From: Andrea Bianco Date: Sat, 29 Jan 2022 15:41:34 +0000 (+0100) Subject: Built motion from commit 766103d3.|2.5.50 X-Git-Url: http://repos.xcallymotion.com/base//%22?a=commitdiff_plain;h=3d99253a31213d03f2ef983b806fe55a14dab477;p=motion2.git Built motion from commit 766103d3.|2.5.50 --- diff --git a/apidoc/api_data.js b/apidoc/api_data.js index dac56d8..96fa16c 100644 --- a/apidoc/api_data.js +++ b/apidoc/api_data.js @@ -13,8 +13,8 @@ define({ "api": [ "name": "getTimezone", "version": "0.0.0", "filename": "server/api/cmHopper/index.js", - "group": "/home/aamorese/v2/motion-v2/server/api/cmHopper/index.js", - "groupTitle": "/home/aamorese/v2/motion-v2/server/api/cmHopper/index.js" + "group": "/Users/andreabianco/Documents/Developments/motion-v2/server/api/cmHopper/index.js", + "groupTitle": "/Users/andreabianco/Documents/Developments/motion-v2/server/api/cmHopper/index.js" }, { "type": "delete", diff --git a/apidoc/api_data.json b/apidoc/api_data.json index 31970f0..4600dba 100644 --- a/apidoc/api_data.json +++ b/apidoc/api_data.json @@ -13,8 +13,8 @@ "name": "getTimezone", "version": "0.0.0", "filename": "server/api/cmHopper/index.js", - "group": "/home/aamorese/v2/motion-v2/server/api/cmHopper/index.js", - "groupTitle": "/home/aamorese/v2/motion-v2/server/api/cmHopper/index.js" + "group": "/Users/andreabianco/Documents/Developments/motion-v2/server/api/cmHopper/index.js", + "groupTitle": "/Users/andreabianco/Documents/Developments/motion-v2/server/api/cmHopper/index.js" }, { "type": "delete", diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1c07133..b8135f8 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-28T14:47:05.044Z", + "time": "2022-01-29T15:12:15.124Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 53612c3..4d810f8 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-28T14:47:05.044Z", + "time": "2022-01-29T15:12:15.124Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/public/app/main/apps/chat/i18n/ar.json b/public/app/main/apps/chat/i18n/ar.json index 8c7e89c..182eac8 100644 --- a/public/app/main/apps/chat/i18n/ar.json +++ b/public/app/main/apps/chat/i18n/ar.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "عنوان REST الخاص بجلسة TVox", "TVOXURL": "عنوان URL IP الخاص بـ TVox", "TVOXUSERNAME": "اسم مستخدم TVox", - "LABELTEXT": "نص التسمية" + "LABELTEXT": "نص التسمية", + "TEXT_BUTTON_COLOR": "لون زر النص" } } diff --git a/public/app/main/apps/chat/i18n/cs.json b/public/app/main/apps/chat/i18n/cs.json index 6967258..6df2c80 100644 --- a/public/app/main/apps/chat/i18n/cs.json +++ b/public/app/main/apps/chat/i18n/cs.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "Adresa URL REST TVox Session", "TVOXURL": "IP adresa TVoxu", "TVOXUSERNAME": "Uživatelské jméno TVox", - "LABELTEXT": "Text štítku" + "LABELTEXT": "Text štítku", + "TEXT_BUTTON_COLOR": "Barva tlačítka textu" } } diff --git a/public/app/main/apps/chat/i18n/da.json b/public/app/main/apps/chat/i18n/da.json index cbbaa2b..8e0ae2e 100644 --- a/public/app/main/apps/chat/i18n/da.json +++ b/public/app/main/apps/chat/i18n/da.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox Session REST Url", "TVOXURL": "TVox IP -URL", "TVOXUSERNAME": "TVox brugernavn", - "LABELTEXT": "Etikettekst" + "LABELTEXT": "Etikettekst", + "TEXT_BUTTON_COLOR": "Farve på tekstknap" } } diff --git a/public/app/main/apps/chat/i18n/de.json b/public/app/main/apps/chat/i18n/de.json index 66c8329..112cad3 100644 --- a/public/app/main/apps/chat/i18n/de.json +++ b/public/app/main/apps/chat/i18n/de.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox-Sitzungs-REST-URL", "TVOXURL": "TVox-IP-URL", "TVOXUSERNAME": "TVox-Benutzername", - "LABELTEXT": "Beschriftungstext" + "LABELTEXT": "Beschriftungstext", + "TEXT_BUTTON_COLOR": "Farbe der Textschaltfläche" } } diff --git a/public/app/main/apps/chat/i18n/es.json b/public/app/main/apps/chat/i18n/es.json index bf8b3ef..591450e 100644 --- a/public/app/main/apps/chat/i18n/es.json +++ b/public/app/main/apps/chat/i18n/es.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "URL de REST de la sesión de TVox", "TVOXURL": "URL de IP de TVox", "TVOXUSERNAME": "Nombre de usuario de TVox", - "LABELTEXT": "Texto de etiqueta" + "LABELTEXT": "Texto de etiqueta", + "TEXT_BUTTON_COLOR": "Color del botón de texto" } } diff --git a/public/app/main/apps/chat/i18n/et.json b/public/app/main/apps/chat/i18n/et.json index 7bac5a9..2f3b48e 100644 --- a/public/app/main/apps/chat/i18n/et.json +++ b/public/app/main/apps/chat/i18n/et.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVoxi seansi REST Url", "TVOXURL": "TVoxi IP -aadress", "TVOXUSERNAME": "TVoxi kasutajanimi", - "LABELTEXT": "Sildi tekst" + "LABELTEXT": "Sildi tekst", + "TEXT_BUTTON_COLOR": "Teksti nupu värv" } } diff --git a/public/app/main/apps/chat/i18n/fa.json b/public/app/main/apps/chat/i18n/fa.json index d74e092..a5f536d 100644 --- a/public/app/main/apps/chat/i18n/fa.json +++ b/public/app/main/apps/chat/i18n/fa.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "نشانی اینترنتی TVox Session REST", "TVOXURL": "آدرس IP TVox", "TVOXUSERNAME": "نام کاربری TVox", - "LABELTEXT": "متن برچسب" + "LABELTEXT": "متن برچسب", + "TEXT_BUTTON_COLOR": "رنگ دکمه متن" } } diff --git a/public/app/main/apps/chat/i18n/fi.json b/public/app/main/apps/chat/i18n/fi.json index 4181bfa..1cc04a3 100644 --- a/public/app/main/apps/chat/i18n/fi.json +++ b/public/app/main/apps/chat/i18n/fi.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox -istunnon REST -URL -osoite", "TVOXURL": "TVoxin IP -osoite", "TVOXUSERNAME": "TVox -käyttäjänimi", - "LABELTEXT": "Merkin teksti" + "LABELTEXT": "Merkin teksti", + "TEXT_BUTTON_COLOR": "Tekstipainikkeen väri" } } diff --git a/public/app/main/apps/chat/i18n/fr.json b/public/app/main/apps/chat/i18n/fr.json index 5817d00..c5c67ca 100644 --- a/public/app/main/apps/chat/i18n/fr.json +++ b/public/app/main/apps/chat/i18n/fr.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "URL REST de la session TVox", "TVOXURL": "URL IP TVox", "TVOXUSERNAME": "Nom d'utilisateur TVox", - "LABELTEXT": "Texte de l'étiquette" + "LABELTEXT": "Texte de l'étiquette", + "TEXT_BUTTON_COLOR": "Couleur du bouton de texte" } } diff --git a/public/app/main/apps/chat/i18n/he.json b/public/app/main/apps/chat/i18n/he.json index 2da5f1c..b10aa27 100644 --- a/public/app/main/apps/chat/i18n/he.json +++ b/public/app/main/apps/chat/i18n/he.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "כתובת אתר מנוחה ל- TVox Session", "TVOXURL": "כתובת ה- IP של TVox", "TVOXUSERNAME": "שם המשתמש של TVox", - "LABELTEXT": "טקסט תווית" + "LABELTEXT": "טקסט תווית", + "TEXT_BUTTON_COLOR": "צבע לחצן טקסט" } } diff --git a/public/app/main/apps/chat/i18n/hi.json b/public/app/main/apps/chat/i18n/hi.json index d2b6bf1..cfe6fe7 100644 --- a/public/app/main/apps/chat/i18n/hi.json +++ b/public/app/main/apps/chat/i18n/hi.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox सत्र REST Url", "TVOXURL": "टीवीओक्स आईपी यूआरएल", "TVOXUSERNAME": "TVox उपयोगकर्ता नाम", - "LABELTEXT": "लेबल टेक्स्ट" + "LABELTEXT": "लेबल टेक्स्ट", + "TEXT_BUTTON_COLOR": "टेक्स्ट बटन का रंग" } } diff --git a/public/app/main/apps/chat/i18n/hu.json b/public/app/main/apps/chat/i18n/hu.json index 6f5d136..dc06d4f 100644 --- a/public/app/main/apps/chat/i18n/hu.json +++ b/public/app/main/apps/chat/i18n/hu.json @@ -485,6 +485,7 @@ "TOOLTIP_SCREENRECORDING_OFF": "Screen Recording available", "DOWNLOAD_WITH_ATTACHMENTS": "Download with attachments", "DOWNLOAD_WITHOUT_ATTACHMENTS": "Download without attachments", - "LABELTEXT": "Címke szövege" + "LABELTEXT": "Címke szövege", + "TEXT_BUTTON_COLOR": "Szöveg gomb színe" } } diff --git a/public/app/main/apps/chat/i18n/id.json b/public/app/main/apps/chat/i18n/id.json index bae9f40..b8a6dee 100644 --- a/public/app/main/apps/chat/i18n/id.json +++ b/public/app/main/apps/chat/i18n/id.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "Url Istirahat Sesi TVox", "TVOXURL": "URL IP TVox", "TVOXUSERNAME": "Nama Pengguna TVox", - "LABELTEXT": "Teks label" + "LABELTEXT": "Teks label", + "TEXT_BUTTON_COLOR": "Warna Tombol Teks" } } diff --git a/public/app/main/apps/chat/i18n/ja.json b/public/app/main/apps/chat/i18n/ja.json index b86d56d..93fc4f0 100644 --- a/public/app/main/apps/chat/i18n/ja.json +++ b/public/app/main/apps/chat/i18n/ja.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVoxセッションRESTUrl", "TVOXURL": "TVox IP URL", "TVOXUSERNAME": "TVoxユーザー名", - "LABELTEXT": "ラベルテキスト" + "LABELTEXT": "ラベルテキスト", + "TEXT_BUTTON_COLOR": "テキストボタンの色" } } diff --git a/public/app/main/apps/chat/i18n/ko.json b/public/app/main/apps/chat/i18n/ko.json index 610197f..cbaf963 100644 --- a/public/app/main/apps/chat/i18n/ko.json +++ b/public/app/main/apps/chat/i18n/ko.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox 세션 REST URL", "TVOXURL": "동방신기 IP URL", "TVOXUSERNAME": "TVox 사용자 이름", - "LABELTEXT": "레이블 텍스트" + "LABELTEXT": "레이블 텍스트", + "TEXT_BUTTON_COLOR": "텍스트 버튼 색상" } } diff --git a/public/app/main/apps/chat/i18n/lt.json b/public/app/main/apps/chat/i18n/lt.json index 76da98e..a72228c 100644 --- a/public/app/main/apps/chat/i18n/lt.json +++ b/public/app/main/apps/chat/i18n/lt.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "„TVox“ sesijos poilsio URL", "TVOXURL": "„TVox“ IP adresas", "TVOXUSERNAME": "„TVox“ vartotojo vardas", - "LABELTEXT": "Etiketės tekstas" + "LABELTEXT": "Etiketės tekstas", + "TEXT_BUTTON_COLOR": "Teksto mygtuko spalva" } } diff --git a/public/app/main/apps/chat/i18n/lv.json b/public/app/main/apps/chat/i18n/lv.json index de95e39..8be1665 100644 --- a/public/app/main/apps/chat/i18n/lv.json +++ b/public/app/main/apps/chat/i18n/lv.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox sesijas REST Url", "TVOXURL": "TVox IP URL", "TVOXUSERNAME": "TVox lietotājvārds", - "LABELTEXT": "Etiķetes teksts" + "LABELTEXT": "Etiķetes teksts", + "TEXT_BUTTON_COLOR": "Teksta pogas krāsa" } } diff --git a/public/app/main/apps/chat/i18n/nl.json b/public/app/main/apps/chat/i18n/nl.json index c9425fe..20f6e0a 100644 --- a/public/app/main/apps/chat/i18n/nl.json +++ b/public/app/main/apps/chat/i18n/nl.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox-sessie REST-URL", "TVOXURL": "TVox IP-URL", "TVOXUSERNAME": "TVox-gebruikersnaam", - "LABELTEXT": "Label tekst" + "LABELTEXT": "Label tekst", + "TEXT_BUTTON_COLOR": "Kleur knop tekst" } } diff --git a/public/app/main/apps/chat/i18n/no.json b/public/app/main/apps/chat/i18n/no.json index eed0849..b1af455 100644 --- a/public/app/main/apps/chat/i18n/no.json +++ b/public/app/main/apps/chat/i18n/no.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox Session REST url", "TVOXURL": "TVox IP -URL", "TVOXUSERNAME": "TVox brukernavn", - "LABELTEXT": "Etiketttekst" + "LABELTEXT": "Etiketttekst", + "TEXT_BUTTON_COLOR": "Farge på tekstknapp" } } diff --git a/public/app/main/apps/chat/i18n/pl.json b/public/app/main/apps/chat/i18n/pl.json index 9fd984a..8567c43 100644 --- a/public/app/main/apps/chat/i18n/pl.json +++ b/public/app/main/apps/chat/i18n/pl.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "Adres URL REST sesji TVox", "TVOXURL": "Adres IP TVox", "TVOXUSERNAME": "Nazwa użytkownika TVox", - "LABELTEXT": "Tekst etykiety" + "LABELTEXT": "Tekst etykiety", + "TEXT_BUTTON_COLOR": "Kolor przycisku tekstowego" } } diff --git a/public/app/main/apps/chat/i18n/pt-BR.json b/public/app/main/apps/chat/i18n/pt-BR.json index ab3bd8a..8a05182 100644 --- a/public/app/main/apps/chat/i18n/pt-BR.json +++ b/public/app/main/apps/chat/i18n/pt-BR.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "Url REST da sessão TVox", "TVOXURL": "URL de TVox IP", "TVOXUSERNAME": "Nome de usuário da TVox", - "LABELTEXT": "Texto da etiqueta" + "LABELTEXT": "Texto da etiqueta", + "TEXT_BUTTON_COLOR": "Cor do botão de texto" } } diff --git a/public/app/main/apps/chat/i18n/pt-PT.json b/public/app/main/apps/chat/i18n/pt-PT.json index cbd4cf0..5e5d199 100644 --- a/public/app/main/apps/chat/i18n/pt-PT.json +++ b/public/app/main/apps/chat/i18n/pt-PT.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "Url REST da sessão TVox", "TVOXURL": "URL de TVox IP", "TVOXUSERNAME": "Nome de usuário da TVox", - "LABELTEXT": "Texto da etiqueta" + "LABELTEXT": "Texto da etiqueta", + "TEXT_BUTTON_COLOR": "Cor do botão de texto" } } diff --git a/public/app/main/apps/chat/i18n/ru.json b/public/app/main/apps/chat/i18n/ru.json index d7d1471..d030305 100644 --- a/public/app/main/apps/chat/i18n/ru.json +++ b/public/app/main/apps/chat/i18n/ru.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "URL-адрес REST для сеанса TVox", "TVOXURL": "IP-адрес TVox", "TVOXUSERNAME": "Имя пользователя TVox", - "LABELTEXT": "Текст ярлыка" + "LABELTEXT": "Текст ярлыка", + "TEXT_BUTTON_COLOR": "Цвет текстовой кнопки" } } diff --git a/public/app/main/apps/chat/i18n/sv.json b/public/app/main/apps/chat/i18n/sv.json index aa4c858..547d7ac 100644 --- a/public/app/main/apps/chat/i18n/sv.json +++ b/public/app/main/apps/chat/i18n/sv.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox Session REST Url", "TVOXURL": "TVox IP -URL", "TVOXUSERNAME": "TVox Användarnamn", - "LABELTEXT": "Etiketttext" + "LABELTEXT": "Etiketttext", + "TEXT_BUTTON_COLOR": "Textknappsfärg" } } diff --git a/public/app/main/apps/chat/i18n/tr.json b/public/app/main/apps/chat/i18n/tr.json index ce8936d..f3492d6 100644 --- a/public/app/main/apps/chat/i18n/tr.json +++ b/public/app/main/apps/chat/i18n/tr.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox Oturumu DİNLENME URL'si", "TVOXURL": "TVox IP URL'si", "TVOXUSERNAME": "Kullanıcı Adı", - "LABELTEXT": "Etiket metni" + "LABELTEXT": "Etiket metni", + "TEXT_BUTTON_COLOR": "Metin Düğmesi Rengi" } } diff --git a/public/app/main/apps/chat/i18n/zh-CN.json b/public/app/main/apps/chat/i18n/zh-CN.json index 5b84bf7..adbbb94 100644 --- a/public/app/main/apps/chat/i18n/zh-CN.json +++ b/public/app/main/apps/chat/i18n/zh-CN.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox 会话 REST 网址", "TVOXURL": "TVox IP 网址", "TVOXUSERNAME": "TVox 用户名", - "LABELTEXT": "标签文字" + "LABELTEXT": "标签文字", + "TEXT_BUTTON_COLOR": "文本按钮颜色" } } diff --git a/public/app/main/apps/chat/i18n/zh-TW.json b/public/app/main/apps/chat/i18n/zh-TW.json index cc64364..bc8240f 100644 --- a/public/app/main/apps/chat/i18n/zh-TW.json +++ b/public/app/main/apps/chat/i18n/zh-TW.json @@ -485,6 +485,7 @@ "TVOXSESSIONURL": "TVox 會話 REST 網址", "TVOXURL": "TVox IP 網址", "TVOXUSERNAME": "TVox 用戶名", - "LABELTEXT": "標籤文字" + "LABELTEXT": "標籤文字", + "TEXT_BUTTON_COLOR": "文本按鈕顏色" } } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 379a9e1..a675af3 100644 --- a/server/api/action/action.attributes.js +++ b/server/api/action/action.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dba=['motionbar','jscripty','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6dba,0x13c));var _0xa6db=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0x6dba[_0x51d129];return _0x44c377;};'use strict';var Sequelize=require(_0xa6db('0x0'));module[_0xa6db('0x1')]={'name':{'type':Sequelize[_0xa6db('0x2')],'get':function(_0x101622){return this[_0xa6db('0x3')](_0xa6db('0x4'));}},'action':{'type':Sequelize[_0xa6db('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xa6db('0x6'),'integration',_0xa6db('0x7'),_0xa6db('0x8'),'urlForward','browser',_0xa6db('0x9'),'script']],'msg':_0xa6db('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xa6db('0xb')},'data2':{'type':Sequelize[_0xa6db('0x5')](0x1000),'comment':_0xa6db('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xa6db('0xd')},'data4':{'type':Sequelize[_0xa6db('0x5')](0x1000),'comments':_0xa6db('0xe')},'data5':{'type':Sequelize[_0xa6db('0x5')](0x1000),'comments':_0xa6db('0xf')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xa6db('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x47aa=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x138830,_0x2b4c51){var _0x3d652c=function(_0x23f56e){while(--_0x23f56e){_0x138830['push'](_0x138830['shift']());}};_0x3d652c(++_0x2b4c51);}(_0x47aa,0x9e));var _0xa47a=function(_0xbb9911,_0x29d55b){_0xbb9911=_0xbb9911-0x0;var _0xb718c6=_0x47aa[_0xbb9911];return _0xb718c6;};'use strict';var Sequelize=require(_0xa47a('0x0'));module[_0xa47a('0x1')]={'name':{'type':Sequelize[_0xa47a('0x2')],'get':function(_0x57fcae){return this[_0xa47a('0x3')]('action');}},'action':{'type':Sequelize[_0xa47a('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xa47a('0x5'),_0xa47a('0x6'),_0xa47a('0x7'),_0xa47a('0x8'),_0xa47a('0x9'),_0xa47a('0xa'),'bot',_0xa47a('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xa47a('0xc')},'data1':{'type':Sequelize[_0xa47a('0x4')](0x1000),'comment':_0xa47a('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xa47a('0xe')},'data3':{'type':Sequelize[_0xa47a('0x4')](0x1000),'comment':_0xa47a('0xf')},'data4':{'type':Sequelize[_0xa47a('0x4')](0x1000),'comments':_0xa47a('0x10')},'data5':{'type':Sequelize[_0xa47a('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0xa47a('0x11')},'data7':{'type':Sequelize[_0xa47a('0x12')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 7e11e46..4aa3f05 100644 --- a/server/api/action/action.controller.js +++ b/server/api/action/action.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bc5=['set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','body','params','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count'];(function(_0x3f636d,_0x5a9125){var _0x7e9e69=function(_0x308803){while(--_0x308803){_0x3f636d['push'](_0x3f636d['shift']());}};_0x7e9e69(++_0x5a9125);}(_0x3bc5,0x123));var _0x53bc=function(_0x12583d,_0x4f8a12){_0x12583d=_0x12583d-0x0;var _0x4eee1d=_0x3bc5[_0x12583d];return _0x4eee1d;};'use strict';var emlformat=require(_0x53bc('0x0'));var rimraf=require(_0x53bc('0x1'));var zipdir=require(_0x53bc('0x2'));var jsonpatch=require(_0x53bc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x53bc('0x4'));var Mustache=require('mustache');var util=require(_0x53bc('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x53bc('0x6'));var ejs=require(_0x53bc('0x7'));var fs=require('fs');var fs_extra=require(_0x53bc('0x8'));var _=require(_0x53bc('0x9'));var squel=require(_0x53bc('0xa'));var crypto=require('crypto');var jsforce=require(_0x53bc('0xb'));var deskjs=require(_0x53bc('0xc'));var toCsv=require(_0x53bc('0x6'));var querystring=require(_0x53bc('0xd'));var Papa=require(_0x53bc('0xe'));var Redis=require(_0x53bc('0xf'));var authService=require(_0x53bc('0x10'));var qs=require(_0x53bc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53bc('0x12'));var logger=require(_0x53bc('0x13'))(_0x53bc('0x14'));var utils=require(_0x53bc('0x15'));var config=require(_0x53bc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x53bc('0x17'))['db'];function respondWithStatusCode(_0x9544d,_0x2f39e4){_0x2f39e4=_0x2f39e4||0xcc;return function(_0x5180c6){if(_0x5180c6){return _0x9544d[_0x53bc('0x18')](_0x2f39e4);}return _0x9544d['status'](_0x2f39e4)[_0x53bc('0x19')]();};}function respondWithResult(_0x36d655,_0xdf4b04){_0xdf4b04=_0xdf4b04||0xc8;return function(_0xc2518b){if(_0xc2518b){return _0x36d655[_0x53bc('0x1a')](_0xdf4b04)[_0x53bc('0x1b')](_0xc2518b);}};}function respondWithFilteredResult(_0xe52eb2,_0x50998f){return function(_0x17d022){if(_0x17d022){var _0x589357=typeof _0x50998f[_0x53bc('0x1c')]===_0x53bc('0x1d')&&typeof _0x50998f['limit']==='undefined';var _0x57faae=_0x17d022[_0x53bc('0x1e')];var _0x807190=_0x589357?0x0:_0x50998f[_0x53bc('0x1c')];var _0x29bdd6=_0x589357?_0x17d022['count']:_0x50998f[_0x53bc('0x1c')]+_0x50998f['limit'];var _0x13ad5f;if(_0x29bdd6>=_0x57faae){_0x29bdd6=_0x57faae;_0x13ad5f=0xc8;}else{_0x13ad5f=0xce;}_0xe52eb2[_0x53bc('0x1a')](_0x13ad5f);return _0xe52eb2[_0x53bc('0x1f')](_0x53bc('0x20'),_0x807190+'-'+_0x29bdd6+'/'+_0x57faae)[_0x53bc('0x1b')](_0x17d022);}return null;};}function patchUpdates(_0x31ab65){return function(_0x138efd){try{jsonpatch[_0x53bc('0x21')](_0x138efd,_0x31ab65,!![]);}catch(_0x5c5090){return BPromise[_0x53bc('0x22')](_0x5c5090);}return _0x138efd[_0x53bc('0x23')]();};}function saveUpdates(_0xf7ca3c,_0x537527){return function(_0x4eee92){if(_0x4eee92){return _0x4eee92[_0x53bc('0x24')](_0xf7ca3c)[_0x53bc('0x25')](function(_0x46d4b0){return _0x46d4b0;});}return null;};}function removeEntity(_0x32a8c3,_0x5c796d){return function(_0x58ff71){if(_0x58ff71){return _0x58ff71[_0x53bc('0x26')]()['then'](function(){_0x32a8c3[_0x53bc('0x1a')](0xcc)[_0x53bc('0x19')]();});}};}function handleEntityNotFound(_0x46e34a,_0x1fe0ce){return function(_0x5f4c3a){if(!_0x5f4c3a){_0x46e34a[_0x53bc('0x18')](0x194);}return _0x5f4c3a;};}function handleError(_0x3913ac,_0x2f28d2){_0x2f28d2=_0x2f28d2||0x1f4;return function(_0x31f357){logger[_0x53bc('0x27')](_0x31f357['stack']);if(_0x31f357[_0x53bc('0x28')]){delete _0x31f357[_0x53bc('0x28')];}_0x3913ac[_0x53bc('0x1a')](_0x2f28d2)[_0x53bc('0x29')](_0x31f357);};}exports[_0x53bc('0x24')]=function(_0x41fa95,_0x2d00a3){if(_0x41fa95[_0x53bc('0x2a')]['id']){delete _0x41fa95['body']['id'];}return db['Action']['find']({'where':{'id':_0x41fa95[_0x53bc('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2d00a3,null))['then'](saveUpdates(_0x41fa95[_0x53bc('0x2a')],null))[_0x53bc('0x25')](respondWithResult(_0x2d00a3,null))[_0x53bc('0x2c')](handleError(_0x2d00a3,null));};exports[_0x53bc('0x26')]=function(_0x128956,_0x19495d){return db[_0x53bc('0x2d')]['find']({'where':{'id':_0x128956[_0x53bc('0x2b')]['id']}})[_0x53bc('0x25')](handleEntityNotFound(_0x19495d,null))['then'](removeEntity(_0x19495d,null))[_0x53bc('0x2c')](handleError(_0x19495d,null));}; \ No newline at end of file +var _0xe8f1=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x30ae7f,_0x2f8e07){var _0x3122cd=function(_0xb7c91b){while(--_0xb7c91b){_0x30ae7f['push'](_0x30ae7f['shift']());}};_0x3122cd(++_0x2f8e07);}(_0xe8f1,0x18c));var _0x1e8f=function(_0x41763a,_0xe1a239){_0x41763a=_0x41763a-0x0;var _0x7b9f9b=_0xe8f1[_0x41763a];return _0x7b9f9b;};'use strict';var emlformat=require(_0x1e8f('0x0'));var rimraf=require(_0x1e8f('0x1'));var zipdir=require(_0x1e8f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1e8f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1e8f('0x4'));var util=require(_0x1e8f('0x5'));var path=require(_0x1e8f('0x6'));var sox=require(_0x1e8f('0x7'));var csv=require(_0x1e8f('0x8'));var ejs=require(_0x1e8f('0x9'));var fs=require('fs');var fs_extra=require(_0x1e8f('0xa'));var _=require('lodash');var squel=require(_0x1e8f('0xb'));var crypto=require('crypto');var jsforce=require(_0x1e8f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1e8f('0x8'));var querystring=require(_0x1e8f('0xd'));var Papa=require('papaparse');var Redis=require(_0x1e8f('0xe'));var authService=require(_0x1e8f('0xf'));var qs=require(_0x1e8f('0x10'));var as=require(_0x1e8f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e8f('0x12'))(_0x1e8f('0x13'));var utils=require('../../config/utils');var config=require(_0x1e8f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e8f('0x15'))['db'];function respondWithStatusCode(_0x343ea5,_0x14ce2e){_0x14ce2e=_0x14ce2e||0xcc;return function(_0x123883){if(_0x123883){return _0x343ea5[_0x1e8f('0x16')](_0x14ce2e);}return _0x343ea5[_0x1e8f('0x17')](_0x14ce2e)[_0x1e8f('0x18')]();};}function respondWithResult(_0x4a3772,_0x3406b1){_0x3406b1=_0x3406b1||0xc8;return function(_0x173d01){if(_0x173d01){return _0x4a3772[_0x1e8f('0x17')](_0x3406b1)[_0x1e8f('0x19')](_0x173d01);}};}function respondWithFilteredResult(_0x53af9f,_0x521d1a){return function(_0x3c501e){if(_0x3c501e){var _0x385a97=typeof _0x521d1a[_0x1e8f('0x1a')]===_0x1e8f('0x1b')&&typeof _0x521d1a[_0x1e8f('0x1c')]===_0x1e8f('0x1b');var _0x5dc88b=_0x3c501e[_0x1e8f('0x1d')];var _0x383e9b=_0x385a97?0x0:_0x521d1a[_0x1e8f('0x1a')];var _0x3732a6=_0x385a97?_0x3c501e['count']:_0x521d1a[_0x1e8f('0x1a')]+_0x521d1a['limit'];var _0x3e7cff;if(_0x3732a6>=_0x5dc88b){_0x3732a6=_0x5dc88b;_0x3e7cff=0xc8;}else{_0x3e7cff=0xce;}_0x53af9f[_0x1e8f('0x17')](_0x3e7cff);return _0x53af9f['set'](_0x1e8f('0x1e'),_0x383e9b+'-'+_0x3732a6+'/'+_0x5dc88b)[_0x1e8f('0x19')](_0x3c501e);}return null;};}function patchUpdates(_0x70ff80){return function(_0x4434b5){try{jsonpatch[_0x1e8f('0x1f')](_0x4434b5,_0x70ff80,!![]);}catch(_0x3dcf7c){return BPromise[_0x1e8f('0x20')](_0x3dcf7c);}return _0x4434b5[_0x1e8f('0x21')]();};}function saveUpdates(_0x3c1e3c,_0xe8090e){return function(_0xfa1f8e){if(_0xfa1f8e){return _0xfa1f8e[_0x1e8f('0x22')](_0x3c1e3c)[_0x1e8f('0x23')](function(_0x4966d3){return _0x4966d3;});}return null;};}function removeEntity(_0x1736ed,_0x5629f6){return function(_0x22687f){if(_0x22687f){return _0x22687f[_0x1e8f('0x24')]()[_0x1e8f('0x23')](function(){_0x1736ed[_0x1e8f('0x17')](0xcc)[_0x1e8f('0x18')]();});}};}function handleEntityNotFound(_0x5e1a14,_0x4d4d28){return function(_0x541e8c){if(!_0x541e8c){_0x5e1a14[_0x1e8f('0x16')](0x194);}return _0x541e8c;};}function handleError(_0xffe53b,_0x51ba5a){_0x51ba5a=_0x51ba5a||0x1f4;return function(_0x2769ca){logger[_0x1e8f('0x25')](_0x2769ca[_0x1e8f('0x26')]);if(_0x2769ca[_0x1e8f('0x27')]){delete _0x2769ca[_0x1e8f('0x27')];}_0xffe53b[_0x1e8f('0x17')](_0x51ba5a)[_0x1e8f('0x28')](_0x2769ca);};}exports[_0x1e8f('0x22')]=function(_0x53fcac,_0x465b00){if(_0x53fcac[_0x1e8f('0x29')]['id']){delete _0x53fcac[_0x1e8f('0x29')]['id'];}return db[_0x1e8f('0x2a')][_0x1e8f('0x2b')]({'where':{'id':_0x53fcac[_0x1e8f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x465b00,null))['then'](saveUpdates(_0x53fcac[_0x1e8f('0x29')],null))[_0x1e8f('0x23')](respondWithResult(_0x465b00,null))[_0x1e8f('0x2d')](handleError(_0x465b00,null));};exports[_0x1e8f('0x24')]=function(_0x14e01f,_0x3fef72){return db[_0x1e8f('0x2a')][_0x1e8f('0x2b')]({'where':{'id':_0x14e01f[_0x1e8f('0x2c')]['id']}})[_0x1e8f('0x23')](handleEntityNotFound(_0x3fef72,null))[_0x1e8f('0x23')](removeEntity(_0x3fef72,null))[_0x1e8f('0x2d')](handleError(_0x3fef72,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index e5227f7..f128ecc 100644 --- a/server/api/action/action.model.js +++ b/server/api/action/action.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3dde=['Action','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','define'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0x3dde,0x14b));var _0xe3dd=function(_0x20913c,_0x28e54e){_0x20913c=_0x20913c-0x0;var _0x4fcb7b=_0x3dde[_0x20913c];return _0x4fcb7b;};'use strict';var _=require('lodash');var util=require(_0xe3dd('0x0'));var logger=require(_0xe3dd('0x1'))(_0xe3dd('0x2'));var moment=require(_0xe3dd('0x3'));var BPromise=require(_0xe3dd('0x4'));var rp=require(_0xe3dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3dd('0x6'));var config=require(_0xe3dd('0x7'));var attributes=require(_0xe3dd('0x8'));module['exports']=function(_0x1e3b98,_0x46b52e){return _0x1e3b98[_0xe3dd('0x9')](_0xe3dd('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9fd=['rimraf','../../config/environment','./action.attributes','exports','define','util','../../config/logger','api','moment','path'];(function(_0x4bbece,_0x44dd1a){var _0x3633ba=function(_0x16fd97){while(--_0x16fd97){_0x4bbece['push'](_0x4bbece['shift']());}};_0x3633ba(++_0x44dd1a);}(_0xf9fd,0x14f));var _0xdf9f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9fd[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xdf9f('0x0'));var logger=require(_0xdf9f('0x1'))(_0xdf9f('0x2'));var moment=require(_0xdf9f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf9f('0x4'));var rimraf=require(_0xdf9f('0x5'));var config=require(_0xdf9f('0x6'));var attributes=require(_0xdf9f('0x7'));module[_0xdf9f('0x8')]=function(_0x549031,_0x4734df){return _0x549031[_0xdf9f('0x9')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index aa34b6d..862c251 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5f0b03,_0x2ca25f){var _0x275ff4=function(_0x17327d){while(--_0x17327d){_0x5f0b03['push'](_0x5f0b03['shift']());}};_0x275ff4(++_0x2ca25f);}(_0x326f,0xd1));var _0xf326=function(_0xcf2dbf,_0x1bb5f9){_0xcf2dbf=_0xcf2dbf-0x0;var _0x305e51=_0x326f[_0xcf2dbf];return _0x305e51;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x53ec,0x192));var _0xc53e=function(_0x2fcd90,_0x4780cc){_0x2fcd90=_0x2fcd90-0x0;var _0x55b596=_0x53ec[_0x2fcd90];return _0x55b596;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 1e0b321..e4d6af7 100644 --- a/server/api/action/index.js +++ b/server/api/action/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0b9=['destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated'];(function(_0x384ba8,_0x46b995){var _0x247d55=function(_0xabb008){while(--_0xabb008){_0x384ba8['push'](_0x384ba8['shift']());}};_0x247d55(++_0x46b995);}(_0xf0b9,0x120));var _0x9f0b=function(_0x2f3fe7,_0x5c162a){_0x2f3fe7=_0x2f3fe7-0x0;var _0x2aa959=_0xf0b9[_0x2f3fe7];return _0x2aa959;};'use strict';var multer=require('multer');var util=require(_0x9f0b('0x0'));var path=require(_0x9f0b('0x1'));var timeout=require(_0x9f0b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9f0b('0x3'));var interaction=require(_0x9f0b('0x4'));var config=require('../../config/environment');var controller=require(_0x9f0b('0x5'));router[_0x9f0b('0x6')](_0x9f0b('0x7'),auth[_0x9f0b('0x8')](),controller['update']);router['delete']('/:id',auth[_0x9f0b('0x8')](),controller[_0x9f0b('0x9')]);module[_0x9f0b('0xa')]=router; \ No newline at end of file +var _0xfcd1=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update'];(function(_0x374383,_0x4481c4){var _0x37f308=function(_0xf7927){while(--_0xf7927){_0x374383['push'](_0x374383['shift']());}};_0x37f308(++_0x4481c4);}(_0xfcd1,0x1e3));var _0x1fcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfcd1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1fcd('0x0'));var util=require(_0x1fcd('0x1'));var path=require(_0x1fcd('0x2'));var timeout=require(_0x1fcd('0x3'));var express=require(_0x1fcd('0x4'));var router=express['Router']();var fs_extra=require(_0x1fcd('0x5'));var auth=require(_0x1fcd('0x6'));var interaction=require(_0x1fcd('0x7'));var config=require(_0x1fcd('0x8'));var controller=require(_0x1fcd('0x9'));router[_0x1fcd('0xa')]('/:id',auth[_0x1fcd('0xb')](),controller[_0x1fcd('0xc')]);router[_0x1fcd('0xd')]('/:id',auth[_0x1fcd('0xb')](),controller[_0x1fcd('0xe')]);module[_0x1fcd('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 37f5728..e8bdb8f 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x524ea7,_0x4e68a0){var _0x432c7c=function(_0x3991f5){while(--_0x3991f5){_0x524ea7['push'](_0x524ea7['shift']());}};_0x432c7c(++_0x4e68a0);}(_0xe14b,0x93));var _0xbe14=function(_0x15ba85,_0x3e481e){_0x15ba85=_0x15ba85-0x0;var _0x194ae5=_0xe14b[_0x15ba85];return _0x194ae5;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file +var _0x71ab=['TEXT','exports','STRING'];(function(_0x2cf2f3,_0x5af528){var _0x436d75=function(_0x522924){while(--_0x522924){_0x2cf2f3['push'](_0x2cf2f3['shift']());}};_0x436d75(++_0x5af528);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 0c1bdb4..e5b08c4 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.controller.js +++ b/server/api/analyticCustomReport/analyticCustomReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98d0=['groupBy','orderBy','DESC','alias','joins','%s.%s\x20=\x20%s.%s','parentKey','foreignTable','foreignKey','conditions','parse','clone','Limited\x20Query:','sequelize','toString','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','SEC_TO_TIME(%s)','metric','output','web','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','../../files/reports','savename','countTable','QueryTypes','run','runReport','cross_join','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','params','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','preview','join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format'];(function(_0x33fe50,_0x1464c8){var _0x20b544=function(_0x9becc5){while(--_0x9becc5){_0x33fe50['push'](_0x33fe50['shift']());}};_0x20b544(++_0x1464c8);}(_0x98d0,0x171));var _0x098d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x98d0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x098d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x098d('0x1'));var jsonpatch=require(_0x098d('0x2'));var rp=require(_0x098d('0x3'));var moment=require(_0x098d('0x4'));var BPromise=require(_0x098d('0x5'));var Mustache=require(_0x098d('0x6'));var util=require('util');var path=require(_0x098d('0x7'));var sox=require(_0x098d('0x8'));var csv=require(_0x098d('0x9'));var ejs=require(_0x098d('0xa'));var fs=require('fs');var fs_extra=require(_0x098d('0xb'));var _=require(_0x098d('0xc'));var squel=require(_0x098d('0xd'));var crypto=require(_0x098d('0xe'));var jsforce=require(_0x098d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x098d('0x9'));var querystring=require(_0x098d('0x10'));var Papa=require(_0x098d('0x11'));var Redis=require(_0x098d('0x12'));var authService=require(_0x098d('0x13'));var qs=require(_0x098d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x098d('0x15'));var logger=require(_0x098d('0x16'))(_0x098d('0x17'));var utils=require(_0x098d('0x18'));var config=require(_0x098d('0x19'));var licenseUtil=require(_0x098d('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require(_0x098d('0x1b'))[_0x098d('0x1c')];function respondWithStatusCode(_0xdd711f,_0x2689ec){_0x2689ec=_0x2689ec||0xcc;return function(_0x12aa46){if(_0x12aa46){return _0xdd711f[_0x098d('0x1d')](_0x2689ec);}return _0xdd711f[_0x098d('0x1e')](_0x2689ec)[_0x098d('0x1f')]();};}function respondWithResult(_0x115d95,_0xdb05ac){_0xdb05ac=_0xdb05ac||0xc8;return function(_0x27bf6d){if(_0x27bf6d){return _0x115d95[_0x098d('0x1e')](_0xdb05ac)[_0x098d('0x20')](_0x27bf6d);}};}function respondWithFilteredResult(_0x5a1439,_0x4d821e){return function(_0x46e0e3){if(_0x46e0e3){var _0x48d28d=typeof _0x4d821e['offset']===_0x098d('0x21')&&typeof _0x4d821e[_0x098d('0x22')]===_0x098d('0x21');var _0x20de8c=_0x46e0e3[_0x098d('0x23')];var _0x5191e2=_0x48d28d?0x0:_0x4d821e[_0x098d('0x24')];var _0x5db83e=_0x48d28d?_0x46e0e3[_0x098d('0x23')]:_0x4d821e[_0x098d('0x24')]+_0x4d821e[_0x098d('0x22')];var _0x362a42;if(_0x5db83e>=_0x20de8c){_0x5db83e=_0x20de8c;_0x362a42=0xc8;}else{_0x362a42=0xce;}_0x5a1439[_0x098d('0x1e')](_0x362a42);return _0x5a1439['set'](_0x098d('0x25'),_0x5191e2+'-'+_0x5db83e+'/'+_0x20de8c)['json'](_0x46e0e3);}return null;};}function patchUpdates(_0x106a51){return function(_0xb26449){try{jsonpatch[_0x098d('0x26')](_0xb26449,_0x106a51,!![]);}catch(_0x2ef447){return BPromise[_0x098d('0x27')](_0x2ef447);}return _0xb26449[_0x098d('0x28')]();};}function saveUpdates(_0x6432f6,_0x4e4d98){return function(_0x42176e){if(_0x42176e){return _0x42176e[_0x098d('0x29')](_0x6432f6)[_0x098d('0x2a')](function(_0x11e277){return _0x11e277;});}return null;};}function removeEntity(_0x330f4f,_0xf65f95){return function(_0x4dfc5b){if(_0x4dfc5b){return _0x4dfc5b[_0x098d('0x2b')]()[_0x098d('0x2a')](function(){var _0x3a6cc6=_0x4dfc5b[_0x098d('0x2c')]({'plain':!![]});var _0x5bf122=_0x098d('0x2d');return db[_0x098d('0x2e')][_0x098d('0x2b')]({'where':{'type':_0x5bf122,'resourceId':_0x3a6cc6['id']}})['then'](function(){return _0x4dfc5b;});})[_0x098d('0x2a')](function(){_0x330f4f[_0x098d('0x1e')](0xcc)[_0x098d('0x1f')]();});}};}function handleEntityNotFound(_0x374a2e,_0x48fda2){return function(_0x578015){if(!_0x578015){_0x374a2e[_0x098d('0x1d')](0x194);}return _0x578015;};}function handleError(_0x4f9615,_0x4ef185){_0x4ef185=_0x4ef185||0x1f4;return function(_0x387762){logger[_0x098d('0x2f')](_0x387762[_0x098d('0x30')]);if(_0x387762[_0x098d('0x31')]){delete _0x387762[_0x098d('0x31')];}_0x4f9615[_0x098d('0x1e')](_0x4ef185)[_0x098d('0x32')](_0x387762);};}exports['index']=function(_0xfd7cbc,_0x32172c){var _0x1cbcd6={},_0x18a2e6={},_0xef4538={'count':0x0,'rows':[]};var _0x1ab390=_[_0x098d('0x33')](db[_0x098d('0x34')][_0x098d('0x35')],function(_0xaf3ef3){return{'name':_0xaf3ef3[_0x098d('0x36')],'type':_0xaf3ef3[_0x098d('0x37')][_0x098d('0x38')]};});_0x18a2e6['model']=_[_0x098d('0x33')](_0x1ab390,_0x098d('0x31'));_0x18a2e6[_0x098d('0x39')]=_[_0x098d('0x3a')](_0xfd7cbc[_0x098d('0x39')]);_0x18a2e6[_0x098d('0x3b')]=_['intersection'](_0x18a2e6['model'],_0x18a2e6[_0x098d('0x39')]);_0x1cbcd6['attributes']=_[_0x098d('0x3c')](_0x18a2e6[_0x098d('0x3d')],qs[_0x098d('0x3e')](_0xfd7cbc[_0x098d('0x39')][_0x098d('0x3e')]));_0x1cbcd6['attributes']=_0x1cbcd6[_0x098d('0x3f')]['length']?_0x1cbcd6[_0x098d('0x3f')]:_0x18a2e6[_0x098d('0x3d')];if(!_0xfd7cbc[_0x098d('0x39')]['hasOwnProperty']('nolimit')){_0x1cbcd6[_0x098d('0x22')]=qs[_0x098d('0x22')](_0xfd7cbc['query']['limit']);_0x1cbcd6['offset']=qs['offset'](_0xfd7cbc['query']['offset']);}_0x1cbcd6[_0x098d('0x40')]=qs['sort'](_0xfd7cbc[_0x098d('0x39')][_0x098d('0x41')]);_0x1cbcd6[_0x098d('0x42')]=qs[_0x098d('0x3b')](_[_0x098d('0x43')](_0xfd7cbc['query'],_0x18a2e6['filters']),_0x1ab390);if(_0xfd7cbc[_0x098d('0x39')]['filter']){_0x1cbcd6['where']=_[_0x098d('0x44')](_0x1cbcd6['where'],{'$or':_['map'](_0x1ab390,function(_0x262471){if(_0x262471[_0x098d('0x37')]!==_0x098d('0x45')){var _0xb73456={};_0xb73456[_0x262471[_0x098d('0x31')]]={'$like':'%'+_0xfd7cbc[_0x098d('0x39')][_0x098d('0x46')]+'%'};return _0xb73456;}})});}_0x1cbcd6=_[_0x098d('0x44')]({},_0x1cbcd6,_0xfd7cbc[_0x098d('0x47')]);var _0x354c22={'where':_0x1cbcd6['where']};return db[_0x098d('0x34')]['count'](_0x354c22)[_0x098d('0x2a')](function(_0x57ab1f){_0xef4538['count']=_0x57ab1f;if(_0xfd7cbc[_0x098d('0x39')]['includeAll']){_0x1cbcd6[_0x098d('0x48')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x098d('0x49')](_0x1cbcd6);})[_0x098d('0x2a')](function(_0x49b857){_0xef4538[_0x098d('0x4a')]=_0x49b857;return _0xef4538;})[_0x098d('0x2a')](respondWithFilteredResult(_0x32172c,_0x1cbcd6))['catch'](handleError(_0x32172c,null));};exports['show']=function(_0x404611,_0x2f7b54){var _0x456322={'raw':![],'where':{'id':_0x404611[_0x098d('0x4b')]['id']}},_0x9dce41={};_0x9dce41['model']=_['keys'](db[_0x098d('0x34')][_0x098d('0x35')]);_0x9dce41[_0x098d('0x39')]=_['keys'](_0x404611['query']);_0x9dce41['filters']=_[_0x098d('0x3c')](_0x9dce41[_0x098d('0x3d')],_0x9dce41[_0x098d('0x39')]);_0x456322[_0x098d('0x3f')]=_[_0x098d('0x3c')](_0x9dce41[_0x098d('0x3d')],qs[_0x098d('0x3e')](_0x404611['query']['fields']));_0x456322[_0x098d('0x3f')]=_0x456322[_0x098d('0x3f')][_0x098d('0x4c')]?_0x456322['attributes']:_0x9dce41[_0x098d('0x3d')];if(_0x404611[_0x098d('0x39')][_0x098d('0x4d')]){_0x456322[_0x098d('0x48')]=[{'all':!![]}];}_0x456322=_['merge']({},_0x456322,_0x404611[_0x098d('0x47')]);return db[_0x098d('0x34')][_0x098d('0x4e')](_0x456322)['then'](handleEntityNotFound(_0x2f7b54,null))['then'](respondWithResult(_0x2f7b54,null))[_0x098d('0x4f')](handleError(_0x2f7b54,null));};exports[_0x098d('0x50')]=function(_0x81ff6b,_0x5e99af){return db[_0x098d('0x34')][_0x098d('0x50')](_0x81ff6b[_0x098d('0x51')],{})[_0x098d('0x2a')](function(_0x27fe95){var _0x9e5940=_0x81ff6b[_0x098d('0x52')][_0x098d('0x2c')]({'plain':!![]});if(!_0x9e5940)throw new Error(_0x098d('0x53'));if(_0x9e5940[_0x098d('0x54')]===_0x098d('0x52')){var _0x4853ec=_0x27fe95[_0x098d('0x2c')]({'plain':!![]});var _0x5ee846='Reports';return db[_0x098d('0x55')]['find']({'where':{'name':_0x5ee846,'userProfileId':_0x9e5940['userProfileId']},'raw':!![]})[_0x098d('0x2a')](function(_0x12a60a){if(_0x12a60a&&_0x12a60a[_0x098d('0x56')]===0x0){return db[_0x098d('0x2e')][_0x098d('0x50')]({'name':_0x4853ec[_0x098d('0x31')],'resourceId':_0x4853ec['id'],'type':'CustomReports','sectionId':_0x12a60a['id']},{})[_0x098d('0x2a')](function(){return _0x27fe95;});}else{return _0x27fe95;}})[_0x098d('0x4f')](function(_0x2b4d72){logger[_0x098d('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4d72);throw _0x2b4d72;});}return _0x27fe95;})[_0x098d('0x2a')](respondWithResult(_0x5e99af,0xc9))[_0x098d('0x4f')](handleError(_0x5e99af,null));};exports[_0x098d('0x29')]=function(_0x1c560c,_0x29cef8){if(_0x1c560c[_0x098d('0x51')]['id']){delete _0x1c560c[_0x098d('0x51')]['id'];}return db[_0x098d('0x34')][_0x098d('0x4e')]({'where':{'id':_0x1c560c[_0x098d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x29cef8,null))[_0x098d('0x2a')](saveUpdates(_0x1c560c[_0x098d('0x51')],null))[_0x098d('0x2a')](respondWithResult(_0x29cef8,null))[_0x098d('0x4f')](handleError(_0x29cef8,null));};exports['destroy']=function(_0x3fbf01,_0x56d254){return db[_0x098d('0x34')][_0x098d('0x4e')]({'where':{'id':_0x3fbf01['params']['id']}})[_0x098d('0x2a')](handleEntityNotFound(_0x56d254,null))['then'](removeEntity(_0x56d254,null))[_0x098d('0x4f')](handleError(_0x56d254,null));};exports[_0x098d('0x57')]=function(_0x2cfab1,_0x4ea36b){var _0x2cf928=0xa;var _0x29b168=[_0x098d('0x58'),'left_join','right_join','cross_join'];var _0x295a8e={'SUM':'SUM(%s)','COUNT':_0x098d('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x098d('0x5a'),'MIN':_0x098d('0x5b'),'AVG':_0x098d('0x5c'),'GROUP_CONCAT':_0x098d('0x5d'),'GROUP_CONCAT ASC':_0x098d('0x5e'),'GROUP_CONCAT DESC':_0x098d('0x5f')};var _0x1dd217={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x098d('0x60'),'HOUR':_0x098d('0x61'),'ROUND':_0x098d('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x10a7b7=function(_0x2c8701){return!_[_0x098d('0x63')]([_0x098d('0x64'),_0x098d('0x65'),_0x098d('0x66'),_0x098d('0x67')],_0x2c8701);};var _0x4f46b4=function(_0x236322){if(!_0x236322||!_0x236322[_0x098d('0x68')][_0x098d('0x4c')]){return'';}for(var _0x3cee57='(',_0x365969=0x0;_0x365969<_0x236322[_0x098d('0x68')][_0x098d('0x4c')];_0x365969+=0x1){_0x365969>0x0&&(_0x3cee57+='\x20'+_0x236322[_0x098d('0x69')]+'\x20');_0x3cee57+=_0x236322[_0x098d('0x68')][_0x365969][_0x098d('0x6a')]?_0x4f46b4(_0x236322[_0x098d('0x68')][_0x365969]['group']):_0x236322[_0x098d('0x68')][_0x365969][_0x098d('0x6b')]+'\x20'+_0x236322[_0x098d('0x68')][_0x365969][_0x098d('0x6c')]+(_0x10a7b7(_0x236322[_0x098d('0x68')][_0x365969][_0x098d('0x6c')])?'\x20'+_0x236322[_0x098d('0x68')][_0x365969][_0x098d('0x6d')]:'');}return _0x3cee57+')';};var _0x47a455={'where':{'id':_0x2cfab1[_0x098d('0x4b')]['id']}},_0x16dc6f,_0x20c36c,_0x5700dc,_0x9c048f,_0x72a09e;_0x47a455=_['merge']({},_0x47a455,_0x2cfab1['options']);return db[_0x098d('0x34')]['find'](_0x47a455)[_0x098d('0x2a')](function(_0x12f452){if(_0x12f452){_0x16dc6f=_0x12f452;return _0x12f452[_0x098d('0x6e')]();}return null;})['then'](function(_0x3dc669){if(_0x3dc669){if(!_0x3dc669[_0x098d('0x4c')]){throw new db[(_0x098d('0x6f'))][(_0x098d('0x70'))](_0x098d('0x71'),0x193);}_0x20c36c=_0x3dc669;return db[_0x098d('0x72')][_0x098d('0x49')]({'raw':!![]});}return null;})['then'](function(_0x56d75f){if(_0x56d75f){_0x5700dc=_[_0x098d('0x73')](_0x56d75f,'id');var _0x16cc3d;var _0x59fd6d=squel[_0x098d('0x74')]();_0x59fd6d[_0x098d('0x75')](_0x16dc6f[_0x098d('0x76')]);for(var _0x33df65=0x0;_0x33df65<_0x20c36c['length'];_0x33df65+=0x1){_0x16cc3d=_0x20c36c[_0x33df65]['MetricId']?_0x5700dc[_0x20c36c[_0x33df65][_0x098d('0x77')]]['metric']:_0x20c36c[_0x33df65]['field'];_0x16cc3d=_0x20c36c[_0x33df65][_0x098d('0x78')]?_[_0x098d('0x79')](_0x295a8e[_0x20c36c[_0x33df65][_0x098d('0x78')]],'%s',_0x16cc3d):_0x16cc3d;_0x16cc3d=_0x20c36c[_0x33df65][_0x098d('0x7a')]?_[_0x098d('0x79')](_0x1dd217[_0x20c36c[_0x33df65]['format']],'%s',_0x16cc3d):_0x16cc3d;if(_0x20c36c[_0x33df65][_0x098d('0x7b')]){_0x59fd6d[_0x098d('0x6a')](_0x16cc3d);}_0x20c36c[_0x33df65][_0x098d('0x7c')]&&_0x59fd6d['order'](_0x16cc3d,_0x20c36c[_0x33df65]['orderBy']===_0x098d('0x7d')?![]:!![]);_0x59fd6d[_0x098d('0x6b')](_0x16cc3d,_0x20c36c[_0x33df65][_0x098d('0x7e')]||_0x16cc3d);}if(_0x16dc6f[_0x098d('0x7f')]){_0x16dc6f[_0x098d('0x7f')]=JSON['parse'](_0x16dc6f[_0x098d('0x7f')]);for(var _0x5d79a9=0x0;_0x5d79a9<_0x16dc6f['joins'][_0x098d('0x4c')];_0x5d79a9+=0x1){if(_0x16dc6f[_0x098d('0x7f')][_0x5d79a9]['type']&&_[_0x098d('0x63')](_0x29b168,_0x16dc6f[_0x098d('0x7f')][_0x5d79a9][_0x098d('0x37')])&&_0x16dc6f['joins'][_0x5d79a9]['parentKey']&&_0x16dc6f[_0x098d('0x7f')][_0x5d79a9]['foreignTable']&&_0x16dc6f['joins'][_0x5d79a9]['foreignKey']){_0x59fd6d[_0x16dc6f['joins'][_0x5d79a9][_0x098d('0x37')]](_0x16dc6f[_0x098d('0x7f')][_0x5d79a9]['foreignTable'],null,util[_0x098d('0x7a')](_0x098d('0x80'),_0x16dc6f[_0x098d('0x76')],_0x16dc6f['joins'][_0x5d79a9][_0x098d('0x81')],_0x16dc6f[_0x098d('0x7f')][_0x5d79a9][_0x098d('0x82')],_0x16dc6f[_0x098d('0x7f')][_0x5d79a9][_0x098d('0x83')]));}}}if(_0x16dc6f['conditions']){_0x16dc6f[_0x098d('0x84')]=JSON[_0x098d('0x85')](_0x16dc6f[_0x098d('0x84')]);_0x59fd6d[_0x098d('0x42')](_0x4f46b4(_0x16dc6f[_0x098d('0x84')]['group']));}_0x72a09e=_0x59fd6d[_0x098d('0x86')]();_0x59fd6d[_0x098d('0x22')](_0x2cf928);_0x59fd6d[_0x098d('0x24')](0x0);logger['debug'](_0x098d('0x87'),_0x59fd6d['toString']());return dbH[_0x098d('0x88')][_0x098d('0x39')](_0x59fd6d[_0x098d('0x89')](),{'type':dbH['sequelize']['QueryTypes'][_0x098d('0x8a')]});}})['then'](respondWithResult(_0x4ea36b,null))[_0x098d('0x4f')](handleError(_0x4ea36b,null));};function runReport(_0x1e956d,_0x37cdc7,_0x11e5b6){var _0x2deb90=_0x37cdc7[_0x098d('0x31')];var _0x2b2f6a=0xa;var _0x315bf8=[_0x098d('0x58'),'left_join','right_join','cross_join'];var _0x615a32={'SUM':_0x098d('0x8b'),'COUNT':_0x098d('0x59'),'COUNT DISTINCT':_0x098d('0x8c'),'MAX':'MAX(%s)','MIN':_0x098d('0x5b'),'AVG':_0x098d('0x5c'),'GROUP_CONCAT':_0x098d('0x5d'),'GROUP_CONCAT ASC':_0x098d('0x5e'),'GROUP_CONCAT DESC':_0x098d('0x5f')};var _0xc29d15={'SEC_TO_TIME':_0x098d('0x8d'),'DATE':_0x098d('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x098d('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23293b=function(_0x4173b4){return!_[_0x098d('0x63')]([_0x098d('0x64'),_0x098d('0x65'),'IS\x20EMPTY',_0x098d('0x67')],_0x4173b4);};var _0x5c2ec6=function(_0x574947){if(!_0x574947||!_0x574947['rules']['length']){return'';}for(var _0x36315a='(',_0x2f62f9=0x0;_0x2f62f9<_0x574947[_0x098d('0x68')][_0x098d('0x4c')];_0x2f62f9+=0x1){_0x2f62f9>0x0&&(_0x36315a+='\x20'+_0x574947[_0x098d('0x69')]+'\x20');_0x36315a+=_0x574947[_0x098d('0x68')][_0x2f62f9][_0x098d('0x6a')]?_0x5c2ec6(_0x574947['rules'][_0x2f62f9][_0x098d('0x6a')]):_0x574947[_0x098d('0x68')][_0x2f62f9][_0x098d('0x6b')]+'\x20'+_0x574947[_0x098d('0x68')][_0x2f62f9][_0x098d('0x6c')]+(_0x23293b(_0x574947[_0x098d('0x68')][_0x2f62f9]['condition'])?'\x20'+_0x574947[_0x098d('0x68')][_0x2f62f9][_0x098d('0x6d')]:'');}return _0x36315a+')';};var _0x355b46={'where':{'id':_0x1e956d['id']}},_0x270acd,_0x422a3a,_0x400528,_0x2f7393,_0x32f24a;_0x355b46=_[_0x098d('0x44')]({},_0x355b46,_0x11e5b6);return db[_0x098d('0x34')][_0x098d('0x4e')](_0x355b46)[_0x098d('0x2a')](function(_0x2f5532){if(_0x2f5532){_0x270acd=_0x2f5532;return _0x2f5532[_0x098d('0x6e')]();}return null;})[_0x098d('0x2a')](function(_0x2e1a0e){if(_0x2e1a0e){if(!_0x2e1a0e[_0x098d('0x4c')]){throw new db['Sequelize'][(_0x098d('0x70'))](_0x098d('0x71'),0x193);}_0x422a3a=_0x2e1a0e;return db[_0x098d('0x72')][_0x098d('0x49')]({'raw':!![]});}return null;})[_0x098d('0x2a')](function(_0x250456){if(_0x250456){_0x400528=_[_0x098d('0x73')](_0x250456,'id');var _0x34ec93;var _0x27817c=squel['select']();_0x27817c['from'](_0x270acd['table']);for(var _0x26403a=0x0;_0x26403a<_0x422a3a[_0x098d('0x4c')];_0x26403a+=0x1){_0x34ec93=_0x422a3a[_0x26403a][_0x098d('0x77')]?_0x400528[_0x422a3a[_0x26403a][_0x098d('0x77')]][_0x098d('0x8e')]:_0x422a3a[_0x26403a][_0x098d('0x6b')];_0x34ec93=_0x422a3a[_0x26403a]['function']?_[_0x098d('0x79')](_0x615a32[_0x422a3a[_0x26403a]['function']],'%s',_0x34ec93):_0x34ec93;_0x34ec93=_0x422a3a[_0x26403a][_0x098d('0x7a')]?_[_0x098d('0x79')](_0xc29d15[_0x422a3a[_0x26403a][_0x098d('0x7a')]],'%s',_0x34ec93):_0x34ec93;if(_0x422a3a[_0x26403a][_0x098d('0x7b')]){_0x27817c[_0x098d('0x6a')](_0x34ec93);}_0x422a3a[_0x26403a]['orderBy']&&_0x27817c[_0x098d('0x40')](_0x34ec93,_0x422a3a[_0x26403a][_0x098d('0x7c')]===_0x098d('0x7d')?![]:!![]);_0x27817c[_0x098d('0x6b')](_0x34ec93,_0x422a3a[_0x26403a][_0x098d('0x7e')]||_0x34ec93);}if(_0x270acd['joins']){_0x270acd[_0x098d('0x7f')]=JSON[_0x098d('0x85')](_0x270acd[_0x098d('0x7f')]);for(var _0xd43dc0=0x0;_0xd43dc0<_0x270acd[_0x098d('0x7f')][_0x098d('0x4c')];_0xd43dc0+=0x1){if(_0x270acd[_0x098d('0x7f')][_0xd43dc0]['type']&&_[_0x098d('0x63')](_0x315bf8,_0x270acd['joins'][_0xd43dc0][_0x098d('0x37')])&&_0x270acd[_0x098d('0x7f')][_0xd43dc0][_0x098d('0x81')]&&_0x270acd[_0x098d('0x7f')][_0xd43dc0][_0x098d('0x82')]&&_0x270acd[_0x098d('0x7f')][_0xd43dc0][_0x098d('0x83')]){_0x27817c[_0x270acd[_0x098d('0x7f')][_0xd43dc0][_0x098d('0x37')]](_0x270acd[_0x098d('0x7f')][_0xd43dc0][_0x098d('0x82')],null,util['format'](_0x098d('0x80'),_0x270acd['table'],_0x270acd[_0x098d('0x7f')][_0xd43dc0][_0x098d('0x81')],_0x270acd[_0x098d('0x7f')][_0xd43dc0][_0x098d('0x82')],_0x270acd[_0x098d('0x7f')][_0xd43dc0][_0x098d('0x83')]));}}}if(_0x270acd[_0x098d('0x84')]){_0x270acd[_0x098d('0x84')]=JSON[_0x098d('0x85')](_0x270acd['conditions']);_0x27817c[_0x098d('0x42')](_0x5c2ec6(_0x270acd[_0x098d('0x84')][_0x098d('0x6a')]));}_0x32f24a=_0x27817c[_0x098d('0x86')]();_0x27817c[_0x098d('0x22')](_0x2b2f6a);_0x27817c[_0x098d('0x24')](0x0);return;}})[_0x098d('0x2a')](function(){if(_0x37cdc7[_0x098d('0x8f')]===_0x098d('0x90')){return null;}var _0x56e2e4=_[_0x098d('0x44')](_0x37cdc7,{'name':_0x37cdc7['fullPath']||_0x37cdc7[_0x098d('0x31')]||_0x270acd[_0x098d('0x31')],'basename':_0x2deb90,'savename':util[_0x098d('0x7a')](_0x098d('0x91'),_0x37cdc7[_0x098d('0x31')]||_0x270acd['name'],require(_0x098d('0x92'))[_0x098d('0x93')](0x4),_0x37cdc7[_0x098d('0x8f')]||_0x098d('0x94')),'reportId':_0x270acd['id'],'reportType':_0x098d('0x95')});return db[_0x098d('0x96')][_0x098d('0x50')](_0x56e2e4,{'raw':!![]});})['then'](function(_0x2548e4){if(_0x270acd[_0x098d('0x76')]==='cdr'){_0x32f24a[_0x098d('0x42')](_0x270acd[_0x098d('0x76')]+_0x098d('0x97'),_0x37cdc7[_0x098d('0x98')],_0x37cdc7[_0x098d('0x99')]);}else{_0x32f24a['where'](_0x270acd[_0x098d('0x76')]+_0x098d('0x9a'),_0x37cdc7[_0x098d('0x98')],_0x37cdc7[_0x098d('0x99')]);}if(_0x2548e4){logger['info']('Run\x20Query:',_0x32f24a[_0x098d('0x89')]());require(_0x098d('0x9b'))['fork'](path[_0x098d('0x58')](__dirname,'../../components/export/',_0x2548e4[_0x098d('0x8f')]),[_0x2548e4['id'],_0x32f24a[_0x098d('0x89')](),path[_0x098d('0x58')](__dirname,_0x098d('0x9c'),_0x2548e4[_0x098d('0x9d')]),_0x2deb90]);return _0x2548e4;}else{var _0x57632f=squel[_0x098d('0x74')]();_0x57632f[_0x098d('0x75')]('('+_0x32f24a[_0x098d('0x89')]()+')',_0x098d('0x9e'));_0x57632f[_0x098d('0x6b')]('COUNT(*)',_0x098d('0x23'));_0x32f24a[_0x098d('0x22')](_0x37cdc7[_0x098d('0x22')]||_0x2b2f6a);_0x32f24a[_0x098d('0x24')](_0x37cdc7[_0x098d('0x24')]||0x0);return dbH['sequelize']['query'](_0x57632f[_0x098d('0x89')](),{'type':dbH[_0x098d('0x88')][_0x098d('0x9f')][_0x098d('0x8a')]})['then'](function(_0x3b682f){if(!_0x3b682f[_0x098d('0x4c')]){_0x2f7393=0x0;}else{_0x2f7393=_0x3b682f[0x0][_0x098d('0x23')]||0x0;}return dbH[_0x098d('0x88')][_0x098d('0x39')](_0x32f24a[_0x098d('0x89')](),{'type':dbH[_0x098d('0x88')][_0x098d('0x9f')][_0x098d('0x8a')]});})[_0x098d('0x2a')](function(_0x10b409){return{'rows':_0x10b409||[],'count':_0x2f7393};});}});}exports[_0x098d('0xa0')]=function(_0x38b610,_0x36a540){return runReport(_0x38b610[_0x098d('0x4b')],_0x38b610[_0x098d('0x39')],_0x38b610[_0x098d('0x47')])[_0x098d('0x2a')](respondWithResult(_0x36a540,null))[_0x098d('0x4f')](handleError(_0x36a540,null));};exports[_0x098d('0xa1')]=runReport;exports[_0x098d('0x39')]=function(_0x3e47f3,_0x402af1){var _0x4e50fa=0xa;var _0xad2486=[_0x098d('0x58'),'left_join','right_join',_0x098d('0xa2')];var _0x296dc3={'SUM':_0x098d('0x8b'),'COUNT':_0x098d('0x59'),'COUNT DISTINCT':_0x098d('0x8c'),'MAX':_0x098d('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x098d('0x5d'),'GROUP_CONCAT ASC':_0x098d('0x5e'),'GROUP_CONCAT DESC':_0x098d('0x5f')};var _0x46114c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x098d('0x60'),'HOUR':_0x098d('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd72a85=function(_0x1500b4){return!_[_0x098d('0x63')]([_0x098d('0x64'),_0x098d('0x65'),_0x098d('0x66'),'IS\x20NOT\x20EMPTY'],_0x1500b4);};var _0x4dfd36=function(_0x53e9c9){if(!_0x53e9c9||!_0x53e9c9['rules'][_0x098d('0x4c')]){return'';}for(var _0x3cc519='(',_0x115ecd=0x0;_0x115ecd<_0x53e9c9['rules'][_0x098d('0x4c')];_0x115ecd+=0x1){_0x115ecd>0x0&&(_0x3cc519+='\x20'+_0x53e9c9[_0x098d('0x69')]+'\x20');_0x3cc519+=_0x53e9c9[_0x098d('0x68')][_0x115ecd][_0x098d('0x6a')]?_0x4dfd36(_0x53e9c9[_0x098d('0x68')][_0x115ecd]['group']):_0x53e9c9['rules'][_0x115ecd][_0x098d('0x6b')]+'\x20'+_0x53e9c9[_0x098d('0x68')][_0x115ecd]['condition']+(_0xd72a85(_0x53e9c9[_0x098d('0x68')][_0x115ecd]['condition'])?'\x20'+_0x53e9c9[_0x098d('0x68')][_0x115ecd][_0x098d('0x6d')]:'');}return _0x3cc519+')';};var _0x5b797f={'where':{'id':_0x3e47f3[_0x098d('0x4b')]['id']}},_0x463f04,_0x174566,_0x109bef,_0xedad00,_0x4eec8d;_0x5b797f=_[_0x098d('0x44')]({},_0x5b797f,_0x3e47f3[_0x098d('0x47')]);return db[_0x098d('0x34')]['find'](_0x5b797f)[_0x098d('0x2a')](function(_0x486652){if(_0x486652){_0x463f04=_0x486652;return _0x486652['getFields']();}return null;})[_0x098d('0x2a')](function(_0x5d9df6){if(_0x5d9df6){if(!_0x5d9df6[_0x098d('0x4c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x098d('0x71'),0x193);}_0x174566=_0x5d9df6;return db['AnalyticMetric'][_0x098d('0x49')]({'raw':!![]});}return null;})['then'](function(_0x4b3ce6){if(_0x4b3ce6){_0x109bef=_[_0x098d('0x73')](_0x4b3ce6,'id');var _0x4a558c;var _0x391529=squel[_0x098d('0x74')]();_0x391529[_0x098d('0x75')](_0x463f04[_0x098d('0x76')]);for(var _0xfbe185=0x0;_0xfbe185<_0x174566[_0x098d('0x4c')];_0xfbe185+=0x1){_0x4a558c=_0x174566[_0xfbe185][_0x098d('0x77')]?_0x109bef[_0x174566[_0xfbe185][_0x098d('0x77')]][_0x098d('0x8e')]:_0x174566[_0xfbe185][_0x098d('0x6b')];_0x4a558c=_0x174566[_0xfbe185][_0x098d('0x78')]?_['replace'](_0x296dc3[_0x174566[_0xfbe185][_0x098d('0x78')]],'%s',_0x4a558c):_0x4a558c;_0x4a558c=_0x174566[_0xfbe185][_0x098d('0x7a')]?_[_0x098d('0x79')](_0x46114c[_0x174566[_0xfbe185][_0x098d('0x7a')]],'%s',_0x4a558c):_0x4a558c;if(_0x174566[_0xfbe185]['groupBy']){_0x391529[_0x098d('0x6a')](_0x4a558c);}_0x174566[_0xfbe185][_0x098d('0x7c')]&&_0x391529[_0x098d('0x40')](_0x4a558c,_0x174566[_0xfbe185][_0x098d('0x7c')]===_0x098d('0x7d')?![]:!![]);_0x391529[_0x098d('0x6b')](_0x4a558c,_0x174566[_0xfbe185][_0x098d('0x7e')]||_0x4a558c);}if(_0x463f04[_0x098d('0x7f')]){_0x463f04['joins']=JSON[_0x098d('0x85')](_0x463f04[_0x098d('0x7f')]);for(var _0x5cf7b8=0x0;_0x5cf7b8<_0x463f04['joins'][_0x098d('0x4c')];_0x5cf7b8+=0x1){if(_0x463f04[_0x098d('0x7f')][_0x5cf7b8][_0x098d('0x37')]&&_[_0x098d('0x63')](_0xad2486,_0x463f04[_0x098d('0x7f')][_0x5cf7b8][_0x098d('0x37')])&&_0x463f04[_0x098d('0x7f')][_0x5cf7b8]['parentKey']&&_0x463f04['joins'][_0x5cf7b8][_0x098d('0x82')]&&_0x463f04[_0x098d('0x7f')][_0x5cf7b8][_0x098d('0x83')]){_0x391529[_0x463f04[_0x098d('0x7f')][_0x5cf7b8][_0x098d('0x37')]](_0x463f04['joins'][_0x5cf7b8][_0x098d('0x82')],null,util[_0x098d('0x7a')]('%s.%s\x20=\x20%s.%s',_0x463f04['table'],_0x463f04[_0x098d('0x7f')][_0x5cf7b8][_0x098d('0x81')],_0x463f04[_0x098d('0x7f')][_0x5cf7b8][_0x098d('0x82')],_0x463f04[_0x098d('0x7f')][_0x5cf7b8][_0x098d('0x83')]));}}}if(_0x463f04[_0x098d('0x84')]){_0x463f04['conditions']=JSON[_0x098d('0x85')](_0x463f04[_0x098d('0x84')]);_0x391529[_0x098d('0x42')](_0x4dfd36(_0x463f04[_0x098d('0x84')][_0x098d('0x6a')]));}_0x4eec8d=_0x391529['clone']();_0x391529[_0x098d('0x22')](_0x4e50fa);_0x391529[_0x098d('0x24')](0x0);logger[_0x098d('0xa3')](_0x098d('0x87'),_0x391529[_0x098d('0x89')]());return dbH[_0x098d('0x88')][_0x098d('0x39')](_0x391529['toString'](),{'type':dbH[_0x098d('0x88')][_0x098d('0x9f')][_0x098d('0x8a')]});}})[_0x098d('0x2a')](function(){return{'sql':_0x4eec8d[_0x098d('0x89')]()};})[_0x098d('0x2a')](respondWithResult(_0x402af1,null))[_0x098d('0x4f')](handleError(_0x402af1,null));}; \ No newline at end of file +var _0xa2d0=['GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','params','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','parse','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)','IS\x20EMPTY','operator','value','AnalyticMetric','clone','output','web','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','SELECT','COUNT(%s)','MAX(%s)','Sequelize','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','get','CustomReports','destroy','error','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0xa2d0,0x194));var _0x0a2d=function(_0x5d0d0c,_0x4281bb){_0x5d0d0c=_0x5d0d0c-0x0;var _0x407e99=_0xa2d0[_0x5d0d0c];return _0x407e99;};'use strict';var emlformat=require(_0x0a2d('0x0'));var rimraf=require(_0x0a2d('0x1'));var zipdir=require(_0x0a2d('0x2'));var jsonpatch=require(_0x0a2d('0x3'));var rp=require(_0x0a2d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0a2d('0x5'));var util=require('util');var path=require(_0x0a2d('0x6'));var sox=require(_0x0a2d('0x7'));var csv=require(_0x0a2d('0x8'));var ejs=require(_0x0a2d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a2d('0xa'));var squel=require('squel');var crypto=require(_0x0a2d('0xb'));var jsforce=require(_0x0a2d('0xc'));var deskjs=require(_0x0a2d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a2d('0xe'));var authService=require(_0x0a2d('0xf'));var qs=require(_0x0a2d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a2d('0x11'))(_0x0a2d('0x12'));var utils=require(_0x0a2d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0a2d('0x14'));var db=require(_0x0a2d('0x15'))['db'];var dbH=require(_0x0a2d('0x15'))[_0x0a2d('0x16')];function respondWithStatusCode(_0x5a79a1,_0x4a773a){_0x4a773a=_0x4a773a||0xcc;return function(_0x48f0c4){if(_0x48f0c4){return _0x5a79a1[_0x0a2d('0x17')](_0x4a773a);}return _0x5a79a1[_0x0a2d('0x18')](_0x4a773a)[_0x0a2d('0x19')]();};}function respondWithResult(_0xc7f441,_0x112c4f){_0x112c4f=_0x112c4f||0xc8;return function(_0x4cea6c){if(_0x4cea6c){return _0xc7f441[_0x0a2d('0x18')](_0x112c4f)[_0x0a2d('0x1a')](_0x4cea6c);}};}function respondWithFilteredResult(_0xdacd1f,_0x5e0c0d){return function(_0x281f13){if(_0x281f13){var _0xc9370=typeof _0x5e0c0d[_0x0a2d('0x1b')]==='undefined'&&typeof _0x5e0c0d[_0x0a2d('0x1c')]===_0x0a2d('0x1d');var _0x4bf489=_0x281f13['count'];var _0x9b5690=_0xc9370?0x0:_0x5e0c0d['offset'];var _0x3eeaab=_0xc9370?_0x281f13[_0x0a2d('0x1e')]:_0x5e0c0d[_0x0a2d('0x1b')]+_0x5e0c0d[_0x0a2d('0x1c')];var _0x27d7cc;if(_0x3eeaab>=_0x4bf489){_0x3eeaab=_0x4bf489;_0x27d7cc=0xc8;}else{_0x27d7cc=0xce;}_0xdacd1f[_0x0a2d('0x18')](_0x27d7cc);return _0xdacd1f[_0x0a2d('0x1f')](_0x0a2d('0x20'),_0x9b5690+'-'+_0x3eeaab+'/'+_0x4bf489)[_0x0a2d('0x1a')](_0x281f13);}return null;};}function patchUpdates(_0x390dbb){return function(_0x23a097){try{jsonpatch[_0x0a2d('0x21')](_0x23a097,_0x390dbb,!![]);}catch(_0x235e25){return BPromise[_0x0a2d('0x22')](_0x235e25);}return _0x23a097[_0x0a2d('0x23')]();};}function saveUpdates(_0x2334e2,_0x5e0bac){return function(_0x5cefed){if(_0x5cefed){return _0x5cefed['update'](_0x2334e2)['then'](function(_0x3e4b63){return _0x3e4b63;});}return null;};}function removeEntity(_0x161a0b,_0x20e78d){return function(_0x37bd23){if(_0x37bd23){return _0x37bd23['destroy']()[_0x0a2d('0x24')](function(){var _0xd5438a=_0x37bd23[_0x0a2d('0x25')]({'plain':!![]});var _0x125fc3=_0x0a2d('0x26');return db['UserProfileResource'][_0x0a2d('0x27')]({'where':{'type':_0x125fc3,'resourceId':_0xd5438a['id']}})['then'](function(){return _0x37bd23;});})['then'](function(){_0x161a0b[_0x0a2d('0x18')](0xcc)[_0x0a2d('0x19')]();});}};}function handleEntityNotFound(_0x221386,_0x16fa37){return function(_0x3c74a9){if(!_0x3c74a9){_0x221386[_0x0a2d('0x17')](0x194);}return _0x3c74a9;};}function handleError(_0x2db498,_0x5dfe1d){_0x5dfe1d=_0x5dfe1d||0x1f4;return function(_0x2e6cc7){logger[_0x0a2d('0x28')](_0x2e6cc7['stack']);if(_0x2e6cc7[_0x0a2d('0x29')]){delete _0x2e6cc7['name'];}_0x2db498[_0x0a2d('0x18')](_0x5dfe1d)[_0x0a2d('0x2a')](_0x2e6cc7);};}exports[_0x0a2d('0x2b')]=function(_0x1b3a12,_0x34ed91){var _0x31ac59={},_0xf31888={},_0x1bfaab={'count':0x0,'rows':[]};var _0x2b2818=_['map'](db[_0x0a2d('0x2c')][_0x0a2d('0x2d')],function(_0xe319aa){return{'name':_0xe319aa[_0x0a2d('0x2e')],'type':_0xe319aa[_0x0a2d('0x2f')][_0x0a2d('0x30')]};});_0xf31888[_0x0a2d('0x31')]=_[_0x0a2d('0x32')](_0x2b2818,'name');_0xf31888[_0x0a2d('0x33')]=_[_0x0a2d('0x34')](_0x1b3a12[_0x0a2d('0x33')]);_0xf31888[_0x0a2d('0x35')]=_['intersection'](_0xf31888[_0x0a2d('0x31')],_0xf31888['query']);_0x31ac59[_0x0a2d('0x36')]=_[_0x0a2d('0x37')](_0xf31888[_0x0a2d('0x31')],qs[_0x0a2d('0x38')](_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x38')]));_0x31ac59[_0x0a2d('0x36')]=_0x31ac59[_0x0a2d('0x36')][_0x0a2d('0x39')]?_0x31ac59[_0x0a2d('0x36')]:_0xf31888[_0x0a2d('0x31')];if(!_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x3a')](_0x0a2d('0x3b'))){_0x31ac59[_0x0a2d('0x1c')]=qs['limit'](_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x1c')]);_0x31ac59[_0x0a2d('0x1b')]=qs[_0x0a2d('0x1b')](_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x1b')]);}_0x31ac59[_0x0a2d('0x3c')]=qs['sort'](_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x3d')]);_0x31ac59[_0x0a2d('0x3e')]=qs[_0x0a2d('0x35')](_[_0x0a2d('0x3f')](_0x1b3a12['query'],_0xf31888[_0x0a2d('0x35')]),_0x2b2818);if(_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x40')]){_0x31ac59[_0x0a2d('0x3e')]=_['merge'](_0x31ac59[_0x0a2d('0x3e')],{'$or':_[_0x0a2d('0x32')](_0x2b2818,function(_0x56211e){if(_0x56211e[_0x0a2d('0x2f')]!=='VIRTUAL'){var _0x40a2c7={};_0x40a2c7[_0x56211e[_0x0a2d('0x29')]]={'$like':'%'+_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x40')]+'%'};return _0x40a2c7;}})});}_0x31ac59=_[_0x0a2d('0x41')]({},_0x31ac59,_0x1b3a12[_0x0a2d('0x42')]);var _0x2e58be={'where':_0x31ac59['where']};return db[_0x0a2d('0x2c')][_0x0a2d('0x1e')](_0x2e58be)[_0x0a2d('0x24')](function(_0x1b323d){_0x1bfaab['count']=_0x1b323d;if(_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x43')]){_0x31ac59[_0x0a2d('0x44')]=[{'all':!![]}];}return db[_0x0a2d('0x2c')][_0x0a2d('0x45')](_0x31ac59);})[_0x0a2d('0x24')](function(_0x385d57){_0x1bfaab[_0x0a2d('0x46')]=_0x385d57;return _0x1bfaab;})[_0x0a2d('0x24')](respondWithFilteredResult(_0x34ed91,_0x31ac59))[_0x0a2d('0x47')](handleError(_0x34ed91,null));};exports[_0x0a2d('0x48')]=function(_0x3f22d2,_0x3386d3){var _0x2ca3f5={'raw':![],'where':{'id':_0x3f22d2['params']['id']}},_0x11e70b={};_0x11e70b[_0x0a2d('0x31')]=_[_0x0a2d('0x34')](db[_0x0a2d('0x2c')][_0x0a2d('0x2d')]);_0x11e70b[_0x0a2d('0x33')]=_[_0x0a2d('0x34')](_0x3f22d2[_0x0a2d('0x33')]);_0x11e70b[_0x0a2d('0x35')]=_[_0x0a2d('0x37')](_0x11e70b['model'],_0x11e70b['query']);_0x2ca3f5[_0x0a2d('0x36')]=_[_0x0a2d('0x37')](_0x11e70b['model'],qs[_0x0a2d('0x38')](_0x3f22d2[_0x0a2d('0x33')][_0x0a2d('0x38')]));_0x2ca3f5['attributes']=_0x2ca3f5[_0x0a2d('0x36')][_0x0a2d('0x39')]?_0x2ca3f5[_0x0a2d('0x36')]:_0x11e70b['model'];if(_0x3f22d2[_0x0a2d('0x33')][_0x0a2d('0x43')]){_0x2ca3f5[_0x0a2d('0x44')]=[{'all':!![]}];}_0x2ca3f5=_[_0x0a2d('0x41')]({},_0x2ca3f5,_0x3f22d2['options']);return db[_0x0a2d('0x2c')][_0x0a2d('0x49')](_0x2ca3f5)['then'](handleEntityNotFound(_0x3386d3,null))[_0x0a2d('0x24')](respondWithResult(_0x3386d3,null))['catch'](handleError(_0x3386d3,null));};exports[_0x0a2d('0x4a')]=function(_0x20662d,_0x187b5b){return db[_0x0a2d('0x2c')][_0x0a2d('0x4a')](_0x20662d['body'],{})[_0x0a2d('0x24')](function(_0x403105){var _0x40d09f=_0x20662d['user'][_0x0a2d('0x25')]({'plain':!![]});if(!_0x40d09f)throw new Error(_0x0a2d('0x4b'));if(_0x40d09f[_0x0a2d('0x4c')]===_0x0a2d('0x4d')){var _0x1ddecf=_0x403105[_0x0a2d('0x25')]({'plain':!![]});var _0x34829e=_0x0a2d('0x4e');return db[_0x0a2d('0x4f')][_0x0a2d('0x49')]({'where':{'name':_0x34829e,'userProfileId':_0x40d09f[_0x0a2d('0x50')]},'raw':!![]})[_0x0a2d('0x24')](function(_0x40b0d8){if(_0x40b0d8&&_0x40b0d8[_0x0a2d('0x51')]===0x0){return db['UserProfileResource'][_0x0a2d('0x4a')]({'name':_0x1ddecf[_0x0a2d('0x29')],'resourceId':_0x1ddecf['id'],'type':_0x0a2d('0x26'),'sectionId':_0x40b0d8['id']},{})['then'](function(){return _0x403105;});}else{return _0x403105;}})[_0x0a2d('0x47')](function(_0x5558d0){logger[_0x0a2d('0x28')](_0x0a2d('0x52'),_0x5558d0);throw _0x5558d0;});}return _0x403105;})[_0x0a2d('0x24')](respondWithResult(_0x187b5b,0xc9))[_0x0a2d('0x47')](handleError(_0x187b5b,null));};exports[_0x0a2d('0x53')]=function(_0x5d7620,_0x28cf11){if(_0x5d7620[_0x0a2d('0x54')]['id']){delete _0x5d7620[_0x0a2d('0x54')]['id'];}return db[_0x0a2d('0x2c')][_0x0a2d('0x49')]({'where':{'id':_0x5d7620['params']['id']}})[_0x0a2d('0x24')](handleEntityNotFound(_0x28cf11,null))['then'](saveUpdates(_0x5d7620[_0x0a2d('0x54')],null))['then'](respondWithResult(_0x28cf11,null))['catch'](handleError(_0x28cf11,null));};exports[_0x0a2d('0x27')]=function(_0x453343,_0x123d00){return db['AnalyticCustomReport'][_0x0a2d('0x49')]({'where':{'id':_0x453343['params']['id']}})['then'](handleEntityNotFound(_0x123d00,null))['then'](removeEntity(_0x123d00,null))['catch'](handleError(_0x123d00,null));};exports['preview']=function(_0x34ae88,_0x4555af){var _0x26c67b=0xa;var _0x64e314=[_0x0a2d('0x55'),'left_join','right_join',_0x0a2d('0x56')];var _0x20f817={'SUM':_0x0a2d('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0a2d('0x58'),'MAX':'MAX(%s)','MIN':_0x0a2d('0x59'),'AVG':_0x0a2d('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0a2d('0x5b')};var _0x49fded={'SEC_TO_TIME':_0x0a2d('0x5c'),'DATE':'DATE(%s)','HOUR':_0x0a2d('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0a2d('0x5e')};var _0x482bc4=function(_0x2fdfaf){return!_[_0x0a2d('0x5f')]([_0x0a2d('0x60'),_0x0a2d('0x61'),'IS\x20EMPTY',_0x0a2d('0x62')],_0x2fdfaf);};var _0x33f996=function(_0x15e439){if(!_0x15e439||!_0x15e439[_0x0a2d('0x63')][_0x0a2d('0x39')]){return'';}for(var _0x28acd0='(',_0x434a51=0x0;_0x434a51<_0x15e439[_0x0a2d('0x63')][_0x0a2d('0x39')];_0x434a51+=0x1){_0x434a51>0x0&&(_0x28acd0+='\x20'+_0x15e439['operator']+'\x20');_0x28acd0+=_0x15e439[_0x0a2d('0x63')][_0x434a51][_0x0a2d('0x64')]?_0x33f996(_0x15e439[_0x0a2d('0x63')][_0x434a51][_0x0a2d('0x64')]):_0x15e439[_0x0a2d('0x63')][_0x434a51][_0x0a2d('0x65')]+'\x20'+_0x15e439['rules'][_0x434a51][_0x0a2d('0x66')]+(_0x482bc4(_0x15e439[_0x0a2d('0x63')][_0x434a51][_0x0a2d('0x66')])?'\x20'+_0x15e439[_0x0a2d('0x63')][_0x434a51]['value']:'');}return _0x28acd0+')';};var _0x490dc9={'where':{'id':_0x34ae88[_0x0a2d('0x67')]['id']}},_0x4613f1,_0x255f9e,_0x5b2b44,_0x10ec20,_0x43780e;_0x490dc9=_[_0x0a2d('0x41')]({},_0x490dc9,_0x34ae88[_0x0a2d('0x42')]);return db[_0x0a2d('0x2c')][_0x0a2d('0x49')](_0x490dc9)[_0x0a2d('0x24')](function(_0x6843ec){if(_0x6843ec){_0x4613f1=_0x6843ec;return _0x6843ec[_0x0a2d('0x68')]();}return null;})[_0x0a2d('0x24')](function(_0x206043){if(_0x206043){if(!_0x206043[_0x0a2d('0x39')]){throw new db['Sequelize'][(_0x0a2d('0x69'))](_0x0a2d('0x6a'),0x193);}_0x255f9e=_0x206043;return db['AnalyticMetric'][_0x0a2d('0x45')]({'raw':!![]});}return null;})['then'](function(_0x504d7a){if(_0x504d7a){_0x5b2b44=_[_0x0a2d('0x6b')](_0x504d7a,'id');var _0x5e6322;var _0x3e906d=squel[_0x0a2d('0x6c')]();_0x3e906d['from'](_0x4613f1[_0x0a2d('0x6d')]);for(var _0x2caefa=0x0;_0x2caefa<_0x255f9e[_0x0a2d('0x39')];_0x2caefa+=0x1){_0x5e6322=_0x255f9e[_0x2caefa]['MetricId']?_0x5b2b44[_0x255f9e[_0x2caefa][_0x0a2d('0x6e')]][_0x0a2d('0x6f')]:_0x255f9e[_0x2caefa]['field'];_0x5e6322=_0x255f9e[_0x2caefa][_0x0a2d('0x70')]?_[_0x0a2d('0x71')](_0x20f817[_0x255f9e[_0x2caefa][_0x0a2d('0x70')]],'%s',_0x5e6322):_0x5e6322;_0x5e6322=_0x255f9e[_0x2caefa]['format']?_[_0x0a2d('0x71')](_0x49fded[_0x255f9e[_0x2caefa][_0x0a2d('0x72')]],'%s',_0x5e6322):_0x5e6322;if(_0x255f9e[_0x2caefa][_0x0a2d('0x73')]){_0x3e906d[_0x0a2d('0x64')](_0x5e6322);}_0x255f9e[_0x2caefa][_0x0a2d('0x74')]&&_0x3e906d[_0x0a2d('0x3c')](_0x5e6322,_0x255f9e[_0x2caefa][_0x0a2d('0x74')]===_0x0a2d('0x75')?![]:!![]);_0x3e906d[_0x0a2d('0x65')](_0x5e6322,_0x255f9e[_0x2caefa][_0x0a2d('0x76')]||_0x5e6322);}if(_0x4613f1['joins']){_0x4613f1['joins']=JSON[_0x0a2d('0x77')](_0x4613f1['joins']);for(var _0x5f3f73=0x0;_0x5f3f73<_0x4613f1[_0x0a2d('0x78')][_0x0a2d('0x39')];_0x5f3f73+=0x1){if(_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x2f')]&&_[_0x0a2d('0x5f')](_0x64e314,_0x4613f1['joins'][_0x5f3f73][_0x0a2d('0x2f')])&&_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x79')]&&_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x7a')]&&_0x4613f1[_0x0a2d('0x78')][_0x5f3f73]['foreignKey']){_0x3e906d[_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x2f')]](_0x4613f1['joins'][_0x5f3f73]['foreignTable'],null,util[_0x0a2d('0x72')](_0x0a2d('0x7b'),_0x4613f1[_0x0a2d('0x6d')],_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x79')],_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x7a')],_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x7c')]));}}}if(_0x4613f1[_0x0a2d('0x7d')]){_0x4613f1[_0x0a2d('0x7d')]=JSON['parse'](_0x4613f1[_0x0a2d('0x7d')]);_0x3e906d['where'](_0x33f996(_0x4613f1[_0x0a2d('0x7d')][_0x0a2d('0x64')]));}_0x43780e=_0x3e906d['clone']();_0x3e906d[_0x0a2d('0x1c')](_0x26c67b);_0x3e906d[_0x0a2d('0x1b')](0x0);logger['debug'](_0x0a2d('0x7e'),_0x3e906d[_0x0a2d('0x7f')]());return dbH[_0x0a2d('0x80')][_0x0a2d('0x33')](_0x3e906d[_0x0a2d('0x7f')](),{'type':dbH['sequelize'][_0x0a2d('0x81')]['SELECT']});}})[_0x0a2d('0x24')](respondWithResult(_0x4555af,null))[_0x0a2d('0x47')](handleError(_0x4555af,null));};function runReport(_0x42d918,_0x5d0379,_0x3ebcd4){var _0x747885=_0x5d0379['name'];var _0x25614f=0xa;var _0x511e71=[_0x0a2d('0x55'),_0x0a2d('0x82'),_0x0a2d('0x83'),_0x0a2d('0x56')];var _0x3981a2={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0a2d('0x58'),'MAX':'MAX(%s)','MIN':_0x0a2d('0x59'),'AVG':_0x0a2d('0x5a'),'GROUP_CONCAT':_0x0a2d('0x84'),'GROUP_CONCAT ASC':_0x0a2d('0x85'),'GROUP_CONCAT DESC':_0x0a2d('0x5b')};var _0xabe737={'SEC_TO_TIME':_0x0a2d('0x5c'),'DATE':_0x0a2d('0x86'),'HOUR':'HOUR(%s)','ROUND':_0x0a2d('0x87'),'UNIX_TIMESTAMP':_0x0a2d('0x5e')};var _0x208012=function(_0x4b78ea){return!_[_0x0a2d('0x5f')]([_0x0a2d('0x60'),_0x0a2d('0x61'),_0x0a2d('0x88'),_0x0a2d('0x62')],_0x4b78ea);};var _0x131ef8=function(_0x4cef2b){if(!_0x4cef2b||!_0x4cef2b['rules'][_0x0a2d('0x39')]){return'';}for(var _0x1a9d6a='(',_0x518404=0x0;_0x518404<_0x4cef2b['rules'][_0x0a2d('0x39')];_0x518404+=0x1){_0x518404>0x0&&(_0x1a9d6a+='\x20'+_0x4cef2b[_0x0a2d('0x89')]+'\x20');_0x1a9d6a+=_0x4cef2b['rules'][_0x518404]['group']?_0x131ef8(_0x4cef2b[_0x0a2d('0x63')][_0x518404]['group']):_0x4cef2b[_0x0a2d('0x63')][_0x518404][_0x0a2d('0x65')]+'\x20'+_0x4cef2b['rules'][_0x518404]['condition']+(_0x208012(_0x4cef2b[_0x0a2d('0x63')][_0x518404][_0x0a2d('0x66')])?'\x20'+_0x4cef2b[_0x0a2d('0x63')][_0x518404][_0x0a2d('0x8a')]:'');}return _0x1a9d6a+')';};var _0x4888d1={'where':{'id':_0x42d918['id']}},_0x3eb434,_0xa93bdf,_0x20be06,_0x47868b,_0x4f82d1;_0x4888d1=_[_0x0a2d('0x41')]({},_0x4888d1,_0x3ebcd4);return db[_0x0a2d('0x2c')][_0x0a2d('0x49')](_0x4888d1)[_0x0a2d('0x24')](function(_0x232596){if(_0x232596){_0x3eb434=_0x232596;return _0x232596[_0x0a2d('0x68')]();}return null;})[_0x0a2d('0x24')](function(_0xa70695){if(_0xa70695){if(!_0xa70695[_0x0a2d('0x39')]){throw new db['Sequelize'][(_0x0a2d('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa93bdf=_0xa70695;return db[_0x0a2d('0x8b')][_0x0a2d('0x45')]({'raw':!![]});}return null;})[_0x0a2d('0x24')](function(_0x2fcb06){if(_0x2fcb06){_0x20be06=_['keyBy'](_0x2fcb06,'id');var _0x5dcb0b;var _0x3cadd3=squel[_0x0a2d('0x6c')]();_0x3cadd3['from'](_0x3eb434[_0x0a2d('0x6d')]);for(var _0x5ce3bc=0x0;_0x5ce3bc<_0xa93bdf[_0x0a2d('0x39')];_0x5ce3bc+=0x1){_0x5dcb0b=_0xa93bdf[_0x5ce3bc][_0x0a2d('0x6e')]?_0x20be06[_0xa93bdf[_0x5ce3bc][_0x0a2d('0x6e')]][_0x0a2d('0x6f')]:_0xa93bdf[_0x5ce3bc][_0x0a2d('0x65')];_0x5dcb0b=_0xa93bdf[_0x5ce3bc][_0x0a2d('0x70')]?_['replace'](_0x3981a2[_0xa93bdf[_0x5ce3bc][_0x0a2d('0x70')]],'%s',_0x5dcb0b):_0x5dcb0b;_0x5dcb0b=_0xa93bdf[_0x5ce3bc][_0x0a2d('0x72')]?_[_0x0a2d('0x71')](_0xabe737[_0xa93bdf[_0x5ce3bc]['format']],'%s',_0x5dcb0b):_0x5dcb0b;if(_0xa93bdf[_0x5ce3bc][_0x0a2d('0x73')]){_0x3cadd3[_0x0a2d('0x64')](_0x5dcb0b);}_0xa93bdf[_0x5ce3bc][_0x0a2d('0x74')]&&_0x3cadd3[_0x0a2d('0x3c')](_0x5dcb0b,_0xa93bdf[_0x5ce3bc][_0x0a2d('0x74')]===_0x0a2d('0x75')?![]:!![]);_0x3cadd3[_0x0a2d('0x65')](_0x5dcb0b,_0xa93bdf[_0x5ce3bc]['alias']||_0x5dcb0b);}if(_0x3eb434[_0x0a2d('0x78')]){_0x3eb434[_0x0a2d('0x78')]=JSON[_0x0a2d('0x77')](_0x3eb434[_0x0a2d('0x78')]);for(var _0x2509d9=0x0;_0x2509d9<_0x3eb434[_0x0a2d('0x78')]['length'];_0x2509d9+=0x1){if(_0x3eb434[_0x0a2d('0x78')][_0x2509d9]['type']&&_['includes'](_0x511e71,_0x3eb434[_0x0a2d('0x78')][_0x2509d9][_0x0a2d('0x2f')])&&_0x3eb434[_0x0a2d('0x78')][_0x2509d9][_0x0a2d('0x79')]&&_0x3eb434[_0x0a2d('0x78')][_0x2509d9]['foreignTable']&&_0x3eb434['joins'][_0x2509d9][_0x0a2d('0x7c')]){_0x3cadd3[_0x3eb434[_0x0a2d('0x78')][_0x2509d9]['type']](_0x3eb434[_0x0a2d('0x78')][_0x2509d9][_0x0a2d('0x7a')],null,util[_0x0a2d('0x72')](_0x0a2d('0x7b'),_0x3eb434[_0x0a2d('0x6d')],_0x3eb434[_0x0a2d('0x78')][_0x2509d9]['parentKey'],_0x3eb434[_0x0a2d('0x78')][_0x2509d9][_0x0a2d('0x7a')],_0x3eb434['joins'][_0x2509d9]['foreignKey']));}}}if(_0x3eb434['conditions']){_0x3eb434['conditions']=JSON['parse'](_0x3eb434[_0x0a2d('0x7d')]);_0x3cadd3[_0x0a2d('0x3e')](_0x131ef8(_0x3eb434['conditions'][_0x0a2d('0x64')]));}_0x4f82d1=_0x3cadd3[_0x0a2d('0x8c')]();_0x3cadd3['limit'](_0x25614f);_0x3cadd3['offset'](0x0);return;}})['then'](function(){if(_0x5d0379[_0x0a2d('0x8d')]===_0x0a2d('0x8e')){return null;}var _0x1f5ffb=_[_0x0a2d('0x41')](_0x5d0379,{'name':_0x5d0379['fullPath']||_0x5d0379[_0x0a2d('0x29')]||_0x3eb434[_0x0a2d('0x29')],'basename':_0x747885,'savename':util[_0x0a2d('0x72')](_0x0a2d('0x8f'),_0x5d0379[_0x0a2d('0x29')]||_0x3eb434[_0x0a2d('0x29')],require(_0x0a2d('0x90'))['generate'](0x4),_0x5d0379['output']||_0x0a2d('0x91')),'reportId':_0x3eb434['id'],'reportType':_0x0a2d('0x92')});return db[_0x0a2d('0x93')][_0x0a2d('0x4a')](_0x1f5ffb,{'raw':!![]});})[_0x0a2d('0x24')](function(_0x29fa81){if(_0x3eb434['table']==='cdr'){_0x4f82d1[_0x0a2d('0x3e')](_0x3eb434[_0x0a2d('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5d0379['startDate'],_0x5d0379['endDate']);}else{_0x4f82d1['where'](_0x3eb434[_0x0a2d('0x6d')]+_0x0a2d('0x94'),_0x5d0379[_0x0a2d('0x95')],_0x5d0379[_0x0a2d('0x96')]);}if(_0x29fa81){logger[_0x0a2d('0x97')]('Run\x20Query:',_0x4f82d1['toString']());require(_0x0a2d('0x98'))[_0x0a2d('0x99')](path[_0x0a2d('0x55')](__dirname,_0x0a2d('0x9a'),_0x29fa81[_0x0a2d('0x8d')]),[_0x29fa81['id'],_0x4f82d1['toString'](),path[_0x0a2d('0x55')](__dirname,_0x0a2d('0x9b'),_0x29fa81[_0x0a2d('0x9c')]),_0x747885]);return _0x29fa81;}else{var _0x44c01d=squel[_0x0a2d('0x6c')]();_0x44c01d[_0x0a2d('0x9d')]('('+_0x4f82d1[_0x0a2d('0x7f')]()+')',_0x0a2d('0x9e'));_0x44c01d[_0x0a2d('0x65')](_0x0a2d('0x9f'),_0x0a2d('0x1e'));_0x4f82d1[_0x0a2d('0x1c')](_0x5d0379['limit']||_0x25614f);_0x4f82d1['offset'](_0x5d0379[_0x0a2d('0x1b')]||0x0);return dbH[_0x0a2d('0x80')]['query'](_0x44c01d[_0x0a2d('0x7f')](),{'type':dbH[_0x0a2d('0x80')][_0x0a2d('0x81')][_0x0a2d('0xa0')]})['then'](function(_0x5e323a){if(!_0x5e323a[_0x0a2d('0x39')]){_0x47868b=0x0;}else{_0x47868b=_0x5e323a[0x0]['count']||0x0;}return dbH[_0x0a2d('0x80')][_0x0a2d('0x33')](_0x4f82d1[_0x0a2d('0x7f')](),{'type':dbH[_0x0a2d('0x80')][_0x0a2d('0x81')][_0x0a2d('0xa0')]});})[_0x0a2d('0x24')](function(_0x207ec9){return{'rows':_0x207ec9||[],'count':_0x47868b};});}});}exports['run']=function(_0xbbce4,_0x5010f7){return runReport(_0xbbce4[_0x0a2d('0x67')],_0xbbce4['query'],_0xbbce4[_0x0a2d('0x42')])['then'](respondWithResult(_0x5010f7,null))['catch'](handleError(_0x5010f7,null));};exports['runReport']=runReport;exports['query']=function(_0x1bb148,_0x5cf798){var _0x24185c=0xa;var _0x268292=['join',_0x0a2d('0x82'),_0x0a2d('0x83'),_0x0a2d('0x56')];var _0x48c600={'SUM':'SUM(%s)','COUNT':_0x0a2d('0xa1'),'COUNT DISTINCT':_0x0a2d('0x58'),'MAX':_0x0a2d('0xa2'),'MIN':_0x0a2d('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0a2d('0x84'),'GROUP_CONCAT ASC':_0x0a2d('0x85'),'GROUP_CONCAT DESC':_0x0a2d('0x5b')};var _0x3cd55e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0a2d('0x86'),'HOUR':_0x0a2d('0x5d'),'ROUND':_0x0a2d('0x87'),'UNIX_TIMESTAMP':_0x0a2d('0x5e')};var _0x3deeac=function(_0x1e4022){return!_[_0x0a2d('0x5f')]([_0x0a2d('0x60'),_0x0a2d('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1e4022);};var _0x4f3ab3=function(_0x35607c){if(!_0x35607c||!_0x35607c[_0x0a2d('0x63')][_0x0a2d('0x39')]){return'';}for(var _0x5a2e41='(',_0x574445=0x0;_0x574445<_0x35607c[_0x0a2d('0x63')][_0x0a2d('0x39')];_0x574445+=0x1){_0x574445>0x0&&(_0x5a2e41+='\x20'+_0x35607c['operator']+'\x20');_0x5a2e41+=_0x35607c['rules'][_0x574445][_0x0a2d('0x64')]?_0x4f3ab3(_0x35607c[_0x0a2d('0x63')][_0x574445][_0x0a2d('0x64')]):_0x35607c[_0x0a2d('0x63')][_0x574445]['field']+'\x20'+_0x35607c[_0x0a2d('0x63')][_0x574445][_0x0a2d('0x66')]+(_0x3deeac(_0x35607c[_0x0a2d('0x63')][_0x574445][_0x0a2d('0x66')])?'\x20'+_0x35607c[_0x0a2d('0x63')][_0x574445][_0x0a2d('0x8a')]:'');}return _0x5a2e41+')';};var _0xb02fb7={'where':{'id':_0x1bb148[_0x0a2d('0x67')]['id']}},_0xde2f10,_0x436b7b,_0x2abbc0,_0x14ae4c,_0x47e420;_0xb02fb7=_[_0x0a2d('0x41')]({},_0xb02fb7,_0x1bb148['options']);return db[_0x0a2d('0x2c')][_0x0a2d('0x49')](_0xb02fb7)[_0x0a2d('0x24')](function(_0x233720){if(_0x233720){_0xde2f10=_0x233720;return _0x233720[_0x0a2d('0x68')]();}return null;})[_0x0a2d('0x24')](function(_0x4ea8e7){if(_0x4ea8e7){if(!_0x4ea8e7['length']){throw new db[(_0x0a2d('0xa3'))]['ValidationErrorItem'](_0x0a2d('0x6a'),0x193);}_0x436b7b=_0x4ea8e7;return db[_0x0a2d('0x8b')][_0x0a2d('0x45')]({'raw':!![]});}return null;})[_0x0a2d('0x24')](function(_0x12f1d3){if(_0x12f1d3){_0x2abbc0=_[_0x0a2d('0x6b')](_0x12f1d3,'id');var _0x2c2a52;var _0x451a19=squel[_0x0a2d('0x6c')]();_0x451a19[_0x0a2d('0x9d')](_0xde2f10[_0x0a2d('0x6d')]);for(var _0x1624a9=0x0;_0x1624a9<_0x436b7b[_0x0a2d('0x39')];_0x1624a9+=0x1){_0x2c2a52=_0x436b7b[_0x1624a9][_0x0a2d('0x6e')]?_0x2abbc0[_0x436b7b[_0x1624a9][_0x0a2d('0x6e')]][_0x0a2d('0x6f')]:_0x436b7b[_0x1624a9][_0x0a2d('0x65')];_0x2c2a52=_0x436b7b[_0x1624a9][_0x0a2d('0x70')]?_[_0x0a2d('0x71')](_0x48c600[_0x436b7b[_0x1624a9][_0x0a2d('0x70')]],'%s',_0x2c2a52):_0x2c2a52;_0x2c2a52=_0x436b7b[_0x1624a9]['format']?_[_0x0a2d('0x71')](_0x3cd55e[_0x436b7b[_0x1624a9][_0x0a2d('0x72')]],'%s',_0x2c2a52):_0x2c2a52;if(_0x436b7b[_0x1624a9][_0x0a2d('0x73')]){_0x451a19[_0x0a2d('0x64')](_0x2c2a52);}_0x436b7b[_0x1624a9]['orderBy']&&_0x451a19[_0x0a2d('0x3c')](_0x2c2a52,_0x436b7b[_0x1624a9]['orderBy']===_0x0a2d('0x75')?![]:!![]);_0x451a19[_0x0a2d('0x65')](_0x2c2a52,_0x436b7b[_0x1624a9][_0x0a2d('0x76')]||_0x2c2a52);}if(_0xde2f10[_0x0a2d('0x78')]){_0xde2f10[_0x0a2d('0x78')]=JSON['parse'](_0xde2f10['joins']);for(var _0x5de04f=0x0;_0x5de04f<_0xde2f10[_0x0a2d('0x78')][_0x0a2d('0x39')];_0x5de04f+=0x1){if(_0xde2f10['joins'][_0x5de04f][_0x0a2d('0x2f')]&&_[_0x0a2d('0x5f')](_0x268292,_0xde2f10[_0x0a2d('0x78')][_0x5de04f][_0x0a2d('0x2f')])&&_0xde2f10[_0x0a2d('0x78')][_0x5de04f][_0x0a2d('0x79')]&&_0xde2f10[_0x0a2d('0x78')][_0x5de04f]['foreignTable']&&_0xde2f10[_0x0a2d('0x78')][_0x5de04f]['foreignKey']){_0x451a19[_0xde2f10[_0x0a2d('0x78')][_0x5de04f]['type']](_0xde2f10[_0x0a2d('0x78')][_0x5de04f][_0x0a2d('0x7a')],null,util[_0x0a2d('0x72')](_0x0a2d('0x7b'),_0xde2f10[_0x0a2d('0x6d')],_0xde2f10['joins'][_0x5de04f]['parentKey'],_0xde2f10[_0x0a2d('0x78')][_0x5de04f]['foreignTable'],_0xde2f10[_0x0a2d('0x78')][_0x5de04f][_0x0a2d('0x7c')]));}}}if(_0xde2f10[_0x0a2d('0x7d')]){_0xde2f10['conditions']=JSON[_0x0a2d('0x77')](_0xde2f10[_0x0a2d('0x7d')]);_0x451a19[_0x0a2d('0x3e')](_0x4f3ab3(_0xde2f10[_0x0a2d('0x7d')][_0x0a2d('0x64')]));}_0x47e420=_0x451a19[_0x0a2d('0x8c')]();_0x451a19[_0x0a2d('0x1c')](_0x24185c);_0x451a19[_0x0a2d('0x1b')](0x0);logger[_0x0a2d('0xa4')](_0x0a2d('0x7e'),_0x451a19[_0x0a2d('0x7f')]());return dbH[_0x0a2d('0x80')][_0x0a2d('0x33')](_0x451a19[_0x0a2d('0x7f')](),{'type':dbH[_0x0a2d('0x80')]['QueryTypes'][_0x0a2d('0xa0')]});}})[_0x0a2d('0x24')](function(){return{'sql':_0x47e420[_0x0a2d('0x7f')]()};})[_0x0a2d('0x24')](respondWithResult(_0x5cf798,null))[_0x0a2d('0x47')](handleError(_0x5cf798,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index ee6c0a6..d4d7571 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.model.js +++ b/server/api/analyticCustomReport/analyticCustomReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x563a=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x399b4d,_0x21a67b){var _0x53b450=function(_0x15e449){while(--_0x15e449){_0x399b4d['push'](_0x399b4d['shift']());}};_0x53b450(++_0x21a67b);}(_0x563a,0xe0));var _0xa563=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x563a[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xa563('0x0'));var util=require(_0xa563('0x1'));var logger=require(_0xa563('0x2'))(_0xa563('0x3'));var moment=require(_0xa563('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa563('0x5'));var config=require(_0xa563('0x6'));var attributes=require(_0xa563('0x7'));module[_0xa563('0x8')]=function(_0x1336a5,_0x345bc2){return _0x1336a5[_0xa563('0x9')](_0xa563('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc27c=['AnalyticCustomReport','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x575269,_0x251332){var _0x4924c0=function(_0x50bba0){while(--_0x50bba0){_0x575269['push'](_0x575269['shift']());}};_0x4924c0(++_0x251332);}(_0xc27c,0x1b9));var _0xcc27=function(_0x231a4d,_0x2d52ec){_0x231a4d=_0x231a4d-0x0;var _0x4c55c3=_0xc27c[_0x231a4d];return _0x4c55c3;};'use strict';var _=require(_0xcc27('0x0'));var util=require(_0xcc27('0x1'));var logger=require(_0xcc27('0x2'))('api');var moment=require(_0xcc27('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc27('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc27('0x5'));var config=require(_0xcc27('0x6'));var attributes=require(_0xcc27('0x7'));module[_0xcc27('0x8')]=function(_0x436b21,_0x402bb4){return _0x436b21['define'](_0xcc27('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 93ec4b0..aa7f426 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.rpc.js +++ b/server/api/analyticCustomReport/analyticCustomReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe517=['rpc','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x291b37,_0x19fdc0){var _0x2988ed=function(_0x571a09){while(--_0x571a09){_0x291b37['push'](_0x291b37['shift']());}};_0x2988ed(++_0x19fdc0);}(_0xe517,0x7d));var _0x7e51=function(_0x5b208e,_0x3217d8){_0x5b208e=_0x5b208e-0x0;var _0x3dd5eb=_0xe517[_0x5b208e];return _0x3dd5eb;};'use strict';var _=require(_0x7e51('0x0'));var util=require(_0x7e51('0x1'));var moment=require(_0x7e51('0x2'));var BPromise=require(_0x7e51('0x3'));var rs=require(_0x7e51('0x4'));var fs=require('fs');var Redis=require(_0x7e51('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e51('0x6'));var logger=require('../../config/logger')(_0x7e51('0x7'));var config=require('../../config/environment');var jayson=require(_0x7e51('0x8'));var client=jayson[_0x7e51('0x9')][_0x7e51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5732a2,_0x40a8d8,_0x154581){return new BPromise(function(_0x324126,_0x575d02){return client[_0x7e51('0xb')](_0x5732a2,_0x154581)[_0x7e51('0xc')](function(_0x3fafff){logger[_0x7e51('0xd')](_0x7e51('0xe'),_0x40a8d8,_0x7e51('0xf'));logger[_0x7e51('0x10')](_0x7e51('0x11'),_0x40a8d8,'request\x20sent',JSON[_0x7e51('0x12')](_0x3fafff));if(_0x3fafff[_0x7e51('0x13')]){if(_0x3fafff[_0x7e51('0x13')][_0x7e51('0x14')]===0x1f4){logger['error'](_0x7e51('0xe'),_0x40a8d8,_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);return _0x575d02(_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);}logger['error'](_0x7e51('0xe'),_0x40a8d8,_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);return _0x324126(_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);}else{logger['info'](_0x7e51('0xe'),_0x40a8d8,_0x7e51('0xf'));_0x324126(_0x3fafff['result'][_0x7e51('0x15')]);}})['catch'](function(_0x23f0ea){logger[_0x7e51('0x13')](_0x7e51('0xe'),_0x40a8d8,_0x23f0ea);_0x575d02(_0x23f0ea);});});} \ No newline at end of file +var _0x7d3a=['client','http','request','then','info','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x2a94f0,_0x357a80){var _0x8fe809=function(_0x16a3c5){while(--_0x16a3c5){_0x2a94f0['push'](_0x2a94f0['shift']());}};_0x8fe809(++_0x357a80);}(_0x7d3a,0x198));var _0xa7d3=function(_0xe0f3e9,_0x59fd23){_0xe0f3e9=_0xe0f3e9-0x0;var _0x589ff7=_0x7d3a[_0xe0f3e9];return _0x589ff7;};'use strict';var _=require(_0xa7d3('0x0'));var util=require('util');var moment=require(_0xa7d3('0x1'));var BPromise=require(_0xa7d3('0x2'));var rs=require(_0xa7d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7d3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7d3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa7d3('0x6')][_0xa7d3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f4ef6,_0x3ffd06,_0x132e8b){return new BPromise(function(_0x208d4a,_0x2e2ea0){return client[_0xa7d3('0x8')](_0x1f4ef6,_0x132e8b)[_0xa7d3('0x9')](function(_0x155d41){logger[_0xa7d3('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3ffd06,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3ffd06,'request\x20sent',JSON['stringify'](_0x155d41));if(_0x155d41[_0xa7d3('0xb')]){if(_0x155d41['error'][_0xa7d3('0xc')]===0x1f4){logger[_0xa7d3('0xb')](_0xa7d3('0xd'),_0x3ffd06,_0x155d41[_0xa7d3('0xb')]['message']);return _0x2e2ea0(_0x155d41['error'][_0xa7d3('0xe')]);}logger['error'](_0xa7d3('0xd'),_0x3ffd06,_0x155d41[_0xa7d3('0xb')]['message']);return _0x208d4a(_0x155d41[_0xa7d3('0xb')][_0xa7d3('0xe')]);}else{logger[_0xa7d3('0xa')](_0xa7d3('0xd'),_0x3ffd06,_0xa7d3('0xf'));_0x208d4a(_0x155d41[_0xa7d3('0x10')][_0xa7d3('0xe')]);}})[_0xa7d3('0x11')](function(_0x5c7ea4){logger[_0xa7d3('0xb')](_0xa7d3('0xd'),_0x3ffd06,_0x5c7ea4);_0x2e2ea0(_0x5c7ea4);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index baa355b..a8a6d4f 100644 --- a/server/api/analyticCustomReport/index.js +++ b/server/api/analyticCustomReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3b0=['express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','/:id','get','/:id/preview','run','/:id/query','query','post','put','update','destroy','exports','multer','util','path'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0xa3b0,0x179));var _0x0a3b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa3b0[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x0a3b('0x0'));var util=require(_0x0a3b('0x1'));var path=require(_0x0a3b('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a3b('0x3'));var router=express[_0x0a3b('0x4')]();var fs_extra=require(_0x0a3b('0x5'));var auth=require(_0x0a3b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x0a3b('0x7')](),controller[_0x0a3b('0x8')]);router['get'](_0x0a3b('0x9'),auth[_0x0a3b('0x7')](),controller['show']);router[_0x0a3b('0xa')](_0x0a3b('0xb'),auth['isAuthenticated'](),controller['preview']);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0x0a3b('0xc')]);router[_0x0a3b('0xa')](_0x0a3b('0xd'),auth[_0x0a3b('0x7')](),controller[_0x0a3b('0xe')]);router[_0x0a3b('0xf')]('/',auth[_0x0a3b('0x7')](),controller['create']);router[_0x0a3b('0x10')](_0x0a3b('0x9'),auth[_0x0a3b('0x7')](),controller[_0x0a3b('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a3b('0x12')]);module[_0x0a3b('0x13')]=router; \ No newline at end of file +var _0x4b01=['run','query','create','put','update','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview'];(function(_0x8ac6f9,_0x31a5a6){var _0x243ed5=function(_0xac099b){while(--_0xac099b){_0x8ac6f9['push'](_0x8ac6f9['shift']());}};_0x243ed5(++_0x31a5a6);}(_0x4b01,0x170));var _0x14b0=function(_0xe05fed,_0x1bd4aa){_0xe05fed=_0xe05fed-0x0;var _0x157a20=_0x4b01[_0xe05fed];return _0x157a20;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x14b0('0x0'));var express=require(_0x14b0('0x1'));var router=express[_0x14b0('0x2')]();var fs_extra=require(_0x14b0('0x3'));var auth=require(_0x14b0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x14b0('0x5'));var controller=require('./analyticCustomReport.controller');router[_0x14b0('0x6')]('/',auth[_0x14b0('0x7')](),controller[_0x14b0('0x8')]);router[_0x14b0('0x6')](_0x14b0('0x9'),auth[_0x14b0('0x7')](),controller[_0x14b0('0xa')]);router[_0x14b0('0x6')](_0x14b0('0xb'),auth[_0x14b0('0x7')](),controller['preview']);router[_0x14b0('0x6')]('/:id/run',auth[_0x14b0('0x7')](),controller[_0x14b0('0xc')]);router[_0x14b0('0x6')]('/:id/query',auth[_0x14b0('0x7')](),controller[_0x14b0('0xd')]);router['post']('/',auth[_0x14b0('0x7')](),controller[_0x14b0('0xe')]);router[_0x14b0('0xf')](_0x14b0('0x9'),auth['isAuthenticated'](),controller[_0x14b0('0x10')]);router['delete']('/:id',auth[_0x14b0('0x7')](),controller[_0x14b0('0x11')]);module[_0x14b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 09271d9..836525e 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x135455,_0xa69de1){var _0x50341e=function(_0x9ef791){while(--_0x9ef791){_0x135455['push'](_0x135455['shift']());}};_0x50341e(++_0xa69de1);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1ae1fe,_0x2d1ac8){_0x1ae1fe=_0x1ae1fe-0x0;var _0x193e73=_0x9c5a[_0x1ae1fe];return _0x193e73;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x2375f1,_0x31d6cf){var _0x1237b5=function(_0x125eda){while(--_0x125eda){_0x2375f1['push'](_0x2375f1['shift']());}};_0x1237b5(++_0x31d6cf);}(_0xd8fb,0x99));var _0xbd8f=function(_0x29b244,_0x3de9e3){_0x29b244=_0x29b244-0x0;var _0x218f5e=_0xd8fb[_0x29b244];return _0x218f5e;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 37b9429..da71e7e 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0x4e2aaa,_0x24c8f5){var _0x1a201b=function(_0xabc02c){while(--_0xabc02c){_0x4e2aaa['push'](_0x4e2aaa['shift']());}};_0x1a201b(++_0x24c8f5);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file +var _0xc6ac=['keyBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2433aa,_0x29d117){_0x2433aa=_0x2433aa-0x0;var _0x2c614b=_0xc6ac[_0x2433aa];return _0x2c614b;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index d73d547..3692f80 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.model.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1807=['lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x31300a,_0xb5f2ce){var _0x3ac551=function(_0x9f53ed){while(--_0x9f53ed){_0x31300a['push'](_0x31300a['shift']());}};_0x3ac551(++_0xb5f2ce);}(_0x1807,0x18c));var _0x7180=function(_0x59929a,_0x1dd58d){_0x59929a=_0x59929a-0x0;var _0x4cf8c5=_0x1807[_0x59929a];return _0x4cf8c5;};'use strict';var _=require(_0x7180('0x0'));var util=require(_0x7180('0x1'));var logger=require(_0x7180('0x2'))(_0x7180('0x3'));var moment=require('moment');var BPromise=require(_0x7180('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7180('0x5'));var config=require(_0x7180('0x6'));var attributes=require(_0x7180('0x7'));module[_0x7180('0x8')]=function(_0x3a4789,_0x2b21af){return _0x3a4789[_0x7180('0x9')](_0x7180('0xa'),attributes,{'tableName':_0x7180('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x811e=['util','../../config/logger','bluebird','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x2630a5,_0x5c59e8){var _0x4b0d4c=function(_0x5a4728){while(--_0x5a4728){_0x2630a5['push'](_0x2630a5['shift']());}};_0x4b0d4c(++_0x5c59e8);}(_0x811e,0x144));var _0xe811=function(_0x42dd89,_0x51aef2){_0x42dd89=_0x42dd89-0x0;var _0x745142=_0x811e[_0x42dd89];return _0x745142;};'use strict';var _=require('lodash');var util=require(_0xe811('0x0'));var logger=require(_0xe811('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe811('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe811('0x3'));var config=require(_0xe811('0x4'));var attributes=require(_0xe811('0x5'));module[_0xe811('0x6')]=function(_0x1c4e23,_0x12d49e){return _0x1c4e23[_0xe811('0x7')](_0xe811('0x8'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 66bc3fc..db260ec 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb311=['request\x20sent','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message'];(function(_0x21e8ae,_0x8ee8dc){var _0x2a53f5=function(_0x54420c){while(--_0x54420c){_0x21e8ae['push'](_0x21e8ae['shift']());}};_0x2a53f5(++_0x8ee8dc);}(_0xb311,0x152));var _0x1b31=function(_0x19a8b2,_0x538929){_0x19a8b2=_0x19a8b2-0x0;var _0x1f60c4=_0xb311[_0x19a8b2];return _0x1f60c4;};'use strict';var _=require(_0x1b31('0x0'));var util=require(_0x1b31('0x1'));var moment=require('moment');var BPromise=require(_0x1b31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b31('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b31('0x4'))(_0x1b31('0x5'));var config=require(_0x1b31('0x6'));var jayson=require(_0x1b31('0x7'));var client=jayson[_0x1b31('0x8')][_0x1b31('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x460c12,_0x1b2fe2,_0x1af325){return new BPromise(function(_0x134d30,_0x551c24){return client[_0x1b31('0xa')](_0x460c12,_0x1af325)[_0x1b31('0xb')](function(_0x1352e8){logger[_0x1b31('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1b2fe2,'request\x20sent');logger['debug'](_0x1b31('0xd'),_0x1b2fe2,'request\x20sent',JSON[_0x1b31('0xe')](_0x1352e8));if(_0x1352e8[_0x1b31('0xf')]){if(_0x1352e8[_0x1b31('0xf')][_0x1b31('0x10')]===0x1f4){logger[_0x1b31('0xf')](_0x1b31('0x11'),_0x1b2fe2,_0x1352e8[_0x1b31('0xf')][_0x1b31('0x12')]);return _0x551c24(_0x1352e8['error'][_0x1b31('0x12')]);}logger[_0x1b31('0xf')](_0x1b31('0x11'),_0x1b2fe2,_0x1352e8[_0x1b31('0xf')][_0x1b31('0x12')]);return _0x134d30(_0x1352e8['error']['message']);}else{logger[_0x1b31('0xc')](_0x1b31('0x11'),_0x1b2fe2,_0x1b31('0x13'));_0x134d30(_0x1352e8['result'][_0x1b31('0x12')]);}})[_0x1b31('0x14')](function(_0x1276d6){logger['error'](_0x1b31('0x11'),_0x1b2fe2,_0x1276d6);_0x551c24(_0x1276d6);});});} \ No newline at end of file +var _0x0046=['client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x6656b1,_0x3421ee){var _0x45ae3a=function(_0x4ba6f5){while(--_0x4ba6f5){_0x6656b1['push'](_0x6656b1['shift']());}};_0x45ae3a(++_0x3421ee);}(_0x0046,0x1af));var _0x6004=function(_0x42641f,_0x59982b){_0x42641f=_0x42641f-0x0;var _0x190aff=_0x0046[_0x42641f];return _0x190aff;};'use strict';var _=require(_0x6004('0x0'));var util=require('util');var moment=require(_0x6004('0x1'));var BPromise=require('bluebird');var rs=require(_0x6004('0x2'));var fs=require('fs');var Redis=require(_0x6004('0x3'));var db=require(_0x6004('0x4'))['db'];var utils=require(_0x6004('0x5'));var logger=require(_0x6004('0x6'))(_0x6004('0x7'));var config=require(_0x6004('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6004('0x9')][_0x6004('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x590c7a,_0x4b4c20,_0x2f8401){return new BPromise(function(_0x1da74b,_0x13a348){return client[_0x6004('0xb')](_0x590c7a,_0x2f8401)[_0x6004('0xc')](function(_0x56adfb){logger[_0x6004('0xd')](_0x6004('0xe'),_0x4b4c20,_0x6004('0xf'));logger[_0x6004('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4b4c20,_0x6004('0xf'),JSON[_0x6004('0x11')](_0x56adfb));if(_0x56adfb[_0x6004('0x12')]){if(_0x56adfb[_0x6004('0x12')]['code']===0x1f4){logger['error'](_0x6004('0xe'),_0x4b4c20,_0x56adfb[_0x6004('0x12')][_0x6004('0x13')]);return _0x13a348(_0x56adfb[_0x6004('0x12')][_0x6004('0x13')]);}logger[_0x6004('0x12')](_0x6004('0xe'),_0x4b4c20,_0x56adfb[_0x6004('0x12')][_0x6004('0x13')]);return _0x1da74b(_0x56adfb[_0x6004('0x12')]['message']);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4b4c20,_0x6004('0xf'));_0x1da74b(_0x56adfb[_0x6004('0x14')][_0x6004('0x13')]);}})[_0x6004('0x15')](function(_0x3b859d){logger['error'](_0x6004('0xe'),_0x4b4c20,_0x3b859d);_0x13a348(_0x3b859d);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index cce130b..1f8cbaa 100644 --- a/server/api/analyticDefaultReport/index.js +++ b/server/api/analyticDefaultReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81a4=['run','/:id/query','query','post','create','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run'];(function(_0x36650f,_0x5df99b){var _0x267ff4=function(_0x8362ea){while(--_0x8362ea){_0x36650f['push'](_0x36650f['shift']());}};_0x267ff4(++_0x5df99b);}(_0x81a4,0x128));var _0x481a=function(_0x284506,_0x191316){_0x284506=_0x284506-0x0;var _0x1e9ee5=_0x81a4[_0x284506];return _0x1e9ee5;};'use strict';var multer=require(_0x481a('0x0'));var util=require(_0x481a('0x1'));var path=require(_0x481a('0x2'));var timeout=require(_0x481a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x481a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x481a('0x5'));var config=require(_0x481a('0x6'));var controller=require(_0x481a('0x7'));router[_0x481a('0x8')]('/',auth['isAuthenticated'](),controller[_0x481a('0x9')]);router[_0x481a('0x8')](_0x481a('0xa'),auth[_0x481a('0xb')](),controller[_0x481a('0xc')]);router['get'](_0x481a('0xd'),auth['isAuthenticated'](),controller[_0x481a('0xe')]);router[_0x481a('0x8')](_0x481a('0xf'),auth['isAuthenticated'](),controller[_0x481a('0x10')]);router['get'](_0x481a('0x11'),auth[_0x481a('0xb')](),controller[_0x481a('0x12')]);router[_0x481a('0x13')]('/',auth['isAuthenticated'](),controller[_0x481a('0x14')]);router['put'](_0x481a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x481a('0x15')](_0x481a('0xa'),auth[_0x481a('0xb')](),controller[_0x481a('0x16')]);module[_0x481a('0x17')]=router; \ No newline at end of file +var _0x7d8b=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','preview','/:id/run','run','query','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x49f671,_0x97347d){var _0x959285=function(_0x1be675){while(--_0x1be675){_0x49f671['push'](_0x49f671['shift']());}};_0x959285(++_0x97347d);}(_0x7d8b,0x1c1));var _0xb7d8=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7d8b[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require('multer');var util=require(_0xb7d8('0x0'));var path=require(_0xb7d8('0x1'));var timeout=require(_0xb7d8('0x2'));var express=require(_0xb7d8('0x3'));var router=express[_0xb7d8('0x4')]();var fs_extra=require(_0xb7d8('0x5'));var auth=require(_0xb7d8('0x6'));var interaction=require(_0xb7d8('0x7'));var config=require(_0xb7d8('0x8'));var controller=require(_0xb7d8('0x9'));router[_0xb7d8('0xa')]('/',auth[_0xb7d8('0xb')](),controller[_0xb7d8('0xc')]);router[_0xb7d8('0xa')](_0xb7d8('0xd'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/preview',auth[_0xb7d8('0xb')](),controller[_0xb7d8('0xe')]);router[_0xb7d8('0xa')](_0xb7d8('0xf'),auth[_0xb7d8('0xb')](),controller[_0xb7d8('0x10')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0xb7d8('0x11')]);router[_0xb7d8('0x12')]('/',auth['isAuthenticated'](),controller[_0xb7d8('0x13')]);router[_0xb7d8('0x14')](_0xb7d8('0xd'),auth[_0xb7d8('0xb')](),controller[_0xb7d8('0x15')]);router[_0xb7d8('0x16')]('/:id',auth[_0xb7d8('0xb')](),controller[_0xb7d8('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8ae118d..5ebdcb1 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3579=['UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','INTEGER'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x3579,0x69));var _0x9357=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x3579[_0x1fc122];return _0xa2cb13;};'use strict';var Sequelize=require(_0x9357('0x0'));var moment=require(_0x9357('0x1'));module[_0x9357('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x9357('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x9357('0x4')](_0x9357('0x5'),_0x9357('0x6'),_0x9357('0x7')),'allowNull':![],'defaultValue':_0x9357('0x5')},'savename':{'type':Sequelize[_0x9357('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9357('0x8')]},'endDate':{'type':Sequelize[_0x9357('0x8')]},'status':{'type':Sequelize[_0x9357('0x3')],'defaultValue':_0x9357('0x9')},'type':{'type':Sequelize['ENUM'](_0x9357('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0x9357('0xa')},'reportId':{'type':Sequelize[_0x9357('0xb')](0xb)[_0x9357('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x07d4=['ENUM','csv','xlsx','DATE','Loading','manual','scheduled','INTEGER','sequelize','moment','exports','STRING'];(function(_0x594808,_0x59e415){var _0x439dcb=function(_0x4a974f){while(--_0x4a974f){_0x594808['push'](_0x594808['shift']());}};_0x439dcb(++_0x59e415);}(_0x07d4,0x1a0));var _0x407d=function(_0x3b5819,_0x3d7caf){_0x3b5819=_0x3b5819-0x0;var _0x13c387=_0x07d4[_0x3b5819];return _0x13c387;};'use strict';var Sequelize=require(_0x407d('0x0'));var moment=require(_0x407d('0x1'));module[_0x407d('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x407d('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x407d('0x4')](_0x407d('0x5'),'pdf',_0x407d('0x6')),'allowNull':![],'defaultValue':_0x407d('0x5')},'savename':{'type':Sequelize[_0x407d('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x407d('0x7')]},'status':{'type':Sequelize[_0x407d('0x3')],'defaultValue':_0x407d('0x8')},'type':{'type':Sequelize['ENUM'](_0x407d('0x9'),_0x407d('0xa')),'allowNull':![],'defaultValue':_0x407d('0x9')},'reportId':{'type':Sequelize[_0x407d('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x407d('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 542ca92..ac78840 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab25=['includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','root','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','stack','name','send','index','AnalyticExtractedReport','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params'];(function(_0x2c8780,_0x3ec3a8){var _0x4c3ac9=function(_0x304ec3){while(--_0x304ec3){_0x2c8780['push'](_0x2c8780['shift']());}};_0x4c3ac9(++_0x3ec3a8);}(_0xab25,0x75));var _0x5ab2=function(_0x7ed2b2,_0x38e016){_0x7ed2b2=_0x7ed2b2-0x0;var _0x27320e=_0xab25[_0x7ed2b2];return _0x27320e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ab2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ab2('0x1'));var rp=require(_0x5ab2('0x2'));var moment=require('moment');var BPromise=require(_0x5ab2('0x3'));var Mustache=require(_0x5ab2('0x4'));var util=require('util');var path=require(_0x5ab2('0x5'));var sox=require(_0x5ab2('0x6'));var csv=require(_0x5ab2('0x7'));var ejs=require(_0x5ab2('0x8'));var fs=require('fs');var fs_extra=require(_0x5ab2('0x9'));var _=require(_0x5ab2('0xa'));var squel=require('squel');var crypto=require(_0x5ab2('0xb'));var jsforce=require(_0x5ab2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5ab2('0xd'));var Papa=require('papaparse');var Redis=require(_0x5ab2('0xe'));var authService=require(_0x5ab2('0xf'));var qs=require(_0x5ab2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ab2('0x11'));var logger=require(_0x5ab2('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x5ab2('0x13'));var licenseUtil=require(_0x5ab2('0x14'));var db=require(_0x5ab2('0x15'))['db'];function respondWithStatusCode(_0x1e0442,_0x4a512e){_0x4a512e=_0x4a512e||0xcc;return function(_0x32bc53){if(_0x32bc53){return _0x1e0442[_0x5ab2('0x16')](_0x4a512e);}return _0x1e0442['status'](_0x4a512e)[_0x5ab2('0x17')]();};}function respondWithResult(_0x4b01f4,_0x2e7fe2){_0x2e7fe2=_0x2e7fe2||0xc8;return function(_0x5746e0){if(_0x5746e0){return _0x4b01f4[_0x5ab2('0x18')](_0x2e7fe2)['json'](_0x5746e0);}};}function respondWithFilteredResult(_0x5589fd,_0x4b28ea){return function(_0x1bceaf){if(_0x1bceaf){var _0x7a6ba7=typeof _0x4b28ea[_0x5ab2('0x19')]===_0x5ab2('0x1a')&&typeof _0x4b28ea[_0x5ab2('0x1b')]===_0x5ab2('0x1a');var _0x7bcb6d=_0x1bceaf[_0x5ab2('0x1c')];var _0x43ee40=_0x7a6ba7?0x0:_0x4b28ea['offset'];var _0x30e6f4=_0x7a6ba7?_0x1bceaf[_0x5ab2('0x1c')]:_0x4b28ea[_0x5ab2('0x19')]+_0x4b28ea[_0x5ab2('0x1b')];var _0x241aa7;if(_0x30e6f4>=_0x7bcb6d){_0x30e6f4=_0x7bcb6d;_0x241aa7=0xc8;}else{_0x241aa7=0xce;}_0x5589fd[_0x5ab2('0x18')](_0x241aa7);return _0x5589fd[_0x5ab2('0x1d')](_0x5ab2('0x1e'),_0x43ee40+'-'+_0x30e6f4+'/'+_0x7bcb6d)['json'](_0x1bceaf);}return null;};}function patchUpdates(_0x282d32){return function(_0x31be65){try{jsonpatch['apply'](_0x31be65,_0x282d32,!![]);}catch(_0x5693dc){return BPromise[_0x5ab2('0x1f')](_0x5693dc);}return _0x31be65[_0x5ab2('0x20')]();};}function saveUpdates(_0x1620c2,_0x1c32c6){return function(_0x20f218){if(_0x20f218){return _0x20f218[_0x5ab2('0x21')](_0x1620c2)['then'](function(_0x1deb4d){return _0x1deb4d;});}return null;};}function removeEntity(_0x5de00d,_0x44f407){return function(_0x12323f){if(_0x12323f){return _0x12323f['destroy']()[_0x5ab2('0x22')](function(){var _0x5cd951=_0x12323f[_0x5ab2('0x23')]({'plain':!![]});var _0x481d9d=_0x5ab2('0x24');return db[_0x5ab2('0x25')][_0x5ab2('0x26')]({'where':{'type':_0x481d9d,'resourceId':_0x5cd951['id']}})[_0x5ab2('0x22')](function(){return _0x12323f;});})[_0x5ab2('0x22')](function(){_0x5de00d[_0x5ab2('0x18')](0xcc)[_0x5ab2('0x17')]();});}};}function handleEntityNotFound(_0x17b137,_0x2b416f){return function(_0xc18e7d){if(!_0xc18e7d){_0x17b137[_0x5ab2('0x16')](0x194);}return _0xc18e7d;};}function handleError(_0x54b58c,_0x2c07dd){_0x2c07dd=_0x2c07dd||0x1f4;return function(_0x43b8ef){logger['error'](_0x43b8ef[_0x5ab2('0x27')]);if(_0x43b8ef[_0x5ab2('0x28')]){delete _0x43b8ef['name'];}_0x54b58c['status'](_0x2c07dd)[_0x5ab2('0x29')](_0x43b8ef);};}exports[_0x5ab2('0x2a')]=function(_0x3a519b,_0x41e9bb){var _0x539c00={},_0x238f67={},_0x3f9b91={'count':0x0,'rows':[]};var _0x5b9999=_['map'](db[_0x5ab2('0x2b')][_0x5ab2('0x2c')],function(_0x9e10f9){return{'name':_0x9e10f9['fieldName'],'type':_0x9e10f9[_0x5ab2('0x2d')]['key']};});_0x238f67[_0x5ab2('0x2e')]=_[_0x5ab2('0x2f')](_0x5b9999,_0x5ab2('0x28'));_0x238f67['query']=_[_0x5ab2('0x30')](_0x3a519b[_0x5ab2('0x31')]);_0x238f67[_0x5ab2('0x32')]=_[_0x5ab2('0x33')](_0x238f67[_0x5ab2('0x2e')],_0x238f67[_0x5ab2('0x31')]);_0x539c00['attributes']=_[_0x5ab2('0x33')](_0x238f67[_0x5ab2('0x2e')],qs[_0x5ab2('0x34')](_0x3a519b[_0x5ab2('0x31')][_0x5ab2('0x34')]));_0x539c00[_0x5ab2('0x35')]=_0x539c00[_0x5ab2('0x35')][_0x5ab2('0x36')]?_0x539c00[_0x5ab2('0x35')]:_0x238f67[_0x5ab2('0x2e')];if(!_0x3a519b[_0x5ab2('0x31')][_0x5ab2('0x37')]('nolimit')){_0x539c00[_0x5ab2('0x1b')]=qs[_0x5ab2('0x1b')](_0x3a519b[_0x5ab2('0x31')][_0x5ab2('0x1b')]);_0x539c00[_0x5ab2('0x19')]=qs['offset'](_0x3a519b['query']['offset']);}_0x539c00[_0x5ab2('0x38')]=qs[_0x5ab2('0x39')](_0x3a519b[_0x5ab2('0x31')][_0x5ab2('0x39')]);_0x539c00[_0x5ab2('0x3a')]=qs['filters'](_[_0x5ab2('0x3b')](_0x3a519b[_0x5ab2('0x31')],_0x238f67[_0x5ab2('0x32')]),_0x5b9999);if(_0x3a519b[_0x5ab2('0x31')]['filter']){_0x539c00['where']=_[_0x5ab2('0x3c')](_0x539c00[_0x5ab2('0x3a')],{'$or':_[_0x5ab2('0x2f')](_0x5b9999,function(_0x3a87a6){if(_0x3a87a6['type']!==_0x5ab2('0x3d')){var _0x37d7a3={};_0x37d7a3[_0x3a87a6[_0x5ab2('0x28')]]={'$like':'%'+_0x3a519b['query'][_0x5ab2('0x3e')]+'%'};return _0x37d7a3;}})});}_0x539c00=_[_0x5ab2('0x3c')]({},_0x539c00,_0x3a519b['options']);var _0x30da54={'where':_0x539c00['where']};return db[_0x5ab2('0x2b')]['count'](_0x30da54)[_0x5ab2('0x22')](function(_0x38bff1){_0x3f9b91['count']=_0x38bff1;if(_0x3a519b[_0x5ab2('0x31')]['includeAll']){_0x539c00[_0x5ab2('0x3f')]=[{'all':!![]}];}return db[_0x5ab2('0x2b')][_0x5ab2('0x40')](_0x539c00);})[_0x5ab2('0x22')](function(_0x1217d9){_0x3f9b91[_0x5ab2('0x41')]=_0x1217d9;return _0x3f9b91;})[_0x5ab2('0x22')](respondWithFilteredResult(_0x41e9bb,_0x539c00))[_0x5ab2('0x42')](handleError(_0x41e9bb,null));};exports[_0x5ab2('0x43')]=function(_0x38ac60,_0x1ca3f4){var _0x5bfa7e={'raw':!![],'where':{'id':_0x38ac60[_0x5ab2('0x44')]['id']}},_0x584ddc={};_0x584ddc[_0x5ab2('0x2e')]=_[_0x5ab2('0x30')](db[_0x5ab2('0x2b')]['rawAttributes']);_0x584ddc[_0x5ab2('0x31')]=_[_0x5ab2('0x30')](_0x38ac60[_0x5ab2('0x31')]);_0x584ddc['filters']=_['intersection'](_0x584ddc['model'],_0x584ddc[_0x5ab2('0x31')]);_0x5bfa7e['attributes']=_[_0x5ab2('0x33')](_0x584ddc[_0x5ab2('0x2e')],qs[_0x5ab2('0x34')](_0x38ac60[_0x5ab2('0x31')][_0x5ab2('0x34')]));_0x5bfa7e[_0x5ab2('0x35')]=_0x5bfa7e['attributes'][_0x5ab2('0x36')]?_0x5bfa7e[_0x5ab2('0x35')]:_0x584ddc[_0x5ab2('0x2e')];if(_0x38ac60['query'][_0x5ab2('0x45')]){_0x5bfa7e['include']=[{'all':!![]}];}_0x5bfa7e=_[_0x5ab2('0x3c')]({},_0x5bfa7e,_0x38ac60['options']);return db[_0x5ab2('0x2b')][_0x5ab2('0x46')](_0x5bfa7e)['then'](handleEntityNotFound(_0x1ca3f4,null))['then'](respondWithResult(_0x1ca3f4,null))['catch'](handleError(_0x1ca3f4,null));};exports[_0x5ab2('0x47')]=function(_0x3103dd,_0x3aaf70){return db[_0x5ab2('0x2b')]['create'](_0x3103dd[_0x5ab2('0x48')],{})['then'](function(_0x16abb5){var _0x5655dd=_0x3103dd[_0x5ab2('0x49')][_0x5ab2('0x23')]({'plain':!![]});if(!_0x5655dd)throw new Error(_0x5ab2('0x4a'));if(_0x5655dd[_0x5ab2('0x4b')]===_0x5ab2('0x49')){var _0x2353e3=_0x16abb5[_0x5ab2('0x23')]({'plain':!![]});var _0x2415e1=_0x5ab2('0x24');return db[_0x5ab2('0x4c')]['find']({'where':{'name':_0x2415e1,'userProfileId':_0x5655dd[_0x5ab2('0x4d')]},'raw':!![]})['then'](function(_0x3a81fe){if(_0x3a81fe&&_0x3a81fe[_0x5ab2('0x4e')]===0x0){return db[_0x5ab2('0x25')]['create']({'name':_0x2353e3['name'],'resourceId':_0x2353e3['id'],'type':_0x3a81fe[_0x5ab2('0x28')],'sectionId':_0x3a81fe['id']},{})[_0x5ab2('0x22')](function(){return _0x16abb5;});}else{return _0x16abb5;}})[_0x5ab2('0x42')](function(_0xbe2c0a){logger[_0x5ab2('0x4f')](_0x5ab2('0x50'),_0xbe2c0a);throw _0xbe2c0a;});}return _0x16abb5;})[_0x5ab2('0x22')](respondWithResult(_0x3aaf70,0xc9))[_0x5ab2('0x42')](handleError(_0x3aaf70,null));};exports[_0x5ab2('0x21')]=function(_0x2126f4,_0xee5dad){if(_0x2126f4[_0x5ab2('0x48')]['id']){delete _0x2126f4[_0x5ab2('0x48')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x2126f4[_0x5ab2('0x44')]['id']}})['then'](handleEntityNotFound(_0xee5dad,null))[_0x5ab2('0x22')](saveUpdates(_0x2126f4['body'],null))['then'](respondWithResult(_0xee5dad,null))[_0x5ab2('0x42')](handleError(_0xee5dad,null));};exports[_0x5ab2('0x26')]=function(_0x18bb40,_0x54f8fd){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x18bb40[_0x5ab2('0x44')]['id']}})[_0x5ab2('0x22')](handleEntityNotFound(_0x54f8fd,null))[_0x5ab2('0x22')](removeEntity(_0x54f8fd,null))[_0x5ab2('0x42')](handleError(_0x54f8fd,null));};exports[_0x5ab2('0x51')]=function(_0x2e3483,_0x18826e,_0x3d1282){return db[_0x5ab2('0x2b')][_0x5ab2('0x46')]({'where':{'id':_0x2e3483[_0x5ab2('0x44')]['id']},'attributes':[_0x5ab2('0x28'),_0x5ab2('0x52'),'savename',_0x5ab2('0x53')],'raw':!![]})[_0x5ab2('0x22')](handleEntityNotFound(_0x18826e,null))[_0x5ab2('0x22')](function(_0x5f54f5){if(_0x5f54f5){if(!fs[_0x5ab2('0x54')](path[_0x5ab2('0x55')](config[_0x5ab2('0x56')],_0x5ab2('0x57'),_0x5f54f5[_0x5ab2('0x58')]))){throw new db['Sequelize'][(_0x5ab2('0x59'))](_0x5ab2('0x5a'));}if(_0x2e3483[_0x5ab2('0x31')]['exists']){return _0x18826e[_0x5ab2('0x16')](0xc8);}return _0x18826e[_0x5ab2('0x51')](path[_0x5ab2('0x55')](config['root'],_0x5ab2('0x57'),_0x5f54f5[_0x5ab2('0x58')]),util[_0x5ab2('0x5b')](_0x5ab2('0x5c'),_0x5f54f5['basename']||_0x5f54f5[_0x5ab2('0x28')],_0x5f54f5[_0x5ab2('0x53')]['toLowerCase']()));}})[_0x5ab2('0x42')](handleError(_0x18826e,null));}; \ No newline at end of file +var _0x651e=['map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','savename','output','join','server/files/reports','Sequelize','exists','format','%s.%s','basename','toLowerCase','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','get','ExtractedReports','destroy','sendStatus','error','stack','name','send'];(function(_0xc7f885,_0x1f8b90){var _0x2e146c=function(_0x48b8ec){while(--_0x48b8ec){_0xc7f885['push'](_0xc7f885['shift']());}};_0x2e146c(++_0x1f8b90);}(_0x651e,0x19f));var _0xe651=function(_0x200ab8,_0x5afe01){_0x200ab8=_0x200ab8-0x0;var _0x40791a=_0x651e[_0x200ab8];return _0x40791a;};'use strict';var emlformat=require(_0xe651('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe651('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe651('0x2'));var moment=require(_0xe651('0x3'));var BPromise=require(_0xe651('0x4'));var Mustache=require(_0xe651('0x5'));var util=require(_0xe651('0x6'));var path=require('path');var sox=require(_0xe651('0x7'));var csv=require(_0xe651('0x8'));var ejs=require(_0xe651('0x9'));var fs=require('fs');var fs_extra=require(_0xe651('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe651('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe651('0xc'));var toCsv=require(_0xe651('0x8'));var querystring=require(_0xe651('0xd'));var Papa=require(_0xe651('0xe'));var Redis=require(_0xe651('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe651('0x10'));var as=require(_0xe651('0x11'));var hardwareService=require(_0xe651('0x12'));var logger=require('../../config/logger')(_0xe651('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe651('0x14'))['db'];function respondWithStatusCode(_0x18612e,_0x34f8c3){_0x34f8c3=_0x34f8c3||0xcc;return function(_0x36c5be){if(_0x36c5be){return _0x18612e['sendStatus'](_0x34f8c3);}return _0x18612e[_0xe651('0x15')](_0x34f8c3)[_0xe651('0x16')]();};}function respondWithResult(_0x15b815,_0x35e02a){_0x35e02a=_0x35e02a||0xc8;return function(_0x3159bc){if(_0x3159bc){return _0x15b815[_0xe651('0x15')](_0x35e02a)[_0xe651('0x17')](_0x3159bc);}};}function respondWithFilteredResult(_0xaad455,_0x3a5d3a){return function(_0x7f1b18){if(_0x7f1b18){var _0x2a88e1=typeof _0x3a5d3a[_0xe651('0x18')]===_0xe651('0x19')&&typeof _0x3a5d3a[_0xe651('0x1a')]===_0xe651('0x19');var _0xa757b5=_0x7f1b18[_0xe651('0x1b')];var _0x4e8dd2=_0x2a88e1?0x0:_0x3a5d3a[_0xe651('0x18')];var _0x498426=_0x2a88e1?_0x7f1b18['count']:_0x3a5d3a[_0xe651('0x18')]+_0x3a5d3a[_0xe651('0x1a')];var _0x4d3b46;if(_0x498426>=_0xa757b5){_0x498426=_0xa757b5;_0x4d3b46=0xc8;}else{_0x4d3b46=0xce;}_0xaad455[_0xe651('0x15')](_0x4d3b46);return _0xaad455['set'](_0xe651('0x1c'),_0x4e8dd2+'-'+_0x498426+'/'+_0xa757b5)['json'](_0x7f1b18);}return null;};}function patchUpdates(_0x459240){return function(_0x486f70){try{jsonpatch['apply'](_0x486f70,_0x459240,!![]);}catch(_0x6528eb){return BPromise['reject'](_0x6528eb);}return _0x486f70[_0xe651('0x1d')]();};}function saveUpdates(_0x3b6460,_0xbc66b9){return function(_0x2da77e){if(_0x2da77e){return _0x2da77e[_0xe651('0x1e')](_0x3b6460)[_0xe651('0x1f')](function(_0x34beb0){return _0x34beb0;});}return null;};}function removeEntity(_0x36bc50,_0x4a6b12){return function(_0x294973){if(_0x294973){return _0x294973['destroy']()[_0xe651('0x1f')](function(){var _0x5c2a41=_0x294973[_0xe651('0x20')]({'plain':!![]});var _0x3491fa=_0xe651('0x21');return db['UserProfileResource'][_0xe651('0x22')]({'where':{'type':_0x3491fa,'resourceId':_0x5c2a41['id']}})[_0xe651('0x1f')](function(){return _0x294973;});})[_0xe651('0x1f')](function(){_0x36bc50['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51c598,_0x17161e){return function(_0x3090dc){if(!_0x3090dc){_0x51c598[_0xe651('0x23')](0x194);}return _0x3090dc;};}function handleError(_0x3e765b,_0x59ced0){_0x59ced0=_0x59ced0||0x1f4;return function(_0x319348){logger[_0xe651('0x24')](_0x319348[_0xe651('0x25')]);if(_0x319348[_0xe651('0x26')]){delete _0x319348[_0xe651('0x26')];}_0x3e765b[_0xe651('0x15')](_0x59ced0)[_0xe651('0x27')](_0x319348);};}exports['index']=function(_0x4d3444,_0x3ba6c4){var _0x6158a2={},_0x53c245={},_0x3efd6c={'count':0x0,'rows':[]};var _0x3957e9=_[_0xe651('0x28')](db[_0xe651('0x29')][_0xe651('0x2a')],function(_0x590606){return{'name':_0x590606[_0xe651('0x2b')],'type':_0x590606[_0xe651('0x2c')][_0xe651('0x2d')]};});_0x53c245[_0xe651('0x2e')]=_['map'](_0x3957e9,_0xe651('0x26'));_0x53c245[_0xe651('0x2f')]=_[_0xe651('0x30')](_0x4d3444[_0xe651('0x2f')]);_0x53c245[_0xe651('0x31')]=_[_0xe651('0x32')](_0x53c245[_0xe651('0x2e')],_0x53c245['query']);_0x6158a2[_0xe651('0x33')]=_['intersection'](_0x53c245[_0xe651('0x2e')],qs[_0xe651('0x34')](_0x4d3444[_0xe651('0x2f')][_0xe651('0x34')]));_0x6158a2[_0xe651('0x33')]=_0x6158a2[_0xe651('0x33')]['length']?_0x6158a2[_0xe651('0x33')]:_0x53c245[_0xe651('0x2e')];if(!_0x4d3444[_0xe651('0x2f')][_0xe651('0x35')]('nolimit')){_0x6158a2[_0xe651('0x1a')]=qs[_0xe651('0x1a')](_0x4d3444[_0xe651('0x2f')][_0xe651('0x1a')]);_0x6158a2['offset']=qs[_0xe651('0x18')](_0x4d3444[_0xe651('0x2f')][_0xe651('0x18')]);}_0x6158a2[_0xe651('0x36')]=qs[_0xe651('0x37')](_0x4d3444[_0xe651('0x2f')][_0xe651('0x37')]);_0x6158a2[_0xe651('0x38')]=qs['filters'](_[_0xe651('0x39')](_0x4d3444['query'],_0x53c245[_0xe651('0x31')]),_0x3957e9);if(_0x4d3444[_0xe651('0x2f')]['filter']){_0x6158a2[_0xe651('0x38')]=_[_0xe651('0x3a')](_0x6158a2[_0xe651('0x38')],{'$or':_[_0xe651('0x28')](_0x3957e9,function(_0x16cb7a){if(_0x16cb7a[_0xe651('0x2c')]!=='VIRTUAL'){var _0x4dfb11={};_0x4dfb11[_0x16cb7a[_0xe651('0x26')]]={'$like':'%'+_0x4d3444['query'][_0xe651('0x3b')]+'%'};return _0x4dfb11;}})});}_0x6158a2=_[_0xe651('0x3a')]({},_0x6158a2,_0x4d3444[_0xe651('0x3c')]);var _0x5b3406={'where':_0x6158a2[_0xe651('0x38')]};return db[_0xe651('0x29')]['count'](_0x5b3406)[_0xe651('0x1f')](function(_0x1739b1){_0x3efd6c[_0xe651('0x1b')]=_0x1739b1;if(_0x4d3444['query'][_0xe651('0x3d')]){_0x6158a2[_0xe651('0x3e')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xe651('0x3f')](_0x6158a2);})[_0xe651('0x1f')](function(_0x1d0138){_0x3efd6c[_0xe651('0x40')]=_0x1d0138;return _0x3efd6c;})['then'](respondWithFilteredResult(_0x3ba6c4,_0x6158a2))[_0xe651('0x41')](handleError(_0x3ba6c4,null));};exports[_0xe651('0x42')]=function(_0x9a666d,_0x4d9d9c){var _0x1c31e0={'raw':!![],'where':{'id':_0x9a666d['params']['id']}},_0x142f49={};_0x142f49[_0xe651('0x2e')]=_['keys'](db[_0xe651('0x29')]['rawAttributes']);_0x142f49['query']=_[_0xe651('0x30')](_0x9a666d[_0xe651('0x2f')]);_0x142f49[_0xe651('0x31')]=_[_0xe651('0x32')](_0x142f49[_0xe651('0x2e')],_0x142f49[_0xe651('0x2f')]);_0x1c31e0[_0xe651('0x33')]=_[_0xe651('0x32')](_0x142f49[_0xe651('0x2e')],qs[_0xe651('0x34')](_0x9a666d[_0xe651('0x2f')][_0xe651('0x34')]));_0x1c31e0[_0xe651('0x33')]=_0x1c31e0[_0xe651('0x33')][_0xe651('0x43')]?_0x1c31e0[_0xe651('0x33')]:_0x142f49[_0xe651('0x2e')];if(_0x9a666d[_0xe651('0x2f')]['includeAll']){_0x1c31e0[_0xe651('0x3e')]=[{'all':!![]}];}_0x1c31e0=_[_0xe651('0x3a')]({},_0x1c31e0,_0x9a666d[_0xe651('0x3c')]);return db[_0xe651('0x29')]['find'](_0x1c31e0)['then'](handleEntityNotFound(_0x4d9d9c,null))[_0xe651('0x1f')](respondWithResult(_0x4d9d9c,null))[_0xe651('0x41')](handleError(_0x4d9d9c,null));};exports['create']=function(_0x2df465,_0x11ea2a){return db['AnalyticExtractedReport'][_0xe651('0x44')](_0x2df465[_0xe651('0x45')],{})[_0xe651('0x1f')](function(_0x13457f){var _0x5d5d61=_0x2df465[_0xe651('0x46')][_0xe651('0x20')]({'plain':!![]});if(!_0x5d5d61)throw new Error(_0xe651('0x47'));if(_0x5d5d61[_0xe651('0x48')]===_0xe651('0x46')){var _0x74e84b=_0x13457f['get']({'plain':!![]});var _0x287d70=_0xe651('0x21');return db[_0xe651('0x49')][_0xe651('0x4a')]({'where':{'name':_0x287d70,'userProfileId':_0x5d5d61[_0xe651('0x4b')]},'raw':!![]})[_0xe651('0x1f')](function(_0x3d19db){if(_0x3d19db&&_0x3d19db[_0xe651('0x4c')]===0x0){return db[_0xe651('0x4d')]['create']({'name':_0x74e84b['name'],'resourceId':_0x74e84b['id'],'type':_0x3d19db['name'],'sectionId':_0x3d19db['id']},{})[_0xe651('0x1f')](function(){return _0x13457f;});}else{return _0x13457f;}})[_0xe651('0x41')](function(_0x590682){logger[_0xe651('0x24')](_0xe651('0x4e'),_0x590682);throw _0x590682;});}return _0x13457f;})[_0xe651('0x1f')](respondWithResult(_0x11ea2a,0xc9))[_0xe651('0x41')](handleError(_0x11ea2a,null));};exports[_0xe651('0x1e')]=function(_0x121d88,_0x495378){if(_0x121d88['body']['id']){delete _0x121d88[_0xe651('0x45')]['id'];}return db[_0xe651('0x29')]['find']({'where':{'id':_0x121d88[_0xe651('0x4f')]['id']}})[_0xe651('0x1f')](handleEntityNotFound(_0x495378,null))[_0xe651('0x1f')](saveUpdates(_0x121d88[_0xe651('0x45')],null))[_0xe651('0x1f')](respondWithResult(_0x495378,null))[_0xe651('0x41')](handleError(_0x495378,null));};exports[_0xe651('0x22')]=function(_0x564071,_0x2c66bc){return db[_0xe651('0x29')][_0xe651('0x4a')]({'where':{'id':_0x564071[_0xe651('0x4f')]['id']}})[_0xe651('0x1f')](handleEntityNotFound(_0x2c66bc,null))['then'](removeEntity(_0x2c66bc,null))[_0xe651('0x41')](handleError(_0x2c66bc,null));};exports[_0xe651('0x50')]=function(_0x480319,_0x77073a,_0x50e95f){return db[_0xe651('0x29')][_0xe651('0x4a')]({'where':{'id':_0x480319[_0xe651('0x4f')]['id']},'attributes':[_0xe651('0x26'),'basename',_0xe651('0x51'),_0xe651('0x52')],'raw':!![]})[_0xe651('0x1f')](handleEntityNotFound(_0x77073a,null))[_0xe651('0x1f')](function(_0x25ab12){if(_0x25ab12){if(!fs['existsSync'](path[_0xe651('0x53')](config['root'],_0xe651('0x54'),_0x25ab12[_0xe651('0x51')]))){throw new db[(_0xe651('0x55'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x480319['query'][_0xe651('0x56')]){return _0x77073a[_0xe651('0x23')](0xc8);}return _0x77073a[_0xe651('0x50')](path[_0xe651('0x53')](config['root'],_0xe651('0x54'),_0x25ab12['savename']),util[_0xe651('0x57')](_0xe651('0x58'),_0x25ab12[_0xe651('0x59')]||_0x25ab12[_0xe651('0x26')],_0x25ab12['output'][_0xe651('0x5a')]()));}})['catch'](handleError(_0x77073a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 81fe8f1..5e925d6 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.model.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05ce=['exports','define','lodash','util','../../config/logger','moment','path','./analyticExtractedReport.attributes'];(function(_0x3eaf6b,_0x3b1ccd){var _0x5c5a97=function(_0x128525){while(--_0x128525){_0x3eaf6b['push'](_0x3eaf6b['shift']());}};_0x5c5a97(++_0x3b1ccd);}(_0x05ce,0x7a));var _0xe05c=function(_0x5d26b5,_0x286d11){_0x5d26b5=_0x5d26b5-0x0;var _0x36ea7f=_0x05ce[_0x5d26b5];return _0x36ea7f;};'use strict';var _=require(_0xe05c('0x0'));var util=require(_0xe05c('0x1'));var logger=require(_0xe05c('0x2'))('api');var moment=require(_0xe05c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe05c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe05c('0x5'));module[_0xe05c('0x6')]=function(_0x1d700c,_0x1b8b95){return _0x1d700c[_0xe05c('0x7')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd7=['define','analytics_extracted_reports','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5a8d63,_0x18ea42){var _0x161a1a=function(_0x1850ac){while(--_0x1850ac){_0x5a8d63['push'](_0x5a8d63['shift']());}};_0x161a1a(++_0x18ea42);}(_0xcdd7,0x1db));var _0x7cdd=function(_0xeedcc,_0x59fff8){_0xeedcc=_0xeedcc-0x0;var _0x4d5c35=_0xcdd7[_0xeedcc];return _0x4d5c35;};'use strict';var _=require(_0x7cdd('0x0'));var util=require('util');var logger=require(_0x7cdd('0x1'))(_0x7cdd('0x2'));var moment=require(_0x7cdd('0x3'));var BPromise=require('bluebird');var rp=require(_0x7cdd('0x4'));var fs=require('fs');var path=require(_0x7cdd('0x5'));var rimraf=require(_0x7cdd('0x6'));var config=require(_0x7cdd('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x7cdd('0x8')]=function(_0x1343a4,_0x2d5f45){return _0x1343a4[_0x7cdd('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0x7cdd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 36f9696..ce9e46f 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1648=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x6133cf,_0x2c8596){var _0x3e5cb5=function(_0xbc7db1){while(--_0xbc7db1){_0x6133cf['push'](_0x6133cf['shift']());}};_0x3e5cb5(++_0x2c8596);}(_0x1648,0xa7));var _0x8164=function(_0x39c9d0,_0x5cf7e8){_0x39c9d0=_0x39c9d0-0x0;var _0x51427c=_0x1648[_0x39c9d0];return _0x51427c;};'use strict';var _=require(_0x8164('0x0'));var util=require(_0x8164('0x1'));var moment=require(_0x8164('0x2'));var BPromise=require(_0x8164('0x3'));var rs=require(_0x8164('0x4'));var fs=require('fs');var Redis=require(_0x8164('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8164('0x6'));var logger=require(_0x8164('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8164('0x8'));var client=jayson[_0x8164('0x9')][_0x8164('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d8f79,_0x4a186f,_0x15516b){return new BPromise(function(_0x46481a,_0x169df5){return client[_0x8164('0xb')](_0x1d8f79,_0x15516b)[_0x8164('0xc')](function(_0x27867c){logger['info'](_0x8164('0xd'),_0x4a186f,_0x8164('0xe'));logger[_0x8164('0xf')](_0x8164('0x10'),_0x4a186f,_0x8164('0xe'),JSON[_0x8164('0x11')](_0x27867c));if(_0x27867c['error']){if(_0x27867c[_0x8164('0x12')][_0x8164('0x13')]===0x1f4){logger[_0x8164('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a186f,_0x27867c['error'][_0x8164('0x14')]);return _0x169df5(_0x27867c[_0x8164('0x12')][_0x8164('0x14')]);}logger[_0x8164('0x12')](_0x8164('0xd'),_0x4a186f,_0x27867c[_0x8164('0x12')]['message']);return _0x46481a(_0x27867c[_0x8164('0x12')]['message']);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a186f,_0x8164('0xe'));_0x46481a(_0x27867c[_0x8164('0x15')][_0x8164('0x14')]);}})[_0x8164('0x16')](function(_0x3f9a8f){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a186f,_0x3f9a8f);_0x169df5(_0x3f9a8f);});});} \ No newline at end of file +var _0x9e47=['client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5ebf3e,_0x476696){var _0x40f180=function(_0x59b9cc){while(--_0x59b9cc){_0x5ebf3e['push'](_0x5ebf3e['shift']());}};_0x40f180(++_0x476696);}(_0x9e47,0xe7));var _0x79e4=function(_0x364050,_0x3270b7){_0x364050=_0x364050-0x0;var _0x368337=_0x9e47[_0x364050];return _0x368337;};'use strict';var _=require(_0x79e4('0x0'));var util=require(_0x79e4('0x1'));var moment=require(_0x79e4('0x2'));var BPromise=require(_0x79e4('0x3'));var rs=require(_0x79e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x79e4('0x5'));var logger=require(_0x79e4('0x6'))('rpc');var config=require(_0x79e4('0x7'));var jayson=require(_0x79e4('0x8'));var client=jayson[_0x79e4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229bd5,_0x3dca7b,_0x356327){return new BPromise(function(_0x563474,_0x3eecf4){return client[_0x79e4('0xa')](_0x229bd5,_0x356327)[_0x79e4('0xb')](function(_0x4c3ea5){logger[_0x79e4('0xc')](_0x79e4('0xd'),_0x3dca7b,'request\x20sent');logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x3dca7b,_0x79e4('0xe'),JSON[_0x79e4('0xf')](_0x4c3ea5));if(_0x4c3ea5[_0x79e4('0x10')]){if(_0x4c3ea5['error']['code']===0x1f4){logger[_0x79e4('0x10')](_0x79e4('0xd'),_0x3dca7b,_0x4c3ea5[_0x79e4('0x10')][_0x79e4('0x11')]);return _0x3eecf4(_0x4c3ea5[_0x79e4('0x10')][_0x79e4('0x11')]);}logger['error'](_0x79e4('0xd'),_0x3dca7b,_0x4c3ea5['error'][_0x79e4('0x11')]);return _0x563474(_0x4c3ea5[_0x79e4('0x10')][_0x79e4('0x11')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x3dca7b,'request\x20sent');_0x563474(_0x4c3ea5[_0x79e4('0x12')][_0x79e4('0x11')]);}})[_0x79e4('0x13')](function(_0x588c7b){logger['error'](_0x79e4('0xd'),_0x3dca7b,_0x588c7b);_0x3eecf4(_0x588c7b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 871916c..e5d5364 100644 --- a/server/api/analyticExtractedReport/index.js +++ b/server/api/analyticExtractedReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbc9=['fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/download','download','create','put','destroy','util','path','connect-timeout','express','Router'];(function(_0x5cd097,_0x49f9ac){var _0x1c4d0d=function(_0x228845){while(--_0x228845){_0x5cd097['push'](_0x5cd097['shift']());}};_0x1c4d0d(++_0x49f9ac);}(_0xbbc9,0x94));var _0x9bbc=function(_0x5b41bd,_0x2b5374){_0x5b41bd=_0x5b41bd-0x0;var _0x559c03=_0xbbc9[_0x5b41bd];return _0x559c03;};'use strict';var multer=require('multer');var util=require(_0x9bbc('0x0'));var path=require(_0x9bbc('0x1'));var timeout=require(_0x9bbc('0x2'));var express=require(_0x9bbc('0x3'));var router=express[_0x9bbc('0x4')]();var fs_extra=require(_0x9bbc('0x5'));var auth=require(_0x9bbc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x9bbc('0x7')]('/',auth[_0x9bbc('0x8')](),controller[_0x9bbc('0x9')]);router[_0x9bbc('0x7')](_0x9bbc('0xa'),auth[_0x9bbc('0x8')](),controller[_0x9bbc('0xb')]);router['get'](_0x9bbc('0xc'),auth['isAuthenticated'](),controller[_0x9bbc('0xd')]);router['post']('/',auth[_0x9bbc('0x8')](),controller[_0x9bbc('0xe')]);router[_0x9bbc('0xf')](_0x9bbc('0xa'),auth[_0x9bbc('0x8')](),controller['update']);router['delete']('/:id',auth[_0x9bbc('0x8')](),controller[_0x9bbc('0x10')]);module['exports']=router; \ No newline at end of file +var _0x377f=['isAuthenticated','index','/:id','/:id/download','download','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x58a049,_0x1e9ab2){var _0x4d7aca=function(_0x162ff5){while(--_0x162ff5){_0x58a049['push'](_0x58a049['shift']());}};_0x4d7aca(++_0x1e9ab2);}(_0x377f,0x144));var _0xf377=function(_0x1659c1,_0x24882f){_0x1659c1=_0x1659c1-0x0;var _0xaefe5a=_0x377f[_0x1659c1];return _0xaefe5a;};'use strict';var multer=require(_0xf377('0x0'));var util=require(_0xf377('0x1'));var path=require(_0xf377('0x2'));var timeout=require(_0xf377('0x3'));var express=require(_0xf377('0x4'));var router=express[_0xf377('0x5')]();var fs_extra=require(_0xf377('0x6'));var auth=require(_0xf377('0x7'));var interaction=require(_0xf377('0x8'));var config=require(_0xf377('0x9'));var controller=require(_0xf377('0xa'));router[_0xf377('0xb')]('/',auth[_0xf377('0xc')](),controller[_0xf377('0xd')]);router[_0xf377('0xb')](_0xf377('0xe'),auth[_0xf377('0xc')](),controller['show']);router['get'](_0xf377('0xf'),auth[_0xf377('0xc')](),controller[_0xf377('0x10')]);router[_0xf377('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf377('0xe'),auth[_0xf377('0xc')](),controller[_0xf377('0x12')]);router[_0xf377('0x13')](_0xf377('0xe'),auth[_0xf377('0xc')](),controller[_0xf377('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index cb5c410..dc5fb25 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5db5=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x20c7f9,_0x1460d5){var _0x304481=function(_0xbe8099){while(--_0xbe8099){_0x20c7f9['push'](_0x20c7f9['shift']());}};_0x304481(++_0x1460d5);}(_0x5db5,0xae));var _0x55db=function(_0x153253,_0x934bb2){_0x153253=_0x153253-0x0;var _0x1e18e1=_0x5db5[_0x153253];return _0x1e18e1;};'use strict';var Sequelize=require(_0x55db('0x0'));module['exports']={'field':{'type':Sequelize[_0x55db('0x1')]},'alias':{'type':Sequelize[_0x55db('0x2')]},'function':{'type':Sequelize[_0x55db('0x2')]},'format':{'type':Sequelize[_0x55db('0x2')]},'groupBy':{'type':Sequelize[_0x55db('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x55db('0x2')]},'custom':{'type':Sequelize[_0x55db('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x68e7=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x5cfe74,_0x26fcf1){var _0x4751e7=function(_0x2a7898){while(--_0x2a7898){_0x5cfe74['push'](_0x5cfe74['shift']());}};_0x4751e7(++_0x26fcf1);}(_0x68e7,0xdb));var _0x768e=function(_0x4401ef,_0x221a30){_0x4401ef=_0x4401ef-0x0;var _0x2326d8=_0x68e7[_0x4401ef];return _0x2326d8;};'use strict';var Sequelize=require(_0x768e('0x0'));module[_0x768e('0x1')]={'field':{'type':Sequelize[_0x768e('0x2')]},'alias':{'type':Sequelize[_0x768e('0x3')]},'function':{'type':Sequelize[_0x768e('0x3')]},'format':{'type':Sequelize[_0x768e('0x3')]},'groupBy':{'type':Sequelize[_0x768e('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x768e('0x3')]},'custom':{'type':Sequelize[_0x768e('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 94d2071..b9d3284 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.controller.js +++ b/server/api/analyticFieldReport/analyticFieldReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x027f=['bulkDestroy','addFields','findOne','sequelize','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','filters','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','AnalyticFieldReport','includeAll','include','catch','show','params','keys','intersection','find','create','bulkCreate','body'];(function(_0x335fbc,_0x28bbc8){var _0x2497b9=function(_0x3729dd){while(--_0x3729dd){_0x335fbc['push'](_0x335fbc['shift']());}};_0x2497b9(++_0x28bbc8);}(_0x027f,0x14a));var _0xf027=function(_0x39ab26,_0x40f18f){_0x39ab26=_0x39ab26-0x0;var _0x3a3796=_0x027f[_0x39ab26];return _0x3a3796;};'use strict';var emlformat=require(_0xf027('0x0'));var rimraf=require(_0xf027('0x1'));var zipdir=require(_0xf027('0x2'));var jsonpatch=require(_0xf027('0x3'));var rp=require(_0xf027('0x4'));var moment=require(_0xf027('0x5'));var BPromise=require(_0xf027('0x6'));var Mustache=require(_0xf027('0x7'));var util=require(_0xf027('0x8'));var path=require(_0xf027('0x9'));var sox=require('sox');var csv=require(_0xf027('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf027('0xb'));var crypto=require(_0xf027('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf027('0xd'));var toCsv=require(_0xf027('0xa'));var querystring=require(_0xf027('0xe'));var Papa=require('papaparse');var Redis=require(_0xf027('0xf'));var authService=require(_0xf027('0x10'));var qs=require(_0xf027('0x11'));var as=require(_0xf027('0x12'));var hardwareService=require(_0xf027('0x13'));var logger=require(_0xf027('0x14'))(_0xf027('0x15'));var utils=require(_0xf027('0x16'));var config=require(_0xf027('0x17'));var licenseUtil=require(_0xf027('0x18'));var db=require(_0xf027('0x19'))['db'];function respondWithStatusCode(_0x41c278,_0x401e1c){_0x401e1c=_0x401e1c||0xcc;return function(_0x250177){if(_0x250177){return _0x41c278[_0xf027('0x1a')](_0x401e1c);}return _0x41c278[_0xf027('0x1b')](_0x401e1c)[_0xf027('0x1c')]();};}function respondWithResult(_0x29d535,_0x4338de){_0x4338de=_0x4338de||0xc8;return function(_0x38d98f){if(_0x38d98f){return _0x29d535['status'](_0x4338de)[_0xf027('0x1d')](_0x38d98f);}};}function respondWithFilteredResult(_0x23cea0,_0x3fd2d6){return function(_0x4cd123){if(_0x4cd123){var _0x5a3019=typeof _0x3fd2d6[_0xf027('0x1e')]===_0xf027('0x1f')&&typeof _0x3fd2d6['limit']===_0xf027('0x1f');var _0x2b36f8=_0x4cd123['count'];var _0x1ad7e8=_0x5a3019?0x0:_0x3fd2d6[_0xf027('0x1e')];var _0x106e7b=_0x5a3019?_0x4cd123[_0xf027('0x20')]:_0x3fd2d6[_0xf027('0x1e')]+_0x3fd2d6[_0xf027('0x21')];var _0x3bdb13;if(_0x106e7b>=_0x2b36f8){_0x106e7b=_0x2b36f8;_0x3bdb13=0xc8;}else{_0x3bdb13=0xce;}_0x23cea0[_0xf027('0x1b')](_0x3bdb13);return _0x23cea0[_0xf027('0x22')](_0xf027('0x23'),_0x1ad7e8+'-'+_0x106e7b+'/'+_0x2b36f8)['json'](_0x4cd123);}return null;};}function patchUpdates(_0x54dddd){return function(_0x18ad2d){try{jsonpatch[_0xf027('0x24')](_0x18ad2d,_0x54dddd,!![]);}catch(_0x44d68d){return BPromise['reject'](_0x44d68d);}return _0x18ad2d[_0xf027('0x25')]();};}function saveUpdates(_0x3daa93,_0x109999){return function(_0x24882d){if(_0x24882d){return _0x24882d[_0xf027('0x26')](_0x3daa93)[_0xf027('0x27')](function(_0xa91868){return _0xa91868;});}return null;};}function removeEntity(_0x5ca670,_0xfb26f0){return function(_0x1fd722){if(_0x1fd722){return _0x1fd722[_0xf027('0x28')]()['then'](function(){_0x5ca670[_0xf027('0x1b')](0xcc)[_0xf027('0x1c')]();});}};}function handleEntityNotFound(_0x2b98d1,_0x1198bd){return function(_0x265801){if(!_0x265801){_0x2b98d1[_0xf027('0x1a')](0x194);}return _0x265801;};}function handleError(_0x565661,_0x315d77){_0x315d77=_0x315d77||0x1f4;return function(_0x4fa95e){logger['error'](_0x4fa95e[_0xf027('0x29')]);if(_0x4fa95e[_0xf027('0x2a')]){delete _0x4fa95e[_0xf027('0x2a')];}_0x565661['status'](_0x315d77)[_0xf027('0x2b')](_0x4fa95e);};}exports['index']=function(_0x1dc23e,_0x530bdc){var _0x2be563={},_0x1b700e={},_0x252bd0={'count':0x0,'rows':[]};var _0x487204=_[_0xf027('0x2c')](db['AnalyticFieldReport'][_0xf027('0x2d')],function(_0x4403eb){return{'name':_0x4403eb[_0xf027('0x2e')],'type':_0x4403eb[_0xf027('0x2f')][_0xf027('0x30')]};});_0x1b700e[_0xf027('0x31')]=_['map'](_0x487204,_0xf027('0x2a'));_0x1b700e['query']=_['keys'](_0x1dc23e['query']);_0x1b700e[_0xf027('0x32')]=_['intersection'](_0x1b700e[_0xf027('0x31')],_0x1b700e[_0xf027('0x33')]);_0x2be563[_0xf027('0x34')]=_['intersection'](_0x1b700e[_0xf027('0x31')],qs[_0xf027('0x35')](_0x1dc23e['query'][_0xf027('0x35')]));_0x2be563[_0xf027('0x34')]=_0x2be563[_0xf027('0x34')][_0xf027('0x36')]?_0x2be563[_0xf027('0x34')]:_0x1b700e['model'];if(!_0x1dc23e[_0xf027('0x33')]['hasOwnProperty'](_0xf027('0x37'))){_0x2be563[_0xf027('0x21')]=qs[_0xf027('0x21')](_0x1dc23e['query'][_0xf027('0x21')]);_0x2be563['offset']=qs[_0xf027('0x1e')](_0x1dc23e[_0xf027('0x33')][_0xf027('0x1e')]);}_0x2be563[_0xf027('0x38')]=qs[_0xf027('0x39')](_0x1dc23e['query'][_0xf027('0x39')]);_0x2be563[_0xf027('0x3a')]=qs[_0xf027('0x32')](_[_0xf027('0x3b')](_0x1dc23e[_0xf027('0x33')],_0x1b700e['filters']),_0x487204);if(_0x1dc23e[_0xf027('0x33')][_0xf027('0x3c')]){_0x2be563[_0xf027('0x3a')]=_[_0xf027('0x3d')](_0x2be563[_0xf027('0x3a')],{'$or':_[_0xf027('0x2c')](_0x487204,function(_0x48b8ff){if(_0x48b8ff[_0xf027('0x2f')]!=='VIRTUAL'){var _0x3ed2dc={};_0x3ed2dc[_0x48b8ff[_0xf027('0x2a')]]={'$like':'%'+_0x1dc23e['query']['filter']+'%'};return _0x3ed2dc;}})});}_0x2be563=_[_0xf027('0x3d')]({},_0x2be563,_0x1dc23e[_0xf027('0x3e')]);var _0xedff25={'where':_0x2be563[_0xf027('0x3a')]};return db[_0xf027('0x3f')]['count'](_0xedff25)[_0xf027('0x27')](function(_0x48691b){_0x252bd0[_0xf027('0x20')]=_0x48691b;if(_0x1dc23e[_0xf027('0x33')][_0xf027('0x40')]){_0x2be563[_0xf027('0x41')]=[{'all':!![]}];}return db[_0xf027('0x3f')]['findAll'](_0x2be563);})[_0xf027('0x27')](function(_0x216152){_0x252bd0['rows']=_0x216152;return _0x252bd0;})[_0xf027('0x27')](respondWithFilteredResult(_0x530bdc,_0x2be563))[_0xf027('0x42')](handleError(_0x530bdc,null));};exports[_0xf027('0x43')]=function(_0x29f816,_0x40c42e){var _0x1606ae={'raw':![],'where':{'id':_0x29f816[_0xf027('0x44')]['id']}},_0x575f2f={};_0x575f2f[_0xf027('0x31')]=_[_0xf027('0x45')](db[_0xf027('0x3f')][_0xf027('0x2d')]);_0x575f2f['query']=_['keys'](_0x29f816[_0xf027('0x33')]);_0x575f2f[_0xf027('0x32')]=_[_0xf027('0x46')](_0x575f2f[_0xf027('0x31')],_0x575f2f[_0xf027('0x33')]);_0x1606ae[_0xf027('0x34')]=_[_0xf027('0x46')](_0x575f2f[_0xf027('0x31')],qs[_0xf027('0x35')](_0x29f816[_0xf027('0x33')][_0xf027('0x35')]));_0x1606ae[_0xf027('0x34')]=_0x1606ae['attributes'][_0xf027('0x36')]?_0x1606ae['attributes']:_0x575f2f[_0xf027('0x31')];if(_0x29f816[_0xf027('0x33')][_0xf027('0x40')]){_0x1606ae['include']=[{'all':!![]}];}_0x1606ae=_[_0xf027('0x3d')]({},_0x1606ae,_0x29f816[_0xf027('0x3e')]);return db['AnalyticFieldReport'][_0xf027('0x47')](_0x1606ae)[_0xf027('0x27')](handleEntityNotFound(_0x40c42e,null))[_0xf027('0x27')](respondWithResult(_0x40c42e,null))['catch'](handleError(_0x40c42e,null));};exports[_0xf027('0x48')]=function(_0x1b56e4,_0x4100dc){return db[_0xf027('0x3f')][_0xf027('0x48')](_0x1b56e4['body'],{})['then'](respondWithResult(_0x4100dc,0xc9))['catch'](handleError(_0x4100dc,null));};exports[_0xf027('0x49')]=function(_0x306e9d,_0x133dcb){return db[_0xf027('0x3f')]['bulkCreate'](_0x306e9d[_0xf027('0x4a')],{'raw':![],'individualHooks':!![]})[_0xf027('0x27')](respondWithResult(_0x133dcb,0xc9))['catch'](handleError(_0x133dcb,null));};exports[_0xf027('0x26')]=function(_0x1d9496,_0x20f8bb){if(_0x1d9496['body']['id']){delete _0x1d9496['body']['id'];}return db[_0xf027('0x3f')]['find']({'where':{'id':_0x1d9496[_0xf027('0x44')]['id']}})[_0xf027('0x27')](handleEntityNotFound(_0x20f8bb,null))[_0xf027('0x27')](saveUpdates(_0x1d9496['body'],null))['then'](respondWithResult(_0x20f8bb,null))['catch'](handleError(_0x20f8bb,null));};exports[_0xf027('0x28')]=function(_0x476922,_0x42c623){return db['AnalyticFieldReport'][_0xf027('0x47')]({'where':{'id':_0x476922[_0xf027('0x44')]['id']}})[_0xf027('0x27')](handleEntityNotFound(_0x42c623,null))['then'](removeEntity(_0x42c623,null))['catch'](handleError(_0x42c623,null));};exports[_0xf027('0x4b')]=function(_0x39bc7f,_0x51d80d){return db[_0xf027('0x3f')][_0xf027('0x28')]({'where':{'id':_0x39bc7f[_0xf027('0x33')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xf027('0x27')](respondWithResult(_0x51d80d,0xcc))[_0xf027('0x42')](handleError(_0x51d80d,null));};exports[_0xf027('0x4c')]=function(_0x5c8299,_0x18b986,_0x25ba92){return db['AnalyticCustomReport'][_0xf027('0x4d')]({'where':{'id':_0x5c8299[_0xf027('0x44')]['id']}})[_0xf027('0x27')](handleEntityNotFound(_0x18b986,null))['then'](function(_0x5410c5){if(_0x5410c5){return db[_0xf027('0x4e')]['transaction'](function(_0x444012){return db[_0xf027('0x3f')][_0xf027('0x28')]({'where':{'CustomReportId':_0x5c8299[_0xf027('0x44')]['id']},'transaction':_0x444012})[_0xf027('0x27')](function(_0x185eaf){var _0x530e06=_[_0xf027('0x2c')](_0x5c8299['body'],function(_0x59b68d){delete _0x59b68d['id'];_0x59b68d[_0xf027('0x4f')]=_0x5c8299[_0xf027('0x44')]['id'];return _0x59b68d;});return db['AnalyticFieldReport'][_0xf027('0x49')](_0x530e06,{'transaction':_0x444012});});})['then'](function(){return db['AnalyticFieldReport'][_0xf027('0x50')]({'where':{'CustomReportId':_0x5c8299[_0xf027('0x44')]['id']}});});}})[_0xf027('0x27')](respondWithResult(_0x18b986,null))[_0xf027('0x42')](handleError(_0x18b986,null));}; \ No newline at end of file +var _0xc1dc=['../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','AnalyticFieldReport','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','where','findAll','catch','show','length','find','create','body','bulkCreate','params','bulkDestroy','ids','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x6c8df2,_0x44145c){var _0x49c98e=function(_0x333686){while(--_0x333686){_0x6c8df2['push'](_0x6c8df2['shift']());}};_0x49c98e(++_0x44145c);}(_0xc1dc,0x15e));var _0xcc1d=function(_0xb6777d,_0x3d0666){_0xb6777d=_0xb6777d-0x0;var _0x2fcd17=_0xc1dc[_0xb6777d];return _0x2fcd17;};'use strict';var emlformat=require(_0xcc1d('0x0'));var rimraf=require(_0xcc1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc1d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc1d('0x3'));var util=require('util');var path=require(_0xcc1d('0x4'));var sox=require(_0xcc1d('0x5'));var csv=require(_0xcc1d('0x6'));var ejs=require(_0xcc1d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc1d('0x8'));var squel=require(_0xcc1d('0x9'));var crypto=require(_0xcc1d('0xa'));var jsforce=require(_0xcc1d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcc1d('0x6'));var querystring=require('querystring');var Papa=require(_0xcc1d('0xc'));var Redis=require(_0xcc1d('0xd'));var authService=require(_0xcc1d('0xe'));var qs=require(_0xcc1d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xcc1d('0x10'));var config=require(_0xcc1d('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc1d('0x12'))['db'];function respondWithStatusCode(_0x4aba6f,_0x3ebdfb){_0x3ebdfb=_0x3ebdfb||0xcc;return function(_0x12a1c6){if(_0x12a1c6){return _0x4aba6f[_0xcc1d('0x13')](_0x3ebdfb);}return _0x4aba6f[_0xcc1d('0x14')](_0x3ebdfb)[_0xcc1d('0x15')]();};}function respondWithResult(_0x45e384,_0x467002){_0x467002=_0x467002||0xc8;return function(_0x34a1b5){if(_0x34a1b5){return _0x45e384[_0xcc1d('0x14')](_0x467002)[_0xcc1d('0x16')](_0x34a1b5);}};}function respondWithFilteredResult(_0x2cf49a,_0x512e16){return function(_0x5cb618){if(_0x5cb618){var _0x2b8330=typeof _0x512e16[_0xcc1d('0x17')]===_0xcc1d('0x18')&&typeof _0x512e16[_0xcc1d('0x19')]==='undefined';var _0x1eab16=_0x5cb618['count'];var _0x432458=_0x2b8330?0x0:_0x512e16['offset'];var _0x245181=_0x2b8330?_0x5cb618[_0xcc1d('0x1a')]:_0x512e16[_0xcc1d('0x17')]+_0x512e16[_0xcc1d('0x19')];var _0x4ec71f;if(_0x245181>=_0x1eab16){_0x245181=_0x1eab16;_0x4ec71f=0xc8;}else{_0x4ec71f=0xce;}_0x2cf49a[_0xcc1d('0x14')](_0x4ec71f);return _0x2cf49a['set'](_0xcc1d('0x1b'),_0x432458+'-'+_0x245181+'/'+_0x1eab16)['json'](_0x5cb618);}return null;};}function patchUpdates(_0x16931d){return function(_0xa669e9){try{jsonpatch[_0xcc1d('0x1c')](_0xa669e9,_0x16931d,!![]);}catch(_0x29c96b){return BPromise[_0xcc1d('0x1d')](_0x29c96b);}return _0xa669e9[_0xcc1d('0x1e')]();};}function saveUpdates(_0x334032,_0x11b6cd){return function(_0x424255){if(_0x424255){return _0x424255[_0xcc1d('0x1f')](_0x334032)['then'](function(_0x427bd7){return _0x427bd7;});}return null;};}function removeEntity(_0x54503a,_0x32cf01){return function(_0x4c7b41){if(_0x4c7b41){return _0x4c7b41[_0xcc1d('0x20')]()[_0xcc1d('0x21')](function(){_0x54503a['status'](0xcc)[_0xcc1d('0x15')]();});}};}function handleEntityNotFound(_0x4f7ab6,_0x1dac30){return function(_0x30d540){if(!_0x30d540){_0x4f7ab6[_0xcc1d('0x13')](0x194);}return _0x30d540;};}function handleError(_0x21e3f2,_0x49d1fc){_0x49d1fc=_0x49d1fc||0x1f4;return function(_0xce609b){logger[_0xcc1d('0x22')](_0xce609b[_0xcc1d('0x23')]);if(_0xce609b[_0xcc1d('0x24')]){delete _0xce609b['name'];}_0x21e3f2[_0xcc1d('0x14')](_0x49d1fc)['send'](_0xce609b);};}exports['index']=function(_0x447bb4,_0x54a379){var _0x4864f5={},_0x54a1d0={},_0x31bbf7={'count':0x0,'rows':[]};var _0x5954d1=_['map'](db[_0xcc1d('0x25')][_0xcc1d('0x26')],function(_0x56d7bc){return{'name':_0x56d7bc[_0xcc1d('0x27')],'type':_0x56d7bc[_0xcc1d('0x28')]['key']};});_0x54a1d0[_0xcc1d('0x29')]=_[_0xcc1d('0x2a')](_0x5954d1,_0xcc1d('0x24'));_0x54a1d0['query']=_[_0xcc1d('0x2b')](_0x447bb4['query']);_0x54a1d0[_0xcc1d('0x2c')]=_[_0xcc1d('0x2d')](_0x54a1d0[_0xcc1d('0x29')],_0x54a1d0[_0xcc1d('0x2e')]);_0x4864f5[_0xcc1d('0x2f')]=_['intersection'](_0x54a1d0['model'],qs[_0xcc1d('0x30')](_0x447bb4['query']['fields']));_0x4864f5[_0xcc1d('0x2f')]=_0x4864f5[_0xcc1d('0x2f')]['length']?_0x4864f5[_0xcc1d('0x2f')]:_0x54a1d0[_0xcc1d('0x29')];if(!_0x447bb4['query'][_0xcc1d('0x31')](_0xcc1d('0x32'))){_0x4864f5[_0xcc1d('0x19')]=qs[_0xcc1d('0x19')](_0x447bb4[_0xcc1d('0x2e')][_0xcc1d('0x19')]);_0x4864f5['offset']=qs[_0xcc1d('0x17')](_0x447bb4[_0xcc1d('0x2e')]['offset']);}_0x4864f5[_0xcc1d('0x33')]=qs['sort'](_0x447bb4[_0xcc1d('0x2e')][_0xcc1d('0x34')]);_0x4864f5['where']=qs['filters'](_[_0xcc1d('0x35')](_0x447bb4[_0xcc1d('0x2e')],_0x54a1d0[_0xcc1d('0x2c')]),_0x5954d1);if(_0x447bb4[_0xcc1d('0x2e')][_0xcc1d('0x36')]){_0x4864f5['where']=_['merge'](_0x4864f5['where'],{'$or':_[_0xcc1d('0x2a')](_0x5954d1,function(_0x55ffcf){if(_0x55ffcf[_0xcc1d('0x28')]!=='VIRTUAL'){var _0xa96342={};_0xa96342[_0x55ffcf[_0xcc1d('0x24')]]={'$like':'%'+_0x447bb4[_0xcc1d('0x2e')]['filter']+'%'};return _0xa96342;}})});}_0x4864f5=_[_0xcc1d('0x37')]({},_0x4864f5,_0x447bb4[_0xcc1d('0x38')]);var _0x1545c3={'where':_0x4864f5[_0xcc1d('0x39')]};return db[_0xcc1d('0x25')]['count'](_0x1545c3)[_0xcc1d('0x21')](function(_0x4fa34f){_0x31bbf7[_0xcc1d('0x1a')]=_0x4fa34f;if(_0x447bb4[_0xcc1d('0x2e')]['includeAll']){_0x4864f5['include']=[{'all':!![]}];}return db[_0xcc1d('0x25')][_0xcc1d('0x3a')](_0x4864f5);})[_0xcc1d('0x21')](function(_0x37c336){_0x31bbf7['rows']=_0x37c336;return _0x31bbf7;})[_0xcc1d('0x21')](respondWithFilteredResult(_0x54a379,_0x4864f5))[_0xcc1d('0x3b')](handleError(_0x54a379,null));};exports[_0xcc1d('0x3c')]=function(_0x2f9090,_0x467b78){var _0x40116f={'raw':![],'where':{'id':_0x2f9090['params']['id']}},_0x2705be={};_0x2705be[_0xcc1d('0x29')]=_[_0xcc1d('0x2b')](db[_0xcc1d('0x25')]['rawAttributes']);_0x2705be[_0xcc1d('0x2e')]=_[_0xcc1d('0x2b')](_0x2f9090[_0xcc1d('0x2e')]);_0x2705be[_0xcc1d('0x2c')]=_[_0xcc1d('0x2d')](_0x2705be[_0xcc1d('0x29')],_0x2705be[_0xcc1d('0x2e')]);_0x40116f[_0xcc1d('0x2f')]=_['intersection'](_0x2705be[_0xcc1d('0x29')],qs[_0xcc1d('0x30')](_0x2f9090[_0xcc1d('0x2e')][_0xcc1d('0x30')]));_0x40116f[_0xcc1d('0x2f')]=_0x40116f[_0xcc1d('0x2f')][_0xcc1d('0x3d')]?_0x40116f[_0xcc1d('0x2f')]:_0x2705be[_0xcc1d('0x29')];if(_0x2f9090['query']['includeAll']){_0x40116f['include']=[{'all':!![]}];}_0x40116f=_['merge']({},_0x40116f,_0x2f9090[_0xcc1d('0x38')]);return db[_0xcc1d('0x25')][_0xcc1d('0x3e')](_0x40116f)[_0xcc1d('0x21')](handleEntityNotFound(_0x467b78,null))[_0xcc1d('0x21')](respondWithResult(_0x467b78,null))[_0xcc1d('0x3b')](handleError(_0x467b78,null));};exports[_0xcc1d('0x3f')]=function(_0x4be22d,_0x295d98){return db[_0xcc1d('0x25')][_0xcc1d('0x3f')](_0x4be22d[_0xcc1d('0x40')],{})['then'](respondWithResult(_0x295d98,0xc9))[_0xcc1d('0x3b')](handleError(_0x295d98,null));};exports[_0xcc1d('0x41')]=function(_0x20be70,_0x3a559e){return db['AnalyticFieldReport'][_0xcc1d('0x41')](_0x20be70[_0xcc1d('0x40')],{'raw':![],'individualHooks':!![]})[_0xcc1d('0x21')](respondWithResult(_0x3a559e,0xc9))[_0xcc1d('0x3b')](handleError(_0x3a559e,null));};exports['update']=function(_0x148aac,_0x2020e8){if(_0x148aac[_0xcc1d('0x40')]['id']){delete _0x148aac[_0xcc1d('0x40')]['id'];}return db['AnalyticFieldReport'][_0xcc1d('0x3e')]({'where':{'id':_0x148aac[_0xcc1d('0x42')]['id']}})[_0xcc1d('0x21')](handleEntityNotFound(_0x2020e8,null))[_0xcc1d('0x21')](saveUpdates(_0x148aac[_0xcc1d('0x40')],null))[_0xcc1d('0x21')](respondWithResult(_0x2020e8,null))['catch'](handleError(_0x2020e8,null));};exports['destroy']=function(_0x308de0,_0x346ece){return db[_0xcc1d('0x25')]['find']({'where':{'id':_0x308de0[_0xcc1d('0x42')]['id']}})[_0xcc1d('0x21')](handleEntityNotFound(_0x346ece,null))[_0xcc1d('0x21')](removeEntity(_0x346ece,null))['catch'](handleError(_0x346ece,null));};exports[_0xcc1d('0x43')]=function(_0x1f8e7e,_0x5bafc6){return db['AnalyticFieldReport'][_0xcc1d('0x20')]({'where':{'id':_0x1f8e7e[_0xcc1d('0x2e')][_0xcc1d('0x44')]||[]},'raw':![],'individualHooks':!![]})[_0xcc1d('0x21')](respondWithResult(_0x5bafc6,0xcc))[_0xcc1d('0x3b')](handleError(_0x5bafc6,null));};exports['addFields']=function(_0x25c455,_0x216b01,_0x5ec5dd){return db['AnalyticCustomReport'][_0xcc1d('0x45')]({'where':{'id':_0x25c455[_0xcc1d('0x42')]['id']}})['then'](handleEntityNotFound(_0x216b01,null))[_0xcc1d('0x21')](function(_0xa44b08){if(_0xa44b08){return db[_0xcc1d('0x46')][_0xcc1d('0x47')](function(_0x12102b){return db['AnalyticFieldReport'][_0xcc1d('0x20')]({'where':{'CustomReportId':_0x25c455[_0xcc1d('0x42')]['id']},'transaction':_0x12102b})[_0xcc1d('0x21')](function(_0x15cde1){var _0x374d21=_[_0xcc1d('0x2a')](_0x25c455[_0xcc1d('0x40')],function(_0x417ff9){delete _0x417ff9['id'];_0x417ff9[_0xcc1d('0x48')]=_0x25c455[_0xcc1d('0x42')]['id'];return _0x417ff9;});return db[_0xcc1d('0x25')]['bulkCreate'](_0x374d21,{'transaction':_0x12102b});});})['then'](function(){return db[_0xcc1d('0x25')]['findAll']({'where':{'CustomReportId':_0x25c455[_0xcc1d('0x42')]['id']}});});}})['then'](respondWithResult(_0x216b01,null))['catch'](handleError(_0x216b01,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 83058dc..b1dca8e 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.model.js +++ b/server/api/analyticFieldReport/analyticFieldReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d14=['path','rimraf','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','api','bluebird','request-promise'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x5d14,0x189));var _0x45d1=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x5d14[_0x5c5c52];return _0x4229ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x45d1('0x0'));var moment=require('moment');var BPromise=require(_0x45d1('0x1'));var rp=require(_0x45d1('0x2'));var fs=require('fs');var path=require(_0x45d1('0x3'));var rimraf=require(_0x45d1('0x4'));var config=require('../../config/environment');var attributes=require(_0x45d1('0x5'));module['exports']=function(_0xf8dc0,_0x1b2c1b){return _0xf8dc0[_0x45d1('0x6')](_0x45d1('0x7'),attributes,{'tableName':_0x45d1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['./analyticFieldReport.attributes','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x342072,_0x50bf45){var _0x530822=function(_0x112a66){while(--_0x112a66){_0x342072['push'](_0x342072['shift']());}};_0x530822(++_0x50bf45);}(_0x0295,0xc9));var _0x5029=function(_0x33990e,_0x27b1f4){_0x33990e=_0x33990e-0x0;var _0x366423=_0x0295[_0x33990e];return _0x366423;};'use strict';var _=require(_0x5029('0x0'));var util=require(_0x5029('0x1'));var logger=require(_0x5029('0x2'))('api');var moment=require(_0x5029('0x3'));var BPromise=require(_0x5029('0x4'));var rp=require(_0x5029('0x5'));var fs=require('fs');var path=require(_0x5029('0x6'));var rimraf=require(_0x5029('0x7'));var config=require('../../config/environment');var attributes=require(_0x5029('0x8'));module['exports']=function(_0x56995c,_0x439891){return _0x56995c['define'](_0x5029('0x9'),attributes,{'tableName':_0x5029('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 7ab3ba4..d559692 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.rpc.js +++ b/server/api/analyticFieldReport/analyticFieldReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb518=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment'];(function(_0x1d2b55,_0x1cfca9){var _0x160bc6=function(_0x1c72bb){while(--_0x1c72bb){_0x1d2b55['push'](_0x1d2b55['shift']());}};_0x160bc6(++_0x1cfca9);}(_0xb518,0x1b8));var _0x8b51=function(_0x491eed,_0x15d6e2){_0x491eed=_0x491eed-0x0;var _0x13652f=_0xb518[_0x491eed];return _0x13652f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8b51('0x0'));var BPromise=require(_0x8b51('0x1'));var rs=require(_0x8b51('0x2'));var fs=require('fs');var Redis=require(_0x8b51('0x3'));var db=require(_0x8b51('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8b51('0x5'));var config=require(_0x8b51('0x6'));var jayson=require(_0x8b51('0x7'));var client=jayson[_0x8b51('0x8')][_0x8b51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d8e9c,_0x125fd2,_0x558e5b){return new BPromise(function(_0x1cc8b2,_0x201488){return client['request'](_0x4d8e9c,_0x558e5b)[_0x8b51('0xa')](function(_0x4d5e63){logger[_0x8b51('0xb')](_0x8b51('0xc'),_0x125fd2,_0x8b51('0xd'));logger[_0x8b51('0xe')](_0x8b51('0xf'),_0x125fd2,_0x8b51('0xd'),JSON[_0x8b51('0x10')](_0x4d5e63));if(_0x4d5e63[_0x8b51('0x11')]){if(_0x4d5e63[_0x8b51('0x11')]['code']===0x1f4){logger[_0x8b51('0x11')](_0x8b51('0xc'),_0x125fd2,_0x4d5e63[_0x8b51('0x11')][_0x8b51('0x12')]);return _0x201488(_0x4d5e63[_0x8b51('0x11')][_0x8b51('0x12')]);}logger[_0x8b51('0x11')](_0x8b51('0xc'),_0x125fd2,_0x4d5e63[_0x8b51('0x11')][_0x8b51('0x12')]);return _0x1cc8b2(_0x4d5e63['error']['message']);}else{logger[_0x8b51('0xb')](_0x8b51('0xc'),_0x125fd2,'request\x20sent');_0x1cc8b2(_0x4d5e63[_0x8b51('0x13')][_0x8b51('0x12')]);}})[_0x8b51('0x14')](function(_0x2c291d){logger[_0x8b51('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x125fd2,_0x2c291d);_0x201488(_0x2c291d);});});} \ No newline at end of file +var _0x3903=['request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0xf32485,_0x3f03e1){var _0x25af45=function(_0x18fac4){while(--_0x18fac4){_0xf32485['push'](_0xf32485['shift']());}};_0x25af45(++_0x3f03e1);}(_0x3903,0x181));var _0x3390=function(_0x14c180,_0x106d82){_0x14c180=_0x14c180-0x0;var _0x5aaf60=_0x3903[_0x14c180];return _0x5aaf60;};'use strict';var _=require(_0x3390('0x0'));var util=require(_0x3390('0x1'));var moment=require(_0x3390('0x2'));var BPromise=require(_0x3390('0x3'));var rs=require(_0x3390('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3390('0x5'))['db'];var utils=require(_0x3390('0x6'));var logger=require('../../config/logger')(_0x3390('0x7'));var config=require(_0x3390('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3390('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x332352,_0x2d4167,_0x5e37df){return new BPromise(function(_0x1ab8c8,_0x5205e8){return client[_0x3390('0xa')](_0x332352,_0x5e37df)[_0x3390('0xb')](function(_0x18d12e){logger[_0x3390('0xc')](_0x3390('0xd'),_0x2d4167,_0x3390('0xe'));logger['debug'](_0x3390('0xf'),_0x2d4167,_0x3390('0xe'),JSON[_0x3390('0x10')](_0x18d12e));if(_0x18d12e[_0x3390('0x11')]){if(_0x18d12e[_0x3390('0x11')]['code']===0x1f4){logger['error'](_0x3390('0xd'),_0x2d4167,_0x18d12e[_0x3390('0x11')][_0x3390('0x12')]);return _0x5205e8(_0x18d12e[_0x3390('0x11')][_0x3390('0x12')]);}logger['error'](_0x3390('0xd'),_0x2d4167,_0x18d12e[_0x3390('0x11')][_0x3390('0x12')]);return _0x1ab8c8(_0x18d12e['error'][_0x3390('0x12')]);}else{logger[_0x3390('0xc')](_0x3390('0xd'),_0x2d4167,'request\x20sent');_0x1ab8c8(_0x18d12e[_0x3390('0x13')][_0x3390('0x12')]);}})[_0x3390('0x14')](function(_0x37174c){logger[_0x3390('0x11')](_0x3390('0xd'),_0x2d4167,_0x37174c);_0x5205e8(_0x37174c);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 07f9932..e21645d 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x37d5cf,_0x2fef1a){var _0x283e2e=function(_0x1284a2){while(--_0x1284a2){_0x37d5cf['push'](_0x37d5cf['shift']());}};_0x283e2e(++_0x2fef1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x4b2ea3,_0x1c48a1){var _0x22cc58=function(_0x3afca6){while(--_0x3afca6){_0x4b2ea3['push'](_0x4b2ea3['shift']());}};_0x22cc58(++_0x1c48a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 3d5c74e..f4d77d2 100644 --- a/server/api/analyticMetric/analyticMetric.attributes.js +++ b/server/api/analyticMetric/analyticMetric.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc16f=['sequelize','exports','name','STRING','TEXT'];(function(_0x3cee5f,_0x7a30db){var _0x4cc372=function(_0x5d6bb6){while(--_0x5d6bb6){_0x3cee5f['push'](_0x3cee5f['shift']());}};_0x4cc372(++_0x7a30db);}(_0xc16f,0xe6));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfc16('0x0'));module[_0xfc16('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfc16('0x2')},'table':{'type':Sequelize[_0xfc16('0x3')]},'metric':{'type':Sequelize[_0xfc16('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa900=['name','TEXT','sequelize','exports','STRING'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0xa900,0x101));var _0x0a90=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0xa900[_0xd13a88];return _0x1c993c;};'use strict';var Sequelize=require(_0x0a90('0x0'));module[_0x0a90('0x1')]={'name':{'type':Sequelize[_0x0a90('0x2')],'allowNull':![],'unique':_0x0a90('0x3')},'table':{'type':Sequelize[_0x0a90('0x2')]},'metric':{'type':Sequelize[_0x0a90('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 9bedd8a..bb60081 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x2a9197,_0x5225eb){var _0x588c8a=function(_0x4698ee){while(--_0x4698ee){_0x2a9197['push'](_0x2a9197['shift']());}};_0x588c8a(++_0x5225eb);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3003c3,_0x4db38c){_0x3003c3=_0x3003c3-0x0;var _0x53ca3c=_0x9c5a[_0x3003c3];return _0x53ca3c;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file +var _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x35ded9,_0x415e45){var _0x626dbf=function(_0xa3c2c8){while(--_0xa3c2c8){_0x35ded9['push'](_0x35ded9['shift']());}};_0x626dbf(++_0x415e45);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2c095f,_0x2cf962){_0x2c095f=_0x2c095f-0x0;var _0x397c9e=_0xdc97[_0x2c095f];return _0x397c9e;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 8dd68d1..19c61af 100644 --- a/server/api/analyticMetric/analyticMetric.model.js +++ b/server/api/analyticMetric/analyticMetric.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9e7=['../../config/environment','./analyticMetric.attributes','define','analytics_metrics','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x46a559,_0x5c9d36){var _0xa934e1=function(_0x1dfed0){while(--_0x1dfed0){_0x46a559['push'](_0x46a559['shift']());}};_0xa934e1(++_0x5c9d36);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x76fef,_0xa2de18){_0x76fef=_0x76fef-0x0;var _0x353380=_0xe9e7[_0x76fef];return _0x353380;};'use strict';var _=require(_0x7e9e('0x0'));var util=require(_0x7e9e('0x1'));var logger=require(_0x7e9e('0x2'))('api');var moment=require(_0x7e9e('0x3'));var BPromise=require(_0x7e9e('0x4'));var rp=require(_0x7e9e('0x5'));var fs=require('fs');var path=require(_0x7e9e('0x6'));var rimraf=require(_0x7e9e('0x7'));var config=require(_0x7e9e('0x8'));var attributes=require(_0x7e9e('0x9'));module['exports']=function(_0x319f70,_0x134fac){return _0x319f70[_0x7e9e('0xa')]('AnalyticMetric',attributes,{'tableName':_0x7e9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1aa=['exports','define','AnalyticMetric','analytics_metrics','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes'];(function(_0xede398,_0x552aff){var _0x5dd527=function(_0x59e8f0){while(--_0x59e8f0){_0xede398['push'](_0xede398['shift']());}};_0x5dd527(++_0x552aff);}(_0xa1aa,0x88));var _0xaa1a=function(_0x1deace,_0x161a28){_0x1deace=_0x1deace-0x0;var _0x10f183=_0xa1aa[_0x1deace];return _0x10f183;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaa1a('0x0'))(_0xaa1a('0x1'));var moment=require(_0xaa1a('0x2'));var BPromise=require(_0xaa1a('0x3'));var rp=require(_0xaa1a('0x4'));var fs=require('fs');var path=require(_0xaa1a('0x5'));var rimraf=require(_0xaa1a('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa1a('0x7'));module[_0xaa1a('0x8')]=function(_0x4934e6,_0x3500c9){return _0x4934e6[_0xaa1a('0x9')](_0xaa1a('0xa'),attributes,{'tableName':_0xaa1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index b968d52..9a066f5 100644 --- a/server/api/analyticMetric/analyticMetric.rpc.js +++ b/server/api/analyticMetric/analyticMetric.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bc0=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util'];(function(_0x4b9424,_0x54b047){var _0x1be525=function(_0x467520){while(--_0x467520){_0x4b9424['push'](_0x4b9424['shift']());}};_0x1be525(++_0x54b047);}(_0x1bc0,0xd6));var _0x01bc=function(_0x1d1f1b,_0x1ce683){_0x1d1f1b=_0x1d1f1b-0x0;var _0x50e5c3=_0x1bc0[_0x1d1f1b];return _0x50e5c3;};'use strict';var _=require(_0x01bc('0x0'));var util=require(_0x01bc('0x1'));var moment=require(_0x01bc('0x2'));var BPromise=require(_0x01bc('0x3'));var rs=require(_0x01bc('0x4'));var fs=require('fs');var Redis=require(_0x01bc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x01bc('0x6'));var logger=require(_0x01bc('0x7'))(_0x01bc('0x8'));var config=require(_0x01bc('0x9'));var jayson=require(_0x01bc('0xa'));var client=jayson[_0x01bc('0xb')][_0x01bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fbb97,_0x4f00c2,_0x127a25){return new BPromise(function(_0x49c8db,_0x577da5){return client[_0x01bc('0xd')](_0x4fbb97,_0x127a25)[_0x01bc('0xe')](function(_0x431efd){logger[_0x01bc('0xf')](_0x01bc('0x10'),_0x4f00c2,_0x01bc('0x11'));logger[_0x01bc('0x12')](_0x01bc('0x13'),_0x4f00c2,'request\x20sent',JSON['stringify'](_0x431efd));if(_0x431efd[_0x01bc('0x14')]){if(_0x431efd['error'][_0x01bc('0x15')]===0x1f4){logger[_0x01bc('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x4f00c2,_0x431efd[_0x01bc('0x14')][_0x01bc('0x16')]);return _0x577da5(_0x431efd[_0x01bc('0x14')][_0x01bc('0x16')]);}logger[_0x01bc('0x14')](_0x01bc('0x10'),_0x4f00c2,_0x431efd[_0x01bc('0x14')][_0x01bc('0x16')]);return _0x49c8db(_0x431efd[_0x01bc('0x14')]['message']);}else{logger[_0x01bc('0xf')](_0x01bc('0x10'),_0x4f00c2,'request\x20sent');_0x49c8db(_0x431efd[_0x01bc('0x17')]['message']);}})['catch'](function(_0x3e898e){logger[_0x01bc('0x14')](_0x01bc('0x10'),_0x4f00c2,_0x3e898e);_0x577da5(_0x3e898e);});});} \ No newline at end of file +var _0x0660=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0xa4963e,_0x2ff8f1){var _0x309ee3=function(_0x460f97){while(--_0x460f97){_0xa4963e['push'](_0xa4963e['shift']());}};_0x309ee3(++_0x2ff8f1);}(_0x0660,0x17c));var _0x0066=function(_0x55c8de,_0xf1c57b){_0x55c8de=_0x55c8de-0x0;var _0x5dcd72=_0x0660[_0x55c8de];return _0x5dcd72;};'use strict';var _=require(_0x0066('0x0'));var util=require(_0x0066('0x1'));var moment=require(_0x0066('0x2'));var BPromise=require(_0x0066('0x3'));var rs=require(_0x0066('0x4'));var fs=require('fs');var Redis=require(_0x0066('0x5'));var db=require(_0x0066('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0066('0x7'))(_0x0066('0x8'));var config=require(_0x0066('0x9'));var jayson=require(_0x0066('0xa'));var client=jayson[_0x0066('0xb')][_0x0066('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc57993,_0xae18f0,_0x2333c9){return new BPromise(function(_0x1aba4f,_0x3c55cb){return client[_0x0066('0xd')](_0xc57993,_0x2333c9)[_0x0066('0xe')](function(_0x1bcc21){logger[_0x0066('0xf')](_0x0066('0x10'),_0xae18f0,'request\x20sent');logger[_0x0066('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0xae18f0,_0x0066('0x12'),JSON[_0x0066('0x13')](_0x1bcc21));if(_0x1bcc21['error']){if(_0x1bcc21[_0x0066('0x14')][_0x0066('0x15')]===0x1f4){logger[_0x0066('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0xae18f0,_0x1bcc21[_0x0066('0x14')]['message']);return _0x3c55cb(_0x1bcc21[_0x0066('0x14')][_0x0066('0x16')]);}logger[_0x0066('0x14')](_0x0066('0x10'),_0xae18f0,_0x1bcc21[_0x0066('0x14')][_0x0066('0x16')]);return _0x1aba4f(_0x1bcc21[_0x0066('0x14')][_0x0066('0x16')]);}else{logger[_0x0066('0xf')](_0x0066('0x10'),_0xae18f0,_0x0066('0x12'));_0x1aba4f(_0x1bcc21[_0x0066('0x17')][_0x0066('0x16')]);}})[_0x0066('0x18')](function(_0x1d3ec2){logger[_0x0066('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0xae18f0,_0x1d3ec2);_0x3c55cb(_0x1d3ec2);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 4bc7606..88bd2de 100644 --- a/server/api/analyticMetric/index.js +++ b/server/api/analyticMetric/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd7b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0xef6939,_0x2a01a3){var _0x4aa8f1=function(_0x42eeb5){while(--_0x42eeb5){_0xef6939['push'](_0xef6939['shift']());}};_0x4aa8f1(++_0x2a01a3);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0xfd7b[_0x3df223];return _0x562d11;};'use strict';var multer=require('multer');var util=require(_0xbfd7('0x0'));var path=require(_0xbfd7('0x1'));var timeout=require(_0xbfd7('0x2'));var express=require(_0xbfd7('0x3'));var router=express[_0xbfd7('0x4')]();var fs_extra=require(_0xbfd7('0x5'));var auth=require(_0xbfd7('0x6'));var interaction=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var controller=require(_0xbfd7('0x9'));router[_0xbfd7('0xa')]('/',auth[_0xbfd7('0xb')](),controller[_0xbfd7('0xc')]);router['get'](_0xbfd7('0xd'),auth['isAuthenticated'](),controller[_0xbfd7('0xe')]);router['post']('/',auth[_0xbfd7('0xb')](),controller[_0xbfd7('0xf')]);router[_0xbfd7('0x10')](_0xbfd7('0xd'),auth['isAuthenticated'](),controller[_0xbfd7('0x11')]);router[_0xbfd7('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbfd7('0x13')]);module[_0xbfd7('0x14')]=router; \ No newline at end of file +var _0x6363=['./analyticMetric.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf0dbff,_0x288c63){var _0x3ba7a0=function(_0x3932ca){while(--_0x3932ca){_0xf0dbff['push'](_0xf0dbff['shift']());}};_0x3ba7a0(++_0x288c63);}(_0x6363,0x13a));var _0x3636=function(_0x427ecc,_0x1f05a0){_0x427ecc=_0x427ecc-0x0;var _0x83789e=_0x6363[_0x427ecc];return _0x83789e;};'use strict';var multer=require(_0x3636('0x0'));var util=require('util');var path=require(_0x3636('0x1'));var timeout=require(_0x3636('0x2'));var express=require(_0x3636('0x3'));var router=express[_0x3636('0x4')]();var fs_extra=require(_0x3636('0x5'));var auth=require(_0x3636('0x6'));var interaction=require(_0x3636('0x7'));var config=require(_0x3636('0x8'));var controller=require(_0x3636('0x9'));router[_0x3636('0xa')]('/',auth[_0x3636('0xb')](),controller[_0x3636('0xc')]);router[_0x3636('0xa')](_0x3636('0xd'),auth['isAuthenticated'](),controller[_0x3636('0xe')]);router['post']('/',auth[_0x3636('0xb')](),controller[_0x3636('0xf')]);router[_0x3636('0x10')](_0x3636('0xd'),auth[_0x3636('0xb')](),controller[_0x3636('0x11')]);router[_0x3636('0x12')](_0x3636('0xd'),auth[_0x3636('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 541a8b0..322cd69 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js +++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ea1=['sequelize','exports'];(function(_0xeccfa1,_0x59fd9b){var _0x586d99=function(_0x27173a){while(--_0x27173a){_0xeccfa1['push'](_0xeccfa1['shift']());}};_0x586d99(++_0x59fd9b);}(_0x1ea1,0xce));var _0x11ea=function(_0x2b9b50,_0x5d9548){_0x2b9b50=_0x2b9b50-0x0;var _0x158ae5=_0x1ea1[_0x2b9b50];return _0x158ae5;};'use strict';var Sequelize=require(_0x11ea('0x0'));module[_0x11ea('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x689b=['sequelize','exports','TEXT'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x689b,0x1d4));var _0xb689=function(_0x429dfd,_0x52b01d){_0x429dfd=_0x429dfd-0x0;var _0x5f520f=_0x689b[_0x429dfd];return _0x5f520f;};'use strict';var Sequelize=require(_0xb689('0x0'));module[_0xb689('0x1')]={'tree':{'type':Sequelize[_0xb689('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 23b3ce2..2d9c968 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.controller.js +++ b/server/api/analyticTreeReport/analyticTreeReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e48=['util','path','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','then','end','name','AnalyticTreeReport','fieldName','type','key','map','keys','filters','model','query','fields','attributes','hasOwnProperty','nolimit','order','pick','filter','where','merge','includeAll','include','rows','catch','show','params','rawAttributes','intersection','length','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x74507e,_0x5701a0){var _0x3bd955=function(_0x2dad7f){while(--_0x2dad7f){_0x74507e['push'](_0x74507e['shift']());}};_0x3bd955(++_0x5701a0);}(_0x0e48,0x1ce));var _0x80e4=function(_0x2743c9,_0x3e3336){_0x2743c9=_0x2743c9-0x0;var _0x727730=_0x0e48[_0x2743c9];return _0x727730;};'use strict';var emlformat=require(_0x80e4('0x0'));var rimraf=require(_0x80e4('0x1'));var zipdir=require(_0x80e4('0x2'));var jsonpatch=require(_0x80e4('0x3'));var rp=require(_0x80e4('0x4'));var moment=require(_0x80e4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x80e4('0x6'));var util=require(_0x80e4('0x7'));var path=require(_0x80e4('0x8'));var sox=require('sox');var csv=require(_0x80e4('0x9'));var ejs=require(_0x80e4('0xa'));var fs=require('fs');var fs_extra=require(_0x80e4('0xb'));var _=require(_0x80e4('0xc'));var squel=require('squel');var crypto=require(_0x80e4('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x80e4('0x9'));var querystring=require('querystring');var Papa=require(_0x80e4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x80e4('0xf'));var as=require(_0x80e4('0x10'));var hardwareService=require(_0x80e4('0x11'));var logger=require(_0x80e4('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x80e4('0x13'));var licenseUtil=require(_0x80e4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d838e,_0x200ef3){_0x200ef3=_0x200ef3||0xcc;return function(_0x4b2531){if(_0x4b2531){return _0x3d838e[_0x80e4('0x15')](_0x200ef3);}return _0x3d838e['status'](_0x200ef3)['end']();};}function respondWithResult(_0x4b26c3,_0x2fd6f1){_0x2fd6f1=_0x2fd6f1||0xc8;return function(_0x2b286f){if(_0x2b286f){return _0x4b26c3[_0x80e4('0x16')](_0x2fd6f1)[_0x80e4('0x17')](_0x2b286f);}};}function respondWithFilteredResult(_0x19305c,_0x1863a8){return function(_0x1e7a51){if(_0x1e7a51){var _0x58cebd=typeof _0x1863a8[_0x80e4('0x18')]==='undefined'&&typeof _0x1863a8[_0x80e4('0x19')]===_0x80e4('0x1a');var _0x482628=_0x1e7a51[_0x80e4('0x1b')];var _0x41c8b1=_0x58cebd?0x0:_0x1863a8[_0x80e4('0x18')];var _0x451ecb=_0x58cebd?_0x1e7a51[_0x80e4('0x1b')]:_0x1863a8[_0x80e4('0x18')]+_0x1863a8[_0x80e4('0x19')];var _0x14d35b;if(_0x451ecb>=_0x482628){_0x451ecb=_0x482628;_0x14d35b=0xc8;}else{_0x14d35b=0xce;}_0x19305c[_0x80e4('0x16')](_0x14d35b);return _0x19305c[_0x80e4('0x1c')](_0x80e4('0x1d'),_0x41c8b1+'-'+_0x451ecb+'/'+_0x482628)[_0x80e4('0x17')](_0x1e7a51);}return null;};}function patchUpdates(_0x283e72){return function(_0x3aa08f){try{jsonpatch[_0x80e4('0x1e')](_0x3aa08f,_0x283e72,!![]);}catch(_0x212db0){return BPromise['reject'](_0x212db0);}return _0x3aa08f['save']();};}function saveUpdates(_0xed7fdf,_0x5d5fd7){return function(_0x3a3a6d){if(_0x3a3a6d){return _0x3a3a6d[_0x80e4('0x1f')](_0xed7fdf)['then'](function(_0x59c171){return _0x59c171;});}return null;};}function removeEntity(_0x353d63,_0x8c3df2){return function(_0x3a654a){if(_0x3a654a){return _0x3a654a[_0x80e4('0x20')]()[_0x80e4('0x21')](function(){_0x353d63['status'](0xcc)[_0x80e4('0x22')]();});}};}function handleEntityNotFound(_0x710b75,_0x3db809){return function(_0x1a00cf){if(!_0x1a00cf){_0x710b75[_0x80e4('0x15')](0x194);}return _0x1a00cf;};}function handleError(_0x4c536f,_0x499245){_0x499245=_0x499245||0x1f4;return function(_0x361719){logger['error'](_0x361719['stack']);if(_0x361719[_0x80e4('0x23')]){delete _0x361719[_0x80e4('0x23')];}_0x4c536f[_0x80e4('0x16')](_0x499245)['send'](_0x361719);};}exports['index']=function(_0x1af4ed,_0x2d7a16){var _0x18599a={},_0x2370a4={},_0x97cfcd={'count':0x0,'rows':[]};var _0x2b826a=_['map'](db[_0x80e4('0x24')]['rawAttributes'],function(_0x2a54b3){return{'name':_0x2a54b3[_0x80e4('0x25')],'type':_0x2a54b3[_0x80e4('0x26')][_0x80e4('0x27')]};});_0x2370a4['model']=_[_0x80e4('0x28')](_0x2b826a,_0x80e4('0x23'));_0x2370a4['query']=_[_0x80e4('0x29')](_0x1af4ed['query']);_0x2370a4[_0x80e4('0x2a')]=_['intersection'](_0x2370a4[_0x80e4('0x2b')],_0x2370a4[_0x80e4('0x2c')]);_0x18599a['attributes']=_['intersection'](_0x2370a4[_0x80e4('0x2b')],qs[_0x80e4('0x2d')](_0x1af4ed[_0x80e4('0x2c')][_0x80e4('0x2d')]));_0x18599a[_0x80e4('0x2e')]=_0x18599a[_0x80e4('0x2e')]['length']?_0x18599a[_0x80e4('0x2e')]:_0x2370a4['model'];if(!_0x1af4ed['query'][_0x80e4('0x2f')](_0x80e4('0x30'))){_0x18599a[_0x80e4('0x19')]=qs[_0x80e4('0x19')](_0x1af4ed[_0x80e4('0x2c')][_0x80e4('0x19')]);_0x18599a[_0x80e4('0x18')]=qs[_0x80e4('0x18')](_0x1af4ed[_0x80e4('0x2c')][_0x80e4('0x18')]);}_0x18599a[_0x80e4('0x31')]=qs['sort'](_0x1af4ed['query']['sort']);_0x18599a['where']=qs[_0x80e4('0x2a')](_[_0x80e4('0x32')](_0x1af4ed[_0x80e4('0x2c')],_0x2370a4['filters']),_0x2b826a);if(_0x1af4ed['query'][_0x80e4('0x33')]){_0x18599a[_0x80e4('0x34')]=_[_0x80e4('0x35')](_0x18599a[_0x80e4('0x34')],{'$or':_[_0x80e4('0x28')](_0x2b826a,function(_0x42aaf0){if(_0x42aaf0['type']!=='VIRTUAL'){var _0x74a660={};_0x74a660[_0x42aaf0[_0x80e4('0x23')]]={'$like':'%'+_0x1af4ed[_0x80e4('0x2c')][_0x80e4('0x33')]+'%'};return _0x74a660;}})});}_0x18599a=_[_0x80e4('0x35')]({},_0x18599a,_0x1af4ed['options']);var _0x205bc4={'where':_0x18599a[_0x80e4('0x34')]};return db[_0x80e4('0x24')][_0x80e4('0x1b')](_0x205bc4)[_0x80e4('0x21')](function(_0xe74b7f){_0x97cfcd[_0x80e4('0x1b')]=_0xe74b7f;if(_0x1af4ed[_0x80e4('0x2c')][_0x80e4('0x36')]){_0x18599a[_0x80e4('0x37')]=[{'all':!![]}];}return db[_0x80e4('0x24')]['findAll'](_0x18599a);})['then'](function(_0x4db26b){_0x97cfcd[_0x80e4('0x38')]=_0x4db26b;return _0x97cfcd;})[_0x80e4('0x21')](respondWithFilteredResult(_0x2d7a16,_0x18599a))[_0x80e4('0x39')](handleError(_0x2d7a16,null));};exports[_0x80e4('0x3a')]=function(_0x133f47,_0x3ec713){var _0x5b2d9b={'raw':!![],'where':{'id':_0x133f47[_0x80e4('0x3b')]['id']}},_0x3c0be1={};_0x3c0be1[_0x80e4('0x2b')]=_[_0x80e4('0x29')](db['AnalyticTreeReport'][_0x80e4('0x3c')]);_0x3c0be1['query']=_[_0x80e4('0x29')](_0x133f47[_0x80e4('0x2c')]);_0x3c0be1[_0x80e4('0x2a')]=_[_0x80e4('0x3d')](_0x3c0be1['model'],_0x3c0be1['query']);_0x5b2d9b[_0x80e4('0x2e')]=_['intersection'](_0x3c0be1[_0x80e4('0x2b')],qs[_0x80e4('0x2d')](_0x133f47[_0x80e4('0x2c')][_0x80e4('0x2d')]));_0x5b2d9b['attributes']=_0x5b2d9b[_0x80e4('0x2e')][_0x80e4('0x3e')]?_0x5b2d9b[_0x80e4('0x2e')]:_0x3c0be1[_0x80e4('0x2b')];if(_0x133f47['query'][_0x80e4('0x36')]){_0x5b2d9b[_0x80e4('0x37')]=[{'all':!![]}];}_0x5b2d9b=_[_0x80e4('0x35')]({},_0x5b2d9b,_0x133f47[_0x80e4('0x3f')]);return db[_0x80e4('0x24')]['find'](_0x5b2d9b)[_0x80e4('0x21')](handleEntityNotFound(_0x3ec713,null))[_0x80e4('0x21')](respondWithResult(_0x3ec713,null))[_0x80e4('0x39')](handleError(_0x3ec713,null));};exports[_0x80e4('0x40')]=function(_0x1607e8,_0x5e01af){return db[_0x80e4('0x24')][_0x80e4('0x40')](_0x1607e8['body'],{})['then'](respondWithResult(_0x5e01af,0xc9))['catch'](handleError(_0x5e01af,null));};exports[_0x80e4('0x1f')]=function(_0x28c0c0,_0x5753fd){if(_0x28c0c0[_0x80e4('0x41')]['id']){delete _0x28c0c0['body']['id'];}return db[_0x80e4('0x24')][_0x80e4('0x42')]({'where':{'id':_0x28c0c0[_0x80e4('0x3b')]['id']}})[_0x80e4('0x21')](handleEntityNotFound(_0x5753fd,null))['then'](saveUpdates(_0x28c0c0[_0x80e4('0x41')],null))['then'](respondWithResult(_0x5753fd,null))[_0x80e4('0x39')](handleError(_0x5753fd,null));};exports[_0x80e4('0x20')]=function(_0x284aec,_0x2453f7){return db[_0x80e4('0x24')]['find']({'where':{'id':_0x284aec[_0x80e4('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2453f7,null))[_0x80e4('0x21')](removeEntity(_0x2453f7,null))['catch'](handleError(_0x2453f7,null));}; \ No newline at end of file +var _0x37bc=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x56423d,_0x5e08df){var _0x16754d=function(_0x2af42a){while(--_0x2af42a){_0x56423d['push'](_0x56423d['shift']());}};_0x16754d(++_0x5e08df);}(_0x37bc,0x12f));var _0xc37b=function(_0x122eee,_0x5d50ff){_0x122eee=_0x122eee-0x0;var _0x81cd=_0x37bc[_0x122eee];return _0x81cd;};'use strict';var emlformat=require(_0xc37b('0x0'));var rimraf=require(_0xc37b('0x1'));var zipdir=require(_0xc37b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc37b('0x3'));var moment=require(_0xc37b('0x4'));var BPromise=require(_0xc37b('0x5'));var Mustache=require('mustache');var util=require(_0xc37b('0x6'));var path=require(_0xc37b('0x7'));var sox=require(_0xc37b('0x8'));var csv=require(_0xc37b('0x9'));var ejs=require(_0xc37b('0xa'));var fs=require('fs');var fs_extra=require(_0xc37b('0xb'));var _=require(_0xc37b('0xc'));var squel=require('squel');var crypto=require(_0xc37b('0xd'));var jsforce=require(_0xc37b('0xe'));var deskjs=require(_0xc37b('0xf'));var toCsv=require(_0xc37b('0x9'));var querystring=require(_0xc37b('0x10'));var Papa=require('papaparse');var Redis=require(_0xc37b('0x11'));var authService=require(_0xc37b('0x12'));var qs=require(_0xc37b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc37b('0x14'))(_0xc37b('0x15'));var utils=require(_0xc37b('0x16'));var config=require(_0xc37b('0x17'));var licenseUtil=require(_0xc37b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ba1ab,_0x4b05c1){_0x4b05c1=_0x4b05c1||0xcc;return function(_0x2e7875){if(_0x2e7875){return _0x1ba1ab[_0xc37b('0x19')](_0x4b05c1);}return _0x1ba1ab[_0xc37b('0x1a')](_0x4b05c1)[_0xc37b('0x1b')]();};}function respondWithResult(_0x2f52b0,_0x29a771){_0x29a771=_0x29a771||0xc8;return function(_0x11101b){if(_0x11101b){return _0x2f52b0[_0xc37b('0x1a')](_0x29a771)[_0xc37b('0x1c')](_0x11101b);}};}function respondWithFilteredResult(_0x3ed3f5,_0x5cdcb8){return function(_0x1b4394){if(_0x1b4394){var _0x1d2a5a=typeof _0x5cdcb8[_0xc37b('0x1d')]===_0xc37b('0x1e')&&typeof _0x5cdcb8[_0xc37b('0x1f')]===_0xc37b('0x1e');var _0x3b3c40=_0x1b4394[_0xc37b('0x20')];var _0x36a4af=_0x1d2a5a?0x0:_0x5cdcb8[_0xc37b('0x1d')];var _0x41003c=_0x1d2a5a?_0x1b4394[_0xc37b('0x20')]:_0x5cdcb8[_0xc37b('0x1d')]+_0x5cdcb8[_0xc37b('0x1f')];var _0x5456ba;if(_0x41003c>=_0x3b3c40){_0x41003c=_0x3b3c40;_0x5456ba=0xc8;}else{_0x5456ba=0xce;}_0x3ed3f5[_0xc37b('0x1a')](_0x5456ba);return _0x3ed3f5[_0xc37b('0x21')](_0xc37b('0x22'),_0x36a4af+'-'+_0x41003c+'/'+_0x3b3c40)['json'](_0x1b4394);}return null;};}function patchUpdates(_0x3f669e){return function(_0x57bc6f){try{jsonpatch[_0xc37b('0x23')](_0x57bc6f,_0x3f669e,!![]);}catch(_0x49f803){return BPromise[_0xc37b('0x24')](_0x49f803);}return _0x57bc6f['save']();};}function saveUpdates(_0xf950d1,_0x1cfcfa){return function(_0x4d3f11){if(_0x4d3f11){return _0x4d3f11[_0xc37b('0x25')](_0xf950d1)[_0xc37b('0x26')](function(_0x1964d2){return _0x1964d2;});}return null;};}function removeEntity(_0x281863,_0x309713){return function(_0x2971c6){if(_0x2971c6){return _0x2971c6[_0xc37b('0x27')]()[_0xc37b('0x26')](function(){_0x281863[_0xc37b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3699f6,_0xf9eec){return function(_0x53c3b4){if(!_0x53c3b4){_0x3699f6['sendStatus'](0x194);}return _0x53c3b4;};}function handleError(_0x131c5d,_0x3d7721){_0x3d7721=_0x3d7721||0x1f4;return function(_0x46c460){logger['error'](_0x46c460[_0xc37b('0x28')]);if(_0x46c460[_0xc37b('0x29')]){delete _0x46c460['name'];}_0x131c5d[_0xc37b('0x1a')](_0x3d7721)[_0xc37b('0x2a')](_0x46c460);};}exports[_0xc37b('0x2b')]=function(_0x80081d,_0x174afb){var _0x283fb6={},_0x1ed4d7={},_0x351b53={'count':0x0,'rows':[]};var _0x3f91e3=_[_0xc37b('0x2c')](db[_0xc37b('0x2d')][_0xc37b('0x2e')],function(_0x32cc69){return{'name':_0x32cc69[_0xc37b('0x2f')],'type':_0x32cc69[_0xc37b('0x30')][_0xc37b('0x31')]};});_0x1ed4d7[_0xc37b('0x32')]=_['map'](_0x3f91e3,_0xc37b('0x29'));_0x1ed4d7[_0xc37b('0x33')]=_['keys'](_0x80081d['query']);_0x1ed4d7[_0xc37b('0x34')]=_[_0xc37b('0x35')](_0x1ed4d7['model'],_0x1ed4d7['query']);_0x283fb6['attributes']=_[_0xc37b('0x35')](_0x1ed4d7[_0xc37b('0x32')],qs[_0xc37b('0x36')](_0x80081d['query'][_0xc37b('0x36')]));_0x283fb6[_0xc37b('0x37')]=_0x283fb6[_0xc37b('0x37')][_0xc37b('0x38')]?_0x283fb6['attributes']:_0x1ed4d7['model'];if(!_0x80081d[_0xc37b('0x33')][_0xc37b('0x39')](_0xc37b('0x3a'))){_0x283fb6[_0xc37b('0x1f')]=qs[_0xc37b('0x1f')](_0x80081d[_0xc37b('0x33')]['limit']);_0x283fb6[_0xc37b('0x1d')]=qs['offset'](_0x80081d[_0xc37b('0x33')][_0xc37b('0x1d')]);}_0x283fb6[_0xc37b('0x3b')]=qs[_0xc37b('0x3c')](_0x80081d[_0xc37b('0x33')][_0xc37b('0x3c')]);_0x283fb6[_0xc37b('0x3d')]=qs['filters'](_[_0xc37b('0x3e')](_0x80081d['query'],_0x1ed4d7[_0xc37b('0x34')]),_0x3f91e3);if(_0x80081d[_0xc37b('0x33')][_0xc37b('0x3f')]){_0x283fb6[_0xc37b('0x3d')]=_['merge'](_0x283fb6[_0xc37b('0x3d')],{'$or':_[_0xc37b('0x2c')](_0x3f91e3,function(_0x429068){if(_0x429068['type']!==_0xc37b('0x40')){var _0x22e219={};_0x22e219[_0x429068[_0xc37b('0x29')]]={'$like':'%'+_0x80081d[_0xc37b('0x33')][_0xc37b('0x3f')]+'%'};return _0x22e219;}})});}_0x283fb6=_[_0xc37b('0x41')]({},_0x283fb6,_0x80081d[_0xc37b('0x42')]);var _0x296939={'where':_0x283fb6[_0xc37b('0x3d')]};return db['AnalyticTreeReport'][_0xc37b('0x20')](_0x296939)['then'](function(_0x357fc1){_0x351b53[_0xc37b('0x20')]=_0x357fc1;if(_0x80081d['query'][_0xc37b('0x43')]){_0x283fb6[_0xc37b('0x44')]=[{'all':!![]}];}return db[_0xc37b('0x2d')]['findAll'](_0x283fb6);})[_0xc37b('0x26')](function(_0x21980d){_0x351b53[_0xc37b('0x45')]=_0x21980d;return _0x351b53;})[_0xc37b('0x26')](respondWithFilteredResult(_0x174afb,_0x283fb6))[_0xc37b('0x46')](handleError(_0x174afb,null));};exports[_0xc37b('0x47')]=function(_0x35ac2f,_0x2116a9){var _0xba806e={'raw':!![],'where':{'id':_0x35ac2f['params']['id']}},_0x167a05={};_0x167a05[_0xc37b('0x32')]=_['keys'](db[_0xc37b('0x2d')][_0xc37b('0x2e')]);_0x167a05[_0xc37b('0x33')]=_[_0xc37b('0x48')](_0x35ac2f[_0xc37b('0x33')]);_0x167a05[_0xc37b('0x34')]=_[_0xc37b('0x35')](_0x167a05['model'],_0x167a05[_0xc37b('0x33')]);_0xba806e[_0xc37b('0x37')]=_[_0xc37b('0x35')](_0x167a05[_0xc37b('0x32')],qs[_0xc37b('0x36')](_0x35ac2f[_0xc37b('0x33')][_0xc37b('0x36')]));_0xba806e[_0xc37b('0x37')]=_0xba806e[_0xc37b('0x37')]['length']?_0xba806e[_0xc37b('0x37')]:_0x167a05[_0xc37b('0x32')];if(_0x35ac2f[_0xc37b('0x33')][_0xc37b('0x43')]){_0xba806e[_0xc37b('0x44')]=[{'all':!![]}];}_0xba806e=_[_0xc37b('0x41')]({},_0xba806e,_0x35ac2f[_0xc37b('0x42')]);return db[_0xc37b('0x2d')][_0xc37b('0x49')](_0xba806e)[_0xc37b('0x26')](handleEntityNotFound(_0x2116a9,null))[_0xc37b('0x26')](respondWithResult(_0x2116a9,null))[_0xc37b('0x46')](handleError(_0x2116a9,null));};exports[_0xc37b('0x4a')]=function(_0x4beac3,_0x4f2132){return db['AnalyticTreeReport'][_0xc37b('0x4a')](_0x4beac3[_0xc37b('0x4b')],{})[_0xc37b('0x26')](respondWithResult(_0x4f2132,0xc9))['catch'](handleError(_0x4f2132,null));};exports['update']=function(_0x4617ef,_0x10b2a2){if(_0x4617ef[_0xc37b('0x4b')]['id']){delete _0x4617ef['body']['id'];}return db[_0xc37b('0x2d')][_0xc37b('0x49')]({'where':{'id':_0x4617ef[_0xc37b('0x4c')]['id']}})[_0xc37b('0x26')](handleEntityNotFound(_0x10b2a2,null))[_0xc37b('0x26')](saveUpdates(_0x4617ef['body'],null))[_0xc37b('0x26')](respondWithResult(_0x10b2a2,null))[_0xc37b('0x46')](handleError(_0x10b2a2,null));};exports['destroy']=function(_0x9b7555,_0x3b35cb){return db['AnalyticTreeReport']['find']({'where':{'id':_0x9b7555[_0xc37b('0x4c')]['id']}})[_0xc37b('0x26')](handleEntityNotFound(_0x3b35cb,null))[_0xc37b('0x26')](removeEntity(_0x3b35cb,null))[_0xc37b('0x46')](handleError(_0x3b35cb,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 75a2eb1..5073bfb 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.model.js +++ b/server/api/analyticTreeReport/analyticTreeReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8da0=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport'];(function(_0x4403e7,_0x3aaa20){var _0x205be8=function(_0xc5c9c3){while(--_0xc5c9c3){_0x4403e7['push'](_0x4403e7['shift']());}};_0x205be8(++_0x3aaa20);}(_0x8da0,0xdc));var _0x08da=function(_0x4bc43b,_0x4ec79e){_0x4bc43b=_0x4bc43b-0x0;var _0x38e1fb=_0x8da0[_0x4bc43b];return _0x38e1fb;};'use strict';var _=require('lodash');var util=require(_0x08da('0x0'));var logger=require(_0x08da('0x1'))(_0x08da('0x2'));var moment=require(_0x08da('0x3'));var BPromise=require('bluebird');var rp=require(_0x08da('0x4'));var fs=require('fs');var path=require(_0x08da('0x5'));var rimraf=require(_0x08da('0x6'));var config=require(_0x08da('0x7'));var attributes=require(_0x08da('0x8'));module[_0x08da('0x9')]=function(_0x493fec,_0x3af236){return _0x493fec['define'](_0x08da('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73c4=['request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','util','../../config/logger','api','moment','bluebird'];(function(_0x5137b1,_0x4ae802){var _0x407727=function(_0x96b353){while(--_0x96b353){_0x5137b1['push'](_0x5137b1['shift']());}};_0x407727(++_0x4ae802);}(_0x73c4,0x73));var _0x473c=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x73c4[_0x56fe98];return _0x212f4f;};'use strict';var _=require('lodash');var util=require(_0x473c('0x0'));var logger=require(_0x473c('0x1'))(_0x473c('0x2'));var moment=require(_0x473c('0x3'));var BPromise=require(_0x473c('0x4'));var rp=require(_0x473c('0x5'));var fs=require('fs');var path=require(_0x473c('0x6'));var rimraf=require('rimraf');var config=require(_0x473c('0x7'));var attributes=require(_0x473c('0x8'));module[_0x473c('0x9')]=function(_0x491b90,_0x46eb12){return _0x491b90[_0x473c('0xa')](_0x473c('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index c796d38..0005fc3 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4f43b6,_0x1ce67c){var _0x3db2ae=function(_0x1e191f){while(--_0x1e191f){_0x4f43b6['push'](_0x4f43b6['shift']());}};_0x3db2ae(++_0x1ce67c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x59b057,_0x3c88b7){_0x59b057=_0x59b057-0x0;var _0x52915b=_0x5f2f[_0x59b057];return _0x52915b;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3dd7ab,_0x323821){var _0xe6f37a=function(_0x19fbe2){while(--_0x19fbe2){_0x3dd7ab['push'](_0x3dd7ab['shift']());}};_0xe6f37a(++_0x323821);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc4aa[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index a4f77e7..817a231 100644 --- a/server/api/analyticTreeReport/index.js +++ b/server/api/analyticTreeReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f54=['util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0x1f54,0x13f));var _0x41f5=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x1f54[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0x41f5('0x0'));var util=require(_0x41f5('0x1'));var path=require('path');var timeout=require(_0x41f5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x41f5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x41f5('0x4'));var config=require(_0x41f5('0x5'));var controller=require(_0x41f5('0x6'));router[_0x41f5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x41f5('0x7')](_0x41f5('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x41f5('0x9')](),controller[_0x41f5('0xa')]);router[_0x41f5('0xb')]('/:id',auth[_0x41f5('0x9')](),controller[_0x41f5('0xc')]);router[_0x41f5('0xd')]('/:id',auth[_0x41f5('0x9')](),controller[_0x41f5('0xe')]);module[_0x41f5('0xf')]=router; \ No newline at end of file +var _0x3d3d=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','show','post','put','/:id','update','delete','destroy'];(function(_0xa8459e,_0x1f379b){var _0x8f9136=function(_0x18cae3){while(--_0x18cae3){_0xa8459e['push'](_0xa8459e['shift']());}};_0x8f9136(++_0x1f379b);}(_0x3d3d,0x199));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd3d3('0x0'));var path=require(_0xd3d3('0x1'));var timeout=require(_0xd3d3('0x2'));var express=require(_0xd3d3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd3d3('0x4'));var interaction=require(_0xd3d3('0x5'));var config=require(_0xd3d3('0x6'));var controller=require(_0xd3d3('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xd3d3('0x8')](),controller[_0xd3d3('0x9')]);router[_0xd3d3('0xa')]('/',auth[_0xd3d3('0x8')](),controller['create']);router[_0xd3d3('0xb')](_0xd3d3('0xc'),auth['isAuthenticated'](),controller[_0xd3d3('0xd')]);router[_0xd3d3('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd3d3('0xf')]);module[_0xd3d3('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 54ef191..d39527d 100644 --- a/server/api/attachment/attachment.attributes.js +++ b/server/api/attachment/attachment.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9bc=['exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x5e509a,_0x3ecd8a){_0x5e509a=_0x5e509a-0x0;var _0x7d4c71=_0xf9bc[_0x5e509a];return _0x7d4c71;};'use strict';var Sequelize=require('sequelize');module[_0xcf9b('0x0')]={'name':{'type':Sequelize[_0xcf9b('0x1')]},'basename':{'type':Sequelize[_0xcf9b('0x1')]},'type':{'type':Sequelize[_0xcf9b('0x1')]}}; \ No newline at end of file +var _0xbacb=['exports','STRING','sequelize'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0xbacb,0x1a6));var _0xbbac=function(_0x5c7dff,_0x2749e2){_0x5c7dff=_0x5c7dff-0x0;var _0x136184=_0xbacb[_0x5c7dff];return _0x136184;};'use strict';var Sequelize=require(_0xbbac('0x0'));module[_0xbbac('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xbbac('0x2')]},'type':{'type':Sequelize[_0xbbac('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1182f4b..b0e5bcc 100644 --- a/server/api/attachment/attachment.controller.js +++ b/server/api/attachment/attachment.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc6=['includeAll','include','findAll','rows','catch','show','params','clone','get','createdAt','body','updatedAt','create','find','file','basename','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xafc6,0x6b));var _0x6afc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xafc6[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6afc('0x0'));var zipdir=require(_0x6afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6afc('0x2'));var moment=require('moment');var BPromise=require(_0x6afc('0x3'));var Mustache=require(_0x6afc('0x4'));var util=require(_0x6afc('0x5'));var path=require(_0x6afc('0x6'));var sox=require('sox');var csv=require(_0x6afc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6afc('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6afc('0x9'));var toCsv=require(_0x6afc('0x7'));var querystring=require(_0x6afc('0xa'));var Papa=require(_0x6afc('0xb'));var Redis=require('ioredis');var authService=require(_0x6afc('0xc'));var qs=require(_0x6afc('0xd'));var as=require(_0x6afc('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6afc('0xf'))(_0x6afc('0x10'));var utils=require(_0x6afc('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6afc('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x186bbc,_0x15206e){_0x15206e=_0x15206e||0xcc;return function(_0xa591f){if(_0xa591f){return _0x186bbc[_0x6afc('0x13')](_0x15206e);}return _0x186bbc[_0x6afc('0x14')](_0x15206e)[_0x6afc('0x15')]();};}function respondWithResult(_0xe11c50,_0x165c9c){_0x165c9c=_0x165c9c||0xc8;return function(_0x4f11ce){if(_0x4f11ce){return _0xe11c50[_0x6afc('0x14')](_0x165c9c)[_0x6afc('0x16')](_0x4f11ce);}};}function respondWithFilteredResult(_0x3d1795,_0x2447ef){return function(_0x27c096){if(_0x27c096){var _0x3f02d1=typeof _0x2447ef[_0x6afc('0x17')]==='undefined'&&typeof _0x2447ef[_0x6afc('0x18')]===_0x6afc('0x19');var _0x1e91e5=_0x27c096['count'];var _0x3b2db1=_0x3f02d1?0x0:_0x2447ef[_0x6afc('0x17')];var _0x3a35f7=_0x3f02d1?_0x27c096[_0x6afc('0x1a')]:_0x2447ef['offset']+_0x2447ef[_0x6afc('0x18')];var _0x2e47fc;if(_0x3a35f7>=_0x1e91e5){_0x3a35f7=_0x1e91e5;_0x2e47fc=0xc8;}else{_0x2e47fc=0xce;}_0x3d1795[_0x6afc('0x14')](_0x2e47fc);return _0x3d1795[_0x6afc('0x1b')](_0x6afc('0x1c'),_0x3b2db1+'-'+_0x3a35f7+'/'+_0x1e91e5)['json'](_0x27c096);}return null;};}function patchUpdates(_0x366fc4){return function(_0x265579){try{jsonpatch[_0x6afc('0x1d')](_0x265579,_0x366fc4,!![]);}catch(_0x2fce76){return BPromise[_0x6afc('0x1e')](_0x2fce76);}return _0x265579[_0x6afc('0x1f')]();};}function saveUpdates(_0xabe1a0,_0x11c954){return function(_0x30ab97){if(_0x30ab97){return _0x30ab97[_0x6afc('0x20')](_0xabe1a0)[_0x6afc('0x21')](function(_0x4fd7c1){return _0x4fd7c1;});}return null;};}function removeEntity(_0x22b68b,_0x424497){return function(_0x496cd2){if(_0x496cd2){return _0x496cd2[_0x6afc('0x22')]()[_0x6afc('0x21')](function(){_0x22b68b[_0x6afc('0x14')](0xcc)[_0x6afc('0x15')]();});}};}function handleEntityNotFound(_0x2c9452,_0x3b0645){return function(_0x23118c){if(!_0x23118c){_0x2c9452['sendStatus'](0x194);}return _0x23118c;};}function handleError(_0x12d2df,_0x59c324){_0x59c324=_0x59c324||0x1f4;return function(_0x387189){logger[_0x6afc('0x23')](_0x387189[_0x6afc('0x24')]);if(_0x387189['name']){delete _0x387189[_0x6afc('0x25')];}_0x12d2df[_0x6afc('0x14')](_0x59c324)[_0x6afc('0x26')](_0x387189);};}exports[_0x6afc('0x27')]=function(_0x3dc971,_0x364f71){var _0x2e2a7a={},_0x2aaeb0={},_0x106f53={'count':0x0,'rows':[]};var _0x4def35=_[_0x6afc('0x28')](db[_0x6afc('0x29')][_0x6afc('0x2a')],function(_0x345369){return{'name':_0x345369[_0x6afc('0x2b')],'type':_0x345369[_0x6afc('0x2c')]['key']};});_0x2aaeb0[_0x6afc('0x2d')]=_[_0x6afc('0x28')](_0x4def35,_0x6afc('0x25'));_0x2aaeb0['query']=_[_0x6afc('0x2e')](_0x3dc971['query']);_0x2aaeb0[_0x6afc('0x2f')]=_['intersection'](_0x2aaeb0[_0x6afc('0x2d')],_0x2aaeb0[_0x6afc('0x30')]);_0x2e2a7a['attributes']=_[_0x6afc('0x31')](_0x2aaeb0['model'],qs[_0x6afc('0x32')](_0x3dc971[_0x6afc('0x30')]['fields']));_0x2e2a7a[_0x6afc('0x33')]=_0x2e2a7a[_0x6afc('0x33')][_0x6afc('0x34')]?_0x2e2a7a[_0x6afc('0x33')]:_0x2aaeb0[_0x6afc('0x2d')];if(!_0x3dc971['query'][_0x6afc('0x35')](_0x6afc('0x36'))){_0x2e2a7a[_0x6afc('0x18')]=qs[_0x6afc('0x18')](_0x3dc971['query'][_0x6afc('0x18')]);_0x2e2a7a[_0x6afc('0x17')]=qs[_0x6afc('0x17')](_0x3dc971['query'][_0x6afc('0x17')]);}_0x2e2a7a[_0x6afc('0x37')]=qs[_0x6afc('0x38')](_0x3dc971['query']['sort']);_0x2e2a7a[_0x6afc('0x39')]=qs[_0x6afc('0x2f')](_[_0x6afc('0x3a')](_0x3dc971['query'],_0x2aaeb0['filters']),_0x4def35);if(_0x3dc971[_0x6afc('0x30')][_0x6afc('0x3b')]){_0x2e2a7a[_0x6afc('0x39')]=_[_0x6afc('0x3c')](_0x2e2a7a[_0x6afc('0x39')],{'$or':_[_0x6afc('0x28')](_0x4def35,function(_0x449104){if(_0x449104[_0x6afc('0x2c')]!==_0x6afc('0x3d')){var _0x42d1ad={};_0x42d1ad[_0x449104[_0x6afc('0x25')]]={'$like':'%'+_0x3dc971[_0x6afc('0x30')][_0x6afc('0x3b')]+'%'};return _0x42d1ad;}})});}_0x2e2a7a=_[_0x6afc('0x3c')]({},_0x2e2a7a,_0x3dc971[_0x6afc('0x3e')]);var _0x4d79a4={'where':_0x2e2a7a[_0x6afc('0x39')]};return db[_0x6afc('0x29')][_0x6afc('0x1a')](_0x4d79a4)[_0x6afc('0x21')](function(_0x1f61ba){_0x106f53[_0x6afc('0x1a')]=_0x1f61ba;if(_0x3dc971[_0x6afc('0x30')][_0x6afc('0x3f')]){_0x2e2a7a[_0x6afc('0x40')]=[{'all':!![]}];}return db[_0x6afc('0x29')][_0x6afc('0x41')](_0x2e2a7a);})[_0x6afc('0x21')](function(_0x1ef2f6){_0x106f53[_0x6afc('0x42')]=_0x1ef2f6;return _0x106f53;})[_0x6afc('0x21')](respondWithFilteredResult(_0x364f71,_0x2e2a7a))[_0x6afc('0x43')](handleError(_0x364f71,null));};exports[_0x6afc('0x44')]=function(_0x4538de,_0xe82388){var _0x5d3bdb={'raw':!![],'where':{'id':_0x4538de[_0x6afc('0x45')]['id']}},_0x5139a4={};_0x5139a4[_0x6afc('0x2d')]=_[_0x6afc('0x2e')](db[_0x6afc('0x29')][_0x6afc('0x2a')]);_0x5139a4[_0x6afc('0x30')]=_[_0x6afc('0x2e')](_0x4538de[_0x6afc('0x30')]);_0x5139a4[_0x6afc('0x2f')]=_[_0x6afc('0x31')](_0x5139a4['model'],_0x5139a4[_0x6afc('0x30')]);_0x5d3bdb['attributes']=_['intersection'](_0x5139a4['model'],qs[_0x6afc('0x32')](_0x4538de[_0x6afc('0x30')][_0x6afc('0x32')]));_0x5d3bdb['attributes']=_0x5d3bdb['attributes'][_0x6afc('0x34')]?_0x5d3bdb[_0x6afc('0x33')]:_0x5139a4['model'];if(_0x4538de['query']['includeAll']){_0x5d3bdb[_0x6afc('0x40')]=[{'all':!![]}];}_0x5d3bdb=_[_0x6afc('0x3c')]({},_0x5d3bdb,_0x4538de[_0x6afc('0x3e')]);return db['Attachment']['find'](_0x5d3bdb)['then'](handleEntityNotFound(_0xe82388,null))['then'](respondWithResult(_0xe82388,null))[_0x6afc('0x43')](handleError(_0xe82388,null));};exports[_0x6afc('0x46')]=function(_0x4ff3e1,_0x400c94){var _0x787a71={'where':{'id':_0x4ff3e1[_0x6afc('0x45')]['id']}},_0x184405={};_0x184405[_0x6afc('0x2d')]=_['keys'](db[_0x6afc('0x29')][_0x6afc('0x2a')]);_0x787a71[_0x6afc('0x33')]=_[_0x6afc('0x31')](_0x184405[_0x6afc('0x2d')],qs[_0x6afc('0x32')](_0x4ff3e1['query']['fields']));_0x787a71[_0x6afc('0x33')]=_0x787a71['attributes'][_0x6afc('0x34')]?_0x787a71['attributes']:_0x184405[_0x6afc('0x2d')];if(_0x4ff3e1[_0x6afc('0x30')]['includeAll']){_0x787a71[_0x6afc('0x40')]=[{'all':!![]}];}_0x787a71=_[_0x6afc('0x3c')]({},_0x787a71,_0x4ff3e1[_0x6afc('0x3e')]);return db['Attachment']['find'](_0x787a71)[_0x6afc('0x21')](handleEntityNotFound(_0x400c94,null))[_0x6afc('0x21')](function(_0x361c3b){if(_0x361c3b){var _0x341a96=_0x361c3b[_0x6afc('0x47')]({'plain':!![]});_0x341a96=qs['omit'](_0x341a96,['id',_0x6afc('0x48'),'updatedAt']);_0x4ff3e1[_0x6afc('0x49')]=_['omit'](_0x4ff3e1[_0x6afc('0x49')],['id',_0x6afc('0x48'),_0x6afc('0x4a')]);return db[_0x6afc('0x29')][_0x6afc('0x4b')](_['merge'](_0x341a96,_0x4ff3e1['body']),{'include':_0x4ff3e1[_0x6afc('0x30')][_0x6afc('0x3f')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x400c94,0xc9))[_0x6afc('0x43')](handleError(_0x400c94,null));};exports['update']=function(_0x24979b,_0x157bc9){if(_0x24979b['body']['id']){delete _0x24979b[_0x6afc('0x49')]['id'];}return db[_0x6afc('0x29')]['find']({'where':{'id':_0x24979b[_0x6afc('0x45')]['id']}})[_0x6afc('0x21')](handleEntityNotFound(_0x157bc9,null))[_0x6afc('0x21')](saveUpdates(_0x24979b['body'],null))[_0x6afc('0x21')](respondWithResult(_0x157bc9,null))['catch'](handleError(_0x157bc9,null));};exports[_0x6afc('0x22')]=function(_0xde67b3,_0x442ce2){return db[_0x6afc('0x29')][_0x6afc('0x4c')]({'where':{'id':_0xde67b3['params']['id']}})[_0x6afc('0x21')](handleEntityNotFound(_0x442ce2,null))['then'](removeEntity(_0x442ce2,null))[_0x6afc('0x43')](handleError(_0x442ce2,null));};exports[_0x6afc('0x4b')]=function(_0x568357,_0xeb8ff0,_0x1661b8){_0x568357[_0x6afc('0x49')]['name']=_0x568357[_0x6afc('0x4d')]['originalname'];_0x568357['body'][_0x6afc('0x4e')]=_0x568357[_0x6afc('0x4d')]['filename'];_0x568357[_0x6afc('0x49')][_0x6afc('0x2c')]=_0x568357[_0x6afc('0x4d')]['mimetype'];return db['Attachment']['create'](_0x568357['body'])[_0x6afc('0x21')](respondWithResult(_0xeb8ff0,0xc9))[_0x6afc('0x43')](handleError(_0xeb8ff0,null));};exports[_0x6afc('0x4f')]=function(_0x215a7e,_0x37c26a,_0x43c11f){return db[_0x6afc('0x29')][_0x6afc('0x50')]({'where':{'id':_0x215a7e[_0x6afc('0x45')]['id']},'raw':!![]})[_0x6afc('0x21')](handleEntityNotFound(_0x37c26a,null))[_0x6afc('0x21')](function(_0x362765){if(_0x362765){var _0x950b65=_0x362765[_0x6afc('0x51')]!==null;var _0x3308eb=path[_0x6afc('0x52')](config['root'],_0x6afc('0x53'));if(_0x950b65){_0x3308eb=path[_0x6afc('0x52')](_0x3308eb,_0x6afc('0x54'));}var _0x22cec7=path['join'](_0x3308eb,_0x362765[_0x6afc('0x4e')]);return _0x37c26a[_0x6afc('0x4f')](_0x22cec7);}})[_0x6afc('0x43')](handleError(_0x37c26a,null));}; \ No newline at end of file +var _0xe97b=['reject','update','then','destroy','sendStatus','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','fields','clone','find','omit','updatedAt','body','createdAt','create','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','offline-chat/','basename','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x22c6c5,_0x51edad){var _0x4ad500=function(_0x125c37){while(--_0x125c37){_0x22c6c5['push'](_0x22c6c5['shift']());}};_0x4ad500(++_0x51edad);}(_0xe97b,0x1f0));var _0xbe97=function(_0x43ad75,_0x13a196){_0x43ad75=_0x43ad75-0x0;var _0x2d4cd8=_0xe97b[_0x43ad75];return _0x2d4cd8;};'use strict';var emlformat=require(_0xbe97('0x0'));var rimraf=require(_0xbe97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe97('0x2'));var rp=require(_0xbe97('0x3'));var moment=require(_0xbe97('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbe97('0x5'));var path=require(_0xbe97('0x6'));var sox=require(_0xbe97('0x7'));var csv=require(_0xbe97('0x8'));var ejs=require(_0xbe97('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe97('0xa'));var squel=require('squel');var crypto=require(_0xbe97('0xb'));var jsforce=require(_0xbe97('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbe97('0x8'));var querystring=require(_0xbe97('0xd'));var Papa=require(_0xbe97('0xe'));var Redis=require(_0xbe97('0xf'));var authService=require(_0xbe97('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe97('0x11'));var logger=require('../../config/logger')(_0xbe97('0x12'));var utils=require(_0xbe97('0x13'));var config=require(_0xbe97('0x14'));var licenseUtil=require(_0xbe97('0x15'));var db=require(_0xbe97('0x16'))['db'];function respondWithStatusCode(_0x48a482,_0x447815){_0x447815=_0x447815||0xcc;return function(_0x5a69d2){if(_0x5a69d2){return _0x48a482['sendStatus'](_0x447815);}return _0x48a482[_0xbe97('0x17')](_0x447815)[_0xbe97('0x18')]();};}function respondWithResult(_0x2cdb3a,_0x36a081){_0x36a081=_0x36a081||0xc8;return function(_0x58326e){if(_0x58326e){return _0x2cdb3a[_0xbe97('0x17')](_0x36a081)[_0xbe97('0x19')](_0x58326e);}};}function respondWithFilteredResult(_0x49167,_0x3587f7){return function(_0x54bf10){if(_0x54bf10){var _0x211d5b=typeof _0x3587f7[_0xbe97('0x1a')]===_0xbe97('0x1b')&&typeof _0x3587f7[_0xbe97('0x1c')]==='undefined';var _0x5e7d7e=_0x54bf10['count'];var _0x2df892=_0x211d5b?0x0:_0x3587f7[_0xbe97('0x1a')];var _0x512466=_0x211d5b?_0x54bf10[_0xbe97('0x1d')]:_0x3587f7[_0xbe97('0x1a')]+_0x3587f7[_0xbe97('0x1c')];var _0x5d363a;if(_0x512466>=_0x5e7d7e){_0x512466=_0x5e7d7e;_0x5d363a=0xc8;}else{_0x5d363a=0xce;}_0x49167['status'](_0x5d363a);return _0x49167[_0xbe97('0x1e')]('Content-Range',_0x2df892+'-'+_0x512466+'/'+_0x5e7d7e)[_0xbe97('0x19')](_0x54bf10);}return null;};}function patchUpdates(_0xc3c1c){return function(_0x5d1366){try{jsonpatch[_0xbe97('0x1f')](_0x5d1366,_0xc3c1c,!![]);}catch(_0x57096b){return BPromise[_0xbe97('0x20')](_0x57096b);}return _0x5d1366['save']();};}function saveUpdates(_0x39a662,_0x8f6eec){return function(_0x5720fe){if(_0x5720fe){return _0x5720fe[_0xbe97('0x21')](_0x39a662)[_0xbe97('0x22')](function(_0xc6916f){return _0xc6916f;});}return null;};}function removeEntity(_0x1d73a8,_0x33e801){return function(_0xbdad17){if(_0xbdad17){return _0xbdad17[_0xbe97('0x23')]()['then'](function(){_0x1d73a8[_0xbe97('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce8084,_0x3c2360){return function(_0x4888b2){if(!_0x4888b2){_0xce8084[_0xbe97('0x24')](0x194);}return _0x4888b2;};}function handleError(_0x198b2f,_0x549f0a){_0x549f0a=_0x549f0a||0x1f4;return function(_0x5efaf4){logger[_0xbe97('0x25')](_0x5efaf4[_0xbe97('0x26')]);if(_0x5efaf4[_0xbe97('0x27')]){delete _0x5efaf4['name'];}_0x198b2f[_0xbe97('0x17')](_0x549f0a)[_0xbe97('0x28')](_0x5efaf4);};}exports[_0xbe97('0x29')]=function(_0x4e3960,_0x48fcbc){var _0x369626={},_0x5ee64a={},_0x4bd0a8={'count':0x0,'rows':[]};var _0x36c546=_['map'](db[_0xbe97('0x2a')][_0xbe97('0x2b')],function(_0x47aaee){return{'name':_0x47aaee[_0xbe97('0x2c')],'type':_0x47aaee[_0xbe97('0x2d')]['key']};});_0x5ee64a['model']=_[_0xbe97('0x2e')](_0x36c546,_0xbe97('0x27'));_0x5ee64a[_0xbe97('0x2f')]=_['keys'](_0x4e3960[_0xbe97('0x2f')]);_0x5ee64a[_0xbe97('0x30')]=_[_0xbe97('0x31')](_0x5ee64a[_0xbe97('0x32')],_0x5ee64a['query']);_0x369626[_0xbe97('0x33')]=_[_0xbe97('0x31')](_0x5ee64a['model'],qs['fields'](_0x4e3960[_0xbe97('0x2f')]['fields']));_0x369626[_0xbe97('0x33')]=_0x369626[_0xbe97('0x33')][_0xbe97('0x34')]?_0x369626['attributes']:_0x5ee64a['model'];if(!_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x35')](_0xbe97('0x36'))){_0x369626[_0xbe97('0x1c')]=qs[_0xbe97('0x1c')](_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x1c')]);_0x369626['offset']=qs[_0xbe97('0x1a')](_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x1a')]);}_0x369626[_0xbe97('0x37')]=qs[_0xbe97('0x38')](_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x38')]);_0x369626[_0xbe97('0x39')]=qs[_0xbe97('0x30')](_[_0xbe97('0x3a')](_0x4e3960[_0xbe97('0x2f')],_0x5ee64a[_0xbe97('0x30')]),_0x36c546);if(_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x3b')]){_0x369626[_0xbe97('0x39')]=_[_0xbe97('0x3c')](_0x369626['where'],{'$or':_[_0xbe97('0x2e')](_0x36c546,function(_0x17d8dd){if(_0x17d8dd[_0xbe97('0x2d')]!==_0xbe97('0x3d')){var _0x5885ff={};_0x5885ff[_0x17d8dd[_0xbe97('0x27')]]={'$like':'%'+_0x4e3960['query'][_0xbe97('0x3b')]+'%'};return _0x5885ff;}})});}_0x369626=_['merge']({},_0x369626,_0x4e3960[_0xbe97('0x3e')]);var _0x2fe99e={'where':_0x369626['where']};return db[_0xbe97('0x2a')][_0xbe97('0x1d')](_0x2fe99e)[_0xbe97('0x22')](function(_0x2b8a2b){_0x4bd0a8[_0xbe97('0x1d')]=_0x2b8a2b;if(_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x3f')]){_0x369626[_0xbe97('0x40')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x369626);})[_0xbe97('0x22')](function(_0x294ad5){_0x4bd0a8[_0xbe97('0x41')]=_0x294ad5;return _0x4bd0a8;})['then'](respondWithFilteredResult(_0x48fcbc,_0x369626))[_0xbe97('0x42')](handleError(_0x48fcbc,null));};exports[_0xbe97('0x43')]=function(_0x1659e0,_0x4842c6){var _0x1b20cd={'raw':!![],'where':{'id':_0x1659e0[_0xbe97('0x44')]['id']}},_0x21b042={};_0x21b042[_0xbe97('0x32')]=_[_0xbe97('0x45')](db[_0xbe97('0x2a')][_0xbe97('0x2b')]);_0x21b042['query']=_[_0xbe97('0x45')](_0x1659e0['query']);_0x21b042[_0xbe97('0x30')]=_[_0xbe97('0x31')](_0x21b042[_0xbe97('0x32')],_0x21b042['query']);_0x1b20cd['attributes']=_[_0xbe97('0x31')](_0x21b042['model'],qs['fields'](_0x1659e0[_0xbe97('0x2f')][_0xbe97('0x46')]));_0x1b20cd[_0xbe97('0x33')]=_0x1b20cd['attributes']['length']?_0x1b20cd['attributes']:_0x21b042[_0xbe97('0x32')];if(_0x1659e0['query']['includeAll']){_0x1b20cd[_0xbe97('0x40')]=[{'all':!![]}];}_0x1b20cd=_[_0xbe97('0x3c')]({},_0x1b20cd,_0x1659e0['options']);return db[_0xbe97('0x2a')]['find'](_0x1b20cd)[_0xbe97('0x22')](handleEntityNotFound(_0x4842c6,null))['then'](respondWithResult(_0x4842c6,null))['catch'](handleError(_0x4842c6,null));};exports[_0xbe97('0x47')]=function(_0x18fcf2,_0xa90d4){var _0xc1bc6={'where':{'id':_0x18fcf2[_0xbe97('0x44')]['id']}},_0x57ae9a={};_0x57ae9a[_0xbe97('0x32')]=_['keys'](db['Attachment'][_0xbe97('0x2b')]);_0xc1bc6[_0xbe97('0x33')]=_[_0xbe97('0x31')](_0x57ae9a[_0xbe97('0x32')],qs[_0xbe97('0x46')](_0x18fcf2['query'][_0xbe97('0x46')]));_0xc1bc6[_0xbe97('0x33')]=_0xc1bc6['attributes'][_0xbe97('0x34')]?_0xc1bc6[_0xbe97('0x33')]:_0x57ae9a[_0xbe97('0x32')];if(_0x18fcf2[_0xbe97('0x2f')]['includeAll']){_0xc1bc6['include']=[{'all':!![]}];}_0xc1bc6=_['merge']({},_0xc1bc6,_0x18fcf2[_0xbe97('0x3e')]);return db[_0xbe97('0x2a')][_0xbe97('0x48')](_0xc1bc6)[_0xbe97('0x22')](handleEntityNotFound(_0xa90d4,null))[_0xbe97('0x22')](function(_0x1519d0){if(_0x1519d0){var _0xd1116c=_0x1519d0['get']({'plain':!![]});_0xd1116c=qs[_0xbe97('0x49')](_0xd1116c,['id','createdAt',_0xbe97('0x4a')]);_0x18fcf2[_0xbe97('0x4b')]=_[_0xbe97('0x49')](_0x18fcf2['body'],['id',_0xbe97('0x4c'),_0xbe97('0x4a')]);return db[_0xbe97('0x2a')]['create'](_[_0xbe97('0x3c')](_0xd1116c,_0x18fcf2['body']),{'include':_0x18fcf2[_0xbe97('0x2f')][_0xbe97('0x3f')]?[{'all':!![]}]:undefined});}})[_0xbe97('0x22')](respondWithResult(_0xa90d4,0xc9))[_0xbe97('0x42')](handleError(_0xa90d4,null));};exports[_0xbe97('0x21')]=function(_0x356836,_0x1f2bfc){if(_0x356836[_0xbe97('0x4b')]['id']){delete _0x356836[_0xbe97('0x4b')]['id'];}return db[_0xbe97('0x2a')][_0xbe97('0x48')]({'where':{'id':_0x356836[_0xbe97('0x44')]['id']}})[_0xbe97('0x22')](handleEntityNotFound(_0x1f2bfc,null))[_0xbe97('0x22')](saveUpdates(_0x356836[_0xbe97('0x4b')],null))['then'](respondWithResult(_0x1f2bfc,null))['catch'](handleError(_0x1f2bfc,null));};exports[_0xbe97('0x23')]=function(_0x56afee,_0x4060a3){return db[_0xbe97('0x2a')][_0xbe97('0x48')]({'where':{'id':_0x56afee[_0xbe97('0x44')]['id']}})[_0xbe97('0x22')](handleEntityNotFound(_0x4060a3,null))[_0xbe97('0x22')](removeEntity(_0x4060a3,null))['catch'](handleError(_0x4060a3,null));};exports[_0xbe97('0x4d')]=function(_0x136390,_0x157b74,_0x36f0ab){_0x136390['body']['name']=_0x136390[_0xbe97('0x4e')][_0xbe97('0x4f')];_0x136390[_0xbe97('0x4b')]['basename']=_0x136390['file'][_0xbe97('0x50')];_0x136390[_0xbe97('0x4b')][_0xbe97('0x2d')]=_0x136390[_0xbe97('0x4e')][_0xbe97('0x51')];return db[_0xbe97('0x2a')][_0xbe97('0x4d')](_0x136390['body'])[_0xbe97('0x22')](respondWithResult(_0x157b74,0xc9))[_0xbe97('0x42')](handleError(_0x157b74,null));};exports[_0xbe97('0x52')]=function(_0x128899,_0xc8bba6,_0x5b66e6){return db[_0xbe97('0x2a')][_0xbe97('0x53')]({'where':{'id':_0x128899[_0xbe97('0x44')]['id']},'raw':!![]})[_0xbe97('0x22')](handleEntityNotFound(_0xc8bba6,null))[_0xbe97('0x22')](function(_0xd6f694){if(_0xd6f694){var _0x1839a9=_0xd6f694[_0xbe97('0x54')]!==null;var _0x30f4d1=path[_0xbe97('0x55')](config['root'],'server/files/attachments/');if(_0x1839a9){_0x30f4d1=path[_0xbe97('0x55')](_0x30f4d1,_0xbe97('0x56'));}var _0x492413=path[_0xbe97('0x55')](_0x30f4d1,_0xd6f694[_0xbe97('0x57')]);return _0xc8bba6['download'](_0x492413);}})[_0xbe97('0x42')](handleError(_0xc8bba6,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index cd57fa2..37d9fd3 100644 --- a/server/api/attachment/attachment.model.js +++ b/server/api/attachment/attachment.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1791=['attachments','lodash','util','api','bluebird','request-promise','rimraf','./attachment.attributes','exports','define','Attachment'];(function(_0x45add7,_0x1e1659){var _0x46d36c=function(_0x51dfa7){while(--_0x51dfa7){_0x45add7['push'](_0x45add7['shift']());}};_0x46d36c(++_0x1e1659);}(_0x1791,0x140));var _0x1179=function(_0x16fb3f,_0x1b2c04){_0x16fb3f=_0x16fb3f-0x0;var _0x25dfb3=_0x1791[_0x16fb3f];return _0x25dfb3;};'use strict';var _=require(_0x1179('0x0'));var util=require(_0x1179('0x1'));var logger=require('../../config/logger')(_0x1179('0x2'));var moment=require('moment');var BPromise=require(_0x1179('0x3'));var rp=require(_0x1179('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1179('0x5'));var config=require('../../config/environment');var attributes=require(_0x1179('0x6'));module[_0x1179('0x7')]=function(_0x8ebcba,_0x422054){return _0x8ebcba[_0x1179('0x8')](_0x1179('0x9'),attributes,{'tableName':_0x1179('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5416=['../../config/logger','bluebird','../../config/environment','exports','attachments','util'];(function(_0x438ff1,_0x1d84fa){var _0x1302fd=function(_0x229c92){while(--_0x229c92){_0x438ff1['push'](_0x438ff1['shift']());}};_0x1302fd(++_0x1d84fa);}(_0x5416,0x95));var _0x6541=function(_0x49782a,_0x2e4976){_0x49782a=_0x49782a-0x0;var _0x500177=_0x5416[_0x49782a];return _0x500177;};'use strict';var _=require('lodash');var util=require(_0x6541('0x0'));var logger=require(_0x6541('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6541('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6541('0x3'));var attributes=require('./attachment.attributes');module[_0x6541('0x4')]=function(_0x87c7d9,_0x348531){return _0x87c7d9['define']('Attachment',attributes,{'tableName':_0x6541('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 1f8b10c..22234bb 100644 --- a/server/api/attachment/attachment.rpc.js +++ b/server/api/attachment/attachment.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1152=['message','result','catch','CreateAttachment','Attachment','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Attachment,\x20%s,\x20%s'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0x1152,0x182));var _0x2115=function(_0x5c080c,_0x31a668){_0x5c080c=_0x5c080c-0x0;var _0x211fd5=_0x1152[_0x5c080c];return _0x211fd5;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var moment=require(_0x2115('0x2'));var BPromise=require(_0x2115('0x3'));var rs=require(_0x2115('0x4'));var fs=require('fs');var Redis=require(_0x2115('0x5'));var db=require(_0x2115('0x6'))['db'];var utils=require(_0x2115('0x7'));var logger=require('../../config/logger')(_0x2115('0x8'));var config=require('../../config/environment');var jayson=require(_0x2115('0x9'));var client=jayson[_0x2115('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x564071,_0x54cdd0,_0x5dbb85){return new BPromise(function(_0x5df6db,_0x158711){return client[_0x2115('0xb')](_0x564071,_0x5dbb85)[_0x2115('0xc')](function(_0x5156f2){logger[_0x2115('0xd')]('Attachment,\x20%s,\x20%s',_0x54cdd0,'request\x20sent');logger[_0x2115('0xe')](_0x2115('0xf'),_0x54cdd0,_0x2115('0x10'),JSON['stringify'](_0x5156f2));if(_0x5156f2[_0x2115('0x11')]){if(_0x5156f2['error'][_0x2115('0x12')]===0x1f4){logger[_0x2115('0x11')](_0x2115('0x13'),_0x54cdd0,_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);return _0x158711(_0x5156f2['error'][_0x2115('0x14')]);}logger['error'](_0x2115('0x13'),_0x54cdd0,_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);return _0x5df6db(_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);}else{logger[_0x2115('0xd')](_0x2115('0x13'),_0x54cdd0,'request\x20sent');_0x5df6db(_0x5156f2[_0x2115('0x15')][_0x2115('0x14')]);}})[_0x2115('0x16')](function(_0x184c05){logger[_0x2115('0x11')](_0x2115('0x13'),_0x54cdd0,_0x184c05);_0x158711(_0x184c05);});});}exports[_0x2115('0x17')]=function(_0x77e2c6){var _0x52b6fe=this;return new Promise(function(_0x154f69,_0x254988){return db[_0x2115('0x18')]['create'](_0x77e2c6[_0x2115('0x19')],{'raw':_0x77e2c6[_0x2115('0x1a')]?_0x77e2c6[_0x2115('0x1a')][_0x2115('0x1b')]===undefined?!![]:![]:!![]})[_0x2115('0xc')](function(_0xcc2d7b){logger[_0x2115('0xd')](_0x2115('0x17'),_0x77e2c6);logger[_0x2115('0xe')](_0x2115('0x17'),_0x77e2c6,JSON[_0x2115('0x1c')](_0xcc2d7b));_0x154f69(_0xcc2d7b);})[_0x2115('0x16')](function(_0x8e37c){logger[_0x2115('0x11')]('CreateAttachment',_0x8e37c[_0x2115('0x14')],_0x77e2c6);_0x254988(_0x52b6fe[_0x2115('0x11')](0x1f4,_0x8e37c[_0x2115('0x14')]));});});}; \ No newline at end of file +var _0x6a24=['create','body','options','raw','then','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6a24,0xd1));var _0x46a2=function(_0x2c9d13,_0x17f33b){_0x2c9d13=_0x2c9d13-0x0;var _0x3c8440=_0x6a24[_0x2c9d13];return _0x3c8440;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var moment=require('moment');var BPromise=require(_0x46a2('0x2'));var rs=require(_0x46a2('0x3'));var fs=require('fs');var Redis=require(_0x46a2('0x4'));var db=require(_0x46a2('0x5'))['db'];var utils=require(_0x46a2('0x6'));var logger=require('../../config/logger')(_0x46a2('0x7'));var config=require(_0x46a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46a2('0x9')][_0x46a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506698,_0x49870f,_0x2092f3){return new BPromise(function(_0x321b88,_0x587092){return client[_0x46a2('0xb')](_0x506698,_0x2092f3)['then'](function(_0x395578){logger['info'](_0x46a2('0xc'),_0x49870f,_0x46a2('0xd'));logger[_0x46a2('0xe')](_0x46a2('0xf'),_0x49870f,_0x46a2('0xd'),JSON[_0x46a2('0x10')](_0x395578));if(_0x395578[_0x46a2('0x11')]){if(_0x395578[_0x46a2('0x11')]['code']===0x1f4){logger['error'](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')]['message']);return _0x587092(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}logger[_0x46a2('0x11')](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);return _0x321b88(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x49870f,_0x46a2('0xd'));_0x321b88(_0x395578[_0x46a2('0x13')]['message']);}})[_0x46a2('0x14')](function(_0x2d755b){logger['error'](_0x46a2('0xc'),_0x49870f,_0x2d755b);_0x587092(_0x2d755b);});});}exports[_0x46a2('0x15')]=function(_0x577f18){var _0x27250b=this;return new Promise(function(_0x24f75f,_0x529bb5){return db[_0x46a2('0x16')][_0x46a2('0x17')](_0x577f18[_0x46a2('0x18')],{'raw':_0x577f18[_0x46a2('0x19')]?_0x577f18[_0x46a2('0x19')][_0x46a2('0x1a')]===undefined?!![]:![]:!![]})[_0x46a2('0x1b')](function(_0x202294){logger[_0x46a2('0x1c')](_0x46a2('0x15'),_0x577f18);logger[_0x46a2('0xe')](_0x46a2('0x15'),_0x577f18,JSON[_0x46a2('0x10')](_0x202294));_0x24f75f(_0x202294);})['catch'](function(_0xa37d90){logger['error'](_0x46a2('0x15'),_0xa37d90[_0x46a2('0x12')],_0x577f18);_0x529bb5(_0x27250b['error'](0x1f4,_0xa37d90[_0x46a2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b80df97..1ea25b9 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x49e4e0,_0x3b2fa1){var _0xa5993f=function(_0xc5eaf8){while(--_0xc5eaf8){_0x49e4e0['push'](_0x49e4e0['shift']());}};_0xa5993f(++_0x3b2fa1);}(_0x2032,0xd9));var _0x2203=function(_0x36d5a9,_0x27a358){_0x36d5a9=_0x36d5a9-0x0;var _0x3ae9cb=_0x2032[_0x36d5a9];return _0x3ae9cb;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5ba401,_0x5aa5da){var _0xd44603=function(_0x240646){while(--_0x240646){_0x5ba401['push'](_0x5ba401['shift']());}};_0xd44603(++_0x5aa5da);}(_0x2032,0xd9));var _0x2203=function(_0x5e9941,_0x1a1457){_0x5e9941=_0x5e9941-0x0;var _0x4fc296=_0x2032[_0x5e9941];return _0x4fc296;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 4095b93..59189f5 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbc5=['minutes','clearBlockUser','getLicense','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','passport','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','online','admin','user','agent','name','domain','disabled','blocked','blockedAt','add'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfbc5,0x98));var _0x5fbc=function(_0x20655e,_0x38dfa2){_0x20655e=_0x20655e-0x0;var _0x55fb26=_0xfbc5[_0x20655e];return _0x55fb26;};'use strict';var passport=require(_0x5fbc('0x0'));var LocalStrategy=require('passport-local')[_0x5fbc('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x5fbc('0x2'));var BPromise=require(_0x5fbc('0x3'));var util=require(_0x5fbc('0x4'));var db=require(_0x5fbc('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x5fbc('0x6'));var config=require(_0x5fbc('0x7'));var logger=require(_0x5fbc('0x8'))(_0x5fbc('0x9'));function isActiveDirectoryConfigured(_0x40ded1){var _0x36d386=![];if(typeof _0x40ded1[_0x5fbc('0xa')]!==_0x5fbc('0xb')){_0x36d386=_0x40ded1[_0x5fbc('0xa')]['baseDN']&&_0x40ded1['activedirectory'][_0x5fbc('0xc')]&&_0x40ded1['activedirectory']['domain'];}return _0x36d386;}function adAuthenticate(_0x24e058,_0x511bae,_0x39d2a4){return new BPromise(function(_0x306ba5,_0x567efc){try{var _0x4cbd2a=new ActiveDirectory(_0x24e058);_0x4cbd2a[_0x5fbc('0xd')](_0x511bae,_0x39d2a4,function(_0x1a1dfd,_0x54aae0){if(_0x1a1dfd){logger[_0x5fbc('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x511bae,util[_0x5fbc('0xf')](_0x1a1dfd,{'showHidden':![],'depth':null}));_0x567efc(_0x5fbc('0x10'));}else if(!_0x54aae0){logger[_0x5fbc('0xe')](_0x5fbc('0x11'),_0x511bae);_0x567efc(_0x5fbc('0x10'));}else{_0x306ba5(_0x54aae0);}});}catch(_0x18c21d){_0x567efc(_0x18c21d);}});}function ActiveDirectoryAuthenticate(_0x20955c,_0x47c308,_0x3b1ab6,_0x9ca50){var _0x381b8c,_0x1f44c6;if(!isActiveDirectoryConfigured(config)){logger[_0x5fbc('0xe')](_0x5fbc('0x12'),_0x47c308);return _0x9ca50(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x5fbc('0x13')][_0x5fbc('0x14')]({'where':{'id':0x1},'attributes':[_0x5fbc('0x15'),_0x5fbc('0x16')],'raw':!![]})[_0x5fbc('0x17')](function(_0xe8354b){_0x381b8c=_0xe8354b;if(!_0x381b8c[_0x5fbc('0x15')]){logger['error'](_0x5fbc('0x18'),_0x47c308);throw new Error(_0x5fbc('0x10'));}return _0x20955c[_0x5fbc('0x14')]({'logging':!![],'attributes':['id','name',_0x5fbc('0x19'),'salt','role','disabled','blocked','blockedAt',_0x5fbc('0x1a')],'where':{'name':_0x47c308,'role':{'$or':[_0x5fbc('0x1b'),_0x5fbc('0x1c'),_0x5fbc('0x1d')]},'adSsoEnabled':!![]}});})['then'](function(_0x4bdb64){if(!_0x4bdb64||_0x4bdb64&&_0x4bdb64[_0x5fbc('0x1e')]!==_0x47c308){throw new Error(_0x5fbc('0x10'));}_0x1f44c6=_0x4bdb64;var _0xbc984a=_0x1f44c6[_0x5fbc('0x1e')]+'@'+config[_0x5fbc('0xa')][_0x5fbc('0x1f')];return adAuthenticate(config[_0x5fbc('0xa')],_0xbc984a,_0x3b1ab6);})[_0x5fbc('0x17')](function(_0x409d25){if(_0x1f44c6[_0x5fbc('0x20')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x381b8c[_0x5fbc('0x16')]>0x0){if(_0x1f44c6[_0x5fbc('0x21')]){if(moment(_0x1f44c6[_0x5fbc('0x22')])[_0x5fbc('0x23')](_0x381b8c[_0x5fbc('0x16')],_0x5fbc('0x24'))>moment()){throw new Error(_0x5fbc('0x10'));}return utils[_0x5fbc('0x25')](_0x1f44c6,0x0,![],null)[_0x5fbc('0x17')](function(){return utils[_0x5fbc('0x26')](_0x1f44c6);})[_0x5fbc('0x17')](function(){return _0x9ca50(null,_0x1f44c6);});}else{return utils[_0x5fbc('0x26')](_0x1f44c6)[_0x5fbc('0x17')](function(){return _0x9ca50(null,_0x1f44c6);});}}else{return utils[_0x5fbc('0x26')](_0x1f44c6)[_0x5fbc('0x17')](function(){return _0x9ca50(null,_0x1f44c6);});}})['catch'](function(_0x31b961){return _0x9ca50(null,![],_0x31b961);});}function handleError(_0x53d1a7,_0x45ddec,_0x550124){return _0x53d1a7[_0x5fbc('0x27')](_0x45ddec||0x1f4)[_0x5fbc('0x28')]({'message':_0x550124?_0x550124['message']||_0x550124:''});}exports[_0x5fbc('0x29')]=function(_0x57af1a,_0x243a69,_0x3d66b4){passport[_0x5fbc('0xd')]('ad-login',function(_0x3258d8,_0xe7ca28,_0x26a762){var _0x30a654=_0x3258d8||_0x26a762;if(_0x30a654){return handleError(_0x243a69,0x191,_0x30a654);}if(!_0xe7ca28){return handleError(_0x243a69,0x194,{'message':_0x5fbc('0x2a')});}else{var _0x21908a={'payload':{'id':_0xe7ca28['id'],'role':_0xe7ca28[_0x5fbc('0x2b')]},'options':{'expiresIn':0x15180}};return authService[_0x5fbc('0x2c')](_0x21908a)[_0x5fbc('0x17')](function(_0x425ac3){_0x243a69[_0x5fbc('0x2d')]({'id':_0xe7ca28['id'],'token':_0x425ac3,'statusCall':'','isAlreadyLogged':_0xe7ca28['online']});});}})(_0x57af1a,_0x243a69,_0x3d66b4);};passport[_0x5fbc('0x2e')]('ad-login',new LocalStrategy({'usernameField':_0x5fbc('0x1e'),'passwordField':_0x5fbc('0x19')},function(_0xf620fc,_0x2e83a3,_0x1a1ea0){return ActiveDirectoryAuthenticate(db['User'],_0xf620fc,_0x2e83a3,_0x1a1ea0);})); \ No newline at end of file +var _0xce62=['json','use','User','passport','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','role','disabled','blockedAt','online','user','agent','then','name','blocked','minutes','clearBlockUser','getLicense','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0xce62,0xfd));var _0x2ce6=function(_0x1ddbd0,_0x1347ec){_0x1ddbd0=_0x1ddbd0-0x0;var _0x5a65a6=_0xce62[_0x1ddbd0];return _0x5a65a6;};'use strict';var passport=require(_0x2ce6('0x0'));var LocalStrategy=require(_0x2ce6('0x1'))[_0x2ce6('0x2')];var moment=require(_0x2ce6('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x2ce6('0x4'));var util=require(_0x2ce6('0x5'));var db=require(_0x2ce6('0x6'))['db'];var authService=require(_0x2ce6('0x7'));var utils=require(_0x2ce6('0x8'));var config=require(_0x2ce6('0x9'));var logger=require('../../config/logger')(_0x2ce6('0xa'));function isActiveDirectoryConfigured(_0x491f8b){var _0x3ea33b=![];if(typeof _0x491f8b[_0x2ce6('0xb')]!==_0x2ce6('0xc')){_0x3ea33b=_0x491f8b[_0x2ce6('0xb')][_0x2ce6('0xd')]&&_0x491f8b[_0x2ce6('0xb')][_0x2ce6('0xe')]&&_0x491f8b[_0x2ce6('0xb')]['domain'];}return _0x3ea33b;}function adAuthenticate(_0x3e779d,_0x121093,_0x5ac6b3){return new BPromise(function(_0x5351dc,_0x122b49){try{var _0x762cc2=new ActiveDirectory(_0x3e779d);_0x762cc2[_0x2ce6('0xf')](_0x121093,_0x5ac6b3,function(_0x422a78,_0x26d518){if(_0x422a78){logger[_0x2ce6('0x10')](_0x2ce6('0x11'),_0x121093,util[_0x2ce6('0x12')](_0x422a78,{'showHidden':![],'depth':null}));_0x122b49(_0x2ce6('0x13'));}else if(!_0x26d518){logger[_0x2ce6('0x10')](_0x2ce6('0x14'),_0x121093);_0x122b49('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5351dc(_0x26d518);}});}catch(_0x3ba157){_0x122b49(_0x3ba157);}});}function ActiveDirectoryAuthenticate(_0x8c34d1,_0x51a5ad,_0x3e0fb0,_0x57be29){var _0x5d8788,_0x38d35c;if(!isActiveDirectoryConfigured(config)){logger[_0x2ce6('0x10')](_0x2ce6('0x15'),_0x51a5ad);return _0x57be29(null,![],{'message':_0x2ce6('0x13')});}return db[_0x2ce6('0x16')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x2ce6('0x17')],'raw':!![]})['then'](function(_0x5dc719){_0x5d8788=_0x5dc719;if(!_0x5d8788[_0x2ce6('0x18')]){logger['error'](_0x2ce6('0x19'),_0x51a5ad);throw new Error(_0x2ce6('0x13'));}return _0x8c34d1[_0x2ce6('0x1a')]({'logging':!![],'attributes':['id','name',_0x2ce6('0x1b'),_0x2ce6('0x1c'),_0x2ce6('0x1d'),_0x2ce6('0x1e'),'blocked',_0x2ce6('0x1f'),_0x2ce6('0x20')],'where':{'name':_0x51a5ad,'role':{'$or':['admin',_0x2ce6('0x21'),_0x2ce6('0x22')]},'adSsoEnabled':!![]}});})[_0x2ce6('0x23')](function(_0x217b7d){if(!_0x217b7d||_0x217b7d&&_0x217b7d[_0x2ce6('0x24')]!==_0x51a5ad){throw new Error(_0x2ce6('0x13'));}_0x38d35c=_0x217b7d;var _0x2e91f0=_0x38d35c[_0x2ce6('0x24')]+'@'+config[_0x2ce6('0xb')]['domain'];return adAuthenticate(config['activedirectory'],_0x2e91f0,_0x3e0fb0);})[_0x2ce6('0x23')](function(_0x48f81e){if(_0x38d35c['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x5d8788['blockDuration']>0x0){if(_0x38d35c[_0x2ce6('0x25')]){if(moment(_0x38d35c['blockedAt'])['add'](_0x5d8788[_0x2ce6('0x17')],_0x2ce6('0x26'))>moment()){throw new Error(_0x2ce6('0x13'));}return utils[_0x2ce6('0x27')](_0x38d35c,0x0,![],null)['then'](function(){return utils[_0x2ce6('0x28')](_0x38d35c);})[_0x2ce6('0x23')](function(){return _0x57be29(null,_0x38d35c);});}else{return utils['getLicense'](_0x38d35c)[_0x2ce6('0x23')](function(){return _0x57be29(null,_0x38d35c);});}}else{return utils[_0x2ce6('0x28')](_0x38d35c)[_0x2ce6('0x23')](function(){return _0x57be29(null,_0x38d35c);});}})['catch'](function(_0xd42580){return _0x57be29(null,![],_0xd42580);});}function handleError(_0x3ee73e,_0x41a29d,_0x5474fb){return _0x3ee73e[_0x2ce6('0x29')](_0x41a29d||0x1f4)[_0x2ce6('0x2a')]({'message':_0x5474fb?_0x5474fb[_0x2ce6('0x2b')]||_0x5474fb:''});}exports['login']=function(_0x1dc0ee,_0x50426d,_0x58b4eb){passport[_0x2ce6('0xf')](_0x2ce6('0x2c'),function(_0x360e73,_0x394f84,_0x3d25f8){var _0x1ec411=_0x360e73||_0x3d25f8;if(_0x1ec411){return handleError(_0x50426d,0x191,_0x1ec411);}if(!_0x394f84){return handleError(_0x50426d,0x194,{'message':_0x2ce6('0x2d')});}else{var _0x3e9f40={'payload':{'id':_0x394f84['id'],'role':_0x394f84[_0x2ce6('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x2ce6('0x2e')](_0x3e9f40)[_0x2ce6('0x23')](function(_0x5a3a1c){_0x50426d[_0x2ce6('0x2f')]({'id':_0x394f84['id'],'token':_0x5a3a1c,'statusCall':'','isAlreadyLogged':_0x394f84[_0x2ce6('0x20')]});});}})(_0x1dc0ee,_0x50426d,_0x58b4eb);};passport[_0x2ce6('0x30')](_0x2ce6('0x2c'),new LocalStrategy({'usernameField':_0x2ce6('0x24'),'passwordField':'password'},function(_0x5f40d5,_0x255d54,_0x4958e2){return ActiveDirectoryAuthenticate(db[_0x2ce6('0x31')],_0x5f40d5,_0x255d54,_0x4958e2);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 5809cf9..01d52d4 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50ca=['express','Router','./authActiveDirectory.controller','login'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0x50ca,0x134));var _0xa50c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50ca[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xa50c('0x0'));var router=express[_0xa50c('0x1')]();var controller=require(_0xa50c('0x2'));router['post']('/',controller[_0xa50c('0x3')]);module['exports']=router; \ No newline at end of file +var _0x2aaf=['exports','express','Router','./authActiveDirectory.controller','post','login'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x2aaf,0xfd));var _0xf2aa=function(_0x36b3f3,_0x2831fc){_0x36b3f3=_0x36b3f3-0x0;var _0x1530cb=_0x2aaf[_0x36b3f3];return _0x1530cb;};'use strict';var express=require(_0xf2aa('0x0'));var router=express[_0xf2aa('0x1')]();var controller=require(_0xf2aa('0x2'));router[_0xf2aa('0x3')]('/',controller[_0xf2aa('0x4')]);module[_0xf2aa('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 457d601..1557604 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x1b6b03,_0x5d3d8e){_0x1b6b03=_0x1b6b03-0x0;var _0x1f7ce2=_0x7a54[_0x1b6b03];return _0x1f7ce2;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7a54,0x106));var _0x47a5=function(_0x40e7d8,_0xc97e0e){_0x40e7d8=_0x40e7d8-0x0;var _0x4cbf25=_0x7a54[_0x40e7d8];return _0x4cbf25;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 62cc976..c993094 100644 --- a/server/api/authGoogle/index.js +++ b/server/api/authGoogle/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1e2=['setTokenCookie','exports','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd1e2,0x7b));var _0x2d1e=function(_0xf1b4f,_0x6dc6dc){_0xf1b4f=_0xf1b4f-0x0;var _0x10e891=_0xd1e2[_0xf1b4f];return _0x10e891;};'use strict';var express=require(_0x2d1e('0x0'));var passport=require('passport');var router=express[_0x2d1e('0x1')]();var controller=require(_0x2d1e('0x2'));var userController=require(_0x2d1e('0x3'));var authService=require(_0x2d1e('0x4'));router[_0x2d1e('0x5')]('/',controller[_0x2d1e('0x6')]);router['get']('/callback',controller[_0x2d1e('0x7')],authService[_0x2d1e('0x8')],userController[_0x2d1e('0x6')],authService[_0x2d1e('0x9')]);module[_0x2d1e('0xa')]=router; \ No newline at end of file +var _0xe3e0=['get','login','/callback','callback','isMiddleware','setTokenCookie','exports','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x547f4d,_0x2dec84){var _0x347db6=function(_0x3fb318){while(--_0x3fb318){_0x547f4d['push'](_0x547f4d['shift']());}};_0x347db6(++_0x2dec84);}(_0xe3e0,0x188));var _0x0e3e=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0xe3e0[_0x35af23];return _0x340506;};'use strict';var express=require('express');var passport=require(_0x0e3e('0x0'));var router=express[_0x0e3e('0x1')]();var controller=require(_0x0e3e('0x2'));var userController=require(_0x0e3e('0x3'));var authService=require('../../components/auth/service');router[_0x0e3e('0x4')]('/',controller[_0x0e3e('0x5')]);router[_0x0e3e('0x4')](_0x0e3e('0x6'),controller[_0x0e3e('0x7')],authService[_0x0e3e('0x8')],userController['login'],authService[_0x0e3e('0x9')]);module[_0x0e3e('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 7a199b6..a2e0b19 100644 --- a/server/api/authLocal/authLocal.controller.js +++ b/server/api/authLocal/authLocal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2e7=['signToken','online','forgot','generate','body','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','find','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','salt','role','blockedAt','loginAttempts','authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','blocked','add','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x2bf14b,_0x409fc8){var _0x32f2d4=function(_0x1f5602){while(--_0x1f5602){_0x2bf14b['push'](_0x2bf14b['shift']());}};_0x32f2d4(++_0x409fc8);}(_0xf2e7,0x1aa));var _0x7f2e=function(_0x1b8690,_0x3a0835){_0x1b8690=_0x1b8690-0x0;var _0x5b7901=_0xf2e7[_0x1b8690];return _0x5b7901;};'use strict';var util=require(_0x7f2e('0x0'));var passport=require(_0x7f2e('0x1'));var LocalStrategy=require(_0x7f2e('0x2'))[_0x7f2e('0x3')];var jayson=require(_0x7f2e('0x4'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x7f2e('0x5'));var db=require(_0x7f2e('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x7f2e('0x7'));var client=jayson[_0x7f2e('0x8')][_0x7f2e('0x9')]({'port':0x232b});function localAuthenticate(_0x5cffd8,_0xe2d235,_0x3b0839,_0x9e97c0){var _0x353a26,_0x593f78;return db[_0x7f2e('0xa')][_0x7f2e('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x7f2e('0xc')],'raw':!![]})[_0x7f2e('0xd')](function(_0xe0fdae){_0x353a26=_0xe0fdae;return _0x5cffd8[_0x7f2e('0xb')]({'attributes':['id',_0x7f2e('0xe'),_0x7f2e('0xf'),_0x7f2e('0x10'),_0x7f2e('0x11'),'disabled','blocked',_0x7f2e('0x12'),_0x7f2e('0x13')],'where':{'name':_0xe2d235,'role':{'$or':['admin','user','agent']}}});})['then'](function(_0x4f2d59){if(!_0x4f2d59||_0x4f2d59&&_0x4f2d59[_0x7f2e('0xe')]!==_0xe2d235){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x593f78=_0x4f2d59;return _0x593f78;}})['then'](function(){_0x593f78[_0x7f2e('0x14')](_0x3b0839,function(_0x51bc53,_0x258844){var _0x3b527d=_0x593f78[_0x7f2e('0x13')]+0x1;if(_0x51bc53){return _0x9e97c0(_0x51bc53);}else if(!_0x258844){if(_0x593f78[_0x7f2e('0x15')]){return _0x9e97c0(null,![],{'message':_0x7f2e('0x16')});}else if(_0x353a26[_0x7f2e('0x17')]>0x0){if(_0x593f78[_0x7f2e('0x18')]){if(_0x353a26[_0x7f2e('0xc')]>0x0){if(moment(_0x593f78[_0x7f2e('0x12')])[_0x7f2e('0x19')](_0x353a26['blockDuration'],'minutes')>moment()){return _0x9e97c0(null,![],{'message':_0x7f2e('0x16')});}else{return utils[_0x7f2e('0x1a')](_0x593f78,_0x3b527d,![],null)[_0x7f2e('0xd')](function(){return _0x9e97c0(null,![],{'message':_0x7f2e('0x16')});});}}else{return _0x9e97c0(null,![],{'message':_0x7f2e('0x16')});}}else{if(_0x3b527d>=_0x353a26['allowedLoginAttempts']){return utils[_0x7f2e('0x1a')](_0x593f78,0x0,!![],moment())[_0x7f2e('0xd')](function(){return _0x9e97c0(null,![],{'message':_0x7f2e('0x16')});});}else{return utils[_0x7f2e('0x1a')](_0x593f78,_0x3b527d,![],null)['then'](function(){return _0x9e97c0(null,![],{'message':_0x7f2e('0x16')});});}}}else{return _0x9e97c0(null,![],{'message':_0x7f2e('0x16')});}}else{if(_0x593f78['disabled']){return _0x9e97c0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x353a26[_0x7f2e('0x17')]>0x0){if(_0x593f78[_0x7f2e('0x18')]){if(_0x353a26[_0x7f2e('0xc')]>0x0){if(moment(_0x593f78[_0x7f2e('0x12')])['add'](_0x353a26['blockDuration'],'minutes')>moment()){return _0x9e97c0(null,![],{'message':_0x7f2e('0x16')});}else{return utils[_0x7f2e('0x1a')](_0x593f78,0x0,![],null)['then'](function(){return utils[_0x7f2e('0x1b')](_0x593f78);})[_0x7f2e('0xd')](function(){return _0x9e97c0(null,_0x593f78);});}}else{return _0x9e97c0(null,![],{'message':_0x7f2e('0x16')});}}else{return utils[_0x7f2e('0x1a')](_0x593f78,0x0,![],null)[_0x7f2e('0xd')](function(){return utils[_0x7f2e('0x1b')](_0x593f78);})[_0x7f2e('0xd')](function(){return _0x9e97c0(null,_0x593f78);})['catch'](function(_0x5a5a88){return _0x9e97c0(null,![],_0x5a5a88);});}}else{if(_0x593f78[_0x7f2e('0x18')]){return _0x9e97c0(null,![],{'message':_0x7f2e('0x16')});}else{return utils[_0x7f2e('0x1b')](_0x593f78)[_0x7f2e('0xd')](function(){return _0x9e97c0(null,_0x593f78);});}}}});})[_0x7f2e('0x1c')](function(_0x27446b){return _0x9e97c0(null,![],_0x27446b);});}function sendServiceMail(_0x48788b){return db[_0x7f2e('0x1d')]['find']({'where':{'service':!![]},'attributes':['id',_0x7f2e('0xe'),_0x7f2e('0x1e')],'include':[{'model':db[_0x7f2e('0x1f')],'as':_0x7f2e('0x20'),'include':[{'model':db[_0x7f2e('0x21')],'as':_0x7f2e('0x21')}]}]})[_0x7f2e('0xd')](function(_0x518989){if(!_0x518989){throw new Error(_0x7f2e('0x22'));}var _0x3eca6c=_0x518989[_0x7f2e('0x23')]();var _0x3167d1={'account':_0x3eca6c,'message':_[_0x7f2e('0x24')]({'from':util[_0x7f2e('0x25')](_0x7f2e('0x26'),_0x518989['name'],_0x518989[_0x7f2e('0x1e')]||_0x518989[_0x7f2e('0x20')][_0x7f2e('0x27')])},_0x48788b)};return client[_0x7f2e('0x28')](_0x7f2e('0x29'),_0x3167d1);})['then'](function(_0x4eb9e8){if(_0x4eb9e8[_0x7f2e('0x2a')]){throw new Error(util[_0x7f2e('0x25')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x4eb9e8['error']['message']||JSON['stringify'](_0x4eb9e8[_0x7f2e('0x2a')])));}return!![];});}function handleError(_0x85e99a,_0xee1287,_0x4e9d68){return _0x85e99a[_0x7f2e('0x2b')](_0xee1287||0x1f4)[_0x7f2e('0x2c')]({'message':_0x4e9d68?_0x4e9d68['message']||_0x4e9d68:''});}exports[_0x7f2e('0x2d')]=function(_0x50d540,_0x427af2,_0xa23b06){passport[_0x7f2e('0x14')](_0x7f2e('0x2e'),function(_0xe09c93,_0x1d3e63,_0x263a65){var _0x4c14e7=_0xe09c93||_0x263a65;if(_0x4c14e7){return handleError(_0x427af2,0x191,_0x4c14e7);}if(!_0x1d3e63){return handleError(_0x427af2,0x194,{'message':_0x7f2e('0x2f')});}else{var _0x467ff2={'payload':{'id':_0x1d3e63['id'],'role':_0x1d3e63[_0x7f2e('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x7f2e('0x30')](_0x467ff2)[_0x7f2e('0xd')](function(_0xacdcc9){_0x427af2['json']({'id':_0x1d3e63['id'],'token':_0xacdcc9,'statusCall':'','isAlreadyLogged':_0x1d3e63[_0x7f2e('0x31')]});});}})(_0x50d540,_0x427af2,_0xa23b06);};exports[_0x7f2e('0x32')]=function(_0x4d5046,_0xce14c5){if(!_0x4d5046['body'][_0x7f2e('0x1e')]){return handleError(_0xce14c5,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x4de65c=rs[_0x7f2e('0x33')]();_0x4d5046[_0x7f2e('0x34')][_0x7f2e('0x1e')]=_0x4d5046['body'][_0x7f2e('0x1e')]['trim']()['toLowerCase']();var _0x2a10f8;return db[_0x7f2e('0xa')][_0x7f2e('0xb')]({'where':{'id':0x1},'attributes':[_0x7f2e('0x17'),_0x7f2e('0xc')],'raw':!![]})[_0x7f2e('0xd')](function(_0x175da2){_0x2a10f8=_0x175da2;return db[_0x7f2e('0x35')]['find']({'where':{'email':_0x4d5046[_0x7f2e('0x34')]['email']}});})['then'](function(_0x774c88){if(!_0x774c88){throw new Error(_0x7f2e('0x36'));}if(_0x774c88[_0x7f2e('0x15')]){throw new Error(_0x7f2e('0x37'));}if(_0x774c88['blocked']){if(moment(_0x774c88[_0x7f2e('0x12')])[_0x7f2e('0x19')](_0x2a10f8[_0x7f2e('0xc')],'minutes')>moment()){throw new Error(_0x7f2e('0x38'));}else{_0x774c88[_0x7f2e('0x18')]=![];_0x774c88[_0x7f2e('0x12')]=null;}}_0x774c88['resetPasswordToken']=_0x4de65c;_0x774c88[_0x7f2e('0x39')]=Date['now']()+0x36ee80;return _0x774c88[_0x7f2e('0x3a')]();})[_0x7f2e('0xd')](function(){return sendServiceMail({'to':_0x4d5046['body'][_0x7f2e('0x1e')],'subject':_0x7f2e('0x3b'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7f2e('0x3c')+'https://'+_0x4d5046['headers'][_0x7f2e('0x3d')]+_0x7f2e('0x3e')+_0x4de65c+'\x0a\x0a'+_0x7f2e('0x3f')});})['then'](function(){_0xce14c5[_0x7f2e('0x2b')](0xc8)[_0x7f2e('0x2c')]({'message':_0x7f2e('0x40')});})[_0x7f2e('0x1c')](function(_0x74f79){return handleError(_0xce14c5,0x1f4,_0x74f79);});};exports[_0x7f2e('0x41')]=function(_0xac726a,_0x474d6e){return db['User'][_0x7f2e('0x42')]({'where':{'resetPasswordToken':_0xac726a[_0x7f2e('0x43')]['token'],'resetPasswordExpires':{'$gt':Date[_0x7f2e('0x44')]()}}})[_0x7f2e('0xd')](function(_0x54118f){if(!_0x54118f){throw new Error(_0x7f2e('0x45'));}return db[_0x7f2e('0xa')][_0x7f2e('0xb')]({'attributes':['id',_0x7f2e('0x46'),_0x7f2e('0x47'),_0x7f2e('0x48')]})[_0x7f2e('0xd')](function(_0x141c18){if(_0x141c18[_0x7f2e('0x46')])authService[_0x7f2e('0x49')](_0xac726a['body']['password']);if(!_0x141c18[_0x7f2e('0x47')]||!_0x54118f[_0x7f2e('0x4a')])return _0x54118f;authService[_0x7f2e('0x4b')](_0xac726a[_0x7f2e('0x34')][_0x7f2e('0xf')],_0x54118f['previousPasswords'],_0x141c18['passwordHistoryLimit']);return _0x54118f;})[_0x7f2e('0xd')](function(){_0x54118f['password']=_0xac726a[_0x7f2e('0x34')][_0x7f2e('0xf')];_0x54118f[_0x7f2e('0x4c')]=null;_0x54118f[_0x7f2e('0x39')]=null;return _0x54118f[_0x7f2e('0x3a')]();});})[_0x7f2e('0xd')](function(){_0x474d6e[_0x7f2e('0x2b')](0xc8)[_0x7f2e('0x2c')]({'message':_0x7f2e('0x4d')});})[_0x7f2e('0x1c')](function(_0x1c8a73){return handleError(_0x474d6e,0x1f4,_0x1c8a73);});};passport[_0x7f2e('0x4e')](_0x7f2e('0x2e'),new LocalStrategy({'usernameField':_0x7f2e('0xe'),'passwordField':'password'},function(_0x250f86,_0xe2fa74,_0xb0dec0){return localAuthenticate(db[_0x7f2e('0x35')],_0x250f86,_0xe2fa74,_0xb0dec0);})); \ No newline at end of file +var _0x8d41=['blockedAt','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','name','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','host','/reset/','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','local-login','util','passport','passport-local','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','findOne','allowedLoginAttempts','then','password','salt','role','blocked'];(function(_0x32c6f0,_0x97ee17){var _0x552f64=function(_0xd3c087){while(--_0xd3c087){_0x32c6f0['push'](_0x32c6f0['shift']());}};_0x552f64(++_0x97ee17);}(_0x8d41,0x18a));var _0x18d4=function(_0xe3d4a2,_0x5dbf95){_0xe3d4a2=_0xe3d4a2-0x0;var _0x131efb=_0x8d41[_0xe3d4a2];return _0x131efb;};'use strict';var util=require(_0x18d4('0x0'));var passport=require(_0x18d4('0x1'));var LocalStrategy=require(_0x18d4('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x18d4('0x3'));var rs=require(_0x18d4('0x4'));var moment=require(_0x18d4('0x5'));var db=require(_0x18d4('0x6'))['db'];var authService=require(_0x18d4('0x7'));var utils=require(_0x18d4('0x8'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x49cb01,_0x1af00f,_0x54c8b2,_0xf6af6a){var _0x3fa2c0,_0x297c84;return db['Setting'][_0x18d4('0x9')]({'where':{'id':0x1},'attributes':[_0x18d4('0xa'),'blockDuration'],'raw':!![]})[_0x18d4('0xb')](function(_0x156221){_0x3fa2c0=_0x156221;return _0x49cb01['findOne']({'attributes':['id','name',_0x18d4('0xc'),_0x18d4('0xd'),_0x18d4('0xe'),'disabled',_0x18d4('0xf'),_0x18d4('0x10'),'loginAttempts'],'where':{'name':_0x1af00f,'role':{'$or':['admin',_0x18d4('0x11'),_0x18d4('0x12')]}}});})[_0x18d4('0xb')](function(_0xb2de7a){if(!_0xb2de7a||_0xb2de7a&&_0xb2de7a['name']!==_0x1af00f){throw new Error(_0x18d4('0x13'));}else{_0x297c84=_0xb2de7a;return _0x297c84;}})[_0x18d4('0xb')](function(){_0x297c84[_0x18d4('0x14')](_0x54c8b2,function(_0x27238e,_0x46642f){var _0x463fb6=_0x297c84['loginAttempts']+0x1;if(_0x27238e){return _0xf6af6a(_0x27238e);}else if(!_0x46642f){if(_0x297c84[_0x18d4('0x15')]){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}else if(_0x3fa2c0['allowedLoginAttempts']>0x0){if(_0x297c84['blocked']){if(_0x3fa2c0[_0x18d4('0x16')]>0x0){if(moment(_0x297c84[_0x18d4('0x10')])['add'](_0x3fa2c0[_0x18d4('0x16')],_0x18d4('0x17'))>moment()){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}else{return utils['clearBlockUser'](_0x297c84,_0x463fb6,![],null)[_0x18d4('0xb')](function(){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});});}}else{return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}}else{if(_0x463fb6>=_0x3fa2c0[_0x18d4('0xa')]){return utils[_0x18d4('0x18')](_0x297c84,0x0,!![],moment())[_0x18d4('0xb')](function(){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});});}else{return utils[_0x18d4('0x18')](_0x297c84,_0x463fb6,![],null)[_0x18d4('0xb')](function(){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});});}}}else{return _0xf6af6a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x297c84['disabled']){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}else if(_0x3fa2c0[_0x18d4('0xa')]>0x0){if(_0x297c84['blocked']){if(_0x3fa2c0['blockDuration']>0x0){if(moment(_0x297c84[_0x18d4('0x10')])[_0x18d4('0x19')](_0x3fa2c0['blockDuration'],_0x18d4('0x17'))>moment()){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}else{return utils[_0x18d4('0x18')](_0x297c84,0x0,![],null)[_0x18d4('0xb')](function(){return utils[_0x18d4('0x1a')](_0x297c84);})[_0x18d4('0xb')](function(){return _0xf6af6a(null,_0x297c84);});}}else{return _0xf6af6a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x18d4('0x18')](_0x297c84,0x0,![],null)[_0x18d4('0xb')](function(){return utils[_0x18d4('0x1a')](_0x297c84);})['then'](function(){return _0xf6af6a(null,_0x297c84);})[_0x18d4('0x1b')](function(_0x151748){return _0xf6af6a(null,![],_0x151748);});}}else{if(_0x297c84['blocked']){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}else{return utils[_0x18d4('0x1a')](_0x297c84)['then'](function(){return _0xf6af6a(null,_0x297c84);});}}}});})['catch'](function(_0x898b99){return _0xf6af6a(null,![],_0x898b99);});}function sendServiceMail(_0x2d2219){return db[_0x18d4('0x1c')][_0x18d4('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x18d4('0x1e'),_0x18d4('0x1f')],'include':[{'model':db[_0x18d4('0x20')],'as':_0x18d4('0x21'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x942956){if(!_0x942956){throw new Error(_0x18d4('0x22'));}var _0x4afed3=_0x942956[_0x18d4('0x23')]();var _0x512a7c={'account':_0x4afed3,'message':_[_0x18d4('0x24')]({'from':util[_0x18d4('0x25')](_0x18d4('0x26'),_0x942956[_0x18d4('0x1e')],_0x942956[_0x18d4('0x1f')]||_0x942956[_0x18d4('0x21')][_0x18d4('0x11')])},_0x2d2219)};return client[_0x18d4('0x27')](_0x18d4('0x28'),_0x512a7c);})['then'](function(_0x183f9d){if(_0x183f9d[_0x18d4('0x29')]){throw new Error(util[_0x18d4('0x25')](_0x18d4('0x2a'),_0x183f9d[_0x18d4('0x29')][_0x18d4('0x2b')]||JSON[_0x18d4('0x2c')](_0x183f9d['error'])));}return!![];});}function handleError(_0xbfa8cc,_0x1601bf,_0x660c0a){return _0xbfa8cc[_0x18d4('0x2d')](_0x1601bf||0x1f4)[_0x18d4('0x2e')]({'message':_0x660c0a?_0x660c0a[_0x18d4('0x2b')]||_0x660c0a:''});}exports[_0x18d4('0x2f')]=function(_0x468d1c,_0x178573,_0x54fa35){passport[_0x18d4('0x14')]('local-login',function(_0x144eae,_0x259f65,_0x31e972){var _0xc89d7c=_0x144eae||_0x31e972;if(_0xc89d7c){return handleError(_0x178573,0x191,_0xc89d7c);}if(!_0x259f65){return handleError(_0x178573,0x194,{'message':_0x18d4('0x30')});}else{var _0x2c4ced={'payload':{'id':_0x259f65['id'],'role':_0x259f65['role']},'options':{'expiresIn':0x15180}};return authService[_0x18d4('0x31')](_0x2c4ced)[_0x18d4('0xb')](function(_0x18e8a3){_0x178573[_0x18d4('0x32')]({'id':_0x259f65['id'],'token':_0x18e8a3,'statusCall':'','isAlreadyLogged':_0x259f65['online']});});}})(_0x468d1c,_0x178573,_0x54fa35);};exports[_0x18d4('0x33')]=function(_0x80ef6c,_0x5c2932){if(!_0x80ef6c['body']['email']){return handleError(_0x5c2932,0x1f4,{'message':_0x18d4('0x34')});}var _0x345906=rs[_0x18d4('0x35')]();_0x80ef6c[_0x18d4('0x36')][_0x18d4('0x1f')]=_0x80ef6c[_0x18d4('0x36')][_0x18d4('0x1f')][_0x18d4('0x37')]()[_0x18d4('0x38')]();var _0x44e231;return db[_0x18d4('0x39')][_0x18d4('0x9')]({'where':{'id':0x1},'attributes':[_0x18d4('0xa'),_0x18d4('0x16')],'raw':!![]})['then'](function(_0x4d5110){_0x44e231=_0x4d5110;return db[_0x18d4('0x3a')][_0x18d4('0x1d')]({'where':{'email':_0x80ef6c[_0x18d4('0x36')][_0x18d4('0x1f')]}});})[_0x18d4('0xb')](function(_0x550ba7){if(!_0x550ba7){throw new Error(_0x18d4('0x3b'));}if(_0x550ba7[_0x18d4('0x15')]){throw new Error(_0x18d4('0x3c'));}if(_0x550ba7['blocked']){if(moment(_0x550ba7[_0x18d4('0x10')])[_0x18d4('0x19')](_0x44e231[_0x18d4('0x16')],_0x18d4('0x17'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x550ba7[_0x18d4('0xf')]=![];_0x550ba7[_0x18d4('0x10')]=null;}}_0x550ba7[_0x18d4('0x3d')]=_0x345906;_0x550ba7[_0x18d4('0x3e')]=Date[_0x18d4('0x3f')]()+0x36ee80;return _0x550ba7['save']();})[_0x18d4('0xb')](function(){return sendServiceMail({'to':_0x80ef6c['body'][_0x18d4('0x1f')],'subject':_0x18d4('0x40'),'text':_0x18d4('0x41')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x80ef6c[_0x18d4('0x42')][_0x18d4('0x43')]+_0x18d4('0x44')+_0x345906+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x5c2932[_0x18d4('0x2d')](0xc8)['send']({'message':_0x18d4('0x45')});})['catch'](function(_0x5352c8){return handleError(_0x5c2932,0x1f4,_0x5352c8);});};exports[_0x18d4('0x46')]=function(_0x22d594,_0x1691aa){return db[_0x18d4('0x3a')][_0x18d4('0x1d')]({'where':{'resetPasswordToken':_0x22d594['params'][_0x18d4('0x47')],'resetPasswordExpires':{'$gt':Date[_0x18d4('0x3f')]()}}})[_0x18d4('0xb')](function(_0x2ff07f){if(!_0x2ff07f){throw new Error(_0x18d4('0x48'));}return db['Setting']['findOne']({'attributes':['id',_0x18d4('0x49'),_0x18d4('0x4a'),_0x18d4('0x4b')]})[_0x18d4('0xb')](function(_0x10c014){if(_0x10c014[_0x18d4('0x49')])authService[_0x18d4('0x4c')](_0x22d594[_0x18d4('0x36')][_0x18d4('0xc')]);if(!_0x10c014[_0x18d4('0x4a')]||!_0x2ff07f[_0x18d4('0x4d')])return _0x2ff07f;authService[_0x18d4('0x4e')](_0x22d594['body'][_0x18d4('0xc')],_0x2ff07f[_0x18d4('0x4d')],_0x10c014['passwordHistoryLimit']);return _0x2ff07f;})[_0x18d4('0xb')](function(){_0x2ff07f[_0x18d4('0xc')]=_0x22d594['body'][_0x18d4('0xc')];_0x2ff07f[_0x18d4('0x3d')]=null;_0x2ff07f[_0x18d4('0x3e')]=null;return _0x2ff07f[_0x18d4('0x4f')]();});})[_0x18d4('0xb')](function(){_0x1691aa[_0x18d4('0x2d')](0xc8)[_0x18d4('0x2e')]({'message':_0x18d4('0x50')});})[_0x18d4('0x1b')](function(_0x53aa33){return handleError(_0x1691aa,0x1f4,_0x53aa33);});};passport['use'](_0x18d4('0x51'),new LocalStrategy({'usernameField':_0x18d4('0x1e'),'passwordField':_0x18d4('0xc')},function(_0x29e9a7,_0x11c249,_0x48b486){return localAuthenticate(db[_0x18d4('0x3a')],_0x29e9a7,_0x11c249,_0x48b486);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index e225f28..493dfe2 100644 --- a/server/api/authLocal/index.js +++ b/server/api/authLocal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x083b=['post','/forgot','/reset/:token','reset','exports','express'];(function(_0x237f53,_0x2bd84a){var _0x4f9dd2=function(_0x3e34f9){while(--_0x3e34f9){_0x237f53['push'](_0x237f53['shift']());}};_0x4f9dd2(++_0x2bd84a);}(_0x083b,0x19d));var _0xb083=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0x083b[_0x8afdd0];return _0x3de7ac;};'use strict';var express=require(_0xb083('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router[_0xb083('0x1')](_0xb083('0x2'),controller['forgot']);router[_0xb083('0x1')](_0xb083('0x3'),controller[_0xb083('0x4')]);module[_0xb083('0x5')]=router; \ No newline at end of file +var _0xd028=['reset','exports','Router','./authLocal.controller','post','login','/forgot','/reset/:token'];(function(_0x2c3360,_0x1497a2){var _0x58c921=function(_0x26f39d){while(--_0x26f39d){_0x2c3360['push'](_0x2c3360['shift']());}};_0x58c921(++_0x1497a2);}(_0xd028,0xfa));var _0x8d02=function(_0x55ffad,_0x1e5f2c){_0x55ffad=_0x55ffad-0x0;var _0x428bcd=_0xd028[_0x55ffad];return _0x428bcd;};'use strict';var express=require('express');var router=express[_0x8d02('0x0')]();var controller=require(_0x8d02('0x1'));router[_0x8d02('0x2')]('/',controller[_0x8d02('0x3')]);router[_0x8d02('0x2')](_0x8d02('0x4'),controller['forgot']);router[_0x8d02('0x2')](_0x8d02('0x5'),controller[_0x8d02('0x6')]);module[_0x8d02('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index f37d2af..2361db6 100644 --- a/server/api/automation/automation.attributes.js +++ b/server/api/automation/automation.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d4e=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x4b7335,_0x16366a){var _0x1a75ae=function(_0x108574){while(--_0x108574){_0x4b7335['push'](_0x4b7335['shift']());}};_0x1a75ae(++_0x16366a);}(_0x0d4e,0x15b));var _0xe0d4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0d4e[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xe0d4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0d4('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xe0d4('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xe0d4('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe0d4('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x13a0=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0xde0a01,_0x227a35){var _0x8dae06=function(_0x3f860e){while(--_0x3f860e){_0xde0a01['push'](_0xde0a01['shift']());}};_0x8dae06(++_0x227a35);}(_0x13a0,0x13a));var _0x013a=function(_0x1286d5,_0x5c2870){_0x1286d5=_0x1286d5-0x0;var _0x1e06b0=_0x13a0[_0x1286d5];return _0x1e06b0;};'use strict';var Sequelize=require(_0x013a('0x0'));module[_0x013a('0x1')]={'name':{'type':Sequelize[_0x013a('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x013a('0x2')]},'description':{'type':Sequelize[_0x013a('0x2')]},'status':{'type':Sequelize[_0x013a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x013a('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 771cbf7..781acc7 100644 --- a/server/api/automation/automation.controller.js +++ b/server/api/automation/automation.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6db2=['findAll','rows','show','length','options','find','catch','create','update','body','params','addConditions','Condition','ids','getConditions','findOne','hasOwnProperty','addActions','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','merge','where','includeAll','include','Automation'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6db2,0xb4));var _0x26db=function(_0x3bc04d,_0x28ab50){_0x3bc04d=_0x3bc04d-0x0;var _0x2a543b=_0x6db2[_0x3bc04d];return _0x2a543b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x26db('0x0'));var jsonpatch=require(_0x26db('0x1'));var rp=require(_0x26db('0x2'));var moment=require(_0x26db('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x26db('0x4'));var util=require(_0x26db('0x5'));var path=require('path');var sox=require(_0x26db('0x6'));var csv=require(_0x26db('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26db('0x8'));var _=require(_0x26db('0x9'));var squel=require('squel');var crypto=require(_0x26db('0xa'));var jsforce=require(_0x26db('0xb'));var deskjs=require(_0x26db('0xc'));var toCsv=require(_0x26db('0x7'));var querystring=require(_0x26db('0xd'));var Papa=require(_0x26db('0xe'));var Redis=require(_0x26db('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x26db('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x26db('0x11'))('api');var utils=require(_0x26db('0x12'));var config=require(_0x26db('0x13'));var licenseUtil=require(_0x26db('0x14'));var db=require(_0x26db('0x15'))['db'];function respondWithStatusCode(_0x430942,_0x4794b){_0x4794b=_0x4794b||0xcc;return function(_0x588c35){if(_0x588c35){return _0x430942[_0x26db('0x16')](_0x4794b);}return _0x430942[_0x26db('0x17')](_0x4794b)['end']();};}function respondWithResult(_0x75edeb,_0x2e453a){_0x2e453a=_0x2e453a||0xc8;return function(_0x2d677a){if(_0x2d677a){return _0x75edeb[_0x26db('0x17')](_0x2e453a)['json'](_0x2d677a);}};}function respondWithFilteredResult(_0x235679,_0x41cb88){return function(_0x200102){if(_0x200102){var _0x3e4ec6=typeof _0x41cb88[_0x26db('0x18')]==='undefined'&&typeof _0x41cb88[_0x26db('0x19')]===_0x26db('0x1a');var _0x30b26e=_0x200102['count'];var _0x5e291d=_0x3e4ec6?0x0:_0x41cb88[_0x26db('0x18')];var _0x3e2e95=_0x3e4ec6?_0x200102[_0x26db('0x1b')]:_0x41cb88[_0x26db('0x18')]+_0x41cb88[_0x26db('0x19')];var _0x12f5dc;if(_0x3e2e95>=_0x30b26e){_0x3e2e95=_0x30b26e;_0x12f5dc=0xc8;}else{_0x12f5dc=0xce;}_0x235679[_0x26db('0x17')](_0x12f5dc);return _0x235679['set'](_0x26db('0x1c'),_0x5e291d+'-'+_0x3e2e95+'/'+_0x30b26e)[_0x26db('0x1d')](_0x200102);}return null;};}function patchUpdates(_0x18697b){return function(_0x4d9785){try{jsonpatch[_0x26db('0x1e')](_0x4d9785,_0x18697b,!![]);}catch(_0x207d2c){return BPromise[_0x26db('0x1f')](_0x207d2c);}return _0x4d9785[_0x26db('0x20')]();};}function saveUpdates(_0x4cbb25,_0x56d3f0){return function(_0x2e6f67){if(_0x2e6f67){return _0x2e6f67['update'](_0x4cbb25)['then'](function(_0x129ad1){return _0x129ad1;});}return null;};}function removeEntity(_0xe4a6c3,_0x448a32){return function(_0x337a16){if(_0x337a16){return _0x337a16[_0x26db('0x21')]()[_0x26db('0x22')](function(){_0xe4a6c3[_0x26db('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x430ae2,_0x4eb3df){return function(_0x36f1eb){if(!_0x36f1eb){_0x430ae2[_0x26db('0x16')](0x194);}return _0x36f1eb;};}function handleError(_0x56834,_0x501257){_0x501257=_0x501257||0x1f4;return function(_0x16f227){logger[_0x26db('0x23')](_0x16f227['stack']);if(_0x16f227[_0x26db('0x24')]){delete _0x16f227[_0x26db('0x24')];}_0x56834['status'](_0x501257)[_0x26db('0x25')](_0x16f227);};}exports[_0x26db('0x26')]=function(_0x3e5d56,_0x3651c0){var _0x4eda62={},_0x335f84={},_0x50908d={'count':0x0,'rows':[]};var _0x50c923=_[_0x26db('0x27')](db['Automation'][_0x26db('0x28')],function(_0x32ddbe){return{'name':_0x32ddbe[_0x26db('0x29')],'type':_0x32ddbe[_0x26db('0x2a')]['key']};});_0x335f84['model']=_[_0x26db('0x27')](_0x50c923,_0x26db('0x24'));_0x335f84[_0x26db('0x2b')]=_[_0x26db('0x2c')](_0x3e5d56[_0x26db('0x2b')]);_0x335f84[_0x26db('0x2d')]=_[_0x26db('0x2e')](_0x335f84[_0x26db('0x2f')],_0x335f84['query']);_0x4eda62[_0x26db('0x30')]=_[_0x26db('0x2e')](_0x335f84['model'],qs['fields'](_0x3e5d56[_0x26db('0x2b')][_0x26db('0x31')]));_0x4eda62['attributes']=_0x4eda62[_0x26db('0x30')]['length']?_0x4eda62[_0x26db('0x30')]:_0x335f84['model'];if(!_0x3e5d56['query']['hasOwnProperty'](_0x26db('0x32'))){_0x4eda62['limit']=qs['limit'](_0x3e5d56[_0x26db('0x2b')][_0x26db('0x19')]);_0x4eda62['offset']=qs[_0x26db('0x18')](_0x3e5d56[_0x26db('0x2b')][_0x26db('0x18')]);}_0x4eda62[_0x26db('0x33')]=qs[_0x26db('0x34')](_0x3e5d56['query'][_0x26db('0x34')]);_0x4eda62['where']=qs[_0x26db('0x2d')](_[_0x26db('0x35')](_0x3e5d56[_0x26db('0x2b')],_0x335f84[_0x26db('0x2d')]),_0x50c923);if(_0x3e5d56[_0x26db('0x2b')][_0x26db('0x36')]){_0x4eda62['where']=_[_0x26db('0x37')](_0x4eda62['where'],{'$or':_['map'](_0x50c923,function(_0x34f280){if(_0x34f280[_0x26db('0x2a')]!=='VIRTUAL'){var _0x68d734={};_0x68d734[_0x34f280[_0x26db('0x24')]]={'$like':'%'+_0x3e5d56[_0x26db('0x2b')][_0x26db('0x36')]+'%'};return _0x68d734;}})});}_0x4eda62=_[_0x26db('0x37')]({},_0x4eda62,_0x3e5d56['options']);var _0x587b94={'where':_0x4eda62[_0x26db('0x38')]};return db['Automation'][_0x26db('0x1b')](_0x587b94)[_0x26db('0x22')](function(_0x5d8839){_0x50908d[_0x26db('0x1b')]=_0x5d8839;if(_0x3e5d56[_0x26db('0x2b')][_0x26db('0x39')]){_0x4eda62[_0x26db('0x3a')]=[{'all':!![]}];}return db[_0x26db('0x3b')][_0x26db('0x3c')](_0x4eda62);})[_0x26db('0x22')](function(_0x29b230){_0x50908d[_0x26db('0x3d')]=_0x29b230;return _0x50908d;})[_0x26db('0x22')](respondWithFilteredResult(_0x3651c0,_0x4eda62))['catch'](handleError(_0x3651c0,null));};exports[_0x26db('0x3e')]=function(_0x17a6f2,_0x41a5fd){var _0x58ab76={'raw':![],'where':{'id':_0x17a6f2['params']['id']}},_0x312f27={};_0x312f27['model']=_[_0x26db('0x2c')](db['Automation'][_0x26db('0x28')]);_0x312f27['query']=_['keys'](_0x17a6f2[_0x26db('0x2b')]);_0x312f27[_0x26db('0x2d')]=_[_0x26db('0x2e')](_0x312f27['model'],_0x312f27['query']);_0x58ab76[_0x26db('0x30')]=_[_0x26db('0x2e')](_0x312f27['model'],qs[_0x26db('0x31')](_0x17a6f2[_0x26db('0x2b')][_0x26db('0x31')]));_0x58ab76[_0x26db('0x30')]=_0x58ab76['attributes'][_0x26db('0x3f')]?_0x58ab76['attributes']:_0x312f27[_0x26db('0x2f')];if(_0x17a6f2[_0x26db('0x2b')][_0x26db('0x39')]){_0x58ab76[_0x26db('0x3a')]=[{'all':!![]}];}_0x58ab76=_[_0x26db('0x37')]({},_0x58ab76,_0x17a6f2[_0x26db('0x40')]);return db['Automation'][_0x26db('0x41')](_0x58ab76)[_0x26db('0x22')](handleEntityNotFound(_0x41a5fd,null))[_0x26db('0x22')](respondWithResult(_0x41a5fd,null))[_0x26db('0x42')](handleError(_0x41a5fd,null));};exports[_0x26db('0x43')]=function(_0x29f3b1,_0x5581f3){return db['Automation'][_0x26db('0x43')](_0x29f3b1['body'],{})[_0x26db('0x22')](respondWithResult(_0x5581f3,0xc9))[_0x26db('0x42')](handleError(_0x5581f3,null));};exports[_0x26db('0x44')]=function(_0x3bf1b3,_0x39a2f0){if(_0x3bf1b3[_0x26db('0x45')]['id']){delete _0x3bf1b3[_0x26db('0x45')]['id'];}return db[_0x26db('0x3b')][_0x26db('0x41')]({'where':{'id':_0x3bf1b3[_0x26db('0x46')]['id']}})['then'](handleEntityNotFound(_0x39a2f0,null))['then'](saveUpdates(_0x3bf1b3[_0x26db('0x45')],null))[_0x26db('0x22')](respondWithResult(_0x39a2f0,null))[_0x26db('0x42')](handleError(_0x39a2f0,null));};exports[_0x26db('0x21')]=function(_0x4dabd3,_0x1a0b6a){return db[_0x26db('0x3b')][_0x26db('0x41')]({'where':{'id':_0x4dabd3[_0x26db('0x46')]['id']}})[_0x26db('0x22')](handleEntityNotFound(_0x1a0b6a,null))['then'](removeEntity(_0x1a0b6a,null))[_0x26db('0x42')](handleError(_0x1a0b6a,null));};exports[_0x26db('0x47')]=function(_0x14aa15,_0xbf3042,_0x488c74){return db[_0x26db('0x48')][_0x26db('0x41')]({'where':{'id':_0x14aa15[_0x26db('0x46')]['id']}})[_0x26db('0x22')](handleEntityNotFound(_0xbf3042,null))[_0x26db('0x22')](function(_0x5b13cc){if(_0x5b13cc){return _0x5b13cc['addConditions'](_0x14aa15['body']['ids'],_['omit'](_0x14aa15[_0x26db('0x45')],[_0x26db('0x49'),'id'])||{});}})[_0x26db('0x22')](respondWithResult(_0xbf3042,null))[_0x26db('0x42')](handleError(_0xbf3042,null));};exports[_0x26db('0x4a')]=function(_0x5716ef,_0x4462ff,_0x4ae3f1){var _0x37496e={};var _0x3e5a0c={};var _0x19ecff;var _0x491402;return db[_0x26db('0x3b')][_0x26db('0x4b')]({'where':{'id':_0x5716ef[_0x26db('0x46')]['id']}})[_0x26db('0x22')](handleEntityNotFound(_0x4462ff,null))[_0x26db('0x22')](function(_0x16e8d4){if(_0x16e8d4){_0x19ecff=_0x16e8d4;_0x3e5a0c[_0x26db('0x2f')]=_[_0x26db('0x2c')](db[_0x26db('0x48')][_0x26db('0x28')]);_0x3e5a0c[_0x26db('0x2b')]=_[_0x26db('0x2c')](_0x5716ef['query']);_0x3e5a0c[_0x26db('0x2d')]=_[_0x26db('0x2e')](_0x3e5a0c[_0x26db('0x2f')],_0x3e5a0c[_0x26db('0x2b')]);_0x37496e[_0x26db('0x30')]=_[_0x26db('0x2e')](_0x3e5a0c[_0x26db('0x2f')],qs[_0x26db('0x31')](_0x5716ef[_0x26db('0x2b')]['fields']));_0x37496e[_0x26db('0x30')]=_0x37496e['attributes']['length']?_0x37496e[_0x26db('0x30')]:_0x3e5a0c[_0x26db('0x2f')];_0x37496e[_0x26db('0x33')]=qs[_0x26db('0x34')](_0x5716ef['query'][_0x26db('0x34')]);_0x37496e[_0x26db('0x38')]=qs['filters'](_['pick'](_0x5716ef[_0x26db('0x2b')],_0x3e5a0c[_0x26db('0x2d')]));if(_0x5716ef[_0x26db('0x2b')][_0x26db('0x36')]){_0x37496e[_0x26db('0x38')]=_['merge'](_0x37496e[_0x26db('0x38')],{'$or':_['map'](_0x37496e[_0x26db('0x30')],function(_0x42dd0e){var _0x37aa9f={};_0x37aa9f[_0x42dd0e]={'$like':'%'+_0x5716ef['query'][_0x26db('0x36')]+'%'};return _0x37aa9f;})});}_0x37496e=_[_0x26db('0x37')]({},_0x37496e,_0x5716ef['options']);return _0x19ecff['getConditions'](_0x37496e);}})[_0x26db('0x22')](function(_0x29651b){if(_0x29651b){_0x491402=_0x29651b[_0x26db('0x3f')];if(!_0x5716ef['query'][_0x26db('0x4c')](_0x26db('0x32'))){_0x37496e[_0x26db('0x19')]=qs[_0x26db('0x19')](_0x5716ef[_0x26db('0x2b')][_0x26db('0x19')]);_0x37496e[_0x26db('0x18')]=qs['offset'](_0x5716ef[_0x26db('0x2b')][_0x26db('0x18')]);}return _0x19ecff[_0x26db('0x4a')](_0x37496e);}})[_0x26db('0x22')](function(_0x27155a){if(_0x27155a){return _0x27155a?{'count':_0x491402,'rows':_0x27155a}:null;}})['then'](respondWithResult(_0x4462ff,null))[_0x26db('0x42')](handleError(_0x4462ff,null));};exports[_0x26db('0x4d')]=function(_0x48dfb7,_0x1006a2,_0x348d41){return db[_0x26db('0x4e')][_0x26db('0x41')]({'where':{'id':_0x48dfb7[_0x26db('0x46')]['id']}})['then'](handleEntityNotFound(_0x1006a2,null))[_0x26db('0x22')](function(_0x225222){if(_0x225222){return _0x225222['addActions'](_0x48dfb7[_0x26db('0x45')][_0x26db('0x49')],_['omit'](_0x48dfb7['body'],[_0x26db('0x49'),'id'])||{});}})['then'](respondWithResult(_0x1006a2,null))[_0x26db('0x42')](handleError(_0x1006a2,null));};exports['getActions']=function(_0x1be444,_0x3088a0,_0x3a5b6f){var _0x418918={};var _0x37b612={};var _0x59646d;var _0x1f85a8;return db[_0x26db('0x3b')]['findOne']({'where':{'id':_0x1be444[_0x26db('0x46')]['id']}})[_0x26db('0x22')](handleEntityNotFound(_0x3088a0,null))[_0x26db('0x22')](function(_0x2b299b){if(_0x2b299b){_0x59646d=_0x2b299b;_0x37b612[_0x26db('0x2f')]=_['keys'](db[_0x26db('0x4e')]['rawAttributes']);_0x37b612[_0x26db('0x2b')]=_[_0x26db('0x2c')](_0x1be444[_0x26db('0x2b')]);_0x37b612[_0x26db('0x2d')]=_['intersection'](_0x37b612[_0x26db('0x2f')],_0x37b612[_0x26db('0x2b')]);_0x418918[_0x26db('0x30')]=_[_0x26db('0x2e')](_0x37b612['model'],qs['fields'](_0x1be444[_0x26db('0x2b')]['fields']));_0x418918['attributes']=_0x418918[_0x26db('0x30')]['length']?_0x418918['attributes']:_0x37b612['model'];_0x418918[_0x26db('0x33')]=qs[_0x26db('0x34')](_0x1be444['query'][_0x26db('0x34')]);_0x418918[_0x26db('0x38')]=qs[_0x26db('0x2d')](_['pick'](_0x1be444['query'],_0x37b612[_0x26db('0x2d')]));if(_0x1be444[_0x26db('0x2b')][_0x26db('0x36')]){_0x418918[_0x26db('0x38')]=_[_0x26db('0x37')](_0x418918[_0x26db('0x38')],{'$or':_[_0x26db('0x27')](_0x418918[_0x26db('0x30')],function(_0x5d8ce6){var _0xf8bab3={};_0xf8bab3[_0x5d8ce6]={'$like':'%'+_0x1be444[_0x26db('0x2b')]['filter']+'%'};return _0xf8bab3;})});}_0x418918=_[_0x26db('0x37')]({},_0x418918,_0x1be444[_0x26db('0x40')]);return _0x59646d[_0x26db('0x4f')](_0x418918);}})[_0x26db('0x22')](function(_0x5e8dcb){if(_0x5e8dcb){_0x1f85a8=_0x5e8dcb['length'];if(!_0x1be444['query']['hasOwnProperty']('nolimit')){_0x418918[_0x26db('0x19')]=qs[_0x26db('0x19')](_0x1be444[_0x26db('0x2b')]['limit']);_0x418918['offset']=qs[_0x26db('0x18')](_0x1be444[_0x26db('0x2b')][_0x26db('0x18')]);}return _0x59646d[_0x26db('0x4f')](_0x418918);}})['then'](function(_0x37b759){if(_0x37b759){return _0x37b759?{'count':_0x1f85a8,'rows':_0x37b759}:null;}})['then'](respondWithResult(_0x3088a0,null))[_0x26db('0x42')](handleError(_0x3088a0,null));}; \ No newline at end of file +var _0xb8e2=['findOne','Condition','addActions','Action','ids','getActions','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','save','update','then','error','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','Automation','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','addConditions','omit','getConditions'];(function(_0x8c8176,_0x5360a1){var _0x4dc47b=function(_0x1a7f65){while(--_0x1a7f65){_0x8c8176['push'](_0x8c8176['shift']());}};_0x4dc47b(++_0x5360a1);}(_0xb8e2,0xac));var _0x2b8e=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0xb8e2[_0x870b62];return _0x2dcb39;};'use strict';var emlformat=require(_0x2b8e('0x0'));var rimraf=require(_0x2b8e('0x1'));var zipdir=require(_0x2b8e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2b8e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b8e('0x4'));var util=require(_0x2b8e('0x5'));var path=require(_0x2b8e('0x6'));var sox=require(_0x2b8e('0x7'));var csv=require(_0x2b8e('0x8'));var ejs=require(_0x2b8e('0x9'));var fs=require('fs');var fs_extra=require(_0x2b8e('0xa'));var _=require(_0x2b8e('0xb'));var squel=require('squel');var crypto=require(_0x2b8e('0xc'));var jsforce=require(_0x2b8e('0xd'));var deskjs=require(_0x2b8e('0xe'));var toCsv=require(_0x2b8e('0x8'));var querystring=require('querystring');var Papa=require(_0x2b8e('0xf'));var Redis=require('ioredis');var authService=require(_0x2b8e('0x10'));var qs=require(_0x2b8e('0x11'));var as=require(_0x2b8e('0x12'));var hardwareService=require(_0x2b8e('0x13'));var logger=require(_0x2b8e('0x14'))(_0x2b8e('0x15'));var utils=require('../../config/utils');var config=require(_0x2b8e('0x16'));var licenseUtil=require(_0x2b8e('0x17'));var db=require(_0x2b8e('0x18'))['db'];function respondWithStatusCode(_0x485be3,_0x457fd9){_0x457fd9=_0x457fd9||0xcc;return function(_0x550b5a){if(_0x550b5a){return _0x485be3[_0x2b8e('0x19')](_0x457fd9);}return _0x485be3[_0x2b8e('0x1a')](_0x457fd9)[_0x2b8e('0x1b')]();};}function respondWithResult(_0xa57f19,_0x1c9cff){_0x1c9cff=_0x1c9cff||0xc8;return function(_0x19a05c){if(_0x19a05c){return _0xa57f19[_0x2b8e('0x1a')](_0x1c9cff)[_0x2b8e('0x1c')](_0x19a05c);}};}function respondWithFilteredResult(_0x3f6132,_0x59f870){return function(_0x505ca4){if(_0x505ca4){var _0x32d85d=typeof _0x59f870[_0x2b8e('0x1d')]===_0x2b8e('0x1e')&&typeof _0x59f870['limit']===_0x2b8e('0x1e');var _0x58f56c=_0x505ca4[_0x2b8e('0x1f')];var _0x393464=_0x32d85d?0x0:_0x59f870['offset'];var _0xb38c2=_0x32d85d?_0x505ca4[_0x2b8e('0x1f')]:_0x59f870[_0x2b8e('0x1d')]+_0x59f870[_0x2b8e('0x20')];var _0x3e7466;if(_0xb38c2>=_0x58f56c){_0xb38c2=_0x58f56c;_0x3e7466=0xc8;}else{_0x3e7466=0xce;}_0x3f6132[_0x2b8e('0x1a')](_0x3e7466);return _0x3f6132['set']('Content-Range',_0x393464+'-'+_0xb38c2+'/'+_0x58f56c)['json'](_0x505ca4);}return null;};}function patchUpdates(_0x14663d){return function(_0x4e3543){try{jsonpatch['apply'](_0x4e3543,_0x14663d,!![]);}catch(_0x3cdff4){return BPromise['reject'](_0x3cdff4);}return _0x4e3543[_0x2b8e('0x21')]();};}function saveUpdates(_0x3aea55,_0x5d4706){return function(_0x2859b4){if(_0x2859b4){return _0x2859b4[_0x2b8e('0x22')](_0x3aea55)[_0x2b8e('0x23')](function(_0x2a1f16){return _0x2a1f16;});}return null;};}function removeEntity(_0x1e674b,_0x1262ce){return function(_0x1c532c){if(_0x1c532c){return _0x1c532c['destroy']()[_0x2b8e('0x23')](function(){_0x1e674b[_0x2b8e('0x1a')](0xcc)[_0x2b8e('0x1b')]();});}};}function handleEntityNotFound(_0x30004e,_0xb46fdb){return function(_0xaad863){if(!_0xaad863){_0x30004e[_0x2b8e('0x19')](0x194);}return _0xaad863;};}function handleError(_0x2932a8,_0x506172){_0x506172=_0x506172||0x1f4;return function(_0x5d90b4){logger[_0x2b8e('0x24')](_0x5d90b4['stack']);if(_0x5d90b4['name']){delete _0x5d90b4['name'];}_0x2932a8[_0x2b8e('0x1a')](_0x506172)[_0x2b8e('0x25')](_0x5d90b4);};}exports[_0x2b8e('0x26')]=function(_0x477ec7,_0x44cae5){var _0x486336={},_0x46f4c5={},_0x3c1d1f={'count':0x0,'rows':[]};var _0x263b83=_[_0x2b8e('0x27')](db['Automation'][_0x2b8e('0x28')],function(_0x2a053c){return{'name':_0x2a053c[_0x2b8e('0x29')],'type':_0x2a053c[_0x2b8e('0x2a')]['key']};});_0x46f4c5[_0x2b8e('0x2b')]=_[_0x2b8e('0x27')](_0x263b83,_0x2b8e('0x2c'));_0x46f4c5[_0x2b8e('0x2d')]=_[_0x2b8e('0x2e')](_0x477ec7[_0x2b8e('0x2d')]);_0x46f4c5[_0x2b8e('0x2f')]=_[_0x2b8e('0x30')](_0x46f4c5[_0x2b8e('0x2b')],_0x46f4c5[_0x2b8e('0x2d')]);_0x486336[_0x2b8e('0x31')]=_[_0x2b8e('0x30')](_0x46f4c5['model'],qs[_0x2b8e('0x32')](_0x477ec7['query'][_0x2b8e('0x32')]));_0x486336[_0x2b8e('0x31')]=_0x486336[_0x2b8e('0x31')][_0x2b8e('0x33')]?_0x486336[_0x2b8e('0x31')]:_0x46f4c5[_0x2b8e('0x2b')];if(!_0x477ec7[_0x2b8e('0x2d')][_0x2b8e('0x34')](_0x2b8e('0x35'))){_0x486336['limit']=qs[_0x2b8e('0x20')](_0x477ec7[_0x2b8e('0x2d')][_0x2b8e('0x20')]);_0x486336[_0x2b8e('0x1d')]=qs[_0x2b8e('0x1d')](_0x477ec7[_0x2b8e('0x2d')]['offset']);}_0x486336[_0x2b8e('0x36')]=qs[_0x2b8e('0x37')](_0x477ec7[_0x2b8e('0x2d')]['sort']);_0x486336[_0x2b8e('0x38')]=qs[_0x2b8e('0x2f')](_[_0x2b8e('0x39')](_0x477ec7[_0x2b8e('0x2d')],_0x46f4c5[_0x2b8e('0x2f')]),_0x263b83);if(_0x477ec7[_0x2b8e('0x2d')]['filter']){_0x486336['where']=_['merge'](_0x486336[_0x2b8e('0x38')],{'$or':_[_0x2b8e('0x27')](_0x263b83,function(_0xcf0da2){if(_0xcf0da2[_0x2b8e('0x2a')]!==_0x2b8e('0x3a')){var _0x5af89c={};_0x5af89c[_0xcf0da2[_0x2b8e('0x2c')]]={'$like':'%'+_0x477ec7[_0x2b8e('0x2d')][_0x2b8e('0x3b')]+'%'};return _0x5af89c;}})});}_0x486336=_[_0x2b8e('0x3c')]({},_0x486336,_0x477ec7[_0x2b8e('0x3d')]);var _0x101ce9={'where':_0x486336[_0x2b8e('0x38')]};return db[_0x2b8e('0x3e')]['count'](_0x101ce9)[_0x2b8e('0x23')](function(_0xe06f10){_0x3c1d1f[_0x2b8e('0x1f')]=_0xe06f10;if(_0x477ec7[_0x2b8e('0x2d')][_0x2b8e('0x3f')]){_0x486336[_0x2b8e('0x40')]=[{'all':!![]}];}return db[_0x2b8e('0x3e')][_0x2b8e('0x41')](_0x486336);})[_0x2b8e('0x23')](function(_0x9271ab){_0x3c1d1f[_0x2b8e('0x42')]=_0x9271ab;return _0x3c1d1f;})[_0x2b8e('0x23')](respondWithFilteredResult(_0x44cae5,_0x486336))[_0x2b8e('0x43')](handleError(_0x44cae5,null));};exports[_0x2b8e('0x44')]=function(_0x3c86a4,_0x3d5e6c){var _0x3fa02c={'raw':![],'where':{'id':_0x3c86a4[_0x2b8e('0x45')]['id']}},_0x1d34d9={};_0x1d34d9[_0x2b8e('0x2b')]=_['keys'](db[_0x2b8e('0x3e')]['rawAttributes']);_0x1d34d9[_0x2b8e('0x2d')]=_[_0x2b8e('0x2e')](_0x3c86a4[_0x2b8e('0x2d')]);_0x1d34d9[_0x2b8e('0x2f')]=_[_0x2b8e('0x30')](_0x1d34d9['model'],_0x1d34d9['query']);_0x3fa02c[_0x2b8e('0x31')]=_[_0x2b8e('0x30')](_0x1d34d9[_0x2b8e('0x2b')],qs[_0x2b8e('0x32')](_0x3c86a4[_0x2b8e('0x2d')]['fields']));_0x3fa02c[_0x2b8e('0x31')]=_0x3fa02c[_0x2b8e('0x31')][_0x2b8e('0x33')]?_0x3fa02c[_0x2b8e('0x31')]:_0x1d34d9['model'];if(_0x3c86a4[_0x2b8e('0x2d')]['includeAll']){_0x3fa02c[_0x2b8e('0x40')]=[{'all':!![]}];}_0x3fa02c=_[_0x2b8e('0x3c')]({},_0x3fa02c,_0x3c86a4['options']);return db[_0x2b8e('0x3e')][_0x2b8e('0x46')](_0x3fa02c)['then'](handleEntityNotFound(_0x3d5e6c,null))[_0x2b8e('0x23')](respondWithResult(_0x3d5e6c,null))[_0x2b8e('0x43')](handleError(_0x3d5e6c,null));};exports[_0x2b8e('0x47')]=function(_0x326231,_0x3429b4){return db[_0x2b8e('0x3e')][_0x2b8e('0x47')](_0x326231['body'],{})['then'](respondWithResult(_0x3429b4,0xc9))[_0x2b8e('0x43')](handleError(_0x3429b4,null));};exports['update']=function(_0xa43ae2,_0x11364a){if(_0xa43ae2[_0x2b8e('0x48')]['id']){delete _0xa43ae2[_0x2b8e('0x48')]['id'];}return db[_0x2b8e('0x3e')][_0x2b8e('0x46')]({'where':{'id':_0xa43ae2[_0x2b8e('0x45')]['id']}})[_0x2b8e('0x23')](handleEntityNotFound(_0x11364a,null))[_0x2b8e('0x23')](saveUpdates(_0xa43ae2[_0x2b8e('0x48')],null))[_0x2b8e('0x23')](respondWithResult(_0x11364a,null))[_0x2b8e('0x43')](handleError(_0x11364a,null));};exports[_0x2b8e('0x49')]=function(_0x1f757e,_0xf3a9dc){return db['Automation'][_0x2b8e('0x46')]({'where':{'id':_0x1f757e[_0x2b8e('0x45')]['id']}})['then'](handleEntityNotFound(_0xf3a9dc,null))['then'](removeEntity(_0xf3a9dc,null))[_0x2b8e('0x43')](handleError(_0xf3a9dc,null));};exports[_0x2b8e('0x4a')]=function(_0x3b52c8,_0x490093,_0x5b0766){return db['Condition']['find']({'where':{'id':_0x3b52c8[_0x2b8e('0x45')]['id']}})[_0x2b8e('0x23')](handleEntityNotFound(_0x490093,null))['then'](function(_0x49e515){if(_0x49e515){return _0x49e515['addConditions'](_0x3b52c8['body']['ids'],_[_0x2b8e('0x4b')](_0x3b52c8[_0x2b8e('0x48')],['ids','id'])||{});}})[_0x2b8e('0x23')](respondWithResult(_0x490093,null))[_0x2b8e('0x43')](handleError(_0x490093,null));};exports[_0x2b8e('0x4c')]=function(_0x13b943,_0x127e0b,_0x49845f){var _0x5ec869={};var _0x174e3c={};var _0x23e2c5;var _0x2c142a;return db[_0x2b8e('0x3e')][_0x2b8e('0x4d')]({'where':{'id':_0x13b943[_0x2b8e('0x45')]['id']}})[_0x2b8e('0x23')](handleEntityNotFound(_0x127e0b,null))[_0x2b8e('0x23')](function(_0x20e2ef){if(_0x20e2ef){_0x23e2c5=_0x20e2ef;_0x174e3c[_0x2b8e('0x2b')]=_[_0x2b8e('0x2e')](db[_0x2b8e('0x4e')]['rawAttributes']);_0x174e3c[_0x2b8e('0x2d')]=_[_0x2b8e('0x2e')](_0x13b943['query']);_0x174e3c[_0x2b8e('0x2f')]=_[_0x2b8e('0x30')](_0x174e3c[_0x2b8e('0x2b')],_0x174e3c['query']);_0x5ec869[_0x2b8e('0x31')]=_[_0x2b8e('0x30')](_0x174e3c[_0x2b8e('0x2b')],qs['fields'](_0x13b943['query'][_0x2b8e('0x32')]));_0x5ec869[_0x2b8e('0x31')]=_0x5ec869[_0x2b8e('0x31')][_0x2b8e('0x33')]?_0x5ec869[_0x2b8e('0x31')]:_0x174e3c[_0x2b8e('0x2b')];_0x5ec869[_0x2b8e('0x36')]=qs[_0x2b8e('0x37')](_0x13b943[_0x2b8e('0x2d')][_0x2b8e('0x37')]);_0x5ec869[_0x2b8e('0x38')]=qs['filters'](_[_0x2b8e('0x39')](_0x13b943[_0x2b8e('0x2d')],_0x174e3c[_0x2b8e('0x2f')]));if(_0x13b943['query'][_0x2b8e('0x3b')]){_0x5ec869[_0x2b8e('0x38')]=_[_0x2b8e('0x3c')](_0x5ec869['where'],{'$or':_[_0x2b8e('0x27')](_0x5ec869[_0x2b8e('0x31')],function(_0x14da1c){var _0x1ed4a6={};_0x1ed4a6[_0x14da1c]={'$like':'%'+_0x13b943[_0x2b8e('0x2d')][_0x2b8e('0x3b')]+'%'};return _0x1ed4a6;})});}_0x5ec869=_[_0x2b8e('0x3c')]({},_0x5ec869,_0x13b943['options']);return _0x23e2c5[_0x2b8e('0x4c')](_0x5ec869);}})['then'](function(_0x59c54c){if(_0x59c54c){_0x2c142a=_0x59c54c[_0x2b8e('0x33')];if(!_0x13b943[_0x2b8e('0x2d')][_0x2b8e('0x34')](_0x2b8e('0x35'))){_0x5ec869[_0x2b8e('0x20')]=qs[_0x2b8e('0x20')](_0x13b943[_0x2b8e('0x2d')]['limit']);_0x5ec869['offset']=qs[_0x2b8e('0x1d')](_0x13b943['query'][_0x2b8e('0x1d')]);}return _0x23e2c5[_0x2b8e('0x4c')](_0x5ec869);}})[_0x2b8e('0x23')](function(_0x387fe2){if(_0x387fe2){return _0x387fe2?{'count':_0x2c142a,'rows':_0x387fe2}:null;}})[_0x2b8e('0x23')](respondWithResult(_0x127e0b,null))[_0x2b8e('0x43')](handleError(_0x127e0b,null));};exports[_0x2b8e('0x4f')]=function(_0x1d9e6d,_0x43dfd8,_0x42d4f7){return db[_0x2b8e('0x50')][_0x2b8e('0x46')]({'where':{'id':_0x1d9e6d[_0x2b8e('0x45')]['id']}})[_0x2b8e('0x23')](handleEntityNotFound(_0x43dfd8,null))[_0x2b8e('0x23')](function(_0x1d8b83){if(_0x1d8b83){return _0x1d8b83['addActions'](_0x1d9e6d['body'][_0x2b8e('0x51')],_[_0x2b8e('0x4b')](_0x1d9e6d[_0x2b8e('0x48')],['ids','id'])||{});}})[_0x2b8e('0x23')](respondWithResult(_0x43dfd8,null))[_0x2b8e('0x43')](handleError(_0x43dfd8,null));};exports[_0x2b8e('0x52')]=function(_0x11fd30,_0x365a82,_0xf0c876){var _0xaa0b56={};var _0x258afa={};var _0x483781;var _0x2eb2ce;return db[_0x2b8e('0x3e')][_0x2b8e('0x4d')]({'where':{'id':_0x11fd30[_0x2b8e('0x45')]['id']}})[_0x2b8e('0x23')](handleEntityNotFound(_0x365a82,null))[_0x2b8e('0x23')](function(_0x10024c){if(_0x10024c){_0x483781=_0x10024c;_0x258afa['model']=_['keys'](db[_0x2b8e('0x50')][_0x2b8e('0x28')]);_0x258afa[_0x2b8e('0x2d')]=_[_0x2b8e('0x2e')](_0x11fd30['query']);_0x258afa[_0x2b8e('0x2f')]=_[_0x2b8e('0x30')](_0x258afa['model'],_0x258afa[_0x2b8e('0x2d')]);_0xaa0b56[_0x2b8e('0x31')]=_[_0x2b8e('0x30')](_0x258afa[_0x2b8e('0x2b')],qs[_0x2b8e('0x32')](_0x11fd30[_0x2b8e('0x2d')]['fields']));_0xaa0b56[_0x2b8e('0x31')]=_0xaa0b56[_0x2b8e('0x31')]['length']?_0xaa0b56[_0x2b8e('0x31')]:_0x258afa['model'];_0xaa0b56[_0x2b8e('0x36')]=qs[_0x2b8e('0x37')](_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x37')]);_0xaa0b56[_0x2b8e('0x38')]=qs['filters'](_[_0x2b8e('0x39')](_0x11fd30[_0x2b8e('0x2d')],_0x258afa[_0x2b8e('0x2f')]));if(_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x3b')]){_0xaa0b56[_0x2b8e('0x38')]=_[_0x2b8e('0x3c')](_0xaa0b56['where'],{'$or':_['map'](_0xaa0b56['attributes'],function(_0x1e3718){var _0x236f92={};_0x236f92[_0x1e3718]={'$like':'%'+_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x3b')]+'%'};return _0x236f92;})});}_0xaa0b56=_[_0x2b8e('0x3c')]({},_0xaa0b56,_0x11fd30[_0x2b8e('0x3d')]);return _0x483781[_0x2b8e('0x52')](_0xaa0b56);}})[_0x2b8e('0x23')](function(_0x2af65e){if(_0x2af65e){_0x2eb2ce=_0x2af65e['length'];if(!_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x34')]('nolimit')){_0xaa0b56[_0x2b8e('0x20')]=qs[_0x2b8e('0x20')](_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x20')]);_0xaa0b56[_0x2b8e('0x1d')]=qs[_0x2b8e('0x1d')](_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x1d')]);}return _0x483781['getActions'](_0xaa0b56);}})[_0x2b8e('0x23')](function(_0x3564c1){if(_0x3564c1){return _0x3564c1?{'count':_0x2eb2ce,'rows':_0x3564c1}:null;}})[_0x2b8e('0x23')](respondWithResult(_0x365a82,null))[_0x2b8e('0x43')](handleError(_0x365a82,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8e62c36..ef94876 100644 --- a/server/api/automation/automation.model.js +++ b/server/api/automation/automation.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb4b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Automation','tools_automations'];(function(_0x559b69,_0x5b98bd){var _0x2ff0eb=function(_0x1caab1){while(--_0x1caab1){_0x559b69['push'](_0x559b69['shift']());}};_0x2ff0eb(++_0x5b98bd);}(_0xdb4b,0xdd));var _0xbdb4=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0xdb4b[_0x5b740b];return _0x6f8f4e;};'use strict';var _=require(_0xbdb4('0x0'));var util=require(_0xbdb4('0x1'));var logger=require(_0xbdb4('0x2'))(_0xbdb4('0x3'));var moment=require(_0xbdb4('0x4'));var BPromise=require(_0xbdb4('0x5'));var rp=require(_0xbdb4('0x6'));var fs=require('fs');var path=require(_0xbdb4('0x7'));var rimraf=require(_0xbdb4('0x8'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0xbdb4('0x9')]=function(_0x5cbd29,_0x1f95d0){return _0x5cbd29[_0xbdb4('0xa')](_0xbdb4('0xb'),attributes,{'tableName':_0xbdb4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab7a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util'];(function(_0x346454,_0x4be199){var _0x198086=function(_0x2af467){while(--_0x2af467){_0x346454['push'](_0x346454['shift']());}};_0x198086(++_0x4be199);}(_0xab7a,0x179));var _0xaab7=function(_0x5230ed,_0x2eb03e){_0x5230ed=_0x5230ed-0x0;var _0x43bb42=_0xab7a[_0x5230ed];return _0x43bb42;};'use strict';var _=require('lodash');var util=require(_0xaab7('0x0'));var logger=require(_0xaab7('0x1'))(_0xaab7('0x2'));var moment=require(_0xaab7('0x3'));var BPromise=require(_0xaab7('0x4'));var rp=require(_0xaab7('0x5'));var fs=require('fs');var path=require(_0xaab7('0x6'));var rimraf=require(_0xaab7('0x7'));var config=require(_0xaab7('0x8'));var attributes=require(_0xaab7('0x9'));module[_0xaab7('0xa')]=function(_0x3a9630,_0x2aadd2){return _0x3a9630[_0xaab7('0xb')](_0xaab7('0xc'),attributes,{'tableName':_0xaab7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index c4a28c8..14aa701 100644 --- a/server/api/automation/automation.rpc.js +++ b/server/api/automation/automation.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fc2=['error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x163347,_0xf0f25a){var _0x28913c=function(_0x5f3763){while(--_0x5f3763){_0x163347['push'](_0x163347['shift']());}};_0x28913c(++_0xf0f25a);}(_0x6fc2,0x117));var _0x26fc=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x6fc2[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x26fc('0x0'));var util=require(_0x26fc('0x1'));var moment=require(_0x26fc('0x2'));var BPromise=require('bluebird');var rs=require(_0x26fc('0x3'));var fs=require('fs');var Redis=require(_0x26fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x26fc('0x5'));var config=require(_0x26fc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x26fc('0x7')][_0x26fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f5258,_0x3dcd63,_0x5c87f2){return new BPromise(function(_0x23c15a,_0x5616eb){return client['request'](_0x2f5258,_0x5c87f2)[_0x26fc('0x9')](function(_0x2ea728){logger[_0x26fc('0xa')]('Automation,\x20%s,\x20%s',_0x3dcd63,_0x26fc('0xb'));logger[_0x26fc('0xc')](_0x26fc('0xd'),_0x3dcd63,_0x26fc('0xb'),JSON[_0x26fc('0xe')](_0x2ea728));if(_0x2ea728[_0x26fc('0xf')]){if(_0x2ea728[_0x26fc('0xf')][_0x26fc('0x10')]===0x1f4){logger[_0x26fc('0xf')](_0x26fc('0x11'),_0x3dcd63,_0x2ea728[_0x26fc('0xf')][_0x26fc('0x12')]);return _0x5616eb(_0x2ea728[_0x26fc('0xf')][_0x26fc('0x12')]);}logger[_0x26fc('0xf')](_0x26fc('0x11'),_0x3dcd63,_0x2ea728['error'][_0x26fc('0x12')]);return _0x23c15a(_0x2ea728[_0x26fc('0xf')][_0x26fc('0x12')]);}else{logger[_0x26fc('0xa')](_0x26fc('0x11'),_0x3dcd63,_0x26fc('0xb'));_0x23c15a(_0x2ea728[_0x26fc('0x13')][_0x26fc('0x12')]);}})[_0x26fc('0x14')](function(_0x54f0e5){logger[_0x26fc('0xf')]('Automation,\x20%s,\x20%s',_0x3dcd63,_0x54f0e5);_0x5616eb(_0x54f0e5);});});} \ No newline at end of file +var _0xeaab=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0xeaab,0xd9));var _0xbeaa=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xeaab[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xbeaa('0x0'));var util=require('util');var moment=require(_0xbeaa('0x1'));var BPromise=require(_0xbeaa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbeaa('0x3'))['db'];var utils=require(_0xbeaa('0x4'));var logger=require(_0xbeaa('0x5'))(_0xbeaa('0x6'));var config=require(_0xbeaa('0x7'));var jayson=require(_0xbeaa('0x8'));var client=jayson[_0xbeaa('0x9')][_0xbeaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f015b,_0x42a779,_0x346043){return new BPromise(function(_0x2da505,_0x15a826){return client[_0xbeaa('0xb')](_0x2f015b,_0x346043)['then'](function(_0x389c0b){logger[_0xbeaa('0xc')](_0xbeaa('0xd'),_0x42a779,_0xbeaa('0xe'));logger[_0xbeaa('0xf')](_0xbeaa('0x10'),_0x42a779,_0xbeaa('0xe'),JSON['stringify'](_0x389c0b));if(_0x389c0b[_0xbeaa('0x11')]){if(_0x389c0b['error'][_0xbeaa('0x12')]===0x1f4){logger[_0xbeaa('0x11')]('Automation,\x20%s,\x20%s',_0x42a779,_0x389c0b[_0xbeaa('0x11')]['message']);return _0x15a826(_0x389c0b[_0xbeaa('0x11')][_0xbeaa('0x13')]);}logger['error'](_0xbeaa('0xd'),_0x42a779,_0x389c0b[_0xbeaa('0x11')][_0xbeaa('0x13')]);return _0x2da505(_0x389c0b[_0xbeaa('0x11')][_0xbeaa('0x13')]);}else{logger[_0xbeaa('0xc')](_0xbeaa('0xd'),_0x42a779,_0xbeaa('0xe'));_0x2da505(_0x389c0b[_0xbeaa('0x14')][_0xbeaa('0x13')]);}})[_0xbeaa('0x15')](function(_0x1cc387){logger[_0xbeaa('0x11')](_0xbeaa('0xd'),_0x42a779,_0x1cc387);_0x15a826(_0x1cc387);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 0fd5c7c..40ae9f2 100644 --- a/server/api/automation/index.js +++ b/server/api/automation/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f14=['index','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','create','update','destroy','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated'];(function(_0xeed073,_0x196567){var _0x522081=function(_0x110c2b){while(--_0x110c2b){_0xeed073['push'](_0xeed073['shift']());}};_0x522081(++_0x196567);}(_0x2f14,0x199));var _0x42f1=function(_0x137710,_0x3eb681){_0x137710=_0x137710-0x0;var _0x1f7c84=_0x2f14[_0x137710];return _0x1f7c84;};'use strict';var multer=require('multer');var util=require(_0x42f1('0x0'));var path=require(_0x42f1('0x1'));var timeout=require('connect-timeout');var express=require(_0x42f1('0x2'));var router=express['Router']();var fs_extra=require(_0x42f1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x42f1('0x4'));var config=require(_0x42f1('0x5'));var controller=require(_0x42f1('0x6'));router[_0x42f1('0x7')]('/',auth[_0x42f1('0x8')](),controller[_0x42f1('0x9')]);router[_0x42f1('0x7')](_0x42f1('0xa'),auth[_0x42f1('0x8')](),controller['show']);router[_0x42f1('0x7')](_0x42f1('0xb'),auth[_0x42f1('0x8')](),controller[_0x42f1('0xc')]);router[_0x42f1('0x7')](_0x42f1('0xd'),auth['isAuthenticated'](),controller[_0x42f1('0xe')]);router[_0x42f1('0xf')]('/',auth[_0x42f1('0x8')](),controller[_0x42f1('0x10')]);router[_0x42f1('0xf')](_0x42f1('0xb'),auth[_0x42f1('0x8')](),controller['addConditions']);router[_0x42f1('0xf')]('/:id/actions',auth[_0x42f1('0x8')](),controller['addActions']);router['put']('/:id',auth[_0x42f1('0x8')](),controller[_0x42f1('0x11')]);router['delete'](_0x42f1('0xa'),auth['isAuthenticated'](),controller[_0x42f1('0x12')]);module['exports']=router; \ No newline at end of file +var _0x54f3=['show','get','/:id/actions','post','/:id/conditions','addConditions','addActions','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./automation.controller','index','/:id','isAuthenticated'];(function(_0x710c48,_0x5557){var _0x4d89ad=function(_0x114ea4){while(--_0x114ea4){_0x710c48['push'](_0x710c48['shift']());}};_0x4d89ad(++_0x5557);}(_0x54f3,0x120));var _0x354f=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x54f3[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require(_0x354f('0x0'));var path=require(_0x354f('0x1'));var timeout=require(_0x354f('0x2'));var express=require(_0x354f('0x3'));var router=express[_0x354f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x354f('0x5'));var config=require(_0x354f('0x6'));var controller=require(_0x354f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x354f('0x8')]);router['get'](_0x354f('0x9'),auth[_0x354f('0xa')](),controller[_0x354f('0xb')]);router[_0x354f('0xc')]('/:id/conditions',auth[_0x354f('0xa')](),controller['getConditions']);router[_0x354f('0xc')](_0x354f('0xd'),auth['isAuthenticated'](),controller['getActions']);router[_0x354f('0xe')]('/',auth[_0x354f('0xa')](),controller['create']);router[_0x354f('0xe')](_0x354f('0xf'),auth['isAuthenticated'](),controller[_0x354f('0x10')]);router[_0x354f('0xe')](_0x354f('0xd'),auth[_0x354f('0xa')](),controller[_0x354f('0x11')]);router[_0x354f('0x12')](_0x354f('0x9'),auth['isAuthenticated'](),controller[_0x354f('0x13')]);router[_0x354f('0x14')](_0x354f('0x9'),auth['isAuthenticated'](),controller[_0x354f('0x15')]);module[_0x354f('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index ef12927..bd704db 100644 --- a/server/api/campaign/campaign.attributes.js +++ b/server/api/campaign/campaign.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5341=['always','never','onlyIfOpen','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ivr','STRING','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM'];(function(_0x32cfff,_0x56f9a3){var _0xe28f13=function(_0x10238a){while(--_0x10238a){_0x32cfff['push'](_0x32cfff['shift']());}};_0xe28f13(++_0x56f9a3);}(_0x5341,0xb3));var _0x1534=function(_0x12d73f,_0x96399d){_0x12d73f=_0x12d73f-0x0;var _0x1f6231=_0x5341[_0x12d73f];return _0x1f6231;};'use strict';var Sequelize=require(_0x1534('0x0'));module[_0x1534('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1534('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x1534('0x3')),'allowNull':![],'defaultValue':_0x1534('0x3')},'description':{'type':Sequelize[_0x1534('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1534('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1534('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1534('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1534('0x7')](0x3)[_0x1534('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1534('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1534('0x9')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1534('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1534('0x7')](0x5)[_0x1534('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1534('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1534('0x7')](0x3)[_0x1534('0x8')],'defaultValue':0x3,'comment':_0x1534('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1534('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1534('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1534('0xe')},'dialTimezone':{'type':Sequelize[_0x1534('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1534('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x1534('0xf')](_0x1534('0x10'),_0x1534('0x11'),_0x1534('0x12')),'defaultValue':_0x1534('0x10')},'dialAMDActive':{'type':Sequelize[_0x1534('0x13')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1534('0x7')](0x9)[_0x1534('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1534('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1534('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1534('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1534('0x7')](0x9)[_0x1534('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1534('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1534('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1534('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x1534('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1534('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1534('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1534('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1534('0x7')](0x9)[_0x1534('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1534('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1534('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1534('0x7')](0x9)[_0x1534('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1534('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1534('0xf')](_0x1534('0x1c'),_0x1534('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1534('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1534('0x1e')},'dialCutDigit':{'type':Sequelize[_0x1534('0x7')](0x3)[_0x1534('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1534('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1534('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1534('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1534('0x7')](0x5)[_0x1534('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1534('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1534('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x1534('0x7')](0x5)[_0x1534('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1534('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1534('0x7')](0x3)[_0x1534('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1534('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1534('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x1534('0x7')](0x3)[_0x1534('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1534('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1534('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1534('0x7')](0x3)[_0x1534('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1534('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1534('0x7')](0x5)[_0x1534('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1534('0x26')}}; \ No newline at end of file +var _0xe96e=['Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED'];(function(_0x1eaa6f,_0x556e77){var _0x370839=function(_0x22e3fe){while(--_0x22e3fe){_0x1eaa6f['push'](_0x1eaa6f['shift']());}};_0x370839(++_0x556e77);}(_0xe96e,0x8b));var _0xee96=function(_0x42250b,_0x407254){_0x42250b=_0x42250b-0x0;var _0x431436=_0xe96e[_0x42250b];return _0x431436;};'use strict';var Sequelize=require(_0xee96('0x0'));module[_0xee96('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xee96('0x2')](_0xee96('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xee96('0x4')]},'active':{'type':Sequelize[_0xee96('0x5')],'defaultValue':0x0,'comment':_0xee96('0x6')},'limitCalls':{'type':Sequelize[_0xee96('0x7')](0x4)[_0xee96('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xee96('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xee96('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xee96('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee96('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'comment':_0xee96('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee96('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xee96('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xee96('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xee96('0x12'),'never',_0xee96('0x13')),'defaultValue':_0xee96('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xee96('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xee96('0x7')](0x9)[_0xee96('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xee96('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xee96('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xee96('0x7')](0x9)[_0xee96('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xee96('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xee96('0x7')](0x9)[_0xee96('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xee96('0x7')](0x9)[_0xee96('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xee96('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xee96('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xee96('0x7')](0x9)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xee96('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xee96('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xee96('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xee96('0x1b'),_0xee96('0x1c')),'defaultValue':_0xee96('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xee96('0x1d')},'dialCutDigit':{'type':Sequelize[_0xee96('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xee96('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee96('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee96('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee96('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e6b09ab..c3a5526 100644 --- a/server/api/campaign/campaign.controller.js +++ b/server/api/campaign/campaign.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc20b=['spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','removeBlackLists','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','IvrCampaigns','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','body','findOne','CmHopper','pick','filter','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0xc20b,0xaa));var _0xbc20=function(_0x36903f,_0x658e21){_0x36903f=_0x36903f-0x0;var _0x220a64=_0xc20b[_0x36903f];return _0x220a64;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc20('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc20('0x1'));var rp=require(_0xbc20('0x2'));var moment=require(_0xbc20('0x3'));var BPromise=require(_0xbc20('0x4'));var Mustache=require(_0xbc20('0x5'));var util=require('util');var path=require('path');var sox=require(_0xbc20('0x6'));var csv=require(_0xbc20('0x7'));var ejs=require(_0xbc20('0x8'));var fs=require('fs');var fs_extra=require(_0xbc20('0x9'));var _=require(_0xbc20('0xa'));var squel=require(_0xbc20('0xb'));var crypto=require(_0xbc20('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbc20('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbc20('0xe'));var Papa=require(_0xbc20('0xf'));var Redis=require(_0xbc20('0x10'));var authService=require(_0xbc20('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbc20('0x12'));var hardwareService=require(_0xbc20('0x13'));var logger=require(_0xbc20('0x14'))(_0xbc20('0x15'));var utils=require(_0xbc20('0x16'));var config=require(_0xbc20('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc20('0x18'))['db'];function respondWithStatusCode(_0x590474,_0x448611){_0x448611=_0x448611||0xcc;return function(_0x9ff918){if(_0x9ff918){return _0x590474[_0xbc20('0x19')](_0x448611);}return _0x590474[_0xbc20('0x1a')](_0x448611)[_0xbc20('0x1b')]();};}function respondWithResult(_0x195bee,_0x194ac8){_0x194ac8=_0x194ac8||0xc8;return function(_0x35e373){if(_0x35e373){return _0x195bee['status'](_0x194ac8)[_0xbc20('0x1c')](_0x35e373);}};}function respondWithFilteredResult(_0x4922fa,_0x4c1b9d){return function(_0x46c34f){if(_0x46c34f){var _0x27ba5c=typeof _0x4c1b9d[_0xbc20('0x1d')]===_0xbc20('0x1e')&&typeof _0x4c1b9d[_0xbc20('0x1f')]===_0xbc20('0x1e');var _0x8b6d04=_0x46c34f[_0xbc20('0x20')];var _0x46e7ea=_0x27ba5c?0x0:_0x4c1b9d[_0xbc20('0x1d')];var _0x114ef7=_0x27ba5c?_0x46c34f[_0xbc20('0x20')]:_0x4c1b9d['offset']+_0x4c1b9d['limit'];var _0x1c8323;if(_0x114ef7>=_0x8b6d04){_0x114ef7=_0x8b6d04;_0x1c8323=0xc8;}else{_0x1c8323=0xce;}_0x4922fa[_0xbc20('0x1a')](_0x1c8323);return _0x4922fa[_0xbc20('0x21')](_0xbc20('0x22'),_0x46e7ea+'-'+_0x114ef7+'/'+_0x8b6d04)[_0xbc20('0x1c')](_0x46c34f);}return null;};}function patchUpdates(_0x4de5e3){return function(_0x563a76){try{jsonpatch[_0xbc20('0x23')](_0x563a76,_0x4de5e3,!![]);}catch(_0x2a8b6c){return BPromise[_0xbc20('0x24')](_0x2a8b6c);}return _0x563a76[_0xbc20('0x25')]();};}function saveUpdates(_0x41c7ec,_0x65242d){return function(_0x59ab83){if(_0x59ab83){return _0x59ab83['update'](_0x41c7ec)[_0xbc20('0x26')](function(_0x3e880d){return _0x3e880d;});}return null;};}function removeEntity(_0x3e3942,_0x2db7d6){return function(_0x4449d4){if(_0x4449d4){return _0x4449d4[_0xbc20('0x27')]()[_0xbc20('0x26')](function(){var _0x193677=_0x4449d4[_0xbc20('0x28')]({'plain':!![]});var _0x391eb=_0xbc20('0x29');return db['UserProfileResource'][_0xbc20('0x27')]({'where':{'type':_0x391eb,'resourceId':_0x193677['id']}})[_0xbc20('0x26')](function(){return _0x4449d4;});})[_0xbc20('0x26')](function(){_0x3e3942[_0xbc20('0x1a')](0xcc)[_0xbc20('0x1b')]();});}};}function handleEntityNotFound(_0x57c97e,_0x454aaf){return function(_0x2250cf){if(!_0x2250cf){_0x57c97e[_0xbc20('0x19')](0x194);}return _0x2250cf;};}function handleError(_0x187c17,_0x4e4621){_0x4e4621=_0x4e4621||0x1f4;return function(_0x8779da){logger[_0xbc20('0x2a')](_0x8779da[_0xbc20('0x2b')]);if(_0x8779da[_0xbc20('0x2c')]){delete _0x8779da['name'];}_0x187c17[_0xbc20('0x1a')](_0x4e4621)[_0xbc20('0x2d')](_0x8779da);};}exports[_0xbc20('0x2e')]=function(_0x509eae,_0x35a074){var _0x332d21={},_0x10cddf={},_0x3601e1={'count':0x0,'rows':[]};var _0x45b609=_[_0xbc20('0x2f')](db[_0xbc20('0x30')][_0xbc20('0x31')],function(_0x39bd74){return{'name':_0x39bd74[_0xbc20('0x32')],'type':_0x39bd74[_0xbc20('0x33')][_0xbc20('0x34')]};});_0x10cddf[_0xbc20('0x35')]=_[_0xbc20('0x2f')](_0x45b609,_0xbc20('0x2c'));_0x10cddf[_0xbc20('0x36')]=_[_0xbc20('0x37')](_0x509eae[_0xbc20('0x36')]);_0x10cddf['filters']=_[_0xbc20('0x38')](_0x10cddf[_0xbc20('0x35')],_0x10cddf[_0xbc20('0x36')]);_0x332d21[_0xbc20('0x39')]=_['intersection'](_0x10cddf[_0xbc20('0x35')],qs[_0xbc20('0x3a')](_0x509eae[_0xbc20('0x36')][_0xbc20('0x3a')]));_0x332d21[_0xbc20('0x39')]=_0x332d21[_0xbc20('0x39')][_0xbc20('0x3b')]?_0x332d21[_0xbc20('0x39')]:_0x10cddf[_0xbc20('0x35')];if(!_0x509eae[_0xbc20('0x36')][_0xbc20('0x3c')](_0xbc20('0x3d'))){_0x332d21['limit']=qs[_0xbc20('0x1f')](_0x509eae[_0xbc20('0x36')][_0xbc20('0x1f')]);_0x332d21[_0xbc20('0x1d')]=qs[_0xbc20('0x1d')](_0x509eae[_0xbc20('0x36')][_0xbc20('0x1d')]);}_0x332d21[_0xbc20('0x3e')]=qs[_0xbc20('0x3f')](_0x509eae[_0xbc20('0x36')][_0xbc20('0x3f')]);_0x332d21[_0xbc20('0x40')]=qs[_0xbc20('0x41')](_['pick'](_0x509eae['query'],_0x10cddf['filters']),_0x45b609);if(_0x509eae[_0xbc20('0x36')]['filter']){_0x332d21[_0xbc20('0x40')]=_['merge'](_0x332d21[_0xbc20('0x40')],{'$or':_[_0xbc20('0x2f')](_0x45b609,function(_0x2c5451){if(_0x2c5451[_0xbc20('0x33')]!==_0xbc20('0x42')){var _0x1ca793={};_0x1ca793[_0x2c5451[_0xbc20('0x2c')]]={'$like':'%'+_0x509eae[_0xbc20('0x36')]['filter']+'%'};return _0x1ca793;}})});}_0x332d21=_[_0xbc20('0x43')]({},_0x332d21,_0x509eae[_0xbc20('0x44')]);var _0x9cf6b={'where':_0x332d21[_0xbc20('0x40')]};return db[_0xbc20('0x30')][_0xbc20('0x20')](_0x9cf6b)[_0xbc20('0x26')](function(_0x1fa1e2){_0x3601e1[_0xbc20('0x20')]=_0x1fa1e2;if(_0x509eae[_0xbc20('0x36')]['includeAll']){_0x332d21[_0xbc20('0x45')]=[{'all':!![]}];}return db[_0xbc20('0x30')][_0xbc20('0x46')](_0x332d21);})[_0xbc20('0x26')](function(_0x2351c0){_0x3601e1[_0xbc20('0x47')]=_0x2351c0;return _0x3601e1;})[_0xbc20('0x26')](respondWithFilteredResult(_0x35a074,_0x332d21))[_0xbc20('0x48')](handleError(_0x35a074,null));};exports[_0xbc20('0x49')]=function(_0x1ecf6d,_0x39647b){var _0x6a3740={'raw':![],'where':{'id':_0x1ecf6d[_0xbc20('0x4a')]['id']}},_0x3d1063={};_0x3d1063[_0xbc20('0x35')]=_[_0xbc20('0x37')](db[_0xbc20('0x30')][_0xbc20('0x31')]);_0x3d1063['query']=_[_0xbc20('0x37')](_0x1ecf6d[_0xbc20('0x36')]);_0x3d1063['filters']=_[_0xbc20('0x38')](_0x3d1063[_0xbc20('0x35')],_0x3d1063[_0xbc20('0x36')]);_0x6a3740[_0xbc20('0x39')]=_[_0xbc20('0x38')](_0x3d1063[_0xbc20('0x35')],qs[_0xbc20('0x3a')](_0x1ecf6d[_0xbc20('0x36')]['fields']));_0x6a3740[_0xbc20('0x39')]=_0x6a3740[_0xbc20('0x39')][_0xbc20('0x3b')]?_0x6a3740[_0xbc20('0x39')]:_0x3d1063[_0xbc20('0x35')];if(_0x1ecf6d[_0xbc20('0x36')]['includeAll']){_0x6a3740[_0xbc20('0x45')]=[{'all':!![]}];}_0x6a3740=_[_0xbc20('0x43')]({},_0x6a3740,_0x1ecf6d['options']);return db[_0xbc20('0x30')]['find'](_0x6a3740)[_0xbc20('0x26')](handleEntityNotFound(_0x39647b,null))[_0xbc20('0x26')](respondWithResult(_0x39647b,null))['catch'](handleError(_0x39647b,null));};exports[_0xbc20('0x4b')]=function(_0x53ac36,_0x53fa15){return db[_0xbc20('0x30')][_0xbc20('0x4b')](_0x53ac36['body'],{})[_0xbc20('0x26')](function(_0x1e3793){var _0x2e4262=_0x53ac36[_0xbc20('0x4c')][_0xbc20('0x28')]({'plain':!![]});if(!_0x2e4262)throw new Error(_0xbc20('0x4d'));if(_0x2e4262[_0xbc20('0x4e')]===_0xbc20('0x4c')){var _0xc19db7=_0x1e3793[_0xbc20('0x28')]({'plain':!![]});var _0x1de106=_0xbc20('0x29');return db[_0xbc20('0x4f')][_0xbc20('0x50')]({'where':{'name':_0x1de106,'userProfileId':_0x2e4262[_0xbc20('0x51')]},'raw':!![]})['then'](function(_0x1d08fd){if(_0x1d08fd&&_0x1d08fd[_0xbc20('0x52')]===0x0){return db[_0xbc20('0x53')][_0xbc20('0x4b')]({'name':_0xc19db7[_0xbc20('0x2c')],'resourceId':_0xc19db7['id'],'type':_0x1d08fd['name'],'sectionId':_0x1d08fd['id']},{})['then'](function(){return _0x1e3793;});}else{return _0x1e3793;}})['catch'](function(_0x3e5ff4){logger[_0xbc20('0x2a')](_0xbc20('0x54'),_0x3e5ff4);throw _0x3e5ff4;});}return _0x1e3793;})['then'](respondWithResult(_0x53fa15,0xc9))[_0xbc20('0x48')](handleError(_0x53fa15,null));};exports[_0xbc20('0x55')]=function(_0x2e2aae,_0x57f7fd){var _0x2f8313={'where':{'id':_0x2e2aae[_0xbc20('0x4a')]['id']}},_0x4e4ee4={};_0x4e4ee4[_0xbc20('0x35')]=_[_0xbc20('0x37')](db[_0xbc20('0x30')][_0xbc20('0x31')]);_0x2f8313[_0xbc20('0x39')]=_['intersection'](_0x4e4ee4['model'],qs['fields'](_0x2e2aae[_0xbc20('0x36')][_0xbc20('0x3a')]));_0x2f8313[_0xbc20('0x39')]=_0x2f8313[_0xbc20('0x39')][_0xbc20('0x3b')]?_0x2f8313[_0xbc20('0x39')]:_0x4e4ee4[_0xbc20('0x35')];if(_0x2e2aae['query'][_0xbc20('0x56')]){_0x2f8313[_0xbc20('0x45')]=[{'all':!![]}];}_0x2f8313=_[_0xbc20('0x43')]({},_0x2f8313,_0x2e2aae[_0xbc20('0x44')]);return db['Campaign'][_0xbc20('0x50')](_0x2f8313)[_0xbc20('0x26')](handleEntityNotFound(_0x57f7fd,null))[_0xbc20('0x26')](function(_0x188954){if(_0x188954){var _0x290749=_0x188954[_0xbc20('0x28')]({'plain':!![]});_0x290749=qs[_0xbc20('0x57')](_0x290749,['id',_0xbc20('0x58'),_0xbc20('0x59')]);_0x2e2aae[_0xbc20('0x5a')]=_[_0xbc20('0x57')](_0x2e2aae[_0xbc20('0x5a')],['id',_0xbc20('0x58'),_0xbc20('0x59')]);return db[_0xbc20('0x30')][_0xbc20('0x4b')](_[_0xbc20('0x43')](_0x290749,_0x2e2aae[_0xbc20('0x5a')]),{'include':_0x2e2aae[_0xbc20('0x36')][_0xbc20('0x56')]?[{'all':!![]}]:undefined})[_0xbc20('0x26')](function(_0x1f7768){var _0x5a11d7=_0x2e2aae[_0xbc20('0x4c')][_0xbc20('0x28')]({'plain':!![]});if(!_0x5a11d7)throw new Error(_0xbc20('0x4d'));if(_0x5a11d7[_0xbc20('0x4e')]===_0xbc20('0x4c')){var _0x4a998c=_0x1f7768[_0xbc20('0x28')]({'plain':!![]});var _0xdc0f60=_0xbc20('0x29');return db[_0xbc20('0x4f')]['find']({'where':{'name':_0xdc0f60,'userProfileId':_0x5a11d7[_0xbc20('0x51')]},'raw':!![]})[_0xbc20('0x26')](function(_0xdee875){if(_0xdee875&&_0xdee875[_0xbc20('0x52')]===0x0){return db[_0xbc20('0x53')]['create']({'name':_0x4a998c['name'],'resourceId':_0x4a998c['id'],'type':_0xdee875[_0xbc20('0x2c')],'sectionId':_0xdee875['id']},{})[_0xbc20('0x26')](function(){return _0x1f7768;});}else{return _0x1f7768;}})[_0xbc20('0x48')](function(_0x43b2e3){logger['error'](_0xbc20('0x54'),_0x43b2e3);throw _0x43b2e3;});}return _0x1f7768;});}})[_0xbc20('0x26')](respondWithResult(_0x57f7fd,0xc9))[_0xbc20('0x48')](handleError(_0x57f7fd,null));};exports['update']=function(_0x3860cc,_0xcf9795){if(_0x3860cc['body']['id']){delete _0x3860cc[_0xbc20('0x5a')]['id'];}return db[_0xbc20('0x30')][_0xbc20('0x50')]({'where':{'id':_0x3860cc['params']['id']}})['then'](handleEntityNotFound(_0xcf9795,null))['then'](saveUpdates(_0x3860cc[_0xbc20('0x5a')],null))[_0xbc20('0x26')](respondWithResult(_0xcf9795,null))[_0xbc20('0x48')](handleError(_0xcf9795,null));};exports[_0xbc20('0x27')]=function(_0x37214e,_0x31b2ce){return db[_0xbc20('0x30')]['find']({'where':{'id':_0x37214e['params']['id']}})[_0xbc20('0x26')](handleEntityNotFound(_0x31b2ce,null))['then'](removeEntity(_0x31b2ce,null))['catch'](handleError(_0x31b2ce,null));};exports['getHoppers']=function(_0x300376,_0x4e314f,_0x8a9e21){var _0x387a4c={'raw':!![],'where':{}};var _0x5a595c={};var _0x311898={'count':0x0,'rows':[]};return db['Campaign'][_0xbc20('0x5b')]({'where':{'id':_0x300376['params']['id']}})[_0xbc20('0x26')](handleEntityNotFound(_0x4e314f,null))[_0xbc20('0x26')](function(_0x4b1534){if(_0x4b1534){_0x5a595c[_0xbc20('0x35')]=_[_0xbc20('0x37')](db[_0xbc20('0x5c')][_0xbc20('0x31')]);_0x5a595c[_0xbc20('0x36')]=_[_0xbc20('0x37')](_0x300376[_0xbc20('0x36')]);_0x5a595c['filters']=_[_0xbc20('0x38')](_0x5a595c['model'],_0x5a595c[_0xbc20('0x36')]);_0x387a4c[_0xbc20('0x39')]=_['intersection'](_0x5a595c['model'],qs[_0xbc20('0x3a')](_0x300376[_0xbc20('0x36')]['fields']));_0x387a4c[_0xbc20('0x39')]=_0x387a4c[_0xbc20('0x39')]['length']?_0x387a4c['attributes']:_0x5a595c[_0xbc20('0x35')];if(!_0x300376['query'][_0xbc20('0x3c')]('nolimit')){_0x387a4c[_0xbc20('0x1f')]=qs['limit'](_0x300376[_0xbc20('0x36')]['limit']);_0x387a4c['offset']=qs[_0xbc20('0x1d')](_0x300376[_0xbc20('0x36')][_0xbc20('0x1d')]);}_0x387a4c[_0xbc20('0x3e')]=qs[_0xbc20('0x3f')](_0x300376[_0xbc20('0x36')][_0xbc20('0x3f')]);_0x387a4c[_0xbc20('0x40')]=qs[_0xbc20('0x41')](_[_0xbc20('0x5d')](_0x300376['query'],_0x5a595c[_0xbc20('0x41')]));_0x387a4c['where']['CampaignId']=_0x4b1534['id'];if(_0x300376[_0xbc20('0x36')][_0xbc20('0x5e')]){_0x387a4c[_0xbc20('0x40')]=_[_0xbc20('0x43')](_0x387a4c[_0xbc20('0x40')],{'$or':_['map'](_0x387a4c['attributes'],function(_0x1f6b17){var _0x1138fc={};_0x1138fc[_0x1f6b17]={'$like':'%'+_0x300376[_0xbc20('0x36')][_0xbc20('0x5e')]+'%'};return _0x1138fc;})});}_0x387a4c=_['merge']({},_0x387a4c,_0x300376['options']);return db[_0xbc20('0x5c')][_0xbc20('0x20')]({'where':_0x387a4c[_0xbc20('0x40')]})[_0xbc20('0x26')](function(_0x538ed7){_0x311898[_0xbc20('0x20')]=_0x538ed7;if(_0x300376[_0xbc20('0x36')]['includeAll']){_0x387a4c[_0xbc20('0x45')]=[{'all':!![]}];}return db[_0xbc20('0x5c')]['findAll'](_0x387a4c);})[_0xbc20('0x26')](function(_0x23515a){_0x311898['rows']=_0x23515a;return _0x311898;});}})['then'](respondWithFilteredResult(_0x4e314f,_0x387a4c))[_0xbc20('0x48')](handleError(_0x4e314f,null));};exports[_0xbc20('0x5f')]=function(_0x3e8385,_0xe6adee,_0x11b0a9){var _0x2fb229={'raw':!![],'where':{}};var _0xea5872={};var _0x99a252={'count':0x0,'rows':[]};return db[_0xbc20('0x30')][_0xbc20('0x5b')]({'where':{'id':_0x3e8385[_0xbc20('0x4a')]['id']}})[_0xbc20('0x26')](handleEntityNotFound(_0xe6adee,null))[_0xbc20('0x26')](function(_0x2a9f6e){if(_0x2a9f6e){_0xea5872[_0xbc20('0x35')]=_['keys'](db[_0xbc20('0x60')][_0xbc20('0x31')]);_0xea5872[_0xbc20('0x36')]=_[_0xbc20('0x37')](_0x3e8385['query']);_0xea5872[_0xbc20('0x41')]=_[_0xbc20('0x38')](_0xea5872[_0xbc20('0x35')],_0xea5872[_0xbc20('0x36')]);_0x2fb229[_0xbc20('0x39')]=_['intersection'](_0xea5872[_0xbc20('0x35')],qs[_0xbc20('0x3a')](_0x3e8385[_0xbc20('0x36')][_0xbc20('0x3a')]));_0x2fb229[_0xbc20('0x39')]=_0x2fb229[_0xbc20('0x39')][_0xbc20('0x3b')]?_0x2fb229['attributes']:_0xea5872['model'];if(!_0x3e8385[_0xbc20('0x36')][_0xbc20('0x3c')]('nolimit')){_0x2fb229[_0xbc20('0x1f')]=qs[_0xbc20('0x1f')](_0x3e8385[_0xbc20('0x36')][_0xbc20('0x1f')]);_0x2fb229['offset']=qs[_0xbc20('0x1d')](_0x3e8385[_0xbc20('0x36')][_0xbc20('0x1d')]);}_0x2fb229['order']=qs[_0xbc20('0x3f')](_0x3e8385[_0xbc20('0x36')]['sort']);_0x2fb229[_0xbc20('0x40')]=qs[_0xbc20('0x41')](_[_0xbc20('0x5d')](_0x3e8385['query'],_0xea5872[_0xbc20('0x41')]));_0x2fb229[_0xbc20('0x40')][_0xbc20('0x61')]=_0x2a9f6e['id'];if(_0x3e8385['query'][_0xbc20('0x5e')]){_0x2fb229[_0xbc20('0x40')]=_[_0xbc20('0x43')](_0x2fb229[_0xbc20('0x40')],{'$or':_[_0xbc20('0x2f')](_0x2fb229[_0xbc20('0x39')],function(_0x418481){var _0x3b8389={};_0x3b8389[_0x418481]={'$like':'%'+_0x3e8385[_0xbc20('0x36')][_0xbc20('0x5e')]+'%'};return _0x3b8389;})});}_0x2fb229=_[_0xbc20('0x43')]({},_0x2fb229,_0x3e8385['options']);return db[_0xbc20('0x60')][_0xbc20('0x20')]({'where':_0x2fb229[_0xbc20('0x40')]})[_0xbc20('0x26')](function(_0x43be24){_0x99a252[_0xbc20('0x20')]=_0x43be24;if(_0x3e8385[_0xbc20('0x36')][_0xbc20('0x56')]){_0x2fb229['include']=[{'all':!![]}];}return db[_0xbc20('0x60')][_0xbc20('0x46')](_0x2fb229);})['then'](function(_0xa87d5e){_0x99a252[_0xbc20('0x47')]=_0xa87d5e;return _0x99a252;});}})[_0xbc20('0x26')](respondWithFilteredResult(_0xe6adee,_0x2fb229))[_0xbc20('0x48')](handleError(_0xe6adee,null));};exports[_0xbc20('0x62')]=function(_0x47bf56,_0x3dea49,_0x25f1fc){var _0x27b2b8={'raw':!![],'where':{}};var _0x446a60={};var _0x22abc3={'count':0x0,'rows':[]};return db[_0xbc20('0x30')]['findOne']({'where':{'id':_0x47bf56['params']['id']}})[_0xbc20('0x26')](handleEntityNotFound(_0x3dea49,null))[_0xbc20('0x26')](function(_0x7d4734){if(_0x7d4734){_0x446a60[_0xbc20('0x35')]=_[_0xbc20('0x37')](db['CmHopperFinal']['rawAttributes']);_0x446a60[_0xbc20('0x36')]=_[_0xbc20('0x37')](_0x47bf56[_0xbc20('0x36')]);_0x446a60[_0xbc20('0x41')]=_['intersection'](_0x446a60['model'],_0x446a60[_0xbc20('0x36')]);_0x27b2b8[_0xbc20('0x39')]=_[_0xbc20('0x38')](_0x446a60[_0xbc20('0x35')],qs[_0xbc20('0x3a')](_0x47bf56[_0xbc20('0x36')]['fields']));_0x27b2b8[_0xbc20('0x39')]=_0x27b2b8[_0xbc20('0x39')]['length']?_0x27b2b8[_0xbc20('0x39')]:_0x446a60[_0xbc20('0x35')];if(!_0x47bf56[_0xbc20('0x36')][_0xbc20('0x3c')](_0xbc20('0x3d'))){_0x27b2b8['limit']=qs[_0xbc20('0x1f')](_0x47bf56['query'][_0xbc20('0x1f')]);_0x27b2b8[_0xbc20('0x1d')]=qs['offset'](_0x47bf56[_0xbc20('0x36')][_0xbc20('0x1d')]);}_0x27b2b8[_0xbc20('0x3e')]=qs[_0xbc20('0x3f')](_0x47bf56[_0xbc20('0x36')]['sort']);_0x27b2b8[_0xbc20('0x40')]=qs['filters'](_[_0xbc20('0x5d')](_0x47bf56['query'],_0x446a60[_0xbc20('0x41')]));_0x27b2b8['where'][_0xbc20('0x61')]=_0x7d4734['id'];if(_0x47bf56[_0xbc20('0x36')][_0xbc20('0x5e')]){_0x27b2b8[_0xbc20('0x40')]=_[_0xbc20('0x43')](_0x27b2b8[_0xbc20('0x40')],{'$or':_[_0xbc20('0x2f')](_0x27b2b8[_0xbc20('0x39')],function(_0xd1b2c4){var _0x43ab76={};_0x43ab76[_0xd1b2c4]={'$like':'%'+_0x47bf56[_0xbc20('0x36')][_0xbc20('0x5e')]+'%'};return _0x43ab76;})});}_0x27b2b8=_[_0xbc20('0x43')]({},_0x27b2b8,_0x47bf56[_0xbc20('0x44')]);return db[_0xbc20('0x63')][_0xbc20('0x20')]({'where':_0x27b2b8['where']})[_0xbc20('0x26')](function(_0x545d9e){_0x22abc3[_0xbc20('0x20')]=_0x545d9e;if(_0x47bf56[_0xbc20('0x36')]['includeAll']){_0x27b2b8['include']=[{'all':!![]}];}return db[_0xbc20('0x63')][_0xbc20('0x46')](_0x27b2b8);})[_0xbc20('0x26')](function(_0x4b3e50){_0x22abc3[_0xbc20('0x47')]=_0x4b3e50;return _0x22abc3;});}})[_0xbc20('0x26')](respondWithFilteredResult(_0x3dea49,_0x27b2b8))[_0xbc20('0x48')](handleError(_0x3dea49,null));};exports[_0xbc20('0x64')]=function(_0x130848,_0x20d578,_0x3cc266){var _0x476531={'raw':!![],'where':{}};var _0x4fb09a={};var _0x5c5c92={'count':0x0,'rows':[]};return db['Campaign'][_0xbc20('0x5b')]({'where':{'id':_0x130848[_0xbc20('0x4a')]['id']}})[_0xbc20('0x26')](handleEntityNotFound(_0x20d578,null))['then'](function(_0x39f6ef){if(_0x39f6ef){_0x4fb09a[_0xbc20('0x35')]=_[_0xbc20('0x37')](db['CmHopperBlack'][_0xbc20('0x31')]);_0x4fb09a[_0xbc20('0x36')]=_[_0xbc20('0x37')](_0x130848['query']);_0x4fb09a[_0xbc20('0x41')]=_[_0xbc20('0x38')](_0x4fb09a[_0xbc20('0x35')],_0x4fb09a[_0xbc20('0x36')]);_0x476531[_0xbc20('0x39')]=_[_0xbc20('0x38')](_0x4fb09a[_0xbc20('0x35')],qs[_0xbc20('0x3a')](_0x130848['query'][_0xbc20('0x3a')]));_0x476531['attributes']=_0x476531[_0xbc20('0x39')][_0xbc20('0x3b')]?_0x476531[_0xbc20('0x39')]:_0x4fb09a[_0xbc20('0x35')];if(!_0x130848[_0xbc20('0x36')][_0xbc20('0x3c')](_0xbc20('0x3d'))){_0x476531[_0xbc20('0x1f')]=qs[_0xbc20('0x1f')](_0x130848[_0xbc20('0x36')]['limit']);_0x476531[_0xbc20('0x1d')]=qs[_0xbc20('0x1d')](_0x130848[_0xbc20('0x36')][_0xbc20('0x1d')]);}_0x476531[_0xbc20('0x3e')]=qs[_0xbc20('0x3f')](_0x130848[_0xbc20('0x36')][_0xbc20('0x3f')]);_0x476531[_0xbc20('0x40')]=qs['filters'](_[_0xbc20('0x5d')](_0x130848[_0xbc20('0x36')],_0x4fb09a[_0xbc20('0x41')]));_0x476531[_0xbc20('0x40')][_0xbc20('0x61')]=_0x39f6ef['id'];if(_0x130848[_0xbc20('0x36')][_0xbc20('0x5e')]){_0x476531[_0xbc20('0x40')]=_[_0xbc20('0x43')](_0x476531[_0xbc20('0x40')],{'$or':_[_0xbc20('0x2f')](_0x476531[_0xbc20('0x39')],function(_0x4ddf70){var _0x1a78e3={};_0x1a78e3[_0x4ddf70]={'$like':'%'+_0x130848['query'][_0xbc20('0x5e')]+'%'};return _0x1a78e3;})});}_0x476531=_[_0xbc20('0x43')]({},_0x476531,_0x130848[_0xbc20('0x44')]);return db[_0xbc20('0x65')][_0xbc20('0x20')]({'where':_0x476531[_0xbc20('0x40')]})['then'](function(_0x429aae){_0x5c5c92['count']=_0x429aae;if(_0x130848['query'][_0xbc20('0x56')]){_0x476531['include']=[{'all':!![]}];}return db[_0xbc20('0x65')][_0xbc20('0x46')](_0x476531);})[_0xbc20('0x26')](function(_0xedf673){_0x5c5c92[_0xbc20('0x47')]=_0xedf673;return _0x5c5c92;});}})[_0xbc20('0x26')](respondWithFilteredResult(_0x20d578,_0x476531))[_0xbc20('0x48')](handleError(_0x20d578,null));};exports[_0xbc20('0x66')]=function(_0x73ffdf,_0x5d42d9,_0xf4d144){var _0x5f104d={};var _0x11e9bd={};var _0x265391;var _0x1214b1;return db['Campaign'][_0xbc20('0x5b')]({'where':{'id':_0x73ffdf[_0xbc20('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d42d9,null))[_0xbc20('0x26')](function(_0x1f25bb){if(_0x1f25bb){_0x265391=_0x1f25bb;_0x11e9bd['model']=_[_0xbc20('0x37')](db[_0xbc20('0x67')][_0xbc20('0x31')]);_0x11e9bd[_0xbc20('0x36')]=_[_0xbc20('0x37')](_0x73ffdf[_0xbc20('0x36')]);_0x11e9bd['filters']=_[_0xbc20('0x38')](_0x11e9bd['model'],_0x11e9bd['query']);_0x5f104d[_0xbc20('0x39')]=_['intersection'](_0x11e9bd[_0xbc20('0x35')],qs['fields'](_0x73ffdf['query']['fields']));_0x5f104d[_0xbc20('0x39')]=_0x5f104d['attributes'][_0xbc20('0x3b')]?_0x5f104d[_0xbc20('0x39')]:_0x11e9bd[_0xbc20('0x35')];_0x5f104d[_0xbc20('0x3e')]=qs['sort'](_0x73ffdf[_0xbc20('0x36')]['sort']);_0x5f104d['where']=qs[_0xbc20('0x41')](_[_0xbc20('0x5d')](_0x73ffdf[_0xbc20('0x36')],_0x11e9bd[_0xbc20('0x41')]));if(_0x73ffdf[_0xbc20('0x36')][_0xbc20('0x5e')]){_0x5f104d[_0xbc20('0x40')]=_[_0xbc20('0x43')](_0x5f104d[_0xbc20('0x40')],{'$or':_[_0xbc20('0x2f')](_0x5f104d[_0xbc20('0x39')],function(_0x1a6c35){var _0x6e7bcf={};_0x6e7bcf[_0x1a6c35]={'$like':'%'+_0x73ffdf[_0xbc20('0x36')][_0xbc20('0x5e')]+'%'};return _0x6e7bcf;})});}_0x5f104d=_[_0xbc20('0x43')]({},_0x5f104d,_0x73ffdf['options']);return _0x265391[_0xbc20('0x66')](_0x5f104d);}})[_0xbc20('0x26')](function(_0x6800db){if(_0x6800db){_0x1214b1=_0x6800db[_0xbc20('0x3b')];if(!_0x73ffdf['query'][_0xbc20('0x3c')]('nolimit')){_0x5f104d[_0xbc20('0x1f')]=qs['limit'](_0x73ffdf[_0xbc20('0x36')][_0xbc20('0x1f')]);_0x5f104d[_0xbc20('0x1d')]=qs[_0xbc20('0x1d')](_0x73ffdf['query'][_0xbc20('0x1d')]);}return _0x265391['getLists'](_0x5f104d);}})['then'](function(_0x38adb7){if(_0x38adb7){return _0x38adb7?{'count':_0x1214b1,'rows':_0x38adb7}:null;}})[_0xbc20('0x26')](respondWithResult(_0x5d42d9,null))[_0xbc20('0x48')](handleError(_0x5d42d9,null));};exports[_0xbc20('0x68')]=function(_0x525fce,_0x17faaa,_0x52067d){var _0x4a7a93,_0x1c793b;return db[_0xbc20('0x30')][_0xbc20('0x50')]({'where':{'id':_0x525fce[_0xbc20('0x4a')]['id']}})['then'](handleEntityNotFound(_0x17faaa,null))['then'](function(_0x41f9d6){if(_0x41f9d6){_0x1c793b=_0x41f9d6;return _0x41f9d6[_0xbc20('0x68')](_0x525fce[_0xbc20('0x5a')][_0xbc20('0x69')],_[_0xbc20('0x57')](_0x525fce[_0xbc20('0x5a')],['ids','id'])||{});}return null;})[_0xbc20('0x6a')](function(_0x58f40a){var _0x2e2113;_0x4a7a93=_0x58f40a||[];var _0x1eec85=[];if(_0x58f40a){for(var _0x596ec2=0x0;_0x596ec2<_0x58f40a['length'];_0x596ec2+=0x1){var _0x82efc6=_0x58f40a[_0x596ec2][_0xbc20('0x28')]({'plain':!![]});_0x1c793b[_0xbc20('0x6b')]=_0x525fce['body'][_0xbc20('0x6b')]?_0x525fce['body'][_0xbc20('0x6b')]:_0x1c793b['dialCheckDuplicateType'];switch(_0x1c793b[_0xbc20('0x6b')]){case _0xbc20('0x6c'):_0x2e2113=squel[_0xbc20('0x6d')]()['into'](_0xbc20('0x6e'))[_0xbc20('0x6f')]([_0xbc20('0x70'),_0xbc20('0x71'),_0xbc20('0x72'),_0xbc20('0x73'),_0xbc20('0x61'),_0xbc20('0x58'),_0xbc20('0x59')],squel[_0xbc20('0x74')]()['field'](_0xbc20('0x70'),_0xbc20('0x70'))[_0xbc20('0x75')](_0xbc20('0x76'),_0xbc20('0x71'))['field']('id',_0xbc20('0x72'))['field'](_0x82efc6['CmListId'][_0xbc20('0x77')](),'ListId')[_0xbc20('0x75')](_0x525fce[_0xbc20('0x4a')]['id'][_0xbc20('0x77')](),_0xbc20('0x61'))[_0xbc20('0x75')](_0xbc20('0x76'),_0xbc20('0x58'))[_0xbc20('0x75')](_0xbc20('0x76'),_0xbc20('0x59'))[_0xbc20('0x78')](_0xbc20('0x79'))[_0xbc20('0x40')](_0xbc20('0x7a'))[_0xbc20('0x40')](_0xbc20('0x7b'),_0x82efc6[_0xbc20('0x7c')][_0xbc20('0x77')]())[_0xbc20('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0xbc20('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbc20('0x74')]()[_0xbc20('0x75')](_0xbc20('0x7d'))[_0xbc20('0x78')](_0xbc20('0x7e'))[_0xbc20('0x40')]('CampaignId\x20=\x20?',_0x525fce[_0xbc20('0x4a')]['id'][_0xbc20('0x77')]()))[_0xbc20('0x40')](_0xbc20('0x7f'),squel[_0xbc20('0x74')]()['field'](_0xbc20('0x80'))[_0xbc20('0x78')](_0xbc20('0x6e'))[_0xbc20('0x40')]('CampaignId\x20=\x20?',_0x525fce[_0xbc20('0x4a')]['id'][_0xbc20('0x77')]())))['toString']();break;case _0xbc20('0x81'):_0x2e2113=squel[_0xbc20('0x6d')]()[_0xbc20('0x82')](_0xbc20('0x6e'))[_0xbc20('0x6f')]([_0xbc20('0x70'),'scheduledAt','ContactId',_0xbc20('0x73'),'CampaignId','createdAt',_0xbc20('0x59')],squel[_0xbc20('0x74')]()['field']('phone','phone')[_0xbc20('0x75')](_0xbc20('0x76'),_0xbc20('0x71'))['field']('id',_0xbc20('0x72'))['field'](_0x82efc6['CmListId'][_0xbc20('0x77')](),_0xbc20('0x73'))[_0xbc20('0x75')](_0x525fce[_0xbc20('0x4a')]['id'][_0xbc20('0x77')](),'CampaignId')['field'](_0xbc20('0x76'),_0xbc20('0x58'))['field'](_0xbc20('0x76'),_0xbc20('0x59'))[_0xbc20('0x78')](_0xbc20('0x79'))[_0xbc20('0x40')]('deletedAt\x20IS\x20NULL')[_0xbc20('0x40')](_0xbc20('0x7b'),_0x82efc6[_0xbc20('0x7c')]['toString']())[_0xbc20('0x40')](_0xbc20('0x83'))['where'](_0xbc20('0x7f'),squel[_0xbc20('0x74')]()['field'](_0xbc20('0x80'))[_0xbc20('0x78')](_0xbc20('0x6e'))['where']('CampaignId\x20=\x20?',_0x525fce['params']['id']['toString']())))[_0xbc20('0x77')]();break;default:_0x2e2113=squel[_0xbc20('0x6d')]()[_0xbc20('0x82')]('cm_hopper')[_0xbc20('0x6f')]([_0xbc20('0x70'),_0xbc20('0x71'),_0xbc20('0x72'),_0xbc20('0x73'),_0xbc20('0x61'),_0xbc20('0x58'),'updatedAt'],squel['select']()['field'](_0xbc20('0x70'),_0xbc20('0x70'))[_0xbc20('0x75')]('NOW()',_0xbc20('0x71'))['field']('id',_0xbc20('0x72'))[_0xbc20('0x75')](_0x82efc6[_0xbc20('0x7c')][_0xbc20('0x77')](),_0xbc20('0x73'))[_0xbc20('0x75')](_0x525fce['params']['id']['toString'](),_0xbc20('0x61'))['field'](_0xbc20('0x76'),_0xbc20('0x58'))['field'](_0xbc20('0x76'),'updatedAt')[_0xbc20('0x78')](_0xbc20('0x79'))[_0xbc20('0x40')](_0xbc20('0x7a'))[_0xbc20('0x40')]('ListId\x20=\x20?',_0x82efc6['CmListId'][_0xbc20('0x77')]())['where'](_0xbc20('0x83')))[_0xbc20('0x77')]();}_0x1eec85[_0xbc20('0x84')](db[_0xbc20('0x85')][_0xbc20('0x36')](_0x2e2113));}return BPromise[_0xbc20('0x86')](_0x1eec85);}})['then'](function(){return _0x4a7a93;})['then'](respondWithResult(_0x17faaa,null))[_0xbc20('0x48')](handleError(_0x17faaa,null));};exports[_0xbc20('0x87')]=function(_0x25eadb,_0x7ebf0e,_0x302c7b){return db[_0xbc20('0x30')]['find']({'where':{'id':_0x25eadb[_0xbc20('0x4a')]['id']}})[_0xbc20('0x26')](handleEntityNotFound(_0x7ebf0e,null))[_0xbc20('0x26')](function(_0x34fe88){if(_0x34fe88){return _0x34fe88[_0xbc20('0x87')](_0x25eadb[_0xbc20('0x36')][_0xbc20('0x69')]);}})[_0xbc20('0x26')](function(_0x598c97){if(_0x598c97){return db['CmHopper'][_0xbc20('0x27')]({'where':{'ListId':_0x25eadb[_0xbc20('0x36')]['ids'],'CampaignId':_0x25eadb[_0xbc20('0x4a')]['id']}})[_0xbc20('0x26')](function(){return _0x598c97;});}})[_0xbc20('0x26')](respondWithStatusCode(_0x7ebf0e,null))[_0xbc20('0x48')](handleError(_0x7ebf0e,null));};exports[_0xbc20('0x88')]=function(_0x207152,_0x431a12,_0x5f34ee){var _0x59e977={};var _0xe7e13c={};var _0x35cd3b;var _0x1e3761;return db[_0xbc20('0x30')][_0xbc20('0x5b')]({'where':{'id':_0x207152['params']['id']}})[_0xbc20('0x26')](handleEntityNotFound(_0x431a12,null))[_0xbc20('0x26')](function(_0x1d1288){if(_0x1d1288){_0x35cd3b=_0x1d1288;_0xe7e13c['model']=_[_0xbc20('0x37')](db[_0xbc20('0x67')][_0xbc20('0x31')]);_0xe7e13c[_0xbc20('0x36')]=_[_0xbc20('0x37')](_0x207152['query']);_0xe7e13c[_0xbc20('0x41')]=_[_0xbc20('0x38')](_0xe7e13c[_0xbc20('0x35')],_0xe7e13c[_0xbc20('0x36')]);_0x59e977[_0xbc20('0x39')]=_['intersection'](_0xe7e13c['model'],qs[_0xbc20('0x3a')](_0x207152['query'][_0xbc20('0x3a')]));_0x59e977['attributes']=_0x59e977[_0xbc20('0x39')][_0xbc20('0x3b')]?_0x59e977[_0xbc20('0x39')]:_0xe7e13c['model'];_0x59e977['order']=qs[_0xbc20('0x3f')](_0x207152[_0xbc20('0x36')][_0xbc20('0x3f')]);_0x59e977['where']=qs[_0xbc20('0x41')](_['pick'](_0x207152[_0xbc20('0x36')],_0xe7e13c['filters']));if(_0x207152['query']['filter']){_0x59e977[_0xbc20('0x40')]=_[_0xbc20('0x43')](_0x59e977[_0xbc20('0x40')],{'$or':_['map'](_0x59e977[_0xbc20('0x39')],function(_0x119190){var _0x481686={};_0x481686[_0x119190]={'$like':'%'+_0x207152['query'][_0xbc20('0x5e')]+'%'};return _0x481686;})});}_0x59e977=_['merge']({},_0x59e977,_0x207152['options']);return _0x35cd3b['getBlackLists'](_0x59e977);}})[_0xbc20('0x26')](function(_0x21933a){if(_0x21933a){_0x1e3761=_0x21933a['length'];if(!_0x207152[_0xbc20('0x36')][_0xbc20('0x3c')](_0xbc20('0x3d'))){_0x59e977[_0xbc20('0x1f')]=qs[_0xbc20('0x1f')](_0x207152[_0xbc20('0x36')][_0xbc20('0x1f')]);_0x59e977[_0xbc20('0x1d')]=qs[_0xbc20('0x1d')](_0x207152['query'][_0xbc20('0x1d')]);}return _0x35cd3b[_0xbc20('0x88')](_0x59e977);}})['then'](function(_0x4748d0){if(_0x4748d0){return _0x4748d0?{'count':_0x1e3761,'rows':_0x4748d0}:null;}})[_0xbc20('0x26')](respondWithResult(_0x431a12,null))['catch'](handleError(_0x431a12,null));};exports['addBlackLists']=function(_0xe2e2b1,_0x1aed36,_0x2117bf){var _0x50c514,_0x1642e8;return db[_0xbc20('0x30')][_0xbc20('0x50')]({'where':{'id':_0xe2e2b1[_0xbc20('0x4a')]['id']}})[_0xbc20('0x26')](handleEntityNotFound(_0x1aed36,null))[_0xbc20('0x26')](function(_0x4fbd70){if(_0x4fbd70){_0x1642e8=_0x4fbd70;return _0x4fbd70['addBlackLists'](_0xe2e2b1[_0xbc20('0x5a')][_0xbc20('0x69')],_[_0xbc20('0x57')](_0xe2e2b1[_0xbc20('0x5a')],[_0xbc20('0x69'),'id'])||{});}return null;})[_0xbc20('0x6a')](function(_0x1f254a){var _0x3b0ee9;_0x50c514=_0x1f254a||[];var _0x30c09f=[];if(_0x1f254a){for(var _0x3d7465=0x0;_0x3d7465<_0x1f254a[_0xbc20('0x3b')];_0x3d7465+=0x1){var _0x58afa7=_0x1f254a[_0x3d7465]['get']({'plain':!![]});_0x3b0ee9=squel[_0xbc20('0x6d')]()[_0xbc20('0x82')]('cm_hopper_black')['fromQuery'](['phone',_0xbc20('0x72'),_0xbc20('0x73'),_0xbc20('0x61'),'createdAt',_0xbc20('0x59')],squel['select']()[_0xbc20('0x75')]('phone',_0xbc20('0x70'))[_0xbc20('0x75')]('id',_0xbc20('0x72'))[_0xbc20('0x75')](_0x58afa7[_0xbc20('0x7c')][_0xbc20('0x77')](),'ListId')[_0xbc20('0x75')](_0xe2e2b1['params']['id']['toString'](),_0xbc20('0x61'))[_0xbc20('0x75')]('NOW()',_0xbc20('0x58'))['field'](_0xbc20('0x76'),'updatedAt')[_0xbc20('0x78')](_0xbc20('0x79'))['where'](_0xbc20('0x7a'))[_0xbc20('0x40')](_0xbc20('0x7b'),_0x58afa7[_0xbc20('0x7c')][_0xbc20('0x77')]())[_0xbc20('0x40')](_0xbc20('0x83')))[_0xbc20('0x77')]();_0x30c09f[_0xbc20('0x84')](db['sequelize'][_0xbc20('0x36')](_0x3b0ee9));}return BPromise[_0xbc20('0x86')](_0x30c09f);}})[_0xbc20('0x26')](function(){return _0x50c514;})[_0xbc20('0x26')](respondWithResult(_0x1aed36,null))[_0xbc20('0x48')](handleError(_0x1aed36,null));};exports[_0xbc20('0x89')]=function(_0x382ca5,_0x1a7ee4,_0x5d1e81){return db[_0xbc20('0x30')][_0xbc20('0x50')]({'where':{'id':_0x382ca5[_0xbc20('0x4a')]['id']}})[_0xbc20('0x26')](handleEntityNotFound(_0x1a7ee4,null))[_0xbc20('0x26')](function(_0x2af187){if(_0x2af187){return _0x2af187['removeBlackLists'](_0x382ca5[_0xbc20('0x36')][_0xbc20('0x69')]);}})[_0xbc20('0x26')](function(_0x2e070b){if(_0x2e070b){return db[_0xbc20('0x65')]['destroy']({'where':{'ListId':_0x382ca5['query'][_0xbc20('0x69')],'CampaignId':_0x382ca5[_0xbc20('0x4a')]['id']}})['then'](function(){return _0x2e070b;});}})[_0xbc20('0x26')](respondWithStatusCode(_0x1a7ee4,null))['catch'](handleError(_0x1a7ee4,null));}; \ No newline at end of file +var _0x352a=['omit','updatedAt','createdAt','getHoppers','CmHopper','order','CampaignId','getHopperHistories','CmHopperHistory','findOne','CmHopperFinal','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','insert','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','removeLists','CmList','getBlackLists','addBlackLists','push','sequelize','all','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x221b48,_0x18067f){var _0x360677=function(_0x1def10){while(--_0x1def10){_0x221b48['push'](_0x221b48['shift']());}};_0x360677(++_0x18067f);}(_0x352a,0x1cf));var _0xa352=function(_0x582c98,_0x53b3a0){_0x582c98=_0x582c98-0x0;var _0x593449=_0x352a[_0x582c98];return _0x593449;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa352('0x0'));var jsonpatch=require(_0xa352('0x1'));var rp=require(_0xa352('0x2'));var moment=require(_0xa352('0x3'));var BPromise=require(_0xa352('0x4'));var Mustache=require(_0xa352('0x5'));var util=require(_0xa352('0x6'));var path=require(_0xa352('0x7'));var sox=require(_0xa352('0x8'));var csv=require(_0xa352('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa352('0xa'));var _=require(_0xa352('0xb'));var squel=require(_0xa352('0xc'));var crypto=require(_0xa352('0xd'));var jsforce=require(_0xa352('0xe'));var deskjs=require(_0xa352('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa352('0x10'));var Redis=require(_0xa352('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa352('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa352('0x13'));var logger=require(_0xa352('0x14'))(_0xa352('0x15'));var utils=require(_0xa352('0x16'));var config=require(_0xa352('0x17'));var licenseUtil=require(_0xa352('0x18'));var db=require(_0xa352('0x19'))['db'];function respondWithStatusCode(_0x1d67cc,_0x1d48b7){_0x1d48b7=_0x1d48b7||0xcc;return function(_0x78f114){if(_0x78f114){return _0x1d67cc[_0xa352('0x1a')](_0x1d48b7);}return _0x1d67cc[_0xa352('0x1b')](_0x1d48b7)[_0xa352('0x1c')]();};}function respondWithResult(_0x41661a,_0x4e0944){_0x4e0944=_0x4e0944||0xc8;return function(_0x25cbb8){if(_0x25cbb8){return _0x41661a[_0xa352('0x1b')](_0x4e0944)[_0xa352('0x1d')](_0x25cbb8);}};}function respondWithFilteredResult(_0x58711f,_0x5c2495){return function(_0x47afb9){if(_0x47afb9){var _0x386f74=typeof _0x5c2495[_0xa352('0x1e')]==='undefined'&&typeof _0x5c2495['limit']===_0xa352('0x1f');var _0x40000d=_0x47afb9[_0xa352('0x20')];var _0x36109a=_0x386f74?0x0:_0x5c2495[_0xa352('0x1e')];var _0x4e9aba=_0x386f74?_0x47afb9[_0xa352('0x20')]:_0x5c2495[_0xa352('0x1e')]+_0x5c2495[_0xa352('0x21')];var _0x4c638e;if(_0x4e9aba>=_0x40000d){_0x4e9aba=_0x40000d;_0x4c638e=0xc8;}else{_0x4c638e=0xce;}_0x58711f['status'](_0x4c638e);return _0x58711f[_0xa352('0x22')](_0xa352('0x23'),_0x36109a+'-'+_0x4e9aba+'/'+_0x40000d)['json'](_0x47afb9);}return null;};}function patchUpdates(_0x8f7708){return function(_0x18ea7d){try{jsonpatch[_0xa352('0x24')](_0x18ea7d,_0x8f7708,!![]);}catch(_0x537684){return BPromise[_0xa352('0x25')](_0x537684);}return _0x18ea7d[_0xa352('0x26')]();};}function saveUpdates(_0x5ec290,_0x185568){return function(_0x23b937){if(_0x23b937){return _0x23b937[_0xa352('0x27')](_0x5ec290)[_0xa352('0x28')](function(_0x449e67){return _0x449e67;});}return null;};}function removeEntity(_0x33efa3,_0x5ae928){return function(_0x360e7d){if(_0x360e7d){return _0x360e7d[_0xa352('0x29')]()[_0xa352('0x28')](function(){var _0x20a207=_0x360e7d[_0xa352('0x2a')]({'plain':!![]});var _0x95168=_0xa352('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x95168,'resourceId':_0x20a207['id']}})[_0xa352('0x28')](function(){return _0x360e7d;});})[_0xa352('0x28')](function(){_0x33efa3[_0xa352('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ce9f8,_0x133c98){return function(_0x102730){if(!_0x102730){_0x2ce9f8[_0xa352('0x1a')](0x194);}return _0x102730;};}function handleError(_0x23fadb,_0x3069f0){_0x3069f0=_0x3069f0||0x1f4;return function(_0x495332){logger[_0xa352('0x2c')](_0x495332[_0xa352('0x2d')]);if(_0x495332['name']){delete _0x495332[_0xa352('0x2e')];}_0x23fadb[_0xa352('0x1b')](_0x3069f0)['send'](_0x495332);};}exports[_0xa352('0x2f')]=function(_0x272659,_0x47a32e){var _0x443efd={},_0x50e4f0={},_0x8406b8={'count':0x0,'rows':[]};var _0xa61354=_[_0xa352('0x30')](db[_0xa352('0x31')][_0xa352('0x32')],function(_0x1847a8){return{'name':_0x1847a8[_0xa352('0x33')],'type':_0x1847a8[_0xa352('0x34')][_0xa352('0x35')]};});_0x50e4f0[_0xa352('0x36')]=_[_0xa352('0x30')](_0xa61354,'name');_0x50e4f0[_0xa352('0x37')]=_[_0xa352('0x38')](_0x272659[_0xa352('0x37')]);_0x50e4f0[_0xa352('0x39')]=_[_0xa352('0x3a')](_0x50e4f0[_0xa352('0x36')],_0x50e4f0[_0xa352('0x37')]);_0x443efd[_0xa352('0x3b')]=_['intersection'](_0x50e4f0['model'],qs[_0xa352('0x3c')](_0x272659[_0xa352('0x37')][_0xa352('0x3c')]));_0x443efd[_0xa352('0x3b')]=_0x443efd[_0xa352('0x3b')]['length']?_0x443efd[_0xa352('0x3b')]:_0x50e4f0['model'];if(!_0x272659[_0xa352('0x37')][_0xa352('0x3d')](_0xa352('0x3e'))){_0x443efd['limit']=qs['limit'](_0x272659['query'][_0xa352('0x21')]);_0x443efd[_0xa352('0x1e')]=qs['offset'](_0x272659[_0xa352('0x37')][_0xa352('0x1e')]);}_0x443efd['order']=qs['sort'](_0x272659['query'][_0xa352('0x3f')]);_0x443efd[_0xa352('0x40')]=qs[_0xa352('0x39')](_[_0xa352('0x41')](_0x272659[_0xa352('0x37')],_0x50e4f0[_0xa352('0x39')]),_0xa61354);if(_0x272659[_0xa352('0x37')][_0xa352('0x42')]){_0x443efd[_0xa352('0x40')]=_[_0xa352('0x43')](_0x443efd[_0xa352('0x40')],{'$or':_[_0xa352('0x30')](_0xa61354,function(_0x4e0f7f){if(_0x4e0f7f[_0xa352('0x34')]!==_0xa352('0x44')){var _0x5eb3f0={};_0x5eb3f0[_0x4e0f7f[_0xa352('0x2e')]]={'$like':'%'+_0x272659['query'][_0xa352('0x42')]+'%'};return _0x5eb3f0;}})});}_0x443efd=_['merge']({},_0x443efd,_0x272659[_0xa352('0x45')]);var _0x2ac1ee={'where':_0x443efd[_0xa352('0x40')]};return db[_0xa352('0x31')][_0xa352('0x20')](_0x2ac1ee)['then'](function(_0x24f8c5){_0x8406b8['count']=_0x24f8c5;if(_0x272659[_0xa352('0x37')][_0xa352('0x46')]){_0x443efd[_0xa352('0x47')]=[{'all':!![]}];}return db['Campaign'][_0xa352('0x48')](_0x443efd);})[_0xa352('0x28')](function(_0x341b1a){_0x8406b8[_0xa352('0x49')]=_0x341b1a;return _0x8406b8;})[_0xa352('0x28')](respondWithFilteredResult(_0x47a32e,_0x443efd))['catch'](handleError(_0x47a32e,null));};exports[_0xa352('0x4a')]=function(_0x4c4ca7,_0x4abdd4){var _0x5d94ce={'raw':![],'where':{'id':_0x4c4ca7[_0xa352('0x4b')]['id']}},_0x3ad3c0={};_0x3ad3c0[_0xa352('0x36')]=_['keys'](db[_0xa352('0x31')][_0xa352('0x32')]);_0x3ad3c0['query']=_[_0xa352('0x38')](_0x4c4ca7[_0xa352('0x37')]);_0x3ad3c0[_0xa352('0x39')]=_[_0xa352('0x3a')](_0x3ad3c0['model'],_0x3ad3c0['query']);_0x5d94ce[_0xa352('0x3b')]=_[_0xa352('0x3a')](_0x3ad3c0[_0xa352('0x36')],qs[_0xa352('0x3c')](_0x4c4ca7[_0xa352('0x37')][_0xa352('0x3c')]));_0x5d94ce[_0xa352('0x3b')]=_0x5d94ce[_0xa352('0x3b')][_0xa352('0x4c')]?_0x5d94ce[_0xa352('0x3b')]:_0x3ad3c0[_0xa352('0x36')];if(_0x4c4ca7[_0xa352('0x37')][_0xa352('0x46')]){_0x5d94ce[_0xa352('0x47')]=[{'all':!![]}];}_0x5d94ce=_[_0xa352('0x43')]({},_0x5d94ce,_0x4c4ca7[_0xa352('0x45')]);return db[_0xa352('0x31')]['find'](_0x5d94ce)[_0xa352('0x28')](handleEntityNotFound(_0x4abdd4,null))[_0xa352('0x28')](respondWithResult(_0x4abdd4,null))[_0xa352('0x4d')](handleError(_0x4abdd4,null));};exports[_0xa352('0x4e')]=function(_0x4f37a9,_0x3bccde){return db['Campaign'][_0xa352('0x4e')](_0x4f37a9[_0xa352('0x4f')],{})[_0xa352('0x28')](function(_0x56cf36){var _0x57ef1a=_0x4f37a9[_0xa352('0x50')][_0xa352('0x2a')]({'plain':!![]});if(!_0x57ef1a)throw new Error(_0xa352('0x51'));if(_0x57ef1a[_0xa352('0x52')]===_0xa352('0x50')){var _0x892b25=_0x56cf36['get']({'plain':!![]});var _0x10c5fe=_0xa352('0x2b');return db[_0xa352('0x53')][_0xa352('0x54')]({'where':{'name':_0x10c5fe,'userProfileId':_0x57ef1a[_0xa352('0x55')]},'raw':!![]})[_0xa352('0x28')](function(_0x57dec4){if(_0x57dec4&&_0x57dec4[_0xa352('0x56')]===0x0){return db[_0xa352('0x57')]['create']({'name':_0x892b25[_0xa352('0x2e')],'resourceId':_0x892b25['id'],'type':_0x57dec4[_0xa352('0x2e')],'sectionId':_0x57dec4['id']},{})[_0xa352('0x28')](function(){return _0x56cf36;});}else{return _0x56cf36;}})[_0xa352('0x4d')](function(_0x20b9f6){logger[_0xa352('0x2c')](_0xa352('0x58'),_0x20b9f6);throw _0x20b9f6;});}return _0x56cf36;})[_0xa352('0x28')](respondWithResult(_0x3bccde,0xc9))[_0xa352('0x4d')](handleError(_0x3bccde,null));};exports['clone']=function(_0x5d433a,_0x297506){var _0x1f67cb={'where':{'id':_0x5d433a[_0xa352('0x4b')]['id']}},_0x1cbb2e={};_0x1cbb2e[_0xa352('0x36')]=_[_0xa352('0x38')](db[_0xa352('0x31')][_0xa352('0x32')]);_0x1f67cb[_0xa352('0x3b')]=_['intersection'](_0x1cbb2e[_0xa352('0x36')],qs[_0xa352('0x3c')](_0x5d433a[_0xa352('0x37')]['fields']));_0x1f67cb[_0xa352('0x3b')]=_0x1f67cb[_0xa352('0x3b')][_0xa352('0x4c')]?_0x1f67cb['attributes']:_0x1cbb2e['model'];if(_0x5d433a[_0xa352('0x37')][_0xa352('0x46')]){_0x1f67cb['include']=[{'all':!![]}];}_0x1f67cb=_[_0xa352('0x43')]({},_0x1f67cb,_0x5d433a[_0xa352('0x45')]);return db['Campaign'][_0xa352('0x54')](_0x1f67cb)[_0xa352('0x28')](handleEntityNotFound(_0x297506,null))['then'](function(_0x128ead){if(_0x128ead){var _0x4649cc=_0x128ead['get']({'plain':!![]});_0x4649cc=qs[_0xa352('0x59')](_0x4649cc,['id','createdAt',_0xa352('0x5a')]);_0x5d433a['body']=_[_0xa352('0x59')](_0x5d433a[_0xa352('0x4f')],['id',_0xa352('0x5b'),_0xa352('0x5a')]);return db[_0xa352('0x31')][_0xa352('0x4e')](_['merge'](_0x4649cc,_0x5d433a[_0xa352('0x4f')]),{'include':_0x5d433a['query']['includeAll']?[{'all':!![]}]:undefined})[_0xa352('0x28')](function(_0x48fbc5){var _0x472e0d=_0x5d433a[_0xa352('0x50')][_0xa352('0x2a')]({'plain':!![]});if(!_0x472e0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x472e0d['role']==='user'){var _0x31848f=_0x48fbc5[_0xa352('0x2a')]({'plain':!![]});var _0x211d77=_0xa352('0x2b');return db[_0xa352('0x53')]['find']({'where':{'name':_0x211d77,'userProfileId':_0x472e0d[_0xa352('0x55')]},'raw':!![]})[_0xa352('0x28')](function(_0x337c81){if(_0x337c81&&_0x337c81['autoAssociation']===0x0){return db[_0xa352('0x57')][_0xa352('0x4e')]({'name':_0x31848f[_0xa352('0x2e')],'resourceId':_0x31848f['id'],'type':_0x337c81[_0xa352('0x2e')],'sectionId':_0x337c81['id']},{})[_0xa352('0x28')](function(){return _0x48fbc5;});}else{return _0x48fbc5;}})[_0xa352('0x4d')](function(_0x14074b){logger[_0xa352('0x2c')](_0xa352('0x58'),_0x14074b);throw _0x14074b;});}return _0x48fbc5;});}})[_0xa352('0x28')](respondWithResult(_0x297506,0xc9))[_0xa352('0x4d')](handleError(_0x297506,null));};exports[_0xa352('0x27')]=function(_0xa2a6fd,_0x1da2de){if(_0xa2a6fd[_0xa352('0x4f')]['id']){delete _0xa2a6fd[_0xa352('0x4f')]['id'];}return db[_0xa352('0x31')][_0xa352('0x54')]({'where':{'id':_0xa2a6fd[_0xa352('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1da2de,null))[_0xa352('0x28')](saveUpdates(_0xa2a6fd['body'],null))[_0xa352('0x28')](respondWithResult(_0x1da2de,null))[_0xa352('0x4d')](handleError(_0x1da2de,null));};exports[_0xa352('0x29')]=function(_0x27e670,_0x70ee12){return db['Campaign']['find']({'where':{'id':_0x27e670[_0xa352('0x4b')]['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x70ee12,null))[_0xa352('0x28')](removeEntity(_0x70ee12,null))[_0xa352('0x4d')](handleError(_0x70ee12,null));};exports[_0xa352('0x5c')]=function(_0x300669,_0x49f100,_0x46ca7b){var _0x205733={'raw':!![],'where':{}};var _0x377769={};var _0x45df9c={'count':0x0,'rows':[]};return db[_0xa352('0x31')]['findOne']({'where':{'id':_0x300669[_0xa352('0x4b')]['id']}})['then'](handleEntityNotFound(_0x49f100,null))[_0xa352('0x28')](function(_0x1c2d44){if(_0x1c2d44){_0x377769['model']=_['keys'](db[_0xa352('0x5d')]['rawAttributes']);_0x377769[_0xa352('0x37')]=_['keys'](_0x300669[_0xa352('0x37')]);_0x377769['filters']=_[_0xa352('0x3a')](_0x377769[_0xa352('0x36')],_0x377769[_0xa352('0x37')]);_0x205733[_0xa352('0x3b')]=_[_0xa352('0x3a')](_0x377769[_0xa352('0x36')],qs[_0xa352('0x3c')](_0x300669[_0xa352('0x37')][_0xa352('0x3c')]));_0x205733[_0xa352('0x3b')]=_0x205733[_0xa352('0x3b')][_0xa352('0x4c')]?_0x205733[_0xa352('0x3b')]:_0x377769[_0xa352('0x36')];if(!_0x300669['query'][_0xa352('0x3d')](_0xa352('0x3e'))){_0x205733[_0xa352('0x21')]=qs[_0xa352('0x21')](_0x300669['query'][_0xa352('0x21')]);_0x205733[_0xa352('0x1e')]=qs['offset'](_0x300669[_0xa352('0x37')][_0xa352('0x1e')]);}_0x205733[_0xa352('0x5e')]=qs[_0xa352('0x3f')](_0x300669[_0xa352('0x37')][_0xa352('0x3f')]);_0x205733[_0xa352('0x40')]=qs['filters'](_[_0xa352('0x41')](_0x300669[_0xa352('0x37')],_0x377769[_0xa352('0x39')]));_0x205733[_0xa352('0x40')][_0xa352('0x5f')]=_0x1c2d44['id'];if(_0x300669[_0xa352('0x37')][_0xa352('0x42')]){_0x205733['where']=_[_0xa352('0x43')](_0x205733[_0xa352('0x40')],{'$or':_['map'](_0x205733[_0xa352('0x3b')],function(_0x38ae8c){var _0x5d9441={};_0x5d9441[_0x38ae8c]={'$like':'%'+_0x300669['query'][_0xa352('0x42')]+'%'};return _0x5d9441;})});}_0x205733=_['merge']({},_0x205733,_0x300669[_0xa352('0x45')]);return db[_0xa352('0x5d')][_0xa352('0x20')]({'where':_0x205733[_0xa352('0x40')]})[_0xa352('0x28')](function(_0x4b84af){_0x45df9c[_0xa352('0x20')]=_0x4b84af;if(_0x300669[_0xa352('0x37')][_0xa352('0x46')]){_0x205733['include']=[{'all':!![]}];}return db['CmHopper'][_0xa352('0x48')](_0x205733);})[_0xa352('0x28')](function(_0x5542b4){_0x45df9c['rows']=_0x5542b4;return _0x45df9c;});}})[_0xa352('0x28')](respondWithFilteredResult(_0x49f100,_0x205733))['catch'](handleError(_0x49f100,null));};exports[_0xa352('0x60')]=function(_0x9d98c2,_0x7e77b4,_0x226833){var _0x1d17ca={'raw':!![],'where':{}};var _0x403b07={};var _0x2269ab={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x9d98c2[_0xa352('0x4b')]['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x7e77b4,null))['then'](function(_0x5b9815){if(_0x5b9815){_0x403b07[_0xa352('0x36')]=_[_0xa352('0x38')](db[_0xa352('0x61')][_0xa352('0x32')]);_0x403b07[_0xa352('0x37')]=_['keys'](_0x9d98c2[_0xa352('0x37')]);_0x403b07[_0xa352('0x39')]=_[_0xa352('0x3a')](_0x403b07['model'],_0x403b07[_0xa352('0x37')]);_0x1d17ca['attributes']=_[_0xa352('0x3a')](_0x403b07[_0xa352('0x36')],qs['fields'](_0x9d98c2[_0xa352('0x37')]['fields']));_0x1d17ca['attributes']=_0x1d17ca['attributes'][_0xa352('0x4c')]?_0x1d17ca[_0xa352('0x3b')]:_0x403b07[_0xa352('0x36')];if(!_0x9d98c2[_0xa352('0x37')][_0xa352('0x3d')](_0xa352('0x3e'))){_0x1d17ca[_0xa352('0x21')]=qs['limit'](_0x9d98c2['query'][_0xa352('0x21')]);_0x1d17ca[_0xa352('0x1e')]=qs['offset'](_0x9d98c2['query']['offset']);}_0x1d17ca[_0xa352('0x5e')]=qs['sort'](_0x9d98c2[_0xa352('0x37')]['sort']);_0x1d17ca[_0xa352('0x40')]=qs['filters'](_['pick'](_0x9d98c2[_0xa352('0x37')],_0x403b07['filters']));_0x1d17ca['where'][_0xa352('0x5f')]=_0x5b9815['id'];if(_0x9d98c2[_0xa352('0x37')][_0xa352('0x42')]){_0x1d17ca[_0xa352('0x40')]=_['merge'](_0x1d17ca['where'],{'$or':_[_0xa352('0x30')](_0x1d17ca[_0xa352('0x3b')],function(_0x11a892){var _0x147285={};_0x147285[_0x11a892]={'$like':'%'+_0x9d98c2[_0xa352('0x37')][_0xa352('0x42')]+'%'};return _0x147285;})});}_0x1d17ca=_[_0xa352('0x43')]({},_0x1d17ca,_0x9d98c2['options']);return db[_0xa352('0x61')][_0xa352('0x20')]({'where':_0x1d17ca[_0xa352('0x40')]})['then'](function(_0x4cad83){_0x2269ab[_0xa352('0x20')]=_0x4cad83;if(_0x9d98c2[_0xa352('0x37')][_0xa352('0x46')]){_0x1d17ca[_0xa352('0x47')]=[{'all':!![]}];}return db[_0xa352('0x61')]['findAll'](_0x1d17ca);})['then'](function(_0x58cf70){_0x2269ab['rows']=_0x58cf70;return _0x2269ab;});}})[_0xa352('0x28')](respondWithFilteredResult(_0x7e77b4,_0x1d17ca))[_0xa352('0x4d')](handleError(_0x7e77b4,null));};exports['getHopperFinals']=function(_0x22e14f,_0x3107f1,_0x45d0bc){var _0x4a496c={'raw':!![],'where':{}};var _0x5a4974={};var _0x3739f9={'count':0x0,'rows':[]};return db[_0xa352('0x31')][_0xa352('0x62')]({'where':{'id':_0x22e14f['params']['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x3107f1,null))[_0xa352('0x28')](function(_0x45ca82){if(_0x45ca82){_0x5a4974[_0xa352('0x36')]=_[_0xa352('0x38')](db[_0xa352('0x63')][_0xa352('0x32')]);_0x5a4974[_0xa352('0x37')]=_[_0xa352('0x38')](_0x22e14f['query']);_0x5a4974[_0xa352('0x39')]=_[_0xa352('0x3a')](_0x5a4974[_0xa352('0x36')],_0x5a4974[_0xa352('0x37')]);_0x4a496c['attributes']=_[_0xa352('0x3a')](_0x5a4974['model'],qs['fields'](_0x22e14f[_0xa352('0x37')][_0xa352('0x3c')]));_0x4a496c['attributes']=_0x4a496c[_0xa352('0x3b')][_0xa352('0x4c')]?_0x4a496c['attributes']:_0x5a4974['model'];if(!_0x22e14f[_0xa352('0x37')][_0xa352('0x3d')](_0xa352('0x3e'))){_0x4a496c['limit']=qs[_0xa352('0x21')](_0x22e14f[_0xa352('0x37')][_0xa352('0x21')]);_0x4a496c[_0xa352('0x1e')]=qs['offset'](_0x22e14f[_0xa352('0x37')][_0xa352('0x1e')]);}_0x4a496c['order']=qs[_0xa352('0x3f')](_0x22e14f[_0xa352('0x37')]['sort']);_0x4a496c[_0xa352('0x40')]=qs[_0xa352('0x39')](_[_0xa352('0x41')](_0x22e14f[_0xa352('0x37')],_0x5a4974['filters']));_0x4a496c[_0xa352('0x40')][_0xa352('0x5f')]=_0x45ca82['id'];if(_0x22e14f['query'][_0xa352('0x42')]){_0x4a496c['where']=_[_0xa352('0x43')](_0x4a496c['where'],{'$or':_[_0xa352('0x30')](_0x4a496c[_0xa352('0x3b')],function(_0x142638){var _0x3db962={};_0x3db962[_0x142638]={'$like':'%'+_0x22e14f[_0xa352('0x37')][_0xa352('0x42')]+'%'};return _0x3db962;})});}_0x4a496c=_[_0xa352('0x43')]({},_0x4a496c,_0x22e14f[_0xa352('0x45')]);return db[_0xa352('0x63')][_0xa352('0x20')]({'where':_0x4a496c['where']})['then'](function(_0x558d0d){_0x3739f9['count']=_0x558d0d;if(_0x22e14f[_0xa352('0x37')][_0xa352('0x46')]){_0x4a496c[_0xa352('0x47')]=[{'all':!![]}];}return db[_0xa352('0x63')][_0xa352('0x48')](_0x4a496c);})['then'](function(_0x38e7ca){_0x3739f9['rows']=_0x38e7ca;return _0x3739f9;});}})[_0xa352('0x28')](respondWithFilteredResult(_0x3107f1,_0x4a496c))[_0xa352('0x4d')](handleError(_0x3107f1,null));};exports['getHopperBlacks']=function(_0x2434ba,_0x3c5a41,_0x4f336a){var _0x221b69={'raw':!![],'where':{}};var _0x1158f2={};var _0x29ae0f={'count':0x0,'rows':[]};return db[_0xa352('0x31')][_0xa352('0x62')]({'where':{'id':_0x2434ba[_0xa352('0x4b')]['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x3c5a41,null))[_0xa352('0x28')](function(_0x343b29){if(_0x343b29){_0x1158f2[_0xa352('0x36')]=_['keys'](db[_0xa352('0x64')]['rawAttributes']);_0x1158f2[_0xa352('0x37')]=_[_0xa352('0x38')](_0x2434ba[_0xa352('0x37')]);_0x1158f2[_0xa352('0x39')]=_['intersection'](_0x1158f2['model'],_0x1158f2[_0xa352('0x37')]);_0x221b69['attributes']=_[_0xa352('0x3a')](_0x1158f2['model'],qs[_0xa352('0x3c')](_0x2434ba[_0xa352('0x37')][_0xa352('0x3c')]));_0x221b69[_0xa352('0x3b')]=_0x221b69[_0xa352('0x3b')][_0xa352('0x4c')]?_0x221b69[_0xa352('0x3b')]:_0x1158f2['model'];if(!_0x2434ba['query'][_0xa352('0x3d')](_0xa352('0x3e'))){_0x221b69[_0xa352('0x21')]=qs[_0xa352('0x21')](_0x2434ba['query'][_0xa352('0x21')]);_0x221b69['offset']=qs['offset'](_0x2434ba[_0xa352('0x37')][_0xa352('0x1e')]);}_0x221b69[_0xa352('0x5e')]=qs['sort'](_0x2434ba[_0xa352('0x37')][_0xa352('0x3f')]);_0x221b69[_0xa352('0x40')]=qs[_0xa352('0x39')](_[_0xa352('0x41')](_0x2434ba[_0xa352('0x37')],_0x1158f2[_0xa352('0x39')]));_0x221b69[_0xa352('0x40')]['CampaignId']=_0x343b29['id'];if(_0x2434ba['query'][_0xa352('0x42')]){_0x221b69[_0xa352('0x40')]=_[_0xa352('0x43')](_0x221b69[_0xa352('0x40')],{'$or':_[_0xa352('0x30')](_0x221b69[_0xa352('0x3b')],function(_0x348b4a){var _0xdfaa5f={};_0xdfaa5f[_0x348b4a]={'$like':'%'+_0x2434ba[_0xa352('0x37')]['filter']+'%'};return _0xdfaa5f;})});}_0x221b69=_[_0xa352('0x43')]({},_0x221b69,_0x2434ba[_0xa352('0x45')]);return db[_0xa352('0x64')][_0xa352('0x20')]({'where':_0x221b69['where']})[_0xa352('0x28')](function(_0x1972e9){_0x29ae0f['count']=_0x1972e9;if(_0x2434ba[_0xa352('0x37')][_0xa352('0x46')]){_0x221b69[_0xa352('0x47')]=[{'all':!![]}];}return db[_0xa352('0x64')][_0xa352('0x48')](_0x221b69);})[_0xa352('0x28')](function(_0x37a3f1){_0x29ae0f['rows']=_0x37a3f1;return _0x29ae0f;});}})[_0xa352('0x28')](respondWithFilteredResult(_0x3c5a41,_0x221b69))[_0xa352('0x4d')](handleError(_0x3c5a41,null));};exports[_0xa352('0x65')]=function(_0x193e77,_0x26b610,_0xd16bb3){var _0x640ee5={};var _0x6757ce={};var _0x536182;var _0x2b4ddc;return db[_0xa352('0x31')][_0xa352('0x62')]({'where':{'id':_0x193e77[_0xa352('0x4b')]['id']}})['then'](handleEntityNotFound(_0x26b610,null))[_0xa352('0x28')](function(_0xb14634){if(_0xb14634){_0x536182=_0xb14634;_0x6757ce[_0xa352('0x36')]=_['keys'](db['CmList']['rawAttributes']);_0x6757ce['query']=_[_0xa352('0x38')](_0x193e77[_0xa352('0x37')]);_0x6757ce['filters']=_[_0xa352('0x3a')](_0x6757ce[_0xa352('0x36')],_0x6757ce[_0xa352('0x37')]);_0x640ee5[_0xa352('0x3b')]=_[_0xa352('0x3a')](_0x6757ce[_0xa352('0x36')],qs['fields'](_0x193e77[_0xa352('0x37')][_0xa352('0x3c')]));_0x640ee5[_0xa352('0x3b')]=_0x640ee5['attributes'][_0xa352('0x4c')]?_0x640ee5[_0xa352('0x3b')]:_0x6757ce[_0xa352('0x36')];_0x640ee5[_0xa352('0x5e')]=qs[_0xa352('0x3f')](_0x193e77[_0xa352('0x37')]['sort']);_0x640ee5[_0xa352('0x40')]=qs['filters'](_[_0xa352('0x41')](_0x193e77[_0xa352('0x37')],_0x6757ce[_0xa352('0x39')]));if(_0x193e77[_0xa352('0x37')]['filter']){_0x640ee5[_0xa352('0x40')]=_[_0xa352('0x43')](_0x640ee5[_0xa352('0x40')],{'$or':_[_0xa352('0x30')](_0x640ee5['attributes'],function(_0x52d3d4){var _0x52e1a4={};_0x52e1a4[_0x52d3d4]={'$like':'%'+_0x193e77[_0xa352('0x37')][_0xa352('0x42')]+'%'};return _0x52e1a4;})});}_0x640ee5=_[_0xa352('0x43')]({},_0x640ee5,_0x193e77[_0xa352('0x45')]);return _0x536182['getLists'](_0x640ee5);}})['then'](function(_0x3efc5c){if(_0x3efc5c){_0x2b4ddc=_0x3efc5c['length'];if(!_0x193e77['query']['hasOwnProperty'](_0xa352('0x3e'))){_0x640ee5[_0xa352('0x21')]=qs['limit'](_0x193e77[_0xa352('0x37')]['limit']);_0x640ee5[_0xa352('0x1e')]=qs[_0xa352('0x1e')](_0x193e77['query'][_0xa352('0x1e')]);}return _0x536182[_0xa352('0x65')](_0x640ee5);}})[_0xa352('0x28')](function(_0x568ac2){if(_0x568ac2){return _0x568ac2?{'count':_0x2b4ddc,'rows':_0x568ac2}:null;}})[_0xa352('0x28')](respondWithResult(_0x26b610,null))[_0xa352('0x4d')](handleError(_0x26b610,null));};exports[_0xa352('0x66')]=function(_0x52a741,_0x9f68ae,_0x326414){var _0x28d4d6,_0x1b8ab7;return db[_0xa352('0x31')][_0xa352('0x54')]({'where':{'id':_0x52a741['params']['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x9f68ae,null))['then'](function(_0x335931){if(_0x335931){_0x1b8ab7=_0x335931;return _0x335931[_0xa352('0x66')](_0x52a741[_0xa352('0x4f')][_0xa352('0x67')],_[_0xa352('0x59')](_0x52a741[_0xa352('0x4f')],[_0xa352('0x67'),'id'])||{});}return null;})[_0xa352('0x68')](function(_0xfb95cd){var _0x521ccf;_0x28d4d6=_0xfb95cd||[];var _0x5d7222=[];if(_0xfb95cd){for(var _0x52c012=0x0;_0x52c012<_0xfb95cd[_0xa352('0x4c')];_0x52c012+=0x1){var _0x41b946=_0xfb95cd[_0x52c012][_0xa352('0x2a')]({'plain':!![]});_0x1b8ab7[_0xa352('0x69')]=_0x52a741[_0xa352('0x4f')][_0xa352('0x69')]?_0x52a741[_0xa352('0x4f')][_0xa352('0x69')]:_0x1b8ab7['dialCheckDuplicateType'];switch(_0x1b8ab7[_0xa352('0x69')]){case _0xa352('0x6a'):_0x521ccf=squel['insert']()[_0xa352('0x6b')](_0xa352('0x6c'))[_0xa352('0x6d')]([_0xa352('0x6e'),_0xa352('0x6f'),_0xa352('0x70'),_0xa352('0x71'),'CampaignId',_0xa352('0x5b'),_0xa352('0x5a')],squel[_0xa352('0x72')]()['field'](_0xa352('0x6e'),_0xa352('0x6e'))[_0xa352('0x73')](_0xa352('0x74'),_0xa352('0x6f'))[_0xa352('0x73')]('id',_0xa352('0x70'))['field'](_0x41b946[_0xa352('0x75')]['toString'](),_0xa352('0x71'))['field'](_0x52a741[_0xa352('0x4b')]['id'][_0xa352('0x76')](),_0xa352('0x5f'))['field'](_0xa352('0x74'),_0xa352('0x5b'))[_0xa352('0x73')](_0xa352('0x74'),_0xa352('0x5a'))[_0xa352('0x77')](_0xa352('0x78'))[_0xa352('0x40')](_0xa352('0x79'))[_0xa352('0x40')]('ListId\x20=\x20?',_0x41b946[_0xa352('0x75')]['toString']())[_0xa352('0x40')](_0xa352('0x7a'))['where'](_0xa352('0x7b'),squel[_0xa352('0x72')]()['field'](_0xa352('0x7c'))[_0xa352('0x77')]('cm_hopper_final')['where'](_0xa352('0x7d'),_0x52a741['params']['id'][_0xa352('0x76')]()))[_0xa352('0x40')](_0xa352('0x7b'),squel[_0xa352('0x72')]()['field']('COALESCE(phone,\x27\x27)')[_0xa352('0x77')](_0xa352('0x6c'))[_0xa352('0x40')]('CampaignId\x20=\x20?',_0x52a741[_0xa352('0x4b')]['id'][_0xa352('0x76')]())))[_0xa352('0x76')]();break;case _0xa352('0x7e'):_0x521ccf=squel[_0xa352('0x7f')]()[_0xa352('0x6b')](_0xa352('0x6c'))[_0xa352('0x6d')](['phone',_0xa352('0x6f'),_0xa352('0x70'),'ListId',_0xa352('0x5f'),_0xa352('0x5b'),_0xa352('0x5a')],squel[_0xa352('0x72')]()[_0xa352('0x73')](_0xa352('0x6e'),_0xa352('0x6e'))['field'](_0xa352('0x74'),_0xa352('0x6f'))['field']('id',_0xa352('0x70'))[_0xa352('0x73')](_0x41b946[_0xa352('0x75')]['toString'](),_0xa352('0x71'))[_0xa352('0x73')](_0x52a741['params']['id'][_0xa352('0x76')](),'CampaignId')[_0xa352('0x73')]('NOW()',_0xa352('0x5b'))['field']('NOW()',_0xa352('0x5a'))['from'](_0xa352('0x78'))[_0xa352('0x40')](_0xa352('0x79'))['where'](_0xa352('0x80'),_0x41b946[_0xa352('0x75')][_0xa352('0x76')]())[_0xa352('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0xa352('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa352('0x72')]()['field'](_0xa352('0x81'))['from'](_0xa352('0x6c'))[_0xa352('0x40')](_0xa352('0x7d'),_0x52a741[_0xa352('0x4b')]['id']['toString']())))[_0xa352('0x76')]();break;default:_0x521ccf=squel[_0xa352('0x7f')]()[_0xa352('0x6b')](_0xa352('0x6c'))[_0xa352('0x6d')]([_0xa352('0x6e'),_0xa352('0x6f'),_0xa352('0x70'),_0xa352('0x71'),_0xa352('0x5f'),_0xa352('0x5b'),_0xa352('0x5a')],squel[_0xa352('0x72')]()[_0xa352('0x73')]('phone','phone')['field'](_0xa352('0x74'),_0xa352('0x6f'))[_0xa352('0x73')]('id',_0xa352('0x70'))['field'](_0x41b946[_0xa352('0x75')][_0xa352('0x76')](),_0xa352('0x71'))[_0xa352('0x73')](_0x52a741[_0xa352('0x4b')]['id']['toString'](),_0xa352('0x5f'))[_0xa352('0x73')]('NOW()','createdAt')[_0xa352('0x73')](_0xa352('0x74'),_0xa352('0x5a'))[_0xa352('0x77')](_0xa352('0x78'))[_0xa352('0x40')](_0xa352('0x79'))[_0xa352('0x40')]('ListId\x20=\x20?',_0x41b946[_0xa352('0x75')][_0xa352('0x76')]())[_0xa352('0x40')](_0xa352('0x7a')))[_0xa352('0x76')]();}_0x5d7222['push'](db['sequelize'][_0xa352('0x37')](_0x521ccf));}return BPromise['all'](_0x5d7222);}})[_0xa352('0x28')](function(){return _0x28d4d6;})[_0xa352('0x28')](respondWithResult(_0x9f68ae,null))[_0xa352('0x4d')](handleError(_0x9f68ae,null));};exports[_0xa352('0x82')]=function(_0x38df59,_0x3e53d8,_0x11d053){return db['Campaign']['find']({'where':{'id':_0x38df59[_0xa352('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e53d8,null))[_0xa352('0x28')](function(_0x4c71df){if(_0x4c71df){return _0x4c71df[_0xa352('0x82')](_0x38df59[_0xa352('0x37')][_0xa352('0x67')]);}})[_0xa352('0x28')](function(_0x5ada38){if(_0x5ada38){return db[_0xa352('0x5d')][_0xa352('0x29')]({'where':{'ListId':_0x38df59[_0xa352('0x37')][_0xa352('0x67')],'CampaignId':_0x38df59['params']['id']}})['then'](function(){return _0x5ada38;});}})['then'](respondWithStatusCode(_0x3e53d8,null))['catch'](handleError(_0x3e53d8,null));};exports['getBlackLists']=function(_0x1d5788,_0x292bff,_0x11a37a){var _0x2f34d3={};var _0x15179f={};var _0x29b810;var _0x18d8bd;return db[_0xa352('0x31')][_0xa352('0x62')]({'where':{'id':_0x1d5788[_0xa352('0x4b')]['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x292bff,null))['then'](function(_0x38f1fd){if(_0x38f1fd){_0x29b810=_0x38f1fd;_0x15179f['model']=_[_0xa352('0x38')](db[_0xa352('0x83')]['rawAttributes']);_0x15179f['query']=_['keys'](_0x1d5788[_0xa352('0x37')]);_0x15179f[_0xa352('0x39')]=_[_0xa352('0x3a')](_0x15179f['model'],_0x15179f[_0xa352('0x37')]);_0x2f34d3[_0xa352('0x3b')]=_['intersection'](_0x15179f[_0xa352('0x36')],qs[_0xa352('0x3c')](_0x1d5788[_0xa352('0x37')]['fields']));_0x2f34d3[_0xa352('0x3b')]=_0x2f34d3['attributes'][_0xa352('0x4c')]?_0x2f34d3[_0xa352('0x3b')]:_0x15179f[_0xa352('0x36')];_0x2f34d3[_0xa352('0x5e')]=qs[_0xa352('0x3f')](_0x1d5788['query'][_0xa352('0x3f')]);_0x2f34d3['where']=qs[_0xa352('0x39')](_[_0xa352('0x41')](_0x1d5788[_0xa352('0x37')],_0x15179f['filters']));if(_0x1d5788[_0xa352('0x37')][_0xa352('0x42')]){_0x2f34d3['where']=_[_0xa352('0x43')](_0x2f34d3[_0xa352('0x40')],{'$or':_[_0xa352('0x30')](_0x2f34d3['attributes'],function(_0x5a545a){var _0x486368={};_0x486368[_0x5a545a]={'$like':'%'+_0x1d5788[_0xa352('0x37')][_0xa352('0x42')]+'%'};return _0x486368;})});}_0x2f34d3=_['merge']({},_0x2f34d3,_0x1d5788[_0xa352('0x45')]);return _0x29b810['getBlackLists'](_0x2f34d3);}})[_0xa352('0x28')](function(_0x54af93){if(_0x54af93){_0x18d8bd=_0x54af93[_0xa352('0x4c')];if(!_0x1d5788[_0xa352('0x37')][_0xa352('0x3d')](_0xa352('0x3e'))){_0x2f34d3[_0xa352('0x21')]=qs[_0xa352('0x21')](_0x1d5788[_0xa352('0x37')][_0xa352('0x21')]);_0x2f34d3['offset']=qs[_0xa352('0x1e')](_0x1d5788['query'][_0xa352('0x1e')]);}return _0x29b810[_0xa352('0x84')](_0x2f34d3);}})[_0xa352('0x28')](function(_0x43777e){if(_0x43777e){return _0x43777e?{'count':_0x18d8bd,'rows':_0x43777e}:null;}})[_0xa352('0x28')](respondWithResult(_0x292bff,null))[_0xa352('0x4d')](handleError(_0x292bff,null));};exports[_0xa352('0x85')]=function(_0x5a7b33,_0xaa0510,_0x20538a){var _0x4b38c9,_0x5cd5b8;return db['Campaign']['find']({'where':{'id':_0x5a7b33[_0xa352('0x4b')]['id']}})['then'](handleEntityNotFound(_0xaa0510,null))[_0xa352('0x28')](function(_0x5608e8){if(_0x5608e8){_0x5cd5b8=_0x5608e8;return _0x5608e8[_0xa352('0x85')](_0x5a7b33[_0xa352('0x4f')]['ids'],_[_0xa352('0x59')](_0x5a7b33['body'],[_0xa352('0x67'),'id'])||{});}return null;})[_0xa352('0x68')](function(_0x4f22fa){var _0x3bef6f;_0x4b38c9=_0x4f22fa||[];var _0x186f4c=[];if(_0x4f22fa){for(var _0x5e243e=0x0;_0x5e243e<_0x4f22fa[_0xa352('0x4c')];_0x5e243e+=0x1){var _0x33fbcd=_0x4f22fa[_0x5e243e][_0xa352('0x2a')]({'plain':!![]});_0x3bef6f=squel[_0xa352('0x7f')]()['into']('cm_hopper_black')['fromQuery']([_0xa352('0x6e'),_0xa352('0x70'),_0xa352('0x71'),'CampaignId',_0xa352('0x5b'),_0xa352('0x5a')],squel[_0xa352('0x72')]()['field'](_0xa352('0x6e'),_0xa352('0x6e'))[_0xa352('0x73')]('id',_0xa352('0x70'))['field'](_0x33fbcd[_0xa352('0x75')][_0xa352('0x76')](),'ListId')[_0xa352('0x73')](_0x5a7b33['params']['id']['toString'](),_0xa352('0x5f'))['field'](_0xa352('0x74'),'createdAt')['field'](_0xa352('0x74'),_0xa352('0x5a'))[_0xa352('0x77')](_0xa352('0x78'))[_0xa352('0x40')](_0xa352('0x79'))[_0xa352('0x40')]('ListId\x20=\x20?',_0x33fbcd[_0xa352('0x75')]['toString']())[_0xa352('0x40')](_0xa352('0x7a')))[_0xa352('0x76')]();_0x186f4c[_0xa352('0x86')](db[_0xa352('0x87')][_0xa352('0x37')](_0x3bef6f));}return BPromise[_0xa352('0x88')](_0x186f4c);}})[_0xa352('0x28')](function(){return _0x4b38c9;})[_0xa352('0x28')](respondWithResult(_0xaa0510,null))['catch'](handleError(_0xaa0510,null));};exports[_0xa352('0x89')]=function(_0x261475,_0x3fed9e,_0x2111f1){return db[_0xa352('0x31')][_0xa352('0x54')]({'where':{'id':_0x261475[_0xa352('0x4b')]['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x3fed9e,null))[_0xa352('0x28')](function(_0x68c76a){if(_0x68c76a){return _0x68c76a[_0xa352('0x89')](_0x261475[_0xa352('0x37')][_0xa352('0x67')]);}})['then'](function(_0x4a2779){if(_0x4a2779){return db[_0xa352('0x64')]['destroy']({'where':{'ListId':_0x261475[_0xa352('0x37')][_0xa352('0x67')],'CampaignId':_0x261475['params']['id']}})[_0xa352('0x28')](function(){return _0x4a2779;});}})[_0xa352('0x28')](respondWithStatusCode(_0x3fed9e,null))[_0xa352('0x4d')](handleError(_0x3fed9e,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7836914..449e262 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x3b96e5,_0x124abe){var _0x8facbe=function(_0x5a95ac){while(--_0x5a95ac){_0x3b96e5['push'](_0x3b96e5['shift']());}};_0x8facbe(++_0x124abe);}(_0x7a54,0x106));var _0x47a5=function(_0x1b5b11,_0x34cce8){_0x1b5b11=_0x1b5b11-0x0;var _0x183cde=_0x7a54[_0x1b5b11];return _0x183cde;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 4aa9f3b..efd09a6 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9f9=['code','message','findAll','options','where','include','map','model','attributes','GetCampaign','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4eaa4c,_0x2f7422){var _0x15aec6=function(_0x23efc9){while(--_0x23efc9){_0x4eaa4c['push'](_0x4eaa4c['shift']());}};_0x15aec6(++_0x2f7422);}(_0xe9f9,0x174));var _0x9e9f=function(_0xd98d86,_0x350961){_0xd98d86=_0xd98d86-0x0;var _0x3f9247=_0xe9f9[_0xd98d86];return _0x3f9247;};'use strict';var _=require(_0x9e9f('0x0'));var util=require('util');var moment=require(_0x9e9f('0x1'));var BPromise=require(_0x9e9f('0x2'));var rs=require(_0x9e9f('0x3'));var fs=require('fs');var Redis=require(_0x9e9f('0x4'));var db=require(_0x9e9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e9f('0x6'))('rpc');var config=require(_0x9e9f('0x7'));var jayson=require(_0x9e9f('0x8'));var client=jayson['client'][_0x9e9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54f87c,_0x310be8,_0x661886){return new BPromise(function(_0x10d43b,_0x5256b3){return client[_0x9e9f('0xa')](_0x54f87c,_0x661886)[_0x9e9f('0xb')](function(_0x2e1e8e){logger[_0x9e9f('0xc')](_0x9e9f('0xd'),_0x310be8,_0x9e9f('0xe'));logger['debug'](_0x9e9f('0xf'),_0x310be8,_0x9e9f('0xe'),JSON[_0x9e9f('0x10')](_0x2e1e8e));if(_0x2e1e8e['error']){if(_0x2e1e8e[_0x9e9f('0x11')][_0x9e9f('0x12')]===0x1f4){logger[_0x9e9f('0x11')](_0x9e9f('0xd'),_0x310be8,_0x2e1e8e[_0x9e9f('0x11')][_0x9e9f('0x13')]);return _0x5256b3(_0x2e1e8e[_0x9e9f('0x11')][_0x9e9f('0x13')]);}logger[_0x9e9f('0x11')]('Campaign,\x20%s,\x20%s',_0x310be8,_0x2e1e8e['error'][_0x9e9f('0x13')]);return _0x10d43b(_0x2e1e8e[_0x9e9f('0x11')][_0x9e9f('0x13')]);}else{logger[_0x9e9f('0xc')](_0x9e9f('0xd'),_0x310be8,_0x9e9f('0xe'));_0x10d43b(_0x2e1e8e['result'][_0x9e9f('0x13')]);}})['catch'](function(_0x38897c){logger['error']('Campaign,\x20%s,\x20%s',_0x310be8,_0x38897c);_0x5256b3(_0x38897c);});});}exports['GetCampaign']=function(_0x3e1c64){var _0x4576ed=this;return new Promise(function(_0xfadc07,_0x21f5b7){return db['Campaign'][_0x9e9f('0x14')]({'raw':_0x3e1c64[_0x9e9f('0x15')]?_0x3e1c64[_0x9e9f('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3e1c64[_0x9e9f('0x15')]?_0x3e1c64[_0x9e9f('0x15')][_0x9e9f('0x16')]||null:null,'attributes':_0x3e1c64[_0x9e9f('0x15')]?_0x3e1c64['options']['attributes']||null:null,'limit':_0x3e1c64[_0x9e9f('0x15')]?_0x3e1c64[_0x9e9f('0x15')]['limit']||null:null,'include':_0x3e1c64[_0x9e9f('0x15')]?_0x3e1c64[_0x9e9f('0x15')][_0x9e9f('0x17')]?_[_0x9e9f('0x18')](_0x3e1c64['options'][_0x9e9f('0x17')],function(_0x1172c2){return{'model':db[_0x1172c2['model']],'as':_0x1172c2['as'],'attributes':_0x1172c2['attributes'],'include':_0x1172c2[_0x9e9f('0x17')]?_[_0x9e9f('0x18')](_0x1172c2['include'],function(_0x172dd1){return{'model':db[_0x172dd1[_0x9e9f('0x19')]],'as':_0x172dd1['as'],'attributes':_0x172dd1['attributes'],'include':_0x172dd1[_0x9e9f('0x17')]?_[_0x9e9f('0x18')](_0x172dd1['include'],function(_0x5cdfe6){return{'model':db[_0x5cdfe6[_0x9e9f('0x19')]],'as':_0x5cdfe6['as'],'attributes':_0x5cdfe6[_0x9e9f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9e9f('0xb')](function(_0xc12c4c){logger['info'](_0x9e9f('0x1b'),_0x3e1c64);logger[_0x9e9f('0x1c')](_0x9e9f('0x1b'),_0x3e1c64,JSON['stringify'](_0xc12c4c));_0xfadc07(_0xc12c4c);})[_0x9e9f('0x1d')](function(_0xa3a2d7){logger[_0x9e9f('0x11')]('GetCampaign',_0xa3a2d7[_0x9e9f('0x13')],_0x3e1c64);_0x21f5b7(_0x4576ed[_0x9e9f('0x11')](0x1f4,_0xa3a2d7[_0x9e9f('0x13')]));});});}; \ No newline at end of file +var _0x5bbd=['info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetCampaign','Campaign','options','raw','where','include','map','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5bb('0x0'));var util=require(_0xd5bb('0x1'));var moment=require(_0xd5bb('0x2'));var BPromise=require(_0xd5bb('0x3'));var rs=require(_0xd5bb('0x4'));var fs=require('fs');var Redis=require(_0xd5bb('0x5'));var db=require(_0xd5bb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd5bb('0x7'));var jayson=require(_0xd5bb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x292873,_0x5093d3,_0x3878ba){return new BPromise(function(_0x17c08f,_0x1e7ad6){return client['request'](_0x292873,_0x3878ba)['then'](function(_0x44ffea){logger[_0xd5bb('0x9')](_0xd5bb('0xa'),_0x5093d3,'request\x20sent');logger[_0xd5bb('0xb')](_0xd5bb('0xc'),_0x5093d3,_0xd5bb('0xd'),JSON['stringify'](_0x44ffea));if(_0x44ffea['error']){if(_0x44ffea[_0xd5bb('0xe')][_0xd5bb('0xf')]===0x1f4){logger['error'](_0xd5bb('0xa'),_0x5093d3,_0x44ffea['error'][_0xd5bb('0x10')]);return _0x1e7ad6(_0x44ffea['error'][_0xd5bb('0x10')]);}logger[_0xd5bb('0xe')]('Campaign,\x20%s,\x20%s',_0x5093d3,_0x44ffea[_0xd5bb('0xe')][_0xd5bb('0x10')]);return _0x17c08f(_0x44ffea[_0xd5bb('0xe')]['message']);}else{logger['info'](_0xd5bb('0xa'),_0x5093d3,_0xd5bb('0xd'));_0x17c08f(_0x44ffea['result'][_0xd5bb('0x10')]);}})[_0xd5bb('0x11')](function(_0x3b7021){logger[_0xd5bb('0xe')]('Campaign,\x20%s,\x20%s',_0x5093d3,_0x3b7021);_0x1e7ad6(_0x3b7021);});});}exports[_0xd5bb('0x12')]=function(_0x41bc89){var _0x567d06=this;return new Promise(function(_0x3d312f,_0x222b0c){return db[_0xd5bb('0x13')]['findAll']({'raw':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x15')]===undefined?!![]:![]:!![],'where':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x16')]||null:null,'attributes':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')]['attributes']||null:null,'limit':_0x41bc89['options']?_0x41bc89[_0xd5bb('0x14')]['limit']||null:null,'include':_0x41bc89['options']?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x17')],function(_0x52383c){return{'model':db[_0x52383c[_0xd5bb('0x19')]],'as':_0x52383c['as'],'attributes':_0x52383c[_0xd5bb('0x1a')],'include':_0x52383c[_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x52383c[_0xd5bb('0x17')],function(_0x48f15d){return{'model':db[_0x48f15d['model']],'as':_0x48f15d['as'],'attributes':_0x48f15d[_0xd5bb('0x1a')],'include':_0x48f15d[_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x48f15d[_0xd5bb('0x17')],function(_0x351c33){return{'model':db[_0x351c33['model']],'as':_0x351c33['as'],'attributes':_0x351c33[_0xd5bb('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30fa6d){logger[_0xd5bb('0x9')](_0xd5bb('0x12'),_0x41bc89);logger[_0xd5bb('0xb')](_0xd5bb('0x12'),_0x41bc89,JSON[_0xd5bb('0x1b')](_0x30fa6d));_0x3d312f(_0x30fa6d);})[_0xd5bb('0x11')](function(_0x228fc4){logger[_0xd5bb('0xe')](_0xd5bb('0x12'),_0x228fc4[_0xd5bb('0x10')],_0x41bc89);_0x222b0c(_0x567d06[_0xd5bb('0xe')](0x1f4,_0x228fc4[_0xd5bb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 827a23d..648136d 100644 --- a/server/api/campaign/index.js +++ b/server/api/campaign/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5145=['getHoppers','/:id/hopper_histories','getHopperHistories','getHopperBlacks','/:id/lists','post','/:id/clone','clone','addBlackLists','put','update','delete','/:id','destroy','removeLists','/:id/blacklists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers'];(function(_0x5c98dd,_0xa500ec){var _0x57bcfd=function(_0x7df484){while(--_0x7df484){_0x5c98dd['push'](_0x5c98dd['shift']());}};_0x57bcfd(++_0xa500ec);}(_0x5145,0x1bf));var _0x5514=function(_0x530abd,_0x42a08f){_0x530abd=_0x530abd-0x0;var _0x17b939=_0x5145[_0x530abd];return _0x17b939;};'use strict';var multer=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var path=require(_0x5514('0x2'));var timeout=require(_0x5514('0x3'));var express=require(_0x5514('0x4'));var router=express[_0x5514('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5514('0x6'));var interaction=require(_0x5514('0x7'));var config=require(_0x5514('0x8'));var controller=require(_0x5514('0x9'));router[_0x5514('0xa')]('/',auth[_0x5514('0xb')](),controller[_0x5514('0xc')]);router['get']('/:id',auth[_0x5514('0xb')](),controller[_0x5514('0xd')]);router[_0x5514('0xa')](_0x5514('0xe'),auth[_0x5514('0xb')](),controller[_0x5514('0xf')]);router[_0x5514('0xa')](_0x5514('0x10'),auth['isAuthenticated'](),controller[_0x5514('0x11')]);router[_0x5514('0xa')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x5514('0xa')]('/:id/hopper_black',auth[_0x5514('0xb')](),controller[_0x5514('0x12')]);router['get'](_0x5514('0x13'),auth[_0x5514('0xb')](),controller['getLists']);router[_0x5514('0xa')]('/:id/blacklists',auth[_0x5514('0xb')](),controller['getBlackLists']);router['post']('/',auth[_0x5514('0xb')](),controller['create']);router[_0x5514('0x14')](_0x5514('0x15'),auth[_0x5514('0xb')](),controller[_0x5514('0x16')]);router['post'](_0x5514('0x13'),auth['isAuthenticated'](),controller['addLists']);router[_0x5514('0x14')]('/:id/blacklists',auth[_0x5514('0xb')](),controller[_0x5514('0x17')]);router[_0x5514('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x5514('0x19')]);router[_0x5514('0x1a')](_0x5514('0x1b'),auth['isAuthenticated'](),controller[_0x5514('0x1c')]);router[_0x5514('0x1a')](_0x5514('0x13'),auth[_0x5514('0xb')](),controller[_0x5514('0x1d')]);router[_0x5514('0x1a')](_0x5514('0x1e'),auth[_0x5514('0xb')](),controller[_0x5514('0x1f')]);module[_0x5514('0x20')]=router; \ No newline at end of file +var _0x07b5=['/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','/:id/clone','clone','/:id/lists','addLists','/:id/blacklists','addBlackLists','put','update','destroy','delete','removeLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals'];(function(_0x3e45b1,_0x23ff50){var _0x433f3c=function(_0x31f593){while(--_0x31f593){_0x3e45b1['push'](_0x3e45b1['shift']());}};_0x433f3c(++_0x23ff50);}(_0x07b5,0x131));var _0x507b=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x07b5[_0x3bb5b4];return _0x586c60;};'use strict';var multer=require(_0x507b('0x0'));var util=require(_0x507b('0x1'));var path=require(_0x507b('0x2'));var timeout=require(_0x507b('0x3'));var express=require(_0x507b('0x4'));var router=express[_0x507b('0x5')]();var fs_extra=require(_0x507b('0x6'));var auth=require(_0x507b('0x7'));var interaction=require(_0x507b('0x8'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x507b('0x9')]('/',auth[_0x507b('0xa')](),controller[_0x507b('0xb')]);router['get'](_0x507b('0xc'),auth[_0x507b('0xa')](),controller[_0x507b('0xd')]);router[_0x507b('0x9')](_0x507b('0xe'),auth['isAuthenticated'](),controller[_0x507b('0xf')]);router[_0x507b('0x9')](_0x507b('0x10'),auth[_0x507b('0xa')](),controller[_0x507b('0x11')]);router[_0x507b('0x9')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x507b('0x12')]);router[_0x507b('0x9')](_0x507b('0x13'),auth[_0x507b('0xa')](),controller[_0x507b('0x14')]);router[_0x507b('0x9')]('/:id/lists',auth[_0x507b('0xa')](),controller[_0x507b('0x15')]);router[_0x507b('0x9')]('/:id/blacklists',auth[_0x507b('0xa')](),controller[_0x507b('0x16')]);router[_0x507b('0x17')]('/',auth[_0x507b('0xa')](),controller['create']);router[_0x507b('0x17')](_0x507b('0x18'),auth[_0x507b('0xa')](),controller[_0x507b('0x19')]);router[_0x507b('0x17')](_0x507b('0x1a'),auth[_0x507b('0xa')](),controller[_0x507b('0x1b')]);router[_0x507b('0x17')](_0x507b('0x1c'),auth[_0x507b('0xa')](),controller[_0x507b('0x1d')]);router[_0x507b('0x1e')](_0x507b('0xc'),auth[_0x507b('0xa')](),controller[_0x507b('0x1f')]);router['delete'](_0x507b('0xc'),auth[_0x507b('0xa')](),controller[_0x507b('0x20')]);router[_0x507b('0x21')](_0x507b('0x1a'),auth[_0x507b('0xa')](),controller[_0x507b('0x22')]);router[_0x507b('0x21')](_0x507b('0x1c'),auth[_0x507b('0xa')](),controller['removeBlackLists']);module[_0x507b('0x23')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 58e2224..af4b9fe 100644 --- a/server/api/cannedAnswer/cannedAnswer.attributes.js +++ b/server/api/cannedAnswer/cannedAnswer.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b3f=['getDataValue','key','exports','STRING','VIRTUAL'];(function(_0x472595,_0x583579){var _0x3f57be=function(_0x54afa5){while(--_0x54afa5){_0x472595['push'](_0x472595['shift']());}};_0x3f57be(++_0x583579);}(_0x3b3f,0xca));var _0xf3b3=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3b3f[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0xf3b3('0x0')]={'key':{'type':Sequelize[_0xf3b3('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xf3b3('0x1')]},'name':{'type':Sequelize[_0xf3b3('0x2')],'get':function(){return this[_0xf3b3('0x3')](_0xf3b3('0x4'));}}}; \ No newline at end of file +var _0x8cf4=['exports','STRING','TEXT','getDataValue','key','sequelize'];(function(_0x37a416,_0x14ee6a){var _0x47959e=function(_0x57aa93){while(--_0x57aa93){_0x37a416['push'](_0x37a416['shift']());}};_0x47959e(++_0x14ee6a);}(_0x8cf4,0x18b));var _0x48cf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8cf4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x48cf('0x0'));module[_0x48cf('0x1')]={'key':{'type':Sequelize[_0x48cf('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x48cf('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x48cf('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x48cf('0x4')](_0x48cf('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 8b40a07..68c61ca 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6c0=['zip-dir','moment','mustache','util','path','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','index','map','fieldName','type','key','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','CannedAnswer','includeAll','include','rows','catch','show','params','rawAttributes','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format'];(function(_0x5ab31d,_0x3dde64){var _0x178f7b=function(_0x2ea683){while(--_0x2ea683){_0x5ab31d['push'](_0x5ab31d['shift']());}};_0x178f7b(++_0x3dde64);}(_0xf6c0,0x194));var _0x0f6c=function(_0x330d71,_0x23b7f2){_0x330d71=_0x330d71-0x0;var _0x463119=_0xf6c0[_0x330d71];return _0x463119;};'use strict';var emlformat=require(_0x0f6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0f6c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0f6c('0x3'));var util=require(_0x0f6c('0x4'));var path=require(_0x0f6c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f6c('0x6'));var _=require('lodash');var squel=require(_0x0f6c('0x7'));var crypto=require(_0x0f6c('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0f6c('0x9'));var toCsv=require(_0x0f6c('0xa'));var querystring=require(_0x0f6c('0xb'));var Papa=require(_0x0f6c('0xc'));var Redis=require(_0x0f6c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0f6c('0xe'));var as=require(_0x0f6c('0xf'));var hardwareService=require(_0x0f6c('0x10'));var logger=require(_0x0f6c('0x11'))('api');var utils=require(_0x0f6c('0x12'));var config=require(_0x0f6c('0x13'));var licenseUtil=require(_0x0f6c('0x14'));var db=require(_0x0f6c('0x15'))['db'];function respondWithStatusCode(_0x30022c,_0x67e4ef){_0x67e4ef=_0x67e4ef||0xcc;return function(_0x53c92f){if(_0x53c92f){return _0x30022c['sendStatus'](_0x67e4ef);}return _0x30022c['status'](_0x67e4ef)[_0x0f6c('0x16')]();};}function respondWithResult(_0x184c1c,_0x311a23){_0x311a23=_0x311a23||0xc8;return function(_0x287277){if(_0x287277){return _0x184c1c[_0x0f6c('0x17')](_0x311a23)[_0x0f6c('0x18')](_0x287277);}};}function respondWithFilteredResult(_0x5697ee,_0x455f48){return function(_0x5e66b0){if(_0x5e66b0){var _0x844248=typeof _0x455f48[_0x0f6c('0x19')]===_0x0f6c('0x1a')&&typeof _0x455f48['limit']==='undefined';var _0xcf5c47=_0x5e66b0['count'];var _0x48aa1c=_0x844248?0x0:_0x455f48[_0x0f6c('0x19')];var _0x2ddb68=_0x844248?_0x5e66b0[_0x0f6c('0x1b')]:_0x455f48[_0x0f6c('0x19')]+_0x455f48[_0x0f6c('0x1c')];var _0x311510;if(_0x2ddb68>=_0xcf5c47){_0x2ddb68=_0xcf5c47;_0x311510=0xc8;}else{_0x311510=0xce;}_0x5697ee['status'](_0x311510);return _0x5697ee[_0x0f6c('0x1d')](_0x0f6c('0x1e'),_0x48aa1c+'-'+_0x2ddb68+'/'+_0xcf5c47)[_0x0f6c('0x18')](_0x5e66b0);}return null;};}function patchUpdates(_0x2600a6){return function(_0x369af9){try{jsonpatch[_0x0f6c('0x1f')](_0x369af9,_0x2600a6,!![]);}catch(_0x32fb1a){return BPromise['reject'](_0x32fb1a);}return _0x369af9['save']();};}function saveUpdates(_0x716757,_0x115720){return function(_0x1f8254){if(_0x1f8254){return _0x1f8254[_0x0f6c('0x20')](_0x716757)[_0x0f6c('0x21')](function(_0x3d1646){return _0x3d1646;});}return null;};}function removeEntity(_0x2e4059,_0x54c355){return function(_0x23774e){if(_0x23774e){return _0x23774e[_0x0f6c('0x22')]()[_0x0f6c('0x21')](function(){var _0x588e0c=_0x23774e[_0x0f6c('0x23')]({'plain':!![]});var _0x2de046=_0x0f6c('0x24');return db[_0x0f6c('0x25')][_0x0f6c('0x22')]({'where':{'type':_0x2de046,'resourceId':_0x588e0c['id']}})[_0x0f6c('0x21')](function(){return _0x23774e;});})[_0x0f6c('0x21')](function(){_0x2e4059['status'](0xcc)[_0x0f6c('0x16')]();});}};}function handleEntityNotFound(_0x4dbb9f,_0x32cc7f){return function(_0x3f9917){if(!_0x3f9917){_0x4dbb9f['sendStatus'](0x194);}return _0x3f9917;};}function handleError(_0x1dc610,_0x3bdc5e){_0x3bdc5e=_0x3bdc5e||0x1f4;return function(_0x14d1bb){logger['error'](_0x14d1bb[_0x0f6c('0x26')]);if(_0x14d1bb['name']){delete _0x14d1bb[_0x0f6c('0x27')];}_0x1dc610[_0x0f6c('0x17')](_0x3bdc5e)['send'](_0x14d1bb);};}exports[_0x0f6c('0x28')]=function(_0x33b022,_0x59860e){var _0x5b1a7a={},_0x2718cb={},_0x4cbd54={'count':0x0,'rows':[]};var _0x2f8658=_[_0x0f6c('0x29')](db['CannedAnswer']['rawAttributes'],function(_0x23c108){return{'name':_0x23c108[_0x0f6c('0x2a')],'type':_0x23c108[_0x0f6c('0x2b')][_0x0f6c('0x2c')]};});_0x2718cb['model']=_['map'](_0x2f8658,_0x0f6c('0x27'));_0x2718cb['query']=_[_0x0f6c('0x2d')](_0x33b022['query']);_0x2718cb[_0x0f6c('0x2e')]=_[_0x0f6c('0x2f')](_0x2718cb[_0x0f6c('0x30')],_0x2718cb[_0x0f6c('0x31')]);_0x5b1a7a['attributes']=_[_0x0f6c('0x2f')](_0x2718cb[_0x0f6c('0x30')],qs[_0x0f6c('0x32')](_0x33b022[_0x0f6c('0x31')][_0x0f6c('0x32')]));_0x5b1a7a[_0x0f6c('0x33')]=_0x5b1a7a[_0x0f6c('0x33')][_0x0f6c('0x34')]?_0x5b1a7a[_0x0f6c('0x33')]:_0x2718cb['model'];if(!_0x33b022['query'][_0x0f6c('0x35')](_0x0f6c('0x36'))){_0x5b1a7a['limit']=qs[_0x0f6c('0x1c')](_0x33b022[_0x0f6c('0x31')][_0x0f6c('0x1c')]);_0x5b1a7a[_0x0f6c('0x19')]=qs['offset'](_0x33b022[_0x0f6c('0x31')]['offset']);}_0x5b1a7a['order']=qs[_0x0f6c('0x37')](_0x33b022['query']['sort']);_0x5b1a7a[_0x0f6c('0x38')]=qs[_0x0f6c('0x2e')](_[_0x0f6c('0x39')](_0x33b022[_0x0f6c('0x31')],_0x2718cb[_0x0f6c('0x2e')]),_0x2f8658);if(_0x33b022[_0x0f6c('0x31')]['filter']){_0x5b1a7a[_0x0f6c('0x38')]=_['merge'](_0x5b1a7a[_0x0f6c('0x38')],{'$or':[{'key':{'$like':'%'+_0x33b022[_0x0f6c('0x31')]['filter']+'%'}},{'value':{'$like':'%'+_0x33b022[_0x0f6c('0x31')]['filter']+'%'}}]});}_0x5b1a7a=_[_0x0f6c('0x3a')]({},_0x5b1a7a,_0x33b022[_0x0f6c('0x3b')]);var _0x5ed598={'where':_0x5b1a7a[_0x0f6c('0x38')]};return db[_0x0f6c('0x3c')][_0x0f6c('0x1b')](_0x5ed598)['then'](function(_0x39f237){_0x4cbd54[_0x0f6c('0x1b')]=_0x39f237;if(_0x33b022[_0x0f6c('0x31')][_0x0f6c('0x3d')]){_0x5b1a7a[_0x0f6c('0x3e')]=[{'all':!![]}];}return db[_0x0f6c('0x3c')]['findAll'](_0x5b1a7a);})[_0x0f6c('0x21')](function(_0x522f5a){_0x4cbd54[_0x0f6c('0x3f')]=_0x522f5a;return _0x4cbd54;})[_0x0f6c('0x21')](respondWithFilteredResult(_0x59860e,_0x5b1a7a))[_0x0f6c('0x40')](handleError(_0x59860e,null));};exports[_0x0f6c('0x41')]=function(_0x167bc6,_0x5104f1){var _0x54c92f={'raw':!![],'where':{'id':_0x167bc6[_0x0f6c('0x42')]['id']}},_0x1dcaca={};_0x1dcaca['model']=_[_0x0f6c('0x2d')](db[_0x0f6c('0x3c')][_0x0f6c('0x43')]);_0x1dcaca[_0x0f6c('0x31')]=_['keys'](_0x167bc6[_0x0f6c('0x31')]);_0x1dcaca[_0x0f6c('0x2e')]=_[_0x0f6c('0x2f')](_0x1dcaca[_0x0f6c('0x30')],_0x1dcaca['query']);_0x54c92f['attributes']=_[_0x0f6c('0x2f')](_0x1dcaca[_0x0f6c('0x30')],qs[_0x0f6c('0x32')](_0x167bc6[_0x0f6c('0x31')][_0x0f6c('0x32')]));_0x54c92f[_0x0f6c('0x33')]=_0x54c92f[_0x0f6c('0x33')]['length']?_0x54c92f[_0x0f6c('0x33')]:_0x1dcaca[_0x0f6c('0x30')];if(_0x167bc6[_0x0f6c('0x31')][_0x0f6c('0x3d')]){_0x54c92f[_0x0f6c('0x3e')]=[{'all':!![]}];}_0x54c92f=_['merge']({},_0x54c92f,_0x167bc6['options']);return db[_0x0f6c('0x3c')][_0x0f6c('0x44')](_0x54c92f)['then'](handleEntityNotFound(_0x5104f1,null))['then'](respondWithResult(_0x5104f1,null))[_0x0f6c('0x40')](handleError(_0x5104f1,null));};exports[_0x0f6c('0x20')]=function(_0x49b102,_0x4196f9){if(_0x49b102['body']['id']){delete _0x49b102[_0x0f6c('0x45')]['id'];}return db[_0x0f6c('0x3c')][_0x0f6c('0x44')]({'where':{'id':_0x49b102[_0x0f6c('0x42')]['id']}})[_0x0f6c('0x21')](handleEntityNotFound(_0x4196f9,null))[_0x0f6c('0x21')](saveUpdates(_0x49b102[_0x0f6c('0x45')],null))[_0x0f6c('0x21')](respondWithResult(_0x4196f9,null))[_0x0f6c('0x40')](handleError(_0x4196f9,null));};exports[_0x0f6c('0x22')]=function(_0x1050e2,_0x1a854d){return db['CannedAnswer'][_0x0f6c('0x44')]({'where':{'id':_0x1050e2[_0x0f6c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a854d,null))[_0x0f6c('0x21')](removeEntity(_0x1a854d,null))['catch'](handleError(_0x1a854d,null));};exports[_0x0f6c('0x46')]=function(_0x4beb94,_0x1714cb){var _0x39ecdd={'key':_0x4beb94[_0x0f6c('0x45')]['key']};if(_0x4beb94[_0x0f6c('0x45')]['MailAccountId']){_0x39ecdd['MailAccountId']=_0x4beb94['body'][_0x0f6c('0x47')];}else if(_0x4beb94['body'][_0x0f6c('0x48')]){_0x39ecdd[_0x0f6c('0x48')]=_0x4beb94[_0x0f6c('0x45')][_0x0f6c('0x48')];}else if(_0x4beb94['body'][_0x0f6c('0x49')]){_0x39ecdd[_0x0f6c('0x49')]=_0x4beb94[_0x0f6c('0x45')][_0x0f6c('0x49')];}else if(_0x4beb94[_0x0f6c('0x45')]['ChatWebsiteId']){_0x39ecdd[_0x0f6c('0x4a')]=_0x4beb94['body'][_0x0f6c('0x4a')];}return db[_0x0f6c('0x3c')][_0x0f6c('0x44')]({'where':_0x39ecdd})[_0x0f6c('0x21')](function(_0x8a5e15){if(_0x8a5e15){throw new db[(_0x0f6c('0x4b'))]['ValidationError'](_0x0f6c('0x4c'));}return db['CannedAnswer'][_0x0f6c('0x46')](_0x4beb94['body']);})[_0x0f6c('0x21')](function(_0x11841f){var _0x22c668=_0x4beb94[_0x0f6c('0x4d')][_0x0f6c('0x23')]({'plain':!![]});if(!_0x22c668)throw new Error(_0x0f6c('0x4e'));if(_0x22c668['role']==='user'){var _0x82db74=_0x11841f[_0x0f6c('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x0f6c('0x44')]({'where':{'name':_0x0f6c('0x24'),'userProfileId':_0x22c668['userProfileId']},'raw':!![]})[_0x0f6c('0x21')](function(_0xebc25){if(_0xebc25&&_0xebc25[_0x0f6c('0x4f')]===0x0){return db[_0x0f6c('0x25')]['create']({'name':_0x82db74[_0x0f6c('0x27')],'resourceId':_0x82db74['id'],'type':_0xebc25[_0x0f6c('0x27')],'sectionId':_0xebc25['id']},{})[_0x0f6c('0x21')](function(){return _0x11841f;});}else{return _0x11841f;}})['catch'](function(_0x54c418){logger['error'](_0x0f6c('0x50'),_0x54c418);throw _0x54c418;});}return _0x11841f;})[_0x0f6c('0x21')](respondWithResult(_0x1714cb,0xc9))['catch'](handleError(_0x1714cb,null));}; \ No newline at end of file +var _0x3bb3=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','CannedAnswers','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','CannedAnswer','includeAll','include','rows','catch','params','keys','merge','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x4ac8ef,_0x5c2c6e){var _0x3a9239=function(_0x3d004e){while(--_0x3d004e){_0x4ac8ef['push'](_0x4ac8ef['shift']());}};_0x3a9239(++_0x5c2c6e);}(_0x3bb3,0x1b2));var _0x33bb=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3bb3[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0x33bb('0x0'));var rimraf=require(_0x33bb('0x1'));var zipdir=require(_0x33bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33bb('0x3'));var moment=require('moment');var BPromise=require(_0x33bb('0x4'));var Mustache=require(_0x33bb('0x5'));var util=require(_0x33bb('0x6'));var path=require(_0x33bb('0x7'));var sox=require(_0x33bb('0x8'));var csv=require('to-csv');var ejs=require(_0x33bb('0x9'));var fs=require('fs');var fs_extra=require(_0x33bb('0xa'));var _=require(_0x33bb('0xb'));var squel=require('squel');var crypto=require(_0x33bb('0xc'));var jsforce=require(_0x33bb('0xd'));var deskjs=require(_0x33bb('0xe'));var toCsv=require(_0x33bb('0xf'));var querystring=require(_0x33bb('0x10'));var Papa=require(_0x33bb('0x11'));var Redis=require(_0x33bb('0x12'));var authService=require(_0x33bb('0x13'));var qs=require(_0x33bb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x33bb('0x15'))(_0x33bb('0x16'));var utils=require('../../config/utils');var config=require(_0x33bb('0x17'));var licenseUtil=require(_0x33bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d3b63,_0x145601){_0x145601=_0x145601||0xcc;return function(_0x1432c8){if(_0x1432c8){return _0x2d3b63[_0x33bb('0x19')](_0x145601);}return _0x2d3b63[_0x33bb('0x1a')](_0x145601)['end']();};}function respondWithResult(_0x4500d1,_0x4295a3){_0x4295a3=_0x4295a3||0xc8;return function(_0x13bda8){if(_0x13bda8){return _0x4500d1[_0x33bb('0x1a')](_0x4295a3)[_0x33bb('0x1b')](_0x13bda8);}};}function respondWithFilteredResult(_0x1f3918,_0x27b44){return function(_0x40a8de){if(_0x40a8de){var _0x35b9c5=typeof _0x27b44['offset']===_0x33bb('0x1c')&&typeof _0x27b44[_0x33bb('0x1d')]==='undefined';var _0x589e01=_0x40a8de[_0x33bb('0x1e')];var _0x2bbd5b=_0x35b9c5?0x0:_0x27b44['offset'];var _0x8fc64e=_0x35b9c5?_0x40a8de[_0x33bb('0x1e')]:_0x27b44[_0x33bb('0x1f')]+_0x27b44['limit'];var _0x5f1b1d;if(_0x8fc64e>=_0x589e01){_0x8fc64e=_0x589e01;_0x5f1b1d=0xc8;}else{_0x5f1b1d=0xce;}_0x1f3918['status'](_0x5f1b1d);return _0x1f3918[_0x33bb('0x20')]('Content-Range',_0x2bbd5b+'-'+_0x8fc64e+'/'+_0x589e01)[_0x33bb('0x1b')](_0x40a8de);}return null;};}function patchUpdates(_0x59efdb){return function(_0x53c093){try{jsonpatch[_0x33bb('0x21')](_0x53c093,_0x59efdb,!![]);}catch(_0x125dac){return BPromise[_0x33bb('0x22')](_0x125dac);}return _0x53c093[_0x33bb('0x23')]();};}function saveUpdates(_0x2dc194,_0xec3d83){return function(_0x22a0eb){if(_0x22a0eb){return _0x22a0eb[_0x33bb('0x24')](_0x2dc194)[_0x33bb('0x25')](function(_0x1492fd){return _0x1492fd;});}return null;};}function removeEntity(_0x34b0d5,_0x1c4a17){return function(_0x2e73e0){if(_0x2e73e0){return _0x2e73e0[_0x33bb('0x26')]()[_0x33bb('0x25')](function(){var _0x250e35=_0x2e73e0[_0x33bb('0x27')]({'plain':!![]});var _0x3a9a8d=_0x33bb('0x28');return db['UserProfileResource'][_0x33bb('0x26')]({'where':{'type':_0x3a9a8d,'resourceId':_0x250e35['id']}})['then'](function(){return _0x2e73e0;});})['then'](function(){_0x34b0d5[_0x33bb('0x1a')](0xcc)[_0x33bb('0x29')]();});}};}function handleEntityNotFound(_0x3b5cc1,_0x5b3fd6){return function(_0x46052b){if(!_0x46052b){_0x3b5cc1[_0x33bb('0x19')](0x194);}return _0x46052b;};}function handleError(_0x1f7245,_0x4458f1){_0x4458f1=_0x4458f1||0x1f4;return function(_0x54c253){logger[_0x33bb('0x2a')](_0x54c253[_0x33bb('0x2b')]);if(_0x54c253[_0x33bb('0x2c')]){delete _0x54c253[_0x33bb('0x2c')];}_0x1f7245[_0x33bb('0x1a')](_0x4458f1)[_0x33bb('0x2d')](_0x54c253);};}exports['index']=function(_0x259d63,_0x5d4bb3){var _0x3f5849={},_0x29f305={},_0x4aa1a8={'count':0x0,'rows':[]};var _0x56be39=_[_0x33bb('0x2e')](db['CannedAnswer'][_0x33bb('0x2f')],function(_0x3d4551){return{'name':_0x3d4551[_0x33bb('0x30')],'type':_0x3d4551[_0x33bb('0x31')][_0x33bb('0x32')]};});_0x29f305[_0x33bb('0x33')]=_['map'](_0x56be39,_0x33bb('0x2c'));_0x29f305[_0x33bb('0x34')]=_['keys'](_0x259d63[_0x33bb('0x34')]);_0x29f305['filters']=_[_0x33bb('0x35')](_0x29f305[_0x33bb('0x33')],_0x29f305[_0x33bb('0x34')]);_0x3f5849['attributes']=_[_0x33bb('0x35')](_0x29f305['model'],qs['fields'](_0x259d63['query'][_0x33bb('0x36')]));_0x3f5849[_0x33bb('0x37')]=_0x3f5849['attributes'][_0x33bb('0x38')]?_0x3f5849[_0x33bb('0x37')]:_0x29f305[_0x33bb('0x33')];if(!_0x259d63[_0x33bb('0x34')]['hasOwnProperty'](_0x33bb('0x39'))){_0x3f5849[_0x33bb('0x1d')]=qs[_0x33bb('0x1d')](_0x259d63[_0x33bb('0x34')][_0x33bb('0x1d')]);_0x3f5849['offset']=qs[_0x33bb('0x1f')](_0x259d63[_0x33bb('0x34')][_0x33bb('0x1f')]);}_0x3f5849['order']=qs[_0x33bb('0x3a')](_0x259d63[_0x33bb('0x34')][_0x33bb('0x3a')]);_0x3f5849[_0x33bb('0x3b')]=qs[_0x33bb('0x3c')](_[_0x33bb('0x3d')](_0x259d63[_0x33bb('0x34')],_0x29f305[_0x33bb('0x3c')]),_0x56be39);if(_0x259d63['query']['filter']){_0x3f5849[_0x33bb('0x3b')]=_['merge'](_0x3f5849[_0x33bb('0x3b')],{'$or':[{'key':{'$like':'%'+_0x259d63[_0x33bb('0x34')][_0x33bb('0x3e')]+'%'}},{'value':{'$like':'%'+_0x259d63[_0x33bb('0x34')][_0x33bb('0x3e')]+'%'}}]});}_0x3f5849=_['merge']({},_0x3f5849,_0x259d63['options']);var _0x530eb9={'where':_0x3f5849[_0x33bb('0x3b')]};return db[_0x33bb('0x3f')]['count'](_0x530eb9)['then'](function(_0x1b1f7f){_0x4aa1a8[_0x33bb('0x1e')]=_0x1b1f7f;if(_0x259d63[_0x33bb('0x34')][_0x33bb('0x40')]){_0x3f5849[_0x33bb('0x41')]=[{'all':!![]}];}return db[_0x33bb('0x3f')]['findAll'](_0x3f5849);})[_0x33bb('0x25')](function(_0x5d6648){_0x4aa1a8[_0x33bb('0x42')]=_0x5d6648;return _0x4aa1a8;})['then'](respondWithFilteredResult(_0x5d4bb3,_0x3f5849))[_0x33bb('0x43')](handleError(_0x5d4bb3,null));};exports['show']=function(_0x284cbb,_0x3a652f){var _0x88336f={'raw':!![],'where':{'id':_0x284cbb[_0x33bb('0x44')]['id']}},_0x3a30d7={};_0x3a30d7[_0x33bb('0x33')]=_[_0x33bb('0x45')](db[_0x33bb('0x3f')][_0x33bb('0x2f')]);_0x3a30d7[_0x33bb('0x34')]=_[_0x33bb('0x45')](_0x284cbb[_0x33bb('0x34')]);_0x3a30d7[_0x33bb('0x3c')]=_[_0x33bb('0x35')](_0x3a30d7[_0x33bb('0x33')],_0x3a30d7[_0x33bb('0x34')]);_0x88336f[_0x33bb('0x37')]=_[_0x33bb('0x35')](_0x3a30d7[_0x33bb('0x33')],qs[_0x33bb('0x36')](_0x284cbb[_0x33bb('0x34')][_0x33bb('0x36')]));_0x88336f[_0x33bb('0x37')]=_0x88336f['attributes'][_0x33bb('0x38')]?_0x88336f['attributes']:_0x3a30d7[_0x33bb('0x33')];if(_0x284cbb['query'][_0x33bb('0x40')]){_0x88336f[_0x33bb('0x41')]=[{'all':!![]}];}_0x88336f=_[_0x33bb('0x46')]({},_0x88336f,_0x284cbb[_0x33bb('0x47')]);return db['CannedAnswer'][_0x33bb('0x48')](_0x88336f)[_0x33bb('0x25')](handleEntityNotFound(_0x3a652f,null))[_0x33bb('0x25')](respondWithResult(_0x3a652f,null))[_0x33bb('0x43')](handleError(_0x3a652f,null));};exports['update']=function(_0x272b68,_0xac4b49){if(_0x272b68['body']['id']){delete _0x272b68[_0x33bb('0x49')]['id'];}return db[_0x33bb('0x3f')][_0x33bb('0x48')]({'where':{'id':_0x272b68[_0x33bb('0x44')]['id']}})[_0x33bb('0x25')](handleEntityNotFound(_0xac4b49,null))[_0x33bb('0x25')](saveUpdates(_0x272b68[_0x33bb('0x49')],null))['then'](respondWithResult(_0xac4b49,null))[_0x33bb('0x43')](handleError(_0xac4b49,null));};exports[_0x33bb('0x26')]=function(_0x40296c,_0x2b5cd8){return db[_0x33bb('0x3f')][_0x33bb('0x48')]({'where':{'id':_0x40296c[_0x33bb('0x44')]['id']}})[_0x33bb('0x25')](handleEntityNotFound(_0x2b5cd8,null))[_0x33bb('0x25')](removeEntity(_0x2b5cd8,null))[_0x33bb('0x43')](handleError(_0x2b5cd8,null));};exports[_0x33bb('0x4a')]=function(_0x211f78,_0x11e555){var _0x4d523f={'key':_0x211f78[_0x33bb('0x49')][_0x33bb('0x32')]};if(_0x211f78[_0x33bb('0x49')][_0x33bb('0x4b')]){_0x4d523f[_0x33bb('0x4b')]=_0x211f78[_0x33bb('0x49')]['MailAccountId'];}else if(_0x211f78['body'][_0x33bb('0x4c')]){_0x4d523f[_0x33bb('0x4c')]=_0x211f78['body'][_0x33bb('0x4c')];}else if(_0x211f78[_0x33bb('0x49')][_0x33bb('0x4d')]){_0x4d523f['OpenchannelAccountId']=_0x211f78[_0x33bb('0x49')][_0x33bb('0x4d')];}else if(_0x211f78[_0x33bb('0x49')][_0x33bb('0x4e')]){_0x4d523f[_0x33bb('0x4e')]=_0x211f78[_0x33bb('0x49')][_0x33bb('0x4e')];}return db[_0x33bb('0x3f')][_0x33bb('0x48')]({'where':_0x4d523f})['then'](function(_0x4fe440){if(_0x4fe440){throw new db[(_0x33bb('0x4f'))]['ValidationError'](_0x33bb('0x50'));}return db[_0x33bb('0x3f')][_0x33bb('0x4a')](_0x211f78[_0x33bb('0x49')]);})[_0x33bb('0x25')](function(_0x19107a){var _0x190961=_0x211f78[_0x33bb('0x51')]['get']({'plain':!![]});if(!_0x190961)throw new Error(_0x33bb('0x52'));if(_0x190961[_0x33bb('0x53')]===_0x33bb('0x51')){var _0xac77d2=_0x19107a['get']({'plain':!![]});return db[_0x33bb('0x54')][_0x33bb('0x48')]({'where':{'name':_0x33bb('0x28'),'userProfileId':_0x190961[_0x33bb('0x55')]},'raw':!![]})[_0x33bb('0x25')](function(_0x22eed0){if(_0x22eed0&&_0x22eed0[_0x33bb('0x56')]===0x0){return db[_0x33bb('0x57')][_0x33bb('0x4a')]({'name':_0xac77d2[_0x33bb('0x2c')],'resourceId':_0xac77d2['id'],'type':_0x22eed0[_0x33bb('0x2c')],'sectionId':_0x22eed0['id']},{})[_0x33bb('0x25')](function(){return _0x19107a;});}else{return _0x19107a;}})[_0x33bb('0x43')](function(_0xbfd1ba){logger['error'](_0x33bb('0x58'),_0xbfd1ba);throw _0xbfd1ba;});}return _0x19107a;})[_0x33bb('0x25')](respondWithResult(_0x11e555,0xc9))['catch'](handleError(_0x11e555,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 39467b3..1115659 100644 --- a/server/api/cannedAnswer/cannedAnswer.model.js +++ b/server/api/cannedAnswer/cannedAnswer.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb96=['CannedAnswer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x4c4a55,_0x1f7c2c){var _0x20c250=function(_0x46bbd1){while(--_0x46bbd1){_0x4c4a55['push'](_0x4c4a55['shift']());}};_0x20c250(++_0x1f7c2c);}(_0xfb96,0x151));var _0x6fb9=function(_0x4bdebe,_0xc0009d){_0x4bdebe=_0x4bdebe-0x0;var _0x21bdb6=_0xfb96[_0x4bdebe];return _0x21bdb6;};'use strict';var _=require(_0x6fb9('0x0'));var util=require(_0x6fb9('0x1'));var logger=require(_0x6fb9('0x2'))(_0x6fb9('0x3'));var moment=require(_0x6fb9('0x4'));var BPromise=require(_0x6fb9('0x5'));var rp=require(_0x6fb9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fb9('0x7'));var config=require(_0x6fb9('0x8'));var attributes=require(_0x6fb9('0x9'));module[_0x6fb9('0xa')]=function(_0xb229ce,_0x1c9f01){return _0xb229ce['define'](_0x6fb9('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7990=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0x7990,0xe3));var _0x0799=function(_0xa8a859,_0x5cfcec){_0xa8a859=_0xa8a859-0x0;var _0xc4b628=_0x7990[_0xa8a859];return _0xc4b628;};'use strict';var _=require(_0x0799('0x0'));var util=require(_0x0799('0x1'));var logger=require(_0x0799('0x2'))(_0x0799('0x3'));var moment=require(_0x0799('0x4'));var BPromise=require(_0x0799('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0799('0x6'));var rimraf=require('rimraf');var config=require(_0x0799('0x7'));var attributes=require(_0x0799('0x8'));module['exports']=function(_0x25f287,_0x14bdfc){return _0x25f287['define'](_0x0799('0x9'),attributes,{'tableName':_0x0799('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0799('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 046d130..57a0e78 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x87aa6b,_0x362aed){var _0x96a500=function(_0x533f56){while(--_0x533f56){_0x87aa6b['push'](_0x87aa6b['shift']());}};_0x96a500(++_0x362aed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x46aa27,_0x1b8e08){var _0x3c570e=function(_0x38b5cf){while(--_0x38b5cf){_0x46aa27['push'](_0x46aa27['shift']());}};_0x3c570e(++_0x1b8e08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index b85d3f6..089aa93 100644 --- a/server/api/cannedAnswer/index.js +++ b/server/api/cannedAnswer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72d9=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer'];(function(_0x4dd623,_0x5e2355){var _0x3c7e10=function(_0x4c9473){while(--_0x4c9473){_0x4dd623['push'](_0x4dd623['shift']());}};_0x3c7e10(++_0x5e2355);}(_0x72d9,0xdc));var _0x972d=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x72d9[_0xfa634c];return _0x73e478;};'use strict';var multer=require(_0x972d('0x0'));var util=require(_0x972d('0x1'));var path=require(_0x972d('0x2'));var timeout=require(_0x972d('0x3'));var express=require(_0x972d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x972d('0x5'));var interaction=require(_0x972d('0x6'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x972d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x972d('0x7')](_0x972d('0x8'),auth[_0x972d('0x9')](),controller[_0x972d('0xa')]);router[_0x972d('0xb')]('/',auth[_0x972d('0x9')](),controller[_0x972d('0xc')]);router[_0x972d('0xd')](_0x972d('0x8'),auth[_0x972d('0x9')](),controller[_0x972d('0xe')]);router[_0x972d('0xf')](_0x972d('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x972d('0x10')]=router; \ No newline at end of file +var _0x1ec2=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x17933a,_0x1319ef){var _0x4b6a02=function(_0x321b46){while(--_0x321b46){_0x17933a['push'](_0x17933a['shift']());}};_0x4b6a02(++_0x1319ef);}(_0x1ec2,0x103));var _0x21ec=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x1ec2[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x21ec('0x0'));var util=require(_0x21ec('0x1'));var path=require(_0x21ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x21ec('0x3'));var router=express['Router']();var fs_extra=require(_0x21ec('0x4'));var auth=require(_0x21ec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x21ec('0x6'));var controller=require(_0x21ec('0x7'));router[_0x21ec('0x8')]('/',auth[_0x21ec('0x9')](),controller[_0x21ec('0xa')]);router['get'](_0x21ec('0xb'),auth[_0x21ec('0x9')](),controller[_0x21ec('0xc')]);router[_0x21ec('0xd')]('/',auth[_0x21ec('0x9')](),controller[_0x21ec('0xe')]);router[_0x21ec('0xf')](_0x21ec('0xb'),auth[_0x21ec('0x9')](),controller['update']);router[_0x21ec('0x10')](_0x21ec('0xb'),auth[_0x21ec('0x9')](),controller[_0x21ec('0x11')]);module[_0x21ec('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index c550415..56d77e1 100644 --- a/server/api/cdr/cdr.attributes.js +++ b/server/api/cdr/cdr.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x462e=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x501ec0,_0x194444){var _0x3a4684=function(_0x461db8){while(--_0x461db8){_0x501ec0['push'](_0x501ec0['shift']());}};_0x3a4684(++_0x194444);}(_0x462e,0x13c));var _0xe462=function(_0x37c9d1,_0x1fb5f5){_0x37c9d1=_0x37c9d1-0x0;var _0x36bbaf=_0x462e[_0x37c9d1];return _0x36bbaf;};'use strict';var Sequelize=require(_0xe462('0x0'));module[_0xe462('0x1')]={'calldate':{'type':Sequelize[_0xe462('0x2')],'allowNull':![],'defaultValue':_0xe462('0x3')},'clid':{'type':Sequelize[_0xe462('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xe462('0x4')]},'dcontext':{'type':Sequelize[_0xe462('0x4')]},'channel':{'type':Sequelize[_0xe462('0x4')]},'dstchannel':{'type':Sequelize[_0xe462('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xe462('0x4')]},'duration':{'type':Sequelize[_0xe462('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xe462('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe462('0x4')]},'amaflags':{'type':Sequelize[_0xe462('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xe462('0x4')]},'uniqueid':{'type':Sequelize[_0xe462('0x4')]},'linkedid':{'type':Sequelize[_0xe462('0x4')]},'sequence':{'type':Sequelize[_0xe462('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe462('0x4')]},'tag':{'type':Sequelize[_0xe462('0x4')]}}; \ No newline at end of file +var _0x2e3d=['STRING','INTEGER','sequelize','1970-01-01\x2000:00:01'];(function(_0x4591e0,_0xec4c9f){var _0x1c6ad6=function(_0x332520){while(--_0x332520){_0x4591e0['push'](_0x4591e0['shift']());}};_0x1c6ad6(++_0xec4c9f);}(_0x2e3d,0x1be));var _0xd2e3=function(_0x4be929,_0x11bbda){_0x4be929=_0x4be929-0x0;var _0x34c57f=_0x2e3d[_0x4be929];return _0x34c57f;};'use strict';var Sequelize=require(_0xd2e3('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xd2e3('0x1')},'clid':{'type':Sequelize[_0xd2e3('0x2')]},'src':{'type':Sequelize[_0xd2e3('0x2')]},'dst':{'type':Sequelize[_0xd2e3('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xd2e3('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xd2e3('0x2')]},'duration':{'type':Sequelize[_0xd2e3('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd2e3('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd2e3('0x2')]},'amaflags':{'type':Sequelize[_0xd2e3('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd2e3('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd2e3('0x2')]},'linkedid':{'type':Sequelize[_0xd2e3('0x2')]},'sequence':{'type':Sequelize[_0xd2e3('0x2')]},'peeraccount':{'type':Sequelize[_0xd2e3('0x2')]},'type':{'type':Sequelize[_0xd2e3('0x2')]},'tag':{'type':Sequelize[_0xd2e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index aaeef48..91af2a0 100644 --- a/server/api/cdr/cdr.controller.js +++ b/server/api/cdr/cdr.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x126e=['../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','Cdr','rawAttributes','type','model','map','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','show','params','intersection','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x36d8e0,_0x29c701){var _0x4b5d52=function(_0x2e0a9d){while(--_0x2e0a9d){_0x36d8e0['push'](_0x36d8e0['shift']());}};_0x4b5d52(++_0x29c701);}(_0x126e,0x108));var _0xe126=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x126e[_0x618414];return _0x21c19a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe126('0x0'));var zipdir=require(_0xe126('0x1'));var jsonpatch=require(_0xe126('0x2'));var rp=require(_0xe126('0x3'));var moment=require(_0xe126('0x4'));var BPromise=require(_0xe126('0x5'));var Mustache=require('mustache');var util=require(_0xe126('0x6'));var path=require(_0xe126('0x7'));var sox=require(_0xe126('0x8'));var csv=require(_0xe126('0x9'));var ejs=require(_0xe126('0xa'));var fs=require('fs');var fs_extra=require(_0xe126('0xb'));var _=require(_0xe126('0xc'));var squel=require('squel');var crypto=require(_0xe126('0xd'));var jsforce=require(_0xe126('0xe'));var deskjs=require(_0xe126('0xf'));var toCsv=require(_0xe126('0x9'));var querystring=require(_0xe126('0x10'));var Papa=require('papaparse');var Redis=require(_0xe126('0x11'));var authService=require(_0xe126('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe126('0x13'));var hardwareService=require(_0xe126('0x14'));var logger=require('../../config/logger')(_0xe126('0x15'));var utils=require('../../config/utils');var config=require(_0xe126('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe126('0x17'))['db'];function respondWithStatusCode(_0x34ae06,_0x23ff02){_0x23ff02=_0x23ff02||0xcc;return function(_0x38b8c3){if(_0x38b8c3){return _0x34ae06[_0xe126('0x18')](_0x23ff02);}return _0x34ae06[_0xe126('0x19')](_0x23ff02)[_0xe126('0x1a')]();};}function respondWithResult(_0x55f10a,_0xd55baf){_0xd55baf=_0xd55baf||0xc8;return function(_0x1c02c9){if(_0x1c02c9){return _0x55f10a['status'](_0xd55baf)[_0xe126('0x1b')](_0x1c02c9);}};}function respondWithFilteredResult(_0x28d7dd,_0x10bc24){return function(_0x38b0c0){if(_0x38b0c0){var _0x5e52d1=typeof _0x10bc24[_0xe126('0x1c')]===_0xe126('0x1d')&&typeof _0x10bc24[_0xe126('0x1e')]==='undefined';var _0x2b0baa=_0x38b0c0['count'];var _0x46c98a=_0x5e52d1?0x0:_0x10bc24[_0xe126('0x1c')];var _0x19b0a3=_0x5e52d1?_0x38b0c0[_0xe126('0x1f')]:_0x10bc24[_0xe126('0x1c')]+_0x10bc24[_0xe126('0x1e')];var _0x20874b;if(_0x19b0a3>=_0x2b0baa){_0x19b0a3=_0x2b0baa;_0x20874b=0xc8;}else{_0x20874b=0xce;}_0x28d7dd[_0xe126('0x19')](_0x20874b);return _0x28d7dd['set'](_0xe126('0x20'),_0x46c98a+'-'+_0x19b0a3+'/'+_0x2b0baa)[_0xe126('0x1b')](_0x38b0c0);}return null;};}function patchUpdates(_0x35ab64){return function(_0x2e5617){try{jsonpatch[_0xe126('0x21')](_0x2e5617,_0x35ab64,!![]);}catch(_0x24076e){return BPromise[_0xe126('0x22')](_0x24076e);}return _0x2e5617[_0xe126('0x23')]();};}function saveUpdates(_0x5257bc,_0x4a1a97){return function(_0xdb6544){if(_0xdb6544){return _0xdb6544[_0xe126('0x24')](_0x5257bc)[_0xe126('0x25')](function(_0x5f1ce1){return _0x5f1ce1;});}return null;};}function removeEntity(_0x5381e1,_0x47f179){return function(_0x4807d3){if(_0x4807d3){return _0x4807d3[_0xe126('0x26')]()['then'](function(){_0x5381e1[_0xe126('0x19')](0xcc)[_0xe126('0x1a')]();});}};}function handleEntityNotFound(_0x4157ed,_0x1674c9){return function(_0x532409){if(!_0x532409){_0x4157ed['sendStatus'](0x194);}return _0x532409;};}function handleError(_0x26482f,_0x4facea){_0x4facea=_0x4facea||0x1f4;return function(_0x3f5de5){logger[_0xe126('0x27')](_0x3f5de5[_0xe126('0x28')]);if(_0x3f5de5['name']){delete _0x3f5de5[_0xe126('0x29')];}_0x26482f[_0xe126('0x19')](_0x4facea)['send'](_0x3f5de5);};}exports[_0xe126('0x2a')]=function(_0x259059,_0x5a8b2a){var _0x9d9e28={},_0x1fb354={},_0x29dec4={'count':0x0,'rows':[]};var _0x181ccc=_['map'](db[_0xe126('0x2b')][_0xe126('0x2c')],function(_0x5e7bab){return{'name':_0x5e7bab['fieldName'],'type':_0x5e7bab[_0xe126('0x2d')]['key']};});_0x1fb354[_0xe126('0x2e')]=_[_0xe126('0x2f')](_0x181ccc,_0xe126('0x29'));_0x1fb354['query']=_[_0xe126('0x30')](_0x259059[_0xe126('0x31')]);_0x1fb354[_0xe126('0x32')]=_['intersection'](_0x1fb354[_0xe126('0x2e')],_0x1fb354[_0xe126('0x31')]);_0x9d9e28['attributes']=_['intersection'](_0x1fb354[_0xe126('0x2e')],qs[_0xe126('0x33')](_0x259059[_0xe126('0x31')][_0xe126('0x33')]));_0x9d9e28[_0xe126('0x34')]=_0x9d9e28[_0xe126('0x34')][_0xe126('0x35')]?_0x9d9e28[_0xe126('0x34')]:_0x1fb354['model'];if(!_0x259059[_0xe126('0x31')][_0xe126('0x36')](_0xe126('0x37'))){_0x9d9e28[_0xe126('0x1e')]=qs[_0xe126('0x1e')](_0x259059[_0xe126('0x31')]['limit']);_0x9d9e28[_0xe126('0x1c')]=qs[_0xe126('0x1c')](_0x259059[_0xe126('0x31')][_0xe126('0x1c')]);}_0x9d9e28[_0xe126('0x38')]=qs['sort'](_0x259059[_0xe126('0x31')][_0xe126('0x39')]);_0x9d9e28[_0xe126('0x3a')]=qs[_0xe126('0x32')](_['pick'](_0x259059[_0xe126('0x31')],_0x1fb354[_0xe126('0x32')]),_0x181ccc);if(_0x259059[_0xe126('0x31')][_0xe126('0x3b')]){_0x9d9e28[_0xe126('0x3a')]=_[_0xe126('0x3c')](_0x9d9e28['where'],{'$or':_[_0xe126('0x2f')](_0x181ccc,function(_0x1a8edf){if(_0x1a8edf[_0xe126('0x2d')]!=='VIRTUAL'){var _0x5073bc={};_0x5073bc[_0x1a8edf[_0xe126('0x29')]]={'$like':'%'+_0x259059[_0xe126('0x31')][_0xe126('0x3b')]+'%'};return _0x5073bc;}})});}_0x9d9e28=_[_0xe126('0x3c')]({},_0x9d9e28,_0x259059[_0xe126('0x3d')]);var _0x1c128d={'where':_0x9d9e28['where']};return db[_0xe126('0x2b')][_0xe126('0x1f')](_0x1c128d)['then'](function(_0x4eb3d7){_0x29dec4[_0xe126('0x1f')]=_0x4eb3d7;if(_0x259059[_0xe126('0x31')]['includeAll']){_0x9d9e28[_0xe126('0x3e')]=[{'all':!![]}];}return db[_0xe126('0x2b')]['findAll'](_0x9d9e28);})[_0xe126('0x25')](function(_0x366754){_0x29dec4['rows']=_0x366754;return _0x29dec4;})[_0xe126('0x25')](respondWithFilteredResult(_0x5a8b2a,_0x9d9e28))['catch'](handleError(_0x5a8b2a,null));};exports[_0xe126('0x3f')]=function(_0x23d1d8,_0x5d5111){var _0x3613de={'raw':!![],'where':{'id':_0x23d1d8[_0xe126('0x40')]['id']}},_0x149b84={};_0x149b84['model']=_[_0xe126('0x30')](db['Cdr'][_0xe126('0x2c')]);_0x149b84[_0xe126('0x31')]=_[_0xe126('0x30')](_0x23d1d8[_0xe126('0x31')]);_0x149b84[_0xe126('0x32')]=_[_0xe126('0x41')](_0x149b84[_0xe126('0x2e')],_0x149b84[_0xe126('0x31')]);_0x3613de[_0xe126('0x34')]=_[_0xe126('0x41')](_0x149b84[_0xe126('0x2e')],qs['fields'](_0x23d1d8['query'][_0xe126('0x33')]));_0x3613de[_0xe126('0x34')]=_0x3613de['attributes'][_0xe126('0x35')]?_0x3613de[_0xe126('0x34')]:_0x149b84[_0xe126('0x2e')];if(_0x23d1d8[_0xe126('0x31')]['includeAll']){_0x3613de[_0xe126('0x3e')]=[{'all':!![]}];}_0x3613de=_[_0xe126('0x3c')]({},_0x3613de,_0x23d1d8[_0xe126('0x3d')]);return db[_0xe126('0x2b')][_0xe126('0x42')](_0x3613de)[_0xe126('0x25')](handleEntityNotFound(_0x5d5111,null))[_0xe126('0x25')](respondWithResult(_0x5d5111,null))[_0xe126('0x43')](handleError(_0x5d5111,null));};exports[_0xe126('0x44')]=function(_0xccc25d,_0x23007d){return db[_0xe126('0x2b')][_0xe126('0x44')](_0xccc25d['body'],{})['then'](respondWithResult(_0x23007d,0xc9))['catch'](handleError(_0x23007d,null));};exports['update']=function(_0xe642ae,_0x8d5abd){if(_0xe642ae[_0xe126('0x45')]['id']){delete _0xe642ae[_0xe126('0x45')]['id'];}return db[_0xe126('0x2b')][_0xe126('0x42')]({'where':{'id':_0xe642ae[_0xe126('0x40')]['id']}})['then'](handleEntityNotFound(_0x8d5abd,null))['then'](saveUpdates(_0xe642ae[_0xe126('0x45')],null))[_0xe126('0x25')](respondWithResult(_0x8d5abd,null))['catch'](handleError(_0x8d5abd,null));};exports[_0xe126('0x26')]=function(_0x209002,_0x518e43){return db[_0xe126('0x2b')][_0xe126('0x42')]({'where':{'id':_0x209002['params']['id']}})['then'](handleEntityNotFound(_0x518e43,null))[_0xe126('0x25')](removeEntity(_0x518e43,null))[_0xe126('0x43')](handleError(_0x518e43,null));};exports[_0xe126('0x46')]=function(_0x48fbed,_0x31e193){return db['Cdr'][_0xe126('0x46')]()[_0xe126('0x25')](respondWithResult(_0x31e193,null))['catch'](handleError(_0x31e193,null));}; \ No newline at end of file +var _0x7da7=['count','limit','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','Cdr','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7da7,0x10d));var _0x77da=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x7da7[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){_0x27b6c7['status'](0xcc)[_0x77da('0x23')]();});}};}function handleEntityNotFound(_0x2d009f,_0x835167){return function(_0xbd06b7){if(!_0xbd06b7){_0x2d009f['sendStatus'](0x194);}return _0xbd06b7;};}function handleError(_0x42240b,_0x167240){_0x167240=_0x167240||0x1f4;return function(_0x470c9f){logger[_0x77da('0x24')](_0x470c9f[_0x77da('0x25')]);if(_0x470c9f['name']){delete _0x470c9f[_0x77da('0x26')];}_0x42240b[_0x77da('0x18')](_0x167240)[_0x77da('0x27')](_0x470c9f);};}exports[_0x77da('0x28')]=function(_0x496ecd,_0x5b4638){var _0x4d395a={},_0x2258e9={},_0x30456a={'count':0x0,'rows':[]};var _0x410d09=_[_0x77da('0x29')](db[_0x77da('0x2a')]['rawAttributes'],function(_0x350b4e){return{'name':_0x350b4e[_0x77da('0x2b')],'type':_0x350b4e[_0x77da('0x2c')][_0x77da('0x2d')]};});_0x2258e9[_0x77da('0x2e')]=_[_0x77da('0x29')](_0x410d09,'name');_0x2258e9[_0x77da('0x2f')]=_[_0x77da('0x30')](_0x496ecd[_0x77da('0x2f')]);_0x2258e9[_0x77da('0x31')]=_[_0x77da('0x32')](_0x2258e9[_0x77da('0x2e')],_0x2258e9[_0x77da('0x2f')]);_0x4d395a[_0x77da('0x33')]=_['intersection'](_0x2258e9['model'],qs[_0x77da('0x34')](_0x496ecd[_0x77da('0x2f')]['fields']));_0x4d395a[_0x77da('0x33')]=_0x4d395a[_0x77da('0x33')][_0x77da('0x35')]?_0x4d395a[_0x77da('0x33')]:_0x2258e9[_0x77da('0x2e')];if(!_0x496ecd[_0x77da('0x2f')][_0x77da('0x36')]('nolimit')){_0x4d395a[_0x77da('0x1c')]=qs['limit'](_0x496ecd['query']['limit']);_0x4d395a[_0x77da('0x19')]=qs['offset'](_0x496ecd[_0x77da('0x2f')][_0x77da('0x19')]);}_0x4d395a[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x496ecd[_0x77da('0x2f')][_0x77da('0x38')]);_0x4d395a[_0x77da('0x39')]=qs['filters'](_[_0x77da('0x3a')](_0x496ecd[_0x77da('0x2f')],_0x2258e9[_0x77da('0x31')]),_0x410d09);if(_0x496ecd[_0x77da('0x2f')][_0x77da('0x3b')]){_0x4d395a[_0x77da('0x39')]=_['merge'](_0x4d395a[_0x77da('0x39')],{'$or':_[_0x77da('0x29')](_0x410d09,function(_0x2cd190){if(_0x2cd190['type']!==_0x77da('0x3c')){var _0x505ffb={};_0x505ffb[_0x2cd190['name']]={'$like':'%'+_0x496ecd['query']['filter']+'%'};return _0x505ffb;}})});}_0x4d395a=_[_0x77da('0x3d')]({},_0x4d395a,_0x496ecd[_0x77da('0x3e')]);var _0xebdea1={'where':_0x4d395a['where']};return db[_0x77da('0x2a')]['count'](_0xebdea1)[_0x77da('0x21')](function(_0x517bd0){_0x30456a[_0x77da('0x1b')]=_0x517bd0;if(_0x496ecd[_0x77da('0x2f')][_0x77da('0x3f')]){_0x4d395a[_0x77da('0x40')]=[{'all':!![]}];}return db[_0x77da('0x2a')]['findAll'](_0x4d395a);})[_0x77da('0x21')](function(_0x1f48bd){_0x30456a[_0x77da('0x41')]=_0x1f48bd;return _0x30456a;})[_0x77da('0x21')](respondWithFilteredResult(_0x5b4638,_0x4d395a))[_0x77da('0x42')](handleError(_0x5b4638,null));};exports[_0x77da('0x43')]=function(_0x4ea24c,_0x319625){var _0x2f0495={'raw':!![],'where':{'id':_0x4ea24c[_0x77da('0x44')]['id']}},_0x21de41={};_0x21de41[_0x77da('0x2e')]=_[_0x77da('0x30')](db['Cdr'][_0x77da('0x45')]);_0x21de41['query']=_[_0x77da('0x30')](_0x4ea24c[_0x77da('0x2f')]);_0x21de41[_0x77da('0x31')]=_['intersection'](_0x21de41[_0x77da('0x2e')],_0x21de41[_0x77da('0x2f')]);_0x2f0495[_0x77da('0x33')]=_[_0x77da('0x32')](_0x21de41[_0x77da('0x2e')],qs[_0x77da('0x34')](_0x4ea24c[_0x77da('0x2f')][_0x77da('0x34')]));_0x2f0495[_0x77da('0x33')]=_0x2f0495['attributes'][_0x77da('0x35')]?_0x2f0495[_0x77da('0x33')]:_0x21de41[_0x77da('0x2e')];if(_0x4ea24c[_0x77da('0x2f')][_0x77da('0x3f')]){_0x2f0495[_0x77da('0x40')]=[{'all':!![]}];}_0x2f0495=_['merge']({},_0x2f0495,_0x4ea24c['options']);return db[_0x77da('0x2a')][_0x77da('0x46')](_0x2f0495)[_0x77da('0x21')](handleEntityNotFound(_0x319625,null))[_0x77da('0x21')](respondWithResult(_0x319625,null))[_0x77da('0x42')](handleError(_0x319625,null));};exports[_0x77da('0x47')]=function(_0x4e811e,_0x6ccb8f){return db[_0x77da('0x2a')][_0x77da('0x47')](_0x4e811e[_0x77da('0x48')],{})['then'](respondWithResult(_0x6ccb8f,0xc9))[_0x77da('0x42')](handleError(_0x6ccb8f,null));};exports['update']=function(_0x518fd5,_0x36263b){if(_0x518fd5[_0x77da('0x48')]['id']){delete _0x518fd5[_0x77da('0x48')]['id'];}return db[_0x77da('0x2a')]['find']({'where':{'id':_0x518fd5[_0x77da('0x44')]['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x36263b,null))['then'](saveUpdates(_0x518fd5[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x36263b,null))['catch'](handleError(_0x36263b,null));};exports[_0x77da('0x22')]=function(_0x3aaf5b,_0x2b73d3){return db[_0x77da('0x2a')][_0x77da('0x46')]({'where':{'id':_0x3aaf5b[_0x77da('0x44')]['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x2b73d3,null))[_0x77da('0x21')](removeEntity(_0x2b73d3,null))[_0x77da('0x42')](handleError(_0x2b73d3,null));};exports[_0x77da('0x49')]=function(_0x52aa0a,_0x3d04a3){return db['Cdr'][_0x77da('0x49')]()[_0x77da('0x21')](respondWithResult(_0x3d04a3,null))[_0x77da('0x42')](handleError(_0x3d04a3,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ca73079..34dd384 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x250010,_0x489f87){var _0x2448f2=function(_0x56f2b2){while(--_0x56f2b2){_0x250010['push'](_0x250010['shift']());}};_0x2448f2(++_0x489f87);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x665877,_0x454a08){var _0x5473bc=function(_0x1c9536){while(--_0x1c9536){_0x665877['push'](_0x665877['shift']());}};_0x5473bc(++_0x454a08);}(_0x7a54,0x106));var _0x47a5=function(_0x48bbe9,_0x33d8ec){_0x48bbe9=_0x48bbe9-0x0;var _0x302e7a=_0x7a54[_0x48bbe9];return _0x302e7a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index ba7a11d..620b33a 100644 --- a/server/api/cdr/cdr.rpc.js +++ b/server/api/cdr/cdr.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84c5=['rpc','../../config/environment','jayson/promise','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0xb81738,_0x5505d3){var _0x3ab859=function(_0x421b75){while(--_0x421b75){_0xb81738['push'](_0xb81738['shift']());}};_0x3ab859(++_0x5505d3);}(_0x84c5,0xa5));var _0x584c=function(_0x81edca,_0x5a643d){_0x81edca=_0x81edca-0x0;var _0x3cbd43=_0x84c5[_0x81edca];return _0x3cbd43;};'use strict';var _=require(_0x584c('0x0'));var util=require(_0x584c('0x1'));var moment=require(_0x584c('0x2'));var BPromise=require('bluebird');var rs=require(_0x584c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x584c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x584c('0x5'))(_0x584c('0x6'));var config=require(_0x584c('0x7'));var jayson=require(_0x584c('0x8'));var client=jayson['client'][_0x584c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a73fa,_0x425597,_0xd279d2){return new BPromise(function(_0x4c8a62,_0x525eda){return client['request'](_0x3a73fa,_0xd279d2)[_0x584c('0xa')](function(_0x1bd214){logger[_0x584c('0xb')](_0x584c('0xc'),_0x425597,_0x584c('0xd'));logger[_0x584c('0xe')](_0x584c('0xf'),_0x425597,_0x584c('0xd'),JSON['stringify'](_0x1bd214));if(_0x1bd214[_0x584c('0x10')]){if(_0x1bd214[_0x584c('0x10')]['code']===0x1f4){logger[_0x584c('0x10')](_0x584c('0xc'),_0x425597,_0x1bd214['error']['message']);return _0x525eda(_0x1bd214['error'][_0x584c('0x11')]);}logger[_0x584c('0x10')](_0x584c('0xc'),_0x425597,_0x1bd214[_0x584c('0x10')][_0x584c('0x11')]);return _0x4c8a62(_0x1bd214[_0x584c('0x10')][_0x584c('0x11')]);}else{logger[_0x584c('0xb')]('Cdr,\x20%s,\x20%s',_0x425597,_0x584c('0xd'));_0x4c8a62(_0x1bd214['result'][_0x584c('0x11')]);}})[_0x584c('0x12')](function(_0x22d432){logger[_0x584c('0x10')](_0x584c('0xc'),_0x425597,_0x22d432);_0x525eda(_0x22d432);});});} \ No newline at end of file +var _0xd626=['then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x25e2a5,_0x2d7270){var _0x429243=function(_0x16853){while(--_0x16853){_0x25e2a5['push'](_0x25e2a5['shift']());}};_0x429243(++_0x2d7270);}(_0xd626,0x1d5));var _0x6d62=function(_0x2f3b65,_0x4db279){_0x2f3b65=_0x2f3b65-0x0;var _0x312b32=_0xd626[_0x2f3b65];return _0x312b32;};'use strict';var _=require('lodash');var util=require(_0x6d62('0x0'));var moment=require(_0x6d62('0x1'));var BPromise=require(_0x6d62('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d62('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d62('0x4'))(_0x6d62('0x5'));var config=require(_0x6d62('0x6'));var jayson=require(_0x6d62('0x7'));var client=jayson[_0x6d62('0x8')][_0x6d62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x289689,_0x219c72,_0x576e0f){return new BPromise(function(_0x16f5fe,_0x2ee642){return client[_0x6d62('0xa')](_0x289689,_0x576e0f)[_0x6d62('0xb')](function(_0x4c14f2){logger[_0x6d62('0xc')](_0x6d62('0xd'),_0x219c72,_0x6d62('0xe'));logger[_0x6d62('0xf')](_0x6d62('0x10'),_0x219c72,_0x6d62('0xe'),JSON[_0x6d62('0x11')](_0x4c14f2));if(_0x4c14f2[_0x6d62('0x12')]){if(_0x4c14f2[_0x6d62('0x12')]['code']===0x1f4){logger[_0x6d62('0x12')](_0x6d62('0xd'),_0x219c72,_0x4c14f2[_0x6d62('0x12')][_0x6d62('0x13')]);return _0x2ee642(_0x4c14f2['error']['message']);}logger[_0x6d62('0x12')]('Cdr,\x20%s,\x20%s',_0x219c72,_0x4c14f2[_0x6d62('0x12')][_0x6d62('0x13')]);return _0x16f5fe(_0x4c14f2[_0x6d62('0x12')][_0x6d62('0x13')]);}else{logger[_0x6d62('0xc')](_0x6d62('0xd'),_0x219c72,_0x6d62('0xe'));_0x16f5fe(_0x4c14f2['result'][_0x6d62('0x13')]);}})['catch'](function(_0x238c25){logger[_0x6d62('0x12')](_0x6d62('0xd'),_0x219c72,_0x238c25);_0x2ee642(_0x238c25);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 93380d9..a01b574 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1f9ee6,_0x7255cb){var _0x101b73=function(_0x2e6ef0){while(--_0x2e6ef0){_0x1f9ee6['push'](_0x1f9ee6['shift']());}};_0x101b73(++_0x7255cb);}(_0xb10b,0x12a));var _0xbb10=function(_0xafdf47,_0x38b5b3){_0xafdf47=_0xafdf47-0x0;var _0x1e6c17=_0xb10b[_0xafdf47];return _0x1e6c17;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 7930d6b..0f38d7e 100644 --- a/server/api/chatApplication/chatApplication.attributes.js +++ b/server/api/chatApplication/chatApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf27=['sequelize','exports','noop','*,*,*,*'];(function(_0x15a116,_0x83bedf){var _0x307a83=function(_0x2aa3b6){while(--_0x2aa3b6){_0x15a116['push'](_0x15a116['shift']());}};_0x307a83(++_0x83bedf);}(_0xdf27,0x104));var _0x7df2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdf27[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7df2('0x0'));module[_0x7df2('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7df2('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7df2('0x3')}}; \ No newline at end of file +var _0xd6ad=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x47686a,_0x23470a){var _0x119e1a=function(_0xef25e3){while(--_0xef25e3){_0x47686a['push'](_0x47686a['shift']());}};_0x119e1a(++_0x23470a);}(_0xd6ad,0x1f0));var _0xdd6a=function(_0x100519,_0x50dd2c){_0x100519=_0x100519-0x0;var _0x1dd752=_0xd6ad[_0x100519];return _0x1dd752;};'use strict';var Sequelize=require(_0xdd6a('0x0'));module[_0xdd6a('0x1')]={'priority':{'type':Sequelize[_0xdd6a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdd6a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdd6a('0x4')]()},'description':{'type':Sequelize[_0xdd6a('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 51da908..76bff24 100644 --- a/server/api/chatApplication/chatApplication.controller.js +++ b/server/api/chatApplication/chatApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe148=['bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','params','model','keys','rawAttributes','query','intersection','attributes','fields','merge','options','find','catch','body','ChatApplication','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe148,0x9e));var _0x8e14=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0xe148[_0xf51c06];return _0x1d5420;};'use strict';var emlformat=require(_0x8e14('0x0'));var rimraf=require(_0x8e14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e14('0x2'));var rp=require(_0x8e14('0x3'));var moment=require('moment');var BPromise=require(_0x8e14('0x4'));var Mustache=require(_0x8e14('0x5'));var util=require(_0x8e14('0x6'));var path=require(_0x8e14('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8e14('0x8'));var fs=require('fs');var fs_extra=require(_0x8e14('0x9'));var _=require('lodash');var squel=require(_0x8e14('0xa'));var crypto=require(_0x8e14('0xb'));var jsforce=require(_0x8e14('0xc'));var deskjs=require(_0x8e14('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8e14('0xe'));var Papa=require('papaparse');var Redis=require(_0x8e14('0xf'));var authService=require(_0x8e14('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8e14('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8e14('0x12'));var utils=require(_0x8e14('0x13'));var config=require(_0x8e14('0x14'));var licenseUtil=require(_0x8e14('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x243e4f,_0x5712fe){_0x5712fe=_0x5712fe||0xcc;return function(_0x5c49d9){if(_0x5c49d9){return _0x243e4f[_0x8e14('0x16')](_0x5712fe);}return _0x243e4f['status'](_0x5712fe)[_0x8e14('0x17')]();};}function respondWithResult(_0x4e1223,_0x59e069){_0x59e069=_0x59e069||0xc8;return function(_0x4f36a5){if(_0x4f36a5){return _0x4e1223[_0x8e14('0x18')](_0x59e069)[_0x8e14('0x19')](_0x4f36a5);}};}function respondWithFilteredResult(_0x13bdc0,_0x128217){return function(_0x40b964){if(_0x40b964){var _0x50db2e=typeof _0x128217[_0x8e14('0x1a')]===_0x8e14('0x1b')&&typeof _0x128217['limit']===_0x8e14('0x1b');var _0x201f86=_0x40b964[_0x8e14('0x1c')];var _0x169b84=_0x50db2e?0x0:_0x128217[_0x8e14('0x1a')];var _0x2510ce=_0x50db2e?_0x40b964[_0x8e14('0x1c')]:_0x128217[_0x8e14('0x1a')]+_0x128217[_0x8e14('0x1d')];var _0x2d1771;if(_0x2510ce>=_0x201f86){_0x2510ce=_0x201f86;_0x2d1771=0xc8;}else{_0x2d1771=0xce;}_0x13bdc0['status'](_0x2d1771);return _0x13bdc0[_0x8e14('0x1e')](_0x8e14('0x1f'),_0x169b84+'-'+_0x2510ce+'/'+_0x201f86)['json'](_0x40b964);}return null;};}function patchUpdates(_0x13587d){return function(_0x5a7d38){try{jsonpatch[_0x8e14('0x20')](_0x5a7d38,_0x13587d,!![]);}catch(_0x5550cb){return BPromise[_0x8e14('0x21')](_0x5550cb);}return _0x5a7d38[_0x8e14('0x22')]();};}function saveUpdates(_0x16d8e6,_0x4b3de5){return function(_0x23c5eb){if(_0x23c5eb){return _0x23c5eb[_0x8e14('0x23')](_0x16d8e6)['then'](function(_0x184cbd){return _0x184cbd;});}return null;};}function removeEntity(_0x2b7ff5,_0x1244d3){return function(_0x52b041){if(_0x52b041){return _0x52b041[_0x8e14('0x24')]()[_0x8e14('0x25')](function(){_0x2b7ff5[_0x8e14('0x18')](0xcc)[_0x8e14('0x17')]();});}};}function handleEntityNotFound(_0x5a0860,_0x28ee4a){return function(_0x5b4af3){if(!_0x5b4af3){_0x5a0860['sendStatus'](0x194);}return _0x5b4af3;};}function handleError(_0x2ad93d,_0x43b6db){_0x43b6db=_0x43b6db||0x1f4;return function(_0x356200){logger['error'](_0x356200[_0x8e14('0x26')]);if(_0x356200[_0x8e14('0x27')]){delete _0x356200[_0x8e14('0x27')];}_0x2ad93d[_0x8e14('0x18')](_0x43b6db)['send'](_0x356200);};}exports['show']=function(_0x2d88db,_0x46e737){var _0x170e0b={'raw':!![],'where':{'id':_0x2d88db[_0x8e14('0x28')]['id']}},_0x9eb6a7={};_0x9eb6a7[_0x8e14('0x29')]=_[_0x8e14('0x2a')](db['ChatApplication'][_0x8e14('0x2b')]);_0x9eb6a7[_0x8e14('0x2c')]=_[_0x8e14('0x2a')](_0x2d88db[_0x8e14('0x2c')]);_0x9eb6a7['filters']=_[_0x8e14('0x2d')](_0x9eb6a7[_0x8e14('0x29')],_0x9eb6a7[_0x8e14('0x2c')]);_0x170e0b[_0x8e14('0x2e')]=_[_0x8e14('0x2d')](_0x9eb6a7[_0x8e14('0x29')],qs[_0x8e14('0x2f')](_0x2d88db[_0x8e14('0x2c')][_0x8e14('0x2f')]));_0x170e0b[_0x8e14('0x2e')]=_0x170e0b[_0x8e14('0x2e')]['length']?_0x170e0b[_0x8e14('0x2e')]:_0x9eb6a7[_0x8e14('0x29')];if(_0x2d88db[_0x8e14('0x2c')]['includeAll']){_0x170e0b['include']=[{'all':!![]}];}_0x170e0b=_[_0x8e14('0x30')]({},_0x170e0b,_0x2d88db[_0x8e14('0x31')]);return db['ChatApplication'][_0x8e14('0x32')](_0x170e0b)[_0x8e14('0x25')](handleEntityNotFound(_0x46e737,null))['then'](respondWithResult(_0x46e737,null))[_0x8e14('0x33')](handleError(_0x46e737,null));};exports['update']=function(_0x70225c,_0xa71666){if(_0x70225c[_0x8e14('0x34')]['id']){delete _0x70225c[_0x8e14('0x34')]['id'];}return db['ChatApplication'][_0x8e14('0x32')]({'where':{'id':_0x70225c[_0x8e14('0x28')]['id']}})[_0x8e14('0x25')](handleEntityNotFound(_0xa71666,null))['then'](saveUpdates(_0x70225c[_0x8e14('0x34')],null))[_0x8e14('0x25')](respondWithResult(_0xa71666,null))[_0x8e14('0x33')](handleError(_0xa71666,null));};exports['destroy']=function(_0x3d1558,_0x2256c0){return db[_0x8e14('0x35')][_0x8e14('0x32')]({'where':{'id':_0x3d1558['params']['id']}})[_0x8e14('0x25')](handleEntityNotFound(_0x2256c0,null))[_0x8e14('0x25')](removeEntity(_0x2256c0,null))['catch'](handleError(_0x2256c0,null));}; \ No newline at end of file +var _0xca66=['reject','save','update','destroy','then','sendStatus','name','send','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','fields','includeAll','merge','options','find','catch','body','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x367834,_0x54134b){var _0x62c7eb=function(_0xcf9591){while(--_0xcf9591){_0x367834['push'](_0x367834['shift']());}};_0x62c7eb(++_0x54134b);}(_0xca66,0x8b));var _0x6ca6=function(_0x41e460,_0x55647a){_0x41e460=_0x41e460-0x0;var _0x2ce3e4=_0xca66[_0x41e460];return _0x2ce3e4;};'use strict';var emlformat=require(_0x6ca6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ca6('0x1'));var rp=require(_0x6ca6('0x2'));var moment=require(_0x6ca6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ca6('0x4'));var util=require('util');var path=require(_0x6ca6('0x5'));var sox=require('sox');var csv=require(_0x6ca6('0x6'));var ejs=require(_0x6ca6('0x7'));var fs=require('fs');var fs_extra=require(_0x6ca6('0x8'));var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x6'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var licenseUtil=require(_0x6ca6('0x17'));var db=require(_0x6ca6('0x18'))['db'];function respondWithStatusCode(_0x4c05e9,_0x152e63){_0x152e63=_0x152e63||0xcc;return function(_0x38de67){if(_0x38de67){return _0x4c05e9['sendStatus'](_0x152e63);}return _0x4c05e9[_0x6ca6('0x19')](_0x152e63)[_0x6ca6('0x1a')]();};}function respondWithResult(_0x3f417f,_0x3570f1){_0x3570f1=_0x3570f1||0xc8;return function(_0xc774c){if(_0xc774c){return _0x3f417f[_0x6ca6('0x19')](_0x3570f1)['json'](_0xc774c);}};}function respondWithFilteredResult(_0x52c59a,_0x5785b1){return function(_0x36ff3e){if(_0x36ff3e){var _0x19e94f=typeof _0x5785b1[_0x6ca6('0x1b')]===_0x6ca6('0x1c')&&typeof _0x5785b1[_0x6ca6('0x1d')]===_0x6ca6('0x1c');var _0x25dc6c=_0x36ff3e['count'];var _0x2391ce=_0x19e94f?0x0:_0x5785b1[_0x6ca6('0x1b')];var _0xc97f0=_0x19e94f?_0x36ff3e[_0x6ca6('0x1e')]:_0x5785b1[_0x6ca6('0x1b')]+_0x5785b1[_0x6ca6('0x1d')];var _0x16a3d7;if(_0xc97f0>=_0x25dc6c){_0xc97f0=_0x25dc6c;_0x16a3d7=0xc8;}else{_0x16a3d7=0xce;}_0x52c59a[_0x6ca6('0x19')](_0x16a3d7);return _0x52c59a[_0x6ca6('0x1f')](_0x6ca6('0x20'),_0x2391ce+'-'+_0xc97f0+'/'+_0x25dc6c)[_0x6ca6('0x21')](_0x36ff3e);}return null;};}function patchUpdates(_0x4c3be9){return function(_0x28a982){try{jsonpatch[_0x6ca6('0x22')](_0x28a982,_0x4c3be9,!![]);}catch(_0x38cad4){return BPromise[_0x6ca6('0x23')](_0x38cad4);}return _0x28a982[_0x6ca6('0x24')]();};}function saveUpdates(_0x438694,_0x593f15){return function(_0xfb962d){if(_0xfb962d){return _0xfb962d[_0x6ca6('0x25')](_0x438694)['then'](function(_0x4927c1){return _0x4927c1;});}return null;};}function removeEntity(_0xfbf496,_0x216701){return function(_0xfe0760){if(_0xfe0760){return _0xfe0760[_0x6ca6('0x26')]()[_0x6ca6('0x27')](function(){_0xfbf496['status'](0xcc)[_0x6ca6('0x1a')]();});}};}function handleEntityNotFound(_0x1d6caa,_0x1c43ee){return function(_0x2d8c64){if(!_0x2d8c64){_0x1d6caa[_0x6ca6('0x28')](0x194);}return _0x2d8c64;};}function handleError(_0x29f37e,_0x3c32ae){_0x3c32ae=_0x3c32ae||0x1f4;return function(_0x2a1e2d){logger['error'](_0x2a1e2d['stack']);if(_0x2a1e2d[_0x6ca6('0x29')]){delete _0x2a1e2d[_0x6ca6('0x29')];}_0x29f37e[_0x6ca6('0x19')](_0x3c32ae)[_0x6ca6('0x2a')](_0x2a1e2d);};}exports['show']=function(_0x5ea6f7,_0x306583){var _0x47cf48={'raw':!![],'where':{'id':_0x5ea6f7[_0x6ca6('0x2b')]['id']}},_0x4ab84c={};_0x4ab84c[_0x6ca6('0x2c')]=_['keys'](db[_0x6ca6('0x2d')][_0x6ca6('0x2e')]);_0x4ab84c[_0x6ca6('0x2f')]=_[_0x6ca6('0x30')](_0x5ea6f7['query']);_0x4ab84c[_0x6ca6('0x31')]=_[_0x6ca6('0x32')](_0x4ab84c[_0x6ca6('0x2c')],_0x4ab84c[_0x6ca6('0x2f')]);_0x47cf48['attributes']=_[_0x6ca6('0x32')](_0x4ab84c[_0x6ca6('0x2c')],qs[_0x6ca6('0x33')](_0x5ea6f7[_0x6ca6('0x2f')]['fields']));_0x47cf48['attributes']=_0x47cf48['attributes']['length']?_0x47cf48['attributes']:_0x4ab84c[_0x6ca6('0x2c')];if(_0x5ea6f7[_0x6ca6('0x2f')][_0x6ca6('0x34')]){_0x47cf48['include']=[{'all':!![]}];}_0x47cf48=_[_0x6ca6('0x35')]({},_0x47cf48,_0x5ea6f7[_0x6ca6('0x36')]);return db[_0x6ca6('0x2d')][_0x6ca6('0x37')](_0x47cf48)['then'](handleEntityNotFound(_0x306583,null))[_0x6ca6('0x27')](respondWithResult(_0x306583,null))[_0x6ca6('0x38')](handleError(_0x306583,null));};exports[_0x6ca6('0x25')]=function(_0x3fac33,_0x4da670){if(_0x3fac33[_0x6ca6('0x39')]['id']){delete _0x3fac33['body']['id'];}return db[_0x6ca6('0x2d')]['find']({'where':{'id':_0x3fac33['params']['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x4da670,null))[_0x6ca6('0x27')](saveUpdates(_0x3fac33[_0x6ca6('0x39')],null))[_0x6ca6('0x27')](respondWithResult(_0x4da670,null))['catch'](handleError(_0x4da670,null));};exports['destroy']=function(_0x17a1da,_0x224257){return db['ChatApplication'][_0x6ca6('0x37')]({'where':{'id':_0x17a1da['params']['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x224257,null))['then'](removeEntity(_0x224257,null))[_0x6ca6('0x38')](handleError(_0x224257,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index b0bb9ac..535cd37 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66e5=['chat_applications','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatApplication'];(function(_0x2023e1,_0xeca985){var _0x1fe133=function(_0x526d5f){while(--_0x526d5f){_0x2023e1['push'](_0x2023e1['shift']());}};_0x1fe133(++_0xeca985);}(_0x66e5,0x1a2));var _0x566e=function(_0x218c0c,_0x2b21e3){_0x218c0c=_0x218c0c-0x0;var _0xf0347d=_0x66e5[_0x218c0c];return _0xf0347d;};'use strict';var _=require(_0x566e('0x0'));var util=require(_0x566e('0x1'));var logger=require('../../config/logger')(_0x566e('0x2'));var moment=require('moment');var BPromise=require(_0x566e('0x3'));var rp=require(_0x566e('0x4'));var fs=require('fs');var path=require(_0x566e('0x5'));var rimraf=require(_0x566e('0x6'));var config=require(_0x566e('0x7'));var attributes=require('./chatApplication.attributes');module[_0x566e('0x8')]=function(_0x3ffb62,_0x2b7667){return _0x3ffb62[_0x566e('0x9')](_0x566e('0xa'),attributes,{'tableName':_0x566e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x566e('0xc')});}; \ No newline at end of file +var _0x7846=['util','../../config/logger','moment','path','rimraf','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1ac2d8,_0xe1aa59){var _0x2744af=function(_0x37a898){while(--_0x37a898){_0x1ac2d8['push'](_0x1ac2d8['shift']());}};_0x2744af(++_0xe1aa59);}(_0x7846,0xbf));var _0x6784=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0x7846[_0x30f030];return _0xf7614f;};'use strict';var _=require(_0x6784('0x0'));var util=require(_0x6784('0x1'));var logger=require(_0x6784('0x2'))('api');var moment=require(_0x6784('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6784('0x4'));var rimraf=require(_0x6784('0x5'));var config=require('../../config/environment');var attributes=require(_0x6784('0x6'));module[_0x6784('0x7')]=function(_0xe42d9c,_0x1cf910){return _0xe42d9c[_0x6784('0x8')](_0x6784('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6784('0xa'),'collate':_0x6784('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0fc959e..5137117 100644 --- a/server/api/chatApplication/chatApplication.rpc.js +++ b/server/api/chatApplication/chatApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5198=['http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4b1012,_0x1415eb){var _0x23d715=function(_0x25f330){while(--_0x25f330){_0x4b1012['push'](_0x4b1012['shift']());}};_0x23d715(++_0x1415eb);}(_0x5198,0xa5));var _0x8519=function(_0x55a4bb,_0x4db7e5){_0x55a4bb=_0x55a4bb-0x0;var _0x20139e=_0x5198[_0x55a4bb];return _0x20139e;};'use strict';var _=require(_0x8519('0x0'));var util=require('util');var moment=require(_0x8519('0x1'));var BPromise=require('bluebird');var rs=require(_0x8519('0x2'));var fs=require('fs');var Redis=require(_0x8519('0x3'));var db=require(_0x8519('0x4'))['db'];var utils=require(_0x8519('0x5'));var logger=require(_0x8519('0x6'))(_0x8519('0x7'));var config=require(_0x8519('0x8'));var jayson=require(_0x8519('0x9'));var client=jayson[_0x8519('0xa')][_0x8519('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a3960,_0x14a2b9,_0x488eac){return new BPromise(function(_0x313ae2,_0x1d34fe){return client[_0x8519('0xc')](_0x4a3960,_0x488eac)['then'](function(_0x97898){logger[_0x8519('0xd')](_0x8519('0xe'),_0x14a2b9,_0x8519('0xf'));logger[_0x8519('0x10')](_0x8519('0x11'),_0x14a2b9,_0x8519('0xf'),JSON[_0x8519('0x12')](_0x97898));if(_0x97898[_0x8519('0x13')]){if(_0x97898[_0x8519('0x13')]['code']===0x1f4){logger[_0x8519('0x13')]('ChatApplication,\x20%s,\x20%s',_0x14a2b9,_0x97898[_0x8519('0x13')]['message']);return _0x1d34fe(_0x97898[_0x8519('0x13')][_0x8519('0x14')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x14a2b9,_0x97898[_0x8519('0x13')][_0x8519('0x14')]);return _0x313ae2(_0x97898[_0x8519('0x13')]['message']);}else{logger[_0x8519('0xd')](_0x8519('0xe'),_0x14a2b9,'request\x20sent');_0x313ae2(_0x97898[_0x8519('0x15')][_0x8519('0x14')]);}})['catch'](function(_0x300a26){logger[_0x8519('0x13')]('ChatApplication,\x20%s,\x20%s',_0x14a2b9,_0x300a26);_0x1d34fe(_0x300a26);});});} \ No newline at end of file +var _0x8b30=['debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0x8b30,0x142));var _0x08b3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8b30[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x08b3('0x0'));var util=require(_0x08b3('0x1'));var moment=require(_0x08b3('0x2'));var BPromise=require(_0x08b3('0x3'));var rs=require(_0x08b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08b3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x08b3('0x6'));var config=require('../../config/environment');var jayson=require(_0x08b3('0x7'));var client=jayson[_0x08b3('0x8')][_0x08b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x532e46,_0x2e454f,_0x4457ab){return new BPromise(function(_0x434c62,_0x555d93){return client[_0x08b3('0xa')](_0x532e46,_0x4457ab)[_0x08b3('0xb')](function(_0x20af6a){logger['info'](_0x08b3('0xc'),_0x2e454f,_0x08b3('0xd'));logger[_0x08b3('0xe')](_0x08b3('0xf'),_0x2e454f,_0x08b3('0xd'),JSON['stringify'](_0x20af6a));if(_0x20af6a[_0x08b3('0x10')]){if(_0x20af6a[_0x08b3('0x10')]['code']===0x1f4){logger[_0x08b3('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2e454f,_0x20af6a['error'][_0x08b3('0x11')]);return _0x555d93(_0x20af6a[_0x08b3('0x10')]['message']);}logger[_0x08b3('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2e454f,_0x20af6a[_0x08b3('0x10')][_0x08b3('0x11')]);return _0x434c62(_0x20af6a[_0x08b3('0x10')][_0x08b3('0x11')]);}else{logger[_0x08b3('0x12')](_0x08b3('0xc'),_0x2e454f,_0x08b3('0xd'));_0x434c62(_0x20af6a[_0x08b3('0x13')][_0x08b3('0x11')]);}})[_0x08b3('0x14')](function(_0x4e534a){logger[_0x08b3('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2e454f,_0x4e534a);_0x555d93(_0x4e534a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 1a9e4c5..9ced608 100644 --- a/server/api/chatApplication/index.js +++ b/server/api/chatApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x589f=['isAuthenticated','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','/:id'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x589f,0x141));var _0xf589=function(_0x2629a2,_0xc206c9){_0x2629a2=_0x2629a2-0x0;var _0x199803=_0x589f[_0x2629a2];return _0x199803;};'use strict';var multer=require(_0xf589('0x0'));var util=require(_0xf589('0x1'));var path=require(_0xf589('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf589('0x3')]();var fs_extra=require(_0xf589('0x4'));var auth=require(_0xf589('0x5'));var interaction=require(_0xf589('0x6'));var config=require('../../config/environment');var controller=require(_0xf589('0x7'));router['get'](_0xf589('0x8'),auth[_0xf589('0x9')](),controller['show']);router['put'](_0xf589('0x8'),auth[_0xf589('0x9')](),controller['update']);router['delete'](_0xf589('0x8'),auth[_0xf589('0x9')](),controller[_0xf589('0xa')]);module['exports']=router; \ No newline at end of file +var _0x0aff=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x312c48,_0x5e52a8){var _0x271c50=function(_0x389927){while(--_0x389927){_0x312c48['push'](_0x312c48['shift']());}};_0x271c50(++_0x5e52a8);}(_0x0aff,0x191));var _0xf0af=function(_0x446f11,_0x95cf21){_0x446f11=_0x446f11-0x0;var _0x385cb5=_0x0aff[_0x446f11];return _0x385cb5;};'use strict';var multer=require(_0xf0af('0x0'));var util=require(_0xf0af('0x1'));var path=require(_0xf0af('0x2'));var timeout=require(_0xf0af('0x3'));var express=require('express');var router=express[_0xf0af('0x4')]();var fs_extra=require(_0xf0af('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf0af('0x6'));var config=require(_0xf0af('0x7'));var controller=require('./chatApplication.controller');router[_0xf0af('0x8')](_0xf0af('0x9'),auth['isAuthenticated'](),controller[_0xf0af('0xa')]);router['put']('/:id',auth[_0xf0af('0xb')](),controller[_0xf0af('0xc')]);router[_0xf0af('0xd')](_0xf0af('0x9'),auth[_0xf0af('0xb')](),controller[_0xf0af('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f710d22..289584d 100644 --- a/server/api/chatGroup/chatGroup.attributes.js +++ b/server/api/chatGroup/chatGroup.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7f4=['STRING','BOOLEAN'];(function(_0x4acc5b,_0x394573){var _0x14c422=function(_0x63ed09){while(--_0x63ed09){_0x4acc5b['push'](_0x4acc5b['shift']());}};_0x14c422(++_0x394573);}(_0xf7f4,0x68));var _0x4f7f=function(_0x162c4a,_0x19af4c){_0x162c4a=_0x162c4a-0x0;var _0x418870=_0xf7f4[_0x162c4a];return _0x418870;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4f7f('0x0')]},'write':{'type':Sequelize[_0x4f7f('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x96ae=['exports','STRING','sequelize'];(function(_0x10a4bc,_0x3b9fd0){var _0x496909=function(_0x1a18e0){while(--_0x1a18e0){_0x10a4bc['push'](_0x10a4bc['shift']());}};_0x496909(++_0x3b9fd0);}(_0x96ae,0xda));var _0xe96a=function(_0x17e69b,_0x512806){_0x17e69b=_0x17e69b-0x0;var _0x55eea8=_0x96ae[_0x17e69b];return _0x55eea8;};'use strict';var Sequelize=require(_0xe96a('0x0'));module[_0xe96a('0x1')]={'name':{'type':Sequelize[_0xe96a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe96a('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 452ee49..8e40f3f 100644 --- a/server/api/chatGroup/chatGroup.controller.js +++ b/server/api/chatGroup/chatGroup.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6168=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','destroy','then','end','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','nolimit','sort','where','merge','VIRTUAL','filter','options','ChatGroup','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','update','describe','getUnread','user','toInteger','addMembers','ids','findOne','User','order','pick','getMembers','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x37b935,_0x5cb3d7){var _0x56da12=function(_0x2fb869){while(--_0x2fb869){_0x37b935['push'](_0x37b935['shift']());}};_0x56da12(++_0x5cb3d7);}(_0x6168,0xbd));var _0x8616=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x6168[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x8616('0x0'));var rimraf=require(_0x8616('0x1'));var zipdir=require(_0x8616('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8616('0x3'));var moment=require(_0x8616('0x4'));var BPromise=require(_0x8616('0x5'));var Mustache=require(_0x8616('0x6'));var util=require(_0x8616('0x7'));var path=require(_0x8616('0x8'));var sox=require(_0x8616('0x9'));var csv=require(_0x8616('0xa'));var ejs=require(_0x8616('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8616('0xc'));var squel=require(_0x8616('0xd'));var crypto=require(_0x8616('0xe'));var jsforce=require(_0x8616('0xf'));var deskjs=require(_0x8616('0x10'));var toCsv=require(_0x8616('0xa'));var querystring=require(_0x8616('0x11'));var Papa=require(_0x8616('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8616('0x13'));var as=require(_0x8616('0x14'));var hardwareService=require(_0x8616('0x15'));var logger=require(_0x8616('0x16'))(_0x8616('0x17'));var utils=require(_0x8616('0x18'));var config=require(_0x8616('0x19'));var licenseUtil=require(_0x8616('0x1a'));var db=require(_0x8616('0x1b'))['db'];config['redis']=_[_0x8616('0x1c')](config['redis'],{'host':_0x8616('0x1d'),'port':0x18eb});var socket=require(_0x8616('0x1e'))(new Redis(config['redis']));require(_0x8616('0x1f'))[_0x8616('0x20')](socket);function respondWithStatusCode(_0x5ce47e,_0x1bd996){_0x1bd996=_0x1bd996||0xcc;return function(_0x343b58){if(_0x343b58){return _0x5ce47e[_0x8616('0x21')](_0x1bd996);}return _0x5ce47e[_0x8616('0x22')](_0x1bd996)['end']();};}function respondWithResult(_0x195a6c,_0x271cab){_0x271cab=_0x271cab||0xc8;return function(_0x3f0f29){if(_0x3f0f29){return _0x195a6c['status'](_0x271cab)['json'](_0x3f0f29);}};}function respondWithFilteredResult(_0x46c438,_0xb30c61){return function(_0x5a6c55){if(_0x5a6c55){var _0x594703=typeof _0xb30c61[_0x8616('0x23')]==='undefined'&&typeof _0xb30c61[_0x8616('0x24')]==='undefined';var _0x41d955=_0x5a6c55[_0x8616('0x25')];var _0x43079b=_0x594703?0x0:_0xb30c61[_0x8616('0x23')];var _0x42fdd2=_0x594703?_0x5a6c55[_0x8616('0x25')]:_0xb30c61[_0x8616('0x23')]+_0xb30c61[_0x8616('0x24')];var _0x131e12;if(_0x42fdd2>=_0x41d955){_0x42fdd2=_0x41d955;_0x131e12=0xc8;}else{_0x131e12=0xce;}_0x46c438[_0x8616('0x22')](_0x131e12);return _0x46c438[_0x8616('0x26')](_0x8616('0x27'),_0x43079b+'-'+_0x42fdd2+'/'+_0x41d955)[_0x8616('0x28')](_0x5a6c55);}return null;};}function patchUpdates(_0x3c6ff4){return function(_0x60c327){try{jsonpatch[_0x8616('0x29')](_0x60c327,_0x3c6ff4,!![]);}catch(_0x50acf9){return BPromise[_0x8616('0x2a')](_0x50acf9);}return _0x60c327['save']();};}function saveUpdates(_0x40ffb2,_0x11d01c){return function(_0x16ad23){if(_0x16ad23){return _0x16ad23['update'](_0x40ffb2)['then'](function(_0x132ec0){return _0x132ec0;});}return null;};}function removeEntity(_0x4e5d24,_0x5e24cd){return function(_0x3fc071){if(_0x3fc071){return _0x3fc071[_0x8616('0x2b')]()[_0x8616('0x2c')](function(){_0x4e5d24[_0x8616('0x22')](0xcc)[_0x8616('0x2d')]();});}};}function handleEntityNotFound(_0x1b0b6a,_0x3eb283){return function(_0x1cc0c6){if(!_0x1cc0c6){_0x1b0b6a['sendStatus'](0x194);}return _0x1cc0c6;};}function handleError(_0x37a400,_0x5ef961){_0x5ef961=_0x5ef961||0x1f4;return function(_0x255108){logger['error'](_0x255108['stack']);if(_0x255108[_0x8616('0x2e')]){delete _0x255108['name'];}_0x37a400[_0x8616('0x22')](_0x5ef961)[_0x8616('0x2f')](_0x255108);};}exports[_0x8616('0x30')]=function(_0x51305e,_0x34a7bb){var _0x5d49f4={},_0x220c13={},_0x1ca943={'count':0x0,'rows':[]};var _0xa633f2=_['map'](db['ChatGroup'][_0x8616('0x31')],function(_0x4cb512){return{'name':_0x4cb512[_0x8616('0x32')],'type':_0x4cb512['type'][_0x8616('0x33')]};});_0x220c13[_0x8616('0x34')]=_[_0x8616('0x35')](_0xa633f2,_0x8616('0x2e'));_0x220c13[_0x8616('0x36')]=_['keys'](_0x51305e[_0x8616('0x36')]);_0x220c13[_0x8616('0x37')]=_[_0x8616('0x38')](_0x220c13[_0x8616('0x34')],_0x220c13[_0x8616('0x36')]);_0x5d49f4[_0x8616('0x39')]=_[_0x8616('0x38')](_0x220c13[_0x8616('0x34')],qs[_0x8616('0x3a')](_0x51305e['query'][_0x8616('0x3a')]));_0x5d49f4[_0x8616('0x39')]=_0x5d49f4[_0x8616('0x39')]['length']?_0x5d49f4[_0x8616('0x39')]:_0x220c13[_0x8616('0x34')];if(!_0x51305e[_0x8616('0x36')]['hasOwnProperty'](_0x8616('0x3b'))){_0x5d49f4['limit']=qs[_0x8616('0x24')](_0x51305e[_0x8616('0x36')][_0x8616('0x24')]);_0x5d49f4[_0x8616('0x23')]=qs[_0x8616('0x23')](_0x51305e[_0x8616('0x36')]['offset']);}_0x5d49f4['order']=qs[_0x8616('0x3c')](_0x51305e[_0x8616('0x36')][_0x8616('0x3c')]);_0x5d49f4[_0x8616('0x3d')]=qs['filters'](_['pick'](_0x51305e['query'],_0x220c13[_0x8616('0x37')]),_0xa633f2);if(_0x51305e[_0x8616('0x36')]['filter']){_0x5d49f4['where']=_[_0x8616('0x3e')](_0x5d49f4[_0x8616('0x3d')],{'$or':_[_0x8616('0x35')](_0xa633f2,function(_0x159751){if(_0x159751['type']!==_0x8616('0x3f')){var _0x1ec577={};_0x1ec577[_0x159751[_0x8616('0x2e')]]={'$like':'%'+_0x51305e[_0x8616('0x36')][_0x8616('0x40')]+'%'};return _0x1ec577;}})});}_0x5d49f4=_[_0x8616('0x3e')]({},_0x5d49f4,_0x51305e[_0x8616('0x41')]);var _0xd334d={'where':_0x5d49f4[_0x8616('0x3d')]};return db[_0x8616('0x42')]['count'](_0xd334d)['then'](function(_0x46c1ec){_0x1ca943['count']=_0x46c1ec;if(_0x51305e[_0x8616('0x36')][_0x8616('0x43')]){_0x5d49f4[_0x8616('0x44')]=[{'all':!![]}];}return db[_0x8616('0x42')][_0x8616('0x45')](_0x5d49f4);})[_0x8616('0x2c')](function(_0x13731a){_0x1ca943[_0x8616('0x46')]=_0x13731a;return _0x1ca943;})[_0x8616('0x2c')](respondWithFilteredResult(_0x34a7bb,_0x5d49f4))[_0x8616('0x47')](handleError(_0x34a7bb,null));};exports['show']=function(_0x45ff7e,_0x4eb7a0){var _0x538928={'raw':!![],'where':{'id':_0x45ff7e[_0x8616('0x48')]['id']}},_0x7e4cf={};_0x7e4cf[_0x8616('0x34')]=_['keys'](db[_0x8616('0x42')][_0x8616('0x31')]);_0x7e4cf[_0x8616('0x36')]=_[_0x8616('0x49')](_0x45ff7e[_0x8616('0x36')]);_0x7e4cf[_0x8616('0x37')]=_[_0x8616('0x38')](_0x7e4cf[_0x8616('0x34')],_0x7e4cf['query']);_0x538928[_0x8616('0x39')]=_[_0x8616('0x38')](_0x7e4cf[_0x8616('0x34')],qs[_0x8616('0x3a')](_0x45ff7e[_0x8616('0x36')][_0x8616('0x3a')]));_0x538928[_0x8616('0x39')]=_0x538928[_0x8616('0x39')][_0x8616('0x4a')]?_0x538928['attributes']:_0x7e4cf[_0x8616('0x34')];if(_0x45ff7e['query'][_0x8616('0x43')]){_0x538928[_0x8616('0x44')]=[{'all':!![]}];}_0x538928=_[_0x8616('0x3e')]({},_0x538928,_0x45ff7e[_0x8616('0x41')]);return db[_0x8616('0x42')][_0x8616('0x4b')](_0x538928)[_0x8616('0x2c')](handleEntityNotFound(_0x4eb7a0,null))[_0x8616('0x2c')](respondWithResult(_0x4eb7a0,null))[_0x8616('0x47')](handleError(_0x4eb7a0,null));};exports['create']=function(_0x39bf47,_0x59f3d6){return db['ChatGroup'][_0x8616('0x4c')](_0x39bf47[_0x8616('0x4d')],{})['then'](respondWithResult(_0x59f3d6,0xc9))[_0x8616('0x47')](handleError(_0x59f3d6,null));};exports[_0x8616('0x4e')]=function(_0x317dde,_0x3f89e8){if(_0x317dde[_0x8616('0x4d')]['id']){delete _0x317dde[_0x8616('0x4d')]['id'];}return db[_0x8616('0x42')][_0x8616('0x4b')]({'where':{'id':_0x317dde[_0x8616('0x48')]['id']}})[_0x8616('0x2c')](handleEntityNotFound(_0x3f89e8,null))[_0x8616('0x2c')](saveUpdates(_0x317dde[_0x8616('0x4d')],null))[_0x8616('0x2c')](respondWithResult(_0x3f89e8,null))[_0x8616('0x47')](handleError(_0x3f89e8,null));};exports[_0x8616('0x2b')]=function(_0x267be7,_0x2f5f0f){return db[_0x8616('0x42')]['find']({'where':{'id':_0x267be7['params']['id']}})['then'](handleEntityNotFound(_0x2f5f0f,null))[_0x8616('0x2c')](removeEntity(_0x2f5f0f,null))[_0x8616('0x47')](handleError(_0x2f5f0f,null));};exports[_0x8616('0x4f')]=function(_0x2c45c0,_0xe329ec){return db['ChatGroup'][_0x8616('0x4f')]()[_0x8616('0x2c')](respondWithResult(_0xe329ec,null))[_0x8616('0x47')](handleError(_0xe329ec,null));};exports[_0x8616('0x50')]=function(_0xd58df9,_0x279775,_0x370d98){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0xd58df9[_0x8616('0x48')]['id'],'ToId':_0xd58df9[_0x8616('0x51')]['id'],'read':![]}})[_0x8616('0x2c')](function(_0x3947a2){return{'id':_[_0x8616('0x52')](_0xd58df9[_0x8616('0x48')]['id']),'count':_0x3947a2};})['then'](respondWithResult(_0x279775,null))['catch'](handleError(_0x279775,null));};exports[_0x8616('0x53')]=function(_0x317634,_0x20f15d,_0x3de9e7){return db['ChatGroup'][_0x8616('0x4b')]({'where':{'id':_0x317634[_0x8616('0x48')]['id']}})[_0x8616('0x2c')](handleEntityNotFound(_0x20f15d,null))[_0x8616('0x2c')](function(_0x42bd5a){if(_0x42bd5a){return _0x42bd5a['addMembers'](_0x317634[_0x8616('0x4d')][_0x8616('0x54')],_['omit'](_0x317634[_0x8616('0x4d')],[_0x8616('0x54'),'id'])||{});}})['then'](respondWithResult(_0x20f15d,null))[_0x8616('0x47')](handleError(_0x20f15d,null));};exports['getMembers']=function(_0x42aa7e,_0x42a6fc,_0x5a0e30){var _0xd11710={};var _0x58faec={};var _0x1d71a0;var _0x27c46a;return db['ChatGroup'][_0x8616('0x55')]({'where':{'id':_0x42aa7e['params']['id']}})[_0x8616('0x2c')](handleEntityNotFound(_0x42a6fc,null))[_0x8616('0x2c')](function(_0x3aed04){if(_0x3aed04){_0x1d71a0=_0x3aed04;_0x58faec[_0x8616('0x34')]=_[_0x8616('0x49')](db[_0x8616('0x56')][_0x8616('0x31')]);_0x58faec[_0x8616('0x36')]=_[_0x8616('0x49')](_0x42aa7e['query']);_0x58faec['filters']=_[_0x8616('0x38')](_0x58faec[_0x8616('0x34')],_0x58faec[_0x8616('0x36')]);_0xd11710[_0x8616('0x39')]=_[_0x8616('0x38')](_0x58faec[_0x8616('0x34')],qs[_0x8616('0x3a')](_0x42aa7e[_0x8616('0x36')]['fields']));_0xd11710[_0x8616('0x39')]=_0xd11710[_0x8616('0x39')]['length']?_0xd11710['attributes']:_0x58faec['model'];_0xd11710[_0x8616('0x57')]=qs[_0x8616('0x3c')](_0x42aa7e['query'][_0x8616('0x3c')]);_0xd11710[_0x8616('0x3d')]=qs[_0x8616('0x37')](_[_0x8616('0x58')](_0x42aa7e[_0x8616('0x36')],_0x58faec[_0x8616('0x37')]));if(_0x42aa7e[_0x8616('0x36')][_0x8616('0x40')]){_0xd11710[_0x8616('0x3d')]=_[_0x8616('0x3e')](_0xd11710['where'],{'$or':_['map'](_0xd11710[_0x8616('0x39')],function(_0x5d4356){var _0xf18165={};_0xf18165[_0x5d4356]={'$like':'%'+_0x42aa7e[_0x8616('0x36')]['filter']+'%'};return _0xf18165;})});}_0xd11710=_[_0x8616('0x3e')]({},_0xd11710,_0x42aa7e[_0x8616('0x41')]);return _0x1d71a0[_0x8616('0x59')](_0xd11710);}})[_0x8616('0x2c')](function(_0x36d7dc){if(_0x36d7dc){_0x27c46a=_0x36d7dc[_0x8616('0x4a')];if(!_0x42aa7e[_0x8616('0x36')]['hasOwnProperty'](_0x8616('0x3b'))){_0xd11710[_0x8616('0x24')]=qs[_0x8616('0x24')](_0x42aa7e[_0x8616('0x36')][_0x8616('0x24')]);_0xd11710[_0x8616('0x23')]=qs[_0x8616('0x23')](_0x42aa7e[_0x8616('0x36')]['offset']);}return _0x1d71a0[_0x8616('0x59')](_0xd11710);}})[_0x8616('0x2c')](function(_0xb66782){if(_0xb66782){return _0xb66782?{'count':_0x27c46a,'rows':_0xb66782}:null;}})[_0x8616('0x2c')](respondWithResult(_0x42a6fc,null))[_0x8616('0x47')](handleError(_0x42a6fc,null));};exports[_0x8616('0x5a')]=function(_0xc45987,_0xc71906,_0xbad833){return db[_0x8616('0x42')]['find']({'where':{'id':_0xc45987['params']['id']}})[_0x8616('0x2c')](handleEntityNotFound(_0xc71906,null))[_0x8616('0x2c')](function(_0x1e7993){if(_0x1e7993){return _0x1e7993[_0x8616('0x5a')](_0xc45987[_0x8616('0x36')]['ids']);}})['then'](respondWithStatusCode(_0xc71906,null))[_0x8616('0x47')](handleError(_0xc71906,null));};exports[_0x8616('0x5b')]=function(_0x53564,_0x59332b,_0x25680a){if(_0x53564[_0x8616('0x4d')]['id']){delete _0x53564['body']['id'];}return db[_0x8616('0x42')][_0x8616('0x4b')]({'where':{'id':_0x53564[_0x8616('0x48')]['id']}})['then'](handleEntityNotFound(_0x59332b,null))['then'](function(_0x11ec15){if(_0x11ec15){_0x53564['body'][_0x8616('0x5c')]=_0x11ec15['id'];return db[_0x8616('0x5d')][_0x8616('0x4c')](_0x53564[_0x8616('0x4d')]);}})[_0x8616('0x2c')](respondWithResult(_0x59332b,null))[_0x8616('0x47')](handleError(_0x59332b,null));};exports[_0x8616('0x5e')]=function(_0x4cd20d,_0x29c8e4,_0x1a60ee){var _0x303176={};var _0x4327bb={};var _0x3c9ed3;var _0x31bf9e;return db['ChatGroup'][_0x8616('0x55')]({'where':{'id':_0x4cd20d[_0x8616('0x48')]['id']}})[_0x8616('0x2c')](handleEntityNotFound(_0x29c8e4,null))[_0x8616('0x2c')](function(_0x34edeb){if(_0x34edeb){_0x3c9ed3=_0x34edeb;_0x4327bb[_0x8616('0x34')]=_[_0x8616('0x49')](db['ChatInternalMessage'][_0x8616('0x31')]);_0x4327bb[_0x8616('0x36')]=_[_0x8616('0x49')](_0x4cd20d[_0x8616('0x36')]);_0x4327bb['filters']=_[_0x8616('0x38')](_0x4327bb[_0x8616('0x34')],_0x4327bb[_0x8616('0x36')]);_0x303176['attributes']=_[_0x8616('0x38')](_0x4327bb[_0x8616('0x34')],qs[_0x8616('0x3a')](_0x4cd20d[_0x8616('0x36')][_0x8616('0x3a')]));_0x303176[_0x8616('0x39')]=_0x303176['attributes'][_0x8616('0x4a')]?_0x303176[_0x8616('0x39')]:_0x4327bb[_0x8616('0x34')];_0x303176['order']=qs[_0x8616('0x3c')](_0x4cd20d[_0x8616('0x36')][_0x8616('0x3c')]);_0x303176[_0x8616('0x3d')]=qs[_0x8616('0x37')](_[_0x8616('0x58')](_0x4cd20d[_0x8616('0x36')],_0x4327bb[_0x8616('0x37')]));if(_0x4cd20d['query']['filter']){_0x303176['where']=_[_0x8616('0x3e')](_0x303176[_0x8616('0x3d')],{'$or':_[_0x8616('0x35')](_0x303176[_0x8616('0x39')],function(_0x56debe){var _0x3ba996={};_0x3ba996[_0x56debe]={'$like':'%'+_0x4cd20d['query'][_0x8616('0x40')]+'%'};return _0x3ba996;})});}if(_0x4cd20d[_0x8616('0x36')]['$gte']){var _0x474f85=_0x4cd20d[_0x8616('0x36')][_0x8616('0x5f')][_0x8616('0x60')](',');var _0x205cab={};_0x205cab[_0x474f85[0x0]]={'$gte':moment(_0x474f85[0x1])[_0x8616('0x61')](_0x8616('0x62'))};_0x303176[_0x8616('0x3d')]=_[_0x8616('0x3e')](_0x303176[_0x8616('0x3d')],_0x205cab);}_0x303176=_[_0x8616('0x3e')]({},_0x303176,_0x4cd20d[_0x8616('0x41')]);return _0x3c9ed3['getMessages'](_0x303176);}})['then'](function(_0x4e2409){if(_0x4e2409){_0x31bf9e=_0x4e2409[_0x8616('0x4a')];if(!_0x4cd20d[_0x8616('0x36')][_0x8616('0x63')](_0x8616('0x3b'))){_0x303176[_0x8616('0x24')]=qs[_0x8616('0x24')](_0x4cd20d['query'][_0x8616('0x24')]);_0x303176[_0x8616('0x23')]=qs['offset'](_0x4cd20d[_0x8616('0x36')][_0x8616('0x23')]);}return _0x3c9ed3[_0x8616('0x5e')](_0x303176);}})[_0x8616('0x2c')](function(_0x3f6a7a){if(_0x3f6a7a){return _0x3f6a7a?{'count':_0x31bf9e,'rows':_0x3f6a7a}:null;}})[_0x8616('0x2c')](respondWithResult(_0x29c8e4,null))['catch'](handleError(_0x29c8e4,null));}; \ No newline at end of file +var _0x8435=['socket.io-emitter','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','ChatGroup','findAll','catch','params','intersection','options','create','body','find','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','order','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost'];(function(_0x3baaa9,_0x887c1c){var _0x530513=function(_0x19092d){while(--_0x19092d){_0x3baaa9['push'](_0x3baaa9['shift']());}};_0x530513(++_0x887c1c);}(_0x8435,0x161));var _0x5843=function(_0x48dcd3,_0x8e11b7){_0x48dcd3=_0x48dcd3-0x0;var _0xdfe356=_0x8435[_0x48dcd3];return _0xdfe356;};'use strict';var emlformat=require(_0x5843('0x0'));var rimraf=require(_0x5843('0x1'));var zipdir=require(_0x5843('0x2'));var jsonpatch=require(_0x5843('0x3'));var rp=require(_0x5843('0x4'));var moment=require(_0x5843('0x5'));var BPromise=require(_0x5843('0x6'));var Mustache=require(_0x5843('0x7'));var util=require(_0x5843('0x8'));var path=require('path');var sox=require(_0x5843('0x9'));var csv=require(_0x5843('0xa'));var ejs=require(_0x5843('0xb'));var fs=require('fs');var fs_extra=require(_0x5843('0xc'));var _=require(_0x5843('0xd'));var squel=require(_0x5843('0xe'));var crypto=require(_0x5843('0xf'));var jsforce=require(_0x5843('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5843('0xa'));var querystring=require(_0x5843('0x11'));var Papa=require('papaparse');var Redis=require(_0x5843('0x12'));var authService=require(_0x5843('0x13'));var qs=require(_0x5843('0x14'));var as=require(_0x5843('0x15'));var hardwareService=require(_0x5843('0x16'));var logger=require(_0x5843('0x17'))('api');var utils=require(_0x5843('0x18'));var config=require(_0x5843('0x19'));var licenseUtil=require(_0x5843('0x1a'));var db=require(_0x5843('0x1b'))['db'];config['redis']=_[_0x5843('0x1c')](config[_0x5843('0x1d')],{'host':_0x5843('0x1e'),'port':0x18eb});var socket=require(_0x5843('0x1f'))(new Redis(config['redis']));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x4495dc,_0x26df65){_0x26df65=_0x26df65||0xcc;return function(_0x4b920e){if(_0x4b920e){return _0x4495dc['sendStatus'](_0x26df65);}return _0x4495dc[_0x5843('0x20')](_0x26df65)[_0x5843('0x21')]();};}function respondWithResult(_0x5a5d4f,_0x4a8e90){_0x4a8e90=_0x4a8e90||0xc8;return function(_0x5af3a1){if(_0x5af3a1){return _0x5a5d4f[_0x5843('0x20')](_0x4a8e90)[_0x5843('0x22')](_0x5af3a1);}};}function respondWithFilteredResult(_0x6949d9,_0x152d26){return function(_0xc48cd){if(_0xc48cd){var _0x2ccff2=typeof _0x152d26[_0x5843('0x23')]==='undefined'&&typeof _0x152d26[_0x5843('0x24')]==='undefined';var _0x15064e=_0xc48cd['count'];var _0x3bf376=_0x2ccff2?0x0:_0x152d26[_0x5843('0x23')];var _0x2ed700=_0x2ccff2?_0xc48cd[_0x5843('0x25')]:_0x152d26[_0x5843('0x23')]+_0x152d26[_0x5843('0x24')];var _0x42b367;if(_0x2ed700>=_0x15064e){_0x2ed700=_0x15064e;_0x42b367=0xc8;}else{_0x42b367=0xce;}_0x6949d9[_0x5843('0x20')](_0x42b367);return _0x6949d9[_0x5843('0x26')](_0x5843('0x27'),_0x3bf376+'-'+_0x2ed700+'/'+_0x15064e)[_0x5843('0x22')](_0xc48cd);}return null;};}function patchUpdates(_0x6f5c1d){return function(_0x487276){try{jsonpatch['apply'](_0x487276,_0x6f5c1d,!![]);}catch(_0x174b4e){return BPromise[_0x5843('0x28')](_0x174b4e);}return _0x487276[_0x5843('0x29')]();};}function saveUpdates(_0x242d76,_0x586604){return function(_0x51b553){if(_0x51b553){return _0x51b553[_0x5843('0x2a')](_0x242d76)['then'](function(_0x22330f){return _0x22330f;});}return null;};}function removeEntity(_0xd6799d,_0x52cb9f){return function(_0x3a2be0){if(_0x3a2be0){return _0x3a2be0[_0x5843('0x2b')]()[_0x5843('0x2c')](function(){_0xd6799d[_0x5843('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x271b59,_0x5d03d9){return function(_0x4c5fd8){if(!_0x4c5fd8){_0x271b59[_0x5843('0x2d')](0x194);}return _0x4c5fd8;};}function handleError(_0x71133d,_0x25cb43){_0x25cb43=_0x25cb43||0x1f4;return function(_0x2177a1){logger['error'](_0x2177a1[_0x5843('0x2e')]);if(_0x2177a1[_0x5843('0x2f')]){delete _0x2177a1[_0x5843('0x2f')];}_0x71133d['status'](_0x25cb43)['send'](_0x2177a1);};}exports['index']=function(_0x40cab9,_0xeb3041){var _0x87427e={},_0x1a7067={},_0x149c14={'count':0x0,'rows':[]};var _0x10ac35=_[_0x5843('0x30')](db['ChatGroup'][_0x5843('0x31')],function(_0x373e51){return{'name':_0x373e51[_0x5843('0x32')],'type':_0x373e51[_0x5843('0x33')]['key']};});_0x1a7067[_0x5843('0x34')]=_[_0x5843('0x30')](_0x10ac35,_0x5843('0x2f'));_0x1a7067[_0x5843('0x35')]=_[_0x5843('0x36')](_0x40cab9[_0x5843('0x35')]);_0x1a7067[_0x5843('0x37')]=_['intersection'](_0x1a7067[_0x5843('0x34')],_0x1a7067[_0x5843('0x35')]);_0x87427e['attributes']=_['intersection'](_0x1a7067[_0x5843('0x34')],qs[_0x5843('0x38')](_0x40cab9['query']['fields']));_0x87427e[_0x5843('0x39')]=_0x87427e['attributes'][_0x5843('0x3a')]?_0x87427e[_0x5843('0x39')]:_0x1a7067[_0x5843('0x34')];if(!_0x40cab9[_0x5843('0x35')][_0x5843('0x3b')](_0x5843('0x3c'))){_0x87427e[_0x5843('0x24')]=qs[_0x5843('0x24')](_0x40cab9['query'][_0x5843('0x24')]);_0x87427e['offset']=qs[_0x5843('0x23')](_0x40cab9[_0x5843('0x35')][_0x5843('0x23')]);}_0x87427e['order']=qs[_0x5843('0x3d')](_0x40cab9['query'][_0x5843('0x3d')]);_0x87427e['where']=qs['filters'](_[_0x5843('0x3e')](_0x40cab9[_0x5843('0x35')],_0x1a7067[_0x5843('0x37')]),_0x10ac35);if(_0x40cab9['query'][_0x5843('0x3f')]){_0x87427e[_0x5843('0x40')]=_[_0x5843('0x41')](_0x87427e['where'],{'$or':_['map'](_0x10ac35,function(_0x2cc098){if(_0x2cc098['type']!==_0x5843('0x42')){var _0x313572={};_0x313572[_0x2cc098[_0x5843('0x2f')]]={'$like':'%'+_0x40cab9[_0x5843('0x35')][_0x5843('0x3f')]+'%'};return _0x313572;}})});}_0x87427e=_['merge']({},_0x87427e,_0x40cab9['options']);var _0x375b61={'where':_0x87427e[_0x5843('0x40')]};return db['ChatGroup'][_0x5843('0x25')](_0x375b61)['then'](function(_0x50c946){_0x149c14[_0x5843('0x25')]=_0x50c946;if(_0x40cab9['query'][_0x5843('0x43')]){_0x87427e[_0x5843('0x44')]=[{'all':!![]}];}return db[_0x5843('0x45')][_0x5843('0x46')](_0x87427e);})[_0x5843('0x2c')](function(_0x1f9dc2){_0x149c14['rows']=_0x1f9dc2;return _0x149c14;})[_0x5843('0x2c')](respondWithFilteredResult(_0xeb3041,_0x87427e))[_0x5843('0x47')](handleError(_0xeb3041,null));};exports['show']=function(_0x3acff9,_0x3db34e){var _0x41971a={'raw':!![],'where':{'id':_0x3acff9[_0x5843('0x48')]['id']}},_0x754c7b={};_0x754c7b[_0x5843('0x34')]=_[_0x5843('0x36')](db[_0x5843('0x45')]['rawAttributes']);_0x754c7b[_0x5843('0x35')]=_[_0x5843('0x36')](_0x3acff9['query']);_0x754c7b[_0x5843('0x37')]=_[_0x5843('0x49')](_0x754c7b['model'],_0x754c7b['query']);_0x41971a[_0x5843('0x39')]=_[_0x5843('0x49')](_0x754c7b['model'],qs[_0x5843('0x38')](_0x3acff9['query'][_0x5843('0x38')]));_0x41971a['attributes']=_0x41971a[_0x5843('0x39')][_0x5843('0x3a')]?_0x41971a[_0x5843('0x39')]:_0x754c7b[_0x5843('0x34')];if(_0x3acff9[_0x5843('0x35')][_0x5843('0x43')]){_0x41971a[_0x5843('0x44')]=[{'all':!![]}];}_0x41971a=_[_0x5843('0x41')]({},_0x41971a,_0x3acff9[_0x5843('0x4a')]);return db[_0x5843('0x45')]['find'](_0x41971a)['then'](handleEntityNotFound(_0x3db34e,null))['then'](respondWithResult(_0x3db34e,null))[_0x5843('0x47')](handleError(_0x3db34e,null));};exports['create']=function(_0x1a43c2,_0x2b7f75){return db[_0x5843('0x45')][_0x5843('0x4b')](_0x1a43c2[_0x5843('0x4c')],{})[_0x5843('0x2c')](respondWithResult(_0x2b7f75,0xc9))[_0x5843('0x47')](handleError(_0x2b7f75,null));};exports[_0x5843('0x2a')]=function(_0x37836b,_0x13b4dc){if(_0x37836b[_0x5843('0x4c')]['id']){delete _0x37836b[_0x5843('0x4c')]['id'];}return db['ChatGroup'][_0x5843('0x4d')]({'where':{'id':_0x37836b['params']['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x13b4dc,null))[_0x5843('0x2c')](saveUpdates(_0x37836b['body'],null))[_0x5843('0x2c')](respondWithResult(_0x13b4dc,null))[_0x5843('0x47')](handleError(_0x13b4dc,null));};exports[_0x5843('0x2b')]=function(_0xba9ffa,_0x5f1191){return db[_0x5843('0x45')][_0x5843('0x4d')]({'where':{'id':_0xba9ffa[_0x5843('0x48')]['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x5f1191,null))[_0x5843('0x2c')](removeEntity(_0x5f1191,null))[_0x5843('0x47')](handleError(_0x5f1191,null));};exports['describe']=function(_0x40ef56,_0x581a87){return db[_0x5843('0x45')][_0x5843('0x4e')]()[_0x5843('0x2c')](respondWithResult(_0x581a87,null))[_0x5843('0x47')](handleError(_0x581a87,null));};exports['getUnread']=function(_0x3e985f,_0xf2b4e0,_0x5f5dd5){return db[_0x5843('0x4f')][_0x5843('0x25')]({'where':{'ChatGroupId':_0x3e985f[_0x5843('0x48')]['id'],'ToId':_0x3e985f[_0x5843('0x50')]['id'],'read':![]}})[_0x5843('0x2c')](function(_0x53f416){return{'id':_[_0x5843('0x51')](_0x3e985f[_0x5843('0x48')]['id']),'count':_0x53f416};})[_0x5843('0x2c')](respondWithResult(_0xf2b4e0,null))[_0x5843('0x47')](handleError(_0xf2b4e0,null));};exports[_0x5843('0x52')]=function(_0x1ac937,_0x412352,_0x2a40b2){return db['ChatGroup'][_0x5843('0x4d')]({'where':{'id':_0x1ac937['params']['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x412352,null))[_0x5843('0x2c')](function(_0x4fdb10){if(_0x4fdb10){return _0x4fdb10[_0x5843('0x52')](_0x1ac937[_0x5843('0x4c')][_0x5843('0x53')],_[_0x5843('0x54')](_0x1ac937[_0x5843('0x4c')],[_0x5843('0x53'),'id'])||{});}})[_0x5843('0x2c')](respondWithResult(_0x412352,null))['catch'](handleError(_0x412352,null));};exports[_0x5843('0x55')]=function(_0x560483,_0x134e8d,_0x48be1b){var _0x4aab14={};var _0x5261db={};var _0x724826;var _0x343b51;return db[_0x5843('0x45')][_0x5843('0x56')]({'where':{'id':_0x560483[_0x5843('0x48')]['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x134e8d,null))[_0x5843('0x2c')](function(_0x18f51d){if(_0x18f51d){_0x724826=_0x18f51d;_0x5261db[_0x5843('0x34')]=_[_0x5843('0x36')](db['User']['rawAttributes']);_0x5261db[_0x5843('0x35')]=_[_0x5843('0x36')](_0x560483[_0x5843('0x35')]);_0x5261db[_0x5843('0x37')]=_[_0x5843('0x49')](_0x5261db['model'],_0x5261db[_0x5843('0x35')]);_0x4aab14[_0x5843('0x39')]=_[_0x5843('0x49')](_0x5261db[_0x5843('0x34')],qs[_0x5843('0x38')](_0x560483['query']['fields']));_0x4aab14[_0x5843('0x39')]=_0x4aab14[_0x5843('0x39')][_0x5843('0x3a')]?_0x4aab14['attributes']:_0x5261db[_0x5843('0x34')];_0x4aab14[_0x5843('0x57')]=qs[_0x5843('0x3d')](_0x560483[_0x5843('0x35')][_0x5843('0x3d')]);_0x4aab14['where']=qs['filters'](_[_0x5843('0x3e')](_0x560483['query'],_0x5261db[_0x5843('0x37')]));if(_0x560483[_0x5843('0x35')]['filter']){_0x4aab14['where']=_['merge'](_0x4aab14['where'],{'$or':_[_0x5843('0x30')](_0x4aab14[_0x5843('0x39')],function(_0xe90b22){var _0x436cd7={};_0x436cd7[_0xe90b22]={'$like':'%'+_0x560483[_0x5843('0x35')]['filter']+'%'};return _0x436cd7;})});}_0x4aab14=_['merge']({},_0x4aab14,_0x560483[_0x5843('0x4a')]);return _0x724826[_0x5843('0x55')](_0x4aab14);}})[_0x5843('0x2c')](function(_0x560b7d){if(_0x560b7d){_0x343b51=_0x560b7d[_0x5843('0x3a')];if(!_0x560483[_0x5843('0x35')][_0x5843('0x3b')](_0x5843('0x3c'))){_0x4aab14[_0x5843('0x24')]=qs[_0x5843('0x24')](_0x560483['query'][_0x5843('0x24')]);_0x4aab14[_0x5843('0x23')]=qs[_0x5843('0x23')](_0x560483[_0x5843('0x35')][_0x5843('0x23')]);}return _0x724826[_0x5843('0x55')](_0x4aab14);}})[_0x5843('0x2c')](function(_0x50f62b){if(_0x50f62b){return _0x50f62b?{'count':_0x343b51,'rows':_0x50f62b}:null;}})[_0x5843('0x2c')](respondWithResult(_0x134e8d,null))['catch'](handleError(_0x134e8d,null));};exports[_0x5843('0x58')]=function(_0x3b75bc,_0x18af63,_0x764265){return db[_0x5843('0x45')][_0x5843('0x4d')]({'where':{'id':_0x3b75bc[_0x5843('0x48')]['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x18af63,null))[_0x5843('0x2c')](function(_0x976b61){if(_0x976b61){return _0x976b61[_0x5843('0x58')](_0x3b75bc['query'][_0x5843('0x53')]);}})['then'](respondWithStatusCode(_0x18af63,null))[_0x5843('0x47')](handleError(_0x18af63,null));};exports[_0x5843('0x59')]=function(_0x290595,_0x22f7a0,_0x5448a4){if(_0x290595[_0x5843('0x4c')]['id']){delete _0x290595[_0x5843('0x4c')]['id'];}return db[_0x5843('0x45')][_0x5843('0x4d')]({'where':{'id':_0x290595[_0x5843('0x48')]['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x22f7a0,null))[_0x5843('0x2c')](function(_0x1c34e7){if(_0x1c34e7){_0x290595['body'][_0x5843('0x5a')]=_0x1c34e7['id'];return db[_0x5843('0x4f')]['create'](_0x290595[_0x5843('0x4c')]);}})[_0x5843('0x2c')](respondWithResult(_0x22f7a0,null))[_0x5843('0x47')](handleError(_0x22f7a0,null));};exports[_0x5843('0x5b')]=function(_0x1190c9,_0x43cfbf,_0x1b76f0){var _0x2a3910={};var _0x344697={};var _0x372f02;var _0x210664;return db['ChatGroup']['findOne']({'where':{'id':_0x1190c9[_0x5843('0x48')]['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x43cfbf,null))[_0x5843('0x2c')](function(_0x464b9e){if(_0x464b9e){_0x372f02=_0x464b9e;_0x344697[_0x5843('0x34')]=_[_0x5843('0x36')](db['ChatInternalMessage'][_0x5843('0x31')]);_0x344697['query']=_[_0x5843('0x36')](_0x1190c9[_0x5843('0x35')]);_0x344697['filters']=_[_0x5843('0x49')](_0x344697['model'],_0x344697[_0x5843('0x35')]);_0x2a3910[_0x5843('0x39')]=_[_0x5843('0x49')](_0x344697['model'],qs[_0x5843('0x38')](_0x1190c9[_0x5843('0x35')]['fields']));_0x2a3910[_0x5843('0x39')]=_0x2a3910[_0x5843('0x39')][_0x5843('0x3a')]?_0x2a3910[_0x5843('0x39')]:_0x344697[_0x5843('0x34')];_0x2a3910[_0x5843('0x57')]=qs[_0x5843('0x3d')](_0x1190c9[_0x5843('0x35')][_0x5843('0x3d')]);_0x2a3910[_0x5843('0x40')]=qs[_0x5843('0x37')](_['pick'](_0x1190c9[_0x5843('0x35')],_0x344697[_0x5843('0x37')]));if(_0x1190c9[_0x5843('0x35')][_0x5843('0x3f')]){_0x2a3910[_0x5843('0x40')]=_[_0x5843('0x41')](_0x2a3910[_0x5843('0x40')],{'$or':_[_0x5843('0x30')](_0x2a3910[_0x5843('0x39')],function(_0x3e3a56){var _0x60f8a={};_0x60f8a[_0x3e3a56]={'$like':'%'+_0x1190c9[_0x5843('0x35')][_0x5843('0x3f')]+'%'};return _0x60f8a;})});}if(_0x1190c9[_0x5843('0x35')][_0x5843('0x5c')]){var _0x3c3267=_0x1190c9[_0x5843('0x35')]['$gte'][_0x5843('0x5d')](',');var _0x5b1fda={};_0x5b1fda[_0x3c3267[0x0]]={'$gte':moment(_0x3c3267[0x1])[_0x5843('0x5e')](_0x5843('0x5f'))};_0x2a3910[_0x5843('0x40')]=_[_0x5843('0x41')](_0x2a3910[_0x5843('0x40')],_0x5b1fda);}_0x2a3910=_[_0x5843('0x41')]({},_0x2a3910,_0x1190c9['options']);return _0x372f02['getMessages'](_0x2a3910);}})['then'](function(_0x47dbbf){if(_0x47dbbf){_0x210664=_0x47dbbf[_0x5843('0x3a')];if(!_0x1190c9[_0x5843('0x35')][_0x5843('0x3b')](_0x5843('0x3c'))){_0x2a3910['limit']=qs['limit'](_0x1190c9['query'][_0x5843('0x24')]);_0x2a3910[_0x5843('0x23')]=qs[_0x5843('0x23')](_0x1190c9[_0x5843('0x35')][_0x5843('0x23')]);}return _0x372f02[_0x5843('0x5b')](_0x2a3910);}})[_0x5843('0x2c')](function(_0x1f9888){if(_0x1f9888){return _0x1f9888?{'count':_0x210664,'rows':_0x1f9888}:null;}})[_0x5843('0x2c')](respondWithResult(_0x43cfbf,null))[_0x5843('0x47')](handleError(_0x43cfbf,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e1c5c43..6a26cff 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f0e=['ChatGroup','setMaxListeners','save','emit','hook','exports','events','../../mysqldb'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9f0e,0x116));var _0xe9f0=function(_0x422fe0,_0x181b25){_0x422fe0=_0x422fe0-0x0;var _0x4e6520=_0x9f0e[_0x422fe0];return _0x4e6520;};'use strict';var EventEmitter=require(_0xe9f0('0x0'));var ChatGroup=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe9f0('0x3')](0x0);var events={'afterCreate':_0xe9f0('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2325c6){return function(_0x150a03,_0x3c589d,_0x202d69){ChatGroupEvents[_0xe9f0('0x5')](_0x2325c6+':'+_0x150a03['id'],_0x150a03);ChatGroupEvents['emit'](_0x2325c6,_0x150a03);_0x202d69(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xe9f0('0x6')](e,emitEvent(event));}}module[_0xe9f0('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x287e=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','ChatGroup'];(function(_0x3a2a20,_0x48e10a){var _0x366ec2=function(_0x15a9b0){while(--_0x15a9b0){_0x3a2a20['push'](_0x3a2a20['shift']());}};_0x366ec2(++_0x48e10a);}(_0x287e,0x1e3));var _0xe287=function(_0x366edb,_0x4b5780){_0x366edb=_0x366edb-0x0;var _0x22472f=_0x287e[_0x366edb];return _0x22472f;};'use strict';var EventEmitter=require(_0xe287('0x0'));var ChatGroup=require(_0xe287('0x1'))['db'][_0xe287('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe287('0x3')](0x0);var events={'afterCreate':_0xe287('0x4'),'afterUpdate':_0xe287('0x5'),'afterDestroy':_0xe287('0x6')};function emitEvent(_0x3ce68e){return function(_0x16d2d7,_0x5f34d6,_0x113035){ChatGroupEvents[_0xe287('0x7')](_0x3ce68e+':'+_0x16d2d7['id'],_0x16d2d7);ChatGroupEvents['emit'](_0x3ce68e,_0x16d2d7);_0x113035(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xe287('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 87b23fd..1f2471a 100644 --- a/server/api/chatGroup/chatGroup.model.js +++ b/server/api/chatGroup/chatGroup.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fca=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup','lodash','util','../../config/logger'];(function(_0x3bfed2,_0x4a30c4){var _0x443dc2=function(_0x50ef4b){while(--_0x50ef4b){_0x3bfed2['push'](_0x3bfed2['shift']());}};_0x443dc2(++_0x4a30c4);}(_0x7fca,0x14d));var _0xa7fc=function(_0x225f8b,_0x5cb37f){_0x225f8b=_0x225f8b-0x0;var _0x579f12=_0x7fca[_0x225f8b];return _0x579f12;};'use strict';var _=require(_0xa7fc('0x0'));var util=require(_0xa7fc('0x1'));var logger=require(_0xa7fc('0x2'))(_0xa7fc('0x3'));var moment=require('moment');var BPromise=require(_0xa7fc('0x4'));var rp=require(_0xa7fc('0x5'));var fs=require('fs');var path=require(_0xa7fc('0x6'));var rimraf=require(_0xa7fc('0x7'));var config=require(_0xa7fc('0x8'));var attributes=require(_0xa7fc('0x9'));module[_0xa7fc('0xa')]=function(_0x223537,_0x5228bc){return _0x223537['define'](_0xa7fc('0xb'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f66=['chat_groups','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup'];(function(_0x26b13c,_0x1d5e01){var _0x23092b=function(_0x5309be){while(--_0x5309be){_0x26b13c['push'](_0x26b13c['shift']());}};_0x23092b(++_0x1d5e01);}(_0x6f66,0x156));var _0x66f6=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x6f66[_0x1e500e];return _0x10dc5e;};'use strict';var _=require('lodash');var util=require(_0x66f6('0x0'));var logger=require('../../config/logger')(_0x66f6('0x1'));var moment=require(_0x66f6('0x2'));var BPromise=require(_0x66f6('0x3'));var rp=require(_0x66f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66f6('0x5'));var config=require(_0x66f6('0x6'));var attributes=require(_0x66f6('0x7'));module[_0x66f6('0x8')]=function(_0x144409,_0x535b62){return _0x144409['define'](_0x66f6('0x9'),attributes,{'tableName':_0x66f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 6f6ea33..4e497bf 100644 --- a/server/api/chatGroup/chatGroup.rpc.js +++ b/server/api/chatGroup/chatGroup.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83f7=['message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s'];(function(_0x59a652,_0x32f8ac){var _0x42b110=function(_0x11a85b){while(--_0x11a85b){_0x59a652['push'](_0x59a652['shift']());}};_0x42b110(++_0x32f8ac);}(_0x83f7,0x84));var _0x783f=function(_0x58abf2,_0x5611eb){_0x58abf2=_0x58abf2-0x0;var _0x5dff90=_0x83f7[_0x58abf2];return _0x5dff90;};'use strict';var _=require(_0x783f('0x0'));var util=require(_0x783f('0x1'));var moment=require(_0x783f('0x2'));var BPromise=require('bluebird');var rs=require(_0x783f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x783f('0x4'));var logger=require(_0x783f('0x5'))(_0x783f('0x6'));var config=require(_0x783f('0x7'));var jayson=require(_0x783f('0x8'));var client=jayson[_0x783f('0x9')][_0x783f('0xa')]({'port':0x232a});config[_0x783f('0xb')]=_['defaults'](config[_0x783f('0xb')],{'host':_0x783f('0xc'),'port':0x18eb});var socket=require(_0x783f('0xd'))(new Redis(config[_0x783f('0xb')]));require('./chatGroup.socket')[_0x783f('0xe')](socket);function respondWithRpcPromise(_0x53b61d,_0x195d40,_0x3f6d1b){return new BPromise(function(_0xc94050,_0x3deb73){return client[_0x783f('0xf')](_0x53b61d,_0x3f6d1b)[_0x783f('0x10')](function(_0x1661c9){logger[_0x783f('0x11')]('ChatGroup,\x20%s,\x20%s',_0x195d40,_0x783f('0x12'));logger[_0x783f('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x195d40,_0x783f('0x12'),JSON[_0x783f('0x14')](_0x1661c9));if(_0x1661c9[_0x783f('0x15')]){if(_0x1661c9[_0x783f('0x15')][_0x783f('0x16')]===0x1f4){logger['error'](_0x783f('0x17'),_0x195d40,_0x1661c9[_0x783f('0x15')][_0x783f('0x18')]);return _0x3deb73(_0x1661c9['error']['message']);}logger[_0x783f('0x15')](_0x783f('0x17'),_0x195d40,_0x1661c9[_0x783f('0x15')][_0x783f('0x18')]);return _0xc94050(_0x1661c9[_0x783f('0x15')][_0x783f('0x18')]);}else{logger['info'](_0x783f('0x17'),_0x195d40,_0x783f('0x12'));_0xc94050(_0x1661c9[_0x783f('0x19')][_0x783f('0x18')]);}})['catch'](function(_0x1ef1bb){logger[_0x783f('0x15')]('ChatGroup,\x20%s,\x20%s',_0x195d40,_0x1ef1bb);_0x3deb73(_0x1ef1bb);});});} \ No newline at end of file +var _0x4f6c=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','ChatGroup,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0x5796cb,_0x15b2e1){var _0x126d5e=function(_0x3d319e){while(--_0x3d319e){_0x5796cb['push'](_0x5796cb['shift']());}};_0x126d5e(++_0x15b2e1);}(_0x4f6c,0x176));var _0xc4f6=function(_0x438bbf,_0x21c23b){_0x438bbf=_0x438bbf-0x0;var _0x32de30=_0x4f6c[_0x438bbf];return _0x32de30;};'use strict';var _=require(_0xc4f6('0x0'));var util=require(_0xc4f6('0x1'));var moment=require(_0xc4f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xc4f6('0x3'));var fs=require('fs');var Redis=require(_0xc4f6('0x4'));var db=require(_0xc4f6('0x5'))['db'];var utils=require(_0xc4f6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc4f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc4f6('0x8')][_0xc4f6('0x9')]({'port':0x232a});config[_0xc4f6('0xa')]=_[_0xc4f6('0xb')](config[_0xc4f6('0xa')],{'host':_0xc4f6('0xc'),'port':0x18eb});var socket=require(_0xc4f6('0xd'))(new Redis(config[_0xc4f6('0xa')]));require('./chatGroup.socket')[_0xc4f6('0xe')](socket);function respondWithRpcPromise(_0x253735,_0x83274b,_0x3dc18c){return new BPromise(function(_0x10ee6c,_0x4e6c49){return client['request'](_0x253735,_0x3dc18c)[_0xc4f6('0xf')](function(_0x345299){logger[_0xc4f6('0x10')]('ChatGroup,\x20%s,\x20%s',_0x83274b,'request\x20sent');logger[_0xc4f6('0x11')](_0xc4f6('0x12'),_0x83274b,'request\x20sent',JSON['stringify'](_0x345299));if(_0x345299[_0xc4f6('0x13')]){if(_0x345299[_0xc4f6('0x13')]['code']===0x1f4){logger['error'](_0xc4f6('0x14'),_0x83274b,_0x345299[_0xc4f6('0x13')][_0xc4f6('0x15')]);return _0x4e6c49(_0x345299[_0xc4f6('0x13')]['message']);}logger[_0xc4f6('0x13')](_0xc4f6('0x14'),_0x83274b,_0x345299[_0xc4f6('0x13')][_0xc4f6('0x15')]);return _0x10ee6c(_0x345299[_0xc4f6('0x13')][_0xc4f6('0x15')]);}else{logger[_0xc4f6('0x10')](_0xc4f6('0x14'),_0x83274b,_0xc4f6('0x16'));_0x10ee6c(_0x345299[_0xc4f6('0x17')]['message']);}})[_0xc4f6('0x18')](function(_0x5e5326){logger[_0xc4f6('0x13')](_0xc4f6('0x14'),_0x83274b,_0x5e5326);_0x4e6c49(_0x5e5326);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 7fd10ed..baa354b 100644 --- a/server/api/chatGroup/chatGroup.socket.js +++ b/server/api/chatGroup/chatGroup.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47dc=['remove','update','emit','length','./chatGroup.events','save'];(function(_0xf973b7,_0x46699f){var _0x499087=function(_0x45b42f){while(--_0x45b42f){_0xf973b7['push'](_0xf973b7['shift']());}};_0x499087(++_0x46699f);}(_0x47dc,0xca));var _0xc47d=function(_0xb4f9db,_0x38ea84){_0xb4f9db=_0xb4f9db-0x0;var _0x42e98f=_0x47dc[_0xb4f9db];return _0x42e98f;};'use strict';var ChatGroupEvents=require(_0xc47d('0x0'));var events=[_0xc47d('0x1'),_0xc47d('0x2'),_0xc47d('0x3')];function createListener(_0x37f684,_0x3c47ee){return function(_0x129415){_0x3c47ee[_0xc47d('0x4')](_0x37f684,_0x129415);};}function removeListener(_0x69bd2b,_0x59aa3c){return function(){ChatGroupEvents['removeListener'](_0x69bd2b,_0x59aa3c);};}exports['register']=function(_0x51420){for(var _0x3ae517=0x0,_0x4628ea=events[_0xc47d('0x5')];_0x3ae517<_0x4628ea;_0x3ae517++){var _0x9bd1ba=events[_0x3ae517];var _0x883d4e=createListener('chatGroup:'+_0x9bd1ba,_0x51420);ChatGroupEvents['on'](_0x9bd1ba,_0x883d4e);}}; \ No newline at end of file +var _0x97cc=['update','emit','length','chatGroup:','./chatGroup.events','save'];(function(_0x33f1a3,_0x1557a5){var _0x1f3d03=function(_0xfc6e8b){while(--_0xfc6e8b){_0x33f1a3['push'](_0x33f1a3['shift']());}};_0x1f3d03(++_0x1557a5);}(_0x97cc,0x154));var _0xc97c=function(_0x574b62,_0x4d28ae){_0x574b62=_0x574b62-0x0;var _0x2eae82=_0x97cc[_0x574b62];return _0x2eae82;};'use strict';var ChatGroupEvents=require(_0xc97c('0x0'));var events=[_0xc97c('0x1'),'remove',_0xc97c('0x2')];function createListener(_0x47fae7,_0x3a8b51){return function(_0x62c29b){_0x3a8b51[_0xc97c('0x3')](_0x47fae7,_0x62c29b);};}function removeListener(_0x385fdd,_0x492476){return function(){ChatGroupEvents['removeListener'](_0x385fdd,_0x492476);};}exports['register']=function(_0x204ea4){for(var _0x5efaae=0x0,_0x42e141=events[_0xc97c('0x4')];_0x5efaae<_0x42e141;_0x5efaae++){var _0x151a8e=events[_0x5efaae];var _0x764734=createListener(_0xc97c('0x5')+_0x151a8e,_0x204ea4);ChatGroupEvents['on'](_0x151a8e,_0x764734);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 2893a16..d73d1fa 100644 --- a/server/api/chatGroup/index.js +++ b/server/api/chatGroup/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1e1=['./chatGroup.controller','get','isAuthenticated','describe','show','getUnread','getMembers','getMessages','post','/:id/members','/:id/messages','addMessage','put','/:id','update','destroy','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xcd2ab5,_0x5b503a){var _0x3eaaf5=function(_0x4ea744){while(--_0x4ea744){_0xcd2ab5['push'](_0xcd2ab5['shift']());}};_0x3eaaf5(++_0x5b503a);}(_0xf1e1,0xa8));var _0x1f1e=function(_0x2da8e3,_0x397415){_0x2da8e3=_0x2da8e3-0x0;var _0x281fd5=_0xf1e1[_0x2da8e3];return _0x281fd5;};'use strict';var multer=require('multer');var util=require(_0x1f1e('0x0'));var path=require('path');var timeout=require(_0x1f1e('0x1'));var express=require(_0x1f1e('0x2'));var router=express['Router']();var fs_extra=require(_0x1f1e('0x3'));var auth=require(_0x1f1e('0x4'));var interaction=require(_0x1f1e('0x5'));var config=require(_0x1f1e('0x6'));var controller=require(_0x1f1e('0x7'));router[_0x1f1e('0x8')]('/',auth[_0x1f1e('0x9')](),controller['index']);router['get']('/describe',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0xa')]);router[_0x1f1e('0x8')]('/:id',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0xb')]);router[_0x1f1e('0x8')]('/:id/unread',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0xc')]);router['get']('/:id/members',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0xd')]);router[_0x1f1e('0x8')]('/:id/messages',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0xe')]);router['post']('/',auth[_0x1f1e('0x9')](),controller['create']);router[_0x1f1e('0xf')](_0x1f1e('0x10'),auth['isAuthenticated'](),controller['addMembers']);router[_0x1f1e('0xf')](_0x1f1e('0x11'),auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x12')]);router[_0x1f1e('0x13')](_0x1f1e('0x14'),auth['isAuthenticated'](),controller[_0x1f1e('0x15')]);router['delete'](_0x1f1e('0x14'),auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x16')]);router[_0x1f1e('0x17')](_0x1f1e('0x10'),auth[_0x1f1e('0x9')](),controller['removeMembers']);module[_0x1f1e('0x18')]=router; \ No newline at end of file +var _0x87be=['show','getUnread','/:id/members','getMembers','/:id/messages','post','addMembers','addMessage','put','/:id','update','delete','removeMembers','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x87be,0x7e));var _0xe87b=function(_0x1c9a49,_0x273ee6){_0x1c9a49=_0x1c9a49-0x0;var _0x19c4ad=_0x87be[_0x1c9a49];return _0x19c4ad;};'use strict';var multer=require(_0xe87b('0x0'));var util=require(_0xe87b('0x1'));var path=require(_0xe87b('0x2'));var timeout=require('connect-timeout');var express=require(_0xe87b('0x3'));var router=express[_0xe87b('0x4')]();var fs_extra=require(_0xe87b('0x5'));var auth=require(_0xe87b('0x6'));var interaction=require(_0xe87b('0x7'));var config=require(_0xe87b('0x8'));var controller=require(_0xe87b('0x9'));router[_0xe87b('0xa')]('/',auth[_0xe87b('0xb')](),controller[_0xe87b('0xc')]);router[_0xe87b('0xa')]('/describe',auth[_0xe87b('0xb')](),controller[_0xe87b('0xd')]);router[_0xe87b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe87b('0xe')]);router[_0xe87b('0xa')]('/:id/unread',auth['isAuthenticated'](),controller[_0xe87b('0xf')]);router[_0xe87b('0xa')](_0xe87b('0x10'),auth['isAuthenticated'](),controller[_0xe87b('0x11')]);router[_0xe87b('0xa')](_0xe87b('0x12'),auth[_0xe87b('0xb')](),controller['getMessages']);router[_0xe87b('0x13')]('/',auth[_0xe87b('0xb')](),controller['create']);router['post'](_0xe87b('0x10'),auth[_0xe87b('0xb')](),controller[_0xe87b('0x14')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xe87b('0x15')]);router[_0xe87b('0x16')](_0xe87b('0x17'),auth[_0xe87b('0xb')](),controller[_0xe87b('0x18')]);router[_0xe87b('0x19')](_0xe87b('0x17'),auth[_0xe87b('0xb')](),controller['destroy']);router['delete'](_0xe87b('0x10'),auth[_0xe87b('0xb')](),controller[_0xe87b('0x1a')]);module[_0xe87b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 6e6548e..dc19d24 100644 --- a/server/api/chatInteraction/chatInteraction.attributes.js +++ b/server/api/chatInteraction/chatInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['thumb','star','TEXT','STRING','DATE','long','exports','BOOLEAN'];(function(_0x44e173,_0x1dde5d){var _0x11d579=function(_0x105734){while(--_0x105734){_0x44e173['push'](_0x44e173['shift']());}};_0x11d579(++_0x1dde5d);}(_0x757a,0xde));var _0xa757=function(_0x461303,_0x216dc3){_0x461303=_0x461303-0x0;var _0x31f34d=_0x757a[_0x461303];return _0x31f34d;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'closed':{'type':Sequelize[_0xa757('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star',_0xa757('0x2')),'defaultValue':_0xa757('0x3')},'ratingMessage':{'type':Sequelize[_0xa757('0x4')]},'pathTranscript':{'type':Sequelize[_0xa757('0x4')]},'mailTranscript':{'type':Sequelize[_0xa757('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa757('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa757('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa757('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xa757('0x5')]},'browserVersion':{'type':Sequelize[_0xa757('0x5')]},'osName':{'type':Sequelize[_0xa757('0x5')]},'osVersion':{'type':Sequelize[_0xa757('0x5')]},'deviceModel':{'type':Sequelize[_0xa757('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xa757('0x5')]},'referer':{'type':Sequelize[_0xa757('0x4')]},'customerIp':{'type':Sequelize[_0xa757('0x5')]},'formData':{'type':Sequelize[_0xa757('0x4')](_0xa757('0x7'))},'read1stAt':{'type':Sequelize[_0xa757('0x6')]},'lastMsgAt':{'type':Sequelize[_0xa757('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xa757('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xb03e=['out','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x2005dd,_0x37e644){var _0x494d45=function(_0x5ec976){while(--_0x5ec976){_0x2005dd['push'](_0x2005dd['shift']());}};_0x494d45(++_0x37e644);}(_0xb03e,0x1eb));var _0xeb03=function(_0x475e41,_0x2a7806){_0x475e41=_0x475e41-0x0;var _0x234f33=_0xb03e[_0x475e41];return _0x234f33;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'closed':{'type':Sequelize[_0xeb03('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xeb03('0x2')]},'ratingType':{'type':Sequelize[_0xeb03('0x3')](_0xeb03('0x4'),_0xeb03('0x5')),'defaultValue':_0xeb03('0x4')},'ratingMessage':{'type':Sequelize[_0xeb03('0x6')]},'pathTranscript':{'type':Sequelize[_0xeb03('0x6')]},'mailTranscript':{'type':Sequelize[_0xeb03('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xeb03('0x8')]},'disposition':{'type':Sequelize[_0xeb03('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xeb03('0x7')]},'note':{'type':Sequelize[_0xeb03('0x7')]},'browserName':{'type':Sequelize[_0xeb03('0x7')]},'browserVersion':{'type':Sequelize[_0xeb03('0x7')]},'osName':{'type':Sequelize[_0xeb03('0x7')]},'osVersion':{'type':Sequelize[_0xeb03('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xeb03('0x7')]},'deviceType':{'type':Sequelize[_0xeb03('0x7')]},'referer':{'type':Sequelize[_0xeb03('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xeb03('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xeb03('0x8')]},'lastMsgAt':{'type':Sequelize[_0xeb03('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xeb03('0x3')]('in',_0xeb03('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xeb03('0x7')]},'customerPort':{'type':Sequelize[_0xeb03('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xeb03('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xeb03('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index bdb3909..dc9d012 100644 --- a/server/api/chatInteraction/chatInteraction.controller.js +++ b/server/api/chatInteraction/chatInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','render','merge','body','contact','account','Users','map','fullname','TagIds','Tags','push','answered','unmanaged','total','closed','UserId','talking','waiting','disposition','abandoned','index','ChatInteraction','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','from','tools_tags','u.fullname','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','sequelize','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','options','create','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','ChatMessage','Messages','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','includeAgent','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','then'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x54ef,0x112));var _0xf54e=function(_0x534baf,_0x2ee802){_0x534baf=_0x534baf-0x0;var _0x3e491b=_0x54ef[_0x534baf];return _0x3e491b;};'use strict';var rimraf=require(_0xf54e('0x0'));var zipdir=require(_0xf54e('0x1'));var rp=require(_0xf54e('0x2'));var moment=require('moment');var BPromise=require(_0xf54e('0x3'));var Mustache=require(_0xf54e('0x4'));var util=require(_0xf54e('0x5'));var path=require(_0xf54e('0x6'));var ejs=require(_0xf54e('0x7'));var fs=require('fs');var _=require(_0xf54e('0x8'));var squel=require(_0xf54e('0x9'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0xf54e('0xa'));var pdf=require(_0xf54e('0xb'));var logger=require(_0xf54e('0xc'))('api');var config=require(_0xf54e('0xd'));var db=require('../../mysqldb')['db'];config[_0xf54e('0xe')]=_[_0xf54e('0xf')](config['redis'],{'host':_0xf54e('0x10'),'port':0x18eb});var socket=require(_0xf54e('0x11'))(new Redis(config[_0xf54e('0xe')]));require(_0xf54e('0x12'))['register'](socket);var jayson=require(_0xf54e('0x13'));var client=jayson[_0xf54e('0x14')][_0xf54e('0x15')]({'port':0x232b});var client9004=jayson[_0xf54e('0x14')]['http']({'port':0x232c});function respondWithRpcPromise(_0x358c88,_0x4b0ee1,_0x4bd828,_0x15a9d4){return new BPromise(function(_0x2033e9,_0x28f776){var _0x380f26=_0x15a9d4||client;return _0x380f26['request'](_0x358c88,_0x4bd828)[_0xf54e('0x16')](function(_0x1bbeaa){logger[_0xf54e('0x17')](_0xf54e('0x18'),_0x4b0ee1,'request\x20sent');logger[_0xf54e('0x19')](_0xf54e('0x1a'),_0x4b0ee1,_0xf54e('0x1b'),JSON['stringify'](_0x1bbeaa));if(_0x1bbeaa['error']){if(_0x1bbeaa[_0xf54e('0x1c')][_0xf54e('0x1d')]===0x1f4){logger[_0xf54e('0x1c')](_0xf54e('0x18'),_0x4b0ee1,_0x1bbeaa[_0xf54e('0x1c')][_0xf54e('0x1e')]);return _0x28f776(_0x1bbeaa[_0xf54e('0x1c')][_0xf54e('0x1e')]);}logger[_0xf54e('0x1c')](_0xf54e('0x18'),_0x4b0ee1,_0x1bbeaa[_0xf54e('0x1c')]['message']);return _0x2033e9(_0x1bbeaa['error'][_0xf54e('0x1e')]);}else{logger['info'](_0xf54e('0x18'),_0x4b0ee1,_0xf54e('0x1b'));_0x2033e9(_0x1bbeaa[_0xf54e('0x1f')][_0xf54e('0x1e')]);}})[_0xf54e('0x20')](function(_0x3887b0){logger[_0xf54e('0x1c')](_0xf54e('0x18'),_0x4b0ee1,_0x3887b0);_0x28f776(_0x3887b0);});});}function respondWithStatusCode(_0x3c0169,_0x5f9eea){_0x5f9eea=_0x5f9eea||0xcc;return function(_0x1c58bd){if(_0x1c58bd){return _0x3c0169['sendStatus'](_0x5f9eea);}return _0x3c0169[_0xf54e('0x21')](_0x5f9eea)['end']();};}function respondWithResult(_0x264a8f,_0x272df6){_0x272df6=_0x272df6||0xc8;return function(_0x335492){if(_0x335492){return _0x264a8f[_0xf54e('0x21')](_0x272df6)[_0xf54e('0x22')](_0x335492);}};}function respondWithFilteredResult(_0x160160,_0x1e08d1){return function(_0x43488d){if(_0x43488d){var _0x2342a9=typeof _0x1e08d1[_0xf54e('0x23')]===_0xf54e('0x24')&&typeof _0x1e08d1[_0xf54e('0x25')]===_0xf54e('0x24');var _0x5390b8=_0x43488d[_0xf54e('0x26')];var _0x4cbf7c=_0x2342a9?0x0:_0x1e08d1[_0xf54e('0x23')];var _0x5e63f4=_0x2342a9?_0x43488d[_0xf54e('0x26')]:_0x1e08d1[_0xf54e('0x23')]+_0x1e08d1[_0xf54e('0x25')];var _0xa13cd0;if(_0x5e63f4>=_0x5390b8){_0x5e63f4=_0x5390b8;_0xa13cd0=0xc8;}else{_0xa13cd0=0xce;}_0x160160[_0xf54e('0x21')](_0xa13cd0);return _0x160160[_0xf54e('0x27')](_0xf54e('0x28'),_0x4cbf7c+'-'+_0x5e63f4+'/'+_0x5390b8)['json'](_0x43488d);}return null;};}function saveUpdates(_0x4b3c73){return function(_0x2f96b1){if(_0x2f96b1){return _0x2f96b1[_0xf54e('0x29')](_0x4b3c73)[_0xf54e('0x16')](function(_0x16d00f){return _0x16d00f;});}return null;};}function removeEntity(_0xb2d4c4){return function(_0x133cd7){if(_0x133cd7){return _0x133cd7[_0xf54e('0x2a')]()[_0xf54e('0x16')](function(){_0xb2d4c4[_0xf54e('0x21')](0xcc)[_0xf54e('0x2b')]();});}};}function handleEntityNotFound(_0x5ea0cc){return function(_0x5f29d3){if(!_0x5f29d3){_0x5ea0cc[_0xf54e('0x2c')](0x194);}return _0x5f29d3;};}function handleError(_0x3169dd,_0x4d8fdd){_0x4d8fdd=_0x4d8fdd||0x1f4;return function(_0x3e319c){logger[_0xf54e('0x1c')](_0x3e319c[_0xf54e('0x2d')]);if(_0x3e319c[_0xf54e('0x2e')]){delete _0x3e319c['name'];}_0x3169dd['status'](_0x4d8fdd)['send'](_0x3e319c);};}function getMustacheRender(_0x3c0cca,_0xe7e042){return Mustache[_0xf54e('0x2f')](_0x3c0cca,_[_0xf54e('0x30')](_0xe7e042[_0xf54e('0x31')],{'contact':_0xe7e042[_0xf54e('0x32')],'message':_0xe7e042['message'],'agent':_0xe7e042['agent'],'interaction':_0xe7e042['interaction'],'account':_0xe7e042[_0xf54e('0x33')]}))||'';}function getInteractionUsers(_0x734187,_0x59c003){return new BPromise(function(_0x4d9b06,_0xda1d10){try{if(_0x59c003[_0x734187['id']]){_0x734187[_0xf54e('0x34')]=_[_0xf54e('0x35')](_0x59c003[_0x734187['id']],function(_0x4a347a){return{'id':_0x4a347a['id'],'fullname':_0x4a347a[_0xf54e('0x36')]};});}}catch(_0x44a437){_0xda1d10(_0x44a437);}_0x4d9b06(_0x734187);});}function getInteractionTags(_0x50aeca,_0x38d7a0){return new BPromise(function(_0x6e5bdf,_0x5af03){try{if(_0x50aeca[_0xf54e('0x37')]){_0x50aeca[_0xf54e('0x38')]=[];_0x50aeca[_0xf54e('0x37')]['split'](',')['forEach'](function(_0x3d5a68){_0x50aeca[_0xf54e('0x38')][_0xf54e('0x39')](_0x38d7a0[_0x3d5a68]);});}delete _0x50aeca['TagIds'];}catch(_0x4533a2){_0x5af03(_0x4533a2);}_0x6e5bdf(_0x50aeca);});}function updateChatInteraction(_0x22fa6f,_0x448054,_0x1ee884){return new BPromise(function(_0x361e4c,_0x23f297){return getInteractionUsers(_0x22fa6f,_0x1ee884)[_0xf54e('0x16')](function(_0x1345b0){return getInteractionTags(_0x1345b0,_0x448054);})[_0xf54e('0x16')](function(_0x2087b3){return getStateInteraction(_0x2087b3);})[_0xf54e('0x16')](function(_0x30e147){_0x361e4c(_0x30e147);})[_0xf54e('0x20')](function(_0x2625fd){_0x23f297(_0x2625fd);});});}function getStateInteraction(_0x2043a8){return new BPromise(function(_0x5085c1){_0x2043a8['waiting']=0x0;_0x2043a8['talking']=0x0;_0x2043a8[_0xf54e('0x3a')]=0x0;_0x2043a8[_0xf54e('0x3b')]=0x0;_0x2043a8['abandoned']=0x0;_0x2043a8[_0xf54e('0x3c')]=0x0;if(!_0x2043a8[_0xf54e('0x3d')]&&!_0x2043a8[_0xf54e('0x3e')]){_0x2043a8['waiting']+=0x1;}if(!_0x2043a8[_0xf54e('0x3d')]&&_0x2043a8[_0xf54e('0x3e')]){_0x2043a8[_0xf54e('0x3f')]+=0x1;if(_0x2043a8[_0xf54e('0x40')]){_0x2043a8[_0xf54e('0x40')]-=0x1;}}if(_0x2043a8[_0xf54e('0x3d')]&&_0x2043a8[_0xf54e('0x41')]===_0xf54e('0x42')){_0x2043a8[_0xf54e('0x42')]+=0x1;if(_0x2043a8['waiting']){_0x2043a8[_0xf54e('0x40')]-=0x1;}}else if(_0x2043a8[_0xf54e('0x3d')]&&!_0x2043a8[_0xf54e('0x3e')]&&_0x2043a8[_0xf54e('0x41')]){_0x2043a8[_0xf54e('0x3b')]+=0x1;if(_0x2043a8[_0xf54e('0x40')]){_0x2043a8['waiting']-=0x1;}}else if(_0x2043a8[_0xf54e('0x3d')]&&_0x2043a8['UserId']){_0x2043a8[_0xf54e('0x3a')]+=0x1;if(_0x2043a8['talking']){_0x2043a8[_0xf54e('0x3f')]-=0x1;}}_0x2043a8[_0xf54e('0x3c')]+=0x1;_0x5085c1(_0x2043a8);});}exports[_0xf54e('0x43')]=function(_0x57371d,_0x1af35d){var _0x40b21c={},_0x12971a={},_0x32fb46={'count':0x0,'rows':[]};var _0x3a5a87=_['map'](db[_0xf54e('0x44')][_0xf54e('0x45')],function(_0x346bb4){return{'name':_0x346bb4[_0xf54e('0x46')],'type':_0x346bb4['type'][_0xf54e('0x47')]};});_0x12971a[_0xf54e('0x48')]=_['map'](_0x3a5a87,_0xf54e('0x2e'));_0x12971a[_0xf54e('0x49')]=_[_0xf54e('0x4a')](_0x57371d[_0xf54e('0x49')]);_0x12971a['filters']=_[_0xf54e('0x4b')](_0x12971a[_0xf54e('0x48')],_0x12971a[_0xf54e('0x49')]);_0x40b21c[_0xf54e('0x4c')]=_[_0xf54e('0x4b')](_0x12971a[_0xf54e('0x48')],qs[_0xf54e('0x4d')](_0x57371d[_0xf54e('0x49')][_0xf54e('0x4d')]));_0x40b21c[_0xf54e('0x4c')]=_0x40b21c[_0xf54e('0x4c')][_0xf54e('0x4e')]?_0x40b21c[_0xf54e('0x4c')]:_0x12971a[_0xf54e('0x48')];if(!_0x57371d[_0xf54e('0x49')][_0xf54e('0x4f')](_0xf54e('0x50'))){_0x40b21c[_0xf54e('0x25')]=qs[_0xf54e('0x25')](_0x57371d[_0xf54e('0x49')]['limit']);_0x40b21c['offset']=qs[_0xf54e('0x23')](_0x57371d[_0xf54e('0x49')][_0xf54e('0x23')]);}_0x40b21c[_0xf54e('0x51')]=qs[_0xf54e('0x52')](_0x57371d[_0xf54e('0x49')][_0xf54e('0x52')]);_0x40b21c[_0xf54e('0x53')]=qs[_0xf54e('0x54')](_[_0xf54e('0x55')](_0x57371d[_0xf54e('0x49')],_0x12971a['filters']),_0x3a5a87);var _0x2aacf6=[];var _0x2df864=squel[_0xf54e('0x56')]()[_0xf54e('0x57')]('id')[_0xf54e('0x57')](_0xf54e('0x2e'))[_0xf54e('0x57')]('color')[_0xf54e('0x58')](_0xf54e('0x59'));var _0x294fa1=squel['select']()[_0xf54e('0x57')]('u.id')[_0xf54e('0x57')](_0xf54e('0x5a'))[_0xf54e('0x57')]('ui.ChatInteractionId')[_0xf54e('0x58')](_0xf54e('0x5b'),'ui')[_0xf54e('0x5c')](_0xf54e('0x5d'),'u',_0xf54e('0x5e'));var _0x2ec72a=squel[_0xf54e('0x56')]()['from']('chat_interactions','i')[_0xf54e('0x5c')](_0xf54e('0x5f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf54e('0x5c')]('users','o',_0xf54e('0x60'))['left_join'](_0xf54e('0x61'),'a',_0xf54e('0x62'))[_0xf54e('0x5c')](_0xf54e('0x63'),'me',_0xf54e('0x64'))[_0xf54e('0x5c')]('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0xf54e('0x5c')](_0xf54e('0x59'),'t','t.id\x20=\x20it.TagId');var _0x57a48e=squel[_0xf54e('0x65')]();var _0x511a99=[];var _0x2b616a=squel[_0xf54e('0x65')]();var _0x47596c;if(_0x57371d[_0xf54e('0x49')][_0xf54e('0x66')]){_0x47596c=as[_0xf54e('0x67')](_0x57371d[_0xf54e('0x49')][_0xf54e('0x66')]);var _0x11732b=_0x47596c[_0xf54e('0x68')];for(var _0x1f9dad=0x0;_0x1f9dad<_0x47596c[_0xf54e('0x69')][_0xf54e('0x4e')];_0x1f9dad++){var _0x2607c2=_0x47596c['conditions'][_0x1f9dad];var _0x302f3d='i';var _0x5d5dd7=_[_0xf54e('0x6a')](_0x3a5a87,[_0xf54e('0x2e'),_0x2607c2[_0xf54e('0x57')]]);if(!_0x5d5dd7){switch(_0x2607c2['field']){case _0xf54e('0x6b'):if(_0x2607c2[_0xf54e('0x6c')]==0x1){_0x2ec72a['having']('`'+_0x2607c2['field']+_0xf54e('0x6d'));}else{_0x2ec72a['having']('`'+_0x2607c2[_0xf54e('0x57')]+_0xf54e('0x6e'));}break;case _0xf54e('0x6f'):if(_0x2607c2[_0xf54e('0x70')]==='$substring'){if(_0x2607c2[_0xf54e('0x6c')]['split']('\x20')[_0xf54e('0x4e')]>0x1){_0x57a48e[_0x11732b](_0xf54e('0x71'),qs[_0xf54e('0x72')](_0x2607c2['value']),null);}else{var _0x2d04db='%'+_0x2607c2['value']+'%';_0x57a48e[_0x11732b](_0xf54e('0x73'),_0x2d04db,_0x2d04db,_0x2d04db);}}else{_0x5d5dd7=_[_0xf54e('0x6a')](_0x3a5a87,['name',_0xf54e('0x74')]);_0x2607c2['field']=_0xf54e('0x74');_0x2ee19b=as[_0xf54e('0x75')](_0x302f3d,_0x5d5dd7[_0xf54e('0x76')],_0x2607c2);_0x57a48e[_0x11732b](_0x2ee19b[_0xf54e('0x77')],_0x2ee19b[_0xf54e('0x6c')]['start'],_0x2ee19b[_0xf54e('0x6c')][_0xf54e('0x2b')]);}break;case'Tag':var _0x2db742=_0x2607c2[_0xf54e('0x6c')]['split'](',')[_0xf54e('0x35')](function(_0x14aaf7){return Number(_0x14aaf7);});_0x2db742[_0xf54e('0x78')](function(_0x4c72ef){_0x2b616a['or'](_0xf54e('0x79'),'%,'+_0x4c72ef+',%');});_0x511a99=_['union'](_0x511a99,_0x2db742);break;case _0xf54e('0x7a'):if(_0x2607c2[_0xf54e('0x70')]==='$substring'){_0x57a48e[_0x11732b](_0xf54e('0x7b'),'%'+_0x2607c2[_0xf54e('0x6c')]+'%',null);}else{_0x5d5dd7=_[_0xf54e('0x6a')](_0x3a5a87,[_0xf54e('0x2e'),_0xf54e('0x3e')]);_0x2607c2[_0xf54e('0x57')]=_0xf54e('0x3e');_0x2ee19b=as[_0xf54e('0x75')](_0x302f3d,_0x5d5dd7[_0xf54e('0x76')],_0x2607c2);_0x57a48e[_0x11732b](_0x2ee19b[_0xf54e('0x77')],_0x2ee19b[_0xf54e('0x6c')]['start'],_0x2ee19b[_0xf54e('0x6c')][_0xf54e('0x2b')]);}break;case _0xf54e('0x31'):_0x2ee19b=as['buildExpression']('me',null,_0x2607c2);_0x57a48e[_0x11732b](_0x2ee19b[_0xf54e('0x77')],_0x2ee19b[_0xf54e('0x6c')][_0xf54e('0x7c')],_0x2ee19b[_0xf54e('0x6c')][_0xf54e('0x2b')]);break;}}else{var _0x2ee19b=as[_0xf54e('0x75')](_0x302f3d,_0x5d5dd7['type'],_0x2607c2);_0x57a48e[_0x11732b](_0x2ee19b[_0xf54e('0x77')],_0x2ee19b[_0xf54e('0x6c')][_0xf54e('0x7c')],_0x2ee19b['value'][_0xf54e('0x2b')]);}}}else{var _0x419ba2=_(_0x57371d[_0xf54e('0x49')])[_0xf54e('0x4a')]()['map'](function(_0x4a6dee){return _[_0xf54e('0x7d')](_0x3a5a87,[_0xf54e('0x2e'),_0x4a6dee])?_0x4a6dee:undefined;})[_0xf54e('0x7e')]()[_0xf54e('0x6c')]();if(!_[_0xf54e('0x7f')](_0x419ba2)){_0x419ba2[_0xf54e('0x78')](function(_0x35b5a4){if(_0x35b5a4===_0xf54e('0x80')){_0x2ec72a[_0xf54e('0x53')](_0xf54e('0x81'),[]['concat'](_0x57371d[_0xf54e('0x49')][_0x35b5a4]));}else if(_0x35b5a4===_0xf54e('0x82')){var _0x2b026a=JSON[_0xf54e('0x83')](_0x57371d['query'][_0x35b5a4])[_0xf54e('0x84')];var _0x1de6dd=JSON[_0xf54e('0x83')](_0x57371d[_0xf54e('0x49')][_0x35b5a4])['$lte'];_0x2ec72a[_0xf54e('0x53')](_0xf54e('0x85'),_0x2b026a,_0x1de6dd);}else{if(_0x57371d[_0xf54e('0x49')][_0x35b5a4]==='null'){_0x2ec72a['where']('i.'+_0x35b5a4+_0xf54e('0x86'));}else{_0x2ec72a[_0xf54e('0x53')]('i.'+_0x35b5a4+_0xf54e('0x87'),_0x57371d[_0xf54e('0x49')][_0x35b5a4]);}}});}if(_0x57371d[_0xf54e('0x49')][_0xf54e('0x88')]){if(_0x57371d[_0xf54e('0x49')][_0xf54e('0x88')]==0x1){_0x2ec72a[_0xf54e('0x89')]('`unreadMessages`\x20=\x200');}else{_0x2ec72a[_0xf54e('0x89')](_0xf54e('0x8a'));}}if(_0x57371d[_0xf54e('0x49')][_0xf54e('0x8b')]){_0x511a99=_[_0xf54e('0x8c')](_0x57371d[_0xf54e('0x49')][_0xf54e('0x8b')])?_0x57371d[_0xf54e('0x49')][_0xf54e('0x8b')]:new Array(_0x57371d[_0xf54e('0x49')][_0xf54e('0x8b')]);_0x511a99[_0xf54e('0x78')](function(_0x5b9ff2){_0x2b616a['or'](_0xf54e('0x79'),'%,'+_0x5b9ff2+',%');});}if(_0x57371d[_0xf54e('0x49')]['filter']){var _0x4a0614=_0x57371d[_0xf54e('0x49')][_0xf54e('0x8d')][_0xf54e('0x8e')]('\x5c','\x5c\x5c')[_0xf54e('0x8e')](/'/g,'\x27\x27');if(qs[_0xf54e('0x8f')](_0x4a0614)){_0x57a48e['or'](_0xf54e('0x90'),_0x4a0614+'%');}else{_0x57a48e['or'](_0xf54e('0x91'),qs[_0xf54e('0x72')](_0x4a0614))['or'](_0xf54e('0x92'),_0x4a0614+'%');}}}_0x2ec72a['where'](_0x57a48e);_0x2ec72a[_0xf54e('0x93')](_0xf54e('0x94'));var _0x3c641b={'type':db['Sequelize'][_0xf54e('0x95')]['SELECT'],'raw':!![]};var _0x3830e7=_0x2ec72a['clone']();_0x3830e7[_0xf54e('0x57')](_0xf54e('0x94'));_0x3830e7['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf54e('0x6b'));if(_0x40b21c[_0xf54e('0x51')]){_0x40b21c[_0xf54e('0x51')][_0xf54e('0x78')](function(_0x389f16){var _0x486626=_0x389f16[0x0]==='contactName'?_0x389f16[0x0]:'i.'+_0x389f16[0x0];_0x2ec72a[_0xf54e('0x51')](_0x486626,_0x389f16[0x1]===_0xf54e('0x96')?![]:!![]);});}if(!_[_0xf54e('0x7f')](_0x511a99)){_0x2ec72a[_0xf54e('0x89')](_0x2b616a);_0x3830e7[_0xf54e('0x53')](_0xf54e('0x97'),_0x511a99);}BPromise[_0xf54e('0x98')]()[_0xf54e('0x16')](function(){if(!_0x47596c){if(_0x57371d[_0xf54e('0x49')][_0xf54e('0x80')])return;_0x3830e7['where'](_0xf54e('0x99'));_0x2ec72a[_0xf54e('0x53')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x57371d['user'][_0xf54e('0x9a')]!==_0xf54e('0x9b'))return;return _0x57371d[_0xf54e('0x9c')][_0xf54e('0x9d')]({'attributes':['id'],'raw':!![]})[_0xf54e('0x16')](function(_0x5e6713){if(_[_0xf54e('0x7f')](_0x5e6713)){_0x3830e7[_0xf54e('0x53')](_0xf54e('0x9e'));_0x2ec72a[_0xf54e('0x53')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x3830e7[_0xf54e('0x53')](_0xf54e('0x81'),_[_0xf54e('0x35')](_0x5e6713,'id'));_0x2ec72a[_0xf54e('0x53')]('i.ChatWebsiteId\x20IN\x20?',_[_0xf54e('0x35')](_0x5e6713,'id'));}});})[_0xf54e('0x16')](function(){if(_0x57371d[_0xf54e('0x9c')][_0xf54e('0x9a')]===_0xf54e('0x9b')&&!_0x47596c&&!_0x57371d['query'][_0xf54e('0x80')])return[];return db['sequelize']['query'](_0x3830e7[_0xf54e('0x9f')](),_0x3c641b);})[_0xf54e('0x16')](function(_0x242f5c){_0x32fb46[_0xf54e('0x26')]=_0x242f5c[_0xf54e('0x4e')];if(_0x32fb46[_0xf54e('0x26')]===0x0)return[];return db[_0xf54e('0xa0')][_0xf54e('0x49')](_0x2df864[_0xf54e('0x9f')](),_0x3c641b)['then'](function(_0x3dddbd){_0x2aacf6=_[_0xf54e('0xa1')](_0x3dddbd,'id');_0x3c641b=_[_0xf54e('0x30')](_0x3c641b,{'model':db[_0xf54e('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x57371d[_0xf54e('0x49')][_0xf54e('0x4d')]){_0x40b21c['attributes'][_0xf54e('0x78')](function(_0x978fe2){_0x2ec72a[_0xf54e('0x57')]('i.'+_0x978fe2);});}else{_0x2ec72a[_0xf54e('0x57')](_0xf54e('0xa2'),_0xf54e('0x6b'));_0x2ec72a['field'](_0xf54e('0xa3'),_0xf54e('0xa4'));_0x2ec72a[_0xf54e('0x57')](_0xf54e('0xa5'),'Account.mandatoryDisposition');_0x2ec72a['field'](_0xf54e('0xa6'),_0xf54e('0xa7'));_0x2ec72a[_0xf54e('0x57')](_0xf54e('0xa8'));_0x2ec72a[_0xf54e('0x57')](_0xf54e('0xa9'),'Contact.firstName');_0x2ec72a[_0xf54e('0x57')](_0xf54e('0xaa'),_0xf54e('0xab'));_0x2ec72a[_0xf54e('0x57')](_0xf54e('0xac'),_0xf54e('0xad'));_0x2ec72a['field'](_0xf54e('0xae'),'Contact.phone');_0x2ec72a[_0xf54e('0x57')]('c.mobile',_0xf54e('0xaf'));_0x2ec72a[_0xf54e('0x57')](_0xf54e('0xb0'),_0xf54e('0xb1'));_0x2ec72a[_0xf54e('0x57')]('o.fullname',_0xf54e('0xb2'));_0x2ec72a[_0xf54e('0x57')]('o.internal',_0xf54e('0xb3'));_0x2ec72a[_0xf54e('0x57')](_0xf54e('0xb4'),_0xf54e('0x37'));}if(_0x40b21c['limit'])_0x2ec72a[_0xf54e('0x25')](_0x40b21c[_0xf54e('0x25')]);if(_0x40b21c['offset'])_0x2ec72a[_0xf54e('0x23')](_0x40b21c['offset']);return db['sequelize'][_0xf54e('0x49')](_0x2ec72a['toString'](),_0x3c641b);})[_0xf54e('0x16')](function(_0x28e406){if(_0x28e406[_0xf54e('0x4e')]>0x0)_0x294fa1[_0xf54e('0x53')](_0xf54e('0xb5'),_['map'](_0x28e406,'id'));return db[_0xf54e('0xa0')][_0xf54e('0x49')](_0x294fa1[_0xf54e('0x9f')](),_0x3c641b)[_0xf54e('0x16')](function(_0x4a681e){var _0x3ed6e4=_['groupBy'](_0x4a681e,_0xf54e('0xb6'));var _0x1e6414=[];_0x28e406['forEach'](function(_0x236f93){_0x1e6414[_0xf54e('0x39')](updateChatInteraction(_0x236f93,_0x2aacf6,_0x3ed6e4));});return BPromise[_0xf54e('0xb7')](_0x1e6414);});});})[_0xf54e('0x16')](function(_0x5a7eac){_0x32fb46[_0xf54e('0xb8')]=_0x5a7eac;return _0x32fb46;})[_0xf54e('0x16')](respondWithFilteredResult(_0x1af35d,_0x40b21c))[_0xf54e('0x20')](handleError(_0x1af35d,null));};exports['show']=function(_0x4a133a,_0x4548a7){var _0x5e33bc={'raw':![],'where':{'id':_0x4a133a['params']['id']}},_0x5765e1={};_0x5765e1[_0xf54e('0x48')]=_[_0xf54e('0x4a')](db[_0xf54e('0x44')][_0xf54e('0x45')]);_0x5765e1[_0xf54e('0x49')]=_[_0xf54e('0x4a')](_0x4a133a[_0xf54e('0x49')]);_0x5765e1[_0xf54e('0x54')]=_[_0xf54e('0x4b')](_0x5765e1['model'],_0x5765e1[_0xf54e('0x49')]);_0x5e33bc['attributes']=_[_0xf54e('0x4b')](_0x5765e1[_0xf54e('0x48')],qs['fields'](_0x4a133a[_0xf54e('0x49')]['fields']));_0x5e33bc[_0xf54e('0x4c')]=_0x5e33bc[_0xf54e('0x4c')][_0xf54e('0x4e')]?_0x5e33bc[_0xf54e('0x4c')]:_0x5765e1[_0xf54e('0x48')];if(_0x4a133a[_0xf54e('0x49')]['includeAll']){_0x5e33bc['include']=[{'all':!![]}];}_0x5e33bc=_['merge']({},_0x5e33bc,_0x4a133a[_0xf54e('0xb9')]);return db['ChatInteraction'][_0xf54e('0x6a')](_0x5e33bc)[_0xf54e('0x16')](handleEntityNotFound(_0x4548a7,null))[_0xf54e('0x16')](respondWithResult(_0x4548a7,null))[_0xf54e('0x20')](handleError(_0x4548a7,null));};exports[_0xf54e('0xba')]=function(_0x5e5e50,_0x40a68c){return db[_0xf54e('0x44')][_0xf54e('0xba')](_0x5e5e50[_0xf54e('0x31')],{})[_0xf54e('0x16')](respondWithResult(_0x40a68c,0xc9))[_0xf54e('0x20')](handleError(_0x40a68c,null));};exports['update']=function(_0x996df5,_0x811fa7){if(_0x996df5[_0xf54e('0x31')]['id']){delete _0x996df5[_0xf54e('0x31')]['id'];}return db[_0xf54e('0x44')]['find']({'where':{'id':_0x996df5[_0xf54e('0xbb')]['id']}})[_0xf54e('0x16')](handleEntityNotFound(_0x811fa7,null))[_0xf54e('0x16')](saveUpdates(_0x996df5[_0xf54e('0x31')],null))[_0xf54e('0x16')](respondWithResult(_0x811fa7,null))[_0xf54e('0x20')](handleError(_0x811fa7,null));};exports[_0xf54e('0x2a')]=function(_0x4689e8,_0x2e42f7){return db['ChatInteraction'][_0xf54e('0x6a')]({'where':{'id':_0x4689e8[_0xf54e('0xbb')]['id']}})['then'](handleEntityNotFound(_0x2e42f7,null))['then'](removeEntity(_0x2e42f7,null))[_0xf54e('0x20')](handleError(_0x2e42f7,null));};exports['describe']=function(_0x40bf28,_0xd4db77){return db[_0xf54e('0x44')][_0xf54e('0xbc')]()['then'](respondWithResult(_0xd4db77,null))[_0xf54e('0x20')](handleError(_0xd4db77,null));};exports[_0xf54e('0xbd')]=function(_0x59fb9a,_0x90ad88){var _0x3797bf=_0x59fb9a[_0xf54e('0xbb')]['id'];var _0x458450;var _0x627e9a;var _0x413b9a;return db[_0xf54e('0x44')][_0xf54e('0xbe')]({'where':{'id':_0x3797bf}})[_0xf54e('0x16')](function(_0x3634bc){_0x458450=_0x3634bc;return db[_0xf54e('0xbf')]['findOne']({'where':{'id':_0x3634bc['ChatWebsiteId']},'attributes':['id',_0xf54e('0xc0'),_0xf54e('0xc1'),_0xf54e('0xc2'),_0xf54e('0xc3'),_0xf54e('0xc4')],'raw':!![]});})['then'](function(_0x3b29f4){if(_0x3b29f4&&_0x3b29f4[_0xf54e('0xc0')]&&_0x3b29f4[_0xf54e('0xc1')]){_0x627e9a=_0x3b29f4;var _0x213dc5={'interaction':{'id':_0x3797bf},'agent':{'id':_0x59fb9a['user']['id'],'name':_0x59fb9a[_0xf54e('0x9c')][_0xf54e('0x2e')],'fullname':_0x59fb9a[_0xf54e('0x9c')][_0xf54e('0x36')],'email':_0x59fb9a[_0xf54e('0x9c')][_0xf54e('0xc5')]},'contact':_0x59fb9a[_0xf54e('0x31')][_0xf54e('0x32')],'account':_0x59fb9a[_0xf54e('0x31')][_0xf54e('0x33')]};var _0x3e0fb5={'rejectUnauthorized':![],'method':_0xf54e('0xc6'),'url':_0xf54e('0xc7'),'headers':{'X-APIKEY':_0x3b29f4[_0xf54e('0xc0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x59fb9a['user'][_0xf54e('0xc5')]],'buttons':null,'topic':_0x627e9a['vidaooTopic'],'note':_['isNull'](_0x627e9a[_0xf54e('0xc3')])?null:getMustacheRender(_0x627e9a[_0xf54e('0xc3')],_0x213dc5),'metadata':null},'redirect':_0xf54e('0xc8'),'json':!![]};try{if(!_[_0xf54e('0xc9')](_0x627e9a[_0xf54e('0xc4')])){var _0x2609ef=getMustacheRender(_0x627e9a[_0xf54e('0xc4')],_0x213dc5);var _0x113020=JSON[_0xf54e('0x83')](_0x2609ef);_0x3e0fb5[_0xf54e('0x31')][_0xf54e('0xca')]=_0x113020;}}catch(_0x3c77cd){throw new db[(_0xf54e('0xcb'))]['ValidationError'](_0xf54e('0xcc'));}return rp(_0x3e0fb5);}else{throw new db[(_0xf54e('0xcb'))][(_0xf54e('0xcd'))](_0xf54e('0xce'));}})[_0xf54e('0x16')](function(_0x59f0d7){_0x413b9a=_0x59f0d7;if(_0x413b9a['id']){var _0x54275b={'body':_0x413b9a[_0xf54e('0xcf')],'ChatWebsiteId':_0x627e9a['id'],'ChatInteractionId':_0x458450['id'],'direction':_0xf54e('0xd0'),'UserId':_0x59fb9a['user']['id']};return db['ChatMessage'][_0xf54e('0xba')](_0x54275b,{});}else{throw new db['Sequelize'][(_0xf54e('0xcd'))](_0xf54e('0xd1'));}})[_0xf54e('0x16')](function(){return _0x458450[_0xf54e('0xd2')]({'vidaooSessionId':_0x413b9a['id']});})[_0xf54e('0x16')](respondWithResult(_0x90ad88,null))[_0xf54e('0x20')](handleError(_0x90ad88,null));};exports['customUpdate']=function(_0x39fc7d,_0x2e0cf9){if(_0x39fc7d['body']['id']){delete _0x39fc7d[_0xf54e('0x31')]['id'];}return db[_0xf54e('0x44')]['find']({'where':{'id':_0x39fc7d[_0xf54e('0xbb')]['id']},'include':[{'model':db[_0xf54e('0xd3')],'as':_0xf54e('0x6f')}]})['then'](handleEntityNotFound(_0x2e0cf9,null))['then'](saveUpdates(_0x39fc7d[_0xf54e('0x31')],null))[_0xf54e('0x16')](respondWithResult(_0x2e0cf9,null))['catch'](handleError(_0x2e0cf9,null));};exports['abandon']=function(_0x4ce631,_0x39027b){if(_0x4ce631[_0xf54e('0x31')]['id']){delete _0x4ce631[_0xf54e('0x31')]['id'];}return db['ChatInteraction'][_0xf54e('0x6a')]({'where':{'id':_0x4ce631[_0xf54e('0xbb')]['id']}})[_0xf54e('0x16')](function(_0x3da354){if(!_0x3da354){logger[_0xf54e('0x1c')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,'entity\x20not\x20found');_0x39027b['sendStatus'](0x194);}else{if(_0x3da354['UserId']){throw new db[(_0xf54e('0xcb'))]['ValidationError'](_0xf54e('0xd4'));}}return _0x3da354;})[_0xf54e('0x16')](function(_0x484691){if(_0x484691){return _0x484691[_0xf54e('0x29')]({'closed':_0x4ce631['body'][_0xf54e('0x3d')],'disposition':_0x4ce631[_0xf54e('0x31')][_0xf54e('0x41')]})[_0xf54e('0x16')](function(_0x3c0755){return _0x3c0755;});}})[_0xf54e('0x16')](function(){return respondWithRpcPromise(_0xf54e('0xd5'),'abandon',_0x4ce631[_0xf54e('0x31')],client9004);})[_0xf54e('0x16')](respondWithResult(_0x39027b,null))[_0xf54e('0x20')](handleError(_0x39027b,null));};exports[_0xf54e('0xd6')]=function(_0x3733f5,_0x4e3ce0){_0x3733f5[_0xf54e('0x31')][_0xf54e('0x2e')]=_0x3733f5[_0xf54e('0xd7')][_0xf54e('0xd8')];_0x3733f5[_0xf54e('0x31')][_0xf54e('0xd9')]=_0x3733f5['file']['filename'];_0x3733f5['body'][_0xf54e('0x76')]=_0x3733f5[_0xf54e('0xd7')][_0xf54e('0xda')];return db[_0xf54e('0xdb')][_0xf54e('0xba')](_0x3733f5['body'])[_0xf54e('0x16')](respondWithResult(_0x4e3ce0,0xc9))[_0xf54e('0x20')](handleError(_0x4e3ce0,null));};exports['attachmentDownload']=function(_0x29c1ad,_0xd90115){return db[_0xf54e('0x44')]['findOne']({'where':{'id':_0x29c1ad[_0xf54e('0xbb')]['id']},'raw':!![]})[_0xf54e('0x16')](handleEntityNotFound(_0xd90115,null))[_0xf54e('0x16')](function(_0x3cbfc6){if(_0x3cbfc6){if(_0x3cbfc6[_0xf54e('0x3d')]){return _0xd90115[_0xf54e('0x21')](0x193)[_0xf54e('0x22')]({'status':0x193,'message':_0xf54e('0xdc')});}return db['Attachment'][_0xf54e('0xbe')]({'where':{'id':_0x29c1ad['query'][_0xf54e('0xdd')]},'raw':!![]})[_0xf54e('0x16')](handleEntityNotFound(_0xd90115,null));}})[_0xf54e('0x16')](function(_0x227683){if(_0x227683){var _0x10086b=_0x227683[_0xf54e('0xde')]!==null;var _0x32e453=path['join'](config['root'],'server/files/attachments/');if(_0x10086b){_0x32e453=path[_0xf54e('0xdf')](_0x32e453,'offline-chat/');}var _0x1d9795=path['join'](_0x32e453,_0x227683[_0xf54e('0xd9')]);return _0xd90115[_0xf54e('0xe0')](_0x1d9795);}})['catch'](handleError(_0xd90115,null));};exports[_0xf54e('0xe1')]=function(_0xf8dbf6,_0x1f832e){var _0xa05dcf=null;var _0x4701b8=null;var _0xfa9739=null;if(_0xf8dbf6[_0xf54e('0x31')]['id']){delete _0xf8dbf6[_0xf54e('0x31')]['id'];}if(_0xf8dbf6[_0xf54e('0x31')][_0xf54e('0xe2')]){_0xfa9739=path[_0xf54e('0xdf')](config['root'],_0xf54e('0xe3'),util[_0xf54e('0xe4')](_0xf54e('0xe5'),Date['now']()));_0xf8dbf6[_0xf54e('0x31')]['pathTranscript']=_0xfa9739;}return db[_0xf54e('0x44')][_0xf54e('0x6a')]({'where':{'id':_0xf8dbf6[_0xf54e('0xbb')]['id']},'include':[{'model':db[_0xf54e('0xe6')],'as':_0xf54e('0xe7'),'include':[{'model':db[_0xf54e('0x7a')],'as':_0xf54e('0x7a')}]}]})[_0xf54e('0x16')](handleEntityNotFound(_0x1f832e,null))[_0xf54e('0x16')](saveUpdates(_0xf8dbf6[_0xf54e('0x31')],null))[_0xf54e('0x16')](function(_0x4a2222){if(_0x4a2222){_0xa05dcf=_0x4a2222;return db['ChatWebsite']['find']({'where':{'id':_0xa05dcf[_0xf54e('0x80')]}});}})[_0xf54e('0x16')](function(_0x44fbb3){if(_0x44fbb3){_0x4701b8=_0x44fbb3;return db['CmContact'][_0xf54e('0x6a')]({'where':{'id':_0xa05dcf[_0xf54e('0x74')]}});}})['then'](function(_0x405254){if(_0x405254){if(_0xfa9739){var _0xc74621=null;for(var _0x37aeab=0x1;_0x37aeab<_0xa05dcf[_0xf54e('0xe7')][_0xf54e('0x4e')];++_0x37aeab){_0xc74621=_0xa05dcf[_0xf54e('0xe7')][_0x37aeab];var _0xbbae1c=_0xc74621['UserId']?util['format'](_0xf54e('0xe8'),_0x4701b8[_0xf54e('0xe9')],_0xc74621[_0xf54e('0x3e')]):_0xf54e('0xea');var _0x53ae5c=_0xf8dbf6[_0xf54e('0x31')][_0xf54e('0xeb')]||util['format'](_0xf54e('0xe8'),'Visitor',_0xc74621[_0xf54e('0x74')]);switch(_0x4701b8[_0xf54e('0xec')]){case _0xf54e('0xed'):_0xbbae1c=_0xc74621[_0xf54e('0x3e')]?util['format'](_0xf54e('0xe8'),_0x4701b8['agentAlias'],_0xc74621[_0xf54e('0x3e')]):_0xf54e('0xea');break;case _0xf54e('0xee'):_0xbbae1c=_0xc74621[_0xf54e('0x3e')]?_0xc74621['User']['alias']||_0xc74621[_0xf54e('0x7a')][_0xf54e('0x36')]:_0xf54e('0xea');break;case'agent_fullname':_0xbbae1c=_0xc74621[_0xf54e('0x3e')]?_0xc74621[_0xf54e('0x7a')]['fullname']:_0xf54e('0xea');break;default:_0xbbae1c=_0xc74621[_0xf54e('0x3e')]?util[_0xf54e('0xe4')](_0xf54e('0xe8'),_0x4701b8[_0xf54e('0xe9')],_0xc74621[_0xf54e('0x3e')]):'System';}var _0x1bf4d5=util[_0xf54e('0xe4')](_0xf54e('0xef'),moment(_0xc74621[_0xf54e('0x82')])[_0xf54e('0xe4')](_0xf54e('0xf0')),_0xc74621[_0xf54e('0xf1')]==='in'?_0x53ae5c:_0xbbae1c,_0xc74621[_0xf54e('0x31')]);if(!_0xc74621[_0xf54e('0xf2')]){fs[_0xf54e('0xf3')](_0xfa9739,_0x1bf4d5);}}return db[_0xf54e('0xf4')][_0xf54e('0xbe')]({'where':{'service':!![]},'include':[{'model':db[_0xf54e('0xf5')],'as':_0xf54e('0xf6'),'raw':!![],'include':[{'model':db[_0xf54e('0xf7')],'as':_0xf54e('0xf7'),'raw':!![]}]}]});}}})[_0xf54e('0x16')](function(_0x4af3ca){if(!_0x4af3ca||!_0x4af3ca[_0xf54e('0xf6')]||!_0xf8dbf6[_0xf54e('0x31')])return _0xa05dcf;var _0x49bf02=_0x4af3ca['getSmtpOptions']();return respondWithRpcPromise(_0xf54e('0xf8'),_0xf54e('0xf9'),{'account':_0x49bf02,'message':{'from':util[_0xf54e('0xe4')](_0xf54e('0xfa'),_0x4af3ca[_0xf54e('0x2e')],_0x4af3ca['email']||_0x4af3ca[_0xf54e('0xf6')]['user']),'to':_0xf8dbf6[_0xf54e('0x31')][_0xf54e('0xe2')],'subject':'Mail\x20Transcript','text':util[_0xf54e('0xe4')](_0xf54e('0xfb'),_0xf8dbf6[_0xf54e('0x31')][_0xf54e('0xe2')]),'attachments':[{'path':_0xfa9739}]}})[_0xf54e('0x16')](function(){return _0xa05dcf;})[_0xf54e('0x20')](function(_0x3770f3){logger[_0xf54e('0x1c')](_0x3770f3);});})[_0xf54e('0x16')](respondWithStatusCode(_0x1f832e,0xc8))['catch'](handleError(_0x1f832e,null));};exports[_0xf54e('0xfc')]=function(_0x5144f6,_0x1591e5){return db[_0xf54e('0xe6')]['find']({'where':{'id':_0x5144f6[_0xf54e('0xbb')]['id']}})['then'](handleEntityNotFound(_0x1591e5,null))[_0xf54e('0x16')](function(_0x826b2f){if(_0x826b2f){return _0x826b2f['addMessage'](_0x5144f6[_0xf54e('0x31')][_0xf54e('0xfd')],_['omit'](_0x5144f6['body'],['ids','id'])||{});}})[_0xf54e('0x16')](respondWithResult(_0x1591e5,null))[_0xf54e('0x20')](handleError(_0x1591e5,null));};exports[_0xf54e('0xfe')]=function(_0x369bfa,_0x3f5c0d){var _0x40d611={'raw':![],'where':{}};var _0x2514fa={};var _0x42d495={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x369bfa[_0xf54e('0xbb')]['id']}})[_0xf54e('0x16')](handleEntityNotFound(_0x3f5c0d,null))[_0xf54e('0x16')](function(_0x3e8afe){if(_0x3e8afe){_0x2514fa[_0xf54e('0x48')]=_['keys'](db[_0xf54e('0xe6')]['rawAttributes']);_0x2514fa['query']=_[_0xf54e('0x4a')](_0x369bfa[_0xf54e('0x49')]);_0x2514fa[_0xf54e('0x54')]=_[_0xf54e('0x4b')](_0x2514fa[_0xf54e('0x48')],_0x2514fa[_0xf54e('0x49')]);_0x40d611[_0xf54e('0x4c')]=_['intersection'](_0x2514fa[_0xf54e('0x48')],qs[_0xf54e('0x4d')](_0x369bfa[_0xf54e('0x49')][_0xf54e('0x4d')]));_0x40d611[_0xf54e('0x4c')]=_0x40d611['attributes'][_0xf54e('0x4e')]?_0x40d611[_0xf54e('0x4c')]:_0x2514fa[_0xf54e('0x48')];if(!_0x369bfa[_0xf54e('0x49')][_0xf54e('0x4f')]('nolimit')){_0x40d611['limit']=qs[_0xf54e('0x25')](_0x369bfa[_0xf54e('0x49')][_0xf54e('0x25')]);_0x40d611['offset']=qs[_0xf54e('0x23')](_0x369bfa[_0xf54e('0x49')][_0xf54e('0x23')]);}_0x40d611[_0xf54e('0x51')]=qs['sort'](_0x369bfa[_0xf54e('0x49')][_0xf54e('0x52')]);_0x40d611[_0xf54e('0x53')]=qs['filters'](_[_0xf54e('0x55')](_0x369bfa[_0xf54e('0x49')],_0x2514fa[_0xf54e('0x54')]));_0x40d611[_0xf54e('0x53')][_0xf54e('0xb6')]=_0x3e8afe['id'];if(_0x369bfa[_0xf54e('0x49')][_0xf54e('0x8d')]){_0x40d611[_0xf54e('0x53')]=_['merge'](_0x40d611[_0xf54e('0x53')],{'$or':_[_0xf54e('0x35')](_0x40d611[_0xf54e('0x4c')],function(_0x384519){var _0x5ceeda={};_0x5ceeda[_0x384519]={'$like':'%'+_0x369bfa['query']['filter']+'%'};return _0x5ceeda;})});}if(_0x369bfa['query'][_0xf54e('0x84')]){var _0x3ff3cc=_0x369bfa[_0xf54e('0x49')]['$gte']['split'](',');var _0xd82fad={};_0xd82fad[_0x3ff3cc[0x0]]={'$gte':moment(_0x3ff3cc[0x1])['format'](_0xf54e('0xff'))};_0x40d611['where']=_[_0xf54e('0x30')](_0x40d611[_0xf54e('0x53')],_0xd82fad);}_0x40d611=_[_0xf54e('0x30')]({},_0x40d611,_0x369bfa['options']);return db[_0xf54e('0xe6')][_0xf54e('0x26')]({'where':_0x40d611[_0xf54e('0x53')]})[_0xf54e('0x16')](function(_0x4d0e0c){_0x42d495[_0xf54e('0x26')]=_0x4d0e0c;if(_0x369bfa[_0xf54e('0x49')][_0xf54e('0x100')]){_0x40d611[_0xf54e('0x101')]=[{'all':!![]}];}return db[_0xf54e('0xe6')][_0xf54e('0x102')](_0x40d611);})['then'](function(_0x31e4c1){_0x42d495['rows']=_0x31e4c1;return _0x42d495;});}})['then'](respondWithFilteredResult(_0x3f5c0d,_0x40d611))[_0xf54e('0x20')](handleError(_0x3f5c0d,null));};exports['getMyMessages']=function(_0x36e321,_0x2775b3){var _0x56411c={'where':{}},_0x53b6a7={},_0x32fa55={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf54e('0xbe')]({'where':{'id':_0x36e321[_0xf54e('0xbb')]['id']}})['then'](handleEntityNotFound(_0x2775b3,null))[_0xf54e('0x16')](function(_0x4ec7ed){if(_0x4ec7ed){_0x53b6a7[_0xf54e('0x48')]=_[_0xf54e('0x4a')](db['ChatMessage'][_0xf54e('0x45')]);_0x53b6a7[_0xf54e('0x49')]=_[_0xf54e('0x4a')](_0x36e321[_0xf54e('0x49')]);_0x53b6a7[_0xf54e('0x54')]=_[_0xf54e('0x4b')](_0x53b6a7[_0xf54e('0x48')],_0x53b6a7[_0xf54e('0x49')]);_0x56411c[_0xf54e('0x4c')]=_['intersection'](_0x53b6a7['model'],qs[_0xf54e('0x4d')](_0x36e321[_0xf54e('0x49')][_0xf54e('0x4d')]));_0x56411c[_0xf54e('0x4c')]=_0x56411c['attributes'][_0xf54e('0x4e')]?_0x56411c[_0xf54e('0x4c')]:_0x53b6a7['model'];if(!_0x36e321[_0xf54e('0x49')][_0xf54e('0x4f')](_0xf54e('0x50'))){_0x56411c[_0xf54e('0x25')]=qs[_0xf54e('0x25')](_0x36e321[_0xf54e('0x49')][_0xf54e('0x25')]);_0x56411c[_0xf54e('0x23')]=qs[_0xf54e('0x23')](_0x36e321[_0xf54e('0x49')][_0xf54e('0x23')]);}_0x56411c['order']=qs['sort'](_0x36e321[_0xf54e('0x49')][_0xf54e('0x52')]);_0x56411c[_0xf54e('0x53')]=qs[_0xf54e('0x54')](_[_0xf54e('0x55')](_0x36e321[_0xf54e('0x49')],_0x53b6a7['filters']));_0x56411c[_0xf54e('0x53')][_0xf54e('0xb6')]=_0x4ec7ed['id'];if(_0x36e321['query'][_0xf54e('0x8d')]){_0x56411c[_0xf54e('0x53')]=_[_0xf54e('0x30')](_0x56411c[_0xf54e('0x53')],{'$or':_['map'](_0x56411c['attributes'],function(_0x19a77b){var _0x23d25a={};_0x23d25a[_0x19a77b]={'$like':'%'+_0x36e321[_0xf54e('0x49')][_0xf54e('0x8d')]+'%'};return _0x23d25a;})});}_0x56411c['where']['secret']=![];if(_0x36e321[_0xf54e('0x49')]['id']){_0x56411c[_0xf54e('0x53')]['id']={'$gt':_0x36e321[_0xf54e('0x49')]['id']};}_0x56411c=_['merge']({},_0x56411c,_0x36e321[_0xf54e('0xb9')]);return db[_0xf54e('0xe6')][_0xf54e('0x26')]({'where':_0x56411c[_0xf54e('0x53')]})['then'](function(_0x2d172b){_0x32fa55['count']=_0x2d172b;_0x56411c[_0xf54e('0x101')]=[];if(_0x36e321[_0xf54e('0x49')][_0xf54e('0x103')]){_0x56411c[_0xf54e('0x101')]['push']({'model':db[_0xf54e('0x7a')],'as':_0xf54e('0x7a'),'attributes':['id',_0xf54e('0x36'),'alias']});}if(_0x36e321[_0xf54e('0x49')][_0xf54e('0x100')]){_0x56411c[_0xf54e('0x101')]=[{'all':!![]}];}return db['ChatMessage'][_0xf54e('0x102')](_0x56411c);})[_0xf54e('0x16')](function(_0x30358d){_0x32fa55[_0xf54e('0xb8')]=_0x30358d;return _0x32fa55;});}})[_0xf54e('0x16')](respondWithFilteredResult(_0x2775b3,_0x56411c))[_0xf54e('0x20')](handleError(_0x2775b3,null));};exports[_0xf54e('0x104')]=function(_0x13dd5a,_0x16d313){return db[_0xf54e('0x44')][_0xf54e('0x6a')]({'where':{'id':_0x13dd5a[_0xf54e('0xbb')]['id']}})[_0xf54e('0x16')](handleEntityNotFound(_0x16d313,null))[_0xf54e('0x16')](function(_0xaaf1ba){if(_0xaaf1ba){return _0xaaf1ba[_0xf54e('0x105')](_0x13dd5a[_0xf54e('0x31')][_0xf54e('0xfd')],_['omit'](_0x13dd5a[_0xf54e('0x31')],[_0xf54e('0xfd'),'id'])||{})[_0xf54e('0x106')](function(){return db[_0xf54e('0x107')][_0xf54e('0x102')]({'attributes':['id',_0xf54e('0x2e'),_0xf54e('0x108')],'where':{'id':_0x13dd5a[_0xf54e('0x31')][_0xf54e('0xfd')]}});})[_0xf54e('0x16')](function(_0x354f69){socket[_0xf54e('0x109')](_0xf54e('0x10a'),{'id':Number(_0x13dd5a[_0xf54e('0xbb')]['id']),'tags':_0x354f69||[]});return{'id':Number(_0x13dd5a[_0xf54e('0xbb')]['id']),'tags':_0x354f69||[]};});}})[_0xf54e('0x16')](respondWithResult(_0x16d313,null))['catch'](handleError(_0x16d313,null));};exports[_0xf54e('0x10b')]=function(_0x28a3f8,_0x1ea814){return db[_0xf54e('0x44')]['find']({'where':{'id':_0x28a3f8[_0xf54e('0xbb')]['id']}})[_0xf54e('0x16')](handleEntityNotFound(_0x1ea814,null))['then'](function(_0xbd64cf){if(_0xbd64cf){return _0xbd64cf[_0xf54e('0x10b')](_0x28a3f8[_0xf54e('0x49')][_0xf54e('0xfd')]);}})[_0xf54e('0x16')](respondWithStatusCode(_0x1ea814,null))[_0xf54e('0x20')](handleError(_0x1ea814,null));};exports[_0xf54e('0xe0')]=function(_0x22f8ad,_0x269670){var _0x17801c=moment()['unix']()[_0xf54e('0x9f')]();var _0x6af5dd=path[_0xf54e('0xdf')](config[_0xf54e('0x10c')],_0xf54e('0x10d'),_0xf54e('0x10e'),_0xf54e('0x10f'));var _0x57f2c8=path[_0xf54e('0xdf')](config[_0xf54e('0x10c')],_0xf54e('0x10d'),_0xf54e('0x10e'),_0xf54e('0x110'));var _0x2932f0=path[_0xf54e('0xdf')](_0x6af5dd,_0x17801c);var _0x3ba5e0=util[_0xf54e('0xe4')](_0xf54e('0x111'),_0x22f8ad['params']['id'],_0x17801c);var _0xb1e536=path[_0xf54e('0xdf')](_0x6af5dd,_0x3ba5e0);var _0x57ae4e=[];_0x57ae4e['push']({'model':db[_0xf54e('0x7a')],'as':_0xf54e('0x7a'),'attributes':['id',_0xf54e('0x36')],'raw':!![]});_0x57ae4e[_0xf54e('0x39')]({'model':db[_0xf54e('0xd3')],'as':_0xf54e('0x6f'),'attributes':['id',_0xf54e('0x112'),_0xf54e('0x113')],'raw':!![]});if(_0x22f8ad[_0xf54e('0x49')][_0xf54e('0x110')]){_0x57ae4e['push']({'model':db[_0xf54e('0xdb')],'as':_0xf54e('0xdb'),'raw':!![]});}var _0x596efb=[{'model':db['ChatMessage'],'as':_0xf54e('0xe7'),'attributes':['id',_0xf54e('0x31'),'createdAt',_0xf54e('0xf1'),_0xf54e('0xf2'),_0xf54e('0x88')],'include':_0x57ae4e}];_0x596efb['push']({'model':db['ChatWebsite'],'as':_0xf54e('0x114'),'attributes':['id','name']});_0x596efb[_0xf54e('0x39')]({'model':db[_0xf54e('0x7a')],'as':_0xf54e('0x115'),'attributes':['id',_0xf54e('0x36')]});return db[_0xf54e('0x44')]['find']({'where':{'id':_0x22f8ad['params']['id']},'include':_0x596efb})[_0xf54e('0x16')](handleEntityNotFound(_0x269670,null))[_0xf54e('0x16')](function(_0x497414){if(_0x497414){var _0x127b6c=_0x497414[_0xf54e('0x116')]({'plain':!![]});fs[_0xf54e('0x117')](_0x2932f0);var _0x1dd5fd={'channel':_0xf54e('0x118'),'account':_0x127b6c['Account']['name'],'agent':_0x127b6c[_0xf54e('0x115')]?_0x127b6c[_0xf54e('0x115')][_0xf54e('0x36')]:_0xf54e('0x119'),'createdAt':moment(_0x127b6c[_0xf54e('0x82')])['format'](_0xf54e('0xff'))[_0xf54e('0x9f')](),'closedAt':_0x127b6c[_0xf54e('0x3d')]?moment(_0x127b6c['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x127b6c['disposition'],'chatInfo':{'browser':_0x127b6c['browserName'],'os':_0x127b6c[_0xf54e('0x11a')],'referer':_0x127b6c[_0xf54e('0x11b')],'customerIp':_0x127b6c['customerIp'],'customerPort':_0x127b6c[_0xf54e('0x11c')]?_0x127b6c[_0xf54e('0x11c')]:_0xf54e('0x119')},'messages':_(_0x127b6c[_0xf54e('0xe7')])[_0xf54e('0x11d')]()[_0xf54e('0x8d')]({'secret':![]})[_0xf54e('0x35')](function(_0x53e6e6){if(_0x53e6e6['Attachment']){var _0x4d79d6=path[_0xf54e('0xdf')](_0x57f2c8,_0x53e6e6[_0xf54e('0xdb')]['basename']);if(fs[_0xf54e('0x11e')](_0x4d79d6)){fs[_0xf54e('0x11f')](_0x4d79d6)[_0xf54e('0x120')](fs['createWriteStream'](path[_0xf54e('0xdf')](_0x2932f0,_0x53e6e6[_0xf54e('0xdb')][_0xf54e('0xd9')])));}}return{'date':moment(_0x53e6e6['createdAt'])[_0xf54e('0xe4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf54e('0x9f')](),'sender':_0x53e6e6[_0xf54e('0xf1')]===_0xf54e('0xd0')?_0x53e6e6[_0xf54e('0x7a')]?_0x53e6e6[_0xf54e('0x7a')]['fullname']:_0xf54e('0xea'):_0x53e6e6[_0xf54e('0x6f')][_0xf54e('0x112')]+(_0x53e6e6[_0xf54e('0x6f')][_0xf54e('0x113')]?'\x20'+_0x53e6e6[_0xf54e('0x6f')]['lastName']:''),'body':_0x53e6e6[_0xf54e('0xdb')]?_0x53e6e6[_0xf54e('0xdb')][_0xf54e('0xd9')]:_0x53e6e6[_0xf54e('0x31')],'direction':_0x53e6e6[_0xf54e('0xf1')]===_0xf54e('0xd0')?'A':'C','secret':_0x53e6e6[_0xf54e('0xf2')],'read':_0x53e6e6[_0xf54e('0x88')],'attachment':_0x53e6e6['Attachment']};})[_0xf54e('0x6c')]()};return ejs[_0xf54e('0x121')](path[_0xf54e('0xdf')](config[_0xf54e('0x10c')],_0xf54e('0x10d'),_0xf54e('0x122'),_0xf54e('0x123')),{'interaction':_0x1dd5fd})[_0xf54e('0x16')](function(_0x2ea0bf){var _0x3fd7db=path[_0xf54e('0xdf')](_0x2932f0,_0xf54e('0x124')+_0x127b6c['id']+'-'+_0x17801c+_0xf54e('0x125'));var _0x13305c={'path':_0x3fd7db,'channel':_0xf54e('0x118'),'interactionId':_0x127b6c['id']};return pdf[_0xf54e('0x126')](_0x2ea0bf,_0x13305c);})[_0xf54e('0x16')](function(){return new Promise(function(_0x5ee371,_0x2310f0){zipdir(_0x2932f0,{'saveTo':_0xb1e536},function(_0x28df44,_0xc4b0a0){if(_0x28df44)return _0x2310f0(_0x28df44);return _0x5ee371(_0xc4b0a0);});})[_0xf54e('0x16')](function(){return new BPromise(function(_0x1eb3c7,_0x12663d){rimraf(_0x2932f0,function(_0x3c4862){if(_0x3c4862)_0x12663d(_0x3c4862);return _0x1eb3c7();});});})[_0xf54e('0x16')](function(){return _0x269670[_0xf54e('0xe0')](_0xb1e536,_0x3ba5e0,function(_0x3e4955){if(_0x3e4955){logger['error'](_0xf54e('0x127'),_0x3e4955);}else{fs[_0xf54e('0x128')](_0xb1e536);}});});});}else{return _0x269670['sendStatus'](0xc8);}})[_0xf54e('0x20')](handleError(_0x269670,null));}; \ No newline at end of file +var _0xedd9=['account','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','abandoned','closed','UserId','disposition','unmanaged','total','index','ChatInteraction','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.fullname','ui.ChatInteractionId','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','user','role','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','show','params','includeAll','include','options','create','createVidaooSession','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','Attachment','Unauthorized','attachId','root','server/files/attachments/','offline-chat/','join','download','close','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','includeAgent','alias','setTags','spread','findAll','removeTags','unix','server','tmp','files','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','direction','Owner','get','Chat','Account','N.A.','closedAt','browserName','osName','referer','customerPort','tail','basename','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','result','message','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','name','send','render','merge','body','contact','agent','interaction'];(function(_0x46fbde,_0x25cedf){var _0x2f8b74=function(_0x5e20d4){while(--_0x5e20d4){_0x46fbde['push'](_0x46fbde['shift']());}};_0x2f8b74(++_0x25cedf);}(_0xedd9,0xfc));var _0x9edd=function(_0x2c9e70,_0x410345){_0x2c9e70=_0x2c9e70-0x0;var _0x25ece3=_0xedd9[_0x2c9e70];return _0x25ece3;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9edd('0x0'));var rp=require(_0x9edd('0x1'));var moment=require(_0x9edd('0x2'));var BPromise=require(_0x9edd('0x3'));var Mustache=require(_0x9edd('0x4'));var util=require(_0x9edd('0x5'));var path=require(_0x9edd('0x6'));var ejs=require(_0x9edd('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0x8'));var Redis=require(_0x9edd('0x9'));var qs=require(_0x9edd('0xa'));var as=require(_0x9edd('0xb'));var pdf=require('../../components/export/pdf');var logger=require(_0x9edd('0xc'))('api');var config=require(_0x9edd('0xd'));var db=require(_0x9edd('0xe'))['db'];config[_0x9edd('0xf')]=_[_0x9edd('0x10')](config['redis'],{'host':_0x9edd('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9edd('0xf')]));require(_0x9edd('0x12'))['register'](socket);var jayson=require(_0x9edd('0x13'));var client=jayson[_0x9edd('0x14')]['http']({'port':0x232b});var client9004=jayson[_0x9edd('0x14')][_0x9edd('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x25e64c,_0xfd544a,_0x287ddd,_0x3a7b84){return new BPromise(function(_0xfca576,_0xef5498){var _0x47eb64=_0x3a7b84||client;return _0x47eb64[_0x9edd('0x16')](_0x25e64c,_0x287ddd)[_0x9edd('0x17')](function(_0x891832){logger[_0x9edd('0x18')](_0x9edd('0x19'),_0xfd544a,_0x9edd('0x1a'));logger[_0x9edd('0x1b')](_0x9edd('0x1c'),_0xfd544a,'request\x20sent',JSON[_0x9edd('0x1d')](_0x891832));if(_0x891832[_0x9edd('0x1e')]){if(_0x891832[_0x9edd('0x1e')]['code']===0x1f4){logger[_0x9edd('0x1e')](_0x9edd('0x19'),_0xfd544a,_0x891832[_0x9edd('0x1e')]['message']);return _0xef5498(_0x891832[_0x9edd('0x1e')]['message']);}logger[_0x9edd('0x1e')](_0x9edd('0x19'),_0xfd544a,_0x891832['error']['message']);return _0xfca576(_0x891832[_0x9edd('0x1e')]['message']);}else{logger[_0x9edd('0x18')]('ChatInteraction,\x20%s,\x20%s',_0xfd544a,'request\x20sent');_0xfca576(_0x891832[_0x9edd('0x1f')][_0x9edd('0x20')]);}})['catch'](function(_0x5823bc){logger[_0x9edd('0x1e')](_0x9edd('0x19'),_0xfd544a,_0x5823bc);_0xef5498(_0x5823bc);});});}function respondWithStatusCode(_0x477878,_0x542172){_0x542172=_0x542172||0xcc;return function(_0x3741c8){if(_0x3741c8){return _0x477878[_0x9edd('0x21')](_0x542172);}return _0x477878[_0x9edd('0x22')](_0x542172)[_0x9edd('0x23')]();};}function respondWithResult(_0x339a0d,_0x4c75d2){_0x4c75d2=_0x4c75d2||0xc8;return function(_0x46c383){if(_0x46c383){return _0x339a0d[_0x9edd('0x22')](_0x4c75d2)[_0x9edd('0x24')](_0x46c383);}};}function respondWithFilteredResult(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(_0x4d507f){var _0x4b3d1b=typeof _0x310a4d[_0x9edd('0x25')]===_0x9edd('0x26')&&typeof _0x310a4d[_0x9edd('0x27')]===_0x9edd('0x26');var _0x3c2227=_0x4d507f['count'];var _0x57a2cc=_0x4b3d1b?0x0:_0x310a4d[_0x9edd('0x25')];var _0x257a26=_0x4b3d1b?_0x4d507f[_0x9edd('0x28')]:_0x310a4d['offset']+_0x310a4d[_0x9edd('0x27')];var _0x28cfae;if(_0x257a26>=_0x3c2227){_0x257a26=_0x3c2227;_0x28cfae=0xc8;}else{_0x28cfae=0xce;}_0x2f9f86[_0x9edd('0x22')](_0x28cfae);return _0x2f9f86[_0x9edd('0x29')]('Content-Range',_0x57a2cc+'-'+_0x257a26+'/'+_0x3c2227)[_0x9edd('0x24')](_0x4d507f);}return null;};}function saveUpdates(_0x3fb556){return function(_0xbe87e1){if(_0xbe87e1){return _0xbe87e1[_0x9edd('0x2a')](_0x3fb556)[_0x9edd('0x17')](function(_0x42e664){return _0x42e664;});}return null;};}function removeEntity(_0x209aba){return function(_0x1fba7b){if(_0x1fba7b){return _0x1fba7b[_0x9edd('0x2b')]()[_0x9edd('0x17')](function(){_0x209aba[_0x9edd('0x22')](0xcc)[_0x9edd('0x23')]();});}};}function handleEntityNotFound(_0x6907a5){return function(_0xa55906){if(!_0xa55906){_0x6907a5[_0x9edd('0x21')](0x194);}return _0xa55906;};}function handleError(_0x5af178,_0x1453d2){_0x1453d2=_0x1453d2||0x1f4;return function(_0x259259){logger[_0x9edd('0x1e')](_0x259259['stack']);if(_0x259259[_0x9edd('0x2c')]){delete _0x259259[_0x9edd('0x2c')];}_0x5af178[_0x9edd('0x22')](_0x1453d2)[_0x9edd('0x2d')](_0x259259);};}function getMustacheRender(_0x21bc30,_0x2bc4ed){return Mustache[_0x9edd('0x2e')](_0x21bc30,_[_0x9edd('0x2f')](_0x2bc4ed[_0x9edd('0x30')],{'contact':_0x2bc4ed[_0x9edd('0x31')],'message':_0x2bc4ed[_0x9edd('0x20')],'agent':_0x2bc4ed[_0x9edd('0x32')],'interaction':_0x2bc4ed[_0x9edd('0x33')],'account':_0x2bc4ed[_0x9edd('0x34')]}))||'';}function getInteractionUsers(_0x5757fc,_0x37fcb2){return new BPromise(function(_0x5ed62d,_0x968303){try{if(_0x37fcb2[_0x5757fc['id']]){_0x5757fc[_0x9edd('0x35')]=_[_0x9edd('0x36')](_0x37fcb2[_0x5757fc['id']],function(_0x434d26){return{'id':_0x434d26['id'],'fullname':_0x434d26[_0x9edd('0x37')]};});}}catch(_0x4fa5ab){_0x968303(_0x4fa5ab);}_0x5ed62d(_0x5757fc);});}function getInteractionTags(_0x6de835,_0x44dbfc){return new BPromise(function(_0x2b3469,_0x38e9be){try{if(_0x6de835[_0x9edd('0x38')]){_0x6de835[_0x9edd('0x39')]=[];_0x6de835[_0x9edd('0x38')][_0x9edd('0x3a')](',')[_0x9edd('0x3b')](function(_0x35c16f){_0x6de835['Tags'][_0x9edd('0x3c')](_0x44dbfc[_0x35c16f]);});}delete _0x6de835['TagIds'];}catch(_0x3ef1d5){_0x38e9be(_0x3ef1d5);}_0x2b3469(_0x6de835);});}function updateChatInteraction(_0x5658d6,_0x30883e,_0x2858b5){return new BPromise(function(_0x34e9d2,_0x479661){return getInteractionUsers(_0x5658d6,_0x2858b5)[_0x9edd('0x17')](function(_0xcbd0ef){return getInteractionTags(_0xcbd0ef,_0x30883e);})[_0x9edd('0x17')](function(_0x48958a){return getStateInteraction(_0x48958a);})[_0x9edd('0x17')](function(_0x51ad91){_0x34e9d2(_0x51ad91);})[_0x9edd('0x3d')](function(_0xfbc492){_0x479661(_0xfbc492);});});}function getStateInteraction(_0x50be2c){return new BPromise(function(_0x315f52){_0x50be2c[_0x9edd('0x3e')]=0x0;_0x50be2c[_0x9edd('0x3f')]=0x0;_0x50be2c[_0x9edd('0x40')]=0x0;_0x50be2c['unmanaged']=0x0;_0x50be2c[_0x9edd('0x41')]=0x0;_0x50be2c['total']=0x0;if(!_0x50be2c[_0x9edd('0x42')]&&!_0x50be2c[_0x9edd('0x43')]){_0x50be2c['waiting']+=0x1;}if(!_0x50be2c[_0x9edd('0x42')]&&_0x50be2c['UserId']){_0x50be2c['talking']+=0x1;if(_0x50be2c[_0x9edd('0x3e')]){_0x50be2c[_0x9edd('0x3e')]-=0x1;}}if(_0x50be2c[_0x9edd('0x42')]&&_0x50be2c[_0x9edd('0x44')]===_0x9edd('0x41')){_0x50be2c[_0x9edd('0x41')]+=0x1;if(_0x50be2c[_0x9edd('0x3e')]){_0x50be2c[_0x9edd('0x3e')]-=0x1;}}else if(_0x50be2c[_0x9edd('0x42')]&&!_0x50be2c[_0x9edd('0x43')]&&_0x50be2c[_0x9edd('0x44')]){_0x50be2c[_0x9edd('0x45')]+=0x1;if(_0x50be2c[_0x9edd('0x3e')]){_0x50be2c[_0x9edd('0x3e')]-=0x1;}}else if(_0x50be2c[_0x9edd('0x42')]&&_0x50be2c['UserId']){_0x50be2c[_0x9edd('0x40')]+=0x1;if(_0x50be2c[_0x9edd('0x3f')]){_0x50be2c[_0x9edd('0x3f')]-=0x1;}}_0x50be2c[_0x9edd('0x46')]+=0x1;_0x315f52(_0x50be2c);});}exports[_0x9edd('0x47')]=function(_0x3ecdfd,_0x10d41e){var _0x4e9ad1={},_0x4a4656={},_0x4bc7a1={'count':0x0,'rows':[]};var _0x4a7dc9=_['map'](db[_0x9edd('0x48')][_0x9edd('0x49')],function(_0x2b06d3){return{'name':_0x2b06d3[_0x9edd('0x4a')],'type':_0x2b06d3[_0x9edd('0x4b')]['key']};});_0x4a4656[_0x9edd('0x4c')]=_[_0x9edd('0x36')](_0x4a7dc9,_0x9edd('0x2c'));_0x4a4656['query']=_[_0x9edd('0x4d')](_0x3ecdfd[_0x9edd('0x4e')]);_0x4a4656[_0x9edd('0x4f')]=_[_0x9edd('0x50')](_0x4a4656[_0x9edd('0x4c')],_0x4a4656[_0x9edd('0x4e')]);_0x4e9ad1['attributes']=_[_0x9edd('0x50')](_0x4a4656[_0x9edd('0x4c')],qs['fields'](_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x51')]));_0x4e9ad1['attributes']=_0x4e9ad1[_0x9edd('0x52')][_0x9edd('0x53')]?_0x4e9ad1[_0x9edd('0x52')]:_0x4a4656['model'];if(!_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x54')](_0x9edd('0x55'))){_0x4e9ad1[_0x9edd('0x27')]=qs['limit'](_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x27')]);_0x4e9ad1[_0x9edd('0x25')]=qs['offset'](_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x25')]);}_0x4e9ad1['order']=qs[_0x9edd('0x56')](_0x3ecdfd['query'][_0x9edd('0x56')]);_0x4e9ad1[_0x9edd('0x57')]=qs[_0x9edd('0x4f')](_[_0x9edd('0x58')](_0x3ecdfd[_0x9edd('0x4e')],_0x4a4656[_0x9edd('0x4f')]),_0x4a7dc9);var _0x2334d4=[];var _0x14dd27=squel[_0x9edd('0x59')]()[_0x9edd('0x5a')]('id')[_0x9edd('0x5a')]('name')[_0x9edd('0x5a')](_0x9edd('0x5b'))[_0x9edd('0x5c')]('tools_tags');var _0xe96d6a=squel['select']()['field']('u.id')[_0x9edd('0x5a')](_0x9edd('0x5d'))[_0x9edd('0x5a')](_0x9edd('0x5e'))['from']('user_has_chat_interactions','ui')['left_join'](_0x9edd('0x5f'),'u',_0x9edd('0x60'));var _0xd5090a=squel[_0x9edd('0x59')]()[_0x9edd('0x5c')](_0x9edd('0x61'),'i')[_0x9edd('0x62')](_0x9edd('0x63'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9edd('0x62')]('users','o',_0x9edd('0x64'))[_0x9edd('0x62')]('chat_websites','a',_0x9edd('0x65'))[_0x9edd('0x62')](_0x9edd('0x66'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x9edd('0x62')](_0x9edd('0x67'),'it',_0x9edd('0x68'))[_0x9edd('0x62')](_0x9edd('0x69'),'t',_0x9edd('0x6a'));var _0x53f55b=squel['expr']();var _0x452ca5=[];var _0x54f96c=squel[_0x9edd('0x6b')]();var _0x3e9a3e;if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x6c')]){_0x3e9a3e=as['parseSearch'](_0x3ecdfd[_0x9edd('0x4e')]['search']);var _0x3e5dca=_0x3e9a3e[_0x9edd('0x6d')];for(var _0xc6bde6=0x0;_0xc6bde6<_0x3e9a3e['conditions'][_0x9edd('0x53')];_0xc6bde6++){var _0x57da5b=_0x3e9a3e[_0x9edd('0x6e')][_0xc6bde6];var _0x4e1eda='i';var _0x4915a9=_[_0x9edd('0x6f')](_0x4a7dc9,['name',_0x57da5b[_0x9edd('0x5a')]]);if(!_0x4915a9){switch(_0x57da5b[_0x9edd('0x5a')]){case _0x9edd('0x70'):if(_0x57da5b['value']==0x1){_0xd5090a[_0x9edd('0x71')]('`'+_0x57da5b[_0x9edd('0x5a')]+_0x9edd('0x72'));}else{_0xd5090a[_0x9edd('0x71')]('`'+_0x57da5b[_0x9edd('0x5a')]+'`\x20>\x200');}break;case'Contact':if(_0x57da5b[_0x9edd('0x73')]===_0x9edd('0x74')){if(_0x57da5b['value']['split']('\x20')['length']>0x1){_0x53f55b[_0x3e5dca](_0x9edd('0x75'),qs['getFullTextValue'](_0x57da5b['value']),null);}else{var _0x3ef9c9='%'+_0x57da5b[_0x9edd('0x76')]+'%';_0x53f55b[_0x3e5dca]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3ef9c9,_0x3ef9c9,_0x3ef9c9);}}else{_0x4915a9=_[_0x9edd('0x6f')](_0x4a7dc9,[_0x9edd('0x2c'),_0x9edd('0x77')]);_0x57da5b['field']=_0x9edd('0x77');_0x3801c4=as['buildExpression'](_0x4e1eda,_0x4915a9[_0x9edd('0x4b')],_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4[_0x9edd('0x78')],_0x3801c4['value'][_0x9edd('0x79')],_0x3801c4[_0x9edd('0x76')]['end']);}break;case _0x9edd('0x7a'):var _0x475dc3=_0x57da5b[_0x9edd('0x76')][_0x9edd('0x3a')](',')['map'](function(_0x366b04){return Number(_0x366b04);});_0x475dc3['forEach'](function(_0x1a618c){_0x54f96c['or'](_0x9edd('0x7b'),'%,'+_0x1a618c+',%');});_0x452ca5=_[_0x9edd('0x7c')](_0x452ca5,_0x475dc3);break;case'User':if(_0x57da5b[_0x9edd('0x73')]===_0x9edd('0x74')){_0x53f55b[_0x3e5dca](_0x9edd('0x7d'),'%'+_0x57da5b[_0x9edd('0x76')]+'%',null);}else{_0x4915a9=_[_0x9edd('0x6f')](_0x4a7dc9,[_0x9edd('0x2c'),_0x9edd('0x43')]);_0x57da5b['field']='UserId';_0x3801c4=as[_0x9edd('0x7e')](_0x4e1eda,_0x4915a9[_0x9edd('0x4b')],_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4[_0x9edd('0x78')],_0x3801c4[_0x9edd('0x76')][_0x9edd('0x79')],_0x3801c4['value'][_0x9edd('0x23')]);}break;case _0x9edd('0x30'):_0x3801c4=as[_0x9edd('0x7e')]('me',null,_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4['text'],_0x3801c4[_0x9edd('0x76')][_0x9edd('0x79')],_0x3801c4['value'][_0x9edd('0x23')]);break;}}else{var _0x3801c4=as['buildExpression'](_0x4e1eda,_0x4915a9[_0x9edd('0x4b')],_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4[_0x9edd('0x78')],_0x3801c4['value'][_0x9edd('0x79')],_0x3801c4['value']['end']);}}}else{var _0x45c9ef=_(_0x3ecdfd[_0x9edd('0x4e')])[_0x9edd('0x4d')]()['map'](function(_0x3c7df3){return _[_0x9edd('0x7f')](_0x4a7dc9,['name',_0x3c7df3])?_0x3c7df3:undefined;})[_0x9edd('0x80')]()[_0x9edd('0x76')]();if(!_[_0x9edd('0x81')](_0x45c9ef)){_0x45c9ef[_0x9edd('0x3b')](function(_0x54ac71){if(_0x54ac71==='ChatWebsiteId'){_0xd5090a[_0x9edd('0x57')]('i.ChatWebsiteId\x20IN\x20?',[][_0x9edd('0x82')](_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71]));}else if(_0x54ac71===_0x9edd('0x83')){var _0x3cfd35=JSON[_0x9edd('0x84')](_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71])[_0x9edd('0x85')];var _0x5a4d4b=JSON[_0x9edd('0x84')](_0x3ecdfd['query'][_0x54ac71])[_0x9edd('0x86')];_0xd5090a[_0x9edd('0x57')](_0x9edd('0x87'),_0x3cfd35,_0x5a4d4b);}else{if(_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71]===_0x9edd('0x88')){_0xd5090a[_0x9edd('0x57')]('i.'+_0x54ac71+_0x9edd('0x89'));}else{_0xd5090a['where']('i.'+_0x54ac71+_0x9edd('0x8a'),_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71]);}}});}if(_0x3ecdfd['query'][_0x9edd('0x8b')]){if(_0x3ecdfd[_0x9edd('0x4e')]['read']==0x1){_0xd5090a[_0x9edd('0x71')](_0x9edd('0x8c'));}else{_0xd5090a[_0x9edd('0x71')]('`unreadMessages`\x20>\x200');}}if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x8d')]){_0x452ca5=_[_0x9edd('0x8e')](_0x3ecdfd['query']['tag'])?_0x3ecdfd['query']['tag']:new Array(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x8d')]);_0x452ca5[_0x9edd('0x3b')](function(_0x521810){_0x54f96c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x521810+',%');});}if(_0x3ecdfd['query'][_0x9edd('0x8f')]){var _0x388252=_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x8f')][_0x9edd('0x90')]('\x5c','\x5c\x5c')[_0x9edd('0x90')](/'/g,'\x27\x27');if(qs[_0x9edd('0x91')](_0x388252)){_0x53f55b['or'](_0x9edd('0x92'),_0x388252+'%');}else{_0x53f55b['or'](_0x9edd('0x93'),qs[_0x9edd('0x94')](_0x388252))['or'](_0x9edd('0x95'),_0x388252+'%');}}}_0xd5090a[_0x9edd('0x57')](_0x53f55b);_0xd5090a['group'](_0x9edd('0x96'));var _0x29f3b2={'type':db[_0x9edd('0x97')][_0x9edd('0x98')][_0x9edd('0x99')],'raw':!![]};var _0x2d067b=_0xd5090a[_0x9edd('0x9a')]();_0x2d067b[_0x9edd('0x5a')]('i.id');_0x2d067b['field'](_0x9edd('0x9b'),'unreadMessages');if(_0x4e9ad1[_0x9edd('0x9c')]){_0x4e9ad1['order'][_0x9edd('0x3b')](function(_0x3f2452){var _0x554804=_0x3f2452[0x0]===_0x9edd('0x9d')?_0x3f2452[0x0]:'i.'+_0x3f2452[0x0];_0xd5090a[_0x9edd('0x9c')](_0x554804,_0x3f2452[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9edd('0x81')](_0x452ca5)){_0xd5090a[_0x9edd('0x71')](_0x54f96c);_0x2d067b[_0x9edd('0x57')](_0x9edd('0x9e'),_0x452ca5);}BPromise[_0x9edd('0x9f')]()['then'](function(){if(!_0x3e9a3e){if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0xa0')])return;_0x2d067b[_0x9edd('0x57')](_0x9edd('0xa1'));_0xd5090a[_0x9edd('0x57')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x3ecdfd['user']['role']!=='agent')return;return _0x3ecdfd['user'][_0x9edd('0xa2')]({'attributes':['id'],'raw':!![]})['then'](function(_0x58cb3f){if(_[_0x9edd('0x81')](_0x58cb3f)){_0x2d067b[_0x9edd('0x57')](_0x9edd('0xa3'));_0xd5090a[_0x9edd('0x57')](_0x9edd('0xa3'));}else{_0x2d067b[_0x9edd('0x57')](_0x9edd('0xa4'),_[_0x9edd('0x36')](_0x58cb3f,'id'));_0xd5090a[_0x9edd('0x57')](_0x9edd('0xa4'),_['map'](_0x58cb3f,'id'));}});})[_0x9edd('0x17')](function(){if(_0x3ecdfd[_0x9edd('0xa5')][_0x9edd('0xa6')]===_0x9edd('0x32')&&!_0x3e9a3e&&!_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0xa0')])return[];return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0x2d067b['toString'](),_0x29f3b2);})['then'](function(_0x401ad3){_0x4bc7a1[_0x9edd('0x28')]=_0x401ad3[_0x9edd('0x53')];if(_0x4bc7a1[_0x9edd('0x28')]===0x0)return[];return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0x14dd27[_0x9edd('0xa8')](),_0x29f3b2)[_0x9edd('0x17')](function(_0x93fef1){_0x2334d4=_[_0x9edd('0xa9')](_0x93fef1,'id');_0x29f3b2=_[_0x9edd('0x2f')](_0x29f3b2,{'model':db[_0x9edd('0x48')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x51')]){_0x4e9ad1['attributes'][_0x9edd('0x3b')](function(_0x34ee39){_0xd5090a['field']('i.'+_0x34ee39);});}else{_0xd5090a[_0x9edd('0x5a')](_0x9edd('0x9b'),_0x9edd('0x70'));_0xd5090a[_0x9edd('0x5a')]('a.key',_0x9edd('0xaa'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xab'),_0x9edd('0xac'));_0xd5090a[_0x9edd('0x5a')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x9edd('0x9d'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xad'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xae'),'Contact.firstName');_0xd5090a['field'](_0x9edd('0xaf'),'Contact.lastName');_0xd5090a[_0x9edd('0x5a')]('c.email',_0x9edd('0xb0'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb1'),_0x9edd('0xb2'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb3'),'Contact.mobile');_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb4'),_0x9edd('0xb5'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb6'),_0x9edd('0xb7'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb8'),'Owner.internal');_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb9'),_0x9edd('0x38'));}if(_0x4e9ad1[_0x9edd('0x27')])_0xd5090a[_0x9edd('0x27')](_0x4e9ad1[_0x9edd('0x27')]);if(_0x4e9ad1[_0x9edd('0x25')])_0xd5090a[_0x9edd('0x25')](_0x4e9ad1[_0x9edd('0x25')]);return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0xd5090a[_0x9edd('0xa8')](),_0x29f3b2);})[_0x9edd('0x17')](function(_0x315a4c){if(_0x315a4c[_0x9edd('0x53')]>0x0)_0xe96d6a[_0x9edd('0x57')](_0x9edd('0xba'),_[_0x9edd('0x36')](_0x315a4c,'id'));return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0xe96d6a[_0x9edd('0xa8')](),_0x29f3b2)['then'](function(_0xa704eb){var _0x553018=_['groupBy'](_0xa704eb,_0x9edd('0xbb'));var _0x108244=[];_0x315a4c[_0x9edd('0x3b')](function(_0x11b556){_0x108244[_0x9edd('0x3c')](updateChatInteraction(_0x11b556,_0x2334d4,_0x553018));});return BPromise[_0x9edd('0xbc')](_0x108244);});});})[_0x9edd('0x17')](function(_0x69925a){_0x4bc7a1[_0x9edd('0xbd')]=_0x69925a;return _0x4bc7a1;})[_0x9edd('0x17')](respondWithFilteredResult(_0x10d41e,_0x4e9ad1))['catch'](handleError(_0x10d41e,null));};exports[_0x9edd('0xbe')]=function(_0x3c2c2c,_0x48f1ae){var _0x568067={'raw':![],'where':{'id':_0x3c2c2c[_0x9edd('0xbf')]['id']}},_0x176427={};_0x176427[_0x9edd('0x4c')]=_[_0x9edd('0x4d')](db['ChatInteraction']['rawAttributes']);_0x176427[_0x9edd('0x4e')]=_['keys'](_0x3c2c2c[_0x9edd('0x4e')]);_0x176427[_0x9edd('0x4f')]=_[_0x9edd('0x50')](_0x176427['model'],_0x176427['query']);_0x568067['attributes']=_[_0x9edd('0x50')](_0x176427[_0x9edd('0x4c')],qs[_0x9edd('0x51')](_0x3c2c2c['query'][_0x9edd('0x51')]));_0x568067[_0x9edd('0x52')]=_0x568067['attributes'][_0x9edd('0x53')]?_0x568067[_0x9edd('0x52')]:_0x176427['model'];if(_0x3c2c2c['query'][_0x9edd('0xc0')]){_0x568067[_0x9edd('0xc1')]=[{'all':!![]}];}_0x568067=_['merge']({},_0x568067,_0x3c2c2c[_0x9edd('0xc2')]);return db[_0x9edd('0x48')]['find'](_0x568067)[_0x9edd('0x17')](handleEntityNotFound(_0x48f1ae,null))['then'](respondWithResult(_0x48f1ae,null))[_0x9edd('0x3d')](handleError(_0x48f1ae,null));};exports[_0x9edd('0xc3')]=function(_0x23eb54,_0x742e13){return db[_0x9edd('0x48')][_0x9edd('0xc3')](_0x23eb54['body'],{})[_0x9edd('0x17')](respondWithResult(_0x742e13,0xc9))[_0x9edd('0x3d')](handleError(_0x742e13,null));};exports[_0x9edd('0x2a')]=function(_0x511ea1,_0x956219){if(_0x511ea1['body']['id']){delete _0x511ea1[_0x9edd('0x30')]['id'];}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x511ea1[_0x9edd('0xbf')]['id']}})['then'](handleEntityNotFound(_0x956219,null))['then'](saveUpdates(_0x511ea1['body'],null))[_0x9edd('0x17')](respondWithResult(_0x956219,null))[_0x9edd('0x3d')](handleError(_0x956219,null));};exports[_0x9edd('0x2b')]=function(_0x50af78,_0x41a761){return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x50af78[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](handleEntityNotFound(_0x41a761,null))[_0x9edd('0x17')](removeEntity(_0x41a761,null))['catch'](handleError(_0x41a761,null));};exports['describe']=function(_0x12ceb1,_0x47676c){return db[_0x9edd('0x48')]['describe']()[_0x9edd('0x17')](respondWithResult(_0x47676c,null))[_0x9edd('0x3d')](handleError(_0x47676c,null));};exports[_0x9edd('0xc4')]=function(_0x454cce,_0x524217){var _0x2122de=_0x454cce['params']['id'];var _0x3d8b18;var _0x3eeb0c;var _0x7b0a4f;return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0x2122de}})['then'](function(_0x3e07f1){_0x3d8b18=_0x3e07f1;return db['ChatWebsite'][_0x9edd('0xc5')]({'where':{'id':_0x3e07f1['ChatWebsiteId']},'attributes':['id',_0x9edd('0xc6'),'vidaooEscalation',_0x9edd('0xc7'),_0x9edd('0xc8'),_0x9edd('0xc9')],'raw':!![]});})['then'](function(_0x244dce){if(_0x244dce&&_0x244dce[_0x9edd('0xc6')]&&_0x244dce[_0x9edd('0xca')]){_0x3eeb0c=_0x244dce;var _0x2e7b0d={'interaction':{'id':_0x2122de},'agent':{'id':_0x454cce[_0x9edd('0xa5')]['id'],'name':_0x454cce[_0x9edd('0xa5')][_0x9edd('0x2c')],'fullname':_0x454cce[_0x9edd('0xa5')][_0x9edd('0x37')],'email':_0x454cce[_0x9edd('0xa5')][_0x9edd('0xcb')]},'contact':_0x454cce[_0x9edd('0x30')][_0x9edd('0x31')],'account':_0x454cce[_0x9edd('0x30')][_0x9edd('0x34')]};var _0x81dd98={'rejectUnauthorized':![],'method':_0x9edd('0xcc'),'url':_0x9edd('0xcd'),'headers':{'X-APIKEY':_0x244dce[_0x9edd('0xc6')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x454cce[_0x9edd('0xa5')][_0x9edd('0xcb')]],'buttons':null,'topic':_0x3eeb0c[_0x9edd('0xc7')],'note':_['isNull'](_0x3eeb0c[_0x9edd('0xc8')])?null:getMustacheRender(_0x3eeb0c['vidaooNote'],_0x2e7b0d),'metadata':null},'redirect':_0x9edd('0xce'),'json':!![]};try{if(!_[_0x9edd('0xcf')](_0x3eeb0c[_0x9edd('0xc9')])){var _0x8ab7e8=getMustacheRender(_0x3eeb0c[_0x9edd('0xc9')],_0x2e7b0d);var _0x5465fd=JSON[_0x9edd('0x84')](_0x8ab7e8);_0x81dd98['body'][_0x9edd('0xd0')]=_0x5465fd;}}catch(_0x438cc5){throw new db[(_0x9edd('0x97'))][(_0x9edd('0xd1'))](_0x9edd('0xd2'));}return rp(_0x81dd98);}else{throw new db[(_0x9edd('0x97'))]['ValidationError'](_0x9edd('0xd3'));}})[_0x9edd('0x17')](function(_0x5be4a6){_0x7b0a4f=_0x5be4a6;if(_0x7b0a4f['id']){var _0x4f7350={'body':_0x7b0a4f['join_url'],'ChatWebsiteId':_0x3eeb0c['id'],'ChatInteractionId':_0x3d8b18['id'],'direction':'out','UserId':_0x454cce[_0x9edd('0xa5')]['id']};return db[_0x9edd('0xd4')][_0x9edd('0xc3')](_0x4f7350,{});}else{throw new db[(_0x9edd('0x97'))][(_0x9edd('0xd1'))](_0x9edd('0xd5'));}})[_0x9edd('0x17')](function(){return _0x3d8b18[_0x9edd('0xd6')]({'vidaooSessionId':_0x7b0a4f['id']});})[_0x9edd('0x17')](respondWithResult(_0x524217,null))[_0x9edd('0x3d')](handleError(_0x524217,null));};exports['customUpdate']=function(_0x361b57,_0x4b3449){if(_0x361b57['body']['id']){delete _0x361b57[_0x9edd('0x30')]['id'];}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x361b57[_0x9edd('0xbf')]['id']},'include':[{'model':db[_0x9edd('0xd7')],'as':'Contact'}]})[_0x9edd('0x17')](handleEntityNotFound(_0x4b3449,null))[_0x9edd('0x17')](saveUpdates(_0x361b57[_0x9edd('0x30')],null))[_0x9edd('0x17')](respondWithResult(_0x4b3449,null))['catch'](handleError(_0x4b3449,null));};exports[_0x9edd('0xd8')]=function(_0x2a3076,_0x3df631){if(_0x2a3076[_0x9edd('0x30')]['id']){delete _0x2a3076[_0x9edd('0x30')]['id'];}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x2a3076[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](function(_0xa8c1f7){if(!_0xa8c1f7){logger[_0x9edd('0x1e')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x9edd('0xd8'),0x194,_0x9edd('0xd9'));_0x3df631[_0x9edd('0x21')](0x194);}else{if(_0xa8c1f7[_0x9edd('0x43')]){throw new db[(_0x9edd('0x97'))][(_0x9edd('0xd1'))](_0x9edd('0xda'));}}return _0xa8c1f7;})[_0x9edd('0x17')](function(_0x4a3955){if(_0x4a3955){return _0x4a3955['update']({'closed':_0x2a3076['body'][_0x9edd('0x42')],'disposition':_0x2a3076[_0x9edd('0x30')][_0x9edd('0x44')]})[_0x9edd('0x17')](function(_0x223c42){return _0x223c42;});}})[_0x9edd('0x17')](function(){return respondWithRpcPromise(_0x9edd('0xdb'),_0x9edd('0xd8'),_0x2a3076[_0x9edd('0x30')],client9004);})[_0x9edd('0x17')](respondWithResult(_0x3df631,null))['catch'](handleError(_0x3df631,null));};exports[_0x9edd('0xdc')]=function(_0x56dc7e,_0x4db9fc){_0x56dc7e[_0x9edd('0x30')][_0x9edd('0x2c')]=_0x56dc7e[_0x9edd('0xdd')]['originalname'];_0x56dc7e['body']['basename']=_0x56dc7e['file']['filename'];_0x56dc7e[_0x9edd('0x30')][_0x9edd('0x4b')]=_0x56dc7e[_0x9edd('0xdd')]['mimetype'];return db[_0x9edd('0xde')][_0x9edd('0xc3')](_0x56dc7e[_0x9edd('0x30')])['then'](respondWithResult(_0x4db9fc,0xc9))[_0x9edd('0x3d')](handleError(_0x4db9fc,null));};exports['attachmentDownload']=function(_0x16a1c8,_0x1a2376){return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0x16a1c8['params']['id']},'raw':!![]})[_0x9edd('0x17')](handleEntityNotFound(_0x1a2376,null))[_0x9edd('0x17')](function(_0x499e2a){if(_0x499e2a){if(_0x499e2a[_0x9edd('0x42')]){return _0x1a2376[_0x9edd('0x22')](0x193)[_0x9edd('0x24')]({'status':0x193,'message':_0x9edd('0xdf')});}return db['Attachment'][_0x9edd('0xc5')]({'where':{'id':_0x16a1c8[_0x9edd('0x4e')][_0x9edd('0xe0')]},'raw':!![]})[_0x9edd('0x17')](handleEntityNotFound(_0x1a2376,null));}})[_0x9edd('0x17')](function(_0x35d21e){if(_0x35d21e){var _0x390354=_0x35d21e['ChatOfflineMessageId']!==null;var _0xb29591=path['join'](config[_0x9edd('0xe1')],_0x9edd('0xe2'));if(_0x390354){_0xb29591=path['join'](_0xb29591,_0x9edd('0xe3'));}var _0x2f212d=path[_0x9edd('0xe4')](_0xb29591,_0x35d21e['basename']);return _0x1a2376[_0x9edd('0xe5')](_0x2f212d);}})[_0x9edd('0x3d')](handleError(_0x1a2376,null));};exports[_0x9edd('0xe6')]=function(_0x52f0e2,_0x155ca5){var _0x517142=null;var _0x288ecc=null;var _0x30d03a=null;if(_0x52f0e2[_0x9edd('0x30')]['id']){delete _0x52f0e2[_0x9edd('0x30')]['id'];}if(_0x52f0e2['body']['mailTranscript']){_0x30d03a=path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0xe7'),util[_0x9edd('0xe8')](_0x9edd('0xe9'),Date['now']()));_0x52f0e2[_0x9edd('0x30')][_0x9edd('0xea')]=_0x30d03a;}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x52f0e2[_0x9edd('0xbf')]['id']},'include':[{'model':db[_0x9edd('0xd4')],'as':_0x9edd('0xeb'),'include':[{'model':db[_0x9edd('0xec')],'as':_0x9edd('0xec')}]}]})[_0x9edd('0x17')](handleEntityNotFound(_0x155ca5,null))[_0x9edd('0x17')](saveUpdates(_0x52f0e2[_0x9edd('0x30')],null))[_0x9edd('0x17')](function(_0x549cd6){if(_0x549cd6){_0x517142=_0x549cd6;return db[_0x9edd('0xed')][_0x9edd('0x6f')]({'where':{'id':_0x517142[_0x9edd('0xa0')]}});}})[_0x9edd('0x17')](function(_0x5aab0e){if(_0x5aab0e){_0x288ecc=_0x5aab0e;return db[_0x9edd('0xd7')][_0x9edd('0x6f')]({'where':{'id':_0x517142[_0x9edd('0x77')]}});}})['then'](function(_0x910adf){if(_0x910adf){if(_0x30d03a){var _0x49a24f=null;for(var _0x483d82=0x1;_0x483d82<_0x517142[_0x9edd('0xeb')][_0x9edd('0x53')];++_0x483d82){_0x49a24f=_0x517142[_0x9edd('0xeb')][_0x483d82];var _0x1934d3=_0x49a24f['UserId']?util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x288ecc[_0x9edd('0xef')],_0x49a24f[_0x9edd('0x43')]):_0x9edd('0xf0');var _0x38efe5=_0x52f0e2[_0x9edd('0x30')][_0x9edd('0xf1')]||util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x9edd('0xf2'),_0x49a24f[_0x9edd('0x77')]);switch(_0x288ecc['agentIdentifier']){case _0x9edd('0xf3'):_0x1934d3=_0x49a24f[_0x9edd('0x43')]?util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x288ecc[_0x9edd('0xef')],_0x49a24f['UserId']):_0x9edd('0xf0');break;case'agent_alias':_0x1934d3=_0x49a24f[_0x9edd('0x43')]?_0x49a24f[_0x9edd('0xec')]['alias']||_0x49a24f['User'][_0x9edd('0x37')]:_0x9edd('0xf0');break;case _0x9edd('0xf4'):_0x1934d3=_0x49a24f[_0x9edd('0x43')]?_0x49a24f[_0x9edd('0xec')]['fullname']:'System';break;default:_0x1934d3=_0x49a24f[_0x9edd('0x43')]?util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x288ecc[_0x9edd('0xef')],_0x49a24f['UserId']):_0x9edd('0xf0');}var _0x3b36ed=util[_0x9edd('0xe8')](_0x9edd('0xf5'),moment(_0x49a24f[_0x9edd('0x83')])[_0x9edd('0xe8')](_0x9edd('0xf6')),_0x49a24f['direction']==='in'?_0x38efe5:_0x1934d3,_0x49a24f[_0x9edd('0x30')]);if(!_0x49a24f[_0x9edd('0xf7')]){fs[_0x9edd('0xf8')](_0x30d03a,_0x3b36ed);}}return db[_0x9edd('0xf9')][_0x9edd('0xc5')]({'where':{'service':!![]},'include':[{'model':db[_0x9edd('0xfa')],'as':_0x9edd('0xfb'),'raw':!![],'include':[{'model':db[_0x9edd('0xfc')],'as':_0x9edd('0xfc'),'raw':!![]}]}]});}}})[_0x9edd('0x17')](function(_0x288bc8){if(!_0x288bc8||!_0x288bc8[_0x9edd('0xfb')]||!_0x52f0e2[_0x9edd('0x30')])return _0x517142;var _0x50bfd5=_0x288bc8[_0x9edd('0xfd')]();return respondWithRpcPromise(_0x9edd('0xfe'),_0x9edd('0xff'),{'account':_0x50bfd5,'message':{'from':util[_0x9edd('0xe8')]('\x22%s\x22\x20<%s>',_0x288bc8[_0x9edd('0x2c')],_0x288bc8[_0x9edd('0xcb')]||_0x288bc8[_0x9edd('0xfb')][_0x9edd('0xa5')]),'to':_0x52f0e2[_0x9edd('0x30')][_0x9edd('0x100')],'subject':_0x9edd('0x101'),'text':util[_0x9edd('0xe8')](_0x9edd('0x102'),_0x52f0e2[_0x9edd('0x30')][_0x9edd('0x100')]),'attachments':[{'path':_0x30d03a}]}})['then'](function(){return _0x517142;})[_0x9edd('0x3d')](function(_0x7916cf){logger[_0x9edd('0x1e')](_0x7916cf);});})[_0x9edd('0x17')](respondWithStatusCode(_0x155ca5,0xc8))[_0x9edd('0x3d')](handleError(_0x155ca5,null));};exports[_0x9edd('0x103')]=function(_0x3bdbed,_0x55d08b){return db[_0x9edd('0xd4')][_0x9edd('0x6f')]({'where':{'id':_0x3bdbed[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](handleEntityNotFound(_0x55d08b,null))[_0x9edd('0x17')](function(_0x116fcb){if(_0x116fcb){return _0x116fcb[_0x9edd('0x103')](_0x3bdbed[_0x9edd('0x30')][_0x9edd('0x104')],_[_0x9edd('0x105')](_0x3bdbed[_0x9edd('0x30')],[_0x9edd('0x104'),'id'])||{});}})[_0x9edd('0x17')](respondWithResult(_0x55d08b,null))[_0x9edd('0x3d')](handleError(_0x55d08b,null));};exports[_0x9edd('0x106')]=function(_0xd227fe,_0x106889){var _0x56a952={'raw':![],'where':{}};var _0xadc0be={};var _0x300094={'count':0x0,'rows':[]};return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0xd227fe[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](handleEntityNotFound(_0x106889,null))[_0x9edd('0x17')](function(_0x11d72d){if(_0x11d72d){_0xadc0be[_0x9edd('0x4c')]=_['keys'](db[_0x9edd('0xd4')][_0x9edd('0x49')]);_0xadc0be[_0x9edd('0x4e')]=_['keys'](_0xd227fe[_0x9edd('0x4e')]);_0xadc0be['filters']=_[_0x9edd('0x50')](_0xadc0be['model'],_0xadc0be[_0x9edd('0x4e')]);_0x56a952[_0x9edd('0x52')]=_['intersection'](_0xadc0be[_0x9edd('0x4c')],qs[_0x9edd('0x51')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x51')]));_0x56a952[_0x9edd('0x52')]=_0x56a952[_0x9edd('0x52')][_0x9edd('0x53')]?_0x56a952['attributes']:_0xadc0be[_0x9edd('0x4c')];if(!_0xd227fe[_0x9edd('0x4e')]['hasOwnProperty'](_0x9edd('0x55'))){_0x56a952['limit']=qs[_0x9edd('0x27')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x27')]);_0x56a952[_0x9edd('0x25')]=qs[_0x9edd('0x25')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x25')]);}_0x56a952[_0x9edd('0x9c')]=qs[_0x9edd('0x56')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x56')]);_0x56a952[_0x9edd('0x57')]=qs['filters'](_['pick'](_0xd227fe[_0x9edd('0x4e')],_0xadc0be[_0x9edd('0x4f')]));_0x56a952[_0x9edd('0x57')][_0x9edd('0xbb')]=_0x11d72d['id'];if(_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x8f')]){_0x56a952[_0x9edd('0x57')]=_[_0x9edd('0x2f')](_0x56a952[_0x9edd('0x57')],{'$or':_['map'](_0x56a952[_0x9edd('0x52')],function(_0x49181c){var _0x3ca64d={};_0x3ca64d[_0x49181c]={'$like':'%'+_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x8f')]+'%'};return _0x3ca64d;})});}if(_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x85')]){var _0x12561b=_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x85')][_0x9edd('0x3a')](',');var _0x3fcbc0={};_0x3fcbc0[_0x12561b[0x0]]={'$gte':moment(_0x12561b[0x1])[_0x9edd('0xe8')](_0x9edd('0x107'))};_0x56a952[_0x9edd('0x57')]=_[_0x9edd('0x2f')](_0x56a952[_0x9edd('0x57')],_0x3fcbc0);}_0x56a952=_[_0x9edd('0x2f')]({},_0x56a952,_0xd227fe[_0x9edd('0xc2')]);return db[_0x9edd('0xd4')][_0x9edd('0x28')]({'where':_0x56a952['where']})['then'](function(_0x33a86d){_0x300094['count']=_0x33a86d;if(_0xd227fe[_0x9edd('0x4e')][_0x9edd('0xc0')]){_0x56a952[_0x9edd('0xc1')]=[{'all':!![]}];}return db[_0x9edd('0xd4')]['findAll'](_0x56a952);})['then'](function(_0x593f45){_0x300094[_0x9edd('0xbd')]=_0x593f45;return _0x300094;});}})[_0x9edd('0x17')](respondWithFilteredResult(_0x106889,_0x56a952))[_0x9edd('0x3d')](handleError(_0x106889,null));};exports[_0x9edd('0x108')]=function(_0x51ac25,_0x4707b7){var _0x48f055={'where':{}},_0x43e9fa={},_0x2e260a={'count':0x0,'rows':[]};return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0x51ac25['params']['id']}})['then'](handleEntityNotFound(_0x4707b7,null))['then'](function(_0x3bb205){if(_0x3bb205){_0x43e9fa[_0x9edd('0x4c')]=_[_0x9edd('0x4d')](db[_0x9edd('0xd4')][_0x9edd('0x49')]);_0x43e9fa[_0x9edd('0x4e')]=_['keys'](_0x51ac25[_0x9edd('0x4e')]);_0x43e9fa[_0x9edd('0x4f')]=_['intersection'](_0x43e9fa['model'],_0x43e9fa[_0x9edd('0x4e')]);_0x48f055[_0x9edd('0x52')]=_[_0x9edd('0x50')](_0x43e9fa['model'],qs[_0x9edd('0x51')](_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x51')]));_0x48f055[_0x9edd('0x52')]=_0x48f055['attributes'][_0x9edd('0x53')]?_0x48f055[_0x9edd('0x52')]:_0x43e9fa[_0x9edd('0x4c')];if(!_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x54')](_0x9edd('0x55'))){_0x48f055['limit']=qs[_0x9edd('0x27')](_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x27')]);_0x48f055[_0x9edd('0x25')]=qs['offset'](_0x51ac25['query'][_0x9edd('0x25')]);}_0x48f055[_0x9edd('0x9c')]=qs[_0x9edd('0x56')](_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x56')]);_0x48f055[_0x9edd('0x57')]=qs[_0x9edd('0x4f')](_[_0x9edd('0x58')](_0x51ac25[_0x9edd('0x4e')],_0x43e9fa[_0x9edd('0x4f')]));_0x48f055[_0x9edd('0x57')][_0x9edd('0xbb')]=_0x3bb205['id'];if(_0x51ac25['query']['filter']){_0x48f055[_0x9edd('0x57')]=_[_0x9edd('0x2f')](_0x48f055[_0x9edd('0x57')],{'$or':_[_0x9edd('0x36')](_0x48f055[_0x9edd('0x52')],function(_0x180c4d){var _0x425948={};_0x425948[_0x180c4d]={'$like':'%'+_0x51ac25[_0x9edd('0x4e')]['filter']+'%'};return _0x425948;})});}_0x48f055[_0x9edd('0x57')][_0x9edd('0xf7')]=![];if(_0x51ac25[_0x9edd('0x4e')]['id']){_0x48f055[_0x9edd('0x57')]['id']={'$gt':_0x51ac25[_0x9edd('0x4e')]['id']};}_0x48f055=_[_0x9edd('0x2f')]({},_0x48f055,_0x51ac25['options']);return db['ChatMessage'][_0x9edd('0x28')]({'where':_0x48f055[_0x9edd('0x57')]})[_0x9edd('0x17')](function(_0x50c328){_0x2e260a['count']=_0x50c328;_0x48f055[_0x9edd('0xc1')]=[];if(_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x109')]){_0x48f055[_0x9edd('0xc1')][_0x9edd('0x3c')]({'model':db[_0x9edd('0xec')],'as':_0x9edd('0xec'),'attributes':['id',_0x9edd('0x37'),_0x9edd('0x10a')]});}if(_0x51ac25[_0x9edd('0x4e')][_0x9edd('0xc0')]){_0x48f055['include']=[{'all':!![]}];}return db[_0x9edd('0xd4')]['findAll'](_0x48f055);})['then'](function(_0x58756b){_0x2e260a[_0x9edd('0xbd')]=_0x58756b;return _0x2e260a;});}})[_0x9edd('0x17')](respondWithFilteredResult(_0x4707b7,_0x48f055))['catch'](handleError(_0x4707b7,null));};exports['addTags']=function(_0x5e721c,_0x47d20b){return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x5e721c[_0x9edd('0xbf')]['id']}})['then'](handleEntityNotFound(_0x47d20b,null))[_0x9edd('0x17')](function(_0x2f99ac){if(_0x2f99ac){return _0x2f99ac[_0x9edd('0x10b')](_0x5e721c[_0x9edd('0x30')][_0x9edd('0x104')],_['omit'](_0x5e721c[_0x9edd('0x30')],['ids','id'])||{})[_0x9edd('0x10c')](function(){return db['Tag'][_0x9edd('0x10d')]({'attributes':['id',_0x9edd('0x2c'),_0x9edd('0x5b')],'where':{'id':_0x5e721c['body'][_0x9edd('0x104')]}});})[_0x9edd('0x17')](function(_0x3e2fc7){socket['emit']('chatInteractionTags:save',{'id':Number(_0x5e721c[_0x9edd('0xbf')]['id']),'tags':_0x3e2fc7||[]});return{'id':Number(_0x5e721c[_0x9edd('0xbf')]['id']),'tags':_0x3e2fc7||[]};});}})[_0x9edd('0x17')](respondWithResult(_0x47d20b,null))[_0x9edd('0x3d')](handleError(_0x47d20b,null));};exports[_0x9edd('0x10e')]=function(_0x83693e,_0x4308a2){return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x83693e[_0x9edd('0xbf')]['id']}})['then'](handleEntityNotFound(_0x4308a2,null))[_0x9edd('0x17')](function(_0x276a53){if(_0x276a53){return _0x276a53['removeTags'](_0x83693e['query'][_0x9edd('0x104')]);}})[_0x9edd('0x17')](respondWithStatusCode(_0x4308a2,null))[_0x9edd('0x3d')](handleError(_0x4308a2,null));};exports[_0x9edd('0xe5')]=function(_0x5eec20,_0xc23db6){var _0x33a71d=moment()[_0x9edd('0x10f')]()[_0x9edd('0xa8')]();var _0x5d8749=path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0x110'),'files',_0x9edd('0x111'));var _0x1e9806=path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0x110'),_0x9edd('0x112'),_0x9edd('0x113'));var _0x4fa1b2=path[_0x9edd('0xe4')](_0x5d8749,_0x33a71d);var _0x2c0620=util['format'](_0x9edd('0x114'),_0x5eec20['params']['id'],_0x33a71d);var _0x5a43af=path[_0x9edd('0xe4')](_0x5d8749,_0x2c0620);var _0x6018fd=[];_0x6018fd[_0x9edd('0x3c')]({'model':db[_0x9edd('0xec')],'as':_0x9edd('0xec'),'attributes':['id',_0x9edd('0x37')],'raw':!![]});_0x6018fd[_0x9edd('0x3c')]({'model':db[_0x9edd('0xd7')],'as':_0x9edd('0x115'),'attributes':['id',_0x9edd('0x116'),_0x9edd('0x117')],'raw':!![]});if(_0x5eec20['query']['attachments']){_0x6018fd[_0x9edd('0x3c')]({'model':db[_0x9edd('0xde')],'as':_0x9edd('0xde'),'raw':!![]});}var _0x3a2dad=[{'model':db[_0x9edd('0xd4')],'as':_0x9edd('0xeb'),'attributes':['id','body',_0x9edd('0x83'),_0x9edd('0x118'),_0x9edd('0xf7'),'read'],'include':_0x6018fd}];_0x3a2dad[_0x9edd('0x3c')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id','name']});_0x3a2dad[_0x9edd('0x3c')]({'model':db[_0x9edd('0xec')],'as':_0x9edd('0x119'),'attributes':['id',_0x9edd('0x37')]});return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x5eec20[_0x9edd('0xbf')]['id']},'include':_0x3a2dad})[_0x9edd('0x17')](handleEntityNotFound(_0xc23db6,null))[_0x9edd('0x17')](function(_0x5033e3){if(_0x5033e3){var _0x3a6ffa=_0x5033e3[_0x9edd('0x11a')]({'plain':!![]});fs['mkdirSync'](_0x4fa1b2);var _0x5d7461={'channel':_0x9edd('0x11b'),'account':_0x3a6ffa[_0x9edd('0x11c')]['name'],'agent':_0x3a6ffa[_0x9edd('0x119')]?_0x3a6ffa[_0x9edd('0x119')][_0x9edd('0x37')]:_0x9edd('0x11d'),'createdAt':moment(_0x3a6ffa['createdAt'])[_0x9edd('0xe8')](_0x9edd('0x107'))[_0x9edd('0xa8')](),'closedAt':_0x3a6ffa['closed']?moment(_0x3a6ffa[_0x9edd('0x11e')])[_0x9edd('0xe8')](_0x9edd('0x107'))[_0x9edd('0xa8')]():'','disposition':_0x3a6ffa[_0x9edd('0x44')],'chatInfo':{'browser':_0x3a6ffa[_0x9edd('0x11f')],'os':_0x3a6ffa[_0x9edd('0x120')],'referer':_0x3a6ffa[_0x9edd('0x121')],'customerIp':_0x3a6ffa['customerIp'],'customerPort':_0x3a6ffa[_0x9edd('0x122')]?_0x3a6ffa[_0x9edd('0x122')]:_0x9edd('0x11d')},'messages':_(_0x3a6ffa[_0x9edd('0xeb')])[_0x9edd('0x123')]()[_0x9edd('0x8f')]({'secret':![]})[_0x9edd('0x36')](function(_0x57845c){if(_0x57845c[_0x9edd('0xde')]){var _0x55d8e1=path['join'](_0x1e9806,_0x57845c[_0x9edd('0xde')][_0x9edd('0x124')]);if(fs['existsSync'](_0x55d8e1)){fs[_0x9edd('0x125')](_0x55d8e1)[_0x9edd('0x126')](fs[_0x9edd('0x127')](path['join'](_0x4fa1b2,_0x57845c['Attachment'][_0x9edd('0x124')])));}}return{'date':moment(_0x57845c[_0x9edd('0x83')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9edd('0xa8')](),'sender':_0x57845c[_0x9edd('0x118')]===_0x9edd('0x128')?_0x57845c[_0x9edd('0xec')]?_0x57845c['User']['fullname']:_0x9edd('0xf0'):_0x57845c[_0x9edd('0x115')]['firstName']+(_0x57845c[_0x9edd('0x115')]['lastName']?'\x20'+_0x57845c[_0x9edd('0x115')][_0x9edd('0x117')]:''),'body':_0x57845c[_0x9edd('0xde')]?_0x57845c[_0x9edd('0xde')]['basename']:_0x57845c[_0x9edd('0x30')],'direction':_0x57845c[_0x9edd('0x118')]==='out'?'A':'C','secret':_0x57845c[_0x9edd('0xf7')],'read':_0x57845c['read'],'attachment':_0x57845c[_0x9edd('0xde')]};})[_0x9edd('0x76')]()};return ejs[_0x9edd('0x129')](path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0x110'),'views',_0x9edd('0x12a')),{'interaction':_0x5d7461})[_0x9edd('0x17')](function(_0x268088){var _0x3aa372=path[_0x9edd('0xe4')](_0x4fa1b2,_0x9edd('0x12b')+_0x3a6ffa['id']+'-'+_0x33a71d+_0x9edd('0x12c'));var _0x299444={'path':_0x3aa372,'channel':_0x9edd('0x11b'),'interactionId':_0x3a6ffa['id']};return pdf[_0x9edd('0x12d')](_0x268088,_0x299444);})['then'](function(){return new Promise(function(_0x2b7c53,_0x62b689){zipdir(_0x4fa1b2,{'saveTo':_0x5a43af},function(_0x319670,_0x108640){if(_0x319670)return _0x62b689(_0x319670);return _0x2b7c53(_0x108640);});})[_0x9edd('0x17')](function(){return new BPromise(function(_0x350ae2,_0x202f59){rimraf(_0x4fa1b2,function(_0x2f5a6e){if(_0x2f5a6e)_0x202f59(_0x2f5a6e);return _0x350ae2();});});})[_0x9edd('0x17')](function(){return _0xc23db6[_0x9edd('0xe5')](_0x5a43af,_0x2c0620,function(_0x142052){if(_0x142052){logger[_0x9edd('0x1e')](_0x9edd('0x12e'),_0x142052);}else{fs[_0x9edd('0x12f')](_0x5a43af);}});});});}else{return _0xc23db6[_0x9edd('0x21')](0xc8);}})['catch'](handleError(_0xc23db6,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 09771ad..5f6aee0 100644 --- a/server/api/chatInteraction/chatInteraction.events.js +++ b/server/api/chatInteraction/chatInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0288=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x0288,0x13f));var _0x8028=function(_0x11dec8,_0xb57f40){_0x11dec8=_0x11dec8-0x0;var _0x4d38f2=_0x0288[_0x11dec8];return _0x4d38f2;};'use strict';var EventEmitter=require(_0x8028('0x0'));var ChatInteraction=require(_0x8028('0x1'))['db'][_0x8028('0x2')];var ChatMessage=require(_0x8028('0x1'))['db'][_0x8028('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8028('0x4')](0x0);var events={'afterCreate':_0x8028('0x5'),'afterUpdate':_0x8028('0x6'),'afterDestroy':_0x8028('0x7')};function emitEvent(_0x21b2d3){return function(_0x39bb51,_0x4e7c4f,_0x518a1e){_0x39bb51[_0x8028('0x8')]({'attributes':['id'],'raw':!![]})[_0x8028('0x9')](function(_0x194693){_0x39bb51[_0x8028('0xa')](_0x8028('0xb'),_0x194693['map'](function(_0x51c94f){return{'id':_0x51c94f['id']};}));return ChatMessage[_0x8028('0xc')]({'where':{'ChatInteractionId':_0x39bb51['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x419b27){_0x39bb51[_0x8028('0xa')](_0x8028('0xd'),_0x419b27[_0x8028('0xe')]);ChatInteractionEvents[_0x8028('0xf')](_0x21b2d3+':'+_0x39bb51['id'],_0x39bb51);ChatInteractionEvents[_0x8028('0xf')](_0x21b2d3,_0x39bb51);_0x518a1e(null);})[_0x8028('0x10')](_0x518a1e(null));};}for(var e in events){if(events[_0x8028('0x11')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x8028('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0x0a44=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook'];(function(_0x56a835,_0x38af97){var _0x2331af=function(_0xce0dbb){while(--_0xce0dbb){_0x56a835['push'](_0x56a835['shift']());}};_0x2331af(++_0x38af97);}(_0x0a44,0x133));var _0x40a4=function(_0x1f352b,_0x4edec5){_0x1f352b=_0x1f352b-0x0;var _0x59f654=_0x0a44[_0x1f352b];return _0x59f654;};'use strict';var EventEmitter=require(_0x40a4('0x0'));var ChatInteraction=require(_0x40a4('0x1'))['db'][_0x40a4('0x2')];var ChatMessage=require(_0x40a4('0x1'))['db'][_0x40a4('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x40a4('0x4'),'afterDestroy':_0x40a4('0x5')};function emitEvent(_0x59434c){return function(_0x23606b,_0x1b6a46,_0x43f9db){_0x23606b[_0x40a4('0x6')]({'attributes':['id'],'raw':!![]})[_0x40a4('0x7')](function(_0x1e0df7){_0x23606b[_0x40a4('0x8')](_0x40a4('0x9'),_0x1e0df7[_0x40a4('0xa')](function(_0x3a4aea){return{'id':_0x3a4aea['id']};}));return ChatMessage[_0x40a4('0xb')]({'where':{'ChatInteractionId':_0x23606b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x40a4('0x7')](function(_0x2fa52e){_0x23606b[_0x40a4('0x8')]('unreadMessages',_0x2fa52e[_0x40a4('0xc')]);ChatInteractionEvents[_0x40a4('0xd')](_0x59434c+':'+_0x23606b['id'],_0x23606b);ChatInteractionEvents[_0x40a4('0xd')](_0x59434c,_0x23606b);_0x43f9db(null);})[_0x40a4('0xe')](_0x43f9db(null));};}for(var e in events){if(events[_0x40a4('0xf')](e)){var event=events[e];ChatInteraction[_0x40a4('0x10')](e,emitEvent(event));}}module[_0x40a4('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 613b7ac..1ab44f9 100644 --- a/server/api/chatInteraction/chatInteraction.model.js +++ b/server/api/chatInteraction/chatInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bc0=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x4bc0,0x121));var _0x04bc=function(_0x1733f9,_0x3e9a1c){_0x1733f9=_0x1733f9-0x0;var _0x30688=_0x4bc0[_0x1733f9];return _0x30688;};'use strict';var _=require(_0x04bc('0x0'));var util=require(_0x04bc('0x1'));var logger=require(_0x04bc('0x2'))('api');var moment=require(_0x04bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x04bc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04bc('0x5'));var config=require(_0x04bc('0x6'));var attributes=require(_0x04bc('0x7'));module[_0x04bc('0x8')]=function(_0xf43577,_0x515669){return _0xf43577[_0x04bc('0x9')](_0x04bc('0xa'),attributes,{'tableName':_0x04bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4846bc,_0x59a28b,_0x318772){if(_0x4846bc[_0x04bc('0xc')]('closed')){_0x4846bc[_0x04bc('0xd')]=moment()[_0x04bc('0xe')](_0x04bc('0xf'));}_0x318772(null,_0x4846bc);}},'charset':_0x04bc('0x10'),'collate':_0x04bc('0x11')});}; \ No newline at end of file +var _0x27e5=['ChatInteraction','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x27e5,0x150));var _0x527e=function(_0xd316f8,_0x2c9655){_0xd316f8=_0xd316f8-0x0;var _0xc2109c=_0x27e5[_0xd316f8];return _0xc2109c;};'use strict';var _=require(_0x527e('0x0'));var util=require('util');var logger=require(_0x527e('0x1'))(_0x527e('0x2'));var moment=require(_0x527e('0x3'));var BPromise=require('bluebird');var rp=require(_0x527e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x527e('0x5'));var config=require(_0x527e('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x527e('0x7')]=function(_0x2fd0c9,_0x20e34e){return _0x2fd0c9[_0x527e('0x8')](_0x527e('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3baa52,_0x74a976,_0x2ddd2d){if(_0x3baa52['changed'](_0x527e('0xa'))){_0x3baa52[_0x527e('0xb')]=moment()[_0x527e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2ddd2d(null,_0x3baa52);}},'charset':_0x527e('0xd'),'collate':_0x527e('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 7c512ea..b6062f4 100644 --- a/server/api/chatInteraction/chatInteraction.rpc.js +++ b/server/api/chatInteraction/chatInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93c1=['register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','find','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket'];(function(_0x193ac2,_0x5d8578){var _0x57836b=function(_0x4c3d32){while(--_0x4c3d32){_0x193ac2['push'](_0x193ac2['shift']());}};_0x57836b(++_0x5d8578);}(_0x93c1,0x1ec));var _0x193c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x93c1[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x193c('0x0'));var util=require('util');var moment=require(_0x193c('0x1'));var BPromise=require(_0x193c('0x2'));var rs=require(_0x193c('0x3'));var fs=require('fs');var Redis=require(_0x193c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x193c('0x5'));var logger=require(_0x193c('0x6'))(_0x193c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x193c('0x8')][_0x193c('0x9')]({'port':0x232a});config[_0x193c('0xa')]=_[_0x193c('0xb')](config[_0x193c('0xa')],{'host':_0x193c('0xc'),'port':0x18eb});var socket=require(_0x193c('0xd'))(new Redis(config['redis']));require(_0x193c('0xe'))[_0x193c('0xf')](socket);function respondWithRpcPromise(_0x9c4f1e,_0x436fdd,_0x78a5c3){return new BPromise(function(_0x5acd2c,_0x329ce2){return client[_0x193c('0x10')](_0x9c4f1e,_0x78a5c3)[_0x193c('0x11')](function(_0x58575a){logger[_0x193c('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x436fdd,_0x193c('0x13'));logger[_0x193c('0x14')](_0x193c('0x15'),_0x436fdd,_0x193c('0x13'),JSON[_0x193c('0x16')](_0x58575a));if(_0x58575a[_0x193c('0x17')]){if(_0x58575a['error'][_0x193c('0x18')]===0x1f4){logger[_0x193c('0x17')](_0x193c('0x19'),_0x436fdd,_0x58575a[_0x193c('0x17')][_0x193c('0x1a')]);return _0x329ce2(_0x58575a[_0x193c('0x17')][_0x193c('0x1a')]);}logger[_0x193c('0x17')](_0x193c('0x19'),_0x436fdd,_0x58575a['error'][_0x193c('0x1a')]);return _0x5acd2c(_0x58575a[_0x193c('0x17')][_0x193c('0x1a')]);}else{logger['info'](_0x193c('0x19'),_0x436fdd,_0x193c('0x13'));_0x5acd2c(_0x58575a[_0x193c('0x1b')][_0x193c('0x1a')]);}})[_0x193c('0x1c')](function(_0xfe7bcf){logger['error'](_0x193c('0x19'),_0x436fdd,_0xfe7bcf);_0x329ce2(_0xfe7bcf);});});}exports[_0x193c('0x1d')]=function(_0x16f7c5){var _0x3fcf9a=this;return new Promise(function(_0x470904,_0x8c8da7){return db[_0x193c('0x1e')][_0x193c('0x1f')](_0x16f7c5['body'],{'raw':_0x16f7c5[_0x193c('0x20')]?_0x16f7c5['options'][_0x193c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16f7c5[_0x193c('0x20')]?_0x16f7c5[_0x193c('0x20')][_0x193c('0x22')]||null:null,'attributes':_0x16f7c5['options']?_0x16f7c5[_0x193c('0x20')][_0x193c('0x23')]||null:null,'limit':_0x16f7c5['options']?_0x16f7c5[_0x193c('0x20')]['limit']||null:null})['then'](function(_0x127006){logger[_0x193c('0x12')](_0x193c('0x1d'),_0x16f7c5);logger[_0x193c('0x14')](_0x193c('0x1d'),_0x16f7c5,JSON[_0x193c('0x16')](_0x127006));_0x470904(_0x127006);})[_0x193c('0x1c')](function(_0x334ba2){logger[_0x193c('0x17')]('UpdateChatInteraction',_0x334ba2['message'],_0x16f7c5);_0x8c8da7(_0x3fcf9a[_0x193c('0x17')](0x1f4,_0x334ba2['message']));});});};exports['AddTagsToChatInteraction']=function(_0x3c11f9){return new Promise(function(_0x6921e5,_0x344da8){return db[_0x193c('0x1e')][_0x193c('0x24')]({'where':_0x3c11f9[_0x193c('0x20')]?_0x3c11f9[_0x193c('0x20')][_0x193c('0x22')]||null:null})[_0x193c('0x11')](function(_0x439fd2){if(_0x439fd2){return _0x439fd2['addTags'](_0x3c11f9['body'][_0x193c('0x25')],_['omit'](_0x3c11f9['body'],[_0x193c('0x25'),'id'])||{});}})['spread'](function(_0x2969da){logger[_0x193c('0x12')](_0x193c('0x26'),_0x3c11f9);logger[_0x193c('0x14')](_0x193c('0x26'),_0x3c11f9,JSON['stringify'](_0x2969da));_0x6921e5(_0x2969da);})[_0x193c('0x1c')](function(_0xd51384){logger[_0x193c('0x17')]('AddTags',_0xd51384[_0x193c('0x1a')],_0x3c11f9);_0x344da8(_this[_0x193c('0x17')](0x1f4,_0xd51384[_0x193c('0x1a')]));});});}; \ No newline at end of file +var _0x2ad3=['then','UpdateChatInteraction','AddTagsToChatInteraction','ids','omit','spread','AddTags','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','debug','stringify','error','ChatInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','ChatInteraction','body','options','raw','where','attributes','limit'];(function(_0x53615b,_0xf060d5){var _0x6058f=function(_0x559d20){while(--_0x559d20){_0x53615b['push'](_0x53615b['shift']());}};_0x6058f(++_0xf060d5);}(_0x2ad3,0xca));var _0x32ad=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x2ad3[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x32ad('0x0'));var fs=require('fs');var Redis=require(_0x32ad('0x1'));var db=require(_0x32ad('0x2'))['db'];var utils=require(_0x32ad('0x3'));var logger=require(_0x32ad('0x4'))(_0x32ad('0x5'));var config=require(_0x32ad('0x6'));var jayson=require(_0x32ad('0x7'));var client=jayson[_0x32ad('0x8')]['http']({'port':0x232a});config[_0x32ad('0x9')]=_[_0x32ad('0xa')](config[_0x32ad('0x9')],{'host':_0x32ad('0xb'),'port':0x18eb});var socket=require(_0x32ad('0xc'))(new Redis(config[_0x32ad('0x9')]));require(_0x32ad('0xd'))[_0x32ad('0xe')](socket);function respondWithRpcPromise(_0x160650,_0x4fa213,_0x2ac7ad){return new BPromise(function(_0x2aa34d,_0x10e6dc){return client[_0x32ad('0xf')](_0x160650,_0x2ac7ad)['then'](function(_0x207a2a){logger[_0x32ad('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x4fa213,'request\x20sent');logger[_0x32ad('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4fa213,'request\x20sent',JSON[_0x32ad('0x12')](_0x207a2a));if(_0x207a2a[_0x32ad('0x13')]){if(_0x207a2a['error']['code']===0x1f4){logger[_0x32ad('0x13')](_0x32ad('0x14'),_0x4fa213,_0x207a2a[_0x32ad('0x13')][_0x32ad('0x15')]);return _0x10e6dc(_0x207a2a[_0x32ad('0x13')]['message']);}logger['error'](_0x32ad('0x14'),_0x4fa213,_0x207a2a[_0x32ad('0x13')][_0x32ad('0x15')]);return _0x2aa34d(_0x207a2a[_0x32ad('0x13')]['message']);}else{logger['info'](_0x32ad('0x14'),_0x4fa213,_0x32ad('0x16'));_0x2aa34d(_0x207a2a[_0x32ad('0x17')][_0x32ad('0x15')]);}})[_0x32ad('0x18')](function(_0x12a1b4){logger[_0x32ad('0x13')](_0x32ad('0x14'),_0x4fa213,_0x12a1b4);_0x10e6dc(_0x12a1b4);});});}exports['UpdateChatInteraction']=function(_0x1c7a35){var _0x1ea469=this;return new Promise(function(_0x41cb29,_0x2a44fa){return db[_0x32ad('0x19')]['update'](_0x1c7a35[_0x32ad('0x1a')],{'raw':_0x1c7a35[_0x32ad('0x1b')]?_0x1c7a35[_0x32ad('0x1b')][_0x32ad('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c7a35[_0x32ad('0x1b')]?_0x1c7a35[_0x32ad('0x1b')][_0x32ad('0x1d')]||null:null,'attributes':_0x1c7a35[_0x32ad('0x1b')]?_0x1c7a35['options'][_0x32ad('0x1e')]||null:null,'limit':_0x1c7a35[_0x32ad('0x1b')]?_0x1c7a35[_0x32ad('0x1b')][_0x32ad('0x1f')]||null:null})[_0x32ad('0x20')](function(_0x4faa3c){logger[_0x32ad('0x10')](_0x32ad('0x21'),_0x1c7a35);logger[_0x32ad('0x11')](_0x32ad('0x21'),_0x1c7a35,JSON[_0x32ad('0x12')](_0x4faa3c));_0x41cb29(_0x4faa3c);})[_0x32ad('0x18')](function(_0x2f834d){logger[_0x32ad('0x13')](_0x32ad('0x21'),_0x2f834d[_0x32ad('0x15')],_0x1c7a35);_0x2a44fa(_0x1ea469['error'](0x1f4,_0x2f834d[_0x32ad('0x15')]));});});};exports[_0x32ad('0x22')]=function(_0x3f28c9){return new Promise(function(_0x1f98e2,_0x4924a3){return db[_0x32ad('0x19')]['find']({'where':_0x3f28c9[_0x32ad('0x1b')]?_0x3f28c9['options'][_0x32ad('0x1d')]||null:null})['then'](function(_0x24f6dd){if(_0x24f6dd){return _0x24f6dd['addTags'](_0x3f28c9['body'][_0x32ad('0x23')],_[_0x32ad('0x24')](_0x3f28c9[_0x32ad('0x1a')],[_0x32ad('0x23'),'id'])||{});}})[_0x32ad('0x25')](function(_0x4b324e){logger['info'](_0x32ad('0x26'),_0x3f28c9);logger[_0x32ad('0x11')](_0x32ad('0x26'),_0x3f28c9,JSON['stringify'](_0x4b324e));_0x1f98e2(_0x4b324e);})[_0x32ad('0x18')](function(_0x37a804){logger[_0x32ad('0x13')](_0x32ad('0x26'),_0x37a804[_0x32ad('0x15')],_0x3f28c9);_0x4924a3(_this[_0x32ad('0x13')](0x1f4,_0x37a804[_0x32ad('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a7dd309..5980f9d 100644 --- a/server/api/chatInteraction/chatInteraction.socket.js +++ b/server/api/chatInteraction/chatInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd019=['register','chatInteraction:','remove','update','emit','removeListener'];(function(_0x5f55b5,_0x372ef9){var _0x489ba1=function(_0x362202){while(--_0x362202){_0x5f55b5['push'](_0x5f55b5['shift']());}};_0x489ba1(++_0x372ef9);}(_0xd019,0x158));var _0x9d01=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0xd019[_0x25fa5c];return _0x1bade2;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x9d01('0x0'),_0x9d01('0x1')];function createListener(_0x5adaef,_0x5406c2){return function(_0x423b2f){_0x5406c2[_0x9d01('0x2')](_0x5adaef,_0x423b2f);};}function removeListener(_0x25563e,_0x1a10fe){return function(){ChatInteractionEvents[_0x9d01('0x3')](_0x25563e,_0x1a10fe);};}exports[_0x9d01('0x4')]=function(_0x24fc1e){for(var _0x3481b4=0x0,_0x5b76ef=events['length'];_0x3481b4<_0x5b76ef;_0x3481b4++){var _0x4c74dc=events[_0x3481b4];var _0xab3a46=createListener(_0x9d01('0x5')+_0x4c74dc,_0x24fc1e);ChatInteractionEvents['on'](_0x4c74dc,_0xab3a46);}}; \ No newline at end of file +var _0x8939=['save','remove','update','emit','removeListener','register','length'];(function(_0x4f7411,_0x591282){var _0x3bfe5b=function(_0x1c5ad0){while(--_0x1c5ad0){_0x4f7411['push'](_0x4f7411['shift']());}};_0x3bfe5b(++_0x591282);}(_0x8939,0x12d));var _0x9893=function(_0x545b6d,_0x1210b2){_0x545b6d=_0x545b6d-0x0;var _0x342968=_0x8939[_0x545b6d];return _0x342968;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x9893('0x0'),_0x9893('0x1'),_0x9893('0x2')];function createListener(_0x574a2c,_0x18ef1e){return function(_0x575fa3){_0x18ef1e[_0x9893('0x3')](_0x574a2c,_0x575fa3);};}function removeListener(_0x27f124,_0x4f85fd){return function(){ChatInteractionEvents[_0x9893('0x4')](_0x27f124,_0x4f85fd);};}exports[_0x9893('0x5')]=function(_0x5aee08){for(var _0x1e1654=0x0,_0x415e95=events[_0x9893('0x6')];_0x1e1654<_0x415e95;_0x1e1654++){var _0x1c97d0=events[_0x1e1654];var _0x13ff86=createListener('chatInteraction:'+_0x1c97d0,_0x5aee08);ChatInteractionEvents['on'](_0x1c97d0,_0x13ff86);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0821c9a..435f3c1 100644 --- a/server/api/chatInteraction/index.js +++ b/server/api/chatInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30be=['download','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','post','single','file','attachmentUpload','/:id/messages','addMessage','chat','put','tracked','update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/my_messages','getMyMessages','/:id/download'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0x30be,0x1e2));var _0xe30b=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x30be[_0x186d17];return _0x5d4b89;};'use strict';var multer=require(_0xe30b('0x0'));var util=require(_0xe30b('0x1'));var path=require(_0xe30b('0x2'));var timeout=require(_0xe30b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe30b('0x4'));var interaction=require(_0xe30b('0x5'));var config=require(_0xe30b('0x6'));var controller=require('./chatInteraction.controller');router[_0xe30b('0x7')]('/',auth[_0xe30b('0x8')](),controller['index']);router[_0xe30b('0x7')](_0xe30b('0x9'),auth[_0xe30b('0x8')](),controller[_0xe30b('0xa')]);router['get'](_0xe30b('0xb'),auth[_0xe30b('0xc')](),controller[_0xe30b('0xd')]);router['get'](_0xe30b('0xe'),auth[_0xe30b('0xc')](),controller['attachmentDownload']);router['get']('/:id/messages',auth[_0xe30b('0x8')](),controller['getMessages']);router[_0xe30b('0x7')](_0xe30b('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xe30b('0x10')]);router[_0xe30b('0x7')](_0xe30b('0x11'),auth['isAuthenticated'](),controller[_0xe30b('0x12')]);router['post']('/',auth[_0xe30b('0x8')](),controller[_0xe30b('0x13')]);router['post'](_0xe30b('0x14'),auth[_0xe30b('0x8')](),controller[_0xe30b('0x15')]);var upload=multer({'storage':multer[_0xe30b('0x16')]({'destination':function(_0x5c3833,_0x19d156,_0x3c5e5e){_0x3c5e5e(null,path[_0xe30b('0x17')](config[_0xe30b('0x18')],_0xe30b('0x19')));},'filename':function(_0x2cdaba,_0x34904c,_0x5bbb47){_0x5bbb47(null,util['format'](_0xe30b('0x1a'),Date[_0xe30b('0x1b')](),_0x34904c[_0xe30b('0x1c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe30b('0x1d')]('/:id/attachment_upload',upload[_0xe30b('0x1e')](_0xe30b('0x1f')),controller[_0xe30b('0x20')]);router[_0xe30b('0x1d')](_0xe30b('0x21'),auth[_0xe30b('0xc')](),controller[_0xe30b('0x22')]);router[_0xe30b('0x1d')]('/:id/tags',auth[_0xe30b('0x8')](),interaction['tracked'](_0xe30b('0x23'),'chatinteraction:addtags'),controller['addTags']);router[_0xe30b('0x24')](_0xe30b('0xb'),auth[_0xe30b('0x8')](),interaction[_0xe30b('0x25')](_0xe30b('0x23'),'chatinteraction:update'),controller[_0xe30b('0x26')]);router['put']('/:id/custom_update',controller[_0xe30b('0x27')]);router[_0xe30b('0x24')](_0xe30b('0x28'),auth['isChatInteractionAuthorized'](),controller[_0xe30b('0x29')]);router['put'](_0xe30b('0x2a'),controller[_0xe30b('0x2b')]);router[_0xe30b('0x2c')](_0xe30b('0xb'),auth['isAuthenticated'](),interaction[_0xe30b('0x25')]('chat',_0xe30b('0x2d')),controller[_0xe30b('0x2e')]);router[_0xe30b('0x2c')](_0xe30b('0x2f'),auth[_0xe30b('0x8')](),controller[_0xe30b('0x30')]);module[_0xe30b('0x31')]=router; \ No newline at end of file +var _0x3a57=['attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','destroy','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file'];(function(_0x2ca743,_0x1b66e7){var _0x4c1fa1=function(_0x1d3f3c){while(--_0x1d3f3c){_0x2ca743['push'](_0x2ca743['shift']());}};_0x4c1fa1(++_0x1b66e7);}(_0x3a57,0x1e6));var _0x73a5=function(_0x49d3c1,_0x574cf3){_0x49d3c1=_0x49d3c1-0x0;var _0x107871=_0x3a57[_0x49d3c1];return _0x107871;};'use strict';var multer=require('multer');var util=require(_0x73a5('0x0'));var path=require(_0x73a5('0x1'));var timeout=require(_0x73a5('0x2'));var express=require('express');var router=express[_0x73a5('0x3')]();var fs_extra=require(_0x73a5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x73a5('0x5'));var config=require(_0x73a5('0x6'));var controller=require('./chatInteraction.controller');router[_0x73a5('0x7')]('/',auth[_0x73a5('0x8')](),controller['index']);router['get'](_0x73a5('0x9'),auth['isAuthenticated'](),controller[_0x73a5('0xa')]);router[_0x73a5('0x7')](_0x73a5('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x73a5('0x7')]('/:id/attachment_download',auth[_0x73a5('0xc')](),controller[_0x73a5('0xd')]);router[_0x73a5('0x7')](_0x73a5('0xe'),auth[_0x73a5('0x8')](),controller['getMessages']);router[_0x73a5('0x7')](_0x73a5('0xf'),auth[_0x73a5('0xc')](),controller[_0x73a5('0x10')]);router[_0x73a5('0x7')](_0x73a5('0x11'),auth['isAuthenticated'](),controller[_0x73a5('0x12')]);router[_0x73a5('0x13')]('/',auth['isAuthenticated'](),controller[_0x73a5('0x14')]);router[_0x73a5('0x13')](_0x73a5('0x15'),auth[_0x73a5('0x8')](),controller[_0x73a5('0x16')]);var upload=multer({'storage':multer[_0x73a5('0x17')]({'destination':function(_0x2935d6,_0x56c7f7,_0x1bcba8){_0x1bcba8(null,path[_0x73a5('0x18')](config[_0x73a5('0x19')],'server/files/attachments/'));},'filename':function(_0x3dd0be,_0x426a2c,_0xa94e2b){_0xa94e2b(null,util[_0x73a5('0x1a')](_0x73a5('0x1b'),Date[_0x73a5('0x1c')](),_0x426a2c[_0x73a5('0x1d')][_0x73a5('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x73a5('0x13')](_0x73a5('0x1f'),upload[_0x73a5('0x20')](_0x73a5('0x21')),controller[_0x73a5('0x22')]);router['post']('/:id/messages',auth[_0x73a5('0xc')](),controller[_0x73a5('0x23')]);router['post'](_0x73a5('0x24'),auth[_0x73a5('0x8')](),interaction[_0x73a5('0x25')](_0x73a5('0x26'),_0x73a5('0x27')),controller[_0x73a5('0x28')]);router[_0x73a5('0x29')]('/:id',auth[_0x73a5('0x8')](),interaction[_0x73a5('0x25')](_0x73a5('0x26'),'chatinteraction:update'),controller[_0x73a5('0x2a')]);router['put'](_0x73a5('0x2b'),controller[_0x73a5('0x2c')]);router[_0x73a5('0x29')](_0x73a5('0x2d'),auth[_0x73a5('0xc')](),controller['abandon']);router['put'](_0x73a5('0x2e'),controller[_0x73a5('0x2f')]);router[_0x73a5('0x30')]('/:id',auth[_0x73a5('0x8')](),interaction[_0x73a5('0x25')](_0x73a5('0x26'),'chatinteraction:destroy'),controller[_0x73a5('0x31')]);router[_0x73a5('0x30')](_0x73a5('0x24'),auth[_0x73a5('0x8')](),controller[_0x73a5('0x32')]);module[_0x73a5('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index e375e63..987d932 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x019a=['medium','BOOLEAN','INTEGER','sequelize','TEXT'];(function(_0x19071f,_0x55eacf){var _0x4695eb=function(_0x8aecf1){while(--_0x8aecf1){_0x19071f['push'](_0x19071f['shift']());}};_0x4695eb(++_0x55eacf);}(_0x019a,0x12a));var _0xa019=function(_0x497489,_0x5215cd){_0x497489=_0x497489-0x0;var _0x48dca7=_0x019a[_0x497489];return _0x48dca7;};'use strict';var Sequelize=require(_0xa019('0x0'));module['exports']={'body':{'type':Sequelize[_0xa019('0x1')](_0xa019('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa019('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa019('0x4')]}}; \ No newline at end of file +var _0xc3b8=['INTEGER','sequelize','TEXT','medium','BOOLEAN'];(function(_0x26d26f,_0x302cce){var _0x5c8c0e=function(_0x519b9d){while(--_0x519b9d){_0x26d26f['push'](_0x26d26f['shift']());}};_0x5c8c0e(++_0x302cce);}(_0xc3b8,0x173));var _0x8c3b=function(_0x3bb89c,_0x3bd0de){_0x3bb89c=_0x3bb89c-0x0;var _0x1f4b69=_0xc3b8[_0x3bb89c];return _0x1f4b69;};'use strict';var Sequelize=require(_0x8c3b('0x0'));module['exports']={'body':{'type':Sequelize[_0x8c3b('0x1')](_0x8c3b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8c3b('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8c3b('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 112d63b..1501362 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.controller.js +++ b/server/api/chatInternalMessage/chatInternalMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe653=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','ChatInternalMessage','includeAll','include','findAll','show','params','find','catch','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','-createdAt','all','eml-format'];(function(_0x1f62e8,_0x4bbb1e){var _0x40db3e=function(_0x65ab61){while(--_0x65ab61){_0x1f62e8['push'](_0x1f62e8['shift']());}};_0x40db3e(++_0x4bbb1e);}(_0xe653,0x161));var _0x3e65=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0xe653[_0x34d346];return _0x122d76;};'use strict';var emlformat=require(_0x3e65('0x0'));var rimraf=require(_0x3e65('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e65('0x2'));var rp=require(_0x3e65('0x3'));var moment=require(_0x3e65('0x4'));var BPromise=require(_0x3e65('0x5'));var Mustache=require(_0x3e65('0x6'));var util=require(_0x3e65('0x7'));var path=require('path');var sox=require(_0x3e65('0x8'));var csv=require(_0x3e65('0x9'));var ejs=require(_0x3e65('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e65('0xb'));var squel=require(_0x3e65('0xc'));var crypto=require(_0x3e65('0xd'));var jsforce=require(_0x3e65('0xe'));var deskjs=require(_0x3e65('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3e65('0x10'));var Papa=require(_0x3e65('0x11'));var Redis=require('ioredis');var authService=require(_0x3e65('0x12'));var qs=require(_0x3e65('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e65('0x14'));var logger=require(_0x3e65('0x15'))(_0x3e65('0x16'));var utils=require(_0x3e65('0x17'));var config=require(_0x3e65('0x18'));var licenseUtil=require(_0x3e65('0x19'));var db=require(_0x3e65('0x1a'))['db'];config[_0x3e65('0x1b')]=_[_0x3e65('0x1c')](config[_0x3e65('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e65('0x1d'))(new Redis(config[_0x3e65('0x1b')]));require('./chatInternalMessage.socket')[_0x3e65('0x1e')](socket);function respondWithStatusCode(_0x348f5e,_0x401e96){_0x401e96=_0x401e96||0xcc;return function(_0x3eead7){if(_0x3eead7){return _0x348f5e[_0x3e65('0x1f')](_0x401e96);}return _0x348f5e['status'](_0x401e96)['end']();};}function respondWithResult(_0x2081f9,_0x21ca86){_0x21ca86=_0x21ca86||0xc8;return function(_0x3ac181){if(_0x3ac181){return _0x2081f9[_0x3e65('0x20')](_0x21ca86)[_0x3e65('0x21')](_0x3ac181);}};}function respondWithFilteredResult(_0x37f384,_0x1673de){return function(_0x4378fd){if(_0x4378fd){var _0x282342=typeof _0x1673de['offset']===_0x3e65('0x22')&&typeof _0x1673de[_0x3e65('0x23')]===_0x3e65('0x22');var _0x4b4b5b=_0x4378fd[_0x3e65('0x24')];var _0x380749=_0x282342?0x0:_0x1673de[_0x3e65('0x25')];var _0x2d81a0=_0x282342?_0x4378fd[_0x3e65('0x24')]:_0x1673de[_0x3e65('0x25')]+_0x1673de[_0x3e65('0x23')];var _0x3ee14a;if(_0x2d81a0>=_0x4b4b5b){_0x2d81a0=_0x4b4b5b;_0x3ee14a=0xc8;}else{_0x3ee14a=0xce;}_0x37f384['status'](_0x3ee14a);return _0x37f384[_0x3e65('0x26')](_0x3e65('0x27'),_0x380749+'-'+_0x2d81a0+'/'+_0x4b4b5b)['json'](_0x4378fd);}return null;};}function patchUpdates(_0x125d23){return function(_0x2fcb2c){try{jsonpatch[_0x3e65('0x28')](_0x2fcb2c,_0x125d23,!![]);}catch(_0x2a5a9f){return BPromise[_0x3e65('0x29')](_0x2a5a9f);}return _0x2fcb2c[_0x3e65('0x2a')]();};}function saveUpdates(_0x38008e,_0xf89b37){return function(_0x5df8a3){if(_0x5df8a3){return _0x5df8a3[_0x3e65('0x2b')](_0x38008e)[_0x3e65('0x2c')](function(_0x3aa01c){return _0x3aa01c;});}return null;};}function removeEntity(_0xd5ce86,_0x5a3ebd){return function(_0x1c74d2){if(_0x1c74d2){return _0x1c74d2['destroy']()[_0x3e65('0x2c')](function(){_0xd5ce86['status'](0xcc)[_0x3e65('0x2d')]();});}};}function handleEntityNotFound(_0x1cc7b6,_0xe49afa){return function(_0x5e471a){if(!_0x5e471a){_0x1cc7b6[_0x3e65('0x1f')](0x194);}return _0x5e471a;};}function handleError(_0x561e1f,_0x36b488){_0x36b488=_0x36b488||0x1f4;return function(_0xde76ec){logger[_0x3e65('0x2e')](_0xde76ec[_0x3e65('0x2f')]);if(_0xde76ec[_0x3e65('0x30')]){delete _0xde76ec[_0x3e65('0x30')];}_0x561e1f[_0x3e65('0x20')](_0x36b488)[_0x3e65('0x31')](_0xde76ec);};}exports['index']=function(_0x48ba25,_0x314d4f){var _0x1a45c6={},_0x447495={},_0x5c1fde={'count':0x0,'rows':[]};var _0x4f1b84=_[_0x3e65('0x32')](db['ChatInternalMessage'][_0x3e65('0x33')],function(_0x4df763){return{'name':_0x4df763[_0x3e65('0x34')],'type':_0x4df763[_0x3e65('0x35')][_0x3e65('0x36')]};});_0x447495['model']=_[_0x3e65('0x32')](_0x4f1b84,_0x3e65('0x30'));_0x447495[_0x3e65('0x37')]=_[_0x3e65('0x38')](_0x48ba25[_0x3e65('0x37')]);_0x447495['filters']=_[_0x3e65('0x39')](_0x447495[_0x3e65('0x3a')],_0x447495[_0x3e65('0x37')]);_0x1a45c6[_0x3e65('0x3b')]=_[_0x3e65('0x39')](_0x447495[_0x3e65('0x3a')],qs[_0x3e65('0x3c')](_0x48ba25[_0x3e65('0x37')][_0x3e65('0x3c')]));_0x1a45c6[_0x3e65('0x3b')]=_0x1a45c6[_0x3e65('0x3b')][_0x3e65('0x3d')]?_0x1a45c6[_0x3e65('0x3b')]:_0x447495[_0x3e65('0x3a')];if(!_0x48ba25[_0x3e65('0x37')][_0x3e65('0x3e')](_0x3e65('0x3f'))){_0x1a45c6['limit']=qs[_0x3e65('0x23')](_0x48ba25[_0x3e65('0x37')][_0x3e65('0x23')]);_0x1a45c6[_0x3e65('0x25')]=qs[_0x3e65('0x25')](_0x48ba25[_0x3e65('0x37')]['offset']);}_0x1a45c6[_0x3e65('0x40')]=qs[_0x3e65('0x41')](_0x48ba25[_0x3e65('0x37')]['sort']);_0x1a45c6[_0x3e65('0x42')]=qs[_0x3e65('0x43')](_[_0x3e65('0x44')](_0x48ba25[_0x3e65('0x37')],_0x447495[_0x3e65('0x43')]),_0x4f1b84);if(_0x48ba25[_0x3e65('0x37')]['filter']){_0x1a45c6[_0x3e65('0x42')]=_[_0x3e65('0x45')](_0x1a45c6[_0x3e65('0x42')],{'$or':_[_0x3e65('0x32')](_0x4f1b84,function(_0x5147f1){if(_0x5147f1[_0x3e65('0x35')]!==_0x3e65('0x46')){var _0x50b02c={};_0x50b02c[_0x5147f1['name']]={'$like':'%'+_0x48ba25[_0x3e65('0x37')][_0x3e65('0x47')]+'%'};return _0x50b02c;}})});}_0x1a45c6=_[_0x3e65('0x45')]({},_0x1a45c6,_0x48ba25[_0x3e65('0x48')]);var _0x521d28={'where':_0x1a45c6['where']};return db[_0x3e65('0x49')]['count'](_0x521d28)['then'](function(_0x14bf12){_0x5c1fde[_0x3e65('0x24')]=_0x14bf12;if(_0x48ba25[_0x3e65('0x37')][_0x3e65('0x4a')]){_0x1a45c6[_0x3e65('0x4b')]=[{'all':!![]}];}return db[_0x3e65('0x49')][_0x3e65('0x4c')](_0x1a45c6);})[_0x3e65('0x2c')](function(_0x40607c){_0x5c1fde['rows']=_0x40607c;return _0x5c1fde;})[_0x3e65('0x2c')](respondWithFilteredResult(_0x314d4f,_0x1a45c6))['catch'](handleError(_0x314d4f,null));};exports[_0x3e65('0x4d')]=function(_0x18cfde,_0x499bab){var _0x56a1f1={'raw':!![],'where':{'id':_0x18cfde[_0x3e65('0x4e')]['id']}},_0x2ef005={};_0x2ef005['model']=_[_0x3e65('0x38')](db[_0x3e65('0x49')][_0x3e65('0x33')]);_0x2ef005[_0x3e65('0x37')]=_['keys'](_0x18cfde[_0x3e65('0x37')]);_0x2ef005[_0x3e65('0x43')]=_[_0x3e65('0x39')](_0x2ef005[_0x3e65('0x3a')],_0x2ef005['query']);_0x56a1f1[_0x3e65('0x3b')]=_[_0x3e65('0x39')](_0x2ef005[_0x3e65('0x3a')],qs[_0x3e65('0x3c')](_0x18cfde['query'][_0x3e65('0x3c')]));_0x56a1f1[_0x3e65('0x3b')]=_0x56a1f1[_0x3e65('0x3b')][_0x3e65('0x3d')]?_0x56a1f1['attributes']:_0x2ef005[_0x3e65('0x3a')];if(_0x18cfde[_0x3e65('0x37')][_0x3e65('0x4a')]){_0x56a1f1['include']=[{'all':!![]}];}_0x56a1f1=_[_0x3e65('0x45')]({},_0x56a1f1,_0x18cfde[_0x3e65('0x48')]);return db[_0x3e65('0x49')][_0x3e65('0x4f')](_0x56a1f1)['then'](handleEntityNotFound(_0x499bab,null))[_0x3e65('0x2c')](respondWithResult(_0x499bab,null))[_0x3e65('0x50')](handleError(_0x499bab,null));};exports[_0x3e65('0x51')]=function(_0x1ee51f,_0x17bef2){return db[_0x3e65('0x49')][_0x3e65('0x51')](_0x1ee51f['body'],{})[_0x3e65('0x2c')](respondWithResult(_0x17bef2,0xc9))[_0x3e65('0x50')](handleError(_0x17bef2,null));};exports[_0x3e65('0x2b')]=function(_0x56abe3,_0x16add8){if(_0x56abe3['body']['id']){delete _0x56abe3[_0x3e65('0x52')]['id'];}return db[_0x3e65('0x49')][_0x3e65('0x4f')]({'where':{'id':_0x56abe3[_0x3e65('0x4e')]['id']}})[_0x3e65('0x2c')](handleEntityNotFound(_0x16add8,null))[_0x3e65('0x2c')](saveUpdates(_0x56abe3[_0x3e65('0x52')],null))[_0x3e65('0x2c')](respondWithResult(_0x16add8,null))['catch'](handleError(_0x16add8,null));};exports[_0x3e65('0x53')]=function(_0x168f00,_0x56add1){return db['ChatInternalMessage'][_0x3e65('0x4f')]({'where':{'id':_0x168f00[_0x3e65('0x4e')]['id']}})[_0x3e65('0x2c')](handleEntityNotFound(_0x56add1,null))['then'](removeEntity(_0x56add1,null))[_0x3e65('0x50')](handleError(_0x56add1,null));};exports[_0x3e65('0x54')]=function(_0x45dda7,_0x4c20ad){return db[_0x3e65('0x49')][_0x3e65('0x54')]()[_0x3e65('0x2c')](respondWithResult(_0x4c20ad,null))[_0x3e65('0x50')](handleError(_0x4c20ad,null));};function wrapUser(_0x1d78d5){return function(_0xbcbcbb){var _0x1d50fe=_0x1d78d5[_0x3e65('0x55')]({'plain':!![]});_0x1d50fe[_0x3e65('0x56')]=[];if(_0xbcbcbb){_0x1d50fe[_0x3e65('0x57')]=_0xbcbcbb[_0x3e65('0x58')];_0x1d50fe[_0x3e65('0x59')]=_0xbcbcbb;}else{_0x1d50fe[_0x3e65('0x57')]=moment(0x0)[_0x3e65('0x5a')](_0x3e65('0x5b'));_0x1d50fe[_0x3e65('0x59')]={};}return _0x1d50fe;};}exports[_0x3e65('0x5c')]=function(_0x52e968,_0x218529,_0x3196ee){var _0x45dae3=[];return db[_0x3e65('0x5d')]['findAll']({'where':{'role':[_0x3e65('0x5e'),_0x3e65('0x5f'),_0x3e65('0x60')]},'attributes':['id',_0x3e65('0x61'),_0x3e65('0x30'),_0x3e65('0x62'),_0x3e65('0x63'),'internal',_0x3e65('0x64'),_0x3e65('0x65'),_0x3e65('0x66'),_0x3e65('0x67')],'order':qs[_0x3e65('0x41')](_0x3e65('0x68')),'include':[{'model':db[_0x3e65('0x69')],'as':_0x3e65('0x6a'),'attributes':['id',_0x3e65('0x30'),_0x3e65('0x35')],'through':{'attributes':[]}}]})[_0x3e65('0x2c')](function(_0x3ca095){if(_0x3ca095){var _0x412587=_0x52e968[_0x3e65('0x60')][_0x3e65('0x55')]({'plain':!![]});if(!_0x412587)throw new Error(_0x3e65('0x6b'));if(_0x412587[_0x3e65('0x62')]===_0x3e65('0x60')){return db[_0x3e65('0x6c')]['find']({'where':{'name':_0x3e65('0x6d'),'userProfileId':_0x412587['userProfileId']},'raw':!![]})['then'](function(_0x2065c9){if(_0x2065c9){if(_0x2065c9[_0x3e65('0x6e')]===0x0){return db[_0x3e65('0x6f')][_0x3e65('0x4c')]({'where':{'sectionId':_0x2065c9['id']},'raw':!![]})[_0x3e65('0x2c')](function(_0x7c9f61){var _0x43b917=[];if(_['isEmpty'](_0x7c9f61)){_0x43b917=_['filter'](_0x3ca095,function(_0x1d24e2){if(_0x1d24e2[_0x3e65('0x62')]!==_0x3e65('0x5e')){return _0x1d24e2;}});return _0x43b917;}else{for(var _0x13f27d=0x0;_0x13f27d<_0x3ca095[_0x3e65('0x3d')];_0x13f27d++){var _0x110def=_0x3ca095[_0x13f27d];if(_0x110def[_0x3e65('0x62')]===_0x3e65('0x5e')){var _0x22ead8=_[_0x3e65('0x4f')](_0x7c9f61,function(_0x1101bc){return _0x1101bc[_0x3e65('0x70')]===_0x110def['id'];});if(_0x22ead8)_0x43b917[_0x3e65('0x71')](_0x110def);}else{_0x43b917[_0x3e65('0x71')](_0x110def);}}return _0x43b917;}});}else{return _0x3ca095;}}else{var _0x6a8af0=_[_0x3e65('0x47')](_0x3ca095,function(_0x36fdb6){if(_0x36fdb6[_0x3e65('0x62')]!==_0x3e65('0x5e')){return _0x36fdb6;}});return _0x6a8af0;}});}else{return _0x3ca095;}}})['then'](function(_0x30dc1e){var _0x539ee4=[];if(_0x30dc1e){_0x45dae3=_0x30dc1e;for(var _0x2b7559=0x0;_0x2b7559<_0x30dc1e[_0x3e65('0x3d')];_0x2b7559+=0x1){_0x45dae3[_0x2b7559][_0x3e65('0x56')]=[];_0x539ee4[_0x3e65('0x71')](db[_0x3e65('0x49')]['find']({'where':{'FromId':[_0x52e968['user']['id'],_0x30dc1e[_0x2b7559]['id']],'ToId':[_0x52e968[_0x3e65('0x60')]['id'],_0x30dc1e[_0x2b7559]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x3e65('0x72'),_0x3e65('0x73'),'read','body'],'order':qs['sort'](_0x3e65('0x74')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3e65('0x2c')](wrapUser(_0x30dc1e[_0x2b7559])));}return BPromise[_0x3e65('0x75')](_0x539ee4);}return[];})[_0x3e65('0x2c')](function(_0x2a1fde){return{'rows':_0x2a1fde,'count':_0x2a1fde['length']};})[_0x3e65('0x2c')](respondWithResult(_0x218529,null))[_0x3e65('0x50')](handleError(_0x218529,null));}; \ No newline at end of file +var _0x4315=['name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','describe','get','messages','lastMessageAt','createdAt','format','lastMessage','User','admin','user','role','online','lastLoginAt','showWebBar','-online','VoiceQueue','UserProfileSection','Agents','userProfileId','autoAssociation','agent','resourceId','push','ToId','read','all','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack'];(function(_0x3be417,_0x1cc829){var _0x3b8b93=function(_0x476ef5){while(--_0x476ef5){_0x3be417['push'](_0x3be417['shift']());}};_0x3b8b93(++_0x1cc829);}(_0x4315,0x17b));var _0x5431=function(_0x5c110c,_0x58d08b){_0x5c110c=_0x5c110c-0x0;var _0x485822=_0x4315[_0x5c110c];return _0x485822;};'use strict';var emlformat=require(_0x5431('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5431('0x1'));var jsonpatch=require(_0x5431('0x2'));var rp=require(_0x5431('0x3'));var moment=require('moment');var BPromise=require(_0x5431('0x4'));var Mustache=require(_0x5431('0x5'));var util=require(_0x5431('0x6'));var path=require(_0x5431('0x7'));var sox=require(_0x5431('0x8'));var csv=require(_0x5431('0x9'));var ejs=require(_0x5431('0xa'));var fs=require('fs');var fs_extra=require(_0x5431('0xb'));var _=require('lodash');var squel=require(_0x5431('0xc'));var crypto=require(_0x5431('0xd'));var jsforce=require(_0x5431('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5431('0x9'));var querystring=require(_0x5431('0xf'));var Papa=require('papaparse');var Redis=require(_0x5431('0x10'));var authService=require(_0x5431('0x11'));var qs=require(_0x5431('0x12'));var as=require(_0x5431('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5431('0x14'));var config=require(_0x5431('0x15'));var licenseUtil=require(_0x5431('0x16'));var db=require(_0x5431('0x17'))['db'];config[_0x5431('0x18')]=_[_0x5431('0x19')](config[_0x5431('0x18')],{'host':_0x5431('0x1a'),'port':0x18eb});var socket=require(_0x5431('0x1b'))(new Redis(config[_0x5431('0x18')]));require(_0x5431('0x1c'))['register'](socket);function respondWithStatusCode(_0x33571e,_0x3a25c8){_0x3a25c8=_0x3a25c8||0xcc;return function(_0x4838d6){if(_0x4838d6){return _0x33571e[_0x5431('0x1d')](_0x3a25c8);}return _0x33571e['status'](_0x3a25c8)['end']();};}function respondWithResult(_0x2a8ff0,_0x43e1ee){_0x43e1ee=_0x43e1ee||0xc8;return function(_0x335147){if(_0x335147){return _0x2a8ff0[_0x5431('0x1e')](_0x43e1ee)[_0x5431('0x1f')](_0x335147);}};}function respondWithFilteredResult(_0x2b0cee,_0x3e058e){return function(_0x3f2380){if(_0x3f2380){var _0x2c8ca6=typeof _0x3e058e[_0x5431('0x20')]===_0x5431('0x21')&&typeof _0x3e058e[_0x5431('0x22')]==='undefined';var _0x2b1004=_0x3f2380[_0x5431('0x23')];var _0x4b2285=_0x2c8ca6?0x0:_0x3e058e[_0x5431('0x20')];var _0x437609=_0x2c8ca6?_0x3f2380[_0x5431('0x23')]:_0x3e058e[_0x5431('0x20')]+_0x3e058e['limit'];var _0x574470;if(_0x437609>=_0x2b1004){_0x437609=_0x2b1004;_0x574470=0xc8;}else{_0x574470=0xce;}_0x2b0cee['status'](_0x574470);return _0x2b0cee[_0x5431('0x24')](_0x5431('0x25'),_0x4b2285+'-'+_0x437609+'/'+_0x2b1004)['json'](_0x3f2380);}return null;};}function patchUpdates(_0x1f9fde){return function(_0x16cd11){try{jsonpatch[_0x5431('0x26')](_0x16cd11,_0x1f9fde,!![]);}catch(_0x2d46fa){return BPromise[_0x5431('0x27')](_0x2d46fa);}return _0x16cd11['save']();};}function saveUpdates(_0x33cf13,_0x4693d6){return function(_0x259845){if(_0x259845){return _0x259845[_0x5431('0x28')](_0x33cf13)[_0x5431('0x29')](function(_0x50019a){return _0x50019a;});}return null;};}function removeEntity(_0x18d897,_0x522cec){return function(_0x29cb14){if(_0x29cb14){return _0x29cb14[_0x5431('0x2a')]()['then'](function(){_0x18d897[_0x5431('0x1e')](0xcc)[_0x5431('0x2b')]();});}};}function handleEntityNotFound(_0x2775ff,_0x477293){return function(_0x530c6e){if(!_0x530c6e){_0x2775ff['sendStatus'](0x194);}return _0x530c6e;};}function handleError(_0x1eb265,_0x9f3a87){_0x9f3a87=_0x9f3a87||0x1f4;return function(_0x1e6577){logger['error'](_0x1e6577[_0x5431('0x2c')]);if(_0x1e6577[_0x5431('0x2d')]){delete _0x1e6577['name'];}_0x1eb265[_0x5431('0x1e')](_0x9f3a87)[_0x5431('0x2e')](_0x1e6577);};}exports[_0x5431('0x2f')]=function(_0x3ec403,_0x5a3a97){var _0x52f799={},_0x3c2fb5={},_0x56f24c={'count':0x0,'rows':[]};var _0x1ec2be=_[_0x5431('0x30')](db[_0x5431('0x31')][_0x5431('0x32')],function(_0x4edea1){return{'name':_0x4edea1[_0x5431('0x33')],'type':_0x4edea1[_0x5431('0x34')][_0x5431('0x35')]};});_0x3c2fb5[_0x5431('0x36')]=_[_0x5431('0x30')](_0x1ec2be,_0x5431('0x2d'));_0x3c2fb5['query']=_[_0x5431('0x37')](_0x3ec403['query']);_0x3c2fb5[_0x5431('0x38')]=_['intersection'](_0x3c2fb5[_0x5431('0x36')],_0x3c2fb5[_0x5431('0x39')]);_0x52f799[_0x5431('0x3a')]=_['intersection'](_0x3c2fb5[_0x5431('0x36')],qs[_0x5431('0x3b')](_0x3ec403[_0x5431('0x39')][_0x5431('0x3b')]));_0x52f799[_0x5431('0x3a')]=_0x52f799[_0x5431('0x3a')][_0x5431('0x3c')]?_0x52f799[_0x5431('0x3a')]:_0x3c2fb5[_0x5431('0x36')];if(!_0x3ec403[_0x5431('0x39')]['hasOwnProperty'](_0x5431('0x3d'))){_0x52f799['limit']=qs[_0x5431('0x22')](_0x3ec403['query']['limit']);_0x52f799[_0x5431('0x20')]=qs['offset'](_0x3ec403['query']['offset']);}_0x52f799[_0x5431('0x3e')]=qs[_0x5431('0x3f')](_0x3ec403[_0x5431('0x39')][_0x5431('0x3f')]);_0x52f799[_0x5431('0x40')]=qs[_0x5431('0x38')](_[_0x5431('0x41')](_0x3ec403[_0x5431('0x39')],_0x3c2fb5[_0x5431('0x38')]),_0x1ec2be);if(_0x3ec403['query']['filter']){_0x52f799[_0x5431('0x40')]=_[_0x5431('0x42')](_0x52f799[_0x5431('0x40')],{'$or':_[_0x5431('0x30')](_0x1ec2be,function(_0x2e3da1){if(_0x2e3da1[_0x5431('0x34')]!==_0x5431('0x43')){var _0x4e38a5={};_0x4e38a5[_0x2e3da1['name']]={'$like':'%'+_0x3ec403[_0x5431('0x39')][_0x5431('0x44')]+'%'};return _0x4e38a5;}})});}_0x52f799=_['merge']({},_0x52f799,_0x3ec403[_0x5431('0x45')]);var _0x33e635={'where':_0x52f799['where']};return db['ChatInternalMessage'][_0x5431('0x23')](_0x33e635)[_0x5431('0x29')](function(_0x37ed32){_0x56f24c[_0x5431('0x23')]=_0x37ed32;if(_0x3ec403[_0x5431('0x39')][_0x5431('0x46')]){_0x52f799[_0x5431('0x47')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x5431('0x48')](_0x52f799);})[_0x5431('0x29')](function(_0x421372){_0x56f24c['rows']=_0x421372;return _0x56f24c;})[_0x5431('0x29')](respondWithFilteredResult(_0x5a3a97,_0x52f799))[_0x5431('0x49')](handleError(_0x5a3a97,null));};exports[_0x5431('0x4a')]=function(_0x362e00,_0x7d131d){var _0x159c61={'raw':!![],'where':{'id':_0x362e00[_0x5431('0x4b')]['id']}},_0x57c5bd={};_0x57c5bd[_0x5431('0x36')]=_[_0x5431('0x37')](db[_0x5431('0x31')][_0x5431('0x32')]);_0x57c5bd['query']=_['keys'](_0x362e00[_0x5431('0x39')]);_0x57c5bd[_0x5431('0x38')]=_[_0x5431('0x4c')](_0x57c5bd[_0x5431('0x36')],_0x57c5bd[_0x5431('0x39')]);_0x159c61[_0x5431('0x3a')]=_['intersection'](_0x57c5bd[_0x5431('0x36')],qs[_0x5431('0x3b')](_0x362e00[_0x5431('0x39')][_0x5431('0x3b')]));_0x159c61['attributes']=_0x159c61[_0x5431('0x3a')][_0x5431('0x3c')]?_0x159c61['attributes']:_0x57c5bd['model'];if(_0x362e00[_0x5431('0x39')]['includeAll']){_0x159c61[_0x5431('0x47')]=[{'all':!![]}];}_0x159c61=_[_0x5431('0x42')]({},_0x159c61,_0x362e00[_0x5431('0x45')]);return db[_0x5431('0x31')][_0x5431('0x4d')](_0x159c61)[_0x5431('0x29')](handleEntityNotFound(_0x7d131d,null))[_0x5431('0x29')](respondWithResult(_0x7d131d,null))[_0x5431('0x49')](handleError(_0x7d131d,null));};exports['create']=function(_0x53d0cd,_0x35c869){return db[_0x5431('0x31')][_0x5431('0x4e')](_0x53d0cd[_0x5431('0x4f')],{})[_0x5431('0x29')](respondWithResult(_0x35c869,0xc9))[_0x5431('0x49')](handleError(_0x35c869,null));};exports[_0x5431('0x28')]=function(_0x5a83b5,_0x2765e7){if(_0x5a83b5['body']['id']){delete _0x5a83b5[_0x5431('0x4f')]['id'];}return db[_0x5431('0x31')][_0x5431('0x4d')]({'where':{'id':_0x5a83b5[_0x5431('0x4b')]['id']}})[_0x5431('0x29')](handleEntityNotFound(_0x2765e7,null))['then'](saveUpdates(_0x5a83b5[_0x5431('0x4f')],null))[_0x5431('0x29')](respondWithResult(_0x2765e7,null))['catch'](handleError(_0x2765e7,null));};exports[_0x5431('0x2a')]=function(_0x319fc1,_0x406d13){return db[_0x5431('0x31')][_0x5431('0x4d')]({'where':{'id':_0x319fc1[_0x5431('0x4b')]['id']}})[_0x5431('0x29')](handleEntityNotFound(_0x406d13,null))['then'](removeEntity(_0x406d13,null))[_0x5431('0x49')](handleError(_0x406d13,null));};exports[_0x5431('0x50')]=function(_0x37c751,_0x21594f){return db[_0x5431('0x31')][_0x5431('0x50')]()[_0x5431('0x29')](respondWithResult(_0x21594f,null))[_0x5431('0x49')](handleError(_0x21594f,null));};function wrapUser(_0x1be936){return function(_0x185138){var _0x1f95d7=_0x1be936[_0x5431('0x51')]({'plain':!![]});_0x1f95d7[_0x5431('0x52')]=[];if(_0x185138){_0x1f95d7[_0x5431('0x53')]=_0x185138[_0x5431('0x54')];_0x1f95d7['lastMessage']=_0x185138;}else{_0x1f95d7[_0x5431('0x53')]=moment(0x0)[_0x5431('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f95d7[_0x5431('0x56')]={};}return _0x1f95d7;};}exports['getUsers']=function(_0x5ca8bf,_0x217fb5,_0x42616d){var _0x5eea47=[];return db[_0x5431('0x57')][_0x5431('0x48')]({'where':{'role':['agent',_0x5431('0x58'),_0x5431('0x59')]},'attributes':['id','fullname',_0x5431('0x2d'),_0x5431('0x5a'),'userpic','internal',_0x5431('0x5b'),_0x5431('0x5c'),'allowmessenger',_0x5431('0x5d')],'order':qs['sort'](_0x5431('0x5e')),'include':[{'model':db[_0x5431('0x5f')],'as':'VoiceQueues','attributes':['id',_0x5431('0x2d'),_0x5431('0x34')],'through':{'attributes':[]}}]})['then'](function(_0x3c684b){if(_0x3c684b){var _0x3ebf2f=_0x5ca8bf['user']['get']({'plain':!![]});if(!_0x3ebf2f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ebf2f[_0x5431('0x5a')]===_0x5431('0x59')){return db[_0x5431('0x60')]['find']({'where':{'name':_0x5431('0x61'),'userProfileId':_0x3ebf2f[_0x5431('0x62')]},'raw':!![]})[_0x5431('0x29')](function(_0x354835){if(_0x354835){if(_0x354835[_0x5431('0x63')]===0x0){return db['UserProfileResource'][_0x5431('0x48')]({'where':{'sectionId':_0x354835['id']},'raw':!![]})[_0x5431('0x29')](function(_0x4a999f){var _0x304aa9=[];if(_['isEmpty'](_0x4a999f)){_0x304aa9=_[_0x5431('0x44')](_0x3c684b,function(_0x5cb5a6){if(_0x5cb5a6[_0x5431('0x5a')]!==_0x5431('0x64')){return _0x5cb5a6;}});return _0x304aa9;}else{for(var _0x5631da=0x0;_0x5631da<_0x3c684b[_0x5431('0x3c')];_0x5631da++){var _0x47a51d=_0x3c684b[_0x5631da];if(_0x47a51d['role']===_0x5431('0x64')){var _0x209799=_[_0x5431('0x4d')](_0x4a999f,function(_0x3acbff){return _0x3acbff[_0x5431('0x65')]===_0x47a51d['id'];});if(_0x209799)_0x304aa9[_0x5431('0x66')](_0x47a51d);}else{_0x304aa9['push'](_0x47a51d);}}return _0x304aa9;}});}else{return _0x3c684b;}}else{var _0xfaafc=_[_0x5431('0x44')](_0x3c684b,function(_0x50a777){if(_0x50a777[_0x5431('0x5a')]!==_0x5431('0x64')){return _0x50a777;}});return _0xfaafc;}});}else{return _0x3c684b;}}})[_0x5431('0x29')](function(_0x11d170){var _0x4eab19=[];if(_0x11d170){_0x5eea47=_0x11d170;for(var _0x8a01a1=0x0;_0x8a01a1<_0x11d170['length'];_0x8a01a1+=0x1){_0x5eea47[_0x8a01a1]['messages']=[];_0x4eab19[_0x5431('0x66')](db[_0x5431('0x31')]['find']({'where':{'FromId':[_0x5ca8bf[_0x5431('0x59')]['id'],_0x11d170[_0x8a01a1]['id']],'ToId':[_0x5ca8bf[_0x5431('0x59')]['id'],_0x11d170[_0x8a01a1]['id']],'ChatGroupId':null},'attributes':['id',_0x5431('0x54'),'FromId',_0x5431('0x67'),_0x5431('0x68'),'body'],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x11d170[_0x8a01a1])));}return BPromise[_0x5431('0x69')](_0x4eab19);}return[];})[_0x5431('0x29')](function(_0x439d5c){return{'rows':_0x439d5c,'count':_0x439d5c[_0x5431('0x3c')]};})['then'](respondWithResult(_0x217fb5,null))[_0x5431('0x49')](handleError(_0x217fb5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 928df64..7d96255 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.events.js +++ b/server/api/chatInternalMessage/chatInternalMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe32a=['hook','exports','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x53407c,_0x37badf){var _0x20311d=function(_0x2532e4){while(--_0x2532e4){_0x53407c['push'](_0x53407c['shift']());}};_0x20311d(++_0x37badf);}(_0xe32a,0x192));var _0xae32=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xe32a[_0x1d87fc];return _0x492b56;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xae32('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xae32('0x1')](0x0);var events={'afterCreate':_0xae32('0x2'),'afterUpdate':'update','afterDestroy':_0xae32('0x3')};function emitEvent(_0x323e4f){return function(_0x54cb30,_0xa9db,_0x1f5dfe){ChatInternalMessageEvents[_0xae32('0x4')](_0x323e4f+':'+_0x54cb30['id'],_0x54cb30);ChatInternalMessageEvents[_0xae32('0x4')](_0x323e4f,_0x54cb30);_0x1f5dfe(null);};}for(var e in events){if(events[_0xae32('0x5')](e)){var event=events[e];ChatInternalMessage[_0xae32('0x6')](e,emitEvent(event));}}module[_0xae32('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x3adb=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x4c157e,_0x10526a){var _0x293d33=function(_0x57c424){while(--_0x57c424){_0x4c157e['push'](_0x4c157e['shift']());}};_0x293d33(++_0x10526a);}(_0x3adb,0xd3));var _0xb3ad=function(_0x3e2212,_0x39d19d){_0x3e2212=_0x3e2212-0x0;var _0x4ff8c7=_0x3adb[_0x3e2212];return _0x4ff8c7;};'use strict';var EventEmitter=require(_0xb3ad('0x0'));var ChatInternalMessage=require(_0xb3ad('0x1'))['db'][_0xb3ad('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb3ad('0x3')](0x0);var events={'afterCreate':_0xb3ad('0x4'),'afterUpdate':'update','afterDestroy':_0xb3ad('0x5')};function emitEvent(_0x411222){return function(_0x3a11d3,_0x4025d3,_0x5f2038){ChatInternalMessageEvents[_0xb3ad('0x6')](_0x411222+':'+_0x3a11d3['id'],_0x3a11d3);ChatInternalMessageEvents[_0xb3ad('0x6')](_0x411222,_0x3a11d3);_0x5f2038(null);};}for(var e in events){if(events[_0xb3ad('0x7')](e)){var event=events[e];ChatInternalMessage[_0xb3ad('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index db042ea..8258390 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.model.js +++ b/server/api/chatInternalMessage/chatInternalMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbb3=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4b1665,_0xb0c095){var _0x5850c0=function(_0x44b7a4){while(--_0x44b7a4){_0x4b1665['push'](_0x4b1665['shift']());}};_0x5850c0(++_0xb0c095);}(_0xbbb3,0x1d4));var _0x3bbb=function(_0x26a561,_0x111c5a){_0x26a561=_0x26a561-0x0;var _0x13a1a0=_0xbbb3[_0x26a561];return _0x13a1a0;};'use strict';var _=require(_0x3bbb('0x0'));var util=require(_0x3bbb('0x1'));var logger=require(_0x3bbb('0x2'))(_0x3bbb('0x3'));var moment=require(_0x3bbb('0x4'));var BPromise=require(_0x3bbb('0x5'));var rp=require(_0x3bbb('0x6'));var fs=require('fs');var path=require(_0x3bbb('0x7'));var rimraf=require(_0x3bbb('0x8'));var config=require(_0x3bbb('0x9'));var attributes=require(_0x3bbb('0xa'));module[_0x3bbb('0xb')]=function(_0x44e523,_0x15b947){return _0x44e523['define'](_0x3bbb('0xc'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3bbb('0xd')});}; \ No newline at end of file +var _0x4f94=['./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x318e54,_0x468a09){var _0x528c14=function(_0x266c42){while(--_0x266c42){_0x318e54['push'](_0x318e54['shift']());}};_0x528c14(++_0x468a09);}(_0x4f94,0x16d));var _0x44f9=function(_0x14075f,_0x567a02){_0x14075f=_0x14075f-0x0;var _0x3e76a8=_0x4f94[_0x14075f];return _0x3e76a8;};'use strict';var _=require('lodash');var util=require(_0x44f9('0x0'));var logger=require(_0x44f9('0x1'))(_0x44f9('0x2'));var moment=require('moment');var BPromise=require(_0x44f9('0x3'));var rp=require(_0x44f9('0x4'));var fs=require('fs');var path=require(_0x44f9('0x5'));var rimraf=require('rimraf');var config=require(_0x44f9('0x6'));var attributes=require(_0x44f9('0x7'));module[_0x44f9('0x8')]=function(_0x4a4b80,_0x383e9f){return _0x4a4b80[_0x44f9('0x9')](_0x44f9('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x44f9('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b0009a9..a6d69ce 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.rpc.js +++ b/server/api/chatInternalMessage/chatInternalMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc117=['http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5b92b5,_0xb074e7){var _0xd2798c=function(_0x4852ad){while(--_0x4852ad){_0x5b92b5['push'](_0x5b92b5['shift']());}};_0xd2798c(++_0xb074e7);}(_0xc117,0x12a));var _0x7c11=function(_0x59ecbe,_0xbd740d){_0x59ecbe=_0x59ecbe-0x0;var _0xd98b7c=_0xc117[_0x59ecbe];return _0xd98b7c;};'use strict';var _=require('lodash');var util=require(_0x7c11('0x0'));var moment=require(_0x7c11('0x1'));var BPromise=require(_0x7c11('0x2'));var rs=require(_0x7c11('0x3'));var fs=require('fs');var Redis=require(_0x7c11('0x4'));var db=require(_0x7c11('0x5'))['db'];var utils=require(_0x7c11('0x6'));var logger=require(_0x7c11('0x7'))(_0x7c11('0x8'));var config=require('../../config/environment');var jayson=require(_0x7c11('0x9'));var client=jayson['client'][_0x7c11('0xa')]({'port':0x232a});config[_0x7c11('0xb')]=_[_0x7c11('0xc')](config[_0x7c11('0xb')],{'host':_0x7c11('0xd'),'port':0x18eb});var socket=require(_0x7c11('0xe'))(new Redis(config[_0x7c11('0xb')]));require(_0x7c11('0xf'))[_0x7c11('0x10')](socket);function respondWithRpcPromise(_0x3c3393,_0x47a8f7,_0x1c54b6){return new BPromise(function(_0x5ca43b,_0x24b75c){return client[_0x7c11('0x11')](_0x3c3393,_0x1c54b6)[_0x7c11('0x12')](function(_0x1b2377){logger[_0x7c11('0x13')](_0x7c11('0x14'),_0x47a8f7,_0x7c11('0x15'));logger[_0x7c11('0x16')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x47a8f7,'request\x20sent',JSON['stringify'](_0x1b2377));if(_0x1b2377[_0x7c11('0x17')]){if(_0x1b2377[_0x7c11('0x17')][_0x7c11('0x18')]===0x1f4){logger['error'](_0x7c11('0x14'),_0x47a8f7,_0x1b2377['error'][_0x7c11('0x19')]);return _0x24b75c(_0x1b2377[_0x7c11('0x17')][_0x7c11('0x19')]);}logger['error'](_0x7c11('0x14'),_0x47a8f7,_0x1b2377[_0x7c11('0x17')][_0x7c11('0x19')]);return _0x5ca43b(_0x1b2377['error'][_0x7c11('0x19')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x47a8f7,_0x7c11('0x15'));_0x5ca43b(_0x1b2377[_0x7c11('0x1a')][_0x7c11('0x19')]);}})[_0x7c11('0x1b')](function(_0x49a744){logger['error'](_0x7c11('0x14'),_0x47a8f7,_0x49a744);_0x24b75c(_0x49a744);});});} \ No newline at end of file +var _0x4ed0=['./chatInternalMessage.socket','register','request','then','request\x20sent','debug','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4ed0,0x79));var _0x04ed=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4ed0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x04ed('0x0'));var util=require('util');var moment=require(_0x04ed('0x1'));var BPromise=require('bluebird');var rs=require(_0x04ed('0x2'));var fs=require('fs');var Redis=require(_0x04ed('0x3'));var db=require(_0x04ed('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x04ed('0x5'))(_0x04ed('0x6'));var config=require('../../config/environment');var jayson=require(_0x04ed('0x7'));var client=jayson[_0x04ed('0x8')][_0x04ed('0x9')]({'port':0x232a});config[_0x04ed('0xa')]=_[_0x04ed('0xb')](config[_0x04ed('0xa')],{'host':_0x04ed('0xc'),'port':0x18eb});var socket=require(_0x04ed('0xd'))(new Redis(config[_0x04ed('0xa')]));require(_0x04ed('0xe'))[_0x04ed('0xf')](socket);function respondWithRpcPromise(_0x4351ab,_0xc00c5c,_0x74f626){return new BPromise(function(_0x54d8e6,_0xdc4ea1){return client[_0x04ed('0x10')](_0x4351ab,_0x74f626)[_0x04ed('0x11')](function(_0x5e0c16){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0xc00c5c,_0x04ed('0x12'));logger[_0x04ed('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xc00c5c,_0x04ed('0x12'),JSON[_0x04ed('0x14')](_0x5e0c16));if(_0x5e0c16[_0x04ed('0x15')]){if(_0x5e0c16['error'][_0x04ed('0x16')]===0x1f4){logger[_0x04ed('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0xc00c5c,_0x5e0c16[_0x04ed('0x15')]['message']);return _0xdc4ea1(_0x5e0c16[_0x04ed('0x15')][_0x04ed('0x17')]);}logger[_0x04ed('0x15')](_0x04ed('0x18'),_0xc00c5c,_0x5e0c16[_0x04ed('0x15')][_0x04ed('0x17')]);return _0x54d8e6(_0x5e0c16['error']['message']);}else{logger[_0x04ed('0x19')](_0x04ed('0x18'),_0xc00c5c,_0x04ed('0x12'));_0x54d8e6(_0x5e0c16['result']['message']);}})[_0x04ed('0x1a')](function(_0x270ccc){logger[_0x04ed('0x15')](_0x04ed('0x18'),_0xc00c5c,_0x270ccc);_0xdc4ea1(_0x270ccc);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 2c8b8b2..8102e2f 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.socket.js +++ b/server/api/chatInternalMessage/chatInternalMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2483=['register','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x54fb94,_0x4bb157){var _0xa6a4b8=function(_0x2017d1){while(--_0x2017d1){_0x54fb94['push'](_0x54fb94['shift']());}};_0xa6a4b8(++_0x4bb157);}(_0x2483,0xa2));var _0x3248=function(_0x4a5ce5,_0x1952f2){_0x4a5ce5=_0x4a5ce5-0x0;var _0x3058e9=_0x2483[_0x4a5ce5];return _0x3058e9;};'use strict';var ChatInternalMessageEvents=require(_0x3248('0x0'));var events=[_0x3248('0x1'),_0x3248('0x2'),_0x3248('0x3')];function createListener(_0xb7e27f,_0x321c19){return function(_0x15e14b){_0x321c19[_0x3248('0x4')](_0xb7e27f,_0x15e14b);};}function removeListener(_0x594685,_0x480645){return function(){ChatInternalMessageEvents[_0x3248('0x5')](_0x594685,_0x480645);};}exports[_0x3248('0x6')]=function(_0x1dbeef){for(var _0x1e2e44=0x0,_0x39d1cc=events['length'];_0x1e2e44<_0x39d1cc;_0x1e2e44++){var _0x5ca10e=events[_0x1e2e44];var _0x436719=createListener(_0x3248('0x7')+_0x5ca10e,_0x1dbeef);ChatInternalMessageEvents['on'](_0x5ca10e,_0x436719);}}; \ No newline at end of file +var _0x8fb4=['remove','update','emit','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0x8fb4,0x156));var _0x48fb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8fb4[_0xa464c9];return _0x3d73c4;};'use strict';var ChatInternalMessageEvents=require(_0x48fb('0x0'));var events=['save',_0x48fb('0x1'),_0x48fb('0x2')];function createListener(_0x4f857b,_0x2a4bae){return function(_0x1db893){_0x2a4bae[_0x48fb('0x3')](_0x4f857b,_0x1db893);};}function removeListener(_0x2dbe46,_0x1a76ae){return function(){ChatInternalMessageEvents['removeListener'](_0x2dbe46,_0x1a76ae);};}exports[_0x48fb('0x4')]=function(_0x5e3ea0){for(var _0x452acf=0x0,_0x513eb2=events[_0x48fb('0x5')];_0x452acf<_0x513eb2;_0x452acf++){var _0x413cf9=events[_0x452acf];var _0x1ede6c=createListener(_0x48fb('0x6')+_0x413cf9,_0x5e3ea0);ChatInternalMessageEvents['on'](_0x413cf9,_0x1ede6c);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4f99e10..c5e8b3d 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x044d=['show','post','create','put','update','delete','exports','util','path','./chatInternalMessage.controller','get','index','isAuthenticated','describe','/users','getUsers','/:id'];(function(_0x1a6c7c,_0x53b594){var _0x58b681=function(_0x5f00a7){while(--_0x5f00a7){_0x1a6c7c['push'](_0x1a6c7c['shift']());}};_0x58b681(++_0x53b594);}(_0x044d,0xd3));var _0xd044=function(_0x9f79ec,_0x18cfb8){_0x9f79ec=_0x9f79ec-0x0;var _0x6f41cb=_0x044d[_0x9f79ec];return _0x6f41cb;};'use strict';var multer=require('multer');var util=require(_0xd044('0x0'));var path=require(_0xd044('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd044('0x2'));router[_0xd044('0x3')]('/',auth['isAuthenticated'](),controller[_0xd044('0x4')]);router[_0xd044('0x3')]('/describe',auth[_0xd044('0x5')](),controller[_0xd044('0x6')]);router[_0xd044('0x3')](_0xd044('0x7'),auth[_0xd044('0x5')](),controller[_0xd044('0x8')]);router[_0xd044('0x3')](_0xd044('0x9'),auth[_0xd044('0x5')](),controller[_0xd044('0xa')]);router[_0xd044('0xb')]('/',auth['isAuthenticated'](),controller[_0xd044('0xc')]);router[_0xd044('0xd')](_0xd044('0x9'),controller[_0xd044('0xe')]);router[_0xd044('0xf')](_0xd044('0x9'),auth[_0xd044('0x5')](),controller['destroy']);module[_0xd044('0x10')]=router; \ No newline at end of file +var _0xc149=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/users','/:id','show','put','util','path','express','fs-extra','../../components/auth/service'];(function(_0x509482,_0x5ab7e7){var _0x35f955=function(_0x58d5f9){while(--_0x58d5f9){_0x509482['push'](_0x509482['shift']());}};_0x35f955(++_0x5ab7e7);}(_0xc149,0x73));var _0x9c14=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc149[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x9c14('0x0'));var path=require(_0x9c14('0x1'));var timeout=require('connect-timeout');var express=require(_0x9c14('0x2'));var router=express['Router']();var fs_extra=require(_0x9c14('0x3'));var auth=require(_0x9c14('0x4'));var interaction=require(_0x9c14('0x5'));var config=require(_0x9c14('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x9c14('0x7')]('/',auth[_0x9c14('0x8')](),controller[_0x9c14('0x9')]);router[_0x9c14('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x9c14('0xa')]);router[_0x9c14('0x7')](_0x9c14('0xb'),auth[_0x9c14('0x8')](),controller['getUsers']);router[_0x9c14('0x7')](_0x9c14('0xc'),auth[_0x9c14('0x8')](),controller[_0x9c14('0xd')]);router['post']('/',auth[_0x9c14('0x8')](),controller['create']);router[_0x9c14('0xe')](_0x9c14('0xc'),controller['update']);router['delete'](_0x9c14('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index c15afd4..98615b4 100644 --- a/server/api/chatMessage/chatMessage.attributes.js +++ b/server/api/chatMessage/chatMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x574d=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x574d,0xc0));var _0xd574=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x574d[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0xd574('0x0'));module[_0xd574('0x1')]={'body':{'type':Sequelize[_0xd574('0x2')](_0xd574('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd574('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd574('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd574('0x5')]('in','out'),'defaultValue':_0xd574('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd574('0x7')]},'providerName':{'type':Sequelize[_0xd574('0x8')]},'providerResponse':{'type':Sequelize[_0xd574('0x2')]}}; \ No newline at end of file +var _0xbc9d=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x5e2862,_0x4760eb){var _0x8dcad4=function(_0x205ddf){while(--_0x205ddf){_0x5e2862['push'](_0x5e2862['shift']());}};_0x8dcad4(++_0x4760eb);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x272105,_0x5486dc){_0x272105=_0x272105-0x0;var _0x4f1470=_0xbc9d[_0x272105];return _0x4f1470;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'body':{'type':Sequelize[_0xdbc9('0x2')](_0xdbc9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdbc9('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xdbc9('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xdbc9('0x6')]},'providerName':{'type':Sequelize[_0xdbc9('0x7')]},'providerResponse':{'type':Sequelize[_0xdbc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 78b8f45..8fc7e7f 100644 --- a/server/api/chatMessage/chatMessage.controller.js +++ b/server/api/chatMessage/chatMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86dc=['destroy','describe','chat-interactions','accept','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','format','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','motionChannel','rejectmessage','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','stack','name','send','index','ChatMessage','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0xb28123,_0x4adf7c){var _0xd4e5f0=function(_0x11bf8e){while(--_0x11bf8e){_0xb28123['push'](_0xb28123['shift']());}};_0xd4e5f0(++_0x4adf7c);}(_0x86dc,0x13e));var _0xc86d=function(_0x35bb81,_0x3c411f){_0x35bb81=_0x35bb81-0x0;var _0x55f13a=_0x86dc[_0x35bb81];return _0x55f13a;};'use strict';var emlformat=require(_0xc86d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc86d('0x1'));var rp=require(_0xc86d('0x2'));var moment=require(_0xc86d('0x3'));var BPromise=require(_0xc86d('0x4'));var Mustache=require('mustache');var util=require(_0xc86d('0x5'));var path=require('path');var sox=require(_0xc86d('0x6'));var csv=require('to-csv');var ejs=require(_0xc86d('0x7'));var fs=require('fs');var fs_extra=require(_0xc86d('0x8'));var _=require(_0xc86d('0x9'));var squel=require('squel');var crypto=require(_0xc86d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc86d('0xb'));var toCsv=require(_0xc86d('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc86d('0xd'));var authService=require(_0xc86d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc86d('0xf'));var hardwareService=require(_0xc86d('0x10'));var logger=require(_0xc86d('0x11'))(_0xc86d('0x12'));var utils=require(_0xc86d('0x13'));var config=require(_0xc86d('0x14'));var licenseUtil=require(_0xc86d('0x15'));var db=require(_0xc86d('0x16'))['db'];config[_0xc86d('0x17')]=_[_0xc86d('0x18')](config[_0xc86d('0x17')],{'host':_0xc86d('0x19'),'port':0x18eb});var socket=require(_0xc86d('0x1a'))(new Redis(config[_0xc86d('0x17')]));require(_0xc86d('0x1b'))[_0xc86d('0x1c')](socket);var jayson=require(_0xc86d('0x1d'));var client=jayson[_0xc86d('0x1e')][_0xc86d('0x1f')]({'port':0x232c});var client9002=jayson[_0xc86d('0x1e')][_0xc86d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5e58aa,_0x4fb8e7,_0x49af1f,_0x3a253c){return new BPromise(function(_0x376a90,_0x17f576){var _0x2a9459=_0x3a253c||client;return _0x2a9459[_0xc86d('0x20')](_0x5e58aa,_0x49af1f)[_0xc86d('0x21')](function(_0x279406){logger['info']('ChatMessage,\x20%s,\x20%s',_0x4fb8e7,_0xc86d('0x22'));logger[_0xc86d('0x23')](_0xc86d('0x24'),_0x4fb8e7,'request\x20sent',JSON[_0xc86d('0x25')](_0x279406));if(_0x279406[_0xc86d('0x26')]){if(_0x279406[_0xc86d('0x26')]['code']===0x1f4){logger[_0xc86d('0x26')](_0xc86d('0x27'),_0x4fb8e7,_0x279406['error'][_0xc86d('0x28')]);return _0x17f576(_0x279406[_0xc86d('0x26')][_0xc86d('0x28')]);}logger[_0xc86d('0x26')]('ChatMessage,\x20%s,\x20%s',_0x4fb8e7,_0x279406[_0xc86d('0x26')][_0xc86d('0x28')]);return _0x376a90(_0x279406[_0xc86d('0x26')][_0xc86d('0x28')]);}else{logger[_0xc86d('0x29')]('ChatMessage,\x20%s,\x20%s',_0x4fb8e7,_0xc86d('0x22'));_0x376a90(_0x279406[_0xc86d('0x2a')][_0xc86d('0x28')]);}})[_0xc86d('0x2b')](function(_0x27d636){logger['error'](_0xc86d('0x27'),_0x4fb8e7,_0x27d636);_0x17f576(_0x27d636);});});}function respondWithStatusCode(_0x54303e,_0x4e1312){_0x4e1312=_0x4e1312||0xcc;return function(_0x533cce){if(_0x533cce){return _0x54303e[_0xc86d('0x2c')](_0x4e1312);}return _0x54303e[_0xc86d('0x2d')](_0x4e1312)[_0xc86d('0x2e')]();};}function respondWithResult(_0x1e29be,_0xd8b255){_0xd8b255=_0xd8b255||0xc8;return function(_0x1ad978){if(_0x1ad978){return _0x1e29be[_0xc86d('0x2d')](_0xd8b255)[_0xc86d('0x2f')](_0x1ad978);}};}function respondWithFilteredResult(_0x4db581,_0x397a55){return function(_0x2bce7b){if(_0x2bce7b){var _0x581a9e=typeof _0x397a55['offset']===_0xc86d('0x30')&&typeof _0x397a55[_0xc86d('0x31')]===_0xc86d('0x30');var _0x271b23=_0x2bce7b[_0xc86d('0x32')];var _0x217415=_0x581a9e?0x0:_0x397a55[_0xc86d('0x33')];var _0x5a4ef1=_0x581a9e?_0x2bce7b['count']:_0x397a55[_0xc86d('0x33')]+_0x397a55[_0xc86d('0x31')];var _0x18e468;if(_0x5a4ef1>=_0x271b23){_0x5a4ef1=_0x271b23;_0x18e468=0xc8;}else{_0x18e468=0xce;}_0x4db581[_0xc86d('0x2d')](_0x18e468);return _0x4db581[_0xc86d('0x34')]('Content-Range',_0x217415+'-'+_0x5a4ef1+'/'+_0x271b23)[_0xc86d('0x2f')](_0x2bce7b);}return null;};}function patchUpdates(_0x5ba241){return function(_0xc539d0){try{jsonpatch[_0xc86d('0x35')](_0xc539d0,_0x5ba241,!![]);}catch(_0x1f01f7){return BPromise[_0xc86d('0x36')](_0x1f01f7);}return _0xc539d0[_0xc86d('0x37')]();};}function saveUpdates(_0x1d7fe8,_0x119b54){return function(_0x100258){if(_0x100258){return _0x100258[_0xc86d('0x38')](_0x1d7fe8)['then'](function(_0x557a73){return _0x557a73;});}return null;};}function removeEntity(_0x52c552,_0x4ce856){return function(_0x50d014){if(_0x50d014){return _0x50d014['destroy']()[_0xc86d('0x21')](function(){_0x52c552[_0xc86d('0x2d')](0xcc)[_0xc86d('0x2e')]();});}};}function handleEntityNotFound(_0x118007,_0x2cba68){return function(_0x225a25){if(!_0x225a25){_0x118007['sendStatus'](0x194);}return _0x225a25;};}function handleError(_0x3b0940,_0x288c34){_0x288c34=_0x288c34||0x1f4;return function(_0x34cb84){logger[_0xc86d('0x26')](_0x34cb84[_0xc86d('0x39')]);if(_0x34cb84[_0xc86d('0x3a')]){delete _0x34cb84[_0xc86d('0x3a')];}_0x3b0940[_0xc86d('0x2d')](_0x288c34)[_0xc86d('0x3b')](_0x34cb84);};}exports[_0xc86d('0x3c')]=function(_0x5e4b08,_0x247560){var _0x5b2df9={},_0x10b90e={},_0x41b71c={'count':0x0,'rows':[]};var _0x3cf1c2=_['map'](db[_0xc86d('0x3d')][_0xc86d('0x3e')],function(_0x3202b8){return{'name':_0x3202b8['fieldName'],'type':_0x3202b8[_0xc86d('0x3f')][_0xc86d('0x40')]};});_0x10b90e[_0xc86d('0x41')]=_[_0xc86d('0x42')](_0x3cf1c2,_0xc86d('0x3a'));_0x10b90e['query']=_[_0xc86d('0x43')](_0x5e4b08[_0xc86d('0x44')]);_0x10b90e[_0xc86d('0x45')]=_[_0xc86d('0x46')](_0x10b90e[_0xc86d('0x41')],_0x10b90e[_0xc86d('0x44')]);_0x5b2df9['attributes']=_[_0xc86d('0x46')](_0x10b90e['model'],qs[_0xc86d('0x47')](_0x5e4b08[_0xc86d('0x44')][_0xc86d('0x47')]));_0x5b2df9[_0xc86d('0x48')]=_0x5b2df9['attributes']['length']?_0x5b2df9['attributes']:_0x10b90e[_0xc86d('0x41')];if(!_0x5e4b08[_0xc86d('0x44')][_0xc86d('0x49')](_0xc86d('0x4a'))){_0x5b2df9['limit']=qs[_0xc86d('0x31')](_0x5e4b08[_0xc86d('0x44')][_0xc86d('0x31')]);_0x5b2df9[_0xc86d('0x33')]=qs[_0xc86d('0x33')](_0x5e4b08['query'][_0xc86d('0x33')]);}_0x5b2df9[_0xc86d('0x4b')]=qs[_0xc86d('0x4c')](_0x5e4b08[_0xc86d('0x44')]['sort']);_0x5b2df9[_0xc86d('0x4d')]=qs['filters'](_['pick'](_0x5e4b08[_0xc86d('0x44')],_0x10b90e['filters']),_0x3cf1c2);if(_0x5e4b08[_0xc86d('0x44')][_0xc86d('0x4e')]){_0x5b2df9[_0xc86d('0x4d')]=_[_0xc86d('0x4f')](_0x5b2df9['where'],{'$or':_[_0xc86d('0x42')](_0x3cf1c2,function(_0x2ed413){if(_0x2ed413[_0xc86d('0x3f')]!=='VIRTUAL'){var _0x56ea96={};_0x56ea96[_0x2ed413[_0xc86d('0x3a')]]={'$like':'%'+_0x5e4b08['query'][_0xc86d('0x4e')]+'%'};return _0x56ea96;}})});}_0x5b2df9=_[_0xc86d('0x4f')]({},_0x5b2df9,_0x5e4b08[_0xc86d('0x50')]);var _0x5a6bfc={'where':_0x5b2df9['where']};return db[_0xc86d('0x3d')][_0xc86d('0x32')](_0x5a6bfc)[_0xc86d('0x21')](function(_0x574663){_0x41b71c[_0xc86d('0x32')]=_0x574663;if(_0x5e4b08['query'][_0xc86d('0x51')]){_0x5b2df9[_0xc86d('0x52')]=[{'all':!![]}];}return db['ChatMessage'][_0xc86d('0x53')](_0x5b2df9);})[_0xc86d('0x21')](function(_0x5db16d){_0x41b71c[_0xc86d('0x54')]=_0x5db16d;return _0x41b71c;})['then'](respondWithFilteredResult(_0x247560,_0x5b2df9))[_0xc86d('0x2b')](handleError(_0x247560,null));};exports[_0xc86d('0x55')]=function(_0x47474a,_0x52c6e0){var _0x505aaf={'raw':!![],'where':{'id':_0x47474a[_0xc86d('0x56')]['id']}},_0x29dbbe={};_0x29dbbe[_0xc86d('0x41')]=_[_0xc86d('0x43')](db['ChatMessage'][_0xc86d('0x3e')]);_0x29dbbe[_0xc86d('0x44')]=_[_0xc86d('0x43')](_0x47474a[_0xc86d('0x44')]);_0x29dbbe[_0xc86d('0x45')]=_[_0xc86d('0x46')](_0x29dbbe['model'],_0x29dbbe[_0xc86d('0x44')]);_0x505aaf[_0xc86d('0x48')]=_[_0xc86d('0x46')](_0x29dbbe[_0xc86d('0x41')],qs[_0xc86d('0x47')](_0x47474a[_0xc86d('0x44')][_0xc86d('0x47')]));_0x505aaf[_0xc86d('0x48')]=_0x505aaf['attributes']['length']?_0x505aaf[_0xc86d('0x48')]:_0x29dbbe['model'];if(_0x47474a[_0xc86d('0x44')][_0xc86d('0x51')]){_0x505aaf['include']=[{'all':!![]}];}_0x505aaf=_[_0xc86d('0x4f')]({},_0x505aaf,_0x47474a[_0xc86d('0x50')]);return db[_0xc86d('0x3d')][_0xc86d('0x57')](_0x505aaf)[_0xc86d('0x21')](handleEntityNotFound(_0x52c6e0,null))[_0xc86d('0x21')](respondWithResult(_0x52c6e0,null))[_0xc86d('0x2b')](handleError(_0x52c6e0,null));};exports[_0xc86d('0x58')]=function(_0x509484,_0x30aacd){return db[_0xc86d('0x3d')][_0xc86d('0x58')](_0x509484[_0xc86d('0x59')],{})['then'](respondWithResult(_0x30aacd,0xc9))[_0xc86d('0x2b')](handleError(_0x30aacd,null));};exports['update']=function(_0xb766e1,_0x3a7900){if(_0xb766e1[_0xc86d('0x59')]['id']){delete _0xb766e1['body']['id'];}return db[_0xc86d('0x3d')][_0xc86d('0x57')]({'where':{'id':_0xb766e1[_0xc86d('0x56')]['id']}})[_0xc86d('0x21')](handleEntityNotFound(_0x3a7900,null))['then'](saveUpdates(_0xb766e1['body'],null))[_0xc86d('0x21')](respondWithResult(_0x3a7900,null))['catch'](handleError(_0x3a7900,null));};exports[_0xc86d('0x5a')]=function(_0x569ac9,_0x41b5ce){return db[_0xc86d('0x3d')][_0xc86d('0x57')]({'where':{'id':_0x569ac9['params']['id']}})['then'](handleEntityNotFound(_0x41b5ce,null))['then'](removeEntity(_0x41b5ce,null))[_0xc86d('0x2b')](handleError(_0x41b5ce,null));};exports[_0xc86d('0x5b')]=function(_0x234af8,_0xa28234){return db[_0xc86d('0x3d')][_0xc86d('0x5b')]()['then'](respondWithResult(_0xa28234,null))['catch'](handleError(_0xa28234,null));};var interaction_log=require(_0xc86d('0x11'))(_0xc86d('0x5c'));exports[_0xc86d('0x5d')]=function(_0x3bb71c,_0x379b99,_0x465aac){var _0x4237fa={'agent':{},'channel':_0xc86d('0x5e')};if(_0x3bb71c[_0xc86d('0x59')]['id']){delete _0x3bb71c['body']['id'];}_0x3bb71c[_0xc86d('0x59')][_0xc86d('0x5f')]=!![];_0x3bb71c['body']['readAt']=moment()['format'](_0xc86d('0x60'));_0x3bb71c[_0xc86d('0x59')][_0xc86d('0x61')]=_0x3bb71c[_0xc86d('0x59')][_0xc86d('0x61')]||_0x3bb71c[_0xc86d('0x62')]['id'];_0x4237fa[_0xc86d('0x63')]['id']=_0x3bb71c[_0xc86d('0x59')]['UserId'];return db[_0xc86d('0x3d')]['find']({'where':{'id':_0x3bb71c[_0xc86d('0x56')]['id'],'UserId':null}})[_0xc86d('0x21')](handleEntityNotFound(_0x379b99,null))[_0xc86d('0x21')](saveUpdates(_0x3bb71c[_0xc86d('0x59')],null))[_0xc86d('0x21')](function(_0x267d2a){if(_0x267d2a){_0x4237fa[_0xc86d('0x28')]=_0x267d2a[_0xc86d('0x64')]({'plain':!![]});return db[_0xc86d('0x65')][_0xc86d('0x57')]({'where':{'id':_0x267d2a[_0xc86d('0x66')]}});}return null;})[_0xc86d('0x21')](handleEntityNotFound(_0x379b99,null))['then'](function(_0x25e122){if(_0x25e122){return _0x25e122[_0xc86d('0x38')]({'UserId':_0x3bb71c[_0xc86d('0x59')][_0xc86d('0x61')],'read1stAt':_[_0xc86d('0x67')](_0x25e122[_0xc86d('0x68')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc86d('0x21')](function(_0x1d2127){if(_0x1d2127){_0x4237fa[_0xc86d('0x69')]=_0x1d2127['get']({'plain':!![]});interaction_log[_0xc86d('0x29')](_0xc86d('0x6a'),_0x3bb71c['user']['id'],_0x3bb71c['user'][_0xc86d('0x3a')],_0x3bb71c[_0xc86d('0x62')][_0xc86d('0x6b')],_0x4237fa[_0xc86d('0x69')]['id'],_0x3bb71c[_0xc86d('0x59')]?JSON[_0xc86d('0x25')](_0x3bb71c[_0xc86d('0x59')]):_0xc86d('0x6c'));return respondWithRpcPromise(_0xc86d('0x6d'),_0xc86d('0x6e'),_0x4237fa);}return null;})[_0xc86d('0x21')](function(_0x296736){var _0x362614=_0xc86d('0x6f')+_0x296736[_0xc86d('0x28')][_0xc86d('0x70')];return db[_0xc86d('0x71')][_0xc86d('0x44')](_0x362614,{'type':db['Sequelize'][_0xc86d('0x72')][_0xc86d('0x73')],'raw':!![]})['then'](function(_0x58656c){return _0x58656c;});})[_0xc86d('0x21')](function(_0x5edc91){if(_0x5edc91){_0x4237fa[_0xc86d('0x28')][_0xc86d('0x74')]=_0x5edc91[0x0];if(!_0x3bb71c[_0xc86d('0x59')]['UserId'])return;return db[_0xc86d('0x75')][_0xc86d('0x57')]({'where':{'id':_0x3bb71c[_0xc86d('0x59')][_0xc86d('0x61')],'role':_0xc86d('0x63')},'attributes':['id',_0xc86d('0x3a'),_0xc86d('0x76'),'email',_0xc86d('0x77')],'raw':!![]});}return null;})[_0xc86d('0x21')](function(_0x61ca65){if(!_0x61ca65)return null;_0x4237fa[_0xc86d('0x28')][_0xc86d('0x63')]=_0x61ca65;return _0x4237fa;})[_0xc86d('0x21')](function(_0x1e885d){if(_0x1e885d){if(_0x3bb71c[_0xc86d('0x59')][_0xc86d('0x78')]){_0x4237fa[_0xc86d('0x28')][_0xc86d('0x79')]=util[_0xc86d('0x7a')](_0xc86d('0x7b'),_0x3bb71c[_0xc86d('0x62')][_0xc86d('0x3a')]);_0x4237fa[_0xc86d('0x28')][_0xc86d('0x7c')]=_0x4237fa[_0xc86d('0x7c')];_0x4237fa[_0xc86d('0x28')]['motionChannel']=_0x4237fa[_0xc86d('0x7c')];_0x4237fa[_0xc86d('0x28')][_0xc86d('0x7d')]='accept';return respondWithRpcPromise(_0xc86d('0x7e'),_0xc86d('0x7e'),{'event':_0xc86d('0x7f'),'message':_[_0xc86d('0x4f')](_0x4237fa[_0xc86d('0x28')],JSON[_0xc86d('0x80')](_0x4237fa['interaction'][_0xc86d('0x81')]))},client9002)[_0xc86d('0x21')](function(){return _0x4237fa;});}return _0x4237fa;}return null;})['then'](respondWithResult(_0x379b99,null))[_0xc86d('0x2b')](handleError(_0x379b99,null));};var interaction_log=require(_0xc86d('0x11'))(_0xc86d('0x5c'));exports['reject']=function(_0x36b290,_0x335992,_0x306e0a){var _0xe39522={'agent':{},'channel':_0xc86d('0x5e')};if(_0x36b290['body']['id']){delete _0x36b290['body']['id'];}_0x36b290[_0xc86d('0x59')]['UserId']=_0x36b290['body'][_0xc86d('0x61')]||_0x36b290['user']['id'];_0xe39522[_0xc86d('0x63')]['id']=_0x36b290[_0xc86d('0x59')][_0xc86d('0x61')];return db[_0xc86d('0x3d')][_0xc86d('0x57')]({'where':{'id':_0x36b290[_0xc86d('0x56')]['id'],'UserId':null}})[_0xc86d('0x21')](handleEntityNotFound(_0x335992,null))[_0xc86d('0x21')](function(_0x947210){if(_0x947210){_0xe39522[_0xc86d('0x28')]=_0x947210[_0xc86d('0x64')]({'plain':!![]});return db[_0xc86d('0x65')][_0xc86d('0x57')]({'where':{'id':_0x947210['ChatInteractionId']}});}return null;})[_0xc86d('0x21')](handleEntityNotFound(_0x335992,null))[_0xc86d('0x21')](function(_0x5ace7e){if(_0x5ace7e){_0xe39522['interaction']=_0x5ace7e['get']({'plain':!![]});interaction_log[_0xc86d('0x29')](_0xc86d('0x82'),_0x36b290[_0xc86d('0x62')]['id'],_0x36b290[_0xc86d('0x62')][_0xc86d('0x3a')],_0x36b290[_0xc86d('0x62')][_0xc86d('0x6b')],_0xe39522['interaction']['id'],_0x36b290[_0xc86d('0x59')]?JSON[_0xc86d('0x25')](_0x36b290[_0xc86d('0x59')]):'null');return respondWithRpcPromise(_0xc86d('0x83'),_0xc86d('0x84'),_0xe39522);}return null;})['then'](function(_0x457b57){var _0x45520f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x457b57[_0xc86d('0x28')]['ContactId'];return db[_0xc86d('0x71')][_0xc86d('0x44')](_0x45520f,{'type':db[_0xc86d('0x85')]['QueryTypes'][_0xc86d('0x73')],'raw':!![]})[_0xc86d('0x21')](function(_0x2948d3){return _0x2948d3;});})[_0xc86d('0x21')](function(_0x17eb20){if(_0x17eb20){_0xe39522[_0xc86d('0x28')][_0xc86d('0x74')]=_0x17eb20[0x0];if(!_0x36b290['body'][_0xc86d('0x61')])return;return db[_0xc86d('0x75')][_0xc86d('0x57')]({'where':{'id':_0x36b290['body'][_0xc86d('0x61')],'role':_0xc86d('0x63')},'attributes':['id',_0xc86d('0x3a'),_0xc86d('0x76'),'email',_0xc86d('0x77')],'raw':!![]});}return null;})[_0xc86d('0x21')](function(_0x4e69ae){if(!_0x4e69ae)return null;_0xe39522['message'][_0xc86d('0x63')]=_0x4e69ae;return _0xe39522;})[_0xc86d('0x21')](function(_0x570a11){if(_0x570a11){_0x570a11[_0xc86d('0x28')][_0xc86d('0x79')]=util[_0xc86d('0x7a')](_0xc86d('0x7b'),_0x36b290['user'][_0xc86d('0x3a')]);_0x570a11['message'][_0xc86d('0x7c')]=_0xe39522[_0xc86d('0x7c')];_0x570a11[_0xc86d('0x28')][_0xc86d('0x86')]=_0xe39522[_0xc86d('0x7c')];_0x570a11[_0xc86d('0x28')][_0xc86d('0x7d')]=_0xc86d('0x36');respondWithRpcPromise('EventManager',_0xc86d('0x7e'),{'event':_0xc86d('0x87'),'message':_[_0xc86d('0x4f')](_0xe39522[_0xc86d('0x28')],JSON['parse'](_0xe39522[_0xc86d('0x69')]['formData']))},client9002);return _0xe39522;}return null;})[_0xc86d('0x21')](respondWithResult(_0x335992,null))[_0xc86d('0x2b')](handleError(_0x335992,null));}; \ No newline at end of file +var _0xadcc=['rejectMessage','User','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','ChatMessage','count','includeAll','findAll','show','params','include','find','create','body','describe','chat-interactions','accept','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','update','format','role','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage'];(function(_0x49b10f,_0x5d03ff){var _0x313620=function(_0x1f46ff){while(--_0x1f46ff){_0x49b10f['push'](_0x49b10f['shift']());}};_0x313620(++_0x5d03ff);}(_0xadcc,0x88));var _0xcadc=function(_0x37d538,_0x1cffdd){_0x37d538=_0x37d538-0x0;var _0x4fa76e=_0xadcc[_0x37d538];return _0x4fa76e;};'use strict';var emlformat=require(_0xcadc('0x0'));var rimraf=require(_0xcadc('0x1'));var zipdir=require(_0xcadc('0x2'));var jsonpatch=require(_0xcadc('0x3'));var rp=require(_0xcadc('0x4'));var moment=require(_0xcadc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcadc('0x6'));var util=require(_0xcadc('0x7'));var path=require(_0xcadc('0x8'));var sox=require(_0xcadc('0x9'));var csv=require(_0xcadc('0xa'));var ejs=require(_0xcadc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcadc('0xc'));var crypto=require(_0xcadc('0xd'));var jsforce=require(_0xcadc('0xe'));var deskjs=require(_0xcadc('0xf'));var toCsv=require(_0xcadc('0xa'));var querystring=require('querystring');var Papa=require(_0xcadc('0x10'));var Redis=require(_0xcadc('0x11'));var authService=require(_0xcadc('0x12'));var qs=require(_0xcadc('0x13'));var as=require(_0xcadc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcadc('0x15'))(_0xcadc('0x16'));var utils=require(_0xcadc('0x17'));var config=require(_0xcadc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcadc('0x19'))['db'];config[_0xcadc('0x1a')]=_['defaults'](config['redis'],{'host':_0xcadc('0x1b'),'port':0x18eb});var socket=require(_0xcadc('0x1c'))(new Redis(config[_0xcadc('0x1a')]));require(_0xcadc('0x1d'))['register'](socket);var jayson=require(_0xcadc('0x1e'));var client=jayson[_0xcadc('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0xcadc('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2b535e,_0x4b2ec1,_0xe333ac,_0x48f9a2){return new BPromise(function(_0x4e112d,_0x29bae8){var _0x426da8=_0x48f9a2||client;return _0x426da8['request'](_0x2b535e,_0xe333ac)[_0xcadc('0x21')](function(_0x213751){logger[_0xcadc('0x22')](_0xcadc('0x23'),_0x4b2ec1,'request\x20sent');logger[_0xcadc('0x24')](_0xcadc('0x25'),_0x4b2ec1,'request\x20sent',JSON[_0xcadc('0x26')](_0x213751));if(_0x213751[_0xcadc('0x27')]){if(_0x213751[_0xcadc('0x27')][_0xcadc('0x28')]===0x1f4){logger[_0xcadc('0x27')](_0xcadc('0x23'),_0x4b2ec1,_0x213751[_0xcadc('0x27')][_0xcadc('0x29')]);return _0x29bae8(_0x213751[_0xcadc('0x27')][_0xcadc('0x29')]);}logger[_0xcadc('0x27')](_0xcadc('0x23'),_0x4b2ec1,_0x213751['error']['message']);return _0x4e112d(_0x213751[_0xcadc('0x27')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x4b2ec1,_0xcadc('0x2a'));_0x4e112d(_0x213751['result'][_0xcadc('0x29')]);}})[_0xcadc('0x2b')](function(_0x132547){logger['error'](_0xcadc('0x23'),_0x4b2ec1,_0x132547);_0x29bae8(_0x132547);});});}function respondWithStatusCode(_0x3ead46,_0x248433){_0x248433=_0x248433||0xcc;return function(_0x47af25){if(_0x47af25){return _0x3ead46[_0xcadc('0x2c')](_0x248433);}return _0x3ead46['status'](_0x248433)[_0xcadc('0x2d')]();};}function respondWithResult(_0x871380,_0x4657e1){_0x4657e1=_0x4657e1||0xc8;return function(_0x130567){if(_0x130567){return _0x871380[_0xcadc('0x2e')](_0x4657e1)[_0xcadc('0x2f')](_0x130567);}};}function respondWithFilteredResult(_0x2139e,_0x35666f){return function(_0x4f9f0f){if(_0x4f9f0f){var _0x52e927=typeof _0x35666f[_0xcadc('0x30')]===_0xcadc('0x31')&&typeof _0x35666f['limit']==='undefined';var _0x278e6f=_0x4f9f0f['count'];var _0x380cb2=_0x52e927?0x0:_0x35666f['offset'];var _0x22e5ee=_0x52e927?_0x4f9f0f['count']:_0x35666f[_0xcadc('0x30')]+_0x35666f[_0xcadc('0x32')];var _0x1fd8c5;if(_0x22e5ee>=_0x278e6f){_0x22e5ee=_0x278e6f;_0x1fd8c5=0xc8;}else{_0x1fd8c5=0xce;}_0x2139e[_0xcadc('0x2e')](_0x1fd8c5);return _0x2139e[_0xcadc('0x33')](_0xcadc('0x34'),_0x380cb2+'-'+_0x22e5ee+'/'+_0x278e6f)['json'](_0x4f9f0f);}return null;};}function patchUpdates(_0x438d80){return function(_0x4df340){try{jsonpatch[_0xcadc('0x35')](_0x4df340,_0x438d80,!![]);}catch(_0x29e262){return BPromise[_0xcadc('0x36')](_0x29e262);}return _0x4df340[_0xcadc('0x37')]();};}function saveUpdates(_0xe58649,_0x3990b6){return function(_0x2ffae6){if(_0x2ffae6){return _0x2ffae6['update'](_0xe58649)[_0xcadc('0x21')](function(_0x50763e){return _0x50763e;});}return null;};}function removeEntity(_0x556d85,_0x2abfa6){return function(_0x268343){if(_0x268343){return _0x268343[_0xcadc('0x38')]()[_0xcadc('0x21')](function(){_0x556d85[_0xcadc('0x2e')](0xcc)[_0xcadc('0x2d')]();});}};}function handleEntityNotFound(_0x57db80,_0x3aabf1){return function(_0x542e4c){if(!_0x542e4c){_0x57db80[_0xcadc('0x2c')](0x194);}return _0x542e4c;};}function handleError(_0x35b095,_0xf3549d){_0xf3549d=_0xf3549d||0x1f4;return function(_0x4ba72f){logger[_0xcadc('0x27')](_0x4ba72f[_0xcadc('0x39')]);if(_0x4ba72f['name']){delete _0x4ba72f[_0xcadc('0x3a')];}_0x35b095[_0xcadc('0x2e')](_0xf3549d)[_0xcadc('0x3b')](_0x4ba72f);};}exports[_0xcadc('0x3c')]=function(_0x418cf9,_0x1d9796){var _0x1b5bb1={},_0x3bd4fc={},_0xc71ffa={'count':0x0,'rows':[]};var _0x546a53=_['map'](db['ChatMessage'][_0xcadc('0x3d')],function(_0x1cb205){return{'name':_0x1cb205['fieldName'],'type':_0x1cb205[_0xcadc('0x3e')][_0xcadc('0x3f')]};});_0x3bd4fc['model']=_[_0xcadc('0x40')](_0x546a53,'name');_0x3bd4fc[_0xcadc('0x41')]=_[_0xcadc('0x42')](_0x418cf9['query']);_0x3bd4fc[_0xcadc('0x43')]=_[_0xcadc('0x44')](_0x3bd4fc[_0xcadc('0x45')],_0x3bd4fc[_0xcadc('0x41')]);_0x1b5bb1[_0xcadc('0x46')]=_[_0xcadc('0x44')](_0x3bd4fc[_0xcadc('0x45')],qs['fields'](_0x418cf9[_0xcadc('0x41')][_0xcadc('0x47')]));_0x1b5bb1['attributes']=_0x1b5bb1['attributes'][_0xcadc('0x48')]?_0x1b5bb1[_0xcadc('0x46')]:_0x3bd4fc['model'];if(!_0x418cf9[_0xcadc('0x41')][_0xcadc('0x49')]('nolimit')){_0x1b5bb1['limit']=qs[_0xcadc('0x32')](_0x418cf9[_0xcadc('0x41')]['limit']);_0x1b5bb1['offset']=qs['offset'](_0x418cf9['query'][_0xcadc('0x30')]);}_0x1b5bb1[_0xcadc('0x4a')]=qs['sort'](_0x418cf9[_0xcadc('0x41')][_0xcadc('0x4b')]);_0x1b5bb1[_0xcadc('0x4c')]=qs[_0xcadc('0x43')](_[_0xcadc('0x4d')](_0x418cf9[_0xcadc('0x41')],_0x3bd4fc[_0xcadc('0x43')]),_0x546a53);if(_0x418cf9[_0xcadc('0x41')]['filter']){_0x1b5bb1['where']=_[_0xcadc('0x4e')](_0x1b5bb1[_0xcadc('0x4c')],{'$or':_[_0xcadc('0x40')](_0x546a53,function(_0x2d9762){if(_0x2d9762['type']!==_0xcadc('0x4f')){var _0x1d0870={};_0x1d0870[_0x2d9762['name']]={'$like':'%'+_0x418cf9[_0xcadc('0x41')]['filter']+'%'};return _0x1d0870;}})});}_0x1b5bb1=_[_0xcadc('0x4e')]({},_0x1b5bb1,_0x418cf9[_0xcadc('0x50')]);var _0x4b5cb7={'where':_0x1b5bb1['where']};return db[_0xcadc('0x51')]['count'](_0x4b5cb7)[_0xcadc('0x21')](function(_0x4389e7){_0xc71ffa[_0xcadc('0x52')]=_0x4389e7;if(_0x418cf9[_0xcadc('0x41')][_0xcadc('0x53')]){_0x1b5bb1['include']=[{'all':!![]}];}return db[_0xcadc('0x51')][_0xcadc('0x54')](_0x1b5bb1);})[_0xcadc('0x21')](function(_0x333fc0){_0xc71ffa['rows']=_0x333fc0;return _0xc71ffa;})['then'](respondWithFilteredResult(_0x1d9796,_0x1b5bb1))[_0xcadc('0x2b')](handleError(_0x1d9796,null));};exports[_0xcadc('0x55')]=function(_0x588823,_0x4d1825){var _0x2e0002={'raw':!![],'where':{'id':_0x588823[_0xcadc('0x56')]['id']}},_0x1255c2={};_0x1255c2[_0xcadc('0x45')]=_[_0xcadc('0x42')](db[_0xcadc('0x51')][_0xcadc('0x3d')]);_0x1255c2[_0xcadc('0x41')]=_[_0xcadc('0x42')](_0x588823['query']);_0x1255c2[_0xcadc('0x43')]=_[_0xcadc('0x44')](_0x1255c2[_0xcadc('0x45')],_0x1255c2[_0xcadc('0x41')]);_0x2e0002[_0xcadc('0x46')]=_[_0xcadc('0x44')](_0x1255c2[_0xcadc('0x45')],qs[_0xcadc('0x47')](_0x588823[_0xcadc('0x41')][_0xcadc('0x47')]));_0x2e0002[_0xcadc('0x46')]=_0x2e0002[_0xcadc('0x46')][_0xcadc('0x48')]?_0x2e0002[_0xcadc('0x46')]:_0x1255c2[_0xcadc('0x45')];if(_0x588823['query']['includeAll']){_0x2e0002[_0xcadc('0x57')]=[{'all':!![]}];}_0x2e0002=_[_0xcadc('0x4e')]({},_0x2e0002,_0x588823[_0xcadc('0x50')]);return db['ChatMessage'][_0xcadc('0x58')](_0x2e0002)[_0xcadc('0x21')](handleEntityNotFound(_0x4d1825,null))[_0xcadc('0x21')](respondWithResult(_0x4d1825,null))[_0xcadc('0x2b')](handleError(_0x4d1825,null));};exports[_0xcadc('0x59')]=function(_0x447355,_0x54018a){return db[_0xcadc('0x51')]['create'](_0x447355[_0xcadc('0x5a')],{})[_0xcadc('0x21')](respondWithResult(_0x54018a,0xc9))[_0xcadc('0x2b')](handleError(_0x54018a,null));};exports['update']=function(_0x420651,_0x21d08a){if(_0x420651[_0xcadc('0x5a')]['id']){delete _0x420651[_0xcadc('0x5a')]['id'];}return db['ChatMessage'][_0xcadc('0x58')]({'where':{'id':_0x420651['params']['id']}})[_0xcadc('0x21')](handleEntityNotFound(_0x21d08a,null))[_0xcadc('0x21')](saveUpdates(_0x420651[_0xcadc('0x5a')],null))[_0xcadc('0x21')](respondWithResult(_0x21d08a,null))['catch'](handleError(_0x21d08a,null));};exports[_0xcadc('0x38')]=function(_0x2b4ba5,_0x48cbe4){return db[_0xcadc('0x51')]['find']({'where':{'id':_0x2b4ba5[_0xcadc('0x56')]['id']}})['then'](handleEntityNotFound(_0x48cbe4,null))[_0xcadc('0x21')](removeEntity(_0x48cbe4,null))[_0xcadc('0x2b')](handleError(_0x48cbe4,null));};exports[_0xcadc('0x5b')]=function(_0x51b191,_0x13e80b){return db['ChatMessage']['describe']()[_0xcadc('0x21')](respondWithResult(_0x13e80b,null))[_0xcadc('0x2b')](handleError(_0x13e80b,null));};var interaction_log=require(_0xcadc('0x15'))(_0xcadc('0x5c'));exports[_0xcadc('0x5d')]=function(_0x73316b,_0x3bd402,_0x197c6d){var _0x22e644={'agent':{},'channel':_0xcadc('0x5e')};if(_0x73316b[_0xcadc('0x5a')]['id']){delete _0x73316b[_0xcadc('0x5a')]['id'];}_0x73316b[_0xcadc('0x5a')][_0xcadc('0x5f')]=!![];_0x73316b[_0xcadc('0x5a')]['readAt']=moment()['format'](_0xcadc('0x60'));_0x73316b[_0xcadc('0x5a')]['UserId']=_0x73316b['body'][_0xcadc('0x61')]||_0x73316b[_0xcadc('0x62')]['id'];_0x22e644[_0xcadc('0x63')]['id']=_0x73316b[_0xcadc('0x5a')][_0xcadc('0x61')];return db[_0xcadc('0x51')][_0xcadc('0x58')]({'where':{'id':_0x73316b[_0xcadc('0x56')]['id'],'UserId':null}})[_0xcadc('0x21')](handleEntityNotFound(_0x3bd402,null))[_0xcadc('0x21')](saveUpdates(_0x73316b['body'],null))[_0xcadc('0x21')](function(_0x3c974e){if(_0x3c974e){_0x22e644[_0xcadc('0x29')]=_0x3c974e[_0xcadc('0x64')]({'plain':!![]});return db[_0xcadc('0x65')]['find']({'where':{'id':_0x3c974e['ChatInteractionId']}});}return null;})[_0xcadc('0x21')](handleEntityNotFound(_0x3bd402,null))[_0xcadc('0x21')](function(_0x467dcb){if(_0x467dcb){return _0x467dcb[_0xcadc('0x66')]({'UserId':_0x73316b[_0xcadc('0x5a')][_0xcadc('0x61')],'read1stAt':_['isNil'](_0x467dcb['read1stAt'])?moment()[_0xcadc('0x67')](_0xcadc('0x60')):undefined});}return null;})[_0xcadc('0x21')](function(_0x1deff1){if(_0x1deff1){_0x22e644['interaction']=_0x1deff1[_0xcadc('0x64')]({'plain':!![]});interaction_log[_0xcadc('0x22')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x73316b[_0xcadc('0x62')]['id'],_0x73316b[_0xcadc('0x62')][_0xcadc('0x3a')],_0x73316b['user'][_0xcadc('0x68')],_0x22e644[_0xcadc('0x69')]['id'],_0x73316b[_0xcadc('0x5a')]?JSON[_0xcadc('0x26')](_0x73316b[_0xcadc('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0xcadc('0x6a'),_0x22e644);}return null;})[_0xcadc('0x21')](function(_0x74fe91){var _0x3572c8=_0xcadc('0x6b')+_0x74fe91[_0xcadc('0x29')][_0xcadc('0x6c')];return db[_0xcadc('0x6d')][_0xcadc('0x41')](_0x3572c8,{'type':db[_0xcadc('0x6e')][_0xcadc('0x6f')][_0xcadc('0x70')],'raw':!![]})[_0xcadc('0x21')](function(_0x603b8e){return _0x603b8e;});})[_0xcadc('0x21')](function(_0x2d2dcd){if(_0x2d2dcd){_0x22e644[_0xcadc('0x29')][_0xcadc('0x71')]=_0x2d2dcd[0x0];if(!_0x73316b['body'][_0xcadc('0x61')])return;return db['User'][_0xcadc('0x58')]({'where':{'id':_0x73316b[_0xcadc('0x5a')][_0xcadc('0x61')],'role':'agent'},'attributes':['id',_0xcadc('0x3a'),_0xcadc('0x72'),_0xcadc('0x73'),_0xcadc('0x74')],'raw':!![]});}return null;})['then'](function(_0x593e0b){if(!_0x593e0b)return null;_0x22e644['message'][_0xcadc('0x63')]=_0x593e0b;return _0x22e644;})[_0xcadc('0x21')](function(_0x12ec99){if(_0x12ec99){if(_0x73316b[_0xcadc('0x5a')]['manual']){_0x22e644['message'][_0xcadc('0x75')]=util[_0xcadc('0x67')](_0xcadc('0x76'),_0x73316b[_0xcadc('0x62')][_0xcadc('0x3a')]);_0x22e644['message']['channel']=_0x22e644[_0xcadc('0x77')];_0x22e644[_0xcadc('0x29')][_0xcadc('0x78')]=_0x22e644[_0xcadc('0x77')];_0x22e644[_0xcadc('0x29')]['event']=_0xcadc('0x5d');return respondWithRpcPromise(_0xcadc('0x79'),_0xcadc('0x79'),{'event':_0xcadc('0x7a'),'message':_[_0xcadc('0x4e')](_0x22e644[_0xcadc('0x29')],JSON[_0xcadc('0x7b')](_0x22e644['interaction'][_0xcadc('0x7c')]))},client9002)['then'](function(){return _0x22e644;});}return _0x22e644;}return null;})['then'](respondWithResult(_0x3bd402,null))['catch'](handleError(_0x3bd402,null));};var interaction_log=require(_0xcadc('0x15'))(_0xcadc('0x5c'));exports['reject']=function(_0xea7eb1,_0x49af21,_0x1c4236){var _0x37a362={'agent':{},'channel':_0xcadc('0x5e')};if(_0xea7eb1[_0xcadc('0x5a')]['id']){delete _0xea7eb1[_0xcadc('0x5a')]['id'];}_0xea7eb1[_0xcadc('0x5a')][_0xcadc('0x61')]=_0xea7eb1[_0xcadc('0x5a')][_0xcadc('0x61')]||_0xea7eb1[_0xcadc('0x62')]['id'];_0x37a362['agent']['id']=_0xea7eb1['body']['UserId'];return db['ChatMessage'][_0xcadc('0x58')]({'where':{'id':_0xea7eb1[_0xcadc('0x56')]['id'],'UserId':null}})[_0xcadc('0x21')](handleEntityNotFound(_0x49af21,null))['then'](function(_0x1f7f53){if(_0x1f7f53){_0x37a362[_0xcadc('0x29')]=_0x1f7f53[_0xcadc('0x64')]({'plain':!![]});return db[_0xcadc('0x65')][_0xcadc('0x58')]({'where':{'id':_0x1f7f53[_0xcadc('0x7d')]}});}return null;})[_0xcadc('0x21')](handleEntityNotFound(_0x49af21,null))['then'](function(_0x2e7496){if(_0x2e7496){_0x37a362[_0xcadc('0x69')]=_0x2e7496[_0xcadc('0x64')]({'plain':!![]});interaction_log[_0xcadc('0x22')](_0xcadc('0x7e'),_0xea7eb1[_0xcadc('0x62')]['id'],_0xea7eb1[_0xcadc('0x62')]['name'],_0xea7eb1['user'][_0xcadc('0x68')],_0x37a362[_0xcadc('0x69')]['id'],_0xea7eb1['body']?JSON[_0xcadc('0x26')](_0xea7eb1[_0xcadc('0x5a')]):'null');return respondWithRpcPromise(_0xcadc('0x7f'),_0xcadc('0x80'),_0x37a362);}return null;})['then'](function(_0x2c6bcf){var _0x1a86bf=_0xcadc('0x6b')+_0x2c6bcf[_0xcadc('0x29')][_0xcadc('0x6c')];return db[_0xcadc('0x6d')][_0xcadc('0x41')](_0x1a86bf,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x3e02f6){return _0x3e02f6;});})[_0xcadc('0x21')](function(_0x486f66){if(_0x486f66){_0x37a362['message'][_0xcadc('0x71')]=_0x486f66[0x0];if(!_0xea7eb1[_0xcadc('0x5a')][_0xcadc('0x61')])return;return db[_0xcadc('0x81')][_0xcadc('0x58')]({'where':{'id':_0xea7eb1['body'][_0xcadc('0x61')],'role':_0xcadc('0x63')},'attributes':['id',_0xcadc('0x3a'),_0xcadc('0x72'),_0xcadc('0x73'),_0xcadc('0x74')],'raw':!![]});}return null;})[_0xcadc('0x21')](function(_0x446ebd){if(!_0x446ebd)return null;_0x37a362[_0xcadc('0x29')][_0xcadc('0x63')]=_0x446ebd;return _0x37a362;})[_0xcadc('0x21')](function(_0x136783){if(_0x136783){_0x136783[_0xcadc('0x29')]['interface']=util[_0xcadc('0x67')](_0xcadc('0x76'),_0xea7eb1[_0xcadc('0x62')][_0xcadc('0x3a')]);_0x136783['message'][_0xcadc('0x77')]=_0x37a362[_0xcadc('0x77')];_0x136783['message'][_0xcadc('0x78')]=_0x37a362[_0xcadc('0x77')];_0x136783['message'][_0xcadc('0x82')]=_0xcadc('0x36');respondWithRpcPromise(_0xcadc('0x79'),_0xcadc('0x79'),{'event':_0xcadc('0x83'),'message':_['merge'](_0x37a362['message'],JSON[_0xcadc('0x7b')](_0x37a362[_0xcadc('0x69')][_0xcadc('0x7c')]))},client9002);return _0x37a362;}return null;})[_0xcadc('0x21')](respondWithResult(_0x49af21,null))[_0xcadc('0x2b')](handleError(_0x49af21,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 31413b7..8cfcf07 100644 --- a/server/api/chatMessage/chatMessage.events.js +++ b/server/api/chatMessage/chatMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb98c=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','update','remove','emit'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0xb98c,0xd2));var _0xcb98=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xb98c[_0x2df507];return _0x1f7167;};'use strict';var EventEmitter=require(_0xcb98('0x0'));var ChatMessage=require(_0xcb98('0x1'))['db'][_0xcb98('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcb98('0x3'),'afterDestroy':_0xcb98('0x4')};function emitEvent(_0x44ca2d){return function(_0x2a63f4,_0x44734f,_0x39bc31){ChatMessageEvents[_0xcb98('0x5')](_0x44ca2d+':'+_0x2a63f4['id'],_0x2a63f4);ChatMessageEvents[_0xcb98('0x5')](_0x44ca2d,_0x2a63f4);_0x39bc31(null);};}for(var e in events){if(events[_0xcb98('0x6')](e)){var event=events[e];ChatMessage[_0xcb98('0x7')](e,emitEvent(event));}}module[_0xcb98('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xf19e=['update','remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf19e,0xbc));var _0xef19=function(_0x26294a,_0x420213){_0x26294a=_0x26294a-0x0;var _0x5dbac7=_0xf19e[_0x26294a];return _0x5dbac7;};'use strict';var EventEmitter=require(_0xef19('0x0'));var ChatMessage=require(_0xef19('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xef19('0x2')](0x0);var events={'afterCreate':_0xef19('0x3'),'afterUpdate':_0xef19('0x4'),'afterDestroy':_0xef19('0x5')};function emitEvent(_0x1f1b03){return function(_0x505a18,_0x1b4712,_0x364c47){ChatMessageEvents[_0xef19('0x6')](_0x1f1b03+':'+_0x505a18['id'],_0x505a18);ChatMessageEvents[_0xef19('0x6')](_0x1f1b03,_0x505a18);_0x364c47(null);};}for(var e in events){if(events[_0xef19('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index ce0153d..ddd951b 100644 --- a/server/api/chatMessage/chatMessage.model.js +++ b/server/api/chatMessage/chatMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa819=['direction','toLowerCase','out','secret','UserId','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatMessage.attributes','exports','define','fti_chat_messages','body','FULLTEXT','models','get'];(function(_0x4582e8,_0x45f260){var _0x41d8df=function(_0x3f154){while(--_0x3f154){_0x4582e8['push'](_0x4582e8['shift']());}};_0x41d8df(++_0x45f260);}(_0xa819,0xa8));var _0x9a81=function(_0x3127fb,_0x1d4232){_0x3127fb=_0x3127fb-0x0;var _0x40a2df=_0xa819[_0x3127fb];return _0x40a2df;};'use strict';var _=require(_0x9a81('0x0'));var util=require('util');var logger=require(_0x9a81('0x1'))('api');var moment=require(_0x9a81('0x2'));var BPromise=require(_0x9a81('0x3'));var rp=require(_0x9a81('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9a81('0x5'));var attributes=require(_0x9a81('0x6'));module[_0x9a81('0x7')]=function(_0x8f1d5c,_0x27aa19){return _0x8f1d5c[_0x9a81('0x8')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x9a81('0x9'),'fields':[_0x9a81('0xa')],'type':_0x9a81('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfc7439,_0x3bf7e2,_0x560ead){var _0x200ba8=_0x8f1d5c[_0x9a81('0xc')];var _0x1fe668=_0xfc7439[_0x9a81('0xd')]({'plain':!![]});if(_0x1fe668[_0x9a81('0xe')][_0x9a81('0xf')]()==='in'||_0x1fe668[_0x9a81('0xe')]['toLowerCase']()===_0x9a81('0x10')&&!_0x1fe668[_0x9a81('0x11')]&&!_['isNil'](_0x1fe668[_0x9a81('0x12')])){_0x200ba8['ChatInteraction'][_0x9a81('0x13')]({'where':{'id':_0x1fe668[_0x9a81('0x14')]}})['then'](function(_0x303153){if(_0x303153){_0x303153[_0x9a81('0x15')]({'lastMsgAt':_0x1fe668[_0x9a81('0x16')],'lastMsgDirection':_0x1fe668[_0x9a81('0xe')]['toLowerCase']()});}})[_0x9a81('0x17')](function(_0xaca594){console[_0x9a81('0x18')](_0xaca594);});}_0x560ead();}},'charset':'utf8mb4','collate':_0x9a81('0x19')});}; \ No newline at end of file +var _0xfb45=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./chatMessage.attributes','define','fti_chat_messages','body','models','get','direction','toLowerCase','out','UserId','ChatInteractionId','then','update','createdAt','catch','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb45,0x115));var _0x5fb4=function(_0x26820c,_0x5de3f7){_0x26820c=_0x26820c-0x0;var _0x301d26=_0xfb45[_0x26820c];return _0x301d26;};'use strict';var _=require(_0x5fb4('0x0'));var util=require(_0x5fb4('0x1'));var logger=require(_0x5fb4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5fb4('0x3'));var rp=require(_0x5fb4('0x4'));var fs=require('fs');var path=require(_0x5fb4('0x5'));var rimraf=require(_0x5fb4('0x6'));var config=require('../../config/environment');var attributes=require(_0x5fb4('0x7'));module['exports']=function(_0x19d18d,_0x3f7256){return _0x19d18d[_0x5fb4('0x8')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x5fb4('0x9'),'fields':[_0x5fb4('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45b064,_0x5cdcca,_0xd8d96){var _0x262291=_0x19d18d[_0x5fb4('0xb')];var _0x2f5427=_0x45b064[_0x5fb4('0xc')]({'plain':!![]});if(_0x2f5427[_0x5fb4('0xd')][_0x5fb4('0xe')]()==='in'||_0x2f5427[_0x5fb4('0xd')][_0x5fb4('0xe')]()===_0x5fb4('0xf')&&!_0x2f5427['secret']&&!_['isNil'](_0x2f5427[_0x5fb4('0x10')])){_0x262291['ChatInteraction']['findOne']({'where':{'id':_0x2f5427[_0x5fb4('0x11')]}})[_0x5fb4('0x12')](function(_0x490990){if(_0x490990){_0x490990[_0x5fb4('0x13')]({'lastMsgAt':_0x2f5427[_0x5fb4('0x14')],'lastMsgDirection':_0x2f5427[_0x5fb4('0xd')][_0x5fb4('0xe')]()});}})[_0x5fb4('0x15')](function(_0x48d2ba){console[_0x5fb4('0x16')](_0x48d2ba);});}_0xd8d96();}},'charset':_0x5fb4('0x17'),'collate':_0x5fb4('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 8a21a7a..bf55bbd 100644 --- a/server/api/chatMessage/chatMessage.rpc.js +++ b/server/api/chatMessage/chatMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c38=['CreateChatMessage','create','body','options','raw','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3c93dc,_0xd5f6f0){var _0x1a53f6=function(_0x56ccda){while(--_0x56ccda){_0x3c93dc['push'](_0x3c93dc['shift']());}};_0x1a53f6(++_0xd5f6f0);}(_0x8c38,0x105));var _0x88c3=function(_0xf8a5c8,_0x52864b){_0xf8a5c8=_0xf8a5c8-0x0;var _0x44ee60=_0x8c38[_0xf8a5c8];return _0x44ee60;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x88c3('0x0'));var BPromise=require(_0x88c3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88c3('0x2'));var db=require(_0x88c3('0x3'))['db'];var utils=require(_0x88c3('0x4'));var logger=require(_0x88c3('0x5'))('rpc');var config=require(_0x88c3('0x6'));var jayson=require(_0x88c3('0x7'));var client=jayson[_0x88c3('0x8')]['http']({'port':0x232a});config[_0x88c3('0x9')]=_[_0x88c3('0xa')](config['redis'],{'host':_0x88c3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88c3('0x9')]));require(_0x88c3('0xc'))[_0x88c3('0xd')](socket);function respondWithRpcPromise(_0xa17a3f,_0x55b9f0,_0x511938){return new BPromise(function(_0x1a5457,_0xc4fcb5){return client[_0x88c3('0xe')](_0xa17a3f,_0x511938)[_0x88c3('0xf')](function(_0x471492){logger[_0x88c3('0x10')](_0x88c3('0x11'),_0x55b9f0,_0x88c3('0x12'));logger[_0x88c3('0x13')](_0x88c3('0x14'),_0x55b9f0,_0x88c3('0x12'),JSON[_0x88c3('0x15')](_0x471492));if(_0x471492['error']){if(_0x471492[_0x88c3('0x16')][_0x88c3('0x17')]===0x1f4){logger['error'](_0x88c3('0x11'),_0x55b9f0,_0x471492[_0x88c3('0x16')][_0x88c3('0x18')]);return _0xc4fcb5(_0x471492[_0x88c3('0x16')][_0x88c3('0x18')]);}logger[_0x88c3('0x16')]('ChatMessage,\x20%s,\x20%s',_0x55b9f0,_0x471492[_0x88c3('0x16')][_0x88c3('0x18')]);return _0x1a5457(_0x471492[_0x88c3('0x16')]['message']);}else{logger[_0x88c3('0x10')](_0x88c3('0x11'),_0x55b9f0,_0x88c3('0x12'));_0x1a5457(_0x471492[_0x88c3('0x19')][_0x88c3('0x18')]);}})[_0x88c3('0x1a')](function(_0x57aee1){logger['error'](_0x88c3('0x11'),_0x55b9f0,_0x57aee1);_0xc4fcb5(_0x57aee1);});});}exports[_0x88c3('0x1b')]=function(_0x506c0d){var _0x96782a=this;return new Promise(function(_0x86b0d1,_0xd7f084){return db['ChatMessage'][_0x88c3('0x1c')](_0x506c0d[_0x88c3('0x1d')],{'raw':_0x506c0d[_0x88c3('0x1e')]?_0x506c0d['options'][_0x88c3('0x1f')]===undefined?!![]:![]:!![]})[_0x88c3('0xf')](function(_0x5b8532){logger[_0x88c3('0x10')](_0x88c3('0x1b'),_0x506c0d);logger[_0x88c3('0x13')](_0x88c3('0x1b'),_0x506c0d,JSON[_0x88c3('0x15')](_0x5b8532));_0x86b0d1(_0x5b8532);})[_0x88c3('0x1a')](function(_0x5a1ac0){logger[_0x88c3('0x16')]('CreateChatMessage',_0x5a1ac0[_0x88c3('0x18')],_0x506c0d);_0xd7f084(_0x96782a[_0x88c3('0x16')](0x1f4,_0x5a1ac0[_0x88c3('0x18')]));});});}; \ No newline at end of file +var _0x8dbb=['ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','ChatMessage','create','options','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info'];(function(_0x2707ff,_0x29ef73){var _0x1c3324=function(_0x18a6e3){while(--_0x18a6e3){_0x2707ff['push'](_0x2707ff['shift']());}};_0x1c3324(++_0x29ef73);}(_0x8dbb,0x6d));var _0xb8db=function(_0x1b852e,_0x185f0d){_0x1b852e=_0x1b852e-0x0;var _0x2fd5cf=_0x8dbb[_0x1b852e];return _0x2fd5cf;};'use strict';var _=require('lodash');var util=require(_0xb8db('0x0'));var moment=require(_0xb8db('0x1'));var BPromise=require(_0xb8db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8db('0x3'));var db=require(_0xb8db('0x4'))['db'];var utils=require(_0xb8db('0x5'));var logger=require(_0xb8db('0x6'))('rpc');var config=require(_0xb8db('0x7'));var jayson=require(_0xb8db('0x8'));var client=jayson['client'][_0xb8db('0x9')]({'port':0x232a});config[_0xb8db('0xa')]=_[_0xb8db('0xb')](config['redis'],{'host':_0xb8db('0xc'),'port':0x18eb});var socket=require(_0xb8db('0xd'))(new Redis(config[_0xb8db('0xa')]));require(_0xb8db('0xe'))[_0xb8db('0xf')](socket);function respondWithRpcPromise(_0x32bfef,_0x202ef0,_0x57c20f){return new BPromise(function(_0x1c13ef,_0x2a9831){return client[_0xb8db('0x10')](_0x32bfef,_0x57c20f)[_0xb8db('0x11')](function(_0x51c4b5){logger[_0xb8db('0x12')](_0xb8db('0x13'),_0x202ef0,_0xb8db('0x14'));logger[_0xb8db('0x15')](_0xb8db('0x16'),_0x202ef0,_0xb8db('0x14'),JSON[_0xb8db('0x17')](_0x51c4b5));if(_0x51c4b5[_0xb8db('0x18')]){if(_0x51c4b5[_0xb8db('0x18')][_0xb8db('0x19')]===0x1f4){logger[_0xb8db('0x18')](_0xb8db('0x13'),_0x202ef0,_0x51c4b5['error'][_0xb8db('0x1a')]);return _0x2a9831(_0x51c4b5['error']['message']);}logger[_0xb8db('0x18')](_0xb8db('0x13'),_0x202ef0,_0x51c4b5[_0xb8db('0x18')][_0xb8db('0x1a')]);return _0x1c13ef(_0x51c4b5[_0xb8db('0x18')][_0xb8db('0x1a')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x202ef0,_0xb8db('0x14'));_0x1c13ef(_0x51c4b5[_0xb8db('0x1b')][_0xb8db('0x1a')]);}})['catch'](function(_0x3d7693){logger[_0xb8db('0x18')](_0xb8db('0x13'),_0x202ef0,_0x3d7693);_0x2a9831(_0x3d7693);});});}exports[_0xb8db('0x1c')]=function(_0x45e367){var _0x4db20d=this;return new Promise(function(_0x20d287,_0x474997){return db[_0xb8db('0x1d')][_0xb8db('0x1e')](_0x45e367['body'],{'raw':_0x45e367[_0xb8db('0x1f')]?_0x45e367[_0xb8db('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xb8db('0x11')](function(_0x11e750){logger[_0xb8db('0x12')](_0xb8db('0x1c'),_0x45e367);logger[_0xb8db('0x15')]('CreateChatMessage',_0x45e367,JSON[_0xb8db('0x17')](_0x11e750));_0x20d287(_0x11e750);})['catch'](function(_0x56a2ef){logger['error']('CreateChatMessage',_0x56a2ef[_0xb8db('0x1a')],_0x45e367);_0x474997(_0x4db20d['error'](0x1f4,_0x56a2ef[_0xb8db('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index cfedbd4..b9cb647 100644 --- a/server/api/chatMessage/chatMessage.socket.js +++ b/server/api/chatMessage/chatMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf006=['register','chatMessage:','remove','update','emit','removeListener'];(function(_0x261c97,_0x1fee70){var _0x26c780=function(_0x3639aa){while(--_0x3639aa){_0x261c97['push'](_0x261c97['shift']());}};_0x26c780(++_0x1fee70);}(_0xf006,0x146));var _0x6f00=function(_0x5a3c92,_0xef82cf){_0x5a3c92=_0x5a3c92-0x0;var _0x48a68b=_0xf006[_0x5a3c92];return _0x48a68b;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x6f00('0x0'),_0x6f00('0x1')];function createListener(_0x5914f3,_0xbab575){return function(_0x4e9dbc){_0xbab575[_0x6f00('0x2')](_0x5914f3,_0x4e9dbc);};}function removeListener(_0x4f4466,_0x5039fb){return function(){ChatMessageEvents[_0x6f00('0x3')](_0x4f4466,_0x5039fb);};}exports[_0x6f00('0x4')]=function(_0x141e71){for(var _0x52c9a2=0x0,_0x3c29ff=events['length'];_0x52c9a2<_0x3c29ff;_0x52c9a2++){var _0x3875fb=events[_0x52c9a2];var _0x3001b1=createListener(_0x6f00('0x5')+_0x3875fb,_0x141e71);ChatMessageEvents['on'](_0x3875fb,_0x3001b1);}}; \ No newline at end of file +var _0x3baf=['save','remove','update','emit','removeListener','register','chatMessage:','./chatMessage.events'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x3baf,0xf7));var _0xf3ba=function(_0x344f62,_0x4bd138){_0x344f62=_0x344f62-0x0;var _0x191372=_0x3baf[_0x344f62];return _0x191372;};'use strict';var ChatMessageEvents=require(_0xf3ba('0x0'));var events=[_0xf3ba('0x1'),_0xf3ba('0x2'),_0xf3ba('0x3')];function createListener(_0x29bbc2,_0x22f9c0){return function(_0xfce22){_0x22f9c0[_0xf3ba('0x4')](_0x29bbc2,_0xfce22);};}function removeListener(_0x3e6058,_0x1ae6e6){return function(){ChatMessageEvents[_0xf3ba('0x5')](_0x3e6058,_0x1ae6e6);};}exports[_0xf3ba('0x6')]=function(_0x475268){for(var _0x2e6df2=0x0,_0x1284b7=events['length'];_0x2e6df2<_0x1284b7;_0x2e6df2++){var _0x579135=events[_0x2e6df2];var _0x5ab058=createListener(_0xf3ba('0x7')+_0x579135,_0x475268);ChatMessageEvents['on'](_0x579135,_0x5ab058);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index a623de9..334c5e8 100644 --- a/server/api/chatMessage/index.js +++ b/server/api/chatMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b6d=['get','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index'];(function(_0x14d903,_0x4d3df2){var _0x43ffb3=function(_0xeba941){while(--_0xeba941){_0x14d903['push'](_0x14d903['shift']());}};_0x43ffb3(++_0x4d3df2);}(_0x3b6d,0x16e));var _0xd3b6=function(_0x200966,_0x93219c){_0x200966=_0x200966-0x0;var _0x1b1be9=_0x3b6d[_0x200966];return _0x1b1be9;};'use strict';var multer=require('multer');var util=require(_0xd3b6('0x0'));var path=require(_0xd3b6('0x1'));var timeout=require(_0xd3b6('0x2'));var express=require('express');var router=express[_0xd3b6('0x3')]();var fs_extra=require(_0xd3b6('0x4'));var auth=require(_0xd3b6('0x5'));var interaction=require(_0xd3b6('0x6'));var config=require(_0xd3b6('0x7'));var controller=require(_0xd3b6('0x8'));router['get']('/',auth[_0xd3b6('0x9')](),controller[_0xd3b6('0xa')]);router[_0xd3b6('0xb')](_0xd3b6('0xc'),auth[_0xd3b6('0x9')](),controller[_0xd3b6('0xd')]);router[_0xd3b6('0xb')](_0xd3b6('0xe'),auth[_0xd3b6('0x9')](),controller[_0xd3b6('0xf')]);router[_0xd3b6('0x10')]('/',auth[_0xd3b6('0x9')](),interaction[_0xd3b6('0x11')](_0xd3b6('0x12'),_0xd3b6('0x13')),controller[_0xd3b6('0x14')]);router[_0xd3b6('0x15')](_0xd3b6('0xe'),controller[_0xd3b6('0x16')]);router[_0xd3b6('0x15')](_0xd3b6('0x17'),auth[_0xd3b6('0x9')](),controller[_0xd3b6('0x18')]);router[_0xd3b6('0x15')](_0xd3b6('0x19'),auth[_0xd3b6('0x9')](),controller[_0xd3b6('0x1a')]);router['delete'](_0xd3b6('0xe'),auth['isAuthenticated'](),controller[_0xd3b6('0x1b')]);module[_0xd3b6('0x1c')]=router; \ No newline at end of file +var _0x9bfc=['/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','tracked','chat','chatmessage:create','put','update','/:id/accept','accept'];(function(_0x151ddd,_0xb1a593){var _0x5ef1f0=function(_0x5731e9){while(--_0x5731e9){_0x151ddd['push'](_0x151ddd['shift']());}};_0x5ef1f0(++_0xb1a593);}(_0x9bfc,0x195));var _0xc9bf=function(_0x4b03d3,_0x32f1d2){_0x4b03d3=_0x4b03d3-0x0;var _0x58a968=_0x9bfc[_0x4b03d3];return _0x58a968;};'use strict';var multer=require(_0xc9bf('0x0'));var util=require(_0xc9bf('0x1'));var path=require('path');var timeout=require(_0xc9bf('0x2'));var express=require(_0xc9bf('0x3'));var router=express['Router']();var fs_extra=require(_0xc9bf('0x4'));var auth=require(_0xc9bf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc9bf('0x6'));var controller=require(_0xc9bf('0x7'));router[_0xc9bf('0x8')]('/',auth[_0xc9bf('0x9')](),controller['index']);router[_0xc9bf('0x8')](_0xc9bf('0xa'),auth[_0xc9bf('0x9')](),controller[_0xc9bf('0xb')]);router['get'](_0xc9bf('0xc'),auth[_0xc9bf('0x9')](),controller['show']);router['post']('/',auth[_0xc9bf('0x9')](),interaction[_0xc9bf('0xd')](_0xc9bf('0xe'),_0xc9bf('0xf')),controller['create']);router[_0xc9bf('0x10')](_0xc9bf('0xc'),controller[_0xc9bf('0x11')]);router[_0xc9bf('0x10')](_0xc9bf('0x12'),auth['isAuthenticated'](),controller[_0xc9bf('0x13')]);router[_0xc9bf('0x10')](_0xc9bf('0x14'),auth[_0xc9bf('0x9')](),controller[_0xc9bf('0x15')]);router[_0xc9bf('0x16')](_0xc9bf('0xc'),auth['isAuthenticated'](),controller[_0xc9bf('0x17')]);module[_0xc9bf('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index a115377..5d69d04 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','TEXT'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x757a,0xde));var _0xa757=function(_0x5023dc,_0x478bca){_0x5023dc=_0x5023dc-0x0;var _0x8e8dab=_0x757a[_0x5023dc];return _0x8e8dab;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x2d3400,_0x29caaf){var _0x2ed6fe=function(_0x5adf80){while(--_0x5adf80){_0x2d3400['push'](_0x2d3400['shift']());}};_0x2ed6fe(++_0x29caaf);}(_0xadb5,0xad));var _0x5adb=function(_0x26f1a6,_0x28f55e){_0x26f1a6=_0x26f1a6-0x0;var _0x3172a8=_0xadb5[_0x26f1a6];return _0x3172a8;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 95b284a..f6b84e7 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7a54,0x106));var _0x47a5=function(_0x270b67,_0x13d6f6){_0x270b67=_0x270b67-0x0;var _0x4078f5=_0x7a54[_0x270b67];return _0x4078f5;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x219043,_0x1e871b){var _0x33c51b=function(_0x460fc0){while(--_0x460fc0){_0x219043['push'](_0x219043['shift']());}};_0x33c51b(++_0x1e871b);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index d471a35..a6e5609 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e64=['../../mysqldb','ChatOfflineMessage','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x1137e3,_0x3833da){var _0x2b10af=function(_0x1764de){while(--_0x1764de){_0x1137e3['push'](_0x1137e3['shift']());}};_0x2b10af(++_0x3833da);}(_0x6e64,0x10f));var _0x46e6=function(_0x42a243,_0xc10f61){_0x42a243=_0x42a243-0x0;var _0x359ef3=_0x6e64[_0x42a243];return _0x359ef3;};'use strict';var EventEmitter=require(_0x46e6('0x0'));var ChatOfflineMessage=require(_0x46e6('0x1'))['db'][_0x46e6('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x46e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x46e6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x158c74){return function(_0x5f1459,_0x2eb3b5,_0x3726cd){ChatOfflineMessageEvents[_0x46e6('0x5')](_0x158c74+':'+_0x5f1459['id'],_0x5f1459);ChatOfflineMessageEvents[_0x46e6('0x5')](_0x158c74,_0x5f1459);_0x3726cd(null);};}for(var e in events){if(events[_0x46e6('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x46e6('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xe9d5=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatOfflineMessage','setMaxListeners','update'];(function(_0x2da794,_0x9d2ed3){var _0x11b534=function(_0x1d9b9e){while(--_0x1d9b9e){_0x2da794['push'](_0x2da794['shift']());}};_0x11b534(++_0x9d2ed3);}(_0xe9d5,0x7a));var _0x5e9d=function(_0x34c8ff,_0x674110){_0x34c8ff=_0x34c8ff-0x0;var _0x42601c=_0xe9d5[_0x34c8ff];return _0x42601c;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x5e9d('0x0'))['db'][_0x5e9d('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x5e9d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e9d('0x3'),'afterDestroy':_0x5e9d('0x4')};function emitEvent(_0x4abcb1){return function(_0x110269,_0x42b25a,_0x3608fd){ChatOfflineMessageEvents[_0x5e9d('0x5')](_0x4abcb1+':'+_0x110269['id'],_0x110269);ChatOfflineMessageEvents[_0x5e9d('0x5')](_0x4abcb1,_0x110269);_0x3608fd(null);};}for(var e in events){if(events[_0x5e9d('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x5e9d('0x7')](e,emitEvent(event));}}module[_0x5e9d('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 70670b3..3f2913e 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.model.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2c=['utf8mb4','utf8mb4_unicode_ci','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x3b40b7,_0x499d76){var _0xa12c16=function(_0x3d8007){while(--_0x3d8007){_0x3b40b7['push'](_0x3b40b7['shift']());}};_0xa12c16(++_0x499d76);}(_0x5f2c,0x68));var _0xc5f2=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f2c[_0x3ab9ee];return _0x82ee88;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xc5f2('0x0')]=function(_0x32dc8d){return _0x32dc8d[_0xc5f2('0x1')](_0xc5f2('0x2'),attributes,{'tableName':_0xc5f2('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc5f2('0x4'),'collate':_0xc5f2('0x5')});}; \ No newline at end of file +var _0xe280=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xe280,0xfc));var _0x0e28=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xe280[_0x4b2863];return _0x567d67;};'use strict';var attributes=require(_0x0e28('0x0'));module[_0x0e28('0x1')]=function(_0x4337dd){return _0x4337dd[_0x0e28('0x2')](_0x0e28('0x3'),attributes,{'tableName':_0x0e28('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0e28('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0381dd6..e792039 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb6e=['../../config/logger','rpc','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x164d75,_0x319140){var _0x17b136=function(_0x4fc5aa){while(--_0x4fc5aa){_0x164d75['push'](_0x164d75['shift']());}};_0x17b136(++_0x319140);}(_0xcb6e,0x102));var _0xecb6=function(_0x4e01f9,_0x463f26){_0x4e01f9=_0x4e01f9-0x0;var _0x1c5e9c=_0xcb6e[_0x4e01f9];return _0x1c5e9c;};'use strict';var _=require(_0xecb6('0x0'));var util=require(_0xecb6('0x1'));var moment=require(_0xecb6('0x2'));var BPromise=require(_0xecb6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xecb6('0x5'));var logger=require(_0xecb6('0x6'))(_0xecb6('0x7'));var config=require('../../config/environment');var jayson=require(_0xecb6('0x8'));var client=jayson[_0xecb6('0x9')][_0xecb6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1902d4,_0x399001,_0x159bde){return new BPromise(function(_0x1339da,_0x5f30d3){return client[_0xecb6('0xb')](_0x1902d4,_0x159bde)['then'](function(_0x1e7ed9){logger[_0xecb6('0xc')](_0xecb6('0xd'),_0x399001,_0xecb6('0xe'));logger[_0xecb6('0xf')](_0xecb6('0x10'),_0x399001,_0xecb6('0xe'),JSON[_0xecb6('0x11')](_0x1e7ed9));if(_0x1e7ed9[_0xecb6('0x12')]){if(_0x1e7ed9[_0xecb6('0x12')][_0xecb6('0x13')]===0x1f4){logger['error'](_0xecb6('0xd'),_0x399001,_0x1e7ed9[_0xecb6('0x12')][_0xecb6('0x14')]);return _0x5f30d3(_0x1e7ed9[_0xecb6('0x12')][_0xecb6('0x14')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x399001,_0x1e7ed9[_0xecb6('0x12')][_0xecb6('0x14')]);return _0x1339da(_0x1e7ed9['error'][_0xecb6('0x14')]);}else{logger[_0xecb6('0xc')](_0xecb6('0xd'),_0x399001,_0xecb6('0xe'));_0x1339da(_0x1e7ed9[_0xecb6('0x15')][_0xecb6('0x14')]);}})['catch'](function(_0x3b3635){logger['error'](_0xecb6('0xd'),_0x399001,_0x3b3635);_0x5f30d3(_0x3b3635);});});} \ No newline at end of file +var _0xa4b0=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x58f62c,_0x1b61f9){var _0x391249=function(_0x59bdd7){while(--_0x59bdd7){_0x58f62c['push'](_0x58f62c['shift']());}};_0x391249(++_0x1b61f9);}(_0xa4b0,0x15d));var _0x0a4b=function(_0x3d1d49,_0xeee5ea){_0x3d1d49=_0x3d1d49-0x0;var _0x100e80=_0xa4b0[_0x3d1d49];return _0x100e80;};'use strict';var _=require(_0x0a4b('0x0'));var util=require(_0x0a4b('0x1'));var moment=require(_0x0a4b('0x2'));var BPromise=require(_0x0a4b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a4b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a4b('0x5'))('rpc');var config=require(_0x0a4b('0x6'));var jayson=require(_0x0a4b('0x7'));var client=jayson['client'][_0x0a4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15ff0f,_0x1bd353,_0x37ab40){return new BPromise(function(_0x690a14,_0x2832d0){return client[_0x0a4b('0x9')](_0x15ff0f,_0x37ab40)[_0x0a4b('0xa')](function(_0x2c58ba){logger[_0x0a4b('0xb')](_0x0a4b('0xc'),_0x1bd353,'request\x20sent');logger['debug'](_0x0a4b('0xd'),_0x1bd353,_0x0a4b('0xe'),JSON[_0x0a4b('0xf')](_0x2c58ba));if(_0x2c58ba[_0x0a4b('0x10')]){if(_0x2c58ba['error'][_0x0a4b('0x11')]===0x1f4){logger[_0x0a4b('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1bd353,_0x2c58ba[_0x0a4b('0x10')][_0x0a4b('0x12')]);return _0x2832d0(_0x2c58ba[_0x0a4b('0x10')]['message']);}logger['error'](_0x0a4b('0xc'),_0x1bd353,_0x2c58ba[_0x0a4b('0x10')][_0x0a4b('0x12')]);return _0x690a14(_0x2c58ba[_0x0a4b('0x10')][_0x0a4b('0x12')]);}else{logger['info'](_0x0a4b('0xc'),_0x1bd353,_0x0a4b('0xe'));_0x690a14(_0x2c58ba[_0x0a4b('0x13')][_0x0a4b('0x12')]);}})[_0x0a4b('0x14')](function(_0x3533f8){logger[_0x0a4b('0x10')](_0x0a4b('0xc'),_0x1bd353,_0x3533f8);_0x2832d0(_0x3533f8);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c4ae77e..62f2221 100644 --- a/server/api/chatOfflineMessage/index.js +++ b/server/api/chatOfflineMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb869=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x44bd1f,_0x384f07){var _0xe3fc9c=function(_0xe8dec6){while(--_0xe8dec6){_0x44bd1f['push'](_0x44bd1f['shift']());}};_0xe3fc9c(++_0x384f07);}(_0xb869,0xff));var _0x9b86=function(_0x531db2,_0x353c2b){_0x531db2=_0x531db2-0x0;var _0xe3706f=_0xb869[_0x531db2];return _0xe3706f;};'use strict';var multer=require(_0x9b86('0x0'));var util=require(_0x9b86('0x1'));var path=require(_0x9b86('0x2'));var timeout=require(_0x9b86('0x3'));var express=require(_0x9b86('0x4'));var router=express[_0x9b86('0x5')]();var fs_extra=require(_0x9b86('0x6'));var auth=require(_0x9b86('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9b86('0x8'));var controller=require(_0x9b86('0x9'));router['get']('/',auth[_0x9b86('0xa')](),controller['index']);router[_0x9b86('0xb')](_0x9b86('0xc'),auth['isAuthenticated'](),controller[_0x9b86('0xd')]);router[_0x9b86('0xb')](_0x9b86('0xe'),auth[_0x9b86('0xa')](),controller['show']);router[_0x9b86('0xf')]('/',auth[_0x9b86('0xa')](),controller['create']);router[_0x9b86('0x10')](_0x9b86('0xe'),auth[_0x9b86('0xa')](),controller['update']);router[_0x9b86('0x11')](_0x9b86('0xe'),auth['isAuthenticated'](),controller[_0x9b86('0x12')]);module[_0x9b86('0x13')]=router; \ No newline at end of file +var _0x1bd7=['fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x1e7af1,_0x3c1e7c){var _0x11d548=function(_0x1d4447){while(--_0x1d4447){_0x1e7af1['push'](_0x1e7af1['shift']());}};_0x11d548(++_0x3c1e7c);}(_0x1bd7,0x1ca));var _0x71bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bd7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x71bd('0x0'));var util=require('util');var path=require(_0x71bd('0x1'));var timeout=require(_0x71bd('0x2'));var express=require('express');var router=express[_0x71bd('0x3')]();var fs_extra=require(_0x71bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x71bd('0x5'));var config=require(_0x71bd('0x6'));var controller=require(_0x71bd('0x7'));router[_0x71bd('0x8')]('/',auth['isAuthenticated'](),controller[_0x71bd('0x9')]);router['get'](_0x71bd('0xa'),auth['isAuthenticated'](),controller[_0x71bd('0xb')]);router[_0x71bd('0x8')](_0x71bd('0xc'),auth[_0x71bd('0xd')](),controller[_0x71bd('0xe')]);router[_0x71bd('0xf')]('/',auth[_0x71bd('0xd')](),controller[_0x71bd('0x10')]);router[_0x71bd('0x11')](_0x71bd('0xc'),auth[_0x71bd('0xd')](),controller[_0x71bd('0x12')]);router[_0x71bd('0x13')](_0x71bd('0xc'),auth[_0x71bd('0xd')](),controller[_0x71bd('0x14')]);module[_0x71bd('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index ac4595e..30459ad 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.attributes.js +++ b/server/api/chatProactiveAction/chatProactiveAction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06ff=['mouseOver','timeout','INTEGER','exports','STRING','ENUM'];(function(_0x1fcf69,_0x5c6c42){var _0x436785=function(_0x46986f){while(--_0x46986f){_0x1fcf69['push'](_0x1fcf69['shift']());}};_0x436785(++_0x5c6c42);}(_0x06ff,0xe7));var _0xf06f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x06ff[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xf06f('0x0')]={'name':{'type':Sequelize[_0xf06f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf06f('0x2')](_0xf06f('0x3'),_0xf06f('0x4')),'defaultValue':_0xf06f('0x3')},'selector':{'type':Sequelize[_0xf06f('0x1')]},'timeout':{'type':Sequelize[_0xf06f('0x5')]}}; \ No newline at end of file +var _0x9773=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x4a2da9,_0x42d63d){var _0x382dbc=function(_0xf7a203){while(--_0xf7a203){_0x4a2da9['push'](_0x4a2da9['shift']());}};_0x382dbc(++_0x42d63d);}(_0x9773,0x9b));var _0x3977=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9773[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3977('0x0'));module[_0x3977('0x1')]={'name':{'type':Sequelize[_0x3977('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3977('0x3')](_0x3977('0x4'),_0x3977('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x3977('0x2')]},'timeout':{'type':Sequelize[_0x3977('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index ac64967..bfee1a2 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.controller.js +++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b69=['limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','send','show','params','model','ChatProactiveAction','rawAttributes','query','keys','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined'];(function(_0x4b3da1,_0x48810f){var _0x55fe11=function(_0x1fb90d){while(--_0x1fb90d){_0x4b3da1['push'](_0x4b3da1['shift']());}};_0x55fe11(++_0x48810f);}(_0x9b69,0xa3));var _0x99b6=function(_0x59696e,_0x3e51c3){_0x59696e=_0x59696e-0x0;var _0x1cbd0a=_0x9b69[_0x59696e];return _0x1cbd0a;};'use strict';var emlformat=require(_0x99b6('0x0'));var rimraf=require(_0x99b6('0x1'));var zipdir=require(_0x99b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x99b6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x99b6('0x4'));var util=require(_0x99b6('0x5'));var path=require(_0x99b6('0x6'));var sox=require('sox');var csv=require(_0x99b6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99b6('0x8'));var _=require(_0x99b6('0x9'));var squel=require(_0x99b6('0xa'));var crypto=require(_0x99b6('0xb'));var jsforce=require(_0x99b6('0xc'));var deskjs=require(_0x99b6('0xd'));var toCsv=require(_0x99b6('0x7'));var querystring=require(_0x99b6('0xe'));var Papa=require(_0x99b6('0xf'));var Redis=require(_0x99b6('0x10'));var authService=require(_0x99b6('0x11'));var qs=require(_0x99b6('0x12'));var as=require(_0x99b6('0x13'));var hardwareService=require(_0x99b6('0x14'));var logger=require(_0x99b6('0x15'))(_0x99b6('0x16'));var utils=require(_0x99b6('0x17'));var config=require(_0x99b6('0x18'));var licenseUtil=require(_0x99b6('0x19'));var db=require(_0x99b6('0x1a'))['db'];function respondWithStatusCode(_0x48a408,_0x4fc440){_0x4fc440=_0x4fc440||0xcc;return function(_0x5791e5){if(_0x5791e5){return _0x48a408['sendStatus'](_0x4fc440);}return _0x48a408['status'](_0x4fc440)['end']();};}function respondWithResult(_0x54cd12,_0x172f35){_0x172f35=_0x172f35||0xc8;return function(_0x184e90){if(_0x184e90){return _0x54cd12[_0x99b6('0x1b')](_0x172f35)['json'](_0x184e90);}};}function respondWithFilteredResult(_0xb63749,_0x1ceee5){return function(_0x70b3f5){if(_0x70b3f5){var _0x417e9a=typeof _0x1ceee5['offset']===_0x99b6('0x1c')&&typeof _0x1ceee5[_0x99b6('0x1d')]===_0x99b6('0x1c');var _0x2a2bf2=_0x70b3f5[_0x99b6('0x1e')];var _0x3fd5ad=_0x417e9a?0x0:_0x1ceee5[_0x99b6('0x1f')];var _0x4cb2e7=_0x417e9a?_0x70b3f5[_0x99b6('0x1e')]:_0x1ceee5['offset']+_0x1ceee5[_0x99b6('0x1d')];var _0x391c6a;if(_0x4cb2e7>=_0x2a2bf2){_0x4cb2e7=_0x2a2bf2;_0x391c6a=0xc8;}else{_0x391c6a=0xce;}_0xb63749[_0x99b6('0x1b')](_0x391c6a);return _0xb63749[_0x99b6('0x20')](_0x99b6('0x21'),_0x3fd5ad+'-'+_0x4cb2e7+'/'+_0x2a2bf2)[_0x99b6('0x22')](_0x70b3f5);}return null;};}function patchUpdates(_0x35b47a){return function(_0x59045f){try{jsonpatch['apply'](_0x59045f,_0x35b47a,!![]);}catch(_0x11b866){return BPromise[_0x99b6('0x23')](_0x11b866);}return _0x59045f[_0x99b6('0x24')]();};}function saveUpdates(_0x465587,_0x4db3a8){return function(_0x38a916){if(_0x38a916){return _0x38a916[_0x99b6('0x25')](_0x465587)[_0x99b6('0x26')](function(_0x563210){return _0x563210;});}return null;};}function removeEntity(_0x13c52d,_0x22db3f){return function(_0x454d43){if(_0x454d43){return _0x454d43[_0x99b6('0x27')]()[_0x99b6('0x26')](function(){_0x13c52d[_0x99b6('0x1b')](0xcc)[_0x99b6('0x28')]();});}};}function handleEntityNotFound(_0x2d92a6,_0x1f8f01){return function(_0x58176f){if(!_0x58176f){_0x2d92a6[_0x99b6('0x29')](0x194);}return _0x58176f;};}function handleError(_0x47ce41,_0x39d788){_0x39d788=_0x39d788||0x1f4;return function(_0x486a7f){logger[_0x99b6('0x2a')](_0x486a7f[_0x99b6('0x2b')]);if(_0x486a7f['name']){delete _0x486a7f['name'];}_0x47ce41[_0x99b6('0x1b')](_0x39d788)[_0x99b6('0x2c')](_0x486a7f);};}exports[_0x99b6('0x2d')]=function(_0x48f796,_0x4a53fa){var _0x5a56fb={'raw':!![],'where':{'id':_0x48f796[_0x99b6('0x2e')]['id']}},_0x55e859={};_0x55e859[_0x99b6('0x2f')]=_['keys'](db[_0x99b6('0x30')][_0x99b6('0x31')]);_0x55e859[_0x99b6('0x32')]=_[_0x99b6('0x33')](_0x48f796[_0x99b6('0x32')]);_0x55e859['filters']=_[_0x99b6('0x34')](_0x55e859[_0x99b6('0x2f')],_0x55e859[_0x99b6('0x32')]);_0x5a56fb[_0x99b6('0x35')]=_[_0x99b6('0x34')](_0x55e859['model'],qs[_0x99b6('0x36')](_0x48f796[_0x99b6('0x32')][_0x99b6('0x36')]));_0x5a56fb[_0x99b6('0x35')]=_0x5a56fb[_0x99b6('0x35')][_0x99b6('0x37')]?_0x5a56fb[_0x99b6('0x35')]:_0x55e859[_0x99b6('0x2f')];if(_0x48f796['query'][_0x99b6('0x38')]){_0x5a56fb[_0x99b6('0x39')]=[{'all':!![]}];}_0x5a56fb=_[_0x99b6('0x3a')]({},_0x5a56fb,_0x48f796[_0x99b6('0x3b')]);return db[_0x99b6('0x30')][_0x99b6('0x3c')](_0x5a56fb)[_0x99b6('0x26')](handleEntityNotFound(_0x4a53fa,null))[_0x99b6('0x26')](respondWithResult(_0x4a53fa,null))[_0x99b6('0x3d')](handleError(_0x4a53fa,null));};exports['create']=function(_0x27c82e,_0x166924){return db['ChatProactiveAction'][_0x99b6('0x3e')](_0x27c82e['body'],{})[_0x99b6('0x26')](respondWithResult(_0x166924,0xc9))[_0x99b6('0x3d')](handleError(_0x166924,null));};exports[_0x99b6('0x25')]=function(_0x1350b1,_0x4e5fb5){if(_0x1350b1[_0x99b6('0x3f')]['id']){delete _0x1350b1['body']['id'];}return db[_0x99b6('0x30')][_0x99b6('0x3c')]({'where':{'id':_0x1350b1[_0x99b6('0x2e')]['id']}})[_0x99b6('0x26')](handleEntityNotFound(_0x4e5fb5,null))[_0x99b6('0x26')](saveUpdates(_0x1350b1[_0x99b6('0x3f')],null))[_0x99b6('0x26')](respondWithResult(_0x4e5fb5,null))[_0x99b6('0x3d')](handleError(_0x4e5fb5,null));};exports[_0x99b6('0x27')]=function(_0x34f785,_0xf99ed6){return db[_0x99b6('0x30')]['find']({'where':{'id':_0x34f785['params']['id']}})[_0x99b6('0x26')](handleEntityNotFound(_0xf99ed6,null))[_0x99b6('0x26')](removeEntity(_0xf99ed6,null))[_0x99b6('0x3d')](handleError(_0xf99ed6,null));}; \ No newline at end of file +var _0x8585=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','show','params','rawAttributes','query','keys','filters','intersection','model','fields','attributes','includeAll','include','options','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','fs-extra','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x21e591,_0x40612d){var _0x4c3223=function(_0x37b8f6){while(--_0x37b8f6){_0x21e591['push'](_0x21e591['shift']());}};_0x4c3223(++_0x40612d);}(_0x8585,0x64));var _0x5858=function(_0x31adf9,_0x511868){_0x31adf9=_0x31adf9-0x0;var _0x4412b5=_0x8585[_0x31adf9];return _0x4412b5;};'use strict';var emlformat=require(_0x5858('0x0'));var rimraf=require(_0x5858('0x1'));var zipdir=require(_0x5858('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5858('0x3'));var moment=require(_0x5858('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5858('0x5'));var sox=require(_0x5858('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5858('0x7'));var _=require(_0x5858('0x8'));var squel=require(_0x5858('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5858('0xa'));var toCsv=require(_0x5858('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5858('0xc'));var authService=require(_0x5858('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5858('0xe'));var hardwareService=require(_0x5858('0xf'));var logger=require(_0x5858('0x10'))(_0x5858('0x11'));var utils=require(_0x5858('0x12'));var config=require(_0x5858('0x13'));var licenseUtil=require(_0x5858('0x14'));var db=require(_0x5858('0x15'))['db'];function respondWithStatusCode(_0x31f0b3,_0x5659d6){_0x5659d6=_0x5659d6||0xcc;return function(_0x3cc424){if(_0x3cc424){return _0x31f0b3[_0x5858('0x16')](_0x5659d6);}return _0x31f0b3[_0x5858('0x17')](_0x5659d6)['end']();};}function respondWithResult(_0x3e62f8,_0x2db74c){_0x2db74c=_0x2db74c||0xc8;return function(_0x40335a){if(_0x40335a){return _0x3e62f8[_0x5858('0x17')](_0x2db74c)[_0x5858('0x18')](_0x40335a);}};}function respondWithFilteredResult(_0x623683,_0x34e900){return function(_0x329635){if(_0x329635){var _0x273f69=typeof _0x34e900[_0x5858('0x19')]===_0x5858('0x1a')&&typeof _0x34e900[_0x5858('0x1b')]===_0x5858('0x1a');var _0x1a0f9f=_0x329635[_0x5858('0x1c')];var _0x46d6ae=_0x273f69?0x0:_0x34e900['offset'];var _0x18100f=_0x273f69?_0x329635[_0x5858('0x1c')]:_0x34e900[_0x5858('0x19')]+_0x34e900['limit'];var _0x22b9af;if(_0x18100f>=_0x1a0f9f){_0x18100f=_0x1a0f9f;_0x22b9af=0xc8;}else{_0x22b9af=0xce;}_0x623683[_0x5858('0x17')](_0x22b9af);return _0x623683[_0x5858('0x1d')]('Content-Range',_0x46d6ae+'-'+_0x18100f+'/'+_0x1a0f9f)[_0x5858('0x18')](_0x329635);}return null;};}function patchUpdates(_0x229fe4){return function(_0x57c278){try{jsonpatch[_0x5858('0x1e')](_0x57c278,_0x229fe4,!![]);}catch(_0x254071){return BPromise[_0x5858('0x1f')](_0x254071);}return _0x57c278[_0x5858('0x20')]();};}function saveUpdates(_0xc74e2f,_0x49d1af){return function(_0x1d772c){if(_0x1d772c){return _0x1d772c[_0x5858('0x21')](_0xc74e2f)[_0x5858('0x22')](function(_0x4ee132){return _0x4ee132;});}return null;};}function removeEntity(_0x2a43de,_0x2f6328){return function(_0x28105f){if(_0x28105f){return _0x28105f[_0x5858('0x23')]()['then'](function(){_0x2a43de['status'](0xcc)[_0x5858('0x24')]();});}};}function handleEntityNotFound(_0x2e07ab,_0x53f2aa){return function(_0x517178){if(!_0x517178){_0x2e07ab['sendStatus'](0x194);}return _0x517178;};}function handleError(_0x1a1e50,_0x3df1dc){_0x3df1dc=_0x3df1dc||0x1f4;return function(_0x2c579e){logger['error'](_0x2c579e[_0x5858('0x25')]);if(_0x2c579e[_0x5858('0x26')]){delete _0x2c579e[_0x5858('0x26')];}_0x1a1e50['status'](_0x3df1dc)[_0x5858('0x27')](_0x2c579e);};}exports[_0x5858('0x28')]=function(_0xbc841e,_0x7ac5de){var _0x5776ca={'raw':!![],'where':{'id':_0xbc841e[_0x5858('0x29')]['id']}},_0x248bed={};_0x248bed['model']=_['keys'](db['ChatProactiveAction'][_0x5858('0x2a')]);_0x248bed[_0x5858('0x2b')]=_[_0x5858('0x2c')](_0xbc841e['query']);_0x248bed[_0x5858('0x2d')]=_[_0x5858('0x2e')](_0x248bed[_0x5858('0x2f')],_0x248bed[_0x5858('0x2b')]);_0x5776ca['attributes']=_[_0x5858('0x2e')](_0x248bed[_0x5858('0x2f')],qs['fields'](_0xbc841e[_0x5858('0x2b')][_0x5858('0x30')]));_0x5776ca[_0x5858('0x31')]=_0x5776ca[_0x5858('0x31')]['length']?_0x5776ca[_0x5858('0x31')]:_0x248bed[_0x5858('0x2f')];if(_0xbc841e['query'][_0x5858('0x32')]){_0x5776ca[_0x5858('0x33')]=[{'all':!![]}];}_0x5776ca=_['merge']({},_0x5776ca,_0xbc841e[_0x5858('0x34')]);return db[_0x5858('0x35')][_0x5858('0x36')](_0x5776ca)[_0x5858('0x22')](handleEntityNotFound(_0x7ac5de,null))['then'](respondWithResult(_0x7ac5de,null))[_0x5858('0x37')](handleError(_0x7ac5de,null));};exports['create']=function(_0x29266b,_0x593834){return db[_0x5858('0x35')][_0x5858('0x38')](_0x29266b[_0x5858('0x39')],{})[_0x5858('0x22')](respondWithResult(_0x593834,0xc9))[_0x5858('0x37')](handleError(_0x593834,null));};exports[_0x5858('0x21')]=function(_0x5baddc,_0x56e6a7){if(_0x5baddc['body']['id']){delete _0x5baddc[_0x5858('0x39')]['id'];}return db[_0x5858('0x35')][_0x5858('0x36')]({'where':{'id':_0x5baddc[_0x5858('0x29')]['id']}})[_0x5858('0x22')](handleEntityNotFound(_0x56e6a7,null))[_0x5858('0x22')](saveUpdates(_0x5baddc[_0x5858('0x39')],null))[_0x5858('0x22')](respondWithResult(_0x56e6a7,null))['catch'](handleError(_0x56e6a7,null));};exports[_0x5858('0x23')]=function(_0x2c66c7,_0x139a7b){return db[_0x5858('0x35')]['find']({'where':{'id':_0x2c66c7[_0x5858('0x29')]['id']}})['then'](handleEntityNotFound(_0x139a7b,null))[_0x5858('0x22')](removeEntity(_0x139a7b,null))['catch'](handleError(_0x139a7b,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index e69b7ec..2de4121 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.model.js +++ b/server/api/chatProactiveAction/chatProactiveAction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3820=['rimraf','../../config/environment','./chatProactiveAction.attributes','ChatProactiveAction','chat_proactive_actions','lodash','api','bluebird','request-promise','path'];(function(_0x10197a,_0x5b7bb6){var _0x11ad2b=function(_0x5b8bc9){while(--_0x5b8bc9){_0x10197a['push'](_0x10197a['shift']());}};_0x11ad2b(++_0x5b7bb6);}(_0x3820,0x13b));var _0x0382=function(_0x4a2707,_0x56a7aa){_0x4a2707=_0x4a2707-0x0;var _0x2eb468=_0x3820[_0x4a2707];return _0x2eb468;};'use strict';var _=require(_0x0382('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0382('0x1'));var moment=require('moment');var BPromise=require(_0x0382('0x2'));var rp=require(_0x0382('0x3'));var fs=require('fs');var path=require(_0x0382('0x4'));var rimraf=require(_0x0382('0x5'));var config=require(_0x0382('0x6'));var attributes=require(_0x0382('0x7'));module['exports']=function(_0x41f574,_0xac8728){return _0x41f574['define'](_0x0382('0x8'),attributes,{'tableName':_0x0382('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x843a=['exports','define','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x843a,0x1b3));var _0xa843=function(_0x41d5d8,_0x453a3c){_0x41d5d8=_0x41d5d8-0x0;var _0x5f1106=_0x843a[_0x41d5d8];return _0x5f1106;};'use strict';var _=require('lodash');var util=require(_0xa843('0x0'));var logger=require(_0xa843('0x1'))(_0xa843('0x2'));var moment=require(_0xa843('0x3'));var BPromise=require(_0xa843('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa843('0x5'));var rimraf=require(_0xa843('0x6'));var config=require(_0xa843('0x7'));var attributes=require(_0xa843('0x8'));module[_0xa843('0x9')]=function(_0x1f29e1,_0x5f0673){return _0x1f29e1[_0xa843('0xa')]('ChatProactiveAction',attributes,{'tableName':_0xa843('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index b569bb3..9abf5d6 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.rpc.js +++ b/server/api/chatProactiveAction/chatProactiveAction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51a2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x30545e,_0x4ee917){var _0xb34f55=function(_0x17545e){while(--_0x17545e){_0x30545e['push'](_0x30545e['shift']());}};_0xb34f55(++_0x4ee917);}(_0x51a2,0xca));var _0x251a=function(_0x59bd3b,_0x53eff9){_0x59bd3b=_0x59bd3b-0x0;var _0x586c53=_0x51a2[_0x59bd3b];return _0x586c53;};'use strict';var _=require(_0x251a('0x0'));var util=require(_0x251a('0x1'));var moment=require(_0x251a('0x2'));var BPromise=require(_0x251a('0x3'));var rs=require(_0x251a('0x4'));var fs=require('fs');var Redis=require(_0x251a('0x5'));var db=require(_0x251a('0x6'))['db'];var utils=require(_0x251a('0x7'));var logger=require(_0x251a('0x8'))('rpc');var config=require(_0x251a('0x9'));var jayson=require(_0x251a('0xa'));var client=jayson['client'][_0x251a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dc4cf,_0x3797a1,_0x273a23){return new BPromise(function(_0x3f4702,_0xaa330b){return client[_0x251a('0xc')](_0x5dc4cf,_0x273a23)[_0x251a('0xd')](function(_0x532579){logger[_0x251a('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x3797a1,_0x251a('0xf'));logger['debug'](_0x251a('0x10'),_0x3797a1,_0x251a('0xf'),JSON[_0x251a('0x11')](_0x532579));if(_0x532579[_0x251a('0x12')]){if(_0x532579['error']['code']===0x1f4){logger['error'](_0x251a('0x13'),_0x3797a1,_0x532579[_0x251a('0x12')][_0x251a('0x14')]);return _0xaa330b(_0x532579[_0x251a('0x12')][_0x251a('0x14')]);}logger[_0x251a('0x12')](_0x251a('0x13'),_0x3797a1,_0x532579[_0x251a('0x12')][_0x251a('0x14')]);return _0x3f4702(_0x532579[_0x251a('0x12')]['message']);}else{logger[_0x251a('0xe')](_0x251a('0x13'),_0x3797a1,_0x251a('0xf'));_0x3f4702(_0x532579[_0x251a('0x15')][_0x251a('0x14')]);}})[_0x251a('0x16')](function(_0x1cf48c){logger[_0x251a('0x12')](_0x251a('0x13'),_0x3797a1,_0x1cf48c);_0xaa330b(_0x1cf48c);});});} \ No newline at end of file +var _0xa4e8=['request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x4e713e,_0x1ac682){var _0x296ac0=function(_0x26a297){while(--_0x26a297){_0x4e713e['push'](_0x4e713e['shift']());}};_0x296ac0(++_0x1ac682);}(_0xa4e8,0x99));var _0x8a4e=function(_0x449487,_0x145fa3){_0x449487=_0x449487-0x0;var _0x2db51e=_0xa4e8[_0x449487];return _0x2db51e;};'use strict';var _=require(_0x8a4e('0x0'));var util=require(_0x8a4e('0x1'));var moment=require(_0x8a4e('0x2'));var BPromise=require(_0x8a4e('0x3'));var rs=require(_0x8a4e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a4e('0x5'))['db'];var utils=require(_0x8a4e('0x6'));var logger=require(_0x8a4e('0x7'))('rpc');var config=require(_0x8a4e('0x8'));var jayson=require(_0x8a4e('0x9'));var client=jayson[_0x8a4e('0xa')][_0x8a4e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fdd0c,_0x4bd448,_0x19f095){return new BPromise(function(_0xd00255,_0x1ef696){return client['request'](_0x1fdd0c,_0x19f095)[_0x8a4e('0xc')](function(_0x30fc6b){logger[_0x8a4e('0xd')](_0x8a4e('0xe'),_0x4bd448,_0x8a4e('0xf'));logger[_0x8a4e('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4bd448,_0x8a4e('0xf'),JSON['stringify'](_0x30fc6b));if(_0x30fc6b[_0x8a4e('0x11')]){if(_0x30fc6b[_0x8a4e('0x11')][_0x8a4e('0x12')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4bd448,_0x30fc6b['error'][_0x8a4e('0x13')]);return _0x1ef696(_0x30fc6b[_0x8a4e('0x11')][_0x8a4e('0x13')]);}logger['error'](_0x8a4e('0xe'),_0x4bd448,_0x30fc6b[_0x8a4e('0x11')][_0x8a4e('0x13')]);return _0xd00255(_0x30fc6b['error']['message']);}else{logger[_0x8a4e('0xd')](_0x8a4e('0xe'),_0x4bd448,_0x8a4e('0xf'));_0xd00255(_0x30fc6b['result'][_0x8a4e('0x13')]);}})[_0x8a4e('0x14')](function(_0x1cb9e3){logger[_0x8a4e('0x11')](_0x8a4e('0xe'),_0x4bd448,_0x1cb9e3);_0x1ef696(_0x1cb9e3);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 7f07456..47ab15a 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4819=['post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x1f75e8,_0x7fa97f){var _0x120699=function(_0x4d817b){while(--_0x4d817b){_0x1f75e8['push'](_0x1f75e8['shift']());}};_0x120699(++_0x7fa97f);}(_0x4819,0xcd));var _0x9481=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x4819[_0x26fc81];return _0x9feece;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get'](_0x9481('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9481('0xb')]('/',auth[_0x9481('0xc')](),controller[_0x9481('0xd')]);router[_0x9481('0xe')](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['delete'](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);module[_0x9481('0x11')]=router; \ No newline at end of file +var _0x5fc3=['create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','show','isAuthenticated'];(function(_0x52d121,_0x1e3558){var _0x1ea01a=function(_0x31ebe8){while(--_0x31ebe8){_0x52d121['push'](_0x52d121['shift']());}};_0x1ea01a(++_0x1e3558);}(_0x5fc3,0xa8));var _0x35fc=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x5fc3[_0x503950];return _0x1657a9;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x35fc('0xa')]);router['post']('/',auth[_0x35fc('0xb')](),controller[_0x35fc('0xc')]);router[_0x35fc('0xd')](_0x35fc('0xe'),auth[_0x35fc('0xb')](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xb')](),controller[_0x35fc('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 66dbff5..daaa35f 100644 --- a/server/api/chatQueue/chatQueue.attributes.js +++ b/server/api/chatQueue/chatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe65=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x29208d,_0x345a28){var _0x1e5ed3=function(_0x14d8a2){while(--_0x14d8a2){_0x29208d['push'](_0x29208d['shift']());}};_0x1e5ed3(++_0x345a28);}(_0xfe65,0x1af));var _0x5fe6=function(_0x5188e5,_0x2b8f64){_0x5188e5=_0x5188e5-0x0;var _0x312bb3=_0xfe65[_0x5188e5];return _0x312bb3;};'use strict';var Sequelize=require('sequelize');module[_0x5fe6('0x0')]={'name':{'type':Sequelize[_0x5fe6('0x1')],'unique':_0x5fe6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5fe6('0x1')]},'timeout':{'type':Sequelize[_0x5fe6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5fe6('0x4')](_0x5fe6('0x5'),_0x5fe6('0x6'),_0x5fe6('0x7'))}}; \ No newline at end of file +var _0xcd93=['rrmemory','beepall','exports','STRING','name','INTEGER','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd93,0x105));var _0x3cd9=function(_0x53c023,_0x1b911a){_0x53c023=_0x53c023-0x0;var _0x29d80f=_0xcd93[_0x53c023];return _0x29d80f;};'use strict';var Sequelize=require('sequelize');module[_0x3cd9('0x0')]={'name':{'type':Sequelize[_0x3cd9('0x1')],'unique':_0x3cd9('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3cd9('0x1')]},'timeout':{'type':Sequelize[_0x3cd9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3cd9('0x4')](_0x3cd9('0x5'),_0x3cd9('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 828fb0a..473369d 100644 --- a/server/api/chatQueue/chatQueue.controller.js +++ b/server/api/chatQueue/chatQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfca=['then','request\x20sent','debug','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','get','ChatQueues','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueue','includeAll','include','findAll','rows','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','hasOwnProperty','ChatQueueId','User','UserId','agent','updatedAt','createdAt','%s/%s','findOne','getTeams','ids','Team','Agents','online','flatMap','addTeams','each','UserChatQueue','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','request'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0xbfca,0x77));var _0xabfc=function(_0x113ba3,_0x531b09){_0x113ba3=_0x113ba3-0x0;var _0x38ae53=_0xbfca[_0x113ba3];return _0x38ae53;};'use strict';var emlformat=require(_0xabfc('0x0'));var rimraf=require(_0xabfc('0x1'));var zipdir=require(_0xabfc('0x2'));var jsonpatch=require(_0xabfc('0x3'));var rp=require(_0xabfc('0x4'));var moment=require('moment');var BPromise=require(_0xabfc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xabfc('0x6'));var csv=require(_0xabfc('0x7'));var ejs=require(_0xabfc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabfc('0x9'));var squel=require(_0xabfc('0xa'));var crypto=require(_0xabfc('0xb'));var jsforce=require(_0xabfc('0xc'));var deskjs=require(_0xabfc('0xd'));var toCsv=require(_0xabfc('0x7'));var querystring=require(_0xabfc('0xe'));var Papa=require(_0xabfc('0xf'));var Redis=require(_0xabfc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xabfc('0x11'));var hardwareService=require(_0xabfc('0x12'));var logger=require(_0xabfc('0x13'))('api');var utils=require(_0xabfc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xabfc('0x15'));var db=require(_0xabfc('0x16'))['db'];config[_0xabfc('0x17')]=_[_0xabfc('0x18')](config[_0xabfc('0x17')],{'host':_0xabfc('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabfc('0x17')]));require(_0xabfc('0x1a'))[_0xabfc('0x1b')](socket);var jayson=require(_0xabfc('0x1c'));var client=jayson[_0xabfc('0x1d')][_0xabfc('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x31d2ea,_0x41607b,_0x18ec13,_0x4790a1){return new BPromise(function(_0x586e1f,_0x55ed92){var _0x19c230=_0x4790a1||client;return _0x19c230[_0xabfc('0x1f')](_0x31d2ea,_0x18ec13)[_0xabfc('0x20')](function(_0x160742){logger['info']('ChatQueue,\x20%s,\x20%s',_0x41607b,_0xabfc('0x21'));logger[_0xabfc('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x41607b,_0xabfc('0x21'),JSON[_0xabfc('0x23')](_0x160742));if(_0x160742['error']){if(_0x160742[_0xabfc('0x24')][_0xabfc('0x25')]===0x1f4){logger[_0xabfc('0x24')](_0xabfc('0x26'),_0x41607b,_0x160742[_0xabfc('0x24')][_0xabfc('0x27')]);return _0x55ed92(_0x160742[_0xabfc('0x24')][_0xabfc('0x27')]);}logger[_0xabfc('0x24')](_0xabfc('0x26'),_0x41607b,_0x160742[_0xabfc('0x24')][_0xabfc('0x27')]);return _0x586e1f(_0x160742['error'][_0xabfc('0x27')]);}else{logger['info'](_0xabfc('0x26'),_0x41607b,_0xabfc('0x21'));_0x586e1f(_0x160742[_0xabfc('0x28')][_0xabfc('0x27')]);}})[_0xabfc('0x29')](function(_0x55f485){logger[_0xabfc('0x24')](_0xabfc('0x26'),_0x41607b,_0x55f485);_0x55ed92(_0x55f485);});});}function respondWithStatusCode(_0x3bc33c,_0x54c197){_0x54c197=_0x54c197||0xcc;return function(_0xe80ca){if(_0xe80ca){return _0x3bc33c['sendStatus'](_0x54c197);}return _0x3bc33c[_0xabfc('0x2a')](_0x54c197)[_0xabfc('0x2b')]();};}function respondWithResult(_0x59416f,_0x3409f5){_0x3409f5=_0x3409f5||0xc8;return function(_0x27887e){if(_0x27887e){return _0x59416f[_0xabfc('0x2a')](_0x3409f5)[_0xabfc('0x2c')](_0x27887e);}};}function respondWithFilteredResult(_0x25421d,_0xc16b9b){return function(_0x21596a){if(_0x21596a){var _0x1bff54=typeof _0xc16b9b['offset']===_0xabfc('0x2d')&&typeof _0xc16b9b[_0xabfc('0x2e')]===_0xabfc('0x2d');var _0x4fb894=_0x21596a[_0xabfc('0x2f')];var _0x46feff=_0x1bff54?0x0:_0xc16b9b[_0xabfc('0x30')];var _0x5b047d=_0x1bff54?_0x21596a[_0xabfc('0x2f')]:_0xc16b9b['offset']+_0xc16b9b[_0xabfc('0x2e')];var _0x3dc1b9;if(_0x5b047d>=_0x4fb894){_0x5b047d=_0x4fb894;_0x3dc1b9=0xc8;}else{_0x3dc1b9=0xce;}_0x25421d['status'](_0x3dc1b9);return _0x25421d[_0xabfc('0x31')](_0xabfc('0x32'),_0x46feff+'-'+_0x5b047d+'/'+_0x4fb894)[_0xabfc('0x2c')](_0x21596a);}return null;};}function patchUpdates(_0x4eb20a){return function(_0x514838){try{jsonpatch['apply'](_0x514838,_0x4eb20a,!![]);}catch(_0x548d7f){return BPromise[_0xabfc('0x33')](_0x548d7f);}return _0x514838[_0xabfc('0x34')]();};}function saveUpdates(_0x42a276,_0x190331){return function(_0x454cef){if(_0x454cef){return _0x454cef[_0xabfc('0x35')](_0x42a276)[_0xabfc('0x20')](function(_0x3d1966){return _0x3d1966;});}return null;};}function removeEntity(_0x2ca879,_0x2cee42){return function(_0x2e3dba){if(_0x2e3dba){return _0x2e3dba['destroy']()['then'](function(){var _0x23acc4=_0x2e3dba[_0xabfc('0x36')]({'plain':!![]});var _0xcd6399=_0xabfc('0x37');return db[_0xabfc('0x38')]['destroy']({'where':{'type':_0xcd6399,'resourceId':_0x23acc4['id']}})[_0xabfc('0x20')](function(){return _0x2e3dba;});})[_0xabfc('0x20')](function(){_0x2ca879[_0xabfc('0x2a')](0xcc)[_0xabfc('0x2b')]();});}};}function handleEntityNotFound(_0x34fe66,_0x203ea2){return function(_0x30c37a){if(!_0x30c37a){_0x34fe66[_0xabfc('0x39')](0x194);}return _0x30c37a;};}function handleError(_0x259f09,_0x228d6c){_0x228d6c=_0x228d6c||0x1f4;return function(_0x524029){logger[_0xabfc('0x24')](_0x524029[_0xabfc('0x3a')]);if(_0x524029['name']){delete _0x524029[_0xabfc('0x3b')];}_0x259f09[_0xabfc('0x2a')](_0x228d6c)[_0xabfc('0x3c')](_0x524029);};}exports[_0xabfc('0x3d')]=function(_0xc7a190,_0x553f9a){var _0x48b718={},_0x4b5b49={},_0x599afb={'count':0x0,'rows':[]};var _0x17ed6c=_[_0xabfc('0x3e')](db['ChatQueue'][_0xabfc('0x3f')],function(_0x4c2c5b){return{'name':_0x4c2c5b[_0xabfc('0x40')],'type':_0x4c2c5b['type'][_0xabfc('0x41')]};});_0x4b5b49[_0xabfc('0x42')]=_['map'](_0x17ed6c,'name');_0x4b5b49[_0xabfc('0x43')]=_['keys'](_0xc7a190[_0xabfc('0x43')]);_0x4b5b49[_0xabfc('0x44')]=_['intersection'](_0x4b5b49['model'],_0x4b5b49[_0xabfc('0x43')]);_0x48b718[_0xabfc('0x45')]=_[_0xabfc('0x46')](_0x4b5b49[_0xabfc('0x42')],qs[_0xabfc('0x47')](_0xc7a190['query']['fields']));_0x48b718[_0xabfc('0x45')]=_0x48b718['attributes'][_0xabfc('0x48')]?_0x48b718[_0xabfc('0x45')]:_0x4b5b49['model'];if(!_0xc7a190['query']['hasOwnProperty'](_0xabfc('0x49'))){_0x48b718[_0xabfc('0x2e')]=qs['limit'](_0xc7a190[_0xabfc('0x43')]['limit']);_0x48b718[_0xabfc('0x30')]=qs[_0xabfc('0x30')](_0xc7a190[_0xabfc('0x43')][_0xabfc('0x30')]);}_0x48b718[_0xabfc('0x4a')]=qs[_0xabfc('0x4b')](_0xc7a190['query'][_0xabfc('0x4b')]);_0x48b718[_0xabfc('0x4c')]=qs[_0xabfc('0x44')](_[_0xabfc('0x4d')](_0xc7a190[_0xabfc('0x43')],_0x4b5b49[_0xabfc('0x44')]),_0x17ed6c);if(_0xc7a190[_0xabfc('0x43')][_0xabfc('0x4e')]){_0x48b718[_0xabfc('0x4c')]=_[_0xabfc('0x4f')](_0x48b718[_0xabfc('0x4c')],{'$or':_[_0xabfc('0x3e')](_0x17ed6c,function(_0x2a5b2d){if(_0x2a5b2d['type']!==_0xabfc('0x50')){var _0x4c561e={};_0x4c561e[_0x2a5b2d[_0xabfc('0x3b')]]={'$like':'%'+_0xc7a190[_0xabfc('0x43')][_0xabfc('0x4e')]+'%'};return _0x4c561e;}})});}_0x48b718=_[_0xabfc('0x4f')]({},_0x48b718,_0xc7a190[_0xabfc('0x51')]);var _0x4c3aa0={'where':_0x48b718['where']};return db[_0xabfc('0x52')]['count'](_0x4c3aa0)[_0xabfc('0x20')](function(_0x384e50){_0x599afb[_0xabfc('0x2f')]=_0x384e50;if(_0xc7a190['query'][_0xabfc('0x53')]){_0x48b718[_0xabfc('0x54')]=[{'all':!![]}];}return db['ChatQueue'][_0xabfc('0x55')](_0x48b718);})[_0xabfc('0x20')](function(_0x57d146){_0x599afb[_0xabfc('0x56')]=_0x57d146;return _0x599afb;})[_0xabfc('0x20')](respondWithFilteredResult(_0x553f9a,_0x48b718))['catch'](handleError(_0x553f9a,null));};exports[_0xabfc('0x57')]=function(_0x1ff16b,_0x1f42fd){var _0x360780={'raw':!![],'where':{'id':_0x1ff16b[_0xabfc('0x58')]['id']}},_0x5c3250={};_0x5c3250[_0xabfc('0x42')]=_[_0xabfc('0x59')](db[_0xabfc('0x52')][_0xabfc('0x3f')]);_0x5c3250[_0xabfc('0x43')]=_[_0xabfc('0x59')](_0x1ff16b[_0xabfc('0x43')]);_0x5c3250[_0xabfc('0x44')]=_[_0xabfc('0x46')](_0x5c3250[_0xabfc('0x42')],_0x5c3250[_0xabfc('0x43')]);_0x360780['attributes']=_[_0xabfc('0x46')](_0x5c3250[_0xabfc('0x42')],qs[_0xabfc('0x47')](_0x1ff16b[_0xabfc('0x43')][_0xabfc('0x47')]));_0x360780[_0xabfc('0x45')]=_0x360780[_0xabfc('0x45')]['length']?_0x360780[_0xabfc('0x45')]:_0x5c3250[_0xabfc('0x42')];if(_0x1ff16b['query']['includeAll']){_0x360780['include']=[{'all':!![]}];}_0x360780=_[_0xabfc('0x4f')]({},_0x360780,_0x1ff16b[_0xabfc('0x51')]);return db[_0xabfc('0x52')][_0xabfc('0x5a')](_0x360780)['then'](handleEntityNotFound(_0x1f42fd,null))['then'](respondWithResult(_0x1f42fd,null))[_0xabfc('0x29')](handleError(_0x1f42fd,null));};exports[_0xabfc('0x5b')]=function(_0x23dc92,_0x49fdec){return db[_0xabfc('0x52')][_0xabfc('0x5b')](_0x23dc92[_0xabfc('0x5c')],{})['then'](function(_0x29d887){var _0x3ee69a=_0x23dc92[_0xabfc('0x5d')][_0xabfc('0x36')]({'plain':!![]});if(!_0x3ee69a)throw new Error(_0xabfc('0x5e'));if(_0x3ee69a['role']===_0xabfc('0x5d')){var _0x38c695=_0x29d887[_0xabfc('0x36')]({'plain':!![]});var _0xe54748=_0xabfc('0x37');return db['UserProfileSection']['find']({'where':{'name':_0xe54748,'userProfileId':_0x3ee69a[_0xabfc('0x5f')]},'raw':!![]})[_0xabfc('0x20')](function(_0x5118a6){if(_0x5118a6&&_0x5118a6[_0xabfc('0x60')]===0x0){return db[_0xabfc('0x38')][_0xabfc('0x5b')]({'name':_0x38c695[_0xabfc('0x3b')],'resourceId':_0x38c695['id'],'type':_0x5118a6[_0xabfc('0x3b')],'sectionId':_0x5118a6['id']},{})['then'](function(){return _0x29d887;});}else{return _0x29d887;}})[_0xabfc('0x29')](function(_0x1c60e2){logger[_0xabfc('0x24')](_0xabfc('0x61'),_0x1c60e2);throw _0x1c60e2;});}return _0x29d887;})[_0xabfc('0x20')](respondWithResult(_0x49fdec,0xc9))['catch'](handleError(_0x49fdec,null));};exports[_0xabfc('0x35')]=function(_0x3cc8d0,_0xaad728){if(_0x3cc8d0[_0xabfc('0x5c')]['id']){delete _0x3cc8d0[_0xabfc('0x5c')]['id'];}return db[_0xabfc('0x52')][_0xabfc('0x5a')]({'where':{'id':_0x3cc8d0[_0xabfc('0x58')]['id']}})['then'](handleEntityNotFound(_0xaad728,null))[_0xabfc('0x20')](saveUpdates(_0x3cc8d0[_0xabfc('0x5c')],null))[_0xabfc('0x20')](respondWithResult(_0xaad728,null))[_0xabfc('0x29')](handleError(_0xaad728,null));};exports[_0xabfc('0x62')]=function(_0x4c526e,_0x16b176){return db['ChatQueue'][_0xabfc('0x5a')]({'where':{'id':_0x4c526e[_0xabfc('0x58')]['id']}})[_0xabfc('0x20')](handleEntityNotFound(_0x16b176,null))[_0xabfc('0x20')](removeEntity(_0x16b176,null))['catch'](handleError(_0x16b176,null));};exports[_0xabfc('0x63')]=function(_0x4a09aa,_0x5e537c){return db[_0xabfc('0x52')]['describe']()[_0xabfc('0x20')](respondWithResult(_0x5e537c,null))['catch'](handleError(_0x5e537c,null));};exports[_0xabfc('0x64')]=function(_0x14f02f,_0x2af8bd,_0x3902fd){var _0x5e2642={'raw':!![],'where':{}},_0x57648e={},_0x839aec;return db[_0xabfc('0x52')]['findOne']({'where':{'id':_0x14f02f[_0xabfc('0x58')]['id']}})['then'](handleEntityNotFound(_0x2af8bd,null))[_0xabfc('0x20')](function(_0x2b070d){if(_0x2b070d){_0x839aec=_0x2b070d[_0xabfc('0x36')]({'plain':!![]});_0x57648e[_0xabfc('0x42')]=_[_0xabfc('0x59')](db['UserChatQueue'][_0xabfc('0x3f')]);_0x57648e['query']=_[_0xabfc('0x59')](_0x14f02f[_0xabfc('0x43')]);_0x57648e['filters']=_['intersection'](_0x57648e['model'],_0x57648e[_0xabfc('0x43')]);_0x5e2642['attributes']=_['intersection'](_0x57648e[_0xabfc('0x42')],qs['fields'](_0x14f02f['query']['fields']));_0x5e2642[_0xabfc('0x45')]=_0x5e2642['attributes'][_0xabfc('0x48')]?_0x5e2642[_0xabfc('0x45')]:_0x57648e[_0xabfc('0x42')];if(!_0x14f02f[_0xabfc('0x43')][_0xabfc('0x65')](_0xabfc('0x49'))){_0x5e2642[_0xabfc('0x2e')]=qs['limit'](_0x14f02f[_0xabfc('0x43')][_0xabfc('0x2e')]);_0x5e2642['offset']=qs[_0xabfc('0x30')](_0x14f02f[_0xabfc('0x43')][_0xabfc('0x30')]);}_0x5e2642['order']=qs[_0xabfc('0x4b')](_0x14f02f[_0xabfc('0x43')][_0xabfc('0x4b')]);_0x5e2642[_0xabfc('0x4c')]=qs['filters'](_['pick'](_0x14f02f[_0xabfc('0x43')],_0x57648e[_0xabfc('0x44')]));_0x5e2642[_0xabfc('0x4c')][_0xabfc('0x66')]=_0x2b070d['id'];if(_0x14f02f[_0xabfc('0x43')][_0xabfc('0x4e')]){_0x5e2642['where']=_[_0xabfc('0x4f')](_0x5e2642[_0xabfc('0x4c')],{'$or':_[_0xabfc('0x3e')](_0x5e2642[_0xabfc('0x45')],function(_0x3b3104){var _0x1848ac={};_0x1848ac[_0x3b3104]={'$like':'%'+_0x14f02f[_0xabfc('0x43')]['filter']+'%'};return _0x1848ac;})});}_0x5e2642=_[_0xabfc('0x4f')]({},_0x5e2642,_0x14f02f[_0xabfc('0x51')]);return db['UserChatQueue'][_0xabfc('0x55')](_0x5e2642);}})[_0xabfc('0x20')](function(_0x331fdf){if(_0x331fdf){return db[_0xabfc('0x67')]['findAndCountAll']({'where':{'id':_[_0xabfc('0x3e')](_0x331fdf,_0xabfc('0x68')),'role':_0xabfc('0x69')},'attributes':['id',_0xabfc('0x3b'),'chatPause',_0xabfc('0x6a'),_0xabfc('0x6b')]});}})[_0xabfc('0x20')](function(_0x372e43){if(_0x372e43){return{'count':_0x372e43[_0xabfc('0x2f')],'rows':_[_0xabfc('0x3e')](_0x372e43[_0xabfc('0x56')],function(_0x1705d8){return{'membername':_0x1705d8[_0xabfc('0x3b')],'UserId':_0x1705d8['id'],'queue_name':_0x839aec[_0xabfc('0x3b')],'ChatQueueId':_0x839aec['id'],'interface':util['format'](_0xabfc('0x6c'),'SIP',_0x1705d8['name']),'penalty':0x0,'paused':_0x1705d8['chatPause'],'createdAt':_0x1705d8[_0xabfc('0x6b')],'updatedAt':_0x1705d8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xabfc('0x20')](respondWithFilteredResult(_0x2af8bd,_0x5e2642))[_0xabfc('0x29')](handleError(_0x2af8bd,null));};exports['getTeams']=function(_0xb15325,_0x409444,_0x323103){var _0x13781f={};var _0xaf14e7={};var _0x2bcbeb;var _0x2905d8;return db[_0xabfc('0x52')][_0xabfc('0x6d')]({'where':{'id':_0xb15325[_0xabfc('0x58')]['id']}})['then'](handleEntityNotFound(_0x409444,null))[_0xabfc('0x20')](function(_0x56446b){if(_0x56446b){_0x2bcbeb=_0x56446b;_0xaf14e7['model']=_[_0xabfc('0x59')](db['Team'][_0xabfc('0x3f')]);_0xaf14e7[_0xabfc('0x43')]=_['keys'](_0xb15325[_0xabfc('0x43')]);_0xaf14e7['filters']=_[_0xabfc('0x46')](_0xaf14e7[_0xabfc('0x42')],_0xaf14e7[_0xabfc('0x43')]);_0x13781f[_0xabfc('0x45')]=_[_0xabfc('0x46')](_0xaf14e7['model'],qs[_0xabfc('0x47')](_0xb15325[_0xabfc('0x43')][_0xabfc('0x47')]));_0x13781f['attributes']=_0x13781f[_0xabfc('0x45')][_0xabfc('0x48')]?_0x13781f[_0xabfc('0x45')]:_0xaf14e7[_0xabfc('0x42')];_0x13781f['order']=qs[_0xabfc('0x4b')](_0xb15325[_0xabfc('0x43')][_0xabfc('0x4b')]);_0x13781f[_0xabfc('0x4c')]=qs[_0xabfc('0x44')](_['pick'](_0xb15325[_0xabfc('0x43')],_0xaf14e7[_0xabfc('0x44')]));if(_0xb15325['query'][_0xabfc('0x4e')]){_0x13781f[_0xabfc('0x4c')]=_[_0xabfc('0x4f')](_0x13781f[_0xabfc('0x4c')],{'$or':_['map'](_0x13781f['attributes'],function(_0x3fd5a6){var _0x44b2a9={};_0x44b2a9[_0x3fd5a6]={'$like':'%'+_0xb15325[_0xabfc('0x43')][_0xabfc('0x4e')]+'%'};return _0x44b2a9;})});}_0x13781f=_[_0xabfc('0x4f')]({},_0x13781f,_0xb15325['options']);return _0x2bcbeb[_0xabfc('0x6e')](_0x13781f);}})[_0xabfc('0x20')](function(_0x23ccd9){if(_0x23ccd9){_0x2905d8=_0x23ccd9[_0xabfc('0x48')];if(!_0xb15325[_0xabfc('0x43')]['hasOwnProperty'](_0xabfc('0x49'))){_0x13781f[_0xabfc('0x2e')]=qs[_0xabfc('0x2e')](_0xb15325[_0xabfc('0x43')][_0xabfc('0x2e')]);_0x13781f['offset']=qs[_0xabfc('0x30')](_0xb15325['query'][_0xabfc('0x30')]);}return _0x2bcbeb[_0xabfc('0x6e')](_0x13781f);}})[_0xabfc('0x20')](function(_0x36a22a){if(_0x36a22a){return _0x36a22a?{'count':_0x2905d8,'rows':_0x36a22a}:null;}})['then'](respondWithResult(_0x409444,null))['catch'](handleError(_0x409444,null));};exports['addTeams']=function(_0xb202eb,_0x4f8c9a,_0x1b4c68){var _0x16d981=_0xb202eb[_0xabfc('0x5c')][_0xabfc('0x6f')];return db[_0xabfc('0x70')]['findAll']({'where':{'id':_0x16d981},'attributes':['id'],'include':[{'model':db[_0xabfc('0x67')],'as':_0xabfc('0x71'),'attributes':['id',_0xabfc('0x3b'),_0xabfc('0x72'),'voicePause','interface'],'raw':!![]}]})[_0xabfc('0x20')](function(_0x1b9b93){if(_0x1b9b93){var _0x183efc=_[_0xabfc('0x73')](_0x1b9b93,function(_0x16eccc){var _0x441554=_0x16eccc['get']({'plain':!![]});return _0x441554[_0xabfc('0x71')];});return db[_0xabfc('0x52')][_0xabfc('0x5a')]({'where':{'id':_0xb202eb[_0xabfc('0x58')]['id']}})['then'](function(_0x36aa6d){return db['sequelize']['transaction'](function(_0x40c0f6){return _0x36aa6d[_0xabfc('0x74')](_0x16d981,{'transaction':_0x40c0f6})['then'](function(){return BPromise[_0xabfc('0x75')](_0x183efc,function(_0x3ba574){return db[_0xabfc('0x76')]['findOrCreate']({'where':{'UserId':_0x3ba574['id'],'ChatQueueId':_0xb202eb[_0xabfc('0x58')]['id']},'transaction':_0x40c0f6});});})[_0xabfc('0x20')](function(){_0x183efc[_0xabfc('0x77')](function(_0x317b24){socket[_0xabfc('0x78')](_0xabfc('0x79'),{'UserId':_0x317b24['id'],'ChatQueueId':_0x36aa6d['id']});});});});});}})[_0xabfc('0x20')](respondWithStatusCode(_0x4f8c9a,null))[_0xabfc('0x29')](handleError(_0x4f8c9a,null));};exports[_0xabfc('0x7a')]=function(_0x4c5ffc,_0x55de39,_0xe64c4e){return db[_0xabfc('0x70')]['findAll']({'where':{'id':_0x4c5ffc[_0xabfc('0x43')][_0xabfc('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x55de39,null))['then'](function(_0x483970){var _0x203b74=_[_0xabfc('0x3e')](_0x483970,'id');var _0x38ca69=[];var _0x572b09=[];var _0x5bf8ce=squel[_0xabfc('0x7b')]();_0x5bf8ce[_0xabfc('0x7c')](_0xabfc('0x7d'))['from'](_0xabfc('0x7e'),'tq')[_0xabfc('0x7f')](_0xabfc('0x80'),'ut',_0xabfc('0x81'))[_0xabfc('0x4c')]('ChatQueueId\x20=\x20?',_0x4c5ffc[_0xabfc('0x58')]['id']);for(var _0x44125f=0x0;_0x44125f<_0x483970[_0xabfc('0x48')];_0x44125f+=0x1){let _0x48495d=_0x483970[_0x44125f];for(var _0x52c1d8=0x0;_0x52c1d8<_0x48495d[_0xabfc('0x71')][_0xabfc('0x48')];_0x52c1d8+=0x1){let _0x3aebfb=_0x48495d[_0xabfc('0x71')][_0x52c1d8];var _0x2599b4=_0x5bf8ce['clone']();_0x2599b4[_0xabfc('0x4c')](_0xabfc('0x82'),_0x3aebfb['id']);_0x572b09[_0xabfc('0x83')](db[_0xabfc('0x84')][_0xabfc('0x43')](_0x2599b4[_0xabfc('0x85')](),{'type':db[_0xabfc('0x84')][_0xabfc('0x86')]['SELECT']})[_0xabfc('0x20')](function(_0xa1645e){if(_0xa1645e['length']===0x1){return _0x3aebfb['id'];}else{var _0x2e0bda=_[_0xabfc('0x87')](_[_0xabfc('0x3e')](_0xa1645e,_0xabfc('0x88')),function(_0x3bd82a){return _[_0xabfc('0x89')](_0x203b74,_0x3bd82a);});if(_0x2e0bda){return _0x3aebfb['id'];}}}));}}return BPromise[_0xabfc('0x8a')](_0x572b09)[_0xabfc('0x20')](function(_0x24508f){_0x38ca69=_(_0x38ca69)[_0xabfc('0x8b')](_0x24508f)[_0xabfc('0x8c')]()[_0xabfc('0x8d')]();return db[_0xabfc('0x52')]['find']({'where':{'id':_0x4c5ffc[_0xabfc('0x58')]['id']}})[_0xabfc('0x20')](function(_0x1a48c2){return db[_0xabfc('0x84')][_0xabfc('0x8e')](function(_0x5b0048){return _0x1a48c2[_0xabfc('0x7a')](_0x4c5ffc[_0xabfc('0x43')][_0xabfc('0x6f')],{'transaction':_0x5b0048})[_0xabfc('0x20')](function(){if(!_[_0xabfc('0x8f')](_0x38ca69)){return _0x1a48c2[_0xabfc('0x90')](_0x38ca69,{'transaction':_0x5b0048});}})[_0xabfc('0x20')](function(){_0x38ca69[_0xabfc('0x77')](function(_0x1c32d5){socket[_0xabfc('0x78')]('userChatQueue:remove',{'UserId':_0x1c32d5,'ChatQueueId':_0x1a48c2['id']});});});});});});})[_0xabfc('0x20')](respondWithStatusCode(_0x55de39,null))[_0xabfc('0x29')](handleError(_0x55de39,null));};exports[_0xabfc('0x91')]=function(_0x3ed3b0,_0x1e3716,_0x48eb5d){return db[_0xabfc('0x52')][_0xabfc('0x5a')]({'where':{'id':_0x3ed3b0[_0xabfc('0x58')]['id']}})[_0xabfc('0x20')](handleEntityNotFound(_0x1e3716,null))[_0xabfc('0x20')](function(_0xb4ccb6){if(_0xb4ccb6){return _0xb4ccb6[_0xabfc('0x91')](_0x3ed3b0[_0xabfc('0x5c')][_0xabfc('0x6f')],_[_0xabfc('0x92')](_0x3ed3b0[_0xabfc('0x5c')],[_0xabfc('0x6f'),'id'])||{})[_0xabfc('0x93')](function(_0x382efd){for(var _0x19ee8f=0x0;_0x19ee8f<_0x3ed3b0['body'][_0xabfc('0x6f')]['length'];_0x19ee8f+=0x1){socket['emit'](_0xabfc('0x79'),{'UserId':Number(_0x3ed3b0[_0xabfc('0x5c')]['ids'][_0x19ee8f]),'ChatQueueId':Number(_0x3ed3b0['params']['id'])});}return _0x382efd;});}})[_0xabfc('0x20')](respondWithResult(_0x1e3716,null))['catch'](handleError(_0x1e3716,null));};exports[_0xabfc('0x90')]=function(_0x4eb87e,_0x268918,_0x123011){return db[_0xabfc('0x52')][_0xabfc('0x5a')]({'where':{'id':_0x4eb87e[_0xabfc('0x58')]['id']}})['then'](handleEntityNotFound(_0x268918,null))[_0xabfc('0x20')](function(_0x1f8f81){if(_0x1f8f81){return _0x1f8f81['removeAgents'](_0x4eb87e[_0xabfc('0x43')][_0xabfc('0x6f')])[_0xabfc('0x20')](function(){if(_[_0xabfc('0x94')](_0x4eb87e['query'][_0xabfc('0x6f')])){for(var _0x24371f=0x0;_0x24371f<_0x4eb87e[_0xabfc('0x43')][_0xabfc('0x6f')][_0xabfc('0x48')];_0x24371f+=0x1){socket[_0xabfc('0x78')]('userChatQueue:remove',{'UserId':Number(_0x4eb87e[_0xabfc('0x43')][_0xabfc('0x6f')][_0x24371f]),'ChatQueueId':Number(_0x4eb87e[_0xabfc('0x58')]['id'])});}}else{socket['emit'](_0xabfc('0x95'),{'UserId':Number(_0x4eb87e[_0xabfc('0x43')][_0xabfc('0x6f')]),'ChatQueueId':Number(_0x4eb87e[_0xabfc('0x58')]['id'])});}});}})[_0xabfc('0x20')](respondWithStatusCode(_0x268918,null))[_0xabfc('0x29')](handleError(_0x268918,null));};exports[_0xabfc('0x96')]=function(_0x20b6fa,_0x2f6e05,_0x220a7d){var _0x5593f0={};var _0x1570b1={};var _0x35188b;var _0x41e93d;return db[_0xabfc('0x52')][_0xabfc('0x6d')]({'where':{'id':_0x20b6fa[_0xabfc('0x58')]['id']}})[_0xabfc('0x20')](handleEntityNotFound(_0x2f6e05,null))[_0xabfc('0x20')](function(_0x6d94e9){if(_0x6d94e9){_0x35188b=_0x6d94e9;_0x1570b1['model']=_[_0xabfc('0x59')](db[_0xabfc('0x67')][_0xabfc('0x3f')]);_0x1570b1[_0xabfc('0x43')]=_[_0xabfc('0x59')](_0x20b6fa[_0xabfc('0x43')]);_0x1570b1[_0xabfc('0x44')]=_[_0xabfc('0x46')](_0x1570b1[_0xabfc('0x42')],_0x1570b1['query']);_0x5593f0[_0xabfc('0x45')]=_[_0xabfc('0x46')](_0x1570b1[_0xabfc('0x42')],qs[_0xabfc('0x47')](_0x20b6fa[_0xabfc('0x43')][_0xabfc('0x47')]));_0x5593f0[_0xabfc('0x45')]=_0x5593f0['attributes'][_0xabfc('0x48')]?_0x5593f0['attributes']:_0x1570b1[_0xabfc('0x42')];_0x5593f0[_0xabfc('0x4a')]=qs['sort'](_0x20b6fa[_0xabfc('0x43')]['sort']);_0x5593f0[_0xabfc('0x4c')]=qs[_0xabfc('0x44')](_[_0xabfc('0x4d')](_0x20b6fa[_0xabfc('0x43')],_0x1570b1[_0xabfc('0x44')]));if(_0x20b6fa[_0xabfc('0x43')]['filter']){_0x5593f0[_0xabfc('0x4c')]=_[_0xabfc('0x4f')](_0x5593f0[_0xabfc('0x4c')],{'$or':_['map'](_0x5593f0[_0xabfc('0x45')],function(_0x4dd4f9){var _0x253d22={};_0x253d22[_0x4dd4f9]={'$like':'%'+_0x20b6fa['query'][_0xabfc('0x4e')]+'%'};return _0x253d22;})});}_0x5593f0=_['merge']({},_0x5593f0,_0x20b6fa[_0xabfc('0x51')]);return _0x35188b[_0xabfc('0x96')](_0x5593f0);}})[_0xabfc('0x20')](function(_0x5cfe96){if(_0x5cfe96){_0x41e93d=_0x5cfe96[_0xabfc('0x48')];if(!_0x20b6fa[_0xabfc('0x43')][_0xabfc('0x65')](_0xabfc('0x49'))){_0x5593f0['limit']=qs['limit'](_0x20b6fa['query'][_0xabfc('0x2e')]);_0x5593f0[_0xabfc('0x30')]=qs[_0xabfc('0x30')](_0x20b6fa[_0xabfc('0x43')]['offset']);}return _0x35188b[_0xabfc('0x96')](_0x5593f0);}})[_0xabfc('0x20')](function(_0x1c14ac){if(_0x1c14ac){return _0x1c14ac?{'count':_0x41e93d,'rows':_0x1c14ac}:null;}})['then'](respondWithResult(_0x2f6e05,null))[_0xabfc('0x29')](handleError(_0x2f6e05,null));}; \ No newline at end of file +var _0x2d94=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','http','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','ChatQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','ChatQueue','includeAll','findAll','rows','show','include','merge','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','params','describe','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','Team','options','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','field'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x2d94,0x1dc));var _0x42d9=function(_0x5e8128,_0x42866f){_0x5e8128=_0x5e8128-0x0;var _0x3cc61b=_0x2d94[_0x5e8128];return _0x3cc61b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42d9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x42d9('0x1'));var rp=require(_0x42d9('0x2'));var moment=require(_0x42d9('0x3'));var BPromise=require(_0x42d9('0x4'));var Mustache=require(_0x42d9('0x5'));var util=require(_0x42d9('0x6'));var path=require(_0x42d9('0x7'));var sox=require(_0x42d9('0x8'));var csv=require(_0x42d9('0x9'));var ejs=require(_0x42d9('0xa'));var fs=require('fs');var fs_extra=require(_0x42d9('0xb'));var _=require(_0x42d9('0xc'));var squel=require(_0x42d9('0xd'));var crypto=require(_0x42d9('0xe'));var jsforce=require(_0x42d9('0xf'));var deskjs=require(_0x42d9('0x10'));var toCsv=require(_0x42d9('0x9'));var querystring=require(_0x42d9('0x11'));var Papa=require(_0x42d9('0x12'));var Redis=require(_0x42d9('0x13'));var authService=require(_0x42d9('0x14'));var qs=require(_0x42d9('0x15'));var as=require(_0x42d9('0x16'));var hardwareService=require(_0x42d9('0x17'));var logger=require(_0x42d9('0x18'))('api');var utils=require(_0x42d9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x42d9('0x1a'));var db=require(_0x42d9('0x1b'))['db'];config[_0x42d9('0x1c')]=_['defaults'](config['redis'],{'host':_0x42d9('0x1d'),'port':0x18eb});var socket=require(_0x42d9('0x1e'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x42d9('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x42d9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5499f9,_0x580fcd,_0x4c2aea,_0x4ac978){return new BPromise(function(_0xdf677b,_0xb00e31){var _0x1c8ac8=_0x4ac978||client;return _0x1c8ac8['request'](_0x5499f9,_0x4c2aea)['then'](function(_0x34ae33){logger[_0x42d9('0x21')](_0x42d9('0x22'),_0x580fcd,_0x42d9('0x23'));logger['debug'](_0x42d9('0x24'),_0x580fcd,_0x42d9('0x23'),JSON[_0x42d9('0x25')](_0x34ae33));if(_0x34ae33[_0x42d9('0x26')]){if(_0x34ae33['error'][_0x42d9('0x27')]===0x1f4){logger[_0x42d9('0x26')]('ChatQueue,\x20%s,\x20%s',_0x580fcd,_0x34ae33['error']['message']);return _0xb00e31(_0x34ae33['error']['message']);}logger[_0x42d9('0x26')](_0x42d9('0x22'),_0x580fcd,_0x34ae33[_0x42d9('0x26')][_0x42d9('0x28')]);return _0xdf677b(_0x34ae33[_0x42d9('0x26')][_0x42d9('0x28')]);}else{logger[_0x42d9('0x21')]('ChatQueue,\x20%s,\x20%s',_0x580fcd,_0x42d9('0x23'));_0xdf677b(_0x34ae33['result'][_0x42d9('0x28')]);}})[_0x42d9('0x29')](function(_0x1c1faf){logger['error'](_0x42d9('0x22'),_0x580fcd,_0x1c1faf);_0xb00e31(_0x1c1faf);});});}function respondWithStatusCode(_0x3f23d6,_0x1144d2){_0x1144d2=_0x1144d2||0xcc;return function(_0x23616){if(_0x23616){return _0x3f23d6[_0x42d9('0x2a')](_0x1144d2);}return _0x3f23d6[_0x42d9('0x2b')](_0x1144d2)[_0x42d9('0x2c')]();};}function respondWithResult(_0x4f27ce,_0x3e512f){_0x3e512f=_0x3e512f||0xc8;return function(_0x7873aa){if(_0x7873aa){return _0x4f27ce[_0x42d9('0x2b')](_0x3e512f)['json'](_0x7873aa);}};}function respondWithFilteredResult(_0x321c31,_0x14b866){return function(_0x314779){if(_0x314779){var _0x4890ce=typeof _0x14b866[_0x42d9('0x2d')]==='undefined'&&typeof _0x14b866[_0x42d9('0x2e')]===_0x42d9('0x2f');var _0x3f98f5=_0x314779['count'];var _0x4bc00c=_0x4890ce?0x0:_0x14b866['offset'];var _0x5134e9=_0x4890ce?_0x314779[_0x42d9('0x30')]:_0x14b866['offset']+_0x14b866['limit'];var _0x2dbf04;if(_0x5134e9>=_0x3f98f5){_0x5134e9=_0x3f98f5;_0x2dbf04=0xc8;}else{_0x2dbf04=0xce;}_0x321c31[_0x42d9('0x2b')](_0x2dbf04);return _0x321c31[_0x42d9('0x31')](_0x42d9('0x32'),_0x4bc00c+'-'+_0x5134e9+'/'+_0x3f98f5)[_0x42d9('0x33')](_0x314779);}return null;};}function patchUpdates(_0x729646){return function(_0x5cecb8){try{jsonpatch[_0x42d9('0x34')](_0x5cecb8,_0x729646,!![]);}catch(_0x5b52ed){return BPromise[_0x42d9('0x35')](_0x5b52ed);}return _0x5cecb8[_0x42d9('0x36')]();};}function saveUpdates(_0x197eb3,_0x231687){return function(_0xe2dcd9){if(_0xe2dcd9){return _0xe2dcd9['update'](_0x197eb3)[_0x42d9('0x37')](function(_0x1ec705){return _0x1ec705;});}return null;};}function removeEntity(_0x5c3699,_0x4a243b){return function(_0x550c5b){if(_0x550c5b){return _0x550c5b[_0x42d9('0x38')]()['then'](function(){var _0x2a9e76=_0x550c5b['get']({'plain':!![]});var _0xf81421=_0x42d9('0x39');return db[_0x42d9('0x3a')]['destroy']({'where':{'type':_0xf81421,'resourceId':_0x2a9e76['id']}})[_0x42d9('0x37')](function(){return _0x550c5b;});})[_0x42d9('0x37')](function(){_0x5c3699['status'](0xcc)[_0x42d9('0x2c')]();});}};}function handleEntityNotFound(_0x4e2f07,_0x18ec7d){return function(_0x32338d){if(!_0x32338d){_0x4e2f07[_0x42d9('0x2a')](0x194);}return _0x32338d;};}function handleError(_0x38404c,_0x52bc10){_0x52bc10=_0x52bc10||0x1f4;return function(_0x396222){logger['error'](_0x396222[_0x42d9('0x3b')]);if(_0x396222['name']){delete _0x396222[_0x42d9('0x3c')];}_0x38404c['status'](_0x52bc10)[_0x42d9('0x3d')](_0x396222);};}exports[_0x42d9('0x3e')]=function(_0x26dbb9,_0x517754){var _0x473435={},_0x5528df={},_0x482d39={'count':0x0,'rows':[]};var _0xe00356=_[_0x42d9('0x3f')](db['ChatQueue'][_0x42d9('0x40')],function(_0x1b96df){return{'name':_0x1b96df[_0x42d9('0x41')],'type':_0x1b96df[_0x42d9('0x42')]['key']};});_0x5528df[_0x42d9('0x43')]=_[_0x42d9('0x3f')](_0xe00356,_0x42d9('0x3c'));_0x5528df[_0x42d9('0x44')]=_[_0x42d9('0x45')](_0x26dbb9[_0x42d9('0x44')]);_0x5528df[_0x42d9('0x46')]=_[_0x42d9('0x47')](_0x5528df[_0x42d9('0x43')],_0x5528df[_0x42d9('0x44')]);_0x473435[_0x42d9('0x48')]=_[_0x42d9('0x47')](_0x5528df[_0x42d9('0x43')],qs[_0x42d9('0x49')](_0x26dbb9[_0x42d9('0x44')][_0x42d9('0x49')]));_0x473435[_0x42d9('0x48')]=_0x473435[_0x42d9('0x48')][_0x42d9('0x4a')]?_0x473435['attributes']:_0x5528df[_0x42d9('0x43')];if(!_0x26dbb9['query'][_0x42d9('0x4b')](_0x42d9('0x4c'))){_0x473435[_0x42d9('0x2e')]=qs[_0x42d9('0x2e')](_0x26dbb9[_0x42d9('0x44')]['limit']);_0x473435['offset']=qs[_0x42d9('0x2d')](_0x26dbb9[_0x42d9('0x44')][_0x42d9('0x2d')]);}_0x473435[_0x42d9('0x4d')]=qs[_0x42d9('0x4e')](_0x26dbb9[_0x42d9('0x44')][_0x42d9('0x4e')]);_0x473435['where']=qs['filters'](_['pick'](_0x26dbb9[_0x42d9('0x44')],_0x5528df['filters']),_0xe00356);if(_0x26dbb9[_0x42d9('0x44')]['filter']){_0x473435[_0x42d9('0x4f')]=_['merge'](_0x473435[_0x42d9('0x4f')],{'$or':_[_0x42d9('0x3f')](_0xe00356,function(_0x297c2a){if(_0x297c2a[_0x42d9('0x42')]!==_0x42d9('0x50')){var _0x26f495={};_0x26f495[_0x297c2a['name']]={'$like':'%'+_0x26dbb9[_0x42d9('0x44')][_0x42d9('0x51')]+'%'};return _0x26f495;}})});}_0x473435=_['merge']({},_0x473435,_0x26dbb9['options']);var _0x47f145={'where':_0x473435[_0x42d9('0x4f')]};return db[_0x42d9('0x52')]['count'](_0x47f145)[_0x42d9('0x37')](function(_0x906b38){_0x482d39[_0x42d9('0x30')]=_0x906b38;if(_0x26dbb9[_0x42d9('0x44')][_0x42d9('0x53')]){_0x473435['include']=[{'all':!![]}];}return db['ChatQueue'][_0x42d9('0x54')](_0x473435);})[_0x42d9('0x37')](function(_0x2d1281){_0x482d39[_0x42d9('0x55')]=_0x2d1281;return _0x482d39;})[_0x42d9('0x37')](respondWithFilteredResult(_0x517754,_0x473435))['catch'](handleError(_0x517754,null));};exports[_0x42d9('0x56')]=function(_0x57f005,_0x4d46ef){var _0x1a204f={'raw':!![],'where':{'id':_0x57f005['params']['id']}},_0x7be063={};_0x7be063[_0x42d9('0x43')]=_['keys'](db['ChatQueue'][_0x42d9('0x40')]);_0x7be063[_0x42d9('0x44')]=_[_0x42d9('0x45')](_0x57f005[_0x42d9('0x44')]);_0x7be063['filters']=_[_0x42d9('0x47')](_0x7be063['model'],_0x7be063[_0x42d9('0x44')]);_0x1a204f[_0x42d9('0x48')]=_[_0x42d9('0x47')](_0x7be063[_0x42d9('0x43')],qs[_0x42d9('0x49')](_0x57f005[_0x42d9('0x44')][_0x42d9('0x49')]));_0x1a204f[_0x42d9('0x48')]=_0x1a204f[_0x42d9('0x48')][_0x42d9('0x4a')]?_0x1a204f[_0x42d9('0x48')]:_0x7be063[_0x42d9('0x43')];if(_0x57f005[_0x42d9('0x44')]['includeAll']){_0x1a204f[_0x42d9('0x57')]=[{'all':!![]}];}_0x1a204f=_[_0x42d9('0x58')]({},_0x1a204f,_0x57f005['options']);return db[_0x42d9('0x52')]['find'](_0x1a204f)[_0x42d9('0x37')](handleEntityNotFound(_0x4d46ef,null))[_0x42d9('0x37')](respondWithResult(_0x4d46ef,null))[_0x42d9('0x29')](handleError(_0x4d46ef,null));};exports['create']=function(_0x4ce56a,_0x9801e3){return db[_0x42d9('0x52')][_0x42d9('0x59')](_0x4ce56a[_0x42d9('0x5a')],{})[_0x42d9('0x37')](function(_0x2a9b3d){var _0x4359b8=_0x4ce56a[_0x42d9('0x5b')][_0x42d9('0x5c')]({'plain':!![]});if(!_0x4359b8)throw new Error(_0x42d9('0x5d'));if(_0x4359b8[_0x42d9('0x5e')]==='user'){var _0x14013d=_0x2a9b3d['get']({'plain':!![]});var _0x170b61='ChatQueues';return db['UserProfileSection'][_0x42d9('0x5f')]({'where':{'name':_0x170b61,'userProfileId':_0x4359b8['userProfileId']},'raw':!![]})['then'](function(_0x4a8131){if(_0x4a8131&&_0x4a8131[_0x42d9('0x60')]===0x0){return db[_0x42d9('0x3a')][_0x42d9('0x59')]({'name':_0x14013d['name'],'resourceId':_0x14013d['id'],'type':_0x4a8131[_0x42d9('0x3c')],'sectionId':_0x4a8131['id']},{})[_0x42d9('0x37')](function(){return _0x2a9b3d;});}else{return _0x2a9b3d;}})[_0x42d9('0x29')](function(_0xd092ce){logger[_0x42d9('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd092ce);throw _0xd092ce;});}return _0x2a9b3d;})['then'](respondWithResult(_0x9801e3,0xc9))[_0x42d9('0x29')](handleError(_0x9801e3,null));};exports['update']=function(_0xa32ff7,_0xc822a9){if(_0xa32ff7[_0x42d9('0x5a')]['id']){delete _0xa32ff7[_0x42d9('0x5a')]['id'];}return db[_0x42d9('0x52')][_0x42d9('0x5f')]({'where':{'id':_0xa32ff7[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0xc822a9,null))[_0x42d9('0x37')](saveUpdates(_0xa32ff7[_0x42d9('0x5a')],null))['then'](respondWithResult(_0xc822a9,null))['catch'](handleError(_0xc822a9,null));};exports[_0x42d9('0x38')]=function(_0x8470ab,_0x2f2099){return db[_0x42d9('0x52')][_0x42d9('0x5f')]({'where':{'id':_0x8470ab[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0x2f2099,null))['then'](removeEntity(_0x2f2099,null))[_0x42d9('0x29')](handleError(_0x2f2099,null));};exports[_0x42d9('0x62')]=function(_0x599277,_0x561972){return db[_0x42d9('0x52')]['describe']()[_0x42d9('0x37')](respondWithResult(_0x561972,null))[_0x42d9('0x29')](handleError(_0x561972,null));};exports['getMembers']=function(_0x4c8d73,_0x54357f,_0x412340){var _0x4c3095={'raw':!![],'where':{}},_0x5f4290={},_0x41620e;return db[_0x42d9('0x52')]['findOne']({'where':{'id':_0x4c8d73[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0x54357f,null))[_0x42d9('0x37')](function(_0x404a0d){if(_0x404a0d){_0x41620e=_0x404a0d[_0x42d9('0x5c')]({'plain':!![]});_0x5f4290[_0x42d9('0x43')]=_[_0x42d9('0x45')](db[_0x42d9('0x63')][_0x42d9('0x40')]);_0x5f4290[_0x42d9('0x44')]=_[_0x42d9('0x45')](_0x4c8d73['query']);_0x5f4290[_0x42d9('0x46')]=_['intersection'](_0x5f4290[_0x42d9('0x43')],_0x5f4290[_0x42d9('0x44')]);_0x4c3095[_0x42d9('0x48')]=_['intersection'](_0x5f4290[_0x42d9('0x43')],qs['fields'](_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x49')]));_0x4c3095[_0x42d9('0x48')]=_0x4c3095[_0x42d9('0x48')][_0x42d9('0x4a')]?_0x4c3095[_0x42d9('0x48')]:_0x5f4290['model'];if(!_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x4b')](_0x42d9('0x4c'))){_0x4c3095[_0x42d9('0x2e')]=qs['limit'](_0x4c8d73['query'][_0x42d9('0x2e')]);_0x4c3095[_0x42d9('0x2d')]=qs['offset'](_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x2d')]);}_0x4c3095[_0x42d9('0x4d')]=qs[_0x42d9('0x4e')](_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x4e')]);_0x4c3095[_0x42d9('0x4f')]=qs[_0x42d9('0x46')](_[_0x42d9('0x64')](_0x4c8d73[_0x42d9('0x44')],_0x5f4290[_0x42d9('0x46')]));_0x4c3095['where'][_0x42d9('0x65')]=_0x404a0d['id'];if(_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x51')]){_0x4c3095['where']=_[_0x42d9('0x58')](_0x4c3095['where'],{'$or':_[_0x42d9('0x3f')](_0x4c3095[_0x42d9('0x48')],function(_0x333fbf){var _0x3b3aa3={};_0x3b3aa3[_0x333fbf]={'$like':'%'+_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x51')]+'%'};return _0x3b3aa3;})});}_0x4c3095=_['merge']({},_0x4c3095,_0x4c8d73['options']);return db[_0x42d9('0x63')]['findAll'](_0x4c3095);}})[_0x42d9('0x37')](function(_0x57b2f3){if(_0x57b2f3){return db[_0x42d9('0x66')][_0x42d9('0x67')]({'where':{'id':_['map'](_0x57b2f3,'UserId'),'role':_0x42d9('0x68')},'attributes':['id','name','chatPause',_0x42d9('0x69'),_0x42d9('0x6a')]});}})['then'](function(_0x12c769){if(_0x12c769){return{'count':_0x12c769[_0x42d9('0x30')],'rows':_['map'](_0x12c769['rows'],function(_0x423cbb){return{'membername':_0x423cbb['name'],'UserId':_0x423cbb['id'],'queue_name':_0x41620e[_0x42d9('0x3c')],'ChatQueueId':_0x41620e['id'],'interface':util[_0x42d9('0x6b')](_0x42d9('0x6c'),_0x42d9('0x6d'),_0x423cbb['name']),'penalty':0x0,'paused':_0x423cbb[_0x42d9('0x6e')],'createdAt':_0x423cbb[_0x42d9('0x6a')],'updatedAt':_0x423cbb[_0x42d9('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x42d9('0x37')](respondWithFilteredResult(_0x54357f,_0x4c3095))[_0x42d9('0x29')](handleError(_0x54357f,null));};exports[_0x42d9('0x6f')]=function(_0x466776,_0x58132a,_0x30acce){var _0x18abca={};var _0x2f5bfc={};var _0x26caa3;var _0x3e7658;return db[_0x42d9('0x52')]['findOne']({'where':{'id':_0x466776[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0x58132a,null))['then'](function(_0x18dbbc){if(_0x18dbbc){_0x26caa3=_0x18dbbc;_0x2f5bfc[_0x42d9('0x43')]=_['keys'](db[_0x42d9('0x70')][_0x42d9('0x40')]);_0x2f5bfc['query']=_[_0x42d9('0x45')](_0x466776['query']);_0x2f5bfc['filters']=_[_0x42d9('0x47')](_0x2f5bfc['model'],_0x2f5bfc[_0x42d9('0x44')]);_0x18abca[_0x42d9('0x48')]=_[_0x42d9('0x47')](_0x2f5bfc['model'],qs['fields'](_0x466776[_0x42d9('0x44')][_0x42d9('0x49')]));_0x18abca[_0x42d9('0x48')]=_0x18abca[_0x42d9('0x48')][_0x42d9('0x4a')]?_0x18abca[_0x42d9('0x48')]:_0x2f5bfc['model'];_0x18abca[_0x42d9('0x4d')]=qs[_0x42d9('0x4e')](_0x466776['query'][_0x42d9('0x4e')]);_0x18abca[_0x42d9('0x4f')]=qs[_0x42d9('0x46')](_[_0x42d9('0x64')](_0x466776[_0x42d9('0x44')],_0x2f5bfc[_0x42d9('0x46')]));if(_0x466776[_0x42d9('0x44')][_0x42d9('0x51')]){_0x18abca['where']=_[_0x42d9('0x58')](_0x18abca[_0x42d9('0x4f')],{'$or':_[_0x42d9('0x3f')](_0x18abca[_0x42d9('0x48')],function(_0x27a99f){var _0x5c5801={};_0x5c5801[_0x27a99f]={'$like':'%'+_0x466776['query'][_0x42d9('0x51')]+'%'};return _0x5c5801;})});}_0x18abca=_[_0x42d9('0x58')]({},_0x18abca,_0x466776[_0x42d9('0x71')]);return _0x26caa3[_0x42d9('0x6f')](_0x18abca);}})['then'](function(_0x523069){if(_0x523069){_0x3e7658=_0x523069[_0x42d9('0x4a')];if(!_0x466776[_0x42d9('0x44')][_0x42d9('0x4b')](_0x42d9('0x4c'))){_0x18abca[_0x42d9('0x2e')]=qs[_0x42d9('0x2e')](_0x466776[_0x42d9('0x44')][_0x42d9('0x2e')]);_0x18abca[_0x42d9('0x2d')]=qs[_0x42d9('0x2d')](_0x466776[_0x42d9('0x44')][_0x42d9('0x2d')]);}return _0x26caa3[_0x42d9('0x6f')](_0x18abca);}})[_0x42d9('0x37')](function(_0x59747d){if(_0x59747d){return _0x59747d?{'count':_0x3e7658,'rows':_0x59747d}:null;}})[_0x42d9('0x37')](respondWithResult(_0x58132a,null))[_0x42d9('0x29')](handleError(_0x58132a,null));};exports[_0x42d9('0x72')]=function(_0x49c4b3,_0x4b3be2,_0x500495){var _0x3bcf35=_0x49c4b3[_0x42d9('0x5a')][_0x42d9('0x73')];return db[_0x42d9('0x70')][_0x42d9('0x54')]({'where':{'id':_0x3bcf35},'attributes':['id'],'include':[{'model':db['User'],'as':_0x42d9('0x74'),'attributes':['id',_0x42d9('0x3c'),_0x42d9('0x75'),_0x42d9('0x76'),_0x42d9('0x77')],'raw':!![]}]})['then'](function(_0x37e43d){if(_0x37e43d){var _0x30a031=_[_0x42d9('0x78')](_0x37e43d,function(_0x2b9b55){var _0x295f74=_0x2b9b55[_0x42d9('0x5c')]({'plain':!![]});return _0x295f74[_0x42d9('0x74')];});return db[_0x42d9('0x52')][_0x42d9('0x5f')]({'where':{'id':_0x49c4b3[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](function(_0x43aa3c){return db[_0x42d9('0x79')][_0x42d9('0x7a')](function(_0x2fe197){return _0x43aa3c[_0x42d9('0x72')](_0x3bcf35,{'transaction':_0x2fe197})[_0x42d9('0x37')](function(){return BPromise['each'](_0x30a031,function(_0x21e82e){return db[_0x42d9('0x63')][_0x42d9('0x7b')]({'where':{'UserId':_0x21e82e['id'],'ChatQueueId':_0x49c4b3[_0x42d9('0x61')]['id']},'transaction':_0x2fe197});});})['then'](function(){_0x30a031[_0x42d9('0x7c')](function(_0x4078b7){socket[_0x42d9('0x7d')](_0x42d9('0x7e'),{'UserId':_0x4078b7['id'],'ChatQueueId':_0x43aa3c['id']});});});});});}})[_0x42d9('0x37')](respondWithStatusCode(_0x4b3be2,null))[_0x42d9('0x29')](handleError(_0x4b3be2,null));};exports['removeTeams']=function(_0x45f2d9,_0x50cdbc,_0x427ec8){return db[_0x42d9('0x70')][_0x42d9('0x54')]({'where':{'id':_0x45f2d9[_0x42d9('0x44')][_0x42d9('0x73')]},'attributes':['id'],'include':[{'model':db[_0x42d9('0x66')],'as':_0x42d9('0x74'),'attributes':['id'],'raw':!![]}]})[_0x42d9('0x37')](handleEntityNotFound(_0x50cdbc,null))[_0x42d9('0x37')](function(_0x397bc3){var _0x4f13fe=_['map'](_0x397bc3,'id');var _0x20d1a7=[];var _0x3e9c34=[];var _0x43149f=squel['select']();_0x43149f[_0x42d9('0x7f')]('tq.TeamId')['from']('team_has_chat_queues','tq')['join'](_0x42d9('0x80'),'ut',_0x42d9('0x81'))['where'](_0x42d9('0x82'),_0x45f2d9[_0x42d9('0x61')]['id']);for(var _0x4cb4d5=0x0;_0x4cb4d5<_0x397bc3[_0x42d9('0x4a')];_0x4cb4d5+=0x1){let _0x4a7eee=_0x397bc3[_0x4cb4d5];for(var _0x38fc0c=0x0;_0x38fc0c<_0x4a7eee[_0x42d9('0x74')][_0x42d9('0x4a')];_0x38fc0c+=0x1){let _0x17e6de=_0x4a7eee[_0x42d9('0x74')][_0x38fc0c];var _0x45c11a=_0x43149f['clone']();_0x45c11a[_0x42d9('0x4f')](_0x42d9('0x83'),_0x17e6de['id']);_0x3e9c34[_0x42d9('0x84')](db[_0x42d9('0x79')]['query'](_0x45c11a[_0x42d9('0x85')](),{'type':db['sequelize'][_0x42d9('0x86')][_0x42d9('0x87')]})[_0x42d9('0x37')](function(_0x2e18df){if(_0x2e18df[_0x42d9('0x4a')]===0x1){return _0x17e6de['id'];}else{var _0x67602f=_[_0x42d9('0x88')](_[_0x42d9('0x3f')](_0x2e18df,_0x42d9('0x89')),function(_0x3f32e9){return _[_0x42d9('0x8a')](_0x4f13fe,_0x3f32e9);});if(_0x67602f){return _0x17e6de['id'];}}}));}}return BPromise[_0x42d9('0x8b')](_0x3e9c34)[_0x42d9('0x37')](function(_0x5c5c16){_0x20d1a7=_(_0x20d1a7)[_0x42d9('0x8c')](_0x5c5c16)[_0x42d9('0x8d')]()[_0x42d9('0x8e')]();return db[_0x42d9('0x52')]['find']({'where':{'id':_0x45f2d9['params']['id']}})['then'](function(_0x3e6566){return db[_0x42d9('0x79')][_0x42d9('0x7a')](function(_0x384071){return _0x3e6566['removeTeams'](_0x45f2d9[_0x42d9('0x44')][_0x42d9('0x73')],{'transaction':_0x384071})[_0x42d9('0x37')](function(){if(!_['isEmpty'](_0x20d1a7)){return _0x3e6566['removeAgents'](_0x20d1a7,{'transaction':_0x384071});}})[_0x42d9('0x37')](function(){_0x20d1a7['forEach'](function(_0x5bedf2){socket[_0x42d9('0x7d')](_0x42d9('0x8f'),{'UserId':_0x5bedf2,'ChatQueueId':_0x3e6566['id']});});});});});});})[_0x42d9('0x37')](respondWithStatusCode(_0x50cdbc,null))['catch'](handleError(_0x50cdbc,null));};exports[_0x42d9('0x90')]=function(_0x30ab98,_0x27c215,_0x254e65){return db['ChatQueue']['find']({'where':{'id':_0x30ab98[_0x42d9('0x61')]['id']}})['then'](handleEntityNotFound(_0x27c215,null))[_0x42d9('0x37')](function(_0x3fc716){if(_0x3fc716){return _0x3fc716[_0x42d9('0x90')](_0x30ab98[_0x42d9('0x5a')][_0x42d9('0x73')],_[_0x42d9('0x91')](_0x30ab98[_0x42d9('0x5a')],['ids','id'])||{})[_0x42d9('0x92')](function(_0x969b19){for(var _0x3b9250=0x0;_0x3b9250<_0x30ab98[_0x42d9('0x5a')][_0x42d9('0x73')]['length'];_0x3b9250+=0x1){socket['emit'](_0x42d9('0x7e'),{'UserId':Number(_0x30ab98[_0x42d9('0x5a')][_0x42d9('0x73')][_0x3b9250]),'ChatQueueId':Number(_0x30ab98['params']['id'])});}return _0x969b19;});}})[_0x42d9('0x37')](respondWithResult(_0x27c215,null))[_0x42d9('0x29')](handleError(_0x27c215,null));};exports[_0x42d9('0x93')]=function(_0x4f5353,_0x7de850,_0x1e8b0e){return db[_0x42d9('0x52')][_0x42d9('0x5f')]({'where':{'id':_0x4f5353[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0x7de850,null))[_0x42d9('0x37')](function(_0x14c0bf){if(_0x14c0bf){return _0x14c0bf['removeAgents'](_0x4f5353[_0x42d9('0x44')][_0x42d9('0x73')])[_0x42d9('0x37')](function(){if(_[_0x42d9('0x94')](_0x4f5353[_0x42d9('0x44')][_0x42d9('0x73')])){for(var _0x3f4f73=0x0;_0x3f4f73<_0x4f5353[_0x42d9('0x44')]['ids'][_0x42d9('0x4a')];_0x3f4f73+=0x1){socket[_0x42d9('0x7d')](_0x42d9('0x8f'),{'UserId':Number(_0x4f5353['query']['ids'][_0x3f4f73]),'ChatQueueId':Number(_0x4f5353[_0x42d9('0x61')]['id'])});}}else{socket[_0x42d9('0x7d')](_0x42d9('0x8f'),{'UserId':Number(_0x4f5353['query'][_0x42d9('0x73')]),'ChatQueueId':Number(_0x4f5353[_0x42d9('0x61')]['id'])});}});}})[_0x42d9('0x37')](respondWithStatusCode(_0x7de850,null))[_0x42d9('0x29')](handleError(_0x7de850,null));};exports[_0x42d9('0x95')]=function(_0x23d221,_0x24d7a7,_0x41c139){var _0x249e96={};var _0x48fce7={};var _0x4125d1;var _0x349860;return db[_0x42d9('0x52')][_0x42d9('0x96')]({'where':{'id':_0x23d221[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0x24d7a7,null))[_0x42d9('0x37')](function(_0x47fdfe){if(_0x47fdfe){_0x4125d1=_0x47fdfe;_0x48fce7[_0x42d9('0x43')]=_[_0x42d9('0x45')](db['User'][_0x42d9('0x40')]);_0x48fce7[_0x42d9('0x44')]=_['keys'](_0x23d221[_0x42d9('0x44')]);_0x48fce7[_0x42d9('0x46')]=_[_0x42d9('0x47')](_0x48fce7[_0x42d9('0x43')],_0x48fce7[_0x42d9('0x44')]);_0x249e96[_0x42d9('0x48')]=_['intersection'](_0x48fce7[_0x42d9('0x43')],qs['fields'](_0x23d221[_0x42d9('0x44')]['fields']));_0x249e96[_0x42d9('0x48')]=_0x249e96[_0x42d9('0x48')][_0x42d9('0x4a')]?_0x249e96[_0x42d9('0x48')]:_0x48fce7[_0x42d9('0x43')];_0x249e96[_0x42d9('0x4d')]=qs[_0x42d9('0x4e')](_0x23d221[_0x42d9('0x44')][_0x42d9('0x4e')]);_0x249e96['where']=qs['filters'](_[_0x42d9('0x64')](_0x23d221['query'],_0x48fce7['filters']));if(_0x23d221[_0x42d9('0x44')][_0x42d9('0x51')]){_0x249e96[_0x42d9('0x4f')]=_[_0x42d9('0x58')](_0x249e96[_0x42d9('0x4f')],{'$or':_[_0x42d9('0x3f')](_0x249e96['attributes'],function(_0x49197b){var _0x1010ae={};_0x1010ae[_0x49197b]={'$like':'%'+_0x23d221['query'][_0x42d9('0x51')]+'%'};return _0x1010ae;})});}_0x249e96=_[_0x42d9('0x58')]({},_0x249e96,_0x23d221['options']);return _0x4125d1['getAgents'](_0x249e96);}})[_0x42d9('0x37')](function(_0x3dc7ad){if(_0x3dc7ad){_0x349860=_0x3dc7ad[_0x42d9('0x4a')];if(!_0x23d221[_0x42d9('0x44')][_0x42d9('0x4b')]('nolimit')){_0x249e96[_0x42d9('0x2e')]=qs[_0x42d9('0x2e')](_0x23d221[_0x42d9('0x44')][_0x42d9('0x2e')]);_0x249e96[_0x42d9('0x2d')]=qs[_0x42d9('0x2d')](_0x23d221['query']['offset']);}return _0x4125d1[_0x42d9('0x95')](_0x249e96);}})['then'](function(_0x59a888){if(_0x59a888){return _0x59a888?{'count':_0x349860,'rows':_0x59a888}:null;}})[_0x42d9('0x37')](respondWithResult(_0x24d7a7,null))[_0x42d9('0x29')](handleError(_0x24d7a7,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 8d7eae1..f851329 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc200=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x4ae5bd,_0x340e5a){var _0x3cd511=function(_0x21aac1){while(--_0x21aac1){_0x4ae5bd['push'](_0x4ae5bd['shift']());}};_0x3cd511(++_0x340e5a);}(_0xc200,0x19e));var _0x0c20=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc200[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x0c20('0x0'));var ChatQueue=require(_0x0c20('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0c20('0x2')](0x0);var events={'afterCreate':_0x0c20('0x3'),'afterUpdate':_0x0c20('0x4'),'afterDestroy':_0x0c20('0x5')};function emitEvent(_0x3dcf87){return function(_0x38663a,_0x2af787,_0x4a2aba){ChatQueueEvents[_0x0c20('0x6')](_0x3dcf87+':'+_0x38663a['id'],_0x38663a);ChatQueueEvents['emit'](_0x3dcf87,_0x38663a);_0x4a2aba(null);};}for(var e in events){if(events[_0x0c20('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x0c20('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x63c5=['save','update','emit','hasOwnProperty','hook','ChatQueue','setMaxListeners'];(function(_0x190e15,_0x3ae444){var _0x4edc9d=function(_0x13a932){while(--_0x13a932){_0x190e15['push'](_0x190e15['shift']());}};_0x4edc9d(++_0x3ae444);}(_0x63c5,0xde));var _0x563c=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x63c5[_0x19ac6e];return _0x1cdcf3;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x563c('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x563c('0x1')](0x0);var events={'afterCreate':_0x563c('0x2'),'afterUpdate':_0x563c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4a1c0a){return function(_0x31a098,_0x3e4756,_0x5a029f){ChatQueueEvents[_0x563c('0x4')](_0x4a1c0a+':'+_0x31a098['id'],_0x31a098);ChatQueueEvents[_0x563c('0x4')](_0x4a1c0a,_0x31a098);_0x5a029f(null);};}for(var e in events){if(events[_0x563c('0x5')](e)){var event=events[e];ChatQueue[_0x563c('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 3fd03c1..d2d52f9 100644 --- a/server/api/chatQueue/chatQueue.model.js +++ b/server/api/chatQueue/chatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5dcb=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x4e8ff5,_0x57e044){var _0x4339c0=function(_0x1b3251){while(--_0x1b3251){_0x4e8ff5['push'](_0x4e8ff5['shift']());}};_0x4339c0(++_0x57e044);}(_0x5dcb,0x9c));var _0xb5dc=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x5dcb[_0x3c487b];return _0x1d65f6;};'use strict';var _=require(_0xb5dc('0x0'));var util=require('util');var logger=require(_0xb5dc('0x1'))(_0xb5dc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb5dc('0x3'));var fs=require('fs');var path=require(_0xb5dc('0x4'));var rimraf=require(_0xb5dc('0x5'));var config=require(_0xb5dc('0x6'));var attributes=require(_0xb5dc('0x7'));module[_0xb5dc('0x8')]=function(_0x480acb,_0x5d0fed){return _0x480acb[_0xb5dc('0x9')](_0xb5dc('0xa'),attributes,{'tableName':_0xb5dc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea4=['bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','api','moment'];(function(_0x3330b8,_0x19b32a){var _0x191799=function(_0xb95e53){while(--_0xb95e53){_0x3330b8['push'](_0x3330b8['shift']());}};_0x191799(++_0x19b32a);}(_0xcea4,0x80));var _0x4cea=function(_0x35a329,_0x488fee){_0x35a329=_0x35a329-0x0;var _0x4cbdb1=_0xcea4[_0x35a329];return _0x4cbdb1;};'use strict';var _=require(_0x4cea('0x0'));var util=require(_0x4cea('0x1'));var logger=require('../../config/logger')(_0x4cea('0x2'));var moment=require(_0x4cea('0x3'));var BPromise=require(_0x4cea('0x4'));var rp=require(_0x4cea('0x5'));var fs=require('fs');var path=require(_0x4cea('0x6'));var rimraf=require('rimraf');var config=require(_0x4cea('0x7'));var attributes=require(_0x4cea('0x8'));module['exports']=function(_0x5b081c,_0x4514d2){return _0x5b081c[_0x4cea('0x9')](_0x4cea('0xa'),attributes,{'tableName':_0x4cea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 03056a5..eba2351 100644 --- a/server/api/chatQueue/chatQueue.rpc.js +++ b/server/api/chatQueue/chatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e47=['register','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','ChatQueue','findAll','options','attributes','limit','include','map','model','catch','find','raw','ShowChatQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatQueue.socket'];(function(_0x2007d8,_0x3a6ae6){var _0x1348bc=function(_0x29ddc1){while(--_0x29ddc1){_0x2007d8['push'](_0x2007d8['shift']());}};_0x1348bc(++_0x3a6ae6);}(_0x0e47,0x65));var _0x70e4=function(_0xc2be36,_0x5a47fc){_0xc2be36=_0xc2be36-0x0;var _0x4c177d=_0x0e47[_0xc2be36];return _0x4c177d;};'use strict';var _=require(_0x70e4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x70e4('0x1'));var rs=require(_0x70e4('0x2'));var fs=require('fs');var Redis=require(_0x70e4('0x3'));var db=require(_0x70e4('0x4'))['db'];var utils=require(_0x70e4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x70e4('0x6'));var jayson=require(_0x70e4('0x7'));var client=jayson['client'][_0x70e4('0x8')]({'port':0x232a});config[_0x70e4('0x9')]=_[_0x70e4('0xa')](config[_0x70e4('0x9')],{'host':_0x70e4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70e4('0x9')]));require(_0x70e4('0xc'))[_0x70e4('0xd')](socket);function respondWithRpcPromise(_0x3c50b6,_0x530b69,_0x2ba4d1){return new BPromise(function(_0x1f5b7d,_0x457df9){return client['request'](_0x3c50b6,_0x2ba4d1)[_0x70e4('0xe')](function(_0x91fc55){logger[_0x70e4('0xf')]('ChatQueue,\x20%s,\x20%s',_0x530b69,_0x70e4('0x10'));logger[_0x70e4('0x11')](_0x70e4('0x12'),_0x530b69,_0x70e4('0x10'),JSON[_0x70e4('0x13')](_0x91fc55));if(_0x91fc55['error']){if(_0x91fc55[_0x70e4('0x14')][_0x70e4('0x15')]===0x1f4){logger['error'](_0x70e4('0x16'),_0x530b69,_0x91fc55['error'][_0x70e4('0x17')]);return _0x457df9(_0x91fc55[_0x70e4('0x14')][_0x70e4('0x17')]);}logger[_0x70e4('0x14')](_0x70e4('0x16'),_0x530b69,_0x91fc55[_0x70e4('0x14')]['message']);return _0x1f5b7d(_0x91fc55['error'][_0x70e4('0x17')]);}else{logger['info'](_0x70e4('0x16'),_0x530b69,_0x70e4('0x10'));_0x1f5b7d(_0x91fc55[_0x70e4('0x18')][_0x70e4('0x17')]);}})['catch'](function(_0x327a9f){logger[_0x70e4('0x14')]('ChatQueue,\x20%s,\x20%s',_0x530b69,_0x327a9f);_0x457df9(_0x327a9f);});});}exports[_0x70e4('0x19')]=function(_0x22791d){var _0x562d9f=this;return new Promise(function(_0x40fb8e,_0x5f2c85){return db[_0x70e4('0x1a')][_0x70e4('0x1b')]({'raw':_0x22791d[_0x70e4('0x1c')]?_0x22791d[_0x70e4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x22791d[_0x70e4('0x1c')]?_0x22791d[_0x70e4('0x1c')]['where']||null:null,'attributes':_0x22791d['options']?_0x22791d['options'][_0x70e4('0x1d')]||null:null,'limit':_0x22791d[_0x70e4('0x1c')]?_0x22791d[_0x70e4('0x1c')][_0x70e4('0x1e')]||null:null,'include':_0x22791d[_0x70e4('0x1c')]?_0x22791d[_0x70e4('0x1c')][_0x70e4('0x1f')]?_[_0x70e4('0x20')](_0x22791d['options'][_0x70e4('0x1f')],function(_0x2c46e0){return{'model':db[_0x2c46e0['model']],'as':_0x2c46e0['as'],'attributes':_0x2c46e0['attributes'],'include':_0x2c46e0[_0x70e4('0x1f')]?_['map'](_0x2c46e0[_0x70e4('0x1f')],function(_0x3ed8f1){return{'model':db[_0x3ed8f1[_0x70e4('0x21')]],'as':_0x3ed8f1['as'],'attributes':_0x3ed8f1['attributes'],'include':_0x3ed8f1[_0x70e4('0x1f')]?_[_0x70e4('0x20')](_0x3ed8f1['include'],function(_0x2ca4d7){return{'model':db[_0x2ca4d7[_0x70e4('0x21')]],'as':_0x2ca4d7['as'],'attributes':_0x2ca4d7[_0x70e4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x70e4('0xe')](function(_0x1bf8a4){logger[_0x70e4('0xf')]('GetChatQueue',_0x22791d);logger[_0x70e4('0x11')](_0x70e4('0x19'),_0x22791d,JSON[_0x70e4('0x13')](_0x1bf8a4));_0x40fb8e(_0x1bf8a4);})[_0x70e4('0x22')](function(_0x3b06a8){logger[_0x70e4('0x14')](_0x70e4('0x19'),_0x3b06a8[_0x70e4('0x17')],_0x22791d);_0x5f2c85(_0x562d9f[_0x70e4('0x14')](0x1f4,_0x3b06a8[_0x70e4('0x17')]));});});};exports['ShowChatQueue']=function(_0x2184ad){var _0x50a960=this;return new Promise(function(_0x20ed6e,_0x40b160){return db[_0x70e4('0x1a')][_0x70e4('0x23')]({'raw':_0x2184ad['options']?_0x2184ad[_0x70e4('0x1c')][_0x70e4('0x24')]===undefined?!![]:![]:!![],'where':_0x2184ad['options']?_0x2184ad['options']['where']||null:null,'attributes':_0x2184ad['options']?_0x2184ad['options'][_0x70e4('0x1d')]||null:null,'include':_0x2184ad[_0x70e4('0x1c')]?_0x2184ad[_0x70e4('0x1c')]['include']?_[_0x70e4('0x20')](_0x2184ad[_0x70e4('0x1c')][_0x70e4('0x1f')],function(_0x1aa1fc){return{'model':db[_0x1aa1fc[_0x70e4('0x21')]],'as':_0x1aa1fc['as'],'attributes':_0x1aa1fc[_0x70e4('0x1d')],'include':_0x1aa1fc['include']?_[_0x70e4('0x20')](_0x1aa1fc[_0x70e4('0x1f')],function(_0x3c98f4){return{'model':db[_0x3c98f4[_0x70e4('0x21')]],'as':_0x3c98f4['as'],'attributes':_0x3c98f4[_0x70e4('0x1d')],'include':_0x3c98f4[_0x70e4('0x1f')]?_[_0x70e4('0x20')](_0x3c98f4['include'],function(_0x7b3089){return{'model':db[_0x7b3089[_0x70e4('0x21')]],'as':_0x7b3089['as'],'attributes':_0x7b3089[_0x70e4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x70e4('0xe')](function(_0x2230e3){logger['info'](_0x70e4('0x25'),_0x2184ad);logger[_0x70e4('0x11')]('ShowChatQueue',_0x2184ad,JSON[_0x70e4('0x13')](_0x2230e3));_0x20ed6e(_0x2230e3);})[_0x70e4('0x22')](function(_0x582272){logger[_0x70e4('0x14')]('ShowChatQueue',_0x582272[_0x70e4('0x17')],_0x2184ad);_0x40b160(_0x50a960[_0x70e4('0x14')](0x1f4,_0x582272[_0x70e4('0x17')]));});});}; \ No newline at end of file +var _0x8f59=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','findAll','options','raw','where','limit','include','map','model','attributes','then','GetChatQueue','ShowChatQueue','ChatQueue','find','lodash','util'];(function(_0x480e69,_0x372174){var _0x5e68f2=function(_0x4b4d80){while(--_0x4b4d80){_0x480e69['push'](_0x480e69['shift']());}};_0x5e68f2(++_0x372174);}(_0x8f59,0x11d));var _0x98f5=function(_0x1f98c0,_0x4ddddf){_0x1f98c0=_0x1f98c0-0x0;var _0x1cc656=_0x8f59[_0x1f98c0];return _0x1cc656;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});config[_0x98f5('0xc')]=_['defaults'](config['redis'],{'host':_0x98f5('0xd'),'port':0x18eb});var socket=require(_0x98f5('0xe'))(new Redis(config[_0x98f5('0xc')]));require('./chatQueue.socket')[_0x98f5('0xf')](socket);function respondWithRpcPromise(_0x31b669,_0x227cf3,_0x39e85d){return new BPromise(function(_0x4c4abc,_0x26a0fc){return client['request'](_0x31b669,_0x39e85d)['then'](function(_0x3cf4b2){logger[_0x98f5('0x10')]('ChatQueue,\x20%s,\x20%s',_0x227cf3,_0x98f5('0x11'));logger[_0x98f5('0x12')](_0x98f5('0x13'),_0x227cf3,_0x98f5('0x11'),JSON[_0x98f5('0x14')](_0x3cf4b2));if(_0x3cf4b2[_0x98f5('0x15')]){if(_0x3cf4b2['error'][_0x98f5('0x16')]===0x1f4){logger[_0x98f5('0x15')]('ChatQueue,\x20%s,\x20%s',_0x227cf3,_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);return _0x26a0fc(_0x3cf4b2[_0x98f5('0x15')]['message']);}logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x3cf4b2[_0x98f5('0x15')]['message']);return _0x4c4abc(_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);}else{logger['info'](_0x98f5('0x18'),_0x227cf3,'request\x20sent');_0x4c4abc(_0x3cf4b2[_0x98f5('0x19')][_0x98f5('0x17')]);}})[_0x98f5('0x1a')](function(_0x11b6d4){logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x11b6d4);_0x26a0fc(_0x11b6d4);});});}exports['GetChatQueue']=function(_0xf88f34){var _0x5500a2=this;return new Promise(function(_0xd1209d,_0x191f23){return db['ChatQueue'][_0x98f5('0x1b')]({'raw':_0xf88f34[_0x98f5('0x1c')]?_0xf88f34[_0x98f5('0x1c')][_0x98f5('0x1d')]===undefined?!![]:![]:!![],'where':_0xf88f34[_0x98f5('0x1c')]?_0xf88f34[_0x98f5('0x1c')][_0x98f5('0x1e')]||null:null,'attributes':_0xf88f34['options']?_0xf88f34[_0x98f5('0x1c')]['attributes']||null:null,'limit':_0xf88f34[_0x98f5('0x1c')]?_0xf88f34['options'][_0x98f5('0x1f')]||null:null,'include':_0xf88f34[_0x98f5('0x1c')]?_0xf88f34[_0x98f5('0x1c')][_0x98f5('0x20')]?_[_0x98f5('0x21')](_0xf88f34[_0x98f5('0x1c')][_0x98f5('0x20')],function(_0x58d506){return{'model':db[_0x58d506[_0x98f5('0x22')]],'as':_0x58d506['as'],'attributes':_0x58d506[_0x98f5('0x23')],'include':_0x58d506['include']?_[_0x98f5('0x21')](_0x58d506[_0x98f5('0x20')],function(_0x5b08c2){return{'model':db[_0x5b08c2[_0x98f5('0x22')]],'as':_0x5b08c2['as'],'attributes':_0x5b08c2[_0x98f5('0x23')],'include':_0x5b08c2[_0x98f5('0x20')]?_[_0x98f5('0x21')](_0x5b08c2[_0x98f5('0x20')],function(_0x576c4b){return{'model':db[_0x576c4b['model']],'as':_0x576c4b['as'],'attributes':_0x576c4b[_0x98f5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x24')](function(_0x18bb29){logger[_0x98f5('0x10')](_0x98f5('0x25'),_0xf88f34);logger[_0x98f5('0x12')]('GetChatQueue',_0xf88f34,JSON[_0x98f5('0x14')](_0x18bb29));_0xd1209d(_0x18bb29);})[_0x98f5('0x1a')](function(_0x7a922b){logger[_0x98f5('0x15')](_0x98f5('0x25'),_0x7a922b[_0x98f5('0x17')],_0xf88f34);_0x191f23(_0x5500a2['error'](0x1f4,_0x7a922b[_0x98f5('0x17')]));});});};exports[_0x98f5('0x26')]=function(_0x229495){var _0x1e193c=this;return new Promise(function(_0x492771,_0x45ca95){return db[_0x98f5('0x27')][_0x98f5('0x28')]({'raw':_0x229495[_0x98f5('0x1c')]?_0x229495[_0x98f5('0x1c')][_0x98f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x229495[_0x98f5('0x1c')]?_0x229495[_0x98f5('0x1c')][_0x98f5('0x1e')]||null:null,'attributes':_0x229495[_0x98f5('0x1c')]?_0x229495[_0x98f5('0x1c')][_0x98f5('0x23')]||null:null,'include':_0x229495[_0x98f5('0x1c')]?_0x229495[_0x98f5('0x1c')][_0x98f5('0x20')]?_[_0x98f5('0x21')](_0x229495[_0x98f5('0x1c')][_0x98f5('0x20')],function(_0x3187bd){return{'model':db[_0x3187bd[_0x98f5('0x22')]],'as':_0x3187bd['as'],'attributes':_0x3187bd['attributes'],'include':_0x3187bd[_0x98f5('0x20')]?_['map'](_0x3187bd['include'],function(_0xd69228){return{'model':db[_0xd69228[_0x98f5('0x22')]],'as':_0xd69228['as'],'attributes':_0xd69228[_0x98f5('0x23')],'include':_0xd69228[_0x98f5('0x20')]?_['map'](_0xd69228[_0x98f5('0x20')],function(_0x250933){return{'model':db[_0x250933[_0x98f5('0x22')]],'as':_0x250933['as'],'attributes':_0x250933['attributes']};}):[]};}):[]};}):[]:[]})[_0x98f5('0x24')](function(_0x1bf25b){logger['info'](_0x98f5('0x26'),_0x229495);logger[_0x98f5('0x12')](_0x98f5('0x26'),_0x229495,JSON['stringify'](_0x1bf25b));_0x492771(_0x1bf25b);})[_0x98f5('0x1a')](function(_0x3388cb){logger[_0x98f5('0x15')](_0x98f5('0x26'),_0x3388cb[_0x98f5('0x17')],_0x229495);_0x45ca95(_0x1e193c['error'](0x1f4,_0x3388cb['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 4970e1c..d23c5c4 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x826a=['update','emit','removeListener','register','length','chatQueue:','save'];(function(_0x455fcb,_0x3020e7){var _0x1ccac5=function(_0x4c6c0b){while(--_0x4c6c0b){_0x455fcb['push'](_0x455fcb['shift']());}};_0x1ccac5(++_0x3020e7);}(_0x826a,0x1aa));var _0xa826=function(_0x2f28a1,_0x4f3c16){_0x2f28a1=_0x2f28a1-0x0;var _0x2929f4=_0x826a[_0x2f28a1];return _0x2929f4;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xa826('0x0'),'remove',_0xa826('0x1')];function createListener(_0x50c70e,_0x376d53){return function(_0x19ba11){_0x376d53[_0xa826('0x2')](_0x50c70e,_0x19ba11);};}function removeListener(_0x34e1ad,_0x5372ab){return function(){ChatQueueEvents[_0xa826('0x3')](_0x34e1ad,_0x5372ab);};}exports[_0xa826('0x4')]=function(_0x3929d4){for(var _0x34327b=0x0,_0x45154f=events[_0xa826('0x5')];_0x34327b<_0x45154f;_0x34327b++){var _0x4339f9=events[_0x34327b];var _0x14c2ba=createListener(_0xa826('0x6')+_0x4339f9,_0x3929d4);ChatQueueEvents['on'](_0x4339f9,_0x14c2ba);}}; \ No newline at end of file +var _0x4b84=['./chatQueue.events','save','emit','length'];(function(_0x51b81d,_0x2dfac5){var _0x2c389d=function(_0x3249ce){while(--_0x3249ce){_0x51b81d['push'](_0x51b81d['shift']());}};_0x2c389d(++_0x2dfac5);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3b2244,_0x54873f){_0x3b2244=_0x3b2244-0x0;var _0x2dcc14=_0x4b84[_0x3b2244];return _0x2dcc14;};'use strict';var ChatQueueEvents=require(_0x44b8('0x0'));var events=[_0x44b8('0x1'),'remove','update'];function createListener(_0x765943,_0x519db3){return function(_0x4b8ad8){_0x519db3[_0x44b8('0x2')](_0x765943,_0x4b8ad8);};}function removeListener(_0x31282a,_0x39ad16){return function(){ChatQueueEvents['removeListener'](_0x31282a,_0x39ad16);};}exports['register']=function(_0x55f25d){for(var _0x996a8b=0x0,_0x54274b=events[_0x44b8('0x3')];_0x996a8b<_0x54274b;_0x996a8b++){var _0x5947f7=events[_0x996a8b];var _0x3e87c5=createListener('chatQueue:'+_0x5947f7,_0x55f25d);ChatQueueEvents['on'](_0x5947f7,_0x3e87c5);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 2c2e899..42e3c49 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3e74,0x175));var _0x43e7=function(_0x29b0f4,_0x201c33){_0x29b0f4=_0x29b0f4-0x0;var _0x5dc981=_0x3e74[_0x29b0f4];return _0x5dc981;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x47397f,_0x45ba05){var _0xba5ff1=function(_0x4e139a){while(--_0x4e139a){_0x47397f['push'](_0x47397f['shift']());}};_0xba5ff1(++_0x45ba05);}(_0x55ca,0x126));var _0xa55c=function(_0x411b14,_0x3f9e36){_0x411b14=_0x411b14-0x0;var _0x402736=_0x55ca[_0x411b14];return _0x402736;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 8029afc..842bb23 100644 --- a/server/api/chatQueueReport/chatQueueReport.attributes.js +++ b/server/api/chatQueueReport/chatQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e82=['STRING','DATE','moment','sequelize','exports'];(function(_0x5453b0,_0x11a4ba){var _0x2483c4=function(_0x21cece){while(--_0x21cece){_0x5453b0['push'](_0x5453b0['shift']());}};_0x2483c4(++_0x11a4ba);}(_0x9e82,0x1e2));var _0x29e8=function(_0x5613da,_0x2d3fce){_0x5613da=_0x5613da-0x0;var _0x1ec0af=_0x9e82[_0x5613da];return _0x1ec0af;};'use strict';var moment=require(_0x29e8('0x0'));var Sequelize=require(_0x29e8('0x1'));module[_0x29e8('0x2')]={'uniqueid':{'type':Sequelize[_0x29e8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x29e8('0x3')]},'joinAt':{'type':Sequelize[_0x29e8('0x4')]},'leaveAt':{'type':Sequelize[_0x29e8('0x4')]},'acceptAt':{'type':Sequelize[_0x29e8('0x4')]},'exitAt':{'type':Sequelize[_0x29e8('0x4')]},'reason':{'type':Sequelize[_0x29e8('0x3')]}}; \ No newline at end of file +var _0x9fc3=['DATE','moment','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9fc3,0x199));var _0x39fc=function(_0x520beb,_0x256dc1){_0x520beb=_0x520beb-0x0;var _0x17c1e1=_0x9fc3[_0x520beb];return _0x17c1e1;};'use strict';var moment=require(_0x39fc('0x0'));var Sequelize=require('sequelize');module[_0x39fc('0x1')]={'uniqueid':{'type':Sequelize[_0x39fc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x39fc('0x2')]},'joinAt':{'type':Sequelize[_0x39fc('0x3')]},'leaveAt':{'type':Sequelize[_0x39fc('0x3')]},'acceptAt':{'type':Sequelize[_0x39fc('0x3')]},'exitAt':{'type':Sequelize[_0x39fc('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 99c011b..7b3c9a0 100644 --- a/server/api/chatQueueReport/chatQueueReport.controller.js +++ b/server/api/chatQueueReport/chatQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x297f=['params','keys','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','error','stack','name','ChatQueueReport','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch'];(function(_0x24db5e,_0x1df6db){var _0x51a4e3=function(_0x4663c5){while(--_0x4663c5){_0x24db5e['push'](_0x24db5e['shift']());}};_0x51a4e3(++_0x1df6db);}(_0x297f,0x1f0));var _0xf297=function(_0x1c47bf,_0x7a5745){_0x1c47bf=_0x1c47bf-0x0;var _0x105adb=_0x297f[_0x1c47bf];return _0x105adb;};'use strict';var emlformat=require(_0xf297('0x0'));var rimraf=require(_0xf297('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf297('0x2'));var moment=require(_0xf297('0x3'));var BPromise=require(_0xf297('0x4'));var Mustache=require(_0xf297('0x5'));var util=require('util');var path=require(_0xf297('0x6'));var sox=require('sox');var csv=require(_0xf297('0x7'));var ejs=require(_0xf297('0x8'));var fs=require('fs');var fs_extra=require(_0xf297('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf297('0xa'));var jsforce=require(_0xf297('0xb'));var deskjs=require(_0xf297('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf297('0xd'));var Papa=require(_0xf297('0xe'));var Redis=require('ioredis');var authService=require(_0xf297('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf297('0x10'));var hardwareService=require(_0xf297('0x11'));var logger=require(_0xf297('0x12'))('api');var utils=require(_0xf297('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf297('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5534f1,_0x395101){_0x395101=_0x395101||0xcc;return function(_0x3554b1){if(_0x3554b1){return _0x5534f1[_0xf297('0x15')](_0x395101);}return _0x5534f1[_0xf297('0x16')](_0x395101)[_0xf297('0x17')]();};}function respondWithResult(_0x3b7941,_0x5c5e7c){_0x5c5e7c=_0x5c5e7c||0xc8;return function(_0xb7647b){if(_0xb7647b){return _0x3b7941[_0xf297('0x16')](_0x5c5e7c)['json'](_0xb7647b);}};}function respondWithFilteredResult(_0x42fd50,_0x5eed15){return function(_0x2dd842){if(_0x2dd842){var _0x12c499=typeof _0x5eed15[_0xf297('0x18')]==='undefined'&&typeof _0x5eed15['limit']===_0xf297('0x19');var _0x1e2a77=_0x2dd842['count'];var _0x47d584=_0x12c499?0x0:_0x5eed15[_0xf297('0x18')];var _0x1932df=_0x12c499?_0x2dd842['count']:_0x5eed15[_0xf297('0x18')]+_0x5eed15[_0xf297('0x1a')];var _0x3ccb7;if(_0x1932df>=_0x1e2a77){_0x1932df=_0x1e2a77;_0x3ccb7=0xc8;}else{_0x3ccb7=0xce;}_0x42fd50['status'](_0x3ccb7);return _0x42fd50[_0xf297('0x1b')](_0xf297('0x1c'),_0x47d584+'-'+_0x1932df+'/'+_0x1e2a77)[_0xf297('0x1d')](_0x2dd842);}return null;};}function patchUpdates(_0x556c15){return function(_0x5f96ba){try{jsonpatch[_0xf297('0x1e')](_0x5f96ba,_0x556c15,!![]);}catch(_0x13ec1d){return BPromise['reject'](_0x13ec1d);}return _0x5f96ba[_0xf297('0x1f')]();};}function saveUpdates(_0x10830f,_0x4023a3){return function(_0x4cf7f7){if(_0x4cf7f7){return _0x4cf7f7[_0xf297('0x20')](_0x10830f)[_0xf297('0x21')](function(_0x6721c2){return _0x6721c2;});}return null;};}function removeEntity(_0x18d62b,_0x5335ca){return function(_0x27265c){if(_0x27265c){return _0x27265c['destroy']()[_0xf297('0x21')](function(){_0x18d62b[_0xf297('0x16')](0xcc)[_0xf297('0x17')]();});}};}function handleEntityNotFound(_0x3064dc,_0x2bd9a3){return function(_0x5a6335){if(!_0x5a6335){_0x3064dc['sendStatus'](0x194);}return _0x5a6335;};}function handleError(_0x8fb0dc,_0x3b4d86){_0x3b4d86=_0x3b4d86||0x1f4;return function(_0x73cabe){logger[_0xf297('0x22')](_0x73cabe[_0xf297('0x23')]);if(_0x73cabe[_0xf297('0x24')]){delete _0x73cabe['name'];}_0x8fb0dc[_0xf297('0x16')](_0x3b4d86)['send'](_0x73cabe);};}exports['index']=function(_0x58f5f3,_0x44d18e){var _0xca3c5e={},_0xa91424={},_0x901699={'count':0x0,'rows':[]};var _0x2cdfc6=_['map'](db[_0xf297('0x25')][_0xf297('0x26')],function(_0x566743){return{'name':_0x566743[_0xf297('0x27')],'type':_0x566743[_0xf297('0x28')][_0xf297('0x29')]};});_0xa91424['model']=_[_0xf297('0x2a')](_0x2cdfc6,_0xf297('0x24'));_0xa91424[_0xf297('0x2b')]=_['keys'](_0x58f5f3[_0xf297('0x2b')]);_0xa91424[_0xf297('0x2c')]=_['intersection'](_0xa91424[_0xf297('0x2d')],_0xa91424[_0xf297('0x2b')]);_0xca3c5e[_0xf297('0x2e')]=_[_0xf297('0x2f')](_0xa91424[_0xf297('0x2d')],qs[_0xf297('0x30')](_0x58f5f3['query'][_0xf297('0x30')]));_0xca3c5e[_0xf297('0x2e')]=_0xca3c5e['attributes'][_0xf297('0x31')]?_0xca3c5e[_0xf297('0x2e')]:_0xa91424[_0xf297('0x2d')];if(!_0x58f5f3[_0xf297('0x2b')]['hasOwnProperty'](_0xf297('0x32'))){_0xca3c5e[_0xf297('0x1a')]=qs[_0xf297('0x1a')](_0x58f5f3['query'][_0xf297('0x1a')]);_0xca3c5e[_0xf297('0x18')]=qs[_0xf297('0x18')](_0x58f5f3[_0xf297('0x2b')][_0xf297('0x18')]);}_0xca3c5e[_0xf297('0x33')]=qs[_0xf297('0x34')](_0x58f5f3[_0xf297('0x2b')]['sort']);_0xca3c5e[_0xf297('0x35')]=qs[_0xf297('0x2c')](_[_0xf297('0x36')](_0x58f5f3[_0xf297('0x2b')],_0xa91424[_0xf297('0x2c')]),_0x2cdfc6);if(_0x58f5f3[_0xf297('0x2b')][_0xf297('0x37')]){_0xca3c5e[_0xf297('0x35')]=_[_0xf297('0x38')](_0xca3c5e[_0xf297('0x35')],{'$or':_[_0xf297('0x2a')](_0x2cdfc6,function(_0x3f2b0a){if(_0x3f2b0a[_0xf297('0x28')]!==_0xf297('0x39')){var _0x317d03={};_0x317d03[_0x3f2b0a['name']]={'$like':'%'+_0x58f5f3[_0xf297('0x2b')][_0xf297('0x37')]+'%'};return _0x317d03;}})});}_0xca3c5e=_['merge']({},_0xca3c5e,_0x58f5f3[_0xf297('0x3a')]);var _0x463b21={'where':_0xca3c5e[_0xf297('0x35')]};return db[_0xf297('0x25')][_0xf297('0x3b')](_0x463b21)[_0xf297('0x21')](function(_0x575a67){_0x901699['count']=_0x575a67;if(_0x58f5f3[_0xf297('0x2b')][_0xf297('0x3c')]){_0xca3c5e[_0xf297('0x3d')]=[{'all':!![]}];}return db[_0xf297('0x25')][_0xf297('0x3e')](_0xca3c5e);})['then'](function(_0x53be11){_0x901699['rows']=_0x53be11;return _0x901699;})[_0xf297('0x21')](respondWithFilteredResult(_0x44d18e,_0xca3c5e))[_0xf297('0x3f')](handleError(_0x44d18e,null));};exports['show']=function(_0x625d81,_0x4e6483){var _0x2cbfe8={'raw':!![],'where':{'id':_0x625d81[_0xf297('0x40')]['id']}},_0x1503cd={};_0x1503cd['model']=_[_0xf297('0x41')](db[_0xf297('0x25')][_0xf297('0x26')]);_0x1503cd[_0xf297('0x2b')]=_[_0xf297('0x41')](_0x625d81[_0xf297('0x2b')]);_0x1503cd['filters']=_[_0xf297('0x2f')](_0x1503cd[_0xf297('0x2d')],_0x1503cd[_0xf297('0x2b')]);_0x2cbfe8['attributes']=_['intersection'](_0x1503cd[_0xf297('0x2d')],qs['fields'](_0x625d81[_0xf297('0x2b')][_0xf297('0x30')]));_0x2cbfe8[_0xf297('0x2e')]=_0x2cbfe8['attributes']['length']?_0x2cbfe8['attributes']:_0x1503cd[_0xf297('0x2d')];if(_0x625d81[_0xf297('0x2b')]['includeAll']){_0x2cbfe8[_0xf297('0x3d')]=[{'all':!![]}];}_0x2cbfe8=_['merge']({},_0x2cbfe8,_0x625d81[_0xf297('0x3a')]);return db['ChatQueueReport'][_0xf297('0x42')](_0x2cbfe8)['then'](handleEntityNotFound(_0x4e6483,null))[_0xf297('0x21')](respondWithResult(_0x4e6483,null))['catch'](handleError(_0x4e6483,null));};exports[_0xf297('0x43')]=function(_0x1213f8,_0x564ae3){return db['ChatQueueReport']['create'](_0x1213f8[_0xf297('0x44')],{})[_0xf297('0x21')](respondWithResult(_0x564ae3,0xc9))[_0xf297('0x3f')](handleError(_0x564ae3,null));};exports[_0xf297('0x20')]=function(_0x528887,_0x4d1215){if(_0x528887[_0xf297('0x44')]['id']){delete _0x528887[_0xf297('0x44')]['id'];}return db[_0xf297('0x25')][_0xf297('0x42')]({'where':{'id':_0x528887[_0xf297('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d1215,null))[_0xf297('0x21')](saveUpdates(_0x528887[_0xf297('0x44')],null))[_0xf297('0x21')](respondWithResult(_0x4d1215,null))[_0xf297('0x3f')](handleError(_0x4d1215,null));};exports['destroy']=function(_0x23efc6,_0xf82b07){return db[_0xf297('0x25')]['find']({'where':{'id':_0x23efc6[_0xf297('0x40')]['id']}})[_0xf297('0x21')](handleEntityNotFound(_0xf82b07,null))[_0xf297('0x21')](removeEntity(_0xf82b07,null))[_0xf297('0x3f')](handleError(_0xf82b07,null));};exports[_0xf297('0x45')]=function(_0xf7c9ba,_0x1d2e33){return db[_0xf297('0x25')][_0xf297('0x45')]()['then'](respondWithResult(_0x1d2e33,null))['catch'](handleError(_0x1d2e33,null));}; \ No newline at end of file +var _0x1410=['eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','find','catch','create','body','params','describe'];(function(_0x589248,_0x31dea3){var _0x486750=function(_0x3e7c21){while(--_0x3e7c21){_0x589248['push'](_0x589248['shift']());}};_0x486750(++_0x31dea3);}(_0x1410,0x130));var _0x0141=function(_0x5ac381,_0x50aabb){_0x5ac381=_0x5ac381-0x0;var _0x516264=_0x1410[_0x5ac381];return _0x516264;};'use strict';var emlformat=require(_0x0141('0x0'));var rimraf=require(_0x0141('0x1'));var zipdir=require(_0x0141('0x2'));var jsonpatch=require(_0x0141('0x3'));var rp=require('request-promise');var moment=require(_0x0141('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0141('0x5'));var util=require('util');var path=require(_0x0141('0x6'));var sox=require(_0x0141('0x7'));var csv=require(_0x0141('0x8'));var ejs=require(_0x0141('0x9'));var fs=require('fs');var fs_extra=require(_0x0141('0xa'));var _=require(_0x0141('0xb'));var squel=require(_0x0141('0xc'));var crypto=require(_0x0141('0xd'));var jsforce=require(_0x0141('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0141('0x8'));var querystring=require(_0x0141('0xf'));var Papa=require(_0x0141('0x10'));var Redis=require(_0x0141('0x11'));var authService=require(_0x0141('0x12'));var qs=require(_0x0141('0x13'));var as=require(_0x0141('0x14'));var hardwareService=require(_0x0141('0x15'));var logger=require('../../config/logger')(_0x0141('0x16'));var utils=require(_0x0141('0x17'));var config=require(_0x0141('0x18'));var licenseUtil=require(_0x0141('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49cebd,_0xab59e3){_0xab59e3=_0xab59e3||0xcc;return function(_0x25aefb){if(_0x25aefb){return _0x49cebd['sendStatus'](_0xab59e3);}return _0x49cebd[_0x0141('0x1a')](_0xab59e3)[_0x0141('0x1b')]();};}function respondWithResult(_0x16a55a,_0x245007){_0x245007=_0x245007||0xc8;return function(_0x1665e2){if(_0x1665e2){return _0x16a55a['status'](_0x245007)[_0x0141('0x1c')](_0x1665e2);}};}function respondWithFilteredResult(_0x5edd9f,_0x2ee001){return function(_0x3db66a){if(_0x3db66a){var _0x345fbd=typeof _0x2ee001[_0x0141('0x1d')]===_0x0141('0x1e')&&typeof _0x2ee001[_0x0141('0x1f')]==='undefined';var _0x58c3bb=_0x3db66a[_0x0141('0x20')];var _0x3720f6=_0x345fbd?0x0:_0x2ee001['offset'];var _0x9c1eec=_0x345fbd?_0x3db66a[_0x0141('0x20')]:_0x2ee001[_0x0141('0x1d')]+_0x2ee001[_0x0141('0x1f')];var _0x5427b5;if(_0x9c1eec>=_0x58c3bb){_0x9c1eec=_0x58c3bb;_0x5427b5=0xc8;}else{_0x5427b5=0xce;}_0x5edd9f[_0x0141('0x1a')](_0x5427b5);return _0x5edd9f[_0x0141('0x21')]('Content-Range',_0x3720f6+'-'+_0x9c1eec+'/'+_0x58c3bb)[_0x0141('0x1c')](_0x3db66a);}return null;};}function patchUpdates(_0x3e8603){return function(_0x17585f){try{jsonpatch[_0x0141('0x22')](_0x17585f,_0x3e8603,!![]);}catch(_0x316f70){return BPromise[_0x0141('0x23')](_0x316f70);}return _0x17585f['save']();};}function saveUpdates(_0x21d8fc,_0x40c774){return function(_0x363860){if(_0x363860){return _0x363860[_0x0141('0x24')](_0x21d8fc)[_0x0141('0x25')](function(_0x1a4b0b){return _0x1a4b0b;});}return null;};}function removeEntity(_0xccf0c,_0x20656b){return function(_0x12a11e){if(_0x12a11e){return _0x12a11e[_0x0141('0x26')]()[_0x0141('0x25')](function(){_0xccf0c[_0x0141('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4247d,_0x14ecbf){return function(_0xb80072){if(!_0xb80072){_0x4247d[_0x0141('0x27')](0x194);}return _0xb80072;};}function handleError(_0xcc5658,_0x52e90a){_0x52e90a=_0x52e90a||0x1f4;return function(_0x59196f){logger[_0x0141('0x28')](_0x59196f[_0x0141('0x29')]);if(_0x59196f['name']){delete _0x59196f[_0x0141('0x2a')];}_0xcc5658['status'](_0x52e90a)[_0x0141('0x2b')](_0x59196f);};}exports[_0x0141('0x2c')]=function(_0x400602,_0x378a87){var _0x2379ad={},_0x29f463={},_0x146daf={'count':0x0,'rows':[]};var _0xc6eabc=_[_0x0141('0x2d')](db[_0x0141('0x2e')][_0x0141('0x2f')],function(_0x36c409){return{'name':_0x36c409[_0x0141('0x30')],'type':_0x36c409['type'][_0x0141('0x31')]};});_0x29f463['model']=_[_0x0141('0x2d')](_0xc6eabc,_0x0141('0x2a'));_0x29f463[_0x0141('0x32')]=_[_0x0141('0x33')](_0x400602[_0x0141('0x32')]);_0x29f463[_0x0141('0x34')]=_['intersection'](_0x29f463[_0x0141('0x35')],_0x29f463['query']);_0x2379ad[_0x0141('0x36')]=_[_0x0141('0x37')](_0x29f463[_0x0141('0x35')],qs['fields'](_0x400602[_0x0141('0x32')][_0x0141('0x38')]));_0x2379ad['attributes']=_0x2379ad[_0x0141('0x36')][_0x0141('0x39')]?_0x2379ad[_0x0141('0x36')]:_0x29f463[_0x0141('0x35')];if(!_0x400602[_0x0141('0x32')]['hasOwnProperty'](_0x0141('0x3a'))){_0x2379ad[_0x0141('0x1f')]=qs[_0x0141('0x1f')](_0x400602[_0x0141('0x32')][_0x0141('0x1f')]);_0x2379ad[_0x0141('0x1d')]=qs['offset'](_0x400602['query'][_0x0141('0x1d')]);}_0x2379ad[_0x0141('0x3b')]=qs['sort'](_0x400602[_0x0141('0x32')][_0x0141('0x3c')]);_0x2379ad[_0x0141('0x3d')]=qs['filters'](_['pick'](_0x400602['query'],_0x29f463[_0x0141('0x34')]),_0xc6eabc);if(_0x400602[_0x0141('0x32')][_0x0141('0x3e')]){_0x2379ad[_0x0141('0x3d')]=_[_0x0141('0x3f')](_0x2379ad[_0x0141('0x3d')],{'$or':_[_0x0141('0x2d')](_0xc6eabc,function(_0x51ae65){if(_0x51ae65[_0x0141('0x40')]!==_0x0141('0x41')){var _0x5b76c1={};_0x5b76c1[_0x51ae65[_0x0141('0x2a')]]={'$like':'%'+_0x400602[_0x0141('0x32')][_0x0141('0x3e')]+'%'};return _0x5b76c1;}})});}_0x2379ad=_[_0x0141('0x3f')]({},_0x2379ad,_0x400602[_0x0141('0x42')]);var _0x158480={'where':_0x2379ad[_0x0141('0x3d')]};return db[_0x0141('0x2e')]['count'](_0x158480)[_0x0141('0x25')](function(_0x9e9408){_0x146daf['count']=_0x9e9408;if(_0x400602[_0x0141('0x32')][_0x0141('0x43')]){_0x2379ad[_0x0141('0x44')]=[{'all':!![]}];}return db[_0x0141('0x2e')][_0x0141('0x45')](_0x2379ad);})['then'](function(_0x1746a1){_0x146daf['rows']=_0x1746a1;return _0x146daf;})[_0x0141('0x25')](respondWithFilteredResult(_0x378a87,_0x2379ad))['catch'](handleError(_0x378a87,null));};exports['show']=function(_0x4e863f,_0x25870d){var _0x2579df={'raw':!![],'where':{'id':_0x4e863f['params']['id']}},_0x210a8c={};_0x210a8c[_0x0141('0x35')]=_[_0x0141('0x33')](db[_0x0141('0x2e')][_0x0141('0x2f')]);_0x210a8c['query']=_[_0x0141('0x33')](_0x4e863f[_0x0141('0x32')]);_0x210a8c[_0x0141('0x34')]=_[_0x0141('0x37')](_0x210a8c[_0x0141('0x35')],_0x210a8c[_0x0141('0x32')]);_0x2579df[_0x0141('0x36')]=_[_0x0141('0x37')](_0x210a8c['model'],qs[_0x0141('0x38')](_0x4e863f[_0x0141('0x32')][_0x0141('0x38')]));_0x2579df['attributes']=_0x2579df[_0x0141('0x36')][_0x0141('0x39')]?_0x2579df[_0x0141('0x36')]:_0x210a8c['model'];if(_0x4e863f[_0x0141('0x32')]['includeAll']){_0x2579df[_0x0141('0x44')]=[{'all':!![]}];}_0x2579df=_['merge']({},_0x2579df,_0x4e863f[_0x0141('0x42')]);return db['ChatQueueReport'][_0x0141('0x46')](_0x2579df)[_0x0141('0x25')](handleEntityNotFound(_0x25870d,null))[_0x0141('0x25')](respondWithResult(_0x25870d,null))[_0x0141('0x47')](handleError(_0x25870d,null));};exports[_0x0141('0x48')]=function(_0x482e1e,_0x3890ef){return db[_0x0141('0x2e')][_0x0141('0x48')](_0x482e1e['body'],{})[_0x0141('0x25')](respondWithResult(_0x3890ef,0xc9))[_0x0141('0x47')](handleError(_0x3890ef,null));};exports[_0x0141('0x24')]=function(_0x4978a3,_0x3e30a8){if(_0x4978a3['body']['id']){delete _0x4978a3[_0x0141('0x49')]['id'];}return db[_0x0141('0x2e')][_0x0141('0x46')]({'where':{'id':_0x4978a3[_0x0141('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3e30a8,null))[_0x0141('0x25')](saveUpdates(_0x4978a3[_0x0141('0x49')],null))[_0x0141('0x25')](respondWithResult(_0x3e30a8,null))[_0x0141('0x47')](handleError(_0x3e30a8,null));};exports[_0x0141('0x26')]=function(_0x2da74f,_0x4a37d3){return db['ChatQueueReport'][_0x0141('0x46')]({'where':{'id':_0x2da74f[_0x0141('0x4a')]['id']}})[_0x0141('0x25')](handleEntityNotFound(_0x4a37d3,null))['then'](removeEntity(_0x4a37d3,null))[_0x0141('0x47')](handleError(_0x4a37d3,null));};exports[_0x0141('0x4b')]=function(_0x1a4217,_0x4b7d84){return db[_0x0141('0x2e')]['describe']()[_0x0141('0x25')](respondWithResult(_0x4b7d84,null))[_0x0141('0x47')](handleError(_0x4b7d84,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 8b77458..ee2a5c7 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x5bf3c8,_0x5c268b){var _0xf2a998=function(_0x24243d){while(--_0x24243d){_0x5bf3c8['push'](_0x5bf3c8['shift']());}};_0xf2a998(++_0x5c268b);}(_0xe706,0xa3));var _0x6e70=function(_0x35f3c9,_0x1aaafe){_0x35f3c9=_0x35f3c9-0x0;var _0x483f61=_0xe706[_0x35f3c9];return _0x483f61;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 3f4fe0d..a538412 100644 --- a/server/api/chatQueueReport/chatQueueReport.rpc.js +++ b/server/api/chatQueueReport/chatQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dd3=['code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','update','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x2dd3,0x99));var _0x32dd=function(_0x45fef0,_0x3e7c35){_0x45fef0=_0x45fef0-0x0;var _0x2b23f0=_0x2dd3[_0x45fef0];return _0x2b23f0;};'use strict';var _=require(_0x32dd('0x0'));var util=require(_0x32dd('0x1'));var moment=require(_0x32dd('0x2'));var BPromise=require(_0x32dd('0x3'));var rs=require(_0x32dd('0x4'));var fs=require('fs');var Redis=require(_0x32dd('0x5'));var db=require(_0x32dd('0x6'))['db'];var utils=require(_0x32dd('0x7'));var logger=require(_0x32dd('0x8'))(_0x32dd('0x9'));var config=require(_0x32dd('0xa'));var jayson=require(_0x32dd('0xb'));var client=jayson['client'][_0x32dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37edb0,_0x3a2d54,_0x4e95ee){return new BPromise(function(_0x5d7793,_0x2f1311){return client[_0x32dd('0xd')](_0x37edb0,_0x4e95ee)[_0x32dd('0xe')](function(_0x12f8eb){logger[_0x32dd('0xf')](_0x32dd('0x10'),_0x3a2d54,_0x32dd('0x11'));logger[_0x32dd('0x12')](_0x32dd('0x13'),_0x3a2d54,_0x32dd('0x11'),JSON[_0x32dd('0x14')](_0x12f8eb));if(_0x12f8eb[_0x32dd('0x15')]){if(_0x12f8eb[_0x32dd('0x15')][_0x32dd('0x16')]===0x1f4){logger[_0x32dd('0x15')](_0x32dd('0x10'),_0x3a2d54,_0x12f8eb['error']['message']);return _0x2f1311(_0x12f8eb[_0x32dd('0x15')][_0x32dd('0x17')]);}logger[_0x32dd('0x15')](_0x32dd('0x10'),_0x3a2d54,_0x12f8eb[_0x32dd('0x15')][_0x32dd('0x17')]);return _0x5d7793(_0x12f8eb[_0x32dd('0x15')]['message']);}else{logger[_0x32dd('0xf')](_0x32dd('0x10'),_0x3a2d54,'request\x20sent');_0x5d7793(_0x12f8eb[_0x32dd('0x18')][_0x32dd('0x17')]);}})[_0x32dd('0x19')](function(_0x54244d){logger[_0x32dd('0x15')]('ChatQueueReport,\x20%s,\x20%s',_0x3a2d54,_0x54244d);_0x2f1311(_0x54244d);});});}exports[_0x32dd('0x1a')]=function(_0x2173e3){var _0xe2ee38=this;return new Promise(function(_0x252c23,_0x59de20){return db[_0x32dd('0x1b')][_0x32dd('0x1c')](_0x2173e3[_0x32dd('0x1d')],{'raw':_0x2173e3['options']?_0x2173e3[_0x32dd('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x32dd('0xe')](function(_0x53a522){logger[_0x32dd('0xf')]('CreateChatQueueReport',_0x2173e3);logger['debug']('CreateChatQueueReport',_0x2173e3,JSON[_0x32dd('0x14')](_0x53a522));_0x252c23(_0x53a522);})[_0x32dd('0x19')](function(_0xf57c91){logger['error'](_0x32dd('0x1a'),_0xf57c91[_0x32dd('0x17')],_0x2173e3);_0x59de20(_0xe2ee38[_0x32dd('0x15')](0x1f4,_0xf57c91[_0x32dd('0x17')]));});});};exports[_0x32dd('0x1f')]=function(_0x3de522){var _0x3b99b2=this;return new Promise(function(_0x28aa62,_0x226146){return db[_0x32dd('0x1b')][_0x32dd('0x20')](_0x3de522[_0x32dd('0x1d')],{'raw':_0x3de522[_0x32dd('0x1e')]?_0x3de522['options'][_0x32dd('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3de522[_0x32dd('0x1e')]?_0x3de522['options'][_0x32dd('0x22')]||null:null,'attributes':_0x3de522['options']?_0x3de522[_0x32dd('0x1e')]['attributes']||null:null,'limit':_0x3de522['options']?_0x3de522['options']['limit']||null:null})[_0x32dd('0xe')](function(_0x31c8d8){logger[_0x32dd('0xf')](_0x32dd('0x1f'),_0x3de522);logger['debug'](_0x32dd('0x1f'),_0x3de522,JSON[_0x32dd('0x14')](_0x31c8d8));_0x28aa62(_0x31c8d8);})[_0x32dd('0x19')](function(_0x465c2f){logger['error']('UpdateChatQueueReport',_0x465c2f[_0x32dd('0x17')],_0x3de522);_0x226146(_0x3b99b2[_0x32dd('0x15')](0x1f4,_0x465c2f[_0x32dd('0x17')]));});});}; \ No newline at end of file +var _0xdcbc=['catch','create','body','options','raw','CreateChatQueueReport','stringify','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x53c5df,_0x55ca90){var _0x102fd5=function(_0x35e6b7){while(--_0x35e6b7){_0x53c5df['push'](_0x53c5df['shift']());}};_0x102fd5(++_0x55ca90);}(_0xdcbc,0x80));var _0xcdcb=function(_0x5bcd52,_0x40b674){_0x5bcd52=_0x5bcd52-0x0;var _0x2ce4df=_0xdcbc[_0x5bcd52];return _0x2ce4df;};'use strict';var _=require(_0xcdcb('0x0'));var util=require(_0xcdcb('0x1'));var moment=require(_0xcdcb('0x2'));var BPromise=require(_0xcdcb('0x3'));var rs=require(_0xcdcb('0x4'));var fs=require('fs');var Redis=require(_0xcdcb('0x5'));var db=require(_0xcdcb('0x6'))['db'];var utils=require(_0xcdcb('0x7'));var logger=require(_0xcdcb('0x8'))(_0xcdcb('0x9'));var config=require(_0xcdcb('0xa'));var jayson=require(_0xcdcb('0xb'));var client=jayson[_0xcdcb('0xc')][_0xcdcb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38de32,_0x33a6dc,_0x1e97a3){return new BPromise(function(_0x566592,_0x27d608){return client[_0xcdcb('0xe')](_0x38de32,_0x1e97a3)['then'](function(_0x2dc70a){logger[_0xcdcb('0xf')](_0xcdcb('0x10'),_0x33a6dc,_0xcdcb('0x11'));logger[_0xcdcb('0x12')](_0xcdcb('0x13'),_0x33a6dc,_0xcdcb('0x11'),JSON['stringify'](_0x2dc70a));if(_0x2dc70a['error']){if(_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x15')]===0x1f4){logger[_0xcdcb('0x14')](_0xcdcb('0x10'),_0x33a6dc,_0x2dc70a['error'][_0xcdcb('0x16')]);return _0x27d608(_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x16')]);}logger[_0xcdcb('0x14')](_0xcdcb('0x10'),_0x33a6dc,_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x16')]);return _0x566592(_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x16')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x33a6dc,_0xcdcb('0x11'));_0x566592(_0x2dc70a[_0xcdcb('0x17')][_0xcdcb('0x16')]);}})[_0xcdcb('0x18')](function(_0x59e554){logger[_0xcdcb('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x33a6dc,_0x59e554);_0x27d608(_0x59e554);});});}exports['CreateChatQueueReport']=function(_0xbe493b){var _0x9b5430=this;return new Promise(function(_0x1f58ec,_0x5df6f1){return db['ChatQueueReport'][_0xcdcb('0x19')](_0xbe493b[_0xcdcb('0x1a')],{'raw':_0xbe493b[_0xcdcb('0x1b')]?_0xbe493b[_0xcdcb('0x1b')][_0xcdcb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2c34a1){logger[_0xcdcb('0xf')](_0xcdcb('0x1d'),_0xbe493b);logger['debug']('CreateChatQueueReport',_0xbe493b,JSON[_0xcdcb('0x1e')](_0x2c34a1));_0x1f58ec(_0x2c34a1);})[_0xcdcb('0x18')](function(_0x2887ce){logger[_0xcdcb('0x14')](_0xcdcb('0x1d'),_0x2887ce['message'],_0xbe493b);_0x5df6f1(_0x9b5430[_0xcdcb('0x14')](0x1f4,_0x2887ce[_0xcdcb('0x16')]));});});};exports[_0xcdcb('0x1f')]=function(_0x22c9ba){var _0x14c553=this;return new Promise(function(_0x506044,_0x25bc83){return db[_0xcdcb('0x20')][_0xcdcb('0x21')](_0x22c9ba[_0xcdcb('0x1a')],{'raw':_0x22c9ba[_0xcdcb('0x1b')]?_0x22c9ba[_0xcdcb('0x1b')][_0xcdcb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22c9ba[_0xcdcb('0x1b')]?_0x22c9ba[_0xcdcb('0x1b')][_0xcdcb('0x22')]||null:null,'attributes':_0x22c9ba[_0xcdcb('0x1b')]?_0x22c9ba[_0xcdcb('0x1b')][_0xcdcb('0x23')]||null:null,'limit':_0x22c9ba[_0xcdcb('0x1b')]?_0x22c9ba[_0xcdcb('0x1b')][_0xcdcb('0x24')]||null:null})[_0xcdcb('0x25')](function(_0x1c0d5d){logger[_0xcdcb('0xf')]('UpdateChatQueueReport',_0x22c9ba);logger['debug'](_0xcdcb('0x1f'),_0x22c9ba,JSON['stringify'](_0x1c0d5d));_0x506044(_0x1c0d5d);})[_0xcdcb('0x18')](function(_0x16ee2e){logger[_0xcdcb('0x14')](_0xcdcb('0x1f'),_0x16ee2e['message'],_0x22c9ba);_0x25bc83(_0x14c553[_0xcdcb('0x14')](0x1f4,_0x16ee2e[_0xcdcb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 41aa22d..7b4e0bd 100644 --- a/server/api/chatQueueReport/index.js +++ b/server/api/chatQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','destroy','multer','path','connect-timeout','express','fs-extra'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xfa3c,0x105));var _0xcfa3=function(_0x46688f,_0x302e66){_0x46688f=_0x46688f-0x0;var _0x5ee527=_0xfa3c[_0x46688f];return _0x5ee527;};'use strict';var multer=require(_0xcfa3('0x0'));var util=require('util');var path=require(_0xcfa3('0x1'));var timeout=require(_0xcfa3('0x2'));var express=require(_0xcfa3('0x3'));var router=express['Router']();var fs_extra=require(_0xcfa3('0x4'));var auth=require(_0xcfa3('0x5'));var interaction=require(_0xcfa3('0x6'));var config=require(_0xcfa3('0x7'));var controller=require(_0xcfa3('0x8'));router[_0xcfa3('0x9')]('/',auth[_0xcfa3('0xa')](),controller[_0xcfa3('0xb')]);router['get'](_0xcfa3('0xc'),auth[_0xcfa3('0xa')](),controller[_0xcfa3('0xd')]);router[_0xcfa3('0x9')](_0xcfa3('0xe'),auth[_0xcfa3('0xa')](),controller[_0xcfa3('0xf')]);router[_0xcfa3('0x10')]('/',auth[_0xcfa3('0xa')](),controller['create']);router['put'](_0xcfa3('0xe'),auth[_0xcfa3('0xa')](),controller[_0xcfa3('0x11')]);router['delete'](_0xcfa3('0xe'),auth[_0xcfa3('0xa')](),controller[_0xcfa3('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa5ae=['put','update','delete','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x425c5b,_0x5a23a5){var _0x3ec47a=function(_0x1aaef9){while(--_0x1aaef9){_0x425c5b['push'](_0x425c5b['shift']());}};_0x3ec47a(++_0x5a23a5);}(_0xa5ae,0x10d));var _0xea5a=function(_0x5eb868,_0x3edfb0){_0x5eb868=_0x5eb868-0x0;var _0x278458=_0xa5ae[_0x5eb868];return _0x278458;};'use strict';var multer=require('multer');var util=require(_0xea5a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xea5a('0x1'));var router=express[_0xea5a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xea5a('0x3'));var interaction=require(_0xea5a('0x4'));var config=require(_0xea5a('0x5'));var controller=require(_0xea5a('0x6'));router[_0xea5a('0x7')]('/',auth['isAuthenticated'](),controller[_0xea5a('0x8')]);router[_0xea5a('0x7')](_0xea5a('0x9'),auth[_0xea5a('0xa')](),controller[_0xea5a('0xb')]);router[_0xea5a('0x7')](_0xea5a('0xc'),auth[_0xea5a('0xa')](),controller[_0xea5a('0xd')]);router[_0xea5a('0xe')]('/',auth[_0xea5a('0xa')](),controller[_0xea5a('0xf')]);router[_0xea5a('0x10')](_0xea5a('0xc'),auth['isAuthenticated'](),controller[_0xea5a('0x11')]);router[_0xea5a('0x12')]('/:id',auth[_0xea5a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 7492b6e..64d85d6 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x57683b,_0x2689ed){var _0x2dbf3c=function(_0x33e947){while(--_0x33e947){_0x57683b['push'](_0x57683b['shift']());}};_0x2dbf3c(++_0x2689ed);}(_0xe706,0xa3));var _0x6e70=function(_0x13ba18,_0x39041f){_0x13ba18=_0x13ba18-0x0;var _0x5e292a=_0xe706[_0x13ba18];return _0x5e292a;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3d82ce,_0xf149e1){var _0x40a2ba=function(_0x1ef273){while(--_0x1ef273){_0x3d82ce['push'](_0x3d82ce['shift']());}};_0x40a2ba(++_0xf149e1);}(_0xaa88,0x137));var _0x8aa8=function(_0x51a6d6,_0x3c9c49){_0x51a6d6=_0x51a6d6-0x0;var _0x5ef1a8=_0xaa88[_0x51a6d6];return _0x5ef1a8;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2e2ff11..86f52c0 100644 --- a/server/api/chatTransferReport/chatTransferReport.controller.js +++ b/server/api/chatTransferReport/chatTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6778=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','find','body'];(function(_0x5cc168,_0x22581f){var _0x5546b6=function(_0x37fbfc){while(--_0x37fbfc){_0x5cc168['push'](_0x5cc168['shift']());}};_0x5546b6(++_0x22581f);}(_0x6778,0x9d));var _0x8677=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x6778[_0x2405bc];return _0x5272d4;};'use strict';var emlformat=require(_0x8677('0x0'));var rimraf=require(_0x8677('0x1'));var zipdir=require(_0x8677('0x2'));var jsonpatch=require(_0x8677('0x3'));var rp=require(_0x8677('0x4'));var moment=require(_0x8677('0x5'));var BPromise=require(_0x8677('0x6'));var Mustache=require(_0x8677('0x7'));var util=require(_0x8677('0x8'));var path=require(_0x8677('0x9'));var sox=require(_0x8677('0xa'));var csv=require(_0x8677('0xb'));var ejs=require(_0x8677('0xc'));var fs=require('fs');var fs_extra=require(_0x8677('0xd'));var _=require(_0x8677('0xe'));var squel=require('squel');var crypto=require(_0x8677('0xf'));var jsforce=require(_0x8677('0x10'));var deskjs=require(_0x8677('0x11'));var toCsv=require(_0x8677('0xb'));var querystring=require(_0x8677('0x12'));var Papa=require(_0x8677('0x13'));var Redis=require(_0x8677('0x14'));var authService=require(_0x8677('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8677('0x16'));var logger=require(_0x8677('0x17'))(_0x8677('0x18'));var utils=require(_0x8677('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8677('0x1a'));var db=require(_0x8677('0x1b'))['db'];function respondWithStatusCode(_0x491e5a,_0x62f037){_0x62f037=_0x62f037||0xcc;return function(_0x1edc70){if(_0x1edc70){return _0x491e5a[_0x8677('0x1c')](_0x62f037);}return _0x491e5a['status'](_0x62f037)[_0x8677('0x1d')]();};}function respondWithResult(_0x34cdf8,_0x2bc242){_0x2bc242=_0x2bc242||0xc8;return function(_0x3bef89){if(_0x3bef89){return _0x34cdf8['status'](_0x2bc242)[_0x8677('0x1e')](_0x3bef89);}};}function respondWithFilteredResult(_0x2cfdd1,_0x2796a4){return function(_0x674641){if(_0x674641){var _0x22ec28=typeof _0x2796a4[_0x8677('0x1f')]===_0x8677('0x20')&&typeof _0x2796a4[_0x8677('0x21')]===_0x8677('0x20');var _0x285d81=_0x674641[_0x8677('0x22')];var _0x44dca7=_0x22ec28?0x0:_0x2796a4[_0x8677('0x1f')];var _0x479a2f=_0x22ec28?_0x674641[_0x8677('0x22')]:_0x2796a4[_0x8677('0x1f')]+_0x2796a4[_0x8677('0x21')];var _0x487c6f;if(_0x479a2f>=_0x285d81){_0x479a2f=_0x285d81;_0x487c6f=0xc8;}else{_0x487c6f=0xce;}_0x2cfdd1[_0x8677('0x23')](_0x487c6f);return _0x2cfdd1[_0x8677('0x24')](_0x8677('0x25'),_0x44dca7+'-'+_0x479a2f+'/'+_0x285d81)[_0x8677('0x1e')](_0x674641);}return null;};}function patchUpdates(_0x6d561){return function(_0x249107){try{jsonpatch[_0x8677('0x26')](_0x249107,_0x6d561,!![]);}catch(_0x5c889f){return BPromise['reject'](_0x5c889f);}return _0x249107[_0x8677('0x27')]();};}function saveUpdates(_0x597040,_0x3d6a33){return function(_0x3135d7){if(_0x3135d7){return _0x3135d7[_0x8677('0x28')](_0x597040)[_0x8677('0x29')](function(_0x4c3213){return _0x4c3213;});}return null;};}function removeEntity(_0x350c74,_0x59669a){return function(_0x37e1c8){if(_0x37e1c8){return _0x37e1c8['destroy']()[_0x8677('0x29')](function(){_0x350c74[_0x8677('0x23')](0xcc)[_0x8677('0x1d')]();});}};}function handleEntityNotFound(_0x34a8b8,_0x1c7d31){return function(_0x10286e){if(!_0x10286e){_0x34a8b8[_0x8677('0x1c')](0x194);}return _0x10286e;};}function handleError(_0x5c76d7,_0x87d8ef){_0x87d8ef=_0x87d8ef||0x1f4;return function(_0x554e04){logger[_0x8677('0x2a')](_0x554e04[_0x8677('0x2b')]);if(_0x554e04[_0x8677('0x2c')]){delete _0x554e04[_0x8677('0x2c')];}_0x5c76d7[_0x8677('0x23')](_0x87d8ef)[_0x8677('0x2d')](_0x554e04);};}exports[_0x8677('0x2e')]=function(_0x476081,_0xe53924){var _0x7ba6ec={},_0x17f45f={},_0x344ad0={'count':0x0,'rows':[]};var _0x1a79d9=_[_0x8677('0x2f')](db[_0x8677('0x30')][_0x8677('0x31')],function(_0x207b7d){return{'name':_0x207b7d[_0x8677('0x32')],'type':_0x207b7d[_0x8677('0x33')][_0x8677('0x34')]};});_0x17f45f['model']=_[_0x8677('0x2f')](_0x1a79d9,_0x8677('0x2c'));_0x17f45f[_0x8677('0x35')]=_[_0x8677('0x36')](_0x476081['query']);_0x17f45f['filters']=_[_0x8677('0x37')](_0x17f45f[_0x8677('0x38')],_0x17f45f[_0x8677('0x35')]);_0x7ba6ec[_0x8677('0x39')]=_['intersection'](_0x17f45f[_0x8677('0x38')],qs[_0x8677('0x3a')](_0x476081[_0x8677('0x35')][_0x8677('0x3a')]));_0x7ba6ec[_0x8677('0x39')]=_0x7ba6ec[_0x8677('0x39')][_0x8677('0x3b')]?_0x7ba6ec['attributes']:_0x17f45f[_0x8677('0x38')];if(!_0x476081['query']['hasOwnProperty'](_0x8677('0x3c'))){_0x7ba6ec[_0x8677('0x21')]=qs[_0x8677('0x21')](_0x476081[_0x8677('0x35')][_0x8677('0x21')]);_0x7ba6ec[_0x8677('0x1f')]=qs[_0x8677('0x1f')](_0x476081[_0x8677('0x35')][_0x8677('0x1f')]);}_0x7ba6ec[_0x8677('0x3d')]=qs['sort'](_0x476081[_0x8677('0x35')][_0x8677('0x3e')]);_0x7ba6ec[_0x8677('0x3f')]=qs[_0x8677('0x40')](_[_0x8677('0x41')](_0x476081[_0x8677('0x35')],_0x17f45f[_0x8677('0x40')]),_0x1a79d9);if(_0x476081[_0x8677('0x35')][_0x8677('0x42')]){_0x7ba6ec[_0x8677('0x3f')]=_[_0x8677('0x43')](_0x7ba6ec['where'],{'$or':_[_0x8677('0x2f')](_0x1a79d9,function(_0x6de63f){if(_0x6de63f['type']!==_0x8677('0x44')){var _0x343ee9={};_0x343ee9[_0x6de63f[_0x8677('0x2c')]]={'$like':'%'+_0x476081[_0x8677('0x35')]['filter']+'%'};return _0x343ee9;}})});}_0x7ba6ec=_[_0x8677('0x43')]({},_0x7ba6ec,_0x476081['options']);var _0x3fb4b4={'where':_0x7ba6ec['where']};return db['ChatTransferReport'][_0x8677('0x22')](_0x3fb4b4)[_0x8677('0x29')](function(_0xfc19da){_0x344ad0[_0x8677('0x22')]=_0xfc19da;if(_0x476081[_0x8677('0x35')][_0x8677('0x45')]){_0x7ba6ec['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x8677('0x46')](_0x7ba6ec);})[_0x8677('0x29')](function(_0x3cb049){_0x344ad0[_0x8677('0x47')]=_0x3cb049;return _0x344ad0;})[_0x8677('0x29')](respondWithFilteredResult(_0xe53924,_0x7ba6ec))[_0x8677('0x48')](handleError(_0xe53924,null));};exports[_0x8677('0x49')]=function(_0x135f3f,_0x3842d9){var _0x4d0013={'raw':!![],'where':{'id':_0x135f3f[_0x8677('0x4a')]['id']}},_0x1725dc={};_0x1725dc['model']=_[_0x8677('0x36')](db[_0x8677('0x30')][_0x8677('0x31')]);_0x1725dc[_0x8677('0x35')]=_[_0x8677('0x36')](_0x135f3f[_0x8677('0x35')]);_0x1725dc[_0x8677('0x40')]=_[_0x8677('0x37')](_0x1725dc[_0x8677('0x38')],_0x1725dc[_0x8677('0x35')]);_0x4d0013[_0x8677('0x39')]=_[_0x8677('0x37')](_0x1725dc[_0x8677('0x38')],qs[_0x8677('0x3a')](_0x135f3f['query'][_0x8677('0x3a')]));_0x4d0013[_0x8677('0x39')]=_0x4d0013[_0x8677('0x39')][_0x8677('0x3b')]?_0x4d0013[_0x8677('0x39')]:_0x1725dc[_0x8677('0x38')];if(_0x135f3f[_0x8677('0x35')]['includeAll']){_0x4d0013['include']=[{'all':!![]}];}_0x4d0013=_[_0x8677('0x43')]({},_0x4d0013,_0x135f3f['options']);return db[_0x8677('0x30')][_0x8677('0x4b')](_0x4d0013)[_0x8677('0x29')](handleEntityNotFound(_0x3842d9,null))[_0x8677('0x29')](respondWithResult(_0x3842d9,null))[_0x8677('0x48')](handleError(_0x3842d9,null));};exports['create']=function(_0x1d5155,_0x3f6f84){return db[_0x8677('0x30')]['create'](_0x1d5155['body'],{})[_0x8677('0x29')](respondWithResult(_0x3f6f84,0xc9))[_0x8677('0x48')](handleError(_0x3f6f84,null));};exports[_0x8677('0x28')]=function(_0x4cb913,_0x5be3ea){if(_0x4cb913[_0x8677('0x4c')]['id']){delete _0x4cb913['body']['id'];}return db[_0x8677('0x30')][_0x8677('0x4b')]({'where':{'id':_0x4cb913[_0x8677('0x4a')]['id']}})[_0x8677('0x29')](handleEntityNotFound(_0x5be3ea,null))[_0x8677('0x29')](saveUpdates(_0x4cb913[_0x8677('0x4c')],null))[_0x8677('0x29')](respondWithResult(_0x5be3ea,null))[_0x8677('0x48')](handleError(_0x5be3ea,null));};exports['destroy']=function(_0x20280e,_0x926245){return db[_0x8677('0x30')][_0x8677('0x4b')]({'where':{'id':_0x20280e[_0x8677('0x4a')]['id']}})['then'](handleEntityNotFound(_0x926245,null))[_0x8677('0x29')](removeEntity(_0x926245,null))[_0x8677('0x48')](handleError(_0x926245,null));};exports['describe']=function(_0x5106bd,_0xf5da31){return db[_0x8677('0x30')][_0x8677('0x4d')]()['then'](respondWithResult(_0xf5da31,null))[_0x8677('0x48')](handleError(_0xf5da31,null));}; \ No newline at end of file +var _0x699a=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','update','then','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3c594c,_0x50a59f){var _0xd6a3f1=function(_0x4a3bfc){while(--_0x4a3bfc){_0x3c594c['push'](_0x3c594c['shift']());}};_0xd6a3f1(++_0x50a59f);}(_0x699a,0x175));var _0xa699=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0x699a[_0x53c4f8];return _0x416458;};'use strict';var emlformat=require(_0xa699('0x0'));var rimraf=require(_0xa699('0x1'));var zipdir=require(_0xa699('0x2'));var jsonpatch=require(_0xa699('0x3'));var rp=require(_0xa699('0x4'));var moment=require(_0xa699('0x5'));var BPromise=require(_0xa699('0x6'));var Mustache=require(_0xa699('0x7'));var util=require('util');var path=require(_0xa699('0x8'));var sox=require(_0xa699('0x9'));var csv=require(_0xa699('0xa'));var ejs=require(_0xa699('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa699('0xc'));var crypto=require(_0xa699('0xd'));var jsforce=require(_0xa699('0xe'));var deskjs=require(_0xa699('0xf'));var toCsv=require(_0xa699('0xa'));var querystring=require(_0xa699('0x10'));var Papa=require(_0xa699('0x11'));var Redis=require(_0xa699('0x12'));var authService=require(_0xa699('0x13'));var qs=require(_0xa699('0x14'));var as=require(_0xa699('0x15'));var hardwareService=require(_0xa699('0x16'));var logger=require(_0xa699('0x17'))(_0xa699('0x18'));var utils=require('../../config/utils');var config=require(_0xa699('0x19'));var licenseUtil=require(_0xa699('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ba8e4,_0x37e793){_0x37e793=_0x37e793||0xcc;return function(_0x128358){if(_0x128358){return _0x2ba8e4[_0xa699('0x1b')](_0x37e793);}return _0x2ba8e4[_0xa699('0x1c')](_0x37e793)['end']();};}function respondWithResult(_0x1b81b4,_0x1eab00){_0x1eab00=_0x1eab00||0xc8;return function(_0x486452){if(_0x486452){return _0x1b81b4['status'](_0x1eab00)[_0xa699('0x1d')](_0x486452);}};}function respondWithFilteredResult(_0x300427,_0x45f586){return function(_0x3b16b1){if(_0x3b16b1){var _0x44925f=typeof _0x45f586['offset']===_0xa699('0x1e')&&typeof _0x45f586['limit']==='undefined';var _0xd021f8=_0x3b16b1[_0xa699('0x1f')];var _0x41a9fa=_0x44925f?0x0:_0x45f586['offset'];var _0x2aa3a4=_0x44925f?_0x3b16b1[_0xa699('0x1f')]:_0x45f586[_0xa699('0x20')]+_0x45f586[_0xa699('0x21')];var _0x3f1aac;if(_0x2aa3a4>=_0xd021f8){_0x2aa3a4=_0xd021f8;_0x3f1aac=0xc8;}else{_0x3f1aac=0xce;}_0x300427['status'](_0x3f1aac);return _0x300427[_0xa699('0x22')]('Content-Range',_0x41a9fa+'-'+_0x2aa3a4+'/'+_0xd021f8)[_0xa699('0x1d')](_0x3b16b1);}return null;};}function patchUpdates(_0x2d78aa){return function(_0x2da020){try{jsonpatch[_0xa699('0x23')](_0x2da020,_0x2d78aa,!![]);}catch(_0x41b157){return BPromise[_0xa699('0x24')](_0x41b157);}return _0x2da020['save']();};}function saveUpdates(_0x2c48ed,_0x281031){return function(_0x2992f2){if(_0x2992f2){return _0x2992f2[_0xa699('0x25')](_0x2c48ed)['then'](function(_0x2ee66d){return _0x2ee66d;});}return null;};}function removeEntity(_0x1ea04d,_0x44928d){return function(_0x37f555){if(_0x37f555){return _0x37f555['destroy']()[_0xa699('0x26')](function(){_0x1ea04d[_0xa699('0x1c')](0xcc)[_0xa699('0x27')]();});}};}function handleEntityNotFound(_0x1594f9,_0x1591b4){return function(_0xff2354){if(!_0xff2354){_0x1594f9[_0xa699('0x1b')](0x194);}return _0xff2354;};}function handleError(_0x246224,_0x3c6fa9){_0x3c6fa9=_0x3c6fa9||0x1f4;return function(_0x13d5f3){logger[_0xa699('0x28')](_0x13d5f3[_0xa699('0x29')]);if(_0x13d5f3[_0xa699('0x2a')]){delete _0x13d5f3[_0xa699('0x2a')];}_0x246224['status'](_0x3c6fa9)[_0xa699('0x2b')](_0x13d5f3);};}exports[_0xa699('0x2c')]=function(_0xd9682f,_0x538a82){var _0x5bd985={},_0x344051={},_0x432787={'count':0x0,'rows':[]};var _0x4a1064=_[_0xa699('0x2d')](db[_0xa699('0x2e')][_0xa699('0x2f')],function(_0x333bf7){return{'name':_0x333bf7[_0xa699('0x30')],'type':_0x333bf7[_0xa699('0x31')][_0xa699('0x32')]};});_0x344051['model']=_['map'](_0x4a1064,_0xa699('0x2a'));_0x344051[_0xa699('0x33')]=_[_0xa699('0x34')](_0xd9682f[_0xa699('0x33')]);_0x344051[_0xa699('0x35')]=_[_0xa699('0x36')](_0x344051[_0xa699('0x37')],_0x344051['query']);_0x5bd985[_0xa699('0x38')]=_[_0xa699('0x36')](_0x344051[_0xa699('0x37')],qs['fields'](_0xd9682f['query'][_0xa699('0x39')]));_0x5bd985['attributes']=_0x5bd985[_0xa699('0x38')][_0xa699('0x3a')]?_0x5bd985['attributes']:_0x344051[_0xa699('0x37')];if(!_0xd9682f[_0xa699('0x33')]['hasOwnProperty'](_0xa699('0x3b'))){_0x5bd985['limit']=qs[_0xa699('0x21')](_0xd9682f[_0xa699('0x33')][_0xa699('0x21')]);_0x5bd985['offset']=qs['offset'](_0xd9682f[_0xa699('0x33')][_0xa699('0x20')]);}_0x5bd985[_0xa699('0x3c')]=qs[_0xa699('0x3d')](_0xd9682f[_0xa699('0x33')]['sort']);_0x5bd985[_0xa699('0x3e')]=qs[_0xa699('0x35')](_['pick'](_0xd9682f[_0xa699('0x33')],_0x344051[_0xa699('0x35')]),_0x4a1064);if(_0xd9682f[_0xa699('0x33')][_0xa699('0x3f')]){_0x5bd985[_0xa699('0x3e')]=_['merge'](_0x5bd985[_0xa699('0x3e')],{'$or':_[_0xa699('0x2d')](_0x4a1064,function(_0x556874){if(_0x556874[_0xa699('0x31')]!==_0xa699('0x40')){var _0x30a22c={};_0x30a22c[_0x556874[_0xa699('0x2a')]]={'$like':'%'+_0xd9682f[_0xa699('0x33')][_0xa699('0x3f')]+'%'};return _0x30a22c;}})});}_0x5bd985=_[_0xa699('0x41')]({},_0x5bd985,_0xd9682f[_0xa699('0x42')]);var _0x37645e={'where':_0x5bd985[_0xa699('0x3e')]};return db[_0xa699('0x2e')]['count'](_0x37645e)['then'](function(_0x44c26f){_0x432787[_0xa699('0x1f')]=_0x44c26f;if(_0xd9682f[_0xa699('0x33')][_0xa699('0x43')]){_0x5bd985['include']=[{'all':!![]}];}return db[_0xa699('0x2e')][_0xa699('0x44')](_0x5bd985);})[_0xa699('0x26')](function(_0x5b69cb){_0x432787[_0xa699('0x45')]=_0x5b69cb;return _0x432787;})[_0xa699('0x26')](respondWithFilteredResult(_0x538a82,_0x5bd985))[_0xa699('0x46')](handleError(_0x538a82,null));};exports[_0xa699('0x47')]=function(_0x1cbffe,_0x26e24a){var _0x20d8dd={'raw':!![],'where':{'id':_0x1cbffe[_0xa699('0x48')]['id']}},_0x5b5349={};_0x5b5349[_0xa699('0x37')]=_[_0xa699('0x34')](db[_0xa699('0x2e')][_0xa699('0x2f')]);_0x5b5349[_0xa699('0x33')]=_[_0xa699('0x34')](_0x1cbffe[_0xa699('0x33')]);_0x5b5349[_0xa699('0x35')]=_[_0xa699('0x36')](_0x5b5349[_0xa699('0x37')],_0x5b5349[_0xa699('0x33')]);_0x20d8dd[_0xa699('0x38')]=_[_0xa699('0x36')](_0x5b5349[_0xa699('0x37')],qs[_0xa699('0x39')](_0x1cbffe[_0xa699('0x33')][_0xa699('0x39')]));_0x20d8dd[_0xa699('0x38')]=_0x20d8dd[_0xa699('0x38')][_0xa699('0x3a')]?_0x20d8dd[_0xa699('0x38')]:_0x5b5349[_0xa699('0x37')];if(_0x1cbffe[_0xa699('0x33')]['includeAll']){_0x20d8dd[_0xa699('0x49')]=[{'all':!![]}];}_0x20d8dd=_[_0xa699('0x41')]({},_0x20d8dd,_0x1cbffe[_0xa699('0x42')]);return db[_0xa699('0x2e')][_0xa699('0x4a')](_0x20d8dd)[_0xa699('0x26')](handleEntityNotFound(_0x26e24a,null))[_0xa699('0x26')](respondWithResult(_0x26e24a,null))[_0xa699('0x46')](handleError(_0x26e24a,null));};exports[_0xa699('0x4b')]=function(_0x2c6346,_0x35bfb2){return db[_0xa699('0x2e')][_0xa699('0x4b')](_0x2c6346[_0xa699('0x4c')],{})[_0xa699('0x26')](respondWithResult(_0x35bfb2,0xc9))['catch'](handleError(_0x35bfb2,null));};exports[_0xa699('0x25')]=function(_0x4de637,_0x4213c7){if(_0x4de637[_0xa699('0x4c')]['id']){delete _0x4de637['body']['id'];}return db[_0xa699('0x2e')][_0xa699('0x4a')]({'where':{'id':_0x4de637[_0xa699('0x48')]['id']}})[_0xa699('0x26')](handleEntityNotFound(_0x4213c7,null))[_0xa699('0x26')](saveUpdates(_0x4de637[_0xa699('0x4c')],null))[_0xa699('0x26')](respondWithResult(_0x4213c7,null))[_0xa699('0x46')](handleError(_0x4213c7,null));};exports[_0xa699('0x4d')]=function(_0x306ba4,_0x5d2041){return db['ChatTransferReport'][_0xa699('0x4a')]({'where':{'id':_0x306ba4[_0xa699('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d2041,null))[_0xa699('0x26')](removeEntity(_0x5d2041,null))['catch'](handleError(_0x5d2041,null));};exports['describe']=function(_0x53278c,_0x26f03b){return db[_0xa699('0x2e')][_0xa699('0x4e')]()[_0xa699('0x26')](respondWithResult(_0x26f03b,null))[_0xa699('0x46')](handleError(_0x26f03b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 852b60d..56af486 100644 --- a/server/api/chatTransferReport/chatTransferReport.model.js +++ b/server/api/chatTransferReport/chatTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc09=['exports','define','ChatTransferReport','report_chat_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2d09cf,_0x3e5d70){var _0x5858a2=function(_0x12f92f){while(--_0x12f92f){_0x2d09cf['push'](_0x2d09cf['shift']());}};_0x5858a2(++_0x3e5d70);}(_0xfc09,0xe8));var _0x9fc0=function(_0x45cd35,_0x41147c){_0x45cd35=_0x45cd35-0x0;var _0x16db84=_0xfc09[_0x45cd35];return _0x16db84;};'use strict';var _=require(_0x9fc0('0x0'));var util=require(_0x9fc0('0x1'));var logger=require(_0x9fc0('0x2'))(_0x9fc0('0x3'));var moment=require(_0x9fc0('0x4'));var BPromise=require(_0x9fc0('0x5'));var rp=require(_0x9fc0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fc0('0x7'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0x9fc0('0x8')]=function(_0x485bb7,_0x3a353a){return _0x485bb7[_0x9fc0('0x9')](_0x9fc0('0xa'),attributes,{'tableName':_0x9fc0('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x133f=['../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x3984ba,_0x2ee57f){var _0x2b06be=function(_0x39929e){while(--_0x39929e){_0x3984ba['push'](_0x3984ba['shift']());}};_0x2b06be(++_0x2ee57f);}(_0x133f,0xbc));var _0xf133=function(_0x11cd72,_0x37d3ac){_0x11cd72=_0x11cd72-0x0;var _0x4b6f60=_0x133f[_0x11cd72];return _0x4b6f60;};'use strict';var _=require(_0xf133('0x0'));var util=require(_0xf133('0x1'));var logger=require('../../config/logger')(_0xf133('0x2'));var moment=require(_0xf133('0x3'));var BPromise=require(_0xf133('0x4'));var rp=require(_0xf133('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf133('0x6'));var config=require(_0xf133('0x7'));var attributes=require(_0xf133('0x8'));module[_0xf133('0x9')]=function(_0x4cbd1f,_0x56e809){return _0x4cbd1f[_0xf133('0xa')](_0xf133('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf133('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 249286a..a3bbce7 100644 --- a/server/api/chatTransferReport/chatTransferReport.rpc.js +++ b/server/api/chatTransferReport/chatTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x589d=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring'];(function(_0xc30967,_0x49dff1){var _0x119388=function(_0x57ed77){while(--_0x57ed77){_0xc30967['push'](_0xc30967['shift']());}};_0x119388(++_0x49dff1);}(_0x589d,0x164));var _0xd589=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x589d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd589('0x0'));var util=require(_0xd589('0x1'));var moment=require(_0xd589('0x2'));var BPromise=require('bluebird');var rs=require(_0xd589('0x3'));var fs=require('fs');var Redis=require(_0xd589('0x4'));var db=require(_0xd589('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd589('0x6'))(_0xd589('0x7'));var config=require(_0xd589('0x8'));var jayson=require(_0xd589('0x9'));var client=jayson[_0xd589('0xa')][_0xd589('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e7e69,_0x4d5873,_0x3d4383){return new BPromise(function(_0x235761,_0xa4dbeb){return client[_0xd589('0xc')](_0x4e7e69,_0x3d4383)[_0xd589('0xd')](function(_0x58fd25){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x4d5873,_0xd589('0xe'));logger[_0xd589('0xf')](_0xd589('0x10'),_0x4d5873,'request\x20sent',JSON[_0xd589('0x11')](_0x58fd25));if(_0x58fd25[_0xd589('0x12')]){if(_0x58fd25[_0xd589('0x12')][_0xd589('0x13')]===0x1f4){logger[_0xd589('0x12')](_0xd589('0x14'),_0x4d5873,_0x58fd25[_0xd589('0x12')][_0xd589('0x15')]);return _0xa4dbeb(_0x58fd25['error'][_0xd589('0x15')]);}logger[_0xd589('0x12')](_0xd589('0x14'),_0x4d5873,_0x58fd25[_0xd589('0x12')][_0xd589('0x15')]);return _0x235761(_0x58fd25[_0xd589('0x12')][_0xd589('0x15')]);}else{logger[_0xd589('0x16')](_0xd589('0x14'),_0x4d5873,_0xd589('0xe'));_0x235761(_0x58fd25['result'][_0xd589('0x15')]);}})[_0xd589('0x17')](function(_0x23f00b){logger[_0xd589('0x12')](_0xd589('0x14'),_0x4d5873,_0x23f00b);_0xa4dbeb(_0x23f00b);});});} \ No newline at end of file +var _0x2c26=['request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x7df626,_0x500898){var _0x7db49d=function(_0x2f20af){while(--_0x2f20af){_0x7df626['push'](_0x7df626['shift']());}};_0x7db49d(++_0x500898);}(_0x2c26,0x1eb));var _0x62c2=function(_0x28d2ce,_0x2cabab){_0x28d2ce=_0x28d2ce-0x0;var _0x58c109=_0x2c26[_0x28d2ce];return _0x58c109;};'use strict';var _=require(_0x62c2('0x0'));var util=require(_0x62c2('0x1'));var moment=require(_0x62c2('0x2'));var BPromise=require(_0x62c2('0x3'));var rs=require(_0x62c2('0x4'));var fs=require('fs');var Redis=require(_0x62c2('0x5'));var db=require(_0x62c2('0x6'))['db'];var utils=require(_0x62c2('0x7'));var logger=require(_0x62c2('0x8'))('rpc');var config=require(_0x62c2('0x9'));var jayson=require(_0x62c2('0xa'));var client=jayson[_0x62c2('0xb')][_0x62c2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4bd9fb,_0x106edc,_0x3edc36){return new BPromise(function(_0x3d4aad,_0x5abd6f){return client[_0x62c2('0xd')](_0x4bd9fb,_0x3edc36)[_0x62c2('0xe')](function(_0xc68626){logger[_0x62c2('0xf')](_0x62c2('0x10'),_0x106edc,_0x62c2('0x11'));logger[_0x62c2('0x12')](_0x62c2('0x13'),_0x106edc,_0x62c2('0x11'),JSON['stringify'](_0xc68626));if(_0xc68626[_0x62c2('0x14')]){if(_0xc68626[_0x62c2('0x14')][_0x62c2('0x15')]===0x1f4){logger['error'](_0x62c2('0x10'),_0x106edc,_0xc68626[_0x62c2('0x14')]['message']);return _0x5abd6f(_0xc68626['error'][_0x62c2('0x16')]);}logger[_0x62c2('0x14')](_0x62c2('0x10'),_0x106edc,_0xc68626[_0x62c2('0x14')][_0x62c2('0x16')]);return _0x3d4aad(_0xc68626['error'][_0x62c2('0x16')]);}else{logger[_0x62c2('0xf')](_0x62c2('0x10'),_0x106edc,_0x62c2('0x11'));_0x3d4aad(_0xc68626['result']['message']);}})[_0x62c2('0x17')](function(_0x106aea){logger[_0x62c2('0x14')](_0x62c2('0x10'),_0x106edc,_0x106aea);_0x5abd6f(_0x106aea);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1a9ef64..7db1a69 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38ce=['describe','/:id','isAuthenticated','show','post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe'];(function(_0xa6fe45,_0x17815f){var _0xf208da=function(_0x46d830){while(--_0x46d830){_0xa6fe45['push'](_0xa6fe45['shift']());}};_0xf208da(++_0x17815f);}(_0x38ce,0xe5));var _0xe38c=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x38ce[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0xe38c('0x0'));var util=require(_0xe38c('0x1'));var path=require(_0xe38c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe38c('0x3'));var router=express[_0xe38c('0x4')]();var fs_extra=require(_0xe38c('0x5'));var auth=require(_0xe38c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe38c('0x7'));var controller=require(_0xe38c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe38c('0x9')](_0xe38c('0xa'),auth['isAuthenticated'](),controller[_0xe38c('0xb')]);router[_0xe38c('0x9')](_0xe38c('0xc'),auth[_0xe38c('0xd')](),controller[_0xe38c('0xe')]);router[_0xe38c('0xf')]('/',auth[_0xe38c('0xd')](),controller[_0xe38c('0x10')]);router[_0xe38c('0x11')]('/:id',auth[_0xe38c('0xd')](),controller[_0xe38c('0x12')]);router[_0xe38c('0x13')](_0xe38c('0xc'),auth[_0xe38c('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb08e=['express','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4a9efd,_0x73947c){var _0x45f2c5=function(_0x2daeb1){while(--_0x2daeb1){_0x4a9efd['push'](_0x4a9efd['shift']());}};_0x45f2c5(++_0x73947c);}(_0xb08e,0x15d));var _0xeb08=function(_0x50acce,_0x6d880b){_0x50acce=_0x50acce-0x0;var _0xf40c85=_0xb08e[_0x50acce];return _0xf40c85;};'use strict';var multer=require(_0xeb08('0x0'));var util=require(_0xeb08('0x1'));var path=require('path');var timeout=require(_0xeb08('0x2'));var express=require(_0xeb08('0x3'));var router=express['Router']();var fs_extra=require(_0xeb08('0x4'));var auth=require(_0xeb08('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeb08('0x6'));var controller=require(_0xeb08('0x7'));router[_0xeb08('0x8')]('/',auth['isAuthenticated'](),controller[_0xeb08('0x9')]);router[_0xeb08('0x8')](_0xeb08('0xa'),auth[_0xeb08('0xb')](),controller[_0xeb08('0xc')]);router[_0xeb08('0x8')](_0xeb08('0xd'),auth[_0xeb08('0xb')](),controller[_0xeb08('0xe')]);router[_0xeb08('0xf')]('/',auth[_0xeb08('0xb')](),controller[_0xeb08('0x10')]);router[_0xeb08('0x11')]('/:id',auth[_0xeb08('0xb')](),controller[_0xeb08('0x12')]);router[_0xeb08('0x13')](_0xeb08('0xd'),auth[_0xeb08('0xb')](),controller[_0xeb08('0x14')]);module[_0xeb08('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 9f91bf3..bf8a7bc 100644 --- a/server/api/chatWebsite/chatWebsite.attributes.js +++ b/server/api/chatWebsite/chatWebsite.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55e0=['CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right'];(function(_0x501078,_0x5bb1e9){var _0x18eaac=function(_0x496e1c){while(--_0x496e1c){_0x501078['push'](_0x501078['shift']());}};_0x18eaac(++_0x5bb1e9);}(_0x55e0,0xdc));var _0x055e=function(_0x508338,_0xcf1f4d){_0x508338=_0x508338-0x0;var _0x1ccd1b=_0x55e0[_0x508338];return _0x1ccd1b;};'use strict';var Sequelize=require(_0x055e('0x0'));var rs=require(_0x055e('0x1'));module[_0x055e('0x2')]={'name':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x055e('0x3')]},'mapKey':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'mapKeyOffline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'key':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x055e('0x3')]},'animation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x055e('0x9')]('rounded','squared'),'defaultValue':_0x055e('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0xb')},'start_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xc')},'offline_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'header_offline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x055e('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x13')},'noteTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x14')},'placeholderMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x16')},'closingMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'skipMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x17')},'ratingType':{'type':Sequelize[_0x055e('0x9')](_0x055e('0x18'),_0x055e('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON[_0x055e('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x055e('0x1b'),'type':_0x055e('0x1c'),'required':!![]},'props':{'title':_0x055e('0x1b'),'helpText':''}},{'type':_0x055e('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x1f'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')](_0x055e('0x1f'))):{};},'set':function(_0x4c653c){return this['setDataValue'](_0x055e('0x1f'),JSON[_0x055e('0x1a')](_0x4c653c));}},'offlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x055e('0x1d'),'props':{'title':_0x055e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':_0x055e('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x055e('0x21')},'props':{'title':'Comments','helpText':_0x055e('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x23'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')]('offlineForm')):{};},'set':function(_0x99a372){return this[_0x055e('0x24')](_0x055e('0x23'),JSON[_0x055e('0x1a')](_0x99a372));}},'token':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return rs[_0x055e('0x25')]();}},'autoclose':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x055e('0x3')]},'forwardOffline':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x26')},'waitingMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x29')},'sendUnmanaged':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x055e('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x055e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return _0x055e('0x2a');}},'notificationSound':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2c')},'verticalAlignment':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2e')},'defaultTitle':{'type':Sequelize[_0x055e('0x3')]},'customerAvatar':{'type':Sequelize[_0x055e('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x30')},'systemAvatar':{'type':Sequelize[_0x055e('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x055e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1012a4){if(!_0x1012a4)this[_0x055e('0x24')](_0x055e('0x32'),null);this['setDataValue'](_0x055e('0x33'),_0x1012a4);}},'vidaooEscalation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x34')},'vidaooNote':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x055e('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x055e('0x10')]}}; \ No newline at end of file +var _0x91a7=['rounded','squared','We\x20are\x20here!','Send','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','ENUM','star','thumb','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN'];(function(_0x297e28,_0x3b1969){var _0xf97226=function(_0x3ca11f){while(--_0x3ca11f){_0x297e28['push'](_0x297e28['shift']());}};_0xf97226(++_0x3b1969);}(_0x91a7,0xe7));var _0x791a=function(_0x596484,_0x4ab476){_0x596484=_0x596484-0x0;var _0x3d27ec=_0x91a7[_0x596484];return _0x3d27ec;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x791a('0x0'));module[_0x791a('0x1')]={'name':{'type':Sequelize[_0x791a('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x791a('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x4')},'key':{'type':Sequelize[_0x791a('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':_0x791a('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x791a('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':_0x791a('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':_0x791a('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x791a('0x2')]},'animation':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x791a('0x9'),_0x791a('0xa')),'defaultValue':_0x791a('0x9')},'header_online':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0xb')},'start_chat_button':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0xc')},'header_offline':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x791a('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x791a('0xf')]},'closingQuestion':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x13')},'ratingType':{'type':Sequelize[_0x791a('0x14')](_0x791a('0x15'),_0x791a('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x791a('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x791a('0xf')],'defaultValue':function(){return JSON[_0x791a('0x17')]({'items':[{'type':_0x791a('0x18'),'variable':null,'config':{'placeholder':_0x791a('0x19'),'type':_0x791a('0x1a'),'required':!![]},'props':{'title':_0x791a('0x19'),'helpText':''}},{'type':_0x791a('0x18'),'props':{'title':_0x791a('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x791a('0x4'),'type':_0x791a('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x791a('0x1b'))?JSON[_0x791a('0x1c')](this[_0x791a('0x1d')](_0x791a('0x1b'))):{};},'set':function(_0x4d748a){return this[_0x791a('0x1e')](_0x791a('0x1b'),JSON['stringify'](_0x4d748a));}},'offlineForm':{'type':Sequelize[_0x791a('0xf')],'defaultValue':function(){return JSON[_0x791a('0x17')]({'items':[{'type':_0x791a('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x791a('0x4'),'type':_0x791a('0x4')},'variable':null},{'type':_0x791a('0x1f'),'config':{'placeholder':_0x791a('0x20')},'props':{'title':_0x791a('0x20'),'helpText':_0x791a('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x791a('0x1d')](_0x791a('0x22'))?JSON['parse'](this[_0x791a('0x1d')](_0x791a('0x22'))):{};},'set':function(_0x1b10a7){return this['setDataValue'](_0x791a('0x22'),JSON['stringify'](_0x1b10a7));}},'token':{'type':Sequelize[_0x791a('0x2')],'defaultValue':function(){return rs[_0x791a('0x23')]();}},'autoclose':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x791a('0x2')]},'forwardOffline':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x24')},'waitingMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x28')},'sendUnmanaged':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x791a('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x791a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x791a('0x2')]},'customerAvatar':{'type':Sequelize[_0x791a('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x791a('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x791a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x791a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x2b')},'systemAvatar':{'type':Sequelize[_0x791a('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x791a('0xd')],'comment':_0x791a('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x15f066){if(!_0x15f066)this[_0x791a('0x1e')](_0x791a('0x2d'),null);this['setDataValue'](_0x791a('0x2e'),_0x15f066);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x791a('0x2f')},'vidaooNote':{'type':Sequelize[_0x791a('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x791a('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x791a('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index e86618e..98ccc56 100644 --- a/server/api/chatWebsite/chatWebsite.controller.js +++ b/server/api/chatWebsite/chatWebsite.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9872=['first','split','firstName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','lastName','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','files','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','defaults','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','Attachment','MailServerOut','CloudProvider','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','toPairsIn','mapValues','subjectOffline','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','getLicense','virtual','Intervals','all','utf8','remote','connection','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','ChatWebsites','status','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','filters','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','file','agentAvatar','filename','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','custom','sitepic','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','isNil','user-agent-parser','setUA','headers','user-agent','chat','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','asc','CmContact','customerIp','cf-connecting-ip','x-forwarded-for'];(function(_0x3be177,_0x297906){var _0x2e2b49=function(_0x32b2dc){while(--_0x32b2dc){_0x3be177['push'](_0x3be177['shift']());}};_0x2e2b49(++_0x297906);}(_0x9872,0x1bd));var _0x2987=function(_0x5efcf5,_0x5ad4bb){_0x5efcf5=_0x5efcf5-0x0;var _0x3a6882=_0x9872[_0x5efcf5];return _0x3a6882;};'use strict';var BPromise=require(_0x2987('0x0'));var Mustache=require(_0x2987('0x1'));var util=require(_0x2987('0x2'));var path=require(_0x2987('0x3'));var ejs=require(_0x2987('0x4'));var fs=require('fs');var fs_extra=require(_0x2987('0x5'));var _=require(_0x2987('0x6'));var querystring=require('querystring');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x2987('0x7'))(_0x2987('0x8'));var config=require(_0x2987('0x9'));var db=require(_0x2987('0xa'))['db'];config['redis']=_['defaults'](config[_0x2987('0xb')],{'host':_0x2987('0xc'),'port':0x18eb});var socket=require(_0x2987('0xd'))(new Redis(config[_0x2987('0xb')]));require(_0x2987('0xe'))[_0x2987('0xf')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x2987('0x10'));var client=jayson['client'][_0x2987('0x11')]({'port':0x232c});var client9002=jayson[_0x2987('0x12')][_0x2987('0x11')]({'port':0x232a});var client9003=jayson[_0x2987('0x12')]['http']({'port':0x232b});var client9001=jayson[_0x2987('0x12')][_0x2987('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x51aae9,_0xc59752,_0x63a282,_0x57ff0e){return new BPromise(function(_0x57ce05,_0x5c734f){var _0x2366bf=_0x57ff0e||client;return _0x2366bf[_0x2987('0x13')](_0x51aae9,_0x63a282)[_0x2987('0x14')](function(_0x525aaa){logger[_0x2987('0x15')](_0x2987('0x16'),_0xc59752,'request\x20sent');logger[_0x2987('0x17')](_0x2987('0x18'),_0xc59752,_0x2987('0x19'),JSON['stringify'](_0x525aaa));if(_0x525aaa[_0x2987('0x1a')]){if(_0x525aaa[_0x2987('0x1a')][_0x2987('0x1b')]===0x1f4){logger[_0x2987('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0xc59752,_0x525aaa['error'][_0x2987('0x1c')]);return _0x5c734f(_0x525aaa['error'][_0x2987('0x1c')]);}logger[_0x2987('0x1a')](_0x2987('0x16'),_0xc59752,_0x525aaa['error']['message']);return _0x57ce05(_0x525aaa['error'][_0x2987('0x1c')]);}else{logger['info'](_0x2987('0x16'),_0xc59752,'request\x20sent');_0x57ce05(_0x525aaa[_0x2987('0x1d')][_0x2987('0x1c')]);}})[_0x2987('0x1e')](function(_0x1ab287){logger['error'](_0x2987('0x16'),_0xc59752,_0x1ab287);_0x5c734f(_0x1ab287);});});}function respondWithStatusCode(_0x343c80,_0x389ebc){_0x389ebc=_0x389ebc||0xcc;return function(_0x53c523){if(_0x53c523){return _0x343c80[_0x2987('0x1f')](_0x389ebc);}return _0x343c80['status'](_0x389ebc)[_0x2987('0x20')]();};}function respondWithResult(_0x78cbc,_0xf60814){_0xf60814=_0xf60814||0xc8;return function(_0x2c3603){if(_0x2c3603){return _0x78cbc['status'](_0xf60814)[_0x2987('0x21')](_0x2c3603);}};}function respondWithFilteredResult(_0x56d966,_0x1c4782){return function(_0x4b6af4){if(_0x4b6af4){var _0x351e30=typeof _0x1c4782[_0x2987('0x22')]==='undefined'&&typeof _0x1c4782[_0x2987('0x23')]===_0x2987('0x24');var _0x38c98b=_0x4b6af4[_0x2987('0x25')];var _0x12790d=_0x351e30?0x0:_0x1c4782[_0x2987('0x22')];var _0xb8192e=_0x351e30?_0x4b6af4[_0x2987('0x25')]:_0x1c4782[_0x2987('0x22')]+_0x1c4782[_0x2987('0x23')];var _0x172037;if(_0xb8192e>=_0x38c98b){_0xb8192e=_0x38c98b;_0x172037=0xc8;}else{_0x172037=0xce;}_0x56d966['status'](_0x172037);return _0x56d966[_0x2987('0x26')](_0x2987('0x27'),_0x12790d+'-'+_0xb8192e+'/'+_0x38c98b)[_0x2987('0x21')](_0x4b6af4);}return null;};}function saveUpdates(_0x513ab1){return function(_0x572fbf){if(_0x572fbf){return _0x572fbf[_0x2987('0x28')](_0x513ab1)[_0x2987('0x14')](function(_0x179244){return _0x179244;});}return null;};}function removeEntity(_0x2bf6cd){return function(_0x5e9626){if(_0x5e9626){return _0x5e9626[_0x2987('0x29')]()[_0x2987('0x14')](function(){var _0x42f8d7=_0x5e9626[_0x2987('0x2a')]({'plain':!![]});var _0x19acb1=_0x2987('0x2b');return db['UserProfileResource'][_0x2987('0x29')]({'where':{'type':_0x19acb1,'resourceId':_0x42f8d7['id']}})[_0x2987('0x14')](function(){return _0x5e9626;});})[_0x2987('0x14')](function(){_0x2bf6cd[_0x2987('0x2c')](0xcc)[_0x2987('0x20')]();});}};}function handleEntityNotFound(_0x13e1ca){return function(_0x3a02cf){if(!_0x3a02cf){_0x13e1ca[_0x2987('0x1f')](0x194);}return _0x3a02cf;};}function handleError(_0xd8fd6b,_0x8b7292){_0x8b7292=_0x8b7292||0x1f4;return function(_0x45e342){logger[_0x2987('0x1a')](_0x45e342['stack']);if(_0x45e342[_0x2987('0x2d')]){delete _0x45e342[_0x2987('0x2d')];}_0xd8fd6b[_0x2987('0x2c')](_0x8b7292)[_0x2987('0x2e')](_0x45e342);};}exports[_0x2987('0x2f')]=function(_0x6cccd5,_0x353cf9){var _0x2dee1c={'include':[{'model':db[_0x2987('0x30')],'as':_0x2987('0x31')}]},_0xd09d89={},_0x10e4c0={'count':0x0,'rows':[]};var _0x15a8c5=_[_0x2987('0x32')](db[_0x2987('0x33')][_0x2987('0x34')],function(_0x190750){return{'name':_0x190750[_0x2987('0x35')],'type':_0x190750['type'][_0x2987('0x36')]};});_0xd09d89[_0x2987('0x37')]=_[_0x2987('0x32')](_0x15a8c5,_0x2987('0x2d'));_0xd09d89[_0x2987('0x38')]=_[_0x2987('0x39')](_0x6cccd5[_0x2987('0x38')]);_0xd09d89['filters']=_[_0x2987('0x3a')](_0xd09d89['model'],_0xd09d89[_0x2987('0x38')]);_0x2dee1c[_0x2987('0x3b')]=_[_0x2987('0x3a')](_0xd09d89[_0x2987('0x37')],qs[_0x2987('0x3c')](_0x6cccd5[_0x2987('0x38')][_0x2987('0x3c')]));_0x2dee1c[_0x2987('0x3b')]=_0x2dee1c[_0x2987('0x3b')][_0x2987('0x3d')]?_0x2dee1c[_0x2987('0x3b')]:_0xd09d89['model'];if(!_0x6cccd5[_0x2987('0x38')][_0x2987('0x3e')](_0x2987('0x3f'))){_0x2dee1c['limit']=qs[_0x2987('0x23')](_0x6cccd5[_0x2987('0x38')][_0x2987('0x23')]);_0x2dee1c[_0x2987('0x22')]=qs[_0x2987('0x22')](_0x6cccd5['query'][_0x2987('0x22')]);}_0x2dee1c['order']=qs[_0x2987('0x40')](_0x6cccd5[_0x2987('0x38')][_0x2987('0x40')]);_0x2dee1c[_0x2987('0x41')]=qs['filters'](_[_0x2987('0x42')](_0x6cccd5[_0x2987('0x38')],_0xd09d89['filters']),_0x15a8c5);if(_0x6cccd5['query'][_0x2987('0x43')]){_0x2dee1c['where']=_['merge'](_0x2dee1c[_0x2987('0x41')],{'$or':_['map'](_0x15a8c5,function(_0x8bac7d){if(_0x8bac7d[_0x2987('0x44')]!==_0x2987('0x45')){var _0x25f733={};_0x25f733[_0x8bac7d[_0x2987('0x2d')]]={'$like':'%'+_0x6cccd5[_0x2987('0x38')][_0x2987('0x43')]+'%'};return _0x25f733;}})});}_0x2dee1c=_[_0x2987('0x46')]({},_0x2dee1c,_0x6cccd5[_0x2987('0x47')]);var _0x52ddfe={'where':_0x2dee1c[_0x2987('0x41')]};return db[_0x2987('0x33')][_0x2987('0x25')](_0x52ddfe)[_0x2987('0x14')](function(_0x1eef55){_0x10e4c0[_0x2987('0x25')]=_0x1eef55;if(_0x6cccd5[_0x2987('0x38')][_0x2987('0x48')]){_0x2dee1c['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x2987('0x49')](_0x2dee1c);})[_0x2987('0x14')](function(_0x20f2ba){_0x10e4c0[_0x2987('0x4a')]=_0x20f2ba;return _0x10e4c0;})[_0x2987('0x14')](respondWithFilteredResult(_0x353cf9,_0x2dee1c))[_0x2987('0x1e')](handleError(_0x353cf9,null));};exports[_0x2987('0x4b')]=function(_0x120f60,_0x575f47){var _0x53a9da={'raw':![],'where':{'id':_0x120f60[_0x2987('0x4c')]['id']},'include':[{'model':db['Pause'],'as':_0x2987('0x31')}]},_0x484a69={};_0x484a69[_0x2987('0x37')]=_[_0x2987('0x39')](db['ChatWebsite'][_0x2987('0x34')]);_0x484a69[_0x2987('0x38')]=_[_0x2987('0x39')](_0x120f60[_0x2987('0x38')]);_0x484a69[_0x2987('0x4d')]=_['intersection'](_0x484a69[_0x2987('0x37')],_0x484a69[_0x2987('0x38')]);_0x53a9da[_0x2987('0x3b')]=_[_0x2987('0x3a')](_0x484a69[_0x2987('0x37')],qs['fields'](_0x120f60[_0x2987('0x38')][_0x2987('0x3c')]));_0x53a9da[_0x2987('0x3b')]=_0x53a9da[_0x2987('0x3b')][_0x2987('0x3d')]?_0x53a9da[_0x2987('0x3b')]:_0x484a69['model'];if(_0x120f60[_0x2987('0x38')][_0x2987('0x48')]){_0x53a9da[_0x2987('0x4e')]=[{'all':!![]}];}_0x53a9da=_[_0x2987('0x46')]({},_0x53a9da,_0x120f60['options']);return db[_0x2987('0x33')][_0x2987('0x4f')](_0x53a9da)[_0x2987('0x14')](handleEntityNotFound(_0x575f47,null))['then'](respondWithResult(_0x575f47,null))['catch'](handleError(_0x575f47,null));};exports[_0x2987('0x50')]=function(_0x270ca9,_0x366ec0){return db[_0x2987('0x33')][_0x2987('0x50')](_0x270ca9['body'],{})[_0x2987('0x14')](function(_0x325e60){var _0x154737=_0x270ca9[_0x2987('0x51')][_0x2987('0x2a')]({'plain':!![]});if(!_0x154737)throw new Error(_0x2987('0x52'));if(_0x154737[_0x2987('0x53')]===_0x2987('0x51')){var _0xda75ca=_0x325e60[_0x2987('0x2a')]({'plain':!![]});var _0x5f1014=_0x2987('0x2b');return db[_0x2987('0x54')][_0x2987('0x4f')]({'where':{'name':_0x5f1014,'userProfileId':_0x154737['userProfileId']},'raw':!![]})['then'](function(_0x9ae95){if(_0x9ae95&&_0x9ae95[_0x2987('0x55')]===0x0){return db[_0x2987('0x56')][_0x2987('0x50')]({'name':_0xda75ca[_0x2987('0x2d')],'resourceId':_0xda75ca['id'],'type':_0x9ae95[_0x2987('0x2d')],'sectionId':_0x9ae95['id']},{})[_0x2987('0x14')](function(){return _0x325e60;});}else{return _0x325e60;}})[_0x2987('0x1e')](function(_0x18899e){logger[_0x2987('0x1a')](_0x2987('0x57'),_0x18899e);throw _0x18899e;});}return _0x325e60;})[_0x2987('0x14')](respondWithResult(_0x366ec0,0xc9))[_0x2987('0x1e')](handleError(_0x366ec0,null));};exports[_0x2987('0x28')]=function(_0x493792,_0x14c17a){if(_0x493792[_0x2987('0x58')]['id']){delete _0x493792[_0x2987('0x58')]['id'];}return db[_0x2987('0x33')][_0x2987('0x4f')]({'where':{'id':_0x493792['params']['id']},'include':[{'model':db[_0x2987('0x30')],'as':_0x2987('0x31')}]})[_0x2987('0x14')](handleEntityNotFound(_0x14c17a,null))['then'](saveUpdates(_0x493792[_0x2987('0x58')],null))[_0x2987('0x14')](respondWithResult(_0x14c17a,null))['catch'](handleError(_0x14c17a,null));};exports[_0x2987('0x29')]=function(_0x587ca3,_0x12cfd6){return db['ChatWebsite'][_0x2987('0x4f')]({'where':{'id':_0x587ca3[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x12cfd6,null))[_0x2987('0x14')](removeEntity(_0x12cfd6,null))[_0x2987('0x1e')](handleError(_0x12cfd6,null));};exports['describe']=function(_0x952a7e,_0x2ea61a){return db[_0x2987('0x33')]['describe']()[_0x2987('0x14')](respondWithResult(_0x2ea61a,null))[_0x2987('0x1e')](handleError(_0x2ea61a,null));};exports[_0x2987('0x59')]=function(_0x38e2c7,_0x2b283c){if(_0x38e2c7[_0x2987('0x58')]['id']){delete _0x38e2c7[_0x2987('0x58')]['id'];}return db['ChatWebsite'][_0x2987('0x4f')]({'where':{'id':_0x38e2c7[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x2b283c,null))[_0x2987('0x14')](function(_0x5932d2){if(_0x5932d2){_0x38e2c7[_0x2987('0x58')][_0x2987('0x5a')]=_0x5932d2['id'];return db['Disposition']['create'](_0x38e2c7[_0x2987('0x58')]);}})[_0x2987('0x14')](respondWithResult(_0x2b283c,null))[_0x2987('0x1e')](handleError(_0x2b283c,null));};exports[_0x2987('0x5b')]=function(_0x12ff28,_0x3b55aa){var _0x442969={'raw':![],'where':{}};var _0x42bc54={};var _0x6007a7={'count':0x0,'rows':[]};return db[_0x2987('0x33')][_0x2987('0x5c')]({'where':{'id':_0x12ff28[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x3b55aa,null))[_0x2987('0x14')](function(_0x2891a0){if(_0x2891a0){_0x42bc54[_0x2987('0x37')]=_[_0x2987('0x39')](db[_0x2987('0x5d')][_0x2987('0x34')]);_0x42bc54[_0x2987('0x38')]=_[_0x2987('0x39')](_0x12ff28[_0x2987('0x38')]);_0x42bc54['filters']=_[_0x2987('0x3a')](_0x42bc54[_0x2987('0x37')],_0x42bc54['query']);_0x442969['attributes']=_[_0x2987('0x3a')](_0x42bc54['model'],qs[_0x2987('0x3c')](_0x12ff28[_0x2987('0x38')]['fields']));_0x442969[_0x2987('0x3b')]=_0x442969[_0x2987('0x3b')]['length']?_0x442969[_0x2987('0x3b')]:_0x42bc54[_0x2987('0x37')];if(!_0x12ff28[_0x2987('0x38')][_0x2987('0x3e')](_0x2987('0x3f'))){_0x442969[_0x2987('0x23')]=qs['limit'](_0x12ff28[_0x2987('0x38')]['limit']);_0x442969[_0x2987('0x22')]=qs[_0x2987('0x22')](_0x12ff28[_0x2987('0x38')][_0x2987('0x22')]);}_0x442969[_0x2987('0x5e')]=qs[_0x2987('0x40')](_0x12ff28[_0x2987('0x38')][_0x2987('0x40')]);_0x442969[_0x2987('0x41')]=qs[_0x2987('0x4d')](_[_0x2987('0x42')](_0x12ff28[_0x2987('0x38')],_0x42bc54[_0x2987('0x4d')]));_0x442969[_0x2987('0x41')][_0x2987('0x5a')]=_0x2891a0['id'];if(_0x12ff28['query']['filter']){_0x442969[_0x2987('0x41')]=_[_0x2987('0x46')](_0x442969[_0x2987('0x41')],{'$or':_['map'](_0x442969['attributes'],function(_0x37c688){var _0x38f67b={};_0x38f67b[_0x37c688]={'$like':'%'+_0x12ff28[_0x2987('0x38')][_0x2987('0x43')]+'%'};return _0x38f67b;})});}_0x442969=_[_0x2987('0x46')]({},_0x442969,_0x12ff28[_0x2987('0x47')]);return db['Disposition'][_0x2987('0x25')]({'where':_0x442969[_0x2987('0x41')]})[_0x2987('0x14')](function(_0x4439c2){_0x6007a7[_0x2987('0x25')]=_0x4439c2;if(_0x12ff28[_0x2987('0x38')][_0x2987('0x48')]){_0x442969[_0x2987('0x4e')]=[{'all':!![]}];}return db[_0x2987('0x5d')]['findAll'](_0x442969);})[_0x2987('0x14')](function(_0x1a3612){_0x6007a7[_0x2987('0x4a')]=_0x1a3612;return _0x6007a7;});}})[_0x2987('0x14')](respondWithFilteredResult(_0x3b55aa,_0x442969))['catch'](handleError(_0x3b55aa,null));};exports[_0x2987('0x5f')]=function(_0x563624,_0x567416){return db[_0x2987('0x33')][_0x2987('0x4f')]({'where':{'id':_0x563624['params']['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x567416,null))[_0x2987('0x14')](function(_0x70f915){if(_0x70f915){return _0x70f915['removeDispositions'](_0x563624['query'][_0x2987('0x60')]);}})[_0x2987('0x14')](respondWithStatusCode(_0x567416,null))['catch'](handleError(_0x567416,null));};exports[_0x2987('0x61')]=function(_0x130b88,_0x49ab05){if(_0x130b88[_0x2987('0x58')]['id']){delete _0x130b88[_0x2987('0x58')]['id'];}return db['ChatWebsite'][_0x2987('0x4f')]({'where':{'id':_0x130b88[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x49ab05,null))['then'](function(_0x32ee52){if(_0x32ee52){_0x130b88[_0x2987('0x58')][_0x2987('0x5a')]=_0x32ee52['id'];return db[_0x2987('0x62')]['create'](_0x130b88[_0x2987('0x58')]);}})['then'](respondWithResult(_0x49ab05,null))['catch'](handleError(_0x49ab05,null));};exports[_0x2987('0x63')]=function(_0x103ad2,_0x410dd3){var _0x37a071={'raw':![],'where':{}};var _0x1cce16={};var _0x2833ce={'count':0x0,'rows':[]};return db[_0x2987('0x33')][_0x2987('0x5c')]({'where':{'id':_0x103ad2[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x410dd3,null))[_0x2987('0x14')](function(_0x5fa86d){if(_0x5fa86d){_0x1cce16[_0x2987('0x37')]=_['keys'](db[_0x2987('0x62')]['rawAttributes']);_0x1cce16[_0x2987('0x38')]=_[_0x2987('0x39')](_0x103ad2[_0x2987('0x38')]);_0x1cce16[_0x2987('0x4d')]=_[_0x2987('0x3a')](_0x1cce16['model'],_0x1cce16[_0x2987('0x38')]);_0x37a071[_0x2987('0x3b')]=_[_0x2987('0x3a')](_0x1cce16['model'],qs[_0x2987('0x3c')](_0x103ad2[_0x2987('0x38')]['fields']));_0x37a071['attributes']=_0x37a071[_0x2987('0x3b')][_0x2987('0x3d')]?_0x37a071[_0x2987('0x3b')]:_0x1cce16[_0x2987('0x37')];if(!_0x103ad2[_0x2987('0x38')][_0x2987('0x3e')]('nolimit')){_0x37a071[_0x2987('0x23')]=qs[_0x2987('0x23')](_0x103ad2[_0x2987('0x38')][_0x2987('0x23')]);_0x37a071['offset']=qs['offset'](_0x103ad2[_0x2987('0x38')][_0x2987('0x22')]);}_0x37a071['order']=qs[_0x2987('0x40')](_0x103ad2[_0x2987('0x38')]['sort']);_0x37a071[_0x2987('0x41')]=qs[_0x2987('0x4d')](_[_0x2987('0x42')](_0x103ad2[_0x2987('0x38')],_0x1cce16[_0x2987('0x4d')]));_0x37a071[_0x2987('0x41')][_0x2987('0x5a')]=_0x5fa86d['id'];if(_0x103ad2[_0x2987('0x38')][_0x2987('0x43')]){_0x37a071[_0x2987('0x41')]=_['merge'](_0x37a071[_0x2987('0x41')],{'$or':_['map'](_0x37a071['attributes'],function(_0x21434d){var _0x302090={};_0x302090[_0x21434d]={'$like':'%'+_0x103ad2[_0x2987('0x38')]['filter']+'%'};return _0x302090;})});}_0x37a071=_[_0x2987('0x46')]({},_0x37a071,_0x103ad2[_0x2987('0x47')]);return db[_0x2987('0x62')][_0x2987('0x25')]({'where':_0x37a071[_0x2987('0x41')]})[_0x2987('0x14')](function(_0x5e3271){_0x2833ce['count']=_0x5e3271;if(_0x103ad2[_0x2987('0x38')][_0x2987('0x48')]){_0x37a071['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x2987('0x49')](_0x37a071);})['then'](function(_0xaae57a){_0x2833ce[_0x2987('0x4a')]=_0xaae57a;return _0x2833ce;});}})[_0x2987('0x14')](respondWithFilteredResult(_0x410dd3,_0x37a071))[_0x2987('0x1e')](handleError(_0x410dd3,null));};exports['removeAnswers']=function(_0x52105e,_0x52f39a){return db[_0x2987('0x33')][_0x2987('0x4f')]({'where':{'id':_0x52105e[_0x2987('0x4c')]['id']}})['then'](handleEntityNotFound(_0x52f39a,null))[_0x2987('0x14')](function(_0x536ab0){if(_0x536ab0){return _0x536ab0[_0x2987('0x64')](_0x52105e[_0x2987('0x38')][_0x2987('0x60')]);}})[_0x2987('0x14')](respondWithStatusCode(_0x52f39a,null))[_0x2987('0x1e')](handleError(_0x52f39a,null));};exports['addLogo']=function(_0x469555,_0x58600a){_0x469555['body']['sitepic']=_0x469555[_0x2987('0x65')]['filename'];return db[_0x2987('0x33')]['find']({'where':{'id':_0x469555[_0x2987('0x4c')]['id']}})['then'](handleEntityNotFound(_0x58600a,null))[_0x2987('0x14')](saveUpdates(_0x469555[_0x2987('0x58')],null))[_0x2987('0x14')](respondWithResult(_0x58600a,null))[_0x2987('0x1e')](handleError(_0x58600a,null));};exports['addAvatar']=function(_0x50974c,_0xedb55c){_0x50974c[_0x2987('0x58')][_0x2987('0x66')]=_0x50974c[_0x2987('0x65')][_0x2987('0x67')];return db['ChatWebsite'][_0x2987('0x4f')]({'where':{'id':_0x50974c['params']['id']}})[_0x2987('0x14')](handleEntityNotFound(_0xedb55c,null))[_0x2987('0x14')](saveUpdates(_0x50974c['body'],null))[_0x2987('0x14')](respondWithResult(_0xedb55c,null))[_0x2987('0x1e')](handleError(_0xedb55c,null));};exports['addCustomerAvatar']=function(_0x410ae7,_0xff76fa){_0x410ae7[_0x2987('0x58')][_0x2987('0x68')]=_0x410ae7['file'][_0x2987('0x67')];return db['ChatWebsite'][_0x2987('0x4f')]({'where':{'id':_0x410ae7['params']['id']}})[_0x2987('0x14')](handleEntityNotFound(_0xff76fa,null))[_0x2987('0x14')](saveUpdates(_0x410ae7[_0x2987('0x58')],null))[_0x2987('0x14')](respondWithResult(_0xff76fa,null))[_0x2987('0x1e')](handleError(_0xff76fa,null));};exports[_0x2987('0x69')]=function(_0x139c6f,_0xb0ff54){_0x139c6f[_0x2987('0x58')][_0x2987('0x6a')]=_0x139c6f[_0x2987('0x65')][_0x2987('0x67')];return db[_0x2987('0x33')][_0x2987('0x4f')]({'where':{'id':_0x139c6f[_0x2987('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb0ff54,null))[_0x2987('0x14')](saveUpdates(_0x139c6f[_0x2987('0x58')],null))[_0x2987('0x14')](respondWithResult(_0xb0ff54,null))['catch'](handleError(_0xb0ff54,null));};exports['getLogo']=function(_0x4de15f,_0x2a3396){var _0x1fc6a7=path[_0x2987('0x6b')](config['root'],_0x2987('0x6c'));var _0x592fd5={'where':{'id':_0x4de15f[_0x2987('0x4c')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5bbf82=![];return require(_0x2987('0x6d'))['getLicense']()[_0x2987('0x14')](function(_0x3d0607){if(_0x3d0607){_0x5bbf82=_0x3d0607[_0x2987('0x6e')];}})[_0x2987('0x14')](function(){return db[_0x2987('0x33')][_0x2987('0x4f')](_0x592fd5);})[_0x2987('0x14')](handleEntityNotFound(_0x2a3396,null))[_0x2987('0x14')](function(_0x59673c){if(_0x59673c){if(!_['isNil'](_0x59673c[_0x2987('0x6f')])){if(fs[_0x2987('0x70')](path['join'](config[_0x2987('0x71')],_0x2987('0x72'),_0x59673c[_0x2987('0x6f')]))&&_0x5bbf82){_0x1fc6a7=path['join'](config[_0x2987('0x71')],_0x2987('0x72'),_0x59673c[_0x2987('0x6f')]);}}return _0x2a3396[_0x2987('0x73')](_0x1fc6a7);}})['catch'](handleError(_0x2a3396,null));};exports[_0x2987('0x74')]=function(_0x275e3a,_0x59a2a1){var _0x462e27=path['join'](config[_0x2987('0x71')],_0x2987('0x75'));var _0x199a26={'where':{'id':_0x275e3a[_0x2987('0x4c')]['id']},'attributes':['id',_0x2987('0x66')],'raw':!![]};return db[_0x2987('0x33')][_0x2987('0x4f')](_0x199a26)[_0x2987('0x14')](handleEntityNotFound(_0x59a2a1,null))[_0x2987('0x14')](function(_0xd98220){if(_0xd98220){if(!_['isNil'](_0xd98220['agentAvatar'])){if(fs['existsSync'](path[_0x2987('0x6b')](config[_0x2987('0x71')],_0x2987('0x76'),_0xd98220[_0x2987('0x66')]))){_0x462e27=path['join'](config[_0x2987('0x71')],_0x2987('0x76'),_0xd98220['agentAvatar']);}}return _0x59a2a1['download'](_0x462e27);}})['catch'](handleError(_0x59a2a1,null));};exports[_0x2987('0x77')]=function(_0x156675,_0x581972){var _0x246f1c=path['join'](config[_0x2987('0x71')],_0x2987('0x78'));var _0x16c4a0={'where':{'id':_0x156675[_0x2987('0x4c')]['id']},'attributes':['id',_0x2987('0x68'),_0x2987('0x79')],'raw':!![]};return db[_0x2987('0x33')][_0x2987('0x4f')](_0x16c4a0)[_0x2987('0x14')](handleEntityNotFound(_0x581972,null))[_0x2987('0x14')](function(_0x4ba094){if(_0x4ba094){if(!_[_0x2987('0x7a')](_0x4ba094[_0x2987('0x68')])){if(fs[_0x2987('0x70')](path[_0x2987('0x6b')](config[_0x2987('0x71')],_0x2987('0x76'),_0x4ba094[_0x2987('0x68')]))&&_0x4ba094[_0x2987('0x79')]){_0x246f1c=path['join'](config[_0x2987('0x71')],'server/files/images/avatars/',_0x4ba094[_0x2987('0x68')]);}}return _0x581972[_0x2987('0x73')](_0x246f1c);}})['catch'](handleError(_0x581972,null));};exports['getSystemAvatar']=function(_0xef2d30,_0x3b0d41){var _0x3e93ab=path[_0x2987('0x6b')](config[_0x2987('0x71')],'server/files/images/avatars/system_avatar.png');var _0x12e551={'where':{'id':_0xef2d30['params']['id']},'attributes':['id',_0x2987('0x6a')],'raw':!![]};return db[_0x2987('0x33')][_0x2987('0x4f')](_0x12e551)[_0x2987('0x14')](handleEntityNotFound(_0x3b0d41,null))[_0x2987('0x14')](function(_0x25739b){if(_0x25739b){if(!_['isNil'](_0x25739b['systemAvatar'])){if(fs[_0x2987('0x70')](path[_0x2987('0x6b')](config[_0x2987('0x71')],_0x2987('0x76'),_0x25739b[_0x2987('0x6a')]))){_0x3e93ab=path[_0x2987('0x6b')](config['root'],'server/files/images/avatars/',_0x25739b[_0x2987('0x6a')]);}}return _0x3b0d41[_0x2987('0x73')](_0x3e93ab);}})[_0x2987('0x1e')](handleError(_0x3b0d41,null));};exports['notify']=function(_0x261202,_0x5a480f){var _0x2025f5=require(_0x2987('0x7b'));var _0x50cfd2=new _0x2025f5();var _0x4417b1=_0x50cfd2[_0x2987('0x7c')](_0x261202[_0x2987('0x7d')][_0x2987('0x7e')])['getResult']();var _0xf7a8c9={'body':_0x261202['body'],'channel':_0x2987('0x7f')};var _0x451e2d=[];var _0x5bb936=[];var _0x10d23a={};var _0x1b159d=![];return db['CmContact']['describe']()['then'](function(_0x1118a8){if(!_0x1118a8){throw new db[(_0x2987('0x80'))]['ValidationError']('no\x20available\x20attributes');}_0x451e2d=_[_0x2987('0x81')](_[_0x2987('0x39')](_0x1118a8),[_0x2987('0x82'),_0x2987('0x83')]);_0x5bb936=_[_0x2987('0x81')](_[_0x2987('0x39')](_0x1118a8),[_0x2987('0x82'),'updatedAt',_0x2987('0x84'),_0x2987('0x85')]);if(_0x261202[_0x2987('0x58')]['id']){delete _0x261202[_0x2987('0x58')]['id'];}if(_[_0x2987('0x7a')](_0x261202[_0x2987('0x58')][_0x2987('0x86')])){throw new db[(_0x2987('0x80'))][(_0x2987('0x87'))](_0x2987('0x88'));}if(_[_0x2987('0x7a')](_0x261202[_0x2987('0x58')]['body'])||_0x261202[_0x2987('0x58')][_0x2987('0x58')]===''){throw new db[(_0x2987('0x80'))][(_0x2987('0x87'))](_0x2987('0x89'));}if(_['isNil'](_0x261202[_0x2987('0x58')]['mapKey'])){throw new db['Sequelize'][(_0x2987('0x87'))](_0x2987('0x8a')+_0x5bb936);}if(!_[_0x2987('0x8b')](_0x5bb936,_0x261202['body'][_0x2987('0x8c')])){throw new db['Sequelize']['ValidationError'](_0x2987('0x8d')+_0x5bb936);}_0x10d23a[_0x261202[_0x2987('0x58')][_0x2987('0x8c')]]=_0x261202[_0x2987('0x58')][_0x2987('0x86')];})[_0x2987('0x14')](function(){return db['ChatWebsite'][_0x2987('0x4f')]({'where':{'id':_0x261202[_0x2987('0x4c')]['id']},'include':[{'model':db['CmList'],'as':_0x2987('0x8e'),'include':[{'model':db['CmContact'],'as':_0x2987('0x8f'),'where':_0x10d23a,'limit':0x1,'order':[[_0x2987('0x83'),_0x2987('0x90')]]}]},{'model':db[_0x2987('0x91')],'as':_0x2987('0x92')}]});})[_0x2987('0x14')](handleEntityNotFound(_0x5a480f,null))['then'](function(_0x1559ec){if(_0x1559ec&&_0x1559ec[_0x2987('0x8e')]){_0xf7a8c9[_0x2987('0x93')]=_0x1559ec;_0xf7a8c9[_0x2987('0x94')]=_0x1559ec[_0x2987('0x92')];_0xf7a8c9[_0x2987('0x95')]=_0x1559ec['List'];_0xf7a8c9[_0x2987('0x94')]=_['orderBy'](_0xf7a8c9[_0x2987('0x94')],['priority'],[_0x2987('0x96')]);if(_0xf7a8c9[_0x2987('0x93')][_0x2987('0x92')]){delete _0xf7a8c9[_0x2987('0x93')][_0x2987('0x92')];}if(_0xf7a8c9[_0x2987('0x93')]['List']&&_0xf7a8c9[_0x2987('0x93')][_0x2987('0x8e')]['Contacts'][_0x2987('0x3d')]){return _0xf7a8c9['account']['List'][_0x2987('0x8f')][0x0];}var _0x3ce649=_['defaults'](_0x261202[_0x2987('0x58')],{'firstName':_0x261202[_0x2987('0x58')][_0x2987('0x86')],'ListId':_0x1559ec['ListId']});_0x3ce649[_0x261202[_0x2987('0x58')]['mapKey']]=_0x261202['body'][_0x2987('0x86')];return db[_0x2987('0x97')][_0x2987('0x50')](_0x3ce649,{'fields':_0x451e2d,'raw':!![]});}})[_0x2987('0x14')](handleEntityNotFound(_0x5a480f,null))[_0x2987('0x14')](function(_0x483f44){_0xf7a8c9['contact']=_0x483f44;var _0x834a6b=_0x261202[_0x2987('0x58')][_0x2987('0x98')];if(_0x261202[_0x2987('0x7d')][_0x2987('0x99')]){_0x834a6b=_0x261202[_0x2987('0x7d')][_0x2987('0x99')];}else if(_0x261202[_0x2987('0x7d')][_0x2987('0x9a')]){_0x834a6b=_[_0x2987('0x9b')](_0x261202['headers'][_0x2987('0x9a')][_0x2987('0x9c')](','));}if(_0x483f44){var _0x34c414={'ContactId':_0x483f44['id'],'ChatWebsiteId':_0x261202['params']['id'],'from':(_0x483f44[_0x2987('0x9d')]||'')+'\x20'+(_0x483f44['lastName']||''),'customerIp':_0x834a6b,'customerPort':_0x261202[_0x2987('0x7d')][_0x2987('0x9e')]?_0x261202[_0x2987('0x7d')][_0x2987('0x9e')]:null,'referer':_0x261202[_0x2987('0x58')][_0x2987('0x9f')],'browserName':_0x4417b1[_0x2987('0xa0')][_0x2987('0x2d')]&&_0x4417b1['browser'][_0x2987('0xa1')]?util[_0x2987('0xa2')]('%s\x20%s',_0x4417b1[_0x2987('0xa0')][_0x2987('0x2d')],_0x4417b1['browser']['version']):_0x2987('0xa3'),'browserVersion':_0x4417b1[_0x2987('0xa0')][_0x2987('0xa1')]||'unknown','osName':util['format'](_0x2987('0xa4'),_0x4417b1['os']['name'],_0x4417b1['os'][_0x2987('0xa1')]),'osVersion':_0x4417b1['os'][_0x2987('0xa1')],'deviceModel':_0x4417b1[_0x2987('0xa5')][_0x2987('0x37')]&&_0x4417b1[_0x2987('0xa5')][_0x2987('0xa6')]?util[_0x2987('0xa2')](_0x2987('0xa7'),_0x4417b1[_0x2987('0xa5')][_0x2987('0x37')],_0x4417b1[_0x2987('0xa5')][_0x2987('0xa6')],_0x4417b1[_0x2987('0xa5')]['type']):null,'deviceVendor':_0x4417b1['device'][_0x2987('0xa6')],'deviceType':_0x4417b1[_0x2987('0xa5')]['type'],'formData':JSON[_0x2987('0xa8')](_0x261202[_0x2987('0x58')])};var _0x58b8dc={'ChatWebsiteId':_0x261202[_0x2987('0x4c')]['id'],'closed':![]};if(_0x261202[_0x2987('0x58')]['threadId']){_0x58b8dc[_0x2987('0xa9')]=_0x261202['body'][_0x2987('0xa9')];return db[_0x2987('0xaa')][_0x2987('0x4f')]({'where':_0x58b8dc})[_0x2987('0x14')](function(_0x2a3871){if(_0x2a3871){return[_0x2a3871,![]];}_0x34c414[_0x2987('0xa9')]=_0x261202[_0x2987('0x58')][_0x2987('0xa9')];_0x34c414[_0x2987('0xab')]=_0x261202[_0x2987('0x58')][_0x2987('0xab')];return db[_0x2987('0xaa')][_0x2987('0x50')](_0x34c414)[_0x2987('0x14')](function(_0x3aaa6c){return[_0x3aaa6c,!![]];});});}_0x58b8dc[_0x2987('0xac')]=_0x483f44['id'];if(_0x261202[_0x2987('0x58')][_0x2987('0xad')]&&_0x261202[_0x2987('0x58')][_0x2987('0xad')]['id']){_0x58b8dc['id']=_0x261202[_0x2987('0x58')][_0x2987('0xad')]['id'];return db[_0x2987('0xaa')][_0x2987('0x4f')]({'where':_0x58b8dc})['then'](function(_0x39c111){if(_0x39c111){return[_0x39c111,![]];}return db[_0x2987('0xaa')]['create'](_0x34c414)[_0x2987('0x14')](function(_0x298353){return[_0x298353,!![]];});});}return db[_0x2987('0xaa')][_0x2987('0x50')](_0x34c414)[_0x2987('0x14')](function(_0x58e9b1){return[_0x58e9b1,!![]];});}})[_0x2987('0xae')](function(_0x3f6c72,_0x15619f){if(_0x3f6c72){_0x1b159d=_0x15619f;if(!_0x15619f){var _0x5ee944={'from':(_0xf7a8c9[_0x2987('0xaf')][_0x2987('0x9d')]||'')+'\x20'+(_0xf7a8c9['contact'][_0x2987('0xb0')]||'')};if(_0x261202[_0x2987('0x58')]['threadId']&&_0x261202[_0x2987('0x58')][_0x2987('0xb1')]&&_0x261202[_0x2987('0x58')][_0x2987('0xa9')]!=_0x261202['body']['messageId']){_0x5ee944[_0x2987('0xa9')]=_0x261202['body'][_0x2987('0xb1')];}return _0x3f6c72[_0x2987('0x28')](_0x5ee944);}else{return _0x3f6c72;}}})[_0x2987('0x14')](function(_0x1dfb40){_0xf7a8c9[_0x2987('0xad')]=_0x1dfb40[_0x2987('0x2a')]({'plain':!![]});_0xf7a8c9['interaction']['created']=_0x1b159d;if(_0xf7a8c9[_0x2987('0xad')][_0x2987('0xb2')]){if(_0xf7a8c9[_0x2987('0x93')]['autoclose']){_0xf7a8c9['applications'][_0x2987('0xb3')]({'id':0x0,'priority':_0xf7a8c9[_0x2987('0x94')]['length']+0x1,'app':_0x2987('0xb4'),'appdata':_0x2987('0xb5'),'interval':_0x2987('0xb6')});}}return db[_0x2987('0xb7')][_0x2987('0x50')]({'body':_0x261202[_0x2987('0x58')][_0x2987('0x58')],'ChatWebsiteId':_0x261202[_0x2987('0x4c')]['id'],'ChatInteractionId':_0x1dfb40['id'],'direction':'in','ContactId':_0xf7a8c9['contact']['id'],'AttachmentId':_0x261202[_0x2987('0x58')][_0x2987('0xb8')]});})[_0x2987('0x14')](function(_0x23157b){_0xf7a8c9[_0x2987('0x1c')]=_0x23157b;if(_0xf7a8c9['interaction'][_0x2987('0xb9')]){return db['User'][_0x2987('0x4f')]({'attributes':['id',_0x2987('0x2d')],'where':{'id':_0xf7a8c9[_0x2987('0xad')][_0x2987('0xb9')]}})[_0x2987('0x14')](function(_0x57e2ce){if(_0x57e2ce){_0xf7a8c9[_0x2987('0x94')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x57e2ce[_0x2987('0x2d')]+','+(_0xf7a8c9[_0x2987('0x93')][_0x2987('0xba')]||0xa),'interval':_0x2987('0xb6')});_0xf7a8c9[_0x2987('0xbb')]=!![];}return respondWithRpcPromise(_0x2987('0xbc'),_0x2987('0xbd'),_0xf7a8c9);});}return respondWithRpcPromise(_0x2987('0xbc'),_0x2987('0xbd'),_0xf7a8c9);})['then'](function(_0x24bf49){respondWithRpcPromise(_0x2987('0xbe'),_0x2987('0xbe'),{'event':_0x2987('0xbf'),'message':_0x24bf49},client9002);return _0x24bf49;})[_0x2987('0x14')](respondWithResult(_0x5a480f,null))[_0x2987('0x1e')](handleError(_0x5a480f,null));};exports['offline']=function(_0x5916bf,_0x136c83){var _0x13c840,_0x3d1a2b,_0x28c106;var _0x39277c=[];var _0x51f323={};var _0x20ceec=_0x5916bf[_0x2987('0xc0')]||[];var _0x1207ae=[];var _0x52af94;return db['CmContact']['describe']()['then'](function(_0x42cc6b){if(!_0x42cc6b){throw new db['Sequelize'][(_0x2987('0x87'))](_0x2987('0xc1'));}_0x39277c=_[_0x2987('0x81')](_['keys'](_0x42cc6b),[_0x2987('0x82'),_0x2987('0x83'),_0x2987('0x84'),'ListId']);if(_0x5916bf[_0x2987('0x58')]['id']){delete _0x5916bf[_0x2987('0x58')]['id'];}if(_['isNil'](_0x5916bf['body'][_0x2987('0x86')])){throw _0x136c83[_0x2987('0x2c')](0x1f4)[_0x2987('0x2e')](new db['Sequelize'][(_0x2987('0x87'))]('from\x20is\x20mandatory'));}if(_[_0x2987('0x7a')](_0x5916bf['body'][_0x2987('0x58')])||_0x5916bf[_0x2987('0x58')][_0x2987('0x58')]===''){throw _0x136c83[_0x2987('0x2c')](0x1f4)[_0x2987('0x2e')](new db[(_0x2987('0x80'))][(_0x2987('0x87'))](_0x2987('0x89')));}if(_['isNil'](_0x5916bf[_0x2987('0x58')][_0x2987('0xc2')])){throw _0x136c83['status'](0x1f4)[_0x2987('0x2e')](new db[(_0x2987('0x80'))][(_0x2987('0x87'))](_0x2987('0xc3')+_0x39277c));}if(!_[_0x2987('0x8b')](_0x39277c,_0x5916bf[_0x2987('0x58')][_0x2987('0xc2')])){throw _0x136c83[_0x2987('0x2c')](0x1f4)[_0x2987('0x2e')](new db[(_0x2987('0x80'))]['ValidationError'](_0x2987('0xc4')+_0x39277c));}_0x51f323[_0x5916bf['body'][_0x2987('0xc2')]]=_0x5916bf['body'][_0x2987('0x86')];})[_0x2987('0x14')](function(){return db[_0x2987('0x33')]['find']({'where':{'id':_0x5916bf[_0x2987('0x4c')]['id']},'include':[{'model':db['CmList'],'as':_0x2987('0x8e')},{'model':db[_0x2987('0xc5')],'as':_0x2987('0xc5')}]});})[_0x2987('0x14')](handleEntityNotFound(_0x136c83,null))[_0x2987('0x14')](function(_0x192954){if(_0x192954&&_0x192954[_0x2987('0x8e')]){_0x3d1a2b=_0x192954;var _0x40128a=_[_0x2987('0xc6')](_0x5916bf['body'],{'firstName':_0x5916bf[_0x2987('0x58')][_0x2987('0x86')],'phone':_0x5916bf[_0x2987('0x58')][_0x2987('0x86')],'ListId':_0x192954['ListId']});_0x40128a[_0x5916bf['body'][_0x2987('0xc2')]]=_0x5916bf['body'][_0x2987('0x86')];return db[_0x2987('0x97')][_0x2987('0xc7')]({'where':_0x51f323,'defaults':_0x40128a});}})[_0x2987('0xae')](function(_0x34acf9){if(_0x34acf9){_0x28c106=_0x34acf9;var _0x4b9e29=fs[_0x2987('0xc8')](path[_0x2987('0x6b')](config['root'],_0x2987('0xc9')),'utf8');var _0x79355d=ejs[_0x2987('0xca')](_0x4b9e29,{'body':_[_0x2987('0xcb')](_0x5916bf[_0x2987('0x58')][_0x2987('0x58')]),'bodyTitle':_0x3d1a2b[_0x2987('0xcc')]});return db[_0x2987('0xcd')]['create']({'body':_0x79355d,'plainBody':htmlToText[_0x2987('0xce')](_0x79355d),'ContactId':_0x34acf9['id'],'ChatWebsiteId':_0x3d1a2b['id']});}})[_0x2987('0x14')](function(_0x1f8799){_0x52af94=_0x1f8799;if(_0x20ceec[_0x2987('0x3d')]){var _0x2f7ec7=_0x20ceec[_0x2987('0x32')](function(_0x415865){return{'name':_0x415865[_0x2987('0xcf')],'basename':_0x415865[_0x2987('0x67')],'type':_0x415865[_0x2987('0xd0')],'ChatOfflineMessageId':_0x1f8799['id']};});_0x1207ae=_0x2f7ec7['map'](_0x3f5acd=>{var _0x48e8bb={'filename':_0x3f5acd[_0x2987('0x2d')],'path':path[_0x2987('0x6b')](config['root'],_0x2987('0xd1'),'files',_0x2987('0xd2'),_0x2987('0xd3'),_0x3f5acd[_0x2987('0xd4')])};return _0x48e8bb;});if(!_0x3d1a2b['openNewInteraction']){return db['sequelize']['transaction'](function(_0x199910){return db[_0x2987('0xd5')]['bulkCreate'](_0x2f7ec7,{'transaction':_0x199910});});}}})['then'](function(){if(_0x52af94){_0x13c840=_0x52af94;return db['MailAccount'][_0x2987('0x5c')]({'where':{'service':!![]},'include':[{'model':db[_0x2987('0xd6')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2987('0xd7')],'as':_0x2987('0xd7'),'raw':!![]}]}]});}})[_0x2987('0x14')](function(_0x4ff99f){if(_0x4ff99f&&_0x4ff99f['Smtp']&&_0x3d1a2b['forwardOffline']&&_0x3d1a2b[_0x2987('0xd8')]){var _0x5e2512=_0x4ff99f['getSmtpOptions']();return respondWithRpcPromise(_0x2987('0xd9'),_0x2987('0xda'),{'account':_0x5e2512,'message':{'from':util[_0x2987('0xa2')](_0x2987('0xdb'),_0x4ff99f[_0x2987('0x2d')],_0x4ff99f[_0x2987('0xdc')]||_0x4ff99f['Smtp']['user']),'to':_0x3d1a2b[_0x2987('0xd8')],'subject':_0x3d1a2b[_0x2987('0xdd')],'html':_0x13c840[_0x2987('0x58')],'attachments':_0x1207ae}},client9003)['then'](function(){return _0x13c840;})[_0x2987('0x1e')](function(_0x4c67f0){logger[_0x2987('0x1a')](_0x4c67f0);});}})[_0x2987('0x14')](function(){if(_0x3d1a2b&&_0x3d1a2b[_0x2987('0xde')]&&_0x3d1a2b[_0x2987('0xdf')]){var _0x21114b=[];if(_0x20ceec[_0x2987('0x3d')]){_0x21114b=_0x20ceec[_0x2987('0x32')](function(_0x56db0b){return{'name':_0x56db0b['originalname'],'basename':_0x56db0b[_0x2987('0x67')],'type':_0x56db0b['mimetype'],'ChatOfflineMessageId':_0x52af94['id']};});}var _0x1ccd4a;if(!_[_0x2987('0x7a')](_0x3d1a2b['subjectOffline'])){var _0x173f03=_['map'](_0x5916bf['body'],function(_0x2946f6){return _0x2946f6;});var _0x339280=_[_0x2987('0xe0')](_0x173f03)[0x0];var _0x36cd44=_[_0x2987('0xe1')](_0x339280,function(_0x2dcc9f){return _0x2dcc9f;});_0x1ccd4a=_0x36cd44[0x1][_0x3d1a2b[_0x2987('0xe2')]];}var _0xb55820={'from':_0x28c106[_0x2987('0xdc')],'firstName':_0x28c106[_0x2987('0x9d')],'lastName':_0x28c106[_0x2987('0xb0')],'mapKey':_0x2987('0xdc'),'message':{'from':_0x28c106['email'],'to':_0x3d1a2b['MailAccount'][_0x2987('0xdc')],'cc':'','subject':_[_0x2987('0x7a')](_0x1ccd4a)?_0x3d1a2b[_0x2987('0xdd')]:_0x1ccd4a,'messageId':'','sentAt':new Date(),'attach':_0x21114b[_0x2987('0x3d')],'attachments':_0x21114b,'originChannel':'Chat','ChatWebsiteId':_0x3d1a2b['id'],'ChatOfflineMessageId':_0x13c840['id'],'originTo':_0x3d1a2b[_0x2987('0xc5')][_0x2987('0xdc')]},'body':_0x13c840[_0x2987('0x58')]};var _0x209e49={'account':{'id':_0x3d1a2b[_0x2987('0xdf')]},'body':_0xb55820,'log':_0x2987('0xe3')};return respondWithRpcPromise('NotifyMailAccount',_0x2987('0xe4'),_0x209e49,client9001)[_0x2987('0x14')](function(){return _0x13c840;})[_0x2987('0x1e')](function(_0x4107fa){logger['error'](_0x4107fa);});}return;})[_0x2987('0x14')](function(){if(_0x13c840){return _0x13c840;}})[_0x2987('0x14')](respondWithResult(_0x136c83,null))['catch'](function(_0x6354ec){logger['error'](_0x2987('0x1e'),_0x6354ec);for(var _0x6902ba of _0x20ceec){var _0x21ff06=path[_0x2987('0x6b')](config['root'],_0x2987('0xd1'),_0x2987('0xc0'),_0x2987('0xd2'),'offline-chat',_0x6902ba[_0x2987('0x67')]);fs_extra[_0x2987('0xe5')](_0x21ff06)['catch'](function(_0x2edb45){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x21ff06,_0x2edb45);});}});};exports[_0x2987('0xe6')]=function(_0x59f609,_0x452141){return db['ChatInteraction']['find']({'where':{'id':_0x59f609[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x452141,null))[_0x2987('0x14')](function(_0x24fb7c){if(_0x24fb7c){return _0x24fb7c['addInteraction'](_0x59f609[_0x2987('0x58')][_0x2987('0x60')],_[_0x2987('0xe7')](_0x59f609[_0x2987('0x58')],[_0x2987('0x60'),'id'])||{});}})[_0x2987('0x14')](respondWithResult(_0x452141,null))[_0x2987('0x1e')](handleError(_0x452141,null));};exports[_0x2987('0xe8')]=function(_0x9d6af1,_0x551a14){var _0x1e6037={'raw':![],'where':{}};var _0x1c7d90={};var _0x2b6592={'count':0x0,'rows':[]};return db[_0x2987('0x33')]['findOne']({'where':{'id':_0x9d6af1[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x551a14,null))['then'](function(_0x4d87b1){if(_0x4d87b1){_0x1c7d90[_0x2987('0x37')]=_['keys'](db[_0x2987('0xaa')][_0x2987('0x34')]);_0x1c7d90['query']=_['keys'](_0x9d6af1[_0x2987('0x38')]);_0x1c7d90[_0x2987('0x4d')]=_['intersection'](_0x1c7d90[_0x2987('0x37')],_0x1c7d90[_0x2987('0x38')]);_0x1e6037[_0x2987('0x3b')]=_[_0x2987('0x3a')](_0x1c7d90['model'],qs[_0x2987('0x3c')](_0x9d6af1[_0x2987('0x38')][_0x2987('0x3c')]));_0x1e6037['attributes']=_0x1e6037['attributes']['length']?_0x1e6037['attributes']:_0x1c7d90[_0x2987('0x37')];if(!_0x9d6af1[_0x2987('0x38')]['hasOwnProperty']('nolimit')){_0x1e6037[_0x2987('0x23')]=qs[_0x2987('0x23')](_0x9d6af1['query']['limit']);_0x1e6037[_0x2987('0x22')]=qs['offset'](_0x9d6af1[_0x2987('0x38')]['offset']);}_0x1e6037[_0x2987('0x5e')]=qs[_0x2987('0x40')](_0x9d6af1[_0x2987('0x38')]['sort']);_0x1e6037[_0x2987('0x41')]=qs[_0x2987('0x4d')](_[_0x2987('0x42')](_0x9d6af1['query'],_0x1c7d90[_0x2987('0x4d')]));_0x1e6037['where'][_0x2987('0x5a')]=_0x4d87b1['id'];if(_0x9d6af1[_0x2987('0x38')]['filter']){_0x1e6037[_0x2987('0x41')]=_[_0x2987('0x46')](_0x1e6037['where'],{'$or':_[_0x2987('0x32')](_0x1e6037[_0x2987('0x3b')],function(_0xbd4fbf){var _0x152d07={};_0x152d07[_0xbd4fbf]={'$like':'%'+_0x9d6af1[_0x2987('0x38')]['filter']+'%'};return _0x152d07;})});}_0x1e6037=_[_0x2987('0x46')]({},_0x1e6037,_0x9d6af1[_0x2987('0x47')]);return db['ChatInteraction'][_0x2987('0x25')]({'where':_0x1e6037[_0x2987('0x41')]})[_0x2987('0x14')](function(_0x5e86ca){_0x2b6592[_0x2987('0x25')]=_0x5e86ca;if(_0x9d6af1[_0x2987('0x38')]['includeAll']){_0x1e6037[_0x2987('0x4e')]=[{'model':db[_0x2987('0x97')],'as':_0x2987('0xe9'),'required':![]},{'model':db[_0x2987('0xea')],'as':_0x2987('0xeb'),'attributes':[_0x2987('0x2d'),_0x2987('0xec'),_0x2987('0xed')],'required':![]},{'model':db['Tag'],'as':_0x2987('0xee'),'attributes':['id',_0x2987('0x2d'),_0x2987('0xef')],'where':_0x9d6af1['query']['tag']?{'id':_0x9d6af1['query'][_0x2987('0xf0')]}:undefined,'required':_0x9d6af1['query'][_0x2987('0xf0')]?!![]:![]}];}return db[_0x2987('0xaa')]['findAll'](_0x1e6037);})[_0x2987('0x14')](function(_0x4c11e4){_0x2b6592[_0x2987('0x4a')]=_0x4c11e4;return _0x2b6592;});}})['then'](respondWithFilteredResult(_0x551a14,_0x1e6037))[_0x2987('0x1e')](handleError(_0x551a14,null));};function iftimePromise(_0x42eb33,_0x1ff567){return respondWithRpcPromise(_0x2987('0xf1'),_0x2987('0xf2'),{'command':_0x1ff567['timezone']?util['format'](_0x2987('0xf3'),_0x42eb33[_0x2987('0xf4')],_0x1ff567[_0x2987('0xf5')]):util['format'](_0x2987('0xf6'),_0x42eb33[_0x2987('0xf4')])},client9002)[_0x2987('0x14')](function(_0x1f7d6c){var _0x5a6145=_0x1f7d6c&&_0x1f7d6c['indexOf'](_0x2987('0xf7'))>=0x0?!![]:![];logger[_0x2987('0x15')](_0x2987('0xf8'),_0x1ff567['id'],_0x42eb33['id'],_0x42eb33[_0x2987('0xf4')],_0x5a6145?_0x2987('0xf9'):_0x2987('0xfa'),_0x1ff567['timezone']?_0x1ff567['timezone']:_0x2987('0xfb'));return _0x5a6145;})['catch'](function(_0x268ec2){logger[_0x2987('0x1a')](_0x2987('0xf8'),_0x1ff567['id'],_0x42eb33['id'],_0x42eb33['interval'],util[_0x2987('0xfc')](_0x268ec2,{'showHidden':![],'depth':null}),_0x1ff567[_0x2987('0xf5')]?_0x1ff567[_0x2987('0xf5')]:_0x2987('0xfb'));return![];});}exports['getSnippet']=function(_0x43f3ec,_0x491887){var _0x55cf79=0x0;var _0x4b24bd=0x0;var _0x5d7f86=![];var _0x24536e;var _0x35a221;return db[_0x2987('0x33')]['find']({'where':{'id':_0x43f3ec[_0x2987('0x4c')]['id']},'include':[{'model':db[_0x2987('0xfd')],'as':'Interval','include':[{'model':db[_0x2987('0xfd')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x2987('0x14')](handleEntityNotFound(_0x491887,null))[_0x2987('0x14')](function(_0x150661){if(_0x150661){_0x24536e=_0x150661;return _0x150661[_0x2987('0xfe')]({'raw':!![]});}})['then'](function(_0x4e79b7){if(_0x24536e){if(_0x4e79b7){_0x35a221=_0x4e79b7;}}return require('../../config/license/util')[_0x2987('0xff')]();})[_0x2987('0x14')](function(_0x250745){if(_0x250745){_0x4b24bd=_0x250745[_0x2987('0x100')];_0x5d7f86=_0x250745[_0x2987('0x6e')];}})[_0x2987('0x14')](function(){return db[_0x2987('0xaa')][_0x2987('0x25')]({'where':{'closed':![]}});})[_0x2987('0x14')](function(_0x1d290b){_0x55cf79=_0x1d290b;if(_0x4b24bd&&_0x1d290b>_0x4b24bd){return db['License']['findOne']({'where':{'id':0x1}})[_0x2987('0x14')](function(_0x68f49){if(_0x68f49){_0x68f49['increment']('chatLicenseExceeded');}});}})['then'](function(){if(_0x24536e[_0x2987('0xfd')]&&_0x24536e['Interval']['Intervals']){var _0x116f0a=[];for(var _0x94cd86=0x0;_0x94cd86<_0x24536e[_0x2987('0xfd')][_0x2987('0x101')][_0x2987('0x3d')];_0x94cd86++){var _0x24a380=_0x24536e['Interval'][_0x2987('0x101')][_0x94cd86]['get']({'plain':!![]});_0x116f0a[_0x2987('0xb3')](iftimePromise(_0x24a380,_0x24536e));}return BPromise[_0x2987('0x102')](_0x116f0a)[_0x2987('0x14')](function(_0x501e85){return _['some'](_0x501e85);});}else{return!![];}})[_0x2987('0x14')](function(_0x3173be){var _0x337ce8=fs[_0x2987('0xc8')](path[_0x2987('0x6b')](config['root'],'server/files/chat/iframe.ejs'),_0x2987('0x103'));var _0x1c6173={'remote':_0x24536e[_0x2987('0x104')],'query':querystring[_0x2987('0xa8')](_['merge'](_0x24536e[_0x2987('0x2a')]({'plain':!![]}),{'customerIp':_0x43f3ec[_0x2987('0x7d')]['x-forwarded-for']||_0x43f3ec[_0x2987('0x7d')]['x-real-ip']||_0x43f3ec[_0x2987('0x105')]['remoteAddress']||_0x43f3ec['ip'],'referer':_0x43f3ec[_0x2987('0x7d')][_0x2987('0x9f')],'openedInteractions':_0x55cf79,'maxInteractions':_0x4b24bd,'virtual':_0x5d7f86[_0x2987('0x100')],'online':_0x3173be,'custom':_0x5d7f86}))[_0x2987('0x106')](/'/g,'\x5c\x27')};_0x491887[_0x2987('0x2e')](ejs[_0x2987('0xca')](Mustache[_0x2987('0xca')](_0x337ce8,_0x1c6173),{'proactiveActions':_0x35a221,'alignment':_0x24536e[_0x2987('0x107')],'verticalAlignment':_0x24536e[_0x2987('0x108')],'div_color':_0x24536e[_0x2987('0xef')],'labelText':_0x24536e[_0x2987('0x109')],'text_color':_0x24536e[_0x2987('0x10a')],'text_button_color':_0x24536e[_0x2987('0x10b')],'button_color':_0x24536e[_0x2987('0x10c')],'background_color':_0x24536e[_0x2987('0x10d')],'hideWhenOffline':_0x24536e[_0x2987('0x10e')],'interval':_0x24536e[_0x2987('0x10f')]}));})['catch'](handleError(_0x491887,null));};exports[_0x2987('0x110')]=function(_0x1c2864,_0x11d3d1){var _0x4c527d=_0x1c2864[_0x2987('0x4c')]['id'];var _0x3b333d=_0x1c2864['body'];var _0x1fe0d=0xc8;var _0x3a176a=null;return db[_0x2987('0x111')][_0x2987('0x112')]({'isolationLevel':db['sequelize'][_0x2987('0x113')][_0x2987('0x114')][_0x2987('0x115')]},function(_0x245133){return db[_0x2987('0x33')][_0x2987('0x5c')]({'where':{'id':_0x4c527d},'transaction':_0x245133})[_0x2987('0x14')](function(_0xa8c411){if(_0xa8c411){return db[_0x2987('0x91')][_0x2987('0x29')]({'where':{'ChatWebsiteId':_0x4c527d},'transaction':_0x245133})[_0x2987('0x14')](function(){var _0x5b6201=_[_0x2987('0x32')](_0x3b333d,function(_0x5adb95){_0x5adb95['ChatWebsiteId']=_0x4c527d;return _0x5adb95;});return db['ChatApplication'][_0x2987('0x116')](_0x5b6201,{'transaction':_0x245133});});}else{_0x1fe0d=0x194;_0x3a176a=[];}});})['then'](function(){if(_0x1fe0d!==0x194){return db['ChatApplication'][_0x2987('0x117')]({'where':{'ChatWebsiteId':_0x4c527d},'order':'priority'})[_0x2987('0x14')](function(_0x70c51f){_0x3a176a=_0x70c51f;});}})[_0x2987('0x1e')](function(_0x1b6585){_0x1fe0d=0x1f4;logger['error'](_0x1b6585[_0x2987('0x118')]);if(_0x1b6585[_0x2987('0x2d')]){delete _0x1b6585[_0x2987('0x2d')];}_0x3a176a=_0x1b6585;})[_0x2987('0x119')](function(){if(_0x3a176a===null){_0x11d3d1[_0x2987('0x1f')](_0x1fe0d);}else{if(_0x1fe0d===0x1f4){_0x11d3d1[_0x2987('0x2c')](_0x1fe0d)[_0x2987('0x2e')](_0x3a176a);}else{_0x11d3d1[_0x2987('0x2c')](_0x1fe0d)[_0x2987('0x21')](_0x3a176a);}}});};exports[_0x2987('0x11a')]=function(_0x38b50e,_0x7013dc){var _0x4eff9f={};var _0x54ca3c={};var _0x1c6778;var _0x153c8f;return db['ChatWebsite'][_0x2987('0x5c')]({'where':{'id':_0x38b50e[_0x2987('0x4c')]['id']}})['then'](handleEntityNotFound(_0x7013dc,null))[_0x2987('0x14')](function(_0x25ade2){if(_0x25ade2){_0x1c6778=_0x25ade2;_0x54ca3c[_0x2987('0x37')]=_['keys'](db[_0x2987('0x91')][_0x2987('0x34')]);_0x54ca3c[_0x2987('0x38')]=_[_0x2987('0x39')](_0x38b50e['query']);_0x54ca3c['filters']=_[_0x2987('0x3a')](_0x54ca3c['model'],_0x54ca3c[_0x2987('0x38')]);_0x4eff9f['attributes']=_[_0x2987('0x3a')](_0x54ca3c[_0x2987('0x37')],qs[_0x2987('0x3c')](_0x38b50e[_0x2987('0x38')]['fields']));_0x4eff9f[_0x2987('0x3b')]=_0x4eff9f[_0x2987('0x3b')][_0x2987('0x3d')]?_0x4eff9f[_0x2987('0x3b')]:_0x54ca3c['model'];_0x4eff9f[_0x2987('0x5e')]=qs[_0x2987('0x40')](_0x38b50e[_0x2987('0x38')][_0x2987('0x40')]);_0x4eff9f[_0x2987('0x41')]=qs['filters'](_[_0x2987('0x42')](_0x38b50e[_0x2987('0x38')],_0x54ca3c['filters']));if(_0x38b50e[_0x2987('0x38')]['filter']){_0x4eff9f[_0x2987('0x41')]=_['merge'](_0x4eff9f[_0x2987('0x41')],{'$or':_[_0x2987('0x32')](_0x4eff9f['attributes'],function(_0x449310){var _0x410aef={};_0x410aef[_0x449310]={'$like':'%'+_0x38b50e['query'][_0x2987('0x43')]+'%'};return _0x410aef;})});}_0x4eff9f=_[_0x2987('0x46')]({},_0x4eff9f,_0x38b50e[_0x2987('0x47')]);return _0x1c6778[_0x2987('0x11a')](_0x4eff9f);}})[_0x2987('0x14')](function(_0x44891a){if(_0x44891a){_0x153c8f=_0x44891a['length'];if(!_0x38b50e['query'][_0x2987('0x3e')](_0x2987('0x3f'))){_0x4eff9f[_0x2987('0x23')]=qs[_0x2987('0x23')](_0x38b50e['query']['limit']);_0x4eff9f[_0x2987('0x22')]=qs[_0x2987('0x22')](_0x38b50e['query'][_0x2987('0x22')]);}return _0x1c6778[_0x2987('0x11a')](_0x4eff9f);}})[_0x2987('0x14')](function(_0x138fc1){if(_0x138fc1){return _0x138fc1?{'count':_0x153c8f,'rows':_0x138fc1}:null;}})[_0x2987('0x14')](respondWithResult(_0x7013dc,null))['catch'](handleError(_0x7013dc,null));};exports[_0x2987('0x11b')]=function(_0x1cdcfa,_0x284fbb){return db[_0x2987('0x11c')][_0x2987('0x4f')]({'where':{'id':_0x1cdcfa[_0x2987('0x4c')]['id']}})['then'](handleEntityNotFound(_0x284fbb,null))[_0x2987('0x14')](function(_0x1b8c6b){if(_0x1b8c6b){return _0x1b8c6b[_0x2987('0x11b')](_0x1cdcfa[_0x2987('0x58')][_0x2987('0x60')],_[_0x2987('0xe7')](_0x1cdcfa[_0x2987('0x58')],[_0x2987('0x60'),'id'])||{});}})[_0x2987('0x14')](respondWithResult(_0x284fbb,null))[_0x2987('0x1e')](handleError(_0x284fbb,null));};exports['getProactiveActions']=function(_0x59cfa2,_0x74c556){var _0x129311={};var _0x305aa3={};var _0xd4870d;var _0x4a3270;return db['ChatWebsite'][_0x2987('0x5c')]({'where':{'id':_0x59cfa2[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x74c556,null))[_0x2987('0x14')](function(_0x58e772){if(_0x58e772){_0xd4870d=_0x58e772;_0x305aa3['model']=_[_0x2987('0x39')](db['ChatProactiveAction'][_0x2987('0x34')]);_0x305aa3[_0x2987('0x38')]=_[_0x2987('0x39')](_0x59cfa2[_0x2987('0x38')]);_0x305aa3[_0x2987('0x4d')]=_[_0x2987('0x3a')](_0x305aa3['model'],_0x305aa3[_0x2987('0x38')]);_0x129311[_0x2987('0x3b')]=_['intersection'](_0x305aa3['model'],qs['fields'](_0x59cfa2[_0x2987('0x38')]['fields']));_0x129311[_0x2987('0x3b')]=_0x129311[_0x2987('0x3b')][_0x2987('0x3d')]?_0x129311[_0x2987('0x3b')]:_0x305aa3[_0x2987('0x37')];_0x129311[_0x2987('0x5e')]=qs[_0x2987('0x40')](_0x59cfa2[_0x2987('0x38')][_0x2987('0x40')]);_0x129311['where']=qs[_0x2987('0x4d')](_[_0x2987('0x42')](_0x59cfa2['query'],_0x305aa3[_0x2987('0x4d')]));if(_0x59cfa2['query']['filter']){_0x129311['where']=_[_0x2987('0x46')](_0x129311[_0x2987('0x41')],{'$or':_['map'](_0x129311[_0x2987('0x3b')],function(_0x173073){var _0x3ff6df={};_0x3ff6df[_0x173073]={'$like':'%'+_0x59cfa2['query'][_0x2987('0x43')]+'%'};return _0x3ff6df;})});}_0x129311=_[_0x2987('0x46')]({},_0x129311,_0x59cfa2[_0x2987('0x47')]);return _0xd4870d[_0x2987('0xfe')](_0x129311);}})['then'](function(_0x1ff5ca){if(_0x1ff5ca){_0x4a3270=_0x1ff5ca[_0x2987('0x3d')];if(!_0x59cfa2[_0x2987('0x38')][_0x2987('0x3e')](_0x2987('0x3f'))){_0x129311['limit']=qs[_0x2987('0x23')](_0x59cfa2[_0x2987('0x38')][_0x2987('0x23')]);_0x129311['offset']=qs[_0x2987('0x22')](_0x59cfa2[_0x2987('0x38')]['offset']);}return _0xd4870d[_0x2987('0xfe')](_0x129311);}})[_0x2987('0x14')](function(_0x50afa4){if(_0x50afa4){return _0x50afa4?{'count':_0x4a3270,'rows':_0x50afa4}:null;}})['then'](respondWithResult(_0x74c556,null))[_0x2987('0x1e')](handleError(_0x74c556,null));};exports[_0x2987('0x11d')]=function(_0xa51dbe,_0x1c99c7){var _0x33340a=_0xa51dbe['query'][_0x2987('0x11e')]==='false'?_0x2987('0x11f'):_0x2987('0x120');return db[_0x2987('0x33')]['find']({'attributes':['id',_0x33340a],'where':{'id':_0xa51dbe[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x1c99c7,null))[_0x2987('0x14')](function(_0x24e12a){if(_0x24e12a){var _0x22a634=_0x24e12a[_0x33340a];var _0x5b9b7b=_0x22a634&&_0x22a634[_0x2987('0x121')]?_0x22a634[_0x2987('0x121')]:[];_0x1c99c7[_0x2987('0x2e')]({'fromKey':_[_0x2987('0x7a')](_0x22a634['fromKey'])?undefined:_0x22a634[_0x2987('0x122')],'count':_0x5b9b7b[_0x2987('0x3d')],'rows':_0x5b9b7b});}})[_0x2987('0x1e')](handleError(_0x1c99c7,null));};exports[_0x2987('0x123')]=function(_0x107503,_0x28698c){var _0x434f80={'raw':![],'where':{}};var _0x476ef8={};var _0xa050b8={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2987('0x5c')]({'where':{'id':_0x107503[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x28698c,null))[_0x2987('0x14')](function(_0x47a022){if(_0x47a022){_0x476ef8['model']=_[_0x2987('0x39')](db['ChatOfflineMessage'][_0x2987('0x34')]);_0x476ef8[_0x2987('0x38')]=_['keys'](_0x107503['query']);_0x476ef8[_0x2987('0x4d')]=_['intersection'](_0x476ef8[_0x2987('0x37')],_0x476ef8[_0x2987('0x38')]);_0x434f80[_0x2987('0x3b')]=_[_0x2987('0x3a')](_0x476ef8['model'],qs[_0x2987('0x3c')](_0x107503[_0x2987('0x38')][_0x2987('0x3c')]));_0x434f80[_0x2987('0x3b')]=_0x434f80['attributes'][_0x2987('0x3d')]?_0x434f80['attributes']:_0x476ef8[_0x2987('0x37')];if(!_0x107503[_0x2987('0x38')][_0x2987('0x3e')](_0x2987('0x3f'))){_0x434f80['limit']=qs[_0x2987('0x23')](_0x107503[_0x2987('0x38')][_0x2987('0x23')]);_0x434f80[_0x2987('0x22')]=qs[_0x2987('0x22')](_0x107503[_0x2987('0x38')][_0x2987('0x22')]);}_0x434f80[_0x2987('0x5e')]=qs['sort'](_0x107503[_0x2987('0x38')][_0x2987('0x40')]);_0x434f80[_0x2987('0x41')]=qs[_0x2987('0x4d')](_[_0x2987('0x42')](_0x107503[_0x2987('0x38')],_0x476ef8['filters']));_0x434f80[_0x2987('0x41')]['ChatWebsiteId']=_0x47a022['id'];if(_0x107503[_0x2987('0x38')][_0x2987('0x43')]){_0x434f80['where']=_['merge'](_0x434f80[_0x2987('0x41')],{'$or':_['map'](_0x434f80[_0x2987('0x3b')],function(_0x510eca){var _0x53ec5d={};_0x53ec5d[_0x510eca]={'$like':'%'+_0x107503[_0x2987('0x38')]['filter']+'%'};return _0x53ec5d;})});}_0x434f80=_[_0x2987('0x46')]({},_0x434f80,_0x107503[_0x2987('0x47')]);return db[_0x2987('0xcd')]['count']({'where':_0x434f80['where']})[_0x2987('0x14')](function(_0x52bb73){_0xa050b8[_0x2987('0x25')]=_0x52bb73;if(_0x107503[_0x2987('0x38')][_0x2987('0x48')]){_0x434f80[_0x2987('0x4e')]=[{'all':!![]}];}else{_0x434f80[_0x2987('0x4e')]=[{'model':db[_0x2987('0x97')],'as':_0x2987('0xe9'),'required':![]},{'model':db[_0x2987('0xd5')],'as':_0x2987('0x124'),'required':![]}];}return db[_0x2987('0xcd')][_0x2987('0x49')](_0x434f80);})[_0x2987('0x14')](function(_0x23f046){_0xa050b8[_0x2987('0x4a')]=_0x23f046;return _0xa050b8;});}})[_0x2987('0x14')](respondWithFilteredResult(_0x28698c,_0x434f80))[_0x2987('0x1e')](handleError(_0x28698c,null));};exports[_0x2987('0x125')]=function(_0x392e38,_0x586e62){return db[_0x2987('0x33')][_0x2987('0x4f')]({'where':{'id':_0x392e38[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x586e62,null))['then'](function(_0x583294){if(_0x583294){return _0x583294['addAgents'](_0x392e38[_0x2987('0x58')][_0x2987('0x60')],_[_0x2987('0xe7')](_0x392e38[_0x2987('0x58')],[_0x2987('0x60'),'id'])||{})[_0x2987('0xae')](function(_0x1357f8){for(var _0x3823f1=0x0;_0x3823f1<_0x392e38[_0x2987('0x58')][_0x2987('0x60')][_0x2987('0x3d')];_0x3823f1+=0x1){socket[_0x2987('0x126')](_0x2987('0x127'),{'UserId':Number(_0x392e38[_0x2987('0x58')][_0x2987('0x60')][_0x3823f1]),'ChatWebsiteId':Number(_0x392e38['params']['id'])});}return _0x1357f8;});}})[_0x2987('0x14')](respondWithResult(_0x586e62,null))[_0x2987('0x1e')](handleError(_0x586e62,null));};exports['removeAgents']=function(_0x279c28,_0x452c7e){return db[_0x2987('0x33')]['find']({'where':{'id':_0x279c28[_0x2987('0x4c')]['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x452c7e,null))[_0x2987('0x14')](function(_0x446a19){if(_0x446a19){return _0x446a19[_0x2987('0x128')](_0x279c28['query'][_0x2987('0x60')])[_0x2987('0x14')](function(){if(_[_0x2987('0x129')](_0x279c28[_0x2987('0x38')][_0x2987('0x60')])){for(var _0x1f9626=0x0;_0x1f9626<_0x279c28['query'][_0x2987('0x60')][_0x2987('0x3d')];_0x1f9626+=0x1){socket[_0x2987('0x126')](_0x2987('0x12a'),{'UserId':Number(_0x279c28[_0x2987('0x38')][_0x2987('0x60')][_0x1f9626]),'ChatWebsiteId':Number(_0x279c28['params']['id'])});}}else{socket[_0x2987('0x126')]('userChatWebsite:remove',{'UserId':Number(_0x279c28[_0x2987('0x38')][_0x2987('0x60')]),'ChatWebsiteId':Number(_0x279c28[_0x2987('0x4c')]['id'])});}});}})[_0x2987('0x14')](respondWithStatusCode(_0x452c7e,null))['catch'](handleError(_0x452c7e,null));};exports[_0x2987('0x12b')]=function(_0x504af3,_0x306fef){var _0x11bc92={};var _0x117eb9={};var _0x5d0f20;var _0x280267;return db['ChatWebsite']['findOne']({'where':{'id':_0x504af3['params']['id']}})[_0x2987('0x14')](handleEntityNotFound(_0x306fef,null))[_0x2987('0x14')](function(_0x3ee294){if(_0x3ee294){_0x5d0f20=_0x3ee294;_0x117eb9[_0x2987('0x37')]=_[_0x2987('0x39')](db[_0x2987('0xea')]['rawAttributes']);_0x117eb9[_0x2987('0x38')]=_[_0x2987('0x39')](_0x504af3[_0x2987('0x38')]);_0x117eb9[_0x2987('0x4d')]=_[_0x2987('0x3a')](_0x117eb9[_0x2987('0x37')],_0x117eb9[_0x2987('0x38')]);_0x11bc92[_0x2987('0x3b')]=_[_0x2987('0x3a')](_0x117eb9[_0x2987('0x37')],qs[_0x2987('0x3c')](_0x504af3[_0x2987('0x38')][_0x2987('0x3c')]));_0x11bc92[_0x2987('0x3b')]=_0x11bc92[_0x2987('0x3b')][_0x2987('0x3d')]?_0x11bc92[_0x2987('0x3b')]:_0x117eb9['model'];_0x11bc92[_0x2987('0x5e')]=qs['sort'](_0x504af3['query'][_0x2987('0x40')]);_0x11bc92[_0x2987('0x41')]=qs['filters'](_[_0x2987('0x42')](_0x504af3[_0x2987('0x38')],_0x117eb9[_0x2987('0x4d')]));if(_0x504af3[_0x2987('0x38')][_0x2987('0x43')]){_0x11bc92['where']=_['merge'](_0x11bc92['where'],{'$or':_[_0x2987('0x32')](_0x11bc92[_0x2987('0x3b')],function(_0x910040){var _0xbbb828={};_0xbbb828[_0x910040]={'$like':'%'+_0x504af3[_0x2987('0x38')][_0x2987('0x43')]+'%'};return _0xbbb828;})});}_0x11bc92=_[_0x2987('0x46')]({},_0x11bc92,_0x504af3[_0x2987('0x47')]);return _0x5d0f20[_0x2987('0x12b')](_0x11bc92);}})[_0x2987('0x14')](function(_0x21c061){if(_0x21c061){_0x280267=_0x21c061[_0x2987('0x3d')];if(!_0x504af3[_0x2987('0x38')][_0x2987('0x3e')](_0x2987('0x3f'))){_0x11bc92[_0x2987('0x23')]=qs[_0x2987('0x23')](_0x504af3[_0x2987('0x38')]['limit']);_0x11bc92['offset']=qs[_0x2987('0x22')](_0x504af3[_0x2987('0x38')]['offset']);}return _0x5d0f20['getAgents'](_0x11bc92);}})['then'](function(_0x2f7070){if(_0x2f7070){return _0x2f7070?{'count':_0x280267,'rows':_0x2f7070}:null;}})[_0x2987('0x14')](respondWithResult(_0x306fef,null))[_0x2987('0x1e')](handleError(_0x306fef,null));}; \ No newline at end of file +var _0x7b27=['removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','addSystemAvatar','getLogo','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','root','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','systemAvatar','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','externalUrl','ChatInteraction','interaction','messageId','created','autoclose','push','unmanaged','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','findOne','MailServerOut','CloudProvider','Smtp','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','User','Owner','Tags','color','tag','Command','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','utf8','remote','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','items','fromKey','getOfflineMessages','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','isArray','getAgents','mustache','util','path','ejs','fs-extra','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','get','ChatWebsites','destroy','stack','name','send','index','Pause','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','ChatWebsite','then','includeAll','include','rows','catch','show','params','mandatoryDispositionPause','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','rawAttributes','hasOwnProperty','findAll'];(function(_0x1a6156,_0x85c3c){var _0x480dda=function(_0x1c5710){while(--_0x1c5710){_0x1a6156['push'](_0x1a6156['shift']());}};_0x480dda(++_0x85c3c);}(_0x7b27,0xcd));var _0x77b2=function(_0x43e740,_0x46b998){_0x43e740=_0x43e740-0x0;var _0x8da82b=_0x7b27[_0x43e740];return _0x8da82b;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x77b2('0x0'));var util=require(_0x77b2('0x1'));var path=require(_0x77b2('0x2'));var ejs=require(_0x77b2('0x3'));var fs=require('fs');var fs_extra=require(_0x77b2('0x4'));var _=require(_0x77b2('0x5'));var querystring=require('querystring');var Redis=require(_0x77b2('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x77b2('0x7'))(_0x77b2('0x8'));var config=require(_0x77b2('0x9'));var db=require(_0x77b2('0xa'))['db'];config[_0x77b2('0xb')]=_[_0x77b2('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x77b2('0xd'))(new Redis(config['redis']));require(_0x77b2('0xe'))[_0x77b2('0xf')](socket);var htmlToText=require(_0x77b2('0x10'));var jayson=require('jayson/promise');var client=jayson[_0x77b2('0x11')]['http']({'port':0x232c});var client9002=jayson[_0x77b2('0x11')][_0x77b2('0x12')]({'port':0x232a});var client9003=jayson['client'][_0x77b2('0x12')]({'port':0x232b});var client9001=jayson[_0x77b2('0x11')][_0x77b2('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x2b1b98,_0x4c1bf0,_0x14035c,_0x1dea48){return new BPromise(function(_0x1c66aa,_0x2e3375){var _0x1160ac=_0x1dea48||client;return _0x1160ac[_0x77b2('0x13')](_0x2b1b98,_0x14035c)['then'](function(_0x382c16){logger[_0x77b2('0x14')](_0x77b2('0x15'),_0x4c1bf0,_0x77b2('0x16'));logger[_0x77b2('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4c1bf0,'request\x20sent',JSON[_0x77b2('0x18')](_0x382c16));if(_0x382c16[_0x77b2('0x19')]){if(_0x382c16[_0x77b2('0x19')]['code']===0x1f4){logger['error'](_0x77b2('0x15'),_0x4c1bf0,_0x382c16['error'][_0x77b2('0x1a')]);return _0x2e3375(_0x382c16['error'][_0x77b2('0x1a')]);}logger[_0x77b2('0x19')](_0x77b2('0x15'),_0x4c1bf0,_0x382c16[_0x77b2('0x19')]['message']);return _0x1c66aa(_0x382c16[_0x77b2('0x19')][_0x77b2('0x1a')]);}else{logger['info'](_0x77b2('0x15'),_0x4c1bf0,'request\x20sent');_0x1c66aa(_0x382c16[_0x77b2('0x1b')][_0x77b2('0x1a')]);}})['catch'](function(_0x3c368d){logger[_0x77b2('0x19')](_0x77b2('0x15'),_0x4c1bf0,_0x3c368d);_0x2e3375(_0x3c368d);});});}function respondWithStatusCode(_0x3afdf9,_0x3d3efd){_0x3d3efd=_0x3d3efd||0xcc;return function(_0xd8f3ae){if(_0xd8f3ae){return _0x3afdf9[_0x77b2('0x1c')](_0x3d3efd);}return _0x3afdf9[_0x77b2('0x1d')](_0x3d3efd)[_0x77b2('0x1e')]();};}function respondWithResult(_0x499a2a,_0xd58b29){_0xd58b29=_0xd58b29||0xc8;return function(_0x1d04f4){if(_0x1d04f4){return _0x499a2a[_0x77b2('0x1d')](_0xd58b29)[_0x77b2('0x1f')](_0x1d04f4);}};}function respondWithFilteredResult(_0x7b5074,_0x5cb6e8){return function(_0x30d06d){if(_0x30d06d){var _0x16fdd8=typeof _0x5cb6e8[_0x77b2('0x20')]==='undefined'&&typeof _0x5cb6e8[_0x77b2('0x21')]===_0x77b2('0x22');var _0x2b3ab4=_0x30d06d['count'];var _0x1274ec=_0x16fdd8?0x0:_0x5cb6e8[_0x77b2('0x20')];var _0x352a81=_0x16fdd8?_0x30d06d[_0x77b2('0x23')]:_0x5cb6e8[_0x77b2('0x20')]+_0x5cb6e8['limit'];var _0x4b742a;if(_0x352a81>=_0x2b3ab4){_0x352a81=_0x2b3ab4;_0x4b742a=0xc8;}else{_0x4b742a=0xce;}_0x7b5074[_0x77b2('0x1d')](_0x4b742a);return _0x7b5074[_0x77b2('0x24')]('Content-Range',_0x1274ec+'-'+_0x352a81+'/'+_0x2b3ab4)[_0x77b2('0x1f')](_0x30d06d);}return null;};}function saveUpdates(_0x39c562){return function(_0x564d18){if(_0x564d18){return _0x564d18['update'](_0x39c562)['then'](function(_0x6760ec){return _0x6760ec;});}return null;};}function removeEntity(_0x46e891){return function(_0x492084){if(_0x492084){return _0x492084['destroy']()['then'](function(){var _0x5a1281=_0x492084[_0x77b2('0x25')]({'plain':!![]});var _0x33a29d=_0x77b2('0x26');return db['UserProfileResource'][_0x77b2('0x27')]({'where':{'type':_0x33a29d,'resourceId':_0x5a1281['id']}})['then'](function(){return _0x492084;});})['then'](function(){_0x46e891[_0x77b2('0x1d')](0xcc)[_0x77b2('0x1e')]();});}};}function handleEntityNotFound(_0x4eca3c){return function(_0x4e5319){if(!_0x4e5319){_0x4eca3c[_0x77b2('0x1c')](0x194);}return _0x4e5319;};}function handleError(_0x4f1638,_0xb0a5b4){_0xb0a5b4=_0xb0a5b4||0x1f4;return function(_0x2fe189){logger[_0x77b2('0x19')](_0x2fe189[_0x77b2('0x28')]);if(_0x2fe189['name']){delete _0x2fe189[_0x77b2('0x29')];}_0x4f1638[_0x77b2('0x1d')](_0xb0a5b4)[_0x77b2('0x2a')](_0x2fe189);};}exports[_0x77b2('0x2b')]=function(_0x2e548c,_0x231629){var _0x365fbd={'include':[{'model':db[_0x77b2('0x2c')],'as':'mandatoryDispositionPause'}]},_0x286a50={},_0x3d1d01={'count':0x0,'rows':[]};var _0x1cf765=_['map'](db['ChatWebsite']['rawAttributes'],function(_0x208e66){return{'name':_0x208e66[_0x77b2('0x2d')],'type':_0x208e66[_0x77b2('0x2e')][_0x77b2('0x2f')]};});_0x286a50[_0x77b2('0x30')]=_[_0x77b2('0x31')](_0x1cf765,'name');_0x286a50[_0x77b2('0x32')]=_['keys'](_0x2e548c['query']);_0x286a50[_0x77b2('0x33')]=_['intersection'](_0x286a50[_0x77b2('0x30')],_0x286a50['query']);_0x365fbd[_0x77b2('0x34')]=_[_0x77b2('0x35')](_0x286a50['model'],qs[_0x77b2('0x36')](_0x2e548c[_0x77b2('0x32')][_0x77b2('0x36')]));_0x365fbd['attributes']=_0x365fbd[_0x77b2('0x34')][_0x77b2('0x37')]?_0x365fbd[_0x77b2('0x34')]:_0x286a50['model'];if(!_0x2e548c[_0x77b2('0x32')]['hasOwnProperty'](_0x77b2('0x38'))){_0x365fbd[_0x77b2('0x21')]=qs['limit'](_0x2e548c['query'][_0x77b2('0x21')]);_0x365fbd[_0x77b2('0x20')]=qs['offset'](_0x2e548c[_0x77b2('0x32')][_0x77b2('0x20')]);}_0x365fbd[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0x2e548c['query']['sort']);_0x365fbd['where']=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0x2e548c[_0x77b2('0x32')],_0x286a50[_0x77b2('0x33')]),_0x1cf765);if(_0x2e548c['query'][_0x77b2('0x3c')]){_0x365fbd['where']=_[_0x77b2('0x3d')](_0x365fbd[_0x77b2('0x3e')],{'$or':_[_0x77b2('0x31')](_0x1cf765,function(_0x18efe7){if(_0x18efe7['type']!==_0x77b2('0x3f')){var _0x529388={};_0x529388[_0x18efe7[_0x77b2('0x29')]]={'$like':'%'+_0x2e548c[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x529388;}})});}_0x365fbd=_[_0x77b2('0x3d')]({},_0x365fbd,_0x2e548c[_0x77b2('0x40')]);var _0x54ca7f={'where':_0x365fbd[_0x77b2('0x3e')]};return db[_0x77b2('0x41')][_0x77b2('0x23')](_0x54ca7f)[_0x77b2('0x42')](function(_0x24150a){_0x3d1d01[_0x77b2('0x23')]=_0x24150a;if(_0x2e548c['query'][_0x77b2('0x43')]){_0x365fbd[_0x77b2('0x44')]=[{'all':!![]}];}return db[_0x77b2('0x41')]['findAll'](_0x365fbd);})[_0x77b2('0x42')](function(_0xd53b81){_0x3d1d01[_0x77b2('0x45')]=_0xd53b81;return _0x3d1d01;})[_0x77b2('0x42')](respondWithFilteredResult(_0x231629,_0x365fbd))[_0x77b2('0x46')](handleError(_0x231629,null));};exports[_0x77b2('0x47')]=function(_0x2b3ef5,_0x5a6332){var _0x63f01d={'raw':![],'where':{'id':_0x2b3ef5[_0x77b2('0x48')]['id']},'include':[{'model':db[_0x77b2('0x2c')],'as':_0x77b2('0x49')}]},_0x18c2a9={};_0x18c2a9['model']=_[_0x77b2('0x4a')](db[_0x77b2('0x41')]['rawAttributes']);_0x18c2a9[_0x77b2('0x32')]=_[_0x77b2('0x4a')](_0x2b3ef5[_0x77b2('0x32')]);_0x18c2a9[_0x77b2('0x33')]=_[_0x77b2('0x35')](_0x18c2a9[_0x77b2('0x30')],_0x18c2a9['query']);_0x63f01d['attributes']=_['intersection'](_0x18c2a9[_0x77b2('0x30')],qs[_0x77b2('0x36')](_0x2b3ef5['query']['fields']));_0x63f01d['attributes']=_0x63f01d[_0x77b2('0x34')][_0x77b2('0x37')]?_0x63f01d[_0x77b2('0x34')]:_0x18c2a9[_0x77b2('0x30')];if(_0x2b3ef5['query'][_0x77b2('0x43')]){_0x63f01d[_0x77b2('0x44')]=[{'all':!![]}];}_0x63f01d=_['merge']({},_0x63f01d,_0x2b3ef5[_0x77b2('0x40')]);return db[_0x77b2('0x41')][_0x77b2('0x4b')](_0x63f01d)[_0x77b2('0x42')](handleEntityNotFound(_0x5a6332,null))[_0x77b2('0x42')](respondWithResult(_0x5a6332,null))[_0x77b2('0x46')](handleError(_0x5a6332,null));};exports[_0x77b2('0x4c')]=function(_0x1ff353,_0x1be355){return db[_0x77b2('0x41')][_0x77b2('0x4c')](_0x1ff353[_0x77b2('0x4d')],{})[_0x77b2('0x42')](function(_0x384711){var _0x2ad86d=_0x1ff353[_0x77b2('0x4e')][_0x77b2('0x25')]({'plain':!![]});if(!_0x2ad86d)throw new Error(_0x77b2('0x4f'));if(_0x2ad86d[_0x77b2('0x50')]===_0x77b2('0x4e')){var _0x53af53=_0x384711[_0x77b2('0x25')]({'plain':!![]});var _0x4700dc=_0x77b2('0x26');return db['UserProfileSection'][_0x77b2('0x4b')]({'where':{'name':_0x4700dc,'userProfileId':_0x2ad86d[_0x77b2('0x51')]},'raw':!![]})[_0x77b2('0x42')](function(_0x2a35d0){if(_0x2a35d0&&_0x2a35d0['autoAssociation']===0x0){return db['UserProfileResource'][_0x77b2('0x4c')]({'name':_0x53af53[_0x77b2('0x29')],'resourceId':_0x53af53['id'],'type':_0x2a35d0['name'],'sectionId':_0x2a35d0['id']},{})['then'](function(){return _0x384711;});}else{return _0x384711;}})[_0x77b2('0x46')](function(_0x5e2e74){logger[_0x77b2('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e2e74);throw _0x5e2e74;});}return _0x384711;})[_0x77b2('0x42')](respondWithResult(_0x1be355,0xc9))[_0x77b2('0x46')](handleError(_0x1be355,null));};exports[_0x77b2('0x52')]=function(_0x4153cf,_0x3cfed6){if(_0x4153cf[_0x77b2('0x4d')]['id']){delete _0x4153cf[_0x77b2('0x4d')]['id'];}return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x4153cf[_0x77b2('0x48')]['id']},'include':[{'model':db[_0x77b2('0x2c')],'as':_0x77b2('0x49')}]})[_0x77b2('0x42')](handleEntityNotFound(_0x3cfed6,null))[_0x77b2('0x42')](saveUpdates(_0x4153cf[_0x77b2('0x4d')],null))[_0x77b2('0x42')](respondWithResult(_0x3cfed6,null))[_0x77b2('0x46')](handleError(_0x3cfed6,null));};exports['destroy']=function(_0x45ea0c,_0x6ff435){return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x45ea0c[_0x77b2('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ff435,null))[_0x77b2('0x42')](removeEntity(_0x6ff435,null))['catch'](handleError(_0x6ff435,null));};exports[_0x77b2('0x53')]=function(_0xa58ba5,_0x162753){return db[_0x77b2('0x41')][_0x77b2('0x53')]()[_0x77b2('0x42')](respondWithResult(_0x162753,null))[_0x77b2('0x46')](handleError(_0x162753,null));};exports[_0x77b2('0x54')]=function(_0x491ddc,_0x28f4ba){if(_0x491ddc[_0x77b2('0x4d')]['id']){delete _0x491ddc[_0x77b2('0x4d')]['id'];}return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x491ddc['params']['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x28f4ba,null))['then'](function(_0x1b3d15){if(_0x1b3d15){_0x491ddc[_0x77b2('0x4d')][_0x77b2('0x55')]=_0x1b3d15['id'];return db[_0x77b2('0x56')][_0x77b2('0x4c')](_0x491ddc['body']);}})[_0x77b2('0x42')](respondWithResult(_0x28f4ba,null))[_0x77b2('0x46')](handleError(_0x28f4ba,null));};exports[_0x77b2('0x57')]=function(_0x337701,_0xa9618d){var _0x327384={'raw':![],'where':{}};var _0x23eb45={};var _0x25cf2f={'count':0x0,'rows':[]};return db[_0x77b2('0x41')]['findOne']({'where':{'id':_0x337701[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0xa9618d,null))[_0x77b2('0x42')](function(_0x300838){if(_0x300838){_0x23eb45['model']=_[_0x77b2('0x4a')](db[_0x77b2('0x56')][_0x77b2('0x58')]);_0x23eb45[_0x77b2('0x32')]=_[_0x77b2('0x4a')](_0x337701[_0x77b2('0x32')]);_0x23eb45['filters']=_[_0x77b2('0x35')](_0x23eb45[_0x77b2('0x30')],_0x23eb45[_0x77b2('0x32')]);_0x327384[_0x77b2('0x34')]=_[_0x77b2('0x35')](_0x23eb45[_0x77b2('0x30')],qs[_0x77b2('0x36')](_0x337701[_0x77b2('0x32')][_0x77b2('0x36')]));_0x327384[_0x77b2('0x34')]=_0x327384[_0x77b2('0x34')]['length']?_0x327384[_0x77b2('0x34')]:_0x23eb45[_0x77b2('0x30')];if(!_0x337701['query'][_0x77b2('0x59')](_0x77b2('0x38'))){_0x327384[_0x77b2('0x21')]=qs[_0x77b2('0x21')](_0x337701[_0x77b2('0x32')]['limit']);_0x327384[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x337701['query'][_0x77b2('0x20')]);}_0x327384[_0x77b2('0x39')]=qs['sort'](_0x337701[_0x77b2('0x32')]['sort']);_0x327384[_0x77b2('0x3e')]=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0x337701['query'],_0x23eb45[_0x77b2('0x33')]));_0x327384['where'][_0x77b2('0x55')]=_0x300838['id'];if(_0x337701[_0x77b2('0x32')][_0x77b2('0x3c')]){_0x327384[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x327384[_0x77b2('0x3e')],{'$or':_[_0x77b2('0x31')](_0x327384[_0x77b2('0x34')],function(_0x3427e2){var _0x413053={};_0x413053[_0x3427e2]={'$like':'%'+_0x337701[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x413053;})});}_0x327384=_[_0x77b2('0x3d')]({},_0x327384,_0x337701[_0x77b2('0x40')]);return db['Disposition'][_0x77b2('0x23')]({'where':_0x327384[_0x77b2('0x3e')]})[_0x77b2('0x42')](function(_0x5dde9f){_0x25cf2f[_0x77b2('0x23')]=_0x5dde9f;if(_0x337701[_0x77b2('0x32')][_0x77b2('0x43')]){_0x327384[_0x77b2('0x44')]=[{'all':!![]}];}return db[_0x77b2('0x56')][_0x77b2('0x5a')](_0x327384);})['then'](function(_0x1a2770){_0x25cf2f[_0x77b2('0x45')]=_0x1a2770;return _0x25cf2f;});}})[_0x77b2('0x42')](respondWithFilteredResult(_0xa9618d,_0x327384))[_0x77b2('0x46')](handleError(_0xa9618d,null));};exports[_0x77b2('0x5b')]=function(_0x2cf7a5,_0x2c4301){return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x2cf7a5['params']['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x2c4301,null))[_0x77b2('0x42')](function(_0xcf7df7){if(_0xcf7df7){return _0xcf7df7[_0x77b2('0x5b')](_0x2cf7a5[_0x77b2('0x32')][_0x77b2('0x5c')]);}})[_0x77b2('0x42')](respondWithStatusCode(_0x2c4301,null))[_0x77b2('0x46')](handleError(_0x2c4301,null));};exports[_0x77b2('0x5d')]=function(_0x24202e,_0x330748){if(_0x24202e[_0x77b2('0x4d')]['id']){delete _0x24202e[_0x77b2('0x4d')]['id'];}return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x24202e[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x330748,null))['then'](function(_0x57212f){if(_0x57212f){_0x24202e['body'][_0x77b2('0x55')]=_0x57212f['id'];return db[_0x77b2('0x5e')][_0x77b2('0x4c')](_0x24202e[_0x77b2('0x4d')]);}})['then'](respondWithResult(_0x330748,null))['catch'](handleError(_0x330748,null));};exports[_0x77b2('0x5f')]=function(_0x3c5136,_0x38b97d){var _0x4f4076={'raw':![],'where':{}};var _0x1f5dd4={};var _0xd23003={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x3c5136[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x38b97d,null))['then'](function(_0x361e43){if(_0x361e43){_0x1f5dd4[_0x77b2('0x30')]=_['keys'](db[_0x77b2('0x5e')][_0x77b2('0x58')]);_0x1f5dd4['query']=_[_0x77b2('0x4a')](_0x3c5136[_0x77b2('0x32')]);_0x1f5dd4[_0x77b2('0x33')]=_[_0x77b2('0x35')](_0x1f5dd4[_0x77b2('0x30')],_0x1f5dd4[_0x77b2('0x32')]);_0x4f4076[_0x77b2('0x34')]=_[_0x77b2('0x35')](_0x1f5dd4[_0x77b2('0x30')],qs[_0x77b2('0x36')](_0x3c5136[_0x77b2('0x32')]['fields']));_0x4f4076[_0x77b2('0x34')]=_0x4f4076[_0x77b2('0x34')][_0x77b2('0x37')]?_0x4f4076['attributes']:_0x1f5dd4[_0x77b2('0x30')];if(!_0x3c5136['query']['hasOwnProperty'](_0x77b2('0x38'))){_0x4f4076[_0x77b2('0x21')]=qs['limit'](_0x3c5136[_0x77b2('0x32')][_0x77b2('0x21')]);_0x4f4076[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x3c5136[_0x77b2('0x32')][_0x77b2('0x20')]);}_0x4f4076[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0x3c5136[_0x77b2('0x32')][_0x77b2('0x3a')]);_0x4f4076[_0x77b2('0x3e')]=qs['filters'](_[_0x77b2('0x3b')](_0x3c5136[_0x77b2('0x32')],_0x1f5dd4[_0x77b2('0x33')]));_0x4f4076['where'][_0x77b2('0x55')]=_0x361e43['id'];if(_0x3c5136[_0x77b2('0x32')][_0x77b2('0x3c')]){_0x4f4076[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x4f4076[_0x77b2('0x3e')],{'$or':_['map'](_0x4f4076[_0x77b2('0x34')],function(_0x4923f3){var _0x2bca17={};_0x2bca17[_0x4923f3]={'$like':'%'+_0x3c5136[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x2bca17;})});}_0x4f4076=_[_0x77b2('0x3d')]({},_0x4f4076,_0x3c5136[_0x77b2('0x40')]);return db[_0x77b2('0x5e')]['count']({'where':_0x4f4076[_0x77b2('0x3e')]})[_0x77b2('0x42')](function(_0x505b62){_0xd23003['count']=_0x505b62;if(_0x3c5136[_0x77b2('0x32')][_0x77b2('0x43')]){_0x4f4076[_0x77b2('0x44')]=[{'all':!![]}];}return db[_0x77b2('0x5e')][_0x77b2('0x5a')](_0x4f4076);})[_0x77b2('0x42')](function(_0x46a9de){_0xd23003[_0x77b2('0x45')]=_0x46a9de;return _0xd23003;});}})[_0x77b2('0x42')](respondWithFilteredResult(_0x38b97d,_0x4f4076))[_0x77b2('0x46')](handleError(_0x38b97d,null));};exports[_0x77b2('0x60')]=function(_0x153ec9,_0x3a31fb){return db['ChatWebsite']['find']({'where':{'id':_0x153ec9[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x3a31fb,null))[_0x77b2('0x42')](function(_0x2de514){if(_0x2de514){return _0x2de514[_0x77b2('0x60')](_0x153ec9[_0x77b2('0x32')][_0x77b2('0x5c')]);}})['then'](respondWithStatusCode(_0x3a31fb,null))[_0x77b2('0x46')](handleError(_0x3a31fb,null));};exports[_0x77b2('0x61')]=function(_0x5b398e,_0x1aae9){_0x5b398e['body'][_0x77b2('0x62')]=_0x5b398e['file'][_0x77b2('0x63')];return db['ChatWebsite'][_0x77b2('0x4b')]({'where':{'id':_0x5b398e[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x1aae9,null))[_0x77b2('0x42')](saveUpdates(_0x5b398e[_0x77b2('0x4d')],null))[_0x77b2('0x42')](respondWithResult(_0x1aae9,null))[_0x77b2('0x46')](handleError(_0x1aae9,null));};exports[_0x77b2('0x64')]=function(_0x53b777,_0x539682){_0x53b777[_0x77b2('0x4d')][_0x77b2('0x65')]=_0x53b777[_0x77b2('0x66')]['filename'];return db[_0x77b2('0x41')]['find']({'where':{'id':_0x53b777[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x539682,null))[_0x77b2('0x42')](saveUpdates(_0x53b777['body'],null))[_0x77b2('0x42')](respondWithResult(_0x539682,null))[_0x77b2('0x46')](handleError(_0x539682,null));};exports[_0x77b2('0x67')]=function(_0x4c7e75,_0x26c410){_0x4c7e75[_0x77b2('0x4d')]['customerAvatar']=_0x4c7e75[_0x77b2('0x66')][_0x77b2('0x63')];return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x4c7e75[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x26c410,null))[_0x77b2('0x42')](saveUpdates(_0x4c7e75[_0x77b2('0x4d')],null))['then'](respondWithResult(_0x26c410,null))[_0x77b2('0x46')](handleError(_0x26c410,null));};exports[_0x77b2('0x68')]=function(_0x36deda,_0x2c0fa8){_0x36deda[_0x77b2('0x4d')]['systemAvatar']=_0x36deda[_0x77b2('0x66')][_0x77b2('0x63')];return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x36deda['params']['id']}})['then'](handleEntityNotFound(_0x2c0fa8,null))[_0x77b2('0x42')](saveUpdates(_0x36deda[_0x77b2('0x4d')],null))[_0x77b2('0x42')](respondWithResult(_0x2c0fa8,null))['catch'](handleError(_0x2c0fa8,null));};exports[_0x77b2('0x69')]=function(_0x2a2516,_0x2c5d9e){var _0xf884c8=path['join'](config['root'],_0x77b2('0x6a'));var _0x159df7={'where':{'id':_0x2a2516[_0x77b2('0x48')]['id']},'attributes':['id',_0x77b2('0x62')],'raw':!![]};var _0x4100f1=![];return require(_0x77b2('0x6b'))[_0x77b2('0x6c')]()[_0x77b2('0x42')](function(_0x4be6da){if(_0x4be6da){_0x4100f1=_0x4be6da[_0x77b2('0x6d')];}})[_0x77b2('0x42')](function(){return db[_0x77b2('0x41')][_0x77b2('0x4b')](_0x159df7);})[_0x77b2('0x42')](handleEntityNotFound(_0x2c5d9e,null))[_0x77b2('0x42')](function(_0x39405b){if(_0x39405b){if(!_[_0x77b2('0x6e')](_0x39405b[_0x77b2('0x62')])){if(fs[_0x77b2('0x6f')](path[_0x77b2('0x70')](config['root'],_0x77b2('0x71'),_0x39405b[_0x77b2('0x62')]))&&_0x4100f1){_0xf884c8=path[_0x77b2('0x70')](config[_0x77b2('0x72')],_0x77b2('0x71'),_0x39405b[_0x77b2('0x62')]);}}return _0x2c5d9e['download'](_0xf884c8);}})[_0x77b2('0x46')](handleError(_0x2c5d9e,null));};exports[_0x77b2('0x73')]=function(_0x48c85b,_0x42d385){var _0x2700dd=path['join'](config['root'],_0x77b2('0x74'));var _0x4313de={'where':{'id':_0x48c85b[_0x77b2('0x48')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0x77b2('0x4b')](_0x4313de)[_0x77b2('0x42')](handleEntityNotFound(_0x42d385,null))['then'](function(_0x1d2abe){if(_0x1d2abe){if(!_['isNil'](_0x1d2abe[_0x77b2('0x65')])){if(fs[_0x77b2('0x6f')](path['join'](config[_0x77b2('0x72')],'server/files/images/avatars/',_0x1d2abe[_0x77b2('0x65')]))){_0x2700dd=path[_0x77b2('0x70')](config[_0x77b2('0x72')],_0x77b2('0x75'),_0x1d2abe[_0x77b2('0x65')]);}}return _0x42d385[_0x77b2('0x76')](_0x2700dd);}})['catch'](handleError(_0x42d385,null));};exports[_0x77b2('0x77')]=function(_0x511b83,_0x54e3e9){var _0x1538ed=path['join'](config[_0x77b2('0x72')],_0x77b2('0x78'));var _0x3e3f53={'where':{'id':_0x511b83[_0x77b2('0x48')]['id']},'attributes':['id',_0x77b2('0x79'),_0x77b2('0x7a')],'raw':!![]};return db[_0x77b2('0x41')][_0x77b2('0x4b')](_0x3e3f53)[_0x77b2('0x42')](handleEntityNotFound(_0x54e3e9,null))[_0x77b2('0x42')](function(_0x5a392f){if(_0x5a392f){if(!_[_0x77b2('0x6e')](_0x5a392f[_0x77b2('0x79')])){if(fs['existsSync'](path[_0x77b2('0x70')](config[_0x77b2('0x72')],'server/files/images/avatars/',_0x5a392f[_0x77b2('0x79')]))&&_0x5a392f[_0x77b2('0x7a')]){_0x1538ed=path['join'](config[_0x77b2('0x72')],'server/files/images/avatars/',_0x5a392f[_0x77b2('0x79')]);}}return _0x54e3e9[_0x77b2('0x76')](_0x1538ed);}})[_0x77b2('0x46')](handleError(_0x54e3e9,null));};exports[_0x77b2('0x7b')]=function(_0xb15f70,_0x172b6f){var _0x3b0f91=path[_0x77b2('0x70')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x461372={'where':{'id':_0xb15f70['params']['id']},'attributes':['id',_0x77b2('0x7c')],'raw':!![]};return db['ChatWebsite'][_0x77b2('0x4b')](_0x461372)['then'](handleEntityNotFound(_0x172b6f,null))[_0x77b2('0x42')](function(_0x320e0a){if(_0x320e0a){if(!_['isNil'](_0x320e0a['systemAvatar'])){if(fs[_0x77b2('0x6f')](path[_0x77b2('0x70')](config[_0x77b2('0x72')],_0x77b2('0x75'),_0x320e0a[_0x77b2('0x7c')]))){_0x3b0f91=path[_0x77b2('0x70')](config[_0x77b2('0x72')],'server/files/images/avatars/',_0x320e0a[_0x77b2('0x7c')]);}}return _0x172b6f['download'](_0x3b0f91);}})['catch'](handleError(_0x172b6f,null));};exports[_0x77b2('0x7d')]=function(_0x5bd3c5,_0xcd4e63){var _0x5e719c=require(_0x77b2('0x7e'));var _0x45a744=new _0x5e719c();var _0x46ee60=_0x45a744['setUA'](_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0x80')])[_0x77b2('0x81')]();var _0x411b6b={'body':_0x5bd3c5['body'],'channel':_0x77b2('0x82')};var _0x15c656=[];var _0x565842=[];var _0x3772af={};var _0x4403ea=![];return db[_0x77b2('0x83')][_0x77b2('0x53')]()[_0x77b2('0x42')](function(_0x16e6b9){if(!_0x16e6b9){throw new db['Sequelize'][(_0x77b2('0x84'))](_0x77b2('0x85'));}_0x15c656=_[_0x77b2('0x86')](_[_0x77b2('0x4a')](_0x16e6b9),[_0x77b2('0x87'),_0x77b2('0x88')]);_0x565842=_['difference'](_[_0x77b2('0x4a')](_0x16e6b9),[_0x77b2('0x87'),_0x77b2('0x88'),_0x77b2('0x89'),_0x77b2('0x8a')]);if(_0x5bd3c5[_0x77b2('0x4d')]['id']){delete _0x5bd3c5['body']['id'];}if(_[_0x77b2('0x6e')](_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x8b')])){throw new db[(_0x77b2('0x8c'))]['ValidationError'](_0x77b2('0x8d'));}if(_[_0x77b2('0x6e')](_0x5bd3c5[_0x77b2('0x4d')]['body'])||_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x4d')]===''){throw new db[(_0x77b2('0x8c'))]['ValidationError'](_0x77b2('0x8e'));}if(_[_0x77b2('0x6e')](_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x8f')])){throw new db[(_0x77b2('0x8c'))][(_0x77b2('0x84'))](_0x77b2('0x90')+_0x565842);}if(!_['includes'](_0x565842,_0x5bd3c5['body'][_0x77b2('0x8f')])){throw new db['Sequelize'][(_0x77b2('0x84'))](_0x77b2('0x91')+_0x565842);}_0x3772af[_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x8f')]]=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x8b')];})[_0x77b2('0x42')](function(){return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x5bd3c5[_0x77b2('0x48')]['id']},'include':[{'model':db[_0x77b2('0x92')],'as':_0x77b2('0x93'),'include':[{'model':db['CmContact'],'as':_0x77b2('0x94'),'where':_0x3772af,'limit':0x1,'order':[[_0x77b2('0x88'),_0x77b2('0x95')]]}]},{'model':db[_0x77b2('0x96')],'as':_0x77b2('0x97')}]});})[_0x77b2('0x42')](handleEntityNotFound(_0xcd4e63,null))[_0x77b2('0x42')](function(_0x5830d8){if(_0x5830d8&&_0x5830d8[_0x77b2('0x93')]){_0x411b6b[_0x77b2('0x98')]=_0x5830d8;_0x411b6b[_0x77b2('0x99')]=_0x5830d8[_0x77b2('0x97')];_0x411b6b[_0x77b2('0x9a')]=_0x5830d8[_0x77b2('0x93')];_0x411b6b['applications']=_[_0x77b2('0x9b')](_0x411b6b[_0x77b2('0x99')],[_0x77b2('0x9c')],[_0x77b2('0x9d')]);if(_0x411b6b['account'][_0x77b2('0x97')]){delete _0x411b6b[_0x77b2('0x98')][_0x77b2('0x97')];}if(_0x411b6b[_0x77b2('0x98')]['List']&&_0x411b6b['account']['List'][_0x77b2('0x94')]['length']){return _0x411b6b['account'][_0x77b2('0x93')][_0x77b2('0x94')][0x0];}var _0x4a8ee2=_[_0x77b2('0xc')](_0x5bd3c5[_0x77b2('0x4d')],{'firstName':_0x5bd3c5['body'][_0x77b2('0x8b')],'ListId':_0x5830d8[_0x77b2('0x8a')]});_0x4a8ee2[_0x5bd3c5['body'][_0x77b2('0x8f')]]=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x8b')];return db[_0x77b2('0x83')][_0x77b2('0x4c')](_0x4a8ee2,{'fields':_0x15c656,'raw':!![]});}})['then'](handleEntityNotFound(_0xcd4e63,null))[_0x77b2('0x42')](function(_0x4b31b6){_0x411b6b[_0x77b2('0x9e')]=_0x4b31b6;var _0x558922=_0x5bd3c5['body']['customerIp'];if(_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0x9f')]){_0x558922=_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0x9f')];}else if(_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0xa0')]){_0x558922=_['first'](_0x5bd3c5[_0x77b2('0x7f')]['x-forwarded-for'][_0x77b2('0xa1')](','));}if(_0x4b31b6){var _0x7e15cc={'ContactId':_0x4b31b6['id'],'ChatWebsiteId':_0x5bd3c5[_0x77b2('0x48')]['id'],'from':(_0x4b31b6[_0x77b2('0xa2')]||'')+'\x20'+(_0x4b31b6[_0x77b2('0xa3')]||''),'customerIp':_0x558922,'customerPort':_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0xa4')]?_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0xa4')]:null,'referer':_0x5bd3c5[_0x77b2('0x4d')]['referer'],'browserName':_0x46ee60[_0x77b2('0xa5')][_0x77b2('0x29')]&&_0x46ee60['browser'][_0x77b2('0xa6')]?util[_0x77b2('0xa7')](_0x77b2('0xa8'),_0x46ee60[_0x77b2('0xa5')][_0x77b2('0x29')],_0x46ee60[_0x77b2('0xa5')][_0x77b2('0xa6')]):_0x77b2('0xa9'),'browserVersion':_0x46ee60[_0x77b2('0xa5')]['version']||_0x77b2('0xa9'),'osName':util[_0x77b2('0xa7')](_0x77b2('0xa8'),_0x46ee60['os']['name'],_0x46ee60['os'][_0x77b2('0xa6')]),'osVersion':_0x46ee60['os'][_0x77b2('0xa6')],'deviceModel':_0x46ee60['device'][_0x77b2('0x30')]&&_0x46ee60[_0x77b2('0xaa')][_0x77b2('0xab')]?util[_0x77b2('0xa7')]('%s\x20%s\x20%s',_0x46ee60[_0x77b2('0xaa')][_0x77b2('0x30')],_0x46ee60[_0x77b2('0xaa')][_0x77b2('0xab')],_0x46ee60['device'][_0x77b2('0x2e')]):null,'deviceVendor':_0x46ee60[_0x77b2('0xaa')]['vendor'],'deviceType':_0x46ee60['device'][_0x77b2('0x2e')],'formData':JSON['stringify'](_0x5bd3c5[_0x77b2('0x4d')])};var _0x1eca39={'ChatWebsiteId':_0x5bd3c5[_0x77b2('0x48')]['id'],'closed':![]};if(_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xac')]){_0x1eca39['threadId']=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xac')];return db['ChatInteraction'][_0x77b2('0x4b')]({'where':_0x1eca39})['then'](function(_0x1a0236){if(_0x1a0236){return[_0x1a0236,![]];}_0x7e15cc[_0x77b2('0xac')]=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xac')];_0x7e15cc[_0x77b2('0xad')]=_0x5bd3c5[_0x77b2('0x4d')]['externalUrl'];return db[_0x77b2('0xae')][_0x77b2('0x4c')](_0x7e15cc)[_0x77b2('0x42')](function(_0x13fb54){return[_0x13fb54,!![]];});});}_0x1eca39['ContactId']=_0x4b31b6['id'];if(_0x5bd3c5[_0x77b2('0x4d')]['interaction']&&_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xaf')]['id']){_0x1eca39['id']=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xaf')]['id'];return db[_0x77b2('0xae')][_0x77b2('0x4b')]({'where':_0x1eca39})[_0x77b2('0x42')](function(_0x378838){if(_0x378838){return[_0x378838,![]];}return db[_0x77b2('0xae')][_0x77b2('0x4c')](_0x7e15cc)['then'](function(_0x71cfbf){return[_0x71cfbf,!![]];});});}return db[_0x77b2('0xae')][_0x77b2('0x4c')](_0x7e15cc)[_0x77b2('0x42')](function(_0x3b0f1c){return[_0x3b0f1c,!![]];});}})['spread'](function(_0x1ce512,_0x62361a){if(_0x1ce512){_0x4403ea=_0x62361a;if(!_0x62361a){var _0x269871={'from':(_0x411b6b['contact']['firstName']||'')+'\x20'+(_0x411b6b['contact'][_0x77b2('0xa3')]||'')};if(_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xac')]&&_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xb0')]&&_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xac')]!=_0x5bd3c5['body'][_0x77b2('0xb0')]){_0x269871[_0x77b2('0xac')]=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xb0')];}return _0x1ce512[_0x77b2('0x52')](_0x269871);}else{return _0x1ce512;}}})['then'](function(_0x2ac1b9){_0x411b6b['interaction']=_0x2ac1b9['get']({'plain':!![]});_0x411b6b[_0x77b2('0xaf')][_0x77b2('0xb1')]=_0x4403ea;if(_0x411b6b[_0x77b2('0xaf')][_0x77b2('0xb1')]){if(_0x411b6b['account'][_0x77b2('0xb2')]){_0x411b6b['applications'][_0x77b2('0xb3')]({'id':0x0,'priority':_0x411b6b[_0x77b2('0x99')]['length']+0x1,'app':'close','appdata':_0x77b2('0xb4'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x5bd3c5['body'][_0x77b2('0x4d')],'ChatWebsiteId':_0x5bd3c5[_0x77b2('0x48')]['id'],'ChatInteractionId':_0x2ac1b9['id'],'direction':'in','ContactId':_0x411b6b[_0x77b2('0x9e')]['id'],'AttachmentId':_0x5bd3c5[_0x77b2('0x4d')]['AttachmentId']});})['then'](function(_0x52d9d3){_0x411b6b[_0x77b2('0x1a')]=_0x52d9d3;if(_0x411b6b[_0x77b2('0xaf')][_0x77b2('0xb5')]){return db['User']['find']({'attributes':['id',_0x77b2('0x29')],'where':{'id':_0x411b6b[_0x77b2('0xaf')]['UserId']}})[_0x77b2('0x42')](function(_0x478d85){if(_0x478d85){_0x411b6b['applications'][_0x77b2('0xb6')]({'id':0x0,'priority':0x0,'app':_0x77b2('0xb7'),'appdata':_0x478d85['name']+','+(_0x411b6b[_0x77b2('0x98')][_0x77b2('0xb8')]||0xa),'interval':'*,*,*,*'});_0x411b6b['forcedOwnership']=!![];}return respondWithRpcPromise('Start','startRouting',_0x411b6b);});}return respondWithRpcPromise(_0x77b2('0xb9'),_0x77b2('0xba'),_0x411b6b);})[_0x77b2('0x42')](function(_0x42a1ff){respondWithRpcPromise('EventManager',_0x77b2('0xbb'),{'event':_0x77b2('0x7d'),'message':_0x42a1ff},client9002);return _0x42a1ff;})[_0x77b2('0x42')](respondWithResult(_0xcd4e63,null))[_0x77b2('0x46')](handleError(_0xcd4e63,null));};exports[_0x77b2('0xbc')]=function(_0x3a34a2,_0xae243){var _0x408edc,_0x1fd2f5,_0xa68597;var _0x392041=[];var _0x4e8ecd={};var _0x2f76e1=_0x3a34a2[_0x77b2('0xbd')]||[];var _0xa90826=[];var _0x34287c;return db[_0x77b2('0x83')][_0x77b2('0x53')]()[_0x77b2('0x42')](function(_0x6dbf12){if(!_0x6dbf12){throw new db[(_0x77b2('0x8c'))][(_0x77b2('0x84'))](_0x77b2('0x85'));}_0x392041=_['difference'](_[_0x77b2('0x4a')](_0x6dbf12),[_0x77b2('0x87'),_0x77b2('0x88'),_0x77b2('0x89'),'ListId']);if(_0x3a34a2['body']['id']){delete _0x3a34a2[_0x77b2('0x4d')]['id'];}if(_[_0x77b2('0x6e')](_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0x8b')])){throw _0xae243[_0x77b2('0x1d')](0x1f4)[_0x77b2('0x2a')](new db[(_0x77b2('0x8c'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x77b2('0x6e')](_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0x4d')])||_0x3a34a2['body'][_0x77b2('0x4d')]===''){throw _0xae243['status'](0x1f4)['send'](new db[(_0x77b2('0x8c'))][(_0x77b2('0x84'))](_0x77b2('0x8e')));}if(_[_0x77b2('0x6e')](_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0xbe')])){throw _0xae243[_0x77b2('0x1d')](0x1f4)[_0x77b2('0x2a')](new db[(_0x77b2('0x8c'))][(_0x77b2('0x84'))](_0x77b2('0xbf')+_0x392041));}if(!_[_0x77b2('0xc0')](_0x392041,_0x3a34a2['body'][_0x77b2('0xbe')])){throw _0xae243[_0x77b2('0x1d')](0x1f4)[_0x77b2('0x2a')](new db[(_0x77b2('0x8c'))][(_0x77b2('0x84'))](_0x77b2('0xc1')+_0x392041));}_0x4e8ecd[_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0xbe')]]=_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0x8b')];})[_0x77b2('0x42')](function(){return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x3a34a2[_0x77b2('0x48')]['id']},'include':[{'model':db[_0x77b2('0x92')],'as':'List'},{'model':db[_0x77b2('0xc2')],'as':_0x77b2('0xc2')}]});})[_0x77b2('0x42')](handleEntityNotFound(_0xae243,null))[_0x77b2('0x42')](function(_0x3efdb1){if(_0x3efdb1&&_0x3efdb1[_0x77b2('0x93')]){_0x1fd2f5=_0x3efdb1;var _0x49ac06=_['defaults'](_0x3a34a2[_0x77b2('0x4d')],{'firstName':_0x3a34a2[_0x77b2('0x4d')]['from'],'phone':_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0x8b')],'ListId':_0x3efdb1[_0x77b2('0x8a')]});_0x49ac06[_0x3a34a2[_0x77b2('0x4d')]['mapKeyOffline']]=_0x3a34a2['body'][_0x77b2('0x8b')];return db[_0x77b2('0x83')][_0x77b2('0xc3')]({'where':_0x4e8ecd,'defaults':_0x49ac06});}})[_0x77b2('0xc4')](function(_0x324743){if(_0x324743){_0xa68597=_0x324743;var _0x3abe5f=fs[_0x77b2('0xc5')](path['join'](config[_0x77b2('0x72')],_0x77b2('0xc6')),'utf8');var _0x103d11=ejs[_0x77b2('0xc7')](_0x3abe5f,{'body':_[_0x77b2('0xc8')](_0x3a34a2[_0x77b2('0x4d')]['body']),'bodyTitle':_0x1fd2f5[_0x77b2('0xc9')]});return db[_0x77b2('0xca')][_0x77b2('0x4c')]({'body':_0x103d11,'plainBody':htmlToText[_0x77b2('0xcb')](_0x103d11),'ContactId':_0x324743['id'],'ChatWebsiteId':_0x1fd2f5['id']});}})[_0x77b2('0x42')](function(_0x1cb2aa){_0x34287c=_0x1cb2aa;if(_0x2f76e1[_0x77b2('0x37')]){var _0x36b834=_0x2f76e1[_0x77b2('0x31')](function(_0x3429a9){return{'name':_0x3429a9[_0x77b2('0xcc')],'basename':_0x3429a9[_0x77b2('0x63')],'type':_0x3429a9['mimetype'],'ChatOfflineMessageId':_0x1cb2aa['id']};});_0xa90826=_0x36b834[_0x77b2('0x31')](_0x367ce1=>{var _0x3354e1={'filename':_0x367ce1[_0x77b2('0x29')],'path':path[_0x77b2('0x70')](config[_0x77b2('0x72')],_0x77b2('0xcd'),'files','attachments',_0x77b2('0xce'),_0x367ce1[_0x77b2('0xcf')])};return _0x3354e1;});if(!_0x1fd2f5[_0x77b2('0xd0')]){return db[_0x77b2('0xd1')][_0x77b2('0xd2')](function(_0xf08b6b){return db['Attachment'][_0x77b2('0xd3')](_0x36b834,{'transaction':_0xf08b6b});});}}})[_0x77b2('0x42')](function(){if(_0x34287c){_0x408edc=_0x34287c;return db[_0x77b2('0xc2')][_0x77b2('0xd4')]({'where':{'service':!![]},'include':[{'model':db[_0x77b2('0xd5')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x77b2('0xd6')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x77b2('0x42')](function(_0x360c91){if(_0x360c91&&_0x360c91[_0x77b2('0xd7')]&&_0x1fd2f5['forwardOffline']&&_0x1fd2f5[_0x77b2('0xd8')]){var _0x1b7c9d=_0x360c91[_0x77b2('0xd9')]();return respondWithRpcPromise(_0x77b2('0xda'),_0x77b2('0xdb'),{'account':_0x1b7c9d,'message':{'from':util['format'](_0x77b2('0xdc'),_0x360c91[_0x77b2('0x29')],_0x360c91[_0x77b2('0xdd')]||_0x360c91['Smtp'][_0x77b2('0x4e')]),'to':_0x1fd2f5['forwardOfflineAddress'],'subject':_0x1fd2f5['offlineMessageSubject'],'html':_0x408edc[_0x77b2('0x4d')],'attachments':_0xa90826}},client9003)[_0x77b2('0x42')](function(){return _0x408edc;})[_0x77b2('0x46')](function(_0x5eecab){logger[_0x77b2('0x19')](_0x5eecab);});}})[_0x77b2('0x42')](function(){if(_0x1fd2f5&&_0x1fd2f5[_0x77b2('0xd0')]&&_0x1fd2f5[_0x77b2('0xde')]){var _0x4660e0=[];if(_0x2f76e1[_0x77b2('0x37')]){_0x4660e0=_0x2f76e1[_0x77b2('0x31')](function(_0xcedab4){return{'name':_0xcedab4[_0x77b2('0xcc')],'basename':_0xcedab4[_0x77b2('0x63')],'type':_0xcedab4[_0x77b2('0xdf')],'ChatOfflineMessageId':_0x34287c['id']};});}var _0x5121c3;if(!_['isNil'](_0x1fd2f5[_0x77b2('0xe0')])){var _0x3c56f0=_[_0x77b2('0x31')](_0x3a34a2[_0x77b2('0x4d')],function(_0xa3bf7b){return _0xa3bf7b;});var _0x4397d9=_[_0x77b2('0xe1')](_0x3c56f0)[0x0];var _0x45e73a=_[_0x77b2('0xe2')](_0x4397d9,function(_0x5665b8){return _0x5665b8;});_0x5121c3=_0x45e73a[0x1][_0x1fd2f5[_0x77b2('0xe0')]];}var _0x3fddab={'from':_0xa68597['email'],'firstName':_0xa68597[_0x77b2('0xa2')],'lastName':_0xa68597[_0x77b2('0xa3')],'mapKey':_0x77b2('0xdd'),'message':{'from':_0xa68597[_0x77b2('0xdd')],'to':_0x1fd2f5[_0x77b2('0xc2')][_0x77b2('0xdd')],'cc':'','subject':_[_0x77b2('0x6e')](_0x5121c3)?_0x1fd2f5[_0x77b2('0xe3')]:_0x5121c3,'messageId':'','sentAt':new Date(),'attach':_0x4660e0[_0x77b2('0x37')],'attachments':_0x4660e0,'originChannel':'Chat','ChatWebsiteId':_0x1fd2f5['id'],'ChatOfflineMessageId':_0x408edc['id'],'originTo':_0x1fd2f5[_0x77b2('0xc2')][_0x77b2('0xdd')]},'body':_0x408edc[_0x77b2('0x4d')]};var _0x101d5a={'account':{'id':_0x1fd2f5[_0x77b2('0xde')]},'body':_0x3fddab,'log':_0x77b2('0xe4')};return respondWithRpcPromise(_0x77b2('0xe4'),_0x77b2('0xe5'),_0x101d5a,client9001)[_0x77b2('0x42')](function(){return _0x408edc;})[_0x77b2('0x46')](function(_0x1849ea){logger[_0x77b2('0x19')](_0x1849ea);});}return;})[_0x77b2('0x42')](function(){if(_0x408edc){return _0x408edc;}})[_0x77b2('0x42')](respondWithResult(_0xae243,null))[_0x77b2('0x46')](function(_0x13ba1c){logger['error'](_0x77b2('0x46'),_0x13ba1c);for(var _0x3b25ce of _0x2f76e1){var _0x26b5e7=path[_0x77b2('0x70')](config['root'],_0x77b2('0xcd'),'files',_0x77b2('0xe6'),'offline-chat',_0x3b25ce[_0x77b2('0x63')]);fs_extra[_0x77b2('0xe7')](_0x26b5e7)['catch'](function(_0x37a948){logger[_0x77b2('0x19')](_0x77b2('0xe8'),_0x26b5e7,_0x37a948);});}});};exports[_0x77b2('0xe9')]=function(_0x40411a,_0x236570){return db[_0x77b2('0xae')]['find']({'where':{'id':_0x40411a['params']['id']}})['then'](handleEntityNotFound(_0x236570,null))[_0x77b2('0x42')](function(_0x12612f){if(_0x12612f){return _0x12612f[_0x77b2('0xe9')](_0x40411a[_0x77b2('0x4d')][_0x77b2('0x5c')],_[_0x77b2('0xea')](_0x40411a[_0x77b2('0x4d')],[_0x77b2('0x5c'),'id'])||{});}})[_0x77b2('0x42')](respondWithResult(_0x236570,null))['catch'](handleError(_0x236570,null));};exports[_0x77b2('0xeb')]=function(_0xa87d4b,_0x4a1149){var _0x24dffd={'raw':![],'where':{}};var _0x114dc7={};var _0x221f0e={'count':0x0,'rows':[]};return db[_0x77b2('0x41')][_0x77b2('0xd4')]({'where':{'id':_0xa87d4b[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x4a1149,null))[_0x77b2('0x42')](function(_0x77f2d1){if(_0x77f2d1){_0x114dc7[_0x77b2('0x30')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x114dc7[_0x77b2('0x32')]=_['keys'](_0xa87d4b['query']);_0x114dc7[_0x77b2('0x33')]=_[_0x77b2('0x35')](_0x114dc7[_0x77b2('0x30')],_0x114dc7[_0x77b2('0x32')]);_0x24dffd['attributes']=_[_0x77b2('0x35')](_0x114dc7['model'],qs[_0x77b2('0x36')](_0xa87d4b[_0x77b2('0x32')][_0x77b2('0x36')]));_0x24dffd[_0x77b2('0x34')]=_0x24dffd['attributes'][_0x77b2('0x37')]?_0x24dffd[_0x77b2('0x34')]:_0x114dc7[_0x77b2('0x30')];if(!_0xa87d4b[_0x77b2('0x32')][_0x77b2('0x59')](_0x77b2('0x38'))){_0x24dffd[_0x77b2('0x21')]=qs[_0x77b2('0x21')](_0xa87d4b['query'][_0x77b2('0x21')]);_0x24dffd['offset']=qs['offset'](_0xa87d4b['query'][_0x77b2('0x20')]);}_0x24dffd[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0xa87d4b[_0x77b2('0x32')][_0x77b2('0x3a')]);_0x24dffd['where']=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0xa87d4b['query'],_0x114dc7[_0x77b2('0x33')]));_0x24dffd['where']['ChatWebsiteId']=_0x77f2d1['id'];if(_0xa87d4b[_0x77b2('0x32')][_0x77b2('0x3c')]){_0x24dffd[_0x77b2('0x3e')]=_['merge'](_0x24dffd[_0x77b2('0x3e')],{'$or':_[_0x77b2('0x31')](_0x24dffd[_0x77b2('0x34')],function(_0x230ca7){var _0x5b5b09={};_0x5b5b09[_0x230ca7]={'$like':'%'+_0xa87d4b[_0x77b2('0x32')]['filter']+'%'};return _0x5b5b09;})});}_0x24dffd=_[_0x77b2('0x3d')]({},_0x24dffd,_0xa87d4b['options']);return db[_0x77b2('0xae')][_0x77b2('0x23')]({'where':_0x24dffd[_0x77b2('0x3e')]})[_0x77b2('0x42')](function(_0x214596){_0x221f0e[_0x77b2('0x23')]=_0x214596;if(_0xa87d4b[_0x77b2('0x32')][_0x77b2('0x43')]){_0x24dffd['include']=[{'model':db[_0x77b2('0x83')],'as':'Contact','required':![]},{'model':db[_0x77b2('0xec')],'as':_0x77b2('0xed'),'attributes':[_0x77b2('0x29'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x77b2('0xee'),'attributes':['id',_0x77b2('0x29'),_0x77b2('0xef')],'where':_0xa87d4b[_0x77b2('0x32')][_0x77b2('0xf0')]?{'id':_0xa87d4b[_0x77b2('0x32')]['tag']}:undefined,'required':_0xa87d4b['query'][_0x77b2('0xf0')]?!![]:![]}];}return db[_0x77b2('0xae')][_0x77b2('0x5a')](_0x24dffd);})[_0x77b2('0x42')](function(_0x3fd958){_0x221f0e['rows']=_0x3fd958;return _0x221f0e;});}})[_0x77b2('0x42')](respondWithFilteredResult(_0x4a1149,_0x24dffd))[_0x77b2('0x46')](handleError(_0x4a1149,null));};function iftimePromise(_0xc4bec3,_0x2c9011){return respondWithRpcPromise(_0x77b2('0xf1'),'getSnippet',{'command':_0x2c9011['timezone']?util[_0x77b2('0xa7')](_0x77b2('0xf2'),_0xc4bec3[_0x77b2('0xf3')],_0x2c9011['timezone']):util[_0x77b2('0xa7')]('iftime\x20%s',_0xc4bec3[_0x77b2('0xf3')])},client9002)['then'](function(_0x364576){var _0x57ad36=_0x364576&&_0x364576[_0x77b2('0xf4')](_0x77b2('0xf5'))>=0x0?!![]:![];logger[_0x77b2('0x14')](_0x77b2('0xf6'),_0x2c9011['id'],_0xc4bec3['id'],_0xc4bec3[_0x77b2('0xf3')],_0x57ad36?_0x77b2('0xf7'):_0x77b2('0xf8'),_0x2c9011[_0x77b2('0xf9')]?_0x2c9011[_0x77b2('0xf9')]:_0x77b2('0xfa'));return _0x57ad36;})['catch'](function(_0x5a7b6a){logger[_0x77b2('0x19')](_0x77b2('0xf6'),_0x2c9011['id'],_0xc4bec3['id'],_0xc4bec3[_0x77b2('0xf3')],util['inspect'](_0x5a7b6a,{'showHidden':![],'depth':null}),_0x2c9011[_0x77b2('0xf9')]?_0x2c9011[_0x77b2('0xf9')]:_0x77b2('0xfa'));return![];});}exports['getSnippet']=function(_0x3b5f0c,_0x1da4b9){var _0x23dcf5=0x0;var _0x355764=0x0;var _0x139ba8=![];var _0x405679;var _0x33c7af;return db[_0x77b2('0x41')]['find']({'where':{'id':_0x3b5f0c[_0x77b2('0x48')]['id']},'include':[{'model':db['Interval'],'as':_0x77b2('0xfb'),'include':[{'model':db[_0x77b2('0xfb')],'as':_0x77b2('0xfc'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x77b2('0x42')](handleEntityNotFound(_0x1da4b9,null))[_0x77b2('0x42')](function(_0x58b7e8){if(_0x58b7e8){_0x405679=_0x58b7e8;return _0x58b7e8[_0x77b2('0xfd')]({'raw':!![]});}})[_0x77b2('0x42')](function(_0x39235c){if(_0x405679){if(_0x39235c){_0x33c7af=_0x39235c;}}return require(_0x77b2('0x6b'))[_0x77b2('0x6c')]();})['then'](function(_0x1f637c){if(_0x1f637c){_0x355764=_0x1f637c[_0x77b2('0xfe')];_0x139ba8=_0x1f637c[_0x77b2('0x6d')];}})[_0x77b2('0x42')](function(){return db[_0x77b2('0xae')][_0x77b2('0x23')]({'where':{'closed':![]}});})['then'](function(_0xa3e848){_0x23dcf5=_0xa3e848;if(_0x355764&&_0xa3e848>_0x355764){return db['License'][_0x77b2('0xd4')]({'where':{'id':0x1}})[_0x77b2('0x42')](function(_0x29a3aa){if(_0x29a3aa){_0x29a3aa[_0x77b2('0xff')](_0x77b2('0x100'));}});}})['then'](function(){if(_0x405679[_0x77b2('0xfb')]&&_0x405679[_0x77b2('0xfb')]['Intervals']){var _0x2f8d08=[];for(var _0x4ccf1f=0x0;_0x4ccf1f<_0x405679[_0x77b2('0xfb')]['Intervals']['length'];_0x4ccf1f++){var _0x30971d=_0x405679[_0x77b2('0xfb')][_0x77b2('0xfc')][_0x4ccf1f][_0x77b2('0x25')]({'plain':!![]});_0x2f8d08[_0x77b2('0xb3')](iftimePromise(_0x30971d,_0x405679));}return BPromise[_0x77b2('0x101')](_0x2f8d08)[_0x77b2('0x42')](function(_0xebed74){return _[_0x77b2('0x102')](_0xebed74);});}else{return!![];}})['then'](function(_0xf9409b){var _0x2411c9=fs[_0x77b2('0xc5')](path[_0x77b2('0x70')](config[_0x77b2('0x72')],_0x77b2('0x103')),_0x77b2('0x104'));var _0x23352f={'remote':_0x405679[_0x77b2('0x105')],'query':querystring[_0x77b2('0x18')](_[_0x77b2('0x3d')](_0x405679[_0x77b2('0x25')]({'plain':!![]}),{'customerIp':_0x3b5f0c['headers'][_0x77b2('0xa0')]||_0x3b5f0c[_0x77b2('0x7f')][_0x77b2('0x106')]||_0x3b5f0c[_0x77b2('0x107')][_0x77b2('0x108')]||_0x3b5f0c['ip'],'referer':_0x3b5f0c['headers'][_0x77b2('0x109')],'openedInteractions':_0x23dcf5,'maxInteractions':_0x355764,'virtual':_0x139ba8[_0x77b2('0xfe')],'online':_0xf9409b,'custom':_0x139ba8}))[_0x77b2('0x10a')](/'/g,'\x5c\x27')};_0x1da4b9[_0x77b2('0x2a')](ejs[_0x77b2('0xc7')](Mustache[_0x77b2('0xc7')](_0x2411c9,_0x23352f),{'proactiveActions':_0x33c7af,'alignment':_0x405679[_0x77b2('0x10b')],'verticalAlignment':_0x405679[_0x77b2('0x10c')],'div_color':_0x405679[_0x77b2('0xef')],'labelText':_0x405679[_0x77b2('0x10d')],'text_color':_0x405679[_0x77b2('0x10e')],'text_button_color':_0x405679[_0x77b2('0x10f')],'button_color':_0x405679[_0x77b2('0x110')],'background_color':_0x405679[_0x77b2('0x111')],'hideWhenOffline':_0x405679[_0x77b2('0x112')],'interval':_0x405679['IntervalId']}));})[_0x77b2('0x46')](handleError(_0x1da4b9,null));};exports[_0x77b2('0x113')]=function(_0x490aa3,_0x5b60d3){var _0x37d689=_0x490aa3[_0x77b2('0x48')]['id'];var _0x54b033=_0x490aa3['body'];var _0x3b9ece=0xc8;var _0x5bfbe4=null;return db[_0x77b2('0xd1')]['transaction']({'isolationLevel':db['sequelize'][_0x77b2('0x114')][_0x77b2('0x115')]['READ_COMMITTED']},function(_0x27cc5e){return db[_0x77b2('0x41')][_0x77b2('0xd4')]({'where':{'id':_0x37d689},'transaction':_0x27cc5e})[_0x77b2('0x42')](function(_0x15a2a5){if(_0x15a2a5){return db[_0x77b2('0x96')][_0x77b2('0x27')]({'where':{'ChatWebsiteId':_0x37d689},'transaction':_0x27cc5e})[_0x77b2('0x42')](function(){var _0xc80244=_[_0x77b2('0x31')](_0x54b033,function(_0x27716a){_0x27716a[_0x77b2('0x55')]=_0x37d689;return _0x27716a;});return db[_0x77b2('0x96')]['bulkCreate'](_0xc80244,{'transaction':_0x27cc5e});});}else{_0x3b9ece=0x194;_0x5bfbe4=[];}});})[_0x77b2('0x42')](function(){if(_0x3b9ece!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x37d689},'order':_0x77b2('0x9c')})['then'](function(_0x12659c){_0x5bfbe4=_0x12659c;});}})[_0x77b2('0x46')](function(_0x4be992){_0x3b9ece=0x1f4;logger['error'](_0x4be992[_0x77b2('0x28')]);if(_0x4be992[_0x77b2('0x29')]){delete _0x4be992[_0x77b2('0x29')];}_0x5bfbe4=_0x4be992;})[_0x77b2('0x116')](function(){if(_0x5bfbe4===null){_0x5b60d3[_0x77b2('0x1c')](_0x3b9ece);}else{if(_0x3b9ece===0x1f4){_0x5b60d3[_0x77b2('0x1d')](_0x3b9ece)[_0x77b2('0x2a')](_0x5bfbe4);}else{_0x5b60d3[_0x77b2('0x1d')](_0x3b9ece)[_0x77b2('0x1f')](_0x5bfbe4);}}});};exports[_0x77b2('0x117')]=function(_0x56d94e,_0x57d123){var _0x3319ac={};var _0x30e2ac={};var _0x27a7b0;var _0x142f30;return db[_0x77b2('0x41')][_0x77b2('0xd4')]({'where':{'id':_0x56d94e['params']['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x57d123,null))[_0x77b2('0x42')](function(_0x38213b){if(_0x38213b){_0x27a7b0=_0x38213b;_0x30e2ac[_0x77b2('0x30')]=_[_0x77b2('0x4a')](db['ChatApplication'][_0x77b2('0x58')]);_0x30e2ac[_0x77b2('0x32')]=_[_0x77b2('0x4a')](_0x56d94e[_0x77b2('0x32')]);_0x30e2ac[_0x77b2('0x33')]=_['intersection'](_0x30e2ac['model'],_0x30e2ac[_0x77b2('0x32')]);_0x3319ac['attributes']=_[_0x77b2('0x35')](_0x30e2ac[_0x77b2('0x30')],qs[_0x77b2('0x36')](_0x56d94e[_0x77b2('0x32')][_0x77b2('0x36')]));_0x3319ac[_0x77b2('0x34')]=_0x3319ac[_0x77b2('0x34')][_0x77b2('0x37')]?_0x3319ac[_0x77b2('0x34')]:_0x30e2ac[_0x77b2('0x30')];_0x3319ac[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0x56d94e['query'][_0x77b2('0x3a')]);_0x3319ac[_0x77b2('0x3e')]=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0x56d94e['query'],_0x30e2ac['filters']));if(_0x56d94e[_0x77b2('0x32')][_0x77b2('0x3c')]){_0x3319ac[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x3319ac[_0x77b2('0x3e')],{'$or':_['map'](_0x3319ac[_0x77b2('0x34')],function(_0x544265){var _0x527e0b={};_0x527e0b[_0x544265]={'$like':'%'+_0x56d94e[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x527e0b;})});}_0x3319ac=_[_0x77b2('0x3d')]({},_0x3319ac,_0x56d94e[_0x77b2('0x40')]);return _0x27a7b0['getApplications'](_0x3319ac);}})[_0x77b2('0x42')](function(_0x172413){if(_0x172413){_0x142f30=_0x172413[_0x77b2('0x37')];if(!_0x56d94e['query'][_0x77b2('0x59')](_0x77b2('0x38'))){_0x3319ac[_0x77b2('0x21')]=qs['limit'](_0x56d94e[_0x77b2('0x32')][_0x77b2('0x21')]);_0x3319ac[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x56d94e[_0x77b2('0x32')]['offset']);}return _0x27a7b0[_0x77b2('0x117')](_0x3319ac);}})[_0x77b2('0x42')](function(_0x8b93a5){if(_0x8b93a5){return _0x8b93a5?{'count':_0x142f30,'rows':_0x8b93a5}:null;}})[_0x77b2('0x42')](respondWithResult(_0x57d123,null))['catch'](handleError(_0x57d123,null));};exports['addProactiveActions']=function(_0x537826,_0x39d291){return db[_0x77b2('0x118')][_0x77b2('0x4b')]({'where':{'id':_0x537826[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x39d291,null))['then'](function(_0x42b4b4){if(_0x42b4b4){return _0x42b4b4[_0x77b2('0x119')](_0x537826[_0x77b2('0x4d')][_0x77b2('0x5c')],_[_0x77b2('0xea')](_0x537826['body'],[_0x77b2('0x5c'),'id'])||{});}})[_0x77b2('0x42')](respondWithResult(_0x39d291,null))[_0x77b2('0x46')](handleError(_0x39d291,null));};exports[_0x77b2('0xfd')]=function(_0x187e0b,_0x2496c3){var _0x1edd7f={};var _0x5d5a9e={};var _0x545401;var _0x29dcb7;return db[_0x77b2('0x41')][_0x77b2('0xd4')]({'where':{'id':_0x187e0b['params']['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x2496c3,null))[_0x77b2('0x42')](function(_0x4e88fc){if(_0x4e88fc){_0x545401=_0x4e88fc;_0x5d5a9e[_0x77b2('0x30')]=_['keys'](db[_0x77b2('0x11a')]['rawAttributes']);_0x5d5a9e[_0x77b2('0x32')]=_[_0x77b2('0x4a')](_0x187e0b[_0x77b2('0x32')]);_0x5d5a9e[_0x77b2('0x33')]=_[_0x77b2('0x35')](_0x5d5a9e['model'],_0x5d5a9e[_0x77b2('0x32')]);_0x1edd7f['attributes']=_[_0x77b2('0x35')](_0x5d5a9e['model'],qs[_0x77b2('0x36')](_0x187e0b[_0x77b2('0x32')]['fields']));_0x1edd7f['attributes']=_0x1edd7f[_0x77b2('0x34')][_0x77b2('0x37')]?_0x1edd7f[_0x77b2('0x34')]:_0x5d5a9e[_0x77b2('0x30')];_0x1edd7f[_0x77b2('0x39')]=qs['sort'](_0x187e0b['query'][_0x77b2('0x3a')]);_0x1edd7f['where']=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0x187e0b['query'],_0x5d5a9e['filters']));if(_0x187e0b[_0x77b2('0x32')]['filter']){_0x1edd7f[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x1edd7f[_0x77b2('0x3e')],{'$or':_[_0x77b2('0x31')](_0x1edd7f[_0x77b2('0x34')],function(_0x405413){var _0x3be026={};_0x3be026[_0x405413]={'$like':'%'+_0x187e0b[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x3be026;})});}_0x1edd7f=_[_0x77b2('0x3d')]({},_0x1edd7f,_0x187e0b['options']);return _0x545401[_0x77b2('0xfd')](_0x1edd7f);}})[_0x77b2('0x42')](function(_0x281a7f){if(_0x281a7f){_0x29dcb7=_0x281a7f['length'];if(!_0x187e0b[_0x77b2('0x32')][_0x77b2('0x59')](_0x77b2('0x38'))){_0x1edd7f['limit']=qs[_0x77b2('0x21')](_0x187e0b[_0x77b2('0x32')][_0x77b2('0x21')]);_0x1edd7f[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x187e0b[_0x77b2('0x32')][_0x77b2('0x20')]);}return _0x545401['getProactiveActions'](_0x1edd7f);}})[_0x77b2('0x42')](function(_0x90242b){if(_0x90242b){return _0x90242b?{'count':_0x29dcb7,'rows':_0x90242b}:null;}})[_0x77b2('0x42')](respondWithResult(_0x2496c3,null))['catch'](handleError(_0x2496c3,null));};exports[_0x77b2('0x11b')]=function(_0x2ca76c,_0x5b3be4){var _0x541626=_0x2ca76c[_0x77b2('0x32')]['online']===_0x77b2('0x11c')?_0x77b2('0x11d'):'onlineForm';return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'attributes':['id',_0x541626],'where':{'id':_0x2ca76c[_0x77b2('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b3be4,null))[_0x77b2('0x42')](function(_0x13a6d6){if(_0x13a6d6){var _0x25da89=_0x13a6d6[_0x541626];var _0x2e5138=_0x25da89&&_0x25da89[_0x77b2('0x11e')]?_0x25da89['items']:[];_0x5b3be4[_0x77b2('0x2a')]({'fromKey':_[_0x77b2('0x6e')](_0x25da89[_0x77b2('0x11f')])?undefined:_0x25da89['fromKey'],'count':_0x2e5138['length'],'rows':_0x2e5138});}})[_0x77b2('0x46')](handleError(_0x5b3be4,null));};exports[_0x77b2('0x120')]=function(_0x51c4c5,_0x17c1ef){var _0x238260={'raw':![],'where':{}};var _0x5bc934={};var _0x1c8ccb={'count':0x0,'rows':[]};return db[_0x77b2('0x41')]['findOne']({'where':{'id':_0x51c4c5['params']['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x17c1ef,null))[_0x77b2('0x42')](function(_0x526a75){if(_0x526a75){_0x5bc934[_0x77b2('0x30')]=_[_0x77b2('0x4a')](db[_0x77b2('0xca')][_0x77b2('0x58')]);_0x5bc934[_0x77b2('0x32')]=_['keys'](_0x51c4c5['query']);_0x5bc934[_0x77b2('0x33')]=_[_0x77b2('0x35')](_0x5bc934[_0x77b2('0x30')],_0x5bc934[_0x77b2('0x32')]);_0x238260[_0x77b2('0x34')]=_[_0x77b2('0x35')](_0x5bc934[_0x77b2('0x30')],qs['fields'](_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x36')]));_0x238260[_0x77b2('0x34')]=_0x238260['attributes']['length']?_0x238260[_0x77b2('0x34')]:_0x5bc934[_0x77b2('0x30')];if(!_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x59')](_0x77b2('0x38'))){_0x238260[_0x77b2('0x21')]=qs[_0x77b2('0x21')](_0x51c4c5['query'][_0x77b2('0x21')]);_0x238260[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x20')]);}_0x238260[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x3a')]);_0x238260[_0x77b2('0x3e')]=qs['filters'](_[_0x77b2('0x3b')](_0x51c4c5[_0x77b2('0x32')],_0x5bc934[_0x77b2('0x33')]));_0x238260['where'][_0x77b2('0x55')]=_0x526a75['id'];if(_0x51c4c5[_0x77b2('0x32')]['filter']){_0x238260[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x238260['where'],{'$or':_[_0x77b2('0x31')](_0x238260[_0x77b2('0x34')],function(_0x3590be){var _0x189619={};_0x189619[_0x3590be]={'$like':'%'+_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x189619;})});}_0x238260=_[_0x77b2('0x3d')]({},_0x238260,_0x51c4c5[_0x77b2('0x40')]);return db[_0x77b2('0xca')][_0x77b2('0x23')]({'where':_0x238260['where']})[_0x77b2('0x42')](function(_0x34f1c1){_0x1c8ccb[_0x77b2('0x23')]=_0x34f1c1;if(_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x43')]){_0x238260[_0x77b2('0x44')]=[{'all':!![]}];}else{_0x238260[_0x77b2('0x44')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x77b2('0x121')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x77b2('0x5a')](_0x238260);})[_0x77b2('0x42')](function(_0x4d791c){_0x1c8ccb[_0x77b2('0x45')]=_0x4d791c;return _0x1c8ccb;});}})[_0x77b2('0x42')](respondWithFilteredResult(_0x17c1ef,_0x238260))[_0x77b2('0x46')](handleError(_0x17c1ef,null));};exports[_0x77b2('0x122')]=function(_0x2defcc,_0x20f4e6){return db['ChatWebsite'][_0x77b2('0x4b')]({'where':{'id':_0x2defcc[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x20f4e6,null))[_0x77b2('0x42')](function(_0x39370d){if(_0x39370d){return _0x39370d[_0x77b2('0x122')](_0x2defcc[_0x77b2('0x4d')][_0x77b2('0x5c')],_[_0x77b2('0xea')](_0x2defcc[_0x77b2('0x4d')],[_0x77b2('0x5c'),'id'])||{})['spread'](function(_0x4fdb){for(var _0x537a90=0x0;_0x537a90<_0x2defcc['body'][_0x77b2('0x5c')]['length'];_0x537a90+=0x1){socket[_0x77b2('0x123')](_0x77b2('0x124'),{'UserId':Number(_0x2defcc[_0x77b2('0x4d')][_0x77b2('0x5c')][_0x537a90]),'ChatWebsiteId':Number(_0x2defcc['params']['id'])});}return _0x4fdb;});}})[_0x77b2('0x42')](respondWithResult(_0x20f4e6,null))[_0x77b2('0x46')](handleError(_0x20f4e6,null));};exports['removeAgents']=function(_0x452a65,_0x17c5fc){return db['ChatWebsite'][_0x77b2('0x4b')]({'where':{'id':_0x452a65[_0x77b2('0x48')]['id']}})['then'](handleEntityNotFound(_0x17c5fc,null))[_0x77b2('0x42')](function(_0xf20fed){if(_0xf20fed){return _0xf20fed[_0x77b2('0x125')](_0x452a65['query'][_0x77b2('0x5c')])[_0x77b2('0x42')](function(){if(_[_0x77b2('0x126')](_0x452a65[_0x77b2('0x32')][_0x77b2('0x5c')])){for(var _0x1e8187=0x0;_0x1e8187<_0x452a65[_0x77b2('0x32')][_0x77b2('0x5c')][_0x77b2('0x37')];_0x1e8187+=0x1){socket[_0x77b2('0x123')]('userChatWebsite:remove',{'UserId':Number(_0x452a65[_0x77b2('0x32')][_0x77b2('0x5c')][_0x1e8187]),'ChatWebsiteId':Number(_0x452a65[_0x77b2('0x48')]['id'])});}}else{socket[_0x77b2('0x123')]('userChatWebsite:remove',{'UserId':Number(_0x452a65[_0x77b2('0x32')][_0x77b2('0x5c')]),'ChatWebsiteId':Number(_0x452a65[_0x77b2('0x48')]['id'])});}});}})[_0x77b2('0x42')](respondWithStatusCode(_0x17c5fc,null))[_0x77b2('0x46')](handleError(_0x17c5fc,null));};exports[_0x77b2('0x127')]=function(_0x18a967,_0x413f62){var _0x8a1a74={};var _0x34bc6a={};var _0x2f5c46;var _0xde51c1;return db[_0x77b2('0x41')][_0x77b2('0xd4')]({'where':{'id':_0x18a967[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x413f62,null))[_0x77b2('0x42')](function(_0x474783){if(_0x474783){_0x2f5c46=_0x474783;_0x34bc6a[_0x77b2('0x30')]=_[_0x77b2('0x4a')](db['User'][_0x77b2('0x58')]);_0x34bc6a[_0x77b2('0x32')]=_[_0x77b2('0x4a')](_0x18a967[_0x77b2('0x32')]);_0x34bc6a[_0x77b2('0x33')]=_['intersection'](_0x34bc6a[_0x77b2('0x30')],_0x34bc6a[_0x77b2('0x32')]);_0x8a1a74[_0x77b2('0x34')]=_[_0x77b2('0x35')](_0x34bc6a[_0x77b2('0x30')],qs[_0x77b2('0x36')](_0x18a967[_0x77b2('0x32')][_0x77b2('0x36')]));_0x8a1a74[_0x77b2('0x34')]=_0x8a1a74[_0x77b2('0x34')][_0x77b2('0x37')]?_0x8a1a74['attributes']:_0x34bc6a[_0x77b2('0x30')];_0x8a1a74[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0x18a967['query']['sort']);_0x8a1a74[_0x77b2('0x3e')]=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0x18a967[_0x77b2('0x32')],_0x34bc6a[_0x77b2('0x33')]));if(_0x18a967[_0x77b2('0x32')][_0x77b2('0x3c')]){_0x8a1a74[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x8a1a74['where'],{'$or':_[_0x77b2('0x31')](_0x8a1a74['attributes'],function(_0xc67a12){var _0x4f11a0={};_0x4f11a0[_0xc67a12]={'$like':'%'+_0x18a967[_0x77b2('0x32')]['filter']+'%'};return _0x4f11a0;})});}_0x8a1a74=_[_0x77b2('0x3d')]({},_0x8a1a74,_0x18a967['options']);return _0x2f5c46[_0x77b2('0x127')](_0x8a1a74);}})['then'](function(_0x1d27dd){if(_0x1d27dd){_0xde51c1=_0x1d27dd['length'];if(!_0x18a967[_0x77b2('0x32')]['hasOwnProperty']('nolimit')){_0x8a1a74[_0x77b2('0x21')]=qs['limit'](_0x18a967[_0x77b2('0x32')][_0x77b2('0x21')]);_0x8a1a74[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x18a967[_0x77b2('0x32')][_0x77b2('0x20')]);}return _0x2f5c46[_0x77b2('0x127')](_0x8a1a74);}})[_0x77b2('0x42')](function(_0x24bddb){if(_0x24bddb){return _0x24bddb?{'count':_0xde51c1,'rows':_0x24bddb}:null;}})[_0x77b2('0x42')](respondWithResult(_0x413f62,null))[_0x77b2('0x46')](handleError(_0x413f62,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 38aacd4..f36e8fa 100644 --- a/server/api/chatWebsite/chatWebsite.events.js +++ b/server/api/chatWebsite/chatWebsite.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1782=['hasOwnProperty','hook','../../mysqldb','ChatWebsite','update','emit'];(function(_0x4a4fb8,_0x1c8af){var _0x1d27c8=function(_0x56ae4f){while(--_0x56ae4f){_0x4a4fb8['push'](_0x4a4fb8['shift']());}};_0x1d27c8(++_0x1c8af);}(_0x1782,0x188));var _0x2178=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x1782[_0xfcbcb8];return _0x1b1f97;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x2178('0x0'))['db'][_0x2178('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2178('0x2'),'afterDestroy':'remove'};function emitEvent(_0xf336e1){return function(_0x24c4cd,_0x4a3e99,_0x40f25d){ChatWebsiteEvents['emit'](_0xf336e1+':'+_0x24c4cd['id'],_0x24c4cd);ChatWebsiteEvents[_0x2178('0x3')](_0xf336e1,_0x24c4cd);_0x40f25d(null);};}for(var e in events){if(events[_0x2178('0x4')](e)){var event=events[e];ChatWebsite[_0x2178('0x5')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xfd2f=['exports','events','../../mysqldb','ChatWebsite','save','remove','hook'];(function(_0x62937f,_0x20243c){var _0x3d11e3=function(_0x428221){while(--_0x428221){_0x62937f['push'](_0x62937f['shift']());}};_0x3d11e3(++_0x20243c);}(_0xfd2f,0x14a));var _0xffd2=function(_0x31bbbd,_0x5c6a56){_0x31bbbd=_0x31bbbd-0x0;var _0x58e12f=_0xfd2f[_0x31bbbd];return _0x58e12f;};'use strict';var EventEmitter=require(_0xffd2('0x0'));var ChatWebsite=require(_0xffd2('0x1'))['db'][_0xffd2('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xffd2('0x3'),'afterUpdate':'update','afterDestroy':_0xffd2('0x4')};function emitEvent(_0x407d4b){return function(_0x492c33,_0x983987,_0x22c424){ChatWebsiteEvents['emit'](_0x407d4b+':'+_0x492c33['id'],_0x492c33);ChatWebsiteEvents['emit'](_0x407d4b,_0x492c33);_0x22c424(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xffd2('0x5')](e,emitEvent(event));}}module[_0xffd2('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index b490618..76eb371 100644 --- a/server/api/chatWebsite/chatWebsite.model.js +++ b/server/api/chatWebsite/chatWebsite.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb82=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x30d774,_0x1f11ec){var _0x1fd848=function(_0x391235){while(--_0x391235){_0x30d774['push'](_0x30d774['shift']());}};_0x1fd848(++_0x1f11ec);}(_0xdb82,0x142));var _0x2db8=function(_0x2a2c8f,_0x529ed6){_0x2a2c8f=_0x2a2c8f-0x0;var _0xe577b0=_0xdb82[_0x2a2c8f];return _0xe577b0;};'use strict';var _=require(_0x2db8('0x0'));var util=require('util');var logger=require(_0x2db8('0x1'))(_0x2db8('0x2'));var moment=require(_0x2db8('0x3'));var BPromise=require(_0x2db8('0x4'));var rp=require(_0x2db8('0x5'));var fs=require('fs');var path=require(_0x2db8('0x6'));var rimraf=require(_0x2db8('0x7'));var config=require(_0x2db8('0x8'));var attributes=require(_0x2db8('0x9'));module[_0x2db8('0xa')]=function(_0x1561bf,_0xc18d4c){return _0x1561bf[_0x2db8('0xb')](_0x2db8('0xc'),attributes,{'tableName':_0x2db8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cd8=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cd8,0x186));var _0x82cd=function(_0x4ca1a3,_0x8330cc){_0x4ca1a3=_0x4ca1a3-0x0;var _0x373192=_0x2cd8[_0x4ca1a3];return _0x373192;};'use strict';var _=require(_0x82cd('0x0'));var util=require(_0x82cd('0x1'));var logger=require(_0x82cd('0x2'))(_0x82cd('0x3'));var moment=require(_0x82cd('0x4'));var BPromise=require(_0x82cd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82cd('0x6'));var rimraf=require(_0x82cd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82cd('0x8'));module[_0x82cd('0x9')]=function(_0x3b560c,_0xdb486c){return _0x3b560c[_0x82cd('0xa')](_0x82cd('0xb'),attributes,{'tableName':_0x82cd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index dcec07a..b68aa60 100644 --- a/server/api/chatWebsite/chatWebsite.rpc.js +++ b/server/api/chatWebsite/chatWebsite.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d2d=['lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x11fc4e,_0x2cae75){var _0x5bdbad=function(_0x59f068){while(--_0x59f068){_0x11fc4e['push'](_0x11fc4e['shift']());}};_0x5bdbad(++_0x2cae75);}(_0x6d2d,0x96));var _0xd6d2=function(_0x581c9b,_0x278f23){_0x581c9b=_0x581c9b-0x0;var _0xf0c58=_0x6d2d[_0x581c9b];return _0xf0c58;};'use strict';var _=require(_0xd6d2('0x0'));var util=require(_0xd6d2('0x1'));var moment=require(_0xd6d2('0x2'));var BPromise=require('bluebird');var rs=require(_0xd6d2('0x3'));var fs=require('fs');var Redis=require(_0xd6d2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd6d2('0x5'))(_0xd6d2('0x6'));var config=require(_0xd6d2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd6d2('0x8')][_0xd6d2('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd6d2('0xa')],{'host':_0xd6d2('0xb'),'port':0x18eb});var socket=require(_0xd6d2('0xc'))(new Redis(config['redis']));require(_0xd6d2('0xd'))['register'](socket);function respondWithRpcPromise(_0x588805,_0x3e7fef,_0x37fe82){return new BPromise(function(_0x15057f,_0x2e5e27){return client[_0xd6d2('0xe')](_0x588805,_0x37fe82)['then'](function(_0x2e4f12){logger[_0xd6d2('0xf')](_0xd6d2('0x10'),_0x3e7fef,_0xd6d2('0x11'));logger[_0xd6d2('0x12')](_0xd6d2('0x13'),_0x3e7fef,'request\x20sent',JSON[_0xd6d2('0x14')](_0x2e4f12));if(_0x2e4f12['error']){if(_0x2e4f12[_0xd6d2('0x15')][_0xd6d2('0x16')]===0x1f4){logger[_0xd6d2('0x15')](_0xd6d2('0x10'),_0x3e7fef,_0x2e4f12[_0xd6d2('0x15')][_0xd6d2('0x17')]);return _0x2e5e27(_0x2e4f12['error']['message']);}logger[_0xd6d2('0x15')](_0xd6d2('0x10'),_0x3e7fef,_0x2e4f12[_0xd6d2('0x15')][_0xd6d2('0x17')]);return _0x15057f(_0x2e4f12['error'][_0xd6d2('0x17')]);}else{logger[_0xd6d2('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x3e7fef,'request\x20sent');_0x15057f(_0x2e4f12['result'][_0xd6d2('0x17')]);}})[_0xd6d2('0x18')](function(_0x3531cf){logger[_0xd6d2('0x15')](_0xd6d2('0x10'),_0x3e7fef,_0x3531cf);_0x2e5e27(_0x3531cf);});});} \ No newline at end of file +var _0xde60=['debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','request\x20sent'];(function(_0x398eb1,_0x50f55d){var _0x58a83f=function(_0x3ebf00){while(--_0x3ebf00){_0x398eb1['push'](_0x398eb1['shift']());}};_0x58a83f(++_0x50f55d);}(_0xde60,0x126));var _0x0de6=function(_0x3c3698,_0xa0bf08){_0x3c3698=_0x3c3698-0x0;var _0x4e6637=_0xde60[_0x3c3698];return _0x4e6637;};'use strict';var _=require('lodash');var util=require(_0x0de6('0x0'));var moment=require(_0x0de6('0x1'));var BPromise=require(_0x0de6('0x2'));var rs=require(_0x0de6('0x3'));var fs=require('fs');var Redis=require(_0x0de6('0x4'));var db=require(_0x0de6('0x5'))['db'];var utils=require(_0x0de6('0x6'));var logger=require('../../config/logger')(_0x0de6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0de6('0x8')][_0x0de6('0x9')]({'port':0x232a});config[_0x0de6('0xa')]=_['defaults'](config[_0x0de6('0xa')],{'host':_0x0de6('0xb'),'port':0x18eb});var socket=require(_0x0de6('0xc'))(new Redis(config[_0x0de6('0xa')]));require(_0x0de6('0xd'))[_0x0de6('0xe')](socket);function respondWithRpcPromise(_0x49fce8,_0x27652f,_0x575e25){return new BPromise(function(_0x5e4638,_0x566741){return client[_0x0de6('0xf')](_0x49fce8,_0x575e25)['then'](function(_0x25c706){logger[_0x0de6('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x27652f,_0x0de6('0x11'));logger[_0x0de6('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x27652f,'request\x20sent',JSON[_0x0de6('0x13')](_0x25c706));if(_0x25c706[_0x0de6('0x14')]){if(_0x25c706[_0x0de6('0x14')][_0x0de6('0x15')]===0x1f4){logger['error'](_0x0de6('0x16'),_0x27652f,_0x25c706[_0x0de6('0x14')][_0x0de6('0x17')]);return _0x566741(_0x25c706[_0x0de6('0x14')]['message']);}logger['error'](_0x0de6('0x16'),_0x27652f,_0x25c706[_0x0de6('0x14')][_0x0de6('0x17')]);return _0x5e4638(_0x25c706[_0x0de6('0x14')][_0x0de6('0x17')]);}else{logger[_0x0de6('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x27652f,_0x0de6('0x11'));_0x5e4638(_0x25c706[_0x0de6('0x18')]['message']);}})[_0x0de6('0x19')](function(_0x524268){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x27652f,_0x524268);_0x566741(_0x524268);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 5a5d7dd..178d179 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd587=['length','./chatWebsite.events','save','update','register'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xd587,0x1b9));var _0x7d58=function(_0x4f7267,_0x385d1e){_0x4f7267=_0x4f7267-0x0;var _0x2efceb=_0xd587[_0x4f7267];return _0x2efceb;};'use strict';var ChatWebsiteEvents=require(_0x7d58('0x0'));var events=[_0x7d58('0x1'),'remove',_0x7d58('0x2')];function createListener(_0x4ec0e4,_0x52ee4a){return function(_0x2c2538){_0x52ee4a['emit'](_0x4ec0e4,_0x2c2538);};}function removeListener(_0x242bae,_0x2fe32e){return function(){ChatWebsiteEvents['removeListener'](_0x242bae,_0x2fe32e);};}exports[_0x7d58('0x3')]=function(_0x422ff3){for(var _0x6772bd=0x0,_0x42765d=events[_0x7d58('0x4')];_0x6772bd<_0x42765d;_0x6772bd++){var _0x9ac419=events[_0x6772bd];var _0x31a898=createListener('chatWebsite:'+_0x9ac419,_0x422ff3);ChatWebsiteEvents['on'](_0x9ac419,_0x31a898);}}; \ No newline at end of file +var _0xf40c=['removeListener','register','chatWebsite:','./chatWebsite.events','remove','update','emit'];(function(_0x424460,_0x52b6dc){var _0x208d60=function(_0x20e273){while(--_0x20e273){_0x424460['push'](_0x424460['shift']());}};_0x208d60(++_0x52b6dc);}(_0xf40c,0x114));var _0xcf40=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xf40c[_0x2f1762];return _0x8ab21;};'use strict';var ChatWebsiteEvents=require(_0xcf40('0x0'));var events=['save',_0xcf40('0x1'),_0xcf40('0x2')];function createListener(_0x32fa8b,_0x13ab2d){return function(_0x18a45f){_0x13ab2d[_0xcf40('0x3')](_0x32fa8b,_0x18a45f);};}function removeListener(_0x33d8a8,_0x27f91d){return function(){ChatWebsiteEvents[_0xcf40('0x4')](_0x33d8a8,_0x27f91d);};}exports[_0xcf40('0x5')]=function(_0x5a779c){for(var _0x45df28=0x0,_0x1172df=events['length'];_0x45df28<_0x1172df;_0x45df28++){var _0x13fb23=events[_0x45df28];var _0x3510af=createListener(_0xcf40('0x6')+_0x13fb23,_0x5a779c);ChatWebsiteEvents['on'](_0x13fb23,_0x3510af);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index ed1dcf2..cf5faaa 100644 --- a/server/api/chatWebsite/index.js +++ b/server/api/chatWebsite/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa83e=['offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','put','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','describe','show','/:id/dispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','format','%s-%s','single','file','join','server/files/images/avatars/','now','originalname','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','attachments'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa83e,0x1d5));var _0xea83=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0xa83e[_0x539533];return _0x3942f3;};'use strict';var multer=require(_0xea83('0x0'));var util=require(_0xea83('0x1'));var path=require(_0xea83('0x2'));var timeout=require(_0xea83('0x3'));var express=require(_0xea83('0x4'));var router=express[_0xea83('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xea83('0x6'));var interaction=require(_0xea83('0x7'));var config=require(_0xea83('0x8'));var controller=require(_0xea83('0x9'));router['get']('/',auth[_0xea83('0xa')](),controller[_0xea83('0xb')]);router[_0xea83('0xc')]('/describe',auth[_0xea83('0xa')](),controller[_0xea83('0xd')]);router[_0xea83('0xc')]('/:id',auth[_0xea83('0xa')](),controller[_0xea83('0xe')]);router[_0xea83('0xc')](_0xea83('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xea83('0xc')]('/:id/canned_answers',auth[_0xea83('0xa')](),controller[_0xea83('0x10')]);router[_0xea83('0xc')](_0xea83('0x11'),controller[_0xea83('0x12')]);router[_0xea83('0xc')](_0xea83('0x13'),controller[_0xea83('0x14')]);router[_0xea83('0xc')](_0xea83('0x15'),controller[_0xea83('0x16')]);router['get'](_0xea83('0x17'),controller[_0xea83('0x18')]);router[_0xea83('0xc')]('/:id/interactions',auth[_0xea83('0xa')](),controller[_0xea83('0x19')]);router['get'](_0xea83('0x1a'),controller['getSnippet']);router[_0xea83('0xc')]('/:id/applications',auth[_0xea83('0xa')](),controller[_0xea83('0x1b')]);router[_0xea83('0xc')](_0xea83('0x1c'),auth[_0xea83('0xa')](),controller[_0xea83('0x1d')]);router[_0xea83('0xc')]('/:id/fields',controller[_0xea83('0x1e')]);router[_0xea83('0xc')](_0xea83('0x1f'),auth[_0xea83('0xa')](),controller[_0xea83('0x20')]);router[_0xea83('0xc')](_0xea83('0x21'),auth[_0xea83('0xa')](),controller[_0xea83('0x22')]);router['post']('/',auth[_0xea83('0xa')](),controller[_0xea83('0x23')]);router[_0xea83('0x24')]('/:id/dispositions',auth[_0xea83('0xa')](),controller[_0xea83('0x25')]);router[_0xea83('0x24')](_0xea83('0x26'),auth[_0xea83('0xa')](),controller[_0xea83('0x27')]);var upload=multer({'storage':multer[_0xea83('0x28')]({'destination':function(_0x4f3af8,_0x2cb1dd,_0x3412b9){_0x3412b9(null,path['join'](config[_0xea83('0x29')],'server/files/images/logos/'));},'filename':function(_0x152485,_0x53bc86,_0x2e9142){_0x2e9142(null,util[_0xea83('0x2a')](_0xea83('0x2b'),Date['now'](),_0x53bc86['originalname']));}})});router[_0xea83('0x24')](_0xea83('0x11'),upload[_0xea83('0x2c')](_0xea83('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0xea83('0x28')]({'destination':function(_0x32327b,_0x15df89,_0x6935b1){_0x6935b1(null,path[_0xea83('0x2e')](config[_0xea83('0x29')],_0xea83('0x2f')));},'filename':function(_0x226924,_0x170865,_0x57c152){_0x57c152(null,util['format'](_0xea83('0x2b'),Date[_0xea83('0x30')](),_0x170865[_0xea83('0x31')]));}})});router[_0xea83('0x24')](_0xea83('0x13'),upload['single'](_0xea83('0x2d')),controller[_0xea83('0x32')]);var upload=multer({'storage':multer[_0xea83('0x28')]({'destination':function(_0x2a69bb,_0x413d87,_0x40d2c9){_0x40d2c9(null,path[_0xea83('0x2e')](config[_0xea83('0x29')],_0xea83('0x2f')));},'filename':function(_0x1c20a6,_0x328959,_0x13cc4c){_0x13cc4c(null,util[_0xea83('0x2a')](_0xea83('0x2b'),Date[_0xea83('0x30')](),_0x328959[_0xea83('0x31')]));}})});router['post']('/:id/customer_avatar',upload['single']('file'),controller[_0xea83('0x33')]);var upload=multer({'storage':multer[_0xea83('0x28')]({'destination':function(_0x1b8bea,_0x595c3f,_0x2a9e16){_0x2a9e16(null,path['join'](config[_0xea83('0x29')],_0xea83('0x2f')));},'filename':function(_0x3b4a50,_0x8dfbfb,_0x54f562){_0x54f562(null,util[_0xea83('0x2a')](_0xea83('0x2b'),Date[_0xea83('0x30')](),_0x8dfbfb[_0xea83('0x31')]));}})});router['post'](_0xea83('0x17'),upload[_0xea83('0x2c')]('file'),controller[_0xea83('0x34')]);router[_0xea83('0x24')](_0xea83('0x35'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x5f2232,_0x1bb5f8,_0x1184d3){const _0x4aae1a=path[_0xea83('0x2e')](config[_0xea83('0x29')],_0xea83('0x36'),_0xea83('0x37'),_0xea83('0x38'));fs_extra[_0xea83('0x39')](_0x4aae1a,function(){_0x1184d3(null,_0x4aae1a);});},'filename':function(_0x2014b8,_0x4766ee,_0xdf68bb){const _0x22c77a=_0x4766ee[_0xea83('0x31')][_0xea83('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x51b86c=path[_0xea83('0x3b')](_0x22c77a);const _0x132c8c=Date[_0xea83('0x30')]()+'-'+_0x22c77a[_0xea83('0x3a')](_0x51b86c,'')+_0x51b86c;_0xdf68bb(null,_0x132c8c);}})});router[_0xea83('0x24')](_0xea83('0x3c'),offlineUploadMulter[_0xea83('0x3d')](),controller[_0xea83('0x3e')]);router[_0xea83('0x24')]('/:id/interactions',auth[_0xea83('0xa')](),controller[_0xea83('0x3f')]);router[_0xea83('0x24')](_0xea83('0x40'),auth[_0xea83('0xa')](),controller[_0xea83('0x41')]);router['post'](_0xea83('0x1c'),auth['isAuthenticated'](),controller[_0xea83('0x42')]);router[_0xea83('0x24')](_0xea83('0x21'),auth['isAuthenticated'](),controller['addAgents']);router[_0xea83('0x43')]('/:id',auth[_0xea83('0xa')](),controller['update']);router[_0xea83('0x44')](_0xea83('0x45'),auth[_0xea83('0xa')](),controller[_0xea83('0x46')]);router[_0xea83('0x44')](_0xea83('0xf'),auth[_0xea83('0xa')](),controller[_0xea83('0x47')]);router[_0xea83('0x44')]('/:id/canned_answers',auth[_0xea83('0xa')](),controller[_0xea83('0x48')]);router[_0xea83('0x44')](_0xea83('0x21'),auth[_0xea83('0xa')](),controller[_0xea83('0x49')]);module[_0xea83('0x4a')]=router; \ No newline at end of file +var _0x0661=['server/files/images/avatars/','/:id/notify','notify','server/files','replace','/:id/offline','any','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/:id','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','join','server/files/images/logos/','%s-%s','originalname','single','diskStorage','root','format','file','addAvatar','now','addCustomerAvatar'];(function(_0x4decc4,_0x289caa){var _0x31920f=function(_0x446056){while(--_0x446056){_0x4decc4['push'](_0x4decc4['shift']());}};_0x31920f(++_0x289caa);}(_0x0661,0x9a));var _0x1066=function(_0x3b541e,_0x14a851){_0x3b541e=_0x3b541e-0x0;var _0x1b54ae=_0x0661[_0x3b541e];return _0x1b54ae;};'use strict';var multer=require(_0x1066('0x0'));var util=require(_0x1066('0x1'));var path=require(_0x1066('0x2'));var timeout=require(_0x1066('0x3'));var express=require(_0x1066('0x4'));var router=express[_0x1066('0x5')]();var fs_extra=require(_0x1066('0x6'));var auth=require(_0x1066('0x7'));var interaction=require(_0x1066('0x8'));var config=require(_0x1066('0x9'));var controller=require(_0x1066('0xa'));router[_0x1066('0xb')]('/',auth[_0x1066('0xc')](),controller[_0x1066('0xd')]);router[_0x1066('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x1066('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x1066('0xb')]('/:id/dispositions',auth[_0x1066('0xc')](),controller['getDispositions']);router[_0x1066('0xb')](_0x1066('0xf'),auth[_0x1066('0xc')](),controller[_0x1066('0x10')]);router['get'](_0x1066('0x11'),controller[_0x1066('0x12')]);router[_0x1066('0xb')](_0x1066('0x13'),controller[_0x1066('0x14')]);router[_0x1066('0xb')](_0x1066('0x15'),controller[_0x1066('0x16')]);router[_0x1066('0xb')](_0x1066('0x17'),controller['getSystemAvatar']);router['get'](_0x1066('0x18'),auth['isAuthenticated'](),controller[_0x1066('0x19')]);router[_0x1066('0xb')]('/:id/snippet',controller[_0x1066('0x1a')]);router[_0x1066('0xb')](_0x1066('0x1b'),auth[_0x1066('0xc')](),controller[_0x1066('0x1c')]);router['get'](_0x1066('0x1d'),auth[_0x1066('0xc')](),controller[_0x1066('0x1e')]);router['get']('/:id/fields',controller[_0x1066('0x1f')]);router[_0x1066('0xb')](_0x1066('0x20'),auth[_0x1066('0xc')](),controller[_0x1066('0x21')]);router[_0x1066('0xb')](_0x1066('0x22'),auth[_0x1066('0xc')](),controller[_0x1066('0x23')]);router[_0x1066('0x24')]('/',auth[_0x1066('0xc')](),controller[_0x1066('0x25')]);router[_0x1066('0x24')](_0x1066('0x26'),auth['isAuthenticated'](),controller[_0x1066('0x27')]);router[_0x1066('0x24')](_0x1066('0xf'),auth[_0x1066('0xc')](),controller[_0x1066('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13961c,_0x4e7844,_0x26098f){_0x26098f(null,path[_0x1066('0x29')](config['root'],_0x1066('0x2a')));},'filename':function(_0x369881,_0x2e7bfd,_0x191a02){_0x191a02(null,util['format'](_0x1066('0x2b'),Date['now'](),_0x2e7bfd[_0x1066('0x2c')]));}})});router[_0x1066('0x24')]('/:id/logo',upload[_0x1066('0x2d')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x1066('0x2e')]({'destination':function(_0x260caa,_0x891a5c,_0x552b31){_0x552b31(null,path[_0x1066('0x29')](config[_0x1066('0x2f')],'server/files/images/avatars/'));},'filename':function(_0x3429c6,_0x250118,_0x267373){_0x267373(null,util[_0x1066('0x30')](_0x1066('0x2b'),Date['now'](),_0x250118['originalname']));}})});router['post'](_0x1066('0x13'),upload[_0x1066('0x2d')](_0x1066('0x31')),controller[_0x1066('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1c6be1,_0x4353d2,_0x4821f5){_0x4821f5(null,path[_0x1066('0x29')](config[_0x1066('0x2f')],'server/files/images/avatars/'));},'filename':function(_0x37cfb5,_0x2b6294,_0x3678b2){_0x3678b2(null,util[_0x1066('0x30')]('%s-%s',Date[_0x1066('0x33')](),_0x2b6294[_0x1066('0x2c')]));}})});router[_0x1066('0x24')](_0x1066('0x15'),upload[_0x1066('0x2d')](_0x1066('0x31')),controller[_0x1066('0x34')]);var upload=multer({'storage':multer[_0x1066('0x2e')]({'destination':function(_0x4256a8,_0x2c92bc,_0x125063){_0x125063(null,path['join'](config[_0x1066('0x2f')],_0x1066('0x35')));},'filename':function(_0x3aa0f7,_0x46c994,_0x556909){_0x556909(null,util['format']('%s-%s',Date['now'](),_0x46c994[_0x1066('0x2c')]));}})});router[_0x1066('0x24')]('/:id/system_avatar',upload[_0x1066('0x2d')]('file'),controller['addSystemAvatar']);router['post'](_0x1066('0x36'),controller[_0x1066('0x37')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x57cfb3,_0x207536,_0x15b0fd){const _0x54f23f=path[_0x1066('0x29')](config[_0x1066('0x2f')],_0x1066('0x38'),'attachments','offline-chat');fs_extra['ensureDir'](_0x54f23f,function(){_0x15b0fd(null,_0x54f23f);});},'filename':function(_0x2c6af1,_0x70d033,_0x50bb32){const _0x2ad2e7=_0x70d033[_0x1066('0x2c')][_0x1066('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x33f257=path['extname'](_0x2ad2e7);const _0x8bb5c9=Date['now']()+'-'+_0x2ad2e7[_0x1066('0x39')](_0x33f257,'')+_0x33f257;_0x50bb32(null,_0x8bb5c9);}})});router['post'](_0x1066('0x3a'),offlineUploadMulter[_0x1066('0x3b')](),controller['offline']);router[_0x1066('0x24')](_0x1066('0x18'),auth[_0x1066('0xc')](),controller[_0x1066('0x3c')]);router['post'](_0x1066('0x1b'),auth[_0x1066('0xc')](),controller[_0x1066('0x3d')]);router[_0x1066('0x24')](_0x1066('0x1d'),auth[_0x1066('0xc')](),controller[_0x1066('0x3e')]);router[_0x1066('0x24')](_0x1066('0x22'),auth[_0x1066('0xc')](),controller[_0x1066('0x3f')]);router[_0x1066('0x40')](_0x1066('0xe'),auth[_0x1066('0xc')](),controller[_0x1066('0x41')]);router[_0x1066('0x42')](_0x1066('0xe'),auth[_0x1066('0xc')](),controller['destroy']);router['delete'](_0x1066('0x26'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x1066('0x42')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1066('0x43')]);router[_0x1066('0x42')]('/:id/users',auth[_0x1066('0xc')](),controller[_0x1066('0x44')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 2c76b75..18d9e42 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcc1=['Client-Side\x20logger\x20not\x20found!','/client-logs','exports','../components/auth/service','../config/environment','Router','env','app','get','client-side-logger'];(function(_0x36e9c1,_0x80b26b){var _0x569640=function(_0x3d07a2){while(--_0x3d07a2){_0x36e9c1['push'](_0x36e9c1['shift']());}};_0x569640(++_0x80b26b);}(_0xfcc1,0x16b));var _0x1fcc=function(_0x185952,_0x914ad8){_0x185952=_0x185952-0x0;var _0x3b2d90=_0xfcc1[_0x185952];return _0x3b2d90;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0x1fcc('0x0'));var config=require(_0x1fcc('0x1'));var router=express[_0x1fcc('0x2')]();var isProduction=config[_0x1fcc('0x3')]==='production'||![];function clientSideLogs(_0xe42c5,_0x5703bd,_0x168cbb){var _0x5f2207=_0xe42c5[_0x1fcc('0x4')][_0x1fcc('0x5')](_0x1fcc('0x6'));if(!_0x5f2207){throw new Error(_0x1fcc('0x7'));}return beaverLogger['expressEndpoint']({'uri':_0x1fcc('0x8'),'logger':_0x5f2207,'enableCors':!isProduction})(_0xe42c5,_0x5703bd,_0x168cbb);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0x1fcc('0x9')]=router; \ No newline at end of file +var _0xd6fd=['production','app','get','expressEndpoint','/client-logs','isAuthenticated','exports','beaver-logger/server','../components/auth/service','Router','env'];(function(_0x274eb5,_0x1d9790){var _0x3f81ac=function(_0x99e4b9){while(--_0x99e4b9){_0x274eb5['push'](_0x274eb5['shift']());}};_0x3f81ac(++_0x1d9790);}(_0xd6fd,0xd8));var _0xdd6f=function(_0x185063,_0x3f0bb7){_0x185063=_0x185063-0x0;var _0x16d9d3=_0xd6fd[_0x185063];return _0x16d9d3;};var beaverLogger=require(_0xdd6f('0x0'));var express=require('express');var auth=require(_0xdd6f('0x1'));var config=require('../config/environment');var router=express[_0xdd6f('0x2')]();var isProduction=config[_0xdd6f('0x3')]===_0xdd6f('0x4')||![];function clientSideLogs(_0x1059c1,_0x2c8583,_0x5b1462){var _0x819fa=_0x1059c1[_0xdd6f('0x5')][_0xdd6f('0x6')]('client-side-logger');if(!_0x819fa){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xdd6f('0x7')]({'uri':_0xdd6f('0x8'),'logger':_0x819fa,'enableCors':!isProduction})(_0x1059c1,_0x2c8583,_0x5b1462);}router['use'](auth[_0xdd6f('0x9')](),clientSideLogs);module[_0xdd6f('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 3712fbe..317be7d 100644 --- a/server/api/cloudProvider/cloudProvider.attributes.js +++ b/server/api/cloudProvider/cloudProvider.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4828=['MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','AmazonAWS','Google','MicrosoftAzure','ENUM','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x4828,0x1b1));var _0x8482=function(_0x359dcf,_0x5786cf){_0x359dcf=_0x359dcf-0x0;var _0x25a5c5=_0x4828[_0x359dcf];return _0x25a5c5;};'use strict';var Sequelize=require('sequelize');module[_0x8482('0x0')]={'name':{'type':Sequelize[_0x8482('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x8482('0x2'),_0x8482('0x3'),_0x8482('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x8482('0x5')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':_0x8482('0x6')},'data2':{'type':Sequelize[_0x8482('0x1')],'comment':_0x8482('0x7')},'data3':{'type':Sequelize['STRING'],'comment':_0x8482('0x8')},'data4':{'type':Sequelize[_0x8482('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0x8482('0x9')},'data6':{'type':Sequelize[_0x8482('0xa')],'comment':_0x8482('0xb')},'data7':{'type':Sequelize[_0x8482('0xa')],'comment':_0x8482('0xc')}}; \ No newline at end of file +var _0x6ba4=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6ba4,0xe5));var _0x46ba=function(_0x2331e6,_0x571011){_0x2331e6=_0x2331e6-0x0;var _0x453f20=_0x6ba4[_0x2331e6];return _0x453f20;};'use strict';var Sequelize=require(_0x46ba('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x46ba('0x1')](_0x46ba('0x2'),_0x46ba('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x46ba('0x1')](_0x46ba('0x4'),_0x46ba('0x5'))},'data1':{'type':Sequelize[_0x46ba('0x6')],'comment':_0x46ba('0x7')},'data2':{'type':Sequelize[_0x46ba('0x6')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0x46ba('0x8')},'data4':{'type':Sequelize[_0x46ba('0x6')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x46ba('0x9')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x46ba('0x9')],'comment':_0x46ba('0xa')},'data7':{'type':Sequelize[_0x46ba('0x9')],'comment':_0x46ba('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index db33059..dd1f7ec 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5d8=['data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','name','padEnd','slice','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','CloudProvider','findAll','rows','service','MicrosoftAzure','decryptString','data3','show','params','rawAttributes','length','find','catch','create','Name\x20parameter\x20not\x20specified','body','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code'];(function(_0x59c97d,_0x241c58){var _0x5074a6=function(_0x12c4a4){while(--_0x12c4a4){_0x59c97d['push'](_0x59c97d['shift']());}};_0x5074a6(++_0x241c58);}(_0xa5d8,0xcb));var _0x8a5d=function(_0x3636ca,_0x253ff8){_0x3636ca=_0x3636ca-0x0;var _0x512228=_0xa5d8[_0x3636ca];return _0x512228;};'use strict';var _=require(_0x8a5d('0x0'));var Redis=require(_0x8a5d('0x1'));var qs=require(_0x8a5d('0x2'));var encryptor=require(_0x8a5d('0x3'));var config=require(_0x8a5d('0x4'));var logger=require(_0x8a5d('0x5'))(_0x8a5d('0x6'));var db=require(_0x8a5d('0x7'))['db'];var oauth=require(_0x8a5d('0x8'));config[_0x8a5d('0x9')]=_['defaults'](config[_0x8a5d('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x544189,_0x3cb9d9){_0x3cb9d9=_0x3cb9d9||0xcc;return function(_0x1084b2){if(_0x1084b2){return _0x544189[_0x8a5d('0xa')](_0x3cb9d9);}return _0x544189[_0x8a5d('0xb')](_0x3cb9d9)[_0x8a5d('0xc')]();};}function respondWithResult(_0x4212b4,_0x390454){_0x390454=_0x390454||0xc8;return function(_0x10644f){if(_0x10644f){return _0x4212b4[_0x8a5d('0xb')](_0x390454)[_0x8a5d('0xd')](_0x10644f);}};}function respondWithFilteredResult(_0x31a4a6,_0xf6bfe2){return function(_0x188dfb){if(_0x188dfb){var _0x1a5134=typeof _0xf6bfe2[_0x8a5d('0xe')]==='undefined'&&typeof _0xf6bfe2['limit']===_0x8a5d('0xf');var _0x2b841b=_0x188dfb[_0x8a5d('0x10')];var _0x14c8a1=_0x1a5134?0x0:_0xf6bfe2['offset'];var _0x1250bd=_0x1a5134?_0x188dfb[_0x8a5d('0x10')]:_0xf6bfe2[_0x8a5d('0xe')]+_0xf6bfe2['limit'];var _0x551298;if(_0x1250bd>=_0x2b841b){_0x1250bd=_0x2b841b;_0x551298=0xc8;}else{_0x551298=0xce;}_0x31a4a6[_0x8a5d('0xb')](_0x551298);return _0x31a4a6[_0x8a5d('0x11')](_0x8a5d('0x12'),_0x14c8a1+'-'+_0x1250bd+'/'+_0x2b841b)[_0x8a5d('0xd')](_0x188dfb);}return null;};}function saveUpdates(_0x479db5){return function(_0x1beac7){if(_0x1beac7){return _0x1beac7[_0x8a5d('0x13')](_0x479db5)[_0x8a5d('0x14')](function(_0x18d820){return _0x18d820;});}return null;};}function removeEntity(_0x19bfe8){return function(_0x5f0e7e){if(_0x5f0e7e){return _0x5f0e7e['destroy']()[_0x8a5d('0x14')](function(){_0x19bfe8[_0x8a5d('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7f7181){return function(_0x2930ae){if(!_0x2930ae){_0x7f7181[_0x8a5d('0xa')](0x194);}return _0x2930ae;};}function handleError(_0x3f1347,_0xd2b723){_0xd2b723=_0xd2b723||0x1f4;return function(_0x5c4bf6){logger['error'](_0x5c4bf6['stack']);if(_0x5c4bf6['name']){delete _0x5c4bf6[_0x8a5d('0x15')];}_0x3f1347[_0x8a5d('0xb')](_0xd2b723)['send'](_0x5c4bf6);};}function maskClientSecret(_0x80e3f5){return _[_0x8a5d('0x16')](_0x80e3f5[_0x8a5d('0x17')](0x0,0x3),0x14,'*');}exports[_0x8a5d('0x18')]=function(_0x25251e,_0x434f43){var _0x2d9f5b={},_0xc881c7={},_0x119c30={'count':0x0,'rows':[]};var _0x57943c=_[_0x8a5d('0x19')](db['CloudProvider']['rawAttributes'],function(_0x11b36b){return{'name':_0x11b36b[_0x8a5d('0x1a')],'type':_0x11b36b[_0x8a5d('0x1b')][_0x8a5d('0x1c')]};});_0xc881c7[_0x8a5d('0x1d')]=_[_0x8a5d('0x19')](_0x57943c,_0x8a5d('0x15'));_0xc881c7[_0x8a5d('0x1e')]=_[_0x8a5d('0x1f')](_0x25251e['query']);_0xc881c7['filters']=_[_0x8a5d('0x20')](_0xc881c7['model'],_0xc881c7[_0x8a5d('0x1e')]);_0x2d9f5b[_0x8a5d('0x21')]=_[_0x8a5d('0x20')](_0xc881c7[_0x8a5d('0x1d')],qs[_0x8a5d('0x22')](_0x25251e['query'][_0x8a5d('0x22')]));_0x2d9f5b[_0x8a5d('0x21')]=_0x2d9f5b[_0x8a5d('0x21')]['length']?_0x2d9f5b[_0x8a5d('0x21')]:_0xc881c7['model'];if(!_0x25251e[_0x8a5d('0x1e')][_0x8a5d('0x23')]('nolimit')){_0x2d9f5b[_0x8a5d('0x24')]=qs[_0x8a5d('0x24')](_0x25251e[_0x8a5d('0x1e')][_0x8a5d('0x24')]);_0x2d9f5b['offset']=qs[_0x8a5d('0xe')](_0x25251e['query'][_0x8a5d('0xe')]);}_0x2d9f5b[_0x8a5d('0x25')]=qs[_0x8a5d('0x26')](_0x25251e[_0x8a5d('0x1e')][_0x8a5d('0x26')]);_0x2d9f5b[_0x8a5d('0x27')]=qs[_0x8a5d('0x28')](_['pick'](_0x25251e[_0x8a5d('0x1e')],_0xc881c7['filters']),_0x57943c);if(_0x25251e[_0x8a5d('0x1e')][_0x8a5d('0x29')]){_0x2d9f5b[_0x8a5d('0x27')]=_['merge'](_0x2d9f5b[_0x8a5d('0x27')],{'$or':_[_0x8a5d('0x19')](_0x57943c,function(_0x4ecdb2){if(_0x4ecdb2[_0x8a5d('0x1b')]!==_0x8a5d('0x2a')){var _0x547f1e={};_0x547f1e[_0x4ecdb2[_0x8a5d('0x15')]]={'$like':'%'+_0x25251e['query'][_0x8a5d('0x29')]+'%'};return _0x547f1e;}})});}_0x2d9f5b=_[_0x8a5d('0x2b')]({},_0x2d9f5b,_0x25251e[_0x8a5d('0x2c')]);var _0x5ee75b={'where':_0x2d9f5b[_0x8a5d('0x27')]};return db['CloudProvider'][_0x8a5d('0x10')](_0x5ee75b)[_0x8a5d('0x14')](function(_0x24e779){_0x119c30['count']=_0x24e779;if(_0x25251e['query']['includeAll']){_0x2d9f5b[_0x8a5d('0x2d')]=[{'all':!![]}];}return db[_0x8a5d('0x2e')][_0x8a5d('0x2f')](_0x2d9f5b);})[_0x8a5d('0x14')](function(_0x4372ff){_0x119c30[_0x8a5d('0x30')]=_['map'](_0x4372ff,function(_0x16a9de){if(_0x16a9de[_0x8a5d('0x31')]===_0x8a5d('0x32')){var _0x5d735f=encryptor[_0x8a5d('0x33')](_0x16a9de[_0x8a5d('0x34')]);_0x16a9de[_0x8a5d('0x34')]=maskClientSecret(_0x5d735f);}return _0x16a9de;});return _0x119c30;})['then'](respondWithFilteredResult(_0x434f43,_0x2d9f5b))['catch'](handleError(_0x434f43,null));};exports[_0x8a5d('0x35')]=function(_0x383869,_0xbdb9d1){var _0x5d4339={'raw':!![],'where':{'id':_0x383869[_0x8a5d('0x36')]['id']}},_0x86ebdd={};_0x86ebdd[_0x8a5d('0x1d')]=_['keys'](db['CloudProvider'][_0x8a5d('0x37')]);_0x86ebdd[_0x8a5d('0x1e')]=_[_0x8a5d('0x1f')](_0x383869['query']);_0x86ebdd[_0x8a5d('0x28')]=_[_0x8a5d('0x20')](_0x86ebdd[_0x8a5d('0x1d')],_0x86ebdd[_0x8a5d('0x1e')]);_0x5d4339[_0x8a5d('0x21')]=_[_0x8a5d('0x20')](_0x86ebdd[_0x8a5d('0x1d')],qs[_0x8a5d('0x22')](_0x383869[_0x8a5d('0x1e')][_0x8a5d('0x22')]));_0x5d4339[_0x8a5d('0x21')]=_0x5d4339[_0x8a5d('0x21')][_0x8a5d('0x38')]?_0x5d4339[_0x8a5d('0x21')]:_0x86ebdd[_0x8a5d('0x1d')];if(_0x383869[_0x8a5d('0x1e')]['includeAll']){_0x5d4339[_0x8a5d('0x2d')]=[{'all':!![]}];}_0x5d4339=_[_0x8a5d('0x2b')]({},_0x5d4339,_0x383869[_0x8a5d('0x2c')]);return db[_0x8a5d('0x2e')][_0x8a5d('0x39')](_0x5d4339)[_0x8a5d('0x14')](handleEntityNotFound(_0xbdb9d1,null))[_0x8a5d('0x14')](function(_0x4d26bf){if(_0x4d26bf['service']==='MicrosoftAzure'){var _0x3d13c3=encryptor['decryptString'](_0x4d26bf[_0x8a5d('0x34')]);_0x4d26bf['data3']=maskClientSecret(_0x3d13c3);}return _0x4d26bf;})[_0x8a5d('0x14')](respondWithResult(_0xbdb9d1,null))[_0x8a5d('0x3a')](handleError(_0xbdb9d1,null));};exports[_0x8a5d('0x3b')]=function(_0x39ebb8,_0x4b0868){if(!_0x39ebb8['body'][_0x8a5d('0x15')])throw new Error(_0x8a5d('0x3c'));if(!_0x39ebb8[_0x8a5d('0x3d')][_0x8a5d('0x31')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x2808e9=db[_0x8a5d('0x2e')][_0x8a5d('0x37')][_0x8a5d('0x31')]['values'];if(!_0x2808e9[_0x8a5d('0x3e')](_0x39ebb8[_0x8a5d('0x3d')]['service']))throw new Error(_0x8a5d('0x3f')+_0x2808e9[_0x8a5d('0x40')](',\x20'));if(_0x39ebb8['body']['service']===_0x8a5d('0x32')&&_0x39ebb8['body'][_0x8a5d('0x34')]){_0x39ebb8['body'][_0x8a5d('0x34')]=encryptor['encryptString'](_0x39ebb8['body'][_0x8a5d('0x34')]);}return db['CloudProvider'][_0x8a5d('0x3b')](_0x39ebb8[_0x8a5d('0x3d')],{})['then'](respondWithResult(_0x4b0868,0xc9))[_0x8a5d('0x3a')](handleError(_0x4b0868,null));};exports['update']=function(_0x3269bc,_0x4cfcdf){if(_0x3269bc['body']['id']){delete _0x3269bc[_0x8a5d('0x3d')]['id'];}return db['CloudProvider'][_0x8a5d('0x39')]({'where':{'id':_0x3269bc[_0x8a5d('0x36')]['id']}})[_0x8a5d('0x14')](handleEntityNotFound(_0x4cfcdf,null))[_0x8a5d('0x14')](function(_0x5bcf48){if(_0x5bcf48[_0x8a5d('0x31')]===_0x8a5d('0x32')&&_0x3269bc['body'][_0x8a5d('0x34')]){_0x3269bc['body'][_0x8a5d('0x34')]=encryptor[_0x8a5d('0x41')](_0x3269bc['body'][_0x8a5d('0x34')]);}return _0x5bcf48;})[_0x8a5d('0x14')](saveUpdates(_0x3269bc[_0x8a5d('0x3d')],null))['then'](respondWithResult(_0x4cfcdf,null))['catch'](handleError(_0x4cfcdf,null));};exports[_0x8a5d('0x42')]=function(_0x3392a7,_0x50ef4d){return db[_0x8a5d('0x2e')][_0x8a5d('0x39')]({'where':{'id':_0x3392a7['params']['id']}})['then'](handleEntityNotFound(_0x50ef4d,null))[_0x8a5d('0x14')](removeEntity(_0x50ef4d,null))['catch'](handleError(_0x50ef4d,null));};exports['oauth2MicrosoftAuthorize']=function(_0x2b5acc,_0x539ab2){return db[_0x8a5d('0x2e')][_0x8a5d('0x43')]({'where':{'id':_0x2b5acc[_0x8a5d('0x36')]['id']},'raw':!![]})[_0x8a5d('0x14')](function(_0x18e277){if(!_0x18e277)return _0x539ab2[_0x8a5d('0xa')](0x194);return{'url':oauth[_0x8a5d('0x44')](_0x18e277,_0x2b5acc[_0x8a5d('0x45')]['id'])};})[_0x8a5d('0x14')](respondWithResult(_0x539ab2,null))[_0x8a5d('0x3a')](handleError(_0x539ab2,null));};exports[_0x8a5d('0x46')]=function(_0x1db2a3,_0x4b0ff4){var _0x6bde07=_0x1db2a3[_0x8a5d('0x3d')];var _0x4b9999;var _0x5ee6c0;if(_0x6bde07['error'])throw _0x6bde07;redis[_0x8a5d('0x47')](_0x6bde07[_0x8a5d('0x48')])[_0x8a5d('0x14')](function(_0x4b5224){if(!_0x4b5224)throw new Error(_0x8a5d('0x49'));_0x4b9999=JSON[_0x8a5d('0x4a')](_0x4b5224);var _0x2657ee=Buffer[_0x8a5d('0x4b')](_0x6bde07[_0x8a5d('0x48')],'base64')['toString']('ascii');_0x5ee6c0=JSON['parse'](_0x2657ee);if(!oauth[_0x8a5d('0x4c')](_0x6bde07['id_token'],_0x4b9999[_0x8a5d('0x4d')]))throw new Error(_0x8a5d('0x4e'));redis[_0x8a5d('0x4f')](_0x6bde07[_0x8a5d('0x48')]);return oauth[_0x8a5d('0x50')](_0x6bde07[_0x8a5d('0x51')],_0x4b9999);})['then'](function(_0x3ed76d){_0x4b9999[_0x8a5d('0x52')]=_0x3ed76d[_0x8a5d('0x53')];_0x4b9999[_0x8a5d('0x54')]=_0x3ed76d[_0x8a5d('0x55')];return db['CloudProvider'][_0x8a5d('0x13')]({'data5':_0x4b9999[_0x8a5d('0x52')],'data6':_0x4b9999[_0x8a5d('0x54')]},{'where':{'id':_0x4b9999['id']}});})[_0x8a5d('0x14')](function(){oauth['startRefreshInterval'](_0x4b9999);socket[_0x8a5d('0x56')](_0x8a5d('0x57'),{'id':_0x5ee6c0['id']});return;})[_0x8a5d('0x14')](respondWithStatusCode(_0x4b0ff4,null))['catch'](function(_0x141bfa){if(_0x5ee6c0){socket['emit'](_0x8a5d('0x58'),{'id':_0x5ee6c0['id']});}if(!_0x4b9999){logger[_0x8a5d('0x59')](_0x8a5d('0x5a'),_0x141bfa);return _0x4b0ff4[_0x8a5d('0xb')](0x1f4)[_0x8a5d('0x5b')](_0x141bfa[_0x8a5d('0x5c')]);}logger[_0x8a5d('0x59')](_0x8a5d('0x5d'),_0x4b9999['id'],JSON[_0x8a5d('0x5e')](_0x141bfa));});}; \ No newline at end of file +var _0xa19e=['json','offset','undefined','limit','count','set','update','then','name','send','padEnd','index','map','CloudProvider','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','service','decryptString','data3','show','params','length','find','MicrosoftAzure','catch','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','from','state','ascii','parse','isValidIdToken','oauth2Claims','getOauth2MicrosoftAccessToken','data5','data6','startRefreshInterval','emit','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','defaults','redis','localhost','socket.io-emitter','sendStatus','end','status'];(function(_0x15dcad,_0x383596){var _0x5c83e0=function(_0x44aad0){while(--_0x44aad0){_0x15dcad['push'](_0x15dcad['shift']());}};_0x5c83e0(++_0x383596);}(_0xa19e,0x15d));var _0xea19=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0xa19e[_0x55c3d9];return _0x19fd97;};'use strict';var _=require(_0xea19('0x0'));var Redis=require(_0xea19('0x1'));var qs=require(_0xea19('0x2'));var encryptor=require(_0xea19('0x3'));var config=require(_0xea19('0x4'));var logger=require(_0xea19('0x5'))(_0xea19('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0xea19('0x7'));config['redis']=_[_0xea19('0x8')](config[_0xea19('0x9')],{'host':_0xea19('0xa'),'port':0x18eb});var socket=require(_0xea19('0xb'))(new Redis(config[_0xea19('0x9')]));var redis=new Redis(config[_0xea19('0x9')]);function respondWithStatusCode(_0xa3cc42,_0x127a79){_0x127a79=_0x127a79||0xcc;return function(_0x220f86){if(_0x220f86){return _0xa3cc42[_0xea19('0xc')](_0x127a79);}return _0xa3cc42['status'](_0x127a79)[_0xea19('0xd')]();};}function respondWithResult(_0x50c3a8,_0x176ab8){_0x176ab8=_0x176ab8||0xc8;return function(_0x26f7cd){if(_0x26f7cd){return _0x50c3a8[_0xea19('0xe')](_0x176ab8)[_0xea19('0xf')](_0x26f7cd);}};}function respondWithFilteredResult(_0x407a56,_0x1c6e56){return function(_0x1d42dc){if(_0x1d42dc){var _0x5c6295=typeof _0x1c6e56[_0xea19('0x10')]===_0xea19('0x11')&&typeof _0x1c6e56[_0xea19('0x12')]===_0xea19('0x11');var _0x564790=_0x1d42dc[_0xea19('0x13')];var _0x509daa=_0x5c6295?0x0:_0x1c6e56[_0xea19('0x10')];var _0x717be4=_0x5c6295?_0x1d42dc[_0xea19('0x13')]:_0x1c6e56[_0xea19('0x10')]+_0x1c6e56[_0xea19('0x12')];var _0x2d5f8f;if(_0x717be4>=_0x564790){_0x717be4=_0x564790;_0x2d5f8f=0xc8;}else{_0x2d5f8f=0xce;}_0x407a56['status'](_0x2d5f8f);return _0x407a56[_0xea19('0x14')]('Content-Range',_0x509daa+'-'+_0x717be4+'/'+_0x564790)['json'](_0x1d42dc);}return null;};}function saveUpdates(_0x5c8bed){return function(_0x10086e){if(_0x10086e){return _0x10086e[_0xea19('0x15')](_0x5c8bed)[_0xea19('0x16')](function(_0x1ab3ae){return _0x1ab3ae;});}return null;};}function removeEntity(_0x4e5e01){return function(_0x20f97b){if(_0x20f97b){return _0x20f97b['destroy']()[_0xea19('0x16')](function(){_0x4e5e01['status'](0xcc)[_0xea19('0xd')]();});}};}function handleEntityNotFound(_0x1cada9){return function(_0x489de7){if(!_0x489de7){_0x1cada9[_0xea19('0xc')](0x194);}return _0x489de7;};}function handleError(_0xedc16d,_0x5be55a){_0x5be55a=_0x5be55a||0x1f4;return function(_0x1914d3){logger['error'](_0x1914d3['stack']);if(_0x1914d3[_0xea19('0x17')]){delete _0x1914d3[_0xea19('0x17')];}_0xedc16d[_0xea19('0xe')](_0x5be55a)[_0xea19('0x18')](_0x1914d3);};}function maskClientSecret(_0x300ed4){return _[_0xea19('0x19')](_0x300ed4['slice'](0x0,0x3),0x14,'*');}exports[_0xea19('0x1a')]=function(_0x2c7a8a,_0x5df391){var _0x13db5e={},_0x370686={},_0x2cacf2={'count':0x0,'rows':[]};var _0x45a755=_[_0xea19('0x1b')](db[_0xea19('0x1c')]['rawAttributes'],function(_0x391872){return{'name':_0x391872[_0xea19('0x1d')],'type':_0x391872[_0xea19('0x1e')][_0xea19('0x1f')]};});_0x370686[_0xea19('0x20')]=_[_0xea19('0x1b')](_0x45a755,_0xea19('0x17'));_0x370686[_0xea19('0x21')]=_[_0xea19('0x22')](_0x2c7a8a[_0xea19('0x21')]);_0x370686[_0xea19('0x23')]=_[_0xea19('0x24')](_0x370686['model'],_0x370686[_0xea19('0x21')]);_0x13db5e[_0xea19('0x25')]=_[_0xea19('0x24')](_0x370686[_0xea19('0x20')],qs['fields'](_0x2c7a8a['query'][_0xea19('0x26')]));_0x13db5e['attributes']=_0x13db5e['attributes']['length']?_0x13db5e[_0xea19('0x25')]:_0x370686['model'];if(!_0x2c7a8a[_0xea19('0x21')][_0xea19('0x27')](_0xea19('0x28'))){_0x13db5e[_0xea19('0x12')]=qs['limit'](_0x2c7a8a[_0xea19('0x21')][_0xea19('0x12')]);_0x13db5e['offset']=qs[_0xea19('0x10')](_0x2c7a8a[_0xea19('0x21')][_0xea19('0x10')]);}_0x13db5e[_0xea19('0x29')]=qs['sort'](_0x2c7a8a['query'][_0xea19('0x2a')]);_0x13db5e['where']=qs['filters'](_['pick'](_0x2c7a8a[_0xea19('0x21')],_0x370686[_0xea19('0x23')]),_0x45a755);if(_0x2c7a8a[_0xea19('0x21')][_0xea19('0x2b')]){_0x13db5e['where']=_[_0xea19('0x2c')](_0x13db5e[_0xea19('0x2d')],{'$or':_[_0xea19('0x1b')](_0x45a755,function(_0x2e6256){if(_0x2e6256[_0xea19('0x1e')]!==_0xea19('0x2e')){var _0x27bd8a={};_0x27bd8a[_0x2e6256['name']]={'$like':'%'+_0x2c7a8a[_0xea19('0x21')][_0xea19('0x2b')]+'%'};return _0x27bd8a;}})});}_0x13db5e=_[_0xea19('0x2c')]({},_0x13db5e,_0x2c7a8a[_0xea19('0x2f')]);var _0x522b58={'where':_0x13db5e[_0xea19('0x2d')]};return db[_0xea19('0x1c')][_0xea19('0x13')](_0x522b58)[_0xea19('0x16')](function(_0x43acb0){_0x2cacf2[_0xea19('0x13')]=_0x43acb0;if(_0x2c7a8a[_0xea19('0x21')][_0xea19('0x30')]){_0x13db5e[_0xea19('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0xea19('0x32')](_0x13db5e);})[_0xea19('0x16')](function(_0x48f8d4){_0x2cacf2[_0xea19('0x33')]=_[_0xea19('0x1b')](_0x48f8d4,function(_0x67b6ba){if(_0x67b6ba[_0xea19('0x34')]==='MicrosoftAzure'){var _0x56e47f=encryptor[_0xea19('0x35')](_0x67b6ba[_0xea19('0x36')]);_0x67b6ba[_0xea19('0x36')]=maskClientSecret(_0x56e47f);}return _0x67b6ba;});return _0x2cacf2;})[_0xea19('0x16')](respondWithFilteredResult(_0x5df391,_0x13db5e))['catch'](handleError(_0x5df391,null));};exports[_0xea19('0x37')]=function(_0xb53d40,_0x269318){var _0x43bad6={'raw':!![],'where':{'id':_0xb53d40[_0xea19('0x38')]['id']}},_0x478703={};_0x478703[_0xea19('0x20')]=_[_0xea19('0x22')](db[_0xea19('0x1c')]['rawAttributes']);_0x478703[_0xea19('0x21')]=_[_0xea19('0x22')](_0xb53d40[_0xea19('0x21')]);_0x478703[_0xea19('0x23')]=_[_0xea19('0x24')](_0x478703[_0xea19('0x20')],_0x478703['query']);_0x43bad6[_0xea19('0x25')]=_[_0xea19('0x24')](_0x478703[_0xea19('0x20')],qs[_0xea19('0x26')](_0xb53d40['query'][_0xea19('0x26')]));_0x43bad6[_0xea19('0x25')]=_0x43bad6[_0xea19('0x25')][_0xea19('0x39')]?_0x43bad6[_0xea19('0x25')]:_0x478703[_0xea19('0x20')];if(_0xb53d40[_0xea19('0x21')][_0xea19('0x30')]){_0x43bad6[_0xea19('0x31')]=[{'all':!![]}];}_0x43bad6=_[_0xea19('0x2c')]({},_0x43bad6,_0xb53d40['options']);return db['CloudProvider'][_0xea19('0x3a')](_0x43bad6)[_0xea19('0x16')](handleEntityNotFound(_0x269318,null))[_0xea19('0x16')](function(_0x53e814){if(_0x53e814[_0xea19('0x34')]===_0xea19('0x3b')){var _0x55ceca=encryptor[_0xea19('0x35')](_0x53e814[_0xea19('0x36')]);_0x53e814[_0xea19('0x36')]=maskClientSecret(_0x55ceca);}return _0x53e814;})[_0xea19('0x16')](respondWithResult(_0x269318,null))[_0xea19('0x3c')](handleError(_0x269318,null));};exports[_0xea19('0x3d')]=function(_0x56fd86,_0xde8feb){if(!_0x56fd86[_0xea19('0x3e')][_0xea19('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x56fd86[_0xea19('0x3e')][_0xea19('0x34')])throw new Error(_0xea19('0x3f'));var _0x4910f2=db[_0xea19('0x1c')]['rawAttributes'][_0xea19('0x34')][_0xea19('0x40')];if(!_0x4910f2[_0xea19('0x41')](_0x56fd86[_0xea19('0x3e')][_0xea19('0x34')]))throw new Error(_0xea19('0x42')+_0x4910f2['join'](',\x20'));if(_0x56fd86[_0xea19('0x3e')]['service']===_0xea19('0x3b')&&_0x56fd86[_0xea19('0x3e')][_0xea19('0x36')]){_0x56fd86['body'][_0xea19('0x36')]=encryptor['encryptString'](_0x56fd86[_0xea19('0x3e')]['data3']);}return db[_0xea19('0x1c')][_0xea19('0x3d')](_0x56fd86[_0xea19('0x3e')],{})[_0xea19('0x16')](respondWithResult(_0xde8feb,0xc9))[_0xea19('0x3c')](handleError(_0xde8feb,null));};exports[_0xea19('0x15')]=function(_0x5840c1,_0x1e5759){if(_0x5840c1[_0xea19('0x3e')]['id']){delete _0x5840c1[_0xea19('0x3e')]['id'];}return db[_0xea19('0x1c')]['find']({'where':{'id':_0x5840c1[_0xea19('0x38')]['id']}})[_0xea19('0x16')](handleEntityNotFound(_0x1e5759,null))[_0xea19('0x16')](function(_0x3ab458){if(_0x3ab458[_0xea19('0x34')]===_0xea19('0x3b')&&_0x5840c1['body'][_0xea19('0x36')]){_0x5840c1[_0xea19('0x3e')]['data3']=encryptor[_0xea19('0x43')](_0x5840c1[_0xea19('0x3e')][_0xea19('0x36')]);}return _0x3ab458;})['then'](saveUpdates(_0x5840c1['body'],null))[_0xea19('0x16')](respondWithResult(_0x1e5759,null))['catch'](handleError(_0x1e5759,null));};exports[_0xea19('0x44')]=function(_0x5c0322,_0x4d85de){return db['CloudProvider'][_0xea19('0x3a')]({'where':{'id':_0x5c0322['params']['id']}})[_0xea19('0x16')](handleEntityNotFound(_0x4d85de,null))['then'](removeEntity(_0x4d85de,null))[_0xea19('0x3c')](handleError(_0x4d85de,null));};exports[_0xea19('0x45')]=function(_0x3953f6,_0x246e95){return db[_0xea19('0x1c')][_0xea19('0x46')]({'where':{'id':_0x3953f6['params']['id']},'raw':!![]})['then'](function(_0x2bf61e){if(!_0x2bf61e)return _0x246e95[_0xea19('0xc')](0x194);return{'url':oauth[_0xea19('0x47')](_0x2bf61e,_0x3953f6['user']['id'])};})[_0xea19('0x16')](respondWithResult(_0x246e95,null))[_0xea19('0x3c')](handleError(_0x246e95,null));};exports[_0xea19('0x48')]=function(_0x19ae2b,_0xf37f3e){var _0x1e855c=_0x19ae2b[_0xea19('0x3e')];var _0xa242f8;var _0x52e7a8;if(_0x1e855c['error'])throw _0x1e855c;redis[_0xea19('0x49')](_0x1e855c['state'])[_0xea19('0x16')](function(_0x2f3043){if(!_0x2f3043)throw new Error(_0xea19('0x4a'));_0xa242f8=JSON['parse'](_0x2f3043);var _0x59bbf1=Buffer[_0xea19('0x4b')](_0x1e855c[_0xea19('0x4c')],'base64')['toString'](_0xea19('0x4d'));_0x52e7a8=JSON[_0xea19('0x4e')](_0x59bbf1);if(!oauth[_0xea19('0x4f')](_0x1e855c['id_token'],_0xa242f8[_0xea19('0x50')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x1e855c[_0xea19('0x4c')]);return oauth[_0xea19('0x51')](_0x1e855c['code'],_0xa242f8);})[_0xea19('0x16')](function(_0xc91c3c){_0xa242f8[_0xea19('0x52')]=_0xc91c3c['access_token'];_0xa242f8[_0xea19('0x53')]=_0xc91c3c['refresh_token'];return db[_0xea19('0x1c')]['update']({'data5':_0xa242f8[_0xea19('0x52')],'data6':_0xa242f8[_0xea19('0x53')]},{'where':{'id':_0xa242f8['id']}});})['then'](function(){oauth[_0xea19('0x54')](_0xa242f8);socket[_0xea19('0x55')]('microsoftAuthorization:success',{'id':_0x52e7a8['id']});return;})[_0xea19('0x16')](respondWithStatusCode(_0xf37f3e,null))[_0xea19('0x3c')](function(_0x47fd99){if(_0x52e7a8){socket['emit'](_0xea19('0x56'),{'id':_0x52e7a8['id']});}if(!_0xa242f8){logger[_0xea19('0x57')](_0xea19('0x58'),_0x47fd99);return _0xf37f3e['status'](0x1f4)['send'](_0x47fd99[_0xea19('0x59')]);}logger[_0xea19('0x57')](_0xea19('0x5a'),_0xa242f8['id'],JSON['stringify'](_0x47fd99));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index de2bfed..054b4d5 100644 --- a/server/api/cloudProvider/cloudProvider.model.js +++ b/server/api/cloudProvider/cloudProvider.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc91=['bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','api'];(function(_0x7fab68,_0x410ee5){var _0x240cee=function(_0x515f76){while(--_0x515f76){_0x7fab68['push'](_0x7fab68['shift']());}};_0x240cee(++_0x410ee5);}(_0xdc91,0x1a2));var _0x1dc9=function(_0x184c04,_0x3579ff){_0x184c04=_0x184c04-0x0;var _0x2a91d6=_0xdc91[_0x184c04];return _0x2a91d6;};'use strict';var _=require(_0x1dc9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1dc9('0x1'));var moment=require('moment');var BPromise=require(_0x1dc9('0x2'));var rp=require(_0x1dc9('0x3'));var fs=require('fs');var path=require(_0x1dc9('0x4'));var rimraf=require(_0x1dc9('0x5'));var config=require(_0x1dc9('0x6'));var attributes=require(_0x1dc9('0x7'));module[_0x1dc9('0x8')]=function(_0x407df2,_0x359021){return _0x407df2[_0x1dc9('0x9')](_0x1dc9('0xa'),attributes,{'tableName':_0x1dc9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41f4=['cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','CloudProvider'];(function(_0x487f14,_0x1cb7ea){var _0x739a54=function(_0xab20d4){while(--_0xab20d4){_0x487f14['push'](_0x487f14['shift']());}};_0x739a54(++_0x1cb7ea);}(_0x41f4,0x175));var _0x441f=function(_0x29c87c,_0x5837e9){_0x29c87c=_0x29c87c-0x0;var _0x3fb66f=_0x41f4[_0x29c87c];return _0x3fb66f;};'use strict';var _=require(_0x441f('0x0'));var util=require(_0x441f('0x1'));var logger=require(_0x441f('0x2'))(_0x441f('0x3'));var moment=require(_0x441f('0x4'));var BPromise=require('bluebird');var rp=require(_0x441f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x441f('0x6'));var config=require(_0x441f('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x441f('0x8')]=function(_0x6c4f5,_0x292970){return _0x6c4f5[_0x441f('0x9')](_0x441f('0xa'),attributes,{'tableName':_0x441f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 6bfea48..2046a2d 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a1b=['all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','localhost','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','map','type','Dynamics365','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','data2','id_token','from','stringify','toString','randomBytes','client_id','data1','redirect_uri','data4','response_mode','form_post','nonce','prompt','login','key','oauth2Claims','set','payload','iss','issuer','audience','exp','resolve','then','data3','findOne','refresh_token','data6','decryptString','{TENANT_ID}','data5','CloudProvider','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','replace','intervals','findAll'];(function(_0x52c942,_0x5f49a7){var _0x4060c5=function(_0x483b17){while(--_0x483b17){_0x52c942['push'](_0x52c942['shift']());}};_0x4060c5(++_0x5f49a7);}(_0x0a1b,0xd8));var _0xb0a1=function(_0x49bc19,_0x219a9f){_0x49bc19=_0x49bc19-0x0;var _0x1c34dc=_0x0a1b[_0x49bc19];return _0x1c34dc;};'use strict';var _=require(_0xb0a1('0x0'));var crypto=require(_0xb0a1('0x1'));var jwt=require(_0xb0a1('0x2'));var moment=require(_0xb0a1('0x3'));var Redis=require(_0xb0a1('0x4'));var rp=require(_0xb0a1('0x5'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0xb0a1('0x6'));var logger=require(_0xb0a1('0x7'))('api');var schedule=require(_0xb0a1('0x8'));var db=require(_0xb0a1('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb0a1('0xa'),'port':0x18eb});var redis=new Redis(config[_0xb0a1('0xb')]);var MICROSOFT_AUTH_URL=_0xb0a1('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb0a1('0xd'),_0xb0a1('0xe'),_0xb0a1('0xf'),'offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All',_0xb0a1('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xb0a1('0xd'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xb0a1('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0xb0a1('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5c08c4){var _0x503810=_[_0xb0a1('0x13')](AZURE_AUTH_SCOPES[_0x5c08c4[_0xb0a1('0x14')]]);if(_0x5c08c4['type']===_0xb0a1('0x15'))_0x503810['push'](_0x5c08c4[_0xb0a1('0x16')]+_0xb0a1('0x17'));return _0x503810[_0xb0a1('0x18')]('\x20');}function getAccessTokenScope(_0x55919b){if(_0x55919b[_0xb0a1('0x14')]===_0xb0a1('0x19'))return _0xb0a1('0x1a');if(_0x55919b[_0xb0a1('0x14')]===_0xb0a1('0x15'))return _0x55919b[_0xb0a1('0x16')]+_0xb0a1('0x17');}function generateMicrosoftAuthorizationUrl(_0x878483,_0x53c790){var _0xa02d56=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x878483[_0xb0a1('0x1b')]);var _0x309a0d=['code',_0xb0a1('0x1c')];var _0x12cf54=Buffer[_0xb0a1('0x1d')](JSON[_0xb0a1('0x1e')]({'id':_0x53c790}))[_0xb0a1('0x1f')]('base64');var _0x543302=crypto[_0xb0a1('0x20')](0x10)[_0xb0a1('0x1f')]('hex');var _0x51b123=getAuthorizationScopes(_0x878483);var _0x5a3691=[{'key':_0xb0a1('0x21'),'value':_0x878483[_0xb0a1('0x22')]},{'key':'response_type','value':encodeURIComponent(_0x309a0d[_0xb0a1('0x18')]('\x20'))},{'key':_0xb0a1('0x23'),'value':_0x878483[_0xb0a1('0x24')]},{'key':_0xb0a1('0x25'),'value':_0xb0a1('0x26')},{'key':'scope','value':encodeURIComponent(_0x51b123)},{'key':'state','value':_0x12cf54},{'key':_0xb0a1('0x27'),'value':_0x543302},{'key':_0xb0a1('0x28'),'value':_0xb0a1('0x29')}];var _0x485f1b=_0xa02d56+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb0a1('0x13')](_0x5a3691,function(_0x45760d){return _0x45760d[_0xb0a1('0x2a')]+'='+_0x45760d['value'];})[_0xb0a1('0x18')]('&');_0x878483[_0xb0a1('0x2b')]={'issuer':_0xa02d56['replace']('oauth2/',''),'audience':_0x878483[_0xb0a1('0x22')],'state':_0x12cf54,'nonce':_0x543302};redis[_0xb0a1('0x2c')](_0x12cf54,JSON[_0xb0a1('0x1e')](_0x878483));return _0x485f1b;}function isValidIdToken(_0x29c96a,_0x9fa3ca){try{var _0x5df695=jwt['decode'](_0x29c96a,{'complete':!![]});var _0x228fcb=_0x5df695[_0xb0a1('0x2d')];if(_0x228fcb[_0xb0a1('0x2e')]!==_0x9fa3ca[_0xb0a1('0x2f')])return![];if(_0x228fcb['aud']!==_0x9fa3ca[_0xb0a1('0x30')])return![];if(_0x228fcb[_0xb0a1('0x27')]!==_0x9fa3ca[_0xb0a1('0x27')])return![];if(moment()['isAfter'](moment['unix'](_0x228fcb[_0xb0a1('0x31')])))return![];return!![];}catch(_0x262dca){throw _0x262dca;}}function refreshOauth2MicrosoftAccessToken(_0x149d2b){return Promise[_0xb0a1('0x32')]()[_0xb0a1('0x33')](function(){if(_0x149d2b[_0xb0a1('0x34')])return _0x149d2b;return db['CloudProvider'][_0xb0a1('0x35')]({'where':{'id':_0x149d2b['id']},'raw':!![]});})[_0xb0a1('0x33')](function(_0x2bb7ef){var _0x5db52a={'grant_type':_0xb0a1('0x36'),'refresh_token':_0x2bb7ef[_0xb0a1('0x37')],'scope':getAccessTokenScope(_0x2bb7ef),'redirect_uri':_0x2bb7ef[_0xb0a1('0x24')],'client_id':_0x2bb7ef[_0xb0a1('0x22')],'client_secret':encryptor[_0xb0a1('0x38')](_0x2bb7ef[_0xb0a1('0x34')])};var _0x4753d5={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0xb0a1('0x39'),_0x2bb7ef['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5db52a,'json':!![]};return rp(_0x4753d5);})[_0xb0a1('0x33')](function(_0x52ca94){_0x149d2b[_0xb0a1('0x3a')]=_0x52ca94['access_token'];_0x149d2b['data6']=_0x52ca94[_0xb0a1('0x36')];return db[_0xb0a1('0x3b')]['update']({'data5':_0x149d2b[_0xb0a1('0x3a')],'data6':_0x149d2b[_0xb0a1('0x37')]},{'where':{'id':_0x149d2b['id']}});})['then'](function(){return _0x149d2b;})[_0xb0a1('0x3c')](function(_0x49da69){logger[_0xb0a1('0x3d')](_0xb0a1('0x3e'),_0x149d2b['id'],_0x49da69);});}function getOauth2MicrosoftAccessToken(_0x25ffc8,_0x431629){var _0x29cd45={'grant_type':_0xb0a1('0x3f'),'code':_0x25ffc8,'scope':getAccessTokenScope(_0x431629),'redirect_uri':_0x431629['data4'],'client_id':_0x431629[_0xb0a1('0x22')],'client_secret':encryptor[_0xb0a1('0x38')](_0x431629['data3'])};var _0x41bd62={'method':_0xb0a1('0x40'),'uri':MICROSOFT_AUTH_URL[_0xb0a1('0x41')]('{TENANT_ID}',_0x431629['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x29cd45,'json':!![]};return rp(_0x41bd62);}function startRefreshInterval(_0x3ae47d){var _0x342741=schedule[_0xb0a1('0x42')];if(_0x342741[_0x3ae47d['id']])clearInterval(_0x342741[_0x3ae47d['id']]);_0x342741[_0x3ae47d['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x3ae47d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x342741;}function startAllRefreshIntervals(){return db[_0xb0a1('0x3b')][_0xb0a1('0x43')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb0a1('0x33')](function(_0x24ee78){var _0x35a866=_0x24ee78['map'](function(_0x68a212){return refreshOauth2MicrosoftAccessToken(_0x68a212)[_0xb0a1('0x33')](function(_0x291afb){startRefreshInterval(_0x291afb);});});return Promise[_0xb0a1('0x44')](_0x35a866);})[_0xb0a1('0x3c')](function(_0x179e4d){var _0x36a86b=_0x179e4d?util[_0xb0a1('0x45')](_0x179e4d,{'showHidden':![],'depth':null}):'';logger[_0xb0a1('0x3d')](_0xb0a1('0x46'),_0x36a86b);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x6f33=['all','catch','inspect','exports','lodash','crypto','moment','request-promise','util','../../config/environment','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','map','type','push','data7','join','Outlook365','Dynamics365','replace','{TENANT_ID}','data2','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','login','key','oauth2/','set','payload','issuer','aud','audience','isAfter','unix','resolve','data3','then','refresh_token','POST','data5','access_token','CloudProvider','data6','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','findAll'];(function(_0x498b80,_0x4a207c){var _0x368941=function(_0x1397a9){while(--_0x1397a9){_0x498b80['push'](_0x498b80['shift']());}};_0x368941(++_0x4a207c);}(_0x6f33,0xee));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x36f3('0x0'));var crypto=require(_0x36f3('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x36f3('0x2'));var Redis=require('ioredis');var rp=require(_0x36f3('0x3'));var util=require(_0x36f3('0x4'));var encryptor=require('../../components/encryptor');var config=require(_0x36f3('0x5'));var logger=require('../../config/logger')(_0x36f3('0x6'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x36f3('0x7'))['db'];config[_0x36f3('0x8')]=_[_0x36f3('0x9')](config[_0x36f3('0x8')],{'host':_0x36f3('0xa'),'port':0x18eb});var redis=new Redis(config[_0x36f3('0x8')]);var MICROSOFT_AUTH_URL=_0x36f3('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x36f3('0xc'),_0x36f3('0xd'),_0x36f3('0xe'),'offline_access',_0x36f3('0xf'),_0x36f3('0x10'),_0x36f3('0x11')],'Dynamics365':[_0x36f3('0xc'),_0x36f3('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x36f3('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x36f3('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x47afac){var _0x3a22f8=_[_0x36f3('0x15')](AZURE_AUTH_SCOPES[_0x47afac[_0x36f3('0x16')]]);if(_0x47afac[_0x36f3('0x16')]==='Dynamics365')_0x3a22f8[_0x36f3('0x17')](_0x47afac[_0x36f3('0x18')]+'/.default');return _0x3a22f8[_0x36f3('0x19')]('\x20');}function getAccessTokenScope(_0x3afdd4){if(_0x3afdd4[_0x36f3('0x16')]===_0x36f3('0x1a'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x3afdd4[_0x36f3('0x16')]===_0x36f3('0x1b'))return _0x3afdd4['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x20f60c,_0x2dbcf7){var _0x848d0d=MICROSOFT_AUTH_URL[_0x36f3('0x1c')](_0x36f3('0x1d'),_0x20f60c[_0x36f3('0x1e')]);var _0x50ad2c=['code',_0x36f3('0x1f')];var _0x416779=Buffer[_0x36f3('0x20')](JSON[_0x36f3('0x21')]({'id':_0x2dbcf7}))[_0x36f3('0x22')](_0x36f3('0x23'));var _0x1ab631=crypto[_0x36f3('0x24')](0x10)['toString'](_0x36f3('0x25'));var _0x308101=getAuthorizationScopes(_0x20f60c);var _0x219673=[{'key':_0x36f3('0x26'),'value':_0x20f60c[_0x36f3('0x27')]},{'key':_0x36f3('0x28'),'value':encodeURIComponent(_0x50ad2c['join']('\x20'))},{'key':_0x36f3('0x29'),'value':_0x20f60c[_0x36f3('0x2a')]},{'key':_0x36f3('0x2b'),'value':_0x36f3('0x2c')},{'key':_0x36f3('0x2d'),'value':encodeURIComponent(_0x308101)},{'key':_0x36f3('0x2e'),'value':_0x416779},{'key':_0x36f3('0x2f'),'value':_0x1ab631},{'key':'prompt','value':_0x36f3('0x30')}];var _0x51121a=_0x848d0d+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x219673,function(_0x54267e){return _0x54267e[_0x36f3('0x31')]+'='+_0x54267e['value'];})[_0x36f3('0x19')]('&');_0x20f60c['oauth2Claims']={'issuer':_0x848d0d[_0x36f3('0x1c')](_0x36f3('0x32'),''),'audience':_0x20f60c[_0x36f3('0x27')],'state':_0x416779,'nonce':_0x1ab631};redis[_0x36f3('0x33')](_0x416779,JSON[_0x36f3('0x21')](_0x20f60c));return _0x51121a;}function isValidIdToken(_0x4a8e5c,_0x4c09fa){try{var _0x2dc242=jwt['decode'](_0x4a8e5c,{'complete':!![]});var _0x30cc87=_0x2dc242[_0x36f3('0x34')];if(_0x30cc87['iss']!==_0x4c09fa[_0x36f3('0x35')])return![];if(_0x30cc87[_0x36f3('0x36')]!==_0x4c09fa[_0x36f3('0x37')])return![];if(_0x30cc87[_0x36f3('0x2f')]!==_0x4c09fa[_0x36f3('0x2f')])return![];if(moment()[_0x36f3('0x38')](moment[_0x36f3('0x39')](_0x30cc87['exp'])))return![];return!![];}catch(_0x1646ab){throw _0x1646ab;}}function refreshOauth2MicrosoftAccessToken(_0x151078){return Promise[_0x36f3('0x3a')]()['then'](function(){if(_0x151078[_0x36f3('0x3b')])return _0x151078;return db['CloudProvider']['findOne']({'where':{'id':_0x151078['id']},'raw':!![]});})[_0x36f3('0x3c')](function(_0xfff1b5){var _0x5865f2={'grant_type':_0x36f3('0x3d'),'refresh_token':_0xfff1b5['data6'],'scope':getAccessTokenScope(_0xfff1b5),'redirect_uri':_0xfff1b5[_0x36f3('0x2a')],'client_id':_0xfff1b5[_0x36f3('0x27')],'client_secret':encryptor['decryptString'](_0xfff1b5[_0x36f3('0x3b')])};var _0x3e5bf2={'method':_0x36f3('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x36f3('0x1c')]('{TENANT_ID}',_0xfff1b5[_0x36f3('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5865f2,'json':!![]};return rp(_0x3e5bf2);})[_0x36f3('0x3c')](function(_0x5bc239){_0x151078[_0x36f3('0x3f')]=_0x5bc239[_0x36f3('0x40')];_0x151078['data6']=_0x5bc239[_0x36f3('0x3d')];return db[_0x36f3('0x41')]['update']({'data5':_0x151078[_0x36f3('0x3f')],'data6':_0x151078[_0x36f3('0x42')]},{'where':{'id':_0x151078['id']}});})[_0x36f3('0x3c')](function(){return _0x151078;})['catch'](function(_0x3f7c68){logger[_0x36f3('0x43')](_0x36f3('0x44'),_0x151078['id'],_0x3f7c68);});}function getOauth2MicrosoftAccessToken(_0x31f22a,_0x2307b2){var _0x1677f2={'grant_type':_0x36f3('0x45'),'code':_0x31f22a,'scope':getAccessTokenScope(_0x2307b2),'redirect_uri':_0x2307b2[_0x36f3('0x2a')],'client_id':_0x2307b2['data1'],'client_secret':encryptor[_0x36f3('0x46')](_0x2307b2[_0x36f3('0x3b')])};var _0x4656e0={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x36f3('0x1c')](_0x36f3('0x1d'),_0x2307b2[_0x36f3('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1677f2,'json':!![]};return rp(_0x4656e0);}function startRefreshInterval(_0x4885e2){var _0x4a4ddb=schedule[_0x36f3('0x47')];if(_0x4a4ddb[_0x4885e2['id']])clearInterval(_0x4a4ddb[_0x4885e2['id']]);_0x4a4ddb[_0x4885e2['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x36f3('0x48')](this,{'id':_0x4885e2['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x36f3('0x47')]=_0x4a4ddb;}function startAllRefreshIntervals(){return db[_0x36f3('0x41')][_0x36f3('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x36f3('0x3c')](function(_0x4f0a4d){var _0x46a104=_0x4f0a4d[_0x36f3('0x15')](function(_0x50cec5){return refreshOauth2MicrosoftAccessToken(_0x50cec5)['then'](function(_0x1e7820){startRefreshInterval(_0x1e7820);});});return Promise[_0x36f3('0x4a')](_0x46a104);})[_0x36f3('0x4b')](function(_0x189be0){var _0x3d2c31=_0x189be0?util[_0x36f3('0x4c')](_0x189be0,{'showHidden':![],'depth':null}):'';logger[_0x36f3('0x43')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x3d2c31);});}module[_0x36f3('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 8aeb8d3..9d3496e 100644 --- a/server/api/cloudProvider/cloudProvider.rpc.js +++ b/server/api/cloudProvider/cloudProvider.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd48e=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CloudProvider,\x20%s,\x20%s','message','catch'];(function(_0x3b9a04,_0x2df8e7){var _0x320c46=function(_0x499081){while(--_0x499081){_0x3b9a04['push'](_0x3b9a04['shift']());}};_0x320c46(++_0x2df8e7);}(_0xd48e,0x93));var _0xed48=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xd48e[_0x44bcb0];return _0xfaf881;};'use strict';var _=require('lodash');var util=require(_0xed48('0x0'));var moment=require(_0xed48('0x1'));var BPromise=require(_0xed48('0x2'));var rs=require(_0xed48('0x3'));var fs=require('fs');var Redis=require(_0xed48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed48('0x5'));var logger=require(_0xed48('0x6'))(_0xed48('0x7'));var config=require('../../config/environment');var jayson=require(_0xed48('0x8'));var client=jayson[_0xed48('0x9')][_0xed48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50b4ce,_0x2cc522,_0x1c9299){return new BPromise(function(_0x52a5e2,_0x5f0f1b){return client['request'](_0x50b4ce,_0x1c9299)[_0xed48('0xb')](function(_0x28096a){logger[_0xed48('0xc')]('CloudProvider,\x20%s,\x20%s',_0x2cc522,'request\x20sent');logger[_0xed48('0xd')](_0xed48('0xe'),_0x2cc522,_0xed48('0xf'),JSON['stringify'](_0x28096a));if(_0x28096a[_0xed48('0x10')]){if(_0x28096a[_0xed48('0x10')][_0xed48('0x11')]===0x1f4){logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);return _0x5f0f1b(_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);}logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);return _0x52a5e2(_0x28096a['error'][_0xed48('0x13')]);}else{logger['info'](_0xed48('0x12'),_0x2cc522,'request\x20sent');_0x52a5e2(_0x28096a['result'][_0xed48('0x13')]);}})[_0xed48('0x14')](function(_0x3dd77d){logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x3dd77d);_0x5f0f1b(_0x3dd77d);});});} \ No newline at end of file +var _0x3609=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x23cca7,_0x3028b8){var _0x2b87d6=function(_0x22b4fc){while(--_0x22b4fc){_0x23cca7['push'](_0x23cca7['shift']());}};_0x2b87d6(++_0x3028b8);}(_0x3609,0x101));var _0x9360=function(_0x43d112,_0x1b23da){_0x43d112=_0x43d112-0x0;var _0x442a6d=_0x3609[_0x43d112];return _0x442a6d;};'use strict';var _=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var moment=require(_0x9360('0x2'));var BPromise=require(_0x9360('0x3'));var rs=require(_0x9360('0x4'));var fs=require('fs');var Redis=require(_0x9360('0x5'));var db=require(_0x9360('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9360('0x7'))(_0x9360('0x8'));var config=require(_0x9360('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11fe15,_0xf4e840,_0x50e967){return new BPromise(function(_0x2a67be,_0x3a08e5){return client[_0x9360('0xa')](_0x11fe15,_0x50e967)[_0x9360('0xb')](function(_0x2d951e){logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,_0x9360('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0xf4e840,_0x9360('0xe'),JSON[_0x9360('0xf')](_0x2d951e));if(_0x2d951e[_0x9360('0x10')]){if(_0x2d951e['error'][_0x9360('0x11')]===0x1f4){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);return _0x3a08e5(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0xf4e840,_0x2d951e[_0x9360('0x10')]['message']);return _0x2a67be(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}else{logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,'request\x20sent');_0x2a67be(_0x2d951e[_0x9360('0x13')][_0x9360('0x12')]);}})[_0x9360('0x14')](function(_0x1e0316){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x1e0316);_0x3a08e5(_0x1e0316);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f8a29e7..4d9cf2f 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7a54,0x106));var _0x47a5=function(_0x310999,_0x540838){_0x310999=_0x310999-0x0;var _0x182d9a=_0x7a54[_0x310999];return _0x182d9a;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x8b09bc,_0x1b178c){var _0x1e89a2=function(_0x5a3c46){while(--_0x5a3c46){_0x8b09bc['push'](_0x8b09bc['shift']());}};_0x1e89a2(++_0x1b178c);}(_0x2ef3,0xba));var _0x32ef=function(_0x9736b7,_0x45c18d){_0x9736b7=_0x9736b7-0x0;var _0x1d502d=_0x2ef3[_0x9736b7];return _0x1d502d;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 4a95178..e69b40a 100644 --- a/server/api/cmCompany/cmCompany.attributes.js +++ b/server/api/cmCompany/cmCompany.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x882d=['sequelize','name','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x882d,0x189));var _0xd882=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0x882d[_0x946518];return _0x909b69;};'use strict';var Sequelize=require(_0xd882('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd882('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd882('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xd882('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd882('0x2')]},'postalCode':{'type':Sequelize[_0xd882('0x2')]},'city':{'type':Sequelize[_0xd882('0x2')]},'country':{'type':Sequelize[_0xd882('0x2')]},'email':{'type':Sequelize[_0xd882('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd882('0x2')]},'sStreet':{'type':Sequelize[_0xd882('0x2')]},'sPostalCode':{'type':Sequelize[_0xd882('0x2')]},'sCity':{'type':Sequelize[_0xd882('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x17f0=['name','sequelize','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x17f0,0x91));var _0x017f=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x17f0[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x017f('0x0'));module[_0x017f('0x1')]={'name':{'type':Sequelize[_0x017f('0x2')],'unique':_0x017f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x017f('0x2')]},'companyId':{'type':Sequelize[_0x017f('0x2')]},'website':{'type':Sequelize[_0x017f('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x017f('0x2')]},'type':{'type':Sequelize[_0x017f('0x2')]},'street':{'type':Sequelize[_0x017f('0x2')]},'postalCode':{'type':Sequelize[_0x017f('0x2')]},'city':{'type':Sequelize[_0x017f('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x017f('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x017f('0x2')]},'sStreet':{'type':Sequelize[_0x017f('0x2')]},'sPostalCode':{'type':Sequelize[_0x017f('0x2')]},'sCity':{'type':Sequelize[_0x017f('0x2')]},'sCountry':{'type':Sequelize[_0x017f('0x2')]},'description':{'type':Sequelize[_0x017f('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index bfa9df4..c794984 100644 --- a/server/api/cmCompany/cmCompany.controller.js +++ b/server/api/cmCompany/cmCompany.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1475=['filter','includeAll','include','catch','show','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','getContacts','rawAttributes','order','map','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','Companies','UserProfileResource','then','end','error','stack','name','send','index','CmCompany','describe','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge'];(function(_0x26b2d9,_0x30ee2c){var _0x3ae823=function(_0x5ef17c){while(--_0x5ef17c){_0x26b2d9['push'](_0x26b2d9['shift']());}};_0x3ae823(++_0x30ee2c);}(_0x1475,0x1ce));var _0x5147=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x1475[_0x15fc3c];return _0x94c5c8;};'use strict';var emlformat=require(_0x5147('0x0'));var rimraf=require(_0x5147('0x1'));var zipdir=require(_0x5147('0x2'));var jsonpatch=require(_0x5147('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5147('0x4'));var Mustache=require(_0x5147('0x5'));var util=require(_0x5147('0x6'));var path=require(_0x5147('0x7'));var sox=require(_0x5147('0x8'));var csv=require(_0x5147('0x9'));var ejs=require(_0x5147('0xa'));var fs=require('fs');var fs_extra=require(_0x5147('0xb'));var _=require(_0x5147('0xc'));var squel=require(_0x5147('0xd'));var crypto=require(_0x5147('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5147('0xf'));var toCsv=require(_0x5147('0x9'));var querystring=require(_0x5147('0x10'));var Papa=require(_0x5147('0x11'));var Redis=require('ioredis');var authService=require(_0x5147('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5147('0x13'));var logger=require('../../config/logger')(_0x5147('0x14'));var utils=require(_0x5147('0x15'));var config=require(_0x5147('0x16'));var licenseUtil=require(_0x5147('0x17'));var db=require(_0x5147('0x18'))['db'];function respondWithStatusCode(_0x4e3292,_0x49d57b){_0x49d57b=_0x49d57b||0xcc;return function(_0x1f504c){if(_0x1f504c){return _0x4e3292[_0x5147('0x19')](_0x49d57b);}return _0x4e3292[_0x5147('0x1a')](_0x49d57b)['end']();};}function respondWithResult(_0x54747f,_0x210d4b){_0x210d4b=_0x210d4b||0xc8;return function(_0x5876b3){if(_0x5876b3){return _0x54747f[_0x5147('0x1a')](_0x210d4b)[_0x5147('0x1b')](_0x5876b3);}};}function respondWithFilteredResult(_0x25942c,_0x10cdb6){return function(_0x207ec6){if(_0x207ec6){var _0xdda230=typeof _0x10cdb6[_0x5147('0x1c')]==='undefined'&&typeof _0x10cdb6[_0x5147('0x1d')]===_0x5147('0x1e');var _0x453b45=_0x207ec6['count'];var _0x45bbd0=_0xdda230?0x0:_0x10cdb6['offset'];var _0x11e9cf=_0xdda230?_0x207ec6[_0x5147('0x1f')]:_0x10cdb6[_0x5147('0x1c')]+_0x10cdb6['limit'];var _0x217e09;if(_0x11e9cf>=_0x453b45){_0x11e9cf=_0x453b45;_0x217e09=0xc8;}else{_0x217e09=0xce;}_0x25942c['status'](_0x217e09);return _0x25942c['set'](_0x5147('0x20'),_0x45bbd0+'-'+_0x11e9cf+'/'+_0x453b45)[_0x5147('0x1b')](_0x207ec6);}return null;};}function patchUpdates(_0x1dbc84){return function(_0x4897fa){try{jsonpatch[_0x5147('0x21')](_0x4897fa,_0x1dbc84,!![]);}catch(_0x18aecb){return BPromise['reject'](_0x18aecb);}return _0x4897fa[_0x5147('0x22')]();};}function saveUpdates(_0x4a9603,_0x5dfc0e){return function(_0xc05b4d){if(_0xc05b4d){return _0xc05b4d[_0x5147('0x23')](_0x4a9603)['then'](function(_0x30ac2e){return _0x30ac2e;});}return null;};}function removeEntity(_0x3fa872,_0x28bad9){return function(_0x3f722c){if(_0x3f722c){return _0x3f722c[_0x5147('0x24')]()['then'](function(){var _0x141397=_0x3f722c['get']({'plain':!![]});var _0x270aa2=_0x5147('0x25');return db[_0x5147('0x26')][_0x5147('0x24')]({'where':{'type':_0x270aa2,'resourceId':_0x141397['id']}})[_0x5147('0x27')](function(){return _0x3f722c;});})[_0x5147('0x27')](function(){_0x3fa872[_0x5147('0x1a')](0xcc)[_0x5147('0x28')]();});}};}function handleEntityNotFound(_0x1879b4,_0x54398a){return function(_0x253078){if(!_0x253078){_0x1879b4[_0x5147('0x19')](0x194);}return _0x253078;};}function handleError(_0x4b73e5,_0x1f048f){_0x1f048f=_0x1f048f||0x1f4;return function(_0x4c9939){logger[_0x5147('0x29')](_0x4c9939[_0x5147('0x2a')]);if(_0x4c9939['name']){delete _0x4c9939[_0x5147('0x2b')];}_0x4b73e5['status'](_0x1f048f)[_0x5147('0x2c')](_0x4c9939);};}exports[_0x5147('0x2d')]=function(_0x270d6e,_0x5e722e){var _0x3118c7={},_0x54af8c={},_0x3b8d6a={'count':0x0,'rows':[]};return db[_0x5147('0x2e')][_0x5147('0x2f')]()['then'](function(_0x253899){_0x54af8c[_0x5147('0x30')]=_['keys'](_0x253899);_0x54af8c[_0x5147('0x31')]=_['keys'](_0x270d6e[_0x5147('0x31')]);_0x54af8c['filters']=_[_0x5147('0x32')](_0x54af8c[_0x5147('0x30')],_0x54af8c['query']);_0x3118c7[_0x5147('0x33')]=_['intersection'](_0x54af8c[_0x5147('0x30')],qs[_0x5147('0x34')](_0x270d6e[_0x5147('0x31')][_0x5147('0x34')]));_0x3118c7['attributes']=_0x3118c7[_0x5147('0x33')][_0x5147('0x35')]?_0x3118c7[_0x5147('0x33')]:_0x54af8c['model'];if(!_0x270d6e['query'][_0x5147('0x36')]('nolimit')){_0x3118c7['limit']=qs[_0x5147('0x1d')](_0x270d6e['query'][_0x5147('0x1d')]);_0x3118c7[_0x5147('0x1c')]=qs['offset'](_0x270d6e['query'][_0x5147('0x1c')]);}_0x3118c7['order']=qs[_0x5147('0x37')](_0x270d6e[_0x5147('0x31')]['sort']);_0x3118c7[_0x5147('0x38')]=qs[_0x5147('0x39')](_[_0x5147('0x3a')](_0x270d6e['query'],_0x54af8c['filters']),_0x253899);if(_0x270d6e[_0x5147('0x31')]['filter']){_0x3118c7[_0x5147('0x38')]=_[_0x5147('0x3b')](_0x3118c7[_0x5147('0x38')],{'$or':_['map'](_0x3118c7[_0x5147('0x33')],function(_0x4cc432){var _0x1c673b={};_0x1c673b[_0x4cc432]={'$like':'%'+_0x270d6e['query'][_0x5147('0x3c')]+'%'};return _0x1c673b;})});}_0x3118c7=_['merge']({},_0x3118c7,_0x270d6e['options']);var _0x2b40d6={'where':_0x3118c7[_0x5147('0x38')]};return db[_0x5147('0x2e')][_0x5147('0x1f')](_0x2b40d6)[_0x5147('0x27')](function(_0x1bb0bb){_0x3b8d6a['count']=_0x1bb0bb;if(_0x270d6e[_0x5147('0x31')][_0x5147('0x3d')]){_0x3118c7[_0x5147('0x3e')]=[{'all':!![]}];}return db[_0x5147('0x2e')]['findAll'](_0x3118c7);})[_0x5147('0x27')](function(_0x57602a){_0x3b8d6a['rows']=_0x57602a;return _0x3b8d6a;})[_0x5147('0x27')](respondWithFilteredResult(_0x5e722e,_0x3118c7))[_0x5147('0x3f')](handleError(_0x5e722e,null));})[_0x5147('0x3f')](handleError(_0x5e722e,null));};exports[_0x5147('0x40')]=function(_0xc7a40,_0xd4f4){var _0x54e0bf={'raw':![],'where':{'id':_0xc7a40['params']['id']}},_0x2bb846={};_0x2bb846[_0x5147('0x30')]=_[_0x5147('0x41')](db[_0x5147('0x2e')]['rawAttributes']);_0x2bb846[_0x5147('0x31')]=_[_0x5147('0x41')](_0xc7a40['query']);_0x2bb846[_0x5147('0x39')]=_[_0x5147('0x32')](_0x2bb846['model'],_0x2bb846[_0x5147('0x31')]);_0x54e0bf['attributes']=_[_0x5147('0x32')](_0x2bb846['model'],qs[_0x5147('0x34')](_0xc7a40[_0x5147('0x31')]['fields']));_0x54e0bf['attributes']=_0x54e0bf[_0x5147('0x33')][_0x5147('0x35')]?_0x54e0bf[_0x5147('0x33')]:_0x2bb846[_0x5147('0x30')];if(_0xc7a40[_0x5147('0x31')]['includeAll']){_0x54e0bf[_0x5147('0x3e')]=[{'all':!![]}];}_0x54e0bf=_[_0x5147('0x3b')]({},_0x54e0bf,_0xc7a40[_0x5147('0x42')]);return db[_0x5147('0x2e')][_0x5147('0x43')](_0x54e0bf)[_0x5147('0x27')](handleEntityNotFound(_0xd4f4,null))[_0x5147('0x27')](respondWithResult(_0xd4f4,null))['catch'](handleError(_0xd4f4,null));};exports['create']=function(_0x26f467,_0x47a81e){return db[_0x5147('0x2e')][_0x5147('0x44')](_0x26f467[_0x5147('0x45')],{})[_0x5147('0x27')](function(_0x2f5460){var _0x432983=_0x26f467[_0x5147('0x46')]['get']({'plain':!![]});if(!_0x432983)throw new Error(_0x5147('0x47'));if(_0x432983[_0x5147('0x48')]==='user'){var _0x3d4159=_0x2f5460[_0x5147('0x49')]({'plain':!![]});var _0x461a7f='Companies';return db[_0x5147('0x4a')][_0x5147('0x43')]({'where':{'name':_0x461a7f,'userProfileId':_0x432983[_0x5147('0x4b')]},'raw':!![]})[_0x5147('0x27')](function(_0x29be9a){if(_0x29be9a&&_0x29be9a['autoAssociation']===0x0){return db[_0x5147('0x26')][_0x5147('0x44')]({'name':_0x3d4159[_0x5147('0x2b')],'resourceId':_0x3d4159['id'],'type':_0x29be9a[_0x5147('0x2b')],'sectionId':_0x29be9a['id']},{})['then'](function(){return _0x2f5460;});}else{return _0x2f5460;}})['catch'](function(_0x213576){logger[_0x5147('0x29')](_0x5147('0x4c'),_0x213576);throw _0x213576;});}return _0x2f5460;})[_0x5147('0x27')](respondWithResult(_0x47a81e,0xc9))[_0x5147('0x3f')](handleError(_0x47a81e,null));};exports[_0x5147('0x23')]=function(_0xfed2f1,_0x5ed5f9){if(_0xfed2f1[_0x5147('0x45')]['id']){delete _0xfed2f1[_0x5147('0x45')]['id'];}return db['CmCompany'][_0x5147('0x43')]({'where':{'id':_0xfed2f1[_0x5147('0x4d')]['id']}})[_0x5147('0x27')](handleEntityNotFound(_0x5ed5f9,null))[_0x5147('0x27')](saveUpdates(_0xfed2f1[_0x5147('0x45')],null))[_0x5147('0x27')](respondWithResult(_0x5ed5f9,null))[_0x5147('0x3f')](handleError(_0x5ed5f9,null));};exports[_0x5147('0x24')]=function(_0x5c889f,_0x4a32b){return db[_0x5147('0x2e')]['find']({'where':{'id':_0x5c889f[_0x5147('0x4d')]['id']}})[_0x5147('0x27')](handleEntityNotFound(_0x4a32b,null))[_0x5147('0x27')](removeEntity(_0x4a32b,null))['catch'](handleError(_0x4a32b,null));};exports[_0x5147('0x2f')]=function(_0x9b2a65,_0x2bd5e4){return db[_0x5147('0x2e')][_0x5147('0x2f')]()[_0x5147('0x27')](respondWithResult(_0x2bd5e4,null))[_0x5147('0x3f')](handleError(_0x2bd5e4,null));};exports[_0x5147('0x4e')]=function(_0x4b2de4,_0x6e07e4,_0x3a2525){return db[_0x5147('0x4f')]['find']({'where':{'id':_0x4b2de4[_0x5147('0x4d')]['id']}})[_0x5147('0x27')](handleEntityNotFound(_0x6e07e4,null))['then'](function(_0x548c8d){if(_0x548c8d){return _0x548c8d[_0x5147('0x4e')](_0x4b2de4[_0x5147('0x45')][_0x5147('0x50')],_[_0x5147('0x51')](_0x4b2de4['body'],[_0x5147('0x50'),'id'])||{});}})[_0x5147('0x27')](respondWithResult(_0x6e07e4,null))['catch'](handleError(_0x6e07e4,null));};exports[_0x5147('0x52')]=function(_0x2902b7,_0x464229,_0x148734){var _0x19c38e={};var _0x5bae4a={};var _0x1aa63c;var _0x5cd67a;return db[_0x5147('0x2e')]['findOne']({'where':{'id':_0x2902b7[_0x5147('0x4d')]['id']}})[_0x5147('0x27')](handleEntityNotFound(_0x464229,null))['then'](function(_0x33a86e){if(_0x33a86e){_0x1aa63c=_0x33a86e;_0x5bae4a[_0x5147('0x30')]=_[_0x5147('0x41')](db['CmContact'][_0x5147('0x53')]);_0x5bae4a['query']=_[_0x5147('0x41')](_0x2902b7[_0x5147('0x31')]);_0x5bae4a[_0x5147('0x39')]=_[_0x5147('0x32')](_0x5bae4a[_0x5147('0x30')],_0x5bae4a['query']);_0x19c38e['attributes']=_[_0x5147('0x32')](_0x5bae4a['model'],qs[_0x5147('0x34')](_0x2902b7[_0x5147('0x31')][_0x5147('0x34')]));_0x19c38e[_0x5147('0x33')]=_0x19c38e['attributes'][_0x5147('0x35')]?_0x19c38e[_0x5147('0x33')]:_0x5bae4a[_0x5147('0x30')];_0x19c38e[_0x5147('0x54')]=qs[_0x5147('0x37')](_0x2902b7[_0x5147('0x31')][_0x5147('0x37')]);_0x19c38e[_0x5147('0x38')]=qs[_0x5147('0x39')](_[_0x5147('0x3a')](_0x2902b7[_0x5147('0x31')],_0x5bae4a[_0x5147('0x39')]));if(_0x2902b7[_0x5147('0x31')][_0x5147('0x3c')]){_0x19c38e['where']=_[_0x5147('0x3b')](_0x19c38e[_0x5147('0x38')],{'$or':_[_0x5147('0x55')](_0x19c38e[_0x5147('0x33')],function(_0x1ad149){var _0x486d22={};_0x486d22[_0x1ad149]={'$like':'%'+_0x2902b7['query'][_0x5147('0x3c')]+'%'};return _0x486d22;})});}_0x19c38e=_[_0x5147('0x3b')]({},_0x19c38e,_0x2902b7[_0x5147('0x42')]);return _0x1aa63c[_0x5147('0x52')](_0x19c38e);}})['then'](function(_0x59f5ef){if(_0x59f5ef){_0x5cd67a=_0x59f5ef['length'];if(!_0x2902b7[_0x5147('0x31')][_0x5147('0x36')](_0x5147('0x56'))){_0x19c38e['limit']=qs['limit'](_0x2902b7[_0x5147('0x31')]['limit']);_0x19c38e[_0x5147('0x1c')]=qs[_0x5147('0x1c')](_0x2902b7[_0x5147('0x31')]['offset']);}return _0x1aa63c[_0x5147('0x52')](_0x19c38e);}})[_0x5147('0x27')](function(_0x53d3cc){if(_0x53d3cc){return _0x53d3cc?{'count':_0x5cd67a,'rows':_0x53d3cc}:null;}})[_0x5147('0x27')](respondWithResult(_0x464229,null))[_0x5147('0x3f')](handleError(_0x464229,null));}; \ No newline at end of file +var _0xc5d0=['describe','addContacts','ids','getContacts','findOne','CmContact','order','options','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','includeAll','include','rows','show','params','rawAttributes','catch','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc5d0,0x1ac));var _0x0c5d=function(_0x112147,_0x4e692e){_0x112147=_0x112147-0x0;var _0x3ba744=_0xc5d0[_0x112147];return _0x3ba744;};'use strict';var emlformat=require(_0x0c5d('0x0'));var rimraf=require(_0x0c5d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c5d('0x2'));var rp=require('request-promise');var moment=require(_0x0c5d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0c5d('0x4'));var path=require(_0x0c5d('0x5'));var sox=require(_0x0c5d('0x6'));var csv=require(_0x0c5d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c5d('0x8'));var _=require('lodash');var squel=require(_0x0c5d('0x9'));var crypto=require(_0x0c5d('0xa'));var jsforce=require(_0x0c5d('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0c5d('0xc'));var authService=require(_0x0c5d('0xd'));var qs=require(_0x0c5d('0xe'));var as=require(_0x0c5d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c5d('0x10'))(_0x0c5d('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0c5d('0x12'));var db=require(_0x0c5d('0x13'))['db'];function respondWithStatusCode(_0x296995,_0x3c94eb){_0x3c94eb=_0x3c94eb||0xcc;return function(_0x1101cd){if(_0x1101cd){return _0x296995[_0x0c5d('0x14')](_0x3c94eb);}return _0x296995[_0x0c5d('0x15')](_0x3c94eb)[_0x0c5d('0x16')]();};}function respondWithResult(_0x227a37,_0x53044d){_0x53044d=_0x53044d||0xc8;return function(_0x1bedf9){if(_0x1bedf9){return _0x227a37[_0x0c5d('0x15')](_0x53044d)[_0x0c5d('0x17')](_0x1bedf9);}};}function respondWithFilteredResult(_0x46868f,_0xb2c538){return function(_0x21e0bc){if(_0x21e0bc){var _0xc97884=typeof _0xb2c538[_0x0c5d('0x18')]===_0x0c5d('0x19')&&typeof _0xb2c538[_0x0c5d('0x1a')]===_0x0c5d('0x19');var _0x5a716c=_0x21e0bc[_0x0c5d('0x1b')];var _0x11b030=_0xc97884?0x0:_0xb2c538[_0x0c5d('0x18')];var _0x105932=_0xc97884?_0x21e0bc[_0x0c5d('0x1b')]:_0xb2c538['offset']+_0xb2c538[_0x0c5d('0x1a')];var _0x559150;if(_0x105932>=_0x5a716c){_0x105932=_0x5a716c;_0x559150=0xc8;}else{_0x559150=0xce;}_0x46868f[_0x0c5d('0x15')](_0x559150);return _0x46868f[_0x0c5d('0x1c')](_0x0c5d('0x1d'),_0x11b030+'-'+_0x105932+'/'+_0x5a716c)['json'](_0x21e0bc);}return null;};}function patchUpdates(_0x24a101){return function(_0x5b000b){try{jsonpatch[_0x0c5d('0x1e')](_0x5b000b,_0x24a101,!![]);}catch(_0x1468ba){return BPromise[_0x0c5d('0x1f')](_0x1468ba);}return _0x5b000b[_0x0c5d('0x20')]();};}function saveUpdates(_0x5a6e81,_0x5569f6){return function(_0x303939){if(_0x303939){return _0x303939['update'](_0x5a6e81)[_0x0c5d('0x21')](function(_0x4e47c6){return _0x4e47c6;});}return null;};}function removeEntity(_0xd64a39,_0x85a32b){return function(_0x22fe13){if(_0x22fe13){return _0x22fe13[_0x0c5d('0x22')]()[_0x0c5d('0x21')](function(){var _0x4b870c=_0x22fe13[_0x0c5d('0x23')]({'plain':!![]});var _0x3a826b=_0x0c5d('0x24');return db[_0x0c5d('0x25')]['destroy']({'where':{'type':_0x3a826b,'resourceId':_0x4b870c['id']}})['then'](function(){return _0x22fe13;});})[_0x0c5d('0x21')](function(){_0xd64a39[_0x0c5d('0x15')](0xcc)[_0x0c5d('0x16')]();});}};}function handleEntityNotFound(_0x1c359d,_0x4f7a6a){return function(_0x5a7234){if(!_0x5a7234){_0x1c359d[_0x0c5d('0x14')](0x194);}return _0x5a7234;};}function handleError(_0x6e23d6,_0x508bed){_0x508bed=_0x508bed||0x1f4;return function(_0x435180){logger[_0x0c5d('0x26')](_0x435180[_0x0c5d('0x27')]);if(_0x435180[_0x0c5d('0x28')]){delete _0x435180[_0x0c5d('0x28')];}_0x6e23d6['status'](_0x508bed)[_0x0c5d('0x29')](_0x435180);};}exports[_0x0c5d('0x2a')]=function(_0x3c3df3,_0x4b403c){var _0x53512c={},_0x8e92e4={},_0x1f3d86={'count':0x0,'rows':[]};return db[_0x0c5d('0x2b')]['describe']()[_0x0c5d('0x21')](function(_0x1425dd){_0x8e92e4[_0x0c5d('0x2c')]=_[_0x0c5d('0x2d')](_0x1425dd);_0x8e92e4[_0x0c5d('0x2e')]=_[_0x0c5d('0x2d')](_0x3c3df3[_0x0c5d('0x2e')]);_0x8e92e4[_0x0c5d('0x2f')]=_[_0x0c5d('0x30')](_0x8e92e4['model'],_0x8e92e4['query']);_0x53512c[_0x0c5d('0x31')]=_[_0x0c5d('0x30')](_0x8e92e4[_0x0c5d('0x2c')],qs[_0x0c5d('0x32')](_0x3c3df3[_0x0c5d('0x2e')]['fields']));_0x53512c[_0x0c5d('0x31')]=_0x53512c[_0x0c5d('0x31')][_0x0c5d('0x33')]?_0x53512c['attributes']:_0x8e92e4[_0x0c5d('0x2c')];if(!_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x34')](_0x0c5d('0x35'))){_0x53512c[_0x0c5d('0x1a')]=qs['limit'](_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x1a')]);_0x53512c['offset']=qs[_0x0c5d('0x18')](_0x3c3df3['query'][_0x0c5d('0x18')]);}_0x53512c['order']=qs[_0x0c5d('0x36')](_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x36')]);_0x53512c[_0x0c5d('0x37')]=qs['filters'](_[_0x0c5d('0x38')](_0x3c3df3[_0x0c5d('0x2e')],_0x8e92e4[_0x0c5d('0x2f')]),_0x1425dd);if(_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x39')]){_0x53512c['where']=_[_0x0c5d('0x3a')](_0x53512c[_0x0c5d('0x37')],{'$or':_[_0x0c5d('0x3b')](_0x53512c[_0x0c5d('0x31')],function(_0x2527b3){var _0x42b99c={};_0x42b99c[_0x2527b3]={'$like':'%'+_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x39')]+'%'};return _0x42b99c;})});}_0x53512c=_['merge']({},_0x53512c,_0x3c3df3['options']);var _0x524a4d={'where':_0x53512c[_0x0c5d('0x37')]};return db[_0x0c5d('0x2b')]['count'](_0x524a4d)[_0x0c5d('0x21')](function(_0x53593a){_0x1f3d86['count']=_0x53593a;if(_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x3c')]){_0x53512c[_0x0c5d('0x3d')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x53512c);})[_0x0c5d('0x21')](function(_0x323db4){_0x1f3d86[_0x0c5d('0x3e')]=_0x323db4;return _0x1f3d86;})[_0x0c5d('0x21')](respondWithFilteredResult(_0x4b403c,_0x53512c))['catch'](handleError(_0x4b403c,null));})['catch'](handleError(_0x4b403c,null));};exports[_0x0c5d('0x3f')]=function(_0x2ae3ad,_0x51702f){var _0x360091={'raw':![],'where':{'id':_0x2ae3ad[_0x0c5d('0x40')]['id']}},_0xfe48fb={};_0xfe48fb['model']=_[_0x0c5d('0x2d')](db[_0x0c5d('0x2b')][_0x0c5d('0x41')]);_0xfe48fb[_0x0c5d('0x2e')]=_[_0x0c5d('0x2d')](_0x2ae3ad[_0x0c5d('0x2e')]);_0xfe48fb['filters']=_[_0x0c5d('0x30')](_0xfe48fb['model'],_0xfe48fb[_0x0c5d('0x2e')]);_0x360091['attributes']=_['intersection'](_0xfe48fb[_0x0c5d('0x2c')],qs[_0x0c5d('0x32')](_0x2ae3ad[_0x0c5d('0x2e')][_0x0c5d('0x32')]));_0x360091[_0x0c5d('0x31')]=_0x360091[_0x0c5d('0x31')][_0x0c5d('0x33')]?_0x360091[_0x0c5d('0x31')]:_0xfe48fb[_0x0c5d('0x2c')];if(_0x2ae3ad['query'][_0x0c5d('0x3c')]){_0x360091[_0x0c5d('0x3d')]=[{'all':!![]}];}_0x360091=_[_0x0c5d('0x3a')]({},_0x360091,_0x2ae3ad['options']);return db['CmCompany']['find'](_0x360091)[_0x0c5d('0x21')](handleEntityNotFound(_0x51702f,null))['then'](respondWithResult(_0x51702f,null))[_0x0c5d('0x42')](handleError(_0x51702f,null));};exports['create']=function(_0x2ccd39,_0x575fb8){return db['CmCompany'][_0x0c5d('0x43')](_0x2ccd39[_0x0c5d('0x44')],{})['then'](function(_0x545f17){var _0x25ccdd=_0x2ccd39[_0x0c5d('0x45')][_0x0c5d('0x23')]({'plain':!![]});if(!_0x25ccdd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25ccdd['role']===_0x0c5d('0x45')){var _0x4b27d3=_0x545f17[_0x0c5d('0x23')]({'plain':!![]});var _0x6a8d29=_0x0c5d('0x24');return db[_0x0c5d('0x46')][_0x0c5d('0x47')]({'where':{'name':_0x6a8d29,'userProfileId':_0x25ccdd[_0x0c5d('0x48')]},'raw':!![]})[_0x0c5d('0x21')](function(_0x57d473){if(_0x57d473&&_0x57d473[_0x0c5d('0x49')]===0x0){return db[_0x0c5d('0x25')]['create']({'name':_0x4b27d3[_0x0c5d('0x28')],'resourceId':_0x4b27d3['id'],'type':_0x57d473[_0x0c5d('0x28')],'sectionId':_0x57d473['id']},{})[_0x0c5d('0x21')](function(){return _0x545f17;});}else{return _0x545f17;}})['catch'](function(_0x419c1b){logger['error'](_0x0c5d('0x4a'),_0x419c1b);throw _0x419c1b;});}return _0x545f17;})[_0x0c5d('0x21')](respondWithResult(_0x575fb8,0xc9))[_0x0c5d('0x42')](handleError(_0x575fb8,null));};exports[_0x0c5d('0x4b')]=function(_0x36e0c4,_0x37b286){if(_0x36e0c4['body']['id']){delete _0x36e0c4[_0x0c5d('0x44')]['id'];}return db[_0x0c5d('0x2b')]['find']({'where':{'id':_0x36e0c4['params']['id']}})[_0x0c5d('0x21')](handleEntityNotFound(_0x37b286,null))[_0x0c5d('0x21')](saveUpdates(_0x36e0c4['body'],null))[_0x0c5d('0x21')](respondWithResult(_0x37b286,null))[_0x0c5d('0x42')](handleError(_0x37b286,null));};exports[_0x0c5d('0x22')]=function(_0x1fb897,_0x1d6e1e){return db['CmCompany']['find']({'where':{'id':_0x1fb897[_0x0c5d('0x40')]['id']}})[_0x0c5d('0x21')](handleEntityNotFound(_0x1d6e1e,null))[_0x0c5d('0x21')](removeEntity(_0x1d6e1e,null))[_0x0c5d('0x42')](handleError(_0x1d6e1e,null));};exports[_0x0c5d('0x4c')]=function(_0x385e10,_0x3fc3c3){return db['CmCompany'][_0x0c5d('0x4c')]()['then'](respondWithResult(_0x3fc3c3,null))[_0x0c5d('0x42')](handleError(_0x3fc3c3,null));};exports[_0x0c5d('0x4d')]=function(_0x52206c,_0x38ed11,_0x22f0e8){return db['CmContact']['find']({'where':{'id':_0x52206c['params']['id']}})[_0x0c5d('0x21')](handleEntityNotFound(_0x38ed11,null))[_0x0c5d('0x21')](function(_0x5ede1e){if(_0x5ede1e){return _0x5ede1e[_0x0c5d('0x4d')](_0x52206c[_0x0c5d('0x44')][_0x0c5d('0x4e')],_['omit'](_0x52206c[_0x0c5d('0x44')],[_0x0c5d('0x4e'),'id'])||{});}})[_0x0c5d('0x21')](respondWithResult(_0x38ed11,null))[_0x0c5d('0x42')](handleError(_0x38ed11,null));};exports[_0x0c5d('0x4f')]=function(_0x54eace,_0x59c802,_0x516175){var _0x23b075={};var _0x3b33e9={};var _0x34d5d2;var _0x533457;return db[_0x0c5d('0x2b')][_0x0c5d('0x50')]({'where':{'id':_0x54eace[_0x0c5d('0x40')]['id']}})[_0x0c5d('0x21')](handleEntityNotFound(_0x59c802,null))[_0x0c5d('0x21')](function(_0x5ca26a){if(_0x5ca26a){_0x34d5d2=_0x5ca26a;_0x3b33e9[_0x0c5d('0x2c')]=_['keys'](db[_0x0c5d('0x51')][_0x0c5d('0x41')]);_0x3b33e9['query']=_[_0x0c5d('0x2d')](_0x54eace['query']);_0x3b33e9[_0x0c5d('0x2f')]=_[_0x0c5d('0x30')](_0x3b33e9[_0x0c5d('0x2c')],_0x3b33e9[_0x0c5d('0x2e')]);_0x23b075[_0x0c5d('0x31')]=_['intersection'](_0x3b33e9[_0x0c5d('0x2c')],qs[_0x0c5d('0x32')](_0x54eace['query'][_0x0c5d('0x32')]));_0x23b075[_0x0c5d('0x31')]=_0x23b075[_0x0c5d('0x31')][_0x0c5d('0x33')]?_0x23b075[_0x0c5d('0x31')]:_0x3b33e9[_0x0c5d('0x2c')];_0x23b075[_0x0c5d('0x52')]=qs[_0x0c5d('0x36')](_0x54eace[_0x0c5d('0x2e')][_0x0c5d('0x36')]);_0x23b075[_0x0c5d('0x37')]=qs[_0x0c5d('0x2f')](_[_0x0c5d('0x38')](_0x54eace[_0x0c5d('0x2e')],_0x3b33e9[_0x0c5d('0x2f')]));if(_0x54eace[_0x0c5d('0x2e')][_0x0c5d('0x39')]){_0x23b075[_0x0c5d('0x37')]=_[_0x0c5d('0x3a')](_0x23b075[_0x0c5d('0x37')],{'$or':_['map'](_0x23b075[_0x0c5d('0x31')],function(_0x32847f){var _0xcf856c={};_0xcf856c[_0x32847f]={'$like':'%'+_0x54eace[_0x0c5d('0x2e')][_0x0c5d('0x39')]+'%'};return _0xcf856c;})});}_0x23b075=_[_0x0c5d('0x3a')]({},_0x23b075,_0x54eace[_0x0c5d('0x53')]);return _0x34d5d2['getContacts'](_0x23b075);}})[_0x0c5d('0x21')](function(_0x4e0720){if(_0x4e0720){_0x533457=_0x4e0720['length'];if(!_0x54eace['query'][_0x0c5d('0x34')](_0x0c5d('0x35'))){_0x23b075[_0x0c5d('0x1a')]=qs['limit'](_0x54eace[_0x0c5d('0x2e')]['limit']);_0x23b075['offset']=qs[_0x0c5d('0x18')](_0x54eace['query'][_0x0c5d('0x18')]);}return _0x34d5d2[_0x0c5d('0x4f')](_0x23b075);}})[_0x0c5d('0x21')](function(_0x2de36c){if(_0x2de36c){return _0x2de36c?{'count':_0x533457,'rows':_0x2de36c}:null;}})['then'](respondWithResult(_0x59c802,null))[_0x0c5d('0x42')](handleError(_0x59c802,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 678e1e1..a70fcfe 100644 --- a/server/api/cmCompany/cmCompany.model.js +++ b/server/api/cmCompany/cmCompany.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6932=['exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','request-promise','path','rimraf','./cmCompany.attributes'];(function(_0xf8067a,_0x305131){var _0x224f41=function(_0x5c09ef){while(--_0x5c09ef){_0xf8067a['push'](_0xf8067a['shift']());}};_0x224f41(++_0x305131);}(_0x6932,0xac));var _0x2693=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x6932[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x2693('0x0'));var util=require(_0x2693('0x1'));var logger=require(_0x2693('0x2'))(_0x2693('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2693('0x4'));var fs=require('fs');var path=require(_0x2693('0x5'));var rimraf=require(_0x2693('0x6'));var config=require('../../config/environment');var attributes=require(_0x2693('0x7'));module[_0x2693('0x8')]=function(_0x2cd06d,_0x2ac9ad){return _0x2cd06d[_0x2693('0x9')](_0x2693('0xa'),attributes,{'tableName':_0x2693('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74a9=['CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x74a9,0xe2));var _0x974a=function(_0x1d4c33,_0x30274f){_0x1d4c33=_0x1d4c33-0x0;var _0x3abfa2=_0x74a9[_0x1d4c33];return _0x3abfa2;};'use strict';var _=require(_0x974a('0x0'));var util=require(_0x974a('0x1'));var logger=require(_0x974a('0x2'))(_0x974a('0x3'));var moment=require(_0x974a('0x4'));var BPromise=require(_0x974a('0x5'));var rp=require(_0x974a('0x6'));var fs=require('fs');var path=require(_0x974a('0x7'));var rimraf=require(_0x974a('0x8'));var config=require(_0x974a('0x9'));var attributes=require('./cmCompany.attributes');module[_0x974a('0xa')]=function(_0x14a486,_0x59119e){return _0x14a486[_0x974a('0xb')](_0x974a('0xc'),attributes,{'tableName':_0x974a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index ee9554f..7d120f9 100644 --- a/server/api/cmCompany/cmCompany.rpc.js +++ b/server/api/cmCompany/cmCompany.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe65=['jayson/promise','client','http','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe65,0x175));var _0x5fe6=function(_0x2a7e9d,_0x156371){_0x2a7e9d=_0x2a7e9d-0x0;var _0x4c57d3=_0xfe65[_0x2a7e9d];return _0x4c57d3;};'use strict';var _=require(_0x5fe6('0x0'));var util=require(_0x5fe6('0x1'));var moment=require(_0x5fe6('0x2'));var BPromise=require('bluebird');var rs=require(_0x5fe6('0x3'));var fs=require('fs');var Redis=require(_0x5fe6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5fe6('0x5'))(_0x5fe6('0x6'));var config=require('../../config/environment');var jayson=require(_0x5fe6('0x7'));var client=jayson[_0x5fe6('0x8')][_0x5fe6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a2596,_0x3f9e6d,_0x50fdaf){return new BPromise(function(_0x51a153,_0x200bd6){return client['request'](_0x2a2596,_0x50fdaf)['then'](function(_0x5696e2){logger['info'](_0x5fe6('0xa'),_0x3f9e6d,'request\x20sent');logger[_0x5fe6('0xb')](_0x5fe6('0xc'),_0x3f9e6d,_0x5fe6('0xd'),JSON[_0x5fe6('0xe')](_0x5696e2));if(_0x5696e2[_0x5fe6('0xf')]){if(_0x5696e2['error'][_0x5fe6('0x10')]===0x1f4){logger[_0x5fe6('0xf')](_0x5fe6('0xa'),_0x3f9e6d,_0x5696e2['error']['message']);return _0x200bd6(_0x5696e2['error'][_0x5fe6('0x11')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x3f9e6d,_0x5696e2[_0x5fe6('0xf')][_0x5fe6('0x11')]);return _0x51a153(_0x5696e2[_0x5fe6('0xf')][_0x5fe6('0x11')]);}else{logger[_0x5fe6('0x12')](_0x5fe6('0xa'),_0x3f9e6d,_0x5fe6('0xd'));_0x51a153(_0x5696e2[_0x5fe6('0x13')][_0x5fe6('0x11')]);}})['catch'](function(_0x9266c3){logger['error'](_0x5fe6('0xa'),_0x3f9e6d,_0x9266c3);_0x200bd6(_0x9266c3);});});} \ No newline at end of file +var _0x70dc=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','CmCompany,\x20%s,\x20%s','result','catch'];(function(_0x2aae9c,_0xe0e9ef){var _0x46643d=function(_0x32f14f){while(--_0x32f14f){_0x2aae9c['push'](_0x2aae9c['shift']());}};_0x46643d(++_0xe0e9ef);}(_0x70dc,0x11e));var _0xc70d=function(_0x5b7eda,_0x557cdd){_0x5b7eda=_0x5b7eda-0x0;var _0x4e18d6=_0x70dc[_0x5b7eda];return _0x4e18d6;};'use strict';var _=require(_0xc70d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc70d('0x1'));var rs=require(_0xc70d('0x2'));var fs=require('fs');var Redis=require(_0xc70d('0x3'));var db=require(_0xc70d('0x4'))['db'];var utils=require(_0xc70d('0x5'));var logger=require(_0xc70d('0x6'))(_0xc70d('0x7'));var config=require(_0xc70d('0x8'));var jayson=require(_0xc70d('0x9'));var client=jayson[_0xc70d('0xa')][_0xc70d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3799e1,_0x16af22,_0x40f6e1){return new BPromise(function(_0x4ae7f9,_0x47daba){return client[_0xc70d('0xc')](_0x3799e1,_0x40f6e1)['then'](function(_0x46fbda){logger[_0xc70d('0xd')]('CmCompany,\x20%s,\x20%s',_0x16af22,_0xc70d('0xe'));logger['debug'](_0xc70d('0xf'),_0x16af22,'request\x20sent',JSON['stringify'](_0x46fbda));if(_0x46fbda[_0xc70d('0x10')]){if(_0x46fbda[_0xc70d('0x10')][_0xc70d('0x11')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x16af22,_0x46fbda[_0xc70d('0x10')][_0xc70d('0x12')]);return _0x47daba(_0x46fbda[_0xc70d('0x10')][_0xc70d('0x12')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x16af22,_0x46fbda['error'][_0xc70d('0x12')]);return _0x4ae7f9(_0x46fbda[_0xc70d('0x10')][_0xc70d('0x12')]);}else{logger[_0xc70d('0xd')](_0xc70d('0x13'),_0x16af22,'request\x20sent');_0x4ae7f9(_0x46fbda[_0xc70d('0x14')][_0xc70d('0x12')]);}})[_0xc70d('0x15')](function(_0x4b42bc){logger['error'](_0xc70d('0x13'),_0x16af22,_0x4b42bc);_0x47daba(_0x4b42bc);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d9d22eb..ee0e2b3 100644 --- a/server/api/cmCompany/index.js +++ b/server/api/cmCompany/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb19=['../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','update','destroy','exports','connect-timeout','Router','../../components/auth/service'];(function(_0x14f8f3,_0x5428b1){var _0x3f384b=function(_0x32eac0){while(--_0x32eac0){_0x14f8f3['push'](_0x14f8f3['shift']());}};_0x3f384b(++_0x5428b1);}(_0xbb19,0xf4));var _0x9bb1=function(_0x49ab96,_0x508ac1){_0x49ab96=_0x49ab96-0x0;var _0x220393=_0xbb19[_0x49ab96];return _0x220393;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9bb1('0x0'));var express=require('express');var router=express[_0x9bb1('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x9bb1('0x2'));var interaction=require(_0x9bb1('0x3'));var config=require('../../config/environment');var controller=require(_0x9bb1('0x4'));router[_0x9bb1('0x5')]('/',auth[_0x9bb1('0x6')](),controller[_0x9bb1('0x7')]);router['get'](_0x9bb1('0x8'),auth['isAuthenticated'](),controller[_0x9bb1('0x9')]);router[_0x9bb1('0x5')](_0x9bb1('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9bb1('0x5')](_0x9bb1('0xb'),auth[_0x9bb1('0x6')](),controller[_0x9bb1('0xc')]);router[_0x9bb1('0xd')]('/',auth[_0x9bb1('0x6')](),controller[_0x9bb1('0xe')]);router[_0x9bb1('0xd')](_0x9bb1('0xb'),auth[_0x9bb1('0x6')](),controller[_0x9bb1('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9bb1('0x10')]);router['delete'](_0x9bb1('0xa'),auth[_0x9bb1('0x6')](),controller[_0x9bb1('0x11')]);module[_0x9bb1('0x12')]=router; \ No newline at end of file +var _0x7f0d=['../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','post','/:id/contacts','addContacts','put','delete','destroy','exports','multer','express','Router','../../components/auth/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7f0d,0x1b4));var _0xd7f0=function(_0x1622bc,_0x5bfde3){_0x1622bc=_0x1622bc-0x0;var _0x3c476f=_0x7f0d[_0x1622bc];return _0x3c476f;};'use strict';var multer=require(_0xd7f0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd7f0('0x1'));var router=express[_0xd7f0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd7f0('0x3'));var interaction=require(_0xd7f0('0x4'));var config=require(_0xd7f0('0x5'));var controller=require(_0xd7f0('0x6'));router[_0xd7f0('0x7')]('/',auth[_0xd7f0('0x8')](),controller[_0xd7f0('0x9')]);router[_0xd7f0('0x7')](_0xd7f0('0xa'),auth[_0xd7f0('0x8')](),controller[_0xd7f0('0xb')]);router[_0xd7f0('0x7')](_0xd7f0('0xc'),auth[_0xd7f0('0x8')](),controller[_0xd7f0('0xd')]);router[_0xd7f0('0x7')]('/:id/contacts',auth[_0xd7f0('0x8')](),controller['getContacts']);router['post']('/',auth[_0xd7f0('0x8')](),controller[_0xd7f0('0xe')]);router[_0xd7f0('0xf')](_0xd7f0('0x10'),auth['isAuthenticated'](),controller[_0xd7f0('0x11')]);router[_0xd7f0('0x12')](_0xd7f0('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd7f0('0x13')](_0xd7f0('0xc'),auth[_0xd7f0('0x8')](),controller[_0xd7f0('0x14')]);module[_0xd7f0('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index b234fda..8c38e63 100644 --- a/server/api/cmContact/cmContact.attributes.js +++ b/server/api/cmContact/cmContact.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['sequelize','STRING','INTEGER','DATE'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var Sequelize=require(_0x65f6('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x65f6('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x65f6('0x1')]},'street':{'type':Sequelize[_0x65f6('0x1')]},'postalCode':{'type':Sequelize[_0x65f6('0x1')]},'city':{'type':Sequelize[_0x65f6('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x65f6('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x65f6('0x1')]},'mobile':{'type':Sequelize[_0x65f6('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x65f6('0x1')]},'facebook':{'type':Sequelize[_0x65f6('0x1')]},'fb_data':{'type':Sequelize[_0x65f6('0x1')]},'twitter':{'type':Sequelize[_0x65f6('0x1')]},'skype':{'type':Sequelize[_0x65f6('0x1')]},'teams':{'type':Sequelize[_0x65f6('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x65f6('0x1')]},'telegram':{'type':Sequelize[_0x65f6('0x1')]},'UserId':{'type':Sequelize[_0x65f6('0x2')]},'priority':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x65f6('0x3')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x65f6('0x2')]}}; \ No newline at end of file +var _0x5f2f=['INTEGER','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x5493c8,_0x232b6d){var _0x3d008f=function(_0x5338e2){while(--_0x5338e2){_0x5493c8['push'](_0x5493c8['shift']());}};_0x3d008f(++_0x232b6d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x52cbf8,_0x15934f){_0x52cbf8=_0x52cbf8-0x0;var _0x5a38af=_0x5f2f[_0x52cbf8];return _0x5a38af;};'use strict';var _=require(_0xf5f2('0x0'));var Sequelize=require(_0xf5f2('0x1'));module[_0xf5f2('0x2')]={'firstName':{'type':Sequelize[_0xf5f2('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf5f2('0x3')]},'street':{'type':Sequelize[_0xf5f2('0x3')]},'postalCode':{'type':Sequelize[_0xf5f2('0x3')]},'city':{'type':Sequelize[_0xf5f2('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5f2('0x4')]},'phone':{'type':Sequelize[_0xf5f2('0x3')]},'mobile':{'type':Sequelize[_0xf5f2('0x3')]},'fax':{'type':Sequelize[_0xf5f2('0x3')]},'email':{'type':Sequelize[_0xf5f2('0x3')]},'url':{'type':Sequelize[_0xf5f2('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xf5f2('0x3')]},'twitter':{'type':Sequelize[_0xf5f2('0x3')]},'skype':{'type':Sequelize[_0xf5f2('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xf5f2('0x3')]},'line':{'type':Sequelize[_0xf5f2('0x3')]},'wechat':{'type':Sequelize[_0xf5f2('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xf5f2('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':Sequelize[_0xf5f2('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 9d4f1b5..e33521c 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37bd=['VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','isNil','dialTimezone','timezones','utcOffset','bulkCreate','each','duplicates','$or','spread','$and','CmCustomField','omit','format','cf_%d','pickBy','table','id\x20=\x20?','toParam','phone','options','getTags','setTags','getHoppers','rawAttributes','include','rows','ContactId','getHopperFinals','includeAll','getJscriptySessions','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','0777','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','parse','meta','import','binding','No\x20phone\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','createdAt','findAndCountAll','startCase','Website','closed','disposition','Account','key','browserName','customerIp','customerPort','deviceModel','osName','ratingType','referer','substatus','externalUrl','threadId','Interaction','Owner','sortBy','slice','moment','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','status','json','undefined','count','offset','Content-Range','update','destroy','end','sendStatus','stack','name','send','describe','then','keys','length','cf_','push','findOne','trimStart','all','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','select','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','field','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','fieldType','datetime','castTo','DATE','buildExpression','text','start','filter','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','c.id','order','DESC','t.id\x20IN\x20?','resolve','user','getLists','c.ListId\x20IS\x20NULL','role','agent','toString','keyBy','merge','CmContact','c.firstName','c.lastName','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','sequelize','Tags','params','catch','tags','startsWith','columnName','displayName','analytics','findAll','alias','type','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview'];(function(_0x193387,_0xa9812f){var _0x2de057=function(_0x2be32e){while(--_0x2be32e){_0x193387['push'](_0x193387['shift']());}};_0x2de057(++_0xa9812f);}(_0x37bd,0x191));var _0xd37b=function(_0x1aef35,_0x41f3d6){_0x1aef35=_0x1aef35-0x0;var _0x408b86=_0x37bd[_0x1aef35];return _0x408b86;};'use strict';var moment=require(_0xd37b('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xd37b('0x1'));var fs=require('fs');var _=require(_0xd37b('0x2'));var squel=require(_0xd37b('0x3'));var Papa=require(_0xd37b('0x4'));var Redis=require(_0xd37b('0x5'));var qs=require(_0xd37b('0x6'));var as=require(_0xd37b('0x7'));var logger=require(_0xd37b('0x8'))(_0xd37b('0x9'));var config=require(_0xd37b('0xa'));var shared=require(_0xd37b('0xb'));var db=require(_0xd37b('0xc'))['db'];config[_0xd37b('0xd')]=_[_0xd37b('0xe')](config[_0xd37b('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd37b('0xf'))(new Redis(config[_0xd37b('0xd')]));require(_0xd37b('0x10'))[_0xd37b('0x11')](socket);function respondWithResult(_0x5ae9b4,_0x2a6236){_0x2a6236=_0x2a6236||0xc8;return function(_0x53c5ca){if(_0x53c5ca){return _0x5ae9b4[_0xd37b('0x12')](_0x2a6236)[_0xd37b('0x13')](_0x53c5ca);}};}function respondWithFilteredResult(_0x1dd9d0,_0x2945e8){return function(_0x40a575){if(_0x40a575){var _0x40d31e=typeof _0x2945e8['offset']===_0xd37b('0x14')&&typeof _0x2945e8['limit']===_0xd37b('0x14');var _0x29ae18=_0x40a575[_0xd37b('0x15')];var _0x205180=_0x40d31e?0x0:_0x2945e8[_0xd37b('0x16')];var _0x47b4c9=_0x40d31e?_0x40a575['count']:_0x2945e8[_0xd37b('0x16')]+_0x2945e8['limit'];var _0x3b88cf;if(_0x47b4c9>=_0x29ae18){_0x47b4c9=_0x29ae18;_0x3b88cf=0xc8;}else{_0x3b88cf=0xce;}_0x1dd9d0[_0xd37b('0x12')](_0x3b88cf);return _0x1dd9d0['set'](_0xd37b('0x17'),_0x205180+'-'+_0x47b4c9+'/'+_0x29ae18)[_0xd37b('0x13')](_0x40a575);}return null;};}function saveUpdates(_0x2a060b){return function(_0x388679){if(_0x388679){return _0x388679[_0xd37b('0x18')](_0x2a060b)['then'](function(_0x35be9c){return _0x35be9c;});}return null;};}function removeEntity(_0x1f2882){return function(_0x183d77){if(_0x183d77){return _0x183d77[_0xd37b('0x19')]()['then'](function(){_0x1f2882['status'](0xcc)[_0xd37b('0x1a')]();});}};}function handleEntityNotFound(_0x1041d9){return function(_0x1ab35d){if(!_0x1ab35d){_0x1041d9[_0xd37b('0x1b')](0x194);}return _0x1ab35d;};}function handleError(_0x426ad7,_0x5d0371){_0x5d0371=_0x5d0371||0x1f4;return function(_0x3eee10){logger['error'](_0x3eee10[_0xd37b('0x1c')]);if(_0x3eee10[_0xd37b('0x1d')]){delete _0x3eee10[_0xd37b('0x1d')];}_0x426ad7[_0xd37b('0x12')](_0x5d0371)[_0xd37b('0x1e')](_0x3eee10);};}exports['index']=function(_0x348c1c,_0x2a5aa0){var _0x53ef55={},_0x452f16={},_0x4f4f67={'count':0x0,'rows':[]};return db['CmContact'][_0xd37b('0x1f')]()[_0xd37b('0x20')](function(_0x47c547){var _0xb33943=[];for(var _0x2b247e=0x0;_0x2b247e0x1){_0x27caa9['or'](_0xd37b('0x60'),qs[_0xd37b('0x61')](_0x55a6a0),null);}else{if(qs['isNumeric'](_0x55a6a0)){_0x27caa9['or'](_0xd37b('0x62'),_0x55a6a0+'%');_0x27caa9['or']('c.phone\x20LIKE\x20?',_0x55a6a0+'%');_0x27caa9['or'](_0xd37b('0x63'),_0x55a6a0+'%');_0x27caa9['or'](_0xd37b('0x64'),_0x55a6a0+'%');}else if(qs['isEmail'](_0x55a6a0)){_0x27caa9['or'](_0xd37b('0x65'),_0x55a6a0+'%');}else{_0x27caa9['or']('c.firstName\x20LIKE\x20?','%'+_0x55a6a0+'%');_0x27caa9['or'](_0xd37b('0x66'),'%'+_0x55a6a0+'%');_0x27caa9['or'](_0xd37b('0x65'),'%'+_0x55a6a0+'%');}}}}_0x216c60[_0xd37b('0x32')](_0x27caa9);_0x216c60['group']('c.id');var _0x16535d={'type':db[_0xd37b('0x67')][_0xd37b('0x68')][_0xd37b('0x69')],'raw':!![]};var _0x4119a4=_0x216c60[_0xd37b('0x6a')]()['field'](_0xd37b('0x6b'));if(_0x53ef55[_0xd37b('0x6c')]){_0x53ef55[_0xd37b('0x6c')]['forEach'](function(_0x1506b6){_0x216c60[_0xd37b('0x6c')]('c.'+_0x1506b6[0x0],_0x1506b6[0x1]===_0xd37b('0x6d')?![]:!![]);});}if(!_['isEmpty'](_0x572086)){_0x216c60['having'](_0x293552);_0x4119a4[_0xd37b('0x32')](_0xd37b('0x6e'),_0x572086);}BPromise[_0xd37b('0x6f')]()['then'](function(){if(!_0x3ba136)return;if(_0x348c1c['user']['role']!=='agent')return;if(!_['some'](_0x3ba136[_0xd37b('0x43')],[_0xd37b('0x45'),'User'])){return _0x348c1c[_0xd37b('0x70')][_0xd37b('0x71')]({'attributes':['id'],'raw':!![]})[_0xd37b('0x20')](function(_0x147a68){if(_[_0xd37b('0x57')](_0x147a68)){_0x4119a4[_0xd37b('0x32')](_0xd37b('0x72'));_0x216c60[_0xd37b('0x32')](_0xd37b('0x72'));}else{_0x4119a4[_0xd37b('0x32')]('c.ListId\x20IN\x20?',_['map'](_0x147a68,'id'));_0x216c60[_0xd37b('0x32')](_0xd37b('0x59'),_[_0xd37b('0x48')](_0x147a68,'id'));}});}})[_0xd37b('0x20')](function(){if(_0x348c1c[_0xd37b('0x70')][_0xd37b('0x73')]===_0xd37b('0x74')&&!_0x3ba136&&!_0x348c1c['query'][_0xd37b('0x58')])return[];return db['sequelize'][_0xd37b('0x29')](_0x4119a4['toString'](),_0x16535d);})['then'](function(_0x489884){_0x4f4f67[_0xd37b('0x15')]=_0x489884[_0xd37b('0x22')];if(_0x4f4f67['count']===0x0)return[];return db['sequelize'][_0xd37b('0x29')](_0x5f4800[_0xd37b('0x75')](),_0x16535d)[_0xd37b('0x20')](function(_0xa734c6){_0x1d019c=_[_0xd37b('0x76')](_0xa734c6,'id');_0x16535d=_[_0xd37b('0x77')](_0x16535d,{'model':db[_0xd37b('0x78')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x348c1c[_0xd37b('0x29')]['fields']){_0x53ef55[_0xd37b('0x2c')][_0xd37b('0x49')](function(_0x402ee0){_0x216c60[_0xd37b('0x45')]('c.'+_0x402ee0);});}else{_0x216c60[_0xd37b('0x45')](_0xd37b('0x6b'));_0x216c60[_0xd37b('0x45')](_0xd37b('0x79'));_0x216c60[_0xd37b('0x45')](_0xd37b('0x7a'));_0x216c60[_0xd37b('0x45')]('c.phone');_0x216c60[_0xd37b('0x45')]('c.mobile');_0x216c60[_0xd37b('0x45')]('c.fax');_0x216c60[_0xd37b('0x45')](_0xd37b('0x7b'));_0x216c60[_0xd37b('0x45')](_0xd37b('0x7c'));_0x216c60[_0xd37b('0x45')](_0xd37b('0x7d'));_0x216c60[_0xd37b('0x45')](_0xd37b('0x7e'));_0x216c60['field'](_0xd37b('0x7f'));_0x216c60[_0xd37b('0x45')](_0xd37b('0x80'),_0xd37b('0x81'));}if(_0x53ef55[_0xd37b('0x30')])_0x216c60['limit'](_0x53ef55['limit']);if(_0x53ef55[_0xd37b('0x16')])_0x216c60[_0xd37b('0x16')](_0x53ef55['offset']);return db[_0xd37b('0x82')]['query'](_0x216c60[_0xd37b('0x75')](),_0x16535d);});})[_0xd37b('0x20')](function(_0xfb6d8d){_0xfb6d8d[_0xd37b('0x49')](function(_0x1cb1af){if(_0x1cb1af['TagIds']){_0x1cb1af[_0xd37b('0x83')]=[];_0x1cb1af[_0xd37b('0x81')]['split'](',')[_0xd37b('0x49')](function(_0x363b1f){_0x1cb1af[_0xd37b('0x83')]['push'](_0x1d019c[_0x363b1f]);});}delete _0x1cb1af[_0xd37b('0x81')];});_0x4f4f67['rows']=_0xfb6d8d;return _0x4f4f67;})[_0xd37b('0x20')](respondWithFilteredResult(_0x2a5aa0,_0x53ef55));})['catch'](handleError(_0x2a5aa0,null));};exports[_0xd37b('0x19')]=function(_0x308d8f,_0x4fb8b4){return db['CmContact']['find']({'where':{'id':_0x308d8f[_0xd37b('0x84')]['id']}})['then'](handleEntityNotFound(_0x4fb8b4,null))[_0xd37b('0x20')](removeEntity(_0x4fb8b4,null))[_0xd37b('0x85')](handleError(_0x4fb8b4,null));};exports[_0xd37b('0x1f')]=function(_0x345650,_0x2c679b){return db[_0xd37b('0x78')][_0xd37b('0x1f')]()['then'](function(_0x1a9623){delete _0x1a9623[_0xd37b('0x86')];for(var _0x19640f=0x0;_0x19640f=_0x547c89){_0x1890fa=_0x547c89;_0x5ec861=0xc8;}else{_0x5ec861=0xce;}_0x12f3e1[_0xe7ec('0x14')](_0x5ec861);return _0x12f3e1[_0xe7ec('0x15')](_0xe7ec('0x16'),_0x3ec268+'-'+_0x1890fa+'/'+_0x547c89)[_0xe7ec('0x17')](_0x1a4b6f);}return null;};}function saveUpdates(_0x5bdd19){return function(_0x1f79b7){if(_0x1f79b7){return _0x1f79b7[_0xe7ec('0x18')](_0x5bdd19)[_0xe7ec('0x19')](function(_0x1c5016){return _0x1c5016;});}return null;};}function removeEntity(_0x2a70cb){return function(_0x3397da){if(_0x3397da){return _0x3397da[_0xe7ec('0x1a')]()['then'](function(){_0x2a70cb['status'](0xcc)[_0xe7ec('0x1b')]();});}};}function handleEntityNotFound(_0x490e83){return function(_0xb61f2d){if(!_0xb61f2d){_0x490e83['sendStatus'](0x194);}return _0xb61f2d;};}function handleError(_0x284c37,_0x42b287){_0x42b287=_0x42b287||0x1f4;return function(_0x30ca28){logger[_0xe7ec('0x1c')](_0x30ca28[_0xe7ec('0x1d')]);if(_0x30ca28['name']){delete _0x30ca28['name'];}_0x284c37[_0xe7ec('0x14')](_0x42b287)['send'](_0x30ca28);};}exports[_0xe7ec('0x1e')]=function(_0x349717,_0x1285ec){var _0x5349bd={},_0x11d3ca={},_0x3e51ae={'count':0x0,'rows':[]};return db[_0xe7ec('0x1f')][_0xe7ec('0x20')]()[_0xe7ec('0x19')](function(_0x169f07){var _0x4c63be=[];for(var _0x872ccb=0x0;_0x872ccb0x1){_0x176536['or'](_0xe7ec('0x64'),qs[_0xe7ec('0x65')](_0x4dafa1),null);}else{if(qs[_0xe7ec('0x66')](_0x4dafa1)){_0x176536['or'](_0xe7ec('0x67'),_0x4dafa1+'%');_0x176536['or'](_0xe7ec('0x68'),_0x4dafa1+'%');_0x176536['or']('c.mobile\x20LIKE\x20?',_0x4dafa1+'%');_0x176536['or'](_0xe7ec('0x69'),_0x4dafa1+'%');}else if(qs[_0xe7ec('0x6a')](_0x4dafa1)){_0x176536['or'](_0xe7ec('0x6b'),_0x4dafa1+'%');}else{_0x176536['or'](_0xe7ec('0x6c'),'%'+_0x4dafa1+'%');_0x176536['or']('c.lastName\x20LIKE\x20?','%'+_0x4dafa1+'%');_0x176536['or'](_0xe7ec('0x6b'),'%'+_0x4dafa1+'%');}}}}_0x233708[_0xe7ec('0x33')](_0x176536);_0x233708['group'](_0xe7ec('0x6d'));var _0x55096b={'type':db['Sequelize'][_0xe7ec('0x6e')][_0xe7ec('0x6f')],'raw':!![]};var _0x11767d=_0x233708[_0xe7ec('0x70')]()[_0xe7ec('0x36')](_0xe7ec('0x6d'));if(_0x5349bd[_0xe7ec('0x31')]){_0x5349bd[_0xe7ec('0x31')][_0xe7ec('0x4b')](function(_0x1e47e0){_0x233708['order']('c.'+_0x1e47e0[0x0],_0x1e47e0[0x1]===_0xe7ec('0x71')?![]:!![]);});}if(!_['isEmpty'](_0x1d4d7b)){_0x233708[_0xe7ec('0x72')](_0x9f2283);_0x11767d[_0xe7ec('0x33')]('t.id\x20IN\x20?',_0x1d4d7b);}BPromise[_0xe7ec('0x73')]()[_0xe7ec('0x19')](function(){if(!_0x34e5d7)return;if(_0x349717['user']['role']!==_0xe7ec('0x74'))return;if(!_['some'](_0x34e5d7[_0xe7ec('0x46')],[_0xe7ec('0x36'),'User'])){return _0x349717['user'][_0xe7ec('0x75')]({'attributes':['id'],'raw':!![]})[_0xe7ec('0x19')](function(_0x1efff7){if(_[_0xe7ec('0x5c')](_0x1efff7)){_0x11767d[_0xe7ec('0x33')]('c.ListId\x20IS\x20NULL');_0x233708[_0xe7ec('0x33')](_0xe7ec('0x76'));}else{_0x11767d[_0xe7ec('0x33')](_0xe7ec('0x77'),_['map'](_0x1efff7,'id'));_0x233708['where'](_0xe7ec('0x77'),_[_0xe7ec('0x57')](_0x1efff7,'id'));}});}})[_0xe7ec('0x19')](function(){if(_0x349717[_0xe7ec('0x78')]['role']===_0xe7ec('0x74')&&!_0x34e5d7&&!_0x349717[_0xe7ec('0x2a')]['ListId'])return[];return db[_0xe7ec('0x79')][_0xe7ec('0x2a')](_0x11767d['toString'](),_0x55096b);})[_0xe7ec('0x19')](function(_0x2ee3f3){_0x3e51ae[_0xe7ec('0x13')]=_0x2ee3f3[_0xe7ec('0x22')];if(_0x3e51ae['count']===0x0)return[];return db['sequelize']['query'](_0x37b946[_0xe7ec('0x7a')](),_0x55096b)[_0xe7ec('0x19')](function(_0x207e8b){_0x3fc32e=_[_0xe7ec('0x7b')](_0x207e8b,'id');_0x55096b=_['merge'](_0x55096b,{'model':db[_0xe7ec('0x1f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x349717['query']['fields']){_0x5349bd[_0xe7ec('0x2f')][_0xe7ec('0x4b')](function(_0x79587){_0x233708[_0xe7ec('0x36')]('c.'+_0x79587);});}else{_0x233708[_0xe7ec('0x36')](_0xe7ec('0x6d'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x7c'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x7d'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x7e'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x7f'));_0x233708[_0xe7ec('0x36')]('c.fax');_0x233708[_0xe7ec('0x36')](_0xe7ec('0x80'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x81'));_0x233708['field'](_0xe7ec('0x82'));_0x233708['field'](_0xe7ec('0x83'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x84'));_0x233708[_0xe7ec('0x36')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe7ec('0x85'));}if(_0x5349bd[_0xe7ec('0x12')])_0x233708[_0xe7ec('0x12')](_0x5349bd[_0xe7ec('0x12')]);if(_0x5349bd[_0xe7ec('0x10')])_0x233708['offset'](_0x5349bd[_0xe7ec('0x10')]);return db['sequelize'][_0xe7ec('0x2a')](_0x233708[_0xe7ec('0x7a')](),_0x55096b);});})['then'](function(_0x1a741f){_0x1a741f[_0xe7ec('0x4b')](function(_0x49e977){if(_0x49e977[_0xe7ec('0x85')]){_0x49e977[_0xe7ec('0x86')]=[];_0x49e977[_0xe7ec('0x85')][_0xe7ec('0x4a')](',')[_0xe7ec('0x4b')](function(_0x40bbd0){_0x49e977[_0xe7ec('0x86')][_0xe7ec('0x87')](_0x3fc32e[_0x40bbd0]);});}delete _0x49e977['TagIds'];});_0x3e51ae[_0xe7ec('0x88')]=_0x1a741f;return _0x3e51ae;})[_0xe7ec('0x19')](respondWithFilteredResult(_0x1285ec,_0x5349bd));})[_0xe7ec('0x89')](handleError(_0x1285ec,null));};exports[_0xe7ec('0x1a')]=function(_0x344e23,_0x3c1117){return db[_0xe7ec('0x1f')]['find']({'where':{'id':_0x344e23['params']['id']}})['then'](handleEntityNotFound(_0x3c1117,null))[_0xe7ec('0x19')](removeEntity(_0x3c1117,null))[_0xe7ec('0x89')](handleError(_0x3c1117,null));};exports[_0xe7ec('0x20')]=function(_0x4faed3,_0x9cda0b){return db[_0xe7ec('0x1f')][_0xe7ec('0x20')]()[_0xe7ec('0x19')](function(_0x5f4ffc){delete _0x5f4ffc['tags'];for(var _0xac12d9=0x0;_0xac12d9{}\s\\|]/g,'-');_0x50fa67(null,util['format'](_0xb3c8('0x1c'),path['basename'](_0x223fd9[_0xb3c8('0x1a')],path[_0xb3c8('0x1d')](_0x223fd9[_0xb3c8('0x1a')])),Date[_0xb3c8('0x1e')](),path[_0xb3c8('0x1d')](_0x223fd9[_0xb3c8('0x1a')])));}})});router[_0xb3c8('0x13')](_0xb3c8('0x1f'),upload[_0xb3c8('0x20')]('file'),controller[_0xb3c8('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1765b9,_0x1c5bca,_0x2ef1ad){_0x2ef1ad(null,path[_0xb3c8('0x22')](config['root'],_0xb3c8('0x23')));},'filename':function(_0x657ae1,_0x4460fc,_0x1622e2){_0x4460fc[_0xb3c8('0x1a')]=_0x4460fc[_0xb3c8('0x1a')][_0xb3c8('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1622e2(null,util['format'](_0xb3c8('0x1c'),path[_0xb3c8('0x24')](_0x4460fc['originalname'],path[_0xb3c8('0x1d')](_0x4460fc[_0xb3c8('0x1a')])),Date[_0xb3c8('0x1e')](),path[_0xb3c8('0x1d')](_0x4460fc[_0xb3c8('0x1a')])));}})});router[_0xb3c8('0x13')](_0xb3c8('0x25'),upload['single'](_0xb3c8('0x26')),controller[_0xb3c8('0x27')]);router[_0xb3c8('0x13')](_0xb3c8('0x28'),auth[_0xb3c8('0x9')](),controller['import']);router[_0xb3c8('0x29')](_0xb3c8('0xb'),auth[_0xb3c8('0x9')](),controller[_0xb3c8('0x2a')]);router[_0xb3c8('0x2b')](_0xb3c8('0xb'),auth[_0xb3c8('0x9')](),controller[_0xb3c8('0x2c')]);module[_0xb3c8('0x2d')]=router; \ No newline at end of file +var _0xa60a=['basename','now','extname','file','uploadCsv','/upload','/upload/:id','import','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getTags','/:id/hoppers','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','getJourney','/merge','merge','create','post','/create_many','bulkCreate','/:id/tags','join','root','server/files/tmp','originalname','replace','format','%s-%s%s'];(function(_0x2bd3fd,_0x166e43){var _0x379a77=function(_0x1314b5){while(--_0x1314b5){_0x2bd3fd['push'](_0x2bd3fd['shift']());}};_0x379a77(++_0x166e43);}(_0xa60a,0x9d));var _0xaa60=function(_0x3b0f61,_0x360d76){_0x3b0f61=_0x3b0f61-0x0;var _0x500241=_0xa60a[_0x3b0f61];return _0x500241;};'use strict';var multer=require(_0xaa60('0x0'));var util=require(_0xaa60('0x1'));var path=require(_0xaa60('0x2'));var timeout=require(_0xaa60('0x3'));var express=require(_0xaa60('0x4'));var router=express[_0xaa60('0x5')]();var fs_extra=require(_0xaa60('0x6'));var auth=require(_0xaa60('0x7'));var interaction=require(_0xaa60('0x8'));var config=require(_0xaa60('0x9'));var controller=require(_0xaa60('0xa'));router['get']('/',auth[_0xaa60('0xb')](),controller[_0xaa60('0xc')]);router['get'](_0xaa60('0xd'),auth[_0xaa60('0xb')](),controller[_0xaa60('0xe')]);router[_0xaa60('0xf')](_0xaa60('0x10'),auth[_0xaa60('0xb')](),controller[_0xaa60('0x11')]);router[_0xaa60('0xf')]('/:id/tags',auth[_0xaa60('0xb')](),controller[_0xaa60('0x12')]);router[_0xaa60('0xf')](_0xaa60('0x13'),auth['isAuthenticated'](),controller['getHoppers']);router[_0xaa60('0xf')]('/:id/hopper_histories',auth[_0xaa60('0xb')](),controller[_0xaa60('0x14')]);router[_0xaa60('0xf')](_0xaa60('0x15'),auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0xaa60('0x16'),auth[_0xaa60('0xb')](),controller[_0xaa60('0x17')]);router[_0xaa60('0xf')]('/:id/journey',auth['isAuthenticated'](),controller[_0xaa60('0x18')]);router['post'](_0xaa60('0x19'),auth[_0xaa60('0xb')](),controller[_0xaa60('0x1a')]);router['post']('/',auth[_0xaa60('0xb')](),controller[_0xaa60('0x1b')]);router[_0xaa60('0x1c')](_0xaa60('0x1d'),auth[_0xaa60('0xb')](),controller[_0xaa60('0x1e')]);router[_0xaa60('0x1c')](_0xaa60('0x1f'),auth['isAuthenticated'](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5bf138,_0x5c7c76,_0x51c982){_0x51c982(null,path[_0xaa60('0x20')](config[_0xaa60('0x21')],_0xaa60('0x22')));},'filename':function(_0x2f8ede,_0x10c33b,_0x1c2447){_0x10c33b[_0xaa60('0x23')]=_0x10c33b[_0xaa60('0x23')][_0xaa60('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c2447(null,util[_0xaa60('0x25')](_0xaa60('0x26'),path[_0xaa60('0x27')](_0x10c33b[_0xaa60('0x23')],path['extname'](_0x10c33b[_0xaa60('0x23')])),Date[_0xaa60('0x28')](),path[_0xaa60('0x29')](_0x10c33b[_0xaa60('0x23')])));}})});router[_0xaa60('0x1c')]('/csv',upload['single'](_0xaa60('0x2a')),controller[_0xaa60('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x48d281,_0x3998ee,_0x2d6727){_0x2d6727(null,path[_0xaa60('0x20')](config[_0xaa60('0x21')],_0xaa60('0x22')));},'filename':function(_0x55c286,_0x39d11b,_0x436929){_0x39d11b['originalname']=_0x39d11b[_0xaa60('0x23')][_0xaa60('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x436929(null,util[_0xaa60('0x25')](_0xaa60('0x26'),path[_0xaa60('0x27')](_0x39d11b['originalname'],path[_0xaa60('0x29')](_0x39d11b[_0xaa60('0x23')])),Date[_0xaa60('0x28')](),path[_0xaa60('0x29')](_0x39d11b[_0xaa60('0x23')])));}})});router[_0xaa60('0x1c')](_0xaa60('0x2c'),upload['single'](_0xaa60('0x2a')),controller['upload']);router[_0xaa60('0x1c')](_0xaa60('0x2d'),auth['isAuthenticated'](),controller[_0xaa60('0x2e')]);router['put'](_0xaa60('0x10'),auth[_0xaa60('0xb')](),controller[_0xaa60('0x2f')]);router['delete'](_0xaa60('0x10'),auth[_0xaa60('0xb')](),controller[_0xaa60('0x30')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index c54f098..759e596 100644 --- a/server/api/cmCustomField/cmCustomField.attributes.js +++ b/server/api/cmCustomField/cmCustomField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1510=['long','type','select','parse','values','isArray','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','getDataValue','setDataValue','TEXT'];(function(_0x2347e9,_0x884d42){var _0x255d1b=function(_0x4a9082){while(--_0x4a9082){_0x2347e9['push'](_0x2347e9['shift']());}};_0x255d1b(++_0x884d42);}(_0x1510,0x18f));var _0x0151=function(_0x22f361,_0x3698d2){_0x22f361=_0x22f361-0x0;var _0x41932d=_0x1510[_0x22f361];return _0x41932d;};'use strict';var Sequelize=require('sequelize');var _=require(_0x0151('0x0'));module[_0x0151('0x1')]={'name':{'type':Sequelize[_0x0151('0x2')],'get':function(_0x5e1e99){return this[_0x0151('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5de300){this[_0x0151('0x4')]('alias',_0x5de300?_0x5de300:this[_0x0151('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x0151('0x5')](_0x0151('0x6')),'get':function(){if(this[_0x0151('0x3')](_0x0151('0x7'))===_0x0151('0x8')){return JSON[_0x0151('0x9')](this[_0x0151('0x3')]('values'));}else{return this['getDataValue'](_0x0151('0xa'));}},'set':function(_0x27b9cc){if(Array[_0x0151('0xb')](_0x27b9cc)){this[_0x0151('0x4')](_0x0151('0xa'),JSON['stringify'](_0x27b9cc));}else{this[_0x0151('0x4')]('values',_0x27b9cc);}}},'required':{'type':Sequelize[_0x0151('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0151('0xd')](_0x0151('0xe'))}}; \ No newline at end of file +var _0x6cfe=['values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','VIRTUAL','getDataValue','STRING','setDataValue','alias','TEXT','long','type','select'];(function(_0x2d89dd,_0x40929a){var _0x3c4bbe=function(_0x3158f1){while(--_0x3158f1){_0x2d89dd['push'](_0x2d89dd['shift']());}};_0x3c4bbe(++_0x40929a);}(_0x6cfe,0x146));var _0xe6cf=function(_0x19e432,_0xba4339){_0x19e432=_0x19e432-0x0;var _0x30b89a=_0x6cfe[_0x19e432];return _0x30b89a;};'use strict';var Sequelize=require(_0xe6cf('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xe6cf('0x1')],'get':function(_0x92ac60){return this[_0xe6cf('0x2')]('alias');}},'alias':{'type':Sequelize[_0xe6cf('0x3')],'allowNull':![],'set':function(_0x247408){this[_0xe6cf('0x4')](_0xe6cf('0x5'),_0x247408?_0x247408:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xe6cf('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0xe6cf('0x6')](_0xe6cf('0x7')),'get':function(){if(this[_0xe6cf('0x2')](_0xe6cf('0x8'))===_0xe6cf('0x9')){return JSON['parse'](this['getDataValue']('values'));}else{return this['getDataValue'](_0xe6cf('0xa'));}},'set':function(_0x5cbe9d){if(Array[_0xe6cf('0xb')](_0x5cbe9d)){this['setDataValue'](_0xe6cf('0xa'),JSON[_0xe6cf('0xc')](_0x5cbe9d));}else{this['setDataValue']('values',_0x5cbe9d);}}},'required':{'type':Sequelize[_0xe6cf('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe6cf('0xe')](_0xe6cf('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 06cc0a5..4aeb1a3 100644 --- a/server/api/cmCustomField/cmCustomField.controller.js +++ b/server/api/cmCustomField/cmCustomField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2da=['catch','update','body','create','Sequelize','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','end','error','name','send','index','map','CmCustomField','rawAttributes','type','key','model','query','keys','filters','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','attributes','find'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0xf2da,0xfc));var _0xaf2d=function(_0x395bfe,_0x4db521){_0x395bfe=_0x395bfe-0x0;var _0x35c81c=_0xf2da[_0x395bfe];return _0x35c81c;};'use strict';var emlformat=require(_0xaf2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf2d('0x1'));var jsonpatch=require(_0xaf2d('0x2'));var rp=require(_0xaf2d('0x3'));var moment=require('moment');var BPromise=require(_0xaf2d('0x4'));var Mustache=require('mustache');var util=require(_0xaf2d('0x5'));var path=require(_0xaf2d('0x6'));var sox=require('sox');var csv=require(_0xaf2d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaf2d('0x8'));var crypto=require(_0xaf2d('0x9'));var jsforce=require(_0xaf2d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xaf2d('0x7'));var querystring=require(_0xaf2d('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaf2d('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xaf2d('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaf2d('0xe'));var utils=require('../../config/utils');var config=require(_0xaf2d('0xf'));var licenseUtil=require(_0xaf2d('0x10'));var db=require(_0xaf2d('0x11'))['db'];function respondWithStatusCode(_0x4c73f8,_0x5dfd56){_0x5dfd56=_0x5dfd56||0xcc;return function(_0x28d65a){if(_0x28d65a){return _0x4c73f8[_0xaf2d('0x12')](_0x5dfd56);}return _0x4c73f8[_0xaf2d('0x13')](_0x5dfd56)['end']();};}function respondWithResult(_0x15ee1a,_0x108278){_0x108278=_0x108278||0xc8;return function(_0xb3cc68){if(_0xb3cc68){return _0x15ee1a[_0xaf2d('0x13')](_0x108278)[_0xaf2d('0x14')](_0xb3cc68);}};}function respondWithFilteredResult(_0x2050db,_0x1238ab){return function(_0x4803cb){if(_0x4803cb){var _0x1ba4a2=typeof _0x1238ab['offset']===_0xaf2d('0x15')&&typeof _0x1238ab[_0xaf2d('0x16')]===_0xaf2d('0x15');var _0x3b8b84=_0x4803cb[_0xaf2d('0x17')];var _0x578608=_0x1ba4a2?0x0:_0x1238ab[_0xaf2d('0x18')];var _0x2e0035=_0x1ba4a2?_0x4803cb[_0xaf2d('0x17')]:_0x1238ab[_0xaf2d('0x18')]+_0x1238ab['limit'];var _0x2e2a0f;if(_0x2e0035>=_0x3b8b84){_0x2e0035=_0x3b8b84;_0x2e2a0f=0xc8;}else{_0x2e2a0f=0xce;}_0x2050db[_0xaf2d('0x13')](_0x2e2a0f);return _0x2050db[_0xaf2d('0x19')](_0xaf2d('0x1a'),_0x578608+'-'+_0x2e0035+'/'+_0x3b8b84)[_0xaf2d('0x14')](_0x4803cb);}return null;};}function patchUpdates(_0x546ecc){return function(_0x6b8157){try{jsonpatch[_0xaf2d('0x1b')](_0x6b8157,_0x546ecc,!![]);}catch(_0x41a0ef){return BPromise[_0xaf2d('0x1c')](_0x41a0ef);}return _0x6b8157['save']();};}function saveUpdates(_0x2d72a6,_0x2f6a6f){return function(_0x2e9884){if(_0x2e9884){return _0x2e9884['update'](_0x2d72a6)[_0xaf2d('0x1d')](function(_0x5d7506){return _0x5d7506;});}return null;};}function removeEntity(_0x3904c0,_0x5d72d1){return function(_0x76e9c9){if(_0x76e9c9){return _0x76e9c9['destroy']()[_0xaf2d('0x1d')](function(){_0x3904c0[_0xaf2d('0x13')](0xcc)[_0xaf2d('0x1e')]();});}};}function handleEntityNotFound(_0x129a7b,_0x4fe87e){return function(_0x5c920b){if(!_0x5c920b){_0x129a7b[_0xaf2d('0x12')](0x194);}return _0x5c920b;};}function handleError(_0x225fba,_0x534603){_0x534603=_0x534603||0x1f4;return function(_0x21333d){logger[_0xaf2d('0x1f')](_0x21333d['stack']);if(_0x21333d[_0xaf2d('0x20')]){delete _0x21333d[_0xaf2d('0x20')];}_0x225fba[_0xaf2d('0x13')](_0x534603)[_0xaf2d('0x21')](_0x21333d);};}exports[_0xaf2d('0x22')]=function(_0x3afd67,_0x57d0c1){var _0x423d6={},_0x106f1e={},_0x5d9b84={'count':0x0,'rows':[]};var _0x144b5e=_[_0xaf2d('0x23')](db[_0xaf2d('0x24')][_0xaf2d('0x25')],function(_0x477c0a){return{'name':_0x477c0a['fieldName'],'type':_0x477c0a[_0xaf2d('0x26')][_0xaf2d('0x27')]};});_0x106f1e[_0xaf2d('0x28')]=_['differenceBy'](_[_0xaf2d('0x23')](_0x144b5e,_0xaf2d('0x20')),['name']);_0x106f1e[_0xaf2d('0x29')]=_[_0xaf2d('0x2a')](_0x3afd67[_0xaf2d('0x29')]);_0x106f1e[_0xaf2d('0x2b')]=_['intersection'](_0x106f1e[_0xaf2d('0x28')],_0x106f1e[_0xaf2d('0x29')]);_0x423d6['attributes']=_['intersection'](_0x106f1e['model'],qs[_0xaf2d('0x2c')](_0x3afd67[_0xaf2d('0x29')][_0xaf2d('0x2c')]));_0x423d6['attributes']=_0x423d6['attributes'][_0xaf2d('0x2d')]?_0x423d6['attributes']:_0x106f1e[_0xaf2d('0x28')];if(!_0x3afd67[_0xaf2d('0x29')][_0xaf2d('0x2e')](_0xaf2d('0x2f'))){_0x423d6['limit']=qs[_0xaf2d('0x16')](_0x3afd67['query'][_0xaf2d('0x16')]);_0x423d6[_0xaf2d('0x18')]=qs[_0xaf2d('0x18')](_0x3afd67[_0xaf2d('0x29')][_0xaf2d('0x18')]);}_0x423d6[_0xaf2d('0x30')]=qs[_0xaf2d('0x31')](_0x3afd67[_0xaf2d('0x29')][_0xaf2d('0x31')]);_0x423d6[_0xaf2d('0x32')]=qs[_0xaf2d('0x2b')](_['pick'](_0x3afd67[_0xaf2d('0x29')],_0x106f1e[_0xaf2d('0x2b')]),_0x144b5e);if(_0x3afd67[_0xaf2d('0x29')][_0xaf2d('0x33')]){_0x423d6['where']=_[_0xaf2d('0x34')](_0x423d6[_0xaf2d('0x32')],{'$or':_['map'](_0x144b5e,function(_0x5632e9){if(_0x5632e9[_0xaf2d('0x26')]!==_0xaf2d('0x35')){var _0xbadb28={};_0xbadb28[_0x5632e9[_0xaf2d('0x20')]]={'$like':'%'+_0x3afd67['query']['filter']+'%'};return _0xbadb28;}})});}_0x423d6=_[_0xaf2d('0x34')]({},_0x423d6,_0x3afd67[_0xaf2d('0x36')]);var _0xc5be2e={'where':_0x423d6[_0xaf2d('0x32')]};return db[_0xaf2d('0x24')][_0xaf2d('0x17')](_0xc5be2e)[_0xaf2d('0x1d')](function(_0x2b857e){_0x5d9b84['count']=_0x2b857e;if(_0x3afd67[_0xaf2d('0x29')][_0xaf2d('0x37')]){_0x423d6[_0xaf2d('0x38')]=[{'all':!![]}];}return db[_0xaf2d('0x24')][_0xaf2d('0x39')](_0x423d6);})[_0xaf2d('0x1d')](function(_0x423f2a){_0x5d9b84[_0xaf2d('0x3a')]=_0x423f2a;return _0x5d9b84;})['then'](respondWithFilteredResult(_0x57d0c1,_0x423d6))['catch'](handleError(_0x57d0c1,null));};exports[_0xaf2d('0x3b')]=function(_0x58749f,_0x5eace9){var _0x5dc12b={'raw':!![],'where':{'id':_0x58749f[_0xaf2d('0x3c')]['id']}},_0x202648={};_0x202648['model']=_[_0xaf2d('0x2a')](db[_0xaf2d('0x24')][_0xaf2d('0x25')]);_0x202648[_0xaf2d('0x29')]=_[_0xaf2d('0x2a')](_0x58749f[_0xaf2d('0x29')]);_0x202648[_0xaf2d('0x2b')]=_[_0xaf2d('0x3d')](_0x202648[_0xaf2d('0x28')],_0x202648[_0xaf2d('0x29')]);_0x5dc12b[_0xaf2d('0x3e')]=_['intersection'](_0x202648[_0xaf2d('0x28')],qs[_0xaf2d('0x2c')](_0x58749f['query'][_0xaf2d('0x2c')]));_0x5dc12b[_0xaf2d('0x3e')]=_0x5dc12b[_0xaf2d('0x3e')][_0xaf2d('0x2d')]?_0x5dc12b[_0xaf2d('0x3e')]:_0x202648[_0xaf2d('0x28')];if(_0x58749f[_0xaf2d('0x29')]['includeAll']){_0x5dc12b[_0xaf2d('0x38')]=[{'all':!![]}];}_0x5dc12b=_[_0xaf2d('0x34')]({},_0x5dc12b,_0x58749f[_0xaf2d('0x36')]);return db[_0xaf2d('0x24')][_0xaf2d('0x3f')](_0x5dc12b)[_0xaf2d('0x1d')](handleEntityNotFound(_0x5eace9,null))[_0xaf2d('0x1d')](respondWithResult(_0x5eace9,null))[_0xaf2d('0x40')](handleError(_0x5eace9,null));};exports[_0xaf2d('0x41')]=function(_0x53e108,_0x324caa){if(_0x53e108[_0xaf2d('0x42')]['id']){delete _0x53e108[_0xaf2d('0x42')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x53e108['params']['id']}})[_0xaf2d('0x1d')](handleEntityNotFound(_0x324caa,null))['then'](saveUpdates(_0x53e108[_0xaf2d('0x42')],null))[_0xaf2d('0x1d')](respondWithResult(_0x324caa,null))[_0xaf2d('0x40')](handleError(_0x324caa,null));};exports['destroy']=function(_0x434e76,_0x1bec1f){return db[_0xaf2d('0x24')][_0xaf2d('0x3f')]({'where':{'id':_0x434e76[_0xaf2d('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1bec1f,null))[_0xaf2d('0x1d')](removeEntity(_0x1bec1f,null))[_0xaf2d('0x40')](handleError(_0x1bec1f,null));};exports[_0xaf2d('0x43')]=function(_0x219372,_0xd03cfb){var _0x41371f;return db['sequelize']['transaction'](function(_0x32d4c5){return db[_0xaf2d('0x24')][_0xaf2d('0x43')](_0x219372['body'],{'transaction':_0x32d4c5})[_0xaf2d('0x1d')](function(_0x19136e){_0x41371f=_0x19136e;var _0x1e8633={'type':db[_0xaf2d('0x44')]['TEXT'],'transaction':_0x32d4c5};switch(_0x219372[_0xaf2d('0x42')][_0xaf2d('0x26')]){case _0xaf2d('0x45'):_0x1e8633[_0xaf2d('0x26')]=db['Sequelize']['TEXT'];break;case _0xaf2d('0x46'):_0x1e8633['type']=db[_0xaf2d('0x44')][_0xaf2d('0x47')];break;case _0xaf2d('0x48'):_0x1e8633[_0xaf2d('0x26')]=db['Sequelize'][_0xaf2d('0x49')];_0x1e8633[_0xaf2d('0x4a')]=![];break;default:}return db['sequelize'][_0xaf2d('0x4b')][_0xaf2d('0x4c')](_0xaf2d('0x4d'),util['format'](_0xaf2d('0x4e'),_0x41371f['id']),_0x1e8633);})['then'](function(){return _0x41371f;});})['then'](respondWithResult(_0xd03cfb,0xc9))[_0xaf2d('0x40')](handleError(_0xd03cfb,null));}; \ No newline at end of file +var _0xac2c=['then','catch','show','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll'];(function(_0x438d01,_0x544bd0){var _0x449b67=function(_0x1e1c1d){while(--_0x1e1c1d){_0x438d01['push'](_0x438d01['shift']());}};_0x449b67(++_0x544bd0);}(_0xac2c,0x6c));var _0xcac2=function(_0x96a05,_0x1f4b8c){_0x96a05=_0x96a05-0x0;var _0x253e31=_0xac2c[_0x96a05];return _0x253e31;};'use strict';var emlformat=require(_0xcac2('0x0'));var rimraf=require(_0xcac2('0x1'));var zipdir=require(_0xcac2('0x2'));var jsonpatch=require(_0xcac2('0x3'));var rp=require(_0xcac2('0x4'));var moment=require(_0xcac2('0x5'));var BPromise=require(_0xcac2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcac2('0x7'));var sox=require('sox');var csv=require(_0xcac2('0x8'));var ejs=require(_0xcac2('0x9'));var fs=require('fs');var fs_extra=require(_0xcac2('0xa'));var _=require(_0xcac2('0xb'));var squel=require(_0xcac2('0xc'));var crypto=require(_0xcac2('0xd'));var jsforce=require(_0xcac2('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcac2('0xf'));var Papa=require('papaparse');var Redis=require(_0xcac2('0x10'));var authService=require(_0xcac2('0x11'));var qs=require(_0xcac2('0x12'));var as=require(_0xcac2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcac2('0x14'))(_0xcac2('0x15'));var utils=require(_0xcac2('0x16'));var config=require(_0xcac2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcac2('0x18'))['db'];function respondWithStatusCode(_0x574ea1,_0x2fae41){_0x2fae41=_0x2fae41||0xcc;return function(_0x41ed3a){if(_0x41ed3a){return _0x574ea1[_0xcac2('0x19')](_0x2fae41);}return _0x574ea1[_0xcac2('0x1a')](_0x2fae41)['end']();};}function respondWithResult(_0x15b01d,_0x283aad){_0x283aad=_0x283aad||0xc8;return function(_0x5487c8){if(_0x5487c8){return _0x15b01d['status'](_0x283aad)[_0xcac2('0x1b')](_0x5487c8);}};}function respondWithFilteredResult(_0x205eab,_0x4d8f68){return function(_0x151648){if(_0x151648){var _0x1bf47c=typeof _0x4d8f68['offset']==='undefined'&&typeof _0x4d8f68['limit']===_0xcac2('0x1c');var _0x2f2ed9=_0x151648[_0xcac2('0x1d')];var _0x98e4b1=_0x1bf47c?0x0:_0x4d8f68[_0xcac2('0x1e')];var _0x392b2f=_0x1bf47c?_0x151648[_0xcac2('0x1d')]:_0x4d8f68[_0xcac2('0x1e')]+_0x4d8f68[_0xcac2('0x1f')];var _0x3a4ebe;if(_0x392b2f>=_0x2f2ed9){_0x392b2f=_0x2f2ed9;_0x3a4ebe=0xc8;}else{_0x3a4ebe=0xce;}_0x205eab[_0xcac2('0x1a')](_0x3a4ebe);return _0x205eab[_0xcac2('0x20')](_0xcac2('0x21'),_0x98e4b1+'-'+_0x392b2f+'/'+_0x2f2ed9)[_0xcac2('0x1b')](_0x151648);}return null;};}function patchUpdates(_0x1731ba){return function(_0x5eb095){try{jsonpatch[_0xcac2('0x22')](_0x5eb095,_0x1731ba,!![]);}catch(_0x28cadf){return BPromise[_0xcac2('0x23')](_0x28cadf);}return _0x5eb095[_0xcac2('0x24')]();};}function saveUpdates(_0x44681f,_0x597252){return function(_0x3f2c51){if(_0x3f2c51){return _0x3f2c51[_0xcac2('0x25')](_0x44681f)['then'](function(_0x29688f){return _0x29688f;});}return null;};}function removeEntity(_0x4b743d,_0x38442f){return function(_0x5e85ac){if(_0x5e85ac){return _0x5e85ac[_0xcac2('0x26')]()['then'](function(){_0x4b743d[_0xcac2('0x1a')](0xcc)[_0xcac2('0x27')]();});}};}function handleEntityNotFound(_0x1f1165,_0x3e23a4){return function(_0x35141f){if(!_0x35141f){_0x1f1165[_0xcac2('0x19')](0x194);}return _0x35141f;};}function handleError(_0x5793ec,_0x2abcce){_0x2abcce=_0x2abcce||0x1f4;return function(_0x15c024){logger[_0xcac2('0x28')](_0x15c024[_0xcac2('0x29')]);if(_0x15c024[_0xcac2('0x2a')]){delete _0x15c024['name'];}_0x5793ec[_0xcac2('0x1a')](_0x2abcce)[_0xcac2('0x2b')](_0x15c024);};}exports[_0xcac2('0x2c')]=function(_0x23ab3e,_0x6606e5){var _0x336b2f={},_0x2199dc={},_0x247107={'count':0x0,'rows':[]};var _0x518658=_[_0xcac2('0x2d')](db[_0xcac2('0x2e')][_0xcac2('0x2f')],function(_0x457c4f){return{'name':_0x457c4f['fieldName'],'type':_0x457c4f[_0xcac2('0x30')][_0xcac2('0x31')]};});_0x2199dc[_0xcac2('0x32')]=_[_0xcac2('0x33')](_['map'](_0x518658,_0xcac2('0x2a')),[_0xcac2('0x2a')]);_0x2199dc[_0xcac2('0x34')]=_[_0xcac2('0x35')](_0x23ab3e['query']);_0x2199dc[_0xcac2('0x36')]=_[_0xcac2('0x37')](_0x2199dc['model'],_0x2199dc['query']);_0x336b2f[_0xcac2('0x38')]=_['intersection'](_0x2199dc[_0xcac2('0x32')],qs[_0xcac2('0x39')](_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x39')]));_0x336b2f[_0xcac2('0x38')]=_0x336b2f[_0xcac2('0x38')][_0xcac2('0x3a')]?_0x336b2f['attributes']:_0x2199dc[_0xcac2('0x32')];if(!_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x3b')](_0xcac2('0x3c'))){_0x336b2f[_0xcac2('0x1f')]=qs[_0xcac2('0x1f')](_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x1f')]);_0x336b2f[_0xcac2('0x1e')]=qs[_0xcac2('0x1e')](_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x1e')]);}_0x336b2f[_0xcac2('0x3d')]=qs['sort'](_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x3e')]);_0x336b2f[_0xcac2('0x3f')]=qs[_0xcac2('0x36')](_[_0xcac2('0x40')](_0x23ab3e[_0xcac2('0x34')],_0x2199dc[_0xcac2('0x36')]),_0x518658);if(_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x41')]){_0x336b2f['where']=_[_0xcac2('0x42')](_0x336b2f[_0xcac2('0x3f')],{'$or':_['map'](_0x518658,function(_0x293b35){if(_0x293b35[_0xcac2('0x30')]!=='VIRTUAL'){var _0x2f795f={};_0x2f795f[_0x293b35[_0xcac2('0x2a')]]={'$like':'%'+_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x41')]+'%'};return _0x2f795f;}})});}_0x336b2f=_[_0xcac2('0x42')]({},_0x336b2f,_0x23ab3e[_0xcac2('0x43')]);var _0x37dbd4={'where':_0x336b2f[_0xcac2('0x3f')]};return db[_0xcac2('0x2e')][_0xcac2('0x1d')](_0x37dbd4)['then'](function(_0x1b93ac){_0x247107[_0xcac2('0x1d')]=_0x1b93ac;if(_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x44')]){_0x336b2f['include']=[{'all':!![]}];}return db[_0xcac2('0x2e')][_0xcac2('0x45')](_0x336b2f);})[_0xcac2('0x46')](function(_0x326343){_0x247107['rows']=_0x326343;return _0x247107;})['then'](respondWithFilteredResult(_0x6606e5,_0x336b2f))[_0xcac2('0x47')](handleError(_0x6606e5,null));};exports[_0xcac2('0x48')]=function(_0x5a2ad4,_0x5be40e){var _0x12374d={'raw':!![],'where':{'id':_0x5a2ad4['params']['id']}},_0xd8bb2a={};_0xd8bb2a[_0xcac2('0x32')]=_['keys'](db['CmCustomField'][_0xcac2('0x2f')]);_0xd8bb2a[_0xcac2('0x34')]=_[_0xcac2('0x35')](_0x5a2ad4[_0xcac2('0x34')]);_0xd8bb2a[_0xcac2('0x36')]=_[_0xcac2('0x37')](_0xd8bb2a[_0xcac2('0x32')],_0xd8bb2a[_0xcac2('0x34')]);_0x12374d[_0xcac2('0x38')]=_['intersection'](_0xd8bb2a[_0xcac2('0x32')],qs[_0xcac2('0x39')](_0x5a2ad4[_0xcac2('0x34')][_0xcac2('0x39')]));_0x12374d[_0xcac2('0x38')]=_0x12374d[_0xcac2('0x38')][_0xcac2('0x3a')]?_0x12374d[_0xcac2('0x38')]:_0xd8bb2a[_0xcac2('0x32')];if(_0x5a2ad4[_0xcac2('0x34')]['includeAll']){_0x12374d['include']=[{'all':!![]}];}_0x12374d=_[_0xcac2('0x42')]({},_0x12374d,_0x5a2ad4['options']);return db[_0xcac2('0x2e')][_0xcac2('0x49')](_0x12374d)[_0xcac2('0x46')](handleEntityNotFound(_0x5be40e,null))[_0xcac2('0x46')](respondWithResult(_0x5be40e,null))[_0xcac2('0x47')](handleError(_0x5be40e,null));};exports[_0xcac2('0x25')]=function(_0x641cf4,_0x5dda61){if(_0x641cf4['body']['id']){delete _0x641cf4[_0xcac2('0x4a')]['id'];}return db[_0xcac2('0x2e')]['find']({'where':{'id':_0x641cf4[_0xcac2('0x4b')]['id']}})[_0xcac2('0x46')](handleEntityNotFound(_0x5dda61,null))[_0xcac2('0x46')](saveUpdates(_0x641cf4[_0xcac2('0x4a')],null))[_0xcac2('0x46')](respondWithResult(_0x5dda61,null))[_0xcac2('0x47')](handleError(_0x5dda61,null));};exports['destroy']=function(_0xf51275,_0x32954a){return db['CmCustomField']['find']({'where':{'id':_0xf51275[_0xcac2('0x4b')]['id']}})[_0xcac2('0x46')](handleEntityNotFound(_0x32954a,null))[_0xcac2('0x46')](removeEntity(_0x32954a,null))['catch'](handleError(_0x32954a,null));};exports[_0xcac2('0x4c')]=function(_0x3fabd3,_0x40e0f7){var _0x338aad;return db[_0xcac2('0x4d')][_0xcac2('0x4e')](function(_0x419456){return db[_0xcac2('0x2e')][_0xcac2('0x4c')](_0x3fabd3['body'],{'transaction':_0x419456})['then'](function(_0x5ae978){_0x338aad=_0x5ae978;var _0xad95cf={'type':db[_0xcac2('0x4f')][_0xcac2('0x50')],'transaction':_0x419456};switch(_0x3fabd3[_0xcac2('0x4a')][_0xcac2('0x30')]){case _0xcac2('0x51'):_0xad95cf[_0xcac2('0x30')]=db[_0xcac2('0x4f')]['TEXT'];break;case _0xcac2('0x52'):_0xad95cf[_0xcac2('0x30')]=db[_0xcac2('0x4f')][_0xcac2('0x53')];break;case'switch':_0xad95cf[_0xcac2('0x30')]=db[_0xcac2('0x4f')][_0xcac2('0x54')];_0xad95cf[_0xcac2('0x55')]=![];break;default:}return db[_0xcac2('0x4d')][_0xcac2('0x56')][_0xcac2('0x57')]('cm_contacts',util[_0xcac2('0x58')]('cf_%d',_0x338aad['id']),_0xad95cf);})[_0xcac2('0x46')](function(){return _0x338aad;});})['then'](respondWithResult(_0x40e0f7,0xc9))[_0xcac2('0x47')](handleError(_0x40e0f7,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 09f3234..06cceb4 100644 --- a/server/api/cmCustomField/cmCustomField.model.js +++ b/server/api/cmCustomField/cmCustomField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f79=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields','util','../../config/logger'];(function(_0x361cba,_0x4bf205){var _0x39be6e=function(_0x59208d){while(--_0x59208d){_0x361cba['push'](_0x361cba['shift']());}};_0x39be6e(++_0x4bf205);}(_0x2f79,0x191));var _0x92f7=function(_0x4192c3,_0x34e587){_0x4192c3=_0x4192c3-0x0;var _0x196f77=_0x2f79[_0x4192c3];return _0x196f77;};'use strict';var _=require('lodash');var util=require(_0x92f7('0x0'));var logger=require(_0x92f7('0x1'))(_0x92f7('0x2'));var moment=require(_0x92f7('0x3'));var BPromise=require(_0x92f7('0x4'));var rp=require(_0x92f7('0x5'));var fs=require('fs');var path=require(_0x92f7('0x6'));var rimraf=require(_0x92f7('0x7'));var config=require(_0x92f7('0x8'));var attributes=require(_0x92f7('0x9'));module[_0x92f7('0xa')]=function(_0x429f74,_0x4a7e5e){return _0x429f74[_0x92f7('0xb')]('CmCustomField',attributes,{'tableName':_0x92f7('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x622f=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','cm_custom_fields','util'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x622f,0x149));var _0xf622=function(_0x23ddb6,_0x3d45fd){_0x23ddb6=_0x23ddb6-0x0;var _0x47f21b=_0x622f[_0x23ddb6];return _0x47f21b;};'use strict';var _=require('lodash');var util=require(_0xf622('0x0'));var logger=require(_0xf622('0x1'))(_0xf622('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf622('0x3'));var fs=require('fs');var path=require(_0xf622('0x4'));var rimraf=require(_0xf622('0x5'));var config=require(_0xf622('0x6'));var attributes=require('./cmCustomField.attributes');module[_0xf622('0x7')]=function(_0x50f795,_0x5d7994){return _0x50f795[_0xf622('0x8')]('CmCustomField',attributes,{'tableName':_0xf622('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 86a7ef4..43bb8f4 100644 --- a/server/api/cmCustomField/cmCustomField.rpc.js +++ b/server/api/cmCustomField/cmCustomField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3072=['request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x3072,0x109));var _0x2307=function(_0x759ad0,_0x4e6119){_0x759ad0=_0x759ad0-0x0;var _0x2bd21a=_0x3072[_0x759ad0];return _0x2bd21a;};'use strict';var _=require(_0x2307('0x0'));var util=require(_0x2307('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2307('0x2'));var fs=require('fs');var Redis=require(_0x2307('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2307('0x4'));var logger=require('../../config/logger')(_0x2307('0x5'));var config=require('../../config/environment');var jayson=require(_0x2307('0x6'));var client=jayson[_0x2307('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11d998,_0x1f6164,_0x57e663){return new BPromise(function(_0x3dd74a,_0x554395){return client[_0x2307('0x8')](_0x11d998,_0x57e663)[_0x2307('0x9')](function(_0x1e839d){logger[_0x2307('0xa')]('CmCustomField,\x20%s,\x20%s',_0x1f6164,'request\x20sent');logger[_0x2307('0xb')](_0x2307('0xc'),_0x1f6164,'request\x20sent',JSON[_0x2307('0xd')](_0x1e839d));if(_0x1e839d[_0x2307('0xe')]){if(_0x1e839d['error'][_0x2307('0xf')]===0x1f4){logger[_0x2307('0xe')](_0x2307('0x10'),_0x1f6164,_0x1e839d[_0x2307('0xe')][_0x2307('0x11')]);return _0x554395(_0x1e839d['error'][_0x2307('0x11')]);}logger[_0x2307('0xe')]('CmCustomField,\x20%s,\x20%s',_0x1f6164,_0x1e839d[_0x2307('0xe')][_0x2307('0x11')]);return _0x3dd74a(_0x1e839d[_0x2307('0xe')][_0x2307('0x11')]);}else{logger[_0x2307('0xa')](_0x2307('0x10'),_0x1f6164,_0x2307('0x12'));_0x3dd74a(_0x1e839d[_0x2307('0x13')]['message']);}})[_0x2307('0x14')](function(_0x3b3bab){logger[_0x2307('0xe')](_0x2307('0x10'),_0x1f6164,_0x3b3bab);_0x554395(_0x3b3bab);});});} \ No newline at end of file +var _0x7068=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','request','then','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CmCustomField,\x20%s,\x20%s'];(function(_0x36b796,_0x5426a1){var _0x5b4097=function(_0x53bfd5){while(--_0x53bfd5){_0x36b796['push'](_0x36b796['shift']());}};_0x5b4097(++_0x5426a1);}(_0x7068,0x1e2));var _0x8706=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x7068[_0x5eef05];return _0x56d4b8;};'use strict';var _=require(_0x8706('0x0'));var util=require(_0x8706('0x1'));var moment=require(_0x8706('0x2'));var BPromise=require(_0x8706('0x3'));var rs=require(_0x8706('0x4'));var fs=require('fs');var Redis=require(_0x8706('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8706('0x6'))('rpc');var config=require(_0x8706('0x7'));var jayson=require(_0x8706('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52fa0f,_0x4fdb7b,_0x2d6358){return new BPromise(function(_0x4a8a96,_0x5cc7f7){return client[_0x8706('0x9')](_0x52fa0f,_0x2d6358)[_0x8706('0xa')](function(_0x335b12){logger['info']('CmCustomField,\x20%s,\x20%s',_0x4fdb7b,'request\x20sent');logger[_0x8706('0xb')](_0x8706('0xc'),_0x4fdb7b,_0x8706('0xd'),JSON[_0x8706('0xe')](_0x335b12));if(_0x335b12['error']){if(_0x335b12['error']['code']===0x1f4){logger[_0x8706('0xf')]('CmCustomField,\x20%s,\x20%s',_0x4fdb7b,_0x335b12['error']['message']);return _0x5cc7f7(_0x335b12[_0x8706('0xf')][_0x8706('0x10')]);}logger[_0x8706('0xf')]('CmCustomField,\x20%s,\x20%s',_0x4fdb7b,_0x335b12[_0x8706('0xf')][_0x8706('0x10')]);return _0x4a8a96(_0x335b12[_0x8706('0xf')][_0x8706('0x10')]);}else{logger['info'](_0x8706('0x11'),_0x4fdb7b,_0x8706('0xd'));_0x4a8a96(_0x335b12[_0x8706('0x12')]['message']);}})[_0x8706('0x13')](function(_0x3b1dc1){logger[_0x8706('0xf')]('CmCustomField,\x20%s,\x20%s',_0x4fdb7b,_0x3b1dc1);_0x5cc7f7(_0x3b1dc1);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index c0b6497..2c9ee93 100644 --- a/server/api/cmCustomField/index.js +++ b/server/api/cmCustomField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83b3=['show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x83b3,0x147));var _0x383b=function(_0x58b279,_0x32d359){_0x58b279=_0x58b279-0x0;var _0x2bd76e=_0x83b3[_0x58b279];return _0x2bd76e;};'use strict';var multer=require(_0x383b('0x0'));var util=require(_0x383b('0x1'));var path=require(_0x383b('0x2'));var timeout=require(_0x383b('0x3'));var express=require(_0x383b('0x4'));var router=express[_0x383b('0x5')]();var fs_extra=require(_0x383b('0x6'));var auth=require(_0x383b('0x7'));var interaction=require(_0x383b('0x8'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x383b('0x9')]('/',auth[_0x383b('0xa')](),controller[_0x383b('0xb')]);router[_0x383b('0x9')](_0x383b('0xc'),auth[_0x383b('0xa')](),controller[_0x383b('0xd')]);router[_0x383b('0xe')]('/',auth[_0x383b('0xa')](),controller[_0x383b('0xf')]);router[_0x383b('0x10')]('/:id',auth[_0x383b('0xa')](),controller[_0x383b('0x11')]);router[_0x383b('0x12')](_0x383b('0xc'),auth[_0x383b('0xa')](),controller['destroy']);module[_0x383b('0x13')]=router; \ No newline at end of file +var _0x03db=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x483bab,_0x58d0da){var _0x20a53e=function(_0x5332e8){while(--_0x5332e8){_0x483bab['push'](_0x483bab['shift']());}};_0x20a53e(++_0x58d0da);}(_0x03db,0x156));var _0xb03d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x03db[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb03d('0x0'));var util=require(_0xb03d('0x1'));var path=require(_0xb03d('0x2'));var timeout=require(_0xb03d('0x3'));var express=require('express');var router=express[_0xb03d('0x4')]();var fs_extra=require(_0xb03d('0x5'));var auth=require(_0xb03d('0x6'));var interaction=require(_0xb03d('0x7'));var config=require(_0xb03d('0x8'));var controller=require('./cmCustomField.controller');router[_0xb03d('0x9')]('/',auth[_0xb03d('0xa')](),controller[_0xb03d('0xb')]);router['get'](_0xb03d('0xc'),auth['isAuthenticated'](),controller[_0xb03d('0xd')]);router[_0xb03d('0xe')]('/',auth[_0xb03d('0xa')](),controller[_0xb03d('0xf')]);router[_0xb03d('0x10')](_0xb03d('0xc'),auth[_0xb03d('0xa')](),controller['update']);router[_0xb03d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb03d('0x12')]);module[_0xb03d('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index a24264a..8590892 100644 --- a/server/api/cmHopper/cmHopper.attributes.js +++ b/server/api/cmHopper/cmHopper.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['UNSIGNED','contactListQueue','sequelize','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x16f77c,_0x5256b1){var _0x78986e=function(_0x10430){while(--_0x10430){_0x16f77c['push'](_0x16f77c['shift']());}};_0x78986e(++_0x5256b1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var moment=require('moment');var Sequelize=require(_0x65f6('0x0'));module['exports']={'phone':{'type':Sequelize[_0x65f6('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x65f6('0x3')],'defaultValue':moment()[_0x65f6('0x4')](_0x65f6('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x65f6('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x65f6('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x65f6('0x6')],'unique':_0x65f6('0x8')},'ListId':{'type':Sequelize[_0x65f6('0x6')],'unique':_0x65f6('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x65f6('0x8')},'CampaignId':{'type':Sequelize[_0x65f6('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x65f6('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x65f6('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x65f6('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x65f6('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x1eba=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED'];(function(_0x583e72,_0x560a6d){var _0x1d7b74=function(_0x553f0e){while(--_0x553f0e){_0x583e72['push'](_0x583e72['shift']());}};_0x1d7b74(++_0x560a6d);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x1eba[_0x37c22c];return _0x119d79;};'use strict';var moment=require(_0xa1eb('0x0'));var Sequelize=require(_0xa1eb('0x1'));module[_0xa1eb('0x2')]={'phone':{'type':Sequelize[_0xa1eb('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xa1eb('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xa1eb('0x5'))},'countbusyretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa1eb('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa1eb('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa1eb('0x7')]},'priority':{'type':Sequelize[_0xa1eb('0x6')](0x2)[_0xa1eb('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa1eb('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa1eb('0x6')],'unique':_0xa1eb('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xa1eb('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xa1eb('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xa1eb('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa1eb('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index b96ce96..5fbe725 100644 --- a/server/api/cmHopper/cmHopper.controller.js +++ b/server/api/cmHopper/cmHopper.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bb0=['order','sort','where','merge','type','filter','CmHopper','include','findAll','rows','show','options','find','catch','create','body','params','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','describe','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','CmList','List','getPreviewRecall','hopperId','LOCK','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty'];(function(_0x22e241,_0x3f0184){var _0x1ca712=function(_0x2d0897){while(--_0x2d0897){_0x22e241['push'](_0x22e241['shift']());}};_0x1ca712(++_0x3f0184);}(_0x2bb0,0xf3));var _0x02bb=function(_0x32ea9d,_0x2e3f8c){_0x32ea9d=_0x32ea9d-0x0;var _0x34d436=_0x2bb0[_0x32ea9d];return _0x34d436;};'use strict';var emlformat=require(_0x02bb('0x0'));var rimraf=require(_0x02bb('0x1'));var zipdir=require(_0x02bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x02bb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x02bb('0x4'));var util=require('util');var path=require(_0x02bb('0x5'));var sox=require(_0x02bb('0x6'));var csv=require(_0x02bb('0x7'));var ejs=require(_0x02bb('0x8'));var fs=require('fs');var fs_extra=require(_0x02bb('0x9'));var _=require(_0x02bb('0xa'));var squel=require(_0x02bb('0xb'));var crypto=require('crypto');var jsforce=require(_0x02bb('0xc'));var deskjs=require(_0x02bb('0xd'));var toCsv=require(_0x02bb('0x7'));var querystring=require('querystring');var Papa=require(_0x02bb('0xe'));var Redis=require('ioredis');var authService=require(_0x02bb('0xf'));var qs=require(_0x02bb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02bb('0x11'));var logger=require(_0x02bb('0x12'))(_0x02bb('0x13'));var utils=require('../../config/utils');var config=require(_0x02bb('0x14'));var shared=require('../../config/environment');var licenseUtil=require(_0x02bb('0x15'));var db=require(_0x02bb('0x16'))['db'];function respondWithStatusCode(_0x1079f9,_0x5c8728){_0x5c8728=_0x5c8728||0xcc;return function(_0x16330c){if(_0x16330c){return _0x1079f9[_0x02bb('0x17')](_0x5c8728);}return _0x1079f9[_0x02bb('0x18')](_0x5c8728)['end']();};}function respondWithResult(_0x2a03ac,_0x55ec40){_0x55ec40=_0x55ec40||0xc8;return function(_0x127a69){if(_0x127a69){return _0x2a03ac[_0x02bb('0x18')](_0x55ec40)[_0x02bb('0x19')](_0x127a69);}};}function respondWithFilteredResult(_0x126c1f,_0x264ef4){return function(_0x224e90){if(_0x224e90){var _0x5cf4cb=typeof _0x264ef4['offset']===_0x02bb('0x1a')&&typeof _0x264ef4[_0x02bb('0x1b')]===_0x02bb('0x1a');var _0xfedf69=_0x224e90[_0x02bb('0x1c')];var _0x20f569=_0x5cf4cb?0x0:_0x264ef4['offset'];var _0x362b16=_0x5cf4cb?_0x224e90['count']:_0x264ef4[_0x02bb('0x1d')]+_0x264ef4[_0x02bb('0x1b')];var _0x1b607f;if(_0x362b16>=_0xfedf69){_0x362b16=_0xfedf69;_0x1b607f=0xc8;}else{_0x1b607f=0xce;}_0x126c1f['status'](_0x1b607f);return _0x126c1f[_0x02bb('0x1e')](_0x02bb('0x1f'),_0x20f569+'-'+_0x362b16+'/'+_0xfedf69)[_0x02bb('0x19')](_0x224e90);}return null;};}function patchUpdates(_0x47b976){return function(_0x1410b8){try{jsonpatch[_0x02bb('0x20')](_0x1410b8,_0x47b976,!![]);}catch(_0x597adf){return BPromise[_0x02bb('0x21')](_0x597adf);}return _0x1410b8['save']();};}function saveUpdates(_0x1195f3,_0x4a91a4){return function(_0x21e550){if(_0x21e550){return _0x21e550[_0x02bb('0x22')](_0x1195f3)[_0x02bb('0x23')](function(_0x35d2ec){return _0x35d2ec;});}return null;};}function removeEntity(_0x144731,_0x54ac46){return function(_0x58467f){if(_0x58467f){return _0x58467f[_0x02bb('0x24')]()['then'](function(){_0x144731[_0x02bb('0x18')](0xcc)[_0x02bb('0x25')]();});}};}function handleEntityNotFound(_0x8ae103,_0x4d3dad){return function(_0x20b55e){if(!_0x20b55e){_0x8ae103[_0x02bb('0x17')](0x194);}return _0x20b55e;};}function handleError(_0x5caeb5,_0x3c483f){_0x3c483f=_0x3c483f||0x1f4;return function(_0x332992){logger[_0x02bb('0x26')](_0x332992[_0x02bb('0x27')]);if(_0x332992[_0x02bb('0x28')]){delete _0x332992[_0x02bb('0x28')];}_0x5caeb5['status'](_0x3c483f)[_0x02bb('0x29')](_0x332992);};}exports['index']=function(_0x1fffab,_0x1d7817){var _0x426c90={},_0x4ae755={},_0x548f1b={'count':0x0,'rows':[]};var _0x3cd365=_[_0x02bb('0x2a')](db['CmHopper'][_0x02bb('0x2b')],function(_0xdd93c3){return{'name':_0xdd93c3[_0x02bb('0x2c')],'type':_0xdd93c3['type']['key']};});_0x4ae755[_0x02bb('0x2d')]=_['map'](_0x3cd365,'name');_0x4ae755[_0x02bb('0x2e')]=_[_0x02bb('0x2f')](_0x1fffab['query']);_0x4ae755[_0x02bb('0x30')]=_[_0x02bb('0x31')](_0x4ae755[_0x02bb('0x2d')],_0x4ae755['query']);_0x4ae755[_0x02bb('0x30')]=_[_0x02bb('0x32')](_0x4ae755[_0x02bb('0x30')],[_0x02bb('0x33'),_0x02bb('0x34'),_0x02bb('0x35'),_0x02bb('0x36'),_0x02bb('0x37'),_0x02bb('0x38'),_0x02bb('0x39'),'$eq',_0x02bb('0x3a'),_0x02bb('0x3b'),'$notBetween',_0x02bb('0x3c'),_0x02bb('0x3d'),_0x02bb('0x3e'),_0x02bb('0x3f'),'$iLike',_0x02bb('0x40'),'$like',_0x02bb('0x41'),_0x02bb('0x42'),_0x02bb('0x43'),_0x02bb('0x44')]);_0x426c90[_0x02bb('0x45')]=_[_0x02bb('0x31')](_0x4ae755[_0x02bb('0x2d')],qs['fields'](_0x1fffab[_0x02bb('0x2e')][_0x02bb('0x46')]));_0x426c90['attributes']=_0x426c90[_0x02bb('0x45')][_0x02bb('0x47')]?_0x426c90[_0x02bb('0x45')]:_0x4ae755[_0x02bb('0x2d')];if(!_0x1fffab[_0x02bb('0x2e')][_0x02bb('0x48')]('nolimit')){_0x426c90[_0x02bb('0x1b')]=qs['limit'](_0x1fffab[_0x02bb('0x2e')][_0x02bb('0x1b')]);_0x426c90[_0x02bb('0x1d')]=qs[_0x02bb('0x1d')](_0x1fffab[_0x02bb('0x2e')][_0x02bb('0x1d')]);}_0x426c90[_0x02bb('0x49')]=qs[_0x02bb('0x4a')](_0x1fffab[_0x02bb('0x2e')]['sort']);_0x426c90[_0x02bb('0x4b')]=qs[_0x02bb('0x30')](_['pick'](_0x1fffab[_0x02bb('0x2e')],_0x4ae755[_0x02bb('0x30')]),_0x3cd365);if(_0x1fffab['query']['filter']){_0x426c90[_0x02bb('0x4b')]=_[_0x02bb('0x4c')](_0x426c90[_0x02bb('0x4b')],{'$or':_[_0x02bb('0x2a')](_0x3cd365,function(_0x7b5399){if(_0x7b5399[_0x02bb('0x4d')]!=='VIRTUAL'){var _0x1a6c9a={};_0x1a6c9a[_0x7b5399['name']]={'$like':'%'+_0x1fffab['query'][_0x02bb('0x4e')]+'%'};return _0x1a6c9a;}})});}_0x426c90=_[_0x02bb('0x4c')]({},_0x426c90,_0x1fffab['options']);var _0x38e17c={'where':_0x426c90['where']};return db[_0x02bb('0x4f')][_0x02bb('0x1c')](_0x38e17c)[_0x02bb('0x23')](function(_0x4a0907){_0x548f1b['count']=_0x4a0907;if(_0x1fffab['query']['includeAll']){_0x426c90[_0x02bb('0x50')]=[{'all':!![]}];}return db[_0x02bb('0x4f')][_0x02bb('0x51')](_0x426c90);})['then'](function(_0x134482){_0x548f1b[_0x02bb('0x52')]=_0x134482;return _0x548f1b;})[_0x02bb('0x23')](respondWithFilteredResult(_0x1d7817,_0x426c90))['catch'](handleError(_0x1d7817,null));};exports[_0x02bb('0x53')]=function(_0x40b76c,_0x23b8d6){var _0x43ede8={'raw':!![],'where':{'id':_0x40b76c['params']['id']}},_0xfb1754={};_0xfb1754['model']=_[_0x02bb('0x2f')](db['CmHopper']['rawAttributes']);_0xfb1754[_0x02bb('0x2e')]=_[_0x02bb('0x2f')](_0x40b76c['query']);_0xfb1754[_0x02bb('0x30')]=_[_0x02bb('0x31')](_0xfb1754[_0x02bb('0x2d')],_0xfb1754['query']);_0x43ede8[_0x02bb('0x45')]=_[_0x02bb('0x31')](_0xfb1754[_0x02bb('0x2d')],qs[_0x02bb('0x46')](_0x40b76c[_0x02bb('0x2e')][_0x02bb('0x46')]));_0x43ede8[_0x02bb('0x45')]=_0x43ede8['attributes'][_0x02bb('0x47')]?_0x43ede8[_0x02bb('0x45')]:_0xfb1754[_0x02bb('0x2d')];if(_0x40b76c[_0x02bb('0x2e')]['includeAll']){_0x43ede8[_0x02bb('0x50')]=[{'all':!![]}];}_0x43ede8=_[_0x02bb('0x4c')]({},_0x43ede8,_0x40b76c[_0x02bb('0x54')]);return db[_0x02bb('0x4f')][_0x02bb('0x55')](_0x43ede8)[_0x02bb('0x23')](handleEntityNotFound(_0x23b8d6,null))[_0x02bb('0x23')](respondWithResult(_0x23b8d6,null))[_0x02bb('0x56')](handleError(_0x23b8d6,null));};exports[_0x02bb('0x57')]=function(_0x292d38,_0x188de0){return db['CmHopper'][_0x02bb('0x57')](_0x292d38['body'],{})[_0x02bb('0x23')](respondWithResult(_0x188de0,0xc9))[_0x02bb('0x56')](handleError(_0x188de0,null));};exports[_0x02bb('0x22')]=function(_0x121174,_0x13c357){if(_0x121174[_0x02bb('0x58')]['id']){delete _0x121174[_0x02bb('0x58')]['id'];}return db[_0x02bb('0x4f')]['find']({'where':{'id':_0x121174[_0x02bb('0x59')]['id']}})[_0x02bb('0x23')](handleEntityNotFound(_0x13c357,null))[_0x02bb('0x23')](saveUpdates(_0x121174[_0x02bb('0x58')],null))[_0x02bb('0x23')](respondWithResult(_0x13c357,null))[_0x02bb('0x56')](handleError(_0x13c357,null));};exports['describe']=function(_0x46c1ef,_0x22ad38){return db[_0x02bb('0x4f')]['describe']()[_0x02bb('0x23')](respondWithResult(_0x22ad38,null))['catch'](handleError(_0x22ad38,null));};exports[_0x02bb('0x24')]=function(_0x3ef720,_0x42dd19){var _0x17ecc8;return db[_0x02bb('0x4f')][_0x02bb('0x55')]({'where':{'id':_0x3ef720[_0x02bb('0x59')]['id']}})[_0x02bb('0x23')](handleEntityNotFound(_0x42dd19,null))[_0x02bb('0x23')](function(_0x414c05){if(_0x414c05){return _0x414c05['destroy']()[_0x02bb('0x23')](function(_0x1f3eb1){return _0x1f3eb1;});}})[_0x02bb('0x23')](function(_0x59ddf5){_0x17ecc8=_0x59ddf5;if(_0x59ddf5){if(_0x59ddf5[_0x02bb('0x5a')]||_0x59ddf5[_0x02bb('0x5b')]){return db[_0x59ddf5[_0x02bb('0x5a')]?_0x02bb('0x5c'):_0x02bb('0x5d')]['find']({'where':{'id':_0x59ddf5[_0x02bb('0x5a')]?_0x59ddf5[_0x02bb('0x5a')]:_0x59ddf5[_0x02bb('0x5b')]},'attributes':['id',_0x02bb('0x28')],'raw':!![]});}}})[_0x02bb('0x23')](function(_0x11de02){var _0x4341d8={};if(_0x11de02){_[_0x02bb('0x4c')](_0x4341d8,_[_0x02bb('0x5e')](_0x17ecc8[_0x02bb('0x5f')],[_0x02bb('0x60'),_0x02bb('0x61'),'id']));_0x4341d8['state']=0x15;_0x4341d8[_0x02bb('0x62')]=_0x02bb('0x63');_0x4341d8['campaign']=_0x11de02[_0x02bb('0x28')];_0x4341d8[_0x02bb('0x64')]=_0x3ef720[_0x02bb('0x65')][_0x02bb('0x28')];_0x4341d8[_0x02bb('0x66')]=_0x3ef720[_0x02bb('0x65')]['id'];_0x4341d8['deleted']=!![];_0x4341d8[_0x02bb('0x67')]=moment()[_0x02bb('0x68')](_0x02bb('0x69'));_0x4341d8[_0x02bb('0x6a')]=_0x17ecc8[_0x02bb('0x6b')];_0x4341d8[_0x02bb('0x6c')]=_0x17ecc8[_0x02bb('0x5a')]?_0x02bb('0x6d'):'ivr';return db[_0x02bb('0x6e')][_0x02bb('0x55')]({'where':{'id':_0x4341d8['ContactId']},'attributes':[_0x02bb('0x6f'),_0x02bb('0x70')]})[_0x02bb('0x23')](function(_0x3892e2){if(!_[_0x02bb('0x71')](_0x42dd19)&&!_[_0x02bb('0x71')](_0x3892e2[_0x02bb('0x6f')])){_0x4341d8[_0x02bb('0x72')]=_0x3892e2[_0x02bb('0x6f')];if(!_[_0x02bb('0x71')](_0x3892e2[_0x02bb('0x70')])){_0x4341d8[_0x02bb('0x72')]+='\x20'+_0x3892e2[_0x02bb('0x70')];}}})[_0x02bb('0x73')](function(){return db[_0x02bb('0x74')][_0x02bb('0x57')](_0x4341d8);});}})['then'](function(){return _0x42dd19[_0x02bb('0x18')](0xcc)[_0x02bb('0x25')]();})[_0x02bb('0x56')](handleError(_0x42dd19,null));};exports[_0x02bb('0x75')]=function(_0x2d1e23,_0x1d29cd,_0x13cdf6){var _0x483f94=[];return db['CmContact'][_0x02bb('0x76')]()[_0x02bb('0x23')](function(_0xd577bd){_0x483f94=_[_0x02bb('0x2f')](_0xd577bd);return _0x2d1e23[_0x02bb('0x65')][_0x02bb('0x77')]({'where':{'type':_0x02bb('0x78'),'dialActive':!![],'dialMethod':_0x02bb('0x79')},'attributes':['id',_0x02bb('0x7a'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x02bb('0x23')](function(_0x33251d){if(_0x33251d&&_0x33251d['length']){return db[_0x02bb('0x7b')][_0x02bb('0x7c')](function(_0x52bcfc){var _0x559737={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x33251d,'id')},'$or':[{'UserId':null},{'UserId':_0x2d1e23[_0x02bb('0x65')]['id']}]};var _0x1d7095={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x33251d)[_0x02bb('0x4e')]([_0x02bb('0x7d'),0x0])['map']('id')[_0x02bb('0x7e')]()},'$or':[{'UserId':null},{'UserId':_0x2d1e23[_0x02bb('0x65')]['id']}]};var _0x255927={'$or':[_0x559737,_0x1d7095]};var _0x45ede0=[];if(_0x2d1e23['body'][_0x02bb('0x7f')]&&_0x2d1e23['body']['direction']===_0x02bb('0x80')){if(!_[_0x02bb('0x81')](_0x2d1e23['body'][_0x02bb('0x82')])){_0x255927['id']={'$in':_0x2d1e23['body'][_0x02bb('0x82')]};}_0x45ede0=[[_0x02bb('0x83'),_0x02bb('0x84')],[_0x02bb('0x85'),_0x33251d[0x0][_0x02bb('0x7a')]===_0x02bb('0x84')?_0x02bb('0x86'):_0x02bb('0x84')],db[_0x02bb('0x7b')][_0x02bb('0x87')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x02bb('0x86')]];}else{if(!_[_0x02bb('0x81')](_0x2d1e23[_0x02bb('0x58')][_0x02bb('0x82')])){_0x255927['id']={'$notIn':_0x2d1e23[_0x02bb('0x58')]['hopperIds']};}_0x45ede0=[['priority',_0x02bb('0x86')],[_0x02bb('0x85'),_0x33251d[0x0]['dialOrderByScheduledAt']],db[_0x02bb('0x7b')][_0x02bb('0x87')](_0x02bb('0x88')),['id',_0x02bb('0x84')]];}return db[_0x02bb('0x4f')][_0x02bb('0x89')]({'attributes':['id',_0x02bb('0x8a'),'recallme'],'where':_0x255927,'order':_0x45ede0,'transaction':_0x52bcfc,'lock':_0x52bcfc['LOCK'][_0x02bb('0x8b')],'include':[{'model':db[_0x02bb('0x6e')],'as':_0x02bb('0x8c'),'attributes':_0x483f94,'include':[{'model':db[_0x02bb('0x8d')],'as':_0x02bb('0x8e'),'attributes':['id',_0x02bb('0x28')]}]},{'model':db[_0x02bb('0x8f')],'as':_0x02bb('0x90'),'attributes':['id',_0x02bb('0x28')]},{'model':db[_0x02bb('0x5c')],'as':'Queue','attributes':['id',_0x02bb('0x28'),'dialActive']}]})[_0x02bb('0x23')](function(_0x33464f){if(_0x33464f){return _0x33464f[_0x02bb('0x22')]({'UserId':_0x2d1e23[_0x02bb('0x65')]['id']},{'transaction':_0x52bcfc});}});});}})[_0x02bb('0x23')](handleEntityNotFound(_0x1d29cd,null))[_0x02bb('0x23')](respondWithResult(_0x1d29cd,null))[_0x02bb('0x56')](handleError(_0x1d29cd,null));};exports[_0x02bb('0x91')]=function(_0x4379b9,_0x435030,_0x161e70){var _0x1fa3e4=[];return db['CmContact'][_0x02bb('0x76')]()['then'](function(_0x50650b){_0x1fa3e4=_[_0x02bb('0x2f')](_0x50650b);return _0x4379b9[_0x02bb('0x65')][_0x02bb('0x77')]({'where':{'type':_0x02bb('0x78'),'dialActive':!![],'dialMethod':_0x02bb('0x79')},'attributes':['id',_0x02bb('0x7a'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x02bb('0x23')](function(_0x4c6b1e){if(_0x4c6b1e&&_0x4c6b1e['length']){return db[_0x02bb('0x7b')][_0x02bb('0x7c')](function(_0x15ea6e){var _0x1f7fe1={'active':![],'recallme':!![],'id':_0x4379b9[_0x02bb('0x58')][_0x02bb('0x92')]};return db[_0x02bb('0x4f')][_0x02bb('0x89')]({'attributes':['id',_0x02bb('0x8a'),'recallme'],'where':_0x1f7fe1,'transaction':_0x15ea6e,'lock':_0x15ea6e[_0x02bb('0x93')][_0x02bb('0x8b')],'include':[{'model':db[_0x02bb('0x6e')],'as':'Contact','attributes':_0x1fa3e4,'include':[{'model':db[_0x02bb('0x8d')],'as':_0x02bb('0x8e'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x02bb('0x90'),'attributes':['id',_0x02bb('0x28')]},{'model':db[_0x02bb('0x5c')],'as':_0x02bb('0x94'),'attributes':['id',_0x02bb('0x28'),_0x02bb('0x95')]}]})[_0x02bb('0x23')](function(_0x26de07){if(_0x26de07){return _0x26de07[_0x02bb('0x22')]({'UserId':_0x4379b9['user']['id']},{'transaction':_0x15ea6e});}});});}})[_0x02bb('0x23')](handleEntityNotFound(_0x435030,null))[_0x02bb('0x23')](respondWithResult(_0x435030,null))['catch'](handleError(_0x435030,null));};exports[_0x02bb('0x96')]=function(_0x281e09,_0x2190ad,_0x261b6f){return _0x281e09[_0x02bb('0x65')][_0x02bb('0x77')]({'where':{'type':_0x02bb('0x78'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x02bb('0x23')](function(_0x448a7a){if(_0x448a7a&&_0x448a7a[_0x02bb('0x47')]){return db['CmHopper'][_0x02bb('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x02bb('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x448a7a,'id')},'$or':[{'UserId':null},{'UserId':_0x281e09[_0x02bb('0x65')]['id']}]}});}return 0x0;})[_0x02bb('0x23')](function(_0x53520f){if(!_[_0x02bb('0x71')](_0x53520f)&&_[_0x02bb('0x97')](_0x53520f)){return _0x2190ad[_0x02bb('0x18')](0xc8)[_0x02bb('0x19')]({'contacts':_0x53520f});}else{logger[_0x02bb('0x26')](_0x02bb('0x98'),_0x02bb('0x96'),0x194,_0x02bb('0x99'));_0x2190ad[_0x02bb('0x17')](0x194);}})[_0x02bb('0x56')](handleError(_0x2190ad,null));};exports['getTimezones']=function(_0x9d1c37,_0x225f46,_0x1d1b96){var _0x165371=shared[_0x02bb('0x9a')];var _0x34a269=[];_['map'](_0x165371,function(_0x178c48){_0x34a269[_0x02bb('0x9b')]({'id':_0x178c48['name'],'name':_0x178c48[_0x02bb('0x28')],'utcOffset':_0x178c48[_0x02bb('0x9c')]});});return _0x225f46[_0x02bb('0x18')](0xc8)[_0x02bb('0x19')]({'tz':_0x34a269});};exports[_0x02bb('0x9d')]=function(_0x4aec84,_0x379b1a,_0x12b373){var _0x286d69=shared[_0x02bb('0x9a')];var _0x430c2a={};if(!_[_0x02bb('0x71')](_0x286d69[_0x4aec84[_0x02bb('0x58')]['id']]))_0x430c2a=_0x286d69[_0x4aec84[_0x02bb('0x58')]['id']];return _0x379b1a['status'](0xc8)[_0x02bb('0x19')](_0x430c2a);}; \ No newline at end of file +var _0xb332=['deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','CmList','Queue','dialActive','getPreviewRecall','getVoiceQueues','outbound','hopperId','findOne','recallme','Company','List','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','eml-format','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map','CmHopper','fieldName','type','key','model','keys','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$contains','$contained','$any','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','include','find','create','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','statedesc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb332,0xd9));var _0x2b33=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0xb332[_0xce9195];return _0x530fe6;};'use strict';var emlformat=require(_0x2b33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b33('0x1'));var jsonpatch=require(_0x2b33('0x2'));var rp=require('request-promise');var moment=require(_0x2b33('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b33('0x4'));var util=require('util');var path=require(_0x2b33('0x5'));var sox=require('sox');var csv=require(_0x2b33('0x6'));var ejs=require(_0x2b33('0x7'));var fs=require('fs');var fs_extra=require(_0x2b33('0x8'));var _=require(_0x2b33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b33('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b33('0x6'));var querystring=require(_0x2b33('0xb'));var Papa=require(_0x2b33('0xc'));var Redis=require(_0x2b33('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2b33('0xe'));var as=require(_0x2b33('0xf'));var hardwareService=require(_0x2b33('0x10'));var logger=require(_0x2b33('0x11'))(_0x2b33('0x12'));var utils=require(_0x2b33('0x13'));var config=require(_0x2b33('0x14'));var shared=require(_0x2b33('0x14'));var licenseUtil=require(_0x2b33('0x15'));var db=require(_0x2b33('0x16'))['db'];function respondWithStatusCode(_0xca2248,_0x4df129){_0x4df129=_0x4df129||0xcc;return function(_0x183773){if(_0x183773){return _0xca2248[_0x2b33('0x17')](_0x4df129);}return _0xca2248[_0x2b33('0x18')](_0x4df129)['end']();};}function respondWithResult(_0x173c75,_0x4d39db){_0x4d39db=_0x4d39db||0xc8;return function(_0x3fcf4e){if(_0x3fcf4e){return _0x173c75[_0x2b33('0x18')](_0x4d39db)[_0x2b33('0x19')](_0x3fcf4e);}};}function respondWithFilteredResult(_0x57aea7,_0x52693f){return function(_0x1d8e75){if(_0x1d8e75){var _0x1d50d0=typeof _0x52693f[_0x2b33('0x1a')]===_0x2b33('0x1b')&&typeof _0x52693f[_0x2b33('0x1c')]==='undefined';var _0x554ab3=_0x1d8e75['count'];var _0x4041bd=_0x1d50d0?0x0:_0x52693f['offset'];var _0x543d52=_0x1d50d0?_0x1d8e75[_0x2b33('0x1d')]:_0x52693f[_0x2b33('0x1a')]+_0x52693f[_0x2b33('0x1c')];var _0x539c5f;if(_0x543d52>=_0x554ab3){_0x543d52=_0x554ab3;_0x539c5f=0xc8;}else{_0x539c5f=0xce;}_0x57aea7[_0x2b33('0x18')](_0x539c5f);return _0x57aea7['set'](_0x2b33('0x1e'),_0x4041bd+'-'+_0x543d52+'/'+_0x554ab3)[_0x2b33('0x19')](_0x1d8e75);}return null;};}function patchUpdates(_0x8c8dc2){return function(_0x2998dd){try{jsonpatch[_0x2b33('0x1f')](_0x2998dd,_0x8c8dc2,!![]);}catch(_0x6d20b){return BPromise[_0x2b33('0x20')](_0x6d20b);}return _0x2998dd['save']();};}function saveUpdates(_0x23024c,_0x1d9c98){return function(_0x100c8d){if(_0x100c8d){return _0x100c8d[_0x2b33('0x21')](_0x23024c)[_0x2b33('0x22')](function(_0x1c27d4){return _0x1c27d4;});}return null;};}function removeEntity(_0x27f1b8,_0x2605e6){return function(_0x5e1cba){if(_0x5e1cba){return _0x5e1cba[_0x2b33('0x23')]()[_0x2b33('0x22')](function(){_0x27f1b8[_0x2b33('0x18')](0xcc)[_0x2b33('0x24')]();});}};}function handleEntityNotFound(_0x4df3d4,_0x2ec9db){return function(_0x530098){if(!_0x530098){_0x4df3d4[_0x2b33('0x17')](0x194);}return _0x530098;};}function handleError(_0x483cf4,_0x2e74d0){_0x2e74d0=_0x2e74d0||0x1f4;return function(_0x341e0e){logger['error'](_0x341e0e[_0x2b33('0x25')]);if(_0x341e0e['name']){delete _0x341e0e[_0x2b33('0x26')];}_0x483cf4['status'](_0x2e74d0)[_0x2b33('0x27')](_0x341e0e);};}exports[_0x2b33('0x28')]=function(_0x9482a,_0x268c1d){var _0xaa6643={},_0x312d4d={},_0x2be034={'count':0x0,'rows':[]};var _0x1fadc5=_[_0x2b33('0x29')](db[_0x2b33('0x2a')]['rawAttributes'],function(_0x5b6527){return{'name':_0x5b6527[_0x2b33('0x2b')],'type':_0x5b6527[_0x2b33('0x2c')][_0x2b33('0x2d')]};});_0x312d4d[_0x2b33('0x2e')]=_[_0x2b33('0x29')](_0x1fadc5,'name');_0x312d4d['query']=_[_0x2b33('0x2f')](_0x9482a[_0x2b33('0x30')]);_0x312d4d[_0x2b33('0x31')]=_[_0x2b33('0x32')](_0x312d4d[_0x2b33('0x2e')],_0x312d4d[_0x2b33('0x30')]);_0x312d4d['filters']=_[_0x2b33('0x33')](_0x312d4d['filters'],[_0x2b33('0x34'),_0x2b33('0x35'),_0x2b33('0x36'),_0x2b33('0x37'),_0x2b33('0x38'),_0x2b33('0x39'),_0x2b33('0x3a'),_0x2b33('0x3b'),_0x2b33('0x3c'),_0x2b33('0x3d'),_0x2b33('0x3e'),_0x2b33('0x3f'),_0x2b33('0x40'),_0x2b33('0x41'),_0x2b33('0x42'),_0x2b33('0x43'),'$notILike','$like','$overlap',_0x2b33('0x44'),_0x2b33('0x45'),_0x2b33('0x46')]);_0xaa6643[_0x2b33('0x47')]=_[_0x2b33('0x32')](_0x312d4d['model'],qs['fields'](_0x9482a[_0x2b33('0x30')]['fields']));_0xaa6643[_0x2b33('0x47')]=_0xaa6643[_0x2b33('0x47')][_0x2b33('0x48')]?_0xaa6643[_0x2b33('0x47')]:_0x312d4d[_0x2b33('0x2e')];if(!_0x9482a[_0x2b33('0x30')][_0x2b33('0x49')](_0x2b33('0x4a'))){_0xaa6643[_0x2b33('0x1c')]=qs[_0x2b33('0x1c')](_0x9482a['query'][_0x2b33('0x1c')]);_0xaa6643[_0x2b33('0x1a')]=qs[_0x2b33('0x1a')](_0x9482a['query']['offset']);}_0xaa6643[_0x2b33('0x4b')]=qs['sort'](_0x9482a[_0x2b33('0x30')][_0x2b33('0x4c')]);_0xaa6643['where']=qs[_0x2b33('0x31')](_[_0x2b33('0x4d')](_0x9482a['query'],_0x312d4d[_0x2b33('0x31')]),_0x1fadc5);if(_0x9482a[_0x2b33('0x30')]['filter']){_0xaa6643[_0x2b33('0x4e')]=_[_0x2b33('0x4f')](_0xaa6643[_0x2b33('0x4e')],{'$or':_['map'](_0x1fadc5,function(_0x1bb73d){if(_0x1bb73d[_0x2b33('0x2c')]!==_0x2b33('0x50')){var _0x22f321={};_0x22f321[_0x1bb73d[_0x2b33('0x26')]]={'$like':'%'+_0x9482a['query'][_0x2b33('0x51')]+'%'};return _0x22f321;}})});}_0xaa6643=_[_0x2b33('0x4f')]({},_0xaa6643,_0x9482a[_0x2b33('0x52')]);var _0x5ad3b2={'where':_0xaa6643[_0x2b33('0x4e')]};return db[_0x2b33('0x2a')][_0x2b33('0x1d')](_0x5ad3b2)[_0x2b33('0x22')](function(_0x485f52){_0x2be034[_0x2b33('0x1d')]=_0x485f52;if(_0x9482a[_0x2b33('0x30')]['includeAll']){_0xaa6643['include']=[{'all':!![]}];}return db['CmHopper'][_0x2b33('0x53')](_0xaa6643);})['then'](function(_0x35df3c){_0x2be034[_0x2b33('0x54')]=_0x35df3c;return _0x2be034;})[_0x2b33('0x22')](respondWithFilteredResult(_0x268c1d,_0xaa6643))[_0x2b33('0x55')](handleError(_0x268c1d,null));};exports[_0x2b33('0x56')]=function(_0xd68bbd,_0x361b71){var _0x13bb23={'raw':!![],'where':{'id':_0xd68bbd[_0x2b33('0x57')]['id']}},_0x56224a={};_0x56224a[_0x2b33('0x2e')]=_[_0x2b33('0x2f')](db[_0x2b33('0x2a')][_0x2b33('0x58')]);_0x56224a[_0x2b33('0x30')]=_['keys'](_0xd68bbd['query']);_0x56224a['filters']=_['intersection'](_0x56224a[_0x2b33('0x2e')],_0x56224a['query']);_0x13bb23[_0x2b33('0x47')]=_['intersection'](_0x56224a['model'],qs[_0x2b33('0x59')](_0xd68bbd[_0x2b33('0x30')][_0x2b33('0x59')]));_0x13bb23['attributes']=_0x13bb23[_0x2b33('0x47')]['length']?_0x13bb23[_0x2b33('0x47')]:_0x56224a[_0x2b33('0x2e')];if(_0xd68bbd[_0x2b33('0x30')][_0x2b33('0x5a')]){_0x13bb23[_0x2b33('0x5b')]=[{'all':!![]}];}_0x13bb23=_[_0x2b33('0x4f')]({},_0x13bb23,_0xd68bbd['options']);return db[_0x2b33('0x2a')][_0x2b33('0x5c')](_0x13bb23)[_0x2b33('0x22')](handleEntityNotFound(_0x361b71,null))['then'](respondWithResult(_0x361b71,null))[_0x2b33('0x55')](handleError(_0x361b71,null));};exports[_0x2b33('0x5d')]=function(_0x434f0f,_0x569ba6){return db[_0x2b33('0x2a')]['create'](_0x434f0f['body'],{})[_0x2b33('0x22')](respondWithResult(_0x569ba6,0xc9))[_0x2b33('0x55')](handleError(_0x569ba6,null));};exports[_0x2b33('0x21')]=function(_0xae5ffe,_0x307370){if(_0xae5ffe[_0x2b33('0x5e')]['id']){delete _0xae5ffe[_0x2b33('0x5e')]['id'];}return db[_0x2b33('0x2a')]['find']({'where':{'id':_0xae5ffe[_0x2b33('0x57')]['id']}})[_0x2b33('0x22')](handleEntityNotFound(_0x307370,null))['then'](saveUpdates(_0xae5ffe[_0x2b33('0x5e')],null))[_0x2b33('0x22')](respondWithResult(_0x307370,null))['catch'](handleError(_0x307370,null));};exports[_0x2b33('0x5f')]=function(_0x433584,_0x20f473){return db[_0x2b33('0x2a')]['describe']()[_0x2b33('0x22')](respondWithResult(_0x20f473,null))[_0x2b33('0x55')](handleError(_0x20f473,null));};exports['destroy']=function(_0x150035,_0x162d13){var _0x1ce316;return db[_0x2b33('0x2a')][_0x2b33('0x5c')]({'where':{'id':_0x150035[_0x2b33('0x57')]['id']}})[_0x2b33('0x22')](handleEntityNotFound(_0x162d13,null))['then'](function(_0x5aa3c0){if(_0x5aa3c0){return _0x5aa3c0[_0x2b33('0x23')]()[_0x2b33('0x22')](function(_0x5c5f00){return _0x5c5f00;});}})[_0x2b33('0x22')](function(_0x569f2d){_0x1ce316=_0x569f2d;if(_0x569f2d){if(_0x569f2d[_0x2b33('0x60')]||_0x569f2d['CampaignId']){return db[_0x569f2d[_0x2b33('0x60')]?_0x2b33('0x61'):_0x2b33('0x62')][_0x2b33('0x5c')]({'where':{'id':_0x569f2d[_0x2b33('0x60')]?_0x569f2d[_0x2b33('0x60')]:_0x569f2d[_0x2b33('0x63')]},'attributes':['id',_0x2b33('0x26')],'raw':!![]});}}})['then'](function(_0x59e470){var _0x1e7b13={};if(_0x59e470){_[_0x2b33('0x4f')](_0x1e7b13,_[_0x2b33('0x64')](_0x1ce316[_0x2b33('0x65')],[_0x2b33('0x66'),_0x2b33('0x67'),'id']));_0x1e7b13['state']=0x15;_0x1e7b13[_0x2b33('0x68')]=_0x2b33('0x69');_0x1e7b13[_0x2b33('0x6a')]=_0x59e470[_0x2b33('0x26')];_0x1e7b13[_0x2b33('0x6b')]=_0x150035[_0x2b33('0x6c')]['name'];_0x1e7b13[_0x2b33('0x6d')]=_0x150035[_0x2b33('0x6c')]['id'];_0x1e7b13[_0x2b33('0x69')]=!![];_0x1e7b13[_0x2b33('0x6e')]=moment()[_0x2b33('0x6f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e7b13[_0x2b33('0x70')]=_0x1ce316[_0x2b33('0x71')];_0x1e7b13[_0x2b33('0x72')]=_0x1ce316[_0x2b33('0x60')]?'queue':_0x2b33('0x73');return db['CmContact'][_0x2b33('0x5c')]({'where':{'id':_0x1e7b13[_0x2b33('0x74')]},'attributes':[_0x2b33('0x75'),_0x2b33('0x76')]})[_0x2b33('0x22')](function(_0x321940){if(!_[_0x2b33('0x77')](_0x162d13)&&!_[_0x2b33('0x77')](_0x321940['firstName'])){_0x1e7b13[_0x2b33('0x78')]=_0x321940[_0x2b33('0x75')];if(!_[_0x2b33('0x77')](_0x321940[_0x2b33('0x76')])){_0x1e7b13[_0x2b33('0x78')]+='\x20'+_0x321940[_0x2b33('0x76')];}}})[_0x2b33('0x79')](function(){return db[_0x2b33('0x7a')][_0x2b33('0x5d')](_0x1e7b13);});}})[_0x2b33('0x22')](function(){return _0x162d13[_0x2b33('0x18')](0xcc)[_0x2b33('0x24')]();})['catch'](handleError(_0x162d13,null));};exports[_0x2b33('0x7b')]=function(_0x4db872,_0x4fb281,_0x6dd6fa){var _0x5404f8=[];return db[_0x2b33('0x7c')]['describe']()[_0x2b33('0x22')](function(_0x469825){_0x5404f8=_[_0x2b33('0x2f')](_0x469825);return _0x4db872[_0x2b33('0x6c')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x52b3ca){if(_0x52b3ca&&_0x52b3ca[_0x2b33('0x48')]){return db[_0x2b33('0x7d')][_0x2b33('0x7e')](function(_0x5429d7){var _0xa2226d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2b33('0x6f')](_0x2b33('0x7f'))},'VoiceQueueId':{'$in':_[_0x2b33('0x29')](_0x52b3ca,'id')},'$or':[{'UserId':null},{'UserId':_0x4db872[_0x2b33('0x6c')]['id']}]};var _0x474aca={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x52b3ca)['filter'](['dialPreviewAutoRecallMe',0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4db872['user']['id']}]};var _0x4cd745={'$or':[_0xa2226d,_0x474aca]};var _0x35a66b=[];if(_0x4db872[_0x2b33('0x5e')]['direction']&&_0x4db872[_0x2b33('0x5e')][_0x2b33('0x80')]===_0x2b33('0x81')){if(!_[_0x2b33('0x82')](_0x4db872[_0x2b33('0x5e')][_0x2b33('0x83')])){_0x4cd745['id']={'$in':_0x4db872[_0x2b33('0x5e')]['hopperIds']};}_0x35a66b=[['priority',_0x2b33('0x84')],[_0x2b33('0x85'),_0x52b3ca[0x0][_0x2b33('0x86')]===_0x2b33('0x84')?_0x2b33('0x87'):'ASC'],db['sequelize']['literal'](_0x2b33('0x88')),['id',_0x2b33('0x87')]];}else{if(!_[_0x2b33('0x82')](_0x4db872['body']['hopperIds'])){_0x4cd745['id']={'$notIn':_0x4db872[_0x2b33('0x5e')][_0x2b33('0x83')]};}_0x35a66b=[['priority',_0x2b33('0x87')],[_0x2b33('0x85'),_0x52b3ca[0x0][_0x2b33('0x86')]],db['sequelize'][_0x2b33('0x89')](_0x2b33('0x8a')),['id',_0x2b33('0x84')]];}return db[_0x2b33('0x2a')]['findOne']({'attributes':['id',_0x2b33('0x8b'),'recallme'],'where':_0x4cd745,'order':_0x35a66b,'transaction':_0x5429d7,'lock':_0x5429d7[_0x2b33('0x8c')][_0x2b33('0x8d')],'include':[{'model':db[_0x2b33('0x7c')],'as':_0x2b33('0x8e'),'attributes':_0x5404f8,'include':[{'model':db[_0x2b33('0x8f')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x2b33('0x90')],'as':'List','attributes':['id','name']},{'model':db[_0x2b33('0x61')],'as':_0x2b33('0x91'),'attributes':['id',_0x2b33('0x26'),_0x2b33('0x92')]}]})[_0x2b33('0x22')](function(_0x44ca31){if(_0x44ca31){return _0x44ca31[_0x2b33('0x21')]({'UserId':_0x4db872[_0x2b33('0x6c')]['id']},{'transaction':_0x5429d7});}});});}})['then'](handleEntityNotFound(_0x4fb281,null))['then'](respondWithResult(_0x4fb281,null))['catch'](handleError(_0x4fb281,null));};exports[_0x2b33('0x93')]=function(_0x2bc121,_0x589106,_0xf15ebc){var _0x7f70b6=[];return db['CmContact'][_0x2b33('0x5f')]()['then'](function(_0x403d06){_0x7f70b6=_[_0x2b33('0x2f')](_0x403d06);return _0x2bc121['user'][_0x2b33('0x94')]({'where':{'type':_0x2b33('0x95'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x2b33('0x86'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x2b33('0x22')](function(_0x5bfe3f){if(_0x5bfe3f&&_0x5bfe3f['length']){return db['sequelize'][_0x2b33('0x7e')](function(_0x4e4fce){var _0x190cc7={'active':![],'recallme':!![],'id':_0x2bc121[_0x2b33('0x5e')][_0x2b33('0x96')]};return db[_0x2b33('0x2a')][_0x2b33('0x97')]({'attributes':['id',_0x2b33('0x8b'),_0x2b33('0x98')],'where':_0x190cc7,'transaction':_0x4e4fce,'lock':_0x4e4fce[_0x2b33('0x8c')][_0x2b33('0x8d')],'include':[{'model':db[_0x2b33('0x7c')],'as':_0x2b33('0x8e'),'attributes':_0x7f70b6,'include':[{'model':db['CmCompany'],'as':_0x2b33('0x99'),'attributes':['id',_0x2b33('0x26')]}]},{'model':db['CmList'],'as':_0x2b33('0x9a'),'attributes':['id','name']},{'model':db[_0x2b33('0x61')],'as':'Queue','attributes':['id',_0x2b33('0x26'),'dialActive']}]})[_0x2b33('0x22')](function(_0x1388c4){if(_0x1388c4){return _0x1388c4[_0x2b33('0x21')]({'UserId':_0x2bc121[_0x2b33('0x6c')]['id']},{'transaction':_0x4e4fce});}});});}})['then'](handleEntityNotFound(_0x589106,null))[_0x2b33('0x22')](respondWithResult(_0x589106,null))[_0x2b33('0x55')](handleError(_0x589106,null));};exports['getOpenContacts']=function(_0x924b18,_0x38f168,_0x123639){return _0x924b18[_0x2b33('0x6c')]['getVoiceQueues']({'where':{'type':_0x2b33('0x95'),'dialActive':!![],'dialMethod':_0x2b33('0x9b')},'attributes':['id'],'raw':!![]})[_0x2b33('0x22')](function(_0x2949ef){if(_0x2949ef&&_0x2949ef['length']){return db[_0x2b33('0x2a')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2b33('0x6f')](_0x2b33('0x7f'))},'VoiceQueueId':{'$in':_[_0x2b33('0x29')](_0x2949ef,'id')},'$or':[{'UserId':null},{'UserId':_0x924b18[_0x2b33('0x6c')]['id']}]}});}return 0x0;})['then'](function(_0x1689e9){if(!_[_0x2b33('0x77')](_0x1689e9)&&_[_0x2b33('0x9c')](_0x1689e9)){return _0x38f168[_0x2b33('0x18')](0xc8)[_0x2b33('0x19')]({'contacts':_0x1689e9});}else{logger['error'](_0x2b33('0x9d'),_0x2b33('0x9e'),0x194,_0x2b33('0x9f'));_0x38f168[_0x2b33('0x17')](0x194);}})[_0x2b33('0x55')](handleError(_0x38f168,null));};exports['getTimezones']=function(_0x3e8eec,_0x24713a,_0x2a6b3a){var _0x5c915b=shared[_0x2b33('0xa0')];var _0x5d9298=[];_[_0x2b33('0x29')](_0x5c915b,function(_0x36be69){_0x5d9298['push']({'id':_0x36be69[_0x2b33('0x26')],'name':_0x36be69[_0x2b33('0x26')],'utcOffset':_0x36be69['utcOffset']});});return _0x24713a['status'](0xc8)[_0x2b33('0x19')]({'tz':_0x5d9298});};exports['getTimezone']=function(_0x36ac4b,_0x32134f,_0x5861ed){var _0x4cdd20=shared['timezones'];var _0x3ddae6={};if(!_[_0x2b33('0x77')](_0x4cdd20[_0x36ac4b[_0x2b33('0x5e')]['id']]))_0x3ddae6=_0x4cdd20[_0x36ac4b['body']['id']];return _0x32134f['status'](0xc8)[_0x2b33('0x19')](_0x3ddae6);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 2207a05..4123742 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0x6a619d,_0x168146){var _0x37d94d=function(_0x1fe619){while(--_0x1fe619){_0x6a619d['push'](_0x6a619d['shift']());}};_0x37d94d(++_0x168146);}(_0x7096,0x10c));var _0x6709=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x7096[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x53ec,0x192));var _0xc53e=function(_0x4e3079,_0x2e48ea){_0x4e3079=_0x4e3079-0x0;var _0x4356fb=_0x53ec[_0x4e3079];return _0x4356fb;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 3fb0c6b..e7c48a0 100644 --- a/server/api/cmHopper/cmHopper.rpc.js +++ b/server/api/cmHopper/cmHopper.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc06f=['voicePause','push','includes','all','dataValues','ContactId','active','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','length','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','literal','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','ShowCmHopper','stringify','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','Contact','keys','User','name'];(function(_0xd23513,_0x407dbb){var _0x589731=function(_0x3d5960){while(--_0x3d5960){_0xd23513['push'](_0xd23513['shift']());}};_0x589731(++_0x407dbb);}(_0xc06f,0x12f));var _0xfc06=function(_0x496572,_0x319fc3){_0x496572=_0x496572-0x0;var _0x58ff9f=_0xc06f[_0x496572];return _0x58ff9f;};'use strict';var _=require(_0xfc06('0x0'));var util=require(_0xfc06('0x1'));var moment=require('moment');var BPromise=require(_0xfc06('0x2'));var rs=require(_0xfc06('0x3'));var fs=require('fs');var Redis=require(_0xfc06('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc06('0x5'));var logger=require(_0xfc06('0x6'))(_0xfc06('0x7'));var config=require(_0xfc06('0x8'));var jayson=require(_0xfc06('0x9'));const {validateExpressRequest}=require(_0xfc06('0xa'));var client=jayson['client'][_0xfc06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cdc97,_0x18804f,_0xe11b43){return new BPromise(function(_0x52b11e,_0x1129f1){return client['request'](_0x4cdc97,_0xe11b43)[_0xfc06('0xc')](function(_0x227072){logger[_0xfc06('0xd')](_0xfc06('0xe'),_0x18804f,_0xfc06('0xf'));logger[_0xfc06('0x10')](_0xfc06('0x11'),_0x18804f,_0xfc06('0xf'),JSON['stringify'](_0x227072));if(_0x227072[_0xfc06('0x12')]){if(_0x227072[_0xfc06('0x12')][_0xfc06('0x13')]===0x1f4){logger[_0xfc06('0x12')]('CmHopper,\x20%s,\x20%s',_0x18804f,_0x227072['error'][_0xfc06('0x14')]);return _0x1129f1(_0x227072[_0xfc06('0x12')]['message']);}logger['error'](_0xfc06('0xe'),_0x18804f,_0x227072[_0xfc06('0x12')][_0xfc06('0x14')]);return _0x52b11e(_0x227072[_0xfc06('0x12')][_0xfc06('0x14')]);}else{logger[_0xfc06('0xd')](_0xfc06('0xe'),_0x18804f,_0xfc06('0xf'));_0x52b11e(_0x227072['result']['message']);}})[_0xfc06('0x15')](function(_0x1746e7){logger[_0xfc06('0x12')](_0xfc06('0xe'),_0x18804f,_0x1746e7);_0x1129f1(_0x1746e7);});});}exports[_0xfc06('0x16')]=function(_0x28b261){var _0x4beec3=this;return new Promise(function(_0x39edd0,_0x4e8be6){return db[_0xfc06('0x17')][_0xfc06('0x18')]({'raw':_0x28b261[_0xfc06('0x19')]?_0x28b261['options'][_0xfc06('0x1a')]===undefined?!![]:![]:!![],'where':_0x28b261[_0xfc06('0x19')]?_0x28b261[_0xfc06('0x19')][_0xfc06('0x1b')]||null:null,'attributes':_0x28b261[_0xfc06('0x19')]?_0x28b261[_0xfc06('0x19')]['attributes']||null:null,'limit':_0x28b261[_0xfc06('0x19')]?_0x28b261[_0xfc06('0x19')][_0xfc06('0x1c')]||null:null,'include':_0x28b261[_0xfc06('0x19')]?_0x28b261[_0xfc06('0x19')][_0xfc06('0x1d')]?_[_0xfc06('0x1e')](_0x28b261[_0xfc06('0x19')][_0xfc06('0x1d')],function(_0x1563ad){return{'model':db[_0x1563ad[_0xfc06('0x1f')]],'as':_0x1563ad['as'],'attributes':_0x1563ad[_0xfc06('0x20')],'include':_0x1563ad['include']?_[_0xfc06('0x1e')](_0x1563ad['include'],function(_0x57ed16){return{'model':db[_0x57ed16[_0xfc06('0x1f')]],'as':_0x57ed16['as'],'attributes':_0x57ed16[_0xfc06('0x20')],'include':_0x57ed16[_0xfc06('0x1d')]?_[_0xfc06('0x1e')](_0x57ed16['include'],function(_0x450ad0){return{'model':db[_0x450ad0[_0xfc06('0x1f')]],'as':_0x450ad0['as'],'attributes':_0x450ad0[_0xfc06('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfc06('0xc')](function(_0x26f3ef){logger['info'](_0xfc06('0x16'),_0x28b261);logger[_0xfc06('0x10')](_0xfc06('0x16'),_0x28b261,JSON['stringify'](_0x26f3ef));_0x39edd0(_0x26f3ef);})[_0xfc06('0x15')](function(_0x4cb22e){logger[_0xfc06('0x12')](_0xfc06('0x16'),_0x4cb22e[_0xfc06('0x14')],_0x28b261);_0x4e8be6(_0x4beec3['error'](0x1f4,_0x4cb22e[_0xfc06('0x14')]));});});};exports[_0xfc06('0x21')]=function(_0x3f2376){var _0x3d990d=this;return new Promise(function(_0x8b9b68,_0x1e5368){return db[_0xfc06('0x17')]['find']({'raw':_0x3f2376['options']?_0x3f2376[_0xfc06('0x19')][_0xfc06('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f2376[_0xfc06('0x19')]?_0x3f2376[_0xfc06('0x19')][_0xfc06('0x1b')]||null:null,'attributes':_0x3f2376[_0xfc06('0x19')]?_0x3f2376[_0xfc06('0x19')][_0xfc06('0x20')]||null:null,'include':_0x3f2376[_0xfc06('0x19')]?_0x3f2376[_0xfc06('0x19')][_0xfc06('0x1d')]?_['map'](_0x3f2376[_0xfc06('0x19')][_0xfc06('0x1d')],function(_0x2f29fb){return{'model':db[_0x2f29fb['model']],'as':_0x2f29fb['as'],'attributes':_0x2f29fb['attributes'],'include':_0x2f29fb['include']?_[_0xfc06('0x1e')](_0x2f29fb[_0xfc06('0x1d')],function(_0x2cf501){return{'model':db[_0x2cf501[_0xfc06('0x1f')]],'as':_0x2cf501['as'],'attributes':_0x2cf501[_0xfc06('0x20')],'include':_0x2cf501[_0xfc06('0x1d')]?_[_0xfc06('0x1e')](_0x2cf501[_0xfc06('0x1d')],function(_0x26f56e){return{'model':db[_0x26f56e['model']],'as':_0x26f56e['as'],'attributes':_0x26f56e['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc06('0xc')](function(_0x369dab){logger[_0xfc06('0xd')](_0xfc06('0x21'),_0x3f2376);logger[_0xfc06('0x10')](_0xfc06('0x21'),_0x3f2376,JSON[_0xfc06('0x22')](_0x369dab));_0x8b9b68(_0x369dab);})[_0xfc06('0x15')](function(_0x3e05d4){logger[_0xfc06('0x12')]('ShowCmHopper',_0x3e05d4['message'],_0x3f2376);_0x1e5368(_0x3d990d[_0xfc06('0x12')](0x1f4,_0x3e05d4[_0xfc06('0x14')]));});});};exports[_0xfc06('0x23')]=function(_0x5efa47){var _0x1cf4cb=this;return new Promise(function(_0x5588d9,_0x16e4a5){return db[_0xfc06('0x17')][_0xfc06('0x24')](_0x5efa47[_0xfc06('0x25')],{'raw':_0x5efa47[_0xfc06('0x19')]?_0x5efa47['options'][_0xfc06('0x1a')]===undefined?!![]:![]:!![]})[_0xfc06('0xc')](function(_0x112f02){logger[_0xfc06('0xd')](_0xfc06('0x23'),_0x5efa47);logger['debug']('CreateCmHopper',_0x5efa47,JSON['stringify'](_0x112f02));_0x5588d9(_0x112f02);})[_0xfc06('0x15')](function(_0x37ee02){logger[_0xfc06('0x12')](_0xfc06('0x23'),_0x37ee02[_0xfc06('0x14')],_0x5efa47);_0x16e4a5(_0x1cf4cb[_0xfc06('0x12')](0x1f4,_0x37ee02['message']));});});};exports[_0xfc06('0x26')]=function(_0x1d3f25){var _0xef6c0e=this;return new Promise(function(_0x27fd63,_0x483203){return db[_0xfc06('0x17')][_0xfc06('0x27')](_0x1d3f25[_0xfc06('0x25')],{'raw':_0x1d3f25['options']?_0x1d3f25['options'][_0xfc06('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d3f25[_0xfc06('0x19')]?_0x1d3f25[_0xfc06('0x19')]['where']||null:null,'attributes':_0x1d3f25[_0xfc06('0x19')]?_0x1d3f25[_0xfc06('0x19')][_0xfc06('0x20')]||null:null,'limit':_0x1d3f25[_0xfc06('0x19')]?_0x1d3f25['options'][_0xfc06('0x1c')]||null:null})[_0xfc06('0xc')](function(_0x1005a5){logger['info']('UpdateCmHopper',_0x1d3f25);logger[_0xfc06('0xd')](_0xfc06('0x28'),JSON[_0xfc06('0x22')](_0x1d3f25[_0xfc06('0x19')][_0xfc06('0x1b')]),_0x1d3f25[_0xfc06('0x25')]['active']);logger[_0xfc06('0x10')](_0xfc06('0x26'),_0x1d3f25,JSON[_0xfc06('0x22')](_0x1005a5));_0x27fd63(_0x1005a5);})[_0xfc06('0x15')](function(_0x4fccb2){logger[_0xfc06('0x12')](_0xfc06('0x26'),_0x4fccb2['message'],_0x1d3f25);_0x483203(_0xef6c0e[_0xfc06('0x12')](0x1f4,_0x4fccb2[_0xfc06('0x14')]));});});};exports['DestroyCmHopper']=function(_0x3b28d2){var _0x40bc9b=this;return new Promise(function(_0x3c05bf,_0x1145ea){return db[_0xfc06('0x17')][_0xfc06('0x29')]({'where':_0x3b28d2['options']?_0x3b28d2['options'][_0xfc06('0x1b')]||null:null})[_0xfc06('0xc')](function(_0x44676f){logger[_0xfc06('0xd')](_0xfc06('0x2a'),_0x3b28d2);logger[_0xfc06('0x10')](_0xfc06('0x2a'),_0x3b28d2,JSON['stringify'](_0x44676f));_0x3c05bf(_0x44676f);})[_0xfc06('0x15')](function(_0x3b8117){logger[_0xfc06('0x12')]('DestroyCmHopper',_0x3b8117[_0xfc06('0x14')],_0x3b28d2);_0x1145ea(_0x40bc9b[_0xfc06('0x12')](0x1f4,_0x3b8117[_0xfc06('0x14')]));});});};exports[_0xfc06('0x2b')]=function(_0x15d2e5){var _0x4e0d7a=this;return new Promise(function(_0x373db8,_0x39c721){return db[_0xfc06('0x2c')][_0xfc06('0x2d')]()[_0xfc06('0xc')](function(_0x3fa013){return db['sequelize'][_0xfc06('0x2e')](function(_0x56ffdd){return db[_0xfc06('0x17')][_0xfc06('0x18')]({'where':_0x15d2e5[_0xfc06('0x19')]?_0x15d2e5[_0xfc06('0x19')][_0xfc06('0x1b')]||null:null,'attributes':_0x15d2e5[_0xfc06('0x19')]?_0x15d2e5[_0xfc06('0x19')][_0xfc06('0x20')]||null:null,'limit':_0x15d2e5[_0xfc06('0x19')]?_0x15d2e5[_0xfc06('0x19')][_0xfc06('0x1c')]||null:null,'order':_0x15d2e5['options']?_0x15d2e5['options'][_0xfc06('0x2f')]||null:null,'transaction':_0x56ffdd,'lock':_0x56ffdd[_0xfc06('0x30')]['UPDATE'],'include':[{'model':db[_0xfc06('0x2c')],'as':_0xfc06('0x31'),'attributes':_[_0xfc06('0x32')](_0x3fa013)},{'model':db[_0xfc06('0x33')],'as':'Agent','attributes':['id',_0xfc06('0x34'),_0xfc06('0x35')]}]})[_0xfc06('0xc')](function(_0x1dc93f){var _0x6ee4c4=[];var _0x1d144a=[];for(var _0x527dd4=0x0;_0x527dd4<_0x1dc93f['length'];_0x527dd4+=0x1){var _0x31810=_0x1dc93f[_0x527dd4]['UserId'];if(_0x31810===null){_0x6ee4c4[_0xfc06('0x36')](_0x1dc93f[_0x527dd4][_0xfc06('0x27')](_0x15d2e5[_0xfc06('0x25')],{'transaction':_0x56ffdd}));}else if(!_0x1d144a[_0xfc06('0x37')](_0x31810)){_0x1d144a[_0xfc06('0x36')](_0x31810);_0x6ee4c4[_0xfc06('0x36')](_0x1dc93f[_0x527dd4][_0xfc06('0x27')](_0x15d2e5['body'],{'transaction':_0x56ffdd}));}}return BPromise[_0xfc06('0x38')](_0x6ee4c4);});})[_0xfc06('0xc')](function(_0x27189f){logger[_0xfc06('0xd')]('GetContactDialer',_0x15d2e5);if(_0x27189f['length']>0x0){logger[_0xfc06('0xd')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x27189f[0x0][_0xfc06('0x39')]['id'],_0x27189f[0x0]['dataValues'][_0xfc06('0x3a')],_0x27189f[0x0][_0xfc06('0x39')][_0xfc06('0x3b')]);}logger[_0xfc06('0x10')](_0xfc06('0x2b'),_0x15d2e5,JSON[_0xfc06('0x22')](_0x27189f));_0x373db8(_0x27189f);})['catch'](function(_0x4b451b){logger[_0xfc06('0x12')](_0xfc06('0x2b'),_0x4b451b[_0xfc06('0x14')],_0x15d2e5);_0x39c721(_0x4e0d7a[_0xfc06('0x12')](0x1f4,_0x4b451b[_0xfc06('0x14')]));});});});};exports[_0xfc06('0x3c')]=function(_0x5af14a){var _0x3a3f53=this;return new Promise(function(_0x162633,_0xa87c52){return db[_0xfc06('0x3d')][_0xfc06('0x2e')](function(_0x15c61b){return db[_0xfc06('0x3e')][_0xfc06('0x24')](_0x5af14a['body'],{'raw':_0x5af14a[_0xfc06('0x19')]?_0x5af14a[_0xfc06('0x19')]['raw']===undefined?!![]:![]:!![],'transaction':_0x15c61b})['then'](function(){logger[_0xfc06('0xd')](_0xfc06('0x3f'),JSON['stringify'](_0x5af14a[_0xfc06('0x19')][_0xfc06('0x1b')]),_0x5af14a['options'][_0xfc06('0x1b')][_0xfc06('0x3b')]);return db[_0xfc06('0x17')][_0xfc06('0x29')]({'where':_0x5af14a['options']?_0x5af14a[_0xfc06('0x19')][_0xfc06('0x1b')]||null:null,'transaction':_0x15c61b});});})[_0xfc06('0xc')](function(_0x1d6ea5){logger['info'](_0xfc06('0x3c'),_0x5af14a);logger[_0xfc06('0x10')](_0xfc06('0x3c'),_0x5af14a,JSON[_0xfc06('0x22')](_0x1d6ea5));_0x162633(_0x1d6ea5);})[_0xfc06('0x15')](function(_0x20bb2b){logger[_0xfc06('0x12')](_0xfc06('0x3c'),_0x20bb2b[_0xfc06('0x14')],_0x5af14a);_0xa87c52(_0x3a3f53['error'](0x1f4,_0x20bb2b['message']));});});};exports[_0xfc06('0x40')]=function(_0x209a15){var _0x188133=this;return new Promise(function(_0xd61b99,_0x3731b8){return db['CmHopper']['findAll']({'raw':_0x209a15[_0xfc06('0x19')]?_0x209a15[_0xfc06('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x209a15[_0xfc06('0x19')]?_0x209a15[_0xfc06('0x19')]['where']||null:null,'attributes':[[db[_0xfc06('0x3d')]['fn']('COUNT',db[_0xfc06('0x3d')]['fn']('IF',db[_0xfc06('0x3d')]['literal'](_0xfc06('0x41')+util[_0xfc06('0x42')](_0xfc06('0x43'),moment()['format'](_0xfc06('0x44')))+_0xfc06('0x45')))),_0xfc06('0x46')]]})['then'](function(_0x36228c){logger[_0xfc06('0xd')](_0xfc06('0x40'),_0x209a15);logger[_0xfc06('0x10')](_0xfc06('0x40'),_0x209a15,JSON['stringify'](_0x36228c));_0xd61b99(_0x36228c);})[_0xfc06('0x15')](function(_0x4b8b6b){logger[_0xfc06('0x12')]('CountReScheduled',_0x4b8b6b[_0xfc06('0x14')],_0x209a15);_0x3731b8(_0x188133[_0xfc06('0x12')](0x1f4,_0x4b8b6b[_0xfc06('0x14')]));});});};exports[_0xfc06('0x47')]=function(_0x4cf7c3){var _0x1a3a9c=this;return new Promise(function(_0x335b9a,_0x32ed6a){return db[_0xfc06('0x2c')][_0xfc06('0x2d')]()[_0xfc06('0xc')](function(_0x2feefa){return db['sequelize']['transaction'](function(_0x49dbd9){return db[_0xfc06('0x17')][_0xfc06('0x18')]({'where':_0x4cf7c3[_0xfc06('0x19')]?_0x4cf7c3[_0xfc06('0x19')][_0xfc06('0x1b')]||null:null,'attributes':_0x4cf7c3['options']?_0x4cf7c3['options'][_0xfc06('0x20')]||null:null,'limit':0x1,'order':_0x4cf7c3[_0xfc06('0x19')]?_0x4cf7c3['options'][_0xfc06('0x2f')]||null:null,'group':db[_0xfc06('0x17')]['UserId'],'transaction':_0x49dbd9,'lock':_0x49dbd9[_0xfc06('0x30')][_0xfc06('0x48')],'include':_0x4cf7c3[_0xfc06('0x19')]?_0x4cf7c3[_0xfc06('0x19')][_0xfc06('0x1d')]?_[_0xfc06('0x1e')](_0x4cf7c3[_0xfc06('0x19')][_0xfc06('0x1d')],function(_0x290591){return{'model':db[_0x290591[_0xfc06('0x1f')]],'as':_0x290591['as'],'attributes':_0x290591[_0xfc06('0x20')],'include':_0x290591[_0xfc06('0x1d')]?_[_0xfc06('0x1e')](_0x290591[_0xfc06('0x1d')],function(_0x1f065d){return{'model':db[_0x1f065d[_0xfc06('0x1f')]],'as':_0x1f065d['as'],'attributes':_0x1f065d[_0xfc06('0x20')],'include':_0x1f065d[_0xfc06('0x1d')]?_['map'](_0x1f065d[_0xfc06('0x1d')],function(_0x3069b8){return{'model':db[_0x3069b8[_0xfc06('0x1f')]],'as':_0x3069b8['as'],'attributes':_0x3069b8[_0xfc06('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x302f32){var _0xfc84a0=[];for(var _0x4b9a06=0x0;_0x4b9a06<_0x302f32[_0xfc06('0x49')];_0x4b9a06+=0x1){_0xfc84a0['push'](_0x302f32[_0x4b9a06]['update'](_0x4cf7c3[_0xfc06('0x25')],{'transaction':_0x49dbd9}));}return BPromise['all'](_0xfc84a0);});})['then'](function(_0x1f2b49){logger['info'](_0xfc06('0x47'),_0x4cf7c3);logger['debug'](_0xfc06('0x47'),_0x4cf7c3,JSON['stringify'](_0x1f2b49));_0x335b9a(_0x1f2b49);})[_0xfc06('0x15')](function(_0x4ad4e6){logger[_0xfc06('0x12')](_0xfc06('0x47'),_0x4ad4e6[_0xfc06('0x14')],_0x4cf7c3);_0x32ed6a(_0x1a3a9c[_0xfc06('0x12')](0x1f4,_0x4ad4e6[_0xfc06('0x14')]));});});});};exports[_0xfc06('0x4a')]=function(_0xb30daa){var _0x26abbb=this;return new Promise(function(_0xd73115,_0x21e566){db['CmContact'][_0xfc06('0x2d')]()[_0xfc06('0xc')](function(_0x460568){return db[_0xfc06('0x17')][_0xfc06('0x18')]({'raw':_0xb30daa[_0xfc06('0x19')]?_0xb30daa[_0xfc06('0x19')][_0xfc06('0x1a')]===undefined?!![]:![]:!![],'where':_0xb30daa[_0xfc06('0x19')]?_0xb30daa[_0xfc06('0x19')][_0xfc06('0x1b')]||null:null,'attributes':_0xb30daa['options']?_0xb30daa['options'][_0xfc06('0x20')]||null:null,'limit':_0xb30daa[_0xfc06('0x19')]?_0xb30daa[_0xfc06('0x19')][_0xfc06('0x1c')]||null:null,'include':_0xb30daa[_0xfc06('0x19')]?_0xb30daa['options']['include']?_['map'](_0xb30daa[_0xfc06('0x19')]['include'],function(_0x53fbe2){return{'model':db[_0x53fbe2['model']],'as':_0x53fbe2['as'],'attributes':_0x53fbe2['as']===_0xfc06('0x31')?_[_0xfc06('0x32')](_0x460568):_0x53fbe2['attributes'],'include':_0x53fbe2['include']?_[_0xfc06('0x1e')](_0x53fbe2['include'],function(_0x54546c){return{'model':db[_0x54546c[_0xfc06('0x1f')]],'as':_0x54546c['as'],'attributes':_0x54546c[_0xfc06('0x20')],'include':_0x54546c[_0xfc06('0x1d')]?_[_0xfc06('0x1e')](_0x54546c[_0xfc06('0x1d')],function(_0x22aae9){return{'model':db[_0x22aae9[_0xfc06('0x1f')]],'as':_0x22aae9['as'],'attributes':_0x22aae9['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc06('0xc')](function(_0x40ae84){logger['info'](_0xfc06('0x16'),_0xb30daa);logger[_0xfc06('0x10')](_0xfc06('0x16'),_0xb30daa,JSON[_0xfc06('0x22')](_0x40ae84));_0xd73115(_0x40ae84);})[_0xfc06('0x15')](function(_0x366bf4){logger[_0xfc06('0x12')](_0xfc06('0x16'),_0x366bf4[_0xfc06('0x14')],_0xb30daa);_0x21e566(_0x26abbb[_0xfc06('0x12')](0x1f4,_0x366bf4[_0xfc06('0x14')]));});});});};exports[_0xfc06('0x4b')]=function(_0x17280a){var _0x515143=this;return new Promise(function(_0x59d22c,_0x57d371){return db[_0xfc06('0x2c')][_0xfc06('0x4c')]({'raw':!![],'where':{'phone':_0x17280a[_0xfc06('0x19')][_0xfc06('0x1b')][_0xfc06('0x4d')]},'attributes':['id',_0xfc06('0x4e')],'order':[['id',_0xfc06('0x4f')]]})[_0xfc06('0xc')](function(_0x276d98){logger['info'](_0xfc06('0x50'),_0x17280a);logger[_0xfc06('0x10')](_0xfc06('0x50'),_0x17280a,JSON[_0xfc06('0x22')](_0x276d98));_0x59d22c(_0x276d98);})[_0xfc06('0x15')](function(_0x57c7be){logger[_0xfc06('0x12')](_0xfc06('0x50'),_0x57c7be['message'],_0x17280a);_0x57d371(_0x515143[_0xfc06('0x12')](0x1f4,_0x57c7be[_0xfc06('0x14')]));});});};exports[_0xfc06('0x51')]=function(_0x258985){var _0x236333=this;return new Promise(function(_0x4fef11,_0xa6b2ff){return db[_0xfc06('0x3d')]['transaction'](function(_0x46c785){return db[_0xfc06('0x17')][_0xfc06('0x27')]({'active':![]},{'where':{},'transaction':_0x46c785})[_0xfc06('0xc')](function(_0x209c62){logger[_0xfc06('0xd')](_0xfc06('0x51'),_0x258985);logger['debug']('ResetActiveCalls',_0x258985,JSON['stringify'](_0x209c62));_0x4fef11(_0x209c62);})[_0xfc06('0x15')](function(_0x4d8523){logger[_0xfc06('0x12')]('ResetActiveCalls',_0x4d8523[_0xfc06('0x14')],_0x258985);_0xa6b2ff(_0x236333[_0xfc06('0x12')](0x1f4,_0x4d8523[_0xfc06('0x14')]));});});});};exports[_0xfc06('0x52')]=function(_0x513ab8){var _0x150a65=this;var _0x56a173=_0x513ab8[_0xfc06('0x25')][_0xfc06('0x1b')][_0xfc06('0x53')];var _0x4ec67a=_0x513ab8[_0xfc06('0x25')][_0xfc06('0x1b')]['interval'];return new Promise(function(_0x742d21,_0x2aa2d7){return db['CmHopper'][_0xfc06('0x18')]({'where':{'voiceQueueId':_0x56a173,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xfc06('0x3d')]['literal'](_0xfc06('0x54')+_0x4ec67a+_0xfc06('0x55'))}},'include':[{'model':db[_0xfc06('0x2c')],'as':_0xfc06('0x31')},{'model':db[_0xfc06('0x33')],'as':'Agent','attributes':['id',_0xfc06('0x34'),_0xfc06('0x35')]},{'model':db[_0xfc06('0x56')],'as':_0xfc06('0x57')}]})[_0xfc06('0xc')](function(_0x8728a4){return db[_0xfc06('0x3d')][_0xfc06('0x2e')](function(_0x2aaaad){return db[_0xfc06('0x17')][_0xfc06('0x27')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x56a173,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xfc06('0x3d')][_0xfc06('0x58')](_0xfc06('0x54')+_0x4ec67a+_0xfc06('0x55'))}},'transaction':_0x2aaaad})[_0xfc06('0xc')](function(_0x3f033a){_0x742d21(_0x8728a4);})['catch'](function(_0x73d7f0){logger[_0xfc06('0x12')](_0xfc06('0x52'),_0x73d7f0[_0xfc06('0x14')],_0x513ab8);_0x2aa2d7(validateExpressRequest);});});})['catch'](function(_0x37327f){logger['error'](_0xfc06('0x52'),_0x37327f['message'],_0x513ab8);_0x2aa2d7(_0x150a65[_0xfc06('0x12')](0x1f4,_0x37327f['message']));});});}; \ No newline at end of file +var _0x5944=['body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','name','voicePause','length','update','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','ContactId','dataValues','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','UserId','GetCmHopperPreview','findAll','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','Agent','List','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','options','attributes','limit','map','include','model','stringify','ShowCmHopper','find','raw','where','CreateCmHopper','create'];(function(_0x672df7,_0x250458){var _0xc3c3e7=function(_0x321176){while(--_0x321176){_0x672df7['push'](_0x672df7['shift']());}};_0xc3c3e7(++_0x250458);}(_0x5944,0xf0));var _0x4594=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x5944[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4594('0x0'));var BPromise=require(_0x4594('0x1'));var rs=require(_0x4594('0x2'));var fs=require('fs');var Redis=require(_0x4594('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4594('0x4'));var logger=require(_0x4594('0x5'))(_0x4594('0x6'));var config=require(_0x4594('0x7'));var jayson=require(_0x4594('0x8'));const {validateExpressRequest}=require(_0x4594('0x9'));var client=jayson[_0x4594('0xa')][_0x4594('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x281285,_0x467933,_0x27dce6){return new BPromise(function(_0x4e78d4,_0x621ad1){return client[_0x4594('0xc')](_0x281285,_0x27dce6)[_0x4594('0xd')](function(_0x2d8882){logger[_0x4594('0xe')]('CmHopper,\x20%s,\x20%s',_0x467933,_0x4594('0xf'));logger[_0x4594('0x10')](_0x4594('0x11'),_0x467933,_0x4594('0xf'),JSON['stringify'](_0x2d8882));if(_0x2d8882[_0x4594('0x12')]){if(_0x2d8882[_0x4594('0x12')][_0x4594('0x13')]===0x1f4){logger[_0x4594('0x12')](_0x4594('0x14'),_0x467933,_0x2d8882[_0x4594('0x12')][_0x4594('0x15')]);return _0x621ad1(_0x2d8882[_0x4594('0x12')]['message']);}logger[_0x4594('0x12')](_0x4594('0x14'),_0x467933,_0x2d8882[_0x4594('0x12')][_0x4594('0x15')]);return _0x4e78d4(_0x2d8882[_0x4594('0x12')][_0x4594('0x15')]);}else{logger[_0x4594('0xe')](_0x4594('0x14'),_0x467933,_0x4594('0xf'));_0x4e78d4(_0x2d8882[_0x4594('0x16')][_0x4594('0x15')]);}})[_0x4594('0x17')](function(_0x35c032){logger[_0x4594('0x12')]('CmHopper,\x20%s,\x20%s',_0x467933,_0x35c032);_0x621ad1(_0x35c032);});});}exports[_0x4594('0x18')]=function(_0x1eaf6d){var _0x2aa580=this;return new Promise(function(_0x3943fd,_0x1f3893){return db[_0x4594('0x19')]['findAll']({'raw':_0x1eaf6d[_0x4594('0x1a')]?_0x1eaf6d[_0x4594('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1eaf6d[_0x4594('0x1a')]?_0x1eaf6d[_0x4594('0x1a')]['where']||null:null,'attributes':_0x1eaf6d[_0x4594('0x1a')]?_0x1eaf6d[_0x4594('0x1a')][_0x4594('0x1b')]||null:null,'limit':_0x1eaf6d[_0x4594('0x1a')]?_0x1eaf6d[_0x4594('0x1a')][_0x4594('0x1c')]||null:null,'include':_0x1eaf6d[_0x4594('0x1a')]?_0x1eaf6d[_0x4594('0x1a')]['include']?_[_0x4594('0x1d')](_0x1eaf6d[_0x4594('0x1a')][_0x4594('0x1e')],function(_0x1c3387){return{'model':db[_0x1c3387['model']],'as':_0x1c3387['as'],'attributes':_0x1c3387[_0x4594('0x1b')],'include':_0x1c3387[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x1c3387[_0x4594('0x1e')],function(_0x2c4b7d){return{'model':db[_0x2c4b7d['model']],'as':_0x2c4b7d['as'],'attributes':_0x2c4b7d[_0x4594('0x1b')],'include':_0x2c4b7d['include']?_[_0x4594('0x1d')](_0x2c4b7d[_0x4594('0x1e')],function(_0x266f6a){return{'model':db[_0x266f6a[_0x4594('0x1f')]],'as':_0x266f6a['as'],'attributes':_0x266f6a['attributes']};}):[]};}):[]};}):[]:[]})[_0x4594('0xd')](function(_0x37a6c0){logger[_0x4594('0xe')](_0x4594('0x18'),_0x1eaf6d);logger[_0x4594('0x10')](_0x4594('0x18'),_0x1eaf6d,JSON[_0x4594('0x20')](_0x37a6c0));_0x3943fd(_0x37a6c0);})['catch'](function(_0x4fb010){logger[_0x4594('0x12')](_0x4594('0x18'),_0x4fb010[_0x4594('0x15')],_0x1eaf6d);_0x1f3893(_0x2aa580[_0x4594('0x12')](0x1f4,_0x4fb010[_0x4594('0x15')]));});});};exports[_0x4594('0x21')]=function(_0xfbf5cb){var _0x2a574e=this;return new Promise(function(_0xaa8f11,_0x22375e){return db['CmHopper'][_0x4594('0x22')]({'raw':_0xfbf5cb[_0x4594('0x1a')]?_0xfbf5cb[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![],'where':_0xfbf5cb[_0x4594('0x1a')]?_0xfbf5cb['options'][_0x4594('0x24')]||null:null,'attributes':_0xfbf5cb[_0x4594('0x1a')]?_0xfbf5cb[_0x4594('0x1a')][_0x4594('0x1b')]||null:null,'include':_0xfbf5cb['options']?_0xfbf5cb[_0x4594('0x1a')][_0x4594('0x1e')]?_[_0x4594('0x1d')](_0xfbf5cb[_0x4594('0x1a')][_0x4594('0x1e')],function(_0x26346c){return{'model':db[_0x26346c['model']],'as':_0x26346c['as'],'attributes':_0x26346c[_0x4594('0x1b')],'include':_0x26346c[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x26346c[_0x4594('0x1e')],function(_0x1fffe6){return{'model':db[_0x1fffe6[_0x4594('0x1f')]],'as':_0x1fffe6['as'],'attributes':_0x1fffe6[_0x4594('0x1b')],'include':_0x1fffe6[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x1fffe6['include'],function(_0x174bcd){return{'model':db[_0x174bcd[_0x4594('0x1f')]],'as':_0x174bcd['as'],'attributes':_0x174bcd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x467376){logger['info'](_0x4594('0x21'),_0xfbf5cb);logger[_0x4594('0x10')](_0x4594('0x21'),_0xfbf5cb,JSON[_0x4594('0x20')](_0x467376));_0xaa8f11(_0x467376);})[_0x4594('0x17')](function(_0x8783c2){logger[_0x4594('0x12')]('ShowCmHopper',_0x8783c2[_0x4594('0x15')],_0xfbf5cb);_0x22375e(_0x2a574e[_0x4594('0x12')](0x1f4,_0x8783c2['message']));});});};exports[_0x4594('0x25')]=function(_0x3e02eb){var _0x398283=this;return new Promise(function(_0x2580eb,_0x24575a){return db['CmHopper'][_0x4594('0x26')](_0x3e02eb[_0x4594('0x27')],{'raw':_0x3e02eb['options']?_0x3e02eb[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x230124){logger[_0x4594('0xe')](_0x4594('0x25'),_0x3e02eb);logger[_0x4594('0x10')]('CreateCmHopper',_0x3e02eb,JSON[_0x4594('0x20')](_0x230124));_0x2580eb(_0x230124);})['catch'](function(_0x24a0ee){logger[_0x4594('0x12')](_0x4594('0x25'),_0x24a0ee['message'],_0x3e02eb);_0x24575a(_0x398283['error'](0x1f4,_0x24a0ee[_0x4594('0x15')]));});});};exports[_0x4594('0x28')]=function(_0xbbb126){var _0x59a1ec=this;return new Promise(function(_0x303ac4,_0x2cdbf5){return db['CmHopper']['update'](_0xbbb126[_0x4594('0x27')],{'raw':_0xbbb126[_0x4594('0x1a')]?_0xbbb126[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbbb126[_0x4594('0x1a')]?_0xbbb126[_0x4594('0x1a')][_0x4594('0x24')]||null:null,'attributes':_0xbbb126['options']?_0xbbb126[_0x4594('0x1a')][_0x4594('0x1b')]||null:null,'limit':_0xbbb126[_0x4594('0x1a')]?_0xbbb126['options'][_0x4594('0x1c')]||null:null})['then'](function(_0x32fb69){logger[_0x4594('0xe')](_0x4594('0x28'),_0xbbb126);logger['info'](_0x4594('0x29'),JSON[_0x4594('0x20')](_0xbbb126[_0x4594('0x1a')][_0x4594('0x24')]),_0xbbb126[_0x4594('0x27')][_0x4594('0x2a')]);logger['debug'](_0x4594('0x28'),_0xbbb126,JSON['stringify'](_0x32fb69));_0x303ac4(_0x32fb69);})[_0x4594('0x17')](function(_0x1e8d61){logger[_0x4594('0x12')](_0x4594('0x28'),_0x1e8d61[_0x4594('0x15')],_0xbbb126);_0x2cdbf5(_0x59a1ec[_0x4594('0x12')](0x1f4,_0x1e8d61[_0x4594('0x15')]));});});};exports[_0x4594('0x2b')]=function(_0x5f0a15){var _0x1e00f3=this;return new Promise(function(_0x4dbd7d,_0x255e5f){return db[_0x4594('0x19')]['destroy']({'where':_0x5f0a15[_0x4594('0x1a')]?_0x5f0a15['options'][_0x4594('0x24')]||null:null})[_0x4594('0xd')](function(_0xf858e0){logger['info']('DestroyCmHopper',_0x5f0a15);logger[_0x4594('0x10')]('DestroyCmHopper',_0x5f0a15,JSON[_0x4594('0x20')](_0xf858e0));_0x4dbd7d(_0xf858e0);})['catch'](function(_0x3f59d6){logger['error'](_0x4594('0x2b'),_0x3f59d6['message'],_0x5f0a15);_0x255e5f(_0x1e00f3[_0x4594('0x12')](0x1f4,_0x3f59d6[_0x4594('0x15')]));});});};exports[_0x4594('0x2c')]=function(_0x114afe){var _0x4862b6=this;return new Promise(function(_0x5c9c80,_0x41332f){return db[_0x4594('0x2d')][_0x4594('0x2e')]()[_0x4594('0xd')](function(_0x36fdb3){return db[_0x4594('0x2f')]['transaction'](function(_0x2015ee){return db[_0x4594('0x19')]['findAll']({'where':_0x114afe['options']?_0x114afe[_0x4594('0x1a')]['where']||null:null,'attributes':_0x114afe[_0x4594('0x1a')]?_0x114afe['options'][_0x4594('0x1b')]||null:null,'limit':_0x114afe[_0x4594('0x1a')]?_0x114afe['options'][_0x4594('0x1c')]||null:null,'order':_0x114afe['options']?_0x114afe[_0x4594('0x1a')][_0x4594('0x30')]||null:null,'transaction':_0x2015ee,'lock':_0x2015ee[_0x4594('0x31')][_0x4594('0x32')],'include':[{'model':db[_0x4594('0x2d')],'as':_0x4594('0x33'),'attributes':_['keys'](_0x36fdb3)},{'model':db['User'],'as':'Agent','attributes':['id',_0x4594('0x34'),_0x4594('0x35')]}]})['then'](function(_0x5ced9a){var _0x5bd788=[];var _0x3cce95=[];for(var _0x5a0882=0x0;_0x5a0882<_0x5ced9a[_0x4594('0x36')];_0x5a0882+=0x1){var _0x132e76=_0x5ced9a[_0x5a0882]['UserId'];if(_0x132e76===null){_0x5bd788['push'](_0x5ced9a[_0x5a0882][_0x4594('0x37')](_0x114afe[_0x4594('0x27')],{'transaction':_0x2015ee}));}else if(!_0x3cce95[_0x4594('0x38')](_0x132e76)){_0x3cce95[_0x4594('0x39')](_0x132e76);_0x5bd788[_0x4594('0x39')](_0x5ced9a[_0x5a0882][_0x4594('0x37')](_0x114afe[_0x4594('0x27')],{'transaction':_0x2015ee}));}}return BPromise[_0x4594('0x3a')](_0x5bd788);});})[_0x4594('0xd')](function(_0x18c61e){logger[_0x4594('0xe')]('GetContactDialer',_0x114afe);if(_0x18c61e[_0x4594('0x36')]>0x0){logger[_0x4594('0xe')](_0x4594('0x3b'),_0x18c61e[0x0]['dataValues']['id'],_0x18c61e[0x0]['dataValues'][_0x4594('0x3c')],_0x18c61e[0x0][_0x4594('0x3d')]['active']);}logger[_0x4594('0x10')](_0x4594('0x2c'),_0x114afe,JSON[_0x4594('0x20')](_0x18c61e));_0x5c9c80(_0x18c61e);})[_0x4594('0x17')](function(_0x11392){logger[_0x4594('0x12')](_0x4594('0x2c'),_0x11392[_0x4594('0x15')],_0x114afe);_0x41332f(_0x4862b6[_0x4594('0x12')](0x1f4,_0x11392['message']));});});});};exports[_0x4594('0x3e')]=function(_0x7d4d58){var _0xd8291=this;return new Promise(function(_0x2d5bbe,_0x194ded){return db[_0x4594('0x2f')][_0x4594('0x3f')](function(_0x459f01){return db[_0x4594('0x40')]['create'](_0x7d4d58[_0x4594('0x27')],{'raw':_0x7d4d58[_0x4594('0x1a')]?_0x7d4d58[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![],'transaction':_0x459f01})[_0x4594('0xd')](function(){logger[_0x4594('0xe')](_0x4594('0x41'),JSON[_0x4594('0x20')](_0x7d4d58['options'][_0x4594('0x24')]),_0x7d4d58[_0x4594('0x1a')]['where']['active']);return db[_0x4594('0x19')][_0x4594('0x42')]({'where':_0x7d4d58[_0x4594('0x1a')]?_0x7d4d58['options'][_0x4594('0x24')]||null:null,'transaction':_0x459f01});});})[_0x4594('0xd')](function(_0x2d0ba1){logger[_0x4594('0xe')]('MoveContactManagedDialer',_0x7d4d58);logger[_0x4594('0x10')](_0x4594('0x3e'),_0x7d4d58,JSON[_0x4594('0x20')](_0x2d0ba1));_0x2d5bbe(_0x2d0ba1);})['catch'](function(_0x408462){logger['error'](_0x4594('0x3e'),_0x408462[_0x4594('0x15')],_0x7d4d58);_0x194ded(_0xd8291[_0x4594('0x12')](0x1f4,_0x408462[_0x4594('0x15')]));});});};exports['CountReScheduled']=function(_0x45425b){var _0x1558ba=this;return new Promise(function(_0x54a001,_0x3ed868){return db[_0x4594('0x19')]['findAll']({'raw':_0x45425b[_0x4594('0x1a')]?_0x45425b[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![],'where':_0x45425b[_0x4594('0x1a')]?_0x45425b['options'][_0x4594('0x24')]||null:null,'attributes':[[db[_0x4594('0x2f')]['fn'](_0x4594('0x43'),db[_0x4594('0x2f')]['fn']('IF',db[_0x4594('0x2f')][_0x4594('0x44')](_0x4594('0x45')+util[_0x4594('0x46')](_0x4594('0x47'),moment()[_0x4594('0x46')](_0x4594('0x48')))+'\x20,\x201,\x20null'))),_0x4594('0x49')]]})[_0x4594('0xd')](function(_0x4ee5ae){logger[_0x4594('0xe')]('CountReScheduled',_0x45425b);logger['debug']('CountReScheduled',_0x45425b,JSON['stringify'](_0x4ee5ae));_0x54a001(_0x4ee5ae);})[_0x4594('0x17')](function(_0x2cb9d0){logger['error'](_0x4594('0x4a'),_0x2cb9d0[_0x4594('0x15')],_0x45425b);_0x3ed868(_0x1558ba[_0x4594('0x12')](0x1f4,_0x2cb9d0[_0x4594('0x15')]));});});};exports[_0x4594('0x4b')]=function(_0x1bd358){var _0x4b8cce=this;return new Promise(function(_0x12a4f9,_0x3d3061){return db[_0x4594('0x2d')][_0x4594('0x2e')]()[_0x4594('0xd')](function(_0x2561a6){return db[_0x4594('0x2f')]['transaction'](function(_0xf3b1b1){return db['CmHopper']['findAll']({'where':_0x1bd358['options']?_0x1bd358[_0x4594('0x1a')]['where']||null:null,'attributes':_0x1bd358[_0x4594('0x1a')]?_0x1bd358['options']['attributes']||null:null,'limit':0x1,'order':_0x1bd358[_0x4594('0x1a')]?_0x1bd358[_0x4594('0x1a')][_0x4594('0x30')]||null:null,'group':db[_0x4594('0x19')][_0x4594('0x4c')],'transaction':_0xf3b1b1,'lock':_0xf3b1b1[_0x4594('0x31')][_0x4594('0x32')],'include':_0x1bd358[_0x4594('0x1a')]?_0x1bd358[_0x4594('0x1a')][_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x1bd358[_0x4594('0x1a')][_0x4594('0x1e')],function(_0xfba556){return{'model':db[_0xfba556[_0x4594('0x1f')]],'as':_0xfba556['as'],'attributes':_0xfba556['attributes'],'include':_0xfba556[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0xfba556['include'],function(_0x36faf8){return{'model':db[_0x36faf8['model']],'as':_0x36faf8['as'],'attributes':_0x36faf8['attributes'],'include':_0x36faf8[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x36faf8[_0x4594('0x1e')],function(_0x4cb727){return{'model':db[_0x4cb727[_0x4594('0x1f')]],'as':_0x4cb727['as'],'attributes':_0x4cb727[_0x4594('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4594('0xd')](function(_0x4339ab){var _0x1c56dc=[];for(var _0x4fb5b2=0x0;_0x4fb5b2<_0x4339ab[_0x4594('0x36')];_0x4fb5b2+=0x1){_0x1c56dc['push'](_0x4339ab[_0x4fb5b2]['update'](_0x1bd358[_0x4594('0x27')],{'transaction':_0xf3b1b1}));}return BPromise[_0x4594('0x3a')](_0x1c56dc);});})[_0x4594('0xd')](function(_0x1b3303){logger[_0x4594('0xe')](_0x4594('0x4b'),_0x1bd358);logger['debug']('GetContactRecallMe',_0x1bd358,JSON['stringify'](_0x1b3303));_0x12a4f9(_0x1b3303);})[_0x4594('0x17')](function(_0x28e5fe){logger[_0x4594('0x12')](_0x4594('0x4b'),_0x28e5fe[_0x4594('0x15')],_0x1bd358);_0x3d3061(_0x4b8cce[_0x4594('0x12')](0x1f4,_0x28e5fe['message']));});});});};exports[_0x4594('0x4d')]=function(_0x9902d7){var _0x393e88=this;return new Promise(function(_0x256650,_0x46c759){db[_0x4594('0x2d')][_0x4594('0x2e')]()[_0x4594('0xd')](function(_0x102672){return db['CmHopper'][_0x4594('0x4e')]({'raw':_0x9902d7['options']?_0x9902d7[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![],'where':_0x9902d7[_0x4594('0x1a')]?_0x9902d7[_0x4594('0x1a')][_0x4594('0x24')]||null:null,'attributes':_0x9902d7[_0x4594('0x1a')]?_0x9902d7[_0x4594('0x1a')]['attributes']||null:null,'limit':_0x9902d7[_0x4594('0x1a')]?_0x9902d7[_0x4594('0x1a')][_0x4594('0x1c')]||null:null,'include':_0x9902d7[_0x4594('0x1a')]?_0x9902d7['options']['include']?_['map'](_0x9902d7[_0x4594('0x1a')][_0x4594('0x1e')],function(_0xb2583e){return{'model':db[_0xb2583e[_0x4594('0x1f')]],'as':_0xb2583e['as'],'attributes':_0xb2583e['as']===_0x4594('0x33')?_['keys'](_0x102672):_0xb2583e[_0x4594('0x1b')],'include':_0xb2583e[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0xb2583e[_0x4594('0x1e')],function(_0x26ae25){return{'model':db[_0x26ae25['model']],'as':_0x26ae25['as'],'attributes':_0x26ae25[_0x4594('0x1b')],'include':_0x26ae25[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x26ae25['include'],function(_0xfe2027){return{'model':db[_0xfe2027[_0x4594('0x1f')]],'as':_0xfe2027['as'],'attributes':_0xfe2027[_0x4594('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4594('0xd')](function(_0x4eb552){logger[_0x4594('0xe')]('GetCmHopper',_0x9902d7);logger['debug'](_0x4594('0x18'),_0x9902d7,JSON[_0x4594('0x20')](_0x4eb552));_0x256650(_0x4eb552);})[_0x4594('0x17')](function(_0x12e9f){logger['error']('GetCmHopper',_0x12e9f['message'],_0x9902d7);_0x46c759(_0x393e88[_0x4594('0x12')](0x1f4,_0x12e9f['message']));});});});};exports[_0x4594('0x4f')]=function(_0x2d0662){var _0x523966=this;return new Promise(function(_0x3bc7ff,_0x4fcf48){return db[_0x4594('0x2d')]['findOne']({'raw':!![],'where':{'phone':_0x2d0662['options'][_0x4594('0x24')][_0x4594('0x50')]},'attributes':['id',_0x4594('0x51')],'order':[['id',_0x4594('0x52')]]})[_0x4594('0xd')](function(_0x420a76){logger[_0x4594('0xe')](_0x4594('0x53'),_0x2d0662);logger[_0x4594('0x10')](_0x4594('0x53'),_0x2d0662,JSON[_0x4594('0x20')](_0x420a76));_0x3bc7ff(_0x420a76);})['catch'](function(_0x20feba){logger[_0x4594('0x12')](_0x4594('0x53'),_0x20feba[_0x4594('0x15')],_0x2d0662);_0x4fcf48(_0x523966[_0x4594('0x12')](0x1f4,_0x20feba[_0x4594('0x15')]));});});};exports[_0x4594('0x54')]=function(_0x39bf3b){var _0x493dab=this;return new Promise(function(_0x4214e9,_0x428959){return db[_0x4594('0x2f')][_0x4594('0x3f')](function(_0x532762){return db[_0x4594('0x19')]['update']({'active':![]},{'where':{},'transaction':_0x532762})[_0x4594('0xd')](function(_0x5b27e7){logger[_0x4594('0xe')]('ResetActiveCalls',_0x39bf3b);logger['debug'](_0x4594('0x54'),_0x39bf3b,JSON['stringify'](_0x5b27e7));_0x4214e9(_0x5b27e7);})[_0x4594('0x17')](function(_0x2dfbef){logger[_0x4594('0x12')]('ResetActiveCalls',_0x2dfbef[_0x4594('0x15')],_0x39bf3b);_0x428959(_0x493dab[_0x4594('0x12')](0x1f4,_0x2dfbef[_0x4594('0x15')]));});});});};exports[_0x4594('0x55')]=function(_0x18757e){var _0x3820a1=this;var _0x463627=_0x18757e[_0x4594('0x27')][_0x4594('0x24')][_0x4594('0x56')];var _0x37f6f9=_0x18757e['body']['where'][_0x4594('0x57')];return new Promise(function(_0x353425,_0x47b00a){return db[_0x4594('0x19')][_0x4594('0x4e')]({'where':{'voiceQueueId':_0x463627,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x4594('0x2f')][_0x4594('0x44')](_0x4594('0x58')+_0x37f6f9+_0x4594('0x59'))}},'include':[{'model':db[_0x4594('0x2d')],'as':'Contact'},{'model':db[_0x4594('0x5a')],'as':_0x4594('0x5b'),'attributes':['id',_0x4594('0x34'),_0x4594('0x35')]},{'model':db['CmList'],'as':_0x4594('0x5c')}]})[_0x4594('0xd')](function(_0x477d73){return db[_0x4594('0x2f')][_0x4594('0x3f')](function(_0x58489f){return db['CmHopper']['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x463627,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x4594('0x2f')]['literal'](_0x4594('0x58')+_0x37f6f9+_0x4594('0x59'))}},'transaction':_0x58489f})[_0x4594('0xd')](function(_0x233f87){_0x353425(_0x477d73);})['catch'](function(_0x1cb2bc){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x1cb2bc['message'],_0x18757e);_0x47b00a(validateExpressRequest);});});})[_0x4594('0x17')](function(_0x38b90a){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x38b90a[_0x4594('0x15')],_0x18757e);_0x47b00a(_0x3820a1['error'](0x1f4,_0x38b90a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f96dcb7..50f09cf 100644 --- a/server/api/cmHopper/index.js +++ b/server/api/cmHopper/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b3a=['getPreview','/previewrecall','put','update','delete','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','post','create'];(function(_0x37463e,_0xb4c74c){var _0x25aaaf=function(_0x203c83){while(--_0x203c83){_0x37463e['push'](_0x37463e['shift']());}};_0x25aaaf(++_0xb4c74c);}(_0x6b3a,0x1af));var _0xa6b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b3a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa6b3('0x0'));var util=require('util');var path=require(_0xa6b3('0x1'));var timeout=require('connect-timeout');var express=require(_0xa6b3('0x2'));var router=express['Router']();var fs_extra=require(_0xa6b3('0x3'));var auth=require(_0xa6b3('0x4'));var interaction=require(_0xa6b3('0x5'));var config=require(_0xa6b3('0x6'));var controller=require(_0xa6b3('0x7'));router[_0xa6b3('0x8')]('/',auth[_0xa6b3('0x9')](),controller['index']);router[_0xa6b3('0x8')](_0xa6b3('0xa'),auth[_0xa6b3('0x9')](),controller[_0xa6b3('0xb')]);router[_0xa6b3('0x8')](_0xa6b3('0xc'),auth['isAuthenticated'](),controller[_0xa6b3('0xd')]);router[_0xa6b3('0x8')]('/timezones',auth[_0xa6b3('0x9')](),controller[_0xa6b3('0xe')]);router[_0xa6b3('0x8')](_0xa6b3('0xf'),auth['isAuthenticated'](),controller[_0xa6b3('0x10')]);router[_0xa6b3('0x11')]('/',auth[_0xa6b3('0x9')](),controller[_0xa6b3('0x12')]);router[_0xa6b3('0x11')]('/preview',auth[_0xa6b3('0x9')](),controller[_0xa6b3('0x13')]);router[_0xa6b3('0x11')]('/timezone',auth[_0xa6b3('0x9')](),controller['getTimezone']);router[_0xa6b3('0x11')](_0xa6b3('0x14'),auth[_0xa6b3('0x9')](),controller['getPreviewRecall']);router[_0xa6b3('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xa6b3('0x16')]);router[_0xa6b3('0x17')](_0xa6b3('0xf'),auth[_0xa6b3('0x9')](),controller['destroy']);module[_0xa6b3('0x18')]=router; \ No newline at end of file +var _0xd8c0=['create','/preview','getPreview','/timezone','getTimezone','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','isAuthenticated','index','/describe','get','/:id','show','post'];(function(_0x1cf4ca,_0x19ac0c){var _0x2a4469=function(_0xabf342){while(--_0xabf342){_0x1cf4ca['push'](_0x1cf4ca['shift']());}};_0x2a4469(++_0x19ac0c);}(_0xd8c0,0x76));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0d8c('0x0'));var util=require(_0x0d8c('0x1'));var path=require('path');var timeout=require(_0x0d8c('0x2'));var express=require('express');var router=express[_0x0d8c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0d8c('0x4'));var interaction=require(_0x0d8c('0x5'));var config=require('../../config/environment');var controller=require(_0x0d8c('0x6'));router['get']('/',auth[_0x0d8c('0x7')](),controller[_0x0d8c('0x8')]);router['get'](_0x0d8c('0x9'),auth[_0x0d8c('0x7')](),controller['describe']);router[_0x0d8c('0xa')]('/opencontacts',auth[_0x0d8c('0x7')](),controller['getOpenContacts']);router[_0x0d8c('0xa')]('/timezones',auth['isAuthenticated'](),controller['getTimezones']);router[_0x0d8c('0xa')](_0x0d8c('0xb'),auth[_0x0d8c('0x7')](),controller[_0x0d8c('0xc')]);router[_0x0d8c('0xd')]('/',auth['isAuthenticated'](),controller[_0x0d8c('0xe')]);router[_0x0d8c('0xd')](_0x0d8c('0xf'),auth[_0x0d8c('0x7')](),controller[_0x0d8c('0x10')]);router[_0x0d8c('0xd')](_0x0d8c('0x11'),auth[_0x0d8c('0x7')](),controller[_0x0d8c('0x12')]);router[_0x0d8c('0xd')]('/previewrecall',auth[_0x0d8c('0x7')](),controller['getPreviewRecall']);router['put'](_0x0d8c('0xb'),auth[_0x0d8c('0x7')](),controller[_0x0d8c('0x13')]);router[_0x0d8c('0x14')]('/:id',auth[_0x0d8c('0x7')](),controller[_0x0d8c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index cb3116f..6c0b160 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.attributes.js +++ b/server/api/cmHopperBlack/cmHopperBlack.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce68=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x4758d3,_0x2dedd7){var _0x2f1293=function(_0x3df457){while(--_0x3df457){_0x4758d3['push'](_0x4758d3['shift']());}};_0x2f1293(++_0x2dedd7);}(_0xce68,0x10c));var _0x8ce6=function(_0x5e0431,_0x2d85ad){_0x5e0431=_0x5e0431-0x0;var _0x4a4c84=_0xce68[_0x5e0431];return _0x4a4c84;};'use strict';var moment=require(_0x8ce6('0x0'));var Sequelize=require('sequelize');module[_0x8ce6('0x1')]={'phone':{'type':Sequelize[_0x8ce6('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8ce6('0x3')],'unique':_0x8ce6('0x4')},'ListId':{'type':Sequelize[_0x8ce6('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x8ce6('0x3')],'unique':_0x8ce6('0x4')}}; \ No newline at end of file +var _0xee14=['INTEGER','contactListQueue','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee14,0x13a));var _0x4ee1=function(_0x9986e0,_0x2f99de){_0x9986e0=_0x9986e0-0x0;var _0x46594f=_0xee14[_0x9986e0];return _0x46594f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4ee1('0x0')]={'phone':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4ee1('0x2')],'unique':_0x4ee1('0x3')},'ListId':{'type':Sequelize[_0x4ee1('0x2')],'unique':_0x4ee1('0x3')},'VoiceQueueId':{'type':Sequelize[_0x4ee1('0x2')],'unique':_0x4ee1('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0e29690..59da5dd 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2624=['CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','update','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x2624,0x191));var _0x4262=function(_0x3a2988,_0x1de78d){_0x3a2988=_0x3a2988-0x0;var _0x14d831=_0x2624[_0x3a2988];return _0x14d831;};'use strict';var emlformat=require(_0x4262('0x0'));var rimraf=require(_0x4262('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4262('0x2'));var rp=require(_0x4262('0x3'));var moment=require('moment');var BPromise=require(_0x4262('0x4'));var Mustache=require(_0x4262('0x5'));var util=require(_0x4262('0x6'));var path=require(_0x4262('0x7'));var sox=require('sox');var csv=require(_0x4262('0x8'));var ejs=require(_0x4262('0x9'));var fs=require('fs');var fs_extra=require(_0x4262('0xa'));var _=require(_0x4262('0xb'));var squel=require('squel');var crypto=require(_0x4262('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4262('0xd'));var toCsv=require(_0x4262('0x8'));var querystring=require(_0x4262('0xe'));var Papa=require('papaparse');var Redis=require(_0x4262('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4262('0x10'));var hardwareService=require(_0x4262('0x11'));var logger=require(_0x4262('0x12'))(_0x4262('0x13'));var utils=require(_0x4262('0x14'));var config=require(_0x4262('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cb67e,_0xce5912){_0xce5912=_0xce5912||0xcc;return function(_0xb896e1){if(_0xb896e1){return _0x1cb67e[_0x4262('0x16')](_0xce5912);}return _0x1cb67e[_0x4262('0x17')](_0xce5912)[_0x4262('0x18')]();};}function respondWithResult(_0x252ec9,_0x36c1f3){_0x36c1f3=_0x36c1f3||0xc8;return function(_0x440e5f){if(_0x440e5f){return _0x252ec9['status'](_0x36c1f3)[_0x4262('0x19')](_0x440e5f);}};}function respondWithFilteredResult(_0x9b16db,_0x1d8228){return function(_0x56f691){if(_0x56f691){var _0x3d9644=typeof _0x1d8228['offset']===_0x4262('0x1a')&&typeof _0x1d8228[_0x4262('0x1b')]===_0x4262('0x1a');var _0x189d87=_0x56f691['count'];var _0x2644d5=_0x3d9644?0x0:_0x1d8228['offset'];var _0x1a0729=_0x3d9644?_0x56f691[_0x4262('0x1c')]:_0x1d8228[_0x4262('0x1d')]+_0x1d8228[_0x4262('0x1b')];var _0x490d4c;if(_0x1a0729>=_0x189d87){_0x1a0729=_0x189d87;_0x490d4c=0xc8;}else{_0x490d4c=0xce;}_0x9b16db['status'](_0x490d4c);return _0x9b16db[_0x4262('0x1e')](_0x4262('0x1f'),_0x2644d5+'-'+_0x1a0729+'/'+_0x189d87)['json'](_0x56f691);}return null;};}function patchUpdates(_0x59c95b){return function(_0x40c034){try{jsonpatch[_0x4262('0x20')](_0x40c034,_0x59c95b,!![]);}catch(_0x16435e){return BPromise[_0x4262('0x21')](_0x16435e);}return _0x40c034[_0x4262('0x22')]();};}function saveUpdates(_0x230b15,_0x44aadc){return function(_0x3d0cbf){if(_0x3d0cbf){return _0x3d0cbf['update'](_0x230b15)['then'](function(_0x2987cb){return _0x2987cb;});}return null;};}function removeEntity(_0x1a4fd8,_0x348922){return function(_0x516fee){if(_0x516fee){return _0x516fee[_0x4262('0x23')]()[_0x4262('0x24')](function(){_0x1a4fd8[_0x4262('0x17')](0xcc)[_0x4262('0x18')]();});}};}function handleEntityNotFound(_0x2baad6,_0x9b50d9){return function(_0x16d487){if(!_0x16d487){_0x2baad6[_0x4262('0x16')](0x194);}return _0x16d487;};}function handleError(_0x580b00,_0x20230c){_0x20230c=_0x20230c||0x1f4;return function(_0x76e198){logger[_0x4262('0x25')](_0x76e198[_0x4262('0x26')]);if(_0x76e198[_0x4262('0x27')]){delete _0x76e198['name'];}_0x580b00['status'](_0x20230c)[_0x4262('0x28')](_0x76e198);};}exports[_0x4262('0x29')]=function(_0x3ac90,_0x2c6ea9){var _0x4bdd7e={},_0x3136e8={},_0x2002fa={'count':0x0,'rows':[]};var _0x1a8533=_[_0x4262('0x2a')](db[_0x4262('0x2b')][_0x4262('0x2c')],function(_0x54d185){return{'name':_0x54d185[_0x4262('0x2d')],'type':_0x54d185['type'][_0x4262('0x2e')]};});_0x3136e8[_0x4262('0x2f')]=_[_0x4262('0x2a')](_0x1a8533,_0x4262('0x27'));_0x3136e8[_0x4262('0x30')]=_[_0x4262('0x31')](_0x3ac90[_0x4262('0x30')]);_0x3136e8[_0x4262('0x32')]=_[_0x4262('0x33')](_0x3136e8['model'],_0x3136e8['query']);_0x4bdd7e[_0x4262('0x34')]=_[_0x4262('0x33')](_0x3136e8['model'],qs[_0x4262('0x35')](_0x3ac90[_0x4262('0x30')][_0x4262('0x35')]));_0x4bdd7e[_0x4262('0x34')]=_0x4bdd7e['attributes'][_0x4262('0x36')]?_0x4bdd7e[_0x4262('0x34')]:_0x3136e8[_0x4262('0x2f')];if(!_0x3ac90[_0x4262('0x30')][_0x4262('0x37')](_0x4262('0x38'))){_0x4bdd7e[_0x4262('0x1b')]=qs[_0x4262('0x1b')](_0x3ac90[_0x4262('0x30')][_0x4262('0x1b')]);_0x4bdd7e[_0x4262('0x1d')]=qs[_0x4262('0x1d')](_0x3ac90['query'][_0x4262('0x1d')]);}_0x4bdd7e['order']=qs[_0x4262('0x39')](_0x3ac90[_0x4262('0x30')]['sort']);_0x4bdd7e[_0x4262('0x3a')]=qs[_0x4262('0x32')](_[_0x4262('0x3b')](_0x3ac90[_0x4262('0x30')],_0x3136e8['filters']),_0x1a8533);if(_0x3ac90['query'][_0x4262('0x3c')]){_0x4bdd7e['where']=_[_0x4262('0x3d')](_0x4bdd7e[_0x4262('0x3a')],{'$or':_[_0x4262('0x2a')](_0x1a8533,function(_0x3366ae){if(_0x3366ae[_0x4262('0x3e')]!=='VIRTUAL'){var _0x1099fa={};_0x1099fa[_0x3366ae[_0x4262('0x27')]]={'$like':'%'+_0x3ac90['query'][_0x4262('0x3c')]+'%'};return _0x1099fa;}})});}_0x4bdd7e=_[_0x4262('0x3d')]({},_0x4bdd7e,_0x3ac90[_0x4262('0x3f')]);var _0x343bec={'where':_0x4bdd7e['where']};return db[_0x4262('0x2b')][_0x4262('0x1c')](_0x343bec)[_0x4262('0x24')](function(_0xc3917){_0x2002fa[_0x4262('0x1c')]=_0xc3917;if(_0x3ac90['query'][_0x4262('0x40')]){_0x4bdd7e[_0x4262('0x41')]=[{'all':!![]}];}return db[_0x4262('0x2b')]['findAll'](_0x4bdd7e);})[_0x4262('0x24')](function(_0x42a5d0){_0x2002fa[_0x4262('0x42')]=_0x42a5d0;return _0x2002fa;})[_0x4262('0x24')](respondWithFilteredResult(_0x2c6ea9,_0x4bdd7e))[_0x4262('0x43')](handleError(_0x2c6ea9,null));};exports[_0x4262('0x44')]=function(_0x723eb9,_0x1d1d4c){var _0x53332e={'raw':!![],'where':{'id':_0x723eb9[_0x4262('0x45')]['id']}},_0x102430={};_0x102430['model']=_[_0x4262('0x31')](db[_0x4262('0x2b')][_0x4262('0x2c')]);_0x102430['query']=_[_0x4262('0x31')](_0x723eb9[_0x4262('0x30')]);_0x102430['filters']=_[_0x4262('0x33')](_0x102430['model'],_0x102430[_0x4262('0x30')]);_0x53332e[_0x4262('0x34')]=_['intersection'](_0x102430['model'],qs[_0x4262('0x35')](_0x723eb9[_0x4262('0x30')][_0x4262('0x35')]));_0x53332e[_0x4262('0x34')]=_0x53332e['attributes'][_0x4262('0x36')]?_0x53332e['attributes']:_0x102430[_0x4262('0x2f')];if(_0x723eb9[_0x4262('0x30')][_0x4262('0x40')]){_0x53332e[_0x4262('0x41')]=[{'all':!![]}];}_0x53332e=_[_0x4262('0x3d')]({},_0x53332e,_0x723eb9[_0x4262('0x3f')]);return db['CmHopperBlack']['find'](_0x53332e)[_0x4262('0x24')](handleEntityNotFound(_0x1d1d4c,null))['then'](respondWithResult(_0x1d1d4c,null))[_0x4262('0x43')](handleError(_0x1d1d4c,null));};exports[_0x4262('0x46')]=function(_0x414721,_0x2bdf96){if(_0x414721[_0x4262('0x47')]['id']){delete _0x414721[_0x4262('0x47')]['id'];}return db[_0x4262('0x2b')][_0x4262('0x48')]({'where':{'id':_0x414721[_0x4262('0x45')]['id']}})[_0x4262('0x24')](handleEntityNotFound(_0x2bdf96,null))[_0x4262('0x24')](saveUpdates(_0x414721[_0x4262('0x47')],null))[_0x4262('0x24')](respondWithResult(_0x2bdf96,null))[_0x4262('0x43')](handleError(_0x2bdf96,null));};exports[_0x4262('0x23')]=function(_0x317b94,_0x4771cc){return db[_0x4262('0x2b')][_0x4262('0x48')]({'where':{'id':_0x317b94['params']['id']}})[_0x4262('0x24')](handleEntityNotFound(_0x4771cc,null))[_0x4262('0x24')](removeEntity(_0x4771cc,null))[_0x4262('0x43')](handleError(_0x4771cc,null));};exports[_0x4262('0x49')]=function(_0x2c0b0f,_0x3b7f1a){return db[_0x4262('0x2b')]['describe']()[_0x4262('0x24')](respondWithResult(_0x3b7f1a,null))[_0x4262('0x43')](handleError(_0x3b7f1a,null));}; \ No newline at end of file +var _0x6f86=['then','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x6f86,0x197));var _0x66f8=function(_0x3b1bba,_0x220536){_0x3b1bba=_0x3b1bba-0x0;var _0x4ca374=_0x6f86[_0x3b1bba];return _0x4ca374;};'use strict';var emlformat=require(_0x66f8('0x0'));var rimraf=require(_0x66f8('0x1'));var zipdir=require(_0x66f8('0x2'));var jsonpatch=require(_0x66f8('0x3'));var rp=require(_0x66f8('0x4'));var moment=require(_0x66f8('0x5'));var BPromise=require(_0x66f8('0x6'));var Mustache=require(_0x66f8('0x7'));var util=require(_0x66f8('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x66f8('0x9'));var ejs=require(_0x66f8('0xa'));var fs=require('fs');var fs_extra=require(_0x66f8('0xb'));var _=require(_0x66f8('0xc'));var squel=require(_0x66f8('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x66f8('0xe'));var toCsv=require(_0x66f8('0x9'));var querystring=require(_0x66f8('0xf'));var Papa=require(_0x66f8('0x10'));var Redis=require(_0x66f8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x66f8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66f8('0x13'));var logger=require('../../config/logger')(_0x66f8('0x14'));var utils=require(_0x66f8('0x15'));var config=require(_0x66f8('0x16'));var licenseUtil=require(_0x66f8('0x17'));var db=require(_0x66f8('0x18'))['db'];function respondWithStatusCode(_0x225caf,_0x36f9bc){_0x36f9bc=_0x36f9bc||0xcc;return function(_0x1796bc){if(_0x1796bc){return _0x225caf[_0x66f8('0x19')](_0x36f9bc);}return _0x225caf[_0x66f8('0x1a')](_0x36f9bc)[_0x66f8('0x1b')]();};}function respondWithResult(_0x2d0147,_0xf269fe){_0xf269fe=_0xf269fe||0xc8;return function(_0x5e245f){if(_0x5e245f){return _0x2d0147['status'](_0xf269fe)[_0x66f8('0x1c')](_0x5e245f);}};}function respondWithFilteredResult(_0x40159e,_0x4a64d3){return function(_0x204240){if(_0x204240){var _0x1f2376=typeof _0x4a64d3[_0x66f8('0x1d')]===_0x66f8('0x1e')&&typeof _0x4a64d3['limit']===_0x66f8('0x1e');var _0x3db726=_0x204240[_0x66f8('0x1f')];var _0xf303e9=_0x1f2376?0x0:_0x4a64d3[_0x66f8('0x1d')];var _0x44abdb=_0x1f2376?_0x204240['count']:_0x4a64d3[_0x66f8('0x1d')]+_0x4a64d3[_0x66f8('0x20')];var _0x47e957;if(_0x44abdb>=_0x3db726){_0x44abdb=_0x3db726;_0x47e957=0xc8;}else{_0x47e957=0xce;}_0x40159e[_0x66f8('0x1a')](_0x47e957);return _0x40159e['set'](_0x66f8('0x21'),_0xf303e9+'-'+_0x44abdb+'/'+_0x3db726)[_0x66f8('0x1c')](_0x204240);}return null;};}function patchUpdates(_0x2aa624){return function(_0xeae797){try{jsonpatch[_0x66f8('0x22')](_0xeae797,_0x2aa624,!![]);}catch(_0x1c61ab){return BPromise[_0x66f8('0x23')](_0x1c61ab);}return _0xeae797['save']();};}function saveUpdates(_0x4db568,_0x3189b0){return function(_0x340b6e){if(_0x340b6e){return _0x340b6e[_0x66f8('0x24')](_0x4db568)[_0x66f8('0x25')](function(_0x5793d1){return _0x5793d1;});}return null;};}function removeEntity(_0x392203,_0x5832c5){return function(_0x4aae92){if(_0x4aae92){return _0x4aae92['destroy']()[_0x66f8('0x25')](function(){_0x392203[_0x66f8('0x1a')](0xcc)[_0x66f8('0x1b')]();});}};}function handleEntityNotFound(_0x462091,_0x12117e){return function(_0x5e7192){if(!_0x5e7192){_0x462091[_0x66f8('0x19')](0x194);}return _0x5e7192;};}function handleError(_0x607cdb,_0x3592e2){_0x3592e2=_0x3592e2||0x1f4;return function(_0x16a20d){logger[_0x66f8('0x26')](_0x16a20d[_0x66f8('0x27')]);if(_0x16a20d['name']){delete _0x16a20d[_0x66f8('0x28')];}_0x607cdb[_0x66f8('0x1a')](_0x3592e2)['send'](_0x16a20d);};}exports[_0x66f8('0x29')]=function(_0x252d19,_0x19f00d){var _0x7b9110={},_0x1c23c9={},_0x38bbbd={'count':0x0,'rows':[]};var _0x1c2ab1=_[_0x66f8('0x2a')](db[_0x66f8('0x2b')][_0x66f8('0x2c')],function(_0x24ae49){return{'name':_0x24ae49[_0x66f8('0x2d')],'type':_0x24ae49['type'][_0x66f8('0x2e')]};});_0x1c23c9[_0x66f8('0x2f')]=_[_0x66f8('0x2a')](_0x1c2ab1,'name');_0x1c23c9['query']=_[_0x66f8('0x30')](_0x252d19[_0x66f8('0x31')]);_0x1c23c9[_0x66f8('0x32')]=_[_0x66f8('0x33')](_0x1c23c9[_0x66f8('0x2f')],_0x1c23c9[_0x66f8('0x31')]);_0x7b9110['attributes']=_[_0x66f8('0x33')](_0x1c23c9[_0x66f8('0x2f')],qs['fields'](_0x252d19['query'][_0x66f8('0x34')]));_0x7b9110[_0x66f8('0x35')]=_0x7b9110[_0x66f8('0x35')][_0x66f8('0x36')]?_0x7b9110[_0x66f8('0x35')]:_0x1c23c9[_0x66f8('0x2f')];if(!_0x252d19['query'][_0x66f8('0x37')]('nolimit')){_0x7b9110[_0x66f8('0x20')]=qs['limit'](_0x252d19[_0x66f8('0x31')][_0x66f8('0x20')]);_0x7b9110[_0x66f8('0x1d')]=qs['offset'](_0x252d19[_0x66f8('0x31')]['offset']);}_0x7b9110[_0x66f8('0x38')]=qs[_0x66f8('0x39')](_0x252d19[_0x66f8('0x31')][_0x66f8('0x39')]);_0x7b9110[_0x66f8('0x3a')]=qs['filters'](_[_0x66f8('0x3b')](_0x252d19[_0x66f8('0x31')],_0x1c23c9['filters']),_0x1c2ab1);if(_0x252d19[_0x66f8('0x31')]['filter']){_0x7b9110[_0x66f8('0x3a')]=_[_0x66f8('0x3c')](_0x7b9110['where'],{'$or':_[_0x66f8('0x2a')](_0x1c2ab1,function(_0x565c5e){if(_0x565c5e['type']!==_0x66f8('0x3d')){var _0x1fa628={};_0x1fa628[_0x565c5e[_0x66f8('0x28')]]={'$like':'%'+_0x252d19['query'][_0x66f8('0x3e')]+'%'};return _0x1fa628;}})});}_0x7b9110=_[_0x66f8('0x3c')]({},_0x7b9110,_0x252d19[_0x66f8('0x3f')]);var _0x26752b={'where':_0x7b9110[_0x66f8('0x3a')]};return db[_0x66f8('0x2b')]['count'](_0x26752b)[_0x66f8('0x25')](function(_0x40eb85){_0x38bbbd[_0x66f8('0x1f')]=_0x40eb85;if(_0x252d19['query'][_0x66f8('0x40')]){_0x7b9110[_0x66f8('0x41')]=[{'all':!![]}];}return db[_0x66f8('0x2b')]['findAll'](_0x7b9110);})[_0x66f8('0x25')](function(_0x5b7da0){_0x38bbbd[_0x66f8('0x42')]=_0x5b7da0;return _0x38bbbd;})[_0x66f8('0x25')](respondWithFilteredResult(_0x19f00d,_0x7b9110))[_0x66f8('0x43')](handleError(_0x19f00d,null));};exports[_0x66f8('0x44')]=function(_0x2bbee0,_0x28462e){var _0x1748ab={'raw':!![],'where':{'id':_0x2bbee0[_0x66f8('0x45')]['id']}},_0x5ebeea={};_0x5ebeea['model']=_['keys'](db['CmHopperBlack'][_0x66f8('0x2c')]);_0x5ebeea[_0x66f8('0x31')]=_[_0x66f8('0x30')](_0x2bbee0['query']);_0x5ebeea['filters']=_[_0x66f8('0x33')](_0x5ebeea[_0x66f8('0x2f')],_0x5ebeea[_0x66f8('0x31')]);_0x1748ab['attributes']=_[_0x66f8('0x33')](_0x5ebeea['model'],qs[_0x66f8('0x34')](_0x2bbee0[_0x66f8('0x31')][_0x66f8('0x34')]));_0x1748ab[_0x66f8('0x35')]=_0x1748ab[_0x66f8('0x35')][_0x66f8('0x36')]?_0x1748ab[_0x66f8('0x35')]:_0x5ebeea['model'];if(_0x2bbee0[_0x66f8('0x31')]['includeAll']){_0x1748ab['include']=[{'all':!![]}];}_0x1748ab=_[_0x66f8('0x3c')]({},_0x1748ab,_0x2bbee0[_0x66f8('0x3f')]);return db[_0x66f8('0x2b')]['find'](_0x1748ab)['then'](handleEntityNotFound(_0x28462e,null))[_0x66f8('0x25')](respondWithResult(_0x28462e,null))[_0x66f8('0x43')](handleError(_0x28462e,null));};exports[_0x66f8('0x24')]=function(_0x1b6f1f,_0x5eefa1){if(_0x1b6f1f['body']['id']){delete _0x1b6f1f[_0x66f8('0x46')]['id'];}return db[_0x66f8('0x2b')]['find']({'where':{'id':_0x1b6f1f[_0x66f8('0x45')]['id']}})[_0x66f8('0x25')](handleEntityNotFound(_0x5eefa1,null))[_0x66f8('0x25')](saveUpdates(_0x1b6f1f[_0x66f8('0x46')],null))[_0x66f8('0x25')](respondWithResult(_0x5eefa1,null))[_0x66f8('0x43')](handleError(_0x5eefa1,null));};exports[_0x66f8('0x47')]=function(_0x50aceb,_0x1eb937){return db[_0x66f8('0x2b')][_0x66f8('0x48')]({'where':{'id':_0x50aceb[_0x66f8('0x45')]['id']}})[_0x66f8('0x25')](handleEntityNotFound(_0x1eb937,null))[_0x66f8('0x25')](removeEntity(_0x1eb937,null))['catch'](handleError(_0x1eb937,null));};exports[_0x66f8('0x49')]=function(_0x1a0442,_0x565c63){return db[_0x66f8('0x2b')][_0x66f8('0x49')]()[_0x66f8('0x25')](respondWithResult(_0x565c63,null))['catch'](handleError(_0x565c63,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f588483..83aa599 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.model.js +++ b/server/api/cmHopperBlack/cmHopperBlack.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa06c=['bluebird','request-promise','path','rimraf','define','cm_hopper_black','util','moment'];(function(_0x106171,_0xf48876){var _0x53f14b=function(_0x426a61){while(--_0x426a61){_0x106171['push'](_0x106171['shift']());}};_0x53f14b(++_0xf48876);}(_0xa06c,0x16e));var _0xca06=function(_0xe88a16,_0x404b8d){_0xe88a16=_0xe88a16-0x0;var _0x1611fa=_0xa06c[_0xe88a16];return _0x1611fa;};'use strict';var _=require('lodash');var util=require(_0xca06('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xca06('0x1'));var BPromise=require(_0xca06('0x2'));var rp=require(_0xca06('0x3'));var fs=require('fs');var path=require(_0xca06('0x4'));var rimraf=require(_0xca06('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x5a8441,_0x24aafb){return _0x5a8441[_0xca06('0x6')]('CmHopperBlack',attributes,{'tableName':_0xca06('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79c7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperBlack','lodash','util','../../config/logger','moment'];(function(_0x16f6e4,_0x288b61){var _0x275354=function(_0x43865e){while(--_0x43865e){_0x16f6e4['push'](_0x16f6e4['shift']());}};_0x275354(++_0x288b61);}(_0x79c7,0xcd));var _0x779c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x779c('0x0'));var util=require(_0x779c('0x1'));var logger=require(_0x779c('0x2'))('api');var moment=require(_0x779c('0x3'));var BPromise=require(_0x779c('0x4'));var rp=require(_0x779c('0x5'));var fs=require('fs');var path=require(_0x779c('0x6'));var rimraf=require(_0x779c('0x7'));var config=require(_0x779c('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x779c('0x9')]=function(_0x4e0398,_0x626dd0){return _0x4e0398['define'](_0x779c('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 8b3cbf0..2a44dc2 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.rpc.js +++ b/server/api/cmHopperBlack/cmHopperBlack.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4fe=['attributes','limit','map','include','model','stringify','catch','CmHopperBlack','update','body','where','UpdateCmHopperBlack','DestroyCmHopperBlack','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','message','CmHopperBlack,\x20%s,\x20%s','result','GetCmHopperBlack','options','raw'];(function(_0x4ef402,_0x58c632){var _0x44b661=function(_0x70dfe3){while(--_0x70dfe3){_0x4ef402['push'](_0x4ef402['shift']());}};_0x44b661(++_0x58c632);}(_0xb4fe,0x175));var _0xeb4f=function(_0x21b819,_0x3d5f26){_0x21b819=_0x21b819-0x0;var _0x48ddbb=_0xb4fe[_0x21b819];return _0x48ddbb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeb4f('0x0'));var BPromise=require(_0xeb4f('0x1'));var rs=require(_0xeb4f('0x2'));var fs=require('fs');var Redis=require(_0xeb4f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xeb4f('0x4'));var logger=require(_0xeb4f('0x5'))(_0xeb4f('0x6'));var config=require(_0xeb4f('0x7'));var jayson=require(_0xeb4f('0x8'));var client=jayson['client'][_0xeb4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33f445,_0x2193c0,_0x35de7a){return new BPromise(function(_0x3bbc09,_0x5ec642){return client[_0xeb4f('0xa')](_0x33f445,_0x35de7a)[_0xeb4f('0xb')](function(_0x466fa2){logger[_0xeb4f('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x2193c0,_0xeb4f('0xd'));logger[_0xeb4f('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2193c0,_0xeb4f('0xd'),JSON['stringify'](_0x466fa2));if(_0x466fa2[_0xeb4f('0xf')]){if(_0x466fa2[_0xeb4f('0xf')][_0xeb4f('0x10')]===0x1f4){logger[_0xeb4f('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x2193c0,_0x466fa2[_0xeb4f('0xf')][_0xeb4f('0x11')]);return _0x5ec642(_0x466fa2[_0xeb4f('0xf')][_0xeb4f('0x11')]);}logger[_0xeb4f('0xf')](_0xeb4f('0x12'),_0x2193c0,_0x466fa2[_0xeb4f('0xf')][_0xeb4f('0x11')]);return _0x3bbc09(_0x466fa2[_0xeb4f('0xf')][_0xeb4f('0x11')]);}else{logger['info'](_0xeb4f('0x12'),_0x2193c0,_0xeb4f('0xd'));_0x3bbc09(_0x466fa2[_0xeb4f('0x13')]['message']);}})['catch'](function(_0x108243){logger[_0xeb4f('0xf')](_0xeb4f('0x12'),_0x2193c0,_0x108243);_0x5ec642(_0x108243);});});}exports[_0xeb4f('0x14')]=function(_0x2464c1){var _0x31a2f5=this;return new Promise(function(_0x51caaf,_0x4cc251){return db['CmHopperBlack']['findAll']({'raw':_0x2464c1[_0xeb4f('0x15')]?_0x2464c1[_0xeb4f('0x15')][_0xeb4f('0x16')]===undefined?!![]:![]:!![],'where':_0x2464c1['options']?_0x2464c1[_0xeb4f('0x15')]['where']||null:null,'attributes':_0x2464c1[_0xeb4f('0x15')]?_0x2464c1[_0xeb4f('0x15')][_0xeb4f('0x17')]||null:null,'limit':_0x2464c1[_0xeb4f('0x15')]?_0x2464c1['options'][_0xeb4f('0x18')]||null:null,'include':_0x2464c1['options']?_0x2464c1[_0xeb4f('0x15')]['include']?_[_0xeb4f('0x19')](_0x2464c1[_0xeb4f('0x15')][_0xeb4f('0x1a')],function(_0x4062cd){return{'model':db[_0x4062cd['model']],'as':_0x4062cd['as'],'attributes':_0x4062cd[_0xeb4f('0x17')],'include':_0x4062cd['include']?_['map'](_0x4062cd[_0xeb4f('0x1a')],function(_0x1ecaae){return{'model':db[_0x1ecaae[_0xeb4f('0x1b')]],'as':_0x1ecaae['as'],'attributes':_0x1ecaae[_0xeb4f('0x17')],'include':_0x1ecaae[_0xeb4f('0x1a')]?_[_0xeb4f('0x19')](_0x1ecaae['include'],function(_0x2c44f6){return{'model':db[_0x2c44f6[_0xeb4f('0x1b')]],'as':_0x2c44f6['as'],'attributes':_0x2c44f6[_0xeb4f('0x17')]};}):[]};}):[]};}):[]:[]})[_0xeb4f('0xb')](function(_0x4a0686){logger[_0xeb4f('0xc')](_0xeb4f('0x14'),_0x2464c1);logger[_0xeb4f('0xe')](_0xeb4f('0x14'),_0x2464c1,JSON[_0xeb4f('0x1c')](_0x4a0686));_0x51caaf(_0x4a0686);})[_0xeb4f('0x1d')](function(_0xbe5e4a){logger[_0xeb4f('0xf')](_0xeb4f('0x14'),_0xbe5e4a[_0xeb4f('0x11')],_0x2464c1);_0x4cc251(_0x31a2f5['error'](0x1f4,_0xbe5e4a['message']));});});};exports['UpdateCmHopperBlack']=function(_0x408acd){var _0x537a73=this;return new Promise(function(_0x459b59,_0x3e3b6c){return db[_0xeb4f('0x1e')][_0xeb4f('0x1f')](_0x408acd[_0xeb4f('0x20')],{'raw':_0x408acd['options']?_0x408acd[_0xeb4f('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x408acd[_0xeb4f('0x15')]?_0x408acd[_0xeb4f('0x15')][_0xeb4f('0x21')]||null:null,'attributes':_0x408acd['options']?_0x408acd[_0xeb4f('0x15')][_0xeb4f('0x17')]||null:null,'limit':_0x408acd[_0xeb4f('0x15')]?_0x408acd[_0xeb4f('0x15')][_0xeb4f('0x18')]||null:null})[_0xeb4f('0xb')](function(_0xc2935d){logger[_0xeb4f('0xc')](_0xeb4f('0x22'),_0x408acd);logger['debug'](_0xeb4f('0x22'),_0x408acd,JSON[_0xeb4f('0x1c')](_0xc2935d));_0x459b59(_0xc2935d);})[_0xeb4f('0x1d')](function(_0x33c740){logger[_0xeb4f('0xf')](_0xeb4f('0x22'),_0x33c740[_0xeb4f('0x11')],_0x408acd);_0x3e3b6c(_0x537a73[_0xeb4f('0xf')](0x1f4,_0x33c740[_0xeb4f('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x133faa){var _0x25eedb=this;return new Promise(function(_0xfb3534,_0x48b68a){return db[_0xeb4f('0x1e')]['destroy']({'where':_0x133faa[_0xeb4f('0x15')]?_0x133faa[_0xeb4f('0x15')][_0xeb4f('0x21')]||null:null})[_0xeb4f('0xb')](function(_0x3c7756){logger[_0xeb4f('0xc')](_0xeb4f('0x23'),_0x133faa);logger[_0xeb4f('0xe')](_0xeb4f('0x23'),_0x133faa,JSON[_0xeb4f('0x1c')](_0x3c7756));_0xfb3534(_0x3c7756);})[_0xeb4f('0x1d')](function(_0x1aeec9){logger[_0xeb4f('0xf')](_0xeb4f('0x23'),_0x1aeec9['message'],_0x133faa);_0x48b68a(_0x25eedb[_0xeb4f('0xf')](0x1f4,_0x1aeec9[_0xeb4f('0x11')]));});});}; \ No newline at end of file +var _0x7413=['../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','where','limit','include','map','model','attributes','UpdateCmHopperBlack','update','body','raw','catch','destroy','DestroyCmHopperBlack','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4f0ac9,_0xf8844e){var _0x1d1f24=function(_0x4f1387){while(--_0x4f1387){_0x4f0ac9['push'](_0x4f0ac9['shift']());}};_0x1d1f24(++_0xf8844e);}(_0x7413,0x6f));var _0x3741=function(_0x54cf06,_0x2226a3){_0x54cf06=_0x54cf06-0x0;var _0x233653=_0x7413[_0x54cf06];return _0x233653;};'use strict';var _=require(_0x3741('0x0'));var util=require('util');var moment=require(_0x3741('0x1'));var BPromise=require(_0x3741('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3741('0x3'));var db=require(_0x3741('0x4'))['db'];var utils=require(_0x3741('0x5'));var logger=require(_0x3741('0x6'))(_0x3741('0x7'));var config=require('../../config/environment');var jayson=require(_0x3741('0x8'));var client=jayson[_0x3741('0x9')][_0x3741('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x492211,_0x27613e,_0xe07bbf){return new BPromise(function(_0x36fefa,_0x17e20d){return client['request'](_0x492211,_0xe07bbf)[_0x3741('0xb')](function(_0x535269){logger[_0x3741('0xc')](_0x3741('0xd'),_0x27613e,_0x3741('0xe'));logger[_0x3741('0xf')](_0x3741('0x10'),_0x27613e,_0x3741('0xe'),JSON[_0x3741('0x11')](_0x535269));if(_0x535269[_0x3741('0x12')]){if(_0x535269['error'][_0x3741('0x13')]===0x1f4){logger['error'](_0x3741('0xd'),_0x27613e,_0x535269[_0x3741('0x12')][_0x3741('0x14')]);return _0x17e20d(_0x535269[_0x3741('0x12')][_0x3741('0x14')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x27613e,_0x535269[_0x3741('0x12')][_0x3741('0x14')]);return _0x36fefa(_0x535269[_0x3741('0x12')]['message']);}else{logger['info'](_0x3741('0xd'),_0x27613e,_0x3741('0xe'));_0x36fefa(_0x535269[_0x3741('0x15')]['message']);}})['catch'](function(_0x30dee2){logger[_0x3741('0x12')](_0x3741('0xd'),_0x27613e,_0x30dee2);_0x17e20d(_0x30dee2);});});}exports[_0x3741('0x16')]=function(_0x335a9c){var _0x53f2ff=this;return new Promise(function(_0x39b9a3,_0xfe3064){return db[_0x3741('0x17')][_0x3741('0x18')]({'raw':_0x335a9c[_0x3741('0x19')]?_0x335a9c[_0x3741('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x335a9c[_0x3741('0x19')]?_0x335a9c[_0x3741('0x19')][_0x3741('0x1a')]||null:null,'attributes':_0x335a9c[_0x3741('0x19')]?_0x335a9c[_0x3741('0x19')]['attributes']||null:null,'limit':_0x335a9c['options']?_0x335a9c[_0x3741('0x19')][_0x3741('0x1b')]||null:null,'include':_0x335a9c[_0x3741('0x19')]?_0x335a9c[_0x3741('0x19')][_0x3741('0x1c')]?_[_0x3741('0x1d')](_0x335a9c['options'][_0x3741('0x1c')],function(_0x178fdf){return{'model':db[_0x178fdf[_0x3741('0x1e')]],'as':_0x178fdf['as'],'attributes':_0x178fdf[_0x3741('0x1f')],'include':_0x178fdf[_0x3741('0x1c')]?_['map'](_0x178fdf[_0x3741('0x1c')],function(_0x58edcf){return{'model':db[_0x58edcf[_0x3741('0x1e')]],'as':_0x58edcf['as'],'attributes':_0x58edcf[_0x3741('0x1f')],'include':_0x58edcf['include']?_[_0x3741('0x1d')](_0x58edcf[_0x3741('0x1c')],function(_0x6020b4){return{'model':db[_0x6020b4[_0x3741('0x1e')]],'as':_0x6020b4['as'],'attributes':_0x6020b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x3741('0xb')](function(_0x8606f9){logger[_0x3741('0xc')](_0x3741('0x16'),_0x335a9c);logger[_0x3741('0xf')](_0x3741('0x16'),_0x335a9c,JSON[_0x3741('0x11')](_0x8606f9));_0x39b9a3(_0x8606f9);})['catch'](function(_0x5ea0fa){logger[_0x3741('0x12')]('GetCmHopperBlack',_0x5ea0fa['message'],_0x335a9c);_0xfe3064(_0x53f2ff['error'](0x1f4,_0x5ea0fa['message']));});});};exports[_0x3741('0x20')]=function(_0x1928b9){var _0x2e29f4=this;return new Promise(function(_0x179b97,_0x474fd2){return db['CmHopperBlack'][_0x3741('0x21')](_0x1928b9[_0x3741('0x22')],{'raw':_0x1928b9[_0x3741('0x19')]?_0x1928b9[_0x3741('0x19')][_0x3741('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1928b9['options']?_0x1928b9[_0x3741('0x19')][_0x3741('0x1a')]||null:null,'attributes':_0x1928b9[_0x3741('0x19')]?_0x1928b9['options']['attributes']||null:null,'limit':_0x1928b9[_0x3741('0x19')]?_0x1928b9['options'][_0x3741('0x1b')]||null:null})[_0x3741('0xb')](function(_0x2b43a6){logger[_0x3741('0xc')]('UpdateCmHopperBlack',_0x1928b9);logger[_0x3741('0xf')](_0x3741('0x20'),_0x1928b9,JSON[_0x3741('0x11')](_0x2b43a6));_0x179b97(_0x2b43a6);})[_0x3741('0x24')](function(_0x19c307){logger['error'](_0x3741('0x20'),_0x19c307[_0x3741('0x14')],_0x1928b9);_0x474fd2(_0x2e29f4['error'](0x1f4,_0x19c307[_0x3741('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x4faa99){var _0x47753f=this;return new Promise(function(_0x15b705,_0x2044f7){return db[_0x3741('0x17')][_0x3741('0x25')]({'where':_0x4faa99[_0x3741('0x19')]?_0x4faa99[_0x3741('0x19')][_0x3741('0x1a')]||null:null})[_0x3741('0xb')](function(_0x326c96){logger[_0x3741('0xc')](_0x3741('0x26'),_0x4faa99);logger['debug'](_0x3741('0x26'),_0x4faa99,JSON['stringify'](_0x326c96));_0x15b705(_0x326c96);})['catch'](function(_0x5a8904){logger[_0x3741('0x12')](_0x3741('0x26'),_0x5a8904[_0x3741('0x14')],_0x4faa99);_0x2044f7(_0x47753f[_0x3741('0x12')](0x1f4,_0x5a8904[_0x3741('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 729ce00..c170c6b 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90b1=['index','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x9e55e5,_0x39a4b2){var _0x24ce1c=function(_0x85bf0c){while(--_0x85bf0c){_0x9e55e5['push'](_0x9e55e5['shift']());}};_0x24ce1c(++_0x39a4b2);}(_0x90b1,0x1bb));var _0x190b=function(_0x4cba28,_0x174f6d){_0x4cba28=_0x4cba28-0x0;var _0x540267=_0x90b1[_0x4cba28];return _0x540267;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0xe')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x10')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller['destroy']);module[_0x190b('0x11')]=router; \ No newline at end of file +var _0x0295=['exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','put','update','delete','destroy'];(function(_0x52bef5,_0x25361e){var _0x365753=function(_0x2a5b41){while(--_0x2a5b41){_0x52bef5['push'](_0x52bef5['shift']());}};_0x365753(++_0x25361e);}(_0x0295,0x1f0));var _0x5029=function(_0x5d8987,_0x14d054){_0x5d8987=_0x5d8987-0x0;var _0x2997eb=_0x0295[_0x5d8987];return _0x2997eb;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0xa')]('/:id',auth[_0x5029('0x8')](),controller[_0x5029('0xb')]);router[_0x5029('0xc')]('/:id',auth[_0x5029('0x8')](),controller[_0x5029('0xd')]);module[_0x5029('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 66f02bb..02aedc8 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.attributes.js +++ b/server/api/cmHopperFinal/cmHopperFinal.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7cd3=['seconds','dispositionat','BOOLEAN','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff'];(function(_0x45a855,_0x16acdb){var _0x3dc5c0=function(_0x50dff8){while(--_0x50dff8){_0x45a855['push'](_0x45a855['shift']());}};_0x3dc5c0(++_0x16acdb);}(_0x7cd3,0x18f));var _0x37cd=function(_0x5d25fd,_0xa37bb5){_0x5d25fd=_0x5d25fd-0x0;var _0x3118c9=_0x7cd3[_0x5d25fd];return _0x3118c9;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x37cd('0x0')]={'state':{'type':Sequelize[_0x37cd('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x37cd('0x2')]},'scheduledat':{'type':Sequelize[_0x37cd('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x37cd('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x37cd('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x37cd('0x2')]},'calleridnum':{'type':Sequelize[_0x37cd('0x2')]},'calleridname':{'type':Sequelize[_0x37cd('0x2')]},'starttime':{'type':Sequelize[_0x37cd('0x3')]},'responsetime':{'type':Sequelize[_0x37cd('0x3')]},'answertime':{'type':Sequelize[_0x37cd('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x37cd('0x3')]},'ringtime':{'type':Sequelize[_0x37cd('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x37cd('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x37cd('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x37cd('0x2')]},'campaign':{'type':Sequelize[_0x37cd('0x2')]},'campaigntype':{'type':Sequelize[_0x37cd('0x2')]},'membername':{'type':Sequelize[_0x37cd('0x2')]},'reason':{'type':Sequelize[_0x37cd('0x2')]},'disposition':{'type':Sequelize[_0x37cd('0x2')]},'secondDisposition':{'type':Sequelize[_0x37cd('0x2')]},'thirdDisposition':{'type':Sequelize[_0x37cd('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x50a7e1){var _0x57f0c3=this[_0x37cd('0x4')](_0x37cd('0x5'));if(_0x57f0c3&&_0x50a7e1){this[_0x37cd('0x6')]('followuptime',moment(_0x50a7e1)[_0x37cd('0x7')](moment(_0x57f0c3),_0x37cd('0x8')));}return this[_0x37cd('0x6')](_0x37cd('0x9'),_0x50a7e1);}},'amd':{'type':Sequelize[_0x37cd('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x37cd('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x37cd('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x37cd('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x37cd('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x37cd('0x3')]},'deleted':{'type':Sequelize[_0x37cd('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x37cd('0x3')]},'recallme':{'type':Sequelize[_0x37cd('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x37cd('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x37cd('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x37cd('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa2fc=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x51c90d,_0x5ea086){var _0x5259f6=function(_0x3431f3){while(--_0x3431f3){_0x51c90d['push'](_0x51c90d['shift']());}};_0x5259f6(++_0x5ea086);}(_0xa2fc,0x184));var _0xca2f=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0xa2fc[_0x5c6022];return _0x4ab5af;};'use strict';var Sequelize=require(_0xca2f('0x0'));var moment=require(_0xca2f('0x1'));module[_0xca2f('0x2')]={'state':{'type':Sequelize[_0xca2f('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xca2f('0x4')]},'scheduledat':{'type':Sequelize[_0xca2f('0x5')]},'countbusyretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xca2f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xca2f('0x4')]},'originatecalleridname':{'type':Sequelize[_0xca2f('0x4')]},'calleridnum':{'type':Sequelize[_0xca2f('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xca2f('0x5')]},'answertime':{'type':Sequelize[_0xca2f('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xca2f('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xca2f('0x4')]},'campaigntype':{'type':Sequelize[_0xca2f('0x4')]},'membername':{'type':Sequelize[_0xca2f('0x4')]},'reason':{'type':Sequelize[_0xca2f('0x4')]},'disposition':{'type':Sequelize[_0xca2f('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xca2f('0x4')]},'dispositionat':{'type':Sequelize[_0xca2f('0x5')],'set':function(_0x4c9d29){var _0x39a5e3=this[_0xca2f('0x6')](_0xca2f('0x7'));if(_0x39a5e3&&_0x4c9d29){this[_0xca2f('0x8')](_0xca2f('0x9'),moment(_0x4c9d29)[_0xca2f('0xa')](moment(_0x39a5e3),_0xca2f('0xb')));}return this[_0xca2f('0x8')](_0xca2f('0xc'),_0x4c9d29);}},'amd':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'fax':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xca2f('0x5')]},'callback':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xca2f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xca2f('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 556832e..85a700d 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','literal','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4137,0xf8));var _0x7413=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4137[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['CmHopperFinal'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['describe']=function(_0x513657,_0x3c1f1a){return db['CmHopperFinal']['describe']()[_0x7413('0x25')](respondWithResult(_0x3c1f1a,null))[_0x7413('0x47')](handleError(_0x3c1f1a,null));};exports['update']=function(_0x2aa12c,_0x586d25){if(_0x2aa12c['body'][_0x7413('0x48')]){delete _0x2aa12c['body'][_0x7413('0x48')];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'uniqueid':_0x2aa12c[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x586d25,null))[_0x7413('0x25')](saveUpdates(_0x2aa12c[_0x7413('0x49')],null))[_0x7413('0x25')](respondWithResult(_0x586d25,null))[_0x7413('0x47')](handleError(_0x586d25,null));};exports[_0x7413('0x4a')]=function(_0x50a27d,_0x369891,_0x501407){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x50a27d[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x4d')))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x51')))),_0x7413('0x52')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x55')))),'abandonedContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x369891,null))[_0x7413('0x25')](respondWithResult(_0x369891,null))[_0x7413('0x47')](handleError(_0x369891,null));};exports[_0x7413('0x5a')]=function(_0x28130e,_0x593571,_0x35f7e8){return db['CmHopperFinal'][_0x7413('0x41')]({'raw':![],'where':{'CampaignId':_0x28130e[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x5b')))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x51')))),'congestionContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7413('0x5c')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x593571,null))[_0x7413('0x25')](respondWithResult(_0x593571,null))[_0x7413('0x47')](handleError(_0x593571,null));};exports[_0x7413('0x5d')]=function(_0x2c504e,_0x50910a,_0x5988bd){return db[_0x7413('0x5e')]['find']({'where':{'id':_0x2c504e[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x50910a,null))['then'](function(_0x2be9b1){var _0x4b676a;if(_0x2be9b1){_0x4b676a=squel[_0x7413('0x5f')]()[_0x7413('0x60')]('cm_hopper')['fromQuery']([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),'ListId',_0x7413('0x64'),_0x7413('0x65'),_0x7413('0x66')],squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x69'),'phone')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x62'))['field'](_0x7413('0x6b'),_0x7413('0x63'))[_0x7413('0x68')](_0x7413('0x6c'),_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x6e'),_0x7413('0x64'))[_0x7413('0x68')]('NOW()',_0x7413('0x65'))[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x71'),_0x2c504e['params']['id']['toString']())[_0x7413('0x3b')](_0x7413('0x72'),_0x2c504e['body'][_0x7413('0x73')][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('phone')[_0x7413('0x6f')]('cm_hopper')[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x77'))[_0x7413('0x6f')](_0x7413('0x70'))[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]())[_0x7413('0x3b')]('state\x20=\x204'))['group']('ContactId'))[_0x7413('0x74')]();return db['sequelize'][_0x7413('0x32')](_0x4b676a);}return[];})[_0x7413('0x25')](respondWithResult(_0x50910a,null))[_0x7413('0x47')](handleError(_0x50910a,null));};exports[_0x7413('0x78')]=function(_0x470c21,_0x17c115,_0xbba3c7){return db[_0x7413('0x79')][_0x7413('0x46')]({'where':{'id':_0x470c21['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x17c115,null))[_0x7413('0x25')](function(_0x38bb4e){var _0x4ea60e;if(_0x38bb4e){_0x4ea60e=squel[_0x7413('0x5f')]()[_0x7413('0x60')](_0x7413('0x7a'))[_0x7413('0x7b')]([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),_0x7413('0x6d'),_0x7413('0x7c'),_0x7413('0x65'),'updatedAt'],squel[_0x7413('0x67')]()[_0x7413('0x68')]('ANY_VALUE(calleridnum)',_0x7413('0x61'))[_0x7413('0x68')]('NOW()',_0x7413('0x62'))[_0x7413('0x68')](_0x7413('0x6b'),'ContactId')[_0x7413('0x68')]('ANY_VALUE(ListId)',_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x7d'),_0x7413('0x7c'))[_0x7413('0x68')](_0x7413('0x6a'),'createdAt')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x72'),_0x470c21['body']['state'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x7413('0x68')](_0x7413('0x61'))[_0x7413('0x6f')]('cm_hopper')['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('calleridnum')['from'](_0x7413('0x70'))[_0x7413('0x3b')]('CampaignId\x20=\x20?',_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x7f')))[_0x7413('0x80')](_0x7413('0x63')))[_0x7413('0x74')]();return db[_0x7413('0x4b')][_0x7413('0x32')](_0x4ea60e);}return[];})['then'](respondWithResult(_0x17c115,null))[_0x7413('0x47')](handleError(_0x17c115,null));};exports[_0x7413('0x81')]=function(_0x59d665,_0x1f3e26,_0xccd480){return db[_0x7413('0x82')]['findOne']({'where':{'VoiceQueueId':_0x59d665['body']['VoiceQueueId'],'CampaignId':_0x59d665[_0x7413('0x49')][_0x7413('0x7c')],'ContactId':_0x59d665[_0x7413('0x49')][_0x7413('0x63')]}})[_0x7413('0x25')](handleEntityNotFound(_0x1f3e26,null))[_0x7413('0x25')](function(_0x207293){if(_0x207293){return _0x207293;}return null;})[_0x7413('0x25')](respondWithResult(_0x1f3e26,null))['catch'](handleError(_0x1f3e26,null));}; \ No newline at end of file +var _0xafc4=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','CmHopperFinal','includeAll','catch','show','params','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','ContactId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','Campaign','fromQuery','CampaignId','CampaignId\x20=\x20?','group','CmHopper','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0xa35380,_0x8c080e){var _0x304c13=function(_0x32f589){while(--_0x32f589){_0xa35380['push'](_0xa35380['shift']());}};_0x304c13(++_0x8c080e);}(_0xafc4,0x69));var _0x4afc=function(_0x207b59,_0x5121b1){_0x207b59=_0x207b59-0x0;var _0x1ead42=_0xafc4[_0x207b59];return _0x1ead42;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['CmHopperFinal'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':!![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x19a0ac,null))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x42e274,_0x269c24){if(_0x42e274[_0x4afc('0x43')][_0x4afc('0x44')]){delete _0x42e274[_0x4afc('0x43')][_0x4afc('0x44')];}return db[_0x4afc('0x3d')][_0x4afc('0x45')]({'where':{'uniqueid':_0x42e274['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x269c24,null))['then'](saveUpdates(_0x42e274['body'],null))[_0x4afc('0x25')](respondWithResult(_0x269c24,null))['catch'](handleError(_0x269c24,null));};exports[_0x4afc('0x46')]=function(_0x355198,_0x2fe2ae,_0x2cafc3){return db['CmHopperFinal'][_0x4afc('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x355198['params']['id']},'attributes':[[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4b')))),_0x4afc('0x4c')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0x4afc('0x4d')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4e')))),_0x4afc('0x4f')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),_0x4afc('0x50')],[db['sequelize']['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x51')))),_0x4afc('0x52')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x53')))),_0x4afc('0x54')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x55')))),_0x4afc('0x56')]]})[_0x4afc('0x25')](handleEntityNotFound(_0x2fe2ae,null))[_0x4afc('0x25')](respondWithResult(_0x2fe2ae,null))[_0x4afc('0x3f')](handleError(_0x2fe2ae,null));};exports[_0x4afc('0x57')]=function(_0x4985c6,_0x1771e8,_0x323c65){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x4985c6[_0x4afc('0x41')]['id']},'attributes':[[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4b')))),_0x4afc('0x4c')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x58')))),'noAnswerContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x4e')))),_0x4afc('0x4f')],[db['sequelize']['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x59')))),_0x4afc('0x50')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x5a')))),'dropContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4afc('0x52')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db[_0x4afc('0x48')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x55')))),_0x4afc('0x56')]]})['then'](handleEntityNotFound(_0x1771e8,null))[_0x4afc('0x25')](respondWithResult(_0x1771e8,null))[_0x4afc('0x3f')](handleError(_0x1771e8,null));};exports[_0x4afc('0x5b')]=function(_0x392252,_0x1f652a,_0x481263){return db['VoiceQueue'][_0x4afc('0x45')]({'where':{'id':_0x392252[_0x4afc('0x41')]['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x1f652a,null))['then'](function(_0x380c56){var _0x14a216;if(_0x380c56){_0x14a216=squel[_0x4afc('0x5c')]()[_0x4afc('0x5d')](_0x4afc('0x5e'))['fromQuery']([_0x4afc('0x5f'),_0x4afc('0x60'),'ContactId',_0x4afc('0x61'),_0x4afc('0x62'),_0x4afc('0x63'),'updatedAt'],squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x66'),_0x4afc('0x5f'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x60'))[_0x4afc('0x65')]('ANY_VALUE(ContactId)',_0x4afc('0x68'))['field']('ANY_VALUE(ListId)',_0x4afc('0x61'))[_0x4afc('0x65')](_0x4afc('0x69'),'VoiceQueueId')['field'](_0x4afc('0x67'),_0x4afc('0x63'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x6a'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x6d'),_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x6f'),_0x392252[_0x4afc('0x43')][_0x4afc('0x70')][_0x4afc('0x6e')]())['where'](_0x4afc('0x71'))[_0x4afc('0x37')](_0x4afc('0x72'),squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x5f'))[_0x4afc('0x6b')](_0x4afc('0x5e'))[_0x4afc('0x37')]('VoiceQueueId\x20=\x20?',_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]()))[_0x4afc('0x37')](_0x4afc('0x72'),squel['select']()[_0x4afc('0x65')](_0x4afc('0x73'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x6d'),_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x74')))['group'](_0x4afc('0x68')))[_0x4afc('0x6e')]();return db['sequelize'][_0x4afc('0x2d')](_0x14a216);}return[];})[_0x4afc('0x25')](respondWithResult(_0x1f652a,null))[_0x4afc('0x3f')](handleError(_0x1f652a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1c3d20,_0x3478aa,_0x24553b){return db[_0x4afc('0x75')]['find']({'where':{'id':_0x1c3d20[_0x4afc('0x41')]['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x3478aa,null))['then'](function(_0x2dc8a1){var _0x36f3ea;if(_0x2dc8a1){_0x36f3ea=squel[_0x4afc('0x5c')]()['into']('cm_hopper')[_0x4afc('0x76')]([_0x4afc('0x5f'),_0x4afc('0x60'),_0x4afc('0x68'),_0x4afc('0x61'),_0x4afc('0x77'),_0x4afc('0x63'),_0x4afc('0x6a')],squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x66'),_0x4afc('0x5f'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x60'))[_0x4afc('0x65')]('ANY_VALUE(ContactId)',_0x4afc('0x68'))[_0x4afc('0x65')]('ANY_VALUE(ListId)',_0x4afc('0x61'))['field']('ANY_VALUE(CampaignId)',_0x4afc('0x77'))['field']('NOW()',_0x4afc('0x63'))['field'](_0x4afc('0x67'),'updatedAt')[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x78'),_0x1c3d20[_0x4afc('0x41')]['id']['toString']())[_0x4afc('0x37')](_0x4afc('0x6f'),_0x1c3d20['body']['state'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x71'))[_0x4afc('0x37')](_0x4afc('0x72'),squel['select']()[_0x4afc('0x65')](_0x4afc('0x5f'))[_0x4afc('0x6b')](_0x4afc('0x5e'))['where'](_0x4afc('0x78'),_0x1c3d20['params']['id'][_0x4afc('0x6e')]()))[_0x4afc('0x37')](_0x4afc('0x72'),squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x73'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x78'),_0x1c3d20[_0x4afc('0x41')]['id']['toString']())[_0x4afc('0x37')]('state\x20=\x204'))[_0x4afc('0x79')]('ContactId'))['toString']();return db[_0x4afc('0x48')]['query'](_0x36f3ea);}return[];})['then'](respondWithResult(_0x3478aa,null))[_0x4afc('0x3f')](handleError(_0x3478aa,null));};exports['checkContactHopper']=function(_0x272e36,_0x24bf53,_0x5b1421){return db[_0x4afc('0x7a')][_0x4afc('0x7b')]({'where':{'VoiceQueueId':_0x272e36['body'][_0x4afc('0x62')],'CampaignId':_0x272e36[_0x4afc('0x43')][_0x4afc('0x77')],'ContactId':_0x272e36['body'][_0x4afc('0x68')]}})[_0x4afc('0x25')](handleEntityNotFound(_0x24bf53,null))[_0x4afc('0x25')](function(_0x16eb6d){if(_0x16eb6d){return _0x16eb6d;}return null;})[_0x4afc('0x25')](respondWithResult(_0x24bf53,null))[_0x4afc('0x3f')](handleError(_0x24bf53,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index b45b238..8b0b008 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.model.js +++ b/server/api/cmHopperFinal/cmHopperFinal.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf732=['util','../../config/logger','bluebird','request-promise','path','rimraf','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x31dc5b,_0x24354f){var _0xd5ed63=function(_0x17995b){while(--_0x17995b){_0x31dc5b['push'](_0x31dc5b['shift']());}};_0xd5ed63(++_0x24354f);}(_0xf732,0x176));var _0x2f73=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0xf732[_0x237da8];return _0x558825;};'use strict';var _=require('lodash');var util=require(_0x2f73('0x0'));var logger=require(_0x2f73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2f73('0x2'));var rp=require(_0x2f73('0x3'));var fs=require('fs');var path=require(_0x2f73('0x4'));var rimraf=require(_0x2f73('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x363f39,_0x57bdd8){return _0x363f39[_0x2f73('0x6')](_0x2f73('0x7'),attributes,{'tableName':_0x2f73('0x8'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x2f73('0x9')]},{'name':_0x2f73('0xa'),'fields':[_0x2f73('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4f8=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xe4f8,0x103));var _0x8e4f=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xe4f8[_0x56825b];return _0x69ce77;};'use strict';var _=require(_0x8e4f('0x0'));var util=require('util');var logger=require(_0x8e4f('0x1'))(_0x8e4f('0x2'));var moment=require(_0x8e4f('0x3'));var BPromise=require(_0x8e4f('0x4'));var rp=require(_0x8e4f('0x5'));var fs=require('fs');var path=require(_0x8e4f('0x6'));var rimraf=require(_0x8e4f('0x7'));var config=require(_0x8e4f('0x8'));var attributes=require('./cmHopperFinal.attributes');module[_0x8e4f('0x9')]=function(_0x215d06,_0x547f04){return _0x215d06[_0x8e4f('0xa')](_0x8e4f('0xb'),attributes,{'tableName':_0x8e4f('0xc'),'paranoid':![],'indexes':[{'name':_0x8e4f('0xd'),'fields':[_0x8e4f('0xd')]},{'name':_0x8e4f('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index f516ff9..3c03861 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1470b4,_0x3bdafd){var _0x2022dd=function(_0x5cf11b){while(--_0x5cf11b){_0x1470b4['push'](_0x1470b4['shift']());}};_0x2022dd(++_0x3bdafd);}(_0x7a54,0x106));var _0x47a5=function(_0x3ef99f,_0xa3ccec){_0x3ef99f=_0x3ef99f-0x0;var _0x2ec311=_0x7a54[_0x3ef99f];return _0x2ec311;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x476791,_0x53bce0){var _0x31dae5=function(_0x292457){while(--_0x292457){_0x476791['push'](_0x476791['shift']());}};_0x31dae5(++_0x53bce0);}(_0x7a54,0x106));var _0x47a5=function(_0x5b333d,_0x18d907){_0x5b333d=_0x5b333d-0x0;var _0x4b4a9c=_0x7a54[_0x5b333d];return _0x4b4a9c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 5b5aa49..11d6aad 100644 --- a/server/api/cmHopperFinal/index.js +++ b/server/api/cmHopperFinal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdb1=['express','Router','fs-extra','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/checkContactHopper','put','update','exports','multer','util'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xcdb1,0xa6));var _0x1cdb=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcdb1[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x1cdb('0x0'));var util=require(_0x1cdb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1cdb('0x2'));var router=express[_0x1cdb('0x3')]();var fs_extra=require(_0x1cdb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1cdb('0x5'));var config=require('../../config/environment');var controller=require(_0x1cdb('0x6'));router[_0x1cdb('0x7')]('/',auth[_0x1cdb('0x8')](),controller[_0x1cdb('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x1cdb('0xa')]);router[_0x1cdb('0x7')](_0x1cdb('0xb'),auth[_0x1cdb('0x8')](),controller[_0x1cdb('0xc')]);router[_0x1cdb('0x7')](_0x1cdb('0xd'),auth['isAuthenticated'](),controller[_0x1cdb('0xe')]);router[_0x1cdb('0x7')](_0x1cdb('0xf'),auth['isAuthenticated'](),controller[_0x1cdb('0x10')]);router['post'](_0x1cdb('0x11'),auth[_0x1cdb('0x8')](),controller[_0x1cdb('0x12')]);router[_0x1cdb('0x13')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x1cdb('0x13')](_0x1cdb('0x14'),auth[_0x1cdb('0x8')](),controller['checkContactHopper']);router[_0x1cdb('0x15')](_0x1cdb('0xb'),auth[_0x1cdb('0x8')](),controller[_0x1cdb('0x16')]);module[_0x1cdb('0x17')]=router; \ No newline at end of file +var _0x2d7b=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','/voice/queue/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','multer'];(function(_0x1cdc05,_0xe647c4){var _0x4aa5fc=function(_0x2ed688){while(--_0x2ed688){_0x1cdc05['push'](_0x1cdc05['shift']());}};_0x4aa5fc(++_0xe647c4);}(_0x2d7b,0x7c));var _0xb2d7=function(_0x5a6d97,_0xcf3f6a){_0x5a6d97=_0x5a6d97-0x0;var _0x19873a=_0x2d7b[_0x5a6d97];return _0x19873a;};'use strict';var multer=require(_0xb2d7('0x0'));var util=require(_0xb2d7('0x1'));var path=require(_0xb2d7('0x2'));var timeout=require(_0xb2d7('0x3'));var express=require(_0xb2d7('0x4'));var router=express['Router']();var fs_extra=require(_0xb2d7('0x5'));var auth=require(_0xb2d7('0x6'));var interaction=require(_0xb2d7('0x7'));var config=require(_0xb2d7('0x8'));var controller=require(_0xb2d7('0x9'));router[_0xb2d7('0xa')]('/',auth[_0xb2d7('0xb')](),controller['index']);router['get'](_0xb2d7('0xc'),auth['isAuthenticated'](),controller[_0xb2d7('0xd')]);router[_0xb2d7('0xa')](_0xb2d7('0xe'),auth[_0xb2d7('0xb')](),controller['show']);router[_0xb2d7('0xa')](_0xb2d7('0xf'),auth[_0xb2d7('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router['get']('/campaign/countAttributes/:id',auth[_0xb2d7('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xb2d7('0x10')](_0xb2d7('0x11'),auth[_0xb2d7('0xb')](),controller[_0xb2d7('0x12')]);router[_0xb2d7('0x10')](_0xb2d7('0x13'),auth[_0xb2d7('0xb')](),controller[_0xb2d7('0x14')]);router['post'](_0xb2d7('0x15'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xb2d7('0x16')](_0xb2d7('0xe'),auth[_0xb2d7('0xb')](),controller[_0xb2d7('0x17')]);module[_0xb2d7('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 30fb937..985a1bc 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.attributes.js +++ b/server/api/cmHopperHistory/cmHopperHistory.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba55=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xba55,0x1f3));var _0x5ba5=function(_0x5596de,_0x16c74e){_0x5596de=_0x5596de-0x0;var _0x472bb4=_0xba55[_0x5596de];return _0x472bb4;};'use strict';var Sequelize=require(_0x5ba5('0x0'));module[_0x5ba5('0x1')]={'state':{'type':Sequelize[_0x5ba5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5ba5('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5ba5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5ba5('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5ba5('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5ba5('0x4')]},'responsetime':{'type':Sequelize[_0x5ba5('0x4')]},'answertime':{'type':Sequelize[_0x5ba5('0x4')]},'droptime':{'type':Sequelize[_0x5ba5('0x4')]},'endtime':{'type':Sequelize[_0x5ba5('0x4')]},'ringtime':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5ba5('0x3')]},'campaign':{'type':Sequelize[_0x5ba5('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5ba5('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x5ba5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5ba5('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5ba5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5ba5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5ba5('0x4')]},'recallme':{'type':Sequelize[_0x5ba5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5ba5('0x4')]},'edited':{'type':Sequelize[_0x5ba5('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5ba5('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5ba5('0x3')]}}; \ No newline at end of file +var _0x8a5d=['INTEGER','STRING','DATE','BOOLEAN'];(function(_0x1ad4d2,_0x1cb648){var _0x15dc44=function(_0x4daaaa){while(--_0x4daaaa){_0x1ad4d2['push'](_0x1ad4d2['shift']());}};_0x15dc44(++_0x1cb648);}(_0x8a5d,0xbc));var _0xd8a5=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0x8a5d[_0x172948];return _0x4aeaa9;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xd8a5('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xd8a5('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xd8a5('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd8a5('0x1')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xd8a5('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xd8a5('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd8a5('0x1')]},'campaign':{'type':Sequelize[_0xd8a5('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xd8a5('0x1')]},'amd':{'type':Sequelize[_0xd8a5('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd8a5('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd8a5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd8a5('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd8a5('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd8a5('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 999c88a..43c3054 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.controller.js +++ b/server/api/cmHopperHistory/cmHopperHistory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5ed=['bluebird','mustache','path','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','CmHopperHistory','includeAll','findAll','catch','show','params','length','include','find','create','describe','update','uniqueid','body','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x22759d,_0x326170){var _0x2b3b24=function(_0x2d8a63){while(--_0x2d8a63){_0x22759d['push'](_0x22759d['shift']());}};_0x2b3b24(++_0x326170);}(_0xf5ed,0x1a0));var _0xdf5e=function(_0x235632,_0x5693d5){_0x235632=_0x235632-0x0;var _0x180a4e=_0xf5ed[_0x235632];return _0x180a4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf5e('0x0'));var zipdir=require(_0xdf5e('0x1'));var jsonpatch=require(_0xdf5e('0x2'));var rp=require('request-promise');var moment=require(_0xdf5e('0x3'));var BPromise=require(_0xdf5e('0x4'));var Mustache=require(_0xdf5e('0x5'));var util=require('util');var path=require(_0xdf5e('0x6'));var sox=require('sox');var csv=require(_0xdf5e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf5e('0x8'));var squel=require(_0xdf5e('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdf5e('0x7'));var querystring=require(_0xdf5e('0xa'));var Papa=require(_0xdf5e('0xb'));var Redis=require(_0xdf5e('0xc'));var authService=require(_0xdf5e('0xd'));var qs=require(_0xdf5e('0xe'));var as=require(_0xdf5e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdf5e('0x10'));var config=require(_0xdf5e('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf5e('0x12'))['db'];function respondWithStatusCode(_0x2fd87e,_0x58da1d){_0x58da1d=_0x58da1d||0xcc;return function(_0x179ee1){if(_0x179ee1){return _0x2fd87e[_0xdf5e('0x13')](_0x58da1d);}return _0x2fd87e[_0xdf5e('0x14')](_0x58da1d)[_0xdf5e('0x15')]();};}function respondWithResult(_0x30e8b2,_0x3f4b1a){_0x3f4b1a=_0x3f4b1a||0xc8;return function(_0x17325c){if(_0x17325c){return _0x30e8b2[_0xdf5e('0x14')](_0x3f4b1a)[_0xdf5e('0x16')](_0x17325c);}};}function respondWithFilteredResult(_0x5171a1,_0x2059e1){return function(_0x100dd0){if(_0x100dd0){var _0xd8d770=typeof _0x2059e1[_0xdf5e('0x17')]===_0xdf5e('0x18')&&typeof _0x2059e1[_0xdf5e('0x19')]===_0xdf5e('0x18');var _0x13aa3c=_0x100dd0[_0xdf5e('0x1a')];var _0x64e0a3=_0xd8d770?0x0:_0x2059e1[_0xdf5e('0x17')];var _0x39aa4c=_0xd8d770?_0x100dd0[_0xdf5e('0x1a')]:_0x2059e1[_0xdf5e('0x17')]+_0x2059e1[_0xdf5e('0x19')];var _0x117536;if(_0x39aa4c>=_0x13aa3c){_0x39aa4c=_0x13aa3c;_0x117536=0xc8;}else{_0x117536=0xce;}_0x5171a1['status'](_0x117536);return _0x5171a1[_0xdf5e('0x1b')](_0xdf5e('0x1c'),_0x64e0a3+'-'+_0x39aa4c+'/'+_0x13aa3c)[_0xdf5e('0x16')](_0x100dd0);}return null;};}function patchUpdates(_0x20680a){return function(_0x121437){try{jsonpatch[_0xdf5e('0x1d')](_0x121437,_0x20680a,!![]);}catch(_0x1d1b9f){return BPromise['reject'](_0x1d1b9f);}return _0x121437[_0xdf5e('0x1e')]();};}function saveUpdates(_0x1d446c,_0x1e831e){return function(_0x357ff4){if(_0x357ff4){return _0x357ff4['update'](_0x1d446c)[_0xdf5e('0x1f')](function(_0x16aa16){return _0x16aa16;});}return null;};}function removeEntity(_0x30a652,_0x3959f6){return function(_0x3bb0a6){if(_0x3bb0a6){return _0x3bb0a6['destroy']()['then'](function(){_0x30a652[_0xdf5e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x369ae0,_0x30c85a){return function(_0x391ab3){if(!_0x391ab3){_0x369ae0[_0xdf5e('0x13')](0x194);}return _0x391ab3;};}function handleError(_0x113fc4,_0x5e6a2c){_0x5e6a2c=_0x5e6a2c||0x1f4;return function(_0x2e47a2){logger[_0xdf5e('0x20')](_0x2e47a2['stack']);if(_0x2e47a2[_0xdf5e('0x21')]){delete _0x2e47a2[_0xdf5e('0x21')];}_0x113fc4['status'](_0x5e6a2c)['send'](_0x2e47a2);};}exports[_0xdf5e('0x22')]=function(_0x430627,_0x3ba2b5){var _0x5014d9={},_0x36ec5d={},_0x5c0d3f={'count':0x0,'rows':[]};var _0x16f94e=_['map'](db['CmHopperHistory'][_0xdf5e('0x23')],function(_0x2cde49){return{'name':_0x2cde49[_0xdf5e('0x24')],'type':_0x2cde49[_0xdf5e('0x25')][_0xdf5e('0x26')]};});_0x36ec5d[_0xdf5e('0x27')]=_[_0xdf5e('0x28')](_0x16f94e,_0xdf5e('0x21'));_0x36ec5d[_0xdf5e('0x29')]=_[_0xdf5e('0x2a')](_0x430627[_0xdf5e('0x29')]);_0x36ec5d[_0xdf5e('0x2b')]=_['intersection'](_0x36ec5d[_0xdf5e('0x27')],_0x36ec5d[_0xdf5e('0x29')]);_0x5014d9[_0xdf5e('0x2c')]=_[_0xdf5e('0x2d')](_0x36ec5d[_0xdf5e('0x27')],qs[_0xdf5e('0x2e')](_0x430627[_0xdf5e('0x29')][_0xdf5e('0x2e')]));_0x5014d9[_0xdf5e('0x2c')]=_0x5014d9[_0xdf5e('0x2c')]['length']?_0x5014d9[_0xdf5e('0x2c')]:_0x36ec5d[_0xdf5e('0x27')];if(!_0x430627[_0xdf5e('0x29')][_0xdf5e('0x2f')](_0xdf5e('0x30'))){_0x5014d9[_0xdf5e('0x19')]=qs[_0xdf5e('0x19')](_0x430627['query']['limit']);_0x5014d9['offset']=qs[_0xdf5e('0x17')](_0x430627[_0xdf5e('0x29')]['offset']);}_0x5014d9[_0xdf5e('0x31')]=qs[_0xdf5e('0x32')](_0x430627[_0xdf5e('0x29')]['sort']);_0x5014d9[_0xdf5e('0x33')]=qs[_0xdf5e('0x2b')](_[_0xdf5e('0x34')](_0x430627[_0xdf5e('0x29')],_0x36ec5d[_0xdf5e('0x2b')]),_0x16f94e);if(_0x430627[_0xdf5e('0x29')]['filter']){_0x5014d9[_0xdf5e('0x33')]=_[_0xdf5e('0x35')](_0x5014d9[_0xdf5e('0x33')],{'$or':_['map'](_0x16f94e,function(_0xf52a0d){if(_0xf52a0d[_0xdf5e('0x25')]!=='VIRTUAL'){var _0xa6e22b={};_0xa6e22b[_0xf52a0d[_0xdf5e('0x21')]]={'$like':'%'+_0x430627[_0xdf5e('0x29')][_0xdf5e('0x36')]+'%'};return _0xa6e22b;}})});}_0x5014d9=_[_0xdf5e('0x35')]({},_0x5014d9,_0x430627[_0xdf5e('0x37')]);var _0x328a13={'where':_0x5014d9['where']};return db[_0xdf5e('0x38')][_0xdf5e('0x1a')](_0x328a13)[_0xdf5e('0x1f')](function(_0x495036){_0x5c0d3f['count']=_0x495036;if(_0x430627[_0xdf5e('0x29')][_0xdf5e('0x39')]){_0x5014d9['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xdf5e('0x3a')](_0x5014d9);})[_0xdf5e('0x1f')](function(_0x14395d){_0x5c0d3f['rows']=_0x14395d;return _0x5c0d3f;})[_0xdf5e('0x1f')](respondWithFilteredResult(_0x3ba2b5,_0x5014d9))[_0xdf5e('0x3b')](handleError(_0x3ba2b5,null));};exports[_0xdf5e('0x3c')]=function(_0x325e7d,_0x4e0e99){var _0x83ea9b={'raw':!![],'where':{'id':_0x325e7d[_0xdf5e('0x3d')]['id']}},_0x219a8a={};_0x219a8a['model']=_['keys'](db[_0xdf5e('0x38')][_0xdf5e('0x23')]);_0x219a8a['query']=_[_0xdf5e('0x2a')](_0x325e7d[_0xdf5e('0x29')]);_0x219a8a[_0xdf5e('0x2b')]=_[_0xdf5e('0x2d')](_0x219a8a[_0xdf5e('0x27')],_0x219a8a[_0xdf5e('0x29')]);_0x83ea9b['attributes']=_[_0xdf5e('0x2d')](_0x219a8a[_0xdf5e('0x27')],qs[_0xdf5e('0x2e')](_0x325e7d[_0xdf5e('0x29')]['fields']));_0x83ea9b[_0xdf5e('0x2c')]=_0x83ea9b[_0xdf5e('0x2c')][_0xdf5e('0x3e')]?_0x83ea9b[_0xdf5e('0x2c')]:_0x219a8a[_0xdf5e('0x27')];if(_0x325e7d[_0xdf5e('0x29')][_0xdf5e('0x39')]){_0x83ea9b[_0xdf5e('0x3f')]=[{'all':!![]}];}_0x83ea9b=_['merge']({},_0x83ea9b,_0x325e7d[_0xdf5e('0x37')]);return db[_0xdf5e('0x38')][_0xdf5e('0x40')](_0x83ea9b)[_0xdf5e('0x1f')](handleEntityNotFound(_0x4e0e99,null))[_0xdf5e('0x1f')](respondWithResult(_0x4e0e99,null))[_0xdf5e('0x3b')](handleError(_0x4e0e99,null));};exports[_0xdf5e('0x41')]=function(_0x103577,_0x471804){return db[_0xdf5e('0x38')][_0xdf5e('0x41')](_0x103577['body'],{})['then'](respondWithResult(_0x471804,0xc9))['catch'](handleError(_0x471804,null));};exports[_0xdf5e('0x42')]=function(_0x23bea5,_0x4878c9){return db['CmHopperHistory'][_0xdf5e('0x42')]()[_0xdf5e('0x1f')](respondWithResult(_0x4878c9,null))['catch'](handleError(_0x4878c9,null));};exports[_0xdf5e('0x43')]=function(_0x199c60,_0xb2de9){if(_0x199c60['body'][_0xdf5e('0x44')]){delete _0x199c60[_0xdf5e('0x45')][_0xdf5e('0x44')];}return db[_0xdf5e('0x38')][_0xdf5e('0x40')]({'where':{'uniqueid':_0x199c60[_0xdf5e('0x3d')]['id']}})[_0xdf5e('0x1f')](handleEntityNotFound(_0xb2de9,null))[_0xdf5e('0x1f')](saveUpdates(_0x199c60[_0xdf5e('0x45')],null))['then'](respondWithResult(_0xb2de9,null))[_0xdf5e('0x3b')](handleError(_0xb2de9,null));}; \ No newline at end of file +var _0x4948=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','CmHopperHistory','type','model','map','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x124bf4,_0x35de0e){var _0x4dae78=function(_0x498e94){while(--_0x498e94){_0x124bf4['push'](_0x124bf4['shift']());}};_0x4dae78(++_0x35de0e);}(_0x4948,0x116));var _0x8494=function(_0x17d80a,_0x1df855){_0x17d80a=_0x17d80a-0x0;var _0x58f29d=_0x4948[_0x17d80a];return _0x58f29d;};'use strict';var emlformat=require(_0x8494('0x0'));var rimraf=require(_0x8494('0x1'));var zipdir=require(_0x8494('0x2'));var jsonpatch=require(_0x8494('0x3'));var rp=require(_0x8494('0x4'));var moment=require(_0x8494('0x5'));var BPromise=require(_0x8494('0x6'));var Mustache=require(_0x8494('0x7'));var util=require('util');var path=require(_0x8494('0x8'));var sox=require(_0x8494('0x9'));var csv=require(_0x8494('0xa'));var ejs=require(_0x8494('0xb'));var fs=require('fs');var fs_extra=require(_0x8494('0xc'));var _=require(_0x8494('0xd'));var squel=require(_0x8494('0xe'));var crypto=require('crypto');var jsforce=require(_0x8494('0xf'));var deskjs=require(_0x8494('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8494('0x11'));var Papa=require(_0x8494('0x12'));var Redis=require(_0x8494('0x13'));var authService=require(_0x8494('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8494('0x15'));var logger=require(_0x8494('0x16'))('api');var utils=require(_0x8494('0x17'));var config=require(_0x8494('0x18'));var licenseUtil=require(_0x8494('0x19'));var db=require(_0x8494('0x1a'))['db'];function respondWithStatusCode(_0x64296b,_0x358016){_0x358016=_0x358016||0xcc;return function(_0xe045f2){if(_0xe045f2){return _0x64296b[_0x8494('0x1b')](_0x358016);}return _0x64296b[_0x8494('0x1c')](_0x358016)[_0x8494('0x1d')]();};}function respondWithResult(_0x387537,_0xb6152){_0xb6152=_0xb6152||0xc8;return function(_0x1d4542){if(_0x1d4542){return _0x387537[_0x8494('0x1c')](_0xb6152)[_0x8494('0x1e')](_0x1d4542);}};}function respondWithFilteredResult(_0x2604db,_0x3d8b8d){return function(_0x508164){if(_0x508164){var _0x7aa108=typeof _0x3d8b8d[_0x8494('0x1f')]===_0x8494('0x20')&&typeof _0x3d8b8d[_0x8494('0x21')]===_0x8494('0x20');var _0x5c34e9=_0x508164[_0x8494('0x22')];var _0x264235=_0x7aa108?0x0:_0x3d8b8d[_0x8494('0x1f')];var _0x512c83=_0x7aa108?_0x508164[_0x8494('0x22')]:_0x3d8b8d['offset']+_0x3d8b8d[_0x8494('0x21')];var _0x9cfea7;if(_0x512c83>=_0x5c34e9){_0x512c83=_0x5c34e9;_0x9cfea7=0xc8;}else{_0x9cfea7=0xce;}_0x2604db[_0x8494('0x1c')](_0x9cfea7);return _0x2604db['set'](_0x8494('0x23'),_0x264235+'-'+_0x512c83+'/'+_0x5c34e9)[_0x8494('0x1e')](_0x508164);}return null;};}function patchUpdates(_0x52b2fa){return function(_0x2f1806){try{jsonpatch['apply'](_0x2f1806,_0x52b2fa,!![]);}catch(_0x47b200){return BPromise[_0x8494('0x24')](_0x47b200);}return _0x2f1806['save']();};}function saveUpdates(_0x41833f,_0x9194b6){return function(_0x1cdff7){if(_0x1cdff7){return _0x1cdff7[_0x8494('0x25')](_0x41833f)[_0x8494('0x26')](function(_0x1b709e){return _0x1b709e;});}return null;};}function removeEntity(_0xb4542,_0x576634){return function(_0x2fb749){if(_0x2fb749){return _0x2fb749[_0x8494('0x27')]()[_0x8494('0x26')](function(){_0xb4542[_0x8494('0x1c')](0xcc)[_0x8494('0x1d')]();});}};}function handleEntityNotFound(_0x5353c0,_0x394034){return function(_0x53ca3e){if(!_0x53ca3e){_0x5353c0[_0x8494('0x1b')](0x194);}return _0x53ca3e;};}function handleError(_0xcb136d,_0x35a3ed){_0x35a3ed=_0x35a3ed||0x1f4;return function(_0x505057){logger[_0x8494('0x28')](_0x505057[_0x8494('0x29')]);if(_0x505057[_0x8494('0x2a')]){delete _0x505057[_0x8494('0x2a')];}_0xcb136d[_0x8494('0x1c')](_0x35a3ed)['send'](_0x505057);};}exports['index']=function(_0x5b240e,_0x4f0e91){var _0xe3129a={},_0x206e98={},_0x534624={'count':0x0,'rows':[]};var _0x5779ba=_['map'](db[_0x8494('0x2b')]['rawAttributes'],function(_0x30c844){return{'name':_0x30c844['fieldName'],'type':_0x30c844[_0x8494('0x2c')]['key']};});_0x206e98[_0x8494('0x2d')]=_[_0x8494('0x2e')](_0x5779ba,'name');_0x206e98[_0x8494('0x2f')]=_[_0x8494('0x30')](_0x5b240e[_0x8494('0x2f')]);_0x206e98[_0x8494('0x31')]=_[_0x8494('0x32')](_0x206e98[_0x8494('0x2d')],_0x206e98[_0x8494('0x2f')]);_0xe3129a[_0x8494('0x33')]=_[_0x8494('0x32')](_0x206e98[_0x8494('0x2d')],qs[_0x8494('0x34')](_0x5b240e[_0x8494('0x2f')][_0x8494('0x34')]));_0xe3129a[_0x8494('0x33')]=_0xe3129a['attributes'][_0x8494('0x35')]?_0xe3129a[_0x8494('0x33')]:_0x206e98['model'];if(!_0x5b240e[_0x8494('0x2f')]['hasOwnProperty']('nolimit')){_0xe3129a['limit']=qs[_0x8494('0x21')](_0x5b240e[_0x8494('0x2f')][_0x8494('0x21')]);_0xe3129a[_0x8494('0x1f')]=qs[_0x8494('0x1f')](_0x5b240e[_0x8494('0x2f')][_0x8494('0x1f')]);}_0xe3129a[_0x8494('0x36')]=qs['sort'](_0x5b240e[_0x8494('0x2f')]['sort']);_0xe3129a[_0x8494('0x37')]=qs['filters'](_[_0x8494('0x38')](_0x5b240e[_0x8494('0x2f')],_0x206e98[_0x8494('0x31')]),_0x5779ba);if(_0x5b240e[_0x8494('0x2f')][_0x8494('0x39')]){_0xe3129a['where']=_[_0x8494('0x3a')](_0xe3129a[_0x8494('0x37')],{'$or':_[_0x8494('0x2e')](_0x5779ba,function(_0x112067){if(_0x112067[_0x8494('0x2c')]!==_0x8494('0x3b')){var _0x535bb7={};_0x535bb7[_0x112067[_0x8494('0x2a')]]={'$like':'%'+_0x5b240e[_0x8494('0x2f')]['filter']+'%'};return _0x535bb7;}})});}_0xe3129a=_[_0x8494('0x3a')]({},_0xe3129a,_0x5b240e[_0x8494('0x3c')]);var _0x374a13={'where':_0xe3129a[_0x8494('0x37')]};return db[_0x8494('0x2b')][_0x8494('0x22')](_0x374a13)[_0x8494('0x26')](function(_0x442e13){_0x534624['count']=_0x442e13;if(_0x5b240e['query'][_0x8494('0x3d')]){_0xe3129a[_0x8494('0x3e')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0xe3129a);})['then'](function(_0x2faa1a){_0x534624[_0x8494('0x3f')]=_0x2faa1a;return _0x534624;})[_0x8494('0x26')](respondWithFilteredResult(_0x4f0e91,_0xe3129a))[_0x8494('0x40')](handleError(_0x4f0e91,null));};exports['show']=function(_0x8bf6e0,_0x4fa490){var _0x4dbd44={'raw':!![],'where':{'id':_0x8bf6e0[_0x8494('0x41')]['id']}},_0x417291={};_0x417291[_0x8494('0x2d')]=_[_0x8494('0x30')](db['CmHopperHistory'][_0x8494('0x42')]);_0x417291[_0x8494('0x2f')]=_['keys'](_0x8bf6e0[_0x8494('0x2f')]);_0x417291[_0x8494('0x31')]=_['intersection'](_0x417291[_0x8494('0x2d')],_0x417291[_0x8494('0x2f')]);_0x4dbd44[_0x8494('0x33')]=_[_0x8494('0x32')](_0x417291['model'],qs[_0x8494('0x34')](_0x8bf6e0['query'][_0x8494('0x34')]));_0x4dbd44['attributes']=_0x4dbd44['attributes'][_0x8494('0x35')]?_0x4dbd44[_0x8494('0x33')]:_0x417291[_0x8494('0x2d')];if(_0x8bf6e0['query']['includeAll']){_0x4dbd44[_0x8494('0x3e')]=[{'all':!![]}];}_0x4dbd44=_[_0x8494('0x3a')]({},_0x4dbd44,_0x8bf6e0[_0x8494('0x3c')]);return db[_0x8494('0x2b')][_0x8494('0x43')](_0x4dbd44)[_0x8494('0x26')](handleEntityNotFound(_0x4fa490,null))[_0x8494('0x26')](respondWithResult(_0x4fa490,null))[_0x8494('0x40')](handleError(_0x4fa490,null));};exports['create']=function(_0x2a2335,_0x27c1da){return db[_0x8494('0x2b')][_0x8494('0x44')](_0x2a2335['body'],{})[_0x8494('0x26')](respondWithResult(_0x27c1da,0xc9))[_0x8494('0x40')](handleError(_0x27c1da,null));};exports[_0x8494('0x45')]=function(_0x15c768,_0x973304){return db[_0x8494('0x2b')]['describe']()['then'](respondWithResult(_0x973304,null))[_0x8494('0x40')](handleError(_0x973304,null));};exports[_0x8494('0x25')]=function(_0x48f58c,_0x87eab3){if(_0x48f58c[_0x8494('0x46')][_0x8494('0x47')]){delete _0x48f58c[_0x8494('0x46')]['uniqueid'];}return db['CmHopperHistory'][_0x8494('0x43')]({'where':{'uniqueid':_0x48f58c[_0x8494('0x41')]['id']}})[_0x8494('0x26')](handleEntityNotFound(_0x87eab3,null))[_0x8494('0x26')](saveUpdates(_0x48f58c[_0x8494('0x46')],null))['then'](respondWithResult(_0x87eab3,null))[_0x8494('0x40')](handleError(_0x87eab3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index bea0fda..9f6694d 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.model.js +++ b/server/api/cmHopperHistory/cmHopperHistory.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x505d=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x4550b4,_0x17cfc9){var _0x119507=function(_0x1187b8){while(--_0x1187b8){_0x4550b4['push'](_0x4550b4['shift']());}};_0x119507(++_0x17cfc9);}(_0x505d,0x93));var _0xd505=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x505d[_0x3f5dca];return _0x5b833a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd505('0x0'))(_0xd505('0x1'));var moment=require(_0xd505('0x2'));var BPromise=require(_0xd505('0x3'));var rp=require(_0xd505('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd505('0x5'));var config=require(_0xd505('0x6'));var attributes=require(_0xd505('0x7'));module[_0xd505('0x8')]=function(_0x4ab634,_0x3a2863){return _0x4ab634['define'](_0xd505('0x9'),attributes,{'tableName':_0xd505('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xd505('0xb')]},{'name':_0xd505('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x29b6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x29b6,0x17e));var _0x629b=function(_0xb3f12b,_0x40e1e8){_0xb3f12b=_0xb3f12b-0x0;var _0x50e42f=_0x29b6[_0xb3f12b];return _0x50e42f;};'use strict';var _=require(_0x629b('0x0'));var util=require(_0x629b('0x1'));var logger=require(_0x629b('0x2'))(_0x629b('0x3'));var moment=require(_0x629b('0x4'));var BPromise=require(_0x629b('0x5'));var rp=require(_0x629b('0x6'));var fs=require('fs');var path=require(_0x629b('0x7'));var rimraf=require(_0x629b('0x8'));var config=require(_0x629b('0x9'));var attributes=require('./cmHopperHistory.attributes');module[_0x629b('0xa')]=function(_0x532d0e,_0x810a16){return _0x532d0e[_0x629b('0xb')](_0x629b('0xc'),attributes,{'tableName':_0x629b('0xd'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x629b('0xe')]},{'name':_0x629b('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index e54922e..40b9dff 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.rpc.js +++ b/server/api/cmHopperHistory/cmHopperHistory.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x502a=['outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','findAll','raw','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','debug','AvgHandleTime','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x502a,0xd8));var _0xa502=function(_0x38bf1d,_0x799953){_0x38bf1d=_0x38bf1d-0x0;var _0x1f0e0c=_0x502a[_0x38bf1d];return _0x1f0e0c;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var moment=require('moment');var BPromise=require(_0xa502('0x2'));var rs=require(_0xa502('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa502('0x4'));var logger=require('../../config/logger')(_0xa502('0x5'));var config=require(_0xa502('0x6'));var jayson=require(_0xa502('0x7'));var client=jayson[_0xa502('0x8')][_0xa502('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x489407,_0x329022,_0x29fb03){return new BPromise(function(_0x4d30f2,_0x4e4e5d){return client[_0xa502('0xa')](_0x489407,_0x29fb03)[_0xa502('0xb')](function(_0x5251fa){logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));logger['debug'](_0xa502('0xf'),_0x329022,_0xa502('0xe'),JSON[_0xa502('0x10')](_0x5251fa));if(_0x5251fa['error']){if(_0x5251fa[_0xa502('0x11')][_0xa502('0x12')]===0x1f4){logger['error'](_0xa502('0xd'),_0x329022,_0x5251fa[_0xa502('0x11')]['message']);return _0x4e4e5d(_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);}logger[_0xa502('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x329022,_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);return _0x4d30f2(_0x5251fa[_0xa502('0x11')]['message']);}else{logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));_0x4d30f2(_0x5251fa[_0xa502('0x14')][_0xa502('0x13')]);}})[_0xa502('0x15')](function(_0x3107a0){logger[_0xa502('0x11')](_0xa502('0xd'),_0x329022,_0x3107a0);_0x4e4e5d(_0x3107a0);});});}exports[_0xa502('0x16')]=function(_0x1445ec){var _0x315455=this;return new Promise(function(_0x1d2f3d,_0x166453){return db[_0xa502('0x17')][_0xa502('0x18')](_0x1445ec[_0xa502('0x19')],{'raw':_0x1445ec[_0xa502('0x1a')]?_0x1445ec['options']['raw']===undefined?!![]:![]:!![]})[_0xa502('0xb')](function(_0x331d55){logger[_0xa502('0xc')](_0xa502('0x16'),_0x1445ec);logger[_0xa502('0x1b')](_0xa502('0x16'),_0x1445ec,JSON[_0xa502('0x10')](_0x331d55));_0x1d2f3d(_0x331d55);})[_0xa502('0x15')](function(_0x287f03){logger[_0xa502('0x11')](_0xa502('0x16'),_0x287f03[_0xa502('0x13')],_0x1445ec);_0x166453(_0x315455['error'](0x1f4,_0x287f03[_0xa502('0x13')]));});});};exports[_0xa502('0x1c')]=function(_0x28bc20){var _0x1fd61d=this;return new Promise(function(_0x570f23,_0x10f7e8){return db[_0xa502('0x17')]['findAll']({'raw':_0x28bc20['options']?_0x28bc20[_0xa502('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x28bc20[_0xa502('0x1a')]?_0x28bc20[_0xa502('0x1a')]['where']||null:null,'attributes':[[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db['sequelize'][_0xa502('0x1f')]('id')),_0xa502('0x20')],[db[_0xa502('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa502('0x21')](_0xa502('0x22')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db['sequelize'][_0xa502('0x21')](_0xa502('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xa502('0x24')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x25'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')](_0xa502('0x26')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0xa502('0x25'),db['sequelize']['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')](_0xa502('0x27')))),_0xa502('0x28')]]})['then'](function(_0x4c60fa){logger[_0xa502('0xc')](_0xa502('0x1c'),_0x28bc20);logger[_0xa502('0x1b')]('AvgHandleTime',_0x28bc20,JSON['stringify'](_0x4c60fa));_0x570f23(_0x4c60fa);})[_0xa502('0x15')](function(_0x1a3ef1){logger[_0xa502('0x11')](_0xa502('0x1c'),_0x1a3ef1['message'],_0x28bc20);_0x10f7e8(_0x1fd61d[_0xa502('0x11')](0x1f4,_0x1a3ef1[_0xa502('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x53a38a){var _0x367bb0=this;return new Promise(function(_0x4be5c2,_0x254bbc){return db[_0xa502('0x17')]['findAll']({'raw':_0x53a38a[_0xa502('0x1a')]?_0x53a38a['options']['raw']===undefined?!![]:![]:!![],'where':_0x53a38a[_0xa502('0x1a')]?_0x53a38a[_0xa502('0x1a')][_0xa502('0x29')]||null:null,'attributes':[[_0xa502('0x2a'),_0xa502('0x2b')],[db['sequelize']['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0xa502('0x2c')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xa502('0x2d')))),_0xa502('0x2e')],[db[_0xa502('0x1d')]['fn']('COUNT',db[_0xa502('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xa502('0x22')))),_0xa502('0x2f')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xa502('0x30')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xa502('0x21')](_0xa502('0x31')))),_0xa502('0x32')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db['sequelize']['fn']('IF',db[_0xa502('0x1d')]['literal'](_0xa502('0x33')))),'outboundDropCallsDayTimeout'],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xa502('0x34')],[db[_0xa502('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0xa502('0x35')],[db[_0xa502('0x1d')]['fn']('COUNT',db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')](_0xa502('0x36')))),_0xa502('0x37')],[db['sequelize']['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal'](_0xa502('0x38')))),_0xa502('0x39')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db['sequelize'][_0xa502('0x21')](_0xa502('0x3a')))),'outboundAnswerAgiCallsDay'],[db[_0xa502('0x1d')]['fn']('COUNT',db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')](_0xa502('0x3b')))),_0xa502('0x39')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0xa502('0x2a')]})['then'](function(_0x18df02){logger[_0xa502('0xc')]('GetVoiceQueueHopperHistory',_0x53a38a);logger[_0xa502('0x1b')](_0xa502('0x3c'),_0x53a38a,JSON[_0xa502('0x10')](_0x18df02));_0x4be5c2(_0x18df02);})[_0xa502('0x15')](function(_0x108221){logger[_0xa502('0x11')](_0xa502('0x3c'),_0x108221[_0xa502('0x13')],_0x53a38a);_0x254bbc(_0x367bb0[_0xa502('0x11')](0x1f4,_0x108221[_0xa502('0x13')]));});});};exports[_0xa502('0x3d')]=function(_0x2b524d){var _0x513331=this;return new Promise(function(_0x950af0,_0x4d9b3a){return db[_0xa502('0x17')][_0xa502('0x3e')]({'raw':_0x2b524d[_0xa502('0x1a')]?_0x2b524d['options'][_0xa502('0x3f')]===undefined?!![]:![]:!![],'where':_0x2b524d[_0xa502('0x1a')]?_0x2b524d[_0xa502('0x1a')][_0xa502('0x29')]||null:null,'attributes':[[_0xa502('0x2a'),_0xa502('0x2b')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['col']('id')),_0xa502('0x40')],[db[_0xa502('0x1d')]['fn'](_0xa502('0x1e'),db[_0xa502('0x1d')]['fn']('IF',db[_0xa502('0x1d')][_0xa502('0x21')](_0xa502('0x22')))),_0xa502('0x41')]],'group':[_0xa502('0x2a')]})['then'](function(_0x4c9f2c){logger['info'](_0xa502('0x3d'),_0x2b524d);logger[_0xa502('0x1b')](_0xa502('0x3d'),_0x2b524d,JSON['stringify'](_0x4c9f2c));_0x950af0(_0x4c9f2c);})[_0xa502('0x15')](function(_0x3e5463){logger[_0xa502('0x11')](_0xa502('0x3d'),_0x3e5463[_0xa502('0x13')],_0x2b524d);_0x4d9b3a(_0x513331[_0xa502('0x11')](0x1f4,_0x3e5463[_0xa502('0x13')]));});});}; \ No newline at end of file +var _0x2bdb=['`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','raw','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','options','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','literal'];(function(_0xdb4496,_0x34501e){var _0x2b9de8=function(_0x33a3f8){while(--_0x33a3f8){_0xdb4496['push'](_0xdb4496['shift']());}};_0x2b9de8(++_0x34501e);}(_0x2bdb,0x105));var _0xb2bd=function(_0x18e1a1,_0x5426d6){_0x18e1a1=_0x18e1a1-0x0;var _0x3613d0=_0x2bdb[_0x18e1a1];return _0x3613d0;};'use strict';var _=require(_0xb2bd('0x0'));var util=require('util');var moment=require(_0xb2bd('0x1'));var BPromise=require('bluebird');var rs=require(_0xb2bd('0x2'));var fs=require('fs');var Redis=require(_0xb2bd('0x3'));var db=require(_0xb2bd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2bd('0x5'))(_0xb2bd('0x6'));var config=require(_0xb2bd('0x7'));var jayson=require(_0xb2bd('0x8'));var client=jayson[_0xb2bd('0x9')][_0xb2bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bff5b,_0x5bae78,_0x21462b){return new BPromise(function(_0x4d9d3f,_0x181f5a){return client[_0xb2bd('0xb')](_0x3bff5b,_0x21462b)[_0xb2bd('0xc')](function(_0xeaa2b7){logger[_0xb2bd('0xd')](_0xb2bd('0xe'),_0x5bae78,_0xb2bd('0xf'));logger[_0xb2bd('0x10')](_0xb2bd('0x11'),_0x5bae78,'request\x20sent',JSON[_0xb2bd('0x12')](_0xeaa2b7));if(_0xeaa2b7[_0xb2bd('0x13')]){if(_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x14')]===0x1f4){logger[_0xb2bd('0x13')](_0xb2bd('0xe'),_0x5bae78,_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);return _0x181f5a(_0xeaa2b7['error'][_0xb2bd('0x15')]);}logger['error'](_0xb2bd('0xe'),_0x5bae78,_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);return _0x4d9d3f(_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);}else{logger['info'](_0xb2bd('0xe'),_0x5bae78,_0xb2bd('0xf'));_0x4d9d3f(_0xeaa2b7[_0xb2bd('0x16')][_0xb2bd('0x15')]);}})['catch'](function(_0x14950f){logger[_0xb2bd('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x5bae78,_0x14950f);_0x181f5a(_0x14950f);});});}exports[_0xb2bd('0x17')]=function(_0x380089){var _0x387897=this;return new Promise(function(_0x315815,_0x5d848d){return db[_0xb2bd('0x18')][_0xb2bd('0x19')](_0x380089['body'],{'raw':_0x380089[_0xb2bd('0x1a')]?_0x380089[_0xb2bd('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x51c595){logger[_0xb2bd('0xd')]('CreateCmHopperHistory',_0x380089);logger[_0xb2bd('0x10')]('CreateCmHopperHistory',_0x380089,JSON[_0xb2bd('0x12')](_0x51c595));_0x315815(_0x51c595);})[_0xb2bd('0x1b')](function(_0x505c35){logger[_0xb2bd('0x13')]('CreateCmHopperHistory',_0x505c35[_0xb2bd('0x15')],_0x380089);_0x5d848d(_0x387897[_0xb2bd('0x13')](0x1f4,_0x505c35[_0xb2bd('0x15')]));});});};exports[_0xb2bd('0x1c')]=function(_0x5665ae){var _0x44635a=this;return new Promise(function(_0x1df967,_0x35fa24){return db[_0xb2bd('0x18')][_0xb2bd('0x1d')]({'raw':_0x5665ae[_0xb2bd('0x1a')]?_0x5665ae[_0xb2bd('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5665ae[_0xb2bd('0x1a')]?_0x5665ae[_0xb2bd('0x1a')][_0xb2bd('0x1e')]||null:null,'attributes':[[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')][_0xb2bd('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0xb2bd('0x1f')]['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db['sequelize'][_0xb2bd('0x22')](_0xb2bd('0x23')))),_0xb2bd('0x24')],[db['sequelize']['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x25')))),_0xb2bd('0x26')],[db['sequelize']['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db['sequelize'][_0xb2bd('0x22')](_0xb2bd('0x27')))),_0xb2bd('0x28')],[db['sequelize']['fn'](_0xb2bd('0x29'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x2a')))),_0xb2bd('0x2b')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x29'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x2c')))),_0xb2bd('0x2d')]]})[_0xb2bd('0xc')](function(_0x41e805){logger['info'](_0xb2bd('0x1c'),_0x5665ae);logger[_0xb2bd('0x10')](_0xb2bd('0x1c'),_0x5665ae,JSON[_0xb2bd('0x12')](_0x41e805));_0x1df967(_0x41e805);})[_0xb2bd('0x1b')](function(_0x5cf15f){logger['error'](_0xb2bd('0x1c'),_0x5cf15f[_0xb2bd('0x15')],_0x5665ae);_0x35fa24(_0x44635a[_0xb2bd('0x13')](0x1f4,_0x5cf15f[_0xb2bd('0x15')]));});});};exports[_0xb2bd('0x2e')]=function(_0x5d30e8){var _0x8a6a59=this;return new Promise(function(_0x1c94dc,_0x8db469){return db[_0xb2bd('0x18')][_0xb2bd('0x1d')]({'raw':_0x5d30e8[_0xb2bd('0x1a')]?_0x5d30e8[_0xb2bd('0x1a')][_0xb2bd('0x2f')]===undefined?!![]:![]:!![],'where':_0x5d30e8[_0xb2bd('0x1a')]?_0x5d30e8[_0xb2bd('0x1a')][_0xb2bd('0x1e')]||null:null,'attributes':[[_0xb2bd('0x30'),_0xb2bd('0x31')],[db['sequelize']['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x32')))),_0xb2bd('0x33')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xb2bd('0x22')](_0xb2bd('0x34')))),'outboundNoAnswerCallsDay'],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x23')))),_0xb2bd('0x35')],[db[_0xb2bd('0x1f')]['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x36')))),'outboundBusyCallsDay'],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db['sequelize']['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x37')))),_0xb2bd('0x38')],[db[_0xb2bd('0x1f')]['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x39')))),_0xb2bd('0x3a')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb2bd('0x3b')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x3c')))),_0xb2bd('0x3d')],[db['sequelize']['fn'](_0xb2bd('0x20'),db['sequelize']['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x3e')))),_0xb2bd('0x3f')],[db[_0xb2bd('0x1f')]['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x40')))),'outboundOriginateFailureCallsDay'],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x41')))),_0xb2bd('0x42')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x43')))),_0xb2bd('0x44')],[db[_0xb2bd('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x45')))),'outboundRejectCallsDay'],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xb2bd('0x46')))),_0xb2bd('0x47')]],'group':[_0xb2bd('0x30')]})[_0xb2bd('0xc')](function(_0x338789){logger['info'](_0xb2bd('0x2e'),_0x5d30e8);logger[_0xb2bd('0x10')](_0xb2bd('0x2e'),_0x5d30e8,JSON[_0xb2bd('0x12')](_0x338789));_0x1c94dc(_0x338789);})['catch'](function(_0x2b07ae){logger['error'](_0xb2bd('0x2e'),_0x2b07ae[_0xb2bd('0x15')],_0x5d30e8);_0x8db469(_0x8a6a59['error'](0x1f4,_0x2b07ae[_0xb2bd('0x15')]));});});};exports[_0xb2bd('0x48')]=function(_0x1ed689){var _0x5b6874=this;return new Promise(function(_0x2681ab,_0x1c7bed){return db['CmHopperHistory'][_0xb2bd('0x1d')]({'raw':_0x1ed689[_0xb2bd('0x1a')]?_0x1ed689[_0xb2bd('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1ed689['options']?_0x1ed689[_0xb2bd('0x1a')][_0xb2bd('0x1e')]||null:null,'attributes':[[_0xb2bd('0x30'),_0xb2bd('0x31')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')][_0xb2bd('0x21')]('id')),'ivrTotalCallsDays'],[db[_0xb2bd('0x1f')]['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xb2bd('0x49')]],'group':[_0xb2bd('0x30')]})['then'](function(_0x560921){logger[_0xb2bd('0xd')]('GetCampaignHopperHistory',_0x1ed689);logger['debug']('GetCampaignHopperHistory',_0x1ed689,JSON[_0xb2bd('0x12')](_0x560921));_0x2681ab(_0x560921);})['catch'](function(_0x367582){logger['error'](_0xb2bd('0x48'),_0x367582[_0xb2bd('0x15')],_0x1ed689);_0x1c7bed(_0x5b6874[_0xb2bd('0x13')](0x1f4,_0x367582[_0xb2bd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a1142bf..59db01a 100644 --- a/server/api/cmHopperHistory/index.js +++ b/server/api/cmHopperHistory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcba6=['exports','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','/describe','describe','isAuthenticated','post','create','put','/:id'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xcba6,0x196));var _0x6cba=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xcba6[_0x368fb9];return _0x4892fb;};'use strict';var multer=require('multer');var util=require(_0x6cba('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6cba('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6cba('0x2'));var interaction=require(_0x6cba('0x3'));var config=require(_0x6cba('0x4'));var controller=require(_0x6cba('0x5'));router[_0x6cba('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6cba('0x6')](_0x6cba('0x7'),auth['isAuthenticated'](),controller[_0x6cba('0x8')]);router['get']('/:id',auth[_0x6cba('0x9')](),controller['show']);router[_0x6cba('0xa')]('/',auth[_0x6cba('0x9')](),controller[_0x6cba('0xb')]);router[_0x6cba('0xc')](_0x6cba('0xd'),auth['isAuthenticated'](),controller['update']);module[_0x6cba('0xe')]=router; \ No newline at end of file +var _0xbb7a=['multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','exports'];(function(_0x18369a,_0x4e8835){var _0xa6e2b8=function(_0x27fe31){while(--_0x27fe31){_0x18369a['push'](_0x18369a['shift']());}};_0xa6e2b8(++_0x4e8835);}(_0xbb7a,0x9a));var _0xabb7=function(_0x20dee7,_0xebc612){_0x20dee7=_0x20dee7-0x0;var _0x125891=_0xbb7a[_0x20dee7];return _0x125891;};'use strict';var multer=require(_0xabb7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xabb7('0x1'));var express=require(_0xabb7('0x2'));var router=express[_0xabb7('0x3')]();var fs_extra=require(_0xabb7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xabb7('0x5'));var config=require(_0xabb7('0x6'));var controller=require('./cmHopperHistory.controller');router[_0xabb7('0x7')]('/',auth[_0xabb7('0x8')](),controller['index']);router[_0xabb7('0x7')]('/describe',auth[_0xabb7('0x8')](),controller['describe']);router[_0xabb7('0x7')](_0xabb7('0x9'),auth[_0xabb7('0x8')](),controller[_0xabb7('0xa')]);router[_0xabb7('0xb')]('/',auth[_0xabb7('0x8')](),controller[_0xabb7('0xc')]);router['put']('/:id',auth[_0xabb7('0x8')](),controller['update']);module[_0xabb7('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 8e67177..6c647dd 100644 --- a/server/api/cmList/cmList.attributes.js +++ b/server/api/cmList/cmList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x430e=['STRING','exports'];(function(_0x1ca186,_0x44acf5){var _0x41a570=function(_0x4f2b36){while(--_0x4f2b36){_0x1ca186['push'](_0x1ca186['shift']());}};_0x41a570(++_0x44acf5);}(_0x430e,0x105));var _0xe430=function(_0x2f50ab,_0x4dfe90){_0x2f50ab=_0x2f50ab-0x0;var _0x1e9b19=_0x430e[_0x2f50ab];return _0x1e9b19;};'use strict';var Sequelize=require('sequelize');module[_0xe430('0x0')]={'name':{'type':Sequelize[_0xe430('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe430('0x1')]},'dialPrefix':{'type':Sequelize[_0xe430('0x1')]}}; \ No newline at end of file +var _0x53d5=['sequelize','exports','STRING','name'];(function(_0x4654d0,_0x19aa25){var _0x5f457e=function(_0x2207e7){while(--_0x2207e7){_0x4654d0['push'](_0x4654d0['shift']());}};_0x5f457e(++_0x19aa25);}(_0x53d5,0x1cc));var _0x553d=function(_0x14ee59,_0x236373){_0x14ee59=_0x14ee59-0x0;var _0x46dcd3=_0x53d5[_0x14ee59];return _0x46dcd3;};'use strict';var Sequelize=require(_0x553d('0x0'));module[_0x553d('0x1')]={'name':{'type':Sequelize[_0x553d('0x2')],'unique':_0x553d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x553d('0x2')]},'dialPrefix':{'type':Sequelize[_0x553d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 73e8fc8..fb07c4b 100644 --- a/server/api/cmList/cmList.controller.js +++ b/server/api/cmList/cmList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f52=['tags','isArray','push','each','omit','success','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','pick','now','writeFileSync','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','findOne','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','./cmList.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Lists','name','index','map','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','CmList','includeAll','find','create','body','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','getDispositions','Disposition','removeDispositions','ids','addContacts','CmContact'];(function(_0x4ab70e,_0x252848){var _0x256e8f=function(_0x1a4a28){while(--_0x1a4a28){_0x4ab70e['push'](_0x4ab70e['shift']());}};_0x256e8f(++_0x252848);}(_0x1f52,0xbb));var _0x21f5=function(_0x4a752,_0x3c1398){_0x4a752=_0x4a752-0x0;var _0x3ff76a=_0x1f52[_0x4a752];return _0x3ff76a;};'use strict';var emlformat=require(_0x21f5('0x0'));var rimraf=require(_0x21f5('0x1'));var zipdir=require(_0x21f5('0x2'));var jsonpatch=require(_0x21f5('0x3'));var rp=require(_0x21f5('0x4'));var moment=require(_0x21f5('0x5'));var BPromise=require(_0x21f5('0x6'));var Mustache=require(_0x21f5('0x7'));var util=require(_0x21f5('0x8'));var path=require(_0x21f5('0x9'));var sox=require(_0x21f5('0xa'));var csv=require(_0x21f5('0xb'));var ejs=require(_0x21f5('0xc'));var fs=require('fs');var fs_extra=require(_0x21f5('0xd'));var _=require(_0x21f5('0xe'));var squel=require(_0x21f5('0xf'));var crypto=require('crypto');var jsforce=require(_0x21f5('0x10'));var deskjs=require(_0x21f5('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21f5('0x12'));var Redis=require('ioredis');var authService=require(_0x21f5('0x13'));var qs=require(_0x21f5('0x14'));var as=require(_0x21f5('0x15'));var hardwareService=require(_0x21f5('0x16'));var logger=require(_0x21f5('0x17'))('api');var utils=require(_0x21f5('0x18'));var config=require(_0x21f5('0x19'));var licenseUtil=require(_0x21f5('0x1a'));var db=require('../../mysqldb')['db'];config[_0x21f5('0x1b')]=_['defaults'](config[_0x21f5('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21f5('0x1b')]));require(_0x21f5('0x1c'))[_0x21f5('0x1d')](socket);function respondWithStatusCode(_0x38281f,_0x1732cb){_0x1732cb=_0x1732cb||0xcc;return function(_0x7cb99b){if(_0x7cb99b){return _0x38281f[_0x21f5('0x1e')](_0x1732cb);}return _0x38281f[_0x21f5('0x1f')](_0x1732cb)[_0x21f5('0x20')]();};}function respondWithResult(_0x539e04,_0x2906f3){_0x2906f3=_0x2906f3||0xc8;return function(_0xe0c4b){if(_0xe0c4b){return _0x539e04[_0x21f5('0x1f')](_0x2906f3)[_0x21f5('0x21')](_0xe0c4b);}};}function respondWithFilteredResult(_0x2dbb59,_0x97f302){return function(_0xaa4686){if(_0xaa4686){var _0xcda1b8=typeof _0x97f302['offset']===_0x21f5('0x22')&&typeof _0x97f302[_0x21f5('0x23')]===_0x21f5('0x22');var _0x26a86b=_0xaa4686[_0x21f5('0x24')];var _0x45dcf0=_0xcda1b8?0x0:_0x97f302[_0x21f5('0x25')];var _0x440246=_0xcda1b8?_0xaa4686[_0x21f5('0x24')]:_0x97f302[_0x21f5('0x25')]+_0x97f302[_0x21f5('0x23')];var _0x50896f;if(_0x440246>=_0x26a86b){_0x440246=_0x26a86b;_0x50896f=0xc8;}else{_0x50896f=0xce;}_0x2dbb59[_0x21f5('0x1f')](_0x50896f);return _0x2dbb59[_0x21f5('0x26')](_0x21f5('0x27'),_0x45dcf0+'-'+_0x440246+'/'+_0x26a86b)[_0x21f5('0x21')](_0xaa4686);}return null;};}function patchUpdates(_0x29f24b){return function(_0x217503){try{jsonpatch['apply'](_0x217503,_0x29f24b,!![]);}catch(_0xd021fd){return BPromise[_0x21f5('0x28')](_0xd021fd);}return _0x217503[_0x21f5('0x29')]();};}function saveUpdates(_0x5f4d6a,_0xad91e9){return function(_0x466c8a){if(_0x466c8a){return _0x466c8a[_0x21f5('0x2a')](_0x5f4d6a)[_0x21f5('0x2b')](function(_0x35b019){return _0x35b019;});}return null;};}function removeEntity(_0x51f922,_0x57a46c){return function(_0xa2a1e1){if(_0xa2a1e1){return _0xa2a1e1[_0x21f5('0x2c')]()[_0x21f5('0x2b')](function(){var _0x2d9ab3=_0xa2a1e1[_0x21f5('0x2d')]({'plain':!![]});var _0x43ac22=_0x21f5('0x2e');return db['UserProfileResource'][_0x21f5('0x2c')]({'where':{'type':_0x43ac22,'resourceId':_0x2d9ab3['id']}})[_0x21f5('0x2b')](function(){return _0xa2a1e1;});})['then'](function(){_0x51f922[_0x21f5('0x1f')](0xcc)[_0x21f5('0x20')]();});}};}function handleEntityNotFound(_0x553809,_0x536566){return function(_0x2e941c){if(!_0x2e941c){_0x553809['sendStatus'](0x194);}return _0x2e941c;};}function handleError(_0x21bb31,_0x5b77fa){_0x5b77fa=_0x5b77fa||0x1f4;return function(_0x29f257){logger['error'](_0x29f257['stack']);if(_0x29f257[_0x21f5('0x2f')]){delete _0x29f257[_0x21f5('0x2f')];}_0x21bb31[_0x21f5('0x1f')](_0x5b77fa)['send'](_0x29f257);};}exports[_0x21f5('0x30')]=function(_0x33c407,_0x14b322){var _0x4f7a5e={},_0x1bbe8c={},_0x3f0f4b={'count':0x0,'rows':[]};var _0x20b035=_[_0x21f5('0x31')](db['CmList'][_0x21f5('0x32')],function(_0x314795){return{'name':_0x314795[_0x21f5('0x33')],'type':_0x314795['type'][_0x21f5('0x34')]};});_0x1bbe8c[_0x21f5('0x35')]=_['map'](_0x20b035,'name');_0x1bbe8c['query']=_[_0x21f5('0x36')](_0x33c407['query']);_0x1bbe8c[_0x21f5('0x37')]=_['intersection'](_0x1bbe8c[_0x21f5('0x35')],_0x1bbe8c[_0x21f5('0x38')]);_0x4f7a5e[_0x21f5('0x39')]=_[_0x21f5('0x3a')](_0x1bbe8c[_0x21f5('0x35')],qs[_0x21f5('0x3b')](_0x33c407[_0x21f5('0x38')][_0x21f5('0x3b')]));_0x4f7a5e['attributes']=_0x4f7a5e['attributes'][_0x21f5('0x3c')]?_0x4f7a5e[_0x21f5('0x39')]:_0x1bbe8c[_0x21f5('0x35')];if(!_0x33c407[_0x21f5('0x38')][_0x21f5('0x3d')](_0x21f5('0x3e'))){_0x4f7a5e['limit']=qs['limit'](_0x33c407['query']['limit']);_0x4f7a5e[_0x21f5('0x25')]=qs[_0x21f5('0x25')](_0x33c407[_0x21f5('0x38')][_0x21f5('0x25')]);}_0x4f7a5e[_0x21f5('0x3f')]=qs['sort'](_0x33c407['query'][_0x21f5('0x40')]);_0x4f7a5e[_0x21f5('0x41')]=qs['filters'](_['pick'](_0x33c407[_0x21f5('0x38')],_0x1bbe8c[_0x21f5('0x37')]),_0x20b035);if(_0x33c407[_0x21f5('0x38')]['filter']){_0x4f7a5e['where']=_[_0x21f5('0x42')](_0x4f7a5e[_0x21f5('0x41')],{'$or':_[_0x21f5('0x31')](_0x20b035,function(_0x1e309a){if(_0x1e309a[_0x21f5('0x43')]!==_0x21f5('0x44')){var _0x55e150={};_0x55e150[_0x1e309a['name']]={'$like':'%'+_0x33c407[_0x21f5('0x38')][_0x21f5('0x45')]+'%'};return _0x55e150;}})});}_0x4f7a5e=_['merge']({},_0x4f7a5e,_0x33c407[_0x21f5('0x46')]);var _0x233df2={'where':_0x4f7a5e[_0x21f5('0x41')]};return db['CmList'][_0x21f5('0x24')](_0x233df2)[_0x21f5('0x2b')](function(_0xccafb4){_0x3f0f4b[_0x21f5('0x24')]=_0xccafb4;if(_0x33c407[_0x21f5('0x38')]['includeAll']){_0x4f7a5e[_0x21f5('0x47')]=[{'all':!![]}];}return db['CmList'][_0x21f5('0x48')](_0x4f7a5e);})[_0x21f5('0x2b')](function(_0x57431e){_0x3f0f4b[_0x21f5('0x49')]=_0x57431e;return _0x3f0f4b;})[_0x21f5('0x2b')](respondWithFilteredResult(_0x14b322,_0x4f7a5e))[_0x21f5('0x4a')](handleError(_0x14b322,null));};exports[_0x21f5('0x4b')]=function(_0x472ea9,_0x563d1e){var _0x3300b5={'raw':![],'where':{'id':_0x472ea9['params']['id']}},_0x43a12e={};_0x43a12e[_0x21f5('0x35')]=_['keys'](db[_0x21f5('0x4c')][_0x21f5('0x32')]);_0x43a12e[_0x21f5('0x38')]=_[_0x21f5('0x36')](_0x472ea9[_0x21f5('0x38')]);_0x43a12e[_0x21f5('0x37')]=_['intersection'](_0x43a12e[_0x21f5('0x35')],_0x43a12e[_0x21f5('0x38')]);_0x3300b5['attributes']=_[_0x21f5('0x3a')](_0x43a12e[_0x21f5('0x35')],qs[_0x21f5('0x3b')](_0x472ea9[_0x21f5('0x38')][_0x21f5('0x3b')]));_0x3300b5[_0x21f5('0x39')]=_0x3300b5[_0x21f5('0x39')][_0x21f5('0x3c')]?_0x3300b5[_0x21f5('0x39')]:_0x43a12e[_0x21f5('0x35')];if(_0x472ea9[_0x21f5('0x38')][_0x21f5('0x4d')]){_0x3300b5[_0x21f5('0x47')]=[{'all':!![]}];}_0x3300b5=_[_0x21f5('0x42')]({},_0x3300b5,_0x472ea9[_0x21f5('0x46')]);return db[_0x21f5('0x4c')][_0x21f5('0x4e')](_0x3300b5)[_0x21f5('0x2b')](handleEntityNotFound(_0x563d1e,null))['then'](respondWithResult(_0x563d1e,null))[_0x21f5('0x4a')](handleError(_0x563d1e,null));};exports[_0x21f5('0x4f')]=function(_0x57357d,_0x5f4052){return db[_0x21f5('0x4c')][_0x21f5('0x4f')](_0x57357d[_0x21f5('0x50')],{})[_0x21f5('0x2b')](function(_0x40b516){var _0x268040=_0x57357d['user']['get']({'plain':!![]});if(!_0x268040)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x268040[_0x21f5('0x51')]==='user'){var _0x4264f1=_0x40b516[_0x21f5('0x2d')]({'plain':!![]});var _0x5d9903=_0x21f5('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x5d9903,'userProfileId':_0x268040['userProfileId']},'raw':!![]})['then'](function(_0x48258d){if(_0x48258d&&_0x48258d[_0x21f5('0x52')]===0x0){return db['UserProfileResource'][_0x21f5('0x4f')]({'name':_0x4264f1[_0x21f5('0x2f')],'resourceId':_0x4264f1['id'],'type':_0x48258d[_0x21f5('0x2f')],'sectionId':_0x48258d['id']},{})[_0x21f5('0x2b')](function(){return _0x40b516;});}else{return _0x40b516;}})[_0x21f5('0x4a')](function(_0x100121){logger[_0x21f5('0x53')](_0x21f5('0x54'),_0x100121);throw _0x100121;});}return _0x40b516;})[_0x21f5('0x2b')](respondWithResult(_0x5f4052,0xc9))['catch'](handleError(_0x5f4052,null));};exports[_0x21f5('0x2a')]=function(_0x37984b,_0x5a3234){if(_0x37984b[_0x21f5('0x50')]['id']){delete _0x37984b[_0x21f5('0x50')]['id'];}return db[_0x21f5('0x4c')][_0x21f5('0x4e')]({'where':{'id':_0x37984b['params']['id']}})[_0x21f5('0x2b')](handleEntityNotFound(_0x5a3234,null))['then'](saveUpdates(_0x37984b[_0x21f5('0x50')],null))['then'](respondWithResult(_0x5a3234,null))['catch'](handleError(_0x5a3234,null));};exports[_0x21f5('0x2c')]=function(_0x583ba0,_0x6b8119){return db[_0x21f5('0x4c')][_0x21f5('0x4e')]({'where':{'id':_0x583ba0[_0x21f5('0x55')]['id']}})[_0x21f5('0x2b')](handleEntityNotFound(_0x6b8119,null))[_0x21f5('0x2b')](removeEntity(_0x6b8119,null))[_0x21f5('0x4a')](handleError(_0x6b8119,null));};exports['describe']=function(_0x4c74ca,_0x599064){return db[_0x21f5('0x4c')][_0x21f5('0x56')]()[_0x21f5('0x2b')](respondWithResult(_0x599064,null))['catch'](handleError(_0x599064,null));};exports[_0x21f5('0x57')]=function(_0xc963fd,_0x240274,_0xa05968){if(_0xc963fd[_0x21f5('0x50')]['id']){delete _0xc963fd[_0x21f5('0x50')]['id'];}return db[_0x21f5('0x4c')]['find']({'where':{'id':_0xc963fd['params']['id']}})[_0x21f5('0x2b')](handleEntityNotFound(_0x240274,null))[_0x21f5('0x2b')](function(_0x1fba95){if(_0x1fba95){_0xc963fd[_0x21f5('0x50')][_0x21f5('0x58')]=_0x1fba95['id'];return db['Disposition']['create'](_0xc963fd[_0x21f5('0x50')]);}})[_0x21f5('0x2b')](respondWithResult(_0x240274,null))[_0x21f5('0x4a')](handleError(_0x240274,null));};exports[_0x21f5('0x59')]=function(_0x6fe223,_0x5151bd,_0x2bad46){var _0x55a4f9={'raw':![],'where':{}};var _0xba224={};var _0x4df29e={'count':0x0,'rows':[]};return db[_0x21f5('0x4c')]['findOne']({'where':{'id':_0x6fe223[_0x21f5('0x55')]['id']}})[_0x21f5('0x2b')](handleEntityNotFound(_0x5151bd,null))[_0x21f5('0x2b')](function(_0x13b797){if(_0x13b797){_0xba224[_0x21f5('0x35')]=_[_0x21f5('0x36')](db[_0x21f5('0x5a')][_0x21f5('0x32')]);_0xba224[_0x21f5('0x38')]=_[_0x21f5('0x36')](_0x6fe223[_0x21f5('0x38')]);_0xba224[_0x21f5('0x37')]=_[_0x21f5('0x3a')](_0xba224[_0x21f5('0x35')],_0xba224[_0x21f5('0x38')]);_0x55a4f9[_0x21f5('0x39')]=_['intersection'](_0xba224[_0x21f5('0x35')],qs[_0x21f5('0x3b')](_0x6fe223[_0x21f5('0x38')][_0x21f5('0x3b')]));_0x55a4f9[_0x21f5('0x39')]=_0x55a4f9['attributes'][_0x21f5('0x3c')]?_0x55a4f9[_0x21f5('0x39')]:_0xba224['model'];if(!_0x6fe223[_0x21f5('0x38')]['hasOwnProperty'](_0x21f5('0x3e'))){_0x55a4f9[_0x21f5('0x23')]=qs['limit'](_0x6fe223[_0x21f5('0x38')][_0x21f5('0x23')]);_0x55a4f9['offset']=qs[_0x21f5('0x25')](_0x6fe223[_0x21f5('0x38')]['offset']);}_0x55a4f9['order']=qs[_0x21f5('0x40')](_0x6fe223['query'][_0x21f5('0x40')]);_0x55a4f9[_0x21f5('0x41')]=qs[_0x21f5('0x37')](_['pick'](_0x6fe223[_0x21f5('0x38')],_0xba224[_0x21f5('0x37')]));_0x55a4f9[_0x21f5('0x41')][_0x21f5('0x58')]=_0x13b797['id'];if(_0x6fe223[_0x21f5('0x38')][_0x21f5('0x45')]){_0x55a4f9['where']=_[_0x21f5('0x42')](_0x55a4f9[_0x21f5('0x41')],{'$or':_[_0x21f5('0x31')](_0x55a4f9[_0x21f5('0x39')],function(_0xb66226){var _0x446dbf={};_0x446dbf[_0xb66226]={'$like':'%'+_0x6fe223[_0x21f5('0x38')]['filter']+'%'};return _0x446dbf;})});}_0x55a4f9=_['merge']({},_0x55a4f9,_0x6fe223[_0x21f5('0x46')]);return db[_0x21f5('0x5a')][_0x21f5('0x24')]({'where':_0x55a4f9[_0x21f5('0x41')]})[_0x21f5('0x2b')](function(_0x4695f1){_0x4df29e[_0x21f5('0x24')]=_0x4695f1;if(_0x6fe223[_0x21f5('0x38')]['includeAll']){_0x55a4f9['include']=[{'all':!![]}];}return db[_0x21f5('0x5a')][_0x21f5('0x48')](_0x55a4f9);})['then'](function(_0x4c2e81){_0x4df29e['rows']=_0x4c2e81;return _0x4df29e;});}})[_0x21f5('0x2b')](respondWithFilteredResult(_0x5151bd,_0x55a4f9))['catch'](handleError(_0x5151bd,null));};exports[_0x21f5('0x5b')]=function(_0x3b3c3f,_0x38709e,_0x3a745f){return db[_0x21f5('0x4c')][_0x21f5('0x4e')]({'where':{'id':_0x3b3c3f[_0x21f5('0x55')]['id']}})[_0x21f5('0x2b')](handleEntityNotFound(_0x38709e,null))['then'](function(_0x205c3b){if(_0x205c3b){return _0x205c3b[_0x21f5('0x5b')](_0x3b3c3f['query'][_0x21f5('0x5c')]);}})[_0x21f5('0x2b')](respondWithStatusCode(_0x38709e,null))[_0x21f5('0x4a')](handleError(_0x38709e,null));};exports[_0x21f5('0x5d')]=function(_0x458c1e,_0x23a82e,_0x508b2b){return db[_0x21f5('0x4c')][_0x21f5('0x4e')]({'where':{'id':_0x458c1e[_0x21f5('0x55')]['id']}})[_0x21f5('0x2b')](handleEntityNotFound(_0x23a82e,null))[_0x21f5('0x2b')](function(_0x614904){if(_0x614904){var _0x55f6b8=[];var _0x1c0a0e={'success':[],'errors':[]};return db[_0x21f5('0x5e')][_0x21f5('0x56')]()['then'](function(_0x52967b){if(_0x458c1e['body'][_0x21f5('0x5f')]&&_[_0x21f5('0x60')](_0x458c1e[_0x21f5('0x50')][_0x21f5('0x5f')])){if(_0x458c1e[_0x21f5('0x50')][_0x21f5('0x5f')][_0x21f5('0x3c')]){_0x458c1e[_0x21f5('0x50')][_0x21f5('0x5f')]=_0x458c1e[_0x21f5('0x50')][_0x21f5('0x5f')]['join'](';')+';';}else{_0x458c1e['body'][_0x21f5('0x5f')]=null;}}else{_0x458c1e[_0x21f5('0x50')][_0x21f5('0x5f')]=null;}if(_0x458c1e['body']&&_[_0x21f5('0x60')](_0x458c1e['body'])){for(var _0x484813=0x0;_0x484813<_0x458c1e[_0x21f5('0x50')][_0x21f5('0x3c')];_0x484813+=0x1){_0x458c1e[_0x21f5('0x50')][_0x484813][_0x21f5('0x58')]=_0x458c1e[_0x21f5('0x55')]['id'];_0x55f6b8[_0x21f5('0x61')](_0x458c1e['body'][_0x484813]);}return BPromise[_0x21f5('0x62')](_0x55f6b8,function(_0x425011){return db[_0x21f5('0x5e')][_0x21f5('0x4f')](_[_0x21f5('0x63')](_0x425011,[_0x21f5('0x5c'),'id'])||{},{'fields':_[_0x21f5('0x36')](_0x52967b),'raw':!![]})['then'](function(_0x1ddf25){_0x1c0a0e[_0x21f5('0x64')][_0x21f5('0x61')](_0x1ddf25['dataValues']);})[_0x21f5('0x4a')](function(_0xdbd68a){_0x1c0a0e['errors'][_0x21f5('0x61')]({'data':_0x425011,'error':_0xdbd68a[_0x21f5('0x65')]});});})[_0x21f5('0x2b')](function(_0xa84646){return _0x1c0a0e;})[_0x21f5('0x4a')](function(_0x385746){return _0x385746;});}else{_0x23a82e[_0x21f5('0x1f')](0x190)[_0x21f5('0x21')]({'message':_0x21f5('0x66')});}});}})[_0x21f5('0x2b')](respondWithResult(_0x23a82e,null))[_0x21f5('0x4a')](handleError(_0x23a82e,null));};exports[_0x21f5('0x67')]=function(_0x16260e,_0x18321f,_0x46f8cb){var _0x52aada;return db[_0x21f5('0x4c')]['find']({'where':{'id':_0x16260e[_0x21f5('0x55')]['id']},'include':[{'model':db[_0x21f5('0x68')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x18321f,null))[_0x21f5('0x2b')](function(_0x490138){if(_0x490138){_0x52aada=_0x490138;return db[_0x21f5('0x5e')][_0x21f5('0x32')];}})[_0x21f5('0x2b')](function(_0x3fb964){if(_0x3fb964){var _0xf931be={};var _0x436d93={};_0x436d93[_0x21f5('0x35')]=_['concat'](_[_0x21f5('0x36')](_0x3fb964),_[_0x21f5('0x31')](_0x52aada[_0x21f5('0x69')],function(_0x1f0a0f){return util[_0x21f5('0x6a')](_0x21f5('0x6b'),_0x1f0a0f['id']);}));_0x436d93[_0x21f5('0x38')]=_['keys'](_0x16260e['query']);_0x436d93[_0x21f5('0x37')]=_[_0x21f5('0x3a')](_0x436d93['model'],_0x436d93['query']);_0xf931be[_0x21f5('0x39')]=_[_0x21f5('0x3a')](_0x436d93[_0x21f5('0x35')],qs[_0x21f5('0x3b')](_0x16260e[_0x21f5('0x38')][_0x21f5('0x3b')]));_0xf931be[_0x21f5('0x39')]=_0xf931be[_0x21f5('0x39')][_0x21f5('0x3c')]?_0xf931be['attributes']:_0x436d93[_0x21f5('0x35')];if(!_0x16260e[_0x21f5('0x38')]['hasOwnProperty'](_0x21f5('0x3e'))){_0xf931be[_0x21f5('0x23')]=qs[_0x21f5('0x23')](_0x16260e['query'][_0x21f5('0x23')]);_0xf931be['offset']=qs[_0x21f5('0x25')](_0x16260e['query'][_0x21f5('0x25')]);}_0xf931be[_0x21f5('0x3f')]=qs[_0x21f5('0x40')](_0x16260e[_0x21f5('0x38')][_0x21f5('0x40')]);_0xf931be[_0x21f5('0x41')]=qs[_0x21f5('0x37')](_['pick'](_0x16260e[_0x21f5('0x38')],_0x436d93[_0x21f5('0x37')]));_0xf931be[_0x21f5('0x6c')]=!![];if(_0x16260e['query']['filter']){_0xf931be['where']=_[_0x21f5('0x42')](_0xf931be['where'],{'$or':_['map'](_0xf931be['attributes'],function(_0xbb58b4){var _0x2ed076={};_0x2ed076[_0xbb58b4]={'$like':'%'+_0x16260e['query'][_0x21f5('0x45')]+'%'};return _0x2ed076;})});}_0xf931be=_['merge']({},_0xf931be,_0x16260e['options']);return _0x52aada[_0x21f5('0x67')](_0xf931be);}})['then'](respondWithResult(_0x18321f,null))['catch'](handleError(_0x18321f,null));};exports[_0x21f5('0x6d')]=function(_0x7924ac,_0xbb9dd4,_0x496481){var _0x509c5a;return db[_0x21f5('0x4c')][_0x21f5('0x4e')]({'where':{'id':_0x7924ac[_0x21f5('0x55')]['id']},'include':[{'model':db[_0x21f5('0x68')],'as':_0x21f5('0x69')}]})[_0x21f5('0x2b')](handleEntityNotFound(_0xbb9dd4,null))[_0x21f5('0x2b')](function(_0x3a926e){if(_0x3a926e){_0x509c5a=_0x3a926e;return db[_0x21f5('0x5e')][_0x21f5('0x32')];}})[_0x21f5('0x2b')](function(_0x428dee){if(_0x428dee){var _0x147d67={};var _0x3df38e={};_0x3df38e[_0x21f5('0x35')]=_['concat'](_[_0x21f5('0x36')](_0x428dee),_[_0x21f5('0x31')](_0x509c5a[_0x21f5('0x69')],function(_0x5c6f26){return util['format']('cf_%d',_0x5c6f26['id']);}));_0x3df38e[_0x21f5('0x38')]=_[_0x21f5('0x36')](_0x7924ac[_0x21f5('0x38')]);_0x3df38e[_0x21f5('0x37')]=_[_0x21f5('0x3a')](_0x3df38e[_0x21f5('0x35')],_0x3df38e[_0x21f5('0x38')]);_0x147d67[_0x21f5('0x39')]=_[_0x21f5('0x3a')](_0x3df38e['model'],qs[_0x21f5('0x3b')](_0x7924ac[_0x21f5('0x38')][_0x21f5('0x3b')]));_0x147d67[_0x21f5('0x39')]=_0x147d67[_0x21f5('0x39')][_0x21f5('0x3c')]?_0x147d67[_0x21f5('0x39')]:_0x3df38e[_0x21f5('0x35')];if(!_0x7924ac[_0x21f5('0x38')][_0x21f5('0x3d')]('nolimit')){_0x147d67[_0x21f5('0x23')]=qs[_0x21f5('0x23')](_0x7924ac[_0x21f5('0x38')][_0x21f5('0x23')]);_0x147d67[_0x21f5('0x25')]=qs[_0x21f5('0x25')](_0x7924ac['query'][_0x21f5('0x25')]);}_0x147d67[_0x21f5('0x3f')]=qs[_0x21f5('0x40')](_0x7924ac[_0x21f5('0x38')][_0x21f5('0x40')]);_0x147d67[_0x21f5('0x41')]=qs[_0x21f5('0x37')](_[_0x21f5('0x6e')](_0x7924ac['query'],_0x3df38e[_0x21f5('0x37')]));_0x147d67['raw']=!![];if(_0x7924ac[_0x21f5('0x38')][_0x21f5('0x45')]){_0x147d67[_0x21f5('0x41')]=_[_0x21f5('0x42')](_0x147d67[_0x21f5('0x41')],{'$or':_[_0x21f5('0x31')](_0x147d67['attributes'],function(_0x61db00){var _0x348c62={};_0x348c62[_0x61db00]={'$like':'%'+_0x7924ac[_0x21f5('0x38')][_0x21f5('0x45')]+'%'};return _0x348c62;})});}_0x147d67=_[_0x21f5('0x42')]({},_0x147d67,_0x7924ac[_0x21f5('0x46')]);return _0x509c5a[_0x21f5('0x67')](_0x147d67);}})[_0x21f5('0x2b')](function(_0x2d4b3e){if(!_['isEmpty'](_0x2d4b3e)){var _0x153f75=toCsv(_0x2d4b3e);var _0x2b892c=Date[_0x21f5('0x6f')]();fs[_0x21f5('0x70')](util[_0x21f5('0x6a')]('/tmp/list_%d_%s.csv',_0x509c5a['id'],_0x2b892c),_0x153f75);_0xbb9dd4[_0x21f5('0x71')]('Content-disposition','attachment;\x20filename='+util[_0x21f5('0x6a')]('list_%d_%s.csv',_0x509c5a['id'],_0x2b892c));_0xbb9dd4[_0x21f5('0x71')](_0x21f5('0x72'),_0x21f5('0x73'));return _0xbb9dd4[_0x21f5('0x74')](util[_0x21f5('0x6a')](_0x21f5('0x75'),_0x509c5a['id'],_0x2b892c));}else{return _0xbb9dd4['sendStatus'](0xcc);}})[_0x21f5('0x4a')](handleError(_0xbb9dd4,null));};exports['addCustomField']=function(_0x4cef54,_0x217acb,_0x2bd1e4){var _0x2801e8;delete _0x4cef54[_0x21f5('0x50')]['id'];return db[_0x21f5('0x4c')]['findOne']({'where':{'id':_0x4cef54['params']['id']}})[_0x21f5('0x2b')](handleEntityNotFound(_0x217acb,null))[_0x21f5('0x2b')](function(_0x3ce20e){if(_0x3ce20e){return db[_0x21f5('0x76')][_0x21f5('0x77')](function(_0x2372ac){return db[_0x21f5('0x68')]['create'](_0x4cef54[_0x21f5('0x50')],{'transaction':_0x2372ac})['then'](function(_0x73ba6a){_0x2801e8=_0x73ba6a;return _0x3ce20e[_0x21f5('0x78')](_0x73ba6a,{'transaction':_0x2372ac});})['then'](function(){var _0x739b28={'type':db[_0x21f5('0x79')][_0x21f5('0x7a')],'transaction':_0x2372ac};switch(_0x4cef54[_0x21f5('0x50')]['type']){case _0x21f5('0x7b'):_0x739b28['type']=db[_0x21f5('0x79')][_0x21f5('0x7a')];break;case _0x21f5('0x7c'):_0x739b28[_0x21f5('0x43')]=db[_0x21f5('0x79')]['INTEGER'];break;case _0x21f5('0x7d'):_0x739b28['type']=db['Sequelize'][_0x21f5('0x7e')];_0x739b28[_0x21f5('0x7f')]=![];break;default:}return db[_0x21f5('0x76')][_0x21f5('0x80')][_0x21f5('0x81')](_0x21f5('0x82'),util[_0x21f5('0x6a')]('cf_%s',_0x2801e8['id']),_0x739b28);})[_0x21f5('0x2b')](function(){return _0x2801e8;});});}})[_0x21f5('0x2b')](respondWithResult(_0x217acb,null))['catch'](handleError(_0x217acb,null));};exports['getCustomFields']=function(_0x425644,_0x4db3a6,_0x547820){var _0x3cb7c4={};var _0x576c99={};var _0x11a1cc;var _0x393049;return db['CmList'][_0x21f5('0x83')]({'where':{'id':_0x425644[_0x21f5('0x55')]['id']}})[_0x21f5('0x2b')](handleEntityNotFound(_0x4db3a6,null))[_0x21f5('0x2b')](function(_0x5d3266){if(_0x5d3266){_0x11a1cc=_0x5d3266;_0x576c99[_0x21f5('0x35')]=_['keys'](db[_0x21f5('0x68')][_0x21f5('0x32')]);_0x576c99[_0x21f5('0x38')]=_['keys'](_0x425644[_0x21f5('0x38')]);_0x576c99['filters']=_[_0x21f5('0x3a')](_0x576c99[_0x21f5('0x35')],_0x576c99[_0x21f5('0x38')]);_0x3cb7c4[_0x21f5('0x39')]=_[_0x21f5('0x3a')](_0x576c99[_0x21f5('0x35')],qs[_0x21f5('0x3b')](_0x425644['query'][_0x21f5('0x3b')]));_0x3cb7c4[_0x21f5('0x39')]=_0x3cb7c4['attributes'][_0x21f5('0x3c')]?_0x3cb7c4[_0x21f5('0x39')]:_0x576c99[_0x21f5('0x35')];_0x3cb7c4['order']=qs[_0x21f5('0x40')](_0x425644['query'][_0x21f5('0x40')]);_0x3cb7c4[_0x21f5('0x41')]=qs[_0x21f5('0x37')](_[_0x21f5('0x6e')](_0x425644['query'],_0x576c99['filters']));_0x3cb7c4[_0x21f5('0x41')]=_[_0x21f5('0x42')](_0x3cb7c4['where'],{'$or':[{'ListId':_0x5d3266['id']},{'ListId':null}]});if(_0x425644[_0x21f5('0x38')][_0x21f5('0x45')]){_0x3cb7c4['where']=_[_0x21f5('0x42')](_0x3cb7c4[_0x21f5('0x41')],{'$or':_[_0x21f5('0x31')](_0x3cb7c4['attributes'],function(_0x294a23){var _0x540f06={};_0x540f06[_0x294a23]={'$like':'%'+_0x425644[_0x21f5('0x38')]['filter']+'%'};return _0x540f06;})});}_0x3cb7c4=_[_0x21f5('0x42')]({},_0x3cb7c4,_0x425644[_0x21f5('0x46')]);return db[_0x21f5('0x68')][_0x21f5('0x84')](_0x3cb7c4);}})[_0x21f5('0x2b')](respondWithResult(_0x4db3a6,null))[_0x21f5('0x4a')](handleError(_0x4db3a6,null));};exports[_0x21f5('0x85')]=function(_0x111e70,_0x4e2358,_0xa22b93){return db[_0x21f5('0x4c')][_0x21f5('0x4e')]({'where':{'id':_0x111e70[_0x21f5('0x55')]['id']}})[_0x21f5('0x2b')](handleEntityNotFound(_0x4e2358,null))[_0x21f5('0x2b')](function(_0x1e455c){if(_0x1e455c){return _0x1e455c['addAgents'](_0x111e70['body'][_0x21f5('0x5c')],_[_0x21f5('0x63')](_0x111e70['body'],[_0x21f5('0x5c'),'id'])||{})[_0x21f5('0x86')](function(_0x196750){for(var _0xcefe79=0x0;_0xcefe79<_0x111e70['body']['ids']['length'];_0xcefe79+=0x1){socket[_0x21f5('0x87')](_0x21f5('0x88'),{'UserId':Number(_0x111e70[_0x21f5('0x50')]['ids'][_0xcefe79]),'CmListId':Number(_0x111e70[_0x21f5('0x55')]['id'])});}return _0x196750;});}})[_0x21f5('0x2b')](respondWithResult(_0x4e2358,null))[_0x21f5('0x4a')](handleError(_0x4e2358,null));};exports['removeAgents']=function(_0x3cda0d,_0x16c7dd,_0x116401){return db[_0x21f5('0x4c')][_0x21f5('0x4e')]({'where':{'id':_0x3cda0d[_0x21f5('0x55')]['id']}})['then'](handleEntityNotFound(_0x16c7dd,null))[_0x21f5('0x2b')](function(_0x5ee143){if(_0x5ee143){return _0x5ee143[_0x21f5('0x89')](_0x3cda0d[_0x21f5('0x38')][_0x21f5('0x5c')])['then'](function(){if(_[_0x21f5('0x60')](_0x3cda0d['query'][_0x21f5('0x5c')])){for(var _0x443a56=0x0;_0x443a56<_0x3cda0d[_0x21f5('0x38')][_0x21f5('0x5c')][_0x21f5('0x3c')];_0x443a56+=0x1){socket[_0x21f5('0x87')](_0x21f5('0x8a'),{'UserId':Number(_0x3cda0d[_0x21f5('0x38')][_0x21f5('0x5c')][_0x443a56]),'CmListId':Number(_0x3cda0d['params']['id'])});}}else{socket[_0x21f5('0x87')](_0x21f5('0x8a'),{'UserId':Number(_0x3cda0d[_0x21f5('0x38')][_0x21f5('0x5c')]),'CmListId':Number(_0x3cda0d[_0x21f5('0x55')]['id'])});}});}})[_0x21f5('0x2b')](respondWithStatusCode(_0x16c7dd,null))[_0x21f5('0x4a')](handleError(_0x16c7dd,null));};exports[_0x21f5('0x8b')]=function(_0x518717,_0x34c555,_0x259004){var _0x11a369={};var _0x348eb1={};var _0x512089;var _0x226d1b;return db['CmList']['findOne']({'where':{'id':_0x518717[_0x21f5('0x55')]['id']}})[_0x21f5('0x2b')](handleEntityNotFound(_0x34c555,null))['then'](function(_0x457033){if(_0x457033){_0x512089=_0x457033;_0x348eb1['model']=_['keys'](db[_0x21f5('0x8c')]['rawAttributes']);_0x348eb1[_0x21f5('0x38')]=_[_0x21f5('0x36')](_0x518717[_0x21f5('0x38')]);_0x348eb1[_0x21f5('0x37')]=_['intersection'](_0x348eb1[_0x21f5('0x35')],_0x348eb1['query']);_0x11a369[_0x21f5('0x39')]=_[_0x21f5('0x3a')](_0x348eb1[_0x21f5('0x35')],qs[_0x21f5('0x3b')](_0x518717[_0x21f5('0x38')][_0x21f5('0x3b')]));_0x11a369['attributes']=_0x11a369[_0x21f5('0x39')][_0x21f5('0x3c')]?_0x11a369['attributes']:_0x348eb1[_0x21f5('0x35')];_0x11a369[_0x21f5('0x3f')]=qs['sort'](_0x518717['query'][_0x21f5('0x40')]);_0x11a369[_0x21f5('0x41')]=qs[_0x21f5('0x37')](_[_0x21f5('0x6e')](_0x518717[_0x21f5('0x38')],_0x348eb1[_0x21f5('0x37')]));if(_0x518717[_0x21f5('0x38')]['filter']){_0x11a369[_0x21f5('0x41')]=_[_0x21f5('0x42')](_0x11a369['where'],{'$or':_[_0x21f5('0x31')](_0x11a369['attributes'],function(_0x1e7ae5){var _0x161f28={};_0x161f28[_0x1e7ae5]={'$like':'%'+_0x518717[_0x21f5('0x38')][_0x21f5('0x45')]+'%'};return _0x161f28;})});}_0x11a369=_[_0x21f5('0x42')]({},_0x11a369,_0x518717[_0x21f5('0x46')]);return _0x512089[_0x21f5('0x8b')](_0x11a369);}})['then'](function(_0x53e5c9){if(_0x53e5c9){_0x226d1b=_0x53e5c9[_0x21f5('0x3c')];if(!_0x518717[_0x21f5('0x38')][_0x21f5('0x3d')](_0x21f5('0x3e'))){_0x11a369[_0x21f5('0x23')]=qs[_0x21f5('0x23')](_0x518717[_0x21f5('0x38')]['limit']);_0x11a369[_0x21f5('0x25')]=qs[_0x21f5('0x25')](_0x518717['query'][_0x21f5('0x25')]);}return _0x512089[_0x21f5('0x8b')](_0x11a369);}})[_0x21f5('0x2b')](function(_0x39ff1e){if(_0x39ff1e){return _0x39ff1e?{'count':_0x226d1b,'rows':_0x39ff1e}:null;}})['then'](respondWithResult(_0x34c555,null))[_0x21f5('0x4a')](handleError(_0x34c555,null));}; \ No newline at end of file +var _0x3d7e=['spread','emit','userCmList:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','save','update','destroy','get','Lists','UserProfileResource','then','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','describe','addDisposition','ListId','findOne','Disposition','hasOwnProperty','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','nolimit','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit'];(function(_0x4fa169,_0x412b2c){var _0x337386=function(_0x5dac3e){while(--_0x5dac3e){_0x4fa169['push'](_0x4fa169['shift']());}};_0x337386(++_0x412b2c);}(_0x3d7e,0x1ae));var _0xe3d7=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0x3d7e[_0x13ac10];return _0x28eda2;};'use strict';var emlformat=require(_0xe3d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3d7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3d7('0x2'));var moment=require(_0xe3d7('0x3'));var BPromise=require(_0xe3d7('0x4'));var Mustache=require(_0xe3d7('0x5'));var util=require(_0xe3d7('0x6'));var path=require(_0xe3d7('0x7'));var sox=require('sox');var csv=require(_0xe3d7('0x8'));var ejs=require(_0xe3d7('0x9'));var fs=require('fs');var fs_extra=require(_0xe3d7('0xa'));var _=require('lodash');var squel=require(_0xe3d7('0xb'));var crypto=require(_0xe3d7('0xc'));var jsforce=require(_0xe3d7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe3d7('0x8'));var querystring=require(_0xe3d7('0xe'));var Papa=require(_0xe3d7('0xf'));var Redis=require(_0xe3d7('0x10'));var authService=require(_0xe3d7('0x11'));var qs=require(_0xe3d7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3d7('0x13'));var logger=require(_0xe3d7('0x14'))(_0xe3d7('0x15'));var utils=require(_0xe3d7('0x16'));var config=require(_0xe3d7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3d7('0x18'))['db'];config['redis']=_[_0xe3d7('0x19')](config[_0xe3d7('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe3d7('0x1b'))(new Redis(config[_0xe3d7('0x1a')]));require(_0xe3d7('0x1c'))[_0xe3d7('0x1d')](socket);function respondWithStatusCode(_0x1ca9af,_0x35b879){_0x35b879=_0x35b879||0xcc;return function(_0xda611d){if(_0xda611d){return _0x1ca9af[_0xe3d7('0x1e')](_0x35b879);}return _0x1ca9af[_0xe3d7('0x1f')](_0x35b879)[_0xe3d7('0x20')]();};}function respondWithResult(_0x3a0f5d,_0x557a4b){_0x557a4b=_0x557a4b||0xc8;return function(_0x2370ab){if(_0x2370ab){return _0x3a0f5d[_0xe3d7('0x1f')](_0x557a4b)[_0xe3d7('0x21')](_0x2370ab);}};}function respondWithFilteredResult(_0x3598b7,_0x1be243){return function(_0xb2d3d1){if(_0xb2d3d1){var _0x4eddd6=typeof _0x1be243['offset']===_0xe3d7('0x22')&&typeof _0x1be243['limit']===_0xe3d7('0x22');var _0x3d3b5f=_0xb2d3d1[_0xe3d7('0x23')];var _0x1fee7c=_0x4eddd6?0x0:_0x1be243[_0xe3d7('0x24')];var _0xfaa878=_0x4eddd6?_0xb2d3d1[_0xe3d7('0x23')]:_0x1be243[_0xe3d7('0x24')]+_0x1be243[_0xe3d7('0x25')];var _0x53238c;if(_0xfaa878>=_0x3d3b5f){_0xfaa878=_0x3d3b5f;_0x53238c=0xc8;}else{_0x53238c=0xce;}_0x3598b7[_0xe3d7('0x1f')](_0x53238c);return _0x3598b7[_0xe3d7('0x26')]('Content-Range',_0x1fee7c+'-'+_0xfaa878+'/'+_0x3d3b5f)['json'](_0xb2d3d1);}return null;};}function patchUpdates(_0x469278){return function(_0x3fd1ba){try{jsonpatch['apply'](_0x3fd1ba,_0x469278,!![]);}catch(_0x2768fd){return BPromise['reject'](_0x2768fd);}return _0x3fd1ba[_0xe3d7('0x27')]();};}function saveUpdates(_0x447ee8,_0x6145c4){return function(_0x334480){if(_0x334480){return _0x334480[_0xe3d7('0x28')](_0x447ee8)['then'](function(_0x15b8d1){return _0x15b8d1;});}return null;};}function removeEntity(_0x4df9a0,_0x5cc3a4){return function(_0x39acc5){if(_0x39acc5){return _0x39acc5[_0xe3d7('0x29')]()['then'](function(){var _0x51a6b3=_0x39acc5[_0xe3d7('0x2a')]({'plain':!![]});var _0x523fc=_0xe3d7('0x2b');return db[_0xe3d7('0x2c')][_0xe3d7('0x29')]({'where':{'type':_0x523fc,'resourceId':_0x51a6b3['id']}})[_0xe3d7('0x2d')](function(){return _0x39acc5;});})[_0xe3d7('0x2d')](function(){_0x4df9a0[_0xe3d7('0x1f')](0xcc)[_0xe3d7('0x20')]();});}};}function handleEntityNotFound(_0x4b9437,_0x37d4b0){return function(_0x5c870b){if(!_0x5c870b){_0x4b9437[_0xe3d7('0x1e')](0x194);}return _0x5c870b;};}function handleError(_0xc804cd,_0x1fafc4){_0x1fafc4=_0x1fafc4||0x1f4;return function(_0x596678){logger['error'](_0x596678[_0xe3d7('0x2e')]);if(_0x596678[_0xe3d7('0x2f')]){delete _0x596678['name'];}_0xc804cd[_0xe3d7('0x1f')](_0x1fafc4)[_0xe3d7('0x30')](_0x596678);};}exports[_0xe3d7('0x31')]=function(_0x21840c,_0x5cbd35){var _0x5af9d6={},_0x88ea03={},_0x55747d={'count':0x0,'rows':[]};var _0x5e7dca=_[_0xe3d7('0x32')](db[_0xe3d7('0x33')][_0xe3d7('0x34')],function(_0x3b3281){return{'name':_0x3b3281[_0xe3d7('0x35')],'type':_0x3b3281['type'][_0xe3d7('0x36')]};});_0x88ea03[_0xe3d7('0x37')]=_[_0xe3d7('0x32')](_0x5e7dca,_0xe3d7('0x2f'));_0x88ea03[_0xe3d7('0x38')]=_[_0xe3d7('0x39')](_0x21840c['query']);_0x88ea03[_0xe3d7('0x3a')]=_[_0xe3d7('0x3b')](_0x88ea03[_0xe3d7('0x37')],_0x88ea03[_0xe3d7('0x38')]);_0x5af9d6[_0xe3d7('0x3c')]=_[_0xe3d7('0x3b')](_0x88ea03[_0xe3d7('0x37')],qs[_0xe3d7('0x3d')](_0x21840c[_0xe3d7('0x38')]['fields']));_0x5af9d6['attributes']=_0x5af9d6[_0xe3d7('0x3c')][_0xe3d7('0x3e')]?_0x5af9d6[_0xe3d7('0x3c')]:_0x88ea03[_0xe3d7('0x37')];if(!_0x21840c[_0xe3d7('0x38')]['hasOwnProperty']('nolimit')){_0x5af9d6[_0xe3d7('0x25')]=qs[_0xe3d7('0x25')](_0x21840c[_0xe3d7('0x38')][_0xe3d7('0x25')]);_0x5af9d6[_0xe3d7('0x24')]=qs[_0xe3d7('0x24')](_0x21840c[_0xe3d7('0x38')]['offset']);}_0x5af9d6[_0xe3d7('0x3f')]=qs[_0xe3d7('0x40')](_0x21840c[_0xe3d7('0x38')][_0xe3d7('0x40')]);_0x5af9d6[_0xe3d7('0x41')]=qs[_0xe3d7('0x3a')](_[_0xe3d7('0x42')](_0x21840c[_0xe3d7('0x38')],_0x88ea03['filters']),_0x5e7dca);if(_0x21840c[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x5af9d6['where']=_['merge'](_0x5af9d6[_0xe3d7('0x41')],{'$or':_[_0xe3d7('0x32')](_0x5e7dca,function(_0x837846){if(_0x837846[_0xe3d7('0x44')]!==_0xe3d7('0x45')){var _0x50897c={};_0x50897c[_0x837846[_0xe3d7('0x2f')]]={'$like':'%'+_0x21840c[_0xe3d7('0x38')][_0xe3d7('0x43')]+'%'};return _0x50897c;}})});}_0x5af9d6=_[_0xe3d7('0x46')]({},_0x5af9d6,_0x21840c[_0xe3d7('0x47')]);var _0x2ae957={'where':_0x5af9d6[_0xe3d7('0x41')]};return db[_0xe3d7('0x33')][_0xe3d7('0x23')](_0x2ae957)[_0xe3d7('0x2d')](function(_0x56fb1a){_0x55747d[_0xe3d7('0x23')]=_0x56fb1a;if(_0x21840c[_0xe3d7('0x38')][_0xe3d7('0x48')]){_0x5af9d6['include']=[{'all':!![]}];}return db[_0xe3d7('0x33')]['findAll'](_0x5af9d6);})[_0xe3d7('0x2d')](function(_0x4407b1){_0x55747d[_0xe3d7('0x49')]=_0x4407b1;return _0x55747d;})['then'](respondWithFilteredResult(_0x5cbd35,_0x5af9d6))[_0xe3d7('0x4a')](handleError(_0x5cbd35,null));};exports['show']=function(_0x27b4a5,_0x2d1626){var _0x321e13={'raw':![],'where':{'id':_0x27b4a5[_0xe3d7('0x4b')]['id']}},_0x3c5410={};_0x3c5410[_0xe3d7('0x37')]=_[_0xe3d7('0x39')](db[_0xe3d7('0x33')][_0xe3d7('0x34')]);_0x3c5410[_0xe3d7('0x38')]=_[_0xe3d7('0x39')](_0x27b4a5[_0xe3d7('0x38')]);_0x3c5410[_0xe3d7('0x3a')]=_['intersection'](_0x3c5410[_0xe3d7('0x37')],_0x3c5410['query']);_0x321e13[_0xe3d7('0x3c')]=_[_0xe3d7('0x3b')](_0x3c5410[_0xe3d7('0x37')],qs[_0xe3d7('0x3d')](_0x27b4a5[_0xe3d7('0x38')]['fields']));_0x321e13[_0xe3d7('0x3c')]=_0x321e13['attributes'][_0xe3d7('0x3e')]?_0x321e13[_0xe3d7('0x3c')]:_0x3c5410[_0xe3d7('0x37')];if(_0x27b4a5[_0xe3d7('0x38')][_0xe3d7('0x48')]){_0x321e13[_0xe3d7('0x4c')]=[{'all':!![]}];}_0x321e13=_[_0xe3d7('0x46')]({},_0x321e13,_0x27b4a5[_0xe3d7('0x47')]);return db['CmList'][_0xe3d7('0x4d')](_0x321e13)[_0xe3d7('0x2d')](handleEntityNotFound(_0x2d1626,null))[_0xe3d7('0x2d')](respondWithResult(_0x2d1626,null))[_0xe3d7('0x4a')](handleError(_0x2d1626,null));};exports[_0xe3d7('0x4e')]=function(_0x1d951c,_0x5e79d4){return db['CmList']['create'](_0x1d951c[_0xe3d7('0x4f')],{})[_0xe3d7('0x2d')](function(_0x16a7dd){var _0x272203=_0x1d951c['user'][_0xe3d7('0x2a')]({'plain':!![]});if(!_0x272203)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x272203['role']===_0xe3d7('0x50')){var _0x3e34cc=_0x16a7dd[_0xe3d7('0x2a')]({'plain':!![]});var _0x24fe7b=_0xe3d7('0x2b');return db[_0xe3d7('0x51')][_0xe3d7('0x4d')]({'where':{'name':_0x24fe7b,'userProfileId':_0x272203[_0xe3d7('0x52')]},'raw':!![]})[_0xe3d7('0x2d')](function(_0xc2869b){if(_0xc2869b&&_0xc2869b[_0xe3d7('0x53')]===0x0){return db[_0xe3d7('0x2c')][_0xe3d7('0x4e')]({'name':_0x3e34cc['name'],'resourceId':_0x3e34cc['id'],'type':_0xc2869b[_0xe3d7('0x2f')],'sectionId':_0xc2869b['id']},{})[_0xe3d7('0x2d')](function(){return _0x16a7dd;});}else{return _0x16a7dd;}})[_0xe3d7('0x4a')](function(_0x3a3301){logger[_0xe3d7('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a3301);throw _0x3a3301;});}return _0x16a7dd;})[_0xe3d7('0x2d')](respondWithResult(_0x5e79d4,0xc9))['catch'](handleError(_0x5e79d4,null));};exports[_0xe3d7('0x28')]=function(_0x2395e9,_0x262b39){if(_0x2395e9[_0xe3d7('0x4f')]['id']){delete _0x2395e9[_0xe3d7('0x4f')]['id'];}return db['CmList'][_0xe3d7('0x4d')]({'where':{'id':_0x2395e9[_0xe3d7('0x4b')]['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x262b39,null))[_0xe3d7('0x2d')](saveUpdates(_0x2395e9['body'],null))[_0xe3d7('0x2d')](respondWithResult(_0x262b39,null))[_0xe3d7('0x4a')](handleError(_0x262b39,null));};exports[_0xe3d7('0x29')]=function(_0x1bb8b3,_0x378f6c){return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0x1bb8b3[_0xe3d7('0x4b')]['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x378f6c,null))[_0xe3d7('0x2d')](removeEntity(_0x378f6c,null))['catch'](handleError(_0x378f6c,null));};exports[_0xe3d7('0x55')]=function(_0x5b26fb,_0x4194de){return db[_0xe3d7('0x33')][_0xe3d7('0x55')]()[_0xe3d7('0x2d')](respondWithResult(_0x4194de,null))[_0xe3d7('0x4a')](handleError(_0x4194de,null));};exports[_0xe3d7('0x56')]=function(_0x2ac904,_0x324fd9,_0xffd632){if(_0x2ac904['body']['id']){delete _0x2ac904[_0xe3d7('0x4f')]['id'];}return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0x2ac904[_0xe3d7('0x4b')]['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x324fd9,null))['then'](function(_0x3687b8){if(_0x3687b8){_0x2ac904[_0xe3d7('0x4f')][_0xe3d7('0x57')]=_0x3687b8['id'];return db['Disposition']['create'](_0x2ac904['body']);}})[_0xe3d7('0x2d')](respondWithResult(_0x324fd9,null))[_0xe3d7('0x4a')](handleError(_0x324fd9,null));};exports['getDispositions']=function(_0xfe5a6e,_0x265fac,_0xc959e2){var _0x369aea={'raw':![],'where':{}};var _0x45ffb2={};var _0x12eb1b={'count':0x0,'rows':[]};return db['CmList'][_0xe3d7('0x58')]({'where':{'id':_0xfe5a6e[_0xe3d7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x265fac,null))[_0xe3d7('0x2d')](function(_0x23f7f0){if(_0x23f7f0){_0x45ffb2[_0xe3d7('0x37')]=_[_0xe3d7('0x39')](db[_0xe3d7('0x59')][_0xe3d7('0x34')]);_0x45ffb2[_0xe3d7('0x38')]=_[_0xe3d7('0x39')](_0xfe5a6e[_0xe3d7('0x38')]);_0x45ffb2[_0xe3d7('0x3a')]=_[_0xe3d7('0x3b')](_0x45ffb2[_0xe3d7('0x37')],_0x45ffb2[_0xe3d7('0x38')]);_0x369aea[_0xe3d7('0x3c')]=_[_0xe3d7('0x3b')](_0x45ffb2['model'],qs[_0xe3d7('0x3d')](_0xfe5a6e[_0xe3d7('0x38')][_0xe3d7('0x3d')]));_0x369aea[_0xe3d7('0x3c')]=_0x369aea[_0xe3d7('0x3c')][_0xe3d7('0x3e')]?_0x369aea[_0xe3d7('0x3c')]:_0x45ffb2['model'];if(!_0xfe5a6e['query'][_0xe3d7('0x5a')]('nolimit')){_0x369aea[_0xe3d7('0x25')]=qs[_0xe3d7('0x25')](_0xfe5a6e[_0xe3d7('0x38')][_0xe3d7('0x25')]);_0x369aea[_0xe3d7('0x24')]=qs[_0xe3d7('0x24')](_0xfe5a6e[_0xe3d7('0x38')][_0xe3d7('0x24')]);}_0x369aea[_0xe3d7('0x3f')]=qs[_0xe3d7('0x40')](_0xfe5a6e[_0xe3d7('0x38')][_0xe3d7('0x40')]);_0x369aea[_0xe3d7('0x41')]=qs[_0xe3d7('0x3a')](_[_0xe3d7('0x42')](_0xfe5a6e['query'],_0x45ffb2[_0xe3d7('0x3a')]));_0x369aea[_0xe3d7('0x41')]['ListId']=_0x23f7f0['id'];if(_0xfe5a6e[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x369aea[_0xe3d7('0x41')]=_[_0xe3d7('0x46')](_0x369aea['where'],{'$or':_[_0xe3d7('0x32')](_0x369aea[_0xe3d7('0x3c')],function(_0x3aa4fb){var _0x304f29={};_0x304f29[_0x3aa4fb]={'$like':'%'+_0xfe5a6e['query'][_0xe3d7('0x43')]+'%'};return _0x304f29;})});}_0x369aea=_['merge']({},_0x369aea,_0xfe5a6e['options']);return db['Disposition'][_0xe3d7('0x23')]({'where':_0x369aea[_0xe3d7('0x41')]})['then'](function(_0x272a7f){_0x12eb1b[_0xe3d7('0x23')]=_0x272a7f;if(_0xfe5a6e[_0xe3d7('0x38')]['includeAll']){_0x369aea['include']=[{'all':!![]}];}return db['Disposition'][_0xe3d7('0x5b')](_0x369aea);})['then'](function(_0x1362dc){_0x12eb1b[_0xe3d7('0x49')]=_0x1362dc;return _0x12eb1b;});}})['then'](respondWithFilteredResult(_0x265fac,_0x369aea))[_0xe3d7('0x4a')](handleError(_0x265fac,null));};exports[_0xe3d7('0x5c')]=function(_0x3d7fd2,_0x5d2cda,_0x47caff){return db['CmList']['find']({'where':{'id':_0x3d7fd2['params']['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x5d2cda,null))[_0xe3d7('0x2d')](function(_0x511e9b){if(_0x511e9b){return _0x511e9b['removeDispositions'](_0x3d7fd2['query'][_0xe3d7('0x5d')]);}})['then'](respondWithStatusCode(_0x5d2cda,null))['catch'](handleError(_0x5d2cda,null));};exports[_0xe3d7('0x5e')]=function(_0x16879b,_0x5341de,_0x4d1628){return db[_0xe3d7('0x33')]['find']({'where':{'id':_0x16879b[_0xe3d7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5341de,null))[_0xe3d7('0x2d')](function(_0x561e4d){if(_0x561e4d){var _0x2fd54d=[];var _0x3f31df={'success':[],'errors':[]};return db[_0xe3d7('0x5f')][_0xe3d7('0x55')]()[_0xe3d7('0x2d')](function(_0x5da5d2){if(_0x16879b['body'][_0xe3d7('0x60')]&&_[_0xe3d7('0x61')](_0x16879b[_0xe3d7('0x4f')]['tags'])){if(_0x16879b['body'][_0xe3d7('0x60')][_0xe3d7('0x3e')]){_0x16879b[_0xe3d7('0x4f')][_0xe3d7('0x60')]=_0x16879b[_0xe3d7('0x4f')][_0xe3d7('0x60')][_0xe3d7('0x62')](';')+';';}else{_0x16879b[_0xe3d7('0x4f')][_0xe3d7('0x60')]=null;}}else{_0x16879b[_0xe3d7('0x4f')][_0xe3d7('0x60')]=null;}if(_0x16879b[_0xe3d7('0x4f')]&&_[_0xe3d7('0x61')](_0x16879b['body'])){for(var _0x22ecee=0x0;_0x22ecee<_0x16879b[_0xe3d7('0x4f')][_0xe3d7('0x3e')];_0x22ecee+=0x1){_0x16879b['body'][_0x22ecee][_0xe3d7('0x57')]=_0x16879b[_0xe3d7('0x4b')]['id'];_0x2fd54d[_0xe3d7('0x63')](_0x16879b['body'][_0x22ecee]);}return BPromise[_0xe3d7('0x64')](_0x2fd54d,function(_0x55ee08){return db[_0xe3d7('0x5f')][_0xe3d7('0x4e')](_['omit'](_0x55ee08,[_0xe3d7('0x5d'),'id'])||{},{'fields':_['keys'](_0x5da5d2),'raw':!![]})[_0xe3d7('0x2d')](function(_0x827399){_0x3f31df[_0xe3d7('0x65')]['push'](_0x827399[_0xe3d7('0x66')]);})[_0xe3d7('0x4a')](function(_0x3d6522){_0x3f31df[_0xe3d7('0x67')][_0xe3d7('0x63')]({'data':_0x55ee08,'error':_0x3d6522[_0xe3d7('0x68')]});});})['then'](function(_0x44a492){return _0x3f31df;})[_0xe3d7('0x4a')](function(_0x38e2e2){return _0x38e2e2;});}else{_0x5341de['status'](0x190)[_0xe3d7('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xe3d7('0x2d')](respondWithResult(_0x5341de,null))[_0xe3d7('0x4a')](handleError(_0x5341de,null));};exports[_0xe3d7('0x69')]=function(_0xda05d3,_0x9db989,_0x471aa5){var _0x52fd6a;return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0xda05d3[_0xe3d7('0x4b')]['id']},'include':[{'model':db[_0xe3d7('0x6a')],'as':_0xe3d7('0x6b')}]})[_0xe3d7('0x2d')](handleEntityNotFound(_0x9db989,null))[_0xe3d7('0x2d')](function(_0x39d71f){if(_0x39d71f){_0x52fd6a=_0x39d71f;return db[_0xe3d7('0x5f')]['rawAttributes'];}})[_0xe3d7('0x2d')](function(_0x400a9f){if(_0x400a9f){var _0x410fcb={};var _0xd01ff2={};_0xd01ff2[_0xe3d7('0x37')]=_[_0xe3d7('0x6c')](_['keys'](_0x400a9f),_['map'](_0x52fd6a[_0xe3d7('0x6b')],function(_0x579edb){return util[_0xe3d7('0x6d')](_0xe3d7('0x6e'),_0x579edb['id']);}));_0xd01ff2[_0xe3d7('0x38')]=_[_0xe3d7('0x39')](_0xda05d3[_0xe3d7('0x38')]);_0xd01ff2['filters']=_[_0xe3d7('0x3b')](_0xd01ff2[_0xe3d7('0x37')],_0xd01ff2[_0xe3d7('0x38')]);_0x410fcb['attributes']=_[_0xe3d7('0x3b')](_0xd01ff2[_0xe3d7('0x37')],qs[_0xe3d7('0x3d')](_0xda05d3[_0xe3d7('0x38')]['fields']));_0x410fcb[_0xe3d7('0x3c')]=_0x410fcb[_0xe3d7('0x3c')][_0xe3d7('0x3e')]?_0x410fcb['attributes']:_0xd01ff2['model'];if(!_0xda05d3[_0xe3d7('0x38')]['hasOwnProperty'](_0xe3d7('0x6f'))){_0x410fcb[_0xe3d7('0x25')]=qs[_0xe3d7('0x25')](_0xda05d3[_0xe3d7('0x38')][_0xe3d7('0x25')]);_0x410fcb[_0xe3d7('0x24')]=qs['offset'](_0xda05d3[_0xe3d7('0x38')][_0xe3d7('0x24')]);}_0x410fcb[_0xe3d7('0x3f')]=qs[_0xe3d7('0x40')](_0xda05d3[_0xe3d7('0x38')][_0xe3d7('0x40')]);_0x410fcb[_0xe3d7('0x41')]=qs[_0xe3d7('0x3a')](_[_0xe3d7('0x42')](_0xda05d3[_0xe3d7('0x38')],_0xd01ff2[_0xe3d7('0x3a')]));_0x410fcb['raw']=!![];if(_0xda05d3[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x410fcb['where']=_[_0xe3d7('0x46')](_0x410fcb['where'],{'$or':_['map'](_0x410fcb[_0xe3d7('0x3c')],function(_0xc9ff3b){var _0x46b743={};_0x46b743[_0xc9ff3b]={'$like':'%'+_0xda05d3[_0xe3d7('0x38')][_0xe3d7('0x43')]+'%'};return _0x46b743;})});}_0x410fcb=_['merge']({},_0x410fcb,_0xda05d3[_0xe3d7('0x47')]);return _0x52fd6a[_0xe3d7('0x69')](_0x410fcb);}})[_0xe3d7('0x2d')](respondWithResult(_0x9db989,null))[_0xe3d7('0x4a')](handleError(_0x9db989,null));};exports[_0xe3d7('0x70')]=function(_0x1d845b,_0x478ce5,_0x2ea2da){var _0x180c01;return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0x1d845b[_0xe3d7('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0xe3d7('0x2d')](handleEntityNotFound(_0x478ce5,null))[_0xe3d7('0x2d')](function(_0x2e3b6b){if(_0x2e3b6b){_0x180c01=_0x2e3b6b;return db[_0xe3d7('0x5f')][_0xe3d7('0x34')];}})[_0xe3d7('0x2d')](function(_0x125f16){if(_0x125f16){var _0x59265e={};var _0x3e38e4={};_0x3e38e4[_0xe3d7('0x37')]=_['concat'](_['keys'](_0x125f16),_[_0xe3d7('0x32')](_0x180c01['CustomFields'],function(_0x36dd04){return util[_0xe3d7('0x6d')](_0xe3d7('0x6e'),_0x36dd04['id']);}));_0x3e38e4[_0xe3d7('0x38')]=_['keys'](_0x1d845b[_0xe3d7('0x38')]);_0x3e38e4[_0xe3d7('0x3a')]=_[_0xe3d7('0x3b')](_0x3e38e4[_0xe3d7('0x37')],_0x3e38e4['query']);_0x59265e[_0xe3d7('0x3c')]=_[_0xe3d7('0x3b')](_0x3e38e4[_0xe3d7('0x37')],qs['fields'](_0x1d845b[_0xe3d7('0x38')]['fields']));_0x59265e[_0xe3d7('0x3c')]=_0x59265e[_0xe3d7('0x3c')][_0xe3d7('0x3e')]?_0x59265e['attributes']:_0x3e38e4[_0xe3d7('0x37')];if(!_0x1d845b[_0xe3d7('0x38')][_0xe3d7('0x5a')](_0xe3d7('0x6f'))){_0x59265e[_0xe3d7('0x25')]=qs[_0xe3d7('0x25')](_0x1d845b[_0xe3d7('0x38')]['limit']);_0x59265e[_0xe3d7('0x24')]=qs[_0xe3d7('0x24')](_0x1d845b['query'][_0xe3d7('0x24')]);}_0x59265e['order']=qs[_0xe3d7('0x40')](_0x1d845b[_0xe3d7('0x38')][_0xe3d7('0x40')]);_0x59265e['where']=qs['filters'](_['pick'](_0x1d845b[_0xe3d7('0x38')],_0x3e38e4[_0xe3d7('0x3a')]));_0x59265e['raw']=!![];if(_0x1d845b[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x59265e[_0xe3d7('0x41')]=_['merge'](_0x59265e[_0xe3d7('0x41')],{'$or':_[_0xe3d7('0x32')](_0x59265e[_0xe3d7('0x3c')],function(_0x4baa3c){var _0x14b973={};_0x14b973[_0x4baa3c]={'$like':'%'+_0x1d845b[_0xe3d7('0x38')][_0xe3d7('0x43')]+'%'};return _0x14b973;})});}_0x59265e=_[_0xe3d7('0x46')]({},_0x59265e,_0x1d845b[_0xe3d7('0x47')]);return _0x180c01[_0xe3d7('0x69')](_0x59265e);}})[_0xe3d7('0x2d')](function(_0x178c9e){if(!_[_0xe3d7('0x71')](_0x178c9e)){var _0x40f1ec=toCsv(_0x178c9e);var _0x1f811b=Date[_0xe3d7('0x72')]();fs[_0xe3d7('0x73')](util[_0xe3d7('0x6d')](_0xe3d7('0x74'),_0x180c01['id'],_0x1f811b),_0x40f1ec);_0x478ce5[_0xe3d7('0x75')](_0xe3d7('0x76'),'attachment;\x20filename='+util[_0xe3d7('0x6d')](_0xe3d7('0x77'),_0x180c01['id'],_0x1f811b));_0x478ce5[_0xe3d7('0x75')](_0xe3d7('0x78'),'text/csv');return _0x478ce5[_0xe3d7('0x79')](util[_0xe3d7('0x6d')](_0xe3d7('0x74'),_0x180c01['id'],_0x1f811b));}else{return _0x478ce5[_0xe3d7('0x1e')](0xcc);}})['catch'](handleError(_0x478ce5,null));};exports[_0xe3d7('0x7a')]=function(_0x40524f,_0x319aa7,_0x532768){var _0x45f485;delete _0x40524f[_0xe3d7('0x4f')]['id'];return db[_0xe3d7('0x33')][_0xe3d7('0x58')]({'where':{'id':_0x40524f['params']['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x319aa7,null))['then'](function(_0x375476){if(_0x375476){return db[_0xe3d7('0x7b')]['transaction'](function(_0xe5136e){return db[_0xe3d7('0x6a')][_0xe3d7('0x4e')](_0x40524f[_0xe3d7('0x4f')],{'transaction':_0xe5136e})[_0xe3d7('0x2d')](function(_0x3fff7c){_0x45f485=_0x3fff7c;return _0x375476[_0xe3d7('0x7c')](_0x3fff7c,{'transaction':_0xe5136e});})[_0xe3d7('0x2d')](function(){var _0x3db001={'type':db[_0xe3d7('0x7d')][_0xe3d7('0x7e')],'transaction':_0xe5136e};switch(_0x40524f[_0xe3d7('0x4f')][_0xe3d7('0x44')]){case _0xe3d7('0x7f'):_0x3db001[_0xe3d7('0x44')]=db[_0xe3d7('0x7d')][_0xe3d7('0x7e')];break;case _0xe3d7('0x80'):_0x3db001[_0xe3d7('0x44')]=db[_0xe3d7('0x7d')][_0xe3d7('0x81')];break;case'switch':_0x3db001[_0xe3d7('0x44')]=db[_0xe3d7('0x7d')][_0xe3d7('0x82')];_0x3db001[_0xe3d7('0x83')]=![];break;default:}return db[_0xe3d7('0x7b')]['queryInterface']['addColumn'](_0xe3d7('0x84'),util[_0xe3d7('0x6d')](_0xe3d7('0x85'),_0x45f485['id']),_0x3db001);})[_0xe3d7('0x2d')](function(){return _0x45f485;});});}})[_0xe3d7('0x2d')](respondWithResult(_0x319aa7,null))[_0xe3d7('0x4a')](handleError(_0x319aa7,null));};exports[_0xe3d7('0x86')]=function(_0x8d8914,_0x3eec94,_0x7e7a59){var _0x54822b={};var _0x4358c2={};var _0x52f8c3;var _0xc705a3;return db['CmList'][_0xe3d7('0x58')]({'where':{'id':_0x8d8914['params']['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x3eec94,null))['then'](function(_0x3dfadf){if(_0x3dfadf){_0x52f8c3=_0x3dfadf;_0x4358c2['model']=_[_0xe3d7('0x39')](db[_0xe3d7('0x6a')][_0xe3d7('0x34')]);_0x4358c2['query']=_[_0xe3d7('0x39')](_0x8d8914[_0xe3d7('0x38')]);_0x4358c2[_0xe3d7('0x3a')]=_[_0xe3d7('0x3b')](_0x4358c2[_0xe3d7('0x37')],_0x4358c2[_0xe3d7('0x38')]);_0x54822b[_0xe3d7('0x3c')]=_[_0xe3d7('0x3b')](_0x4358c2[_0xe3d7('0x37')],qs['fields'](_0x8d8914[_0xe3d7('0x38')][_0xe3d7('0x3d')]));_0x54822b[_0xe3d7('0x3c')]=_0x54822b[_0xe3d7('0x3c')]['length']?_0x54822b[_0xe3d7('0x3c')]:_0x4358c2[_0xe3d7('0x37')];_0x54822b[_0xe3d7('0x3f')]=qs[_0xe3d7('0x40')](_0x8d8914['query']['sort']);_0x54822b['where']=qs['filters'](_[_0xe3d7('0x42')](_0x8d8914['query'],_0x4358c2[_0xe3d7('0x3a')]));_0x54822b['where']=_[_0xe3d7('0x46')](_0x54822b[_0xe3d7('0x41')],{'$or':[{'ListId':_0x3dfadf['id']},{'ListId':null}]});if(_0x8d8914[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x54822b[_0xe3d7('0x41')]=_['merge'](_0x54822b[_0xe3d7('0x41')],{'$or':_['map'](_0x54822b[_0xe3d7('0x3c')],function(_0x1ad519){var _0x212a30={};_0x212a30[_0x1ad519]={'$like':'%'+_0x8d8914[_0xe3d7('0x38')][_0xe3d7('0x43')]+'%'};return _0x212a30;})});}_0x54822b=_[_0xe3d7('0x46')]({},_0x54822b,_0x8d8914[_0xe3d7('0x47')]);return db[_0xe3d7('0x6a')][_0xe3d7('0x87')](_0x54822b);}})[_0xe3d7('0x2d')](respondWithResult(_0x3eec94,null))['catch'](handleError(_0x3eec94,null));};exports[_0xe3d7('0x88')]=function(_0xa18fdc,_0x372190,_0x38166e){return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0xa18fdc['params']['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x372190,null))[_0xe3d7('0x2d')](function(_0x52b213){if(_0x52b213){return _0x52b213[_0xe3d7('0x88')](_0xa18fdc[_0xe3d7('0x4f')][_0xe3d7('0x5d')],_[_0xe3d7('0x89')](_0xa18fdc['body'],[_0xe3d7('0x5d'),'id'])||{})[_0xe3d7('0x8a')](function(_0x4ad1ba){for(var _0x9765d9=0x0;_0x9765d9<_0xa18fdc[_0xe3d7('0x4f')][_0xe3d7('0x5d')][_0xe3d7('0x3e')];_0x9765d9+=0x1){socket[_0xe3d7('0x8b')]('userCmList:save',{'UserId':Number(_0xa18fdc[_0xe3d7('0x4f')][_0xe3d7('0x5d')][_0x9765d9]),'CmListId':Number(_0xa18fdc['params']['id'])});}return _0x4ad1ba;});}})[_0xe3d7('0x2d')](respondWithResult(_0x372190,null))[_0xe3d7('0x4a')](handleError(_0x372190,null));};exports['removeAgents']=function(_0x35c3b7,_0x5a0c8b,_0x1408ce){return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0x35c3b7[_0xe3d7('0x4b')]['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x5a0c8b,null))[_0xe3d7('0x2d')](function(_0x2d4ca5){if(_0x2d4ca5){return _0x2d4ca5['removeAgents'](_0x35c3b7[_0xe3d7('0x38')][_0xe3d7('0x5d')])[_0xe3d7('0x2d')](function(){if(_[_0xe3d7('0x61')](_0x35c3b7[_0xe3d7('0x38')][_0xe3d7('0x5d')])){for(var _0x5db142=0x0;_0x5db142<_0x35c3b7[_0xe3d7('0x38')][_0xe3d7('0x5d')][_0xe3d7('0x3e')];_0x5db142+=0x1){socket[_0xe3d7('0x8b')](_0xe3d7('0x8c'),{'UserId':Number(_0x35c3b7[_0xe3d7('0x38')]['ids'][_0x5db142]),'CmListId':Number(_0x35c3b7[_0xe3d7('0x4b')]['id'])});}}else{socket[_0xe3d7('0x8b')](_0xe3d7('0x8c'),{'UserId':Number(_0x35c3b7[_0xe3d7('0x38')][_0xe3d7('0x5d')]),'CmListId':Number(_0x35c3b7[_0xe3d7('0x4b')]['id'])});}});}})[_0xe3d7('0x2d')](respondWithStatusCode(_0x5a0c8b,null))[_0xe3d7('0x4a')](handleError(_0x5a0c8b,null));};exports[_0xe3d7('0x8d')]=function(_0x33be45,_0x1f212f,_0x5e1a41){var _0x345881={};var _0xbc2457={};var _0x398f1c;var _0x1f62c5;return db['CmList'][_0xe3d7('0x58')]({'where':{'id':_0x33be45['params']['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x1f212f,null))['then'](function(_0x4c0e60){if(_0x4c0e60){_0x398f1c=_0x4c0e60;_0xbc2457['model']=_[_0xe3d7('0x39')](db['User'][_0xe3d7('0x34')]);_0xbc2457[_0xe3d7('0x38')]=_[_0xe3d7('0x39')](_0x33be45[_0xe3d7('0x38')]);_0xbc2457[_0xe3d7('0x3a')]=_['intersection'](_0xbc2457[_0xe3d7('0x37')],_0xbc2457['query']);_0x345881['attributes']=_['intersection'](_0xbc2457['model'],qs[_0xe3d7('0x3d')](_0x33be45[_0xe3d7('0x38')]['fields']));_0x345881[_0xe3d7('0x3c')]=_0x345881[_0xe3d7('0x3c')][_0xe3d7('0x3e')]?_0x345881[_0xe3d7('0x3c')]:_0xbc2457[_0xe3d7('0x37')];_0x345881[_0xe3d7('0x3f')]=qs[_0xe3d7('0x40')](_0x33be45[_0xe3d7('0x38')][_0xe3d7('0x40')]);_0x345881[_0xe3d7('0x41')]=qs['filters'](_['pick'](_0x33be45[_0xe3d7('0x38')],_0xbc2457[_0xe3d7('0x3a')]));if(_0x33be45[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x345881['where']=_[_0xe3d7('0x46')](_0x345881[_0xe3d7('0x41')],{'$or':_[_0xe3d7('0x32')](_0x345881[_0xe3d7('0x3c')],function(_0x1d31fa){var _0x36418a={};_0x36418a[_0x1d31fa]={'$like':'%'+_0x33be45['query'][_0xe3d7('0x43')]+'%'};return _0x36418a;})});}_0x345881=_[_0xe3d7('0x46')]({},_0x345881,_0x33be45[_0xe3d7('0x47')]);return _0x398f1c[_0xe3d7('0x8d')](_0x345881);}})[_0xe3d7('0x2d')](function(_0x46cd0d){if(_0x46cd0d){_0x1f62c5=_0x46cd0d['length'];if(!_0x33be45[_0xe3d7('0x38')]['hasOwnProperty'](_0xe3d7('0x6f'))){_0x345881[_0xe3d7('0x25')]=qs['limit'](_0x33be45[_0xe3d7('0x38')][_0xe3d7('0x25')]);_0x345881['offset']=qs[_0xe3d7('0x24')](_0x33be45[_0xe3d7('0x38')]['offset']);}return _0x398f1c['getAgents'](_0x345881);}})['then'](function(_0x1bf97e){if(_0x1bf97e){return _0x1bf97e?{'count':_0x1f62c5,'rows':_0x1bf97e}:null;}})[_0xe3d7('0x2d')](respondWithResult(_0x1f212f,null))[_0xe3d7('0x4a')](handleError(_0x1f212f,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 287ad30..e5d2908 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x3ce295,_0x5a0272){var _0x573046=function(_0x1e3a8e){while(--_0x1e3a8e){_0x3ce295['push'](_0x3ce295['shift']());}};_0x573046(++_0x5a0272);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x2a240a,_0x45a3a7){_0x2a240a=_0x2a240a-0x0;var _0x242b5e=_0x326f[_0x2a240a];return _0x242b5e;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 093342f..c0fb5c6 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xaee414,_0x44e567){var _0x2b482c=function(_0x26834b){while(--_0x26834b){_0xaee414['push'](_0xaee414['shift']());}};_0x2b482c(++_0x44e567);}(_0x702d,0x147));var _0xd702=function(_0x41ccf6,_0x133396){_0x41ccf6=_0x41ccf6-0x0;var _0x3ed83c=_0x702d[_0x41ccf6];return _0x3ed83c;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4e8967,_0x30dda6){var _0x2ff29b=function(_0x54b5c6){while(--_0x54b5c6){_0x4e8967['push'](_0x4e8967['shift']());}};_0x2ff29b(++_0x30dda6);}(_0x702d,0x147));var _0xd702=function(_0x45a862,_0x26892a){_0x45a862=_0x45a862-0x0;var _0x88ce56=_0x702d[_0x45a862];return _0x88ce56;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 527e11a..395e0ce 100644 --- a/server/api/cmList/cmList.rpc.js +++ b/server/api/cmList/cmList.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf544=['http','redis','defaults','localhost','socket.io-emitter','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x26e424,_0xfcf210){var _0x2c81d6=function(_0x58feef){while(--_0x58feef){_0x26e424['push'](_0x26e424['shift']());}};_0x2c81d6(++_0xfcf210);}(_0xf544,0x145));var _0x4f54=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0xf544[_0x3f578f];return _0x32c754;};'use strict';var _=require(_0x4f54('0x0'));var util=require(_0x4f54('0x1'));var moment=require('moment');var BPromise=require(_0x4f54('0x2'));var rs=require(_0x4f54('0x3'));var fs=require('fs');var Redis=require(_0x4f54('0x4'));var db=require(_0x4f54('0x5'))['db'];var utils=require(_0x4f54('0x6'));var logger=require('../../config/logger')(_0x4f54('0x7'));var config=require(_0x4f54('0x8'));var jayson=require(_0x4f54('0x9'));var client=jayson[_0x4f54('0xa')][_0x4f54('0xb')]({'port':0x232a});config[_0x4f54('0xc')]=_[_0x4f54('0xd')](config[_0x4f54('0xc')],{'host':_0x4f54('0xe'),'port':0x18eb});var socket=require(_0x4f54('0xf'))(new Redis(config[_0x4f54('0xc')]));require('./cmList.socket')[_0x4f54('0x10')](socket);function respondWithRpcPromise(_0x4e8947,_0x49e996,_0xbb6527){return new BPromise(function(_0x12f75a,_0x4e57cc){return client[_0x4f54('0x11')](_0x4e8947,_0xbb6527)['then'](function(_0x5f1a5f){logger[_0x4f54('0x12')](_0x4f54('0x13'),_0x49e996,_0x4f54('0x14'));logger[_0x4f54('0x15')]('CmList,\x20%s,\x20%s,\x20%s',_0x49e996,_0x4f54('0x14'),JSON[_0x4f54('0x16')](_0x5f1a5f));if(_0x5f1a5f[_0x4f54('0x17')]){if(_0x5f1a5f[_0x4f54('0x17')][_0x4f54('0x18')]===0x1f4){logger['error'](_0x4f54('0x13'),_0x49e996,_0x5f1a5f[_0x4f54('0x17')]['message']);return _0x4e57cc(_0x5f1a5f[_0x4f54('0x17')][_0x4f54('0x19')]);}logger[_0x4f54('0x17')](_0x4f54('0x13'),_0x49e996,_0x5f1a5f[_0x4f54('0x17')][_0x4f54('0x19')]);return _0x12f75a(_0x5f1a5f[_0x4f54('0x17')][_0x4f54('0x19')]);}else{logger[_0x4f54('0x12')](_0x4f54('0x13'),_0x49e996,_0x4f54('0x14'));_0x12f75a(_0x5f1a5f[_0x4f54('0x1a')]['message']);}})[_0x4f54('0x1b')](function(_0xd68ca){logger[_0x4f54('0x17')](_0x4f54('0x13'),_0x49e996,_0xd68ca);_0x4e57cc(_0xd68ca);});});} \ No newline at end of file +var _0xfeab=['register','request','info','debug','error','message','CmList,\x20%s,\x20%s','request\x20sent','result','catch','util','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','./cmList.socket'];(function(_0x18e448,_0x114039){var _0x350a0f=function(_0x396cbc){while(--_0x396cbc){_0x18e448['push'](_0x18e448['shift']());}};_0x350a0f(++_0x114039);}(_0xfeab,0x106));var _0xbfea=function(_0x23d8b2,_0x48626c){_0x23d8b2=_0x23d8b2-0x0;var _0x12922d=_0xfeab[_0x23d8b2];return _0x12922d;};'use strict';var _=require('lodash');var util=require(_0xbfea('0x0'));var moment=require(_0xbfea('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbfea('0x3'));var logger=require(_0xbfea('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbfea('0x5'));var client=jayson[_0xbfea('0x6')]['http']({'port':0x232a});config[_0xbfea('0x7')]=_['defaults'](config['redis'],{'host':_0xbfea('0x8'),'port':0x18eb});var socket=require(_0xbfea('0x9'))(new Redis(config[_0xbfea('0x7')]));require(_0xbfea('0xa'))[_0xbfea('0xb')](socket);function respondWithRpcPromise(_0x43a699,_0x522d85,_0x4abe24){return new BPromise(function(_0x34ec9f,_0x31a405){return client[_0xbfea('0xc')](_0x43a699,_0x4abe24)['then'](function(_0x464618){logger[_0xbfea('0xd')]('CmList,\x20%s,\x20%s',_0x522d85,'request\x20sent');logger[_0xbfea('0xe')]('CmList,\x20%s,\x20%s,\x20%s',_0x522d85,'request\x20sent',JSON['stringify'](_0x464618));if(_0x464618[_0xbfea('0xf')]){if(_0x464618[_0xbfea('0xf')]['code']===0x1f4){logger[_0xbfea('0xf')]('CmList,\x20%s,\x20%s',_0x522d85,_0x464618[_0xbfea('0xf')][_0xbfea('0x10')]);return _0x31a405(_0x464618['error'][_0xbfea('0x10')]);}logger['error'](_0xbfea('0x11'),_0x522d85,_0x464618[_0xbfea('0xf')][_0xbfea('0x10')]);return _0x34ec9f(_0x464618[_0xbfea('0xf')][_0xbfea('0x10')]);}else{logger[_0xbfea('0xd')]('CmList,\x20%s,\x20%s',_0x522d85,_0xbfea('0x12'));_0x34ec9f(_0x464618[_0xbfea('0x13')][_0xbfea('0x10')]);}})[_0xbfea('0x14')](function(_0x4ae410){logger[_0xbfea('0xf')]('CmList,\x20%s,\x20%s',_0x522d85,_0x4ae410);_0x31a405(_0x4ae410);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5ffaf90..448f254 100644 --- a/server/api/cmList/cmList.socket.js +++ b/server/api/cmList/cmList.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4366=['removeListener','register','length','cmList:','./cmList.events','save','remove','update'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x4366,0x1bc));var _0x6436=function(_0x3daa81,_0x48427e){_0x3daa81=_0x3daa81-0x0;var _0x19ba67=_0x4366[_0x3daa81];return _0x19ba67;};'use strict';var CmListEvents=require(_0x6436('0x0'));var events=[_0x6436('0x1'),_0x6436('0x2'),_0x6436('0x3')];function createListener(_0xf2bbb1,_0x87044a){return function(_0x2e77fd){_0x87044a['emit'](_0xf2bbb1,_0x2e77fd);};}function removeListener(_0x4946df,_0x42484b){return function(){CmListEvents[_0x6436('0x4')](_0x4946df,_0x42484b);};}exports[_0x6436('0x5')]=function(_0x263f9f){for(var _0x42caba=0x0,_0xba2251=events[_0x6436('0x6')];_0x42caba<_0xba2251;_0x42caba++){var _0x21d618=events[_0x42caba];var _0x5200ce=createListener(_0x6436('0x7')+_0x21d618,_0x263f9f);CmListEvents['on'](_0x21d618,_0x5200ce);}}; \ No newline at end of file +var _0xd11d=['remove','update','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0xd11d,0xc6));var _0xdd11=function(_0x38f63b,_0x590bac){_0x38f63b=_0x38f63b-0x0;var _0x164374=_0xd11d[_0x38f63b];return _0x164374;};'use strict';var CmListEvents=require(_0xdd11('0x0'));var events=[_0xdd11('0x1'),_0xdd11('0x2'),_0xdd11('0x3')];function createListener(_0x1e659b,_0x213b2e){return function(_0x1f32d2){_0x213b2e['emit'](_0x1e659b,_0x1f32d2);};}function removeListener(_0x577d65,_0xa118e0){return function(){CmListEvents[_0xdd11('0x4')](_0x577d65,_0xa118e0);};}exports[_0xdd11('0x5')]=function(_0x3f045d){for(var _0x547975=0x0,_0x4e092e=events[_0xdd11('0x6')];_0x547975<_0x4e092e;_0x547975++){var _0x6902c2=events[_0x547975];var _0x4aa271=createListener(_0xdd11('0x7')+_0x6902c2,_0x3f045d);CmListEvents['on'](_0x6902c2,_0x4aa271);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 490229d..d81c450 100644 --- a/server/api/cmList/index.js +++ b/server/api/cmList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3766=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','post','create','/:id/dispositions','addContacts','addCustomField','/:id/users','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a9b94,_0x4d763e){var _0x379102=function(_0x1d9e7c){while(--_0x1d9e7c){_0x1a9b94['push'](_0x1a9b94['shift']());}};_0x379102(++_0x4d763e);}(_0x3766,0x110));var _0x6376=function(_0x1cee4e,_0x2c30bb){_0x1cee4e=_0x1cee4e-0x0;var _0x22fdda=_0x3766[_0x1cee4e];return _0x22fdda;};'use strict';var multer=require(_0x6376('0x0'));var util=require(_0x6376('0x1'));var path=require(_0x6376('0x2'));var timeout=require('connect-timeout');var express=require(_0x6376('0x3'));var router=express[_0x6376('0x4')]();var fs_extra=require(_0x6376('0x5'));var auth=require(_0x6376('0x6'));var interaction=require(_0x6376('0x7'));var config=require(_0x6376('0x8'));var controller=require('./cmList.controller');router[_0x6376('0x9')]('/',auth[_0x6376('0xa')](),controller[_0x6376('0xb')]);router[_0x6376('0x9')](_0x6376('0xc'),auth['isAuthenticated'](),controller[_0x6376('0xd')]);router['get'](_0x6376('0xe'),auth['isAuthenticated'](),controller[_0x6376('0xf')]);router['get']('/:id/dispositions',auth[_0x6376('0xa')](),controller[_0x6376('0x10')]);router['get'](_0x6376('0x11'),auth['isAuthenticated'](),controller[_0x6376('0x12')]);router[_0x6376('0x9')](_0x6376('0x13'),auth['isAuthenticated'](),controller['getContactsCsv']);router['get'](_0x6376('0x14'),auth[_0x6376('0xa')](),controller[_0x6376('0x15')]);router[_0x6376('0x9')]('/:id/users',auth[_0x6376('0xa')](),controller['getAgents']);router[_0x6376('0x16')]('/',auth[_0x6376('0xa')](),controller[_0x6376('0x17')]);router[_0x6376('0x16')](_0x6376('0x18'),auth[_0x6376('0xa')](),controller['addDisposition']);router[_0x6376('0x16')](_0x6376('0x11'),auth[_0x6376('0xa')](),controller[_0x6376('0x19')]);router['post']('/:id/fields',auth[_0x6376('0xa')](),controller[_0x6376('0x1a')]);router[_0x6376('0x16')](_0x6376('0x1b'),auth[_0x6376('0xa')](),controller[_0x6376('0x1c')]);router['put'](_0x6376('0xe'),auth[_0x6376('0xa')](),controller[_0x6376('0x1d')]);router[_0x6376('0x1e')](_0x6376('0xe'),auth[_0x6376('0xa')](),controller[_0x6376('0x1f')]);router['delete'](_0x6376('0x18'),auth[_0x6376('0xa')](),controller[_0x6376('0x20')]);router[_0x6376('0x1e')](_0x6376('0x1b'),auth[_0x6376('0xa')](),controller[_0x6376('0x21')]);module[_0x6376('0x22')]=router; \ No newline at end of file +var _0xde64=['/:id/fields','addCustomField','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','/:id/contacts','getContacts','getContactsCsv','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts'];(function(_0x2e72c7,_0x3cefda){var _0x12f876=function(_0x286755){while(--_0x286755){_0x2e72c7['push'](_0x2e72c7['shift']());}};_0x12f876(++_0x3cefda);}(_0xde64,0x17c));var _0x4de6=function(_0x600f5a,_0xb4fac0){_0x600f5a=_0x600f5a-0x0;var _0x2b3bd3=_0xde64[_0x600f5a];return _0x2b3bd3;};'use strict';var multer=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var path=require(_0x4de6('0x2'));var timeout=require(_0x4de6('0x3'));var express=require(_0x4de6('0x4'));var router=express[_0x4de6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4de6('0x6'));var interaction=require(_0x4de6('0x7'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x4de6('0x8')]('/',auth[_0x4de6('0x9')](),controller['index']);router['get'](_0x4de6('0xa'),auth[_0x4de6('0x9')](),controller[_0x4de6('0xb')]);router[_0x4de6('0x8')](_0x4de6('0xc'),auth[_0x4de6('0x9')](),controller['show']);router[_0x4de6('0x8')](_0x4de6('0xd'),auth[_0x4de6('0x9')](),controller['getDispositions']);router[_0x4de6('0x8')](_0x4de6('0xe'),auth[_0x4de6('0x9')](),controller[_0x4de6('0xf')]);router[_0x4de6('0x8')]('/:id/contacts/csv',auth[_0x4de6('0x9')](),controller[_0x4de6('0x10')]);router[_0x4de6('0x8')]('/:id/fields',auth[_0x4de6('0x9')](),controller[_0x4de6('0x11')]);router[_0x4de6('0x8')](_0x4de6('0x12'),auth['isAuthenticated'](),controller[_0x4de6('0x13')]);router[_0x4de6('0x14')]('/',auth[_0x4de6('0x9')](),controller['create']);router[_0x4de6('0x14')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4de6('0x15')]);router[_0x4de6('0x14')](_0x4de6('0xe'),auth[_0x4de6('0x9')](),controller[_0x4de6('0x16')]);router[_0x4de6('0x14')](_0x4de6('0x17'),auth['isAuthenticated'](),controller[_0x4de6('0x18')]);router[_0x4de6('0x14')](_0x4de6('0x12'),auth[_0x4de6('0x9')](),controller[_0x4de6('0x19')]);router[_0x4de6('0x1a')](_0x4de6('0xc'),auth[_0x4de6('0x9')](),controller[_0x4de6('0x1b')]);router[_0x4de6('0x1c')]('/:id',auth[_0x4de6('0x9')](),controller['destroy']);router[_0x4de6('0x1c')](_0x4de6('0xd'),auth[_0x4de6('0x9')](),controller['removeDispositions']);router[_0x4de6('0x1c')]('/:id/users',auth[_0x4de6('0x9')](),controller[_0x4de6('0x1d')]);module[_0x4de6('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 59a7ce7..f0b5f64 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3748=['VIRTUAL','getDataValue','STRING'];(function(_0xb6a090,_0x1e8274){var _0xb955af=function(_0x1f8d84){while(--_0x1f8d84){_0xb6a090['push'](_0xb6a090['shift']());}};_0xb955af(++_0x1e8274);}(_0x3748,0x1cb));var _0x8374=function(_0x451098,_0x53ca32){_0x451098=_0x451098-0x0;var _0x25c57a=_0x3748[_0x451098];return _0x25c57a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8374('0x0')],'get':function(_0x531e27){return this[_0x8374('0x1')]('field');}},'field':{'type':Sequelize[_0x8374('0x2')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x8374('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe0a3=['sequelize','VIRTUAL','getDataValue','field','STRING'];(function(_0x3f9da4,_0x1c80c0){var _0x101707=function(_0x37c2aa){while(--_0x37c2aa){_0x3f9da4['push'](_0x3f9da4['shift']());}};_0x101707(++_0x1c80c0);}(_0xe0a3,0x154));var _0x3e0a=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0xe0a3[_0x1265ed];return _0x5ac459;};'use strict';var Sequelize=require(_0x3e0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e0a('0x1')],'get':function(_0x50bc27){return this[_0x3e0a('0x2')](_0x3e0a('0x3'));}},'field':{'type':Sequelize[_0x3e0a('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x3e0a('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x3e0a('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 5126074..4e04ee9 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x35fce0,_0x13767f){var _0x3f0aeb=function(_0x58db45){while(--_0x58db45){_0x35fce0['push'](_0x35fce0['shift']());}};_0x3f0aeb(++_0x13767f);}(_0x7a54,0x106));var _0x47a5=function(_0x3132c0,_0x51b71f){_0x3132c0=_0x3132c0-0x0;var _0x5e46a7=_0x7a54[_0x3132c0];return _0x5e46a7;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x18cf80,_0x235efa){var _0x46d596=function(_0x3d45e2){while(--_0x3d45e2){_0x18cf80['push'](_0x18cf80['shift']());}};_0x46d596(++_0x235efa);}(_0x7a54,0x106));var _0x47a5=function(_0x31e817,_0x57ac86){_0x31e817=_0x31e817-0x0;var _0x101377=_0x7a54[_0x31e817];return _0x101377;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 8ecff18..5cd8706 100644 --- a/server/api/condition/condition.model.js +++ b/server/api/condition/condition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52d8=['request-promise','path','rimraf','./condition.attributes','exports','define','Condition','lodash','util','api','moment','bluebird'];(function(_0xb86502,_0x36c096){var _0x3a44c2=function(_0x7a47d8){while(--_0x7a47d8){_0xb86502['push'](_0xb86502['shift']());}};_0x3a44c2(++_0x36c096);}(_0x52d8,0x67));var _0x852d=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x52d8[_0x1663ae];return _0x30ffb8;};'use strict';var _=require(_0x852d('0x0'));var util=require(_0x852d('0x1'));var logger=require('../../config/logger')(_0x852d('0x2'));var moment=require(_0x852d('0x3'));var BPromise=require(_0x852d('0x4'));var rp=require(_0x852d('0x5'));var fs=require('fs');var path=require(_0x852d('0x6'));var rimraf=require(_0x852d('0x7'));var config=require('../../config/environment');var attributes=require(_0x852d('0x8'));module[_0x852d('0x9')]=function(_0x58ef2d,_0x397533){return _0x58ef2d[_0x852d('0xa')](_0x852d('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8cc=['bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','util','api','moment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb8cc,0x194));var _0xcb8c=function(_0x21aac0,_0x3c6855){_0x21aac0=_0x21aac0-0x0;var _0x4f3846=_0xb8cc[_0x21aac0];return _0x4f3846;};'use strict';var _=require('lodash');var util=require(_0xcb8c('0x0'));var logger=require('../../config/logger')(_0xcb8c('0x1'));var moment=require(_0xcb8c('0x2'));var BPromise=require(_0xcb8c('0x3'));var rp=require(_0xcb8c('0x4'));var fs=require('fs');var path=require(_0xcb8c('0x5'));var rimraf=require('rimraf');var config=require(_0xcb8c('0x6'));var attributes=require(_0xcb8c('0x7'));module[_0xcb8c('0x8')]=function(_0x48866d,_0x123d13){return _0x48866d[_0xcb8c('0x9')](_0xcb8c('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 3071cf9..2cf6eb7 100644 --- a/server/api/condition/condition.rpc.js +++ b/server/api/condition/condition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcd6=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error'];(function(_0x4c41c4,_0x75bc8a){var _0x2bdc48=function(_0x2ea5e8){while(--_0x2ea5e8){_0x4c41c4['push'](_0x4c41c4['shift']());}};_0x2bdc48(++_0x75bc8a);}(_0xdcd6,0x1d0));var _0x6dcd=function(_0x44c844,_0x1e3d7d){_0x44c844=_0x44c844-0x0;var _0x1d51b7=_0xdcd6[_0x44c844];return _0x1d51b7;};'use strict';var _=require(_0x6dcd('0x0'));var util=require(_0x6dcd('0x1'));var moment=require(_0x6dcd('0x2'));var BPromise=require('bluebird');var rs=require(_0x6dcd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dcd('0x4'))['db'];var utils=require(_0x6dcd('0x5'));var logger=require(_0x6dcd('0x6'))(_0x6dcd('0x7'));var config=require(_0x6dcd('0x8'));var jayson=require(_0x6dcd('0x9'));var client=jayson[_0x6dcd('0xa')][_0x6dcd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ec7bb,_0x57f216,_0x3cc617){return new BPromise(function(_0x4c46c1,_0x1fe661){return client['request'](_0x1ec7bb,_0x3cc617)[_0x6dcd('0xc')](function(_0x652e22){logger[_0x6dcd('0xd')](_0x6dcd('0xe'),_0x57f216,_0x6dcd('0xf'));logger[_0x6dcd('0x10')](_0x6dcd('0x11'),_0x57f216,_0x6dcd('0xf'),JSON['stringify'](_0x652e22));if(_0x652e22['error']){if(_0x652e22[_0x6dcd('0x12')]['code']===0x1f4){logger[_0x6dcd('0x12')](_0x6dcd('0xe'),_0x57f216,_0x652e22[_0x6dcd('0x12')][_0x6dcd('0x13')]);return _0x1fe661(_0x652e22[_0x6dcd('0x12')]['message']);}logger[_0x6dcd('0x12')]('Condition,\x20%s,\x20%s',_0x57f216,_0x652e22[_0x6dcd('0x12')][_0x6dcd('0x13')]);return _0x4c46c1(_0x652e22[_0x6dcd('0x12')][_0x6dcd('0x13')]);}else{logger[_0x6dcd('0xd')]('Condition,\x20%s,\x20%s',_0x57f216,_0x6dcd('0xf'));_0x4c46c1(_0x652e22['result']['message']);}})[_0x6dcd('0x14')](function(_0x20648c){logger[_0x6dcd('0x12')]('Condition,\x20%s,\x20%s',_0x57f216,_0x20648c);_0x1fe661(_0x20648c);});});} \ No newline at end of file +var _0x4336=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x21596f,_0x4c7ba5){var _0x273962=function(_0x4100b2){while(--_0x4100b2){_0x21596f['push'](_0x21596f['shift']());}};_0x273962(++_0x4c7ba5);}(_0x4336,0x172));var _0x6433=function(_0x1ce042,_0xb19eae){_0x1ce042=_0x1ce042-0x0;var _0x441ac0=_0x4336[_0x1ce042];return _0x441ac0;};'use strict';var _=require(_0x6433('0x0'));var util=require(_0x6433('0x1'));var moment=require(_0x6433('0x2'));var BPromise=require(_0x6433('0x3'));var rs=require(_0x6433('0x4'));var fs=require('fs');var Redis=require(_0x6433('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6433('0x6'));var logger=require(_0x6433('0x7'))(_0x6433('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6433('0x9')][_0x6433('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb307ef,_0x4368ca,_0x2cbbc8){return new BPromise(function(_0x477457,_0x26c32a){return client[_0x6433('0xb')](_0xb307ef,_0x2cbbc8)[_0x6433('0xc')](function(_0x44e658){logger[_0x6433('0xd')]('Condition,\x20%s,\x20%s',_0x4368ca,_0x6433('0xe'));logger[_0x6433('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x4368ca,_0x6433('0xe'),JSON[_0x6433('0x10')](_0x44e658));if(_0x44e658[_0x6433('0x11')]){if(_0x44e658[_0x6433('0x11')][_0x6433('0x12')]===0x1f4){logger[_0x6433('0x11')](_0x6433('0x13'),_0x4368ca,_0x44e658[_0x6433('0x11')]['message']);return _0x26c32a(_0x44e658[_0x6433('0x11')]['message']);}logger[_0x6433('0x11')](_0x6433('0x13'),_0x4368ca,_0x44e658[_0x6433('0x11')][_0x6433('0x14')]);return _0x477457(_0x44e658['error']['message']);}else{logger[_0x6433('0xd')](_0x6433('0x13'),_0x4368ca,_0x6433('0xe'));_0x477457(_0x44e658[_0x6433('0x15')][_0x6433('0x14')]);}})['catch'](function(_0x1bce81){logger[_0x6433('0x11')]('Condition,\x20%s,\x20%s',_0x4368ca,_0x1bce81);_0x26c32a(_0x1bce81);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index a9c5911..c43d651 100644 --- a/server/api/condition/index.js +++ b/server/api/condition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c2d=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','delete'];(function(_0x4b8f97,_0x2edafb){var _0x4ae227=function(_0x277347){while(--_0x277347){_0x4b8f97['push'](_0x4b8f97['shift']());}};_0x4ae227(++_0x2edafb);}(_0x1c2d,0x1ec));var _0xd1c2=function(_0x59d414,_0x1176c2){_0x59d414=_0x59d414-0x0;var _0x3dbc45=_0x1c2d[_0x59d414];return _0x3dbc45;};'use strict';var multer=require(_0xd1c2('0x0'));var util=require(_0xd1c2('0x1'));var path=require(_0xd1c2('0x2'));var timeout=require('connect-timeout');var express=require(_0xd1c2('0x3'));var router=express[_0xd1c2('0x4')]();var fs_extra=require(_0xd1c2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd1c2('0x6'));var config=require('../../config/environment');var controller=require(_0xd1c2('0x7'));router[_0xd1c2('0x8')](_0xd1c2('0x9'),auth[_0xd1c2('0xa')](),controller['update']);router[_0xd1c2('0xb')](_0xd1c2('0x9'),auth[_0xd1c2('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2d35=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','connect-timeout'];(function(_0x4862a3,_0x421f68){var _0x5a9df4=function(_0x302b86){while(--_0x302b86){_0x4862a3['push'](_0x4862a3['shift']());}};_0x5a9df4(++_0x421f68);}(_0x2d35,0x115));var _0x52d3=function(_0x246eeb,_0x1bf6ef){_0x246eeb=_0x246eeb-0x0;var _0x114642=_0x2d35[_0x246eeb];return _0x114642;};'use strict';var multer=require(_0x52d3('0x0'));var util=require(_0x52d3('0x1'));var path=require('path');var timeout=require(_0x52d3('0x2'));var express=require('express');var router=express[_0x52d3('0x3')]();var fs_extra=require(_0x52d3('0x4'));var auth=require(_0x52d3('0x5'));var interaction=require(_0x52d3('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x52d3('0x7')](_0x52d3('0x8'),auth['isAuthenticated'](),controller[_0x52d3('0x9')]);router[_0x52d3('0xa')](_0x52d3('0x8'),auth[_0x52d3('0xb')](),controller[_0x52d3('0xc')]);module[_0x52d3('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index bd8d3a2..27ca0a8 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x39227e,_0x56bd38){var _0x1b0163=function(_0x4a1f4b){while(--_0x4a1f4b){_0x39227e['push'](_0x39227e['shift']());}};_0x1b0163(++_0x56bd38);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x52930a,_0x419035){var _0x26b0c0=function(_0x4b21e7){while(--_0x4b21e7){_0x52930a['push'](_0x52930a['shift']());}};_0x26b0c0(++_0x419035);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index f2b853c..9d8cb51 100644 --- a/server/api/dashboard/dashboard.controller.js +++ b/server/api/dashboard/dashboard.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bfa=['nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','include','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrEmailAccounts','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','end','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x24096e,_0x56e8ec){var _0x391afb=function(_0x15dfd5){while(--_0x15dfd5){_0x24096e['push'](_0x24096e['shift']());}};_0x391afb(++_0x56e8ec);}(_0x4bfa,0x1df));var _0xa4bf=function(_0x50551e,_0x4ceff3){_0x50551e=_0x50551e-0x0;var _0x5a08c1=_0x4bfa[_0x50551e];return _0x5a08c1;};'use strict';var emlformat=require(_0xa4bf('0x0'));var rimraf=require(_0xa4bf('0x1'));var zipdir=require(_0xa4bf('0x2'));var jsonpatch=require(_0xa4bf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa4bf('0x4'));var Mustache=require(_0xa4bf('0x5'));var util=require(_0xa4bf('0x6'));var path=require('path');var sox=require(_0xa4bf('0x7'));var csv=require(_0xa4bf('0x8'));var ejs=require(_0xa4bf('0x9'));var fs=require('fs');var fs_extra=require(_0xa4bf('0xa'));var _=require(_0xa4bf('0xb'));var squel=require(_0xa4bf('0xc'));var crypto=require(_0xa4bf('0xd'));var jsforce=require(_0xa4bf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa4bf('0x8'));var querystring=require(_0xa4bf('0xf'));var Papa=require(_0xa4bf('0x10'));var Redis=require(_0xa4bf('0x11'));var authService=require(_0xa4bf('0x12'));var qs=require(_0xa4bf('0x13'));var as=require(_0xa4bf('0x14'));var hardwareService=require(_0xa4bf('0x15'));var logger=require(_0xa4bf('0x16'))('api');var utils=require(_0xa4bf('0x17'));var config=require(_0xa4bf('0x18'));var licenseUtil=require(_0xa4bf('0x19'));var db=require(_0xa4bf('0x1a'))['db'];config[_0xa4bf('0x1b')]=_[_0xa4bf('0x1c')](config[_0xa4bf('0x1b')],{'host':_0xa4bf('0x1d'),'port':0x18eb});var socket=require(_0xa4bf('0x1e'))(new Redis(config['redis']));require(_0xa4bf('0x1f'))[_0xa4bf('0x20')](socket);function respondWithStatusCode(_0x443433,_0x46f1f8){_0x46f1f8=_0x46f1f8||0xcc;return function(_0xbe3bc){if(_0xbe3bc){return _0x443433[_0xa4bf('0x21')](_0x46f1f8);}return _0x443433['status'](_0x46f1f8)['end']();};}function respondWithResult(_0x213187,_0x5880bc){_0x5880bc=_0x5880bc||0xc8;return function(_0x34bac3){if(_0x34bac3){return _0x213187[_0xa4bf('0x22')](_0x5880bc)[_0xa4bf('0x23')](_0x34bac3);}};}function respondWithFilteredResult(_0xe78677,_0xf90cd2){return function(_0x259753){if(_0x259753){var _0x4ae8ef=typeof _0xf90cd2[_0xa4bf('0x24')]===_0xa4bf('0x25')&&typeof _0xf90cd2[_0xa4bf('0x26')]===_0xa4bf('0x25');var _0x1850fc=_0x259753['count'];var _0x2a56ca=_0x4ae8ef?0x0:_0xf90cd2['offset'];var _0x13e4c4=_0x4ae8ef?_0x259753[_0xa4bf('0x27')]:_0xf90cd2['offset']+_0xf90cd2[_0xa4bf('0x26')];var _0x426bf5;if(_0x13e4c4>=_0x1850fc){_0x13e4c4=_0x1850fc;_0x426bf5=0xc8;}else{_0x426bf5=0xce;}_0xe78677[_0xa4bf('0x22')](_0x426bf5);return _0xe78677[_0xa4bf('0x28')](_0xa4bf('0x29'),_0x2a56ca+'-'+_0x13e4c4+'/'+_0x1850fc)[_0xa4bf('0x23')](_0x259753);}return null;};}function patchUpdates(_0x4fcd3f){return function(_0x5dcbae){try{jsonpatch['apply'](_0x5dcbae,_0x4fcd3f,!![]);}catch(_0x4ad12d){return BPromise[_0xa4bf('0x2a')](_0x4ad12d);}return _0x5dcbae[_0xa4bf('0x2b')]();};}function saveUpdates(_0x1055cc,_0x3f1fd9){return function(_0x4e6569){if(_0x4e6569){return _0x4e6569[_0xa4bf('0x2c')](_0x1055cc)[_0xa4bf('0x2d')](function(_0x2c6223){return _0x2c6223;});}return null;};}function removeEntity(_0x3da5cf,_0x11f84a){return function(_0x505d59){if(_0x505d59){return _0x505d59['destroy']()[_0xa4bf('0x2d')](function(){var _0x4f238e=_0x505d59[_0xa4bf('0x2e')]({'plain':!![]});var _0x32a93e=_0xa4bf('0x2f');return db[_0xa4bf('0x30')][_0xa4bf('0x31')]({'where':{'type':_0x32a93e,'resourceId':_0x4f238e['id']}})[_0xa4bf('0x2d')](function(){return _0x505d59;});})['then'](function(){_0x3da5cf[_0xa4bf('0x22')](0xcc)[_0xa4bf('0x32')]();});}};}function handleEntityNotFound(_0x3b5b30,_0x2d7b90){return function(_0x5debf1){if(!_0x5debf1){_0x3b5b30[_0xa4bf('0x21')](0x194);}return _0x5debf1;};}function handleError(_0x245ed7,_0x2a36e6){_0x2a36e6=_0x2a36e6||0x1f4;return function(_0x6e7fc){logger[_0xa4bf('0x33')](_0x6e7fc[_0xa4bf('0x34')]);if(_0x6e7fc['name']){delete _0x6e7fc[_0xa4bf('0x35')];}_0x245ed7[_0xa4bf('0x22')](_0x2a36e6)[_0xa4bf('0x36')](_0x6e7fc);};}exports[_0xa4bf('0x37')]=function(_0x24b41c,_0x14cd80){var _0x3981bc={},_0x1bcdf5={},_0x2d6fa7={'count':0x0,'rows':[]};var _0x37152f=_[_0xa4bf('0x38')](db[_0xa4bf('0x39')][_0xa4bf('0x3a')],function(_0x12f828){return{'name':_0x12f828[_0xa4bf('0x3b')],'type':_0x12f828['type'][_0xa4bf('0x3c')]};});_0x1bcdf5[_0xa4bf('0x3d')]=_[_0xa4bf('0x38')](_0x37152f,'name');_0x1bcdf5[_0xa4bf('0x3e')]=_[_0xa4bf('0x3f')](_0x24b41c[_0xa4bf('0x3e')]);_0x1bcdf5['filters']=_[_0xa4bf('0x40')](_0x1bcdf5[_0xa4bf('0x3d')],_0x1bcdf5[_0xa4bf('0x3e')]);_0x3981bc['attributes']=_[_0xa4bf('0x40')](_0x1bcdf5['model'],qs[_0xa4bf('0x41')](_0x24b41c[_0xa4bf('0x3e')][_0xa4bf('0x41')]));_0x3981bc[_0xa4bf('0x42')]=_0x3981bc['attributes'][_0xa4bf('0x43')]?_0x3981bc[_0xa4bf('0x42')]:_0x1bcdf5[_0xa4bf('0x3d')];if(!_0x24b41c[_0xa4bf('0x3e')][_0xa4bf('0x44')](_0xa4bf('0x45'))){_0x3981bc[_0xa4bf('0x26')]=qs[_0xa4bf('0x26')](_0x24b41c['query']['limit']);_0x3981bc['offset']=qs[_0xa4bf('0x24')](_0x24b41c[_0xa4bf('0x3e')][_0xa4bf('0x24')]);}_0x3981bc['order']=qs[_0xa4bf('0x46')](_0x24b41c[_0xa4bf('0x3e')][_0xa4bf('0x46')]);_0x3981bc[_0xa4bf('0x47')]=qs[_0xa4bf('0x48')](_[_0xa4bf('0x49')](_0x24b41c[_0xa4bf('0x3e')],_0x1bcdf5[_0xa4bf('0x48')]),_0x37152f);if(_0x24b41c['query'][_0xa4bf('0x4a')]){_0x3981bc[_0xa4bf('0x47')]=_[_0xa4bf('0x4b')](_0x3981bc[_0xa4bf('0x47')],{'$or':_[_0xa4bf('0x38')](_0x37152f,function(_0x46f0a0){if(_0x46f0a0['type']!==_0xa4bf('0x4c')){var _0x4db3aa={};_0x4db3aa[_0x46f0a0[_0xa4bf('0x35')]]={'$like':'%'+_0x24b41c[_0xa4bf('0x3e')]['filter']+'%'};return _0x4db3aa;}})});}_0x3981bc=_[_0xa4bf('0x4b')]({},_0x3981bc,_0x24b41c[_0xa4bf('0x4d')]);var _0x3453cf={'where':_0x3981bc['where']};return db['Dashboard'][_0xa4bf('0x27')](_0x3453cf)[_0xa4bf('0x2d')](function(_0x529e55){_0x2d6fa7[_0xa4bf('0x27')]=_0x529e55;if(_0x24b41c[_0xa4bf('0x3e')][_0xa4bf('0x4e')]){_0x3981bc['include']=[{'all':!![]}];}return db[_0xa4bf('0x39')][_0xa4bf('0x4f')](_0x3981bc);})[_0xa4bf('0x2d')](function(_0x32285a){_0x2d6fa7[_0xa4bf('0x50')]=_0x32285a;return _0x2d6fa7;})['then'](respondWithFilteredResult(_0x14cd80,_0x3981bc))[_0xa4bf('0x51')](handleError(_0x14cd80,null));};exports[_0xa4bf('0x52')]=function(_0x2d9351,_0x37512d){var _0x446b1f={'raw':![],'where':{'id':_0x2d9351['params']['id']}},_0x2c73fc={};_0x2c73fc[_0xa4bf('0x3d')]=_[_0xa4bf('0x3f')](db['Dashboard']['rawAttributes']);_0x2c73fc[_0xa4bf('0x3e')]=_[_0xa4bf('0x3f')](_0x2d9351[_0xa4bf('0x3e')]);_0x2c73fc['filters']=_[_0xa4bf('0x40')](_0x2c73fc['model'],_0x2c73fc[_0xa4bf('0x3e')]);_0x446b1f[_0xa4bf('0x42')]=_[_0xa4bf('0x40')](_0x2c73fc[_0xa4bf('0x3d')],qs[_0xa4bf('0x41')](_0x2d9351[_0xa4bf('0x3e')][_0xa4bf('0x41')]));_0x446b1f[_0xa4bf('0x42')]=_0x446b1f['attributes'][_0xa4bf('0x43')]?_0x446b1f[_0xa4bf('0x42')]:_0x2c73fc[_0xa4bf('0x3d')];if(_0x2d9351['query'][_0xa4bf('0x4e')]){_0x446b1f['include']=[{'all':!![]}];}_0x446b1f=_[_0xa4bf('0x4b')]({},_0x446b1f,_0x2d9351[_0xa4bf('0x4d')]);return db[_0xa4bf('0x39')][_0xa4bf('0x53')](_0x446b1f)[_0xa4bf('0x2d')](handleEntityNotFound(_0x37512d,null))[_0xa4bf('0x2d')](respondWithResult(_0x37512d,null))['catch'](handleError(_0x37512d,null));};exports[_0xa4bf('0x54')]=function(_0x5026f9,_0x1de98a){return db['Dashboard'][_0xa4bf('0x54')](_0x5026f9[_0xa4bf('0x55')],{})[_0xa4bf('0x2d')](function(_0x4867f2){var _0x315366=_0x5026f9[_0xa4bf('0x56')]['get']({'plain':!![]});if(!_0x315366)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x315366[_0xa4bf('0x57')]==='user'){var _0xeb415f=_0x4867f2[_0xa4bf('0x2e')]({'plain':!![]});var _0x439c37='CustomDashboards';return db[_0xa4bf('0x58')]['find']({'where':{'name':_0x439c37,'userProfileId':_0x315366['userProfileId']},'raw':!![]})['then'](function(_0x22044f){if(_0x22044f&&_0x22044f[_0xa4bf('0x59')]===0x0){return db[_0xa4bf('0x30')][_0xa4bf('0x54')]({'name':_0xeb415f[_0xa4bf('0x35')],'resourceId':_0xeb415f['id'],'type':_0x22044f[_0xa4bf('0x35')],'sectionId':_0x22044f['id']},{})['then'](function(){return _0x4867f2;});}else{return _0x4867f2;}})[_0xa4bf('0x51')](function(_0x302f8e){logger['error'](_0xa4bf('0x5a'),_0x302f8e);throw _0x302f8e;});}return _0x4867f2;})[_0xa4bf('0x2d')](respondWithResult(_0x1de98a,0xc9))[_0xa4bf('0x51')](handleError(_0x1de98a,null));};exports['clone']=function(_0x5810da,_0x3fad56){var _0x39a7b3={'where':{'id':_0x5810da[_0xa4bf('0x5b')]['id']}},_0x8b66cf={};_0x8b66cf['model']=_[_0xa4bf('0x3f')](db['Dashboard'][_0xa4bf('0x3a')]);_0x39a7b3[_0xa4bf('0x42')]=_[_0xa4bf('0x40')](_0x8b66cf[_0xa4bf('0x3d')],qs['fields'](_0x5810da[_0xa4bf('0x3e')][_0xa4bf('0x41')]));_0x39a7b3[_0xa4bf('0x42')]=_0x39a7b3[_0xa4bf('0x42')][_0xa4bf('0x43')]?_0x39a7b3[_0xa4bf('0x42')]:_0x8b66cf[_0xa4bf('0x3d')];if(_0x5810da[_0xa4bf('0x3e')][_0xa4bf('0x4e')]){_0x39a7b3[_0xa4bf('0x5c')]=[{'all':!![]}];}_0x39a7b3=_[_0xa4bf('0x4b')]({},_0x39a7b3,_0x5810da[_0xa4bf('0x4d')]);return db[_0xa4bf('0x39')]['find'](_0x39a7b3)[_0xa4bf('0x2d')](handleEntityNotFound(_0x3fad56,null))[_0xa4bf('0x2d')](function(_0x30be24){if(_0x30be24){var _0x5209b0=_0x30be24[_0xa4bf('0x2e')]({'plain':!![]});_0x5209b0=qs[_0xa4bf('0x5d')](_0x5209b0,['id','createdAt',_0xa4bf('0x5e')]);_0x5810da[_0xa4bf('0x55')]=_['omit'](_0x5810da[_0xa4bf('0x55')],['id','createdAt',_0xa4bf('0x5e')]);return db[_0xa4bf('0x39')][_0xa4bf('0x54')](_[_0xa4bf('0x4b')](_0x5209b0,_0x5810da['body']),{'include':_0x5810da[_0xa4bf('0x3e')][_0xa4bf('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0xed6c18){var _0x1ec71e=_0x5810da[_0xa4bf('0x56')]['get']({'plain':!![]});if(!_0x1ec71e)throw new Error(_0xa4bf('0x5f'));if(_0x1ec71e[_0xa4bf('0x57')]==='user'){var _0x4cb481=_0xed6c18[_0xa4bf('0x2e')]({'plain':!![]});var _0xd468ce=_0xa4bf('0x2f');return db[_0xa4bf('0x58')][_0xa4bf('0x53')]({'where':{'name':_0xd468ce,'userProfileId':_0x1ec71e[_0xa4bf('0x60')]},'raw':!![]})['then'](function(_0x4cbb97){if(_0x4cbb97&&_0x4cbb97[_0xa4bf('0x59')]===0x0){return db[_0xa4bf('0x30')][_0xa4bf('0x54')]({'name':_0x4cb481[_0xa4bf('0x35')],'resourceId':_0x4cb481['id'],'type':_0x4cbb97[_0xa4bf('0x35')],'sectionId':_0x4cbb97['id']},{})[_0xa4bf('0x2d')](function(){return _0xed6c18;});}else{return _0xed6c18;}})[_0xa4bf('0x51')](function(_0x5b2bb8){logger[_0xa4bf('0x33')](_0xa4bf('0x5a'),_0x5b2bb8);throw _0x5b2bb8;});}return _0xed6c18;});}})[_0xa4bf('0x2d')](respondWithResult(_0x3fad56,0xc9))['catch'](handleError(_0x3fad56,null));};exports[_0xa4bf('0x2c')]=function(_0x40c1d5,_0x4409a8){if(_0x40c1d5[_0xa4bf('0x55')]['id']){delete _0x40c1d5[_0xa4bf('0x55')]['id'];}return db['Dashboard'][_0xa4bf('0x53')]({'where':{'id':_0x40c1d5[_0xa4bf('0x5b')]['id']}})[_0xa4bf('0x2d')](handleEntityNotFound(_0x4409a8,null))[_0xa4bf('0x2d')](saveUpdates(_0x40c1d5[_0xa4bf('0x55')],null))[_0xa4bf('0x2d')](respondWithResult(_0x4409a8,null))[_0xa4bf('0x51')](handleError(_0x4409a8,null));};exports[_0xa4bf('0x31')]=function(_0x55eba6,_0x2e9262){return db['Dashboard'][_0xa4bf('0x53')]({'where':{'id':_0x55eba6['params']['id']}})[_0xa4bf('0x2d')](handleEntityNotFound(_0x2e9262,null))[_0xa4bf('0x2d')](removeEntity(_0x2e9262,null))[_0xa4bf('0x51')](handleError(_0x2e9262,null));};function widgetAttributes(_0x2603ad){try{switch(_0x2603ad[_0xa4bf('0x61')]){case _0xa4bf('0x62'):return[{'name':_0xa4bf('0x63'),'value':_0x2603ad[_0xa4bf('0x63')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x0]?_0x2603ad[_0xa4bf('0x64')][0x0][_0xa4bf('0x65')]:undefined)||_0xa4bf('0x66')}];case _0xa4bf('0x67'):return[{'name':'attrPath','value':_0x2603ad[_0xa4bf('0x68')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad['attrs'][0x0]?_0x2603ad['attrs'][0x0][_0xa4bf('0x65')]:undefined)||''}];case _0xa4bf('0x69'):return[{'name':_0xa4bf('0x6a'),'value':_0x2603ad[_0xa4bf('0x6a')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad['attrs'][0x0]?_0x2603ad[_0xa4bf('0x64')][0x0][_0xa4bf('0x65')]:undefined)||_0xa4bf('0x6b')},{'name':'attrTimezone','value':_0x2603ad[_0xa4bf('0x6c')]||(_0x2603ad['attrs']&&_0x2603ad[_0xa4bf('0x64')][0x1]?_0x2603ad['attrs'][0x1][_0xa4bf('0x65')]:undefined)||'0.00'},{'name':_0xa4bf('0x6d'),'value':_0x2603ad[_0xa4bf('0x6d')]||(_0x2603ad['attrs']&&_0x2603ad['attrs'][0x2]?_0x2603ad[_0xa4bf('0x64')][0x2]['value']:undefined)||0xc}];case _0xa4bf('0x6e'):return[{'name':'attrMetric','value':_0x2603ad[_0xa4bf('0x6f')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad['attrs'][0x0]?_0x2603ad[_0xa4bf('0x64')][0x0][_0xa4bf('0x65')]:undefined)||_0xa4bf('0x70')},{'name':_0xa4bf('0x71'),'value':_0x2603ad[_0xa4bf('0x71')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x1]?_0x2603ad[_0xa4bf('0x64')][0x1][_0xa4bf('0x65')]:undefined)||[]},{'name':'attrFontSize','value':_0x2603ad[_0xa4bf('0x6d')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad['attrs'][0x2]?_0x2603ad['attrs'][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x2603ad[_0xa4bf('0x72')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x3]?_0x2603ad[_0xa4bf('0x64')][0x3][_0xa4bf('0x65')]:undefined)||_0xa4bf('0x73')},{'name':'attrEmailAccounts','value':_0x2603ad['attrEmailAccounts']||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x4]?_0x2603ad[_0xa4bf('0x64')][0x4][_0xa4bf('0x65')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2603ad[_0xa4bf('0x74')]||(_0x2603ad['attrs']&&_0x2603ad[_0xa4bf('0x64')][0x5]?_0x2603ad[_0xa4bf('0x64')][0x5]['value']:undefined)||''},{'name':_0xa4bf('0x75'),'value':_0x2603ad[_0xa4bf('0x75')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x6]?_0x2603ad[_0xa4bf('0x64')][0x6][_0xa4bf('0x65')]:undefined)||''},{'name':_0xa4bf('0x76'),'value':_0x2603ad[_0xa4bf('0x76')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x7]?_0x2603ad[_0xa4bf('0x64')][0x7][_0xa4bf('0x65')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2603ad[_0xa4bf('0x77')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x8]?_0x2603ad[_0xa4bf('0x64')][0x8][_0xa4bf('0x65')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2603ad['attrChatWebsites']||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x9]?_0x2603ad[_0xa4bf('0x64')][0x9][_0xa4bf('0x65')]:undefined)||''}];case _0xa4bf('0x78'):case _0xa4bf('0x79'):return[{'name':_0xa4bf('0x7a'),'value':_0x2603ad['attrSerie1']||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x0]?_0x2603ad[_0xa4bf('0x64')][0x0]['value']:undefined)||'total'},{'name':_0xa4bf('0x7b'),'value':_0x2603ad[_0xa4bf('0x7b')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x1]?_0x2603ad[_0xa4bf('0x64')][0x1][_0xa4bf('0x65')]:undefined)||null},{'name':'attrSerie3','value':_0x2603ad['attrSerie3']||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x2]?_0x2603ad[_0xa4bf('0x64')][0x2][_0xa4bf('0x65')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2603ad[_0xa4bf('0x71')]||(_0x2603ad['attrs']&&_0x2603ad[_0xa4bf('0x64')][0x3]?_0x2603ad[_0xa4bf('0x64')][0x3][_0xa4bf('0x65')]:undefined)||[]},{'name':_0xa4bf('0x72'),'value':_0x2603ad[_0xa4bf('0x72')]||(_0x2603ad['attrs']&&_0x2603ad['attrs'][0x4]?_0x2603ad[_0xa4bf('0x64')][0x4][_0xa4bf('0x65')]:undefined)||_0xa4bf('0x73')},{'name':_0xa4bf('0x7c'),'value':_0x2603ad[_0xa4bf('0x7c')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x5]?_0x2603ad['attrs'][0x5]['value']:undefined)||''},{'name':_0xa4bf('0x74'),'value':_0x2603ad[_0xa4bf('0x74')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x6]?_0x2603ad[_0xa4bf('0x64')][0x6][_0xa4bf('0x65')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2603ad[_0xa4bf('0x75')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x7]?_0x2603ad['attrs'][0x7][_0xa4bf('0x65')]:undefined)||''},{'name':_0xa4bf('0x76'),'value':_0x2603ad[_0xa4bf('0x76')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad['attrs'][0x8]?_0x2603ad[_0xa4bf('0x64')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2603ad[_0xa4bf('0x77')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad['attrs'][0x9]?_0x2603ad['attrs'][0x9][_0xa4bf('0x65')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2603ad[_0xa4bf('0x7d')]||(_0x2603ad['attrs']&&_0x2603ad[_0xa4bf('0x64')][0xa]?_0x2603ad['attrs'][0xa]['value']:undefined)||''}];case _0xa4bf('0x7e'):return[{'name':_0xa4bf('0x7f'),'type':_0x2603ad[_0xa4bf('0x80')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad['attrs'][0x0]?_0x2603ad[_0xa4bf('0x64')][0x0][_0xa4bf('0x61')]:undefined)||null,'value':_0x2603ad[_0xa4bf('0x7f')]||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x0]?_0x2603ad[_0xa4bf('0x64')][0x0][_0xa4bf('0x65')]:undefined)||null},{'name':_0xa4bf('0x81'),'value':_0x2603ad['attrRefresh']||(_0x2603ad[_0xa4bf('0x64')]&&_0x2603ad[_0xa4bf('0x64')][0x1]?_0x2603ad['attrs'][0x1][_0xa4bf('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x1a2067){logger[_0xa4bf('0x33')](_0xa4bf('0x82'),JSON[_0xa4bf('0x83')](_0x1a2067));return[];}}exports[_0xa4bf('0x84')]=function(_0x1aaa90,_0x1cd6ea,_0x4de39b){if(_0x1aaa90['body']['id']){delete _0x1aaa90[_0xa4bf('0x55')]['id'];}return db[_0xa4bf('0x39')][_0xa4bf('0x53')]({'where':{'id':_0x1aaa90[_0xa4bf('0x5b')]['id']}})[_0xa4bf('0x2d')](handleEntityNotFound(_0x1cd6ea,null))['then'](function(_0x43ed86){if(_0x43ed86){_0x1aaa90['body'][_0xa4bf('0x85')]=_0x43ed86['id'];_0x1aaa90['body']['attrs']=widgetAttributes(_0x1aaa90[_0xa4bf('0x55')]);return db[_0xa4bf('0x86')][_0xa4bf('0x54')](_0x1aaa90[_0xa4bf('0x55')]);}})[_0xa4bf('0x2d')](respondWithResult(_0x1cd6ea,null))[_0xa4bf('0x51')](handleError(_0x1cd6ea,null));};exports[_0xa4bf('0x87')]=function(_0x45349e,_0x383bca,_0x4d7c87){var _0x27f452={};var _0x46757f={};var _0xe1c51a;var _0x13dd53;return db[_0xa4bf('0x39')][_0xa4bf('0x88')]({'where':{'id':_0x45349e[_0xa4bf('0x5b')]['id']}})[_0xa4bf('0x2d')](handleEntityNotFound(_0x383bca,null))['then'](function(_0x1b5edc){if(_0x1b5edc){_0xe1c51a=_0x1b5edc;_0x46757f[_0xa4bf('0x3d')]=_[_0xa4bf('0x3f')](db[_0xa4bf('0x86')][_0xa4bf('0x3a')]);_0x46757f[_0xa4bf('0x3e')]=_[_0xa4bf('0x3f')](_0x45349e[_0xa4bf('0x3e')]);_0x46757f['filters']=_[_0xa4bf('0x40')](_0x46757f['model'],_0x46757f['query']);_0x27f452[_0xa4bf('0x42')]=_['intersection'](_0x46757f[_0xa4bf('0x3d')],qs['fields'](_0x45349e[_0xa4bf('0x3e')][_0xa4bf('0x41')]));_0x27f452[_0xa4bf('0x42')]=_0x27f452['attributes'][_0xa4bf('0x43')]?_0x27f452['attributes']:_0x46757f[_0xa4bf('0x3d')];_0x27f452['order']=qs[_0xa4bf('0x46')](_0x45349e['query'][_0xa4bf('0x46')]);_0x27f452[_0xa4bf('0x47')]=qs[_0xa4bf('0x48')](_[_0xa4bf('0x49')](_0x45349e[_0xa4bf('0x3e')],_0x46757f[_0xa4bf('0x48')]));if(_0x45349e[_0xa4bf('0x3e')]['filter']){_0x27f452['where']=_[_0xa4bf('0x4b')](_0x27f452[_0xa4bf('0x47')],{'$or':_[_0xa4bf('0x38')](_0x27f452[_0xa4bf('0x42')],function(_0x17425a){var _0x32ff32={};_0x32ff32[_0x17425a]={'$like':'%'+_0x45349e['query']['filter']+'%'};return _0x32ff32;})});}_0x27f452=_[_0xa4bf('0x4b')]({},_0x27f452,_0x45349e[_0xa4bf('0x4d')]);return _0xe1c51a['getItems'](_0x27f452);}})[_0xa4bf('0x2d')](function(_0x3644a8){if(_0x3644a8){_0x13dd53=_0x3644a8[_0xa4bf('0x43')];if(!_0x45349e[_0xa4bf('0x3e')][_0xa4bf('0x44')](_0xa4bf('0x45'))){_0x27f452[_0xa4bf('0x26')]=qs[_0xa4bf('0x26')](_0x45349e[_0xa4bf('0x3e')]['limit']);_0x27f452[_0xa4bf('0x24')]=qs[_0xa4bf('0x24')](_0x45349e['query']['offset']);}return _0xe1c51a[_0xa4bf('0x87')](_0x27f452);}})[_0xa4bf('0x2d')](function(_0x5e214c){if(_0x5e214c){return _0x5e214c?{'count':_0x13dd53,'rows':_0x5e214c}:null;}})[_0xa4bf('0x2d')](respondWithResult(_0x383bca,null))['catch'](handleError(_0x383bca,null));}; \ No newline at end of file +var _0xac93=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','CustomDashboards','UserProfileResource','error','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','Dashboard','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','destroy','iframe','attrUrl','attrs','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrReport','type','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0xac93,0xe5));var _0x3ac9=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xac93[_0x4a7631];return _0x1a5a6f;};'use strict';var emlformat=require(_0x3ac9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3ac9('0x1'));var rp=require(_0x3ac9('0x2'));var moment=require('moment');var BPromise=require(_0x3ac9('0x3'));var Mustache=require('mustache');var util=require(_0x3ac9('0x4'));var path=require(_0x3ac9('0x5'));var sox=require(_0x3ac9('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ac9('0x7'));var _=require(_0x3ac9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ac9('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3ac9('0xa'));var querystring=require(_0x3ac9('0xb'));var Papa=require(_0x3ac9('0xc'));var Redis=require(_0x3ac9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3ac9('0xe'));var as=require(_0x3ac9('0xf'));var hardwareService=require(_0x3ac9('0x10'));var logger=require('../../config/logger')(_0x3ac9('0x11'));var utils=require(_0x3ac9('0x12'));var config=require(_0x3ac9('0x13'));var licenseUtil=require(_0x3ac9('0x14'));var db=require(_0x3ac9('0x15'))['db'];config['redis']=_[_0x3ac9('0x16')](config[_0x3ac9('0x17')],{'host':_0x3ac9('0x18'),'port':0x18eb});var socket=require(_0x3ac9('0x19'))(new Redis(config[_0x3ac9('0x17')]));require(_0x3ac9('0x1a'))[_0x3ac9('0x1b')](socket);function respondWithStatusCode(_0x445647,_0x44b8bd){_0x44b8bd=_0x44b8bd||0xcc;return function(_0x26320c){if(_0x26320c){return _0x445647[_0x3ac9('0x1c')](_0x44b8bd);}return _0x445647[_0x3ac9('0x1d')](_0x44b8bd)[_0x3ac9('0x1e')]();};}function respondWithResult(_0x44a95b,_0x301d1e){_0x301d1e=_0x301d1e||0xc8;return function(_0x3945c4){if(_0x3945c4){return _0x44a95b[_0x3ac9('0x1d')](_0x301d1e)['json'](_0x3945c4);}};}function respondWithFilteredResult(_0x1e41b2,_0x1dfb58){return function(_0x51da52){if(_0x51da52){var _0x4d3a44=typeof _0x1dfb58[_0x3ac9('0x1f')]===_0x3ac9('0x20')&&typeof _0x1dfb58[_0x3ac9('0x21')]==='undefined';var _0x37112c=_0x51da52[_0x3ac9('0x22')];var _0x5bafae=_0x4d3a44?0x0:_0x1dfb58['offset'];var _0x2cc703=_0x4d3a44?_0x51da52[_0x3ac9('0x22')]:_0x1dfb58[_0x3ac9('0x1f')]+_0x1dfb58[_0x3ac9('0x21')];var _0x1fc9bc;if(_0x2cc703>=_0x37112c){_0x2cc703=_0x37112c;_0x1fc9bc=0xc8;}else{_0x1fc9bc=0xce;}_0x1e41b2[_0x3ac9('0x1d')](_0x1fc9bc);return _0x1e41b2[_0x3ac9('0x23')](_0x3ac9('0x24'),_0x5bafae+'-'+_0x2cc703+'/'+_0x37112c)['json'](_0x51da52);}return null;};}function patchUpdates(_0x30fdae){return function(_0x2640e3){try{jsonpatch['apply'](_0x2640e3,_0x30fdae,!![]);}catch(_0x1f383d){return BPromise[_0x3ac9('0x25')](_0x1f383d);}return _0x2640e3[_0x3ac9('0x26')]();};}function saveUpdates(_0x46a3bb,_0x107499){return function(_0x550bce){if(_0x550bce){return _0x550bce[_0x3ac9('0x27')](_0x46a3bb)[_0x3ac9('0x28')](function(_0x45cf43){return _0x45cf43;});}return null;};}function removeEntity(_0x4999f8,_0x41479f){return function(_0x468080){if(_0x468080){return _0x468080['destroy']()[_0x3ac9('0x28')](function(){var _0x523e2b=_0x468080[_0x3ac9('0x29')]({'plain':!![]});var _0x16c1a3=_0x3ac9('0x2a');return db[_0x3ac9('0x2b')]['destroy']({'where':{'type':_0x16c1a3,'resourceId':_0x523e2b['id']}})[_0x3ac9('0x28')](function(){return _0x468080;});})[_0x3ac9('0x28')](function(){_0x4999f8[_0x3ac9('0x1d')](0xcc)[_0x3ac9('0x1e')]();});}};}function handleEntityNotFound(_0x35d91e,_0x1f7023){return function(_0x31d86b){if(!_0x31d86b){_0x35d91e['sendStatus'](0x194);}return _0x31d86b;};}function handleError(_0x2b1276,_0x33ac10){_0x33ac10=_0x33ac10||0x1f4;return function(_0x1e3205){logger[_0x3ac9('0x2c')](_0x1e3205['stack']);if(_0x1e3205[_0x3ac9('0x2d')]){delete _0x1e3205[_0x3ac9('0x2d')];}_0x2b1276[_0x3ac9('0x1d')](_0x33ac10)[_0x3ac9('0x2e')](_0x1e3205);};}exports[_0x3ac9('0x2f')]=function(_0x2051f7,_0x45db69){var _0xc33c1f={},_0x1642ec={},_0x2fdc81={'count':0x0,'rows':[]};var _0x1b6ca8=_[_0x3ac9('0x30')](db['Dashboard']['rawAttributes'],function(_0x7ba9e9){return{'name':_0x7ba9e9[_0x3ac9('0x31')],'type':_0x7ba9e9['type'][_0x3ac9('0x32')]};});_0x1642ec['model']=_[_0x3ac9('0x30')](_0x1b6ca8,_0x3ac9('0x2d'));_0x1642ec[_0x3ac9('0x33')]=_[_0x3ac9('0x34')](_0x2051f7[_0x3ac9('0x33')]);_0x1642ec[_0x3ac9('0x35')]=_[_0x3ac9('0x36')](_0x1642ec[_0x3ac9('0x37')],_0x1642ec[_0x3ac9('0x33')]);_0xc33c1f['attributes']=_[_0x3ac9('0x36')](_0x1642ec[_0x3ac9('0x37')],qs[_0x3ac9('0x38')](_0x2051f7[_0x3ac9('0x33')]['fields']));_0xc33c1f[_0x3ac9('0x39')]=_0xc33c1f[_0x3ac9('0x39')][_0x3ac9('0x3a')]?_0xc33c1f[_0x3ac9('0x39')]:_0x1642ec['model'];if(!_0x2051f7['query'][_0x3ac9('0x3b')](_0x3ac9('0x3c'))){_0xc33c1f[_0x3ac9('0x21')]=qs[_0x3ac9('0x21')](_0x2051f7['query'][_0x3ac9('0x21')]);_0xc33c1f['offset']=qs[_0x3ac9('0x1f')](_0x2051f7[_0x3ac9('0x33')]['offset']);}_0xc33c1f[_0x3ac9('0x3d')]=qs[_0x3ac9('0x3e')](_0x2051f7['query'][_0x3ac9('0x3e')]);_0xc33c1f['where']=qs[_0x3ac9('0x35')](_['pick'](_0x2051f7['query'],_0x1642ec['filters']),_0x1b6ca8);if(_0x2051f7['query'][_0x3ac9('0x3f')]){_0xc33c1f['where']=_[_0x3ac9('0x40')](_0xc33c1f[_0x3ac9('0x41')],{'$or':_['map'](_0x1b6ca8,function(_0x355df7){if(_0x355df7['type']!=='VIRTUAL'){var _0xf2e13d={};_0xf2e13d[_0x355df7[_0x3ac9('0x2d')]]={'$like':'%'+_0x2051f7['query'][_0x3ac9('0x3f')]+'%'};return _0xf2e13d;}})});}_0xc33c1f=_[_0x3ac9('0x40')]({},_0xc33c1f,_0x2051f7['options']);var _0x1c7f3e={'where':_0xc33c1f[_0x3ac9('0x41')]};return db[_0x3ac9('0x42')][_0x3ac9('0x22')](_0x1c7f3e)[_0x3ac9('0x28')](function(_0x45c747){_0x2fdc81[_0x3ac9('0x22')]=_0x45c747;if(_0x2051f7['query'][_0x3ac9('0x43')]){_0xc33c1f[_0x3ac9('0x44')]=[{'all':!![]}];}return db[_0x3ac9('0x42')][_0x3ac9('0x45')](_0xc33c1f);})[_0x3ac9('0x28')](function(_0x4832a5){_0x2fdc81[_0x3ac9('0x46')]=_0x4832a5;return _0x2fdc81;})[_0x3ac9('0x28')](respondWithFilteredResult(_0x45db69,_0xc33c1f))[_0x3ac9('0x47')](handleError(_0x45db69,null));};exports[_0x3ac9('0x48')]=function(_0x471ce4,_0x285424){var _0x38a7ba={'raw':![],'where':{'id':_0x471ce4[_0x3ac9('0x49')]['id']}},_0x200e46={};_0x200e46[_0x3ac9('0x37')]=_[_0x3ac9('0x34')](db['Dashboard'][_0x3ac9('0x4a')]);_0x200e46['query']=_['keys'](_0x471ce4[_0x3ac9('0x33')]);_0x200e46[_0x3ac9('0x35')]=_[_0x3ac9('0x36')](_0x200e46[_0x3ac9('0x37')],_0x200e46[_0x3ac9('0x33')]);_0x38a7ba[_0x3ac9('0x39')]=_[_0x3ac9('0x36')](_0x200e46['model'],qs[_0x3ac9('0x38')](_0x471ce4[_0x3ac9('0x33')][_0x3ac9('0x38')]));_0x38a7ba[_0x3ac9('0x39')]=_0x38a7ba[_0x3ac9('0x39')][_0x3ac9('0x3a')]?_0x38a7ba['attributes']:_0x200e46[_0x3ac9('0x37')];if(_0x471ce4[_0x3ac9('0x33')][_0x3ac9('0x43')]){_0x38a7ba['include']=[{'all':!![]}];}_0x38a7ba=_[_0x3ac9('0x40')]({},_0x38a7ba,_0x471ce4[_0x3ac9('0x4b')]);return db[_0x3ac9('0x42')]['find'](_0x38a7ba)[_0x3ac9('0x28')](handleEntityNotFound(_0x285424,null))[_0x3ac9('0x28')](respondWithResult(_0x285424,null))[_0x3ac9('0x47')](handleError(_0x285424,null));};exports[_0x3ac9('0x4c')]=function(_0x307aaf,_0x94e70c){return db[_0x3ac9('0x42')]['create'](_0x307aaf['body'],{})[_0x3ac9('0x28')](function(_0x35f55c){var _0xaa9918=_0x307aaf['user'][_0x3ac9('0x29')]({'plain':!![]});if(!_0xaa9918)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaa9918[_0x3ac9('0x4d')]==='user'){var _0x569b9d=_0x35f55c[_0x3ac9('0x29')]({'plain':!![]});var _0xa1b562='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0xa1b562,'userProfileId':_0xaa9918[_0x3ac9('0x4e')]},'raw':!![]})[_0x3ac9('0x28')](function(_0x30353a){if(_0x30353a&&_0x30353a[_0x3ac9('0x4f')]===0x0){return db[_0x3ac9('0x2b')][_0x3ac9('0x4c')]({'name':_0x569b9d[_0x3ac9('0x2d')],'resourceId':_0x569b9d['id'],'type':_0x30353a[_0x3ac9('0x2d')],'sectionId':_0x30353a['id']},{})[_0x3ac9('0x28')](function(){return _0x35f55c;});}else{return _0x35f55c;}})[_0x3ac9('0x47')](function(_0xeff2b4){logger[_0x3ac9('0x2c')](_0x3ac9('0x50'),_0xeff2b4);throw _0xeff2b4;});}return _0x35f55c;})[_0x3ac9('0x28')](respondWithResult(_0x94e70c,0xc9))['catch'](handleError(_0x94e70c,null));};exports[_0x3ac9('0x51')]=function(_0x2a8853,_0x330644){var _0x283919={'where':{'id':_0x2a8853['params']['id']}},_0x289525={};_0x289525['model']=_[_0x3ac9('0x34')](db['Dashboard'][_0x3ac9('0x4a')]);_0x283919[_0x3ac9('0x39')]=_[_0x3ac9('0x36')](_0x289525['model'],qs[_0x3ac9('0x38')](_0x2a8853[_0x3ac9('0x33')][_0x3ac9('0x38')]));_0x283919[_0x3ac9('0x39')]=_0x283919['attributes']['length']?_0x283919['attributes']:_0x289525[_0x3ac9('0x37')];if(_0x2a8853[_0x3ac9('0x33')]['includeAll']){_0x283919[_0x3ac9('0x44')]=[{'all':!![]}];}_0x283919=_['merge']({},_0x283919,_0x2a8853[_0x3ac9('0x4b')]);return db[_0x3ac9('0x42')]['find'](_0x283919)['then'](handleEntityNotFound(_0x330644,null))[_0x3ac9('0x28')](function(_0x3857df){if(_0x3857df){var _0x2a811a=_0x3857df[_0x3ac9('0x29')]({'plain':!![]});_0x2a811a=qs[_0x3ac9('0x52')](_0x2a811a,['id','createdAt','updatedAt']);_0x2a8853[_0x3ac9('0x53')]=_[_0x3ac9('0x52')](_0x2a8853[_0x3ac9('0x53')],['id','createdAt',_0x3ac9('0x54')]);return db[_0x3ac9('0x42')]['create'](_[_0x3ac9('0x40')](_0x2a811a,_0x2a8853[_0x3ac9('0x53')]),{'include':_0x2a8853[_0x3ac9('0x33')][_0x3ac9('0x43')]?[{'all':!![]}]:undefined})[_0x3ac9('0x28')](function(_0x4d00db){var _0x147548=_0x2a8853[_0x3ac9('0x55')]['get']({'plain':!![]});if(!_0x147548)throw new Error(_0x3ac9('0x56'));if(_0x147548['role']===_0x3ac9('0x55')){var _0x3b7c9f=_0x4d00db[_0x3ac9('0x29')]({'plain':!![]});var _0x31c2ad='CustomDashboards';return db[_0x3ac9('0x57')][_0x3ac9('0x58')]({'where':{'name':_0x31c2ad,'userProfileId':_0x147548['userProfileId']},'raw':!![]})[_0x3ac9('0x28')](function(_0x5b5df6){if(_0x5b5df6&&_0x5b5df6[_0x3ac9('0x4f')]===0x0){return db['UserProfileResource'][_0x3ac9('0x4c')]({'name':_0x3b7c9f[_0x3ac9('0x2d')],'resourceId':_0x3b7c9f['id'],'type':_0x5b5df6[_0x3ac9('0x2d')],'sectionId':_0x5b5df6['id']},{})[_0x3ac9('0x28')](function(){return _0x4d00db;});}else{return _0x4d00db;}})[_0x3ac9('0x47')](function(_0x2e1e33){logger['error'](_0x3ac9('0x50'),_0x2e1e33);throw _0x2e1e33;});}return _0x4d00db;});}})[_0x3ac9('0x28')](respondWithResult(_0x330644,0xc9))[_0x3ac9('0x47')](handleError(_0x330644,null));};exports[_0x3ac9('0x27')]=function(_0x1b4fe6,_0x2d5c6a){if(_0x1b4fe6[_0x3ac9('0x53')]['id']){delete _0x1b4fe6[_0x3ac9('0x53')]['id'];}return db[_0x3ac9('0x42')][_0x3ac9('0x58')]({'where':{'id':_0x1b4fe6[_0x3ac9('0x49')]['id']}})[_0x3ac9('0x28')](handleEntityNotFound(_0x2d5c6a,null))[_0x3ac9('0x28')](saveUpdates(_0x1b4fe6[_0x3ac9('0x53')],null))[_0x3ac9('0x28')](respondWithResult(_0x2d5c6a,null))[_0x3ac9('0x47')](handleError(_0x2d5c6a,null));};exports[_0x3ac9('0x59')]=function(_0x2c0c53,_0x53a6c8){return db[_0x3ac9('0x42')][_0x3ac9('0x58')]({'where':{'id':_0x2c0c53['params']['id']}})[_0x3ac9('0x28')](handleEntityNotFound(_0x53a6c8,null))[_0x3ac9('0x28')](removeEntity(_0x53a6c8,null))[_0x3ac9('0x47')](handleError(_0x53a6c8,null));};function widgetAttributes(_0x4c5383){try{switch(_0x4c5383['type']){case _0x3ac9('0x5a'):return[{'name':_0x3ac9('0x5b'),'value':_0x4c5383[_0x3ac9('0x5b')]||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383['attrs'][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0x3ac9('0x5d'),'value':_0x4c5383[_0x3ac9('0x5d')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383[_0x3ac9('0x5c')][0x0][_0x3ac9('0x5e')]:undefined)||''}];case _0x3ac9('0x5f'):return[{'name':_0x3ac9('0x60'),'value':_0x4c5383[_0x3ac9('0x60')]||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383[_0x3ac9('0x5c')][0x0][_0x3ac9('0x5e')]:undefined)||_0x3ac9('0x61')},{'name':'attrTimezone','value':_0x4c5383[_0x3ac9('0x62')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383['attrs'][0x1]?_0x4c5383[_0x3ac9('0x5c')][0x1]['value']:undefined)||_0x3ac9('0x63')},{'name':'attrFontSize','value':_0x4c5383['attrFontSize']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x2]?_0x4c5383['attrs'][0x2][_0x3ac9('0x5e')]:undefined)||0xc}];case _0x3ac9('0x64'):return[{'name':_0x3ac9('0x65'),'value':_0x4c5383['attrMetric']||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383[_0x3ac9('0x5c')][0x0][_0x3ac9('0x5e')]:undefined)||_0x3ac9('0x66')},{'name':'attrVoiceQueues','value':_0x4c5383[_0x3ac9('0x67')]||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x1]?_0x4c5383[_0x3ac9('0x5c')][0x1]['value']:undefined)||[]},{'name':_0x3ac9('0x68'),'value':_0x4c5383['attrFontSize']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x2]?_0x4c5383['attrs'][0x2][_0x3ac9('0x5e')]:undefined)||0x14},{'name':_0x3ac9('0x69'),'value':_0x4c5383['attrChannel']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383['attrs'][0x3]?_0x4c5383[_0x3ac9('0x5c')][0x3][_0x3ac9('0x5e')]:undefined)||_0x3ac9('0x6a')},{'name':_0x3ac9('0x6b'),'value':_0x4c5383['attrEmailAccounts']||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x4]?_0x4c5383[_0x3ac9('0x5c')][0x4][_0x3ac9('0x5e')]:undefined)||''},{'name':_0x3ac9('0x6c'),'value':_0x4c5383[_0x3ac9('0x6c')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x5]?_0x4c5383['attrs'][0x5]['value']:undefined)||''},{'name':_0x3ac9('0x6d'),'value':_0x4c5383[_0x3ac9('0x6d')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x6]?_0x4c5383[_0x3ac9('0x5c')][0x6]['value']:undefined)||''},{'name':_0x3ac9('0x6e'),'value':_0x4c5383[_0x3ac9('0x6e')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x7]?_0x4c5383[_0x3ac9('0x5c')][0x7][_0x3ac9('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4c5383[_0x3ac9('0x6f')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383['attrs'][0x8]?_0x4c5383['attrs'][0x8][_0x3ac9('0x5e')]:undefined)||''},{'name':_0x3ac9('0x70'),'value':_0x4c5383[_0x3ac9('0x70')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x9]?_0x4c5383[_0x3ac9('0x5c')][0x9][_0x3ac9('0x5e')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x4c5383[_0x3ac9('0x71')]||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383[_0x3ac9('0x5c')][0x0][_0x3ac9('0x5e')]:undefined)||_0x3ac9('0x66')},{'name':'attrSerie2','value':_0x4c5383[_0x3ac9('0x72')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x1]?_0x4c5383[_0x3ac9('0x5c')][0x1][_0x3ac9('0x5e')]:undefined)||null},{'name':_0x3ac9('0x73'),'value':_0x4c5383[_0x3ac9('0x73')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x2]?_0x4c5383[_0x3ac9('0x5c')][0x2]['value']:undefined)||null},{'name':_0x3ac9('0x67'),'value':_0x4c5383['attrVoiceQueues']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383['attrs'][0x3]?_0x4c5383[_0x3ac9('0x5c')][0x3][_0x3ac9('0x5e')]:undefined)||[]},{'name':_0x3ac9('0x69'),'value':_0x4c5383[_0x3ac9('0x69')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x4]?_0x4c5383[_0x3ac9('0x5c')][0x4][_0x3ac9('0x5e')]:undefined)||_0x3ac9('0x6a')},{'name':_0x3ac9('0x6b'),'value':_0x4c5383['attrEmailAccounts']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x5]?_0x4c5383[_0x3ac9('0x5c')][0x5][_0x3ac9('0x5e')]:undefined)||''},{'name':_0x3ac9('0x6c'),'value':_0x4c5383[_0x3ac9('0x6c')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x6]?_0x4c5383[_0x3ac9('0x5c')][0x6]['value']:undefined)||''},{'name':_0x3ac9('0x6d'),'value':_0x4c5383[_0x3ac9('0x6d')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x7]?_0x4c5383[_0x3ac9('0x5c')][0x7][_0x3ac9('0x5e')]:undefined)||''},{'name':_0x3ac9('0x6e'),'value':_0x4c5383[_0x3ac9('0x6e')]||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x8]?_0x4c5383['attrs'][0x8]['value']:undefined)||''},{'name':_0x3ac9('0x6f'),'value':_0x4c5383['attrWhatsappAccounts']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x9]?_0x4c5383['attrs'][0x9][_0x3ac9('0x5e')]:undefined)||''},{'name':_0x3ac9('0x70'),'value':_0x4c5383[_0x3ac9('0x70')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0xa]?_0x4c5383[_0x3ac9('0x5c')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x3ac9('0x74'),'type':_0x4c5383['reportType']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383['attrs'][0x0][_0x3ac9('0x75')]:undefined)||null,'value':_0x4c5383['attrReport']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383[_0x3ac9('0x5c')][0x0][_0x3ac9('0x5e')]:undefined)||null},{'name':_0x3ac9('0x76'),'value':_0x4c5383[_0x3ac9('0x76')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x1]?_0x4c5383['attrs'][0x1][_0x3ac9('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x1537f1){logger[_0x3ac9('0x2c')](_0x3ac9('0x77'),JSON['stringify'](_0x1537f1));return[];}}exports[_0x3ac9('0x78')]=function(_0x202698,_0x1535d3,_0x3c54b4){if(_0x202698[_0x3ac9('0x53')]['id']){delete _0x202698[_0x3ac9('0x53')]['id'];}return db[_0x3ac9('0x42')][_0x3ac9('0x58')]({'where':{'id':_0x202698['params']['id']}})['then'](handleEntityNotFound(_0x1535d3,null))[_0x3ac9('0x28')](function(_0x282c45){if(_0x282c45){_0x202698[_0x3ac9('0x53')][_0x3ac9('0x79')]=_0x282c45['id'];_0x202698[_0x3ac9('0x53')][_0x3ac9('0x5c')]=widgetAttributes(_0x202698[_0x3ac9('0x53')]);return db[_0x3ac9('0x7a')][_0x3ac9('0x4c')](_0x202698[_0x3ac9('0x53')]);}})[_0x3ac9('0x28')](respondWithResult(_0x1535d3,null))[_0x3ac9('0x47')](handleError(_0x1535d3,null));};exports[_0x3ac9('0x7b')]=function(_0x22ddea,_0x450416,_0x513bcd){var _0x29e631={};var _0x1a173a={};var _0x2b1a4d;var _0x3ab170;return db[_0x3ac9('0x42')][_0x3ac9('0x7c')]({'where':{'id':_0x22ddea[_0x3ac9('0x49')]['id']}})['then'](handleEntityNotFound(_0x450416,null))[_0x3ac9('0x28')](function(_0x5b87bb){if(_0x5b87bb){_0x2b1a4d=_0x5b87bb;_0x1a173a[_0x3ac9('0x37')]=_[_0x3ac9('0x34')](db[_0x3ac9('0x7a')][_0x3ac9('0x4a')]);_0x1a173a[_0x3ac9('0x33')]=_[_0x3ac9('0x34')](_0x22ddea[_0x3ac9('0x33')]);_0x1a173a[_0x3ac9('0x35')]=_['intersection'](_0x1a173a['model'],_0x1a173a[_0x3ac9('0x33')]);_0x29e631['attributes']=_[_0x3ac9('0x36')](_0x1a173a[_0x3ac9('0x37')],qs['fields'](_0x22ddea[_0x3ac9('0x33')][_0x3ac9('0x38')]));_0x29e631[_0x3ac9('0x39')]=_0x29e631[_0x3ac9('0x39')][_0x3ac9('0x3a')]?_0x29e631[_0x3ac9('0x39')]:_0x1a173a[_0x3ac9('0x37')];_0x29e631[_0x3ac9('0x3d')]=qs[_0x3ac9('0x3e')](_0x22ddea[_0x3ac9('0x33')][_0x3ac9('0x3e')]);_0x29e631[_0x3ac9('0x41')]=qs['filters'](_['pick'](_0x22ddea[_0x3ac9('0x33')],_0x1a173a[_0x3ac9('0x35')]));if(_0x22ddea['query'][_0x3ac9('0x3f')]){_0x29e631[_0x3ac9('0x41')]=_[_0x3ac9('0x40')](_0x29e631[_0x3ac9('0x41')],{'$or':_[_0x3ac9('0x30')](_0x29e631['attributes'],function(_0xc5d6f1){var _0x46b72e={};_0x46b72e[_0xc5d6f1]={'$like':'%'+_0x22ddea['query'][_0x3ac9('0x3f')]+'%'};return _0x46b72e;})});}_0x29e631=_[_0x3ac9('0x40')]({},_0x29e631,_0x22ddea[_0x3ac9('0x4b')]);return _0x2b1a4d[_0x3ac9('0x7b')](_0x29e631);}})[_0x3ac9('0x28')](function(_0x131eb1){if(_0x131eb1){_0x3ab170=_0x131eb1['length'];if(!_0x22ddea[_0x3ac9('0x33')][_0x3ac9('0x3b')]('nolimit')){_0x29e631[_0x3ac9('0x21')]=qs[_0x3ac9('0x21')](_0x22ddea['query'][_0x3ac9('0x21')]);_0x29e631[_0x3ac9('0x1f')]=qs[_0x3ac9('0x1f')](_0x22ddea[_0x3ac9('0x33')][_0x3ac9('0x1f')]);}return _0x2b1a4d[_0x3ac9('0x7b')](_0x29e631);}})[_0x3ac9('0x28')](function(_0x373a62){if(_0x373a62){return _0x373a62?{'count':_0x3ab170,'rows':_0x373a62}:null;}})[_0x3ac9('0x28')](respondWithResult(_0x450416,null))[_0x3ac9('0x47')](handleError(_0x450416,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 53b603e..eb35a17 100644 --- a/server/api/dashboard/dashboard.events.js +++ b/server/api/dashboard/dashboard.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51ac=['hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','save','update','remove','emit'];(function(_0x371ac2,_0xc5961c){var _0x37d93d=function(_0x26b927){while(--_0x26b927){_0x371ac2['push'](_0x371ac2['shift']());}};_0x37d93d(++_0xc5961c);}(_0x51ac,0xfd));var _0xc51a=function(_0x1fc6ad,_0x55ed5a){_0x1fc6ad=_0x1fc6ad-0x0;var _0x15cdea=_0x51ac[_0x1fc6ad];return _0x15cdea;};'use strict';var EventEmitter=require(_0xc51a('0x0'));var Dashboard=require(_0xc51a('0x1'))['db'][_0xc51a('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc51a('0x3'),'afterUpdate':_0xc51a('0x4'),'afterDestroy':_0xc51a('0x5')};function emitEvent(_0x59b8e8){return function(_0x383540,_0x194393,_0x55f5a6){DashboardEvents[_0xc51a('0x6')](_0x59b8e8+':'+_0x383540['id'],_0x383540);DashboardEvents['emit'](_0x59b8e8,_0x383540);_0x55f5a6(null);};}for(var e in events){if(events[_0xc51a('0x7')](e)){var event=events[e];Dashboard[_0xc51a('0x8')](e,emitEvent(event));}}module[_0xc51a('0x9')]=DashboardEvents; \ No newline at end of file +var _0x42ec=['hasOwnProperty','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit'];(function(_0x2cb4cc,_0x1042c9){var _0x54bca9=function(_0x2583f7){while(--_0x2583f7){_0x2cb4cc['push'](_0x2cb4cc['shift']());}};_0x54bca9(++_0x1042c9);}(_0x42ec,0x1e8));var _0xc42e=function(_0x10436f,_0x49ebc5){_0x10436f=_0x10436f-0x0;var _0x14d081=_0x42ec[_0x10436f];return _0x14d081;};'use strict';var EventEmitter=require(_0xc42e('0x0'));var Dashboard=require(_0xc42e('0x1'))['db'][_0xc42e('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc42e('0x3')](0x0);var events={'afterCreate':_0xc42e('0x4'),'afterUpdate':'update','afterDestroy':_0xc42e('0x5')};function emitEvent(_0x49a4c9){return function(_0x107a41,_0x2f1f54,_0x2baaa9){DashboardEvents[_0xc42e('0x6')](_0x49a4c9+':'+_0x107a41['id'],_0x107a41);DashboardEvents['emit'](_0x49a4c9,_0x107a41);_0x2baaa9(null);};}for(var e in events){if(events[_0xc42e('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xc42e('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a0308dd..f54b865 100644 --- a/server/api/dashboard/dashboard.model.js +++ b/server/api/dashboard/dashboard.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b14=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x4b5367,_0x11bb42){var _0x1d604a=function(_0x217b48){while(--_0x217b48){_0x4b5367['push'](_0x4b5367['shift']());}};_0x1d604a(++_0x11bb42);}(_0x5b14,0xfc));var _0x45b1=function(_0x39cad6,_0x1edf41){_0x39cad6=_0x39cad6-0x0;var _0x5a82f2=_0x5b14[_0x39cad6];return _0x5a82f2;};'use strict';var _=require(_0x45b1('0x0'));var util=require(_0x45b1('0x1'));var logger=require(_0x45b1('0x2'))(_0x45b1('0x3'));var moment=require(_0x45b1('0x4'));var BPromise=require(_0x45b1('0x5'));var rp=require(_0x45b1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x45b1('0x7'));var attributes=require(_0x45b1('0x8'));module[_0x45b1('0x9')]=function(_0x30e348,_0x415978){return _0x30e348[_0x45b1('0xa')](_0x45b1('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf451=['define','dashboards','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x24cefa,_0x4d34d1){var _0x27cbdd=function(_0xd74a15){while(--_0xd74a15){_0x24cefa['push'](_0x24cefa['shift']());}};_0x27cbdd(++_0x4d34d1);}(_0xf451,0x161));var _0x1f45=function(_0x3d4080,_0x5a2514){_0x3d4080=_0x3d4080-0x0;var _0x1c3583=_0xf451[_0x3d4080];return _0x1c3583;};'use strict';var _=require(_0x1f45('0x0'));var util=require(_0x1f45('0x1'));var logger=require(_0x1f45('0x2'))(_0x1f45('0x3'));var moment=require('moment');var BPromise=require(_0x1f45('0x4'));var rp=require(_0x1f45('0x5'));var fs=require('fs');var path=require(_0x1f45('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module['exports']=function(_0x4a3c60,_0x3436b8){return _0x4a3c60[_0x1f45('0x7')]('Dashboard',attributes,{'tableName':_0x1f45('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 4fed441..18ac5b2 100644 --- a/server/api/dashboard/dashboard.rpc.js +++ b/server/api/dashboard/dashboard.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7ae=['Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x210296,_0xe067c5){var _0x24713e=function(_0x552dd1){while(--_0x552dd1){_0x210296['push'](_0x210296['shift']());}};_0x24713e(++_0xe067c5);}(_0xd7ae,0x1d0));var _0xed7a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd7ae[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xed7a('0x0'));var util=require(_0xed7a('0x1'));var moment=require(_0xed7a('0x2'));var BPromise=require(_0xed7a('0x3'));var rs=require(_0xed7a('0x4'));var fs=require('fs');var Redis=require(_0xed7a('0x5'));var db=require(_0xed7a('0x6'))['db'];var utils=require(_0xed7a('0x7'));var logger=require(_0xed7a('0x8'))(_0xed7a('0x9'));var config=require('../../config/environment');var jayson=require(_0xed7a('0xa'));var client=jayson[_0xed7a('0xb')][_0xed7a('0xc')]({'port':0x232a});config[_0xed7a('0xd')]=_[_0xed7a('0xe')](config[_0xed7a('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xed7a('0xf'))(new Redis(config[_0xed7a('0xd')]));require(_0xed7a('0x10'))[_0xed7a('0x11')](socket);function respondWithRpcPromise(_0x1444f9,_0x1fccb6,_0x3f47d6){return new BPromise(function(_0x255fed,_0x4bf284){return client['request'](_0x1444f9,_0x3f47d6)['then'](function(_0x290933){logger[_0xed7a('0x12')](_0xed7a('0x13'),_0x1fccb6,_0xed7a('0x14'));logger[_0xed7a('0x15')](_0xed7a('0x16'),_0x1fccb6,_0xed7a('0x14'),JSON['stringify'](_0x290933));if(_0x290933[_0xed7a('0x17')]){if(_0x290933['error'][_0xed7a('0x18')]===0x1f4){logger[_0xed7a('0x17')](_0xed7a('0x13'),_0x1fccb6,_0x290933[_0xed7a('0x17')]['message']);return _0x4bf284(_0x290933[_0xed7a('0x17')]['message']);}logger[_0xed7a('0x17')]('Dashboard,\x20%s,\x20%s',_0x1fccb6,_0x290933[_0xed7a('0x17')][_0xed7a('0x19')]);return _0x255fed(_0x290933[_0xed7a('0x17')][_0xed7a('0x19')]);}else{logger[_0xed7a('0x12')](_0xed7a('0x13'),_0x1fccb6,'request\x20sent');_0x255fed(_0x290933[_0xed7a('0x1a')]['message']);}})['catch'](function(_0x5774cf){logger[_0xed7a('0x17')]('Dashboard,\x20%s,\x20%s',_0x1fccb6,_0x5774cf);_0x4bf284(_0x5774cf);});});} \ No newline at end of file +var _0xc97d=['localhost','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3d9565,_0x5db973){var _0x546f66=function(_0x137352){while(--_0x137352){_0x3d9565['push'](_0x3d9565['shift']());}};_0x546f66(++_0x5db973);}(_0xc97d,0x12a));var _0xdc97=function(_0x46c00f,_0x33cf04){_0x46c00f=_0x46c00f-0x0;var _0x2a6462=_0xc97d[_0x46c00f];return _0x2a6462;};'use strict';var _=require(_0xdc97('0x0'));var util=require(_0xdc97('0x1'));var moment=require(_0xdc97('0x2'));var BPromise=require(_0xdc97('0x3'));var rs=require(_0xdc97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc97('0x5'))['db'];var utils=require(_0xdc97('0x6'));var logger=require('../../config/logger')(_0xdc97('0x7'));var config=require(_0xdc97('0x8'));var jayson=require(_0xdc97('0x9'));var client=jayson[_0xdc97('0xa')][_0xdc97('0xb')]({'port':0x232a});config[_0xdc97('0xc')]=_[_0xdc97('0xd')](config[_0xdc97('0xc')],{'host':_0xdc97('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc97('0xc')]));require('./dashboard.socket')[_0xdc97('0xf')](socket);function respondWithRpcPromise(_0x4da10e,_0x333d32,_0x2096e7){return new BPromise(function(_0x507c67,_0x31bcb8){return client[_0xdc97('0x10')](_0x4da10e,_0x2096e7)[_0xdc97('0x11')](function(_0x28fcb4){logger['info'](_0xdc97('0x12'),_0x333d32,_0xdc97('0x13'));logger['debug'](_0xdc97('0x14'),_0x333d32,'request\x20sent',JSON[_0xdc97('0x15')](_0x28fcb4));if(_0x28fcb4[_0xdc97('0x16')]){if(_0x28fcb4[_0xdc97('0x16')]['code']===0x1f4){logger[_0xdc97('0x16')](_0xdc97('0x12'),_0x333d32,_0x28fcb4[_0xdc97('0x16')][_0xdc97('0x17')]);return _0x31bcb8(_0x28fcb4[_0xdc97('0x16')]['message']);}logger[_0xdc97('0x16')](_0xdc97('0x12'),_0x333d32,_0x28fcb4['error'][_0xdc97('0x17')]);return _0x507c67(_0x28fcb4['error'][_0xdc97('0x17')]);}else{logger['info'](_0xdc97('0x12'),_0x333d32,'request\x20sent');_0x507c67(_0x28fcb4[_0xdc97('0x18')][_0xdc97('0x17')]);}})[_0xdc97('0x19')](function(_0x42f260){logger[_0xdc97('0x16')]('Dashboard,\x20%s,\x20%s',_0x333d32,_0x42f260);_0x31bcb8(_0x42f260);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 3fa2cfe..a956d11 100644 --- a/server/api/dashboard/dashboard.socket.js +++ b/server/api/dashboard/dashboard.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4df2=['./dashboard.events','remove','update','emit','register','length'];(function(_0x3b2370,_0x2d528f){var _0x39b49d=function(_0x513ada){while(--_0x513ada){_0x3b2370['push'](_0x3b2370['shift']());}};_0x39b49d(++_0x2d528f);}(_0x4df2,0x162));var _0x24df=function(_0x2db792,_0x4a13d1){_0x2db792=_0x2db792-0x0;var _0x52c35c=_0x4df2[_0x2db792];return _0x52c35c;};'use strict';var DashboardEvents=require(_0x24df('0x0'));var events=['save',_0x24df('0x1'),_0x24df('0x2')];function createListener(_0x39bcd4,_0x4d7487){return function(_0x3824de){_0x4d7487[_0x24df('0x3')](_0x39bcd4,_0x3824de);};}function removeListener(_0x3af7e2,_0x36890b){return function(){DashboardEvents['removeListener'](_0x3af7e2,_0x36890b);};}exports[_0x24df('0x4')]=function(_0x3d036b){for(var _0x104559=0x0,_0x2c4986=events[_0x24df('0x5')];_0x104559<_0x2c4986;_0x104559++){var _0x29ac19=events[_0x104559];var _0x174c4e=createListener('dashboard:'+_0x29ac19,_0x3d036b);DashboardEvents['on'](_0x29ac19,_0x174c4e);}}; \ No newline at end of file +var _0xbff2=['removeListener','register','length','dashboard:','./dashboard.events','save','update','emit'];(function(_0x2ca765,_0x216da4){var _0x5d20b9=function(_0x1b357d){while(--_0x1b357d){_0x2ca765['push'](_0x2ca765['shift']());}};_0x5d20b9(++_0x216da4);}(_0xbff2,0x194));var _0x2bff=function(_0x2c49c2,_0x470653){_0x2c49c2=_0x2c49c2-0x0;var _0x2e15cf=_0xbff2[_0x2c49c2];return _0x2e15cf;};'use strict';var DashboardEvents=require(_0x2bff('0x0'));var events=[_0x2bff('0x1'),'remove',_0x2bff('0x2')];function createListener(_0x4aaad4,_0x552321){return function(_0xb34fd5){_0x552321[_0x2bff('0x3')](_0x4aaad4,_0xb34fd5);};}function removeListener(_0x37e97c,_0x59e16b){return function(){DashboardEvents[_0x2bff('0x4')](_0x37e97c,_0x59e16b);};}exports[_0x2bff('0x5')]=function(_0x241022){for(var _0x37ed80=0x0,_0x37a7e7=events[_0x2bff('0x6')];_0x37ed80<_0x37a7e7;_0x37ed80++){var _0x1ee59f=events[_0x37ed80];var _0x5eeb30=createListener(_0x2bff('0x7')+_0x1ee59f,_0x241022);DashboardEvents['on'](_0x1ee59f,_0x5eeb30);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index db1d7b9..65aacea 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5458=['../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','destroy','util','express','fs-extra'];(function(_0x4deda6,_0x4277e3){var _0x37c5ee=function(_0x326fea){while(--_0x326fea){_0x4deda6['push'](_0x4deda6['shift']());}};_0x37c5ee(++_0x4277e3);}(_0x5458,0xb1));var _0x8545=function(_0x148506,_0x520090){_0x148506=_0x148506-0x0;var _0x86cfd2=_0x5458[_0x148506];return _0x86cfd2;};'use strict';var multer=require('multer');var util=require(_0x8545('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8545('0x1'));var router=express['Router']();var fs_extra=require(_0x8545('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x8545('0x3'));var config=require(_0x8545('0x4'));var controller=require(_0x8545('0x5'));router[_0x8545('0x6')]('/',auth['isAuthenticated'](),controller[_0x8545('0x7')]);router[_0x8545('0x6')](_0x8545('0x8'),auth[_0x8545('0x9')](),controller[_0x8545('0xa')]);router[_0x8545('0x6')](_0x8545('0xb'),auth[_0x8545('0x9')](),controller[_0x8545('0xc')]);router[_0x8545('0xd')]('/',auth[_0x8545('0x9')](),controller[_0x8545('0xe')]);router[_0x8545('0xd')](_0x8545('0xf'),auth[_0x8545('0x9')](),controller[_0x8545('0x10')]);router[_0x8545('0xd')](_0x8545('0xb'),auth[_0x8545('0x9')](),controller[_0x8545('0x11')]);router[_0x8545('0x12')](_0x8545('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8545('0x8'),auth[_0x8545('0x9')](),controller[_0x8545('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb8e0=['destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','index','get','/:id','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','delete'];(function(_0x21a8b3,_0x92dbb5){var _0x117c35=function(_0x1f1f9b){while(--_0x1f1f9b){_0x21a8b3['push'](_0x21a8b3['shift']());}};_0x117c35(++_0x92dbb5);}(_0xb8e0,0x8c));var _0x0b8e=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0xb8e0[_0x2bddf9];return _0x3f3ae9;};'use strict';var multer=require(_0x0b8e('0x0'));var util=require(_0x0b8e('0x1'));var path=require('path');var timeout=require(_0x0b8e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0b8e('0x3'));var auth=require(_0x0b8e('0x4'));var interaction=require(_0x0b8e('0x5'));var config=require('../../config/environment');var controller=require(_0x0b8e('0x6'));router['get']('/',auth[_0x0b8e('0x7')](),controller[_0x0b8e('0x8')]);router[_0x0b8e('0x9')](_0x0b8e('0xa'),auth[_0x0b8e('0x7')](),controller[_0x0b8e('0xb')]);router['get'](_0x0b8e('0xc'),auth[_0x0b8e('0x7')](),controller[_0x0b8e('0xd')]);router[_0x0b8e('0xe')]('/',auth[_0x0b8e('0x7')](),controller['create']);router['post'](_0x0b8e('0xf'),auth[_0x0b8e('0x7')](),controller[_0x0b8e('0x10')]);router[_0x0b8e('0xe')]('/:id/items',auth['isAuthenticated'](),controller[_0x0b8e('0x11')]);router[_0x0b8e('0x12')](_0x0b8e('0xa'),auth['isAuthenticated'](),controller[_0x0b8e('0x13')]);router[_0x0b8e('0x14')](_0x0b8e('0xa'),auth['isAuthenticated'](),controller[_0x0b8e('0x15')]);module[_0x0b8e('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 07b20b3..aa9d30b 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1883=['stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x1883,0xab));var _0x3188=function(_0xd0d0d,_0x2f28ed){_0xd0d0d=_0xd0d0d-0x0;var _0x1ac444=_0x1883[_0xd0d0d];return _0x1ac444;};'use strict';var Sequelize=require(_0x3188('0x0'));var squel=require(_0x3188('0x1'));var _=require(_0x3188('0x2'));module[_0x3188('0x3')]={'title':{'type':Sequelize[_0x3188('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x3188('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3188('0x5')](_0x3188('0x6')),'get':function(){try{return JSON[_0x3188('0x7')](this[_0x3188('0x8')](_0x3188('0x9')));}catch(_0x345612){return[];}},'set':function(_0x408ae0){try{this[_0x3188('0xa')](_0x3188('0x9'),JSON[_0x3188('0xb')](_0x408ae0));}catch(_0x3e3afb){this['setDataValue'](_0x3188('0x9'),JSON[_0x3188('0xb')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3188('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x3188('0xc')]},'background':{'type':Sequelize[_0x3188('0x4')],'allowNull':![],'defaultValue':_0x3188('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3188('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3188('0x4')]},'titleFontSize':{'type':Sequelize[_0x3188('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0xe2fe=['setDataValue','INTEGER','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify'];(function(_0x1f9184,_0x2fc942){var _0x3a548d=function(_0x5c6020){while(--_0x5c6020){_0x1f9184['push'](_0x1f9184['shift']());}};_0x3a548d(++_0x2fc942);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));var squel=require('squel');var _=require('lodash');module[_0xee2f('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xee2f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xee2f('0x3')](_0xee2f('0x4')),'get':function(){try{return JSON[_0xee2f('0x5')](this[_0xee2f('0x6')]('attrs'));}catch(_0x311a2f){return[];}},'set':function(_0x2b7e7c){try{this['setDataValue'](_0xee2f('0x7'),JSON[_0xee2f('0x8')](_0x2b7e7c));}catch(_0x5a7975){this[_0xee2f('0x9')]('attrs',JSON[_0xee2f('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xee2f('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xee2f('0xa')]},'col':{'type':Sequelize[_0xee2f('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xee2f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 14731e2..516caa9 100644 --- a/server/api/dashboardItem/dashboardItem.controller.js +++ b/server/api/dashboardItem/dashboardItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81c6=['attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','DashboardItem','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','find','catch','type','iframe','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total'];(function(_0x54c629,_0x258b05){var _0x4a8ce9=function(_0x504ee2){while(--_0x504ee2){_0x54c629['push'](_0x54c629['shift']());}};_0x4a8ce9(++_0x258b05);}(_0x81c6,0x1d5));var _0x681c=function(_0x59fffa,_0x5a61db){_0x59fffa=_0x59fffa-0x0;var _0x281d4e=_0x81c6[_0x59fffa];return _0x281d4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x681c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x681c('0x1'));var BPromise=require(_0x681c('0x2'));var Mustache=require(_0x681c('0x3'));var util=require('util');var path=require(_0x681c('0x4'));var sox=require(_0x681c('0x5'));var csv=require(_0x681c('0x6'));var ejs=require(_0x681c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x681c('0x8'));var squel=require(_0x681c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x681c('0xa'));var toCsv=require(_0x681c('0x6'));var querystring=require(_0x681c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x681c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x681c('0xd'));var hardwareService=require(_0x681c('0xe'));var logger=require(_0x681c('0xf'))(_0x681c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x681c('0x11'));var db=require(_0x681c('0x12'))['db'];config[_0x681c('0x13')]=_['defaults'](config[_0x681c('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x681c('0x14'))(new Redis(config['redis']));require(_0x681c('0x15'))[_0x681c('0x16')](socket);function respondWithStatusCode(_0xe8bb4d,_0x416723){_0x416723=_0x416723||0xcc;return function(_0x402aa2){if(_0x402aa2){return _0xe8bb4d[_0x681c('0x17')](_0x416723);}return _0xe8bb4d['status'](_0x416723)[_0x681c('0x18')]();};}function respondWithResult(_0x1135c9,_0x435a4c){_0x435a4c=_0x435a4c||0xc8;return function(_0x5eb8){if(_0x5eb8){return _0x1135c9[_0x681c('0x19')](_0x435a4c)[_0x681c('0x1a')](_0x5eb8);}};}function respondWithFilteredResult(_0x4e7df2,_0xf3c042){return function(_0x42f506){if(_0x42f506){var _0x4a9192=typeof _0xf3c042[_0x681c('0x1b')]==='undefined'&&typeof _0xf3c042[_0x681c('0x1c')]===_0x681c('0x1d');var _0x54d27f=_0x42f506[_0x681c('0x1e')];var _0x4c22c7=_0x4a9192?0x0:_0xf3c042[_0x681c('0x1b')];var _0x11836c=_0x4a9192?_0x42f506[_0x681c('0x1e')]:_0xf3c042[_0x681c('0x1b')]+_0xf3c042[_0x681c('0x1c')];var _0x51d626;if(_0x11836c>=_0x54d27f){_0x11836c=_0x54d27f;_0x51d626=0xc8;}else{_0x51d626=0xce;}_0x4e7df2['status'](_0x51d626);return _0x4e7df2['set'](_0x681c('0x1f'),_0x4c22c7+'-'+_0x11836c+'/'+_0x54d27f)[_0x681c('0x1a')](_0x42f506);}return null;};}function patchUpdates(_0x3adfe3){return function(_0x27b8a0){try{jsonpatch[_0x681c('0x20')](_0x27b8a0,_0x3adfe3,!![]);}catch(_0x29f3fa){return BPromise[_0x681c('0x21')](_0x29f3fa);}return _0x27b8a0[_0x681c('0x22')]();};}function saveUpdates(_0x1b3d2b,_0x397ae3){return function(_0x2be552){if(_0x2be552){return _0x2be552[_0x681c('0x23')](_0x1b3d2b)[_0x681c('0x24')](function(_0x218410){return _0x218410;});}return null;};}function removeEntity(_0x3237ed,_0x228f59){return function(_0x5f352f){if(_0x5f352f){return _0x5f352f[_0x681c('0x25')]()['then'](function(){_0x3237ed[_0x681c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x583499,_0x30c977){return function(_0x17ea7c){if(!_0x17ea7c){_0x583499[_0x681c('0x17')](0x194);}return _0x17ea7c;};}function handleError(_0x2f7772,_0x4c9fd0){_0x4c9fd0=_0x4c9fd0||0x1f4;return function(_0x3b1031){logger[_0x681c('0x26')](_0x3b1031[_0x681c('0x27')]);if(_0x3b1031[_0x681c('0x28')]){delete _0x3b1031[_0x681c('0x28')];}_0x2f7772[_0x681c('0x19')](_0x4c9fd0)[_0x681c('0x29')](_0x3b1031);};}exports['show']=function(_0x3727e6,_0x390be5){var _0x2e783d={'raw':![],'where':{'id':_0x3727e6[_0x681c('0x2a')]['id']}},_0x4af6aa={};_0x4af6aa[_0x681c('0x2b')]=_[_0x681c('0x2c')](db['DashboardItem'][_0x681c('0x2d')]);_0x4af6aa['query']=_['keys'](_0x3727e6[_0x681c('0x2e')]);_0x4af6aa[_0x681c('0x2f')]=_[_0x681c('0x30')](_0x4af6aa['model'],_0x4af6aa[_0x681c('0x2e')]);_0x2e783d['attributes']=_[_0x681c('0x30')](_0x4af6aa['model'],qs['fields'](_0x3727e6['query'][_0x681c('0x31')]));_0x2e783d[_0x681c('0x32')]=_0x2e783d['attributes'][_0x681c('0x33')]?_0x2e783d['attributes']:_0x4af6aa['model'];if(_0x3727e6[_0x681c('0x2e')]['includeAll']){_0x2e783d[_0x681c('0x34')]=[{'all':!![]}];}_0x2e783d=_[_0x681c('0x35')]({},_0x2e783d,_0x3727e6[_0x681c('0x36')]);return db['DashboardItem']['find'](_0x2e783d)[_0x681c('0x24')](handleEntityNotFound(_0x390be5,null))[_0x681c('0x24')](respondWithResult(_0x390be5,null))['catch'](handleError(_0x390be5,null));};exports[_0x681c('0x25')]=function(_0x3a2120,_0x302dab){return db['DashboardItem'][_0x681c('0x37')]({'where':{'id':_0x3a2120[_0x681c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x302dab,null))[_0x681c('0x24')](removeEntity(_0x302dab,null))[_0x681c('0x38')](handleError(_0x302dab,null));};function widgetAttributes(_0x83953c){try{switch(_0x83953c[_0x681c('0x39')]){case _0x681c('0x3a'):return[{'name':'attrUrl','value':_0x83953c['attrUrl']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x0]?_0x83953c['attrs'][0x0][_0x681c('0x3c')]:undefined)||_0x681c('0x3d')}];case'custom':return[{'name':_0x681c('0x3e'),'value':_0x83953c[_0x681c('0x3e')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x0]?_0x83953c[_0x681c('0x3b')][0x0][_0x681c('0x3c')]:undefined)||''}];case _0x681c('0x3f'):return[{'name':_0x681c('0x40'),'value':_0x83953c[_0x681c('0x40')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x0]?_0x83953c[_0x681c('0x3b')][0x0][_0x681c('0x3c')]:undefined)||_0x681c('0x41')},{'name':_0x681c('0x42'),'value':_0x83953c[_0x681c('0x42')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x1]?_0x83953c[_0x681c('0x3b')][0x1][_0x681c('0x3c')]:undefined)||_0x681c('0x43')},{'name':_0x681c('0x44'),'value':_0x83953c[_0x681c('0x44')]||(_0x83953c['attrs']&&_0x83953c[_0x681c('0x3b')][0x2]?_0x83953c['attrs'][0x2]['value']:undefined)||0xc}];case _0x681c('0x45'):return[{'name':_0x681c('0x46'),'value':_0x83953c[_0x681c('0x46')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x0]?_0x83953c[_0x681c('0x3b')][0x0]['value']:undefined)||'total'},{'name':_0x681c('0x47'),'value':_0x83953c[_0x681c('0x47')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x1]?_0x83953c[_0x681c('0x3b')][0x1][_0x681c('0x3c')]:undefined)||[]},{'name':'attrFontSize','value':_0x83953c[_0x681c('0x44')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x2]?_0x83953c['attrs'][0x2][_0x681c('0x3c')]:undefined)||0x14},{'name':'attrChannel','value':_0x83953c[_0x681c('0x48')]||(_0x83953c['attrs']&&_0x83953c['attrs'][0x3]?_0x83953c['attrs'][0x3][_0x681c('0x3c')]:undefined)||_0x681c('0x49')},{'name':_0x681c('0x4a'),'value':_0x83953c['attrEmailAccounts']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x4]?_0x83953c['attrs'][0x4][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4b'),'value':_0x83953c[_0x681c('0x4b')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x5]?_0x83953c[_0x681c('0x3b')][0x5]['value']:undefined)||''},{'name':_0x681c('0x4c'),'value':_0x83953c[_0x681c('0x4c')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x6]?_0x83953c[_0x681c('0x3b')][0x6][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4d'),'value':_0x83953c[_0x681c('0x4d')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x7]?_0x83953c[_0x681c('0x3b')][0x7][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4e'),'value':_0x83953c[_0x681c('0x4e')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x8]?_0x83953c[_0x681c('0x3b')][0x8][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4f'),'value':_0x83953c['attrChatWebsites']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x9]?_0x83953c['attrs'][0x9][_0x681c('0x3c')]:undefined)||''}];case'multibar-chart':case _0x681c('0x50'):return[{'name':_0x681c('0x51'),'value':_0x83953c[_0x681c('0x51')]||(_0x83953c['attrs']&&_0x83953c[_0x681c('0x3b')][0x0]?_0x83953c[_0x681c('0x3b')][0x0]['value']:undefined)||_0x681c('0x52')},{'name':'attrSerie2','value':_0x83953c[_0x681c('0x53')]||(_0x83953c['attrs']&&_0x83953c[_0x681c('0x3b')][0x1]?_0x83953c[_0x681c('0x3b')][0x1]['value']:undefined)||null},{'name':_0x681c('0x54'),'value':_0x83953c['attrSerie3']||(_0x83953c['attrs']&&_0x83953c[_0x681c('0x3b')][0x2]?_0x83953c[_0x681c('0x3b')][0x2][_0x681c('0x3c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x83953c[_0x681c('0x47')]||(_0x83953c['attrs']&&_0x83953c[_0x681c('0x3b')][0x3]?_0x83953c['attrs'][0x3]['value']:undefined)||[]},{'name':_0x681c('0x48'),'value':_0x83953c[_0x681c('0x48')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x4]?_0x83953c['attrs'][0x4][_0x681c('0x3c')]:undefined)||_0x681c('0x49')},{'name':_0x681c('0x4a'),'value':_0x83953c[_0x681c('0x4a')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0x5]?_0x83953c[_0x681c('0x3b')][0x5][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4b'),'value':_0x83953c[_0x681c('0x4b')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x6]?_0x83953c[_0x681c('0x3b')][0x6][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4c'),'value':_0x83953c[_0x681c('0x4c')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x7]?_0x83953c['attrs'][0x7][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4d'),'value':_0x83953c[_0x681c('0x4d')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x8]?_0x83953c['attrs'][0x8][_0x681c('0x3c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x83953c['attrWhatsappAccounts']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x9]?_0x83953c['attrs'][0x9][_0x681c('0x3c')]:undefined)||''},{'name':_0x681c('0x4f'),'value':_0x83953c[_0x681c('0x4f')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c['attrs'][0xa]?_0x83953c[_0x681c('0x3b')][0xa][_0x681c('0x3c')]:undefined)||''}];case _0x681c('0x55'):return[{'name':_0x681c('0x56'),'type':_0x83953c['reportType']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x0]?_0x83953c[_0x681c('0x3b')][0x0]['type']:undefined)||null,'value':_0x83953c['attrReport']||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x0]?_0x83953c['attrs'][0x0][_0x681c('0x3c')]:undefined)||null},{'name':_0x681c('0x57'),'value':_0x83953c[_0x681c('0x57')]||(_0x83953c[_0x681c('0x3b')]&&_0x83953c[_0x681c('0x3b')][0x1]?_0x83953c['attrs'][0x1][_0x681c('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x27f4ca){logger[_0x681c('0x26')](_0x681c('0x58'),JSON['stringify'](_0x27f4ca));return[];}}exports[_0x681c('0x59')]=function(_0xf0232,_0x2b0623){if(_0xf0232[_0x681c('0x5a')]){_0xf0232[_0x681c('0x5a')]['attrs']=widgetAttributes(_0xf0232[_0x681c('0x5a')]);}return db[_0x681c('0x5b')]['create'](_0xf0232['body'],{})['then'](respondWithResult(_0x2b0623,0xc9))[_0x681c('0x38')](handleError(_0x2b0623,null));};exports['update']=function(_0x40763f,_0x26e13c){if(_0x40763f[_0x681c('0x5a')]['id']){delete _0x40763f[_0x681c('0x5a')]['id'];}_0x40763f[_0x681c('0x5a')]['attrs']=widgetAttributes(_0x40763f[_0x681c('0x5a')]);return db['DashboardItem']['find']({'where':{'id':_0x40763f[_0x681c('0x2a')]['id']}})[_0x681c('0x24')](handleEntityNotFound(_0x26e13c,null))[_0x681c('0x24')](saveUpdates(_0x40763f['body'],null))[_0x681c('0x24')](respondWithResult(_0x26e13c,null))[_0x681c('0x38')](handleError(_0x26e13c,null));}; \ No newline at end of file +var _0xa899=['keys','DashboardItem','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','params','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','voice','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','update','then','end','error','stack','name','send','show','model'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0xa899,0x155));var _0x9a89=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0xa899[_0x15a634];return _0xf4f7a0;};'use strict';var emlformat=require(_0x9a89('0x0'));var rimraf=require(_0x9a89('0x1'));var zipdir=require(_0x9a89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a89('0x3'));var moment=require(_0x9a89('0x4'));var BPromise=require(_0x9a89('0x5'));var Mustache=require(_0x9a89('0x6'));var util=require(_0x9a89('0x7'));var path=require(_0x9a89('0x8'));var sox=require(_0x9a89('0x9'));var csv=require(_0x9a89('0xa'));var ejs=require(_0x9a89('0xb'));var fs=require('fs');var fs_extra=require(_0x9a89('0xc'));var _=require(_0x9a89('0xd'));var squel=require(_0x9a89('0xe'));var crypto=require(_0x9a89('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9a89('0xa'));var querystring=require(_0x9a89('0x10'));var Papa=require('papaparse');var Redis=require(_0x9a89('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9a89('0x12'));var as=require(_0x9a89('0x13'));var hardwareService=require(_0x9a89('0x14'));var logger=require(_0x9a89('0x15'))(_0x9a89('0x16'));var utils=require(_0x9a89('0x17'));var config=require(_0x9a89('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9a89('0x19')]=_[_0x9a89('0x1a')](config[_0x9a89('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9a89('0x1b'))[_0x9a89('0x1c')](socket);function respondWithStatusCode(_0x5720a2,_0x187616){_0x187616=_0x187616||0xcc;return function(_0x427569){if(_0x427569){return _0x5720a2[_0x9a89('0x1d')](_0x187616);}return _0x5720a2[_0x9a89('0x1e')](_0x187616)['end']();};}function respondWithResult(_0x11a933,_0x3fe542){_0x3fe542=_0x3fe542||0xc8;return function(_0x5adef3){if(_0x5adef3){return _0x11a933['status'](_0x3fe542)[_0x9a89('0x1f')](_0x5adef3);}};}function respondWithFilteredResult(_0x4a15f1,_0xba2eaa){return function(_0x334725){if(_0x334725){var _0x53db7f=typeof _0xba2eaa[_0x9a89('0x20')]==='undefined'&&typeof _0xba2eaa[_0x9a89('0x21')]===_0x9a89('0x22');var _0x54c45d=_0x334725[_0x9a89('0x23')];var _0x3759cb=_0x53db7f?0x0:_0xba2eaa[_0x9a89('0x20')];var _0x1619e0=_0x53db7f?_0x334725[_0x9a89('0x23')]:_0xba2eaa[_0x9a89('0x20')]+_0xba2eaa[_0x9a89('0x21')];var _0x1548db;if(_0x1619e0>=_0x54c45d){_0x1619e0=_0x54c45d;_0x1548db=0xc8;}else{_0x1548db=0xce;}_0x4a15f1['status'](_0x1548db);return _0x4a15f1['set'](_0x9a89('0x24'),_0x3759cb+'-'+_0x1619e0+'/'+_0x54c45d)[_0x9a89('0x1f')](_0x334725);}return null;};}function patchUpdates(_0xea8910){return function(_0x2e83aa){try{jsonpatch[_0x9a89('0x25')](_0x2e83aa,_0xea8910,!![]);}catch(_0x3cc288){return BPromise['reject'](_0x3cc288);}return _0x2e83aa['save']();};}function saveUpdates(_0x42c5ee,_0x4f99e9){return function(_0x3f5723){if(_0x3f5723){return _0x3f5723[_0x9a89('0x26')](_0x42c5ee)[_0x9a89('0x27')](function(_0x3b1807){return _0x3b1807;});}return null;};}function removeEntity(_0x423a1d,_0x35032a){return function(_0x3ab9e5){if(_0x3ab9e5){return _0x3ab9e5['destroy']()[_0x9a89('0x27')](function(){_0x423a1d['status'](0xcc)[_0x9a89('0x28')]();});}};}function handleEntityNotFound(_0x5a888b,_0x5817e4){return function(_0x340999){if(!_0x340999){_0x5a888b[_0x9a89('0x1d')](0x194);}return _0x340999;};}function handleError(_0x4aa0b1,_0x11c397){_0x11c397=_0x11c397||0x1f4;return function(_0x5abe70){logger[_0x9a89('0x29')](_0x5abe70[_0x9a89('0x2a')]);if(_0x5abe70[_0x9a89('0x2b')]){delete _0x5abe70[_0x9a89('0x2b')];}_0x4aa0b1[_0x9a89('0x1e')](_0x11c397)[_0x9a89('0x2c')](_0x5abe70);};}exports[_0x9a89('0x2d')]=function(_0x5e5751,_0x4df9f2){var _0x48f05d={'raw':![],'where':{'id':_0x5e5751['params']['id']}},_0x44e2fd={};_0x44e2fd[_0x9a89('0x2e')]=_[_0x9a89('0x2f')](db[_0x9a89('0x30')]['rawAttributes']);_0x44e2fd[_0x9a89('0x31')]=_['keys'](_0x5e5751[_0x9a89('0x31')]);_0x44e2fd[_0x9a89('0x32')]=_[_0x9a89('0x33')](_0x44e2fd[_0x9a89('0x2e')],_0x44e2fd[_0x9a89('0x31')]);_0x48f05d['attributes']=_[_0x9a89('0x33')](_0x44e2fd[_0x9a89('0x2e')],qs[_0x9a89('0x34')](_0x5e5751[_0x9a89('0x31')][_0x9a89('0x34')]));_0x48f05d[_0x9a89('0x35')]=_0x48f05d[_0x9a89('0x35')][_0x9a89('0x36')]?_0x48f05d[_0x9a89('0x35')]:_0x44e2fd['model'];if(_0x5e5751[_0x9a89('0x31')][_0x9a89('0x37')]){_0x48f05d[_0x9a89('0x38')]=[{'all':!![]}];}_0x48f05d=_[_0x9a89('0x39')]({},_0x48f05d,_0x5e5751[_0x9a89('0x3a')]);return db[_0x9a89('0x30')][_0x9a89('0x3b')](_0x48f05d)[_0x9a89('0x27')](handleEntityNotFound(_0x4df9f2,null))[_0x9a89('0x27')](respondWithResult(_0x4df9f2,null))[_0x9a89('0x3c')](handleError(_0x4df9f2,null));};exports['destroy']=function(_0x587f4d,_0x45d51e){return db[_0x9a89('0x30')][_0x9a89('0x3b')]({'where':{'id':_0x587f4d[_0x9a89('0x3d')]['id']}})[_0x9a89('0x27')](handleEntityNotFound(_0x45d51e,null))[_0x9a89('0x27')](removeEntity(_0x45d51e,null))[_0x9a89('0x3c')](handleError(_0x45d51e,null));};function widgetAttributes(_0x18f4bb){try{switch(_0x18f4bb[_0x9a89('0x3e')]){case _0x9a89('0x3f'):return[{'name':_0x9a89('0x40'),'value':_0x18f4bb['attrUrl']||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0][_0x9a89('0x42')]:undefined)||_0x9a89('0x43')}];case _0x9a89('0x44'):return[{'name':_0x9a89('0x45'),'value':_0x18f4bb[_0x9a89('0x45')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0]['value']:undefined)||''}];case _0x9a89('0x46'):return[{'name':_0x9a89('0x47'),'value':_0x18f4bb[_0x9a89('0x47')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x0]?_0x18f4bb['attrs'][0x0][_0x9a89('0x42')]:undefined)||'HH:mm:ss'},{'name':_0x9a89('0x48'),'value':_0x18f4bb[_0x9a89('0x48')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x1]?_0x18f4bb[_0x9a89('0x41')][0x1][_0x9a89('0x42')]:undefined)||_0x9a89('0x49')},{'name':_0x9a89('0x4a'),'value':_0x18f4bb['attrFontSize']||(_0x18f4bb['attrs']&&_0x18f4bb['attrs'][0x2]?_0x18f4bb[_0x9a89('0x41')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x9a89('0x4b'),'value':_0x18f4bb[_0x9a89('0x4b')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0]['value']:undefined)||_0x9a89('0x4c')},{'name':'attrVoiceQueues','value':_0x18f4bb[_0x9a89('0x4d')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x1]?_0x18f4bb['attrs'][0x1][_0x9a89('0x42')]:undefined)||[]},{'name':_0x9a89('0x4a'),'value':_0x18f4bb[_0x9a89('0x4a')]||(_0x18f4bb['attrs']&&_0x18f4bb['attrs'][0x2]?_0x18f4bb[_0x9a89('0x41')][0x2]['value']:undefined)||0x14},{'name':_0x9a89('0x4e'),'value':_0x18f4bb[_0x9a89('0x4e')]||(_0x18f4bb['attrs']&&_0x18f4bb[_0x9a89('0x41')][0x3]?_0x18f4bb[_0x9a89('0x41')][0x3]['value']:undefined)||'voice'},{'name':_0x9a89('0x4f'),'value':_0x18f4bb[_0x9a89('0x4f')]||(_0x18f4bb['attrs']&&_0x18f4bb[_0x9a89('0x41')][0x4]?_0x18f4bb['attrs'][0x4][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x50'),'value':_0x18f4bb[_0x9a89('0x50')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x5]?_0x18f4bb['attrs'][0x5][_0x9a89('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x18f4bb[_0x9a89('0x51')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x6]?_0x18f4bb[_0x9a89('0x41')][0x6][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x52'),'value':_0x18f4bb[_0x9a89('0x52')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x7]?_0x18f4bb[_0x9a89('0x41')][0x7][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x53'),'value':_0x18f4bb[_0x9a89('0x53')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x8]?_0x18f4bb[_0x9a89('0x41')][0x8][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x54'),'value':_0x18f4bb['attrChatWebsites']||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x9]?_0x18f4bb['attrs'][0x9]['value']:undefined)||''}];case _0x9a89('0x55'):case _0x9a89('0x56'):return[{'name':_0x9a89('0x57'),'value':_0x18f4bb['attrSerie1']||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0]['value']:undefined)||_0x9a89('0x4c')},{'name':'attrSerie2','value':_0x18f4bb[_0x9a89('0x58')]||(_0x18f4bb['attrs']&&_0x18f4bb['attrs'][0x1]?_0x18f4bb[_0x9a89('0x41')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x18f4bb['attrSerie3']||(_0x18f4bb['attrs']&&_0x18f4bb['attrs'][0x2]?_0x18f4bb['attrs'][0x2][_0x9a89('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x18f4bb[_0x9a89('0x4d')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x3]?_0x18f4bb[_0x9a89('0x41')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x18f4bb[_0x9a89('0x4e')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x4]?_0x18f4bb[_0x9a89('0x41')][0x4]['value']:undefined)||_0x9a89('0x59')},{'name':'attrEmailAccounts','value':_0x18f4bb[_0x9a89('0x4f')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x5]?_0x18f4bb[_0x9a89('0x41')][0x5][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x50'),'value':_0x18f4bb[_0x9a89('0x50')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x6]?_0x18f4bb[_0x9a89('0x41')][0x6][_0x9a89('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x18f4bb[_0x9a89('0x51')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x7]?_0x18f4bb[_0x9a89('0x41')][0x7][_0x9a89('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x18f4bb['attrOpenchannelAccounts']||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x8]?_0x18f4bb[_0x9a89('0x41')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x18f4bb['attrWhatsappAccounts']||(_0x18f4bb['attrs']&&_0x18f4bb['attrs'][0x9]?_0x18f4bb[_0x9a89('0x41')][0x9][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x54'),'value':_0x18f4bb['attrChatWebsites']||(_0x18f4bb['attrs']&&_0x18f4bb[_0x9a89('0x41')][0xa]?_0x18f4bb['attrs'][0xa]['value']:undefined)||''}];case _0x9a89('0x5a'):return[{'name':'attrReport','type':_0x18f4bb[_0x9a89('0x5b')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0][_0x9a89('0x3e')]:undefined)||null,'value':_0x18f4bb['attrReport']||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0]['value']:undefined)||null},{'name':_0x9a89('0x5c'),'value':_0x18f4bb[_0x9a89('0x5c')]||(_0x18f4bb['attrs']&&_0x18f4bb[_0x9a89('0x41')][0x1]?_0x18f4bb[_0x9a89('0x41')][0x1][_0x9a89('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x5b71e2){logger[_0x9a89('0x29')](_0x9a89('0x5d'),JSON[_0x9a89('0x5e')](_0x5b71e2));return[];}}exports[_0x9a89('0x5f')]=function(_0x5e41f1,_0x46ee8a){if(_0x5e41f1['body']){_0x5e41f1[_0x9a89('0x60')][_0x9a89('0x41')]=widgetAttributes(_0x5e41f1[_0x9a89('0x60')]);}return db[_0x9a89('0x30')][_0x9a89('0x5f')](_0x5e41f1[_0x9a89('0x60')],{})[_0x9a89('0x27')](respondWithResult(_0x46ee8a,0xc9))[_0x9a89('0x3c')](handleError(_0x46ee8a,null));};exports['update']=function(_0x5bad90,_0x2ed99d){if(_0x5bad90['body']['id']){delete _0x5bad90[_0x9a89('0x60')]['id'];}_0x5bad90[_0x9a89('0x60')]['attrs']=widgetAttributes(_0x5bad90['body']);return db[_0x9a89('0x30')][_0x9a89('0x3b')]({'where':{'id':_0x5bad90[_0x9a89('0x3d')]['id']}})[_0x9a89('0x27')](handleEntityNotFound(_0x2ed99d,null))[_0x9a89('0x27')](saveUpdates(_0x5bad90[_0x9a89('0x60')],null))[_0x9a89('0x27')](respondWithResult(_0x2ed99d,null))[_0x9a89('0x3c')](handleError(_0x2ed99d,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a9ea9c4..e6f3a6d 100644 --- a/server/api/dashboardItem/dashboardItem.events.js +++ b/server/api/dashboardItem/dashboardItem.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8e0=['hasOwnProperty','DashboardItem','update','emit'];(function(_0x58cfe6,_0x457d17){var _0x3d18c6=function(_0x457fe0){while(--_0x457fe0){_0x58cfe6['push'](_0x58cfe6['shift']());}};_0x3d18c6(++_0x457d17);}(_0xa8e0,0xad));var _0x0a8e=function(_0x17158c,_0x58cb92){_0x17158c=_0x17158c-0x0;var _0x734f31=_0xa8e0[_0x17158c];return _0x734f31;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x0a8e('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a8e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4698c6){return function(_0x385522,_0xaae85b,_0x7b68c3){DashboardItemEvents[_0x0a8e('0x2')](_0x4698c6+':'+_0x385522['id'],_0x385522);DashboardItemEvents[_0x0a8e('0x2')](_0x4698c6,_0x385522);_0x7b68c3(null);};}for(var e in events){if(events[_0x0a8e('0x3')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x0afd=['exports','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x0afd,0x89));var _0xd0af=function(_0x1d8d09,_0x4fac0a){_0x1d8d09=_0x1d8d09-0x0;var _0xeef3fd=_0x0afd[_0x1d8d09];return _0xeef3fd;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xd0af('0x0'))['db'][_0xd0af('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd0af('0x2')](0x0);var events={'afterCreate':_0xd0af('0x3'),'afterUpdate':'update','afterDestroy':_0xd0af('0x4')};function emitEvent(_0x4ee157){return function(_0x14ad13,_0xb9f1bf,_0x529c41){DashboardItemEvents[_0xd0af('0x5')](_0x4ee157+':'+_0x14ad13['id'],_0x14ad13);DashboardItemEvents[_0xd0af('0x5')](_0x4ee157,_0x14ad13);_0x529c41(null);};}for(var e in events){if(events[_0xd0af('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xd0af('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index c7b4eaf..85568ad 100644 --- a/server/api/dashboardItem/dashboardItem.model.js +++ b/server/api/dashboardItem/dashboardItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7ee=['dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define'];(function(_0x7fb279,_0x4e333a){var _0x4344de=function(_0x25c483){while(--_0x25c483){_0x7fb279['push'](_0x7fb279['shift']());}};_0x4344de(++_0x4e333a);}(_0xa7ee,0x119));var _0xea7e=function(_0x249f8c,_0xfb3946){_0x249f8c=_0x249f8c-0x0;var _0x5e224a=_0xa7ee[_0x249f8c];return _0x5e224a;};'use strict';var _=require(_0xea7e('0x0'));var util=require(_0xea7e('0x1'));var logger=require(_0xea7e('0x2'))(_0xea7e('0x3'));var moment=require(_0xea7e('0x4'));var BPromise=require(_0xea7e('0x5'));var rp=require(_0xea7e('0x6'));var fs=require('fs');var path=require(_0xea7e('0x7'));var rimraf=require(_0xea7e('0x8'));var config=require(_0xea7e('0x9'));var attributes=require(_0xea7e('0xa'));module[_0xea7e('0xb')]=function(_0xc6b99d,_0x3d9e5e){return _0xc6b99d[_0xea7e('0xc')]('DashboardItem',attributes,{'tableName':_0xea7e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2e2=['path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2f2dc2,_0x1718e2){var _0x3d8516=function(_0x170832){while(--_0x170832){_0x2f2dc2['push'](_0x2f2dc2['shift']());}};_0x3d8516(++_0x1718e2);}(_0xd2e2,0xa2));var _0x2d2e=function(_0x3cde58,_0x522de4){_0x3cde58=_0x3cde58-0x0;var _0x115021=_0xd2e2[_0x3cde58];return _0x115021;};'use strict';var _=require(_0x2d2e('0x0'));var util=require(_0x2d2e('0x1'));var logger=require(_0x2d2e('0x2'))(_0x2d2e('0x3'));var moment=require(_0x2d2e('0x4'));var BPromise=require(_0x2d2e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d2e('0x6'));var rimraf=require(_0x2d2e('0x7'));var config=require(_0x2d2e('0x8'));var attributes=require(_0x2d2e('0x9'));module[_0x2d2e('0xa')]=function(_0x55cc13,_0x2adde5){return _0x55cc13[_0x2d2e('0xb')](_0x2d2e('0xc'),attributes,{'tableName':_0x2d2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index ade528e..f1fea10 100644 --- a/server/api/dashboardItem/dashboardItem.rpc.js +++ b/server/api/dashboardItem/dashboardItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc32=['DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','request','then','info'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0xbc32,0xb1));var _0x2bc3=function(_0x24bb24,_0x1e721c){_0x24bb24=_0x24bb24-0x0;var _0x388624=_0xbc32[_0x24bb24];return _0x388624;};'use strict';var _=require('lodash');var util=require(_0x2bc3('0x0'));var moment=require(_0x2bc3('0x1'));var BPromise=require(_0x2bc3('0x2'));var rs=require(_0x2bc3('0x3'));var fs=require('fs');var Redis=require(_0x2bc3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2bc3('0x5'));var logger=require('../../config/logger')(_0x2bc3('0x6'));var config=require(_0x2bc3('0x7'));var jayson=require(_0x2bc3('0x8'));var client=jayson[_0x2bc3('0x9')][_0x2bc3('0xa')]({'port':0x232a});config[_0x2bc3('0xb')]=_[_0x2bc3('0xc')](config[_0x2bc3('0xb')],{'host':_0x2bc3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2bc3('0xe'))[_0x2bc3('0xf')](socket);function respondWithRpcPromise(_0x2a162a,_0x5ec97c,_0x1601e5){return new BPromise(function(_0x5b3903,_0x4466d3){return client[_0x2bc3('0x10')](_0x2a162a,_0x1601e5)[_0x2bc3('0x11')](function(_0x37fafa){logger[_0x2bc3('0x12')](_0x2bc3('0x13'),_0x5ec97c,_0x2bc3('0x14'));logger[_0x2bc3('0x15')](_0x2bc3('0x16'),_0x5ec97c,_0x2bc3('0x14'),JSON[_0x2bc3('0x17')](_0x37fafa));if(_0x37fafa[_0x2bc3('0x18')]){if(_0x37fafa['error']['code']===0x1f4){logger[_0x2bc3('0x18')](_0x2bc3('0x13'),_0x5ec97c,_0x37fafa[_0x2bc3('0x18')][_0x2bc3('0x19')]);return _0x4466d3(_0x37fafa['error'][_0x2bc3('0x19')]);}logger['error'](_0x2bc3('0x13'),_0x5ec97c,_0x37fafa[_0x2bc3('0x18')]['message']);return _0x5b3903(_0x37fafa[_0x2bc3('0x18')][_0x2bc3('0x19')]);}else{logger[_0x2bc3('0x12')](_0x2bc3('0x13'),_0x5ec97c,_0x2bc3('0x14'));_0x5b3903(_0x37fafa[_0x2bc3('0x1a')][_0x2bc3('0x19')]);}})[_0x2bc3('0x1b')](function(_0x520fe7){logger[_0x2bc3('0x18')](_0x2bc3('0x13'),_0x5ec97c,_0x520fe7);_0x4466d3(_0x520fe7);});});} \ No newline at end of file +var _0x7451=['localhost','socket.io-emitter','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis'];(function(_0x718493,_0x485616){var _0x59af54=function(_0x21268d){while(--_0x21268d){_0x718493['push'](_0x718493['shift']());}};_0x59af54(++_0x485616);}(_0x7451,0xe7));var _0x1745=function(_0x3fb673,_0x37ae86){_0x3fb673=_0x3fb673-0x0;var _0x15fe73=_0x7451[_0x3fb673];return _0x15fe73;};'use strict';var _=require(_0x1745('0x0'));var util=require('util');var moment=require(_0x1745('0x1'));var BPromise=require(_0x1745('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1745('0x3'));var db=require(_0x1745('0x4'))['db'];var utils=require(_0x1745('0x5'));var logger=require(_0x1745('0x6'))(_0x1745('0x7'));var config=require(_0x1745('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1745('0x9')]({'port':0x232a});config['redis']=_[_0x1745('0xa')](config[_0x1745('0xb')],{'host':_0x1745('0xc'),'port':0x18eb});var socket=require(_0x1745('0xd'))(new Redis(config[_0x1745('0xb')]));require(_0x1745('0xe'))[_0x1745('0xf')](socket);function respondWithRpcPromise(_0x9bf12a,_0x4b3f30,_0x2eb136){return new BPromise(function(_0x585227,_0x4ef1f6){return client[_0x1745('0x10')](_0x9bf12a,_0x2eb136)['then'](function(_0x455ee4){logger['info'](_0x1745('0x11'),_0x4b3f30,_0x1745('0x12'));logger[_0x1745('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4b3f30,_0x1745('0x12'),JSON[_0x1745('0x14')](_0x455ee4));if(_0x455ee4[_0x1745('0x15')]){if(_0x455ee4['error'][_0x1745('0x16')]===0x1f4){logger[_0x1745('0x15')]('DashboardItem,\x20%s,\x20%s',_0x4b3f30,_0x455ee4[_0x1745('0x15')][_0x1745('0x17')]);return _0x4ef1f6(_0x455ee4['error']['message']);}logger['error'](_0x1745('0x11'),_0x4b3f30,_0x455ee4[_0x1745('0x15')][_0x1745('0x17')]);return _0x585227(_0x455ee4[_0x1745('0x15')][_0x1745('0x17')]);}else{logger[_0x1745('0x18')](_0x1745('0x11'),_0x4b3f30,_0x1745('0x12'));_0x585227(_0x455ee4[_0x1745('0x19')][_0x1745('0x17')]);}})[_0x1745('0x1a')](function(_0x5dac1b){logger[_0x1745('0x15')](_0x1745('0x11'),_0x4b3f30,_0x5dac1b);_0x4ef1f6(_0x5dac1b);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 1c96e15..a1cee82 100644 --- a/server/api/dashboardItem/dashboardItem.socket.js +++ b/server/api/dashboardItem/dashboardItem.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb37e=['removeListener','register','length','dashboardItem:','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb37e,0x14c));var _0xeb37=function(_0x259035,_0x5720fe){_0x259035=_0x259035-0x0;var _0x5cd0b3=_0xb37e[_0x259035];return _0x5cd0b3;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xeb37('0x0'),_0xeb37('0x1'),_0xeb37('0x2')];function createListener(_0x54eeaf,_0x1dda1b){return function(_0x39f382){_0x1dda1b[_0xeb37('0x3')](_0x54eeaf,_0x39f382);};}function removeListener(_0x5c78fa,_0x2c8220){return function(){DashboardItemEvents[_0xeb37('0x4')](_0x5c78fa,_0x2c8220);};}exports[_0xeb37('0x5')]=function(_0x1dbf41){for(var _0x4c561b=0x0,_0x14ceaa=events[_0xeb37('0x6')];_0x4c561b<_0x14ceaa;_0x4c561b++){var _0x1b1a94=events[_0x4c561b];var _0xfe42c2=createListener(_0xeb37('0x7')+_0x1b1a94,_0x1dbf41);DashboardItemEvents['on'](_0x1b1a94,_0xfe42c2);}}; \ No newline at end of file +var _0x53aa=['./dashboardItem.events','remove'];(function(_0x2daa9a,_0x4c6870){var _0x487ec0=function(_0x15a6b0){while(--_0x15a6b0){_0x2daa9a['push'](_0x2daa9a['shift']());}};_0x487ec0(++_0x4c6870);}(_0x53aa,0x76));var _0xa53a=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x53aa[_0x176329];return _0x31997c;};'use strict';var DashboardItemEvents=require(_0xa53a('0x0'));var events=['save',_0xa53a('0x1'),'update'];function createListener(_0x186d08,_0x5b465c){return function(_0xaba33f){_0x5b465c['emit'](_0x186d08,_0xaba33f);};}function removeListener(_0x2f7f04,_0x311fe1){return function(){DashboardItemEvents['removeListener'](_0x2f7f04,_0x311fe1);};}exports['register']=function(_0x539544){for(var _0x3d2793=0x0,_0xd5d7ce=events['length'];_0x3d2793<_0xd5d7ce;_0x3d2793++){var _0x1eebab=events[_0x3d2793];var _0x1b290e=createListener('dashboardItem:'+_0x1eebab,_0x539544);DashboardItemEvents['on'](_0x1eebab,_0x1b290e);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 2a63cdf..ca971f2 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0df0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','post','isAuthenticated','create','update','delete','connect-timeout','express'];(function(_0x2330c5,_0x5ddb84){var _0x48133d=function(_0xda2dcd){while(--_0xda2dcd){_0x2330c5['push'](_0x2330c5['shift']());}};_0x48133d(++_0x5ddb84);}(_0x0df0,0x7c));var _0x00df=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0x0df0[_0x4953da];return _0x2d3780;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x00df('0x0'));var express=require(_0x00df('0x1'));var router=express['Router']();var fs_extra=require(_0x00df('0x2'));var auth=require(_0x00df('0x3'));var interaction=require(_0x00df('0x4'));var config=require(_0x00df('0x5'));var controller=require('./dashboardItem.controller');router[_0x00df('0x6')](_0x00df('0x7'),auth['isAuthenticated'](),controller[_0x00df('0x8')]);router[_0x00df('0x9')]('/',auth[_0x00df('0xa')](),controller[_0x00df('0xb')]);router['put'](_0x00df('0x7'),auth['isAuthenticated'](),controller[_0x00df('0xc')]);router[_0x00df('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x16f3=['connect-timeout','express','Router','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xe51e1e,_0x2a2559){var _0x2d04ab=function(_0x2dab4a){while(--_0x2dab4a){_0xe51e1e['push'](_0xe51e1e['shift']());}};_0x2d04ab(++_0x2a2559);}(_0x16f3,0x10d));var _0x316f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16f3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x316f('0x0'));var util=require(_0x316f('0x1'));var path=require(_0x316f('0x2'));var timeout=require(_0x316f('0x3'));var express=require(_0x316f('0x4'));var router=express[_0x316f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x316f('0x6'));router[_0x316f('0x7')](_0x316f('0x8'),auth[_0x316f('0x9')](),controller['show']);router['post']('/',auth[_0x316f('0x9')](),controller[_0x316f('0xa')]);router[_0x316f('0xb')](_0x316f('0x8'),auth[_0x316f('0x9')](),controller[_0x316f('0xc')]);router[_0x316f('0xd')](_0x316f('0x8'),auth[_0x316f('0x9')](),controller[_0x316f('0xe')]);module[_0x316f('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 2bf3948..967ae5c 100644 --- a/server/api/disposition/disposition.attributes.js +++ b/server/api/disposition/disposition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb517=['second','third','sequelize','STRING','ENUM','first'];(function(_0x21a5dd,_0x17af24){var _0x11dded=function(_0xbe4f1d){while(--_0xbe4f1d){_0x21a5dd['push'](_0x21a5dd['shift']());}};_0x11dded(++_0x17af24);}(_0xb517,0x188));var _0x7b51=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0xb517[_0x5027b1];return _0x4a46cf;};'use strict';var Sequelize=require(_0x7b51('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b51('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x7b51('0x2')](_0x7b51('0x3'),_0x7b51('0x4'),_0x7b51('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x7b51('0x1')]}}; \ No newline at end of file +var _0xc223=['STRING','sequelize','exports','first','third'];(function(_0x13beff,_0x3919f5){var _0x50e34d=function(_0x56c8a3){while(--_0x56c8a3){_0x13beff['push'](_0x13beff['shift']());}};_0x50e34d(++_0x3919f5);}(_0xc223,0x1b9));var _0x3c22=function(_0x8f20de,_0x1a59ed){_0x8f20de=_0x8f20de-0x0;var _0x380167=_0xc223[_0x8f20de];return _0x380167;};'use strict';var Sequelize=require(_0x3c22('0x0'));module[_0x3c22('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x3c22('0x2'),'second',_0x3c22('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x3c22('0x4')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 03f2dc1..e7ffbd1 100644 --- a/server/api/disposition/disposition.controller.js +++ b/server/api/disposition/disposition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x59f2=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','apply','then','destroy','UserProfileResource','sendStatus','error','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x11bb30,_0xd2b70d){var _0x4b64eb=function(_0x42c984){while(--_0x42c984){_0x11bb30['push'](_0x11bb30['shift']());}};_0x4b64eb(++_0xd2b70d);}(_0x59f2,0xb3));var _0x259f=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x59f2[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x259f('0x0'));var rp=require('request-promise');var moment=require(_0x259f('0x1'));var BPromise=require(_0x259f('0x2'));var Mustache=require(_0x259f('0x3'));var util=require(_0x259f('0x4'));var path=require('path');var sox=require(_0x259f('0x5'));var csv=require(_0x259f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x259f('0x7'));var squel=require(_0x259f('0x8'));var crypto=require(_0x259f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x259f('0xa'));var toCsv=require('to-csv');var querystring=require(_0x259f('0xb'));var Papa=require(_0x259f('0xc'));var Redis=require(_0x259f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x259f('0xe'));var as=require(_0x259f('0xf'));var hardwareService=require(_0x259f('0x10'));var logger=require('../../config/logger')(_0x259f('0x11'));var utils=require(_0x259f('0x12'));var config=require(_0x259f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x314e55,_0x31a57f){_0x31a57f=_0x31a57f||0xcc;return function(_0x4d130f){if(_0x4d130f){return _0x314e55['sendStatus'](_0x31a57f);}return _0x314e55[_0x259f('0x14')](_0x31a57f)[_0x259f('0x15')]();};}function respondWithResult(_0x4007d9,_0xea5fa){_0xea5fa=_0xea5fa||0xc8;return function(_0x12a6ef){if(_0x12a6ef){return _0x4007d9[_0x259f('0x14')](_0xea5fa)[_0x259f('0x16')](_0x12a6ef);}};}function respondWithFilteredResult(_0x421c66,_0x4cb8a3){return function(_0x333c38){if(_0x333c38){var _0x447145=typeof _0x4cb8a3[_0x259f('0x17')]===_0x259f('0x18')&&typeof _0x4cb8a3[_0x259f('0x19')]===_0x259f('0x18');var _0x3303ca=_0x333c38[_0x259f('0x1a')];var _0x6daf07=_0x447145?0x0:_0x4cb8a3[_0x259f('0x17')];var _0x39e4ab=_0x447145?_0x333c38[_0x259f('0x1a')]:_0x4cb8a3['offset']+_0x4cb8a3[_0x259f('0x19')];var _0x4343b5;if(_0x39e4ab>=_0x3303ca){_0x39e4ab=_0x3303ca;_0x4343b5=0xc8;}else{_0x4343b5=0xce;}_0x421c66['status'](_0x4343b5);return _0x421c66[_0x259f('0x1b')]('Content-Range',_0x6daf07+'-'+_0x39e4ab+'/'+_0x3303ca)[_0x259f('0x16')](_0x333c38);}return null;};}function patchUpdates(_0x225d21){return function(_0x4d69c4){try{jsonpatch[_0x259f('0x1c')](_0x4d69c4,_0x225d21,!![]);}catch(_0x395a9e){return BPromise['reject'](_0x395a9e);}return _0x4d69c4['save']();};}function saveUpdates(_0x33b646,_0x3832b0){return function(_0x163d83){if(_0x163d83){return _0x163d83['update'](_0x33b646)[_0x259f('0x1d')](function(_0x55a58e){return _0x55a58e;});}return null;};}function removeEntity(_0xb78775,_0x55a9e0){return function(_0x42b578){if(_0x42b578){return _0x42b578[_0x259f('0x1e')]()[_0x259f('0x1d')](function(){var _0x980dea=_0x42b578['get']({'plain':!![]});var _0x23079d='Dispositions';return db[_0x259f('0x1f')][_0x259f('0x1e')]({'where':{'type':_0x23079d,'resourceId':_0x980dea['id']}})['then'](function(){return _0x42b578;});})['then'](function(){_0xb78775[_0x259f('0x14')](0xcc)[_0x259f('0x15')]();});}};}function handleEntityNotFound(_0x4ae0f9,_0x365062){return function(_0x42f9f8){if(!_0x42f9f8){_0x4ae0f9[_0x259f('0x20')](0x194);}return _0x42f9f8;};}function handleError(_0x2f8b8e,_0x53d40e){_0x53d40e=_0x53d40e||0x1f4;return function(_0x4c339b){logger[_0x259f('0x21')](_0x4c339b['stack']);if(_0x4c339b[_0x259f('0x22')]){delete _0x4c339b[_0x259f('0x22')];}_0x2f8b8e['status'](_0x53d40e)[_0x259f('0x23')](_0x4c339b);};}exports[_0x259f('0x24')]=function(_0xb50025,_0x22ef0a){var _0x1b4701={},_0x4d65b1={},_0x19aff7={'count':0x0,'rows':[]};var _0x3d2947=_[_0x259f('0x25')](db[_0x259f('0x26')][_0x259f('0x27')],function(_0x268399){return{'name':_0x268399[_0x259f('0x28')],'type':_0x268399[_0x259f('0x29')][_0x259f('0x2a')]};});_0x4d65b1[_0x259f('0x2b')]=_['map'](_0x3d2947,_0x259f('0x22'));_0x4d65b1[_0x259f('0x2c')]=_['keys'](_0xb50025[_0x259f('0x2c')]);_0x4d65b1[_0x259f('0x2d')]=_[_0x259f('0x2e')](_0x4d65b1[_0x259f('0x2b')],_0x4d65b1[_0x259f('0x2c')]);_0x1b4701[_0x259f('0x2f')]=_[_0x259f('0x2e')](_0x4d65b1[_0x259f('0x2b')],qs[_0x259f('0x30')](_0xb50025[_0x259f('0x2c')][_0x259f('0x30')]));_0x1b4701[_0x259f('0x2f')]=_0x1b4701[_0x259f('0x2f')][_0x259f('0x31')]?_0x1b4701[_0x259f('0x2f')]:_0x4d65b1['model'];if(!_0xb50025[_0x259f('0x2c')][_0x259f('0x32')](_0x259f('0x33'))){_0x1b4701[_0x259f('0x19')]=qs['limit'](_0xb50025[_0x259f('0x2c')][_0x259f('0x19')]);_0x1b4701['offset']=qs[_0x259f('0x17')](_0xb50025['query'][_0x259f('0x17')]);}_0x1b4701['order']=qs['sort'](_0xb50025['query'][_0x259f('0x34')]);_0x1b4701['where']=qs[_0x259f('0x2d')](_['pick'](_0xb50025[_0x259f('0x2c')],_0x4d65b1[_0x259f('0x2d')]),_0x3d2947);if(_0xb50025[_0x259f('0x2c')][_0x259f('0x35')]){_0x1b4701[_0x259f('0x36')]=_[_0x259f('0x37')](_0x1b4701[_0x259f('0x36')],{'$or':_[_0x259f('0x25')](_0x3d2947,function(_0x427e39){if(_0x427e39[_0x259f('0x29')]!==_0x259f('0x38')){var _0x5a724e={};_0x5a724e[_0x427e39['name']]={'$like':'%'+_0xb50025['query'][_0x259f('0x35')]+'%'};return _0x5a724e;}})});}_0x1b4701=_[_0x259f('0x37')]({},_0x1b4701,_0xb50025[_0x259f('0x39')]);var _0x453501={'where':_0x1b4701[_0x259f('0x36')]};return db['Disposition'][_0x259f('0x1a')](_0x453501)[_0x259f('0x1d')](function(_0x5542a1){_0x19aff7[_0x259f('0x1a')]=_0x5542a1;if(_0xb50025[_0x259f('0x2c')][_0x259f('0x3a')]){_0x1b4701[_0x259f('0x3b')]=[{'all':!![]}];}return db['Disposition'][_0x259f('0x3c')](_0x1b4701);})['then'](function(_0x45774b){_0x19aff7['rows']=_0x45774b;return _0x19aff7;})[_0x259f('0x1d')](respondWithFilteredResult(_0x22ef0a,_0x1b4701))['catch'](handleError(_0x22ef0a,null));};exports[_0x259f('0x3d')]=function(_0x14ce8b,_0x236102){var _0x3f77a1={'raw':!![],'where':{'id':_0x14ce8b[_0x259f('0x3e')]['id']}},_0x36999c={};_0x36999c[_0x259f('0x2b')]=_['keys'](db[_0x259f('0x26')][_0x259f('0x27')]);_0x36999c[_0x259f('0x2c')]=_[_0x259f('0x3f')](_0x14ce8b[_0x259f('0x2c')]);_0x36999c[_0x259f('0x2d')]=_['intersection'](_0x36999c[_0x259f('0x2b')],_0x36999c[_0x259f('0x2c')]);_0x3f77a1[_0x259f('0x2f')]=_[_0x259f('0x2e')](_0x36999c[_0x259f('0x2b')],qs['fields'](_0x14ce8b[_0x259f('0x2c')][_0x259f('0x30')]));_0x3f77a1['attributes']=_0x3f77a1[_0x259f('0x2f')][_0x259f('0x31')]?_0x3f77a1[_0x259f('0x2f')]:_0x36999c['model'];if(_0x14ce8b[_0x259f('0x2c')]['includeAll']){_0x3f77a1['include']=[{'all':!![]}];}_0x3f77a1=_[_0x259f('0x37')]({},_0x3f77a1,_0x14ce8b[_0x259f('0x39')]);return db[_0x259f('0x26')][_0x259f('0x40')](_0x3f77a1)[_0x259f('0x1d')](handleEntityNotFound(_0x236102,null))['then'](respondWithResult(_0x236102,null))[_0x259f('0x41')](handleError(_0x236102,null));};exports['create']=function(_0x4f8446,_0x12bef4){return db[_0x259f('0x26')][_0x259f('0x42')](_0x4f8446[_0x259f('0x43')],{})[_0x259f('0x1d')](function(_0xcbcb44){var _0x3deab1=_0x4f8446[_0x259f('0x44')][_0x259f('0x45')]({'plain':!![]});if(!_0x3deab1)throw new Error(_0x259f('0x46'));if(_0x3deab1[_0x259f('0x47')]==='user'){var _0x111ba5=_0xcbcb44['get']({'plain':!![]});var _0x47e8a3='Dispositions';return db[_0x259f('0x48')][_0x259f('0x40')]({'where':{'name':_0x47e8a3,'userProfileId':_0x3deab1[_0x259f('0x49')]},'raw':!![]})[_0x259f('0x1d')](function(_0x1a5fdf){if(_0x1a5fdf&&_0x1a5fdf[_0x259f('0x4a')]===0x0){return db['UserProfileResource'][_0x259f('0x42')]({'name':_0x111ba5[_0x259f('0x22')],'resourceId':_0x111ba5['id'],'type':_0x1a5fdf[_0x259f('0x22')],'sectionId':_0x1a5fdf['id']},{})[_0x259f('0x1d')](function(){return _0xcbcb44;});}else{return _0xcbcb44;}})[_0x259f('0x41')](function(_0x30f531){logger[_0x259f('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30f531);throw _0x30f531;});}return _0xcbcb44;})[_0x259f('0x1d')](respondWithResult(_0x12bef4,0xc9))[_0x259f('0x41')](handleError(_0x12bef4,null));};exports['update']=function(_0x4a65f7,_0x22a97f){if(_0x4a65f7['body']['id']){delete _0x4a65f7[_0x259f('0x43')]['id'];}return db['Disposition'][_0x259f('0x40')]({'where':{'id':_0x4a65f7[_0x259f('0x3e')]['id']}})[_0x259f('0x1d')](handleEntityNotFound(_0x22a97f,null))[_0x259f('0x1d')](saveUpdates(_0x4a65f7[_0x259f('0x43')],null))['then'](respondWithResult(_0x22a97f,null))[_0x259f('0x41')](handleError(_0x22a97f,null));};exports[_0x259f('0x1e')]=function(_0x119814,_0x51f5b8){return db[_0x259f('0x26')][_0x259f('0x40')]({'where':{'id':_0x119814[_0x259f('0x3e')]['id']}})[_0x259f('0x1d')](handleEntityNotFound(_0x51f5b8,null))['then'](removeEntity(_0x51f5b8,null))['catch'](handleError(_0x51f5b8,null));}; \ No newline at end of file +var _0xea98=['Dispositions','end','error','stack','name','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x57c155,_0x5b4161){var _0x5a315b=function(_0x184e8d){while(--_0x184e8d){_0x57c155['push'](_0x57c155['shift']());}};_0x5a315b(++_0x5b4161);}(_0xea98,0xd8));var _0x8ea9=function(_0x22b41b,_0x32b31a){_0x22b41b=_0x22b41b-0x0;var _0x278dff=_0xea98[_0x22b41b];return _0x278dff;};'use strict';var emlformat=require(_0x8ea9('0x0'));var rimraf=require(_0x8ea9('0x1'));var zipdir=require(_0x8ea9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ea9('0x3'));var moment=require(_0x8ea9('0x4'));var BPromise=require(_0x8ea9('0x5'));var Mustache=require(_0x8ea9('0x6'));var util=require('util');var path=require(_0x8ea9('0x7'));var sox=require(_0x8ea9('0x8'));var csv=require(_0x8ea9('0x9'));var ejs=require(_0x8ea9('0xa'));var fs=require('fs');var fs_extra=require(_0x8ea9('0xb'));var _=require(_0x8ea9('0xc'));var squel=require('squel');var crypto=require(_0x8ea9('0xd'));var jsforce=require(_0x8ea9('0xe'));var deskjs=require(_0x8ea9('0xf'));var toCsv=require(_0x8ea9('0x9'));var querystring=require(_0x8ea9('0x10'));var Papa=require('papaparse');var Redis=require(_0x8ea9('0x11'));var authService=require(_0x8ea9('0x12'));var qs=require(_0x8ea9('0x13'));var as=require(_0x8ea9('0x14'));var hardwareService=require(_0x8ea9('0x15'));var logger=require(_0x8ea9('0x16'))(_0x8ea9('0x17'));var utils=require(_0x8ea9('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8ea9('0x19'))['db'];function respondWithStatusCode(_0x34e851,_0x5b8082){_0x5b8082=_0x5b8082||0xcc;return function(_0x46aa9e){if(_0x46aa9e){return _0x34e851[_0x8ea9('0x1a')](_0x5b8082);}return _0x34e851[_0x8ea9('0x1b')](_0x5b8082)['end']();};}function respondWithResult(_0x162b4b,_0x3e55ca){_0x3e55ca=_0x3e55ca||0xc8;return function(_0x5962d0){if(_0x5962d0){return _0x162b4b[_0x8ea9('0x1b')](_0x3e55ca)[_0x8ea9('0x1c')](_0x5962d0);}};}function respondWithFilteredResult(_0x4e1bc8,_0x43b4cf){return function(_0x501fe6){if(_0x501fe6){var _0x3d18f9=typeof _0x43b4cf[_0x8ea9('0x1d')]==='undefined'&&typeof _0x43b4cf[_0x8ea9('0x1e')]===_0x8ea9('0x1f');var _0x4a1d76=_0x501fe6[_0x8ea9('0x20')];var _0x1ff50e=_0x3d18f9?0x0:_0x43b4cf[_0x8ea9('0x1d')];var _0x58cae3=_0x3d18f9?_0x501fe6[_0x8ea9('0x20')]:_0x43b4cf[_0x8ea9('0x1d')]+_0x43b4cf[_0x8ea9('0x1e')];var _0x23e59b;if(_0x58cae3>=_0x4a1d76){_0x58cae3=_0x4a1d76;_0x23e59b=0xc8;}else{_0x23e59b=0xce;}_0x4e1bc8[_0x8ea9('0x1b')](_0x23e59b);return _0x4e1bc8[_0x8ea9('0x21')](_0x8ea9('0x22'),_0x1ff50e+'-'+_0x58cae3+'/'+_0x4a1d76)[_0x8ea9('0x1c')](_0x501fe6);}return null;};}function patchUpdates(_0x2585e3){return function(_0x34e8a8){try{jsonpatch[_0x8ea9('0x23')](_0x34e8a8,_0x2585e3,!![]);}catch(_0x128dda){return BPromise[_0x8ea9('0x24')](_0x128dda);}return _0x34e8a8[_0x8ea9('0x25')]();};}function saveUpdates(_0x1e0d0d,_0x3a067c){return function(_0x5cceac){if(_0x5cceac){return _0x5cceac[_0x8ea9('0x26')](_0x1e0d0d)[_0x8ea9('0x27')](function(_0x20c550){return _0x20c550;});}return null;};}function removeEntity(_0x2f691d,_0x369058){return function(_0x20ef0e){if(_0x20ef0e){return _0x20ef0e[_0x8ea9('0x28')]()[_0x8ea9('0x27')](function(){var _0x18c124=_0x20ef0e[_0x8ea9('0x29')]({'plain':!![]});var _0xd0c891=_0x8ea9('0x2a');return db['UserProfileResource'][_0x8ea9('0x28')]({'where':{'type':_0xd0c891,'resourceId':_0x18c124['id']}})[_0x8ea9('0x27')](function(){return _0x20ef0e;});})[_0x8ea9('0x27')](function(){_0x2f691d[_0x8ea9('0x1b')](0xcc)[_0x8ea9('0x2b')]();});}};}function handleEntityNotFound(_0x3c34a8,_0x36fa02){return function(_0x20ff98){if(!_0x20ff98){_0x3c34a8[_0x8ea9('0x1a')](0x194);}return _0x20ff98;};}function handleError(_0x5c385b,_0x16c783){_0x16c783=_0x16c783||0x1f4;return function(_0x397a28){logger[_0x8ea9('0x2c')](_0x397a28[_0x8ea9('0x2d')]);if(_0x397a28[_0x8ea9('0x2e')]){delete _0x397a28[_0x8ea9('0x2e')];}_0x5c385b[_0x8ea9('0x1b')](_0x16c783)['send'](_0x397a28);};}exports['index']=function(_0x1daa06,_0xeb388a){var _0x21b8e0={},_0x5956d6={},_0x5ae561={'count':0x0,'rows':[]};var _0x158c4e=_[_0x8ea9('0x2f')](db[_0x8ea9('0x30')][_0x8ea9('0x31')],function(_0x4bc043){return{'name':_0x4bc043[_0x8ea9('0x32')],'type':_0x4bc043[_0x8ea9('0x33')][_0x8ea9('0x34')]};});_0x5956d6[_0x8ea9('0x35')]=_['map'](_0x158c4e,_0x8ea9('0x2e'));_0x5956d6[_0x8ea9('0x36')]=_[_0x8ea9('0x37')](_0x1daa06[_0x8ea9('0x36')]);_0x5956d6[_0x8ea9('0x38')]=_[_0x8ea9('0x39')](_0x5956d6['model'],_0x5956d6[_0x8ea9('0x36')]);_0x21b8e0[_0x8ea9('0x3a')]=_[_0x8ea9('0x39')](_0x5956d6['model'],qs[_0x8ea9('0x3b')](_0x1daa06[_0x8ea9('0x36')]['fields']));_0x21b8e0[_0x8ea9('0x3a')]=_0x21b8e0[_0x8ea9('0x3a')][_0x8ea9('0x3c')]?_0x21b8e0['attributes']:_0x5956d6['model'];if(!_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x3d')](_0x8ea9('0x3e'))){_0x21b8e0[_0x8ea9('0x1e')]=qs[_0x8ea9('0x1e')](_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x1e')]);_0x21b8e0['offset']=qs[_0x8ea9('0x1d')](_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x1d')]);}_0x21b8e0[_0x8ea9('0x3f')]=qs[_0x8ea9('0x40')](_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x40')]);_0x21b8e0[_0x8ea9('0x41')]=qs[_0x8ea9('0x38')](_[_0x8ea9('0x42')](_0x1daa06['query'],_0x5956d6[_0x8ea9('0x38')]),_0x158c4e);if(_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x43')]){_0x21b8e0[_0x8ea9('0x41')]=_[_0x8ea9('0x44')](_0x21b8e0['where'],{'$or':_[_0x8ea9('0x2f')](_0x158c4e,function(_0x47ed01){if(_0x47ed01['type']!=='VIRTUAL'){var _0x326b6c={};_0x326b6c[_0x47ed01[_0x8ea9('0x2e')]]={'$like':'%'+_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x43')]+'%'};return _0x326b6c;}})});}_0x21b8e0=_[_0x8ea9('0x44')]({},_0x21b8e0,_0x1daa06['options']);var _0x493a0e={'where':_0x21b8e0['where']};return db['Disposition'][_0x8ea9('0x20')](_0x493a0e)[_0x8ea9('0x27')](function(_0x28a61e){_0x5ae561[_0x8ea9('0x20')]=_0x28a61e;if(_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x45')]){_0x21b8e0[_0x8ea9('0x46')]=[{'all':!![]}];}return db[_0x8ea9('0x30')]['findAll'](_0x21b8e0);})[_0x8ea9('0x27')](function(_0x832edf){_0x5ae561[_0x8ea9('0x47')]=_0x832edf;return _0x5ae561;})[_0x8ea9('0x27')](respondWithFilteredResult(_0xeb388a,_0x21b8e0))[_0x8ea9('0x48')](handleError(_0xeb388a,null));};exports[_0x8ea9('0x49')]=function(_0x212517,_0x1c208a){var _0x32e0d4={'raw':!![],'where':{'id':_0x212517[_0x8ea9('0x4a')]['id']}},_0x5eec31={};_0x5eec31[_0x8ea9('0x35')]=_[_0x8ea9('0x37')](db[_0x8ea9('0x30')][_0x8ea9('0x31')]);_0x5eec31[_0x8ea9('0x36')]=_['keys'](_0x212517[_0x8ea9('0x36')]);_0x5eec31[_0x8ea9('0x38')]=_[_0x8ea9('0x39')](_0x5eec31['model'],_0x5eec31[_0x8ea9('0x36')]);_0x32e0d4['attributes']=_[_0x8ea9('0x39')](_0x5eec31['model'],qs[_0x8ea9('0x3b')](_0x212517['query'][_0x8ea9('0x3b')]));_0x32e0d4[_0x8ea9('0x3a')]=_0x32e0d4[_0x8ea9('0x3a')][_0x8ea9('0x3c')]?_0x32e0d4[_0x8ea9('0x3a')]:_0x5eec31[_0x8ea9('0x35')];if(_0x212517[_0x8ea9('0x36')][_0x8ea9('0x45')]){_0x32e0d4[_0x8ea9('0x46')]=[{'all':!![]}];}_0x32e0d4=_['merge']({},_0x32e0d4,_0x212517[_0x8ea9('0x4b')]);return db[_0x8ea9('0x30')][_0x8ea9('0x4c')](_0x32e0d4)['then'](handleEntityNotFound(_0x1c208a,null))[_0x8ea9('0x27')](respondWithResult(_0x1c208a,null))['catch'](handleError(_0x1c208a,null));};exports[_0x8ea9('0x4d')]=function(_0x11e0f4,_0x390bcf){return db[_0x8ea9('0x30')]['create'](_0x11e0f4['body'],{})[_0x8ea9('0x27')](function(_0x2dcd93){var _0x1ca23d=_0x11e0f4[_0x8ea9('0x4e')][_0x8ea9('0x29')]({'plain':!![]});if(!_0x1ca23d)throw new Error(_0x8ea9('0x4f'));if(_0x1ca23d[_0x8ea9('0x50')]==='user'){var _0x13166c=_0x2dcd93[_0x8ea9('0x29')]({'plain':!![]});var _0x124d11=_0x8ea9('0x2a');return db[_0x8ea9('0x51')][_0x8ea9('0x4c')]({'where':{'name':_0x124d11,'userProfileId':_0x1ca23d[_0x8ea9('0x52')]},'raw':!![]})[_0x8ea9('0x27')](function(_0x199476){if(_0x199476&&_0x199476[_0x8ea9('0x53')]===0x0){return db[_0x8ea9('0x54')][_0x8ea9('0x4d')]({'name':_0x13166c[_0x8ea9('0x2e')],'resourceId':_0x13166c['id'],'type':_0x199476[_0x8ea9('0x2e')],'sectionId':_0x199476['id']},{})[_0x8ea9('0x27')](function(){return _0x2dcd93;});}else{return _0x2dcd93;}})['catch'](function(_0x1fc27a){logger[_0x8ea9('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fc27a);throw _0x1fc27a;});}return _0x2dcd93;})[_0x8ea9('0x27')](respondWithResult(_0x390bcf,0xc9))[_0x8ea9('0x48')](handleError(_0x390bcf,null));};exports['update']=function(_0x3f9a44,_0x547456){if(_0x3f9a44[_0x8ea9('0x55')]['id']){delete _0x3f9a44[_0x8ea9('0x55')]['id'];}return db[_0x8ea9('0x30')][_0x8ea9('0x4c')]({'where':{'id':_0x3f9a44[_0x8ea9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x547456,null))[_0x8ea9('0x27')](saveUpdates(_0x3f9a44['body'],null))[_0x8ea9('0x27')](respondWithResult(_0x547456,null))['catch'](handleError(_0x547456,null));};exports[_0x8ea9('0x28')]=function(_0x5b370a,_0x2c0883){return db[_0x8ea9('0x30')]['find']({'where':{'id':_0x5b370a[_0x8ea9('0x4a')]['id']}})[_0x8ea9('0x27')](handleEntityNotFound(_0x2c0883,null))[_0x8ea9('0x27')](removeEntity(_0x2c0883,null))[_0x8ea9('0x48')](handleError(_0x2c0883,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 0a10067..5fae798 100644 --- a/server/api/disposition/disposition.model.js +++ b/server/api/disposition/disposition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d79=['tools_dispositions','name_voice','name','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./disposition.attributes','exports'];(function(_0x36dd61,_0x12a5bd){var _0x44d8e5=function(_0x1b1d28){while(--_0x1b1d28){_0x36dd61['push'](_0x36dd61['shift']());}};_0x44d8e5(++_0x12a5bd);}(_0x9d79,0x1c5));var _0x99d7=function(_0x18b781,_0x32b5a8){_0x18b781=_0x18b781-0x0;var _0x488920=_0x9d79[_0x18b781];return _0x488920;};'use strict';var _=require(_0x99d7('0x0'));var util=require('util');var logger=require(_0x99d7('0x1'))(_0x99d7('0x2'));var moment=require(_0x99d7('0x3'));var BPromise=require(_0x99d7('0x4'));var rp=require(_0x99d7('0x5'));var fs=require('fs');var path=require(_0x99d7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x99d7('0x7'));module[_0x99d7('0x8')]=function(_0x22f9b7,_0x66399f){return _0x22f9b7['define']('Disposition',attributes,{'tableName':_0x99d7('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x99d7('0xa'),'fields':[_0x99d7('0xb'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x99d7('0xb'),_0x99d7('0xc')]},{'unique':!![],'name':_0x99d7('0xd'),'fields':[_0x99d7('0xb'),'MailAccountId']},{'unique':!![],'name':_0x99d7('0xe'),'fields':[_0x99d7('0xb'),_0x99d7('0xf')]},{'unique':!![],'name':_0x99d7('0x10'),'fields':['name',_0x99d7('0x11')]},{'unique':!![],'name':_0x99d7('0x12'),'fields':[_0x99d7('0xb'),_0x99d7('0x13')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x99d7('0xb'),_0x99d7('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x543f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','Disposition','tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash'];(function(_0x3b4bfb,_0x52a83e){var _0x5a820f=function(_0x3f8b09){while(--_0x3f8b09){_0x3b4bfb['push'](_0x3b4bfb['shift']());}};_0x5a820f(++_0x52a83e);}(_0x543f,0x18f));var _0xf543=function(_0x10837b,_0x3f2838){_0x10837b=_0x10837b-0x0;var _0x1e64b5=_0x543f[_0x10837b];return _0x1e64b5;};'use strict';var _=require(_0xf543('0x0'));var util=require(_0xf543('0x1'));var logger=require(_0xf543('0x2'))(_0xf543('0x3'));var moment=require(_0xf543('0x4'));var BPromise=require(_0xf543('0x5'));var rp=require(_0xf543('0x6'));var fs=require('fs');var path=require(_0xf543('0x7'));var rimraf=require(_0xf543('0x8'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xf543('0x9')]=function(_0x5ccccd,_0x58b240){return _0x5ccccd['define'](_0xf543('0xa'),attributes,{'tableName':_0xf543('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf543('0xc'),'fields':['name',_0xf543('0xd')]},{'unique':!![],'name':_0xf543('0xe'),'fields':[_0xf543('0xf'),_0xf543('0x10')]},{'unique':!![],'name':_0xf543('0x11'),'fields':[_0xf543('0xf'),'MailAccountId']},{'unique':!![],'name':_0xf543('0x12'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xf543('0x13'),'fields':[_0xf543('0xf'),_0xf543('0x14')]},{'unique':!![],'name':_0xf543('0x15'),'fields':[_0xf543('0xf'),_0xf543('0x16')]},{'unique':!![],'name':_0xf543('0x17'),'fields':[_0xf543('0xf'),_0xf543('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f16e9e0..295107e 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2310ca,_0x1d331c){var _0x13fe7b=function(_0x1e5460){while(--_0x1e5460){_0x2310ca['push'](_0x2310ca['shift']());}};_0x13fe7b(++_0x1d331c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b341c,_0x100e51){var _0x36a3fb=function(_0x2ef63d){while(--_0x2ef63d){_0x1b341c['push'](_0x1b341c['shift']());}};_0x36a3fb(++_0x100e51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 31e8af9..3f96b33 100644 --- a/server/api/disposition/index.js +++ b/server/api/disposition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cd5=['multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','create','update','delete','destroy','exports'];(function(_0x22104c,_0x40dcc4){var _0x4ca5ab=function(_0x79450e){while(--_0x79450e){_0x22104c['push'](_0x22104c['shift']());}};_0x4ca5ab(++_0x40dcc4);}(_0x4cd5,0xb4));var _0x54cd=function(_0x8cbc1e,_0x2ab75c){_0x8cbc1e=_0x8cbc1e-0x0;var _0x2e48d4=_0x4cd5[_0x8cbc1e];return _0x2e48d4;};'use strict';var multer=require(_0x54cd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x54cd('0x1'));var express=require(_0x54cd('0x2'));var router=express[_0x54cd('0x3')]();var fs_extra=require(_0x54cd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x54cd('0x5'));var config=require(_0x54cd('0x6'));var controller=require(_0x54cd('0x7'));router[_0x54cd('0x8')]('/',auth[_0x54cd('0x9')](),controller['index']);router[_0x54cd('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x54cd('0x9')](),controller[_0x54cd('0xa')]);router['put']('/:id',auth[_0x54cd('0x9')](),controller[_0x54cd('0xb')]);router[_0x54cd('0xc')]('/:id',auth[_0x54cd('0x9')](),controller[_0x54cd('0xd')]);module[_0x54cd('0xe')]=router; \ No newline at end of file +var _0x43e3=['post','create','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x43e3,0x16b));var _0x343e=function(_0x522bc8,_0x3525bf){_0x522bc8=_0x522bc8-0x0;var _0x5c5ab4=_0x43e3[_0x522bc8];return _0x5c5ab4;};'use strict';var multer=require(_0x343e('0x0'));var util=require('util');var path=require(_0x343e('0x1'));var timeout=require(_0x343e('0x2'));var express=require('express');var router=express[_0x343e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x343e('0x4'));var interaction=require(_0x343e('0x5'));var config=require(_0x343e('0x6'));var controller=require('./disposition.controller');router['get']('/',auth[_0x343e('0x7')](),controller[_0x343e('0x8')]);router[_0x343e('0x9')](_0x343e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x343e('0xb')]('/',auth[_0x343e('0x7')](),controller[_0x343e('0xc')]);router[_0x343e('0xd')](_0x343e('0xa'),auth['isAuthenticated'](),controller[_0x343e('0xe')]);router[_0x343e('0xf')]('/:id',auth[_0x343e('0x7')](),controller['destroy']);module[_0x343e('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index a3fe8fd..fd942c6 100644 --- a/server/api/faxAccount/faxAccount.attributes.js +++ b/server/api/faxAccount/faxAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefd3=['localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x376f2c,_0x2519fc){var _0x586d51=function(_0x4b69f5){while(--_0x4b69f5){_0x376f2c['push'](_0x376f2c['shift']());}};_0x586d51(++_0x2519fc);}(_0xefd3,0x1aa));var _0x3efd=function(_0x32c0b6,_0x1ef4f0){_0x32c0b6=_0x32c0b6-0x0;var _0x3fe26a=_0xefd3[_0x32c0b6];return _0x3fe26a;};'use strict';var Sequelize=require(_0x3efd('0x0'));module[_0x3efd('0x1')]={'name':{'type':Sequelize[_0x3efd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3efd('0x2')]},'ecm':{'type':Sequelize[_0x3efd('0x3')](_0x3efd('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x3efd('0x2')],'defaultValue':_0x3efd('0x5')},'localstationid':{'type':Sequelize[_0x3efd('0x2')],'unique':_0x3efd('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x3efd('0x7'),_0x3efd('0x8'),_0x3efd('0x9'),_0x3efd('0xa'),_0x3efd('0xb'),_0x3efd('0xc')),'defaultValue':_0x3efd('0x8')},'maxrate':{'type':Sequelize[_0x3efd('0x3')]('2400',_0x3efd('0x8'),_0x3efd('0x9'),_0x3efd('0xa'),_0x3efd('0xb'),_0x3efd('0xc')),'defaultValue':_0x3efd('0xc')},'modem':{'type':Sequelize[_0x3efd('0x2')],'defaultValue':_0x3efd('0xd')},'gateway':{'type':Sequelize[_0x3efd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3efd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x3efd('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x3efd('0xf'),'IAX',_0x3efd('0x10'),'KHOMP'),'defaultValue':_0x3efd('0xf')},'key':{'type':Sequelize[_0x3efd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3efd('0x11')],'defaultValue':function(){return _0x3efd('0x12');}},'notificationSound':{'type':Sequelize[_0x3efd('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3efd('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3efd('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3efd('0xe')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3efd('0x13')],'defaultValue':![],'comment':_0x3efd('0x14'),'set':function(_0x107092){if(!_0x107092)this[_0x3efd('0x15')](_0x3efd('0x16'),null);this[_0x3efd('0x15')](_0x3efd('0x17'),_0x107092);}}}; \ No newline at end of file +var _0x59a2=['INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','4800','14400','v17,v27,v29'];(function(_0x7642c,_0x2ec4b0){var _0x5412fd=function(_0xffc8e3){while(--_0xffc8e3){_0x7642c['push'](_0x7642c['shift']());}};_0x5412fd(++_0x2ec4b0);}(_0x59a2,0x12b));var _0x259a=function(_0x3896b6,_0x27450b){_0x3896b6=_0x3896b6-0x0;var _0x4ba030=_0x59a2[_0x3896b6];return _0x4ba030;};'use strict';var Sequelize=require('sequelize');module[_0x259a('0x0')]={'name':{'type':Sequelize[_0x259a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x259a('0x1')]},'ecm':{'type':Sequelize[_0x259a('0x2')](_0x259a('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x259a('0x1')],'defaultValue':_0x259a('0x4')},'localstationid':{'type':Sequelize[_0x259a('0x1')],'unique':_0x259a('0x5')},'minrate':{'type':Sequelize[_0x259a('0x2')](_0x259a('0x6'),'4800',_0x259a('0x7'),_0x259a('0x8'),_0x259a('0x9'),'14400'),'defaultValue':_0x259a('0xa')},'maxrate':{'type':Sequelize[_0x259a('0x2')](_0x259a('0x6'),_0x259a('0xa'),_0x259a('0x7'),_0x259a('0x8'),'12000',_0x259a('0xb')),'defaultValue':_0x259a('0xb')},'modem':{'type':Sequelize[_0x259a('0x1')],'defaultValue':_0x259a('0xc')},'gateway':{'type':Sequelize[_0x259a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x259a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x259a('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x259a('0xe'),_0x259a('0xf'),_0x259a('0x10'),_0x259a('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x259a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x259a('0x12');}},'notificationSound':{'type':Sequelize[_0x259a('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x259a('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x259a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x259a('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x259a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x259a('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x259a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x259a('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x259a('0x14'),'set':function(_0x4e15ef){if(!_0x4e15ef)this[_0x259a('0x15')](_0x259a('0x16'),null);this[_0x259a('0x15')](_0x259a('0x17'),_0x4e15ef);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index eb1afe1..2a2bb82 100644 --- a/server/api/faxAccount/faxAccount.controller.js +++ b/server/api/faxAccount/faxAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20ce=['../../mysqldb','defaults','redis','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','include','removeAnswers','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','internal','Tag','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','exten','localstationid','app','system','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','filename','Messages','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util'];(function(_0x194527,_0x4a0ce8){var _0x310cbf=function(_0x38ed33){while(--_0x38ed33){_0x194527['push'](_0x194527['shift']());}};_0x310cbf(++_0x4a0ce8);}(_0x20ce,0xab));var _0xe20c=function(_0xedd773,_0x5cfdb2){_0xedd773=_0xedd773-0x0;var _0x1eb9f2=_0x20ce[_0xedd773];return _0x1eb9f2;};'use strict';var emlformat=require(_0xe20c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe20c('0x1'));var jsonpatch=require(_0xe20c('0x2'));var rp=require('request-promise');var moment=require(_0xe20c('0x3'));var BPromise=require(_0xe20c('0x4'));var Mustache=require(_0xe20c('0x5'));var util=require(_0xe20c('0x6'));var path=require(_0xe20c('0x7'));var sox=require(_0xe20c('0x8'));var csv=require(_0xe20c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe20c('0xa'));var squel=require(_0xe20c('0xb'));var crypto=require(_0xe20c('0xc'));var jsforce=require(_0xe20c('0xd'));var deskjs=require(_0xe20c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe20c('0xf'));var Papa=require(_0xe20c('0x10'));var Redis=require(_0xe20c('0x11'));var authService=require(_0xe20c('0x12'));var qs=require(_0xe20c('0x13'));var as=require(_0xe20c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe20c('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe20c('0x16'));var db=require(_0xe20c('0x17'))['db'];config['redis']=_[_0xe20c('0x18')](config[_0xe20c('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe20c('0x1a'))(new Redis(config[_0xe20c('0x19')]));require(_0xe20c('0x1b'))[_0xe20c('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe20c('0x1d')][_0xe20c('0x1e')]({'port':0x232c});var client9002=jayson[_0xe20c('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15bca1,_0x1db63e,_0xab2865,_0x19e07a){return new BPromise(function(_0x422fc0,_0x2b0f98){var _0x47d7c5=_0x19e07a||client;return _0x47d7c5[_0xe20c('0x1f')](_0x15bca1,_0xab2865)[_0xe20c('0x20')](function(_0x2161c7){logger['info']('FaxAccount,\x20%s,\x20%s',_0x1db63e,'request\x20sent');logger[_0xe20c('0x21')](_0xe20c('0x22'),_0x1db63e,_0xe20c('0x23'),JSON['stringify'](_0x2161c7));if(_0x2161c7[_0xe20c('0x24')]){if(_0x2161c7['error']['code']===0x1f4){logger[_0xe20c('0x24')](_0xe20c('0x25'),_0x1db63e,_0x2161c7['error']['message']);return _0x2b0f98(_0x2161c7['error']['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x1db63e,_0x2161c7['error'][_0xe20c('0x26')]);return _0x422fc0(_0x2161c7[_0xe20c('0x24')][_0xe20c('0x26')]);}else{logger[_0xe20c('0x27')](_0xe20c('0x25'),_0x1db63e,'request\x20sent');_0x422fc0(_0x2161c7[_0xe20c('0x28')]['message']);}})[_0xe20c('0x29')](function(_0xb5587c){logger[_0xe20c('0x24')](_0xe20c('0x25'),_0x1db63e,_0xb5587c);_0x2b0f98(_0xb5587c);});});}function respondWithStatusCode(_0xed5391,_0x54aa05){_0x54aa05=_0x54aa05||0xcc;return function(_0x3d998e){if(_0x3d998e){return _0xed5391[_0xe20c('0x2a')](_0x54aa05);}return _0xed5391[_0xe20c('0x2b')](_0x54aa05)[_0xe20c('0x2c')]();};}function respondWithResult(_0x1d6d18,_0x397104){_0x397104=_0x397104||0xc8;return function(_0x577608){if(_0x577608){return _0x1d6d18[_0xe20c('0x2b')](_0x397104)[_0xe20c('0x2d')](_0x577608);}};}function respondWithFilteredResult(_0x31b60d,_0x14ad3a){return function(_0x519749){if(_0x519749){var _0x1af0e1=typeof _0x14ad3a[_0xe20c('0x2e')]===_0xe20c('0x2f')&&typeof _0x14ad3a[_0xe20c('0x30')]===_0xe20c('0x2f');var _0x1637d2=_0x519749[_0xe20c('0x31')];var _0x150b72=_0x1af0e1?0x0:_0x14ad3a[_0xe20c('0x2e')];var _0x28dfa0=_0x1af0e1?_0x519749['count']:_0x14ad3a[_0xe20c('0x2e')]+_0x14ad3a[_0xe20c('0x30')];var _0x5163c2;if(_0x28dfa0>=_0x1637d2){_0x28dfa0=_0x1637d2;_0x5163c2=0xc8;}else{_0x5163c2=0xce;}_0x31b60d[_0xe20c('0x2b')](_0x5163c2);return _0x31b60d[_0xe20c('0x32')]('Content-Range',_0x150b72+'-'+_0x28dfa0+'/'+_0x1637d2)['json'](_0x519749);}return null;};}function patchUpdates(_0x14fa08){return function(_0x28d707){try{jsonpatch[_0xe20c('0x33')](_0x28d707,_0x14fa08,!![]);}catch(_0x5e0e31){return BPromise[_0xe20c('0x34')](_0x5e0e31);}return _0x28d707[_0xe20c('0x35')]();};}function saveUpdates(_0x362d80,_0x1eee88){return function(_0x696af1){if(_0x696af1){return _0x696af1[_0xe20c('0x36')](_0x362d80)['then'](function(_0x9414){return _0x9414;});}return null;};}function removeEntity(_0x268203,_0x35c416){return function(_0xb515b3){if(_0xb515b3){return _0xb515b3[_0xe20c('0x37')]()[_0xe20c('0x20')](function(){var _0x336543=_0xb515b3[_0xe20c('0x38')]({'plain':!![]});var _0x520bb7='FaxAccounts';return db['UserProfileResource'][_0xe20c('0x37')]({'where':{'type':_0x520bb7,'resourceId':_0x336543['id']}})[_0xe20c('0x20')](function(){return _0xb515b3;});})[_0xe20c('0x20')](function(){_0x268203[_0xe20c('0x2b')](0xcc)[_0xe20c('0x2c')]();});}};}function handleEntityNotFound(_0x52e06b,_0x4f6416){return function(_0x1aea96){if(!_0x1aea96){_0x52e06b[_0xe20c('0x2a')](0x194);}return _0x1aea96;};}function handleError(_0x6aa286,_0x2c1480){_0x2c1480=_0x2c1480||0x1f4;return function(_0x5df2aa){logger['error'](_0x5df2aa[_0xe20c('0x39')]);if(_0x5df2aa[_0xe20c('0x3a')]){delete _0x5df2aa[_0xe20c('0x3a')];}_0x6aa286[_0xe20c('0x2b')](_0x2c1480)[_0xe20c('0x3b')](_0x5df2aa);};}exports[_0xe20c('0x3c')]=function(_0x950e8,_0x260db1){var _0x3846f9={'include':[{'model':db[_0xe20c('0x3d')],'as':_0xe20c('0x3e')}]},_0x50889d={},_0x55780b={'count':0x0,'rows':[]};var _0x73a3d0=_[_0xe20c('0x3f')](db[_0xe20c('0x40')][_0xe20c('0x41')],function(_0x594726){return{'name':_0x594726[_0xe20c('0x42')],'type':_0x594726[_0xe20c('0x43')][_0xe20c('0x44')]};});_0x50889d[_0xe20c('0x45')]=_['map'](_0x73a3d0,_0xe20c('0x3a'));_0x50889d[_0xe20c('0x46')]=_[_0xe20c('0x47')](_0x950e8['query']);_0x50889d[_0xe20c('0x48')]=_['intersection'](_0x50889d[_0xe20c('0x45')],_0x50889d['query']);_0x3846f9[_0xe20c('0x49')]=_[_0xe20c('0x4a')](_0x50889d[_0xe20c('0x45')],qs[_0xe20c('0x4b')](_0x950e8[_0xe20c('0x46')][_0xe20c('0x4b')]));_0x3846f9['attributes']=_0x3846f9['attributes'][_0xe20c('0x4c')]?_0x3846f9[_0xe20c('0x49')]:_0x50889d[_0xe20c('0x45')];if(!_0x950e8['query']['hasOwnProperty'](_0xe20c('0x4d'))){_0x3846f9['limit']=qs[_0xe20c('0x30')](_0x950e8[_0xe20c('0x46')][_0xe20c('0x30')]);_0x3846f9[_0xe20c('0x2e')]=qs[_0xe20c('0x2e')](_0x950e8[_0xe20c('0x46')][_0xe20c('0x2e')]);}_0x3846f9[_0xe20c('0x4e')]=qs[_0xe20c('0x4f')](_0x950e8[_0xe20c('0x46')]['sort']);_0x3846f9[_0xe20c('0x50')]=qs['filters'](_[_0xe20c('0x51')](_0x950e8[_0xe20c('0x46')],_0x50889d[_0xe20c('0x48')]),_0x73a3d0);if(_0x950e8[_0xe20c('0x46')][_0xe20c('0x52')]){_0x3846f9['where']=_['merge'](_0x3846f9[_0xe20c('0x50')],{'$or':_[_0xe20c('0x3f')](_0x73a3d0,function(_0x96043d){if(_0x96043d[_0xe20c('0x43')]!==_0xe20c('0x53')){var _0x1ef514={};_0x1ef514[_0x96043d[_0xe20c('0x3a')]]={'$like':'%'+_0x950e8['query'][_0xe20c('0x52')]+'%'};return _0x1ef514;}})});}_0x3846f9=_[_0xe20c('0x54')]({},_0x3846f9,_0x950e8[_0xe20c('0x55')]);var _0x8e74ad={'where':_0x3846f9[_0xe20c('0x50')]};return db['FaxAccount'][_0xe20c('0x31')](_0x8e74ad)[_0xe20c('0x20')](function(_0x217b46){_0x55780b[_0xe20c('0x31')]=_0x217b46;if(_0x950e8[_0xe20c('0x46')][_0xe20c('0x56')]){_0x3846f9['include']=[{'all':!![]}];}return db[_0xe20c('0x40')]['findAll'](_0x3846f9);})[_0xe20c('0x20')](function(_0x216ae2){_0x55780b[_0xe20c('0x57')]=_0x216ae2;return _0x55780b;})[_0xe20c('0x20')](respondWithFilteredResult(_0x260db1,_0x3846f9))[_0xe20c('0x29')](handleError(_0x260db1,null));};exports[_0xe20c('0x58')]=function(_0x22e220,_0x153061){var _0x20e3f1={'raw':![],'where':{'id':_0x22e220[_0xe20c('0x59')]['id']},'include':[{'model':db[_0xe20c('0x3d')],'as':_0xe20c('0x3e')}]},_0x5db145={};_0x5db145['model']=_[_0xe20c('0x47')](db[_0xe20c('0x40')][_0xe20c('0x41')]);_0x5db145[_0xe20c('0x46')]=_['keys'](_0x22e220[_0xe20c('0x46')]);_0x5db145['filters']=_[_0xe20c('0x4a')](_0x5db145[_0xe20c('0x45')],_0x5db145['query']);_0x20e3f1[_0xe20c('0x49')]=_['intersection'](_0x5db145[_0xe20c('0x45')],qs[_0xe20c('0x4b')](_0x22e220[_0xe20c('0x46')][_0xe20c('0x4b')]));_0x20e3f1[_0xe20c('0x49')]=_0x20e3f1['attributes'][_0xe20c('0x4c')]?_0x20e3f1[_0xe20c('0x49')]:_0x5db145[_0xe20c('0x45')];if(_0x22e220['query'][_0xe20c('0x56')]){_0x20e3f1['include']=[{'all':!![]}];}_0x20e3f1=_[_0xe20c('0x54')]({},_0x20e3f1,_0x22e220[_0xe20c('0x55')]);return db['FaxAccount'][_0xe20c('0x5a')](_0x20e3f1)[_0xe20c('0x20')](handleEntityNotFound(_0x153061,null))[_0xe20c('0x20')](respondWithResult(_0x153061,null))[_0xe20c('0x29')](handleError(_0x153061,null));};exports[_0xe20c('0x5b')]=function(_0x1ba6da,_0x4b4415){return db[_0xe20c('0x40')][_0xe20c('0x5b')](_0x1ba6da[_0xe20c('0x5c')],{})[_0xe20c('0x20')](function(_0x32fe88){var _0x5547f6=_0x1ba6da[_0xe20c('0x5d')][_0xe20c('0x38')]({'plain':!![]});if(!_0x5547f6)throw new Error(_0xe20c('0x5e'));if(_0x5547f6[_0xe20c('0x5f')]===_0xe20c('0x5d')){var _0x51f9e3=_0x32fe88[_0xe20c('0x38')]({'plain':!![]});var _0x3d591b=_0xe20c('0x60');return db['UserProfileSection'][_0xe20c('0x5a')]({'where':{'name':_0x3d591b,'userProfileId':_0x5547f6[_0xe20c('0x61')]},'raw':!![]})[_0xe20c('0x20')](function(_0x9c7299){if(_0x9c7299&&_0x9c7299['autoAssociation']===0x0){return db[_0xe20c('0x62')][_0xe20c('0x5b')]({'name':_0x51f9e3['name'],'resourceId':_0x51f9e3['id'],'type':_0x9c7299[_0xe20c('0x3a')],'sectionId':_0x9c7299['id']},{})[_0xe20c('0x20')](function(){return _0x32fe88;});}else{return _0x32fe88;}})['catch'](function(_0x3f289b){logger[_0xe20c('0x24')](_0xe20c('0x63'),_0x3f289b);throw _0x3f289b;});}return _0x32fe88;})[_0xe20c('0x20')](respondWithResult(_0x4b4415,0xc9))[_0xe20c('0x29')](handleError(_0x4b4415,null));};exports[_0xe20c('0x36')]=function(_0x3f12b9,_0xf1399a){if(_0x3f12b9[_0xe20c('0x5c')]['id']){delete _0x3f12b9[_0xe20c('0x5c')]['id'];}return db[_0xe20c('0x40')][_0xe20c('0x5a')]({'where':{'id':_0x3f12b9[_0xe20c('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xe20c('0x3e')}]})[_0xe20c('0x20')](handleEntityNotFound(_0xf1399a,null))[_0xe20c('0x20')](saveUpdates(_0x3f12b9[_0xe20c('0x5c')],null))[_0xe20c('0x20')](respondWithResult(_0xf1399a,null))[_0xe20c('0x29')](handleError(_0xf1399a,null));};exports[_0xe20c('0x37')]=function(_0x5238ec,_0x2907c6){return db[_0xe20c('0x40')][_0xe20c('0x5a')]({'where':{'id':_0x5238ec['params']['id']}})[_0xe20c('0x20')](handleEntityNotFound(_0x2907c6,null))[_0xe20c('0x20')](removeEntity(_0x2907c6,null))['catch'](handleError(_0x2907c6,null));};exports[_0xe20c('0x64')]=function(_0x2fc484,_0x3a3eea){return db[_0xe20c('0x40')][_0xe20c('0x64')]()[_0xe20c('0x20')](respondWithResult(_0x3a3eea,null))[_0xe20c('0x29')](handleError(_0x3a3eea,null));};exports[_0xe20c('0x65')]=function(_0x16da96,_0x7f315a,_0x5b22ef){if(_0x16da96[_0xe20c('0x5c')]['id']){delete _0x16da96[_0xe20c('0x5c')]['id'];}return db['FaxAccount'][_0xe20c('0x5a')]({'where':{'id':_0x16da96['params']['id']}})['then'](handleEntityNotFound(_0x7f315a,null))['then'](function(_0x58f234){if(_0x58f234){_0x16da96[_0xe20c('0x5c')][_0xe20c('0x66')]=_0x58f234['id'];return db[_0xe20c('0x67')][_0xe20c('0x5b')](_0x16da96['body']);}})[_0xe20c('0x20')](respondWithResult(_0x7f315a,null))[_0xe20c('0x29')](handleError(_0x7f315a,null));};exports[_0xe20c('0x68')]=function(_0x4d9cce,_0x54605b,_0x25cafe){var _0x8cbc68={'raw':![],'where':{}};var _0x55d2e0={};var _0x13b65d={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe20c('0x69')]({'where':{'id':_0x4d9cce[_0xe20c('0x59')]['id']}})['then'](handleEntityNotFound(_0x54605b,null))[_0xe20c('0x20')](function(_0xddeca0){if(_0xddeca0){_0x55d2e0[_0xe20c('0x45')]=_[_0xe20c('0x47')](db[_0xe20c('0x67')]['rawAttributes']);_0x55d2e0[_0xe20c('0x46')]=_['keys'](_0x4d9cce[_0xe20c('0x46')]);_0x55d2e0[_0xe20c('0x48')]=_[_0xe20c('0x4a')](_0x55d2e0[_0xe20c('0x45')],_0x55d2e0[_0xe20c('0x46')]);_0x8cbc68[_0xe20c('0x49')]=_[_0xe20c('0x4a')](_0x55d2e0['model'],qs[_0xe20c('0x4b')](_0x4d9cce[_0xe20c('0x46')][_0xe20c('0x4b')]));_0x8cbc68['attributes']=_0x8cbc68[_0xe20c('0x49')][_0xe20c('0x4c')]?_0x8cbc68[_0xe20c('0x49')]:_0x55d2e0['model'];if(!_0x4d9cce[_0xe20c('0x46')][_0xe20c('0x6a')](_0xe20c('0x4d'))){_0x8cbc68[_0xe20c('0x30')]=qs[_0xe20c('0x30')](_0x4d9cce[_0xe20c('0x46')][_0xe20c('0x30')]);_0x8cbc68[_0xe20c('0x2e')]=qs[_0xe20c('0x2e')](_0x4d9cce[_0xe20c('0x46')][_0xe20c('0x2e')]);}_0x8cbc68[_0xe20c('0x4e')]=qs['sort'](_0x4d9cce[_0xe20c('0x46')]['sort']);_0x8cbc68[_0xe20c('0x50')]=qs['filters'](_[_0xe20c('0x51')](_0x4d9cce[_0xe20c('0x46')],_0x55d2e0[_0xe20c('0x48')]));_0x8cbc68[_0xe20c('0x50')][_0xe20c('0x66')]=_0xddeca0['id'];if(_0x4d9cce['query'][_0xe20c('0x52')]){_0x8cbc68['where']=_['merge'](_0x8cbc68[_0xe20c('0x50')],{'$or':_[_0xe20c('0x3f')](_0x8cbc68[_0xe20c('0x49')],function(_0x136aae){var _0x39727f={};_0x39727f[_0x136aae]={'$like':'%'+_0x4d9cce[_0xe20c('0x46')][_0xe20c('0x52')]+'%'};return _0x39727f;})});}_0x8cbc68=_[_0xe20c('0x54')]({},_0x8cbc68,_0x4d9cce[_0xe20c('0x55')]);return db[_0xe20c('0x67')][_0xe20c('0x31')]({'where':_0x8cbc68['where']})['then'](function(_0x3b3475){_0x13b65d[_0xe20c('0x31')]=_0x3b3475;if(_0x4d9cce[_0xe20c('0x46')][_0xe20c('0x56')]){_0x8cbc68['include']=[{'all':!![]}];}return db[_0xe20c('0x67')][_0xe20c('0x6b')](_0x8cbc68);})[_0xe20c('0x20')](function(_0x285f6c){_0x13b65d[_0xe20c('0x57')]=_0x285f6c;return _0x13b65d;});}})[_0xe20c('0x20')](respondWithFilteredResult(_0x54605b,_0x8cbc68))[_0xe20c('0x29')](handleError(_0x54605b,null));};exports[_0xe20c('0x6c')]=function(_0x2272bf,_0x3b6ac1,_0x2decfd){return db['FaxAccount'][_0xe20c('0x5a')]({'where':{'id':_0x2272bf['params']['id']}})[_0xe20c('0x20')](handleEntityNotFound(_0x3b6ac1,null))[_0xe20c('0x20')](function(_0x2486fa){if(_0x2486fa){return _0x2486fa[_0xe20c('0x6c')](_0x2272bf['query'][_0xe20c('0x6d')]);}})[_0xe20c('0x20')](respondWithStatusCode(_0x3b6ac1,null))[_0xe20c('0x29')](handleError(_0x3b6ac1,null));};exports[_0xe20c('0x6e')]=function(_0x1b3fa6,_0xc6848b,_0x2c24f0){if(_0x1b3fa6[_0xe20c('0x5c')]['id']){delete _0x1b3fa6[_0xe20c('0x5c')]['id'];}return db[_0xe20c('0x40')][_0xe20c('0x5a')]({'where':{'id':_0x1b3fa6['params']['id']}})[_0xe20c('0x20')](handleEntityNotFound(_0xc6848b,null))['then'](function(_0x48fe0a){if(_0x48fe0a){_0x1b3fa6[_0xe20c('0x5c')][_0xe20c('0x66')]=_0x48fe0a['id'];return db[_0xe20c('0x6f')][_0xe20c('0x5b')](_0x1b3fa6[_0xe20c('0x5c')]);}})[_0xe20c('0x20')](respondWithResult(_0xc6848b,null))['catch'](handleError(_0xc6848b,null));};exports[_0xe20c('0x70')]=function(_0x5bcf3c,_0xf9d66a,_0x3b461f){var _0x3da5ed={'raw':![],'where':{}};var _0x428001={};var _0x53d23a={'count':0x0,'rows':[]};return db[_0xe20c('0x40')]['findOne']({'where':{'id':_0x5bcf3c['params']['id']}})['then'](handleEntityNotFound(_0xf9d66a,null))[_0xe20c('0x20')](function(_0x2779c7){if(_0x2779c7){_0x428001[_0xe20c('0x45')]=_[_0xe20c('0x47')](db['CannedAnswer'][_0xe20c('0x41')]);_0x428001[_0xe20c('0x46')]=_[_0xe20c('0x47')](_0x5bcf3c[_0xe20c('0x46')]);_0x428001[_0xe20c('0x48')]=_['intersection'](_0x428001['model'],_0x428001[_0xe20c('0x46')]);_0x3da5ed[_0xe20c('0x49')]=_[_0xe20c('0x4a')](_0x428001[_0xe20c('0x45')],qs[_0xe20c('0x4b')](_0x5bcf3c['query'][_0xe20c('0x4b')]));_0x3da5ed[_0xe20c('0x49')]=_0x3da5ed[_0xe20c('0x49')]['length']?_0x3da5ed['attributes']:_0x428001[_0xe20c('0x45')];if(!_0x5bcf3c[_0xe20c('0x46')]['hasOwnProperty'](_0xe20c('0x4d'))){_0x3da5ed[_0xe20c('0x30')]=qs[_0xe20c('0x30')](_0x5bcf3c['query'][_0xe20c('0x30')]);_0x3da5ed[_0xe20c('0x2e')]=qs[_0xe20c('0x2e')](_0x5bcf3c[_0xe20c('0x46')][_0xe20c('0x2e')]);}_0x3da5ed[_0xe20c('0x4e')]=qs[_0xe20c('0x4f')](_0x5bcf3c[_0xe20c('0x46')][_0xe20c('0x4f')]);_0x3da5ed['where']=qs[_0xe20c('0x48')](_[_0xe20c('0x51')](_0x5bcf3c[_0xe20c('0x46')],_0x428001[_0xe20c('0x48')]));_0x3da5ed[_0xe20c('0x50')]['FaxAccountId']=_0x2779c7['id'];if(_0x5bcf3c['query'][_0xe20c('0x52')]){_0x3da5ed[_0xe20c('0x50')]=_[_0xe20c('0x54')](_0x3da5ed[_0xe20c('0x50')],{'$or':_[_0xe20c('0x3f')](_0x3da5ed['attributes'],function(_0x128958){var _0x3c5c64={};_0x3c5c64[_0x128958]={'$like':'%'+_0x5bcf3c[_0xe20c('0x46')][_0xe20c('0x52')]+'%'};return _0x3c5c64;})});}_0x3da5ed=_[_0xe20c('0x54')]({},_0x3da5ed,_0x5bcf3c[_0xe20c('0x55')]);return db[_0xe20c('0x6f')]['count']({'where':_0x3da5ed[_0xe20c('0x50')]})['then'](function(_0x53f93b){_0x53d23a['count']=_0x53f93b;if(_0x5bcf3c[_0xe20c('0x46')]['includeAll']){_0x3da5ed[_0xe20c('0x71')]=[{'all':!![]}];}return db[_0xe20c('0x6f')][_0xe20c('0x6b')](_0x3da5ed);})[_0xe20c('0x20')](function(_0x372f9f){_0x53d23a[_0xe20c('0x57')]=_0x372f9f;return _0x53d23a;});}})[_0xe20c('0x20')](respondWithFilteredResult(_0xf9d66a,_0x3da5ed))[_0xe20c('0x29')](handleError(_0xf9d66a,null));};exports[_0xe20c('0x72')]=function(_0x1e8930,_0xb6b877,_0x3c92b5){return db[_0xe20c('0x40')][_0xe20c('0x5a')]({'where':{'id':_0x1e8930['params']['id']}})['then'](handleEntityNotFound(_0xb6b877,null))[_0xe20c('0x20')](function(_0x35e7b7){if(_0x35e7b7){return _0x35e7b7['removeAnswers'](_0x1e8930[_0xe20c('0x46')][_0xe20c('0x6d')]);}})['then'](respondWithStatusCode(_0xb6b877,null))[_0xe20c('0x29')](handleError(_0xb6b877,null));};exports['addInteraction']=function(_0x549c02,_0x42867a,_0x126d86){return db[_0xe20c('0x73')][_0xe20c('0x5a')]({'where':{'id':_0x549c02['params']['id']}})[_0xe20c('0x20')](handleEntityNotFound(_0x42867a,null))[_0xe20c('0x20')](function(_0x308cec){if(_0x308cec){return _0x308cec['addInteraction'](_0x549c02['body'][_0xe20c('0x6d')],_[_0xe20c('0x74')](_0x549c02[_0xe20c('0x5c')],[_0xe20c('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x42867a,null))[_0xe20c('0x29')](handleError(_0x42867a,null));};exports[_0xe20c('0x75')]=function(_0x270a47,_0x43e33a,_0x3fbe3d){var _0x4b3a17={'raw':![],'where':{}};var _0x16bfe2={};var _0xe0ef88={'count':0x0,'rows':[]};return db[_0xe20c('0x40')][_0xe20c('0x69')]({'where':{'id':_0x270a47[_0xe20c('0x59')]['id']}})[_0xe20c('0x20')](handleEntityNotFound(_0x43e33a,null))[_0xe20c('0x20')](function(_0x5d3a65){if(_0x5d3a65){_0x16bfe2[_0xe20c('0x45')]=_[_0xe20c('0x47')](db[_0xe20c('0x73')][_0xe20c('0x41')]);_0x16bfe2[_0xe20c('0x46')]=_[_0xe20c('0x47')](_0x270a47[_0xe20c('0x46')]);_0x16bfe2[_0xe20c('0x48')]=_[_0xe20c('0x4a')](_0x16bfe2[_0xe20c('0x45')],_0x16bfe2[_0xe20c('0x46')]);_0x4b3a17[_0xe20c('0x49')]=_[_0xe20c('0x4a')](_0x16bfe2[_0xe20c('0x45')],qs[_0xe20c('0x4b')](_0x270a47[_0xe20c('0x46')]['fields']));_0x4b3a17[_0xe20c('0x49')]=_0x4b3a17['attributes'][_0xe20c('0x4c')]?_0x4b3a17['attributes']:_0x16bfe2[_0xe20c('0x45')];if(!_0x270a47[_0xe20c('0x46')]['hasOwnProperty']('nolimit')){_0x4b3a17[_0xe20c('0x30')]=qs[_0xe20c('0x30')](_0x270a47[_0xe20c('0x46')]['limit']);_0x4b3a17[_0xe20c('0x2e')]=qs[_0xe20c('0x2e')](_0x270a47[_0xe20c('0x46')][_0xe20c('0x2e')]);}_0x4b3a17['order']=qs[_0xe20c('0x4f')](_0x270a47['query']['sort']);_0x4b3a17[_0xe20c('0x50')]=qs[_0xe20c('0x48')](_['pick'](_0x270a47['query'],_0x16bfe2[_0xe20c('0x48')]));_0x4b3a17['where'][_0xe20c('0x66')]=_0x5d3a65['id'];if(_0x270a47[_0xe20c('0x46')][_0xe20c('0x52')]){_0x4b3a17[_0xe20c('0x50')]=_[_0xe20c('0x54')](_0x4b3a17[_0xe20c('0x50')],{'$or':_[_0xe20c('0x3f')](_0x4b3a17['attributes'],function(_0x3d453b){var _0x24402a={};_0x24402a[_0x3d453b]={'$like':'%'+_0x270a47['query'][_0xe20c('0x52')]+'%'};return _0x24402a;})});}_0x4b3a17=_[_0xe20c('0x54')]({},_0x4b3a17,_0x270a47[_0xe20c('0x55')]);return db['FaxInteraction'][_0xe20c('0x31')]({'where':_0x4b3a17['where']})[_0xe20c('0x20')](function(_0x2c3d9d){_0xe0ef88[_0xe20c('0x31')]=_0x2c3d9d;if(_0x270a47[_0xe20c('0x46')][_0xe20c('0x56')]){_0x4b3a17[_0xe20c('0x71')]=[{'model':db[_0xe20c('0x76')],'as':_0xe20c('0x77'),'required':![]},{'model':db['User'],'as':_0xe20c('0x78'),'attributes':[_0xe20c('0x3a'),'fullname',_0xe20c('0x79')],'required':![]},{'model':db[_0xe20c('0x7a')],'as':_0xe20c('0x7b'),'attributes':['id',_0xe20c('0x3a'),'color'],'where':_0x270a47[_0xe20c('0x46')][_0xe20c('0x7c')]?{'id':_0x270a47[_0xe20c('0x46')][_0xe20c('0x7c')]}:undefined,'required':_0x270a47['query']['tag']?!![]:![]}];}return db[_0xe20c('0x73')][_0xe20c('0x6b')](_0x4b3a17);})['then'](function(_0x91690e){_0xe0ef88[_0xe20c('0x57')]=_0x91690e;return _0xe0ef88;});}})[_0xe20c('0x20')](respondWithFilteredResult(_0x43e33a,_0x4b3a17))[_0xe20c('0x29')](handleError(_0x43e33a,null));};exports['addApplications']=function(_0x2fd4d6,_0x52b128){var _0x6d7dc2=_0x2fd4d6[_0xe20c('0x59')]['id'];var _0x533034=_0x2fd4d6[_0xe20c('0x5c')];var _0x3cc768=0xc8;var _0x4ab4c0=null;return db[_0xe20c('0x7d')][_0xe20c('0x7e')]({'isolationLevel':db[_0xe20c('0x7d')][_0xe20c('0x7f')][_0xe20c('0x80')][_0xe20c('0x81')]},function(_0x3ad81c){return db[_0xe20c('0x40')][_0xe20c('0x69')]({'where':{'id':_0x6d7dc2},'transaction':_0x3ad81c})['then'](function(_0x4ab5fa){if(_0x4ab5fa){return db[_0xe20c('0x82')][_0xe20c('0x37')]({'where':{'FaxAccountId':_0x6d7dc2},'transaction':_0x3ad81c})['then'](function(){var _0x2b33f7=_['map'](_0x533034,function(_0x58ddde){_0x58ddde[_0xe20c('0x66')]=_0x6d7dc2;return _0x58ddde;});return db[_0xe20c('0x82')][_0xe20c('0x83')](_0x2b33f7,{'transaction':_0x3ad81c});});}else{_0x3cc768=0x194;_0x4ab4c0=[];}});})['then'](function(){if(_0x3cc768!==0x194){return db[_0xe20c('0x82')][_0xe20c('0x84')]({'where':{'FaxAccountId':_0x6d7dc2},'order':_0xe20c('0x85')})[_0xe20c('0x20')](function(_0x41523a){_0x4ab4c0=_0x41523a;});}})['catch'](function(_0x481513){_0x3cc768=0x1f4;logger[_0xe20c('0x24')](_0x481513[_0xe20c('0x39')]);if(_0x481513[_0xe20c('0x3a')]){delete _0x481513[_0xe20c('0x3a')];}_0x4ab4c0=_0x481513;})[_0xe20c('0x86')](function(){if(_0x4ab4c0===null){_0x52b128[_0xe20c('0x2a')](_0x3cc768);}else{if(_0x3cc768===0x1f4){_0x52b128[_0xe20c('0x2b')](_0x3cc768)['send'](_0x4ab4c0);}else{_0x52b128[_0xe20c('0x2b')](_0x3cc768)[_0xe20c('0x2d')](_0x4ab4c0);}}});};exports[_0xe20c('0x87')]=function(_0x4a62c4,_0x333637,_0x692789){var _0x22f2ef={};var _0x5872c4={};var _0x43a7e4;var _0x47cea7;return db['FaxAccount'][_0xe20c('0x69')]({'where':{'id':_0x4a62c4['params']['id']}})[_0xe20c('0x20')](handleEntityNotFound(_0x333637,null))[_0xe20c('0x20')](function(_0x301e13){if(_0x301e13){_0x43a7e4=_0x301e13;_0x5872c4[_0xe20c('0x45')]=_[_0xe20c('0x47')](db[_0xe20c('0x82')][_0xe20c('0x41')]);_0x5872c4[_0xe20c('0x46')]=_[_0xe20c('0x47')](_0x4a62c4[_0xe20c('0x46')]);_0x5872c4['filters']=_['intersection'](_0x5872c4[_0xe20c('0x45')],_0x5872c4[_0xe20c('0x46')]);_0x22f2ef['attributes']=_[_0xe20c('0x4a')](_0x5872c4[_0xe20c('0x45')],qs[_0xe20c('0x4b')](_0x4a62c4[_0xe20c('0x46')][_0xe20c('0x4b')]));_0x22f2ef['attributes']=_0x22f2ef['attributes']['length']?_0x22f2ef[_0xe20c('0x49')]:_0x5872c4[_0xe20c('0x45')];_0x22f2ef['order']=qs[_0xe20c('0x4f')](_0x4a62c4[_0xe20c('0x46')]['sort']);_0x22f2ef[_0xe20c('0x50')]=qs[_0xe20c('0x48')](_[_0xe20c('0x51')](_0x4a62c4['query'],_0x5872c4[_0xe20c('0x48')]));if(_0x4a62c4[_0xe20c('0x46')]['filter']){_0x22f2ef[_0xe20c('0x50')]=_[_0xe20c('0x54')](_0x22f2ef[_0xe20c('0x50')],{'$or':_['map'](_0x22f2ef['attributes'],function(_0x3e4ee8){var _0x4c1276={};_0x4c1276[_0x3e4ee8]={'$like':'%'+_0x4a62c4[_0xe20c('0x46')][_0xe20c('0x52')]+'%'};return _0x4c1276;})});}_0x22f2ef=_[_0xe20c('0x54')]({},_0x22f2ef,_0x4a62c4[_0xe20c('0x55')]);return _0x43a7e4[_0xe20c('0x87')](_0x22f2ef);}})['then'](function(_0x5b330e){if(_0x5b330e){_0x47cea7=_0x5b330e['length'];if(!_0x4a62c4[_0xe20c('0x46')][_0xe20c('0x6a')]('nolimit')){_0x22f2ef[_0xe20c('0x30')]=qs[_0xe20c('0x30')](_0x4a62c4[_0xe20c('0x46')]['limit']);_0x22f2ef[_0xe20c('0x2e')]=qs[_0xe20c('0x2e')](_0x4a62c4[_0xe20c('0x46')][_0xe20c('0x2e')]);}return _0x43a7e4['getApplications'](_0x22f2ef);}})[_0xe20c('0x20')](function(_0xef7a9a){if(_0xef7a9a){return _0xef7a9a?{'count':_0x47cea7,'rows':_0xef7a9a}:null;}})[_0xe20c('0x20')](respondWithResult(_0x333637,null))['catch'](handleError(_0x333637,null));};function Extension(_0x57fde8,_0x1ec6aa,_0x38c4cd,_0x2fa355){this[_0xe20c('0x88')]='from-voip-provider';this[_0xe20c('0x89')]=_0x57fde8[_0xe20c('0x8a')];this[_0xe20c('0x8b')]=_0x2fa355;this[_0xe20c('0x43')]=_0xe20c('0x8c');this['description']=_0xe20c('0x8d');this[_0xe20c('0x66')]=_0x57fde8['id'];this[_0xe20c('0x85')]=_0x1ec6aa;this['appdata']=_0x38c4cd;}function createExtensionsReciveFax(_0x23ff1a){var _0x4ce713=0x1;var _0x4f54b8=[];_0x4f54b8[_0xe20c('0x8e')](new Extension(_0x23ff1a,_0x4ce713,'','Answer'));_0x4ce713+=0x1;_0x4f54b8[_0xe20c('0x8e')](new Extension(_0x23ff1a,_0x4ce713,_0xe20c('0x8f'),_0xe20c('0x90')));_0x4ce713+=0x1;for(var _0x45e0b5 in _0x23ff1a){if(_0x23ff1a[_0xe20c('0x6a')](_0x45e0b5)&&(_0x45e0b5===_0xe20c('0x91')||_0x45e0b5==='localstationid'||_0x45e0b5===_0xe20c('0x92')||_0x45e0b5==='faxdetect'||_0x45e0b5===_0xe20c('0x93')||_0x45e0b5===_0xe20c('0x94')||_0x45e0b5===_0xe20c('0x95')||_0x45e0b5===_0xe20c('0x96')||_0x45e0b5===_0xe20c('0x97'))){_0x4f54b8[_0xe20c('0x8e')](new Extension(_0x23ff1a,_0x4ce713,_0xe20c('0x98')+_0x45e0b5+')='+_0x23ff1a[_0x45e0b5],_0xe20c('0x90')));_0x4ce713+=0x1;}}_0x4f54b8['push'](new Extension(_0x23ff1a,_0x4ce713,'6','Wait'));_0x4ce713+=0x1;_0x4f54b8['push'](new Extension(_0x23ff1a,_0x4ce713,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax'));_0x4ce713=0x0;return _0x4f54b8;}exports[_0xe20c('0x99')]=function(_0x1d15ab,_0x4b43ab,_0x250743){var _0x4de1fa;return db[_0xe20c('0x7d')][_0xe20c('0x7e')](function(_0x14d2a3){return db[_0xe20c('0x40')][_0xe20c('0x5b')](_0x1d15ab[_0xe20c('0x5c')],{'transaction':_0x14d2a3})[_0xe20c('0x20')](function(_0x4e5dac){_0x4de1fa=_0x4e5dac[_0xe20c('0x38')]({'plain':!![]});return db[_0xe20c('0x9a')][_0xe20c('0x83')](createExtensionsReciveFax(_0x4de1fa),{'transaction':_0x14d2a3});});})[_0xe20c('0x20')](function(){return _0x4de1fa;})['then'](respondWithResult(_0x4b43ab,null))['catch'](handleError(_0x4b43ab,null));};exports[_0xe20c('0x9b')]=function(_0x31d303,_0x4b4563,_0x287359){var _0x5f09f7;return db[_0xe20c('0x7d')][_0xe20c('0x7e')](function(_0xc5cab6){return db['FaxAccount'][_0xe20c('0x36')](_0x31d303['body'],{'where':{'id':_0x31d303['body']['id']},'transaction':_0xc5cab6})[_0xe20c('0x20')](function(_0x122623){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x31d303[_0xe20c('0x5c')]['id']},'transaction':_0xc5cab6})[_0xe20c('0x20')](function(_0x1d3a8b){return db[_0xe20c('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0xe20c('0x74')](_0x31d303[_0xe20c('0x5c')],[_0xe20c('0x9c'),_0xe20c('0x44'),_0xe20c('0x9d'),_0xe20c('0x9e'),'TrunkId',_0xe20c('0x9f')])),{'transaction':_0xc5cab6});});});})[_0xe20c('0x20')](function(){return db[_0xe20c('0x40')][_0xe20c('0xa0')](_0x31d303[_0xe20c('0x5c')]['id']);})[_0xe20c('0x20')](respondWithResult(_0x4b4563,null))[_0xe20c('0x29')](handleError(_0x4b4563,null));};exports[_0xe20c('0xa1')]=function(_0x3f1732,_0x26c085,_0x18a4c9){var _0x433507={'raw':!![],'where':{}};var _0x562df4={};var _0x1350c0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe20c('0x69')]({'where':{'id':_0x3f1732['params']['id']}})[_0xe20c('0x20')](handleEntityNotFound(_0x26c085,null))[_0xe20c('0x20')](function(_0x5d5b9c){if(_0x5d5b9c){_0x562df4[_0xe20c('0x45')]=_[_0xe20c('0x47')](db[_0xe20c('0xa2')][_0xe20c('0x41')]);_0x562df4[_0xe20c('0x46')]=_[_0xe20c('0x47')](_0x3f1732['query']);_0x562df4[_0xe20c('0x48')]=_[_0xe20c('0x4a')](_0x562df4['model'],_0x562df4[_0xe20c('0x46')]);_0x433507[_0xe20c('0x49')]=_[_0xe20c('0x4a')](_0x562df4[_0xe20c('0x45')],qs['fields'](_0x3f1732[_0xe20c('0x46')][_0xe20c('0x4b')]));_0x433507[_0xe20c('0x49')]=_0x433507[_0xe20c('0x49')]['length']?_0x433507[_0xe20c('0x49')]:_0x562df4[_0xe20c('0x45')];if(!_0x3f1732[_0xe20c('0x46')][_0xe20c('0x6a')](_0xe20c('0x4d'))){_0x433507[_0xe20c('0x30')]=qs['limit'](_0x3f1732[_0xe20c('0x46')][_0xe20c('0x30')]);_0x433507[_0xe20c('0x2e')]=qs[_0xe20c('0x2e')](_0x3f1732[_0xe20c('0x46')][_0xe20c('0x2e')]);}_0x433507[_0xe20c('0x4e')]=qs[_0xe20c('0x4f')](_0x3f1732[_0xe20c('0x46')]['sort']);_0x433507[_0xe20c('0x50')]=qs[_0xe20c('0x48')](_[_0xe20c('0x51')](_0x3f1732[_0xe20c('0x46')],_0x562df4[_0xe20c('0x48')]));_0x433507['where'][_0xe20c('0x66')]=_0x5d5b9c['id'];if(_0x3f1732[_0xe20c('0x46')][_0xe20c('0x52')]){_0x433507['where']=_['merge'](_0x433507['where'],{'$or':_[_0xe20c('0x3f')](_0x433507[_0xe20c('0x49')],function(_0xb9f7b1){var _0x144389={};_0x144389[_0xb9f7b1]={'$like':'%'+_0x3f1732[_0xe20c('0x46')][_0xe20c('0x52')]+'%'};return _0x144389;})});}if(_0x3f1732['query'][_0xe20c('0xa3')]){var _0x762d71=_0x3f1732[_0xe20c('0x46')][_0xe20c('0xa3')][_0xe20c('0xa4')](',');var _0x4906e9={};_0x4906e9[_0x762d71[0x0]]={'$gte':moment(_0x762d71[0x1])[_0xe20c('0xa5')](_0xe20c('0xa6'))};_0x433507[_0xe20c('0x50')]=_['merge'](_0x433507['where'],_0x4906e9);}_0x433507=_[_0xe20c('0x54')]({},_0x433507,_0x3f1732['options']);return db[_0xe20c('0xa2')][_0xe20c('0x31')]({'where':_0x433507[_0xe20c('0x50')]})[_0xe20c('0x20')](function(_0x8df65b){_0x1350c0[_0xe20c('0x31')]=_0x8df65b;if(_0x3f1732[_0xe20c('0x46')][_0xe20c('0x56')]){_0x433507[_0xe20c('0x71')]=[{'all':!![]}];}return db[_0xe20c('0xa2')][_0xe20c('0x6b')](_0x433507);})['then'](function(_0x58dddd){_0x1350c0[_0xe20c('0x57')]=_0x58dddd;return _0x1350c0;});}})[_0xe20c('0x20')](respondWithFilteredResult(_0x26c085,_0x433507))['catch'](handleError(_0x26c085,null));};exports[_0xe20c('0x3b')]=function(_0x3140c0,_0x47000a,_0x5e7c0a){var _0x5ac5c5,_0x411f14={},_0x3f3e3d;if(_0x3140c0[_0xe20c('0x5c')]['to']){_0x3f3e3d=_0x3140c0[_0xe20c('0x5c')]['to'][0x0];}return db[_0xe20c('0x40')]['find']({'where':{'id':_0x3140c0[_0xe20c('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0xe20c('0xa7'),'include':[{'model':db[_0xe20c('0x76')],'as':_0xe20c('0xa8'),'where':{'fax':_0x3f3e3d},'limit':0x1,'order':[[_0xe20c('0x9e'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x47000a,null))['then'](function(_0x56d6b8){_0x5ac5c5=_0x56d6b8;if(_0x3140c0[_0xe20c('0x5c')][_0xe20c('0xa9')]&&_0x3140c0[_0xe20c('0x5c')][_0xe20c('0xa9')]['length']){for(var _0x950a89=0x0;_0x950a89<_0x3140c0[_0xe20c('0x5c')]['attachments'][_0xe20c('0x4c')];_0x950a89+=0x1){_0x3140c0[_0xe20c('0x5c')][_0xe20c('0xa9')][_0x950a89]={'filename':_0x3140c0['body']['attachments'][_0x950a89][_0xe20c('0x3a')],'id':_0x3140c0['body'][_0xe20c('0xa9')][_0x950a89]['id'],'path':path['join'](config[_0xe20c('0xaa')],_0xe20c('0xab'),_0x3140c0[_0xe20c('0x5c')][_0xe20c('0xa9')][_0x950a89][_0xe20c('0xac')])};}}return respondWithRpcPromise(_0xe20c('0xad'),'CheckAfterSend',{'FaxAccountId':_[_0xe20c('0xae')](_0x3140c0[_0xe20c('0x59')]['id'])?undefined:_0x3140c0['params']['id'],'path':_[_0xe20c('0xae')](_0x3140c0['body']['attachments'][0x0][_0xe20c('0x7')])?undefined:_0x3140c0[_0xe20c('0x5c')][_0xe20c('0xa9')][0x0][_0xe20c('0x7')],'fax':_[_0xe20c('0xae')](_0x3140c0['body']['to'][0x0])?undefined:_0x3140c0[_0xe20c('0x5c')]['to'][0x0]},client9002);})[_0xe20c('0x20')](function(){if(_0x5ac5c5){if(_['isNil'](_0x3140c0[_0xe20c('0x5c')]['from'])){_0x3140c0[_0xe20c('0x5c')][_0xe20c('0xaf')]=util[_0xe20c('0xa5')](_0xe20c('0xb0'),_0x5ac5c5[_0xe20c('0x3a')],_0x5ac5c5[_0xe20c('0xb1')]);}if(_0x5ac5c5[_0xe20c('0xa7')]){if(_0x5ac5c5[_0xe20c('0xa7')]['Contacts'][_0xe20c('0x4c')]){return _0x5ac5c5[_0xe20c('0xa7')][_0xe20c('0xa8')][0x0];}else{return db['CmContact'][_0xe20c('0x5b')](_[_0xe20c('0x18')](_0x3140c0[_0xe20c('0x5c')],{'firstName':_0x3140c0[_0xe20c('0x5c')]['to'][0x0],'phone':_0x3140c0[_0xe20c('0x5c')]['to'][0x0],'fax':_0x3140c0[_0xe20c('0x5c')]['to'][0x0],'ListId':_0x5ac5c5[_0xe20c('0x9f')]}));}}else{throw new Error(_0xe20c('0xb2'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xe20c('0x20')](function(_0x14c56d){if(_0x14c56d){return db[_0xe20c('0x73')][_0xe20c('0x5a')]({'where':{'ContactId':_0x14c56d['id'],'closed':![],'FaxAccountId':_0x5ac5c5['id']}})['then'](function(_0x1ab95b){if(_0x1ab95b){return[_0x1ab95b,![]];}return db[_0xe20c('0x73')][_0xe20c('0x5b')]({'UserId':_0x3140c0['user']['id'],'ContactId':_0x14c56d['id'],'FaxAccountId':_0x5ac5c5['id'],'fax':_0x3140c0[_0xe20c('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xe20c('0x54')](_0x3140c0[_0xe20c('0x5c')],{'read':![],'body':_0x3140c0['body'][_0xe20c('0xa9')][0x0][_0xe20c('0xb3')],'FaxAccountId':_0x5ac5c5['id'],'UserId':_0x3140c0[_0xe20c('0x5d')]['id'],'ContactId':_0x14c56d['id'],'AttachmentId':_0x3140c0['body'][_0xe20c('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0xe20c('0xa2')],'as':_0xe20c('0xb4')}]})[_0xe20c('0x20')](function(_0x5324ef){return[_0x5324ef,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0xfc0c71,_0x43d75c){if(_0x43d75c){return _0xfc0c71;}return db[_0xe20c('0xa2')][_0xe20c('0x5b')]({'direction':_0xe20c('0xb5'),'read':![],'body':_0x3140c0[_0xe20c('0x5c')][_0xe20c('0xa9')][0x0]['filename'],'FaxAccountId':_0x5ac5c5['id'],'FaxInteractionId':_0xfc0c71['id'],'UserId':_0x3140c0['user']['id'],'ContactId':_0xfc0c71[_0xe20c('0xb6')],'AttachmentId':_0x3140c0['body']['attachments'][0x0]['id']})['then'](function(_0x8a7ae0){_0xfc0c71[_0xe20c('0xb7')]['Messages']=[];_0xfc0c71[_0xe20c('0xb7')]['Messages'][_0xe20c('0x8e')](_0x8a7ae0[_0xe20c('0xb7')]);return _0xfc0c71;});})[_0xe20c('0x20')](function(_0x1d3568){respondWithRpcPromise(_0xe20c('0xb8'),_0xe20c('0xb8'),{'FaxAccountId':_[_0xe20c('0xae')](_0x3140c0['params']['id'])?undefined:_0x3140c0[_0xe20c('0x59')]['id'],'path':_[_0xe20c('0xae')](_0x3140c0[_0xe20c('0x5c')][_0xe20c('0xa9')][0x0][_0xe20c('0x7')])?undefined:_0x3140c0['body'][_0xe20c('0xa9')][0x0]['path'],'fax':_[_0xe20c('0xae')](_0x3140c0[_0xe20c('0x5c')]['to'][0x0])?undefined:_0x3140c0['body']['to'][0x0],'AttachmentId':_0x3140c0[_0xe20c('0x5c')][_0xe20c('0xa9')][0x0]['id']},client9002)['then'](function(_0x3f23af){logger[_0xe20c('0x27')]('SendFaxRpc,\x20%s',_0x3f23af);})[_0xe20c('0x29')](function(_0x3be34a){logger[_0xe20c('0x27')](_0xe20c('0xb9'),_0x3be34a);});return _0x1d3568;})['then'](respondWithResult(_0x47000a,null))[_0xe20c('0x29')](handleError(_0x47000a,null));};exports[_0xe20c('0xba')]=function(_0x513b28,_0x7cfae6,_0x1922c1){return db[_0xe20c('0x40')][_0xe20c('0x5a')]({'where':{'id':_0x513b28[_0xe20c('0x59')]['id']}})[_0xe20c('0x20')](handleEntityNotFound(_0x7cfae6,null))['then'](function(_0x3be0d9){if(_0x3be0d9){return _0x3be0d9[_0xe20c('0xba')](_0x513b28[_0xe20c('0x5c')][_0xe20c('0x6d')],_[_0xe20c('0x74')](_0x513b28[_0xe20c('0x5c')],[_0xe20c('0x6d'),'id'])||{})[_0xe20c('0xbb')](function(_0xfb39df){for(var _0x389a1b=0x0;_0x389a1b<_0x513b28['body'][_0xe20c('0x6d')][_0xe20c('0x4c')];_0x389a1b+=0x1){socket[_0xe20c('0xbc')](_0xe20c('0xbd'),{'UserId':Number(_0x513b28[_0xe20c('0x5c')][_0xe20c('0x6d')][_0x389a1b]),'FaxAccountId':Number(_0x513b28[_0xe20c('0x59')]['id'])});}return _0xfb39df;});}})[_0xe20c('0x20')](respondWithResult(_0x7cfae6,null))[_0xe20c('0x29')](handleError(_0x7cfae6,null));};exports[_0xe20c('0xbe')]=function(_0x5e11a3,_0x13e007,_0x1b220a){return db[_0xe20c('0x40')]['find']({'where':{'id':_0x5e11a3['params']['id']}})[_0xe20c('0x20')](handleEntityNotFound(_0x13e007,null))['then'](function(_0x597b61){if(_0x597b61){return _0x597b61[_0xe20c('0xbe')](_0x5e11a3['query'][_0xe20c('0x6d')])[_0xe20c('0x20')](function(){if(_[_0xe20c('0xbf')](_0x5e11a3['query'][_0xe20c('0x6d')])){for(var _0x12e408=0x0;_0x12e408<_0x5e11a3[_0xe20c('0x46')][_0xe20c('0x6d')][_0xe20c('0x4c')];_0x12e408+=0x1){socket[_0xe20c('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x5e11a3['query'][_0xe20c('0x6d')][_0x12e408]),'FaxAccountId':Number(_0x5e11a3[_0xe20c('0x59')]['id'])});}}else{socket[_0xe20c('0xbc')](_0xe20c('0xc0'),{'UserId':Number(_0x5e11a3[_0xe20c('0x46')][_0xe20c('0x6d')]),'FaxAccountId':Number(_0x5e11a3['params']['id'])});}});}})[_0xe20c('0x20')](respondWithStatusCode(_0x13e007,null))[_0xe20c('0x29')](handleError(_0x13e007,null));};exports['getAgents']=function(_0x25771f,_0x5033b1,_0x1c30d6){var _0x1fda6a={};var _0x44b55d={};var _0xd92be1;var _0x3da35a;return db[_0xe20c('0x40')][_0xe20c('0x69')]({'where':{'id':_0x25771f[_0xe20c('0x59')]['id']}})[_0xe20c('0x20')](handleEntityNotFound(_0x5033b1,null))[_0xe20c('0x20')](function(_0x118325){if(_0x118325){_0xd92be1=_0x118325;_0x44b55d[_0xe20c('0x45')]=_[_0xe20c('0x47')](db['User'][_0xe20c('0x41')]);_0x44b55d['query']=_['keys'](_0x25771f[_0xe20c('0x46')]);_0x44b55d[_0xe20c('0x48')]=_[_0xe20c('0x4a')](_0x44b55d['model'],_0x44b55d['query']);_0x1fda6a[_0xe20c('0x49')]=_[_0xe20c('0x4a')](_0x44b55d[_0xe20c('0x45')],qs[_0xe20c('0x4b')](_0x25771f[_0xe20c('0x46')][_0xe20c('0x4b')]));_0x1fda6a[_0xe20c('0x49')]=_0x1fda6a[_0xe20c('0x49')]['length']?_0x1fda6a[_0xe20c('0x49')]:_0x44b55d[_0xe20c('0x45')];_0x1fda6a[_0xe20c('0x4e')]=qs['sort'](_0x25771f['query'][_0xe20c('0x4f')]);_0x1fda6a['where']=qs[_0xe20c('0x48')](_[_0xe20c('0x51')](_0x25771f[_0xe20c('0x46')],_0x44b55d['filters']));if(_0x25771f[_0xe20c('0x46')]['filter']){_0x1fda6a[_0xe20c('0x50')]=_[_0xe20c('0x54')](_0x1fda6a[_0xe20c('0x50')],{'$or':_[_0xe20c('0x3f')](_0x1fda6a[_0xe20c('0x49')],function(_0x51ae2c){var _0x5c1a38={};_0x5c1a38[_0x51ae2c]={'$like':'%'+_0x25771f[_0xe20c('0x46')]['filter']+'%'};return _0x5c1a38;})});}_0x1fda6a=_[_0xe20c('0x54')]({},_0x1fda6a,_0x25771f[_0xe20c('0x55')]);return _0xd92be1[_0xe20c('0xc1')](_0x1fda6a);}})['then'](function(_0x460186){if(_0x460186){_0x3da35a=_0x460186['length'];if(!_0x25771f['query'][_0xe20c('0x6a')](_0xe20c('0x4d'))){_0x1fda6a[_0xe20c('0x30')]=qs[_0xe20c('0x30')](_0x25771f[_0xe20c('0x46')][_0xe20c('0x30')]);_0x1fda6a[_0xe20c('0x2e')]=qs['offset'](_0x25771f[_0xe20c('0x46')][_0xe20c('0x2e')]);}return _0xd92be1[_0xe20c('0xc1')](_0x1fda6a);}})[_0xe20c('0x20')](function(_0x43bd4b){if(_0x43bd4b){return _0x43bd4b?{'count':_0x3da35a,'rows':_0x43bd4b}:null;}})[_0xe20c('0x20')](respondWithResult(_0x5033b1,null))['catch'](handleError(_0x5033b1,null));}; \ No newline at end of file +var _0xcc11=['Contacts','attachments','join','basename','CheckAfterSend','isNil','from','fax','defaults','out','Messages','Contact\x20not\x20found','spread','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','get','FaxAccounts','UserProfileResource','destroy','stack','name','index','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','include','FaxAccount','findAll','rows','show','params','Pause','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','priority','finally','send','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','gateway','faxdetect','maxrate','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcc11,0xda));var _0x1cc1=function(_0x29f258,_0x559572){_0x29f258=_0x29f258-0x0;var _0x1315c7=_0xcc11[_0x29f258];return _0x1315c7;};'use strict';var emlformat=require(_0x1cc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1cc1('0x1'));var jsonpatch=require(_0x1cc1('0x2'));var rp=require(_0x1cc1('0x3'));var moment=require(_0x1cc1('0x4'));var BPromise=require(_0x1cc1('0x5'));var Mustache=require('mustache');var util=require(_0x1cc1('0x6'));var path=require(_0x1cc1('0x7'));var sox=require(_0x1cc1('0x8'));var csv=require(_0x1cc1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cc1('0xa'));var _=require(_0x1cc1('0xb'));var squel=require(_0x1cc1('0xc'));var crypto=require(_0x1cc1('0xd'));var jsforce=require(_0x1cc1('0xe'));var deskjs=require(_0x1cc1('0xf'));var toCsv=require(_0x1cc1('0x9'));var querystring=require(_0x1cc1('0x10'));var Papa=require(_0x1cc1('0x11'));var Redis=require(_0x1cc1('0x12'));var authService=require(_0x1cc1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1cc1('0x14'));var hardwareService=require(_0x1cc1('0x15'));var logger=require(_0x1cc1('0x16'))(_0x1cc1('0x17'));var utils=require('../../config/utils');var config=require(_0x1cc1('0x18'));var licenseUtil=require(_0x1cc1('0x19'));var db=require('../../mysqldb')['db'];config[_0x1cc1('0x1a')]=_['defaults'](config['redis'],{'host':_0x1cc1('0x1b'),'port':0x18eb});var socket=require(_0x1cc1('0x1c'))(new Redis(config['redis']));require(_0x1cc1('0x1d'))['register'](socket);var jayson=require(_0x1cc1('0x1e'));var client=jayson[_0x1cc1('0x1f')][_0x1cc1('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x1cc1('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2ecfe0,_0x53cf5f,_0x1c2982,_0x10b341){return new BPromise(function(_0x5c8586,_0x154a32){var _0x5534c6=_0x10b341||client;return _0x5534c6[_0x1cc1('0x21')](_0x2ecfe0,_0x1c2982)['then'](function(_0x3abb62){logger[_0x1cc1('0x22')](_0x1cc1('0x23'),_0x53cf5f,_0x1cc1('0x24'));logger[_0x1cc1('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x53cf5f,_0x1cc1('0x24'),JSON[_0x1cc1('0x26')](_0x3abb62));if(_0x3abb62[_0x1cc1('0x27')]){if(_0x3abb62[_0x1cc1('0x27')][_0x1cc1('0x28')]===0x1f4){logger[_0x1cc1('0x27')](_0x1cc1('0x23'),_0x53cf5f,_0x3abb62[_0x1cc1('0x27')][_0x1cc1('0x29')]);return _0x154a32(_0x3abb62[_0x1cc1('0x27')][_0x1cc1('0x29')]);}logger[_0x1cc1('0x27')](_0x1cc1('0x23'),_0x53cf5f,_0x3abb62[_0x1cc1('0x27')][_0x1cc1('0x29')]);return _0x5c8586(_0x3abb62[_0x1cc1('0x27')][_0x1cc1('0x29')]);}else{logger['info'](_0x1cc1('0x23'),_0x53cf5f,_0x1cc1('0x24'));_0x5c8586(_0x3abb62[_0x1cc1('0x2a')][_0x1cc1('0x29')]);}})[_0x1cc1('0x2b')](function(_0x428137){logger['error']('FaxAccount,\x20%s,\x20%s',_0x53cf5f,_0x428137);_0x154a32(_0x428137);});});}function respondWithStatusCode(_0x2dcfba,_0x31a51){_0x31a51=_0x31a51||0xcc;return function(_0x555e93){if(_0x555e93){return _0x2dcfba[_0x1cc1('0x2c')](_0x31a51);}return _0x2dcfba['status'](_0x31a51)[_0x1cc1('0x2d')]();};}function respondWithResult(_0x5b030f,_0x573d70){_0x573d70=_0x573d70||0xc8;return function(_0x51dfb2){if(_0x51dfb2){return _0x5b030f[_0x1cc1('0x2e')](_0x573d70)[_0x1cc1('0x2f')](_0x51dfb2);}};}function respondWithFilteredResult(_0x1f7a62,_0x93541a){return function(_0x3ed8a2){if(_0x3ed8a2){var _0x5af1d4=typeof _0x93541a[_0x1cc1('0x30')]===_0x1cc1('0x31')&&typeof _0x93541a['limit']==='undefined';var _0x3d343b=_0x3ed8a2['count'];var _0x326234=_0x5af1d4?0x0:_0x93541a[_0x1cc1('0x30')];var _0x21be14=_0x5af1d4?_0x3ed8a2[_0x1cc1('0x32')]:_0x93541a[_0x1cc1('0x30')]+_0x93541a[_0x1cc1('0x33')];var _0x11715e;if(_0x21be14>=_0x3d343b){_0x21be14=_0x3d343b;_0x11715e=0xc8;}else{_0x11715e=0xce;}_0x1f7a62[_0x1cc1('0x2e')](_0x11715e);return _0x1f7a62[_0x1cc1('0x34')](_0x1cc1('0x35'),_0x326234+'-'+_0x21be14+'/'+_0x3d343b)['json'](_0x3ed8a2);}return null;};}function patchUpdates(_0x455095){return function(_0x415985){try{jsonpatch[_0x1cc1('0x36')](_0x415985,_0x455095,!![]);}catch(_0x340b38){return BPromise['reject'](_0x340b38);}return _0x415985['save']();};}function saveUpdates(_0x368f18,_0x6cda36){return function(_0x2b5b78){if(_0x2b5b78){return _0x2b5b78[_0x1cc1('0x37')](_0x368f18)[_0x1cc1('0x38')](function(_0x27eaf9){return _0x27eaf9;});}return null;};}function removeEntity(_0x2c0262,_0x2f7b20){return function(_0x35e55d){if(_0x35e55d){return _0x35e55d['destroy']()[_0x1cc1('0x38')](function(){var _0x32a37a=_0x35e55d[_0x1cc1('0x39')]({'plain':!![]});var _0x307e44=_0x1cc1('0x3a');return db[_0x1cc1('0x3b')][_0x1cc1('0x3c')]({'where':{'type':_0x307e44,'resourceId':_0x32a37a['id']}})[_0x1cc1('0x38')](function(){return _0x35e55d;});})['then'](function(){_0x2c0262[_0x1cc1('0x2e')](0xcc)[_0x1cc1('0x2d')]();});}};}function handleEntityNotFound(_0x28392f,_0xdc117a){return function(_0xcff1b8){if(!_0xcff1b8){_0x28392f[_0x1cc1('0x2c')](0x194);}return _0xcff1b8;};}function handleError(_0x194392,_0x3f6bb2){_0x3f6bb2=_0x3f6bb2||0x1f4;return function(_0x132045){logger[_0x1cc1('0x27')](_0x132045[_0x1cc1('0x3d')]);if(_0x132045['name']){delete _0x132045[_0x1cc1('0x3e')];}_0x194392[_0x1cc1('0x2e')](_0x3f6bb2)['send'](_0x132045);};}exports[_0x1cc1('0x3f')]=function(_0x463aaa,_0x2e865){var _0x315892={'include':[{'model':db['Pause'],'as':_0x1cc1('0x40')}]},_0x324f74={},_0x990749={'count':0x0,'rows':[]};var _0x6306c5=_['map'](db['FaxAccount'][_0x1cc1('0x41')],function(_0x570425){return{'name':_0x570425[_0x1cc1('0x42')],'type':_0x570425[_0x1cc1('0x43')][_0x1cc1('0x44')]};});_0x324f74[_0x1cc1('0x45')]=_[_0x1cc1('0x46')](_0x6306c5,_0x1cc1('0x3e'));_0x324f74[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x463aaa[_0x1cc1('0x47')]);_0x324f74['filters']=_[_0x1cc1('0x49')](_0x324f74[_0x1cc1('0x45')],_0x324f74[_0x1cc1('0x47')]);_0x315892['attributes']=_['intersection'](_0x324f74['model'],qs[_0x1cc1('0x4a')](_0x463aaa[_0x1cc1('0x47')]['fields']));_0x315892[_0x1cc1('0x4b')]=_0x315892[_0x1cc1('0x4b')]['length']?_0x315892[_0x1cc1('0x4b')]:_0x324f74[_0x1cc1('0x45')];if(!_0x463aaa[_0x1cc1('0x47')][_0x1cc1('0x4c')](_0x1cc1('0x4d'))){_0x315892[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x463aaa[_0x1cc1('0x47')]['limit']);_0x315892[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x463aaa['query'][_0x1cc1('0x30')]);}_0x315892[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x463aaa[_0x1cc1('0x47')]['sort']);_0x315892[_0x1cc1('0x50')]=qs['filters'](_[_0x1cc1('0x51')](_0x463aaa['query'],_0x324f74[_0x1cc1('0x52')]),_0x6306c5);if(_0x463aaa[_0x1cc1('0x47')][_0x1cc1('0x53')]){_0x315892[_0x1cc1('0x50')]=_[_0x1cc1('0x54')](_0x315892['where'],{'$or':_[_0x1cc1('0x46')](_0x6306c5,function(_0xe0c23a){if(_0xe0c23a[_0x1cc1('0x43')]!=='VIRTUAL'){var _0x51cde5={};_0x51cde5[_0xe0c23a['name']]={'$like':'%'+_0x463aaa[_0x1cc1('0x47')][_0x1cc1('0x53')]+'%'};return _0x51cde5;}})});}_0x315892=_[_0x1cc1('0x54')]({},_0x315892,_0x463aaa[_0x1cc1('0x55')]);var _0x285e68={'where':_0x315892[_0x1cc1('0x50')]};return db['FaxAccount']['count'](_0x285e68)[_0x1cc1('0x38')](function(_0x1db818){_0x990749[_0x1cc1('0x32')]=_0x1db818;if(_0x463aaa[_0x1cc1('0x47')]['includeAll']){_0x315892[_0x1cc1('0x56')]=[{'all':!![]}];}return db[_0x1cc1('0x57')][_0x1cc1('0x58')](_0x315892);})[_0x1cc1('0x38')](function(_0x289d8c){_0x990749[_0x1cc1('0x59')]=_0x289d8c;return _0x990749;})[_0x1cc1('0x38')](respondWithFilteredResult(_0x2e865,_0x315892))['catch'](handleError(_0x2e865,null));};exports[_0x1cc1('0x5a')]=function(_0x1436bf,_0x1d493c){var _0x547c7a={'raw':![],'where':{'id':_0x1436bf[_0x1cc1('0x5b')]['id']},'include':[{'model':db[_0x1cc1('0x5c')],'as':_0x1cc1('0x40')}]},_0x54b4a1={};_0x54b4a1[_0x1cc1('0x45')]=_[_0x1cc1('0x48')](db[_0x1cc1('0x57')]['rawAttributes']);_0x54b4a1[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x1436bf[_0x1cc1('0x47')]);_0x54b4a1[_0x1cc1('0x52')]=_[_0x1cc1('0x49')](_0x54b4a1[_0x1cc1('0x45')],_0x54b4a1[_0x1cc1('0x47')]);_0x547c7a['attributes']=_[_0x1cc1('0x49')](_0x54b4a1[_0x1cc1('0x45')],qs[_0x1cc1('0x4a')](_0x1436bf[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x547c7a[_0x1cc1('0x4b')]=_0x547c7a[_0x1cc1('0x4b')][_0x1cc1('0x5d')]?_0x547c7a[_0x1cc1('0x4b')]:_0x54b4a1[_0x1cc1('0x45')];if(_0x1436bf[_0x1cc1('0x47')]['includeAll']){_0x547c7a[_0x1cc1('0x56')]=[{'all':!![]}];}_0x547c7a=_[_0x1cc1('0x54')]({},_0x547c7a,_0x1436bf['options']);return db['FaxAccount'][_0x1cc1('0x5e')](_0x547c7a)[_0x1cc1('0x38')](handleEntityNotFound(_0x1d493c,null))[_0x1cc1('0x38')](respondWithResult(_0x1d493c,null))['catch'](handleError(_0x1d493c,null));};exports[_0x1cc1('0x5f')]=function(_0x4fe9b0,_0x4c339b){return db[_0x1cc1('0x57')][_0x1cc1('0x5f')](_0x4fe9b0['body'],{})[_0x1cc1('0x38')](function(_0x531c87){var _0xc9d849=_0x4fe9b0[_0x1cc1('0x60')][_0x1cc1('0x39')]({'plain':!![]});if(!_0xc9d849)throw new Error(_0x1cc1('0x61'));if(_0xc9d849[_0x1cc1('0x62')]===_0x1cc1('0x60')){var _0x26c627=_0x531c87[_0x1cc1('0x39')]({'plain':!![]});var _0x11f4b3='FaxAccounts';return db[_0x1cc1('0x63')][_0x1cc1('0x5e')]({'where':{'name':_0x11f4b3,'userProfileId':_0xc9d849['userProfileId']},'raw':!![]})[_0x1cc1('0x38')](function(_0x56cd44){if(_0x56cd44&&_0x56cd44[_0x1cc1('0x64')]===0x0){return db['UserProfileResource'][_0x1cc1('0x5f')]({'name':_0x26c627[_0x1cc1('0x3e')],'resourceId':_0x26c627['id'],'type':_0x56cd44[_0x1cc1('0x3e')],'sectionId':_0x56cd44['id']},{})[_0x1cc1('0x38')](function(){return _0x531c87;});}else{return _0x531c87;}})[_0x1cc1('0x2b')](function(_0x5f0db2){logger[_0x1cc1('0x27')](_0x1cc1('0x65'),_0x5f0db2);throw _0x5f0db2;});}return _0x531c87;})['then'](respondWithResult(_0x4c339b,0xc9))[_0x1cc1('0x2b')](handleError(_0x4c339b,null));};exports[_0x1cc1('0x37')]=function(_0x63d965,_0x3e0245){if(_0x63d965[_0x1cc1('0x66')]['id']){delete _0x63d965[_0x1cc1('0x66')]['id'];}return db[_0x1cc1('0x57')][_0x1cc1('0x5e')]({'where':{'id':_0x63d965[_0x1cc1('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x1cc1('0x40')}]})[_0x1cc1('0x38')](handleEntityNotFound(_0x3e0245,null))[_0x1cc1('0x38')](saveUpdates(_0x63d965[_0x1cc1('0x66')],null))[_0x1cc1('0x38')](respondWithResult(_0x3e0245,null))[_0x1cc1('0x2b')](handleError(_0x3e0245,null));};exports[_0x1cc1('0x3c')]=function(_0x41095e,_0x263590){return db[_0x1cc1('0x57')]['find']({'where':{'id':_0x41095e[_0x1cc1('0x5b')]['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x263590,null))[_0x1cc1('0x38')](removeEntity(_0x263590,null))['catch'](handleError(_0x263590,null));};exports[_0x1cc1('0x67')]=function(_0x275060,_0x11cad4){return db[_0x1cc1('0x57')][_0x1cc1('0x67')]()[_0x1cc1('0x38')](respondWithResult(_0x11cad4,null))[_0x1cc1('0x2b')](handleError(_0x11cad4,null));};exports[_0x1cc1('0x68')]=function(_0x26d595,_0x5ebbeb,_0x1bedec){if(_0x26d595[_0x1cc1('0x66')]['id']){delete _0x26d595['body']['id'];}return db['FaxAccount'][_0x1cc1('0x5e')]({'where':{'id':_0x26d595[_0x1cc1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5ebbeb,null))[_0x1cc1('0x38')](function(_0x47f5ef){if(_0x47f5ef){_0x26d595[_0x1cc1('0x66')]['FaxAccountId']=_0x47f5ef['id'];return db[_0x1cc1('0x69')][_0x1cc1('0x5f')](_0x26d595[_0x1cc1('0x66')]);}})[_0x1cc1('0x38')](respondWithResult(_0x5ebbeb,null))[_0x1cc1('0x2b')](handleError(_0x5ebbeb,null));};exports[_0x1cc1('0x6a')]=function(_0x156d14,_0x5b2e00,_0x1195bf){var _0x377605={'raw':![],'where':{}};var _0x4a4303={};var _0x410d90={'count':0x0,'rows':[]};return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x156d14['params']['id']}})['then'](handleEntityNotFound(_0x5b2e00,null))[_0x1cc1('0x38')](function(_0x265383){if(_0x265383){_0x4a4303[_0x1cc1('0x45')]=_[_0x1cc1('0x48')](db['Disposition'][_0x1cc1('0x41')]);_0x4a4303[_0x1cc1('0x47')]=_['keys'](_0x156d14['query']);_0x4a4303[_0x1cc1('0x52')]=_[_0x1cc1('0x49')](_0x4a4303['model'],_0x4a4303[_0x1cc1('0x47')]);_0x377605[_0x1cc1('0x4b')]=_['intersection'](_0x4a4303['model'],qs[_0x1cc1('0x4a')](_0x156d14[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x377605[_0x1cc1('0x4b')]=_0x377605[_0x1cc1('0x4b')][_0x1cc1('0x5d')]?_0x377605[_0x1cc1('0x4b')]:_0x4a4303[_0x1cc1('0x45')];if(!_0x156d14[_0x1cc1('0x47')]['hasOwnProperty']('nolimit')){_0x377605[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x156d14[_0x1cc1('0x47')]['limit']);_0x377605[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x156d14['query']['offset']);}_0x377605[_0x1cc1('0x4e')]=qs['sort'](_0x156d14['query'][_0x1cc1('0x4f')]);_0x377605['where']=qs['filters'](_['pick'](_0x156d14[_0x1cc1('0x47')],_0x4a4303[_0x1cc1('0x52')]));_0x377605[_0x1cc1('0x50')][_0x1cc1('0x6c')]=_0x265383['id'];if(_0x156d14[_0x1cc1('0x47')]['filter']){_0x377605[_0x1cc1('0x50')]=_['merge'](_0x377605['where'],{'$or':_[_0x1cc1('0x46')](_0x377605[_0x1cc1('0x4b')],function(_0x7b790f){var _0x37cda5={};_0x37cda5[_0x7b790f]={'$like':'%'+_0x156d14[_0x1cc1('0x47')]['filter']+'%'};return _0x37cda5;})});}_0x377605=_[_0x1cc1('0x54')]({},_0x377605,_0x156d14[_0x1cc1('0x55')]);return db[_0x1cc1('0x69')][_0x1cc1('0x32')]({'where':_0x377605[_0x1cc1('0x50')]})[_0x1cc1('0x38')](function(_0x1ae4b9){_0x410d90[_0x1cc1('0x32')]=_0x1ae4b9;if(_0x156d14['query'][_0x1cc1('0x6d')]){_0x377605['include']=[{'all':!![]}];}return db[_0x1cc1('0x69')][_0x1cc1('0x58')](_0x377605);})[_0x1cc1('0x38')](function(_0x349e3d){_0x410d90[_0x1cc1('0x59')]=_0x349e3d;return _0x410d90;});}})[_0x1cc1('0x38')](respondWithFilteredResult(_0x5b2e00,_0x377605))[_0x1cc1('0x2b')](handleError(_0x5b2e00,null));};exports[_0x1cc1('0x6e')]=function(_0x1d549e,_0x68df9a,_0x256d49){return db[_0x1cc1('0x57')][_0x1cc1('0x5e')]({'where':{'id':_0x1d549e[_0x1cc1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x68df9a,null))['then'](function(_0x2012ba){if(_0x2012ba){return _0x2012ba[_0x1cc1('0x6e')](_0x1d549e[_0x1cc1('0x47')][_0x1cc1('0x6f')]);}})[_0x1cc1('0x38')](respondWithStatusCode(_0x68df9a,null))[_0x1cc1('0x2b')](handleError(_0x68df9a,null));};exports[_0x1cc1('0x70')]=function(_0x483005,_0x2bcc28,_0x5c180d){if(_0x483005[_0x1cc1('0x66')]['id']){delete _0x483005['body']['id'];}return db[_0x1cc1('0x57')][_0x1cc1('0x5e')]({'where':{'id':_0x483005['params']['id']}})['then'](handleEntityNotFound(_0x2bcc28,null))[_0x1cc1('0x38')](function(_0x46a77e){if(_0x46a77e){_0x483005[_0x1cc1('0x66')][_0x1cc1('0x6c')]=_0x46a77e['id'];return db[_0x1cc1('0x71')]['create'](_0x483005[_0x1cc1('0x66')]);}})['then'](respondWithResult(_0x2bcc28,null))['catch'](handleError(_0x2bcc28,null));};exports[_0x1cc1('0x72')]=function(_0x3d2c51,_0x3b578c,_0xc08022){var _0x36bd0d={'raw':![],'where':{}};var _0x38e44c={};var _0x2640c5={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1cc1('0x6b')]({'where':{'id':_0x3d2c51['params']['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x3b578c,null))['then'](function(_0xe48d4e){if(_0xe48d4e){_0x38e44c[_0x1cc1('0x45')]=_['keys'](db[_0x1cc1('0x71')]['rawAttributes']);_0x38e44c[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x3d2c51[_0x1cc1('0x47')]);_0x38e44c[_0x1cc1('0x52')]=_['intersection'](_0x38e44c['model'],_0x38e44c[_0x1cc1('0x47')]);_0x36bd0d[_0x1cc1('0x4b')]=_[_0x1cc1('0x49')](_0x38e44c[_0x1cc1('0x45')],qs['fields'](_0x3d2c51[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x36bd0d['attributes']=_0x36bd0d['attributes'][_0x1cc1('0x5d')]?_0x36bd0d[_0x1cc1('0x4b')]:_0x38e44c[_0x1cc1('0x45')];if(!_0x3d2c51['query'][_0x1cc1('0x4c')]('nolimit')){_0x36bd0d[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x3d2c51[_0x1cc1('0x47')][_0x1cc1('0x33')]);_0x36bd0d['offset']=qs[_0x1cc1('0x30')](_0x3d2c51['query'][_0x1cc1('0x30')]);}_0x36bd0d[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x3d2c51[_0x1cc1('0x47')][_0x1cc1('0x4f')]);_0x36bd0d[_0x1cc1('0x50')]=qs[_0x1cc1('0x52')](_[_0x1cc1('0x51')](_0x3d2c51[_0x1cc1('0x47')],_0x38e44c[_0x1cc1('0x52')]));_0x36bd0d[_0x1cc1('0x50')][_0x1cc1('0x6c')]=_0xe48d4e['id'];if(_0x3d2c51[_0x1cc1('0x47')]['filter']){_0x36bd0d[_0x1cc1('0x50')]=_['merge'](_0x36bd0d[_0x1cc1('0x50')],{'$or':_[_0x1cc1('0x46')](_0x36bd0d[_0x1cc1('0x4b')],function(_0x4fdae){var _0x41a432={};_0x41a432[_0x4fdae]={'$like':'%'+_0x3d2c51[_0x1cc1('0x47')][_0x1cc1('0x53')]+'%'};return _0x41a432;})});}_0x36bd0d=_[_0x1cc1('0x54')]({},_0x36bd0d,_0x3d2c51[_0x1cc1('0x55')]);return db['CannedAnswer'][_0x1cc1('0x32')]({'where':_0x36bd0d[_0x1cc1('0x50')]})[_0x1cc1('0x38')](function(_0x53619e){_0x2640c5[_0x1cc1('0x32')]=_0x53619e;if(_0x3d2c51[_0x1cc1('0x47')][_0x1cc1('0x6d')]){_0x36bd0d[_0x1cc1('0x56')]=[{'all':!![]}];}return db[_0x1cc1('0x71')][_0x1cc1('0x58')](_0x36bd0d);})[_0x1cc1('0x38')](function(_0x14cd15){_0x2640c5['rows']=_0x14cd15;return _0x2640c5;});}})[_0x1cc1('0x38')](respondWithFilteredResult(_0x3b578c,_0x36bd0d))['catch'](handleError(_0x3b578c,null));};exports['removeAnswers']=function(_0x14c0d6,_0x1444eb,_0x52551f){return db[_0x1cc1('0x57')]['find']({'where':{'id':_0x14c0d6[_0x1cc1('0x5b')]['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x1444eb,null))[_0x1cc1('0x38')](function(_0x25ddbd){if(_0x25ddbd){return _0x25ddbd[_0x1cc1('0x73')](_0x14c0d6['query']['ids']);}})[_0x1cc1('0x38')](respondWithStatusCode(_0x1444eb,null))[_0x1cc1('0x2b')](handleError(_0x1444eb,null));};exports[_0x1cc1('0x74')]=function(_0x10f837,_0x37770f,_0x33701c){return db[_0x1cc1('0x75')][_0x1cc1('0x5e')]({'where':{'id':_0x10f837[_0x1cc1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x37770f,null))['then'](function(_0x5dc59c){if(_0x5dc59c){return _0x5dc59c[_0x1cc1('0x74')](_0x10f837['body'][_0x1cc1('0x6f')],_[_0x1cc1('0x76')](_0x10f837[_0x1cc1('0x66')],[_0x1cc1('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x37770f,null))['catch'](handleError(_0x37770f,null));};exports[_0x1cc1('0x77')]=function(_0x227f25,_0x410a1a,_0x46a1d2){var _0x4ac410={'raw':![],'where':{}};var _0x4d1d6a={};var _0x5575e5={'count':0x0,'rows':[]};return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x227f25[_0x1cc1('0x5b')]['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x410a1a,null))[_0x1cc1('0x38')](function(_0x5a9eeb){if(_0x5a9eeb){_0x4d1d6a[_0x1cc1('0x45')]=_[_0x1cc1('0x48')](db[_0x1cc1('0x75')]['rawAttributes']);_0x4d1d6a[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x227f25[_0x1cc1('0x47')]);_0x4d1d6a[_0x1cc1('0x52')]=_[_0x1cc1('0x49')](_0x4d1d6a[_0x1cc1('0x45')],_0x4d1d6a[_0x1cc1('0x47')]);_0x4ac410[_0x1cc1('0x4b')]=_[_0x1cc1('0x49')](_0x4d1d6a[_0x1cc1('0x45')],qs['fields'](_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x4ac410[_0x1cc1('0x4b')]=_0x4ac410[_0x1cc1('0x4b')][_0x1cc1('0x5d')]?_0x4ac410[_0x1cc1('0x4b')]:_0x4d1d6a[_0x1cc1('0x45')];if(!_0x227f25['query']['hasOwnProperty']('nolimit')){_0x4ac410[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x33')]);_0x4ac410[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x30')]);}_0x4ac410[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x227f25['query'][_0x1cc1('0x4f')]);_0x4ac410[_0x1cc1('0x50')]=qs['filters'](_[_0x1cc1('0x51')](_0x227f25[_0x1cc1('0x47')],_0x4d1d6a[_0x1cc1('0x52')]));_0x4ac410['where'][_0x1cc1('0x6c')]=_0x5a9eeb['id'];if(_0x227f25['query']['filter']){_0x4ac410[_0x1cc1('0x50')]=_[_0x1cc1('0x54')](_0x4ac410[_0x1cc1('0x50')],{'$or':_['map'](_0x4ac410[_0x1cc1('0x4b')],function(_0x39c511){var _0x1a8061={};_0x1a8061[_0x39c511]={'$like':'%'+_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x53')]+'%'};return _0x1a8061;})});}_0x4ac410=_['merge']({},_0x4ac410,_0x227f25[_0x1cc1('0x55')]);return db[_0x1cc1('0x75')][_0x1cc1('0x32')]({'where':_0x4ac410[_0x1cc1('0x50')]})['then'](function(_0x22ee51){_0x5575e5[_0x1cc1('0x32')]=_0x22ee51;if(_0x227f25['query'][_0x1cc1('0x6d')]){_0x4ac410['include']=[{'model':db[_0x1cc1('0x78')],'as':_0x1cc1('0x79'),'required':![]},{'model':db[_0x1cc1('0x7a')],'as':'Owner','attributes':[_0x1cc1('0x3e'),_0x1cc1('0x7b'),_0x1cc1('0x7c')],'required':![]},{'model':db[_0x1cc1('0x7d')],'as':'Tags','attributes':['id',_0x1cc1('0x3e'),'color'],'where':_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x7e')]?{'id':_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x7e')]}:undefined,'required':_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x7e')]?!![]:![]}];}return db[_0x1cc1('0x75')]['findAll'](_0x4ac410);})[_0x1cc1('0x38')](function(_0x2aef92){_0x5575e5['rows']=_0x2aef92;return _0x5575e5;});}})[_0x1cc1('0x38')](respondWithFilteredResult(_0x410a1a,_0x4ac410))[_0x1cc1('0x2b')](handleError(_0x410a1a,null));};exports[_0x1cc1('0x7f')]=function(_0xa56ee,_0x171bd8){var _0x269ad0=_0xa56ee[_0x1cc1('0x5b')]['id'];var _0x2d739a=_0xa56ee[_0x1cc1('0x66')];var _0x22f650=0xc8;var _0x5ad71=null;return db['sequelize'][_0x1cc1('0x80')]({'isolationLevel':db[_0x1cc1('0x81')][_0x1cc1('0x82')][_0x1cc1('0x83')][_0x1cc1('0x84')]},function(_0x3a824e){return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x269ad0},'transaction':_0x3a824e})['then'](function(_0x510bfc){if(_0x510bfc){return db[_0x1cc1('0x85')][_0x1cc1('0x3c')]({'where':{'FaxAccountId':_0x269ad0},'transaction':_0x3a824e})['then'](function(){var _0x1dcd79=_[_0x1cc1('0x46')](_0x2d739a,function(_0xa792a0){_0xa792a0[_0x1cc1('0x6c')]=_0x269ad0;return _0xa792a0;});return db[_0x1cc1('0x85')]['bulkCreate'](_0x1dcd79,{'transaction':_0x3a824e});});}else{_0x22f650=0x194;_0x5ad71=[];}});})[_0x1cc1('0x38')](function(){if(_0x22f650!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x269ad0},'order':_0x1cc1('0x86')})[_0x1cc1('0x38')](function(_0x49e90f){_0x5ad71=_0x49e90f;});}})['catch'](function(_0x36175c){_0x22f650=0x1f4;logger[_0x1cc1('0x27')](_0x36175c[_0x1cc1('0x3d')]);if(_0x36175c[_0x1cc1('0x3e')]){delete _0x36175c['name'];}_0x5ad71=_0x36175c;})[_0x1cc1('0x87')](function(){if(_0x5ad71===null){_0x171bd8['sendStatus'](_0x22f650);}else{if(_0x22f650===0x1f4){_0x171bd8['status'](_0x22f650)[_0x1cc1('0x88')](_0x5ad71);}else{_0x171bd8['status'](_0x22f650)[_0x1cc1('0x2f')](_0x5ad71);}}});};exports['getApplications']=function(_0x59c40b,_0x2589a9,_0xa9089f){var _0x340fd4={};var _0x4a67b8={};var _0xd47bd0;var _0x20ac5f;return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x59c40b['params']['id']}})['then'](handleEntityNotFound(_0x2589a9,null))['then'](function(_0x115bcf){if(_0x115bcf){_0xd47bd0=_0x115bcf;_0x4a67b8['model']=_[_0x1cc1('0x48')](db[_0x1cc1('0x85')]['rawAttributes']);_0x4a67b8[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x59c40b[_0x1cc1('0x47')]);_0x4a67b8[_0x1cc1('0x52')]=_['intersection'](_0x4a67b8[_0x1cc1('0x45')],_0x4a67b8[_0x1cc1('0x47')]);_0x340fd4[_0x1cc1('0x4b')]=_[_0x1cc1('0x49')](_0x4a67b8['model'],qs['fields'](_0x59c40b[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x340fd4['attributes']=_0x340fd4[_0x1cc1('0x4b')][_0x1cc1('0x5d')]?_0x340fd4[_0x1cc1('0x4b')]:_0x4a67b8[_0x1cc1('0x45')];_0x340fd4[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x59c40b[_0x1cc1('0x47')][_0x1cc1('0x4f')]);_0x340fd4[_0x1cc1('0x50')]=qs[_0x1cc1('0x52')](_['pick'](_0x59c40b[_0x1cc1('0x47')],_0x4a67b8[_0x1cc1('0x52')]));if(_0x59c40b[_0x1cc1('0x47')][_0x1cc1('0x53')]){_0x340fd4['where']=_[_0x1cc1('0x54')](_0x340fd4[_0x1cc1('0x50')],{'$or':_['map'](_0x340fd4[_0x1cc1('0x4b')],function(_0x14fbae){var _0x126a18={};_0x126a18[_0x14fbae]={'$like':'%'+_0x59c40b[_0x1cc1('0x47')]['filter']+'%'};return _0x126a18;})});}_0x340fd4=_[_0x1cc1('0x54')]({},_0x340fd4,_0x59c40b[_0x1cc1('0x55')]);return _0xd47bd0[_0x1cc1('0x89')](_0x340fd4);}})[_0x1cc1('0x38')](function(_0x182ebe){if(_0x182ebe){_0x20ac5f=_0x182ebe[_0x1cc1('0x5d')];if(!_0x59c40b['query'][_0x1cc1('0x4c')](_0x1cc1('0x4d'))){_0x340fd4[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x59c40b['query']['limit']);_0x340fd4[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x59c40b['query'][_0x1cc1('0x30')]);}return _0xd47bd0['getApplications'](_0x340fd4);}})[_0x1cc1('0x38')](function(_0x53fd81){if(_0x53fd81){return _0x53fd81?{'count':_0x20ac5f,'rows':_0x53fd81}:null;}})[_0x1cc1('0x38')](respondWithResult(_0x2589a9,null))[_0x1cc1('0x2b')](handleError(_0x2589a9,null));};function Extension(_0x1291f1,_0x5092b8,_0x5a26be,_0x1ec914){this[_0x1cc1('0x8a')]=_0x1cc1('0x8b');this[_0x1cc1('0x8c')]=_0x1291f1[_0x1cc1('0x8d')];this[_0x1cc1('0x8e')]=_0x1ec914;this[_0x1cc1('0x43')]=_0x1cc1('0x8f');this['description']=_0x1cc1('0x90');this[_0x1cc1('0x6c')]=_0x1291f1['id'];this[_0x1cc1('0x86')]=_0x5092b8;this[_0x1cc1('0x91')]=_0x5a26be;}function createExtensionsReciveFax(_0x499e1b){var _0x5f02cf=0x1;var _0x121883=[];_0x121883[_0x1cc1('0x92')](new Extension(_0x499e1b,_0x5f02cf,'','Answer'));_0x5f02cf+=0x1;_0x121883[_0x1cc1('0x92')](new Extension(_0x499e1b,_0x5f02cf,'CDR(type)=inbound-fax','Set'));_0x5f02cf+=0x1;for(var _0xcfde0f in _0x499e1b){if(_0x499e1b[_0x1cc1('0x4c')](_0xcfde0f)&&(_0xcfde0f==='ecm'||_0xcfde0f===_0x1cc1('0x8d')||_0xcfde0f===_0x1cc1('0x93')||_0xcfde0f===_0x1cc1('0x94')||_0xcfde0f==='headerinfo'||_0xcfde0f===_0x1cc1('0x95')||_0xcfde0f==='minrate'||_0xcfde0f==='modem'||_0xcfde0f===_0x1cc1('0x96'))){_0x121883[_0x1cc1('0x92')](new Extension(_0x499e1b,_0x5f02cf,_0x1cc1('0x97')+_0xcfde0f+')='+_0x499e1b[_0xcfde0f],'Set'));_0x5f02cf+=0x1;}}_0x121883[_0x1cc1('0x92')](new Extension(_0x499e1b,_0x5f02cf,'6',_0x1cc1('0x98')));_0x5f02cf+=0x1;_0x121883[_0x1cc1('0x92')](new Extension(_0x499e1b,_0x5f02cf,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d',_0x1cc1('0x99')));_0x5f02cf=0x0;return _0x121883;}exports[_0x1cc1('0x9a')]=function(_0x192e73,_0x33997e,_0x10bd73){var _0x3494c1;return db[_0x1cc1('0x81')][_0x1cc1('0x80')](function(_0x393812){return db[_0x1cc1('0x57')][_0x1cc1('0x5f')](_0x192e73['body'],{'transaction':_0x393812})[_0x1cc1('0x38')](function(_0x568440){_0x3494c1=_0x568440[_0x1cc1('0x39')]({'plain':!![]});return db[_0x1cc1('0x9b')][_0x1cc1('0x9c')](createExtensionsReciveFax(_0x3494c1),{'transaction':_0x393812});});})['then'](function(){return _0x3494c1;})[_0x1cc1('0x38')](respondWithResult(_0x33997e,null))[_0x1cc1('0x2b')](handleError(_0x33997e,null));};exports[_0x1cc1('0x9d')]=function(_0x444261,_0x1afc71,_0x5613d5){var _0x3edf3b;return db[_0x1cc1('0x81')][_0x1cc1('0x80')](function(_0x3a84e4){return db[_0x1cc1('0x57')][_0x1cc1('0x37')](_0x444261[_0x1cc1('0x66')],{'where':{'id':_0x444261[_0x1cc1('0x66')]['id']},'transaction':_0x3a84e4})[_0x1cc1('0x38')](function(_0x5885f5){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x444261['body']['id']},'transaction':_0x3a84e4})['then'](function(_0x530f92){return db['VoiceExtension'][_0x1cc1('0x9c')](createExtensionsReciveFax(_[_0x1cc1('0x76')](_0x444261[_0x1cc1('0x66')],[_0x1cc1('0x9e'),'key',_0x1cc1('0x9f'),_0x1cc1('0xa0'),_0x1cc1('0xa1'),_0x1cc1('0xa2')])),{'transaction':_0x3a84e4});});});})[_0x1cc1('0x38')](function(){return db[_0x1cc1('0x57')][_0x1cc1('0xa3')](_0x444261['body']['id']);})['then'](respondWithResult(_0x1afc71,null))['catch'](handleError(_0x1afc71,null));};exports[_0x1cc1('0xa4')]=function(_0x408a96,_0x127bc0,_0x44eeeb){var _0x125671={'raw':!![],'where':{}};var _0xfa98ef={};var _0x186e58={'count':0x0,'rows':[]};return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x408a96['params']['id']}})['then'](handleEntityNotFound(_0x127bc0,null))[_0x1cc1('0x38')](function(_0x4e64ef){if(_0x4e64ef){_0xfa98ef[_0x1cc1('0x45')]=_['keys'](db[_0x1cc1('0xa5')][_0x1cc1('0x41')]);_0xfa98ef[_0x1cc1('0x47')]=_['keys'](_0x408a96['query']);_0xfa98ef[_0x1cc1('0x52')]=_['intersection'](_0xfa98ef[_0x1cc1('0x45')],_0xfa98ef[_0x1cc1('0x47')]);_0x125671[_0x1cc1('0x4b')]=_[_0x1cc1('0x49')](_0xfa98ef[_0x1cc1('0x45')],qs[_0x1cc1('0x4a')](_0x408a96[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x125671[_0x1cc1('0x4b')]=_0x125671[_0x1cc1('0x4b')][_0x1cc1('0x5d')]?_0x125671[_0x1cc1('0x4b')]:_0xfa98ef[_0x1cc1('0x45')];if(!_0x408a96['query']['hasOwnProperty']('nolimit')){_0x125671[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x408a96[_0x1cc1('0x47')][_0x1cc1('0x33')]);_0x125671[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x408a96[_0x1cc1('0x47')]['offset']);}_0x125671[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x408a96[_0x1cc1('0x47')]['sort']);_0x125671['where']=qs['filters'](_['pick'](_0x408a96['query'],_0xfa98ef['filters']));_0x125671[_0x1cc1('0x50')][_0x1cc1('0x6c')]=_0x4e64ef['id'];if(_0x408a96[_0x1cc1('0x47')][_0x1cc1('0x53')]){_0x125671[_0x1cc1('0x50')]=_[_0x1cc1('0x54')](_0x125671[_0x1cc1('0x50')],{'$or':_[_0x1cc1('0x46')](_0x125671[_0x1cc1('0x4b')],function(_0x233c8c){var _0x55a66c={};_0x55a66c[_0x233c8c]={'$like':'%'+_0x408a96[_0x1cc1('0x47')][_0x1cc1('0x53')]+'%'};return _0x55a66c;})});}if(_0x408a96['query'][_0x1cc1('0xa6')]){var _0x2068f9=_0x408a96[_0x1cc1('0x47')][_0x1cc1('0xa6')][_0x1cc1('0xa7')](',');var _0x7f735c={};_0x7f735c[_0x2068f9[0x0]]={'$gte':moment(_0x2068f9[0x1])[_0x1cc1('0xa8')](_0x1cc1('0xa9'))};_0x125671[_0x1cc1('0x50')]=_['merge'](_0x125671['where'],_0x7f735c);}_0x125671=_[_0x1cc1('0x54')]({},_0x125671,_0x408a96[_0x1cc1('0x55')]);return db[_0x1cc1('0xa5')][_0x1cc1('0x32')]({'where':_0x125671[_0x1cc1('0x50')]})[_0x1cc1('0x38')](function(_0x6ed7dc){_0x186e58[_0x1cc1('0x32')]=_0x6ed7dc;if(_0x408a96[_0x1cc1('0x47')][_0x1cc1('0x6d')]){_0x125671['include']=[{'all':!![]}];}return db[_0x1cc1('0xa5')][_0x1cc1('0x58')](_0x125671);})[_0x1cc1('0x38')](function(_0x3863e0){_0x186e58[_0x1cc1('0x59')]=_0x3863e0;return _0x186e58;});}})[_0x1cc1('0x38')](respondWithFilteredResult(_0x127bc0,_0x125671))['catch'](handleError(_0x127bc0,null));};exports[_0x1cc1('0x88')]=function(_0x1b37cd,_0x4ac0ab,_0x48d5aa){var _0x45d8f9,_0x41b30b={},_0xa496ea;if(_0x1b37cd['body']['to']){_0xa496ea=_0x1b37cd['body']['to'][0x0];}return db[_0x1cc1('0x57')]['find']({'where':{'id':_0x1b37cd[_0x1cc1('0x5b')]['id']},'include':[{'model':db[_0x1cc1('0xaa')],'as':_0x1cc1('0xab'),'include':[{'model':db['CmContact'],'as':_0x1cc1('0xac'),'where':{'fax':_0xa496ea},'limit':0x1,'order':[[_0x1cc1('0xa0'),'DESC']]}]}]})[_0x1cc1('0x38')](handleEntityNotFound(_0x4ac0ab,null))[_0x1cc1('0x38')](function(_0x4376eb){_0x45d8f9=_0x4376eb;if(_0x1b37cd['body']['attachments']&&_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][_0x1cc1('0x5d')]){for(var _0x4937f3=0x0;_0x4937f3<_0x1b37cd[_0x1cc1('0x66')]['attachments'][_0x1cc1('0x5d')];_0x4937f3+=0x1){_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][_0x4937f3]={'filename':_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][_0x4937f3]['name'],'id':_0x1b37cd[_0x1cc1('0x66')]['attachments'][_0x4937f3]['id'],'path':path[_0x1cc1('0xae')](config['root'],'server/files/attachments',_0x1b37cd['body'][_0x1cc1('0xad')][_0x4937f3][_0x1cc1('0xaf')])};}}return respondWithRpcPromise(_0x1cc1('0xb0'),_0x1cc1('0xb0'),{'FaxAccountId':_[_0x1cc1('0xb1')](_0x1b37cd[_0x1cc1('0x5b')]['id'])?undefined:_0x1b37cd[_0x1cc1('0x5b')]['id'],'path':_[_0x1cc1('0xb1')](_0x1b37cd['body'][_0x1cc1('0xad')][0x0][_0x1cc1('0x7')])?undefined:_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0][_0x1cc1('0x7')],'fax':_[_0x1cc1('0xb1')](_0x1b37cd[_0x1cc1('0x66')]['to'][0x0])?undefined:_0x1b37cd[_0x1cc1('0x66')]['to'][0x0]},client9002);})['then'](function(){if(_0x45d8f9){if(_[_0x1cc1('0xb1')](_0x1b37cd[_0x1cc1('0x66')]['from'])){_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xb2')]=util[_0x1cc1('0xa8')]('\x22%s\x22\x20<%s>',_0x45d8f9[_0x1cc1('0x3e')],_0x45d8f9[_0x1cc1('0xb3')]);}if(_0x45d8f9[_0x1cc1('0xab')]){if(_0x45d8f9[_0x1cc1('0xab')][_0x1cc1('0xac')]['length']){return _0x45d8f9[_0x1cc1('0xab')][_0x1cc1('0xac')][0x0];}else{return db[_0x1cc1('0x78')][_0x1cc1('0x5f')](_[_0x1cc1('0xb4')](_0x1b37cd[_0x1cc1('0x66')],{'firstName':_0x1b37cd[_0x1cc1('0x66')]['to'][0x0],'phone':_0x1b37cd[_0x1cc1('0x66')]['to'][0x0],'fax':_0x1b37cd[_0x1cc1('0x66')]['to'][0x0],'ListId':_0x45d8f9[_0x1cc1('0xa2')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x1cc1('0x38')](function(_0x58b550){if(_0x58b550){return db[_0x1cc1('0x75')][_0x1cc1('0x5e')]({'where':{'ContactId':_0x58b550['id'],'closed':![],'FaxAccountId':_0x45d8f9['id']}})[_0x1cc1('0x38')](function(_0x11b57d){if(_0x11b57d){return[_0x11b57d,![]];}return db[_0x1cc1('0x75')][_0x1cc1('0x5f')]({'UserId':_0x1b37cd['user']['id'],'ContactId':_0x58b550['id'],'FaxAccountId':_0x45d8f9['id'],'fax':_0x1b37cd[_0x1cc1('0x66')]['to'][0x0],'firstMsgDirection':_0x1cc1('0xb5'),'Messages':[_[_0x1cc1('0x54')](_0x1b37cd[_0x1cc1('0x66')],{'read':![],'body':_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0]['filename'],'FaxAccountId':_0x45d8f9['id'],'UserId':_0x1b37cd[_0x1cc1('0x60')]['id'],'ContactId':_0x58b550['id'],'AttachmentId':_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x1cc1('0xb6')}]})[_0x1cc1('0x38')](function(_0x59674e){return[_0x59674e,!![]];});});}else{throw new Error(_0x1cc1('0xb7'));}})[_0x1cc1('0xb8')](function(_0x483590,_0x264377){if(_0x264377){return _0x483590;}return db[_0x1cc1('0xa5')][_0x1cc1('0x5f')]({'direction':'out','read':![],'body':_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0][_0x1cc1('0xb9')],'FaxAccountId':_0x45d8f9['id'],'FaxInteractionId':_0x483590['id'],'UserId':_0x1b37cd['user']['id'],'ContactId':_0x483590['ContactId'],'AttachmentId':_0x1b37cd['body'][_0x1cc1('0xad')][0x0]['id']})[_0x1cc1('0x38')](function(_0x3949fb){_0x483590[_0x1cc1('0xba')][_0x1cc1('0xb6')]=[];_0x483590['dataValues']['Messages'][_0x1cc1('0x92')](_0x3949fb[_0x1cc1('0xba')]);return _0x483590;});})['then'](function(_0x35ebda){respondWithRpcPromise('SendFax',_0x1cc1('0xbb'),{'FaxAccountId':_[_0x1cc1('0xb1')](_0x1b37cd['params']['id'])?undefined:_0x1b37cd[_0x1cc1('0x5b')]['id'],'path':_['isNil'](_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0][_0x1cc1('0x7')])?undefined:_0x1b37cd[_0x1cc1('0x66')]['attachments'][0x0]['path'],'fax':_[_0x1cc1('0xb1')](_0x1b37cd[_0x1cc1('0x66')]['to'][0x0])?undefined:_0x1b37cd[_0x1cc1('0x66')]['to'][0x0],'AttachmentId':_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0]['id']},client9002)[_0x1cc1('0x38')](function(_0x4ba1f3){logger[_0x1cc1('0x22')](_0x1cc1('0xbc'),_0x4ba1f3);})[_0x1cc1('0x2b')](function(_0x35f3cb){logger[_0x1cc1('0x22')](_0x1cc1('0xbc'),_0x35f3cb);});return _0x35ebda;})[_0x1cc1('0x38')](respondWithResult(_0x4ac0ab,null))['catch'](handleError(_0x4ac0ab,null));};exports['addAgents']=function(_0x564fff,_0x48029a,_0x4c2f22){return db['FaxAccount']['find']({'where':{'id':_0x564fff['params']['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x48029a,null))['then'](function(_0x3a945c){if(_0x3a945c){return _0x3a945c[_0x1cc1('0xbd')](_0x564fff[_0x1cc1('0x66')][_0x1cc1('0x6f')],_[_0x1cc1('0x76')](_0x564fff['body'],['ids','id'])||{})[_0x1cc1('0xb8')](function(_0x5a3c83){for(var _0x39a9f3=0x0;_0x39a9f3<_0x564fff[_0x1cc1('0x66')][_0x1cc1('0x6f')][_0x1cc1('0x5d')];_0x39a9f3+=0x1){socket[_0x1cc1('0xbe')](_0x1cc1('0xbf'),{'UserId':Number(_0x564fff[_0x1cc1('0x66')]['ids'][_0x39a9f3]),'FaxAccountId':Number(_0x564fff[_0x1cc1('0x5b')]['id'])});}return _0x5a3c83;});}})[_0x1cc1('0x38')](respondWithResult(_0x48029a,null))[_0x1cc1('0x2b')](handleError(_0x48029a,null));};exports[_0x1cc1('0xc0')]=function(_0x1b998d,_0x5388fd,_0x3ef131){return db[_0x1cc1('0x57')][_0x1cc1('0x5e')]({'where':{'id':_0x1b998d[_0x1cc1('0x5b')]['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x5388fd,null))[_0x1cc1('0x38')](function(_0xa5c0ed){if(_0xa5c0ed){return _0xa5c0ed[_0x1cc1('0xc0')](_0x1b998d[_0x1cc1('0x47')]['ids'])[_0x1cc1('0x38')](function(){if(_['isArray'](_0x1b998d[_0x1cc1('0x47')]['ids'])){for(var _0x4df04d=0x0;_0x4df04d<_0x1b998d[_0x1cc1('0x47')][_0x1cc1('0x6f')][_0x1cc1('0x5d')];_0x4df04d+=0x1){socket[_0x1cc1('0xbe')](_0x1cc1('0xc1'),{'UserId':Number(_0x1b998d[_0x1cc1('0x47')][_0x1cc1('0x6f')][_0x4df04d]),'FaxAccountId':Number(_0x1b998d['params']['id'])});}}else{socket['emit'](_0x1cc1('0xc1'),{'UserId':Number(_0x1b998d[_0x1cc1('0x47')]['ids']),'FaxAccountId':Number(_0x1b998d['params']['id'])});}});}})[_0x1cc1('0x38')](respondWithStatusCode(_0x5388fd,null))[_0x1cc1('0x2b')](handleError(_0x5388fd,null));};exports[_0x1cc1('0xc2')]=function(_0x429f14,_0x8a4fbf,_0x49b5af){var _0x304e67={};var _0x1afd61={};var _0x3871f7;var _0x386c17;return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x429f14[_0x1cc1('0x5b')]['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x8a4fbf,null))[_0x1cc1('0x38')](function(_0x114bc8){if(_0x114bc8){_0x3871f7=_0x114bc8;_0x1afd61[_0x1cc1('0x45')]=_['keys'](db[_0x1cc1('0x7a')][_0x1cc1('0x41')]);_0x1afd61[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x429f14[_0x1cc1('0x47')]);_0x1afd61[_0x1cc1('0x52')]=_[_0x1cc1('0x49')](_0x1afd61[_0x1cc1('0x45')],_0x1afd61['query']);_0x304e67[_0x1cc1('0x4b')]=_['intersection'](_0x1afd61[_0x1cc1('0x45')],qs[_0x1cc1('0x4a')](_0x429f14['query'][_0x1cc1('0x4a')]));_0x304e67['attributes']=_0x304e67['attributes'][_0x1cc1('0x5d')]?_0x304e67[_0x1cc1('0x4b')]:_0x1afd61[_0x1cc1('0x45')];_0x304e67[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x429f14[_0x1cc1('0x47')][_0x1cc1('0x4f')]);_0x304e67[_0x1cc1('0x50')]=qs[_0x1cc1('0x52')](_[_0x1cc1('0x51')](_0x429f14['query'],_0x1afd61[_0x1cc1('0x52')]));if(_0x429f14['query'][_0x1cc1('0x53')]){_0x304e67[_0x1cc1('0x50')]=_[_0x1cc1('0x54')](_0x304e67[_0x1cc1('0x50')],{'$or':_[_0x1cc1('0x46')](_0x304e67[_0x1cc1('0x4b')],function(_0x1891fa){var _0x33fc41={};_0x33fc41[_0x1891fa]={'$like':'%'+_0x429f14[_0x1cc1('0x47')]['filter']+'%'};return _0x33fc41;})});}_0x304e67=_[_0x1cc1('0x54')]({},_0x304e67,_0x429f14[_0x1cc1('0x55')]);return _0x3871f7[_0x1cc1('0xc2')](_0x304e67);}})[_0x1cc1('0x38')](function(_0x4c6fd2){if(_0x4c6fd2){_0x386c17=_0x4c6fd2[_0x1cc1('0x5d')];if(!_0x429f14['query'][_0x1cc1('0x4c')](_0x1cc1('0x4d'))){_0x304e67[_0x1cc1('0x33')]=qs['limit'](_0x429f14[_0x1cc1('0x47')][_0x1cc1('0x33')]);_0x304e67[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x429f14[_0x1cc1('0x47')][_0x1cc1('0x30')]);}return _0x3871f7[_0x1cc1('0xc2')](_0x304e67);}})[_0x1cc1('0x38')](function(_0x5036a9){if(_0x5036a9){return _0x5036a9?{'count':_0x386c17,'rows':_0x5036a9}:null;}})[_0x1cc1('0x38')](respondWithResult(_0x8a4fbf,null))[_0x1cc1('0x2b')](handleError(_0x8a4fbf,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9fc58f2..1105473 100644 --- a/server/api/faxAccount/faxAccount.events.js +++ b/server/api/faxAccount/faxAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a21=['update','remove','emit','hook','../../mysqldb','FaxAccount','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a21,0xf9));var _0x16a2=function(_0x3b1fea,_0x3d7034){_0x3b1fea=_0x3b1fea-0x0;var _0x2944e7=_0x6a21[_0x3b1fea];return _0x2944e7;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x16a2('0x0'))['db'][_0x16a2('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x16a2('0x2'),'afterUpdate':_0x16a2('0x3'),'afterDestroy':_0x16a2('0x4')};function emitEvent(_0x18e0e6){return function(_0x3304d3,_0x501069,_0x4c40eb){FaxAccountEvents[_0x16a2('0x5')](_0x18e0e6+':'+_0x3304d3['id'],_0x3304d3);FaxAccountEvents[_0x16a2('0x5')](_0x18e0e6,_0x3304d3);_0x4c40eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x16a2('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x95a2=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3db285,_0x2ce3dc){var _0x287478=function(_0x146324){while(--_0x146324){_0x3db285['push'](_0x3db285['shift']());}};_0x287478(++_0x2ce3dc);}(_0x95a2,0x120));var _0x295a=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x95a2[_0xbf8ebe];return _0x1e25e8;};'use strict';var EventEmitter=require(_0x295a('0x0'));var FaxAccount=require(_0x295a('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x295a('0x2')](0x0);var events={'afterCreate':_0x295a('0x3'),'afterUpdate':_0x295a('0x4'),'afterDestroy':_0x295a('0x5')};function emitEvent(_0x294eca){return function(_0x4c797f,_0x1c2169,_0x20a3bf){FaxAccountEvents['emit'](_0x294eca+':'+_0x4c797f['id'],_0x4c797f);FaxAccountEvents[_0x295a('0x6')](_0x294eca,_0x4c797f);_0x20a3bf(null);};}for(var e in events){if(events[_0x295a('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x295a('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 5569a2a..4037ae4 100644 --- a/server/api/faxAccount/faxAccount.model.js +++ b/server/api/faxAccount/faxAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a53=['rimraf','../../config/environment','exports','define','fax_accounts','lodash','util','api','bluebird','path'];(function(_0x4fae76,_0x5dd8e5){var _0x16f6ae=function(_0x5b0128){while(--_0x5b0128){_0x4fae76['push'](_0x4fae76['shift']());}};_0x16f6ae(++_0x5dd8e5);}(_0x0a53,0x163));var _0x30a5=function(_0x19e206,_0x3e945d){_0x19e206=_0x19e206-0x0;var _0x531b21=_0x0a53[_0x19e206];return _0x531b21;};'use strict';var _=require(_0x30a5('0x0'));var util=require(_0x30a5('0x1'));var logger=require('../../config/logger')(_0x30a5('0x2'));var moment=require('moment');var BPromise=require(_0x30a5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x30a5('0x4'));var rimraf=require(_0x30a5('0x5'));var config=require(_0x30a5('0x6'));var attributes=require('./faxAccount.attributes');module[_0x30a5('0x7')]=function(_0x34b50d,_0x4b77b6){return _0x34b50d[_0x30a5('0x8')]('FaxAccount',attributes,{'tableName':_0x30a5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c0a=['../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1e25de,_0xf8a6ce){var _0x5f3cc8=function(_0x8cc260){while(--_0x8cc260){_0x1e25de['push'](_0x1e25de['shift']());}};_0x5f3cc8(++_0xf8a6ce);}(_0x7c0a,0xa1));var _0xa7c0=function(_0x20794f,_0x5ee4c7){_0x20794f=_0x20794f-0x0;var _0x4108b4=_0x7c0a[_0x20794f];return _0x4108b4;};'use strict';var _=require(_0xa7c0('0x0'));var util=require('util');var logger=require(_0xa7c0('0x1'))(_0xa7c0('0x2'));var moment=require(_0xa7c0('0x3'));var BPromise=require(_0xa7c0('0x4'));var rp=require(_0xa7c0('0x5'));var fs=require('fs');var path=require(_0xa7c0('0x6'));var rimraf=require('rimraf');var config=require(_0xa7c0('0x7'));var attributes=require(_0xa7c0('0x8'));module[_0xa7c0('0x9')]=function(_0x3e84d3,_0x120ac5){return _0x3e84d3['define'](_0xa7c0('0xa'),attributes,{'tableName':_0xa7c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 54c1413..b174e7a 100644 --- a/server/api/faxAccount/faxAccount.rpc.js +++ b/server/api/faxAccount/faxAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x358b=['created','interaction','ContactId','AttachmentId','UserId','User','agent','name','waitForTheAssignedAgent','startRouting','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','account','CmList','List','Contacts','FaxApplication','Applications','get','applications','orderBy','priority','asc','length','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged'];(function(_0xa14d8c,_0x14759b){var _0x3facda=function(_0x13c866){while(--_0x13c866){_0xa14d8c['push'](_0xa14d8c['shift']());}};_0x3facda(++_0x14759b);}(_0x358b,0x1c2));var _0xb358=function(_0x3bedac,_0x1c22a3){_0x3bedac=_0x3bedac-0x0;var _0x54a37d=_0x358b[_0x3bedac];return _0x54a37d;};'use strict';var _=require(_0xb358('0x0'));var util=require(_0xb358('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb358('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb358('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb358('0x4'))(_0xb358('0x5'));var config=require(_0xb358('0x6'));var jayson=require(_0xb358('0x7'));var client=jayson['client'][_0xb358('0x8')]({'port':0x232c});config['redis']=_[_0xb358('0x9')](config[_0xb358('0xa')],{'host':_0xb358('0xb'),'port':0x18eb});var socket=require(_0xb358('0xc'))(new Redis(config[_0xb358('0xa')]));require(_0xb358('0xd'))[_0xb358('0xe')](socket);function respondWithRpcPromise(_0x3bad43,_0x265460,_0x3c2623){return new BPromise(function(_0xf77fe,_0x64a184){return client[_0xb358('0xf')](_0x3bad43,_0x3c2623)[_0xb358('0x10')](function(_0x5b4eae){logger['info']('FaxAccount,\x20%s,\x20%s',_0x265460,_0xb358('0x11'));logger[_0xb358('0x12')](_0xb358('0x13'),_0x265460,_0xb358('0x11'),JSON[_0xb358('0x14')](_0x5b4eae));if(_0x5b4eae[_0xb358('0x15')]){if(_0x5b4eae[_0xb358('0x15')][_0xb358('0x16')]===0x1f4){logger['error'](_0xb358('0x17'),_0x265460,_0x5b4eae[_0xb358('0x15')][_0xb358('0x18')]);return _0x64a184(_0x5b4eae[_0xb358('0x15')]['message']);}logger[_0xb358('0x15')](_0xb358('0x17'),_0x265460,_0x5b4eae[_0xb358('0x15')]['message']);return _0xf77fe(_0x5b4eae[_0xb358('0x15')]['message']);}else{logger[_0xb358('0x19')]('FaxAccount,\x20%s,\x20%s',_0x265460,'request\x20sent');_0xf77fe(_0x5b4eae['result']['message']);}})[_0xb358('0x1a')](function(_0x6559b9){logger[_0xb358('0x15')](_0xb358('0x17'),_0x265460,_0x6559b9);_0x64a184(_0x6559b9);});});}exports[_0xb358('0x1b')]=function(_0x9e70fd){var _0x56a22d=this;return new Promise(function(_0x18d154,_0x2149ae){return db[_0xb358('0x1c')][_0xb358('0x1d')]({'raw':_0x9e70fd[_0xb358('0x1e')]?_0x9e70fd[_0xb358('0x1e')][_0xb358('0x1f')]===undefined?!![]:![]:!![],'where':_0x9e70fd[_0xb358('0x1e')]?_0x9e70fd['options'][_0xb358('0x20')]||null:null,'attributes':_0x9e70fd['options']?_0x9e70fd[_0xb358('0x1e')][_0xb358('0x21')]||null:null,'limit':_0x9e70fd[_0xb358('0x1e')]?_0x9e70fd[_0xb358('0x1e')][_0xb358('0x22')]||null:null,'include':_0x9e70fd[_0xb358('0x1e')]?_0x9e70fd[_0xb358('0x1e')][_0xb358('0x23')]?_[_0xb358('0x24')](_0x9e70fd[_0xb358('0x1e')][_0xb358('0x23')],function(_0xd82586){return{'model':db[_0xd82586[_0xb358('0x25')]],'as':_0xd82586['as'],'attributes':_0xd82586[_0xb358('0x21')],'include':_0xd82586[_0xb358('0x23')]?_[_0xb358('0x24')](_0xd82586[_0xb358('0x23')],function(_0x5083f4){return{'model':db[_0x5083f4['model']],'as':_0x5083f4['as'],'attributes':_0x5083f4[_0xb358('0x21')],'include':_0x5083f4[_0xb358('0x23')]?_[_0xb358('0x24')](_0x5083f4[_0xb358('0x23')],function(_0x4f3eba){return{'model':db[_0x4f3eba[_0xb358('0x25')]],'as':_0x4f3eba['as'],'attributes':_0x4f3eba[_0xb358('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5779d4){logger[_0xb358('0x19')](_0xb358('0x1b'),_0x9e70fd);logger[_0xb358('0x12')]('GetFaxAccount',_0x9e70fd,JSON[_0xb358('0x14')](_0x5779d4));_0x18d154(_0x5779d4);})[_0xb358('0x1a')](function(_0x5b30bb){logger['error']('GetFaxAccount',_0x5b30bb[_0xb358('0x18')],_0x9e70fd);_0x2149ae(_0x56a22d[_0xb358('0x15')](0x1f4,_0x5b30bb[_0xb358('0x18')]));});});};exports[_0xb358('0x26')]=function(_0x3ec8a5,_0x7d439d,_0x4ef157){var _0x3bffb9=this;return new Promise(function(_0x2962a1,_0x126bac){var _0x533035={'body':_0x3ec8a5[_0xb358('0x27')],'channel':'fax'};var _0x44a1e3=[];var _0x46ce97=[];var _0x3f73fb={};return db[_0xb358('0x28')][_0xb358('0x29')]()['then'](function(_0x36ba00){if(!_0x36ba00){throw new db[(_0xb358('0x2a'))]['ValidationError'](_0xb358('0x2b'));}_0x44a1e3=_[_0xb358('0x2c')](_['keys'](_0x36ba00),[_0xb358('0x2d'),_0xb358('0x2e')]);_0x46ce97=_[_0xb358('0x2c')](_[_0xb358('0x2f')](_0x36ba00),[_0xb358('0x2d'),'updatedAt',_0xb358('0x30'),_0xb358('0x31')]);if(_0x3ec8a5[_0xb358('0x27')]['id']){delete _0x3ec8a5['body']['id'];}if(_[_0xb358('0x32')](_0x3ec8a5[_0xb358('0x27')][_0xb358('0x33')])){throw new db[(_0xb358('0x2a'))][(_0xb358('0x34'))]('from\x20is\x20mandatory');}if(_[_0xb358('0x32')](_0x3ec8a5[_0xb358('0x27')]['body'])||_0x3ec8a5[_0xb358('0x27')][_0xb358('0x27')]===''){throw new db[(_0xb358('0x2a'))]['ValidationError'](_0xb358('0x35'));}if(_[_0xb358('0x32')](_0x3ec8a5[_0xb358('0x27')]['mapKey'])){throw new db[(_0xb358('0x2a'))]['ValidationError'](_0xb358('0x36')+_0x46ce97);}if(!_[_0xb358('0x37')](_0x46ce97,_0x3ec8a5['body'][_0xb358('0x38')])){throw new db[(_0xb358('0x2a'))][(_0xb358('0x34'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46ce97);}_0x3f73fb[_0x3ec8a5[_0xb358('0x27')][_0xb358('0x38')]]=_0x3ec8a5[_0xb358('0x27')][_0xb358('0x33')];})['then'](function(){return db[_0xb358('0x1c')][_0xb358('0x39')]({'where':{'id':_0x3ec8a5[_0xb358('0x3a')]['id']},'include':[{'model':db[_0xb358('0x3b')],'as':_0xb358('0x3c'),'include':[{'model':db[_0xb358('0x28')],'as':_0xb358('0x3d'),'where':_0x3f73fb,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xb358('0x3e')],'as':_0xb358('0x3f')}]});})[_0xb358('0x10')](function(_0x4766ff){if(_0x4766ff&&_0x4766ff[_0xb358('0x3c')]){var _0xcc0991=_0x4766ff[_0xb358('0x40')]({'plain':!![]});_0x533035[_0xb358('0x3a')]=_0xcc0991;_0x533035[_0xb358('0x41')]=_0xcc0991[_0xb358('0x3f')];_0x533035['list']=_0xcc0991[_0xb358('0x3c')];_0x533035[_0xb358('0x41')]=_[_0xb358('0x42')](_0x533035['applications'],[_0xb358('0x43')],[_0xb358('0x44')]);if(_0x533035[_0xb358('0x3a')][_0xb358('0x3f')]){delete _0x533035[_0xb358('0x3a')]['Applications'];}if(_0x533035[_0xb358('0x3a')][_0xb358('0x3c')]&&_0x533035['account']['List'][_0xb358('0x3d')][_0xb358('0x45')]){return _0x533035[_0xb358('0x3a')][_0xb358('0x3c')][_0xb358('0x3d')][0x0];}var _0x5727dc=_[_0xb358('0x9')](_0x3ec8a5[_0xb358('0x27')],{'firstName':_0x3ec8a5[_0xb358('0x27')][_0xb358('0x33')],'ListId':_0xcc0991[_0xb358('0x31')]});_0x5727dc[_0x3ec8a5[_0xb358('0x27')][_0xb358('0x38')]]=_0x3ec8a5['body'][_0xb358('0x33')];return db[_0xb358('0x28')][_0xb358('0x46')](_0x5727dc,{'fields':_0x44a1e3,'raw':!![]});}})[_0xb358('0x10')](function(_0x289316){_0x533035['contact']=_0x289316;if(_0x289316){var _0x24d974={'ContactId':_0x289316['id'],'FaxAccountId':_0x3ec8a5[_0xb358('0x3a')]['id'],'fax':_0x289316['fax']};return db[_0xb358('0x47')][_0xb358('0x39')]({'where':{'ContactId':_0x289316['id'],'closed':![],'FaxAccountId':_0x3ec8a5[_0xb358('0x3a')]['id']}})[_0xb358('0x10')](function(_0x519d06){if(_0x519d06){return[_0x519d06,![]];}return db[_0xb358('0x47')][_0xb358('0x46')](_0x24d974)[_0xb358('0x10')](function(_0x41abb0){return[_0x41abb0,!![]];});});}else{throw new Error(_0xb358('0x48'));}})[_0xb358('0x49')](function(_0x4fbb16,_0x4387e9){var _0x1b09fc=_0x4fbb16[_0xb358('0x40')]({'plain':!![]});if(_0x4387e9){if(_0x533035['account'][_0xb358('0x4a')]){_0x533035['applications'][_0xb358('0x4b')]({'id':0x0,'priority':_0x533035['applications'][_0xb358('0x45')]+0x1,'app':_0xb358('0x4c'),'appdata':_0xb358('0x4d'),'interval':'*,*,*,*'});}_0x1b09fc['created']=!![];}else{_0x1b09fc[_0xb358('0x4e')]=![];}_0x533035[_0xb358('0x4f')]=_0x1b09fc;return db['FaxMessage'][_0xb358('0x46')]({'body':_0x3ec8a5['body']['body'],'FaxAccountId':_0x3ec8a5[_0xb358('0x3a')]['id'],'FaxInteractionId':_0x4fbb16['id'],'direction':'in','ContactId':_0x4fbb16[_0xb358('0x50')],'AttachmentId':_0x3ec8a5[_0xb358('0x27')][_0xb358('0x51')]});})[_0xb358('0x10')](function(_0x10ed9c){_0x533035[_0xb358('0x18')]=_0x10ed9c;if(_0x533035[_0xb358('0x4f')][_0xb358('0x52')]){return db[_0xb358('0x53')][_0xb358('0x39')]({'attributes':['id','name'],'where':{'id':_0x533035[_0xb358('0x4f')]['UserId']}})[_0xb358('0x10')](function(_0x112092){if(_0x112092){_0x533035[_0xb358('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb358('0x54'),'appdata':_0x112092[_0xb358('0x55')]+','+(_0x533035[_0xb358('0x3a')][_0xb358('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xb358('0x57'),_0x533035);});}return respondWithRpcPromise('Start',_0xb358('0x57'),_0x533035);})[_0xb358('0x10')](function(_0x5c3bdc){_0x2962a1(_0x5c3bdc);})['catch'](function(_0x427a93){_0x126bac(_0x3bffb9['error'](0x1f4,_0x427a93[_0xb358('0x18')]));});});}; \ No newline at end of file +var _0x3a83=['where','attributes','limit','include','map','model','debug','NotifyFaxAccount','body','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','DESC','FaxApplication','get','applications','Applications','list','priority','asc','Contacts','defaults','create','contact','fax','FaxInteraction','spread','autoclose','push','length','close','created','AttachmentId','interaction','User','name','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','message','error','result','catch','GetFaxAccount','findAll','raw','options'];(function(_0x2479c5,_0x4703ae){var _0x870e13=function(_0x261f7b){while(--_0x261f7b){_0x2479c5['push'](_0x2479c5['shift']());}};_0x870e13(++_0x4703ae);}(_0x3a83,0x145));var _0x33a8=function(_0x277b19,_0x3b6aac){_0x277b19=_0x277b19-0x0;var _0x1fdb96=_0x3a83[_0x277b19];return _0x1fdb96;};'use strict';var _=require(_0x33a8('0x0'));var util=require(_0x33a8('0x1'));var moment=require(_0x33a8('0x2'));var BPromise=require('bluebird');var rs=require(_0x33a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33a8('0x4'))['db'];var utils=require(_0x33a8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x33a8('0x6'));var jayson=require(_0x33a8('0x7'));var client=jayson[_0x33a8('0x8')][_0x33a8('0x9')]({'port':0x232c});config[_0x33a8('0xa')]=_['defaults'](config[_0x33a8('0xa')],{'host':_0x33a8('0xb'),'port':0x18eb});var socket=require(_0x33a8('0xc'))(new Redis(config[_0x33a8('0xa')]));require('./faxAccount.socket')[_0x33a8('0xd')](socket);function respondWithRpcPromise(_0x556bf4,_0x1aedad,_0x36d201){return new BPromise(function(_0x47bc71,_0x3e98e3){return client['request'](_0x556bf4,_0x36d201)[_0x33a8('0xe')](function(_0x2ec2c1){logger[_0x33a8('0xf')](_0x33a8('0x10'),_0x1aedad,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1aedad,_0x33a8('0x11'),JSON[_0x33a8('0x12')](_0x2ec2c1));if(_0x2ec2c1['error']){if(_0x2ec2c1['error']['code']===0x1f4){logger['error'](_0x33a8('0x10'),_0x1aedad,_0x2ec2c1['error'][_0x33a8('0x13')]);return _0x3e98e3(_0x2ec2c1['error'][_0x33a8('0x13')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x1aedad,_0x2ec2c1[_0x33a8('0x14')]['message']);return _0x47bc71(_0x2ec2c1[_0x33a8('0x14')][_0x33a8('0x13')]);}else{logger['info'](_0x33a8('0x10'),_0x1aedad,_0x33a8('0x11'));_0x47bc71(_0x2ec2c1[_0x33a8('0x15')]['message']);}})[_0x33a8('0x16')](function(_0x21cf84){logger[_0x33a8('0x14')](_0x33a8('0x10'),_0x1aedad,_0x21cf84);_0x3e98e3(_0x21cf84);});});}exports[_0x33a8('0x17')]=function(_0x2381c3){var _0x558971=this;return new Promise(function(_0x6dda79,_0x221e3e){return db['FaxAccount'][_0x33a8('0x18')]({'raw':_0x2381c3['options']?_0x2381c3['options'][_0x33a8('0x19')]===undefined?!![]:![]:!![],'where':_0x2381c3['options']?_0x2381c3[_0x33a8('0x1a')][_0x33a8('0x1b')]||null:null,'attributes':_0x2381c3[_0x33a8('0x1a')]?_0x2381c3[_0x33a8('0x1a')][_0x33a8('0x1c')]||null:null,'limit':_0x2381c3[_0x33a8('0x1a')]?_0x2381c3[_0x33a8('0x1a')][_0x33a8('0x1d')]||null:null,'include':_0x2381c3[_0x33a8('0x1a')]?_0x2381c3[_0x33a8('0x1a')][_0x33a8('0x1e')]?_[_0x33a8('0x1f')](_0x2381c3[_0x33a8('0x1a')][_0x33a8('0x1e')],function(_0x552947){return{'model':db[_0x552947['model']],'as':_0x552947['as'],'attributes':_0x552947[_0x33a8('0x1c')],'include':_0x552947[_0x33a8('0x1e')]?_['map'](_0x552947['include'],function(_0x593551){return{'model':db[_0x593551[_0x33a8('0x20')]],'as':_0x593551['as'],'attributes':_0x593551[_0x33a8('0x1c')],'include':_0x593551['include']?_['map'](_0x593551[_0x33a8('0x1e')],function(_0x3ee69c){return{'model':db[_0x3ee69c['model']],'as':_0x3ee69c['as'],'attributes':_0x3ee69c[_0x33a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x33a8('0xe')](function(_0x4d5476){logger[_0x33a8('0xf')]('GetFaxAccount',_0x2381c3);logger[_0x33a8('0x21')](_0x33a8('0x17'),_0x2381c3,JSON['stringify'](_0x4d5476));_0x6dda79(_0x4d5476);})[_0x33a8('0x16')](function(_0x319149){logger['error'](_0x33a8('0x17'),_0x319149['message'],_0x2381c3);_0x221e3e(_0x558971[_0x33a8('0x14')](0x1f4,_0x319149[_0x33a8('0x13')]));});});};exports[_0x33a8('0x22')]=function(_0x1904db,_0x21171f,_0x344e14){var _0x5154b4=this;return new Promise(function(_0x2841e6,_0x369933){var _0x2dbb6c={'body':_0x1904db[_0x33a8('0x23')],'channel':'fax'};var _0x3ad46a=[];var _0x28c152=[];var _0x5f1738={};return db[_0x33a8('0x24')]['describe']()['then'](function(_0x582e32){if(!_0x582e32){throw new db['Sequelize'][(_0x33a8('0x25'))](_0x33a8('0x26'));}_0x3ad46a=_[_0x33a8('0x27')](_['keys'](_0x582e32),[_0x33a8('0x28'),_0x33a8('0x29')]);_0x28c152=_[_0x33a8('0x27')](_[_0x33a8('0x2a')](_0x582e32),[_0x33a8('0x28'),'updatedAt',_0x33a8('0x2b'),_0x33a8('0x2c')]);if(_0x1904db[_0x33a8('0x23')]['id']){delete _0x1904db[_0x33a8('0x23')]['id'];}if(_[_0x33a8('0x2d')](_0x1904db[_0x33a8('0x23')][_0x33a8('0x2e')])){throw new db[(_0x33a8('0x2f'))][(_0x33a8('0x25'))](_0x33a8('0x30'));}if(_[_0x33a8('0x2d')](_0x1904db['body']['body'])||_0x1904db[_0x33a8('0x23')][_0x33a8('0x23')]===''){throw new db[(_0x33a8('0x2f'))][(_0x33a8('0x25'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x33a8('0x2d')](_0x1904db[_0x33a8('0x23')][_0x33a8('0x31')])){throw new db[(_0x33a8('0x2f'))][(_0x33a8('0x25'))](_0x33a8('0x32')+_0x28c152);}if(!_[_0x33a8('0x33')](_0x28c152,_0x1904db[_0x33a8('0x23')][_0x33a8('0x31')])){throw new db['Sequelize'][(_0x33a8('0x25'))](_0x33a8('0x34')+_0x28c152);}_0x5f1738[_0x1904db[_0x33a8('0x23')][_0x33a8('0x31')]]=_0x1904db[_0x33a8('0x23')]['from'];})[_0x33a8('0xe')](function(){return db[_0x33a8('0x35')][_0x33a8('0x36')]({'where':{'id':_0x1904db[_0x33a8('0x37')]['id']},'include':[{'model':db[_0x33a8('0x38')],'as':_0x33a8('0x39'),'include':[{'model':db[_0x33a8('0x24')],'as':'Contacts','where':_0x5f1738,'limit':0x1,'order':[['updatedAt',_0x33a8('0x3a')]]}]},{'model':db[_0x33a8('0x3b')],'as':'Applications'}]});})[_0x33a8('0xe')](function(_0x4efad8){if(_0x4efad8&&_0x4efad8['List']){var _0x232f6f=_0x4efad8[_0x33a8('0x3c')]({'plain':!![]});_0x2dbb6c[_0x33a8('0x37')]=_0x232f6f;_0x2dbb6c[_0x33a8('0x3d')]=_0x232f6f[_0x33a8('0x3e')];_0x2dbb6c[_0x33a8('0x3f')]=_0x232f6f[_0x33a8('0x39')];_0x2dbb6c[_0x33a8('0x3d')]=_['orderBy'](_0x2dbb6c[_0x33a8('0x3d')],[_0x33a8('0x40')],[_0x33a8('0x41')]);if(_0x2dbb6c[_0x33a8('0x37')][_0x33a8('0x3e')]){delete _0x2dbb6c['account'][_0x33a8('0x3e')];}if(_0x2dbb6c[_0x33a8('0x37')][_0x33a8('0x39')]&&_0x2dbb6c[_0x33a8('0x37')][_0x33a8('0x39')][_0x33a8('0x42')]['length']){return _0x2dbb6c[_0x33a8('0x37')][_0x33a8('0x39')][_0x33a8('0x42')][0x0];}var _0x134a7b=_[_0x33a8('0x43')](_0x1904db[_0x33a8('0x23')],{'firstName':_0x1904db[_0x33a8('0x23')][_0x33a8('0x2e')],'ListId':_0x232f6f[_0x33a8('0x2c')]});_0x134a7b[_0x1904db[_0x33a8('0x23')][_0x33a8('0x31')]]=_0x1904db['body'][_0x33a8('0x2e')];return db['CmContact'][_0x33a8('0x44')](_0x134a7b,{'fields':_0x3ad46a,'raw':!![]});}})[_0x33a8('0xe')](function(_0xe043e4){_0x2dbb6c[_0x33a8('0x45')]=_0xe043e4;if(_0xe043e4){var _0x2e58d8={'ContactId':_0xe043e4['id'],'FaxAccountId':_0x1904db['account']['id'],'fax':_0xe043e4[_0x33a8('0x46')]};return db['FaxInteraction'][_0x33a8('0x36')]({'where':{'ContactId':_0xe043e4['id'],'closed':![],'FaxAccountId':_0x1904db['account']['id']}})[_0x33a8('0xe')](function(_0x56c061){if(_0x56c061){return[_0x56c061,![]];}return db[_0x33a8('0x47')][_0x33a8('0x44')](_0x2e58d8)[_0x33a8('0xe')](function(_0x5d7d50){return[_0x5d7d50,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x33a8('0x48')](function(_0x18999a,_0xf8042f){var _0x1ef540=_0x18999a[_0x33a8('0x3c')]({'plain':!![]});if(_0xf8042f){if(_0x2dbb6c[_0x33a8('0x37')][_0x33a8('0x49')]){_0x2dbb6c[_0x33a8('0x3d')][_0x33a8('0x4a')]({'id':0x0,'priority':_0x2dbb6c[_0x33a8('0x3d')][_0x33a8('0x4b')]+0x1,'app':_0x33a8('0x4c'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x1ef540['created']=!![];}else{_0x1ef540[_0x33a8('0x4d')]=![];}_0x2dbb6c['interaction']=_0x1ef540;return db['FaxMessage'][_0x33a8('0x44')]({'body':_0x1904db[_0x33a8('0x23')][_0x33a8('0x23')],'FaxAccountId':_0x1904db[_0x33a8('0x37')]['id'],'FaxInteractionId':_0x18999a['id'],'direction':'in','ContactId':_0x18999a['ContactId'],'AttachmentId':_0x1904db[_0x33a8('0x23')][_0x33a8('0x4e')]});})[_0x33a8('0xe')](function(_0x1ae753){_0x2dbb6c[_0x33a8('0x13')]=_0x1ae753;if(_0x2dbb6c[_0x33a8('0x4f')]['UserId']){return db[_0x33a8('0x50')]['find']({'attributes':['id',_0x33a8('0x51')],'where':{'id':_0x2dbb6c[_0x33a8('0x4f')][_0x33a8('0x52')]}})[_0x33a8('0xe')](function(_0x175d4d){if(_0x175d4d){_0x2dbb6c['applications'][_0x33a8('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x175d4d[_0x33a8('0x51')]+','+(_0x2dbb6c['account'][_0x33a8('0x54')]||0xa),'interval':_0x33a8('0x55')});}return respondWithRpcPromise(_0x33a8('0x56'),_0x33a8('0x57'),_0x2dbb6c);});}return respondWithRpcPromise(_0x33a8('0x56'),_0x33a8('0x57'),_0x2dbb6c);})[_0x33a8('0xe')](function(_0x383c01){_0x2841e6(_0x383c01);})[_0x33a8('0x16')](function(_0x2249e9){_0x369933(_0x5154b4['error'](0x1f4,_0x2249e9[_0x33a8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 080836f..c5d2f3c 100644 --- a/server/api/faxAccount/faxAccount.socket.js +++ b/server/api/faxAccount/faxAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e7a=['length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x328305,_0x19098d){var _0xf0347=function(_0xa391c1){while(--_0xa391c1){_0x328305['push'](_0x328305['shift']());}};_0xf0347(++_0x19098d);}(_0x5e7a,0xa2));var _0xa5e7=function(_0x15653a,_0x54d78d){_0x15653a=_0x15653a-0x0;var _0x433cda=_0x5e7a[_0x15653a];return _0x433cda;};'use strict';var FaxAccountEvents=require(_0xa5e7('0x0'));var events=[_0xa5e7('0x1'),_0xa5e7('0x2'),_0xa5e7('0x3')];function createListener(_0x539a84,_0x4969ba){return function(_0x2c7ab0){_0x4969ba[_0xa5e7('0x4')](_0x539a84,_0x2c7ab0);};}function removeListener(_0x5d0ab9,_0x180c73){return function(){FaxAccountEvents[_0xa5e7('0x5')](_0x5d0ab9,_0x180c73);};}exports['register']=function(_0xea0dee){for(var _0x4240fc=0x0,_0x530fb1=events[_0xa5e7('0x6')];_0x4240fc<_0x530fb1;_0x4240fc++){var _0x3d0030=events[_0x4240fc];var _0x37663d=createListener(_0xa5e7('0x7')+_0x3d0030,_0xea0dee);FaxAccountEvents['on'](_0x3d0030,_0x37663d);}}; \ No newline at end of file +var _0x74dc=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x74dc,0xd5));var _0xc74d=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0x74dc[_0x6e1239];return _0x418150;};'use strict';var FaxAccountEvents=require(_0xc74d('0x0'));var events=[_0xc74d('0x1'),_0xc74d('0x2'),_0xc74d('0x3')];function createListener(_0x2583bf,_0x170ca1){return function(_0x30f68f){_0x170ca1[_0xc74d('0x4')](_0x2583bf,_0x30f68f);};}function removeListener(_0x46216a,_0x5c5cd8){return function(){FaxAccountEvents[_0xc74d('0x5')](_0x46216a,_0x5c5cd8);};}exports[_0xc74d('0x6')]=function(_0x3513a6){for(var _0x43db69=0x0,_0x1fe840=events[_0xc74d('0x7')];_0x43db69<_0x1fe840;_0x43db69++){var _0x4c3075=events[_0x43db69];var _0x2f75ce=createListener(_0xc74d('0x8')+_0x4c3075,_0x3513a6);FaxAccountEvents['on'](_0x4c3075,_0x2f75ce);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index d90021b..c35d615 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x217393,_0x5542f0){var _0x1d8ef0=function(_0x4811ed){while(--_0x4811ed){_0x217393['push'](_0x217393['shift']());}};_0x1d8ef0(++_0x5542f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5ec340,_0x547f62){var _0x2772b8=function(_0x43df49){while(--_0x43df49){_0x5ec340['push'](_0x5ec340['shift']());}};_0x2772b8(++_0x547f62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 4eb70fb..024f719 100644 --- a/server/api/faxApplication/faxApplication.attributes.js +++ b/server/api/faxApplication/faxApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee73=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x3ecc30,_0x75412b){var _0x2682bc=function(_0x34c384){while(--_0x34c384){_0x3ecc30['push'](_0x3ecc30['shift']());}};_0x2682bc(++_0x75412b);}(_0xee73,0x68));var _0x3ee7=function(_0x50fc19,_0x2685e7){_0x50fc19=_0x50fc19-0x0;var _0x30c392=_0xee73[_0x50fc19];return _0x30c392;};'use strict';var Sequelize=require(_0x3ee7('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3ee7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3ee7('0x2')],'allowNull':![],'defaultValue':_0x3ee7('0x3')},'appdata':{'type':Sequelize[_0x3ee7('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3ee7('0x2')],'defaultValue':_0x3ee7('0x5')}}; \ No newline at end of file +var _0x0d43=['TEXT','STRING','*,*,*,*','exports'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x0d43,0x133));var _0x30d4=function(_0x1e97a5,_0x37a2e9){_0x1e97a5=_0x1e97a5-0x0;var _0x42915d=_0x0d43[_0x1e97a5];return _0x42915d;};'use strict';var Sequelize=require('sequelize');module[_0x30d4('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x30d4('0x1')]()},'description':{'type':Sequelize[_0x30d4('0x2')]},'interval':{'type':Sequelize[_0x30d4('0x2')],'defaultValue':_0x30d4('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 7e0ffc9..4229f04 100644 --- a/server/api/faxApplication/faxApplication.controller.js +++ b/server/api/faxApplication/faxApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe570=['status','end','limit','undefined','count','offset','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','keys','length','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xe570,0xbe));var _0x0e57=function(_0x4036d4,_0x5994ab){_0x4036d4=_0x4036d4-0x0;var _0x3bc2a4=_0xe570[_0x4036d4];return _0x3bc2a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e57('0x0'));var zipdir=require(_0x0e57('0x1'));var jsonpatch=require(_0x0e57('0x2'));var rp=require(_0x0e57('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0e57('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0e57('0x5'));var ejs=require(_0x0e57('0x6'));var fs=require('fs');var fs_extra=require(_0x0e57('0x7'));var _=require(_0x0e57('0x8'));var squel=require(_0x0e57('0x9'));var crypto=require(_0x0e57('0xa'));var jsforce=require(_0x0e57('0xb'));var deskjs=require(_0x0e57('0xc'));var toCsv=require(_0x0e57('0x5'));var querystring=require(_0x0e57('0xd'));var Papa=require('papaparse');var Redis=require(_0x0e57('0xe'));var authService=require(_0x0e57('0xf'));var qs=require(_0x0e57('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e57('0x11'));var logger=require(_0x0e57('0x12'))(_0x0e57('0x13'));var utils=require(_0x0e57('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0e57('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1057ef,_0x30e829){_0x30e829=_0x30e829||0xcc;return function(_0x1b3873){if(_0x1b3873){return _0x1057ef[_0x0e57('0x16')](_0x30e829);}return _0x1057ef[_0x0e57('0x17')](_0x30e829)[_0x0e57('0x18')]();};}function respondWithResult(_0x19bb1c,_0x49a778){_0x49a778=_0x49a778||0xc8;return function(_0x559e64){if(_0x559e64){return _0x19bb1c[_0x0e57('0x17')](_0x49a778)['json'](_0x559e64);}};}function respondWithFilteredResult(_0x5ae59a,_0x78c242){return function(_0x49c84d){if(_0x49c84d){var _0x3694ad=typeof _0x78c242['offset']==='undefined'&&typeof _0x78c242[_0x0e57('0x19')]===_0x0e57('0x1a');var _0x1bcd48=_0x49c84d[_0x0e57('0x1b')];var _0x1f1578=_0x3694ad?0x0:_0x78c242[_0x0e57('0x1c')];var _0x2a2a7f=_0x3694ad?_0x49c84d[_0x0e57('0x1b')]:_0x78c242[_0x0e57('0x1c')]+_0x78c242['limit'];var _0x9acb92;if(_0x2a2a7f>=_0x1bcd48){_0x2a2a7f=_0x1bcd48;_0x9acb92=0xc8;}else{_0x9acb92=0xce;}_0x5ae59a[_0x0e57('0x17')](_0x9acb92);return _0x5ae59a[_0x0e57('0x1d')](_0x0e57('0x1e'),_0x1f1578+'-'+_0x2a2a7f+'/'+_0x1bcd48)[_0x0e57('0x1f')](_0x49c84d);}return null;};}function patchUpdates(_0x15c1bc){return function(_0x42e1b1){try{jsonpatch['apply'](_0x42e1b1,_0x15c1bc,!![]);}catch(_0x2cd818){return BPromise[_0x0e57('0x20')](_0x2cd818);}return _0x42e1b1[_0x0e57('0x21')]();};}function saveUpdates(_0x1aaa2f,_0x1161ff){return function(_0x5caf18){if(_0x5caf18){return _0x5caf18['update'](_0x1aaa2f)[_0x0e57('0x22')](function(_0x4ba0d6){return _0x4ba0d6;});}return null;};}function removeEntity(_0x4749b9,_0x85a381){return function(_0x42f767){if(_0x42f767){return _0x42f767[_0x0e57('0x23')]()[_0x0e57('0x22')](function(){_0x4749b9[_0x0e57('0x17')](0xcc)[_0x0e57('0x18')]();});}};}function handleEntityNotFound(_0x3bda31,_0x35692f){return function(_0x4e52b4){if(!_0x4e52b4){_0x3bda31[_0x0e57('0x16')](0x194);}return _0x4e52b4;};}function handleError(_0x41878c,_0x1831da){_0x1831da=_0x1831da||0x1f4;return function(_0x5e9409){logger[_0x0e57('0x24')](_0x5e9409[_0x0e57('0x25')]);if(_0x5e9409['name']){delete _0x5e9409[_0x0e57('0x26')];}_0x41878c['status'](_0x1831da)[_0x0e57('0x27')](_0x5e9409);};}exports[_0x0e57('0x28')]=function(_0x1b4db1,_0x3dfb41){var _0x5bb8ba={},_0x5a4deb={},_0x1dcecb={'count':0x0,'rows':[]};var _0xe83f9f=_[_0x0e57('0x29')](db[_0x0e57('0x2a')][_0x0e57('0x2b')],function(_0x2265b8){return{'name':_0x2265b8[_0x0e57('0x2c')],'type':_0x2265b8['type'][_0x0e57('0x2d')]};});_0x5a4deb[_0x0e57('0x2e')]=_[_0x0e57('0x29')](_0xe83f9f,_0x0e57('0x26'));_0x5a4deb[_0x0e57('0x2f')]=_['keys'](_0x1b4db1[_0x0e57('0x2f')]);_0x5a4deb[_0x0e57('0x30')]=_[_0x0e57('0x31')](_0x5a4deb[_0x0e57('0x2e')],_0x5a4deb[_0x0e57('0x2f')]);_0x5bb8ba[_0x0e57('0x32')]=_['intersection'](_0x5a4deb[_0x0e57('0x2e')],qs[_0x0e57('0x33')](_0x1b4db1[_0x0e57('0x2f')][_0x0e57('0x33')]));_0x5bb8ba['attributes']=_0x5bb8ba[_0x0e57('0x32')]['length']?_0x5bb8ba[_0x0e57('0x32')]:_0x5a4deb[_0x0e57('0x2e')];if(!_0x1b4db1[_0x0e57('0x2f')][_0x0e57('0x34')]('nolimit')){_0x5bb8ba[_0x0e57('0x19')]=qs['limit'](_0x1b4db1['query'][_0x0e57('0x19')]);_0x5bb8ba['offset']=qs['offset'](_0x1b4db1[_0x0e57('0x2f')][_0x0e57('0x1c')]);}_0x5bb8ba['order']=qs[_0x0e57('0x35')](_0x1b4db1['query']['sort']);_0x5bb8ba['where']=qs[_0x0e57('0x30')](_[_0x0e57('0x36')](_0x1b4db1[_0x0e57('0x2f')],_0x5a4deb[_0x0e57('0x30')]),_0xe83f9f);if(_0x1b4db1['query'][_0x0e57('0x37')]){_0x5bb8ba[_0x0e57('0x38')]=_[_0x0e57('0x39')](_0x5bb8ba[_0x0e57('0x38')],{'$or':_[_0x0e57('0x29')](_0xe83f9f,function(_0x22e587){if(_0x22e587[_0x0e57('0x3a')]!==_0x0e57('0x3b')){var _0xbd30d6={};_0xbd30d6[_0x22e587[_0x0e57('0x26')]]={'$like':'%'+_0x1b4db1[_0x0e57('0x2f')][_0x0e57('0x37')]+'%'};return _0xbd30d6;}})});}_0x5bb8ba=_[_0x0e57('0x39')]({},_0x5bb8ba,_0x1b4db1[_0x0e57('0x3c')]);var _0x47ed3b={'where':_0x5bb8ba[_0x0e57('0x38')]};return db[_0x0e57('0x2a')][_0x0e57('0x1b')](_0x47ed3b)[_0x0e57('0x22')](function(_0x19f4d9){_0x1dcecb['count']=_0x19f4d9;if(_0x1b4db1[_0x0e57('0x2f')][_0x0e57('0x3d')]){_0x5bb8ba['include']=[{'all':!![]}];}return db['FaxApplication'][_0x0e57('0x3e')](_0x5bb8ba);})[_0x0e57('0x22')](function(_0xd2b96d){_0x1dcecb['rows']=_0xd2b96d;return _0x1dcecb;})[_0x0e57('0x22')](respondWithFilteredResult(_0x3dfb41,_0x5bb8ba))[_0x0e57('0x3f')](handleError(_0x3dfb41,null));};exports[_0x0e57('0x40')]=function(_0x79cfd5,_0x3951fb){var _0x338481={'raw':!![],'where':{'id':_0x79cfd5['params']['id']}},_0x46ab0e={};_0x46ab0e[_0x0e57('0x2e')]=_['keys'](db[_0x0e57('0x2a')][_0x0e57('0x2b')]);_0x46ab0e[_0x0e57('0x2f')]=_[_0x0e57('0x41')](_0x79cfd5[_0x0e57('0x2f')]);_0x46ab0e[_0x0e57('0x30')]=_[_0x0e57('0x31')](_0x46ab0e['model'],_0x46ab0e[_0x0e57('0x2f')]);_0x338481['attributes']=_[_0x0e57('0x31')](_0x46ab0e[_0x0e57('0x2e')],qs[_0x0e57('0x33')](_0x79cfd5[_0x0e57('0x2f')][_0x0e57('0x33')]));_0x338481[_0x0e57('0x32')]=_0x338481[_0x0e57('0x32')][_0x0e57('0x42')]?_0x338481[_0x0e57('0x32')]:_0x46ab0e[_0x0e57('0x2e')];if(_0x79cfd5[_0x0e57('0x2f')][_0x0e57('0x3d')]){_0x338481['include']=[{'all':!![]}];}_0x338481=_['merge']({},_0x338481,_0x79cfd5['options']);return db['FaxApplication'][_0x0e57('0x43')](_0x338481)[_0x0e57('0x22')](handleEntityNotFound(_0x3951fb,null))['then'](respondWithResult(_0x3951fb,null))[_0x0e57('0x3f')](handleError(_0x3951fb,null));};exports[_0x0e57('0x44')]=function(_0x5a6ffa,_0xde8f34){return db[_0x0e57('0x2a')][_0x0e57('0x44')](_0x5a6ffa['body'],{})[_0x0e57('0x22')](respondWithResult(_0xde8f34,0xc9))[_0x0e57('0x3f')](handleError(_0xde8f34,null));};exports['update']=function(_0x11d106,_0xf0d896){if(_0x11d106[_0x0e57('0x45')]['id']){delete _0x11d106[_0x0e57('0x45')]['id'];}return db[_0x0e57('0x2a')][_0x0e57('0x43')]({'where':{'id':_0x11d106['params']['id']}})[_0x0e57('0x22')](handleEntityNotFound(_0xf0d896,null))[_0x0e57('0x22')](saveUpdates(_0x11d106['body'],null))[_0x0e57('0x22')](respondWithResult(_0xf0d896,null))[_0x0e57('0x3f')](handleError(_0xf0d896,null));};exports[_0x0e57('0x23')]=function(_0x47c0f4,_0x322db5){return db[_0x0e57('0x2a')][_0x0e57('0x43')]({'where':{'id':_0x47c0f4[_0x0e57('0x46')]['id']}})[_0x0e57('0x22')](handleEntityNotFound(_0x322db5,null))[_0x0e57('0x22')](removeEntity(_0x322db5,null))[_0x0e57('0x3f')](handleError(_0x322db5,null));}; \ No newline at end of file +var _0x94ba=['lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','save','then','destroy','end','sendStatus','error','stack','name','send','FaxApplication','rawAttributes','type','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','body','update','params','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0xfd32be,_0xe0076b){var _0x376641=function(_0x1ec260){while(--_0x1ec260){_0xfd32be['push'](_0xfd32be['shift']());}};_0x376641(++_0xe0076b);}(_0x94ba,0xc2));var _0xa94b=function(_0x2b98d4,_0x1de753){_0x2b98d4=_0x2b98d4-0x0;var _0x76ce5b=_0x94ba[_0x2b98d4];return _0x76ce5b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa94b('0x0'));var rp=require(_0xa94b('0x1'));var moment=require(_0xa94b('0x2'));var BPromise=require(_0xa94b('0x3'));var Mustache=require(_0xa94b('0x4'));var util=require(_0xa94b('0x5'));var path=require(_0xa94b('0x6'));var sox=require(_0xa94b('0x7'));var csv=require(_0xa94b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa94b('0x9'));var _=require(_0xa94b('0xa'));var squel=require(_0xa94b('0xb'));var crypto=require(_0xa94b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa94b('0xd'));var Redis=require('ioredis');var authService=require(_0xa94b('0xe'));var qs=require(_0xa94b('0xf'));var as=require(_0xa94b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa94b('0x11'))(_0xa94b('0x12'));var utils=require('../../config/utils');var config=require(_0xa94b('0x13'));var licenseUtil=require(_0xa94b('0x14'));var db=require(_0xa94b('0x15'))['db'];function respondWithStatusCode(_0x1cc8a2,_0x25f757){_0x25f757=_0x25f757||0xcc;return function(_0x16e8bd){if(_0x16e8bd){return _0x1cc8a2['sendStatus'](_0x25f757);}return _0x1cc8a2['status'](_0x25f757)['end']();};}function respondWithResult(_0x20ca6a,_0x1ad659){_0x1ad659=_0x1ad659||0xc8;return function(_0xe09192){if(_0xe09192){return _0x20ca6a[_0xa94b('0x16')](_0x1ad659)[_0xa94b('0x17')](_0xe09192);}};}function respondWithFilteredResult(_0xb0db46,_0x494c71){return function(_0x4bfb95){if(_0x4bfb95){var _0x5d6276=typeof _0x494c71[_0xa94b('0x18')]===_0xa94b('0x19')&&typeof _0x494c71['limit']==='undefined';var _0x12076d=_0x4bfb95[_0xa94b('0x1a')];var _0x308a71=_0x5d6276?0x0:_0x494c71['offset'];var _0x4a80c2=_0x5d6276?_0x4bfb95[_0xa94b('0x1a')]:_0x494c71[_0xa94b('0x18')]+_0x494c71[_0xa94b('0x1b')];var _0x32516f;if(_0x4a80c2>=_0x12076d){_0x4a80c2=_0x12076d;_0x32516f=0xc8;}else{_0x32516f=0xce;}_0xb0db46[_0xa94b('0x16')](_0x32516f);return _0xb0db46[_0xa94b('0x1c')](_0xa94b('0x1d'),_0x308a71+'-'+_0x4a80c2+'/'+_0x12076d)[_0xa94b('0x17')](_0x4bfb95);}return null;};}function patchUpdates(_0x34d14f){return function(_0x481f56){try{jsonpatch['apply'](_0x481f56,_0x34d14f,!![]);}catch(_0x5ed056){return BPromise['reject'](_0x5ed056);}return _0x481f56[_0xa94b('0x1e')]();};}function saveUpdates(_0x5c2b7f,_0xf6604e){return function(_0x574fa2){if(_0x574fa2){return _0x574fa2['update'](_0x5c2b7f)[_0xa94b('0x1f')](function(_0x47cfac){return _0x47cfac;});}return null;};}function removeEntity(_0x79a56e,_0x5c906d){return function(_0xc1251b){if(_0xc1251b){return _0xc1251b[_0xa94b('0x20')]()[_0xa94b('0x1f')](function(){_0x79a56e[_0xa94b('0x16')](0xcc)[_0xa94b('0x21')]();});}};}function handleEntityNotFound(_0x1f091a,_0x13570d){return function(_0x284645){if(!_0x284645){_0x1f091a[_0xa94b('0x22')](0x194);}return _0x284645;};}function handleError(_0x148b9e,_0x56b42a){_0x56b42a=_0x56b42a||0x1f4;return function(_0x45e4fc){logger[_0xa94b('0x23')](_0x45e4fc[_0xa94b('0x24')]);if(_0x45e4fc[_0xa94b('0x25')]){delete _0x45e4fc['name'];}_0x148b9e['status'](_0x56b42a)[_0xa94b('0x26')](_0x45e4fc);};}exports['index']=function(_0xd160fb,_0x477a4a){var _0xf972b3={},_0xc033c5={},_0x32ad22={'count':0x0,'rows':[]};var _0x27831b=_['map'](db[_0xa94b('0x27')][_0xa94b('0x28')],function(_0x506d3c){return{'name':_0x506d3c['fieldName'],'type':_0x506d3c[_0xa94b('0x29')]['key']};});_0xc033c5[_0xa94b('0x2a')]=_['map'](_0x27831b,_0xa94b('0x25'));_0xc033c5['query']=_[_0xa94b('0x2b')](_0xd160fb[_0xa94b('0x2c')]);_0xc033c5['filters']=_[_0xa94b('0x2d')](_0xc033c5[_0xa94b('0x2a')],_0xc033c5[_0xa94b('0x2c')]);_0xf972b3['attributes']=_[_0xa94b('0x2d')](_0xc033c5[_0xa94b('0x2a')],qs[_0xa94b('0x2e')](_0xd160fb[_0xa94b('0x2c')]['fields']));_0xf972b3[_0xa94b('0x2f')]=_0xf972b3[_0xa94b('0x2f')]['length']?_0xf972b3['attributes']:_0xc033c5['model'];if(!_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x30')](_0xa94b('0x31'))){_0xf972b3[_0xa94b('0x1b')]=qs[_0xa94b('0x1b')](_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x1b')]);_0xf972b3['offset']=qs[_0xa94b('0x18')](_0xd160fb['query']['offset']);}_0xf972b3['order']=qs[_0xa94b('0x32')](_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x32')]);_0xf972b3['where']=qs[_0xa94b('0x33')](_['pick'](_0xd160fb[_0xa94b('0x2c')],_0xc033c5[_0xa94b('0x33')]),_0x27831b);if(_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x34')]){_0xf972b3[_0xa94b('0x35')]=_[_0xa94b('0x36')](_0xf972b3[_0xa94b('0x35')],{'$or':_['map'](_0x27831b,function(_0x54c0ec){if(_0x54c0ec[_0xa94b('0x29')]!==_0xa94b('0x37')){var _0x31843c={};_0x31843c[_0x54c0ec['name']]={'$like':'%'+_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x34')]+'%'};return _0x31843c;}})});}_0xf972b3=_[_0xa94b('0x36')]({},_0xf972b3,_0xd160fb[_0xa94b('0x38')]);var _0x7bbfa8={'where':_0xf972b3['where']};return db[_0xa94b('0x27')][_0xa94b('0x1a')](_0x7bbfa8)['then'](function(_0x149efb){_0x32ad22[_0xa94b('0x1a')]=_0x149efb;if(_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x39')]){_0xf972b3[_0xa94b('0x3a')]=[{'all':!![]}];}return db[_0xa94b('0x27')][_0xa94b('0x3b')](_0xf972b3);})[_0xa94b('0x1f')](function(_0x2daea5){_0x32ad22[_0xa94b('0x3c')]=_0x2daea5;return _0x32ad22;})[_0xa94b('0x1f')](respondWithFilteredResult(_0x477a4a,_0xf972b3))[_0xa94b('0x3d')](handleError(_0x477a4a,null));};exports[_0xa94b('0x3e')]=function(_0xd3b31e,_0x3e8912){var _0x2b0ab6={'raw':!![],'where':{'id':_0xd3b31e['params']['id']}},_0x71ed39={};_0x71ed39[_0xa94b('0x2a')]=_['keys'](db[_0xa94b('0x27')][_0xa94b('0x28')]);_0x71ed39['query']=_[_0xa94b('0x2b')](_0xd3b31e[_0xa94b('0x2c')]);_0x71ed39[_0xa94b('0x33')]=_[_0xa94b('0x2d')](_0x71ed39[_0xa94b('0x2a')],_0x71ed39[_0xa94b('0x2c')]);_0x2b0ab6[_0xa94b('0x2f')]=_['intersection'](_0x71ed39[_0xa94b('0x2a')],qs[_0xa94b('0x2e')](_0xd3b31e[_0xa94b('0x2c')][_0xa94b('0x2e')]));_0x2b0ab6[_0xa94b('0x2f')]=_0x2b0ab6['attributes'][_0xa94b('0x3f')]?_0x2b0ab6['attributes']:_0x71ed39[_0xa94b('0x2a')];if(_0xd3b31e['query'][_0xa94b('0x39')]){_0x2b0ab6[_0xa94b('0x3a')]=[{'all':!![]}];}_0x2b0ab6=_[_0xa94b('0x36')]({},_0x2b0ab6,_0xd3b31e['options']);return db['FaxApplication'][_0xa94b('0x40')](_0x2b0ab6)[_0xa94b('0x1f')](handleEntityNotFound(_0x3e8912,null))[_0xa94b('0x1f')](respondWithResult(_0x3e8912,null))[_0xa94b('0x3d')](handleError(_0x3e8912,null));};exports['create']=function(_0x3dc000,_0x4814db){return db[_0xa94b('0x27')]['create'](_0x3dc000[_0xa94b('0x41')],{})[_0xa94b('0x1f')](respondWithResult(_0x4814db,0xc9))[_0xa94b('0x3d')](handleError(_0x4814db,null));};exports[_0xa94b('0x42')]=function(_0x5724b4,_0x6da8d8){if(_0x5724b4[_0xa94b('0x41')]['id']){delete _0x5724b4[_0xa94b('0x41')]['id'];}return db[_0xa94b('0x27')][_0xa94b('0x40')]({'where':{'id':_0x5724b4['params']['id']}})[_0xa94b('0x1f')](handleEntityNotFound(_0x6da8d8,null))[_0xa94b('0x1f')](saveUpdates(_0x5724b4[_0xa94b('0x41')],null))['then'](respondWithResult(_0x6da8d8,null))[_0xa94b('0x3d')](handleError(_0x6da8d8,null));};exports[_0xa94b('0x20')]=function(_0x235830,_0x10fccd){return db[_0xa94b('0x27')][_0xa94b('0x40')]({'where':{'id':_0x235830[_0xa94b('0x43')]['id']}})[_0xa94b('0x1f')](handleEntityNotFound(_0x10fccd,null))[_0xa94b('0x1f')](removeEntity(_0x10fccd,null))['catch'](handleError(_0x10fccd,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index bf2138c..4fe7f65 100644 --- a/server/api/faxApplication/faxApplication.model.js +++ b/server/api/faxApplication/faxApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcf2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x493985,_0xabbee5){var _0x532b94=function(_0x150fbc){while(--_0x150fbc){_0x493985['push'](_0x493985['shift']());}};_0x532b94(++_0xabbee5);}(_0xdcf2,0x174));var _0x2dcf=function(_0x37c0ac,_0xa6f090){_0x37c0ac=_0x37c0ac-0x0;var _0xf22837=_0xdcf2[_0x37c0ac];return _0xf22837;};'use strict';var _=require(_0x2dcf('0x0'));var util=require(_0x2dcf('0x1'));var logger=require(_0x2dcf('0x2'))(_0x2dcf('0x3'));var moment=require(_0x2dcf('0x4'));var BPromise=require(_0x2dcf('0x5'));var rp=require(_0x2dcf('0x6'));var fs=require('fs');var path=require(_0x2dcf('0x7'));var rimraf=require(_0x2dcf('0x8'));var config=require(_0x2dcf('0x9'));var attributes=require(_0x2dcf('0xa'));module[_0x2dcf('0xb')]=function(_0x2126a1,_0x317116){return _0x2126a1[_0x2dcf('0xc')](_0x2dcf('0xd'),attributes,{'tableName':_0x2dcf('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2dcf('0xf'),'collate':_0x2dcf('0x10')});}; \ No newline at end of file +var _0xcd82=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5c0e6b,_0x218652){var _0x495ca1=function(_0x4a6f0a){while(--_0x4a6f0a){_0x5c0e6b['push'](_0x5c0e6b['shift']());}};_0x495ca1(++_0x218652);}(_0xcd82,0x135));var _0x2cd8=function(_0x9033b4,_0x5e5af6){_0x9033b4=_0x9033b4-0x0;var _0x32d7bc=_0xcd82[_0x9033b4];return _0x32d7bc;};'use strict';var _=require(_0x2cd8('0x0'));var util=require(_0x2cd8('0x1'));var logger=require(_0x2cd8('0x2'))(_0x2cd8('0x3'));var moment=require('moment');var BPromise=require(_0x2cd8('0x4'));var rp=require(_0x2cd8('0x5'));var fs=require('fs');var path=require(_0x2cd8('0x6'));var rimraf=require(_0x2cd8('0x7'));var config=require(_0x2cd8('0x8'));var attributes=require(_0x2cd8('0x9'));module[_0x2cd8('0xa')]=function(_0x9b2d37,_0x4c871f){return _0x9b2d37[_0x2cd8('0xb')]('FaxApplication',attributes,{'tableName':_0x2cd8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2cd8('0xd'),'collate':_0x2cd8('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index faa2ff6..22d8ecd 100644 --- a/server/api/faxApplication/faxApplication.rpc.js +++ b/server/api/faxApplication/faxApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd99d=['info','result','catch','UpdateFaxApplication','update','body','options','raw','limit','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x35ce0d,_0x1bb85f){var _0x492060=function(_0x402dd5){while(--_0x402dd5){_0x35ce0d['push'](_0x35ce0d['shift']());}};_0x492060(++_0x1bb85f);}(_0xd99d,0x1ae));var _0xdd99=function(_0x69150a,_0x56ab6f){_0x69150a=_0x69150a-0x0;var _0x5368c0=_0xd99d[_0x69150a];return _0x5368c0;};'use strict';var _=require(_0xdd99('0x0'));var util=require('util');var moment=require(_0xdd99('0x1'));var BPromise=require(_0xdd99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd99('0x3'));var db=require(_0xdd99('0x4'))['db'];var utils=require(_0xdd99('0x5'));var logger=require(_0xdd99('0x6'))(_0xdd99('0x7'));var config=require(_0xdd99('0x8'));var jayson=require(_0xdd99('0x9'));var client=jayson[_0xdd99('0xa')][_0xdd99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x169f27,_0x1fc81f,_0x18a5ba){return new BPromise(function(_0x5c737a,_0x2755cd){return client[_0xdd99('0xc')](_0x169f27,_0x18a5ba)['then'](function(_0x46fe1c){logger['info'](_0xdd99('0xd'),_0x1fc81f,_0xdd99('0xe'));logger[_0xdd99('0xf')](_0xdd99('0x10'),_0x1fc81f,'request\x20sent',JSON[_0xdd99('0x11')](_0x46fe1c));if(_0x46fe1c[_0xdd99('0x12')]){if(_0x46fe1c[_0xdd99('0x12')]['code']===0x1f4){logger[_0xdd99('0x12')](_0xdd99('0xd'),_0x1fc81f,_0x46fe1c['error']['message']);return _0x2755cd(_0x46fe1c[_0xdd99('0x12')][_0xdd99('0x13')]);}logger[_0xdd99('0x12')](_0xdd99('0xd'),_0x1fc81f,_0x46fe1c[_0xdd99('0x12')][_0xdd99('0x13')]);return _0x5c737a(_0x46fe1c[_0xdd99('0x12')][_0xdd99('0x13')]);}else{logger[_0xdd99('0x14')](_0xdd99('0xd'),_0x1fc81f,'request\x20sent');_0x5c737a(_0x46fe1c[_0xdd99('0x15')]['message']);}})[_0xdd99('0x16')](function(_0x31f530){logger['error'](_0xdd99('0xd'),_0x1fc81f,_0x31f530);_0x2755cd(_0x31f530);});});}exports[_0xdd99('0x17')]=function(_0x542a9a){var _0x1ccd63=this;return new Promise(function(_0x37cbc3,_0x2e05a5){return db['FaxApplication'][_0xdd99('0x18')](_0x542a9a[_0xdd99('0x19')],{'raw':_0x542a9a[_0xdd99('0x1a')]?_0x542a9a['options'][_0xdd99('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x542a9a[_0xdd99('0x1a')]?_0x542a9a['options']['where']||null:null,'attributes':_0x542a9a['options']?_0x542a9a[_0xdd99('0x1a')]['attributes']||null:null,'limit':_0x542a9a[_0xdd99('0x1a')]?_0x542a9a[_0xdd99('0x1a')][_0xdd99('0x1c')]||null:null})[_0xdd99('0x1d')](function(_0x2b1bbb){logger[_0xdd99('0x14')]('UpdateFaxApplication',_0x542a9a);logger[_0xdd99('0xf')](_0xdd99('0x17'),_0x542a9a,JSON[_0xdd99('0x11')](_0x2b1bbb));_0x37cbc3(_0x2b1bbb);})[_0xdd99('0x16')](function(_0xc17d23){logger['error'](_0xdd99('0x17'),_0xc17d23[_0xdd99('0x13')],_0x542a9a);_0x2e05a5(_0x1ccd63['error'](0x1f4,_0xc17d23['message']));});});}; \ No newline at end of file +var _0x785d=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','UpdateFaxApplication','FaxApplication','options','raw','where','attributes','limit','then'];(function(_0x503c40,_0x1683a5){var _0x53e8bc=function(_0x156ca5){while(--_0x156ca5){_0x503c40['push'](_0x503c40['shift']());}};_0x53e8bc(++_0x1683a5);}(_0x785d,0x1b3));var _0xd785=function(_0x50387f,_0x34c620){_0x50387f=_0x50387f-0x0;var _0x363ba4=_0x785d[_0x50387f];return _0x363ba4;};'use strict';var _=require(_0xd785('0x0'));var util=require(_0xd785('0x1'));var moment=require(_0xd785('0x2'));var BPromise=require(_0xd785('0x3'));var rs=require(_0xd785('0x4'));var fs=require('fs');var Redis=require(_0xd785('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd785('0x6'));var logger=require(_0xd785('0x7'))('rpc');var config=require(_0xd785('0x8'));var jayson=require(_0xd785('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x290679,_0x50599c,_0x579ff3){return new BPromise(function(_0x2158ec,_0x3e0196){return client[_0xd785('0xa')](_0x290679,_0x579ff3)['then'](function(_0x2af301){logger[_0xd785('0xb')](_0xd785('0xc'),_0x50599c,_0xd785('0xd'));logger[_0xd785('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x50599c,_0xd785('0xd'),JSON[_0xd785('0xf')](_0x2af301));if(_0x2af301['error']){if(_0x2af301['error'][_0xd785('0x10')]===0x1f4){logger[_0xd785('0x11')](_0xd785('0xc'),_0x50599c,_0x2af301[_0xd785('0x11')]['message']);return _0x3e0196(_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);}logger[_0xd785('0x11')]('FaxApplication,\x20%s,\x20%s',_0x50599c,_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);return _0x2158ec(_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);}else{logger[_0xd785('0xb')](_0xd785('0xc'),_0x50599c,'request\x20sent');_0x2158ec(_0x2af301[_0xd785('0x13')][_0xd785('0x12')]);}})[_0xd785('0x14')](function(_0x467c1e){logger[_0xd785('0x11')](_0xd785('0xc'),_0x50599c,_0x467c1e);_0x3e0196(_0x467c1e);});});}exports[_0xd785('0x15')]=function(_0x29d72d){var _0x3c974c=this;return new Promise(function(_0x2d4079,_0x54aab3){return db[_0xd785('0x16')]['update'](_0x29d72d['body'],{'raw':_0x29d72d[_0xd785('0x17')]?_0x29d72d[_0xd785('0x17')][_0xd785('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29d72d['options']?_0x29d72d[_0xd785('0x17')][_0xd785('0x19')]||null:null,'attributes':_0x29d72d[_0xd785('0x17')]?_0x29d72d[_0xd785('0x17')][_0xd785('0x1a')]||null:null,'limit':_0x29d72d['options']?_0x29d72d[_0xd785('0x17')][_0xd785('0x1b')]||null:null})[_0xd785('0x1c')](function(_0x1a32d0){logger[_0xd785('0xb')](_0xd785('0x15'),_0x29d72d);logger[_0xd785('0xe')](_0xd785('0x15'),_0x29d72d,JSON['stringify'](_0x1a32d0));_0x2d4079(_0x1a32d0);})['catch'](function(_0x2c7f6d){logger[_0xd785('0x11')](_0xd785('0x15'),_0x2c7f6d[_0xd785('0x12')],_0x29d72d);_0x54aab3(_0x3c974c[_0xd785('0x11')](0x1f4,_0x2c7f6d[_0xd785('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 4d9ed56..fc4df4c 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9348=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','show','post','delete','/:id','destroy','exports','multer'];(function(_0x3b8508,_0xff4ad6){var _0x4f9a7c=function(_0x32f477){while(--_0x32f477){_0x3b8508['push'](_0x3b8508['shift']());}};_0x4f9a7c(++_0xff4ad6);}(_0x9348,0x10d));var _0x8934=function(_0x23430f,_0x413d86){_0x23430f=_0x23430f-0x0;var _0x130459=_0x9348[_0x23430f];return _0x130459;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x8934('0xa')](),controller['update']);router[_0x8934('0xe')](_0x8934('0xf'),auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);module[_0x8934('0x11')]=router; \ No newline at end of file +var _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1109d5,_0x2da38f){_0x1109d5=_0x1109d5-0x0;var _0x58b0a8=_0xd7d1[_0x1109d5];return _0x58b0a8;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 945bf74..b174b6e 100644 --- a/server/api/faxInteraction/faxInteraction.attributes.js +++ b/server/api/faxInteraction/faxInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22e3=['out','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0x22e3,0x13f));var _0x322e=function(_0xcf6927,_0x1bfcb5){_0xcf6927=_0xcf6927-0x0;var _0x2bf387=_0x22e3[_0xcf6927];return _0x2bf387;};'use strict';var Sequelize=require('sequelize');module[_0x322e('0x0')]={'closed':{'type':Sequelize[_0x322e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x322e('0x2')]},'disposition':{'type':Sequelize[_0x322e('0x3')]},'secondDisposition':{'type':Sequelize[_0x322e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x322e('0x2')]},'fax':{'type':Sequelize[_0x322e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x322e('0x4')]('in',_0x322e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x322e('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x322e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xec03=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3e85cd,_0x31466f){var _0x1cd092=function(_0x1f4409){while(--_0x1f4409){_0x3e85cd['push'](_0x3e85cd['shift']());}};_0x1cd092(++_0x31466f);}(_0xec03,0x7e));var _0x3ec0=function(_0x60eac7,_0xc05d7e){_0x60eac7=_0x60eac7-0x0;var _0xca5f1d=_0xec03[_0x60eac7];return _0xca5f1d;};'use strict';var Sequelize=require(_0x3ec0('0x0'));module[_0x3ec0('0x1')]={'closed':{'type':Sequelize[_0x3ec0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3ec0('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3ec0('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3ec0('0x3')]},'fax':{'type':Sequelize[_0x3ec0('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3ec0('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3ec0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3ec0('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 366055c..31d51c7 100644 --- a/server/api/faxInteraction/faxInteraction.controller.js +++ b/server/api/faxInteraction/faxInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7286=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','send','Users','map','fullname','TagIds','Tags','split','push','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','FaxInteraction','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','user_has_fax_interactions','u.id\x20=\x20ui.UserId','fax_interactions','left_join','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','start','keys','some','isEmpty','forEach','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','user','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','show','includeAll','include','options','create','params','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','basename','createReadStream','resolve','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0x7286,0xd5));var _0x6728=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7286[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0x6728('0x0'));var rimraf=require(_0x6728('0x1'));var zipdir=require(_0x6728('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6728('0x3'));var moment=require(_0x6728('0x4'));var BPromise=require(_0x6728('0x5'));var Mustache=require('mustache');var util=require(_0x6728('0x6'));var path=require('path');var sox=require(_0x6728('0x7'));var csv=require('to-csv');var ejs=require(_0x6728('0x8'));var fs=require('fs');var fs_extra=require(_0x6728('0x9'));var _=require(_0x6728('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6728('0xb'));var deskjs=require(_0x6728('0xc'));var toCsv=require(_0x6728('0xd'));var querystring=require(_0x6728('0xe'));var Papa=require(_0x6728('0xf'));var Redis=require(_0x6728('0x10'));var authService=require(_0x6728('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6728('0x12'));var hardwareService=require(_0x6728('0x13'));var logger=require(_0x6728('0x14'))(_0x6728('0x15'));var utils=require('../../config/utils');var config=require(_0x6728('0x16'));var licenseUtil=require(_0x6728('0x17'));var db=require(_0x6728('0x18'))['db'];config[_0x6728('0x19')]=_[_0x6728('0x1a')](config['redis'],{'host':_0x6728('0x1b'),'port':0x18eb});var socket=require(_0x6728('0x1c'))(new Redis(config[_0x6728('0x19')]));require(_0x6728('0x1d'))['register'](socket);function respondWithStatusCode(_0x2ee10b,_0x49fd8e){_0x49fd8e=_0x49fd8e||0xcc;return function(_0x82ffe0){if(_0x82ffe0){return _0x2ee10b[_0x6728('0x1e')](_0x49fd8e);}return _0x2ee10b[_0x6728('0x1f')](_0x49fd8e)[_0x6728('0x20')]();};}function respondWithResult(_0x51324f,_0x1aaaa0){_0x1aaaa0=_0x1aaaa0||0xc8;return function(_0x51615d){if(_0x51615d){return _0x51324f[_0x6728('0x1f')](_0x1aaaa0)['json'](_0x51615d);}};}function respondWithFilteredResult(_0x2a9eb3,_0x16b55c){return function(_0x2b3775){if(_0x2b3775){var _0x3fada4=typeof _0x16b55c[_0x6728('0x21')]===_0x6728('0x22')&&typeof _0x16b55c[_0x6728('0x23')]===_0x6728('0x22');var _0x497227=_0x2b3775[_0x6728('0x24')];var _0xdb5416=_0x3fada4?0x0:_0x16b55c[_0x6728('0x21')];var _0x5a6ead=_0x3fada4?_0x2b3775['count']:_0x16b55c[_0x6728('0x21')]+_0x16b55c[_0x6728('0x23')];var _0x93cb3c;if(_0x5a6ead>=_0x497227){_0x5a6ead=_0x497227;_0x93cb3c=0xc8;}else{_0x93cb3c=0xce;}_0x2a9eb3['status'](_0x93cb3c);return _0x2a9eb3[_0x6728('0x25')](_0x6728('0x26'),_0xdb5416+'-'+_0x5a6ead+'/'+_0x497227)['json'](_0x2b3775);}return null;};}function patchUpdates(_0x263801){return function(_0x6daed7){try{jsonpatch[_0x6728('0x27')](_0x6daed7,_0x263801,!![]);}catch(_0x38a807){return BPromise[_0x6728('0x28')](_0x38a807);}return _0x6daed7['save']();};}function saveUpdates(_0x5e6a50,_0x22da2f){return function(_0x40186d){if(_0x40186d){return _0x40186d[_0x6728('0x29')](_0x5e6a50)[_0x6728('0x2a')](function(_0x3c364c){return _0x3c364c;});}return null;};}function removeEntity(_0x41c0dc,_0x31b713){return function(_0x1cf0af){if(_0x1cf0af){return _0x1cf0af['destroy']()[_0x6728('0x2a')](function(){_0x41c0dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6e4b05,_0x3b4088){return function(_0x17b857){if(!_0x17b857){_0x6e4b05[_0x6728('0x1e')](0x194);}return _0x17b857;};}function handleError(_0x29f077,_0x41ba3c){_0x41ba3c=_0x41ba3c||0x1f4;return function(_0x1ebd55){logger[_0x6728('0x2b')](_0x1ebd55[_0x6728('0x2c')]);if(_0x1ebd55['name']){delete _0x1ebd55['name'];}_0x29f077[_0x6728('0x1f')](_0x41ba3c)[_0x6728('0x2d')](_0x1ebd55);};}function getInteractionUsers(_0x1e7871,_0x14c173){return new BPromise(function(_0x59dd8f,_0x41001a){try{if(_0x14c173[_0x1e7871['id']]){_0x1e7871[_0x6728('0x2e')]=_[_0x6728('0x2f')](_0x14c173[_0x1e7871['id']],function(_0x36afa9){return{'id':_0x36afa9['id'],'fullname':_0x36afa9[_0x6728('0x30')]};});}}catch(_0x41504b){_0x41001a(_0x41504b);}_0x59dd8f(_0x1e7871);});}function getInteractionTags(_0xdc96af,_0x1074dc){return new BPromise(function(_0x201efe,_0x3e7121){try{if(_0xdc96af[_0x6728('0x31')]){_0xdc96af[_0x6728('0x32')]=[];_0xdc96af[_0x6728('0x31')][_0x6728('0x33')](',')['forEach'](function(_0x18c103){_0xdc96af['Tags'][_0x6728('0x34')](_0x1074dc[_0x18c103]);});}delete _0xdc96af[_0x6728('0x31')];}catch(_0x1a499f){_0x3e7121(_0x1a499f);}_0x201efe(_0xdc96af);});}function updateFaxInteraction(_0x3546ed,_0x185d57,_0x4e0ddf){return new BPromise(function(_0x16d15a,_0x347d54){return getInteractionUsers(_0x3546ed,_0x4e0ddf)[_0x6728('0x2a')](function(_0x3d39ea){return getInteractionTags(_0x3d39ea,_0x185d57);})[_0x6728('0x2a')](function(_0x46a834){return getStateInteraction(_0x46a834);})[_0x6728('0x2a')](function(_0x45ee55){_0x16d15a(_0x45ee55);})[_0x6728('0x35')](function(_0x45ec65){_0x347d54(_0x45ec65);});});}function getStateInteraction(_0x13a301){return new BPromise(function(_0x31df8c){_0x13a301[_0x6728('0x36')]=0x0;_0x13a301[_0x6728('0x37')]=0x0;_0x13a301[_0x6728('0x38')]=0x0;_0x13a301['unmanaged']=0x0;_0x13a301[_0x6728('0x39')]=0x0;if(!_0x13a301[_0x6728('0x3a')]&&!_0x13a301[_0x6728('0x3b')]){_0x13a301[_0x6728('0x36')]+=0x1;}if(!_0x13a301[_0x6728('0x3a')]&&_0x13a301[_0x6728('0x3b')]){_0x13a301[_0x6728('0x37')]+=0x1;if(_0x13a301[_0x6728('0x36')]){_0x13a301[_0x6728('0x36')]-=0x1;}}if(_0x13a301[_0x6728('0x3a')]&&_0x13a301['UserId']){_0x13a301[_0x6728('0x38')]+=0x1;if(_0x13a301[_0x6728('0x37')]){_0x13a301['talking']-=0x1;}}if(_0x13a301['closed']&&!_0x13a301[_0x6728('0x3b')]){_0x13a301[_0x6728('0x3c')]+=0x1;if(_0x13a301[_0x6728('0x36')]){_0x13a301[_0x6728('0x36')]-=0x1;}}_0x13a301[_0x6728('0x39')]+=0x1;_0x31df8c(_0x13a301);});}exports[_0x6728('0x3d')]=function(_0x4ecdb8,_0x53a50e){var _0x548482={},_0x3159c8={},_0x1f717f={'count':0x0,'rows':[]};var _0x2b55fd=_[_0x6728('0x2f')](db[_0x6728('0x3e')][_0x6728('0x3f')],function(_0x3bee70){return{'name':_0x3bee70[_0x6728('0x40')],'type':_0x3bee70['type'][_0x6728('0x41')]};});_0x3159c8[_0x6728('0x42')]=_[_0x6728('0x2f')](_0x2b55fd,_0x6728('0x43'));_0x3159c8[_0x6728('0x44')]=_['keys'](_0x4ecdb8[_0x6728('0x44')]);_0x3159c8[_0x6728('0x45')]=_[_0x6728('0x46')](_0x3159c8[_0x6728('0x42')],_0x3159c8[_0x6728('0x44')]);_0x548482[_0x6728('0x47')]=_['intersection'](_0x3159c8[_0x6728('0x42')],qs[_0x6728('0x48')](_0x4ecdb8[_0x6728('0x44')][_0x6728('0x48')]));_0x548482[_0x6728('0x47')]=_0x548482[_0x6728('0x47')][_0x6728('0x49')]?_0x548482[_0x6728('0x47')]:_0x3159c8[_0x6728('0x42')];if(!_0x4ecdb8[_0x6728('0x44')]['hasOwnProperty'](_0x6728('0x4a'))){_0x548482[_0x6728('0x23')]=qs[_0x6728('0x23')](_0x4ecdb8[_0x6728('0x44')]['limit']);_0x548482[_0x6728('0x21')]=qs[_0x6728('0x21')](_0x4ecdb8['query']['offset']);}_0x548482[_0x6728('0x4b')]=qs[_0x6728('0x4c')](_0x4ecdb8[_0x6728('0x44')][_0x6728('0x4c')]);_0x548482[_0x6728('0x4d')]=qs['filters'](_[_0x6728('0x4e')](_0x4ecdb8[_0x6728('0x44')],_0x3159c8[_0x6728('0x45')]),_0x2b55fd);var _0x4fc4c0=[];var _0xc7db4e=squel[_0x6728('0x4f')]()['field']('id')['field'](_0x6728('0x43'))[_0x6728('0x50')](_0x6728('0x51'))[_0x6728('0x52')](_0x6728('0x53'));var _0x18ca1f=squel[_0x6728('0x4f')]()[_0x6728('0x50')]('u.id')[_0x6728('0x50')]('u.fullname')[_0x6728('0x50')]('ui.FaxInteractionId')[_0x6728('0x52')](_0x6728('0x54'),'ui')['left_join']('users','u',_0x6728('0x55'));var _0x2b8944=squel[_0x6728('0x4f')]()[_0x6728('0x52')](_0x6728('0x56'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x6728('0x57')](_0x6728('0x58'),'o',_0x6728('0x59'))['left_join']('fax_accounts','a',_0x6728('0x5a'))['left_join'](_0x6728('0x5b'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x6728('0x57')](_0x6728('0x5c'),'it',_0x6728('0x5d'))['left_join'](_0x6728('0x53'),'t','t.id\x20=\x20it.TagId');var _0x1bd4a1=squel[_0x6728('0x5e')]();var _0x23dc4e=[];var _0x2a41b2=squel[_0x6728('0x5e')]();var _0x5b35c5;if(_0x4ecdb8[_0x6728('0x44')][_0x6728('0x5f')]){_0x5b35c5=as[_0x6728('0x60')](_0x4ecdb8[_0x6728('0x44')][_0x6728('0x5f')]);var _0x4332be=_0x5b35c5[_0x6728('0x61')];for(var _0x2596a1=0x0;_0x2596a1<_0x5b35c5[_0x6728('0x62')][_0x6728('0x49')];_0x2596a1++){var _0x5d71f3=_0x5b35c5[_0x6728('0x62')][_0x2596a1];var _0x2bc736='i';var _0x33fdf=_[_0x6728('0x63')](_0x2b55fd,[_0x6728('0x43'),_0x5d71f3[_0x6728('0x50')]]);if(!_0x33fdf){switch(_0x5d71f3[_0x6728('0x50')]){case'unreadMessages':if(_0x5d71f3['value']==0x1){_0x2b8944[_0x6728('0x64')]('`'+_0x5d71f3[_0x6728('0x50')]+_0x6728('0x65'));}else{_0x2b8944[_0x6728('0x64')]('`'+_0x5d71f3[_0x6728('0x50')]+_0x6728('0x66'));}break;case _0x6728('0x67'):if(_0x5d71f3['operator']==='$substring'){if(_0x5d71f3[_0x6728('0x68')][_0x6728('0x33')]('\x20')[_0x6728('0x49')]>0x1){_0x1bd4a1[_0x4332be](_0x6728('0x69'),qs[_0x6728('0x6a')](_0x5d71f3[_0x6728('0x68')]),null);}else{var _0x2c4cbd='%'+_0x5d71f3[_0x6728('0x68')]+'%';_0x1bd4a1[_0x4332be](_0x6728('0x6b'),_0x2c4cbd,_0x2c4cbd,_0x2c4cbd);}}else{_0x33fdf=_[_0x6728('0x63')](_0x2b55fd,['name',_0x6728('0x6c')]);_0x5d71f3[_0x6728('0x50')]=_0x6728('0x6c');_0x278c52=as[_0x6728('0x6d')](_0x2bc736,_0x33fdf[_0x6728('0x6e')],_0x5d71f3);_0x1bd4a1[_0x4332be](_0x278c52[_0x6728('0x6f')],_0x278c52[_0x6728('0x68')]['start'],_0x278c52[_0x6728('0x68')][_0x6728('0x20')]);}break;case _0x6728('0x70'):var _0x1e21f6=_0x5d71f3[_0x6728('0x68')][_0x6728('0x33')](',')['map'](function(_0x41882e){return Number(_0x41882e);});_0x1e21f6['forEach'](function(_0x192706){_0x2a41b2['or'](_0x6728('0x71'),'%,'+_0x192706+',%');});_0x23dc4e=_[_0x6728('0x72')](_0x23dc4e,_0x1e21f6);break;case _0x6728('0x73'):if(_0x5d71f3['operator']===_0x6728('0x74')){_0x1bd4a1[_0x4332be](_0x6728('0x75'),'%'+_0x5d71f3[_0x6728('0x68')]+'%',null);}else{_0x33fdf=_['find'](_0x2b55fd,[_0x6728('0x43'),_0x6728('0x3b')]);_0x5d71f3[_0x6728('0x50')]=_0x6728('0x3b');_0x278c52=as['buildExpression'](_0x2bc736,_0x33fdf[_0x6728('0x6e')],_0x5d71f3);_0x1bd4a1[_0x4332be](_0x278c52[_0x6728('0x6f')],_0x278c52['value']['start'],_0x278c52[_0x6728('0x68')][_0x6728('0x20')]);}break;case _0x6728('0x76'):_0x278c52=as[_0x6728('0x6d')]('me',null,_0x5d71f3);_0x1bd4a1[_0x4332be](_0x278c52[_0x6728('0x6f')],_0x278c52[_0x6728('0x68')]['start'],_0x278c52[_0x6728('0x68')]['end']);break;}}else{var _0x278c52=as[_0x6728('0x6d')](_0x2bc736,_0x33fdf[_0x6728('0x6e')],_0x5d71f3);_0x1bd4a1[_0x4332be](_0x278c52[_0x6728('0x6f')],_0x278c52[_0x6728('0x68')][_0x6728('0x77')],_0x278c52['value']['end']);}}}else{var _0x3ddd8e=_(_0x4ecdb8[_0x6728('0x44')])[_0x6728('0x78')]()[_0x6728('0x2f')](function(_0xc7e4c0){return _[_0x6728('0x79')](_0x2b55fd,[_0x6728('0x43'),_0xc7e4c0])?_0xc7e4c0:undefined;})['compact']()[_0x6728('0x68')]();if(!_[_0x6728('0x7a')](_0x3ddd8e)){_0x3ddd8e[_0x6728('0x7b')](function(_0x13102a){if(_0x13102a===_0x6728('0x7c')){_0x2b8944['where'](_0x6728('0x7d'),[][_0x6728('0x7e')](_0x4ecdb8['query'][_0x13102a]));}else if(_0x13102a===_0x6728('0x7f')){var _0x2979b8=JSON[_0x6728('0x80')](_0x4ecdb8[_0x6728('0x44')][_0x13102a])[_0x6728('0x81')];var _0x1cd4c1=JSON[_0x6728('0x80')](_0x4ecdb8[_0x6728('0x44')][_0x13102a])[_0x6728('0x82')];_0x2b8944[_0x6728('0x4d')](_0x6728('0x83'),_0x2979b8,_0x1cd4c1);}else{if(_0x4ecdb8['query'][_0x13102a]===_0x6728('0x84')){_0x2b8944[_0x6728('0x4d')]('i.'+_0x13102a+_0x6728('0x85'));}else{_0x2b8944[_0x6728('0x4d')]('i.'+_0x13102a+'\x20=\x20?',_0x4ecdb8['query'][_0x13102a]);}}});}if(_0x4ecdb8[_0x6728('0x44')][_0x6728('0x86')]){if(_0x4ecdb8['query'][_0x6728('0x86')]==0x1){_0x2b8944[_0x6728('0x64')](_0x6728('0x87'));}else{_0x2b8944[_0x6728('0x64')](_0x6728('0x88'));}}if(_0x4ecdb8['query'][_0x6728('0x89')]){_0x23dc4e=_['isArray'](_0x4ecdb8['query']['tag'])?_0x4ecdb8['query']['tag']:new Array(_0x4ecdb8[_0x6728('0x44')][_0x6728('0x89')]);_0x23dc4e[_0x6728('0x7b')](function(_0x4f05fe){_0x2a41b2['or'](_0x6728('0x71'),'%,'+_0x4f05fe+',%');});}if(_0x4ecdb8[_0x6728('0x44')][_0x6728('0x8a')]){var _0x9e0529=_0x4ecdb8['query'][_0x6728('0x8a')][_0x6728('0x8b')]('\x5c','\x5c\x5c')[_0x6728('0x8b')](/'/g,'\x27\x27');if(qs[_0x6728('0x8c')](_0x9e0529)){_0x1bd4a1['or'](_0x6728('0x8d'),_0x9e0529+'%')['or']('i.fax\x20LIKE\x20?',_0x9e0529+'%');}_0x1bd4a1['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x9e0529+'%');}}_0x2b8944[_0x6728('0x4d')](_0x1bd4a1);_0x2b8944[_0x6728('0x8e')]('i.id');var _0x2cc142={'type':db[_0x6728('0x8f')][_0x6728('0x90')][_0x6728('0x91')],'raw':!![]};var _0x21a412=_0x2b8944[_0x6728('0x92')]();_0x21a412['field'](_0x6728('0x93'));_0x21a412['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6728('0x94'));if(_0x548482[_0x6728('0x4b')]){_0x548482['order']['forEach'](function(_0x262097){var _0x5a46eb=_0x262097[0x0]===_0x6728('0x95')?_0x262097[0x0]:'i.'+_0x262097[0x0];_0x2b8944[_0x6728('0x4b')](_0x5a46eb,_0x262097[0x1]===_0x6728('0x96')?![]:!![]);});}if(!_[_0x6728('0x7a')](_0x23dc4e)){_0x2b8944['having'](_0x2a41b2);_0x21a412['where'](_0x6728('0x97'),_0x23dc4e);}BPromise['resolve']()[_0x6728('0x2a')](function(){if(!_0x5b35c5){if(_0x4ecdb8[_0x6728('0x44')][_0x6728('0x7c')])return;_0x21a412['where'](_0x6728('0x98'));_0x2b8944[_0x6728('0x4d')](_0x6728('0x98'));return;}if(_0x4ecdb8['user'][_0x6728('0x99')]!==_0x6728('0x9a'))return;return _0x4ecdb8['user'][_0x6728('0x9b')]({'attributes':['id'],'raw':!![]})[_0x6728('0x2a')](function(_0x21b727){if(_[_0x6728('0x7a')](_0x21b727)){_0x21a412[_0x6728('0x4d')](_0x6728('0x9c'));_0x2b8944[_0x6728('0x4d')](_0x6728('0x9c'));}else{_0x21a412[_0x6728('0x4d')](_0x6728('0x7d'),_[_0x6728('0x2f')](_0x21b727,'id'));_0x2b8944['where'](_0x6728('0x7d'),_['map'](_0x21b727,'id'));}});})[_0x6728('0x2a')](function(){if(_0x4ecdb8[_0x6728('0x9d')][_0x6728('0x99')]===_0x6728('0x9a')&&!_0x5b35c5&&!_0x4ecdb8[_0x6728('0x44')][_0x6728('0x7c')])return[];return db[_0x6728('0x9e')][_0x6728('0x44')](_0x21a412['toString'](),_0x2cc142);})['then'](function(_0x42e2d7){_0x1f717f['count']=_0x42e2d7[_0x6728('0x49')];if(_0x1f717f['count']===0x0)return[];return db[_0x6728('0x9e')][_0x6728('0x44')](_0xc7db4e[_0x6728('0x9f')](),_0x2cc142)[_0x6728('0x2a')](function(_0x395749){_0x4fc4c0=_[_0x6728('0xa0')](_0x395749,'id');_0x2cc142=_[_0x6728('0xa1')](_0x2cc142,{'model':db[_0x6728('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4ecdb8[_0x6728('0x44')][_0x6728('0x48')]){_0x548482[_0x6728('0x47')][_0x6728('0x7b')](function(_0x4bf703){_0x2b8944[_0x6728('0x50')]('i.'+_0x4bf703);});}else{_0x2b8944[_0x6728('0x50')](_0x6728('0xa2'),_0x6728('0x94'));_0x2b8944['field'](_0x6728('0xa3'),_0x6728('0xa4'));_0x2b8944[_0x6728('0x50')]('a.mandatoryDisposition',_0x6728('0xa5'));_0x2b8944[_0x6728('0x50')](_0x6728('0xa6'),'contactName');_0x2b8944[_0x6728('0x50')](_0x6728('0xa7'));_0x2b8944[_0x6728('0x50')](_0x6728('0xa8'),_0x6728('0xa9'));_0x2b8944[_0x6728('0x50')](_0x6728('0xaa'),_0x6728('0xab'));_0x2b8944['field'](_0x6728('0xac'),_0x6728('0xad'));_0x2b8944[_0x6728('0x50')](_0x6728('0xae'),_0x6728('0xaf'));_0x2b8944[_0x6728('0x50')](_0x6728('0xb0'),_0x6728('0xb1'));_0x2b8944[_0x6728('0x50')](_0x6728('0xb2'),_0x6728('0xb3'));_0x2b8944[_0x6728('0x50')](_0x6728('0xb4'),_0x6728('0xb5'));_0x2b8944['field'](_0x6728('0xb6'),_0x6728('0xb7'));_0x2b8944[_0x6728('0x50')](_0x6728('0xb8'),_0x6728('0x31'));}if(_0x548482[_0x6728('0x23')])_0x2b8944['limit'](_0x548482['limit']);if(_0x548482[_0x6728('0x21')])_0x2b8944[_0x6728('0x21')](_0x548482['offset']);return db[_0x6728('0x9e')]['query'](_0x2b8944['toString'](),_0x2cc142);})[_0x6728('0x2a')](function(_0x477758){if(_0x477758[_0x6728('0x49')]>0x0)_0x18ca1f['where'](_0x6728('0xb9'),_[_0x6728('0x2f')](_0x477758,'id'));return db[_0x6728('0x9e')]['query'](_0x18ca1f[_0x6728('0x9f')](),_0x2cc142)[_0x6728('0x2a')](function(_0x38e55d){var _0x1036a8=_[_0x6728('0xba')](_0x38e55d,_0x6728('0xbb'));var _0x5e3a32=[];_0x477758[_0x6728('0x7b')](function(_0x56fd72){_0x5e3a32[_0x6728('0x34')](updateFaxInteraction(_0x56fd72,_0x4fc4c0,_0x1036a8));});return BPromise['all'](_0x5e3a32);});});})[_0x6728('0x2a')](function(_0x4326e1){_0x1f717f[_0x6728('0xbc')]=_0x4326e1;return _0x1f717f;})['then'](respondWithFilteredResult(_0x53a50e,_0x548482))['catch'](handleError(_0x53a50e,null));};exports[_0x6728('0xbd')]=function(_0x4fdcd4,_0x5e0777){var _0x21504a={'raw':![],'where':{'id':_0x4fdcd4['params']['id']}},_0x1542cf={};_0x1542cf[_0x6728('0x42')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x1542cf[_0x6728('0x44')]=_[_0x6728('0x78')](_0x4fdcd4[_0x6728('0x44')]);_0x1542cf[_0x6728('0x45')]=_[_0x6728('0x46')](_0x1542cf['model'],_0x1542cf['query']);_0x21504a[_0x6728('0x47')]=_[_0x6728('0x46')](_0x1542cf[_0x6728('0x42')],qs['fields'](_0x4fdcd4[_0x6728('0x44')]['fields']));_0x21504a['attributes']=_0x21504a[_0x6728('0x47')][_0x6728('0x49')]?_0x21504a[_0x6728('0x47')]:_0x1542cf[_0x6728('0x42')];if(_0x4fdcd4[_0x6728('0x44')][_0x6728('0xbe')]){_0x21504a[_0x6728('0xbf')]=[{'all':!![]}];}_0x21504a=_[_0x6728('0xa1')]({},_0x21504a,_0x4fdcd4[_0x6728('0xc0')]);return db[_0x6728('0x3e')][_0x6728('0x63')](_0x21504a)[_0x6728('0x2a')](handleEntityNotFound(_0x5e0777,null))['then'](respondWithResult(_0x5e0777,null))['catch'](handleError(_0x5e0777,null));};exports[_0x6728('0xc1')]=function(_0x3968c2,_0x41c96d){return db[_0x6728('0x3e')][_0x6728('0xc1')](_0x3968c2[_0x6728('0x76')],{})[_0x6728('0x2a')](respondWithResult(_0x41c96d,0xc9))['catch'](handleError(_0x41c96d,null));};exports[_0x6728('0x29')]=function(_0x12bb05,_0x3d56a9){if(_0x12bb05[_0x6728('0x76')]['id']){delete _0x12bb05['body']['id'];}return db['FaxInteraction'][_0x6728('0x63')]({'where':{'id':_0x12bb05[_0x6728('0xc2')]['id']}})['then'](handleEntityNotFound(_0x3d56a9,null))['then'](saveUpdates(_0x12bb05[_0x6728('0x76')],null))['then'](respondWithResult(_0x3d56a9,null))[_0x6728('0x35')](handleError(_0x3d56a9,null));};exports[_0x6728('0xc3')]=function(_0x53baf9,_0x32555e){return db['FaxInteraction'][_0x6728('0x63')]({'where':{'id':_0x53baf9[_0x6728('0xc2')]['id']}})[_0x6728('0x2a')](handleEntityNotFound(_0x32555e,null))[_0x6728('0x2a')](removeEntity(_0x32555e,null))[_0x6728('0x35')](handleError(_0x32555e,null));};exports[_0x6728('0xc4')]=function(_0x5bb2d4,_0x3fc768){return db[_0x6728('0x3e')][_0x6728('0xc4')]()[_0x6728('0x2a')](respondWithResult(_0x3fc768,null))[_0x6728('0x35')](handleError(_0x3fc768,null));};exports[_0x6728('0xc5')]=function(_0x2fb0d6,_0xdf0b0,_0x4fd291){return db[_0x6728('0xc6')][_0x6728('0x63')]({'where':{'id':_0x2fb0d6[_0x6728('0xc2')]['id']}})[_0x6728('0x2a')](handleEntityNotFound(_0xdf0b0,null))[_0x6728('0x2a')](function(_0x8efbe1){if(_0x8efbe1){return _0x8efbe1[_0x6728('0xc5')](_0x2fb0d6[_0x6728('0x76')][_0x6728('0xc7')],_[_0x6728('0xc8')](_0x2fb0d6[_0x6728('0x76')],[_0x6728('0xc7'),'id'])||{});}})['then'](respondWithResult(_0xdf0b0,null))[_0x6728('0x35')](handleError(_0xdf0b0,null));};exports[_0x6728('0xc9')]=function(_0x20dee1,_0x33eb88,_0x16c67e){var _0x16b3a8={'raw':![],'where':{}};var _0x18e0e5={};var _0x57ee63={'count':0x0,'rows':[]};return db[_0x6728('0x3e')][_0x6728('0xca')]({'where':{'id':_0x20dee1[_0x6728('0xc2')]['id']}})['then'](handleEntityNotFound(_0x33eb88,null))[_0x6728('0x2a')](function(_0x3c2f93){if(_0x3c2f93){_0x18e0e5[_0x6728('0x42')]=_[_0x6728('0x78')](db['FaxMessage'][_0x6728('0x3f')]);_0x18e0e5['query']=_['keys'](_0x20dee1[_0x6728('0x44')]);_0x18e0e5[_0x6728('0x45')]=_[_0x6728('0x46')](_0x18e0e5[_0x6728('0x42')],_0x18e0e5[_0x6728('0x44')]);_0x16b3a8[_0x6728('0x47')]=_[_0x6728('0x46')](_0x18e0e5['model'],qs['fields'](_0x20dee1[_0x6728('0x44')][_0x6728('0x48')]));_0x16b3a8[_0x6728('0x47')]=_0x16b3a8[_0x6728('0x47')][_0x6728('0x49')]?_0x16b3a8[_0x6728('0x47')]:_0x18e0e5[_0x6728('0x42')];if(!_0x20dee1['query'][_0x6728('0xcb')]('nolimit')){_0x16b3a8['limit']=qs['limit'](_0x20dee1['query'][_0x6728('0x23')]);_0x16b3a8[_0x6728('0x21')]=qs['offset'](_0x20dee1[_0x6728('0x44')][_0x6728('0x21')]);}_0x16b3a8['order']=qs[_0x6728('0x4c')](_0x20dee1[_0x6728('0x44')][_0x6728('0x4c')]);_0x16b3a8[_0x6728('0x4d')]=qs[_0x6728('0x45')](_[_0x6728('0x4e')](_0x20dee1['query'],_0x18e0e5[_0x6728('0x45')]));_0x16b3a8['where'][_0x6728('0xbb')]=_0x3c2f93['id'];if(_0x20dee1['query'][_0x6728('0x8a')]){_0x16b3a8[_0x6728('0x4d')]=_[_0x6728('0xa1')](_0x16b3a8['where'],{'$or':_[_0x6728('0x2f')](_0x16b3a8['attributes'],function(_0x5ab5f2){var _0x57a722={};_0x57a722[_0x5ab5f2]={'$like':'%'+_0x20dee1[_0x6728('0x44')][_0x6728('0x8a')]+'%'};return _0x57a722;})});}if(_0x20dee1[_0x6728('0x44')][_0x6728('0x81')]){var _0x448993=_0x20dee1[_0x6728('0x44')]['$gte']['split'](',');var _0x294443={};_0x294443[_0x448993[0x0]]={'$gte':moment(_0x448993[0x1])['format'](_0x6728('0xcc'))};_0x16b3a8[_0x6728('0x4d')]=_[_0x6728('0xa1')](_0x16b3a8[_0x6728('0x4d')],_0x294443);}_0x16b3a8=_[_0x6728('0xa1')]({},_0x16b3a8,_0x20dee1['options']);return db[_0x6728('0xc6')][_0x6728('0x24')]({'where':_0x16b3a8[_0x6728('0x4d')]})[_0x6728('0x2a')](function(_0x5c70a2){_0x57ee63['count']=_0x5c70a2;if(_0x20dee1['query'][_0x6728('0xbe')]){_0x16b3a8[_0x6728('0xbf')]=[{'all':!![]}];}return db[_0x6728('0xc6')][_0x6728('0xcd')](_0x16b3a8);})[_0x6728('0x2a')](function(_0x4b2a57){_0x57ee63[_0x6728('0xbc')]=_0x4b2a57;return _0x57ee63;});}})[_0x6728('0x2a')](respondWithFilteredResult(_0x33eb88,_0x16b3a8))[_0x6728('0x35')](handleError(_0x33eb88,null));};exports[_0x6728('0xce')]=function(_0xf82eec,_0x3b9365,_0x5ebfa6){return db[_0x6728('0x3e')][_0x6728('0x63')]({'where':{'id':_0xf82eec[_0x6728('0xc2')]['id']}})[_0x6728('0x2a')](handleEntityNotFound(_0x3b9365,null))['then'](function(_0x4688e6){if(_0x4688e6){return _0x4688e6['setTags'](_0xf82eec[_0x6728('0x76')]['ids'],_[_0x6728('0xc8')](_0xf82eec[_0x6728('0x76')],['ids','id'])||{})[_0x6728('0xcf')](function(){return db[_0x6728('0x70')][_0x6728('0xcd')]({'attributes':['id',_0x6728('0x43'),_0x6728('0x51')],'where':{'id':_0xf82eec[_0x6728('0x76')]['ids']}});})['then'](function(_0x1911a7){socket[_0x6728('0xd0')]('faxInteractionTags:save',{'id':Number(_0xf82eec[_0x6728('0xc2')]['id']),'tags':_0x1911a7||[]});return{'id':Number(_0xf82eec[_0x6728('0xc2')]['id']),'tags':_0x1911a7||[]};});}})['then'](respondWithResult(_0x3b9365,null))[_0x6728('0x35')](handleError(_0x3b9365,null));};exports[_0x6728('0xd1')]=function(_0x4ff35d,_0x1cbbde,_0x2c0b94){return db[_0x6728('0x3e')][_0x6728('0x63')]({'where':{'id':_0x4ff35d[_0x6728('0xc2')]['id']}})['then'](handleEntityNotFound(_0x1cbbde,null))[_0x6728('0x2a')](function(_0x32f4b9){if(_0x32f4b9){return _0x32f4b9[_0x6728('0xd1')](_0x4ff35d[_0x6728('0x44')][_0x6728('0xc7')]);}})[_0x6728('0x2a')](respondWithStatusCode(_0x1cbbde,null))['catch'](handleError(_0x1cbbde,null));};exports[_0x6728('0xd2')]=function(_0x5a854c,_0x2b83a6){var _0x5e44f2=moment()[_0x6728('0xd3')]()[_0x6728('0x9f')]();var _0x59be2b=path[_0x6728('0xd4')](config[_0x6728('0xd5')],_0x6728('0xd6'),_0x6728('0xd7'),_0x6728('0xd8'));var _0x3c0ac3=path[_0x6728('0xd4')](config[_0x6728('0xd5')],_0x6728('0xd6'),'files',_0x6728('0xd9'));var _0x106f69=path[_0x6728('0xd4')](_0x59be2b,_0x5e44f2);var _0x363d0c=util[_0x6728('0xda')](_0x6728('0xdb'),_0x5a854c[_0x6728('0xc2')]['id'],_0x5e44f2);var _0x216470=path[_0x6728('0xd4')](_0x59be2b,_0x363d0c);var _0x527fae=[];_0x527fae['push']({'model':db['Attachment'],'as':_0x6728('0xdc'),'raw':!![]});var _0x58f43c=[{'model':db[_0x6728('0xc6')],'as':'Messages','attributes':['id',_0x6728('0x76'),_0x6728('0x7f')],'include':_0x527fae}];return db[_0x6728('0x3e')]['find']({'where':{'id':_0x5a854c['params']['id']},'include':_0x58f43c})[_0x6728('0x2a')](handleEntityNotFound(_0x2b83a6,null))[_0x6728('0x2a')](function(_0x260ed1){if(_0x260ed1&&_0x260ed1[_0x6728('0xdd')]){var _0x16f89f=_0x260ed1['get']({'plain':!![]});fs['mkdirSync'](_0x106f69);for(var _0x4c401d=0x0;_0x4c401d<_0x16f89f[_0x6728('0xdd')]['length'];_0x4c401d++){var _0x32ab44=_0x16f89f['Messages'][_0x4c401d][_0x6728('0xdc')];if(_0x32ab44){var _0x7fb20b=path['join'](_0x3c0ac3,_0x32ab44[_0x6728('0xde')]);if(fs['existsSync'](_0x7fb20b)){fs[_0x6728('0xdf')](_0x7fb20b)['pipe'](fs['createWriteStream'](path[_0x6728('0xd4')](_0x106f69,_0x32ab44[_0x6728('0xde')])));}}}return BPromise[_0x6728('0xe0')]()['then'](function(){return new BPromise(function(_0xd1c57b,_0x16abf2){zipdir(_0x106f69,{'saveTo':_0x216470},function(_0x2218f3,_0x423a53){if(_0x2218f3)return _0x16abf2(_0x2218f3);return _0xd1c57b(_0x423a53);});})[_0x6728('0x2a')](function(){return new BPromise(function(_0xf565ba,_0x4da3f6){rimraf(_0x106f69,function(_0x194a93){if(_0x194a93)_0x4da3f6(_0x194a93);return _0xf565ba();});});})[_0x6728('0x2a')](function(){return _0x2b83a6[_0x6728('0xd2')](_0x216470,_0x363d0c,function(_0x25878c){if(_0x25878c){console[_0x6728('0xe1')](_0x6728('0xe2'),_0x25878c);}else{fs[_0x6728('0xe3')](_0x216470);}});});});}else{return _0x2b83a6[_0x6728('0x1e')](0xc8);}})[_0x6728('0x35')](handleError(_0x2b83a6,null));}; \ No newline at end of file +var _0x1e58=['Contact','operator','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','keys','some','compact','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','resolve','FaxAccountId','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','show','params','FaxInteraction','include','merge','create','body','describe','addMessage','omit','getMessages','FaxMessage','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','ids','spread','faxInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','talking','unmanaged','closed','UserId','waiting','answered','total','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','users','u.id\x20=\x20ui.UserId','from','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200'];(function(_0x3e18bf,_0x387f5e){var _0x1022e5=function(_0x242ec4){while(--_0x242ec4){_0x3e18bf['push'](_0x3e18bf['shift']());}};_0x1022e5(++_0x387f5e);}(_0x1e58,0x74));var _0x81e5=function(_0x1f26bb,_0x5ca46c){_0x1f26bb=_0x1f26bb-0x0;var _0x466c79=_0x1e58[_0x1f26bb];return _0x466c79;};'use strict';var emlformat=require(_0x81e5('0x0'));var rimraf=require(_0x81e5('0x1'));var zipdir=require(_0x81e5('0x2'));var jsonpatch=require(_0x81e5('0x3'));var rp=require(_0x81e5('0x4'));var moment=require(_0x81e5('0x5'));var BPromise=require(_0x81e5('0x6'));var Mustache=require(_0x81e5('0x7'));var util=require(_0x81e5('0x8'));var path=require('path');var sox=require(_0x81e5('0x9'));var csv=require(_0x81e5('0xa'));var ejs=require(_0x81e5('0xb'));var fs=require('fs');var fs_extra=require(_0x81e5('0xc'));var _=require(_0x81e5('0xd'));var squel=require('squel');var crypto=require(_0x81e5('0xe'));var jsforce=require(_0x81e5('0xf'));var deskjs=require(_0x81e5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x81e5('0x11'));var Papa=require(_0x81e5('0x12'));var Redis=require(_0x81e5('0x13'));var authService=require(_0x81e5('0x14'));var qs=require(_0x81e5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81e5('0x16'));var logger=require(_0x81e5('0x17'))(_0x81e5('0x18'));var utils=require(_0x81e5('0x19'));var config=require(_0x81e5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x81e5('0x1b'))['db'];config[_0x81e5('0x1c')]=_[_0x81e5('0x1d')](config[_0x81e5('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x81e5('0x1e'))(new Redis(config[_0x81e5('0x1c')]));require(_0x81e5('0x1f'))[_0x81e5('0x20')](socket);function respondWithStatusCode(_0x5ee13b,_0x30b9ba){_0x30b9ba=_0x30b9ba||0xcc;return function(_0x34a1e0){if(_0x34a1e0){return _0x5ee13b[_0x81e5('0x21')](_0x30b9ba);}return _0x5ee13b[_0x81e5('0x22')](_0x30b9ba)[_0x81e5('0x23')]();};}function respondWithResult(_0x512418,_0x5252f4){_0x5252f4=_0x5252f4||0xc8;return function(_0x37fead){if(_0x37fead){return _0x512418['status'](_0x5252f4)[_0x81e5('0x24')](_0x37fead);}};}function respondWithFilteredResult(_0x4431db,_0x4ccfb2){return function(_0x4b8c9d){if(_0x4b8c9d){var _0xfa41b4=typeof _0x4ccfb2[_0x81e5('0x25')]===_0x81e5('0x26')&&typeof _0x4ccfb2[_0x81e5('0x27')]==='undefined';var _0x3dc82f=_0x4b8c9d[_0x81e5('0x28')];var _0x30047a=_0xfa41b4?0x0:_0x4ccfb2[_0x81e5('0x25')];var _0x54d6f4=_0xfa41b4?_0x4b8c9d['count']:_0x4ccfb2[_0x81e5('0x25')]+_0x4ccfb2[_0x81e5('0x27')];var _0x516640;if(_0x54d6f4>=_0x3dc82f){_0x54d6f4=_0x3dc82f;_0x516640=0xc8;}else{_0x516640=0xce;}_0x4431db[_0x81e5('0x22')](_0x516640);return _0x4431db[_0x81e5('0x29')](_0x81e5('0x2a'),_0x30047a+'-'+_0x54d6f4+'/'+_0x3dc82f)[_0x81e5('0x24')](_0x4b8c9d);}return null;};}function patchUpdates(_0x13d676){return function(_0x5b537c){try{jsonpatch[_0x81e5('0x2b')](_0x5b537c,_0x13d676,!![]);}catch(_0x57ba51){return BPromise[_0x81e5('0x2c')](_0x57ba51);}return _0x5b537c['save']();};}function saveUpdates(_0x531214,_0x6245a1){return function(_0x3a34a2){if(_0x3a34a2){return _0x3a34a2[_0x81e5('0x2d')](_0x531214)[_0x81e5('0x2e')](function(_0x36fc4e){return _0x36fc4e;});}return null;};}function removeEntity(_0x1a8d63,_0x1fa988){return function(_0x1efeb9){if(_0x1efeb9){return _0x1efeb9[_0x81e5('0x2f')]()[_0x81e5('0x2e')](function(){_0x1a8d63['status'](0xcc)[_0x81e5('0x23')]();});}};}function handleEntityNotFound(_0x57fa41,_0x1a4829){return function(_0x365dfc){if(!_0x365dfc){_0x57fa41[_0x81e5('0x21')](0x194);}return _0x365dfc;};}function handleError(_0x16bc08,_0x4ff5a8){_0x4ff5a8=_0x4ff5a8||0x1f4;return function(_0x2b3909){logger['error'](_0x2b3909[_0x81e5('0x30')]);if(_0x2b3909[_0x81e5('0x31')]){delete _0x2b3909['name'];}_0x16bc08[_0x81e5('0x22')](_0x4ff5a8)[_0x81e5('0x32')](_0x2b3909);};}function getInteractionUsers(_0x30b361,_0x27d7eb){return new BPromise(function(_0x7157be,_0x54e040){try{if(_0x27d7eb[_0x30b361['id']]){_0x30b361[_0x81e5('0x33')]=_[_0x81e5('0x34')](_0x27d7eb[_0x30b361['id']],function(_0x4bc5da){return{'id':_0x4bc5da['id'],'fullname':_0x4bc5da['fullname']};});}}catch(_0x75bcf1){_0x54e040(_0x75bcf1);}_0x7157be(_0x30b361);});}function getInteractionTags(_0x4214cd,_0x2f5d0e){return new BPromise(function(_0x21eaeb,_0x534523){try{if(_0x4214cd[_0x81e5('0x35')]){_0x4214cd[_0x81e5('0x36')]=[];_0x4214cd[_0x81e5('0x35')][_0x81e5('0x37')](',')[_0x81e5('0x38')](function(_0xe133f7){_0x4214cd[_0x81e5('0x36')][_0x81e5('0x39')](_0x2f5d0e[_0xe133f7]);});}delete _0x4214cd[_0x81e5('0x35')];}catch(_0x504a96){_0x534523(_0x504a96);}_0x21eaeb(_0x4214cd);});}function updateFaxInteraction(_0x65282d,_0x58e6e0,_0x1009d2){return new BPromise(function(_0x191def,_0x57f9ad){return getInteractionUsers(_0x65282d,_0x1009d2)[_0x81e5('0x2e')](function(_0xd454fb){return getInteractionTags(_0xd454fb,_0x58e6e0);})[_0x81e5('0x2e')](function(_0x3d6920){return getStateInteraction(_0x3d6920);})[_0x81e5('0x2e')](function(_0x2745b){_0x191def(_0x2745b);})[_0x81e5('0x3a')](function(_0x315150){_0x57f9ad(_0x315150);});});}function getStateInteraction(_0x17bc45){return new BPromise(function(_0xb0bfe3){_0x17bc45['waiting']=0x0;_0x17bc45[_0x81e5('0x3b')]=0x0;_0x17bc45['answered']=0x0;_0x17bc45[_0x81e5('0x3c')]=0x0;_0x17bc45['total']=0x0;if(!_0x17bc45[_0x81e5('0x3d')]&&!_0x17bc45[_0x81e5('0x3e')]){_0x17bc45['waiting']+=0x1;}if(!_0x17bc45[_0x81e5('0x3d')]&&_0x17bc45['UserId']){_0x17bc45['talking']+=0x1;if(_0x17bc45[_0x81e5('0x3f')]){_0x17bc45['waiting']-=0x1;}}if(_0x17bc45[_0x81e5('0x3d')]&&_0x17bc45[_0x81e5('0x3e')]){_0x17bc45[_0x81e5('0x40')]+=0x1;if(_0x17bc45[_0x81e5('0x3b')]){_0x17bc45[_0x81e5('0x3b')]-=0x1;}}if(_0x17bc45[_0x81e5('0x3d')]&&!_0x17bc45[_0x81e5('0x3e')]){_0x17bc45[_0x81e5('0x3c')]+=0x1;if(_0x17bc45[_0x81e5('0x3f')]){_0x17bc45[_0x81e5('0x3f')]-=0x1;}}_0x17bc45[_0x81e5('0x41')]+=0x1;_0xb0bfe3(_0x17bc45);});}exports['index']=function(_0x1c356f,_0x5c34e5){var _0x53289e={},_0x252fae={},_0x60bf3={'count':0x0,'rows':[]};var _0x1b4ee4=_[_0x81e5('0x34')](db['FaxInteraction'][_0x81e5('0x42')],function(_0x1ff22a){return{'name':_0x1ff22a['fieldName'],'type':_0x1ff22a[_0x81e5('0x43')][_0x81e5('0x44')]};});_0x252fae[_0x81e5('0x45')]=_['map'](_0x1b4ee4,_0x81e5('0x31'));_0x252fae[_0x81e5('0x46')]=_['keys'](_0x1c356f[_0x81e5('0x46')]);_0x252fae['filters']=_[_0x81e5('0x47')](_0x252fae[_0x81e5('0x45')],_0x252fae['query']);_0x53289e[_0x81e5('0x48')]=_[_0x81e5('0x47')](_0x252fae[_0x81e5('0x45')],qs[_0x81e5('0x49')](_0x1c356f[_0x81e5('0x46')][_0x81e5('0x49')]));_0x53289e['attributes']=_0x53289e[_0x81e5('0x48')][_0x81e5('0x4a')]?_0x53289e['attributes']:_0x252fae['model'];if(!_0x1c356f[_0x81e5('0x46')][_0x81e5('0x4b')]('nolimit')){_0x53289e[_0x81e5('0x27')]=qs[_0x81e5('0x27')](_0x1c356f[_0x81e5('0x46')][_0x81e5('0x27')]);_0x53289e[_0x81e5('0x25')]=qs[_0x81e5('0x25')](_0x1c356f['query'][_0x81e5('0x25')]);}_0x53289e[_0x81e5('0x4c')]=qs[_0x81e5('0x4d')](_0x1c356f[_0x81e5('0x46')]['sort']);_0x53289e[_0x81e5('0x4e')]=qs[_0x81e5('0x4f')](_['pick'](_0x1c356f[_0x81e5('0x46')],_0x252fae[_0x81e5('0x4f')]),_0x1b4ee4);var _0x58ebba=[];var _0x2ce783=squel[_0x81e5('0x50')]()[_0x81e5('0x51')]('id')[_0x81e5('0x51')](_0x81e5('0x31'))[_0x81e5('0x51')](_0x81e5('0x52'))['from'](_0x81e5('0x53'));var _0x5d4115=squel[_0x81e5('0x50')]()['field'](_0x81e5('0x54'))[_0x81e5('0x51')](_0x81e5('0x55'))[_0x81e5('0x51')](_0x81e5('0x56'))['from']('user_has_fax_interactions','ui')['left_join'](_0x81e5('0x57'),'u',_0x81e5('0x58'));var _0x22a19c=squel['select']()[_0x81e5('0x59')](_0x81e5('0x5a'),'i')[_0x81e5('0x5b')](_0x81e5('0x5c'),'c',_0x81e5('0x5d'))[_0x81e5('0x5b')](_0x81e5('0x57'),'o',_0x81e5('0x5e'))[_0x81e5('0x5b')](_0x81e5('0x5f'),'a',_0x81e5('0x60'))[_0x81e5('0x5b')](_0x81e5('0x61'),'me',_0x81e5('0x62'))[_0x81e5('0x5b')](_0x81e5('0x63'),'it',_0x81e5('0x64'))[_0x81e5('0x5b')](_0x81e5('0x53'),'t',_0x81e5('0x65'));var _0x165ea2=squel[_0x81e5('0x66')]();var _0x131727=[];var _0x1f7ed1=squel['expr']();var _0x5b1254;if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x67')]){_0x5b1254=as['parseSearch'](_0x1c356f[_0x81e5('0x46')]['search']);var _0x1e2ae0=_0x5b1254['sqlOperator'];for(var _0x58246e=0x0;_0x58246e<_0x5b1254[_0x81e5('0x68')][_0x81e5('0x4a')];_0x58246e++){var _0x4ee5cb=_0x5b1254[_0x81e5('0x68')][_0x58246e];var _0x2962a4='i';var _0x493efa=_[_0x81e5('0x69')](_0x1b4ee4,[_0x81e5('0x31'),_0x4ee5cb[_0x81e5('0x51')]]);if(!_0x493efa){switch(_0x4ee5cb[_0x81e5('0x51')]){case _0x81e5('0x6a'):if(_0x4ee5cb['value']==0x1){_0x22a19c[_0x81e5('0x6b')]('`'+_0x4ee5cb[_0x81e5('0x51')]+_0x81e5('0x6c'));}else{_0x22a19c[_0x81e5('0x6b')]('`'+_0x4ee5cb[_0x81e5('0x51')]+_0x81e5('0x6d'));}break;case _0x81e5('0x6e'):if(_0x4ee5cb[_0x81e5('0x6f')]==='$substring'){if(_0x4ee5cb[_0x81e5('0x70')][_0x81e5('0x37')]('\x20')['length']>0x1){_0x165ea2[_0x1e2ae0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x81e5('0x71')](_0x4ee5cb['value']),null);}else{var _0x5a3077='%'+_0x4ee5cb[_0x81e5('0x70')]+'%';_0x165ea2[_0x1e2ae0](_0x81e5('0x72'),_0x5a3077,_0x5a3077,_0x5a3077);}}else{_0x493efa=_[_0x81e5('0x69')](_0x1b4ee4,[_0x81e5('0x31'),_0x81e5('0x73')]);_0x4ee5cb[_0x81e5('0x51')]=_0x81e5('0x73');_0x4b4c3b=as[_0x81e5('0x74')](_0x2962a4,_0x493efa['type'],_0x4ee5cb);_0x165ea2[_0x1e2ae0](_0x4b4c3b[_0x81e5('0x75')],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x76')],_0x4b4c3b[_0x81e5('0x70')]['end']);}break;case _0x81e5('0x77'):var _0x331944=_0x4ee5cb[_0x81e5('0x70')][_0x81e5('0x37')](',')[_0x81e5('0x34')](function(_0x3c691e){return Number(_0x3c691e);});_0x331944['forEach'](function(_0x24b305){_0x1f7ed1['or'](_0x81e5('0x78'),'%,'+_0x24b305+',%');});_0x131727=_[_0x81e5('0x79')](_0x131727,_0x331944);break;case _0x81e5('0x7a'):if(_0x4ee5cb['operator']==='$substring'){_0x165ea2[_0x1e2ae0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4ee5cb[_0x81e5('0x70')]+'%',null);}else{_0x493efa=_['find'](_0x1b4ee4,[_0x81e5('0x31'),_0x81e5('0x3e')]);_0x4ee5cb[_0x81e5('0x51')]=_0x81e5('0x3e');_0x4b4c3b=as[_0x81e5('0x74')](_0x2962a4,_0x493efa[_0x81e5('0x43')],_0x4ee5cb);_0x165ea2[_0x1e2ae0](_0x4b4c3b[_0x81e5('0x75')],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x76')],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x23')]);}break;case'body':_0x4b4c3b=as[_0x81e5('0x74')]('me',null,_0x4ee5cb);_0x165ea2[_0x1e2ae0](_0x4b4c3b['text'],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x76')],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x23')]);break;}}else{var _0x4b4c3b=as['buildExpression'](_0x2962a4,_0x493efa[_0x81e5('0x43')],_0x4ee5cb);_0x165ea2[_0x1e2ae0](_0x4b4c3b[_0x81e5('0x75')],_0x4b4c3b['value']['start'],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x23')]);}}}else{var _0x19768c=_(_0x1c356f[_0x81e5('0x46')])[_0x81e5('0x7b')]()[_0x81e5('0x34')](function(_0x2c6c3f){return _[_0x81e5('0x7c')](_0x1b4ee4,['name',_0x2c6c3f])?_0x2c6c3f:undefined;})[_0x81e5('0x7d')]()[_0x81e5('0x70')]();if(!_['isEmpty'](_0x19768c)){_0x19768c[_0x81e5('0x38')](function(_0x4809cb){if(_0x4809cb==='FaxAccountId'){_0x22a19c[_0x81e5('0x4e')](_0x81e5('0x7e'),[][_0x81e5('0x7f')](_0x1c356f[_0x81e5('0x46')][_0x4809cb]));}else if(_0x4809cb===_0x81e5('0x80')){var _0x5d88f3=JSON[_0x81e5('0x81')](_0x1c356f[_0x81e5('0x46')][_0x4809cb])[_0x81e5('0x82')];var _0x4c2e70=JSON[_0x81e5('0x81')](_0x1c356f['query'][_0x4809cb])['$lte'];_0x22a19c[_0x81e5('0x4e')](_0x81e5('0x83'),_0x5d88f3,_0x4c2e70);}else{if(_0x1c356f[_0x81e5('0x46')][_0x4809cb]===_0x81e5('0x84')){_0x22a19c['where']('i.'+_0x4809cb+_0x81e5('0x85'));}else{_0x22a19c[_0x81e5('0x4e')]('i.'+_0x4809cb+_0x81e5('0x86'),_0x1c356f['query'][_0x4809cb]);}}});}if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x87')]){if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x87')]==0x1){_0x22a19c['having'](_0x81e5('0x88'));}else{_0x22a19c['having'](_0x81e5('0x89'));}}if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x8a')]){_0x131727=_[_0x81e5('0x8b')](_0x1c356f[_0x81e5('0x46')][_0x81e5('0x8a')])?_0x1c356f[_0x81e5('0x46')]['tag']:new Array(_0x1c356f['query']['tag']);_0x131727[_0x81e5('0x38')](function(_0x5127d2){_0x1f7ed1['or'](_0x81e5('0x78'),'%,'+_0x5127d2+',%');});}if(_0x1c356f['query'][_0x81e5('0x8c')]){var _0x59168c=_0x1c356f[_0x81e5('0x46')][_0x81e5('0x8c')][_0x81e5('0x8d')]('\x5c','\x5c\x5c')[_0x81e5('0x8d')](/'/g,'\x27\x27');if(qs[_0x81e5('0x8e')](_0x59168c)){_0x165ea2['or']('i.id\x20LIKE\x20?',_0x59168c+'%')['or'](_0x81e5('0x8f'),_0x59168c+'%');}_0x165ea2['or'](_0x81e5('0x90'),_0x59168c+'%');}}_0x22a19c['where'](_0x165ea2);_0x22a19c[_0x81e5('0x91')](_0x81e5('0x92'));var _0x45c68e={'type':db[_0x81e5('0x93')][_0x81e5('0x94')][_0x81e5('0x95')],'raw':!![]};var _0x49244f=_0x22a19c['clone']();_0x49244f[_0x81e5('0x51')](_0x81e5('0x92'));_0x49244f[_0x81e5('0x51')](_0x81e5('0x96'),_0x81e5('0x6a'));if(_0x53289e[_0x81e5('0x4c')]){_0x53289e['order'][_0x81e5('0x38')](function(_0x2fe242){var _0x235118=_0x2fe242[0x0]==='contactName'?_0x2fe242[0x0]:'i.'+_0x2fe242[0x0];_0x22a19c['order'](_0x235118,_0x2fe242[0x1]==='DESC'?![]:!![]);});}if(!_[_0x81e5('0x97')](_0x131727)){_0x22a19c[_0x81e5('0x6b')](_0x1f7ed1);_0x49244f[_0x81e5('0x4e')](_0x81e5('0x98'),_0x131727);}BPromise[_0x81e5('0x99')]()[_0x81e5('0x2e')](function(){if(!_0x5b1254){if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x9a')])return;_0x49244f[_0x81e5('0x4e')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x22a19c['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1c356f[_0x81e5('0x9b')][_0x81e5('0x9c')]!=='agent')return;return _0x1c356f[_0x81e5('0x9b')][_0x81e5('0x9d')]({'attributes':['id'],'raw':!![]})[_0x81e5('0x2e')](function(_0x1dc997){if(_[_0x81e5('0x97')](_0x1dc997)){_0x49244f['where'](_0x81e5('0x9e'));_0x22a19c['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x49244f[_0x81e5('0x4e')]('i.FaxAccountId\x20IN\x20?',_[_0x81e5('0x34')](_0x1dc997,'id'));_0x22a19c[_0x81e5('0x4e')](_0x81e5('0x7e'),_[_0x81e5('0x34')](_0x1dc997,'id'));}});})['then'](function(){if(_0x1c356f[_0x81e5('0x9b')]['role']==='agent'&&!_0x5b1254&&!_0x1c356f[_0x81e5('0x46')][_0x81e5('0x9a')])return[];return db[_0x81e5('0x9f')][_0x81e5('0x46')](_0x49244f['toString'](),_0x45c68e);})[_0x81e5('0x2e')](function(_0x2447f9){_0x60bf3[_0x81e5('0x28')]=_0x2447f9[_0x81e5('0x4a')];if(_0x60bf3[_0x81e5('0x28')]===0x0)return[];return db[_0x81e5('0x9f')][_0x81e5('0x46')](_0x2ce783['toString'](),_0x45c68e)[_0x81e5('0x2e')](function(_0x39c5b9){_0x58ebba=_[_0x81e5('0xa0')](_0x39c5b9,'id');_0x45c68e=_['merge'](_0x45c68e,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x49')]){_0x53289e['attributes']['forEach'](function(_0x984f17){_0x22a19c['field']('i.'+_0x984f17);});}else{_0x22a19c['field'](_0x81e5('0x96'),_0x81e5('0x6a'));_0x22a19c[_0x81e5('0x51')]('a.key',_0x81e5('0xa1'));_0x22a19c[_0x81e5('0x51')](_0x81e5('0xa2'),_0x81e5('0xa3'));_0x22a19c[_0x81e5('0x51')](_0x81e5('0xa4'),_0x81e5('0xa5'));_0x22a19c['field']('i.*');_0x22a19c['field'](_0x81e5('0xa6'),'Contact.firstName');_0x22a19c[_0x81e5('0x51')](_0x81e5('0xa7'),'Contact.lastName');_0x22a19c[_0x81e5('0x51')](_0x81e5('0xa8'),_0x81e5('0xa9'));_0x22a19c[_0x81e5('0x51')](_0x81e5('0xaa'),_0x81e5('0xab'));_0x22a19c[_0x81e5('0x51')](_0x81e5('0xac'),'Contact.mobile');_0x22a19c[_0x81e5('0x51')]('c.fax',_0x81e5('0xad'));_0x22a19c[_0x81e5('0x51')](_0x81e5('0xae'),_0x81e5('0xaf'));_0x22a19c['field'](_0x81e5('0xb0'),_0x81e5('0xb1'));_0x22a19c['field'](_0x81e5('0xb2'),_0x81e5('0x35'));}if(_0x53289e[_0x81e5('0x27')])_0x22a19c[_0x81e5('0x27')](_0x53289e['limit']);if(_0x53289e[_0x81e5('0x25')])_0x22a19c[_0x81e5('0x25')](_0x53289e['offset']);return db['sequelize'][_0x81e5('0x46')](_0x22a19c[_0x81e5('0xb3')](),_0x45c68e);})[_0x81e5('0x2e')](function(_0x2e941f){if(_0x2e941f[_0x81e5('0x4a')]>0x0)_0x5d4115[_0x81e5('0x4e')](_0x81e5('0xb4'),_[_0x81e5('0x34')](_0x2e941f,'id'));return db[_0x81e5('0x9f')][_0x81e5('0x46')](_0x5d4115[_0x81e5('0xb3')](),_0x45c68e)['then'](function(_0x3075cf){var _0x1d01b9=_[_0x81e5('0xb5')](_0x3075cf,_0x81e5('0xb6'));var _0x5a3aa0=[];_0x2e941f[_0x81e5('0x38')](function(_0x4aac46){_0x5a3aa0['push'](updateFaxInteraction(_0x4aac46,_0x58ebba,_0x1d01b9));});return BPromise['all'](_0x5a3aa0);});});})['then'](function(_0x36c7fa){_0x60bf3[_0x81e5('0xb7')]=_0x36c7fa;return _0x60bf3;})[_0x81e5('0x2e')](respondWithFilteredResult(_0x5c34e5,_0x53289e))[_0x81e5('0x3a')](handleError(_0x5c34e5,null));};exports[_0x81e5('0xb8')]=function(_0x533ce7,_0x59d248){var _0x179850={'raw':![],'where':{'id':_0x533ce7[_0x81e5('0xb9')]['id']}},_0x49c807={};_0x49c807[_0x81e5('0x45')]=_[_0x81e5('0x7b')](db[_0x81e5('0xba')][_0x81e5('0x42')]);_0x49c807[_0x81e5('0x46')]=_[_0x81e5('0x7b')](_0x533ce7[_0x81e5('0x46')]);_0x49c807['filters']=_['intersection'](_0x49c807[_0x81e5('0x45')],_0x49c807[_0x81e5('0x46')]);_0x179850['attributes']=_['intersection'](_0x49c807[_0x81e5('0x45')],qs[_0x81e5('0x49')](_0x533ce7[_0x81e5('0x46')][_0x81e5('0x49')]));_0x179850[_0x81e5('0x48')]=_0x179850[_0x81e5('0x48')][_0x81e5('0x4a')]?_0x179850[_0x81e5('0x48')]:_0x49c807[_0x81e5('0x45')];if(_0x533ce7[_0x81e5('0x46')]['includeAll']){_0x179850[_0x81e5('0xbb')]=[{'all':!![]}];}_0x179850=_[_0x81e5('0xbc')]({},_0x179850,_0x533ce7['options']);return db['FaxInteraction'][_0x81e5('0x69')](_0x179850)[_0x81e5('0x2e')](handleEntityNotFound(_0x59d248,null))['then'](respondWithResult(_0x59d248,null))[_0x81e5('0x3a')](handleError(_0x59d248,null));};exports['create']=function(_0x4c8018,_0x5b2d8c){return db[_0x81e5('0xba')][_0x81e5('0xbd')](_0x4c8018[_0x81e5('0xbe')],{})[_0x81e5('0x2e')](respondWithResult(_0x5b2d8c,0xc9))[_0x81e5('0x3a')](handleError(_0x5b2d8c,null));};exports[_0x81e5('0x2d')]=function(_0x4a61cd,_0x3bff5e){if(_0x4a61cd[_0x81e5('0xbe')]['id']){delete _0x4a61cd[_0x81e5('0xbe')]['id'];}return db[_0x81e5('0xba')][_0x81e5('0x69')]({'where':{'id':_0x4a61cd['params']['id']}})['then'](handleEntityNotFound(_0x3bff5e,null))['then'](saveUpdates(_0x4a61cd[_0x81e5('0xbe')],null))['then'](respondWithResult(_0x3bff5e,null))[_0x81e5('0x3a')](handleError(_0x3bff5e,null));};exports[_0x81e5('0x2f')]=function(_0x4c4e5f,_0x3c03b2){return db[_0x81e5('0xba')][_0x81e5('0x69')]({'where':{'id':_0x4c4e5f[_0x81e5('0xb9')]['id']}})['then'](handleEntityNotFound(_0x3c03b2,null))['then'](removeEntity(_0x3c03b2,null))[_0x81e5('0x3a')](handleError(_0x3c03b2,null));};exports[_0x81e5('0xbf')]=function(_0x3964ed,_0x335dc6){return db[_0x81e5('0xba')][_0x81e5('0xbf')]()['then'](respondWithResult(_0x335dc6,null))['catch'](handleError(_0x335dc6,null));};exports[_0x81e5('0xc0')]=function(_0x2bf8fa,_0x6da40d,_0x48abac){return db['FaxMessage'][_0x81e5('0x69')]({'where':{'id':_0x2bf8fa['params']['id']}})[_0x81e5('0x2e')](handleEntityNotFound(_0x6da40d,null))[_0x81e5('0x2e')](function(_0x281059){if(_0x281059){return _0x281059[_0x81e5('0xc0')](_0x2bf8fa[_0x81e5('0xbe')]['ids'],_[_0x81e5('0xc1')](_0x2bf8fa['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x6da40d,null))[_0x81e5('0x3a')](handleError(_0x6da40d,null));};exports[_0x81e5('0xc2')]=function(_0x5b8e39,_0x5292df,_0x56cc21){var _0x22a66a={'raw':![],'where':{}};var _0x343710={};var _0x12a4f7={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x5b8e39[_0x81e5('0xb9')]['id']}})[_0x81e5('0x2e')](handleEntityNotFound(_0x5292df,null))[_0x81e5('0x2e')](function(_0x50fad5){if(_0x50fad5){_0x343710[_0x81e5('0x45')]=_['keys'](db[_0x81e5('0xc3')][_0x81e5('0x42')]);_0x343710[_0x81e5('0x46')]=_[_0x81e5('0x7b')](_0x5b8e39[_0x81e5('0x46')]);_0x343710[_0x81e5('0x4f')]=_[_0x81e5('0x47')](_0x343710[_0x81e5('0x45')],_0x343710['query']);_0x22a66a[_0x81e5('0x48')]=_[_0x81e5('0x47')](_0x343710['model'],qs[_0x81e5('0x49')](_0x5b8e39[_0x81e5('0x46')][_0x81e5('0x49')]));_0x22a66a[_0x81e5('0x48')]=_0x22a66a[_0x81e5('0x48')]['length']?_0x22a66a[_0x81e5('0x48')]:_0x343710[_0x81e5('0x45')];if(!_0x5b8e39[_0x81e5('0x46')]['hasOwnProperty']('nolimit')){_0x22a66a[_0x81e5('0x27')]=qs[_0x81e5('0x27')](_0x5b8e39[_0x81e5('0x46')][_0x81e5('0x27')]);_0x22a66a[_0x81e5('0x25')]=qs[_0x81e5('0x25')](_0x5b8e39[_0x81e5('0x46')]['offset']);}_0x22a66a[_0x81e5('0x4c')]=qs[_0x81e5('0x4d')](_0x5b8e39[_0x81e5('0x46')][_0x81e5('0x4d')]);_0x22a66a[_0x81e5('0x4e')]=qs[_0x81e5('0x4f')](_[_0x81e5('0xc4')](_0x5b8e39[_0x81e5('0x46')],_0x343710[_0x81e5('0x4f')]));_0x22a66a[_0x81e5('0x4e')][_0x81e5('0xb6')]=_0x50fad5['id'];if(_0x5b8e39[_0x81e5('0x46')]['filter']){_0x22a66a[_0x81e5('0x4e')]=_['merge'](_0x22a66a[_0x81e5('0x4e')],{'$or':_[_0x81e5('0x34')](_0x22a66a['attributes'],function(_0x557fd0){var _0x2674bc={};_0x2674bc[_0x557fd0]={'$like':'%'+_0x5b8e39[_0x81e5('0x46')]['filter']+'%'};return _0x2674bc;})});}if(_0x5b8e39[_0x81e5('0x46')][_0x81e5('0x82')]){var _0x28543f=_0x5b8e39[_0x81e5('0x46')][_0x81e5('0x82')][_0x81e5('0x37')](',');var _0x3fce3d={};_0x3fce3d[_0x28543f[0x0]]={'$gte':moment(_0x28543f[0x1])[_0x81e5('0xc5')](_0x81e5('0xc6'))};_0x22a66a[_0x81e5('0x4e')]=_[_0x81e5('0xbc')](_0x22a66a[_0x81e5('0x4e')],_0x3fce3d);}_0x22a66a=_['merge']({},_0x22a66a,_0x5b8e39[_0x81e5('0xc7')]);return db[_0x81e5('0xc3')]['count']({'where':_0x22a66a['where']})[_0x81e5('0x2e')](function(_0x4b911a){_0x12a4f7['count']=_0x4b911a;if(_0x5b8e39[_0x81e5('0x46')][_0x81e5('0xc8')]){_0x22a66a[_0x81e5('0xbb')]=[{'all':!![]}];}return db[_0x81e5('0xc3')][_0x81e5('0xc9')](_0x22a66a);})['then'](function(_0xb0db3b){_0x12a4f7['rows']=_0xb0db3b;return _0x12a4f7;});}})[_0x81e5('0x2e')](respondWithFilteredResult(_0x5292df,_0x22a66a))[_0x81e5('0x3a')](handleError(_0x5292df,null));};exports[_0x81e5('0xca')]=function(_0x215016,_0x1e9113,_0xa21d0a){return db[_0x81e5('0xba')][_0x81e5('0x69')]({'where':{'id':_0x215016[_0x81e5('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1e9113,null))['then'](function(_0x4367f3){if(_0x4367f3){return _0x4367f3[_0x81e5('0xcb')](_0x215016[_0x81e5('0xbe')]['ids'],_[_0x81e5('0xc1')](_0x215016['body'],[_0x81e5('0xcc'),'id'])||{})[_0x81e5('0xcd')](function(){return db['Tag'][_0x81e5('0xc9')]({'attributes':['id',_0x81e5('0x31'),_0x81e5('0x52')],'where':{'id':_0x215016['body'][_0x81e5('0xcc')]}});})[_0x81e5('0x2e')](function(_0xb38928){socket['emit'](_0x81e5('0xce'),{'id':Number(_0x215016[_0x81e5('0xb9')]['id']),'tags':_0xb38928||[]});return{'id':Number(_0x215016[_0x81e5('0xb9')]['id']),'tags':_0xb38928||[]};});}})[_0x81e5('0x2e')](respondWithResult(_0x1e9113,null))['catch'](handleError(_0x1e9113,null));};exports[_0x81e5('0xcf')]=function(_0x5377dc,_0x10e6b1,_0x18e2cd){return db[_0x81e5('0xba')][_0x81e5('0x69')]({'where':{'id':_0x5377dc[_0x81e5('0xb9')]['id']}})[_0x81e5('0x2e')](handleEntityNotFound(_0x10e6b1,null))['then'](function(_0x1eda1c){if(_0x1eda1c){return _0x1eda1c[_0x81e5('0xcf')](_0x5377dc[_0x81e5('0x46')]['ids']);}})[_0x81e5('0x2e')](respondWithStatusCode(_0x10e6b1,null))[_0x81e5('0x3a')](handleError(_0x10e6b1,null));};exports[_0x81e5('0xd0')]=function(_0x49157e,_0x5e9079){var _0x5f1535=moment()[_0x81e5('0xd1')]()[_0x81e5('0xb3')]();var _0x3dd128=path['join'](config[_0x81e5('0xd2')],_0x81e5('0xd3'),_0x81e5('0xd4'),_0x81e5('0xd5'));var _0x118a28=path[_0x81e5('0xd6')](config['root'],_0x81e5('0xd3'),_0x81e5('0xd4'),'attachments');var _0x1c078a=path[_0x81e5('0xd6')](_0x3dd128,_0x5f1535);var _0x4f3105=util[_0x81e5('0xc5')](_0x81e5('0xd7'),_0x49157e[_0x81e5('0xb9')]['id'],_0x5f1535);var _0x35809f=path[_0x81e5('0xd6')](_0x3dd128,_0x4f3105);var _0x2692fa=[];_0x2692fa[_0x81e5('0x39')]({'model':db[_0x81e5('0xd8')],'as':_0x81e5('0xd8'),'raw':!![]});var _0x2ea08b=[{'model':db['FaxMessage'],'as':_0x81e5('0xd9'),'attributes':['id',_0x81e5('0xbe'),_0x81e5('0x80')],'include':_0x2692fa}];return db[_0x81e5('0xba')][_0x81e5('0x69')]({'where':{'id':_0x49157e[_0x81e5('0xb9')]['id']},'include':_0x2ea08b})[_0x81e5('0x2e')](handleEntityNotFound(_0x5e9079,null))['then'](function(_0x2ac817){if(_0x2ac817&&_0x2ac817[_0x81e5('0xd9')]){var _0x1bd54a=_0x2ac817[_0x81e5('0xda')]({'plain':!![]});fs[_0x81e5('0xdb')](_0x1c078a);for(var _0x59fa76=0x0;_0x59fa76<_0x1bd54a[_0x81e5('0xd9')][_0x81e5('0x4a')];_0x59fa76++){var _0x3ba966=_0x1bd54a[_0x81e5('0xd9')][_0x59fa76][_0x81e5('0xd8')];if(_0x3ba966){var _0x350a5d=path[_0x81e5('0xd6')](_0x118a28,_0x3ba966[_0x81e5('0xdc')]);if(fs['existsSync'](_0x350a5d)){fs['createReadStream'](_0x350a5d)[_0x81e5('0xdd')](fs[_0x81e5('0xde')](path['join'](_0x1c078a,_0x3ba966['basename'])));}}}return BPromise[_0x81e5('0x99')]()[_0x81e5('0x2e')](function(){return new BPromise(function(_0x4128e1,_0x49dfbb){zipdir(_0x1c078a,{'saveTo':_0x35809f},function(_0x4433e9,_0x38d455){if(_0x4433e9)return _0x49dfbb(_0x4433e9);return _0x4128e1(_0x38d455);});})[_0x81e5('0x2e')](function(){return new BPromise(function(_0x4aacf6,_0x5761b2){rimraf(_0x1c078a,function(_0x1fe669){if(_0x1fe669)_0x5761b2(_0x1fe669);return _0x4aacf6();});});})[_0x81e5('0x2e')](function(){return _0x5e9079[_0x81e5('0xd0')](_0x35809f,_0x4f3105,function(_0x49c988){if(_0x49c988){console[_0x81e5('0xdf')](_0x81e5('0xe0'),_0x49c988);}else{fs[_0x81e5('0xe1')](_0x35809f);}});});});}else{return _0x5e9079[_0x81e5('0x21')](0xc8);}})[_0x81e5('0x3a')](handleError(_0x5e9079,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a4b2eef..1dd1ad4 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8031=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage'];(function(_0x1d7d13,_0x2468e6){var _0x1359dc=function(_0x17359a){while(--_0x17359a){_0x1d7d13['push'](_0x1d7d13['shift']());}};_0x1359dc(++_0x2468e6);}(_0x8031,0x13f));var _0x1803=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x8031[_0x45b034];return _0x509cb0;};'use strict';var EventEmitter=require(_0x1803('0x0'));var FaxInteraction=require(_0x1803('0x1'))['db'][_0x1803('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x1803('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1803('0x4')](0x0);var events={'afterCreate':_0x1803('0x5'),'afterUpdate':_0x1803('0x6'),'afterDestroy':_0x1803('0x7')};function emitEvent(_0x4ed4a7){return function(_0x44f8ed,_0x3b9ddb,_0x370dda){_0x44f8ed[_0x1803('0x8')]({'attributes':['id'],'raw':!![]})[_0x1803('0x9')](function(_0x1ef403){_0x44f8ed[_0x1803('0xa')](_0x1803('0xb'),_0x1ef403[_0x1803('0xc')](function(_0x283880){return{'id':_0x283880['id']};}));return FaxMessage[_0x1803('0xd')]({'where':{'FaxInteractionId':_0x44f8ed['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1803('0x9')](function(_0x5c60d4){_0x44f8ed[_0x1803('0xa')](_0x1803('0xe'),_0x5c60d4[_0x1803('0xf')]);FaxInteractionEvents['emit'](_0x4ed4a7+':'+_0x44f8ed['id'],_0x44f8ed);FaxInteractionEvents[_0x1803('0x10')](_0x4ed4a7,_0x44f8ed);_0x370dda(null);})['catch'](_0x370dda(null));};}for(var e in events){if(events[_0x1803('0x11')](e)){var event=events[e];FaxInteraction[_0x1803('0x12')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x03d9=['update','remove','getUsers','setDataValue','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','FaxInteraction','setMaxListeners','save'];(function(_0x5c3e6f,_0x5d8cb3){var _0x20a332=function(_0x5cc855){while(--_0x5cc855){_0x5c3e6f['push'](_0x5c3e6f['shift']());}};_0x20a332(++_0x5d8cb3);}(_0x03d9,0x1db));var _0x903d=function(_0x137bbb,_0x1867cc){_0x137bbb=_0x137bbb-0x0;var _0x464359=_0x03d9[_0x137bbb];return _0x464359;};'use strict';var EventEmitter=require(_0x903d('0x0'));var FaxInteraction=require(_0x903d('0x1'))['db'][_0x903d('0x2')];var FaxMessage=require(_0x903d('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x903d('0x3')](0x0);var events={'afterCreate':_0x903d('0x4'),'afterUpdate':_0x903d('0x5'),'afterDestroy':_0x903d('0x6')};function emitEvent(_0x222024){return function(_0x34e359,_0xd350a0,_0x1a1573){_0x34e359[_0x903d('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x56b563){_0x34e359[_0x903d('0x8')]('Users',_0x56b563['map'](function(_0x16291b){return{'id':_0x16291b['id']};}));return FaxMessage[_0x903d('0x9')]({'where':{'FaxInteractionId':_0x34e359['id'],'direction':'in','read':![]},'raw':!![]});})[_0x903d('0xa')](function(_0x5e4d66){_0x34e359[_0x903d('0x8')](_0x903d('0xb'),_0x5e4d66[_0x903d('0xc')]);FaxInteractionEvents[_0x903d('0xd')](_0x222024+':'+_0x34e359['id'],_0x34e359);FaxInteractionEvents[_0x903d('0xd')](_0x222024,_0x34e359);_0x1a1573(null);})[_0x903d('0xe')](_0x1a1573(null));};}for(var e in events){if(events[_0x903d('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 0f9534e..e97e5e2 100644 --- a/server/api/faxInteraction/faxInteraction.model.js +++ b/server/api/faxInteraction/faxInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f63=['exports','fax_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','api','bluebird','request-promise','path','rimraf'];(function(_0x6dbd60,_0x6f51d9){var _0x4f7d0b=function(_0x62bd59){while(--_0x62bd59){_0x6dbd60['push'](_0x6dbd60['shift']());}};_0x4f7d0b(++_0x6f51d9);}(_0x2f63,0xf5));var _0x32f6=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0x2f63[_0x5e6bec];return _0x5dc5cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x32f6('0x0'));var moment=require('moment');var BPromise=require(_0x32f6('0x1'));var rp=require(_0x32f6('0x2'));var fs=require('fs');var path=require(_0x32f6('0x3'));var rimraf=require(_0x32f6('0x4'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x32f6('0x5')]=function(_0x525c4e,_0x1c9389){return _0x525c4e['define']('FaxInteraction',attributes,{'tableName':_0x32f6('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c9ab7,_0x1f4960,_0x3896e4){if(_0x4c9ab7['changed']('closed')){_0x4c9ab7[_0x32f6('0x7')]=moment()[_0x32f6('0x8')](_0x32f6('0x9'));}_0x3896e4(null,_0x4c9ab7);}}});}; \ No newline at end of file +var _0x68fc=['./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x68fc,0x13b));var _0xc68f=function(_0x36e292,_0x1ceee2){_0x36e292=_0x36e292-0x0;var _0x1ffb5a=_0x68fc[_0x36e292];return _0x1ffb5a;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))(_0xc68f('0x3'));var moment=require(_0xc68f('0x4'));var BPromise=require(_0xc68f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc68f('0x6'));var config=require('../../config/environment');var attributes=require(_0xc68f('0x7'));module[_0xc68f('0x8')]=function(_0x336546,_0x17691e){return _0x336546['define'](_0xc68f('0x9'),attributes,{'tableName':_0xc68f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b38b7,_0x741460,_0xc43b70){if(_0x4b38b7[_0xc68f('0xb')](_0xc68f('0xc'))){_0x4b38b7[_0xc68f('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xc43b70(null,_0x4b38b7);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e2ab3b6..c12de2b 100644 --- a/server/api/faxInteraction/faxInteraction.rpc.js +++ b/server/api/faxInteraction/faxInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97c0=['code','message','info','result','catch','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','stringify','find','omit','ids','spread','AddTags','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x16b531,_0x41964c){var _0x47d42b=function(_0x4dca07){while(--_0x4dca07){_0x16b531['push'](_0x16b531['shift']());}};_0x47d42b(++_0x41964c);}(_0x97c0,0x1aa));var _0x097c=function(_0x3bc10a,_0xab424e){_0x3bc10a=_0x3bc10a-0x0;var _0x44cee0=_0x97c0[_0x3bc10a];return _0x44cee0;};'use strict';var _=require('lodash');var util=require(_0x097c('0x0'));var moment=require(_0x097c('0x1'));var BPromise=require(_0x097c('0x2'));var rs=require(_0x097c('0x3'));var fs=require('fs');var Redis=require(_0x097c('0x4'));var db=require(_0x097c('0x5'))['db'];var utils=require(_0x097c('0x6'));var logger=require(_0x097c('0x7'))(_0x097c('0x8'));var config=require(_0x097c('0x9'));var jayson=require(_0x097c('0xa'));var client=jayson[_0x097c('0xb')][_0x097c('0xc')]({'port':0x232a});config['redis']=_[_0x097c('0xd')](config['redis'],{'host':_0x097c('0xe'),'port':0x18eb});var socket=require(_0x097c('0xf'))(new Redis(config[_0x097c('0x10')]));require(_0x097c('0x11'))['register'](socket);function respondWithRpcPromise(_0x5a2afb,_0x1ef872,_0x3420e2){return new BPromise(function(_0x485274,_0x3fde76){return client[_0x097c('0x12')](_0x5a2afb,_0x3420e2)[_0x097c('0x13')](function(_0x4be040){logger['info'](_0x097c('0x14'),_0x1ef872,_0x097c('0x15'));logger['debug'](_0x097c('0x16'),_0x1ef872,_0x097c('0x15'),JSON['stringify'](_0x4be040));if(_0x4be040[_0x097c('0x17')]){if(_0x4be040[_0x097c('0x17')][_0x097c('0x18')]===0x1f4){logger['error'](_0x097c('0x14'),_0x1ef872,_0x4be040['error'][_0x097c('0x19')]);return _0x3fde76(_0x4be040['error']['message']);}logger[_0x097c('0x17')](_0x097c('0x14'),_0x1ef872,_0x4be040[_0x097c('0x17')][_0x097c('0x19')]);return _0x485274(_0x4be040[_0x097c('0x17')]['message']);}else{logger[_0x097c('0x1a')]('FaxInteraction,\x20%s,\x20%s',_0x1ef872,'request\x20sent');_0x485274(_0x4be040[_0x097c('0x1b')][_0x097c('0x19')]);}})[_0x097c('0x1c')](function(_0x48a1c0){logger[_0x097c('0x17')](_0x097c('0x14'),_0x1ef872,_0x48a1c0);_0x3fde76(_0x48a1c0);});});}exports['UpdateFaxInteraction']=function(_0x460f85){var _0x10098b=this;return new Promise(function(_0x51646f,_0x5f0bcf){return db[_0x097c('0x1d')][_0x097c('0x1e')](_0x460f85[_0x097c('0x1f')],{'raw':_0x460f85[_0x097c('0x20')]?_0x460f85['options'][_0x097c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x460f85[_0x097c('0x20')]?_0x460f85[_0x097c('0x20')][_0x097c('0x22')]||null:null,'attributes':_0x460f85['options']?_0x460f85['options'][_0x097c('0x23')]||null:null,'limit':_0x460f85['options']?_0x460f85[_0x097c('0x20')][_0x097c('0x24')]||null:null})[_0x097c('0x13')](function(_0x529ed5){logger[_0x097c('0x1a')]('UpdateFaxInteraction',_0x460f85);logger['debug'](_0x097c('0x25'),_0x460f85,JSON[_0x097c('0x26')](_0x529ed5));_0x51646f(_0x529ed5);})['catch'](function(_0x544cd6){logger[_0x097c('0x17')](_0x097c('0x25'),_0x544cd6['message'],_0x460f85);_0x5f0bcf(_0x10098b[_0x097c('0x17')](0x1f4,_0x544cd6[_0x097c('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x584d19){return new Promise(function(_0x11afff,_0x444959){return db[_0x097c('0x1d')][_0x097c('0x27')]({'where':_0x584d19[_0x097c('0x20')]?_0x584d19['options'][_0x097c('0x22')]||null:null})[_0x097c('0x13')](function(_0x1cb06a){if(_0x1cb06a){return _0x1cb06a['addTags'](_0x584d19[_0x097c('0x1f')]['ids'],_[_0x097c('0x28')](_0x584d19[_0x097c('0x1f')],[_0x097c('0x29'),'id'])||{});}})[_0x097c('0x2a')](function(_0x22366a){logger['info'](_0x097c('0x2b'),_0x584d19);logger[_0x097c('0x2c')](_0x097c('0x2b'),_0x584d19,JSON['stringify'](_0x22366a));_0x11afff(_0x22366a);})['catch'](function(_0x12d905){logger[_0x097c('0x17')](_0x097c('0x2b'),_0x12d905[_0x097c('0x19')],_0x584d19);_0x444959(_this[_0x097c('0x17')](0x1f4,_0x12d905[_0x097c('0x19')]));});});}; \ No newline at end of file +var _0xe11a=['options','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','update'];(function(_0x279522,_0x497270){var _0xc6071d=function(_0x505793){while(--_0x505793){_0x279522['push'](_0x279522['shift']());}};_0xc6071d(++_0x497270);}(_0xe11a,0x86));var _0xae11=function(_0xfda808,_0x369464){_0xfda808=_0xfda808-0x0;var _0x3b95ce=_0xe11a[_0xfda808];return _0x3b95ce;};'use strict';var _=require(_0xae11('0x0'));var util=require(_0xae11('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xae11('0x2'));var fs=require('fs');var Redis=require(_0xae11('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xae11('0x4'));var logger=require(_0xae11('0x5'))(_0xae11('0x6'));var config=require(_0xae11('0x7'));var jayson=require(_0xae11('0x8'));var client=jayson[_0xae11('0x9')]['http']({'port':0x232a});config[_0xae11('0xa')]=_[_0xae11('0xb')](config[_0xae11('0xa')],{'host':_0xae11('0xc'),'port':0x18eb});var socket=require(_0xae11('0xd'))(new Redis(config[_0xae11('0xa')]));require('./faxInteraction.socket')[_0xae11('0xe')](socket);function respondWithRpcPromise(_0x2ef886,_0x18320a,_0x6a00d9){return new BPromise(function(_0x578656,_0x39e8e7){return client[_0xae11('0xf')](_0x2ef886,_0x6a00d9)[_0xae11('0x10')](function(_0x32fcea){logger[_0xae11('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x18320a,_0xae11('0x12'));logger[_0xae11('0x13')](_0xae11('0x14'),_0x18320a,'request\x20sent',JSON[_0xae11('0x15')](_0x32fcea));if(_0x32fcea[_0xae11('0x16')]){if(_0x32fcea['error'][_0xae11('0x17')]===0x1f4){logger[_0xae11('0x16')](_0xae11('0x18'),_0x18320a,_0x32fcea[_0xae11('0x16')]['message']);return _0x39e8e7(_0x32fcea[_0xae11('0x16')][_0xae11('0x19')]);}logger[_0xae11('0x16')](_0xae11('0x18'),_0x18320a,_0x32fcea[_0xae11('0x16')][_0xae11('0x19')]);return _0x578656(_0x32fcea['error'][_0xae11('0x19')]);}else{logger[_0xae11('0x11')](_0xae11('0x18'),_0x18320a,_0xae11('0x12'));_0x578656(_0x32fcea[_0xae11('0x1a')][_0xae11('0x19')]);}})[_0xae11('0x1b')](function(_0x3f180d){logger['error'](_0xae11('0x18'),_0x18320a,_0x3f180d);_0x39e8e7(_0x3f180d);});});}exports[_0xae11('0x1c')]=function(_0x2457c6){var _0xdc38b9=this;return new Promise(function(_0x22755f,_0xb74de4){return db['FaxInteraction'][_0xae11('0x1d')](_0x2457c6['body'],{'raw':_0x2457c6[_0xae11('0x1e')]?_0x2457c6[_0xae11('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2457c6[_0xae11('0x1e')]?_0x2457c6[_0xae11('0x1e')][_0xae11('0x1f')]||null:null,'attributes':_0x2457c6[_0xae11('0x1e')]?_0x2457c6[_0xae11('0x1e')][_0xae11('0x20')]||null:null,'limit':_0x2457c6[_0xae11('0x1e')]?_0x2457c6[_0xae11('0x1e')][_0xae11('0x21')]||null:null})[_0xae11('0x10')](function(_0x31418a){logger[_0xae11('0x11')](_0xae11('0x1c'),_0x2457c6);logger['debug'](_0xae11('0x1c'),_0x2457c6,JSON['stringify'](_0x31418a));_0x22755f(_0x31418a);})['catch'](function(_0x5b98ea){logger[_0xae11('0x16')](_0xae11('0x1c'),_0x5b98ea[_0xae11('0x19')],_0x2457c6);_0xb74de4(_0xdc38b9[_0xae11('0x16')](0x1f4,_0x5b98ea['message']));});});};exports[_0xae11('0x22')]=function(_0x27c1e2){return new Promise(function(_0x2cadc6,_0x129c4a){return db[_0xae11('0x23')]['find']({'where':_0x27c1e2[_0xae11('0x1e')]?_0x27c1e2[_0xae11('0x1e')][_0xae11('0x1f')]||null:null})[_0xae11('0x10')](function(_0x441d9b){if(_0x441d9b){return _0x441d9b[_0xae11('0x24')](_0x27c1e2['body'][_0xae11('0x25')],_[_0xae11('0x26')](_0x27c1e2['body'],[_0xae11('0x25'),'id'])||{});}})[_0xae11('0x27')](function(_0x1f2d72){logger[_0xae11('0x11')]('AddTags',_0x27c1e2);logger[_0xae11('0x13')](_0xae11('0x28'),_0x27c1e2,JSON['stringify'](_0x1f2d72));_0x2cadc6(_0x1f2d72);})['catch'](function(_0x3cff1d){logger[_0xae11('0x16')](_0xae11('0x28'),_0x3cff1d['message'],_0x27c1e2);_0x129c4a(_this[_0xae11('0x16')](0x1f4,_0x3cff1d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0344a84..55df2c5 100644 --- a/server/api/faxInteraction/faxInteraction.socket.js +++ b/server/api/faxInteraction/faxInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92a2=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x13be83,_0x592e82){var _0x12a9b8=function(_0x2cad5c){while(--_0x2cad5c){_0x13be83['push'](_0x13be83['shift']());}};_0x12a9b8(++_0x592e82);}(_0x92a2,0x164));var _0x292a=function(_0x141c2e,_0x5ae3bd){_0x141c2e=_0x141c2e-0x0;var _0x813267=_0x92a2[_0x141c2e];return _0x813267;};'use strict';var FaxInteractionEvents=require(_0x292a('0x0'));var events=[_0x292a('0x1'),_0x292a('0x2'),_0x292a('0x3')];function createListener(_0x270ae5,_0x2ab1bf){return function(_0x344bf8){_0x2ab1bf['emit'](_0x270ae5,_0x344bf8);};}function removeListener(_0x385ee1,_0x27927c){return function(){FaxInteractionEvents[_0x292a('0x4')](_0x385ee1,_0x27927c);};}exports[_0x292a('0x5')]=function(_0x4ce91d){for(var _0x99d5f1=0x0,_0x16f141=events[_0x292a('0x6')];_0x99d5f1<_0x16f141;_0x99d5f1++){var _0x1e7a3c=events[_0x99d5f1];var _0x42cf28=createListener(_0x292a('0x7')+_0x1e7a3c,_0x4ce91d);FaxInteractionEvents['on'](_0x1e7a3c,_0x42cf28);}}; \ No newline at end of file +var _0xcbdb=['./faxInteraction.events','save','remove','emit','removeListener','register'];(function(_0x55c2ad,_0x558836){var _0x1daf4c=function(_0x269847){while(--_0x269847){_0x55c2ad['push'](_0x55c2ad['shift']());}};_0x1daf4c(++_0x558836);}(_0xcbdb,0x162));var _0xbcbd=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xcbdb[_0xa8883];return _0x479426;};'use strict';var FaxInteractionEvents=require(_0xbcbd('0x0'));var events=[_0xbcbd('0x1'),_0xbcbd('0x2'),'update'];function createListener(_0x3d28cd,_0x1eb7f2){return function(_0x5e2d5f){_0x1eb7f2[_0xbcbd('0x3')](_0x3d28cd,_0x5e2d5f);};}function removeListener(_0xac7588,_0x3c501f){return function(){FaxInteractionEvents[_0xbcbd('0x4')](_0xac7588,_0x3c501f);};}exports[_0xbcbd('0x5')]=function(_0xb9d7ae){for(var _0x4dee4f=0x0,_0x1887ec=events['length'];_0x4dee4f<_0x1887ec;_0x4dee4f++){var _0x1e13c5=events[_0x4dee4f];var _0x483fb2=createListener('faxInteraction:'+_0x1e13c5,_0xb9d7ae);FaxInteractionEvents['on'](_0x1e13c5,_0x483fb2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 48d9370..2c3f38d 100644 --- a/server/api/faxInteraction/index.js +++ b/server/api/faxInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecbc=['../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','fax','put','faxinteraction:update','update','delete','tracked','faxinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xecbc,0xe9));var _0xcecb=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xecbc[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require(_0xcecb('0x0'));var util=require('util');var path=require(_0xcecb('0x1'));var timeout=require(_0xcecb('0x2'));var express=require(_0xcecb('0x3'));var router=express[_0xcecb('0x4')]();var fs_extra=require(_0xcecb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcecb('0x6'));var config=require(_0xcecb('0x7'));var controller=require(_0xcecb('0x8'));router[_0xcecb('0x9')]('/',auth[_0xcecb('0xa')](),controller[_0xcecb('0xb')]);router[_0xcecb('0x9')]('/describe',auth[_0xcecb('0xa')](),controller[_0xcecb('0xc')]);router[_0xcecb('0x9')](_0xcecb('0xd'),auth[_0xcecb('0xa')](),controller['show']);router[_0xcecb('0x9')](_0xcecb('0xe'),auth[_0xcecb('0xa')](),controller[_0xcecb('0xf')]);router[_0xcecb('0x9')]('/:id/download',auth[_0xcecb('0xa')](),controller[_0xcecb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcecb('0x11')]);router[_0xcecb('0x12')](_0xcecb('0xe'),auth[_0xcecb('0xa')](),controller[_0xcecb('0x13')]);router[_0xcecb('0x12')](_0xcecb('0x14'),auth[_0xcecb('0xa')](),interaction['tracked'](_0xcecb('0x15'),'faxinteraction:addtags'),controller['addTags']);router[_0xcecb('0x16')](_0xcecb('0xd'),auth[_0xcecb('0xa')](),interaction['tracked']('fax',_0xcecb('0x17')),controller[_0xcecb('0x18')]);router[_0xcecb('0x19')](_0xcecb('0xd'),auth[_0xcecb('0xa')](),interaction[_0xcecb('0x1a')](_0xcecb('0x15'),_0xcecb('0x1b')),controller[_0xcecb('0x1c')]);router['delete']('/:id/tags',auth[_0xcecb('0xa')](),controller['removeTags']);module[_0xcecb('0x1d')]=router; \ No newline at end of file +var _0x6483=['/:id','/:id/messages','/:id/download','post','create','/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','/describe','isAuthenticated','describe','get'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x6483,0x1e2));var _0x3648=function(_0x2b3812,_0x47ddf3){_0x2b3812=_0x2b3812-0x0;var _0x5e2309=_0x6483[_0x2b3812];return _0x5e2309;};'use strict';var multer=require(_0x3648('0x0'));var util=require(_0x3648('0x1'));var path=require(_0x3648('0x2'));var timeout=require('connect-timeout');var express=require(_0x3648('0x3'));var router=express['Router']();var fs_extra=require(_0x3648('0x4'));var auth=require(_0x3648('0x5'));var interaction=require(_0x3648('0x6'));var config=require(_0x3648('0x7'));var controller=require(_0x3648('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3648('0x9')]);router['get'](_0x3648('0xa'),auth[_0x3648('0xb')](),controller[_0x3648('0xc')]);router[_0x3648('0xd')](_0x3648('0xe'),auth[_0x3648('0xb')](),controller['show']);router['get'](_0x3648('0xf'),auth[_0x3648('0xb')](),controller['getMessages']);router[_0x3648('0xd')](_0x3648('0x10'),auth[_0x3648('0xb')](),controller['download']);router[_0x3648('0x11')]('/',auth[_0x3648('0xb')](),controller[_0x3648('0x12')]);router['post'](_0x3648('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0x3648('0x11')](_0x3648('0x13'),auth['isAuthenticated'](),interaction[_0x3648('0x14')]('fax',_0x3648('0x15')),controller[_0x3648('0x16')]);router[_0x3648('0x17')](_0x3648('0xe'),auth[_0x3648('0xb')](),interaction['tracked'](_0x3648('0x18'),'faxinteraction:update'),controller[_0x3648('0x19')]);router[_0x3648('0x1a')](_0x3648('0xe'),auth[_0x3648('0xb')](),interaction[_0x3648('0x14')](_0x3648('0x18'),_0x3648('0x1b')),controller[_0x3648('0x1c')]);router[_0x3648('0x1a')]('/:id/tags',auth[_0x3648('0xb')](),controller[_0x3648('0x1d')]);module[_0x3648('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 774df9b..aeefae0 100644 --- a/server/api/faxMessage/faxMessage.attributes.js +++ b/server/api/faxMessage/faxMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8eeb=['ENUM','out','DATE','sequelize','TEXT','medium'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x8eeb,0x183));var _0xb8ee=function(_0x28fe2d,_0x3ce8d9){_0x28fe2d=_0x28fe2d-0x0;var _0x26d1e2=_0x8eeb[_0x28fe2d];return _0x26d1e2;};'use strict';var Sequelize=require(_0xb8ee('0x0'));module['exports']={'body':{'type':Sequelize[_0xb8ee('0x1')](_0xb8ee('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb8ee('0x3')]('in',_0xb8ee('0x4')),'defaultValue':_0xb8ee('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xb8ee('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xb8ee('0x5')]}}; \ No newline at end of file +var _0xac31=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5e83c2,_0x48a6ae){var _0x41701f=function(_0x1da963){while(--_0x1da963){_0x5e83c2['push'](_0x5e83c2['shift']());}};_0x41701f(++_0x48a6ae);}(_0xac31,0xca));var _0x1ac3=function(_0x2c8640,_0x4fa2f2){_0x2c8640=_0x2c8640-0x0;var _0x21321b=_0xac31[_0x2c8640];return _0x21321b;};'use strict';var Sequelize=require(_0x1ac3('0x0'));module[_0x1ac3('0x1')]={'body':{'type':Sequelize[_0x1ac3('0x2')](_0x1ac3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1ac3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1ac3('0x5')]('in',_0x1ac3('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x1ac3('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1ac3('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 7d63ce5..50ec8f9 100644 --- a/server/api/faxMessage/faxMessage.controller.js +++ b/server/api/faxMessage/faxMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa28d=['fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','body','find','describe','accept','fax','readAt','format','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','role','RejectMessage','fullname','internal','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','attachments','join','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','catch','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes'];(function(_0x251cde,_0x311cbe){var _0x23c3ef=function(_0x25d91d){while(--_0x25d91d){_0x251cde['push'](_0x251cde['shift']());}};_0x23c3ef(++_0x311cbe);}(_0xa28d,0x16c));var _0xda28=function(_0x25f3ab,_0x5b827f){_0x25f3ab=_0x25f3ab-0x0;var _0x36cb7d=_0xa28d[_0x25f3ab];return _0x36cb7d;};'use strict';var emlformat=require(_0xda28('0x0'));var rimraf=require(_0xda28('0x1'));var zipdir=require(_0xda28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda28('0x3'));var moment=require(_0xda28('0x4'));var BPromise=require(_0xda28('0x5'));var Mustache=require(_0xda28('0x6'));var util=require(_0xda28('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xda28('0x8'));var ejs=require(_0xda28('0x9'));var fs=require('fs');var fs_extra=require(_0xda28('0xa'));var _=require('lodash');var squel=require(_0xda28('0xb'));var crypto=require('crypto');var jsforce=require(_0xda28('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xda28('0x8'));var querystring=require(_0xda28('0xd'));var Papa=require('papaparse');var Redis=require(_0xda28('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xda28('0xf'));var as=require(_0xda28('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda28('0x11'))(_0xda28('0x12'));var utils=require(_0xda28('0x13'));var config=require(_0xda28('0x14'));var licenseUtil=require(_0xda28('0x15'));var db=require('../../mysqldb')['db'];config[_0xda28('0x16')]=_[_0xda28('0x17')](config[_0xda28('0x16')],{'host':_0xda28('0x18'),'port':0x18eb});var socket=require(_0xda28('0x19'))(new Redis(config[_0xda28('0x16')]));require(_0xda28('0x1a'))[_0xda28('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xda28('0x1c')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e7ca5,_0x3d071c,_0x469ac3,_0x70ac53){return new BPromise(function(_0x19188d,_0x390398){var _0x31a22d=_0x70ac53||client;return _0x31a22d[_0xda28('0x1d')](_0x3e7ca5,_0x469ac3)[_0xda28('0x1e')](function(_0x93dd38){logger['info']('FaxMessage,\x20%s,\x20%s',_0x3d071c,_0xda28('0x1f'));logger[_0xda28('0x20')](_0xda28('0x21'),_0x3d071c,_0xda28('0x1f'),JSON[_0xda28('0x22')](_0x93dd38));if(_0x93dd38[_0xda28('0x23')]){if(_0x93dd38[_0xda28('0x23')][_0xda28('0x24')]===0x1f4){logger[_0xda28('0x23')](_0xda28('0x25'),_0x3d071c,_0x93dd38[_0xda28('0x23')][_0xda28('0x26')]);return _0x390398(_0x93dd38[_0xda28('0x23')][_0xda28('0x26')]);}logger['error'](_0xda28('0x25'),_0x3d071c,_0x93dd38[_0xda28('0x23')]['message']);return _0x19188d(_0x93dd38['error'][_0xda28('0x26')]);}else{logger[_0xda28('0x27')](_0xda28('0x25'),_0x3d071c,_0xda28('0x1f'));_0x19188d(_0x93dd38['result'][_0xda28('0x26')]);}})[_0xda28('0x28')](function(_0x7c2432){logger[_0xda28('0x23')]('FaxMessage,\x20%s,\x20%s',_0x3d071c,_0x7c2432);_0x390398(_0x7c2432);});});}function respondWithStatusCode(_0x94cae,_0x54d6e0){_0x54d6e0=_0x54d6e0||0xcc;return function(_0x5e1f85){if(_0x5e1f85){return _0x94cae[_0xda28('0x29')](_0x54d6e0);}return _0x94cae['status'](_0x54d6e0)[_0xda28('0x2a')]();};}function respondWithResult(_0x27cc07,_0x254919){_0x254919=_0x254919||0xc8;return function(_0x5f4cf0){if(_0x5f4cf0){return _0x27cc07['status'](_0x254919)[_0xda28('0x2b')](_0x5f4cf0);}};}function respondWithFilteredResult(_0x2e5c5e,_0x48cd2d){return function(_0x28c219){if(_0x28c219){var _0x5ba628=typeof _0x48cd2d[_0xda28('0x2c')]==='undefined'&&typeof _0x48cd2d[_0xda28('0x2d')]===_0xda28('0x2e');var _0x1d7bdf=_0x28c219[_0xda28('0x2f')];var _0x3ca258=_0x5ba628?0x0:_0x48cd2d['offset'];var _0x2a9e92=_0x5ba628?_0x28c219[_0xda28('0x2f')]:_0x48cd2d['offset']+_0x48cd2d[_0xda28('0x2d')];var _0x23a389;if(_0x2a9e92>=_0x1d7bdf){_0x2a9e92=_0x1d7bdf;_0x23a389=0xc8;}else{_0x23a389=0xce;}_0x2e5c5e[_0xda28('0x30')](_0x23a389);return _0x2e5c5e[_0xda28('0x31')](_0xda28('0x32'),_0x3ca258+'-'+_0x2a9e92+'/'+_0x1d7bdf)[_0xda28('0x2b')](_0x28c219);}return null;};}function patchUpdates(_0x38a7b0){return function(_0x5447fc){try{jsonpatch[_0xda28('0x33')](_0x5447fc,_0x38a7b0,!![]);}catch(_0x37dcba){return BPromise[_0xda28('0x34')](_0x37dcba);}return _0x5447fc['save']();};}function saveUpdates(_0x332713,_0x324a09){return function(_0x5763f0){if(_0x5763f0){return _0x5763f0[_0xda28('0x35')](_0x332713)[_0xda28('0x1e')](function(_0x390b4b){return _0x390b4b;});}return null;};}function removeEntity(_0x100d0b,_0x53fb8b){return function(_0x2160da){if(_0x2160da){return _0x2160da[_0xda28('0x36')]()['then'](function(){_0x100d0b[_0xda28('0x30')](0xcc)[_0xda28('0x2a')]();});}};}function handleEntityNotFound(_0x28551a,_0x3fbf58){return function(_0xaf5cbd){if(!_0xaf5cbd){_0x28551a[_0xda28('0x29')](0x194);}return _0xaf5cbd;};}function handleError(_0x22669b,_0x547769){_0x547769=_0x547769||0x1f4;return function(_0x2f1ef6){logger['error'](_0x2f1ef6[_0xda28('0x37')]);if(_0x2f1ef6[_0xda28('0x38')]){delete _0x2f1ef6[_0xda28('0x38')];}_0x22669b[_0xda28('0x30')](_0x547769)[_0xda28('0x39')](_0x2f1ef6);};}exports[_0xda28('0x3a')]=function(_0xb9ecf4,_0x31290a){var _0x2d19cd={},_0x3dd65a={},_0x30ea8e={'count':0x0,'rows':[]};var _0x20a632=_[_0xda28('0x3b')](db[_0xda28('0x3c')][_0xda28('0x3d')],function(_0x23cc1e){return{'name':_0x23cc1e[_0xda28('0x3e')],'type':_0x23cc1e[_0xda28('0x3f')][_0xda28('0x40')]};});_0x3dd65a['model']=_[_0xda28('0x3b')](_0x20a632,_0xda28('0x38'));_0x3dd65a['query']=_[_0xda28('0x41')](_0xb9ecf4[_0xda28('0x42')]);_0x3dd65a[_0xda28('0x43')]=_[_0xda28('0x44')](_0x3dd65a[_0xda28('0x45')],_0x3dd65a[_0xda28('0x42')]);_0x2d19cd['attributes']=_[_0xda28('0x44')](_0x3dd65a['model'],qs[_0xda28('0x46')](_0xb9ecf4[_0xda28('0x42')]['fields']));_0x2d19cd[_0xda28('0x47')]=_0x2d19cd[_0xda28('0x47')][_0xda28('0x48')]?_0x2d19cd[_0xda28('0x47')]:_0x3dd65a[_0xda28('0x45')];if(!_0xb9ecf4['query'][_0xda28('0x49')]('nolimit')){_0x2d19cd[_0xda28('0x2d')]=qs[_0xda28('0x2d')](_0xb9ecf4[_0xda28('0x42')][_0xda28('0x2d')]);_0x2d19cd['offset']=qs[_0xda28('0x2c')](_0xb9ecf4[_0xda28('0x42')][_0xda28('0x2c')]);}_0x2d19cd[_0xda28('0x4a')]=qs[_0xda28('0x4b')](_0xb9ecf4[_0xda28('0x42')]['sort']);_0x2d19cd[_0xda28('0x4c')]=qs[_0xda28('0x43')](_[_0xda28('0x4d')](_0xb9ecf4[_0xda28('0x42')],_0x3dd65a['filters']),_0x20a632);if(_0xb9ecf4[_0xda28('0x42')]['filter']){_0x2d19cd[_0xda28('0x4c')]=_[_0xda28('0x4e')](_0x2d19cd[_0xda28('0x4c')],{'$or':_[_0xda28('0x3b')](_0x20a632,function(_0x507b87){if(_0x507b87[_0xda28('0x3f')]!==_0xda28('0x4f')){var _0xde75fa={};_0xde75fa[_0x507b87[_0xda28('0x38')]]={'$like':'%'+_0xb9ecf4[_0xda28('0x42')][_0xda28('0x50')]+'%'};return _0xde75fa;}})});}_0x2d19cd=_[_0xda28('0x4e')]({},_0x2d19cd,_0xb9ecf4[_0xda28('0x51')]);var _0xf577b9={'where':_0x2d19cd[_0xda28('0x4c')]};return db['FaxMessage'][_0xda28('0x2f')](_0xf577b9)[_0xda28('0x1e')](function(_0x10d66b){_0x30ea8e[_0xda28('0x2f')]=_0x10d66b;if(_0xb9ecf4[_0xda28('0x42')]['includeAll']){_0x2d19cd[_0xda28('0x52')]=[{'all':!![]}];}return db[_0xda28('0x3c')][_0xda28('0x53')](_0x2d19cd);})[_0xda28('0x1e')](function(_0x370065){_0x30ea8e[_0xda28('0x54')]=_0x370065;return _0x30ea8e;})[_0xda28('0x1e')](respondWithFilteredResult(_0x31290a,_0x2d19cd))['catch'](handleError(_0x31290a,null));};exports[_0xda28('0x55')]=function(_0x3ff92b,_0x2263bd){var _0x475323={'raw':!![],'where':{'id':_0x3ff92b[_0xda28('0x56')]['id']}},_0xee79f4={};_0xee79f4[_0xda28('0x45')]=_[_0xda28('0x41')](db['FaxMessage']['rawAttributes']);_0xee79f4[_0xda28('0x42')]=_['keys'](_0x3ff92b[_0xda28('0x42')]);_0xee79f4[_0xda28('0x43')]=_[_0xda28('0x44')](_0xee79f4[_0xda28('0x45')],_0xee79f4['query']);_0x475323[_0xda28('0x47')]=_[_0xda28('0x44')](_0xee79f4[_0xda28('0x45')],qs[_0xda28('0x46')](_0x3ff92b['query']['fields']));_0x475323[_0xda28('0x47')]=_0x475323[_0xda28('0x47')][_0xda28('0x48')]?_0x475323[_0xda28('0x47')]:_0xee79f4[_0xda28('0x45')];if(_0x3ff92b[_0xda28('0x42')][_0xda28('0x57')]){_0x475323['include']=[{'all':!![]}];}_0x475323=_[_0xda28('0x4e')]({},_0x475323,_0x3ff92b['options']);return db[_0xda28('0x3c')]['find'](_0x475323)[_0xda28('0x1e')](handleEntityNotFound(_0x2263bd,null))[_0xda28('0x1e')](respondWithResult(_0x2263bd,null))[_0xda28('0x28')](handleError(_0x2263bd,null));};exports['update']=function(_0x10deaf,_0x436750){if(_0x10deaf[_0xda28('0x58')]['id']){delete _0x10deaf[_0xda28('0x58')]['id'];}return db[_0xda28('0x3c')][_0xda28('0x59')]({'where':{'id':_0x10deaf[_0xda28('0x56')]['id']}})['then'](handleEntityNotFound(_0x436750,null))[_0xda28('0x1e')](saveUpdates(_0x10deaf[_0xda28('0x58')],null))[_0xda28('0x1e')](respondWithResult(_0x436750,null))[_0xda28('0x28')](handleError(_0x436750,null));};exports[_0xda28('0x36')]=function(_0x3b4867,_0x24034d){return db[_0xda28('0x3c')]['find']({'where':{'id':_0x3b4867[_0xda28('0x56')]['id']}})[_0xda28('0x1e')](handleEntityNotFound(_0x24034d,null))[_0xda28('0x1e')](removeEntity(_0x24034d,null))[_0xda28('0x28')](handleError(_0x24034d,null));};exports[_0xda28('0x5a')]=function(_0xe3d6e2,_0x37ae26){return db['FaxMessage'][_0xda28('0x5a')]()[_0xda28('0x1e')](respondWithResult(_0x37ae26,null))['catch'](handleError(_0x37ae26,null));};var interaction_log=require(_0xda28('0x11'))('fax-interactions');exports[_0xda28('0x5b')]=function(_0x4a86cf,_0x5e5140,_0x144af4){var _0x2d341b={'agent':{},'channel':_0xda28('0x5c')};if(_0x4a86cf[_0xda28('0x58')]['id']){delete _0x4a86cf['body']['id'];}_0x4a86cf[_0xda28('0x58')]['read']=!![];_0x4a86cf[_0xda28('0x58')][_0xda28('0x5d')]=moment()[_0xda28('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a86cf[_0xda28('0x58')][_0xda28('0x5f')]=_0x4a86cf[_0xda28('0x58')][_0xda28('0x5f')]||_0x4a86cf[_0xda28('0x60')]['id'];_0x2d341b['agent']['id']=_0x4a86cf[_0xda28('0x58')]['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x4a86cf[_0xda28('0x56')]['id'],'UserId':null}})[_0xda28('0x1e')](handleEntityNotFound(_0x5e5140,null))[_0xda28('0x1e')](saveUpdates(_0x4a86cf[_0xda28('0x58')],null))[_0xda28('0x1e')](function(_0x3bb804){if(_0x3bb804){_0x2d341b['message']=_0x3bb804[_0xda28('0x61')]({'plain':!![]});return db[_0xda28('0x62')]['find']({'where':{'id':_0x3bb804[_0xda28('0x63')]}});}return null;})[_0xda28('0x1e')](handleEntityNotFound(_0x5e5140,null))['then'](function(_0x374a69){if(_0x374a69){return _0x374a69[_0xda28('0x35')]({'UserId':_0x4a86cf[_0xda28('0x58')][_0xda28('0x5f')],'read1stAt':_[_0xda28('0x64')](_0x374a69['read1stAt'])?moment()[_0xda28('0x5e')](_0xda28('0x65')):undefined});}return null;})[_0xda28('0x1e')](function(_0x1f230b){if(_0x1f230b){_0x2d341b[_0xda28('0x66')]=_0x1f230b[_0xda28('0x61')]({'plain':!![]});interaction_log[_0xda28('0x27')](_0xda28('0x67'),_0x4a86cf['user']['id'],_0x4a86cf['user'][_0xda28('0x38')],_0x4a86cf[_0xda28('0x60')]['role'],_0x2d341b[_0xda28('0x66')]['id'],_0x4a86cf[_0xda28('0x58')]?JSON[_0xda28('0x22')](_0x4a86cf['body']):_0xda28('0x68'));return respondWithRpcPromise(_0xda28('0x69'),'acceptMessage',_0x2d341b);}return null;})[_0xda28('0x1e')](function(_0x858cb0){var _0x3a2618=_0xda28('0x6a')+_0x858cb0[_0xda28('0x26')][_0xda28('0x6b')];return db[_0xda28('0x6c')][_0xda28('0x42')](_0x3a2618,{'type':db[_0xda28('0x6d')][_0xda28('0x6e')][_0xda28('0x6f')],'raw':!![]})[_0xda28('0x1e')](function(_0x5bf76a){return _0x5bf76a;});})['then'](function(_0xff26fc){if(_0xff26fc){_0x2d341b['message'][_0xda28('0x70')]=_0xff26fc[0x0];if(!_0x4a86cf[_0xda28('0x58')][_0xda28('0x5f')])return;return db[_0xda28('0x71')][_0xda28('0x59')]({'where':{'id':_0x4a86cf[_0xda28('0x58')][_0xda28('0x5f')],'role':_0xda28('0x72')},'attributes':['id',_0xda28('0x38'),'fullname',_0xda28('0x73'),'internal'],'raw':!![]});}return null;})[_0xda28('0x1e')](function(_0x1cf6fc){if(!_0x1cf6fc)return null;_0x2d341b[_0xda28('0x26')]['agent']=_0x1cf6fc;return _0x2d341b;})[_0xda28('0x1e')](function(_0x3261c0){if(_0x3261c0){if(_0x4a86cf[_0xda28('0x58')][_0xda28('0x74')]){_0x2d341b[_0xda28('0x26')][_0xda28('0x75')]=util['format'](_0xda28('0x76'),_0x4a86cf['user'][_0xda28('0x38')]);_0x2d341b[_0xda28('0x26')]['channel']=_0x2d341b[_0xda28('0x77')];_0x2d341b[_0xda28('0x26')][_0xda28('0x78')]=_0x2d341b[_0xda28('0x77')];_0x2d341b['message'][_0xda28('0x79')]=_0xda28('0x5b');return respondWithRpcPromise(_0xda28('0x7a'),_0xda28('0x7a'),{'event':'acceptmessage','message':_0x2d341b[_0xda28('0x26')]},client9002)[_0xda28('0x1e')](function(){return _0x2d341b;});}return _0x2d341b;}return null;})[_0xda28('0x1e')](respondWithResult(_0x5e5140,null))['catch'](handleError(_0x5e5140,null));};var interaction_log=require(_0xda28('0x11'))('fax-interactions');exports[_0xda28('0x34')]=function(_0x5ce86b,_0x52d029,_0x3ec979){var _0x1f88b2={'agent':{},'channel':'fax'};if(_0x5ce86b[_0xda28('0x58')]['id']){delete _0x5ce86b[_0xda28('0x58')]['id'];}_0x5ce86b['body'][_0xda28('0x5f')]=_0x5ce86b[_0xda28('0x58')][_0xda28('0x5f')]||_0x5ce86b[_0xda28('0x60')]['id'];_0x1f88b2[_0xda28('0x72')]['id']=_0x5ce86b[_0xda28('0x58')][_0xda28('0x5f')];return db['FaxMessage'][_0xda28('0x59')]({'where':{'id':_0x5ce86b[_0xda28('0x56')]['id'],'UserId':null}})[_0xda28('0x1e')](handleEntityNotFound(_0x52d029,null))[_0xda28('0x1e')](function(_0x336dd8){if(_0x336dd8){_0x1f88b2['message']=_0x336dd8['get']({'plain':!![]});return db[_0xda28('0x62')][_0xda28('0x59')]({'where':{'id':_0x336dd8['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x52d029,null))[_0xda28('0x1e')](function(_0x49f290){if(_0x49f290){_0x1f88b2[_0xda28('0x66')]=_0x49f290[_0xda28('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5ce86b[_0xda28('0x60')]['id'],_0x5ce86b['user']['name'],_0x5ce86b[_0xda28('0x60')][_0xda28('0x7b')],_0x1f88b2[_0xda28('0x66')]['id'],_0x5ce86b['body']?JSON[_0xda28('0x22')](_0x5ce86b[_0xda28('0x58')]):_0xda28('0x68'));return respondWithRpcPromise(_0xda28('0x7c'),'rejectMessage',_0x1f88b2);}return null;})[_0xda28('0x1e')](function(_0x5e0b79){var _0x4dda73=_0xda28('0x6a')+_0x5e0b79[_0xda28('0x26')][_0xda28('0x6b')];return db[_0xda28('0x6c')][_0xda28('0x42')](_0x4dda73,{'type':db[_0xda28('0x6d')][_0xda28('0x6e')][_0xda28('0x6f')],'raw':!![]})['then'](function(_0x469f40){return _0x469f40;});})[_0xda28('0x1e')](function(_0xc8cca9){if(_0xc8cca9){_0x1f88b2[_0xda28('0x26')][_0xda28('0x70')]=_0xc8cca9[0x0];if(!_0x5ce86b[_0xda28('0x58')][_0xda28('0x5f')])return;return db[_0xda28('0x71')][_0xda28('0x59')]({'where':{'id':_0x5ce86b[_0xda28('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0xda28('0x38'),_0xda28('0x7d'),'email',_0xda28('0x7e')],'raw':!![]});}return null;})['then'](function(_0x15810b){if(!_0x15810b)return null;_0x1f88b2[_0xda28('0x26')][_0xda28('0x72')]=_0x15810b;return _0x1f88b2;})[_0xda28('0x1e')](function(_0x1906ec){if(_0x1906ec){_0x1906ec[_0xda28('0x26')][_0xda28('0x75')]=util[_0xda28('0x5e')](_0xda28('0x76'),_0x5ce86b[_0xda28('0x60')]['name']);_0x1906ec[_0xda28('0x26')]['channel']=_0x1f88b2[_0xda28('0x77')];_0x1906ec[_0xda28('0x26')][_0xda28('0x78')]=_0x1f88b2[_0xda28('0x77')];_0x1906ec[_0xda28('0x26')][_0xda28('0x79')]=_0xda28('0x34');respondWithRpcPromise(_0xda28('0x7a'),_0xda28('0x7a'),{'event':_0xda28('0x7f'),'message':_0x1906ec[_0xda28('0x26')]},client9002);return _0x1f88b2;}return null;})[_0xda28('0x1e')](respondWithResult(_0x52d029,null))[_0xda28('0x28')](handleError(_0x52d029,null));};exports['create']=function(_0x4aedce,_0x240d6c){var _0x18e956;return db[_0xda28('0x3c')][_0xda28('0x80')](_0x4aedce[_0xda28('0x58')],{})['then'](function(_0x2402b9){_0x18e956=_0x2402b9;return db[_0xda28('0x81')][_0xda28('0x82')]({'where':{'id':_0x18e956[_0xda28('0x6b')]}});})[_0xda28('0x1e')](function(_0xb2207){if(_['isNil'](_0xb2207)){return;}else{_0x18e956[_0xda28('0x5c')]=_0xb2207['fax'];return db[_0xda28('0x83')][_0xda28('0x82')]({'where':{'id':_0x18e956[_0xda28('0x84')]}});}})[_0xda28('0x1e')](function(_0x5abb81){return respondWithRpcPromise(_0xda28('0x85'),'SendFax',{'FaxAccountId':_['isNil'](_0x4aedce[_0xda28('0x58')])?undefined:_0x4aedce[_0xda28('0x58')][_0xda28('0x86')],'path':_[_0xda28('0x64')](_0x5abb81)?undefined:util[_0xda28('0x5e')](_0xda28('0x87'),_0x5abb81[_0xda28('0x88')]),'fax':_[_0xda28('0x64')](_0x18e956[_0xda28('0x5c')])?undefined:_0x18e956[_0xda28('0x5c')],'AttachmentId':_0x18e956[_0xda28('0x84')]},client9002);})[_0xda28('0x1e')](respondWithResult(_0x240d6c,0xc9))[_0xda28('0x28')](handleError(_0x240d6c,null));};exports[_0xda28('0x89')]=function(_0x1a9698,_0x6d8519){var _0x31d124=path['join'](config[_0xda28('0x8a')],_0xda28('0x8b'),'files',_0xda28('0x8c'));return db[_0xda28('0x3c')][_0xda28('0x59')]({'where':{'id':_0x1a9698['params']['id']},'include':[{'model':db['Attachment'],'as':_0xda28('0x83')}]})[_0xda28('0x1e')](handleEntityNotFound(_0x6d8519,null))[_0xda28('0x1e')](function(_0x5d52d4){if(_0x5d52d4){return _0x6d8519['download'](path[_0xda28('0x8d')](_0x31d124,_0x5d52d4[_0xda28('0x83')][_0xda28('0x88')]));}})[_0xda28('0x28')](handleError(_0x6d8519,null));}; \ No newline at end of file +var _0xaecb=['describe','../../config/logger','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax','FaxInteraction','RejectMessage','rejectMessage','User','fullname','motionChannel','rejectmessage','create','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','Attachment','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','body','find'];(function(_0x40e13e,_0x376d13){var _0x5db39e=function(_0x2dc3f6){while(--_0x2dc3f6){_0x40e13e['push'](_0x40e13e['shift']());}};_0x5db39e(++_0x376d13);}(_0xaecb,0x15e));var _0xbaec=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaecb[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xbaec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbaec('0x1'));var jsonpatch=require(_0xbaec('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbaec('0x3'));var Mustache=require(_0xbaec('0x4'));var util=require(_0xbaec('0x5'));var path=require(_0xbaec('0x6'));var sox=require(_0xbaec('0x7'));var csv=require(_0xbaec('0x8'));var ejs=require(_0xbaec('0x9'));var fs=require('fs');var fs_extra=require(_0xbaec('0xa'));var _=require(_0xbaec('0xb'));var squel=require(_0xbaec('0xc'));var crypto=require(_0xbaec('0xd'));var jsforce=require(_0xbaec('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbaec('0xf'));var Redis=require(_0xbaec('0x10'));var authService=require(_0xbaec('0x11'));var qs=require(_0xbaec('0x12'));var as=require(_0xbaec('0x13'));var hardwareService=require(_0xbaec('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xbaec('0x15'));var config=require(_0xbaec('0x16'));var licenseUtil=require(_0xbaec('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xbaec('0x18')](config[_0xbaec('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbaec('0x1a'))(new Redis(config[_0xbaec('0x19')]));require(_0xbaec('0x1b'))[_0xbaec('0x1c')](socket);var jayson=require(_0xbaec('0x1d'));var client=jayson[_0xbaec('0x1e')][_0xbaec('0x1f')]({'port':0x232c});var client9002=jayson[_0xbaec('0x1e')][_0xbaec('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5ace5c,_0x1efbd7,_0x2d1b62,_0x3ee59){return new BPromise(function(_0x325eec,_0x51a3ea){var _0x1a2ed5=_0x3ee59||client;return _0x1a2ed5[_0xbaec('0x20')](_0x5ace5c,_0x2d1b62)['then'](function(_0x4b93f9){logger[_0xbaec('0x21')](_0xbaec('0x22'),_0x1efbd7,'request\x20sent');logger[_0xbaec('0x23')](_0xbaec('0x24'),_0x1efbd7,'request\x20sent',JSON[_0xbaec('0x25')](_0x4b93f9));if(_0x4b93f9[_0xbaec('0x26')]){if(_0x4b93f9[_0xbaec('0x26')][_0xbaec('0x27')]===0x1f4){logger['error'](_0xbaec('0x22'),_0x1efbd7,_0x4b93f9[_0xbaec('0x26')][_0xbaec('0x28')]);return _0x51a3ea(_0x4b93f9['error'][_0xbaec('0x28')]);}logger[_0xbaec('0x26')](_0xbaec('0x22'),_0x1efbd7,_0x4b93f9['error'][_0xbaec('0x28')]);return _0x325eec(_0x4b93f9[_0xbaec('0x26')][_0xbaec('0x28')]);}else{logger[_0xbaec('0x21')](_0xbaec('0x22'),_0x1efbd7,_0xbaec('0x29'));_0x325eec(_0x4b93f9['result'][_0xbaec('0x28')]);}})[_0xbaec('0x2a')](function(_0x5ab0fa){logger['error'](_0xbaec('0x22'),_0x1efbd7,_0x5ab0fa);_0x51a3ea(_0x5ab0fa);});});}function respondWithStatusCode(_0x523844,_0x556284){_0x556284=_0x556284||0xcc;return function(_0x45c53c){if(_0x45c53c){return _0x523844[_0xbaec('0x2b')](_0x556284);}return _0x523844['status'](_0x556284)[_0xbaec('0x2c')]();};}function respondWithResult(_0x428049,_0x2a0631){_0x2a0631=_0x2a0631||0xc8;return function(_0x5ea86a){if(_0x5ea86a){return _0x428049[_0xbaec('0x2d')](_0x2a0631)[_0xbaec('0x2e')](_0x5ea86a);}};}function respondWithFilteredResult(_0x45eaae,_0x541d4e){return function(_0x34d749){if(_0x34d749){var _0x1e44f9=typeof _0x541d4e['offset']===_0xbaec('0x2f')&&typeof _0x541d4e['limit']===_0xbaec('0x2f');var _0x35129c=_0x34d749[_0xbaec('0x30')];var _0x2db74c=_0x1e44f9?0x0:_0x541d4e[_0xbaec('0x31')];var _0x6cc6ab=_0x1e44f9?_0x34d749[_0xbaec('0x30')]:_0x541d4e[_0xbaec('0x31')]+_0x541d4e[_0xbaec('0x32')];var _0x33582f;if(_0x6cc6ab>=_0x35129c){_0x6cc6ab=_0x35129c;_0x33582f=0xc8;}else{_0x33582f=0xce;}_0x45eaae['status'](_0x33582f);return _0x45eaae['set'](_0xbaec('0x33'),_0x2db74c+'-'+_0x6cc6ab+'/'+_0x35129c)['json'](_0x34d749);}return null;};}function patchUpdates(_0x29252e){return function(_0xb0b842){try{jsonpatch[_0xbaec('0x34')](_0xb0b842,_0x29252e,!![]);}catch(_0x1d3e1d){return BPromise[_0xbaec('0x35')](_0x1d3e1d);}return _0xb0b842[_0xbaec('0x36')]();};}function saveUpdates(_0x584e92,_0x53ef37){return function(_0x276dfe){if(_0x276dfe){return _0x276dfe[_0xbaec('0x37')](_0x584e92)[_0xbaec('0x38')](function(_0x424f16){return _0x424f16;});}return null;};}function removeEntity(_0x31b229,_0x34b892){return function(_0x508360){if(_0x508360){return _0x508360[_0xbaec('0x39')]()[_0xbaec('0x38')](function(){_0x31b229[_0xbaec('0x2d')](0xcc)[_0xbaec('0x2c')]();});}};}function handleEntityNotFound(_0x469633,_0x3f9238){return function(_0x2cc981){if(!_0x2cc981){_0x469633['sendStatus'](0x194);}return _0x2cc981;};}function handleError(_0x508043,_0x799b6c){_0x799b6c=_0x799b6c||0x1f4;return function(_0x16fc2c){logger['error'](_0x16fc2c['stack']);if(_0x16fc2c[_0xbaec('0x3a')]){delete _0x16fc2c[_0xbaec('0x3a')];}_0x508043[_0xbaec('0x2d')](_0x799b6c)[_0xbaec('0x3b')](_0x16fc2c);};}exports[_0xbaec('0x3c')]=function(_0x24cc90,_0x5dd61a){var _0x4988b2={},_0x4aadb5={},_0x433645={'count':0x0,'rows':[]};var _0x3cb99d=_[_0xbaec('0x3d')](db[_0xbaec('0x3e')][_0xbaec('0x3f')],function(_0x2a7299){return{'name':_0x2a7299[_0xbaec('0x40')],'type':_0x2a7299[_0xbaec('0x41')][_0xbaec('0x42')]};});_0x4aadb5['model']=_[_0xbaec('0x3d')](_0x3cb99d,'name');_0x4aadb5['query']=_['keys'](_0x24cc90[_0xbaec('0x43')]);_0x4aadb5[_0xbaec('0x44')]=_[_0xbaec('0x45')](_0x4aadb5[_0xbaec('0x46')],_0x4aadb5['query']);_0x4988b2[_0xbaec('0x47')]=_[_0xbaec('0x45')](_0x4aadb5[_0xbaec('0x46')],qs[_0xbaec('0x48')](_0x24cc90[_0xbaec('0x43')][_0xbaec('0x48')]));_0x4988b2[_0xbaec('0x47')]=_0x4988b2['attributes'][_0xbaec('0x49')]?_0x4988b2[_0xbaec('0x47')]:_0x4aadb5[_0xbaec('0x46')];if(!_0x24cc90[_0xbaec('0x43')][_0xbaec('0x4a')](_0xbaec('0x4b'))){_0x4988b2[_0xbaec('0x32')]=qs['limit'](_0x24cc90[_0xbaec('0x43')][_0xbaec('0x32')]);_0x4988b2['offset']=qs[_0xbaec('0x31')](_0x24cc90[_0xbaec('0x43')][_0xbaec('0x31')]);}_0x4988b2[_0xbaec('0x4c')]=qs[_0xbaec('0x4d')](_0x24cc90[_0xbaec('0x43')][_0xbaec('0x4d')]);_0x4988b2['where']=qs[_0xbaec('0x44')](_['pick'](_0x24cc90[_0xbaec('0x43')],_0x4aadb5[_0xbaec('0x44')]),_0x3cb99d);if(_0x24cc90[_0xbaec('0x43')][_0xbaec('0x4e')]){_0x4988b2[_0xbaec('0x4f')]=_[_0xbaec('0x50')](_0x4988b2[_0xbaec('0x4f')],{'$or':_[_0xbaec('0x3d')](_0x3cb99d,function(_0xbc38e){if(_0xbc38e['type']!==_0xbaec('0x51')){var _0x29ea57={};_0x29ea57[_0xbc38e['name']]={'$like':'%'+_0x24cc90[_0xbaec('0x43')][_0xbaec('0x4e')]+'%'};return _0x29ea57;}})});}_0x4988b2=_['merge']({},_0x4988b2,_0x24cc90[_0xbaec('0x52')]);var _0x150c95={'where':_0x4988b2[_0xbaec('0x4f')]};return db['FaxMessage']['count'](_0x150c95)[_0xbaec('0x38')](function(_0x19435a){_0x433645[_0xbaec('0x30')]=_0x19435a;if(_0x24cc90[_0xbaec('0x43')][_0xbaec('0x53')]){_0x4988b2[_0xbaec('0x54')]=[{'all':!![]}];}return db[_0xbaec('0x3e')][_0xbaec('0x55')](_0x4988b2);})[_0xbaec('0x38')](function(_0x120530){_0x433645['rows']=_0x120530;return _0x433645;})[_0xbaec('0x38')](respondWithFilteredResult(_0x5dd61a,_0x4988b2))[_0xbaec('0x2a')](handleError(_0x5dd61a,null));};exports[_0xbaec('0x56')]=function(_0x1fde2e,_0x211b93){var _0x505d0c={'raw':!![],'where':{'id':_0x1fde2e[_0xbaec('0x57')]['id']}},_0x1f1102={};_0x1f1102[_0xbaec('0x46')]=_[_0xbaec('0x58')](db['FaxMessage'][_0xbaec('0x3f')]);_0x1f1102[_0xbaec('0x43')]=_[_0xbaec('0x58')](_0x1fde2e['query']);_0x1f1102[_0xbaec('0x44')]=_['intersection'](_0x1f1102['model'],_0x1f1102[_0xbaec('0x43')]);_0x505d0c['attributes']=_[_0xbaec('0x45')](_0x1f1102['model'],qs[_0xbaec('0x48')](_0x1fde2e[_0xbaec('0x43')][_0xbaec('0x48')]));_0x505d0c['attributes']=_0x505d0c[_0xbaec('0x47')][_0xbaec('0x49')]?_0x505d0c['attributes']:_0x1f1102['model'];if(_0x1fde2e[_0xbaec('0x43')][_0xbaec('0x53')]){_0x505d0c[_0xbaec('0x54')]=[{'all':!![]}];}_0x505d0c=_[_0xbaec('0x50')]({},_0x505d0c,_0x1fde2e['options']);return db[_0xbaec('0x3e')]['find'](_0x505d0c)[_0xbaec('0x38')](handleEntityNotFound(_0x211b93,null))['then'](respondWithResult(_0x211b93,null))['catch'](handleError(_0x211b93,null));};exports[_0xbaec('0x37')]=function(_0x41f906,_0x3b86d6){if(_0x41f906['body']['id']){delete _0x41f906[_0xbaec('0x59')]['id'];}return db[_0xbaec('0x3e')][_0xbaec('0x5a')]({'where':{'id':_0x41f906[_0xbaec('0x57')]['id']}})['then'](handleEntityNotFound(_0x3b86d6,null))['then'](saveUpdates(_0x41f906[_0xbaec('0x59')],null))[_0xbaec('0x38')](respondWithResult(_0x3b86d6,null))['catch'](handleError(_0x3b86d6,null));};exports['destroy']=function(_0x383a5b,_0x1752db){return db[_0xbaec('0x3e')][_0xbaec('0x5a')]({'where':{'id':_0x383a5b['params']['id']}})[_0xbaec('0x38')](handleEntityNotFound(_0x1752db,null))['then'](removeEntity(_0x1752db,null))[_0xbaec('0x2a')](handleError(_0x1752db,null));};exports[_0xbaec('0x5b')]=function(_0x2b3156,_0x318817){return db[_0xbaec('0x3e')]['describe']()[_0xbaec('0x38')](respondWithResult(_0x318817,null))[_0xbaec('0x2a')](handleError(_0x318817,null));};var interaction_log=require(_0xbaec('0x5c'))('fax-interactions');exports[_0xbaec('0x5d')]=function(_0x14a273,_0x4ed988,_0x344654){var _0x3930aa={'agent':{},'channel':'fax'};if(_0x14a273['body']['id']){delete _0x14a273[_0xbaec('0x59')]['id'];}_0x14a273[_0xbaec('0x59')][_0xbaec('0x5e')]=!![];_0x14a273[_0xbaec('0x59')][_0xbaec('0x5f')]=moment()[_0xbaec('0x60')](_0xbaec('0x61'));_0x14a273[_0xbaec('0x59')][_0xbaec('0x62')]=_0x14a273[_0xbaec('0x59')]['UserId']||_0x14a273[_0xbaec('0x63')]['id'];_0x3930aa[_0xbaec('0x64')]['id']=_0x14a273[_0xbaec('0x59')][_0xbaec('0x62')];return db[_0xbaec('0x3e')][_0xbaec('0x5a')]({'where':{'id':_0x14a273[_0xbaec('0x57')]['id'],'UserId':null}})[_0xbaec('0x38')](handleEntityNotFound(_0x4ed988,null))[_0xbaec('0x38')](saveUpdates(_0x14a273['body'],null))[_0xbaec('0x38')](function(_0x399bb8){if(_0x399bb8){_0x3930aa['message']=_0x399bb8[_0xbaec('0x65')]({'plain':!![]});return db['FaxInteraction'][_0xbaec('0x5a')]({'where':{'id':_0x399bb8[_0xbaec('0x66')]}});}return null;})[_0xbaec('0x38')](handleEntityNotFound(_0x4ed988,null))['then'](function(_0x905c6a){if(_0x905c6a){return _0x905c6a[_0xbaec('0x37')]({'UserId':_0x14a273[_0xbaec('0x59')]['UserId'],'read1stAt':_[_0xbaec('0x67')](_0x905c6a[_0xbaec('0x68')])?moment()[_0xbaec('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbaec('0x38')](function(_0x3f95b2){if(_0x3f95b2){_0x3930aa['interaction']=_0x3f95b2[_0xbaec('0x65')]({'plain':!![]});interaction_log['info'](_0xbaec('0x69'),_0x14a273['user']['id'],_0x14a273['user'][_0xbaec('0x3a')],_0x14a273['user'][_0xbaec('0x6a')],_0x3930aa[_0xbaec('0x6b')]['id'],_0x14a273['body']?JSON['stringify'](_0x14a273['body']):_0xbaec('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xbaec('0x6d'),_0x3930aa);}return null;})['then'](function(_0x33a749){var _0x4b6d3d=_0xbaec('0x6e')+_0x33a749['message'][_0xbaec('0x6f')];return db[_0xbaec('0x70')][_0xbaec('0x43')](_0x4b6d3d,{'type':db[_0xbaec('0x71')][_0xbaec('0x72')][_0xbaec('0x73')],'raw':!![]})['then'](function(_0x2a1354){return _0x2a1354;});})[_0xbaec('0x38')](function(_0x393114){if(_0x393114){_0x3930aa[_0xbaec('0x28')][_0xbaec('0x74')]=_0x393114[0x0];if(!_0x14a273[_0xbaec('0x59')][_0xbaec('0x62')])return;return db['User'][_0xbaec('0x5a')]({'where':{'id':_0x14a273[_0xbaec('0x59')][_0xbaec('0x62')],'role':_0xbaec('0x64')},'attributes':['id','name','fullname',_0xbaec('0x75'),_0xbaec('0x76')],'raw':!![]});}return null;})[_0xbaec('0x38')](function(_0x52ec41){if(!_0x52ec41)return null;_0x3930aa[_0xbaec('0x28')]['agent']=_0x52ec41;return _0x3930aa;})[_0xbaec('0x38')](function(_0x63974c){if(_0x63974c){if(_0x14a273[_0xbaec('0x59')][_0xbaec('0x77')]){_0x3930aa[_0xbaec('0x28')][_0xbaec('0x78')]=util['format'](_0xbaec('0x79'),_0x14a273[_0xbaec('0x63')][_0xbaec('0x3a')]);_0x3930aa[_0xbaec('0x28')][_0xbaec('0x7a')]=_0x3930aa[_0xbaec('0x7a')];_0x3930aa['message']['motionChannel']=_0x3930aa[_0xbaec('0x7a')];_0x3930aa[_0xbaec('0x28')][_0xbaec('0x7b')]=_0xbaec('0x5d');return respondWithRpcPromise(_0xbaec('0x7c'),_0xbaec('0x7c'),{'event':_0xbaec('0x7d'),'message':_0x3930aa['message']},client9002)['then'](function(){return _0x3930aa;});}return _0x3930aa;}return null;})['then'](respondWithResult(_0x4ed988,null))['catch'](handleError(_0x4ed988,null));};var interaction_log=require(_0xbaec('0x5c'))('fax-interactions');exports[_0xbaec('0x35')]=function(_0x152ed3,_0x1cfa53,_0x1acfab){var _0x556599={'agent':{},'channel':_0xbaec('0x7e')};if(_0x152ed3['body']['id']){delete _0x152ed3['body']['id'];}_0x152ed3['body'][_0xbaec('0x62')]=_0x152ed3['body'][_0xbaec('0x62')]||_0x152ed3[_0xbaec('0x63')]['id'];_0x556599[_0xbaec('0x64')]['id']=_0x152ed3['body']['UserId'];return db[_0xbaec('0x3e')][_0xbaec('0x5a')]({'where':{'id':_0x152ed3['params']['id'],'UserId':null}})[_0xbaec('0x38')](handleEntityNotFound(_0x1cfa53,null))['then'](function(_0x378539){if(_0x378539){_0x556599[_0xbaec('0x28')]=_0x378539['get']({'plain':!![]});return db[_0xbaec('0x7f')][_0xbaec('0x5a')]({'where':{'id':_0x378539[_0xbaec('0x66')]}});}return null;})[_0xbaec('0x38')](handleEntityNotFound(_0x1cfa53,null))[_0xbaec('0x38')](function(_0x4a73fe){if(_0x4a73fe){_0x556599['interaction']=_0x4a73fe['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x152ed3[_0xbaec('0x63')]['id'],_0x152ed3[_0xbaec('0x63')]['name'],_0x152ed3[_0xbaec('0x63')][_0xbaec('0x6a')],_0x556599['interaction']['id'],_0x152ed3['body']?JSON[_0xbaec('0x25')](_0x152ed3[_0xbaec('0x59')]):'null');return respondWithRpcPromise(_0xbaec('0x80'),_0xbaec('0x81'),_0x556599);}return null;})[_0xbaec('0x38')](function(_0x1217e4){var _0x37398c=_0xbaec('0x6e')+_0x1217e4[_0xbaec('0x28')][_0xbaec('0x6f')];return db[_0xbaec('0x70')][_0xbaec('0x43')](_0x37398c,{'type':db[_0xbaec('0x71')][_0xbaec('0x72')]['SELECT'],'raw':!![]})[_0xbaec('0x38')](function(_0x275daa){return _0x275daa;});})[_0xbaec('0x38')](function(_0xe26507){if(_0xe26507){_0x556599['message']['contact']=_0xe26507[0x0];if(!_0x152ed3[_0xbaec('0x59')]['UserId'])return;return db[_0xbaec('0x82')][_0xbaec('0x5a')]({'where':{'id':_0x152ed3[_0xbaec('0x59')][_0xbaec('0x62')],'role':_0xbaec('0x64')},'attributes':['id',_0xbaec('0x3a'),_0xbaec('0x83'),_0xbaec('0x75'),_0xbaec('0x76')],'raw':!![]});}return null;})[_0xbaec('0x38')](function(_0x125a8a){if(!_0x125a8a)return null;_0x556599[_0xbaec('0x28')][_0xbaec('0x64')]=_0x125a8a;return _0x556599;})['then'](function(_0x4e2b3c){if(_0x4e2b3c){_0x4e2b3c['message'][_0xbaec('0x78')]=util[_0xbaec('0x60')](_0xbaec('0x79'),_0x152ed3['user'][_0xbaec('0x3a')]);_0x4e2b3c[_0xbaec('0x28')]['channel']=_0x556599[_0xbaec('0x7a')];_0x4e2b3c[_0xbaec('0x28')][_0xbaec('0x84')]=_0x556599[_0xbaec('0x7a')];_0x4e2b3c['message'][_0xbaec('0x7b')]=_0xbaec('0x35');respondWithRpcPromise('EventManager',_0xbaec('0x7c'),{'event':_0xbaec('0x85'),'message':_0x4e2b3c[_0xbaec('0x28')]},client9002);return _0x556599;}return null;})[_0xbaec('0x38')](respondWithResult(_0x1cfa53,null))[_0xbaec('0x2a')](handleError(_0x1cfa53,null));};exports['create']=function(_0x145517,_0x1784e4){var _0x4a7d3b;return db['FaxMessage'][_0xbaec('0x86')](_0x145517[_0xbaec('0x59')],{})[_0xbaec('0x38')](function(_0x165713){_0x4a7d3b=_0x165713;return db['CmContact']['findOne']({'where':{'id':_0x4a7d3b[_0xbaec('0x6f')]}});})[_0xbaec('0x38')](function(_0x7d6b11){if(_[_0xbaec('0x67')](_0x7d6b11)){return;}else{_0x4a7d3b[_0xbaec('0x7e')]=_0x7d6b11[_0xbaec('0x7e')];return db['Attachment'][_0xbaec('0x87')]({'where':{'id':_0x4a7d3b[_0xbaec('0x88')]}});}})[_0xbaec('0x38')](function(_0xb89b70){return respondWithRpcPromise(_0xbaec('0x89'),_0xbaec('0x89'),{'FaxAccountId':_[_0xbaec('0x67')](_0x145517[_0xbaec('0x59')])?undefined:_0x145517[_0xbaec('0x59')][_0xbaec('0x8a')],'path':_[_0xbaec('0x67')](_0xb89b70)?undefined:util[_0xbaec('0x60')](_0xbaec('0x8b'),_0xb89b70[_0xbaec('0x8c')]),'fax':_[_0xbaec('0x67')](_0x4a7d3b[_0xbaec('0x7e')])?undefined:_0x4a7d3b[_0xbaec('0x7e')],'AttachmentId':_0x4a7d3b[_0xbaec('0x88')]},client9002);})[_0xbaec('0x38')](respondWithResult(_0x1784e4,0xc9))[_0xbaec('0x2a')](handleError(_0x1784e4,null));};exports[_0xbaec('0x8d')]=function(_0x4d787f,_0x2f4cce){var _0x5ab5ee=path[_0xbaec('0x8e')](config['root'],_0xbaec('0x8f'),_0xbaec('0x90'),_0xbaec('0x91'));return db['FaxMessage'][_0xbaec('0x5a')]({'where':{'id':_0x4d787f[_0xbaec('0x57')]['id']},'include':[{'model':db['Attachment'],'as':_0xbaec('0x92')}]})[_0xbaec('0x38')](handleEntityNotFound(_0x2f4cce,null))[_0xbaec('0x38')](function(_0x89e506){if(_0x89e506){return _0x2f4cce['download'](path[_0xbaec('0x8e')](_0x5ab5ee,_0x89e506[_0xbaec('0x92')]['basename']));}})['catch'](handleError(_0x2f4cce,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 8b2e9d5..4ea1266 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55c1=['hasOwnProperty','exports','events','../../mysqldb','update','remove','emit'];(function(_0x956c6a,_0x4da772){var _0x2f39b6=function(_0x181546){while(--_0x181546){_0x956c6a['push'](_0x956c6a['shift']());}};_0x2f39b6(++_0x4da772);}(_0x55c1,0x1e5));var _0x155c=function(_0x362f6a,_0x3bd6b4){_0x362f6a=_0x362f6a-0x0;var _0x366640=_0x55c1[_0x362f6a];return _0x366640;};'use strict';var EventEmitter=require(_0x155c('0x0'));var FaxMessage=require(_0x155c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x155c('0x2'),'afterDestroy':_0x155c('0x3')};function emitEvent(_0x30444a){return function(_0x64c8aa,_0xb127e8,_0x5305d5){FaxMessageEvents[_0x155c('0x4')](_0x30444a+':'+_0x64c8aa['id'],_0x64c8aa);FaxMessageEvents[_0x155c('0x4')](_0x30444a,_0x64c8aa);_0x5305d5(null);};}for(var e in events){if(events[_0x155c('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x155c('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x66da=['../../mysqldb','FaxMessage','setMaxListeners','emit','hasOwnProperty','hook','exports','events'];(function(_0xa07b60,_0x5587f5){var _0x4a0f88=function(_0x2603aa){while(--_0x2603aa){_0xa07b60['push'](_0xa07b60['shift']());}};_0x4a0f88(++_0x5587f5);}(_0x66da,0x16f));var _0xa66d=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x66da[_0x4bd06e];return _0x85ebb;};'use strict';var EventEmitter=require(_0xa66d('0x0'));var FaxMessage=require(_0xa66d('0x1'))['db'][_0xa66d('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa66d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17b831){return function(_0x950036,_0x1326e8,_0x436606){FaxMessageEvents[_0xa66d('0x4')](_0x17b831+':'+_0x950036['id'],_0x950036);FaxMessageEvents['emit'](_0x17b831,_0x950036);_0x436606(null);};}for(var e in events){if(events[_0xa66d('0x5')](e)){var event=events[e];FaxMessage[_0xa66d('0x6')](e,emitEvent(event));}}module[_0xa66d('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index d18f16c..89f36a1 100644 --- a/server/api/faxMessage/faxMessage.model.js +++ b/server/api/faxMessage/faxMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf036=['get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT'];(function(_0x465d2d,_0x11dea1){var _0xc62db7=function(_0x96eb9a){while(--_0x96eb9a){_0x465d2d['push'](_0x465d2d['shift']());}};_0xc62db7(++_0x11dea1);}(_0xf036,0xed));var _0x6f03=function(_0xdd999,_0x2c94cf){_0xdd999=_0xdd999-0x0;var _0x3e0e5a=_0xf036[_0xdd999];return _0x3e0e5a;};'use strict';var _=require(_0x6f03('0x0'));var util=require(_0x6f03('0x1'));var logger=require(_0x6f03('0x2'))('api');var moment=require(_0x6f03('0x3'));var BPromise=require(_0x6f03('0x4'));var rp=require(_0x6f03('0x5'));var fs=require('fs');var path=require(_0x6f03('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f03('0x7'));module[_0x6f03('0x8')]=function(_0x2e6c18,_0x15307c){return _0x2e6c18[_0x6f03('0x9')](_0x6f03('0xa'),attributes,{'tableName':_0x6f03('0xb'),'paranoid':![],'indexes':[{'name':_0x6f03('0xc'),'fields':[_0x6f03('0xd')],'type':_0x6f03('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x433a58,_0x53d988,_0x1e24d9){var _0x63827b=_0x2e6c18['models'];var _0x4c0316=_0x433a58[_0x6f03('0xf')]({'plain':!![]});if(_0x4c0316[_0x6f03('0x10')][_0x6f03('0x11')]()==='in'||_0x4c0316['direction'][_0x6f03('0x11')]()===_0x6f03('0x12')&&!_0x4c0316[_0x6f03('0x13')]&&!_[_0x6f03('0x14')](_0x4c0316[_0x6f03('0x15')])){_0x63827b['FaxInteraction']['findOne']({'where':{'id':_0x4c0316[_0x6f03('0x16')]}})[_0x6f03('0x17')](function(_0x3bfd26){if(_0x3bfd26){_0x3bfd26['update']({'lastMsgAt':_0x4c0316[_0x6f03('0x18')],'lastMsgDirection':_0x4c0316[_0x6f03('0x10')][_0x6f03('0x11')]()});}})['catch'](function(_0x3b522a){console[_0x6f03('0x19')](_0x3b522a);});}_0x1e24d9();}},'charset':_0x6f03('0x1a'),'collate':_0x6f03('0x1b')});}; \ No newline at end of file +var _0x4b96=['path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2f72d0,_0x8bee5a){var _0x57dc92=function(_0x2d03f2){while(--_0x2d03f2){_0x2f72d0['push'](_0x2f72d0['shift']());}};_0x57dc92(++_0x8bee5a);}(_0x4b96,0xba));var _0x64b9=function(_0x231281,_0x49e743){_0x231281=_0x231281-0x0;var _0x16dc2f=_0x4b96[_0x231281];return _0x16dc2f;};'use strict';var _=require(_0x64b9('0x0'));var util=require('util');var logger=require(_0x64b9('0x1'))(_0x64b9('0x2'));var moment=require(_0x64b9('0x3'));var BPromise=require(_0x64b9('0x4'));var rp=require(_0x64b9('0x5'));var fs=require('fs');var path=require(_0x64b9('0x6'));var rimraf=require(_0x64b9('0x7'));var config=require('../../config/environment');var attributes=require(_0x64b9('0x8'));module[_0x64b9('0x9')]=function(_0x2ee994,_0x1908e3){return _0x2ee994[_0x64b9('0xa')](_0x64b9('0xb'),attributes,{'tableName':_0x64b9('0xc'),'paranoid':![],'indexes':[{'name':_0x64b9('0xd'),'fields':[_0x64b9('0xe')],'type':_0x64b9('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd32dd6,_0x58d775,_0x4c2966){var _0x121e1a=_0x2ee994[_0x64b9('0x10')];var _0x4d8a7c=_0xd32dd6[_0x64b9('0x11')]({'plain':!![]});if(_0x4d8a7c[_0x64b9('0x12')]['toLowerCase']()==='in'||_0x4d8a7c[_0x64b9('0x12')][_0x64b9('0x13')]()===_0x64b9('0x14')&&!_0x4d8a7c[_0x64b9('0x15')]&&!_['isNil'](_0x4d8a7c[_0x64b9('0x16')])){_0x121e1a[_0x64b9('0x17')][_0x64b9('0x18')]({'where':{'id':_0x4d8a7c[_0x64b9('0x19')]}})[_0x64b9('0x1a')](function(_0x594a0b){if(_0x594a0b){_0x594a0b[_0x64b9('0x1b')]({'lastMsgAt':_0x4d8a7c[_0x64b9('0x1c')],'lastMsgDirection':_0x4d8a7c[_0x64b9('0x12')][_0x64b9('0x13')]()});}})[_0x64b9('0x1d')](function(_0xeb37c8){console[_0x64b9('0x1e')](_0xeb37c8);});}_0x4c2966();}},'charset':_0x64b9('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 5e0a4cf..abee49f 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['request\x20sent','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','update','body','attributes','limit','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x874709,_0x20b492){var _0x351b20=function(_0x87c907){while(--_0x87c907){_0x874709['push'](_0x874709['shift']());}};_0x351b20(++_0x20b492);}(_0x34e8,0x12c));var _0x834e=function(_0x2950c9,_0x562568){_0x2950c9=_0x2950c9-0x0;var _0x868a73=_0x34e8[_0x2950c9];return _0x868a73;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});config['redis']=_[_0x834e('0xc')](config[_0x834e('0xd')],{'host':_0x834e('0xe'),'port':0x18eb});var socket=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xd')]));require(_0x834e('0x10'))[_0x834e('0x11')](socket);function respondWithRpcPromise(_0x1af45a,_0x3bdda9,_0x186b3b){return new BPromise(function(_0x1e41fe,_0x36e124){return client[_0x834e('0x12')](_0x1af45a,_0x186b3b)[_0x834e('0x13')](function(_0x293514){logger[_0x834e('0x14')](_0x834e('0x15'),_0x3bdda9,'request\x20sent');logger[_0x834e('0x16')](_0x834e('0x17'),_0x3bdda9,'request\x20sent',JSON[_0x834e('0x18')](_0x293514));if(_0x293514[_0x834e('0x19')]){if(_0x293514[_0x834e('0x19')][_0x834e('0x1a')]===0x1f4){logger['error'](_0x834e('0x15'),_0x3bdda9,_0x293514[_0x834e('0x19')]['message']);return _0x36e124(_0x293514[_0x834e('0x19')]['message']);}logger[_0x834e('0x19')](_0x834e('0x15'),_0x3bdda9,_0x293514['error'][_0x834e('0x1b')]);return _0x1e41fe(_0x293514[_0x834e('0x19')][_0x834e('0x1b')]);}else{logger['info'](_0x834e('0x15'),_0x3bdda9,_0x834e('0x1c'));_0x1e41fe(_0x293514[_0x834e('0x1d')][_0x834e('0x1b')]);}})[_0x834e('0x1e')](function(_0x254677){logger[_0x834e('0x19')]('FaxMessage,\x20%s,\x20%s',_0x3bdda9,_0x254677);_0x36e124(_0x254677);});});}exports[_0x834e('0x1f')]=function(_0x1fd2c6){var _0x113ff4=this;return new Promise(function(_0x325a99,_0x4ab05d){return db[_0x834e('0x20')][_0x834e('0x21')](_0x1fd2c6['body'],{'raw':_0x1fd2c6[_0x834e('0x22')]?_0x1fd2c6[_0x834e('0x22')][_0x834e('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x4e3f48){logger[_0x834e('0x14')](_0x834e('0x1f'),_0x1fd2c6);logger['debug'](_0x834e('0x1f'),_0x1fd2c6,JSON[_0x834e('0x18')](_0x4e3f48));_0x325a99(_0x4e3f48);})['catch'](function(_0x3bc4f7){logger[_0x834e('0x19')](_0x834e('0x1f'),_0x3bc4f7['message'],_0x1fd2c6);_0x4ab05d(_0x113ff4[_0x834e('0x19')](0x1f4,_0x3bc4f7[_0x834e('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x5bef62){var _0x1e713a=this;return new Promise(function(_0x508a1d,_0x2826ec){return db[_0x834e('0x20')][_0x834e('0x24')](_0x5bef62[_0x834e('0x25')],{'raw':_0x5bef62[_0x834e('0x22')]?_0x5bef62[_0x834e('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bef62['options']?_0x5bef62['options']['where']||null:null,'attributes':_0x5bef62[_0x834e('0x22')]?_0x5bef62[_0x834e('0x22')][_0x834e('0x26')]||null:null,'limit':_0x5bef62['options']?_0x5bef62[_0x834e('0x22')][_0x834e('0x27')]||null:null})[_0x834e('0x13')](function(_0x1e026a){logger[_0x834e('0x14')](_0x834e('0x28'),_0x5bef62);logger[_0x834e('0x16')](_0x834e('0x28'),_0x5bef62,JSON[_0x834e('0x18')](_0x1e026a));_0x508a1d(_0x1e026a);})['catch'](function(_0xef9ec2){logger['error'](_0x834e('0x28'),_0xef9ec2[_0x834e('0x1b')],_0x5bef62);_0x2826ec(_0x1e713a[_0x834e('0x19')](0x1f4,_0xef9ec2[_0x834e('0x1b')]));});});}; \ No newline at end of file +var _0xbec5=['then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x3b9394,_0x108960){var _0x28e57b=function(_0x4e294d){while(--_0x4e294d){_0x3b9394['push'](_0x3b9394['shift']());}};_0x28e57b(++_0x108960);}(_0xbec5,0xe5));var _0x5bec=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0xbec5[_0x4ec13d];return _0x3c3fa7;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});config[_0x5bec('0xb')]=_[_0x5bec('0xc')](config[_0x5bec('0xb')],{'host':_0x5bec('0xd'),'port':0x18eb});var socket=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xb')]));require(_0x5bec('0xf'))['register'](socket);function respondWithRpcPromise(_0x41a827,_0x5c2d67,_0x748f75){return new BPromise(function(_0x2a70a7,_0x117162){return client['request'](_0x41a827,_0x748f75)[_0x5bec('0x10')](function(_0x18fa47){logger[_0x5bec('0x11')]('FaxMessage,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'));logger[_0x5bec('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'),JSON[_0x5bec('0x14')](_0x18fa47));if(_0x18fa47[_0x5bec('0x15')]){if(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x16')]===0x1f4){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);return _0x117162(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47['error']['message']);return _0x2a70a7(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}else{logger[_0x5bec('0x11')](_0x5bec('0x17'),_0x5c2d67,'request\x20sent');_0x2a70a7(_0x18fa47['result'][_0x5bec('0x18')]);}})[_0x5bec('0x19')](function(_0x4e0191){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x4e0191);_0x117162(_0x4e0191);});});}exports[_0x5bec('0x1a')]=function(_0x593786){var _0x554f9f=this;return new Promise(function(_0xab397b,_0x5be91c){return db[_0x5bec('0x1b')][_0x5bec('0x1c')](_0x593786[_0x5bec('0x1d')],{'raw':_0x593786[_0x5bec('0x1e')]?_0x593786[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5bec('0x10')](function(_0x4cfcb8){logger[_0x5bec('0x11')](_0x5bec('0x1a'),_0x593786);logger['debug'](_0x5bec('0x1a'),_0x593786,JSON[_0x5bec('0x14')](_0x4cfcb8));_0xab397b(_0x4cfcb8);})['catch'](function(_0x45afb7){logger[_0x5bec('0x15')](_0x5bec('0x1a'),_0x45afb7[_0x5bec('0x18')],_0x593786);_0x5be91c(_0x554f9f[_0x5bec('0x15')](0x1f4,_0x45afb7[_0x5bec('0x18')]));});});};exports[_0x5bec('0x1f')]=function(_0x4de66a){var _0x5b63ab=this;return new Promise(function(_0x5e44b3,_0x2961bd){return db[_0x5bec('0x1b')][_0x5bec('0x20')](_0x4de66a['body'],{'raw':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['where']||null:null,'attributes':_0x4de66a['options']?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x21')]||null:null,'limit':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x22')]||null:null})[_0x5bec('0x10')](function(_0x5d6621){logger[_0x5bec('0x11')]('UpdateFaxMessage',_0x4de66a);logger[_0x5bec('0x13')](_0x5bec('0x1f'),_0x4de66a,JSON[_0x5bec('0x14')](_0x5d6621));_0x5e44b3(_0x5d6621);})[_0x5bec('0x19')](function(_0x5128c0){logger[_0x5bec('0x15')](_0x5bec('0x1f'),_0x5128c0[_0x5bec('0x18')],_0x4de66a);_0x2961bd(_0x5b63ab['error'](0x1f4,_0x5128c0[_0x5bec('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 89d9edb..db64f6b 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf3b=['emit','register','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x3d9320,_0x5277f3){var _0x402bed=function(_0x2d01f1){while(--_0x2d01f1){_0x3d9320['push'](_0x3d9320['shift']());}};_0x402bed(++_0x5277f3);}(_0xaf3b,0x13c));var _0xbaf3=function(_0x395836,_0xc2b387){_0x395836=_0x395836-0x0;var _0x5cacf1=_0xaf3b[_0x395836];return _0x5cacf1;};'use strict';var FaxMessageEvents=require(_0xbaf3('0x0'));var events=[_0xbaf3('0x1'),_0xbaf3('0x2'),_0xbaf3('0x3')];function createListener(_0x41b32a,_0x1f241a){return function(_0x90b4fc){_0x1f241a[_0xbaf3('0x4')](_0x41b32a,_0x90b4fc);};}function removeListener(_0x15f3a4,_0x1b635a){return function(){FaxMessageEvents['removeListener'](_0x15f3a4,_0x1b635a);};}exports[_0xbaf3('0x5')]=function(_0x4b345f){for(var _0x192f54=0x0,_0x3c5c89=events[_0xbaf3('0x6')];_0x192f54<_0x3c5c89;_0x192f54++){var _0x2abce3=events[_0x192f54];var _0x27b366=createListener(_0xbaf3('0x7')+_0x2abce3,_0x4b345f);FaxMessageEvents['on'](_0x2abce3,_0x27b366);}}; \ No newline at end of file +var _0x4da3=['emit','removeListener','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x45bd9f,_0x23507b){var _0x160dc3=function(_0x2ecf3c){while(--_0x2ecf3c){_0x45bd9f['push'](_0x45bd9f['shift']());}};_0x160dc3(++_0x23507b);}(_0x4da3,0x1ac));var _0x34da=function(_0x1eaa70,_0x5abda1){_0x1eaa70=_0x1eaa70-0x0;var _0x20b6e9=_0x4da3[_0x1eaa70];return _0x20b6e9;};'use strict';var FaxMessageEvents=require(_0x34da('0x0'));var events=[_0x34da('0x1'),_0x34da('0x2'),_0x34da('0x3')];function createListener(_0x2780f5,_0x56b593){return function(_0x476d82){_0x56b593[_0x34da('0x4')](_0x2780f5,_0x476d82);};}function removeListener(_0x11c5fa,_0x56b381){return function(){FaxMessageEvents[_0x34da('0x5')](_0x11c5fa,_0x56b381);};}exports['register']=function(_0x382cbf){for(var _0x4e81ac=0x0,_0x596265=events[_0x34da('0x6')];_0x4e81ac<_0x596265;_0x4e81ac++){var _0x31f7b1=events[_0x4e81ac];var _0x4bb909=createListener(_0x34da('0x7')+_0x31f7b1,_0x382cbf);FaxMessageEvents['on'](_0x31f7b1,_0x4bb909);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f330552..3c7deb7 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb688=['accept','reject','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','fax','faxmessage:create','create','put','update','/:id/accept'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xb688,0xcf));var _0x8b68=function(_0x4d37cd,_0x319860){_0x4d37cd=_0x4d37cd-0x0;var _0x40f388=_0xb688[_0x4d37cd];return _0x40f388;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')]('/',auth[_0x8b68('0xc')](),interaction['tracked'](_0x8b68('0x13'),_0x8b68('0x14')),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')](_0x8b68('0x18'),auth['isAuthenticated'](),controller[_0x8b68('0x19')]);router['put']('/:id/reject',auth[_0x8b68('0xc')](),controller[_0x8b68('0x1a')]);router[_0x8b68('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x8b68('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xc788=['describe','/:id','show','post','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc788,0xc4));var _0x8c78=function(_0x3fd50c,_0x1b41ed){_0x3fd50c=_0x3fd50c-0x0;var _0x4cebb2=_0xc788[_0x3fd50c];return _0x4cebb2;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var fs_extra=require(_0x8c78('0x4'));var auth=require(_0x8c78('0x5'));var interaction=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var controller=require('./faxMessage.controller');router[_0x8c78('0x8')]('/',auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0x8')](_0x8c78('0xb'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0x8')](_0x8c78('0xd'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);router[_0x8c78('0x8')]('/:id/download',auth[_0x8c78('0x9')](),controller['download']);router[_0x8c78('0xf')]('/',auth[_0x8c78('0x9')](),interaction['tracked'](_0x8c78('0x10'),_0x8c78('0x11')),controller['create']);router[_0x8c78('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8c78('0x13')]);router[_0x8c78('0x12')](_0x8c78('0x14'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x15')]);router[_0x8c78('0x12')](_0x8c78('0x16'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x17')]);router[_0x8c78('0x18')]('/:id',auth[_0x8c78('0x9')](),controller[_0x8c78('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 5735c9e..ee24d88 100644 --- a/server/api/faxQueue/faxQueue.attributes.js +++ b/server/api/faxQueue/faxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d49=['name','STRING','INTEGER','ENUM','beepall','roundrobin','exports'];(function(_0xbe0d72,_0x5f0264){var _0x4601ca=function(_0x21c17f){while(--_0x21c17f){_0xbe0d72['push'](_0xbe0d72['shift']());}};_0x4601ca(++_0x5f0264);}(_0x0d49,0x19c));var _0x90d4=function(_0x20414a,_0x31a292){_0x20414a=_0x20414a-0x0;var _0x1a63db=_0x0d49[_0x20414a];return _0x1a63db;};'use strict';var Sequelize=require('sequelize');module[_0x90d4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x90d4('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x90d4('0x2')]},'timeout':{'type':Sequelize[_0x90d4('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x90d4('0x4')]('rrmemory',_0x90d4('0x5'),_0x90d4('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x90d4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb6e=['INTEGER','ENUM','rrmemory','beepall','exports','STRING','name'];(function(_0x3fe690,_0x4e4d40){var _0x2ffe41=function(_0x3db537){while(--_0x3db537){_0x3fe690['push'](_0x3fe690['shift']());}};_0x2ffe41(++_0x4e4d40);}(_0xfb6e,0x177));var _0xefb6=function(_0x5fc1ac,_0x422418){_0x5fc1ac=_0x5fc1ac-0x0;var _0xce7874=_0xfb6e[_0x5fc1ac];return _0xce7874;};'use strict';var Sequelize=require('sequelize');module[_0xefb6('0x0')]={'name':{'type':Sequelize[_0xefb6('0x1')],'unique':_0xefb6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xefb6('0x1')]},'timeout':{'type':Sequelize[_0xefb6('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xefb6('0x4')](_0xefb6('0x5'),_0xefb6('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xefb6('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index d4ae1dc..d417941 100644 --- a/server/api/faxQueue/faxQueue.controller.js +++ b/server/api/faxQueue/faxQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x944e=['create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','UserFaxQueue','FaxQueueId','User','findAndCountAll','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','nolimit','addTeams','ids','Team','findAll','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','FaxQueues','UserProfileResource','stack','name','index','map','FaxQueue','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','rows','show','params','keys','rawAttributes','find'];(function(_0x432e5e,_0x8b54b4){var _0x35f8d5=function(_0x5d806f){while(--_0x5d806f){_0x432e5e['push'](_0x432e5e['shift']());}};_0x35f8d5(++_0x8b54b4);}(_0x944e,0x163));var _0xe944=function(_0xcc29a2,_0x18b1cc){_0xcc29a2=_0xcc29a2-0x0;var _0x5c42a1=_0x944e[_0xcc29a2];return _0x5c42a1;};'use strict';var emlformat=require(_0xe944('0x0'));var rimraf=require(_0xe944('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe944('0x2'));var rp=require(_0xe944('0x3'));var moment=require(_0xe944('0x4'));var BPromise=require(_0xe944('0x5'));var Mustache=require('mustache');var util=require(_0xe944('0x6'));var path=require(_0xe944('0x7'));var sox=require('sox');var csv=require(_0xe944('0x8'));var ejs=require(_0xe944('0x9'));var fs=require('fs');var fs_extra=require(_0xe944('0xa'));var _=require(_0xe944('0xb'));var squel=require('squel');var crypto=require(_0xe944('0xc'));var jsforce=require(_0xe944('0xd'));var deskjs=require(_0xe944('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe944('0xf'));var Papa=require(_0xe944('0x10'));var Redis=require(_0xe944('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe944('0x12'));var as=require(_0xe944('0x13'));var hardwareService=require(_0xe944('0x14'));var logger=require(_0xe944('0x15'))(_0xe944('0x16'));var utils=require('../../config/utils');var config=require(_0xe944('0x17'));var licenseUtil=require(_0xe944('0x18'));var db=require(_0xe944('0x19'))['db'];config[_0xe944('0x1a')]=_[_0xe944('0x1b')](config[_0xe944('0x1a')],{'host':_0xe944('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe944('0x1a')]));require(_0xe944('0x1d'))[_0xe944('0x1e')](socket);function respondWithStatusCode(_0xfcf7b7,_0x43d8ee){_0x43d8ee=_0x43d8ee||0xcc;return function(_0x520527){if(_0x520527){return _0xfcf7b7[_0xe944('0x1f')](_0x43d8ee);}return _0xfcf7b7[_0xe944('0x20')](_0x43d8ee)[_0xe944('0x21')]();};}function respondWithResult(_0xb3f17,_0x89aa31){_0x89aa31=_0x89aa31||0xc8;return function(_0x1b9eb4){if(_0x1b9eb4){return _0xb3f17['status'](_0x89aa31)[_0xe944('0x22')](_0x1b9eb4);}};}function respondWithFilteredResult(_0x33e69a,_0x483b33){return function(_0x167ea3){if(_0x167ea3){var _0x3b7c6a=typeof _0x483b33[_0xe944('0x23')]===_0xe944('0x24')&&typeof _0x483b33[_0xe944('0x25')]===_0xe944('0x24');var _0x1ccf37=_0x167ea3[_0xe944('0x26')];var _0x3c6c8c=_0x3b7c6a?0x0:_0x483b33[_0xe944('0x23')];var _0x398678=_0x3b7c6a?_0x167ea3['count']:_0x483b33['offset']+_0x483b33[_0xe944('0x25')];var _0x158f64;if(_0x398678>=_0x1ccf37){_0x398678=_0x1ccf37;_0x158f64=0xc8;}else{_0x158f64=0xce;}_0x33e69a[_0xe944('0x20')](_0x158f64);return _0x33e69a[_0xe944('0x27')](_0xe944('0x28'),_0x3c6c8c+'-'+_0x398678+'/'+_0x1ccf37)[_0xe944('0x22')](_0x167ea3);}return null;};}function patchUpdates(_0x391a45){return function(_0x8ea4d8){try{jsonpatch[_0xe944('0x29')](_0x8ea4d8,_0x391a45,!![]);}catch(_0x48822d){return BPromise[_0xe944('0x2a')](_0x48822d);}return _0x8ea4d8[_0xe944('0x2b')]();};}function saveUpdates(_0x2fa763,_0x33edef){return function(_0x8240a){if(_0x8240a){return _0x8240a[_0xe944('0x2c')](_0x2fa763)[_0xe944('0x2d')](function(_0x3475fa){return _0x3475fa;});}return null;};}function removeEntity(_0x4930ef,_0x4425c8){return function(_0x3c58da){if(_0x3c58da){return _0x3c58da[_0xe944('0x2e')]()['then'](function(){var _0x4aab99=_0x3c58da['get']({'plain':!![]});var _0xc79fd3=_0xe944('0x2f');return db[_0xe944('0x30')]['destroy']({'where':{'type':_0xc79fd3,'resourceId':_0x4aab99['id']}})[_0xe944('0x2d')](function(){return _0x3c58da;});})[_0xe944('0x2d')](function(){_0x4930ef[_0xe944('0x20')](0xcc)[_0xe944('0x21')]();});}};}function handleEntityNotFound(_0x542f37,_0x32cc72){return function(_0x3d8a9c){if(!_0x3d8a9c){_0x542f37[_0xe944('0x1f')](0x194);}return _0x3d8a9c;};}function handleError(_0x17d694,_0x5e74da){_0x5e74da=_0x5e74da||0x1f4;return function(_0x54ad27){logger['error'](_0x54ad27[_0xe944('0x31')]);if(_0x54ad27[_0xe944('0x32')]){delete _0x54ad27[_0xe944('0x32')];}_0x17d694['status'](_0x5e74da)['send'](_0x54ad27);};}exports[_0xe944('0x33')]=function(_0x437106,_0x10eb69){var _0x29a2c9={},_0x230b12={},_0x4b7343={'count':0x0,'rows':[]};var _0x1e20d3=_[_0xe944('0x34')](db[_0xe944('0x35')]['rawAttributes'],function(_0x3403c1){return{'name':_0x3403c1[_0xe944('0x36')],'type':_0x3403c1[_0xe944('0x37')][_0xe944('0x38')]};});_0x230b12[_0xe944('0x39')]=_[_0xe944('0x34')](_0x1e20d3,_0xe944('0x32'));_0x230b12[_0xe944('0x3a')]=_['keys'](_0x437106[_0xe944('0x3a')]);_0x230b12[_0xe944('0x3b')]=_[_0xe944('0x3c')](_0x230b12[_0xe944('0x39')],_0x230b12[_0xe944('0x3a')]);_0x29a2c9['attributes']=_['intersection'](_0x230b12[_0xe944('0x39')],qs[_0xe944('0x3d')](_0x437106[_0xe944('0x3a')][_0xe944('0x3d')]));_0x29a2c9[_0xe944('0x3e')]=_0x29a2c9[_0xe944('0x3e')][_0xe944('0x3f')]?_0x29a2c9[_0xe944('0x3e')]:_0x230b12[_0xe944('0x39')];if(!_0x437106[_0xe944('0x3a')][_0xe944('0x40')]('nolimit')){_0x29a2c9[_0xe944('0x25')]=qs[_0xe944('0x25')](_0x437106['query'][_0xe944('0x25')]);_0x29a2c9[_0xe944('0x23')]=qs[_0xe944('0x23')](_0x437106[_0xe944('0x3a')][_0xe944('0x23')]);}_0x29a2c9[_0xe944('0x41')]=qs[_0xe944('0x42')](_0x437106[_0xe944('0x3a')][_0xe944('0x42')]);_0x29a2c9['where']=qs[_0xe944('0x3b')](_[_0xe944('0x43')](_0x437106[_0xe944('0x3a')],_0x230b12[_0xe944('0x3b')]),_0x1e20d3);if(_0x437106[_0xe944('0x3a')][_0xe944('0x44')]){_0x29a2c9[_0xe944('0x45')]=_[_0xe944('0x46')](_0x29a2c9[_0xe944('0x45')],{'$or':_[_0xe944('0x34')](_0x1e20d3,function(_0x579802){if(_0x579802['type']!=='VIRTUAL'){var _0xe5cf66={};_0xe5cf66[_0x579802[_0xe944('0x32')]]={'$like':'%'+_0x437106[_0xe944('0x3a')]['filter']+'%'};return _0xe5cf66;}})});}_0x29a2c9=_[_0xe944('0x46')]({},_0x29a2c9,_0x437106[_0xe944('0x47')]);var _0x6d6fd3={'where':_0x29a2c9[_0xe944('0x45')]};return db[_0xe944('0x35')][_0xe944('0x26')](_0x6d6fd3)['then'](function(_0x5dc1a1){_0x4b7343[_0xe944('0x26')]=_0x5dc1a1;if(_0x437106[_0xe944('0x3a')][_0xe944('0x48')]){_0x29a2c9[_0xe944('0x49')]=[{'all':!![]}];}return db[_0xe944('0x35')]['findAll'](_0x29a2c9);})['then'](function(_0x230dad){_0x4b7343[_0xe944('0x4a')]=_0x230dad;return _0x4b7343;})[_0xe944('0x2d')](respondWithFilteredResult(_0x10eb69,_0x29a2c9))['catch'](handleError(_0x10eb69,null));};exports[_0xe944('0x4b')]=function(_0x5e6df7,_0x19f4f7){var _0x4c6f5a={'raw':!![],'where':{'id':_0x5e6df7[_0xe944('0x4c')]['id']}},_0x27ebda={};_0x27ebda['model']=_[_0xe944('0x4d')](db[_0xe944('0x35')][_0xe944('0x4e')]);_0x27ebda[_0xe944('0x3a')]=_[_0xe944('0x4d')](_0x5e6df7[_0xe944('0x3a')]);_0x27ebda['filters']=_[_0xe944('0x3c')](_0x27ebda[_0xe944('0x39')],_0x27ebda[_0xe944('0x3a')]);_0x4c6f5a[_0xe944('0x3e')]=_[_0xe944('0x3c')](_0x27ebda[_0xe944('0x39')],qs[_0xe944('0x3d')](_0x5e6df7['query'][_0xe944('0x3d')]));_0x4c6f5a['attributes']=_0x4c6f5a[_0xe944('0x3e')][_0xe944('0x3f')]?_0x4c6f5a[_0xe944('0x3e')]:_0x27ebda[_0xe944('0x39')];if(_0x5e6df7[_0xe944('0x3a')][_0xe944('0x48')]){_0x4c6f5a[_0xe944('0x49')]=[{'all':!![]}];}_0x4c6f5a=_[_0xe944('0x46')]({},_0x4c6f5a,_0x5e6df7[_0xe944('0x47')]);return db['FaxQueue'][_0xe944('0x4f')](_0x4c6f5a)[_0xe944('0x2d')](handleEntityNotFound(_0x19f4f7,null))[_0xe944('0x2d')](respondWithResult(_0x19f4f7,null))['catch'](handleError(_0x19f4f7,null));};exports['create']=function(_0x51a954,_0x2beeca){return db['FaxQueue'][_0xe944('0x50')](_0x51a954[_0xe944('0x51')],{})[_0xe944('0x2d')](function(_0x355700){var _0x51e3f3=_0x51a954[_0xe944('0x52')][_0xe944('0x53')]({'plain':!![]});if(!_0x51e3f3)throw new Error(_0xe944('0x54'));if(_0x51e3f3[_0xe944('0x55')]===_0xe944('0x52')){var _0x4b9d11=_0x355700[_0xe944('0x53')]({'plain':!![]});var _0x278715='FaxQueues';return db['UserProfileSection'][_0xe944('0x4f')]({'where':{'name':_0x278715,'userProfileId':_0x51e3f3[_0xe944('0x56')]},'raw':!![]})[_0xe944('0x2d')](function(_0x2df2d0){if(_0x2df2d0&&_0x2df2d0['autoAssociation']===0x0){return db[_0xe944('0x30')][_0xe944('0x50')]({'name':_0x4b9d11[_0xe944('0x32')],'resourceId':_0x4b9d11['id'],'type':_0x2df2d0[_0xe944('0x32')],'sectionId':_0x2df2d0['id']},{})['then'](function(){return _0x355700;});}else{return _0x355700;}})[_0xe944('0x57')](function(_0x3d85f3){logger[_0xe944('0x58')](_0xe944('0x59'),_0x3d85f3);throw _0x3d85f3;});}return _0x355700;})['then'](respondWithResult(_0x2beeca,0xc9))[_0xe944('0x57')](handleError(_0x2beeca,null));};exports['update']=function(_0x21eac4,_0x1adb45){if(_0x21eac4[_0xe944('0x51')]['id']){delete _0x21eac4[_0xe944('0x51')]['id'];}return db[_0xe944('0x35')][_0xe944('0x4f')]({'where':{'id':_0x21eac4[_0xe944('0x4c')]['id']}})[_0xe944('0x2d')](handleEntityNotFound(_0x1adb45,null))[_0xe944('0x2d')](saveUpdates(_0x21eac4[_0xe944('0x51')],null))['then'](respondWithResult(_0x1adb45,null))[_0xe944('0x57')](handleError(_0x1adb45,null));};exports['destroy']=function(_0x2bd086,_0x510510){return db[_0xe944('0x35')][_0xe944('0x4f')]({'where':{'id':_0x2bd086[_0xe944('0x4c')]['id']}})[_0xe944('0x2d')](handleEntityNotFound(_0x510510,null))[_0xe944('0x2d')](removeEntity(_0x510510,null))[_0xe944('0x57')](handleError(_0x510510,null));};exports['describe']=function(_0xf11c7b,_0x3ed0c4){return db[_0xe944('0x35')]['describe']()[_0xe944('0x2d')](respondWithResult(_0x3ed0c4,null))['catch'](handleError(_0x3ed0c4,null));};exports['getMembers']=function(_0xa29452,_0x572b39,_0x9c030b){var _0x5c0345={'raw':!![],'where':{}},_0x1ce846={},_0x4c5b73;return db[_0xe944('0x35')]['findOne']({'where':{'id':_0xa29452[_0xe944('0x4c')]['id']}})[_0xe944('0x2d')](handleEntityNotFound(_0x572b39,null))[_0xe944('0x2d')](function(_0x215e0f){if(_0x215e0f){_0x4c5b73=_0x215e0f[_0xe944('0x53')]({'plain':!![]});_0x1ce846['model']=_[_0xe944('0x4d')](db[_0xe944('0x5a')][_0xe944('0x4e')]);_0x1ce846[_0xe944('0x3a')]=_['keys'](_0xa29452[_0xe944('0x3a')]);_0x1ce846[_0xe944('0x3b')]=_[_0xe944('0x3c')](_0x1ce846[_0xe944('0x39')],_0x1ce846[_0xe944('0x3a')]);_0x5c0345[_0xe944('0x3e')]=_['intersection'](_0x1ce846[_0xe944('0x39')],qs[_0xe944('0x3d')](_0xa29452[_0xe944('0x3a')]['fields']));_0x5c0345['attributes']=_0x5c0345[_0xe944('0x3e')][_0xe944('0x3f')]?_0x5c0345[_0xe944('0x3e')]:_0x1ce846['model'];if(!_0xa29452['query'][_0xe944('0x40')]('nolimit')){_0x5c0345[_0xe944('0x25')]=qs['limit'](_0xa29452[_0xe944('0x3a')][_0xe944('0x25')]);_0x5c0345['offset']=qs[_0xe944('0x23')](_0xa29452['query']['offset']);}_0x5c0345[_0xe944('0x41')]=qs[_0xe944('0x42')](_0xa29452['query'][_0xe944('0x42')]);_0x5c0345[_0xe944('0x45')]=qs[_0xe944('0x3b')](_[_0xe944('0x43')](_0xa29452['query'],_0x1ce846[_0xe944('0x3b')]));_0x5c0345['where'][_0xe944('0x5b')]=_0x215e0f['id'];if(_0xa29452[_0xe944('0x3a')][_0xe944('0x44')]){_0x5c0345[_0xe944('0x45')]=_[_0xe944('0x46')](_0x5c0345[_0xe944('0x45')],{'$or':_[_0xe944('0x34')](_0x5c0345['attributes'],function(_0x2d01af){var _0x60fa1e={};_0x60fa1e[_0x2d01af]={'$like':'%'+_0xa29452[_0xe944('0x3a')]['filter']+'%'};return _0x60fa1e;})});}_0x5c0345=_['merge']({},_0x5c0345,_0xa29452[_0xe944('0x47')]);return db['UserFaxQueue']['findAll'](_0x5c0345);}})['then'](function(_0x1e2ff4){if(_0x1e2ff4){return db[_0xe944('0x5c')][_0xe944('0x5d')]({'where':{'id':_[_0xe944('0x34')](_0x1e2ff4,'UserId'),'role':_0xe944('0x5e')},'attributes':['id',_0xe944('0x32'),_0xe944('0x5f'),_0xe944('0x60'),_0xe944('0x61')]});}})['then'](function(_0x281d59){if(_0x281d59){return{'count':_0x281d59[_0xe944('0x26')],'rows':_[_0xe944('0x34')](_0x281d59[_0xe944('0x4a')],function(_0x3da493){return{'membername':_0x3da493['name'],'UserId':_0x3da493['id'],'queue_name':_0x4c5b73[_0xe944('0x32')],'FaxQueueId':_0x4c5b73['id'],'interface':util['format'](_0xe944('0x62'),_0xe944('0x63'),_0x3da493[_0xe944('0x32')]),'penalty':0x0,'paused':_0x3da493[_0xe944('0x5f')],'createdAt':_0x3da493[_0xe944('0x61')],'updatedAt':_0x3da493[_0xe944('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x572b39,_0x5c0345))[_0xe944('0x57')](handleError(_0x572b39,null));};exports[_0xe944('0x64')]=function(_0x487ae5,_0x45f452,_0x4ed352){var _0x1618ef={};var _0x47ad0d={};var _0x37dc0c;var _0x15f5af;return db[_0xe944('0x35')][_0xe944('0x65')]({'where':{'id':_0x487ae5[_0xe944('0x4c')]['id']}})[_0xe944('0x2d')](handleEntityNotFound(_0x45f452,null))[_0xe944('0x2d')](function(_0x323d09){if(_0x323d09){_0x37dc0c=_0x323d09;_0x47ad0d[_0xe944('0x39')]=_[_0xe944('0x4d')](db['Team'][_0xe944('0x4e')]);_0x47ad0d['query']=_[_0xe944('0x4d')](_0x487ae5[_0xe944('0x3a')]);_0x47ad0d[_0xe944('0x3b')]=_[_0xe944('0x3c')](_0x47ad0d[_0xe944('0x39')],_0x47ad0d[_0xe944('0x3a')]);_0x1618ef[_0xe944('0x3e')]=_[_0xe944('0x3c')](_0x47ad0d['model'],qs[_0xe944('0x3d')](_0x487ae5['query'][_0xe944('0x3d')]));_0x1618ef[_0xe944('0x3e')]=_0x1618ef[_0xe944('0x3e')][_0xe944('0x3f')]?_0x1618ef[_0xe944('0x3e')]:_0x47ad0d[_0xe944('0x39')];_0x1618ef[_0xe944('0x41')]=qs[_0xe944('0x42')](_0x487ae5[_0xe944('0x3a')]['sort']);_0x1618ef[_0xe944('0x45')]=qs['filters'](_[_0xe944('0x43')](_0x487ae5[_0xe944('0x3a')],_0x47ad0d['filters']));if(_0x487ae5[_0xe944('0x3a')][_0xe944('0x44')]){_0x1618ef['where']=_[_0xe944('0x46')](_0x1618ef['where'],{'$or':_[_0xe944('0x34')](_0x1618ef['attributes'],function(_0x4f7b27){var _0x2c99d7={};_0x2c99d7[_0x4f7b27]={'$like':'%'+_0x487ae5[_0xe944('0x3a')][_0xe944('0x44')]+'%'};return _0x2c99d7;})});}_0x1618ef=_[_0xe944('0x46')]({},_0x1618ef,_0x487ae5[_0xe944('0x47')]);return _0x37dc0c[_0xe944('0x64')](_0x1618ef);}})[_0xe944('0x2d')](function(_0x45441a){if(_0x45441a){_0x15f5af=_0x45441a[_0xe944('0x3f')];if(!_0x487ae5[_0xe944('0x3a')][_0xe944('0x40')](_0xe944('0x66'))){_0x1618ef[_0xe944('0x25')]=qs['limit'](_0x487ae5[_0xe944('0x3a')][_0xe944('0x25')]);_0x1618ef['offset']=qs['offset'](_0x487ae5[_0xe944('0x3a')][_0xe944('0x23')]);}return _0x37dc0c[_0xe944('0x64')](_0x1618ef);}})[_0xe944('0x2d')](function(_0x34842b){if(_0x34842b){return _0x34842b?{'count':_0x15f5af,'rows':_0x34842b}:null;}})['then'](respondWithResult(_0x45f452,null))[_0xe944('0x57')](handleError(_0x45f452,null));};exports[_0xe944('0x67')]=function(_0x1d15f1,_0x403385,_0x5b7201){var _0x570d9d=_0x1d15f1['body'][_0xe944('0x68')];return db[_0xe944('0x69')][_0xe944('0x6a')]({'where':{'id':_0x570d9d},'attributes':['id'],'include':[{'model':db[_0xe944('0x5c')],'as':_0xe944('0x6b'),'attributes':['id',_0xe944('0x32'),_0xe944('0x6c'),_0xe944('0x6d'),_0xe944('0x6e')],'raw':!![]}]})[_0xe944('0x2d')](function(_0x455d7b){if(_0x455d7b){var _0x1c74c8=_[_0xe944('0x6f')](_0x455d7b,function(_0x288d96){var _0x18016b=_0x288d96[_0xe944('0x53')]({'plain':!![]});return _0x18016b[_0xe944('0x6b')];});return db[_0xe944('0x35')][_0xe944('0x4f')]({'where':{'id':_0x1d15f1['params']['id']}})[_0xe944('0x2d')](function(_0x2bfe82){return db[_0xe944('0x70')]['transaction'](function(_0x3aa22f){return _0x2bfe82[_0xe944('0x67')](_0x570d9d,{'transaction':_0x3aa22f})[_0xe944('0x2d')](function(){return BPromise[_0xe944('0x71')](_0x1c74c8,function(_0x2dbc24){return db[_0xe944('0x5a')][_0xe944('0x72')]({'where':{'UserId':_0x2dbc24['id'],'FaxQueueId':_0x1d15f1[_0xe944('0x4c')]['id']},'transaction':_0x3aa22f});});})[_0xe944('0x2d')](function(){_0x1c74c8[_0xe944('0x73')](function(_0x42de8b){socket['emit'](_0xe944('0x74'),{'UserId':_0x42de8b['id'],'FaxQueueId':_0x2bfe82['id']});});});});});}})[_0xe944('0x2d')](respondWithStatusCode(_0x403385,null))['catch'](handleError(_0x403385,null));};exports[_0xe944('0x75')]=function(_0x4a80fe,_0x3ba6a3,_0x43e203){return db[_0xe944('0x69')][_0xe944('0x6a')]({'where':{'id':_0x4a80fe['query'][_0xe944('0x68')]},'attributes':['id'],'include':[{'model':db[_0xe944('0x5c')],'as':_0xe944('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xe944('0x2d')](handleEntityNotFound(_0x3ba6a3,null))[_0xe944('0x2d')](function(_0x263253){var _0x4e38be=_[_0xe944('0x34')](_0x263253,'id');var _0x11f027=[];var _0x71b6a=[];var _0x39cd42=squel[_0xe944('0x76')]();_0x39cd42[_0xe944('0x77')](_0xe944('0x78'))[_0xe944('0x79')](_0xe944('0x7a'),'tq')[_0xe944('0x7b')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xe944('0x7c'),_0x4a80fe[_0xe944('0x4c')]['id']);for(var _0x5afaac=0x0;_0x5afaac<_0x263253[_0xe944('0x3f')];_0x5afaac+=0x1){let _0xbb6d0=_0x263253[_0x5afaac];for(var _0x31a696=0x0;_0x31a696<_0xbb6d0[_0xe944('0x6b')][_0xe944('0x3f')];_0x31a696+=0x1){let _0x45e53a=_0xbb6d0[_0xe944('0x6b')][_0x31a696];var _0x180a87=_0x39cd42[_0xe944('0x7d')]();_0x180a87[_0xe944('0x45')](_0xe944('0x7e'),_0x45e53a['id']);_0x71b6a[_0xe944('0x7f')](db[_0xe944('0x70')][_0xe944('0x3a')](_0x180a87[_0xe944('0x80')](),{'type':db['sequelize'][_0xe944('0x81')][_0xe944('0x82')]})['then'](function(_0x1ba092){if(_0x1ba092[_0xe944('0x3f')]===0x1){return _0x45e53a['id'];}else{var _0x3e61de=_['every'](_[_0xe944('0x34')](_0x1ba092,_0xe944('0x83')),function(_0x461f4b){return _[_0xe944('0x84')](_0x4e38be,_0x461f4b);});if(_0x3e61de){return _0x45e53a['id'];}}}));}}return BPromise[_0xe944('0x85')](_0x71b6a)[_0xe944('0x2d')](function(_0x435c80){_0x11f027=_(_0x11f027)[_0xe944('0x86')](_0x435c80)['compact']()[_0xe944('0x87')]();return db[_0xe944('0x35')][_0xe944('0x4f')]({'where':{'id':_0x4a80fe[_0xe944('0x4c')]['id']}})[_0xe944('0x2d')](function(_0x4845b8){return db[_0xe944('0x70')][_0xe944('0x88')](function(_0x38f3ba){return _0x4845b8[_0xe944('0x75')](_0x4a80fe[_0xe944('0x3a')][_0xe944('0x68')],{'transaction':_0x38f3ba})[_0xe944('0x2d')](function(){if(!_[_0xe944('0x89')](_0x11f027)){return _0x4845b8[_0xe944('0x8a')](_0x11f027,{'transaction':_0x38f3ba});}})[_0xe944('0x2d')](function(){_0x11f027[_0xe944('0x73')](function(_0x2a6436){socket[_0xe944('0x8b')](_0xe944('0x8c'),{'UserId':_0x2a6436,'FaxQueueId':_0x4845b8['id']});});});});});});})['then'](respondWithStatusCode(_0x3ba6a3,null))['catch'](handleError(_0x3ba6a3,null));};exports[_0xe944('0x8d')]=function(_0x397864,_0x49f466,_0xea1d72){return db[_0xe944('0x35')][_0xe944('0x4f')]({'where':{'id':_0x397864[_0xe944('0x4c')]['id']}})['then'](handleEntityNotFound(_0x49f466,null))[_0xe944('0x2d')](function(_0x477278){if(_0x477278){return _0x477278[_0xe944('0x8d')](_0x397864[_0xe944('0x51')][_0xe944('0x68')],_[_0xe944('0x8e')](_0x397864[_0xe944('0x51')],[_0xe944('0x68'),'id'])||{})['spread'](function(_0x5862f0){for(var _0x3b18f7=0x0;_0x3b18f7<_0x397864['body'][_0xe944('0x68')]['length'];_0x3b18f7+=0x1){socket['emit'](_0xe944('0x74'),{'UserId':Number(_0x397864[_0xe944('0x51')][_0xe944('0x68')][_0x3b18f7]),'FaxQueueId':Number(_0x397864[_0xe944('0x4c')]['id'])});}return _0x5862f0;});}})[_0xe944('0x2d')](respondWithResult(_0x49f466,null))[_0xe944('0x57')](handleError(_0x49f466,null));};exports[_0xe944('0x8a')]=function(_0x2bcf61,_0x5523a6,_0x246004){return db[_0xe944('0x35')][_0xe944('0x4f')]({'where':{'id':_0x2bcf61['params']['id']}})[_0xe944('0x2d')](handleEntityNotFound(_0x5523a6,null))[_0xe944('0x2d')](function(_0x5da547){if(_0x5da547){return _0x5da547[_0xe944('0x8a')](_0x2bcf61[_0xe944('0x3a')][_0xe944('0x68')])['then'](function(){if(_[_0xe944('0x8f')](_0x2bcf61[_0xe944('0x3a')][_0xe944('0x68')])){for(var _0x287e80=0x0;_0x287e80<_0x2bcf61[_0xe944('0x3a')][_0xe944('0x68')][_0xe944('0x3f')];_0x287e80+=0x1){socket[_0xe944('0x8b')](_0xe944('0x8c'),{'UserId':Number(_0x2bcf61[_0xe944('0x3a')]['ids'][_0x287e80]),'FaxQueueId':Number(_0x2bcf61[_0xe944('0x4c')]['id'])});}}else{socket[_0xe944('0x8b')](_0xe944('0x8c'),{'UserId':Number(_0x2bcf61[_0xe944('0x3a')]['ids']),'FaxQueueId':Number(_0x2bcf61[_0xe944('0x4c')]['id'])});}});}})[_0xe944('0x2d')](respondWithStatusCode(_0x5523a6,null))[_0xe944('0x57')](handleError(_0x5523a6,null));};exports['getAgents']=function(_0x1199df,_0x63317b,_0x1d2837){var _0x1586af={};var _0x3cae23={};var _0x1b9665;var _0x2bd9d8;return db[_0xe944('0x35')][_0xe944('0x65')]({'where':{'id':_0x1199df[_0xe944('0x4c')]['id']}})[_0xe944('0x2d')](handleEntityNotFound(_0x63317b,null))[_0xe944('0x2d')](function(_0x1d0b55){if(_0x1d0b55){_0x1b9665=_0x1d0b55;_0x3cae23[_0xe944('0x39')]=_[_0xe944('0x4d')](db['User']['rawAttributes']);_0x3cae23[_0xe944('0x3a')]=_[_0xe944('0x4d')](_0x1199df[_0xe944('0x3a')]);_0x3cae23[_0xe944('0x3b')]=_[_0xe944('0x3c')](_0x3cae23['model'],_0x3cae23[_0xe944('0x3a')]);_0x1586af[_0xe944('0x3e')]=_[_0xe944('0x3c')](_0x3cae23['model'],qs[_0xe944('0x3d')](_0x1199df['query'][_0xe944('0x3d')]));_0x1586af[_0xe944('0x3e')]=_0x1586af[_0xe944('0x3e')]['length']?_0x1586af[_0xe944('0x3e')]:_0x3cae23[_0xe944('0x39')];_0x1586af['order']=qs[_0xe944('0x42')](_0x1199df[_0xe944('0x3a')][_0xe944('0x42')]);_0x1586af[_0xe944('0x45')]=qs[_0xe944('0x3b')](_[_0xe944('0x43')](_0x1199df[_0xe944('0x3a')],_0x3cae23['filters']));if(_0x1199df[_0xe944('0x3a')][_0xe944('0x44')]){_0x1586af[_0xe944('0x45')]=_['merge'](_0x1586af[_0xe944('0x45')],{'$or':_[_0xe944('0x34')](_0x1586af['attributes'],function(_0x1cc8f8){var _0x2c82d4={};_0x2c82d4[_0x1cc8f8]={'$like':'%'+_0x1199df[_0xe944('0x3a')][_0xe944('0x44')]+'%'};return _0x2c82d4;})});}_0x1586af=_[_0xe944('0x46')]({},_0x1586af,_0x1199df[_0xe944('0x47')]);return _0x1b9665[_0xe944('0x90')](_0x1586af);}})[_0xe944('0x2d')](function(_0x3671d7){if(_0x3671d7){_0x2bd9d8=_0x3671d7['length'];if(!_0x1199df[_0xe944('0x3a')]['hasOwnProperty'](_0xe944('0x66'))){_0x1586af[_0xe944('0x25')]=qs[_0xe944('0x25')](_0x1199df[_0xe944('0x3a')][_0xe944('0x25')]);_0x1586af[_0xe944('0x23')]=qs[_0xe944('0x23')](_0x1199df['query']['offset']);}return _0x1b9665[_0xe944('0x90')](_0x1586af);}})[_0xe944('0x2d')](function(_0x384a7b){if(_0x384a7b){return _0x384a7b?{'count':_0x2bd9d8,'rows':_0x384a7b}:null;}})[_0xe944('0x2d')](respondWithResult(_0x63317b,null))[_0xe944('0x57')](handleError(_0x63317b,null));}; \ No newline at end of file +var _0x6c74=['userFaxQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','FaxQueue','rawAttributes','type','key','model','filters','query','intersection','fields','attributes','length','nolimit','sort','filter','where','options','include','findAll','rows','catch','show','params','keys','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','UserFaxQueue','hasOwnProperty','order','pick','FaxQueueId','User','UserId','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','compact','omit','spread','userFaxQueue:save','removeAgents','isArray'];(function(_0x25069c,_0x592c87){var _0x11eaec=function(_0x36d717){while(--_0x36d717){_0x25069c['push'](_0x25069c['shift']());}};_0x11eaec(++_0x592c87);}(_0x6c74,0x10a));var _0x46c7=function(_0x401298,_0x75d2c){_0x401298=_0x401298-0x0;var _0x52dd05=_0x6c74[_0x401298];return _0x52dd05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x46c7('0x0'));var rp=require(_0x46c7('0x1'));var moment=require(_0x46c7('0x2'));var BPromise=require(_0x46c7('0x3'));var Mustache=require('mustache');var util=require(_0x46c7('0x4'));var path=require(_0x46c7('0x5'));var sox=require('sox');var csv=require(_0x46c7('0x6'));var ejs=require(_0x46c7('0x7'));var fs=require('fs');var fs_extra=require(_0x46c7('0x8'));var _=require(_0x46c7('0x9'));var squel=require(_0x46c7('0xa'));var crypto=require('crypto');var jsforce=require(_0x46c7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x46c7('0x6'));var querystring=require(_0x46c7('0xc'));var Papa=require('papaparse');var Redis=require(_0x46c7('0xd'));var authService=require(_0x46c7('0xe'));var qs=require(_0x46c7('0xf'));var as=require(_0x46c7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46c7('0x11'))(_0x46c7('0x12'));var utils=require(_0x46c7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x46c7('0x14'));var db=require(_0x46c7('0x15'))['db'];config[_0x46c7('0x16')]=_[_0x46c7('0x17')](config[_0x46c7('0x16')],{'host':_0x46c7('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x46c7('0x16')]));require('./faxQueue.socket')[_0x46c7('0x19')](socket);function respondWithStatusCode(_0x13eca2,_0x10af8f){_0x10af8f=_0x10af8f||0xcc;return function(_0x4ecf5c){if(_0x4ecf5c){return _0x13eca2[_0x46c7('0x1a')](_0x10af8f);}return _0x13eca2['status'](_0x10af8f)[_0x46c7('0x1b')]();};}function respondWithResult(_0xbfb3b7,_0x2adca7){_0x2adca7=_0x2adca7||0xc8;return function(_0x5859af){if(_0x5859af){return _0xbfb3b7[_0x46c7('0x1c')](_0x2adca7)[_0x46c7('0x1d')](_0x5859af);}};}function respondWithFilteredResult(_0x8546f6,_0x14ef0c){return function(_0x5ece33){if(_0x5ece33){var _0x1c7762=typeof _0x14ef0c[_0x46c7('0x1e')]===_0x46c7('0x1f')&&typeof _0x14ef0c[_0x46c7('0x20')]===_0x46c7('0x1f');var _0x2f4f15=_0x5ece33[_0x46c7('0x21')];var _0x3f7054=_0x1c7762?0x0:_0x14ef0c['offset'];var _0x59487a=_0x1c7762?_0x5ece33[_0x46c7('0x21')]:_0x14ef0c[_0x46c7('0x1e')]+_0x14ef0c[_0x46c7('0x20')];var _0x1ee726;if(_0x59487a>=_0x2f4f15){_0x59487a=_0x2f4f15;_0x1ee726=0xc8;}else{_0x1ee726=0xce;}_0x8546f6[_0x46c7('0x1c')](_0x1ee726);return _0x8546f6[_0x46c7('0x22')](_0x46c7('0x23'),_0x3f7054+'-'+_0x59487a+'/'+_0x2f4f15)[_0x46c7('0x1d')](_0x5ece33);}return null;};}function patchUpdates(_0x1e2974){return function(_0x5826e4){try{jsonpatch[_0x46c7('0x24')](_0x5826e4,_0x1e2974,!![]);}catch(_0x30da90){return BPromise[_0x46c7('0x25')](_0x30da90);}return _0x5826e4['save']();};}function saveUpdates(_0x3cf1f3,_0x38fc92){return function(_0x2ae214){if(_0x2ae214){return _0x2ae214[_0x46c7('0x26')](_0x3cf1f3)[_0x46c7('0x27')](function(_0x1cf64f){return _0x1cf64f;});}return null;};}function removeEntity(_0x46064a,_0x15a916){return function(_0x1b0f5f){if(_0x1b0f5f){return _0x1b0f5f[_0x46c7('0x28')]()[_0x46c7('0x27')](function(){var _0x1d5b6f=_0x1b0f5f[_0x46c7('0x29')]({'plain':!![]});var _0xdec61e='FaxQueues';return db[_0x46c7('0x2a')]['destroy']({'where':{'type':_0xdec61e,'resourceId':_0x1d5b6f['id']}})[_0x46c7('0x27')](function(){return _0x1b0f5f;});})['then'](function(){_0x46064a[_0x46c7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aabf5,_0x546ffd){return function(_0x3aaebd){if(!_0x3aaebd){_0x3aabf5[_0x46c7('0x1a')](0x194);}return _0x3aaebd;};}function handleError(_0x1ccd67,_0x249516){_0x249516=_0x249516||0x1f4;return function(_0x51db9b){logger['error'](_0x51db9b[_0x46c7('0x2b')]);if(_0x51db9b[_0x46c7('0x2c')]){delete _0x51db9b[_0x46c7('0x2c')];}_0x1ccd67[_0x46c7('0x1c')](_0x249516)[_0x46c7('0x2d')](_0x51db9b);};}exports[_0x46c7('0x2e')]=function(_0x3cba20,_0x29dd09){var _0x419eb8={},_0x536839={},_0x16bd3b={'count':0x0,'rows':[]};var _0x1c65eb=_[_0x46c7('0x2f')](db[_0x46c7('0x30')][_0x46c7('0x31')],function(_0x1d44e8){return{'name':_0x1d44e8['fieldName'],'type':_0x1d44e8[_0x46c7('0x32')][_0x46c7('0x33')]};});_0x536839[_0x46c7('0x34')]=_[_0x46c7('0x2f')](_0x1c65eb,_0x46c7('0x2c'));_0x536839['query']=_['keys'](_0x3cba20['query']);_0x536839[_0x46c7('0x35')]=_['intersection'](_0x536839[_0x46c7('0x34')],_0x536839[_0x46c7('0x36')]);_0x419eb8['attributes']=_[_0x46c7('0x37')](_0x536839['model'],qs[_0x46c7('0x38')](_0x3cba20['query'][_0x46c7('0x38')]));_0x419eb8['attributes']=_0x419eb8[_0x46c7('0x39')][_0x46c7('0x3a')]?_0x419eb8[_0x46c7('0x39')]:_0x536839[_0x46c7('0x34')];if(!_0x3cba20[_0x46c7('0x36')]['hasOwnProperty'](_0x46c7('0x3b'))){_0x419eb8[_0x46c7('0x20')]=qs[_0x46c7('0x20')](_0x3cba20[_0x46c7('0x36')][_0x46c7('0x20')]);_0x419eb8[_0x46c7('0x1e')]=qs['offset'](_0x3cba20[_0x46c7('0x36')][_0x46c7('0x1e')]);}_0x419eb8['order']=qs[_0x46c7('0x3c')](_0x3cba20[_0x46c7('0x36')]['sort']);_0x419eb8['where']=qs[_0x46c7('0x35')](_['pick'](_0x3cba20[_0x46c7('0x36')],_0x536839[_0x46c7('0x35')]),_0x1c65eb);if(_0x3cba20[_0x46c7('0x36')][_0x46c7('0x3d')]){_0x419eb8['where']=_['merge'](_0x419eb8[_0x46c7('0x3e')],{'$or':_[_0x46c7('0x2f')](_0x1c65eb,function(_0x2b684a){if(_0x2b684a[_0x46c7('0x32')]!=='VIRTUAL'){var _0x3dc682={};_0x3dc682[_0x2b684a[_0x46c7('0x2c')]]={'$like':'%'+_0x3cba20['query'][_0x46c7('0x3d')]+'%'};return _0x3dc682;}})});}_0x419eb8=_['merge']({},_0x419eb8,_0x3cba20[_0x46c7('0x3f')]);var _0x4508fb={'where':_0x419eb8['where']};return db[_0x46c7('0x30')]['count'](_0x4508fb)[_0x46c7('0x27')](function(_0xa2c9a9){_0x16bd3b[_0x46c7('0x21')]=_0xa2c9a9;if(_0x3cba20[_0x46c7('0x36')]['includeAll']){_0x419eb8[_0x46c7('0x40')]=[{'all':!![]}];}return db[_0x46c7('0x30')][_0x46c7('0x41')](_0x419eb8);})['then'](function(_0x3b0651){_0x16bd3b[_0x46c7('0x42')]=_0x3b0651;return _0x16bd3b;})[_0x46c7('0x27')](respondWithFilteredResult(_0x29dd09,_0x419eb8))[_0x46c7('0x43')](handleError(_0x29dd09,null));};exports[_0x46c7('0x44')]=function(_0x1838a4,_0x50e85e){var _0x23a891={'raw':!![],'where':{'id':_0x1838a4[_0x46c7('0x45')]['id']}},_0x3364ef={};_0x3364ef[_0x46c7('0x34')]=_[_0x46c7('0x46')](db[_0x46c7('0x30')][_0x46c7('0x31')]);_0x3364ef['query']=_['keys'](_0x1838a4['query']);_0x3364ef['filters']=_['intersection'](_0x3364ef[_0x46c7('0x34')],_0x3364ef[_0x46c7('0x36')]);_0x23a891[_0x46c7('0x39')]=_[_0x46c7('0x37')](_0x3364ef['model'],qs[_0x46c7('0x38')](_0x1838a4[_0x46c7('0x36')]['fields']));_0x23a891['attributes']=_0x23a891[_0x46c7('0x39')]['length']?_0x23a891[_0x46c7('0x39')]:_0x3364ef[_0x46c7('0x34')];if(_0x1838a4[_0x46c7('0x36')][_0x46c7('0x47')]){_0x23a891['include']=[{'all':!![]}];}_0x23a891=_[_0x46c7('0x48')]({},_0x23a891,_0x1838a4['options']);return db[_0x46c7('0x30')][_0x46c7('0x49')](_0x23a891)[_0x46c7('0x27')](handleEntityNotFound(_0x50e85e,null))[_0x46c7('0x27')](respondWithResult(_0x50e85e,null))[_0x46c7('0x43')](handleError(_0x50e85e,null));};exports[_0x46c7('0x4a')]=function(_0x1c70a9,_0x283b05){return db[_0x46c7('0x30')][_0x46c7('0x4a')](_0x1c70a9[_0x46c7('0x4b')],{})['then'](function(_0x109d45){var _0x3a9e6d=_0x1c70a9[_0x46c7('0x4c')][_0x46c7('0x29')]({'plain':!![]});if(!_0x3a9e6d)throw new Error(_0x46c7('0x4d'));if(_0x3a9e6d[_0x46c7('0x4e')]===_0x46c7('0x4c')){var _0x407fb9=_0x109d45[_0x46c7('0x29')]({'plain':!![]});var _0x43b36c=_0x46c7('0x4f');return db[_0x46c7('0x50')][_0x46c7('0x49')]({'where':{'name':_0x43b36c,'userProfileId':_0x3a9e6d['userProfileId']},'raw':!![]})[_0x46c7('0x27')](function(_0x498c7b){if(_0x498c7b&&_0x498c7b[_0x46c7('0x51')]===0x0){return db[_0x46c7('0x2a')][_0x46c7('0x4a')]({'name':_0x407fb9[_0x46c7('0x2c')],'resourceId':_0x407fb9['id'],'type':_0x498c7b[_0x46c7('0x2c')],'sectionId':_0x498c7b['id']},{})[_0x46c7('0x27')](function(){return _0x109d45;});}else{return _0x109d45;}})[_0x46c7('0x43')](function(_0x34a528){logger['error'](_0x46c7('0x52'),_0x34a528);throw _0x34a528;});}return _0x109d45;})['then'](respondWithResult(_0x283b05,0xc9))['catch'](handleError(_0x283b05,null));};exports['update']=function(_0x5e09e7,_0x200375){if(_0x5e09e7[_0x46c7('0x4b')]['id']){delete _0x5e09e7[_0x46c7('0x4b')]['id'];}return db['FaxQueue'][_0x46c7('0x49')]({'where':{'id':_0x5e09e7[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x200375,null))[_0x46c7('0x27')](saveUpdates(_0x5e09e7[_0x46c7('0x4b')],null))[_0x46c7('0x27')](respondWithResult(_0x200375,null))[_0x46c7('0x43')](handleError(_0x200375,null));};exports[_0x46c7('0x28')]=function(_0x69e324,_0x181c2e){return db[_0x46c7('0x30')]['find']({'where':{'id':_0x69e324['params']['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x181c2e,null))['then'](removeEntity(_0x181c2e,null))['catch'](handleError(_0x181c2e,null));};exports['describe']=function(_0x2e0157,_0x393dfe){return db[_0x46c7('0x30')]['describe']()[_0x46c7('0x27')](respondWithResult(_0x393dfe,null))['catch'](handleError(_0x393dfe,null));};exports['getMembers']=function(_0x5d3087,_0x45af78,_0x38ebf9){var _0x3383e9={'raw':!![],'where':{}},_0x41f980={},_0x35a493;return db[_0x46c7('0x30')][_0x46c7('0x53')]({'where':{'id':_0x5d3087[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x45af78,null))[_0x46c7('0x27')](function(_0x4216b0){if(_0x4216b0){_0x35a493=_0x4216b0[_0x46c7('0x29')]({'plain':!![]});_0x41f980[_0x46c7('0x34')]=_[_0x46c7('0x46')](db[_0x46c7('0x54')]['rawAttributes']);_0x41f980[_0x46c7('0x36')]=_[_0x46c7('0x46')](_0x5d3087[_0x46c7('0x36')]);_0x41f980[_0x46c7('0x35')]=_[_0x46c7('0x37')](_0x41f980[_0x46c7('0x34')],_0x41f980[_0x46c7('0x36')]);_0x3383e9[_0x46c7('0x39')]=_[_0x46c7('0x37')](_0x41f980[_0x46c7('0x34')],qs[_0x46c7('0x38')](_0x5d3087[_0x46c7('0x36')]['fields']));_0x3383e9['attributes']=_0x3383e9['attributes'][_0x46c7('0x3a')]?_0x3383e9[_0x46c7('0x39')]:_0x41f980['model'];if(!_0x5d3087[_0x46c7('0x36')][_0x46c7('0x55')]('nolimit')){_0x3383e9[_0x46c7('0x20')]=qs[_0x46c7('0x20')](_0x5d3087['query'][_0x46c7('0x20')]);_0x3383e9[_0x46c7('0x1e')]=qs[_0x46c7('0x1e')](_0x5d3087[_0x46c7('0x36')][_0x46c7('0x1e')]);}_0x3383e9[_0x46c7('0x56')]=qs[_0x46c7('0x3c')](_0x5d3087[_0x46c7('0x36')][_0x46c7('0x3c')]);_0x3383e9['where']=qs['filters'](_[_0x46c7('0x57')](_0x5d3087['query'],_0x41f980['filters']));_0x3383e9[_0x46c7('0x3e')][_0x46c7('0x58')]=_0x4216b0['id'];if(_0x5d3087[_0x46c7('0x36')][_0x46c7('0x3d')]){_0x3383e9[_0x46c7('0x3e')]=_[_0x46c7('0x48')](_0x3383e9[_0x46c7('0x3e')],{'$or':_[_0x46c7('0x2f')](_0x3383e9[_0x46c7('0x39')],function(_0x3b70b8){var _0x3f5f0a={};_0x3f5f0a[_0x3b70b8]={'$like':'%'+_0x5d3087[_0x46c7('0x36')][_0x46c7('0x3d')]+'%'};return _0x3f5f0a;})});}_0x3383e9=_[_0x46c7('0x48')]({},_0x3383e9,_0x5d3087[_0x46c7('0x3f')]);return db['UserFaxQueue'][_0x46c7('0x41')](_0x3383e9);}})['then'](function(_0x8bd0f4){if(_0x8bd0f4){return db[_0x46c7('0x59')]['findAndCountAll']({'where':{'id':_[_0x46c7('0x2f')](_0x8bd0f4,_0x46c7('0x5a')),'role':'agent'},'attributes':['id',_0x46c7('0x2c'),_0x46c7('0x5b'),_0x46c7('0x5c'),_0x46c7('0x5d')]});}})[_0x46c7('0x27')](function(_0x2a405d){if(_0x2a405d){return{'count':_0x2a405d[_0x46c7('0x21')],'rows':_[_0x46c7('0x2f')](_0x2a405d['rows'],function(_0x36558d){return{'membername':_0x36558d[_0x46c7('0x2c')],'UserId':_0x36558d['id'],'queue_name':_0x35a493[_0x46c7('0x2c')],'FaxQueueId':_0x35a493['id'],'interface':util['format'](_0x46c7('0x5e'),_0x46c7('0x5f'),_0x36558d[_0x46c7('0x2c')]),'penalty':0x0,'paused':_0x36558d[_0x46c7('0x5b')],'createdAt':_0x36558d[_0x46c7('0x5d')],'updatedAt':_0x36558d[_0x46c7('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x45af78,_0x3383e9))['catch'](handleError(_0x45af78,null));};exports['getTeams']=function(_0x21c0ca,_0xf0f4cf,_0x2a84dc){var _0x137334={};var _0x1e7825={};var _0x50e3de;var _0x762f4c;return db[_0x46c7('0x30')][_0x46c7('0x53')]({'where':{'id':_0x21c0ca[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0xf0f4cf,null))['then'](function(_0x46fb39){if(_0x46fb39){_0x50e3de=_0x46fb39;_0x1e7825[_0x46c7('0x34')]=_['keys'](db['Team'][_0x46c7('0x31')]);_0x1e7825[_0x46c7('0x36')]=_[_0x46c7('0x46')](_0x21c0ca['query']);_0x1e7825['filters']=_[_0x46c7('0x37')](_0x1e7825[_0x46c7('0x34')],_0x1e7825[_0x46c7('0x36')]);_0x137334[_0x46c7('0x39')]=_[_0x46c7('0x37')](_0x1e7825['model'],qs[_0x46c7('0x38')](_0x21c0ca[_0x46c7('0x36')][_0x46c7('0x38')]));_0x137334[_0x46c7('0x39')]=_0x137334[_0x46c7('0x39')][_0x46c7('0x3a')]?_0x137334[_0x46c7('0x39')]:_0x1e7825[_0x46c7('0x34')];_0x137334['order']=qs[_0x46c7('0x3c')](_0x21c0ca['query'][_0x46c7('0x3c')]);_0x137334['where']=qs[_0x46c7('0x35')](_[_0x46c7('0x57')](_0x21c0ca['query'],_0x1e7825['filters']));if(_0x21c0ca[_0x46c7('0x36')][_0x46c7('0x3d')]){_0x137334['where']=_[_0x46c7('0x48')](_0x137334[_0x46c7('0x3e')],{'$or':_[_0x46c7('0x2f')](_0x137334['attributes'],function(_0x297c22){var _0x597c40={};_0x597c40[_0x297c22]={'$like':'%'+_0x21c0ca[_0x46c7('0x36')][_0x46c7('0x3d')]+'%'};return _0x597c40;})});}_0x137334=_[_0x46c7('0x48')]({},_0x137334,_0x21c0ca[_0x46c7('0x3f')]);return _0x50e3de[_0x46c7('0x60')](_0x137334);}})[_0x46c7('0x27')](function(_0x12434f){if(_0x12434f){_0x762f4c=_0x12434f[_0x46c7('0x3a')];if(!_0x21c0ca[_0x46c7('0x36')][_0x46c7('0x55')](_0x46c7('0x3b'))){_0x137334[_0x46c7('0x20')]=qs[_0x46c7('0x20')](_0x21c0ca[_0x46c7('0x36')][_0x46c7('0x20')]);_0x137334[_0x46c7('0x1e')]=qs[_0x46c7('0x1e')](_0x21c0ca[_0x46c7('0x36')]['offset']);}return _0x50e3de[_0x46c7('0x60')](_0x137334);}})['then'](function(_0x47b22c){if(_0x47b22c){return _0x47b22c?{'count':_0x762f4c,'rows':_0x47b22c}:null;}})[_0x46c7('0x27')](respondWithResult(_0xf0f4cf,null))['catch'](handleError(_0xf0f4cf,null));};exports[_0x46c7('0x61')]=function(_0xce2d54,_0x1b5a92,_0x1d9195){var _0x45278b=_0xce2d54[_0x46c7('0x4b')][_0x46c7('0x62')];return db[_0x46c7('0x63')][_0x46c7('0x41')]({'where':{'id':_0x45278b},'attributes':['id'],'include':[{'model':db[_0x46c7('0x59')],'as':_0x46c7('0x64'),'attributes':['id',_0x46c7('0x2c'),_0x46c7('0x65'),_0x46c7('0x66'),'interface'],'raw':!![]}]})[_0x46c7('0x27')](function(_0xa18c70){if(_0xa18c70){var _0x244919=_[_0x46c7('0x67')](_0xa18c70,function(_0x299c23){var _0x1fe338=_0x299c23[_0x46c7('0x29')]({'plain':!![]});return _0x1fe338['Agents'];});return db['FaxQueue'][_0x46c7('0x49')]({'where':{'id':_0xce2d54[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](function(_0x1d3e5b){return db[_0x46c7('0x68')][_0x46c7('0x69')](function(_0x52f387){return _0x1d3e5b[_0x46c7('0x61')](_0x45278b,{'transaction':_0x52f387})[_0x46c7('0x27')](function(){return BPromise[_0x46c7('0x6a')](_0x244919,function(_0x10dedc){return db[_0x46c7('0x54')][_0x46c7('0x6b')]({'where':{'UserId':_0x10dedc['id'],'FaxQueueId':_0xce2d54['params']['id']},'transaction':_0x52f387});});})[_0x46c7('0x27')](function(){_0x244919[_0x46c7('0x6c')](function(_0x3d7d0e){socket[_0x46c7('0x6d')]('userFaxQueue:save',{'UserId':_0x3d7d0e['id'],'FaxQueueId':_0x1d3e5b['id']});});});});});}})[_0x46c7('0x27')](respondWithStatusCode(_0x1b5a92,null))[_0x46c7('0x43')](handleError(_0x1b5a92,null));};exports[_0x46c7('0x6e')]=function(_0x197bba,_0x32838d,_0x4145d7){return db[_0x46c7('0x63')][_0x46c7('0x41')]({'where':{'id':_0x197bba[_0x46c7('0x36')][_0x46c7('0x62')]},'attributes':['id'],'include':[{'model':db[_0x46c7('0x59')],'as':_0x46c7('0x64'),'attributes':['id'],'raw':!![]}]})[_0x46c7('0x27')](handleEntityNotFound(_0x32838d,null))[_0x46c7('0x27')](function(_0x1917ea){var _0x1d4b61=_['map'](_0x1917ea,'id');var _0x39c38a=[];var _0x4fb8b2=[];var _0x1be3c8=squel[_0x46c7('0x6f')]();_0x1be3c8[_0x46c7('0x70')](_0x46c7('0x71'))['from'](_0x46c7('0x72'),'tq')[_0x46c7('0x73')](_0x46c7('0x74'),'ut',_0x46c7('0x75'))['where']('FaxQueueId\x20=\x20?',_0x197bba[_0x46c7('0x45')]['id']);for(var _0x1b0205=0x0;_0x1b0205<_0x1917ea[_0x46c7('0x3a')];_0x1b0205+=0x1){let _0x3080ed=_0x1917ea[_0x1b0205];for(var _0x53230e=0x0;_0x53230e<_0x3080ed['Agents'][_0x46c7('0x3a')];_0x53230e+=0x1){let _0x3e2fea=_0x3080ed[_0x46c7('0x64')][_0x53230e];var _0x3a3d2a=_0x1be3c8['clone']();_0x3a3d2a[_0x46c7('0x3e')](_0x46c7('0x76'),_0x3e2fea['id']);_0x4fb8b2['push'](db[_0x46c7('0x68')][_0x46c7('0x36')](_0x3a3d2a['toString'](),{'type':db['sequelize'][_0x46c7('0x77')][_0x46c7('0x78')]})['then'](function(_0x567a47){if(_0x567a47[_0x46c7('0x3a')]===0x1){return _0x3e2fea['id'];}else{var _0x594be5=_[_0x46c7('0x79')](_[_0x46c7('0x2f')](_0x567a47,_0x46c7('0x7a')),function(_0x58febc){return _[_0x46c7('0x7b')](_0x1d4b61,_0x58febc);});if(_0x594be5){return _0x3e2fea['id'];}}}));}}return BPromise['all'](_0x4fb8b2)['then'](function(_0x4b8701){_0x39c38a=_(_0x39c38a)['union'](_0x4b8701)[_0x46c7('0x7c')]()['value']();return db[_0x46c7('0x30')][_0x46c7('0x49')]({'where':{'id':_0x197bba[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](function(_0x15446b){return db[_0x46c7('0x68')][_0x46c7('0x69')](function(_0xb849ec){return _0x15446b[_0x46c7('0x6e')](_0x197bba[_0x46c7('0x36')][_0x46c7('0x62')],{'transaction':_0xb849ec})['then'](function(){if(!_['isEmpty'](_0x39c38a)){return _0x15446b['removeAgents'](_0x39c38a,{'transaction':_0xb849ec});}})[_0x46c7('0x27')](function(){_0x39c38a[_0x46c7('0x6c')](function(_0x533e32){socket[_0x46c7('0x6d')]('userFaxQueue:remove',{'UserId':_0x533e32,'FaxQueueId':_0x15446b['id']});});});});});});})[_0x46c7('0x27')](respondWithStatusCode(_0x32838d,null))[_0x46c7('0x43')](handleError(_0x32838d,null));};exports['addAgents']=function(_0x368ab9,_0x157295,_0x581d1e){return db[_0x46c7('0x30')][_0x46c7('0x49')]({'where':{'id':_0x368ab9[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x157295,null))[_0x46c7('0x27')](function(_0x3a3b8f){if(_0x3a3b8f){return _0x3a3b8f['addAgents'](_0x368ab9[_0x46c7('0x4b')][_0x46c7('0x62')],_[_0x46c7('0x7d')](_0x368ab9['body'],[_0x46c7('0x62'),'id'])||{})[_0x46c7('0x7e')](function(_0x3dd582){for(var _0x35a70e=0x0;_0x35a70e<_0x368ab9[_0x46c7('0x4b')][_0x46c7('0x62')][_0x46c7('0x3a')];_0x35a70e+=0x1){socket[_0x46c7('0x6d')](_0x46c7('0x7f'),{'UserId':Number(_0x368ab9[_0x46c7('0x4b')]['ids'][_0x35a70e]),'FaxQueueId':Number(_0x368ab9[_0x46c7('0x45')]['id'])});}return _0x3dd582;});}})['then'](respondWithResult(_0x157295,null))[_0x46c7('0x43')](handleError(_0x157295,null));};exports[_0x46c7('0x80')]=function(_0x2960a5,_0x5a3056,_0x4d68ef){return db[_0x46c7('0x30')][_0x46c7('0x49')]({'where':{'id':_0x2960a5['params']['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x5a3056,null))[_0x46c7('0x27')](function(_0x4935cb){if(_0x4935cb){return _0x4935cb[_0x46c7('0x80')](_0x2960a5[_0x46c7('0x36')][_0x46c7('0x62')])[_0x46c7('0x27')](function(){if(_[_0x46c7('0x81')](_0x2960a5[_0x46c7('0x36')][_0x46c7('0x62')])){for(var _0xb908f5=0x0;_0xb908f5<_0x2960a5[_0x46c7('0x36')][_0x46c7('0x62')][_0x46c7('0x3a')];_0xb908f5+=0x1){socket[_0x46c7('0x6d')](_0x46c7('0x82'),{'UserId':Number(_0x2960a5[_0x46c7('0x36')][_0x46c7('0x62')][_0xb908f5]),'FaxQueueId':Number(_0x2960a5[_0x46c7('0x45')]['id'])});}}else{socket[_0x46c7('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x2960a5[_0x46c7('0x36')][_0x46c7('0x62')]),'FaxQueueId':Number(_0x2960a5[_0x46c7('0x45')]['id'])});}});}})[_0x46c7('0x27')](respondWithStatusCode(_0x5a3056,null))[_0x46c7('0x43')](handleError(_0x5a3056,null));};exports['getAgents']=function(_0x3d0ce7,_0x3614de,_0x282bbe){var _0x3ae3c6={};var _0x24053a={};var _0x23996e;var _0x387e0a;return db[_0x46c7('0x30')][_0x46c7('0x53')]({'where':{'id':_0x3d0ce7[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x3614de,null))[_0x46c7('0x27')](function(_0x1c1053){if(_0x1c1053){_0x23996e=_0x1c1053;_0x24053a[_0x46c7('0x34')]=_[_0x46c7('0x46')](db['User'][_0x46c7('0x31')]);_0x24053a[_0x46c7('0x36')]=_[_0x46c7('0x46')](_0x3d0ce7[_0x46c7('0x36')]);_0x24053a[_0x46c7('0x35')]=_[_0x46c7('0x37')](_0x24053a[_0x46c7('0x34')],_0x24053a['query']);_0x3ae3c6[_0x46c7('0x39')]=_[_0x46c7('0x37')](_0x24053a['model'],qs[_0x46c7('0x38')](_0x3d0ce7['query'][_0x46c7('0x38')]));_0x3ae3c6[_0x46c7('0x39')]=_0x3ae3c6[_0x46c7('0x39')][_0x46c7('0x3a')]?_0x3ae3c6[_0x46c7('0x39')]:_0x24053a[_0x46c7('0x34')];_0x3ae3c6[_0x46c7('0x56')]=qs[_0x46c7('0x3c')](_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x3c')]);_0x3ae3c6[_0x46c7('0x3e')]=qs[_0x46c7('0x35')](_[_0x46c7('0x57')](_0x3d0ce7[_0x46c7('0x36')],_0x24053a[_0x46c7('0x35')]));if(_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x3d')]){_0x3ae3c6[_0x46c7('0x3e')]=_[_0x46c7('0x48')](_0x3ae3c6[_0x46c7('0x3e')],{'$or':_['map'](_0x3ae3c6[_0x46c7('0x39')],function(_0x591280){var _0x1ac5c2={};_0x1ac5c2[_0x591280]={'$like':'%'+_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x3d')]+'%'};return _0x1ac5c2;})});}_0x3ae3c6=_[_0x46c7('0x48')]({},_0x3ae3c6,_0x3d0ce7['options']);return _0x23996e[_0x46c7('0x83')](_0x3ae3c6);}})[_0x46c7('0x27')](function(_0x49d5d4){if(_0x49d5d4){_0x387e0a=_0x49d5d4['length'];if(!_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x55')](_0x46c7('0x3b'))){_0x3ae3c6[_0x46c7('0x20')]=qs[_0x46c7('0x20')](_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x20')]);_0x3ae3c6[_0x46c7('0x1e')]=qs['offset'](_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x1e')]);}return _0x23996e[_0x46c7('0x83')](_0x3ae3c6);}})[_0x46c7('0x27')](function(_0xb755cf){if(_0xb755cf){return _0xb755cf?{'count':_0x387e0a,'rows':_0xb755cf}:null;}})['then'](respondWithResult(_0x3614de,null))[_0x46c7('0x43')](handleError(_0x3614de,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 3f455ae..965f0fd 100644 --- a/server/api/faxQueue/faxQueue.events.js +++ b/server/api/faxQueue/faxQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38be=['save','update','remove','hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x38be,0x16e));var _0xe38b=function(_0xd544f5,_0x4f1c9e){_0xd544f5=_0xd544f5-0x0;var _0xde170e=_0x38be[_0xd544f5];return _0xde170e;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xe38b('0x0'))['db'][_0xe38b('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xe38b('0x2')](0x0);var events={'afterCreate':_0xe38b('0x3'),'afterUpdate':_0xe38b('0x4'),'afterDestroy':_0xe38b('0x5')};function emitEvent(_0x196365){return function(_0x4c4906,_0x4290af,_0x3fbfba){FaxQueueEvents['emit'](_0x196365+':'+_0x4c4906['id'],_0x4c4906);FaxQueueEvents['emit'](_0x196365,_0x4c4906);_0x3fbfba(null);};}for(var e in events){if(events[_0xe38b('0x6')](e)){var event=events[e];FaxQueue[_0xe38b('0x7')](e,emitEvent(event));}}module[_0xe38b('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x3482=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x3482,0x192));var _0x2348=function(_0x2d8d12,_0x5ec696){_0x2d8d12=_0x2d8d12-0x0;var _0x3c2473=_0x3482[_0x2d8d12];return _0x3c2473;};'use strict';var EventEmitter=require(_0x2348('0x0'));var FaxQueue=require(_0x2348('0x1'))['db'][_0x2348('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2348('0x3')](0x0);var events={'afterCreate':_0x2348('0x4'),'afterUpdate':_0x2348('0x5'),'afterDestroy':_0x2348('0x6')};function emitEvent(_0x15eb3b){return function(_0xd5366b,_0x5947e0,_0x48f4cb){FaxQueueEvents[_0x2348('0x7')](_0x15eb3b+':'+_0xd5366b['id'],_0xd5366b);FaxQueueEvents['emit'](_0x15eb3b,_0xd5366b);_0x48f4cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x2348('0x8')](e,emitEvent(event));}}module[_0x2348('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 6e17a7a..10124cb 100644 --- a/server/api/faxQueue/faxQueue.model.js +++ b/server/api/faxQueue/faxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cb9=['moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','lodash','../../config/logger'];(function(_0xfc9240,_0x3e0b64){var _0x3c71be=function(_0x510a33){while(--_0x510a33){_0xfc9240['push'](_0xfc9240['shift']());}};_0x3c71be(++_0x3e0b64);}(_0x2cb9,0x130));var _0x92cb=function(_0x5e0a52,_0x39b8e1){_0x5e0a52=_0x5e0a52-0x0;var _0x342148=_0x2cb9[_0x5e0a52];return _0x342148;};'use strict';var _=require(_0x92cb('0x0'));var util=require('util');var logger=require(_0x92cb('0x1'))('api');var moment=require(_0x92cb('0x2'));var BPromise=require(_0x92cb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92cb('0x4'));var rimraf=require(_0x92cb('0x5'));var config=require(_0x92cb('0x6'));var attributes=require(_0x92cb('0x7'));module[_0x92cb('0x8')]=function(_0x149f19,_0x12cb5c){return _0x149f19['define']('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fc4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x6fc4,0xdd));var _0x46fc=function(_0x25fef3,_0x2238b0){_0x25fef3=_0x25fef3-0x0;var _0x5d9ea1=_0x6fc4[_0x25fef3];return _0x5d9ea1;};'use strict';var _=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var logger=require(_0x46fc('0x2'))(_0x46fc('0x3'));var moment=require(_0x46fc('0x4'));var BPromise=require(_0x46fc('0x5'));var rp=require(_0x46fc('0x6'));var fs=require('fs');var path=require(_0x46fc('0x7'));var rimraf=require(_0x46fc('0x8'));var config=require(_0x46fc('0x9'));var attributes=require(_0x46fc('0xa'));module[_0x46fc('0xb')]=function(_0x3fce43,_0x5d6bfd){return _0x3fce43[_0x46fc('0xc')](_0x46fc('0xd'),attributes,{'tableName':_0x46fc('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 57ac359..590f3e4 100644 --- a/server/api/faxQueue/faxQueue.rpc.js +++ b/server/api/faxQueue/faxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb78f=['stringify','find','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetFaxQueue','raw','options','where','attributes','include','map','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb78f,0xc1));var _0xfb78=function(_0x453e51,_0x13102e){_0x453e51=_0x453e51-0x0;var _0x150787=_0xb78f[_0x453e51];return _0x150787;};'use strict';var _=require(_0xfb78('0x0'));var util=require(_0xfb78('0x1'));var moment=require(_0xfb78('0x2'));var BPromise=require(_0xfb78('0x3'));var rs=require(_0xfb78('0x4'));var fs=require('fs');var Redis=require(_0xfb78('0x5'));var db=require(_0xfb78('0x6'))['db'];var utils=require(_0xfb78('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xfb78('0x8'));var jayson=require(_0xfb78('0x9'));var client=jayson[_0xfb78('0xa')][_0xfb78('0xb')]({'port':0x232a});config[_0xfb78('0xc')]=_[_0xfb78('0xd')](config['redis'],{'host':_0xfb78('0xe'),'port':0x18eb});var socket=require(_0xfb78('0xf'))(new Redis(config['redis']));require(_0xfb78('0x10'))[_0xfb78('0x11')](socket);function respondWithRpcPromise(_0x41da64,_0x37123c,_0x3ac866){return new BPromise(function(_0x339911,_0x167d67){return client[_0xfb78('0x12')](_0x41da64,_0x3ac866)['then'](function(_0x999dbc){logger[_0xfb78('0x13')](_0xfb78('0x14'),_0x37123c,_0xfb78('0x15'));logger[_0xfb78('0x16')](_0xfb78('0x17'),_0x37123c,_0xfb78('0x15'),JSON['stringify'](_0x999dbc));if(_0x999dbc[_0xfb78('0x18')]){if(_0x999dbc[_0xfb78('0x18')]['code']===0x1f4){logger[_0xfb78('0x18')](_0xfb78('0x14'),_0x37123c,_0x999dbc[_0xfb78('0x18')][_0xfb78('0x19')]);return _0x167d67(_0x999dbc['error'][_0xfb78('0x19')]);}logger[_0xfb78('0x18')]('FaxQueue,\x20%s,\x20%s',_0x37123c,_0x999dbc[_0xfb78('0x18')]['message']);return _0x339911(_0x999dbc[_0xfb78('0x18')][_0xfb78('0x19')]);}else{logger[_0xfb78('0x13')](_0xfb78('0x14'),_0x37123c,'request\x20sent');_0x339911(_0x999dbc['result']['message']);}})[_0xfb78('0x1a')](function(_0x485cfb){logger[_0xfb78('0x18')](_0xfb78('0x14'),_0x37123c,_0x485cfb);_0x167d67(_0x485cfb);});});}exports[_0xfb78('0x1b')]=function(_0x2ab6f9){var _0x2064d2=this;return new Promise(function(_0x37555c,_0x303bc0){return db['FaxQueue']['findAll']({'raw':_0x2ab6f9['options']?_0x2ab6f9['options'][_0xfb78('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ab6f9[_0xfb78('0x1d')]?_0x2ab6f9[_0xfb78('0x1d')][_0xfb78('0x1e')]||null:null,'attributes':_0x2ab6f9[_0xfb78('0x1d')]?_0x2ab6f9[_0xfb78('0x1d')][_0xfb78('0x1f')]||null:null,'limit':_0x2ab6f9['options']?_0x2ab6f9['options']['limit']||null:null,'include':_0x2ab6f9['options']?_0x2ab6f9[_0xfb78('0x1d')][_0xfb78('0x20')]?_[_0xfb78('0x21')](_0x2ab6f9[_0xfb78('0x1d')][_0xfb78('0x20')],function(_0x1edc0a){return{'model':db[_0x1edc0a[_0xfb78('0x22')]],'as':_0x1edc0a['as'],'attributes':_0x1edc0a[_0xfb78('0x1f')],'include':_0x1edc0a[_0xfb78('0x20')]?_['map'](_0x1edc0a[_0xfb78('0x20')],function(_0x18aba8){return{'model':db[_0x18aba8[_0xfb78('0x22')]],'as':_0x18aba8['as'],'attributes':_0x18aba8['attributes'],'include':_0x18aba8[_0xfb78('0x20')]?_[_0xfb78('0x21')](_0x18aba8[_0xfb78('0x20')],function(_0x44323d){return{'model':db[_0x44323d[_0xfb78('0x22')]],'as':_0x44323d['as'],'attributes':_0x44323d[_0xfb78('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1178eb){logger['info'](_0xfb78('0x1b'),_0x2ab6f9);logger[_0xfb78('0x16')](_0xfb78('0x1b'),_0x2ab6f9,JSON[_0xfb78('0x23')](_0x1178eb));_0x37555c(_0x1178eb);})[_0xfb78('0x1a')](function(_0x4e8c66){logger['error'](_0xfb78('0x1b'),_0x4e8c66[_0xfb78('0x19')],_0x2ab6f9);_0x303bc0(_0x2064d2[_0xfb78('0x18')](0x1f4,_0x4e8c66[_0xfb78('0x19')]));});});};exports['ShowFaxQueue']=function(_0x311b28){var _0x29114f=this;return new Promise(function(_0x4c79f3,_0x37007f){return db['FaxQueue'][_0xfb78('0x24')]({'raw':_0x311b28['options']?_0x311b28[_0xfb78('0x1d')][_0xfb78('0x1c')]===undefined?!![]:![]:!![],'where':_0x311b28[_0xfb78('0x1d')]?_0x311b28[_0xfb78('0x1d')][_0xfb78('0x1e')]||null:null,'attributes':_0x311b28[_0xfb78('0x1d')]?_0x311b28[_0xfb78('0x1d')][_0xfb78('0x1f')]||null:null,'include':_0x311b28['options']?_0x311b28[_0xfb78('0x1d')][_0xfb78('0x20')]?_['map'](_0x311b28[_0xfb78('0x1d')][_0xfb78('0x20')],function(_0x339441){return{'model':db[_0x339441['model']],'as':_0x339441['as'],'attributes':_0x339441['attributes'],'include':_0x339441['include']?_[_0xfb78('0x21')](_0x339441[_0xfb78('0x20')],function(_0x314256){return{'model':db[_0x314256[_0xfb78('0x22')]],'as':_0x314256['as'],'attributes':_0x314256[_0xfb78('0x1f')],'include':_0x314256[_0xfb78('0x20')]?_[_0xfb78('0x21')](_0x314256[_0xfb78('0x20')],function(_0x42b349){return{'model':db[_0x42b349[_0xfb78('0x22')]],'as':_0x42b349['as'],'attributes':_0x42b349[_0xfb78('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f90a6){logger['info'](_0xfb78('0x25'),_0x311b28);logger[_0xfb78('0x16')](_0xfb78('0x25'),_0x311b28,JSON[_0xfb78('0x23')](_0x3f90a6));_0x4c79f3(_0x3f90a6);})[_0xfb78('0x1a')](function(_0x56e566){logger[_0xfb78('0x18')](_0xfb78('0x25'),_0x56e566[_0xfb78('0x19')],_0x311b28);_0x37007f(_0x29114f[_0xfb78('0x18')](0x1f4,_0x56e566[_0xfb78('0x19')]));});});}; \ No newline at end of file +var _0x2be3=['GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','redis','localhost','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3a42df,_0x3d9577){var _0x38e0a2=function(_0x3f7a03){while(--_0x3f7a03){_0x3a42df['push'](_0x3a42df['shift']());}};_0x38e0a2(++_0x3d9577);}(_0x2be3,0x99));var _0x32be=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x2be3[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x32be('0x0'));var rs=require(_0x32be('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32be('0x2'));var logger=require('../../config/logger')(_0x32be('0x3'));var config=require(_0x32be('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x32be('0x5')]['http']({'port':0x232a});config[_0x32be('0x6')]=_['defaults'](config[_0x32be('0x6')],{'host':_0x32be('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32be('0x6')]));require(_0x32be('0x8'))['register'](socket);function respondWithRpcPromise(_0x3d2c65,_0x409a35,_0x251adb){return new BPromise(function(_0x3bedce,_0x5ab9d4){return client[_0x32be('0x9')](_0x3d2c65,_0x251adb)[_0x32be('0xa')](function(_0xad91a5){logger[_0x32be('0xb')](_0x32be('0xc'),_0x409a35,_0x32be('0xd'));logger[_0x32be('0xe')](_0x32be('0xf'),_0x409a35,'request\x20sent',JSON[_0x32be('0x10')](_0xad91a5));if(_0xad91a5[_0x32be('0x11')]){if(_0xad91a5[_0x32be('0x11')][_0x32be('0x12')]===0x1f4){logger[_0x32be('0x11')](_0x32be('0xc'),_0x409a35,_0xad91a5[_0x32be('0x11')][_0x32be('0x13')]);return _0x5ab9d4(_0xad91a5['error']['message']);}logger[_0x32be('0x11')](_0x32be('0xc'),_0x409a35,_0xad91a5[_0x32be('0x11')]['message']);return _0x3bedce(_0xad91a5[_0x32be('0x11')][_0x32be('0x13')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x409a35,_0x32be('0xd'));_0x3bedce(_0xad91a5[_0x32be('0x14')][_0x32be('0x13')]);}})[_0x32be('0x15')](function(_0x2d003e){logger['error'](_0x32be('0xc'),_0x409a35,_0x2d003e);_0x5ab9d4(_0x2d003e);});});}exports[_0x32be('0x16')]=function(_0x598d0e){var _0x29fa00=this;return new Promise(function(_0x5b5a66,_0x564cb8){return db[_0x32be('0x17')][_0x32be('0x18')]({'raw':_0x598d0e[_0x32be('0x19')]?_0x598d0e[_0x32be('0x19')][_0x32be('0x1a')]===undefined?!![]:![]:!![],'where':_0x598d0e[_0x32be('0x19')]?_0x598d0e['options'][_0x32be('0x1b')]||null:null,'attributes':_0x598d0e[_0x32be('0x19')]?_0x598d0e['options'][_0x32be('0x1c')]||null:null,'limit':_0x598d0e['options']?_0x598d0e[_0x32be('0x19')][_0x32be('0x1d')]||null:null,'include':_0x598d0e[_0x32be('0x19')]?_0x598d0e[_0x32be('0x19')][_0x32be('0x1e')]?_[_0x32be('0x1f')](_0x598d0e[_0x32be('0x19')]['include'],function(_0x5a4766){return{'model':db[_0x5a4766[_0x32be('0x20')]],'as':_0x5a4766['as'],'attributes':_0x5a4766[_0x32be('0x1c')],'include':_0x5a4766[_0x32be('0x1e')]?_[_0x32be('0x1f')](_0x5a4766[_0x32be('0x1e')],function(_0x42b8f0){return{'model':db[_0x42b8f0[_0x32be('0x20')]],'as':_0x42b8f0['as'],'attributes':_0x42b8f0[_0x32be('0x1c')],'include':_0x42b8f0[_0x32be('0x1e')]?_[_0x32be('0x1f')](_0x42b8f0['include'],function(_0x4d10cd){return{'model':db[_0x4d10cd[_0x32be('0x20')]],'as':_0x4d10cd['as'],'attributes':_0x4d10cd[_0x32be('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x32be('0xa')](function(_0x364842){logger[_0x32be('0xb')]('GetFaxQueue',_0x598d0e);logger[_0x32be('0xe')](_0x32be('0x16'),_0x598d0e,JSON[_0x32be('0x10')](_0x364842));_0x5b5a66(_0x364842);})[_0x32be('0x15')](function(_0x328780){logger[_0x32be('0x11')]('GetFaxQueue',_0x328780['message'],_0x598d0e);_0x564cb8(_0x29fa00['error'](0x1f4,_0x328780[_0x32be('0x13')]));});});};exports[_0x32be('0x21')]=function(_0xd38912){var _0x53e58a=this;return new Promise(function(_0x33eba2,_0x4a2ad6){return db[_0x32be('0x17')][_0x32be('0x22')]({'raw':_0xd38912['options']?_0xd38912['options'][_0x32be('0x1a')]===undefined?!![]:![]:!![],'where':_0xd38912['options']?_0xd38912[_0x32be('0x19')]['where']||null:null,'attributes':_0xd38912['options']?_0xd38912[_0x32be('0x19')][_0x32be('0x1c')]||null:null,'include':_0xd38912['options']?_0xd38912[_0x32be('0x19')][_0x32be('0x1e')]?_[_0x32be('0x1f')](_0xd38912['options'][_0x32be('0x1e')],function(_0x497c85){return{'model':db[_0x497c85[_0x32be('0x20')]],'as':_0x497c85['as'],'attributes':_0x497c85[_0x32be('0x1c')],'include':_0x497c85[_0x32be('0x1e')]?_[_0x32be('0x1f')](_0x497c85[_0x32be('0x1e')],function(_0x20e1c4){return{'model':db[_0x20e1c4[_0x32be('0x20')]],'as':_0x20e1c4['as'],'attributes':_0x20e1c4[_0x32be('0x1c')],'include':_0x20e1c4[_0x32be('0x1e')]?_[_0x32be('0x1f')](_0x20e1c4['include'],function(_0x2e9bbf){return{'model':db[_0x2e9bbf[_0x32be('0x20')]],'as':_0x2e9bbf['as'],'attributes':_0x2e9bbf[_0x32be('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x32be('0xa')](function(_0x41616e){logger[_0x32be('0xb')](_0x32be('0x21'),_0xd38912);logger[_0x32be('0xe')](_0x32be('0x21'),_0xd38912,JSON['stringify'](_0x41616e));_0x33eba2(_0x41616e);})[_0x32be('0x15')](function(_0x4d0bd0){logger['error'](_0x32be('0x21'),_0x4d0bd0[_0x32be('0x13')],_0xd38912);_0x4a2ad6(_0x53e58a['error'](0x1f4,_0x4d0bd0[_0x32be('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 20082f4..4fa7043 100644 --- a/server/api/faxQueue/faxQueue.socket.js +++ b/server/api/faxQueue/faxQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe747=['length','faxQueue:','./faxQueue.events','save','update','emit','removeListener'];(function(_0x937708,_0x3f2346){var _0x329e39=function(_0x484cb7){while(--_0x484cb7){_0x937708['push'](_0x937708['shift']());}};_0x329e39(++_0x3f2346);}(_0xe747,0x13d));var _0x7e74=function(_0x268149,_0x209ba5){_0x268149=_0x268149-0x0;var _0x5cd66e=_0xe747[_0x268149];return _0x5cd66e;};'use strict';var FaxQueueEvents=require(_0x7e74('0x0'));var events=[_0x7e74('0x1'),'remove',_0x7e74('0x2')];function createListener(_0x53ec8c,_0x50b2a5){return function(_0x466e93){_0x50b2a5[_0x7e74('0x3')](_0x53ec8c,_0x466e93);};}function removeListener(_0x22c72f,_0x1cf884){return function(){FaxQueueEvents[_0x7e74('0x4')](_0x22c72f,_0x1cf884);};}exports['register']=function(_0x33b887){for(var _0x141853=0x0,_0x38f16b=events[_0x7e74('0x5')];_0x141853<_0x38f16b;_0x141853++){var _0x5a62cb=events[_0x141853];var _0x1b6141=createListener(_0x7e74('0x6')+_0x5a62cb,_0x33b887);FaxQueueEvents['on'](_0x5a62cb,_0x1b6141);}}; \ No newline at end of file +var _0xf45b=['register','length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x4a0e37,_0x2ccabf){var _0x57477b=function(_0x14c9a1){while(--_0x14c9a1){_0x4a0e37['push'](_0x4a0e37['shift']());}};_0x57477b(++_0x2ccabf);}(_0xf45b,0x13e));var _0xbf45=function(_0xf7dd0f,_0x396c3b){_0xf7dd0f=_0xf7dd0f-0x0;var _0x3fc64b=_0xf45b[_0xf7dd0f];return _0x3fc64b;};'use strict';var FaxQueueEvents=require(_0xbf45('0x0'));var events=[_0xbf45('0x1'),_0xbf45('0x2'),_0xbf45('0x3')];function createListener(_0x4f7b17,_0x5248d3){return function(_0x50e028){_0x5248d3[_0xbf45('0x4')](_0x4f7b17,_0x50e028);};}function removeListener(_0x3e559b,_0x5d019e){return function(){FaxQueueEvents[_0xbf45('0x5')](_0x3e559b,_0x5d019e);};}exports[_0xbf45('0x6')]=function(_0x57ea5d){for(var _0xe16b6d=0x0,_0x408cee=events[_0xbf45('0x7')];_0xe16b6d<_0x408cee;_0xe16b6d++){var _0x28c646=events[_0xe16b6d];var _0x38d56e=createListener(_0xbf45('0x8')+_0x28c646,_0x57ea5d);FaxQueueEvents['on'](_0x28c646,_0x38d56e);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 89b27d0..7427823 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2bc=['/:id/users','update','destroy','delete','removeTeams','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xe2bc[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0xce2b('0x0'));var util=require('util');var path=require(_0xce2b('0x1'));var timeout=require('connect-timeout');var express=require(_0xce2b('0x2'));var router=express[_0xce2b('0x3')]();var fs_extra=require(_0xce2b('0x4'));var auth=require(_0xce2b('0x5'));var interaction=require(_0xce2b('0x6'));var config=require('../../config/environment');var controller=require(_0xce2b('0x7'));router[_0xce2b('0x8')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0xa')]);router[_0xce2b('0x8')]('/describe',auth[_0xce2b('0x9')](),controller[_0xce2b('0xb')]);router['get'](_0xce2b('0xc'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xd')]);router[_0xce2b('0x8')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xf')]);router[_0xce2b('0x8')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller['getTeams']);router[_0xce2b('0x8')]('/:id/users',auth[_0xce2b('0x9')](),controller[_0xce2b('0x11')]);router[_0xce2b('0x12')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0x13')]);router[_0xce2b('0x12')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller['addTeams']);router[_0xce2b('0x12')](_0xce2b('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xce2b('0xc'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x15')]);router['delete']('/:id',auth[_0xce2b('0x9')](),controller[_0xce2b('0x16')]);router[_0xce2b('0x17')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x18')]);router[_0xce2b('0x17')](_0xce2b('0x14'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x19')]);module['exports']=router; \ No newline at end of file +var _0xb934=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb934,0x92));var _0x4b93=function(_0x36a106,_0x1d271f){_0x36a106=_0x36a106-0x0;var _0x8531a2=_0xb934[_0x36a106];return _0x8531a2;};'use strict';var multer=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var path=require(_0x4b93('0x2'));var timeout=require('connect-timeout');var express=require(_0x4b93('0x3'));var router=express[_0x4b93('0x4')]();var fs_extra=require(_0x4b93('0x5'));var auth=require(_0x4b93('0x6'));var interaction=require(_0x4b93('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x4b93('0x8')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0xa')]);router[_0x4b93('0x8')]('/describe',auth[_0x4b93('0x9')](),controller[_0x4b93('0xb')]);router[_0x4b93('0x8')](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0xd')]);router[_0x4b93('0x8')](_0x4b93('0xe'),auth[_0x4b93('0x9')](),controller['getMembers']);router[_0x4b93('0x8')](_0x4b93('0xf'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x10')]);router[_0x4b93('0x8')](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x12')]);router[_0x4b93('0x13')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0x14')]);router[_0x4b93('0x13')](_0x4b93('0xf'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x15')]);router['post'](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x16')]);router['put'](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x17')]);router[_0x4b93('0x18')](_0x4b93('0xc'),auth['isAuthenticated'](),controller[_0x4b93('0x19')]);router[_0x4b93('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4b93('0x1a')]);router[_0x4b93('0x18')](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x1b')]);module[_0x4b93('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 59bf576..e283cc9 100644 --- a/server/api/faxQueueReport/faxQueueReport.attributes.js +++ b/server/api/faxQueueReport/faxQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24e2=['moment','sequelize','exports','STRING','DATE'];(function(_0x1a6399,_0x437d38){var _0x3a42d1=function(_0xeacda1){while(--_0xeacda1){_0x1a6399['push'](_0x1a6399['shift']());}};_0x3a42d1(++_0x437d38);}(_0x24e2,0x109));var _0x224e=function(_0x168404,_0x436e53){_0x168404=_0x168404-0x0;var _0x4a422a=_0x24e2[_0x168404];return _0x4a422a;};'use strict';var moment=require(_0x224e('0x0'));var Sequelize=require(_0x224e('0x1'));module[_0x224e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x224e('0x3')]},'joinAt':{'type':Sequelize[_0x224e('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x224e('0x4')]},'exitAt':{'type':Sequelize[_0x224e('0x4')]},'reason':{'type':Sequelize[_0x224e('0x3')]}}; \ No newline at end of file +var _0x76d5=['exports','STRING','DATE'];(function(_0xbb8d37,_0x342d57){var _0x13844e=function(_0x47bfc5){while(--_0x47bfc5){_0xbb8d37['push'](_0xbb8d37['shift']());}};_0x13844e(++_0x342d57);}(_0x76d5,0x108));var _0x576d=function(_0x17dacd,_0xb39305){_0x17dacd=_0x17dacd-0x0;var _0x10a2aa=_0x76d5[_0x17dacd];return _0x10a2aa;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x576d('0x0')]={'uniqueid':{'type':Sequelize[_0x576d('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x576d('0x2')]},'exitAt':{'type':Sequelize[_0x576d('0x2')]},'reason':{'type':Sequelize[_0x576d('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index d621e45..77ebead 100644 --- a/server/api/faxQueueReport/faxQueueReport.controller.js +++ b/server/api/faxQueueReport/faxQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe99=['findAll','rows','catch','show','includeAll','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include'];(function(_0x35e50a,_0x1e9a61){var _0x45d7aa=function(_0x1b431d){while(--_0x1b431d){_0x35e50a['push'](_0x35e50a['shift']());}};_0x45d7aa(++_0x1e9a61);}(_0xbe99,0x196));var _0x9be9=function(_0x558697,_0x41e242){_0x558697=_0x558697-0x0;var _0x4812d6=_0xbe99[_0x558697];return _0x4812d6;};'use strict';var emlformat=require(_0x9be9('0x0'));var rimraf=require(_0x9be9('0x1'));var zipdir=require(_0x9be9('0x2'));var jsonpatch=require(_0x9be9('0x3'));var rp=require(_0x9be9('0x4'));var moment=require('moment');var BPromise=require(_0x9be9('0x5'));var Mustache=require('mustache');var util=require(_0x9be9('0x6'));var path=require(_0x9be9('0x7'));var sox=require(_0x9be9('0x8'));var csv=require(_0x9be9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9be9('0xa'));var _=require(_0x9be9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9be9('0xc'));var deskjs=require(_0x9be9('0xd'));var toCsv=require(_0x9be9('0x9'));var querystring=require(_0x9be9('0xe'));var Papa=require(_0x9be9('0xf'));var Redis=require(_0x9be9('0x10'));var authService=require(_0x9be9('0x11'));var qs=require(_0x9be9('0x12'));var as=require(_0x9be9('0x13'));var hardwareService=require(_0x9be9('0x14'));var logger=require(_0x9be9('0x15'))(_0x9be9('0x16'));var utils=require(_0x9be9('0x17'));var config=require(_0x9be9('0x18'));var licenseUtil=require(_0x9be9('0x19'));var db=require(_0x9be9('0x1a'))['db'];function respondWithStatusCode(_0x33c2cd,_0x4b6d99){_0x4b6d99=_0x4b6d99||0xcc;return function(_0x1251e4){if(_0x1251e4){return _0x33c2cd[_0x9be9('0x1b')](_0x4b6d99);}return _0x33c2cd[_0x9be9('0x1c')](_0x4b6d99)[_0x9be9('0x1d')]();};}function respondWithResult(_0x2cc374,_0x50a7fb){_0x50a7fb=_0x50a7fb||0xc8;return function(_0x2798bd){if(_0x2798bd){return _0x2cc374[_0x9be9('0x1c')](_0x50a7fb)[_0x9be9('0x1e')](_0x2798bd);}};}function respondWithFilteredResult(_0x5a8a3d,_0x2d3e45){return function(_0x418c1e){if(_0x418c1e){var _0x3c92cc=typeof _0x2d3e45[_0x9be9('0x1f')]===_0x9be9('0x20')&&typeof _0x2d3e45['limit']===_0x9be9('0x20');var _0x1cbff7=_0x418c1e[_0x9be9('0x21')];var _0x5f2612=_0x3c92cc?0x0:_0x2d3e45['offset'];var _0x9a37a0=_0x3c92cc?_0x418c1e[_0x9be9('0x21')]:_0x2d3e45[_0x9be9('0x1f')]+_0x2d3e45['limit'];var _0x5aeca2;if(_0x9a37a0>=_0x1cbff7){_0x9a37a0=_0x1cbff7;_0x5aeca2=0xc8;}else{_0x5aeca2=0xce;}_0x5a8a3d[_0x9be9('0x1c')](_0x5aeca2);return _0x5a8a3d[_0x9be9('0x22')](_0x9be9('0x23'),_0x5f2612+'-'+_0x9a37a0+'/'+_0x1cbff7)[_0x9be9('0x1e')](_0x418c1e);}return null;};}function patchUpdates(_0x1b041b){return function(_0x3761c7){try{jsonpatch[_0x9be9('0x24')](_0x3761c7,_0x1b041b,!![]);}catch(_0x2c1f2f){return BPromise[_0x9be9('0x25')](_0x2c1f2f);}return _0x3761c7[_0x9be9('0x26')]();};}function saveUpdates(_0xd700ff,_0x100637){return function(_0x599429){if(_0x599429){return _0x599429[_0x9be9('0x27')](_0xd700ff)['then'](function(_0x2d543d){return _0x2d543d;});}return null;};}function removeEntity(_0xf87e6d,_0x451e60){return function(_0x3fe959){if(_0x3fe959){return _0x3fe959['destroy']()[_0x9be9('0x28')](function(){_0xf87e6d[_0x9be9('0x1c')](0xcc)[_0x9be9('0x1d')]();});}};}function handleEntityNotFound(_0x42a486,_0x60f1ad){return function(_0x13d557){if(!_0x13d557){_0x42a486[_0x9be9('0x1b')](0x194);}return _0x13d557;};}function handleError(_0x28688c,_0x292581){_0x292581=_0x292581||0x1f4;return function(_0x27be52){logger['error'](_0x27be52[_0x9be9('0x29')]);if(_0x27be52[_0x9be9('0x2a')]){delete _0x27be52[_0x9be9('0x2a')];}_0x28688c[_0x9be9('0x1c')](_0x292581)[_0x9be9('0x2b')](_0x27be52);};}exports['index']=function(_0x22c898,_0x45e200){var _0x49ed5d={},_0x199623={},_0x49e398={'count':0x0,'rows':[]};var _0x3bdcb7=_[_0x9be9('0x2c')](db[_0x9be9('0x2d')][_0x9be9('0x2e')],function(_0x5a527a){return{'name':_0x5a527a[_0x9be9('0x2f')],'type':_0x5a527a[_0x9be9('0x30')][_0x9be9('0x31')]};});_0x199623[_0x9be9('0x32')]=_[_0x9be9('0x2c')](_0x3bdcb7,_0x9be9('0x2a'));_0x199623[_0x9be9('0x33')]=_[_0x9be9('0x34')](_0x22c898['query']);_0x199623['filters']=_[_0x9be9('0x35')](_0x199623['model'],_0x199623[_0x9be9('0x33')]);_0x49ed5d[_0x9be9('0x36')]=_[_0x9be9('0x35')](_0x199623[_0x9be9('0x32')],qs['fields'](_0x22c898[_0x9be9('0x33')][_0x9be9('0x37')]));_0x49ed5d[_0x9be9('0x36')]=_0x49ed5d[_0x9be9('0x36')][_0x9be9('0x38')]?_0x49ed5d['attributes']:_0x199623[_0x9be9('0x32')];if(!_0x22c898['query']['hasOwnProperty']('nolimit')){_0x49ed5d['limit']=qs[_0x9be9('0x39')](_0x22c898[_0x9be9('0x33')]['limit']);_0x49ed5d[_0x9be9('0x1f')]=qs[_0x9be9('0x1f')](_0x22c898[_0x9be9('0x33')][_0x9be9('0x1f')]);}_0x49ed5d[_0x9be9('0x3a')]=qs['sort'](_0x22c898[_0x9be9('0x33')][_0x9be9('0x3b')]);_0x49ed5d[_0x9be9('0x3c')]=qs[_0x9be9('0x3d')](_[_0x9be9('0x3e')](_0x22c898[_0x9be9('0x33')],_0x199623[_0x9be9('0x3d')]),_0x3bdcb7);if(_0x22c898[_0x9be9('0x33')][_0x9be9('0x3f')]){_0x49ed5d[_0x9be9('0x3c')]=_[_0x9be9('0x40')](_0x49ed5d[_0x9be9('0x3c')],{'$or':_[_0x9be9('0x2c')](_0x3bdcb7,function(_0x3d117b){if(_0x3d117b[_0x9be9('0x30')]!==_0x9be9('0x41')){var _0x2d657d={};_0x2d657d[_0x3d117b[_0x9be9('0x2a')]]={'$like':'%'+_0x22c898[_0x9be9('0x33')][_0x9be9('0x3f')]+'%'};return _0x2d657d;}})});}_0x49ed5d=_[_0x9be9('0x40')]({},_0x49ed5d,_0x22c898[_0x9be9('0x42')]);var _0x24cc6c={'where':_0x49ed5d[_0x9be9('0x3c')]};return db['FaxQueueReport'][_0x9be9('0x21')](_0x24cc6c)[_0x9be9('0x28')](function(_0x885c95){_0x49e398[_0x9be9('0x21')]=_0x885c95;if(_0x22c898[_0x9be9('0x33')]['includeAll']){_0x49ed5d[_0x9be9('0x43')]=[{'all':!![]}];}return db[_0x9be9('0x2d')][_0x9be9('0x44')](_0x49ed5d);})[_0x9be9('0x28')](function(_0x1f7775){_0x49e398[_0x9be9('0x45')]=_0x1f7775;return _0x49e398;})[_0x9be9('0x28')](respondWithFilteredResult(_0x45e200,_0x49ed5d))[_0x9be9('0x46')](handleError(_0x45e200,null));};exports[_0x9be9('0x47')]=function(_0x486fd9,_0x585809){var _0x3ca323={'raw':!![],'where':{'id':_0x486fd9['params']['id']}},_0x56bf39={};_0x56bf39[_0x9be9('0x32')]=_[_0x9be9('0x34')](db[_0x9be9('0x2d')]['rawAttributes']);_0x56bf39['query']=_[_0x9be9('0x34')](_0x486fd9['query']);_0x56bf39[_0x9be9('0x3d')]=_[_0x9be9('0x35')](_0x56bf39['model'],_0x56bf39[_0x9be9('0x33')]);_0x3ca323[_0x9be9('0x36')]=_[_0x9be9('0x35')](_0x56bf39[_0x9be9('0x32')],qs[_0x9be9('0x37')](_0x486fd9['query'][_0x9be9('0x37')]));_0x3ca323[_0x9be9('0x36')]=_0x3ca323[_0x9be9('0x36')]['length']?_0x3ca323[_0x9be9('0x36')]:_0x56bf39['model'];if(_0x486fd9[_0x9be9('0x33')][_0x9be9('0x48')]){_0x3ca323[_0x9be9('0x43')]=[{'all':!![]}];}_0x3ca323=_[_0x9be9('0x40')]({},_0x3ca323,_0x486fd9['options']);return db['FaxQueueReport'][_0x9be9('0x49')](_0x3ca323)[_0x9be9('0x28')](handleEntityNotFound(_0x585809,null))['then'](respondWithResult(_0x585809,null))[_0x9be9('0x46')](handleError(_0x585809,null));};exports[_0x9be9('0x4a')]=function(_0x2b1a9a,_0x7d0656){return db[_0x9be9('0x2d')][_0x9be9('0x4a')](_0x2b1a9a[_0x9be9('0x4b')],{})[_0x9be9('0x28')](respondWithResult(_0x7d0656,0xc9))[_0x9be9('0x46')](handleError(_0x7d0656,null));};exports[_0x9be9('0x27')]=function(_0x1385ac,_0x31faa8){if(_0x1385ac['body']['id']){delete _0x1385ac[_0x9be9('0x4b')]['id'];}return db[_0x9be9('0x2d')][_0x9be9('0x49')]({'where':{'id':_0x1385ac[_0x9be9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x31faa8,null))['then'](saveUpdates(_0x1385ac[_0x9be9('0x4b')],null))[_0x9be9('0x28')](respondWithResult(_0x31faa8,null))[_0x9be9('0x46')](handleError(_0x31faa8,null));};exports[_0x9be9('0x4d')]=function(_0x18450a,_0x5840fc){return db[_0x9be9('0x2d')][_0x9be9('0x49')]({'where':{'id':_0x18450a['params']['id']}})[_0x9be9('0x28')](handleEntityNotFound(_0x5840fc,null))[_0x9be9('0x28')](removeEntity(_0x5840fc,null))['catch'](handleError(_0x5840fc,null));};exports[_0x9be9('0x4e')]=function(_0x3ab27b,_0x1ccb41){return db[_0x9be9('0x2d')]['describe']()[_0x9be9('0x28')](respondWithResult(_0x1ccb41,null))[_0x9be9('0x46')](handleError(_0x1ccb41,null));}; \ No newline at end of file +var _0x25b0=['sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','index','map','FaxQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x25b0,0x140));var _0x025b=function(_0x5459b0,_0x4d2ef8){_0x5459b0=_0x5459b0-0x0;var _0x675a35=_0x25b0[_0x5459b0];return _0x675a35;};'use strict';var emlformat=require(_0x025b('0x0'));var rimraf=require(_0x025b('0x1'));var zipdir=require(_0x025b('0x2'));var jsonpatch=require(_0x025b('0x3'));var rp=require(_0x025b('0x4'));var moment=require(_0x025b('0x5'));var BPromise=require(_0x025b('0x6'));var Mustache=require(_0x025b('0x7'));var util=require(_0x025b('0x8'));var path=require(_0x025b('0x9'));var sox=require('sox');var csv=require(_0x025b('0xa'));var ejs=require(_0x025b('0xb'));var fs=require('fs');var fs_extra=require(_0x025b('0xc'));var _=require('lodash');var squel=require(_0x025b('0xd'));var crypto=require(_0x025b('0xe'));var jsforce=require(_0x025b('0xf'));var deskjs=require(_0x025b('0x10'));var toCsv=require(_0x025b('0xa'));var querystring=require(_0x025b('0x11'));var Papa=require(_0x025b('0x12'));var Redis=require('ioredis');var authService=require(_0x025b('0x13'));var qs=require(_0x025b('0x14'));var as=require(_0x025b('0x15'));var hardwareService=require(_0x025b('0x16'));var logger=require(_0x025b('0x17'))(_0x025b('0x18'));var utils=require(_0x025b('0x19'));var config=require(_0x025b('0x1a'));var licenseUtil=require(_0x025b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403230,_0x4ff41a){_0x4ff41a=_0x4ff41a||0xcc;return function(_0x288d63){if(_0x288d63){return _0x403230[_0x025b('0x1c')](_0x4ff41a);}return _0x403230[_0x025b('0x1d')](_0x4ff41a)['end']();};}function respondWithResult(_0x2761e3,_0x4347ec){_0x4347ec=_0x4347ec||0xc8;return function(_0x2c831d){if(_0x2c831d){return _0x2761e3[_0x025b('0x1d')](_0x4347ec)[_0x025b('0x1e')](_0x2c831d);}};}function respondWithFilteredResult(_0x263191,_0x41b189){return function(_0x50d54b){if(_0x50d54b){var _0x242be4=typeof _0x41b189[_0x025b('0x1f')]===_0x025b('0x20')&&typeof _0x41b189[_0x025b('0x21')]===_0x025b('0x20');var _0x795cac=_0x50d54b[_0x025b('0x22')];var _0x525651=_0x242be4?0x0:_0x41b189[_0x025b('0x1f')];var _0x3c1a58=_0x242be4?_0x50d54b[_0x025b('0x22')]:_0x41b189[_0x025b('0x1f')]+_0x41b189[_0x025b('0x21')];var _0x102b89;if(_0x3c1a58>=_0x795cac){_0x3c1a58=_0x795cac;_0x102b89=0xc8;}else{_0x102b89=0xce;}_0x263191[_0x025b('0x1d')](_0x102b89);return _0x263191[_0x025b('0x23')](_0x025b('0x24'),_0x525651+'-'+_0x3c1a58+'/'+_0x795cac)[_0x025b('0x1e')](_0x50d54b);}return null;};}function patchUpdates(_0x56866e){return function(_0x463388){try{jsonpatch[_0x025b('0x25')](_0x463388,_0x56866e,!![]);}catch(_0x7430fd){return BPromise[_0x025b('0x26')](_0x7430fd);}return _0x463388['save']();};}function saveUpdates(_0x4c712a,_0x1a519d){return function(_0x415655){if(_0x415655){return _0x415655[_0x025b('0x27')](_0x4c712a)[_0x025b('0x28')](function(_0x4edb56){return _0x4edb56;});}return null;};}function removeEntity(_0x1c65fc,_0x2dd34b){return function(_0x34acb1){if(_0x34acb1){return _0x34acb1[_0x025b('0x29')]()[_0x025b('0x28')](function(){_0x1c65fc[_0x025b('0x1d')](0xcc)[_0x025b('0x2a')]();});}};}function handleEntityNotFound(_0x31fd5a,_0x25bd08){return function(_0x352f69){if(!_0x352f69){_0x31fd5a[_0x025b('0x1c')](0x194);}return _0x352f69;};}function handleError(_0x2b97ba,_0x14086f){_0x14086f=_0x14086f||0x1f4;return function(_0x3dca9b){logger['error'](_0x3dca9b[_0x025b('0x2b')]);if(_0x3dca9b[_0x025b('0x2c')]){delete _0x3dca9b[_0x025b('0x2c')];}_0x2b97ba[_0x025b('0x1d')](_0x14086f)['send'](_0x3dca9b);};}exports[_0x025b('0x2d')]=function(_0x503aaf,_0x1f19d9){var _0x21b41a={},_0x296de2={},_0x229e6d={'count':0x0,'rows':[]};var _0x2d074f=_[_0x025b('0x2e')](db[_0x025b('0x2f')]['rawAttributes'],function(_0x41d26e){return{'name':_0x41d26e['fieldName'],'type':_0x41d26e[_0x025b('0x30')][_0x025b('0x31')]};});_0x296de2[_0x025b('0x32')]=_[_0x025b('0x2e')](_0x2d074f,'name');_0x296de2[_0x025b('0x33')]=_[_0x025b('0x34')](_0x503aaf[_0x025b('0x33')]);_0x296de2[_0x025b('0x35')]=_[_0x025b('0x36')](_0x296de2[_0x025b('0x32')],_0x296de2[_0x025b('0x33')]);_0x21b41a[_0x025b('0x37')]=_['intersection'](_0x296de2[_0x025b('0x32')],qs[_0x025b('0x38')](_0x503aaf['query'][_0x025b('0x38')]));_0x21b41a[_0x025b('0x37')]=_0x21b41a[_0x025b('0x37')][_0x025b('0x39')]?_0x21b41a[_0x025b('0x37')]:_0x296de2['model'];if(!_0x503aaf['query'][_0x025b('0x3a')](_0x025b('0x3b'))){_0x21b41a[_0x025b('0x21')]=qs[_0x025b('0x21')](_0x503aaf[_0x025b('0x33')][_0x025b('0x21')]);_0x21b41a[_0x025b('0x1f')]=qs['offset'](_0x503aaf['query']['offset']);}_0x21b41a['order']=qs['sort'](_0x503aaf[_0x025b('0x33')][_0x025b('0x3c')]);_0x21b41a[_0x025b('0x3d')]=qs['filters'](_[_0x025b('0x3e')](_0x503aaf['query'],_0x296de2['filters']),_0x2d074f);if(_0x503aaf[_0x025b('0x33')][_0x025b('0x3f')]){_0x21b41a['where']=_[_0x025b('0x40')](_0x21b41a[_0x025b('0x3d')],{'$or':_[_0x025b('0x2e')](_0x2d074f,function(_0x4a4268){if(_0x4a4268[_0x025b('0x30')]!=='VIRTUAL'){var _0x30c3d5={};_0x30c3d5[_0x4a4268[_0x025b('0x2c')]]={'$like':'%'+_0x503aaf[_0x025b('0x33')][_0x025b('0x3f')]+'%'};return _0x30c3d5;}})});}_0x21b41a=_['merge']({},_0x21b41a,_0x503aaf[_0x025b('0x41')]);var _0x5ac85f={'where':_0x21b41a[_0x025b('0x3d')]};return db['FaxQueueReport'][_0x025b('0x22')](_0x5ac85f)[_0x025b('0x28')](function(_0x1880a7){_0x229e6d[_0x025b('0x22')]=_0x1880a7;if(_0x503aaf[_0x025b('0x33')]['includeAll']){_0x21b41a[_0x025b('0x42')]=[{'all':!![]}];}return db[_0x025b('0x2f')]['findAll'](_0x21b41a);})['then'](function(_0x1a77d6){_0x229e6d[_0x025b('0x43')]=_0x1a77d6;return _0x229e6d;})[_0x025b('0x28')](respondWithFilteredResult(_0x1f19d9,_0x21b41a))[_0x025b('0x44')](handleError(_0x1f19d9,null));};exports[_0x025b('0x45')]=function(_0x5134e4,_0x2f0d21){var _0x4b59df={'raw':!![],'where':{'id':_0x5134e4[_0x025b('0x46')]['id']}},_0x24b530={};_0x24b530[_0x025b('0x32')]=_[_0x025b('0x34')](db[_0x025b('0x2f')]['rawAttributes']);_0x24b530[_0x025b('0x33')]=_[_0x025b('0x34')](_0x5134e4[_0x025b('0x33')]);_0x24b530[_0x025b('0x35')]=_[_0x025b('0x36')](_0x24b530[_0x025b('0x32')],_0x24b530[_0x025b('0x33')]);_0x4b59df[_0x025b('0x37')]=_[_0x025b('0x36')](_0x24b530[_0x025b('0x32')],qs[_0x025b('0x38')](_0x5134e4[_0x025b('0x33')][_0x025b('0x38')]));_0x4b59df[_0x025b('0x37')]=_0x4b59df[_0x025b('0x37')]['length']?_0x4b59df['attributes']:_0x24b530['model'];if(_0x5134e4['query'][_0x025b('0x47')]){_0x4b59df[_0x025b('0x42')]=[{'all':!![]}];}_0x4b59df=_[_0x025b('0x40')]({},_0x4b59df,_0x5134e4[_0x025b('0x41')]);return db[_0x025b('0x2f')][_0x025b('0x48')](_0x4b59df)['then'](handleEntityNotFound(_0x2f0d21,null))[_0x025b('0x28')](respondWithResult(_0x2f0d21,null))[_0x025b('0x44')](handleError(_0x2f0d21,null));};exports['create']=function(_0x4424f0,_0x39ce38){return db['FaxQueueReport'][_0x025b('0x49')](_0x4424f0[_0x025b('0x4a')],{})[_0x025b('0x28')](respondWithResult(_0x39ce38,0xc9))[_0x025b('0x44')](handleError(_0x39ce38,null));};exports[_0x025b('0x27')]=function(_0x5489c0,_0x3b10c4){if(_0x5489c0[_0x025b('0x4a')]['id']){delete _0x5489c0[_0x025b('0x4a')]['id'];}return db[_0x025b('0x2f')]['find']({'where':{'id':_0x5489c0[_0x025b('0x46')]['id']}})[_0x025b('0x28')](handleEntityNotFound(_0x3b10c4,null))[_0x025b('0x28')](saveUpdates(_0x5489c0[_0x025b('0x4a')],null))[_0x025b('0x28')](respondWithResult(_0x3b10c4,null))[_0x025b('0x44')](handleError(_0x3b10c4,null));};exports['destroy']=function(_0x317001,_0xc216ff){return db[_0x025b('0x2f')]['find']({'where':{'id':_0x317001[_0x025b('0x46')]['id']}})[_0x025b('0x28')](handleEntityNotFound(_0xc216ff,null))[_0x025b('0x28')](removeEntity(_0xc216ff,null))['catch'](handleError(_0xc216ff,null));};exports['describe']=function(_0x1c4f03,_0x5ea697){return db[_0x025b('0x2f')][_0x025b('0x4b')]()[_0x025b('0x28')](respondWithResult(_0x5ea697,null))['catch'](handleError(_0x5ea697,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index b491566..bd8b73b 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x3ccdd5,_0x381eb6){var _0x5f3a13=function(_0x1b68bf){while(--_0x1b68bf){_0x3ccdd5['push'](_0x3ccdd5['shift']());}};_0x5f3a13(++_0x381eb6);}(_0x7a54,0x106));var _0x47a5=function(_0x579815,_0x534f88){_0x579815=_0x579815-0x0;var _0x19eb5d=_0x7a54[_0x579815];return _0x19eb5d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x26b4d8,_0x44c5bb){var _0x1484e5=function(_0x1119a4){while(--_0x1119a4){_0x26b4d8['push'](_0x26b4d8['shift']());}};_0x1484e5(++_0x44c5bb);}(_0xabce,0x103));var _0xeabc=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xabce[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 7564c57..567ae3b 100644 --- a/server/api/faxQueueReport/faxQueueReport.rpc.js +++ b/server/api/faxQueueReport/faxQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacee=['update','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','catch','UpdateFaxQueueReport'];(function(_0x56e2d4,_0xb9d699){var _0x366b57=function(_0x934fe){while(--_0x934fe){_0x56e2d4['push'](_0x56e2d4['shift']());}};_0x366b57(++_0xb9d699);}(_0xacee,0x1f3));var _0xeace=function(_0x1c4246,_0x349da6){_0x1c4246=_0x1c4246-0x0;var _0x5df71b=_0xacee[_0x1c4246];return _0x5df71b;};'use strict';var _=require(_0xeace('0x0'));var util=require(_0xeace('0x1'));var moment=require(_0xeace('0x2'));var BPromise=require(_0xeace('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeace('0x4'));var db=require(_0xeace('0x5'))['db'];var utils=require(_0xeace('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xeace('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeace('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f114e,_0x3ecd46,_0x4c6db8){return new BPromise(function(_0x18fcad,_0x5e5227){return client['request'](_0x5f114e,_0x4c6db8)[_0xeace('0x9')](function(_0x514c37){logger[_0xeace('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x3ecd46,_0xeace('0xb'));logger[_0xeace('0xc')](_0xeace('0xd'),_0x3ecd46,'request\x20sent',JSON[_0xeace('0xe')](_0x514c37));if(_0x514c37[_0xeace('0xf')]){if(_0x514c37[_0xeace('0xf')][_0xeace('0x10')]===0x1f4){logger['error'](_0xeace('0x11'),_0x3ecd46,_0x514c37[_0xeace('0xf')][_0xeace('0x12')]);return _0x5e5227(_0x514c37[_0xeace('0xf')][_0xeace('0x12')]);}logger[_0xeace('0xf')](_0xeace('0x11'),_0x3ecd46,_0x514c37[_0xeace('0xf')]['message']);return _0x18fcad(_0x514c37['error'][_0xeace('0x12')]);}else{logger[_0xeace('0xa')](_0xeace('0x11'),_0x3ecd46,_0xeace('0xb'));_0x18fcad(_0x514c37[_0xeace('0x13')][_0xeace('0x12')]);}})['catch'](function(_0x533723){logger[_0xeace('0xf')](_0xeace('0x11'),_0x3ecd46,_0x533723);_0x5e5227(_0x533723);});});}exports['CreateFaxQueueReport']=function(_0x199140){var _0x5253eb=this;return new Promise(function(_0x292d9e,_0x47efa1){return db[_0xeace('0x14')][_0xeace('0x15')](_0x199140[_0xeace('0x16')],{'raw':_0x199140[_0xeace('0x17')]?_0x199140[_0xeace('0x17')][_0xeace('0x18')]===undefined?!![]:![]:!![]})[_0xeace('0x9')](function(_0x2f2131){logger['info'](_0xeace('0x19'),_0x199140);logger[_0xeace('0xc')](_0xeace('0x19'),_0x199140,JSON[_0xeace('0xe')](_0x2f2131));_0x292d9e(_0x2f2131);})[_0xeace('0x1a')](function(_0x2cd2a3){logger[_0xeace('0xf')](_0xeace('0x19'),_0x2cd2a3[_0xeace('0x12')],_0x199140);_0x47efa1(_0x5253eb[_0xeace('0xf')](0x1f4,_0x2cd2a3[_0xeace('0x12')]));});});};exports[_0xeace('0x1b')]=function(_0x5b5371){var _0x3c55dd=this;return new Promise(function(_0x5e988d,_0x132fcf){return db[_0xeace('0x14')][_0xeace('0x1c')](_0x5b5371[_0xeace('0x16')],{'raw':_0x5b5371[_0xeace('0x17')]?_0x5b5371[_0xeace('0x17')][_0xeace('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b5371['options']?_0x5b5371['options'][_0xeace('0x1d')]||null:null,'attributes':_0x5b5371[_0xeace('0x17')]?_0x5b5371[_0xeace('0x17')][_0xeace('0x1e')]||null:null,'limit':_0x5b5371[_0xeace('0x17')]?_0x5b5371[_0xeace('0x17')]['limit']||null:null})['then'](function(_0x46a9c6){logger[_0xeace('0xa')](_0xeace('0x1b'),_0x5b5371);logger[_0xeace('0xc')](_0xeace('0x1b'),_0x5b5371,JSON[_0xeace('0xe')](_0x46a9c6));_0x5e988d(_0x46a9c6);})['catch'](function(_0x5dab13){logger[_0xeace('0xf')]('UpdateFaxQueueReport',_0x5dab13[_0xeace('0x12')],_0x5b5371);_0x132fcf(_0x3c55dd['error'](0x1f4,_0x5dab13['message']));});});}; \ No newline at end of file +var _0xa7df=['info','result','catch','FaxQueueReport','CreateFaxQueueReport','stringify','UpdateFaxQueueReport','update','body','options','raw','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0xc7f205,_0x2d60a7){var _0x11a494=function(_0x367ff8){while(--_0x367ff8){_0xc7f205['push'](_0xc7f205['shift']());}};_0x11a494(++_0x2d60a7);}(_0xa7df,0x1c7));var _0xfa7d=function(_0x4fd573,_0x2a953b){_0x4fd573=_0x4fd573-0x0;var _0x926f6d=_0xa7df[_0x4fd573];return _0x926f6d;};'use strict';var _=require(_0xfa7d('0x0'));var util=require(_0xfa7d('0x1'));var moment=require('moment');var BPromise=require(_0xfa7d('0x2'));var rs=require(_0xfa7d('0x3'));var fs=require('fs');var Redis=require(_0xfa7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa7d('0x5'));var logger=require(_0xfa7d('0x6'))(_0xfa7d('0x7'));var config=require(_0xfa7d('0x8'));var jayson=require(_0xfa7d('0x9'));var client=jayson[_0xfa7d('0xa')][_0xfa7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab846,_0x3fdf04,_0x1cba85){return new BPromise(function(_0x49036c,_0x3b501b){return client[_0xfa7d('0xc')](_0x5ab846,_0x1cba85)[_0xfa7d('0xd')](function(_0x326750){logger['info'](_0xfa7d('0xe'),_0x3fdf04,'request\x20sent');logger[_0xfa7d('0xf')](_0xfa7d('0x10'),_0x3fdf04,_0xfa7d('0x11'),JSON['stringify'](_0x326750));if(_0x326750['error']){if(_0x326750[_0xfa7d('0x12')][_0xfa7d('0x13')]===0x1f4){logger[_0xfa7d('0x12')](_0xfa7d('0xe'),_0x3fdf04,_0x326750[_0xfa7d('0x12')][_0xfa7d('0x14')]);return _0x3b501b(_0x326750['error'][_0xfa7d('0x14')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x3fdf04,_0x326750[_0xfa7d('0x12')][_0xfa7d('0x14')]);return _0x49036c(_0x326750[_0xfa7d('0x12')][_0xfa7d('0x14')]);}else{logger[_0xfa7d('0x15')](_0xfa7d('0xe'),_0x3fdf04,_0xfa7d('0x11'));_0x49036c(_0x326750[_0xfa7d('0x16')]['message']);}})[_0xfa7d('0x17')](function(_0x12faec){logger[_0xfa7d('0x12')](_0xfa7d('0xe'),_0x3fdf04,_0x12faec);_0x3b501b(_0x12faec);});});}exports['CreateFaxQueueReport']=function(_0x9de0d7){var _0xf1d13d=this;return new Promise(function(_0x488c10,_0x24ac96){return db[_0xfa7d('0x18')]['create'](_0x9de0d7['body'],{'raw':_0x9de0d7['options']?_0x9de0d7['options']['raw']===undefined?!![]:![]:!![]})[_0xfa7d('0xd')](function(_0x8f1e8f){logger[_0xfa7d('0x15')](_0xfa7d('0x19'),_0x9de0d7);logger['debug'](_0xfa7d('0x19'),_0x9de0d7,JSON[_0xfa7d('0x1a')](_0x8f1e8f));_0x488c10(_0x8f1e8f);})[_0xfa7d('0x17')](function(_0x24676b){logger[_0xfa7d('0x12')]('CreateFaxQueueReport',_0x24676b['message'],_0x9de0d7);_0x24ac96(_0xf1d13d['error'](0x1f4,_0x24676b[_0xfa7d('0x14')]));});});};exports[_0xfa7d('0x1b')]=function(_0x48e60a){var _0x1b0106=this;return new Promise(function(_0x426a65,_0x4c2b60){return db[_0xfa7d('0x18')][_0xfa7d('0x1c')](_0x48e60a[_0xfa7d('0x1d')],{'raw':_0x48e60a[_0xfa7d('0x1e')]?_0x48e60a[_0xfa7d('0x1e')][_0xfa7d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48e60a[_0xfa7d('0x1e')]?_0x48e60a['options']['where']||null:null,'attributes':_0x48e60a[_0xfa7d('0x1e')]?_0x48e60a[_0xfa7d('0x1e')][_0xfa7d('0x20')]||null:null,'limit':_0x48e60a[_0xfa7d('0x1e')]?_0x48e60a[_0xfa7d('0x1e')][_0xfa7d('0x21')]||null:null})[_0xfa7d('0xd')](function(_0x7d2125){logger[_0xfa7d('0x15')]('UpdateFaxQueueReport',_0x48e60a);logger['debug'](_0xfa7d('0x1b'),_0x48e60a,JSON[_0xfa7d('0x1a')](_0x7d2125));_0x426a65(_0x7d2125);})[_0xfa7d('0x17')](function(_0x15dd1e){logger[_0xfa7d('0x12')](_0xfa7d('0x1b'),_0x15dd1e[_0xfa7d('0x14')],_0x48e60a);_0x4c2b60(_0x1b0106[_0xfa7d('0x12')](0x1f4,_0x15dd1e[_0xfa7d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index f104393..3d9af3a 100644 --- a/server/api/faxQueueReport/index.js +++ b/server/api/faxQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae0b=['./faxQueueReport.controller','isAuthenticated','index','get','describe','post','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x29e4ed,_0x22721c){var _0x44f705=function(_0x85eab6){while(--_0x85eab6){_0x29e4ed['push'](_0x29e4ed['shift']());}};_0x44f705(++_0x22721c);}(_0xae0b,0x9a));var _0xbae0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae0b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbae0('0x0'));var util=require(_0xbae0('0x1'));var path=require(_0xbae0('0x2'));var timeout=require(_0xbae0('0x3'));var express=require(_0xbae0('0x4'));var router=express['Router']();var fs_extra=require(_0xbae0('0x5'));var auth=require(_0xbae0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbae0('0x7'));var controller=require(_0xbae0('0x8'));router['get']('/',auth[_0xbae0('0x9')](),controller[_0xbae0('0xa')]);router[_0xbae0('0xb')]('/describe',auth[_0xbae0('0x9')](),controller[_0xbae0('0xc')]);router[_0xbae0('0xb')]('/:id',auth[_0xbae0('0x9')](),controller['show']);router[_0xbae0('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbae0('0xe'),auth[_0xbae0('0x9')](),controller['update']);router[_0xbae0('0xf')]('/:id',auth[_0xbae0('0x9')](),controller[_0xbae0('0x10')]);module[_0xbae0('0x11')]=router; \ No newline at end of file +var _0xc5da=['update','destroy','exports','multer','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put'];(function(_0x370092,_0x1cba5a){var _0x450c0d=function(_0x1e704d){while(--_0x1e704d){_0x370092['push'](_0x370092['shift']());}};_0x450c0d(++_0x1cba5a);}(_0xc5da,0xcf));var _0xac5d=function(_0x4adb52,_0xe8c27b){_0x4adb52=_0x4adb52-0x0;var _0x329062=_0xc5da[_0x4adb52];return _0x329062;};'use strict';var multer=require(_0xac5d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xac5d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xac5d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xac5d('0x3'));var config=require(_0xac5d('0x4'));var controller=require(_0xac5d('0x5'));router[_0xac5d('0x6')]('/',auth[_0xac5d('0x7')](),controller[_0xac5d('0x8')]);router['get']('/describe',auth[_0xac5d('0x7')](),controller[_0xac5d('0x9')]);router['get'](_0xac5d('0xa'),auth[_0xac5d('0x7')](),controller[_0xac5d('0xb')]);router[_0xac5d('0xc')]('/',auth[_0xac5d('0x7')](),controller['create']);router[_0xac5d('0xd')](_0xac5d('0xa'),auth[_0xac5d('0x7')](),controller[_0xac5d('0xe')]);router['delete'](_0xac5d('0xa'),auth['isAuthenticated'](),controller[_0xac5d('0xf')]);module[_0xac5d('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 6ce2db7..cbcaec7 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x109384,_0x1c1795){var _0x33bf53=function(_0xb78ca2){while(--_0xb78ca2){_0x109384['push'](_0x109384['shift']());}};_0x33bf53(++_0x1c1795);}(_0xf4eb,0xec));var _0xbf4e=function(_0x236723,_0x73b8){_0x236723=_0x236723-0x0;var _0x7124c5=_0xf4eb[_0x236723];return _0x7124c5;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x42f07d,_0x424a90){_0x42f07d=_0x42f07d-0x0;var _0x20662f=_0xb43b[_0x42f07d];return _0x20662f;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 80c4a6e..dbf7b33 100644 --- a/server/api/faxTransferReport/faxTransferReport.controller.js +++ b/server/api/faxTransferReport/faxTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa656=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxTransferReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length'];(function(_0x5b7f75,_0x5ec340){var _0x4a7abc=function(_0x161235){while(--_0x161235){_0x5b7f75['push'](_0x5b7f75['shift']());}};_0x4a7abc(++_0x5ec340);}(_0xa656,0x14a));var _0x6a65=function(_0x16d4c0,_0x7a2aae){_0x16d4c0=_0x16d4c0-0x0;var _0x448c2c=_0xa656[_0x16d4c0];return _0x448c2c;};'use strict';var emlformat=require(_0x6a65('0x0'));var rimraf=require(_0x6a65('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a65('0x2'));var rp=require(_0x6a65('0x3'));var moment=require(_0x6a65('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6a65('0x5'));var util=require(_0x6a65('0x6'));var path=require(_0x6a65('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a65('0x8'));var _=require(_0x6a65('0x9'));var squel=require('squel');var crypto=require(_0x6a65('0xa'));var jsforce=require(_0x6a65('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6a65('0xc'));var querystring=require(_0x6a65('0xd'));var Papa=require(_0x6a65('0xe'));var Redis=require(_0x6a65('0xf'));var authService=require(_0x6a65('0x10'));var qs=require(_0x6a65('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a65('0x12'))(_0x6a65('0x13'));var utils=require('../../config/utils');var config=require(_0x6a65('0x14'));var licenseUtil=require(_0x6a65('0x15'));var db=require(_0x6a65('0x16'))['db'];function respondWithStatusCode(_0x32510d,_0xa05c3){_0xa05c3=_0xa05c3||0xcc;return function(_0x3e0cfa){if(_0x3e0cfa){return _0x32510d['sendStatus'](_0xa05c3);}return _0x32510d[_0x6a65('0x17')](_0xa05c3)[_0x6a65('0x18')]();};}function respondWithResult(_0x5b55df,_0x31bbcd){_0x31bbcd=_0x31bbcd||0xc8;return function(_0x444538){if(_0x444538){return _0x5b55df[_0x6a65('0x17')](_0x31bbcd)['json'](_0x444538);}};}function respondWithFilteredResult(_0x2b2828,_0x10a412){return function(_0x15b6b9){if(_0x15b6b9){var _0x7e1f1c=typeof _0x10a412[_0x6a65('0x19')]===_0x6a65('0x1a')&&typeof _0x10a412[_0x6a65('0x1b')]===_0x6a65('0x1a');var _0x3b097a=_0x15b6b9[_0x6a65('0x1c')];var _0x39a6f9=_0x7e1f1c?0x0:_0x10a412['offset'];var _0x2f3154=_0x7e1f1c?_0x15b6b9[_0x6a65('0x1c')]:_0x10a412[_0x6a65('0x19')]+_0x10a412['limit'];var _0x5c1629;if(_0x2f3154>=_0x3b097a){_0x2f3154=_0x3b097a;_0x5c1629=0xc8;}else{_0x5c1629=0xce;}_0x2b2828[_0x6a65('0x17')](_0x5c1629);return _0x2b2828[_0x6a65('0x1d')](_0x6a65('0x1e'),_0x39a6f9+'-'+_0x2f3154+'/'+_0x3b097a)[_0x6a65('0x1f')](_0x15b6b9);}return null;};}function patchUpdates(_0x142d65){return function(_0x20e4c6){try{jsonpatch[_0x6a65('0x20')](_0x20e4c6,_0x142d65,!![]);}catch(_0x2f4967){return BPromise[_0x6a65('0x21')](_0x2f4967);}return _0x20e4c6[_0x6a65('0x22')]();};}function saveUpdates(_0x2a30dd,_0x831785){return function(_0x29276d){if(_0x29276d){return _0x29276d[_0x6a65('0x23')](_0x2a30dd)[_0x6a65('0x24')](function(_0x262fc1){return _0x262fc1;});}return null;};}function removeEntity(_0x477b12,_0x48206d){return function(_0x1f249c){if(_0x1f249c){return _0x1f249c[_0x6a65('0x25')]()[_0x6a65('0x24')](function(){_0x477b12[_0x6a65('0x17')](0xcc)[_0x6a65('0x18')]();});}};}function handleEntityNotFound(_0x5a2ae5,_0x3e6250){return function(_0x45230d){if(!_0x45230d){_0x5a2ae5[_0x6a65('0x26')](0x194);}return _0x45230d;};}function handleError(_0x41d0b7,_0x4daccf){_0x4daccf=_0x4daccf||0x1f4;return function(_0x270145){logger[_0x6a65('0x27')](_0x270145[_0x6a65('0x28')]);if(_0x270145[_0x6a65('0x29')]){delete _0x270145[_0x6a65('0x29')];}_0x41d0b7['status'](_0x4daccf)[_0x6a65('0x2a')](_0x270145);};}exports[_0x6a65('0x2b')]=function(_0x575a1a,_0x38fa40){var _0x3d5d58={},_0x25c37e={},_0x1ec93a={'count':0x0,'rows':[]};var _0x29a423=_[_0x6a65('0x2c')](db['FaxTransferReport'][_0x6a65('0x2d')],function(_0x212142){return{'name':_0x212142['fieldName'],'type':_0x212142[_0x6a65('0x2e')][_0x6a65('0x2f')]};});_0x25c37e[_0x6a65('0x30')]=_[_0x6a65('0x2c')](_0x29a423,'name');_0x25c37e[_0x6a65('0x31')]=_['keys'](_0x575a1a[_0x6a65('0x31')]);_0x25c37e[_0x6a65('0x32')]=_[_0x6a65('0x33')](_0x25c37e['model'],_0x25c37e['query']);_0x3d5d58['attributes']=_[_0x6a65('0x33')](_0x25c37e[_0x6a65('0x30')],qs['fields'](_0x575a1a[_0x6a65('0x31')][_0x6a65('0x34')]));_0x3d5d58[_0x6a65('0x35')]=_0x3d5d58[_0x6a65('0x35')][_0x6a65('0x36')]?_0x3d5d58[_0x6a65('0x35')]:_0x25c37e[_0x6a65('0x30')];if(!_0x575a1a['query'][_0x6a65('0x37')]('nolimit')){_0x3d5d58[_0x6a65('0x1b')]=qs[_0x6a65('0x1b')](_0x575a1a[_0x6a65('0x31')][_0x6a65('0x1b')]);_0x3d5d58[_0x6a65('0x19')]=qs[_0x6a65('0x19')](_0x575a1a[_0x6a65('0x31')][_0x6a65('0x19')]);}_0x3d5d58[_0x6a65('0x38')]=qs[_0x6a65('0x39')](_0x575a1a['query'][_0x6a65('0x39')]);_0x3d5d58[_0x6a65('0x3a')]=qs[_0x6a65('0x32')](_[_0x6a65('0x3b')](_0x575a1a[_0x6a65('0x31')],_0x25c37e[_0x6a65('0x32')]),_0x29a423);if(_0x575a1a[_0x6a65('0x31')][_0x6a65('0x3c')]){_0x3d5d58[_0x6a65('0x3a')]=_[_0x6a65('0x3d')](_0x3d5d58[_0x6a65('0x3a')],{'$or':_['map'](_0x29a423,function(_0x229d00){if(_0x229d00[_0x6a65('0x2e')]!==_0x6a65('0x3e')){var _0x52fbd4={};_0x52fbd4[_0x229d00[_0x6a65('0x29')]]={'$like':'%'+_0x575a1a[_0x6a65('0x31')][_0x6a65('0x3c')]+'%'};return _0x52fbd4;}})});}_0x3d5d58=_['merge']({},_0x3d5d58,_0x575a1a[_0x6a65('0x3f')]);var _0x233f9d={'where':_0x3d5d58[_0x6a65('0x3a')]};return db[_0x6a65('0x40')][_0x6a65('0x1c')](_0x233f9d)[_0x6a65('0x24')](function(_0x3bf590){_0x1ec93a[_0x6a65('0x1c')]=_0x3bf590;if(_0x575a1a[_0x6a65('0x31')][_0x6a65('0x41')]){_0x3d5d58[_0x6a65('0x42')]=[{'all':!![]}];}return db[_0x6a65('0x40')][_0x6a65('0x43')](_0x3d5d58);})[_0x6a65('0x24')](function(_0x4ea4b7){_0x1ec93a[_0x6a65('0x44')]=_0x4ea4b7;return _0x1ec93a;})['then'](respondWithFilteredResult(_0x38fa40,_0x3d5d58))['catch'](handleError(_0x38fa40,null));};exports[_0x6a65('0x45')]=function(_0xa3011e,_0x33d863){var _0x30cdc8={'raw':!![],'where':{'id':_0xa3011e[_0x6a65('0x46')]['id']}},_0x115491={};_0x115491[_0x6a65('0x30')]=_[_0x6a65('0x47')](db[_0x6a65('0x40')][_0x6a65('0x2d')]);_0x115491[_0x6a65('0x31')]=_[_0x6a65('0x47')](_0xa3011e['query']);_0x115491['filters']=_['intersection'](_0x115491[_0x6a65('0x30')],_0x115491[_0x6a65('0x31')]);_0x30cdc8['attributes']=_['intersection'](_0x115491[_0x6a65('0x30')],qs[_0x6a65('0x34')](_0xa3011e[_0x6a65('0x31')][_0x6a65('0x34')]));_0x30cdc8[_0x6a65('0x35')]=_0x30cdc8[_0x6a65('0x35')][_0x6a65('0x36')]?_0x30cdc8[_0x6a65('0x35')]:_0x115491[_0x6a65('0x30')];if(_0xa3011e[_0x6a65('0x31')][_0x6a65('0x41')]){_0x30cdc8[_0x6a65('0x42')]=[{'all':!![]}];}_0x30cdc8=_[_0x6a65('0x3d')]({},_0x30cdc8,_0xa3011e[_0x6a65('0x3f')]);return db[_0x6a65('0x40')][_0x6a65('0x48')](_0x30cdc8)['then'](handleEntityNotFound(_0x33d863,null))['then'](respondWithResult(_0x33d863,null))[_0x6a65('0x49')](handleError(_0x33d863,null));};exports[_0x6a65('0x4a')]=function(_0x52d16a,_0x53e972){return db['FaxTransferReport'][_0x6a65('0x4a')](_0x52d16a[_0x6a65('0x4b')],{})[_0x6a65('0x24')](respondWithResult(_0x53e972,0xc9))[_0x6a65('0x49')](handleError(_0x53e972,null));};exports[_0x6a65('0x23')]=function(_0x3f47a2,_0x30654c){if(_0x3f47a2['body']['id']){delete _0x3f47a2[_0x6a65('0x4b')]['id'];}return db[_0x6a65('0x40')]['find']({'where':{'id':_0x3f47a2[_0x6a65('0x46')]['id']}})[_0x6a65('0x24')](handleEntityNotFound(_0x30654c,null))[_0x6a65('0x24')](saveUpdates(_0x3f47a2[_0x6a65('0x4b')],null))[_0x6a65('0x24')](respondWithResult(_0x30654c,null))[_0x6a65('0x49')](handleError(_0x30654c,null));};exports[_0x6a65('0x25')]=function(_0x5536cb,_0x538acb){return db[_0x6a65('0x40')][_0x6a65('0x48')]({'where':{'id':_0x5536cb['params']['id']}})['then'](handleEntityNotFound(_0x538acb,null))[_0x6a65('0x24')](removeEntity(_0x538acb,null))[_0x6a65('0x49')](handleError(_0x538acb,null));};exports[_0x6a65('0x4c')]=function(_0x3d907b,_0x336142){return db['FaxTransferReport'][_0x6a65('0x4c')]()['then'](respondWithResult(_0x336142,null))[_0x6a65('0x49')](handleError(_0x336142,null));}; \ No newline at end of file +var _0x6c02=['offset','set','Content-Range','then','destroy','end','stack','send','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','name','where','includeAll','include','findAll','rows','catch','show','params','merge','options','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','limit','undefined','count'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0x6c02,0x104));var _0x26c0=function(_0x54763f,_0x132c0e){_0x54763f=_0x54763f-0x0;var _0x1f25f0=_0x6c02[_0x54763f];return _0x1f25f0;};'use strict';var emlformat=require(_0x26c0('0x0'));var rimraf=require(_0x26c0('0x1'));var zipdir=require(_0x26c0('0x2'));var jsonpatch=require(_0x26c0('0x3'));var rp=require(_0x26c0('0x4'));var moment=require(_0x26c0('0x5'));var BPromise=require(_0x26c0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x26c0('0x7'));var csv=require(_0x26c0('0x8'));var ejs=require(_0x26c0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26c0('0xa'));var squel=require(_0x26c0('0xb'));var crypto=require(_0x26c0('0xc'));var jsforce=require(_0x26c0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x26c0('0x8'));var querystring=require(_0x26c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x26c0('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x26c0('0x10'));var hardwareService=require(_0x26c0('0x11'));var logger=require(_0x26c0('0x12'))(_0x26c0('0x13'));var utils=require(_0x26c0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x26c0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x265585,_0x104be4){_0x104be4=_0x104be4||0xcc;return function(_0x4bdda7){if(_0x4bdda7){return _0x265585[_0x26c0('0x16')](_0x104be4);}return _0x265585['status'](_0x104be4)['end']();};}function respondWithResult(_0x3ccf7f,_0x56b95a){_0x56b95a=_0x56b95a||0xc8;return function(_0x437aa7){if(_0x437aa7){return _0x3ccf7f[_0x26c0('0x17')](_0x56b95a)[_0x26c0('0x18')](_0x437aa7);}};}function respondWithFilteredResult(_0x33fbe9,_0x365c55){return function(_0x4cde54){if(_0x4cde54){var _0x4dcd21=typeof _0x365c55['offset']==='undefined'&&typeof _0x365c55[_0x26c0('0x19')]===_0x26c0('0x1a');var _0x50967e=_0x4cde54[_0x26c0('0x1b')];var _0x1008ed=_0x4dcd21?0x0:_0x365c55['offset'];var _0x1dc570=_0x4dcd21?_0x4cde54[_0x26c0('0x1b')]:_0x365c55[_0x26c0('0x1c')]+_0x365c55[_0x26c0('0x19')];var _0x280197;if(_0x1dc570>=_0x50967e){_0x1dc570=_0x50967e;_0x280197=0xc8;}else{_0x280197=0xce;}_0x33fbe9[_0x26c0('0x17')](_0x280197);return _0x33fbe9[_0x26c0('0x1d')](_0x26c0('0x1e'),_0x1008ed+'-'+_0x1dc570+'/'+_0x50967e)[_0x26c0('0x18')](_0x4cde54);}return null;};}function patchUpdates(_0x397d09){return function(_0x54a22d){try{jsonpatch['apply'](_0x54a22d,_0x397d09,!![]);}catch(_0x179f85){return BPromise['reject'](_0x179f85);}return _0x54a22d['save']();};}function saveUpdates(_0x47a048,_0x286821){return function(_0x347a86){if(_0x347a86){return _0x347a86['update'](_0x47a048)[_0x26c0('0x1f')](function(_0x132cbf){return _0x132cbf;});}return null;};}function removeEntity(_0x258449,_0x7ade6f){return function(_0x3c4f08){if(_0x3c4f08){return _0x3c4f08[_0x26c0('0x20')]()['then'](function(){_0x258449[_0x26c0('0x17')](0xcc)[_0x26c0('0x21')]();});}};}function handleEntityNotFound(_0xcb70dd,_0x36ab47){return function(_0x288cf5){if(!_0x288cf5){_0xcb70dd[_0x26c0('0x16')](0x194);}return _0x288cf5;};}function handleError(_0xa57951,_0x31057f){_0x31057f=_0x31057f||0x1f4;return function(_0x1dc934){logger['error'](_0x1dc934[_0x26c0('0x22')]);if(_0x1dc934['name']){delete _0x1dc934['name'];}_0xa57951[_0x26c0('0x17')](_0x31057f)[_0x26c0('0x23')](_0x1dc934);};}exports['index']=function(_0x1378da,_0x8f9514){var _0x2b450a={},_0xd3486e={},_0x53ddfa={'count':0x0,'rows':[]};var _0x2346db=_[_0x26c0('0x24')](db[_0x26c0('0x25')][_0x26c0('0x26')],function(_0x12d949){return{'name':_0x12d949[_0x26c0('0x27')],'type':_0x12d949[_0x26c0('0x28')][_0x26c0('0x29')]};});_0xd3486e[_0x26c0('0x2a')]=_[_0x26c0('0x24')](_0x2346db,'name');_0xd3486e[_0x26c0('0x2b')]=_[_0x26c0('0x2c')](_0x1378da[_0x26c0('0x2b')]);_0xd3486e[_0x26c0('0x2d')]=_[_0x26c0('0x2e')](_0xd3486e[_0x26c0('0x2a')],_0xd3486e['query']);_0x2b450a[_0x26c0('0x2f')]=_[_0x26c0('0x2e')](_0xd3486e[_0x26c0('0x2a')],qs[_0x26c0('0x30')](_0x1378da[_0x26c0('0x2b')][_0x26c0('0x30')]));_0x2b450a[_0x26c0('0x2f')]=_0x2b450a[_0x26c0('0x2f')][_0x26c0('0x31')]?_0x2b450a[_0x26c0('0x2f')]:_0xd3486e[_0x26c0('0x2a')];if(!_0x1378da[_0x26c0('0x2b')][_0x26c0('0x32')](_0x26c0('0x33'))){_0x2b450a['limit']=qs[_0x26c0('0x19')](_0x1378da[_0x26c0('0x2b')][_0x26c0('0x19')]);_0x2b450a['offset']=qs[_0x26c0('0x1c')](_0x1378da[_0x26c0('0x2b')][_0x26c0('0x1c')]);}_0x2b450a[_0x26c0('0x34')]=qs[_0x26c0('0x35')](_0x1378da[_0x26c0('0x2b')]['sort']);_0x2b450a['where']=qs[_0x26c0('0x2d')](_[_0x26c0('0x36')](_0x1378da[_0x26c0('0x2b')],_0xd3486e[_0x26c0('0x2d')]),_0x2346db);if(_0x1378da[_0x26c0('0x2b')][_0x26c0('0x37')]){_0x2b450a['where']=_['merge'](_0x2b450a['where'],{'$or':_[_0x26c0('0x24')](_0x2346db,function(_0x517f2b){if(_0x517f2b['type']!==_0x26c0('0x38')){var _0x30d613={};_0x30d613[_0x517f2b[_0x26c0('0x39')]]={'$like':'%'+_0x1378da[_0x26c0('0x2b')][_0x26c0('0x37')]+'%'};return _0x30d613;}})});}_0x2b450a=_['merge']({},_0x2b450a,_0x1378da['options']);var _0x23ea7f={'where':_0x2b450a[_0x26c0('0x3a')]};return db['FaxTransferReport'][_0x26c0('0x1b')](_0x23ea7f)[_0x26c0('0x1f')](function(_0x241f63){_0x53ddfa[_0x26c0('0x1b')]=_0x241f63;if(_0x1378da[_0x26c0('0x2b')][_0x26c0('0x3b')]){_0x2b450a[_0x26c0('0x3c')]=[{'all':!![]}];}return db[_0x26c0('0x25')][_0x26c0('0x3d')](_0x2b450a);})[_0x26c0('0x1f')](function(_0xd1d026){_0x53ddfa[_0x26c0('0x3e')]=_0xd1d026;return _0x53ddfa;})[_0x26c0('0x1f')](respondWithFilteredResult(_0x8f9514,_0x2b450a))[_0x26c0('0x3f')](handleError(_0x8f9514,null));};exports[_0x26c0('0x40')]=function(_0x40e77d,_0x19d386){var _0x3d3cd5={'raw':!![],'where':{'id':_0x40e77d[_0x26c0('0x41')]['id']}},_0x4a7086={};_0x4a7086[_0x26c0('0x2a')]=_['keys'](db['FaxTransferReport'][_0x26c0('0x26')]);_0x4a7086[_0x26c0('0x2b')]=_[_0x26c0('0x2c')](_0x40e77d[_0x26c0('0x2b')]);_0x4a7086['filters']=_['intersection'](_0x4a7086[_0x26c0('0x2a')],_0x4a7086[_0x26c0('0x2b')]);_0x3d3cd5[_0x26c0('0x2f')]=_[_0x26c0('0x2e')](_0x4a7086['model'],qs['fields'](_0x40e77d[_0x26c0('0x2b')][_0x26c0('0x30')]));_0x3d3cd5[_0x26c0('0x2f')]=_0x3d3cd5['attributes'][_0x26c0('0x31')]?_0x3d3cd5[_0x26c0('0x2f')]:_0x4a7086[_0x26c0('0x2a')];if(_0x40e77d[_0x26c0('0x2b')][_0x26c0('0x3b')]){_0x3d3cd5[_0x26c0('0x3c')]=[{'all':!![]}];}_0x3d3cd5=_[_0x26c0('0x42')]({},_0x3d3cd5,_0x40e77d[_0x26c0('0x43')]);return db[_0x26c0('0x25')]['find'](_0x3d3cd5)[_0x26c0('0x1f')](handleEntityNotFound(_0x19d386,null))[_0x26c0('0x1f')](respondWithResult(_0x19d386,null))[_0x26c0('0x3f')](handleError(_0x19d386,null));};exports[_0x26c0('0x44')]=function(_0x248ffb,_0x12d40b){return db[_0x26c0('0x25')][_0x26c0('0x44')](_0x248ffb[_0x26c0('0x45')],{})['then'](respondWithResult(_0x12d40b,0xc9))[_0x26c0('0x3f')](handleError(_0x12d40b,null));};exports[_0x26c0('0x46')]=function(_0x5f351a,_0x1e1117){if(_0x5f351a[_0x26c0('0x45')]['id']){delete _0x5f351a['body']['id'];}return db[_0x26c0('0x25')][_0x26c0('0x47')]({'where':{'id':_0x5f351a[_0x26c0('0x41')]['id']}})[_0x26c0('0x1f')](handleEntityNotFound(_0x1e1117,null))['then'](saveUpdates(_0x5f351a[_0x26c0('0x45')],null))[_0x26c0('0x1f')](respondWithResult(_0x1e1117,null))[_0x26c0('0x3f')](handleError(_0x1e1117,null));};exports[_0x26c0('0x20')]=function(_0x150f49,_0x135ad4){return db[_0x26c0('0x25')][_0x26c0('0x47')]({'where':{'id':_0x150f49['params']['id']}})[_0x26c0('0x1f')](handleEntityNotFound(_0x135ad4,null))['then'](removeEntity(_0x135ad4,null))['catch'](handleError(_0x135ad4,null));};exports['describe']=function(_0x2f265e,_0x5e694c){return db[_0x26c0('0x25')]['describe']()[_0x26c0('0x1f')](respondWithResult(_0x5e694c,null))['catch'](handleError(_0x5e694c,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 3c7a466..22a7657 100644 --- a/server/api/faxTransferReport/faxTransferReport.model.js +++ b/server/api/faxTransferReport/faxTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5493=['moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','report_fax_transfer','uniqueid','util'];(function(_0x5032e3,_0x240bb6){var _0x21e4ec=function(_0x37ced8){while(--_0x37ced8){_0x5032e3['push'](_0x5032e3['shift']());}};_0x21e4ec(++_0x240bb6);}(_0x5493,0x1cb));var _0x3549=function(_0x28b838,_0x480673){_0x28b838=_0x28b838-0x0;var _0x1a44ad=_0x5493[_0x28b838];return _0x1a44ad;};'use strict';var _=require('lodash');var util=require(_0x3549('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3549('0x1'));var BPromise=require(_0x3549('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3549('0x3'));var rimraf=require(_0x3549('0x4'));var config=require(_0x3549('0x5'));var attributes=require(_0x3549('0x6'));module[_0x3549('0x7')]=function(_0x138740,_0x129d5d){return _0x138740['define']('FaxTransferReport',attributes,{'tableName':_0x3549('0x8'),'paranoid':![],'indexes':[{'name':_0x3549('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2572=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0x5401ae,_0x5e58ac){var _0x286068=function(_0x2cac88){while(--_0x2cac88){_0x5401ae['push'](_0x5401ae['shift']());}};_0x286068(++_0x5e58ac);}(_0x2572,0x110));var _0x2257=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x2572[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x2257('0x0'));var util=require(_0x2257('0x1'));var logger=require(_0x2257('0x2'))(_0x2257('0x3'));var moment=require(_0x2257('0x4'));var BPromise=require(_0x2257('0x5'));var rp=require(_0x2257('0x6'));var fs=require('fs');var path=require(_0x2257('0x7'));var rimraf=require(_0x2257('0x8'));var config=require('../../config/environment');var attributes=require(_0x2257('0x9'));module[_0x2257('0xa')]=function(_0x43ffe5,_0xa5bd9){return _0x43ffe5[_0x2257('0xb')](_0x2257('0xc'),attributes,{'tableName':_0x2257('0xd'),'paranoid':![],'indexes':[{'name':_0x2257('0xe'),'fields':[_0x2257('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 3f8f54e..f94be47 100644 --- a/server/api/faxTransferReport/faxTransferReport.rpc.js +++ b/server/api/faxTransferReport/faxTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1855=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1855,0x135));var _0x5185=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x1855[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5185('0x0'));var rs=require(_0x5185('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5185('0x2'));var logger=require(_0x5185('0x3'))(_0x5185('0x4'));var config=require(_0x5185('0x5'));var jayson=require(_0x5185('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c3958,_0xfe3ca6,_0x35160a){return new BPromise(function(_0x5c7eb6,_0x41dd0f){return client[_0x5185('0x7')](_0x2c3958,_0x35160a)[_0x5185('0x8')](function(_0x4f20a2){logger[_0x5185('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0xfe3ca6,_0x5185('0xa'));logger[_0x5185('0xb')](_0x5185('0xc'),_0xfe3ca6,_0x5185('0xa'),JSON[_0x5185('0xd')](_0x4f20a2));if(_0x4f20a2[_0x5185('0xe')]){if(_0x4f20a2[_0x5185('0xe')][_0x5185('0xf')]===0x1f4){logger['error'](_0x5185('0x10'),_0xfe3ca6,_0x4f20a2[_0x5185('0xe')]['message']);return _0x41dd0f(_0x4f20a2[_0x5185('0xe')][_0x5185('0x11')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0xfe3ca6,_0x4f20a2[_0x5185('0xe')][_0x5185('0x11')]);return _0x5c7eb6(_0x4f20a2[_0x5185('0xe')][_0x5185('0x11')]);}else{logger[_0x5185('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0xfe3ca6,'request\x20sent');_0x5c7eb6(_0x4f20a2[_0x5185('0x12')][_0x5185('0x11')]);}})[_0x5185('0x13')](function(_0x455fd2){logger[_0x5185('0xe')](_0x5185('0x10'),_0xfe3ca6,_0x455fd2);_0x41dd0f(_0x455fd2);});});} \ No newline at end of file +var _0x90ca=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x411efb,_0x507d52){var _0x5e3952=function(_0x3ffc78){while(--_0x3ffc78){_0x411efb['push'](_0x411efb['shift']());}};_0x5e3952(++_0x507d52);}(_0x90ca,0xf0));var _0xa90c=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x90ca[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0xa90c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa90c('0x1'));var rs=require(_0xa90c('0x2'));var fs=require('fs');var Redis=require(_0xa90c('0x3'));var db=require(_0xa90c('0x4'))['db'];var utils=require(_0xa90c('0x5'));var logger=require('../../config/logger')(_0xa90c('0x6'));var config=require(_0xa90c('0x7'));var jayson=require(_0xa90c('0x8'));var client=jayson[_0xa90c('0x9')][_0xa90c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4db424,_0x4bebfc,_0x4d9f2d){return new BPromise(function(_0x4ae3e0,_0xa90f71){return client[_0xa90c('0xb')](_0x4db424,_0x4d9f2d)[_0xa90c('0xc')](function(_0x54bebb){logger[_0xa90c('0xd')](_0xa90c('0xe'),_0x4bebfc,_0xa90c('0xf'));logger[_0xa90c('0x10')](_0xa90c('0x11'),_0x4bebfc,_0xa90c('0xf'),JSON[_0xa90c('0x12')](_0x54bebb));if(_0x54bebb[_0xa90c('0x13')]){if(_0x54bebb[_0xa90c('0x13')][_0xa90c('0x14')]===0x1f4){logger[_0xa90c('0x13')](_0xa90c('0xe'),_0x4bebfc,_0x54bebb[_0xa90c('0x13')][_0xa90c('0x15')]);return _0xa90f71(_0x54bebb[_0xa90c('0x13')][_0xa90c('0x15')]);}logger[_0xa90c('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x4bebfc,_0x54bebb[_0xa90c('0x13')][_0xa90c('0x15')]);return _0x4ae3e0(_0x54bebb[_0xa90c('0x13')][_0xa90c('0x15')]);}else{logger[_0xa90c('0xd')](_0xa90c('0xe'),_0x4bebfc,_0xa90c('0xf'));_0x4ae3e0(_0x54bebb[_0xa90c('0x16')]['message']);}})[_0xa90c('0x17')](function(_0x2e0765){logger['error'](_0xa90c('0xe'),_0x4bebfc,_0x2e0765);_0xa90f71(_0x2e0765);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2d28d70..55ec89d 100644 --- a/server/api/faxTransferReport/index.js +++ b/server/api/faxTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x890e=['show','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x10221b,_0x4202b8){var _0x40e259=function(_0x389b79){while(--_0x389b79){_0x10221b['push'](_0x10221b['shift']());}};_0x40e259(++_0x4202b8);}(_0x890e,0x6f));var _0xe890=function(_0x5ebcc5,_0x52fcac){_0x5ebcc5=_0x5ebcc5-0x0;var _0x4548a9=_0x890e[_0x5ebcc5];return _0x4548a9;};'use strict';var multer=require(_0xe890('0x0'));var util=require(_0xe890('0x1'));var path=require('path');var timeout=require(_0xe890('0x2'));var express=require(_0xe890('0x3'));var router=express[_0xe890('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe890('0x5'));var interaction=require(_0xe890('0x6'));var config=require(_0xe890('0x7'));var controller=require(_0xe890('0x8'));router[_0xe890('0x9')]('/',auth[_0xe890('0xa')](),controller[_0xe890('0xb')]);router['get'](_0xe890('0xc'),auth['isAuthenticated'](),controller[_0xe890('0xd')]);router[_0xe890('0x9')](_0xe890('0xe'),auth[_0xe890('0xa')](),controller[_0xe890('0xf')]);router['post']('/',auth[_0xe890('0xa')](),controller[_0xe890('0x10')]);router['put']('/:id',auth[_0xe890('0xa')](),controller[_0xe890('0x11')]);router[_0xe890('0x12')](_0xe890('0xe'),auth[_0xe890('0xa')](),controller[_0xe890('0x13')]);module[_0xe890('0x14')]=router; \ No newline at end of file +var _0xf14f=['./faxTransferReport.controller','isAuthenticated','index','get','describe','post','put','/:id','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17432e,_0x2434bf){var _0x2080fe=function(_0x12b079){while(--_0x12b079){_0x17432e['push'](_0x17432e['shift']());}};_0x2080fe(++_0x2434bf);}(_0xf14f,0x188));var _0xff14=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0xf14f[_0x25bca6];return _0x3f8d02;};'use strict';var multer=require(_0xff14('0x0'));var util=require(_0xff14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xff14('0x2'));var router=express['Router']();var fs_extra=require(_0xff14('0x3'));var auth=require(_0xff14('0x4'));var interaction=require(_0xff14('0x5'));var config=require(_0xff14('0x6'));var controller=require(_0xff14('0x7'));router['get']('/',auth[_0xff14('0x8')](),controller[_0xff14('0x9')]);router[_0xff14('0xa')]('/describe',auth[_0xff14('0x8')](),controller[_0xff14('0xb')]);router[_0xff14('0xa')]('/:id',auth[_0xff14('0x8')](),controller['show']);router[_0xff14('0xc')]('/',auth[_0xff14('0x8')](),controller['create']);router[_0xff14('0xd')](_0xff14('0xe'),auth[_0xff14('0x8')](),controller[_0xff14('0xf')]);router[_0xff14('0x10')](_0xff14('0xe'),auth[_0xff14('0x8')](),controller[_0xff14('0x11')]);module[_0xff14('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 7feeecb..8542ac1 100644 --- a/server/api/intDeskAccount/index.js +++ b/server/api/intDeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe312=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./intDeskAccount.controller','get'];(function(_0x5a03c9,_0x1aacab){var _0x7eb510=function(_0x5962d9){while(--_0x5962d9){_0x5a03c9['push'](_0x5a03c9['shift']());}};_0x7eb510(++_0x1aacab);}(_0xe312,0x19c));var _0x2e31=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xe312[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require(_0x2e31('0x0'));var util=require(_0x2e31('0x1'));var path=require(_0x2e31('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2e31('0x3')]();var fs_extra=require(_0x2e31('0x4'));var auth=require(_0x2e31('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2e31('0x6'));router[_0x2e31('0x7')]('/',auth[_0x2e31('0x8')](),controller[_0x2e31('0x9')]);router[_0x2e31('0x7')](_0x2e31('0xa'),auth[_0x2e31('0x8')](),controller[_0x2e31('0xb')]);router[_0x2e31('0x7')](_0x2e31('0xc'),auth[_0x2e31('0x8')](),controller[_0x2e31('0xd')]);router[_0x2e31('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2e31('0xe')]);router[_0x2e31('0xf')]('/',auth[_0x2e31('0x8')](),controller[_0x2e31('0x10')]);router[_0x2e31('0xf')]('/:id/configurations',auth[_0x2e31('0x8')](),controller[_0x2e31('0x11')]);router[_0x2e31('0x12')]('/:id',auth[_0x2e31('0x8')](),controller[_0x2e31('0x13')]);router['delete']('/:id',auth[_0x2e31('0x8')](),controller['destroy']);module[_0x2e31('0x14')]=router; \ No newline at end of file +var _0x9b1e=['/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./intDeskAccount.controller','get','isAuthenticated','index'];(function(_0x507743,_0x2b1454){var _0x416a31=function(_0x4fdf10){while(--_0x4fdf10){_0x507743['push'](_0x507743['shift']());}};_0x416a31(++_0x2b1454);}(_0x9b1e,0xfd));var _0xe9b1=function(_0x51edd3,_0x5b97dc){_0x51edd3=_0x51edd3-0x0;var _0x14684a=_0x9b1e[_0x51edd3];return _0x14684a;};'use strict';var multer=require(_0xe9b1('0x0'));var util=require(_0xe9b1('0x1'));var path=require(_0xe9b1('0x2'));var timeout=require(_0xe9b1('0x3'));var express=require(_0xe9b1('0x4'));var router=express[_0xe9b1('0x5')]();var fs_extra=require(_0xe9b1('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe9b1('0x7'));router[_0xe9b1('0x8')]('/',auth[_0xe9b1('0x9')](),controller[_0xe9b1('0xa')]);router[_0xe9b1('0x8')](_0xe9b1('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xe9b1('0xc')]);router['get'](_0xe9b1('0xd'),auth[_0xe9b1('0x9')](),controller[_0xe9b1('0xe')]);router[_0xe9b1('0xf')]('/',auth[_0xe9b1('0x9')](),controller[_0xe9b1('0x10')]);router['post'](_0xe9b1('0x11'),auth[_0xe9b1('0x9')](),controller['addConfiguration']);router['put']('/:id',auth[_0xe9b1('0x9')](),controller[_0xe9b1('0x12')]);router[_0xe9b1('0x13')](_0xe9b1('0xb'),auth['isAuthenticated'](),controller[_0xe9b1('0x14')]);module[_0xe9b1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index d6c9109..4c8ee24 100644 --- a/server/api/intDeskAccount/intDeskAccount.attributes.js +++ b/server/api/intDeskAccount/intDeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8544=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x571a64,_0x3a71a0){var _0x2a95a1=function(_0x4905ef){while(--_0x4905ef){_0x571a64['push'](_0x571a64['shift']());}};_0x2a95a1(++_0x3a71a0);}(_0x8544,0x131));var _0x4854=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x8544[_0x166d93];return _0xba708;};'use strict';var Sequelize=require(_0x4854('0x0'));module[_0x4854('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4854('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4854('0x2')]},'authType':{'type':Sequelize[_0x4854('0x3')](_0x4854('0x4')),'defaultValue':_0x4854('0x4')},'password':{'type':Sequelize[_0x4854('0x2')]},'consumerKey':{'type':Sequelize[_0x4854('0x2')]},'consumerSecret':{'type':Sequelize[_0x4854('0x2')]},'token':{'type':Sequelize[_0x4854('0x2')]},'tokenSecret':{'type':Sequelize[_0x4854('0x2')]},'serverUrl':{'type':Sequelize[_0x4854('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4854('0x3')](_0x4854('0x5'),_0x4854('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x74ea=['integrationTab','newTab','exports','STRING','basic','ENUM'];(function(_0x2bc54c,_0x4e8bb4){var _0x445db8=function(_0x34ab28){while(--_0x34ab28){_0x2bc54c['push'](_0x2bc54c['shift']());}};_0x445db8(++_0x4e8bb4);}(_0x74ea,0x1e8));var _0xa74e=function(_0x51dc1d,_0x5760c9){_0x51dc1d=_0x51dc1d-0x0;var _0x5de4b2=_0x74ea[_0x51dc1d];return _0x5de4b2;};'use strict';var Sequelize=require('sequelize');module[_0xa74e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa74e('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xa74e('0x2')),'defaultValue':_0xa74e('0x2')},'password':{'type':Sequelize[_0xa74e('0x1')]},'consumerKey':{'type':Sequelize[_0xa74e('0x1')]},'consumerSecret':{'type':Sequelize[_0xa74e('0x1')]},'token':{'type':Sequelize[_0xa74e('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa74e('0x3')](_0xa74e('0x4'),_0xa74e('0x5')),'defaultValue':_0xa74e('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f112dbe..84ab886 100644 --- a/server/api/intDeskAccount/intDeskAccount.controller.js +++ b/server/api/intDeskAccount/intDeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2702=['Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','base64','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','nolimit','sort','where','pick','filter','merge','DeskAccount','includeAll','include','rows','catch','show','params','keys','intersection','fields','length','find','create','update','body','getConfigurations','findOne','DeskConfiguration','order','hasOwnProperty','offset','addConfiguration','AccountId','Subjects','getSubjects','channel'];(function(_0x49dd75,_0x370818){var _0x340a46=function(_0x2e3cfb){while(--_0x2e3cfb){_0x49dd75['push'](_0x49dd75['shift']());}};_0x340a46(++_0x370818);}(_0x2702,0x104));var _0x2270=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x2702[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x2270('0x0'));var rimraf=require(_0x2270('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2270('0x2'));var rp=require(_0x2270('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2270('0x4'));var util=require('util');var path=require(_0x2270('0x5'));var sox=require(_0x2270('0x6'));var csv=require(_0x2270('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2270('0x8'));var _=require('lodash');var squel=require(_0x2270('0x9'));var crypto=require(_0x2270('0xa'));var jsforce=require(_0x2270('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2270('0xc'));var Papa=require(_0x2270('0xd'));var Redis=require(_0x2270('0xe'));var authService=require(_0x2270('0xf'));var qs=require(_0x2270('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2270('0x11'));var logger=require(_0x2270('0x12'))(_0x2270('0x13'));var utils=require(_0x2270('0x14'));var config=require(_0x2270('0x15'));var licenseUtil=require(_0x2270('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2270('0x17'));function respondWithStatusCode(_0x4639b7,_0x5b82bc){_0x5b82bc=_0x5b82bc||0xcc;return function(_0x5ee892){if(_0x5ee892){return _0x4639b7[_0x2270('0x18')](_0x5b82bc);}return _0x4639b7[_0x2270('0x19')](_0x5b82bc)[_0x2270('0x1a')]();};}function respondWithResult(_0x594176,_0x3f04bb){_0x3f04bb=_0x3f04bb||0xc8;return function(_0x391729){if(_0x391729){return _0x594176[_0x2270('0x19')](_0x3f04bb)[_0x2270('0x1b')](_0x391729);}};}function respondWithFilteredResult(_0x2181de,_0x49f85c){return function(_0x2a2a89){if(_0x2a2a89){var _0xee5227=typeof _0x49f85c['offset']==='undefined'&&typeof _0x49f85c[_0x2270('0x1c')]===_0x2270('0x1d');var _0x4b2de3=_0x2a2a89[_0x2270('0x1e')];var _0x53efe7=_0xee5227?0x0:_0x49f85c['offset'];var _0x2ec346=_0xee5227?_0x2a2a89[_0x2270('0x1e')]:_0x49f85c['offset']+_0x49f85c['limit'];var _0x186cbb;if(_0x2ec346>=_0x4b2de3){_0x2ec346=_0x4b2de3;_0x186cbb=0xc8;}else{_0x186cbb=0xce;}_0x2181de['status'](_0x186cbb);return _0x2181de[_0x2270('0x1f')]('Content-Range',_0x53efe7+'-'+_0x2ec346+'/'+_0x4b2de3)[_0x2270('0x1b')](_0x2a2a89);}return null;};}function patchUpdates(_0x263582){return function(_0x418bbd){try{jsonpatch[_0x2270('0x20')](_0x418bbd,_0x263582,!![]);}catch(_0x11b3fd){return BPromise[_0x2270('0x21')](_0x11b3fd);}return _0x418bbd[_0x2270('0x22')]();};}function saveUpdates(_0x314ec5,_0x4564c8){return function(_0x35977c){if(_0x35977c){return _0x35977c['update'](_0x314ec5)[_0x2270('0x23')](function(_0x432be4){return _0x432be4;});}return null;};}function removeEntity(_0x5b27ae,_0x18a9fd){return function(_0x58f607){if(_0x58f607){return _0x58f607[_0x2270('0x24')]()[_0x2270('0x23')](function(){_0x5b27ae['status'](0xcc)[_0x2270('0x1a')]();});}};}function handleEntityNotFound(_0x4826a4,_0x9852a5){return function(_0x57e6e4){if(!_0x57e6e4){_0x4826a4[_0x2270('0x18')](0x194);}return _0x57e6e4;};}function handleError(_0x4c3022,_0x1f5b79){_0x1f5b79=_0x1f5b79||0x1f4;return function(_0x27ab1f){logger[_0x2270('0x25')](_0x27ab1f[_0x2270('0x26')]);if(_0x27ab1f[_0x2270('0x27')]){delete _0x27ab1f[_0x2270('0x27')];}_0x4c3022[_0x2270('0x19')](_0x1f5b79)[_0x2270('0x28')](_0x27ab1f);};}exports[_0x2270('0x29')]=function(_0x2b77de,_0x721843){var _0x6864ad={},_0x29cf35={},_0x5af648={'count':0x0,'rows':[]};var _0x15595c=_[_0x2270('0x2a')](db['DeskAccount'][_0x2270('0x2b')],function(_0x72bf52){return{'name':_0x72bf52[_0x2270('0x2c')],'type':_0x72bf52[_0x2270('0x2d')]['key']};});_0x29cf35[_0x2270('0x2e')]=_[_0x2270('0x2a')](_0x15595c,'name');_0x29cf35[_0x2270('0x2f')]=_['keys'](_0x2b77de[_0x2270('0x2f')]);_0x29cf35[_0x2270('0x30')]=_['intersection'](_0x29cf35[_0x2270('0x2e')],_0x29cf35[_0x2270('0x2f')]);_0x6864ad['attributes']=_['intersection'](_0x29cf35[_0x2270('0x2e')],qs['fields'](_0x2b77de[_0x2270('0x2f')]['fields']));_0x6864ad[_0x2270('0x31')]=_0x6864ad[_0x2270('0x31')]['length']?_0x6864ad[_0x2270('0x31')]:_0x29cf35[_0x2270('0x2e')];if(!_0x2b77de[_0x2270('0x2f')]['hasOwnProperty'](_0x2270('0x32'))){_0x6864ad['limit']=qs[_0x2270('0x1c')](_0x2b77de[_0x2270('0x2f')]['limit']);_0x6864ad['offset']=qs['offset'](_0x2b77de['query']['offset']);}_0x6864ad['order']=qs[_0x2270('0x33')](_0x2b77de[_0x2270('0x2f')]['sort']);_0x6864ad[_0x2270('0x34')]=qs[_0x2270('0x30')](_[_0x2270('0x35')](_0x2b77de[_0x2270('0x2f')],_0x29cf35['filters']),_0x15595c);if(_0x2b77de[_0x2270('0x2f')][_0x2270('0x36')]){_0x6864ad['where']=_['merge'](_0x6864ad[_0x2270('0x34')],{'$or':_[_0x2270('0x2a')](_0x15595c,function(_0x61b714){if(_0x61b714[_0x2270('0x2d')]!=='VIRTUAL'){var _0x31c2c7={};_0x31c2c7[_0x61b714[_0x2270('0x27')]]={'$like':'%'+_0x2b77de[_0x2270('0x2f')][_0x2270('0x36')]+'%'};return _0x31c2c7;}})});}_0x6864ad=_[_0x2270('0x37')]({},_0x6864ad,_0x2b77de['options']);var _0x342333={'where':_0x6864ad[_0x2270('0x34')]};return db[_0x2270('0x38')]['count'](_0x342333)[_0x2270('0x23')](function(_0x58a443){_0x5af648[_0x2270('0x1e')]=_0x58a443;if(_0x2b77de[_0x2270('0x2f')][_0x2270('0x39')]){_0x6864ad[_0x2270('0x3a')]=[{'all':!![]}];}return db[_0x2270('0x38')]['findAll'](_0x6864ad);})[_0x2270('0x23')](function(_0x1185e){_0x5af648[_0x2270('0x3b')]=_0x1185e;return _0x5af648;})[_0x2270('0x23')](respondWithFilteredResult(_0x721843,_0x6864ad))[_0x2270('0x3c')](handleError(_0x721843,null));};exports[_0x2270('0x3d')]=function(_0x59f656,_0x2683fc){var _0x7cad9c={'raw':![],'where':{'id':_0x59f656[_0x2270('0x3e')]['id']}},_0x553bf2={};_0x553bf2[_0x2270('0x2e')]=_[_0x2270('0x3f')](db[_0x2270('0x38')][_0x2270('0x2b')]);_0x553bf2[_0x2270('0x2f')]=_['keys'](_0x59f656[_0x2270('0x2f')]);_0x553bf2[_0x2270('0x30')]=_[_0x2270('0x40')](_0x553bf2[_0x2270('0x2e')],_0x553bf2[_0x2270('0x2f')]);_0x7cad9c[_0x2270('0x31')]=_[_0x2270('0x40')](_0x553bf2[_0x2270('0x2e')],qs[_0x2270('0x41')](_0x59f656[_0x2270('0x2f')][_0x2270('0x41')]));_0x7cad9c[_0x2270('0x31')]=_0x7cad9c[_0x2270('0x31')][_0x2270('0x42')]?_0x7cad9c[_0x2270('0x31')]:_0x553bf2['model'];if(_0x59f656[_0x2270('0x2f')][_0x2270('0x39')]){_0x7cad9c[_0x2270('0x3a')]=[{'all':!![]}];}_0x7cad9c=_['merge']({},_0x7cad9c,_0x59f656['options']);return db[_0x2270('0x38')][_0x2270('0x43')](_0x7cad9c)[_0x2270('0x23')](handleEntityNotFound(_0x2683fc,null))[_0x2270('0x23')](respondWithResult(_0x2683fc,null))[_0x2270('0x3c')](handleError(_0x2683fc,null));};exports[_0x2270('0x44')]=function(_0x571f10,_0x29f469){return db['DeskAccount'][_0x2270('0x44')](_0x571f10['body'],{})[_0x2270('0x23')](respondWithResult(_0x29f469,0xc9))['catch'](handleError(_0x29f469,null));};exports[_0x2270('0x45')]=function(_0x1fb4b5,_0x88a0a3){if(_0x1fb4b5[_0x2270('0x46')]['id']){delete _0x1fb4b5['body']['id'];}return db['DeskAccount'][_0x2270('0x43')]({'where':{'id':_0x1fb4b5[_0x2270('0x3e')]['id']}})[_0x2270('0x23')](handleEntityNotFound(_0x88a0a3,null))[_0x2270('0x23')](saveUpdates(_0x1fb4b5[_0x2270('0x46')],null))[_0x2270('0x23')](respondWithResult(_0x88a0a3,null))[_0x2270('0x3c')](handleError(_0x88a0a3,null));};exports['destroy']=function(_0x4ca6b9,_0x17ebb8){return db['DeskAccount']['find']({'where':{'id':_0x4ca6b9[_0x2270('0x3e')]['id']}})[_0x2270('0x23')](handleEntityNotFound(_0x17ebb8,null))[_0x2270('0x23')](removeEntity(_0x17ebb8,null))[_0x2270('0x3c')](handleError(_0x17ebb8,null));};exports[_0x2270('0x47')]=function(_0x51b262,_0x4a2c74,_0x518167){var _0x40180e={};var _0xe02ef1={};var _0x2a54ce;var _0x437a7a;return db['DeskAccount'][_0x2270('0x48')]({'where':{'id':_0x51b262[_0x2270('0x3e')]['id']}})[_0x2270('0x23')](handleEntityNotFound(_0x4a2c74,null))[_0x2270('0x23')](function(_0x4aa80e){if(_0x4aa80e){_0x2a54ce=_0x4aa80e;_0xe02ef1[_0x2270('0x2e')]=_['keys'](db[_0x2270('0x49')][_0x2270('0x2b')]);_0xe02ef1[_0x2270('0x2f')]=_[_0x2270('0x3f')](_0x51b262[_0x2270('0x2f')]);_0xe02ef1[_0x2270('0x30')]=_[_0x2270('0x40')](_0xe02ef1['model'],_0xe02ef1[_0x2270('0x2f')]);_0x40180e[_0x2270('0x31')]=_[_0x2270('0x40')](_0xe02ef1[_0x2270('0x2e')],qs[_0x2270('0x41')](_0x51b262['query'][_0x2270('0x41')]));_0x40180e[_0x2270('0x31')]=_0x40180e[_0x2270('0x31')][_0x2270('0x42')]?_0x40180e['attributes']:_0xe02ef1[_0x2270('0x2e')];_0x40180e[_0x2270('0x4a')]=qs[_0x2270('0x33')](_0x51b262[_0x2270('0x2f')]['sort']);_0x40180e[_0x2270('0x34')]=qs[_0x2270('0x30')](_[_0x2270('0x35')](_0x51b262[_0x2270('0x2f')],_0xe02ef1[_0x2270('0x30')]));if(_0x51b262[_0x2270('0x2f')][_0x2270('0x36')]){_0x40180e[_0x2270('0x34')]=_['merge'](_0x40180e[_0x2270('0x34')],{'$or':_[_0x2270('0x2a')](_0x40180e[_0x2270('0x31')],function(_0x273ef3){var _0x7362a1={};_0x7362a1[_0x273ef3]={'$like':'%'+_0x51b262['query'][_0x2270('0x36')]+'%'};return _0x7362a1;})});}_0x40180e=_[_0x2270('0x37')]({},_0x40180e,_0x51b262['options']);return _0x2a54ce[_0x2270('0x47')](_0x40180e);}})['then'](function(_0x14ae85){if(_0x14ae85){_0x437a7a=_0x14ae85['length'];if(!_0x51b262['query'][_0x2270('0x4b')]('nolimit')){_0x40180e[_0x2270('0x1c')]=qs['limit'](_0x51b262[_0x2270('0x2f')]['limit']);_0x40180e[_0x2270('0x4c')]=qs[_0x2270('0x4c')](_0x51b262['query'][_0x2270('0x4c')]);}return _0x2a54ce[_0x2270('0x47')](_0x40180e);}})[_0x2270('0x23')](function(_0x6e9c55){if(_0x6e9c55){return _0x6e9c55?{'count':_0x437a7a,'rows':_0x6e9c55}:null;}})[_0x2270('0x23')](respondWithResult(_0x4a2c74,null))[_0x2270('0x3c')](handleError(_0x4a2c74,null));};exports[_0x2270('0x4d')]=function(_0x1ad2e0,_0x5fa7a8,_0x853c28){if(_0x1ad2e0[_0x2270('0x46')]['id']){delete _0x1ad2e0[_0x2270('0x46')]['id'];}return db[_0x2270('0x38')][_0x2270('0x48')]({'where':{'id':_0x1ad2e0[_0x2270('0x3e')]['id']}})[_0x2270('0x23')](handleEntityNotFound(_0x5fa7a8,null))[_0x2270('0x23')](function(_0x5b4ce8){if(_0x5b4ce8){_0x1ad2e0[_0x2270('0x46')][_0x2270('0x4e')]=_0x5b4ce8['id'];_0x1ad2e0['body'][_0x2270('0x4f')]=integrations[_0x2270('0x50')](_0x1ad2e0[_0x2270('0x46')][_0x2270('0x51')],_0x1ad2e0[_0x2270('0x46')][_0x2270('0x2d')]);_0x1ad2e0['body'][_0x2270('0x52')]=integrations[_0x2270('0x53')](_0x1ad2e0[_0x2270('0x46')]['channel'],_0x1ad2e0[_0x2270('0x46')]['type']);return db[_0x2270('0x49')][_0x2270('0x44')](_0x1ad2e0['body'],{'include':[{'model':db[_0x2270('0x54')],'as':_0x2270('0x4f')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x2270('0x23')](respondWithResult(_0x5fa7a8,null))['catch'](handleError(_0x5fa7a8,null));};exports[_0x2270('0x55')]=function(_0x4d46ea,_0x3f4878,_0xc92913){var _0x251c36=[{'name':_0x2270('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x38fa6b='';return db[_0x2270('0x38')][_0x2270('0x48')]({'where':{'id':_0x4d46ea[_0x2270('0x3e')]['id']},'attributes':['id',_0x2270('0x57'),_0x2270('0x58'),_0x2270('0x59'),_0x2270('0x5a'),_0x2270('0x5b'),_0x2270('0x5c'),_0x2270('0x5d'),_0x2270('0x5e')]})[_0x2270('0x23')](handleEntityNotFound(_0x3f4878,null))[_0x2270('0x23')](function(_0x28c783){if(_0x28c783){_0x38fa6b=_0x28c783[_0x2270('0x57')];var _0x2c261e=_0x38fa6b[_0x2270('0x5f')](-0x1);if(_0x2c261e==='/'){_0x38fa6b=_0x38fa6b[_0x2270('0x60')](0x0,_0x38fa6b['lastIndexOf'](_0x2c261e));}var _0x548102={'method':_0x2270('0x61'),'uri':util[_0x2270('0x62')](_0x2270('0x63'),_0x38fa6b),'headers':{'Content-Type':_0x2270('0x64'),'Accept':_0x2270('0x64')},'json':!![]};if(_0x28c783[_0x2270('0x58')]===_0x2270('0x65')){_0x548102[_0x2270('0x66')][_0x2270('0x67')]=util[_0x2270('0x62')]('Basic\x20%s',new Buffer(util[_0x2270('0x62')]('%s:%s',_0x28c783['username'],_0x28c783[_0x2270('0x5a')]))['toString'](_0x2270('0x68')));}return rp(_0x548102)[_0x2270('0x23')](function(_0x36b08c){return _0x251c36[_0x2270('0x69')](_[_0x2270('0x2a')](_0x36b08c[_0x2270('0x6a')][_0x2270('0x6b')],function(_0x57065d){return{'id':_0x57065d[_0x2270('0x27')],'name':_0x57065d['name'],'type':_0x57065d['type'],'active':_0x57065d[_0x2270('0x6c')],'label':_0x57065d['label'],'custom':!![]};}));});}})[_0x2270('0x23')](function(_0x343603){return{'count':_0x343603[_0x2270('0x42')],'rows':_0x343603};})[_0x2270('0x23')](respondWithResult(_0x3f4878,null))[_0x2270('0x3c')](function(_0x30b2ca){var _0x1754c4=_0x4d46ea[_0x2270('0x2f')][_0x2270('0x6d')]?0x1f4:_0x30b2ca[_0x2270('0x6e')]||0x1f4;logger[_0x2270('0x25')](_0x2270('0x6f'),_0x2270('0x55'),_0x1754c4,JSON[_0x2270('0x70')](_0x30b2ca));delete _0x30b2ca['name'];if(_0x1754c4===0x191){_0x1754c4=0x190;}_0x3f4878[_0x2270('0x19')](_0x1754c4)['send'](_0x4d46ea[_0x2270('0x2f')]['test']?{'message':_0x2270('0x71'),'statusCode':_0x30b2ca[_0x2270('0x6e')]}:_0x30b2ca);});}; \ No newline at end of file +var _0xf8c2=['show','params','rawAttributes','options','find','create','body','update','destroy','getConfigurations','DeskConfiguration','sort','findOne','AccountId','Subjects','getSubjects','getDescriptions','type','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','lastIndexOf','GET','format','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','json','apply','reject','save','then','error','stack','name','send','index','map','DeskAccount','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch'];(function(_0x164fb4,_0xd8353d){var _0x1057fc=function(_0x4fedf4){while(--_0x4fedf4){_0x164fb4['push'](_0x164fb4['shift']());}};_0x1057fc(++_0xd8353d);}(_0xf8c2,0x188));var _0x2f8c=function(_0x4aa9f2,_0x3bec12){_0x4aa9f2=_0x4aa9f2-0x0;var _0x2375ef=_0xf8c2[_0x4aa9f2];return _0x2375ef;};'use strict';var emlformat=require(_0x2f8c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f8c('0x1'));var rp=require(_0x2f8c('0x2'));var moment=require('moment');var BPromise=require(_0x2f8c('0x3'));var Mustache=require('mustache');var util=require(_0x2f8c('0x4'));var path=require(_0x2f8c('0x5'));var sox=require(_0x2f8c('0x6'));var csv=require(_0x2f8c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f8c('0x8'));var _=require(_0x2f8c('0x9'));var squel=require(_0x2f8c('0xa'));var crypto=require(_0x2f8c('0xb'));var jsforce=require(_0x2f8c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2f8c('0xd'));var Redis=require(_0x2f8c('0xe'));var authService=require(_0x2f8c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2f8c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f8c('0x11'))(_0x2f8c('0x12'));var utils=require(_0x2f8c('0x13'));var config=require(_0x2f8c('0x14'));var licenseUtil=require(_0x2f8c('0x15'));var db=require(_0x2f8c('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4f5496,_0x466245){_0x466245=_0x466245||0xcc;return function(_0x34946f){if(_0x34946f){return _0x4f5496[_0x2f8c('0x17')](_0x466245);}return _0x4f5496['status'](_0x466245)[_0x2f8c('0x18')]();};}function respondWithResult(_0x327e25,_0x2ed1b7){_0x2ed1b7=_0x2ed1b7||0xc8;return function(_0x46ff5c){if(_0x46ff5c){return _0x327e25[_0x2f8c('0x19')](_0x2ed1b7)['json'](_0x46ff5c);}};}function respondWithFilteredResult(_0x47bccc,_0x525c0d){return function(_0x363252){if(_0x363252){var _0x664470=typeof _0x525c0d[_0x2f8c('0x1a')]===_0x2f8c('0x1b')&&typeof _0x525c0d['limit']===_0x2f8c('0x1b');var _0x51e76f=_0x363252['count'];var _0x5aa147=_0x664470?0x0:_0x525c0d[_0x2f8c('0x1a')];var _0x40a0ba=_0x664470?_0x363252[_0x2f8c('0x1c')]:_0x525c0d[_0x2f8c('0x1a')]+_0x525c0d[_0x2f8c('0x1d')];var _0x172190;if(_0x40a0ba>=_0x51e76f){_0x40a0ba=_0x51e76f;_0x172190=0xc8;}else{_0x172190=0xce;}_0x47bccc[_0x2f8c('0x19')](_0x172190);return _0x47bccc[_0x2f8c('0x1e')]('Content-Range',_0x5aa147+'-'+_0x40a0ba+'/'+_0x51e76f)[_0x2f8c('0x1f')](_0x363252);}return null;};}function patchUpdates(_0xae27c7){return function(_0x47722b){try{jsonpatch[_0x2f8c('0x20')](_0x47722b,_0xae27c7,!![]);}catch(_0x5af2d6){return BPromise[_0x2f8c('0x21')](_0x5af2d6);}return _0x47722b[_0x2f8c('0x22')]();};}function saveUpdates(_0x2e9eea,_0x4e36fe){return function(_0x31ef1e){if(_0x31ef1e){return _0x31ef1e['update'](_0x2e9eea)[_0x2f8c('0x23')](function(_0x166ecd){return _0x166ecd;});}return null;};}function removeEntity(_0x5aafde,_0x48fba7){return function(_0x4a592b){if(_0x4a592b){return _0x4a592b['destroy']()['then'](function(){_0x5aafde[_0x2f8c('0x19')](0xcc)[_0x2f8c('0x18')]();});}};}function handleEntityNotFound(_0x4cb763,_0x30810e){return function(_0x2904c3){if(!_0x2904c3){_0x4cb763[_0x2f8c('0x17')](0x194);}return _0x2904c3;};}function handleError(_0x2cc3b8,_0x134a56){_0x134a56=_0x134a56||0x1f4;return function(_0xf07aa3){logger[_0x2f8c('0x24')](_0xf07aa3[_0x2f8c('0x25')]);if(_0xf07aa3[_0x2f8c('0x26')]){delete _0xf07aa3[_0x2f8c('0x26')];}_0x2cc3b8[_0x2f8c('0x19')](_0x134a56)[_0x2f8c('0x27')](_0xf07aa3);};}exports[_0x2f8c('0x28')]=function(_0x26fc69,_0x7ec36b){var _0x10bd27={},_0x3b886c={},_0x401c46={'count':0x0,'rows':[]};var _0x44aa77=_[_0x2f8c('0x29')](db[_0x2f8c('0x2a')]['rawAttributes'],function(_0x1e98a0){return{'name':_0x1e98a0['fieldName'],'type':_0x1e98a0['type'][_0x2f8c('0x2b')]};});_0x3b886c['model']=_['map'](_0x44aa77,_0x2f8c('0x26'));_0x3b886c['query']=_[_0x2f8c('0x2c')](_0x26fc69[_0x2f8c('0x2d')]);_0x3b886c[_0x2f8c('0x2e')]=_[_0x2f8c('0x2f')](_0x3b886c[_0x2f8c('0x30')],_0x3b886c[_0x2f8c('0x2d')]);_0x10bd27[_0x2f8c('0x31')]=_[_0x2f8c('0x2f')](_0x3b886c[_0x2f8c('0x30')],qs[_0x2f8c('0x32')](_0x26fc69[_0x2f8c('0x2d')]['fields']));_0x10bd27[_0x2f8c('0x31')]=_0x10bd27[_0x2f8c('0x31')][_0x2f8c('0x33')]?_0x10bd27[_0x2f8c('0x31')]:_0x3b886c[_0x2f8c('0x30')];if(!_0x26fc69[_0x2f8c('0x2d')][_0x2f8c('0x34')](_0x2f8c('0x35'))){_0x10bd27[_0x2f8c('0x1d')]=qs['limit'](_0x26fc69[_0x2f8c('0x2d')][_0x2f8c('0x1d')]);_0x10bd27[_0x2f8c('0x1a')]=qs['offset'](_0x26fc69['query']['offset']);}_0x10bd27[_0x2f8c('0x36')]=qs['sort'](_0x26fc69['query']['sort']);_0x10bd27[_0x2f8c('0x37')]=qs[_0x2f8c('0x2e')](_[_0x2f8c('0x38')](_0x26fc69['query'],_0x3b886c[_0x2f8c('0x2e')]),_0x44aa77);if(_0x26fc69['query']['filter']){_0x10bd27[_0x2f8c('0x37')]=_[_0x2f8c('0x39')](_0x10bd27[_0x2f8c('0x37')],{'$or':_['map'](_0x44aa77,function(_0x24d6a8){if(_0x24d6a8['type']!==_0x2f8c('0x3a')){var _0x2ab671={};_0x2ab671[_0x24d6a8[_0x2f8c('0x26')]]={'$like':'%'+_0x26fc69[_0x2f8c('0x2d')][_0x2f8c('0x3b')]+'%'};return _0x2ab671;}})});}_0x10bd27=_[_0x2f8c('0x39')]({},_0x10bd27,_0x26fc69['options']);var _0x214488={'where':_0x10bd27[_0x2f8c('0x37')]};return db['DeskAccount'][_0x2f8c('0x1c')](_0x214488)[_0x2f8c('0x23')](function(_0x41cce2){_0x401c46[_0x2f8c('0x1c')]=_0x41cce2;if(_0x26fc69[_0x2f8c('0x2d')][_0x2f8c('0x3c')]){_0x10bd27[_0x2f8c('0x3d')]=[{'all':!![]}];}return db[_0x2f8c('0x2a')]['findAll'](_0x10bd27);})['then'](function(_0x2bbdb0){_0x401c46[_0x2f8c('0x3e')]=_0x2bbdb0;return _0x401c46;})[_0x2f8c('0x23')](respondWithFilteredResult(_0x7ec36b,_0x10bd27))[_0x2f8c('0x3f')](handleError(_0x7ec36b,null));};exports[_0x2f8c('0x40')]=function(_0x1734bb,_0x981faa){var _0x58aa6d={'raw':![],'where':{'id':_0x1734bb[_0x2f8c('0x41')]['id']}},_0x1a7aff={};_0x1a7aff[_0x2f8c('0x30')]=_[_0x2f8c('0x2c')](db[_0x2f8c('0x2a')][_0x2f8c('0x42')]);_0x1a7aff[_0x2f8c('0x2d')]=_['keys'](_0x1734bb[_0x2f8c('0x2d')]);_0x1a7aff[_0x2f8c('0x2e')]=_[_0x2f8c('0x2f')](_0x1a7aff[_0x2f8c('0x30')],_0x1a7aff[_0x2f8c('0x2d')]);_0x58aa6d[_0x2f8c('0x31')]=_[_0x2f8c('0x2f')](_0x1a7aff[_0x2f8c('0x30')],qs[_0x2f8c('0x32')](_0x1734bb[_0x2f8c('0x2d')][_0x2f8c('0x32')]));_0x58aa6d[_0x2f8c('0x31')]=_0x58aa6d['attributes'][_0x2f8c('0x33')]?_0x58aa6d[_0x2f8c('0x31')]:_0x1a7aff[_0x2f8c('0x30')];if(_0x1734bb[_0x2f8c('0x2d')][_0x2f8c('0x3c')]){_0x58aa6d[_0x2f8c('0x3d')]=[{'all':!![]}];}_0x58aa6d=_[_0x2f8c('0x39')]({},_0x58aa6d,_0x1734bb[_0x2f8c('0x43')]);return db[_0x2f8c('0x2a')][_0x2f8c('0x44')](_0x58aa6d)[_0x2f8c('0x23')](handleEntityNotFound(_0x981faa,null))[_0x2f8c('0x23')](respondWithResult(_0x981faa,null))[_0x2f8c('0x3f')](handleError(_0x981faa,null));};exports[_0x2f8c('0x45')]=function(_0x499c8c,_0xd5c1b4){return db[_0x2f8c('0x2a')][_0x2f8c('0x45')](_0x499c8c[_0x2f8c('0x46')],{})[_0x2f8c('0x23')](respondWithResult(_0xd5c1b4,0xc9))['catch'](handleError(_0xd5c1b4,null));};exports[_0x2f8c('0x47')]=function(_0x56f8c9,_0x4390bd){if(_0x56f8c9['body']['id']){delete _0x56f8c9['body']['id'];}return db[_0x2f8c('0x2a')][_0x2f8c('0x44')]({'where':{'id':_0x56f8c9['params']['id']}})['then'](handleEntityNotFound(_0x4390bd,null))[_0x2f8c('0x23')](saveUpdates(_0x56f8c9[_0x2f8c('0x46')],null))[_0x2f8c('0x23')](respondWithResult(_0x4390bd,null))[_0x2f8c('0x3f')](handleError(_0x4390bd,null));};exports[_0x2f8c('0x48')]=function(_0x3acee8,_0x102f2f){return db[_0x2f8c('0x2a')][_0x2f8c('0x44')]({'where':{'id':_0x3acee8['params']['id']}})['then'](handleEntityNotFound(_0x102f2f,null))[_0x2f8c('0x23')](removeEntity(_0x102f2f,null))[_0x2f8c('0x3f')](handleError(_0x102f2f,null));};exports[_0x2f8c('0x49')]=function(_0x68582a,_0x401277,_0x43e54f){var _0x3ab690={};var _0x7aa5a3={};var _0x36fab9;var _0x493af6;return db[_0x2f8c('0x2a')]['findOne']({'where':{'id':_0x68582a[_0x2f8c('0x41')]['id']}})[_0x2f8c('0x23')](handleEntityNotFound(_0x401277,null))[_0x2f8c('0x23')](function(_0x4a405a){if(_0x4a405a){_0x36fab9=_0x4a405a;_0x7aa5a3['model']=_[_0x2f8c('0x2c')](db[_0x2f8c('0x4a')][_0x2f8c('0x42')]);_0x7aa5a3[_0x2f8c('0x2d')]=_['keys'](_0x68582a[_0x2f8c('0x2d')]);_0x7aa5a3[_0x2f8c('0x2e')]=_[_0x2f8c('0x2f')](_0x7aa5a3[_0x2f8c('0x30')],_0x7aa5a3[_0x2f8c('0x2d')]);_0x3ab690[_0x2f8c('0x31')]=_[_0x2f8c('0x2f')](_0x7aa5a3['model'],qs[_0x2f8c('0x32')](_0x68582a[_0x2f8c('0x2d')][_0x2f8c('0x32')]));_0x3ab690[_0x2f8c('0x31')]=_0x3ab690['attributes']['length']?_0x3ab690[_0x2f8c('0x31')]:_0x7aa5a3['model'];_0x3ab690[_0x2f8c('0x36')]=qs[_0x2f8c('0x4b')](_0x68582a[_0x2f8c('0x2d')]['sort']);_0x3ab690[_0x2f8c('0x37')]=qs[_0x2f8c('0x2e')](_[_0x2f8c('0x38')](_0x68582a[_0x2f8c('0x2d')],_0x7aa5a3[_0x2f8c('0x2e')]));if(_0x68582a['query']['filter']){_0x3ab690[_0x2f8c('0x37')]=_[_0x2f8c('0x39')](_0x3ab690[_0x2f8c('0x37')],{'$or':_[_0x2f8c('0x29')](_0x3ab690[_0x2f8c('0x31')],function(_0x2fe86b){var _0x5f5ec4={};_0x5f5ec4[_0x2fe86b]={'$like':'%'+_0x68582a['query'][_0x2f8c('0x3b')]+'%'};return _0x5f5ec4;})});}_0x3ab690=_[_0x2f8c('0x39')]({},_0x3ab690,_0x68582a[_0x2f8c('0x43')]);return _0x36fab9[_0x2f8c('0x49')](_0x3ab690);}})[_0x2f8c('0x23')](function(_0x149227){if(_0x149227){_0x493af6=_0x149227[_0x2f8c('0x33')];if(!_0x68582a['query'][_0x2f8c('0x34')](_0x2f8c('0x35'))){_0x3ab690[_0x2f8c('0x1d')]=qs[_0x2f8c('0x1d')](_0x68582a[_0x2f8c('0x2d')][_0x2f8c('0x1d')]);_0x3ab690[_0x2f8c('0x1a')]=qs[_0x2f8c('0x1a')](_0x68582a[_0x2f8c('0x2d')][_0x2f8c('0x1a')]);}return _0x36fab9[_0x2f8c('0x49')](_0x3ab690);}})['then'](function(_0x3591b5){if(_0x3591b5){return _0x3591b5?{'count':_0x493af6,'rows':_0x3591b5}:null;}})[_0x2f8c('0x23')](respondWithResult(_0x401277,null))[_0x2f8c('0x3f')](handleError(_0x401277,null));};exports['addConfiguration']=function(_0x5e691f,_0x44ad26,_0x3994d9){if(_0x5e691f[_0x2f8c('0x46')]['id']){delete _0x5e691f[_0x2f8c('0x46')]['id'];}return db[_0x2f8c('0x2a')][_0x2f8c('0x4c')]({'where':{'id':_0x5e691f[_0x2f8c('0x41')]['id']}})[_0x2f8c('0x23')](handleEntityNotFound(_0x44ad26,null))[_0x2f8c('0x23')](function(_0x47700f){if(_0x47700f){_0x5e691f['body'][_0x2f8c('0x4d')]=_0x47700f['id'];_0x5e691f['body'][_0x2f8c('0x4e')]=integrations[_0x2f8c('0x4f')](_0x5e691f[_0x2f8c('0x46')]['channel'],_0x5e691f[_0x2f8c('0x46')]['type']);_0x5e691f[_0x2f8c('0x46')]['Descriptions']=integrations[_0x2f8c('0x50')](_0x5e691f['body']['channel'],_0x5e691f[_0x2f8c('0x46')][_0x2f8c('0x51')]);return db['DeskConfiguration']['create'](_0x5e691f['body'],{'include':[{'model':db[_0x2f8c('0x52')],'as':_0x2f8c('0x4e')},{'model':db[_0x2f8c('0x52')],'as':_0x2f8c('0x53')}]});}return null;})[_0x2f8c('0x23')](respondWithResult(_0x44ad26,null))[_0x2f8c('0x3f')](handleError(_0x44ad26,null));};exports['getFields']=function(_0x306a7d,_0x5c64dc,_0x346cc2){var _0x4d3d03=[{'name':_0x2f8c('0x54'),'label':_0x2f8c('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x220177='';return db[_0x2f8c('0x2a')][_0x2f8c('0x4c')]({'where':{'id':_0x306a7d[_0x2f8c('0x41')]['id']},'attributes':['id',_0x2f8c('0x55'),_0x2f8c('0x56'),_0x2f8c('0x57'),_0x2f8c('0x58'),_0x2f8c('0x59'),_0x2f8c('0x5a'),_0x2f8c('0x5b'),_0x2f8c('0x5c')]})[_0x2f8c('0x23')](handleEntityNotFound(_0x5c64dc,null))[_0x2f8c('0x23')](function(_0x374bac){if(_0x374bac){_0x220177=_0x374bac[_0x2f8c('0x55')];var _0x555e72=_0x220177[_0x2f8c('0x5d')](-0x1);if(_0x555e72==='/'){_0x220177=_0x220177['substring'](0x0,_0x220177[_0x2f8c('0x5e')](_0x555e72));}var _0x163722={'method':_0x2f8c('0x5f'),'uri':util[_0x2f8c('0x60')]('%s/custom_fields',_0x220177),'headers':{'Content-Type':_0x2f8c('0x61'),'Accept':'application/json'},'json':!![]};if(_0x374bac[_0x2f8c('0x56')]===_0x2f8c('0x62')){_0x163722['headers'][_0x2f8c('0x63')]=util['format'](_0x2f8c('0x64'),new Buffer(util[_0x2f8c('0x60')](_0x2f8c('0x65'),_0x374bac[_0x2f8c('0x57')],_0x374bac[_0x2f8c('0x58')]))[_0x2f8c('0x66')](_0x2f8c('0x67')));}return rp(_0x163722)[_0x2f8c('0x23')](function(_0x4098ba){return _0x4d3d03[_0x2f8c('0x68')](_['map'](_0x4098ba[_0x2f8c('0x69')][_0x2f8c('0x6a')],function(_0x7db6e2){return{'id':_0x7db6e2['name'],'name':_0x7db6e2[_0x2f8c('0x26')],'type':_0x7db6e2[_0x2f8c('0x51')],'active':_0x7db6e2['active'],'label':_0x7db6e2[_0x2f8c('0x6b')],'custom':!![]};}));});}})[_0x2f8c('0x23')](function(_0x453cea){return{'count':_0x453cea['length'],'rows':_0x453cea};})[_0x2f8c('0x23')](respondWithResult(_0x5c64dc,null))[_0x2f8c('0x3f')](function(_0xf0d899){var _0x4d8285=_0x306a7d[_0x2f8c('0x2d')][_0x2f8c('0x6c')]?0x1f4:_0xf0d899[_0x2f8c('0x6d')]||0x1f4;logger[_0x2f8c('0x24')](_0x2f8c('0x6e'),_0x2f8c('0x6f'),_0x4d8285,JSON[_0x2f8c('0x70')](_0xf0d899));delete _0xf0d899[_0x2f8c('0x26')];if(_0x4d8285===0x191){_0x4d8285=0x190;}_0x5c64dc[_0x2f8c('0x19')](_0x4d8285)['send'](_0x306a7d['query'][_0x2f8c('0x6c')]?{'message':_0x2f8c('0x71'),'statusCode':_0xf0d899[_0x2f8c('0x6d')]}:_0xf0d899);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8d644f2..591dc42 100644 --- a/server/api/intDeskAccount/intDeskAccount.model.js +++ b/server/api/intDeskAccount/intDeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb84=['rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','request-promise','path'];(function(_0x1d5773,_0x3ddd0b){var _0x4777f4=function(_0x380a13){while(--_0x380a13){_0x1d5773['push'](_0x1d5773['shift']());}};_0x4777f4(++_0x3ddd0b);}(_0xbb84,0x7f));var _0x4bb8=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0xbb84[_0x36bff5];return _0x80ade5;};'use strict';var _=require(_0x4bb8('0x0'));var util=require('util');var logger=require(_0x4bb8('0x1'))(_0x4bb8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4bb8('0x3'));var fs=require('fs');var path=require(_0x4bb8('0x4'));var rimraf=require(_0x4bb8('0x5'));var config=require('../../config/environment');var attributes=require(_0x4bb8('0x6'));var integrations=require(_0x4bb8('0x7'));module['exports']=function(_0x1f3610,_0x372afb){return _0x1f3610[_0x4bb8('0x8')](_0x4bb8('0x9'),attributes,{'tableName':_0x4bb8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc59=['DeskAccount','lodash','util','api','bluebird','path','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4a86f8,_0x5edd40){var _0x5e9383=function(_0x3238ae){while(--_0x3238ae){_0x4a86f8['push'](_0x4a86f8['shift']());}};_0x5e9383(++_0x5edd40);}(_0xfc59,0xfd));var _0x9fc5=function(_0x195ee2,_0x4760d5){_0x195ee2=_0x195ee2-0x0;var _0x5ed5ef=_0xfc59[_0x195ee2];return _0x5ed5ef;};'use strict';var _=require(_0x9fc5('0x0'));var util=require(_0x9fc5('0x1'));var logger=require('../../config/logger')(_0x9fc5('0x2'));var moment=require('moment');var BPromise=require(_0x9fc5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fc5('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9fc5('0x5'));var integrations=require(_0x9fc5('0x6'));module[_0x9fc5('0x7')]=function(_0x189ec7,_0x41b33d){return _0x189ec7['define'](_0x9fc5('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 94282a1..e0cecf9 100644 --- a/server/api/intDeskAccount/intDeskAccount.rpc.js +++ b/server/api/intDeskAccount/intDeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8920=['where','include','model','map','attributes','then','GetDeskAccount','find','ShowDeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','DeskAccount','findAll','options','raw'];(function(_0x1540e8,_0x52b4df){var _0x4eadb1=function(_0x5a1e07){while(--_0x5a1e07){_0x1540e8['push'](_0x1540e8['shift']());}};_0x4eadb1(++_0x52b4df);}(_0x8920,0x1a1));var _0x0892=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8920[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0892('0x0'));var util=require(_0x0892('0x1'));var moment=require(_0x0892('0x2'));var BPromise=require(_0x0892('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0892('0x4'))['db'];var utils=require(_0x0892('0x5'));var logger=require('../../config/logger')(_0x0892('0x6'));var config=require(_0x0892('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0892('0x8')][_0x0892('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7fbde3,_0x17b32e,_0x3401b8){return new BPromise(function(_0x336bd9,_0x655e67){return client['request'](_0x7fbde3,_0x3401b8)['then'](function(_0x5b875a){logger[_0x0892('0xa')]('DeskAccount,\x20%s,\x20%s',_0x17b32e,'request\x20sent');logger[_0x0892('0xb')](_0x0892('0xc'),_0x17b32e,_0x0892('0xd'),JSON[_0x0892('0xe')](_0x5b875a));if(_0x5b875a[_0x0892('0xf')]){if(_0x5b875a[_0x0892('0xf')][_0x0892('0x10')]===0x1f4){logger[_0x0892('0xf')](_0x0892('0x11'),_0x17b32e,_0x5b875a[_0x0892('0xf')][_0x0892('0x12')]);return _0x655e67(_0x5b875a[_0x0892('0xf')][_0x0892('0x12')]);}logger[_0x0892('0xf')]('DeskAccount,\x20%s,\x20%s',_0x17b32e,_0x5b875a[_0x0892('0xf')]['message']);return _0x336bd9(_0x5b875a[_0x0892('0xf')]['message']);}else{logger['info'](_0x0892('0x11'),_0x17b32e,_0x0892('0xd'));_0x336bd9(_0x5b875a[_0x0892('0x13')][_0x0892('0x12')]);}})[_0x0892('0x14')](function(_0x51653f){logger[_0x0892('0xf')](_0x0892('0x11'),_0x17b32e,_0x51653f);_0x655e67(_0x51653f);});});}exports['GetDeskAccount']=function(_0x17fe30){var _0xed7eb0=this;return new Promise(function(_0x3b323f,_0x1cf333){return db[_0x0892('0x15')][_0x0892('0x16')]({'raw':_0x17fe30[_0x0892('0x17')]?_0x17fe30[_0x0892('0x17')][_0x0892('0x18')]===undefined?!![]:![]:!![],'where':_0x17fe30[_0x0892('0x17')]?_0x17fe30['options'][_0x0892('0x19')]||null:null,'attributes':_0x17fe30['options']?_0x17fe30[_0x0892('0x17')]['attributes']||null:null,'limit':_0x17fe30[_0x0892('0x17')]?_0x17fe30[_0x0892('0x17')]['limit']||null:null,'include':_0x17fe30[_0x0892('0x17')]?_0x17fe30[_0x0892('0x17')]['include']?_['map'](_0x17fe30['options'][_0x0892('0x1a')],function(_0x5e2041){return{'model':db[_0x5e2041[_0x0892('0x1b')]],'as':_0x5e2041['as'],'attributes':_0x5e2041['attributes'],'include':_0x5e2041[_0x0892('0x1a')]?_[_0x0892('0x1c')](_0x5e2041[_0x0892('0x1a')],function(_0x12be57){return{'model':db[_0x12be57[_0x0892('0x1b')]],'as':_0x12be57['as'],'attributes':_0x12be57[_0x0892('0x1d')],'include':_0x12be57[_0x0892('0x1a')]?_[_0x0892('0x1c')](_0x12be57[_0x0892('0x1a')],function(_0x26a744){return{'model':db[_0x26a744[_0x0892('0x1b')]],'as':_0x26a744['as'],'attributes':_0x26a744[_0x0892('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0892('0x1e')](function(_0x455140){logger[_0x0892('0xa')](_0x0892('0x1f'),_0x17fe30);logger[_0x0892('0xb')](_0x0892('0x1f'),_0x17fe30,JSON[_0x0892('0xe')](_0x455140));_0x3b323f(_0x455140);})['catch'](function(_0x38063d){logger['error']('GetDeskAccount',_0x38063d['message'],_0x17fe30);_0x1cf333(_0xed7eb0[_0x0892('0xf')](0x1f4,_0x38063d[_0x0892('0x12')]));});});};exports['ShowDeskAccount']=function(_0x10cac8){var _0x5bf1b8=this;return new Promise(function(_0x211814,_0x363a85){return db['DeskAccount'][_0x0892('0x20')]({'raw':_0x10cac8[_0x0892('0x17')]?_0x10cac8[_0x0892('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x10cac8[_0x0892('0x17')]?_0x10cac8['options']['where']||null:null,'attributes':_0x10cac8[_0x0892('0x17')]?_0x10cac8[_0x0892('0x17')][_0x0892('0x1d')]||null:null,'include':_0x10cac8[_0x0892('0x17')]?_0x10cac8['options'][_0x0892('0x1a')]?_['map'](_0x10cac8[_0x0892('0x17')]['include'],function(_0x5d5917){return{'model':db[_0x5d5917[_0x0892('0x1b')]],'as':_0x5d5917['as'],'attributes':_0x5d5917[_0x0892('0x1d')],'include':_0x5d5917[_0x0892('0x1a')]?_[_0x0892('0x1c')](_0x5d5917[_0x0892('0x1a')],function(_0x491a3b){return{'model':db[_0x491a3b[_0x0892('0x1b')]],'as':_0x491a3b['as'],'attributes':_0x491a3b[_0x0892('0x1d')],'include':_0x491a3b[_0x0892('0x1a')]?_[_0x0892('0x1c')](_0x491a3b[_0x0892('0x1a')],function(_0x710bd){return{'model':db[_0x710bd[_0x0892('0x1b')]],'as':_0x710bd['as'],'attributes':_0x710bd[_0x0892('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x121a04){logger[_0x0892('0xa')]('ShowDeskAccount',_0x10cac8);logger[_0x0892('0xb')](_0x0892('0x21'),_0x10cac8,JSON['stringify'](_0x121a04));_0x211814(_0x121a04);})[_0x0892('0x14')](function(_0x853586){logger['error'](_0x0892('0x21'),_0x853586[_0x0892('0x12')],_0x10cac8);_0x363a85(_0x5bf1b8[_0x0892('0xf')](0x1f4,_0x853586[_0x0892('0x12')]));});});}; \ No newline at end of file +var _0xdff3=['info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','DeskAccount','findAll','options','attributes','include','map','model','then','GetDeskAccount','ShowDeskAccount','where','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0xdca4a6,_0x4965f6){var _0x5c5b95=function(_0x2c8fe7){while(--_0x2c8fe7){_0xdca4a6['push'](_0xdca4a6['shift']());}};_0x5c5b95(++_0x4965f6);}(_0xdff3,0xe2));var _0x3dff=function(_0x19cc01,_0x564500){_0x19cc01=_0x19cc01-0x0;var _0xb5835c=_0xdff3[_0x19cc01];return _0xb5835c;};'use strict';var _=require(_0x3dff('0x0'));var util=require(_0x3dff('0x1'));var moment=require('moment');var BPromise=require(_0x3dff('0x2'));var rs=require(_0x3dff('0x3'));var fs=require('fs');var Redis=require(_0x3dff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3dff('0x5'));var logger=require(_0x3dff('0x6'))(_0x3dff('0x7'));var config=require(_0x3dff('0x8'));var jayson=require(_0x3dff('0x9'));var client=jayson['client'][_0x3dff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x370dbf,_0x9490de,_0x584fa3){return new BPromise(function(_0x3fc96,_0x73c5e4){return client[_0x3dff('0xb')](_0x370dbf,_0x584fa3)['then'](function(_0x4ca065){logger[_0x3dff('0xc')](_0x3dff('0xd'),_0x9490de,_0x3dff('0xe'));logger[_0x3dff('0xf')](_0x3dff('0x10'),_0x9490de,'request\x20sent',JSON[_0x3dff('0x11')](_0x4ca065));if(_0x4ca065['error']){if(_0x4ca065[_0x3dff('0x12')][_0x3dff('0x13')]===0x1f4){logger[_0x3dff('0x12')](_0x3dff('0xd'),_0x9490de,_0x4ca065[_0x3dff('0x12')][_0x3dff('0x14')]);return _0x73c5e4(_0x4ca065['error'][_0x3dff('0x14')]);}logger[_0x3dff('0x12')]('DeskAccount,\x20%s,\x20%s',_0x9490de,_0x4ca065[_0x3dff('0x12')][_0x3dff('0x14')]);return _0x3fc96(_0x4ca065[_0x3dff('0x12')]['message']);}else{logger[_0x3dff('0xc')](_0x3dff('0xd'),_0x9490de,'request\x20sent');_0x3fc96(_0x4ca065[_0x3dff('0x15')][_0x3dff('0x14')]);}})[_0x3dff('0x16')](function(_0x4ae531){logger[_0x3dff('0x12')](_0x3dff('0xd'),_0x9490de,_0x4ae531);_0x73c5e4(_0x4ae531);});});}exports['GetDeskAccount']=function(_0x3482ad){var _0x1c39cc=this;return new Promise(function(_0x570852,_0x51bf56){return db[_0x3dff('0x17')][_0x3dff('0x18')]({'raw':_0x3482ad['options']?_0x3482ad[_0x3dff('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3482ad['options']?_0x3482ad[_0x3dff('0x19')]['where']||null:null,'attributes':_0x3482ad[_0x3dff('0x19')]?_0x3482ad[_0x3dff('0x19')][_0x3dff('0x1a')]||null:null,'limit':_0x3482ad[_0x3dff('0x19')]?_0x3482ad[_0x3dff('0x19')]['limit']||null:null,'include':_0x3482ad[_0x3dff('0x19')]?_0x3482ad[_0x3dff('0x19')][_0x3dff('0x1b')]?_[_0x3dff('0x1c')](_0x3482ad[_0x3dff('0x19')][_0x3dff('0x1b')],function(_0x3b248f){return{'model':db[_0x3b248f[_0x3dff('0x1d')]],'as':_0x3b248f['as'],'attributes':_0x3b248f['attributes'],'include':_0x3b248f[_0x3dff('0x1b')]?_[_0x3dff('0x1c')](_0x3b248f[_0x3dff('0x1b')],function(_0x478927){return{'model':db[_0x478927[_0x3dff('0x1d')]],'as':_0x478927['as'],'attributes':_0x478927[_0x3dff('0x1a')],'include':_0x478927[_0x3dff('0x1b')]?_[_0x3dff('0x1c')](_0x478927['include'],function(_0x271acb){return{'model':db[_0x271acb['model']],'as':_0x271acb['as'],'attributes':_0x271acb['attributes']};}):[]};}):[]};}):[]:[]})[_0x3dff('0x1e')](function(_0x23a4c0){logger['info'](_0x3dff('0x1f'),_0x3482ad);logger[_0x3dff('0xf')](_0x3dff('0x1f'),_0x3482ad,JSON[_0x3dff('0x11')](_0x23a4c0));_0x570852(_0x23a4c0);})['catch'](function(_0x52fd09){logger[_0x3dff('0x12')]('GetDeskAccount',_0x52fd09[_0x3dff('0x14')],_0x3482ad);_0x51bf56(_0x1c39cc[_0x3dff('0x12')](0x1f4,_0x52fd09[_0x3dff('0x14')]));});});};exports[_0x3dff('0x20')]=function(_0x277d26){var _0x1f51b8=this;return new Promise(function(_0x41daea,_0x4f463d){return db[_0x3dff('0x17')]['find']({'raw':_0x277d26[_0x3dff('0x19')]?_0x277d26[_0x3dff('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x277d26[_0x3dff('0x19')]?_0x277d26[_0x3dff('0x19')][_0x3dff('0x21')]||null:null,'attributes':_0x277d26[_0x3dff('0x19')]?_0x277d26[_0x3dff('0x19')][_0x3dff('0x1a')]||null:null,'include':_0x277d26[_0x3dff('0x19')]?_0x277d26[_0x3dff('0x19')][_0x3dff('0x1b')]?_[_0x3dff('0x1c')](_0x277d26[_0x3dff('0x19')][_0x3dff('0x1b')],function(_0x426b42){return{'model':db[_0x426b42['model']],'as':_0x426b42['as'],'attributes':_0x426b42[_0x3dff('0x1a')],'include':_0x426b42['include']?_[_0x3dff('0x1c')](_0x426b42[_0x3dff('0x1b')],function(_0x37a0ad){return{'model':db[_0x37a0ad[_0x3dff('0x1d')]],'as':_0x37a0ad['as'],'attributes':_0x37a0ad[_0x3dff('0x1a')],'include':_0x37a0ad[_0x3dff('0x1b')]?_[_0x3dff('0x1c')](_0x37a0ad[_0x3dff('0x1b')],function(_0x21a695){return{'model':db[_0x21a695[_0x3dff('0x1d')]],'as':_0x21a695['as'],'attributes':_0x21a695['attributes']};}):[]};}):[]};}):[]:[]})[_0x3dff('0x1e')](function(_0x4c91ce){logger[_0x3dff('0xc')](_0x3dff('0x20'),_0x277d26);logger['debug'](_0x3dff('0x20'),_0x277d26,JSON[_0x3dff('0x11')](_0x4c91ce));_0x41daea(_0x4c91ce);})[_0x3dff('0x16')](function(_0x1ffc4e){logger[_0x3dff('0x12')](_0x3dff('0x20'),_0x1ffc4e[_0x3dff('0x14')],_0x277d26);_0x4f463d(_0x1f51b8['error'](0x1f4,_0x1ffc4e['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f425b3a..33bbf11 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x55ca,0x126));var _0xa55c=function(_0x263999,_0x477176){_0x263999=_0x263999-0x0;var _0x336996=_0x55ca[_0x263999];return _0x336996;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x89ddcd,_0x39022b){var _0x48ca3a=function(_0x1310b3){while(--_0x1310b3){_0x89ddcd['push'](_0x89ddcd['shift']());}};_0x48ca3a(++_0x39022b);}(_0x3e74,0x175));var _0x43e7=function(_0x2fe7ae,_0x12fa85){_0x2fe7ae=_0x2fe7ae-0x0;var _0x47fcab=_0x3e74[_0x2fe7ae];return _0x47fcab;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f069317..c05d2de 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15c0=['STRING','sequelize'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x15c0,0x1d9));var _0x015c=function(_0x5d3c64,_0x1092ac){_0x5d3c64=_0x5d3c64-0x0;var _0x161d1e=_0x15c0[_0x5d3c64];return _0x161d1e;};'use strict';var Sequelize=require(_0x015c('0x0'));module['exports']={'name':{'type':Sequelize[_0x015c('0x1')]},'description':{'type':Sequelize[_0x015c('0x1')]}}; \ No newline at end of file +var _0x30c8=['exports','STRING','sequelize'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x30c8,0x12b));var _0x830c=function(_0x5d4b42,_0x2bbf37){_0x5d4b42=_0x5d4b42-0x0;var _0xc78a6=_0x30c8[_0x5d4b42];return _0xc78a6;};'use strict';var Sequelize=require(_0x830c('0x0'));module[_0x830c('0x1')]={'name':{'type':Sequelize[_0x830c('0x2')]},'description':{'type':Sequelize[_0x830c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 29a6538..fe7043d 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8eb8=['destroy','error','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','show','params','includeAll','include','create','body','catch','find','findOne','DeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','Content-Range','json','apply','reject','save','then'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8eb8,0x1c8));var _0x88eb=function(_0x110661,_0x17d410){_0x110661=_0x110661-0x0;var _0x2f2579=_0x8eb8[_0x110661];return _0x2f2579;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x88eb('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x88eb('0x1'));var moment=require(_0x88eb('0x2'));var BPromise=require(_0x88eb('0x3'));var Mustache=require(_0x88eb('0x4'));var util=require(_0x88eb('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x88eb('0x6'));var ejs=require(_0x88eb('0x7'));var fs=require('fs');var fs_extra=require(_0x88eb('0x8'));var _=require(_0x88eb('0x9'));var squel=require('squel');var crypto=require(_0x88eb('0xa'));var jsforce=require(_0x88eb('0xb'));var deskjs=require(_0x88eb('0xc'));var toCsv=require(_0x88eb('0x6'));var querystring=require(_0x88eb('0xd'));var Papa=require(_0x88eb('0xe'));var Redis=require(_0x88eb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x88eb('0x10'));var as=require(_0x88eb('0x11'));var hardwareService=require(_0x88eb('0x12'));var logger=require(_0x88eb('0x13'))(_0x88eb('0x14'));var utils=require('../../config/utils');var config=require(_0x88eb('0x15'));var licenseUtil=require(_0x88eb('0x16'));var db=require(_0x88eb('0x17'))['db'];function respondWithStatusCode(_0x1a4197,_0x36b48f){_0x36b48f=_0x36b48f||0xcc;return function(_0x536137){if(_0x536137){return _0x1a4197[_0x88eb('0x18')](_0x36b48f);}return _0x1a4197[_0x88eb('0x19')](_0x36b48f)[_0x88eb('0x1a')]();};}function respondWithResult(_0x102a0c,_0x20f65c){_0x20f65c=_0x20f65c||0xc8;return function(_0x383659){if(_0x383659){return _0x102a0c[_0x88eb('0x19')](_0x20f65c)['json'](_0x383659);}};}function respondWithFilteredResult(_0x2550c3,_0x547c97){return function(_0x14969c){if(_0x14969c){var _0xed0b1c=typeof _0x547c97[_0x88eb('0x1b')]==='undefined'&&typeof _0x547c97[_0x88eb('0x1c')]===_0x88eb('0x1d');var _0x9d651d=_0x14969c['count'];var _0x368b23=_0xed0b1c?0x0:_0x547c97['offset'];var _0x4531f9=_0xed0b1c?_0x14969c['count']:_0x547c97[_0x88eb('0x1b')]+_0x547c97[_0x88eb('0x1c')];var _0x3c29b3;if(_0x4531f9>=_0x9d651d){_0x4531f9=_0x9d651d;_0x3c29b3=0xc8;}else{_0x3c29b3=0xce;}_0x2550c3['status'](_0x3c29b3);return _0x2550c3['set'](_0x88eb('0x1e'),_0x368b23+'-'+_0x4531f9+'/'+_0x9d651d)[_0x88eb('0x1f')](_0x14969c);}return null;};}function patchUpdates(_0x89dc78){return function(_0x5be3aa){try{jsonpatch[_0x88eb('0x20')](_0x5be3aa,_0x89dc78,!![]);}catch(_0x17d9b6){return BPromise[_0x88eb('0x21')](_0x17d9b6);}return _0x5be3aa[_0x88eb('0x22')]();};}function saveUpdates(_0x4d7422,_0x186e00){return function(_0xa3381a){if(_0xa3381a){return _0xa3381a['update'](_0x4d7422)[_0x88eb('0x23')](function(_0x31be26){return _0x31be26;});}return null;};}function removeEntity(_0x31120c,_0x4bc047){return function(_0x3c489a){if(_0x3c489a){return _0x3c489a[_0x88eb('0x24')]()[_0x88eb('0x23')](function(){_0x31120c[_0x88eb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4787d8,_0x5925e6){return function(_0x470050){if(!_0x470050){_0x4787d8[_0x88eb('0x18')](0x194);}return _0x470050;};}function handleError(_0x5b6705,_0x104ce8){_0x104ce8=_0x104ce8||0x1f4;return function(_0x5aeabe){logger[_0x88eb('0x25')](_0x5aeabe['stack']);if(_0x5aeabe[_0x88eb('0x26')]){delete _0x5aeabe['name'];}_0x5b6705[_0x88eb('0x19')](_0x104ce8)[_0x88eb('0x27')](_0x5aeabe);};}exports[_0x88eb('0x28')]=function(_0x20ef98,_0xd4c8f6){var _0x7c4a06={},_0x25b3a8={},_0x95c732={'count':0x0,'rows':[]};var _0x39c7f9=_[_0x88eb('0x29')](db[_0x88eb('0x2a')][_0x88eb('0x2b')],function(_0x38874e){return{'name':_0x38874e['fieldName'],'type':_0x38874e[_0x88eb('0x2c')][_0x88eb('0x2d')]};});_0x25b3a8[_0x88eb('0x2e')]=_[_0x88eb('0x29')](_0x39c7f9,'name');_0x25b3a8[_0x88eb('0x2f')]=_[_0x88eb('0x30')](_0x20ef98[_0x88eb('0x2f')]);_0x25b3a8[_0x88eb('0x31')]=_['intersection'](_0x25b3a8['model'],_0x25b3a8['query']);_0x7c4a06[_0x88eb('0x32')]=_[_0x88eb('0x33')](_0x25b3a8[_0x88eb('0x2e')],qs[_0x88eb('0x34')](_0x20ef98[_0x88eb('0x2f')][_0x88eb('0x34')]));_0x7c4a06['attributes']=_0x7c4a06[_0x88eb('0x32')][_0x88eb('0x35')]?_0x7c4a06[_0x88eb('0x32')]:_0x25b3a8[_0x88eb('0x2e')];if(!_0x20ef98[_0x88eb('0x2f')][_0x88eb('0x36')](_0x88eb('0x37'))){_0x7c4a06[_0x88eb('0x1c')]=qs[_0x88eb('0x1c')](_0x20ef98['query'][_0x88eb('0x1c')]);_0x7c4a06['offset']=qs['offset'](_0x20ef98['query'][_0x88eb('0x1b')]);}_0x7c4a06[_0x88eb('0x38')]=qs[_0x88eb('0x39')](_0x20ef98[_0x88eb('0x2f')][_0x88eb('0x39')]);_0x7c4a06[_0x88eb('0x3a')]=qs['filters'](_[_0x88eb('0x3b')](_0x20ef98['query'],_0x25b3a8[_0x88eb('0x31')]),_0x39c7f9);if(_0x20ef98['query'][_0x88eb('0x3c')]){_0x7c4a06[_0x88eb('0x3a')]=_[_0x88eb('0x3d')](_0x7c4a06['where'],{'$or':_[_0x88eb('0x29')](_0x39c7f9,function(_0xeb5cb2){if(_0xeb5cb2[_0x88eb('0x2c')]!==_0x88eb('0x3e')){var _0x59e07f={};_0x59e07f[_0xeb5cb2[_0x88eb('0x26')]]={'$like':'%'+_0x20ef98['query'][_0x88eb('0x3c')]+'%'};return _0x59e07f;}})});}_0x7c4a06=_[_0x88eb('0x3d')]({},_0x7c4a06,_0x20ef98[_0x88eb('0x3f')]);var _0x19716a={'where':_0x7c4a06[_0x88eb('0x3a')]};return db[_0x88eb('0x2a')][_0x88eb('0x40')](_0x19716a)[_0x88eb('0x23')](function(_0x2c7aac){_0x95c732[_0x88eb('0x40')]=_0x2c7aac;if(_0x20ef98['query']['includeAll']){_0x7c4a06['include']=[{'all':!![]}];}return db[_0x88eb('0x2a')]['findAll'](_0x7c4a06);})[_0x88eb('0x23')](function(_0x23de87){_0x95c732['rows']=_0x23de87;return _0x95c732;})[_0x88eb('0x23')](respondWithFilteredResult(_0xd4c8f6,_0x7c4a06))['catch'](handleError(_0xd4c8f6,null));};exports[_0x88eb('0x41')]=function(_0x2d503e,_0x19960c){var _0x1bb7fe={'raw':![],'where':{'id':_0x2d503e[_0x88eb('0x42')]['id']}},_0x4e3930={};_0x4e3930[_0x88eb('0x2e')]=_['keys'](db[_0x88eb('0x2a')][_0x88eb('0x2b')]);_0x4e3930[_0x88eb('0x2f')]=_[_0x88eb('0x30')](_0x2d503e[_0x88eb('0x2f')]);_0x4e3930['filters']=_['intersection'](_0x4e3930[_0x88eb('0x2e')],_0x4e3930[_0x88eb('0x2f')]);_0x1bb7fe[_0x88eb('0x32')]=_[_0x88eb('0x33')](_0x4e3930[_0x88eb('0x2e')],qs[_0x88eb('0x34')](_0x2d503e[_0x88eb('0x2f')][_0x88eb('0x34')]));_0x1bb7fe['attributes']=_0x1bb7fe[_0x88eb('0x32')]['length']?_0x1bb7fe[_0x88eb('0x32')]:_0x4e3930[_0x88eb('0x2e')];if(_0x2d503e['query'][_0x88eb('0x43')]){_0x1bb7fe[_0x88eb('0x44')]=[{'all':!![]}];}_0x1bb7fe=_[_0x88eb('0x3d')]({},_0x1bb7fe,_0x2d503e[_0x88eb('0x3f')]);return db[_0x88eb('0x2a')]['find'](_0x1bb7fe)[_0x88eb('0x23')](handleEntityNotFound(_0x19960c,null))['then'](respondWithResult(_0x19960c,null))['catch'](handleError(_0x19960c,null));};exports[_0x88eb('0x45')]=function(_0x15aadf,_0x26f427){return db[_0x88eb('0x2a')][_0x88eb('0x45')](_0x15aadf[_0x88eb('0x46')],{})[_0x88eb('0x23')](respondWithResult(_0x26f427,0xc9))[_0x88eb('0x47')](handleError(_0x26f427,null));};exports['update']=function(_0x2348bd,_0x4b8c60){if(_0x2348bd[_0x88eb('0x46')]['id']){delete _0x2348bd[_0x88eb('0x46')]['id'];}return db[_0x88eb('0x2a')][_0x88eb('0x48')]({'where':{'id':_0x2348bd[_0x88eb('0x42')]['id']}})[_0x88eb('0x23')](handleEntityNotFound(_0x4b8c60,null))['then'](saveUpdates(_0x2348bd[_0x88eb('0x46')],null))[_0x88eb('0x23')](respondWithResult(_0x4b8c60,null))[_0x88eb('0x47')](handleError(_0x4b8c60,null));};exports[_0x88eb('0x24')]=function(_0x30a356,_0x39b3d0){return db[_0x88eb('0x2a')][_0x88eb('0x48')]({'where':{'id':_0x30a356['params']['id']}})[_0x88eb('0x23')](handleEntityNotFound(_0x39b3d0,null))['then'](removeEntity(_0x39b3d0,null))[_0x88eb('0x47')](handleError(_0x39b3d0,null));};exports['getFields']=function(_0xe94613,_0x314c59,_0x1bb6d4){var _0x3143b2={};var _0x8cb265={};var _0x4c4cfe;var _0x4f30cf;return db[_0x88eb('0x2a')][_0x88eb('0x49')]({'where':{'id':_0xe94613[_0x88eb('0x42')]['id']}})[_0x88eb('0x23')](handleEntityNotFound(_0x314c59,null))['then'](function(_0x5132c1){if(_0x5132c1){_0x4c4cfe=_0x5132c1;_0x8cb265[_0x88eb('0x2e')]=_['keys'](db[_0x88eb('0x4a')][_0x88eb('0x2b')]);_0x8cb265['query']=_[_0x88eb('0x30')](_0xe94613[_0x88eb('0x2f')]);_0x8cb265[_0x88eb('0x31')]=_[_0x88eb('0x33')](_0x8cb265['model'],_0x8cb265[_0x88eb('0x2f')]);_0x3143b2['attributes']=_[_0x88eb('0x33')](_0x8cb265[_0x88eb('0x2e')],qs['fields'](_0xe94613[_0x88eb('0x2f')][_0x88eb('0x34')]));_0x3143b2[_0x88eb('0x32')]=_0x3143b2[_0x88eb('0x32')]['length']?_0x3143b2[_0x88eb('0x32')]:_0x8cb265['model'];_0x3143b2[_0x88eb('0x38')]=qs['sort'](_0xe94613[_0x88eb('0x2f')][_0x88eb('0x39')]);_0x3143b2[_0x88eb('0x3a')]=qs[_0x88eb('0x31')](_[_0x88eb('0x3b')](_0xe94613[_0x88eb('0x2f')],_0x8cb265[_0x88eb('0x31')]));if(_0xe94613['query'][_0x88eb('0x3c')]){_0x3143b2[_0x88eb('0x3a')]=_[_0x88eb('0x3d')](_0x3143b2[_0x88eb('0x3a')],{'$or':_[_0x88eb('0x29')](_0x3143b2['attributes'],function(_0x404022){var _0x3d6a90={};_0x3d6a90[_0x404022]={'$like':'%'+_0xe94613[_0x88eb('0x2f')][_0x88eb('0x3c')]+'%'};return _0x3d6a90;})});}_0x3143b2=_[_0x88eb('0x3d')]({},_0x3143b2,_0xe94613['options']);return _0x4c4cfe['getFields'](_0x3143b2);}})[_0x88eb('0x23')](function(_0x58b7ac){if(_0x58b7ac){_0x4f30cf=_0x58b7ac[_0x88eb('0x35')];if(!_0xe94613[_0x88eb('0x2f')][_0x88eb('0x36')](_0x88eb('0x37'))){_0x3143b2['limit']=qs['limit'](_0xe94613['query'][_0x88eb('0x1c')]);_0x3143b2[_0x88eb('0x1b')]=qs[_0x88eb('0x1b')](_0xe94613['query'][_0x88eb('0x1b')]);}return _0x4c4cfe[_0x88eb('0x4b')](_0x3143b2);}})[_0x88eb('0x23')](function(_0x2bed0f){if(_0x2bed0f){return _0x2bed0f?{'count':_0x4f30cf,'rows':_0x2bed0f}:null;}})[_0x88eb('0x23')](respondWithResult(_0x314c59,null))['catch'](handleError(_0x314c59,null));};exports['getSubjects']=function(_0x1fca04,_0x5ab42a,_0x4c51a6){var _0x6ee55={};var _0x12d378={};var _0x1e8e1b;var _0x496faf;return db[_0x88eb('0x2a')][_0x88eb('0x49')]({'where':{'id':_0x1fca04[_0x88eb('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ab42a,null))[_0x88eb('0x23')](function(_0x16f08a){if(_0x16f08a){_0x1e8e1b=_0x16f08a;_0x12d378[_0x88eb('0x2e')]=_[_0x88eb('0x30')](db[_0x88eb('0x4a')][_0x88eb('0x2b')]);_0x12d378[_0x88eb('0x2f')]=_[_0x88eb('0x30')](_0x1fca04[_0x88eb('0x2f')]);_0x12d378[_0x88eb('0x31')]=_['intersection'](_0x12d378[_0x88eb('0x2e')],_0x12d378[_0x88eb('0x2f')]);_0x6ee55['attributes']=_['intersection'](_0x12d378[_0x88eb('0x2e')],qs[_0x88eb('0x34')](_0x1fca04[_0x88eb('0x2f')]['fields']));_0x6ee55[_0x88eb('0x32')]=_0x6ee55[_0x88eb('0x32')][_0x88eb('0x35')]?_0x6ee55[_0x88eb('0x32')]:_0x12d378['model'];_0x6ee55[_0x88eb('0x38')]=qs['sort'](_0x1fca04[_0x88eb('0x2f')][_0x88eb('0x39')]);_0x6ee55[_0x88eb('0x3a')]=qs[_0x88eb('0x31')](_['pick'](_0x1fca04['query'],_0x12d378[_0x88eb('0x31')]));if(_0x1fca04[_0x88eb('0x2f')]['filter']){_0x6ee55[_0x88eb('0x3a')]=_[_0x88eb('0x3d')](_0x6ee55[_0x88eb('0x3a')],{'$or':_['map'](_0x6ee55[_0x88eb('0x32')],function(_0x3bc244){var _0x47c94f={};_0x47c94f[_0x3bc244]={'$like':'%'+_0x1fca04[_0x88eb('0x2f')][_0x88eb('0x3c')]+'%'};return _0x47c94f;})});}_0x6ee55=_[_0x88eb('0x3d')]({},_0x6ee55,_0x1fca04['options']);return _0x1e8e1b[_0x88eb('0x4c')](_0x6ee55);}})[_0x88eb('0x23')](function(_0xb9eab4){if(_0xb9eab4){_0x496faf=_0xb9eab4[_0x88eb('0x35')];if(!_0x1fca04[_0x88eb('0x2f')]['hasOwnProperty'](_0x88eb('0x37'))){_0x6ee55[_0x88eb('0x1c')]=qs[_0x88eb('0x1c')](_0x1fca04['query'][_0x88eb('0x1c')]);_0x6ee55[_0x88eb('0x1b')]=qs[_0x88eb('0x1b')](_0x1fca04[_0x88eb('0x2f')][_0x88eb('0x1b')]);}return _0x1e8e1b[_0x88eb('0x4c')](_0x6ee55);}})[_0x88eb('0x23')](function(_0x37a9ca){if(_0x37a9ca){return _0x37a9ca?{'count':_0x496faf,'rows':_0x37a9ca}:null;}})['then'](respondWithResult(_0x5ab42a,null))['catch'](handleError(_0x5ab42a,null));};exports[_0x88eb('0x4d')]=function(_0x340e44,_0x296cd1,_0x38badd){var _0x5ae6ed={};var _0x22423d={};var _0x1585de;var _0x3b53c7;return db[_0x88eb('0x2a')][_0x88eb('0x49')]({'where':{'id':_0x340e44[_0x88eb('0x42')]['id']}})['then'](handleEntityNotFound(_0x296cd1,null))[_0x88eb('0x23')](function(_0x36d22d){if(_0x36d22d){_0x1585de=_0x36d22d;_0x22423d[_0x88eb('0x2e')]=_[_0x88eb('0x30')](db[_0x88eb('0x4a')][_0x88eb('0x2b')]);_0x22423d['query']=_['keys'](_0x340e44[_0x88eb('0x2f')]);_0x22423d[_0x88eb('0x31')]=_[_0x88eb('0x33')](_0x22423d[_0x88eb('0x2e')],_0x22423d[_0x88eb('0x2f')]);_0x5ae6ed['attributes']=_[_0x88eb('0x33')](_0x22423d['model'],qs[_0x88eb('0x34')](_0x340e44[_0x88eb('0x2f')][_0x88eb('0x34')]));_0x5ae6ed[_0x88eb('0x32')]=_0x5ae6ed['attributes']['length']?_0x5ae6ed[_0x88eb('0x32')]:_0x22423d[_0x88eb('0x2e')];_0x5ae6ed[_0x88eb('0x38')]=qs['sort'](_0x340e44[_0x88eb('0x2f')][_0x88eb('0x39')]);_0x5ae6ed[_0x88eb('0x3a')]=qs[_0x88eb('0x31')](_[_0x88eb('0x3b')](_0x340e44['query'],_0x22423d[_0x88eb('0x31')]));if(_0x340e44['query'][_0x88eb('0x3c')]){_0x5ae6ed[_0x88eb('0x3a')]=_[_0x88eb('0x3d')](_0x5ae6ed[_0x88eb('0x3a')],{'$or':_['map'](_0x5ae6ed['attributes'],function(_0x5afdac){var _0x48a64f={};_0x48a64f[_0x5afdac]={'$like':'%'+_0x340e44[_0x88eb('0x2f')][_0x88eb('0x3c')]+'%'};return _0x48a64f;})});}_0x5ae6ed=_[_0x88eb('0x3d')]({},_0x5ae6ed,_0x340e44['options']);return _0x1585de[_0x88eb('0x4d')](_0x5ae6ed);}})['then'](function(_0x28fae4){if(_0x28fae4){_0x3b53c7=_0x28fae4[_0x88eb('0x35')];if(!_0x340e44[_0x88eb('0x2f')][_0x88eb('0x36')]('nolimit')){_0x5ae6ed['limit']=qs[_0x88eb('0x1c')](_0x340e44[_0x88eb('0x2f')]['limit']);_0x5ae6ed[_0x88eb('0x1b')]=qs[_0x88eb('0x1b')](_0x340e44[_0x88eb('0x2f')][_0x88eb('0x1b')]);}return _0x1585de['getDescriptions'](_0x5ae6ed);}})['then'](function(_0x1af38c){if(_0x1af38c){return _0x1af38c?{'count':_0x3b53c7,'rows':_0x1af38c}:null;}})[_0x88eb('0x23')](respondWithResult(_0x296cd1,null))[_0x88eb('0x47')](handleError(_0x296cd1,null));};exports[_0x88eb('0x4e')]=function(_0x33a62c,_0x43456,_0x4a7c61){var _0x28e3a8={};var _0x823844={};var _0x2d9669;var _0x4afcd1;return db[_0x88eb('0x2a')]['findOne']({'where':{'id':_0x33a62c[_0x88eb('0x42')]['id']}})[_0x88eb('0x23')](handleEntityNotFound(_0x43456,null))[_0x88eb('0x23')](function(_0x2b2b7f){if(_0x2b2b7f){_0x2d9669=_0x2b2b7f;_0x823844[_0x88eb('0x2e')]=_[_0x88eb('0x30')](db[_0x88eb('0x4f')][_0x88eb('0x2b')]);_0x823844['query']=_[_0x88eb('0x30')](_0x33a62c[_0x88eb('0x2f')]);_0x823844[_0x88eb('0x31')]=_[_0x88eb('0x33')](_0x823844[_0x88eb('0x2e')],_0x823844['query']);_0x28e3a8['attributes']=_[_0x88eb('0x33')](_0x823844[_0x88eb('0x2e')],qs['fields'](_0x33a62c[_0x88eb('0x2f')]['fields']));_0x28e3a8[_0x88eb('0x32')]=_0x28e3a8['attributes'][_0x88eb('0x35')]?_0x28e3a8[_0x88eb('0x32')]:_0x823844[_0x88eb('0x2e')];_0x28e3a8['order']=qs[_0x88eb('0x39')](_0x33a62c[_0x88eb('0x2f')][_0x88eb('0x39')]);_0x28e3a8['where']=qs['filters'](_[_0x88eb('0x3b')](_0x33a62c['query'],_0x823844[_0x88eb('0x31')]));if(_0x33a62c[_0x88eb('0x2f')][_0x88eb('0x3c')]){_0x28e3a8[_0x88eb('0x3a')]=_[_0x88eb('0x3d')](_0x28e3a8[_0x88eb('0x3a')],{'$or':_[_0x88eb('0x29')](_0x28e3a8[_0x88eb('0x32')],function(_0x54029a){var _0x114ab6={};_0x114ab6[_0x54029a]={'$like':'%'+_0x33a62c[_0x88eb('0x2f')][_0x88eb('0x3c')]+'%'};return _0x114ab6;})});}_0x28e3a8=_['merge']({},_0x28e3a8,_0x33a62c[_0x88eb('0x3f')]);return _0x2d9669['getTags'](_0x28e3a8);}})['then'](function(_0x5d829f){if(_0x5d829f){_0x4afcd1=_0x5d829f[_0x88eb('0x35')];if(!_0x33a62c['query'][_0x88eb('0x36')](_0x88eb('0x37'))){_0x28e3a8['limit']=qs['limit'](_0x33a62c[_0x88eb('0x2f')][_0x88eb('0x1c')]);_0x28e3a8['offset']=qs[_0x88eb('0x1b')](_0x33a62c[_0x88eb('0x2f')][_0x88eb('0x1b')]);}return _0x2d9669[_0x88eb('0x4e')](_0x28e3a8);}})[_0x88eb('0x23')](function(_0x4ce1ec){if(_0x4ce1ec){return _0x4ce1ec?{'count':_0x4afcd1,'rows':_0x4ce1ec}:null;}})[_0x88eb('0x23')](respondWithResult(_0x43456,null))['catch'](handleError(_0x43456,null));};exports[_0x88eb('0x50')]=function(_0x1e3f8f,_0x4586f1,_0x1a161d){if(_0x1e3f8f[_0x88eb('0x46')]['id']){delete _0x1e3f8f['body']['id'];}return db[_0x88eb('0x2a')][_0x88eb('0x49')]({'where':{'id':_0x1e3f8f[_0x88eb('0x42')]['id']}})[_0x88eb('0x23')](handleEntityNotFound(_0x4586f1,null))['then'](function(_0x4fd4b7){if(_0x4fd4b7){return _0x4fd4b7['setTags'](_0x1e3f8f[_0x88eb('0x46')][_0x88eb('0x51')]||[]);}return null;})['then'](respondWithResult(_0x4586f1,null))[_0x88eb('0x47')](handleError(_0x4586f1,null));}; \ No newline at end of file +var _0x06a3=['keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','model','find','create','body','getFields','findOne','DeskField','order','map','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','send','DeskConfiguration','rawAttributes','fieldName','type','key','name'];(function(_0x27eda0,_0x42a3cf){var _0x2b63a5=function(_0x431084){while(--_0x431084){_0x27eda0['push'](_0x27eda0['shift']());}};_0x2b63a5(++_0x42a3cf);}(_0x06a3,0x79));var _0x306a=function(_0x5f2fea,_0x9fde07){_0x5f2fea=_0x5f2fea-0x0;var _0x198a0c=_0x06a3[_0x5f2fea];return _0x198a0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x306a('0x0'));var zipdir=require(_0x306a('0x1'));var jsonpatch=require(_0x306a('0x2'));var rp=require(_0x306a('0x3'));var moment=require('moment');var BPromise=require(_0x306a('0x4'));var Mustache=require(_0x306a('0x5'));var util=require('util');var path=require(_0x306a('0x6'));var sox=require(_0x306a('0x7'));var csv=require(_0x306a('0x8'));var ejs=require(_0x306a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x306a('0xa'));var crypto=require(_0x306a('0xb'));var jsforce=require(_0x306a('0xc'));var deskjs=require(_0x306a('0xd'));var toCsv=require(_0x306a('0x8'));var querystring=require(_0x306a('0xe'));var Papa=require(_0x306a('0xf'));var Redis=require(_0x306a('0x10'));var authService=require(_0x306a('0x11'));var qs=require(_0x306a('0x12'));var as=require(_0x306a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x306a('0x14'))(_0x306a('0x15'));var utils=require(_0x306a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x306a('0x17'));var db=require(_0x306a('0x18'))['db'];function respondWithStatusCode(_0x5b1998,_0x1ba4b2){_0x1ba4b2=_0x1ba4b2||0xcc;return function(_0x51c304){if(_0x51c304){return _0x5b1998['sendStatus'](_0x1ba4b2);}return _0x5b1998[_0x306a('0x19')](_0x1ba4b2)[_0x306a('0x1a')]();};}function respondWithResult(_0x136ff0,_0x24b073){_0x24b073=_0x24b073||0xc8;return function(_0x212c24){if(_0x212c24){return _0x136ff0[_0x306a('0x19')](_0x24b073)['json'](_0x212c24);}};}function respondWithFilteredResult(_0x2b8e66,_0xc6fa9){return function(_0x26f724){if(_0x26f724){var _0x4828cd=typeof _0xc6fa9[_0x306a('0x1b')]==='undefined'&&typeof _0xc6fa9['limit']===_0x306a('0x1c');var _0x1ceb0a=_0x26f724['count'];var _0x304566=_0x4828cd?0x0:_0xc6fa9[_0x306a('0x1b')];var _0xae1c6b=_0x4828cd?_0x26f724[_0x306a('0x1d')]:_0xc6fa9['offset']+_0xc6fa9['limit'];var _0x22950a;if(_0xae1c6b>=_0x1ceb0a){_0xae1c6b=_0x1ceb0a;_0x22950a=0xc8;}else{_0x22950a=0xce;}_0x2b8e66[_0x306a('0x19')](_0x22950a);return _0x2b8e66['set'](_0x306a('0x1e'),_0x304566+'-'+_0xae1c6b+'/'+_0x1ceb0a)[_0x306a('0x1f')](_0x26f724);}return null;};}function patchUpdates(_0x40a32f){return function(_0x19879d){try{jsonpatch[_0x306a('0x20')](_0x19879d,_0x40a32f,!![]);}catch(_0x190604){return BPromise[_0x306a('0x21')](_0x190604);}return _0x19879d[_0x306a('0x22')]();};}function saveUpdates(_0x13e2b0,_0x2f18cd){return function(_0x14f383){if(_0x14f383){return _0x14f383[_0x306a('0x23')](_0x13e2b0)[_0x306a('0x24')](function(_0x2c3de8){return _0x2c3de8;});}return null;};}function removeEntity(_0x67c3b1,_0x4ebc1f){return function(_0x376d0b){if(_0x376d0b){return _0x376d0b[_0x306a('0x25')]()['then'](function(){_0x67c3b1[_0x306a('0x19')](0xcc)[_0x306a('0x1a')]();});}};}function handleEntityNotFound(_0x28f1b7,_0x275a0){return function(_0x36cd58){if(!_0x36cd58){_0x28f1b7[_0x306a('0x26')](0x194);}return _0x36cd58;};}function handleError(_0x947fd7,_0x3f2cce){_0x3f2cce=_0x3f2cce||0x1f4;return function(_0x32a7c8){logger['error'](_0x32a7c8[_0x306a('0x27')]);if(_0x32a7c8['name']){delete _0x32a7c8['name'];}_0x947fd7[_0x306a('0x19')](_0x3f2cce)[_0x306a('0x28')](_0x32a7c8);};}exports['index']=function(_0x48b8a5,_0x46f932){var _0x50f47b={},_0x1d0525={},_0x4fcfa9={'count':0x0,'rows':[]};var _0x553516=_['map'](db[_0x306a('0x29')][_0x306a('0x2a')],function(_0x5de6ec){return{'name':_0x5de6ec[_0x306a('0x2b')],'type':_0x5de6ec[_0x306a('0x2c')][_0x306a('0x2d')]};});_0x1d0525['model']=_['map'](_0x553516,_0x306a('0x2e'));_0x1d0525['query']=_[_0x306a('0x2f')](_0x48b8a5[_0x306a('0x30')]);_0x1d0525['filters']=_[_0x306a('0x31')](_0x1d0525['model'],_0x1d0525['query']);_0x50f47b[_0x306a('0x32')]=_['intersection'](_0x1d0525['model'],qs[_0x306a('0x33')](_0x48b8a5['query'][_0x306a('0x33')]));_0x50f47b[_0x306a('0x32')]=_0x50f47b[_0x306a('0x32')][_0x306a('0x34')]?_0x50f47b[_0x306a('0x32')]:_0x1d0525['model'];if(!_0x48b8a5['query'][_0x306a('0x35')](_0x306a('0x36'))){_0x50f47b[_0x306a('0x37')]=qs[_0x306a('0x37')](_0x48b8a5[_0x306a('0x30')][_0x306a('0x37')]);_0x50f47b[_0x306a('0x1b')]=qs['offset'](_0x48b8a5[_0x306a('0x30')][_0x306a('0x1b')]);}_0x50f47b['order']=qs[_0x306a('0x38')](_0x48b8a5['query'][_0x306a('0x38')]);_0x50f47b[_0x306a('0x39')]=qs[_0x306a('0x3a')](_[_0x306a('0x3b')](_0x48b8a5[_0x306a('0x30')],_0x1d0525['filters']),_0x553516);if(_0x48b8a5[_0x306a('0x30')][_0x306a('0x3c')]){_0x50f47b[_0x306a('0x39')]=_[_0x306a('0x3d')](_0x50f47b[_0x306a('0x39')],{'$or':_['map'](_0x553516,function(_0x2c10fc){if(_0x2c10fc[_0x306a('0x2c')]!==_0x306a('0x3e')){var _0x3755ae={};_0x3755ae[_0x2c10fc['name']]={'$like':'%'+_0x48b8a5[_0x306a('0x30')][_0x306a('0x3c')]+'%'};return _0x3755ae;}})});}_0x50f47b=_[_0x306a('0x3d')]({},_0x50f47b,_0x48b8a5[_0x306a('0x3f')]);var _0x23cfe5={'where':_0x50f47b['where']};return db[_0x306a('0x29')][_0x306a('0x1d')](_0x23cfe5)[_0x306a('0x24')](function(_0x571bd5){_0x4fcfa9['count']=_0x571bd5;if(_0x48b8a5[_0x306a('0x30')][_0x306a('0x40')]){_0x50f47b[_0x306a('0x41')]=[{'all':!![]}];}return db[_0x306a('0x29')][_0x306a('0x42')](_0x50f47b);})[_0x306a('0x24')](function(_0x16f16b){_0x4fcfa9['rows']=_0x16f16b;return _0x4fcfa9;})[_0x306a('0x24')](respondWithFilteredResult(_0x46f932,_0x50f47b))[_0x306a('0x43')](handleError(_0x46f932,null));};exports[_0x306a('0x44')]=function(_0x309a5c,_0x5d5600){var _0x1757a8={'raw':![],'where':{'id':_0x309a5c[_0x306a('0x45')]['id']}},_0x138eeb={};_0x138eeb[_0x306a('0x46')]=_['keys'](db[_0x306a('0x29')]['rawAttributes']);_0x138eeb[_0x306a('0x30')]=_[_0x306a('0x2f')](_0x309a5c[_0x306a('0x30')]);_0x138eeb[_0x306a('0x3a')]=_[_0x306a('0x31')](_0x138eeb['model'],_0x138eeb[_0x306a('0x30')]);_0x1757a8[_0x306a('0x32')]=_[_0x306a('0x31')](_0x138eeb[_0x306a('0x46')],qs[_0x306a('0x33')](_0x309a5c[_0x306a('0x30')][_0x306a('0x33')]));_0x1757a8[_0x306a('0x32')]=_0x1757a8[_0x306a('0x32')][_0x306a('0x34')]?_0x1757a8[_0x306a('0x32')]:_0x138eeb[_0x306a('0x46')];if(_0x309a5c['query'][_0x306a('0x40')]){_0x1757a8[_0x306a('0x41')]=[{'all':!![]}];}_0x1757a8=_[_0x306a('0x3d')]({},_0x1757a8,_0x309a5c[_0x306a('0x3f')]);return db[_0x306a('0x29')][_0x306a('0x47')](_0x1757a8)[_0x306a('0x24')](handleEntityNotFound(_0x5d5600,null))['then'](respondWithResult(_0x5d5600,null))[_0x306a('0x43')](handleError(_0x5d5600,null));};exports[_0x306a('0x48')]=function(_0x5e892b,_0x1ccc30){return db['DeskConfiguration']['create'](_0x5e892b[_0x306a('0x49')],{})[_0x306a('0x24')](respondWithResult(_0x1ccc30,0xc9))[_0x306a('0x43')](handleError(_0x1ccc30,null));};exports[_0x306a('0x23')]=function(_0x41f06f,_0x475d86){if(_0x41f06f[_0x306a('0x49')]['id']){delete _0x41f06f[_0x306a('0x49')]['id'];}return db[_0x306a('0x29')][_0x306a('0x47')]({'where':{'id':_0x41f06f[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x475d86,null))[_0x306a('0x24')](saveUpdates(_0x41f06f[_0x306a('0x49')],null))['then'](respondWithResult(_0x475d86,null))[_0x306a('0x43')](handleError(_0x475d86,null));};exports[_0x306a('0x25')]=function(_0x364539,_0x1c98dd){return db['DeskConfiguration'][_0x306a('0x47')]({'where':{'id':_0x364539[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x1c98dd,null))[_0x306a('0x24')](removeEntity(_0x1c98dd,null))[_0x306a('0x43')](handleError(_0x1c98dd,null));};exports[_0x306a('0x4a')]=function(_0xcd289,_0x3d23fa,_0x50fb72){var _0x38fb69={};var _0x32e231={};var _0x46b506;var _0x2d1083;return db[_0x306a('0x29')][_0x306a('0x4b')]({'where':{'id':_0xcd289[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x3d23fa,null))['then'](function(_0x371afb){if(_0x371afb){_0x46b506=_0x371afb;_0x32e231[_0x306a('0x46')]=_['keys'](db[_0x306a('0x4c')]['rawAttributes']);_0x32e231[_0x306a('0x30')]=_[_0x306a('0x2f')](_0xcd289[_0x306a('0x30')]);_0x32e231[_0x306a('0x3a')]=_[_0x306a('0x31')](_0x32e231[_0x306a('0x46')],_0x32e231[_0x306a('0x30')]);_0x38fb69[_0x306a('0x32')]=_[_0x306a('0x31')](_0x32e231['model'],qs['fields'](_0xcd289[_0x306a('0x30')][_0x306a('0x33')]));_0x38fb69[_0x306a('0x32')]=_0x38fb69[_0x306a('0x32')][_0x306a('0x34')]?_0x38fb69[_0x306a('0x32')]:_0x32e231[_0x306a('0x46')];_0x38fb69[_0x306a('0x4d')]=qs['sort'](_0xcd289['query'][_0x306a('0x38')]);_0x38fb69[_0x306a('0x39')]=qs[_0x306a('0x3a')](_[_0x306a('0x3b')](_0xcd289[_0x306a('0x30')],_0x32e231[_0x306a('0x3a')]));if(_0xcd289[_0x306a('0x30')][_0x306a('0x3c')]){_0x38fb69[_0x306a('0x39')]=_[_0x306a('0x3d')](_0x38fb69['where'],{'$or':_[_0x306a('0x4e')](_0x38fb69[_0x306a('0x32')],function(_0x2ae38a){var _0x588755={};_0x588755[_0x2ae38a]={'$like':'%'+_0xcd289[_0x306a('0x30')][_0x306a('0x3c')]+'%'};return _0x588755;})});}_0x38fb69=_[_0x306a('0x3d')]({},_0x38fb69,_0xcd289[_0x306a('0x3f')]);return _0x46b506[_0x306a('0x4a')](_0x38fb69);}})[_0x306a('0x24')](function(_0x4a15cb){if(_0x4a15cb){_0x2d1083=_0x4a15cb[_0x306a('0x34')];if(!_0xcd289['query'][_0x306a('0x35')](_0x306a('0x36'))){_0x38fb69[_0x306a('0x37')]=qs['limit'](_0xcd289[_0x306a('0x30')][_0x306a('0x37')]);_0x38fb69['offset']=qs[_0x306a('0x1b')](_0xcd289[_0x306a('0x30')][_0x306a('0x1b')]);}return _0x46b506[_0x306a('0x4a')](_0x38fb69);}})[_0x306a('0x24')](function(_0x395199){if(_0x395199){return _0x395199?{'count':_0x2d1083,'rows':_0x395199}:null;}})[_0x306a('0x24')](respondWithResult(_0x3d23fa,null))[_0x306a('0x43')](handleError(_0x3d23fa,null));};exports[_0x306a('0x4f')]=function(_0x1b340f,_0x12e410,_0x2abad6){var _0x37e8a0={};var _0x3032f6={};var _0x53fe90;var _0x17e057;return db[_0x306a('0x29')][_0x306a('0x4b')]({'where':{'id':_0x1b340f[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x12e410,null))['then'](function(_0x5e8589){if(_0x5e8589){_0x53fe90=_0x5e8589;_0x3032f6[_0x306a('0x46')]=_['keys'](db[_0x306a('0x4c')][_0x306a('0x2a')]);_0x3032f6[_0x306a('0x30')]=_['keys'](_0x1b340f['query']);_0x3032f6[_0x306a('0x3a')]=_[_0x306a('0x31')](_0x3032f6['model'],_0x3032f6[_0x306a('0x30')]);_0x37e8a0[_0x306a('0x32')]=_[_0x306a('0x31')](_0x3032f6[_0x306a('0x46')],qs['fields'](_0x1b340f[_0x306a('0x30')][_0x306a('0x33')]));_0x37e8a0[_0x306a('0x32')]=_0x37e8a0['attributes'][_0x306a('0x34')]?_0x37e8a0['attributes']:_0x3032f6[_0x306a('0x46')];_0x37e8a0[_0x306a('0x4d')]=qs[_0x306a('0x38')](_0x1b340f[_0x306a('0x30')][_0x306a('0x38')]);_0x37e8a0[_0x306a('0x39')]=qs[_0x306a('0x3a')](_[_0x306a('0x3b')](_0x1b340f[_0x306a('0x30')],_0x3032f6[_0x306a('0x3a')]));if(_0x1b340f['query'][_0x306a('0x3c')]){_0x37e8a0[_0x306a('0x39')]=_[_0x306a('0x3d')](_0x37e8a0['where'],{'$or':_[_0x306a('0x4e')](_0x37e8a0[_0x306a('0x32')],function(_0x462fff){var _0x5620e7={};_0x5620e7[_0x462fff]={'$like':'%'+_0x1b340f['query']['filter']+'%'};return _0x5620e7;})});}_0x37e8a0=_['merge']({},_0x37e8a0,_0x1b340f['options']);return _0x53fe90[_0x306a('0x4f')](_0x37e8a0);}})[_0x306a('0x24')](function(_0x5d7987){if(_0x5d7987){_0x17e057=_0x5d7987[_0x306a('0x34')];if(!_0x1b340f[_0x306a('0x30')][_0x306a('0x35')](_0x306a('0x36'))){_0x37e8a0[_0x306a('0x37')]=qs['limit'](_0x1b340f[_0x306a('0x30')]['limit']);_0x37e8a0['offset']=qs[_0x306a('0x1b')](_0x1b340f[_0x306a('0x30')][_0x306a('0x1b')]);}return _0x53fe90[_0x306a('0x4f')](_0x37e8a0);}})['then'](function(_0x4f9403){if(_0x4f9403){return _0x4f9403?{'count':_0x17e057,'rows':_0x4f9403}:null;}})[_0x306a('0x24')](respondWithResult(_0x12e410,null))[_0x306a('0x43')](handleError(_0x12e410,null));};exports['getDescriptions']=function(_0x2fb387,_0x437370,_0x1e79c1){var _0x89f8d9={};var _0x4f0905={};var _0x26bdb5;var _0x41a95;return db['DeskConfiguration'][_0x306a('0x4b')]({'where':{'id':_0x2fb387[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x437370,null))['then'](function(_0x69c34d){if(_0x69c34d){_0x26bdb5=_0x69c34d;_0x4f0905[_0x306a('0x46')]=_['keys'](db[_0x306a('0x4c')]['rawAttributes']);_0x4f0905['query']=_[_0x306a('0x2f')](_0x2fb387[_0x306a('0x30')]);_0x4f0905[_0x306a('0x3a')]=_['intersection'](_0x4f0905[_0x306a('0x46')],_0x4f0905['query']);_0x89f8d9[_0x306a('0x32')]=_[_0x306a('0x31')](_0x4f0905['model'],qs['fields'](_0x2fb387[_0x306a('0x30')][_0x306a('0x33')]));_0x89f8d9['attributes']=_0x89f8d9[_0x306a('0x32')][_0x306a('0x34')]?_0x89f8d9[_0x306a('0x32')]:_0x4f0905[_0x306a('0x46')];_0x89f8d9['order']=qs[_0x306a('0x38')](_0x2fb387[_0x306a('0x30')][_0x306a('0x38')]);_0x89f8d9[_0x306a('0x39')]=qs[_0x306a('0x3a')](_[_0x306a('0x3b')](_0x2fb387[_0x306a('0x30')],_0x4f0905[_0x306a('0x3a')]));if(_0x2fb387[_0x306a('0x30')][_0x306a('0x3c')]){_0x89f8d9[_0x306a('0x39')]=_[_0x306a('0x3d')](_0x89f8d9[_0x306a('0x39')],{'$or':_['map'](_0x89f8d9[_0x306a('0x32')],function(_0x4721e7){var _0x5a2efe={};_0x5a2efe[_0x4721e7]={'$like':'%'+_0x2fb387[_0x306a('0x30')][_0x306a('0x3c')]+'%'};return _0x5a2efe;})});}_0x89f8d9=_[_0x306a('0x3d')]({},_0x89f8d9,_0x2fb387[_0x306a('0x3f')]);return _0x26bdb5[_0x306a('0x50')](_0x89f8d9);}})[_0x306a('0x24')](function(_0x38e01b){if(_0x38e01b){_0x41a95=_0x38e01b[_0x306a('0x34')];if(!_0x2fb387[_0x306a('0x30')][_0x306a('0x35')]('nolimit')){_0x89f8d9[_0x306a('0x37')]=qs[_0x306a('0x37')](_0x2fb387[_0x306a('0x30')][_0x306a('0x37')]);_0x89f8d9['offset']=qs[_0x306a('0x1b')](_0x2fb387['query'][_0x306a('0x1b')]);}return _0x26bdb5[_0x306a('0x50')](_0x89f8d9);}})[_0x306a('0x24')](function(_0x345c74){if(_0x345c74){return _0x345c74?{'count':_0x41a95,'rows':_0x345c74}:null;}})[_0x306a('0x24')](respondWithResult(_0x437370,null))[_0x306a('0x43')](handleError(_0x437370,null));};exports[_0x306a('0x51')]=function(_0x2f565d,_0x1aa0e9,_0x3cc928){var _0x332f0e={};var _0x18d255={};var _0x22aa14;var _0x5d2a72;return db[_0x306a('0x29')]['findOne']({'where':{'id':_0x2f565d['params']['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x1aa0e9,null))[_0x306a('0x24')](function(_0x2bc00b){if(_0x2bc00b){_0x22aa14=_0x2bc00b;_0x18d255[_0x306a('0x46')]=_[_0x306a('0x2f')](db[_0x306a('0x52')][_0x306a('0x2a')]);_0x18d255[_0x306a('0x30')]=_[_0x306a('0x2f')](_0x2f565d['query']);_0x18d255['filters']=_[_0x306a('0x31')](_0x18d255['model'],_0x18d255['query']);_0x332f0e['attributes']=_[_0x306a('0x31')](_0x18d255[_0x306a('0x46')],qs[_0x306a('0x33')](_0x2f565d[_0x306a('0x30')]['fields']));_0x332f0e[_0x306a('0x32')]=_0x332f0e[_0x306a('0x32')][_0x306a('0x34')]?_0x332f0e['attributes']:_0x18d255[_0x306a('0x46')];_0x332f0e['order']=qs[_0x306a('0x38')](_0x2f565d['query'][_0x306a('0x38')]);_0x332f0e[_0x306a('0x39')]=qs[_0x306a('0x3a')](_[_0x306a('0x3b')](_0x2f565d[_0x306a('0x30')],_0x18d255['filters']));if(_0x2f565d[_0x306a('0x30')][_0x306a('0x3c')]){_0x332f0e[_0x306a('0x39')]=_[_0x306a('0x3d')](_0x332f0e[_0x306a('0x39')],{'$or':_[_0x306a('0x4e')](_0x332f0e[_0x306a('0x32')],function(_0x2e4276){var _0x346f1a={};_0x346f1a[_0x2e4276]={'$like':'%'+_0x2f565d['query']['filter']+'%'};return _0x346f1a;})});}_0x332f0e=_['merge']({},_0x332f0e,_0x2f565d[_0x306a('0x3f')]);return _0x22aa14[_0x306a('0x51')](_0x332f0e);}})[_0x306a('0x24')](function(_0x1bddbb){if(_0x1bddbb){_0x5d2a72=_0x1bddbb[_0x306a('0x34')];if(!_0x2f565d['query'][_0x306a('0x35')](_0x306a('0x36'))){_0x332f0e['limit']=qs[_0x306a('0x37')](_0x2f565d[_0x306a('0x30')]['limit']);_0x332f0e[_0x306a('0x1b')]=qs['offset'](_0x2f565d[_0x306a('0x30')][_0x306a('0x1b')]);}return _0x22aa14[_0x306a('0x51')](_0x332f0e);}})['then'](function(_0x5051df){if(_0x5051df){return _0x5051df?{'count':_0x5d2a72,'rows':_0x5051df}:null;}})['then'](respondWithResult(_0x1aa0e9,null))['catch'](handleError(_0x1aa0e9,null));};exports[_0x306a('0x53')]=function(_0x310be3,_0x4ec6f5,_0x177bda){if(_0x310be3[_0x306a('0x49')]['id']){delete _0x310be3['body']['id'];}return db[_0x306a('0x29')]['findOne']({'where':{'id':_0x310be3[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x4ec6f5,null))[_0x306a('0x24')](function(_0x1c8dc1){if(_0x1c8dc1){return _0x1c8dc1[_0x306a('0x53')](_0x310be3['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x4ec6f5,null))[_0x306a('0x43')](handleError(_0x4ec6f5,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 1a13416..c3a6197 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.model.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd3a=['../../config/logger','api','moment','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0xbd3a,0x112));var _0xabd3=function(_0x67b184,_0xe71e10){_0x67b184=_0x67b184-0x0;var _0x5958b7=_0xbd3a[_0x67b184];return _0x5958b7;};'use strict';var _=require(_0xabd3('0x0'));var util=require(_0xabd3('0x1'));var logger=require(_0xabd3('0x2'))(_0xabd3('0x3'));var moment=require(_0xabd3('0x4'));var BPromise=require('bluebird');var rp=require(_0xabd3('0x5'));var fs=require('fs');var path=require(_0xabd3('0x6'));var rimraf=require('rimraf');var config=require(_0xabd3('0x7'));var attributes=require(_0xabd3('0x8'));module[_0xabd3('0x9')]=function(_0x4a95a6,_0x196516){return _0x4a95a6[_0xabd3('0xa')](_0xabd3('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2dd=['int_desk_configurations','util','api','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration'];(function(_0x469d84,_0x5ad27e){var _0xdf80df=function(_0x2c9932){while(--_0x2c9932){_0x469d84['push'](_0x469d84['shift']());}};_0xdf80df(++_0x5ad27e);}(_0xb2dd,0xb5));var _0xdb2d=function(_0x2583b2,_0x45a743){_0x2583b2=_0x2583b2-0x0;var _0xc1b07c=_0xb2dd[_0x2583b2];return _0xc1b07c;};'use strict';var _=require('lodash');var util=require(_0xdb2d('0x0'));var logger=require('../../config/logger')(_0xdb2d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb2d('0x2'));var fs=require('fs');var path=require(_0xdb2d('0x3'));var rimraf=require('rimraf');var config=require(_0xdb2d('0x4'));var attributes=require(_0xdb2d('0x5'));module[_0xdb2d('0x6')]=function(_0x24926b,_0xa289e6){return _0x24926b['define'](_0xdb2d('0x7'),attributes,{'tableName':_0xdb2d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index f526a78..e7ad17a 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3070=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x2341ab,_0x326a6c){var _0x54533e=function(_0x413273){while(--_0x413273){_0x2341ab['push'](_0x2341ab['shift']());}};_0x54533e(++_0x326a6c);}(_0x3070,0x75));var _0x0307=function(_0x35013b,_0x195ec0){_0x35013b=_0x35013b-0x0;var _0xf12709=_0x3070[_0x35013b];return _0xf12709;};'use strict';var _=require('lodash');var util=require(_0x0307('0x0'));var moment=require('moment');var BPromise=require(_0x0307('0x1'));var rs=require(_0x0307('0x2'));var fs=require('fs');var Redis=require(_0x0307('0x3'));var db=require(_0x0307('0x4'))['db'];var utils=require(_0x0307('0x5'));var logger=require(_0x0307('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0307('0x7'));var client=jayson[_0x0307('0x8')][_0x0307('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc1dc51,_0x4fbe3e,_0x3ecfb6){return new BPromise(function(_0x41e638,_0x53e6b7){return client[_0x0307('0xa')](_0xc1dc51,_0x3ecfb6)[_0x0307('0xb')](function(_0x187fb3){logger[_0x0307('0xc')](_0x0307('0xd'),_0x4fbe3e,_0x0307('0xe'));logger[_0x0307('0xf')](_0x0307('0x10'),_0x4fbe3e,_0x0307('0xe'),JSON['stringify'](_0x187fb3));if(_0x187fb3[_0x0307('0x11')]){if(_0x187fb3['error'][_0x0307('0x12')]===0x1f4){logger[_0x0307('0x11')](_0x0307('0xd'),_0x4fbe3e,_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);return _0x53e6b7(_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);}logger[_0x0307('0x11')](_0x0307('0xd'),_0x4fbe3e,_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);return _0x41e638(_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);}else{logger[_0x0307('0xc')](_0x0307('0xd'),_0x4fbe3e,'request\x20sent');_0x41e638(_0x187fb3[_0x0307('0x14')][_0x0307('0x13')]);}})[_0x0307('0x15')](function(_0x5f11a5){logger['error'](_0x0307('0xd'),_0x4fbe3e,_0x5f11a5);_0x53e6b7(_0x5f11a5);});});} \ No newline at end of file +var _0x7880=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment'];(function(_0xd76e03,_0x527b40){var _0x30dd20=function(_0x10d530){while(--_0x10d530){_0xd76e03['push'](_0xd76e03['shift']());}};_0x30dd20(++_0x527b40);}(_0x7880,0x10f));var _0x0788=function(_0x385669,_0x43d386){_0x385669=_0x385669-0x0;var _0x11e2d2=_0x7880[_0x385669];return _0x11e2d2;};'use strict';var _=require(_0x0788('0x0'));var util=require('util');var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0788('0x6'));var config=require('../../config/environment');var jayson=require(_0x0788('0x7'));var client=jayson[_0x0788('0x8')][_0x0788('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ece1c,_0x14cfa5,_0x450b71){return new BPromise(function(_0x5366c7,_0x1662a2){return client[_0x0788('0xa')](_0x5ece1c,_0x450b71)[_0x0788('0xb')](function(_0x95ebe3){logger[_0x0788('0xc')](_0x0788('0xd'),_0x14cfa5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x14cfa5,_0x0788('0xe'),JSON[_0x0788('0x11')](_0x95ebe3));if(_0x95ebe3['error']){if(_0x95ebe3[_0x0788('0x12')]['code']===0x1f4){logger[_0x0788('0x12')](_0x0788('0xd'),_0x14cfa5,_0x95ebe3[_0x0788('0x12')][_0x0788('0x13')]);return _0x1662a2(_0x95ebe3[_0x0788('0x12')]['message']);}logger[_0x0788('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x14cfa5,_0x95ebe3[_0x0788('0x12')]['message']);return _0x5366c7(_0x95ebe3['error'][_0x0788('0x13')]);}else{logger[_0x0788('0xc')](_0x0788('0xd'),_0x14cfa5,'request\x20sent');_0x5366c7(_0x95ebe3[_0x0788('0x14')][_0x0788('0x13')]);}})['catch'](function(_0x334f58){logger[_0x0788('0x12')](_0x0788('0xd'),_0x14cfa5,_0x334f58);_0x1662a2(_0x334f58);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f8631ab..a5b9cb6 100644 --- a/server/api/intDeskField/index.js +++ b/server/api/intDeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8165=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','create','put','update','delete','destroy','multer','util','path'];(function(_0x5072c7,_0x309510){var _0x15a451=function(_0x3f2a7e){while(--_0x3f2a7e){_0x5072c7['push'](_0x5072c7['shift']());}};_0x15a451(++_0x309510);}(_0x8165,0x96));var _0x5816=function(_0x5862ec,_0x1f96c9){_0x5862ec=_0x5862ec-0x0;var _0x4d727b=_0x8165[_0x5862ec];return _0x4d727b;};'use strict';var multer=require(_0x5816('0x0'));var util=require(_0x5816('0x1'));var path=require(_0x5816('0x2'));var timeout=require(_0x5816('0x3'));var express=require(_0x5816('0x4'));var router=express[_0x5816('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5816('0x6'));var interaction=require(_0x5816('0x7'));var config=require(_0x5816('0x8'));var controller=require('./intDeskField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5816('0x9')](_0x5816('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5816('0xb')](),controller[_0x5816('0xc')]);router[_0x5816('0xd')](_0x5816('0xa'),auth['isAuthenticated'](),controller[_0x5816('0xe')]);router[_0x5816('0xf')](_0x5816('0xa'),auth[_0x5816('0xb')](),controller[_0x5816('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8be9=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer'];(function(_0x5d9fdf,_0x4bbefa){var _0x361769=function(_0x34e8f5){while(--_0x34e8f5){_0x5d9fdf['push'](_0x5d9fdf['shift']());}};_0x361769(++_0x4bbefa);}(_0x8be9,0x8f));var _0x98be=function(_0x8dfc35,_0x115773){_0x8dfc35=_0x8dfc35-0x0;var _0x2a98bd=_0x8be9[_0x8dfc35];return _0x2a98bd;};'use strict';var multer=require(_0x98be('0x0'));var util=require('util');var path=require(_0x98be('0x1'));var timeout=require(_0x98be('0x2'));var express=require(_0x98be('0x3'));var router=express[_0x98be('0x4')]();var fs_extra=require(_0x98be('0x5'));var auth=require(_0x98be('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x98be('0x7'));var controller=require('./intDeskField.controller');router[_0x98be('0x8')]('/',auth[_0x98be('0x9')](),controller[_0x98be('0xa')]);router['get'](_0x98be('0xb'),auth[_0x98be('0x9')](),controller[_0x98be('0xc')]);router[_0x98be('0xd')]('/',auth[_0x98be('0x9')](),controller[_0x98be('0xe')]);router['put'](_0x98be('0xb'),auth['isAuthenticated'](),controller[_0x98be('0xf')]);router['delete'](_0x98be('0xb'),auth['isAuthenticated'](),controller[_0x98be('0x10')]);module[_0x98be('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 225e5f1..f5e2212 100644 --- a/server/api/intDeskField/intDeskField.attributes.js +++ b/server/api/intDeskField/intDeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3689=['string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x185952,_0x914ad8){var _0x3b2d90=function(_0x154bc3){while(--_0x154bc3){_0x185952['push'](_0x185952['shift']());}};_0x3b2d90(++_0x914ad8);}(_0x3689,0x8d));var _0x9368=function(_0x31c00,_0x1b6d1c){_0x31c00=_0x31c00-0x0;var _0x33270c=_0x3689[_0x31c00];return _0x33270c;};'use strict';var Sequelize=require(_0x9368('0x0'));module[_0x9368('0x1')]={'type':{'type':Sequelize[_0x9368('0x2')](_0x9368('0x3'),_0x9368('0x4'),'customVariable',_0x9368('0x5'),_0x9368('0x6')),'defaultValue':_0x9368('0x3')},'content':{'type':Sequelize[_0x9368('0x7')]},'key':{'type':Sequelize[_0x9368('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9368('0x3'),_0x9368('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x9368('0x7')]},'idField':{'type':Sequelize[_0x9368('0x7')]},'nameField':{'type':Sequelize[_0x9368('0x7')]},'customField':{'type':Sequelize[_0x9368('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9368('0x7')]}}; \ No newline at end of file +var _0x6c93=['BOOLEAN','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x5ca004,_0x9d926b){var _0x8b7a64=function(_0x44ed7d){while(--_0x44ed7d){_0x5ca004['push'](_0x5ca004['shift']());}};_0x8b7a64(++_0x9d926b);}(_0x6c93,0x1c3));var _0x36c9=function(_0x2dd6b1,_0x4485d7){_0x2dd6b1=_0x2dd6b1-0x0;var _0x494306=_0x6c93[_0x2dd6b1];return _0x494306;};'use strict';var Sequelize=require('sequelize');module[_0x36c9('0x0')]={'type':{'type':Sequelize[_0x36c9('0x1')]('string',_0x36c9('0x2'),_0x36c9('0x3'),_0x36c9('0x4'),_0x36c9('0x5')),'defaultValue':_0x36c9('0x6')},'content':{'type':Sequelize[_0x36c9('0x7')]},'key':{'type':Sequelize[_0x36c9('0x7')]},'keyType':{'type':Sequelize[_0x36c9('0x1')](_0x36c9('0x6'),'variable',_0x36c9('0x3'))},'keyContent':{'type':Sequelize[_0x36c9('0x7')]},'idField':{'type':Sequelize[_0x36c9('0x7')]},'nameField':{'type':Sequelize[_0x36c9('0x7')]},'customField':{'type':Sequelize[_0x36c9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x36c9('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1f7b95a..77bbaec 100644 --- a/server/api/intDeskField/intDeskField.controller.js +++ b/server/api/intDeskField/intDeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc838=['json','offset','undefined','count','limit','set','Content-Range','save','update','then','error','send','DeskField','rawAttributes','fieldName','type','key','map','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','rows','catch','show','options','create','body','find','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end'];(function(_0x21503d,_0x2c00bc){var _0xabc3e3=function(_0x32214b){while(--_0x32214b){_0x21503d['push'](_0x21503d['shift']());}};_0xabc3e3(++_0x2c00bc);}(_0xc838,0xbd));var _0x8c83=function(_0x4bd34f,_0x27f4fd){_0x4bd34f=_0x4bd34f-0x0;var _0x3d235f=_0xc838[_0x4bd34f];return _0x3d235f;};'use strict';var emlformat=require(_0x8c83('0x0'));var rimraf=require(_0x8c83('0x1'));var zipdir=require(_0x8c83('0x2'));var jsonpatch=require(_0x8c83('0x3'));var rp=require(_0x8c83('0x4'));var moment=require(_0x8c83('0x5'));var BPromise=require(_0x8c83('0x6'));var Mustache=require(_0x8c83('0x7'));var util=require(_0x8c83('0x8'));var path=require(_0x8c83('0x9'));var sox=require(_0x8c83('0xa'));var csv=require(_0x8c83('0xb'));var ejs=require(_0x8c83('0xc'));var fs=require('fs');var fs_extra=require(_0x8c83('0xd'));var _=require(_0x8c83('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8c83('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8c83('0xb'));var querystring=require(_0x8c83('0x10'));var Papa=require(_0x8c83('0x11'));var Redis=require(_0x8c83('0x12'));var authService=require(_0x8c83('0x13'));var qs=require(_0x8c83('0x14'));var as=require(_0x8c83('0x15'));var hardwareService=require(_0x8c83('0x16'));var logger=require(_0x8c83('0x17'))(_0x8c83('0x18'));var utils=require(_0x8c83('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8c83('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51d568,_0x4a2fc7){_0x4a2fc7=_0x4a2fc7||0xcc;return function(_0x57a0b5){if(_0x57a0b5){return _0x51d568[_0x8c83('0x1b')](_0x4a2fc7);}return _0x51d568[_0x8c83('0x1c')](_0x4a2fc7)[_0x8c83('0x1d')]();};}function respondWithResult(_0x45d86c,_0x401fc5){_0x401fc5=_0x401fc5||0xc8;return function(_0x1aaac5){if(_0x1aaac5){return _0x45d86c[_0x8c83('0x1c')](_0x401fc5)[_0x8c83('0x1e')](_0x1aaac5);}};}function respondWithFilteredResult(_0x1ac932,_0xf2dee0){return function(_0x573b7d){if(_0x573b7d){var _0x2b4027=typeof _0xf2dee0[_0x8c83('0x1f')]==='undefined'&&typeof _0xf2dee0['limit']===_0x8c83('0x20');var _0x4e3da8=_0x573b7d[_0x8c83('0x21')];var _0x535962=_0x2b4027?0x0:_0xf2dee0['offset'];var _0x3f4b38=_0x2b4027?_0x573b7d['count']:_0xf2dee0[_0x8c83('0x1f')]+_0xf2dee0[_0x8c83('0x22')];var _0x505c0c;if(_0x3f4b38>=_0x4e3da8){_0x3f4b38=_0x4e3da8;_0x505c0c=0xc8;}else{_0x505c0c=0xce;}_0x1ac932['status'](_0x505c0c);return _0x1ac932[_0x8c83('0x23')](_0x8c83('0x24'),_0x535962+'-'+_0x3f4b38+'/'+_0x4e3da8)['json'](_0x573b7d);}return null;};}function patchUpdates(_0x41e629){return function(_0x18f718){try{jsonpatch['apply'](_0x18f718,_0x41e629,!![]);}catch(_0x34825d){return BPromise['reject'](_0x34825d);}return _0x18f718[_0x8c83('0x25')]();};}function saveUpdates(_0x39b02f,_0x17937e){return function(_0xf7b089){if(_0xf7b089){return _0xf7b089[_0x8c83('0x26')](_0x39b02f)['then'](function(_0x4faecd){return _0x4faecd;});}return null;};}function removeEntity(_0x29fced,_0x3a21e9){return function(_0x59e6f9){if(_0x59e6f9){return _0x59e6f9['destroy']()[_0x8c83('0x27')](function(){_0x29fced[_0x8c83('0x1c')](0xcc)[_0x8c83('0x1d')]();});}};}function handleEntityNotFound(_0x5034e1,_0x1bd922){return function(_0x4f7088){if(!_0x4f7088){_0x5034e1[_0x8c83('0x1b')](0x194);}return _0x4f7088;};}function handleError(_0xc5d97d,_0x29b5d8){_0x29b5d8=_0x29b5d8||0x1f4;return function(_0x1180e1){logger[_0x8c83('0x28')](_0x1180e1['stack']);if(_0x1180e1['name']){delete _0x1180e1['name'];}_0xc5d97d[_0x8c83('0x1c')](_0x29b5d8)[_0x8c83('0x29')](_0x1180e1);};}exports['index']=function(_0x106f71,_0x12419a){var _0x142201={},_0x596ff0={},_0x48a74b={'count':0x0,'rows':[]};var _0x1b054a=_['map'](db[_0x8c83('0x2a')][_0x8c83('0x2b')],function(_0x290af8){return{'name':_0x290af8[_0x8c83('0x2c')],'type':_0x290af8[_0x8c83('0x2d')][_0x8c83('0x2e')]};});_0x596ff0['model']=_[_0x8c83('0x2f')](_0x1b054a,_0x8c83('0x30'));_0x596ff0[_0x8c83('0x31')]=_[_0x8c83('0x32')](_0x106f71[_0x8c83('0x31')]);_0x596ff0[_0x8c83('0x33')]=_[_0x8c83('0x34')](_0x596ff0[_0x8c83('0x35')],_0x596ff0[_0x8c83('0x31')]);_0x142201[_0x8c83('0x36')]=_['intersection'](_0x596ff0[_0x8c83('0x35')],qs[_0x8c83('0x37')](_0x106f71[_0x8c83('0x31')]['fields']));_0x142201[_0x8c83('0x36')]=_0x142201[_0x8c83('0x36')]['length']?_0x142201[_0x8c83('0x36')]:_0x596ff0[_0x8c83('0x35')];if(!_0x106f71[_0x8c83('0x31')][_0x8c83('0x38')](_0x8c83('0x39'))){_0x142201[_0x8c83('0x22')]=qs[_0x8c83('0x22')](_0x106f71[_0x8c83('0x31')][_0x8c83('0x22')]);_0x142201[_0x8c83('0x1f')]=qs[_0x8c83('0x1f')](_0x106f71[_0x8c83('0x31')]['offset']);}_0x142201['order']=qs[_0x8c83('0x3a')](_0x106f71[_0x8c83('0x31')][_0x8c83('0x3a')]);_0x142201[_0x8c83('0x3b')]=qs[_0x8c83('0x33')](_['pick'](_0x106f71['query'],_0x596ff0[_0x8c83('0x33')]),_0x1b054a);if(_0x106f71[_0x8c83('0x31')][_0x8c83('0x3c')]){_0x142201['where']=_['merge'](_0x142201['where'],{'$or':_['map'](_0x1b054a,function(_0x259bca){if(_0x259bca[_0x8c83('0x2d')]!==_0x8c83('0x3d')){var _0xbc83f8={};_0xbc83f8[_0x259bca[_0x8c83('0x30')]]={'$like':'%'+_0x106f71[_0x8c83('0x31')][_0x8c83('0x3c')]+'%'};return _0xbc83f8;}})});}_0x142201=_[_0x8c83('0x3e')]({},_0x142201,_0x106f71['options']);var _0x5bfea5={'where':_0x142201[_0x8c83('0x3b')]};return db[_0x8c83('0x2a')][_0x8c83('0x21')](_0x5bfea5)['then'](function(_0x2bab6d){_0x48a74b['count']=_0x2bab6d;if(_0x106f71[_0x8c83('0x31')][_0x8c83('0x3f')]){_0x142201['include']=[{'all':!![]}];}return db[_0x8c83('0x2a')]['findAll'](_0x142201);})['then'](function(_0x5dfc16){_0x48a74b[_0x8c83('0x40')]=_0x5dfc16;return _0x48a74b;})[_0x8c83('0x27')](respondWithFilteredResult(_0x12419a,_0x142201))[_0x8c83('0x41')](handleError(_0x12419a,null));};exports[_0x8c83('0x42')]=function(_0x3e4eb9,_0x3883de){var _0x3a6c98={'raw':!![],'where':{'id':_0x3e4eb9['params']['id']}},_0x4b540d={};_0x4b540d[_0x8c83('0x35')]=_[_0x8c83('0x32')](db[_0x8c83('0x2a')][_0x8c83('0x2b')]);_0x4b540d[_0x8c83('0x31')]=_[_0x8c83('0x32')](_0x3e4eb9[_0x8c83('0x31')]);_0x4b540d['filters']=_['intersection'](_0x4b540d[_0x8c83('0x35')],_0x4b540d[_0x8c83('0x31')]);_0x3a6c98[_0x8c83('0x36')]=_[_0x8c83('0x34')](_0x4b540d[_0x8c83('0x35')],qs[_0x8c83('0x37')](_0x3e4eb9[_0x8c83('0x31')][_0x8c83('0x37')]));_0x3a6c98[_0x8c83('0x36')]=_0x3a6c98[_0x8c83('0x36')]['length']?_0x3a6c98['attributes']:_0x4b540d[_0x8c83('0x35')];if(_0x3e4eb9[_0x8c83('0x31')][_0x8c83('0x3f')]){_0x3a6c98['include']=[{'all':!![]}];}_0x3a6c98=_[_0x8c83('0x3e')]({},_0x3a6c98,_0x3e4eb9[_0x8c83('0x43')]);return db[_0x8c83('0x2a')]['find'](_0x3a6c98)['then'](handleEntityNotFound(_0x3883de,null))['then'](respondWithResult(_0x3883de,null))[_0x8c83('0x41')](handleError(_0x3883de,null));};exports['create']=function(_0x5d3734,_0x35ee54){return db['DeskField'][_0x8c83('0x44')](_0x5d3734[_0x8c83('0x45')],{})[_0x8c83('0x27')](respondWithResult(_0x35ee54,0xc9))[_0x8c83('0x41')](handleError(_0x35ee54,null));};exports['update']=function(_0x5d8f9f,_0x2c8853){if(_0x5d8f9f[_0x8c83('0x45')]['id']){delete _0x5d8f9f[_0x8c83('0x45')]['id'];}return db['DeskField'][_0x8c83('0x46')]({'where':{'id':_0x5d8f9f['params']['id']}})[_0x8c83('0x27')](handleEntityNotFound(_0x2c8853,null))[_0x8c83('0x27')](saveUpdates(_0x5d8f9f[_0x8c83('0x45')],null))[_0x8c83('0x27')](respondWithResult(_0x2c8853,null))['catch'](handleError(_0x2c8853,null));};exports[_0x8c83('0x47')]=function(_0x5830b5,_0x595397){return db[_0x8c83('0x2a')][_0x8c83('0x46')]({'where':{'id':_0x5830b5[_0x8c83('0x48')]['id']}})[_0x8c83('0x27')](handleEntityNotFound(_0x595397,null))['then'](removeEntity(_0x595397,null))[_0x8c83('0x41')](handleError(_0x595397,null));}; \ No newline at end of file +var _0x960c=['set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','DeskField','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x960c,0x113));var _0xc960=function(_0x5de8c7,_0x498fa3){_0x5de8c7=_0x5de8c7-0x0;var _0x1611af=_0x960c[_0x5de8c7];return _0x1611af;};'use strict';var emlformat=require(_0xc960('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc960('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc960('0x2'));var moment=require(_0xc960('0x3'));var BPromise=require(_0xc960('0x4'));var Mustache=require('mustache');var util=require(_0xc960('0x5'));var path=require(_0xc960('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc960('0x7'));var fs=require('fs');var fs_extra=require(_0xc960('0x8'));var _=require(_0xc960('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc960('0xa'));var deskjs=require(_0xc960('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc960('0xc'));var Redis=require(_0xc960('0xd'));var authService=require(_0xc960('0xe'));var qs=require(_0xc960('0xf'));var as=require(_0xc960('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc960('0x11'))(_0xc960('0x12'));var utils=require(_0xc960('0x13'));var config=require(_0xc960('0x14'));var licenseUtil=require(_0xc960('0x15'));var db=require(_0xc960('0x16'))['db'];function respondWithStatusCode(_0x371361,_0x25cbcc){_0x25cbcc=_0x25cbcc||0xcc;return function(_0x25e805){if(_0x25e805){return _0x371361[_0xc960('0x17')](_0x25cbcc);}return _0x371361[_0xc960('0x18')](_0x25cbcc)['end']();};}function respondWithResult(_0x3a6e2c,_0x2e6f0e){_0x2e6f0e=_0x2e6f0e||0xc8;return function(_0x427c4d){if(_0x427c4d){return _0x3a6e2c[_0xc960('0x18')](_0x2e6f0e)['json'](_0x427c4d);}};}function respondWithFilteredResult(_0x1fb9fe,_0x49326c){return function(_0x195ff0){if(_0x195ff0){var _0x43cd5a=typeof _0x49326c[_0xc960('0x19')]===_0xc960('0x1a')&&typeof _0x49326c[_0xc960('0x1b')]===_0xc960('0x1a');var _0x32e2f5=_0x195ff0[_0xc960('0x1c')];var _0x34ccf1=_0x43cd5a?0x0:_0x49326c[_0xc960('0x19')];var _0x3462c5=_0x43cd5a?_0x195ff0[_0xc960('0x1c')]:_0x49326c[_0xc960('0x19')]+_0x49326c['limit'];var _0x6ad87d;if(_0x3462c5>=_0x32e2f5){_0x3462c5=_0x32e2f5;_0x6ad87d=0xc8;}else{_0x6ad87d=0xce;}_0x1fb9fe[_0xc960('0x18')](_0x6ad87d);return _0x1fb9fe[_0xc960('0x1d')](_0xc960('0x1e'),_0x34ccf1+'-'+_0x3462c5+'/'+_0x32e2f5)[_0xc960('0x1f')](_0x195ff0);}return null;};}function patchUpdates(_0x5e0536){return function(_0x3b4b5c){try{jsonpatch[_0xc960('0x20')](_0x3b4b5c,_0x5e0536,!![]);}catch(_0x232375){return BPromise[_0xc960('0x21')](_0x232375);}return _0x3b4b5c[_0xc960('0x22')]();};}function saveUpdates(_0x881df5,_0x309885){return function(_0x3770de){if(_0x3770de){return _0x3770de[_0xc960('0x23')](_0x881df5)['then'](function(_0x5671f2){return _0x5671f2;});}return null;};}function removeEntity(_0x9cf5e8,_0x536ed4){return function(_0x8dbf09){if(_0x8dbf09){return _0x8dbf09[_0xc960('0x24')]()[_0xc960('0x25')](function(){_0x9cf5e8[_0xc960('0x18')](0xcc)[_0xc960('0x26')]();});}};}function handleEntityNotFound(_0x43c5aa,_0xc14cb6){return function(_0x3458f4){if(!_0x3458f4){_0x43c5aa[_0xc960('0x17')](0x194);}return _0x3458f4;};}function handleError(_0x540390,_0x56a6d5){_0x56a6d5=_0x56a6d5||0x1f4;return function(_0x274481){logger[_0xc960('0x27')](_0x274481[_0xc960('0x28')]);if(_0x274481[_0xc960('0x29')]){delete _0x274481[_0xc960('0x29')];}_0x540390[_0xc960('0x18')](_0x56a6d5)[_0xc960('0x2a')](_0x274481);};}exports[_0xc960('0x2b')]=function(_0x5b42c4,_0x5ce276){var _0x535275={},_0x1f6212={},_0x49079a={'count':0x0,'rows':[]};var _0x478024=_[_0xc960('0x2c')](db['DeskField']['rawAttributes'],function(_0x2accff){return{'name':_0x2accff[_0xc960('0x2d')],'type':_0x2accff[_0xc960('0x2e')][_0xc960('0x2f')]};});_0x1f6212[_0xc960('0x30')]=_['map'](_0x478024,_0xc960('0x29'));_0x1f6212[_0xc960('0x31')]=_[_0xc960('0x32')](_0x5b42c4['query']);_0x1f6212[_0xc960('0x33')]=_['intersection'](_0x1f6212[_0xc960('0x30')],_0x1f6212['query']);_0x535275[_0xc960('0x34')]=_[_0xc960('0x35')](_0x1f6212[_0xc960('0x30')],qs[_0xc960('0x36')](_0x5b42c4[_0xc960('0x31')][_0xc960('0x36')]));_0x535275[_0xc960('0x34')]=_0x535275['attributes']['length']?_0x535275[_0xc960('0x34')]:_0x1f6212[_0xc960('0x30')];if(!_0x5b42c4[_0xc960('0x31')][_0xc960('0x37')]('nolimit')){_0x535275[_0xc960('0x1b')]=qs[_0xc960('0x1b')](_0x5b42c4[_0xc960('0x31')][_0xc960('0x1b')]);_0x535275[_0xc960('0x19')]=qs[_0xc960('0x19')](_0x5b42c4[_0xc960('0x31')][_0xc960('0x19')]);}_0x535275[_0xc960('0x38')]=qs[_0xc960('0x39')](_0x5b42c4[_0xc960('0x31')]['sort']);_0x535275['where']=qs[_0xc960('0x33')](_[_0xc960('0x3a')](_0x5b42c4[_0xc960('0x31')],_0x1f6212[_0xc960('0x33')]),_0x478024);if(_0x5b42c4[_0xc960('0x31')][_0xc960('0x3b')]){_0x535275['where']=_[_0xc960('0x3c')](_0x535275['where'],{'$or':_[_0xc960('0x2c')](_0x478024,function(_0x29ae2d){if(_0x29ae2d[_0xc960('0x2e')]!==_0xc960('0x3d')){var _0x141235={};_0x141235[_0x29ae2d[_0xc960('0x29')]]={'$like':'%'+_0x5b42c4[_0xc960('0x31')]['filter']+'%'};return _0x141235;}})});}_0x535275=_[_0xc960('0x3c')]({},_0x535275,_0x5b42c4[_0xc960('0x3e')]);var _0x123edc={'where':_0x535275['where']};return db[_0xc960('0x3f')]['count'](_0x123edc)[_0xc960('0x25')](function(_0x65a99f){_0x49079a[_0xc960('0x1c')]=_0x65a99f;if(_0x5b42c4['query'][_0xc960('0x40')]){_0x535275[_0xc960('0x41')]=[{'all':!![]}];}return db[_0xc960('0x3f')][_0xc960('0x42')](_0x535275);})[_0xc960('0x25')](function(_0x1ce91c){_0x49079a[_0xc960('0x43')]=_0x1ce91c;return _0x49079a;})[_0xc960('0x25')](respondWithFilteredResult(_0x5ce276,_0x535275))['catch'](handleError(_0x5ce276,null));};exports[_0xc960('0x44')]=function(_0xd94ad7,_0x2798ef){var _0x3f2e72={'raw':!![],'where':{'id':_0xd94ad7[_0xc960('0x45')]['id']}},_0xf8b2b={};_0xf8b2b[_0xc960('0x30')]=_[_0xc960('0x32')](db[_0xc960('0x3f')][_0xc960('0x46')]);_0xf8b2b[_0xc960('0x31')]=_[_0xc960('0x32')](_0xd94ad7['query']);_0xf8b2b[_0xc960('0x33')]=_[_0xc960('0x35')](_0xf8b2b[_0xc960('0x30')],_0xf8b2b[_0xc960('0x31')]);_0x3f2e72[_0xc960('0x34')]=_[_0xc960('0x35')](_0xf8b2b[_0xc960('0x30')],qs['fields'](_0xd94ad7[_0xc960('0x31')][_0xc960('0x36')]));_0x3f2e72[_0xc960('0x34')]=_0x3f2e72['attributes'][_0xc960('0x47')]?_0x3f2e72[_0xc960('0x34')]:_0xf8b2b[_0xc960('0x30')];if(_0xd94ad7['query']['includeAll']){_0x3f2e72['include']=[{'all':!![]}];}_0x3f2e72=_[_0xc960('0x3c')]({},_0x3f2e72,_0xd94ad7[_0xc960('0x3e')]);return db[_0xc960('0x3f')][_0xc960('0x48')](_0x3f2e72)[_0xc960('0x25')](handleEntityNotFound(_0x2798ef,null))[_0xc960('0x25')](respondWithResult(_0x2798ef,null))[_0xc960('0x49')](handleError(_0x2798ef,null));};exports['create']=function(_0x241949,_0x460e98){return db[_0xc960('0x3f')][_0xc960('0x4a')](_0x241949[_0xc960('0x4b')],{})[_0xc960('0x25')](respondWithResult(_0x460e98,0xc9))['catch'](handleError(_0x460e98,null));};exports['update']=function(_0x2ec45b,_0x232479){if(_0x2ec45b['body']['id']){delete _0x2ec45b['body']['id'];}return db[_0xc960('0x3f')][_0xc960('0x48')]({'where':{'id':_0x2ec45b[_0xc960('0x45')]['id']}})['then'](handleEntityNotFound(_0x232479,null))[_0xc960('0x25')](saveUpdates(_0x2ec45b[_0xc960('0x4b')],null))[_0xc960('0x25')](respondWithResult(_0x232479,null))[_0xc960('0x49')](handleError(_0x232479,null));};exports[_0xc960('0x24')]=function(_0x3458c6,_0x11ecee){return db[_0xc960('0x3f')][_0xc960('0x48')]({'where':{'id':_0x3458c6[_0xc960('0x45')]['id']}})[_0xc960('0x25')](handleEntityNotFound(_0x11ecee,null))[_0xc960('0x25')](removeEntity(_0x11ecee,null))[_0xc960('0x49')](handleError(_0x11ecee,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 5589e36..89555eb 100644 --- a/server/api/intDeskField/intDeskField.model.js +++ b/server/api/intDeskField/intDeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf622=['./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','request-promise','../../config/environment'];(function(_0x1e1305,_0x4444a2){var _0x2d91c5=function(_0x7332c7){while(--_0x7332c7){_0x1e1305['push'](_0x1e1305['shift']());}};_0x2d91c5(++_0x4444a2);}(_0xf622,0x1ab));var _0x2f62=function(_0x6f8249,_0x19e3eb){_0x6f8249=_0x6f8249-0x0;var _0x30f539=_0xf622[_0x6f8249];return _0x30f539;};'use strict';var _=require(_0x2f62('0x0'));var util=require('util');var logger=require(_0x2f62('0x1'))(_0x2f62('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f62('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2f62('0x4'));var attributes=require(_0x2f62('0x5'));module[_0x2f62('0x6')]=function(_0x4b8c9f,_0x26f4be){return _0x4b8c9f[_0x2f62('0x7')](_0x2f62('0x8'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x2f62('0x9'),'fields':[_0x2f62('0xa'),_0x2f62('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d2e=['../../config/logger','api','moment','bluebird','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util'];(function(_0x4a04f3,_0x2fff74){var _0x1b0686=function(_0xfa3eb){while(--_0xfa3eb){_0x4a04f3['push'](_0x4a04f3['shift']());}};_0x1b0686(++_0x2fff74);}(_0x4d2e,0x110));var _0xe4d2=function(_0x5f27f2,_0x1448f0){_0x5f27f2=_0x5f27f2-0x0;var _0x8817d7=_0x4d2e[_0x5f27f2];return _0x8817d7;};'use strict';var _=require('lodash');var util=require(_0xe4d2('0x0'));var logger=require(_0xe4d2('0x1'))(_0xe4d2('0x2'));var moment=require(_0xe4d2('0x3'));var BPromise=require(_0xe4d2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe4d2('0x5'));var attributes=require('./intDeskField.attributes');module[_0xe4d2('0x6')]=function(_0x3de4cd,_0x2c0cb8){return _0x3de4cd[_0xe4d2('0x7')](_0xe4d2('0x8'),attributes,{'tableName':_0xe4d2('0x9'),'paranoid':![],'indexes':[{'name':_0xe4d2('0xa'),'fields':[_0xe4d2('0xb'),_0xe4d2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 2563d4e..4ba230e 100644 --- a/server/api/intDeskField/intDeskField.rpc.js +++ b/server/api/intDeskField/intDeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaaa2=['DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskField,\x20%s,\x20%s','catch','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xaaa2,0x142));var _0x2aaa=function(_0x4af368,_0x3732b6){_0x4af368=_0x4af368-0x0;var _0x1b44bc=_0xaaa2[_0x4af368];return _0x1b44bc;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var moment=require(_0x2aaa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2aaa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aaa('0x4'));var logger=require('../../config/logger')(_0x2aaa('0x5'));var config=require(_0x2aaa('0x6'));var jayson=require(_0x2aaa('0x7'));var client=jayson[_0x2aaa('0x8')][_0x2aaa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14999c,_0x2b6bd6,_0x381de4){return new BPromise(function(_0x2951f4,_0x2f7cde){return client[_0x2aaa('0xa')](_0x14999c,_0x381de4)[_0x2aaa('0xb')](function(_0x43f54d){logger[_0x2aaa('0xc')]('DeskField,\x20%s,\x20%s',_0x2b6bd6,_0x2aaa('0xd'));logger['debug'](_0x2aaa('0xe'),_0x2b6bd6,_0x2aaa('0xd'),JSON[_0x2aaa('0xf')](_0x43f54d));if(_0x43f54d[_0x2aaa('0x10')]){if(_0x43f54d[_0x2aaa('0x10')][_0x2aaa('0x11')]===0x1f4){logger[_0x2aaa('0x10')]('DeskField,\x20%s,\x20%s',_0x2b6bd6,_0x43f54d[_0x2aaa('0x10')][_0x2aaa('0x12')]);return _0x2f7cde(_0x43f54d[_0x2aaa('0x10')][_0x2aaa('0x12')]);}logger[_0x2aaa('0x10')](_0x2aaa('0x13'),_0x2b6bd6,_0x43f54d['error'][_0x2aaa('0x12')]);return _0x2951f4(_0x43f54d[_0x2aaa('0x10')][_0x2aaa('0x12')]);}else{logger[_0x2aaa('0xc')]('DeskField,\x20%s,\x20%s',_0x2b6bd6,_0x2aaa('0xd'));_0x2951f4(_0x43f54d['result'][_0x2aaa('0x12')]);}})[_0x2aaa('0x14')](function(_0xe6dfc8){logger[_0x2aaa('0x10')](_0x2aaa('0x13'),_0x2b6bd6,_0xe6dfc8);_0x2f7cde(_0xe6dfc8);});});} \ No newline at end of file +var _0x53ee=['client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x211a82,_0x17f675){var _0x14932f=function(_0x4245e1){while(--_0x4245e1){_0x211a82['push'](_0x211a82['shift']());}};_0x14932f(++_0x17f675);}(_0x53ee,0x1af));var _0xe53e=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x53ee[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe53e('0x0'));var BPromise=require(_0xe53e('0x1'));var rs=require(_0xe53e('0x2'));var fs=require('fs');var Redis=require(_0xe53e('0x3'));var db=require(_0xe53e('0x4'))['db'];var utils=require(_0xe53e('0x5'));var logger=require(_0xe53e('0x6'))(_0xe53e('0x7'));var config=require('../../config/environment');var jayson=require(_0xe53e('0x8'));var client=jayson[_0xe53e('0x9')][_0xe53e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47459e,_0x11376c,_0x55da57){return new BPromise(function(_0x375f1f,_0x42669d){return client[_0xe53e('0xb')](_0x47459e,_0x55da57)[_0xe53e('0xc')](function(_0xa1ef16){logger['info'](_0xe53e('0xd'),_0x11376c,_0xe53e('0xe'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x11376c,_0xe53e('0xe'),JSON[_0xe53e('0xf')](_0xa1ef16));if(_0xa1ef16[_0xe53e('0x10')]){if(_0xa1ef16[_0xe53e('0x10')][_0xe53e('0x11')]===0x1f4){logger[_0xe53e('0x10')]('DeskField,\x20%s,\x20%s',_0x11376c,_0xa1ef16['error']['message']);return _0x42669d(_0xa1ef16['error'][_0xe53e('0x12')]);}logger['error'](_0xe53e('0xd'),_0x11376c,_0xa1ef16[_0xe53e('0x10')][_0xe53e('0x12')]);return _0x375f1f(_0xa1ef16['error'][_0xe53e('0x12')]);}else{logger[_0xe53e('0x13')](_0xe53e('0xd'),_0x11376c,_0xe53e('0xe'));_0x375f1f(_0xa1ef16[_0xe53e('0x14')]['message']);}})[_0xe53e('0x15')](function(_0x4f2176){logger[_0xe53e('0x10')]('DeskField,\x20%s,\x20%s',_0x11376c,_0x4f2176);_0x42669d(_0x4f2176);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 4ff2e7d..a050ad9 100644 --- a/server/api/intDynamics365Account/index.js +++ b/server/api/intDynamics365Account/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97ad=['update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','/:id/configurations','put'];(function(_0x141d43,_0x570a1e){var _0x188b2d=function(_0x56d0ba){while(--_0x56d0ba){_0x141d43['push'](_0x141d43['shift']());}};_0x188b2d(++_0x570a1e);}(_0x97ad,0x1b8));var _0xd97a=function(_0x5e0795,_0xc62997){_0x5e0795=_0x5e0795-0x0;var _0x2cc0b9=_0x97ad[_0x5e0795];return _0x2cc0b9;};'use strict';var multer=require(_0xd97a('0x0'));var util=require(_0xd97a('0x1'));var path=require(_0xd97a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd97a('0x3')]();var fs_extra=require(_0xd97a('0x4'));var auth=require(_0xd97a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0xd97a('0x6')]('/',auth[_0xd97a('0x7')](),controller[_0xd97a('0x8')]);router['get'](_0xd97a('0x9'),auth[_0xd97a('0x7')](),controller[_0xd97a('0xa')]);router[_0xd97a('0x6')]('/:id/configurations',auth[_0xd97a('0x7')](),controller[_0xd97a('0xb')]);router[_0xd97a('0x6')](_0xd97a('0xc'),auth[_0xd97a('0x7')](),controller[_0xd97a('0xd')]);router['post']('/',auth[_0xd97a('0x7')](),controller['create']);router['post'](_0xd97a('0xe'),auth[_0xd97a('0x7')](),controller['addConfiguration']);router[_0xd97a('0xf')](_0xd97a('0x9'),auth[_0xd97a('0x7')](),controller[_0xd97a('0x10')]);router[_0xd97a('0x11')](_0xd97a('0x9'),auth[_0xd97a('0x7')](),controller['destroy']);module[_0xd97a('0x12')]=router; \ No newline at end of file +var _0x5885=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','exports'];(function(_0x176317,_0x4897b3){var _0xef2759=function(_0x581e2b){while(--_0x581e2b){_0x176317['push'](_0x176317['shift']());}};_0xef2759(++_0x4897b3);}(_0x5885,0x198));var _0x5588=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5885[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x5588('0x0'));var util=require(_0x5588('0x1'));var path=require('path');var timeout=require(_0x5588('0x2'));var express=require(_0x5588('0x3'));var router=express[_0x5588('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5588('0x5'));var interaction=require(_0x5588('0x6'));var config=require('../../config/environment');var controller=require(_0x5588('0x7'));router['get']('/',auth[_0x5588('0x8')](),controller[_0x5588('0x9')]);router[_0x5588('0xa')](_0x5588('0xb'),auth[_0x5588('0x8')](),controller[_0x5588('0xc')]);router[_0x5588('0xa')](_0x5588('0xd'),auth[_0x5588('0x8')](),controller[_0x5588('0xe')]);router[_0x5588('0xa')](_0x5588('0xf'),auth[_0x5588('0x8')](),controller[_0x5588('0x10')]);router['post']('/',auth[_0x5588('0x8')](),controller[_0x5588('0x11')]);router[_0x5588('0x12')](_0x5588('0xd'),auth[_0x5588('0x8')](),controller[_0x5588('0x13')]);router['put'](_0x5588('0xb'),auth['isAuthenticated'](),controller[_0x5588('0x14')]);router[_0x5588('0x15')](_0x5588('0xb'),auth[_0x5588('0x8')](),controller[_0x5588('0x16')]);module[_0x5588('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 437681a..ed8304f 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.attributes.js +++ b/server/api/intDynamics365Account/intDynamics365Account.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab86=['STRING','BOOLEAN','sequelize','exports'];(function(_0x629c0d,_0xf7892e){var _0x3f3cc1=function(_0x5e9d4a){while(--_0x5e9d4a){_0x629c0d['push'](_0x629c0d['shift']());}};_0x3f3cc1(++_0xf7892e);}(_0xab86,0x13e));var _0x6ab8=function(_0x3c57c5,_0x1bcd12){_0x3c57c5=_0x3c57c5-0x0;var _0x3a2ac9=_0xab86[_0x3c57c5];return _0x3a2ac9;};'use strict';var Sequelize=require(_0x6ab8('0x0'));module[_0x6ab8('0x1')]={'name':{'type':Sequelize[_0x6ab8('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6ab8('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6ab8('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6ab8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6ab8('0x2')]},'modernAuthentication':{'type':Sequelize[_0x6ab8('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x38e4=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4e6452,_0x228b08){var _0x1459ba=function(_0x2c20ef){while(--_0x2c20ef){_0x4e6452['push'](_0x4e6452['shift']());}};_0x1459ba(++_0x228b08);}(_0x38e4,0x9e));var _0x438e=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x38e4[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x438e('0x0'));module[_0x438e('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x438e('0x2')]},'password':{'type':Sequelize[_0x438e('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x438e('0x2')]},'clientId':{'type':Sequelize[_0x438e('0x2')]},'clientSecret':{'type':Sequelize[_0x438e('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x438e('0x2')]},'modernAuthentication':{'type':Sequelize[_0x438e('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 84e8284..62e4255 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.controller.js +++ b/server/api/intDynamics365Account/intDynamics365Account.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0db=['pick','filter','merge','where','map','VIRTUAL','includeAll','include','findAll','catch','show','rawAttributes','options','find','create','body','params','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Configuration','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','tenantId','modernAuthentication','CloudProvider','data5','data7','access_token','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','isNil','BooleanAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','error','stack','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','json','offset','limit','undefined','count','status','set','Content-Range','then','destroy','end','sendStatus','name','send','index','Dynamics365Account','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x2fd0fb,_0x47f885){var _0x16aa32=function(_0x20bfc9){while(--_0x20bfc9){_0x2fd0fb['push'](_0x2fd0fb['shift']());}};_0x16aa32(++_0x47f885);}(_0xf0db,0x160));var _0xbf0d=function(_0x5c1eba,_0x2a356c){_0x5c1eba=_0x5c1eba-0x0;var _0x46e2dc=_0xf0db[_0x5c1eba];return _0x46e2dc;};'use strict';var rp=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var _=require(_0xbf0d('0x2'));var qs=require(_0xbf0d('0x3'));var logger=require(_0xbf0d('0x4'))(_0xbf0d('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbf0d('0x6'));function respondWithResult(_0x3c3e13,_0x329a2a){_0x329a2a=_0x329a2a||0xc8;return function(_0x3e96cb){if(_0x3e96cb){return _0x3c3e13['status'](_0x329a2a)[_0xbf0d('0x7')](_0x3e96cb);}};}function respondWithFilteredResult(_0x3f2ea7,_0x578df5){return function(_0x421fce){if(_0x421fce){var _0x4af546=typeof _0x578df5[_0xbf0d('0x8')]==='undefined'&&typeof _0x578df5[_0xbf0d('0x9')]===_0xbf0d('0xa');var _0x514141=_0x421fce[_0xbf0d('0xb')];var _0x3c8c84=_0x4af546?0x0:_0x578df5['offset'];var _0x105863=_0x4af546?_0x421fce[_0xbf0d('0xb')]:_0x578df5[_0xbf0d('0x8')]+_0x578df5[_0xbf0d('0x9')];var _0x58be05;if(_0x105863>=_0x514141){_0x105863=_0x514141;_0x58be05=0xc8;}else{_0x58be05=0xce;}_0x3f2ea7[_0xbf0d('0xc')](_0x58be05);return _0x3f2ea7[_0xbf0d('0xd')](_0xbf0d('0xe'),_0x3c8c84+'-'+_0x105863+'/'+_0x514141)[_0xbf0d('0x7')](_0x421fce);}return null;};}function saveUpdates(_0x3cc8e5){return function(_0x5610cc){if(_0x5610cc){return _0x5610cc['update'](_0x3cc8e5)[_0xbf0d('0xf')](function(_0x5de44c){return _0x5de44c;});}return null;};}function removeEntity(_0x4d3876){return function(_0x391997){if(_0x391997){return _0x391997[_0xbf0d('0x10')]()['then'](function(){_0x4d3876[_0xbf0d('0xc')](0xcc)[_0xbf0d('0x11')]();});}};}function handleEntityNotFound(_0x26e8ba){return function(_0x5ee273){if(!_0x5ee273){_0x26e8ba[_0xbf0d('0x12')](0x194);}return _0x5ee273;};}function handleError(_0x1f9062,_0x4a9f3a){_0x4a9f3a=_0x4a9f3a||0x1f4;return function(_0x4113c0){logger['error'](_0x4113c0['stack']);if(_0x4113c0[_0xbf0d('0x13')]){delete _0x4113c0['name'];}_0x1f9062[_0xbf0d('0xc')](_0x4a9f3a)[_0xbf0d('0x14')](_0x4113c0);};}exports[_0xbf0d('0x15')]=function(_0x575588,_0x299b9e){var _0x54ecf5={},_0x1e9cd8={},_0x7ea634={'count':0x0,'rows':[]};var _0x1dd61d=_['map'](db[_0xbf0d('0x16')]['rawAttributes'],function(_0x3ebc01){return{'name':_0x3ebc01[_0xbf0d('0x17')],'type':_0x3ebc01[_0xbf0d('0x18')]['key']};});_0x1e9cd8[_0xbf0d('0x19')]=_['map'](_0x1dd61d,'name');_0x1e9cd8[_0xbf0d('0x1a')]=_[_0xbf0d('0x1b')](_0x575588[_0xbf0d('0x1a')]);_0x1e9cd8[_0xbf0d('0x1c')]=_[_0xbf0d('0x1d')](_0x1e9cd8[_0xbf0d('0x19')],_0x1e9cd8[_0xbf0d('0x1a')]);_0x54ecf5[_0xbf0d('0x1e')]=_[_0xbf0d('0x1d')](_0x1e9cd8[_0xbf0d('0x19')],qs[_0xbf0d('0x1f')](_0x575588[_0xbf0d('0x1a')][_0xbf0d('0x1f')]));_0x54ecf5['attributes']=_0x54ecf5[_0xbf0d('0x1e')][_0xbf0d('0x20')]?_0x54ecf5[_0xbf0d('0x1e')]:_0x1e9cd8[_0xbf0d('0x19')];if(!_0x575588['query'][_0xbf0d('0x21')](_0xbf0d('0x22'))){_0x54ecf5[_0xbf0d('0x9')]=qs[_0xbf0d('0x9')](_0x575588[_0xbf0d('0x1a')][_0xbf0d('0x9')]);_0x54ecf5[_0xbf0d('0x8')]=qs[_0xbf0d('0x8')](_0x575588[_0xbf0d('0x1a')][_0xbf0d('0x8')]);}_0x54ecf5['order']=qs[_0xbf0d('0x23')](_0x575588[_0xbf0d('0x1a')][_0xbf0d('0x23')]);_0x54ecf5['where']=qs['filters'](_[_0xbf0d('0x24')](_0x575588[_0xbf0d('0x1a')],_0x1e9cd8[_0xbf0d('0x1c')]),_0x1dd61d);if(_0x575588[_0xbf0d('0x1a')][_0xbf0d('0x25')]){_0x54ecf5['where']=_[_0xbf0d('0x26')](_0x54ecf5[_0xbf0d('0x27')],{'$or':_[_0xbf0d('0x28')](_0x1dd61d,function(_0x35feda){if(_0x35feda['type']!==_0xbf0d('0x29')){var _0x317afc={};_0x317afc[_0x35feda[_0xbf0d('0x13')]]={'$like':'%'+_0x575588[_0xbf0d('0x1a')]['filter']+'%'};return _0x317afc;}})});}_0x54ecf5=_['merge']({},_0x54ecf5,_0x575588['options']);var _0x5c7ad3={'where':_0x54ecf5[_0xbf0d('0x27')]};return db[_0xbf0d('0x16')][_0xbf0d('0xb')](_0x5c7ad3)['then'](function(_0x385265){_0x7ea634['count']=_0x385265;if(_0x575588[_0xbf0d('0x1a')][_0xbf0d('0x2a')]){_0x54ecf5[_0xbf0d('0x2b')]=[{'all':!![]}];}return db[_0xbf0d('0x16')][_0xbf0d('0x2c')](_0x54ecf5);})[_0xbf0d('0xf')](function(_0x121c61){_0x7ea634['rows']=_0x121c61;return _0x7ea634;})['then'](respondWithFilteredResult(_0x299b9e,_0x54ecf5))[_0xbf0d('0x2d')](handleError(_0x299b9e,null));};exports[_0xbf0d('0x2e')]=function(_0x23303d,_0x32fa03){var _0x5f4156={'raw':![],'where':{'id':_0x23303d['params']['id']}},_0xec7354={};_0xec7354[_0xbf0d('0x19')]=_[_0xbf0d('0x1b')](db[_0xbf0d('0x16')][_0xbf0d('0x2f')]);_0xec7354[_0xbf0d('0x1a')]=_[_0xbf0d('0x1b')](_0x23303d[_0xbf0d('0x1a')]);_0xec7354['filters']=_['intersection'](_0xec7354['model'],_0xec7354[_0xbf0d('0x1a')]);_0x5f4156['attributes']=_[_0xbf0d('0x1d')](_0xec7354[_0xbf0d('0x19')],qs[_0xbf0d('0x1f')](_0x23303d['query'][_0xbf0d('0x1f')]));_0x5f4156[_0xbf0d('0x1e')]=_0x5f4156[_0xbf0d('0x1e')]['length']?_0x5f4156[_0xbf0d('0x1e')]:_0xec7354[_0xbf0d('0x19')];if(_0x23303d[_0xbf0d('0x1a')][_0xbf0d('0x2a')]){_0x5f4156[_0xbf0d('0x2b')]=[{'all':!![]}];}_0x5f4156=_['merge']({},_0x5f4156,_0x23303d[_0xbf0d('0x30')]);return db[_0xbf0d('0x16')][_0xbf0d('0x31')](_0x5f4156)[_0xbf0d('0xf')](handleEntityNotFound(_0x32fa03,null))[_0xbf0d('0xf')](respondWithResult(_0x32fa03,null))['catch'](handleError(_0x32fa03,null));};exports[_0xbf0d('0x32')]=function(_0x4eb503,_0x5cc17c){return db[_0xbf0d('0x16')]['create'](_0x4eb503[_0xbf0d('0x33')],{})[_0xbf0d('0xf')](respondWithResult(_0x5cc17c,0xc9))[_0xbf0d('0x2d')](handleError(_0x5cc17c,null));};exports['update']=function(_0x5ce9de,_0x34c71a){if(_0x5ce9de[_0xbf0d('0x33')]['id']){delete _0x5ce9de[_0xbf0d('0x33')]['id'];}return db[_0xbf0d('0x16')][_0xbf0d('0x31')]({'where':{'id':_0x5ce9de[_0xbf0d('0x34')]['id']}})[_0xbf0d('0xf')](handleEntityNotFound(_0x34c71a,null))[_0xbf0d('0xf')](saveUpdates(_0x5ce9de[_0xbf0d('0x33')],null))[_0xbf0d('0xf')](respondWithResult(_0x34c71a,null))[_0xbf0d('0x2d')](handleError(_0x34c71a,null));};exports['destroy']=function(_0x3b94f9,_0x22e07d){return db[_0xbf0d('0x16')][_0xbf0d('0x31')]({'where':{'id':_0x3b94f9['params']['id']}})[_0xbf0d('0xf')](handleEntityNotFound(_0x22e07d,null))[_0xbf0d('0xf')](removeEntity(_0x22e07d,null))[_0xbf0d('0x2d')](handleError(_0x22e07d,null));};exports[_0xbf0d('0x35')]=function(_0x5eb91e,_0x51821a){var _0x184ed4={};var _0x8b2380={};var _0x3f93b8;var _0xa8cfe3;return db[_0xbf0d('0x16')][_0xbf0d('0x36')]({'where':{'id':_0x5eb91e['params']['id']}})[_0xbf0d('0xf')](handleEntityNotFound(_0x51821a,null))['then'](function(_0x39206f){if(_0x39206f){_0x3f93b8=_0x39206f;_0x8b2380[_0xbf0d('0x19')]=_['keys'](db['Dynamics365Configuration'][_0xbf0d('0x2f')]);_0x8b2380['query']=_[_0xbf0d('0x1b')](_0x5eb91e[_0xbf0d('0x1a')]);_0x8b2380[_0xbf0d('0x1c')]=_[_0xbf0d('0x1d')](_0x8b2380['model'],_0x8b2380['query']);_0x184ed4['attributes']=_[_0xbf0d('0x1d')](_0x8b2380['model'],qs[_0xbf0d('0x1f')](_0x5eb91e[_0xbf0d('0x1a')][_0xbf0d('0x1f')]));_0x184ed4[_0xbf0d('0x1e')]=_0x184ed4[_0xbf0d('0x1e')]['length']?_0x184ed4['attributes']:_0x8b2380['model'];_0x184ed4[_0xbf0d('0x37')]=qs[_0xbf0d('0x23')](_0x5eb91e[_0xbf0d('0x1a')]['sort']);_0x184ed4[_0xbf0d('0x27')]=qs['filters'](_[_0xbf0d('0x24')](_0x5eb91e[_0xbf0d('0x1a')],_0x8b2380[_0xbf0d('0x1c')]));if(_0x5eb91e[_0xbf0d('0x1a')][_0xbf0d('0x25')]){_0x184ed4[_0xbf0d('0x27')]=_[_0xbf0d('0x26')](_0x184ed4[_0xbf0d('0x27')],{'$or':_[_0xbf0d('0x28')](_0x184ed4['attributes'],function(_0x4aca26){var _0x18f21a={};_0x18f21a[_0x4aca26]={'$like':'%'+_0x5eb91e[_0xbf0d('0x1a')][_0xbf0d('0x25')]+'%'};return _0x18f21a;})});}_0x184ed4=_['merge']({},_0x184ed4,_0x5eb91e[_0xbf0d('0x30')]);return _0x3f93b8['getConfigurations'](_0x184ed4);}})[_0xbf0d('0xf')](function(_0x55f6f9){if(_0x55f6f9){_0xa8cfe3=_0x55f6f9[_0xbf0d('0x20')];if(!_0x5eb91e[_0xbf0d('0x1a')][_0xbf0d('0x21')](_0xbf0d('0x22'))){_0x184ed4[_0xbf0d('0x9')]=qs['limit'](_0x5eb91e[_0xbf0d('0x1a')][_0xbf0d('0x9')]);_0x184ed4[_0xbf0d('0x8')]=qs[_0xbf0d('0x8')](_0x5eb91e[_0xbf0d('0x1a')][_0xbf0d('0x8')]);}return _0x3f93b8[_0xbf0d('0x35')](_0x184ed4);}})['then'](function(_0x2876e5){if(_0x2876e5){return _0x2876e5?{'count':_0xa8cfe3,'rows':_0x2876e5}:null;}})['then'](respondWithResult(_0x51821a,null))['catch'](handleError(_0x51821a,null));};exports[_0xbf0d('0x38')]=function(_0x476f14,_0x4e9b45){if(_0x476f14[_0xbf0d('0x33')]['id']){delete _0x476f14['body']['id'];}return db[_0xbf0d('0x16')][_0xbf0d('0x36')]({'where':{'id':_0x476f14[_0xbf0d('0x34')]['id']}})[_0xbf0d('0xf')](handleEntityNotFound(_0x4e9b45,null))[_0xbf0d('0xf')](function(_0x6d89df){if(_0x6d89df){_0x476f14[_0xbf0d('0x33')][_0xbf0d('0x39')]=_0x6d89df['id'];_0x476f14['body'][_0xbf0d('0x3a')]=integrations[_0xbf0d('0x3b')](_0x476f14[_0xbf0d('0x33')][_0xbf0d('0x3c')],_0x476f14[_0xbf0d('0x33')][_0xbf0d('0x18')]);_0x476f14[_0xbf0d('0x33')]['Descriptions']=integrations[_0xbf0d('0x3d')](_0x476f14[_0xbf0d('0x33')][_0xbf0d('0x3c')],_0x476f14['body'][_0xbf0d('0x18')]);return db[_0xbf0d('0x3e')][_0xbf0d('0x32')](_0x476f14[_0xbf0d('0x33')],{'include':[{'model':db['Dynamics365Field'],'as':_0xbf0d('0x3a')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xbf0d('0xf')](respondWithResult(_0x4e9b45,null))['catch'](handleError(_0x4e9b45,null));};function sanitizeRemoteUri(_0xd6230e){var _0x3d51b0=_0xd6230e['slice'](-0x1);if(_0x3d51b0==='/')return _0xd6230e[_0xbf0d('0x3f')](0x0,_0xd6230e[_0xbf0d('0x40')](_0x3d51b0));return _0xd6230e;}function getWebApiUrl(_0x2df1e2){return util[_0xbf0d('0x41')](_0xbf0d('0x42'),_0x2df1e2);}exports[_0xbf0d('0x43')]=function(_0x403bc7,_0x39298f){var _0x4ed289=_0x403bc7[_0xbf0d('0x1a')]['ticketType'];var _0x31e8b3=_0x4ed289===_0xbf0d('0x44')?_0xbf0d('0x45'):'PhoneCall';var _0x547cdb='';var _0x294ee2='';var _0x99f02d='';var _0x2d4e0f='';var _0x4732bf='';var _0x2837ef='';var _0x38d7ac='';var _0x31fab8='';var _0x21740c=[_0xbf0d('0x46'),_0xbf0d('0x47'),_0xbf0d('0x48'),_0xbf0d('0x49'),'caseorigincode',_0xbf0d('0x4a'),_0xbf0d('0x4b'),_0xbf0d('0x4c'),_0xbf0d('0x4d'),_0xbf0d('0x4e')];var _0x29ba20=[_0xbf0d('0x4f'),_0xbf0d('0x50'),'actualserviceunits','billedserviceunits','contactidname',_0xbf0d('0x51'),_0xbf0d('0x52'),_0xbf0d('0x53'),_0xbf0d('0x54'),_0xbf0d('0x55'),_0xbf0d('0x56'),_0xbf0d('0x57'),_0xbf0d('0x58'),_0xbf0d('0x59'),_0xbf0d('0x5a'),_0xbf0d('0x5b'),'customeridtype',_0xbf0d('0x5c'),_0xbf0d('0x5d'),_0xbf0d('0x5e'),_0xbf0d('0x5f'),_0xbf0d('0x60'),'escalatedon',_0xbf0d('0x61'),'firstresponsebykpiidname','followupby',_0xbf0d('0x62'),_0xbf0d('0x63'),_0xbf0d('0x64'),'lastonholdtime',_0xbf0d('0x65'),_0xbf0d('0x66'),_0xbf0d('0x67'),_0xbf0d('0x68'),_0xbf0d('0x69'),_0xbf0d('0x6a'),'modifiedonbehalfbyname',_0xbf0d('0x6b'),_0xbf0d('0x6c'),_0xbf0d('0x6d'),_0xbf0d('0x6e'),_0xbf0d('0x6f'),_0xbf0d('0x70'),'owneridname','owneridtype',_0xbf0d('0x71'),_0xbf0d('0x72'),_0xbf0d('0x73'),_0xbf0d('0x74'),_0xbf0d('0x75'),_0xbf0d('0x76'),_0xbf0d('0x77'),_0xbf0d('0x78'),'resolvebykpiidname',_0xbf0d('0x79'),_0xbf0d('0x7a'),_0xbf0d('0x7b'),'sentimentvalue',_0xbf0d('0x7c'),_0xbf0d('0x7d'),_0xbf0d('0x7e'),_0xbf0d('0x7f'),'statuscode',_0xbf0d('0x80'),_0xbf0d('0x81'),_0xbf0d('0x82'),_0xbf0d('0x83'),_0xbf0d('0x84'),_0xbf0d('0x85'),_0xbf0d('0x86')];var _0x17bc2c=_0x21740c['concat'](_0x29ba20);return db[_0xbf0d('0x16')]['findOne']({'where':{'id':_0x403bc7[_0xbf0d('0x34')]['id']},'attributes':['id',_0xbf0d('0x87'),_0xbf0d('0x88'),'remoteUri',_0xbf0d('0x89'),'clientId','clientSecret',_0xbf0d('0x8a')],'include':[{'model':db[_0xbf0d('0x8b')],'as':'CloudProvider','attributes':['id',_0xbf0d('0x8c'),_0xbf0d('0x8d')]}]})['then'](handleEntityNotFound(_0x39298f,null))[_0xbf0d('0xf')](function(_0x2186eb){if(_0x2186eb){if(_0x2186eb[_0xbf0d('0x8a')]){_0x2186eb[_0xbf0d('0x8e')]=_0x2186eb[_0xbf0d('0x8b')][_0xbf0d('0x8c')];_0x31fab8=sanitizeRemoteUri(_0x2186eb[_0xbf0d('0x8b')][_0xbf0d('0x8d')]);_0x38d7ac=getWebApiUrl(_0x31fab8);return _0x2186eb;}_0x31fab8=sanitizeRemoteUri(_0x2186eb[_0xbf0d('0x8f')]);_0x38d7ac=getWebApiUrl(_0x31fab8);var _0x1c607b={'method':_0xbf0d('0x90'),'uri':_0xbf0d('0x91')+_0x2186eb[_0xbf0d('0x89')]+_0xbf0d('0x92'),'form':{'client_id':_0x2186eb[_0xbf0d('0x93')],'resource':_0x31fab8,'username':_0x2186eb['username'],'password':_0x2186eb[_0xbf0d('0x88')],'grant_type':_0xbf0d('0x88'),'client_secret':_0x2186eb[_0xbf0d('0x94')]},'json':!![]};return rp(_0x1c607b);}})[_0xbf0d('0xf')](function(_0x4dd8b4){_0x2837ef=_0x4dd8b4['access_token'];var _0x198903={'method':_0xbf0d('0x95'),'uri':encodeURI(_0x38d7ac+_0xbf0d('0x96')+_0x31e8b3+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2837ef,'If-None-Match':null,'OData-Version':_0xbf0d('0x97')},'json':!![]};return rp(_0x198903);})[_0xbf0d('0xf')](function(_0x36fa8b){var _0x1c1750=_0x36fa8b[_0xbf0d('0x98')][0x0];var _0x163013=_0x1c1750['MetadataId'];var _0x2caf26={'method':'GET','uri':_0x38d7ac+'EntityDefinitions('+_0x163013+_0xbf0d('0x99'),'headers':{'Authorization':_0xbf0d('0x9a')+_0x2837ef,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2caf26);})[_0xbf0d('0xf')](function(_0x1419ee){_0x547cdb=_0x1419ee;_0x294ee2=_0x547cdb['Attributes'];_0x294ee2=_[_0xbf0d('0x9b')](_0x294ee2,function(_0x168d41){return!_0x17bc2c[_0xbf0d('0x9c')](_0x168d41[_0xbf0d('0x9d')]);});var _0x3fd359=[];var _0x41482c=[];_0x294ee2[_0xbf0d('0x9e')](function(_0x5983ea){if(_0x5983ea['@odata.type']){var _0x5e9f43=_0x5983ea[_0xbf0d('0x9f')][_0xbf0d('0x3f')](_0x5983ea[_0xbf0d('0x9f')]['lastIndexOf']('.')+0x1);if(_0x5e9f43===_0xbf0d('0xa0')){_0x3fd359['push'](getSelectList(_0x38d7ac,_0x4ed289,_0x41482c,_0x547cdb[_0xbf0d('0xa1')],_0x5983ea['MetadataId'],_0x2837ef));}}});return Promise['all'](_0x3fd359);})[_0xbf0d('0xf')](function(_0x499916){_0x99f02d=_0x499916[0x0];var _0x1b3eb1=[];var _0x285c9c=[];_0x294ee2[_0xbf0d('0x9e')](function(_0xe30c6b){if(!_[_0xbf0d('0xa2')](_0xe30c6b['@odata.type'])){var _0x40fa82=_0xe30c6b[_0xbf0d('0x9f')][_0xbf0d('0x3f')](_0xe30c6b[_0xbf0d('0x9f')]['lastIndexOf']('.')+0x1);if(_0x40fa82===_0xbf0d('0xa3')){_0x1b3eb1[_0xbf0d('0xa4')](getBooleanList(_0x38d7ac,_0x4ed289,_0x285c9c,_0x547cdb[_0xbf0d('0xa1')],_0xe30c6b['MetadataId'],_0x2837ef));}}});return Promise[_0xbf0d('0xa5')](_0x1b3eb1);})['then'](function(_0xc6aec){_0x2d4e0f=_0xc6aec[0x0];var _0x33fd24=[];var _0x2695ae=[];_0x294ee2[_0xbf0d('0x9e')](function(_0x38a8f4){if(_0x38a8f4[_0xbf0d('0x9f')]){var _0x4cd5f1=_0x38a8f4['@odata.type'][_0xbf0d('0x3f')](_0x38a8f4['@odata.type']['lastIndexOf']('.')+0x1);if(_0x4cd5f1===_0xbf0d('0xa6')||_0x4cd5f1===_0xbf0d('0xa7')||_0x4cd5f1==='BigIntAttributeMetadata'||_0x4cd5f1===_0xbf0d('0xa8')||_0x4cd5f1==='MemoAttributeMetadata'||_0x4cd5f1===_0xbf0d('0xa9')||_0x4cd5f1===_0xbf0d('0xaa')||_0x4cd5f1===_0xbf0d('0xab')||_0x4cd5f1===_0xbf0d('0xac')||_0x4cd5f1===_0xbf0d('0xad')){_0x33fd24['push'](getInputList(_0x38d7ac,_0x4ed289,_0x4cd5f1,_0x2695ae,_0x547cdb['MetadataId'],_0x38a8f4[_0xbf0d('0xa1')],_0x2837ef));}}});return Promise['all'](_0x33fd24);})[_0xbf0d('0xf')](function(_0x4b7bae){_0x4732bf=_0x4b7bae[0x0];var _0x192a14=_0x99f02d[_0xbf0d('0xae')](_0x2d4e0f)['concat'](_0x4732bf);var _0x350c17={'count':_0x192a14['length'],'rows':_0x192a14};return _0x350c17;})[_0xbf0d('0xf')](respondWithResult(_0x39298f,null))[_0xbf0d('0x2d')](function(_0x3aa1bc){var _0x2163fa=_0x403bc7['query'][_0xbf0d('0xaf')]?0x1f4:_0x3aa1bc[_0xbf0d('0xb0')]||0x1f4;logger[_0xbf0d('0xb1')](_0x3aa1bc[_0xbf0d('0xb2')]);delete _0x3aa1bc[_0xbf0d('0x13')];if(_0x2163fa===0x191){_0x2163fa=0x190;}_0x39298f['status'](_0x2163fa)[_0xbf0d('0x14')](_0x403bc7[_0xbf0d('0x1a')][_0xbf0d('0xaf')]?{'message':_0xbf0d('0xb3'),'statusCode':_0x3aa1bc[_0xbf0d('0xb0')]}:_0x3aa1bc);});};function getSelectList(_0x480db3,_0x54a11d,_0x44bc1f,_0x1cc0f1,_0x38ff0f,_0x13a425){var _0x41e082={'method':_0xbf0d('0x95'),'uri':_0x480db3+_0xbf0d('0xb4')+_0x1cc0f1+_0xbf0d('0xb5')+_0x38ff0f+_0xbf0d('0xb6')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xbf0d('0x9a')+_0x13a425,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x41e082)[_0xbf0d('0xf')](function(_0x4db3df){var _0x4aff94=[];var _0x4ca80e=_0x4db3df[_0xbf0d('0xb7')][_0xbf0d('0xb8')];_0x4ca80e[_0xbf0d('0x9e')](function(_0x3b4c35){_0x4aff94['push']({'name':_0x3b4c35[_0xbf0d('0xb9')][_0xbf0d('0xba')]['Label'],'value':String(_0x3b4c35[_0xbf0d('0xbb')])});});var _0x138160={'id':_0x54a11d+'_'+_0x4db3df[_0xbf0d('0x9d')],'name':_0x4db3df['DisplayName'][_0xbf0d('0xba')][_0xbf0d('0xb9')],'custom':![],'options':_0x4aff94};_0x44bc1f[_0xbf0d('0xa4')](_0x138160);return _0x44bc1f;});}function getBooleanList(_0x7015e1,_0x52b946,_0x369d31,_0x38ce48,_0x5885b8,_0xd88d99){var _0x42211b={'method':'GET','uri':_0x7015e1+'EntityDefinitions('+_0x38ce48+')/Attributes('+_0x5885b8+_0xbf0d('0xbc'),'headers':{'Authorization':'Bearer\x20'+_0xd88d99,'If-None-Match':null,'OData-Version':_0xbf0d('0x97')},'json':!![]};return rp(_0x42211b)[_0xbf0d('0xf')](function(_0x487ce5){var _0x1a9eca=[];_0x1a9eca[_0xbf0d('0xa4')]({'name':_0x487ce5['OptionSet']['TrueOption']['Label']['UserLocalizedLabel'][_0xbf0d('0xb9')],'value':'true'},{'name':_0x487ce5[_0xbf0d('0xb7')][_0xbf0d('0xbd')][_0xbf0d('0xb9')]['UserLocalizedLabel']['Label'],'value':_0xbf0d('0xbe')});var _0xf98e23={'id':_0x52b946+'_'+_0x487ce5['LogicalName'],'name':_0x487ce5[_0xbf0d('0xbf')][_0xbf0d('0xba')]['Label'],'custom':![],'options':_0x1a9eca};_0x369d31[_0xbf0d('0xa4')](_0xf98e23);return _0x369d31;});}function getInputList(_0x5162a0,_0x2fa665,_0x4f598f,_0x2c44b0,_0xfa8695,_0x2b9a23,_0x2ce9ed){var _0x30c5fb={'method':_0xbf0d('0x95'),'uri':_0x5162a0+'EntityDefinitions('+_0xfa8695+_0xbf0d('0xb5')+_0x2b9a23+_0xbf0d('0xc0')+_0x4f598f+_0xbf0d('0xc1'),'headers':{'Authorization':_0xbf0d('0x9a')+_0x2ce9ed,'If-None-Match':null,'OData-Version':_0xbf0d('0x97')},'json':!![]};return rp(_0x30c5fb)[_0xbf0d('0xf')](function(_0x466c88){var _0x496558={'id':_0x2fa665+'_'+_0x466c88[_0xbf0d('0x9d')],'name':_0x466c88[_0xbf0d('0xbf')][_0xbf0d('0xba')]?_0x466c88[_0xbf0d('0xbf')][_0xbf0d('0xba')]['Label']:_0x466c88[_0xbf0d('0x9d')],'custom':![],'options':[]};_0x2c44b0[_0xbf0d('0xa4')](_0x496558);return _0x2c44b0;});} \ No newline at end of file +var _0x7a77=['slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','/oauth2/token','clientId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(','Attributes','remove','includes','LogicalName','@odata.type','push','all','forEach','isNil','BooleanAttributeMetadata','substring','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','Content-Range','update','destroy','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','then','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','Subjects','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue'];(function(_0x3ea935,_0x13a566){var _0x55c782=function(_0x107d0e){while(--_0x107d0e){_0x3ea935['push'](_0x3ea935['shift']());}};_0x55c782(++_0x13a566);}(_0x7a77,0x1c3));var _0x77a7=function(_0xe87b40,_0x2120f3){_0xe87b40=_0xe87b40-0x0;var _0x4970f8=_0x7a77[_0xe87b40];return _0x4970f8;};'use strict';var rp=require(_0x77a7('0x0'));var util=require(_0x77a7('0x1'));var _=require(_0x77a7('0x2'));var qs=require(_0x77a7('0x3'));var logger=require('../../config/logger')(_0x77a7('0x4'));var db=require(_0x77a7('0x5'))['db'];var integrations=require(_0x77a7('0x6'));function respondWithResult(_0x4bd9a7,_0x247b91){_0x247b91=_0x247b91||0xc8;return function(_0x45a5c0){if(_0x45a5c0){return _0x4bd9a7[_0x77a7('0x7')](_0x247b91)[_0x77a7('0x8')](_0x45a5c0);}};}function respondWithFilteredResult(_0x425669,_0x359bac){return function(_0x1d349c){if(_0x1d349c){var _0x2df3d8=typeof _0x359bac[_0x77a7('0x9')]===_0x77a7('0xa')&&typeof _0x359bac['limit']===_0x77a7('0xa');var _0x42d87d=_0x1d349c[_0x77a7('0xb')];var _0x4d8b3d=_0x2df3d8?0x0:_0x359bac[_0x77a7('0x9')];var _0x5bf561=_0x2df3d8?_0x1d349c[_0x77a7('0xb')]:_0x359bac[_0x77a7('0x9')]+_0x359bac['limit'];var _0x262580;if(_0x5bf561>=_0x42d87d){_0x5bf561=_0x42d87d;_0x262580=0xc8;}else{_0x262580=0xce;}_0x425669['status'](_0x262580);return _0x425669['set'](_0x77a7('0xc'),_0x4d8b3d+'-'+_0x5bf561+'/'+_0x42d87d)[_0x77a7('0x8')](_0x1d349c);}return null;};}function saveUpdates(_0x601eef){return function(_0x6f5703){if(_0x6f5703){return _0x6f5703[_0x77a7('0xd')](_0x601eef)['then'](function(_0x1e556e){return _0x1e556e;});}return null;};}function removeEntity(_0x468345){return function(_0x431fbf){if(_0x431fbf){return _0x431fbf[_0x77a7('0xe')]()['then'](function(){_0x468345[_0x77a7('0x7')](0xcc)[_0x77a7('0xf')]();});}};}function handleEntityNotFound(_0x3a7ad4){return function(_0x1bd2bd){if(!_0x1bd2bd){_0x3a7ad4['sendStatus'](0x194);}return _0x1bd2bd;};}function handleError(_0x691982,_0x5e470c){_0x5e470c=_0x5e470c||0x1f4;return function(_0x41b7c9){logger[_0x77a7('0x10')](_0x41b7c9[_0x77a7('0x11')]);if(_0x41b7c9[_0x77a7('0x12')]){delete _0x41b7c9['name'];}_0x691982[_0x77a7('0x7')](_0x5e470c)[_0x77a7('0x13')](_0x41b7c9);};}exports[_0x77a7('0x14')]=function(_0x262a39,_0x5a3d66){var _0x149dda={},_0x407f13={},_0x552f1f={'count':0x0,'rows':[]};var _0x4c8f22=_[_0x77a7('0x15')](db[_0x77a7('0x16')][_0x77a7('0x17')],function(_0x349c3a){return{'name':_0x349c3a[_0x77a7('0x18')],'type':_0x349c3a[_0x77a7('0x19')][_0x77a7('0x1a')]};});_0x407f13['model']=_[_0x77a7('0x15')](_0x4c8f22,_0x77a7('0x12'));_0x407f13[_0x77a7('0x1b')]=_[_0x77a7('0x1c')](_0x262a39[_0x77a7('0x1b')]);_0x407f13[_0x77a7('0x1d')]=_[_0x77a7('0x1e')](_0x407f13['model'],_0x407f13['query']);_0x149dda[_0x77a7('0x1f')]=_[_0x77a7('0x1e')](_0x407f13['model'],qs[_0x77a7('0x20')](_0x262a39[_0x77a7('0x1b')][_0x77a7('0x20')]));_0x149dda[_0x77a7('0x1f')]=_0x149dda['attributes'][_0x77a7('0x21')]?_0x149dda['attributes']:_0x407f13[_0x77a7('0x22')];if(!_0x262a39[_0x77a7('0x1b')][_0x77a7('0x23')](_0x77a7('0x24'))){_0x149dda['limit']=qs['limit'](_0x262a39['query'][_0x77a7('0x25')]);_0x149dda[_0x77a7('0x9')]=qs[_0x77a7('0x9')](_0x262a39[_0x77a7('0x1b')][_0x77a7('0x9')]);}_0x149dda[_0x77a7('0x26')]=qs[_0x77a7('0x27')](_0x262a39[_0x77a7('0x1b')][_0x77a7('0x27')]);_0x149dda[_0x77a7('0x28')]=qs[_0x77a7('0x1d')](_[_0x77a7('0x29')](_0x262a39[_0x77a7('0x1b')],_0x407f13[_0x77a7('0x1d')]),_0x4c8f22);if(_0x262a39[_0x77a7('0x1b')][_0x77a7('0x2a')]){_0x149dda[_0x77a7('0x28')]=_[_0x77a7('0x2b')](_0x149dda[_0x77a7('0x28')],{'$or':_[_0x77a7('0x15')](_0x4c8f22,function(_0x541563){if(_0x541563[_0x77a7('0x19')]!==_0x77a7('0x2c')){var _0x5a1d35={};_0x5a1d35[_0x541563[_0x77a7('0x12')]]={'$like':'%'+_0x262a39['query'][_0x77a7('0x2a')]+'%'};return _0x5a1d35;}})});}_0x149dda=_[_0x77a7('0x2b')]({},_0x149dda,_0x262a39['options']);var _0x32d194={'where':_0x149dda['where']};return db['Dynamics365Account']['count'](_0x32d194)[_0x77a7('0x2d')](function(_0xe95232){_0x552f1f[_0x77a7('0xb')]=_0xe95232;if(_0x262a39[_0x77a7('0x1b')]['includeAll']){_0x149dda[_0x77a7('0x2e')]=[{'all':!![]}];}return db[_0x77a7('0x16')][_0x77a7('0x2f')](_0x149dda);})[_0x77a7('0x2d')](function(_0xf9dbf6){_0x552f1f[_0x77a7('0x30')]=_0xf9dbf6;return _0x552f1f;})[_0x77a7('0x2d')](respondWithFilteredResult(_0x5a3d66,_0x149dda))[_0x77a7('0x31')](handleError(_0x5a3d66,null));};exports[_0x77a7('0x32')]=function(_0xeee306,_0x36e287){var _0x43673e={'raw':![],'where':{'id':_0xeee306[_0x77a7('0x33')]['id']}},_0x5e907d={};_0x5e907d['model']=_[_0x77a7('0x1c')](db[_0x77a7('0x16')]['rawAttributes']);_0x5e907d[_0x77a7('0x1b')]=_['keys'](_0xeee306[_0x77a7('0x1b')]);_0x5e907d[_0x77a7('0x1d')]=_['intersection'](_0x5e907d['model'],_0x5e907d[_0x77a7('0x1b')]);_0x43673e[_0x77a7('0x1f')]=_['intersection'](_0x5e907d[_0x77a7('0x22')],qs[_0x77a7('0x20')](_0xeee306['query'][_0x77a7('0x20')]));_0x43673e[_0x77a7('0x1f')]=_0x43673e[_0x77a7('0x1f')][_0x77a7('0x21')]?_0x43673e['attributes']:_0x5e907d['model'];if(_0xeee306['query'][_0x77a7('0x34')]){_0x43673e[_0x77a7('0x2e')]=[{'all':!![]}];}_0x43673e=_[_0x77a7('0x2b')]({},_0x43673e,_0xeee306[_0x77a7('0x35')]);return db[_0x77a7('0x16')][_0x77a7('0x36')](_0x43673e)[_0x77a7('0x2d')](handleEntityNotFound(_0x36e287,null))[_0x77a7('0x2d')](respondWithResult(_0x36e287,null))[_0x77a7('0x31')](handleError(_0x36e287,null));};exports[_0x77a7('0x37')]=function(_0x5b722f,_0x566712){return db['Dynamics365Account'][_0x77a7('0x37')](_0x5b722f['body'],{})[_0x77a7('0x2d')](respondWithResult(_0x566712,0xc9))[_0x77a7('0x31')](handleError(_0x566712,null));};exports[_0x77a7('0xd')]=function(_0x7c903,_0x29ce5c){if(_0x7c903[_0x77a7('0x38')]['id']){delete _0x7c903[_0x77a7('0x38')]['id'];}return db[_0x77a7('0x16')]['find']({'where':{'id':_0x7c903[_0x77a7('0x33')]['id']}})[_0x77a7('0x2d')](handleEntityNotFound(_0x29ce5c,null))[_0x77a7('0x2d')](saveUpdates(_0x7c903[_0x77a7('0x38')],null))[_0x77a7('0x2d')](respondWithResult(_0x29ce5c,null))['catch'](handleError(_0x29ce5c,null));};exports['destroy']=function(_0x56e33c,_0xb963ca){return db[_0x77a7('0x16')][_0x77a7('0x36')]({'where':{'id':_0x56e33c['params']['id']}})[_0x77a7('0x2d')](handleEntityNotFound(_0xb963ca,null))['then'](removeEntity(_0xb963ca,null))['catch'](handleError(_0xb963ca,null));};exports[_0x77a7('0x39')]=function(_0x322433,_0x5d0405){var _0x572036={};var _0x729a96={};var _0x40cd19;var _0xbb147f;return db[_0x77a7('0x16')][_0x77a7('0x3a')]({'where':{'id':_0x322433[_0x77a7('0x33')]['id']}})[_0x77a7('0x2d')](handleEntityNotFound(_0x5d0405,null))['then'](function(_0x4a8e92){if(_0x4a8e92){_0x40cd19=_0x4a8e92;_0x729a96[_0x77a7('0x22')]=_[_0x77a7('0x1c')](db[_0x77a7('0x3b')][_0x77a7('0x17')]);_0x729a96[_0x77a7('0x1b')]=_[_0x77a7('0x1c')](_0x322433[_0x77a7('0x1b')]);_0x729a96['filters']=_[_0x77a7('0x1e')](_0x729a96[_0x77a7('0x22')],_0x729a96[_0x77a7('0x1b')]);_0x572036[_0x77a7('0x1f')]=_[_0x77a7('0x1e')](_0x729a96[_0x77a7('0x22')],qs['fields'](_0x322433[_0x77a7('0x1b')][_0x77a7('0x20')]));_0x572036[_0x77a7('0x1f')]=_0x572036[_0x77a7('0x1f')]['length']?_0x572036['attributes']:_0x729a96[_0x77a7('0x22')];_0x572036[_0x77a7('0x26')]=qs[_0x77a7('0x27')](_0x322433[_0x77a7('0x1b')]['sort']);_0x572036['where']=qs[_0x77a7('0x1d')](_[_0x77a7('0x29')](_0x322433[_0x77a7('0x1b')],_0x729a96['filters']));if(_0x322433[_0x77a7('0x1b')]['filter']){_0x572036[_0x77a7('0x28')]=_[_0x77a7('0x2b')](_0x572036['where'],{'$or':_['map'](_0x572036['attributes'],function(_0x3a559e){var _0x2091d7={};_0x2091d7[_0x3a559e]={'$like':'%'+_0x322433[_0x77a7('0x1b')][_0x77a7('0x2a')]+'%'};return _0x2091d7;})});}_0x572036=_[_0x77a7('0x2b')]({},_0x572036,_0x322433[_0x77a7('0x35')]);return _0x40cd19['getConfigurations'](_0x572036);}})[_0x77a7('0x2d')](function(_0x3d381a){if(_0x3d381a){_0xbb147f=_0x3d381a[_0x77a7('0x21')];if(!_0x322433[_0x77a7('0x1b')]['hasOwnProperty'](_0x77a7('0x24'))){_0x572036['limit']=qs['limit'](_0x322433[_0x77a7('0x1b')]['limit']);_0x572036['offset']=qs[_0x77a7('0x9')](_0x322433['query'][_0x77a7('0x9')]);}return _0x40cd19[_0x77a7('0x39')](_0x572036);}})[_0x77a7('0x2d')](function(_0x295e4a){if(_0x295e4a){return _0x295e4a?{'count':_0xbb147f,'rows':_0x295e4a}:null;}})[_0x77a7('0x2d')](respondWithResult(_0x5d0405,null))[_0x77a7('0x31')](handleError(_0x5d0405,null));};exports[_0x77a7('0x3c')]=function(_0x5c3d35,_0x2a0cd5){if(_0x5c3d35['body']['id']){delete _0x5c3d35[_0x77a7('0x38')]['id'];}return db[_0x77a7('0x16')][_0x77a7('0x3a')]({'where':{'id':_0x5c3d35[_0x77a7('0x33')]['id']}})[_0x77a7('0x2d')](handleEntityNotFound(_0x2a0cd5,null))[_0x77a7('0x2d')](function(_0x4f4430){if(_0x4f4430){_0x5c3d35[_0x77a7('0x38')][_0x77a7('0x3d')]=_0x4f4430['id'];_0x5c3d35[_0x77a7('0x38')]['Subjects']=integrations[_0x77a7('0x3e')](_0x5c3d35[_0x77a7('0x38')]['channel'],_0x5c3d35['body']['type']);_0x5c3d35[_0x77a7('0x38')][_0x77a7('0x3f')]=integrations[_0x77a7('0x40')](_0x5c3d35['body'][_0x77a7('0x41')],_0x5c3d35['body'][_0x77a7('0x19')]);return db[_0x77a7('0x3b')][_0x77a7('0x37')](_0x5c3d35[_0x77a7('0x38')],{'include':[{'model':db[_0x77a7('0x42')],'as':_0x77a7('0x43')},{'model':db['Dynamics365Field'],'as':_0x77a7('0x3f')}]});}return null;})['then'](respondWithResult(_0x2a0cd5,null))[_0x77a7('0x31')](handleError(_0x2a0cd5,null));};function sanitizeRemoteUri(_0x975888){var _0x2b0fca=_0x975888[_0x77a7('0x44')](-0x1);if(_0x2b0fca==='/')return _0x975888['substring'](0x0,_0x975888[_0x77a7('0x45')](_0x2b0fca));return _0x975888;}function getWebApiUrl(_0x2672d9){return util[_0x77a7('0x46')](_0x77a7('0x47'),_0x2672d9);}exports[_0x77a7('0x48')]=function(_0x1e4719,_0x2c28ef){var _0x243077=_0x1e4719[_0x77a7('0x1b')][_0x77a7('0x49')];var _0x1d5931=_0x243077===_0x77a7('0x4a')?_0x77a7('0x4b'):_0x77a7('0x4c');var _0x24dbf0='';var _0x420754='';var _0x3e12dd='';var _0x1d0c90='';var _0x34930a='';var _0x1a9990='';var _0xf63405='';var _0x3ae87f='';var _0x15ca83=['title',_0x77a7('0x4d'),_0x77a7('0x4e'),_0x77a7('0x4f'),_0x77a7('0x50'),'subject',_0x77a7('0x51'),_0x77a7('0x52'),_0x77a7('0x53'),_0x77a7('0x54')];var _0x3445df=[_0x77a7('0x55'),_0x77a7('0x56'),'actualserviceunits','billedserviceunits',_0x77a7('0x57'),'contactidyominame',_0x77a7('0x58'),_0x77a7('0x59'),'createdbyexternalpartyname',_0x77a7('0x5a'),_0x77a7('0x5b'),_0x77a7('0x5c'),_0x77a7('0x5d'),_0x77a7('0x5e'),'createdonbehalfbyyominame',_0x77a7('0x5f'),_0x77a7('0x60'),_0x77a7('0x61'),_0x77a7('0x62'),_0x77a7('0x63'),_0x77a7('0x64'),_0x77a7('0x65'),_0x77a7('0x66'),'exchangerate',_0x77a7('0x67'),_0x77a7('0x68'),'importsequencenumber',_0x77a7('0x69'),_0x77a7('0x6a'),_0x77a7('0x6b'),'masteridname',_0x77a7('0x6c'),'modifiedbyexternalpartyyominame',_0x77a7('0x6d'),'modifiedbyyominame',_0x77a7('0x6e'),_0x77a7('0x6f'),_0x77a7('0x70'),_0x77a7('0x71'),'msdyn_iotalertname',_0x77a7('0x72'),_0x77a7('0x73'),_0x77a7('0x74'),_0x77a7('0x75'),_0x77a7('0x76'),_0x77a7('0x77'),_0x77a7('0x78'),_0x77a7('0x79'),_0x77a7('0x7a'),_0x77a7('0x7b'),_0x77a7('0x7c'),'productserialnumber',_0x77a7('0x7d'),_0x77a7('0x7e'),_0x77a7('0x7f'),_0x77a7('0x80'),_0x77a7('0x81'),_0x77a7('0x82'),'slainvokedidname',_0x77a7('0x83'),'socialprofileidname',_0x77a7('0x84'),_0x77a7('0x85'),_0x77a7('0x86'),_0x77a7('0x87'),_0x77a7('0x88'),_0x77a7('0x89'),'traversedpath',_0x77a7('0x8a'),_0x77a7('0x8b')];var _0x1a6f42=_0x15ca83[_0x77a7('0x8c')](_0x3445df);return db[_0x77a7('0x16')][_0x77a7('0x3a')]({'where':{'id':_0x1e4719[_0x77a7('0x33')]['id']},'attributes':['id',_0x77a7('0x8d'),_0x77a7('0x8e'),_0x77a7('0x8f'),_0x77a7('0x90'),'clientId',_0x77a7('0x91'),_0x77a7('0x92')],'include':[{'model':db[_0x77a7('0x93')],'as':'CloudProvider','attributes':['id',_0x77a7('0x94'),_0x77a7('0x95')]}]})[_0x77a7('0x2d')](handleEntityNotFound(_0x2c28ef,null))['then'](function(_0x6171ba){if(_0x6171ba){if(_0x6171ba[_0x77a7('0x92')]){_0x6171ba[_0x77a7('0x96')]=_0x6171ba['CloudProvider'][_0x77a7('0x94')];_0x3ae87f=sanitizeRemoteUri(_0x6171ba[_0x77a7('0x93')][_0x77a7('0x95')]);_0xf63405=getWebApiUrl(_0x3ae87f);return _0x6171ba;}_0x3ae87f=sanitizeRemoteUri(_0x6171ba[_0x77a7('0x8f')]);_0xf63405=getWebApiUrl(_0x3ae87f);var _0xb292cf={'method':_0x77a7('0x97'),'uri':'https://login.microsoftonline.com/'+_0x6171ba[_0x77a7('0x90')]+_0x77a7('0x98'),'form':{'client_id':_0x6171ba[_0x77a7('0x99')],'resource':_0x3ae87f,'username':_0x6171ba['username'],'password':_0x6171ba['password'],'grant_type':_0x77a7('0x8e'),'client_secret':_0x6171ba['clientSecret']},'json':!![]};return rp(_0xb292cf);}})[_0x77a7('0x2d')](function(_0x33b64f){_0x1a9990=_0x33b64f[_0x77a7('0x96')];var _0x5d6fa5={'method':'GET','uri':encodeURI(_0xf63405+_0x77a7('0x9a')+_0x1d5931+'\x27'),'headers':{'Authorization':_0x77a7('0x9b')+_0x1a9990,'If-None-Match':null,'OData-Version':_0x77a7('0x9c')},'json':!![]};return rp(_0x5d6fa5);})['then'](function(_0x2bc4b3){var _0x5791a2=_0x2bc4b3[_0x77a7('0x9d')][0x0];var _0x16639e=_0x5791a2[_0x77a7('0x9e')];var _0x2bf195={'method':_0x77a7('0x9f'),'uri':_0xf63405+_0x77a7('0xa0')+_0x16639e+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x1a9990,'If-None-Match':null,'OData-Version':_0x77a7('0x9c')},'json':!![]};return rp(_0x2bf195);})[_0x77a7('0x2d')](function(_0x58066d){_0x24dbf0=_0x58066d;_0x420754=_0x24dbf0[_0x77a7('0xa1')];_0x420754=_[_0x77a7('0xa2')](_0x420754,function(_0x9bd285){return!_0x1a6f42[_0x77a7('0xa3')](_0x9bd285[_0x77a7('0xa4')]);});var _0x12f3e0=[];var _0x1a1cf8=[];_0x420754['forEach'](function(_0x97cd62){if(_0x97cd62['@odata.type']){var _0x2ca59b=_0x97cd62[_0x77a7('0xa5')]['substring'](_0x97cd62[_0x77a7('0xa5')][_0x77a7('0x45')]('.')+0x1);if(_0x2ca59b==='PicklistAttributeMetadata'){_0x12f3e0[_0x77a7('0xa6')](getSelectList(_0xf63405,_0x243077,_0x1a1cf8,_0x24dbf0[_0x77a7('0x9e')],_0x97cd62[_0x77a7('0x9e')],_0x1a9990));}}});return Promise[_0x77a7('0xa7')](_0x12f3e0);})[_0x77a7('0x2d')](function(_0x1ec197){_0x3e12dd=_0x1ec197[0x0];var _0x96756c=[];var _0x1be2a7=[];_0x420754[_0x77a7('0xa8')](function(_0x5cf324){if(!_[_0x77a7('0xa9')](_0x5cf324[_0x77a7('0xa5')])){var _0x2d4bd3=_0x5cf324[_0x77a7('0xa5')]['substring'](_0x5cf324[_0x77a7('0xa5')][_0x77a7('0x45')]('.')+0x1);if(_0x2d4bd3===_0x77a7('0xaa')){_0x96756c['push'](getBooleanList(_0xf63405,_0x243077,_0x1be2a7,_0x24dbf0[_0x77a7('0x9e')],_0x5cf324[_0x77a7('0x9e')],_0x1a9990));}}});return Promise[_0x77a7('0xa7')](_0x96756c);})[_0x77a7('0x2d')](function(_0x17a13a){_0x1d0c90=_0x17a13a[0x0];var _0x29f55f=[];var _0x2ab350=[];_0x420754[_0x77a7('0xa8')](function(_0x5d7761){if(_0x5d7761[_0x77a7('0xa5')]){var _0x120e0c=_0x5d7761[_0x77a7('0xa5')][_0x77a7('0xab')](_0x5d7761['@odata.type'][_0x77a7('0x45')]('.')+0x1);if(_0x120e0c===_0x77a7('0xac')||_0x120e0c==='DoubleAttributeMetadata'||_0x120e0c===_0x77a7('0xad')||_0x120e0c===_0x77a7('0xae')||_0x120e0c===_0x77a7('0xaf')||_0x120e0c===_0x77a7('0xb0')||_0x120e0c==='StatusAttributeMetadata'||_0x120e0c===_0x77a7('0xb1')||_0x120e0c===_0x77a7('0xb2')||_0x120e0c==='DecimalAttributeMetadata'){_0x29f55f[_0x77a7('0xa6')](getInputList(_0xf63405,_0x243077,_0x120e0c,_0x2ab350,_0x24dbf0[_0x77a7('0x9e')],_0x5d7761[_0x77a7('0x9e')],_0x1a9990));}}});return Promise[_0x77a7('0xa7')](_0x29f55f);})[_0x77a7('0x2d')](function(_0x46f3cc){_0x34930a=_0x46f3cc[0x0];var _0x384d0f=_0x3e12dd[_0x77a7('0x8c')](_0x1d0c90)['concat'](_0x34930a);var _0x5a7871={'count':_0x384d0f[_0x77a7('0x21')],'rows':_0x384d0f};return _0x5a7871;})[_0x77a7('0x2d')](respondWithResult(_0x2c28ef,null))[_0x77a7('0x31')](function(_0xb99953){var _0x18a1d7=_0x1e4719[_0x77a7('0x1b')][_0x77a7('0xb3')]?0x1f4:_0xb99953[_0x77a7('0xb4')]||0x1f4;logger[_0x77a7('0x10')](_0xb99953[_0x77a7('0x11')]);delete _0xb99953[_0x77a7('0x12')];if(_0x18a1d7===0x191){_0x18a1d7=0x190;}_0x2c28ef[_0x77a7('0x7')](_0x18a1d7)[_0x77a7('0x13')](_0x1e4719[_0x77a7('0x1b')][_0x77a7('0xb3')]?{'message':'Wrong\x20credentials','statusCode':_0xb99953[_0x77a7('0xb4')]}:_0xb99953);});};function getSelectList(_0x1785d2,_0x4a28a6,_0x2fb2bf,_0xdb9fb4,_0x171e85,_0x360df3){var _0xbaed2e={'method':_0x77a7('0x9f'),'uri':_0x1785d2+'EntityDefinitions('+_0xdb9fb4+_0x77a7('0xb5')+_0x171e85+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x360df3,'If-None-Match':null,'OData-Version':_0x77a7('0x9c')},'json':!![]};return rp(_0xbaed2e)[_0x77a7('0x2d')](function(_0x2e3707){var _0x482051=[];var _0x5529b3=_0x2e3707[_0x77a7('0xb6')][_0x77a7('0xb7')];_0x5529b3[_0x77a7('0xa8')](function(_0x3c3c1c){_0x482051['push']({'name':_0x3c3c1c[_0x77a7('0xb8')][_0x77a7('0xb9')][_0x77a7('0xb8')],'value':String(_0x3c3c1c['Value'])});});var _0x5d40c1={'id':_0x4a28a6+'_'+_0x2e3707[_0x77a7('0xa4')],'name':_0x2e3707['DisplayName'][_0x77a7('0xb9')][_0x77a7('0xb8')],'custom':![],'options':_0x482051};_0x2fb2bf['push'](_0x5d40c1);return _0x2fb2bf;});}function getBooleanList(_0x540796,_0xca97fb,_0x14b93e,_0x3dd843,_0x2b4e18,_0x321055){var _0x5cb234={'method':_0x77a7('0x9f'),'uri':_0x540796+_0x77a7('0xa0')+_0x3dd843+_0x77a7('0xb5')+_0x2b4e18+_0x77a7('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x321055,'If-None-Match':null,'OData-Version':_0x77a7('0x9c')},'json':!![]};return rp(_0x5cb234)[_0x77a7('0x2d')](function(_0x3e6c06){var _0x8111c5=[];_0x8111c5[_0x77a7('0xa6')]({'name':_0x3e6c06[_0x77a7('0xb6')][_0x77a7('0xbb')][_0x77a7('0xb8')][_0x77a7('0xb9')][_0x77a7('0xb8')],'value':_0x77a7('0xbc')},{'name':_0x3e6c06[_0x77a7('0xb6')][_0x77a7('0xbd')][_0x77a7('0xb8')][_0x77a7('0xb9')]['Label'],'value':_0x77a7('0xbe')});var _0x326c99={'id':_0xca97fb+'_'+_0x3e6c06[_0x77a7('0xa4')],'name':_0x3e6c06[_0x77a7('0xbf')][_0x77a7('0xb9')][_0x77a7('0xb8')],'custom':![],'options':_0x8111c5};_0x14b93e['push'](_0x326c99);return _0x14b93e;});}function getInputList(_0x383ae2,_0x4429be,_0x307429,_0x4a6863,_0x24f3d8,_0x4fdb52,_0x3bb8dc){var _0x27cbc4={'method':_0x77a7('0x9f'),'uri':_0x383ae2+_0x77a7('0xa0')+_0x24f3d8+_0x77a7('0xb5')+_0x4fdb52+_0x77a7('0xc0')+_0x307429+_0x77a7('0xc1'),'headers':{'Authorization':'Bearer\x20'+_0x3bb8dc,'If-None-Match':null,'OData-Version':_0x77a7('0x9c')},'json':!![]};return rp(_0x27cbc4)[_0x77a7('0x2d')](function(_0x5d75e7){var _0x319d65={'id':_0x4429be+'_'+_0x5d75e7[_0x77a7('0xa4')],'name':_0x5d75e7[_0x77a7('0xbf')][_0x77a7('0xb9')]?_0x5d75e7['DisplayName'][_0x77a7('0xb9')][_0x77a7('0xb8')]:_0x5d75e7[_0x77a7('0xa4')],'custom':![],'options':[]};_0x4a6863[_0x77a7('0xa6')](_0x319d65);return _0x4a6863;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 342b536..aba6069 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x57cb4d,_0x3dd4ea){var _0x568135=function(_0x54ff47){while(--_0x54ff47){_0x57cb4d['push'](_0x57cb4d['shift']());}};_0x568135(++_0x3dd4ea);}(_0xe706,0xa3));var _0x6e70=function(_0x149980,_0xeb67c8){_0x149980=_0x149980-0x0;var _0x3aacce=_0xe706[_0x149980];return _0x3aacce;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x4c8e24,_0x46101b){var _0x22e201=function(_0x369efa){while(--_0x369efa){_0x4c8e24['push'](_0x4c8e24['shift']());}};_0x22e201(++_0x46101b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 7b569dc..f674dd4 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.rpc.js +++ b/server/api/intDynamics365Account/intDynamics365Account.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b8f=['info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','include','map','model','ShowDynamics365Account','find','raw','debug','lodash','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x153067,_0xcf617b){var _0x7fa3d4=function(_0x364b01){while(--_0x364b01){_0x153067['push'](_0x153067['shift']());}};_0x7fa3d4(++_0xcf617b);}(_0x6b8f,0x160));var _0xf6b8=function(_0x29baf9,_0x1c5f13){_0x29baf9=_0x29baf9-0x0;var _0xff40c4=_0x6b8f[_0x29baf9];return _0xff40c4;};'use strict';var _=require(_0xf6b8('0x0'));var util=require(_0xf6b8('0x1'));var moment=require(_0xf6b8('0x2'));var BPromise=require(_0xf6b8('0x3'));var rs=require(_0xf6b8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf6b8('0x5'));var jayson=require(_0xf6b8('0x6'));var client=jayson[_0xf6b8('0x7')][_0xf6b8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28e402,_0xb7f2e0,_0x25f3d7){return new BPromise(function(_0x3ca541,_0x4b5933){return client[_0xf6b8('0x9')](_0x28e402,_0x25f3d7)[_0xf6b8('0xa')](function(_0x2e6d9c){logger[_0xf6b8('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0xb7f2e0,_0xf6b8('0xc'));logger['debug'](_0xf6b8('0xd'),_0xb7f2e0,_0xf6b8('0xc'),JSON[_0xf6b8('0xe')](_0x2e6d9c));if(_0x2e6d9c[_0xf6b8('0xf')]){if(_0x2e6d9c[_0xf6b8('0xf')][_0xf6b8('0x10')]===0x1f4){logger[_0xf6b8('0xf')](_0xf6b8('0x11'),_0xb7f2e0,_0x2e6d9c['error']['message']);return _0x4b5933(_0x2e6d9c[_0xf6b8('0xf')][_0xf6b8('0x12')]);}logger[_0xf6b8('0xf')](_0xf6b8('0x11'),_0xb7f2e0,_0x2e6d9c[_0xf6b8('0xf')]['message']);return _0x3ca541(_0x2e6d9c[_0xf6b8('0xf')][_0xf6b8('0x12')]);}else{logger[_0xf6b8('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0xb7f2e0,_0xf6b8('0xc'));_0x3ca541(_0x2e6d9c['result'][_0xf6b8('0x12')]);}})[_0xf6b8('0x13')](function(_0x3856e6){logger[_0xf6b8('0xf')](_0xf6b8('0x11'),_0xb7f2e0,_0x3856e6);_0x4b5933(_0x3856e6);});});}exports[_0xf6b8('0x14')]=function(_0x57e4b7){var _0x2847b0=this;return new Promise(function(_0x1ac421,_0x3c074d){return db[_0xf6b8('0x15')][_0xf6b8('0x16')]({'raw':_0x57e4b7[_0xf6b8('0x17')]?_0x57e4b7[_0xf6b8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x57e4b7[_0xf6b8('0x17')]?_0x57e4b7[_0xf6b8('0x17')][_0xf6b8('0x18')]||null:null,'attributes':_0x57e4b7['options']?_0x57e4b7['options'][_0xf6b8('0x19')]||null:null,'limit':_0x57e4b7[_0xf6b8('0x17')]?_0x57e4b7[_0xf6b8('0x17')]['limit']||null:null,'include':_0x57e4b7[_0xf6b8('0x17')]?_0x57e4b7[_0xf6b8('0x17')][_0xf6b8('0x1a')]?_[_0xf6b8('0x1b')](_0x57e4b7[_0xf6b8('0x17')]['include'],function(_0x2508ff){return{'model':db[_0x2508ff[_0xf6b8('0x1c')]],'as':_0x2508ff['as'],'attributes':_0x2508ff[_0xf6b8('0x19')],'include':_0x2508ff[_0xf6b8('0x1a')]?_[_0xf6b8('0x1b')](_0x2508ff[_0xf6b8('0x1a')],function(_0x2d143e){return{'model':db[_0x2d143e[_0xf6b8('0x1c')]],'as':_0x2d143e['as'],'attributes':_0x2d143e['attributes'],'include':_0x2d143e['include']?_['map'](_0x2d143e[_0xf6b8('0x1a')],function(_0x282715){return{'model':db[_0x282715['model']],'as':_0x282715['as'],'attributes':_0x282715[_0xf6b8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf6b8('0xa')](function(_0x171b9f){logger[_0xf6b8('0xb')](_0xf6b8('0x14'),_0x57e4b7);logger['debug'](_0xf6b8('0x14'),_0x57e4b7,JSON['stringify'](_0x171b9f));_0x1ac421(_0x171b9f);})[_0xf6b8('0x13')](function(_0x35eac1){logger['error'](_0xf6b8('0x14'),_0x35eac1[_0xf6b8('0x12')],_0x57e4b7);_0x3c074d(_0x2847b0['error'](0x1f4,_0x35eac1[_0xf6b8('0x12')]));});});};exports[_0xf6b8('0x1d')]=function(_0x1624dc){var _0x200e95=this;return new Promise(function(_0x581dd3,_0x534222){return db[_0xf6b8('0x15')][_0xf6b8('0x1e')]({'raw':_0x1624dc[_0xf6b8('0x17')]?_0x1624dc[_0xf6b8('0x17')][_0xf6b8('0x1f')]===undefined?!![]:![]:!![],'where':_0x1624dc[_0xf6b8('0x17')]?_0x1624dc['options']['where']||null:null,'attributes':_0x1624dc[_0xf6b8('0x17')]?_0x1624dc[_0xf6b8('0x17')]['attributes']||null:null,'include':_0x1624dc[_0xf6b8('0x17')]?_0x1624dc['options']['include']?_[_0xf6b8('0x1b')](_0x1624dc[_0xf6b8('0x17')]['include'],function(_0xf5ddfd){return{'model':db[_0xf5ddfd['model']],'as':_0xf5ddfd['as'],'attributes':_0xf5ddfd[_0xf6b8('0x19')],'include':_0xf5ddfd[_0xf6b8('0x1a')]?_['map'](_0xf5ddfd[_0xf6b8('0x1a')],function(_0x2da44d){return{'model':db[_0x2da44d[_0xf6b8('0x1c')]],'as':_0x2da44d['as'],'attributes':_0x2da44d['attributes'],'include':_0x2da44d['include']?_['map'](_0x2da44d[_0xf6b8('0x1a')],function(_0x48b57d){return{'model':db[_0x48b57d[_0xf6b8('0x1c')]],'as':_0x48b57d['as'],'attributes':_0x48b57d[_0xf6b8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf6b8('0xa')](function(_0x49e17b){logger[_0xf6b8('0xb')](_0xf6b8('0x1d'),_0x1624dc);logger[_0xf6b8('0x20')](_0xf6b8('0x1d'),_0x1624dc,JSON[_0xf6b8('0xe')](_0x49e17b));_0x581dd3(_0x49e17b);})[_0xf6b8('0x13')](function(_0x512cf0){logger[_0xf6b8('0xf')](_0xf6b8('0x1d'),_0x512cf0[_0xf6b8('0x12')],_0x1624dc);_0x534222(_0x200e95[_0xf6b8('0xf')](0x1f4,_0x512cf0[_0xf6b8('0x12')]));});});}; \ No newline at end of file +var _0x92ac=['model','map','GetDynamics365Account','ShowDynamics365Account','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include'];(function(_0x1d85bf,_0x54b3c0){var _0x96edc7=function(_0x1a2848){while(--_0x1a2848){_0x1d85bf['push'](_0x1d85bf['shift']());}};_0x96edc7(++_0x54b3c0);}(_0x92ac,0x186));var _0xc92a=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x92ac[_0x2f3794];return _0x1c9fbe;};'use strict';var _=require('lodash');var util=require(_0xc92a('0x0'));var moment=require(_0xc92a('0x1'));var BPromise=require(_0xc92a('0x2'));var rs=require(_0xc92a('0x3'));var fs=require('fs');var Redis=require(_0xc92a('0x4'));var db=require(_0xc92a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc92a('0x6'));var config=require(_0xc92a('0x7'));var jayson=require(_0xc92a('0x8'));var client=jayson['client'][_0xc92a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x473997,_0x31c2dc,_0x992f43){return new BPromise(function(_0x4d56a0,_0x17134d){return client[_0xc92a('0xa')](_0x473997,_0x992f43)[_0xc92a('0xb')](function(_0x60e6ec){logger[_0xc92a('0xc')](_0xc92a('0xd'),_0x31c2dc,_0xc92a('0xe'));logger[_0xc92a('0xf')](_0xc92a('0x10'),_0x31c2dc,_0xc92a('0xe'),JSON[_0xc92a('0x11')](_0x60e6ec));if(_0x60e6ec[_0xc92a('0x12')]){if(_0x60e6ec[_0xc92a('0x12')][_0xc92a('0x13')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x31c2dc,_0x60e6ec[_0xc92a('0x12')]['message']);return _0x17134d(_0x60e6ec[_0xc92a('0x12')]['message']);}logger[_0xc92a('0x12')](_0xc92a('0xd'),_0x31c2dc,_0x60e6ec[_0xc92a('0x12')][_0xc92a('0x14')]);return _0x4d56a0(_0x60e6ec[_0xc92a('0x12')][_0xc92a('0x14')]);}else{logger['info'](_0xc92a('0xd'),_0x31c2dc,_0xc92a('0xe'));_0x4d56a0(_0x60e6ec[_0xc92a('0x15')][_0xc92a('0x14')]);}})[_0xc92a('0x16')](function(_0x57e70f){logger[_0xc92a('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x31c2dc,_0x57e70f);_0x17134d(_0x57e70f);});});}exports['GetDynamics365Account']=function(_0x134640){var _0x259343=this;return new Promise(function(_0x1acaf2,_0x494ec7){return db['Dynamics365Account'][_0xc92a('0x17')]({'raw':_0x134640[_0xc92a('0x18')]?_0x134640[_0xc92a('0x18')][_0xc92a('0x19')]===undefined?!![]:![]:!![],'where':_0x134640['options']?_0x134640[_0xc92a('0x18')][_0xc92a('0x1a')]||null:null,'attributes':_0x134640['options']?_0x134640[_0xc92a('0x18')][_0xc92a('0x1b')]||null:null,'limit':_0x134640[_0xc92a('0x18')]?_0x134640[_0xc92a('0x18')][_0xc92a('0x1c')]||null:null,'include':_0x134640['options']?_0x134640['options']['include']?_['map'](_0x134640['options'][_0xc92a('0x1d')],function(_0x9f72ad){return{'model':db[_0x9f72ad[_0xc92a('0x1e')]],'as':_0x9f72ad['as'],'attributes':_0x9f72ad[_0xc92a('0x1b')],'include':_0x9f72ad[_0xc92a('0x1d')]?_[_0xc92a('0x1f')](_0x9f72ad[_0xc92a('0x1d')],function(_0x1f0d5a){return{'model':db[_0x1f0d5a[_0xc92a('0x1e')]],'as':_0x1f0d5a['as'],'attributes':_0x1f0d5a[_0xc92a('0x1b')],'include':_0x1f0d5a['include']?_[_0xc92a('0x1f')](_0x1f0d5a['include'],function(_0x58225a){return{'model':db[_0x58225a['model']],'as':_0x58225a['as'],'attributes':_0x58225a[_0xc92a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc92a('0xb')](function(_0x4fdba0){logger['info']('GetDynamics365Account',_0x134640);logger[_0xc92a('0xf')](_0xc92a('0x20'),_0x134640,JSON[_0xc92a('0x11')](_0x4fdba0));_0x1acaf2(_0x4fdba0);})[_0xc92a('0x16')](function(_0x5cfddf){logger[_0xc92a('0x12')](_0xc92a('0x20'),_0x5cfddf[_0xc92a('0x14')],_0x134640);_0x494ec7(_0x259343[_0xc92a('0x12')](0x1f4,_0x5cfddf[_0xc92a('0x14')]));});});};exports[_0xc92a('0x21')]=function(_0x180b7a){var _0x74689f=this;return new Promise(function(_0x3e0bd7,_0x15ba6a){return db['Dynamics365Account'][_0xc92a('0x22')]({'raw':_0x180b7a[_0xc92a('0x18')]?_0x180b7a[_0xc92a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x180b7a[_0xc92a('0x18')]?_0x180b7a['options'][_0xc92a('0x1a')]||null:null,'attributes':_0x180b7a[_0xc92a('0x18')]?_0x180b7a['options']['attributes']||null:null,'include':_0x180b7a[_0xc92a('0x18')]?_0x180b7a[_0xc92a('0x18')][_0xc92a('0x1d')]?_[_0xc92a('0x1f')](_0x180b7a[_0xc92a('0x18')][_0xc92a('0x1d')],function(_0x3304d5){return{'model':db[_0x3304d5[_0xc92a('0x1e')]],'as':_0x3304d5['as'],'attributes':_0x3304d5[_0xc92a('0x1b')],'include':_0x3304d5[_0xc92a('0x1d')]?_[_0xc92a('0x1f')](_0x3304d5['include'],function(_0x288152){return{'model':db[_0x288152['model']],'as':_0x288152['as'],'attributes':_0x288152[_0xc92a('0x1b')],'include':_0x288152[_0xc92a('0x1d')]?_[_0xc92a('0x1f')](_0x288152[_0xc92a('0x1d')],function(_0x25c927){return{'model':db[_0x25c927[_0xc92a('0x1e')]],'as':_0x25c927['as'],'attributes':_0x25c927[_0xc92a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc92a('0xb')](function(_0x246b90){logger[_0xc92a('0xc')](_0xc92a('0x21'),_0x180b7a);logger[_0xc92a('0xf')](_0xc92a('0x21'),_0x180b7a,JSON[_0xc92a('0x11')](_0x246b90));_0x3e0bd7(_0x246b90);})[_0xc92a('0x16')](function(_0x41bdeb){logger[_0xc92a('0x12')]('ShowDynamics365Account',_0x41bdeb[_0xc92a('0x14')],_0x180b7a);_0x15ba6a(_0x74689f[_0xc92a('0x12')](0x1f4,_0x41bdeb[_0xc92a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 47e4461..2a4144b 100644 --- a/server/api/intDynamics365Configuration/index.js +++ b/server/api/intDynamics365Configuration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd89b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x123b70,_0x5706d0){var _0x5b30f5=function(_0x555f05){while(--_0x555f05){_0x123b70['push'](_0x123b70['shift']());}};_0x5b30f5(++_0x5706d0);}(_0xd89b,0xca));var _0xbd89=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xd89b[_0x403c20];return _0x2b271a;};'use strict';var multer=require('multer');var util=require(_0xbd89('0x0'));var path=require(_0xbd89('0x1'));var timeout=require(_0xbd89('0x2'));var express=require(_0xbd89('0x3'));var router=express[_0xbd89('0x4')]();var fs_extra=require(_0xbd89('0x5'));var auth=require(_0xbd89('0x6'));var interaction=require(_0xbd89('0x7'));var config=require(_0xbd89('0x8'));var controller=require('./intDynamics365Configuration.controller');router[_0xbd89('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbd89('0xa'),auth[_0xbd89('0xb')](),controller[_0xbd89('0xc')]);router[_0xbd89('0x9')](_0xbd89('0xd'),auth[_0xbd89('0xb')](),controller[_0xbd89('0xe')]);router[_0xbd89('0x9')]('/:id/subjects',auth[_0xbd89('0xb')](),controller[_0xbd89('0xf')]);router[_0xbd89('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xbd89('0x10')]);router[_0xbd89('0x11')]('/',auth[_0xbd89('0xb')](),controller[_0xbd89('0x12')]);router[_0xbd89('0x13')]('/:id',auth[_0xbd89('0xb')](),controller[_0xbd89('0x14')]);router[_0xbd89('0x15')](_0xbd89('0xa'),auth[_0xbd89('0xb')](),controller['destroy']);module[_0xbd89('0x16')]=router; \ No newline at end of file +var _0xdd4f=['multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports'];(function(_0x4e6e99,_0x5c41fc){var _0x28cdcc=function(_0x3cf717){while(--_0x3cf717){_0x4e6e99['push'](_0x4e6e99['shift']());}};_0x28cdcc(++_0x5c41fc);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x56d344,_0x26fa8e){_0x56d344=_0x56d344-0x0;var _0x82e07c=_0xdd4f[_0x56d344];return _0x82e07c;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./intDynamics365Configuration.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['get'](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xc')]);router['get'](_0xfdd4('0xd'),auth['isAuthenticated'](),controller[_0xfdd4('0xe')]);router[_0xfdd4('0x6')](_0xfdd4('0xf'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x10')]);router[_0xfdd4('0x11')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x12')]);router[_0xfdd4('0x13')](_0xfdd4('0x9'),auth[_0xfdd4('0x7')](),controller['update']);router[_0xfdd4('0x14')](_0xfdd4('0x9'),auth[_0xfdd4('0x7')](),controller['destroy']);module[_0xfdd4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 276800b..0eb4bed 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bb4=['ENUM','nothing','contact','exports','STRING'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0x2bb4,0xc6));var _0x42bb=function(_0x492f45,_0x4bbf55){_0x492f45=_0x492f45-0x0;var _0x297b67=_0x2bb4[_0x492f45];return _0x297b67;};'use strict';var Sequelize=require('sequelize');module[_0x42bb('0x0')]={'name':{'type':Sequelize[_0x42bb('0x1')]},'description':{'type':Sequelize[_0x42bb('0x1')]},'ticketType':{'type':Sequelize[_0x42bb('0x2')]('incident','phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x42bb('0x3')),'defaultValue':_0x42bb('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0x72f1=['STRING','phonecall','incident','ENUM','nothing','contact','sequelize'];(function(_0x3eff16,_0x3e77f){var _0x381da4=function(_0x138bff){while(--_0x138bff){_0x3eff16['push'](_0x3eff16['shift']());}};_0x381da4(++_0x3e77f);}(_0x72f1,0x1bf));var _0x172f=function(_0x45ab1b,_0x54fe6d){_0x45ab1b=_0x45ab1b-0x0;var _0x507db7=_0x72f1[_0x45ab1b];return _0x507db7;};'use strict';var Sequelize=require(_0x172f('0x0'));module['exports']={'name':{'type':Sequelize[_0x172f('0x1')]},'description':{'type':Sequelize[_0x172f('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x172f('0x2')),'defaultValue':_0x172f('0x3')},'moduleCreate':{'type':Sequelize[_0x172f('0x4')]('contact',_0x172f('0x5')),'defaultValue':_0x172f('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index ca1c88f..313dd3c 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x563d=['show','params','options','create','body','find','getFields','findOne','Dynamics365Field','filter','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','reject','save','destroy','then','end','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','Dynamics365Configuration','includeAll','include','findAll','rows','catch'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0x563d,0x17f));var _0xd563=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x563d[_0x37ffea];return _0x2e2615;};'use strict';var emlformat=require(_0xd563('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd563('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd563('0x2'));var BPromise=require(_0xd563('0x3'));var Mustache=require(_0xd563('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd563('0x5'));var ejs=require(_0xd563('0x6'));var fs=require('fs');var fs_extra=require(_0xd563('0x7'));var _=require('lodash');var squel=require(_0xd563('0x8'));var crypto=require('crypto');var jsforce=require(_0xd563('0x9'));var deskjs=require(_0xd563('0xa'));var toCsv=require(_0xd563('0x5'));var querystring=require(_0xd563('0xb'));var Papa=require(_0xd563('0xc'));var Redis=require(_0xd563('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd563('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd563('0xf'));var utils=require(_0xd563('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xd563('0x11'));var db=require(_0xd563('0x12'))['db'];function respondWithStatusCode(_0x1403ae,_0x361d2e){_0x361d2e=_0x361d2e||0xcc;return function(_0x62777){if(_0x62777){return _0x1403ae[_0xd563('0x13')](_0x361d2e);}return _0x1403ae[_0xd563('0x14')](_0x361d2e)['end']();};}function respondWithResult(_0x55e07d,_0x2f3320){_0x2f3320=_0x2f3320||0xc8;return function(_0x1c4e9e){if(_0x1c4e9e){return _0x55e07d[_0xd563('0x14')](_0x2f3320)['json'](_0x1c4e9e);}};}function respondWithFilteredResult(_0x26de15,_0xf65ffa){return function(_0x145412){if(_0x145412){var _0x1a2337=typeof _0xf65ffa[_0xd563('0x15')]===_0xd563('0x16')&&typeof _0xf65ffa[_0xd563('0x17')]==='undefined';var _0x393061=_0x145412[_0xd563('0x18')];var _0x4da85e=_0x1a2337?0x0:_0xf65ffa[_0xd563('0x15')];var _0x63a027=_0x1a2337?_0x145412[_0xd563('0x18')]:_0xf65ffa['offset']+_0xf65ffa['limit'];var _0x4c9b38;if(_0x63a027>=_0x393061){_0x63a027=_0x393061;_0x4c9b38=0xc8;}else{_0x4c9b38=0xce;}_0x26de15[_0xd563('0x14')](_0x4c9b38);return _0x26de15['set'](_0xd563('0x19'),_0x4da85e+'-'+_0x63a027+'/'+_0x393061)['json'](_0x145412);}return null;};}function patchUpdates(_0x42a91b){return function(_0x28f82a){try{jsonpatch['apply'](_0x28f82a,_0x42a91b,!![]);}catch(_0x5b74c4){return BPromise[_0xd563('0x1a')](_0x5b74c4);}return _0x28f82a[_0xd563('0x1b')]();};}function saveUpdates(_0x37e6be,_0x37ba4f){return function(_0x550dd3){if(_0x550dd3){return _0x550dd3['update'](_0x37e6be)['then'](function(_0x3b78bb){return _0x3b78bb;});}return null;};}function removeEntity(_0x56d74c,_0x3e7963){return function(_0x5d3e0f){if(_0x5d3e0f){return _0x5d3e0f[_0xd563('0x1c')]()[_0xd563('0x1d')](function(){_0x56d74c['status'](0xcc)[_0xd563('0x1e')]();});}};}function handleEntityNotFound(_0x259f67,_0x2a3afd){return function(_0x4eb2d0){if(!_0x4eb2d0){_0x259f67[_0xd563('0x13')](0x194);}return _0x4eb2d0;};}function handleError(_0x45bebb,_0x250311){_0x250311=_0x250311||0x1f4;return function(_0x5662de){logger[_0xd563('0x1f')](_0x5662de[_0xd563('0x20')]);if(_0x5662de[_0xd563('0x21')]){delete _0x5662de[_0xd563('0x21')];}_0x45bebb[_0xd563('0x14')](_0x250311)[_0xd563('0x22')](_0x5662de);};}exports[_0xd563('0x23')]=function(_0x3e3283,_0x585ecf){var _0x23848d={},_0x471c53={},_0x4d71f5={'count':0x0,'rows':[]};var _0xef211c=_['map'](db['Dynamics365Configuration'][_0xd563('0x24')],function(_0x4995d2){return{'name':_0x4995d2['fieldName'],'type':_0x4995d2[_0xd563('0x25')][_0xd563('0x26')]};});_0x471c53[_0xd563('0x27')]=_[_0xd563('0x28')](_0xef211c,_0xd563('0x21'));_0x471c53[_0xd563('0x29')]=_[_0xd563('0x2a')](_0x3e3283[_0xd563('0x29')]);_0x471c53[_0xd563('0x2b')]=_[_0xd563('0x2c')](_0x471c53[_0xd563('0x27')],_0x471c53[_0xd563('0x29')]);_0x23848d[_0xd563('0x2d')]=_[_0xd563('0x2c')](_0x471c53['model'],qs[_0xd563('0x2e')](_0x3e3283[_0xd563('0x29')]['fields']));_0x23848d['attributes']=_0x23848d[_0xd563('0x2d')][_0xd563('0x2f')]?_0x23848d[_0xd563('0x2d')]:_0x471c53[_0xd563('0x27')];if(!_0x3e3283[_0xd563('0x29')]['hasOwnProperty'](_0xd563('0x30'))){_0x23848d[_0xd563('0x17')]=qs[_0xd563('0x17')](_0x3e3283[_0xd563('0x29')][_0xd563('0x17')]);_0x23848d[_0xd563('0x15')]=qs['offset'](_0x3e3283[_0xd563('0x29')]['offset']);}_0x23848d[_0xd563('0x31')]=qs[_0xd563('0x32')](_0x3e3283['query'][_0xd563('0x32')]);_0x23848d[_0xd563('0x33')]=qs[_0xd563('0x2b')](_[_0xd563('0x34')](_0x3e3283[_0xd563('0x29')],_0x471c53[_0xd563('0x2b')]),_0xef211c);if(_0x3e3283[_0xd563('0x29')]['filter']){_0x23848d[_0xd563('0x33')]=_[_0xd563('0x35')](_0x23848d[_0xd563('0x33')],{'$or':_[_0xd563('0x28')](_0xef211c,function(_0x4e66af){if(_0x4e66af[_0xd563('0x25')]!==_0xd563('0x36')){var _0x25d460={};_0x25d460[_0x4e66af[_0xd563('0x21')]]={'$like':'%'+_0x3e3283['query']['filter']+'%'};return _0x25d460;}})});}_0x23848d=_[_0xd563('0x35')]({},_0x23848d,_0x3e3283['options']);var _0x17bfe9={'where':_0x23848d['where']};return db[_0xd563('0x37')]['count'](_0x17bfe9)['then'](function(_0x4c4bf9){_0x4d71f5[_0xd563('0x18')]=_0x4c4bf9;if(_0x3e3283['query'][_0xd563('0x38')]){_0x23848d[_0xd563('0x39')]=[{'all':!![]}];}return db[_0xd563('0x37')][_0xd563('0x3a')](_0x23848d);})['then'](function(_0x4b4cf8){_0x4d71f5[_0xd563('0x3b')]=_0x4b4cf8;return _0x4d71f5;})['then'](respondWithFilteredResult(_0x585ecf,_0x23848d))[_0xd563('0x3c')](handleError(_0x585ecf,null));};exports[_0xd563('0x3d')]=function(_0x304c30,_0x1bbffd){var _0x5386a8={'raw':![],'where':{'id':_0x304c30[_0xd563('0x3e')]['id']}},_0x432359={};_0x432359['model']=_[_0xd563('0x2a')](db[_0xd563('0x37')][_0xd563('0x24')]);_0x432359['query']=_[_0xd563('0x2a')](_0x304c30[_0xd563('0x29')]);_0x432359[_0xd563('0x2b')]=_[_0xd563('0x2c')](_0x432359[_0xd563('0x27')],_0x432359[_0xd563('0x29')]);_0x5386a8['attributes']=_[_0xd563('0x2c')](_0x432359[_0xd563('0x27')],qs[_0xd563('0x2e')](_0x304c30['query'][_0xd563('0x2e')]));_0x5386a8['attributes']=_0x5386a8['attributes'][_0xd563('0x2f')]?_0x5386a8['attributes']:_0x432359[_0xd563('0x27')];if(_0x304c30[_0xd563('0x29')]['includeAll']){_0x5386a8[_0xd563('0x39')]=[{'all':!![]}];}_0x5386a8=_[_0xd563('0x35')]({},_0x5386a8,_0x304c30[_0xd563('0x3f')]);return db[_0xd563('0x37')]['find'](_0x5386a8)[_0xd563('0x1d')](handleEntityNotFound(_0x1bbffd,null))['then'](respondWithResult(_0x1bbffd,null))[_0xd563('0x3c')](handleError(_0x1bbffd,null));};exports['create']=function(_0x2d0416,_0x2bb566){return db['Dynamics365Configuration'][_0xd563('0x40')](_0x2d0416[_0xd563('0x41')],{})[_0xd563('0x1d')](respondWithResult(_0x2bb566,0xc9))[_0xd563('0x3c')](handleError(_0x2bb566,null));};exports['update']=function(_0x5e1618,_0x3a0815){if(_0x5e1618[_0xd563('0x41')]['id']){delete _0x5e1618[_0xd563('0x41')]['id'];}return db[_0xd563('0x37')][_0xd563('0x42')]({'where':{'id':_0x5e1618[_0xd563('0x3e')]['id']}})[_0xd563('0x1d')](handleEntityNotFound(_0x3a0815,null))[_0xd563('0x1d')](saveUpdates(_0x5e1618[_0xd563('0x41')],null))[_0xd563('0x1d')](respondWithResult(_0x3a0815,null))[_0xd563('0x3c')](handleError(_0x3a0815,null));};exports[_0xd563('0x1c')]=function(_0x2ab3cf,_0x31ad4b){return db[_0xd563('0x37')][_0xd563('0x42')]({'where':{'id':_0x2ab3cf[_0xd563('0x3e')]['id']}})[_0xd563('0x1d')](handleEntityNotFound(_0x31ad4b,null))[_0xd563('0x1d')](removeEntity(_0x31ad4b,null))[_0xd563('0x3c')](handleError(_0x31ad4b,null));};exports[_0xd563('0x43')]=function(_0x58faed,_0x545826,_0x568cca){var _0x2c1872={};var _0x36633a={};var _0x665bf4;var _0x398498;return db[_0xd563('0x37')][_0xd563('0x44')]({'where':{'id':_0x58faed[_0xd563('0x3e')]['id']}})[_0xd563('0x1d')](handleEntityNotFound(_0x545826,null))[_0xd563('0x1d')](function(_0x4ac797){if(_0x4ac797){_0x665bf4=_0x4ac797;_0x36633a[_0xd563('0x27')]=_[_0xd563('0x2a')](db[_0xd563('0x45')][_0xd563('0x24')]);_0x36633a['query']=_[_0xd563('0x2a')](_0x58faed['query']);_0x36633a[_0xd563('0x2b')]=_['intersection'](_0x36633a['model'],_0x36633a[_0xd563('0x29')]);_0x2c1872[_0xd563('0x2d')]=_[_0xd563('0x2c')](_0x36633a[_0xd563('0x27')],qs[_0xd563('0x2e')](_0x58faed[_0xd563('0x29')][_0xd563('0x2e')]));_0x2c1872[_0xd563('0x2d')]=_0x2c1872[_0xd563('0x2d')][_0xd563('0x2f')]?_0x2c1872[_0xd563('0x2d')]:_0x36633a[_0xd563('0x27')];_0x2c1872['order']=qs['sort'](_0x58faed[_0xd563('0x29')]['sort']);_0x2c1872[_0xd563('0x33')]=qs[_0xd563('0x2b')](_[_0xd563('0x34')](_0x58faed[_0xd563('0x29')],_0x36633a[_0xd563('0x2b')]));if(_0x58faed[_0xd563('0x29')][_0xd563('0x46')]){_0x2c1872[_0xd563('0x33')]=_[_0xd563('0x35')](_0x2c1872[_0xd563('0x33')],{'$or':_['map'](_0x2c1872[_0xd563('0x2d')],function(_0x5720f1){var _0x2a37e3={};_0x2a37e3[_0x5720f1]={'$like':'%'+_0x58faed[_0xd563('0x29')]['filter']+'%'};return _0x2a37e3;})});}_0x2c1872=_[_0xd563('0x35')]({},_0x2c1872,_0x58faed[_0xd563('0x3f')]);return _0x665bf4[_0xd563('0x43')](_0x2c1872);}})[_0xd563('0x1d')](function(_0x334e56){if(_0x334e56){_0x398498=_0x334e56[_0xd563('0x2f')];if(!_0x58faed['query']['hasOwnProperty'](_0xd563('0x30'))){_0x2c1872[_0xd563('0x17')]=qs[_0xd563('0x17')](_0x58faed['query']['limit']);_0x2c1872[_0xd563('0x15')]=qs[_0xd563('0x15')](_0x58faed[_0xd563('0x29')][_0xd563('0x15')]);}return _0x665bf4[_0xd563('0x43')](_0x2c1872);}})[_0xd563('0x1d')](function(_0x5a4131){if(_0x5a4131){return _0x5a4131?{'count':_0x398498,'rows':_0x5a4131}:null;}})[_0xd563('0x1d')](respondWithResult(_0x545826,null))['catch'](handleError(_0x545826,null));};exports[_0xd563('0x47')]=function(_0x4fa105,_0xcbaba6,_0x4b0e21){var _0x4d5558={};var _0x232165={};var _0xe3782;var _0x40367c;return db[_0xd563('0x37')][_0xd563('0x44')]({'where':{'id':_0x4fa105['params']['id']}})[_0xd563('0x1d')](handleEntityNotFound(_0xcbaba6,null))[_0xd563('0x1d')](function(_0x1edc24){if(_0x1edc24){_0xe3782=_0x1edc24;_0x232165[_0xd563('0x27')]=_[_0xd563('0x2a')](db[_0xd563('0x45')][_0xd563('0x24')]);_0x232165['query']=_[_0xd563('0x2a')](_0x4fa105[_0xd563('0x29')]);_0x232165[_0xd563('0x2b')]=_['intersection'](_0x232165['model'],_0x232165['query']);_0x4d5558[_0xd563('0x2d')]=_[_0xd563('0x2c')](_0x232165[_0xd563('0x27')],qs[_0xd563('0x2e')](_0x4fa105['query']['fields']));_0x4d5558['attributes']=_0x4d5558[_0xd563('0x2d')][_0xd563('0x2f')]?_0x4d5558[_0xd563('0x2d')]:_0x232165['model'];_0x4d5558[_0xd563('0x31')]=qs[_0xd563('0x32')](_0x4fa105[_0xd563('0x29')][_0xd563('0x32')]);_0x4d5558[_0xd563('0x33')]=qs[_0xd563('0x2b')](_[_0xd563('0x34')](_0x4fa105[_0xd563('0x29')],_0x232165[_0xd563('0x2b')]));if(_0x4fa105['query'][_0xd563('0x46')]){_0x4d5558[_0xd563('0x33')]=_[_0xd563('0x35')](_0x4d5558[_0xd563('0x33')],{'$or':_[_0xd563('0x28')](_0x4d5558['attributes'],function(_0x27c783){var _0x27a970={};_0x27a970[_0x27c783]={'$like':'%'+_0x4fa105['query']['filter']+'%'};return _0x27a970;})});}_0x4d5558=_[_0xd563('0x35')]({},_0x4d5558,_0x4fa105['options']);return _0xe3782[_0xd563('0x47')](_0x4d5558);}})[_0xd563('0x1d')](function(_0x182860){if(_0x182860){_0x40367c=_0x182860[_0xd563('0x2f')];if(!_0x4fa105['query'][_0xd563('0x48')](_0xd563('0x30'))){_0x4d5558[_0xd563('0x17')]=qs[_0xd563('0x17')](_0x4fa105[_0xd563('0x29')][_0xd563('0x17')]);_0x4d5558[_0xd563('0x15')]=qs[_0xd563('0x15')](_0x4fa105['query'][_0xd563('0x15')]);}return _0xe3782[_0xd563('0x47')](_0x4d5558);}})[_0xd563('0x1d')](function(_0x420946){if(_0x420946){return _0x420946?{'count':_0x40367c,'rows':_0x420946}:null;}})[_0xd563('0x1d')](respondWithResult(_0xcbaba6,null))['catch'](handleError(_0xcbaba6,null));};exports['getDescriptions']=function(_0x2ef622,_0x2fe563,_0x195d47){var _0x1c7571={};var _0x266d69={};var _0x13fa62;var _0x56fcbc;return db[_0xd563('0x37')]['findOne']({'where':{'id':_0x2ef622[_0xd563('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2fe563,null))[_0xd563('0x1d')](function(_0x1fbef2){if(_0x1fbef2){_0x13fa62=_0x1fbef2;_0x266d69[_0xd563('0x27')]=_[_0xd563('0x2a')](db[_0xd563('0x45')][_0xd563('0x24')]);_0x266d69['query']=_[_0xd563('0x2a')](_0x2ef622[_0xd563('0x29')]);_0x266d69[_0xd563('0x2b')]=_[_0xd563('0x2c')](_0x266d69[_0xd563('0x27')],_0x266d69['query']);_0x1c7571[_0xd563('0x2d')]=_[_0xd563('0x2c')](_0x266d69['model'],qs[_0xd563('0x2e')](_0x2ef622[_0xd563('0x29')]['fields']));_0x1c7571[_0xd563('0x2d')]=_0x1c7571['attributes'][_0xd563('0x2f')]?_0x1c7571[_0xd563('0x2d')]:_0x266d69[_0xd563('0x27')];_0x1c7571[_0xd563('0x31')]=qs[_0xd563('0x32')](_0x2ef622[_0xd563('0x29')][_0xd563('0x32')]);_0x1c7571['where']=qs[_0xd563('0x2b')](_[_0xd563('0x34')](_0x2ef622[_0xd563('0x29')],_0x266d69[_0xd563('0x2b')]));if(_0x2ef622[_0xd563('0x29')][_0xd563('0x46')]){_0x1c7571[_0xd563('0x33')]=_[_0xd563('0x35')](_0x1c7571[_0xd563('0x33')],{'$or':_[_0xd563('0x28')](_0x1c7571[_0xd563('0x2d')],function(_0x2a0fc9){var _0x59807e={};_0x59807e[_0x2a0fc9]={'$like':'%'+_0x2ef622['query']['filter']+'%'};return _0x59807e;})});}_0x1c7571=_[_0xd563('0x35')]({},_0x1c7571,_0x2ef622[_0xd563('0x3f')]);return _0x13fa62[_0xd563('0x49')](_0x1c7571);}})[_0xd563('0x1d')](function(_0x6819cd){if(_0x6819cd){_0x56fcbc=_0x6819cd['length'];if(!_0x2ef622['query'][_0xd563('0x48')](_0xd563('0x30'))){_0x1c7571[_0xd563('0x17')]=qs[_0xd563('0x17')](_0x2ef622[_0xd563('0x29')]['limit']);_0x1c7571[_0xd563('0x15')]=qs['offset'](_0x2ef622[_0xd563('0x29')][_0xd563('0x15')]);}return _0x13fa62[_0xd563('0x49')](_0x1c7571);}})[_0xd563('0x1d')](function(_0x510a7c){if(_0x510a7c){return _0x510a7c?{'count':_0x56fcbc,'rows':_0x510a7c}:null;}})[_0xd563('0x1d')](respondWithResult(_0x2fe563,null))[_0xd563('0x3c')](handleError(_0x2fe563,null));}; \ No newline at end of file +var _0x108e=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','Dynamics365Configuration','findAll','rows','catch','show','rawAttributes','includeAll','merge','find','create','body','params','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv'];(function(_0x23eb8c,_0x5618e8){var _0x4978ba=function(_0x1512ed){while(--_0x1512ed){_0x23eb8c['push'](_0x23eb8c['shift']());}};_0x4978ba(++_0x5618e8);}(_0x108e,0x1e8));var _0xe108=function(_0x32f6e7,_0x23f23b){_0x32f6e7=_0x32f6e7-0x0;var _0x5958ad=_0x108e[_0x32f6e7];return _0x5958ad;};'use strict';var emlformat=require(_0xe108('0x0'));var rimraf=require(_0xe108('0x1'));var zipdir=require(_0xe108('0x2'));var jsonpatch=require(_0xe108('0x3'));var rp=require('request-promise');var moment=require(_0xe108('0x4'));var BPromise=require(_0xe108('0x5'));var Mustache=require(_0xe108('0x6'));var util=require(_0xe108('0x7'));var path=require('path');var sox=require(_0xe108('0x8'));var csv=require('to-csv');var ejs=require(_0xe108('0x9'));var fs=require('fs');var fs_extra=require(_0xe108('0xa'));var _=require(_0xe108('0xb'));var squel=require(_0xe108('0xc'));var crypto=require(_0xe108('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe108('0xe'));var toCsv=require(_0xe108('0xf'));var querystring=require(_0xe108('0x10'));var Papa=require('papaparse');var Redis=require(_0xe108('0x11'));var authService=require(_0xe108('0x12'));var qs=require(_0xe108('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe108('0x14'));var logger=require(_0xe108('0x15'))(_0xe108('0x16'));var utils=require(_0xe108('0x17'));var config=require(_0xe108('0x18'));var licenseUtil=require(_0xe108('0x19'));var db=require(_0xe108('0x1a'))['db'];function respondWithStatusCode(_0x3e10c2,_0x5f5d69){_0x5f5d69=_0x5f5d69||0xcc;return function(_0x3b829a){if(_0x3b829a){return _0x3e10c2[_0xe108('0x1b')](_0x5f5d69);}return _0x3e10c2[_0xe108('0x1c')](_0x5f5d69)[_0xe108('0x1d')]();};}function respondWithResult(_0x241d71,_0x19cd23){_0x19cd23=_0x19cd23||0xc8;return function(_0x5e5794){if(_0x5e5794){return _0x241d71[_0xe108('0x1c')](_0x19cd23)[_0xe108('0x1e')](_0x5e5794);}};}function respondWithFilteredResult(_0x2dbe4d,_0x5c11ae){return function(_0x6666c2){if(_0x6666c2){var _0x299410=typeof _0x5c11ae[_0xe108('0x1f')]===_0xe108('0x20')&&typeof _0x5c11ae[_0xe108('0x21')]===_0xe108('0x20');var _0x6d3579=_0x6666c2[_0xe108('0x22')];var _0x581a67=_0x299410?0x0:_0x5c11ae['offset'];var _0x2083f7=_0x299410?_0x6666c2[_0xe108('0x22')]:_0x5c11ae[_0xe108('0x1f')]+_0x5c11ae[_0xe108('0x21')];var _0xc4e3cb;if(_0x2083f7>=_0x6d3579){_0x2083f7=_0x6d3579;_0xc4e3cb=0xc8;}else{_0xc4e3cb=0xce;}_0x2dbe4d[_0xe108('0x1c')](_0xc4e3cb);return _0x2dbe4d[_0xe108('0x23')](_0xe108('0x24'),_0x581a67+'-'+_0x2083f7+'/'+_0x6d3579)[_0xe108('0x1e')](_0x6666c2);}return null;};}function patchUpdates(_0x3892cd){return function(_0x5bc6f6){try{jsonpatch['apply'](_0x5bc6f6,_0x3892cd,!![]);}catch(_0x1779ad){return BPromise[_0xe108('0x25')](_0x1779ad);}return _0x5bc6f6['save']();};}function saveUpdates(_0x3fb6ee,_0x58354d){return function(_0x5092ae){if(_0x5092ae){return _0x5092ae[_0xe108('0x26')](_0x3fb6ee)[_0xe108('0x27')](function(_0x1206bb){return _0x1206bb;});}return null;};}function removeEntity(_0x4fc390,_0x2b22e4){return function(_0x2bb736){if(_0x2bb736){return _0x2bb736[_0xe108('0x28')]()[_0xe108('0x27')](function(){_0x4fc390[_0xe108('0x1c')](0xcc)[_0xe108('0x1d')]();});}};}function handleEntityNotFound(_0x37bd03,_0x171418){return function(_0xfc2776){if(!_0xfc2776){_0x37bd03[_0xe108('0x1b')](0x194);}return _0xfc2776;};}function handleError(_0x4478dd,_0x25b153){_0x25b153=_0x25b153||0x1f4;return function(_0x2a5560){logger[_0xe108('0x29')](_0x2a5560[_0xe108('0x2a')]);if(_0x2a5560['name']){delete _0x2a5560[_0xe108('0x2b')];}_0x4478dd[_0xe108('0x1c')](_0x25b153)['send'](_0x2a5560);};}exports[_0xe108('0x2c')]=function(_0x4d894c,_0x185d18){var _0x37b3c8={},_0x4a71eb={},_0x100fea={'count':0x0,'rows':[]};var _0x49136f=_[_0xe108('0x2d')](db['Dynamics365Configuration']['rawAttributes'],function(_0x3ec050){return{'name':_0x3ec050[_0xe108('0x2e')],'type':_0x3ec050[_0xe108('0x2f')][_0xe108('0x30')]};});_0x4a71eb[_0xe108('0x31')]=_[_0xe108('0x2d')](_0x49136f,'name');_0x4a71eb['query']=_[_0xe108('0x32')](_0x4d894c[_0xe108('0x33')]);_0x4a71eb[_0xe108('0x34')]=_[_0xe108('0x35')](_0x4a71eb[_0xe108('0x31')],_0x4a71eb['query']);_0x37b3c8[_0xe108('0x36')]=_[_0xe108('0x35')](_0x4a71eb[_0xe108('0x31')],qs[_0xe108('0x37')](_0x4d894c[_0xe108('0x33')]['fields']));_0x37b3c8[_0xe108('0x36')]=_0x37b3c8['attributes'][_0xe108('0x38')]?_0x37b3c8[_0xe108('0x36')]:_0x4a71eb[_0xe108('0x31')];if(!_0x4d894c[_0xe108('0x33')][_0xe108('0x39')](_0xe108('0x3a'))){_0x37b3c8['limit']=qs[_0xe108('0x21')](_0x4d894c[_0xe108('0x33')][_0xe108('0x21')]);_0x37b3c8['offset']=qs['offset'](_0x4d894c[_0xe108('0x33')][_0xe108('0x1f')]);}_0x37b3c8[_0xe108('0x3b')]=qs[_0xe108('0x3c')](_0x4d894c[_0xe108('0x33')][_0xe108('0x3c')]);_0x37b3c8[_0xe108('0x3d')]=qs[_0xe108('0x34')](_[_0xe108('0x3e')](_0x4d894c[_0xe108('0x33')],_0x4a71eb[_0xe108('0x34')]),_0x49136f);if(_0x4d894c['query'][_0xe108('0x3f')]){_0x37b3c8['where']=_['merge'](_0x37b3c8['where'],{'$or':_[_0xe108('0x2d')](_0x49136f,function(_0x2eecc7){if(_0x2eecc7['type']!==_0xe108('0x40')){var _0x286c90={};_0x286c90[_0x2eecc7[_0xe108('0x2b')]]={'$like':'%'+_0x4d894c['query'][_0xe108('0x3f')]+'%'};return _0x286c90;}})});}_0x37b3c8=_['merge']({},_0x37b3c8,_0x4d894c[_0xe108('0x41')]);var _0x645791={'where':_0x37b3c8[_0xe108('0x3d')]};return db['Dynamics365Configuration'][_0xe108('0x22')](_0x645791)[_0xe108('0x27')](function(_0x3f8816){_0x100fea[_0xe108('0x22')]=_0x3f8816;if(_0x4d894c['query']['includeAll']){_0x37b3c8[_0xe108('0x42')]=[{'all':!![]}];}return db[_0xe108('0x43')][_0xe108('0x44')](_0x37b3c8);})[_0xe108('0x27')](function(_0x40433c){_0x100fea[_0xe108('0x45')]=_0x40433c;return _0x100fea;})[_0xe108('0x27')](respondWithFilteredResult(_0x185d18,_0x37b3c8))[_0xe108('0x46')](handleError(_0x185d18,null));};exports[_0xe108('0x47')]=function(_0xda4ea9,_0x23e211){var _0x11a56d={'raw':![],'where':{'id':_0xda4ea9['params']['id']}},_0x407cd6={};_0x407cd6['model']=_[_0xe108('0x32')](db['Dynamics365Configuration'][_0xe108('0x48')]);_0x407cd6[_0xe108('0x33')]=_[_0xe108('0x32')](_0xda4ea9[_0xe108('0x33')]);_0x407cd6['filters']=_[_0xe108('0x35')](_0x407cd6['model'],_0x407cd6['query']);_0x11a56d[_0xe108('0x36')]=_['intersection'](_0x407cd6['model'],qs[_0xe108('0x37')](_0xda4ea9['query']['fields']));_0x11a56d['attributes']=_0x11a56d[_0xe108('0x36')]['length']?_0x11a56d[_0xe108('0x36')]:_0x407cd6['model'];if(_0xda4ea9[_0xe108('0x33')][_0xe108('0x49')]){_0x11a56d[_0xe108('0x42')]=[{'all':!![]}];}_0x11a56d=_[_0xe108('0x4a')]({},_0x11a56d,_0xda4ea9[_0xe108('0x41')]);return db['Dynamics365Configuration'][_0xe108('0x4b')](_0x11a56d)[_0xe108('0x27')](handleEntityNotFound(_0x23e211,null))[_0xe108('0x27')](respondWithResult(_0x23e211,null))[_0xe108('0x46')](handleError(_0x23e211,null));};exports[_0xe108('0x4c')]=function(_0x1b20d2,_0x4282c8){return db[_0xe108('0x43')][_0xe108('0x4c')](_0x1b20d2[_0xe108('0x4d')],{})[_0xe108('0x27')](respondWithResult(_0x4282c8,0xc9))[_0xe108('0x46')](handleError(_0x4282c8,null));};exports['update']=function(_0x309cc4,_0x2c47ea){if(_0x309cc4[_0xe108('0x4d')]['id']){delete _0x309cc4[_0xe108('0x4d')]['id'];}return db[_0xe108('0x43')][_0xe108('0x4b')]({'where':{'id':_0x309cc4[_0xe108('0x4e')]['id']}})[_0xe108('0x27')](handleEntityNotFound(_0x2c47ea,null))[_0xe108('0x27')](saveUpdates(_0x309cc4[_0xe108('0x4d')],null))[_0xe108('0x27')](respondWithResult(_0x2c47ea,null))['catch'](handleError(_0x2c47ea,null));};exports[_0xe108('0x28')]=function(_0x1b7a99,_0x3184d8){return db['Dynamics365Configuration']['find']({'where':{'id':_0x1b7a99[_0xe108('0x4e')]['id']}})[_0xe108('0x27')](handleEntityNotFound(_0x3184d8,null))[_0xe108('0x27')](removeEntity(_0x3184d8,null))[_0xe108('0x46')](handleError(_0x3184d8,null));};exports[_0xe108('0x4f')]=function(_0x1eb1fc,_0x1a05f8,_0x1a361a){var _0x18f0ff={};var _0x4ff3d6={};var _0x377b95;var _0x120481;return db[_0xe108('0x43')][_0xe108('0x50')]({'where':{'id':_0x1eb1fc['params']['id']}})[_0xe108('0x27')](handleEntityNotFound(_0x1a05f8,null))[_0xe108('0x27')](function(_0x562bf0){if(_0x562bf0){_0x377b95=_0x562bf0;_0x4ff3d6[_0xe108('0x31')]=_[_0xe108('0x32')](db['Dynamics365Field']['rawAttributes']);_0x4ff3d6[_0xe108('0x33')]=_[_0xe108('0x32')](_0x1eb1fc[_0xe108('0x33')]);_0x4ff3d6[_0xe108('0x34')]=_['intersection'](_0x4ff3d6['model'],_0x4ff3d6[_0xe108('0x33')]);_0x18f0ff[_0xe108('0x36')]=_[_0xe108('0x35')](_0x4ff3d6[_0xe108('0x31')],qs[_0xe108('0x37')](_0x1eb1fc[_0xe108('0x33')][_0xe108('0x37')]));_0x18f0ff[_0xe108('0x36')]=_0x18f0ff['attributes'][_0xe108('0x38')]?_0x18f0ff[_0xe108('0x36')]:_0x4ff3d6[_0xe108('0x31')];_0x18f0ff[_0xe108('0x3b')]=qs['sort'](_0x1eb1fc[_0xe108('0x33')][_0xe108('0x3c')]);_0x18f0ff[_0xe108('0x3d')]=qs[_0xe108('0x34')](_[_0xe108('0x3e')](_0x1eb1fc['query'],_0x4ff3d6[_0xe108('0x34')]));if(_0x1eb1fc[_0xe108('0x33')][_0xe108('0x3f')]){_0x18f0ff[_0xe108('0x3d')]=_[_0xe108('0x4a')](_0x18f0ff['where'],{'$or':_['map'](_0x18f0ff[_0xe108('0x36')],function(_0x4c2d83){var _0x1c53b8={};_0x1c53b8[_0x4c2d83]={'$like':'%'+_0x1eb1fc[_0xe108('0x33')][_0xe108('0x3f')]+'%'};return _0x1c53b8;})});}_0x18f0ff=_['merge']({},_0x18f0ff,_0x1eb1fc[_0xe108('0x41')]);return _0x377b95[_0xe108('0x4f')](_0x18f0ff);}})[_0xe108('0x27')](function(_0x3192d4){if(_0x3192d4){_0x120481=_0x3192d4[_0xe108('0x38')];if(!_0x1eb1fc[_0xe108('0x33')][_0xe108('0x39')]('nolimit')){_0x18f0ff[_0xe108('0x21')]=qs[_0xe108('0x21')](_0x1eb1fc[_0xe108('0x33')][_0xe108('0x21')]);_0x18f0ff[_0xe108('0x1f')]=qs[_0xe108('0x1f')](_0x1eb1fc[_0xe108('0x33')]['offset']);}return _0x377b95[_0xe108('0x4f')](_0x18f0ff);}})[_0xe108('0x27')](function(_0x3bcad4){if(_0x3bcad4){return _0x3bcad4?{'count':_0x120481,'rows':_0x3bcad4}:null;}})[_0xe108('0x27')](respondWithResult(_0x1a05f8,null))['catch'](handleError(_0x1a05f8,null));};exports['getSubjects']=function(_0x5c9e0a,_0x18ded8,_0x1a16a4){var _0x3c54e5={};var _0x319c48={};var _0x38819a;var _0x35cc9f;return db[_0xe108('0x43')][_0xe108('0x50')]({'where':{'id':_0x5c9e0a[_0xe108('0x4e')]['id']}})[_0xe108('0x27')](handleEntityNotFound(_0x18ded8,null))[_0xe108('0x27')](function(_0x5a127f){if(_0x5a127f){_0x38819a=_0x5a127f;_0x319c48[_0xe108('0x31')]=_[_0xe108('0x32')](db[_0xe108('0x51')][_0xe108('0x48')]);_0x319c48[_0xe108('0x33')]=_[_0xe108('0x32')](_0x5c9e0a[_0xe108('0x33')]);_0x319c48['filters']=_[_0xe108('0x35')](_0x319c48[_0xe108('0x31')],_0x319c48['query']);_0x3c54e5[_0xe108('0x36')]=_[_0xe108('0x35')](_0x319c48[_0xe108('0x31')],qs[_0xe108('0x37')](_0x5c9e0a[_0xe108('0x33')][_0xe108('0x37')]));_0x3c54e5[_0xe108('0x36')]=_0x3c54e5['attributes']['length']?_0x3c54e5[_0xe108('0x36')]:_0x319c48[_0xe108('0x31')];_0x3c54e5['order']=qs['sort'](_0x5c9e0a[_0xe108('0x33')][_0xe108('0x3c')]);_0x3c54e5[_0xe108('0x3d')]=qs[_0xe108('0x34')](_[_0xe108('0x3e')](_0x5c9e0a[_0xe108('0x33')],_0x319c48['filters']));if(_0x5c9e0a['query'][_0xe108('0x3f')]){_0x3c54e5[_0xe108('0x3d')]=_[_0xe108('0x4a')](_0x3c54e5['where'],{'$or':_[_0xe108('0x2d')](_0x3c54e5['attributes'],function(_0x316b0f){var _0x5dddd9={};_0x5dddd9[_0x316b0f]={'$like':'%'+_0x5c9e0a[_0xe108('0x33')]['filter']+'%'};return _0x5dddd9;})});}_0x3c54e5=_[_0xe108('0x4a')]({},_0x3c54e5,_0x5c9e0a['options']);return _0x38819a[_0xe108('0x52')](_0x3c54e5);}})['then'](function(_0x40b21){if(_0x40b21){_0x35cc9f=_0x40b21['length'];if(!_0x5c9e0a['query'][_0xe108('0x39')](_0xe108('0x3a'))){_0x3c54e5[_0xe108('0x21')]=qs[_0xe108('0x21')](_0x5c9e0a['query']['limit']);_0x3c54e5['offset']=qs['offset'](_0x5c9e0a['query'][_0xe108('0x1f')]);}return _0x38819a['getSubjects'](_0x3c54e5);}})[_0xe108('0x27')](function(_0x8119df){if(_0x8119df){return _0x8119df?{'count':_0x35cc9f,'rows':_0x8119df}:null;}})['then'](respondWithResult(_0x18ded8,null))['catch'](handleError(_0x18ded8,null));};exports[_0xe108('0x53')]=function(_0x34be0d,_0x1ac920,_0x77efc5){var _0x40cb7d={};var _0x425b0c={};var _0x5d1db2;var _0x478d4c;return db[_0xe108('0x43')][_0xe108('0x50')]({'where':{'id':_0x34be0d[_0xe108('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1ac920,null))[_0xe108('0x27')](function(_0x4edd94){if(_0x4edd94){_0x5d1db2=_0x4edd94;_0x425b0c[_0xe108('0x31')]=_['keys'](db[_0xe108('0x51')]['rawAttributes']);_0x425b0c[_0xe108('0x33')]=_[_0xe108('0x32')](_0x34be0d['query']);_0x425b0c[_0xe108('0x34')]=_[_0xe108('0x35')](_0x425b0c[_0xe108('0x31')],_0x425b0c[_0xe108('0x33')]);_0x40cb7d[_0xe108('0x36')]=_[_0xe108('0x35')](_0x425b0c[_0xe108('0x31')],qs[_0xe108('0x37')](_0x34be0d[_0xe108('0x33')][_0xe108('0x37')]));_0x40cb7d[_0xe108('0x36')]=_0x40cb7d[_0xe108('0x36')]['length']?_0x40cb7d[_0xe108('0x36')]:_0x425b0c['model'];_0x40cb7d[_0xe108('0x3b')]=qs[_0xe108('0x3c')](_0x34be0d['query'][_0xe108('0x3c')]);_0x40cb7d[_0xe108('0x3d')]=qs[_0xe108('0x34')](_['pick'](_0x34be0d[_0xe108('0x33')],_0x425b0c['filters']));if(_0x34be0d[_0xe108('0x33')]['filter']){_0x40cb7d['where']=_[_0xe108('0x4a')](_0x40cb7d[_0xe108('0x3d')],{'$or':_[_0xe108('0x2d')](_0x40cb7d['attributes'],function(_0x238a64){var _0xc8bad9={};_0xc8bad9[_0x238a64]={'$like':'%'+_0x34be0d[_0xe108('0x33')]['filter']+'%'};return _0xc8bad9;})});}_0x40cb7d=_[_0xe108('0x4a')]({},_0x40cb7d,_0x34be0d[_0xe108('0x41')]);return _0x5d1db2[_0xe108('0x53')](_0x40cb7d);}})[_0xe108('0x27')](function(_0x5cceea){if(_0x5cceea){_0x478d4c=_0x5cceea[_0xe108('0x38')];if(!_0x34be0d['query'][_0xe108('0x39')](_0xe108('0x3a'))){_0x40cb7d[_0xe108('0x21')]=qs[_0xe108('0x21')](_0x34be0d['query']['limit']);_0x40cb7d[_0xe108('0x1f')]=qs['offset'](_0x34be0d[_0xe108('0x33')][_0xe108('0x1f')]);}return _0x5d1db2[_0xe108('0x53')](_0x40cb7d);}})['then'](function(_0x5c2293){if(_0x5c2293){return _0x5c2293?{'count':_0x478d4c,'rows':_0x5c2293}:null;}})[_0xe108('0x27')](respondWithResult(_0x1ac920,null))['catch'](handleError(_0x1ac920,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 60fba8e..88852c0 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x7bdd79,_0x3461ac){var _0x462dee=function(_0x4a3cb0){while(--_0x4a3cb0){_0x7bdd79['push'](_0x7bdd79['shift']());}};_0x462dee(++_0x3461ac);}(_0x9bde,0xe1));var _0xe9bd=function(_0xf26689,_0x1868c2){_0xf26689=_0xf26689-0x0;var _0xe1ad41=_0x9bde[_0xf26689];return _0xe1ad41;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x504c6d,_0x465664){var _0x25fce5=function(_0x28e695){while(--_0x28e695){_0x504c6d['push'](_0x504c6d['shift']());}};_0x25fce5(++_0x465664);}(_0x54ef,0x112));var _0xf54e=function(_0x56096e,_0x45ea43){_0x56096e=_0x56096e-0x0;var _0x4ecccd=_0x54ef[_0x56096e];return _0x4ecccd;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index dddb86e..4b13a32 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcc2=['rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x39cc8f,_0xb60cd8){var _0x15e616=function(_0x513d9e){while(--_0x513d9e){_0x39cc8f['push'](_0x39cc8f['shift']());}};_0x15e616(++_0xb60cd8);}(_0xdcc2,0x120));var _0x2dcc=function(_0x598455,_0x16505a){_0x598455=_0x598455-0x0;var _0x224f4b=_0xdcc2[_0x598455];return _0x224f4b;};'use strict';var _=require(_0x2dcc('0x0'));var util=require(_0x2dcc('0x1'));var moment=require(_0x2dcc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2dcc('0x3'))['db'];var utils=require(_0x2dcc('0x4'));var logger=require(_0x2dcc('0x5'))(_0x2dcc('0x6'));var config=require(_0x2dcc('0x7'));var jayson=require(_0x2dcc('0x8'));var client=jayson[_0x2dcc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f2b25,_0xbcb47c,_0x46d648){return new BPromise(function(_0x2683fa,_0x4eb7fb){return client[_0x2dcc('0xa')](_0x4f2b25,_0x46d648)[_0x2dcc('0xb')](function(_0x55369a){logger[_0x2dcc('0xc')](_0x2dcc('0xd'),_0xbcb47c,'request\x20sent');logger[_0x2dcc('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0xbcb47c,_0x2dcc('0xf'),JSON[_0x2dcc('0x10')](_0x55369a));if(_0x55369a[_0x2dcc('0x11')]){if(_0x55369a['error'][_0x2dcc('0x12')]===0x1f4){logger[_0x2dcc('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0xbcb47c,_0x55369a[_0x2dcc('0x11')][_0x2dcc('0x13')]);return _0x4eb7fb(_0x55369a[_0x2dcc('0x11')][_0x2dcc('0x13')]);}logger['error'](_0x2dcc('0xd'),_0xbcb47c,_0x55369a[_0x2dcc('0x11')][_0x2dcc('0x13')]);return _0x2683fa(_0x55369a[_0x2dcc('0x11')]['message']);}else{logger[_0x2dcc('0xc')](_0x2dcc('0xd'),_0xbcb47c,_0x2dcc('0xf'));_0x2683fa(_0x55369a['result'][_0x2dcc('0x13')]);}})[_0x2dcc('0x14')](function(_0x590c99){logger[_0x2dcc('0x11')](_0x2dcc('0xd'),_0xbcb47c,_0x590c99);_0x4eb7fb(_0x590c99);});});} \ No newline at end of file +var _0xc8b6=['stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0xc8b6,0xd4));var _0x6c8b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xc8b6[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x6c8b('0x0'));var util=require(_0x6c8b('0x1'));var moment=require(_0x6c8b('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c8b('0x3'));var fs=require('fs');var Redis=require(_0x6c8b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c8b('0x5'));var logger=require(_0x6c8b('0x6'))(_0x6c8b('0x7'));var config=require(_0x6c8b('0x8'));var jayson=require(_0x6c8b('0x9'));var client=jayson[_0x6c8b('0xa')][_0x6c8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39ede0,_0x2f3434,_0x1d43b1){return new BPromise(function(_0x3852e8,_0x1c8d36){return client[_0x6c8b('0xc')](_0x39ede0,_0x1d43b1)[_0x6c8b('0xd')](function(_0x71d5c1){logger['info'](_0x6c8b('0xe'),_0x2f3434,_0x6c8b('0xf'));logger[_0x6c8b('0x10')](_0x6c8b('0x11'),_0x2f3434,_0x6c8b('0xf'),JSON[_0x6c8b('0x12')](_0x71d5c1));if(_0x71d5c1[_0x6c8b('0x13')]){if(_0x71d5c1['error'][_0x6c8b('0x14')]===0x1f4){logger[_0x6c8b('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2f3434,_0x71d5c1[_0x6c8b('0x13')][_0x6c8b('0x15')]);return _0x1c8d36(_0x71d5c1[_0x6c8b('0x13')][_0x6c8b('0x15')]);}logger[_0x6c8b('0x13')](_0x6c8b('0xe'),_0x2f3434,_0x71d5c1['error'][_0x6c8b('0x15')]);return _0x3852e8(_0x71d5c1[_0x6c8b('0x13')]['message']);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x2f3434,_0x6c8b('0xf'));_0x3852e8(_0x71d5c1[_0x6c8b('0x16')][_0x6c8b('0x15')]);}})['catch'](function(_0x552a01){logger['error'](_0x6c8b('0xe'),_0x2f3434,_0x552a01);_0x1c8d36(_0x552a01);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 94746d8..3adbcc3 100644 --- a/server/api/intDynamics365Field/index.js +++ b/server/api/intDynamics365Field/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4e8=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','get','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x49ce54,_0x4b2752){var _0x3c24b8=function(_0x6d15dc){while(--_0x6d15dc){_0x49ce54['push'](_0x49ce54['shift']());}};_0x3c24b8(++_0x4b2752);}(_0xd4e8,0x9a));var _0x8d4e=function(_0x520a18,_0x2e7d0a){_0x520a18=_0x520a18-0x0;var _0x5b0ba6=_0xd4e8[_0x520a18];return _0x5b0ba6;};'use strict';var multer=require(_0x8d4e('0x0'));var util=require('util');var path=require(_0x8d4e('0x1'));var timeout=require(_0x8d4e('0x2'));var express=require(_0x8d4e('0x3'));var router=express['Router']();var fs_extra=require(_0x8d4e('0x4'));var auth=require(_0x8d4e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8d4e('0x6')](_0x8d4e('0x7'),auth[_0x8d4e('0x8')](),controller[_0x8d4e('0x9')]);router[_0x8d4e('0xa')]('/',auth[_0x8d4e('0x8')](),controller[_0x8d4e('0xb')]);router[_0x8d4e('0xc')](_0x8d4e('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x8d4e('0xd')]('/:id',auth[_0x8d4e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x139d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2f70d2,_0x49da1c){var _0x3581d0=function(_0x2824a8){while(--_0x2824a8){_0x2f70d2['push'](_0x2f70d2['shift']());}};_0x3581d0(++_0x49da1c);}(_0x139d,0x1c9));var _0xd139=function(_0x48f76a,_0x29b2ac){_0x48f76a=_0x48f76a-0x0;var _0x3385a6=_0x139d[_0x48f76a];return _0x3385a6;};'use strict';var multer=require(_0xd139('0x0'));var util=require(_0xd139('0x1'));var path=require(_0xd139('0x2'));var timeout=require(_0xd139('0x3'));var express=require(_0xd139('0x4'));var router=express[_0xd139('0x5')]();var fs_extra=require(_0xd139('0x6'));var auth=require(_0xd139('0x7'));var interaction=require(_0xd139('0x8'));var config=require(_0xd139('0x9'));var controller=require(_0xd139('0xa'));router[_0xd139('0xb')]('/',auth['isAuthenticated'](),controller[_0xd139('0xc')]);router[_0xd139('0xb')](_0xd139('0xd'),auth[_0xd139('0xe')](),controller[_0xd139('0xf')]);router['post']('/',auth[_0xd139('0xe')](),controller[_0xd139('0x10')]);router[_0xd139('0x11')](_0xd139('0xd'),auth[_0xd139('0xe')](),controller[_0xd139('0x12')]);router[_0xd139('0x13')](_0xd139('0xd'),auth['isAuthenticated'](),controller[_0xd139('0x14')]);module[_0xd139('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 30cd9ad..7ade0b5 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.attributes.js +++ b/server/api/intDynamics365Field/intDynamics365Field.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f65=['customVariable','string','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2f4f0e,_0x36be72){var _0x3d36c4=function(_0x87819e){while(--_0x87819e){_0x2f4f0e['push'](_0x2f4f0e['shift']());}};_0x3d36c4(++_0x36be72);}(_0x1f65,0x155));var _0x51f6=function(_0x50faaa,_0x59d114){_0x50faaa=_0x50faaa-0x0;var _0x48300e=_0x1f65[_0x50faaa];return _0x48300e;};'use strict';var Sequelize=require(_0x51f6('0x0'));module[_0x51f6('0x1')]={'type':{'type':Sequelize[_0x51f6('0x2')]('string','variable',_0x51f6('0x3'),'keyValue','picklist'),'defaultValue':_0x51f6('0x4')},'content':{'type':Sequelize[_0x51f6('0x5')]},'key':{'type':Sequelize[_0x51f6('0x5')]},'keyType':{'type':Sequelize[_0x51f6('0x2')](_0x51f6('0x4'),_0x51f6('0x6'),_0x51f6('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x51f6('0x5')]},'nameField':{'type':Sequelize[_0x51f6('0x5')]},'customField':{'type':Sequelize[_0x51f6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x51f6('0x5')]}}; \ No newline at end of file +var _0xb83a=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xb83a,0xc5));var _0xab83=function(_0x2f9d59,_0x89d5b1){_0x2f9d59=_0x2f9d59-0x0;var _0x18755d=_0xb83a[_0x2f9d59];return _0x18755d;};'use strict';var Sequelize=require(_0xab83('0x0'));module[_0xab83('0x1')]={'type':{'type':Sequelize[_0xab83('0x2')](_0xab83('0x3'),_0xab83('0x4'),_0xab83('0x5'),_0xab83('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xab83('0x7')]},'keyType':{'type':Sequelize[_0xab83('0x2')](_0xab83('0x3'),_0xab83('0x4'),_0xab83('0x5'))},'keyContent':{'type':Sequelize[_0xab83('0x7')]},'idField':{'type':Sequelize[_0xab83('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xab83('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab83('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index a1ff4a8..c1ac118 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.controller.js +++ b/server/api/intDynamics365Field/intDynamics365Field.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7101=['Dynamics365Field','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','offset','count','status','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map'];(function(_0x2f6758,_0x341820){var _0x2ed969=function(_0x45472f){while(--_0x45472f){_0x2f6758['push'](_0x2f6758['shift']());}};_0x2ed969(++_0x341820);}(_0x7101,0x1b0));var _0x1710=function(_0x1e4e1a,_0x3bdb4a){_0x1e4e1a=_0x1e4e1a-0x0;var _0x462e08=_0x7101[_0x1e4e1a];return _0x462e08;};'use strict';var emlformat=require(_0x1710('0x0'));var rimraf=require(_0x1710('0x1'));var zipdir=require(_0x1710('0x2'));var jsonpatch=require(_0x1710('0x3'));var rp=require(_0x1710('0x4'));var moment=require(_0x1710('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1710('0x6'));var util=require(_0x1710('0x7'));var path=require(_0x1710('0x8'));var sox=require(_0x1710('0x9'));var csv=require(_0x1710('0xa'));var ejs=require(_0x1710('0xb'));var fs=require('fs');var fs_extra=require(_0x1710('0xc'));var _=require(_0x1710('0xd'));var squel=require(_0x1710('0xe'));var crypto=require('crypto');var jsforce=require(_0x1710('0xf'));var deskjs=require(_0x1710('0x10'));var toCsv=require(_0x1710('0xa'));var querystring=require('querystring');var Papa=require(_0x1710('0x11'));var Redis=require(_0x1710('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1710('0x13'));var as=require(_0x1710('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1710('0x15'))(_0x1710('0x16'));var utils=require(_0x1710('0x17'));var config=require(_0x1710('0x18'));var licenseUtil=require(_0x1710('0x19'));var db=require(_0x1710('0x1a'))['db'];function respondWithStatusCode(_0xb32e2f,_0x101b4d){_0x101b4d=_0x101b4d||0xcc;return function(_0x172e3d){if(_0x172e3d){return _0xb32e2f[_0x1710('0x1b')](_0x101b4d);}return _0xb32e2f['status'](_0x101b4d)['end']();};}function respondWithResult(_0x444258,_0x51d618){_0x51d618=_0x51d618||0xc8;return function(_0x3a23bb){if(_0x3a23bb){return _0x444258['status'](_0x51d618)[_0x1710('0x1c')](_0x3a23bb);}};}function respondWithFilteredResult(_0x4c2d8e,_0x4652ec){return function(_0x533582){if(_0x533582){var _0x3dfe55=typeof _0x4652ec['offset']===_0x1710('0x1d')&&typeof _0x4652ec[_0x1710('0x1e')]===_0x1710('0x1d');var _0x21c9b5=_0x533582['count'];var _0x18b61d=_0x3dfe55?0x0:_0x4652ec[_0x1710('0x1f')];var _0x51e15c=_0x3dfe55?_0x533582[_0x1710('0x20')]:_0x4652ec[_0x1710('0x1f')]+_0x4652ec['limit'];var _0x4ac739;if(_0x51e15c>=_0x21c9b5){_0x51e15c=_0x21c9b5;_0x4ac739=0xc8;}else{_0x4ac739=0xce;}_0x4c2d8e[_0x1710('0x21')](_0x4ac739);return _0x4c2d8e[_0x1710('0x22')](_0x1710('0x23'),_0x18b61d+'-'+_0x51e15c+'/'+_0x21c9b5)[_0x1710('0x1c')](_0x533582);}return null;};}function patchUpdates(_0x1b0e64){return function(_0x177d10){try{jsonpatch[_0x1710('0x24')](_0x177d10,_0x1b0e64,!![]);}catch(_0xb84fc8){return BPromise[_0x1710('0x25')](_0xb84fc8);}return _0x177d10[_0x1710('0x26')]();};}function saveUpdates(_0x1c4e19,_0x22cfc1){return function(_0x54f75d){if(_0x54f75d){return _0x54f75d['update'](_0x1c4e19)['then'](function(_0x953758){return _0x953758;});}return null;};}function removeEntity(_0x248045,_0x2961d5){return function(_0x4ec7d0){if(_0x4ec7d0){return _0x4ec7d0[_0x1710('0x27')]()[_0x1710('0x28')](function(){_0x248045[_0x1710('0x21')](0xcc)[_0x1710('0x29')]();});}};}function handleEntityNotFound(_0x2996e7,_0xc57b83){return function(_0x1d318a){if(!_0x1d318a){_0x2996e7[_0x1710('0x1b')](0x194);}return _0x1d318a;};}function handleError(_0x571bb5,_0x4667cb){_0x4667cb=_0x4667cb||0x1f4;return function(_0x441153){logger[_0x1710('0x2a')](_0x441153[_0x1710('0x2b')]);if(_0x441153[_0x1710('0x2c')]){delete _0x441153['name'];}_0x571bb5[_0x1710('0x21')](_0x4667cb)[_0x1710('0x2d')](_0x441153);};}exports[_0x1710('0x2e')]=function(_0xa5d032,_0x519a06){var _0x553c45={},_0x39be92={},_0x571c40={'count':0x0,'rows':[]};var _0xb67bdd=_[_0x1710('0x2f')](db[_0x1710('0x30')][_0x1710('0x31')],function(_0xe35ab4){return{'name':_0xe35ab4[_0x1710('0x32')],'type':_0xe35ab4[_0x1710('0x33')][_0x1710('0x34')]};});_0x39be92['model']=_[_0x1710('0x2f')](_0xb67bdd,_0x1710('0x2c'));_0x39be92['query']=_['keys'](_0xa5d032[_0x1710('0x35')]);_0x39be92[_0x1710('0x36')]=_[_0x1710('0x37')](_0x39be92[_0x1710('0x38')],_0x39be92[_0x1710('0x35')]);_0x553c45[_0x1710('0x39')]=_['intersection'](_0x39be92[_0x1710('0x38')],qs[_0x1710('0x3a')](_0xa5d032[_0x1710('0x35')][_0x1710('0x3a')]));_0x553c45[_0x1710('0x39')]=_0x553c45['attributes'][_0x1710('0x3b')]?_0x553c45[_0x1710('0x39')]:_0x39be92[_0x1710('0x38')];if(!_0xa5d032[_0x1710('0x35')]['hasOwnProperty'](_0x1710('0x3c'))){_0x553c45[_0x1710('0x1e')]=qs[_0x1710('0x1e')](_0xa5d032[_0x1710('0x35')][_0x1710('0x1e')]);_0x553c45[_0x1710('0x1f')]=qs[_0x1710('0x1f')](_0xa5d032[_0x1710('0x35')][_0x1710('0x1f')]);}_0x553c45[_0x1710('0x3d')]=qs[_0x1710('0x3e')](_0xa5d032[_0x1710('0x35')]['sort']);_0x553c45[_0x1710('0x3f')]=qs[_0x1710('0x36')](_[_0x1710('0x40')](_0xa5d032['query'],_0x39be92[_0x1710('0x36')]),_0xb67bdd);if(_0xa5d032[_0x1710('0x35')]['filter']){_0x553c45[_0x1710('0x3f')]=_[_0x1710('0x41')](_0x553c45[_0x1710('0x3f')],{'$or':_[_0x1710('0x2f')](_0xb67bdd,function(_0x532e66){if(_0x532e66[_0x1710('0x33')]!==_0x1710('0x42')){var _0x1f8bcf={};_0x1f8bcf[_0x532e66[_0x1710('0x2c')]]={'$like':'%'+_0xa5d032[_0x1710('0x35')][_0x1710('0x43')]+'%'};return _0x1f8bcf;}})});}_0x553c45=_[_0x1710('0x41')]({},_0x553c45,_0xa5d032[_0x1710('0x44')]);var _0x581a76={'where':_0x553c45[_0x1710('0x3f')]};return db['Dynamics365Field']['count'](_0x581a76)[_0x1710('0x28')](function(_0x5f05f1){_0x571c40[_0x1710('0x20')]=_0x5f05f1;if(_0xa5d032[_0x1710('0x35')][_0x1710('0x45')]){_0x553c45[_0x1710('0x46')]=[{'all':!![]}];}return db[_0x1710('0x30')][_0x1710('0x47')](_0x553c45);})[_0x1710('0x28')](function(_0x4b443a){_0x571c40[_0x1710('0x48')]=_0x4b443a;return _0x571c40;})[_0x1710('0x28')](respondWithFilteredResult(_0x519a06,_0x553c45))['catch'](handleError(_0x519a06,null));};exports[_0x1710('0x49')]=function(_0x3d8e87,_0x1cb6da){var _0xcb0841={'raw':!![],'where':{'id':_0x3d8e87[_0x1710('0x4a')]['id']}},_0x39886e={};_0x39886e[_0x1710('0x38')]=_[_0x1710('0x4b')](db[_0x1710('0x30')][_0x1710('0x31')]);_0x39886e[_0x1710('0x35')]=_[_0x1710('0x4b')](_0x3d8e87[_0x1710('0x35')]);_0x39886e[_0x1710('0x36')]=_[_0x1710('0x37')](_0x39886e[_0x1710('0x38')],_0x39886e['query']);_0xcb0841['attributes']=_[_0x1710('0x37')](_0x39886e[_0x1710('0x38')],qs[_0x1710('0x3a')](_0x3d8e87[_0x1710('0x35')][_0x1710('0x3a')]));_0xcb0841[_0x1710('0x39')]=_0xcb0841[_0x1710('0x39')][_0x1710('0x3b')]?_0xcb0841[_0x1710('0x39')]:_0x39886e[_0x1710('0x38')];if(_0x3d8e87[_0x1710('0x35')]['includeAll']){_0xcb0841[_0x1710('0x46')]=[{'all':!![]}];}_0xcb0841=_[_0x1710('0x41')]({},_0xcb0841,_0x3d8e87[_0x1710('0x44')]);return db[_0x1710('0x30')][_0x1710('0x4c')](_0xcb0841)[_0x1710('0x28')](handleEntityNotFound(_0x1cb6da,null))[_0x1710('0x28')](respondWithResult(_0x1cb6da,null))['catch'](handleError(_0x1cb6da,null));};exports[_0x1710('0x4d')]=function(_0x2db9c1,_0x3e6c3d){return db[_0x1710('0x30')][_0x1710('0x4d')](_0x2db9c1['body'],{})['then'](respondWithResult(_0x3e6c3d,0xc9))[_0x1710('0x4e')](handleError(_0x3e6c3d,null));};exports['update']=function(_0x36ff92,_0x174ba3){if(_0x36ff92['body']['id']){delete _0x36ff92[_0x1710('0x4f')]['id'];}return db[_0x1710('0x30')][_0x1710('0x4c')]({'where':{'id':_0x36ff92[_0x1710('0x4a')]['id']}})[_0x1710('0x28')](handleEntityNotFound(_0x174ba3,null))[_0x1710('0x28')](saveUpdates(_0x36ff92[_0x1710('0x4f')],null))[_0x1710('0x28')](respondWithResult(_0x174ba3,null))['catch'](handleError(_0x174ba3,null));};exports[_0x1710('0x27')]=function(_0x3f0195,_0xd4e684){return db['Dynamics365Field']['find']({'where':{'id':_0x3f0195[_0x1710('0x4a')]['id']}})[_0x1710('0x28')](handleEntityNotFound(_0xd4e684,null))[_0x1710('0x28')](removeEntity(_0xd4e684,null))['catch'](handleError(_0xd4e684,null));}; \ No newline at end of file +var _0x37bc=['query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','Dynamics365Field','include','rows','catch','show','params','includeAll','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x37bc,0xb0));var _0xc37b=function(_0x1808aa,_0x26c66b){_0x1808aa=_0x1808aa-0x0;var _0x55d788=_0x37bc[_0x1808aa];return _0x55d788;};'use strict';var emlformat=require(_0xc37b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc37b('0x1'));var jsonpatch=require(_0xc37b('0x2'));var rp=require(_0xc37b('0x3'));var moment=require('moment');var BPromise=require(_0xc37b('0x4'));var Mustache=require(_0xc37b('0x5'));var util=require('util');var path=require(_0xc37b('0x6'));var sox=require(_0xc37b('0x7'));var csv=require(_0xc37b('0x8'));var ejs=require(_0xc37b('0x9'));var fs=require('fs');var fs_extra=require(_0xc37b('0xa'));var _=require(_0xc37b('0xb'));var squel=require(_0xc37b('0xc'));var crypto=require(_0xc37b('0xd'));var jsforce=require(_0xc37b('0xe'));var deskjs=require(_0xc37b('0xf'));var toCsv=require(_0xc37b('0x8'));var querystring=require(_0xc37b('0x10'));var Papa=require(_0xc37b('0x11'));var Redis=require(_0xc37b('0x12'));var authService=require(_0xc37b('0x13'));var qs=require(_0xc37b('0x14'));var as=require(_0xc37b('0x15'));var hardwareService=require(_0xc37b('0x16'));var logger=require(_0xc37b('0x17'))('api');var utils=require(_0xc37b('0x18'));var config=require(_0xc37b('0x19'));var licenseUtil=require(_0xc37b('0x1a'));var db=require(_0xc37b('0x1b'))['db'];function respondWithStatusCode(_0x27955b,_0x2fa4bb){_0x2fa4bb=_0x2fa4bb||0xcc;return function(_0x108390){if(_0x108390){return _0x27955b[_0xc37b('0x1c')](_0x2fa4bb);}return _0x27955b[_0xc37b('0x1d')](_0x2fa4bb)[_0xc37b('0x1e')]();};}function respondWithResult(_0x29e575,_0x43786f){_0x43786f=_0x43786f||0xc8;return function(_0x8b543f){if(_0x8b543f){return _0x29e575[_0xc37b('0x1d')](_0x43786f)['json'](_0x8b543f);}};}function respondWithFilteredResult(_0x2ddff0,_0x17b665){return function(_0x288569){if(_0x288569){var _0x2f73d8=typeof _0x17b665['offset']==='undefined'&&typeof _0x17b665[_0xc37b('0x1f')]==='undefined';var _0x4a42b1=_0x288569[_0xc37b('0x20')];var _0xdf455e=_0x2f73d8?0x0:_0x17b665[_0xc37b('0x21')];var _0x5e4bb6=_0x2f73d8?_0x288569[_0xc37b('0x20')]:_0x17b665[_0xc37b('0x21')]+_0x17b665['limit'];var _0xa5319d;if(_0x5e4bb6>=_0x4a42b1){_0x5e4bb6=_0x4a42b1;_0xa5319d=0xc8;}else{_0xa5319d=0xce;}_0x2ddff0[_0xc37b('0x1d')](_0xa5319d);return _0x2ddff0[_0xc37b('0x22')](_0xc37b('0x23'),_0xdf455e+'-'+_0x5e4bb6+'/'+_0x4a42b1)['json'](_0x288569);}return null;};}function patchUpdates(_0x11612a){return function(_0x4683fe){try{jsonpatch[_0xc37b('0x24')](_0x4683fe,_0x11612a,!![]);}catch(_0xa29a89){return BPromise[_0xc37b('0x25')](_0xa29a89);}return _0x4683fe[_0xc37b('0x26')]();};}function saveUpdates(_0x2ce2ff,_0x1f40c7){return function(_0x5357a0){if(_0x5357a0){return _0x5357a0[_0xc37b('0x27')](_0x2ce2ff)[_0xc37b('0x28')](function(_0x5068a9){return _0x5068a9;});}return null;};}function removeEntity(_0x3d8f03,_0x4b65d8){return function(_0x58a6f0){if(_0x58a6f0){return _0x58a6f0[_0xc37b('0x29')]()[_0xc37b('0x28')](function(){_0x3d8f03[_0xc37b('0x1d')](0xcc)[_0xc37b('0x1e')]();});}};}function handleEntityNotFound(_0x4d7d47,_0x3d1118){return function(_0x159c73){if(!_0x159c73){_0x4d7d47[_0xc37b('0x1c')](0x194);}return _0x159c73;};}function handleError(_0x34f69a,_0x5be868){_0x5be868=_0x5be868||0x1f4;return function(_0x444fbe){logger['error'](_0x444fbe[_0xc37b('0x2a')]);if(_0x444fbe['name']){delete _0x444fbe[_0xc37b('0x2b')];}_0x34f69a[_0xc37b('0x1d')](_0x5be868)[_0xc37b('0x2c')](_0x444fbe);};}exports[_0xc37b('0x2d')]=function(_0x461de2,_0x242ced){var _0x3b1675={},_0x5e1307={},_0x59c024={'count':0x0,'rows':[]};var _0x123722=_['map'](db['Dynamics365Field'][_0xc37b('0x2e')],function(_0x1e6fec){return{'name':_0x1e6fec[_0xc37b('0x2f')],'type':_0x1e6fec[_0xc37b('0x30')]['key']};});_0x5e1307[_0xc37b('0x31')]=_[_0xc37b('0x32')](_0x123722,_0xc37b('0x2b'));_0x5e1307['query']=_[_0xc37b('0x33')](_0x461de2[_0xc37b('0x34')]);_0x5e1307[_0xc37b('0x35')]=_[_0xc37b('0x36')](_0x5e1307['model'],_0x5e1307[_0xc37b('0x34')]);_0x3b1675[_0xc37b('0x37')]=_['intersection'](_0x5e1307[_0xc37b('0x31')],qs[_0xc37b('0x38')](_0x461de2[_0xc37b('0x34')]['fields']));_0x3b1675['attributes']=_0x3b1675[_0xc37b('0x37')][_0xc37b('0x39')]?_0x3b1675[_0xc37b('0x37')]:_0x5e1307[_0xc37b('0x31')];if(!_0x461de2[_0xc37b('0x34')]['hasOwnProperty']('nolimit')){_0x3b1675['limit']=qs[_0xc37b('0x1f')](_0x461de2['query']['limit']);_0x3b1675['offset']=qs[_0xc37b('0x21')](_0x461de2[_0xc37b('0x34')]['offset']);}_0x3b1675[_0xc37b('0x3a')]=qs[_0xc37b('0x3b')](_0x461de2[_0xc37b('0x34')]['sort']);_0x3b1675[_0xc37b('0x3c')]=qs['filters'](_[_0xc37b('0x3d')](_0x461de2[_0xc37b('0x34')],_0x5e1307[_0xc37b('0x35')]),_0x123722);if(_0x461de2[_0xc37b('0x34')]['filter']){_0x3b1675[_0xc37b('0x3c')]=_[_0xc37b('0x3e')](_0x3b1675['where'],{'$or':_[_0xc37b('0x32')](_0x123722,function(_0x29f18c){if(_0x29f18c[_0xc37b('0x30')]!==_0xc37b('0x3f')){var _0x258105={};_0x258105[_0x29f18c[_0xc37b('0x2b')]]={'$like':'%'+_0x461de2[_0xc37b('0x34')][_0xc37b('0x40')]+'%'};return _0x258105;}})});}_0x3b1675=_[_0xc37b('0x3e')]({},_0x3b1675,_0x461de2['options']);var _0x23d7e4={'where':_0x3b1675[_0xc37b('0x3c')]};return db[_0xc37b('0x41')][_0xc37b('0x20')](_0x23d7e4)[_0xc37b('0x28')](function(_0x13fabf){_0x59c024[_0xc37b('0x20')]=_0x13fabf;if(_0x461de2[_0xc37b('0x34')]['includeAll']){_0x3b1675[_0xc37b('0x42')]=[{'all':!![]}];}return db[_0xc37b('0x41')]['findAll'](_0x3b1675);})[_0xc37b('0x28')](function(_0x4a07ac){_0x59c024[_0xc37b('0x43')]=_0x4a07ac;return _0x59c024;})['then'](respondWithFilteredResult(_0x242ced,_0x3b1675))[_0xc37b('0x44')](handleError(_0x242ced,null));};exports[_0xc37b('0x45')]=function(_0x3ef296,_0xeec854){var _0x23e5ff={'raw':!![],'where':{'id':_0x3ef296[_0xc37b('0x46')]['id']}},_0x26de51={};_0x26de51[_0xc37b('0x31')]=_['keys'](db['Dynamics365Field'][_0xc37b('0x2e')]);_0x26de51[_0xc37b('0x34')]=_[_0xc37b('0x33')](_0x3ef296[_0xc37b('0x34')]);_0x26de51[_0xc37b('0x35')]=_[_0xc37b('0x36')](_0x26de51['model'],_0x26de51[_0xc37b('0x34')]);_0x23e5ff[_0xc37b('0x37')]=_[_0xc37b('0x36')](_0x26de51[_0xc37b('0x31')],qs[_0xc37b('0x38')](_0x3ef296['query'][_0xc37b('0x38')]));_0x23e5ff[_0xc37b('0x37')]=_0x23e5ff[_0xc37b('0x37')][_0xc37b('0x39')]?_0x23e5ff[_0xc37b('0x37')]:_0x26de51[_0xc37b('0x31')];if(_0x3ef296[_0xc37b('0x34')][_0xc37b('0x47')]){_0x23e5ff[_0xc37b('0x42')]=[{'all':!![]}];}_0x23e5ff=_[_0xc37b('0x3e')]({},_0x23e5ff,_0x3ef296[_0xc37b('0x48')]);return db[_0xc37b('0x41')][_0xc37b('0x49')](_0x23e5ff)[_0xc37b('0x28')](handleEntityNotFound(_0xeec854,null))[_0xc37b('0x28')](respondWithResult(_0xeec854,null))[_0xc37b('0x44')](handleError(_0xeec854,null));};exports['create']=function(_0xf3d981,_0x5364aa){return db[_0xc37b('0x41')][_0xc37b('0x4a')](_0xf3d981[_0xc37b('0x4b')],{})['then'](respondWithResult(_0x5364aa,0xc9))[_0xc37b('0x44')](handleError(_0x5364aa,null));};exports['update']=function(_0x36a110,_0x11e1a2){if(_0x36a110['body']['id']){delete _0x36a110[_0xc37b('0x4b')]['id'];}return db['Dynamics365Field'][_0xc37b('0x49')]({'where':{'id':_0x36a110[_0xc37b('0x46')]['id']}})['then'](handleEntityNotFound(_0x11e1a2,null))['then'](saveUpdates(_0x36a110['body'],null))[_0xc37b('0x28')](respondWithResult(_0x11e1a2,null))['catch'](handleError(_0x11e1a2,null));};exports[_0xc37b('0x29')]=function(_0x3c9ff2,_0x208f12){return db['Dynamics365Field'][_0xc37b('0x49')]({'where':{'id':_0x3c9ff2[_0xc37b('0x46')]['id']}})[_0xc37b('0x28')](handleEntityNotFound(_0x208f12,null))[_0xc37b('0x28')](removeEntity(_0x208f12,null))[_0xc37b('0x44')](handleError(_0x208f12,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index dcf4c77..db86c1a 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.model.js +++ b/server/api/intDynamics365Field/intDynamics365Field.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6cd=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x1f9ace,_0x694975){var _0x2c348d=function(_0x4c6b42){while(--_0x4c6b42){_0x1f9ace['push'](_0x1f9ace['shift']());}};_0x2c348d(++_0x694975);}(_0xf6cd,0x13b));var _0xdf6c=function(_0x4f27f8,_0x3ce31f){_0x4f27f8=_0x4f27f8-0x0;var _0x2d469b=_0xf6cd[_0x4f27f8];return _0x2d469b;};'use strict';var _=require(_0xdf6c('0x0'));var util=require('util');var logger=require(_0xdf6c('0x1'))(_0xdf6c('0x2'));var moment=require(_0xdf6c('0x3'));var BPromise=require(_0xdf6c('0x4'));var rp=require(_0xdf6c('0x5'));var fs=require('fs');var path=require(_0xdf6c('0x6'));var rimraf=require(_0xdf6c('0x7'));var config=require(_0xdf6c('0x8'));var attributes=require(_0xdf6c('0x9'));module['exports']=function(_0x4fa729,_0xc75e2e){return _0x4fa729['define'](_0xdf6c('0xa'),attributes,{'tableName':_0xdf6c('0xb'),'paranoid':![],'indexes':[{'name':_0xdf6c('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2149=['Dynamics365Field','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa65cc,_0x3ffcd5){var _0x22a2d4=function(_0x17fe94){while(--_0x17fe94){_0xa65cc['push'](_0xa65cc['shift']());}};_0x22a2d4(++_0x3ffcd5);}(_0x2149,0x148));var _0x9214=function(_0x53524f,_0x16d8ba){_0x53524f=_0x53524f-0x0;var _0x47b996=_0x2149[_0x53524f];return _0x47b996;};'use strict';var _=require(_0x9214('0x0'));var util=require(_0x9214('0x1'));var logger=require(_0x9214('0x2'))(_0x9214('0x3'));var moment=require(_0x9214('0x4'));var BPromise=require(_0x9214('0x5'));var rp=require(_0x9214('0x6'));var fs=require('fs');var path=require(_0x9214('0x7'));var rimraf=require(_0x9214('0x8'));var config=require(_0x9214('0x9'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x4cf875,_0x3b960c){return _0x4cf875['define'](_0x9214('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x9214('0xb'),'fields':[_0x9214('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index b3d20ff..1b67166 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.rpc.js +++ b/server/api/intDynamics365Field/intDynamics365Field.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9db1=['catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','result'];(function(_0x23f4cc,_0x4b6d1a){var _0x8d3d1a=function(_0xec5fd1){while(--_0xec5fd1){_0x23f4cc['push'](_0x23f4cc['shift']());}};_0x8d3d1a(++_0x4b6d1a);}(_0x9db1,0x1c9));var _0x19db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9db1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x19db('0x0'));var moment=require(_0x19db('0x1'));var BPromise=require(_0x19db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19db('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x19db('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x19db('0x5'));var jayson=require(_0x19db('0x6'));var client=jayson[_0x19db('0x7')][_0x19db('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21a668,_0x3b307c,_0x5bac82){return new BPromise(function(_0x3facfa,_0x18a0cb){return client['request'](_0x21a668,_0x5bac82)[_0x19db('0x9')](function(_0x50b39d){logger[_0x19db('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x3b307c,'request\x20sent');logger[_0x19db('0xb')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3b307c,_0x19db('0xc'),JSON[_0x19db('0xd')](_0x50b39d));if(_0x50b39d[_0x19db('0xe')]){if(_0x50b39d[_0x19db('0xe')]['code']===0x1f4){logger[_0x19db('0xe')](_0x19db('0xf'),_0x3b307c,_0x50b39d[_0x19db('0xe')][_0x19db('0x10')]);return _0x18a0cb(_0x50b39d[_0x19db('0xe')][_0x19db('0x10')]);}logger[_0x19db('0xe')](_0x19db('0xf'),_0x3b307c,_0x50b39d[_0x19db('0xe')]['message']);return _0x3facfa(_0x50b39d['error']['message']);}else{logger['info'](_0x19db('0xf'),_0x3b307c,_0x19db('0xc'));_0x3facfa(_0x50b39d[_0x19db('0x11')][_0x19db('0x10')]);}})[_0x19db('0x12')](function(_0x1000fd){logger[_0x19db('0xe')](_0x19db('0xf'),_0x3b307c,_0x1000fd);_0x18a0cb(_0x1000fd);});});} \ No newline at end of file +var _0x582a=['../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x1ca247,_0x2f501c){var _0x56c711=function(_0x3a5f4d){while(--_0x3a5f4d){_0x1ca247['push'](_0x1ca247['shift']());}};_0x56c711(++_0x2f501c);}(_0x582a,0x198));var _0xa582=function(_0xca5e7d,_0xd2bf69){_0xca5e7d=_0xca5e7d-0x0;var _0x4fa0cf=_0x582a[_0xca5e7d];return _0x4fa0cf;};'use strict';var _=require('lodash');var util=require(_0xa582('0x0'));var moment=require('moment');var BPromise=require(_0xa582('0x1'));var rs=require(_0xa582('0x2'));var fs=require('fs');var Redis=require(_0xa582('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa582('0x4'))(_0xa582('0x5'));var config=require(_0xa582('0x6'));var jayson=require(_0xa582('0x7'));var client=jayson[_0xa582('0x8')][_0xa582('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x186209,_0x7a086c,_0x233ab1){return new BPromise(function(_0x388af8,_0x13827e){return client[_0xa582('0xa')](_0x186209,_0x233ab1)[_0xa582('0xb')](function(_0x3f8edf){logger[_0xa582('0xc')](_0xa582('0xd'),_0x7a086c,_0xa582('0xe'));logger[_0xa582('0xf')](_0xa582('0x10'),_0x7a086c,_0xa582('0xe'),JSON[_0xa582('0x11')](_0x3f8edf));if(_0x3f8edf[_0xa582('0x12')]){if(_0x3f8edf[_0xa582('0x12')][_0xa582('0x13')]===0x1f4){logger[_0xa582('0x12')](_0xa582('0xd'),_0x7a086c,_0x3f8edf[_0xa582('0x12')]['message']);return _0x13827e(_0x3f8edf[_0xa582('0x12')][_0xa582('0x14')]);}logger[_0xa582('0x12')](_0xa582('0xd'),_0x7a086c,_0x3f8edf[_0xa582('0x12')]['message']);return _0x388af8(_0x3f8edf[_0xa582('0x12')][_0xa582('0x14')]);}else{logger[_0xa582('0xc')](_0xa582('0xd'),_0x7a086c,'request\x20sent');_0x388af8(_0x3f8edf[_0xa582('0x15')][_0xa582('0x14')]);}})[_0xa582('0x16')](function(_0x1e7bc8){logger['error'](_0xa582('0xd'),_0x7a086c,_0x1e7bc8);_0x13827e(_0x1e7bc8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 628e790..e434942 100644 --- a/server/api/intFreshdeskAccount/index.js +++ b/server/api/intFreshdeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e28=['destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','/:id/configurations','getConfigurations','get','getFields','post','create','addConfiguration','put','update','delete','/:id'];(function(_0x47041d,_0x42153f){var _0x5022bd=function(_0x1dbb9a){while(--_0x1dbb9a){_0x47041d['push'](_0x47041d['shift']());}};_0x5022bd(++_0x42153f);}(_0x3e28,0x14c));var _0x83e2=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x3e28[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0x83e2('0x0'));var util=require(_0x83e2('0x1'));var path=require('path');var timeout=require(_0x83e2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x83e2('0x3'));var interaction=require(_0x83e2('0x4'));var config=require(_0x83e2('0x5'));var controller=require(_0x83e2('0x6'));router['get']('/',auth[_0x83e2('0x7')](),controller[_0x83e2('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x83e2('0x9'),auth[_0x83e2('0x7')](),controller[_0x83e2('0xa')]);router[_0x83e2('0xb')]('/:id/fields',auth[_0x83e2('0x7')](),controller[_0x83e2('0xc')]);router[_0x83e2('0xd')]('/',auth[_0x83e2('0x7')](),controller[_0x83e2('0xe')]);router[_0x83e2('0xd')](_0x83e2('0x9'),auth[_0x83e2('0x7')](),controller[_0x83e2('0xf')]);router[_0x83e2('0x10')]('/:id',auth[_0x83e2('0x7')](),controller[_0x83e2('0x11')]);router[_0x83e2('0x12')](_0x83e2('0x13'),auth[_0x83e2('0x7')](),controller[_0x83e2('0x14')]);module[_0x83e2('0x15')]=router; \ No newline at end of file +var _0xe0c1=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','destroy','exports'];(function(_0x20f3bc,_0x34c2fd){var _0x2e0502=function(_0x14dd1a){while(--_0x14dd1a){_0x20f3bc['push'](_0x20f3bc['shift']());}};_0x2e0502(++_0x34c2fd);}(_0xe0c1,0x84));var _0x1e0c=function(_0x5b7282,_0x277d44){_0x5b7282=_0x5b7282-0x0;var _0x250a1e=_0xe0c1[_0x5b7282];return _0x250a1e;};'use strict';var multer=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var path=require('path');var timeout=require(_0x1e0c('0x2'));var express=require('express');var router=express[_0x1e0c('0x3')]();var fs_extra=require(_0x1e0c('0x4'));var auth=require(_0x1e0c('0x5'));var interaction=require(_0x1e0c('0x6'));var config=require(_0x1e0c('0x7'));var controller=require(_0x1e0c('0x8'));router['get']('/',auth[_0x1e0c('0x9')](),controller[_0x1e0c('0xa')]);router['get'](_0x1e0c('0xb'),auth['isAuthenticated'](),controller[_0x1e0c('0xc')]);router['get'](_0x1e0c('0xd'),auth[_0x1e0c('0x9')](),controller[_0x1e0c('0xe')]);router['get']('/:id/fields',auth[_0x1e0c('0x9')](),controller[_0x1e0c('0xf')]);router[_0x1e0c('0x10')]('/',auth[_0x1e0c('0x9')](),controller[_0x1e0c('0x11')]);router['post'](_0x1e0c('0xd'),auth[_0x1e0c('0x9')](),controller['addConfiguration']);router[_0x1e0c('0x12')]('/:id',auth[_0x1e0c('0x9')](),controller[_0x1e0c('0x13')]);router['delete'](_0x1e0c('0xb'),auth[_0x1e0c('0x9')](),controller[_0x1e0c('0x14')]);module[_0x1e0c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 33f8394..f6ac097 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['remoteUri','sequelize','STRING'];(function(_0x49e7dd,_0x7d68e7){var _0x47c0db=function(_0x566994){while(--_0x566994){_0x49e7dd['push'](_0x49e7dd['shift']());}};_0x47c0db(++_0x7d68e7);}(_0xb10b,0x12a));var _0xbb10=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xb10b[_0x8af54b];return _0x27d8f0;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize[_0xbb10('0x1')]},'username':{'type':Sequelize[_0xbb10('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xbb10('0x1')]},'remoteUri':{'type':Sequelize[_0xbb10('0x1')],'unique':_0xbb10('0x2')},'serverUrl':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4bd3=['sequelize','STRING','remoteUri'];(function(_0x24a2cc,_0x455e1f){var _0x1cf0ad=function(_0x3ad71b){while(--_0x3ad71b){_0x24a2cc['push'](_0x24a2cc['shift']());}};_0x1cf0ad(++_0x455e1f);}(_0x4bd3,0x174));var _0x34bd=function(_0x307617,_0x3d0a23){_0x307617=_0x307617-0x0;var _0x1a005b=_0x4bd3[_0x307617];return _0x1a005b;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x34bd('0x1')],'unique':_0x34bd('0x2')},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index e1df4d8..e04c080 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1aa=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','FreshdeskAccount','catch','params','includeAll','find','create','body','update','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_dropdown','label','capitalize','test','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x14e27a,_0x3b4136){var _0x288688=function(_0x3d7ab1){while(--_0x3d7ab1){_0x14e27a['push'](_0x14e27a['shift']());}};_0x288688(++_0x3b4136);}(_0xa1aa,0x19b));var _0xaa1a=function(_0xfe634a,_0x3a52d6){_0xfe634a=_0xfe634a-0x0;var _0x169b5b=_0xa1aa[_0xfe634a];return _0x169b5b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa1a('0x0'));var zipdir=require(_0xaa1a('0x1'));var jsonpatch=require(_0xaa1a('0x2'));var rp=require(_0xaa1a('0x3'));var moment=require(_0xaa1a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa1a('0x5'));var path=require(_0xaa1a('0x6'));var sox=require('sox');var csv=require(_0xaa1a('0x7'));var ejs=require(_0xaa1a('0x8'));var fs=require('fs');var fs_extra=require(_0xaa1a('0x9'));var _=require('lodash');var squel=require(_0xaa1a('0xa'));var crypto=require('crypto');var jsforce=require(_0xaa1a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaa1a('0x7'));var querystring=require(_0xaa1a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa1a('0xd'));var qs=require(_0xaa1a('0xe'));var as=require(_0xaa1a('0xf'));var hardwareService=require(_0xaa1a('0x10'));var logger=require('../../config/logger')(_0xaa1a('0x11'));var utils=require(_0xaa1a('0x12'));var config=require(_0xaa1a('0x13'));var licenseUtil=require(_0xaa1a('0x14'));var db=require(_0xaa1a('0x15'))['db'];var integrations=require(_0xaa1a('0x16'));function respondWithStatusCode(_0x25ae41,_0x2f018d){_0x2f018d=_0x2f018d||0xcc;return function(_0x25aea6){if(_0x25aea6){return _0x25ae41[_0xaa1a('0x17')](_0x2f018d);}return _0x25ae41['status'](_0x2f018d)['end']();};}function respondWithResult(_0x38715a,_0x3a577f){_0x3a577f=_0x3a577f||0xc8;return function(_0x268f91){if(_0x268f91){return _0x38715a[_0xaa1a('0x18')](_0x3a577f)[_0xaa1a('0x19')](_0x268f91);}};}function respondWithFilteredResult(_0x5da087,_0x90ef70){return function(_0x480a27){if(_0x480a27){var _0x12153c=typeof _0x90ef70[_0xaa1a('0x1a')]===_0xaa1a('0x1b')&&typeof _0x90ef70[_0xaa1a('0x1c')]==='undefined';var _0x521a8e=_0x480a27[_0xaa1a('0x1d')];var _0xcb3609=_0x12153c?0x0:_0x90ef70['offset'];var _0x33f564=_0x12153c?_0x480a27[_0xaa1a('0x1d')]:_0x90ef70[_0xaa1a('0x1a')]+_0x90ef70[_0xaa1a('0x1c')];var _0x2fe366;if(_0x33f564>=_0x521a8e){_0x33f564=_0x521a8e;_0x2fe366=0xc8;}else{_0x2fe366=0xce;}_0x5da087[_0xaa1a('0x18')](_0x2fe366);return _0x5da087['set'](_0xaa1a('0x1e'),_0xcb3609+'-'+_0x33f564+'/'+_0x521a8e)[_0xaa1a('0x19')](_0x480a27);}return null;};}function patchUpdates(_0x8586aa){return function(_0x3298ed){try{jsonpatch[_0xaa1a('0x1f')](_0x3298ed,_0x8586aa,!![]);}catch(_0x436f94){return BPromise[_0xaa1a('0x20')](_0x436f94);}return _0x3298ed['save']();};}function saveUpdates(_0xa32c54,_0x282f07){return function(_0x1ac174){if(_0x1ac174){return _0x1ac174['update'](_0xa32c54)[_0xaa1a('0x21')](function(_0x15b366){return _0x15b366;});}return null;};}function removeEntity(_0x583c90,_0x4accdf){return function(_0x64fc15){if(_0x64fc15){return _0x64fc15[_0xaa1a('0x22')]()[_0xaa1a('0x21')](function(){_0x583c90[_0xaa1a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a30d0,_0x32f406){return function(_0x5c326e){if(!_0x5c326e){_0x2a30d0[_0xaa1a('0x17')](0x194);}return _0x5c326e;};}function handleError(_0x21144c,_0x29e219){_0x29e219=_0x29e219||0x1f4;return function(_0x5d7191){logger[_0xaa1a('0x23')](_0x5d7191[_0xaa1a('0x24')]);if(_0x5d7191[_0xaa1a('0x25')]){delete _0x5d7191[_0xaa1a('0x25')];}_0x21144c[_0xaa1a('0x18')](_0x29e219)[_0xaa1a('0x26')](_0x5d7191);};}exports[_0xaa1a('0x27')]=function(_0x5291be,_0x4c495f){var _0x5c42d2={},_0xea95b0={},_0x37be5c={'count':0x0,'rows':[]};var _0x29271b=_[_0xaa1a('0x28')](db['FreshdeskAccount'][_0xaa1a('0x29')],function(_0x22ba1d){return{'name':_0x22ba1d[_0xaa1a('0x2a')],'type':_0x22ba1d[_0xaa1a('0x2b')][_0xaa1a('0x2c')]};});_0xea95b0[_0xaa1a('0x2d')]=_[_0xaa1a('0x28')](_0x29271b,_0xaa1a('0x25'));_0xea95b0[_0xaa1a('0x2e')]=_[_0xaa1a('0x2f')](_0x5291be[_0xaa1a('0x2e')]);_0xea95b0[_0xaa1a('0x30')]=_[_0xaa1a('0x31')](_0xea95b0[_0xaa1a('0x2d')],_0xea95b0[_0xaa1a('0x2e')]);_0x5c42d2['attributes']=_['intersection'](_0xea95b0[_0xaa1a('0x2d')],qs['fields'](_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0x5c42d2[_0xaa1a('0x33')]=_0x5c42d2[_0xaa1a('0x33')][_0xaa1a('0x34')]?_0x5c42d2[_0xaa1a('0x33')]:_0xea95b0['model'];if(!_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x35')](_0xaa1a('0x36'))){_0x5c42d2[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x1c')]);_0x5c42d2[_0xaa1a('0x1a')]=qs['offset'](_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x1a')]);}_0x5c42d2[_0xaa1a('0x37')]=qs[_0xaa1a('0x38')](_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x38')]);_0x5c42d2[_0xaa1a('0x39')]=qs[_0xaa1a('0x30')](_[_0xaa1a('0x3a')](_0x5291be[_0xaa1a('0x2e')],_0xea95b0[_0xaa1a('0x30')]),_0x29271b);if(_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x3b')]){_0x5c42d2[_0xaa1a('0x39')]=_[_0xaa1a('0x3c')](_0x5c42d2[_0xaa1a('0x39')],{'$or':_['map'](_0x29271b,function(_0x578325){if(_0x578325[_0xaa1a('0x2b')]!==_0xaa1a('0x3d')){var _0x395044={};_0x395044[_0x578325[_0xaa1a('0x25')]]={'$like':'%'+_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x3b')]+'%'};return _0x395044;}})});}_0x5c42d2=_['merge']({},_0x5c42d2,_0x5291be[_0xaa1a('0x3e')]);var _0x529e82={'where':_0x5c42d2[_0xaa1a('0x39')]};return db['FreshdeskAccount'][_0xaa1a('0x1d')](_0x529e82)[_0xaa1a('0x21')](function(_0x838e30){_0x37be5c[_0xaa1a('0x1d')]=_0x838e30;if(_0x5291be['query']['includeAll']){_0x5c42d2[_0xaa1a('0x3f')]=[{'all':!![]}];}return db[_0xaa1a('0x40')]['findAll'](_0x5c42d2);})[_0xaa1a('0x21')](function(_0xe3a924){_0x37be5c['rows']=_0xe3a924;return _0x37be5c;})['then'](respondWithFilteredResult(_0x4c495f,_0x5c42d2))[_0xaa1a('0x41')](handleError(_0x4c495f,null));};exports['show']=function(_0x27f0ff,_0x252b32){var _0x30011d={'raw':![],'where':{'id':_0x27f0ff[_0xaa1a('0x42')]['id']}},_0x10d387={};_0x10d387[_0xaa1a('0x2d')]=_['keys'](db['FreshdeskAccount']['rawAttributes']);_0x10d387['query']=_[_0xaa1a('0x2f')](_0x27f0ff['query']);_0x10d387[_0xaa1a('0x30')]=_[_0xaa1a('0x31')](_0x10d387[_0xaa1a('0x2d')],_0x10d387[_0xaa1a('0x2e')]);_0x30011d[_0xaa1a('0x33')]=_[_0xaa1a('0x31')](_0x10d387[_0xaa1a('0x2d')],qs[_0xaa1a('0x32')](_0x27f0ff[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0x30011d[_0xaa1a('0x33')]=_0x30011d['attributes'][_0xaa1a('0x34')]?_0x30011d[_0xaa1a('0x33')]:_0x10d387[_0xaa1a('0x2d')];if(_0x27f0ff['query'][_0xaa1a('0x43')]){_0x30011d['include']=[{'all':!![]}];}_0x30011d=_[_0xaa1a('0x3c')]({},_0x30011d,_0x27f0ff[_0xaa1a('0x3e')]);return db[_0xaa1a('0x40')][_0xaa1a('0x44')](_0x30011d)['then'](handleEntityNotFound(_0x252b32,null))[_0xaa1a('0x21')](respondWithResult(_0x252b32,null))[_0xaa1a('0x41')](handleError(_0x252b32,null));};exports[_0xaa1a('0x45')]=function(_0x37eea0,_0x265c37){return db[_0xaa1a('0x40')][_0xaa1a('0x45')](_0x37eea0[_0xaa1a('0x46')],{})[_0xaa1a('0x21')](respondWithResult(_0x265c37,0xc9))['catch'](handleError(_0x265c37,null));};exports[_0xaa1a('0x47')]=function(_0x4327b9,_0x13f32e){if(_0x4327b9[_0xaa1a('0x46')]['id']){delete _0x4327b9[_0xaa1a('0x46')]['id'];}return db[_0xaa1a('0x40')][_0xaa1a('0x44')]({'where':{'id':_0x4327b9[_0xaa1a('0x42')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x13f32e,null))[_0xaa1a('0x21')](saveUpdates(_0x4327b9[_0xaa1a('0x46')],null))[_0xaa1a('0x21')](respondWithResult(_0x13f32e,null))[_0xaa1a('0x41')](handleError(_0x13f32e,null));};exports[_0xaa1a('0x22')]=function(_0x4556de,_0x42c5e5){return db[_0xaa1a('0x40')][_0xaa1a('0x44')]({'where':{'id':_0x4556de['params']['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x42c5e5,null))[_0xaa1a('0x21')](removeEntity(_0x42c5e5,null))[_0xaa1a('0x41')](handleError(_0x42c5e5,null));};exports['getConfigurations']=function(_0x56a465,_0x6cb05d,_0x5a2aa2){var _0xe34753={};var _0x509774={};var _0x9d5c46;var _0x5bad29;return db[_0xaa1a('0x40')][_0xaa1a('0x48')]({'where':{'id':_0x56a465[_0xaa1a('0x42')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x6cb05d,null))[_0xaa1a('0x21')](function(_0x4fc334){if(_0x4fc334){_0x9d5c46=_0x4fc334;_0x509774['model']=_['keys'](db[_0xaa1a('0x49')][_0xaa1a('0x29')]);_0x509774[_0xaa1a('0x2e')]=_['keys'](_0x56a465[_0xaa1a('0x2e')]);_0x509774[_0xaa1a('0x30')]=_['intersection'](_0x509774['model'],_0x509774[_0xaa1a('0x2e')]);_0xe34753[_0xaa1a('0x33')]=_[_0xaa1a('0x31')](_0x509774[_0xaa1a('0x2d')],qs[_0xaa1a('0x32')](_0x56a465[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0xe34753[_0xaa1a('0x33')]=_0xe34753[_0xaa1a('0x33')][_0xaa1a('0x34')]?_0xe34753[_0xaa1a('0x33')]:_0x509774[_0xaa1a('0x2d')];_0xe34753['order']=qs[_0xaa1a('0x38')](_0x56a465['query'][_0xaa1a('0x38')]);_0xe34753[_0xaa1a('0x39')]=qs['filters'](_['pick'](_0x56a465[_0xaa1a('0x2e')],_0x509774['filters']));if(_0x56a465[_0xaa1a('0x2e')][_0xaa1a('0x3b')]){_0xe34753[_0xaa1a('0x39')]=_[_0xaa1a('0x3c')](_0xe34753[_0xaa1a('0x39')],{'$or':_[_0xaa1a('0x28')](_0xe34753[_0xaa1a('0x33')],function(_0x37c8fd){var _0x544727={};_0x544727[_0x37c8fd]={'$like':'%'+_0x56a465[_0xaa1a('0x2e')][_0xaa1a('0x3b')]+'%'};return _0x544727;})});}_0xe34753=_['merge']({},_0xe34753,_0x56a465[_0xaa1a('0x3e')]);return _0x9d5c46[_0xaa1a('0x4a')](_0xe34753);}})[_0xaa1a('0x21')](function(_0x27aa45){if(_0x27aa45){_0x5bad29=_0x27aa45[_0xaa1a('0x34')];if(!_0x56a465[_0xaa1a('0x2e')]['hasOwnProperty'](_0xaa1a('0x36'))){_0xe34753[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x56a465['query']['limit']);_0xe34753[_0xaa1a('0x1a')]=qs[_0xaa1a('0x1a')](_0x56a465[_0xaa1a('0x2e')]['offset']);}return _0x9d5c46['getConfigurations'](_0xe34753);}})[_0xaa1a('0x21')](function(_0x37f941){if(_0x37f941){return _0x37f941?{'count':_0x5bad29,'rows':_0x37f941}:null;}})['then'](respondWithResult(_0x6cb05d,null))[_0xaa1a('0x41')](handleError(_0x6cb05d,null));};exports[_0xaa1a('0x4b')]=function(_0x3053ae,_0x1a053e,_0x2b4d8e){if(_0x3053ae[_0xaa1a('0x46')]['id']){delete _0x3053ae['body']['id'];}return db[_0xaa1a('0x40')][_0xaa1a('0x48')]({'where':{'id':_0x3053ae[_0xaa1a('0x42')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x1a053e,null))[_0xaa1a('0x21')](function(_0x40d6a9){if(_0x40d6a9){_0x3053ae[_0xaa1a('0x46')]['AccountId']=_0x40d6a9['id'];_0x3053ae[_0xaa1a('0x46')]['Subjects']=integrations[_0xaa1a('0x4c')](_0x3053ae[_0xaa1a('0x46')]['channel'],_0x3053ae[_0xaa1a('0x46')][_0xaa1a('0x2b')]);_0x3053ae[_0xaa1a('0x46')][_0xaa1a('0x4d')]=integrations[_0xaa1a('0x4e')](_0x3053ae[_0xaa1a('0x46')][_0xaa1a('0x4f')],_0x3053ae[_0xaa1a('0x46')][_0xaa1a('0x2b')]);return db[_0xaa1a('0x49')][_0xaa1a('0x45')](_0x3053ae[_0xaa1a('0x46')],{'include':[{'model':db[_0xaa1a('0x50')],'as':_0xaa1a('0x51')},{'model':db[_0xaa1a('0x50')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1a053e,null))[_0xaa1a('0x41')](handleError(_0x1a053e,null));};exports[_0xaa1a('0x52')]=function(_0x2d038c,_0x3f48b2,_0xc8ec8c){var _0x17378b='';return db[_0xaa1a('0x40')][_0xaa1a('0x48')]({'where':{'id':_0x2d038c['params']['id']},'attributes':['id',_0xaa1a('0x53'),_0xaa1a('0x54')]})['then'](handleEntityNotFound(_0x3f48b2,null))['then'](function(_0x2dbc56){if(_0x2dbc56){_0x17378b=_0x2dbc56[_0xaa1a('0x53')];var _0x424ec8=_0x17378b[_0xaa1a('0x55')](-0x1);if(_0x424ec8==='/'){_0x17378b=_0x17378b[_0xaa1a('0x56')](0x0,_0x17378b[_0xaa1a('0x57')](_0x424ec8));}return rp({'method':_0xaa1a('0x58'),'uri':util[_0xaa1a('0x59')](_0xaa1a('0x5a'),_0x17378b,_0xaa1a('0x5b')),'headers':{'Authorization':util[_0xaa1a('0x59')](_0xaa1a('0x5c'),new Buffer(util[_0xaa1a('0x59')](_0xaa1a('0x5d'),_0x2dbc56[_0xaa1a('0x54')]))[_0xaa1a('0x5e')](_0xaa1a('0x5f')))},'json':!![]});}})[_0xaa1a('0x21')](function(_0x1ae2c3){if(_0x1ae2c3){var _0x5ef63e=[_0xaa1a('0x60'),_0xaa1a('0x61'),_0xaa1a('0x62'),_0xaa1a('0x63'),'status',_0xaa1a('0x64'),_0xaa1a('0x65'),_0xaa1a('0x66'),_0xaa1a('0x67'),_0xaa1a('0x65'),_0xaa1a('0x68')];_[_0xaa1a('0x69')](_0x1ae2c3,function(_0x3a1de4){return _0x5ef63e[_0xaa1a('0x6a')](_0x3a1de4['name'])||!_0x3a1de4[_0xaa1a('0x6b')]&&_0x3a1de4[_0xaa1a('0x2b')]!=='custom_text'&&_0x3a1de4['type']!==_0xaa1a('0x6c');});return{'count':_0x1ae2c3[_0xaa1a('0x34')],'rows':_[_0xaa1a('0x28')](_0x1ae2c3,function(_0x3dfdfd){return{'id':_0x3dfdfd[_0xaa1a('0x25')],'name':_0x3dfdfd[_0xaa1a('0x6d')],'custom':!_0x3dfdfd[_0xaa1a('0x6b')],'options':_0x3dfdfd['choices']?_[_0xaa1a('0x28')](_0x3dfdfd['choices'],function(_0x1c7fbb){return{'name':_[_0xaa1a('0x6e')](_0x1c7fbb),'value':_0x1c7fbb};}):[]};})};}})['then'](respondWithResult(_0x3f48b2,null))['catch'](function(_0x508d8e){var _0x1c2286=_0x2d038c['query'][_0xaa1a('0x6f')]?0x1f4:_0x508d8e['statusCode']||0x1f4;logger[_0xaa1a('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xaa1a('0x52'),_0x1c2286,JSON[_0xaa1a('0x70')](_0x508d8e));delete _0x508d8e[_0xaa1a('0x25')];if(_0x1c2286===0x191){_0x1c2286=0x190;}_0x3f48b2['status'](_0x1c2286)['send'](_0x2d038c[_0xaa1a('0x2e')][_0xaa1a('0x6f')]?{'message':_0xaa1a('0x71'),'statusCode':_0x508d8e[_0xaa1a('0x72')]}:_0x508d8e);});}; \ No newline at end of file +var _0xf7b4=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshdeskAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','merge','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','pick','nolimit','addConfiguration','AccountId','channel','Descriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','agent','description','priority','source','ticket_type','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2d5594,_0x420501){var _0x2c1ea2=function(_0x26847e){while(--_0x26847e){_0x2d5594['push'](_0x2d5594['shift']());}};_0x2c1ea2(++_0x420501);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4a1e96,_0x143e6b){_0x4a1e96=_0x4a1e96-0x0;var _0x5acea9=_0xf7b4[_0x4a1e96];return _0x5acea9;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4f7b('0x17'));function respondWithStatusCode(_0x2e8dd9,_0x3c55e1){_0x3c55e1=_0x3c55e1||0xcc;return function(_0x41a050){if(_0x41a050){return _0x2e8dd9['sendStatus'](_0x3c55e1);}return _0x2e8dd9[_0x4f7b('0x18')](_0x3c55e1)[_0x4f7b('0x19')]();};}function respondWithResult(_0x407cee,_0x43a51a){_0x43a51a=_0x43a51a||0xc8;return function(_0x339486){if(_0x339486){return _0x407cee[_0x4f7b('0x18')](_0x43a51a)[_0x4f7b('0x1a')](_0x339486);}};}function respondWithFilteredResult(_0x2437cc,_0x260667){return function(_0x29fdd5){if(_0x29fdd5){var _0x1a28b8=typeof _0x260667[_0x4f7b('0x1b')]==='undefined'&&typeof _0x260667[_0x4f7b('0x1c')]==='undefined';var _0x5b5ee3=_0x29fdd5[_0x4f7b('0x1d')];var _0x3813da=_0x1a28b8?0x0:_0x260667['offset'];var _0x2b34c9=_0x1a28b8?_0x29fdd5[_0x4f7b('0x1d')]:_0x260667[_0x4f7b('0x1b')]+_0x260667[_0x4f7b('0x1c')];var _0x5a5187;if(_0x2b34c9>=_0x5b5ee3){_0x2b34c9=_0x5b5ee3;_0x5a5187=0xc8;}else{_0x5a5187=0xce;}_0x2437cc[_0x4f7b('0x18')](_0x5a5187);return _0x2437cc['set'](_0x4f7b('0x1e'),_0x3813da+'-'+_0x2b34c9+'/'+_0x5b5ee3)[_0x4f7b('0x1a')](_0x29fdd5);}return null;};}function patchUpdates(_0xa2f54e){return function(_0xdb2df2){try{jsonpatch[_0x4f7b('0x1f')](_0xdb2df2,_0xa2f54e,!![]);}catch(_0x203a92){return BPromise[_0x4f7b('0x20')](_0x203a92);}return _0xdb2df2[_0x4f7b('0x21')]();};}function saveUpdates(_0x2a8b50,_0x5508bd){return function(_0x410176){if(_0x410176){return _0x410176[_0x4f7b('0x22')](_0x2a8b50)[_0x4f7b('0x23')](function(_0x5bd43f){return _0x5bd43f;});}return null;};}function removeEntity(_0x150f57,_0x4610a4){return function(_0x5d22f4){if(_0x5d22f4){return _0x5d22f4[_0x4f7b('0x24')]()['then'](function(){_0x150f57[_0x4f7b('0x18')](0xcc)[_0x4f7b('0x19')]();});}};}function handleEntityNotFound(_0x23c820,_0x278c41){return function(_0x17aa9d){if(!_0x17aa9d){_0x23c820[_0x4f7b('0x25')](0x194);}return _0x17aa9d;};}function handleError(_0x181e13,_0x3ad769){_0x3ad769=_0x3ad769||0x1f4;return function(_0x4ec9a3){logger[_0x4f7b('0x26')](_0x4ec9a3[_0x4f7b('0x27')]);if(_0x4ec9a3[_0x4f7b('0x28')]){delete _0x4ec9a3['name'];}_0x181e13[_0x4f7b('0x18')](_0x3ad769)[_0x4f7b('0x29')](_0x4ec9a3);};}exports[_0x4f7b('0x2a')]=function(_0x3a56ff,_0x1ccce0){var _0x4ebffa={},_0xac1f93={},_0x3331b2={'count':0x0,'rows':[]};var _0x9a675c=_['map'](db[_0x4f7b('0x2b')]['rawAttributes'],function(_0x4e4828){return{'name':_0x4e4828[_0x4f7b('0x2c')],'type':_0x4e4828['type'][_0x4f7b('0x2d')]};});_0xac1f93[_0x4f7b('0x2e')]=_[_0x4f7b('0x2f')](_0x9a675c,_0x4f7b('0x28'));_0xac1f93[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3a56ff[_0x4f7b('0x30')]);_0xac1f93[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],_0xac1f93[_0x4f7b('0x30')]);_0x4ebffa[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0x4ebffa[_0x4f7b('0x34')]=_0x4ebffa[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x4ebffa[_0x4f7b('0x34')]:_0xac1f93[_0x4f7b('0x2e')];if(!_0x3a56ff['query'][_0x4f7b('0x37')]('nolimit')){_0x4ebffa[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x3a56ff['query'][_0x4f7b('0x1c')]);_0x4ebffa[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x3a56ff['query'][_0x4f7b('0x1b')]);}_0x4ebffa[_0x4f7b('0x38')]=qs[_0x4f7b('0x39')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0x4ebffa[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_['pick'](_0x3a56ff[_0x4f7b('0x30')],_0xac1f93['filters']),_0x9a675c);if(_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x3b')]){_0x4ebffa[_0x4f7b('0x3a')]=_['merge'](_0x4ebffa[_0x4f7b('0x3a')],{'$or':_['map'](_0x9a675c,function(_0x2471dc){if(_0x2471dc[_0x4f7b('0x3c')]!=='VIRTUAL'){var _0x48aecc={};_0x48aecc[_0x2471dc[_0x4f7b('0x28')]]={'$like':'%'+_0x3a56ff['query'][_0x4f7b('0x3b')]+'%'};return _0x48aecc;}})});}_0x4ebffa=_[_0x4f7b('0x3d')]({},_0x4ebffa,_0x3a56ff['options']);var _0x1d0746={'where':_0x4ebffa['where']};return db['FreshdeskAccount']['count'](_0x1d0746)[_0x4f7b('0x23')](function(_0x2e861d){_0x3331b2[_0x4f7b('0x1d')]=_0x2e861d;if(_0x3a56ff[_0x4f7b('0x30')]['includeAll']){_0x4ebffa[_0x4f7b('0x3e')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x4f7b('0x3f')](_0x4ebffa);})['then'](function(_0x3c411f){_0x3331b2['rows']=_0x3c411f;return _0x3331b2;})[_0x4f7b('0x23')](respondWithFilteredResult(_0x1ccce0,_0x4ebffa))[_0x4f7b('0x40')](handleError(_0x1ccce0,null));};exports[_0x4f7b('0x41')]=function(_0x3ab08f,_0x2986cd){var _0x325cd6={'raw':![],'where':{'id':_0x3ab08f[_0x4f7b('0x42')]['id']}},_0x3fdde2={};_0x3fdde2[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x2b')][_0x4f7b('0x43')]);_0x3fdde2[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3ab08f[_0x4f7b('0x30')]);_0x3fdde2[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],_0x3fdde2['query']);_0x325cd6['attributes']=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3ab08f[_0x4f7b('0x30')]['fields']));_0x325cd6['attributes']=_0x325cd6[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x325cd6[_0x4f7b('0x34')]:_0x3fdde2[_0x4f7b('0x2e')];if(_0x3ab08f['query']['includeAll']){_0x325cd6[_0x4f7b('0x3e')]=[{'all':!![]}];}_0x325cd6=_[_0x4f7b('0x3d')]({},_0x325cd6,_0x3ab08f[_0x4f7b('0x44')]);return db[_0x4f7b('0x2b')][_0x4f7b('0x45')](_0x325cd6)['then'](handleEntityNotFound(_0x2986cd,null))[_0x4f7b('0x23')](respondWithResult(_0x2986cd,null))[_0x4f7b('0x40')](handleError(_0x2986cd,null));};exports[_0x4f7b('0x46')]=function(_0x5df68e,_0x6c659c){return db[_0x4f7b('0x2b')][_0x4f7b('0x46')](_0x5df68e[_0x4f7b('0x47')],{})[_0x4f7b('0x23')](respondWithResult(_0x6c659c,0xc9))[_0x4f7b('0x40')](handleError(_0x6c659c,null));};exports[_0x4f7b('0x22')]=function(_0x2e563f,_0x2630ec){if(_0x2e563f[_0x4f7b('0x47')]['id']){delete _0x2e563f['body']['id'];}return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x2e563f[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2630ec,null))[_0x4f7b('0x23')](saveUpdates(_0x2e563f[_0x4f7b('0x47')],null))[_0x4f7b('0x23')](respondWithResult(_0x2630ec,null))[_0x4f7b('0x40')](handleError(_0x2630ec,null));};exports[_0x4f7b('0x24')]=function(_0x7e624,_0x144ba1){return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x7e624[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x144ba1,null))[_0x4f7b('0x23')](removeEntity(_0x144ba1,null))[_0x4f7b('0x40')](handleError(_0x144ba1,null));};exports[_0x4f7b('0x48')]=function(_0x4d1ac9,_0x2c9cee,_0x40c183){var _0xeeb227={};var _0xb92819={};var _0x3437a8;var _0x819fb3;return db['FreshdeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x4d1ac9[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x2c9cee,null))['then'](function(_0x4017b5){if(_0x4017b5){_0x3437a8=_0x4017b5;_0xb92819[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x4a')][_0x4f7b('0x43')]);_0xb92819[_0x4f7b('0x30')]=_['keys'](_0x4d1ac9[_0x4f7b('0x30')]);_0xb92819['filters']=_['intersection'](_0xb92819['model'],_0xb92819[_0x4f7b('0x30')]);_0xeeb227[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xb92819['model'],qs['fields'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0xeeb227['attributes']=_0xeeb227[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0xeeb227[_0x4f7b('0x34')]:_0xb92819[_0x4f7b('0x2e')];_0xeeb227['order']=qs[_0x4f7b('0x39')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0xeeb227[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_[_0x4f7b('0x4b')](_0x4d1ac9[_0x4f7b('0x30')],_0xb92819['filters']));if(_0x4d1ac9['query']['filter']){_0xeeb227[_0x4f7b('0x3a')]=_['merge'](_0xeeb227['where'],{'$or':_['map'](_0xeeb227['attributes'],function(_0x4a35d1){var _0x2715b5={};_0x2715b5[_0x4a35d1]={'$like':'%'+_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x3b')]+'%'};return _0x2715b5;})});}_0xeeb227=_[_0x4f7b('0x3d')]({},_0xeeb227,_0x4d1ac9[_0x4f7b('0x44')]);return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x1d500c){if(_0x1d500c){_0x819fb3=_0x1d500c[_0x4f7b('0x36')];if(!_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x37')](_0x4f7b('0x4c'))){_0xeeb227[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1c')]);_0xeeb227[_0x4f7b('0x1b')]=qs['offset'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1b')]);}return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x321f36){if(_0x321f36){return _0x321f36?{'count':_0x819fb3,'rows':_0x321f36}:null;}})['then'](respondWithResult(_0x2c9cee,null))['catch'](handleError(_0x2c9cee,null));};exports[_0x4f7b('0x4d')]=function(_0x5a2b3d,_0x457ac5,_0x384a08){if(_0x5a2b3d[_0x4f7b('0x47')]['id']){delete _0x5a2b3d[_0x4f7b('0x47')]['id'];}return db['FreshdeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x5a2b3d[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x457ac5,null))['then'](function(_0x4b2089){if(_0x4b2089){_0x5a2b3d['body'][_0x4f7b('0x4e')]=_0x4b2089['id'];_0x5a2b3d['body']['Subjects']=integrations['getSubjects'](_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')]['type']);_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x50')]=integrations['getDescriptions'](_0x5a2b3d['body'][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x3c')]);return db[_0x4f7b('0x4a')]['create'](_0x5a2b3d[_0x4f7b('0x47')],{'include':[{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x52')},{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x50')}]});}return null;})[_0x4f7b('0x23')](respondWithResult(_0x457ac5,null))['catch'](handleError(_0x457ac5,null));};exports[_0x4f7b('0x53')]=function(_0x79deaa,_0xa10c21,_0x220f21){var _0x1ca442='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x79deaa['params']['id']},'attributes':['id',_0x4f7b('0x54'),_0x4f7b('0x55')]})[_0x4f7b('0x23')](handleEntityNotFound(_0xa10c21,null))[_0x4f7b('0x23')](function(_0x803e04){if(_0x803e04){_0x1ca442=_0x803e04['remoteUri'];var _0x960913=_0x1ca442[_0x4f7b('0x56')](-0x1);if(_0x960913==='/'){_0x1ca442=_0x1ca442[_0x4f7b('0x57')](0x0,_0x1ca442[_0x4f7b('0x58')](_0x960913));}return rp({'method':_0x4f7b('0x59'),'uri':util[_0x4f7b('0x5a')](_0x4f7b('0x5b'),_0x1ca442,_0x4f7b('0x5c')),'headers':{'Authorization':util[_0x4f7b('0x5a')](_0x4f7b('0x5d'),new Buffer(util[_0x4f7b('0x5a')](_0x4f7b('0x5e'),_0x803e04[_0x4f7b('0x55')]))[_0x4f7b('0x5f')](_0x4f7b('0x60')))},'json':!![]});}})[_0x4f7b('0x23')](function(_0xcb5f7e){if(_0xcb5f7e){var _0xf0691e=['requester','subject',_0x4f7b('0x61'),_0x4f7b('0x62'),_0x4f7b('0x18'),_0x4f7b('0x63'),'group',_0x4f7b('0x64'),_0x4f7b('0x65'),_0x4f7b('0x66'),_0x4f7b('0x67')];_[_0x4f7b('0x68')](_0xcb5f7e,function(_0x378587){return _0xf0691e[_0x4f7b('0x69')](_0x378587[_0x4f7b('0x28')])||!_0x378587[_0x4f7b('0x6a')]&&_0x378587[_0x4f7b('0x3c')]!==_0x4f7b('0x6b')&&_0x378587[_0x4f7b('0x3c')]!==_0x4f7b('0x6c');});return{'count':_0xcb5f7e[_0x4f7b('0x36')],'rows':_[_0x4f7b('0x2f')](_0xcb5f7e,function(_0x5d4227){return{'id':_0x5d4227[_0x4f7b('0x28')],'name':_0x5d4227[_0x4f7b('0x6d')],'custom':!_0x5d4227['default'],'options':_0x5d4227['choices']?_[_0x4f7b('0x2f')](_0x5d4227[_0x4f7b('0x6e')],function(_0x3d25a6){return{'name':_[_0x4f7b('0x6f')](_0x3d25a6),'value':_0x3d25a6};}):[]};})};}})[_0x4f7b('0x23')](respondWithResult(_0xa10c21,null))[_0x4f7b('0x40')](function(_0x1f7692){var _0x48d9c6=_0x79deaa['query'][_0x4f7b('0x70')]?0x1f4:_0x1f7692[_0x4f7b('0x71')]||0x1f4;logger[_0x4f7b('0x26')](_0x4f7b('0x72'),'getFields',_0x48d9c6,JSON[_0x4f7b('0x73')](_0x1f7692));delete _0x1f7692[_0x4f7b('0x28')];if(_0x48d9c6===0x191){_0x48d9c6=0x190;}_0xa10c21['status'](_0x48d9c6)[_0x4f7b('0x29')](_0x79deaa[_0x4f7b('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1f7692[_0x4f7b('0x71')]}:_0x1f7692);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 4fe2583..f801d10 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5620=['int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intFreshdeskAccount.attributes','define','FreshdeskAccount'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x5620,0x140));var _0x0562=function(_0x3240ff,_0x3b9c3d){_0x3240ff=_0x3240ff-0x0;var _0x514858=_0x5620[_0x3240ff];return _0x514858;};'use strict';var _=require(_0x0562('0x0'));var util=require(_0x0562('0x1'));var logger=require(_0x0562('0x2'))(_0x0562('0x3'));var moment=require(_0x0562('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0562('0x5'));var config=require(_0x0562('0x6'));var attributes=require(_0x0562('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x391487,_0x7c72e0){return _0x391487[_0x0562('0x8')](_0x0562('0x9'),attributes,{'tableName':_0x0562('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x112f=['./intFreshdeskAccount.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29ad08,_0x2d3929){var _0x205d44=function(_0x4266b0){while(--_0x4266b0){_0x29ad08['push'](_0x29ad08['shift']());}};_0x205d44(++_0x2d3929);}(_0x112f,0x85));var _0xf112=function(_0x3234cf,_0x134836){_0x3234cf=_0x3234cf-0x0;var _0x300532=_0x112f[_0x3234cf];return _0x300532;};'use strict';var _=require(_0xf112('0x0'));var util=require(_0xf112('0x1'));var logger=require(_0xf112('0x2'))(_0xf112('0x3'));var moment=require(_0xf112('0x4'));var BPromise=require(_0xf112('0x5'));var rp=require(_0xf112('0x6'));var fs=require('fs');var path=require(_0xf112('0x7'));var rimraf=require(_0xf112('0x8'));var config=require(_0xf112('0x9'));var attributes=require(_0xf112('0xa'));var integrations=require('../../components/integrations/configuration');module[_0xf112('0xb')]=function(_0x2650f0,_0x39c810){return _0x2650f0[_0xf112('0xc')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 816e22d..e5e042d 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x313d=['ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','attributes','limit','map','model','include','then'];(function(_0x236527,_0x152cc5){var _0xa3fdac=function(_0x3f7865){while(--_0x3f7865){_0x236527['push'](_0x236527['shift']());}};_0xa3fdac(++_0x152cc5);}(_0x313d,0x10d));var _0xd313=function(_0x4156e8,_0x343d46){_0x4156e8=_0x4156e8-0x0;var _0x58be48=_0x313d[_0x4156e8];return _0x58be48;};'use strict';var _=require(_0xd313('0x0'));var util=require(_0xd313('0x1'));var moment=require(_0xd313('0x2'));var BPromise=require('bluebird');var rs=require(_0xd313('0x3'));var fs=require('fs');var Redis=require(_0xd313('0x4'));var db=require(_0xd313('0x5'))['db'];var utils=require(_0xd313('0x6'));var logger=require(_0xd313('0x7'))(_0xd313('0x8'));var config=require(_0xd313('0x9'));var jayson=require(_0xd313('0xa'));var client=jayson[_0xd313('0xb')][_0xd313('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57166b,_0x395a01,_0x32d18e){return new BPromise(function(_0x59933b,_0x51be26){return client[_0xd313('0xd')](_0x57166b,_0x32d18e)['then'](function(_0x5bf2c1){logger[_0xd313('0xe')](_0xd313('0xf'),_0x395a01,'request\x20sent');logger[_0xd313('0x10')](_0xd313('0x11'),_0x395a01,_0xd313('0x12'),JSON[_0xd313('0x13')](_0x5bf2c1));if(_0x5bf2c1['error']){if(_0x5bf2c1[_0xd313('0x14')][_0xd313('0x15')]===0x1f4){logger[_0xd313('0x14')](_0xd313('0xf'),_0x395a01,_0x5bf2c1['error'][_0xd313('0x16')]);return _0x51be26(_0x5bf2c1[_0xd313('0x14')][_0xd313('0x16')]);}logger[_0xd313('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x395a01,_0x5bf2c1[_0xd313('0x14')][_0xd313('0x16')]);return _0x59933b(_0x5bf2c1[_0xd313('0x14')][_0xd313('0x16')]);}else{logger[_0xd313('0xe')](_0xd313('0xf'),_0x395a01,'request\x20sent');_0x59933b(_0x5bf2c1[_0xd313('0x17')][_0xd313('0x16')]);}})[_0xd313('0x18')](function(_0x323b2d){logger['error'](_0xd313('0xf'),_0x395a01,_0x323b2d);_0x51be26(_0x323b2d);});});}exports[_0xd313('0x19')]=function(_0x1965e1){var _0x2e8a4c=this;return new Promise(function(_0x390ec9,_0x55c475){return db['FreshdeskAccount'][_0xd313('0x1a')]({'raw':_0x1965e1[_0xd313('0x1b')]?_0x1965e1[_0xd313('0x1b')][_0xd313('0x1c')]===undefined?!![]:![]:!![],'where':_0x1965e1[_0xd313('0x1b')]?_0x1965e1[_0xd313('0x1b')]['where']||null:null,'attributes':_0x1965e1[_0xd313('0x1b')]?_0x1965e1[_0xd313('0x1b')][_0xd313('0x1d')]||null:null,'limit':_0x1965e1[_0xd313('0x1b')]?_0x1965e1['options'][_0xd313('0x1e')]||null:null,'include':_0x1965e1[_0xd313('0x1b')]?_0x1965e1[_0xd313('0x1b')]['include']?_[_0xd313('0x1f')](_0x1965e1[_0xd313('0x1b')]['include'],function(_0x9f5a45){return{'model':db[_0x9f5a45[_0xd313('0x20')]],'as':_0x9f5a45['as'],'attributes':_0x9f5a45[_0xd313('0x1d')],'include':_0x9f5a45[_0xd313('0x21')]?_[_0xd313('0x1f')](_0x9f5a45[_0xd313('0x21')],function(_0x3c56e3){return{'model':db[_0x3c56e3[_0xd313('0x20')]],'as':_0x3c56e3['as'],'attributes':_0x3c56e3[_0xd313('0x1d')],'include':_0x3c56e3[_0xd313('0x21')]?_[_0xd313('0x1f')](_0x3c56e3['include'],function(_0x6fee7d){return{'model':db[_0x6fee7d[_0xd313('0x20')]],'as':_0x6fee7d['as'],'attributes':_0x6fee7d[_0xd313('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd313('0x22')](function(_0x81b105){logger[_0xd313('0xe')](_0xd313('0x19'),_0x1965e1);logger['debug'](_0xd313('0x19'),_0x1965e1,JSON['stringify'](_0x81b105));_0x390ec9(_0x81b105);})['catch'](function(_0x3b963b){logger[_0xd313('0x14')](_0xd313('0x19'),_0x3b963b[_0xd313('0x16')],_0x1965e1);_0x55c475(_0x2e8a4c[_0xd313('0x14')](0x1f4,_0x3b963b[_0xd313('0x16')]));});});};exports[_0xd313('0x23')]=function(_0x101c8c){var _0x3bceb4=this;return new Promise(function(_0x4ea0e6,_0x4e23f7){return db[_0xd313('0x24')][_0xd313('0x25')]({'raw':_0x101c8c['options']?_0x101c8c[_0xd313('0x1b')][_0xd313('0x1c')]===undefined?!![]:![]:!![],'where':_0x101c8c[_0xd313('0x1b')]?_0x101c8c[_0xd313('0x1b')]['where']||null:null,'attributes':_0x101c8c[_0xd313('0x1b')]?_0x101c8c[_0xd313('0x1b')]['attributes']||null:null,'include':_0x101c8c[_0xd313('0x1b')]?_0x101c8c[_0xd313('0x1b')][_0xd313('0x21')]?_[_0xd313('0x1f')](_0x101c8c[_0xd313('0x1b')][_0xd313('0x21')],function(_0x16aa44){return{'model':db[_0x16aa44[_0xd313('0x20')]],'as':_0x16aa44['as'],'attributes':_0x16aa44[_0xd313('0x1d')],'include':_0x16aa44[_0xd313('0x21')]?_[_0xd313('0x1f')](_0x16aa44[_0xd313('0x21')],function(_0x3f6d0d){return{'model':db[_0x3f6d0d['model']],'as':_0x3f6d0d['as'],'attributes':_0x3f6d0d['attributes'],'include':_0x3f6d0d[_0xd313('0x21')]?_[_0xd313('0x1f')](_0x3f6d0d[_0xd313('0x21')],function(_0x40b5f1){return{'model':db[_0x40b5f1[_0xd313('0x20')]],'as':_0x40b5f1['as'],'attributes':_0x40b5f1[_0xd313('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x913284){logger[_0xd313('0xe')](_0xd313('0x23'),_0x101c8c);logger['debug'](_0xd313('0x23'),_0x101c8c,JSON[_0xd313('0x13')](_0x913284));_0x4ea0e6(_0x913284);})['catch'](function(_0x1d8a1f){logger[_0xd313('0x14')](_0xd313('0x23'),_0x1d8a1f[_0xd313('0x16')],_0x101c8c);_0x4e23f7(_0x3bceb4[_0xd313('0x14')](0x1f4,_0x1d8a1f[_0xd313('0x16')]));});});}; \ No newline at end of file +var _0xadd2=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','where','attributes','limit','map','include','model','GetFreshdeskAccount','stringify','FreshdeskAccount','find','ShowFreshdeskAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x536efe,_0x1cd079){var _0x10daba=function(_0x19a38d){while(--_0x19a38d){_0x536efe['push'](_0x536efe['shift']());}};_0x10daba(++_0x1cd079);}(_0xadd2,0xa5));var _0x2add=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xadd2[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2add('0x0'));var BPromise=require('bluebird');var rs=require(_0x2add('0x1'));var fs=require('fs');var Redis=require(_0x2add('0x2'));var db=require(_0x2add('0x3'))['db'];var utils=require(_0x2add('0x4'));var logger=require(_0x2add('0x5'))(_0x2add('0x6'));var config=require(_0x2add('0x7'));var jayson=require(_0x2add('0x8'));var client=jayson[_0x2add('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48fb55,_0x447b6d,_0x18489c){return new BPromise(function(_0x5b5047,_0x21f439){return client['request'](_0x48fb55,_0x18489c)[_0x2add('0xa')](function(_0x4363a1){logger[_0x2add('0xb')](_0x2add('0xc'),_0x447b6d,_0x2add('0xd'));logger[_0x2add('0xe')](_0x2add('0xf'),_0x447b6d,_0x2add('0xd'),JSON['stringify'](_0x4363a1));if(_0x4363a1[_0x2add('0x10')]){if(_0x4363a1[_0x2add('0x10')][_0x2add('0x11')]===0x1f4){logger[_0x2add('0x10')](_0x2add('0xc'),_0x447b6d,_0x4363a1[_0x2add('0x10')][_0x2add('0x12')]);return _0x21f439(_0x4363a1[_0x2add('0x10')]['message']);}logger[_0x2add('0x10')](_0x2add('0xc'),_0x447b6d,_0x4363a1[_0x2add('0x10')][_0x2add('0x12')]);return _0x5b5047(_0x4363a1[_0x2add('0x10')][_0x2add('0x12')]);}else{logger[_0x2add('0xb')](_0x2add('0xc'),_0x447b6d,'request\x20sent');_0x5b5047(_0x4363a1[_0x2add('0x13')][_0x2add('0x12')]);}})[_0x2add('0x14')](function(_0x1cd847){logger[_0x2add('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x447b6d,_0x1cd847);_0x21f439(_0x1cd847);});});}exports['GetFreshdeskAccount']=function(_0x3630f0){var _0x524a3f=this;return new Promise(function(_0x525afc,_0x54d277){return db['FreshdeskAccount']['findAll']({'raw':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x16')]===undefined?!![]:![]:!![],'where':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x17')]||null:null,'attributes':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x18')]||null:null,'limit':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x19')]||null:null,'include':_0x3630f0[_0x2add('0x15')]?_0x3630f0['options']['include']?_['map'](_0x3630f0[_0x2add('0x15')]['include'],function(_0x50bd25){return{'model':db[_0x50bd25['model']],'as':_0x50bd25['as'],'attributes':_0x50bd25[_0x2add('0x18')],'include':_0x50bd25['include']?_[_0x2add('0x1a')](_0x50bd25[_0x2add('0x1b')],function(_0x40c4e9){return{'model':db[_0x40c4e9[_0x2add('0x1c')]],'as':_0x40c4e9['as'],'attributes':_0x40c4e9[_0x2add('0x18')],'include':_0x40c4e9[_0x2add('0x1b')]?_[_0x2add('0x1a')](_0x40c4e9['include'],function(_0x199a54){return{'model':db[_0x199a54[_0x2add('0x1c')]],'as':_0x199a54['as'],'attributes':_0x199a54['attributes']};}):[]};}):[]};}):[]:[]})[_0x2add('0xa')](function(_0x12b704){logger[_0x2add('0xb')](_0x2add('0x1d'),_0x3630f0);logger[_0x2add('0xe')](_0x2add('0x1d'),_0x3630f0,JSON[_0x2add('0x1e')](_0x12b704));_0x525afc(_0x12b704);})[_0x2add('0x14')](function(_0x334ff0){logger[_0x2add('0x10')](_0x2add('0x1d'),_0x334ff0[_0x2add('0x12')],_0x3630f0);_0x54d277(_0x524a3f[_0x2add('0x10')](0x1f4,_0x334ff0[_0x2add('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x1dac76){var _0x201008=this;return new Promise(function(_0x165e8d,_0x1f780d){return db[_0x2add('0x1f')][_0x2add('0x20')]({'raw':_0x1dac76[_0x2add('0x15')]?_0x1dac76[_0x2add('0x15')][_0x2add('0x16')]===undefined?!![]:![]:!![],'where':_0x1dac76[_0x2add('0x15')]?_0x1dac76[_0x2add('0x15')][_0x2add('0x17')]||null:null,'attributes':_0x1dac76[_0x2add('0x15')]?_0x1dac76[_0x2add('0x15')]['attributes']||null:null,'include':_0x1dac76['options']?_0x1dac76[_0x2add('0x15')]['include']?_[_0x2add('0x1a')](_0x1dac76[_0x2add('0x15')][_0x2add('0x1b')],function(_0x4f43af){return{'model':db[_0x4f43af['model']],'as':_0x4f43af['as'],'attributes':_0x4f43af[_0x2add('0x18')],'include':_0x4f43af['include']?_[_0x2add('0x1a')](_0x4f43af[_0x2add('0x1b')],function(_0x99dadb){return{'model':db[_0x99dadb[_0x2add('0x1c')]],'as':_0x99dadb['as'],'attributes':_0x99dadb[_0x2add('0x18')],'include':_0x99dadb['include']?_[_0x2add('0x1a')](_0x99dadb[_0x2add('0x1b')],function(_0x2ca10b){return{'model':db[_0x2ca10b[_0x2add('0x1c')]],'as':_0x2ca10b['as'],'attributes':_0x2ca10b[_0x2add('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2add('0xa')](function(_0x3d58c7){logger['info']('ShowFreshdeskAccount',_0x1dac76);logger[_0x2add('0xe')]('ShowFreshdeskAccount',_0x1dac76,JSON[_0x2add('0x1e')](_0x3d58c7));_0x165e8d(_0x3d58c7);})[_0x2add('0x14')](function(_0x53ff4a){logger[_0x2add('0x10')](_0x2add('0x21'),_0x53ff4a[_0x2add('0x12')],_0x1dac76);_0x1f780d(_0x201008[_0x2add('0x10')](0x1f4,_0x53ff4a[_0x2add('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 5fdabda..d24cfee 100644 --- a/server/api/intFreshdeskConfiguration/index.js +++ b/server/api/intFreshdeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dbc=['Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','create','post','setTags','put','/:id','update','delete','util','connect-timeout','express'];(function(_0x1d6fff,_0x5a8399){var _0x5eaa54=function(_0x1b2e11){while(--_0x1b2e11){_0x1d6fff['push'](_0x1d6fff['shift']());}};_0x5eaa54(++_0x5a8399);}(_0x4dbc,0xfa));var _0xc4db=function(_0x32026c,_0x4b01ad){_0x32026c=_0x32026c-0x0;var _0x406df0=_0x4dbc[_0x32026c];return _0x406df0;};'use strict';var multer=require('multer');var util=require(_0xc4db('0x0'));var path=require('path');var timeout=require(_0xc4db('0x1'));var express=require(_0xc4db('0x2'));var router=express[_0xc4db('0x3')]();var fs_extra=require(_0xc4db('0x4'));var auth=require(_0xc4db('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc4db('0x6'));var controller=require(_0xc4db('0x7'));router[_0xc4db('0x8')]('/',auth[_0xc4db('0x9')](),controller['index']);router[_0xc4db('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc4db('0x8')](_0xc4db('0xa'),auth[_0xc4db('0x9')](),controller[_0xc4db('0xb')]);router[_0xc4db('0x8')](_0xc4db('0xc'),auth[_0xc4db('0x9')](),controller[_0xc4db('0xd')]);router[_0xc4db('0x8')]('/:id/descriptions',auth[_0xc4db('0x9')](),controller[_0xc4db('0xe')]);router[_0xc4db('0x8')](_0xc4db('0xf'),auth[_0xc4db('0x9')](),controller['getTags']);router['post']('/',auth[_0xc4db('0x9')](),controller[_0xc4db('0x10')]);router[_0xc4db('0x11')]('/:id/tags',auth[_0xc4db('0x9')](),controller[_0xc4db('0x12')]);router[_0xc4db('0x13')](_0xc4db('0x14'),auth['isAuthenticated'](),controller[_0xc4db('0x15')]);router[_0xc4db('0x16')](_0xc4db('0x14'),auth[_0xc4db('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb219=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','getFields','/:id/descriptions','/:id/tags','post','create','put','/:id','update','destroy','exports'];(function(_0x5830f3,_0x3c6c01){var _0x38efdb=function(_0x2716bb){while(--_0x2716bb){_0x5830f3['push'](_0x5830f3['shift']());}};_0x38efdb(++_0x3c6c01);}(_0xb219,0x84));var _0x9b21=function(_0x442f3a,_0x1ac71a){_0x442f3a=_0x442f3a-0x0;var _0x3aee26=_0xb219[_0x442f3a];return _0x3aee26;};'use strict';var multer=require(_0x9b21('0x0'));var util=require(_0x9b21('0x1'));var path=require(_0x9b21('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9b21('0x3')]();var fs_extra=require(_0x9b21('0x4'));var auth=require(_0x9b21('0x5'));var interaction=require(_0x9b21('0x6'));var config=require(_0x9b21('0x7'));var controller=require(_0x9b21('0x8'));router['get']('/',auth[_0x9b21('0x9')](),controller[_0x9b21('0xa')]);router[_0x9b21('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9b21('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x9b21('0xc')]);router['get']('/:id/subjects',auth[_0x9b21('0x9')](),controller['getSubjects']);router['get'](_0x9b21('0xd'),auth[_0x9b21('0x9')](),controller['getDescriptions']);router[_0x9b21('0xb')](_0x9b21('0xe'),auth['isAuthenticated'](),controller['getTags']);router[_0x9b21('0xf')]('/',auth['isAuthenticated'](),controller[_0x9b21('0x10')]);router[_0x9b21('0xf')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x9b21('0x11')](_0x9b21('0x12'),auth[_0x9b21('0x9')](),controller[_0x9b21('0x13')]);router['delete'](_0x9b21('0x12'),auth[_0x9b21('0x9')](),controller[_0x9b21('0x14')]);module[_0x9b21('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 6f20ee1..a7f2e50 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bc3=['sequelize','exports','STRING'];(function(_0x4be0e1,_0x2096ca){var _0x318501=function(_0x453259){while(--_0x453259){_0x4be0e1['push'](_0x4be0e1['shift']());}};_0x318501(++_0x2096ca);}(_0x2bc3,0x15c));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x32bc('0x0'));module[_0x32bc('0x1')]={'name':{'type':Sequelize[_0x32bc('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa594=['exports','STRING'];(function(_0x3593f4,_0x48a5e6){var _0x1aceb4=function(_0x246a04){while(--_0x246a04){_0x3593f4['push'](_0x3593f4['shift']());}};_0x1aceb4(++_0x48a5e6);}(_0xa594,0x66));var _0x4a59=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0xa594[_0x4d8666];return _0x37175b;};'use strict';var Sequelize=require('sequelize');module[_0x4a59('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4a59('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 4d43f1a..8eff845 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f0a=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','include','FreshdeskConfiguration','findAll','catch','params','keys','includeAll','merge','create','body','find','getFields','findOne','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9f0a,0x1a1));var _0xa9f0=function(_0x2e94d3,_0x221cfb){_0x2e94d3=_0x2e94d3-0x0;var _0x2bdccd=_0x9f0a[_0x2e94d3];return _0x2bdccd;};'use strict';var emlformat=require(_0xa9f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9f0('0x1'));var jsonpatch=require(_0xa9f0('0x2'));var rp=require('request-promise');var moment=require(_0xa9f0('0x3'));var BPromise=require(_0xa9f0('0x4'));var Mustache=require(_0xa9f0('0x5'));var util=require(_0xa9f0('0x6'));var path=require(_0xa9f0('0x7'));var sox=require(_0xa9f0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9f0('0x9'));var _=require(_0xa9f0('0xa'));var squel=require(_0xa9f0('0xb'));var crypto=require(_0xa9f0('0xc'));var jsforce=require(_0xa9f0('0xd'));var deskjs=require(_0xa9f0('0xe'));var toCsv=require(_0xa9f0('0xf'));var querystring=require(_0xa9f0('0x10'));var Papa=require(_0xa9f0('0x11'));var Redis=require(_0xa9f0('0x12'));var authService=require(_0xa9f0('0x13'));var qs=require(_0xa9f0('0x14'));var as=require(_0xa9f0('0x15'));var hardwareService=require(_0xa9f0('0x16'));var logger=require(_0xa9f0('0x17'))(_0xa9f0('0x18'));var utils=require(_0xa9f0('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa9f0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21b44a,_0x2699b3){_0x2699b3=_0x2699b3||0xcc;return function(_0x55616e){if(_0x55616e){return _0x21b44a[_0xa9f0('0x1b')](_0x2699b3);}return _0x21b44a[_0xa9f0('0x1c')](_0x2699b3)[_0xa9f0('0x1d')]();};}function respondWithResult(_0x1714d1,_0x3e5261){_0x3e5261=_0x3e5261||0xc8;return function(_0x537781){if(_0x537781){return _0x1714d1[_0xa9f0('0x1c')](_0x3e5261)[_0xa9f0('0x1e')](_0x537781);}};}function respondWithFilteredResult(_0x506807,_0x544fe3){return function(_0x14141e){if(_0x14141e){var _0x3db991=typeof _0x544fe3[_0xa9f0('0x1f')]===_0xa9f0('0x20')&&typeof _0x544fe3[_0xa9f0('0x21')]==='undefined';var _0x1cefc9=_0x14141e[_0xa9f0('0x22')];var _0xb4b2c4=_0x3db991?0x0:_0x544fe3[_0xa9f0('0x1f')];var _0x51011e=_0x3db991?_0x14141e[_0xa9f0('0x22')]:_0x544fe3[_0xa9f0('0x1f')]+_0x544fe3[_0xa9f0('0x21')];var _0xd2dfb6;if(_0x51011e>=_0x1cefc9){_0x51011e=_0x1cefc9;_0xd2dfb6=0xc8;}else{_0xd2dfb6=0xce;}_0x506807[_0xa9f0('0x1c')](_0xd2dfb6);return _0x506807[_0xa9f0('0x23')]('Content-Range',_0xb4b2c4+'-'+_0x51011e+'/'+_0x1cefc9)['json'](_0x14141e);}return null;};}function patchUpdates(_0x4380e4){return function(_0x5dc2e4){try{jsonpatch[_0xa9f0('0x24')](_0x5dc2e4,_0x4380e4,!![]);}catch(_0x11501a){return BPromise[_0xa9f0('0x25')](_0x11501a);}return _0x5dc2e4[_0xa9f0('0x26')]();};}function saveUpdates(_0x34ac17,_0x5aa192){return function(_0x4dadde){if(_0x4dadde){return _0x4dadde[_0xa9f0('0x27')](_0x34ac17)[_0xa9f0('0x28')](function(_0x44784a){return _0x44784a;});}return null;};}function removeEntity(_0x232331,_0x408d0c){return function(_0x17d58a){if(_0x17d58a){return _0x17d58a[_0xa9f0('0x29')]()[_0xa9f0('0x28')](function(){_0x232331[_0xa9f0('0x1c')](0xcc)[_0xa9f0('0x1d')]();});}};}function handleEntityNotFound(_0x4cad64,_0x360351){return function(_0x1c2886){if(!_0x1c2886){_0x4cad64[_0xa9f0('0x1b')](0x194);}return _0x1c2886;};}function handleError(_0x1db684,_0x3ca4a9){_0x3ca4a9=_0x3ca4a9||0x1f4;return function(_0x1cce71){logger[_0xa9f0('0x2a')](_0x1cce71[_0xa9f0('0x2b')]);if(_0x1cce71[_0xa9f0('0x2c')]){delete _0x1cce71[_0xa9f0('0x2c')];}_0x1db684['status'](_0x3ca4a9)[_0xa9f0('0x2d')](_0x1cce71);};}exports[_0xa9f0('0x2e')]=function(_0x24b0c2,_0x42375c){var _0x2bc2ef={},_0x331d1f={},_0x134e8e={'count':0x0,'rows':[]};var _0x71b545=_[_0xa9f0('0x2f')](db['FreshdeskConfiguration'][_0xa9f0('0x30')],function(_0x4343d0){return{'name':_0x4343d0[_0xa9f0('0x31')],'type':_0x4343d0[_0xa9f0('0x32')][_0xa9f0('0x33')]};});_0x331d1f[_0xa9f0('0x34')]=_[_0xa9f0('0x2f')](_0x71b545,'name');_0x331d1f[_0xa9f0('0x35')]=_['keys'](_0x24b0c2['query']);_0x331d1f['filters']=_[_0xa9f0('0x36')](_0x331d1f[_0xa9f0('0x34')],_0x331d1f[_0xa9f0('0x35')]);_0x2bc2ef[_0xa9f0('0x37')]=_[_0xa9f0('0x36')](_0x331d1f[_0xa9f0('0x34')],qs[_0xa9f0('0x38')](_0x24b0c2[_0xa9f0('0x35')][_0xa9f0('0x38')]));_0x2bc2ef[_0xa9f0('0x37')]=_0x2bc2ef['attributes'][_0xa9f0('0x39')]?_0x2bc2ef[_0xa9f0('0x37')]:_0x331d1f[_0xa9f0('0x34')];if(!_0x24b0c2['query'][_0xa9f0('0x3a')](_0xa9f0('0x3b'))){_0x2bc2ef[_0xa9f0('0x21')]=qs[_0xa9f0('0x21')](_0x24b0c2[_0xa9f0('0x35')][_0xa9f0('0x21')]);_0x2bc2ef[_0xa9f0('0x1f')]=qs[_0xa9f0('0x1f')](_0x24b0c2[_0xa9f0('0x35')][_0xa9f0('0x1f')]);}_0x2bc2ef[_0xa9f0('0x3c')]=qs[_0xa9f0('0x3d')](_0x24b0c2[_0xa9f0('0x35')]['sort']);_0x2bc2ef[_0xa9f0('0x3e')]=qs[_0xa9f0('0x3f')](_[_0xa9f0('0x40')](_0x24b0c2[_0xa9f0('0x35')],_0x331d1f[_0xa9f0('0x3f')]),_0x71b545);if(_0x24b0c2[_0xa9f0('0x35')][_0xa9f0('0x41')]){_0x2bc2ef[_0xa9f0('0x3e')]=_['merge'](_0x2bc2ef[_0xa9f0('0x3e')],{'$or':_[_0xa9f0('0x2f')](_0x71b545,function(_0x336d0d){if(_0x336d0d[_0xa9f0('0x32')]!==_0xa9f0('0x42')){var _0x5300c7={};_0x5300c7[_0x336d0d[_0xa9f0('0x2c')]]={'$like':'%'+_0x24b0c2['query'][_0xa9f0('0x41')]+'%'};return _0x5300c7;}})});}_0x2bc2ef=_['merge']({},_0x2bc2ef,_0x24b0c2[_0xa9f0('0x43')]);var _0x43def0={'where':_0x2bc2ef[_0xa9f0('0x3e')]};return db['FreshdeskConfiguration']['count'](_0x43def0)[_0xa9f0('0x28')](function(_0x4c6ae2){_0x134e8e[_0xa9f0('0x22')]=_0x4c6ae2;if(_0x24b0c2[_0xa9f0('0x35')]['includeAll']){_0x2bc2ef[_0xa9f0('0x44')]=[{'all':!![]}];}return db[_0xa9f0('0x45')][_0xa9f0('0x46')](_0x2bc2ef);})[_0xa9f0('0x28')](function(_0x3b8136){_0x134e8e['rows']=_0x3b8136;return _0x134e8e;})[_0xa9f0('0x28')](respondWithFilteredResult(_0x42375c,_0x2bc2ef))[_0xa9f0('0x47')](handleError(_0x42375c,null));};exports['show']=function(_0x4d1252,_0x2798c7){var _0x5aaaee={'raw':![],'where':{'id':_0x4d1252[_0xa9f0('0x48')]['id']}},_0x54c617={};_0x54c617[_0xa9f0('0x34')]=_[_0xa9f0('0x49')](db['FreshdeskConfiguration']['rawAttributes']);_0x54c617[_0xa9f0('0x35')]=_[_0xa9f0('0x49')](_0x4d1252[_0xa9f0('0x35')]);_0x54c617[_0xa9f0('0x3f')]=_['intersection'](_0x54c617[_0xa9f0('0x34')],_0x54c617[_0xa9f0('0x35')]);_0x5aaaee[_0xa9f0('0x37')]=_[_0xa9f0('0x36')](_0x54c617[_0xa9f0('0x34')],qs[_0xa9f0('0x38')](_0x4d1252['query'][_0xa9f0('0x38')]));_0x5aaaee['attributes']=_0x5aaaee[_0xa9f0('0x37')][_0xa9f0('0x39')]?_0x5aaaee[_0xa9f0('0x37')]:_0x54c617[_0xa9f0('0x34')];if(_0x4d1252['query'][_0xa9f0('0x4a')]){_0x5aaaee['include']=[{'all':!![]}];}_0x5aaaee=_[_0xa9f0('0x4b')]({},_0x5aaaee,_0x4d1252['options']);return db[_0xa9f0('0x45')]['find'](_0x5aaaee)['then'](handleEntityNotFound(_0x2798c7,null))[_0xa9f0('0x28')](respondWithResult(_0x2798c7,null))['catch'](handleError(_0x2798c7,null));};exports[_0xa9f0('0x4c')]=function(_0x2c79f5,_0x99ac02){return db[_0xa9f0('0x45')]['create'](_0x2c79f5[_0xa9f0('0x4d')],{})[_0xa9f0('0x28')](respondWithResult(_0x99ac02,0xc9))[_0xa9f0('0x47')](handleError(_0x99ac02,null));};exports['update']=function(_0x3683bb,_0x595859){if(_0x3683bb[_0xa9f0('0x4d')]['id']){delete _0x3683bb['body']['id'];}return db[_0xa9f0('0x45')][_0xa9f0('0x4e')]({'where':{'id':_0x3683bb[_0xa9f0('0x48')]['id']}})[_0xa9f0('0x28')](handleEntityNotFound(_0x595859,null))['then'](saveUpdates(_0x3683bb['body'],null))['then'](respondWithResult(_0x595859,null))[_0xa9f0('0x47')](handleError(_0x595859,null));};exports[_0xa9f0('0x29')]=function(_0x176139,_0x12652b){return db[_0xa9f0('0x45')][_0xa9f0('0x4e')]({'where':{'id':_0x176139['params']['id']}})[_0xa9f0('0x28')](handleEntityNotFound(_0x12652b,null))[_0xa9f0('0x28')](removeEntity(_0x12652b,null))[_0xa9f0('0x47')](handleError(_0x12652b,null));};exports[_0xa9f0('0x4f')]=function(_0x291fa4,_0x50a56d,_0x151546){var _0x155c29={};var _0xe75689={};var _0x393e97;var _0x54961c;return db[_0xa9f0('0x45')][_0xa9f0('0x50')]({'where':{'id':_0x291fa4['params']['id']}})['then'](handleEntityNotFound(_0x50a56d,null))[_0xa9f0('0x28')](function(_0x52e063){if(_0x52e063){_0x393e97=_0x52e063;_0xe75689[_0xa9f0('0x34')]=_[_0xa9f0('0x49')](db['FreshdeskField'][_0xa9f0('0x30')]);_0xe75689[_0xa9f0('0x35')]=_[_0xa9f0('0x49')](_0x291fa4[_0xa9f0('0x35')]);_0xe75689[_0xa9f0('0x3f')]=_[_0xa9f0('0x36')](_0xe75689['model'],_0xe75689['query']);_0x155c29[_0xa9f0('0x37')]=_[_0xa9f0('0x36')](_0xe75689[_0xa9f0('0x34')],qs['fields'](_0x291fa4['query'][_0xa9f0('0x38')]));_0x155c29[_0xa9f0('0x37')]=_0x155c29[_0xa9f0('0x37')][_0xa9f0('0x39')]?_0x155c29['attributes']:_0xe75689[_0xa9f0('0x34')];_0x155c29[_0xa9f0('0x3c')]=qs[_0xa9f0('0x3d')](_0x291fa4[_0xa9f0('0x35')][_0xa9f0('0x3d')]);_0x155c29['where']=qs[_0xa9f0('0x3f')](_[_0xa9f0('0x40')](_0x291fa4[_0xa9f0('0x35')],_0xe75689['filters']));if(_0x291fa4[_0xa9f0('0x35')][_0xa9f0('0x41')]){_0x155c29[_0xa9f0('0x3e')]=_[_0xa9f0('0x4b')](_0x155c29[_0xa9f0('0x3e')],{'$or':_[_0xa9f0('0x2f')](_0x155c29[_0xa9f0('0x37')],function(_0x297e85){var _0x3d18c2={};_0x3d18c2[_0x297e85]={'$like':'%'+_0x291fa4[_0xa9f0('0x35')][_0xa9f0('0x41')]+'%'};return _0x3d18c2;})});}_0x155c29=_[_0xa9f0('0x4b')]({},_0x155c29,_0x291fa4['options']);return _0x393e97[_0xa9f0('0x4f')](_0x155c29);}})[_0xa9f0('0x28')](function(_0x54f819){if(_0x54f819){_0x54961c=_0x54f819[_0xa9f0('0x39')];if(!_0x291fa4['query'][_0xa9f0('0x3a')](_0xa9f0('0x3b'))){_0x155c29[_0xa9f0('0x21')]=qs['limit'](_0x291fa4['query']['limit']);_0x155c29[_0xa9f0('0x1f')]=qs[_0xa9f0('0x1f')](_0x291fa4[_0xa9f0('0x35')][_0xa9f0('0x1f')]);}return _0x393e97[_0xa9f0('0x4f')](_0x155c29);}})[_0xa9f0('0x28')](function(_0x3e7298){if(_0x3e7298){return _0x3e7298?{'count':_0x54961c,'rows':_0x3e7298}:null;}})[_0xa9f0('0x28')](respondWithResult(_0x50a56d,null))['catch'](handleError(_0x50a56d,null));};exports[_0xa9f0('0x51')]=function(_0x1df7c9,_0x5bfe1e,_0x3cbdd8){var _0x1c6441={};var _0x42c8d4={};var _0xc623d;var _0x4847fb;return db[_0xa9f0('0x45')][_0xa9f0('0x50')]({'where':{'id':_0x1df7c9[_0xa9f0('0x48')]['id']}})[_0xa9f0('0x28')](handleEntityNotFound(_0x5bfe1e,null))[_0xa9f0('0x28')](function(_0x1898fd){if(_0x1898fd){_0xc623d=_0x1898fd;_0x42c8d4[_0xa9f0('0x34')]=_['keys'](db[_0xa9f0('0x52')][_0xa9f0('0x30')]);_0x42c8d4[_0xa9f0('0x35')]=_['keys'](_0x1df7c9[_0xa9f0('0x35')]);_0x42c8d4[_0xa9f0('0x3f')]=_[_0xa9f0('0x36')](_0x42c8d4[_0xa9f0('0x34')],_0x42c8d4[_0xa9f0('0x35')]);_0x1c6441[_0xa9f0('0x37')]=_['intersection'](_0x42c8d4[_0xa9f0('0x34')],qs[_0xa9f0('0x38')](_0x1df7c9['query'][_0xa9f0('0x38')]));_0x1c6441[_0xa9f0('0x37')]=_0x1c6441[_0xa9f0('0x37')][_0xa9f0('0x39')]?_0x1c6441[_0xa9f0('0x37')]:_0x42c8d4['model'];_0x1c6441[_0xa9f0('0x3c')]=qs[_0xa9f0('0x3d')](_0x1df7c9[_0xa9f0('0x35')]['sort']);_0x1c6441[_0xa9f0('0x3e')]=qs['filters'](_[_0xa9f0('0x40')](_0x1df7c9['query'],_0x42c8d4[_0xa9f0('0x3f')]));if(_0x1df7c9[_0xa9f0('0x35')][_0xa9f0('0x41')]){_0x1c6441[_0xa9f0('0x3e')]=_[_0xa9f0('0x4b')](_0x1c6441[_0xa9f0('0x3e')],{'$or':_['map'](_0x1c6441[_0xa9f0('0x37')],function(_0x17a8f2){var _0x3d358c={};_0x3d358c[_0x17a8f2]={'$like':'%'+_0x1df7c9[_0xa9f0('0x35')][_0xa9f0('0x41')]+'%'};return _0x3d358c;})});}_0x1c6441=_[_0xa9f0('0x4b')]({},_0x1c6441,_0x1df7c9[_0xa9f0('0x43')]);return _0xc623d[_0xa9f0('0x51')](_0x1c6441);}})['then'](function(_0x357109){if(_0x357109){_0x4847fb=_0x357109[_0xa9f0('0x39')];if(!_0x1df7c9['query'][_0xa9f0('0x3a')](_0xa9f0('0x3b'))){_0x1c6441[_0xa9f0('0x21')]=qs[_0xa9f0('0x21')](_0x1df7c9['query'][_0xa9f0('0x21')]);_0x1c6441[_0xa9f0('0x1f')]=qs[_0xa9f0('0x1f')](_0x1df7c9[_0xa9f0('0x35')]['offset']);}return _0xc623d['getSubjects'](_0x1c6441);}})[_0xa9f0('0x28')](function(_0x303a09){if(_0x303a09){return _0x303a09?{'count':_0x4847fb,'rows':_0x303a09}:null;}})[_0xa9f0('0x28')](respondWithResult(_0x5bfe1e,null))[_0xa9f0('0x47')](handleError(_0x5bfe1e,null));};exports[_0xa9f0('0x53')]=function(_0x44eae9,_0x1d0280,_0x49120f){var _0x161d93={};var _0x2b2638={};var _0x2572ad;var _0x500672;return db[_0xa9f0('0x45')]['findOne']({'where':{'id':_0x44eae9[_0xa9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d0280,null))[_0xa9f0('0x28')](function(_0x49e34e){if(_0x49e34e){_0x2572ad=_0x49e34e;_0x2b2638[_0xa9f0('0x34')]=_[_0xa9f0('0x49')](db['FreshdeskField'][_0xa9f0('0x30')]);_0x2b2638[_0xa9f0('0x35')]=_[_0xa9f0('0x49')](_0x44eae9[_0xa9f0('0x35')]);_0x2b2638[_0xa9f0('0x3f')]=_['intersection'](_0x2b2638[_0xa9f0('0x34')],_0x2b2638[_0xa9f0('0x35')]);_0x161d93[_0xa9f0('0x37')]=_[_0xa9f0('0x36')](_0x2b2638['model'],qs[_0xa9f0('0x38')](_0x44eae9[_0xa9f0('0x35')][_0xa9f0('0x38')]));_0x161d93['attributes']=_0x161d93[_0xa9f0('0x37')]['length']?_0x161d93[_0xa9f0('0x37')]:_0x2b2638['model'];_0x161d93[_0xa9f0('0x3c')]=qs[_0xa9f0('0x3d')](_0x44eae9[_0xa9f0('0x35')][_0xa9f0('0x3d')]);_0x161d93['where']=qs['filters'](_[_0xa9f0('0x40')](_0x44eae9['query'],_0x2b2638[_0xa9f0('0x3f')]));if(_0x44eae9['query']['filter']){_0x161d93[_0xa9f0('0x3e')]=_['merge'](_0x161d93[_0xa9f0('0x3e')],{'$or':_['map'](_0x161d93[_0xa9f0('0x37')],function(_0x5e44e2){var _0x16784d={};_0x16784d[_0x5e44e2]={'$like':'%'+_0x44eae9[_0xa9f0('0x35')][_0xa9f0('0x41')]+'%'};return _0x16784d;})});}_0x161d93=_[_0xa9f0('0x4b')]({},_0x161d93,_0x44eae9['options']);return _0x2572ad[_0xa9f0('0x53')](_0x161d93);}})['then'](function(_0x128299){if(_0x128299){_0x500672=_0x128299[_0xa9f0('0x39')];if(!_0x44eae9[_0xa9f0('0x35')][_0xa9f0('0x3a')](_0xa9f0('0x3b'))){_0x161d93[_0xa9f0('0x21')]=qs[_0xa9f0('0x21')](_0x44eae9[_0xa9f0('0x35')]['limit']);_0x161d93[_0xa9f0('0x1f')]=qs[_0xa9f0('0x1f')](_0x44eae9['query'][_0xa9f0('0x1f')]);}return _0x2572ad['getDescriptions'](_0x161d93);}})[_0xa9f0('0x28')](function(_0x41140a){if(_0x41140a){return _0x41140a?{'count':_0x500672,'rows':_0x41140a}:null;}})[_0xa9f0('0x28')](respondWithResult(_0x1d0280,null))[_0xa9f0('0x47')](handleError(_0x1d0280,null));};exports['getTags']=function(_0x3de2b,_0x2379a9,_0x570675){var _0x5ac4b8={};var _0x3a86a5={};var _0x12d651;var _0x5442c2;return db[_0xa9f0('0x45')][_0xa9f0('0x50')]({'where':{'id':_0x3de2b['params']['id']}})['then'](handleEntityNotFound(_0x2379a9,null))['then'](function(_0xc849b3){if(_0xc849b3){_0x12d651=_0xc849b3;_0x3a86a5[_0xa9f0('0x34')]=_[_0xa9f0('0x49')](db['Tag']['rawAttributes']);_0x3a86a5[_0xa9f0('0x35')]=_[_0xa9f0('0x49')](_0x3de2b['query']);_0x3a86a5[_0xa9f0('0x3f')]=_[_0xa9f0('0x36')](_0x3a86a5[_0xa9f0('0x34')],_0x3a86a5[_0xa9f0('0x35')]);_0x5ac4b8[_0xa9f0('0x37')]=_[_0xa9f0('0x36')](_0x3a86a5[_0xa9f0('0x34')],qs[_0xa9f0('0x38')](_0x3de2b[_0xa9f0('0x35')][_0xa9f0('0x38')]));_0x5ac4b8[_0xa9f0('0x37')]=_0x5ac4b8['attributes'][_0xa9f0('0x39')]?_0x5ac4b8[_0xa9f0('0x37')]:_0x3a86a5[_0xa9f0('0x34')];_0x5ac4b8[_0xa9f0('0x3c')]=qs[_0xa9f0('0x3d')](_0x3de2b['query'][_0xa9f0('0x3d')]);_0x5ac4b8['where']=qs[_0xa9f0('0x3f')](_[_0xa9f0('0x40')](_0x3de2b[_0xa9f0('0x35')],_0x3a86a5[_0xa9f0('0x3f')]));if(_0x3de2b[_0xa9f0('0x35')][_0xa9f0('0x41')]){_0x5ac4b8[_0xa9f0('0x3e')]=_['merge'](_0x5ac4b8[_0xa9f0('0x3e')],{'$or':_[_0xa9f0('0x2f')](_0x5ac4b8[_0xa9f0('0x37')],function(_0x5c93da){var _0x573cb0={};_0x573cb0[_0x5c93da]={'$like':'%'+_0x3de2b[_0xa9f0('0x35')]['filter']+'%'};return _0x573cb0;})});}_0x5ac4b8=_[_0xa9f0('0x4b')]({},_0x5ac4b8,_0x3de2b[_0xa9f0('0x43')]);return _0x12d651['getTags'](_0x5ac4b8);}})[_0xa9f0('0x28')](function(_0x262e36){if(_0x262e36){_0x5442c2=_0x262e36['length'];if(!_0x3de2b[_0xa9f0('0x35')][_0xa9f0('0x3a')]('nolimit')){_0x5ac4b8[_0xa9f0('0x21')]=qs[_0xa9f0('0x21')](_0x3de2b[_0xa9f0('0x35')][_0xa9f0('0x21')]);_0x5ac4b8[_0xa9f0('0x1f')]=qs[_0xa9f0('0x1f')](_0x3de2b[_0xa9f0('0x35')][_0xa9f0('0x1f')]);}return _0x12d651[_0xa9f0('0x54')](_0x5ac4b8);}})['then'](function(_0x4ae61f){if(_0x4ae61f){return _0x4ae61f?{'count':_0x5442c2,'rows':_0x4ae61f}:null;}})[_0xa9f0('0x28')](respondWithResult(_0x2379a9,null))[_0xa9f0('0x47')](handleError(_0x2379a9,null));};exports[_0xa9f0('0x55')]=function(_0x3d564a,_0x166f32,_0x3e8acf){if(_0x3d564a[_0xa9f0('0x4d')]['id']){delete _0x3d564a[_0xa9f0('0x4d')]['id'];}return db['FreshdeskConfiguration'][_0xa9f0('0x50')]({'where':{'id':_0x3d564a['params']['id']}})[_0xa9f0('0x28')](handleEntityNotFound(_0x166f32,null))[_0xa9f0('0x28')](function(_0x5df433){if(_0x5df433){return _0x5df433[_0xa9f0('0x55')](_0x3d564a[_0xa9f0('0x4d')][_0xa9f0('0x56')]||[]);}return null;})[_0xa9f0('0x28')](respondWithResult(_0x166f32,null))[_0xa9f0('0x47')](handleError(_0x166f32,null));}; \ No newline at end of file +var _0x9c02=['getTags','setTags','ids','eml-format','fast-json-patch','moment','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions'];(function(_0x5c3b79,_0x13b43b){var _0x3bacc7=function(_0x3c7714){while(--_0x3c7714){_0x5c3b79['push'](_0x5c3b79['shift']());}};_0x3bacc7(++_0x13b43b);}(_0x9c02,0x99));var _0x29c0=function(_0x2ba676,_0x3843d1){_0x2ba676=_0x2ba676-0x0;var _0xfbd231=_0x9c02[_0x2ba676];return _0xfbd231;};'use strict';var emlformat=require(_0x29c0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x29c0('0x1'));var rp=require('request-promise');var moment=require(_0x29c0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x29c0('0x3'));var util=require('util');var path=require('path');var sox=require(_0x29c0('0x4'));var csv=require('to-csv');var ejs=require(_0x29c0('0x5'));var fs=require('fs');var fs_extra=require(_0x29c0('0x6'));var _=require(_0x29c0('0x7'));var squel=require('squel');var crypto=require(_0x29c0('0x8'));var jsforce=require(_0x29c0('0x9'));var deskjs=require(_0x29c0('0xa'));var toCsv=require('to-csv');var querystring=require(_0x29c0('0xb'));var Papa=require(_0x29c0('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29c0('0xd'));var hardwareService=require(_0x29c0('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x29c0('0xf'));var licenseUtil=require(_0x29c0('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x346cfd,_0x170e0c){_0x170e0c=_0x170e0c||0xcc;return function(_0x52a049){if(_0x52a049){return _0x346cfd[_0x29c0('0x11')](_0x170e0c);}return _0x346cfd[_0x29c0('0x12')](_0x170e0c)[_0x29c0('0x13')]();};}function respondWithResult(_0x1e7514,_0x52eecd){_0x52eecd=_0x52eecd||0xc8;return function(_0x4cb0c2){if(_0x4cb0c2){return _0x1e7514['status'](_0x52eecd)['json'](_0x4cb0c2);}};}function respondWithFilteredResult(_0x11041f,_0x599ac3){return function(_0x3a62da){if(_0x3a62da){var _0x4a28ed=typeof _0x599ac3[_0x29c0('0x14')]===_0x29c0('0x15')&&typeof _0x599ac3[_0x29c0('0x16')]===_0x29c0('0x15');var _0x4ad2b9=_0x3a62da[_0x29c0('0x17')];var _0x596108=_0x4a28ed?0x0:_0x599ac3['offset'];var _0x423a3a=_0x4a28ed?_0x3a62da[_0x29c0('0x17')]:_0x599ac3[_0x29c0('0x14')]+_0x599ac3[_0x29c0('0x16')];var _0x57ca66;if(_0x423a3a>=_0x4ad2b9){_0x423a3a=_0x4ad2b9;_0x57ca66=0xc8;}else{_0x57ca66=0xce;}_0x11041f['status'](_0x57ca66);return _0x11041f['set'](_0x29c0('0x18'),_0x596108+'-'+_0x423a3a+'/'+_0x4ad2b9)['json'](_0x3a62da);}return null;};}function patchUpdates(_0xb31d70){return function(_0x18c729){try{jsonpatch[_0x29c0('0x19')](_0x18c729,_0xb31d70,!![]);}catch(_0x367fcd){return BPromise[_0x29c0('0x1a')](_0x367fcd);}return _0x18c729['save']();};}function saveUpdates(_0xbba8fe,_0x5da54f){return function(_0x393b93){if(_0x393b93){return _0x393b93[_0x29c0('0x1b')](_0xbba8fe)[_0x29c0('0x1c')](function(_0x9c1ace){return _0x9c1ace;});}return null;};}function removeEntity(_0xd70043,_0x401026){return function(_0x3b494f){if(_0x3b494f){return _0x3b494f[_0x29c0('0x1d')]()[_0x29c0('0x1c')](function(){_0xd70043['status'](0xcc)[_0x29c0('0x13')]();});}};}function handleEntityNotFound(_0x294def,_0x4099ce){return function(_0x5b72ce){if(!_0x5b72ce){_0x294def[_0x29c0('0x11')](0x194);}return _0x5b72ce;};}function handleError(_0x3bfc65,_0x58ac99){_0x58ac99=_0x58ac99||0x1f4;return function(_0x353e31){logger[_0x29c0('0x1e')](_0x353e31[_0x29c0('0x1f')]);if(_0x353e31[_0x29c0('0x20')]){delete _0x353e31[_0x29c0('0x20')];}_0x3bfc65['status'](_0x58ac99)[_0x29c0('0x21')](_0x353e31);};}exports[_0x29c0('0x22')]=function(_0x3339fa,_0x511757){var _0x57b138={},_0x5b68e0={},_0x1046ea={'count':0x0,'rows':[]};var _0x5dd46f=_[_0x29c0('0x23')](db[_0x29c0('0x24')][_0x29c0('0x25')],function(_0x1b753b){return{'name':_0x1b753b['fieldName'],'type':_0x1b753b[_0x29c0('0x26')]['key']};});_0x5b68e0['model']=_[_0x29c0('0x23')](_0x5dd46f,_0x29c0('0x20'));_0x5b68e0['query']=_['keys'](_0x3339fa[_0x29c0('0x27')]);_0x5b68e0[_0x29c0('0x28')]=_[_0x29c0('0x29')](_0x5b68e0[_0x29c0('0x2a')],_0x5b68e0['query']);_0x57b138['attributes']=_[_0x29c0('0x29')](_0x5b68e0[_0x29c0('0x2a')],qs[_0x29c0('0x2b')](_0x3339fa[_0x29c0('0x27')][_0x29c0('0x2b')]));_0x57b138['attributes']=_0x57b138[_0x29c0('0x2c')][_0x29c0('0x2d')]?_0x57b138[_0x29c0('0x2c')]:_0x5b68e0[_0x29c0('0x2a')];if(!_0x3339fa[_0x29c0('0x27')][_0x29c0('0x2e')]('nolimit')){_0x57b138['limit']=qs[_0x29c0('0x16')](_0x3339fa[_0x29c0('0x27')][_0x29c0('0x16')]);_0x57b138[_0x29c0('0x14')]=qs[_0x29c0('0x14')](_0x3339fa[_0x29c0('0x27')][_0x29c0('0x14')]);}_0x57b138[_0x29c0('0x2f')]=qs[_0x29c0('0x30')](_0x3339fa[_0x29c0('0x27')][_0x29c0('0x30')]);_0x57b138[_0x29c0('0x31')]=qs[_0x29c0('0x28')](_[_0x29c0('0x32')](_0x3339fa[_0x29c0('0x27')],_0x5b68e0['filters']),_0x5dd46f);if(_0x3339fa[_0x29c0('0x27')][_0x29c0('0x33')]){_0x57b138['where']=_['merge'](_0x57b138[_0x29c0('0x31')],{'$or':_['map'](_0x5dd46f,function(_0x5c6e5c){if(_0x5c6e5c['type']!==_0x29c0('0x34')){var _0xfdeffe={};_0xfdeffe[_0x5c6e5c[_0x29c0('0x20')]]={'$like':'%'+_0x3339fa[_0x29c0('0x27')][_0x29c0('0x33')]+'%'};return _0xfdeffe;}})});}_0x57b138=_[_0x29c0('0x35')]({},_0x57b138,_0x3339fa['options']);var _0x261713={'where':_0x57b138['where']};return db[_0x29c0('0x24')][_0x29c0('0x17')](_0x261713)[_0x29c0('0x1c')](function(_0x317d80){_0x1046ea[_0x29c0('0x17')]=_0x317d80;if(_0x3339fa['query'][_0x29c0('0x36')]){_0x57b138[_0x29c0('0x37')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x29c0('0x38')](_0x57b138);})[_0x29c0('0x1c')](function(_0x2c5bd7){_0x1046ea[_0x29c0('0x39')]=_0x2c5bd7;return _0x1046ea;})[_0x29c0('0x1c')](respondWithFilteredResult(_0x511757,_0x57b138))[_0x29c0('0x3a')](handleError(_0x511757,null));};exports[_0x29c0('0x3b')]=function(_0x16482d,_0x41cf29){var _0x391543={'raw':![],'where':{'id':_0x16482d[_0x29c0('0x3c')]['id']}},_0x1bab6c={};_0x1bab6c[_0x29c0('0x2a')]=_[_0x29c0('0x3d')](db[_0x29c0('0x24')][_0x29c0('0x25')]);_0x1bab6c[_0x29c0('0x27')]=_['keys'](_0x16482d[_0x29c0('0x27')]);_0x1bab6c[_0x29c0('0x28')]=_[_0x29c0('0x29')](_0x1bab6c[_0x29c0('0x2a')],_0x1bab6c[_0x29c0('0x27')]);_0x391543[_0x29c0('0x2c')]=_[_0x29c0('0x29')](_0x1bab6c[_0x29c0('0x2a')],qs[_0x29c0('0x2b')](_0x16482d[_0x29c0('0x27')][_0x29c0('0x2b')]));_0x391543[_0x29c0('0x2c')]=_0x391543[_0x29c0('0x2c')][_0x29c0('0x2d')]?_0x391543['attributes']:_0x1bab6c[_0x29c0('0x2a')];if(_0x16482d[_0x29c0('0x27')][_0x29c0('0x36')]){_0x391543[_0x29c0('0x37')]=[{'all':!![]}];}_0x391543=_[_0x29c0('0x35')]({},_0x391543,_0x16482d[_0x29c0('0x3e')]);return db['FreshdeskConfiguration'][_0x29c0('0x3f')](_0x391543)[_0x29c0('0x1c')](handleEntityNotFound(_0x41cf29,null))[_0x29c0('0x1c')](respondWithResult(_0x41cf29,null))[_0x29c0('0x3a')](handleError(_0x41cf29,null));};exports[_0x29c0('0x40')]=function(_0x34f226,_0x2715b1){return db[_0x29c0('0x24')][_0x29c0('0x40')](_0x34f226[_0x29c0('0x41')],{})[_0x29c0('0x1c')](respondWithResult(_0x2715b1,0xc9))[_0x29c0('0x3a')](handleError(_0x2715b1,null));};exports[_0x29c0('0x1b')]=function(_0xb38671,_0x2ac97e){if(_0xb38671[_0x29c0('0x41')]['id']){delete _0xb38671[_0x29c0('0x41')]['id'];}return db[_0x29c0('0x24')]['find']({'where':{'id':_0xb38671[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x2ac97e,null))[_0x29c0('0x1c')](saveUpdates(_0xb38671[_0x29c0('0x41')],null))[_0x29c0('0x1c')](respondWithResult(_0x2ac97e,null))[_0x29c0('0x3a')](handleError(_0x2ac97e,null));};exports[_0x29c0('0x1d')]=function(_0x1b2116,_0x124bbd){return db['FreshdeskConfiguration'][_0x29c0('0x3f')]({'where':{'id':_0x1b2116[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x124bbd,null))[_0x29c0('0x1c')](removeEntity(_0x124bbd,null))[_0x29c0('0x3a')](handleError(_0x124bbd,null));};exports[_0x29c0('0x42')]=function(_0x5378de,_0x230db8,_0x375342){var _0x4e757b={};var _0x4c6dcf={};var _0x56caf0;var _0x10b34b;return db[_0x29c0('0x24')][_0x29c0('0x43')]({'where':{'id':_0x5378de['params']['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x230db8,null))[_0x29c0('0x1c')](function(_0x37d9ec){if(_0x37d9ec){_0x56caf0=_0x37d9ec;_0x4c6dcf[_0x29c0('0x2a')]=_[_0x29c0('0x3d')](db[_0x29c0('0x44')][_0x29c0('0x25')]);_0x4c6dcf['query']=_[_0x29c0('0x3d')](_0x5378de[_0x29c0('0x27')]);_0x4c6dcf[_0x29c0('0x28')]=_[_0x29c0('0x29')](_0x4c6dcf['model'],_0x4c6dcf['query']);_0x4e757b['attributes']=_[_0x29c0('0x29')](_0x4c6dcf[_0x29c0('0x2a')],qs[_0x29c0('0x2b')](_0x5378de['query'][_0x29c0('0x2b')]));_0x4e757b[_0x29c0('0x2c')]=_0x4e757b['attributes'][_0x29c0('0x2d')]?_0x4e757b[_0x29c0('0x2c')]:_0x4c6dcf[_0x29c0('0x2a')];_0x4e757b['order']=qs[_0x29c0('0x30')](_0x5378de['query'][_0x29c0('0x30')]);_0x4e757b['where']=qs[_0x29c0('0x28')](_[_0x29c0('0x32')](_0x5378de[_0x29c0('0x27')],_0x4c6dcf[_0x29c0('0x28')]));if(_0x5378de[_0x29c0('0x27')]['filter']){_0x4e757b['where']=_[_0x29c0('0x35')](_0x4e757b[_0x29c0('0x31')],{'$or':_[_0x29c0('0x23')](_0x4e757b[_0x29c0('0x2c')],function(_0x2f0396){var _0x11937a={};_0x11937a[_0x2f0396]={'$like':'%'+_0x5378de[_0x29c0('0x27')][_0x29c0('0x33')]+'%'};return _0x11937a;})});}_0x4e757b=_['merge']({},_0x4e757b,_0x5378de['options']);return _0x56caf0[_0x29c0('0x42')](_0x4e757b);}})[_0x29c0('0x1c')](function(_0x127de9){if(_0x127de9){_0x10b34b=_0x127de9[_0x29c0('0x2d')];if(!_0x5378de[_0x29c0('0x27')][_0x29c0('0x2e')](_0x29c0('0x45'))){_0x4e757b['limit']=qs[_0x29c0('0x16')](_0x5378de[_0x29c0('0x27')]['limit']);_0x4e757b[_0x29c0('0x14')]=qs[_0x29c0('0x14')](_0x5378de[_0x29c0('0x27')][_0x29c0('0x14')]);}return _0x56caf0[_0x29c0('0x42')](_0x4e757b);}})[_0x29c0('0x1c')](function(_0x16bf40){if(_0x16bf40){return _0x16bf40?{'count':_0x10b34b,'rows':_0x16bf40}:null;}})[_0x29c0('0x1c')](respondWithResult(_0x230db8,null))[_0x29c0('0x3a')](handleError(_0x230db8,null));};exports[_0x29c0('0x46')]=function(_0x421878,_0x3c85b4,_0x1f0e72){var _0x18c3ca={};var _0x47de7b={};var _0x534197;var _0x41751e;return db['FreshdeskConfiguration'][_0x29c0('0x43')]({'where':{'id':_0x421878[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x3c85b4,null))[_0x29c0('0x1c')](function(_0xd26c36){if(_0xd26c36){_0x534197=_0xd26c36;_0x47de7b['model']=_[_0x29c0('0x3d')](db['FreshdeskField'][_0x29c0('0x25')]);_0x47de7b[_0x29c0('0x27')]=_[_0x29c0('0x3d')](_0x421878['query']);_0x47de7b[_0x29c0('0x28')]=_['intersection'](_0x47de7b[_0x29c0('0x2a')],_0x47de7b[_0x29c0('0x27')]);_0x18c3ca[_0x29c0('0x2c')]=_[_0x29c0('0x29')](_0x47de7b[_0x29c0('0x2a')],qs[_0x29c0('0x2b')](_0x421878[_0x29c0('0x27')][_0x29c0('0x2b')]));_0x18c3ca['attributes']=_0x18c3ca[_0x29c0('0x2c')][_0x29c0('0x2d')]?_0x18c3ca[_0x29c0('0x2c')]:_0x47de7b['model'];_0x18c3ca['order']=qs[_0x29c0('0x30')](_0x421878[_0x29c0('0x27')]['sort']);_0x18c3ca['where']=qs[_0x29c0('0x28')](_[_0x29c0('0x32')](_0x421878[_0x29c0('0x27')],_0x47de7b[_0x29c0('0x28')]));if(_0x421878[_0x29c0('0x27')]['filter']){_0x18c3ca[_0x29c0('0x31')]=_[_0x29c0('0x35')](_0x18c3ca[_0x29c0('0x31')],{'$or':_[_0x29c0('0x23')](_0x18c3ca[_0x29c0('0x2c')],function(_0x3ad78b){var _0x3390a3={};_0x3390a3[_0x3ad78b]={'$like':'%'+_0x421878[_0x29c0('0x27')][_0x29c0('0x33')]+'%'};return _0x3390a3;})});}_0x18c3ca=_[_0x29c0('0x35')]({},_0x18c3ca,_0x421878['options']);return _0x534197[_0x29c0('0x46')](_0x18c3ca);}})[_0x29c0('0x1c')](function(_0x34e443){if(_0x34e443){_0x41751e=_0x34e443[_0x29c0('0x2d')];if(!_0x421878[_0x29c0('0x27')]['hasOwnProperty'](_0x29c0('0x45'))){_0x18c3ca[_0x29c0('0x16')]=qs[_0x29c0('0x16')](_0x421878[_0x29c0('0x27')]['limit']);_0x18c3ca[_0x29c0('0x14')]=qs[_0x29c0('0x14')](_0x421878['query'][_0x29c0('0x14')]);}return _0x534197[_0x29c0('0x46')](_0x18c3ca);}})['then'](function(_0x393095){if(_0x393095){return _0x393095?{'count':_0x41751e,'rows':_0x393095}:null;}})[_0x29c0('0x1c')](respondWithResult(_0x3c85b4,null))['catch'](handleError(_0x3c85b4,null));};exports['getDescriptions']=function(_0x566054,_0x338a93,_0x1aecd7){var _0x160401={};var _0x351739={};var _0x465e59;var _0x1f3b68;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x566054[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x338a93,null))[_0x29c0('0x1c')](function(_0x21b02d){if(_0x21b02d){_0x465e59=_0x21b02d;_0x351739[_0x29c0('0x2a')]=_[_0x29c0('0x3d')](db[_0x29c0('0x44')][_0x29c0('0x25')]);_0x351739[_0x29c0('0x27')]=_[_0x29c0('0x3d')](_0x566054[_0x29c0('0x27')]);_0x351739[_0x29c0('0x28')]=_[_0x29c0('0x29')](_0x351739[_0x29c0('0x2a')],_0x351739['query']);_0x160401[_0x29c0('0x2c')]=_[_0x29c0('0x29')](_0x351739[_0x29c0('0x2a')],qs[_0x29c0('0x2b')](_0x566054[_0x29c0('0x27')][_0x29c0('0x2b')]));_0x160401[_0x29c0('0x2c')]=_0x160401[_0x29c0('0x2c')][_0x29c0('0x2d')]?_0x160401[_0x29c0('0x2c')]:_0x351739[_0x29c0('0x2a')];_0x160401[_0x29c0('0x2f')]=qs[_0x29c0('0x30')](_0x566054[_0x29c0('0x27')][_0x29c0('0x30')]);_0x160401[_0x29c0('0x31')]=qs['filters'](_[_0x29c0('0x32')](_0x566054[_0x29c0('0x27')],_0x351739[_0x29c0('0x28')]));if(_0x566054['query']['filter']){_0x160401[_0x29c0('0x31')]=_[_0x29c0('0x35')](_0x160401['where'],{'$or':_[_0x29c0('0x23')](_0x160401[_0x29c0('0x2c')],function(_0x5d2d49){var _0x1a44ad={};_0x1a44ad[_0x5d2d49]={'$like':'%'+_0x566054[_0x29c0('0x27')][_0x29c0('0x33')]+'%'};return _0x1a44ad;})});}_0x160401=_[_0x29c0('0x35')]({},_0x160401,_0x566054[_0x29c0('0x3e')]);return _0x465e59[_0x29c0('0x47')](_0x160401);}})[_0x29c0('0x1c')](function(_0x40f857){if(_0x40f857){_0x1f3b68=_0x40f857[_0x29c0('0x2d')];if(!_0x566054['query'][_0x29c0('0x2e')](_0x29c0('0x45'))){_0x160401[_0x29c0('0x16')]=qs['limit'](_0x566054[_0x29c0('0x27')][_0x29c0('0x16')]);_0x160401[_0x29c0('0x14')]=qs[_0x29c0('0x14')](_0x566054[_0x29c0('0x27')][_0x29c0('0x14')]);}return _0x465e59[_0x29c0('0x47')](_0x160401);}})[_0x29c0('0x1c')](function(_0x313417){if(_0x313417){return _0x313417?{'count':_0x1f3b68,'rows':_0x313417}:null;}})['then'](respondWithResult(_0x338a93,null))[_0x29c0('0x3a')](handleError(_0x338a93,null));};exports['getTags']=function(_0x141185,_0x5ef85f,_0x586b53){var _0x556625={};var _0x5ad8ec={};var _0x5ed366;var _0x1b787a;return db[_0x29c0('0x24')][_0x29c0('0x43')]({'where':{'id':_0x141185[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x5ef85f,null))[_0x29c0('0x1c')](function(_0x4ef893){if(_0x4ef893){_0x5ed366=_0x4ef893;_0x5ad8ec[_0x29c0('0x2a')]=_[_0x29c0('0x3d')](db['Tag']['rawAttributes']);_0x5ad8ec[_0x29c0('0x27')]=_[_0x29c0('0x3d')](_0x141185['query']);_0x5ad8ec['filters']=_[_0x29c0('0x29')](_0x5ad8ec[_0x29c0('0x2a')],_0x5ad8ec[_0x29c0('0x27')]);_0x556625['attributes']=_['intersection'](_0x5ad8ec['model'],qs[_0x29c0('0x2b')](_0x141185[_0x29c0('0x27')][_0x29c0('0x2b')]));_0x556625[_0x29c0('0x2c')]=_0x556625[_0x29c0('0x2c')][_0x29c0('0x2d')]?_0x556625[_0x29c0('0x2c')]:_0x5ad8ec['model'];_0x556625[_0x29c0('0x2f')]=qs[_0x29c0('0x30')](_0x141185[_0x29c0('0x27')][_0x29c0('0x30')]);_0x556625[_0x29c0('0x31')]=qs['filters'](_[_0x29c0('0x32')](_0x141185[_0x29c0('0x27')],_0x5ad8ec[_0x29c0('0x28')]));if(_0x141185['query'][_0x29c0('0x33')]){_0x556625[_0x29c0('0x31')]=_[_0x29c0('0x35')](_0x556625[_0x29c0('0x31')],{'$or':_[_0x29c0('0x23')](_0x556625[_0x29c0('0x2c')],function(_0x442f39){var _0x25aec7={};_0x25aec7[_0x442f39]={'$like':'%'+_0x141185['query'][_0x29c0('0x33')]+'%'};return _0x25aec7;})});}_0x556625=_[_0x29c0('0x35')]({},_0x556625,_0x141185[_0x29c0('0x3e')]);return _0x5ed366[_0x29c0('0x48')](_0x556625);}})[_0x29c0('0x1c')](function(_0x2a2203){if(_0x2a2203){_0x1b787a=_0x2a2203[_0x29c0('0x2d')];if(!_0x141185[_0x29c0('0x27')]['hasOwnProperty'](_0x29c0('0x45'))){_0x556625[_0x29c0('0x16')]=qs[_0x29c0('0x16')](_0x141185[_0x29c0('0x27')][_0x29c0('0x16')]);_0x556625[_0x29c0('0x14')]=qs[_0x29c0('0x14')](_0x141185['query'][_0x29c0('0x14')]);}return _0x5ed366[_0x29c0('0x48')](_0x556625);}})[_0x29c0('0x1c')](function(_0x44607c){if(_0x44607c){return _0x44607c?{'count':_0x1b787a,'rows':_0x44607c}:null;}})[_0x29c0('0x1c')](respondWithResult(_0x5ef85f,null))['catch'](handleError(_0x5ef85f,null));};exports[_0x29c0('0x49')]=function(_0x2c2b48,_0x59a708,_0x98a81e){if(_0x2c2b48[_0x29c0('0x41')]['id']){delete _0x2c2b48[_0x29c0('0x41')]['id'];}return db['FreshdeskConfiguration'][_0x29c0('0x43')]({'where':{'id':_0x2c2b48[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x59a708,null))[_0x29c0('0x1c')](function(_0x376e2f){if(_0x376e2f){return _0x376e2f[_0x29c0('0x49')](_0x2c2b48[_0x29c0('0x41')][_0x29c0('0x4a')]||[]);}return null;})[_0x29c0('0x1c')](respondWithResult(_0x59a708,null))[_0x29c0('0x3a')](handleError(_0x59a708,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3ead05e..66a503d 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37e4=['define','FreshdeskConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskConfiguration.attributes','exports'];(function(_0x35a633,_0x2ec579){var _0x23aa38=function(_0x204972){while(--_0x204972){_0x35a633['push'](_0x35a633['shift']());}};_0x23aa38(++_0x2ec579);}(_0x37e4,0x1e6));var _0x437e=function(_0x1dd272,_0x343ad0){_0x1dd272=_0x1dd272-0x0;var _0x40061a=_0x37e4[_0x1dd272];return _0x40061a;};'use strict';var _=require(_0x437e('0x0'));var util=require('util');var logger=require(_0x437e('0x1'))(_0x437e('0x2'));var moment=require(_0x437e('0x3'));var BPromise=require(_0x437e('0x4'));var rp=require(_0x437e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x437e('0x6'));var config=require('../../config/environment');var attributes=require(_0x437e('0x7'));module[_0x437e('0x8')]=function(_0x45ab5b,_0x5acde4){return _0x45ab5b[_0x437e('0x9')](_0x437e('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb73e=['int_freshdesk_configurations','lodash','util','../../config/logger','api','rimraf','../../config/environment','exports','FreshdeskConfiguration'];(function(_0xa0a2e0,_0x4b6fdd){var _0x6a4a9a=function(_0x30e988){while(--_0x30e988){_0xa0a2e0['push'](_0xa0a2e0['shift']());}};_0x6a4a9a(++_0x4b6fdd);}(_0xb73e,0x7f));var _0xeb73=function(_0x7459fe,_0x1024a0){_0x7459fe=_0x7459fe-0x0;var _0x2f698d=_0xb73e[_0x7459fe];return _0x2f698d;};'use strict';var _=require(_0xeb73('0x0'));var util=require(_0xeb73('0x1'));var logger=require(_0xeb73('0x2'))(_0xeb73('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeb73('0x4'));var config=require(_0xeb73('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xeb73('0x6')]=function(_0x4993d8,_0x44fa53){return _0x4993d8['define'](_0xeb73('0x7'),attributes,{'tableName':_0xeb73('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index b553d78..215dac2 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x926b=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x44257f,_0x50b73c){var _0x153a90=function(_0x163a5b){while(--_0x163a5b){_0x44257f['push'](_0x44257f['shift']());}};_0x153a90(++_0x50b73c);}(_0x926b,0x162));var _0xb926=function(_0x2e252d,_0x1b07b8){_0x2e252d=_0x2e252d-0x0;var _0x5e3be9=_0x926b[_0x2e252d];return _0x5e3be9;};'use strict';var _=require(_0xb926('0x0'));var util=require('util');var moment=require(_0xb926('0x1'));var BPromise=require(_0xb926('0x2'));var rs=require(_0xb926('0x3'));var fs=require('fs');var Redis=require(_0xb926('0x4'));var db=require(_0xb926('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb926('0x6'))(_0xb926('0x7'));var config=require(_0xb926('0x8'));var jayson=require(_0xb926('0x9'));var client=jayson[_0xb926('0xa')][_0xb926('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c2383,_0xae4ca0,_0x6c2bab){return new BPromise(function(_0x493c01,_0x23939d){return client[_0xb926('0xc')](_0x4c2383,_0x6c2bab)[_0xb926('0xd')](function(_0x34e08d){logger[_0xb926('0xe')](_0xb926('0xf'),_0xae4ca0,_0xb926('0x10'));logger[_0xb926('0x11')](_0xb926('0x12'),_0xae4ca0,_0xb926('0x10'),JSON[_0xb926('0x13')](_0x34e08d));if(_0x34e08d[_0xb926('0x14')]){if(_0x34e08d[_0xb926('0x14')][_0xb926('0x15')]===0x1f4){logger[_0xb926('0x14')](_0xb926('0xf'),_0xae4ca0,_0x34e08d[_0xb926('0x14')][_0xb926('0x16')]);return _0x23939d(_0x34e08d[_0xb926('0x14')][_0xb926('0x16')]);}logger[_0xb926('0x14')](_0xb926('0xf'),_0xae4ca0,_0x34e08d['error'][_0xb926('0x16')]);return _0x493c01(_0x34e08d[_0xb926('0x14')]['message']);}else{logger[_0xb926('0xe')](_0xb926('0xf'),_0xae4ca0,'request\x20sent');_0x493c01(_0x34e08d[_0xb926('0x17')]['message']);}})[_0xb926('0x18')](function(_0x16d9ed){logger[_0xb926('0x14')](_0xb926('0xf'),_0xae4ca0,_0x16d9ed);_0x23939d(_0x16d9ed);});});} \ No newline at end of file +var _0x5cbe=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0x3a2fc9,_0x526677){var _0x2e0e54=function(_0x3de021){while(--_0x3de021){_0x3a2fc9['push'](_0x3a2fc9['shift']());}};_0x2e0e54(++_0x526677);}(_0x5cbe,0x182));var _0xe5cb=function(_0x41141c,_0x6b1368){_0x41141c=_0x41141c-0x0;var _0x58adc5=_0x5cbe[_0x41141c];return _0x58adc5;};'use strict';var _=require(_0xe5cb('0x0'));var util=require(_0xe5cb('0x1'));var moment=require(_0xe5cb('0x2'));var BPromise=require(_0xe5cb('0x3'));var rs=require(_0xe5cb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5cb('0x5'))['db'];var utils=require(_0xe5cb('0x6'));var logger=require(_0xe5cb('0x7'))('rpc');var config=require(_0xe5cb('0x8'));var jayson=require(_0xe5cb('0x9'));var client=jayson[_0xe5cb('0xa')][_0xe5cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fb14c,_0x43cfdb,_0x136221){return new BPromise(function(_0x415b28,_0x298153){return client[_0xe5cb('0xc')](_0x1fb14c,_0x136221)[_0xe5cb('0xd')](function(_0x1e945){logger[_0xe5cb('0xe')](_0xe5cb('0xf'),_0x43cfdb,'request\x20sent');logger[_0xe5cb('0x10')](_0xe5cb('0x11'),_0x43cfdb,'request\x20sent',JSON[_0xe5cb('0x12')](_0x1e945));if(_0x1e945[_0xe5cb('0x13')]){if(_0x1e945[_0xe5cb('0x13')]['code']===0x1f4){logger[_0xe5cb('0x13')](_0xe5cb('0xf'),_0x43cfdb,_0x1e945['error']['message']);return _0x298153(_0x1e945[_0xe5cb('0x13')]['message']);}logger[_0xe5cb('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x43cfdb,_0x1e945[_0xe5cb('0x13')][_0xe5cb('0x14')]);return _0x415b28(_0x1e945[_0xe5cb('0x13')][_0xe5cb('0x14')]);}else{logger[_0xe5cb('0xe')](_0xe5cb('0xf'),_0x43cfdb,_0xe5cb('0x15'));_0x415b28(_0x1e945[_0xe5cb('0x16')][_0xe5cb('0x14')]);}})[_0xe5cb('0x17')](function(_0x2dc0cb){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x43cfdb,_0x2dc0cb);_0x298153(_0x2dc0cb);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 7821d1e..6e51a1a 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31fc=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','/:id','show','create','put','isAuthenticated'];(function(_0x29291b,_0x5f3cae){var _0x41e36a=function(_0x23f5b1){while(--_0x23f5b1){_0x29291b['push'](_0x29291b['shift']());}};_0x41e36a(++_0x5f3cae);}(_0x31fc,0x145));var _0xc31f=function(_0x1d49da,_0x4b8203){_0x1d49da=_0x1d49da-0x0;var _0x206b1d=_0x31fc[_0x1d49da];return _0x206b1d;};'use strict';var multer=require(_0xc31f('0x0'));var util=require('util');var path=require(_0xc31f('0x1'));var timeout=require(_0xc31f('0x2'));var express=require(_0xc31f('0x3'));var router=express[_0xc31f('0x4')]();var fs_extra=require(_0xc31f('0x5'));var auth=require(_0xc31f('0x6'));var interaction=require(_0xc31f('0x7'));var config=require('../../config/environment');var controller=require(_0xc31f('0x8'));router[_0xc31f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc31f('0x9')](_0xc31f('0xa'),auth['isAuthenticated'](),controller[_0xc31f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc31f('0xc')]);router[_0xc31f('0xd')](_0xc31f('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc31f('0xa'),auth[_0xc31f('0xe')](),controller[_0xc31f('0xf')]);module[_0xc31f('0x10')]=router; \ No newline at end of file +var _0x3e93=['../../config/environment','./intFreshdeskField.controller','index','get','/:id','isAuthenticated','show','post','put','delete','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x88a98e,_0x56668b){var _0x23eede=function(_0x165899){while(--_0x165899){_0x88a98e['push'](_0x88a98e['shift']());}};_0x23eede(++_0x56668b);}(_0x3e93,0xda));var _0x33e9=function(_0x4029dc,_0x5c3bf1){_0x4029dc=_0x4029dc-0x0;var _0x4971e0=_0x3e93[_0x4029dc];return _0x4971e0;};'use strict';var multer=require(_0x33e9('0x0'));var util=require(_0x33e9('0x1'));var path=require(_0x33e9('0x2'));var timeout=require('connect-timeout');var express=require(_0x33e9('0x3'));var router=express['Router']();var fs_extra=require(_0x33e9('0x4'));var auth=require(_0x33e9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x33e9('0x6'));var controller=require(_0x33e9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x33e9('0x8')]);router[_0x33e9('0x9')](_0x33e9('0xa'),auth[_0x33e9('0xb')](),controller[_0x33e9('0xc')]);router[_0x33e9('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x33e9('0xe')](_0x33e9('0xa'),auth[_0x33e9('0xb')](),controller['update']);router[_0x33e9('0xf')](_0x33e9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7976ff2..c816cc5 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.attributes.js +++ b/server/api/intFreshdeskField/intFreshdeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7497=['string','keyValue','picklist','STRING','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7497,0x178));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x7749('0x0')]={'type':{'type':Sequelize[_0x7749('0x1')](_0x7749('0x2'),'variable','customVariable',_0x7749('0x3'),_0x7749('0x4')),'defaultValue':_0x7749('0x2')},'content':{'type':Sequelize[_0x7749('0x5')]},'key':{'type':Sequelize[_0x7749('0x5')]},'keyType':{'type':Sequelize[_0x7749('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x7749('0x5')]},'idField':{'type':Sequelize[_0x7749('0x5')]},'nameField':{'type':Sequelize[_0x7749('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9e63=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x36f896,_0x1a615b){var _0x267f0d=function(_0x2809e7){while(--_0x2809e7){_0x36f896['push'](_0x36f896['shift']());}};_0x267f0d(++_0x1a615b);}(_0x9e63,0x173));var _0x39e6=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x9e63[_0x934425];return _0x31d596;};'use strict';var Sequelize=require(_0x39e6('0x0'));module['exports']={'type':{'type':Sequelize[_0x39e6('0x1')](_0x39e6('0x2'),_0x39e6('0x3'),_0x39e6('0x4'),_0x39e6('0x5'),_0x39e6('0x6')),'defaultValue':_0x39e6('0x2')},'content':{'type':Sequelize[_0x39e6('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x39e6('0x2'),'variable',_0x39e6('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x39e6('0x7')]},'nameField':{'type':Sequelize[_0x39e6('0x7')]},'customField':{'type':Sequelize[_0x39e6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x39e6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 7920104..fb927f7 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.controller.js +++ b/server/api/intFreshdeskField/intFreshdeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd547=['offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','error','send','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','json'];(function(_0x2f0c4e,_0x1354da){var _0x55f193=function(_0xa12b2){while(--_0xa12b2){_0x2f0c4e['push'](_0x2f0c4e['shift']());}};_0x55f193(++_0x1354da);}(_0xd547,0x1c1));var _0x7d54=function(_0x465d8c,_0x101ece){_0x465d8c=_0x465d8c-0x0;var _0x28f93e=_0xd547[_0x465d8c];return _0x28f93e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d54('0x0'));var jsonpatch=require(_0x7d54('0x1'));var rp=require(_0x7d54('0x2'));var moment=require(_0x7d54('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d54('0x4'));var path=require('path');var sox=require(_0x7d54('0x5'));var csv=require('to-csv');var ejs=require(_0x7d54('0x6'));var fs=require('fs');var fs_extra=require(_0x7d54('0x7'));var _=require(_0x7d54('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d54('0x9'));var toCsv=require(_0x7d54('0xa'));var querystring=require('querystring');var Papa=require(_0x7d54('0xb'));var Redis=require('ioredis');var authService=require(_0x7d54('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x7d54('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d54('0xe'))(_0x7d54('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7d54('0x10'))['db'];function respondWithStatusCode(_0x3e8072,_0x428430){_0x428430=_0x428430||0xcc;return function(_0x4be6c5){if(_0x4be6c5){return _0x3e8072[_0x7d54('0x11')](_0x428430);}return _0x3e8072['status'](_0x428430)[_0x7d54('0x12')]();};}function respondWithResult(_0x5e46ee,_0x11c94a){_0x11c94a=_0x11c94a||0xc8;return function(_0x43718a){if(_0x43718a){return _0x5e46ee['status'](_0x11c94a)[_0x7d54('0x13')](_0x43718a);}};}function respondWithFilteredResult(_0x208b3c,_0x25b69c){return function(_0x5a6bec){if(_0x5a6bec){var _0x2b1b0f=typeof _0x25b69c[_0x7d54('0x14')]===_0x7d54('0x15')&&typeof _0x25b69c[_0x7d54('0x16')]===_0x7d54('0x15');var _0x22f27c=_0x5a6bec['count'];var _0x81971b=_0x2b1b0f?0x0:_0x25b69c[_0x7d54('0x14')];var _0x57e789=_0x2b1b0f?_0x5a6bec[_0x7d54('0x17')]:_0x25b69c['offset']+_0x25b69c['limit'];var _0x46a719;if(_0x57e789>=_0x22f27c){_0x57e789=_0x22f27c;_0x46a719=0xc8;}else{_0x46a719=0xce;}_0x208b3c[_0x7d54('0x18')](_0x46a719);return _0x208b3c[_0x7d54('0x19')](_0x7d54('0x1a'),_0x81971b+'-'+_0x57e789+'/'+_0x22f27c)['json'](_0x5a6bec);}return null;};}function patchUpdates(_0x23ea55){return function(_0x2b0770){try{jsonpatch['apply'](_0x2b0770,_0x23ea55,!![]);}catch(_0x22718f){return BPromise[_0x7d54('0x1b')](_0x22718f);}return _0x2b0770[_0x7d54('0x1c')]();};}function saveUpdates(_0x6cc88b,_0x715a4e){return function(_0x4fe2cb){if(_0x4fe2cb){return _0x4fe2cb[_0x7d54('0x1d')](_0x6cc88b)['then'](function(_0x589f93){return _0x589f93;});}return null;};}function removeEntity(_0x5e0c4b,_0x2967b0){return function(_0x299f6e){if(_0x299f6e){return _0x299f6e['destroy']()[_0x7d54('0x1e')](function(){_0x5e0c4b[_0x7d54('0x18')](0xcc)[_0x7d54('0x12')]();});}};}function handleEntityNotFound(_0x19520a,_0x3b611f){return function(_0x6d0375){if(!_0x6d0375){_0x19520a[_0x7d54('0x11')](0x194);}return _0x6d0375;};}function handleError(_0x372f14,_0x509b8f){_0x509b8f=_0x509b8f||0x1f4;return function(_0x2818b6){logger[_0x7d54('0x1f')](_0x2818b6['stack']);if(_0x2818b6['name']){delete _0x2818b6['name'];}_0x372f14['status'](_0x509b8f)[_0x7d54('0x20')](_0x2818b6);};}exports[_0x7d54('0x21')]=function(_0x57e2ce,_0x32df83){var _0x252017={},_0x4a8488={},_0x472032={'count':0x0,'rows':[]};var _0x425a47=_[_0x7d54('0x22')](db[_0x7d54('0x23')][_0x7d54('0x24')],function(_0x2f1052){return{'name':_0x2f1052[_0x7d54('0x25')],'type':_0x2f1052[_0x7d54('0x26')]['key']};});_0x4a8488[_0x7d54('0x27')]=_['map'](_0x425a47,'name');_0x4a8488[_0x7d54('0x28')]=_[_0x7d54('0x29')](_0x57e2ce['query']);_0x4a8488[_0x7d54('0x2a')]=_[_0x7d54('0x2b')](_0x4a8488[_0x7d54('0x27')],_0x4a8488[_0x7d54('0x28')]);_0x252017[_0x7d54('0x2c')]=_[_0x7d54('0x2b')](_0x4a8488[_0x7d54('0x27')],qs['fields'](_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x2d')]));_0x252017['attributes']=_0x252017[_0x7d54('0x2c')][_0x7d54('0x2e')]?_0x252017[_0x7d54('0x2c')]:_0x4a8488['model'];if(!_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x2f')](_0x7d54('0x30'))){_0x252017[_0x7d54('0x16')]=qs[_0x7d54('0x16')](_0x57e2ce['query'][_0x7d54('0x16')]);_0x252017[_0x7d54('0x14')]=qs['offset'](_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x14')]);}_0x252017[_0x7d54('0x31')]=qs[_0x7d54('0x32')](_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x32')]);_0x252017[_0x7d54('0x33')]=qs[_0x7d54('0x2a')](_[_0x7d54('0x34')](_0x57e2ce[_0x7d54('0x28')],_0x4a8488[_0x7d54('0x2a')]),_0x425a47);if(_0x57e2ce[_0x7d54('0x28')]['filter']){_0x252017['where']=_[_0x7d54('0x35')](_0x252017[_0x7d54('0x33')],{'$or':_[_0x7d54('0x22')](_0x425a47,function(_0x624b65){if(_0x624b65['type']!=='VIRTUAL'){var _0x114531={};_0x114531[_0x624b65['name']]={'$like':'%'+_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x36')]+'%'};return _0x114531;}})});}_0x252017=_['merge']({},_0x252017,_0x57e2ce['options']);var _0x20c2ed={'where':_0x252017[_0x7d54('0x33')]};return db['FreshdeskField'][_0x7d54('0x17')](_0x20c2ed)[_0x7d54('0x1e')](function(_0x5adae8){_0x472032['count']=_0x5adae8;if(_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x37')]){_0x252017[_0x7d54('0x38')]=[{'all':!![]}];}return db[_0x7d54('0x23')][_0x7d54('0x39')](_0x252017);})[_0x7d54('0x1e')](function(_0x17f951){_0x472032[_0x7d54('0x3a')]=_0x17f951;return _0x472032;})[_0x7d54('0x1e')](respondWithFilteredResult(_0x32df83,_0x252017))[_0x7d54('0x3b')](handleError(_0x32df83,null));};exports[_0x7d54('0x3c')]=function(_0x543096,_0x536946){var _0x395b0d={'raw':!![],'where':{'id':_0x543096[_0x7d54('0x3d')]['id']}},_0xd8cefd={};_0xd8cefd[_0x7d54('0x27')]=_[_0x7d54('0x29')](db[_0x7d54('0x23')][_0x7d54('0x24')]);_0xd8cefd['query']=_[_0x7d54('0x29')](_0x543096['query']);_0xd8cefd['filters']=_[_0x7d54('0x2b')](_0xd8cefd[_0x7d54('0x27')],_0xd8cefd[_0x7d54('0x28')]);_0x395b0d[_0x7d54('0x2c')]=_[_0x7d54('0x2b')](_0xd8cefd['model'],qs[_0x7d54('0x2d')](_0x543096[_0x7d54('0x28')]['fields']));_0x395b0d[_0x7d54('0x2c')]=_0x395b0d[_0x7d54('0x2c')][_0x7d54('0x2e')]?_0x395b0d[_0x7d54('0x2c')]:_0xd8cefd[_0x7d54('0x27')];if(_0x543096[_0x7d54('0x28')]['includeAll']){_0x395b0d[_0x7d54('0x38')]=[{'all':!![]}];}_0x395b0d=_[_0x7d54('0x35')]({},_0x395b0d,_0x543096[_0x7d54('0x3e')]);return db[_0x7d54('0x23')][_0x7d54('0x3f')](_0x395b0d)[_0x7d54('0x1e')](handleEntityNotFound(_0x536946,null))[_0x7d54('0x1e')](respondWithResult(_0x536946,null))['catch'](handleError(_0x536946,null));};exports[_0x7d54('0x40')]=function(_0x2ea2d0,_0x2cf5f0){return db[_0x7d54('0x23')][_0x7d54('0x40')](_0x2ea2d0['body'],{})[_0x7d54('0x1e')](respondWithResult(_0x2cf5f0,0xc9))['catch'](handleError(_0x2cf5f0,null));};exports[_0x7d54('0x1d')]=function(_0x560b42,_0x5b6449){if(_0x560b42[_0x7d54('0x41')]['id']){delete _0x560b42['body']['id'];}return db['FreshdeskField'][_0x7d54('0x3f')]({'where':{'id':_0x560b42[_0x7d54('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5b6449,null))[_0x7d54('0x1e')](saveUpdates(_0x560b42[_0x7d54('0x41')],null))[_0x7d54('0x1e')](respondWithResult(_0x5b6449,null))['catch'](handleError(_0x5b6449,null));};exports[_0x7d54('0x42')]=function(_0x57bb14,_0x16e23f){return db[_0x7d54('0x23')][_0x7d54('0x3f')]({'where':{'id':_0x57bb14[_0x7d54('0x3d')]['id']}})['then'](handleEntityNotFound(_0x16e23f,null))['then'](removeEntity(_0x16e23f,null))[_0x7d54('0x3b')](handleError(_0x16e23f,null));}; \ No newline at end of file +var _0x5712=['fieldName','type','query','keys','filters','intersection','attributes','model','fields','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','save','then','destroy','name','send','index','map','FreshdeskField','rawAttributes'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x5712,0x140));var _0x2571=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5712[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x2571('0x0'));var rimraf=require(_0x2571('0x1'));var zipdir=require(_0x2571('0x2'));var jsonpatch=require(_0x2571('0x3'));var rp=require(_0x2571('0x4'));var moment=require(_0x2571('0x5'));var BPromise=require(_0x2571('0x6'));var Mustache=require(_0x2571('0x7'));var util=require(_0x2571('0x8'));var path=require(_0x2571('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2571('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2571('0xb'));var squel=require(_0x2571('0xc'));var crypto=require(_0x2571('0xd'));var jsforce=require(_0x2571('0xe'));var deskjs=require(_0x2571('0xf'));var toCsv=require(_0x2571('0x10'));var querystring=require('querystring');var Papa=require(_0x2571('0x11'));var Redis=require('ioredis');var authService=require(_0x2571('0x12'));var qs=require(_0x2571('0x13'));var as=require(_0x2571('0x14'));var hardwareService=require(_0x2571('0x15'));var logger=require(_0x2571('0x16'))(_0x2571('0x17'));var utils=require(_0x2571('0x18'));var config=require(_0x2571('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33d3ed,_0x1ab846){_0x1ab846=_0x1ab846||0xcc;return function(_0x10823d){if(_0x10823d){return _0x33d3ed[_0x2571('0x1a')](_0x1ab846);}return _0x33d3ed[_0x2571('0x1b')](_0x1ab846)[_0x2571('0x1c')]();};}function respondWithResult(_0x241129,_0x130ab1){_0x130ab1=_0x130ab1||0xc8;return function(_0xdf8c3a){if(_0xdf8c3a){return _0x241129[_0x2571('0x1b')](_0x130ab1)[_0x2571('0x1d')](_0xdf8c3a);}};}function respondWithFilteredResult(_0x3c1a08,_0x5b0392){return function(_0x30b0f2){if(_0x30b0f2){var _0x47b5e9=typeof _0x5b0392['offset']==='undefined'&&typeof _0x5b0392['limit']===_0x2571('0x1e');var _0x371ae2=_0x30b0f2[_0x2571('0x1f')];var _0x75af2a=_0x47b5e9?0x0:_0x5b0392['offset'];var _0x7707=_0x47b5e9?_0x30b0f2[_0x2571('0x1f')]:_0x5b0392['offset']+_0x5b0392[_0x2571('0x20')];var _0x7303ad;if(_0x7707>=_0x371ae2){_0x7707=_0x371ae2;_0x7303ad=0xc8;}else{_0x7303ad=0xce;}_0x3c1a08[_0x2571('0x1b')](_0x7303ad);return _0x3c1a08[_0x2571('0x21')](_0x2571('0x22'),_0x75af2a+'-'+_0x7707+'/'+_0x371ae2)['json'](_0x30b0f2);}return null;};}function patchUpdates(_0x52da27){return function(_0x5fe030){try{jsonpatch[_0x2571('0x23')](_0x5fe030,_0x52da27,!![]);}catch(_0x58f6aa){return BPromise['reject'](_0x58f6aa);}return _0x5fe030[_0x2571('0x24')]();};}function saveUpdates(_0x2e7d89,_0x2218fb){return function(_0xb6dfa6){if(_0xb6dfa6){return _0xb6dfa6['update'](_0x2e7d89)[_0x2571('0x25')](function(_0x55ec06){return _0x55ec06;});}return null;};}function removeEntity(_0x1ec23c,_0x4316b1){return function(_0x5d6778){if(_0x5d6778){return _0x5d6778[_0x2571('0x26')]()[_0x2571('0x25')](function(){_0x1ec23c[_0x2571('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d455d,_0x77e02){return function(_0x1cbbdc){if(!_0x1cbbdc){_0x5d455d[_0x2571('0x1a')](0x194);}return _0x1cbbdc;};}function handleError(_0x1547d2,_0x2f5cae){_0x2f5cae=_0x2f5cae||0x1f4;return function(_0x246bbd){logger['error'](_0x246bbd['stack']);if(_0x246bbd[_0x2571('0x27')]){delete _0x246bbd[_0x2571('0x27')];}_0x1547d2[_0x2571('0x1b')](_0x2f5cae)[_0x2571('0x28')](_0x246bbd);};}exports[_0x2571('0x29')]=function(_0x165aa8,_0x3d5660){var _0x315dc1={},_0x1f7562={},_0xac59bc={'count':0x0,'rows':[]};var _0x5b3373=_[_0x2571('0x2a')](db[_0x2571('0x2b')][_0x2571('0x2c')],function(_0x441e7d){return{'name':_0x441e7d[_0x2571('0x2d')],'type':_0x441e7d[_0x2571('0x2e')]['key']};});_0x1f7562['model']=_[_0x2571('0x2a')](_0x5b3373,_0x2571('0x27'));_0x1f7562[_0x2571('0x2f')]=_[_0x2571('0x30')](_0x165aa8['query']);_0x1f7562[_0x2571('0x31')]=_[_0x2571('0x32')](_0x1f7562['model'],_0x1f7562['query']);_0x315dc1[_0x2571('0x33')]=_[_0x2571('0x32')](_0x1f7562[_0x2571('0x34')],qs['fields'](_0x165aa8[_0x2571('0x2f')][_0x2571('0x35')]));_0x315dc1['attributes']=_0x315dc1[_0x2571('0x33')]['length']?_0x315dc1[_0x2571('0x33')]:_0x1f7562[_0x2571('0x34')];if(!_0x165aa8[_0x2571('0x2f')]['hasOwnProperty']('nolimit')){_0x315dc1[_0x2571('0x20')]=qs['limit'](_0x165aa8[_0x2571('0x2f')][_0x2571('0x20')]);_0x315dc1[_0x2571('0x36')]=qs[_0x2571('0x36')](_0x165aa8['query'][_0x2571('0x36')]);}_0x315dc1[_0x2571('0x37')]=qs['sort'](_0x165aa8[_0x2571('0x2f')][_0x2571('0x38')]);_0x315dc1['where']=qs[_0x2571('0x31')](_[_0x2571('0x39')](_0x165aa8[_0x2571('0x2f')],_0x1f7562[_0x2571('0x31')]),_0x5b3373);if(_0x165aa8[_0x2571('0x2f')][_0x2571('0x3a')]){_0x315dc1[_0x2571('0x3b')]=_[_0x2571('0x3c')](_0x315dc1[_0x2571('0x3b')],{'$or':_[_0x2571('0x2a')](_0x5b3373,function(_0x379a45){if(_0x379a45[_0x2571('0x2e')]!==_0x2571('0x3d')){var _0x198f44={};_0x198f44[_0x379a45['name']]={'$like':'%'+_0x165aa8[_0x2571('0x2f')][_0x2571('0x3a')]+'%'};return _0x198f44;}})});}_0x315dc1=_[_0x2571('0x3c')]({},_0x315dc1,_0x165aa8[_0x2571('0x3e')]);var _0x158432={'where':_0x315dc1[_0x2571('0x3b')]};return db[_0x2571('0x2b')]['count'](_0x158432)[_0x2571('0x25')](function(_0x15c610){_0xac59bc[_0x2571('0x1f')]=_0x15c610;if(_0x165aa8['query'][_0x2571('0x3f')]){_0x315dc1[_0x2571('0x40')]=[{'all':!![]}];}return db[_0x2571('0x2b')]['findAll'](_0x315dc1);})[_0x2571('0x25')](function(_0x1c6ccd){_0xac59bc[_0x2571('0x41')]=_0x1c6ccd;return _0xac59bc;})[_0x2571('0x25')](respondWithFilteredResult(_0x3d5660,_0x315dc1))[_0x2571('0x42')](handleError(_0x3d5660,null));};exports[_0x2571('0x43')]=function(_0x3a817a,_0x45fdd9){var _0x3d4004={'raw':!![],'where':{'id':_0x3a817a[_0x2571('0x44')]['id']}},_0x5d2734={};_0x5d2734[_0x2571('0x34')]=_[_0x2571('0x30')](db[_0x2571('0x2b')][_0x2571('0x2c')]);_0x5d2734[_0x2571('0x2f')]=_[_0x2571('0x30')](_0x3a817a[_0x2571('0x2f')]);_0x5d2734['filters']=_['intersection'](_0x5d2734['model'],_0x5d2734['query']);_0x3d4004['attributes']=_['intersection'](_0x5d2734[_0x2571('0x34')],qs[_0x2571('0x35')](_0x3a817a['query'][_0x2571('0x35')]));_0x3d4004[_0x2571('0x33')]=_0x3d4004[_0x2571('0x33')][_0x2571('0x45')]?_0x3d4004[_0x2571('0x33')]:_0x5d2734['model'];if(_0x3a817a['query']['includeAll']){_0x3d4004[_0x2571('0x40')]=[{'all':!![]}];}_0x3d4004=_[_0x2571('0x3c')]({},_0x3d4004,_0x3a817a[_0x2571('0x3e')]);return db[_0x2571('0x2b')][_0x2571('0x46')](_0x3d4004)[_0x2571('0x25')](handleEntityNotFound(_0x45fdd9,null))[_0x2571('0x25')](respondWithResult(_0x45fdd9,null))['catch'](handleError(_0x45fdd9,null));};exports[_0x2571('0x47')]=function(_0x20189c,_0x1642a8){return db['FreshdeskField'][_0x2571('0x47')](_0x20189c[_0x2571('0x48')],{})[_0x2571('0x25')](respondWithResult(_0x1642a8,0xc9))[_0x2571('0x42')](handleError(_0x1642a8,null));};exports['update']=function(_0x18291c,_0x245edb){if(_0x18291c[_0x2571('0x48')]['id']){delete _0x18291c[_0x2571('0x48')]['id'];}return db['FreshdeskField'][_0x2571('0x46')]({'where':{'id':_0x18291c[_0x2571('0x44')]['id']}})[_0x2571('0x25')](handleEntityNotFound(_0x245edb,null))[_0x2571('0x25')](saveUpdates(_0x18291c[_0x2571('0x48')],null))['then'](respondWithResult(_0x245edb,null))[_0x2571('0x42')](handleError(_0x245edb,null));};exports[_0x2571('0x26')]=function(_0x20302b,_0x1d2e36){return db[_0x2571('0x2b')][_0x2571('0x46')]({'where':{'id':_0x20302b['params']['id']}})['then'](handleEntityNotFound(_0x1d2e36,null))[_0x2571('0x25')](removeEntity(_0x1d2e36,null))['catch'](handleError(_0x1d2e36,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index c1ecd81..9cd1379 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.model.js +++ b/server/api/intFreshdeskField/intFreshdeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49a4=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x2730ca,_0x400760){var _0x1e10b5=function(_0x6f43dd){while(--_0x6f43dd){_0x2730ca['push'](_0x2730ca['shift']());}};_0x1e10b5(++_0x400760);}(_0x49a4,0x149));var _0x449a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49a4[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x449a('0x0'));var moment=require(_0x449a('0x1'));var BPromise=require(_0x449a('0x2'));var rp=require(_0x449a('0x3'));var fs=require('fs');var path=require(_0x449a('0x4'));var rimraf=require(_0x449a('0x5'));var config=require(_0x449a('0x6'));var attributes=require(_0x449a('0x7'));module[_0x449a('0x8')]=function(_0x43b56e,_0x37c157){return _0x43b56e['define']('FreshdeskField',attributes,{'tableName':_0x449a('0x9'),'paranoid':![],'indexes':[{'name':_0x449a('0xa'),'fields':[_0x449a('0xb'),_0x449a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd164=['idField','FieldId','util','../../config/logger','api','request-promise','path','../../config/environment','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x2ef1de,_0x568cfa){var _0x57e525=function(_0x2cf566){while(--_0x2cf566){_0x2ef1de['push'](_0x2ef1de['shift']());}};_0x57e525(++_0x568cfa);}(_0xd164,0x9e));var _0x4d16=function(_0x26db68,_0x4d956d){_0x26db68=_0x26db68-0x0;var _0x5f0c21=_0xd164[_0x26db68];return _0x5f0c21;};'use strict';var _=require('lodash');var util=require(_0x4d16('0x0'));var logger=require(_0x4d16('0x1'))(_0x4d16('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d16('0x3'));var fs=require('fs');var path=require(_0x4d16('0x4'));var rimraf=require('rimraf');var config=require(_0x4d16('0x5'));var attributes=require('./intFreshdeskField.attributes');module[_0x4d16('0x6')]=function(_0x1f7c27,_0x49bd1e){return _0x1f7c27['define'](_0x4d16('0x7'),attributes,{'tableName':_0x4d16('0x8'),'paranoid':![],'indexes':[{'name':_0x4d16('0x9'),'fields':[_0x4d16('0xa'),_0x4d16('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index d850a05..c2627c3 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a2c=['debug','stringify','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','FreshdeskField,\x20%s,\x20%s'];(function(_0x40435d,_0x27e3ff){var _0x3f76b4=function(_0x20ddb9){while(--_0x20ddb9){_0x40435d['push'](_0x40435d['shift']());}};_0x3f76b4(++_0x27e3ff);}(_0x8a2c,0x7f));var _0xc8a2=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x8a2c[_0x28aea5];return _0x6a55f9;};'use strict';var _=require('lodash');var util=require(_0xc8a2('0x0'));var moment=require(_0xc8a2('0x1'));var BPromise=require(_0xc8a2('0x2'));var rs=require(_0xc8a2('0x3'));var fs=require('fs');var Redis=require(_0xc8a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8a2('0x5'));var logger=require(_0xc8a2('0x6'))(_0xc8a2('0x7'));var config=require(_0xc8a2('0x8'));var jayson=require(_0xc8a2('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1cbcef,_0x549ba9,_0x299e5e){return new BPromise(function(_0x490e39,_0x26aea6){return client[_0xc8a2('0xa')](_0x1cbcef,_0x299e5e)['then'](function(_0x44b3d5){logger[_0xc8a2('0xb')](_0xc8a2('0xc'),_0x549ba9,'request\x20sent');logger[_0xc8a2('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x549ba9,'request\x20sent',JSON[_0xc8a2('0xe')](_0x44b3d5));if(_0x44b3d5[_0xc8a2('0xf')]){if(_0x44b3d5[_0xc8a2('0xf')]['code']===0x1f4){logger[_0xc8a2('0xf')](_0xc8a2('0xc'),_0x549ba9,_0x44b3d5[_0xc8a2('0xf')][_0xc8a2('0x10')]);return _0x26aea6(_0x44b3d5[_0xc8a2('0xf')][_0xc8a2('0x10')]);}logger[_0xc8a2('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x549ba9,_0x44b3d5['error'][_0xc8a2('0x10')]);return _0x490e39(_0x44b3d5[_0xc8a2('0xf')][_0xc8a2('0x10')]);}else{logger[_0xc8a2('0xb')](_0xc8a2('0xc'),_0x549ba9,_0xc8a2('0x11'));_0x490e39(_0x44b3d5[_0xc8a2('0x12')][_0xc8a2('0x10')]);}})[_0xc8a2('0x13')](function(_0x309ac9){logger[_0xc8a2('0xf')](_0xc8a2('0xc'),_0x549ba9,_0x309ac9);_0x26aea6(_0x309ac9);});});} \ No newline at end of file +var _0xdb45=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xdb45,0x1da));var _0x5db4=function(_0x31163d,_0x215b95){_0x31163d=_0x31163d-0x0;var _0x4acb12=_0xdb45[_0x31163d];return _0x4acb12;};'use strict';var _=require(_0x5db4('0x0'));var util=require(_0x5db4('0x1'));var moment=require(_0x5db4('0x2'));var BPromise=require(_0x5db4('0x3'));var rs=require(_0x5db4('0x4'));var fs=require('fs');var Redis=require(_0x5db4('0x5'));var db=require(_0x5db4('0x6'))['db'];var utils=require(_0x5db4('0x7'));var logger=require(_0x5db4('0x8'))(_0x5db4('0x9'));var config=require(_0x5db4('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5db4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f2b65,_0x4438b0,_0x4c3a0f){return new BPromise(function(_0x1231cf,_0x15420a){return client[_0x5db4('0xc')](_0x1f2b65,_0x4c3a0f)[_0x5db4('0xd')](function(_0x52ce93){logger[_0x5db4('0xe')](_0x5db4('0xf'),_0x4438b0,'request\x20sent');logger[_0x5db4('0x10')](_0x5db4('0x11'),_0x4438b0,_0x5db4('0x12'),JSON['stringify'](_0x52ce93));if(_0x52ce93[_0x5db4('0x13')]){if(_0x52ce93[_0x5db4('0x13')][_0x5db4('0x14')]===0x1f4){logger[_0x5db4('0x13')](_0x5db4('0xf'),_0x4438b0,_0x52ce93[_0x5db4('0x13')]['message']);return _0x15420a(_0x52ce93['error']['message']);}logger[_0x5db4('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x4438b0,_0x52ce93[_0x5db4('0x13')][_0x5db4('0x15')]);return _0x1231cf(_0x52ce93[_0x5db4('0x13')]['message']);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x4438b0,_0x5db4('0x12'));_0x1231cf(_0x52ce93[_0x5db4('0x16')][_0x5db4('0x15')]);}})[_0x5db4('0x17')](function(_0x5c1095){logger[_0x5db4('0x13')](_0x5db4('0xf'),_0x4438b0,_0x5c1095);_0x15420a(_0x5c1095);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 726a22f..b1fabd2 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x3391c4,_0x38627b){var _0x1d8c22=function(_0x58ce31){while(--_0x58ce31){_0x3391c4['push'](_0x3391c4['shift']());}};_0x1d8c22(++_0x38627b);}(_0xe706,0xa3));var _0x6e70=function(_0x1cb73e,_0xce62f4){_0x1cb73e=_0x1cb73e-0x0;var _0x5c1e4c=_0xe706[_0x1cb73e];return _0x5c1e4c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')]('/',auth[_0x6e70('0xb')](),controller['create']);router['post'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x18')]=router; \ No newline at end of file +var _0x80ed=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','path'];(function(_0x1172c0,_0x4de4e0){var _0x3dc00b=function(_0x74a578){while(--_0x74a578){_0x1172c0['push'](_0x1172c0['shift']());}};_0x3dc00b(++_0x4de4e0);}(_0x80ed,0x11c));var _0xd80e=function(_0xb96f0b,_0x375b3c){_0xb96f0b=_0xb96f0b-0x0;var _0x1e0167=_0x80ed[_0xb96f0b];return _0x1e0167;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getFields']);router[_0xd80e('0x10')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x10')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x12')]);router[_0xd80e('0x13')](_0xd80e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd80e('0x9')](),controller[_0xd80e('0x14')]);module[_0xd80e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 5b4d438..1379a8e 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['username','remoteUri','STRING'];(function(_0x16cb03,_0x43ea58){var _0x10944e=function(_0x27ebaa){while(--_0x27ebaa){_0x16cb03['push'](_0x16cb03['shift']());}};_0x10944e(++_0x43ea58);}(_0x524e,0x15e));var _0xe524=function(_0x414b0c,_0x23daab){_0x414b0c=_0x414b0c-0x0;var _0x834510=_0x524e[_0x414b0c];return _0x834510;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'apiKey':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xfef3=['sequelize','STRING','username','remoteUri'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xfef3,0x118));var _0x3fef=function(_0x4ce2f4,_0x5e3d4a){_0x4ce2f4=_0x4ce2f4-0x0;var _0x13145e=_0xfef3[_0x4ce2f4];return _0x13145e;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index ae20c85..31418ab 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3de=['reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','FreshsalesConfiguration','pick','addConfiguration','findOne','getSubjects','channel','getDescriptions','FreshsalesField','Subjects','Descriptions','username','remoteUri','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x33b44c,_0x16b582){var _0x93dfa4=function(_0x47be0e){while(--_0x47be0e){_0x33b44c['push'](_0x33b44c['shift']());}};_0x93dfa4(++_0x16b582);}(_0xc3de,0x17a));var _0xec3d=function(_0x61c5b8,_0x25ce48){_0x61c5b8=_0x61c5b8-0x0;var _0x1d8943=_0xc3de[_0x61c5b8];return _0x1d8943;};'use strict';var emlformat=require(_0xec3d('0x0'));var rimraf=require(_0xec3d('0x1'));var zipdir=require(_0xec3d('0x2'));var jsonpatch=require(_0xec3d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xec3d('0x4'));var Mustache=require('mustache');var util=require(_0xec3d('0x5'));var path=require(_0xec3d('0x6'));var sox=require(_0xec3d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec3d('0x8'));var squel=require(_0xec3d('0x9'));var crypto=require(_0xec3d('0xa'));var jsforce=require(_0xec3d('0xb'));var deskjs=require(_0xec3d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xec3d('0xd'));var Papa=require(_0xec3d('0xe'));var Redis=require(_0xec3d('0xf'));var authService=require(_0xec3d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec3d('0x11'));var logger=require(_0xec3d('0x12'))(_0xec3d('0x13'));var utils=require(_0xec3d('0x14'));var config=require(_0xec3d('0x15'));var licenseUtil=require(_0xec3d('0x16'));var db=require(_0xec3d('0x17'))['db'];var integrations=require(_0xec3d('0x18'));function respondWithStatusCode(_0x49da1d,_0x594e17){_0x594e17=_0x594e17||0xcc;return function(_0x472db6){if(_0x472db6){return _0x49da1d['sendStatus'](_0x594e17);}return _0x49da1d[_0xec3d('0x19')](_0x594e17)['end']();};}function respondWithResult(_0x473a4b,_0x1406eb){_0x1406eb=_0x1406eb||0xc8;return function(_0x43f342){if(_0x43f342){return _0x473a4b['status'](_0x1406eb)[_0xec3d('0x1a')](_0x43f342);}};}function respondWithFilteredResult(_0x4a2fa1,_0x3616ee){return function(_0x242130){if(_0x242130){var _0x1c7651=typeof _0x3616ee[_0xec3d('0x1b')]===_0xec3d('0x1c')&&typeof _0x3616ee[_0xec3d('0x1d')]==='undefined';var _0x50d3d4=_0x242130[_0xec3d('0x1e')];var _0x1e7db8=_0x1c7651?0x0:_0x3616ee[_0xec3d('0x1b')];var _0x9923ab=_0x1c7651?_0x242130['count']:_0x3616ee[_0xec3d('0x1b')]+_0x3616ee[_0xec3d('0x1d')];var _0x486058;if(_0x9923ab>=_0x50d3d4){_0x9923ab=_0x50d3d4;_0x486058=0xc8;}else{_0x486058=0xce;}_0x4a2fa1[_0xec3d('0x19')](_0x486058);return _0x4a2fa1[_0xec3d('0x1f')](_0xec3d('0x20'),_0x1e7db8+'-'+_0x9923ab+'/'+_0x50d3d4)['json'](_0x242130);}return null;};}function patchUpdates(_0x5a612c){return function(_0xccbf3){try{jsonpatch[_0xec3d('0x21')](_0xccbf3,_0x5a612c,!![]);}catch(_0x54d9bd){return BPromise[_0xec3d('0x22')](_0x54d9bd);}return _0xccbf3[_0xec3d('0x23')]();};}function saveUpdates(_0x4fd1c8,_0x517839){return function(_0x330ff4){if(_0x330ff4){return _0x330ff4[_0xec3d('0x24')](_0x4fd1c8)['then'](function(_0x1a21af){return _0x1a21af;});}return null;};}function removeEntity(_0x422e0c,_0x31e99e){return function(_0x3e4faf){if(_0x3e4faf){return _0x3e4faf[_0xec3d('0x25')]()[_0xec3d('0x26')](function(){_0x422e0c['status'](0xcc)[_0xec3d('0x27')]();});}};}function handleEntityNotFound(_0x36380f,_0xeb6c34){return function(_0x7a8d13){if(!_0x7a8d13){_0x36380f[_0xec3d('0x28')](0x194);}return _0x7a8d13;};}function handleError(_0x49e315,_0x30e1ee){_0x30e1ee=_0x30e1ee||0x1f4;return function(_0x186bf0){logger[_0xec3d('0x29')](_0x186bf0[_0xec3d('0x2a')]);if(_0x186bf0[_0xec3d('0x2b')]){delete _0x186bf0[_0xec3d('0x2b')];}_0x49e315[_0xec3d('0x19')](_0x30e1ee)[_0xec3d('0x2c')](_0x186bf0);};}exports['index']=function(_0x3d2e4f,_0x4b49b4){var _0x182c66={},_0xacfc83={},_0x298bd1={'count':0x0,'rows':[]};var _0x264f44=_[_0xec3d('0x2d')](db[_0xec3d('0x2e')][_0xec3d('0x2f')],function(_0x2bdc4b){return{'name':_0x2bdc4b[_0xec3d('0x30')],'type':_0x2bdc4b[_0xec3d('0x31')]['key']};});_0xacfc83[_0xec3d('0x32')]=_[_0xec3d('0x2d')](_0x264f44,_0xec3d('0x2b'));_0xacfc83[_0xec3d('0x33')]=_[_0xec3d('0x34')](_0x3d2e4f[_0xec3d('0x33')]);_0xacfc83[_0xec3d('0x35')]=_[_0xec3d('0x36')](_0xacfc83[_0xec3d('0x32')],_0xacfc83[_0xec3d('0x33')]);_0x182c66[_0xec3d('0x37')]=_['intersection'](_0xacfc83[_0xec3d('0x32')],qs[_0xec3d('0x38')](_0x3d2e4f[_0xec3d('0x33')][_0xec3d('0x38')]));_0x182c66[_0xec3d('0x37')]=_0x182c66[_0xec3d('0x37')][_0xec3d('0x39')]?_0x182c66[_0xec3d('0x37')]:_0xacfc83[_0xec3d('0x32')];if(!_0x3d2e4f['query'][_0xec3d('0x3a')](_0xec3d('0x3b'))){_0x182c66[_0xec3d('0x1d')]=qs[_0xec3d('0x1d')](_0x3d2e4f[_0xec3d('0x33')]['limit']);_0x182c66[_0xec3d('0x1b')]=qs[_0xec3d('0x1b')](_0x3d2e4f[_0xec3d('0x33')][_0xec3d('0x1b')]);}_0x182c66[_0xec3d('0x3c')]=qs[_0xec3d('0x3d')](_0x3d2e4f[_0xec3d('0x33')][_0xec3d('0x3d')]);_0x182c66[_0xec3d('0x3e')]=qs[_0xec3d('0x35')](_['pick'](_0x3d2e4f['query'],_0xacfc83['filters']),_0x264f44);if(_0x3d2e4f[_0xec3d('0x33')][_0xec3d('0x3f')]){_0x182c66[_0xec3d('0x3e')]=_['merge'](_0x182c66[_0xec3d('0x3e')],{'$or':_[_0xec3d('0x2d')](_0x264f44,function(_0x2dc737){if(_0x2dc737[_0xec3d('0x31')]!==_0xec3d('0x40')){var _0x535013={};_0x535013[_0x2dc737[_0xec3d('0x2b')]]={'$like':'%'+_0x3d2e4f[_0xec3d('0x33')][_0xec3d('0x3f')]+'%'};return _0x535013;}})});}_0x182c66=_[_0xec3d('0x41')]({},_0x182c66,_0x3d2e4f[_0xec3d('0x42')]);var _0x23cae2={'where':_0x182c66[_0xec3d('0x3e')]};return db[_0xec3d('0x2e')][_0xec3d('0x1e')](_0x23cae2)[_0xec3d('0x26')](function(_0x3e209b){_0x298bd1['count']=_0x3e209b;if(_0x3d2e4f[_0xec3d('0x33')]['includeAll']){_0x182c66[_0xec3d('0x43')]=[{'all':!![]}];}return db[_0xec3d('0x2e')][_0xec3d('0x44')](_0x182c66);})[_0xec3d('0x26')](function(_0x460c33){_0x298bd1[_0xec3d('0x45')]=_0x460c33;return _0x298bd1;})['then'](respondWithFilteredResult(_0x4b49b4,_0x182c66))[_0xec3d('0x46')](handleError(_0x4b49b4,null));};exports[_0xec3d('0x47')]=function(_0x558f8e,_0x10b81c){var _0x8e9238={'raw':![],'where':{'id':_0x558f8e[_0xec3d('0x48')]['id']}},_0x2fc378={};_0x2fc378[_0xec3d('0x32')]=_['keys'](db[_0xec3d('0x2e')][_0xec3d('0x2f')]);_0x2fc378[_0xec3d('0x33')]=_['keys'](_0x558f8e[_0xec3d('0x33')]);_0x2fc378[_0xec3d('0x35')]=_[_0xec3d('0x36')](_0x2fc378[_0xec3d('0x32')],_0x2fc378['query']);_0x8e9238[_0xec3d('0x37')]=_[_0xec3d('0x36')](_0x2fc378[_0xec3d('0x32')],qs[_0xec3d('0x38')](_0x558f8e[_0xec3d('0x33')][_0xec3d('0x38')]));_0x8e9238[_0xec3d('0x37')]=_0x8e9238[_0xec3d('0x37')][_0xec3d('0x39')]?_0x8e9238[_0xec3d('0x37')]:_0x2fc378[_0xec3d('0x32')];if(_0x558f8e[_0xec3d('0x33')]['includeAll']){_0x8e9238['include']=[{'all':!![]}];}_0x8e9238=_['merge']({},_0x8e9238,_0x558f8e[_0xec3d('0x42')]);return db[_0xec3d('0x2e')]['find'](_0x8e9238)[_0xec3d('0x26')](handleEntityNotFound(_0x10b81c,null))['then'](respondWithResult(_0x10b81c,null))[_0xec3d('0x46')](handleError(_0x10b81c,null));};exports[_0xec3d('0x49')]=function(_0x5df0ef,_0x3d57d9){return db[_0xec3d('0x2e')][_0xec3d('0x49')](_0x5df0ef[_0xec3d('0x4a')],{})[_0xec3d('0x26')](respondWithResult(_0x3d57d9,0xc9))[_0xec3d('0x46')](handleError(_0x3d57d9,null));};exports['update']=function(_0x13490c,_0x300eb8){if(_0x13490c[_0xec3d('0x4a')]['id']){delete _0x13490c[_0xec3d('0x4a')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x13490c[_0xec3d('0x48')]['id']}})[_0xec3d('0x26')](handleEntityNotFound(_0x300eb8,null))[_0xec3d('0x26')](saveUpdates(_0x13490c[_0xec3d('0x4a')],null))[_0xec3d('0x26')](respondWithResult(_0x300eb8,null))[_0xec3d('0x46')](handleError(_0x300eb8,null));};exports[_0xec3d('0x25')]=function(_0x548ea9,_0x305b12){return db['FreshsalesAccount'][_0xec3d('0x4b')]({'where':{'id':_0x548ea9[_0xec3d('0x48')]['id']}})['then'](handleEntityNotFound(_0x305b12,null))[_0xec3d('0x26')](removeEntity(_0x305b12,null))[_0xec3d('0x46')](handleError(_0x305b12,null));};exports[_0xec3d('0x4c')]=function(_0x47f289,_0xe296f6,_0xfa30d4){var _0x50c443={};var _0xd2280f={};var _0x43ff61;var _0x394629;return db[_0xec3d('0x2e')]['findOne']({'where':{'id':_0x47f289[_0xec3d('0x48')]['id']}})[_0xec3d('0x26')](handleEntityNotFound(_0xe296f6,null))[_0xec3d('0x26')](function(_0x3c0bdd){if(_0x3c0bdd){_0x43ff61=_0x3c0bdd;_0xd2280f[_0xec3d('0x32')]=_[_0xec3d('0x34')](db[_0xec3d('0x4d')][_0xec3d('0x2f')]);_0xd2280f['query']=_['keys'](_0x47f289[_0xec3d('0x33')]);_0xd2280f[_0xec3d('0x35')]=_['intersection'](_0xd2280f[_0xec3d('0x32')],_0xd2280f[_0xec3d('0x33')]);_0x50c443[_0xec3d('0x37')]=_[_0xec3d('0x36')](_0xd2280f['model'],qs[_0xec3d('0x38')](_0x47f289[_0xec3d('0x33')][_0xec3d('0x38')]));_0x50c443[_0xec3d('0x37')]=_0x50c443[_0xec3d('0x37')][_0xec3d('0x39')]?_0x50c443[_0xec3d('0x37')]:_0xd2280f[_0xec3d('0x32')];_0x50c443[_0xec3d('0x3c')]=qs[_0xec3d('0x3d')](_0x47f289[_0xec3d('0x33')][_0xec3d('0x3d')]);_0x50c443[_0xec3d('0x3e')]=qs['filters'](_[_0xec3d('0x4e')](_0x47f289[_0xec3d('0x33')],_0xd2280f['filters']));if(_0x47f289[_0xec3d('0x33')][_0xec3d('0x3f')]){_0x50c443[_0xec3d('0x3e')]=_['merge'](_0x50c443['where'],{'$or':_[_0xec3d('0x2d')](_0x50c443[_0xec3d('0x37')],function(_0x3149a1){var _0x5df571={};_0x5df571[_0x3149a1]={'$like':'%'+_0x47f289['query'][_0xec3d('0x3f')]+'%'};return _0x5df571;})});}_0x50c443=_['merge']({},_0x50c443,_0x47f289[_0xec3d('0x42')]);return _0x43ff61[_0xec3d('0x4c')](_0x50c443);}})[_0xec3d('0x26')](function(_0x2b0a73){if(_0x2b0a73){_0x394629=_0x2b0a73[_0xec3d('0x39')];if(!_0x47f289[_0xec3d('0x33')][_0xec3d('0x3a')]('nolimit')){_0x50c443[_0xec3d('0x1d')]=qs[_0xec3d('0x1d')](_0x47f289[_0xec3d('0x33')]['limit']);_0x50c443[_0xec3d('0x1b')]=qs['offset'](_0x47f289['query'][_0xec3d('0x1b')]);}return _0x43ff61['getConfigurations'](_0x50c443);}})[_0xec3d('0x26')](function(_0x33a742){if(_0x33a742){return _0x33a742?{'count':_0x394629,'rows':_0x33a742}:null;}})[_0xec3d('0x26')](respondWithResult(_0xe296f6,null))[_0xec3d('0x46')](handleError(_0xe296f6,null));};exports[_0xec3d('0x4f')]=function(_0x555d8c,_0x561b07,_0x4ec039){if(_0x555d8c[_0xec3d('0x4a')]['id']){delete _0x555d8c['body']['id'];}return db[_0xec3d('0x2e')][_0xec3d('0x50')]({'where':{'id':_0x555d8c[_0xec3d('0x48')]['id']}})[_0xec3d('0x26')](handleEntityNotFound(_0x561b07,null))[_0xec3d('0x26')](function(_0x3480e4){if(_0x3480e4){_0x555d8c[_0xec3d('0x4a')]['AccountId']=_0x3480e4['id'];_0x555d8c[_0xec3d('0x4a')]['Subjects']=integrations[_0xec3d('0x51')](_0x555d8c[_0xec3d('0x4a')][_0xec3d('0x52')],_0x555d8c[_0xec3d('0x4a')][_0xec3d('0x31')]);_0x555d8c[_0xec3d('0x4a')]['Descriptions']=integrations[_0xec3d('0x53')](_0x555d8c[_0xec3d('0x4a')][_0xec3d('0x52')],_0x555d8c[_0xec3d('0x4a')][_0xec3d('0x31')]);return db[_0xec3d('0x4d')][_0xec3d('0x49')](_0x555d8c['body'],{'include':[{'model':db[_0xec3d('0x54')],'as':_0xec3d('0x55')},{'model':db[_0xec3d('0x54')],'as':_0xec3d('0x56')}]});}return null;})[_0xec3d('0x26')](respondWithResult(_0x561b07,null))['catch'](handleError(_0x561b07,null));};exports['getFields']=function(_0x4f9f93,_0x68d03e,_0xb1740d){var _0x246d56='';var _0xdf3bc8='';return db[_0xec3d('0x2e')]['findOne']({'where':{'id':_0x4f9f93[_0xec3d('0x48')]['id']},'attributes':['id',_0xec3d('0x57'),_0xec3d('0x58'),'apiKey']})['then'](handleEntityNotFound(_0x68d03e,null))['then'](function(_0x2bd2f1){if(_0x2bd2f1){_0xdf3bc8=_0x2bd2f1[_0xec3d('0x57')];_0x246d56=_0x2bd2f1[_0xec3d('0x58')];var _0x23b685=_0x2bd2f1[_0xec3d('0x58')]['slice'](-0x1);if(_0x23b685==='/'){_0x246d56=_0x246d56[_0xec3d('0x59')](0x0,_0x246d56[_0xec3d('0x5a')](_0x23b685));}return rp({'method':'GET','uri':util[_0xec3d('0x5b')](_0xec3d('0x5c'),_0x246d56,_0xec3d('0x5d')),'headers':{'Authorization':_0xec3d('0x5e')+_0x2bd2f1['apiKey']},'json':!![]});}})[_0xec3d('0x26')](function(_0x5a7e52){if(_0x5a7e52){var _0xb3f597=_0x5a7e52[_0xec3d('0x5f')];var _0x374687=![];var _0x358c57=null;for(_0x358c57=0x0;_0x358c57<_0xb3f597['length'];_0x358c57++){if(_0xb3f597[_0x358c57][_0xec3d('0x60')]===_0xdf3bc8){_0x374687=!![];}}if(_0x374687){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x68d03e,null))[_0xec3d('0x46')](function(_0x595d4a){var _0x388f67=_0x4f9f93[_0xec3d('0x33')][_0xec3d('0x61')]?0x1f4:_0x595d4a['statusCode']||0x1f4;logger[_0xec3d('0x29')](_0xec3d('0x62'),_0xec3d('0x63'),_0x388f67,JSON[_0xec3d('0x64')](_0x595d4a));delete _0x595d4a[_0xec3d('0x2b')];if(_0x388f67===0x191){_0x388f67=0x190;}_0x68d03e['status'](_0x388f67)[_0xec3d('0x2c')](_0x4f9f93['query'][_0xec3d('0x61')]?{'message':_0xec3d('0x65'),'statusCode':_0x595d4a[_0xec3d('0x66')]}:_0x595d4a);});}; \ No newline at end of file +var _0xf937=['then','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','create','body','find','getConfigurations','findOne','filter','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','FreshsalesConfiguration','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update'];(function(_0x2f5142,_0x1ab07a){var _0x4e0de5=function(_0x2c65ac){while(--_0x2c65ac){_0x2f5142['push'](_0x2f5142['shift']());}};_0x4e0de5(++_0x1ab07a);}(_0xf937,0x1e4));var _0x7f93=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0xf937[_0x2fff83];return _0xa2a722;};'use strict';var emlformat=require(_0x7f93('0x0'));var rimraf=require(_0x7f93('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7f93('0x2'));var moment=require(_0x7f93('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7f93('0x4'));var util=require(_0x7f93('0x5'));var path=require(_0x7f93('0x6'));var sox=require(_0x7f93('0x7'));var csv=require(_0x7f93('0x8'));var ejs=require(_0x7f93('0x9'));var fs=require('fs');var fs_extra=require(_0x7f93('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f93('0xb'));var jsforce=require(_0x7f93('0xc'));var deskjs=require(_0x7f93('0xd'));var toCsv=require(_0x7f93('0x8'));var querystring=require('querystring');var Papa=require(_0x7f93('0xe'));var Redis=require(_0x7f93('0xf'));var authService=require(_0x7f93('0x10'));var qs=require(_0x7f93('0x11'));var as=require(_0x7f93('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7f93('0x13'));var utils=require(_0x7f93('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7f93('0x15'));var db=require(_0x7f93('0x16'))['db'];var integrations=require(_0x7f93('0x17'));function respondWithStatusCode(_0x220344,_0x457d52){_0x457d52=_0x457d52||0xcc;return function(_0x32b68b){if(_0x32b68b){return _0x220344[_0x7f93('0x18')](_0x457d52);}return _0x220344['status'](_0x457d52)[_0x7f93('0x19')]();};}function respondWithResult(_0x2d4cea,_0xcaa33){_0xcaa33=_0xcaa33||0xc8;return function(_0x310a7a){if(_0x310a7a){return _0x2d4cea[_0x7f93('0x1a')](_0xcaa33)[_0x7f93('0x1b')](_0x310a7a);}};}function respondWithFilteredResult(_0x5b2c43,_0x52cefc){return function(_0x3808b6){if(_0x3808b6){var _0x2cde82=typeof _0x52cefc[_0x7f93('0x1c')]===_0x7f93('0x1d')&&typeof _0x52cefc[_0x7f93('0x1e')]===_0x7f93('0x1d');var _0x36e334=_0x3808b6[_0x7f93('0x1f')];var _0x1bc2da=_0x2cde82?0x0:_0x52cefc[_0x7f93('0x1c')];var _0x1b2215=_0x2cde82?_0x3808b6['count']:_0x52cefc[_0x7f93('0x1c')]+_0x52cefc[_0x7f93('0x1e')];var _0x159ba4;if(_0x1b2215>=_0x36e334){_0x1b2215=_0x36e334;_0x159ba4=0xc8;}else{_0x159ba4=0xce;}_0x5b2c43[_0x7f93('0x1a')](_0x159ba4);return _0x5b2c43[_0x7f93('0x20')]('Content-Range',_0x1bc2da+'-'+_0x1b2215+'/'+_0x36e334)[_0x7f93('0x1b')](_0x3808b6);}return null;};}function patchUpdates(_0x5e45ed){return function(_0x35f0a3){try{jsonpatch[_0x7f93('0x21')](_0x35f0a3,_0x5e45ed,!![]);}catch(_0x52417){return BPromise['reject'](_0x52417);}return _0x35f0a3[_0x7f93('0x22')]();};}function saveUpdates(_0x4736b1,_0x9b84fb){return function(_0x444e7e){if(_0x444e7e){return _0x444e7e[_0x7f93('0x23')](_0x4736b1)[_0x7f93('0x24')](function(_0x5b1b1b){return _0x5b1b1b;});}return null;};}function removeEntity(_0x195e3d,_0x29f2cd){return function(_0x5db056){if(_0x5db056){return _0x5db056['destroy']()[_0x7f93('0x24')](function(){_0x195e3d[_0x7f93('0x1a')](0xcc)[_0x7f93('0x19')]();});}};}function handleEntityNotFound(_0x2b5260,_0x44c9dc){return function(_0x225234){if(!_0x225234){_0x2b5260[_0x7f93('0x18')](0x194);}return _0x225234;};}function handleError(_0x5f04ef,_0x2863ec){_0x2863ec=_0x2863ec||0x1f4;return function(_0x36b26e){logger[_0x7f93('0x25')](_0x36b26e[_0x7f93('0x26')]);if(_0x36b26e[_0x7f93('0x27')]){delete _0x36b26e['name'];}_0x5f04ef[_0x7f93('0x1a')](_0x2863ec)[_0x7f93('0x28')](_0x36b26e);};}exports[_0x7f93('0x29')]=function(_0x3d19d5,_0x476a79){var _0x3c9e09={},_0x1b099e={},_0x38499e={'count':0x0,'rows':[]};var _0x2ed6da=_[_0x7f93('0x2a')](db[_0x7f93('0x2b')]['rawAttributes'],function(_0x342a41){return{'name':_0x342a41[_0x7f93('0x2c')],'type':_0x342a41[_0x7f93('0x2d')][_0x7f93('0x2e')]};});_0x1b099e['model']=_[_0x7f93('0x2a')](_0x2ed6da,_0x7f93('0x27'));_0x1b099e[_0x7f93('0x2f')]=_[_0x7f93('0x30')](_0x3d19d5[_0x7f93('0x2f')]);_0x1b099e['filters']=_[_0x7f93('0x31')](_0x1b099e[_0x7f93('0x32')],_0x1b099e['query']);_0x3c9e09['attributes']=_[_0x7f93('0x31')](_0x1b099e['model'],qs['fields'](_0x3d19d5[_0x7f93('0x2f')][_0x7f93('0x33')]));_0x3c9e09[_0x7f93('0x34')]=_0x3c9e09[_0x7f93('0x34')][_0x7f93('0x35')]?_0x3c9e09[_0x7f93('0x34')]:_0x1b099e[_0x7f93('0x32')];if(!_0x3d19d5[_0x7f93('0x2f')][_0x7f93('0x36')]('nolimit')){_0x3c9e09[_0x7f93('0x1e')]=qs[_0x7f93('0x1e')](_0x3d19d5[_0x7f93('0x2f')][_0x7f93('0x1e')]);_0x3c9e09[_0x7f93('0x1c')]=qs[_0x7f93('0x1c')](_0x3d19d5[_0x7f93('0x2f')][_0x7f93('0x1c')]);}_0x3c9e09[_0x7f93('0x37')]=qs[_0x7f93('0x38')](_0x3d19d5[_0x7f93('0x2f')]['sort']);_0x3c9e09[_0x7f93('0x39')]=qs[_0x7f93('0x3a')](_[_0x7f93('0x3b')](_0x3d19d5['query'],_0x1b099e[_0x7f93('0x3a')]),_0x2ed6da);if(_0x3d19d5[_0x7f93('0x2f')]['filter']){_0x3c9e09[_0x7f93('0x39')]=_['merge'](_0x3c9e09['where'],{'$or':_[_0x7f93('0x2a')](_0x2ed6da,function(_0x34da1e){if(_0x34da1e[_0x7f93('0x2d')]!==_0x7f93('0x3c')){var _0x3ed21f={};_0x3ed21f[_0x34da1e[_0x7f93('0x27')]]={'$like':'%'+_0x3d19d5[_0x7f93('0x2f')]['filter']+'%'};return _0x3ed21f;}})});}_0x3c9e09=_['merge']({},_0x3c9e09,_0x3d19d5[_0x7f93('0x3d')]);var _0x57c79d={'where':_0x3c9e09[_0x7f93('0x39')]};return db[_0x7f93('0x2b')][_0x7f93('0x1f')](_0x57c79d)[_0x7f93('0x24')](function(_0x470fbd){_0x38499e['count']=_0x470fbd;if(_0x3d19d5['query'][_0x7f93('0x3e')]){_0x3c9e09[_0x7f93('0x3f')]=[{'all':!![]}];}return db[_0x7f93('0x2b')][_0x7f93('0x40')](_0x3c9e09);})['then'](function(_0x578ed8){_0x38499e[_0x7f93('0x41')]=_0x578ed8;return _0x38499e;})['then'](respondWithFilteredResult(_0x476a79,_0x3c9e09))[_0x7f93('0x42')](handleError(_0x476a79,null));};exports[_0x7f93('0x43')]=function(_0x39a3e9,_0x377b08){var _0x533b3d={'raw':![],'where':{'id':_0x39a3e9[_0x7f93('0x44')]['id']}},_0x33c254={};_0x33c254['model']=_[_0x7f93('0x30')](db['FreshsalesAccount'][_0x7f93('0x45')]);_0x33c254[_0x7f93('0x2f')]=_['keys'](_0x39a3e9['query']);_0x33c254[_0x7f93('0x3a')]=_[_0x7f93('0x31')](_0x33c254[_0x7f93('0x32')],_0x33c254[_0x7f93('0x2f')]);_0x533b3d['attributes']=_['intersection'](_0x33c254[_0x7f93('0x32')],qs[_0x7f93('0x33')](_0x39a3e9[_0x7f93('0x2f')][_0x7f93('0x33')]));_0x533b3d[_0x7f93('0x34')]=_0x533b3d[_0x7f93('0x34')]['length']?_0x533b3d[_0x7f93('0x34')]:_0x33c254[_0x7f93('0x32')];if(_0x39a3e9[_0x7f93('0x2f')]['includeAll']){_0x533b3d[_0x7f93('0x3f')]=[{'all':!![]}];}_0x533b3d=_[_0x7f93('0x46')]({},_0x533b3d,_0x39a3e9[_0x7f93('0x3d')]);return db[_0x7f93('0x2b')]['find'](_0x533b3d)[_0x7f93('0x24')](handleEntityNotFound(_0x377b08,null))[_0x7f93('0x24')](respondWithResult(_0x377b08,null))['catch'](handleError(_0x377b08,null));};exports[_0x7f93('0x47')]=function(_0x239220,_0x29eb1d){return db['FreshsalesAccount'][_0x7f93('0x47')](_0x239220[_0x7f93('0x48')],{})['then'](respondWithResult(_0x29eb1d,0xc9))['catch'](handleError(_0x29eb1d,null));};exports['update']=function(_0x3252fb,_0x15f57a){if(_0x3252fb[_0x7f93('0x48')]['id']){delete _0x3252fb[_0x7f93('0x48')]['id'];}return db['FreshsalesAccount'][_0x7f93('0x49')]({'where':{'id':_0x3252fb[_0x7f93('0x44')]['id']}})['then'](handleEntityNotFound(_0x15f57a,null))[_0x7f93('0x24')](saveUpdates(_0x3252fb[_0x7f93('0x48')],null))[_0x7f93('0x24')](respondWithResult(_0x15f57a,null))['catch'](handleError(_0x15f57a,null));};exports['destroy']=function(_0x2c82d6,_0x21bfec){return db[_0x7f93('0x2b')][_0x7f93('0x49')]({'where':{'id':_0x2c82d6[_0x7f93('0x44')]['id']}})[_0x7f93('0x24')](handleEntityNotFound(_0x21bfec,null))[_0x7f93('0x24')](removeEntity(_0x21bfec,null))['catch'](handleError(_0x21bfec,null));};exports[_0x7f93('0x4a')]=function(_0x42923e,_0x130199,_0x484bbe){var _0x5f856={};var _0x38dd41={};var _0x189092;var _0x2f4bfb;return db[_0x7f93('0x2b')][_0x7f93('0x4b')]({'where':{'id':_0x42923e[_0x7f93('0x44')]['id']}})['then'](handleEntityNotFound(_0x130199,null))[_0x7f93('0x24')](function(_0x1ec689){if(_0x1ec689){_0x189092=_0x1ec689;_0x38dd41[_0x7f93('0x32')]=_[_0x7f93('0x30')](db['FreshsalesConfiguration'][_0x7f93('0x45')]);_0x38dd41['query']=_[_0x7f93('0x30')](_0x42923e[_0x7f93('0x2f')]);_0x38dd41[_0x7f93('0x3a')]=_[_0x7f93('0x31')](_0x38dd41['model'],_0x38dd41[_0x7f93('0x2f')]);_0x5f856['attributes']=_['intersection'](_0x38dd41[_0x7f93('0x32')],qs[_0x7f93('0x33')](_0x42923e[_0x7f93('0x2f')]['fields']));_0x5f856[_0x7f93('0x34')]=_0x5f856[_0x7f93('0x34')][_0x7f93('0x35')]?_0x5f856['attributes']:_0x38dd41['model'];_0x5f856['order']=qs[_0x7f93('0x38')](_0x42923e[_0x7f93('0x2f')]['sort']);_0x5f856[_0x7f93('0x39')]=qs[_0x7f93('0x3a')](_['pick'](_0x42923e[_0x7f93('0x2f')],_0x38dd41[_0x7f93('0x3a')]));if(_0x42923e[_0x7f93('0x2f')][_0x7f93('0x4c')]){_0x5f856['where']=_[_0x7f93('0x46')](_0x5f856[_0x7f93('0x39')],{'$or':_[_0x7f93('0x2a')](_0x5f856['attributes'],function(_0x11a28d){var _0x559f53={};_0x559f53[_0x11a28d]={'$like':'%'+_0x42923e[_0x7f93('0x2f')][_0x7f93('0x4c')]+'%'};return _0x559f53;})});}_0x5f856=_[_0x7f93('0x46')]({},_0x5f856,_0x42923e[_0x7f93('0x3d')]);return _0x189092[_0x7f93('0x4a')](_0x5f856);}})[_0x7f93('0x24')](function(_0x186459){if(_0x186459){_0x2f4bfb=_0x186459['length'];if(!_0x42923e[_0x7f93('0x2f')][_0x7f93('0x36')](_0x7f93('0x4d'))){_0x5f856[_0x7f93('0x1e')]=qs[_0x7f93('0x1e')](_0x42923e['query'][_0x7f93('0x1e')]);_0x5f856[_0x7f93('0x1c')]=qs[_0x7f93('0x1c')](_0x42923e[_0x7f93('0x2f')][_0x7f93('0x1c')]);}return _0x189092[_0x7f93('0x4a')](_0x5f856);}})['then'](function(_0x38ea98){if(_0x38ea98){return _0x38ea98?{'count':_0x2f4bfb,'rows':_0x38ea98}:null;}})[_0x7f93('0x24')](respondWithResult(_0x130199,null))[_0x7f93('0x42')](handleError(_0x130199,null));};exports[_0x7f93('0x4e')]=function(_0x171342,_0x578c2d,_0x2081d1){if(_0x171342['body']['id']){delete _0x171342['body']['id'];}return db[_0x7f93('0x2b')]['findOne']({'where':{'id':_0x171342['params']['id']}})[_0x7f93('0x24')](handleEntityNotFound(_0x578c2d,null))[_0x7f93('0x24')](function(_0xb271a0){if(_0xb271a0){_0x171342['body']['AccountId']=_0xb271a0['id'];_0x171342[_0x7f93('0x48')][_0x7f93('0x4f')]=integrations[_0x7f93('0x50')](_0x171342['body'][_0x7f93('0x51')],_0x171342[_0x7f93('0x48')][_0x7f93('0x2d')]);_0x171342[_0x7f93('0x48')]['Descriptions']=integrations[_0x7f93('0x52')](_0x171342[_0x7f93('0x48')][_0x7f93('0x51')],_0x171342['body']['type']);return db[_0x7f93('0x53')][_0x7f93('0x47')](_0x171342['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x7f93('0x4f')},{'model':db[_0x7f93('0x54')],'as':_0x7f93('0x55')}]});}return null;})[_0x7f93('0x24')](respondWithResult(_0x578c2d,null))['catch'](handleError(_0x578c2d,null));};exports[_0x7f93('0x56')]=function(_0x366cf9,_0xe0a928,_0x4dc057){var _0x1cd261='';var _0x205a80='';return db[_0x7f93('0x2b')][_0x7f93('0x4b')]({'where':{'id':_0x366cf9[_0x7f93('0x44')]['id']},'attributes':['id',_0x7f93('0x57'),_0x7f93('0x58'),_0x7f93('0x59')]})[_0x7f93('0x24')](handleEntityNotFound(_0xe0a928,null))['then'](function(_0x146fc7){if(_0x146fc7){_0x205a80=_0x146fc7[_0x7f93('0x57')];_0x1cd261=_0x146fc7[_0x7f93('0x58')];var _0x15b10b=_0x146fc7[_0x7f93('0x58')][_0x7f93('0x5a')](-0x1);if(_0x15b10b==='/'){_0x1cd261=_0x1cd261[_0x7f93('0x5b')](0x0,_0x1cd261['lastIndexOf'](_0x15b10b));}return rp({'method':'GET','uri':util[_0x7f93('0x5c')](_0x7f93('0x5d'),_0x1cd261,_0x7f93('0x5e')),'headers':{'Authorization':_0x7f93('0x5f')+_0x146fc7[_0x7f93('0x59')]},'json':!![]});}})[_0x7f93('0x24')](function(_0x368fc9){if(_0x368fc9){var _0x37d769=_0x368fc9[_0x7f93('0x60')];var _0x32716a=![];var _0xd30b48=null;for(_0xd30b48=0x0;_0xd30b48<_0x37d769[_0x7f93('0x35')];_0xd30b48++){if(_0x37d769[_0xd30b48][_0x7f93('0x61')]===_0x205a80){_0x32716a=!![];}}if(_0x32716a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7f93('0x62')});}}})[_0x7f93('0x24')](respondWithResult(_0xe0a928,null))[_0x7f93('0x42')](function(_0x55127b){var _0x2f6c5d=_0x366cf9[_0x7f93('0x2f')][_0x7f93('0x63')]?0x1f4:_0x55127b['statusCode']||0x1f4;logger[_0x7f93('0x25')](_0x7f93('0x64'),_0x7f93('0x56'),_0x2f6c5d,JSON[_0x7f93('0x65')](_0x55127b));delete _0x55127b['name'];if(_0x2f6c5d===0x191){_0x2f6c5d=0x190;}_0xe0a928[_0x7f93('0x1a')](_0x2f6c5d)['send'](_0x366cf9[_0x7f93('0x2f')][_0x7f93('0x63')]?{'message':_0x7f93('0x66'),'statusCode':_0x55127b[_0x7f93('0x67')]}:_0x55127b);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 5f1495d..baf31a8 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6050=['moment','bluebird','path','rimraf','../../config/environment','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x4f540f,_0x4bb48c){var _0x327fe8=function(_0x212c32){while(--_0x212c32){_0x4f540f['push'](_0x4f540f['shift']());}};_0x327fe8(++_0x4bb48c);}(_0x6050,0x196));var _0x0605=function(_0x2c632e,_0x576b14){_0x2c632e=_0x2c632e-0x0;var _0x153c0f=_0x6050[_0x2c632e];return _0x153c0f;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd78d96,_0x578623){return _0xd78d96['define']('FreshsalesAccount',attributes,{'tableName':_0x0605('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x579f49,_0x10efb2){var _0x277855=function(_0x33263d){while(--_0x33263d){_0x579f49['push'](_0x579f49['shift']());}};_0x277855(++_0x10efb2);}(_0xba34,0x119));var _0x4ba3=function(_0x2a52e8,_0x51e75b){_0x2a52e8=_0x2a52e8-0x0;var _0x33f3ea=_0xba34[_0x2a52e8];return _0x33f3ea;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 4f4b991..6663d22 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1c6=['then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshsalesAccount','FreshsalesAccount','find','ShowFreshsalesAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x3a865d,_0x3f473a){var _0x3fee51=function(_0x5132a5){while(--_0x5132a5){_0x3a865d['push'](_0x3a865d['shift']());}};_0x3fee51(++_0x3f473a);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x19063e,_0x492250){_0x19063e=_0x19063e-0x0;var _0x3be681=_0xc1c6[_0x19063e];return _0x3be681;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});}exports['GetFreshsalesAccount']=function(_0x137770){var _0x4ede06=this;return new Promise(function(_0x338dc2,_0x1a0ab9){return db['FreshsalesAccount'][_0x6c1c('0x13')]({'raw':_0x137770['options']?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![],'where':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x16')]||null:null,'attributes':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x17')]||null:null,'limit':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x18')]||null:null,'include':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x137770[_0x6c1c('0x14')][_0x6c1c('0x19')],function(_0x12c638){return{'model':db[_0x12c638[_0x6c1c('0x1b')]],'as':_0x12c638['as'],'attributes':_0x12c638[_0x6c1c('0x17')],'include':_0x12c638[_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x12c638[_0x6c1c('0x19')],function(_0x7ff10d){return{'model':db[_0x7ff10d[_0x6c1c('0x1b')]],'as':_0x7ff10d['as'],'attributes':_0x7ff10d[_0x6c1c('0x17')],'include':_0x7ff10d[_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x7ff10d[_0x6c1c('0x19')],function(_0x5f4568){return{'model':db[_0x5f4568[_0x6c1c('0x1b')]],'as':_0x5f4568['as'],'attributes':_0x5f4568['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c1c('0x9')](function(_0x4c23f8){logger[_0x6c1c('0x11')]('GetFreshsalesAccount',_0x137770);logger[_0x6c1c('0xc')](_0x6c1c('0x1c'),_0x137770,JSON['stringify'](_0x4c23f8));_0x338dc2(_0x4c23f8);})[_0x6c1c('0x12')](function(_0x24da4c){logger['error'](_0x6c1c('0x1c'),_0x24da4c[_0x6c1c('0x10')],_0x137770);_0x1a0ab9(_0x4ede06[_0x6c1c('0xf')](0x1f4,_0x24da4c[_0x6c1c('0x10')]));});});};exports['ShowFreshsalesAccount']=function(_0x52c036){var _0x3cba17=this;return new Promise(function(_0x45128c,_0x21acef){return db[_0x6c1c('0x1d')][_0x6c1c('0x1e')]({'raw':_0x52c036[_0x6c1c('0x14')]?_0x52c036['options'][_0x6c1c('0x15')]===undefined?!![]:![]:!![],'where':_0x52c036[_0x6c1c('0x14')]?_0x52c036['options'][_0x6c1c('0x16')]||null:null,'attributes':_0x52c036[_0x6c1c('0x14')]?_0x52c036[_0x6c1c('0x14')][_0x6c1c('0x17')]||null:null,'include':_0x52c036['options']?_0x52c036[_0x6c1c('0x14')][_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x52c036['options'][_0x6c1c('0x19')],function(_0x4e5767){return{'model':db[_0x4e5767[_0x6c1c('0x1b')]],'as':_0x4e5767['as'],'attributes':_0x4e5767['attributes'],'include':_0x4e5767[_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x4e5767[_0x6c1c('0x19')],function(_0x54b8d3){return{'model':db[_0x54b8d3['model']],'as':_0x54b8d3['as'],'attributes':_0x54b8d3[_0x6c1c('0x17')],'include':_0x54b8d3[_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x54b8d3['include'],function(_0x1a9132){return{'model':db[_0x1a9132['model']],'as':_0x1a9132['as'],'attributes':_0x1a9132['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c1c('0x9')](function(_0xbafcb3){logger[_0x6c1c('0x11')](_0x6c1c('0x1f'),_0x52c036);logger['debug'](_0x6c1c('0x1f'),_0x52c036,JSON[_0x6c1c('0xe')](_0xbafcb3));_0x45128c(_0xbafcb3);})[_0x6c1c('0x12')](function(_0x18da02){logger[_0x6c1c('0xf')](_0x6c1c('0x1f'),_0x18da02[_0x6c1c('0x10')],_0x52c036);_0x21acef(_0x3cba17[_0x6c1c('0xf')](0x1f4,_0x18da02[_0x6c1c('0x10')]));});});}; \ No newline at end of file +var _0x4325=['stringify','code','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5aa21b,_0x425dbe){var _0x37eaef=function(_0x381938){while(--_0x381938){_0x5aa21b['push'](_0x5aa21b['shift']());}};_0x37eaef(++_0x425dbe);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')]({'raw':_0x32fe60[_0x5432('0x1a')]?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'where':_0x32fe60[_0x5432('0x1a')]?_0x32fe60['options'][_0x5432('0x1c')]||null:null,'attributes':_0x32fe60[_0x5432('0x1a')]?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1d')]||null:null,'limit':_0x32fe60[_0x5432('0x1a')]?_0x32fe60['options']['limit']||null:null,'include':_0x32fe60['options']?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x32fe60[_0x5432('0x1a')]['include'],function(_0x4af5f4){return{'model':db[_0x4af5f4[_0x5432('0x20')]],'as':_0x4af5f4['as'],'attributes':_0x4af5f4[_0x5432('0x1d')],'include':_0x4af5f4['include']?_[_0x5432('0x1f')](_0x4af5f4[_0x5432('0x1e')],function(_0x637582){return{'model':db[_0x637582['model']],'as':_0x637582['as'],'attributes':_0x637582[_0x5432('0x1d')],'include':_0x637582[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x637582['include'],function(_0x4ab09d){return{'model':db[_0x4ab09d[_0x5432('0x20')]],'as':_0x4ab09d['as'],'attributes':_0x4ab09d[_0x5432('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1abe73){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger['debug'](_0x5432('0x17'),_0x32fe60,JSON['stringify'](_0x1abe73));_0x5f011f(_0x1abe73);})['catch'](function(_0x6fc7f5){logger['error'](_0x5432('0x17'),_0x6fc7f5['message'],_0x32fe60);_0x3f3873(_0x4221a8['error'](0x1f4,_0x6fc7f5[_0x5432('0x13')]));});});};exports[_0x5432('0x21')]=function(_0x345b51){var _0x4e92d5=this;return new Promise(function(_0x31490c,_0x1d436c){return db[_0x5432('0x18')][_0x5432('0x22')]({'raw':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'where':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')]['where']||null:null,'attributes':_0x345b51['options']?_0x345b51[_0x5432('0x1a')][_0x5432('0x1d')]||null:null,'include':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')][_0x5432('0x1e')]?_['map'](_0x345b51[_0x5432('0x1a')]['include'],function(_0x2955e0){return{'model':db[_0x2955e0[_0x5432('0x20')]],'as':_0x2955e0['as'],'attributes':_0x2955e0[_0x5432('0x1d')],'include':_0x2955e0[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x2955e0[_0x5432('0x1e')],function(_0x5c3c77){return{'model':db[_0x5c3c77[_0x5432('0x20')]],'as':_0x5c3c77['as'],'attributes':_0x5c3c77[_0x5432('0x1d')],'include':_0x5c3c77[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x5c3c77['include'],function(_0xe01f4b){return{'model':db[_0xe01f4b[_0x5432('0x20')]],'as':_0xe01f4b['as'],'attributes':_0xe01f4b[_0x5432('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5432('0xb')](function(_0x3fb586){logger[_0x5432('0x14')](_0x5432('0x21'),_0x345b51);logger[_0x5432('0xd')](_0x5432('0x21'),_0x345b51,JSON[_0x5432('0x10')](_0x3fb586));_0x31490c(_0x3fb586);})[_0x5432('0x16')](function(_0x1f4679){logger[_0x5432('0x12')](_0x5432('0x21'),_0x1f4679['message'],_0x345b51);_0x1d436c(_0x4e92d5[_0x5432('0x12')](0x1f4,_0x1f4679['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index e67d948..831a284 100644 --- a/server/api/intFreshsalesConfiguration/index.js +++ b/server/api/intFreshsalesConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d8c=['get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','post','create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x13476a,_0x5706e4){var _0x29081c=function(_0x43c1c8){while(--_0x43c1c8){_0x13476a['push'](_0x13476a['shift']());}};_0x29081c(++_0x5706e4);}(_0x2d8c,0xa8));var _0xc2d8=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0x2d8c[_0x1c8cc6];return _0x522936;};'use strict';var multer=require(_0xc2d8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc2d8('0x1'));var express=require(_0xc2d8('0x2'));var router=express[_0xc2d8('0x3')]();var fs_extra=require(_0xc2d8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc2d8('0x5'));var config=require(_0xc2d8('0x6'));var controller=require(_0xc2d8('0x7'));router[_0xc2d8('0x8')]('/',auth[_0xc2d8('0x9')](),controller[_0xc2d8('0xa')]);router[_0xc2d8('0x8')](_0xc2d8('0xb'),auth[_0xc2d8('0x9')](),controller[_0xc2d8('0xc')]);router[_0xc2d8('0x8')](_0xc2d8('0xd'),auth[_0xc2d8('0x9')](),controller[_0xc2d8('0xe')]);router[_0xc2d8('0x8')](_0xc2d8('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xc2d8('0x8')](_0xc2d8('0x10'),auth[_0xc2d8('0x9')](),controller['getFields']);router[_0xc2d8('0x11')]('/',auth[_0xc2d8('0x9')](),controller[_0xc2d8('0x12')]);router['put'](_0xc2d8('0xb'),auth[_0xc2d8('0x9')](),controller[_0xc2d8('0x13')]);router[_0xc2d8('0x14')](_0xc2d8('0xb'),auth['isAuthenticated'](),controller[_0xc2d8('0x15')]);module['exports']=router; \ No newline at end of file +var _0x123d=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','/:id/descriptions','/:id/fields','getFields','post','update','delete','destroy','exports','multer','util'];(function(_0x251041,_0x270cd8){var _0x2c2759=function(_0x1c06ca){while(--_0x1c06ca){_0x251041['push'](_0x251041['shift']());}};_0x2c2759(++_0x270cd8);}(_0x123d,0xd6));var _0xd123=function(_0x3783ab,_0xa5bc3b){_0x3783ab=_0x3783ab-0x0;var _0x4ddddf=_0x123d[_0x3783ab];return _0x4ddddf;};'use strict';var multer=require(_0xd123('0x0'));var util=require(_0xd123('0x1'));var path=require(_0xd123('0x2'));var timeout=require(_0xd123('0x3'));var express=require(_0xd123('0x4'));var router=express[_0xd123('0x5')]();var fs_extra=require(_0xd123('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd123('0x7'));var config=require(_0xd123('0x8'));var controller=require(_0xd123('0x9'));router[_0xd123('0xa')]('/',auth['isAuthenticated'](),controller[_0xd123('0xb')]);router[_0xd123('0xa')](_0xd123('0xc'),auth[_0xd123('0xd')](),controller[_0xd123('0xe')]);router[_0xd123('0xa')](_0xd123('0xf'),auth[_0xd123('0xd')](),controller['getSubjects']);router[_0xd123('0xa')](_0xd123('0x10'),auth[_0xd123('0xd')](),controller['getDescriptions']);router['get'](_0xd123('0x11'),auth[_0xd123('0xd')](),controller[_0xd123('0x12')]);router[_0xd123('0x13')]('/',auth[_0xd123('0xd')](),controller['create']);router['put'](_0xd123('0xc'),auth['isAuthenticated'](),controller[_0xd123('0x14')]);router[_0xd123('0x15')](_0xd123('0xc'),auth[_0xd123('0xd')](),controller[_0xd123('0x16')]);module[_0xd123('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index d322671..c497382 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c12=['STRING','sequelize','exports'];(function(_0x491d35,_0x43f6e5){var _0x5a2de7=function(_0x119155){while(--_0x119155){_0x491d35['push'](_0x491d35['shift']());}};_0x5a2de7(++_0x43f6e5);}(_0x6c12,0x19f));var _0x26c1=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x6c12[_0x20ef64];return _0x3707d8;};'use strict';var Sequelize=require(_0x26c1('0x0'));module[_0x26c1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x26c1('0x2')]}}; \ No newline at end of file +var _0xe713=['sequelize','exports','STRING'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe713,0xab));var _0x3e71=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0xe713[_0x218972];return _0x1bb1a8;};'use strict';var Sequelize=require(_0x3e71('0x0'));module[_0x3e71('0x1')]={'name':{'type':Sequelize[_0x3e71('0x2')]},'description':{'type':Sequelize[_0x3e71('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index eed5600..78129e1 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa683=['fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','type','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf'];(function(_0x5a5da0,_0x2eed8e){var _0x2ef731=function(_0x5c6dab){while(--_0x5c6dab){_0x5a5da0['push'](_0x5a5da0['shift']());}};_0x2ef731(++_0x2eed8e);}(_0xa683,0xa2));var _0x3a68=function(_0x42755b,_0x2dc8e1){_0x42755b=_0x42755b-0x0;var _0x11dfeb=_0xa683[_0x42755b];return _0x11dfeb;};'use strict';var emlformat=require(_0x3a68('0x0'));var rimraf=require(_0x3a68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a68('0x2'));var rp=require(_0x3a68('0x3'));var moment=require('moment');var BPromise=require(_0x3a68('0x4'));var Mustache=require('mustache');var util=require(_0x3a68('0x5'));var path=require(_0x3a68('0x6'));var sox=require(_0x3a68('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a68('0x8'));var _=require(_0x3a68('0x9'));var squel=require(_0x3a68('0xa'));var crypto=require('crypto');var jsforce=require(_0x3a68('0xb'));var deskjs=require(_0x3a68('0xc'));var toCsv=require(_0x3a68('0xd'));var querystring=require(_0x3a68('0xe'));var Papa=require(_0x3a68('0xf'));var Redis=require(_0x3a68('0x10'));var authService=require(_0x3a68('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3a68('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a68('0x13'))(_0x3a68('0x14'));var utils=require(_0x3a68('0x15'));var config=require(_0x3a68('0x16'));var licenseUtil=require(_0x3a68('0x17'));var db=require(_0x3a68('0x18'))['db'];function respondWithStatusCode(_0x17d996,_0x471d38){_0x471d38=_0x471d38||0xcc;return function(_0x5cee22){if(_0x5cee22){return _0x17d996[_0x3a68('0x19')](_0x471d38);}return _0x17d996[_0x3a68('0x1a')](_0x471d38)['end']();};}function respondWithResult(_0x85b76e,_0x5a5b8c){_0x5a5b8c=_0x5a5b8c||0xc8;return function(_0x48b52d){if(_0x48b52d){return _0x85b76e[_0x3a68('0x1a')](_0x5a5b8c)[_0x3a68('0x1b')](_0x48b52d);}};}function respondWithFilteredResult(_0x4a174a,_0x4f7e7e){return function(_0x1ecdb1){if(_0x1ecdb1){var _0xb4e67c=typeof _0x4f7e7e[_0x3a68('0x1c')]==='undefined'&&typeof _0x4f7e7e[_0x3a68('0x1d')]===_0x3a68('0x1e');var _0x46937c=_0x1ecdb1[_0x3a68('0x1f')];var _0x28ea1e=_0xb4e67c?0x0:_0x4f7e7e[_0x3a68('0x1c')];var _0x33d7a6=_0xb4e67c?_0x1ecdb1[_0x3a68('0x1f')]:_0x4f7e7e[_0x3a68('0x1c')]+_0x4f7e7e['limit'];var _0x2016a8;if(_0x33d7a6>=_0x46937c){_0x33d7a6=_0x46937c;_0x2016a8=0xc8;}else{_0x2016a8=0xce;}_0x4a174a[_0x3a68('0x1a')](_0x2016a8);return _0x4a174a[_0x3a68('0x20')](_0x3a68('0x21'),_0x28ea1e+'-'+_0x33d7a6+'/'+_0x46937c)['json'](_0x1ecdb1);}return null;};}function patchUpdates(_0x330f19){return function(_0x5b83d1){try{jsonpatch[_0x3a68('0x22')](_0x5b83d1,_0x330f19,!![]);}catch(_0x2f49fe){return BPromise[_0x3a68('0x23')](_0x2f49fe);}return _0x5b83d1[_0x3a68('0x24')]();};}function saveUpdates(_0x1d8987,_0x237be0){return function(_0x77a04b){if(_0x77a04b){return _0x77a04b[_0x3a68('0x25')](_0x1d8987)['then'](function(_0x404875){return _0x404875;});}return null;};}function removeEntity(_0x517a2c,_0x495da5){return function(_0x59ea91){if(_0x59ea91){return _0x59ea91['destroy']()[_0x3a68('0x26')](function(){_0x517a2c[_0x3a68('0x1a')](0xcc)[_0x3a68('0x27')]();});}};}function handleEntityNotFound(_0x159cf5,_0x2029b2){return function(_0x52d592){if(!_0x52d592){_0x159cf5[_0x3a68('0x19')](0x194);}return _0x52d592;};}function handleError(_0x4102ca,_0x2ad792){_0x2ad792=_0x2ad792||0x1f4;return function(_0x53efad){logger[_0x3a68('0x28')](_0x53efad[_0x3a68('0x29')]);if(_0x53efad[_0x3a68('0x2a')]){delete _0x53efad[_0x3a68('0x2a')];}_0x4102ca[_0x3a68('0x1a')](_0x2ad792)[_0x3a68('0x2b')](_0x53efad);};}exports[_0x3a68('0x2c')]=function(_0x529650,_0x2fcc00){var _0x4c9856={},_0x2ddd2a={},_0x5bd9b5={'count':0x0,'rows':[]};var _0x305290=_['map'](db[_0x3a68('0x2d')][_0x3a68('0x2e')],function(_0x49d8ed){return{'name':_0x49d8ed[_0x3a68('0x2f')],'type':_0x49d8ed['type']['key']};});_0x2ddd2a[_0x3a68('0x30')]=_['map'](_0x305290,'name');_0x2ddd2a[_0x3a68('0x31')]=_[_0x3a68('0x32')](_0x529650[_0x3a68('0x31')]);_0x2ddd2a['filters']=_[_0x3a68('0x33')](_0x2ddd2a[_0x3a68('0x30')],_0x2ddd2a['query']);_0x4c9856[_0x3a68('0x34')]=_[_0x3a68('0x33')](_0x2ddd2a[_0x3a68('0x30')],qs[_0x3a68('0x35')](_0x529650[_0x3a68('0x31')][_0x3a68('0x35')]));_0x4c9856[_0x3a68('0x34')]=_0x4c9856[_0x3a68('0x34')][_0x3a68('0x36')]?_0x4c9856[_0x3a68('0x34')]:_0x2ddd2a[_0x3a68('0x30')];if(!_0x529650['query'][_0x3a68('0x37')](_0x3a68('0x38'))){_0x4c9856[_0x3a68('0x1d')]=qs[_0x3a68('0x1d')](_0x529650[_0x3a68('0x31')][_0x3a68('0x1d')]);_0x4c9856[_0x3a68('0x1c')]=qs[_0x3a68('0x1c')](_0x529650[_0x3a68('0x31')][_0x3a68('0x1c')]);}_0x4c9856[_0x3a68('0x39')]=qs[_0x3a68('0x3a')](_0x529650['query'][_0x3a68('0x3a')]);_0x4c9856[_0x3a68('0x3b')]=qs['filters'](_[_0x3a68('0x3c')](_0x529650[_0x3a68('0x31')],_0x2ddd2a[_0x3a68('0x3d')]),_0x305290);if(_0x529650[_0x3a68('0x31')][_0x3a68('0x3e')]){_0x4c9856['where']=_[_0x3a68('0x3f')](_0x4c9856[_0x3a68('0x3b')],{'$or':_[_0x3a68('0x40')](_0x305290,function(_0xb91df3){if(_0xb91df3[_0x3a68('0x41')]!==_0x3a68('0x42')){var _0x58f71e={};_0x58f71e[_0xb91df3[_0x3a68('0x2a')]]={'$like':'%'+_0x529650['query']['filter']+'%'};return _0x58f71e;}})});}_0x4c9856=_['merge']({},_0x4c9856,_0x529650[_0x3a68('0x43')]);var _0x1b30b0={'where':_0x4c9856[_0x3a68('0x3b')]};return db[_0x3a68('0x2d')]['count'](_0x1b30b0)[_0x3a68('0x26')](function(_0x51b610){_0x5bd9b5['count']=_0x51b610;if(_0x529650[_0x3a68('0x31')]['includeAll']){_0x4c9856[_0x3a68('0x44')]=[{'all':!![]}];}return db[_0x3a68('0x2d')][_0x3a68('0x45')](_0x4c9856);})['then'](function(_0x4ab7aa){_0x5bd9b5[_0x3a68('0x46')]=_0x4ab7aa;return _0x5bd9b5;})[_0x3a68('0x26')](respondWithFilteredResult(_0x2fcc00,_0x4c9856))[_0x3a68('0x47')](handleError(_0x2fcc00,null));};exports['show']=function(_0x4959bf,_0x19ab8d){var _0x2e24ce={'raw':![],'where':{'id':_0x4959bf[_0x3a68('0x48')]['id']}},_0x346193={};_0x346193['model']=_[_0x3a68('0x32')](db[_0x3a68('0x2d')][_0x3a68('0x2e')]);_0x346193[_0x3a68('0x31')]=_[_0x3a68('0x32')](_0x4959bf[_0x3a68('0x31')]);_0x346193[_0x3a68('0x3d')]=_[_0x3a68('0x33')](_0x346193['model'],_0x346193['query']);_0x2e24ce['attributes']=_[_0x3a68('0x33')](_0x346193['model'],qs[_0x3a68('0x35')](_0x4959bf[_0x3a68('0x31')][_0x3a68('0x35')]));_0x2e24ce['attributes']=_0x2e24ce['attributes'][_0x3a68('0x36')]?_0x2e24ce['attributes']:_0x346193[_0x3a68('0x30')];if(_0x4959bf['query']['includeAll']){_0x2e24ce[_0x3a68('0x44')]=[{'all':!![]}];}_0x2e24ce=_[_0x3a68('0x3f')]({},_0x2e24ce,_0x4959bf[_0x3a68('0x43')]);return db[_0x3a68('0x2d')][_0x3a68('0x49')](_0x2e24ce)['then'](handleEntityNotFound(_0x19ab8d,null))[_0x3a68('0x26')](respondWithResult(_0x19ab8d,null))['catch'](handleError(_0x19ab8d,null));};exports[_0x3a68('0x4a')]=function(_0x40c230,_0x2a670c){return db[_0x3a68('0x2d')][_0x3a68('0x4a')](_0x40c230[_0x3a68('0x4b')],{})[_0x3a68('0x26')](respondWithResult(_0x2a670c,0xc9))[_0x3a68('0x47')](handleError(_0x2a670c,null));};exports[_0x3a68('0x25')]=function(_0x229487,_0x533249){if(_0x229487[_0x3a68('0x4b')]['id']){delete _0x229487['body']['id'];}return db[_0x3a68('0x2d')]['find']({'where':{'id':_0x229487[_0x3a68('0x48')]['id']}})[_0x3a68('0x26')](handleEntityNotFound(_0x533249,null))[_0x3a68('0x26')](saveUpdates(_0x229487[_0x3a68('0x4b')],null))['then'](respondWithResult(_0x533249,null))['catch'](handleError(_0x533249,null));};exports[_0x3a68('0x4c')]=function(_0x2d9e07,_0x10069c){return db[_0x3a68('0x2d')][_0x3a68('0x49')]({'where':{'id':_0x2d9e07[_0x3a68('0x48')]['id']}})[_0x3a68('0x26')](handleEntityNotFound(_0x10069c,null))[_0x3a68('0x26')](removeEntity(_0x10069c,null))[_0x3a68('0x47')](handleError(_0x10069c,null));};exports[_0x3a68('0x4d')]=function(_0x3c0bc5,_0x2d1452,_0x26fad3){var _0x346fc9={};var _0xfa3a25={};var _0x52d471;var _0x8424bd;return db[_0x3a68('0x2d')][_0x3a68('0x4e')]({'where':{'id':_0x3c0bc5[_0x3a68('0x48')]['id']}})[_0x3a68('0x26')](handleEntityNotFound(_0x2d1452,null))[_0x3a68('0x26')](function(_0xa8658a){if(_0xa8658a){_0x52d471=_0xa8658a;_0xfa3a25[_0x3a68('0x30')]=_[_0x3a68('0x32')](db[_0x3a68('0x4f')][_0x3a68('0x2e')]);_0xfa3a25['query']=_[_0x3a68('0x32')](_0x3c0bc5[_0x3a68('0x31')]);_0xfa3a25['filters']=_[_0x3a68('0x33')](_0xfa3a25[_0x3a68('0x30')],_0xfa3a25['query']);_0x346fc9[_0x3a68('0x34')]=_[_0x3a68('0x33')](_0xfa3a25['model'],qs[_0x3a68('0x35')](_0x3c0bc5['query']['fields']));_0x346fc9[_0x3a68('0x34')]=_0x346fc9[_0x3a68('0x34')][_0x3a68('0x36')]?_0x346fc9[_0x3a68('0x34')]:_0xfa3a25[_0x3a68('0x30')];_0x346fc9[_0x3a68('0x39')]=qs['sort'](_0x3c0bc5['query']['sort']);_0x346fc9[_0x3a68('0x3b')]=qs['filters'](_[_0x3a68('0x3c')](_0x3c0bc5['query'],_0xfa3a25[_0x3a68('0x3d')]));if(_0x3c0bc5['query'][_0x3a68('0x3e')]){_0x346fc9[_0x3a68('0x3b')]=_[_0x3a68('0x3f')](_0x346fc9['where'],{'$or':_[_0x3a68('0x40')](_0x346fc9[_0x3a68('0x34')],function(_0x298bb9){var _0x33cf9b={};_0x33cf9b[_0x298bb9]={'$like':'%'+_0x3c0bc5[_0x3a68('0x31')][_0x3a68('0x3e')]+'%'};return _0x33cf9b;})});}_0x346fc9=_['merge']({},_0x346fc9,_0x3c0bc5['options']);return _0x52d471[_0x3a68('0x4d')](_0x346fc9);}})['then'](function(_0x239274){if(_0x239274){_0x8424bd=_0x239274[_0x3a68('0x36')];if(!_0x3c0bc5[_0x3a68('0x31')][_0x3a68('0x37')](_0x3a68('0x38'))){_0x346fc9[_0x3a68('0x1d')]=qs[_0x3a68('0x1d')](_0x3c0bc5['query'][_0x3a68('0x1d')]);_0x346fc9[_0x3a68('0x1c')]=qs[_0x3a68('0x1c')](_0x3c0bc5['query'][_0x3a68('0x1c')]);}return _0x52d471['getSubjects'](_0x346fc9);}})[_0x3a68('0x26')](function(_0x37efe3){if(_0x37efe3){return _0x37efe3?{'count':_0x8424bd,'rows':_0x37efe3}:null;}})[_0x3a68('0x26')](respondWithResult(_0x2d1452,null))[_0x3a68('0x47')](handleError(_0x2d1452,null));};exports[_0x3a68('0x50')]=function(_0x5d652a,_0x326560,_0x53e850){var _0x4db767={};var _0x288b9b={};var _0x2ccc47;var _0x31824f;return db[_0x3a68('0x2d')]['findOne']({'where':{'id':_0x5d652a[_0x3a68('0x48')]['id']}})[_0x3a68('0x26')](handleEntityNotFound(_0x326560,null))[_0x3a68('0x26')](function(_0x230fae){if(_0x230fae){_0x2ccc47=_0x230fae;_0x288b9b[_0x3a68('0x30')]=_[_0x3a68('0x32')](db[_0x3a68('0x4f')][_0x3a68('0x2e')]);_0x288b9b[_0x3a68('0x31')]=_[_0x3a68('0x32')](_0x5d652a[_0x3a68('0x31')]);_0x288b9b['filters']=_[_0x3a68('0x33')](_0x288b9b['model'],_0x288b9b[_0x3a68('0x31')]);_0x4db767['attributes']=_[_0x3a68('0x33')](_0x288b9b[_0x3a68('0x30')],qs[_0x3a68('0x35')](_0x5d652a[_0x3a68('0x31')][_0x3a68('0x35')]));_0x4db767[_0x3a68('0x34')]=_0x4db767[_0x3a68('0x34')]['length']?_0x4db767[_0x3a68('0x34')]:_0x288b9b['model'];_0x4db767['order']=qs[_0x3a68('0x3a')](_0x5d652a[_0x3a68('0x31')][_0x3a68('0x3a')]);_0x4db767[_0x3a68('0x3b')]=qs['filters'](_[_0x3a68('0x3c')](_0x5d652a['query'],_0x288b9b['filters']));if(_0x5d652a[_0x3a68('0x31')][_0x3a68('0x3e')]){_0x4db767[_0x3a68('0x3b')]=_['merge'](_0x4db767[_0x3a68('0x3b')],{'$or':_[_0x3a68('0x40')](_0x4db767[_0x3a68('0x34')],function(_0x400552){var _0x1ca94c={};_0x1ca94c[_0x400552]={'$like':'%'+_0x5d652a['query'][_0x3a68('0x3e')]+'%'};return _0x1ca94c;})});}_0x4db767=_['merge']({},_0x4db767,_0x5d652a[_0x3a68('0x43')]);return _0x2ccc47[_0x3a68('0x50')](_0x4db767);}})[_0x3a68('0x26')](function(_0x1f385f){if(_0x1f385f){_0x31824f=_0x1f385f[_0x3a68('0x36')];if(!_0x5d652a[_0x3a68('0x31')]['hasOwnProperty'](_0x3a68('0x38'))){_0x4db767[_0x3a68('0x1d')]=qs[_0x3a68('0x1d')](_0x5d652a[_0x3a68('0x31')][_0x3a68('0x1d')]);_0x4db767['offset']=qs[_0x3a68('0x1c')](_0x5d652a[_0x3a68('0x31')]['offset']);}return _0x2ccc47['getDescriptions'](_0x4db767);}})[_0x3a68('0x26')](function(_0x1b3afe){if(_0x1b3afe){return _0x1b3afe?{'count':_0x31824f,'rows':_0x1b3afe}:null;}})[_0x3a68('0x26')](respondWithResult(_0x326560,null))[_0x3a68('0x47')](handleError(_0x326560,null));};exports[_0x3a68('0x51')]=function(_0x15ce2a,_0x1e107c,_0x3599a6){var _0x8eec60={};var _0x523085={};var _0x24c044;var _0x10db78;return db['FreshsalesConfiguration'][_0x3a68('0x4e')]({'where':{'id':_0x15ce2a['params']['id']}})[_0x3a68('0x26')](handleEntityNotFound(_0x1e107c,null))['then'](function(_0x2c430d){if(_0x2c430d){_0x24c044=_0x2c430d;_0x523085[_0x3a68('0x30')]=_[_0x3a68('0x32')](db[_0x3a68('0x4f')]['rawAttributes']);_0x523085[_0x3a68('0x31')]=_[_0x3a68('0x32')](_0x15ce2a[_0x3a68('0x31')]);_0x523085['filters']=_[_0x3a68('0x33')](_0x523085[_0x3a68('0x30')],_0x523085[_0x3a68('0x31')]);_0x8eec60['attributes']=_[_0x3a68('0x33')](_0x523085[_0x3a68('0x30')],qs['fields'](_0x15ce2a[_0x3a68('0x31')]['fields']));_0x8eec60[_0x3a68('0x34')]=_0x8eec60[_0x3a68('0x34')][_0x3a68('0x36')]?_0x8eec60['attributes']:_0x523085[_0x3a68('0x30')];_0x8eec60[_0x3a68('0x39')]=qs[_0x3a68('0x3a')](_0x15ce2a[_0x3a68('0x31')]['sort']);_0x8eec60[_0x3a68('0x3b')]=qs[_0x3a68('0x3d')](_['pick'](_0x15ce2a['query'],_0x523085[_0x3a68('0x3d')]));if(_0x15ce2a[_0x3a68('0x31')][_0x3a68('0x3e')]){_0x8eec60[_0x3a68('0x3b')]=_[_0x3a68('0x3f')](_0x8eec60[_0x3a68('0x3b')],{'$or':_[_0x3a68('0x40')](_0x8eec60[_0x3a68('0x34')],function(_0x49d851){var _0xafa88f={};_0xafa88f[_0x49d851]={'$like':'%'+_0x15ce2a[_0x3a68('0x31')][_0x3a68('0x3e')]+'%'};return _0xafa88f;})});}_0x8eec60=_[_0x3a68('0x3f')]({},_0x8eec60,_0x15ce2a[_0x3a68('0x43')]);return _0x24c044[_0x3a68('0x51')](_0x8eec60);}})['then'](function(_0x362078){if(_0x362078){_0x10db78=_0x362078[_0x3a68('0x36')];if(!_0x15ce2a[_0x3a68('0x31')][_0x3a68('0x37')]('nolimit')){_0x8eec60[_0x3a68('0x1d')]=qs[_0x3a68('0x1d')](_0x15ce2a[_0x3a68('0x31')][_0x3a68('0x1d')]);_0x8eec60['offset']=qs[_0x3a68('0x1c')](_0x15ce2a[_0x3a68('0x31')][_0x3a68('0x1c')]);}return _0x24c044[_0x3a68('0x51')](_0x8eec60);}})[_0x3a68('0x26')](function(_0x520145){if(_0x520145){return _0x520145?{'count':_0x10db78,'rows':_0x520145}:null;}})['then'](respondWithResult(_0x1e107c,null))[_0x3a68('0x47')](handleError(_0x1e107c,null));}; \ No newline at end of file +var _0xc50f=['where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getSubjects','findOne','fields','nolimit','getDescriptions','FreshsalesField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','apply','save','update','then','sendStatus','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter'];(function(_0x57354f,_0x2bc06f){var _0x41aeef=function(_0x5c298b){while(--_0x5c298b){_0x57354f['push'](_0x57354f['shift']());}};_0x41aeef(++_0x2bc06f);}(_0xc50f,0x66));var _0xfc50=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc50f[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xfc50('0x0'));var rimraf=require(_0xfc50('0x1'));var zipdir=require(_0xfc50('0x2'));var jsonpatch=require(_0xfc50('0x3'));var rp=require(_0xfc50('0x4'));var moment=require(_0xfc50('0x5'));var BPromise=require(_0xfc50('0x6'));var Mustache=require('mustache');var util=require(_0xfc50('0x7'));var path=require('path');var sox=require(_0xfc50('0x8'));var csv=require(_0xfc50('0x9'));var ejs=require(_0xfc50('0xa'));var fs=require('fs');var fs_extra=require(_0xfc50('0xb'));var _=require(_0xfc50('0xc'));var squel=require(_0xfc50('0xd'));var crypto=require(_0xfc50('0xe'));var jsforce=require(_0xfc50('0xf'));var deskjs=require(_0xfc50('0x10'));var toCsv=require(_0xfc50('0x9'));var querystring=require(_0xfc50('0x11'));var Papa=require(_0xfc50('0x12'));var Redis=require(_0xfc50('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xfc50('0x14'));var as=require(_0xfc50('0x15'));var hardwareService=require(_0xfc50('0x16'));var logger=require(_0xfc50('0x17'))(_0xfc50('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc50('0x19'));var db=require(_0xfc50('0x1a'))['db'];function respondWithStatusCode(_0x5656f1,_0x1b1c01){_0x1b1c01=_0x1b1c01||0xcc;return function(_0xb81a56){if(_0xb81a56){return _0x5656f1['sendStatus'](_0x1b1c01);}return _0x5656f1[_0xfc50('0x1b')](_0x1b1c01)[_0xfc50('0x1c')]();};}function respondWithResult(_0x16ebdf,_0x187597){_0x187597=_0x187597||0xc8;return function(_0x46c5b8){if(_0x46c5b8){return _0x16ebdf['status'](_0x187597)[_0xfc50('0x1d')](_0x46c5b8);}};}function respondWithFilteredResult(_0xe8733f,_0x1c670c){return function(_0x13cc5f){if(_0x13cc5f){var _0x583f70=typeof _0x1c670c[_0xfc50('0x1e')]==='undefined'&&typeof _0x1c670c[_0xfc50('0x1f')]==='undefined';var _0x4e8ca9=_0x13cc5f[_0xfc50('0x20')];var _0x1d6750=_0x583f70?0x0:_0x1c670c['offset'];var _0x101dae=_0x583f70?_0x13cc5f['count']:_0x1c670c['offset']+_0x1c670c[_0xfc50('0x1f')];var _0x25a835;if(_0x101dae>=_0x4e8ca9){_0x101dae=_0x4e8ca9;_0x25a835=0xc8;}else{_0x25a835=0xce;}_0xe8733f[_0xfc50('0x1b')](_0x25a835);return _0xe8733f[_0xfc50('0x21')]('Content-Range',_0x1d6750+'-'+_0x101dae+'/'+_0x4e8ca9)[_0xfc50('0x1d')](_0x13cc5f);}return null;};}function patchUpdates(_0x177656){return function(_0x5c0a3c){try{jsonpatch[_0xfc50('0x22')](_0x5c0a3c,_0x177656,!![]);}catch(_0x385560){return BPromise['reject'](_0x385560);}return _0x5c0a3c[_0xfc50('0x23')]();};}function saveUpdates(_0x25610f,_0x317fe4){return function(_0x453ea8){if(_0x453ea8){return _0x453ea8[_0xfc50('0x24')](_0x25610f)[_0xfc50('0x25')](function(_0x51d488){return _0x51d488;});}return null;};}function removeEntity(_0x5a49c6,_0x4a10f0){return function(_0x1b0bcf){if(_0x1b0bcf){return _0x1b0bcf['destroy']()['then'](function(){_0x5a49c6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x167e8e,_0x1cec7e){return function(_0x56491d){if(!_0x56491d){_0x167e8e[_0xfc50('0x26')](0x194);}return _0x56491d;};}function handleError(_0x743fae,_0x27509c){_0x27509c=_0x27509c||0x1f4;return function(_0x1fa74e){logger[_0xfc50('0x27')](_0x1fa74e[_0xfc50('0x28')]);if(_0x1fa74e[_0xfc50('0x29')]){delete _0x1fa74e['name'];}_0x743fae['status'](_0x27509c)['send'](_0x1fa74e);};}exports[_0xfc50('0x2a')]=function(_0x5a5818,_0x1a7151){var _0x2b59c7={},_0x18b3bc={},_0x1835ea={'count':0x0,'rows':[]};var _0x544878=_[_0xfc50('0x2b')](db[_0xfc50('0x2c')][_0xfc50('0x2d')],function(_0xa3c539){return{'name':_0xa3c539['fieldName'],'type':_0xa3c539[_0xfc50('0x2e')][_0xfc50('0x2f')]};});_0x18b3bc[_0xfc50('0x30')]=_[_0xfc50('0x2b')](_0x544878,'name');_0x18b3bc['query']=_[_0xfc50('0x31')](_0x5a5818[_0xfc50('0x32')]);_0x18b3bc[_0xfc50('0x33')]=_[_0xfc50('0x34')](_0x18b3bc[_0xfc50('0x30')],_0x18b3bc[_0xfc50('0x32')]);_0x2b59c7[_0xfc50('0x35')]=_[_0xfc50('0x34')](_0x18b3bc[_0xfc50('0x30')],qs['fields'](_0x5a5818[_0xfc50('0x32')]['fields']));_0x2b59c7[_0xfc50('0x35')]=_0x2b59c7[_0xfc50('0x35')][_0xfc50('0x36')]?_0x2b59c7[_0xfc50('0x35')]:_0x18b3bc[_0xfc50('0x30')];if(!_0x5a5818['query'][_0xfc50('0x37')]('nolimit')){_0x2b59c7[_0xfc50('0x1f')]=qs['limit'](_0x5a5818['query'][_0xfc50('0x1f')]);_0x2b59c7['offset']=qs[_0xfc50('0x1e')](_0x5a5818[_0xfc50('0x32')][_0xfc50('0x1e')]);}_0x2b59c7[_0xfc50('0x38')]=qs['sort'](_0x5a5818[_0xfc50('0x32')][_0xfc50('0x39')]);_0x2b59c7['where']=qs[_0xfc50('0x33')](_[_0xfc50('0x3a')](_0x5a5818[_0xfc50('0x32')],_0x18b3bc[_0xfc50('0x33')]),_0x544878);if(_0x5a5818[_0xfc50('0x32')][_0xfc50('0x3b')]){_0x2b59c7[_0xfc50('0x3c')]=_[_0xfc50('0x3d')](_0x2b59c7[_0xfc50('0x3c')],{'$or':_[_0xfc50('0x2b')](_0x544878,function(_0x2595c2){if(_0x2595c2[_0xfc50('0x2e')]!==_0xfc50('0x3e')){var _0x20b282={};_0x20b282[_0x2595c2['name']]={'$like':'%'+_0x5a5818[_0xfc50('0x32')][_0xfc50('0x3b')]+'%'};return _0x20b282;}})});}_0x2b59c7=_['merge']({},_0x2b59c7,_0x5a5818[_0xfc50('0x3f')]);var _0x122f86={'where':_0x2b59c7[_0xfc50('0x3c')]};return db[_0xfc50('0x2c')][_0xfc50('0x20')](_0x122f86)[_0xfc50('0x25')](function(_0xee73cb){_0x1835ea[_0xfc50('0x20')]=_0xee73cb;if(_0x5a5818['query'][_0xfc50('0x40')]){_0x2b59c7[_0xfc50('0x41')]=[{'all':!![]}];}return db[_0xfc50('0x2c')][_0xfc50('0x42')](_0x2b59c7);})[_0xfc50('0x25')](function(_0x37a32e){_0x1835ea[_0xfc50('0x43')]=_0x37a32e;return _0x1835ea;})[_0xfc50('0x25')](respondWithFilteredResult(_0x1a7151,_0x2b59c7))[_0xfc50('0x44')](handleError(_0x1a7151,null));};exports[_0xfc50('0x45')]=function(_0x291d3f,_0x2a6fa9){var _0x59c8dd={'raw':![],'where':{'id':_0x291d3f[_0xfc50('0x46')]['id']}},_0x11dea2={};_0x11dea2['model']=_[_0xfc50('0x31')](db[_0xfc50('0x2c')]['rawAttributes']);_0x11dea2[_0xfc50('0x32')]=_[_0xfc50('0x31')](_0x291d3f[_0xfc50('0x32')]);_0x11dea2['filters']=_[_0xfc50('0x34')](_0x11dea2[_0xfc50('0x30')],_0x11dea2[_0xfc50('0x32')]);_0x59c8dd[_0xfc50('0x35')]=_[_0xfc50('0x34')](_0x11dea2['model'],qs['fields'](_0x291d3f[_0xfc50('0x32')]['fields']));_0x59c8dd['attributes']=_0x59c8dd['attributes'][_0xfc50('0x36')]?_0x59c8dd['attributes']:_0x11dea2[_0xfc50('0x30')];if(_0x291d3f[_0xfc50('0x32')][_0xfc50('0x40')]){_0x59c8dd['include']=[{'all':!![]}];}_0x59c8dd=_[_0xfc50('0x3d')]({},_0x59c8dd,_0x291d3f['options']);return db[_0xfc50('0x2c')][_0xfc50('0x47')](_0x59c8dd)[_0xfc50('0x25')](handleEntityNotFound(_0x2a6fa9,null))[_0xfc50('0x25')](respondWithResult(_0x2a6fa9,null))['catch'](handleError(_0x2a6fa9,null));};exports[_0xfc50('0x48')]=function(_0x1bf1e5,_0x21a55a){return db[_0xfc50('0x2c')][_0xfc50('0x48')](_0x1bf1e5[_0xfc50('0x49')],{})[_0xfc50('0x25')](respondWithResult(_0x21a55a,0xc9))[_0xfc50('0x44')](handleError(_0x21a55a,null));};exports[_0xfc50('0x24')]=function(_0x3a745c,_0x3cb852){if(_0x3a745c[_0xfc50('0x49')]['id']){delete _0x3a745c[_0xfc50('0x49')]['id'];}return db[_0xfc50('0x2c')]['find']({'where':{'id':_0x3a745c[_0xfc50('0x46')]['id']}})[_0xfc50('0x25')](handleEntityNotFound(_0x3cb852,null))[_0xfc50('0x25')](saveUpdates(_0x3a745c[_0xfc50('0x49')],null))['then'](respondWithResult(_0x3cb852,null))[_0xfc50('0x44')](handleError(_0x3cb852,null));};exports[_0xfc50('0x4a')]=function(_0x58ad69,_0x3ca122){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x58ad69[_0xfc50('0x46')]['id']}})[_0xfc50('0x25')](handleEntityNotFound(_0x3ca122,null))['then'](removeEntity(_0x3ca122,null))[_0xfc50('0x44')](handleError(_0x3ca122,null));};exports[_0xfc50('0x4b')]=function(_0x4ffb9a,_0x1e2a7e,_0x4b9e53){var _0x64d8ac={};var _0x298b2d={};var _0x44a6d7;var _0x4e5551;return db[_0xfc50('0x2c')][_0xfc50('0x4c')]({'where':{'id':_0x4ffb9a['params']['id']}})[_0xfc50('0x25')](handleEntityNotFound(_0x1e2a7e,null))[_0xfc50('0x25')](function(_0x4babb2){if(_0x4babb2){_0x44a6d7=_0x4babb2;_0x298b2d[_0xfc50('0x30')]=_[_0xfc50('0x31')](db['FreshsalesField']['rawAttributes']);_0x298b2d[_0xfc50('0x32')]=_[_0xfc50('0x31')](_0x4ffb9a['query']);_0x298b2d[_0xfc50('0x33')]=_[_0xfc50('0x34')](_0x298b2d[_0xfc50('0x30')],_0x298b2d[_0xfc50('0x32')]);_0x64d8ac['attributes']=_[_0xfc50('0x34')](_0x298b2d[_0xfc50('0x30')],qs[_0xfc50('0x4d')](_0x4ffb9a[_0xfc50('0x32')][_0xfc50('0x4d')]));_0x64d8ac['attributes']=_0x64d8ac[_0xfc50('0x35')]['length']?_0x64d8ac['attributes']:_0x298b2d[_0xfc50('0x30')];_0x64d8ac['order']=qs[_0xfc50('0x39')](_0x4ffb9a[_0xfc50('0x32')]['sort']);_0x64d8ac[_0xfc50('0x3c')]=qs[_0xfc50('0x33')](_[_0xfc50('0x3a')](_0x4ffb9a[_0xfc50('0x32')],_0x298b2d[_0xfc50('0x33')]));if(_0x4ffb9a[_0xfc50('0x32')][_0xfc50('0x3b')]){_0x64d8ac['where']=_[_0xfc50('0x3d')](_0x64d8ac[_0xfc50('0x3c')],{'$or':_[_0xfc50('0x2b')](_0x64d8ac[_0xfc50('0x35')],function(_0x409653){var _0x3df1b1={};_0x3df1b1[_0x409653]={'$like':'%'+_0x4ffb9a[_0xfc50('0x32')]['filter']+'%'};return _0x3df1b1;})});}_0x64d8ac=_[_0xfc50('0x3d')]({},_0x64d8ac,_0x4ffb9a[_0xfc50('0x3f')]);return _0x44a6d7[_0xfc50('0x4b')](_0x64d8ac);}})[_0xfc50('0x25')](function(_0x2241e0){if(_0x2241e0){_0x4e5551=_0x2241e0[_0xfc50('0x36')];if(!_0x4ffb9a[_0xfc50('0x32')][_0xfc50('0x37')](_0xfc50('0x4e'))){_0x64d8ac[_0xfc50('0x1f')]=qs[_0xfc50('0x1f')](_0x4ffb9a[_0xfc50('0x32')]['limit']);_0x64d8ac['offset']=qs[_0xfc50('0x1e')](_0x4ffb9a[_0xfc50('0x32')][_0xfc50('0x1e')]);}return _0x44a6d7[_0xfc50('0x4b')](_0x64d8ac);}})[_0xfc50('0x25')](function(_0x32320b){if(_0x32320b){return _0x32320b?{'count':_0x4e5551,'rows':_0x32320b}:null;}})[_0xfc50('0x25')](respondWithResult(_0x1e2a7e,null))[_0xfc50('0x44')](handleError(_0x1e2a7e,null));};exports[_0xfc50('0x4f')]=function(_0x584e0d,_0x34739c,_0x185954){var _0x906c20={};var _0x186705={};var _0x149cf7;var _0x361f7f;return db[_0xfc50('0x2c')][_0xfc50('0x4c')]({'where':{'id':_0x584e0d[_0xfc50('0x46')]['id']}})[_0xfc50('0x25')](handleEntityNotFound(_0x34739c,null))[_0xfc50('0x25')](function(_0x4a92f4){if(_0x4a92f4){_0x149cf7=_0x4a92f4;_0x186705[_0xfc50('0x30')]=_['keys'](db[_0xfc50('0x50')][_0xfc50('0x2d')]);_0x186705[_0xfc50('0x32')]=_['keys'](_0x584e0d[_0xfc50('0x32')]);_0x186705[_0xfc50('0x33')]=_[_0xfc50('0x34')](_0x186705[_0xfc50('0x30')],_0x186705['query']);_0x906c20[_0xfc50('0x35')]=_[_0xfc50('0x34')](_0x186705['model'],qs[_0xfc50('0x4d')](_0x584e0d['query'][_0xfc50('0x4d')]));_0x906c20[_0xfc50('0x35')]=_0x906c20[_0xfc50('0x35')][_0xfc50('0x36')]?_0x906c20['attributes']:_0x186705[_0xfc50('0x30')];_0x906c20['order']=qs['sort'](_0x584e0d[_0xfc50('0x32')][_0xfc50('0x39')]);_0x906c20['where']=qs[_0xfc50('0x33')](_[_0xfc50('0x3a')](_0x584e0d[_0xfc50('0x32')],_0x186705[_0xfc50('0x33')]));if(_0x584e0d[_0xfc50('0x32')][_0xfc50('0x3b')]){_0x906c20['where']=_['merge'](_0x906c20[_0xfc50('0x3c')],{'$or':_['map'](_0x906c20[_0xfc50('0x35')],function(_0x1774ba){var _0x21b1b1={};_0x21b1b1[_0x1774ba]={'$like':'%'+_0x584e0d[_0xfc50('0x32')]['filter']+'%'};return _0x21b1b1;})});}_0x906c20=_[_0xfc50('0x3d')]({},_0x906c20,_0x584e0d[_0xfc50('0x3f')]);return _0x149cf7['getDescriptions'](_0x906c20);}})['then'](function(_0x5b913c){if(_0x5b913c){_0x361f7f=_0x5b913c[_0xfc50('0x36')];if(!_0x584e0d[_0xfc50('0x32')]['hasOwnProperty'](_0xfc50('0x4e'))){_0x906c20[_0xfc50('0x1f')]=qs['limit'](_0x584e0d[_0xfc50('0x32')][_0xfc50('0x1f')]);_0x906c20[_0xfc50('0x1e')]=qs[_0xfc50('0x1e')](_0x584e0d[_0xfc50('0x32')][_0xfc50('0x1e')]);}return _0x149cf7[_0xfc50('0x4f')](_0x906c20);}})[_0xfc50('0x25')](function(_0x3fce0e){if(_0x3fce0e){return _0x3fce0e?{'count':_0x361f7f,'rows':_0x3fce0e}:null;}})['then'](respondWithResult(_0x34739c,null))[_0xfc50('0x44')](handleError(_0x34739c,null));};exports['getFields']=function(_0x53b778,_0xf3004a,_0x3d1b5d){var _0x48a50b={};var _0x335793={};var _0x2f5eb4;var _0xa788cf;return db[_0xfc50('0x2c')]['findOne']({'where':{'id':_0x53b778[_0xfc50('0x46')]['id']}})[_0xfc50('0x25')](handleEntityNotFound(_0xf3004a,null))[_0xfc50('0x25')](function(_0x100454){if(_0x100454){_0x2f5eb4=_0x100454;_0x335793['model']=_[_0xfc50('0x31')](db['FreshsalesField'][_0xfc50('0x2d')]);_0x335793[_0xfc50('0x32')]=_[_0xfc50('0x31')](_0x53b778[_0xfc50('0x32')]);_0x335793[_0xfc50('0x33')]=_[_0xfc50('0x34')](_0x335793[_0xfc50('0x30')],_0x335793[_0xfc50('0x32')]);_0x48a50b[_0xfc50('0x35')]=_[_0xfc50('0x34')](_0x335793[_0xfc50('0x30')],qs['fields'](_0x53b778['query'][_0xfc50('0x4d')]));_0x48a50b[_0xfc50('0x35')]=_0x48a50b[_0xfc50('0x35')][_0xfc50('0x36')]?_0x48a50b[_0xfc50('0x35')]:_0x335793['model'];_0x48a50b[_0xfc50('0x38')]=qs[_0xfc50('0x39')](_0x53b778[_0xfc50('0x32')][_0xfc50('0x39')]);_0x48a50b[_0xfc50('0x3c')]=qs[_0xfc50('0x33')](_[_0xfc50('0x3a')](_0x53b778[_0xfc50('0x32')],_0x335793[_0xfc50('0x33')]));if(_0x53b778[_0xfc50('0x32')][_0xfc50('0x3b')]){_0x48a50b[_0xfc50('0x3c')]=_[_0xfc50('0x3d')](_0x48a50b[_0xfc50('0x3c')],{'$or':_[_0xfc50('0x2b')](_0x48a50b['attributes'],function(_0x1d3bb3){var _0x2dba70={};_0x2dba70[_0x1d3bb3]={'$like':'%'+_0x53b778[_0xfc50('0x32')][_0xfc50('0x3b')]+'%'};return _0x2dba70;})});}_0x48a50b=_['merge']({},_0x48a50b,_0x53b778['options']);return _0x2f5eb4['getFields'](_0x48a50b);}})[_0xfc50('0x25')](function(_0x2d4707){if(_0x2d4707){_0xa788cf=_0x2d4707['length'];if(!_0x53b778['query']['hasOwnProperty'](_0xfc50('0x4e'))){_0x48a50b[_0xfc50('0x1f')]=qs['limit'](_0x53b778['query']['limit']);_0x48a50b[_0xfc50('0x1e')]=qs[_0xfc50('0x1e')](_0x53b778[_0xfc50('0x32')][_0xfc50('0x1e')]);}return _0x2f5eb4['getFields'](_0x48a50b);}})['then'](function(_0xcbdf79){if(_0xcbdf79){return _0xcbdf79?{'count':_0xa788cf,'rows':_0xcbdf79}:null;}})[_0xfc50('0x25')](respondWithResult(_0xf3004a,null))['catch'](handleError(_0xf3004a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 8522c9a..5710718 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaba5=['int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x42872c,_0x2f6e08){var _0x586d86=function(_0x371644){while(--_0x371644){_0x42872c['push'](_0x42872c['shift']());}};_0x586d86(++_0x2f6e08);}(_0xaba5,0x105));var _0x5aba=function(_0x2dbfed,_0x4c99ed){_0x2dbfed=_0x2dbfed-0x0;var _0x54c018=_0xaba5[_0x2dbfed];return _0x54c018;};'use strict';var _=require(_0x5aba('0x0'));var util=require(_0x5aba('0x1'));var logger=require(_0x5aba('0x2'))(_0x5aba('0x3'));var moment=require(_0x5aba('0x4'));var BPromise=require(_0x5aba('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5aba('0x6'));var rimraf=require('rimraf');var config=require(_0x5aba('0x7'));var attributes=require(_0x5aba('0x8'));module[_0x5aba('0x9')]=function(_0x2dbcc7,_0x135d1c){return _0x2dbcc7[_0x5aba('0xa')](_0x5aba('0xb'),attributes,{'tableName':_0x5aba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c65=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xba39bc,_0x53262f){var _0x152e04=function(_0x7d82ce){while(--_0x7d82ce){_0xba39bc['push'](_0xba39bc['shift']());}};_0x152e04(++_0x53262f);}(_0x2c65,0x130));var _0x52c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c65[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x52c6('0x0'));var util=require(_0x52c6('0x1'));var logger=require(_0x52c6('0x2'))(_0x52c6('0x3'));var moment=require(_0x52c6('0x4'));var BPromise=require(_0x52c6('0x5'));var rp=require(_0x52c6('0x6'));var fs=require('fs');var path=require(_0x52c6('0x7'));var rimraf=require(_0x52c6('0x8'));var config=require(_0x52c6('0x9'));var attributes=require(_0x52c6('0xa'));module[_0x52c6('0xb')]=function(_0x2320cd,_0x3d300d){return _0x2320cd['define'](_0x52c6('0xc'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 2261c8f..cbc08e5 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb993=['../../config/logger','rpc','jayson/promise','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x6b15e9,_0x20eaa3){var _0x630fd6=function(_0x2b25a4){while(--_0x2b25a4){_0x6b15e9['push'](_0x6b15e9['shift']());}};_0x630fd6(++_0x20eaa3);}(_0xb993,0x1b2));var _0x3b99=function(_0xa4c877,_0x24a7c3){_0xa4c877=_0xa4c877-0x0;var _0x313b42=_0xb993[_0xa4c877];return _0x313b42;};'use strict';var _=require(_0x3b99('0x0'));var util=require(_0x3b99('0x1'));var moment=require(_0x3b99('0x2'));var BPromise=require(_0x3b99('0x3'));var rs=require(_0x3b99('0x4'));var fs=require('fs');var Redis=require(_0x3b99('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3b99('0x6'))(_0x3b99('0x7'));var config=require('../../config/environment');var jayson=require(_0x3b99('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ba9aa,_0x364bc4,_0x370ff1){return new BPromise(function(_0x4cfa7d,_0x2d2858){return client[_0x3b99('0x9')](_0x5ba9aa,_0x370ff1)[_0x3b99('0xa')](function(_0x3693f8){logger[_0x3b99('0xb')](_0x3b99('0xc'),_0x364bc4,_0x3b99('0xd'));logger[_0x3b99('0xe')](_0x3b99('0xf'),_0x364bc4,_0x3b99('0xd'),JSON[_0x3b99('0x10')](_0x3693f8));if(_0x3693f8[_0x3b99('0x11')]){if(_0x3693f8[_0x3b99('0x11')][_0x3b99('0x12')]===0x1f4){logger[_0x3b99('0x11')](_0x3b99('0xc'),_0x364bc4,_0x3693f8['error']['message']);return _0x2d2858(_0x3693f8[_0x3b99('0x11')]['message']);}logger['error'](_0x3b99('0xc'),_0x364bc4,_0x3693f8[_0x3b99('0x11')][_0x3b99('0x13')]);return _0x4cfa7d(_0x3693f8['error']['message']);}else{logger['info'](_0x3b99('0xc'),_0x364bc4,'request\x20sent');_0x4cfa7d(_0x3693f8[_0x3b99('0x14')][_0x3b99('0x13')]);}})[_0x3b99('0x15')](function(_0xe8839b){logger['error'](_0x3b99('0xc'),_0x364bc4,_0xe8839b);_0x2d2858(_0xe8839b);});});} \ No newline at end of file +var _0xa052=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x417a94,_0x14f396){var _0x20e7d5=function(_0x2bdec7){while(--_0x2bdec7){_0x417a94['push'](_0x417a94['shift']());}};_0x20e7d5(++_0x14f396);}(_0xa052,0x99));var _0x2a05=function(_0x333a64,_0x3ef4a6){_0x333a64=_0x333a64-0x0;var _0x3b8c1e=_0xa052[_0x333a64];return _0x3b8c1e;};'use strict';var _=require(_0x2a05('0x0'));var util=require(_0x2a05('0x1'));var moment=require(_0x2a05('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a05('0x3'));var fs=require('fs');var Redis=require(_0x2a05('0x4'));var db=require(_0x2a05('0x5'))['db'];var utils=require(_0x2a05('0x6'));var logger=require(_0x2a05('0x7'))(_0x2a05('0x8'));var config=require(_0x2a05('0x9'));var jayson=require(_0x2a05('0xa'));var client=jayson[_0x2a05('0xb')][_0x2a05('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3db819,_0xbafe7e,_0x5562cd){return new BPromise(function(_0x156d30,_0x270f43){return client[_0x2a05('0xd')](_0x3db819,_0x5562cd)['then'](function(_0x4759f3){logger['info'](_0x2a05('0xe'),_0xbafe7e,_0x2a05('0xf'));logger[_0x2a05('0x10')](_0x2a05('0x11'),_0xbafe7e,_0x2a05('0xf'),JSON[_0x2a05('0x12')](_0x4759f3));if(_0x4759f3['error']){if(_0x4759f3[_0x2a05('0x13')][_0x2a05('0x14')]===0x1f4){logger['error'](_0x2a05('0xe'),_0xbafe7e,_0x4759f3[_0x2a05('0x13')][_0x2a05('0x15')]);return _0x270f43(_0x4759f3[_0x2a05('0x13')][_0x2a05('0x15')]);}logger[_0x2a05('0x13')](_0x2a05('0xe'),_0xbafe7e,_0x4759f3[_0x2a05('0x13')][_0x2a05('0x15')]);return _0x156d30(_0x4759f3[_0x2a05('0x13')][_0x2a05('0x15')]);}else{logger[_0x2a05('0x16')](_0x2a05('0xe'),_0xbafe7e,_0x2a05('0xf'));_0x156d30(_0x4759f3[_0x2a05('0x17')][_0x2a05('0x15')]);}})[_0x2a05('0x18')](function(_0xa9c86d){logger[_0x2a05('0x13')](_0x2a05('0xe'),_0xbafe7e,_0xa9c86d);_0x270f43(_0xa9c86d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 1ae73fe..22fa009 100644 --- a/server/api/intFreshsalesField/index.js +++ b/server/api/intFreshsalesField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a55=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','path'];(function(_0x2e4cdc,_0x281a98){var _0x2596ee=function(_0x29fe81){while(--_0x29fe81){_0x2e4cdc['push'](_0x2e4cdc['shift']());}};_0x2596ee(++_0x281a98);}(_0x6a55,0x154));var _0x56a5=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0x6a55[_0x21f9c2];return _0x3da17f;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require(_0x56a5('0x1'));var timeout=require(_0x56a5('0x2'));var express=require('express');var router=express[_0x56a5('0x3')]();var fs_extra=require(_0x56a5('0x4'));var auth=require(_0x56a5('0x5'));var interaction=require(_0x56a5('0x6'));var config=require(_0x56a5('0x7'));var controller=require(_0x56a5('0x8'));router[_0x56a5('0x9')]('/',auth[_0x56a5('0xa')](),controller[_0x56a5('0xb')]);router[_0x56a5('0x9')](_0x56a5('0xc'),auth[_0x56a5('0xa')](),controller[_0x56a5('0xd')]);router[_0x56a5('0xe')]('/',auth['isAuthenticated'](),controller[_0x56a5('0xf')]);router[_0x56a5('0x10')]('/:id',auth[_0x56a5('0xa')](),controller['update']);router['delete'](_0x56a5('0xc'),auth[_0x56a5('0xa')](),controller[_0x56a5('0x11')]);module[_0x56a5('0x12')]=router; \ No newline at end of file +var _0xc737=['get','/:id','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x37930,_0x113c18){var _0x25faec=function(_0x344734){while(--_0x344734){_0x37930['push'](_0x37930['shift']());}};_0x25faec(++_0x113c18);}(_0xc737,0x8e));var _0x7c73=function(_0x3ca54c,_0xdaddba){_0x3ca54c=_0x3ca54c-0x0;var _0xbbccb4=_0xc737[_0x3ca54c];return _0xbbccb4;};'use strict';var multer=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var path=require('path');var timeout=require(_0x7c73('0x2'));var express=require(_0x7c73('0x3'));var router=express[_0x7c73('0x4')]();var fs_extra=require(_0x7c73('0x5'));var auth=require(_0x7c73('0x6'));var interaction=require(_0x7c73('0x7'));var config=require(_0x7c73('0x8'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x7c73('0x9')](),controller[_0x7c73('0xa')]);router[_0x7c73('0xb')](_0x7c73('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7c73('0xd')](_0x7c73('0xc'),auth[_0x7c73('0x9')](),controller[_0x7c73('0xe')]);router['delete'](_0x7c73('0xc'),auth['isAuthenticated'](),controller[_0x7c73('0xf')]);module[_0x7c73('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index cb02ae7..ce8ae65 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.attributes.js +++ b/server/api/intFreshsalesField/intFreshsalesField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d5b=['ENUM','variable','customVariable','picklist','string','STRING'];(function(_0x487fb0,_0x52fde2){var _0x3b6538=function(_0x1bc67b){while(--_0x1bc67b){_0x487fb0['push'](_0x487fb0['shift']());}};_0x3b6538(++_0x52fde2);}(_0x7d5b,0x96));var _0xb7d5=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x7d5b[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb7d5('0x0')]('string',_0xb7d5('0x1'),_0xb7d5('0x2'),'keyValue',_0xb7d5('0x3')),'defaultValue':_0xb7d5('0x4')},'content':{'type':Sequelize[_0xb7d5('0x5')]},'key':{'type':Sequelize[_0xb7d5('0x5')]},'keyType':{'type':Sequelize[_0xb7d5('0x0')]('string',_0xb7d5('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0xb7d5('0x5')]},'idField':{'type':Sequelize[_0xb7d5('0x5')]},'nameField':{'type':Sequelize[_0xb7d5('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x50c9=['customVariable','BOOLEAN','exports','string','keyValue','STRING','ENUM','variable'];(function(_0x30e3c8,_0x5a531b){var _0x38c130=function(_0x125f7f){while(--_0x125f7f){_0x30e3c8['push'](_0x30e3c8['shift']());}};_0x38c130(++_0x5a531b);}(_0x50c9,0xda));var _0x950c=function(_0x46365d,_0x2e46a5){_0x46365d=_0x46365d-0x0;var _0x4e8368=_0x50c9[_0x46365d];return _0x4e8368;};'use strict';var Sequelize=require('sequelize');module[_0x950c('0x0')]={'type':{'type':Sequelize['ENUM'](_0x950c('0x1'),'variable','customVariable',_0x950c('0x2'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x950c('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x950c('0x4')](_0x950c('0x1'),_0x950c('0x5'),_0x950c('0x6'))},'keyContent':{'type':Sequelize[_0x950c('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x950c('0x3')]},'customField':{'type':Sequelize[_0x950c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x950c('0x3')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index fe3cedc..096b55f 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.controller.js +++ b/server/api/intFreshsalesField/intFreshsalesField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb419=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0xb419,0x65));var _0x9b41=function(_0xda28a9,_0x47dab9){_0xda28a9=_0xda28a9-0x0;var _0x2abaf9=_0xb419[_0xda28a9];return _0x2abaf9;};'use strict';var emlformat=require(_0x9b41('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b41('0x1'));var jsonpatch=require(_0x9b41('0x2'));var rp=require('request-promise');var moment=require(_0x9b41('0x3'));var BPromise=require(_0x9b41('0x4'));var Mustache=require(_0x9b41('0x5'));var util=require(_0x9b41('0x6'));var path=require(_0x9b41('0x7'));var sox=require(_0x9b41('0x8'));var csv=require(_0x9b41('0x9'));var ejs=require(_0x9b41('0xa'));var fs=require('fs');var fs_extra=require(_0x9b41('0xb'));var _=require('lodash');var squel=require(_0x9b41('0xc'));var crypto=require(_0x9b41('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9b41('0xe'));var toCsv=require(_0x9b41('0x9'));var querystring=require('querystring');var Papa=require(_0x9b41('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9b41('0x10'));var as=require(_0x9b41('0x11'));var hardwareService=require(_0x9b41('0x12'));var logger=require('../../config/logger')(_0x9b41('0x13'));var utils=require('../../config/utils');var config=require(_0x9b41('0x14'));var licenseUtil=require(_0x9b41('0x15'));var db=require(_0x9b41('0x16'))['db'];function respondWithStatusCode(_0x54793f,_0x2d701a){_0x2d701a=_0x2d701a||0xcc;return function(_0x1f1407){if(_0x1f1407){return _0x54793f[_0x9b41('0x17')](_0x2d701a);}return _0x54793f[_0x9b41('0x18')](_0x2d701a)['end']();};}function respondWithResult(_0x40d6c3,_0x4bcd84){_0x4bcd84=_0x4bcd84||0xc8;return function(_0x34c203){if(_0x34c203){return _0x40d6c3['status'](_0x4bcd84)[_0x9b41('0x19')](_0x34c203);}};}function respondWithFilteredResult(_0x49ff72,_0x2fe378){return function(_0x211e92){if(_0x211e92){var _0x461b1e=typeof _0x2fe378[_0x9b41('0x1a')]===_0x9b41('0x1b')&&typeof _0x2fe378[_0x9b41('0x1c')]==='undefined';var _0x3338b4=_0x211e92['count'];var _0x669d78=_0x461b1e?0x0:_0x2fe378['offset'];var _0x242802=_0x461b1e?_0x211e92[_0x9b41('0x1d')]:_0x2fe378['offset']+_0x2fe378[_0x9b41('0x1c')];var _0x5a33a6;if(_0x242802>=_0x3338b4){_0x242802=_0x3338b4;_0x5a33a6=0xc8;}else{_0x5a33a6=0xce;}_0x49ff72[_0x9b41('0x18')](_0x5a33a6);return _0x49ff72[_0x9b41('0x1e')](_0x9b41('0x1f'),_0x669d78+'-'+_0x242802+'/'+_0x3338b4)[_0x9b41('0x19')](_0x211e92);}return null;};}function patchUpdates(_0x23b5e5){return function(_0x1dfc73){try{jsonpatch[_0x9b41('0x20')](_0x1dfc73,_0x23b5e5,!![]);}catch(_0x14fc71){return BPromise[_0x9b41('0x21')](_0x14fc71);}return _0x1dfc73[_0x9b41('0x22')]();};}function saveUpdates(_0x338764,_0x30575c){return function(_0x51bdcc){if(_0x51bdcc){return _0x51bdcc[_0x9b41('0x23')](_0x338764)[_0x9b41('0x24')](function(_0x3e1bea){return _0x3e1bea;});}return null;};}function removeEntity(_0xdaa4df,_0x295e30){return function(_0x5a5c1f){if(_0x5a5c1f){return _0x5a5c1f[_0x9b41('0x25')]()[_0x9b41('0x24')](function(){_0xdaa4df[_0x9b41('0x18')](0xcc)[_0x9b41('0x26')]();});}};}function handleEntityNotFound(_0x32c0d9,_0x46a5bb){return function(_0x47c46f){if(!_0x47c46f){_0x32c0d9[_0x9b41('0x17')](0x194);}return _0x47c46f;};}function handleError(_0x5f2904,_0x4f3238){_0x4f3238=_0x4f3238||0x1f4;return function(_0x2e2793){logger[_0x9b41('0x27')](_0x2e2793[_0x9b41('0x28')]);if(_0x2e2793[_0x9b41('0x29')]){delete _0x2e2793[_0x9b41('0x29')];}_0x5f2904[_0x9b41('0x18')](_0x4f3238)[_0x9b41('0x2a')](_0x2e2793);};}exports[_0x9b41('0x2b')]=function(_0x2cb649,_0x162cf3){var _0x1db68c={},_0x127530={},_0x555f4c={'count':0x0,'rows':[]};var _0x3dce77=_[_0x9b41('0x2c')](db[_0x9b41('0x2d')][_0x9b41('0x2e')],function(_0x56daf9){return{'name':_0x56daf9[_0x9b41('0x2f')],'type':_0x56daf9['type'][_0x9b41('0x30')]};});_0x127530[_0x9b41('0x31')]=_[_0x9b41('0x2c')](_0x3dce77,_0x9b41('0x29'));_0x127530[_0x9b41('0x32')]=_[_0x9b41('0x33')](_0x2cb649[_0x9b41('0x32')]);_0x127530[_0x9b41('0x34')]=_[_0x9b41('0x35')](_0x127530[_0x9b41('0x31')],_0x127530[_0x9b41('0x32')]);_0x1db68c[_0x9b41('0x36')]=_['intersection'](_0x127530[_0x9b41('0x31')],qs[_0x9b41('0x37')](_0x2cb649[_0x9b41('0x32')]['fields']));_0x1db68c['attributes']=_0x1db68c[_0x9b41('0x36')][_0x9b41('0x38')]?_0x1db68c['attributes']:_0x127530[_0x9b41('0x31')];if(!_0x2cb649[_0x9b41('0x32')][_0x9b41('0x39')]('nolimit')){_0x1db68c[_0x9b41('0x1c')]=qs['limit'](_0x2cb649[_0x9b41('0x32')][_0x9b41('0x1c')]);_0x1db68c[_0x9b41('0x1a')]=qs[_0x9b41('0x1a')](_0x2cb649['query'][_0x9b41('0x1a')]);}_0x1db68c[_0x9b41('0x3a')]=qs[_0x9b41('0x3b')](_0x2cb649[_0x9b41('0x32')][_0x9b41('0x3b')]);_0x1db68c[_0x9b41('0x3c')]=qs[_0x9b41('0x34')](_[_0x9b41('0x3d')](_0x2cb649[_0x9b41('0x32')],_0x127530[_0x9b41('0x34')]),_0x3dce77);if(_0x2cb649[_0x9b41('0x32')][_0x9b41('0x3e')]){_0x1db68c[_0x9b41('0x3c')]=_['merge'](_0x1db68c[_0x9b41('0x3c')],{'$or':_[_0x9b41('0x2c')](_0x3dce77,function(_0x2afe1c){if(_0x2afe1c[_0x9b41('0x3f')]!==_0x9b41('0x40')){var _0x5960d7={};_0x5960d7[_0x2afe1c[_0x9b41('0x29')]]={'$like':'%'+_0x2cb649[_0x9b41('0x32')][_0x9b41('0x3e')]+'%'};return _0x5960d7;}})});}_0x1db68c=_[_0x9b41('0x41')]({},_0x1db68c,_0x2cb649[_0x9b41('0x42')]);var _0x5f4720={'where':_0x1db68c[_0x9b41('0x3c')]};return db[_0x9b41('0x2d')]['count'](_0x5f4720)[_0x9b41('0x24')](function(_0x1af173){_0x555f4c[_0x9b41('0x1d')]=_0x1af173;if(_0x2cb649[_0x9b41('0x32')][_0x9b41('0x43')]){_0x1db68c[_0x9b41('0x44')]=[{'all':!![]}];}return db[_0x9b41('0x2d')][_0x9b41('0x45')](_0x1db68c);})[_0x9b41('0x24')](function(_0x42060a){_0x555f4c[_0x9b41('0x46')]=_0x42060a;return _0x555f4c;})['then'](respondWithFilteredResult(_0x162cf3,_0x1db68c))[_0x9b41('0x47')](handleError(_0x162cf3,null));};exports['show']=function(_0x404d5b,_0x265886){var _0x3c910f={'raw':!![],'where':{'id':_0x404d5b[_0x9b41('0x48')]['id']}},_0x494efc={};_0x494efc['model']=_[_0x9b41('0x33')](db[_0x9b41('0x2d')][_0x9b41('0x2e')]);_0x494efc[_0x9b41('0x32')]=_[_0x9b41('0x33')](_0x404d5b[_0x9b41('0x32')]);_0x494efc['filters']=_[_0x9b41('0x35')](_0x494efc['model'],_0x494efc[_0x9b41('0x32')]);_0x3c910f[_0x9b41('0x36')]=_[_0x9b41('0x35')](_0x494efc[_0x9b41('0x31')],qs[_0x9b41('0x37')](_0x404d5b[_0x9b41('0x32')]['fields']));_0x3c910f[_0x9b41('0x36')]=_0x3c910f['attributes']['length']?_0x3c910f[_0x9b41('0x36')]:_0x494efc[_0x9b41('0x31')];if(_0x404d5b[_0x9b41('0x32')]['includeAll']){_0x3c910f[_0x9b41('0x44')]=[{'all':!![]}];}_0x3c910f=_[_0x9b41('0x41')]({},_0x3c910f,_0x404d5b[_0x9b41('0x42')]);return db[_0x9b41('0x2d')][_0x9b41('0x49')](_0x3c910f)['then'](handleEntityNotFound(_0x265886,null))[_0x9b41('0x24')](respondWithResult(_0x265886,null))['catch'](handleError(_0x265886,null));};exports[_0x9b41('0x4a')]=function(_0x3ef283,_0x449e20){return db['FreshsalesField'][_0x9b41('0x4a')](_0x3ef283[_0x9b41('0x4b')],{})[_0x9b41('0x24')](respondWithResult(_0x449e20,0xc9))[_0x9b41('0x47')](handleError(_0x449e20,null));};exports[_0x9b41('0x23')]=function(_0xd2d0eb,_0x309f75){if(_0xd2d0eb['body']['id']){delete _0xd2d0eb[_0x9b41('0x4b')]['id'];}return db[_0x9b41('0x2d')][_0x9b41('0x49')]({'where':{'id':_0xd2d0eb[_0x9b41('0x48')]['id']}})[_0x9b41('0x24')](handleEntityNotFound(_0x309f75,null))[_0x9b41('0x24')](saveUpdates(_0xd2d0eb['body'],null))['then'](respondWithResult(_0x309f75,null))[_0x9b41('0x47')](handleError(_0x309f75,null));};exports[_0x9b41('0x25')]=function(_0x46c739,_0x3a9a24){return db[_0x9b41('0x2d')][_0x9b41('0x49')]({'where':{'id':_0x46c739[_0x9b41('0x48')]['id']}})[_0x9b41('0x24')](handleEntityNotFound(_0x3a9a24,null))['then'](removeEntity(_0x3a9a24,null))['catch'](handleError(_0x3a9a24,null));}; \ No newline at end of file +var _0xcc5f=['model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','stack','name','map','FreshsalesField','rawAttributes'];(function(_0x3da72b,_0x4fd809){var _0xc64ac4=function(_0x387e50){while(--_0x387e50){_0x3da72b['push'](_0x3da72b['shift']());}};_0xc64ac4(++_0x4fd809);}(_0xcc5f,0x1c7));var _0xfcc5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcc5f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfcc5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcc5('0x1'));var jsonpatch=require(_0xfcc5('0x2'));var rp=require('request-promise');var moment=require(_0xfcc5('0x3'));var BPromise=require(_0xfcc5('0x4'));var Mustache=require('mustache');var util=require(_0xfcc5('0x5'));var path=require(_0xfcc5('0x6'));var sox=require('sox');var csv=require(_0xfcc5('0x7'));var ejs=require(_0xfcc5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcc5('0x9'));var squel=require('squel');var crypto=require(_0xfcc5('0xa'));var jsforce=require(_0xfcc5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfcc5('0x7'));var querystring=require(_0xfcc5('0xc'));var Papa=require(_0xfcc5('0xd'));var Redis=require(_0xfcc5('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfcc5('0xf'));var hardwareService=require(_0xfcc5('0x10'));var logger=require(_0xfcc5('0x11'))(_0xfcc5('0x12'));var utils=require(_0xfcc5('0x13'));var config=require(_0xfcc5('0x14'));var licenseUtil=require(_0xfcc5('0x15'));var db=require(_0xfcc5('0x16'))['db'];function respondWithStatusCode(_0x2f1f4c,_0x965bc4){_0x965bc4=_0x965bc4||0xcc;return function(_0x46636e){if(_0x46636e){return _0x2f1f4c[_0xfcc5('0x17')](_0x965bc4);}return _0x2f1f4c[_0xfcc5('0x18')](_0x965bc4)[_0xfcc5('0x19')]();};}function respondWithResult(_0x20d379,_0x4c8b46){_0x4c8b46=_0x4c8b46||0xc8;return function(_0xab06c9){if(_0xab06c9){return _0x20d379[_0xfcc5('0x18')](_0x4c8b46)[_0xfcc5('0x1a')](_0xab06c9);}};}function respondWithFilteredResult(_0x4f5338,_0x17a54f){return function(_0x17c49e){if(_0x17c49e){var _0x6aba2d=typeof _0x17a54f[_0xfcc5('0x1b')]==='undefined'&&typeof _0x17a54f[_0xfcc5('0x1c')]===_0xfcc5('0x1d');var _0x39f691=_0x17c49e['count'];var _0x39a8fe=_0x6aba2d?0x0:_0x17a54f[_0xfcc5('0x1b')];var _0x1497d3=_0x6aba2d?_0x17c49e[_0xfcc5('0x1e')]:_0x17a54f[_0xfcc5('0x1b')]+_0x17a54f[_0xfcc5('0x1c')];var _0x4cee5c;if(_0x1497d3>=_0x39f691){_0x1497d3=_0x39f691;_0x4cee5c=0xc8;}else{_0x4cee5c=0xce;}_0x4f5338[_0xfcc5('0x18')](_0x4cee5c);return _0x4f5338[_0xfcc5('0x1f')](_0xfcc5('0x20'),_0x39a8fe+'-'+_0x1497d3+'/'+_0x39f691)[_0xfcc5('0x1a')](_0x17c49e);}return null;};}function patchUpdates(_0x28a159){return function(_0x50655f){try{jsonpatch['apply'](_0x50655f,_0x28a159,!![]);}catch(_0x3f5190){return BPromise[_0xfcc5('0x21')](_0x3f5190);}return _0x50655f[_0xfcc5('0x22')]();};}function saveUpdates(_0x25f44d,_0x2db98b){return function(_0x8eae6d){if(_0x8eae6d){return _0x8eae6d[_0xfcc5('0x23')](_0x25f44d)[_0xfcc5('0x24')](function(_0x6f33ed){return _0x6f33ed;});}return null;};}function removeEntity(_0x276e22,_0x492b19){return function(_0x306c28){if(_0x306c28){return _0x306c28['destroy']()['then'](function(){_0x276e22[_0xfcc5('0x18')](0xcc)[_0xfcc5('0x19')]();});}};}function handleEntityNotFound(_0x3ebbc0,_0x3ca706){return function(_0x1409d9){if(!_0x1409d9){_0x3ebbc0[_0xfcc5('0x17')](0x194);}return _0x1409d9;};}function handleError(_0x409023,_0x5af4f8){_0x5af4f8=_0x5af4f8||0x1f4;return function(_0x161d03){logger['error'](_0x161d03[_0xfcc5('0x25')]);if(_0x161d03['name']){delete _0x161d03[_0xfcc5('0x26')];}_0x409023[_0xfcc5('0x18')](_0x5af4f8)['send'](_0x161d03);};}exports['index']=function(_0x1e01be,_0x1b8495){var _0x27e152={},_0x476578={},_0x376474={'count':0x0,'rows':[]};var _0x3736d2=_[_0xfcc5('0x27')](db[_0xfcc5('0x28')][_0xfcc5('0x29')],function(_0x1f5eae){return{'name':_0x1f5eae['fieldName'],'type':_0x1f5eae['type']['key']};});_0x476578[_0xfcc5('0x2a')]=_[_0xfcc5('0x27')](_0x3736d2,_0xfcc5('0x26'));_0x476578['query']=_[_0xfcc5('0x2b')](_0x1e01be[_0xfcc5('0x2c')]);_0x476578['filters']=_['intersection'](_0x476578[_0xfcc5('0x2a')],_0x476578[_0xfcc5('0x2c')]);_0x27e152[_0xfcc5('0x2d')]=_[_0xfcc5('0x2e')](_0x476578[_0xfcc5('0x2a')],qs[_0xfcc5('0x2f')](_0x1e01be[_0xfcc5('0x2c')]['fields']));_0x27e152['attributes']=_0x27e152['attributes']['length']?_0x27e152[_0xfcc5('0x2d')]:_0x476578[_0xfcc5('0x2a')];if(!_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x30')](_0xfcc5('0x31'))){_0x27e152[_0xfcc5('0x1c')]=qs[_0xfcc5('0x1c')](_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x1c')]);_0x27e152['offset']=qs['offset'](_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x1b')]);}_0x27e152[_0xfcc5('0x32')]=qs[_0xfcc5('0x33')](_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x33')]);_0x27e152['where']=qs['filters'](_[_0xfcc5('0x34')](_0x1e01be[_0xfcc5('0x2c')],_0x476578[_0xfcc5('0x35')]),_0x3736d2);if(_0x1e01be['query'][_0xfcc5('0x36')]){_0x27e152[_0xfcc5('0x37')]=_[_0xfcc5('0x38')](_0x27e152[_0xfcc5('0x37')],{'$or':_[_0xfcc5('0x27')](_0x3736d2,function(_0x5f7d0f){if(_0x5f7d0f[_0xfcc5('0x39')]!==_0xfcc5('0x3a')){var _0x250e6a={};_0x250e6a[_0x5f7d0f['name']]={'$like':'%'+_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x36')]+'%'};return _0x250e6a;}})});}_0x27e152=_['merge']({},_0x27e152,_0x1e01be[_0xfcc5('0x3b')]);var _0x55d118={'where':_0x27e152[_0xfcc5('0x37')]};return db[_0xfcc5('0x28')][_0xfcc5('0x1e')](_0x55d118)[_0xfcc5('0x24')](function(_0x1075ce){_0x376474[_0xfcc5('0x1e')]=_0x1075ce;if(_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x3c')]){_0x27e152[_0xfcc5('0x3d')]=[{'all':!![]}];}return db[_0xfcc5('0x28')][_0xfcc5('0x3e')](_0x27e152);})['then'](function(_0x1fec73){_0x376474['rows']=_0x1fec73;return _0x376474;})[_0xfcc5('0x24')](respondWithFilteredResult(_0x1b8495,_0x27e152))[_0xfcc5('0x3f')](handleError(_0x1b8495,null));};exports[_0xfcc5('0x40')]=function(_0x453bc0,_0x18a6be){var _0x53ce45={'raw':!![],'where':{'id':_0x453bc0[_0xfcc5('0x41')]['id']}},_0x587983={};_0x587983['model']=_[_0xfcc5('0x2b')](db[_0xfcc5('0x28')][_0xfcc5('0x29')]);_0x587983[_0xfcc5('0x2c')]=_['keys'](_0x453bc0[_0xfcc5('0x2c')]);_0x587983[_0xfcc5('0x35')]=_[_0xfcc5('0x2e')](_0x587983[_0xfcc5('0x2a')],_0x587983['query']);_0x53ce45['attributes']=_['intersection'](_0x587983['model'],qs['fields'](_0x453bc0['query'][_0xfcc5('0x2f')]));_0x53ce45[_0xfcc5('0x2d')]=_0x53ce45[_0xfcc5('0x2d')][_0xfcc5('0x42')]?_0x53ce45['attributes']:_0x587983[_0xfcc5('0x2a')];if(_0x453bc0['query'][_0xfcc5('0x3c')]){_0x53ce45[_0xfcc5('0x3d')]=[{'all':!![]}];}_0x53ce45=_[_0xfcc5('0x38')]({},_0x53ce45,_0x453bc0[_0xfcc5('0x3b')]);return db[_0xfcc5('0x28')]['find'](_0x53ce45)[_0xfcc5('0x24')](handleEntityNotFound(_0x18a6be,null))[_0xfcc5('0x24')](respondWithResult(_0x18a6be,null))[_0xfcc5('0x3f')](handleError(_0x18a6be,null));};exports[_0xfcc5('0x43')]=function(_0x775e3f,_0x19897e){return db['FreshsalesField'][_0xfcc5('0x43')](_0x775e3f[_0xfcc5('0x44')],{})[_0xfcc5('0x24')](respondWithResult(_0x19897e,0xc9))[_0xfcc5('0x3f')](handleError(_0x19897e,null));};exports['update']=function(_0x52b487,_0x157a93){if(_0x52b487['body']['id']){delete _0x52b487[_0xfcc5('0x44')]['id'];}return db[_0xfcc5('0x28')][_0xfcc5('0x45')]({'where':{'id':_0x52b487['params']['id']}})[_0xfcc5('0x24')](handleEntityNotFound(_0x157a93,null))[_0xfcc5('0x24')](saveUpdates(_0x52b487[_0xfcc5('0x44')],null))[_0xfcc5('0x24')](respondWithResult(_0x157a93,null))[_0xfcc5('0x3f')](handleError(_0x157a93,null));};exports[_0xfcc5('0x46')]=function(_0x43466a,_0x321d39){return db[_0xfcc5('0x28')]['find']({'where':{'id':_0x43466a[_0xfcc5('0x41')]['id']}})['then'](handleEntityNotFound(_0x321d39,null))[_0xfcc5('0x24')](removeEntity(_0x321d39,null))['catch'](handleError(_0x321d39,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 71dcdbc..9602c20 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.model.js +++ b/server/api/intFreshsalesField/intFreshsalesField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x135b=['../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x135b,0xaf));var _0xb135=function(_0x1c0a25,_0x227201){_0x1c0a25=_0x1c0a25-0x0;var _0x4ddd7e=_0x135b[_0x1c0a25];return _0x4ddd7e;};'use strict';var _=require(_0xb135('0x0'));var util=require(_0xb135('0x1'));var logger=require(_0xb135('0x2'))(_0xb135('0x3'));var moment=require('moment');var BPromise=require(_0xb135('0x4'));var rp=require(_0xb135('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb135('0x6'));var config=require(_0xb135('0x7'));var attributes=require(_0xb135('0x8'));module['exports']=function(_0x51a09c,_0x5b96fe){return _0x51a09c[_0xb135('0x9')](_0xb135('0xa'),attributes,{'tableName':_0xb135('0xb'),'paranoid':![],'indexes':[{'name':_0xb135('0xc'),'fields':['idField',_0xb135('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1472=['request-promise','path','./intFreshsalesField.attributes','exports','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x56352b,_0x25ed46){var _0x5ab7d6=function(_0x203dbf){while(--_0x203dbf){_0x56352b['push'](_0x56352b['shift']());}};_0x5ab7d6(++_0x25ed46);}(_0x1472,0x166));var _0x2147=function(_0x2a829f,_0x1b0c15){_0x2a829f=_0x2a829f-0x0;var _0x5737c3=_0x1472[_0x2a829f];return _0x5737c3;};'use strict';var _=require(_0x2147('0x0'));var util=require(_0x2147('0x1'));var logger=require(_0x2147('0x2'))(_0x2147('0x3'));var moment=require(_0x2147('0x4'));var BPromise=require(_0x2147('0x5'));var rp=require(_0x2147('0x6'));var fs=require('fs');var path=require(_0x2147('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2147('0x8'));module[_0x2147('0x9')]=function(_0x146353,_0x5593f4){return _0x146353['define'](_0x2147('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x2147('0xb'),'fields':[_0x2147('0xc'),_0x2147('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index b07c54e..4055df2 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd51=['FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5db953,_0x191f91){_0x5db953=_0x5db953-0x0;var _0x51d13f=_0xbd51[_0x5db953];return _0x51d13f;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x353cd8,_0x1eef98){var _0x518964=function(_0x1e21cd){while(--_0x1e21cd){_0x353cd8['push'](_0x353cd8['shift']());}};_0x518964(++_0x1eef98);}(_0x5fc3,0xa8));var _0x35fc=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0x5fc3[_0x43fdf8];return _0x1160c6;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3d6aaf1..33508b7 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5e8f91,_0x101a09){var _0x456b93=function(_0x132127){while(--_0x132127){_0x5e8f91['push'](_0x5e8f91['shift']());}};_0x456b93(++_0x101a09);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3fc0d9,_0xb79daf){var _0x3e376a=function(_0x35f5ae){while(--_0x35f5ae){_0x3fc0d9['push'](_0x3fc0d9['shift']());}};_0x3e376a(++_0xb79daf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index fd6dcca..59c18de 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8374=['sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x8374,0x174));var _0x4837=function(_0xf89589,_0x1cf0d5){_0xf89589=_0xf89589-0x0;var _0x10891e=_0x8374[_0xf89589];return _0x10891e;};'use strict';var Sequelize=require(_0x4837('0x0'));module[_0x4837('0x1')]={'name':{'type':Sequelize[_0x4837('0x2')]},'description':{'type':Sequelize[_0x4837('0x2')]},'username':{'type':Sequelize[_0x4837('0x2')],'unique':_0x4837('0x3')},'remoteUri':{'type':Sequelize[_0x4837('0x2')]},'password':{'type':Sequelize[_0x4837('0x2')]},'clientId':{'type':Sequelize[_0x4837('0x2')]},'clientSecret':{'type':Sequelize[_0x4837('0x2')]},'securityToken':{'type':Sequelize[_0x4837('0x2')]},'serverUrl':{'type':Sequelize[_0x4837('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4837('0x4')](_0x4837('0x5'),'newTab'),'defaultValue':_0x4837('0x5')}}; \ No newline at end of file +var _0x803c=['ENUM','newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x803c,0x65));var _0xc803=function(_0x2b06f4,_0x207c99){_0x2b06f4=_0x2b06f4-0x0;var _0x417105=_0x803c[_0x2b06f4];return _0x417105;};'use strict';var Sequelize=require(_0xc803('0x0'));module[_0xc803('0x1')]={'name':{'type':Sequelize[_0xc803('0x2')]},'description':{'type':Sequelize[_0xc803('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc803('0x3')},'remoteUri':{'type':Sequelize[_0xc803('0x2')]},'password':{'type':Sequelize[_0xc803('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc803('0x2')]},'securityToken':{'type':Sequelize[_0xc803('0x2')]},'serverUrl':{'type':Sequelize[_0xc803('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc803('0x4')]('integrationTab',_0xc803('0x5')),'defaultValue':_0xc803('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 04bf289..a7c81fa 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9530=['../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','SalesforceAccount','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','SalesforceConfiguration','rawAttributes','order','pick','addConfiguration','findOne','getSubjects','Descriptions','getDescriptions','channel','Subjects','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','lastIndexOf','login','concat','securityToken','isNil','ticketType','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','textarea','phone','includes','label','value','True','False','false','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x3d3379,_0x4c9bc1){var _0x358633=function(_0x54510c){while(--_0x54510c){_0x3d3379['push'](_0x3d3379['shift']());}};_0x358633(++_0x4c9bc1);}(_0x9530,0x1d5));var _0x0953=function(_0x3b5aa0,_0xee39c6){_0x3b5aa0=_0x3b5aa0-0x0;var _0xd782c7=_0x9530[_0x3b5aa0];return _0xd782c7;};'use strict';var emlformat=require(_0x0953('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0953('0x1'));var jsonpatch=require(_0x0953('0x2'));var rp=require(_0x0953('0x3'));var moment=require('moment');var BPromise=require(_0x0953('0x4'));var Mustache=require(_0x0953('0x5'));var util=require(_0x0953('0x6'));var path=require(_0x0953('0x7'));var sox=require(_0x0953('0x8'));var csv=require(_0x0953('0x9'));var ejs=require(_0x0953('0xa'));var fs=require('fs');var fs_extra=require(_0x0953('0xb'));var _=require(_0x0953('0xc'));var squel=require(_0x0953('0xd'));var crypto=require(_0x0953('0xe'));var jsforce=require(_0x0953('0xf'));var deskjs=require(_0x0953('0x10'));var toCsv=require(_0x0953('0x9'));var querystring=require(_0x0953('0x11'));var Papa=require(_0x0953('0x12'));var Redis=require(_0x0953('0x13'));var authService=require(_0x0953('0x14'));var qs=require(_0x0953('0x15'));var as=require(_0x0953('0x16'));var hardwareService=require(_0x0953('0x17'));var logger=require(_0x0953('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x0953('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0953('0x1a'))['db'];var integrations=require(_0x0953('0x1b'));function respondWithStatusCode(_0x18e417,_0x2ff5f6){_0x2ff5f6=_0x2ff5f6||0xcc;return function(_0x5b7b35){if(_0x5b7b35){return _0x18e417[_0x0953('0x1c')](_0x2ff5f6);}return _0x18e417[_0x0953('0x1d')](_0x2ff5f6)[_0x0953('0x1e')]();};}function respondWithResult(_0x147680,_0x276673){_0x276673=_0x276673||0xc8;return function(_0xf4da35){if(_0xf4da35){return _0x147680['status'](_0x276673)[_0x0953('0x1f')](_0xf4da35);}};}function respondWithFilteredResult(_0x5e9309,_0x4aaced){return function(_0x42af19){if(_0x42af19){var _0x46ada4=typeof _0x4aaced[_0x0953('0x20')]===_0x0953('0x21')&&typeof _0x4aaced[_0x0953('0x22')]===_0x0953('0x21');var _0x9de3e8=_0x42af19[_0x0953('0x23')];var _0x20d9d9=_0x46ada4?0x0:_0x4aaced[_0x0953('0x20')];var _0x137794=_0x46ada4?_0x42af19[_0x0953('0x23')]:_0x4aaced[_0x0953('0x20')]+_0x4aaced[_0x0953('0x22')];var _0x615861;if(_0x137794>=_0x9de3e8){_0x137794=_0x9de3e8;_0x615861=0xc8;}else{_0x615861=0xce;}_0x5e9309[_0x0953('0x1d')](_0x615861);return _0x5e9309[_0x0953('0x24')](_0x0953('0x25'),_0x20d9d9+'-'+_0x137794+'/'+_0x9de3e8)['json'](_0x42af19);}return null;};}function patchUpdates(_0x1764da){return function(_0x510ab6){try{jsonpatch[_0x0953('0x26')](_0x510ab6,_0x1764da,!![]);}catch(_0x5c1775){return BPromise['reject'](_0x5c1775);}return _0x510ab6['save']();};}function saveUpdates(_0x135136,_0x322c42){return function(_0x2aa54f){if(_0x2aa54f){return _0x2aa54f[_0x0953('0x27')](_0x135136)[_0x0953('0x28')](function(_0x3e59c2){return _0x3e59c2;});}return null;};}function removeEntity(_0x78b2be,_0x354a8b){return function(_0x50dd69){if(_0x50dd69){return _0x50dd69[_0x0953('0x29')]()[_0x0953('0x28')](function(){_0x78b2be[_0x0953('0x1d')](0xcc)[_0x0953('0x1e')]();});}};}function handleEntityNotFound(_0x53ef7d,_0x27726f){return function(_0x5295e7){if(!_0x5295e7){_0x53ef7d['sendStatus'](0x194);}return _0x5295e7;};}function handleError(_0x330fcc,_0x310301){_0x310301=_0x310301||0x1f4;return function(_0x1c0256){logger[_0x0953('0x2a')](_0x1c0256[_0x0953('0x2b')]);if(_0x1c0256['name']){delete _0x1c0256[_0x0953('0x2c')];}_0x330fcc[_0x0953('0x1d')](_0x310301)['send'](_0x1c0256);};}exports['index']=function(_0x3e09b6,_0x1dd448){var _0x5a352c={},_0x30c1ca={},_0x4b6737={'count':0x0,'rows':[]};var _0x2f5138=_['map'](db[_0x0953('0x2d')]['rawAttributes'],function(_0x25a4ff){return{'name':_0x25a4ff[_0x0953('0x2e')],'type':_0x25a4ff[_0x0953('0x2f')]['key']};});_0x30c1ca[_0x0953('0x30')]=_[_0x0953('0x31')](_0x2f5138,_0x0953('0x2c'));_0x30c1ca[_0x0953('0x32')]=_[_0x0953('0x33')](_0x3e09b6[_0x0953('0x32')]);_0x30c1ca['filters']=_[_0x0953('0x34')](_0x30c1ca['model'],_0x30c1ca['query']);_0x5a352c['attributes']=_[_0x0953('0x34')](_0x30c1ca[_0x0953('0x30')],qs[_0x0953('0x35')](_0x3e09b6[_0x0953('0x32')][_0x0953('0x35')]));_0x5a352c[_0x0953('0x36')]=_0x5a352c[_0x0953('0x36')][_0x0953('0x37')]?_0x5a352c[_0x0953('0x36')]:_0x30c1ca['model'];if(!_0x3e09b6[_0x0953('0x32')][_0x0953('0x38')](_0x0953('0x39'))){_0x5a352c[_0x0953('0x22')]=qs['limit'](_0x3e09b6[_0x0953('0x32')]['limit']);_0x5a352c[_0x0953('0x20')]=qs[_0x0953('0x20')](_0x3e09b6['query'][_0x0953('0x20')]);}_0x5a352c['order']=qs[_0x0953('0x3a')](_0x3e09b6[_0x0953('0x32')][_0x0953('0x3a')]);_0x5a352c[_0x0953('0x3b')]=qs[_0x0953('0x3c')](_['pick'](_0x3e09b6['query'],_0x30c1ca[_0x0953('0x3c')]),_0x2f5138);if(_0x3e09b6['query'][_0x0953('0x3d')]){_0x5a352c['where']=_[_0x0953('0x3e')](_0x5a352c['where'],{'$or':_[_0x0953('0x31')](_0x2f5138,function(_0x149906){if(_0x149906[_0x0953('0x2f')]!==_0x0953('0x3f')){var _0x4eabbf={};_0x4eabbf[_0x149906[_0x0953('0x2c')]]={'$like':'%'+_0x3e09b6[_0x0953('0x32')][_0x0953('0x3d')]+'%'};return _0x4eabbf;}})});}_0x5a352c=_[_0x0953('0x3e')]({},_0x5a352c,_0x3e09b6[_0x0953('0x40')]);var _0x88bd12={'where':_0x5a352c[_0x0953('0x3b')]};return db['SalesforceAccount'][_0x0953('0x23')](_0x88bd12)[_0x0953('0x28')](function(_0x222766){_0x4b6737[_0x0953('0x23')]=_0x222766;if(_0x3e09b6[_0x0953('0x32')][_0x0953('0x41')]){_0x5a352c[_0x0953('0x42')]=[{'all':!![]}];}return db[_0x0953('0x2d')][_0x0953('0x43')](_0x5a352c);})[_0x0953('0x28')](function(_0xd42b){_0x4b6737[_0x0953('0x44')]=_0xd42b;return _0x4b6737;})['then'](respondWithFilteredResult(_0x1dd448,_0x5a352c))[_0x0953('0x45')](handleError(_0x1dd448,null));};exports[_0x0953('0x46')]=function(_0x52d200,_0x2e2570){var _0xb8c82a={'raw':![],'where':{'id':_0x52d200[_0x0953('0x47')]['id']}},_0x1f4363={};_0x1f4363['model']=_[_0x0953('0x33')](db['SalesforceAccount']['rawAttributes']);_0x1f4363['query']=_[_0x0953('0x33')](_0x52d200[_0x0953('0x32')]);_0x1f4363[_0x0953('0x3c')]=_['intersection'](_0x1f4363[_0x0953('0x30')],_0x1f4363[_0x0953('0x32')]);_0xb8c82a[_0x0953('0x36')]=_[_0x0953('0x34')](_0x1f4363[_0x0953('0x30')],qs[_0x0953('0x35')](_0x52d200[_0x0953('0x32')][_0x0953('0x35')]));_0xb8c82a[_0x0953('0x36')]=_0xb8c82a[_0x0953('0x36')]['length']?_0xb8c82a[_0x0953('0x36')]:_0x1f4363[_0x0953('0x30')];if(_0x52d200[_0x0953('0x32')][_0x0953('0x41')]){_0xb8c82a[_0x0953('0x42')]=[{'all':!![]}];}_0xb8c82a=_[_0x0953('0x3e')]({},_0xb8c82a,_0x52d200[_0x0953('0x40')]);return db[_0x0953('0x2d')][_0x0953('0x48')](_0xb8c82a)[_0x0953('0x28')](handleEntityNotFound(_0x2e2570,null))['then'](respondWithResult(_0x2e2570,null))[_0x0953('0x45')](handleError(_0x2e2570,null));};exports[_0x0953('0x49')]=function(_0x3563b3,_0x462252){return db[_0x0953('0x2d')][_0x0953('0x49')](_0x3563b3[_0x0953('0x4a')],{})[_0x0953('0x28')](respondWithResult(_0x462252,0xc9))['catch'](handleError(_0x462252,null));};exports[_0x0953('0x27')]=function(_0x585cd0,_0x4d3ea5){if(_0x585cd0[_0x0953('0x4a')]['id']){delete _0x585cd0[_0x0953('0x4a')]['id'];}return db['SalesforceAccount'][_0x0953('0x48')]({'where':{'id':_0x585cd0['params']['id']}})[_0x0953('0x28')](handleEntityNotFound(_0x4d3ea5,null))['then'](saveUpdates(_0x585cd0['body'],null))[_0x0953('0x28')](respondWithResult(_0x4d3ea5,null))[_0x0953('0x45')](handleError(_0x4d3ea5,null));};exports[_0x0953('0x29')]=function(_0x2b6121,_0x2a7818){return db['SalesforceAccount']['find']({'where':{'id':_0x2b6121['params']['id']}})['then'](handleEntityNotFound(_0x2a7818,null))[_0x0953('0x28')](removeEntity(_0x2a7818,null))['catch'](handleError(_0x2a7818,null));};exports[_0x0953('0x4b')]=function(_0x49c8,_0x584476,_0x447428){var _0x2b02fe={};var _0x4869f0={};var _0x11ffa9;var _0x3d874e;return db[_0x0953('0x2d')]['findOne']({'where':{'id':_0x49c8[_0x0953('0x47')]['id']}})[_0x0953('0x28')](handleEntityNotFound(_0x584476,null))[_0x0953('0x28')](function(_0xb88de2){if(_0xb88de2){_0x11ffa9=_0xb88de2;_0x4869f0['model']=_[_0x0953('0x33')](db[_0x0953('0x4c')][_0x0953('0x4d')]);_0x4869f0[_0x0953('0x32')]=_['keys'](_0x49c8[_0x0953('0x32')]);_0x4869f0[_0x0953('0x3c')]=_[_0x0953('0x34')](_0x4869f0[_0x0953('0x30')],_0x4869f0[_0x0953('0x32')]);_0x2b02fe[_0x0953('0x36')]=_[_0x0953('0x34')](_0x4869f0[_0x0953('0x30')],qs[_0x0953('0x35')](_0x49c8[_0x0953('0x32')][_0x0953('0x35')]));_0x2b02fe[_0x0953('0x36')]=_0x2b02fe[_0x0953('0x36')][_0x0953('0x37')]?_0x2b02fe[_0x0953('0x36')]:_0x4869f0[_0x0953('0x30')];_0x2b02fe[_0x0953('0x4e')]=qs['sort'](_0x49c8[_0x0953('0x32')][_0x0953('0x3a')]);_0x2b02fe[_0x0953('0x3b')]=qs[_0x0953('0x3c')](_[_0x0953('0x4f')](_0x49c8['query'],_0x4869f0[_0x0953('0x3c')]));if(_0x49c8[_0x0953('0x32')][_0x0953('0x3d')]){_0x2b02fe['where']=_['merge'](_0x2b02fe[_0x0953('0x3b')],{'$or':_[_0x0953('0x31')](_0x2b02fe['attributes'],function(_0x5bfef8){var _0x586a29={};_0x586a29[_0x5bfef8]={'$like':'%'+_0x49c8['query']['filter']+'%'};return _0x586a29;})});}_0x2b02fe=_[_0x0953('0x3e')]({},_0x2b02fe,_0x49c8['options']);return _0x11ffa9[_0x0953('0x4b')](_0x2b02fe);}})[_0x0953('0x28')](function(_0x4e1951){if(_0x4e1951){_0x3d874e=_0x4e1951['length'];if(!_0x49c8['query'][_0x0953('0x38')]('nolimit')){_0x2b02fe[_0x0953('0x22')]=qs['limit'](_0x49c8[_0x0953('0x32')][_0x0953('0x22')]);_0x2b02fe[_0x0953('0x20')]=qs[_0x0953('0x20')](_0x49c8[_0x0953('0x32')]['offset']);}return _0x11ffa9[_0x0953('0x4b')](_0x2b02fe);}})[_0x0953('0x28')](function(_0x302a10){if(_0x302a10){return _0x302a10?{'count':_0x3d874e,'rows':_0x302a10}:null;}})['then'](respondWithResult(_0x584476,null))[_0x0953('0x45')](handleError(_0x584476,null));};exports[_0x0953('0x50')]=function(_0x5d6b91,_0x4fdae5,_0x428eb0){if(_0x5d6b91[_0x0953('0x4a')]['id']){delete _0x5d6b91[_0x0953('0x4a')]['id'];}return db['SalesforceAccount'][_0x0953('0x51')]({'where':{'id':_0x5d6b91[_0x0953('0x47')]['id']}})['then'](handleEntityNotFound(_0x4fdae5,null))[_0x0953('0x28')](function(_0x5190b4){if(_0x5190b4){_0x5d6b91[_0x0953('0x4a')]['AccountId']=_0x5190b4['id'];_0x5d6b91['body']['Subjects']=integrations[_0x0953('0x52')](_0x5d6b91[_0x0953('0x4a')]['channel'],_0x5d6b91['body'][_0x0953('0x2f')]);_0x5d6b91['body'][_0x0953('0x53')]=integrations[_0x0953('0x54')](_0x5d6b91['body'][_0x0953('0x55')],_0x5d6b91['body'][_0x0953('0x2f')]);return db[_0x0953('0x4c')][_0x0953('0x49')](_0x5d6b91['body'],{'include':[{'model':db['SalesforceField'],'as':_0x0953('0x56')},{'model':db[_0x0953('0x57')],'as':_0x0953('0x53')}]});}return null;})[_0x0953('0x28')](respondWithResult(_0x4fdae5,null))['catch'](handleError(_0x4fdae5,null));};exports[_0x0953('0x58')]=function(_0x49310c,_0x2b7354,_0xdcbe0){var _0x3f48d3;var _0x43bb5f='';var _0x1a81e1=_0x0953('0x59');return db[_0x0953('0x2d')][_0x0953('0x51')]({'where':{'id':_0x49310c[_0x0953('0x47')]['id']},'attributes':['id',_0x0953('0x5a'),_0x0953('0x5b'),_0x0953('0x5c'),_0x0953('0x5d'),_0x0953('0x5e'),'securityToken']})[_0x0953('0x28')](handleEntityNotFound(_0x2b7354,null))[_0x0953('0x28')](function(_0x3de21d){if(_0x3de21d){_0x43bb5f=_0x3de21d[_0x0953('0x5a')];var _0x397f88=_0x43bb5f[_0x0953('0x5f')](-0x1);if(_0x397f88==='/'){_0x43bb5f=_0x43bb5f['substring'](0x0,_0x43bb5f[_0x0953('0x60')](_0x397f88));}_0x3f48d3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x43bb5f,'clientId':_0x3de21d[_0x0953('0x5b')],'clientSecret':_0x3de21d[_0x0953('0x5c')]}});return _0x3f48d3[_0x0953('0x61')](_0x3de21d[_0x0953('0x5d')],_0x3de21d[_0x0953('0x5e')][_0x0953('0x62')](_0x3de21d[_0x0953('0x63')]));}})['then'](function(_0x51ce2c){if(_0x51ce2c){if(!_[_0x0953('0x64')](_0x49310c[_0x0953('0x32')][_0x0953('0x65')])){_0x1a81e1=_0x49310c[_0x0953('0x32')][_0x0953('0x65')];}return _0x3f48d3['sobject'](_0x1a81e1)[_0x0953('0x66')]();}})[_0x0953('0x28')](function(_0x312484){var _0x5f35db=[_0x0953('0x67'),'ActivityDate',_0x0953('0x68'),_0x0953('0x69'),_0x0953('0x6a'),_0x0953('0x6b')];var _0x4909d0=['string',_0x0953('0x6c'),_0x0953('0x6d'),_0x0953('0x6e'),'email',_0x0953('0x6f'),_0x0953('0x70')];if(_0x312484){_['remove'](_0x312484['fields'],function(_0x5d409a){return _0x5f35db[_0x0953('0x71')](_0x5d409a['name'])||!_0x4909d0['includes'](_0x5d409a[_0x0953('0x2f')]);});return{'count':_0x312484['fields'][_0x0953('0x37')],'rows':_[_0x0953('0x31')](_0x312484[_0x0953('0x35')],function(_0x35ad32){return{'id':_0x35ad32[_0x0953('0x2c')],'name':_0x35ad32[_0x0953('0x72')],'custom':_0x35ad32['custom'],'options':_0x35ad32['picklistValues'][_0x0953('0x37')]>0x0?_[_0x0953('0x31')](_0x35ad32['picklistValues'],function(_0x132b4a){return{'name':_0x132b4a['label'],'value':_0x132b4a[_0x0953('0x73')]};}):_0x35ad32[_0x0953('0x2f')]==_0x0953('0x6e')?[{'name':_0x0953('0x74'),'value':'true'},{'name':_0x0953('0x75'),'value':_0x0953('0x76')}]:[]};})};}})[_0x0953('0x28')](respondWithResult(_0x2b7354,null))[_0x0953('0x45')](function(_0x21e399){var _0x8a3b28=_0x49310c['query'][_0x0953('0x77')]?0x1f4:_0x21e399['statusCode']||0x1f4;logger['error'](_0x0953('0x78'),_0x0953('0x58'),_0x8a3b28,JSON['stringify'](_0x21e399));delete _0x21e399['name'];if(_0x8a3b28===0x191){_0x8a3b28=0x190;}_0x2b7354[_0x0953('0x1d')](_0x8a3b28)[_0x0953('0x79')](_0x49310c[_0x0953('0x32')][_0x0953('0x77')]?{'message':_0x0953('0x7a'),'statusCode':_0x21e399[_0x0953('0x7b')]}:_0x21e399);});}; \ No newline at end of file +var _0x92eb=['addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','SalesforceField','remoteUri','clientSecret','username','password','slice','lastIndexOf','Connection','clientId','login','concat','securityToken','isNil','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','boolean','email','textarea','remove','includes','custom','picklistValues','value','True','true','False','false','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','json','offset','count','limit','status','reject','save','update','destroy','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','catch','params','intersection','create','body','find','getConfigurations','SalesforceConfiguration'];(function(_0x398c66,_0x3d75d0){var _0x254322=function(_0x64a3e5){while(--_0x64a3e5){_0x398c66['push'](_0x398c66['shift']());}};_0x254322(++_0x3d75d0);}(_0x92eb,0x196));var _0xb92e=function(_0x263ef3,_0x5dde75){_0x263ef3=_0x263ef3-0x0;var _0x18e32a=_0x92eb[_0x263ef3];return _0x18e32a;};'use strict';var emlformat=require(_0xb92e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb92e('0x1'));var jsonpatch=require(_0xb92e('0x2'));var rp=require(_0xb92e('0x3'));var moment=require(_0xb92e('0x4'));var BPromise=require(_0xb92e('0x5'));var Mustache=require(_0xb92e('0x6'));var util=require(_0xb92e('0x7'));var path=require(_0xb92e('0x8'));var sox=require(_0xb92e('0x9'));var csv=require(_0xb92e('0xa'));var ejs=require(_0xb92e('0xb'));var fs=require('fs');var fs_extra=require(_0xb92e('0xc'));var _=require('lodash');var squel=require(_0xb92e('0xd'));var crypto=require(_0xb92e('0xe'));var jsforce=require(_0xb92e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb92e('0xa'));var querystring=require(_0xb92e('0x10'));var Papa=require(_0xb92e('0x11'));var Redis=require(_0xb92e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb92e('0x13'));var as=require(_0xb92e('0x14'));var hardwareService=require(_0xb92e('0x15'));var logger=require(_0xb92e('0x16'))(_0xb92e('0x17'));var utils=require('../../config/utils');var config=require(_0xb92e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb92e('0x19'))['db'];var integrations=require(_0xb92e('0x1a'));function respondWithStatusCode(_0x48ebf1,_0x373a11){_0x373a11=_0x373a11||0xcc;return function(_0x1b889f){if(_0x1b889f){return _0x48ebf1['sendStatus'](_0x373a11);}return _0x48ebf1['status'](_0x373a11)['end']();};}function respondWithResult(_0x21db47,_0x1e93ed){_0x1e93ed=_0x1e93ed||0xc8;return function(_0x104930){if(_0x104930){return _0x21db47['status'](_0x1e93ed)[_0xb92e('0x1b')](_0x104930);}};}function respondWithFilteredResult(_0x3bb797,_0x42aa6a){return function(_0x3954d9){if(_0x3954d9){var _0x3c467e=typeof _0x42aa6a[_0xb92e('0x1c')]==='undefined'&&typeof _0x42aa6a['limit']==='undefined';var _0x44ffd9=_0x3954d9[_0xb92e('0x1d')];var _0x244ed1=_0x3c467e?0x0:_0x42aa6a[_0xb92e('0x1c')];var _0x36ea2d=_0x3c467e?_0x3954d9[_0xb92e('0x1d')]:_0x42aa6a[_0xb92e('0x1c')]+_0x42aa6a[_0xb92e('0x1e')];var _0x154bdc;if(_0x36ea2d>=_0x44ffd9){_0x36ea2d=_0x44ffd9;_0x154bdc=0xc8;}else{_0x154bdc=0xce;}_0x3bb797[_0xb92e('0x1f')](_0x154bdc);return _0x3bb797['set']('Content-Range',_0x244ed1+'-'+_0x36ea2d+'/'+_0x44ffd9)[_0xb92e('0x1b')](_0x3954d9);}return null;};}function patchUpdates(_0x4fc33b){return function(_0x13b287){try{jsonpatch['apply'](_0x13b287,_0x4fc33b,!![]);}catch(_0x11a9e2){return BPromise[_0xb92e('0x20')](_0x11a9e2);}return _0x13b287[_0xb92e('0x21')]();};}function saveUpdates(_0x37392d,_0x4e7622){return function(_0x4ae112){if(_0x4ae112){return _0x4ae112[_0xb92e('0x22')](_0x37392d)['then'](function(_0x1a21ab){return _0x1a21ab;});}return null;};}function removeEntity(_0x222214,_0x275d8a){return function(_0x3e0361){if(_0x3e0361){return _0x3e0361[_0xb92e('0x23')]()['then'](function(){_0x222214[_0xb92e('0x1f')](0xcc)[_0xb92e('0x24')]();});}};}function handleEntityNotFound(_0x23eb6a,_0xc4a6f0){return function(_0x36b30f){if(!_0x36b30f){_0x23eb6a['sendStatus'](0x194);}return _0x36b30f;};}function handleError(_0x55b82a,_0x467740){_0x467740=_0x467740||0x1f4;return function(_0x31c95d){logger['error'](_0x31c95d[_0xb92e('0x25')]);if(_0x31c95d[_0xb92e('0x26')]){delete _0x31c95d[_0xb92e('0x26')];}_0x55b82a['status'](_0x467740)[_0xb92e('0x27')](_0x31c95d);};}exports[_0xb92e('0x28')]=function(_0x5e4d64,_0x14187d){var _0x44b484={},_0xc96dc={},_0x238ed9={'count':0x0,'rows':[]};var _0x4a667f=_[_0xb92e('0x29')](db[_0xb92e('0x2a')][_0xb92e('0x2b')],function(_0x2d237d){return{'name':_0x2d237d[_0xb92e('0x2c')],'type':_0x2d237d[_0xb92e('0x2d')][_0xb92e('0x2e')]};});_0xc96dc['model']=_[_0xb92e('0x29')](_0x4a667f,_0xb92e('0x26'));_0xc96dc[_0xb92e('0x2f')]=_[_0xb92e('0x30')](_0x5e4d64[_0xb92e('0x2f')]);_0xc96dc[_0xb92e('0x31')]=_['intersection'](_0xc96dc[_0xb92e('0x32')],_0xc96dc['query']);_0x44b484[_0xb92e('0x33')]=_['intersection'](_0xc96dc[_0xb92e('0x32')],qs[_0xb92e('0x34')](_0x5e4d64[_0xb92e('0x2f')][_0xb92e('0x34')]));_0x44b484['attributes']=_0x44b484[_0xb92e('0x33')][_0xb92e('0x35')]?_0x44b484[_0xb92e('0x33')]:_0xc96dc['model'];if(!_0x5e4d64['query'][_0xb92e('0x36')](_0xb92e('0x37'))){_0x44b484[_0xb92e('0x1e')]=qs[_0xb92e('0x1e')](_0x5e4d64['query']['limit']);_0x44b484[_0xb92e('0x1c')]=qs[_0xb92e('0x1c')](_0x5e4d64[_0xb92e('0x2f')]['offset']);}_0x44b484[_0xb92e('0x38')]=qs['sort'](_0x5e4d64[_0xb92e('0x2f')][_0xb92e('0x39')]);_0x44b484[_0xb92e('0x3a')]=qs[_0xb92e('0x31')](_['pick'](_0x5e4d64[_0xb92e('0x2f')],_0xc96dc[_0xb92e('0x31')]),_0x4a667f);if(_0x5e4d64[_0xb92e('0x2f')][_0xb92e('0x3b')]){_0x44b484[_0xb92e('0x3a')]=_[_0xb92e('0x3c')](_0x44b484[_0xb92e('0x3a')],{'$or':_['map'](_0x4a667f,function(_0x24d04b){if(_0x24d04b[_0xb92e('0x2d')]!==_0xb92e('0x3d')){var _0x26cbdd={};_0x26cbdd[_0x24d04b[_0xb92e('0x26')]]={'$like':'%'+_0x5e4d64[_0xb92e('0x2f')][_0xb92e('0x3b')]+'%'};return _0x26cbdd;}})});}_0x44b484=_[_0xb92e('0x3c')]({},_0x44b484,_0x5e4d64[_0xb92e('0x3e')]);var _0x37f8bf={'where':_0x44b484[_0xb92e('0x3a')]};return db[_0xb92e('0x2a')][_0xb92e('0x1d')](_0x37f8bf)[_0xb92e('0x3f')](function(_0x10c856){_0x238ed9[_0xb92e('0x1d')]=_0x10c856;if(_0x5e4d64['query'][_0xb92e('0x40')]){_0x44b484[_0xb92e('0x41')]=[{'all':!![]}];}return db[_0xb92e('0x2a')]['findAll'](_0x44b484);})[_0xb92e('0x3f')](function(_0x3f7f3d){_0x238ed9['rows']=_0x3f7f3d;return _0x238ed9;})['then'](respondWithFilteredResult(_0x14187d,_0x44b484))[_0xb92e('0x42')](handleError(_0x14187d,null));};exports['show']=function(_0x53203c,_0x17e73a){var _0x4c1cfa={'raw':![],'where':{'id':_0x53203c[_0xb92e('0x43')]['id']}},_0x163945={};_0x163945[_0xb92e('0x32')]=_[_0xb92e('0x30')](db[_0xb92e('0x2a')][_0xb92e('0x2b')]);_0x163945['query']=_[_0xb92e('0x30')](_0x53203c[_0xb92e('0x2f')]);_0x163945['filters']=_[_0xb92e('0x44')](_0x163945['model'],_0x163945[_0xb92e('0x2f')]);_0x4c1cfa['attributes']=_[_0xb92e('0x44')](_0x163945['model'],qs[_0xb92e('0x34')](_0x53203c[_0xb92e('0x2f')][_0xb92e('0x34')]));_0x4c1cfa[_0xb92e('0x33')]=_0x4c1cfa[_0xb92e('0x33')][_0xb92e('0x35')]?_0x4c1cfa['attributes']:_0x163945[_0xb92e('0x32')];if(_0x53203c[_0xb92e('0x2f')][_0xb92e('0x40')]){_0x4c1cfa[_0xb92e('0x41')]=[{'all':!![]}];}_0x4c1cfa=_[_0xb92e('0x3c')]({},_0x4c1cfa,_0x53203c[_0xb92e('0x3e')]);return db[_0xb92e('0x2a')]['find'](_0x4c1cfa)[_0xb92e('0x3f')](handleEntityNotFound(_0x17e73a,null))['then'](respondWithResult(_0x17e73a,null))[_0xb92e('0x42')](handleError(_0x17e73a,null));};exports[_0xb92e('0x45')]=function(_0x3c58d7,_0x3c894f){return db['SalesforceAccount']['create'](_0x3c58d7['body'],{})[_0xb92e('0x3f')](respondWithResult(_0x3c894f,0xc9))[_0xb92e('0x42')](handleError(_0x3c894f,null));};exports[_0xb92e('0x22')]=function(_0x4aad08,_0x5208bb){if(_0x4aad08[_0xb92e('0x46')]['id']){delete _0x4aad08[_0xb92e('0x46')]['id'];}return db[_0xb92e('0x2a')][_0xb92e('0x47')]({'where':{'id':_0x4aad08[_0xb92e('0x43')]['id']}})[_0xb92e('0x3f')](handleEntityNotFound(_0x5208bb,null))[_0xb92e('0x3f')](saveUpdates(_0x4aad08['body'],null))[_0xb92e('0x3f')](respondWithResult(_0x5208bb,null))[_0xb92e('0x42')](handleError(_0x5208bb,null));};exports['destroy']=function(_0x1baea8,_0x1fc278){return db[_0xb92e('0x2a')][_0xb92e('0x47')]({'where':{'id':_0x1baea8[_0xb92e('0x43')]['id']}})[_0xb92e('0x3f')](handleEntityNotFound(_0x1fc278,null))[_0xb92e('0x3f')](removeEntity(_0x1fc278,null))['catch'](handleError(_0x1fc278,null));};exports[_0xb92e('0x48')]=function(_0xe8f9aa,_0x458081,_0x56438f){var _0x32f124={};var _0x35f4b6={};var _0x46d5c4;var _0x52c84d;return db[_0xb92e('0x2a')]['findOne']({'where':{'id':_0xe8f9aa[_0xb92e('0x43')]['id']}})[_0xb92e('0x3f')](handleEntityNotFound(_0x458081,null))['then'](function(_0x4d0645){if(_0x4d0645){_0x46d5c4=_0x4d0645;_0x35f4b6[_0xb92e('0x32')]=_['keys'](db[_0xb92e('0x49')][_0xb92e('0x2b')]);_0x35f4b6['query']=_['keys'](_0xe8f9aa[_0xb92e('0x2f')]);_0x35f4b6['filters']=_[_0xb92e('0x44')](_0x35f4b6['model'],_0x35f4b6[_0xb92e('0x2f')]);_0x32f124[_0xb92e('0x33')]=_[_0xb92e('0x44')](_0x35f4b6[_0xb92e('0x32')],qs['fields'](_0xe8f9aa[_0xb92e('0x2f')][_0xb92e('0x34')]));_0x32f124[_0xb92e('0x33')]=_0x32f124[_0xb92e('0x33')][_0xb92e('0x35')]?_0x32f124['attributes']:_0x35f4b6[_0xb92e('0x32')];_0x32f124['order']=qs[_0xb92e('0x39')](_0xe8f9aa['query']['sort']);_0x32f124[_0xb92e('0x3a')]=qs[_0xb92e('0x31')](_['pick'](_0xe8f9aa[_0xb92e('0x2f')],_0x35f4b6[_0xb92e('0x31')]));if(_0xe8f9aa[_0xb92e('0x2f')][_0xb92e('0x3b')]){_0x32f124[_0xb92e('0x3a')]=_[_0xb92e('0x3c')](_0x32f124['where'],{'$or':_['map'](_0x32f124[_0xb92e('0x33')],function(_0x4e7590){var _0xfced4f={};_0xfced4f[_0x4e7590]={'$like':'%'+_0xe8f9aa[_0xb92e('0x2f')][_0xb92e('0x3b')]+'%'};return _0xfced4f;})});}_0x32f124=_[_0xb92e('0x3c')]({},_0x32f124,_0xe8f9aa['options']);return _0x46d5c4[_0xb92e('0x48')](_0x32f124);}})[_0xb92e('0x3f')](function(_0x3bf6ce){if(_0x3bf6ce){_0x52c84d=_0x3bf6ce['length'];if(!_0xe8f9aa[_0xb92e('0x2f')][_0xb92e('0x36')]('nolimit')){_0x32f124[_0xb92e('0x1e')]=qs[_0xb92e('0x1e')](_0xe8f9aa[_0xb92e('0x2f')]['limit']);_0x32f124[_0xb92e('0x1c')]=qs[_0xb92e('0x1c')](_0xe8f9aa[_0xb92e('0x2f')][_0xb92e('0x1c')]);}return _0x46d5c4[_0xb92e('0x48')](_0x32f124);}})['then'](function(_0x9e7adc){if(_0x9e7adc){return _0x9e7adc?{'count':_0x52c84d,'rows':_0x9e7adc}:null;}})[_0xb92e('0x3f')](respondWithResult(_0x458081,null))['catch'](handleError(_0x458081,null));};exports[_0xb92e('0x4a')]=function(_0x495dad,_0x2f9c97,_0x4bdd3e){if(_0x495dad[_0xb92e('0x46')]['id']){delete _0x495dad[_0xb92e('0x46')]['id'];}return db[_0xb92e('0x2a')][_0xb92e('0x4b')]({'where':{'id':_0x495dad[_0xb92e('0x43')]['id']}})[_0xb92e('0x3f')](handleEntityNotFound(_0x2f9c97,null))['then'](function(_0x4763b2){if(_0x4763b2){_0x495dad['body'][_0xb92e('0x4c')]=_0x4763b2['id'];_0x495dad[_0xb92e('0x46')][_0xb92e('0x4d')]=integrations[_0xb92e('0x4e')](_0x495dad['body']['channel'],_0x495dad[_0xb92e('0x46')][_0xb92e('0x2d')]);_0x495dad['body'][_0xb92e('0x4f')]=integrations[_0xb92e('0x50')](_0x495dad[_0xb92e('0x46')]['channel'],_0x495dad[_0xb92e('0x46')][_0xb92e('0x2d')]);return db['SalesforceConfiguration'][_0xb92e('0x45')](_0x495dad[_0xb92e('0x46')],{'include':[{'model':db[_0xb92e('0x51')],'as':_0xb92e('0x4d')},{'model':db[_0xb92e('0x51')],'as':_0xb92e('0x4f')}]});}return null;})[_0xb92e('0x3f')](respondWithResult(_0x2f9c97,null))[_0xb92e('0x42')](handleError(_0x2f9c97,null));};exports['getFields']=function(_0xe3271b,_0x13475d,_0x2fe1a3){var _0x354814;var _0x1bd13e='';var _0x599973='Task';return db['SalesforceAccount'][_0xb92e('0x4b')]({'where':{'id':_0xe3271b[_0xb92e('0x43')]['id']},'attributes':['id',_0xb92e('0x52'),'clientId',_0xb92e('0x53'),_0xb92e('0x54'),_0xb92e('0x55'),'securityToken']})[_0xb92e('0x3f')](handleEntityNotFound(_0x13475d,null))[_0xb92e('0x3f')](function(_0x4338ff){if(_0x4338ff){_0x1bd13e=_0x4338ff[_0xb92e('0x52')];var _0x3ff28b=_0x1bd13e[_0xb92e('0x56')](-0x1);if(_0x3ff28b==='/'){_0x1bd13e=_0x1bd13e['substring'](0x0,_0x1bd13e[_0xb92e('0x57')](_0x3ff28b));}_0x354814=new jsforce[(_0xb92e('0x58'))]({'oauth2':{'loginUrl':_0x1bd13e,'clientId':_0x4338ff[_0xb92e('0x59')],'clientSecret':_0x4338ff[_0xb92e('0x53')]}});return _0x354814[_0xb92e('0x5a')](_0x4338ff[_0xb92e('0x54')],_0x4338ff[_0xb92e('0x55')][_0xb92e('0x5b')](_0x4338ff[_0xb92e('0x5c')]));}})[_0xb92e('0x3f')](function(_0x44388b){if(_0x44388b){if(!_[_0xb92e('0x5d')](_0xe3271b['query'][_0xb92e('0x5e')])){_0x599973=_0xe3271b['query']['ticketType'];}return _0x354814[_0xb92e('0x5f')](_0x599973)['describe']();}})[_0xb92e('0x3f')](function(_0xc3f38b){var _0x38dd79=['OwnerId',_0xb92e('0x60'),_0xb92e('0x61'),_0xb92e('0x62'),_0xb92e('0x63'),'Description'];var _0x27db32=[_0xb92e('0x64'),_0xb92e('0x65'),'picklist',_0xb92e('0x66'),_0xb92e('0x67'),_0xb92e('0x68'),'phone'];if(_0xc3f38b){_[_0xb92e('0x69')](_0xc3f38b[_0xb92e('0x34')],function(_0x1add60){return _0x38dd79[_0xb92e('0x6a')](_0x1add60['name'])||!_0x27db32[_0xb92e('0x6a')](_0x1add60[_0xb92e('0x2d')]);});return{'count':_0xc3f38b['fields']['length'],'rows':_[_0xb92e('0x29')](_0xc3f38b[_0xb92e('0x34')],function(_0x3103c8){return{'id':_0x3103c8[_0xb92e('0x26')],'name':_0x3103c8['label'],'custom':_0x3103c8[_0xb92e('0x6b')],'options':_0x3103c8[_0xb92e('0x6c')][_0xb92e('0x35')]>0x0?_[_0xb92e('0x29')](_0x3103c8['picklistValues'],function(_0x3abe56){return{'name':_0x3abe56['label'],'value':_0x3abe56[_0xb92e('0x6d')]};}):_0x3103c8[_0xb92e('0x2d')]==_0xb92e('0x66')?[{'name':_0xb92e('0x6e'),'value':_0xb92e('0x6f')},{'name':_0xb92e('0x70'),'value':_0xb92e('0x71')}]:[]};})};}})[_0xb92e('0x3f')](respondWithResult(_0x13475d,null))[_0xb92e('0x42')](function(_0x2c2bde){var _0xf39c88=_0xe3271b[_0xb92e('0x2f')]['test']?0x1f4:_0x2c2bde[_0xb92e('0x72')]||0x1f4;logger[_0xb92e('0x73')](_0xb92e('0x74'),_0xb92e('0x75'),_0xf39c88,JSON[_0xb92e('0x76')](_0x2c2bde));delete _0x2c2bde[_0xb92e('0x26')];if(_0xf39c88===0x191){_0xf39c88=0x190;}_0x13475d['status'](_0xf39c88)['send'](_0xe3271b[_0xb92e('0x2f')][_0xb92e('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x2c2bde[_0xb92e('0x72')]}:_0x2c2bde);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ba4a4dd..cec482a 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.model.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x765b=['rimraf','../../config/environment','SalesforceAccount','int_salesforce_accounts','api','bluebird','path'];(function(_0x5d25d1,_0x3e7a97){var _0x5695cb=function(_0x3b1846){while(--_0x3b1846){_0x5d25d1['push'](_0x5d25d1['shift']());}};_0x5695cb(++_0x3e7a97);}(_0x765b,0x18c));var _0xb765=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0x765b[_0x130d82];return _0x112070;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb765('0x0'));var moment=require('moment');var BPromise=require(_0xb765('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb765('0x2'));var rimraf=require(_0xb765('0x3'));var config=require(_0xb765('0x4'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5441a3,_0x339593){return _0x5441a3['define'](_0xb765('0x5'),attributes,{'tableName':_0xb765('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe85c=['SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','define'];(function(_0x3da35e,_0x3680bc){var _0x5d3417=function(_0x38b149){while(--_0x38b149){_0x3da35e['push'](_0x3da35e['shift']());}};_0x5d3417(++_0x3680bc);}(_0xe85c,0x1a6));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce85('0x0'));var util=require('util');var logger=require(_0xce85('0x1'))(_0xce85('0x2'));var moment=require(_0xce85('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xce85('0x4'));var rimraf=require(_0xce85('0x5'));var config=require(_0xce85('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5ea8d4,_0x3fe62f){return _0x5ea8d4[_0xce85('0x7')](_0xce85('0x8'),attributes,{'tableName':_0xce85('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 9396759..f1696f0 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1be5=['GetSalesforceAccount','SalesforceAccount','options','raw','where','limit','include','map','model','attributes','ShowSalesforceAccount','find','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x37a269,_0x3b6a4f){var _0x44c19b=function(_0x4ec245){while(--_0x4ec245){_0x37a269['push'](_0x37a269['shift']());}};_0x44c19b(++_0x3b6a4f);}(_0x1be5,0x91));var _0x51be=function(_0x18963e,_0xa47d8b){_0x18963e=_0x18963e-0x0;var _0x27aacd=_0x1be5[_0x18963e];return _0x27aacd;};'use strict';var _=require('lodash');var util=require(_0x51be('0x0'));var moment=require(_0x51be('0x1'));var BPromise=require(_0x51be('0x2'));var rs=require(_0x51be('0x3'));var fs=require('fs');var Redis=require(_0x51be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x51be('0x5'));var logger=require(_0x51be('0x6'))(_0x51be('0x7'));var config=require('../../config/environment');var jayson=require(_0x51be('0x8'));var client=jayson['client'][_0x51be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d866b,_0x4a9747,_0x4233d9){return new BPromise(function(_0x4785af,_0x5c8d3c){return client['request'](_0x2d866b,_0x4233d9)['then'](function(_0x2a5880){logger[_0x51be('0xa')](_0x51be('0xb'),_0x4a9747,_0x51be('0xc'));logger[_0x51be('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4a9747,_0x51be('0xc'),JSON[_0x51be('0xe')](_0x2a5880));if(_0x2a5880[_0x51be('0xf')]){if(_0x2a5880['error'][_0x51be('0x10')]===0x1f4){logger[_0x51be('0xf')](_0x51be('0xb'),_0x4a9747,_0x2a5880['error'][_0x51be('0x11')]);return _0x5c8d3c(_0x2a5880[_0x51be('0xf')]['message']);}logger[_0x51be('0xf')](_0x51be('0xb'),_0x4a9747,_0x2a5880[_0x51be('0xf')][_0x51be('0x11')]);return _0x4785af(_0x2a5880['error']['message']);}else{logger[_0x51be('0xa')](_0x51be('0xb'),_0x4a9747,'request\x20sent');_0x4785af(_0x2a5880[_0x51be('0x12')][_0x51be('0x11')]);}})[_0x51be('0x13')](function(_0x34cc79){logger[_0x51be('0xf')](_0x51be('0xb'),_0x4a9747,_0x34cc79);_0x5c8d3c(_0x34cc79);});});}exports[_0x51be('0x14')]=function(_0x31b2cd){var _0x49c1d1=this;return new Promise(function(_0x3c6f4f,_0x11092b){return db[_0x51be('0x15')]['findAll']({'raw':_0x31b2cd['options']?_0x31b2cd[_0x51be('0x16')][_0x51be('0x17')]===undefined?!![]:![]:!![],'where':_0x31b2cd[_0x51be('0x16')]?_0x31b2cd['options'][_0x51be('0x18')]||null:null,'attributes':_0x31b2cd[_0x51be('0x16')]?_0x31b2cd[_0x51be('0x16')]['attributes']||null:null,'limit':_0x31b2cd[_0x51be('0x16')]?_0x31b2cd[_0x51be('0x16')][_0x51be('0x19')]||null:null,'include':_0x31b2cd['options']?_0x31b2cd[_0x51be('0x16')][_0x51be('0x1a')]?_[_0x51be('0x1b')](_0x31b2cd[_0x51be('0x16')][_0x51be('0x1a')],function(_0x2bf27f){return{'model':db[_0x2bf27f[_0x51be('0x1c')]],'as':_0x2bf27f['as'],'attributes':_0x2bf27f[_0x51be('0x1d')],'include':_0x2bf27f[_0x51be('0x1a')]?_[_0x51be('0x1b')](_0x2bf27f[_0x51be('0x1a')],function(_0x216d82){return{'model':db[_0x216d82['model']],'as':_0x216d82['as'],'attributes':_0x216d82[_0x51be('0x1d')],'include':_0x216d82[_0x51be('0x1a')]?_[_0x51be('0x1b')](_0x216d82[_0x51be('0x1a')],function(_0x54725d){return{'model':db[_0x54725d['model']],'as':_0x54725d['as'],'attributes':_0x54725d[_0x51be('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1441dd){logger[_0x51be('0xa')](_0x51be('0x14'),_0x31b2cd);logger[_0x51be('0xd')]('GetSalesforceAccount',_0x31b2cd,JSON[_0x51be('0xe')](_0x1441dd));_0x3c6f4f(_0x1441dd);})[_0x51be('0x13')](function(_0x32cc15){logger[_0x51be('0xf')](_0x51be('0x14'),_0x32cc15[_0x51be('0x11')],_0x31b2cd);_0x11092b(_0x49c1d1[_0x51be('0xf')](0x1f4,_0x32cc15[_0x51be('0x11')]));});});};exports[_0x51be('0x1e')]=function(_0x4e8f45){var _0x25f909=this;return new Promise(function(_0xbee9fe,_0x25fd43){return db[_0x51be('0x15')][_0x51be('0x1f')]({'raw':_0x4e8f45[_0x51be('0x16')]?_0x4e8f45[_0x51be('0x16')][_0x51be('0x17')]===undefined?!![]:![]:!![],'where':_0x4e8f45[_0x51be('0x16')]?_0x4e8f45[_0x51be('0x16')][_0x51be('0x18')]||null:null,'attributes':_0x4e8f45[_0x51be('0x16')]?_0x4e8f45['options']['attributes']||null:null,'include':_0x4e8f45[_0x51be('0x16')]?_0x4e8f45['options'][_0x51be('0x1a')]?_[_0x51be('0x1b')](_0x4e8f45[_0x51be('0x16')]['include'],function(_0x33c8ad){return{'model':db[_0x33c8ad['model']],'as':_0x33c8ad['as'],'attributes':_0x33c8ad[_0x51be('0x1d')],'include':_0x33c8ad['include']?_[_0x51be('0x1b')](_0x33c8ad['include'],function(_0x25ba8e){return{'model':db[_0x25ba8e[_0x51be('0x1c')]],'as':_0x25ba8e['as'],'attributes':_0x25ba8e['attributes'],'include':_0x25ba8e[_0x51be('0x1a')]?_[_0x51be('0x1b')](_0x25ba8e['include'],function(_0x184331){return{'model':db[_0x184331[_0x51be('0x1c')]],'as':_0x184331['as'],'attributes':_0x184331['attributes']};}):[]};}):[]};}):[]:[]})[_0x51be('0x20')](function(_0x3711dd){logger[_0x51be('0xa')]('ShowSalesforceAccount',_0x4e8f45);logger[_0x51be('0xd')](_0x51be('0x1e'),_0x4e8f45,JSON['stringify'](_0x3711dd));_0xbee9fe(_0x3711dd);})[_0x51be('0x13')](function(_0x1e6592){logger[_0x51be('0xf')](_0x51be('0x1e'),_0x1e6592[_0x51be('0x11')],_0x4e8f45);_0x25fd43(_0x25f909[_0x51be('0xf')](0x1f4,_0x1e6592['message']));});});}; \ No newline at end of file +var _0xc91e=['result','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetSalesforceAccount','debug','ShowSalesforceAccount','find','lodash','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info'];(function(_0x426de2,_0x24acaf){var _0x1dbafc=function(_0x57e5d4){while(--_0x57e5d4){_0x426de2['push'](_0x426de2['shift']());}};_0x1dbafc(++_0x24acaf);}(_0xc91e,0xdc));var _0xec91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc91e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec91('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xec91('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec91('0x2'))(_0xec91('0x3'));var config=require(_0xec91('0x4'));var jayson=require(_0xec91('0x5'));var client=jayson[_0xec91('0x6')][_0xec91('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3252b7,_0x67d76f,_0x184169){return new BPromise(function(_0x5399cd,_0x290973){return client[_0xec91('0x8')](_0x3252b7,_0x184169)[_0xec91('0x9')](function(_0x37e40d){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x67d76f,_0xec91('0xa'));logger['debug'](_0xec91('0xb'),_0x67d76f,_0xec91('0xa'),JSON[_0xec91('0xc')](_0x37e40d));if(_0x37e40d[_0xec91('0xd')]){if(_0x37e40d[_0xec91('0xd')][_0xec91('0xe')]===0x1f4){logger[_0xec91('0xd')](_0xec91('0xf'),_0x67d76f,_0x37e40d[_0xec91('0xd')][_0xec91('0x10')]);return _0x290973(_0x37e40d['error'][_0xec91('0x10')]);}logger['error'](_0xec91('0xf'),_0x67d76f,_0x37e40d[_0xec91('0xd')][_0xec91('0x10')]);return _0x5399cd(_0x37e40d[_0xec91('0xd')][_0xec91('0x10')]);}else{logger[_0xec91('0x11')](_0xec91('0xf'),_0x67d76f,_0xec91('0xa'));_0x5399cd(_0x37e40d[_0xec91('0x12')]['message']);}})[_0xec91('0x13')](function(_0x198641){logger[_0xec91('0xd')](_0xec91('0xf'),_0x67d76f,_0x198641);_0x290973(_0x198641);});});}exports['GetSalesforceAccount']=function(_0x1402a4){var _0x47c219=this;return new Promise(function(_0x159ff3,_0x22a1ba){return db[_0xec91('0x14')][_0xec91('0x15')]({'raw':_0x1402a4[_0xec91('0x16')]?_0x1402a4[_0xec91('0x16')][_0xec91('0x17')]===undefined?!![]:![]:!![],'where':_0x1402a4[_0xec91('0x16')]?_0x1402a4[_0xec91('0x16')][_0xec91('0x18')]||null:null,'attributes':_0x1402a4[_0xec91('0x16')]?_0x1402a4['options'][_0xec91('0x19')]||null:null,'limit':_0x1402a4[_0xec91('0x16')]?_0x1402a4[_0xec91('0x16')][_0xec91('0x1a')]||null:null,'include':_0x1402a4[_0xec91('0x16')]?_0x1402a4['options'][_0xec91('0x1b')]?_['map'](_0x1402a4[_0xec91('0x16')][_0xec91('0x1b')],function(_0x2b7eac){return{'model':db[_0x2b7eac[_0xec91('0x1c')]],'as':_0x2b7eac['as'],'attributes':_0x2b7eac['attributes'],'include':_0x2b7eac['include']?_[_0xec91('0x1d')](_0x2b7eac[_0xec91('0x1b')],function(_0x43794c){return{'model':db[_0x43794c[_0xec91('0x1c')]],'as':_0x43794c['as'],'attributes':_0x43794c[_0xec91('0x19')],'include':_0x43794c[_0xec91('0x1b')]?_[_0xec91('0x1d')](_0x43794c[_0xec91('0x1b')],function(_0x55f477){return{'model':db[_0x55f477['model']],'as':_0x55f477['as'],'attributes':_0x55f477['attributes']};}):[]};}):[]};}):[]:[]})[_0xec91('0x9')](function(_0x4757f9){logger['info'](_0xec91('0x1e'),_0x1402a4);logger[_0xec91('0x1f')]('GetSalesforceAccount',_0x1402a4,JSON['stringify'](_0x4757f9));_0x159ff3(_0x4757f9);})[_0xec91('0x13')](function(_0x5a0c39){logger[_0xec91('0xd')](_0xec91('0x1e'),_0x5a0c39[_0xec91('0x10')],_0x1402a4);_0x22a1ba(_0x47c219[_0xec91('0xd')](0x1f4,_0x5a0c39[_0xec91('0x10')]));});});};exports[_0xec91('0x20')]=function(_0x2d564d){var _0xb3b04d=this;return new Promise(function(_0x184144,_0x2d9e9a){return db[_0xec91('0x14')][_0xec91('0x21')]({'raw':_0x2d564d['options']?_0x2d564d[_0xec91('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2d564d['options']?_0x2d564d[_0xec91('0x16')][_0xec91('0x18')]||null:null,'attributes':_0x2d564d[_0xec91('0x16')]?_0x2d564d['options'][_0xec91('0x19')]||null:null,'include':_0x2d564d[_0xec91('0x16')]?_0x2d564d[_0xec91('0x16')]['include']?_[_0xec91('0x1d')](_0x2d564d[_0xec91('0x16')]['include'],function(_0x3bd849){return{'model':db[_0x3bd849['model']],'as':_0x3bd849['as'],'attributes':_0x3bd849[_0xec91('0x19')],'include':_0x3bd849[_0xec91('0x1b')]?_['map'](_0x3bd849[_0xec91('0x1b')],function(_0x52ca6f){return{'model':db[_0x52ca6f[_0xec91('0x1c')]],'as':_0x52ca6f['as'],'attributes':_0x52ca6f[_0xec91('0x19')],'include':_0x52ca6f[_0xec91('0x1b')]?_[_0xec91('0x1d')](_0x52ca6f[_0xec91('0x1b')],function(_0x1f69ea){return{'model':db[_0x1f69ea[_0xec91('0x1c')]],'as':_0x1f69ea['as'],'attributes':_0x1f69ea[_0xec91('0x19')]};}):[]};}):[]};}):[]:[]})[_0xec91('0x9')](function(_0x2c1e52){logger[_0xec91('0x11')](_0xec91('0x20'),_0x2d564d);logger[_0xec91('0x1f')](_0xec91('0x20'),_0x2d564d,JSON[_0xec91('0xc')](_0x2c1e52));_0x184144(_0x2c1e52);})[_0xec91('0x13')](function(_0x40da4c){logger[_0xec91('0xd')](_0xec91('0x20'),_0x40da4c[_0xec91('0x10')],_0x2d564d);_0x2d9e9a(_0xb3b04d[_0xec91('0xd')](0x1f4,_0x40da4c[_0xec91('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 67b47a1..36dc154 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x591a90,_0x5525b0){_0x591a90=_0x591a90-0x0;var _0x551587=_0x0b0e[_0x591a90];return _0x551587;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x0b0e[_0x5575cd];return _0x4979a0;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 5f8cec1..30588ee 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd45=['ENUM','contact_lead','contact','lead','account','nothing','sequelize','exports','STRING','Task','Case'];(function(_0x2d191a,_0x584c88){var _0x148e2f=function(_0x525dd3){while(--_0x525dd3){_0x2d191a['push'](_0x2d191a['shift']());}};_0x148e2f(++_0x584c88);}(_0xbd45,0x166));var _0x5bd4=function(_0x55de6c,_0x324c03){_0x55de6c=_0x55de6c-0x0;var _0x54caf1=_0xbd45[_0x55de6c];return _0x54caf1;};'use strict';var Sequelize=require(_0x5bd4('0x0'));module[_0x5bd4('0x1')]={'name':{'type':Sequelize[_0x5bd4('0x2')]},'description':{'type':Sequelize[_0x5bd4('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x5bd4('0x3'),_0x5bd4('0x4')),'defaultValue':_0x5bd4('0x3')},'moduleSearch':{'type':Sequelize[_0x5bd4('0x5')](_0x5bd4('0x6'),_0x5bd4('0x7'),_0x5bd4('0x8'),'account_contact_lead',_0x5bd4('0x9')),'defaultValue':_0x5bd4('0x6')},'moduleCreate':{'type':Sequelize[_0x5bd4('0x5')](_0x5bd4('0xa'),_0x5bd4('0x7'),'lead',_0x5bd4('0x9')),'defaultValue':_0x5bd4('0x8')},'leadId':{'type':Sequelize[_0x5bd4('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x5bd4('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x5bd4('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x5bd4('0x2')]}}; \ No newline at end of file +var _0x95cc=['account_contact_lead','account','nothing','sequelize','exports','STRING','Task','ENUM','contact_lead','contact','lead'];(function(_0x231238,_0x5117a6){var _0x3d15fe=function(_0x7e0cb4){while(--_0x7e0cb4){_0x231238['push'](_0x231238['shift']());}};_0x3d15fe(++_0x5117a6);}(_0x95cc,0x19a));var _0xc95c=function(_0x3faa69,_0x3706c8){_0x3faa69=_0x3faa69-0x0;var _0x2b83a4=_0x95cc[_0x3faa69];return _0x2b83a4;};'use strict';var Sequelize=require(_0xc95c('0x0'));module[_0xc95c('0x1')]={'name':{'type':Sequelize[_0xc95c('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xc95c('0x3'),'Case'),'defaultValue':_0xc95c('0x3')},'moduleSearch':{'type':Sequelize[_0xc95c('0x4')](_0xc95c('0x5'),_0xc95c('0x6'),_0xc95c('0x7'),_0xc95c('0x8'),_0xc95c('0x9')),'defaultValue':_0xc95c('0x5')},'moduleCreate':{'type':Sequelize[_0xc95c('0x4')](_0xc95c('0xa'),_0xc95c('0x6'),'lead',_0xc95c('0x9')),'defaultValue':_0xc95c('0x7')},'leadId':{'type':Sequelize[_0xc95c('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xc95c('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xc95c('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xc95c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index c903069..290b70f 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef89=['length','include','find','catch','create','body','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','map','SalesforceConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params'];(function(_0x329d59,_0xae2550){var _0x2ff3bb=function(_0x2f9019){while(--_0x2f9019){_0x329d59['push'](_0x329d59['shift']());}};_0x2ff3bb(++_0xae2550);}(_0xef89,0xf6));var _0x9ef8=function(_0x20e7e2,_0x2cc1da){_0x20e7e2=_0x20e7e2-0x0;var _0x48841c=_0xef89[_0x20e7e2];return _0x48841c;};'use strict';var emlformat=require(_0x9ef8('0x0'));var rimraf=require(_0x9ef8('0x1'));var zipdir=require(_0x9ef8('0x2'));var jsonpatch=require(_0x9ef8('0x3'));var rp=require(_0x9ef8('0x4'));var moment=require('moment');var BPromise=require(_0x9ef8('0x5'));var Mustache=require(_0x9ef8('0x6'));var util=require(_0x9ef8('0x7'));var path=require(_0x9ef8('0x8'));var sox=require(_0x9ef8('0x9'));var csv=require('to-csv');var ejs=require(_0x9ef8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9ef8('0xb'));var jsforce=require(_0x9ef8('0xc'));var deskjs=require(_0x9ef8('0xd'));var toCsv=require(_0x9ef8('0xe'));var querystring=require(_0x9ef8('0xf'));var Papa=require(_0x9ef8('0x10'));var Redis=require(_0x9ef8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9ef8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ef8('0x13'))(_0x9ef8('0x14'));var utils=require('../../config/utils');var config=require(_0x9ef8('0x15'));var licenseUtil=require(_0x9ef8('0x16'));var db=require(_0x9ef8('0x17'))['db'];function respondWithStatusCode(_0x40d359,_0x38739d){_0x38739d=_0x38739d||0xcc;return function(_0x6d291b){if(_0x6d291b){return _0x40d359['sendStatus'](_0x38739d);}return _0x40d359['status'](_0x38739d)[_0x9ef8('0x18')]();};}function respondWithResult(_0x1fe8c9,_0x14611d){_0x14611d=_0x14611d||0xc8;return function(_0x3a0c2b){if(_0x3a0c2b){return _0x1fe8c9[_0x9ef8('0x19')](_0x14611d)[_0x9ef8('0x1a')](_0x3a0c2b);}};}function respondWithFilteredResult(_0x4052ce,_0x146075){return function(_0x4f4ff2){if(_0x4f4ff2){var _0x597ad2=typeof _0x146075[_0x9ef8('0x1b')]===_0x9ef8('0x1c')&&typeof _0x146075[_0x9ef8('0x1d')]==='undefined';var _0x284ac0=_0x4f4ff2[_0x9ef8('0x1e')];var _0x3b5e56=_0x597ad2?0x0:_0x146075['offset'];var _0x53141a=_0x597ad2?_0x4f4ff2[_0x9ef8('0x1e')]:_0x146075[_0x9ef8('0x1b')]+_0x146075[_0x9ef8('0x1d')];var _0x19e9c4;if(_0x53141a>=_0x284ac0){_0x53141a=_0x284ac0;_0x19e9c4=0xc8;}else{_0x19e9c4=0xce;}_0x4052ce['status'](_0x19e9c4);return _0x4052ce['set'](_0x9ef8('0x1f'),_0x3b5e56+'-'+_0x53141a+'/'+_0x284ac0)[_0x9ef8('0x1a')](_0x4f4ff2);}return null;};}function patchUpdates(_0x2b938b){return function(_0x429212){try{jsonpatch['apply'](_0x429212,_0x2b938b,!![]);}catch(_0x32e4ee){return BPromise[_0x9ef8('0x20')](_0x32e4ee);}return _0x429212[_0x9ef8('0x21')]();};}function saveUpdates(_0x43a67c,_0x59e6ae){return function(_0x285b22){if(_0x285b22){return _0x285b22[_0x9ef8('0x22')](_0x43a67c)[_0x9ef8('0x23')](function(_0x38f888){return _0x38f888;});}return null;};}function removeEntity(_0x420058,_0x19ce3a){return function(_0x160ae7){if(_0x160ae7){return _0x160ae7[_0x9ef8('0x24')]()[_0x9ef8('0x23')](function(){_0x420058[_0x9ef8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4afe14,_0x5cb6f0){return function(_0x16d23e){if(!_0x16d23e){_0x4afe14[_0x9ef8('0x25')](0x194);}return _0x16d23e;};}function handleError(_0x56edab,_0x29bd66){_0x29bd66=_0x29bd66||0x1f4;return function(_0x4e8142){logger[_0x9ef8('0x26')](_0x4e8142[_0x9ef8('0x27')]);if(_0x4e8142[_0x9ef8('0x28')]){delete _0x4e8142[_0x9ef8('0x28')];}_0x56edab[_0x9ef8('0x19')](_0x29bd66)['send'](_0x4e8142);};}exports['index']=function(_0x4644f7,_0x1992d0){var _0x357728={},_0xb93053={},_0xa35792={'count':0x0,'rows':[]};var _0x4f8a7a=_[_0x9ef8('0x29')](db[_0x9ef8('0x2a')][_0x9ef8('0x2b')],function(_0x5873e3){return{'name':_0x5873e3['fieldName'],'type':_0x5873e3[_0x9ef8('0x2c')][_0x9ef8('0x2d')]};});_0xb93053[_0x9ef8('0x2e')]=_[_0x9ef8('0x29')](_0x4f8a7a,'name');_0xb93053['query']=_[_0x9ef8('0x2f')](_0x4644f7[_0x9ef8('0x30')]);_0xb93053[_0x9ef8('0x31')]=_[_0x9ef8('0x32')](_0xb93053[_0x9ef8('0x2e')],_0xb93053[_0x9ef8('0x30')]);_0x357728[_0x9ef8('0x33')]=_['intersection'](_0xb93053[_0x9ef8('0x2e')],qs[_0x9ef8('0x34')](_0x4644f7[_0x9ef8('0x30')]['fields']));_0x357728['attributes']=_0x357728[_0x9ef8('0x33')]['length']?_0x357728[_0x9ef8('0x33')]:_0xb93053[_0x9ef8('0x2e')];if(!_0x4644f7[_0x9ef8('0x30')][_0x9ef8('0x35')](_0x9ef8('0x36'))){_0x357728[_0x9ef8('0x1d')]=qs[_0x9ef8('0x1d')](_0x4644f7[_0x9ef8('0x30')][_0x9ef8('0x1d')]);_0x357728['offset']=qs[_0x9ef8('0x1b')](_0x4644f7[_0x9ef8('0x30')][_0x9ef8('0x1b')]);}_0x357728['order']=qs[_0x9ef8('0x37')](_0x4644f7[_0x9ef8('0x30')][_0x9ef8('0x37')]);_0x357728[_0x9ef8('0x38')]=qs['filters'](_[_0x9ef8('0x39')](_0x4644f7[_0x9ef8('0x30')],_0xb93053['filters']),_0x4f8a7a);if(_0x4644f7[_0x9ef8('0x30')][_0x9ef8('0x3a')]){_0x357728['where']=_[_0x9ef8('0x3b')](_0x357728['where'],{'$or':_[_0x9ef8('0x29')](_0x4f8a7a,function(_0x4ee369){if(_0x4ee369[_0x9ef8('0x2c')]!==_0x9ef8('0x3c')){var _0x100c4f={};_0x100c4f[_0x4ee369[_0x9ef8('0x28')]]={'$like':'%'+_0x4644f7[_0x9ef8('0x30')][_0x9ef8('0x3a')]+'%'};return _0x100c4f;}})});}_0x357728=_[_0x9ef8('0x3b')]({},_0x357728,_0x4644f7[_0x9ef8('0x3d')]);var _0x487945={'where':_0x357728[_0x9ef8('0x38')]};return db[_0x9ef8('0x2a')][_0x9ef8('0x1e')](_0x487945)[_0x9ef8('0x23')](function(_0x3d3318){_0xa35792[_0x9ef8('0x1e')]=_0x3d3318;if(_0x4644f7['query'][_0x9ef8('0x3e')]){_0x357728['include']=[{'all':!![]}];}return db[_0x9ef8('0x2a')][_0x9ef8('0x3f')](_0x357728);})[_0x9ef8('0x23')](function(_0x33f7bc){_0xa35792[_0x9ef8('0x40')]=_0x33f7bc;return _0xa35792;})[_0x9ef8('0x23')](respondWithFilteredResult(_0x1992d0,_0x357728))['catch'](handleError(_0x1992d0,null));};exports['show']=function(_0x575f3b,_0x5179b7){var _0x29201={'raw':![],'where':{'id':_0x575f3b[_0x9ef8('0x41')]['id']}},_0xbf93e1={};_0xbf93e1['model']=_['keys'](db[_0x9ef8('0x2a')][_0x9ef8('0x2b')]);_0xbf93e1[_0x9ef8('0x30')]=_[_0x9ef8('0x2f')](_0x575f3b[_0x9ef8('0x30')]);_0xbf93e1[_0x9ef8('0x31')]=_['intersection'](_0xbf93e1[_0x9ef8('0x2e')],_0xbf93e1['query']);_0x29201['attributes']=_[_0x9ef8('0x32')](_0xbf93e1['model'],qs[_0x9ef8('0x34')](_0x575f3b[_0x9ef8('0x30')][_0x9ef8('0x34')]));_0x29201['attributes']=_0x29201[_0x9ef8('0x33')][_0x9ef8('0x42')]?_0x29201[_0x9ef8('0x33')]:_0xbf93e1['model'];if(_0x575f3b['query'][_0x9ef8('0x3e')]){_0x29201[_0x9ef8('0x43')]=[{'all':!![]}];}_0x29201=_[_0x9ef8('0x3b')]({},_0x29201,_0x575f3b['options']);return db[_0x9ef8('0x2a')][_0x9ef8('0x44')](_0x29201)[_0x9ef8('0x23')](handleEntityNotFound(_0x5179b7,null))[_0x9ef8('0x23')](respondWithResult(_0x5179b7,null))[_0x9ef8('0x45')](handleError(_0x5179b7,null));};exports['create']=function(_0x192fcb,_0x243476){return db['SalesforceConfiguration'][_0x9ef8('0x46')](_0x192fcb[_0x9ef8('0x47')],{})[_0x9ef8('0x23')](respondWithResult(_0x243476,0xc9))['catch'](handleError(_0x243476,null));};exports[_0x9ef8('0x22')]=function(_0x451e17,_0x3e203d){if(_0x451e17[_0x9ef8('0x47')]['id']){delete _0x451e17[_0x9ef8('0x47')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x451e17[_0x9ef8('0x41')]['id']}})[_0x9ef8('0x23')](handleEntityNotFound(_0x3e203d,null))[_0x9ef8('0x23')](saveUpdates(_0x451e17[_0x9ef8('0x47')],null))['then'](respondWithResult(_0x3e203d,null))[_0x9ef8('0x45')](handleError(_0x3e203d,null));};exports['destroy']=function(_0x3f1c34,_0x45f6fb){return db[_0x9ef8('0x2a')][_0x9ef8('0x44')]({'where':{'id':_0x3f1c34[_0x9ef8('0x41')]['id']}})['then'](handleEntityNotFound(_0x45f6fb,null))['then'](removeEntity(_0x45f6fb,null))[_0x9ef8('0x45')](handleError(_0x45f6fb,null));};exports[_0x9ef8('0x48')]=function(_0x268771,_0x5e2c9c,_0x77184d){var _0x36a2b3={};var _0x16a530={};var _0x59f668;var _0x4cbb46;return db[_0x9ef8('0x2a')][_0x9ef8('0x49')]({'where':{'id':_0x268771[_0x9ef8('0x41')]['id']}})[_0x9ef8('0x23')](handleEntityNotFound(_0x5e2c9c,null))[_0x9ef8('0x23')](function(_0x52f6e1){if(_0x52f6e1){_0x59f668=_0x52f6e1;_0x16a530['model']=_[_0x9ef8('0x2f')](db[_0x9ef8('0x4a')][_0x9ef8('0x2b')]);_0x16a530[_0x9ef8('0x30')]=_[_0x9ef8('0x2f')](_0x268771['query']);_0x16a530[_0x9ef8('0x31')]=_['intersection'](_0x16a530[_0x9ef8('0x2e')],_0x16a530[_0x9ef8('0x30')]);_0x36a2b3[_0x9ef8('0x33')]=_[_0x9ef8('0x32')](_0x16a530[_0x9ef8('0x2e')],qs[_0x9ef8('0x34')](_0x268771[_0x9ef8('0x30')][_0x9ef8('0x34')]));_0x36a2b3[_0x9ef8('0x33')]=_0x36a2b3[_0x9ef8('0x33')][_0x9ef8('0x42')]?_0x36a2b3['attributes']:_0x16a530[_0x9ef8('0x2e')];_0x36a2b3[_0x9ef8('0x4b')]=qs[_0x9ef8('0x37')](_0x268771[_0x9ef8('0x30')][_0x9ef8('0x37')]);_0x36a2b3[_0x9ef8('0x38')]=qs[_0x9ef8('0x31')](_['pick'](_0x268771[_0x9ef8('0x30')],_0x16a530['filters']));if(_0x268771[_0x9ef8('0x30')][_0x9ef8('0x3a')]){_0x36a2b3[_0x9ef8('0x38')]=_[_0x9ef8('0x3b')](_0x36a2b3['where'],{'$or':_[_0x9ef8('0x29')](_0x36a2b3[_0x9ef8('0x33')],function(_0x141dd8){var _0x4ab25a={};_0x4ab25a[_0x141dd8]={'$like':'%'+_0x268771[_0x9ef8('0x30')][_0x9ef8('0x3a')]+'%'};return _0x4ab25a;})});}_0x36a2b3=_['merge']({},_0x36a2b3,_0x268771[_0x9ef8('0x3d')]);return _0x59f668[_0x9ef8('0x48')](_0x36a2b3);}})[_0x9ef8('0x23')](function(_0x38c523){if(_0x38c523){_0x4cbb46=_0x38c523[_0x9ef8('0x42')];if(!_0x268771[_0x9ef8('0x30')][_0x9ef8('0x35')](_0x9ef8('0x36'))){_0x36a2b3['limit']=qs['limit'](_0x268771[_0x9ef8('0x30')][_0x9ef8('0x1d')]);_0x36a2b3[_0x9ef8('0x1b')]=qs[_0x9ef8('0x1b')](_0x268771[_0x9ef8('0x30')][_0x9ef8('0x1b')]);}return _0x59f668[_0x9ef8('0x48')](_0x36a2b3);}})[_0x9ef8('0x23')](function(_0x2a9762){if(_0x2a9762){return _0x2a9762?{'count':_0x4cbb46,'rows':_0x2a9762}:null;}})[_0x9ef8('0x23')](respondWithResult(_0x5e2c9c,null))[_0x9ef8('0x45')](handleError(_0x5e2c9c,null));};exports[_0x9ef8('0x4c')]=function(_0x7e2784,_0x1ec985,_0x5477e8){var _0x55395d={};var _0x2c3a4d={};var _0x44e2e2;var _0x806b0d;return db[_0x9ef8('0x2a')][_0x9ef8('0x49')]({'where':{'id':_0x7e2784[_0x9ef8('0x41')]['id']}})[_0x9ef8('0x23')](handleEntityNotFound(_0x1ec985,null))[_0x9ef8('0x23')](function(_0x145c18){if(_0x145c18){_0x44e2e2=_0x145c18;_0x2c3a4d[_0x9ef8('0x2e')]=_[_0x9ef8('0x2f')](db['SalesforceField'][_0x9ef8('0x2b')]);_0x2c3a4d['query']=_[_0x9ef8('0x2f')](_0x7e2784['query']);_0x2c3a4d[_0x9ef8('0x31')]=_['intersection'](_0x2c3a4d[_0x9ef8('0x2e')],_0x2c3a4d[_0x9ef8('0x30')]);_0x55395d['attributes']=_[_0x9ef8('0x32')](_0x2c3a4d[_0x9ef8('0x2e')],qs['fields'](_0x7e2784[_0x9ef8('0x30')][_0x9ef8('0x34')]));_0x55395d[_0x9ef8('0x33')]=_0x55395d[_0x9ef8('0x33')][_0x9ef8('0x42')]?_0x55395d[_0x9ef8('0x33')]:_0x2c3a4d['model'];_0x55395d[_0x9ef8('0x4b')]=qs[_0x9ef8('0x37')](_0x7e2784[_0x9ef8('0x30')][_0x9ef8('0x37')]);_0x55395d[_0x9ef8('0x38')]=qs['filters'](_[_0x9ef8('0x39')](_0x7e2784[_0x9ef8('0x30')],_0x2c3a4d[_0x9ef8('0x31')]));if(_0x7e2784['query'][_0x9ef8('0x3a')]){_0x55395d[_0x9ef8('0x38')]=_[_0x9ef8('0x3b')](_0x55395d[_0x9ef8('0x38')],{'$or':_['map'](_0x55395d[_0x9ef8('0x33')],function(_0x24cc35){var _0x5987bb={};_0x5987bb[_0x24cc35]={'$like':'%'+_0x7e2784[_0x9ef8('0x30')]['filter']+'%'};return _0x5987bb;})});}_0x55395d=_[_0x9ef8('0x3b')]({},_0x55395d,_0x7e2784[_0x9ef8('0x3d')]);return _0x44e2e2[_0x9ef8('0x4c')](_0x55395d);}})['then'](function(_0x445ce3){if(_0x445ce3){_0x806b0d=_0x445ce3['length'];if(!_0x7e2784[_0x9ef8('0x30')][_0x9ef8('0x35')](_0x9ef8('0x36'))){_0x55395d['limit']=qs[_0x9ef8('0x1d')](_0x7e2784[_0x9ef8('0x30')][_0x9ef8('0x1d')]);_0x55395d[_0x9ef8('0x1b')]=qs[_0x9ef8('0x1b')](_0x7e2784[_0x9ef8('0x30')][_0x9ef8('0x1b')]);}return _0x44e2e2['getSubjects'](_0x55395d);}})[_0x9ef8('0x23')](function(_0x2667ae){if(_0x2667ae){return _0x2667ae?{'count':_0x806b0d,'rows':_0x2667ae}:null;}})[_0x9ef8('0x23')](respondWithResult(_0x1ec985,null))[_0x9ef8('0x45')](handleError(_0x1ec985,null));};exports['getDescriptions']=function(_0x5a926a,_0x814728,_0x2ff73a){var _0x126fa3={};var _0x39dbe3={};var _0x576eff;var _0x57a770;return db[_0x9ef8('0x2a')][_0x9ef8('0x49')]({'where':{'id':_0x5a926a[_0x9ef8('0x41')]['id']}})['then'](handleEntityNotFound(_0x814728,null))[_0x9ef8('0x23')](function(_0x133550){if(_0x133550){_0x576eff=_0x133550;_0x39dbe3[_0x9ef8('0x2e')]=_[_0x9ef8('0x2f')](db[_0x9ef8('0x4a')][_0x9ef8('0x2b')]);_0x39dbe3['query']=_[_0x9ef8('0x2f')](_0x5a926a['query']);_0x39dbe3['filters']=_[_0x9ef8('0x32')](_0x39dbe3['model'],_0x39dbe3['query']);_0x126fa3[_0x9ef8('0x33')]=_[_0x9ef8('0x32')](_0x39dbe3['model'],qs['fields'](_0x5a926a[_0x9ef8('0x30')]['fields']));_0x126fa3[_0x9ef8('0x33')]=_0x126fa3[_0x9ef8('0x33')][_0x9ef8('0x42')]?_0x126fa3[_0x9ef8('0x33')]:_0x39dbe3['model'];_0x126fa3[_0x9ef8('0x4b')]=qs[_0x9ef8('0x37')](_0x5a926a[_0x9ef8('0x30')][_0x9ef8('0x37')]);_0x126fa3[_0x9ef8('0x38')]=qs[_0x9ef8('0x31')](_[_0x9ef8('0x39')](_0x5a926a['query'],_0x39dbe3[_0x9ef8('0x31')]));if(_0x5a926a[_0x9ef8('0x30')][_0x9ef8('0x3a')]){_0x126fa3[_0x9ef8('0x38')]=_[_0x9ef8('0x3b')](_0x126fa3[_0x9ef8('0x38')],{'$or':_['map'](_0x126fa3[_0x9ef8('0x33')],function(_0x48c960){var _0x2d8f86={};_0x2d8f86[_0x48c960]={'$like':'%'+_0x5a926a[_0x9ef8('0x30')][_0x9ef8('0x3a')]+'%'};return _0x2d8f86;})});}_0x126fa3=_[_0x9ef8('0x3b')]({},_0x126fa3,_0x5a926a['options']);return _0x576eff[_0x9ef8('0x4d')](_0x126fa3);}})[_0x9ef8('0x23')](function(_0x1c005b){if(_0x1c005b){_0x57a770=_0x1c005b['length'];if(!_0x5a926a[_0x9ef8('0x30')][_0x9ef8('0x35')](_0x9ef8('0x36'))){_0x126fa3['limit']=qs[_0x9ef8('0x1d')](_0x5a926a[_0x9ef8('0x30')][_0x9ef8('0x1d')]);_0x126fa3[_0x9ef8('0x1b')]=qs[_0x9ef8('0x1b')](_0x5a926a[_0x9ef8('0x30')][_0x9ef8('0x1b')]);}return _0x576eff[_0x9ef8('0x4d')](_0x126fa3);}})[_0x9ef8('0x23')](function(_0x46fde1){if(_0x46fde1){return _0x46fde1?{'count':_0x57a770,'rows':_0x46fde1}:null;}})[_0x9ef8('0x23')](respondWithResult(_0x814728,null))['catch'](handleError(_0x814728,null));}; \ No newline at end of file +var _0x9d9d=['sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','rows','params','length','options','find','create','body','catch','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x115638,_0x561aae){var _0x2d0dc8=function(_0x402be4){while(--_0x402be4){_0x115638['push'](_0x115638['shift']());}};_0x2d0dc8(++_0x561aae);}(_0x9d9d,0x129));var _0xd9d9=function(_0x25e931,_0x3ae075){_0x25e931=_0x25e931-0x0;var _0x42f489=_0x9d9d[_0x25e931];return _0x42f489;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd9d9('0x0'));var zipdir=require(_0xd9d9('0x1'));var jsonpatch=require(_0xd9d9('0x2'));var rp=require(_0xd9d9('0x3'));var moment=require(_0xd9d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd9d9('0x5'));var util=require(_0xd9d9('0x6'));var path=require(_0xd9d9('0x7'));var sox=require(_0xd9d9('0x8'));var csv=require(_0xd9d9('0x9'));var ejs=require(_0xd9d9('0xa'));var fs=require('fs');var fs_extra=require(_0xd9d9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd9d9('0xc'));var jsforce=require(_0xd9d9('0xd'));var deskjs=require(_0xd9d9('0xe'));var toCsv=require(_0xd9d9('0x9'));var querystring=require(_0xd9d9('0xf'));var Papa=require('papaparse');var Redis=require(_0xd9d9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd9d9('0x11'));var as=require(_0xd9d9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd9d9('0x13'))('api');var utils=require(_0xd9d9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd9d9('0x15'));var db=require(_0xd9d9('0x16'))['db'];function respondWithStatusCode(_0x118203,_0x54b024){_0x54b024=_0x54b024||0xcc;return function(_0x3842f1){if(_0x3842f1){return _0x118203[_0xd9d9('0x17')](_0x54b024);}return _0x118203['status'](_0x54b024)[_0xd9d9('0x18')]();};}function respondWithResult(_0x550392,_0x54bf64){_0x54bf64=_0x54bf64||0xc8;return function(_0x3e1c02){if(_0x3e1c02){return _0x550392[_0xd9d9('0x19')](_0x54bf64)['json'](_0x3e1c02);}};}function respondWithFilteredResult(_0x159fe4,_0x25ca0a){return function(_0x54ef05){if(_0x54ef05){var _0x417eda=typeof _0x25ca0a['offset']===_0xd9d9('0x1a')&&typeof _0x25ca0a[_0xd9d9('0x1b')]===_0xd9d9('0x1a');var _0x330fac=_0x54ef05[_0xd9d9('0x1c')];var _0x123d50=_0x417eda?0x0:_0x25ca0a['offset'];var _0x13748e=_0x417eda?_0x54ef05[_0xd9d9('0x1c')]:_0x25ca0a[_0xd9d9('0x1d')]+_0x25ca0a[_0xd9d9('0x1b')];var _0x3be93e;if(_0x13748e>=_0x330fac){_0x13748e=_0x330fac;_0x3be93e=0xc8;}else{_0x3be93e=0xce;}_0x159fe4[_0xd9d9('0x19')](_0x3be93e);return _0x159fe4[_0xd9d9('0x1e')](_0xd9d9('0x1f'),_0x123d50+'-'+_0x13748e+'/'+_0x330fac)[_0xd9d9('0x20')](_0x54ef05);}return null;};}function patchUpdates(_0x4f5cf5){return function(_0x33c970){try{jsonpatch[_0xd9d9('0x21')](_0x33c970,_0x4f5cf5,!![]);}catch(_0x5dbf85){return BPromise[_0xd9d9('0x22')](_0x5dbf85);}return _0x33c970[_0xd9d9('0x23')]();};}function saveUpdates(_0x2dddfa,_0x372225){return function(_0x2fb324){if(_0x2fb324){return _0x2fb324[_0xd9d9('0x24')](_0x2dddfa)['then'](function(_0x211465){return _0x211465;});}return null;};}function removeEntity(_0x532723,_0x15554f){return function(_0x2e859c){if(_0x2e859c){return _0x2e859c[_0xd9d9('0x25')]()[_0xd9d9('0x26')](function(){_0x532723[_0xd9d9('0x19')](0xcc)[_0xd9d9('0x18')]();});}};}function handleEntityNotFound(_0x29ee73,_0x4ea5ce){return function(_0xdd1422){if(!_0xdd1422){_0x29ee73[_0xd9d9('0x17')](0x194);}return _0xdd1422;};}function handleError(_0x5a37b5,_0x2abf6d){_0x2abf6d=_0x2abf6d||0x1f4;return function(_0x40bb7a){logger['error'](_0x40bb7a[_0xd9d9('0x27')]);if(_0x40bb7a[_0xd9d9('0x28')]){delete _0x40bb7a[_0xd9d9('0x28')];}_0x5a37b5[_0xd9d9('0x19')](_0x2abf6d)[_0xd9d9('0x29')](_0x40bb7a);};}exports[_0xd9d9('0x2a')]=function(_0x2e1d83,_0x571e35){var _0x36aca1={},_0xb9746={},_0x1e8676={'count':0x0,'rows':[]};var _0x13f16a=_[_0xd9d9('0x2b')](db[_0xd9d9('0x2c')][_0xd9d9('0x2d')],function(_0x5133c8){return{'name':_0x5133c8[_0xd9d9('0x2e')],'type':_0x5133c8[_0xd9d9('0x2f')][_0xd9d9('0x30')]};});_0xb9746['model']=_[_0xd9d9('0x2b')](_0x13f16a,'name');_0xb9746[_0xd9d9('0x31')]=_[_0xd9d9('0x32')](_0x2e1d83['query']);_0xb9746[_0xd9d9('0x33')]=_['intersection'](_0xb9746[_0xd9d9('0x34')],_0xb9746[_0xd9d9('0x31')]);_0x36aca1[_0xd9d9('0x35')]=_[_0xd9d9('0x36')](_0xb9746[_0xd9d9('0x34')],qs[_0xd9d9('0x37')](_0x2e1d83[_0xd9d9('0x31')][_0xd9d9('0x37')]));_0x36aca1[_0xd9d9('0x35')]=_0x36aca1['attributes']['length']?_0x36aca1[_0xd9d9('0x35')]:_0xb9746[_0xd9d9('0x34')];if(!_0x2e1d83[_0xd9d9('0x31')][_0xd9d9('0x38')]('nolimit')){_0x36aca1['limit']=qs['limit'](_0x2e1d83[_0xd9d9('0x31')][_0xd9d9('0x1b')]);_0x36aca1[_0xd9d9('0x1d')]=qs[_0xd9d9('0x1d')](_0x2e1d83[_0xd9d9('0x31')]['offset']);}_0x36aca1[_0xd9d9('0x39')]=qs['sort'](_0x2e1d83[_0xd9d9('0x31')][_0xd9d9('0x3a')]);_0x36aca1['where']=qs['filters'](_[_0xd9d9('0x3b')](_0x2e1d83['query'],_0xb9746[_0xd9d9('0x33')]),_0x13f16a);if(_0x2e1d83['query']['filter']){_0x36aca1[_0xd9d9('0x3c')]=_['merge'](_0x36aca1['where'],{'$or':_['map'](_0x13f16a,function(_0x20ec83){if(_0x20ec83[_0xd9d9('0x2f')]!==_0xd9d9('0x3d')){var _0x1f1ece={};_0x1f1ece[_0x20ec83[_0xd9d9('0x28')]]={'$like':'%'+_0x2e1d83[_0xd9d9('0x31')][_0xd9d9('0x3e')]+'%'};return _0x1f1ece;}})});}_0x36aca1=_[_0xd9d9('0x3f')]({},_0x36aca1,_0x2e1d83['options']);var _0xd9bbce={'where':_0x36aca1[_0xd9d9('0x3c')]};return db['SalesforceConfiguration'][_0xd9d9('0x1c')](_0xd9bbce)['then'](function(_0x379989){_0x1e8676['count']=_0x379989;if(_0x2e1d83['query'][_0xd9d9('0x40')]){_0x36aca1[_0xd9d9('0x41')]=[{'all':!![]}];}return db[_0xd9d9('0x2c')]['findAll'](_0x36aca1);})[_0xd9d9('0x26')](function(_0x2ffe86){_0x1e8676[_0xd9d9('0x42')]=_0x2ffe86;return _0x1e8676;})['then'](respondWithFilteredResult(_0x571e35,_0x36aca1))['catch'](handleError(_0x571e35,null));};exports['show']=function(_0x40c1a7,_0x139ed5){var _0x40b1c9={'raw':![],'where':{'id':_0x40c1a7[_0xd9d9('0x43')]['id']}},_0x6aab0a={};_0x6aab0a[_0xd9d9('0x34')]=_[_0xd9d9('0x32')](db[_0xd9d9('0x2c')][_0xd9d9('0x2d')]);_0x6aab0a[_0xd9d9('0x31')]=_[_0xd9d9('0x32')](_0x40c1a7[_0xd9d9('0x31')]);_0x6aab0a[_0xd9d9('0x33')]=_[_0xd9d9('0x36')](_0x6aab0a['model'],_0x6aab0a[_0xd9d9('0x31')]);_0x40b1c9['attributes']=_[_0xd9d9('0x36')](_0x6aab0a['model'],qs['fields'](_0x40c1a7['query'][_0xd9d9('0x37')]));_0x40b1c9[_0xd9d9('0x35')]=_0x40b1c9[_0xd9d9('0x35')][_0xd9d9('0x44')]?_0x40b1c9['attributes']:_0x6aab0a[_0xd9d9('0x34')];if(_0x40c1a7[_0xd9d9('0x31')][_0xd9d9('0x40')]){_0x40b1c9[_0xd9d9('0x41')]=[{'all':!![]}];}_0x40b1c9=_[_0xd9d9('0x3f')]({},_0x40b1c9,_0x40c1a7[_0xd9d9('0x45')]);return db[_0xd9d9('0x2c')][_0xd9d9('0x46')](_0x40b1c9)[_0xd9d9('0x26')](handleEntityNotFound(_0x139ed5,null))['then'](respondWithResult(_0x139ed5,null))['catch'](handleError(_0x139ed5,null));};exports[_0xd9d9('0x47')]=function(_0x5b244d,_0x5ea292){return db[_0xd9d9('0x2c')][_0xd9d9('0x47')](_0x5b244d[_0xd9d9('0x48')],{})['then'](respondWithResult(_0x5ea292,0xc9))['catch'](handleError(_0x5ea292,null));};exports[_0xd9d9('0x24')]=function(_0x161ff7,_0x5c2086){if(_0x161ff7[_0xd9d9('0x48')]['id']){delete _0x161ff7[_0xd9d9('0x48')]['id'];}return db[_0xd9d9('0x2c')][_0xd9d9('0x46')]({'where':{'id':_0x161ff7[_0xd9d9('0x43')]['id']}})[_0xd9d9('0x26')](handleEntityNotFound(_0x5c2086,null))[_0xd9d9('0x26')](saveUpdates(_0x161ff7['body'],null))[_0xd9d9('0x26')](respondWithResult(_0x5c2086,null))['catch'](handleError(_0x5c2086,null));};exports[_0xd9d9('0x25')]=function(_0x2ac231,_0x4a4b15){return db[_0xd9d9('0x2c')]['find']({'where':{'id':_0x2ac231[_0xd9d9('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a4b15,null))[_0xd9d9('0x26')](removeEntity(_0x4a4b15,null))[_0xd9d9('0x49')](handleError(_0x4a4b15,null));};exports[_0xd9d9('0x4a')]=function(_0x8a80b4,_0x517746,_0x22ea44){var _0x6a03fc={};var _0x15b6b8={};var _0x5915bd;var _0x4ba0aa;return db[_0xd9d9('0x2c')][_0xd9d9('0x4b')]({'where':{'id':_0x8a80b4['params']['id']}})[_0xd9d9('0x26')](handleEntityNotFound(_0x517746,null))[_0xd9d9('0x26')](function(_0x324d96){if(_0x324d96){_0x5915bd=_0x324d96;_0x15b6b8[_0xd9d9('0x34')]=_[_0xd9d9('0x32')](db[_0xd9d9('0x4c')][_0xd9d9('0x2d')]);_0x15b6b8[_0xd9d9('0x31')]=_[_0xd9d9('0x32')](_0x8a80b4[_0xd9d9('0x31')]);_0x15b6b8[_0xd9d9('0x33')]=_[_0xd9d9('0x36')](_0x15b6b8['model'],_0x15b6b8[_0xd9d9('0x31')]);_0x6a03fc[_0xd9d9('0x35')]=_[_0xd9d9('0x36')](_0x15b6b8[_0xd9d9('0x34')],qs[_0xd9d9('0x37')](_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x37')]));_0x6a03fc[_0xd9d9('0x35')]=_0x6a03fc[_0xd9d9('0x35')][_0xd9d9('0x44')]?_0x6a03fc[_0xd9d9('0x35')]:_0x15b6b8[_0xd9d9('0x34')];_0x6a03fc[_0xd9d9('0x39')]=qs[_0xd9d9('0x3a')](_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x3a')]);_0x6a03fc['where']=qs[_0xd9d9('0x33')](_[_0xd9d9('0x3b')](_0x8a80b4[_0xd9d9('0x31')],_0x15b6b8[_0xd9d9('0x33')]));if(_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x3e')]){_0x6a03fc['where']=_['merge'](_0x6a03fc[_0xd9d9('0x3c')],{'$or':_['map'](_0x6a03fc[_0xd9d9('0x35')],function(_0x179a15){var _0x4b0a48={};_0x4b0a48[_0x179a15]={'$like':'%'+_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x3e')]+'%'};return _0x4b0a48;})});}_0x6a03fc=_[_0xd9d9('0x3f')]({},_0x6a03fc,_0x8a80b4[_0xd9d9('0x45')]);return _0x5915bd[_0xd9d9('0x4a')](_0x6a03fc);}})[_0xd9d9('0x26')](function(_0x29edf5){if(_0x29edf5){_0x4ba0aa=_0x29edf5[_0xd9d9('0x44')];if(!_0x8a80b4['query'][_0xd9d9('0x38')](_0xd9d9('0x4d'))){_0x6a03fc[_0xd9d9('0x1b')]=qs['limit'](_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x1b')]);_0x6a03fc[_0xd9d9('0x1d')]=qs[_0xd9d9('0x1d')](_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x1d')]);}return _0x5915bd['getFields'](_0x6a03fc);}})[_0xd9d9('0x26')](function(_0x3464f0){if(_0x3464f0){return _0x3464f0?{'count':_0x4ba0aa,'rows':_0x3464f0}:null;}})['then'](respondWithResult(_0x517746,null))[_0xd9d9('0x49')](handleError(_0x517746,null));};exports[_0xd9d9('0x4e')]=function(_0x2ab64e,_0x3f5a0d,_0x505dbe){var _0x474150={};var _0x3a279c={};var _0x2a5528;var _0x4b833a;return db['SalesforceConfiguration'][_0xd9d9('0x4b')]({'where':{'id':_0x2ab64e[_0xd9d9('0x43')]['id']}})[_0xd9d9('0x26')](handleEntityNotFound(_0x3f5a0d,null))[_0xd9d9('0x26')](function(_0x458011){if(_0x458011){_0x2a5528=_0x458011;_0x3a279c['model']=_[_0xd9d9('0x32')](db[_0xd9d9('0x4c')]['rawAttributes']);_0x3a279c[_0xd9d9('0x31')]=_[_0xd9d9('0x32')](_0x2ab64e[_0xd9d9('0x31')]);_0x3a279c[_0xd9d9('0x33')]=_[_0xd9d9('0x36')](_0x3a279c[_0xd9d9('0x34')],_0x3a279c[_0xd9d9('0x31')]);_0x474150[_0xd9d9('0x35')]=_['intersection'](_0x3a279c[_0xd9d9('0x34')],qs['fields'](_0x2ab64e['query'][_0xd9d9('0x37')]));_0x474150['attributes']=_0x474150['attributes'][_0xd9d9('0x44')]?_0x474150['attributes']:_0x3a279c[_0xd9d9('0x34')];_0x474150[_0xd9d9('0x39')]=qs['sort'](_0x2ab64e['query'][_0xd9d9('0x3a')]);_0x474150[_0xd9d9('0x3c')]=qs[_0xd9d9('0x33')](_[_0xd9d9('0x3b')](_0x2ab64e[_0xd9d9('0x31')],_0x3a279c[_0xd9d9('0x33')]));if(_0x2ab64e['query'][_0xd9d9('0x3e')]){_0x474150[_0xd9d9('0x3c')]=_['merge'](_0x474150['where'],{'$or':_[_0xd9d9('0x2b')](_0x474150[_0xd9d9('0x35')],function(_0x60b4eb){var _0x28e959={};_0x28e959[_0x60b4eb]={'$like':'%'+_0x2ab64e[_0xd9d9('0x31')][_0xd9d9('0x3e')]+'%'};return _0x28e959;})});}_0x474150=_[_0xd9d9('0x3f')]({},_0x474150,_0x2ab64e[_0xd9d9('0x45')]);return _0x2a5528[_0xd9d9('0x4e')](_0x474150);}})['then'](function(_0x5f0b16){if(_0x5f0b16){_0x4b833a=_0x5f0b16[_0xd9d9('0x44')];if(!_0x2ab64e[_0xd9d9('0x31')][_0xd9d9('0x38')](_0xd9d9('0x4d'))){_0x474150[_0xd9d9('0x1b')]=qs[_0xd9d9('0x1b')](_0x2ab64e[_0xd9d9('0x31')][_0xd9d9('0x1b')]);_0x474150[_0xd9d9('0x1d')]=qs[_0xd9d9('0x1d')](_0x2ab64e[_0xd9d9('0x31')][_0xd9d9('0x1d')]);}return _0x2a5528[_0xd9d9('0x4e')](_0x474150);}})[_0xd9d9('0x26')](function(_0x5d1919){if(_0x5d1919){return _0x5d1919?{'count':_0x4b833a,'rows':_0x5d1919}:null;}})['then'](respondWithResult(_0x3f5a0d,null))[_0xd9d9('0x49')](handleError(_0x3f5a0d,null));};exports[_0xd9d9('0x4f')]=function(_0x569d64,_0x598fff,_0x3f3457){var _0x58a711={};var _0x5bd082={};var _0x55bc7f;var _0x2cae4d;return db[_0xd9d9('0x2c')][_0xd9d9('0x4b')]({'where':{'id':_0x569d64[_0xd9d9('0x43')]['id']}})[_0xd9d9('0x26')](handleEntityNotFound(_0x598fff,null))[_0xd9d9('0x26')](function(_0x44749c){if(_0x44749c){_0x55bc7f=_0x44749c;_0x5bd082['model']=_[_0xd9d9('0x32')](db[_0xd9d9('0x4c')][_0xd9d9('0x2d')]);_0x5bd082[_0xd9d9('0x31')]=_['keys'](_0x569d64[_0xd9d9('0x31')]);_0x5bd082[_0xd9d9('0x33')]=_[_0xd9d9('0x36')](_0x5bd082[_0xd9d9('0x34')],_0x5bd082[_0xd9d9('0x31')]);_0x58a711['attributes']=_[_0xd9d9('0x36')](_0x5bd082[_0xd9d9('0x34')],qs[_0xd9d9('0x37')](_0x569d64[_0xd9d9('0x31')][_0xd9d9('0x37')]));_0x58a711[_0xd9d9('0x35')]=_0x58a711[_0xd9d9('0x35')][_0xd9d9('0x44')]?_0x58a711[_0xd9d9('0x35')]:_0x5bd082['model'];_0x58a711[_0xd9d9('0x39')]=qs[_0xd9d9('0x3a')](_0x569d64[_0xd9d9('0x31')][_0xd9d9('0x3a')]);_0x58a711[_0xd9d9('0x3c')]=qs[_0xd9d9('0x33')](_[_0xd9d9('0x3b')](_0x569d64[_0xd9d9('0x31')],_0x5bd082[_0xd9d9('0x33')]));if(_0x569d64[_0xd9d9('0x31')]['filter']){_0x58a711[_0xd9d9('0x3c')]=_['merge'](_0x58a711[_0xd9d9('0x3c')],{'$or':_[_0xd9d9('0x2b')](_0x58a711[_0xd9d9('0x35')],function(_0x3035f0){var _0x494f2c={};_0x494f2c[_0x3035f0]={'$like':'%'+_0x569d64[_0xd9d9('0x31')][_0xd9d9('0x3e')]+'%'};return _0x494f2c;})});}_0x58a711=_[_0xd9d9('0x3f')]({},_0x58a711,_0x569d64['options']);return _0x55bc7f['getDescriptions'](_0x58a711);}})[_0xd9d9('0x26')](function(_0x3cb127){if(_0x3cb127){_0x2cae4d=_0x3cb127[_0xd9d9('0x44')];if(!_0x569d64[_0xd9d9('0x31')]['hasOwnProperty'](_0xd9d9('0x4d'))){_0x58a711[_0xd9d9('0x1b')]=qs[_0xd9d9('0x1b')](_0x569d64[_0xd9d9('0x31')]['limit']);_0x58a711['offset']=qs[_0xd9d9('0x1d')](_0x569d64[_0xd9d9('0x31')][_0xd9d9('0x1d')]);}return _0x55bc7f['getDescriptions'](_0x58a711);}})[_0xd9d9('0x26')](function(_0x479834){if(_0x479834){return _0x479834?{'count':_0x2cae4d,'rows':_0x479834}:null;}})[_0xd9d9('0x26')](respondWithResult(_0x598fff,null))[_0xd9d9('0x49')](handleError(_0x598fff,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 8d538ca..06cdbe9 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7372=['moment','bluebird','path','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','../../config/logger'];(function(_0x5812b9,_0x2fa1cc){var _0xf61ef=function(_0x287489){while(--_0x287489){_0x5812b9['push'](_0x5812b9['shift']());}};_0xf61ef(++_0x2fa1cc);}(_0x7372,0x8e));var _0x2737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7372[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2737('0x0'));var util=require('util');var logger=require(_0x2737('0x1'))('api');var moment=require(_0x2737('0x2'));var BPromise=require(_0x2737('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2737('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2737('0x5'));module[_0x2737('0x6')]=function(_0x214f49,_0x32b8e6){return _0x214f49[_0x2737('0x7')](_0x2737('0x8'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f90=['rimraf','./intSalesforceConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','moment','path'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0x7f90,0xf4));var _0x07f9=function(_0x41010e,_0x25e9c5){_0x41010e=_0x41010e-0x0;var _0x59e342=_0x7f90[_0x41010e];return _0x59e342;};'use strict';var _=require(_0x07f9('0x0'));var util=require(_0x07f9('0x1'));var logger=require(_0x07f9('0x2'))(_0x07f9('0x3'));var moment=require(_0x07f9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x07f9('0x5'));var rimraf=require(_0x07f9('0x6'));var config=require('../../config/environment');var attributes=require(_0x07f9('0x7'));module[_0x07f9('0x8')]=function(_0x46f86e,_0x449544){return _0x46f86e[_0x07f9('0x9')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index a3b2125..40ee0b3 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f15=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x2030e1,_0x6f1cae){var _0x523f51=function(_0x27ac94){while(--_0x27ac94){_0x2030e1['push'](_0x2030e1['shift']());}};_0x523f51(++_0x6f1cae);}(_0x5f15,0x11d));var _0x55f1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5f15[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x55f1('0x0'));var util=require(_0x55f1('0x1'));var moment=require(_0x55f1('0x2'));var BPromise=require(_0x55f1('0x3'));var rs=require(_0x55f1('0x4'));var fs=require('fs');var Redis=require(_0x55f1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x55f1('0x6'))(_0x55f1('0x7'));var config=require(_0x55f1('0x8'));var jayson=require(_0x55f1('0x9'));var client=jayson[_0x55f1('0xa')][_0x55f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22ab1c,_0x2bbc72,_0x1ef28d){return new BPromise(function(_0x48606b,_0x351a0e){return client[_0x55f1('0xc')](_0x22ab1c,_0x1ef28d)[_0x55f1('0xd')](function(_0x4a59bb){logger[_0x55f1('0xe')](_0x55f1('0xf'),_0x2bbc72,_0x55f1('0x10'));logger[_0x55f1('0x11')](_0x55f1('0x12'),_0x2bbc72,_0x55f1('0x10'),JSON['stringify'](_0x4a59bb));if(_0x4a59bb[_0x55f1('0x13')]){if(_0x4a59bb[_0x55f1('0x13')][_0x55f1('0x14')]===0x1f4){logger[_0x55f1('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2bbc72,_0x4a59bb['error'][_0x55f1('0x15')]);return _0x351a0e(_0x4a59bb[_0x55f1('0x13')][_0x55f1('0x15')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2bbc72,_0x4a59bb[_0x55f1('0x13')][_0x55f1('0x15')]);return _0x48606b(_0x4a59bb[_0x55f1('0x13')][_0x55f1('0x15')]);}else{logger[_0x55f1('0xe')](_0x55f1('0xf'),_0x2bbc72,_0x55f1('0x10'));_0x48606b(_0x4a59bb[_0x55f1('0x16')][_0x55f1('0x15')]);}})[_0x55f1('0x17')](function(_0x4fd9b7){logger[_0x55f1('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2bbc72,_0x4fd9b7);_0x351a0e(_0x4fd9b7);});});} \ No newline at end of file +var _0xf3b4=['rpc','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x51885c,_0x2711a7){var _0x3ab453=function(_0xc9a744){while(--_0xc9a744){_0x51885c['push'](_0x51885c['shift']());}};_0x3ab453(++_0x2711a7);}(_0xf3b4,0x1c7));var _0x4f3b=function(_0x2abdd3,_0x33cb82){_0x2abdd3=_0x2abdd3-0x0;var _0x3e002e=_0xf3b4[_0x2abdd3];return _0x3e002e;};'use strict';var _=require(_0x4f3b('0x0'));var util=require(_0x4f3b('0x1'));var moment=require(_0x4f3b('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f3b('0x3'));var fs=require('fs');var Redis=require(_0x4f3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f3b('0x5'));var logger=require(_0x4f3b('0x6'))(_0x4f3b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4f3b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e62d3,_0x351d0f,_0x339f10){return new BPromise(function(_0x163768,_0x4249c7){return client[_0x4f3b('0x9')](_0x1e62d3,_0x339f10)[_0x4f3b('0xa')](function(_0x5f351d){logger[_0x4f3b('0xb')](_0x4f3b('0xc'),_0x351d0f,'request\x20sent');logger[_0x4f3b('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x351d0f,'request\x20sent',JSON[_0x4f3b('0xe')](_0x5f351d));if(_0x5f351d[_0x4f3b('0xf')]){if(_0x5f351d[_0x4f3b('0xf')][_0x4f3b('0x10')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x351d0f,_0x5f351d[_0x4f3b('0xf')][_0x4f3b('0x11')]);return _0x4249c7(_0x5f351d['error']['message']);}logger[_0x4f3b('0xf')](_0x4f3b('0xc'),_0x351d0f,_0x5f351d[_0x4f3b('0xf')][_0x4f3b('0x11')]);return _0x163768(_0x5f351d['error'][_0x4f3b('0x11')]);}else{logger[_0x4f3b('0xb')](_0x4f3b('0xc'),_0x351d0f,_0x4f3b('0x12'));_0x163768(_0x5f351d[_0x4f3b('0x13')][_0x4f3b('0x11')]);}})[_0x4f3b('0x14')](function(_0xc1cabc){logger[_0x4f3b('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x351d0f,_0xc1cabc);_0x4249c7(_0xc1cabc);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 225b3a2..0765178 100644 --- a/server/api/intSalesforceField/index.js +++ b/server/api/intSalesforceField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f09=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x4f09,0x1d2));var _0x94f0=function(_0x3f29b4,_0x2b5b02){_0x3f29b4=_0x3f29b4-0x0;var _0x4d8893=_0x4f09[_0x3f29b4];return _0x4d8893;};'use strict';var multer=require(_0x94f0('0x0'));var util=require(_0x94f0('0x1'));var path=require(_0x94f0('0x2'));var timeout=require('connect-timeout');var express=require(_0x94f0('0x3'));var router=express['Router']();var fs_extra=require(_0x94f0('0x4'));var auth=require(_0x94f0('0x5'));var interaction=require(_0x94f0('0x6'));var config=require(_0x94f0('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x94f0('0x8')]);router[_0x94f0('0x9')](_0x94f0('0xa'),auth[_0x94f0('0xb')](),controller[_0x94f0('0xc')]);router[_0x94f0('0xd')]('/',auth[_0x94f0('0xb')](),controller['create']);router[_0x94f0('0xe')](_0x94f0('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x94f0('0xf')](_0x94f0('0xa'),auth[_0x94f0('0xb')](),controller[_0x94f0('0x10')]);module[_0x94f0('0x11')]=router; \ No newline at end of file +var _0x62d8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x4ced97,_0x2c46d4){var _0x11ae41=function(_0x35d8c5){while(--_0x35d8c5){_0x4ced97['push'](_0x4ced97['shift']());}};_0x11ae41(++_0x2c46d4);}(_0x62d8,0xc7));var _0x862d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x62d8[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x862d('0x0'));var path=require(_0x862d('0x1'));var timeout=require(_0x862d('0x2'));var express=require('express');var router=express[_0x862d('0x3')]();var fs_extra=require(_0x862d('0x4'));var auth=require(_0x862d('0x5'));var interaction=require(_0x862d('0x6'));var config=require(_0x862d('0x7'));var controller=require(_0x862d('0x8'));router[_0x862d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x862d('0x9')]('/:id',auth[_0x862d('0xa')](),controller[_0x862d('0xb')]);router[_0x862d('0xc')]('/',auth[_0x862d('0xa')](),controller[_0x862d('0xd')]);router[_0x862d('0xe')](_0x862d('0xf'),auth[_0x862d('0xa')](),controller[_0x862d('0x10')]);router[_0x862d('0x11')](_0x862d('0xf'),auth['isAuthenticated'](),controller[_0x862d('0x12')]);module[_0x862d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index cd7e0b8..b7b28e4 100644 --- a/server/api/intSalesforceField/intSalesforceField.attributes.js +++ b/server/api/intSalesforceField/intSalesforceField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9484=['keyValue','string','STRING','variable','exports','ENUM','customVariable'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x9484,0x100));var _0x4948=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0x9484[_0xe4bb3d];return _0xd9e51;};'use strict';var Sequelize=require('sequelize');module[_0x4948('0x0')]={'type':{'type':Sequelize[_0x4948('0x1')]('string','variable',_0x4948('0x2'),_0x4948('0x3'),'picklist'),'defaultValue':_0x4948('0x4')},'content':{'type':Sequelize[_0x4948('0x5')]},'key':{'type':Sequelize[_0x4948('0x5')]},'keyType':{'type':Sequelize[_0x4948('0x1')](_0x4948('0x4'),_0x4948('0x6'),_0x4948('0x2'))},'keyContent':{'type':Sequelize[_0x4948('0x5')]},'idField':{'type':Sequelize[_0x4948('0x5')]},'variableName':{'type':Sequelize[_0x4948('0x5')]}}; \ No newline at end of file +var _0x0842=['string','customVariable','picklist','STRING','variable','ENUM'];(function(_0xb3e798,_0x5e982a){var _0x41dca1=function(_0x5dc573){while(--_0x5dc573){_0xb3e798['push'](_0xb3e798['shift']());}};_0x41dca1(++_0x5e982a);}(_0x0842,0x77));var _0x2084=function(_0x4acb9d,_0x28894b){_0x4acb9d=_0x4acb9d-0x0;var _0x252ccb=_0x0842[_0x4acb9d];return _0x252ccb;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2084('0x0')](_0x2084('0x1'),'variable',_0x2084('0x2'),'keyValue',_0x2084('0x3')),'defaultValue':_0x2084('0x1')},'content':{'type':Sequelize[_0x2084('0x4')]},'key':{'type':Sequelize[_0x2084('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x2084('0x1'),_0x2084('0x5'),_0x2084('0x2'))},'keyContent':{'type':Sequelize[_0x2084('0x4')]},'idField':{'type':Sequelize[_0x2084('0x4')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index cdb0dfe..cc17609 100644 --- a/server/api/intSalesforceField/intSalesforceField.controller.js +++ b/server/api/intSalesforceField/intSalesforceField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad2f=['rows','catch','show','params','find','create','body','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','type','VIRTUAL','merge','options','include','SalesforceField','findAll'];(function(_0x5d5485,_0x4a8e19){var _0x2d215f=function(_0x2cda46){while(--_0x2cda46){_0x5d5485['push'](_0x5d5485['shift']());}};_0x2d215f(++_0x4a8e19);}(_0xad2f,0x160));var _0xfad2=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xad2f[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfad2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfad2('0x1'));var moment=require('moment');var BPromise=require(_0xfad2('0x2'));var Mustache=require(_0xfad2('0x3'));var util=require(_0xfad2('0x4'));var path=require(_0xfad2('0x5'));var sox=require('sox');var csv=require(_0xfad2('0x6'));var ejs=require(_0xfad2('0x7'));var fs=require('fs');var fs_extra=require(_0xfad2('0x8'));var _=require(_0xfad2('0x9'));var squel=require('squel');var crypto=require(_0xfad2('0xa'));var jsforce=require(_0xfad2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfad2('0x6'));var querystring=require(_0xfad2('0xc'));var Papa=require('papaparse');var Redis=require(_0xfad2('0xd'));var authService=require(_0xfad2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfad2('0xf'));var hardwareService=require(_0xfad2('0x10'));var logger=require('../../config/logger')(_0xfad2('0x11'));var utils=require(_0xfad2('0x12'));var config=require(_0xfad2('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfad2('0x14'))['db'];function respondWithStatusCode(_0x107dfd,_0x5094c4){_0x5094c4=_0x5094c4||0xcc;return function(_0x264175){if(_0x264175){return _0x107dfd[_0xfad2('0x15')](_0x5094c4);}return _0x107dfd['status'](_0x5094c4)[_0xfad2('0x16')]();};}function respondWithResult(_0x3577d4,_0x440ff7){_0x440ff7=_0x440ff7||0xc8;return function(_0x5ef92d){if(_0x5ef92d){return _0x3577d4[_0xfad2('0x17')](_0x440ff7)[_0xfad2('0x18')](_0x5ef92d);}};}function respondWithFilteredResult(_0x85c55a,_0x37510d){return function(_0x5c289f){if(_0x5c289f){var _0x2e28c5=typeof _0x37510d[_0xfad2('0x19')]===_0xfad2('0x1a')&&typeof _0x37510d[_0xfad2('0x1b')]===_0xfad2('0x1a');var _0x29e726=_0x5c289f[_0xfad2('0x1c')];var _0x155f8b=_0x2e28c5?0x0:_0x37510d[_0xfad2('0x19')];var _0x186dfc=_0x2e28c5?_0x5c289f[_0xfad2('0x1c')]:_0x37510d[_0xfad2('0x19')]+_0x37510d[_0xfad2('0x1b')];var _0x14ea37;if(_0x186dfc>=_0x29e726){_0x186dfc=_0x29e726;_0x14ea37=0xc8;}else{_0x14ea37=0xce;}_0x85c55a[_0xfad2('0x17')](_0x14ea37);return _0x85c55a[_0xfad2('0x1d')]('Content-Range',_0x155f8b+'-'+_0x186dfc+'/'+_0x29e726)[_0xfad2('0x18')](_0x5c289f);}return null;};}function patchUpdates(_0x4371b3){return function(_0x3ce445){try{jsonpatch[_0xfad2('0x1e')](_0x3ce445,_0x4371b3,!![]);}catch(_0x528b12){return BPromise[_0xfad2('0x1f')](_0x528b12);}return _0x3ce445[_0xfad2('0x20')]();};}function saveUpdates(_0x470238,_0x1d0d11){return function(_0xe3e51d){if(_0xe3e51d){return _0xe3e51d[_0xfad2('0x21')](_0x470238)[_0xfad2('0x22')](function(_0x168e26){return _0x168e26;});}return null;};}function removeEntity(_0x309bb0,_0x3da555){return function(_0x6f07e0){if(_0x6f07e0){return _0x6f07e0['destroy']()[_0xfad2('0x22')](function(){_0x309bb0[_0xfad2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x531c01,_0x444a74){return function(_0x3e98ca){if(!_0x3e98ca){_0x531c01[_0xfad2('0x15')](0x194);}return _0x3e98ca;};}function handleError(_0x5c8438,_0x2a7c1e){_0x2a7c1e=_0x2a7c1e||0x1f4;return function(_0x3eacc9){logger[_0xfad2('0x23')](_0x3eacc9[_0xfad2('0x24')]);if(_0x3eacc9[_0xfad2('0x25')]){delete _0x3eacc9['name'];}_0x5c8438['status'](_0x2a7c1e)[_0xfad2('0x26')](_0x3eacc9);};}exports[_0xfad2('0x27')]=function(_0x3e77ea,_0x49d7dc){var _0x331a20={},_0x3707ea={},_0x1834d4={'count':0x0,'rows':[]};var _0x257cf0=_['map'](db['SalesforceField'][_0xfad2('0x28')],function(_0x511974){return{'name':_0x511974[_0xfad2('0x29')],'type':_0x511974['type']['key']};});_0x3707ea['model']=_[_0xfad2('0x2a')](_0x257cf0,_0xfad2('0x25'));_0x3707ea[_0xfad2('0x2b')]=_[_0xfad2('0x2c')](_0x3e77ea[_0xfad2('0x2b')]);_0x3707ea[_0xfad2('0x2d')]=_[_0xfad2('0x2e')](_0x3707ea[_0xfad2('0x2f')],_0x3707ea[_0xfad2('0x2b')]);_0x331a20[_0xfad2('0x30')]=_['intersection'](_0x3707ea[_0xfad2('0x2f')],qs[_0xfad2('0x31')](_0x3e77ea[_0xfad2('0x2b')][_0xfad2('0x31')]));_0x331a20[_0xfad2('0x30')]=_0x331a20[_0xfad2('0x30')][_0xfad2('0x32')]?_0x331a20[_0xfad2('0x30')]:_0x3707ea['model'];if(!_0x3e77ea[_0xfad2('0x2b')][_0xfad2('0x33')]('nolimit')){_0x331a20[_0xfad2('0x1b')]=qs[_0xfad2('0x1b')](_0x3e77ea[_0xfad2('0x2b')][_0xfad2('0x1b')]);_0x331a20['offset']=qs[_0xfad2('0x19')](_0x3e77ea['query'][_0xfad2('0x19')]);}_0x331a20['order']=qs['sort'](_0x3e77ea['query'][_0xfad2('0x34')]);_0x331a20[_0xfad2('0x35')]=qs[_0xfad2('0x2d')](_['pick'](_0x3e77ea['query'],_0x3707ea[_0xfad2('0x2d')]),_0x257cf0);if(_0x3e77ea[_0xfad2('0x2b')][_0xfad2('0x36')]){_0x331a20['where']=_['merge'](_0x331a20[_0xfad2('0x35')],{'$or':_[_0xfad2('0x2a')](_0x257cf0,function(_0x46be04){if(_0x46be04[_0xfad2('0x37')]!==_0xfad2('0x38')){var _0x3c83e0={};_0x3c83e0[_0x46be04[_0xfad2('0x25')]]={'$like':'%'+_0x3e77ea['query'][_0xfad2('0x36')]+'%'};return _0x3c83e0;}})});}_0x331a20=_[_0xfad2('0x39')]({},_0x331a20,_0x3e77ea[_0xfad2('0x3a')]);var _0x2e6cb6={'where':_0x331a20[_0xfad2('0x35')]};return db['SalesforceField']['count'](_0x2e6cb6)[_0xfad2('0x22')](function(_0x1fc596){_0x1834d4[_0xfad2('0x1c')]=_0x1fc596;if(_0x3e77ea[_0xfad2('0x2b')]['includeAll']){_0x331a20[_0xfad2('0x3b')]=[{'all':!![]}];}return db[_0xfad2('0x3c')][_0xfad2('0x3d')](_0x331a20);})[_0xfad2('0x22')](function(_0x14b998){_0x1834d4[_0xfad2('0x3e')]=_0x14b998;return _0x1834d4;})[_0xfad2('0x22')](respondWithFilteredResult(_0x49d7dc,_0x331a20))[_0xfad2('0x3f')](handleError(_0x49d7dc,null));};exports[_0xfad2('0x40')]=function(_0x297240,_0x4eb0ed){var _0x18b667={'raw':!![],'where':{'id':_0x297240[_0xfad2('0x41')]['id']}},_0x246c57={};_0x246c57['model']=_[_0xfad2('0x2c')](db['SalesforceField']['rawAttributes']);_0x246c57['query']=_[_0xfad2('0x2c')](_0x297240[_0xfad2('0x2b')]);_0x246c57[_0xfad2('0x2d')]=_['intersection'](_0x246c57[_0xfad2('0x2f')],_0x246c57[_0xfad2('0x2b')]);_0x18b667[_0xfad2('0x30')]=_[_0xfad2('0x2e')](_0x246c57[_0xfad2('0x2f')],qs[_0xfad2('0x31')](_0x297240[_0xfad2('0x2b')]['fields']));_0x18b667[_0xfad2('0x30')]=_0x18b667[_0xfad2('0x30')][_0xfad2('0x32')]?_0x18b667[_0xfad2('0x30')]:_0x246c57[_0xfad2('0x2f')];if(_0x297240[_0xfad2('0x2b')]['includeAll']){_0x18b667[_0xfad2('0x3b')]=[{'all':!![]}];}_0x18b667=_['merge']({},_0x18b667,_0x297240['options']);return db[_0xfad2('0x3c')][_0xfad2('0x42')](_0x18b667)[_0xfad2('0x22')](handleEntityNotFound(_0x4eb0ed,null))[_0xfad2('0x22')](respondWithResult(_0x4eb0ed,null))[_0xfad2('0x3f')](handleError(_0x4eb0ed,null));};exports[_0xfad2('0x43')]=function(_0x4c3b24,_0x58fa58){return db[_0xfad2('0x3c')][_0xfad2('0x43')](_0x4c3b24[_0xfad2('0x44')],{})[_0xfad2('0x22')](respondWithResult(_0x58fa58,0xc9))['catch'](handleError(_0x58fa58,null));};exports[_0xfad2('0x21')]=function(_0x5be95f,_0x58b90b){if(_0x5be95f['body']['id']){delete _0x5be95f['body']['id'];}return db[_0xfad2('0x3c')][_0xfad2('0x42')]({'where':{'id':_0x5be95f[_0xfad2('0x41')]['id']}})[_0xfad2('0x22')](handleEntityNotFound(_0x58b90b,null))[_0xfad2('0x22')](saveUpdates(_0x5be95f[_0xfad2('0x44')],null))[_0xfad2('0x22')](respondWithResult(_0x58b90b,null))[_0xfad2('0x3f')](handleError(_0x58b90b,null));};exports['destroy']=function(_0x3a73a5,_0x3f27a7){return db[_0xfad2('0x3c')][_0xfad2('0x42')]({'where':{'id':_0x3a73a5[_0xfad2('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f27a7,null))[_0xfad2('0x22')](removeEntity(_0x3f27a7,null))[_0xfad2('0x3f')](handleError(_0x3f27a7,null));}; \ No newline at end of file +var _0xa8da=['merge','options','includeAll','include','then','catch','show','params','SalesforceField','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL'];(function(_0x55203d,_0xe80ef8){var _0x3119fd=function(_0x39c0f5){while(--_0x39c0f5){_0x55203d['push'](_0x55203d['shift']());}};_0x3119fd(++_0xe80ef8);}(_0xa8da,0x184));var _0xaa8d=function(_0x2942af,_0x2166ac){_0x2942af=_0x2942af-0x0;var _0x2b91ea=_0xa8da[_0x2942af];return _0x2b91ea;};'use strict';var emlformat=require(_0xaa8d('0x0'));var rimraf=require(_0xaa8d('0x1'));var zipdir=require(_0xaa8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa8d('0x3'));var moment=require(_0xaa8d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa8d('0x5'));var path=require(_0xaa8d('0x6'));var sox=require('sox');var csv=require(_0xaa8d('0x7'));var ejs=require(_0xaa8d('0x8'));var fs=require('fs');var fs_extra=require(_0xaa8d('0x9'));var _=require(_0xaa8d('0xa'));var squel=require(_0xaa8d('0xb'));var crypto=require(_0xaa8d('0xc'));var jsforce=require(_0xaa8d('0xd'));var deskjs=require(_0xaa8d('0xe'));var toCsv=require(_0xaa8d('0x7'));var querystring=require(_0xaa8d('0xf'));var Papa=require(_0xaa8d('0x10'));var Redis=require(_0xaa8d('0x11'));var authService=require(_0xaa8d('0x12'));var qs=require(_0xaa8d('0x13'));var as=require(_0xaa8d('0x14'));var hardwareService=require(_0xaa8d('0x15'));var logger=require(_0xaa8d('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaa8d('0x17'));var db=require(_0xaa8d('0x18'))['db'];function respondWithStatusCode(_0x1bba6a,_0x43d89e){_0x43d89e=_0x43d89e||0xcc;return function(_0x5a3dad){if(_0x5a3dad){return _0x1bba6a['sendStatus'](_0x43d89e);}return _0x1bba6a[_0xaa8d('0x19')](_0x43d89e)[_0xaa8d('0x1a')]();};}function respondWithResult(_0xefde89,_0x26a16b){_0x26a16b=_0x26a16b||0xc8;return function(_0x5f28b0){if(_0x5f28b0){return _0xefde89[_0xaa8d('0x19')](_0x26a16b)[_0xaa8d('0x1b')](_0x5f28b0);}};}function respondWithFilteredResult(_0x43bf44,_0x4ebeba){return function(_0x3e36c8){if(_0x3e36c8){var _0x2fdc08=typeof _0x4ebeba['offset']===_0xaa8d('0x1c')&&typeof _0x4ebeba[_0xaa8d('0x1d')]===_0xaa8d('0x1c');var _0x13bdbc=_0x3e36c8[_0xaa8d('0x1e')];var _0x2e6017=_0x2fdc08?0x0:_0x4ebeba['offset'];var _0x46f74d=_0x2fdc08?_0x3e36c8[_0xaa8d('0x1e')]:_0x4ebeba[_0xaa8d('0x1f')]+_0x4ebeba[_0xaa8d('0x1d')];var _0x2d434a;if(_0x46f74d>=_0x13bdbc){_0x46f74d=_0x13bdbc;_0x2d434a=0xc8;}else{_0x2d434a=0xce;}_0x43bf44['status'](_0x2d434a);return _0x43bf44[_0xaa8d('0x20')](_0xaa8d('0x21'),_0x2e6017+'-'+_0x46f74d+'/'+_0x13bdbc)['json'](_0x3e36c8);}return null;};}function patchUpdates(_0x22c598){return function(_0x4b9fc1){try{jsonpatch['apply'](_0x4b9fc1,_0x22c598,!![]);}catch(_0x426131){return BPromise[_0xaa8d('0x22')](_0x426131);}return _0x4b9fc1[_0xaa8d('0x23')]();};}function saveUpdates(_0x51b1c0,_0x500816){return function(_0x374f7c){if(_0x374f7c){return _0x374f7c[_0xaa8d('0x24')](_0x51b1c0)['then'](function(_0x51f258){return _0x51f258;});}return null;};}function removeEntity(_0x37991f,_0x93e073){return function(_0x2dff43){if(_0x2dff43){return _0x2dff43[_0xaa8d('0x25')]()['then'](function(){_0x37991f[_0xaa8d('0x19')](0xcc)[_0xaa8d('0x1a')]();});}};}function handleEntityNotFound(_0x35883e,_0x5a5268){return function(_0x1b84c9){if(!_0x1b84c9){_0x35883e['sendStatus'](0x194);}return _0x1b84c9;};}function handleError(_0x10f197,_0x4b0e57){_0x4b0e57=_0x4b0e57||0x1f4;return function(_0x4dde46){logger[_0xaa8d('0x26')](_0x4dde46[_0xaa8d('0x27')]);if(_0x4dde46[_0xaa8d('0x28')]){delete _0x4dde46[_0xaa8d('0x28')];}_0x10f197[_0xaa8d('0x19')](_0x4b0e57)[_0xaa8d('0x29')](_0x4dde46);};}exports[_0xaa8d('0x2a')]=function(_0x2f885e,_0x2e8cdf){var _0x8ceec8={},_0x1d950d={},_0x18c947={'count':0x0,'rows':[]};var _0x13be6f=_[_0xaa8d('0x2b')](db['SalesforceField'][_0xaa8d('0x2c')],function(_0x22d49b){return{'name':_0x22d49b[_0xaa8d('0x2d')],'type':_0x22d49b[_0xaa8d('0x2e')][_0xaa8d('0x2f')]};});_0x1d950d[_0xaa8d('0x30')]=_[_0xaa8d('0x2b')](_0x13be6f,_0xaa8d('0x28'));_0x1d950d['query']=_[_0xaa8d('0x31')](_0x2f885e[_0xaa8d('0x32')]);_0x1d950d['filters']=_[_0xaa8d('0x33')](_0x1d950d['model'],_0x1d950d[_0xaa8d('0x32')]);_0x8ceec8[_0xaa8d('0x34')]=_['intersection'](_0x1d950d[_0xaa8d('0x30')],qs[_0xaa8d('0x35')](_0x2f885e['query']['fields']));_0x8ceec8['attributes']=_0x8ceec8[_0xaa8d('0x34')]['length']?_0x8ceec8[_0xaa8d('0x34')]:_0x1d950d[_0xaa8d('0x30')];if(!_0x2f885e[_0xaa8d('0x32')][_0xaa8d('0x36')]('nolimit')){_0x8ceec8[_0xaa8d('0x1d')]=qs['limit'](_0x2f885e[_0xaa8d('0x32')][_0xaa8d('0x1d')]);_0x8ceec8[_0xaa8d('0x1f')]=qs['offset'](_0x2f885e[_0xaa8d('0x32')][_0xaa8d('0x1f')]);}_0x8ceec8[_0xaa8d('0x37')]=qs[_0xaa8d('0x38')](_0x2f885e[_0xaa8d('0x32')]['sort']);_0x8ceec8[_0xaa8d('0x39')]=qs[_0xaa8d('0x3a')](_[_0xaa8d('0x3b')](_0x2f885e[_0xaa8d('0x32')],_0x1d950d[_0xaa8d('0x3a')]),_0x13be6f);if(_0x2f885e['query'][_0xaa8d('0x3c')]){_0x8ceec8[_0xaa8d('0x39')]=_['merge'](_0x8ceec8['where'],{'$or':_[_0xaa8d('0x2b')](_0x13be6f,function(_0x338c00){if(_0x338c00['type']!==_0xaa8d('0x3d')){var _0x2562f0={};_0x2562f0[_0x338c00[_0xaa8d('0x28')]]={'$like':'%'+_0x2f885e[_0xaa8d('0x32')]['filter']+'%'};return _0x2562f0;}})});}_0x8ceec8=_[_0xaa8d('0x3e')]({},_0x8ceec8,_0x2f885e[_0xaa8d('0x3f')]);var _0x511ae6={'where':_0x8ceec8[_0xaa8d('0x39')]};return db['SalesforceField']['count'](_0x511ae6)['then'](function(_0x405b71){_0x18c947['count']=_0x405b71;if(_0x2f885e[_0xaa8d('0x32')][_0xaa8d('0x40')]){_0x8ceec8[_0xaa8d('0x41')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x8ceec8);})[_0xaa8d('0x42')](function(_0x34f0b2){_0x18c947['rows']=_0x34f0b2;return _0x18c947;})['then'](respondWithFilteredResult(_0x2e8cdf,_0x8ceec8))[_0xaa8d('0x43')](handleError(_0x2e8cdf,null));};exports[_0xaa8d('0x44')]=function(_0xcf308f,_0x13d501){var _0x296c0c={'raw':!![],'where':{'id':_0xcf308f[_0xaa8d('0x45')]['id']}},_0x155470={};_0x155470[_0xaa8d('0x30')]=_[_0xaa8d('0x31')](db[_0xaa8d('0x46')][_0xaa8d('0x2c')]);_0x155470[_0xaa8d('0x32')]=_[_0xaa8d('0x31')](_0xcf308f[_0xaa8d('0x32')]);_0x155470[_0xaa8d('0x3a')]=_[_0xaa8d('0x33')](_0x155470[_0xaa8d('0x30')],_0x155470['query']);_0x296c0c[_0xaa8d('0x34')]=_[_0xaa8d('0x33')](_0x155470[_0xaa8d('0x30')],qs[_0xaa8d('0x35')](_0xcf308f[_0xaa8d('0x32')][_0xaa8d('0x35')]));_0x296c0c[_0xaa8d('0x34')]=_0x296c0c['attributes'][_0xaa8d('0x47')]?_0x296c0c[_0xaa8d('0x34')]:_0x155470['model'];if(_0xcf308f['query'][_0xaa8d('0x40')]){_0x296c0c['include']=[{'all':!![]}];}_0x296c0c=_['merge']({},_0x296c0c,_0xcf308f[_0xaa8d('0x3f')]);return db[_0xaa8d('0x46')][_0xaa8d('0x48')](_0x296c0c)[_0xaa8d('0x42')](handleEntityNotFound(_0x13d501,null))[_0xaa8d('0x42')](respondWithResult(_0x13d501,null))['catch'](handleError(_0x13d501,null));};exports[_0xaa8d('0x49')]=function(_0x2a2738,_0x2cc27f){return db[_0xaa8d('0x46')]['create'](_0x2a2738[_0xaa8d('0x4a')],{})[_0xaa8d('0x42')](respondWithResult(_0x2cc27f,0xc9))[_0xaa8d('0x43')](handleError(_0x2cc27f,null));};exports[_0xaa8d('0x24')]=function(_0x56b989,_0x5f1c13){if(_0x56b989['body']['id']){delete _0x56b989['body']['id'];}return db[_0xaa8d('0x46')][_0xaa8d('0x48')]({'where':{'id':_0x56b989[_0xaa8d('0x45')]['id']}})['then'](handleEntityNotFound(_0x5f1c13,null))[_0xaa8d('0x42')](saveUpdates(_0x56b989[_0xaa8d('0x4a')],null))['then'](respondWithResult(_0x5f1c13,null))['catch'](handleError(_0x5f1c13,null));};exports['destroy']=function(_0x3a32c7,_0x5b1c5b){return db['SalesforceField'][_0xaa8d('0x48')]({'where':{'id':_0x3a32c7[_0xaa8d('0x45')]['id']}})[_0xaa8d('0x42')](handleEntityNotFound(_0x5b1c5b,null))[_0xaa8d('0x42')](removeEntity(_0x5b1c5b,null))[_0xaa8d('0x43')](handleError(_0x5b1c5b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 8183533..150de5b 100644 --- a/server/api/intSalesforceField/intSalesforceField.model.js +++ b/server/api/intSalesforceField/intSalesforceField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda16=['request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2e3074,_0x5ad9db){var _0xc76614=function(_0x1cd130){while(--_0x1cd130){_0x2e3074['push'](_0x2e3074['shift']());}};_0xc76614(++_0x5ad9db);}(_0xda16,0x1bb));var _0x6da1=function(_0xd1ce83,_0x4199ec){_0xd1ce83=_0xd1ce83-0x0;var _0x51aabb=_0xda16[_0xd1ce83];return _0x51aabb;};'use strict';var _=require(_0x6da1('0x0'));var util=require(_0x6da1('0x1'));var logger=require(_0x6da1('0x2'))('api');var moment=require(_0x6da1('0x3'));var BPromise=require(_0x6da1('0x4'));var rp=require(_0x6da1('0x5'));var fs=require('fs');var path=require(_0x6da1('0x6'));var rimraf=require('rimraf');var config=require(_0x6da1('0x7'));var attributes=require(_0x6da1('0x8'));module[_0x6da1('0x9')]=function(_0x1c4d5d,_0x52b685){return _0x1c4d5d[_0x6da1('0xa')](_0x6da1('0xb'),attributes,{'tableName':_0x6da1('0xc'),'paranoid':![],'indexes':[{'name':_0x6da1('0xd'),'fields':[_0x6da1('0xe'),_0x6da1('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x19d0=['SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define'];(function(_0x33d239,_0x24bb87){var _0x6784c2=function(_0x2d8fb6){while(--_0x2d8fb6){_0x33d239['push'](_0x33d239['shift']());}};_0x6784c2(++_0x24bb87);}(_0x19d0,0x154));var _0x019d=function(_0x2db4d9,_0x1a4a79){_0x2db4d9=_0x2db4d9-0x0;var _0xfc9d02=_0x19d0[_0x2db4d9];return _0xfc9d02;};'use strict';var _=require(_0x019d('0x0'));var util=require(_0x019d('0x1'));var logger=require('../../config/logger')(_0x019d('0x2'));var moment=require(_0x019d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x019d('0x4'));var rimraf=require(_0x019d('0x5'));var config=require(_0x019d('0x6'));var attributes=require(_0x019d('0x7'));module[_0x019d('0x8')]=function(_0x423484,_0x46b692){return _0x423484[_0x019d('0x9')](_0x019d('0xa'),attributes,{'tableName':_0x019d('0xb'),'paranoid':![],'indexes':[{'name':_0x019d('0xc'),'fields':['idField',_0x019d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 87a9fc8..7ffb1d9 100644 --- a/server/api/intSalesforceField/intSalesforceField.rpc.js +++ b/server/api/intSalesforceField/intSalesforceField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bf0=['code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1bf0,0x65));var _0x01bf=function(_0x5f0341,_0x13f4a1){_0x5f0341=_0x5f0341-0x0;var _0x4e4249=_0x1bf0[_0x5f0341];return _0x4e4249;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x01bf('0x0'));var BPromise=require(_0x01bf('0x1'));var rs=require(_0x01bf('0x2'));var fs=require('fs');var Redis=require(_0x01bf('0x3'));var db=require(_0x01bf('0x4'))['db'];var utils=require(_0x01bf('0x5'));var logger=require(_0x01bf('0x6'))(_0x01bf('0x7'));var config=require(_0x01bf('0x8'));var jayson=require(_0x01bf('0x9'));var client=jayson[_0x01bf('0xa')][_0x01bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5964de,_0xab9ae6,_0x3f7d46){return new BPromise(function(_0x38e911,_0x24ffc8){return client[_0x01bf('0xc')](_0x5964de,_0x3f7d46)['then'](function(_0x4f0c12){logger['info'](_0x01bf('0xd'),_0xab9ae6,_0x01bf('0xe'));logger[_0x01bf('0xf')](_0x01bf('0x10'),_0xab9ae6,_0x01bf('0xe'),JSON[_0x01bf('0x11')](_0x4f0c12));if(_0x4f0c12['error']){if(_0x4f0c12[_0x01bf('0x12')][_0x01bf('0x13')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0xab9ae6,_0x4f0c12[_0x01bf('0x12')][_0x01bf('0x14')]);return _0x24ffc8(_0x4f0c12[_0x01bf('0x12')][_0x01bf('0x14')]);}logger['error'](_0x01bf('0xd'),_0xab9ae6,_0x4f0c12[_0x01bf('0x12')]['message']);return _0x38e911(_0x4f0c12['error'][_0x01bf('0x14')]);}else{logger[_0x01bf('0x15')](_0x01bf('0xd'),_0xab9ae6,_0x01bf('0xe'));_0x38e911(_0x4f0c12[_0x01bf('0x16')][_0x01bf('0x14')]);}})[_0x01bf('0x17')](function(_0x2e48cc){logger[_0x01bf('0x12')](_0x01bf('0xd'),_0xab9ae6,_0x2e48cc);_0x24ffc8(_0x2e48cc);});});} \ No newline at end of file +var _0x8971=['moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util'];(function(_0x2fc284,_0x5d271c){var _0x221234=function(_0x39fb00){while(--_0x39fb00){_0x2fc284['push'](_0x2fc284['shift']());}};_0x221234(++_0x5d271c);}(_0x8971,0x132));var _0x1897=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x8971[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x1897('0x0'));var util=require(_0x1897('0x1'));var moment=require(_0x1897('0x2'));var BPromise=require(_0x1897('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1897('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1897('0x5'))(_0x1897('0x6'));var config=require(_0x1897('0x7'));var jayson=require(_0x1897('0x8'));var client=jayson[_0x1897('0x9')][_0x1897('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4518a5,_0x1c9111,_0x1ad0c4){return new BPromise(function(_0xb50f5e,_0x223ee9){return client['request'](_0x4518a5,_0x1ad0c4)[_0x1897('0xb')](function(_0x1e6328){logger['info'](_0x1897('0xc'),_0x1c9111,_0x1897('0xd'));logger[_0x1897('0xe')](_0x1897('0xf'),_0x1c9111,'request\x20sent',JSON[_0x1897('0x10')](_0x1e6328));if(_0x1e6328['error']){if(_0x1e6328[_0x1897('0x11')]['code']===0x1f4){logger[_0x1897('0x11')](_0x1897('0xc'),_0x1c9111,_0x1e6328[_0x1897('0x11')][_0x1897('0x12')]);return _0x223ee9(_0x1e6328['error'][_0x1897('0x12')]);}logger[_0x1897('0x11')]('SalesforceField,\x20%s,\x20%s',_0x1c9111,_0x1e6328[_0x1897('0x11')]['message']);return _0xb50f5e(_0x1e6328[_0x1897('0x11')][_0x1897('0x12')]);}else{logger[_0x1897('0x13')](_0x1897('0xc'),_0x1c9111,_0x1897('0xd'));_0xb50f5e(_0x1e6328[_0x1897('0x14')][_0x1897('0x12')]);}})[_0x1897('0x15')](function(_0x79ca9d){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1c9111,_0x79ca9d);_0x223ee9(_0x79ca9d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index d66e0f5..841d79d 100644 --- a/server/api/intServicenowAccount/index.js +++ b/server/api/intServicenowAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x265e=['../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x265e,0xc7));var _0xe265=function(_0x491601,_0x3e3b30){_0x491601=_0x491601-0x0;var _0x34e309=_0x265e[_0x491601];return _0x34e309;};'use strict';var multer=require(_0xe265('0x0'));var util=require(_0xe265('0x1'));var path=require(_0xe265('0x2'));var timeout=require(_0xe265('0x3'));var express=require(_0xe265('0x4'));var router=express[_0xe265('0x5')]();var fs_extra=require(_0xe265('0x6'));var auth=require(_0xe265('0x7'));var interaction=require(_0xe265('0x8'));var config=require(_0xe265('0x9'));var controller=require(_0xe265('0xa'));router[_0xe265('0xb')]('/',auth[_0xe265('0xc')](),controller[_0xe265('0xd')]);router[_0xe265('0xb')](_0xe265('0xe'),auth['isAuthenticated'](),controller[_0xe265('0xf')]);router[_0xe265('0xb')](_0xe265('0x10'),auth['isAuthenticated'](),controller[_0xe265('0x11')]);router[_0xe265('0xb')](_0xe265('0x12'),auth['isAuthenticated'](),controller['getFields']);router[_0xe265('0x13')]('/',auth[_0xe265('0xc')](),controller[_0xe265('0x14')]);router['post'](_0xe265('0x10'),auth[_0xe265('0xc')](),controller[_0xe265('0x15')]);router[_0xe265('0x16')](_0xe265('0xe'),auth['isAuthenticated'](),controller[_0xe265('0x17')]);router['delete'](_0xe265('0xe'),auth[_0xe265('0xc')](),controller[_0xe265('0x18')]);module[_0xe265('0x19')]=router; \ No newline at end of file +var _0xdfaa=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','create','post','/:id/configurations','addConfiguration'];(function(_0x4287e9,_0x31f01c){var _0x2f8390=function(_0xb41856){while(--_0xb41856){_0x4287e9['push'](_0x4287e9['shift']());}};_0x2f8390(++_0x31f01c);}(_0xdfaa,0x14a));var _0xadfa=function(_0x41d184,_0x54df8c){_0x41d184=_0x41d184-0x0;var _0x32f782=_0xdfaa[_0x41d184];return _0x32f782;};'use strict';var multer=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var path=require(_0xadfa('0x2'));var timeout=require(_0xadfa('0x3'));var express=require(_0xadfa('0x4'));var router=express['Router']();var fs_extra=require(_0xadfa('0x5'));var auth=require(_0xadfa('0x6'));var interaction=require(_0xadfa('0x7'));var config=require(_0xadfa('0x8'));var controller=require(_0xadfa('0x9'));router[_0xadfa('0xa')]('/',auth[_0xadfa('0xb')](),controller[_0xadfa('0xc')]);router[_0xadfa('0xa')](_0xadfa('0xd'),auth[_0xadfa('0xb')](),controller[_0xadfa('0xe')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xadfa('0xa')](_0xadfa('0xf'),auth[_0xadfa('0xb')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xadfa('0x10')]);router[_0xadfa('0x11')](_0xadfa('0x12'),auth[_0xadfa('0xb')](),controller[_0xadfa('0x13')]);router[_0xadfa('0x14')](_0xadfa('0xd'),auth['isAuthenticated'](),controller[_0xadfa('0x15')]);router[_0xadfa('0x16')](_0xadfa('0xd'),auth[_0xadfa('0xb')](),controller[_0xadfa('0x17')]);module[_0xadfa('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index a348f05..0349dd8 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.attributes.js +++ b/server/api/intServicenowAccount/intServicenowAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e5c=['remoteUri','sequelize','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e5c,0xe5));var _0xc4e5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4e5c[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0xc4e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xc4e5('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc4e5('0x1')],'unique':_0xc4e5('0x2')},'password':{'type':Sequelize[_0xc4e5('0x1')]},'email':{'type':Sequelize[_0xc4e5('0x1')]},'remoteUri':{'type':Sequelize[_0xc4e5('0x1')],'unique':_0xc4e5('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa821=['username','remoteUri','sequelize','exports','STRING'];(function(_0x3c498f,_0x1a9eef){var _0x2104b8=function(_0x2d8b1a){while(--_0x2d8b1a){_0x3c498f['push'](_0x3c498f['shift']());}};_0x2104b8(++_0x1a9eef);}(_0xa821,0x151));var _0x1a82=function(_0x2a0f49,_0x413759){_0x2a0f49=_0x2a0f49-0x0;var _0x1fa51b=_0xa821[_0x2a0f49];return _0x1fa51b;};'use strict';var Sequelize=require(_0x1a82('0x0'));module[_0x1a82('0x1')]={'name':{'type':Sequelize[_0x1a82('0x2')]},'description':{'type':Sequelize[_0x1a82('0x2')]},'username':{'type':Sequelize[_0x1a82('0x2')],'unique':_0x1a82('0x3')},'password':{'type':Sequelize[_0x1a82('0x2')]},'email':{'type':Sequelize[_0x1a82('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1a82('0x4')},'serverUrl':{'type':Sequelize[_0x1a82('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index fb38aa5..c1849bd 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.controller.js +++ b/server/api/intServicenowAccount/intServicenowAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x575d=['count','offset','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','ServicenowAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','show','params','rawAttributes','include','find','catch','create','body','ServicenowConfiguration','getConfigurations','addConfiguration','findOne','Subjects','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','made_sla','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','user_input','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','assigned_to','comments','approval','comments_and_work_notes','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','assign','forEach','internalType','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','push','ServiceNow\x20error:\x20','test','statusCode','boolean','True','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','rimraf','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit'];(function(_0x3da416,_0x4ce419){var _0x2b6982=function(_0x22227c){while(--_0x22227c){_0x3da416['push'](_0x3da416['shift']());}};_0x2b6982(++_0x4ce419);}(_0x575d,0x145));var _0xd575=function(_0x50a805,_0x514091){_0x50a805=_0x50a805-0x0;var _0xb33c67=_0x575d[_0x50a805];return _0xb33c67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd575('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd575('0x1'));var rp=require('request-promise');var moment=require(_0xd575('0x2'));var BPromise=require(_0xd575('0x3'));var Mustache=require('mustache');var util=require(_0xd575('0x4'));var path=require(_0xd575('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd575('0x6'));var fs=require('fs');var fs_extra=require(_0xd575('0x7'));var _=require('lodash');var squel=require(_0xd575('0x8'));var crypto=require(_0xd575('0x9'));var jsforce=require(_0xd575('0xa'));var deskjs=require(_0xd575('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd575('0xc'));var Papa=require(_0xd575('0xd'));var Redis=require(_0xd575('0xe'));var authService=require(_0xd575('0xf'));var qs=require(_0xd575('0x10'));var as=require(_0xd575('0x11'));var hardwareService=require(_0xd575('0x12'));var logger=require(_0xd575('0x13'))(_0xd575('0x14'));var utils=require('../../config/utils');var config=require(_0xd575('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd575('0x16'))['db'];var integrations=require(_0xd575('0x17'));function respondWithStatusCode(_0x5f550e,_0x47d187){_0x47d187=_0x47d187||0xcc;return function(_0x5eef14){if(_0x5eef14){return _0x5f550e['sendStatus'](_0x47d187);}return _0x5f550e[_0xd575('0x18')](_0x47d187)[_0xd575('0x19')]();};}function respondWithResult(_0x1cb08f,_0x58cd91){_0x58cd91=_0x58cd91||0xc8;return function(_0x570050){if(_0x570050){return _0x1cb08f[_0xd575('0x18')](_0x58cd91)[_0xd575('0x1a')](_0x570050);}};}function respondWithFilteredResult(_0x5335d8,_0x32aa38){return function(_0x3f1876){if(_0x3f1876){var _0x389cc5=typeof _0x32aa38['offset']===_0xd575('0x1b')&&typeof _0x32aa38[_0xd575('0x1c')]===_0xd575('0x1b');var _0x15dc17=_0x3f1876[_0xd575('0x1d')];var _0xa48bd6=_0x389cc5?0x0:_0x32aa38['offset'];var _0x283ec1=_0x389cc5?_0x3f1876['count']:_0x32aa38[_0xd575('0x1e')]+_0x32aa38[_0xd575('0x1c')];var _0x594cc3;if(_0x283ec1>=_0x15dc17){_0x283ec1=_0x15dc17;_0x594cc3=0xc8;}else{_0x594cc3=0xce;}_0x5335d8[_0xd575('0x18')](_0x594cc3);return _0x5335d8[_0xd575('0x1f')](_0xd575('0x20'),_0xa48bd6+'-'+_0x283ec1+'/'+_0x15dc17)['json'](_0x3f1876);}return null;};}function patchUpdates(_0x5244c6){return function(_0x407a17){try{jsonpatch['apply'](_0x407a17,_0x5244c6,!![]);}catch(_0x250216){return BPromise[_0xd575('0x21')](_0x250216);}return _0x407a17[_0xd575('0x22')]();};}function saveUpdates(_0x3b9bb4,_0x3da125){return function(_0x5b00fe){if(_0x5b00fe){return _0x5b00fe[_0xd575('0x23')](_0x3b9bb4)['then'](function(_0x3524c6){return _0x3524c6;});}return null;};}function removeEntity(_0x3286d5,_0x18e739){return function(_0x50eb6a){if(_0x50eb6a){return _0x50eb6a[_0xd575('0x24')]()[_0xd575('0x25')](function(){_0x3286d5[_0xd575('0x18')](0xcc)[_0xd575('0x19')]();});}};}function handleEntityNotFound(_0xf56199,_0x4a88b1){return function(_0x37460b){if(!_0x37460b){_0xf56199[_0xd575('0x26')](0x194);}return _0x37460b;};}function handleError(_0x3a58af,_0x511b14){_0x511b14=_0x511b14||0x1f4;return function(_0x516031){logger[_0xd575('0x27')](_0x516031[_0xd575('0x28')]);if(_0x516031[_0xd575('0x29')]){delete _0x516031['name'];}_0x3a58af[_0xd575('0x18')](_0x511b14)[_0xd575('0x2a')](_0x516031);};}exports[_0xd575('0x2b')]=function(_0x108c7d,_0x50d221){var _0x472705={},_0x51ce79={},_0xdf4205={'count':0x0,'rows':[]};var _0x282e31=_[_0xd575('0x2c')](db[_0xd575('0x2d')]['rawAttributes'],function(_0x1dbb99){return{'name':_0x1dbb99[_0xd575('0x2e')],'type':_0x1dbb99['type'][_0xd575('0x2f')]};});_0x51ce79[_0xd575('0x30')]=_[_0xd575('0x2c')](_0x282e31,_0xd575('0x29'));_0x51ce79[_0xd575('0x31')]=_[_0xd575('0x32')](_0x108c7d[_0xd575('0x31')]);_0x51ce79[_0xd575('0x33')]=_[_0xd575('0x34')](_0x51ce79['model'],_0x51ce79[_0xd575('0x31')]);_0x472705[_0xd575('0x35')]=_[_0xd575('0x34')](_0x51ce79[_0xd575('0x30')],qs[_0xd575('0x36')](_0x108c7d[_0xd575('0x31')][_0xd575('0x36')]));_0x472705[_0xd575('0x35')]=_0x472705[_0xd575('0x35')][_0xd575('0x37')]?_0x472705[_0xd575('0x35')]:_0x51ce79[_0xd575('0x30')];if(!_0x108c7d[_0xd575('0x31')][_0xd575('0x38')](_0xd575('0x39'))){_0x472705[_0xd575('0x1c')]=qs['limit'](_0x108c7d[_0xd575('0x31')][_0xd575('0x1c')]);_0x472705[_0xd575('0x1e')]=qs[_0xd575('0x1e')](_0x108c7d[_0xd575('0x31')][_0xd575('0x1e')]);}_0x472705[_0xd575('0x3a')]=qs['sort'](_0x108c7d['query'][_0xd575('0x3b')]);_0x472705[_0xd575('0x3c')]=qs[_0xd575('0x33')](_[_0xd575('0x3d')](_0x108c7d['query'],_0x51ce79['filters']),_0x282e31);if(_0x108c7d[_0xd575('0x31')][_0xd575('0x3e')]){_0x472705[_0xd575('0x3c')]=_['merge'](_0x472705[_0xd575('0x3c')],{'$or':_[_0xd575('0x2c')](_0x282e31,function(_0x692e25){if(_0x692e25[_0xd575('0x3f')]!==_0xd575('0x40')){var _0x51f00e={};_0x51f00e[_0x692e25[_0xd575('0x29')]]={'$like':'%'+_0x108c7d[_0xd575('0x31')]['filter']+'%'};return _0x51f00e;}})});}_0x472705=_[_0xd575('0x41')]({},_0x472705,_0x108c7d[_0xd575('0x42')]);var _0x46abe6={'where':_0x472705[_0xd575('0x3c')]};return db[_0xd575('0x2d')][_0xd575('0x1d')](_0x46abe6)[_0xd575('0x25')](function(_0x4a9a4c){_0xdf4205[_0xd575('0x1d')]=_0x4a9a4c;if(_0x108c7d[_0xd575('0x31')][_0xd575('0x43')]){_0x472705['include']=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x472705);})['then'](function(_0x172df8){_0xdf4205['rows']=_0x172df8;return _0xdf4205;})[_0xd575('0x25')](respondWithFilteredResult(_0x50d221,_0x472705))['catch'](handleError(_0x50d221,null));};exports[_0xd575('0x44')]=function(_0xc34b58,_0x51fad4){var _0x3d7b54={'raw':![],'where':{'id':_0xc34b58[_0xd575('0x45')]['id']}},_0x85ea9d={};_0x85ea9d[_0xd575('0x30')]=_[_0xd575('0x32')](db[_0xd575('0x2d')][_0xd575('0x46')]);_0x85ea9d[_0xd575('0x31')]=_[_0xd575('0x32')](_0xc34b58[_0xd575('0x31')]);_0x85ea9d['filters']=_['intersection'](_0x85ea9d['model'],_0x85ea9d['query']);_0x3d7b54['attributes']=_[_0xd575('0x34')](_0x85ea9d[_0xd575('0x30')],qs[_0xd575('0x36')](_0xc34b58[_0xd575('0x31')][_0xd575('0x36')]));_0x3d7b54['attributes']=_0x3d7b54[_0xd575('0x35')][_0xd575('0x37')]?_0x3d7b54[_0xd575('0x35')]:_0x85ea9d[_0xd575('0x30')];if(_0xc34b58[_0xd575('0x31')]['includeAll']){_0x3d7b54[_0xd575('0x47')]=[{'all':!![]}];}_0x3d7b54=_[_0xd575('0x41')]({},_0x3d7b54,_0xc34b58[_0xd575('0x42')]);return db['ServicenowAccount'][_0xd575('0x48')](_0x3d7b54)['then'](handleEntityNotFound(_0x51fad4,null))[_0xd575('0x25')](respondWithResult(_0x51fad4,null))[_0xd575('0x49')](handleError(_0x51fad4,null));};exports[_0xd575('0x4a')]=function(_0x5f1091,_0x5de939){return db[_0xd575('0x2d')]['create'](_0x5f1091[_0xd575('0x4b')],{})['then'](respondWithResult(_0x5de939,0xc9))[_0xd575('0x49')](handleError(_0x5de939,null));};exports['update']=function(_0x12896c,_0x40c8c7){if(_0x12896c[_0xd575('0x4b')]['id']){delete _0x12896c[_0xd575('0x4b')]['id'];}return db['ServicenowAccount'][_0xd575('0x48')]({'where':{'id':_0x12896c[_0xd575('0x45')]['id']}})[_0xd575('0x25')](handleEntityNotFound(_0x40c8c7,null))[_0xd575('0x25')](saveUpdates(_0x12896c[_0xd575('0x4b')],null))['then'](respondWithResult(_0x40c8c7,null))['catch'](handleError(_0x40c8c7,null));};exports[_0xd575('0x24')]=function(_0x3c1f31,_0x5908a2){return db[_0xd575('0x2d')][_0xd575('0x48')]({'where':{'id':_0x3c1f31[_0xd575('0x45')]['id']}})[_0xd575('0x25')](handleEntityNotFound(_0x5908a2,null))[_0xd575('0x25')](removeEntity(_0x5908a2,null))['catch'](handleError(_0x5908a2,null));};exports['getConfigurations']=function(_0x14cf60,_0x2b45c2,_0x25ed2d){var _0x40430c={};var _0x53c2d5={};var _0x49cbb4;var _0x28d207;return db[_0xd575('0x2d')]['findOne']({'where':{'id':_0x14cf60[_0xd575('0x45')]['id']}})[_0xd575('0x25')](handleEntityNotFound(_0x2b45c2,null))['then'](function(_0x461321){if(_0x461321){_0x49cbb4=_0x461321;_0x53c2d5['model']=_[_0xd575('0x32')](db[_0xd575('0x4c')][_0xd575('0x46')]);_0x53c2d5[_0xd575('0x31')]=_[_0xd575('0x32')](_0x14cf60[_0xd575('0x31')]);_0x53c2d5[_0xd575('0x33')]=_[_0xd575('0x34')](_0x53c2d5[_0xd575('0x30')],_0x53c2d5[_0xd575('0x31')]);_0x40430c[_0xd575('0x35')]=_[_0xd575('0x34')](_0x53c2d5[_0xd575('0x30')],qs['fields'](_0x14cf60[_0xd575('0x31')][_0xd575('0x36')]));_0x40430c[_0xd575('0x35')]=_0x40430c[_0xd575('0x35')][_0xd575('0x37')]?_0x40430c[_0xd575('0x35')]:_0x53c2d5[_0xd575('0x30')];_0x40430c[_0xd575('0x3a')]=qs[_0xd575('0x3b')](_0x14cf60[_0xd575('0x31')]['sort']);_0x40430c[_0xd575('0x3c')]=qs[_0xd575('0x33')](_[_0xd575('0x3d')](_0x14cf60[_0xd575('0x31')],_0x53c2d5[_0xd575('0x33')]));if(_0x14cf60[_0xd575('0x31')][_0xd575('0x3e')]){_0x40430c[_0xd575('0x3c')]=_['merge'](_0x40430c[_0xd575('0x3c')],{'$or':_[_0xd575('0x2c')](_0x40430c[_0xd575('0x35')],function(_0x37879b){var _0x35b0ed={};_0x35b0ed[_0x37879b]={'$like':'%'+_0x14cf60[_0xd575('0x31')][_0xd575('0x3e')]+'%'};return _0x35b0ed;})});}_0x40430c=_[_0xd575('0x41')]({},_0x40430c,_0x14cf60[_0xd575('0x42')]);return _0x49cbb4[_0xd575('0x4d')](_0x40430c);}})['then'](function(_0x5738a5){if(_0x5738a5){_0x28d207=_0x5738a5[_0xd575('0x37')];if(!_0x14cf60[_0xd575('0x31')][_0xd575('0x38')](_0xd575('0x39'))){_0x40430c[_0xd575('0x1c')]=qs['limit'](_0x14cf60[_0xd575('0x31')][_0xd575('0x1c')]);_0x40430c[_0xd575('0x1e')]=qs[_0xd575('0x1e')](_0x14cf60[_0xd575('0x31')][_0xd575('0x1e')]);}return _0x49cbb4[_0xd575('0x4d')](_0x40430c);}})['then'](function(_0xc526b9){if(_0xc526b9){return _0xc526b9?{'count':_0x28d207,'rows':_0xc526b9}:null;}})[_0xd575('0x25')](respondWithResult(_0x2b45c2,null))['catch'](handleError(_0x2b45c2,null));};exports[_0xd575('0x4e')]=function(_0x5759f4,_0x2a59e2,_0x159335){if(_0x5759f4['body']['id']){delete _0x5759f4[_0xd575('0x4b')]['id'];}return db[_0xd575('0x2d')][_0xd575('0x4f')]({'where':{'id':_0x5759f4['params']['id']}})['then'](handleEntityNotFound(_0x2a59e2,null))[_0xd575('0x25')](function(_0x51b53b){if(_0x51b53b){_0x5759f4['body']['AccountId']=_0x51b53b['id'];_0x5759f4[_0xd575('0x4b')][_0xd575('0x50')]=integrations['getSubjects'](_0x5759f4['body']['channel'],_0x5759f4[_0xd575('0x4b')][_0xd575('0x3f')]);_0x5759f4[_0xd575('0x4b')][_0xd575('0x51')]=integrations[_0xd575('0x52')](_0x5759f4['body']['channel'],_0x5759f4[_0xd575('0x4b')][_0xd575('0x3f')]);return db[_0xd575('0x4c')]['create'](_0x5759f4[_0xd575('0x4b')],{'include':[{'model':db[_0xd575('0x53')],'as':_0xd575('0x50')},{'model':db[_0xd575('0x53')],'as':_0xd575('0x51')}]});}return null;})[_0xd575('0x25')](respondWithResult(_0x2a59e2,null))[_0xd575('0x49')](handleError(_0x2a59e2,null));};exports[_0xd575('0x54')]=function(_0x514e06,_0x133387,_0x7f54b7){var _0x908430=['made_sla',_0xd575('0x55'),_0xd575('0x56'),_0xd575('0x57'),_0xd575('0x58'),_0xd575('0x59'),_0xd575('0x5a'),_0xd575('0x5b'),_0xd575('0x5c')];var _0x527c8c=['parent',_0xd575('0x5d'),'caused_by','watch_list',_0xd575('0x5e'),_0xd575('0x5f'),_0xd575('0x60'),_0xd575('0x55'),_0xd575('0x61'),'number',_0xd575('0x62'),'sys_updated_by','opened_by',_0xd575('0x63'),'sys_created_on',_0xd575('0x64'),_0xd575('0x65'),_0xd575('0x66'),'knowledge',_0xd575('0x3a'),_0xd575('0x67'),'closed_at',_0xd575('0x68'),'delivery_plan','impact',_0xd575('0x69'),_0xd575('0x6a'),_0xd575('0x6b'),_0xd575('0x6c'),_0xd575('0x6d'),'rfc',_0xd575('0x6e'),_0xd575('0x6f'),_0xd575('0x70'),_0xd575('0x71'),_0xd575('0x72'),_0xd575('0x73'),_0xd575('0x74'),_0xd575('0x75'),_0xd575('0x76'),'approval_set',_0xd575('0x57'),_0xd575('0x77'),_0xd575('0x78'),'close_code','correlation_display',_0xd575('0x79'),_0xd575('0x7a'),_0xd575('0x7b'),_0xd575('0x7c'),_0xd575('0x7d'),_0xd575('0x7e'),'calendar_duration',_0xd575('0x59'),_0xd575('0x7f'),_0xd575('0x80'),_0xd575('0x81'),_0xd575('0x82'),_0xd575('0x83'),_0xd575('0x84'),_0xd575('0x85'),_0xd575('0x86'),'incident_state',_0xd575('0x87'),_0xd575('0x88'),'company',_0xd575('0x89'),'activity_due',_0xd575('0x8a'),_0xd575('0x5b'),_0xd575('0x8b'),'sla_due',_0xd575('0x8c'),_0xd575('0x8d'),'due_date',_0xd575('0x8e'),_0xd575('0x8f'),'sys_tags',_0xd575('0x90'),_0xd575('0x91'),_0xd575('0x92'),_0xd575('0x93'),'category'];var _0x282fde='';var _0x51977e='';var _0x470e22=[];var _0x37719a='';var _0x4e8a00='';var _0x3fb52c=[];var _0x5b2afc='';var _0x5a4088='';var _0x17834e={};var _0x47b520='';return db[_0xd575('0x2d')][_0xd575('0x4f')]({'where':{'id':_0x514e06['params']['id']},'attributes':['id',_0xd575('0x94'),_0xd575('0x95'),_0xd575('0x96'),_0xd575('0x97'),'serverUrl']})[_0xd575('0x25')](handleEntityNotFound(_0x133387,null))['then'](function(_0x1f285b){if(_0x1f285b){_0x47b520=_0x1f285b[_0xd575('0x97')];var _0x441a8d=_0x47b520['slice'](-0x1);if(_0x441a8d==='/'){_0x47b520=_0x47b520['substring'](0x0,_0x47b520[_0xd575('0x98')](_0x441a8d));}_0x5a4088=util[_0xd575('0x99')](_0xd575('0x9a'),_0x47b520);_0x5b2afc=util[_0xd575('0x99')]('%s/api/now/table/',_0x47b520);_0x17834e={'user':_0x1f285b[_0xd575('0x94')],'pass':_0x1f285b[_0xd575('0x95')]};var _0x141961={'method':_0xd575('0x9b'),'uri':_0x5a4088+_0xd575('0x9c'),'auth':_0x17834e,'json':!![]};return rp(_0x141961);}})[_0xd575('0x25')](function(_0x239605){if(_0x239605[_0xd575('0x9d')][_0xd575('0x37')]>0x0){_0x282fde=_0x239605[_0xd575('0x9d')];}console[_0xd575('0x9e')]('incident\x20table\x20objects',_0x282fde);_0x3fb52c=[];_0x51977e=Object[_0xd575('0x9f')]([],_0x282fde);_['remove'](_0x51977e,function(_0x137228){return!_0x908430['includes'](_0x137228[_0xd575('0x29')]);});_0x51977e[_0xd575('0xa0')](function(_0x3a22d4){var _0x343b90=createFieldObject(_0x5b2afc,_0x17834e,_0x3a22d4[_0xd575('0xa1')],_0x3a22d4[_0xd575('0x29')],_0x3a22d4['label'],![]);_0x3fb52c['push'](_0x343b90);});return Promise[_0xd575('0xa2')](_0x3fb52c);})[_0xd575('0x25')](function(_0xc71f15){_0x470e22=_0xc71f15;_0x37719a=Object['assign']([],_0x282fde);console[_0xd575('0x9e')](_0xd575('0xa3'),_0x282fde);_[_0xd575('0xa4')](_0x37719a,function(_0x24b099){return _0x527c8c['includes'](_0x24b099['name']);});console['log'](_0xd575('0xa5'),_0x37719a);_0x3fb52c=[];_0x37719a[_0xd575('0xa0')](function(_0x4d8abf){var _0x3ad1e7=createFieldObject(_0x5b2afc,_0x17834e,_0x4d8abf[_0xd575('0xa1')],_0x4d8abf[_0xd575('0x29')],_0x4d8abf[_0xd575('0xa6')],!![]);_0x3fb52c[_0xd575('0xa7')](_0x3ad1e7);});return Promise[_0xd575('0xa2')](_0x3fb52c);})['then'](function(_0x33be54){_0x4e8a00=_0x33be54;var _0x5d4860=_0x470e22['concat'](_0x4e8a00);return{'count':_0x5d4860[_0xd575('0x37')],'rows':_0x5d4860};})[_0xd575('0x25')](respondWithResult(_0x133387,null))['catch'](function(_0x13e61c){console['log'](_0xd575('0xa8')+_0x13e61c);var _0x476867=_0x514e06['query'][_0xd575('0xa9')]?0x1f4:_0x13e61c[_0xd575('0xaa')]||0x1f4;logger[_0xd575('0x27')](_0x13e61c[_0xd575('0x28')]);delete _0x13e61c[_0xd575('0x29')];if(_0x476867===0x191){_0x476867=0x190;}_0x133387[_0xd575('0x18')](_0x476867)[_0xd575('0x2a')](_0x514e06[_0xd575('0x31')][_0xd575('0xa9')]?{'message':'Wrong\x20credentials','statusCode':_0x13e61c[_0xd575('0xaa')]}:_0x13e61c);});};function createFieldObject(_0x38dbc3,_0x1ffe9e,_0x59d0a3,_0x5d4cb1,_0x4fc64f,_0x56fe16){return new Promise(function(_0x4f9b17,_0x3067fd){var _0x235b1b={'id':_0x5d4cb1,'name':_0x4fc64f,'custom':_0x56fe16};if(_0x59d0a3===_0xd575('0xab')){_0x235b1b[_0xd575('0x42')]=[{'name':_0xd575('0xac'),'value':'true'},{'name':'False','value':'false'}];_0x4f9b17(_0x235b1b);}else{var _0x4af8b2={'method':_0xd575('0x9b'),'uri':_0x38dbc3+_0xd575('0xad')+_0x5d4cb1,'auth':_0x1ffe9e,'json':!![]};return rp(_0x4af8b2)[_0xd575('0x25')](function(_0x1e6b85){var _0x139ac9=[];if(_0x1e6b85[_0xd575('0x9d')][_0xd575('0x37')]>0x0){_0x1e6b85[_0xd575('0x9d')][_0xd575('0xa0')](function(_0x1aff34){if(_0x1aff34[_0xd575('0xae')]===_0xd575('0xaf')){var _0x446f3c={'name':_0x1aff34[_0xd575('0xa6')],'value':_0x1aff34[_0xd575('0xb0')]};_0x139ac9[_0xd575('0xa7')](_0x446f3c);}});}_0x235b1b[_0xd575('0x42')]=_0x139ac9;if(_0x235b1b['options'][_0xd575('0x37')]>0x0){_0x4f9b17(_0x235b1b);}else{if(_0x56fe16==![]){_0x4f9b17();}else{_0x4f9b17(_0x235b1b);}}});}});} \ No newline at end of file +var _0xc598=['slice','substring','lastIndexOf','format','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','options','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','number','resolved_by','opened_by','sys_created_on','sys_domain','sys_created_by','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','username','email','serverUrl'];(function(_0x23db26,_0x5083b0){var _0x7d47a9=function(_0x443e16){while(--_0x443e16){_0x23db26['push'](_0x23db26['shift']());}};_0x7d47a9(++_0x5083b0);}(_0xc598,0xcf));var _0x8c59=function(_0x3ba5ba,_0x3131a){_0x3ba5ba=_0x3ba5ba-0x0;var _0x5a204a=_0xc598[_0x3ba5ba];return _0x5a204a;};'use strict';var emlformat=require(_0x8c59('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8c59('0x1'));var moment=require('moment');var BPromise=require(_0x8c59('0x2'));var Mustache=require(_0x8c59('0x3'));var util=require(_0x8c59('0x4'));var path=require(_0x8c59('0x5'));var sox=require('sox');var csv=require(_0x8c59('0x6'));var ejs=require(_0x8c59('0x7'));var fs=require('fs');var fs_extra=require(_0x8c59('0x8'));var _=require(_0x8c59('0x9'));var squel=require(_0x8c59('0xa'));var crypto=require(_0x8c59('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8c59('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8c59('0xd'));var Papa=require(_0x8c59('0xe'));var Redis=require('ioredis');var authService=require(_0x8c59('0xf'));var qs=require(_0x8c59('0x10'));var as=require(_0x8c59('0x11'));var hardwareService=require(_0x8c59('0x12'));var logger=require('../../config/logger')(_0x8c59('0x13'));var utils=require(_0x8c59('0x14'));var config=require(_0x8c59('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c59('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16754a,_0x487f2b){_0x487f2b=_0x487f2b||0xcc;return function(_0x553c65){if(_0x553c65){return _0x16754a[_0x8c59('0x17')](_0x487f2b);}return _0x16754a['status'](_0x487f2b)['end']();};}function respondWithResult(_0x14b5e5,_0x52f5f2){_0x52f5f2=_0x52f5f2||0xc8;return function(_0x1d2cbd){if(_0x1d2cbd){return _0x14b5e5[_0x8c59('0x18')](_0x52f5f2)[_0x8c59('0x19')](_0x1d2cbd);}};}function respondWithFilteredResult(_0x317387,_0x1d73d9){return function(_0x2aa59b){if(_0x2aa59b){var _0x29c68c=typeof _0x1d73d9['offset']===_0x8c59('0x1a')&&typeof _0x1d73d9[_0x8c59('0x1b')]==='undefined';var _0x4b3565=_0x2aa59b[_0x8c59('0x1c')];var _0x1c7739=_0x29c68c?0x0:_0x1d73d9[_0x8c59('0x1d')];var _0x380b24=_0x29c68c?_0x2aa59b['count']:_0x1d73d9[_0x8c59('0x1d')]+_0x1d73d9[_0x8c59('0x1b')];var _0x17e8a7;if(_0x380b24>=_0x4b3565){_0x380b24=_0x4b3565;_0x17e8a7=0xc8;}else{_0x17e8a7=0xce;}_0x317387['status'](_0x17e8a7);return _0x317387['set'](_0x8c59('0x1e'),_0x1c7739+'-'+_0x380b24+'/'+_0x4b3565)[_0x8c59('0x19')](_0x2aa59b);}return null;};}function patchUpdates(_0x1b3ba2){return function(_0x329978){try{jsonpatch[_0x8c59('0x1f')](_0x329978,_0x1b3ba2,!![]);}catch(_0x5f0621){return BPromise[_0x8c59('0x20')](_0x5f0621);}return _0x329978[_0x8c59('0x21')]();};}function saveUpdates(_0x59efbc,_0x5e2e81){return function(_0x4c8760){if(_0x4c8760){return _0x4c8760[_0x8c59('0x22')](_0x59efbc)[_0x8c59('0x23')](function(_0x7b3e10){return _0x7b3e10;});}return null;};}function removeEntity(_0x3aced2,_0x3b2a78){return function(_0x85736f){if(_0x85736f){return _0x85736f['destroy']()['then'](function(){_0x3aced2[_0x8c59('0x18')](0xcc)[_0x8c59('0x24')]();});}};}function handleEntityNotFound(_0x47629e,_0x43f712){return function(_0x56abc5){if(!_0x56abc5){_0x47629e[_0x8c59('0x17')](0x194);}return _0x56abc5;};}function handleError(_0x141367,_0x1362c8){_0x1362c8=_0x1362c8||0x1f4;return function(_0x18a76d){logger[_0x8c59('0x25')](_0x18a76d[_0x8c59('0x26')]);if(_0x18a76d['name']){delete _0x18a76d[_0x8c59('0x27')];}_0x141367[_0x8c59('0x18')](_0x1362c8)[_0x8c59('0x28')](_0x18a76d);};}exports['index']=function(_0x33eaab,_0x160fc1){var _0x1aef9a={},_0x46554b={},_0x5c4db4={'count':0x0,'rows':[]};var _0x2f0756=_[_0x8c59('0x29')](db[_0x8c59('0x2a')][_0x8c59('0x2b')],function(_0x2d802e){return{'name':_0x2d802e[_0x8c59('0x2c')],'type':_0x2d802e[_0x8c59('0x2d')][_0x8c59('0x2e')]};});_0x46554b[_0x8c59('0x2f')]=_[_0x8c59('0x29')](_0x2f0756,_0x8c59('0x27'));_0x46554b[_0x8c59('0x30')]=_[_0x8c59('0x31')](_0x33eaab[_0x8c59('0x30')]);_0x46554b[_0x8c59('0x32')]=_[_0x8c59('0x33')](_0x46554b[_0x8c59('0x2f')],_0x46554b[_0x8c59('0x30')]);_0x1aef9a['attributes']=_['intersection'](_0x46554b[_0x8c59('0x2f')],qs['fields'](_0x33eaab[_0x8c59('0x30')][_0x8c59('0x34')]));_0x1aef9a['attributes']=_0x1aef9a[_0x8c59('0x35')][_0x8c59('0x36')]?_0x1aef9a[_0x8c59('0x35')]:_0x46554b['model'];if(!_0x33eaab['query'][_0x8c59('0x37')](_0x8c59('0x38'))){_0x1aef9a['limit']=qs[_0x8c59('0x1b')](_0x33eaab['query'][_0x8c59('0x1b')]);_0x1aef9a[_0x8c59('0x1d')]=qs['offset'](_0x33eaab[_0x8c59('0x30')][_0x8c59('0x1d')]);}_0x1aef9a[_0x8c59('0x39')]=qs[_0x8c59('0x3a')](_0x33eaab[_0x8c59('0x30')][_0x8c59('0x3a')]);_0x1aef9a[_0x8c59('0x3b')]=qs['filters'](_['pick'](_0x33eaab[_0x8c59('0x30')],_0x46554b[_0x8c59('0x32')]),_0x2f0756);if(_0x33eaab[_0x8c59('0x30')]['filter']){_0x1aef9a[_0x8c59('0x3b')]=_['merge'](_0x1aef9a[_0x8c59('0x3b')],{'$or':_[_0x8c59('0x29')](_0x2f0756,function(_0x2dfc1e){if(_0x2dfc1e[_0x8c59('0x2d')]!==_0x8c59('0x3c')){var _0x240609={};_0x240609[_0x2dfc1e[_0x8c59('0x27')]]={'$like':'%'+_0x33eaab[_0x8c59('0x30')][_0x8c59('0x3d')]+'%'};return _0x240609;}})});}_0x1aef9a=_[_0x8c59('0x3e')]({},_0x1aef9a,_0x33eaab['options']);var _0x5cbfc6={'where':_0x1aef9a['where']};return db[_0x8c59('0x2a')]['count'](_0x5cbfc6)[_0x8c59('0x23')](function(_0x4693b8){_0x5c4db4[_0x8c59('0x1c')]=_0x4693b8;if(_0x33eaab['query'][_0x8c59('0x3f')]){_0x1aef9a[_0x8c59('0x40')]=[{'all':!![]}];}return db[_0x8c59('0x2a')][_0x8c59('0x41')](_0x1aef9a);})['then'](function(_0x287ee9){_0x5c4db4['rows']=_0x287ee9;return _0x5c4db4;})['then'](respondWithFilteredResult(_0x160fc1,_0x1aef9a))[_0x8c59('0x42')](handleError(_0x160fc1,null));};exports[_0x8c59('0x43')]=function(_0x356bd3,_0x52512b){var _0x32de96={'raw':![],'where':{'id':_0x356bd3[_0x8c59('0x44')]['id']}},_0x3c8f93={};_0x3c8f93[_0x8c59('0x2f')]=_[_0x8c59('0x31')](db['ServicenowAccount'][_0x8c59('0x2b')]);_0x3c8f93[_0x8c59('0x30')]=_['keys'](_0x356bd3['query']);_0x3c8f93[_0x8c59('0x32')]=_['intersection'](_0x3c8f93['model'],_0x3c8f93[_0x8c59('0x30')]);_0x32de96['attributes']=_[_0x8c59('0x33')](_0x3c8f93[_0x8c59('0x2f')],qs[_0x8c59('0x34')](_0x356bd3['query'][_0x8c59('0x34')]));_0x32de96[_0x8c59('0x35')]=_0x32de96['attributes'][_0x8c59('0x36')]?_0x32de96[_0x8c59('0x35')]:_0x3c8f93[_0x8c59('0x2f')];if(_0x356bd3['query'][_0x8c59('0x3f')]){_0x32de96[_0x8c59('0x40')]=[{'all':!![]}];}_0x32de96=_[_0x8c59('0x3e')]({},_0x32de96,_0x356bd3['options']);return db[_0x8c59('0x2a')][_0x8c59('0x45')](_0x32de96)['then'](handleEntityNotFound(_0x52512b,null))[_0x8c59('0x23')](respondWithResult(_0x52512b,null))[_0x8c59('0x42')](handleError(_0x52512b,null));};exports[_0x8c59('0x46')]=function(_0x4dd053,_0x10df0f){return db['ServicenowAccount'][_0x8c59('0x46')](_0x4dd053[_0x8c59('0x47')],{})['then'](respondWithResult(_0x10df0f,0xc9))['catch'](handleError(_0x10df0f,null));};exports[_0x8c59('0x22')]=function(_0x5b7e4b,_0x2ef7b1){if(_0x5b7e4b['body']['id']){delete _0x5b7e4b[_0x8c59('0x47')]['id'];}return db[_0x8c59('0x2a')][_0x8c59('0x45')]({'where':{'id':_0x5b7e4b[_0x8c59('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ef7b1,null))['then'](saveUpdates(_0x5b7e4b[_0x8c59('0x47')],null))['then'](respondWithResult(_0x2ef7b1,null))[_0x8c59('0x42')](handleError(_0x2ef7b1,null));};exports[_0x8c59('0x48')]=function(_0x12360c,_0x16b807){return db['ServicenowAccount'][_0x8c59('0x45')]({'where':{'id':_0x12360c[_0x8c59('0x44')]['id']}})['then'](handleEntityNotFound(_0x16b807,null))[_0x8c59('0x23')](removeEntity(_0x16b807,null))[_0x8c59('0x42')](handleError(_0x16b807,null));};exports[_0x8c59('0x49')]=function(_0x3cee27,_0x6ad0c5,_0x110d0c){var _0x5da212={};var _0x354f12={};var _0x5239ca;var _0x300d25;return db[_0x8c59('0x2a')][_0x8c59('0x4a')]({'where':{'id':_0x3cee27['params']['id']}})[_0x8c59('0x23')](handleEntityNotFound(_0x6ad0c5,null))[_0x8c59('0x23')](function(_0x102b89){if(_0x102b89){_0x5239ca=_0x102b89;_0x354f12[_0x8c59('0x2f')]=_[_0x8c59('0x31')](db[_0x8c59('0x4b')][_0x8c59('0x2b')]);_0x354f12[_0x8c59('0x30')]=_['keys'](_0x3cee27[_0x8c59('0x30')]);_0x354f12[_0x8c59('0x32')]=_[_0x8c59('0x33')](_0x354f12['model'],_0x354f12[_0x8c59('0x30')]);_0x5da212[_0x8c59('0x35')]=_['intersection'](_0x354f12[_0x8c59('0x2f')],qs[_0x8c59('0x34')](_0x3cee27[_0x8c59('0x30')][_0x8c59('0x34')]));_0x5da212[_0x8c59('0x35')]=_0x5da212[_0x8c59('0x35')][_0x8c59('0x36')]?_0x5da212[_0x8c59('0x35')]:_0x354f12['model'];_0x5da212[_0x8c59('0x39')]=qs['sort'](_0x3cee27[_0x8c59('0x30')][_0x8c59('0x3a')]);_0x5da212[_0x8c59('0x3b')]=qs[_0x8c59('0x32')](_[_0x8c59('0x4c')](_0x3cee27[_0x8c59('0x30')],_0x354f12['filters']));if(_0x3cee27[_0x8c59('0x30')][_0x8c59('0x3d')]){_0x5da212['where']=_[_0x8c59('0x3e')](_0x5da212[_0x8c59('0x3b')],{'$or':_[_0x8c59('0x29')](_0x5da212[_0x8c59('0x35')],function(_0x5744ff){var _0x51a135={};_0x51a135[_0x5744ff]={'$like':'%'+_0x3cee27['query'][_0x8c59('0x3d')]+'%'};return _0x51a135;})});}_0x5da212=_[_0x8c59('0x3e')]({},_0x5da212,_0x3cee27[_0x8c59('0x4d')]);return _0x5239ca['getConfigurations'](_0x5da212);}})[_0x8c59('0x23')](function(_0x388406){if(_0x388406){_0x300d25=_0x388406['length'];if(!_0x3cee27[_0x8c59('0x30')]['hasOwnProperty']('nolimit')){_0x5da212[_0x8c59('0x1b')]=qs[_0x8c59('0x1b')](_0x3cee27['query']['limit']);_0x5da212[_0x8c59('0x1d')]=qs[_0x8c59('0x1d')](_0x3cee27['query'][_0x8c59('0x1d')]);}return _0x5239ca[_0x8c59('0x49')](_0x5da212);}})[_0x8c59('0x23')](function(_0x29c342){if(_0x29c342){return _0x29c342?{'count':_0x300d25,'rows':_0x29c342}:null;}})['then'](respondWithResult(_0x6ad0c5,null))['catch'](handleError(_0x6ad0c5,null));};exports[_0x8c59('0x4e')]=function(_0x556d96,_0x16fac5,_0x459156){if(_0x556d96[_0x8c59('0x47')]['id']){delete _0x556d96[_0x8c59('0x47')]['id'];}return db[_0x8c59('0x2a')][_0x8c59('0x4a')]({'where':{'id':_0x556d96[_0x8c59('0x44')]['id']}})[_0x8c59('0x23')](handleEntityNotFound(_0x16fac5,null))[_0x8c59('0x23')](function(_0x446a17){if(_0x446a17){_0x556d96[_0x8c59('0x47')]['AccountId']=_0x446a17['id'];_0x556d96['body'][_0x8c59('0x4f')]=integrations[_0x8c59('0x50')](_0x556d96[_0x8c59('0x47')][_0x8c59('0x51')],_0x556d96['body'][_0x8c59('0x2d')]);_0x556d96[_0x8c59('0x47')]['Descriptions']=integrations[_0x8c59('0x52')](_0x556d96['body'][_0x8c59('0x51')],_0x556d96['body'][_0x8c59('0x2d')]);return db[_0x8c59('0x4b')][_0x8c59('0x46')](_0x556d96[_0x8c59('0x47')],{'include':[{'model':db[_0x8c59('0x53')],'as':_0x8c59('0x4f')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x8c59('0x23')](respondWithResult(_0x16fac5,null))[_0x8c59('0x42')](handleError(_0x16fac5,null));};exports[_0x8c59('0x54')]=function(_0x2b510a,_0x3c6738,_0x2065ab){var _0xb00f06=[_0x8c59('0x55'),_0x8c59('0x56'),_0x8c59('0x57'),_0x8c59('0x58'),_0x8c59('0x59'),_0x8c59('0x5a'),_0x8c59('0x5b'),_0x8c59('0x5c'),_0x8c59('0x5d')];var _0x2a8e5d=[_0x8c59('0x5e'),_0x8c59('0x55'),_0x8c59('0x5f'),_0x8c59('0x60'),'upon_reject',_0x8c59('0x61'),'child_incidents','hold_reason','approval_history',_0x8c59('0x62'),_0x8c59('0x63'),'sys_updated_by',_0x8c59('0x64'),'user_input',_0x8c59('0x65'),_0x8c59('0x66'),'state',_0x8c59('0x67'),_0x8c59('0x57'),'order','calendar_stc','closed_at',_0x8c59('0x68'),_0x8c59('0x69'),'impact',_0x8c59('0x6a'),_0x8c59('0x6b'),_0x8c59('0x6c'),_0x8c59('0x6d'),_0x8c59('0x6e'),_0x8c59('0x6f'),_0x8c59('0x70'),_0x8c59('0x71'),_0x8c59('0x72'),'business_duration','group_list','work_end','reopened_time','resolved_at',_0x8c59('0x73'),_0x8c59('0x74'),'subcategory',_0x8c59('0x75'),_0x8c59('0x76'),_0x8c59('0x59'),_0x8c59('0x77'),_0x8c59('0x78'),_0x8c59('0x79'),_0x8c59('0x7a'),'business_stc',_0x8c59('0x7b'),_0x8c59('0x7c'),_0x8c59('0x7d'),'notify','sys_class_name','close_notes',_0x8c59('0x7e'),_0x8c59('0x7f'),'parent_incident',_0x8c59('0x80'),_0x8c59('0x81'),_0x8c59('0x82'),_0x8c59('0x5b'),_0x8c59('0x83'),_0x8c59('0x84'),'company',_0x8c59('0x85'),_0x8c59('0x86'),_0x8c59('0x87'),_0x8c59('0x5c'),_0x8c59('0x88'),_0x8c59('0x89'),'approval','comments_and_work_notes',_0x8c59('0x8a'),_0x8c59('0x8b'),_0x8c59('0x8c'),_0x8c59('0x8d'),_0x8c59('0x8e'),'upon_approval','correlation_id',_0x8c59('0x8f'),_0x8c59('0x5d')];var _0x227534='';var _0x235758='';var _0x4f94c6=[];var _0x3e1b9e='';var _0x3298f3='';var _0x490f0b=[];var _0x4d0b4a='';var _0x511eea='';var _0xa3794b={};var _0x3c05ef='';return db[_0x8c59('0x2a')][_0x8c59('0x4a')]({'where':{'id':_0x2b510a[_0x8c59('0x44')]['id']},'attributes':['id',_0x8c59('0x90'),'password',_0x8c59('0x91'),'remoteUri',_0x8c59('0x92')]})[_0x8c59('0x23')](handleEntityNotFound(_0x3c6738,null))[_0x8c59('0x23')](function(_0x59be2f){if(_0x59be2f){_0x3c05ef=_0x59be2f['remoteUri'];var _0x427a24=_0x3c05ef[_0x8c59('0x93')](-0x1);if(_0x427a24==='/'){_0x3c05ef=_0x3c05ef[_0x8c59('0x94')](0x0,_0x3c05ef[_0x8c59('0x95')](_0x427a24));}_0x511eea=util[_0x8c59('0x96')]('%s/api/now/doc/table/schema/',_0x3c05ef);_0x4d0b4a=util[_0x8c59('0x96')](_0x8c59('0x97'),_0x3c05ef);_0xa3794b={'user':_0x59be2f[_0x8c59('0x90')],'pass':_0x59be2f[_0x8c59('0x98')]};var _0x40c89b={'method':_0x8c59('0x99'),'uri':_0x511eea+_0x8c59('0x9a'),'auth':_0xa3794b,'json':!![]};return rp(_0x40c89b);}})['then'](function(_0x1664f4){if(_0x1664f4[_0x8c59('0x9b')][_0x8c59('0x36')]>0x0){_0x227534=_0x1664f4[_0x8c59('0x9b')];}console[_0x8c59('0x9c')]('incident\x20table\x20objects',_0x227534);_0x490f0b=[];_0x235758=Object[_0x8c59('0x9d')]([],_0x227534);_[_0x8c59('0x9e')](_0x235758,function(_0x2141d4){return!_0xb00f06[_0x8c59('0x9f')](_0x2141d4[_0x8c59('0x27')]);});_0x235758[_0x8c59('0xa0')](function(_0x160dec){var _0x45ddb9=createFieldObject(_0x4d0b4a,_0xa3794b,_0x160dec[_0x8c59('0xa1')],_0x160dec[_0x8c59('0x27')],_0x160dec[_0x8c59('0xa2')],![]);_0x490f0b['push'](_0x45ddb9);});return Promise[_0x8c59('0xa3')](_0x490f0b);})[_0x8c59('0x23')](function(_0x5f4a03){_0x4f94c6=_0x5f4a03;_0x3e1b9e=Object[_0x8c59('0x9d')]([],_0x227534);console[_0x8c59('0x9c')](_0x8c59('0xa4'),_0x227534);_[_0x8c59('0x9e')](_0x3e1b9e,function(_0x5b1937){return _0x2a8e5d[_0x8c59('0x9f')](_0x5b1937['name']);});console[_0x8c59('0x9c')](_0x8c59('0xa5'),_0x3e1b9e);_0x490f0b=[];_0x3e1b9e['forEach'](function(_0x5f71ea){var _0x3ec2fe=createFieldObject(_0x4d0b4a,_0xa3794b,_0x5f71ea[_0x8c59('0xa1')],_0x5f71ea['name'],_0x5f71ea['label'],!![]);_0x490f0b[_0x8c59('0xa6')](_0x3ec2fe);});return Promise[_0x8c59('0xa3')](_0x490f0b);})[_0x8c59('0x23')](function(_0x4f16f0){_0x3298f3=_0x4f16f0;var _0x29a87e=_0x4f94c6[_0x8c59('0xa7')](_0x3298f3);return{'count':_0x29a87e[_0x8c59('0x36')],'rows':_0x29a87e};})[_0x8c59('0x23')](respondWithResult(_0x3c6738,null))['catch'](function(_0x65f60a){console[_0x8c59('0x9c')](_0x8c59('0xa8')+_0x65f60a);var _0x62ed06=_0x2b510a[_0x8c59('0x30')][_0x8c59('0xa9')]?0x1f4:_0x65f60a['statusCode']||0x1f4;logger[_0x8c59('0x25')](_0x65f60a[_0x8c59('0x26')]);delete _0x65f60a[_0x8c59('0x27')];if(_0x62ed06===0x191){_0x62ed06=0x190;}_0x3c6738[_0x8c59('0x18')](_0x62ed06)[_0x8c59('0x28')](_0x2b510a[_0x8c59('0x30')][_0x8c59('0xa9')]?{'message':_0x8c59('0xaa'),'statusCode':_0x65f60a[_0x8c59('0xab')]}:_0x65f60a);});};function createFieldObject(_0x254997,_0x4c7697,_0x4600d9,_0x187be6,_0x19e958,_0x25a946){return new Promise(function(_0x497d1e,_0xbf99cf){var _0x540187={'id':_0x187be6,'name':_0x19e958,'custom':_0x25a946};if(_0x4600d9===_0x8c59('0xac')){_0x540187[_0x8c59('0x4d')]=[{'name':_0x8c59('0xad'),'value':'true'},{'name':'False','value':_0x8c59('0xae')}];_0x497d1e(_0x540187);}else{var _0x146ad3={'method':'GET','uri':_0x254997+_0x8c59('0xaf')+_0x187be6,'auth':_0x4c7697,'json':!![]};return rp(_0x146ad3)['then'](function(_0x316ba6){var _0x2d1dc5=[];if(_0x316ba6['result']['length']>0x0){_0x316ba6[_0x8c59('0x9b')][_0x8c59('0xa0')](function(_0x1e0e07){if(_0x1e0e07[_0x8c59('0xb0')]===_0x8c59('0xae')){var _0x41869c={'name':_0x1e0e07[_0x8c59('0xa2')],'value':_0x1e0e07['value']};_0x2d1dc5[_0x8c59('0xa6')](_0x41869c);}});}_0x540187[_0x8c59('0x4d')]=_0x2d1dc5;if(_0x540187[_0x8c59('0x4d')]['length']>0x0){_0x497d1e(_0x540187);}else{if(_0x25a946==![]){_0x497d1e();}else{_0x497d1e(_0x540187);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 38ad34c..c71783a 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d17=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x20e72a,_0x280735){var _0x29dda7=function(_0xdbf391){while(--_0xdbf391){_0x20e72a['push'](_0x20e72a['shift']());}};_0x29dda7(++_0x280735);}(_0x5d17,0x114));var _0x75d1=function(_0x1ac5e1,_0x43a483){_0x1ac5e1=_0x1ac5e1-0x0;var _0x3ae80e=_0x5d17[_0x1ac5e1];return _0x3ae80e;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));var integrations=require(_0x75d1('0x8'));module['exports']=function(_0x458681,_0x116a51){return _0x458681[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','api','bluebird','request-promise'];(function(_0x1587b4,_0x1c918d){var _0x4e5054=function(_0x44552c){while(--_0x44552c){_0x1587b4['push'](_0x1587b4['shift']());}};_0x4e5054(++_0x1c918d);}(_0x71ab,0x64));var _0xb71a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x71ab[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 31665c6..e413a5b 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.rpc.js +++ b/server/api/intServicenowAccount/intServicenowAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a6e=['map','model','include','GetServicenowAccount','debug','ShowServicenowAccount','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','raw','attributes','limit'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x0a6e,0x128));var _0xe0a6=function(_0x4a3456,_0x4eaa33){_0x4a3456=_0x4a3456-0x0;var _0x105e06=_0x0a6e[_0x4a3456];return _0x105e06;};'use strict';var _=require('lodash');var util=require(_0xe0a6('0x0'));var moment=require(_0xe0a6('0x1'));var BPromise=require(_0xe0a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0a6('0x3'));var db=require(_0xe0a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0a6('0x5'))(_0xe0a6('0x6'));var config=require(_0xe0a6('0x7'));var jayson=require(_0xe0a6('0x8'));var client=jayson[_0xe0a6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x384263,_0x1f616d,_0x2e5b39){return new BPromise(function(_0x33c9f6,_0x48f0fa){return client[_0xe0a6('0xa')](_0x384263,_0x2e5b39)[_0xe0a6('0xb')](function(_0x429894){logger[_0xe0a6('0xc')](_0xe0a6('0xd'),_0x1f616d,_0xe0a6('0xe'));logger['debug'](_0xe0a6('0xf'),_0x1f616d,_0xe0a6('0xe'),JSON[_0xe0a6('0x10')](_0x429894));if(_0x429894['error']){if(_0x429894[_0xe0a6('0x11')][_0xe0a6('0x12')]===0x1f4){logger[_0xe0a6('0x11')](_0xe0a6('0xd'),_0x1f616d,_0x429894[_0xe0a6('0x11')][_0xe0a6('0x13')]);return _0x48f0fa(_0x429894[_0xe0a6('0x11')][_0xe0a6('0x13')]);}logger[_0xe0a6('0x11')](_0xe0a6('0xd'),_0x1f616d,_0x429894['error'][_0xe0a6('0x13')]);return _0x33c9f6(_0x429894['error'][_0xe0a6('0x13')]);}else{logger[_0xe0a6('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x1f616d,'request\x20sent');_0x33c9f6(_0x429894[_0xe0a6('0x14')][_0xe0a6('0x13')]);}})[_0xe0a6('0x15')](function(_0x7fa2b0){logger[_0xe0a6('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1f616d,_0x7fa2b0);_0x48f0fa(_0x7fa2b0);});});}exports['GetServicenowAccount']=function(_0x14454b){var _0x536b1f=this;return new Promise(function(_0x3d23bb,_0x5dc7ed){return db[_0xe0a6('0x16')][_0xe0a6('0x17')]({'raw':_0x14454b[_0xe0a6('0x18')]?_0x14454b[_0xe0a6('0x18')][_0xe0a6('0x19')]===undefined?!![]:![]:!![],'where':_0x14454b['options']?_0x14454b[_0xe0a6('0x18')]['where']||null:null,'attributes':_0x14454b[_0xe0a6('0x18')]?_0x14454b['options'][_0xe0a6('0x1a')]||null:null,'limit':_0x14454b[_0xe0a6('0x18')]?_0x14454b[_0xe0a6('0x18')][_0xe0a6('0x1b')]||null:null,'include':_0x14454b['options']?_0x14454b[_0xe0a6('0x18')]['include']?_[_0xe0a6('0x1c')](_0x14454b[_0xe0a6('0x18')]['include'],function(_0x4cabd6){return{'model':db[_0x4cabd6[_0xe0a6('0x1d')]],'as':_0x4cabd6['as'],'attributes':_0x4cabd6[_0xe0a6('0x1a')],'include':_0x4cabd6[_0xe0a6('0x1e')]?_[_0xe0a6('0x1c')](_0x4cabd6[_0xe0a6('0x1e')],function(_0x4e86eb){return{'model':db[_0x4e86eb[_0xe0a6('0x1d')]],'as':_0x4e86eb['as'],'attributes':_0x4e86eb[_0xe0a6('0x1a')],'include':_0x4e86eb[_0xe0a6('0x1e')]?_[_0xe0a6('0x1c')](_0x4e86eb['include'],function(_0x353b84){return{'model':db[_0x353b84[_0xe0a6('0x1d')]],'as':_0x353b84['as'],'attributes':_0x353b84[_0xe0a6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe0a6('0xb')](function(_0x1bc9f7){logger[_0xe0a6('0xc')](_0xe0a6('0x1f'),_0x14454b);logger[_0xe0a6('0x20')](_0xe0a6('0x1f'),_0x14454b,JSON[_0xe0a6('0x10')](_0x1bc9f7));_0x3d23bb(_0x1bc9f7);})[_0xe0a6('0x15')](function(_0x5c2f6b){logger['error'](_0xe0a6('0x1f'),_0x5c2f6b[_0xe0a6('0x13')],_0x14454b);_0x5dc7ed(_0x536b1f[_0xe0a6('0x11')](0x1f4,_0x5c2f6b[_0xe0a6('0x13')]));});});};exports[_0xe0a6('0x21')]=function(_0x40fa53){var _0x50ff5a=this;return new Promise(function(_0x3ca1e3,_0x344d45){return db[_0xe0a6('0x16')][_0xe0a6('0x22')]({'raw':_0x40fa53[_0xe0a6('0x18')]?_0x40fa53[_0xe0a6('0x18')][_0xe0a6('0x19')]===undefined?!![]:![]:!![],'where':_0x40fa53[_0xe0a6('0x18')]?_0x40fa53[_0xe0a6('0x18')][_0xe0a6('0x23')]||null:null,'attributes':_0x40fa53[_0xe0a6('0x18')]?_0x40fa53[_0xe0a6('0x18')]['attributes']||null:null,'include':_0x40fa53[_0xe0a6('0x18')]?_0x40fa53['options'][_0xe0a6('0x1e')]?_[_0xe0a6('0x1c')](_0x40fa53[_0xe0a6('0x18')][_0xe0a6('0x1e')],function(_0x4690e4){return{'model':db[_0x4690e4['model']],'as':_0x4690e4['as'],'attributes':_0x4690e4[_0xe0a6('0x1a')],'include':_0x4690e4['include']?_[_0xe0a6('0x1c')](_0x4690e4['include'],function(_0x404e69){return{'model':db[_0x404e69[_0xe0a6('0x1d')]],'as':_0x404e69['as'],'attributes':_0x404e69[_0xe0a6('0x1a')],'include':_0x404e69[_0xe0a6('0x1e')]?_[_0xe0a6('0x1c')](_0x404e69[_0xe0a6('0x1e')],function(_0x2a332b){return{'model':db[_0x2a332b[_0xe0a6('0x1d')]],'as':_0x2a332b['as'],'attributes':_0x2a332b[_0xe0a6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe0a6('0xb')](function(_0x4a9b04){logger['info'](_0xe0a6('0x21'),_0x40fa53);logger['debug'](_0xe0a6('0x21'),_0x40fa53,JSON['stringify'](_0x4a9b04));_0x3ca1e3(_0x4a9b04);})['catch'](function(_0x4406c3){logger[_0xe0a6('0x11')](_0xe0a6('0x21'),_0x4406c3[_0xe0a6('0x13')],_0x40fa53);_0x344d45(_0x50ff5a[_0xe0a6('0x11')](0x1f4,_0x4406c3['message']));});});}; \ No newline at end of file +var _0xcfea=['then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','stringify','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request'];(function(_0x158b75,_0x29f951){var _0xdd65d7=function(_0x4af7da){while(--_0x4af7da){_0x158b75['push'](_0x158b75['shift']());}};_0xdd65d7(++_0x29f951);}(_0xcfea,0xa3));var _0xacfe=function(_0xa9ded8,_0x48913d){_0xa9ded8=_0xa9ded8-0x0;var _0x572f94=_0xcfea[_0xa9ded8];return _0x572f94;};'use strict';var _=require(_0xacfe('0x0'));var util=require(_0xacfe('0x1'));var moment=require(_0xacfe('0x2'));var BPromise=require(_0xacfe('0x3'));var rs=require(_0xacfe('0x4'));var fs=require('fs');var Redis=require(_0xacfe('0x5'));var db=require(_0xacfe('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xacfe('0x7'));var jayson=require(_0xacfe('0x8'));var client=jayson[_0xacfe('0x9')][_0xacfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ac436,_0x1c9e72,_0xa38f95){return new BPromise(function(_0x97fff3,_0x101f8d){return client[_0xacfe('0xb')](_0x4ac436,_0xa38f95)[_0xacfe('0xc')](function(_0x355025){logger[_0xacfe('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1c9e72,_0xacfe('0xe'));logger[_0xacfe('0xf')](_0xacfe('0x10'),_0x1c9e72,_0xacfe('0xe'),JSON['stringify'](_0x355025));if(_0x355025['error']){if(_0x355025[_0xacfe('0x11')]['code']===0x1f4){logger[_0xacfe('0x11')](_0xacfe('0x12'),_0x1c9e72,_0x355025[_0xacfe('0x11')][_0xacfe('0x13')]);return _0x101f8d(_0x355025['error'][_0xacfe('0x13')]);}logger['error'](_0xacfe('0x12'),_0x1c9e72,_0x355025['error'][_0xacfe('0x13')]);return _0x97fff3(_0x355025[_0xacfe('0x11')]['message']);}else{logger[_0xacfe('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1c9e72,_0xacfe('0xe'));_0x97fff3(_0x355025[_0xacfe('0x14')]['message']);}})[_0xacfe('0x15')](function(_0x84bb04){logger[_0xacfe('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1c9e72,_0x84bb04);_0x101f8d(_0x84bb04);});});}exports[_0xacfe('0x16')]=function(_0x52b475){var _0x58bc90=this;return new Promise(function(_0x5e66b9,_0x1427ab){return db[_0xacfe('0x17')]['findAll']({'raw':_0x52b475[_0xacfe('0x18')]?_0x52b475[_0xacfe('0x18')][_0xacfe('0x19')]===undefined?!![]:![]:!![],'where':_0x52b475[_0xacfe('0x18')]?_0x52b475['options'][_0xacfe('0x1a')]||null:null,'attributes':_0x52b475[_0xacfe('0x18')]?_0x52b475['options'][_0xacfe('0x1b')]||null:null,'limit':_0x52b475['options']?_0x52b475['options'][_0xacfe('0x1c')]||null:null,'include':_0x52b475[_0xacfe('0x18')]?_0x52b475[_0xacfe('0x18')][_0xacfe('0x1d')]?_[_0xacfe('0x1e')](_0x52b475[_0xacfe('0x18')][_0xacfe('0x1d')],function(_0x2e7d03){return{'model':db[_0x2e7d03[_0xacfe('0x1f')]],'as':_0x2e7d03['as'],'attributes':_0x2e7d03[_0xacfe('0x1b')],'include':_0x2e7d03[_0xacfe('0x1d')]?_['map'](_0x2e7d03[_0xacfe('0x1d')],function(_0x569f5f){return{'model':db[_0x569f5f[_0xacfe('0x1f')]],'as':_0x569f5f['as'],'attributes':_0x569f5f['attributes'],'include':_0x569f5f['include']?_[_0xacfe('0x1e')](_0x569f5f[_0xacfe('0x1d')],function(_0x14120d){return{'model':db[_0x14120d['model']],'as':_0x14120d['as'],'attributes':_0x14120d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x23daca){logger[_0xacfe('0xd')](_0xacfe('0x16'),_0x52b475);logger['debug'](_0xacfe('0x16'),_0x52b475,JSON[_0xacfe('0x20')](_0x23daca));_0x5e66b9(_0x23daca);})[_0xacfe('0x15')](function(_0x4672cb){logger[_0xacfe('0x11')](_0xacfe('0x16'),_0x4672cb[_0xacfe('0x13')],_0x52b475);_0x1427ab(_0x58bc90[_0xacfe('0x11')](0x1f4,_0x4672cb[_0xacfe('0x13')]));});});};exports[_0xacfe('0x21')]=function(_0x5a1aa0){var _0x54b102=this;return new Promise(function(_0x5527d7,_0x493a4c){return db[_0xacfe('0x17')][_0xacfe('0x22')]({'raw':_0x5a1aa0['options']?_0x5a1aa0[_0xacfe('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a1aa0[_0xacfe('0x18')]?_0x5a1aa0[_0xacfe('0x18')][_0xacfe('0x1a')]||null:null,'attributes':_0x5a1aa0[_0xacfe('0x18')]?_0x5a1aa0[_0xacfe('0x18')][_0xacfe('0x1b')]||null:null,'include':_0x5a1aa0[_0xacfe('0x18')]?_0x5a1aa0[_0xacfe('0x18')][_0xacfe('0x1d')]?_[_0xacfe('0x1e')](_0x5a1aa0[_0xacfe('0x18')][_0xacfe('0x1d')],function(_0x551f0b){return{'model':db[_0x551f0b[_0xacfe('0x1f')]],'as':_0x551f0b['as'],'attributes':_0x551f0b[_0xacfe('0x1b')],'include':_0x551f0b['include']?_['map'](_0x551f0b[_0xacfe('0x1d')],function(_0x39fdbc){return{'model':db[_0x39fdbc[_0xacfe('0x1f')]],'as':_0x39fdbc['as'],'attributes':_0x39fdbc[_0xacfe('0x1b')],'include':_0x39fdbc['include']?_[_0xacfe('0x1e')](_0x39fdbc[_0xacfe('0x1d')],function(_0x111edc){return{'model':db[_0x111edc[_0xacfe('0x1f')]],'as':_0x111edc['as'],'attributes':_0x111edc[_0xacfe('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xacfe('0xc')](function(_0x3a36fa){logger[_0xacfe('0xd')](_0xacfe('0x21'),_0x5a1aa0);logger['debug'](_0xacfe('0x21'),_0x5a1aa0,JSON[_0xacfe('0x20')](_0x3a36fa));_0x5527d7(_0x3a36fa);})[_0xacfe('0x15')](function(_0x52aff4){logger[_0xacfe('0x11')](_0xacfe('0x21'),_0x52aff4['message'],_0x5a1aa0);_0x493a4c(_0x54b102['error'](0x1f4,_0x52aff4[_0xacfe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b3daf65..090d47b 100644 --- a/server/api/intServicenowConfiguration/index.js +++ b/server/api/intServicenowConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d15=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields'];(function(_0x25e6a6,_0x1cc361){var _0x1043bc=function(_0x5a682f){while(--_0x5a682f){_0x25e6a6['push'](_0x25e6a6['shift']());}};_0x1043bc(++_0x1cc361);}(_0x5d15,0x6c));var _0x55d1=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0x5d15[_0x1cc961];return _0x471d86;};'use strict';var multer=require('multer');var util=require(_0x55d1('0x0'));var path=require('path');var timeout=require(_0x55d1('0x1'));var express=require('express');var router=express[_0x55d1('0x2')]();var fs_extra=require(_0x55d1('0x3'));var auth=require(_0x55d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x55d1('0x5'));var controller=require(_0x55d1('0x6'));router[_0x55d1('0x7')]('/',auth[_0x55d1('0x8')](),controller['index']);router[_0x55d1('0x7')](_0x55d1('0x9'),auth[_0x55d1('0x8')](),controller['show']);router[_0x55d1('0x7')](_0x55d1('0xa'),auth[_0x55d1('0x8')](),controller[_0x55d1('0xb')]);router['get'](_0x55d1('0xc'),auth['isAuthenticated'](),controller[_0x55d1('0xd')]);router['get'](_0x55d1('0xe'),auth['isAuthenticated'](),controller[_0x55d1('0xf')]);router[_0x55d1('0x10')]('/',auth[_0x55d1('0x8')](),controller[_0x55d1('0x11')]);router[_0x55d1('0x12')](_0x55d1('0x9'),auth[_0x55d1('0x8')](),controller['update']);router[_0x55d1('0x13')](_0x55d1('0x9'),auth[_0x55d1('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xca00=['put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x2b7d9b,_0x508c46){var _0xe67b02=function(_0x5f48fe){while(--_0x5f48fe){_0x2b7d9b['push'](_0x2b7d9b['shift']());}};_0xe67b02(++_0x508c46);}(_0xca00,0x19c));var _0x0ca0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca00[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x0ca0('0x0'));var util=require(_0x0ca0('0x1'));var path=require(_0x0ca0('0x2'));var timeout=require(_0x0ca0('0x3'));var express=require('express');var router=express[_0x0ca0('0x4')]();var fs_extra=require(_0x0ca0('0x5'));var auth=require(_0x0ca0('0x6'));var interaction=require(_0x0ca0('0x7'));var config=require(_0x0ca0('0x8'));var controller=require('./intServicenowConfiguration.controller');router[_0x0ca0('0x9')]('/',auth[_0x0ca0('0xa')](),controller[_0x0ca0('0xb')]);router[_0x0ca0('0x9')](_0x0ca0('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0ca0('0x9')](_0x0ca0('0xd'),auth['isAuthenticated'](),controller[_0x0ca0('0xe')]);router[_0x0ca0('0x9')](_0x0ca0('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0ca0('0x9')](_0x0ca0('0x10'),auth[_0x0ca0('0xa')](),controller[_0x0ca0('0x11')]);router[_0x0ca0('0x12')]('/',auth[_0x0ca0('0xa')](),controller[_0x0ca0('0x13')]);router[_0x0ca0('0x14')](_0x0ca0('0xc'),auth[_0x0ca0('0xa')](),controller[_0x0ca0('0x15')]);router[_0x0ca0('0x16')](_0x0ca0('0xc'),auth[_0x0ca0('0xa')](),controller['destroy']);module[_0x0ca0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 7a6a192..53dbef7 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39eb=['exports','STRING','sequelize'];(function(_0x3baacd,_0x3e7cb4){var _0x4d941e=function(_0x477b23){while(--_0x477b23){_0x3baacd['push'](_0x3baacd['shift']());}};_0x4d941e(++_0x3e7cb4);}(_0x39eb,0x80));var _0xb39e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x39eb[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xb39e('0x0'));module[_0xb39e('0x1')]={'name':{'type':Sequelize[_0xb39e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xedc1=['STRING'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xedc1,0x133));var _0x1edc=function(_0x11dbbe,_0x7b04d3){_0x11dbbe=_0x11dbbe-0x0;var _0x475061=_0xedc1[_0x11dbbe];return _0x475061;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1edc('0x0')]},'description':{'type':Sequelize[_0x1edc('0x0')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 8ce8cfb..be8e5e1 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a5a=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','includeAll','include','rows','show','params','options','find','catch','create','body','getFields','ServicenowField','getSubjects','findOne','order','pick','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2cd535,_0x1bf6b5){var _0x146a6c=function(_0x507464){while(--_0x507464){_0x2cd535['push'](_0x2cd535['shift']());}};_0x146a6c(++_0x1bf6b5);}(_0x1a5a,0x89));var _0xa1a5=function(_0x3156ec,_0x18ffd2){_0x3156ec=_0x3156ec-0x0;var _0x4b43da=_0x1a5a[_0x3156ec];return _0x4b43da;};'use strict';var emlformat=require(_0xa1a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1a5('0x1'));var jsonpatch=require(_0xa1a5('0x2'));var rp=require(_0xa1a5('0x3'));var moment=require(_0xa1a5('0x4'));var BPromise=require(_0xa1a5('0x5'));var Mustache=require(_0xa1a5('0x6'));var util=require(_0xa1a5('0x7'));var path=require(_0xa1a5('0x8'));var sox=require('sox');var csv=require(_0xa1a5('0x9'));var ejs=require(_0xa1a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa1a5('0xb'));var squel=require(_0xa1a5('0xc'));var crypto=require(_0xa1a5('0xd'));var jsforce=require(_0xa1a5('0xe'));var deskjs=require(_0xa1a5('0xf'));var toCsv=require(_0xa1a5('0x9'));var querystring=require('querystring');var Papa=require(_0xa1a5('0x10'));var Redis=require('ioredis');var authService=require(_0xa1a5('0x11'));var qs=require(_0xa1a5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1a5('0x13'));var logger=require(_0xa1a5('0x14'))(_0xa1a5('0x15'));var utils=require(_0xa1a5('0x16'));var config=require(_0xa1a5('0x17'));var licenseUtil=require(_0xa1a5('0x18'));var db=require(_0xa1a5('0x19'))['db'];function respondWithStatusCode(_0xe8174f,_0x3ddf8c){_0x3ddf8c=_0x3ddf8c||0xcc;return function(_0x515604){if(_0x515604){return _0xe8174f[_0xa1a5('0x1a')](_0x3ddf8c);}return _0xe8174f[_0xa1a5('0x1b')](_0x3ddf8c)[_0xa1a5('0x1c')]();};}function respondWithResult(_0xe1ce4e,_0x58051e){_0x58051e=_0x58051e||0xc8;return function(_0x4feb92){if(_0x4feb92){return _0xe1ce4e[_0xa1a5('0x1b')](_0x58051e)[_0xa1a5('0x1d')](_0x4feb92);}};}function respondWithFilteredResult(_0x1bbe47,_0x424762){return function(_0x3112bf){if(_0x3112bf){var _0x1e5140=typeof _0x424762[_0xa1a5('0x1e')]===_0xa1a5('0x1f')&&typeof _0x424762[_0xa1a5('0x20')]===_0xa1a5('0x1f');var _0x21b8e0=_0x3112bf[_0xa1a5('0x21')];var _0x21a63f=_0x1e5140?0x0:_0x424762['offset'];var _0x1e55d7=_0x1e5140?_0x3112bf[_0xa1a5('0x21')]:_0x424762['offset']+_0x424762[_0xa1a5('0x20')];var _0x3e0d2f;if(_0x1e55d7>=_0x21b8e0){_0x1e55d7=_0x21b8e0;_0x3e0d2f=0xc8;}else{_0x3e0d2f=0xce;}_0x1bbe47['status'](_0x3e0d2f);return _0x1bbe47[_0xa1a5('0x22')](_0xa1a5('0x23'),_0x21a63f+'-'+_0x1e55d7+'/'+_0x21b8e0)['json'](_0x3112bf);}return null;};}function patchUpdates(_0xe39b78){return function(_0x2895a4){try{jsonpatch[_0xa1a5('0x24')](_0x2895a4,_0xe39b78,!![]);}catch(_0x14c3fc){return BPromise[_0xa1a5('0x25')](_0x14c3fc);}return _0x2895a4['save']();};}function saveUpdates(_0x220de3,_0x56a035){return function(_0x53e075){if(_0x53e075){return _0x53e075[_0xa1a5('0x26')](_0x220de3)['then'](function(_0x57ad41){return _0x57ad41;});}return null;};}function removeEntity(_0x5703ba,_0x575eca){return function(_0x1c232d){if(_0x1c232d){return _0x1c232d[_0xa1a5('0x27')]()[_0xa1a5('0x28')](function(){_0x5703ba[_0xa1a5('0x1b')](0xcc)[_0xa1a5('0x1c')]();});}};}function handleEntityNotFound(_0x30c8c1,_0x427f4d){return function(_0x29777e){if(!_0x29777e){_0x30c8c1[_0xa1a5('0x1a')](0x194);}return _0x29777e;};}function handleError(_0x1ef526,_0x2d22ab){_0x2d22ab=_0x2d22ab||0x1f4;return function(_0x11a348){logger[_0xa1a5('0x29')](_0x11a348[_0xa1a5('0x2a')]);if(_0x11a348['name']){delete _0x11a348[_0xa1a5('0x2b')];}_0x1ef526['status'](_0x2d22ab)[_0xa1a5('0x2c')](_0x11a348);};}exports[_0xa1a5('0x2d')]=function(_0x570dec,_0xab6a7d){var _0x417cd1={},_0x3401a2={},_0x52af28={'count':0x0,'rows':[]};var _0x38ea75=_[_0xa1a5('0x2e')](db[_0xa1a5('0x2f')][_0xa1a5('0x30')],function(_0x51528d){return{'name':_0x51528d[_0xa1a5('0x31')],'type':_0x51528d['type']['key']};});_0x3401a2[_0xa1a5('0x32')]=_[_0xa1a5('0x2e')](_0x38ea75,_0xa1a5('0x2b'));_0x3401a2['query']=_[_0xa1a5('0x33')](_0x570dec[_0xa1a5('0x34')]);_0x3401a2[_0xa1a5('0x35')]=_[_0xa1a5('0x36')](_0x3401a2[_0xa1a5('0x32')],_0x3401a2[_0xa1a5('0x34')]);_0x417cd1['attributes']=_[_0xa1a5('0x36')](_0x3401a2[_0xa1a5('0x32')],qs[_0xa1a5('0x37')](_0x570dec['query'][_0xa1a5('0x37')]));_0x417cd1[_0xa1a5('0x38')]=_0x417cd1[_0xa1a5('0x38')][_0xa1a5('0x39')]?_0x417cd1['attributes']:_0x3401a2[_0xa1a5('0x32')];if(!_0x570dec[_0xa1a5('0x34')][_0xa1a5('0x3a')](_0xa1a5('0x3b'))){_0x417cd1[_0xa1a5('0x20')]=qs[_0xa1a5('0x20')](_0x570dec[_0xa1a5('0x34')][_0xa1a5('0x20')]);_0x417cd1[_0xa1a5('0x1e')]=qs[_0xa1a5('0x1e')](_0x570dec[_0xa1a5('0x34')][_0xa1a5('0x1e')]);}_0x417cd1['order']=qs[_0xa1a5('0x3c')](_0x570dec['query']['sort']);_0x417cd1['where']=qs['filters'](_['pick'](_0x570dec[_0xa1a5('0x34')],_0x3401a2[_0xa1a5('0x35')]),_0x38ea75);if(_0x570dec[_0xa1a5('0x34')][_0xa1a5('0x3d')]){_0x417cd1[_0xa1a5('0x3e')]=_['merge'](_0x417cd1[_0xa1a5('0x3e')],{'$or':_[_0xa1a5('0x2e')](_0x38ea75,function(_0x420e1e){if(_0x420e1e['type']!==_0xa1a5('0x3f')){var _0x4441d6={};_0x4441d6[_0x420e1e['name']]={'$like':'%'+_0x570dec['query']['filter']+'%'};return _0x4441d6;}})});}_0x417cd1=_[_0xa1a5('0x40')]({},_0x417cd1,_0x570dec['options']);var _0x3f9ece={'where':_0x417cd1[_0xa1a5('0x3e')]};return db[_0xa1a5('0x2f')][_0xa1a5('0x21')](_0x3f9ece)[_0xa1a5('0x28')](function(_0x37a0ae){_0x52af28[_0xa1a5('0x21')]=_0x37a0ae;if(_0x570dec['query'][_0xa1a5('0x41')]){_0x417cd1[_0xa1a5('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x417cd1);})['then'](function(_0x3e463d){_0x52af28[_0xa1a5('0x43')]=_0x3e463d;return _0x52af28;})[_0xa1a5('0x28')](respondWithFilteredResult(_0xab6a7d,_0x417cd1))['catch'](handleError(_0xab6a7d,null));};exports[_0xa1a5('0x44')]=function(_0x152be9,_0x5cd3bc){var _0x1354db={'raw':![],'where':{'id':_0x152be9[_0xa1a5('0x45')]['id']}},_0x712b49={};_0x712b49['model']=_['keys'](db[_0xa1a5('0x2f')][_0xa1a5('0x30')]);_0x712b49['query']=_[_0xa1a5('0x33')](_0x152be9[_0xa1a5('0x34')]);_0x712b49[_0xa1a5('0x35')]=_[_0xa1a5('0x36')](_0x712b49['model'],_0x712b49['query']);_0x1354db[_0xa1a5('0x38')]=_[_0xa1a5('0x36')](_0x712b49[_0xa1a5('0x32')],qs['fields'](_0x152be9[_0xa1a5('0x34')][_0xa1a5('0x37')]));_0x1354db[_0xa1a5('0x38')]=_0x1354db[_0xa1a5('0x38')]['length']?_0x1354db[_0xa1a5('0x38')]:_0x712b49['model'];if(_0x152be9[_0xa1a5('0x34')][_0xa1a5('0x41')]){_0x1354db[_0xa1a5('0x42')]=[{'all':!![]}];}_0x1354db=_['merge']({},_0x1354db,_0x152be9[_0xa1a5('0x46')]);return db[_0xa1a5('0x2f')][_0xa1a5('0x47')](_0x1354db)[_0xa1a5('0x28')](handleEntityNotFound(_0x5cd3bc,null))[_0xa1a5('0x28')](respondWithResult(_0x5cd3bc,null))[_0xa1a5('0x48')](handleError(_0x5cd3bc,null));};exports[_0xa1a5('0x49')]=function(_0xa07455,_0x5188fe){return db['ServicenowConfiguration'][_0xa1a5('0x49')](_0xa07455[_0xa1a5('0x4a')],{})[_0xa1a5('0x28')](respondWithResult(_0x5188fe,0xc9))['catch'](handleError(_0x5188fe,null));};exports[_0xa1a5('0x26')]=function(_0x51c648,_0x1e0b2d){if(_0x51c648[_0xa1a5('0x4a')]['id']){delete _0x51c648[_0xa1a5('0x4a')]['id'];}return db['ServicenowConfiguration'][_0xa1a5('0x47')]({'where':{'id':_0x51c648['params']['id']}})[_0xa1a5('0x28')](handleEntityNotFound(_0x1e0b2d,null))[_0xa1a5('0x28')](saveUpdates(_0x51c648[_0xa1a5('0x4a')],null))[_0xa1a5('0x28')](respondWithResult(_0x1e0b2d,null))['catch'](handleError(_0x1e0b2d,null));};exports['destroy']=function(_0x482c5b,_0x7fb77b){return db['ServicenowConfiguration'][_0xa1a5('0x47')]({'where':{'id':_0x482c5b[_0xa1a5('0x45')]['id']}})[_0xa1a5('0x28')](handleEntityNotFound(_0x7fb77b,null))[_0xa1a5('0x28')](removeEntity(_0x7fb77b,null))[_0xa1a5('0x48')](handleError(_0x7fb77b,null));};exports[_0xa1a5('0x4b')]=function(_0x50287e,_0x50a7ed,_0x24501b){var _0x4709db={};var _0xd46b80={};var _0x44fe92;var _0xa5754f;return db[_0xa1a5('0x2f')]['findOne']({'where':{'id':_0x50287e[_0xa1a5('0x45')]['id']}})['then'](handleEntityNotFound(_0x50a7ed,null))[_0xa1a5('0x28')](function(_0x2e820d){if(_0x2e820d){_0x44fe92=_0x2e820d;_0xd46b80[_0xa1a5('0x32')]=_[_0xa1a5('0x33')](db[_0xa1a5('0x4c')][_0xa1a5('0x30')]);_0xd46b80[_0xa1a5('0x34')]=_[_0xa1a5('0x33')](_0x50287e[_0xa1a5('0x34')]);_0xd46b80['filters']=_[_0xa1a5('0x36')](_0xd46b80[_0xa1a5('0x32')],_0xd46b80[_0xa1a5('0x34')]);_0x4709db['attributes']=_[_0xa1a5('0x36')](_0xd46b80[_0xa1a5('0x32')],qs[_0xa1a5('0x37')](_0x50287e[_0xa1a5('0x34')][_0xa1a5('0x37')]));_0x4709db[_0xa1a5('0x38')]=_0x4709db[_0xa1a5('0x38')][_0xa1a5('0x39')]?_0x4709db[_0xa1a5('0x38')]:_0xd46b80[_0xa1a5('0x32')];_0x4709db['order']=qs[_0xa1a5('0x3c')](_0x50287e['query'][_0xa1a5('0x3c')]);_0x4709db['where']=qs[_0xa1a5('0x35')](_['pick'](_0x50287e['query'],_0xd46b80[_0xa1a5('0x35')]));if(_0x50287e[_0xa1a5('0x34')][_0xa1a5('0x3d')]){_0x4709db['where']=_[_0xa1a5('0x40')](_0x4709db['where'],{'$or':_[_0xa1a5('0x2e')](_0x4709db['attributes'],function(_0x1d4be9){var _0x3f6a4e={};_0x3f6a4e[_0x1d4be9]={'$like':'%'+_0x50287e[_0xa1a5('0x34')][_0xa1a5('0x3d')]+'%'};return _0x3f6a4e;})});}_0x4709db=_['merge']({},_0x4709db,_0x50287e[_0xa1a5('0x46')]);return _0x44fe92['getFields'](_0x4709db);}})['then'](function(_0x1a2b22){if(_0x1a2b22){_0xa5754f=_0x1a2b22[_0xa1a5('0x39')];if(!_0x50287e['query'][_0xa1a5('0x3a')]('nolimit')){_0x4709db[_0xa1a5('0x20')]=qs[_0xa1a5('0x20')](_0x50287e['query'][_0xa1a5('0x20')]);_0x4709db[_0xa1a5('0x1e')]=qs[_0xa1a5('0x1e')](_0x50287e[_0xa1a5('0x34')][_0xa1a5('0x1e')]);}return _0x44fe92[_0xa1a5('0x4b')](_0x4709db);}})[_0xa1a5('0x28')](function(_0x41d316){if(_0x41d316){return _0x41d316?{'count':_0xa5754f,'rows':_0x41d316}:null;}})[_0xa1a5('0x28')](respondWithResult(_0x50a7ed,null))[_0xa1a5('0x48')](handleError(_0x50a7ed,null));};exports[_0xa1a5('0x4d')]=function(_0x250e4b,_0x5065c1,_0x2d587b){var _0x3c97e2={};var _0x1ff222={};var _0x2e3078;var _0x26c107;return db['ServicenowConfiguration'][_0xa1a5('0x4e')]({'where':{'id':_0x250e4b[_0xa1a5('0x45')]['id']}})['then'](handleEntityNotFound(_0x5065c1,null))['then'](function(_0x5e2b8a){if(_0x5e2b8a){_0x2e3078=_0x5e2b8a;_0x1ff222[_0xa1a5('0x32')]=_['keys'](db['ServicenowField'][_0xa1a5('0x30')]);_0x1ff222[_0xa1a5('0x34')]=_['keys'](_0x250e4b[_0xa1a5('0x34')]);_0x1ff222['filters']=_[_0xa1a5('0x36')](_0x1ff222[_0xa1a5('0x32')],_0x1ff222[_0xa1a5('0x34')]);_0x3c97e2['attributes']=_[_0xa1a5('0x36')](_0x1ff222[_0xa1a5('0x32')],qs[_0xa1a5('0x37')](_0x250e4b[_0xa1a5('0x34')]['fields']));_0x3c97e2[_0xa1a5('0x38')]=_0x3c97e2[_0xa1a5('0x38')][_0xa1a5('0x39')]?_0x3c97e2['attributes']:_0x1ff222[_0xa1a5('0x32')];_0x3c97e2[_0xa1a5('0x4f')]=qs[_0xa1a5('0x3c')](_0x250e4b[_0xa1a5('0x34')][_0xa1a5('0x3c')]);_0x3c97e2[_0xa1a5('0x3e')]=qs[_0xa1a5('0x35')](_[_0xa1a5('0x50')](_0x250e4b[_0xa1a5('0x34')],_0x1ff222[_0xa1a5('0x35')]));if(_0x250e4b[_0xa1a5('0x34')][_0xa1a5('0x3d')]){_0x3c97e2[_0xa1a5('0x3e')]=_['merge'](_0x3c97e2[_0xa1a5('0x3e')],{'$or':_[_0xa1a5('0x2e')](_0x3c97e2['attributes'],function(_0x2c3f5e){var _0xe5654d={};_0xe5654d[_0x2c3f5e]={'$like':'%'+_0x250e4b[_0xa1a5('0x34')][_0xa1a5('0x3d')]+'%'};return _0xe5654d;})});}_0x3c97e2=_[_0xa1a5('0x40')]({},_0x3c97e2,_0x250e4b[_0xa1a5('0x46')]);return _0x2e3078[_0xa1a5('0x4d')](_0x3c97e2);}})[_0xa1a5('0x28')](function(_0x106b08){if(_0x106b08){_0x26c107=_0x106b08[_0xa1a5('0x39')];if(!_0x250e4b[_0xa1a5('0x34')][_0xa1a5('0x3a')](_0xa1a5('0x3b'))){_0x3c97e2[_0xa1a5('0x20')]=qs[_0xa1a5('0x20')](_0x250e4b[_0xa1a5('0x34')][_0xa1a5('0x20')]);_0x3c97e2[_0xa1a5('0x1e')]=qs[_0xa1a5('0x1e')](_0x250e4b[_0xa1a5('0x34')]['offset']);}return _0x2e3078['getSubjects'](_0x3c97e2);}})['then'](function(_0x4426a5){if(_0x4426a5){return _0x4426a5?{'count':_0x26c107,'rows':_0x4426a5}:null;}})[_0xa1a5('0x28')](respondWithResult(_0x5065c1,null))[_0xa1a5('0x48')](handleError(_0x5065c1,null));};exports['getDescriptions']=function(_0x5bf94e,_0x546cdf,_0x54e651){var _0x59f43a={};var _0xd0f788={};var _0x32b5b8;var _0xdf65b3;return db[_0xa1a5('0x2f')]['findOne']({'where':{'id':_0x5bf94e['params']['id']}})['then'](handleEntityNotFound(_0x546cdf,null))[_0xa1a5('0x28')](function(_0x4bfa5f){if(_0x4bfa5f){_0x32b5b8=_0x4bfa5f;_0xd0f788[_0xa1a5('0x32')]=_[_0xa1a5('0x33')](db[_0xa1a5('0x4c')]['rawAttributes']);_0xd0f788['query']=_[_0xa1a5('0x33')](_0x5bf94e['query']);_0xd0f788[_0xa1a5('0x35')]=_[_0xa1a5('0x36')](_0xd0f788[_0xa1a5('0x32')],_0xd0f788['query']);_0x59f43a[_0xa1a5('0x38')]=_[_0xa1a5('0x36')](_0xd0f788[_0xa1a5('0x32')],qs[_0xa1a5('0x37')](_0x5bf94e[_0xa1a5('0x34')][_0xa1a5('0x37')]));_0x59f43a[_0xa1a5('0x38')]=_0x59f43a[_0xa1a5('0x38')][_0xa1a5('0x39')]?_0x59f43a['attributes']:_0xd0f788[_0xa1a5('0x32')];_0x59f43a[_0xa1a5('0x4f')]=qs[_0xa1a5('0x3c')](_0x5bf94e[_0xa1a5('0x34')][_0xa1a5('0x3c')]);_0x59f43a[_0xa1a5('0x3e')]=qs[_0xa1a5('0x35')](_['pick'](_0x5bf94e[_0xa1a5('0x34')],_0xd0f788[_0xa1a5('0x35')]));if(_0x5bf94e['query'][_0xa1a5('0x3d')]){_0x59f43a[_0xa1a5('0x3e')]=_['merge'](_0x59f43a[_0xa1a5('0x3e')],{'$or':_[_0xa1a5('0x2e')](_0x59f43a[_0xa1a5('0x38')],function(_0x4272d4){var _0x5eb8e1={};_0x5eb8e1[_0x4272d4]={'$like':'%'+_0x5bf94e['query']['filter']+'%'};return _0x5eb8e1;})});}_0x59f43a=_[_0xa1a5('0x40')]({},_0x59f43a,_0x5bf94e[_0xa1a5('0x46')]);return _0x32b5b8[_0xa1a5('0x51')](_0x59f43a);}})['then'](function(_0x1176fb){if(_0x1176fb){_0xdf65b3=_0x1176fb['length'];if(!_0x5bf94e[_0xa1a5('0x34')][_0xa1a5('0x3a')]('nolimit')){_0x59f43a[_0xa1a5('0x20')]=qs[_0xa1a5('0x20')](_0x5bf94e['query'][_0xa1a5('0x20')]);_0x59f43a[_0xa1a5('0x1e')]=qs[_0xa1a5('0x1e')](_0x5bf94e[_0xa1a5('0x34')][_0xa1a5('0x1e')]);}return _0x32b5b8[_0xa1a5('0x51')](_0x59f43a);}})[_0xa1a5('0x28')](function(_0x25c4ad){if(_0x25c4ad){return _0x25c4ad?{'count':_0xdf65b3,'rows':_0x25c4ad}:null;}})[_0xa1a5('0x28')](respondWithResult(_0x546cdf,null))['catch'](handleError(_0x546cdf,null));}; \ No newline at end of file +var _0xc148=['pick','hasOwnProperty','getSubjects','getDescriptions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','ServicenowConfiguration','include','findAll','show','params','options','find','catch','create','getFields','ServicenowField'];(function(_0x670c80,_0x42c00e){var _0x5d15ec=function(_0x37c4f1){while(--_0x37c4f1){_0x670c80['push'](_0x670c80['shift']());}};_0x5d15ec(++_0x42c00e);}(_0xc148,0x149));var _0x8c14=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xc148[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c14('0x0'));var zipdir=require(_0x8c14('0x1'));var jsonpatch=require(_0x8c14('0x2'));var rp=require(_0x8c14('0x3'));var moment=require('moment');var BPromise=require(_0x8c14('0x4'));var Mustache=require(_0x8c14('0x5'));var util=require(_0x8c14('0x6'));var path=require(_0x8c14('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8c14('0x8'));var fs=require('fs');var fs_extra=require(_0x8c14('0x9'));var _=require('lodash');var squel=require(_0x8c14('0xa'));var crypto=require(_0x8c14('0xb'));var jsforce=require(_0x8c14('0xc'));var deskjs=require(_0x8c14('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8c14('0xe'));var Papa=require(_0x8c14('0xf'));var Redis=require(_0x8c14('0x10'));var authService=require(_0x8c14('0x11'));var qs=require(_0x8c14('0x12'));var as=require(_0x8c14('0x13'));var hardwareService=require(_0x8c14('0x14'));var logger=require(_0x8c14('0x15'))(_0x8c14('0x16'));var utils=require(_0x8c14('0x17'));var config=require(_0x8c14('0x18'));var licenseUtil=require(_0x8c14('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x263ab6,_0x2786f5){_0x2786f5=_0x2786f5||0xcc;return function(_0x265eff){if(_0x265eff){return _0x263ab6[_0x8c14('0x1a')](_0x2786f5);}return _0x263ab6[_0x8c14('0x1b')](_0x2786f5)[_0x8c14('0x1c')]();};}function respondWithResult(_0x2bb2cc,_0x4ddf5f){_0x4ddf5f=_0x4ddf5f||0xc8;return function(_0x2a90bb){if(_0x2a90bb){return _0x2bb2cc[_0x8c14('0x1b')](_0x4ddf5f)[_0x8c14('0x1d')](_0x2a90bb);}};}function respondWithFilteredResult(_0x1f0ea4,_0x5f5b3a){return function(_0x4578aa){if(_0x4578aa){var _0x48d273=typeof _0x5f5b3a[_0x8c14('0x1e')]===_0x8c14('0x1f')&&typeof _0x5f5b3a[_0x8c14('0x20')]===_0x8c14('0x1f');var _0x5dddb4=_0x4578aa[_0x8c14('0x21')];var _0x3adf0c=_0x48d273?0x0:_0x5f5b3a['offset'];var _0x22204c=_0x48d273?_0x4578aa[_0x8c14('0x21')]:_0x5f5b3a[_0x8c14('0x1e')]+_0x5f5b3a[_0x8c14('0x20')];var _0x4c677b;if(_0x22204c>=_0x5dddb4){_0x22204c=_0x5dddb4;_0x4c677b=0xc8;}else{_0x4c677b=0xce;}_0x1f0ea4[_0x8c14('0x1b')](_0x4c677b);return _0x1f0ea4[_0x8c14('0x22')](_0x8c14('0x23'),_0x3adf0c+'-'+_0x22204c+'/'+_0x5dddb4)[_0x8c14('0x1d')](_0x4578aa);}return null;};}function patchUpdates(_0x5e310c){return function(_0x247197){try{jsonpatch[_0x8c14('0x24')](_0x247197,_0x5e310c,!![]);}catch(_0xfa36be){return BPromise[_0x8c14('0x25')](_0xfa36be);}return _0x247197[_0x8c14('0x26')]();};}function saveUpdates(_0xd57b0,_0x29a181){return function(_0x4139cb){if(_0x4139cb){return _0x4139cb[_0x8c14('0x27')](_0xd57b0)[_0x8c14('0x28')](function(_0x18b712){return _0x18b712;});}return null;};}function removeEntity(_0x217103,_0x233a3e){return function(_0x2f044a){if(_0x2f044a){return _0x2f044a['destroy']()['then'](function(){_0x217103[_0x8c14('0x1b')](0xcc)[_0x8c14('0x1c')]();});}};}function handleEntityNotFound(_0x4c9c29,_0xb51740){return function(_0xa1ce33){if(!_0xa1ce33){_0x4c9c29[_0x8c14('0x1a')](0x194);}return _0xa1ce33;};}function handleError(_0xf88e0d,_0x2b2fff){_0x2b2fff=_0x2b2fff||0x1f4;return function(_0x5d078a){logger[_0x8c14('0x29')](_0x5d078a[_0x8c14('0x2a')]);if(_0x5d078a[_0x8c14('0x2b')]){delete _0x5d078a[_0x8c14('0x2b')];}_0xf88e0d[_0x8c14('0x1b')](_0x2b2fff)[_0x8c14('0x2c')](_0x5d078a);};}exports[_0x8c14('0x2d')]=function(_0x14e7b2,_0xc0d9a4){var _0x172e79={},_0x41682e={},_0x484fef={'count':0x0,'rows':[]};var _0x2f6bf4=_[_0x8c14('0x2e')](db['ServicenowConfiguration'][_0x8c14('0x2f')],function(_0x353463){return{'name':_0x353463[_0x8c14('0x30')],'type':_0x353463[_0x8c14('0x31')]['key']};});_0x41682e[_0x8c14('0x32')]=_[_0x8c14('0x2e')](_0x2f6bf4,_0x8c14('0x2b'));_0x41682e[_0x8c14('0x33')]=_[_0x8c14('0x34')](_0x14e7b2[_0x8c14('0x33')]);_0x41682e[_0x8c14('0x35')]=_[_0x8c14('0x36')](_0x41682e[_0x8c14('0x32')],_0x41682e[_0x8c14('0x33')]);_0x172e79['attributes']=_[_0x8c14('0x36')](_0x41682e[_0x8c14('0x32')],qs[_0x8c14('0x37')](_0x14e7b2[_0x8c14('0x33')][_0x8c14('0x37')]));_0x172e79['attributes']=_0x172e79[_0x8c14('0x38')][_0x8c14('0x39')]?_0x172e79[_0x8c14('0x38')]:_0x41682e[_0x8c14('0x32')];if(!_0x14e7b2[_0x8c14('0x33')]['hasOwnProperty'](_0x8c14('0x3a'))){_0x172e79[_0x8c14('0x20')]=qs[_0x8c14('0x20')](_0x14e7b2['query']['limit']);_0x172e79['offset']=qs['offset'](_0x14e7b2[_0x8c14('0x33')][_0x8c14('0x1e')]);}_0x172e79[_0x8c14('0x3b')]=qs[_0x8c14('0x3c')](_0x14e7b2['query'][_0x8c14('0x3c')]);_0x172e79[_0x8c14('0x3d')]=qs[_0x8c14('0x35')](_['pick'](_0x14e7b2[_0x8c14('0x33')],_0x41682e[_0x8c14('0x35')]),_0x2f6bf4);if(_0x14e7b2[_0x8c14('0x33')][_0x8c14('0x3e')]){_0x172e79[_0x8c14('0x3d')]=_[_0x8c14('0x3f')](_0x172e79[_0x8c14('0x3d')],{'$or':_[_0x8c14('0x2e')](_0x2f6bf4,function(_0x46381e){if(_0x46381e[_0x8c14('0x31')]!==_0x8c14('0x40')){var _0x5b842e={};_0x5b842e[_0x46381e[_0x8c14('0x2b')]]={'$like':'%'+_0x14e7b2[_0x8c14('0x33')][_0x8c14('0x3e')]+'%'};return _0x5b842e;}})});}_0x172e79=_[_0x8c14('0x3f')]({},_0x172e79,_0x14e7b2['options']);var _0x2bb041={'where':_0x172e79[_0x8c14('0x3d')]};return db[_0x8c14('0x41')][_0x8c14('0x21')](_0x2bb041)[_0x8c14('0x28')](function(_0x1b0114){_0x484fef['count']=_0x1b0114;if(_0x14e7b2[_0x8c14('0x33')]['includeAll']){_0x172e79[_0x8c14('0x42')]=[{'all':!![]}];}return db[_0x8c14('0x41')][_0x8c14('0x43')](_0x172e79);})[_0x8c14('0x28')](function(_0x313c02){_0x484fef['rows']=_0x313c02;return _0x484fef;})[_0x8c14('0x28')](respondWithFilteredResult(_0xc0d9a4,_0x172e79))['catch'](handleError(_0xc0d9a4,null));};exports[_0x8c14('0x44')]=function(_0x19de80,_0x50ba81){var _0x890958={'raw':![],'where':{'id':_0x19de80[_0x8c14('0x45')]['id']}},_0x4bc246={};_0x4bc246['model']=_[_0x8c14('0x34')](db[_0x8c14('0x41')]['rawAttributes']);_0x4bc246[_0x8c14('0x33')]=_[_0x8c14('0x34')](_0x19de80[_0x8c14('0x33')]);_0x4bc246[_0x8c14('0x35')]=_['intersection'](_0x4bc246[_0x8c14('0x32')],_0x4bc246['query']);_0x890958['attributes']=_[_0x8c14('0x36')](_0x4bc246['model'],qs[_0x8c14('0x37')](_0x19de80[_0x8c14('0x33')]['fields']));_0x890958[_0x8c14('0x38')]=_0x890958[_0x8c14('0x38')][_0x8c14('0x39')]?_0x890958[_0x8c14('0x38')]:_0x4bc246[_0x8c14('0x32')];if(_0x19de80[_0x8c14('0x33')]['includeAll']){_0x890958[_0x8c14('0x42')]=[{'all':!![]}];}_0x890958=_[_0x8c14('0x3f')]({},_0x890958,_0x19de80[_0x8c14('0x46')]);return db[_0x8c14('0x41')][_0x8c14('0x47')](_0x890958)[_0x8c14('0x28')](handleEntityNotFound(_0x50ba81,null))[_0x8c14('0x28')](respondWithResult(_0x50ba81,null))[_0x8c14('0x48')](handleError(_0x50ba81,null));};exports['create']=function(_0x4e2e78,_0xa1e26e){return db[_0x8c14('0x41')][_0x8c14('0x49')](_0x4e2e78['body'],{})[_0x8c14('0x28')](respondWithResult(_0xa1e26e,0xc9))[_0x8c14('0x48')](handleError(_0xa1e26e,null));};exports[_0x8c14('0x27')]=function(_0xc112ad,_0x4bd859){if(_0xc112ad['body']['id']){delete _0xc112ad['body']['id'];}return db[_0x8c14('0x41')][_0x8c14('0x47')]({'where':{'id':_0xc112ad[_0x8c14('0x45')]['id']}})['then'](handleEntityNotFound(_0x4bd859,null))[_0x8c14('0x28')](saveUpdates(_0xc112ad['body'],null))[_0x8c14('0x28')](respondWithResult(_0x4bd859,null))[_0x8c14('0x48')](handleError(_0x4bd859,null));};exports['destroy']=function(_0x7ce664,_0x4a18fd){return db['ServicenowConfiguration'][_0x8c14('0x47')]({'where':{'id':_0x7ce664[_0x8c14('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a18fd,null))[_0x8c14('0x28')](removeEntity(_0x4a18fd,null))[_0x8c14('0x48')](handleError(_0x4a18fd,null));};exports[_0x8c14('0x4a')]=function(_0x3d57c1,_0x5c95c5,_0x3f8070){var _0x5bc79a={};var _0xfb7e0b={};var _0x13c1a9;var _0x4b5adc;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x3d57c1['params']['id']}})['then'](handleEntityNotFound(_0x5c95c5,null))['then'](function(_0x26b27d){if(_0x26b27d){_0x13c1a9=_0x26b27d;_0xfb7e0b[_0x8c14('0x32')]=_[_0x8c14('0x34')](db[_0x8c14('0x4b')][_0x8c14('0x2f')]);_0xfb7e0b[_0x8c14('0x33')]=_[_0x8c14('0x34')](_0x3d57c1[_0x8c14('0x33')]);_0xfb7e0b[_0x8c14('0x35')]=_[_0x8c14('0x36')](_0xfb7e0b[_0x8c14('0x32')],_0xfb7e0b[_0x8c14('0x33')]);_0x5bc79a[_0x8c14('0x38')]=_['intersection'](_0xfb7e0b[_0x8c14('0x32')],qs[_0x8c14('0x37')](_0x3d57c1['query'][_0x8c14('0x37')]));_0x5bc79a[_0x8c14('0x38')]=_0x5bc79a[_0x8c14('0x38')][_0x8c14('0x39')]?_0x5bc79a[_0x8c14('0x38')]:_0xfb7e0b['model'];_0x5bc79a['order']=qs[_0x8c14('0x3c')](_0x3d57c1[_0x8c14('0x33')]['sort']);_0x5bc79a['where']=qs['filters'](_[_0x8c14('0x4c')](_0x3d57c1['query'],_0xfb7e0b[_0x8c14('0x35')]));if(_0x3d57c1[_0x8c14('0x33')][_0x8c14('0x3e')]){_0x5bc79a[_0x8c14('0x3d')]=_['merge'](_0x5bc79a['where'],{'$or':_['map'](_0x5bc79a['attributes'],function(_0x578e6b){var _0x2e109e={};_0x2e109e[_0x578e6b]={'$like':'%'+_0x3d57c1[_0x8c14('0x33')][_0x8c14('0x3e')]+'%'};return _0x2e109e;})});}_0x5bc79a=_[_0x8c14('0x3f')]({},_0x5bc79a,_0x3d57c1[_0x8c14('0x46')]);return _0x13c1a9[_0x8c14('0x4a')](_0x5bc79a);}})[_0x8c14('0x28')](function(_0x1f6d56){if(_0x1f6d56){_0x4b5adc=_0x1f6d56[_0x8c14('0x39')];if(!_0x3d57c1[_0x8c14('0x33')][_0x8c14('0x4d')](_0x8c14('0x3a'))){_0x5bc79a[_0x8c14('0x20')]=qs[_0x8c14('0x20')](_0x3d57c1[_0x8c14('0x33')][_0x8c14('0x20')]);_0x5bc79a[_0x8c14('0x1e')]=qs[_0x8c14('0x1e')](_0x3d57c1[_0x8c14('0x33')][_0x8c14('0x1e')]);}return _0x13c1a9['getFields'](_0x5bc79a);}})[_0x8c14('0x28')](function(_0x11c161){if(_0x11c161){return _0x11c161?{'count':_0x4b5adc,'rows':_0x11c161}:null;}})[_0x8c14('0x28')](respondWithResult(_0x5c95c5,null))[_0x8c14('0x48')](handleError(_0x5c95c5,null));};exports[_0x8c14('0x4e')]=function(_0x1f13a2,_0x415155,_0x4c861b){var _0x179aef={};var _0x253d0a={};var _0x5e2c90;var _0x157633;return db[_0x8c14('0x41')]['findOne']({'where':{'id':_0x1f13a2[_0x8c14('0x45')]['id']}})[_0x8c14('0x28')](handleEntityNotFound(_0x415155,null))['then'](function(_0x234989){if(_0x234989){_0x5e2c90=_0x234989;_0x253d0a['model']=_[_0x8c14('0x34')](db['ServicenowField'][_0x8c14('0x2f')]);_0x253d0a[_0x8c14('0x33')]=_[_0x8c14('0x34')](_0x1f13a2[_0x8c14('0x33')]);_0x253d0a['filters']=_[_0x8c14('0x36')](_0x253d0a[_0x8c14('0x32')],_0x253d0a[_0x8c14('0x33')]);_0x179aef[_0x8c14('0x38')]=_['intersection'](_0x253d0a['model'],qs[_0x8c14('0x37')](_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x37')]));_0x179aef['attributes']=_0x179aef['attributes'][_0x8c14('0x39')]?_0x179aef[_0x8c14('0x38')]:_0x253d0a[_0x8c14('0x32')];_0x179aef[_0x8c14('0x3b')]=qs['sort'](_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x3c')]);_0x179aef[_0x8c14('0x3d')]=qs['filters'](_['pick'](_0x1f13a2['query'],_0x253d0a[_0x8c14('0x35')]));if(_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x3e')]){_0x179aef[_0x8c14('0x3d')]=_[_0x8c14('0x3f')](_0x179aef['where'],{'$or':_[_0x8c14('0x2e')](_0x179aef[_0x8c14('0x38')],function(_0x4902ee){var _0x2ac52c={};_0x2ac52c[_0x4902ee]={'$like':'%'+_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x3e')]+'%'};return _0x2ac52c;})});}_0x179aef=_['merge']({},_0x179aef,_0x1f13a2[_0x8c14('0x46')]);return _0x5e2c90['getSubjects'](_0x179aef);}})[_0x8c14('0x28')](function(_0x217e0a){if(_0x217e0a){_0x157633=_0x217e0a[_0x8c14('0x39')];if(!_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x4d')]('nolimit')){_0x179aef['limit']=qs[_0x8c14('0x20')](_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x20')]);_0x179aef[_0x8c14('0x1e')]=qs[_0x8c14('0x1e')](_0x1f13a2[_0x8c14('0x33')]['offset']);}return _0x5e2c90[_0x8c14('0x4e')](_0x179aef);}})[_0x8c14('0x28')](function(_0x1e937a){if(_0x1e937a){return _0x1e937a?{'count':_0x157633,'rows':_0x1e937a}:null;}})['then'](respondWithResult(_0x415155,null))['catch'](handleError(_0x415155,null));};exports[_0x8c14('0x4f')]=function(_0x44672d,_0x90075f,_0xce9584){var _0x51f19c={};var _0xa61731={};var _0xa0cdca;var _0x1059a2;return db[_0x8c14('0x41')][_0x8c14('0x50')]({'where':{'id':_0x44672d[_0x8c14('0x45')]['id']}})['then'](handleEntityNotFound(_0x90075f,null))[_0x8c14('0x28')](function(_0x1784ac){if(_0x1784ac){_0xa0cdca=_0x1784ac;_0xa61731[_0x8c14('0x32')]=_[_0x8c14('0x34')](db[_0x8c14('0x4b')][_0x8c14('0x2f')]);_0xa61731['query']=_[_0x8c14('0x34')](_0x44672d['query']);_0xa61731[_0x8c14('0x35')]=_[_0x8c14('0x36')](_0xa61731[_0x8c14('0x32')],_0xa61731[_0x8c14('0x33')]);_0x51f19c[_0x8c14('0x38')]=_[_0x8c14('0x36')](_0xa61731[_0x8c14('0x32')],qs[_0x8c14('0x37')](_0x44672d['query'][_0x8c14('0x37')]));_0x51f19c[_0x8c14('0x38')]=_0x51f19c[_0x8c14('0x38')]['length']?_0x51f19c[_0x8c14('0x38')]:_0xa61731['model'];_0x51f19c[_0x8c14('0x3b')]=qs[_0x8c14('0x3c')](_0x44672d[_0x8c14('0x33')][_0x8c14('0x3c')]);_0x51f19c[_0x8c14('0x3d')]=qs['filters'](_[_0x8c14('0x4c')](_0x44672d[_0x8c14('0x33')],_0xa61731['filters']));if(_0x44672d[_0x8c14('0x33')][_0x8c14('0x3e')]){_0x51f19c['where']=_[_0x8c14('0x3f')](_0x51f19c['where'],{'$or':_[_0x8c14('0x2e')](_0x51f19c[_0x8c14('0x38')],function(_0x3e61cb){var _0x285229={};_0x285229[_0x3e61cb]={'$like':'%'+_0x44672d['query'][_0x8c14('0x3e')]+'%'};return _0x285229;})});}_0x51f19c=_[_0x8c14('0x3f')]({},_0x51f19c,_0x44672d[_0x8c14('0x46')]);return _0xa0cdca[_0x8c14('0x4f')](_0x51f19c);}})['then'](function(_0x4d08c6){if(_0x4d08c6){_0x1059a2=_0x4d08c6[_0x8c14('0x39')];if(!_0x44672d[_0x8c14('0x33')]['hasOwnProperty'](_0x8c14('0x3a'))){_0x51f19c[_0x8c14('0x20')]=qs['limit'](_0x44672d['query'][_0x8c14('0x20')]);_0x51f19c[_0x8c14('0x1e')]=qs[_0x8c14('0x1e')](_0x44672d[_0x8c14('0x33')]['offset']);}return _0xa0cdca['getDescriptions'](_0x51f19c);}})[_0x8c14('0x28')](function(_0x4d96b2){if(_0x4d96b2){return _0x4d96b2?{'count':_0x1059a2,'rows':_0x4d96b2}:null;}})['then'](respondWithResult(_0x90075f,null))[_0x8c14('0x48')](handleError(_0x90075f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 553d8e2..c4d0dbe 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ea9=['path','rimraf','./intServicenowConfiguration.attributes','define','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5dd510,_0x275e79){var _0x27f673=function(_0x20dc6b){while(--_0x20dc6b){_0x5dd510['push'](_0x5dd510['shift']());}};_0x27f673(++_0x275e79);}(_0x6ea9,0x89));var _0x96ea=function(_0x34fa73,_0x1d4c74){_0x34fa73=_0x34fa73-0x0;var _0x225647=_0x6ea9[_0x34fa73];return _0x225647;};'use strict';var _=require(_0x96ea('0x0'));var util=require(_0x96ea('0x1'));var logger=require(_0x96ea('0x2'))(_0x96ea('0x3'));var moment=require(_0x96ea('0x4'));var BPromise=require('bluebird');var rp=require(_0x96ea('0x5'));var fs=require('fs');var path=require(_0x96ea('0x6'));var rimraf=require(_0x96ea('0x7'));var config=require('../../config/environment');var attributes=require(_0x96ea('0x8'));module['exports']=function(_0x32cf31,_0x54e1b1){return _0x32cf31[_0x96ea('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x96ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f7b=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x4398fc,_0x341cb7){_0x4398fc=_0x4398fc-0x0;var _0x4922c4=_0x4f7b[_0x4398fc];return _0x4922c4;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var logger=require(_0xb4f7('0x2'))(_0xb4f7('0x3'));var moment=require('moment');var BPromise=require(_0xb4f7('0x4'));var rp=require(_0xb4f7('0x5'));var fs=require('fs');var path=require(_0xb4f7('0x6'));var rimraf=require(_0xb4f7('0x7'));var config=require(_0xb4f7('0x8'));var attributes=require(_0xb4f7('0x9'));module[_0xb4f7('0xa')]=function(_0x15443c,_0x4d2d83){return _0x15443c[_0xb4f7('0xb')]('ServicenowConfiguration',attributes,{'tableName':_0xb4f7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index a3bb457..ac2e3b1 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1cb9,0x14e));var _0x91cb=function(_0x29683c,_0x18891a){_0x29683c=_0x29683c-0x0;var _0x19cf30=_0x1cb9[_0x29683c];return _0x19cf30;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x5398=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x1bd425,_0x334d54){var _0x1e4f11=function(_0x31e0fa){while(--_0x31e0fa){_0x1bd425['push'](_0x1bd425['shift']());}};_0x1e4f11(++_0x334d54);}(_0x5398,0xe2));var _0x8539=function(_0x3cba36,_0x5eccbc){_0x3cba36=_0x3cba36-0x0;var _0x2866e2=_0x5398[_0x3cba36];return _0x2866e2;};'use strict';var _=require('lodash');var util=require(_0x8539('0x0'));var moment=require(_0x8539('0x1'));var BPromise=require(_0x8539('0x2'));var rs=require(_0x8539('0x3'));var fs=require('fs');var Redis=require(_0x8539('0x4'));var db=require(_0x8539('0x5'))['db'];var utils=require(_0x8539('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8539('0x7'));var jayson=require(_0x8539('0x8'));var client=jayson[_0x8539('0x9')][_0x8539('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28f25c,_0x30f2ab,_0x47c5be){return new BPromise(function(_0x1fad89,_0x3bf5c4){return client[_0x8539('0xb')](_0x28f25c,_0x47c5be)[_0x8539('0xc')](function(_0x2dda95){logger[_0x8539('0xd')](_0x8539('0xe'),_0x30f2ab,_0x8539('0xf'));logger[_0x8539('0x10')](_0x8539('0x11'),_0x30f2ab,'request\x20sent',JSON[_0x8539('0x12')](_0x2dda95));if(_0x2dda95[_0x8539('0x13')]){if(_0x2dda95[_0x8539('0x13')]['code']===0x1f4){logger[_0x8539('0x13')](_0x8539('0xe'),_0x30f2ab,_0x2dda95[_0x8539('0x13')][_0x8539('0x14')]);return _0x3bf5c4(_0x2dda95['error']['message']);}logger[_0x8539('0x13')](_0x8539('0xe'),_0x30f2ab,_0x2dda95[_0x8539('0x13')][_0x8539('0x14')]);return _0x1fad89(_0x2dda95[_0x8539('0x13')]['message']);}else{logger['info'](_0x8539('0xe'),_0x30f2ab,_0x8539('0xf'));_0x1fad89(_0x2dda95[_0x8539('0x15')][_0x8539('0x14')]);}})[_0x8539('0x16')](function(_0x29bf43){logger[_0x8539('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x30f2ab,_0x29bf43);_0x3bf5c4(_0x29bf43);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index d358c3e..826ef4c 100644 --- a/server/api/intServicenowField/index.js +++ b/server/api/intServicenowField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81a1=['delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','show','create','put','/:id','update'];(function(_0x527f48,_0x451eca){var _0x4b59c4=function(_0x30585f){while(--_0x30585f){_0x527f48['push'](_0x527f48['shift']());}};_0x4b59c4(++_0x451eca);}(_0x81a1,0xed));var _0x181a=function(_0x272952,_0x24884e){_0x272952=_0x272952-0x0;var _0x58853a=_0x81a1[_0x272952];return _0x58853a;};'use strict';var multer=require(_0x181a('0x0'));var util=require(_0x181a('0x1'));var path=require(_0x181a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x181a('0x3'));var auth=require(_0x181a('0x4'));var interaction=require(_0x181a('0x5'));var config=require(_0x181a('0x6'));var controller=require(_0x181a('0x7'));router['get']('/',auth[_0x181a('0x8')](),controller[_0x181a('0x9')]);router['get']('/:id',auth[_0x181a('0x8')](),controller[_0x181a('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x181a('0xb')]);router[_0x181a('0xc')](_0x181a('0xd'),auth['isAuthenticated'](),controller[_0x181a('0xe')]);router[_0x181a('0xf')]('/:id',auth[_0x181a('0x8')](),controller[_0x181a('0x10')]);module[_0x181a('0x11')]=router; \ No newline at end of file +var _0x2b98=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','put'];(function(_0x20c1c0,_0x382264){var _0x55241f=function(_0x23e42a){while(--_0x23e42a){_0x20c1c0['push'](_0x20c1c0['shift']());}};_0x55241f(++_0x382264);}(_0x2b98,0x169));var _0x82b9=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x2b98[_0x5d80de];return _0x1c7556;};'use strict';var multer=require(_0x82b9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x82b9('0x1'));var express=require(_0x82b9('0x2'));var router=express[_0x82b9('0x3')]();var fs_extra=require(_0x82b9('0x4'));var auth=require(_0x82b9('0x5'));var interaction=require(_0x82b9('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x82b9('0x7')]('/',auth[_0x82b9('0x8')](),controller[_0x82b9('0x9')]);router[_0x82b9('0x7')](_0x82b9('0xa'),auth[_0x82b9('0x8')](),controller[_0x82b9('0xb')]);router['post']('/',auth[_0x82b9('0x8')](),controller['create']);router[_0x82b9('0xc')](_0x82b9('0xa'),auth[_0x82b9('0x8')](),controller[_0x82b9('0xd')]);router[_0x82b9('0xe')](_0x82b9('0xa'),auth['isAuthenticated'](),controller[_0x82b9('0xf')]);module[_0x82b9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 77d37ff..1151f6d 100644 --- a/server/api/intServicenowField/intServicenowField.attributes.js +++ b/server/api/intServicenowField/intServicenowField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9ac=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','sequelize'];(function(_0x2f3195,_0xd55489){var _0x5a16fb=function(_0x3d1aad){while(--_0x3d1aad){_0x2f3195['push'](_0x2f3195['shift']());}};_0x5a16fb(++_0xd55489);}(_0xf9ac,0x11f));var _0xcf9a=function(_0x541c52,_0x1f9d5b){_0x541c52=_0x541c52-0x0;var _0x44d586=_0xf9ac[_0x541c52];return _0x44d586;};'use strict';var Sequelize=require(_0xcf9a('0x0'));module['exports']={'type':{'type':Sequelize[_0xcf9a('0x1')](_0xcf9a('0x2'),'variable',_0xcf9a('0x3'),_0xcf9a('0x4'),_0xcf9a('0x5')),'defaultValue':_0xcf9a('0x2')},'content':{'type':Sequelize[_0xcf9a('0x6')]},'key':{'type':Sequelize[_0xcf9a('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xcf9a('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xcf9a('0x6')]},'idField':{'type':Sequelize[_0xcf9a('0x6')]},'nameField':{'type':Sequelize[_0xcf9a('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcf9a('0x6')]}}; \ No newline at end of file +var _0x1a79=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x1ae7b0,_0x2301a2){var _0x2d83dc=function(_0x32a63f){while(--_0x32a63f){_0x1ae7b0['push'](_0x1ae7b0['shift']());}};_0x2d83dc(++_0x2301a2);}(_0x1a79,0x19b));var _0x91a7=function(_0x5d313a,_0x1a0bcf){_0x5d313a=_0x5d313a-0x0;var _0x5cf450=_0x1a79[_0x5d313a];return _0x5cf450;};'use strict';var Sequelize=require(_0x91a7('0x0'));module[_0x91a7('0x1')]={'type':{'type':Sequelize[_0x91a7('0x2')]('string',_0x91a7('0x3'),_0x91a7('0x4'),_0x91a7('0x5'),_0x91a7('0x6')),'defaultValue':_0x91a7('0x7')},'content':{'type':Sequelize[_0x91a7('0x8')]},'key':{'type':Sequelize[_0x91a7('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x91a7('0x3'),_0x91a7('0x4'))},'keyContent':{'type':Sequelize[_0x91a7('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x91a7('0x8')]},'customField':{'type':Sequelize[_0x91a7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x91a7('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index bbbccf8..1327ddf 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04df=['zip-dir','bluebird','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','ServicenowField','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','length','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','fields','create','body','find','params','rimraf'];(function(_0x41cb08,_0x17e68e){var _0x1bdfad=function(_0x5b3954){while(--_0x5b3954){_0x41cb08['push'](_0x41cb08['shift']());}};_0x1bdfad(++_0x17e68e);}(_0x04df,0x123));var _0xf04d=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x04df[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf04d('0x0'));var zipdir=require(_0xf04d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf04d('0x2'));var Mustache=require('mustache');var util=require(_0xf04d('0x3'));var path=require(_0xf04d('0x4'));var sox=require(_0xf04d('0x5'));var csv=require(_0xf04d('0x6'));var ejs=require(_0xf04d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf04d('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xf04d('0x9'));var toCsv=require(_0xf04d('0x6'));var querystring=require(_0xf04d('0xa'));var Papa=require('papaparse');var Redis=require(_0xf04d('0xb'));var authService=require(_0xf04d('0xc'));var qs=require(_0xf04d('0xd'));var as=require(_0xf04d('0xe'));var hardwareService=require(_0xf04d('0xf'));var logger=require(_0xf04d('0x10'))('api');var utils=require(_0xf04d('0x11'));var config=require(_0xf04d('0x12'));var licenseUtil=require(_0xf04d('0x13'));var db=require(_0xf04d('0x14'))['db'];function respondWithStatusCode(_0x4df492,_0x2f9f17){_0x2f9f17=_0x2f9f17||0xcc;return function(_0x250228){if(_0x250228){return _0x4df492[_0xf04d('0x15')](_0x2f9f17);}return _0x4df492['status'](_0x2f9f17)['end']();};}function respondWithResult(_0x37212b,_0x3f5a92){_0x3f5a92=_0x3f5a92||0xc8;return function(_0x2156a8){if(_0x2156a8){return _0x37212b['status'](_0x3f5a92)[_0xf04d('0x16')](_0x2156a8);}};}function respondWithFilteredResult(_0x20f745,_0x9596b6){return function(_0x4a6054){if(_0x4a6054){var _0x24dd37=typeof _0x9596b6['offset']===_0xf04d('0x17')&&typeof _0x9596b6[_0xf04d('0x18')]===_0xf04d('0x17');var _0x2d9fdd=_0x4a6054[_0xf04d('0x19')];var _0x22b7e0=_0x24dd37?0x0:_0x9596b6[_0xf04d('0x1a')];var _0x43d06d=_0x24dd37?_0x4a6054[_0xf04d('0x19')]:_0x9596b6[_0xf04d('0x1a')]+_0x9596b6[_0xf04d('0x18')];var _0x7285aa;if(_0x43d06d>=_0x2d9fdd){_0x43d06d=_0x2d9fdd;_0x7285aa=0xc8;}else{_0x7285aa=0xce;}_0x20f745[_0xf04d('0x1b')](_0x7285aa);return _0x20f745[_0xf04d('0x1c')](_0xf04d('0x1d'),_0x22b7e0+'-'+_0x43d06d+'/'+_0x2d9fdd)[_0xf04d('0x16')](_0x4a6054);}return null;};}function patchUpdates(_0x20c8ea){return function(_0x536961){try{jsonpatch[_0xf04d('0x1e')](_0x536961,_0x20c8ea,!![]);}catch(_0x2ab8af){return BPromise[_0xf04d('0x1f')](_0x2ab8af);}return _0x536961[_0xf04d('0x20')]();};}function saveUpdates(_0x46f984,_0x18fc2f){return function(_0x29bf4d){if(_0x29bf4d){return _0x29bf4d[_0xf04d('0x21')](_0x46f984)[_0xf04d('0x22')](function(_0x51391c){return _0x51391c;});}return null;};}function removeEntity(_0x51226d,_0xb0783){return function(_0xa4d7c9){if(_0xa4d7c9){return _0xa4d7c9[_0xf04d('0x23')]()[_0xf04d('0x22')](function(){_0x51226d['status'](0xcc)[_0xf04d('0x24')]();});}};}function handleEntityNotFound(_0x3d06b1,_0x11de43){return function(_0x3b220b){if(!_0x3b220b){_0x3d06b1[_0xf04d('0x15')](0x194);}return _0x3b220b;};}function handleError(_0x15a05b,_0xcce9c1){_0xcce9c1=_0xcce9c1||0x1f4;return function(_0x3649d8){logger[_0xf04d('0x25')](_0x3649d8[_0xf04d('0x26')]);if(_0x3649d8[_0xf04d('0x27')]){delete _0x3649d8[_0xf04d('0x27')];}_0x15a05b['status'](_0xcce9c1)[_0xf04d('0x28')](_0x3649d8);};}exports['index']=function(_0x3d58cb,_0x321ee5){var _0x5849ef={},_0x451aff={},_0x5f3be5={'count':0x0,'rows':[]};var _0x54c175=_['map'](db[_0xf04d('0x29')][_0xf04d('0x2a')],function(_0x2c322e){return{'name':_0x2c322e[_0xf04d('0x2b')],'type':_0x2c322e[_0xf04d('0x2c')][_0xf04d('0x2d')]};});_0x451aff['model']=_[_0xf04d('0x2e')](_0x54c175,'name');_0x451aff[_0xf04d('0x2f')]=_[_0xf04d('0x30')](_0x3d58cb['query']);_0x451aff['filters']=_[_0xf04d('0x31')](_0x451aff[_0xf04d('0x32')],_0x451aff[_0xf04d('0x2f')]);_0x5849ef['attributes']=_['intersection'](_0x451aff[_0xf04d('0x32')],qs['fields'](_0x3d58cb[_0xf04d('0x2f')]['fields']));_0x5849ef[_0xf04d('0x33')]=_0x5849ef[_0xf04d('0x33')][_0xf04d('0x34')]?_0x5849ef[_0xf04d('0x33')]:_0x451aff[_0xf04d('0x32')];if(!_0x3d58cb[_0xf04d('0x2f')]['hasOwnProperty']('nolimit')){_0x5849ef[_0xf04d('0x18')]=qs['limit'](_0x3d58cb[_0xf04d('0x2f')][_0xf04d('0x18')]);_0x5849ef['offset']=qs['offset'](_0x3d58cb[_0xf04d('0x2f')]['offset']);}_0x5849ef[_0xf04d('0x35')]=qs[_0xf04d('0x36')](_0x3d58cb[_0xf04d('0x2f')]['sort']);_0x5849ef[_0xf04d('0x37')]=qs[_0xf04d('0x38')](_[_0xf04d('0x39')](_0x3d58cb[_0xf04d('0x2f')],_0x451aff['filters']),_0x54c175);if(_0x3d58cb[_0xf04d('0x2f')]['filter']){_0x5849ef[_0xf04d('0x37')]=_['merge'](_0x5849ef[_0xf04d('0x37')],{'$or':_[_0xf04d('0x2e')](_0x54c175,function(_0x560155){if(_0x560155[_0xf04d('0x2c')]!==_0xf04d('0x3a')){var _0x395fbc={};_0x395fbc[_0x560155[_0xf04d('0x27')]]={'$like':'%'+_0x3d58cb[_0xf04d('0x2f')][_0xf04d('0x3b')]+'%'};return _0x395fbc;}})});}_0x5849ef=_[_0xf04d('0x3c')]({},_0x5849ef,_0x3d58cb[_0xf04d('0x3d')]);var _0x11b4a3={'where':_0x5849ef['where']};return db[_0xf04d('0x29')][_0xf04d('0x19')](_0x11b4a3)[_0xf04d('0x22')](function(_0x3815f7){_0x5f3be5[_0xf04d('0x19')]=_0x3815f7;if(_0x3d58cb[_0xf04d('0x2f')][_0xf04d('0x3e')]){_0x5849ef[_0xf04d('0x3f')]=[{'all':!![]}];}return db['ServicenowField'][_0xf04d('0x40')](_0x5849ef);})[_0xf04d('0x22')](function(_0x370b52){_0x5f3be5[_0xf04d('0x41')]=_0x370b52;return _0x5f3be5;})[_0xf04d('0x22')](respondWithFilteredResult(_0x321ee5,_0x5849ef))[_0xf04d('0x42')](handleError(_0x321ee5,null));};exports[_0xf04d('0x43')]=function(_0x36b45a,_0x442ffe){var _0x20b020={'raw':!![],'where':{'id':_0x36b45a['params']['id']}},_0x2e10fe={};_0x2e10fe[_0xf04d('0x32')]=_['keys'](db[_0xf04d('0x29')][_0xf04d('0x2a')]);_0x2e10fe[_0xf04d('0x2f')]=_[_0xf04d('0x30')](_0x36b45a[_0xf04d('0x2f')]);_0x2e10fe[_0xf04d('0x38')]=_[_0xf04d('0x31')](_0x2e10fe[_0xf04d('0x32')],_0x2e10fe[_0xf04d('0x2f')]);_0x20b020[_0xf04d('0x33')]=_[_0xf04d('0x31')](_0x2e10fe[_0xf04d('0x32')],qs[_0xf04d('0x44')](_0x36b45a[_0xf04d('0x2f')][_0xf04d('0x44')]));_0x20b020[_0xf04d('0x33')]=_0x20b020['attributes']['length']?_0x20b020[_0xf04d('0x33')]:_0x2e10fe[_0xf04d('0x32')];if(_0x36b45a[_0xf04d('0x2f')][_0xf04d('0x3e')]){_0x20b020['include']=[{'all':!![]}];}_0x20b020=_[_0xf04d('0x3c')]({},_0x20b020,_0x36b45a['options']);return db['ServicenowField']['find'](_0x20b020)[_0xf04d('0x22')](handleEntityNotFound(_0x442ffe,null))[_0xf04d('0x22')](respondWithResult(_0x442ffe,null))['catch'](handleError(_0x442ffe,null));};exports[_0xf04d('0x45')]=function(_0x3ecc44,_0x344ec1){return db[_0xf04d('0x29')][_0xf04d('0x45')](_0x3ecc44['body'],{})[_0xf04d('0x22')](respondWithResult(_0x344ec1,0xc9))[_0xf04d('0x42')](handleError(_0x344ec1,null));};exports[_0xf04d('0x21')]=function(_0x2e2779,_0x3d76cc){if(_0x2e2779[_0xf04d('0x46')]['id']){delete _0x2e2779[_0xf04d('0x46')]['id'];}return db[_0xf04d('0x29')][_0xf04d('0x47')]({'where':{'id':_0x2e2779['params']['id']}})[_0xf04d('0x22')](handleEntityNotFound(_0x3d76cc,null))[_0xf04d('0x22')](saveUpdates(_0x2e2779[_0xf04d('0x46')],null))['then'](respondWithResult(_0x3d76cc,null))[_0xf04d('0x42')](handleError(_0x3d76cc,null));};exports[_0xf04d('0x23')]=function(_0x56f217,_0x479bd5){return db[_0xf04d('0x29')][_0xf04d('0x47')]({'where':{'id':_0x56f217[_0xf04d('0x48')]['id']}})['then'](handleEntityNotFound(_0x479bd5,null))[_0xf04d('0x22')](removeEntity(_0x479bd5,null))[_0xf04d('0x42')](handleError(_0x479bd5,null));}; \ No newline at end of file +var _0x0e9e=['zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','ServicenowField','includeAll','include','findAll','rows','catch','params','intersection','length','find','create','body','eml-format','rimraf'];(function(_0x5adeab,_0x3ddf5f){var _0x147201=function(_0x4459a5){while(--_0x4459a5){_0x5adeab['push'](_0x5adeab['shift']());}};_0x147201(++_0x3ddf5f);}(_0x0e9e,0x1ba));var _0xe0e9=function(_0x3c7079,_0x1d505b){_0x3c7079=_0x3c7079-0x0;var _0x5f2bd6=_0x0e9e[_0x3c7079];return _0x5f2bd6;};'use strict';var emlformat=require(_0xe0e9('0x0'));var rimraf=require(_0xe0e9('0x1'));var zipdir=require(_0xe0e9('0x2'));var jsonpatch=require(_0xe0e9('0x3'));var rp=require(_0xe0e9('0x4'));var moment=require('moment');var BPromise=require(_0xe0e9('0x5'));var Mustache=require('mustache');var util=require(_0xe0e9('0x6'));var path=require(_0xe0e9('0x7'));var sox=require(_0xe0e9('0x8'));var csv=require(_0xe0e9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0e9('0xa'));var _=require(_0xe0e9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0e9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe0e9('0x9'));var querystring=require(_0xe0e9('0xd'));var Papa=require(_0xe0e9('0xe'));var Redis=require(_0xe0e9('0xf'));var authService=require(_0xe0e9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe0e9('0x11'));var hardwareService=require(_0xe0e9('0x12'));var logger=require(_0xe0e9('0x13'))(_0xe0e9('0x14'));var utils=require(_0xe0e9('0x15'));var config=require(_0xe0e9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0e9('0x17'))['db'];function respondWithStatusCode(_0x465bec,_0x11293a){_0x11293a=_0x11293a||0xcc;return function(_0x542303){if(_0x542303){return _0x465bec[_0xe0e9('0x18')](_0x11293a);}return _0x465bec[_0xe0e9('0x19')](_0x11293a)['end']();};}function respondWithResult(_0xfe4c52,_0xe27edc){_0xe27edc=_0xe27edc||0xc8;return function(_0x296bd9){if(_0x296bd9){return _0xfe4c52['status'](_0xe27edc)[_0xe0e9('0x1a')](_0x296bd9);}};}function respondWithFilteredResult(_0x1ed504,_0xffe0ab){return function(_0x356a0a){if(_0x356a0a){var _0xc3298d=typeof _0xffe0ab[_0xe0e9('0x1b')]==='undefined'&&typeof _0xffe0ab[_0xe0e9('0x1c')]===_0xe0e9('0x1d');var _0xecae2b=_0x356a0a[_0xe0e9('0x1e')];var _0x3b24cc=_0xc3298d?0x0:_0xffe0ab[_0xe0e9('0x1b')];var _0x1f9492=_0xc3298d?_0x356a0a[_0xe0e9('0x1e')]:_0xffe0ab[_0xe0e9('0x1b')]+_0xffe0ab[_0xe0e9('0x1c')];var _0x2bb5f0;if(_0x1f9492>=_0xecae2b){_0x1f9492=_0xecae2b;_0x2bb5f0=0xc8;}else{_0x2bb5f0=0xce;}_0x1ed504[_0xe0e9('0x19')](_0x2bb5f0);return _0x1ed504[_0xe0e9('0x1f')](_0xe0e9('0x20'),_0x3b24cc+'-'+_0x1f9492+'/'+_0xecae2b)[_0xe0e9('0x1a')](_0x356a0a);}return null;};}function patchUpdates(_0x306af3){return function(_0x30cb6b){try{jsonpatch[_0xe0e9('0x21')](_0x30cb6b,_0x306af3,!![]);}catch(_0x35b5db){return BPromise[_0xe0e9('0x22')](_0x35b5db);}return _0x30cb6b[_0xe0e9('0x23')]();};}function saveUpdates(_0x4fb830,_0x2821c4){return function(_0xcac505){if(_0xcac505){return _0xcac505[_0xe0e9('0x24')](_0x4fb830)[_0xe0e9('0x25')](function(_0x3faafe){return _0x3faafe;});}return null;};}function removeEntity(_0x10397b,_0x416f42){return function(_0x3ca411){if(_0x3ca411){return _0x3ca411[_0xe0e9('0x26')]()[_0xe0e9('0x25')](function(){_0x10397b[_0xe0e9('0x19')](0xcc)[_0xe0e9('0x27')]();});}};}function handleEntityNotFound(_0x1d22e3,_0x44138b){return function(_0x40e6bf){if(!_0x40e6bf){_0x1d22e3[_0xe0e9('0x18')](0x194);}return _0x40e6bf;};}function handleError(_0x14332e,_0x123a11){_0x123a11=_0x123a11||0x1f4;return function(_0x2b00b9){logger['error'](_0x2b00b9[_0xe0e9('0x28')]);if(_0x2b00b9[_0xe0e9('0x29')]){delete _0x2b00b9[_0xe0e9('0x29')];}_0x14332e['status'](_0x123a11)['send'](_0x2b00b9);};}exports[_0xe0e9('0x2a')]=function(_0x4b13a0,_0x2f383e){var _0x248dc5={},_0x1932c3={},_0x11573c={'count':0x0,'rows':[]};var _0x26cfa6=_[_0xe0e9('0x2b')](db['ServicenowField'][_0xe0e9('0x2c')],function(_0x1aa216){return{'name':_0x1aa216[_0xe0e9('0x2d')],'type':_0x1aa216[_0xe0e9('0x2e')][_0xe0e9('0x2f')]};});_0x1932c3[_0xe0e9('0x30')]=_[_0xe0e9('0x2b')](_0x26cfa6,'name');_0x1932c3['query']=_[_0xe0e9('0x31')](_0x4b13a0['query']);_0x1932c3[_0xe0e9('0x32')]=_['intersection'](_0x1932c3['model'],_0x1932c3[_0xe0e9('0x33')]);_0x248dc5['attributes']=_['intersection'](_0x1932c3['model'],qs[_0xe0e9('0x34')](_0x4b13a0[_0xe0e9('0x33')][_0xe0e9('0x34')]));_0x248dc5[_0xe0e9('0x35')]=_0x248dc5['attributes']['length']?_0x248dc5[_0xe0e9('0x35')]:_0x1932c3['model'];if(!_0x4b13a0[_0xe0e9('0x33')]['hasOwnProperty'](_0xe0e9('0x36'))){_0x248dc5[_0xe0e9('0x1c')]=qs[_0xe0e9('0x1c')](_0x4b13a0[_0xe0e9('0x33')][_0xe0e9('0x1c')]);_0x248dc5[_0xe0e9('0x1b')]=qs[_0xe0e9('0x1b')](_0x4b13a0[_0xe0e9('0x33')]['offset']);}_0x248dc5[_0xe0e9('0x37')]=qs[_0xe0e9('0x38')](_0x4b13a0[_0xe0e9('0x33')][_0xe0e9('0x38')]);_0x248dc5[_0xe0e9('0x39')]=qs[_0xe0e9('0x32')](_[_0xe0e9('0x3a')](_0x4b13a0[_0xe0e9('0x33')],_0x1932c3[_0xe0e9('0x32')]),_0x26cfa6);if(_0x4b13a0['query'][_0xe0e9('0x3b')]){_0x248dc5[_0xe0e9('0x39')]=_[_0xe0e9('0x3c')](_0x248dc5[_0xe0e9('0x39')],{'$or':_[_0xe0e9('0x2b')](_0x26cfa6,function(_0x5a290f){if(_0x5a290f[_0xe0e9('0x2e')]!=='VIRTUAL'){var _0x2c3a42={};_0x2c3a42[_0x5a290f[_0xe0e9('0x29')]]={'$like':'%'+_0x4b13a0[_0xe0e9('0x33')][_0xe0e9('0x3b')]+'%'};return _0x2c3a42;}})});}_0x248dc5=_['merge']({},_0x248dc5,_0x4b13a0[_0xe0e9('0x3d')]);var _0x1577a0={'where':_0x248dc5['where']};return db[_0xe0e9('0x3e')][_0xe0e9('0x1e')](_0x1577a0)['then'](function(_0x5eabc4){_0x11573c[_0xe0e9('0x1e')]=_0x5eabc4;if(_0x4b13a0['query'][_0xe0e9('0x3f')]){_0x248dc5[_0xe0e9('0x40')]=[{'all':!![]}];}return db[_0xe0e9('0x3e')][_0xe0e9('0x41')](_0x248dc5);})[_0xe0e9('0x25')](function(_0xd4edd0){_0x11573c[_0xe0e9('0x42')]=_0xd4edd0;return _0x11573c;})[_0xe0e9('0x25')](respondWithFilteredResult(_0x2f383e,_0x248dc5))[_0xe0e9('0x43')](handleError(_0x2f383e,null));};exports['show']=function(_0x1f5f91,_0x17e222){var _0x4fd087={'raw':!![],'where':{'id':_0x1f5f91[_0xe0e9('0x44')]['id']}},_0x16fee3={};_0x16fee3[_0xe0e9('0x30')]=_[_0xe0e9('0x31')](db['ServicenowField'][_0xe0e9('0x2c')]);_0x16fee3['query']=_[_0xe0e9('0x31')](_0x1f5f91[_0xe0e9('0x33')]);_0x16fee3[_0xe0e9('0x32')]=_['intersection'](_0x16fee3['model'],_0x16fee3['query']);_0x4fd087[_0xe0e9('0x35')]=_[_0xe0e9('0x45')](_0x16fee3[_0xe0e9('0x30')],qs['fields'](_0x1f5f91[_0xe0e9('0x33')][_0xe0e9('0x34')]));_0x4fd087[_0xe0e9('0x35')]=_0x4fd087[_0xe0e9('0x35')][_0xe0e9('0x46')]?_0x4fd087['attributes']:_0x16fee3[_0xe0e9('0x30')];if(_0x1f5f91[_0xe0e9('0x33')]['includeAll']){_0x4fd087[_0xe0e9('0x40')]=[{'all':!![]}];}_0x4fd087=_[_0xe0e9('0x3c')]({},_0x4fd087,_0x1f5f91[_0xe0e9('0x3d')]);return db['ServicenowField'][_0xe0e9('0x47')](_0x4fd087)['then'](handleEntityNotFound(_0x17e222,null))[_0xe0e9('0x25')](respondWithResult(_0x17e222,null))[_0xe0e9('0x43')](handleError(_0x17e222,null));};exports['create']=function(_0x16741f,_0x1065b5){return db[_0xe0e9('0x3e')][_0xe0e9('0x48')](_0x16741f[_0xe0e9('0x49')],{})[_0xe0e9('0x25')](respondWithResult(_0x1065b5,0xc9))['catch'](handleError(_0x1065b5,null));};exports[_0xe0e9('0x24')]=function(_0x43e924,_0x37ce88){if(_0x43e924['body']['id']){delete _0x43e924[_0xe0e9('0x49')]['id'];}return db[_0xe0e9('0x3e')][_0xe0e9('0x47')]({'where':{'id':_0x43e924['params']['id']}})['then'](handleEntityNotFound(_0x37ce88,null))[_0xe0e9('0x25')](saveUpdates(_0x43e924['body'],null))[_0xe0e9('0x25')](respondWithResult(_0x37ce88,null))[_0xe0e9('0x43')](handleError(_0x37ce88,null));};exports[_0xe0e9('0x26')]=function(_0x1406aa,_0x2c234f){return db[_0xe0e9('0x3e')][_0xe0e9('0x47')]({'where':{'id':_0x1406aa['params']['id']}})[_0xe0e9('0x25')](handleEntityNotFound(_0x2c234f,null))[_0xe0e9('0x25')](removeEntity(_0x2c234f,null))['catch'](handleError(_0x2c234f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 490365a..6561023 100644 --- a/server/api/intServicenowField/intServicenowField.model.js +++ b/server/api/intServicenowField/intServicenowField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2164=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0x2164,0x1f4));var _0x4216=function(_0x3aac9c,_0x94989){_0x3aac9c=_0x3aac9c-0x0;var _0x5672bc=_0x2164[_0x3aac9c];return _0x5672bc;};'use strict';var _=require(_0x4216('0x0'));var util=require('util');var logger=require(_0x4216('0x1'))(_0x4216('0x2'));var moment=require('moment');var BPromise=require(_0x4216('0x3'));var rp=require(_0x4216('0x4'));var fs=require('fs');var path=require(_0x4216('0x5'));var rimraf=require(_0x4216('0x6'));var config=require(_0x4216('0x7'));var attributes=require(_0x4216('0x8'));module[_0x4216('0x9')]=function(_0x31e199,_0x1e103d){return _0x31e199['define'](_0x4216('0xa'),attributes,{'tableName':_0x4216('0xb'),'paranoid':![],'indexes':[{'name':_0x4216('0xc'),'fields':[_0x4216('0xd'),_0x4216('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbddb=['api','moment','bluebird','request-promise','path','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','util'];(function(_0xaa0679,_0x8f4bcb){var _0x3ff0a7=function(_0x3b66e8){while(--_0x3b66e8){_0xaa0679['push'](_0xaa0679['shift']());}};_0x3ff0a7(++_0x8f4bcb);}(_0xbddb,0x11d));var _0xbbdd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbddb[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xbbdd('0x0'));var logger=require('../../config/logger')(_0xbbdd('0x1'));var moment=require(_0xbbdd('0x2'));var BPromise=require(_0xbbdd('0x3'));var rp=require(_0xbbdd('0x4'));var fs=require('fs');var path=require(_0xbbdd('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbbdd('0x6'));module[_0xbbdd('0x7')]=function(_0x4a52b9,_0x2b2b98){return _0x4a52b9[_0xbbdd('0x8')](_0xbbdd('0x9'),attributes,{'tableName':_0xbbdd('0xa'),'paranoid':![],'indexes':[{'name':_0xbbdd('0xb'),'fields':['idField',_0xbbdd('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index d381e1e..25a6e6e 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x2bc1ae,_0x32cdf3){var _0x22af74=function(_0x238a25){while(--_0x238a25){_0x2bc1ae['push'](_0x2bc1ae['shift']());}};_0x22af74(++_0x32cdf3);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x129b5d,_0x5e453b){_0x129b5d=_0x129b5d-0x0;var _0x32a64a=_0x9ffd[_0x129b5d];return _0x32a64a;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x32f70b,_0x26430f){var _0x5cb010=function(_0x50228e){while(--_0x50228e){_0x32f70b['push'](_0x32f70b['shift']());}};_0x5cb010(++_0x26430f);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x6c176,_0x14e00b){_0x6c176=_0x6c176-0x0;var _0x11fa0d=_0x9ffd[_0x6c176];return _0x11fa0d;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 5a1c310..7d550ee 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2e4620,_0x3edc0a){var _0x3a2743=function(_0x946371){while(--_0x946371){_0x2e4620['push'](_0x2e4620['shift']());}};_0x3a2743(++_0x3edc0a);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1109f3,_0x10333e){var _0x552b03=function(_0x1cc982){while(--_0x1cc982){_0x1109f3['push'](_0x1109f3['shift']());}};_0x552b03(++_0x10333e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index c6f8c46..22adebe 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0xe27162,_0xf4da2d){var _0x2348df=function(_0x3a4ede){while(--_0x3a4ede){_0xe27162['push'](_0xe27162['shift']());}};_0x2348df(++_0xf4da2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4700b9,_0x58879a){var _0xf9a14d=function(_0x4be797){while(--_0x4be797){_0x4700b9['push'](_0x4700b9['shift']());}};_0xf9a14d(++_0x58879a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 0f3720c..a17ffc6 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd26c=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','SugarcrmAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','substring','lastIndexOf','POST','%s%s','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf'];(function(_0x25dc1f,_0xfc1d99){var _0x503f8e=function(_0xd63498){while(--_0xd63498){_0x25dc1f['push'](_0x25dc1f['shift']());}};_0x503f8e(++_0xfc1d99);}(_0xd26c,0x1e6));var _0xcd26=function(_0x325c11,_0x2169b6){_0x325c11=_0x325c11-0x0;var _0x5bfb18=_0xd26c[_0x325c11];return _0x5bfb18;};'use strict';var emlformat=require(_0xcd26('0x0'));var rimraf=require(_0xcd26('0x1'));var zipdir=require(_0xcd26('0x2'));var jsonpatch=require(_0xcd26('0x3'));var rp=require(_0xcd26('0x4'));var moment=require(_0xcd26('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcd26('0x6'));var util=require(_0xcd26('0x7'));var path=require(_0xcd26('0x8'));var sox=require(_0xcd26('0x9'));var csv=require(_0xcd26('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd26('0xb'));var _=require(_0xcd26('0xc'));var squel=require(_0xcd26('0xd'));var crypto=require(_0xcd26('0xe'));var jsforce=require(_0xcd26('0xf'));var deskjs=require(_0xcd26('0x10'));var toCsv=require(_0xcd26('0xa'));var querystring=require(_0xcd26('0x11'));var Papa=require(_0xcd26('0x12'));var Redis=require(_0xcd26('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd26('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xcd26('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd26('0x16'))['db'];var integrations=require(_0xcd26('0x17'));function respondWithStatusCode(_0x5860b3,_0x26c10a){_0x26c10a=_0x26c10a||0xcc;return function(_0x2588f3){if(_0x2588f3){return _0x5860b3[_0xcd26('0x18')](_0x26c10a);}return _0x5860b3[_0xcd26('0x19')](_0x26c10a)[_0xcd26('0x1a')]();};}function respondWithResult(_0x2b807b,_0x18cf70){_0x18cf70=_0x18cf70||0xc8;return function(_0x1e4844){if(_0x1e4844){return _0x2b807b[_0xcd26('0x19')](_0x18cf70)[_0xcd26('0x1b')](_0x1e4844);}};}function respondWithFilteredResult(_0x55f63f,_0x39acbd){return function(_0x13e7a0){if(_0x13e7a0){var _0x33f159=typeof _0x39acbd[_0xcd26('0x1c')]===_0xcd26('0x1d')&&typeof _0x39acbd['limit']==='undefined';var _0x528dcd=_0x13e7a0[_0xcd26('0x1e')];var _0x31da5f=_0x33f159?0x0:_0x39acbd[_0xcd26('0x1c')];var _0x5ba2da=_0x33f159?_0x13e7a0[_0xcd26('0x1e')]:_0x39acbd[_0xcd26('0x1c')]+_0x39acbd['limit'];var _0x31c492;if(_0x5ba2da>=_0x528dcd){_0x5ba2da=_0x528dcd;_0x31c492=0xc8;}else{_0x31c492=0xce;}_0x55f63f['status'](_0x31c492);return _0x55f63f[_0xcd26('0x1f')](_0xcd26('0x20'),_0x31da5f+'-'+_0x5ba2da+'/'+_0x528dcd)[_0xcd26('0x1b')](_0x13e7a0);}return null;};}function patchUpdates(_0x1a2d69){return function(_0xe451db){try{jsonpatch['apply'](_0xe451db,_0x1a2d69,!![]);}catch(_0x41828f){return BPromise[_0xcd26('0x21')](_0x41828f);}return _0xe451db[_0xcd26('0x22')]();};}function saveUpdates(_0x4e3ed9,_0x10db97){return function(_0x59b4f3){if(_0x59b4f3){return _0x59b4f3[_0xcd26('0x23')](_0x4e3ed9)[_0xcd26('0x24')](function(_0x41c10b){return _0x41c10b;});}return null;};}function removeEntity(_0x375f0d,_0x10c5c5){return function(_0x13aa3d){if(_0x13aa3d){return _0x13aa3d[_0xcd26('0x25')]()[_0xcd26('0x24')](function(){_0x375f0d[_0xcd26('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x375c79,_0x94b71a){return function(_0x4aa055){if(!_0x4aa055){_0x375c79[_0xcd26('0x18')](0x194);}return _0x4aa055;};}function handleError(_0x1c0c0c,_0x63807b){_0x63807b=_0x63807b||0x1f4;return function(_0x22c690){logger[_0xcd26('0x26')](_0x22c690[_0xcd26('0x27')]);if(_0x22c690[_0xcd26('0x28')]){delete _0x22c690[_0xcd26('0x28')];}_0x1c0c0c['status'](_0x63807b)['send'](_0x22c690);};}exports[_0xcd26('0x29')]=function(_0x496ea6,_0x581d45){var _0x4c5095={},_0x5522f4={},_0x36ea14={'count':0x0,'rows':[]};var _0x33f943=_['map'](db[_0xcd26('0x2a')][_0xcd26('0x2b')],function(_0x3ee6fc){return{'name':_0x3ee6fc[_0xcd26('0x2c')],'type':_0x3ee6fc[_0xcd26('0x2d')][_0xcd26('0x2e')]};});_0x5522f4['model']=_[_0xcd26('0x2f')](_0x33f943,_0xcd26('0x28'));_0x5522f4[_0xcd26('0x30')]=_[_0xcd26('0x31')](_0x496ea6[_0xcd26('0x30')]);_0x5522f4[_0xcd26('0x32')]=_[_0xcd26('0x33')](_0x5522f4[_0xcd26('0x34')],_0x5522f4[_0xcd26('0x30')]);_0x4c5095[_0xcd26('0x35')]=_[_0xcd26('0x33')](_0x5522f4['model'],qs[_0xcd26('0x36')](_0x496ea6[_0xcd26('0x30')][_0xcd26('0x36')]));_0x4c5095[_0xcd26('0x35')]=_0x4c5095['attributes'][_0xcd26('0x37')]?_0x4c5095[_0xcd26('0x35')]:_0x5522f4[_0xcd26('0x34')];if(!_0x496ea6[_0xcd26('0x30')]['hasOwnProperty'](_0xcd26('0x38'))){_0x4c5095[_0xcd26('0x39')]=qs[_0xcd26('0x39')](_0x496ea6[_0xcd26('0x30')][_0xcd26('0x39')]);_0x4c5095[_0xcd26('0x1c')]=qs[_0xcd26('0x1c')](_0x496ea6[_0xcd26('0x30')][_0xcd26('0x1c')]);}_0x4c5095[_0xcd26('0x3a')]=qs[_0xcd26('0x3b')](_0x496ea6[_0xcd26('0x30')][_0xcd26('0x3b')]);_0x4c5095[_0xcd26('0x3c')]=qs['filters'](_[_0xcd26('0x3d')](_0x496ea6['query'],_0x5522f4[_0xcd26('0x32')]),_0x33f943);if(_0x496ea6[_0xcd26('0x30')][_0xcd26('0x3e')]){_0x4c5095['where']=_[_0xcd26('0x3f')](_0x4c5095[_0xcd26('0x3c')],{'$or':_['map'](_0x33f943,function(_0x30a01c){if(_0x30a01c[_0xcd26('0x2d')]!==_0xcd26('0x40')){var _0x168f43={};_0x168f43[_0x30a01c[_0xcd26('0x28')]]={'$like':'%'+_0x496ea6[_0xcd26('0x30')][_0xcd26('0x3e')]+'%'};return _0x168f43;}})});}_0x4c5095=_[_0xcd26('0x3f')]({},_0x4c5095,_0x496ea6[_0xcd26('0x41')]);var _0x5d28aa={'where':_0x4c5095[_0xcd26('0x3c')]};return db[_0xcd26('0x2a')][_0xcd26('0x1e')](_0x5d28aa)['then'](function(_0x1c2bd8){_0x36ea14['count']=_0x1c2bd8;if(_0x496ea6['query'][_0xcd26('0x42')]){_0x4c5095[_0xcd26('0x43')]=[{'all':!![]}];}return db[_0xcd26('0x2a')][_0xcd26('0x44')](_0x4c5095);})['then'](function(_0x5b72b1){_0x36ea14['rows']=_0x5b72b1;return _0x36ea14;})[_0xcd26('0x24')](respondWithFilteredResult(_0x581d45,_0x4c5095))[_0xcd26('0x45')](handleError(_0x581d45,null));};exports['show']=function(_0x417aad,_0x64c23e){var _0x5b99df={'raw':![],'where':{'id':_0x417aad[_0xcd26('0x46')]['id']}},_0x4b3d3b={};_0x4b3d3b['model']=_[_0xcd26('0x31')](db[_0xcd26('0x2a')]['rawAttributes']);_0x4b3d3b[_0xcd26('0x30')]=_[_0xcd26('0x31')](_0x417aad[_0xcd26('0x30')]);_0x4b3d3b[_0xcd26('0x32')]=_['intersection'](_0x4b3d3b[_0xcd26('0x34')],_0x4b3d3b[_0xcd26('0x30')]);_0x5b99df['attributes']=_[_0xcd26('0x33')](_0x4b3d3b[_0xcd26('0x34')],qs[_0xcd26('0x36')](_0x417aad[_0xcd26('0x30')][_0xcd26('0x36')]));_0x5b99df[_0xcd26('0x35')]=_0x5b99df['attributes']['length']?_0x5b99df[_0xcd26('0x35')]:_0x4b3d3b['model'];if(_0x417aad[_0xcd26('0x30')][_0xcd26('0x42')]){_0x5b99df[_0xcd26('0x43')]=[{'all':!![]}];}_0x5b99df=_[_0xcd26('0x3f')]({},_0x5b99df,_0x417aad[_0xcd26('0x41')]);return db[_0xcd26('0x2a')][_0xcd26('0x47')](_0x5b99df)['then'](handleEntityNotFound(_0x64c23e,null))[_0xcd26('0x24')](respondWithResult(_0x64c23e,null))[_0xcd26('0x45')](handleError(_0x64c23e,null));};exports[_0xcd26('0x48')]=function(_0xb47706,_0x2797a5){return db['SugarcrmAccount'][_0xcd26('0x48')](_0xb47706[_0xcd26('0x49')],{})[_0xcd26('0x24')](respondWithResult(_0x2797a5,0xc9))[_0xcd26('0x45')](handleError(_0x2797a5,null));};exports['update']=function(_0x48bab4,_0x1bc67d){if(_0x48bab4[_0xcd26('0x49')]['id']){delete _0x48bab4[_0xcd26('0x49')]['id'];}return db['SugarcrmAccount'][_0xcd26('0x47')]({'where':{'id':_0x48bab4[_0xcd26('0x46')]['id']}})[_0xcd26('0x24')](handleEntityNotFound(_0x1bc67d,null))[_0xcd26('0x24')](saveUpdates(_0x48bab4[_0xcd26('0x49')],null))['then'](respondWithResult(_0x1bc67d,null))['catch'](handleError(_0x1bc67d,null));};exports[_0xcd26('0x25')]=function(_0xb42a0f,_0x3f6285){return db[_0xcd26('0x2a')]['find']({'where':{'id':_0xb42a0f[_0xcd26('0x46')]['id']}})[_0xcd26('0x24')](handleEntityNotFound(_0x3f6285,null))[_0xcd26('0x24')](removeEntity(_0x3f6285,null))[_0xcd26('0x45')](handleError(_0x3f6285,null));};exports[_0xcd26('0x4a')]=function(_0x5596ea,_0x4eb966,_0x2be32d){var _0x21b695={};var _0x1072b7={};var _0x41cef0;var _0x181e50;return db[_0xcd26('0x2a')][_0xcd26('0x4b')]({'where':{'id':_0x5596ea[_0xcd26('0x46')]['id']}})['then'](handleEntityNotFound(_0x4eb966,null))[_0xcd26('0x24')](function(_0x48e16f){if(_0x48e16f){_0x41cef0=_0x48e16f;_0x1072b7['model']=_[_0xcd26('0x31')](db[_0xcd26('0x4c')][_0xcd26('0x2b')]);_0x1072b7[_0xcd26('0x30')]=_[_0xcd26('0x31')](_0x5596ea[_0xcd26('0x30')]);_0x1072b7[_0xcd26('0x32')]=_[_0xcd26('0x33')](_0x1072b7['model'],_0x1072b7[_0xcd26('0x30')]);_0x21b695[_0xcd26('0x35')]=_[_0xcd26('0x33')](_0x1072b7['model'],qs[_0xcd26('0x36')](_0x5596ea[_0xcd26('0x30')][_0xcd26('0x36')]));_0x21b695['attributes']=_0x21b695[_0xcd26('0x35')][_0xcd26('0x37')]?_0x21b695['attributes']:_0x1072b7[_0xcd26('0x34')];_0x21b695[_0xcd26('0x3a')]=qs[_0xcd26('0x3b')](_0x5596ea['query'][_0xcd26('0x3b')]);_0x21b695[_0xcd26('0x3c')]=qs[_0xcd26('0x32')](_[_0xcd26('0x3d')](_0x5596ea['query'],_0x1072b7[_0xcd26('0x32')]));if(_0x5596ea[_0xcd26('0x30')][_0xcd26('0x3e')]){_0x21b695[_0xcd26('0x3c')]=_[_0xcd26('0x3f')](_0x21b695['where'],{'$or':_['map'](_0x21b695[_0xcd26('0x35')],function(_0x4c64a4){var _0x6c3448={};_0x6c3448[_0x4c64a4]={'$like':'%'+_0x5596ea[_0xcd26('0x30')]['filter']+'%'};return _0x6c3448;})});}_0x21b695=_[_0xcd26('0x3f')]({},_0x21b695,_0x5596ea[_0xcd26('0x41')]);return _0x41cef0['getConfigurations'](_0x21b695);}})[_0xcd26('0x24')](function(_0x56d802){if(_0x56d802){_0x181e50=_0x56d802[_0xcd26('0x37')];if(!_0x5596ea['query'][_0xcd26('0x4d')](_0xcd26('0x38'))){_0x21b695[_0xcd26('0x39')]=qs[_0xcd26('0x39')](_0x5596ea['query'][_0xcd26('0x39')]);_0x21b695[_0xcd26('0x1c')]=qs['offset'](_0x5596ea['query'][_0xcd26('0x1c')]);}return _0x41cef0['getConfigurations'](_0x21b695);}})[_0xcd26('0x24')](function(_0x2c0f6a){if(_0x2c0f6a){return _0x2c0f6a?{'count':_0x181e50,'rows':_0x2c0f6a}:null;}})[_0xcd26('0x24')](respondWithResult(_0x4eb966,null))['catch'](handleError(_0x4eb966,null));};exports[_0xcd26('0x4e')]=function(_0x51bb00,_0x111634,_0x9034de){if(_0x51bb00[_0xcd26('0x49')]['id']){delete _0x51bb00[_0xcd26('0x49')]['id'];}return db[_0xcd26('0x2a')][_0xcd26('0x4b')]({'where':{'id':_0x51bb00[_0xcd26('0x46')]['id']}})[_0xcd26('0x24')](handleEntityNotFound(_0x111634,null))[_0xcd26('0x24')](function(_0x1677f5){if(_0x1677f5){_0x51bb00[_0xcd26('0x49')][_0xcd26('0x4f')]=_0x1677f5['id'];_0x51bb00[_0xcd26('0x49')][_0xcd26('0x50')]=integrations[_0xcd26('0x51')](_0x51bb00['body'][_0xcd26('0x52')],_0x51bb00[_0xcd26('0x49')][_0xcd26('0x2d')]);_0x51bb00['body'][_0xcd26('0x53')]=integrations[_0xcd26('0x54')](_0x51bb00['body']['channel'],_0x51bb00[_0xcd26('0x49')][_0xcd26('0x2d')]);return db[_0xcd26('0x4c')]['create'](_0x51bb00[_0xcd26('0x49')],{'include':[{'model':db[_0xcd26('0x55')],'as':_0xcd26('0x50')},{'model':db[_0xcd26('0x55')],'as':_0xcd26('0x53')}]});}return null;})['then'](respondWithResult(_0x111634,null))[_0xcd26('0x45')](handleError(_0x111634,null));};exports['getFields']=function(_0x524b66,_0x2401c3,_0x4604d3){var _0xc7c306='';var _0x4dee1a=['id',_0xcd26('0x28'),_0xcd26('0x56'),_0xcd26('0x57'),_0xcd26('0x58'),_0xcd26('0x59'),_0xcd26('0x5a'),_0xcd26('0x5b'),_0xcd26('0x5c'),_0xcd26('0x5d'),_0xcd26('0x5e'),'direction'];return db[_0xcd26('0x2a')]['findOne']({'where':{'id':_0x524b66['params']['id']},'attributes':['id',_0xcd26('0x5f'),_0xcd26('0x60'),_0xcd26('0x61')]})[_0xcd26('0x24')](handleEntityNotFound(_0x2401c3,null))[_0xcd26('0x24')](function(_0x1102c0){if(_0x1102c0){_0xc7c306=_0x1102c0[_0xcd26('0x61')];var _0x4f1024=_0xc7c306['slice'](-0x1);if(_0x4f1024==='/'){_0xc7c306=_0xc7c306[_0xcd26('0x62')](0x0,_0xc7c306[_0xcd26('0x63')](_0x4f1024));}return rp({'method':_0xcd26('0x64'),'uri':util['format'](_0xcd26('0x65'),_0xc7c306,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xcd26('0x66'),'input_type':_0xcd26('0x67'),'response_type':_0xcd26('0x67'),'rest_data':JSON[_0xcd26('0x68')]({'user_auth':{'user_name':_0x1102c0[_0xcd26('0x5f')],'password':_0x1102c0[_0xcd26('0x60')],'encryption':'PLAIN'},'application':_0xcd26('0x69')})}});}})['then'](function(_0x254fba){if(_0x254fba&&_0x254fba[_0xcd26('0x28')]!==_0xcd26('0x6a')&&_0x254fba[_0xcd26('0x28')]!=='Password\x20Expired'){return rp({'method':_0xcd26('0x64'),'uri':util[_0xcd26('0x6b')](_0xcd26('0x65'),_0xc7c306,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xcd26('0x6c'),'input_type':_0xcd26('0x67'),'response_type':_0xcd26('0x67'),'rest_data':JSON[_0xcd26('0x68')]({'session':_0x254fba['id'],'module_name':_0xcd26('0x6d')})}})['then'](function(_0x446027){if(_0x446027){var _0x4b6db3=_[_0xcd26('0x6e')](_0x446027[_0xcd26('0x6f')]);_['remove'](_0x4b6db3,function(_0x45e506){return _0x4dee1a[_0xcd26('0x70')](_0x45e506['name']);});return{'count':_0x4b6db3[_0xcd26('0x37')],'rows':_[_0xcd26('0x2f')](_0x4b6db3,function(_0x160fde){return{'id':_0x160fde['name'],'name':_0x160fde[_0xcd26('0x71')],'custom':_[_0xcd26('0x72')](_0x160fde['name'],'_c')?!![]:![],'options':_0x160fde[_0xcd26('0x41')]?_[_0xcd26('0x2f')](_[_0xcd26('0x6e')](_0x160fde[_0xcd26('0x41')]),function(_0x309211){return{'name':_0x309211[_0xcd26('0x73')],'value':_0x309211[_0xcd26('0x28')]};}):[]};})};}})[_0xcd26('0x24')](respondWithResult(_0x2401c3,null))[_0xcd26('0x45')](function(_0x392d2d){var _0x1f0d0c=_0x524b66['query'][_0xcd26('0x74')]?0x1f4:_0x392d2d[_0xcd26('0x75')]||0x1f4;logger[_0xcd26('0x26')](_0xcd26('0x76'),_0xcd26('0x77'),_0x1f0d0c,JSON[_0xcd26('0x68')](_0x392d2d));delete _0x392d2d[_0xcd26('0x28')];if(_0x1f0d0c===0x191){_0x1f0d0c=0x190;}_0x2401c3[_0xcd26('0x19')](_0x1f0d0c)['send'](_0x524b66['query'][_0xcd26('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x392d2d[_0xcd26('0x75')]}:_0x392d2d);});}else{var _0x2dc746=0x1f4;_0x2401c3[_0xcd26('0x19')](_0x2dc746)[_0xcd26('0x78')]({'message':_0xcd26('0x79'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x5e71=['body','getConfigurations','findOne','SugarcrmConfiguration','order','nolimit','AccountId','getSubjects','Descriptions','getDescriptions','channel','create','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','Password\x20Expired','POST','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','stack','name','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x5e71,0x123));var _0x15e7=function(_0x385ebe,_0x25fe9d){_0x385ebe=_0x385ebe-0x0;var _0xb18314=_0x5e71[_0x385ebe];return _0xb18314;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x15e7('0x0'));var moment=require(_0x15e7('0x1'));var BPromise=require(_0x15e7('0x2'));var Mustache=require('mustache');var util=require(_0x15e7('0x3'));var path=require(_0x15e7('0x4'));var sox=require(_0x15e7('0x5'));var csv=require(_0x15e7('0x6'));var ejs=require(_0x15e7('0x7'));var fs=require('fs');var fs_extra=require(_0x15e7('0x8'));var _=require(_0x15e7('0x9'));var squel=require('squel');var crypto=require(_0x15e7('0xa'));var jsforce=require(_0x15e7('0xb'));var deskjs=require(_0x15e7('0xc'));var toCsv=require(_0x15e7('0x6'));var querystring=require(_0x15e7('0xd'));var Papa=require(_0x15e7('0xe'));var Redis=require('ioredis');var authService=require(_0x15e7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x15e7('0x10'));var hardwareService=require(_0x15e7('0x11'));var logger=require(_0x15e7('0x12'))('api');var utils=require(_0x15e7('0x13'));var config=require(_0x15e7('0x14'));var licenseUtil=require(_0x15e7('0x15'));var db=require(_0x15e7('0x16'))['db'];var integrations=require(_0x15e7('0x17'));function respondWithStatusCode(_0x4dab2e,_0x17afe2){_0x17afe2=_0x17afe2||0xcc;return function(_0x2b7975){if(_0x2b7975){return _0x4dab2e[_0x15e7('0x18')](_0x17afe2);}return _0x4dab2e[_0x15e7('0x19')](_0x17afe2)[_0x15e7('0x1a')]();};}function respondWithResult(_0x578f25,_0x4665c6){_0x4665c6=_0x4665c6||0xc8;return function(_0x2b079b){if(_0x2b079b){return _0x578f25[_0x15e7('0x19')](_0x4665c6)[_0x15e7('0x1b')](_0x2b079b);}};}function respondWithFilteredResult(_0xcb22ca,_0x30ebec){return function(_0x5f53f1){if(_0x5f53f1){var _0x7c610b=typeof _0x30ebec[_0x15e7('0x1c')]==='undefined'&&typeof _0x30ebec[_0x15e7('0x1d')]===_0x15e7('0x1e');var _0x1ae4ed=_0x5f53f1[_0x15e7('0x1f')];var _0x53a34c=_0x7c610b?0x0:_0x30ebec[_0x15e7('0x1c')];var _0xb6b0f4=_0x7c610b?_0x5f53f1['count']:_0x30ebec[_0x15e7('0x1c')]+_0x30ebec['limit'];var _0x3a2af4;if(_0xb6b0f4>=_0x1ae4ed){_0xb6b0f4=_0x1ae4ed;_0x3a2af4=0xc8;}else{_0x3a2af4=0xce;}_0xcb22ca[_0x15e7('0x19')](_0x3a2af4);return _0xcb22ca['set'](_0x15e7('0x20'),_0x53a34c+'-'+_0xb6b0f4+'/'+_0x1ae4ed)[_0x15e7('0x1b')](_0x5f53f1);}return null;};}function patchUpdates(_0x15d33d){return function(_0x2d60c6){try{jsonpatch[_0x15e7('0x21')](_0x2d60c6,_0x15d33d,!![]);}catch(_0x3771a7){return BPromise['reject'](_0x3771a7);}return _0x2d60c6[_0x15e7('0x22')]();};}function saveUpdates(_0x2379ec,_0xe59125){return function(_0x15b710){if(_0x15b710){return _0x15b710[_0x15e7('0x23')](_0x2379ec)[_0x15e7('0x24')](function(_0x322c95){return _0x322c95;});}return null;};}function removeEntity(_0x29da7,_0x4f6301){return function(_0xb71dac){if(_0xb71dac){return _0xb71dac[_0x15e7('0x25')]()[_0x15e7('0x24')](function(){_0x29da7[_0x15e7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfcd202,_0x55ed35){return function(_0x525bd1){if(!_0x525bd1){_0xfcd202[_0x15e7('0x18')](0x194);}return _0x525bd1;};}function handleError(_0x22f974,_0x2a18d6){_0x2a18d6=_0x2a18d6||0x1f4;return function(_0x22c542){logger['error'](_0x22c542[_0x15e7('0x26')]);if(_0x22c542['name']){delete _0x22c542[_0x15e7('0x27')];}_0x22f974['status'](_0x2a18d6)['send'](_0x22c542);};}exports['index']=function(_0x19160e,_0x171520){var _0x12ed1={},_0x1adfac={},_0x1f3f97={'count':0x0,'rows':[]};var _0x43e323=_[_0x15e7('0x28')](db[_0x15e7('0x29')][_0x15e7('0x2a')],function(_0x494fdc){return{'name':_0x494fdc[_0x15e7('0x2b')],'type':_0x494fdc[_0x15e7('0x2c')][_0x15e7('0x2d')]};});_0x1adfac[_0x15e7('0x2e')]=_[_0x15e7('0x28')](_0x43e323,_0x15e7('0x27'));_0x1adfac['query']=_[_0x15e7('0x2f')](_0x19160e[_0x15e7('0x30')]);_0x1adfac[_0x15e7('0x31')]=_['intersection'](_0x1adfac[_0x15e7('0x2e')],_0x1adfac[_0x15e7('0x30')]);_0x12ed1[_0x15e7('0x32')]=_[_0x15e7('0x33')](_0x1adfac[_0x15e7('0x2e')],qs[_0x15e7('0x34')](_0x19160e[_0x15e7('0x30')][_0x15e7('0x34')]));_0x12ed1[_0x15e7('0x32')]=_0x12ed1[_0x15e7('0x32')][_0x15e7('0x35')]?_0x12ed1['attributes']:_0x1adfac[_0x15e7('0x2e')];if(!_0x19160e[_0x15e7('0x30')][_0x15e7('0x36')]('nolimit')){_0x12ed1[_0x15e7('0x1d')]=qs[_0x15e7('0x1d')](_0x19160e[_0x15e7('0x30')]['limit']);_0x12ed1[_0x15e7('0x1c')]=qs[_0x15e7('0x1c')](_0x19160e['query'][_0x15e7('0x1c')]);}_0x12ed1['order']=qs[_0x15e7('0x37')](_0x19160e[_0x15e7('0x30')][_0x15e7('0x37')]);_0x12ed1[_0x15e7('0x38')]=qs['filters'](_[_0x15e7('0x39')](_0x19160e[_0x15e7('0x30')],_0x1adfac['filters']),_0x43e323);if(_0x19160e[_0x15e7('0x30')][_0x15e7('0x3a')]){_0x12ed1[_0x15e7('0x38')]=_[_0x15e7('0x3b')](_0x12ed1[_0x15e7('0x38')],{'$or':_['map'](_0x43e323,function(_0x7ed514){if(_0x7ed514['type']!=='VIRTUAL'){var _0x55df67={};_0x55df67[_0x7ed514['name']]={'$like':'%'+_0x19160e[_0x15e7('0x30')][_0x15e7('0x3a')]+'%'};return _0x55df67;}})});}_0x12ed1=_[_0x15e7('0x3b')]({},_0x12ed1,_0x19160e[_0x15e7('0x3c')]);var _0x63de17={'where':_0x12ed1[_0x15e7('0x38')]};return db[_0x15e7('0x29')][_0x15e7('0x1f')](_0x63de17)[_0x15e7('0x24')](function(_0x5335b5){_0x1f3f97[_0x15e7('0x1f')]=_0x5335b5;if(_0x19160e[_0x15e7('0x30')][_0x15e7('0x3d')]){_0x12ed1[_0x15e7('0x3e')]=[{'all':!![]}];}return db[_0x15e7('0x29')][_0x15e7('0x3f')](_0x12ed1);})[_0x15e7('0x24')](function(_0x2c1988){_0x1f3f97[_0x15e7('0x40')]=_0x2c1988;return _0x1f3f97;})[_0x15e7('0x24')](respondWithFilteredResult(_0x171520,_0x12ed1))[_0x15e7('0x41')](handleError(_0x171520,null));};exports[_0x15e7('0x42')]=function(_0x1b2e17,_0x47d175){var _0x1a57a7={'raw':![],'where':{'id':_0x1b2e17[_0x15e7('0x43')]['id']}},_0x24e8df={};_0x24e8df[_0x15e7('0x2e')]=_[_0x15e7('0x2f')](db[_0x15e7('0x29')]['rawAttributes']);_0x24e8df[_0x15e7('0x30')]=_[_0x15e7('0x2f')](_0x1b2e17['query']);_0x24e8df[_0x15e7('0x31')]=_['intersection'](_0x24e8df[_0x15e7('0x2e')],_0x24e8df['query']);_0x1a57a7['attributes']=_[_0x15e7('0x33')](_0x24e8df[_0x15e7('0x2e')],qs['fields'](_0x1b2e17[_0x15e7('0x30')][_0x15e7('0x34')]));_0x1a57a7[_0x15e7('0x32')]=_0x1a57a7[_0x15e7('0x32')][_0x15e7('0x35')]?_0x1a57a7['attributes']:_0x24e8df[_0x15e7('0x2e')];if(_0x1b2e17['query'][_0x15e7('0x3d')]){_0x1a57a7['include']=[{'all':!![]}];}_0x1a57a7=_[_0x15e7('0x3b')]({},_0x1a57a7,_0x1b2e17[_0x15e7('0x3c')]);return db[_0x15e7('0x29')][_0x15e7('0x44')](_0x1a57a7)[_0x15e7('0x24')](handleEntityNotFound(_0x47d175,null))[_0x15e7('0x24')](respondWithResult(_0x47d175,null))[_0x15e7('0x41')](handleError(_0x47d175,null));};exports['create']=function(_0x3d4d07,_0x327ce7){return db[_0x15e7('0x29')]['create'](_0x3d4d07[_0x15e7('0x45')],{})[_0x15e7('0x24')](respondWithResult(_0x327ce7,0xc9))[_0x15e7('0x41')](handleError(_0x327ce7,null));};exports[_0x15e7('0x23')]=function(_0x2bfc6d,_0x466d4c){if(_0x2bfc6d[_0x15e7('0x45')]['id']){delete _0x2bfc6d['body']['id'];}return db['SugarcrmAccount'][_0x15e7('0x44')]({'where':{'id':_0x2bfc6d[_0x15e7('0x43')]['id']}})['then'](handleEntityNotFound(_0x466d4c,null))[_0x15e7('0x24')](saveUpdates(_0x2bfc6d['body'],null))[_0x15e7('0x24')](respondWithResult(_0x466d4c,null))[_0x15e7('0x41')](handleError(_0x466d4c,null));};exports[_0x15e7('0x25')]=function(_0x3bc810,_0x2c71bf){return db[_0x15e7('0x29')][_0x15e7('0x44')]({'where':{'id':_0x3bc810[_0x15e7('0x43')]['id']}})['then'](handleEntityNotFound(_0x2c71bf,null))[_0x15e7('0x24')](removeEntity(_0x2c71bf,null))['catch'](handleError(_0x2c71bf,null));};exports[_0x15e7('0x46')]=function(_0x315072,_0x5a0c22,_0x2e6e5b){var _0x1831c5={};var _0x267a3c={};var _0x2498c0;var _0x4a9403;return db[_0x15e7('0x29')][_0x15e7('0x47')]({'where':{'id':_0x315072[_0x15e7('0x43')]['id']}})[_0x15e7('0x24')](handleEntityNotFound(_0x5a0c22,null))['then'](function(_0x33d669){if(_0x33d669){_0x2498c0=_0x33d669;_0x267a3c[_0x15e7('0x2e')]=_[_0x15e7('0x2f')](db[_0x15e7('0x48')][_0x15e7('0x2a')]);_0x267a3c[_0x15e7('0x30')]=_[_0x15e7('0x2f')](_0x315072['query']);_0x267a3c[_0x15e7('0x31')]=_[_0x15e7('0x33')](_0x267a3c['model'],_0x267a3c[_0x15e7('0x30')]);_0x1831c5[_0x15e7('0x32')]=_[_0x15e7('0x33')](_0x267a3c[_0x15e7('0x2e')],qs[_0x15e7('0x34')](_0x315072[_0x15e7('0x30')]['fields']));_0x1831c5[_0x15e7('0x32')]=_0x1831c5[_0x15e7('0x32')][_0x15e7('0x35')]?_0x1831c5['attributes']:_0x267a3c[_0x15e7('0x2e')];_0x1831c5[_0x15e7('0x49')]=qs[_0x15e7('0x37')](_0x315072[_0x15e7('0x30')][_0x15e7('0x37')]);_0x1831c5[_0x15e7('0x38')]=qs[_0x15e7('0x31')](_[_0x15e7('0x39')](_0x315072[_0x15e7('0x30')],_0x267a3c['filters']));if(_0x315072[_0x15e7('0x30')]['filter']){_0x1831c5['where']=_['merge'](_0x1831c5[_0x15e7('0x38')],{'$or':_[_0x15e7('0x28')](_0x1831c5[_0x15e7('0x32')],function(_0x266805){var _0x481e7f={};_0x481e7f[_0x266805]={'$like':'%'+_0x315072[_0x15e7('0x30')][_0x15e7('0x3a')]+'%'};return _0x481e7f;})});}_0x1831c5=_[_0x15e7('0x3b')]({},_0x1831c5,_0x315072['options']);return _0x2498c0[_0x15e7('0x46')](_0x1831c5);}})['then'](function(_0x21a823){if(_0x21a823){_0x4a9403=_0x21a823[_0x15e7('0x35')];if(!_0x315072[_0x15e7('0x30')]['hasOwnProperty'](_0x15e7('0x4a'))){_0x1831c5['limit']=qs[_0x15e7('0x1d')](_0x315072[_0x15e7('0x30')]['limit']);_0x1831c5['offset']=qs[_0x15e7('0x1c')](_0x315072[_0x15e7('0x30')][_0x15e7('0x1c')]);}return _0x2498c0[_0x15e7('0x46')](_0x1831c5);}})['then'](function(_0x52859c){if(_0x52859c){return _0x52859c?{'count':_0x4a9403,'rows':_0x52859c}:null;}})['then'](respondWithResult(_0x5a0c22,null))[_0x15e7('0x41')](handleError(_0x5a0c22,null));};exports['addConfiguration']=function(_0x3be9ee,_0x5a5b22,_0x29c791){if(_0x3be9ee['body']['id']){delete _0x3be9ee['body']['id'];}return db['SugarcrmAccount'][_0x15e7('0x47')]({'where':{'id':_0x3be9ee[_0x15e7('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a5b22,null))[_0x15e7('0x24')](function(_0x4c9b17){if(_0x4c9b17){_0x3be9ee[_0x15e7('0x45')][_0x15e7('0x4b')]=_0x4c9b17['id'];_0x3be9ee['body']['Subjects']=integrations[_0x15e7('0x4c')](_0x3be9ee[_0x15e7('0x45')]['channel'],_0x3be9ee['body'][_0x15e7('0x2c')]);_0x3be9ee[_0x15e7('0x45')][_0x15e7('0x4d')]=integrations[_0x15e7('0x4e')](_0x3be9ee[_0x15e7('0x45')][_0x15e7('0x4f')],_0x3be9ee[_0x15e7('0x45')][_0x15e7('0x2c')]);return db['SugarcrmConfiguration'][_0x15e7('0x50')](_0x3be9ee[_0x15e7('0x45')],{'include':[{'model':db[_0x15e7('0x51')],'as':_0x15e7('0x52')},{'model':db[_0x15e7('0x51')],'as':_0x15e7('0x4d')}]});}return null;})[_0x15e7('0x24')](respondWithResult(_0x5a5b22,null))['catch'](handleError(_0x5a5b22,null));};exports[_0x15e7('0x53')]=function(_0x4f72ae,_0x269c97,_0x34d725){var _0x956c62='';var _0x2091c3=['id','name',_0x15e7('0x54'),_0x15e7('0x55'),'description','date_start',_0x15e7('0x56'),_0x15e7('0x57'),'parent_id',_0x15e7('0x58'),_0x15e7('0x59'),_0x15e7('0x5a')];return db['SugarcrmAccount'][_0x15e7('0x47')]({'where':{'id':_0x4f72ae[_0x15e7('0x43')]['id']},'attributes':['id',_0x15e7('0x5b'),_0x15e7('0x5c'),_0x15e7('0x5d')]})[_0x15e7('0x24')](handleEntityNotFound(_0x269c97,null))[_0x15e7('0x24')](function(_0x456596){if(_0x456596){_0x956c62=_0x456596['remoteUri'];var _0x1c8d13=_0x956c62[_0x15e7('0x5e')](-0x1);if(_0x1c8d13==='/'){_0x956c62=_0x956c62[_0x15e7('0x5f')](0x0,_0x956c62[_0x15e7('0x60')](_0x1c8d13));}return rp({'method':'POST','uri':util[_0x15e7('0x61')](_0x15e7('0x62'),_0x956c62,_0x15e7('0x63')),'json':!![],'form':{'method':_0x15e7('0x64'),'input_type':_0x15e7('0x65'),'response_type':_0x15e7('0x65'),'rest_data':JSON[_0x15e7('0x66')]({'user_auth':{'user_name':_0x456596[_0x15e7('0x5b')],'password':_0x456596[_0x15e7('0x5c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x15e7('0x24')](function(_0x38e39a){if(_0x38e39a&&_0x38e39a['name']!=='Invalid\x20Login'&&_0x38e39a[_0x15e7('0x27')]!==_0x15e7('0x67')){return rp({'method':_0x15e7('0x68'),'uri':util['format'](_0x15e7('0x62'),_0x956c62,_0x15e7('0x63')),'json':!![],'form':{'method':_0x15e7('0x69'),'input_type':_0x15e7('0x65'),'response_type':_0x15e7('0x65'),'rest_data':JSON[_0x15e7('0x66')]({'session':_0x38e39a['id'],'module_name':_0x15e7('0x6a')})}})[_0x15e7('0x24')](function(_0x179b7b){if(_0x179b7b){var _0x95dc08=_[_0x15e7('0x6b')](_0x179b7b[_0x15e7('0x6c')]);_[_0x15e7('0x6d')](_0x95dc08,function(_0x10d387){return _0x2091c3[_0x15e7('0x6e')](_0x10d387[_0x15e7('0x27')]);});return{'count':_0x95dc08[_0x15e7('0x35')],'rows':_[_0x15e7('0x28')](_0x95dc08,function(_0x381b2d){return{'id':_0x381b2d['name'],'name':_0x381b2d[_0x15e7('0x6f')],'custom':_[_0x15e7('0x70')](_0x381b2d[_0x15e7('0x27')],'_c')?!![]:![],'options':_0x381b2d[_0x15e7('0x3c')]?_['map'](_['values'](_0x381b2d[_0x15e7('0x3c')]),function(_0x3c3cf0){return{'name':_0x3c3cf0[_0x15e7('0x71')],'value':_0x3c3cf0[_0x15e7('0x27')]};}):[]};})};}})[_0x15e7('0x24')](respondWithResult(_0x269c97,null))[_0x15e7('0x41')](function(_0x353abe){var _0x45b999=_0x4f72ae[_0x15e7('0x30')][_0x15e7('0x72')]?0x1f4:_0x353abe[_0x15e7('0x73')]||0x1f4;logger[_0x15e7('0x74')](_0x15e7('0x75'),_0x15e7('0x53'),_0x45b999,JSON[_0x15e7('0x66')](_0x353abe));delete _0x353abe[_0x15e7('0x27')];if(_0x45b999===0x191){_0x45b999=0x190;}_0x269c97['status'](_0x45b999)[_0x15e7('0x76')](_0x4f72ae['query'][_0x15e7('0x72')]?{'message':_0x15e7('0x77'),'statusCode':_0x353abe[_0x15e7('0x73')]}:_0x353abe);});}else{var _0x3f660b=0x1f4;_0x269c97[_0x15e7('0x19')](_0x3f660b)[_0x15e7('0x76')]({'message':_0x15e7('0x77'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 3b4b198..b9e893f 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6fc=['int_sugarcrm_accounts','lodash','util','moment','bluebird','path','../../config/environment','define','SugarcrmAccount'];(function(_0x29715e,_0x2dae78){var _0x3df67d=function(_0x19b8c0){while(--_0x19b8c0){_0x29715e['push'](_0x29715e['shift']());}};_0x3df67d(++_0x2dae78);}(_0xa6fc,0x10f));var _0xca6f=function(_0x4ec534,_0x1e761d){_0x4ec534=_0x4ec534-0x0;var _0x3592b8=_0xa6fc[_0x4ec534];return _0x3592b8;};'use strict';var _=require(_0xca6f('0x0'));var util=require(_0xca6f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca6f('0x2'));var BPromise=require(_0xca6f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca6f('0x4'));var rimraf=require('rimraf');var config=require(_0xca6f('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x6e8f9b,_0x51739c){return _0x6e8f9b[_0xca6f('0x6')](_0xca6f('0x7'),attributes,{'tableName':_0xca6f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c7d=['../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x395dc0,_0x3e1799){var _0x5c77d8=function(_0x32d9ad){while(--_0x32d9ad){_0x395dc0['push'](_0x395dc0['shift']());}};_0x5c77d8(++_0x3e1799);}(_0x8c7d,0xe1));var _0xd8c7=function(_0x386926,_0x3ca0b0){_0x386926=_0x386926-0x0;var _0x48bd18=_0x8c7d[_0x386926];return _0x48bd18;};'use strict';var _=require(_0xd8c7('0x0'));var util=require('util');var logger=require(_0xd8c7('0x1'))('api');var moment=require(_0xd8c7('0x2'));var BPromise=require(_0xd8c7('0x3'));var rp=require(_0xd8c7('0x4'));var fs=require('fs');var path=require(_0xd8c7('0x5'));var rimraf=require(_0xd8c7('0x6'));var config=require(_0xd8c7('0x7'));var attributes=require(_0xd8c7('0x8'));var integrations=require(_0xd8c7('0x9'));module[_0xd8c7('0xa')]=function(_0x57c00f,_0x5aa388){return _0x57c00f[_0xd8c7('0xb')](_0xd8c7('0xc'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index da681d2..53a6d1e 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x661f=['attributes','limit','map','include','model','ShowSugarcrmAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where'];(function(_0xe02534,_0x49906a){var _0x30e61d=function(_0x31c762){while(--_0x31c762){_0xe02534['push'](_0xe02534['shift']());}};_0x30e61d(++_0x49906a);}(_0x661f,0x137));var _0xf661=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x661f[_0xef8146];return _0x5a6cb0;};'use strict';var _=require('lodash');var util=require(_0xf661('0x0'));var moment=require(_0xf661('0x1'));var BPromise=require(_0xf661('0x2'));var rs=require(_0xf661('0x3'));var fs=require('fs');var Redis=require(_0xf661('0x4'));var db=require(_0xf661('0x5'))['db'];var utils=require(_0xf661('0x6'));var logger=require(_0xf661('0x7'))(_0xf661('0x8'));var config=require(_0xf661('0x9'));var jayson=require(_0xf661('0xa'));var client=jayson[_0xf661('0xb')][_0xf661('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51f6ae,_0x394b4c,_0x1049ef){return new BPromise(function(_0x9ff498,_0x213c3b){return client[_0xf661('0xd')](_0x51f6ae,_0x1049ef)[_0xf661('0xe')](function(_0x546cb9){logger[_0xf661('0xf')](_0xf661('0x10'),_0x394b4c,'request\x20sent');logger[_0xf661('0x11')](_0xf661('0x12'),_0x394b4c,_0xf661('0x13'),JSON[_0xf661('0x14')](_0x546cb9));if(_0x546cb9[_0xf661('0x15')]){if(_0x546cb9[_0xf661('0x15')]['code']===0x1f4){logger[_0xf661('0x15')](_0xf661('0x10'),_0x394b4c,_0x546cb9[_0xf661('0x15')][_0xf661('0x16')]);return _0x213c3b(_0x546cb9['error'][_0xf661('0x16')]);}logger[_0xf661('0x15')](_0xf661('0x10'),_0x394b4c,_0x546cb9['error'][_0xf661('0x16')]);return _0x9ff498(_0x546cb9['error']['message']);}else{logger[_0xf661('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x394b4c,_0xf661('0x13'));_0x9ff498(_0x546cb9[_0xf661('0x17')]['message']);}})[_0xf661('0x18')](function(_0x50fe26){logger[_0xf661('0x15')](_0xf661('0x10'),_0x394b4c,_0x50fe26);_0x213c3b(_0x50fe26);});});}exports[_0xf661('0x19')]=function(_0x4b18e3){var _0x59a9bb=this;return new Promise(function(_0x49b61f,_0x3a2270){return db[_0xf661('0x1a')][_0xf661('0x1b')]({'raw':_0x4b18e3[_0xf661('0x1c')]?_0x4b18e3[_0xf661('0x1c')][_0xf661('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b18e3['options']?_0x4b18e3[_0xf661('0x1c')][_0xf661('0x1e')]||null:null,'attributes':_0x4b18e3[_0xf661('0x1c')]?_0x4b18e3[_0xf661('0x1c')][_0xf661('0x1f')]||null:null,'limit':_0x4b18e3[_0xf661('0x1c')]?_0x4b18e3['options'][_0xf661('0x20')]||null:null,'include':_0x4b18e3['options']?_0x4b18e3[_0xf661('0x1c')]['include']?_[_0xf661('0x21')](_0x4b18e3[_0xf661('0x1c')][_0xf661('0x22')],function(_0x286aab){return{'model':db[_0x286aab[_0xf661('0x23')]],'as':_0x286aab['as'],'attributes':_0x286aab[_0xf661('0x1f')],'include':_0x286aab[_0xf661('0x22')]?_[_0xf661('0x21')](_0x286aab[_0xf661('0x22')],function(_0x3736d0){return{'model':db[_0x3736d0['model']],'as':_0x3736d0['as'],'attributes':_0x3736d0['attributes'],'include':_0x3736d0['include']?_['map'](_0x3736d0['include'],function(_0x506066){return{'model':db[_0x506066[_0xf661('0x23')]],'as':_0x506066['as'],'attributes':_0x506066[_0xf661('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf661('0xe')](function(_0x3ba902){logger['info'](_0xf661('0x19'),_0x4b18e3);logger[_0xf661('0x11')](_0xf661('0x19'),_0x4b18e3,JSON['stringify'](_0x3ba902));_0x49b61f(_0x3ba902);})[_0xf661('0x18')](function(_0x50b26c){logger[_0xf661('0x15')](_0xf661('0x19'),_0x50b26c['message'],_0x4b18e3);_0x3a2270(_0x59a9bb[_0xf661('0x15')](0x1f4,_0x50b26c[_0xf661('0x16')]));});});};exports[_0xf661('0x24')]=function(_0x38ddd9){var _0x1af49d=this;return new Promise(function(_0x102ace,_0x30f895){return db[_0xf661('0x1a')][_0xf661('0x25')]({'raw':_0x38ddd9['options']?_0x38ddd9[_0xf661('0x1c')][_0xf661('0x1d')]===undefined?!![]:![]:!![],'where':_0x38ddd9['options']?_0x38ddd9['options']['where']||null:null,'attributes':_0x38ddd9[_0xf661('0x1c')]?_0x38ddd9[_0xf661('0x1c')][_0xf661('0x1f')]||null:null,'include':_0x38ddd9[_0xf661('0x1c')]?_0x38ddd9['options'][_0xf661('0x22')]?_[_0xf661('0x21')](_0x38ddd9[_0xf661('0x1c')][_0xf661('0x22')],function(_0x3d363e){return{'model':db[_0x3d363e[_0xf661('0x23')]],'as':_0x3d363e['as'],'attributes':_0x3d363e['attributes'],'include':_0x3d363e[_0xf661('0x22')]?_[_0xf661('0x21')](_0x3d363e[_0xf661('0x22')],function(_0x20d632){return{'model':db[_0x20d632['model']],'as':_0x20d632['as'],'attributes':_0x20d632[_0xf661('0x1f')],'include':_0x20d632[_0xf661('0x22')]?_[_0xf661('0x21')](_0x20d632['include'],function(_0xed104c){return{'model':db[_0xed104c[_0xf661('0x23')]],'as':_0xed104c['as'],'attributes':_0xed104c['attributes']};}):[]};}):[]};}):[]:[]})[_0xf661('0xe')](function(_0x4a2564){logger[_0xf661('0xf')]('ShowSugarcrmAccount',_0x38ddd9);logger[_0xf661('0x11')](_0xf661('0x24'),_0x38ddd9,JSON['stringify'](_0x4a2564));_0x102ace(_0x4a2564);})[_0xf661('0x18')](function(_0x13fb6b){logger[_0xf661('0x15')]('ShowSugarcrmAccount',_0x13fb6b[_0xf661('0x16')],_0x38ddd9);_0x30f895(_0x1af49d[_0xf661('0x15')](0x1f4,_0x13fb6b[_0xf661('0x16')]));});});}; \ No newline at end of file +var _0x6b7e=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','stringify','catch','ShowSugarcrmAccount','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0x6b7e,0x148));var _0xe6b7=function(_0x30c29a,_0xfd0519){_0x30c29a=_0x30c29a-0x0;var _0x314d81=_0x6b7e[_0x30c29a];return _0x314d81;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe6b7('0x0'));var BPromise=require(_0xe6b7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6b7('0x2'));var db=require(_0xe6b7('0x3'))['db'];var utils=require(_0xe6b7('0x4'));var logger=require(_0xe6b7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe6b7('0x6'));var client=jayson[_0xe6b7('0x7')][_0xe6b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a0796,_0x48de6b,_0x2951c7){return new BPromise(function(_0xc6efa1,_0x3c652a){return client[_0xe6b7('0x9')](_0x4a0796,_0x2951c7)[_0xe6b7('0xa')](function(_0x273a94){logger[_0xe6b7('0xb')](_0xe6b7('0xc'),_0x48de6b,_0xe6b7('0xd'));logger[_0xe6b7('0xe')](_0xe6b7('0xf'),_0x48de6b,_0xe6b7('0xd'),JSON['stringify'](_0x273a94));if(_0x273a94[_0xe6b7('0x10')]){if(_0x273a94[_0xe6b7('0x10')][_0xe6b7('0x11')]===0x1f4){logger[_0xe6b7('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x48de6b,_0x273a94[_0xe6b7('0x10')][_0xe6b7('0x12')]);return _0x3c652a(_0x273a94[_0xe6b7('0x10')][_0xe6b7('0x12')]);}logger[_0xe6b7('0x10')](_0xe6b7('0xc'),_0x48de6b,_0x273a94[_0xe6b7('0x10')][_0xe6b7('0x12')]);return _0xc6efa1(_0x273a94['error'][_0xe6b7('0x12')]);}else{logger[_0xe6b7('0xb')](_0xe6b7('0xc'),_0x48de6b,_0xe6b7('0xd'));_0xc6efa1(_0x273a94[_0xe6b7('0x13')]['message']);}})['catch'](function(_0x5ad500){logger['error'](_0xe6b7('0xc'),_0x48de6b,_0x5ad500);_0x3c652a(_0x5ad500);});});}exports['GetSugarcrmAccount']=function(_0x64aa19){var _0x2e7ae8=this;return new Promise(function(_0x524bfc,_0x54ff02){return db[_0xe6b7('0x14')]['findAll']({'raw':_0x64aa19[_0xe6b7('0x15')]?_0x64aa19['options'][_0xe6b7('0x16')]===undefined?!![]:![]:!![],'where':_0x64aa19[_0xe6b7('0x15')]?_0x64aa19[_0xe6b7('0x15')][_0xe6b7('0x17')]||null:null,'attributes':_0x64aa19[_0xe6b7('0x15')]?_0x64aa19['options'][_0xe6b7('0x18')]||null:null,'limit':_0x64aa19['options']?_0x64aa19['options'][_0xe6b7('0x19')]||null:null,'include':_0x64aa19[_0xe6b7('0x15')]?_0x64aa19[_0xe6b7('0x15')][_0xe6b7('0x1a')]?_[_0xe6b7('0x1b')](_0x64aa19[_0xe6b7('0x15')]['include'],function(_0x414c28){return{'model':db[_0x414c28['model']],'as':_0x414c28['as'],'attributes':_0x414c28[_0xe6b7('0x18')],'include':_0x414c28[_0xe6b7('0x1a')]?_['map'](_0x414c28[_0xe6b7('0x1a')],function(_0x5f4161){return{'model':db[_0x5f4161[_0xe6b7('0x1c')]],'as':_0x5f4161['as'],'attributes':_0x5f4161[_0xe6b7('0x18')],'include':_0x5f4161[_0xe6b7('0x1a')]?_['map'](_0x5f4161[_0xe6b7('0x1a')],function(_0x4e1fc5){return{'model':db[_0x4e1fc5[_0xe6b7('0x1c')]],'as':_0x4e1fc5['as'],'attributes':_0x4e1fc5[_0xe6b7('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe6b7('0xa')](function(_0x1330f0){logger[_0xe6b7('0xb')](_0xe6b7('0x1d'),_0x64aa19);logger['debug'](_0xe6b7('0x1d'),_0x64aa19,JSON[_0xe6b7('0x1e')](_0x1330f0));_0x524bfc(_0x1330f0);})[_0xe6b7('0x1f')](function(_0x461935){logger['error'](_0xe6b7('0x1d'),_0x461935[_0xe6b7('0x12')],_0x64aa19);_0x54ff02(_0x2e7ae8[_0xe6b7('0x10')](0x1f4,_0x461935['message']));});});};exports[_0xe6b7('0x20')]=function(_0x582ac4){var _0x306298=this;return new Promise(function(_0x5f4ba6,_0x233271){return db[_0xe6b7('0x14')][_0xe6b7('0x21')]({'raw':_0x582ac4[_0xe6b7('0x15')]?_0x582ac4['options'][_0xe6b7('0x16')]===undefined?!![]:![]:!![],'where':_0x582ac4['options']?_0x582ac4[_0xe6b7('0x15')][_0xe6b7('0x17')]||null:null,'attributes':_0x582ac4[_0xe6b7('0x15')]?_0x582ac4[_0xe6b7('0x15')]['attributes']||null:null,'include':_0x582ac4['options']?_0x582ac4['options'][_0xe6b7('0x1a')]?_[_0xe6b7('0x1b')](_0x582ac4[_0xe6b7('0x15')]['include'],function(_0x2f81c1){return{'model':db[_0x2f81c1[_0xe6b7('0x1c')]],'as':_0x2f81c1['as'],'attributes':_0x2f81c1[_0xe6b7('0x18')],'include':_0x2f81c1[_0xe6b7('0x1a')]?_[_0xe6b7('0x1b')](_0x2f81c1['include'],function(_0x50a87f){return{'model':db[_0x50a87f[_0xe6b7('0x1c')]],'as':_0x50a87f['as'],'attributes':_0x50a87f[_0xe6b7('0x18')],'include':_0x50a87f['include']?_[_0xe6b7('0x1b')](_0x50a87f[_0xe6b7('0x1a')],function(_0x357477){return{'model':db[_0x357477[_0xe6b7('0x1c')]],'as':_0x357477['as'],'attributes':_0x357477[_0xe6b7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc70c0d){logger[_0xe6b7('0xb')](_0xe6b7('0x20'),_0x582ac4);logger[_0xe6b7('0xe')](_0xe6b7('0x20'),_0x582ac4,JSON[_0xe6b7('0x1e')](_0xc70c0d));_0x5f4ba6(_0xc70c0d);})[_0xe6b7('0x1f')](function(_0x5e7b55){logger[_0xe6b7('0x10')](_0xe6b7('0x20'),_0x5e7b55[_0xe6b7('0x12')],_0x582ac4);_0x233271(_0x306298[_0xe6b7('0x10')](0x1f4,_0x5e7b55[_0xe6b7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 8fdad6f..b9ea96f 100644 --- a/server/api/intSugarcrmConfiguration/index.js +++ b/server/api/intSugarcrmConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd27d=['show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x50ca5a,_0x351cb4){var _0x3c6d80=function(_0x51366a){while(--_0x51366a){_0x50ca5a['push'](_0x50ca5a['shift']());}};_0x3c6d80(++_0x351cb4);}(_0xd27d,0x1d4));var _0xdd27=function(_0x3f1ee0,_0x30762f){_0x3f1ee0=_0x3f1ee0-0x0;var _0x41f93c=_0xd27d[_0x3f1ee0];return _0x41f93c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdd27('0x0'));var timeout=require('connect-timeout');var express=require(_0xdd27('0x1'));var router=express[_0xdd27('0x2')]();var fs_extra=require(_0xdd27('0x3'));var auth=require(_0xdd27('0x4'));var interaction=require(_0xdd27('0x5'));var config=require(_0xdd27('0x6'));var controller=require(_0xdd27('0x7'));router[_0xdd27('0x8')]('/',auth[_0xdd27('0x9')](),controller[_0xdd27('0xa')]);router[_0xdd27('0x8')](_0xdd27('0xb'),auth['isAuthenticated'](),controller[_0xdd27('0xc')]);router[_0xdd27('0x8')](_0xdd27('0xd'),auth['isAuthenticated'](),controller[_0xdd27('0xe')]);router[_0xdd27('0x8')](_0xdd27('0xf'),auth[_0xdd27('0x9')](),controller['getSubjects']);router[_0xdd27('0x8')](_0xdd27('0x10'),auth[_0xdd27('0x9')](),controller[_0xdd27('0x11')]);router[_0xdd27('0x12')]('/',auth[_0xdd27('0x9')](),controller[_0xdd27('0x13')]);router[_0xdd27('0x14')]('/:id',auth[_0xdd27('0x9')](),controller['update']);router[_0xdd27('0x15')](_0xdd27('0xb'),auth[_0xdd27('0x9')](),controller[_0xdd27('0x16')]);module[_0xdd27('0x17')]=router; \ No newline at end of file +var _0x6d49=['show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x414688,_0x4dae18){var _0x244712=function(_0x200c7a){while(--_0x200c7a){_0x414688['push'](_0x414688['shift']());}};_0x244712(++_0x4dae18);}(_0x6d49,0x174));var _0x96d4=function(_0x48c1a3,_0x461b4c){_0x48c1a3=_0x48c1a3-0x0;var _0xd6c631=_0x6d49[_0x48c1a3];return _0xd6c631;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x96d4('0x0'));var timeout=require(_0x96d4('0x1'));var express=require(_0x96d4('0x2'));var router=express['Router']();var fs_extra=require(_0x96d4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x96d4('0x4'));var config=require('../../config/environment');var controller=require(_0x96d4('0x5'));router[_0x96d4('0x6')]('/',auth[_0x96d4('0x7')](),controller['index']);router[_0x96d4('0x6')]('/:id',auth[_0x96d4('0x7')](),controller[_0x96d4('0x8')]);router['get'](_0x96d4('0x9'),auth[_0x96d4('0x7')](),controller['getFields']);router['get'](_0x96d4('0xa'),auth[_0x96d4('0x7')](),controller[_0x96d4('0xb')]);router[_0x96d4('0x6')](_0x96d4('0xc'),auth['isAuthenticated'](),controller[_0x96d4('0xd')]);router[_0x96d4('0xe')]('/',auth[_0x96d4('0x7')](),controller[_0x96d4('0xf')]);router[_0x96d4('0x10')](_0x96d4('0x11'),auth['isAuthenticated'](),controller[_0x96d4('0x12')]);router['delete'](_0x96d4('0x11'),auth[_0x96d4('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 6ad3459..6e6ef90 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabed=['exports','STRING','sequelize'];(function(_0x4f930e,_0x46c994){var _0x12d373=function(_0x31e433){while(--_0x31e433){_0x4f930e['push'](_0x4f930e['shift']());}};_0x12d373(++_0x46c994);}(_0xabed,0xfe));var _0xdabe=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xabed[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0xdabe('0x0'));module[_0xdabe('0x1')]={'name':{'type':Sequelize[_0xdabe('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8d92=['STRING','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8d92,0x79));var _0x28d9=function(_0x57d0dc,_0x387f3e){_0x57d0dc=_0x57d0dc-0x0;var _0x177765=_0x8d92[_0x57d0dc];return _0x177765;};'use strict';var Sequelize=require(_0x28d9('0x0'));module[_0x28d9('0x1')]={'name':{'type':Sequelize[_0x28d9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 4ae2b9a..a10656b 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a1e=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','include','rows','catch','show','params','includeAll','body','find','getFields','findOne','pick','merge','nolimit','SugarcrmField','getSubjects','getDescriptions','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x9a1e,0xd3));var _0xe9a1=function(_0x4467bc,_0xe78926){_0x4467bc=_0x4467bc-0x0;var _0x434d0b=_0x9a1e[_0x4467bc];return _0x434d0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe9a1('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe9a1('0x1'));var Mustache=require(_0xe9a1('0x2'));var util=require(_0xe9a1('0x3'));var path=require(_0xe9a1('0x4'));var sox=require(_0xe9a1('0x5'));var csv=require(_0xe9a1('0x6'));var ejs=require(_0xe9a1('0x7'));var fs=require('fs');var fs_extra=require(_0xe9a1('0x8'));var _=require(_0xe9a1('0x9'));var squel=require(_0xe9a1('0xa'));var crypto=require(_0xe9a1('0xb'));var jsforce=require(_0xe9a1('0xc'));var deskjs=require(_0xe9a1('0xd'));var toCsv=require(_0xe9a1('0x6'));var querystring=require(_0xe9a1('0xe'));var Papa=require(_0xe9a1('0xf'));var Redis=require(_0xe9a1('0x10'));var authService=require(_0xe9a1('0x11'));var qs=require(_0xe9a1('0x12'));var as=require(_0xe9a1('0x13'));var hardwareService=require(_0xe9a1('0x14'));var logger=require(_0xe9a1('0x15'))(_0xe9a1('0x16'));var utils=require(_0xe9a1('0x17'));var config=require(_0xe9a1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9a1('0x19'))['db'];function respondWithStatusCode(_0x31392a,_0x363a13){_0x363a13=_0x363a13||0xcc;return function(_0x1851ce){if(_0x1851ce){return _0x31392a[_0xe9a1('0x1a')](_0x363a13);}return _0x31392a[_0xe9a1('0x1b')](_0x363a13)[_0xe9a1('0x1c')]();};}function respondWithResult(_0x3771f9,_0x3c4455){_0x3c4455=_0x3c4455||0xc8;return function(_0x460709){if(_0x460709){return _0x3771f9[_0xe9a1('0x1b')](_0x3c4455)[_0xe9a1('0x1d')](_0x460709);}};}function respondWithFilteredResult(_0x1a55d3,_0x14da8e){return function(_0x189986){if(_0x189986){var _0x4f011e=typeof _0x14da8e[_0xe9a1('0x1e')]===_0xe9a1('0x1f')&&typeof _0x14da8e['limit']==='undefined';var _0x1c4096=_0x189986[_0xe9a1('0x20')];var _0x202af6=_0x4f011e?0x0:_0x14da8e[_0xe9a1('0x1e')];var _0x179e3b=_0x4f011e?_0x189986['count']:_0x14da8e[_0xe9a1('0x1e')]+_0x14da8e[_0xe9a1('0x21')];var _0x4a855f;if(_0x179e3b>=_0x1c4096){_0x179e3b=_0x1c4096;_0x4a855f=0xc8;}else{_0x4a855f=0xce;}_0x1a55d3[_0xe9a1('0x1b')](_0x4a855f);return _0x1a55d3[_0xe9a1('0x22')](_0xe9a1('0x23'),_0x202af6+'-'+_0x179e3b+'/'+_0x1c4096)['json'](_0x189986);}return null;};}function patchUpdates(_0x2b7a13){return function(_0x4ed782){try{jsonpatch[_0xe9a1('0x24')](_0x4ed782,_0x2b7a13,!![]);}catch(_0x2c60d7){return BPromise[_0xe9a1('0x25')](_0x2c60d7);}return _0x4ed782['save']();};}function saveUpdates(_0xf67a31,_0x3ec374){return function(_0x531651){if(_0x531651){return _0x531651[_0xe9a1('0x26')](_0xf67a31)[_0xe9a1('0x27')](function(_0x23632c){return _0x23632c;});}return null;};}function removeEntity(_0x54fbf2,_0x52d2f9){return function(_0x19e0f2){if(_0x19e0f2){return _0x19e0f2[_0xe9a1('0x28')]()['then'](function(){_0x54fbf2[_0xe9a1('0x1b')](0xcc)[_0xe9a1('0x1c')]();});}};}function handleEntityNotFound(_0x79a3e7,_0x54c7f4){return function(_0xb1e580){if(!_0xb1e580){_0x79a3e7[_0xe9a1('0x1a')](0x194);}return _0xb1e580;};}function handleError(_0x3b54ab,_0x129409){_0x129409=_0x129409||0x1f4;return function(_0x75616c){logger['error'](_0x75616c[_0xe9a1('0x29')]);if(_0x75616c['name']){delete _0x75616c[_0xe9a1('0x2a')];}_0x3b54ab[_0xe9a1('0x1b')](_0x129409)['send'](_0x75616c);};}exports['index']=function(_0x5eac68,_0xce042){var _0x207cb4={},_0x223aff={},_0x50f975={'count':0x0,'rows':[]};var _0x448053=_[_0xe9a1('0x2b')](db[_0xe9a1('0x2c')][_0xe9a1('0x2d')],function(_0x3d54c7){return{'name':_0x3d54c7[_0xe9a1('0x2e')],'type':_0x3d54c7[_0xe9a1('0x2f')][_0xe9a1('0x30')]};});_0x223aff[_0xe9a1('0x31')]=_[_0xe9a1('0x2b')](_0x448053,'name');_0x223aff[_0xe9a1('0x32')]=_[_0xe9a1('0x33')](_0x5eac68[_0xe9a1('0x32')]);_0x223aff[_0xe9a1('0x34')]=_[_0xe9a1('0x35')](_0x223aff[_0xe9a1('0x31')],_0x223aff[_0xe9a1('0x32')]);_0x207cb4[_0xe9a1('0x36')]=_[_0xe9a1('0x35')](_0x223aff['model'],qs[_0xe9a1('0x37')](_0x5eac68[_0xe9a1('0x32')]['fields']));_0x207cb4[_0xe9a1('0x36')]=_0x207cb4[_0xe9a1('0x36')][_0xe9a1('0x38')]?_0x207cb4[_0xe9a1('0x36')]:_0x223aff[_0xe9a1('0x31')];if(!_0x5eac68[_0xe9a1('0x32')][_0xe9a1('0x39')]('nolimit')){_0x207cb4[_0xe9a1('0x21')]=qs['limit'](_0x5eac68[_0xe9a1('0x32')][_0xe9a1('0x21')]);_0x207cb4['offset']=qs[_0xe9a1('0x1e')](_0x5eac68[_0xe9a1('0x32')][_0xe9a1('0x1e')]);}_0x207cb4[_0xe9a1('0x3a')]=qs[_0xe9a1('0x3b')](_0x5eac68[_0xe9a1('0x32')]['sort']);_0x207cb4[_0xe9a1('0x3c')]=qs[_0xe9a1('0x34')](_['pick'](_0x5eac68[_0xe9a1('0x32')],_0x223aff[_0xe9a1('0x34')]),_0x448053);if(_0x5eac68[_0xe9a1('0x32')][_0xe9a1('0x3d')]){_0x207cb4[_0xe9a1('0x3c')]=_['merge'](_0x207cb4[_0xe9a1('0x3c')],{'$or':_[_0xe9a1('0x2b')](_0x448053,function(_0x30202f){if(_0x30202f[_0xe9a1('0x2f')]!==_0xe9a1('0x3e')){var _0x11cc0e={};_0x11cc0e[_0x30202f[_0xe9a1('0x2a')]]={'$like':'%'+_0x5eac68[_0xe9a1('0x32')][_0xe9a1('0x3d')]+'%'};return _0x11cc0e;}})});}_0x207cb4=_['merge']({},_0x207cb4,_0x5eac68[_0xe9a1('0x3f')]);var _0x5d3f8d={'where':_0x207cb4['where']};return db['SugarcrmConfiguration'][_0xe9a1('0x20')](_0x5d3f8d)[_0xe9a1('0x27')](function(_0xa09323){_0x50f975['count']=_0xa09323;if(_0x5eac68[_0xe9a1('0x32')]['includeAll']){_0x207cb4[_0xe9a1('0x40')]=[{'all':!![]}];}return db[_0xe9a1('0x2c')]['findAll'](_0x207cb4);})[_0xe9a1('0x27')](function(_0x179147){_0x50f975[_0xe9a1('0x41')]=_0x179147;return _0x50f975;})[_0xe9a1('0x27')](respondWithFilteredResult(_0xce042,_0x207cb4))[_0xe9a1('0x42')](handleError(_0xce042,null));};exports[_0xe9a1('0x43')]=function(_0x24c702,_0x2db1bd){var _0x352bef={'raw':![],'where':{'id':_0x24c702[_0xe9a1('0x44')]['id']}},_0xb9b20a={};_0xb9b20a[_0xe9a1('0x31')]=_[_0xe9a1('0x33')](db['SugarcrmConfiguration'][_0xe9a1('0x2d')]);_0xb9b20a[_0xe9a1('0x32')]=_[_0xe9a1('0x33')](_0x24c702[_0xe9a1('0x32')]);_0xb9b20a[_0xe9a1('0x34')]=_[_0xe9a1('0x35')](_0xb9b20a[_0xe9a1('0x31')],_0xb9b20a[_0xe9a1('0x32')]);_0x352bef[_0xe9a1('0x36')]=_[_0xe9a1('0x35')](_0xb9b20a[_0xe9a1('0x31')],qs[_0xe9a1('0x37')](_0x24c702[_0xe9a1('0x32')][_0xe9a1('0x37')]));_0x352bef[_0xe9a1('0x36')]=_0x352bef['attributes'][_0xe9a1('0x38')]?_0x352bef[_0xe9a1('0x36')]:_0xb9b20a['model'];if(_0x24c702[_0xe9a1('0x32')][_0xe9a1('0x45')]){_0x352bef[_0xe9a1('0x40')]=[{'all':!![]}];}_0x352bef=_['merge']({},_0x352bef,_0x24c702[_0xe9a1('0x3f')]);return db[_0xe9a1('0x2c')]['find'](_0x352bef)[_0xe9a1('0x27')](handleEntityNotFound(_0x2db1bd,null))[_0xe9a1('0x27')](respondWithResult(_0x2db1bd,null))[_0xe9a1('0x42')](handleError(_0x2db1bd,null));};exports['create']=function(_0x53f552,_0x53f10c){return db[_0xe9a1('0x2c')]['create'](_0x53f552[_0xe9a1('0x46')],{})[_0xe9a1('0x27')](respondWithResult(_0x53f10c,0xc9))[_0xe9a1('0x42')](handleError(_0x53f10c,null));};exports[_0xe9a1('0x26')]=function(_0x4c76db,_0x444b30){if(_0x4c76db[_0xe9a1('0x46')]['id']){delete _0x4c76db[_0xe9a1('0x46')]['id'];}return db[_0xe9a1('0x2c')]['find']({'where':{'id':_0x4c76db['params']['id']}})[_0xe9a1('0x27')](handleEntityNotFound(_0x444b30,null))[_0xe9a1('0x27')](saveUpdates(_0x4c76db[_0xe9a1('0x46')],null))[_0xe9a1('0x27')](respondWithResult(_0x444b30,null))[_0xe9a1('0x42')](handleError(_0x444b30,null));};exports['destroy']=function(_0x5f5362,_0x2ab82b){return db[_0xe9a1('0x2c')][_0xe9a1('0x47')]({'where':{'id':_0x5f5362[_0xe9a1('0x44')]['id']}})[_0xe9a1('0x27')](handleEntityNotFound(_0x2ab82b,null))[_0xe9a1('0x27')](removeEntity(_0x2ab82b,null))['catch'](handleError(_0x2ab82b,null));};exports[_0xe9a1('0x48')]=function(_0xc8cbdf,_0x5f4acb,_0x3eeba2){var _0x3f458c={};var _0x4f2a9f={};var _0x1558f6;var _0x367273;return db['SugarcrmConfiguration'][_0xe9a1('0x49')]({'where':{'id':_0xc8cbdf[_0xe9a1('0x44')]['id']}})[_0xe9a1('0x27')](handleEntityNotFound(_0x5f4acb,null))[_0xe9a1('0x27')](function(_0x3df044){if(_0x3df044){_0x1558f6=_0x3df044;_0x4f2a9f['model']=_[_0xe9a1('0x33')](db['SugarcrmField'][_0xe9a1('0x2d')]);_0x4f2a9f[_0xe9a1('0x32')]=_['keys'](_0xc8cbdf[_0xe9a1('0x32')]);_0x4f2a9f[_0xe9a1('0x34')]=_[_0xe9a1('0x35')](_0x4f2a9f['model'],_0x4f2a9f[_0xe9a1('0x32')]);_0x3f458c[_0xe9a1('0x36')]=_['intersection'](_0x4f2a9f[_0xe9a1('0x31')],qs[_0xe9a1('0x37')](_0xc8cbdf[_0xe9a1('0x32')][_0xe9a1('0x37')]));_0x3f458c[_0xe9a1('0x36')]=_0x3f458c['attributes'][_0xe9a1('0x38')]?_0x3f458c['attributes']:_0x4f2a9f['model'];_0x3f458c[_0xe9a1('0x3a')]=qs[_0xe9a1('0x3b')](_0xc8cbdf[_0xe9a1('0x32')][_0xe9a1('0x3b')]);_0x3f458c['where']=qs[_0xe9a1('0x34')](_[_0xe9a1('0x4a')](_0xc8cbdf[_0xe9a1('0x32')],_0x4f2a9f[_0xe9a1('0x34')]));if(_0xc8cbdf['query'][_0xe9a1('0x3d')]){_0x3f458c[_0xe9a1('0x3c')]=_[_0xe9a1('0x4b')](_0x3f458c[_0xe9a1('0x3c')],{'$or':_['map'](_0x3f458c[_0xe9a1('0x36')],function(_0x239138){var _0x41c290={};_0x41c290[_0x239138]={'$like':'%'+_0xc8cbdf[_0xe9a1('0x32')][_0xe9a1('0x3d')]+'%'};return _0x41c290;})});}_0x3f458c=_[_0xe9a1('0x4b')]({},_0x3f458c,_0xc8cbdf[_0xe9a1('0x3f')]);return _0x1558f6['getFields'](_0x3f458c);}})[_0xe9a1('0x27')](function(_0x261b7c){if(_0x261b7c){_0x367273=_0x261b7c[_0xe9a1('0x38')];if(!_0xc8cbdf[_0xe9a1('0x32')]['hasOwnProperty'](_0xe9a1('0x4c'))){_0x3f458c[_0xe9a1('0x21')]=qs['limit'](_0xc8cbdf[_0xe9a1('0x32')][_0xe9a1('0x21')]);_0x3f458c[_0xe9a1('0x1e')]=qs[_0xe9a1('0x1e')](_0xc8cbdf[_0xe9a1('0x32')][_0xe9a1('0x1e')]);}return _0x1558f6[_0xe9a1('0x48')](_0x3f458c);}})[_0xe9a1('0x27')](function(_0x263727){if(_0x263727){return _0x263727?{'count':_0x367273,'rows':_0x263727}:null;}})[_0xe9a1('0x27')](respondWithResult(_0x5f4acb,null))[_0xe9a1('0x42')](handleError(_0x5f4acb,null));};exports['getSubjects']=function(_0xae82ee,_0x528723,_0x19f8da){var _0x48a001={};var _0x311b4a={};var _0x2de07a;var _0x413306;return db[_0xe9a1('0x2c')]['findOne']({'where':{'id':_0xae82ee[_0xe9a1('0x44')]['id']}})[_0xe9a1('0x27')](handleEntityNotFound(_0x528723,null))['then'](function(_0x49f6bd){if(_0x49f6bd){_0x2de07a=_0x49f6bd;_0x311b4a['model']=_['keys'](db[_0xe9a1('0x4d')][_0xe9a1('0x2d')]);_0x311b4a['query']=_[_0xe9a1('0x33')](_0xae82ee[_0xe9a1('0x32')]);_0x311b4a[_0xe9a1('0x34')]=_[_0xe9a1('0x35')](_0x311b4a[_0xe9a1('0x31')],_0x311b4a['query']);_0x48a001[_0xe9a1('0x36')]=_[_0xe9a1('0x35')](_0x311b4a[_0xe9a1('0x31')],qs['fields'](_0xae82ee[_0xe9a1('0x32')]['fields']));_0x48a001[_0xe9a1('0x36')]=_0x48a001[_0xe9a1('0x36')][_0xe9a1('0x38')]?_0x48a001['attributes']:_0x311b4a[_0xe9a1('0x31')];_0x48a001[_0xe9a1('0x3a')]=qs[_0xe9a1('0x3b')](_0xae82ee[_0xe9a1('0x32')][_0xe9a1('0x3b')]);_0x48a001['where']=qs[_0xe9a1('0x34')](_[_0xe9a1('0x4a')](_0xae82ee[_0xe9a1('0x32')],_0x311b4a[_0xe9a1('0x34')]));if(_0xae82ee['query'][_0xe9a1('0x3d')]){_0x48a001[_0xe9a1('0x3c')]=_[_0xe9a1('0x4b')](_0x48a001[_0xe9a1('0x3c')],{'$or':_['map'](_0x48a001['attributes'],function(_0x50f574){var _0x1aa10d={};_0x1aa10d[_0x50f574]={'$like':'%'+_0xae82ee['query'][_0xe9a1('0x3d')]+'%'};return _0x1aa10d;})});}_0x48a001=_[_0xe9a1('0x4b')]({},_0x48a001,_0xae82ee[_0xe9a1('0x3f')]);return _0x2de07a['getSubjects'](_0x48a001);}})['then'](function(_0x5bb176){if(_0x5bb176){_0x413306=_0x5bb176[_0xe9a1('0x38')];if(!_0xae82ee[_0xe9a1('0x32')][_0xe9a1('0x39')](_0xe9a1('0x4c'))){_0x48a001[_0xe9a1('0x21')]=qs['limit'](_0xae82ee[_0xe9a1('0x32')][_0xe9a1('0x21')]);_0x48a001[_0xe9a1('0x1e')]=qs[_0xe9a1('0x1e')](_0xae82ee[_0xe9a1('0x32')]['offset']);}return _0x2de07a[_0xe9a1('0x4e')](_0x48a001);}})['then'](function(_0x4b18b4){if(_0x4b18b4){return _0x4b18b4?{'count':_0x413306,'rows':_0x4b18b4}:null;}})[_0xe9a1('0x27')](respondWithResult(_0x528723,null))[_0xe9a1('0x42')](handleError(_0x528723,null));};exports[_0xe9a1('0x4f')]=function(_0x1e111e,_0x377897,_0x35ce24){var _0x5583f9={};var _0x45a97c={};var _0x3b7c6e;var _0x5a2625;return db['SugarcrmConfiguration'][_0xe9a1('0x49')]({'where':{'id':_0x1e111e[_0xe9a1('0x44')]['id']}})[_0xe9a1('0x27')](handleEntityNotFound(_0x377897,null))[_0xe9a1('0x27')](function(_0x45fb45){if(_0x45fb45){_0x3b7c6e=_0x45fb45;_0x45a97c['model']=_[_0xe9a1('0x33')](db[_0xe9a1('0x4d')]['rawAttributes']);_0x45a97c[_0xe9a1('0x32')]=_[_0xe9a1('0x33')](_0x1e111e[_0xe9a1('0x32')]);_0x45a97c[_0xe9a1('0x34')]=_[_0xe9a1('0x35')](_0x45a97c[_0xe9a1('0x31')],_0x45a97c[_0xe9a1('0x32')]);_0x5583f9[_0xe9a1('0x36')]=_['intersection'](_0x45a97c[_0xe9a1('0x31')],qs[_0xe9a1('0x37')](_0x1e111e[_0xe9a1('0x32')]['fields']));_0x5583f9[_0xe9a1('0x36')]=_0x5583f9['attributes'][_0xe9a1('0x38')]?_0x5583f9[_0xe9a1('0x36')]:_0x45a97c[_0xe9a1('0x31')];_0x5583f9[_0xe9a1('0x3a')]=qs['sort'](_0x1e111e[_0xe9a1('0x32')]['sort']);_0x5583f9[_0xe9a1('0x3c')]=qs[_0xe9a1('0x34')](_[_0xe9a1('0x4a')](_0x1e111e[_0xe9a1('0x32')],_0x45a97c[_0xe9a1('0x34')]));if(_0x1e111e[_0xe9a1('0x32')]['filter']){_0x5583f9[_0xe9a1('0x3c')]=_[_0xe9a1('0x4b')](_0x5583f9[_0xe9a1('0x3c')],{'$or':_[_0xe9a1('0x2b')](_0x5583f9[_0xe9a1('0x36')],function(_0x75d721){var _0x39c723={};_0x39c723[_0x75d721]={'$like':'%'+_0x1e111e['query'][_0xe9a1('0x3d')]+'%'};return _0x39c723;})});}_0x5583f9=_[_0xe9a1('0x4b')]({},_0x5583f9,_0x1e111e[_0xe9a1('0x3f')]);return _0x3b7c6e[_0xe9a1('0x4f')](_0x5583f9);}})[_0xe9a1('0x27')](function(_0x4c521e){if(_0x4c521e){_0x5a2625=_0x4c521e['length'];if(!_0x1e111e[_0xe9a1('0x32')]['hasOwnProperty'](_0xe9a1('0x4c'))){_0x5583f9['limit']=qs[_0xe9a1('0x21')](_0x1e111e[_0xe9a1('0x32')][_0xe9a1('0x21')]);_0x5583f9[_0xe9a1('0x1e')]=qs[_0xe9a1('0x1e')](_0x1e111e[_0xe9a1('0x32')]['offset']);}return _0x3b7c6e[_0xe9a1('0x4f')](_0x5583f9);}})[_0xe9a1('0x27')](function(_0x4e83d6){if(_0x4e83d6){return _0x4e83d6?{'count':_0x5a2625,'rows':_0x4e83d6}:null;}})[_0xe9a1('0x27')](respondWithResult(_0x377897,null))[_0xe9a1('0x42')](handleError(_0x377897,null));}; \ No newline at end of file +var _0x2def=['fieldName','type','model','map','name','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','update','params','getFields','findOne','SugarcrmField','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','index'];(function(_0x21823b,_0x19b482){var _0xc4b79=function(_0x2f6497){while(--_0x2f6497){_0x21823b['push'](_0x21823b['shift']());}};_0xc4b79(++_0x19b482);}(_0x2def,0x178));var _0xf2de=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2def[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xf2de('0x0'));var rimraf=require(_0xf2de('0x1'));var zipdir=require(_0xf2de('0x2'));var jsonpatch=require(_0xf2de('0x3'));var rp=require(_0xf2de('0x4'));var moment=require(_0xf2de('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf2de('0x6'));var util=require(_0xf2de('0x7'));var path=require('path');var sox=require(_0xf2de('0x8'));var csv=require(_0xf2de('0x9'));var ejs=require(_0xf2de('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2de('0xb'));var squel=require(_0xf2de('0xc'));var crypto=require('crypto');var jsforce=require(_0xf2de('0xd'));var deskjs=require(_0xf2de('0xe'));var toCsv=require(_0xf2de('0x9'));var querystring=require(_0xf2de('0xf'));var Papa=require(_0xf2de('0x10'));var Redis=require(_0xf2de('0x11'));var authService=require(_0xf2de('0x12'));var qs=require(_0xf2de('0x13'));var as=require(_0xf2de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2de('0x15'))(_0xf2de('0x16'));var utils=require('../../config/utils');var config=require(_0xf2de('0x17'));var licenseUtil=require(_0xf2de('0x18'));var db=require(_0xf2de('0x19'))['db'];function respondWithStatusCode(_0x3a3b8c,_0x23859e){_0x23859e=_0x23859e||0xcc;return function(_0x4cc63c){if(_0x4cc63c){return _0x3a3b8c[_0xf2de('0x1a')](_0x23859e);}return _0x3a3b8c[_0xf2de('0x1b')](_0x23859e)['end']();};}function respondWithResult(_0x54685,_0x4b0620){_0x4b0620=_0x4b0620||0xc8;return function(_0x13ca46){if(_0x13ca46){return _0x54685[_0xf2de('0x1b')](_0x4b0620)[_0xf2de('0x1c')](_0x13ca46);}};}function respondWithFilteredResult(_0x176f14,_0x5dee95){return function(_0x48b857){if(_0x48b857){var _0x5befbf=typeof _0x5dee95[_0xf2de('0x1d')]===_0xf2de('0x1e')&&typeof _0x5dee95[_0xf2de('0x1f')]===_0xf2de('0x1e');var _0x17cfb0=_0x48b857[_0xf2de('0x20')];var _0x2ea5b3=_0x5befbf?0x0:_0x5dee95[_0xf2de('0x1d')];var _0x1ee77e=_0x5befbf?_0x48b857['count']:_0x5dee95['offset']+_0x5dee95['limit'];var _0x20d7d5;if(_0x1ee77e>=_0x17cfb0){_0x1ee77e=_0x17cfb0;_0x20d7d5=0xc8;}else{_0x20d7d5=0xce;}_0x176f14[_0xf2de('0x1b')](_0x20d7d5);return _0x176f14[_0xf2de('0x21')](_0xf2de('0x22'),_0x2ea5b3+'-'+_0x1ee77e+'/'+_0x17cfb0)[_0xf2de('0x1c')](_0x48b857);}return null;};}function patchUpdates(_0x1a8e4a){return function(_0x2421d7){try{jsonpatch[_0xf2de('0x23')](_0x2421d7,_0x1a8e4a,!![]);}catch(_0x16937f){return BPromise[_0xf2de('0x24')](_0x16937f);}return _0x2421d7[_0xf2de('0x25')]();};}function saveUpdates(_0x58b907,_0x5db9d3){return function(_0x1f5034){if(_0x1f5034){return _0x1f5034['update'](_0x58b907)['then'](function(_0x58f97c){return _0x58f97c;});}return null;};}function removeEntity(_0x3bccee,_0x27cee3){return function(_0x5352c7){if(_0x5352c7){return _0x5352c7[_0xf2de('0x26')]()[_0xf2de('0x27')](function(){_0x3bccee[_0xf2de('0x1b')](0xcc)[_0xf2de('0x28')]();});}};}function handleEntityNotFound(_0x390716,_0x16cf7a){return function(_0x22aacb){if(!_0x22aacb){_0x390716['sendStatus'](0x194);}return _0x22aacb;};}function handleError(_0x41f77f,_0x257c48){_0x257c48=_0x257c48||0x1f4;return function(_0x5ba7d3){logger[_0xf2de('0x29')](_0x5ba7d3[_0xf2de('0x2a')]);if(_0x5ba7d3['name']){delete _0x5ba7d3['name'];}_0x41f77f[_0xf2de('0x1b')](_0x257c48)['send'](_0x5ba7d3);};}exports[_0xf2de('0x2b')]=function(_0x146c1d,_0x2b0fb3){var _0x181eb9={},_0x49705b={},_0x4b14d4={'count':0x0,'rows':[]};var _0x91f9b=_['map'](db['SugarcrmConfiguration']['rawAttributes'],function(_0x145808){return{'name':_0x145808[_0xf2de('0x2c')],'type':_0x145808[_0xf2de('0x2d')]['key']};});_0x49705b[_0xf2de('0x2e')]=_[_0xf2de('0x2f')](_0x91f9b,_0xf2de('0x30'));_0x49705b['query']=_[_0xf2de('0x31')](_0x146c1d['query']);_0x49705b[_0xf2de('0x32')]=_[_0xf2de('0x33')](_0x49705b[_0xf2de('0x2e')],_0x49705b[_0xf2de('0x34')]);_0x181eb9[_0xf2de('0x35')]=_[_0xf2de('0x33')](_0x49705b['model'],qs[_0xf2de('0x36')](_0x146c1d[_0xf2de('0x34')][_0xf2de('0x36')]));_0x181eb9['attributes']=_0x181eb9[_0xf2de('0x35')]['length']?_0x181eb9[_0xf2de('0x35')]:_0x49705b[_0xf2de('0x2e')];if(!_0x146c1d[_0xf2de('0x34')]['hasOwnProperty'](_0xf2de('0x37'))){_0x181eb9[_0xf2de('0x1f')]=qs[_0xf2de('0x1f')](_0x146c1d[_0xf2de('0x34')][_0xf2de('0x1f')]);_0x181eb9[_0xf2de('0x1d')]=qs[_0xf2de('0x1d')](_0x146c1d[_0xf2de('0x34')][_0xf2de('0x1d')]);}_0x181eb9[_0xf2de('0x38')]=qs[_0xf2de('0x39')](_0x146c1d[_0xf2de('0x34')][_0xf2de('0x39')]);_0x181eb9['where']=qs[_0xf2de('0x32')](_['pick'](_0x146c1d[_0xf2de('0x34')],_0x49705b[_0xf2de('0x32')]),_0x91f9b);if(_0x146c1d[_0xf2de('0x34')][_0xf2de('0x3a')]){_0x181eb9[_0xf2de('0x3b')]=_[_0xf2de('0x3c')](_0x181eb9[_0xf2de('0x3b')],{'$or':_[_0xf2de('0x2f')](_0x91f9b,function(_0x50b97c){if(_0x50b97c[_0xf2de('0x2d')]!==_0xf2de('0x3d')){var _0x38aa1d={};_0x38aa1d[_0x50b97c[_0xf2de('0x30')]]={'$like':'%'+_0x146c1d['query'][_0xf2de('0x3a')]+'%'};return _0x38aa1d;}})});}_0x181eb9=_[_0xf2de('0x3c')]({},_0x181eb9,_0x146c1d[_0xf2de('0x3e')]);var _0x44291b={'where':_0x181eb9[_0xf2de('0x3b')]};return db[_0xf2de('0x3f')][_0xf2de('0x20')](_0x44291b)[_0xf2de('0x27')](function(_0x4cafaf){_0x4b14d4[_0xf2de('0x20')]=_0x4cafaf;if(_0x146c1d['query'][_0xf2de('0x40')]){_0x181eb9[_0xf2de('0x41')]=[{'all':!![]}];}return db[_0xf2de('0x3f')][_0xf2de('0x42')](_0x181eb9);})[_0xf2de('0x27')](function(_0x4e7832){_0x4b14d4[_0xf2de('0x43')]=_0x4e7832;return _0x4b14d4;})[_0xf2de('0x27')](respondWithFilteredResult(_0x2b0fb3,_0x181eb9))[_0xf2de('0x44')](handleError(_0x2b0fb3,null));};exports[_0xf2de('0x45')]=function(_0x1c371c,_0x214598){var _0x399d30={'raw':![],'where':{'id':_0x1c371c['params']['id']}},_0x435bc3={};_0x435bc3[_0xf2de('0x2e')]=_[_0xf2de('0x31')](db['SugarcrmConfiguration'][_0xf2de('0x46')]);_0x435bc3[_0xf2de('0x34')]=_[_0xf2de('0x31')](_0x1c371c[_0xf2de('0x34')]);_0x435bc3[_0xf2de('0x32')]=_[_0xf2de('0x33')](_0x435bc3[_0xf2de('0x2e')],_0x435bc3[_0xf2de('0x34')]);_0x399d30['attributes']=_[_0xf2de('0x33')](_0x435bc3[_0xf2de('0x2e')],qs[_0xf2de('0x36')](_0x1c371c[_0xf2de('0x34')][_0xf2de('0x36')]));_0x399d30[_0xf2de('0x35')]=_0x399d30[_0xf2de('0x35')][_0xf2de('0x47')]?_0x399d30[_0xf2de('0x35')]:_0x435bc3[_0xf2de('0x2e')];if(_0x1c371c['query']['includeAll']){_0x399d30[_0xf2de('0x41')]=[{'all':!![]}];}_0x399d30=_[_0xf2de('0x3c')]({},_0x399d30,_0x1c371c['options']);return db[_0xf2de('0x3f')][_0xf2de('0x48')](_0x399d30)[_0xf2de('0x27')](handleEntityNotFound(_0x214598,null))['then'](respondWithResult(_0x214598,null))['catch'](handleError(_0x214598,null));};exports[_0xf2de('0x49')]=function(_0x2553e2,_0x4e2b17){return db[_0xf2de('0x3f')]['create'](_0x2553e2[_0xf2de('0x4a')],{})['then'](respondWithResult(_0x4e2b17,0xc9))[_0xf2de('0x44')](handleError(_0x4e2b17,null));};exports[_0xf2de('0x4b')]=function(_0x123708,_0x4a1f74){if(_0x123708[_0xf2de('0x4a')]['id']){delete _0x123708[_0xf2de('0x4a')]['id'];}return db[_0xf2de('0x3f')][_0xf2de('0x48')]({'where':{'id':_0x123708[_0xf2de('0x4c')]['id']}})[_0xf2de('0x27')](handleEntityNotFound(_0x4a1f74,null))[_0xf2de('0x27')](saveUpdates(_0x123708['body'],null))[_0xf2de('0x27')](respondWithResult(_0x4a1f74,null))[_0xf2de('0x44')](handleError(_0x4a1f74,null));};exports['destroy']=function(_0x33dc58,_0x152cb7){return db['SugarcrmConfiguration'][_0xf2de('0x48')]({'where':{'id':_0x33dc58[_0xf2de('0x4c')]['id']}})[_0xf2de('0x27')](handleEntityNotFound(_0x152cb7,null))[_0xf2de('0x27')](removeEntity(_0x152cb7,null))[_0xf2de('0x44')](handleError(_0x152cb7,null));};exports[_0xf2de('0x4d')]=function(_0x4da994,_0x50cfdb,_0x3054df){var _0x199bcd={};var _0x440a3c={};var _0x2a2370;var _0xa5048f;return db['SugarcrmConfiguration'][_0xf2de('0x4e')]({'where':{'id':_0x4da994[_0xf2de('0x4c')]['id']}})[_0xf2de('0x27')](handleEntityNotFound(_0x50cfdb,null))[_0xf2de('0x27')](function(_0x30b31f){if(_0x30b31f){_0x2a2370=_0x30b31f;_0x440a3c[_0xf2de('0x2e')]=_[_0xf2de('0x31')](db[_0xf2de('0x4f')][_0xf2de('0x46')]);_0x440a3c[_0xf2de('0x34')]=_[_0xf2de('0x31')](_0x4da994[_0xf2de('0x34')]);_0x440a3c[_0xf2de('0x32')]=_[_0xf2de('0x33')](_0x440a3c[_0xf2de('0x2e')],_0x440a3c[_0xf2de('0x34')]);_0x199bcd[_0xf2de('0x35')]=_['intersection'](_0x440a3c['model'],qs['fields'](_0x4da994['query']['fields']));_0x199bcd[_0xf2de('0x35')]=_0x199bcd[_0xf2de('0x35')]['length']?_0x199bcd[_0xf2de('0x35')]:_0x440a3c[_0xf2de('0x2e')];_0x199bcd[_0xf2de('0x38')]=qs[_0xf2de('0x39')](_0x4da994['query'][_0xf2de('0x39')]);_0x199bcd['where']=qs[_0xf2de('0x32')](_[_0xf2de('0x50')](_0x4da994[_0xf2de('0x34')],_0x440a3c[_0xf2de('0x32')]));if(_0x4da994['query'][_0xf2de('0x3a')]){_0x199bcd[_0xf2de('0x3b')]=_['merge'](_0x199bcd[_0xf2de('0x3b')],{'$or':_['map'](_0x199bcd[_0xf2de('0x35')],function(_0x493b81){var _0xa91c6b={};_0xa91c6b[_0x493b81]={'$like':'%'+_0x4da994[_0xf2de('0x34')][_0xf2de('0x3a')]+'%'};return _0xa91c6b;})});}_0x199bcd=_[_0xf2de('0x3c')]({},_0x199bcd,_0x4da994['options']);return _0x2a2370[_0xf2de('0x4d')](_0x199bcd);}})['then'](function(_0x1fa1e4){if(_0x1fa1e4){_0xa5048f=_0x1fa1e4[_0xf2de('0x47')];if(!_0x4da994[_0xf2de('0x34')][_0xf2de('0x51')](_0xf2de('0x37'))){_0x199bcd[_0xf2de('0x1f')]=qs['limit'](_0x4da994[_0xf2de('0x34')]['limit']);_0x199bcd[_0xf2de('0x1d')]=qs[_0xf2de('0x1d')](_0x4da994[_0xf2de('0x34')][_0xf2de('0x1d')]);}return _0x2a2370[_0xf2de('0x4d')](_0x199bcd);}})['then'](function(_0x19eb4a){if(_0x19eb4a){return _0x19eb4a?{'count':_0xa5048f,'rows':_0x19eb4a}:null;}})['then'](respondWithResult(_0x50cfdb,null))['catch'](handleError(_0x50cfdb,null));};exports['getSubjects']=function(_0x312650,_0x11a28f,_0x529f5a){var _0x5a8134={};var _0x17875b={};var _0x26560b;var _0x1d09c4;return db['SugarcrmConfiguration'][_0xf2de('0x4e')]({'where':{'id':_0x312650[_0xf2de('0x4c')]['id']}})[_0xf2de('0x27')](handleEntityNotFound(_0x11a28f,null))[_0xf2de('0x27')](function(_0x1496f9){if(_0x1496f9){_0x26560b=_0x1496f9;_0x17875b[_0xf2de('0x2e')]=_[_0xf2de('0x31')](db[_0xf2de('0x4f')]['rawAttributes']);_0x17875b[_0xf2de('0x34')]=_[_0xf2de('0x31')](_0x312650[_0xf2de('0x34')]);_0x17875b[_0xf2de('0x32')]=_[_0xf2de('0x33')](_0x17875b[_0xf2de('0x2e')],_0x17875b[_0xf2de('0x34')]);_0x5a8134['attributes']=_[_0xf2de('0x33')](_0x17875b['model'],qs[_0xf2de('0x36')](_0x312650[_0xf2de('0x34')]['fields']));_0x5a8134[_0xf2de('0x35')]=_0x5a8134[_0xf2de('0x35')][_0xf2de('0x47')]?_0x5a8134['attributes']:_0x17875b[_0xf2de('0x2e')];_0x5a8134[_0xf2de('0x38')]=qs[_0xf2de('0x39')](_0x312650['query'][_0xf2de('0x39')]);_0x5a8134[_0xf2de('0x3b')]=qs['filters'](_[_0xf2de('0x50')](_0x312650['query'],_0x17875b[_0xf2de('0x32')]));if(_0x312650[_0xf2de('0x34')][_0xf2de('0x3a')]){_0x5a8134[_0xf2de('0x3b')]=_['merge'](_0x5a8134[_0xf2de('0x3b')],{'$or':_['map'](_0x5a8134[_0xf2de('0x35')],function(_0x4a42b1){var _0x18979b={};_0x18979b[_0x4a42b1]={'$like':'%'+_0x312650[_0xf2de('0x34')]['filter']+'%'};return _0x18979b;})});}_0x5a8134=_[_0xf2de('0x3c')]({},_0x5a8134,_0x312650['options']);return _0x26560b[_0xf2de('0x52')](_0x5a8134);}})[_0xf2de('0x27')](function(_0x1e960c){if(_0x1e960c){_0x1d09c4=_0x1e960c[_0xf2de('0x47')];if(!_0x312650['query'][_0xf2de('0x51')](_0xf2de('0x37'))){_0x5a8134[_0xf2de('0x1f')]=qs[_0xf2de('0x1f')](_0x312650['query'][_0xf2de('0x1f')]);_0x5a8134[_0xf2de('0x1d')]=qs[_0xf2de('0x1d')](_0x312650[_0xf2de('0x34')]['offset']);}return _0x26560b[_0xf2de('0x52')](_0x5a8134);}})[_0xf2de('0x27')](function(_0x3ddab7){if(_0x3ddab7){return _0x3ddab7?{'count':_0x1d09c4,'rows':_0x3ddab7}:null;}})[_0xf2de('0x27')](respondWithResult(_0x11a28f,null))[_0xf2de('0x44')](handleError(_0x11a28f,null));};exports[_0xf2de('0x53')]=function(_0x4935f6,_0x1cb34e,_0x3f5e10){var _0x19922b={};var _0x491ee3={};var _0x272b10;var _0x168cd1;return db[_0xf2de('0x3f')][_0xf2de('0x4e')]({'where':{'id':_0x4935f6[_0xf2de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cb34e,null))['then'](function(_0x44ec4e){if(_0x44ec4e){_0x272b10=_0x44ec4e;_0x491ee3[_0xf2de('0x2e')]=_[_0xf2de('0x31')](db[_0xf2de('0x4f')][_0xf2de('0x46')]);_0x491ee3[_0xf2de('0x34')]=_[_0xf2de('0x31')](_0x4935f6[_0xf2de('0x34')]);_0x491ee3[_0xf2de('0x32')]=_['intersection'](_0x491ee3[_0xf2de('0x2e')],_0x491ee3['query']);_0x19922b['attributes']=_[_0xf2de('0x33')](_0x491ee3[_0xf2de('0x2e')],qs[_0xf2de('0x36')](_0x4935f6[_0xf2de('0x34')]['fields']));_0x19922b[_0xf2de('0x35')]=_0x19922b[_0xf2de('0x35')][_0xf2de('0x47')]?_0x19922b[_0xf2de('0x35')]:_0x491ee3[_0xf2de('0x2e')];_0x19922b['order']=qs[_0xf2de('0x39')](_0x4935f6[_0xf2de('0x34')][_0xf2de('0x39')]);_0x19922b[_0xf2de('0x3b')]=qs[_0xf2de('0x32')](_[_0xf2de('0x50')](_0x4935f6[_0xf2de('0x34')],_0x491ee3[_0xf2de('0x32')]));if(_0x4935f6[_0xf2de('0x34')][_0xf2de('0x3a')]){_0x19922b[_0xf2de('0x3b')]=_[_0xf2de('0x3c')](_0x19922b[_0xf2de('0x3b')],{'$or':_[_0xf2de('0x2f')](_0x19922b['attributes'],function(_0x3bd8a7){var _0x325cc4={};_0x325cc4[_0x3bd8a7]={'$like':'%'+_0x4935f6[_0xf2de('0x34')]['filter']+'%'};return _0x325cc4;})});}_0x19922b=_[_0xf2de('0x3c')]({},_0x19922b,_0x4935f6['options']);return _0x272b10['getDescriptions'](_0x19922b);}})[_0xf2de('0x27')](function(_0x488c7a){if(_0x488c7a){_0x168cd1=_0x488c7a[_0xf2de('0x47')];if(!_0x4935f6['query']['hasOwnProperty'](_0xf2de('0x37'))){_0x19922b[_0xf2de('0x1f')]=qs[_0xf2de('0x1f')](_0x4935f6['query'][_0xf2de('0x1f')]);_0x19922b['offset']=qs[_0xf2de('0x1d')](_0x4935f6[_0xf2de('0x34')][_0xf2de('0x1d')]);}return _0x272b10[_0xf2de('0x53')](_0x19922b);}})[_0xf2de('0x27')](function(_0x256bc1){if(_0x256bc1){return _0x256bc1?{'count':_0x168cd1,'rows':_0x256bc1}:null;}})['then'](respondWithResult(_0x1cb34e,null))['catch'](handleError(_0x1cb34e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 1e3772b..f84a070 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7a1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api'];(function(_0x25f8ef,_0x5db5b9){var _0x10f90b=function(_0x4363d9){while(--_0x4363d9){_0x25f8ef['push'](_0x25f8ef['shift']());}};_0x10f90b(++_0x5db5b9);}(_0xd7a1,0x1d8));var _0x1d7a=function(_0x466b13,_0x7f20ce){_0x466b13=_0x466b13-0x0;var _0x5cb98c=_0xd7a1[_0x466b13];return _0x5cb98c;};'use strict';var _=require(_0x1d7a('0x0'));var util=require(_0x1d7a('0x1'));var logger=require(_0x1d7a('0x2'))(_0x1d7a('0x3'));var moment=require(_0x1d7a('0x4'));var BPromise=require(_0x1d7a('0x5'));var rp=require(_0x1d7a('0x6'));var fs=require('fs');var path=require(_0x1d7a('0x7'));var rimraf=require(_0x1d7a('0x8'));var config=require(_0x1d7a('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x1d7a('0xa')]=function(_0x242932,_0x2ca71a){return _0x242932[_0x1d7a('0xb')](_0x1d7a('0xc'),attributes,{'tableName':_0x1d7a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ea2=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','api','bluebird'];(function(_0x4530a6,_0x20a8d5){var _0x52c438=function(_0x105a68){while(--_0x105a68){_0x4530a6['push'](_0x4530a6['shift']());}};_0x52c438(++_0x20a8d5);}(_0x5ea2,0x69));var _0x25ea=function(_0x429168,_0x31f0d0){_0x429168=_0x429168-0x0;var _0x549a22=_0x5ea2[_0x429168];return _0x549a22;};'use strict';var _=require('lodash');var util=require(_0x25ea('0x0'));var logger=require('../../config/logger')(_0x25ea('0x1'));var moment=require('moment');var BPromise=require(_0x25ea('0x2'));var rp=require(_0x25ea('0x3'));var fs=require('fs');var path=require(_0x25ea('0x4'));var rimraf=require(_0x25ea('0x5'));var config=require(_0x25ea('0x6'));var attributes=require(_0x25ea('0x7'));module[_0x25ea('0x8')]=function(_0x126809,_0x4ae0ec){return _0x126809[_0x25ea('0x9')](_0x25ea('0xa'),attributes,{'tableName':_0x25ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index c3f016e..86a34b4 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca81=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2c077b,_0x171aff){var _0x23105e=function(_0x5bc326){while(--_0x5bc326){_0x2c077b['push'](_0x2c077b['shift']());}};_0x23105e(++_0x171aff);}(_0xca81,0x12a));var _0x1ca8=function(_0x2bb31c,_0x31b73d){_0x2bb31c=_0x2bb31c-0x0;var _0x4551b4=_0xca81[_0x2bb31c];return _0x4551b4;};'use strict';var _=require(_0x1ca8('0x0'));var util=require(_0x1ca8('0x1'));var moment=require(_0x1ca8('0x2'));var BPromise=require(_0x1ca8('0x3'));var rs=require(_0x1ca8('0x4'));var fs=require('fs');var Redis=require(_0x1ca8('0x5'));var db=require(_0x1ca8('0x6'))['db'];var utils=require(_0x1ca8('0x7'));var logger=require(_0x1ca8('0x8'))(_0x1ca8('0x9'));var config=require(_0x1ca8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1ca8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x137912,_0x49c9c1,_0x4c8ed9){return new BPromise(function(_0x4af979,_0x1c68d5){return client[_0x1ca8('0xc')](_0x137912,_0x4c8ed9)[_0x1ca8('0xd')](function(_0x218588){logger[_0x1ca8('0xe')](_0x1ca8('0xf'),_0x49c9c1,'request\x20sent');logger[_0x1ca8('0x10')](_0x1ca8('0x11'),_0x49c9c1,_0x1ca8('0x12'),JSON[_0x1ca8('0x13')](_0x218588));if(_0x218588[_0x1ca8('0x14')]){if(_0x218588['error'][_0x1ca8('0x15')]===0x1f4){logger[_0x1ca8('0x14')](_0x1ca8('0xf'),_0x49c9c1,_0x218588[_0x1ca8('0x14')][_0x1ca8('0x16')]);return _0x1c68d5(_0x218588[_0x1ca8('0x14')][_0x1ca8('0x16')]);}logger[_0x1ca8('0x14')](_0x1ca8('0xf'),_0x49c9c1,_0x218588[_0x1ca8('0x14')][_0x1ca8('0x16')]);return _0x4af979(_0x218588[_0x1ca8('0x14')][_0x1ca8('0x16')]);}else{logger[_0x1ca8('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x49c9c1,_0x1ca8('0x12'));_0x4af979(_0x218588[_0x1ca8('0x17')]['message']);}})[_0x1ca8('0x18')](function(_0x5f12be){logger[_0x1ca8('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x49c9c1,_0x5f12be);_0x1c68d5(_0x5f12be);});});} \ No newline at end of file +var _0x552d=['code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4caade,_0x549ce1){var _0x2041ff=function(_0x402f3a){while(--_0x402f3a){_0x4caade['push'](_0x4caade['shift']());}};_0x2041ff(++_0x549ce1);}(_0x552d,0xd6));var _0xd552=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x552d[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0xd552('0x0'));var moment=require(_0xd552('0x1'));var BPromise=require(_0xd552('0x2'));var rs=require(_0xd552('0x3'));var fs=require('fs');var Redis=require(_0xd552('0x4'));var db=require(_0xd552('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd552('0x6'))('rpc');var config=require(_0xd552('0x7'));var jayson=require(_0xd552('0x8'));var client=jayson[_0xd552('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f2576,_0x28804d,_0x5b6c17){return new BPromise(function(_0x5a2d91,_0x3b9e26){return client[_0xd552('0xa')](_0x1f2576,_0x5b6c17)[_0xd552('0xb')](function(_0x23fd5d){logger['info'](_0xd552('0xc'),_0x28804d,_0xd552('0xd'));logger[_0xd552('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x28804d,_0xd552('0xd'),JSON[_0xd552('0xf')](_0x23fd5d));if(_0x23fd5d[_0xd552('0x10')]){if(_0x23fd5d[_0xd552('0x10')][_0xd552('0x11')]===0x1f4){logger[_0xd552('0x10')](_0xd552('0xc'),_0x28804d,_0x23fd5d[_0xd552('0x10')][_0xd552('0x12')]);return _0x3b9e26(_0x23fd5d[_0xd552('0x10')][_0xd552('0x12')]);}logger[_0xd552('0x10')](_0xd552('0xc'),_0x28804d,_0x23fd5d[_0xd552('0x10')][_0xd552('0x12')]);return _0x5a2d91(_0x23fd5d[_0xd552('0x10')][_0xd552('0x12')]);}else{logger[_0xd552('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x28804d,_0xd552('0xd'));_0x5a2d91(_0x23fd5d['result']['message']);}})[_0xd552('0x14')](function(_0x38d589){logger[_0xd552('0x10')](_0xd552('0xc'),_0x28804d,_0x38d589);_0x3b9e26(_0x38d589);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4a4e834..350f98d 100644 --- a/server/api/intSugarcrmField/index.js +++ b/server/api/intSugarcrmField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabb9=['isAuthenticated','get','/:id','show','post','create','put','destroy','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabb9,0x78));var _0x9abb=function(_0xb5484c,_0x38fc0c){_0xb5484c=_0xb5484c-0x0;var _0x235b8b=_0xabb9[_0xb5484c];return _0x235b8b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9abb('0x0'));var timeout=require(_0x9abb('0x1'));var express=require('express');var router=express[_0x9abb('0x2')]();var fs_extra=require(_0x9abb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9abb('0x4'));var config=require('../../config/environment');var controller=require(_0x9abb('0x5'));router['get']('/',auth[_0x9abb('0x6')](),controller['index']);router[_0x9abb('0x7')](_0x9abb('0x8'),auth[_0x9abb('0x6')](),controller[_0x9abb('0x9')]);router[_0x9abb('0xa')]('/',auth['isAuthenticated'](),controller[_0x9abb('0xb')]);router[_0x9abb('0xc')]('/:id',auth[_0x9abb('0x6')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9abb('0xd')]);module['exports']=router; \ No newline at end of file +var _0xdeeb=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','create','put'];(function(_0x198885,_0x2f71b6){var _0x3b0ca0=function(_0x377394){while(--_0x377394){_0x198885['push'](_0x198885['shift']());}};_0x3b0ca0(++_0x2f71b6);}(_0xdeeb,0x93));var _0xbdee=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xdeeb[_0x2bc3f4];return _0x14ac53;};'use strict';var multer=require(_0xbdee('0x0'));var util=require(_0xbdee('0x1'));var path=require(_0xbdee('0x2'));var timeout=require(_0xbdee('0x3'));var express=require('express');var router=express[_0xbdee('0x4')]();var fs_extra=require(_0xbdee('0x5'));var auth=require(_0xbdee('0x6'));var interaction=require(_0xbdee('0x7'));var config=require('../../config/environment');var controller=require(_0xbdee('0x8'));router[_0xbdee('0x9')]('/',auth[_0xbdee('0xa')](),controller[_0xbdee('0xb')]);router[_0xbdee('0x9')](_0xbdee('0xc'),auth[_0xbdee('0xa')](),controller['show']);router['post']('/',auth[_0xbdee('0xa')](),controller[_0xbdee('0xd')]);router[_0xbdee('0xe')](_0xbdee('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbdee('0xf')](_0xbdee('0xc'),auth['isAuthenticated'](),controller[_0xbdee('0x10')]);module[_0xbdee('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 24a87be..5d443dc 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.attributes.js +++ b/server/api/intSugarcrmField/intSugarcrmField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cbf=['sequelize','exports','string','customVariable','keyValue','STRING','ENUM','variable'];(function(_0x29181e,_0x489a0d){var _0x56088c=function(_0x572efc){while(--_0x572efc){_0x29181e['push'](_0x29181e['shift']());}};_0x56088c(++_0x489a0d);}(_0x6cbf,0x188));var _0xf6cb=function(_0x4441c1,_0x223037){_0x4441c1=_0x4441c1-0x0;var _0x4485cd=_0x6cbf[_0x4441c1];return _0x4485cd;};'use strict';var Sequelize=require(_0xf6cb('0x0'));module[_0xf6cb('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf6cb('0x2'),'variable',_0xf6cb('0x3'),_0xf6cb('0x4'),'picklist'),'defaultValue':_0xf6cb('0x2')},'content':{'type':Sequelize[_0xf6cb('0x5')]},'key':{'type':Sequelize[_0xf6cb('0x5')]},'keyType':{'type':Sequelize[_0xf6cb('0x6')]('string',_0xf6cb('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf6cb('0x5')]}}; \ No newline at end of file +var _0x0392=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0xc2a56e,_0x3650fb){var _0x20c022=function(_0x2e23bf){while(--_0x2e23bf){_0xc2a56e['push'](_0xc2a56e['shift']());}};_0x20c022(++_0x3650fb);}(_0x0392,0x66));var _0x2039=function(_0x331ce0,_0xe335b9){_0x331ce0=_0x331ce0-0x0;var _0x31c3c7=_0x0392[_0x331ce0];return _0x31c3c7;};'use strict';var Sequelize=require(_0x2039('0x0'));module[_0x2039('0x1')]={'type':{'type':Sequelize[_0x2039('0x2')](_0x2039('0x3'),_0x2039('0x4'),_0x2039('0x5'),_0x2039('0x6'),_0x2039('0x7')),'defaultValue':_0x2039('0x3')},'content':{'type':Sequelize[_0x2039('0x8')]},'key':{'type':Sequelize[_0x2039('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x2039('0x3'),'variable',_0x2039('0x5'))},'keyContent':{'type':Sequelize[_0x2039('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2039('0x8')]},'customField':{'type':Sequelize[_0x2039('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2039('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 637c1fc..50224fc 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.controller.js +++ b/server/api/intSugarcrmField/intSugarcrmField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7929=['type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge'];(function(_0xcd691,_0x145dbd){var _0x5ecf4b=function(_0x2109c9){while(--_0x2109c9){_0xcd691['push'](_0xcd691['shift']());}};_0x5ecf4b(++_0x145dbd);}(_0x7929,0x142));var _0x9792=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0x7929[_0x378b4];return _0x11d07b;};'use strict';var emlformat=require(_0x9792('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9792('0x1'));var jsonpatch=require(_0x9792('0x2'));var rp=require(_0x9792('0x3'));var moment=require(_0x9792('0x4'));var BPromise=require(_0x9792('0x5'));var Mustache=require(_0x9792('0x6'));var util=require(_0x9792('0x7'));var path=require(_0x9792('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9792('0x9'));var fs=require('fs');var fs_extra=require(_0x9792('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9792('0xb'));var jsforce=require(_0x9792('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9792('0xd'));var querystring=require(_0x9792('0xe'));var Papa=require('papaparse');var Redis=require(_0x9792('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9792('0x10'));var as=require(_0x9792('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9792('0x12'))(_0x9792('0x13'));var utils=require(_0x9792('0x14'));var config=require(_0x9792('0x15'));var licenseUtil=require(_0x9792('0x16'));var db=require(_0x9792('0x17'))['db'];function respondWithStatusCode(_0x469be9,_0x2d7684){_0x2d7684=_0x2d7684||0xcc;return function(_0x542161){if(_0x542161){return _0x469be9[_0x9792('0x18')](_0x2d7684);}return _0x469be9[_0x9792('0x19')](_0x2d7684)['end']();};}function respondWithResult(_0x2e3433,_0x3b12f9){_0x3b12f9=_0x3b12f9||0xc8;return function(_0x3c6e97){if(_0x3c6e97){return _0x2e3433[_0x9792('0x19')](_0x3b12f9)[_0x9792('0x1a')](_0x3c6e97);}};}function respondWithFilteredResult(_0xb46c6b,_0x4f620e){return function(_0x5f58a4){if(_0x5f58a4){var _0x319347=typeof _0x4f620e[_0x9792('0x1b')]===_0x9792('0x1c')&&typeof _0x4f620e['limit']===_0x9792('0x1c');var _0xa06a4d=_0x5f58a4[_0x9792('0x1d')];var _0x5c413a=_0x319347?0x0:_0x4f620e['offset'];var _0x2cfb21=_0x319347?_0x5f58a4['count']:_0x4f620e['offset']+_0x4f620e[_0x9792('0x1e')];var _0x41f0ab;if(_0x2cfb21>=_0xa06a4d){_0x2cfb21=_0xa06a4d;_0x41f0ab=0xc8;}else{_0x41f0ab=0xce;}_0xb46c6b[_0x9792('0x19')](_0x41f0ab);return _0xb46c6b[_0x9792('0x1f')](_0x9792('0x20'),_0x5c413a+'-'+_0x2cfb21+'/'+_0xa06a4d)[_0x9792('0x1a')](_0x5f58a4);}return null;};}function patchUpdates(_0x17e71d){return function(_0x578866){try{jsonpatch[_0x9792('0x21')](_0x578866,_0x17e71d,!![]);}catch(_0x1f867e){return BPromise[_0x9792('0x22')](_0x1f867e);}return _0x578866[_0x9792('0x23')]();};}function saveUpdates(_0x20e1a2,_0x3265aa){return function(_0x47a67c){if(_0x47a67c){return _0x47a67c[_0x9792('0x24')](_0x20e1a2)[_0x9792('0x25')](function(_0x5afd16){return _0x5afd16;});}return null;};}function removeEntity(_0x5d89b4,_0x597cba){return function(_0x5d32f2){if(_0x5d32f2){return _0x5d32f2[_0x9792('0x26')]()[_0x9792('0x25')](function(){_0x5d89b4[_0x9792('0x19')](0xcc)[_0x9792('0x27')]();});}};}function handleEntityNotFound(_0x1072e9,_0xfa1202){return function(_0x4e99de){if(!_0x4e99de){_0x1072e9['sendStatus'](0x194);}return _0x4e99de;};}function handleError(_0x5d69c0,_0x15bc73){_0x15bc73=_0x15bc73||0x1f4;return function(_0x346460){logger[_0x9792('0x28')](_0x346460[_0x9792('0x29')]);if(_0x346460[_0x9792('0x2a')]){delete _0x346460[_0x9792('0x2a')];}_0x5d69c0[_0x9792('0x19')](_0x15bc73)['send'](_0x346460);};}exports[_0x9792('0x2b')]=function(_0x20ecab,_0x40ba19){var _0x442945={},_0xd2c8d={},_0x2bda63={'count':0x0,'rows':[]};var _0xd69313=_[_0x9792('0x2c')](db[_0x9792('0x2d')][_0x9792('0x2e')],function(_0x3f6a05){return{'name':_0x3f6a05[_0x9792('0x2f')],'type':_0x3f6a05['type'][_0x9792('0x30')]};});_0xd2c8d[_0x9792('0x31')]=_[_0x9792('0x2c')](_0xd69313,'name');_0xd2c8d[_0x9792('0x32')]=_['keys'](_0x20ecab[_0x9792('0x32')]);_0xd2c8d[_0x9792('0x33')]=_['intersection'](_0xd2c8d[_0x9792('0x31')],_0xd2c8d[_0x9792('0x32')]);_0x442945[_0x9792('0x34')]=_[_0x9792('0x35')](_0xd2c8d['model'],qs['fields'](_0x20ecab[_0x9792('0x32')][_0x9792('0x36')]));_0x442945[_0x9792('0x34')]=_0x442945[_0x9792('0x34')][_0x9792('0x37')]?_0x442945[_0x9792('0x34')]:_0xd2c8d[_0x9792('0x31')];if(!_0x20ecab['query'][_0x9792('0x38')](_0x9792('0x39'))){_0x442945['limit']=qs['limit'](_0x20ecab[_0x9792('0x32')][_0x9792('0x1e')]);_0x442945['offset']=qs[_0x9792('0x1b')](_0x20ecab[_0x9792('0x32')][_0x9792('0x1b')]);}_0x442945['order']=qs[_0x9792('0x3a')](_0x20ecab[_0x9792('0x32')][_0x9792('0x3a')]);_0x442945['where']=qs[_0x9792('0x33')](_[_0x9792('0x3b')](_0x20ecab['query'],_0xd2c8d[_0x9792('0x33')]),_0xd69313);if(_0x20ecab[_0x9792('0x32')][_0x9792('0x3c')]){_0x442945[_0x9792('0x3d')]=_[_0x9792('0x3e')](_0x442945[_0x9792('0x3d')],{'$or':_[_0x9792('0x2c')](_0xd69313,function(_0x2fc944){if(_0x2fc944[_0x9792('0x3f')]!==_0x9792('0x40')){var _0x31ac52={};_0x31ac52[_0x2fc944[_0x9792('0x2a')]]={'$like':'%'+_0x20ecab[_0x9792('0x32')]['filter']+'%'};return _0x31ac52;}})});}_0x442945=_['merge']({},_0x442945,_0x20ecab['options']);var _0x27d755={'where':_0x442945[_0x9792('0x3d')]};return db[_0x9792('0x2d')][_0x9792('0x1d')](_0x27d755)[_0x9792('0x25')](function(_0x3d2647){_0x2bda63[_0x9792('0x1d')]=_0x3d2647;if(_0x20ecab[_0x9792('0x32')][_0x9792('0x41')]){_0x442945[_0x9792('0x42')]=[{'all':!![]}];}return db[_0x9792('0x2d')][_0x9792('0x43')](_0x442945);})['then'](function(_0x282cd5){_0x2bda63[_0x9792('0x44')]=_0x282cd5;return _0x2bda63;})['then'](respondWithFilteredResult(_0x40ba19,_0x442945))[_0x9792('0x45')](handleError(_0x40ba19,null));};exports[_0x9792('0x46')]=function(_0x5a463f,_0x1d10b3){var _0x2bae65={'raw':!![],'where':{'id':_0x5a463f[_0x9792('0x47')]['id']}},_0x24547a={};_0x24547a['model']=_['keys'](db[_0x9792('0x2d')][_0x9792('0x2e')]);_0x24547a['query']=_[_0x9792('0x48')](_0x5a463f['query']);_0x24547a[_0x9792('0x33')]=_[_0x9792('0x35')](_0x24547a[_0x9792('0x31')],_0x24547a[_0x9792('0x32')]);_0x2bae65[_0x9792('0x34')]=_[_0x9792('0x35')](_0x24547a[_0x9792('0x31')],qs['fields'](_0x5a463f[_0x9792('0x32')][_0x9792('0x36')]));_0x2bae65[_0x9792('0x34')]=_0x2bae65[_0x9792('0x34')]['length']?_0x2bae65['attributes']:_0x24547a['model'];if(_0x5a463f[_0x9792('0x32')]['includeAll']){_0x2bae65[_0x9792('0x42')]=[{'all':!![]}];}_0x2bae65=_[_0x9792('0x3e')]({},_0x2bae65,_0x5a463f[_0x9792('0x49')]);return db[_0x9792('0x2d')]['find'](_0x2bae65)[_0x9792('0x25')](handleEntityNotFound(_0x1d10b3,null))[_0x9792('0x25')](respondWithResult(_0x1d10b3,null))['catch'](handleError(_0x1d10b3,null));};exports[_0x9792('0x4a')]=function(_0x45b9ca,_0x2ea901){return db[_0x9792('0x2d')]['create'](_0x45b9ca[_0x9792('0x4b')],{})[_0x9792('0x25')](respondWithResult(_0x2ea901,0xc9))['catch'](handleError(_0x2ea901,null));};exports[_0x9792('0x24')]=function(_0x5091ed,_0x1c4c57){if(_0x5091ed[_0x9792('0x4b')]['id']){delete _0x5091ed[_0x9792('0x4b')]['id'];}return db[_0x9792('0x2d')][_0x9792('0x4c')]({'where':{'id':_0x5091ed[_0x9792('0x47')]['id']}})[_0x9792('0x25')](handleEntityNotFound(_0x1c4c57,null))[_0x9792('0x25')](saveUpdates(_0x5091ed['body'],null))[_0x9792('0x25')](respondWithResult(_0x1c4c57,null))[_0x9792('0x45')](handleError(_0x1c4c57,null));};exports['destroy']=function(_0x29cba9,_0x5434b3){return db['SugarcrmField']['find']({'where':{'id':_0x29cba9[_0x9792('0x47')]['id']}})['then'](handleEntityNotFound(_0x5434b3,null))['then'](removeEntity(_0x5434b3,null))[_0x9792('0x45')](handleError(_0x5434b3,null));}; \ No newline at end of file +var _0xfcfa=['../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util'];(function(_0x45dec8,_0x20a9c0){var _0x2f5625=function(_0x44e54b){while(--_0x44e54b){_0x45dec8['push'](_0x45dec8['shift']());}};_0x2f5625(++_0x20a9c0);}(_0xfcfa,0x84));var _0xafcf=function(_0x3c9058,_0x68b1e3){_0x3c9058=_0x3c9058-0x0;var _0x5c1c81=_0xfcfa[_0x3c9058];return _0x5c1c81;};'use strict';var emlformat=require(_0xafcf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xafcf('0x1'));var rp=require(_0xafcf('0x2'));var moment=require(_0xafcf('0x3'));var BPromise=require(_0xafcf('0x4'));var Mustache=require(_0xafcf('0x5'));var util=require('util');var path=require(_0xafcf('0x6'));var sox=require(_0xafcf('0x7'));var csv=require(_0xafcf('0x8'));var ejs=require(_0xafcf('0x9'));var fs=require('fs');var fs_extra=require(_0xafcf('0xa'));var _=require(_0xafcf('0xb'));var squel=require(_0xafcf('0xc'));var crypto=require(_0xafcf('0xd'));var jsforce=require(_0xafcf('0xe'));var deskjs=require(_0xafcf('0xf'));var toCsv=require('to-csv');var querystring=require(_0xafcf('0x10'));var Papa=require(_0xafcf('0x11'));var Redis=require(_0xafcf('0x12'));var authService=require(_0xafcf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xafcf('0x14'));var hardwareService=require(_0xafcf('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xafcf('0x16'));var licenseUtil=require(_0xafcf('0x17'));var db=require(_0xafcf('0x18'))['db'];function respondWithStatusCode(_0x39a858,_0x539465){_0x539465=_0x539465||0xcc;return function(_0x3a9d6d){if(_0x3a9d6d){return _0x39a858[_0xafcf('0x19')](_0x539465);}return _0x39a858['status'](_0x539465)[_0xafcf('0x1a')]();};}function respondWithResult(_0x3b152d,_0x39b182){_0x39b182=_0x39b182||0xc8;return function(_0x1ad81c){if(_0x1ad81c){return _0x3b152d['status'](_0x39b182)[_0xafcf('0x1b')](_0x1ad81c);}};}function respondWithFilteredResult(_0x301131,_0xb1428e){return function(_0x27684d){if(_0x27684d){var _0x487659=typeof _0xb1428e[_0xafcf('0x1c')]===_0xafcf('0x1d')&&typeof _0xb1428e[_0xafcf('0x1e')]===_0xafcf('0x1d');var _0x13b65b=_0x27684d[_0xafcf('0x1f')];var _0x1bffe0=_0x487659?0x0:_0xb1428e['offset'];var _0x5e040f=_0x487659?_0x27684d[_0xafcf('0x1f')]:_0xb1428e[_0xafcf('0x1c')]+_0xb1428e['limit'];var _0x3c7611;if(_0x5e040f>=_0x13b65b){_0x5e040f=_0x13b65b;_0x3c7611=0xc8;}else{_0x3c7611=0xce;}_0x301131['status'](_0x3c7611);return _0x301131[_0xafcf('0x20')](_0xafcf('0x21'),_0x1bffe0+'-'+_0x5e040f+'/'+_0x13b65b)[_0xafcf('0x1b')](_0x27684d);}return null;};}function patchUpdates(_0x1f5425){return function(_0x1b16dd){try{jsonpatch[_0xafcf('0x22')](_0x1b16dd,_0x1f5425,!![]);}catch(_0x18cade){return BPromise[_0xafcf('0x23')](_0x18cade);}return _0x1b16dd[_0xafcf('0x24')]();};}function saveUpdates(_0x4f409e,_0x4b4798){return function(_0x4ea103){if(_0x4ea103){return _0x4ea103[_0xafcf('0x25')](_0x4f409e)[_0xafcf('0x26')](function(_0x2bdb8e){return _0x2bdb8e;});}return null;};}function removeEntity(_0x3beaeb,_0x1ff838){return function(_0xc26e42){if(_0xc26e42){return _0xc26e42[_0xafcf('0x27')]()['then'](function(){_0x3beaeb[_0xafcf('0x28')](0xcc)[_0xafcf('0x1a')]();});}};}function handleEntityNotFound(_0x65169e,_0x1290fc){return function(_0x402897){if(!_0x402897){_0x65169e[_0xafcf('0x19')](0x194);}return _0x402897;};}function handleError(_0x4ea27d,_0x3b0121){_0x3b0121=_0x3b0121||0x1f4;return function(_0x85f5d3){logger[_0xafcf('0x29')](_0x85f5d3[_0xafcf('0x2a')]);if(_0x85f5d3['name']){delete _0x85f5d3[_0xafcf('0x2b')];}_0x4ea27d[_0xafcf('0x28')](_0x3b0121)[_0xafcf('0x2c')](_0x85f5d3);};}exports[_0xafcf('0x2d')]=function(_0x408707,_0x3fc25e){var _0x195bf3={},_0x5644a8={},_0x4cbf87={'count':0x0,'rows':[]};var _0x870647=_[_0xafcf('0x2e')](db[_0xafcf('0x2f')][_0xafcf('0x30')],function(_0x5e115a){return{'name':_0x5e115a[_0xafcf('0x31')],'type':_0x5e115a[_0xafcf('0x32')][_0xafcf('0x33')]};});_0x5644a8[_0xafcf('0x34')]=_[_0xafcf('0x2e')](_0x870647,_0xafcf('0x2b'));_0x5644a8['query']=_[_0xafcf('0x35')](_0x408707[_0xafcf('0x36')]);_0x5644a8[_0xafcf('0x37')]=_['intersection'](_0x5644a8['model'],_0x5644a8[_0xafcf('0x36')]);_0x195bf3[_0xafcf('0x38')]=_[_0xafcf('0x39')](_0x5644a8[_0xafcf('0x34')],qs[_0xafcf('0x3a')](_0x408707[_0xafcf('0x36')][_0xafcf('0x3a')]));_0x195bf3['attributes']=_0x195bf3['attributes'][_0xafcf('0x3b')]?_0x195bf3['attributes']:_0x5644a8[_0xafcf('0x34')];if(!_0x408707[_0xafcf('0x36')][_0xafcf('0x3c')](_0xafcf('0x3d'))){_0x195bf3[_0xafcf('0x1e')]=qs[_0xafcf('0x1e')](_0x408707[_0xafcf('0x36')]['limit']);_0x195bf3[_0xafcf('0x1c')]=qs[_0xafcf('0x1c')](_0x408707[_0xafcf('0x36')]['offset']);}_0x195bf3[_0xafcf('0x3e')]=qs['sort'](_0x408707[_0xafcf('0x36')][_0xafcf('0x3f')]);_0x195bf3['where']=qs[_0xafcf('0x37')](_['pick'](_0x408707[_0xafcf('0x36')],_0x5644a8[_0xafcf('0x37')]),_0x870647);if(_0x408707[_0xafcf('0x36')][_0xafcf('0x40')]){_0x195bf3[_0xafcf('0x41')]=_['merge'](_0x195bf3[_0xafcf('0x41')],{'$or':_[_0xafcf('0x2e')](_0x870647,function(_0x511097){if(_0x511097[_0xafcf('0x32')]!==_0xafcf('0x42')){var _0x45c789={};_0x45c789[_0x511097[_0xafcf('0x2b')]]={'$like':'%'+_0x408707['query'][_0xafcf('0x40')]+'%'};return _0x45c789;}})});}_0x195bf3=_[_0xafcf('0x43')]({},_0x195bf3,_0x408707[_0xafcf('0x44')]);var _0x17aef7={'where':_0x195bf3[_0xafcf('0x41')]};return db[_0xafcf('0x2f')][_0xafcf('0x1f')](_0x17aef7)[_0xafcf('0x26')](function(_0x188626){_0x4cbf87[_0xafcf('0x1f')]=_0x188626;if(_0x408707[_0xafcf('0x36')][_0xafcf('0x45')]){_0x195bf3['include']=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x195bf3);})[_0xafcf('0x26')](function(_0x49b9b7){_0x4cbf87[_0xafcf('0x46')]=_0x49b9b7;return _0x4cbf87;})['then'](respondWithFilteredResult(_0x3fc25e,_0x195bf3))[_0xafcf('0x47')](handleError(_0x3fc25e,null));};exports[_0xafcf('0x48')]=function(_0x503abc,_0xa3621d){var _0x17ba81={'raw':!![],'where':{'id':_0x503abc[_0xafcf('0x49')]['id']}},_0x3a17fa={};_0x3a17fa[_0xafcf('0x34')]=_[_0xafcf('0x35')](db[_0xafcf('0x2f')][_0xafcf('0x30')]);_0x3a17fa['query']=_[_0xafcf('0x35')](_0x503abc[_0xafcf('0x36')]);_0x3a17fa[_0xafcf('0x37')]=_[_0xafcf('0x39')](_0x3a17fa[_0xafcf('0x34')],_0x3a17fa[_0xafcf('0x36')]);_0x17ba81['attributes']=_[_0xafcf('0x39')](_0x3a17fa[_0xafcf('0x34')],qs[_0xafcf('0x3a')](_0x503abc['query'][_0xafcf('0x3a')]));_0x17ba81['attributes']=_0x17ba81['attributes'][_0xafcf('0x3b')]?_0x17ba81[_0xafcf('0x38')]:_0x3a17fa[_0xafcf('0x34')];if(_0x503abc[_0xafcf('0x36')][_0xafcf('0x45')]){_0x17ba81[_0xafcf('0x4a')]=[{'all':!![]}];}_0x17ba81=_['merge']({},_0x17ba81,_0x503abc[_0xafcf('0x44')]);return db[_0xafcf('0x2f')][_0xafcf('0x4b')](_0x17ba81)['then'](handleEntityNotFound(_0xa3621d,null))['then'](respondWithResult(_0xa3621d,null))[_0xafcf('0x47')](handleError(_0xa3621d,null));};exports[_0xafcf('0x4c')]=function(_0x399a1e,_0x52f99d){return db[_0xafcf('0x2f')]['create'](_0x399a1e[_0xafcf('0x4d')],{})[_0xafcf('0x26')](respondWithResult(_0x52f99d,0xc9))['catch'](handleError(_0x52f99d,null));};exports[_0xafcf('0x25')]=function(_0xed08fc,_0x233a50){if(_0xed08fc[_0xafcf('0x4d')]['id']){delete _0xed08fc[_0xafcf('0x4d')]['id'];}return db[_0xafcf('0x2f')][_0xafcf('0x4b')]({'where':{'id':_0xed08fc[_0xafcf('0x49')]['id']}})[_0xafcf('0x26')](handleEntityNotFound(_0x233a50,null))[_0xafcf('0x26')](saveUpdates(_0xed08fc[_0xafcf('0x4d')],null))[_0xafcf('0x26')](respondWithResult(_0x233a50,null))['catch'](handleError(_0x233a50,null));};exports[_0xafcf('0x27')]=function(_0x51d8b3,_0x3e5fe9){return db[_0xafcf('0x2f')][_0xafcf('0x4b')]({'where':{'id':_0x51d8b3['params']['id']}})[_0xafcf('0x26')](handleEntityNotFound(_0x3e5fe9,null))[_0xafcf('0x26')](removeEntity(_0x3e5fe9,null))[_0xafcf('0x47')](handleError(_0x3e5fe9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4ff9336..48403c0 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.model.js +++ b/server/api/intSugarcrmField/intSugarcrmField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdfb=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x44aac2,_0x336163){var _0x38a6bc=function(_0x423444){while(--_0x423444){_0x44aac2['push'](_0x44aac2['shift']());}};_0x38a6bc(++_0x336163);}(_0xcdfb,0x84));var _0xbcdf=function(_0x13fcb6,_0x577407){_0x13fcb6=_0x13fcb6-0x0;var _0x4a0498=_0xcdfb[_0x13fcb6];return _0x4a0498;};'use strict';var _=require(_0xbcdf('0x0'));var util=require(_0xbcdf('0x1'));var logger=require(_0xbcdf('0x2'))('api');var moment=require(_0xbcdf('0x3'));var BPromise=require(_0xbcdf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcdf('0x5'));var rimraf=require(_0xbcdf('0x6'));var config=require(_0xbcdf('0x7'));var attributes=require(_0xbcdf('0x8'));module[_0xbcdf('0x9')]=function(_0x8b2712,_0xaa6009){return _0x8b2712[_0xbcdf('0xa')](_0xbcdf('0xb'),attributes,{'tableName':_0xbcdf('0xc'),'paranoid':![],'indexes':[{'name':_0xbcdf('0xd'),'fields':[_0xbcdf('0xe'),_0xbcdf('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbe5=['int_sugarcrm_fields','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0xfbe5,0x1a6));var _0x5fbe=function(_0x87aa9e,_0x36e0a3){_0x87aa9e=_0x87aa9e-0x0;var _0x1d4ed3=_0xfbe5[_0x87aa9e];return _0x1d4ed3;};'use strict';var _=require(_0x5fbe('0x0'));var util=require(_0x5fbe('0x1'));var logger=require(_0x5fbe('0x2'))('api');var moment=require(_0x5fbe('0x3'));var BPromise=require(_0x5fbe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fbe('0x5'));var rimraf=require(_0x5fbe('0x6'));var config=require(_0x5fbe('0x7'));var attributes=require(_0x5fbe('0x8'));module[_0x5fbe('0x9')]=function(_0x84c0be,_0x5b2819){return _0x84c0be[_0x5fbe('0xa')](_0x5fbe('0xb'),attributes,{'tableName':_0x5fbe('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x5fbe('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index a019acb..d9e1b2c 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.rpc.js +++ b/server/api/intSugarcrmField/intSugarcrmField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2eb5=['result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x221d12,_0x1c71f2){var _0x5def23=function(_0x338c57){while(--_0x338c57){_0x221d12['push'](_0x221d12['shift']());}};_0x5def23(++_0x1c71f2);}(_0x2eb5,0x1a6));var _0x52eb=function(_0x3a3cb2,_0x5aba91){_0x3a3cb2=_0x3a3cb2-0x0;var _0x5eef75=_0x2eb5[_0x3a3cb2];return _0x5eef75;};'use strict';var _=require('lodash');var util=require(_0x52eb('0x0'));var moment=require('moment');var BPromise=require(_0x52eb('0x1'));var rs=require(_0x52eb('0x2'));var fs=require('fs');var Redis=require(_0x52eb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x52eb('0x4'));var logger=require(_0x52eb('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x52eb('0x6'));var client=jayson[_0x52eb('0x7')][_0x52eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x240e9c,_0x2881de,_0x267830){return new BPromise(function(_0x5374e5,_0x169d57){return client['request'](_0x240e9c,_0x267830)[_0x52eb('0x9')](function(_0x5515af){logger[_0x52eb('0xa')](_0x52eb('0xb'),_0x2881de,'request\x20sent');logger[_0x52eb('0xc')](_0x52eb('0xd'),_0x2881de,_0x52eb('0xe'),JSON[_0x52eb('0xf')](_0x5515af));if(_0x5515af['error']){if(_0x5515af[_0x52eb('0x10')][_0x52eb('0x11')]===0x1f4){logger[_0x52eb('0x10')](_0x52eb('0xb'),_0x2881de,_0x5515af[_0x52eb('0x10')][_0x52eb('0x12')]);return _0x169d57(_0x5515af['error']['message']);}logger[_0x52eb('0x10')](_0x52eb('0xb'),_0x2881de,_0x5515af[_0x52eb('0x10')][_0x52eb('0x12')]);return _0x5374e5(_0x5515af[_0x52eb('0x10')][_0x52eb('0x12')]);}else{logger['info'](_0x52eb('0xb'),_0x2881de,_0x52eb('0xe'));_0x5374e5(_0x5515af[_0x52eb('0x13')]['message']);}})[_0x52eb('0x14')](function(_0x28bc95){logger['error'](_0x52eb('0xb'),_0x2881de,_0x28bc95);_0x169d57(_0x28bc95);});});} \ No newline at end of file +var _0x9c8e=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x9c8e,0x14b));var _0xe9c8=function(_0x316067,_0x1766f9){_0x316067=_0x316067-0x0;var _0x1dfb40=_0x9c8e[_0x316067];return _0x1dfb40;};'use strict';var _=require(_0xe9c8('0x0'));var util=require(_0xe9c8('0x1'));var moment=require(_0xe9c8('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9c8('0x3'));var fs=require('fs');var Redis=require(_0xe9c8('0x4'));var db=require(_0xe9c8('0x5'))['db'];var utils=require(_0xe9c8('0x6'));var logger=require(_0xe9c8('0x7'))('rpc');var config=require(_0xe9c8('0x8'));var jayson=require(_0xe9c8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x547c74,_0x5c87cb,_0x155321){return new BPromise(function(_0x3e350f,_0x2b6be0){return client[_0xe9c8('0xa')](_0x547c74,_0x155321)['then'](function(_0x3616d9){logger['info'](_0xe9c8('0xb'),_0x5c87cb,_0xe9c8('0xc'));logger[_0xe9c8('0xd')](_0xe9c8('0xe'),_0x5c87cb,'request\x20sent',JSON[_0xe9c8('0xf')](_0x3616d9));if(_0x3616d9[_0xe9c8('0x10')]){if(_0x3616d9[_0xe9c8('0x10')]['code']===0x1f4){logger[_0xe9c8('0x10')](_0xe9c8('0xb'),_0x5c87cb,_0x3616d9[_0xe9c8('0x10')][_0xe9c8('0x11')]);return _0x2b6be0(_0x3616d9['error']['message']);}logger[_0xe9c8('0x10')](_0xe9c8('0xb'),_0x5c87cb,_0x3616d9[_0xe9c8('0x10')]['message']);return _0x3e350f(_0x3616d9[_0xe9c8('0x10')][_0xe9c8('0x11')]);}else{logger[_0xe9c8('0x12')](_0xe9c8('0xb'),_0x5c87cb,_0xe9c8('0xc'));_0x3e350f(_0x3616d9[_0xe9c8('0x13')][_0xe9c8('0x11')]);}})[_0xe9c8('0x14')](function(_0x1cc6ac){logger[_0xe9c8('0x10')](_0xe9c8('0xb'),_0x5c87cb,_0x1cc6ac);_0x2b6be0(_0x1cc6ac);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4662e61..7e18cff 100644 --- a/server/api/intVtigerAccount/index.js +++ b/server/api/intVtigerAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54da=['addConfiguration','update','delete','/:id','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','index','get','/:id/configurations','isAuthenticated','/:id/fields','post','create'];(function(_0x38e4ee,_0x3e780e){var _0x3094f7=function(_0x4ba459){while(--_0x4ba459){_0x38e4ee['push'](_0x38e4ee['shift']());}};_0x3094f7(++_0x3e780e);}(_0x54da,0x9d));var _0xa54d=function(_0x20a270,_0x8b8437){_0x20a270=_0x20a270-0x0;var _0x49429a=_0x54da[_0x20a270];return _0x49429a;};'use strict';var multer=require(_0xa54d('0x0'));var util=require('util');var path=require(_0xa54d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa54d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa54d('0x3'));var interaction=require(_0xa54d('0x4'));var config=require(_0xa54d('0x5'));var controller=require(_0xa54d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa54d('0x7')]);router[_0xa54d('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa54d('0x8')](_0xa54d('0x9'),auth[_0xa54d('0xa')](),controller['getConfigurations']);router[_0xa54d('0x8')](_0xa54d('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0xa54d('0xc')]('/',auth['isAuthenticated'](),controller[_0xa54d('0xd')]);router[_0xa54d('0xc')](_0xa54d('0x9'),auth['isAuthenticated'](),controller[_0xa54d('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa54d('0xf')]);router[_0xa54d('0x10')](_0xa54d('0x11'),auth[_0xa54d('0xa')](),controller[_0xa54d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x95d9=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','multer','util','path'];(function(_0x246119,_0x30a4f3){var _0x59c74f=function(_0x313fb5){while(--_0x313fb5){_0x246119['push'](_0x246119['shift']());}};_0x59c74f(++_0x30a4f3);}(_0x95d9,0x97));var _0x995d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x95d9[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x995d('0x0'));var util=require(_0x995d('0x1'));var path=require(_0x995d('0x2'));var timeout=require(_0x995d('0x3'));var express=require('express');var router=express[_0x995d('0x4')]();var fs_extra=require(_0x995d('0x5'));var auth=require(_0x995d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x995d('0x7'));var controller=require(_0x995d('0x8'));router[_0x995d('0x9')]('/',auth[_0x995d('0xa')](),controller[_0x995d('0xb')]);router['get'](_0x995d('0xc'),auth[_0x995d('0xa')](),controller[_0x995d('0xd')]);router[_0x995d('0x9')](_0x995d('0xe'),auth[_0x995d('0xa')](),controller['getConfigurations']);router[_0x995d('0x9')](_0x995d('0xf'),auth[_0x995d('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x995d('0x10')](_0x995d('0xe'),auth[_0x995d('0xa')](),controller[_0x995d('0x11')]);router[_0x995d('0x12')]('/:id',auth[_0x995d('0xa')](),controller[_0x995d('0x13')]);router[_0x995d('0x14')](_0x995d('0xc'),auth['isAuthenticated'](),controller[_0x995d('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index b89b549..4e82ef8 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.attributes.js +++ b/server/api/intVtigerAccount/intVtigerAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c00=['STRING','HelpDesk','sequelize'];(function(_0x473d01,_0x2ed44e){var _0x12ed60=function(_0x1192df){while(--_0x1192df){_0x473d01['push'](_0x473d01['shift']());}};_0x12ed60(++_0x2ed44e);}(_0x8c00,0x13d));var _0x08c0=function(_0x55cb9f,_0x64654d){_0x55cb9f=_0x55cb9f-0x0;var _0x272a75=_0x8c00[_0x55cb9f];return _0x272a75;};'use strict';var Sequelize=require(_0x08c0('0x0'));module['exports']={'name':{'type':Sequelize[_0x08c0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x08c0('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x08c0('0x1')],'allowNull':![],'defaultValue':_0x08c0('0x2')},'remoteUri':{'type':Sequelize[_0x08c0('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe658=['HelpDesk','sequelize','exports','STRING'];(function(_0x237786,_0x293124){var _0x184527=function(_0x541c9c){while(--_0x541c9c){_0x237786['push'](_0x237786['shift']());}};_0x184527(++_0x293124);}(_0xe658,0x115));var _0x8e65=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe658[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x8e65('0x0'));module[_0x8e65('0x1')]={'name':{'type':Sequelize[_0x8e65('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8e65('0x2')]},'username':{'type':Sequelize[_0x8e65('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8e65('0x3')},'remoteUri':{'type':Sequelize[_0x8e65('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8e65('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8e65('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 817caf5..1dbddaa 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.controller.js +++ b/server/api/intVtigerAccount/intVtigerAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d60=['model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','include','findAll','rows','catch','params','fields','includeAll','find','create','body','update','getConfigurations','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','Subjects','md5','username','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','login','token','success','describe','result','reference','owner','remove','false','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','moment','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection'];(function(_0x1e26b9,_0x136dcf){var _0x37152b=function(_0x5bf9d6){while(--_0x5bf9d6){_0x1e26b9['push'](_0x1e26b9['shift']());}};_0x37152b(++_0x136dcf);}(_0x6d60,0x196));var _0x06d6=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x6d60[_0x4b7b62];return _0x2280df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06d6('0x0'));var zipdir=require(_0x06d6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x06d6('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x06d6('0x3'));var path=require(_0x06d6('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x06d6('0x5'));var fs=require('fs');var fs_extra=require(_0x06d6('0x6'));var _=require('lodash');var squel=require(_0x06d6('0x7'));var crypto=require(_0x06d6('0x8'));var jsforce=require(_0x06d6('0x9'));var deskjs=require(_0x06d6('0xa'));var toCsv=require(_0x06d6('0xb'));var querystring=require(_0x06d6('0xc'));var Papa=require('papaparse');var Redis=require(_0x06d6('0xd'));var authService=require(_0x06d6('0xe'));var qs=require(_0x06d6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06d6('0x10'));var logger=require('../../config/logger')(_0x06d6('0x11'));var utils=require(_0x06d6('0x12'));var config=require(_0x06d6('0x13'));var licenseUtil=require(_0x06d6('0x14'));var db=require(_0x06d6('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e9cab,_0x2ecb45){_0x2ecb45=_0x2ecb45||0xcc;return function(_0x601973){if(_0x601973){return _0x3e9cab[_0x06d6('0x16')](_0x2ecb45);}return _0x3e9cab[_0x06d6('0x17')](_0x2ecb45)['end']();};}function respondWithResult(_0x5544df,_0x27887b){_0x27887b=_0x27887b||0xc8;return function(_0x59a45a){if(_0x59a45a){return _0x5544df[_0x06d6('0x17')](_0x27887b)[_0x06d6('0x18')](_0x59a45a);}};}function respondWithFilteredResult(_0x41e5e5,_0x34be6e){return function(_0x39840d){if(_0x39840d){var _0x1fa884=typeof _0x34be6e['offset']===_0x06d6('0x19')&&typeof _0x34be6e[_0x06d6('0x1a')]===_0x06d6('0x19');var _0x331dcb=_0x39840d[_0x06d6('0x1b')];var _0x77f548=_0x1fa884?0x0:_0x34be6e[_0x06d6('0x1c')];var _0xbb86a3=_0x1fa884?_0x39840d['count']:_0x34be6e[_0x06d6('0x1c')]+_0x34be6e[_0x06d6('0x1a')];var _0x205de6;if(_0xbb86a3>=_0x331dcb){_0xbb86a3=_0x331dcb;_0x205de6=0xc8;}else{_0x205de6=0xce;}_0x41e5e5[_0x06d6('0x17')](_0x205de6);return _0x41e5e5['set'](_0x06d6('0x1d'),_0x77f548+'-'+_0xbb86a3+'/'+_0x331dcb)['json'](_0x39840d);}return null;};}function patchUpdates(_0x1228c7){return function(_0x476c9b){try{jsonpatch[_0x06d6('0x1e')](_0x476c9b,_0x1228c7,!![]);}catch(_0x22cc9b){return BPromise['reject'](_0x22cc9b);}return _0x476c9b[_0x06d6('0x1f')]();};}function saveUpdates(_0x5c7f33,_0x5289e4){return function(_0x35b7b6){if(_0x35b7b6){return _0x35b7b6['update'](_0x5c7f33)[_0x06d6('0x20')](function(_0x5cb36d){return _0x5cb36d;});}return null;};}function removeEntity(_0x2c25fe,_0x5c8de7){return function(_0x3b573d){if(_0x3b573d){return _0x3b573d[_0x06d6('0x21')]()[_0x06d6('0x20')](function(){_0x2c25fe['status'](0xcc)[_0x06d6('0x22')]();});}};}function handleEntityNotFound(_0x462b08,_0x159809){return function(_0x707d97){if(!_0x707d97){_0x462b08[_0x06d6('0x16')](0x194);}return _0x707d97;};}function handleError(_0x4bd8b3,_0xbf08e0){_0xbf08e0=_0xbf08e0||0x1f4;return function(_0x414b72){logger[_0x06d6('0x23')](_0x414b72[_0x06d6('0x24')]);if(_0x414b72[_0x06d6('0x25')]){delete _0x414b72[_0x06d6('0x25')];}_0x4bd8b3[_0x06d6('0x17')](_0xbf08e0)[_0x06d6('0x26')](_0x414b72);};}exports[_0x06d6('0x27')]=function(_0x2ff0fe,_0x5227fb){var _0x2e425a={},_0xf0da2a={},_0x4bcdad={'count':0x0,'rows':[]};var _0x384b7a=_[_0x06d6('0x28')](db[_0x06d6('0x29')][_0x06d6('0x2a')],function(_0x1e5253){return{'name':_0x1e5253[_0x06d6('0x2b')],'type':_0x1e5253[_0x06d6('0x2c')][_0x06d6('0x2d')]};});_0xf0da2a['model']=_[_0x06d6('0x28')](_0x384b7a,'name');_0xf0da2a['query']=_[_0x06d6('0x2e')](_0x2ff0fe[_0x06d6('0x2f')]);_0xf0da2a[_0x06d6('0x30')]=_[_0x06d6('0x31')](_0xf0da2a[_0x06d6('0x32')],_0xf0da2a[_0x06d6('0x2f')]);_0x2e425a[_0x06d6('0x33')]=_[_0x06d6('0x31')](_0xf0da2a['model'],qs['fields'](_0x2ff0fe['query']['fields']));_0x2e425a[_0x06d6('0x33')]=_0x2e425a[_0x06d6('0x33')][_0x06d6('0x34')]?_0x2e425a['attributes']:_0xf0da2a[_0x06d6('0x32')];if(!_0x2ff0fe[_0x06d6('0x2f')][_0x06d6('0x35')](_0x06d6('0x36'))){_0x2e425a[_0x06d6('0x1a')]=qs[_0x06d6('0x1a')](_0x2ff0fe[_0x06d6('0x2f')][_0x06d6('0x1a')]);_0x2e425a[_0x06d6('0x1c')]=qs[_0x06d6('0x1c')](_0x2ff0fe['query'][_0x06d6('0x1c')]);}_0x2e425a[_0x06d6('0x37')]=qs[_0x06d6('0x38')](_0x2ff0fe[_0x06d6('0x2f')][_0x06d6('0x38')]);_0x2e425a['where']=qs[_0x06d6('0x30')](_[_0x06d6('0x39')](_0x2ff0fe[_0x06d6('0x2f')],_0xf0da2a[_0x06d6('0x30')]),_0x384b7a);if(_0x2ff0fe['query']['filter']){_0x2e425a[_0x06d6('0x3a')]=_['merge'](_0x2e425a[_0x06d6('0x3a')],{'$or':_['map'](_0x384b7a,function(_0x2c5e10){if(_0x2c5e10['type']!==_0x06d6('0x3b')){var _0x1d75ac={};_0x1d75ac[_0x2c5e10[_0x06d6('0x25')]]={'$like':'%'+_0x2ff0fe[_0x06d6('0x2f')][_0x06d6('0x3c')]+'%'};return _0x1d75ac;}})});}_0x2e425a=_[_0x06d6('0x3d')]({},_0x2e425a,_0x2ff0fe['options']);var _0xb231f={'where':_0x2e425a[_0x06d6('0x3a')]};return db[_0x06d6('0x29')][_0x06d6('0x1b')](_0xb231f)[_0x06d6('0x20')](function(_0x5e1764){_0x4bcdad['count']=_0x5e1764;if(_0x2ff0fe[_0x06d6('0x2f')]['includeAll']){_0x2e425a[_0x06d6('0x3e')]=[{'all':!![]}];}return db[_0x06d6('0x29')][_0x06d6('0x3f')](_0x2e425a);})['then'](function(_0x2e6407){_0x4bcdad[_0x06d6('0x40')]=_0x2e6407;return _0x4bcdad;})[_0x06d6('0x20')](respondWithFilteredResult(_0x5227fb,_0x2e425a))[_0x06d6('0x41')](handleError(_0x5227fb,null));};exports['show']=function(_0x3594ca,_0x791148){var _0x224dab={'raw':![],'where':{'id':_0x3594ca[_0x06d6('0x42')]['id']}},_0x3ee8c0={};_0x3ee8c0[_0x06d6('0x32')]=_[_0x06d6('0x2e')](db[_0x06d6('0x29')]['rawAttributes']);_0x3ee8c0[_0x06d6('0x2f')]=_['keys'](_0x3594ca[_0x06d6('0x2f')]);_0x3ee8c0[_0x06d6('0x30')]=_[_0x06d6('0x31')](_0x3ee8c0['model'],_0x3ee8c0[_0x06d6('0x2f')]);_0x224dab[_0x06d6('0x33')]=_[_0x06d6('0x31')](_0x3ee8c0['model'],qs['fields'](_0x3594ca['query'][_0x06d6('0x43')]));_0x224dab[_0x06d6('0x33')]=_0x224dab[_0x06d6('0x33')]['length']?_0x224dab[_0x06d6('0x33')]:_0x3ee8c0[_0x06d6('0x32')];if(_0x3594ca[_0x06d6('0x2f')][_0x06d6('0x44')]){_0x224dab['include']=[{'all':!![]}];}_0x224dab=_[_0x06d6('0x3d')]({},_0x224dab,_0x3594ca['options']);return db[_0x06d6('0x29')][_0x06d6('0x45')](_0x224dab)[_0x06d6('0x20')](handleEntityNotFound(_0x791148,null))[_0x06d6('0x20')](respondWithResult(_0x791148,null))[_0x06d6('0x41')](handleError(_0x791148,null));};exports['create']=function(_0x5a6765,_0x49c536){return db[_0x06d6('0x29')][_0x06d6('0x46')](_0x5a6765[_0x06d6('0x47')],{})[_0x06d6('0x20')](respondWithResult(_0x49c536,0xc9))['catch'](handleError(_0x49c536,null));};exports[_0x06d6('0x48')]=function(_0x5f3c90,_0xe3f760){if(_0x5f3c90[_0x06d6('0x47')]['id']){delete _0x5f3c90['body']['id'];}return db[_0x06d6('0x29')]['find']({'where':{'id':_0x5f3c90[_0x06d6('0x42')]['id']}})[_0x06d6('0x20')](handleEntityNotFound(_0xe3f760,null))['then'](saveUpdates(_0x5f3c90[_0x06d6('0x47')],null))[_0x06d6('0x20')](respondWithResult(_0xe3f760,null))[_0x06d6('0x41')](handleError(_0xe3f760,null));};exports[_0x06d6('0x21')]=function(_0x3e096d,_0x4ea0e3){return db[_0x06d6('0x29')][_0x06d6('0x45')]({'where':{'id':_0x3e096d['params']['id']}})[_0x06d6('0x20')](handleEntityNotFound(_0x4ea0e3,null))[_0x06d6('0x20')](removeEntity(_0x4ea0e3,null))[_0x06d6('0x41')](handleError(_0x4ea0e3,null));};exports[_0x06d6('0x49')]=function(_0x5836c9,_0xe9e5a9,_0x35fd08){var _0x1872de={};var _0x37ea01={};var _0x25300d;var _0x279695;return db[_0x06d6('0x29')]['findOne']({'where':{'id':_0x5836c9[_0x06d6('0x42')]['id']}})[_0x06d6('0x20')](handleEntityNotFound(_0xe9e5a9,null))[_0x06d6('0x20')](function(_0x27acbf){if(_0x27acbf){_0x25300d=_0x27acbf;_0x37ea01[_0x06d6('0x32')]=_[_0x06d6('0x2e')](db['VtigerConfiguration'][_0x06d6('0x2a')]);_0x37ea01[_0x06d6('0x2f')]=_['keys'](_0x5836c9[_0x06d6('0x2f')]);_0x37ea01[_0x06d6('0x30')]=_[_0x06d6('0x31')](_0x37ea01[_0x06d6('0x32')],_0x37ea01['query']);_0x1872de[_0x06d6('0x33')]=_[_0x06d6('0x31')](_0x37ea01[_0x06d6('0x32')],qs[_0x06d6('0x43')](_0x5836c9['query']['fields']));_0x1872de['attributes']=_0x1872de['attributes'][_0x06d6('0x34')]?_0x1872de['attributes']:_0x37ea01['model'];_0x1872de[_0x06d6('0x37')]=qs[_0x06d6('0x38')](_0x5836c9[_0x06d6('0x2f')]['sort']);_0x1872de[_0x06d6('0x3a')]=qs[_0x06d6('0x30')](_[_0x06d6('0x39')](_0x5836c9[_0x06d6('0x2f')],_0x37ea01[_0x06d6('0x30')]));if(_0x5836c9['query'][_0x06d6('0x3c')]){_0x1872de[_0x06d6('0x3a')]=_[_0x06d6('0x3d')](_0x1872de[_0x06d6('0x3a')],{'$or':_[_0x06d6('0x28')](_0x1872de['attributes'],function(_0x385b20){var _0xf63951={};_0xf63951[_0x385b20]={'$like':'%'+_0x5836c9[_0x06d6('0x2f')][_0x06d6('0x3c')]+'%'};return _0xf63951;})});}_0x1872de=_[_0x06d6('0x3d')]({},_0x1872de,_0x5836c9['options']);return _0x25300d[_0x06d6('0x49')](_0x1872de);}})[_0x06d6('0x20')](function(_0x5e51b6){if(_0x5e51b6){_0x279695=_0x5e51b6[_0x06d6('0x34')];if(!_0x5836c9[_0x06d6('0x2f')][_0x06d6('0x35')]('nolimit')){_0x1872de[_0x06d6('0x1a')]=qs[_0x06d6('0x1a')](_0x5836c9[_0x06d6('0x2f')][_0x06d6('0x1a')]);_0x1872de['offset']=qs[_0x06d6('0x1c')](_0x5836c9[_0x06d6('0x2f')][_0x06d6('0x1c')]);}return _0x25300d[_0x06d6('0x49')](_0x1872de);}})['then'](function(_0x561b8e){if(_0x561b8e){return _0x561b8e?{'count':_0x279695,'rows':_0x561b8e}:null;}})[_0x06d6('0x20')](respondWithResult(_0xe9e5a9,null))[_0x06d6('0x41')](handleError(_0xe9e5a9,null));};exports['addConfiguration']=function(_0x57a7a1,_0x114d80,_0x5eaeb1){if(_0x57a7a1[_0x06d6('0x47')]['id']){delete _0x57a7a1[_0x06d6('0x47')]['id'];}return db[_0x06d6('0x29')]['findOne']({'where':{'id':_0x57a7a1[_0x06d6('0x42')]['id']}})[_0x06d6('0x20')](handleEntityNotFound(_0x114d80,null))[_0x06d6('0x20')](function(_0x1c6d48){if(_0x1c6d48){_0x57a7a1[_0x06d6('0x47')][_0x06d6('0x4a')]=_0x1c6d48['id'];_0x57a7a1['body']['Subjects']=integrations[_0x06d6('0x4b')](_0x57a7a1[_0x06d6('0x47')][_0x06d6('0x4c')],_0x57a7a1[_0x06d6('0x47')][_0x06d6('0x2c')]);_0x57a7a1[_0x06d6('0x47')][_0x06d6('0x4d')]=integrations[_0x06d6('0x4e')](_0x57a7a1[_0x06d6('0x47')]['channel'],_0x57a7a1[_0x06d6('0x47')][_0x06d6('0x2c')]);return db[_0x06d6('0x4f')][_0x06d6('0x46')](_0x57a7a1[_0x06d6('0x47')],{'include':[{'model':db['VtigerField'],'as':_0x06d6('0x50')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x06d6('0x20')](respondWithResult(_0x114d80,null))[_0x06d6('0x41')](handleError(_0x114d80,null));};var md5=require(_0x06d6('0x51'));exports['getFields']=function(_0x8901ca,_0x163e10,_0x1b0969){var _0x48d357=null;var _0x5116b3=null;var _0x51713e=null;var _0x567203=null;var _0x337742='';return db[_0x06d6('0x29')]['findOne']({'where':{'id':_0x8901ca[_0x06d6('0x42')]['id']},'attributes':['id',_0x06d6('0x25'),_0x06d6('0x52'),'description','moduleName',_0x06d6('0x53'),_0x06d6('0x54'),_0x06d6('0x55')]})[_0x06d6('0x20')](handleEntityNotFound(_0x163e10,null))[_0x06d6('0x20')](function(_0x289d3d){if(_0x289d3d){_0x48d357=_0x289d3d[_0x06d6('0x52')];_0x5116b3=_0x289d3d[_0x06d6('0x55')];_0x51713e=_0x289d3d[_0x06d6('0x56')];_0x337742=_0x289d3d[_0x06d6('0x53')];var _0x53c743=_0x337742[_0x06d6('0x57')](-0x1);if(_0x53c743==='/'){_0x337742=_0x337742['substring'](0x0,_0x337742[_0x06d6('0x58')](_0x53c743));}_0x567203=util[_0x06d6('0x59')](_0x06d6('0x5a'),_0x337742);var _0x3c9e1d={'method':_0x06d6('0x5b'),'uri':_0x567203,'qs':{'operation':_0x06d6('0x5c'),'username':_0x289d3d[_0x06d6('0x52')]},'json':!![]};return rp(_0x3c9e1d);}})['then'](function(_0x50d02b){if(_0x50d02b['success']){var _0xe89c33={'method':'POST','uri':_0x567203,'form':{'operation':_0x06d6('0x5d'),'username':_0x48d357,'accessKey':md5(_0x50d02b['result'][_0x06d6('0x5e')]+_0x5116b3)},'json':!![]};return rp(_0xe89c33);}})[_0x06d6('0x20')](function(_0x4ba9a1){if(_0x4ba9a1[_0x06d6('0x5f')]){var _0x20aee6={'method':_0x06d6('0x5b'),'uri':_0x567203,'qs':{'operation':_0x06d6('0x60'),'username':_0x48d357,'sessionName':_0x4ba9a1[_0x06d6('0x61')]['sessionName'],'elementType':_0x51713e},'json':!![]};return rp(_0x20aee6);}})[_0x06d6('0x20')](function(_0x2f024f){if(_0x2f024f['success']){var _0x5b251a=['autogenerated',_0x06d6('0x62'),_0x06d6('0x63')];_['remove'](_0x2f024f[_0x06d6('0x61')][_0x06d6('0x43')],function(_0x3c01c6){return _0x5b251a['includes'](_0x3c01c6[_0x06d6('0x2c')][_0x06d6('0x25')]);});_[_0x06d6('0x64')](_0x2f024f[_0x06d6('0x61')]['fields'],function(_0x253733){return _0x253733['editable']===_0x06d6('0x65');});return{'count':_0x2f024f[_0x06d6('0x61')]['fields'][_0x06d6('0x34')],'rows':_[_0x06d6('0x28')](_0x2f024f[_0x06d6('0x61')]['fields'],function(_0x4048d2){return{'id':_0x4048d2[_0x06d6('0x25')],'name':_0x4048d2['label'],'custom':_[_0x06d6('0x66')](_0x4048d2[_0x06d6('0x25')],_0x06d6('0x67'))?!![]:![],'options':_0x4048d2['type'][_0x06d6('0x25')]===_0x06d6('0x68')&&_0x4048d2[_0x06d6('0x2c')][_0x06d6('0x69')]['length']>0x0?_[_0x06d6('0x28')](_0x4048d2['type'][_0x06d6('0x69')],function(_0x167d14){return{'name':_0x167d14['label'],'value':_0x167d14[_0x06d6('0x6a')]};}):[]};})};}})[_0x06d6('0x20')](respondWithResult(_0x163e10,null))[_0x06d6('0x41')](function(_0x435f58){console['log'](_0x06d6('0x6b')+_0x435f58);var _0x3b7bd9=_0x8901ca[_0x06d6('0x2f')]['test']?0x1f4:_0x435f58[_0x06d6('0x6c')]||0x1f4;logger[_0x06d6('0x23')](_0x06d6('0x6d'),_0x06d6('0x6e'),_0x3b7bd9,JSON[_0x06d6('0x6f')](_0x435f58));delete _0x435f58[_0x06d6('0x25')];if(_0x3b7bd9===0x191){_0x3b7bd9=0x190;}_0x163e10[_0x06d6('0x17')](_0x3b7bd9)[_0x06d6('0x26')](_0x8901ca[_0x06d6('0x2f')][_0x06d6('0x70')]?{'message':_0x06d6('0x71'),'statusCode':_0x435f58['statusCode']}:_0x435f58);});}; \ No newline at end of file +var _0x0183=['end','json','offset','count','limit','status','set','reject','save','update','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','VtigerConfiguration','sort','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','success','POST','login','describe','result','sessionName','autogenerated','remove','includes','editable','false','cf_','picklist','picklistValues','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x0183,0xd4));var _0x3018=function(_0xc299f4,_0x23a17b){_0xc299f4=_0xc299f4-0x0;var _0x170d26=_0x0183[_0xc299f4];return _0x170d26;};'use strict';var emlformat=require(_0x3018('0x0'));var rimraf=require(_0x3018('0x1'));var zipdir=require(_0x3018('0x2'));var jsonpatch=require(_0x3018('0x3'));var rp=require(_0x3018('0x4'));var moment=require(_0x3018('0x5'));var BPromise=require(_0x3018('0x6'));var Mustache=require('mustache');var util=require(_0x3018('0x7'));var path=require('path');var sox=require(_0x3018('0x8'));var csv=require(_0x3018('0x9'));var ejs=require(_0x3018('0xa'));var fs=require('fs');var fs_extra=require(_0x3018('0xb'));var _=require(_0x3018('0xc'));var squel=require(_0x3018('0xd'));var crypto=require('crypto');var jsforce=require(_0x3018('0xe'));var deskjs=require(_0x3018('0xf'));var toCsv=require(_0x3018('0x9'));var querystring=require(_0x3018('0x10'));var Papa=require('papaparse');var Redis=require(_0x3018('0x11'));var authService=require(_0x3018('0x12'));var qs=require(_0x3018('0x13'));var as=require(_0x3018('0x14'));var hardwareService=require(_0x3018('0x15'));var logger=require(_0x3018('0x16'))(_0x3018('0x17'));var utils=require(_0x3018('0x18'));var config=require(_0x3018('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3018('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xeebe82,_0x32c95f){_0x32c95f=_0x32c95f||0xcc;return function(_0x320ae4){if(_0x320ae4){return _0xeebe82[_0x3018('0x1b')](_0x32c95f);}return _0xeebe82['status'](_0x32c95f)[_0x3018('0x1c')]();};}function respondWithResult(_0x974826,_0x2eff46){_0x2eff46=_0x2eff46||0xc8;return function(_0x5f0f5a){if(_0x5f0f5a){return _0x974826['status'](_0x2eff46)[_0x3018('0x1d')](_0x5f0f5a);}};}function respondWithFilteredResult(_0x4687ae,_0x4d8e12){return function(_0x4fdf06){if(_0x4fdf06){var _0x2605ef=typeof _0x4d8e12[_0x3018('0x1e')]==='undefined'&&typeof _0x4d8e12['limit']==='undefined';var _0x142273=_0x4fdf06[_0x3018('0x1f')];var _0x24ee6e=_0x2605ef?0x0:_0x4d8e12[_0x3018('0x1e')];var _0x48ef4f=_0x2605ef?_0x4fdf06[_0x3018('0x1f')]:_0x4d8e12['offset']+_0x4d8e12[_0x3018('0x20')];var _0x4e0640;if(_0x48ef4f>=_0x142273){_0x48ef4f=_0x142273;_0x4e0640=0xc8;}else{_0x4e0640=0xce;}_0x4687ae[_0x3018('0x21')](_0x4e0640);return _0x4687ae[_0x3018('0x22')]('Content-Range',_0x24ee6e+'-'+_0x48ef4f+'/'+_0x142273)['json'](_0x4fdf06);}return null;};}function patchUpdates(_0x11b40d){return function(_0x749037){try{jsonpatch['apply'](_0x749037,_0x11b40d,!![]);}catch(_0x138cc2){return BPromise[_0x3018('0x23')](_0x138cc2);}return _0x749037[_0x3018('0x24')]();};}function saveUpdates(_0x387ab1,_0x441e3b){return function(_0x438deb){if(_0x438deb){return _0x438deb[_0x3018('0x25')](_0x387ab1)[_0x3018('0x26')](function(_0x4cbc49){return _0x4cbc49;});}return null;};}function removeEntity(_0x32e2ea,_0x5a1db6){return function(_0xef7049){if(_0xef7049){return _0xef7049['destroy']()['then'](function(){_0x32e2ea[_0x3018('0x21')](0xcc)[_0x3018('0x1c')]();});}};}function handleEntityNotFound(_0x3fd28c,_0x9e346d){return function(_0x2dfdf8){if(!_0x2dfdf8){_0x3fd28c[_0x3018('0x1b')](0x194);}return _0x2dfdf8;};}function handleError(_0x21b9bb,_0x54e5d1){_0x54e5d1=_0x54e5d1||0x1f4;return function(_0x48cb91){logger[_0x3018('0x27')](_0x48cb91[_0x3018('0x28')]);if(_0x48cb91[_0x3018('0x29')]){delete _0x48cb91[_0x3018('0x29')];}_0x21b9bb[_0x3018('0x21')](_0x54e5d1)[_0x3018('0x2a')](_0x48cb91);};}exports[_0x3018('0x2b')]=function(_0x15bb5b,_0xee84a6){var _0x2e11de={},_0x433858={},_0x15d784={'count':0x0,'rows':[]};var _0x5357c9=_[_0x3018('0x2c')](db[_0x3018('0x2d')][_0x3018('0x2e')],function(_0x2176be){return{'name':_0x2176be['fieldName'],'type':_0x2176be[_0x3018('0x2f')]['key']};});_0x433858[_0x3018('0x30')]=_[_0x3018('0x2c')](_0x5357c9,_0x3018('0x29'));_0x433858[_0x3018('0x31')]=_[_0x3018('0x32')](_0x15bb5b[_0x3018('0x31')]);_0x433858['filters']=_[_0x3018('0x33')](_0x433858['model'],_0x433858[_0x3018('0x31')]);_0x2e11de[_0x3018('0x34')]=_['intersection'](_0x433858[_0x3018('0x30')],qs[_0x3018('0x35')](_0x15bb5b[_0x3018('0x31')][_0x3018('0x35')]));_0x2e11de[_0x3018('0x34')]=_0x2e11de[_0x3018('0x34')][_0x3018('0x36')]?_0x2e11de[_0x3018('0x34')]:_0x433858[_0x3018('0x30')];if(!_0x15bb5b[_0x3018('0x31')][_0x3018('0x37')](_0x3018('0x38'))){_0x2e11de['limit']=qs[_0x3018('0x20')](_0x15bb5b[_0x3018('0x31')][_0x3018('0x20')]);_0x2e11de['offset']=qs[_0x3018('0x1e')](_0x15bb5b['query'][_0x3018('0x1e')]);}_0x2e11de[_0x3018('0x39')]=qs['sort'](_0x15bb5b[_0x3018('0x31')]['sort']);_0x2e11de[_0x3018('0x3a')]=qs[_0x3018('0x3b')](_['pick'](_0x15bb5b[_0x3018('0x31')],_0x433858[_0x3018('0x3b')]),_0x5357c9);if(_0x15bb5b[_0x3018('0x31')][_0x3018('0x3c')]){_0x2e11de[_0x3018('0x3a')]=_['merge'](_0x2e11de[_0x3018('0x3a')],{'$or':_[_0x3018('0x2c')](_0x5357c9,function(_0x50b800){if(_0x50b800[_0x3018('0x2f')]!==_0x3018('0x3d')){var _0x2025c4={};_0x2025c4[_0x50b800[_0x3018('0x29')]]={'$like':'%'+_0x15bb5b[_0x3018('0x31')][_0x3018('0x3c')]+'%'};return _0x2025c4;}})});}_0x2e11de=_[_0x3018('0x3e')]({},_0x2e11de,_0x15bb5b['options']);var _0x208512={'where':_0x2e11de['where']};return db[_0x3018('0x2d')][_0x3018('0x1f')](_0x208512)['then'](function(_0x15d7ac){_0x15d784[_0x3018('0x1f')]=_0x15d7ac;if(_0x15bb5b[_0x3018('0x31')][_0x3018('0x3f')]){_0x2e11de[_0x3018('0x40')]=[{'all':!![]}];}return db[_0x3018('0x2d')][_0x3018('0x41')](_0x2e11de);})[_0x3018('0x26')](function(_0x4698e8){_0x15d784[_0x3018('0x42')]=_0x4698e8;return _0x15d784;})['then'](respondWithFilteredResult(_0xee84a6,_0x2e11de))[_0x3018('0x43')](handleError(_0xee84a6,null));};exports[_0x3018('0x44')]=function(_0x5f62d4,_0x17941c){var _0xb7a833={'raw':![],'where':{'id':_0x5f62d4[_0x3018('0x45')]['id']}},_0x40ba18={};_0x40ba18[_0x3018('0x30')]=_['keys'](db[_0x3018('0x2d')][_0x3018('0x2e')]);_0x40ba18[_0x3018('0x31')]=_['keys'](_0x5f62d4['query']);_0x40ba18[_0x3018('0x3b')]=_[_0x3018('0x33')](_0x40ba18[_0x3018('0x30')],_0x40ba18[_0x3018('0x31')]);_0xb7a833[_0x3018('0x34')]=_['intersection'](_0x40ba18['model'],qs['fields'](_0x5f62d4['query'][_0x3018('0x35')]));_0xb7a833[_0x3018('0x34')]=_0xb7a833['attributes'][_0x3018('0x36')]?_0xb7a833[_0x3018('0x34')]:_0x40ba18[_0x3018('0x30')];if(_0x5f62d4[_0x3018('0x31')][_0x3018('0x3f')]){_0xb7a833[_0x3018('0x40')]=[{'all':!![]}];}_0xb7a833=_[_0x3018('0x3e')]({},_0xb7a833,_0x5f62d4[_0x3018('0x46')]);return db[_0x3018('0x2d')][_0x3018('0x47')](_0xb7a833)[_0x3018('0x26')](handleEntityNotFound(_0x17941c,null))[_0x3018('0x26')](respondWithResult(_0x17941c,null))[_0x3018('0x43')](handleError(_0x17941c,null));};exports[_0x3018('0x48')]=function(_0x5a9449,_0x22bc1d){return db['VtigerAccount'][_0x3018('0x48')](_0x5a9449[_0x3018('0x49')],{})['then'](respondWithResult(_0x22bc1d,0xc9))[_0x3018('0x43')](handleError(_0x22bc1d,null));};exports[_0x3018('0x25')]=function(_0x9ba72a,_0x3300e4){if(_0x9ba72a[_0x3018('0x49')]['id']){delete _0x9ba72a[_0x3018('0x49')]['id'];}return db[_0x3018('0x2d')][_0x3018('0x47')]({'where':{'id':_0x9ba72a[_0x3018('0x45')]['id']}})[_0x3018('0x26')](handleEntityNotFound(_0x3300e4,null))[_0x3018('0x26')](saveUpdates(_0x9ba72a['body'],null))[_0x3018('0x26')](respondWithResult(_0x3300e4,null))[_0x3018('0x43')](handleError(_0x3300e4,null));};exports[_0x3018('0x4a')]=function(_0x8a843e,_0x468307){return db['VtigerAccount'][_0x3018('0x47')]({'where':{'id':_0x8a843e[_0x3018('0x45')]['id']}})['then'](handleEntityNotFound(_0x468307,null))[_0x3018('0x26')](removeEntity(_0x468307,null))[_0x3018('0x43')](handleError(_0x468307,null));};exports[_0x3018('0x4b')]=function(_0x23afd4,_0x127808,_0x1f032f){var _0x41ee60={};var _0x3b89c1={};var _0x749dee;var _0x5933aa;return db['VtigerAccount']['findOne']({'where':{'id':_0x23afd4['params']['id']}})[_0x3018('0x26')](handleEntityNotFound(_0x127808,null))[_0x3018('0x26')](function(_0xf43292){if(_0xf43292){_0x749dee=_0xf43292;_0x3b89c1[_0x3018('0x30')]=_[_0x3018('0x32')](db[_0x3018('0x4c')][_0x3018('0x2e')]);_0x3b89c1[_0x3018('0x31')]=_['keys'](_0x23afd4[_0x3018('0x31')]);_0x3b89c1[_0x3018('0x3b')]=_[_0x3018('0x33')](_0x3b89c1[_0x3018('0x30')],_0x3b89c1[_0x3018('0x31')]);_0x41ee60[_0x3018('0x34')]=_['intersection'](_0x3b89c1[_0x3018('0x30')],qs['fields'](_0x23afd4[_0x3018('0x31')][_0x3018('0x35')]));_0x41ee60['attributes']=_0x41ee60['attributes'][_0x3018('0x36')]?_0x41ee60[_0x3018('0x34')]:_0x3b89c1[_0x3018('0x30')];_0x41ee60['order']=qs['sort'](_0x23afd4[_0x3018('0x31')][_0x3018('0x4d')]);_0x41ee60[_0x3018('0x3a')]=qs['filters'](_[_0x3018('0x4e')](_0x23afd4[_0x3018('0x31')],_0x3b89c1['filters']));if(_0x23afd4[_0x3018('0x31')][_0x3018('0x3c')]){_0x41ee60[_0x3018('0x3a')]=_['merge'](_0x41ee60[_0x3018('0x3a')],{'$or':_[_0x3018('0x2c')](_0x41ee60[_0x3018('0x34')],function(_0x27da91){var _0x19a16a={};_0x19a16a[_0x27da91]={'$like':'%'+_0x23afd4[_0x3018('0x31')][_0x3018('0x3c')]+'%'};return _0x19a16a;})});}_0x41ee60=_[_0x3018('0x3e')]({},_0x41ee60,_0x23afd4[_0x3018('0x46')]);return _0x749dee['getConfigurations'](_0x41ee60);}})['then'](function(_0x159568){if(_0x159568){_0x5933aa=_0x159568[_0x3018('0x36')];if(!_0x23afd4[_0x3018('0x31')][_0x3018('0x37')](_0x3018('0x38'))){_0x41ee60[_0x3018('0x20')]=qs[_0x3018('0x20')](_0x23afd4[_0x3018('0x31')][_0x3018('0x20')]);_0x41ee60['offset']=qs[_0x3018('0x1e')](_0x23afd4[_0x3018('0x31')][_0x3018('0x1e')]);}return _0x749dee['getConfigurations'](_0x41ee60);}})[_0x3018('0x26')](function(_0x203509){if(_0x203509){return _0x203509?{'count':_0x5933aa,'rows':_0x203509}:null;}})[_0x3018('0x26')](respondWithResult(_0x127808,null))[_0x3018('0x43')](handleError(_0x127808,null));};exports[_0x3018('0x4f')]=function(_0x361481,_0x45f51d,_0x365534){if(_0x361481[_0x3018('0x49')]['id']){delete _0x361481[_0x3018('0x49')]['id'];}return db[_0x3018('0x2d')][_0x3018('0x50')]({'where':{'id':_0x361481[_0x3018('0x45')]['id']}})['then'](handleEntityNotFound(_0x45f51d,null))[_0x3018('0x26')](function(_0x5560d5){if(_0x5560d5){_0x361481[_0x3018('0x49')][_0x3018('0x51')]=_0x5560d5['id'];_0x361481[_0x3018('0x49')][_0x3018('0x52')]=integrations[_0x3018('0x53')](_0x361481[_0x3018('0x49')]['channel'],_0x361481['body']['type']);_0x361481['body'][_0x3018('0x54')]=integrations[_0x3018('0x55')](_0x361481['body']['channel'],_0x361481[_0x3018('0x49')][_0x3018('0x2f')]);return db['VtigerConfiguration']['create'](_0x361481['body'],{'include':[{'model':db[_0x3018('0x56')],'as':_0x3018('0x52')},{'model':db[_0x3018('0x56')],'as':_0x3018('0x54')}]});}return null;})[_0x3018('0x26')](respondWithResult(_0x45f51d,null))['catch'](handleError(_0x45f51d,null));};var md5=require(_0x3018('0x57'));exports[_0x3018('0x58')]=function(_0x404632,_0x18d6a5,_0x231af9){var _0x541029=null;var _0x2f6060=null;var _0x3ec054=null;var _0x4aa324=null;var _0x54a376='';return db[_0x3018('0x2d')][_0x3018('0x50')]({'where':{'id':_0x404632[_0x3018('0x45')]['id']},'attributes':['id',_0x3018('0x29'),_0x3018('0x59'),_0x3018('0x5a'),_0x3018('0x5b'),_0x3018('0x5c'),_0x3018('0x5d'),_0x3018('0x5e')]})[_0x3018('0x26')](handleEntityNotFound(_0x18d6a5,null))[_0x3018('0x26')](function(_0x3ee05f){if(_0x3ee05f){_0x541029=_0x3ee05f[_0x3018('0x59')];_0x2f6060=_0x3ee05f['accessKey'];_0x3ec054=_0x3ee05f[_0x3018('0x5b')];_0x54a376=_0x3ee05f[_0x3018('0x5c')];var _0x412d43=_0x54a376[_0x3018('0x5f')](-0x1);if(_0x412d43==='/'){_0x54a376=_0x54a376[_0x3018('0x60')](0x0,_0x54a376['lastIndexOf'](_0x412d43));}_0x4aa324=util[_0x3018('0x61')](_0x3018('0x62'),_0x54a376);var _0x2268ca={'method':_0x3018('0x63'),'uri':_0x4aa324,'qs':{'operation':_0x3018('0x64'),'username':_0x3ee05f[_0x3018('0x59')]},'json':!![]};return rp(_0x2268ca);}})[_0x3018('0x26')](function(_0x214017){if(_0x214017[_0x3018('0x65')]){var _0x267ab3={'method':_0x3018('0x66'),'uri':_0x4aa324,'form':{'operation':_0x3018('0x67'),'username':_0x541029,'accessKey':md5(_0x214017['result']['token']+_0x2f6060)},'json':!![]};return rp(_0x267ab3);}})[_0x3018('0x26')](function(_0x1e47e8){if(_0x1e47e8['success']){var _0x33dacb={'method':_0x3018('0x63'),'uri':_0x4aa324,'qs':{'operation':_0x3018('0x68'),'username':_0x541029,'sessionName':_0x1e47e8[_0x3018('0x69')][_0x3018('0x6a')],'elementType':_0x3ec054},'json':!![]};return rp(_0x33dacb);}})['then'](function(_0xbdd4b5){if(_0xbdd4b5[_0x3018('0x65')]){var _0x41cd38=[_0x3018('0x6b'),'reference','owner'];_[_0x3018('0x6c')](_0xbdd4b5[_0x3018('0x69')][_0x3018('0x35')],function(_0x136ba0){return _0x41cd38[_0x3018('0x6d')](_0x136ba0[_0x3018('0x2f')][_0x3018('0x29')]);});_[_0x3018('0x6c')](_0xbdd4b5[_0x3018('0x69')]['fields'],function(_0xd90732){return _0xd90732[_0x3018('0x6e')]===_0x3018('0x6f');});return{'count':_0xbdd4b5['result'][_0x3018('0x35')][_0x3018('0x36')],'rows':_['map'](_0xbdd4b5[_0x3018('0x69')]['fields'],function(_0x4d4aee){return{'id':_0x4d4aee[_0x3018('0x29')],'name':_0x4d4aee['label'],'custom':_['startsWith'](_0x4d4aee[_0x3018('0x29')],_0x3018('0x70'))?!![]:![],'options':_0x4d4aee[_0x3018('0x2f')][_0x3018('0x29')]===_0x3018('0x71')&&_0x4d4aee['type'][_0x3018('0x72')][_0x3018('0x36')]>0x0?_[_0x3018('0x2c')](_0x4d4aee[_0x3018('0x2f')][_0x3018('0x72')],function(_0x2482f1){return{'name':_0x2482f1[_0x3018('0x73')],'value':_0x2482f1[_0x3018('0x74')]};}):[]};})};}})['then'](respondWithResult(_0x18d6a5,null))[_0x3018('0x43')](function(_0x1e152a){console['log']('vTiger\x20error:\x20'+_0x1e152a);var _0xaf80b0=_0x404632[_0x3018('0x31')][_0x3018('0x75')]?0x1f4:_0x1e152a[_0x3018('0x76')]||0x1f4;logger['error'](_0x3018('0x77'),'getFields',_0xaf80b0,JSON['stringify'](_0x1e152a));delete _0x1e152a[_0x3018('0x29')];if(_0xaf80b0===0x191){_0xaf80b0=0x190;}_0x18d6a5['status'](_0xaf80b0)[_0x3018('0x2a')](_0x404632[_0x3018('0x31')][_0x3018('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x1e152a[_0x3018('0x76')]}:_0x1e152a);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 34d508b..fecac58 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.model.js +++ b/server/api/intVtigerAccount/intVtigerAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa106=['define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x5b7be5,_0x2a7f33){var _0x231861=function(_0x49a302){while(--_0x49a302){_0x5b7be5['push'](_0x5b7be5['shift']());}};_0x231861(++_0x2a7f33);}(_0xa106,0x121));var _0x6a10=function(_0x1e0ca5,_0x57fd4f){_0x1e0ca5=_0x1e0ca5-0x0;var _0x410923=_0xa106[_0x1e0ca5];return _0x410923;};'use strict';var _=require(_0x6a10('0x0'));var util=require('util');var logger=require(_0x6a10('0x1'))(_0x6a10('0x2'));var moment=require(_0x6a10('0x3'));var BPromise=require(_0x6a10('0x4'));var rp=require(_0x6a10('0x5'));var fs=require('fs');var path=require(_0x6a10('0x6'));var rimraf=require(_0x6a10('0x7'));var config=require('../../config/environment');var attributes=require(_0x6a10('0x8'));var integrations=require(_0x6a10('0x9'));module['exports']=function(_0x59de4b,_0x2df7cd){return _0x59de4b[_0x6a10('0xa')](_0x6a10('0xb'),attributes,{'tableName':_0x6a10('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b6f=['moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api'];(function(_0x4a03bd,_0x55bed6){var _0x560574=function(_0x1e7a85){while(--_0x1e7a85){_0x4a03bd['push'](_0x4a03bd['shift']());}};_0x560574(++_0x55bed6);}(_0x8b6f,0x13e));var _0xf8b6=function(_0x27fdcc,_0x421cb5){_0x27fdcc=_0x27fdcc-0x0;var _0x17c2de=_0x8b6f[_0x27fdcc];return _0x17c2de;};'use strict';var _=require(_0xf8b6('0x0'));var util=require(_0xf8b6('0x1'));var logger=require(_0xf8b6('0x2'))(_0xf8b6('0x3'));var moment=require(_0xf8b6('0x4'));var BPromise=require(_0xf8b6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8b6('0x6'));var rimraf=require('rimraf');var config=require(_0xf8b6('0x7'));var attributes=require(_0xf8b6('0x8'));var integrations=require(_0xf8b6('0x9'));module[_0xf8b6('0xa')]=function(_0x184f42,_0x56c73b){return _0x184f42[_0xf8b6('0xb')](_0xf8b6('0xc'),attributes,{'tableName':_0xf8b6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index acdd216..3fef300 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9a7=['then','debug','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','catch','ShowVtigerAccount','where'];(function(_0x27676d,_0xc09be6){var _0x248795=function(_0x2a2bad){while(--_0x2a2bad){_0x27676d['push'](_0x27676d['shift']());}};_0x248795(++_0xc09be6);}(_0xb9a7,0x112));var _0x7b9a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xb9a7[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});}exports[_0x7b9a('0x13')]=function(_0x271263){var _0x169d16=this;return new Promise(function(_0x44a232,_0x180a67){return db[_0x7b9a('0x14')][_0x7b9a('0x15')]({'raw':_0x271263[_0x7b9a('0x16')]?_0x271263[_0x7b9a('0x16')][_0x7b9a('0x17')]===undefined?!![]:![]:!![],'where':_0x271263[_0x7b9a('0x16')]?_0x271263[_0x7b9a('0x16')]['where']||null:null,'attributes':_0x271263[_0x7b9a('0x16')]?_0x271263['options'][_0x7b9a('0x18')]||null:null,'limit':_0x271263['options']?_0x271263[_0x7b9a('0x16')][_0x7b9a('0x19')]||null:null,'include':_0x271263[_0x7b9a('0x16')]?_0x271263['options'][_0x7b9a('0x1a')]?_[_0x7b9a('0x1b')](_0x271263['options'][_0x7b9a('0x1a')],function(_0x374dca){return{'model':db[_0x374dca[_0x7b9a('0x1c')]],'as':_0x374dca['as'],'attributes':_0x374dca[_0x7b9a('0x18')],'include':_0x374dca[_0x7b9a('0x1a')]?_['map'](_0x374dca[_0x7b9a('0x1a')],function(_0x23219e){return{'model':db[_0x23219e['model']],'as':_0x23219e['as'],'attributes':_0x23219e[_0x7b9a('0x18')],'include':_0x23219e['include']?_[_0x7b9a('0x1b')](_0x23219e[_0x7b9a('0x1a')],function(_0x4c2271){return{'model':db[_0x4c2271['model']],'as':_0x4c2271['as'],'attributes':_0x4c2271[_0x7b9a('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54df8a){logger[_0x7b9a('0x11')]('GetVtigerAccount',_0x271263);logger['debug'](_0x7b9a('0x13'),_0x271263,JSON['stringify'](_0x54df8a));_0x44a232(_0x54df8a);})[_0x7b9a('0x1d')](function(_0x314b6d){logger['error'](_0x7b9a('0x13'),_0x314b6d[_0x7b9a('0x10')],_0x271263);_0x180a67(_0x169d16[_0x7b9a('0xe')](0x1f4,_0x314b6d['message']));});});};exports[_0x7b9a('0x1e')]=function(_0x2ce78b){var _0x181e9c=this;return new Promise(function(_0x6c8b1f,_0x5028e7){return db[_0x7b9a('0x14')]['find']({'raw':_0x2ce78b['options']?_0x2ce78b[_0x7b9a('0x16')][_0x7b9a('0x17')]===undefined?!![]:![]:!![],'where':_0x2ce78b[_0x7b9a('0x16')]?_0x2ce78b['options'][_0x7b9a('0x1f')]||null:null,'attributes':_0x2ce78b[_0x7b9a('0x16')]?_0x2ce78b['options']['attributes']||null:null,'include':_0x2ce78b[_0x7b9a('0x16')]?_0x2ce78b[_0x7b9a('0x16')]['include']?_[_0x7b9a('0x1b')](_0x2ce78b[_0x7b9a('0x16')][_0x7b9a('0x1a')],function(_0x18db2f){return{'model':db[_0x18db2f[_0x7b9a('0x1c')]],'as':_0x18db2f['as'],'attributes':_0x18db2f['attributes'],'include':_0x18db2f[_0x7b9a('0x1a')]?_[_0x7b9a('0x1b')](_0x18db2f[_0x7b9a('0x1a')],function(_0x7070dd){return{'model':db[_0x7070dd[_0x7b9a('0x1c')]],'as':_0x7070dd['as'],'attributes':_0x7070dd[_0x7b9a('0x18')],'include':_0x7070dd['include']?_['map'](_0x7070dd[_0x7b9a('0x1a')],function(_0x31d29e){return{'model':db[_0x31d29e['model']],'as':_0x31d29e['as'],'attributes':_0x31d29e[_0x7b9a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7b9a('0x20')](function(_0xf58dca){logger['info'](_0x7b9a('0x1e'),_0x2ce78b);logger[_0x7b9a('0x21')]('ShowVtigerAccount',_0x2ce78b,JSON['stringify'](_0xf58dca));_0x6c8b1f(_0xf58dca);})[_0x7b9a('0x1d')](function(_0x130c04){logger[_0x7b9a('0xe')](_0x7b9a('0x1e'),_0x130c04[_0x7b9a('0x10')],_0x2ce78b);_0x5028e7(_0x181e9c[_0x7b9a('0xe')](0x1f4,_0x130c04[_0x7b9a('0x10')]));});});}; \ No newline at end of file +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowVtigerAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount'];(function(_0x475acf,_0x1e9c7d){var _0x234bc8=function(_0x418c07){while(--_0x418c07){_0x475acf['push'](_0x475acf['shift']());}};_0x234bc8(++_0x1e9c7d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetVtigerAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowVtigerAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index b760e1d..8be357b 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87fb=['/:id/subjects','getSubjects','get','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','index','/:id','isAuthenticated','show','getFields'];(function(_0x2e0cf6,_0x37232d){var _0x3e261e=function(_0x51ccaf){while(--_0x51ccaf){_0x2e0cf6['push'](_0x2e0cf6['shift']());}};_0x3e261e(++_0x37232d);}(_0x87fb,0x15b));var _0xb87f=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x87fb[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xb87f('0x0'));var util=require(_0xb87f('0x1'));var path=require(_0xb87f('0x2'));var timeout=require(_0xb87f('0x3'));var express=require(_0xb87f('0x4'));var router=express['Router']();var fs_extra=require(_0xb87f('0x5'));var auth=require(_0xb87f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb87f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb87f('0x8')]);router['get'](_0xb87f('0x9'),auth[_0xb87f('0xa')](),controller[_0xb87f('0xb')]);router['get']('/:id/fields',auth[_0xb87f('0xa')](),controller[_0xb87f('0xc')]);router['get'](_0xb87f('0xd'),auth[_0xb87f('0xa')](),controller[_0xb87f('0xe')]);router[_0xb87f('0xf')](_0xb87f('0x10'),auth[_0xb87f('0xa')](),controller[_0xb87f('0x11')]);router[_0xb87f('0x12')]('/',auth[_0xb87f('0xa')](),controller[_0xb87f('0x13')]);router[_0xb87f('0x14')](_0xb87f('0x9'),auth[_0xb87f('0xa')](),controller[_0xb87f('0x15')]);router[_0xb87f('0x16')](_0xb87f('0x9'),auth['isAuthenticated'](),controller[_0xb87f('0x17')]);module['exports']=router; \ No newline at end of file +var _0x2fed=['index','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x4712b3,_0x3948b0){var _0x304c94=function(_0x56f0f6){while(--_0x56f0f6){_0x4712b3['push'](_0x4712b3['shift']());}};_0x304c94(++_0x3948b0);}(_0x2fed,0x199));var _0xd2fe=function(_0x270da4,_0x3a4c57){_0x270da4=_0x270da4-0x0;var _0x2d4290=_0x2fed[_0x270da4];return _0x2d4290;};'use strict';var multer=require('multer');var util=require(_0xd2fe('0x0'));var path=require(_0xd2fe('0x1'));var timeout=require(_0xd2fe('0x2'));var express=require(_0xd2fe('0x3'));var router=express[_0xd2fe('0x4')]();var fs_extra=require(_0xd2fe('0x5'));var auth=require(_0xd2fe('0x6'));var interaction=require(_0xd2fe('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x9')]);router[_0xd2fe('0xa')](_0xd2fe('0xb'),auth[_0xd2fe('0x8')](),controller['show']);router[_0xd2fe('0xa')](_0xd2fe('0xc'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0xd')]);router[_0xd2fe('0xa')](_0xd2fe('0xe'),auth['isAuthenticated'](),controller[_0xd2fe('0xf')]);router[_0xd2fe('0xa')](_0xd2fe('0x10'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x11')]);router['post']('/',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x12')]);router[_0xd2fe('0x13')](_0xd2fe('0xb'),auth[_0xd2fe('0x8')](),controller['update']);router['delete'](_0xd2fe('0xb'),auth['isAuthenticated'](),controller[_0xd2fe('0x14')]);module[_0xd2fe('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 94a62c6..d0af872 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb754=['STRING','sequelize','exports'];(function(_0x17c982,_0x2c495b){var _0xffa2dd=function(_0x477cc5){while(--_0x477cc5){_0x17c982['push'](_0x17c982['shift']());}};_0xffa2dd(++_0x2c495b);}(_0xb754,0x76));var _0x4b75=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0xb754[_0x1cb0b4];return _0x525b60;};'use strict';var Sequelize=require(_0x4b75('0x0'));module[_0x4b75('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4b75('0x2')]}}; \ No newline at end of file +var _0xb9f1=['exports','STRING','sequelize'];(function(_0x3bb168,_0x28c4fd){var _0x1a0a3c=function(_0x38ebb1){while(--_0x38ebb1){_0x3bb168['push'](_0x3bb168['shift']());}};_0x1a0a3c(++_0x28c4fd);}(_0xb9f1,0x1c1));var _0x1b9f=function(_0x5496d9,_0x589166){_0x5496d9=_0x5496d9-0x0;var _0x111079=_0xb9f1[_0x5496d9];return _0x111079;};'use strict';var Sequelize=require(_0x1b9f('0x0'));module[_0x1b9f('0x1')]={'name':{'type':Sequelize[_0x1b9f('0x2')]},'description':{'type':Sequelize[_0x1b9f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index dcdbcd0..cd15a14 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe0e=['length','options','find','create','body','getFields','findOne','pick','getSubjects','VtigerField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','fields'];(function(_0x3bca63,_0x1b4d82){var _0x2559f6=function(_0x54d53e){while(--_0x54d53e){_0x3bca63['push'](_0x3bca63['shift']());}};_0x2559f6(++_0x1b4d82);}(_0xfe0e,0x1a4));var _0xefe0=function(_0x26fb85,_0x35576f){_0x26fb85=_0x26fb85-0x0;var _0x13e0f9=_0xfe0e[_0x26fb85];return _0x13e0f9;};'use strict';var emlformat=require(_0xefe0('0x0'));var rimraf=require(_0xefe0('0x1'));var zipdir=require(_0xefe0('0x2'));var jsonpatch=require(_0xefe0('0x3'));var rp=require(_0xefe0('0x4'));var moment=require(_0xefe0('0x5'));var BPromise=require(_0xefe0('0x6'));var Mustache=require(_0xefe0('0x7'));var util=require(_0xefe0('0x8'));var path=require(_0xefe0('0x9'));var sox=require(_0xefe0('0xa'));var csv=require('to-csv');var ejs=require(_0xefe0('0xb'));var fs=require('fs');var fs_extra=require(_0xefe0('0xc'));var _=require(_0xefe0('0xd'));var squel=require('squel');var crypto=require(_0xefe0('0xe'));var jsforce=require(_0xefe0('0xf'));var deskjs=require(_0xefe0('0x10'));var toCsv=require(_0xefe0('0x11'));var querystring=require(_0xefe0('0x12'));var Papa=require('papaparse');var Redis=require(_0xefe0('0x13'));var authService=require(_0xefe0('0x14'));var qs=require(_0xefe0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefe0('0x16'));var logger=require(_0xefe0('0x17'))(_0xefe0('0x18'));var utils=require(_0xefe0('0x19'));var config=require(_0xefe0('0x1a'));var licenseUtil=require(_0xefe0('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x217104,_0x24e025){_0x24e025=_0x24e025||0xcc;return function(_0x1283a0){if(_0x1283a0){return _0x217104[_0xefe0('0x1c')](_0x24e025);}return _0x217104[_0xefe0('0x1d')](_0x24e025)[_0xefe0('0x1e')]();};}function respondWithResult(_0x46e6b3,_0x6a10ce){_0x6a10ce=_0x6a10ce||0xc8;return function(_0x59a122){if(_0x59a122){return _0x46e6b3['status'](_0x6a10ce)[_0xefe0('0x1f')](_0x59a122);}};}function respondWithFilteredResult(_0x4af311,_0x48b032){return function(_0x348553){if(_0x348553){var _0x321d98=typeof _0x48b032[_0xefe0('0x20')]===_0xefe0('0x21')&&typeof _0x48b032[_0xefe0('0x22')]==='undefined';var _0x338338=_0x348553[_0xefe0('0x23')];var _0x9ed2a5=_0x321d98?0x0:_0x48b032[_0xefe0('0x20')];var _0x534869=_0x321d98?_0x348553[_0xefe0('0x23')]:_0x48b032[_0xefe0('0x20')]+_0x48b032[_0xefe0('0x22')];var _0x6c9d8d;if(_0x534869>=_0x338338){_0x534869=_0x338338;_0x6c9d8d=0xc8;}else{_0x6c9d8d=0xce;}_0x4af311[_0xefe0('0x1d')](_0x6c9d8d);return _0x4af311['set']('Content-Range',_0x9ed2a5+'-'+_0x534869+'/'+_0x338338)['json'](_0x348553);}return null;};}function patchUpdates(_0x2790b1){return function(_0x2e0265){try{jsonpatch['apply'](_0x2e0265,_0x2790b1,!![]);}catch(_0x403a97){return BPromise[_0xefe0('0x24')](_0x403a97);}return _0x2e0265[_0xefe0('0x25')]();};}function saveUpdates(_0x340367,_0x4a8461){return function(_0x57244f){if(_0x57244f){return _0x57244f[_0xefe0('0x26')](_0x340367)[_0xefe0('0x27')](function(_0x5e9579){return _0x5e9579;});}return null;};}function removeEntity(_0x1c8cf7,_0x263edc){return function(_0x2b60a0){if(_0x2b60a0){return _0x2b60a0[_0xefe0('0x28')]()[_0xefe0('0x27')](function(){_0x1c8cf7[_0xefe0('0x1d')](0xcc)[_0xefe0('0x1e')]();});}};}function handleEntityNotFound(_0x3bbc2d,_0x4736c5){return function(_0x1a24cd){if(!_0x1a24cd){_0x3bbc2d[_0xefe0('0x1c')](0x194);}return _0x1a24cd;};}function handleError(_0x6d4450,_0x5154d5){_0x5154d5=_0x5154d5||0x1f4;return function(_0x2a2cf3){logger[_0xefe0('0x29')](_0x2a2cf3['stack']);if(_0x2a2cf3[_0xefe0('0x2a')]){delete _0x2a2cf3[_0xefe0('0x2a')];}_0x6d4450['status'](_0x5154d5)[_0xefe0('0x2b')](_0x2a2cf3);};}exports[_0xefe0('0x2c')]=function(_0x3df815,_0x2f70ce){var _0x47b220={},_0x1dcd50={},_0x23d3f8={'count':0x0,'rows':[]};var _0x4f4e86=_[_0xefe0('0x2d')](db['VtigerConfiguration'][_0xefe0('0x2e')],function(_0x289588){return{'name':_0x289588[_0xefe0('0x2f')],'type':_0x289588[_0xefe0('0x30')]['key']};});_0x1dcd50[_0xefe0('0x31')]=_['map'](_0x4f4e86,_0xefe0('0x2a'));_0x1dcd50[_0xefe0('0x32')]=_['keys'](_0x3df815[_0xefe0('0x32')]);_0x1dcd50[_0xefe0('0x33')]=_[_0xefe0('0x34')](_0x1dcd50[_0xefe0('0x31')],_0x1dcd50[_0xefe0('0x32')]);_0x47b220[_0xefe0('0x35')]=_[_0xefe0('0x34')](_0x1dcd50['model'],qs['fields'](_0x3df815['query']['fields']));_0x47b220['attributes']=_0x47b220['attributes']['length']?_0x47b220[_0xefe0('0x35')]:_0x1dcd50[_0xefe0('0x31')];if(!_0x3df815[_0xefe0('0x32')][_0xefe0('0x36')](_0xefe0('0x37'))){_0x47b220[_0xefe0('0x22')]=qs[_0xefe0('0x22')](_0x3df815['query']['limit']);_0x47b220['offset']=qs[_0xefe0('0x20')](_0x3df815[_0xefe0('0x32')][_0xefe0('0x20')]);}_0x47b220[_0xefe0('0x38')]=qs[_0xefe0('0x39')](_0x3df815['query'][_0xefe0('0x39')]);_0x47b220[_0xefe0('0x3a')]=qs['filters'](_['pick'](_0x3df815[_0xefe0('0x32')],_0x1dcd50[_0xefe0('0x33')]),_0x4f4e86);if(_0x3df815[_0xefe0('0x32')][_0xefe0('0x3b')]){_0x47b220['where']=_[_0xefe0('0x3c')](_0x47b220[_0xefe0('0x3a')],{'$or':_[_0xefe0('0x2d')](_0x4f4e86,function(_0x124693){if(_0x124693['type']!==_0xefe0('0x3d')){var _0x4f974a={};_0x4f974a[_0x124693[_0xefe0('0x2a')]]={'$like':'%'+_0x3df815[_0xefe0('0x32')][_0xefe0('0x3b')]+'%'};return _0x4f974a;}})});}_0x47b220=_['merge']({},_0x47b220,_0x3df815['options']);var _0x31af17={'where':_0x47b220['where']};return db[_0xefe0('0x3e')][_0xefe0('0x23')](_0x31af17)['then'](function(_0xf9d48f){_0x23d3f8[_0xefe0('0x23')]=_0xf9d48f;if(_0x3df815[_0xefe0('0x32')][_0xefe0('0x3f')]){_0x47b220[_0xefe0('0x40')]=[{'all':!![]}];}return db[_0xefe0('0x3e')][_0xefe0('0x41')](_0x47b220);})['then'](function(_0x3a2c2f){_0x23d3f8[_0xefe0('0x42')]=_0x3a2c2f;return _0x23d3f8;})[_0xefe0('0x27')](respondWithFilteredResult(_0x2f70ce,_0x47b220))[_0xefe0('0x43')](handleError(_0x2f70ce,null));};exports[_0xefe0('0x44')]=function(_0xd84398,_0x4625fa){var _0x459e89={'raw':![],'where':{'id':_0xd84398[_0xefe0('0x45')]['id']}},_0x1ee1b0={};_0x1ee1b0[_0xefe0('0x31')]=_[_0xefe0('0x46')](db[_0xefe0('0x3e')][_0xefe0('0x2e')]);_0x1ee1b0[_0xefe0('0x32')]=_[_0xefe0('0x46')](_0xd84398[_0xefe0('0x32')]);_0x1ee1b0[_0xefe0('0x33')]=_[_0xefe0('0x34')](_0x1ee1b0['model'],_0x1ee1b0[_0xefe0('0x32')]);_0x459e89[_0xefe0('0x35')]=_[_0xefe0('0x34')](_0x1ee1b0[_0xefe0('0x31')],qs['fields'](_0xd84398[_0xefe0('0x32')][_0xefe0('0x47')]));_0x459e89['attributes']=_0x459e89[_0xefe0('0x35')][_0xefe0('0x48')]?_0x459e89['attributes']:_0x1ee1b0[_0xefe0('0x31')];if(_0xd84398[_0xefe0('0x32')][_0xefe0('0x3f')]){_0x459e89[_0xefe0('0x40')]=[{'all':!![]}];}_0x459e89=_[_0xefe0('0x3c')]({},_0x459e89,_0xd84398[_0xefe0('0x49')]);return db[_0xefe0('0x3e')][_0xefe0('0x4a')](_0x459e89)[_0xefe0('0x27')](handleEntityNotFound(_0x4625fa,null))['then'](respondWithResult(_0x4625fa,null))[_0xefe0('0x43')](handleError(_0x4625fa,null));};exports[_0xefe0('0x4b')]=function(_0x5921b6,_0x3771eb){return db[_0xefe0('0x3e')][_0xefe0('0x4b')](_0x5921b6[_0xefe0('0x4c')],{})[_0xefe0('0x27')](respondWithResult(_0x3771eb,0xc9))[_0xefe0('0x43')](handleError(_0x3771eb,null));};exports[_0xefe0('0x26')]=function(_0x169100,_0x5025ca){if(_0x169100[_0xefe0('0x4c')]['id']){delete _0x169100[_0xefe0('0x4c')]['id'];}return db[_0xefe0('0x3e')][_0xefe0('0x4a')]({'where':{'id':_0x169100[_0xefe0('0x45')]['id']}})['then'](handleEntityNotFound(_0x5025ca,null))[_0xefe0('0x27')](saveUpdates(_0x169100[_0xefe0('0x4c')],null))[_0xefe0('0x27')](respondWithResult(_0x5025ca,null))['catch'](handleError(_0x5025ca,null));};exports[_0xefe0('0x28')]=function(_0x50868d,_0x1a00f5){return db[_0xefe0('0x3e')]['find']({'where':{'id':_0x50868d['params']['id']}})['then'](handleEntityNotFound(_0x1a00f5,null))['then'](removeEntity(_0x1a00f5,null))[_0xefe0('0x43')](handleError(_0x1a00f5,null));};exports[_0xefe0('0x4d')]=function(_0x89f48e,_0x2b3d80,_0x42a8ed){var _0x5a8a6e={};var _0x10fe4a={};var _0x47e180;var _0x3e470d;return db[_0xefe0('0x3e')][_0xefe0('0x4e')]({'where':{'id':_0x89f48e[_0xefe0('0x45')]['id']}})[_0xefe0('0x27')](handleEntityNotFound(_0x2b3d80,null))[_0xefe0('0x27')](function(_0x9feef5){if(_0x9feef5){_0x47e180=_0x9feef5;_0x10fe4a[_0xefe0('0x31')]=_[_0xefe0('0x46')](db['VtigerField']['rawAttributes']);_0x10fe4a[_0xefe0('0x32')]=_[_0xefe0('0x46')](_0x89f48e[_0xefe0('0x32')]);_0x10fe4a[_0xefe0('0x33')]=_['intersection'](_0x10fe4a[_0xefe0('0x31')],_0x10fe4a['query']);_0x5a8a6e[_0xefe0('0x35')]=_['intersection'](_0x10fe4a[_0xefe0('0x31')],qs[_0xefe0('0x47')](_0x89f48e[_0xefe0('0x32')][_0xefe0('0x47')]));_0x5a8a6e[_0xefe0('0x35')]=_0x5a8a6e[_0xefe0('0x35')][_0xefe0('0x48')]?_0x5a8a6e[_0xefe0('0x35')]:_0x10fe4a[_0xefe0('0x31')];_0x5a8a6e[_0xefe0('0x38')]=qs[_0xefe0('0x39')](_0x89f48e['query'][_0xefe0('0x39')]);_0x5a8a6e['where']=qs[_0xefe0('0x33')](_[_0xefe0('0x4f')](_0x89f48e[_0xefe0('0x32')],_0x10fe4a[_0xefe0('0x33')]));if(_0x89f48e[_0xefe0('0x32')][_0xefe0('0x3b')]){_0x5a8a6e['where']=_[_0xefe0('0x3c')](_0x5a8a6e['where'],{'$or':_['map'](_0x5a8a6e[_0xefe0('0x35')],function(_0x1faeea){var _0x8a2b1d={};_0x8a2b1d[_0x1faeea]={'$like':'%'+_0x89f48e['query'][_0xefe0('0x3b')]+'%'};return _0x8a2b1d;})});}_0x5a8a6e=_[_0xefe0('0x3c')]({},_0x5a8a6e,_0x89f48e[_0xefe0('0x49')]);return _0x47e180[_0xefe0('0x4d')](_0x5a8a6e);}})[_0xefe0('0x27')](function(_0x3a9844){if(_0x3a9844){_0x3e470d=_0x3a9844['length'];if(!_0x89f48e['query']['hasOwnProperty']('nolimit')){_0x5a8a6e[_0xefe0('0x22')]=qs[_0xefe0('0x22')](_0x89f48e[_0xefe0('0x32')][_0xefe0('0x22')]);_0x5a8a6e[_0xefe0('0x20')]=qs[_0xefe0('0x20')](_0x89f48e[_0xefe0('0x32')][_0xefe0('0x20')]);}return _0x47e180[_0xefe0('0x4d')](_0x5a8a6e);}})[_0xefe0('0x27')](function(_0x2f6e68){if(_0x2f6e68){return _0x2f6e68?{'count':_0x3e470d,'rows':_0x2f6e68}:null;}})[_0xefe0('0x27')](respondWithResult(_0x2b3d80,null))[_0xefe0('0x43')](handleError(_0x2b3d80,null));};exports[_0xefe0('0x50')]=function(_0x2da28b,_0x570722,_0x28b679){var _0x428fdf={};var _0x56082b={};var _0x379198;var _0x2d61e7;return db[_0xefe0('0x3e')]['findOne']({'where':{'id':_0x2da28b['params']['id']}})[_0xefe0('0x27')](handleEntityNotFound(_0x570722,null))['then'](function(_0xc1b92e){if(_0xc1b92e){_0x379198=_0xc1b92e;_0x56082b[_0xefe0('0x31')]=_[_0xefe0('0x46')](db[_0xefe0('0x51')]['rawAttributes']);_0x56082b[_0xefe0('0x32')]=_[_0xefe0('0x46')](_0x2da28b[_0xefe0('0x32')]);_0x56082b[_0xefe0('0x33')]=_[_0xefe0('0x34')](_0x56082b[_0xefe0('0x31')],_0x56082b['query']);_0x428fdf[_0xefe0('0x35')]=_[_0xefe0('0x34')](_0x56082b['model'],qs['fields'](_0x2da28b['query'][_0xefe0('0x47')]));_0x428fdf[_0xefe0('0x35')]=_0x428fdf[_0xefe0('0x35')][_0xefe0('0x48')]?_0x428fdf[_0xefe0('0x35')]:_0x56082b['model'];_0x428fdf[_0xefe0('0x38')]=qs[_0xefe0('0x39')](_0x2da28b[_0xefe0('0x32')][_0xefe0('0x39')]);_0x428fdf[_0xefe0('0x3a')]=qs[_0xefe0('0x33')](_['pick'](_0x2da28b[_0xefe0('0x32')],_0x56082b[_0xefe0('0x33')]));if(_0x2da28b[_0xefe0('0x32')]['filter']){_0x428fdf[_0xefe0('0x3a')]=_[_0xefe0('0x3c')](_0x428fdf[_0xefe0('0x3a')],{'$or':_['map'](_0x428fdf[_0xefe0('0x35')],function(_0x593b0f){var _0x3125c1={};_0x3125c1[_0x593b0f]={'$like':'%'+_0x2da28b[_0xefe0('0x32')][_0xefe0('0x3b')]+'%'};return _0x3125c1;})});}_0x428fdf=_[_0xefe0('0x3c')]({},_0x428fdf,_0x2da28b[_0xefe0('0x49')]);return _0x379198[_0xefe0('0x50')](_0x428fdf);}})['then'](function(_0x20ef8b){if(_0x20ef8b){_0x2d61e7=_0x20ef8b['length'];if(!_0x2da28b[_0xefe0('0x32')]['hasOwnProperty'](_0xefe0('0x37'))){_0x428fdf['limit']=qs[_0xefe0('0x22')](_0x2da28b[_0xefe0('0x32')][_0xefe0('0x22')]);_0x428fdf['offset']=qs[_0xefe0('0x20')](_0x2da28b[_0xefe0('0x32')][_0xefe0('0x20')]);}return _0x379198[_0xefe0('0x50')](_0x428fdf);}})[_0xefe0('0x27')](function(_0x2156e0){if(_0x2156e0){return _0x2156e0?{'count':_0x2d61e7,'rows':_0x2156e0}:null;}})[_0xefe0('0x27')](respondWithResult(_0x570722,null))[_0xefe0('0x43')](handleError(_0x570722,null));};exports['getDescriptions']=function(_0x4f1049,_0x5dcb2b,_0x5e803d){var _0x139d15={};var _0x341cca={};var _0x1ad995;var _0x1823ee;return db[_0xefe0('0x3e')][_0xefe0('0x4e')]({'where':{'id':_0x4f1049[_0xefe0('0x45')]['id']}})[_0xefe0('0x27')](handleEntityNotFound(_0x5dcb2b,null))[_0xefe0('0x27')](function(_0x18fc63){if(_0x18fc63){_0x1ad995=_0x18fc63;_0x341cca['model']=_[_0xefe0('0x46')](db[_0xefe0('0x51')]['rawAttributes']);_0x341cca[_0xefe0('0x32')]=_[_0xefe0('0x46')](_0x4f1049[_0xefe0('0x32')]);_0x341cca[_0xefe0('0x33')]=_['intersection'](_0x341cca[_0xefe0('0x31')],_0x341cca[_0xefe0('0x32')]);_0x139d15[_0xefe0('0x35')]=_[_0xefe0('0x34')](_0x341cca['model'],qs[_0xefe0('0x47')](_0x4f1049[_0xefe0('0x32')][_0xefe0('0x47')]));_0x139d15[_0xefe0('0x35')]=_0x139d15[_0xefe0('0x35')][_0xefe0('0x48')]?_0x139d15[_0xefe0('0x35')]:_0x341cca[_0xefe0('0x31')];_0x139d15[_0xefe0('0x38')]=qs[_0xefe0('0x39')](_0x4f1049['query'][_0xefe0('0x39')]);_0x139d15[_0xefe0('0x3a')]=qs[_0xefe0('0x33')](_[_0xefe0('0x4f')](_0x4f1049[_0xefe0('0x32')],_0x341cca['filters']));if(_0x4f1049[_0xefe0('0x32')][_0xefe0('0x3b')]){_0x139d15[_0xefe0('0x3a')]=_[_0xefe0('0x3c')](_0x139d15[_0xefe0('0x3a')],{'$or':_['map'](_0x139d15['attributes'],function(_0x29beb0){var _0x353518={};_0x353518[_0x29beb0]={'$like':'%'+_0x4f1049[_0xefe0('0x32')][_0xefe0('0x3b')]+'%'};return _0x353518;})});}_0x139d15=_[_0xefe0('0x3c')]({},_0x139d15,_0x4f1049[_0xefe0('0x49')]);return _0x1ad995['getDescriptions'](_0x139d15);}})['then'](function(_0x383a70){if(_0x383a70){_0x1823ee=_0x383a70[_0xefe0('0x48')];if(!_0x4f1049[_0xefe0('0x32')][_0xefe0('0x36')](_0xefe0('0x37'))){_0x139d15[_0xefe0('0x22')]=qs['limit'](_0x4f1049[_0xefe0('0x32')]['limit']);_0x139d15['offset']=qs[_0xefe0('0x20')](_0x4f1049[_0xefe0('0x32')][_0xefe0('0x20')]);}return _0x1ad995['getDescriptions'](_0x139d15);}})['then'](function(_0x3e1917){if(_0x3e1917){return _0x3e1917?{'count':_0x1823ee,'rows':_0x3e1917}:null;}})['then'](respondWithResult(_0x5dcb2b,null))[_0xefe0('0x43')](handleError(_0x5dcb2b,null));}; \ No newline at end of file +var _0x77ed=['fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','VtigerConfiguration','fieldName','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','rawAttributes','include','find','create','body','params','getFields','findOne','keys','nolimit','getSubjects','VtigerField','getDescriptions','eml-format','rimraf'];(function(_0x30b192,_0x4ae829){var _0xfd98bd=function(_0xff8039){while(--_0xff8039){_0x30b192['push'](_0x30b192['shift']());}};_0xfd98bd(++_0x4ae829);}(_0x77ed,0x1ba));var _0xd77e=function(_0x261213,_0x2f3fdb){_0x261213=_0x261213-0x0;var _0x4a3376=_0x77ed[_0x261213];return _0x4a3376;};'use strict';var emlformat=require(_0xd77e('0x0'));var rimraf=require(_0xd77e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd77e('0x2'));var rp=require(_0xd77e('0x3'));var moment=require(_0xd77e('0x4'));var BPromise=require(_0xd77e('0x5'));var Mustache=require(_0xd77e('0x6'));var util=require(_0xd77e('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd77e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd77e('0x9'));var deskjs=require(_0xd77e('0xa'));var toCsv=require(_0xd77e('0xb'));var querystring=require(_0xd77e('0xc'));var Papa=require('papaparse');var Redis=require(_0xd77e('0xd'));var authService=require(_0xd77e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd77e('0xf'));var hardwareService=require(_0xd77e('0x10'));var logger=require(_0xd77e('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd77e('0x12'))['db'];function respondWithStatusCode(_0x20023a,_0x3a5e6a){_0x3a5e6a=_0x3a5e6a||0xcc;return function(_0x4a6a31){if(_0x4a6a31){return _0x20023a[_0xd77e('0x13')](_0x3a5e6a);}return _0x20023a[_0xd77e('0x14')](_0x3a5e6a)[_0xd77e('0x15')]();};}function respondWithResult(_0x49bd87,_0xde02a7){_0xde02a7=_0xde02a7||0xc8;return function(_0x349a05){if(_0x349a05){return _0x49bd87[_0xd77e('0x14')](_0xde02a7)[_0xd77e('0x16')](_0x349a05);}};}function respondWithFilteredResult(_0x1de452,_0x3ead66){return function(_0x3e8f69){if(_0x3e8f69){var _0x21291c=typeof _0x3ead66[_0xd77e('0x17')]===_0xd77e('0x18')&&typeof _0x3ead66[_0xd77e('0x19')]===_0xd77e('0x18');var _0x5bea9e=_0x3e8f69[_0xd77e('0x1a')];var _0x1b5073=_0x21291c?0x0:_0x3ead66['offset'];var _0x3496f0=_0x21291c?_0x3e8f69[_0xd77e('0x1a')]:_0x3ead66['offset']+_0x3ead66[_0xd77e('0x19')];var _0x79e5e;if(_0x3496f0>=_0x5bea9e){_0x3496f0=_0x5bea9e;_0x79e5e=0xc8;}else{_0x79e5e=0xce;}_0x1de452[_0xd77e('0x14')](_0x79e5e);return _0x1de452['set'](_0xd77e('0x1b'),_0x1b5073+'-'+_0x3496f0+'/'+_0x5bea9e)[_0xd77e('0x16')](_0x3e8f69);}return null;};}function patchUpdates(_0xfe8f15){return function(_0x88b05b){try{jsonpatch[_0xd77e('0x1c')](_0x88b05b,_0xfe8f15,!![]);}catch(_0x2e4bbc){return BPromise['reject'](_0x2e4bbc);}return _0x88b05b[_0xd77e('0x1d')]();};}function saveUpdates(_0x5a3ab6,_0x326556){return function(_0x4642d9){if(_0x4642d9){return _0x4642d9[_0xd77e('0x1e')](_0x5a3ab6)[_0xd77e('0x1f')](function(_0x5a143f){return _0x5a143f;});}return null;};}function removeEntity(_0x5e124d,_0x2b4c8f){return function(_0x2b47d3){if(_0x2b47d3){return _0x2b47d3[_0xd77e('0x20')]()[_0xd77e('0x1f')](function(){_0x5e124d[_0xd77e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35140,_0x492ea1){return function(_0x1a3b59){if(!_0x1a3b59){_0x35140[_0xd77e('0x13')](0x194);}return _0x1a3b59;};}function handleError(_0x1aef57,_0x436f24){_0x436f24=_0x436f24||0x1f4;return function(_0x3564ed){logger[_0xd77e('0x21')](_0x3564ed[_0xd77e('0x22')]);if(_0x3564ed['name']){delete _0x3564ed['name'];}_0x1aef57[_0xd77e('0x14')](_0x436f24)[_0xd77e('0x23')](_0x3564ed);};}exports[_0xd77e('0x24')]=function(_0x2c1d00,_0x1927e1){var _0x2fe3ff={},_0xc5c3ac={},_0x41c71a={'count':0x0,'rows':[]};var _0x25aeb7=_[_0xd77e('0x25')](db[_0xd77e('0x26')]['rawAttributes'],function(_0x2744f9){return{'name':_0x2744f9[_0xd77e('0x27')],'type':_0x2744f9['type']['key']};});_0xc5c3ac[_0xd77e('0x28')]=_['map'](_0x25aeb7,_0xd77e('0x29'));_0xc5c3ac[_0xd77e('0x2a')]=_['keys'](_0x2c1d00[_0xd77e('0x2a')]);_0xc5c3ac[_0xd77e('0x2b')]=_[_0xd77e('0x2c')](_0xc5c3ac[_0xd77e('0x28')],_0xc5c3ac[_0xd77e('0x2a')]);_0x2fe3ff['attributes']=_[_0xd77e('0x2c')](_0xc5c3ac['model'],qs['fields'](_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x2d')]));_0x2fe3ff[_0xd77e('0x2e')]=_0x2fe3ff[_0xd77e('0x2e')][_0xd77e('0x2f')]?_0x2fe3ff['attributes']:_0xc5c3ac[_0xd77e('0x28')];if(!_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x30')]('nolimit')){_0x2fe3ff[_0xd77e('0x19')]=qs[_0xd77e('0x19')](_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x19')]);_0x2fe3ff[_0xd77e('0x17')]=qs[_0xd77e('0x17')](_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x17')]);}_0x2fe3ff[_0xd77e('0x31')]=qs[_0xd77e('0x32')](_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x32')]);_0x2fe3ff[_0xd77e('0x33')]=qs[_0xd77e('0x2b')](_[_0xd77e('0x34')](_0x2c1d00[_0xd77e('0x2a')],_0xc5c3ac[_0xd77e('0x2b')]),_0x25aeb7);if(_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x35')]){_0x2fe3ff[_0xd77e('0x33')]=_[_0xd77e('0x36')](_0x2fe3ff[_0xd77e('0x33')],{'$or':_[_0xd77e('0x25')](_0x25aeb7,function(_0x435ae9){if(_0x435ae9[_0xd77e('0x37')]!==_0xd77e('0x38')){var _0x55997={};_0x55997[_0x435ae9['name']]={'$like':'%'+_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x35')]+'%'};return _0x55997;}})});}_0x2fe3ff=_[_0xd77e('0x36')]({},_0x2fe3ff,_0x2c1d00[_0xd77e('0x39')]);var _0x8db31f={'where':_0x2fe3ff[_0xd77e('0x33')]};return db[_0xd77e('0x26')][_0xd77e('0x1a')](_0x8db31f)[_0xd77e('0x1f')](function(_0x1c3d6d){_0x41c71a['count']=_0x1c3d6d;if(_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x3a')]){_0x2fe3ff['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0xd77e('0x3b')](_0x2fe3ff);})[_0xd77e('0x1f')](function(_0x506a07){_0x41c71a['rows']=_0x506a07;return _0x41c71a;})['then'](respondWithFilteredResult(_0x1927e1,_0x2fe3ff))[_0xd77e('0x3c')](handleError(_0x1927e1,null));};exports['show']=function(_0x102e03,_0x129083){var _0x4ee48f={'raw':![],'where':{'id':_0x102e03['params']['id']}},_0x45d86c={};_0x45d86c[_0xd77e('0x28')]=_['keys'](db[_0xd77e('0x26')][_0xd77e('0x3d')]);_0x45d86c['query']=_['keys'](_0x102e03[_0xd77e('0x2a')]);_0x45d86c[_0xd77e('0x2b')]=_[_0xd77e('0x2c')](_0x45d86c[_0xd77e('0x28')],_0x45d86c[_0xd77e('0x2a')]);_0x4ee48f['attributes']=_['intersection'](_0x45d86c[_0xd77e('0x28')],qs[_0xd77e('0x2d')](_0x102e03[_0xd77e('0x2a')][_0xd77e('0x2d')]));_0x4ee48f[_0xd77e('0x2e')]=_0x4ee48f[_0xd77e('0x2e')][_0xd77e('0x2f')]?_0x4ee48f['attributes']:_0x45d86c[_0xd77e('0x28')];if(_0x102e03[_0xd77e('0x2a')][_0xd77e('0x3a')]){_0x4ee48f[_0xd77e('0x3e')]=[{'all':!![]}];}_0x4ee48f=_[_0xd77e('0x36')]({},_0x4ee48f,_0x102e03[_0xd77e('0x39')]);return db['VtigerConfiguration'][_0xd77e('0x3f')](_0x4ee48f)[_0xd77e('0x1f')](handleEntityNotFound(_0x129083,null))[_0xd77e('0x1f')](respondWithResult(_0x129083,null))[_0xd77e('0x3c')](handleError(_0x129083,null));};exports[_0xd77e('0x40')]=function(_0x3d60a9,_0x4932d7){return db['VtigerConfiguration'][_0xd77e('0x40')](_0x3d60a9['body'],{})[_0xd77e('0x1f')](respondWithResult(_0x4932d7,0xc9))[_0xd77e('0x3c')](handleError(_0x4932d7,null));};exports['update']=function(_0x2e45cd,_0x818e5f){if(_0x2e45cd['body']['id']){delete _0x2e45cd[_0xd77e('0x41')]['id'];}return db[_0xd77e('0x26')]['find']({'where':{'id':_0x2e45cd[_0xd77e('0x42')]['id']}})[_0xd77e('0x1f')](handleEntityNotFound(_0x818e5f,null))['then'](saveUpdates(_0x2e45cd['body'],null))['then'](respondWithResult(_0x818e5f,null))[_0xd77e('0x3c')](handleError(_0x818e5f,null));};exports[_0xd77e('0x20')]=function(_0x4daacf,_0x54fbc3){return db['VtigerConfiguration'][_0xd77e('0x3f')]({'where':{'id':_0x4daacf[_0xd77e('0x42')]['id']}})[_0xd77e('0x1f')](handleEntityNotFound(_0x54fbc3,null))[_0xd77e('0x1f')](removeEntity(_0x54fbc3,null))[_0xd77e('0x3c')](handleError(_0x54fbc3,null));};exports[_0xd77e('0x43')]=function(_0x46b5dd,_0x5561f1,_0x8c679c){var _0x20c07f={};var _0x29533c={};var _0x104946;var _0x2cf586;return db[_0xd77e('0x26')][_0xd77e('0x44')]({'where':{'id':_0x46b5dd['params']['id']}})[_0xd77e('0x1f')](handleEntityNotFound(_0x5561f1,null))[_0xd77e('0x1f')](function(_0xbb1580){if(_0xbb1580){_0x104946=_0xbb1580;_0x29533c[_0xd77e('0x28')]=_[_0xd77e('0x45')](db['VtigerField'][_0xd77e('0x3d')]);_0x29533c[_0xd77e('0x2a')]=_[_0xd77e('0x45')](_0x46b5dd['query']);_0x29533c[_0xd77e('0x2b')]=_[_0xd77e('0x2c')](_0x29533c[_0xd77e('0x28')],_0x29533c['query']);_0x20c07f[_0xd77e('0x2e')]=_['intersection'](_0x29533c[_0xd77e('0x28')],qs[_0xd77e('0x2d')](_0x46b5dd[_0xd77e('0x2a')]['fields']));_0x20c07f[_0xd77e('0x2e')]=_0x20c07f[_0xd77e('0x2e')][_0xd77e('0x2f')]?_0x20c07f[_0xd77e('0x2e')]:_0x29533c[_0xd77e('0x28')];_0x20c07f[_0xd77e('0x31')]=qs[_0xd77e('0x32')](_0x46b5dd[_0xd77e('0x2a')]['sort']);_0x20c07f['where']=qs['filters'](_[_0xd77e('0x34')](_0x46b5dd['query'],_0x29533c[_0xd77e('0x2b')]));if(_0x46b5dd[_0xd77e('0x2a')][_0xd77e('0x35')]){_0x20c07f[_0xd77e('0x33')]=_['merge'](_0x20c07f[_0xd77e('0x33')],{'$or':_[_0xd77e('0x25')](_0x20c07f[_0xd77e('0x2e')],function(_0x36e4ab){var _0x2d31ee={};_0x2d31ee[_0x36e4ab]={'$like':'%'+_0x46b5dd[_0xd77e('0x2a')][_0xd77e('0x35')]+'%'};return _0x2d31ee;})});}_0x20c07f=_[_0xd77e('0x36')]({},_0x20c07f,_0x46b5dd[_0xd77e('0x39')]);return _0x104946['getFields'](_0x20c07f);}})[_0xd77e('0x1f')](function(_0x26b822){if(_0x26b822){_0x2cf586=_0x26b822[_0xd77e('0x2f')];if(!_0x46b5dd[_0xd77e('0x2a')][_0xd77e('0x30')](_0xd77e('0x46'))){_0x20c07f[_0xd77e('0x19')]=qs[_0xd77e('0x19')](_0x46b5dd[_0xd77e('0x2a')][_0xd77e('0x19')]);_0x20c07f[_0xd77e('0x17')]=qs[_0xd77e('0x17')](_0x46b5dd[_0xd77e('0x2a')][_0xd77e('0x17')]);}return _0x104946[_0xd77e('0x43')](_0x20c07f);}})[_0xd77e('0x1f')](function(_0x2ff8c8){if(_0x2ff8c8){return _0x2ff8c8?{'count':_0x2cf586,'rows':_0x2ff8c8}:null;}})[_0xd77e('0x1f')](respondWithResult(_0x5561f1,null))[_0xd77e('0x3c')](handleError(_0x5561f1,null));};exports[_0xd77e('0x47')]=function(_0x48c37e,_0x15090f,_0x3a9062){var _0x5a743a={};var _0x14db24={};var _0x44372b;var _0x24a16e;return db[_0xd77e('0x26')][_0xd77e('0x44')]({'where':{'id':_0x48c37e[_0xd77e('0x42')]['id']}})['then'](handleEntityNotFound(_0x15090f,null))[_0xd77e('0x1f')](function(_0x14c038){if(_0x14c038){_0x44372b=_0x14c038;_0x14db24[_0xd77e('0x28')]=_['keys'](db[_0xd77e('0x48')]['rawAttributes']);_0x14db24[_0xd77e('0x2a')]=_[_0xd77e('0x45')](_0x48c37e[_0xd77e('0x2a')]);_0x14db24[_0xd77e('0x2b')]=_[_0xd77e('0x2c')](_0x14db24[_0xd77e('0x28')],_0x14db24['query']);_0x5a743a['attributes']=_['intersection'](_0x14db24[_0xd77e('0x28')],qs[_0xd77e('0x2d')](_0x48c37e[_0xd77e('0x2a')][_0xd77e('0x2d')]));_0x5a743a[_0xd77e('0x2e')]=_0x5a743a[_0xd77e('0x2e')][_0xd77e('0x2f')]?_0x5a743a[_0xd77e('0x2e')]:_0x14db24[_0xd77e('0x28')];_0x5a743a[_0xd77e('0x31')]=qs[_0xd77e('0x32')](_0x48c37e['query'][_0xd77e('0x32')]);_0x5a743a[_0xd77e('0x33')]=qs[_0xd77e('0x2b')](_[_0xd77e('0x34')](_0x48c37e[_0xd77e('0x2a')],_0x14db24[_0xd77e('0x2b')]));if(_0x48c37e[_0xd77e('0x2a')][_0xd77e('0x35')]){_0x5a743a[_0xd77e('0x33')]=_['merge'](_0x5a743a[_0xd77e('0x33')],{'$or':_[_0xd77e('0x25')](_0x5a743a[_0xd77e('0x2e')],function(_0x4963f9){var _0x121959={};_0x121959[_0x4963f9]={'$like':'%'+_0x48c37e[_0xd77e('0x2a')][_0xd77e('0x35')]+'%'};return _0x121959;})});}_0x5a743a=_[_0xd77e('0x36')]({},_0x5a743a,_0x48c37e[_0xd77e('0x39')]);return _0x44372b['getSubjects'](_0x5a743a);}})['then'](function(_0x1011c3){if(_0x1011c3){_0x24a16e=_0x1011c3['length'];if(!_0x48c37e[_0xd77e('0x2a')][_0xd77e('0x30')]('nolimit')){_0x5a743a[_0xd77e('0x19')]=qs['limit'](_0x48c37e[_0xd77e('0x2a')][_0xd77e('0x19')]);_0x5a743a[_0xd77e('0x17')]=qs[_0xd77e('0x17')](_0x48c37e['query']['offset']);}return _0x44372b[_0xd77e('0x47')](_0x5a743a);}})[_0xd77e('0x1f')](function(_0x407b89){if(_0x407b89){return _0x407b89?{'count':_0x24a16e,'rows':_0x407b89}:null;}})[_0xd77e('0x1f')](respondWithResult(_0x15090f,null))[_0xd77e('0x3c')](handleError(_0x15090f,null));};exports['getDescriptions']=function(_0x37bf00,_0x3df02c,_0x484dd2){var _0xa3b66c={};var _0x114ad7={};var _0x29f300;var _0x355cc9;return db[_0xd77e('0x26')][_0xd77e('0x44')]({'where':{'id':_0x37bf00[_0xd77e('0x42')]['id']}})['then'](handleEntityNotFound(_0x3df02c,null))[_0xd77e('0x1f')](function(_0x424402){if(_0x424402){_0x29f300=_0x424402;_0x114ad7[_0xd77e('0x28')]=_[_0xd77e('0x45')](db[_0xd77e('0x48')][_0xd77e('0x3d')]);_0x114ad7[_0xd77e('0x2a')]=_['keys'](_0x37bf00['query']);_0x114ad7['filters']=_[_0xd77e('0x2c')](_0x114ad7[_0xd77e('0x28')],_0x114ad7[_0xd77e('0x2a')]);_0xa3b66c[_0xd77e('0x2e')]=_[_0xd77e('0x2c')](_0x114ad7[_0xd77e('0x28')],qs[_0xd77e('0x2d')](_0x37bf00[_0xd77e('0x2a')][_0xd77e('0x2d')]));_0xa3b66c[_0xd77e('0x2e')]=_0xa3b66c['attributes'][_0xd77e('0x2f')]?_0xa3b66c[_0xd77e('0x2e')]:_0x114ad7[_0xd77e('0x28')];_0xa3b66c[_0xd77e('0x31')]=qs[_0xd77e('0x32')](_0x37bf00[_0xd77e('0x2a')]['sort']);_0xa3b66c[_0xd77e('0x33')]=qs[_0xd77e('0x2b')](_[_0xd77e('0x34')](_0x37bf00[_0xd77e('0x2a')],_0x114ad7[_0xd77e('0x2b')]));if(_0x37bf00[_0xd77e('0x2a')][_0xd77e('0x35')]){_0xa3b66c[_0xd77e('0x33')]=_[_0xd77e('0x36')](_0xa3b66c[_0xd77e('0x33')],{'$or':_[_0xd77e('0x25')](_0xa3b66c['attributes'],function(_0x2b60e0){var _0x1ddf9d={};_0x1ddf9d[_0x2b60e0]={'$like':'%'+_0x37bf00[_0xd77e('0x2a')][_0xd77e('0x35')]+'%'};return _0x1ddf9d;})});}_0xa3b66c=_['merge']({},_0xa3b66c,_0x37bf00['options']);return _0x29f300[_0xd77e('0x49')](_0xa3b66c);}})[_0xd77e('0x1f')](function(_0x4570f5){if(_0x4570f5){_0x355cc9=_0x4570f5['length'];if(!_0x37bf00[_0xd77e('0x2a')]['hasOwnProperty'](_0xd77e('0x46'))){_0xa3b66c[_0xd77e('0x19')]=qs[_0xd77e('0x19')](_0x37bf00['query'][_0xd77e('0x19')]);_0xa3b66c[_0xd77e('0x17')]=qs[_0xd77e('0x17')](_0x37bf00['query'][_0xd77e('0x17')]);}return _0x29f300[_0xd77e('0x49')](_0xa3b66c);}})[_0xd77e('0x1f')](function(_0x97b5a2){if(_0x97b5a2){return _0x97b5a2?{'count':_0x355cc9,'rows':_0x97b5a2}:null;}})[_0xd77e('0x1f')](respondWithResult(_0x3df02c,null))[_0xd77e('0x3c')](handleError(_0x3df02c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 8ba1690..7ffa72c 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce28=['../../config/logger','api','path','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x440848,_0x549f55){var _0x2ccc66=function(_0x49aae6){while(--_0x49aae6){_0x440848['push'](_0x440848['shift']());}};_0x2ccc66(++_0x549f55);}(_0xce28,0x121));var _0x8ce2=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xce28[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x8ce2('0x0'));var util=require('util');var logger=require(_0x8ce2('0x1'))(_0x8ce2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ce2('0x3'));var rimraf=require(_0x8ce2('0x4'));var config=require('../../config/environment');var attributes=require(_0x8ce2('0x5'));module[_0x8ce2('0x6')]=function(_0x3ed221,_0x1a7ef2){return _0x3ed221[_0x8ce2('0x7')](_0x8ce2('0x8'),attributes,{'tableName':_0x8ce2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37be=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37be,0xaa));var _0xe37b=function(_0x3f2a35,_0x484454){_0x3f2a35=_0x3f2a35-0x0;var _0x151f63=_0x37be[_0x3f2a35];return _0x151f63;};'use strict';var _=require(_0xe37b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe37b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe37b('0x2'));var fs=require('fs');var path=require(_0xe37b('0x3'));var rimraf=require(_0xe37b('0x4'));var config=require(_0xe37b('0x5'));var attributes=require(_0xe37b('0x6'));module[_0xe37b('0x7')]=function(_0x39dc32,_0x5ae9b8){return _0x39dc32[_0xe37b('0x8')](_0xe37b('0x9'),attributes,{'tableName':_0xe37b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 14445b9..14ca9ec 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80ee=['http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x52a1a6,_0x39ef2d){var _0x5eeaee=function(_0x1d37e6){while(--_0x1d37e6){_0x52a1a6['push'](_0x52a1a6['shift']());}};_0x5eeaee(++_0x39ef2d);}(_0x80ee,0x9b));var _0xe80e=function(_0xfc0021,_0x336a32){_0xfc0021=_0xfc0021-0x0;var _0x5f392c=_0x80ee[_0xfc0021];return _0x5f392c;};'use strict';var _=require(_0xe80e('0x0'));var util=require(_0xe80e('0x1'));var moment=require(_0xe80e('0x2'));var BPromise=require(_0xe80e('0x3'));var rs=require(_0xe80e('0x4'));var fs=require('fs');var Redis=require(_0xe80e('0x5'));var db=require(_0xe80e('0x6'))['db'];var utils=require(_0xe80e('0x7'));var logger=require(_0xe80e('0x8'))(_0xe80e('0x9'));var config=require(_0xe80e('0xa'));var jayson=require(_0xe80e('0xb'));var client=jayson[_0xe80e('0xc')][_0xe80e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5aaaec,_0x442ee5,_0x270bf6){return new BPromise(function(_0x335f42,_0x54242e){return client[_0xe80e('0xe')](_0x5aaaec,_0x270bf6)[_0xe80e('0xf')](function(_0x4e80ec){logger[_0xe80e('0x10')](_0xe80e('0x11'),_0x442ee5,'request\x20sent');logger[_0xe80e('0x12')](_0xe80e('0x13'),_0x442ee5,_0xe80e('0x14'),JSON['stringify'](_0x4e80ec));if(_0x4e80ec[_0xe80e('0x15')]){if(_0x4e80ec['error']['code']===0x1f4){logger['error'](_0xe80e('0x11'),_0x442ee5,_0x4e80ec[_0xe80e('0x15')]['message']);return _0x54242e(_0x4e80ec[_0xe80e('0x15')][_0xe80e('0x16')]);}logger[_0xe80e('0x15')](_0xe80e('0x11'),_0x442ee5,_0x4e80ec[_0xe80e('0x15')][_0xe80e('0x16')]);return _0x335f42(_0x4e80ec[_0xe80e('0x15')]['message']);}else{logger[_0xe80e('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x442ee5,_0xe80e('0x14'));_0x335f42(_0x4e80ec[_0xe80e('0x17')][_0xe80e('0x16')]);}})['catch'](function(_0x11aaba){logger[_0xe80e('0x15')](_0xe80e('0x11'),_0x442ee5,_0x11aaba);_0x54242e(_0x11aaba);});});} \ No newline at end of file +var _0xa576=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4e6375,_0x3156c5){var _0x443f68=function(_0x527db6){while(--_0x527db6){_0x4e6375['push'](_0x4e6375['shift']());}};_0x443f68(++_0x3156c5);}(_0xa576,0x151));var _0x6a57=function(_0x117871,_0x4b52b7){_0x117871=_0x117871-0x0;var _0x6cd12=_0xa576[_0x117871];return _0x6cd12;};'use strict';var _=require(_0x6a57('0x0'));var util=require('util');var moment=require(_0x6a57('0x1'));var BPromise=require(_0x6a57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a57('0x3'));var db=require(_0x6a57('0x4'))['db'];var utils=require(_0x6a57('0x5'));var logger=require(_0x6a57('0x6'))(_0x6a57('0x7'));var config=require(_0x6a57('0x8'));var jayson=require(_0x6a57('0x9'));var client=jayson[_0x6a57('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31b0f0,_0x1d2e51,_0x5a8a5f){return new BPromise(function(_0x524872,_0x50f7ab){return client[_0x6a57('0xb')](_0x31b0f0,_0x5a8a5f)[_0x6a57('0xc')](function(_0x561785){logger[_0x6a57('0xd')](_0x6a57('0xe'),_0x1d2e51,'request\x20sent');logger[_0x6a57('0xf')](_0x6a57('0x10'),_0x1d2e51,_0x6a57('0x11'),JSON[_0x6a57('0x12')](_0x561785));if(_0x561785[_0x6a57('0x13')]){if(_0x561785[_0x6a57('0x13')][_0x6a57('0x14')]===0x1f4){logger['error'](_0x6a57('0xe'),_0x1d2e51,_0x561785[_0x6a57('0x13')][_0x6a57('0x15')]);return _0x50f7ab(_0x561785[_0x6a57('0x13')][_0x6a57('0x15')]);}logger[_0x6a57('0x13')](_0x6a57('0xe'),_0x1d2e51,_0x561785[_0x6a57('0x13')][_0x6a57('0x15')]);return _0x524872(_0x561785[_0x6a57('0x13')][_0x6a57('0x15')]);}else{logger[_0x6a57('0xd')](_0x6a57('0xe'),_0x1d2e51,_0x6a57('0x11'));_0x524872(_0x561785[_0x6a57('0x16')][_0x6a57('0x15')]);}})[_0x6a57('0x17')](function(_0x2cc02e){logger[_0x6a57('0x13')](_0x6a57('0xe'),_0x1d2e51,_0x2cc02e);_0x50f7ab(_0x2cc02e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6fc31b5..0611a05 100644 --- a/server/api/intVtigerField/index.js +++ b/server/api/intVtigerField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9fb=['fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','put','/:id','update','destroy','exports','util','path','connect-timeout','Router'];(function(_0x4037cb,_0x4252e0){var _0x4d591c=function(_0x2fa17f){while(--_0x2fa17f){_0x4037cb['push'](_0x4037cb['shift']());}};_0x4d591c(++_0x4252e0);}(_0xd9fb,0xb0));var _0xbd9f=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xd9fb[_0x43d11d];return _0x38cd08;};'use strict';var multer=require('multer');var util=require(_0xbd9f('0x0'));var path=require(_0xbd9f('0x1'));var timeout=require(_0xbd9f('0x2'));var express=require('express');var router=express[_0xbd9f('0x3')]();var fs_extra=require(_0xbd9f('0x4'));var auth=require(_0xbd9f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd9f('0x6'));var controller=require(_0xbd9f('0x7'));router[_0xbd9f('0x8')]('/',auth[_0xbd9f('0x9')](),controller['index']);router[_0xbd9f('0x8')]('/:id',auth[_0xbd9f('0x9')](),controller['show']);router['post']('/',auth[_0xbd9f('0x9')](),controller['create']);router[_0xbd9f('0xa')](_0xbd9f('0xb'),auth[_0xbd9f('0x9')](),controller[_0xbd9f('0xc')]);router['delete'](_0xbd9f('0xb'),auth['isAuthenticated'](),controller[_0xbd9f('0xd')]);module[_0xbd9f('0xe')]=router; \ No newline at end of file +var _0x5c56=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x36a073,_0x2ce3ce){var _0xc9762b=function(_0x416bfe){while(--_0x416bfe){_0x36a073['push'](_0x36a073['shift']());}};_0xc9762b(++_0x2ce3ce);}(_0x5c56,0x1bd));var _0x65c5=function(_0x464a17,_0x463917){_0x464a17=_0x464a17-0x0;var _0x236b0e=_0x5c56[_0x464a17];return _0x236b0e;};'use strict';var multer=require(_0x65c5('0x0'));var util=require(_0x65c5('0x1'));var path=require('path');var timeout=require(_0x65c5('0x2'));var express=require('express');var router=express[_0x65c5('0x3')]();var fs_extra=require(_0x65c5('0x4'));var auth=require(_0x65c5('0x5'));var interaction=require(_0x65c5('0x6'));var config=require(_0x65c5('0x7'));var controller=require('./intVtigerField.controller');router[_0x65c5('0x8')]('/',auth[_0x65c5('0x9')](),controller[_0x65c5('0xa')]);router['get'](_0x65c5('0xb'),auth[_0x65c5('0x9')](),controller[_0x65c5('0xc')]);router[_0x65c5('0xd')]('/',auth[_0x65c5('0x9')](),controller['create']);router[_0x65c5('0xe')](_0x65c5('0xb'),auth[_0x65c5('0x9')](),controller[_0x65c5('0xf')]);router['delete'](_0x65c5('0xb'),auth[_0x65c5('0x9')](),controller[_0x65c5('0x10')]);module[_0x65c5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 194dfcd..5c46349 100644 --- a/server/api/intVtigerField/intVtigerField.attributes.js +++ b/server/api/intVtigerField/intVtigerField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28f5=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x581da0,_0x200b8b){var _0x37bd67=function(_0x3d22e1){while(--_0x3d22e1){_0x581da0['push'](_0x581da0['shift']());}};_0x37bd67(++_0x200b8b);}(_0x28f5,0x198));var _0x528f=function(_0x203d0c,_0x5ef226){_0x203d0c=_0x203d0c-0x0;var _0x2a4e20=_0x28f5[_0x203d0c];return _0x2a4e20;};'use strict';var Sequelize=require(_0x528f('0x0'));module[_0x528f('0x1')]={'type':{'type':Sequelize[_0x528f('0x2')](_0x528f('0x3'),_0x528f('0x4'),'customVariable',_0x528f('0x5'),_0x528f('0x6')),'defaultValue':_0x528f('0x3')},'content':{'type':Sequelize[_0x528f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x528f('0x4'),_0x528f('0x8'))},'keyContent':{'type':Sequelize[_0x528f('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x528f('0x7')]},'customField':{'type':Sequelize[_0x528f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8b29=['keyValue','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x26f375,_0x411d4e){var _0x3613f9=function(_0x481889){while(--_0x481889){_0x26f375['push'](_0x26f375['shift']());}};_0x3613f9(++_0x411d4e);}(_0x8b29,0x198));var _0x98b2=function(_0x4df01a,_0x44d9e1){_0x4df01a=_0x4df01a-0x0;var _0x528594=_0x8b29[_0x4df01a];return _0x528594;};'use strict';var Sequelize=require('sequelize');module[_0x98b2('0x0')]={'type':{'type':Sequelize[_0x98b2('0x1')](_0x98b2('0x2'),_0x98b2('0x3'),_0x98b2('0x4'),_0x98b2('0x5'),'picklist'),'defaultValue':_0x98b2('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x98b2('0x2'),_0x98b2('0x3'),_0x98b2('0x4'))},'keyContent':{'type':Sequelize[_0x98b2('0x6')]},'idField':{'type':Sequelize[_0x98b2('0x6')]},'nameField':{'type':Sequelize[_0x98b2('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x98b2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3d10af3..423150d 100644 --- a/server/api/intVtigerField/intVtigerField.controller.js +++ b/server/api/intVtigerField/intVtigerField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbb6=['body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','save','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','nolimit','order','sort','where','pick','filter','merge','options','VtigerField','includeAll','findAll','rows','catch','show','params','fields','length','include','create'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xbbb6,0x12e));var _0x6bbb=function(_0x3df408,_0x508050){_0x3df408=_0x3df408-0x0;var _0x3f7af0=_0xbbb6[_0x3df408];return _0x3f7af0;};'use strict';var emlformat=require(_0x6bbb('0x0'));var rimraf=require(_0x6bbb('0x1'));var zipdir=require(_0x6bbb('0x2'));var jsonpatch=require(_0x6bbb('0x3'));var rp=require(_0x6bbb('0x4'));var moment=require(_0x6bbb('0x5'));var BPromise=require(_0x6bbb('0x6'));var Mustache=require(_0x6bbb('0x7'));var util=require('util');var path=require(_0x6bbb('0x8'));var sox=require(_0x6bbb('0x9'));var csv=require(_0x6bbb('0xa'));var ejs=require(_0x6bbb('0xb'));var fs=require('fs');var fs_extra=require(_0x6bbb('0xc'));var _=require(_0x6bbb('0xd'));var squel=require('squel');var crypto=require(_0x6bbb('0xe'));var jsforce=require(_0x6bbb('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6bbb('0x10'));var Papa=require(_0x6bbb('0x11'));var Redis=require(_0x6bbb('0x12'));var authService=require(_0x6bbb('0x13'));var qs=require(_0x6bbb('0x14'));var as=require(_0x6bbb('0x15'));var hardwareService=require(_0x6bbb('0x16'));var logger=require(_0x6bbb('0x17'))(_0x6bbb('0x18'));var utils=require(_0x6bbb('0x19'));var config=require(_0x6bbb('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6bbb('0x1b'))['db'];function respondWithStatusCode(_0x587c04,_0x292166){_0x292166=_0x292166||0xcc;return function(_0x32983b){if(_0x32983b){return _0x587c04[_0x6bbb('0x1c')](_0x292166);}return _0x587c04[_0x6bbb('0x1d')](_0x292166)[_0x6bbb('0x1e')]();};}function respondWithResult(_0x908550,_0x42bde0){_0x42bde0=_0x42bde0||0xc8;return function(_0x4c2f42){if(_0x4c2f42){return _0x908550[_0x6bbb('0x1d')](_0x42bde0)[_0x6bbb('0x1f')](_0x4c2f42);}};}function respondWithFilteredResult(_0x23d277,_0x35ff70){return function(_0x39302d){if(_0x39302d){var _0x54502c=typeof _0x35ff70[_0x6bbb('0x20')]===_0x6bbb('0x21')&&typeof _0x35ff70[_0x6bbb('0x22')]===_0x6bbb('0x21');var _0xd9810f=_0x39302d[_0x6bbb('0x23')];var _0x175b65=_0x54502c?0x0:_0x35ff70['offset'];var _0x683311=_0x54502c?_0x39302d['count']:_0x35ff70['offset']+_0x35ff70[_0x6bbb('0x22')];var _0x1882c7;if(_0x683311>=_0xd9810f){_0x683311=_0xd9810f;_0x1882c7=0xc8;}else{_0x1882c7=0xce;}_0x23d277[_0x6bbb('0x1d')](_0x1882c7);return _0x23d277['set']('Content-Range',_0x175b65+'-'+_0x683311+'/'+_0xd9810f)['json'](_0x39302d);}return null;};}function patchUpdates(_0x5d6ba0){return function(_0x39d1f8){try{jsonpatch['apply'](_0x39d1f8,_0x5d6ba0,!![]);}catch(_0x23634d){return BPromise['reject'](_0x23634d);}return _0x39d1f8[_0x6bbb('0x24')]();};}function saveUpdates(_0x280231,_0x5c7ca8){return function(_0x4da11d){if(_0x4da11d){return _0x4da11d['update'](_0x280231)[_0x6bbb('0x25')](function(_0x4f314c){return _0x4f314c;});}return null;};}function removeEntity(_0x3d4c41,_0x8c3c3f){return function(_0x31e92f){if(_0x31e92f){return _0x31e92f[_0x6bbb('0x26')]()['then'](function(){_0x3d4c41['status'](0xcc)[_0x6bbb('0x1e')]();});}};}function handleEntityNotFound(_0x19d698,_0x48af65){return function(_0x5cc06e){if(!_0x5cc06e){_0x19d698[_0x6bbb('0x1c')](0x194);}return _0x5cc06e;};}function handleError(_0x130279,_0x5864b9){_0x5864b9=_0x5864b9||0x1f4;return function(_0xf4542f){logger[_0x6bbb('0x27')](_0xf4542f[_0x6bbb('0x28')]);if(_0xf4542f['name']){delete _0xf4542f[_0x6bbb('0x29')];}_0x130279[_0x6bbb('0x1d')](_0x5864b9)[_0x6bbb('0x2a')](_0xf4542f);};}exports[_0x6bbb('0x2b')]=function(_0x5df0be,_0x5b3f77){var _0x3ff9f3={},_0x340a92={},_0x460b3c={'count':0x0,'rows':[]};var _0x500a54=_[_0x6bbb('0x2c')](db['VtigerField'][_0x6bbb('0x2d')],function(_0x2d9350){return{'name':_0x2d9350['fieldName'],'type':_0x2d9350[_0x6bbb('0x2e')][_0x6bbb('0x2f')]};});_0x340a92['model']=_['map'](_0x500a54,_0x6bbb('0x29'));_0x340a92[_0x6bbb('0x30')]=_[_0x6bbb('0x31')](_0x5df0be[_0x6bbb('0x30')]);_0x340a92[_0x6bbb('0x32')]=_['intersection'](_0x340a92['model'],_0x340a92[_0x6bbb('0x30')]);_0x3ff9f3['attributes']=_[_0x6bbb('0x33')](_0x340a92[_0x6bbb('0x34')],qs['fields'](_0x5df0be[_0x6bbb('0x30')]['fields']));_0x3ff9f3['attributes']=_0x3ff9f3[_0x6bbb('0x35')]['length']?_0x3ff9f3[_0x6bbb('0x35')]:_0x340a92[_0x6bbb('0x34')];if(!_0x5df0be[_0x6bbb('0x30')]['hasOwnProperty'](_0x6bbb('0x36'))){_0x3ff9f3[_0x6bbb('0x22')]=qs[_0x6bbb('0x22')](_0x5df0be[_0x6bbb('0x30')][_0x6bbb('0x22')]);_0x3ff9f3[_0x6bbb('0x20')]=qs['offset'](_0x5df0be[_0x6bbb('0x30')][_0x6bbb('0x20')]);}_0x3ff9f3[_0x6bbb('0x37')]=qs[_0x6bbb('0x38')](_0x5df0be['query'][_0x6bbb('0x38')]);_0x3ff9f3[_0x6bbb('0x39')]=qs[_0x6bbb('0x32')](_[_0x6bbb('0x3a')](_0x5df0be[_0x6bbb('0x30')],_0x340a92[_0x6bbb('0x32')]),_0x500a54);if(_0x5df0be[_0x6bbb('0x30')][_0x6bbb('0x3b')]){_0x3ff9f3[_0x6bbb('0x39')]=_[_0x6bbb('0x3c')](_0x3ff9f3[_0x6bbb('0x39')],{'$or':_[_0x6bbb('0x2c')](_0x500a54,function(_0x2128fc){if(_0x2128fc[_0x6bbb('0x2e')]!=='VIRTUAL'){var _0x45ef5d={};_0x45ef5d[_0x2128fc[_0x6bbb('0x29')]]={'$like':'%'+_0x5df0be[_0x6bbb('0x30')]['filter']+'%'};return _0x45ef5d;}})});}_0x3ff9f3=_['merge']({},_0x3ff9f3,_0x5df0be[_0x6bbb('0x3d')]);var _0xf82855={'where':_0x3ff9f3[_0x6bbb('0x39')]};return db[_0x6bbb('0x3e')][_0x6bbb('0x23')](_0xf82855)['then'](function(_0x572730){_0x460b3c[_0x6bbb('0x23')]=_0x572730;if(_0x5df0be[_0x6bbb('0x30')][_0x6bbb('0x3f')]){_0x3ff9f3['include']=[{'all':!![]}];}return db[_0x6bbb('0x3e')][_0x6bbb('0x40')](_0x3ff9f3);})[_0x6bbb('0x25')](function(_0x4aac2f){_0x460b3c[_0x6bbb('0x41')]=_0x4aac2f;return _0x460b3c;})[_0x6bbb('0x25')](respondWithFilteredResult(_0x5b3f77,_0x3ff9f3))[_0x6bbb('0x42')](handleError(_0x5b3f77,null));};exports[_0x6bbb('0x43')]=function(_0x3ab89c,_0x4ba495){var _0x29653d={'raw':!![],'where':{'id':_0x3ab89c[_0x6bbb('0x44')]['id']}},_0x2482c6={};_0x2482c6[_0x6bbb('0x34')]=_['keys'](db[_0x6bbb('0x3e')][_0x6bbb('0x2d')]);_0x2482c6[_0x6bbb('0x30')]=_[_0x6bbb('0x31')](_0x3ab89c[_0x6bbb('0x30')]);_0x2482c6[_0x6bbb('0x32')]=_[_0x6bbb('0x33')](_0x2482c6[_0x6bbb('0x34')],_0x2482c6[_0x6bbb('0x30')]);_0x29653d[_0x6bbb('0x35')]=_['intersection'](_0x2482c6[_0x6bbb('0x34')],qs['fields'](_0x3ab89c[_0x6bbb('0x30')][_0x6bbb('0x45')]));_0x29653d[_0x6bbb('0x35')]=_0x29653d[_0x6bbb('0x35')][_0x6bbb('0x46')]?_0x29653d['attributes']:_0x2482c6[_0x6bbb('0x34')];if(_0x3ab89c['query'][_0x6bbb('0x3f')]){_0x29653d[_0x6bbb('0x47')]=[{'all':!![]}];}_0x29653d=_['merge']({},_0x29653d,_0x3ab89c[_0x6bbb('0x3d')]);return db[_0x6bbb('0x3e')]['find'](_0x29653d)[_0x6bbb('0x25')](handleEntityNotFound(_0x4ba495,null))[_0x6bbb('0x25')](respondWithResult(_0x4ba495,null))[_0x6bbb('0x42')](handleError(_0x4ba495,null));};exports[_0x6bbb('0x48')]=function(_0x4d4dc2,_0x243d76){return db[_0x6bbb('0x3e')][_0x6bbb('0x48')](_0x4d4dc2['body'],{})[_0x6bbb('0x25')](respondWithResult(_0x243d76,0xc9))[_0x6bbb('0x42')](handleError(_0x243d76,null));};exports['update']=function(_0x5d6057,_0x4a39cb){if(_0x5d6057[_0x6bbb('0x49')]['id']){delete _0x5d6057[_0x6bbb('0x49')]['id'];}return db[_0x6bbb('0x3e')]['find']({'where':{'id':_0x5d6057['params']['id']}})[_0x6bbb('0x25')](handleEntityNotFound(_0x4a39cb,null))[_0x6bbb('0x25')](saveUpdates(_0x5d6057[_0x6bbb('0x49')],null))[_0x6bbb('0x25')](respondWithResult(_0x4a39cb,null))['catch'](handleError(_0x4a39cb,null));};exports[_0x6bbb('0x26')]=function(_0x35dee4,_0x49d78e){return db[_0x6bbb('0x3e')][_0x6bbb('0x4a')]({'where':{'id':_0x35dee4[_0x6bbb('0x44')]['id']}})[_0x6bbb('0x25')](handleEntityNotFound(_0x49d78e,null))[_0x6bbb('0x25')](removeEntity(_0x49d78e,null))[_0x6bbb('0x42')](handleError(_0x49d78e,null));}; \ No newline at end of file +var _0x8148=['rows','catch','params','keys','options','create','body','update','find','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','destroy','then','end','error','name','send','index','VtigerField','rawAttributes','type','model','map','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include'];(function(_0x516856,_0x356418){var _0x3a4fcf=function(_0x447d01){while(--_0x447d01){_0x516856['push'](_0x516856['shift']());}};_0x3a4fcf(++_0x356418);}(_0x8148,0x121));var _0x8814=function(_0x28d89a,_0x31dd9a){_0x28d89a=_0x28d89a-0x0;var _0x111f8e=_0x8148[_0x28d89a];return _0x111f8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8814('0x0'));var zipdir=require(_0x8814('0x1'));var jsonpatch=require(_0x8814('0x2'));var rp=require('request-promise');var moment=require(_0x8814('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8814('0x4'));var sox=require('sox');var csv=require(_0x8814('0x5'));var ejs=require(_0x8814('0x6'));var fs=require('fs');var fs_extra=require(_0x8814('0x7'));var _=require(_0x8814('0x8'));var squel=require(_0x8814('0x9'));var crypto=require(_0x8814('0xa'));var jsforce=require(_0x8814('0xb'));var deskjs=require(_0x8814('0xc'));var toCsv=require(_0x8814('0x5'));var querystring=require(_0x8814('0xd'));var Papa=require(_0x8814('0xe'));var Redis=require(_0x8814('0xf'));var authService=require(_0x8814('0x10'));var qs=require(_0x8814('0x11'));var as=require(_0x8814('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8814('0x13'))(_0x8814('0x14'));var utils=require('../../config/utils');var config=require(_0x8814('0x15'));var licenseUtil=require(_0x8814('0x16'));var db=require(_0x8814('0x17'))['db'];function respondWithStatusCode(_0x1d52c2,_0x31ee1c){_0x31ee1c=_0x31ee1c||0xcc;return function(_0x3b3eaa){if(_0x3b3eaa){return _0x1d52c2[_0x8814('0x18')](_0x31ee1c);}return _0x1d52c2[_0x8814('0x19')](_0x31ee1c)['end']();};}function respondWithResult(_0x512767,_0x313569){_0x313569=_0x313569||0xc8;return function(_0x6d8129){if(_0x6d8129){return _0x512767[_0x8814('0x19')](_0x313569)[_0x8814('0x1a')](_0x6d8129);}};}function respondWithFilteredResult(_0xd8329d,_0x400201){return function(_0x4ec606){if(_0x4ec606){var _0x2fb00b=typeof _0x400201[_0x8814('0x1b')]===_0x8814('0x1c')&&typeof _0x400201['limit']===_0x8814('0x1c');var _0x4edd86=_0x4ec606[_0x8814('0x1d')];var _0xa68a8=_0x2fb00b?0x0:_0x400201[_0x8814('0x1b')];var _0x8659ea=_0x2fb00b?_0x4ec606[_0x8814('0x1d')]:_0x400201[_0x8814('0x1b')]+_0x400201[_0x8814('0x1e')];var _0x160c13;if(_0x8659ea>=_0x4edd86){_0x8659ea=_0x4edd86;_0x160c13=0xc8;}else{_0x160c13=0xce;}_0xd8329d[_0x8814('0x19')](_0x160c13);return _0xd8329d[_0x8814('0x1f')]('Content-Range',_0xa68a8+'-'+_0x8659ea+'/'+_0x4edd86)['json'](_0x4ec606);}return null;};}function patchUpdates(_0x3bf2a9){return function(_0x149578){try{jsonpatch['apply'](_0x149578,_0x3bf2a9,!![]);}catch(_0x4dac6d){return BPromise[_0x8814('0x20')](_0x4dac6d);}return _0x149578[_0x8814('0x21')]();};}function saveUpdates(_0x5001fd,_0x5702e8){return function(_0x1183a8){if(_0x1183a8){return _0x1183a8['update'](_0x5001fd)['then'](function(_0x1f03ac){return _0x1f03ac;});}return null;};}function removeEntity(_0xf5480d,_0x43f0ec){return function(_0x20220e){if(_0x20220e){return _0x20220e[_0x8814('0x22')]()[_0x8814('0x23')](function(){_0xf5480d[_0x8814('0x19')](0xcc)[_0x8814('0x24')]();});}};}function handleEntityNotFound(_0x390b56,_0x358907){return function(_0xc3eaef){if(!_0xc3eaef){_0x390b56[_0x8814('0x18')](0x194);}return _0xc3eaef;};}function handleError(_0x2b2c0a,_0x26843e){_0x26843e=_0x26843e||0x1f4;return function(_0x25bce9){logger[_0x8814('0x25')](_0x25bce9['stack']);if(_0x25bce9[_0x8814('0x26')]){delete _0x25bce9[_0x8814('0x26')];}_0x2b2c0a[_0x8814('0x19')](_0x26843e)[_0x8814('0x27')](_0x25bce9);};}exports[_0x8814('0x28')]=function(_0x2c3bbc,_0x4212a1){var _0x96a13={},_0x548bae={},_0x284a93={'count':0x0,'rows':[]};var _0x17df4e=_['map'](db[_0x8814('0x29')][_0x8814('0x2a')],function(_0x1c5244){return{'name':_0x1c5244['fieldName'],'type':_0x1c5244[_0x8814('0x2b')]['key']};});_0x548bae[_0x8814('0x2c')]=_[_0x8814('0x2d')](_0x17df4e,_0x8814('0x26'));_0x548bae['query']=_['keys'](_0x2c3bbc[_0x8814('0x2e')]);_0x548bae['filters']=_[_0x8814('0x2f')](_0x548bae[_0x8814('0x2c')],_0x548bae[_0x8814('0x2e')]);_0x96a13[_0x8814('0x30')]=_[_0x8814('0x2f')](_0x548bae[_0x8814('0x2c')],qs['fields'](_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x31')]));_0x96a13['attributes']=_0x96a13[_0x8814('0x30')]['length']?_0x96a13['attributes']:_0x548bae[_0x8814('0x2c')];if(!_0x2c3bbc[_0x8814('0x2e')]['hasOwnProperty'](_0x8814('0x32'))){_0x96a13[_0x8814('0x1e')]=qs[_0x8814('0x1e')](_0x2c3bbc['query'][_0x8814('0x1e')]);_0x96a13[_0x8814('0x1b')]=qs[_0x8814('0x1b')](_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x1b')]);}_0x96a13[_0x8814('0x33')]=qs['sort'](_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x34')]);_0x96a13['where']=qs[_0x8814('0x35')](_[_0x8814('0x36')](_0x2c3bbc['query'],_0x548bae[_0x8814('0x35')]),_0x17df4e);if(_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x37')]){_0x96a13[_0x8814('0x38')]=_[_0x8814('0x39')](_0x96a13[_0x8814('0x38')],{'$or':_[_0x8814('0x2d')](_0x17df4e,function(_0x50941d){if(_0x50941d[_0x8814('0x2b')]!==_0x8814('0x3a')){var _0x301fec={};_0x301fec[_0x50941d[_0x8814('0x26')]]={'$like':'%'+_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x37')]+'%'};return _0x301fec;}})});}_0x96a13=_[_0x8814('0x39')]({},_0x96a13,_0x2c3bbc['options']);var _0x507876={'where':_0x96a13[_0x8814('0x38')]};return db[_0x8814('0x29')][_0x8814('0x1d')](_0x507876)[_0x8814('0x23')](function(_0x56bf62){_0x284a93[_0x8814('0x1d')]=_0x56bf62;if(_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x3b')]){_0x96a13[_0x8814('0x3c')]=[{'all':!![]}];}return db[_0x8814('0x29')]['findAll'](_0x96a13);})[_0x8814('0x23')](function(_0x52a1c0){_0x284a93[_0x8814('0x3d')]=_0x52a1c0;return _0x284a93;})[_0x8814('0x23')](respondWithFilteredResult(_0x4212a1,_0x96a13))[_0x8814('0x3e')](handleError(_0x4212a1,null));};exports['show']=function(_0x2ff68,_0x2c7024){var _0x43fb16={'raw':!![],'where':{'id':_0x2ff68[_0x8814('0x3f')]['id']}},_0x4d6730={};_0x4d6730[_0x8814('0x2c')]=_[_0x8814('0x40')](db[_0x8814('0x29')][_0x8814('0x2a')]);_0x4d6730[_0x8814('0x2e')]=_[_0x8814('0x40')](_0x2ff68[_0x8814('0x2e')]);_0x4d6730[_0x8814('0x35')]=_[_0x8814('0x2f')](_0x4d6730[_0x8814('0x2c')],_0x4d6730['query']);_0x43fb16[_0x8814('0x30')]=_[_0x8814('0x2f')](_0x4d6730[_0x8814('0x2c')],qs['fields'](_0x2ff68[_0x8814('0x2e')][_0x8814('0x31')]));_0x43fb16[_0x8814('0x30')]=_0x43fb16['attributes']['length']?_0x43fb16[_0x8814('0x30')]:_0x4d6730[_0x8814('0x2c')];if(_0x2ff68['query'][_0x8814('0x3b')]){_0x43fb16[_0x8814('0x3c')]=[{'all':!![]}];}_0x43fb16=_[_0x8814('0x39')]({},_0x43fb16,_0x2ff68[_0x8814('0x41')]);return db[_0x8814('0x29')]['find'](_0x43fb16)[_0x8814('0x23')](handleEntityNotFound(_0x2c7024,null))['then'](respondWithResult(_0x2c7024,null))[_0x8814('0x3e')](handleError(_0x2c7024,null));};exports[_0x8814('0x42')]=function(_0xa07635,_0x2192a0){return db['VtigerField'][_0x8814('0x42')](_0xa07635[_0x8814('0x43')],{})[_0x8814('0x23')](respondWithResult(_0x2192a0,0xc9))['catch'](handleError(_0x2192a0,null));};exports[_0x8814('0x44')]=function(_0x281781,_0x4948f7){if(_0x281781[_0x8814('0x43')]['id']){delete _0x281781[_0x8814('0x43')]['id'];}return db[_0x8814('0x29')]['find']({'where':{'id':_0x281781[_0x8814('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4948f7,null))[_0x8814('0x23')](saveUpdates(_0x281781[_0x8814('0x43')],null))[_0x8814('0x23')](respondWithResult(_0x4948f7,null))[_0x8814('0x3e')](handleError(_0x4948f7,null));};exports[_0x8814('0x22')]=function(_0x19be42,_0x1c48af){return db['VtigerField'][_0x8814('0x45')]({'where':{'id':_0x19be42[_0x8814('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1c48af,null))[_0x8814('0x23')](removeEntity(_0x1c48af,null))['catch'](handleError(_0x1c48af,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index f960c4d..4d4432e 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02ea=['moment','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField','vtiger_unique_index','idField','FieldId','lodash'];(function(_0x4a8cf9,_0x4797ee){var _0x3fd298=function(_0x2b4175){while(--_0x2b4175){_0x4a8cf9['push'](_0x4a8cf9['shift']());}};_0x3fd298(++_0x4797ee);}(_0x02ea,0x180));var _0xa02e=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0x02ea[_0x45ae0d];return _0x371826;};'use strict';var _=require(_0xa02e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa02e('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa02e('0x2'));var rimraf=require(_0xa02e('0x3'));var config=require(_0xa02e('0x4'));var attributes=require(_0xa02e('0x5'));module[_0xa02e('0x6')]=function(_0x3065da,_0x4eea49){return _0x3065da['define'](_0xa02e('0x7'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xa02e('0x8'),'fields':[_0xa02e('0x9'),_0xa02e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1280=['path','rimraf','../../config/environment','exports','define','VtigerField','vtiger_unique_index','lodash','util','moment','bluebird'];(function(_0x5d8324,_0x3a353a){var _0x1c5903=function(_0x10d46a){while(--_0x10d46a){_0x5d8324['push'](_0x5d8324['shift']());}};_0x1c5903(++_0x3a353a);}(_0x1280,0x13b));var _0x0128=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x1280[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x0128('0x0'));var util=require(_0x0128('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0128('0x2'));var BPromise=require(_0x0128('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0128('0x4'));var rimraf=require(_0x0128('0x5'));var config=require(_0x0128('0x6'));var attributes=require('./intVtigerField.attributes');module[_0x0128('0x7')]=function(_0x2412e9,_0x136935){return _0x2412e9[_0x0128('0x8')](_0x0128('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x0128('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 1a31b3e..7734b0d 100644 --- a/server/api/intVtigerField/intVtigerField.rpc.js +++ b/server/api/intVtigerField/intVtigerField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfe4=['util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch'];(function(_0x5d7b55,_0xee503c){var _0x20c819=function(_0x4dad95){while(--_0x4dad95){_0x5d7b55['push'](_0x5d7b55['shift']());}};_0x20c819(++_0xee503c);}(_0xdfe4,0x120));var _0x4dfe=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xdfe4[_0x4709c0];return _0x13348b;};'use strict';var _=require('lodash');var util=require(_0x4dfe('0x0'));var moment=require(_0x4dfe('0x1'));var BPromise=require('bluebird');var rs=require(_0x4dfe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4dfe('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4dfe('0x4'))(_0x4dfe('0x5'));var config=require('../../config/environment');var jayson=require(_0x4dfe('0x6'));var client=jayson[_0x4dfe('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1db5f1,_0x37547c,_0x343a51){return new BPromise(function(_0x51080a,_0x5b0e2a){return client['request'](_0x1db5f1,_0x343a51)[_0x4dfe('0x8')](function(_0x4095fe){logger[_0x4dfe('0x9')](_0x4dfe('0xa'),_0x37547c,'request\x20sent');logger[_0x4dfe('0xb')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x37547c,_0x4dfe('0xc'),JSON[_0x4dfe('0xd')](_0x4095fe));if(_0x4095fe[_0x4dfe('0xe')]){if(_0x4095fe['error']['code']===0x1f4){logger['error'](_0x4dfe('0xa'),_0x37547c,_0x4095fe['error'][_0x4dfe('0xf')]);return _0x5b0e2a(_0x4095fe[_0x4dfe('0xe')][_0x4dfe('0xf')]);}logger['error'](_0x4dfe('0xa'),_0x37547c,_0x4095fe[_0x4dfe('0xe')]['message']);return _0x51080a(_0x4095fe[_0x4dfe('0xe')]['message']);}else{logger[_0x4dfe('0x9')]('VtigerField,\x20%s,\x20%s',_0x37547c,'request\x20sent');_0x51080a(_0x4095fe[_0x4dfe('0x10')][_0x4dfe('0xf')]);}})[_0x4dfe('0x11')](function(_0x1c15d1){logger[_0x4dfe('0xe')]('VtigerField,\x20%s,\x20%s',_0x37547c,_0x1c15d1);_0x5b0e2a(_0x1c15d1);});});} \ No newline at end of file +var _0x04f4=['request','then','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x04f4,0xfc));var _0x404f=function(_0xefd94d,_0x26969e){_0xefd94d=_0xefd94d-0x0;var _0x2c771d=_0x04f4[_0xefd94d];return _0x2c771d;};'use strict';var _=require('lodash');var util=require(_0x404f('0x0'));var moment=require(_0x404f('0x1'));var BPromise=require(_0x404f('0x2'));var rs=require(_0x404f('0x3'));var fs=require('fs');var Redis=require(_0x404f('0x4'));var db=require(_0x404f('0x5'))['db'];var utils=require(_0x404f('0x6'));var logger=require(_0x404f('0x7'))('rpc');var config=require(_0x404f('0x8'));var jayson=require(_0x404f('0x9'));var client=jayson[_0x404f('0xa')][_0x404f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x489c4d,_0x7ec322,_0x279cdc){return new BPromise(function(_0x211763,_0x409f9c){return client[_0x404f('0xc')](_0x489c4d,_0x279cdc)[_0x404f('0xd')](function(_0x1fad13){logger['info'](_0x404f('0xe'),_0x7ec322,'request\x20sent');logger['debug'](_0x404f('0xf'),_0x7ec322,_0x404f('0x10'),JSON['stringify'](_0x1fad13));if(_0x1fad13[_0x404f('0x11')]){if(_0x1fad13[_0x404f('0x11')][_0x404f('0x12')]===0x1f4){logger['error'](_0x404f('0xe'),_0x7ec322,_0x1fad13[_0x404f('0x11')][_0x404f('0x13')]);return _0x409f9c(_0x1fad13[_0x404f('0x11')][_0x404f('0x13')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x7ec322,_0x1fad13[_0x404f('0x11')][_0x404f('0x13')]);return _0x211763(_0x1fad13['error']['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x7ec322,'request\x20sent');_0x211763(_0x1fad13[_0x404f('0x14')][_0x404f('0x13')]);}})[_0x404f('0x15')](function(_0x26153b){logger[_0x404f('0x11')](_0x404f('0xe'),_0x7ec322,_0x26153b);_0x409f9c(_0x26153b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index da2ae01..3019c5f 100644 --- a/server/api/intZendeskAccount/index.js +++ b/server/api/intZendeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04e9=['addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x3cb65f,_0x988aff){var _0x142658=function(_0x1e3b8b){while(--_0x1e3b8b){_0x3cb65f['push'](_0x3cb65f['shift']());}};_0x142658(++_0x988aff);}(_0x04e9,0x1bf));var _0x904e=function(_0x51b43e,_0x4193a3){_0x51b43e=_0x51b43e-0x0;var _0x176868=_0x04e9[_0x51b43e];return _0x176868;};'use strict';var multer=require(_0x904e('0x0'));var util=require(_0x904e('0x1'));var path=require(_0x904e('0x2'));var timeout=require(_0x904e('0x3'));var express=require(_0x904e('0x4'));var router=express[_0x904e('0x5')]();var fs_extra=require(_0x904e('0x6'));var auth=require(_0x904e('0x7'));var interaction=require(_0x904e('0x8'));var config=require(_0x904e('0x9'));var controller=require(_0x904e('0xa'));router[_0x904e('0xb')]('/',auth[_0x904e('0xc')](),controller[_0x904e('0xd')]);router['get'](_0x904e('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x904e('0xb')](_0x904e('0xf'),auth[_0x904e('0xc')](),controller[_0x904e('0x10')]);router[_0x904e('0xb')](_0x904e('0x11'),auth[_0x904e('0xc')](),controller[_0x904e('0x12')]);router[_0x904e('0x13')]('/',auth[_0x904e('0xc')](),controller[_0x904e('0x14')]);router['post'](_0x904e('0xf'),auth[_0x904e('0xc')](),controller[_0x904e('0x15')]);router[_0x904e('0x16')](_0x904e('0xe'),auth[_0x904e('0xc')](),controller[_0x904e('0x17')]);router[_0x904e('0x18')](_0x904e('0xe'),auth[_0x904e('0xc')](),controller[_0x904e('0x19')]);module['exports']=router; \ No newline at end of file +var _0xf22e=['/:id/fields','post','create','addConfiguration','put','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf22e,0x94));var _0xef22=function(_0x5a1071,_0x331154){_0x5a1071=_0x5a1071-0x0;var _0x57b6fb=_0xf22e[_0x5a1071];return _0x57b6fb;};'use strict';var multer=require('multer');var util=require(_0xef22('0x0'));var path=require(_0xef22('0x1'));var timeout=require(_0xef22('0x2'));var express=require(_0xef22('0x3'));var router=express[_0xef22('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xef22('0x5'));var controller=require('./intZendeskAccount.controller');router[_0xef22('0x6')]('/',auth['isAuthenticated'](),controller[_0xef22('0x7')]);router['get'](_0xef22('0x8'),auth[_0xef22('0x9')](),controller[_0xef22('0xa')]);router[_0xef22('0x6')](_0xef22('0xb'),auth[_0xef22('0x9')](),controller['getConfigurations']);router['get'](_0xef22('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xef22('0xd')]('/',auth['isAuthenticated'](),controller[_0xef22('0xe')]);router['post'](_0xef22('0xb'),auth[_0xef22('0x9')](),controller[_0xef22('0xf')]);router[_0xef22('0x10')](_0xef22('0x8'),auth[_0xef22('0x9')](),controller[_0xef22('0x11')]);router[_0xef22('0x12')]('/:id',auth[_0xef22('0x9')](),controller['destroy']);module[_0xef22('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 05a79ed..ef8507e 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.attributes.js +++ b/server/api/intZendeskAccount/intZendeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7de=['integrationTab','sequelize','exports','STRING','username','ENUM','password','token','newTab'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xb7de,0xc7));var _0xeb7d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb7de[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xeb7d('0x0'));module[_0xeb7d('0x1')]={'name':{'type':Sequelize[_0xeb7d('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xeb7d('0x2')],'unique':_0xeb7d('0x3')},'password':{'type':Sequelize[_0xeb7d('0x2')]},'token':{'type':Sequelize[_0xeb7d('0x2')]},'remoteUri':{'type':Sequelize[_0xeb7d('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xeb7d('0x4')](_0xeb7d('0x5'),_0xeb7d('0x6')),'defaultValue':_0xeb7d('0x5')},'serverUrl':{'type':Sequelize[_0xeb7d('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xeb7d('0x7')),'defaultValue':_0xeb7d('0x8')}}; \ No newline at end of file +var _0x044a=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','password','token'];(function(_0x38e63e,_0x2a45fc){var _0x5df16f=function(_0x3ed5ef){while(--_0x3ed5ef){_0x38e63e['push'](_0x38e63e['shift']());}};_0x5df16f(++_0x2a45fc);}(_0x044a,0x173));var _0xa044=function(_0x295fd2,_0x21d77f){_0x295fd2=_0x295fd2-0x0;var _0x3ec8d1=_0x044a[_0x295fd2];return _0x3ec8d1;};'use strict';var Sequelize=require(_0xa044('0x0'));module[_0xa044('0x1')]={'name':{'type':Sequelize[_0xa044('0x2')]},'description':{'type':Sequelize[_0xa044('0x2')]},'username':{'type':Sequelize[_0xa044('0x2')],'unique':_0xa044('0x3')},'password':{'type':Sequelize[_0xa044('0x2')]},'token':{'type':Sequelize[_0xa044('0x2')]},'remoteUri':{'type':Sequelize[_0xa044('0x2')],'unique':_0xa044('0x4')},'authType':{'type':Sequelize['ENUM'](_0xa044('0x5'),_0xa044('0x6')),'defaultValue':_0xa044('0x5')},'serverUrl':{'type':Sequelize[_0xa044('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa044('0x7'),_0xa044('0x8')),'defaultValue':_0xa044('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a7d5f08..bc6f88d 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.controller.js +++ b/server/api/intZendeskAccount/intZendeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7b4=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','merge','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes','title','position','system_field_options','custom_field_options','test','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','mustache','util','path','sox'];(function(_0x462b92,_0x3d6ffe){var _0x520ca6=function(_0x33d6e8){while(--_0x33d6e8){_0x462b92['push'](_0x462b92['shift']());}};_0x520ca6(++_0x3d6ffe);}(_0xf7b4,0x152));var _0x4f7b=function(_0x14361b,_0x42d5cc){_0x14361b=_0x14361b-0x0;var _0x5d96bb=_0xf7b4[_0x14361b];return _0x5d96bb;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4f7b('0x17'));function respondWithStatusCode(_0x2e8dd9,_0x3c55e1){_0x3c55e1=_0x3c55e1||0xcc;return function(_0x41a050){if(_0x41a050){return _0x2e8dd9['sendStatus'](_0x3c55e1);}return _0x2e8dd9[_0x4f7b('0x18')](_0x3c55e1)[_0x4f7b('0x19')]();};}function respondWithResult(_0x407cee,_0x43a51a){_0x43a51a=_0x43a51a||0xc8;return function(_0x339486){if(_0x339486){return _0x407cee[_0x4f7b('0x18')](_0x43a51a)[_0x4f7b('0x1a')](_0x339486);}};}function respondWithFilteredResult(_0x2437cc,_0x260667){return function(_0x29fdd5){if(_0x29fdd5){var _0x1a28b8=typeof _0x260667[_0x4f7b('0x1b')]==='undefined'&&typeof _0x260667[_0x4f7b('0x1c')]==='undefined';var _0x5b5ee3=_0x29fdd5[_0x4f7b('0x1d')];var _0x3813da=_0x1a28b8?0x0:_0x260667['offset'];var _0x2b34c9=_0x1a28b8?_0x29fdd5[_0x4f7b('0x1d')]:_0x260667[_0x4f7b('0x1b')]+_0x260667[_0x4f7b('0x1c')];var _0x5a5187;if(_0x2b34c9>=_0x5b5ee3){_0x2b34c9=_0x5b5ee3;_0x5a5187=0xc8;}else{_0x5a5187=0xce;}_0x2437cc[_0x4f7b('0x18')](_0x5a5187);return _0x2437cc['set'](_0x4f7b('0x1e'),_0x3813da+'-'+_0x2b34c9+'/'+_0x5b5ee3)[_0x4f7b('0x1a')](_0x29fdd5);}return null;};}function patchUpdates(_0xa2f54e){return function(_0xdb2df2){try{jsonpatch[_0x4f7b('0x1f')](_0xdb2df2,_0xa2f54e,!![]);}catch(_0x203a92){return BPromise[_0x4f7b('0x20')](_0x203a92);}return _0xdb2df2[_0x4f7b('0x21')]();};}function saveUpdates(_0x2a8b50,_0x5508bd){return function(_0x410176){if(_0x410176){return _0x410176[_0x4f7b('0x22')](_0x2a8b50)[_0x4f7b('0x23')](function(_0x5bd43f){return _0x5bd43f;});}return null;};}function removeEntity(_0x150f57,_0x4610a4){return function(_0x5d22f4){if(_0x5d22f4){return _0x5d22f4[_0x4f7b('0x24')]()['then'](function(){_0x150f57[_0x4f7b('0x18')](0xcc)[_0x4f7b('0x19')]();});}};}function handleEntityNotFound(_0x23c820,_0x278c41){return function(_0x17aa9d){if(!_0x17aa9d){_0x23c820[_0x4f7b('0x25')](0x194);}return _0x17aa9d;};}function handleError(_0x181e13,_0x3ad769){_0x3ad769=_0x3ad769||0x1f4;return function(_0x4ec9a3){logger[_0x4f7b('0x26')](_0x4ec9a3[_0x4f7b('0x27')]);if(_0x4ec9a3[_0x4f7b('0x28')]){delete _0x4ec9a3['name'];}_0x181e13[_0x4f7b('0x18')](_0x3ad769)[_0x4f7b('0x29')](_0x4ec9a3);};}exports[_0x4f7b('0x2a')]=function(_0x3a56ff,_0x1ccce0){var _0x4ebffa={},_0xac1f93={},_0x3331b2={'count':0x0,'rows':[]};var _0x9a675c=_['map'](db[_0x4f7b('0x2b')]['rawAttributes'],function(_0x4e4828){return{'name':_0x4e4828[_0x4f7b('0x2c')],'type':_0x4e4828['type'][_0x4f7b('0x2d')]};});_0xac1f93[_0x4f7b('0x2e')]=_[_0x4f7b('0x2f')](_0x9a675c,_0x4f7b('0x28'));_0xac1f93[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3a56ff[_0x4f7b('0x30')]);_0xac1f93[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],_0xac1f93[_0x4f7b('0x30')]);_0x4ebffa[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0x4ebffa[_0x4f7b('0x34')]=_0x4ebffa[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x4ebffa[_0x4f7b('0x34')]:_0xac1f93[_0x4f7b('0x2e')];if(!_0x3a56ff['query'][_0x4f7b('0x37')]('nolimit')){_0x4ebffa[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x3a56ff['query'][_0x4f7b('0x1c')]);_0x4ebffa[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x3a56ff['query'][_0x4f7b('0x1b')]);}_0x4ebffa[_0x4f7b('0x38')]=qs[_0x4f7b('0x39')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0x4ebffa[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_['pick'](_0x3a56ff[_0x4f7b('0x30')],_0xac1f93['filters']),_0x9a675c);if(_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x3b')]){_0x4ebffa[_0x4f7b('0x3a')]=_['merge'](_0x4ebffa[_0x4f7b('0x3a')],{'$or':_['map'](_0x9a675c,function(_0x2471dc){if(_0x2471dc[_0x4f7b('0x3c')]!=='VIRTUAL'){var _0x48aecc={};_0x48aecc[_0x2471dc[_0x4f7b('0x28')]]={'$like':'%'+_0x3a56ff['query'][_0x4f7b('0x3b')]+'%'};return _0x48aecc;}})});}_0x4ebffa=_[_0x4f7b('0x3d')]({},_0x4ebffa,_0x3a56ff['options']);var _0x1d0746={'where':_0x4ebffa['where']};return db['ZendeskAccount']['count'](_0x1d0746)[_0x4f7b('0x23')](function(_0x2e861d){_0x3331b2[_0x4f7b('0x1d')]=_0x2e861d;if(_0x3a56ff[_0x4f7b('0x30')]['includeAll']){_0x4ebffa[_0x4f7b('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4f7b('0x3f')](_0x4ebffa);})['then'](function(_0x3c411f){_0x3331b2['rows']=_0x3c411f;return _0x3331b2;})[_0x4f7b('0x23')](respondWithFilteredResult(_0x1ccce0,_0x4ebffa))[_0x4f7b('0x40')](handleError(_0x1ccce0,null));};exports[_0x4f7b('0x41')]=function(_0x3ab08f,_0x2986cd){var _0x325cd6={'raw':![],'where':{'id':_0x3ab08f[_0x4f7b('0x42')]['id']}},_0x3fdde2={};_0x3fdde2[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x2b')][_0x4f7b('0x43')]);_0x3fdde2[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3ab08f[_0x4f7b('0x30')]);_0x3fdde2[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],_0x3fdde2['query']);_0x325cd6['attributes']=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3ab08f[_0x4f7b('0x30')]['fields']));_0x325cd6['attributes']=_0x325cd6[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x325cd6[_0x4f7b('0x34')]:_0x3fdde2[_0x4f7b('0x2e')];if(_0x3ab08f['query']['includeAll']){_0x325cd6[_0x4f7b('0x3e')]=[{'all':!![]}];}_0x325cd6=_[_0x4f7b('0x3d')]({},_0x325cd6,_0x3ab08f[_0x4f7b('0x44')]);return db[_0x4f7b('0x2b')][_0x4f7b('0x45')](_0x325cd6)['then'](handleEntityNotFound(_0x2986cd,null))[_0x4f7b('0x23')](respondWithResult(_0x2986cd,null))[_0x4f7b('0x40')](handleError(_0x2986cd,null));};exports[_0x4f7b('0x46')]=function(_0x5df68e,_0x6c659c){return db[_0x4f7b('0x2b')][_0x4f7b('0x46')](_0x5df68e[_0x4f7b('0x47')],{})[_0x4f7b('0x23')](respondWithResult(_0x6c659c,0xc9))[_0x4f7b('0x40')](handleError(_0x6c659c,null));};exports[_0x4f7b('0x22')]=function(_0x2e563f,_0x2630ec){if(_0x2e563f[_0x4f7b('0x47')]['id']){delete _0x2e563f['body']['id'];}return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x2e563f[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2630ec,null))[_0x4f7b('0x23')](saveUpdates(_0x2e563f[_0x4f7b('0x47')],null))[_0x4f7b('0x23')](respondWithResult(_0x2630ec,null))[_0x4f7b('0x40')](handleError(_0x2630ec,null));};exports[_0x4f7b('0x24')]=function(_0x7e624,_0x144ba1){return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x7e624[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x144ba1,null))[_0x4f7b('0x23')](removeEntity(_0x144ba1,null))[_0x4f7b('0x40')](handleError(_0x144ba1,null));};exports[_0x4f7b('0x48')]=function(_0x4d1ac9,_0x2c9cee,_0x40c183){var _0xeeb227={};var _0xb92819={};var _0x3437a8;var _0x819fb3;return db['ZendeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x4d1ac9[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x2c9cee,null))['then'](function(_0x4017b5){if(_0x4017b5){_0x3437a8=_0x4017b5;_0xb92819[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x4a')][_0x4f7b('0x43')]);_0xb92819[_0x4f7b('0x30')]=_['keys'](_0x4d1ac9[_0x4f7b('0x30')]);_0xb92819['filters']=_['intersection'](_0xb92819['model'],_0xb92819[_0x4f7b('0x30')]);_0xeeb227[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xb92819['model'],qs['fields'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0xeeb227['attributes']=_0xeeb227[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0xeeb227[_0x4f7b('0x34')]:_0xb92819[_0x4f7b('0x2e')];_0xeeb227['order']=qs[_0x4f7b('0x39')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0xeeb227[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_[_0x4f7b('0x4b')](_0x4d1ac9[_0x4f7b('0x30')],_0xb92819['filters']));if(_0x4d1ac9['query']['filter']){_0xeeb227[_0x4f7b('0x3a')]=_['merge'](_0xeeb227['where'],{'$or':_['map'](_0xeeb227['attributes'],function(_0x4a35d1){var _0x2715b5={};_0x2715b5[_0x4a35d1]={'$like':'%'+_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x3b')]+'%'};return _0x2715b5;})});}_0xeeb227=_[_0x4f7b('0x3d')]({},_0xeeb227,_0x4d1ac9[_0x4f7b('0x44')]);return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x1d500c){if(_0x1d500c){_0x819fb3=_0x1d500c[_0x4f7b('0x36')];if(!_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x37')](_0x4f7b('0x4c'))){_0xeeb227[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1c')]);_0xeeb227[_0x4f7b('0x1b')]=qs['offset'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1b')]);}return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x321f36){if(_0x321f36){return _0x321f36?{'count':_0x819fb3,'rows':_0x321f36}:null;}})['then'](respondWithResult(_0x2c9cee,null))['catch'](handleError(_0x2c9cee,null));};exports[_0x4f7b('0x4d')]=function(_0x5a2b3d,_0x457ac5,_0x384a08){if(_0x5a2b3d[_0x4f7b('0x47')]['id']){delete _0x5a2b3d[_0x4f7b('0x47')]['id'];}return db['ZendeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x5a2b3d[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x457ac5,null))['then'](function(_0x4b2089){if(_0x4b2089){_0x5a2b3d['body'][_0x4f7b('0x4e')]=_0x4b2089['id'];_0x5a2b3d['body']['Subjects']=integrations['getSubjects'](_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')]['type']);_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x50')]=integrations['getDescriptions'](_0x5a2b3d['body'][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x3c')]);return db[_0x4f7b('0x4a')]['create'](_0x5a2b3d[_0x4f7b('0x47')],{'include':[{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x52')},{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x50')}]});}return null;})[_0x4f7b('0x23')](respondWithResult(_0x457ac5,null))['catch'](handleError(_0x457ac5,null));};exports[_0x4f7b('0x53')]=function(_0x79deaa,_0xa10c21,_0x220f21){var _0x1ca442='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x79deaa['params']['id']},'attributes':['id',_0x4f7b('0x54'),_0x4f7b('0x55'),_0x4f7b('0x56'),_0x4f7b('0x57'),_0x4f7b('0x58')]})['then'](handleEntityNotFound(_0xa10c21,null))[_0x4f7b('0x23')](function(_0x16dbe3){if(_0x16dbe3){_0x1ca442=_0x16dbe3[_0x4f7b('0x58')];var _0x2a09b6=_0x1ca442[_0x4f7b('0x59')](-0x1);if(_0x2a09b6==='/'){_0x1ca442=_0x1ca442[_0x4f7b('0x5a')](0x0,_0x1ca442[_0x4f7b('0x5b')](_0x2a09b6));}var _0x477077={'method':_0x4f7b('0x5c'),'uri':util[_0x4f7b('0x5d')](_0x4f7b('0x5e'),_0x1ca442,_0x4f7b('0x5f')),'json':!![]};switch(_0x16dbe3[_0x4f7b('0x57')]){case _0x4f7b('0x55'):_0x477077[_0x4f7b('0x60')]={'Authorization':util[_0x4f7b('0x5d')](_0x4f7b('0x61'),new Buffer(util[_0x4f7b('0x5d')]('%s:%s',_0x16dbe3['username'],_0x16dbe3[_0x4f7b('0x55')]))[_0x4f7b('0x62')](_0x4f7b('0x63')))};break;case _0x4f7b('0x56'):_0x477077['headers']={'Authorization':util[_0x4f7b('0x5d')](_0x4f7b('0x61'),new Buffer(util[_0x4f7b('0x5d')](_0x4f7b('0x64'),_0x16dbe3[_0x4f7b('0x54')],_0x16dbe3[_0x4f7b('0x56')]))[_0x4f7b('0x62')](_0x4f7b('0x63')))};break;default:throw new db[(_0x4f7b('0x65'))][(_0x4f7b('0x66'))](_0x4f7b('0x67'));}return rp(_0x477077);}})[_0x4f7b('0x23')](function(_0x26b5cb){if(_0x26b5cb){var _0x278d72=[_0x4f7b('0x68'),'description',_0x4f7b('0x69'),_0x4f7b('0x6a')];_['remove'](_0x26b5cb['ticket_fields'],function(_0x45aced){return _0x278d72[_0x4f7b('0x6b')](_0x45aced[_0x4f7b('0x3c')]);});return{'count':_0x26b5cb[_0x4f7b('0x5f')][_0x4f7b('0x36')],'rows':_[_0x4f7b('0x2f')](_0x26b5cb[_0x4f7b('0x5f')],function(_0x48d9c6){return{'id':_0x48d9c6['id'],'name':_0x48d9c6['position']>0x7?_0x48d9c6[_0x4f7b('0x6c')]:_0x48d9c6[_0x4f7b('0x3c')],'custom':_0x48d9c6[_0x4f7b('0x6d')]>0x7?!![]:![],'options':_0x48d9c6[_0x4f7b('0x6e')]?_0x48d9c6['system_field_options']:_0x48d9c6[_0x4f7b('0x6f')]?_0x48d9c6[_0x4f7b('0x6f')]:[]};})};}})['then'](respondWithResult(_0xa10c21,null))[_0x4f7b('0x40')](function(_0x247541){var _0x50aabe=_0x79deaa['query'][_0x4f7b('0x70')]?0x1f4:_0x247541['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4f7b('0x53'),_0x50aabe,JSON['stringify'](_0x247541));delete _0x247541[_0x4f7b('0x28')];if(_0x50aabe===0x191){_0x50aabe=0x190;}_0xa10c21[_0x4f7b('0x18')](_0x50aabe)[_0x4f7b('0x29')](_0x79deaa[_0x4f7b('0x30')][_0x4f7b('0x70')]?{'message':_0x4f7b('0x71'),'statusCode':_0x247541[_0x4f7b('0x72')]}:_0x247541);});}; \ No newline at end of file +var _0xe605=['password','token','authType','remoteUri','slice','GET','format','headers','Basic\x20%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','ZendeskAccount','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','rawAttributes','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username'];(function(_0x4f6037,_0x8e0a90){var _0x2542e2=function(_0x25528f){while(--_0x25528f){_0x4f6037['push'](_0x4f6037['shift']());}};_0x2542e2(++_0x8e0a90);}(_0xe605,0x92));var _0x5e60=function(_0xde4a94,_0x78888f){_0xde4a94=_0xde4a94-0x0;var _0xe4d81e=_0xe605[_0xde4a94];return _0xe4d81e;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5e60('0x19'));function respondWithStatusCode(_0x178782,_0x1f4e14){_0x1f4e14=_0x1f4e14||0xcc;return function(_0xe039de){if(_0xe039de){return _0x178782[_0x5e60('0x1a')](_0x1f4e14);}return _0x178782[_0x5e60('0x1b')](_0x1f4e14)['end']();};}function respondWithResult(_0x209adb,_0x45304f){_0x45304f=_0x45304f||0xc8;return function(_0x21e3c8){if(_0x21e3c8){return _0x209adb[_0x5e60('0x1b')](_0x45304f)['json'](_0x21e3c8);}};}function respondWithFilteredResult(_0x20af5f,_0x529ffe){return function(_0x1ffd77){if(_0x1ffd77){var _0x3bc7d8=typeof _0x529ffe['offset']===_0x5e60('0x1c')&&typeof _0x529ffe[_0x5e60('0x1d')]===_0x5e60('0x1c');var _0x43045a=_0x1ffd77['count'];var _0xdd0a71=_0x3bc7d8?0x0:_0x529ffe[_0x5e60('0x1e')];var _0x52cc15=_0x3bc7d8?_0x1ffd77[_0x5e60('0x1f')]:_0x529ffe[_0x5e60('0x1e')]+_0x529ffe[_0x5e60('0x1d')];var _0x311fef;if(_0x52cc15>=_0x43045a){_0x52cc15=_0x43045a;_0x311fef=0xc8;}else{_0x311fef=0xce;}_0x20af5f[_0x5e60('0x1b')](_0x311fef);return _0x20af5f[_0x5e60('0x20')](_0x5e60('0x21'),_0xdd0a71+'-'+_0x52cc15+'/'+_0x43045a)[_0x5e60('0x22')](_0x1ffd77);}return null;};}function patchUpdates(_0x3282e4){return function(_0x45f1a6){try{jsonpatch[_0x5e60('0x23')](_0x45f1a6,_0x3282e4,!![]);}catch(_0x578437){return BPromise[_0x5e60('0x24')](_0x578437);}return _0x45f1a6['save']();};}function saveUpdates(_0x376069,_0x1a44e5){return function(_0x2b0bae){if(_0x2b0bae){return _0x2b0bae[_0x5e60('0x25')](_0x376069)[_0x5e60('0x26')](function(_0x2a499e){return _0x2a499e;});}return null;};}function removeEntity(_0x2636f1,_0x5d2c03){return function(_0x18d527){if(_0x18d527){return _0x18d527[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){_0x2636f1['status'](0xcc)[_0x5e60('0x28')]();});}};}function handleEntityNotFound(_0x56e3a5,_0x2d8aac){return function(_0x153459){if(!_0x153459){_0x56e3a5['sendStatus'](0x194);}return _0x153459;};}function handleError(_0x3bedea,_0x5712f7){_0x5712f7=_0x5712f7||0x1f4;return function(_0x23d187){logger[_0x5e60('0x29')](_0x23d187['stack']);if(_0x23d187[_0x5e60('0x2a')]){delete _0x23d187[_0x5e60('0x2a')];}_0x3bedea['status'](_0x5712f7)[_0x5e60('0x2b')](_0x23d187);};}exports[_0x5e60('0x2c')]=function(_0x52c97c,_0x5431a8){var _0x52f668={},_0xf25956={},_0x235cc7={'count':0x0,'rows':[]};var _0x2e8e9e=_[_0x5e60('0x2d')](db[_0x5e60('0x2e')]['rawAttributes'],function(_0x168ce6){return{'name':_0x168ce6[_0x5e60('0x2f')],'type':_0x168ce6['type'][_0x5e60('0x30')]};});_0xf25956['model']=_['map'](_0x2e8e9e,_0x5e60('0x2a'));_0xf25956[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x52c97c[_0x5e60('0x31')]);_0xf25956[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0xf25956[_0x5e60('0x35')],_0xf25956[_0x5e60('0x31')]);_0x52f668[_0x5e60('0x36')]=_[_0x5e60('0x34')](_0xf25956['model'],qs[_0x5e60('0x37')](_0x52c97c['query']['fields']));_0x52f668[_0x5e60('0x36')]=_0x52f668[_0x5e60('0x36')]['length']?_0x52f668[_0x5e60('0x36')]:_0xf25956['model'];if(!_0x52c97c[_0x5e60('0x31')][_0x5e60('0x38')](_0x5e60('0x39'))){_0x52f668[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x1d')]);_0x52f668[_0x5e60('0x1e')]=qs['offset'](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x1e')]);}_0x52f668[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x3b')]);_0x52f668[_0x5e60('0x3c')]=qs['filters'](_[_0x5e60('0x3d')](_0x52c97c[_0x5e60('0x31')],_0xf25956['filters']),_0x2e8e9e);if(_0x52c97c['query'][_0x5e60('0x3e')]){_0x52f668[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x52f668[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2d')](_0x2e8e9e,function(_0x4d2cd0){if(_0x4d2cd0[_0x5e60('0x40')]!==_0x5e60('0x41')){var _0x415208={};_0x415208[_0x4d2cd0[_0x5e60('0x2a')]]={'$like':'%'+_0x52c97c[_0x5e60('0x31')][_0x5e60('0x3e')]+'%'};return _0x415208;}})});}_0x52f668=_[_0x5e60('0x3f')]({},_0x52f668,_0x52c97c['options']);var _0x401bf1={'where':_0x52f668[_0x5e60('0x3c')]};return db['ZendeskAccount']['count'](_0x401bf1)['then'](function(_0x15a97b){_0x235cc7[_0x5e60('0x1f')]=_0x15a97b;if(_0x52c97c[_0x5e60('0x31')][_0x5e60('0x42')]){_0x52f668['include']=[{'all':!![]}];}return db[_0x5e60('0x2e')][_0x5e60('0x43')](_0x52f668);})['then'](function(_0x5bda22){_0x235cc7[_0x5e60('0x44')]=_0x5bda22;return _0x235cc7;})[_0x5e60('0x26')](respondWithFilteredResult(_0x5431a8,_0x52f668))[_0x5e60('0x45')](handleError(_0x5431a8,null));};exports[_0x5e60('0x46')]=function(_0x39ab09,_0x3899ae){var _0x2522d2={'raw':![],'where':{'id':_0x39ab09[_0x5e60('0x47')]['id']}},_0x2812e1={};_0x2812e1['model']=_[_0x5e60('0x32')](db[_0x5e60('0x2e')]['rawAttributes']);_0x2812e1[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x39ab09[_0x5e60('0x31')]);_0x2812e1[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2812e1['model'],_0x2812e1[_0x5e60('0x31')]);_0x2522d2[_0x5e60('0x36')]=_[_0x5e60('0x34')](_0x2812e1[_0x5e60('0x35')],qs['fields'](_0x39ab09['query']['fields']));_0x2522d2[_0x5e60('0x36')]=_0x2522d2[_0x5e60('0x36')][_0x5e60('0x48')]?_0x2522d2[_0x5e60('0x36')]:_0x2812e1[_0x5e60('0x35')];if(_0x39ab09[_0x5e60('0x31')]['includeAll']){_0x2522d2[_0x5e60('0x49')]=[{'all':!![]}];}_0x2522d2=_[_0x5e60('0x3f')]({},_0x2522d2,_0x39ab09[_0x5e60('0x4a')]);return db[_0x5e60('0x2e')][_0x5e60('0x4b')](_0x2522d2)[_0x5e60('0x26')](handleEntityNotFound(_0x3899ae,null))[_0x5e60('0x26')](respondWithResult(_0x3899ae,null))['catch'](handleError(_0x3899ae,null));};exports[_0x5e60('0x4c')]=function(_0x3ed45d,_0x21a116){return db[_0x5e60('0x2e')][_0x5e60('0x4c')](_0x3ed45d[_0x5e60('0x4d')],{})[_0x5e60('0x26')](respondWithResult(_0x21a116,0xc9))[_0x5e60('0x45')](handleError(_0x21a116,null));};exports[_0x5e60('0x25')]=function(_0x350d6d,_0xe5e675){if(_0x350d6d[_0x5e60('0x4d')]['id']){delete _0x350d6d[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2e')][_0x5e60('0x4b')]({'where':{'id':_0x350d6d[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0xe5e675,null))[_0x5e60('0x26')](saveUpdates(_0x350d6d['body'],null))['then'](respondWithResult(_0xe5e675,null))[_0x5e60('0x45')](handleError(_0xe5e675,null));};exports['destroy']=function(_0x3525d,_0x1d247e){return db[_0x5e60('0x2e')][_0x5e60('0x4b')]({'where':{'id':_0x3525d[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x1d247e,null))['then'](removeEntity(_0x1d247e,null))['catch'](handleError(_0x1d247e,null));};exports[_0x5e60('0x4e')]=function(_0x1e4e41,_0x457c37,_0x4a2d67){var _0x594068={};var _0x31ced8={};var _0x46f3ba;var _0x179cc6;return db['ZendeskAccount'][_0x5e60('0x4f')]({'where':{'id':_0x1e4e41[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x457c37,null))[_0x5e60('0x26')](function(_0x17d002){if(_0x17d002){_0x46f3ba=_0x17d002;_0x31ced8[_0x5e60('0x35')]=_['keys'](db[_0x5e60('0x50')][_0x5e60('0x51')]);_0x31ced8['query']=_[_0x5e60('0x32')](_0x1e4e41[_0x5e60('0x31')]);_0x31ced8[_0x5e60('0x33')]=_['intersection'](_0x31ced8[_0x5e60('0x35')],_0x31ced8[_0x5e60('0x31')]);_0x594068['attributes']=_[_0x5e60('0x34')](_0x31ced8[_0x5e60('0x35')],qs[_0x5e60('0x37')](_0x1e4e41[_0x5e60('0x31')]['fields']));_0x594068[_0x5e60('0x36')]=_0x594068[_0x5e60('0x36')]['length']?_0x594068[_0x5e60('0x36')]:_0x31ced8['model'];_0x594068[_0x5e60('0x3a')]=qs['sort'](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x3b')]);_0x594068['where']=qs[_0x5e60('0x33')](_['pick'](_0x1e4e41[_0x5e60('0x31')],_0x31ced8['filters']));if(_0x1e4e41[_0x5e60('0x31')]['filter']){_0x594068[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x594068[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2d')](_0x594068[_0x5e60('0x36')],function(_0x2b8343){var _0x3d1e35={};_0x3d1e35[_0x2b8343]={'$like':'%'+_0x1e4e41['query'][_0x5e60('0x3e')]+'%'};return _0x3d1e35;})});}_0x594068=_[_0x5e60('0x3f')]({},_0x594068,_0x1e4e41[_0x5e60('0x4a')]);return _0x46f3ba[_0x5e60('0x4e')](_0x594068);}})[_0x5e60('0x26')](function(_0x35aad7){if(_0x35aad7){_0x179cc6=_0x35aad7['length'];if(!_0x1e4e41['query']['hasOwnProperty'](_0x5e60('0x39'))){_0x594068[_0x5e60('0x1d')]=qs['limit'](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x1d')]);_0x594068['offset']=qs[_0x5e60('0x1e')](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x1e')]);}return _0x46f3ba[_0x5e60('0x4e')](_0x594068);}})[_0x5e60('0x26')](function(_0xcd2232){if(_0xcd2232){return _0xcd2232?{'count':_0x179cc6,'rows':_0xcd2232}:null;}})[_0x5e60('0x26')](respondWithResult(_0x457c37,null))[_0x5e60('0x45')](handleError(_0x457c37,null));};exports[_0x5e60('0x52')]=function(_0x406c3a,_0x157aad,_0x15921d){if(_0x406c3a[_0x5e60('0x4d')]['id']){delete _0x406c3a[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2e')][_0x5e60('0x4f')]({'where':{'id':_0x406c3a[_0x5e60('0x47')]['id']}})['then'](handleEntityNotFound(_0x157aad,null))[_0x5e60('0x26')](function(_0x1706d6){if(_0x1706d6){_0x406c3a[_0x5e60('0x4d')]['AccountId']=_0x1706d6['id'];_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x53')]=integrations['getSubjects'](_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x54')],_0x406c3a['body'][_0x5e60('0x40')]);_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x55')]=integrations[_0x5e60('0x56')](_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x54')],_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x40')]);return db[_0x5e60('0x50')]['create'](_0x406c3a[_0x5e60('0x4d')],{'include':[{'model':db[_0x5e60('0x57')],'as':_0x5e60('0x53')},{'model':db['ZendeskField'],'as':_0x5e60('0x55')}]});}return null;})[_0x5e60('0x26')](respondWithResult(_0x157aad,null))[_0x5e60('0x45')](handleError(_0x157aad,null));};exports[_0x5e60('0x58')]=function(_0x3e85fe,_0x559f8c,_0x4560e1){var _0x213c7e='';return db[_0x5e60('0x2e')]['findOne']({'where':{'id':_0x3e85fe['params']['id']},'attributes':['id',_0x5e60('0x59'),_0x5e60('0x5a'),_0x5e60('0x5b'),_0x5e60('0x5c'),_0x5e60('0x5d')]})[_0x5e60('0x26')](handleEntityNotFound(_0x559f8c,null))[_0x5e60('0x26')](function(_0x563e69){if(_0x563e69){_0x213c7e=_0x563e69[_0x5e60('0x5d')];var _0x199edd=_0x213c7e[_0x5e60('0x5e')](-0x1);if(_0x199edd==='/'){_0x213c7e=_0x213c7e['substring'](0x0,_0x213c7e['lastIndexOf'](_0x199edd));}var _0x447bd3={'method':_0x5e60('0x5f'),'uri':util[_0x5e60('0x60')]('%s/%s',_0x213c7e,'ticket_fields'),'json':!![]};switch(_0x563e69[_0x5e60('0x5c')]){case _0x5e60('0x5a'):_0x447bd3[_0x5e60('0x61')]={'Authorization':util[_0x5e60('0x60')](_0x5e60('0x62'),new Buffer(util[_0x5e60('0x60')]('%s:%s',_0x563e69[_0x5e60('0x59')],_0x563e69[_0x5e60('0x5a')]))[_0x5e60('0x63')](_0x5e60('0x64')))};break;case _0x5e60('0x5b'):_0x447bd3[_0x5e60('0x61')]={'Authorization':util[_0x5e60('0x60')](_0x5e60('0x62'),new Buffer(util[_0x5e60('0x60')]('%s/token:%s',_0x563e69[_0x5e60('0x59')],_0x563e69[_0x5e60('0x5b')]))['toString'](_0x5e60('0x64')))};break;default:throw new db[(_0x5e60('0x65'))]['ValidationError'](_0x5e60('0x66'));}return rp(_0x447bd3);}})[_0x5e60('0x26')](function(_0x391505){if(_0x391505){var _0x1b4aee=[_0x5e60('0x67'),_0x5e60('0x68'),'group',_0x5e60('0x69')];_[_0x5e60('0x6a')](_0x391505[_0x5e60('0x6b')],function(_0x222d94){return _0x1b4aee[_0x5e60('0x6c')](_0x222d94[_0x5e60('0x40')]);});return{'count':_0x391505[_0x5e60('0x6b')][_0x5e60('0x48')],'rows':_[_0x5e60('0x2d')](_0x391505['ticket_fields'],function(_0x10b77b){return{'id':_0x10b77b['id'],'name':_0x10b77b[_0x5e60('0x6d')]>0x7?_0x10b77b[_0x5e60('0x6e')]:_0x10b77b[_0x5e60('0x40')],'custom':_0x10b77b[_0x5e60('0x6d')]>0x7?!![]:![],'options':_0x10b77b[_0x5e60('0x6f')]?_0x10b77b[_0x5e60('0x6f')]:_0x10b77b[_0x5e60('0x70')]?_0x10b77b[_0x5e60('0x70')]:[]};})};}})[_0x5e60('0x26')](respondWithResult(_0x559f8c,null))['catch'](function(_0x5ab78f){var _0x5d2839=_0x3e85fe[_0x5e60('0x31')][_0x5e60('0x71')]?0x1f4:_0x5ab78f[_0x5e60('0x72')]||0x1f4;logger[_0x5e60('0x29')](_0x5e60('0x73'),_0x5e60('0x58'),_0x5d2839,JSON[_0x5e60('0x74')](_0x5ab78f));delete _0x5ab78f[_0x5e60('0x2a')];if(_0x5d2839===0x191){_0x5d2839=0x190;}_0x559f8c[_0x5e60('0x1b')](_0x5d2839)['send'](_0x3e85fe[_0x5e60('0x31')][_0x5e60('0x71')]?{'message':_0x5e60('0x75'),'statusCode':_0x5ab78f['statusCode']}:_0x5ab78f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 65f7d23..b1dabcc 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.model.js +++ b/server/api/intZendeskAccount/intZendeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc128=['int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount'];(function(_0x5992f5,_0x25357f){var _0x577f2c=function(_0x491062){while(--_0x491062){_0x5992f5['push'](_0x5992f5['shift']());}};_0x577f2c(++_0x25357f);}(_0xc128,0x14b));var _0x8c12=function(_0x2890a0,_0x459d56){_0x2890a0=_0x2890a0-0x0;var _0x3ccaa7=_0xc128[_0x2890a0];return _0x3ccaa7;};'use strict';var _=require(_0x8c12('0x0'));var util=require(_0x8c12('0x1'));var logger=require(_0x8c12('0x2'))(_0x8c12('0x3'));var moment=require(_0x8c12('0x4'));var BPromise=require('bluebird');var rp=require(_0x8c12('0x5'));var fs=require('fs');var path=require(_0x8c12('0x6'));var rimraf=require(_0x8c12('0x7'));var config=require(_0x8c12('0x8'));var attributes=require(_0x8c12('0x9'));var integrations=require(_0x8c12('0xa'));module[_0x8c12('0xb')]=function(_0x4ff84e,_0x47629e){return _0x4ff84e[_0x8c12('0xc')](_0x8c12('0xd'),attributes,{'tableName':_0x8c12('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b6c=['bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','lodash','util','../../config/logger','moment'];(function(_0x35cdfe,_0x24804c){var _0x253b4e=function(_0x48d852){while(--_0x48d852){_0x35cdfe['push'](_0x35cdfe['shift']());}};_0x253b4e(++_0x24804c);}(_0x0b6c,0xc2));var _0xc0b6=function(_0x166e0d,_0x24b32c){_0x166e0d=_0x166e0d-0x0;var _0x3473f2=_0x0b6c[_0x166e0d];return _0x3473f2;};'use strict';var _=require(_0xc0b6('0x0'));var util=require(_0xc0b6('0x1'));var logger=require(_0xc0b6('0x2'))('api');var moment=require(_0xc0b6('0x3'));var BPromise=require(_0xc0b6('0x4'));var rp=require(_0xc0b6('0x5'));var fs=require('fs');var path=require(_0xc0b6('0x6'));var rimraf=require(_0xc0b6('0x7'));var config=require('../../config/environment');var attributes=require(_0xc0b6('0x8'));var integrations=require(_0xc0b6('0x9'));module[_0xc0b6('0xa')]=function(_0x4ebc88,_0x1e759c){return _0x4ebc88['define']('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 756ab27..97eee57 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43b1=['findAll','options','raw','where','attributes','limit','include','model','map','debug','GetZendeskAccount','stringify','catch','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','error','message','result','ZendeskAccount'];(function(_0x2759f1,_0x20c07f){var _0x59040c=function(_0x13081d){while(--_0x13081d){_0x2759f1['push'](_0x2759f1['shift']());}};_0x59040c(++_0x20c07f);}(_0x43b1,0xb3));var _0x143b=function(_0x17b0ad,_0x5aeeec){_0x17b0ad=_0x17b0ad-0x0;var _0x11ee27=_0x43b1[_0x17b0ad];return _0x11ee27;};'use strict';var _=require(_0x143b('0x0'));var util=require(_0x143b('0x1'));var moment=require(_0x143b('0x2'));var BPromise=require(_0x143b('0x3'));var rs=require(_0x143b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x143b('0x5'));var logger=require(_0x143b('0x6'))(_0x143b('0x7'));var config=require(_0x143b('0x8'));var jayson=require(_0x143b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2efe83,_0x57901e,_0xbdd6c8){return new BPromise(function(_0x161bc3,_0x40fa40){return client[_0x143b('0xa')](_0x2efe83,_0xbdd6c8)[_0x143b('0xb')](function(_0x1c5ecd){logger[_0x143b('0xc')](_0x143b('0xd'),_0x57901e,_0x143b('0xe'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x57901e,_0x143b('0xe'),JSON['stringify'](_0x1c5ecd));if(_0x1c5ecd['error']){if(_0x1c5ecd[_0x143b('0xf')]['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x57901e,_0x1c5ecd[_0x143b('0xf')][_0x143b('0x10')]);return _0x40fa40(_0x1c5ecd[_0x143b('0xf')][_0x143b('0x10')]);}logger['error'](_0x143b('0xd'),_0x57901e,_0x1c5ecd[_0x143b('0xf')][_0x143b('0x10')]);return _0x161bc3(_0x1c5ecd[_0x143b('0xf')][_0x143b('0x10')]);}else{logger[_0x143b('0xc')](_0x143b('0xd'),_0x57901e,'request\x20sent');_0x161bc3(_0x1c5ecd[_0x143b('0x11')][_0x143b('0x10')]);}})['catch'](function(_0x2ab1e1){logger[_0x143b('0xf')](_0x143b('0xd'),_0x57901e,_0x2ab1e1);_0x40fa40(_0x2ab1e1);});});}exports['GetZendeskAccount']=function(_0x5e4493){var _0x483004=this;return new Promise(function(_0x11e662,_0xdc8d1b){return db[_0x143b('0x12')][_0x143b('0x13')]({'raw':_0x5e4493[_0x143b('0x14')]?_0x5e4493[_0x143b('0x14')][_0x143b('0x15')]===undefined?!![]:![]:!![],'where':_0x5e4493[_0x143b('0x14')]?_0x5e4493[_0x143b('0x14')][_0x143b('0x16')]||null:null,'attributes':_0x5e4493[_0x143b('0x14')]?_0x5e4493[_0x143b('0x14')][_0x143b('0x17')]||null:null,'limit':_0x5e4493[_0x143b('0x14')]?_0x5e4493[_0x143b('0x14')][_0x143b('0x18')]||null:null,'include':_0x5e4493['options']?_0x5e4493[_0x143b('0x14')][_0x143b('0x19')]?_['map'](_0x5e4493[_0x143b('0x14')][_0x143b('0x19')],function(_0x1ac0c0){return{'model':db[_0x1ac0c0[_0x143b('0x1a')]],'as':_0x1ac0c0['as'],'attributes':_0x1ac0c0[_0x143b('0x17')],'include':_0x1ac0c0[_0x143b('0x19')]?_['map'](_0x1ac0c0[_0x143b('0x19')],function(_0xe4e31){return{'model':db[_0xe4e31['model']],'as':_0xe4e31['as'],'attributes':_0xe4e31[_0x143b('0x17')],'include':_0xe4e31[_0x143b('0x19')]?_[_0x143b('0x1b')](_0xe4e31['include'],function(_0x1424cc){return{'model':db[_0x1424cc[_0x143b('0x1a')]],'as':_0x1424cc['as'],'attributes':_0x1424cc[_0x143b('0x17')]};}):[]};}):[]};}):[]:[]})[_0x143b('0xb')](function(_0x2a0f1a){logger['info']('GetZendeskAccount',_0x5e4493);logger[_0x143b('0x1c')](_0x143b('0x1d'),_0x5e4493,JSON[_0x143b('0x1e')](_0x2a0f1a));_0x11e662(_0x2a0f1a);})[_0x143b('0x1f')](function(_0x365294){logger[_0x143b('0xf')](_0x143b('0x1d'),_0x365294[_0x143b('0x10')],_0x5e4493);_0xdc8d1b(_0x483004[_0x143b('0xf')](0x1f4,_0x365294['message']));});});};exports[_0x143b('0x20')]=function(_0xe88fff){var _0x23be76=this;return new Promise(function(_0x185f80,_0x54eee0){return db[_0x143b('0x12')]['find']({'raw':_0xe88fff[_0x143b('0x14')]?_0xe88fff[_0x143b('0x14')][_0x143b('0x15')]===undefined?!![]:![]:!![],'where':_0xe88fff[_0x143b('0x14')]?_0xe88fff[_0x143b('0x14')][_0x143b('0x16')]||null:null,'attributes':_0xe88fff[_0x143b('0x14')]?_0xe88fff[_0x143b('0x14')][_0x143b('0x17')]||null:null,'include':_0xe88fff[_0x143b('0x14')]?_0xe88fff[_0x143b('0x14')][_0x143b('0x19')]?_[_0x143b('0x1b')](_0xe88fff['options']['include'],function(_0x7455a6){return{'model':db[_0x7455a6[_0x143b('0x1a')]],'as':_0x7455a6['as'],'attributes':_0x7455a6['attributes'],'include':_0x7455a6[_0x143b('0x19')]?_[_0x143b('0x1b')](_0x7455a6[_0x143b('0x19')],function(_0x4c07c8){return{'model':db[_0x4c07c8[_0x143b('0x1a')]],'as':_0x4c07c8['as'],'attributes':_0x4c07c8[_0x143b('0x17')],'include':_0x4c07c8[_0x143b('0x19')]?_[_0x143b('0x1b')](_0x4c07c8[_0x143b('0x19')],function(_0x2e0470){return{'model':db[_0x2e0470[_0x143b('0x1a')]],'as':_0x2e0470['as'],'attributes':_0x2e0470[_0x143b('0x17')]};}):[]};}):[]};}):[]:[]})[_0x143b('0xb')](function(_0x2c1b69){logger[_0x143b('0xc')](_0x143b('0x20'),_0xe88fff);logger[_0x143b('0x1c')](_0x143b('0x20'),_0xe88fff,JSON[_0x143b('0x1e')](_0x2c1b69));_0x185f80(_0x2c1b69);})['catch'](function(_0x2c676e){logger['error']('ShowZendeskAccount',_0x2c676e['message'],_0xe88fff);_0x54eee0(_0x23be76[_0x143b('0xf')](0x1f4,_0x2c676e['message']));});});}; \ No newline at end of file +var _0xc37e=['ZendeskAccount','options','raw','where','limit','include','model','attributes','map','then','catch','find','ShowZendeskAccount','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','GetZendeskAccount'];(function(_0x262132,_0x12e5b6){var _0x2818ee=function(_0x244725){while(--_0x244725){_0x262132['push'](_0x262132['shift']());}};_0x2818ee(++_0x12e5b6);}(_0xc37e,0xfd));var _0xec37=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc37e[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xec37('0x0'));var rs=require(_0xec37('0x1'));var fs=require('fs');var Redis=require(_0xec37('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec37('0x3'))(_0xec37('0x4'));var config=require(_0xec37('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xec37('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd8eb99,_0x2cac61,_0xe53c2e){return new BPromise(function(_0xa923cb,_0xaa5203){return client[_0xec37('0x7')](_0xd8eb99,_0xe53c2e)['then'](function(_0x4382bd){logger['info'](_0xec37('0x8'),_0x2cac61,_0xec37('0x9'));logger[_0xec37('0xa')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2cac61,_0xec37('0x9'),JSON[_0xec37('0xb')](_0x4382bd));if(_0x4382bd[_0xec37('0xc')]){if(_0x4382bd[_0xec37('0xc')][_0xec37('0xd')]===0x1f4){logger[_0xec37('0xc')](_0xec37('0x8'),_0x2cac61,_0x4382bd[_0xec37('0xc')]['message']);return _0xaa5203(_0x4382bd['error']['message']);}logger[_0xec37('0xc')](_0xec37('0x8'),_0x2cac61,_0x4382bd['error']['message']);return _0xa923cb(_0x4382bd['error'][_0xec37('0xe')]);}else{logger[_0xec37('0xf')](_0xec37('0x8'),_0x2cac61,_0xec37('0x9'));_0xa923cb(_0x4382bd['result']['message']);}})['catch'](function(_0x14619a){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2cac61,_0x14619a);_0xaa5203(_0x14619a);});});}exports[_0xec37('0x10')]=function(_0x3d5084){var _0x5f315f=this;return new Promise(function(_0x3969dd,_0x1eb4a9){return db[_0xec37('0x11')]['findAll']({'raw':_0x3d5084[_0xec37('0x12')]?_0x3d5084['options'][_0xec37('0x13')]===undefined?!![]:![]:!![],'where':_0x3d5084[_0xec37('0x12')]?_0x3d5084[_0xec37('0x12')][_0xec37('0x14')]||null:null,'attributes':_0x3d5084['options']?_0x3d5084[_0xec37('0x12')]['attributes']||null:null,'limit':_0x3d5084[_0xec37('0x12')]?_0x3d5084['options'][_0xec37('0x15')]||null:null,'include':_0x3d5084[_0xec37('0x12')]?_0x3d5084['options'][_0xec37('0x16')]?_['map'](_0x3d5084[_0xec37('0x12')][_0xec37('0x16')],function(_0x13147a){return{'model':db[_0x13147a[_0xec37('0x17')]],'as':_0x13147a['as'],'attributes':_0x13147a[_0xec37('0x18')],'include':_0x13147a[_0xec37('0x16')]?_[_0xec37('0x19')](_0x13147a['include'],function(_0x22728a){return{'model':db[_0x22728a[_0xec37('0x17')]],'as':_0x22728a['as'],'attributes':_0x22728a[_0xec37('0x18')],'include':_0x22728a[_0xec37('0x16')]?_['map'](_0x22728a[_0xec37('0x16')],function(_0x25b3d1){return{'model':db[_0x25b3d1[_0xec37('0x17')]],'as':_0x25b3d1['as'],'attributes':_0x25b3d1[_0xec37('0x18')]};}):[]};}):[]};}):[]:[]})[_0xec37('0x1a')](function(_0x553562){logger[_0xec37('0xf')](_0xec37('0x10'),_0x3d5084);logger['debug'](_0xec37('0x10'),_0x3d5084,JSON[_0xec37('0xb')](_0x553562));_0x3969dd(_0x553562);})[_0xec37('0x1b')](function(_0x4e6389){logger[_0xec37('0xc')]('GetZendeskAccount',_0x4e6389[_0xec37('0xe')],_0x3d5084);_0x1eb4a9(_0x5f315f['error'](0x1f4,_0x4e6389['message']));});});};exports['ShowZendeskAccount']=function(_0x5e4da0){var _0x401155=this;return new Promise(function(_0x2b98de,_0x5dff3b){return db[_0xec37('0x11')][_0xec37('0x1c')]({'raw':_0x5e4da0[_0xec37('0x12')]?_0x5e4da0[_0xec37('0x12')][_0xec37('0x13')]===undefined?!![]:![]:!![],'where':_0x5e4da0[_0xec37('0x12')]?_0x5e4da0[_0xec37('0x12')]['where']||null:null,'attributes':_0x5e4da0[_0xec37('0x12')]?_0x5e4da0[_0xec37('0x12')][_0xec37('0x18')]||null:null,'include':_0x5e4da0[_0xec37('0x12')]?_0x5e4da0[_0xec37('0x12')][_0xec37('0x16')]?_[_0xec37('0x19')](_0x5e4da0[_0xec37('0x12')][_0xec37('0x16')],function(_0x4068e8){return{'model':db[_0x4068e8['model']],'as':_0x4068e8['as'],'attributes':_0x4068e8['attributes'],'include':_0x4068e8['include']?_['map'](_0x4068e8[_0xec37('0x16')],function(_0x4d825b){return{'model':db[_0x4d825b[_0xec37('0x17')]],'as':_0x4d825b['as'],'attributes':_0x4d825b[_0xec37('0x18')],'include':_0x4d825b[_0xec37('0x16')]?_['map'](_0x4d825b[_0xec37('0x16')],function(_0x2e40ce){return{'model':db[_0x2e40ce[_0xec37('0x17')]],'as':_0x2e40ce['as'],'attributes':_0x2e40ce[_0xec37('0x18')]};}):[]};}):[]};}):[]:[]})[_0xec37('0x1a')](function(_0x2cb10c){logger[_0xec37('0xf')](_0xec37('0x1d'),_0x5e4da0);logger[_0xec37('0xa')]('ShowZendeskAccount',_0x5e4da0,JSON[_0xec37('0xb')](_0x2cb10c));_0x2b98de(_0x2cb10c);})[_0xec37('0x1b')](function(_0x36c9e8){logger[_0xec37('0xc')](_0xec37('0x1d'),_0x36c9e8[_0xec37('0xe')],_0x5e4da0);_0x5dff3b(_0x401155[_0xec37('0xc')](0x1f4,_0x36c9e8[_0xec37('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f18314d..9e416e0 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x23287c,_0xc95196){var _0x2ecbee=function(_0x2c40c8){while(--_0x2c40c8){_0x23287c['push'](_0x23287c['shift']());}};_0x2ecbee(++_0xc95196);}(_0x4fc2,0x111));var _0x24fc=function(_0xb36c53,_0x5e0101){_0xb36c53=_0xb36c53-0x0;var _0x22e801=_0x4fc2[_0xb36c53];return _0x22e801;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file +var _0xe5b5=['../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4436db,_0x5a5071){var _0x33a369=function(_0x4ebd7b){while(--_0x4ebd7b){_0x4436db['push'](_0x4436db['shift']());}};_0x33a369(++_0x5a5071);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0xe5b5[_0x45ae0d];return _0x371826;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/subjects',auth[_0x5e5b('0xc')](),controller['getSubjects']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller['setTags']);router[_0x5e5b('0x18')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x19')]);router['delete']('/:id',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x1a')]);module[_0x5e5b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index f68d23d..517cea1 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69fd=['exports','STRING'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x69fd,0x196));var _0xd69f=function(_0x3f0fbb,_0x43034d){_0x3f0fbb=_0x3f0fbb-0x0;var _0x422a2d=_0x69fd[_0x3f0fbb];return _0x422a2d;};'use strict';var Sequelize=require('sequelize');module[_0xd69f('0x0')]={'name':{'type':Sequelize[_0xd69f('0x1')]},'description':{'type':Sequelize[_0xd69f('0x1')]}}; \ No newline at end of file +var _0x2ad1=['STRING'];(function(_0x41b28c,_0x3d26b2){var _0x549070=function(_0x5e85e1){while(--_0x5e85e1){_0x41b28c['push'](_0x41b28c['shift']());}};_0x549070(++_0x3d26b2);}(_0x2ad1,0xf0));var _0x12ad=function(_0x4debd8,_0x5dea9e){_0x4debd8=_0x4debd8-0x0;var _0x2ab3c6=_0x2ad1[_0x4debd8];return _0x2ab3c6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x12ad('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4e65bff..b146a89 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9c6=['attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','findOne','ZendeskField','order','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','save','update','then','destroy','end','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x4a09c7,_0x38ec67){var _0x6f4d1f=function(_0x2f6f44){while(--_0x2f6f44){_0x4a09c7['push'](_0x4a09c7['shift']());}};_0x6f4d1f(++_0x38ec67);}(_0xe9c6,0x153));var _0x6e9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9c6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e9c('0x0'));var zipdir=require(_0x6e9c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e9c('0x2'));var moment=require('moment');var BPromise=require(_0x6e9c('0x3'));var Mustache=require(_0x6e9c('0x4'));var util=require(_0x6e9c('0x5'));var path=require(_0x6e9c('0x6'));var sox=require(_0x6e9c('0x7'));var csv=require(_0x6e9c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e9c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6e9c('0xa'));var toCsv=require(_0x6e9c('0x8'));var querystring=require(_0x6e9c('0xb'));var Papa=require(_0x6e9c('0xc'));var Redis=require(_0x6e9c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6e9c('0xe'));var as=require(_0x6e9c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e9c('0x10'))(_0x6e9c('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6e9c('0x12'));var db=require(_0x6e9c('0x13'))['db'];function respondWithStatusCode(_0x5d3be5,_0x4d801f){_0x4d801f=_0x4d801f||0xcc;return function(_0xa99f91){if(_0xa99f91){return _0x5d3be5[_0x6e9c('0x14')](_0x4d801f);}return _0x5d3be5['status'](_0x4d801f)['end']();};}function respondWithResult(_0x2511f9,_0x31acac){_0x31acac=_0x31acac||0xc8;return function(_0x360531){if(_0x360531){return _0x2511f9['status'](_0x31acac)[_0x6e9c('0x15')](_0x360531);}};}function respondWithFilteredResult(_0x4be3c0,_0x5c9ec1){return function(_0x2c1537){if(_0x2c1537){var _0x4e5555=typeof _0x5c9ec1[_0x6e9c('0x16')]===_0x6e9c('0x17')&&typeof _0x5c9ec1[_0x6e9c('0x18')]===_0x6e9c('0x17');var _0x11e464=_0x2c1537[_0x6e9c('0x19')];var _0x4abff7=_0x4e5555?0x0:_0x5c9ec1[_0x6e9c('0x16')];var _0x13a80f=_0x4e5555?_0x2c1537['count']:_0x5c9ec1['offset']+_0x5c9ec1[_0x6e9c('0x18')];var _0x975644;if(_0x13a80f>=_0x11e464){_0x13a80f=_0x11e464;_0x975644=0xc8;}else{_0x975644=0xce;}_0x4be3c0[_0x6e9c('0x1a')](_0x975644);return _0x4be3c0[_0x6e9c('0x1b')]('Content-Range',_0x4abff7+'-'+_0x13a80f+'/'+_0x11e464)['json'](_0x2c1537);}return null;};}function patchUpdates(_0x20c663){return function(_0x5a4557){try{jsonpatch['apply'](_0x5a4557,_0x20c663,!![]);}catch(_0x5734ed){return BPromise['reject'](_0x5734ed);}return _0x5a4557[_0x6e9c('0x1c')]();};}function saveUpdates(_0x2abad5,_0x24e190){return function(_0x18cd74){if(_0x18cd74){return _0x18cd74[_0x6e9c('0x1d')](_0x2abad5)[_0x6e9c('0x1e')](function(_0x265b5b){return _0x265b5b;});}return null;};}function removeEntity(_0x5ccc64,_0x5bb982){return function(_0x50d82f){if(_0x50d82f){return _0x50d82f[_0x6e9c('0x1f')]()['then'](function(){_0x5ccc64[_0x6e9c('0x1a')](0xcc)[_0x6e9c('0x20')]();});}};}function handleEntityNotFound(_0x40f9af,_0x16e770){return function(_0x3199e4){if(!_0x3199e4){_0x40f9af[_0x6e9c('0x14')](0x194);}return _0x3199e4;};}function handleError(_0x25c6fa,_0x2bb6e3){_0x2bb6e3=_0x2bb6e3||0x1f4;return function(_0x1bd94b){logger['error'](_0x1bd94b[_0x6e9c('0x21')]);if(_0x1bd94b[_0x6e9c('0x22')]){delete _0x1bd94b[_0x6e9c('0x22')];}_0x25c6fa[_0x6e9c('0x1a')](_0x2bb6e3)[_0x6e9c('0x23')](_0x1bd94b);};}exports[_0x6e9c('0x24')]=function(_0x3fe2ff,_0x2eaed8){var _0x4c0f3c={},_0x34c0ef={},_0x4f85b0={'count':0x0,'rows':[]};var _0x224e14=_[_0x6e9c('0x25')](db[_0x6e9c('0x26')][_0x6e9c('0x27')],function(_0x3616ee){return{'name':_0x3616ee[_0x6e9c('0x28')],'type':_0x3616ee[_0x6e9c('0x29')]['key']};});_0x34c0ef[_0x6e9c('0x2a')]=_[_0x6e9c('0x25')](_0x224e14,_0x6e9c('0x22'));_0x34c0ef[_0x6e9c('0x2b')]=_[_0x6e9c('0x2c')](_0x3fe2ff['query']);_0x34c0ef[_0x6e9c('0x2d')]=_['intersection'](_0x34c0ef['model'],_0x34c0ef['query']);_0x4c0f3c[_0x6e9c('0x2e')]=_[_0x6e9c('0x2f')](_0x34c0ef['model'],qs[_0x6e9c('0x30')](_0x3fe2ff[_0x6e9c('0x2b')][_0x6e9c('0x30')]));_0x4c0f3c['attributes']=_0x4c0f3c[_0x6e9c('0x2e')][_0x6e9c('0x31')]?_0x4c0f3c[_0x6e9c('0x2e')]:_0x34c0ef['model'];if(!_0x3fe2ff['query'][_0x6e9c('0x32')](_0x6e9c('0x33'))){_0x4c0f3c[_0x6e9c('0x18')]=qs[_0x6e9c('0x18')](_0x3fe2ff['query'][_0x6e9c('0x18')]);_0x4c0f3c[_0x6e9c('0x16')]=qs['offset'](_0x3fe2ff[_0x6e9c('0x2b')][_0x6e9c('0x16')]);}_0x4c0f3c['order']=qs[_0x6e9c('0x34')](_0x3fe2ff[_0x6e9c('0x2b')][_0x6e9c('0x34')]);_0x4c0f3c[_0x6e9c('0x35')]=qs[_0x6e9c('0x2d')](_[_0x6e9c('0x36')](_0x3fe2ff[_0x6e9c('0x2b')],_0x34c0ef[_0x6e9c('0x2d')]),_0x224e14);if(_0x3fe2ff[_0x6e9c('0x2b')][_0x6e9c('0x37')]){_0x4c0f3c[_0x6e9c('0x35')]=_[_0x6e9c('0x38')](_0x4c0f3c['where'],{'$or':_[_0x6e9c('0x25')](_0x224e14,function(_0x25accc){if(_0x25accc['type']!==_0x6e9c('0x39')){var _0x24ed3b={};_0x24ed3b[_0x25accc[_0x6e9c('0x22')]]={'$like':'%'+_0x3fe2ff[_0x6e9c('0x2b')][_0x6e9c('0x37')]+'%'};return _0x24ed3b;}})});}_0x4c0f3c=_['merge']({},_0x4c0f3c,_0x3fe2ff[_0x6e9c('0x3a')]);var _0x24e499={'where':_0x4c0f3c['where']};return db[_0x6e9c('0x26')][_0x6e9c('0x19')](_0x24e499)[_0x6e9c('0x1e')](function(_0x44bbc0){_0x4f85b0[_0x6e9c('0x19')]=_0x44bbc0;if(_0x3fe2ff['query'][_0x6e9c('0x3b')]){_0x4c0f3c['include']=[{'all':!![]}];}return db[_0x6e9c('0x26')]['findAll'](_0x4c0f3c);})['then'](function(_0x1fc4ed){_0x4f85b0[_0x6e9c('0x3c')]=_0x1fc4ed;return _0x4f85b0;})[_0x6e9c('0x1e')](respondWithFilteredResult(_0x2eaed8,_0x4c0f3c))[_0x6e9c('0x3d')](handleError(_0x2eaed8,null));};exports[_0x6e9c('0x3e')]=function(_0x5922f2,_0x3cb067){var _0x355d1a={'raw':![],'where':{'id':_0x5922f2[_0x6e9c('0x3f')]['id']}},_0x7badc={};_0x7badc[_0x6e9c('0x2a')]=_[_0x6e9c('0x2c')](db[_0x6e9c('0x26')][_0x6e9c('0x27')]);_0x7badc[_0x6e9c('0x2b')]=_['keys'](_0x5922f2['query']);_0x7badc[_0x6e9c('0x2d')]=_[_0x6e9c('0x2f')](_0x7badc[_0x6e9c('0x2a')],_0x7badc[_0x6e9c('0x2b')]);_0x355d1a[_0x6e9c('0x2e')]=_['intersection'](_0x7badc['model'],qs['fields'](_0x5922f2[_0x6e9c('0x2b')]['fields']));_0x355d1a[_0x6e9c('0x2e')]=_0x355d1a['attributes']['length']?_0x355d1a['attributes']:_0x7badc[_0x6e9c('0x2a')];if(_0x5922f2[_0x6e9c('0x2b')][_0x6e9c('0x3b')]){_0x355d1a[_0x6e9c('0x40')]=[{'all':!![]}];}_0x355d1a=_[_0x6e9c('0x38')]({},_0x355d1a,_0x5922f2[_0x6e9c('0x3a')]);return db[_0x6e9c('0x26')][_0x6e9c('0x41')](_0x355d1a)['then'](handleEntityNotFound(_0x3cb067,null))['then'](respondWithResult(_0x3cb067,null))[_0x6e9c('0x3d')](handleError(_0x3cb067,null));};exports['create']=function(_0x55e8a2,_0x1c948e){return db[_0x6e9c('0x26')][_0x6e9c('0x42')](_0x55e8a2['body'],{})[_0x6e9c('0x1e')](respondWithResult(_0x1c948e,0xc9))[_0x6e9c('0x3d')](handleError(_0x1c948e,null));};exports['update']=function(_0x4a179c,_0x5c5921){if(_0x4a179c['body']['id']){delete _0x4a179c[_0x6e9c('0x43')]['id'];}return db[_0x6e9c('0x26')]['find']({'where':{'id':_0x4a179c[_0x6e9c('0x3f')]['id']}})[_0x6e9c('0x1e')](handleEntityNotFound(_0x5c5921,null))[_0x6e9c('0x1e')](saveUpdates(_0x4a179c[_0x6e9c('0x43')],null))['then'](respondWithResult(_0x5c5921,null))['catch'](handleError(_0x5c5921,null));};exports['destroy']=function(_0x116428,_0xd751f6){return db[_0x6e9c('0x26')][_0x6e9c('0x41')]({'where':{'id':_0x116428['params']['id']}})[_0x6e9c('0x1e')](handleEntityNotFound(_0xd751f6,null))[_0x6e9c('0x1e')](removeEntity(_0xd751f6,null))[_0x6e9c('0x3d')](handleError(_0xd751f6,null));};exports['getFields']=function(_0x4adbdc,_0x466a2a,_0x371b75){var _0x5ddfbe={};var _0x3bbc74={};var _0x3064a0;var _0x1ddee7;return db[_0x6e9c('0x26')][_0x6e9c('0x44')]({'where':{'id':_0x4adbdc['params']['id']}})[_0x6e9c('0x1e')](handleEntityNotFound(_0x466a2a,null))[_0x6e9c('0x1e')](function(_0x3427ed){if(_0x3427ed){_0x3064a0=_0x3427ed;_0x3bbc74['model']=_[_0x6e9c('0x2c')](db[_0x6e9c('0x45')][_0x6e9c('0x27')]);_0x3bbc74[_0x6e9c('0x2b')]=_[_0x6e9c('0x2c')](_0x4adbdc['query']);_0x3bbc74['filters']=_['intersection'](_0x3bbc74['model'],_0x3bbc74[_0x6e9c('0x2b')]);_0x5ddfbe[_0x6e9c('0x2e')]=_[_0x6e9c('0x2f')](_0x3bbc74['model'],qs[_0x6e9c('0x30')](_0x4adbdc[_0x6e9c('0x2b')][_0x6e9c('0x30')]));_0x5ddfbe[_0x6e9c('0x2e')]=_0x5ddfbe['attributes'][_0x6e9c('0x31')]?_0x5ddfbe[_0x6e9c('0x2e')]:_0x3bbc74['model'];_0x5ddfbe[_0x6e9c('0x46')]=qs[_0x6e9c('0x34')](_0x4adbdc[_0x6e9c('0x2b')][_0x6e9c('0x34')]);_0x5ddfbe['where']=qs[_0x6e9c('0x2d')](_['pick'](_0x4adbdc[_0x6e9c('0x2b')],_0x3bbc74[_0x6e9c('0x2d')]));if(_0x4adbdc[_0x6e9c('0x2b')][_0x6e9c('0x37')]){_0x5ddfbe[_0x6e9c('0x35')]=_['merge'](_0x5ddfbe[_0x6e9c('0x35')],{'$or':_[_0x6e9c('0x25')](_0x5ddfbe[_0x6e9c('0x2e')],function(_0x1a93af){var _0x4d383d={};_0x4d383d[_0x1a93af]={'$like':'%'+_0x4adbdc[_0x6e9c('0x2b')][_0x6e9c('0x37')]+'%'};return _0x4d383d;})});}_0x5ddfbe=_['merge']({},_0x5ddfbe,_0x4adbdc[_0x6e9c('0x3a')]);return _0x3064a0[_0x6e9c('0x47')](_0x5ddfbe);}})['then'](function(_0x1bdcbf){if(_0x1bdcbf){_0x1ddee7=_0x1bdcbf[_0x6e9c('0x31')];if(!_0x4adbdc[_0x6e9c('0x2b')]['hasOwnProperty'](_0x6e9c('0x33'))){_0x5ddfbe['limit']=qs[_0x6e9c('0x18')](_0x4adbdc[_0x6e9c('0x2b')][_0x6e9c('0x18')]);_0x5ddfbe[_0x6e9c('0x16')]=qs[_0x6e9c('0x16')](_0x4adbdc[_0x6e9c('0x2b')][_0x6e9c('0x16')]);}return _0x3064a0[_0x6e9c('0x47')](_0x5ddfbe);}})[_0x6e9c('0x1e')](function(_0x20cbf5){if(_0x20cbf5){return _0x20cbf5?{'count':_0x1ddee7,'rows':_0x20cbf5}:null;}})[_0x6e9c('0x1e')](respondWithResult(_0x466a2a,null))[_0x6e9c('0x3d')](handleError(_0x466a2a,null));};exports[_0x6e9c('0x48')]=function(_0x23e51b,_0x13e249,_0x33c53d){var _0x25831={};var _0x35894b={};var _0x325bec;var _0x2e97dc;return db[_0x6e9c('0x26')][_0x6e9c('0x44')]({'where':{'id':_0x23e51b[_0x6e9c('0x3f')]['id']}})[_0x6e9c('0x1e')](handleEntityNotFound(_0x13e249,null))[_0x6e9c('0x1e')](function(_0x236099){if(_0x236099){_0x325bec=_0x236099;_0x35894b[_0x6e9c('0x2a')]=_['keys'](db[_0x6e9c('0x45')]['rawAttributes']);_0x35894b[_0x6e9c('0x2b')]=_[_0x6e9c('0x2c')](_0x23e51b[_0x6e9c('0x2b')]);_0x35894b['filters']=_['intersection'](_0x35894b[_0x6e9c('0x2a')],_0x35894b[_0x6e9c('0x2b')]);_0x25831['attributes']=_[_0x6e9c('0x2f')](_0x35894b[_0x6e9c('0x2a')],qs[_0x6e9c('0x30')](_0x23e51b['query'][_0x6e9c('0x30')]));_0x25831[_0x6e9c('0x2e')]=_0x25831[_0x6e9c('0x2e')][_0x6e9c('0x31')]?_0x25831[_0x6e9c('0x2e')]:_0x35894b['model'];_0x25831[_0x6e9c('0x46')]=qs[_0x6e9c('0x34')](_0x23e51b[_0x6e9c('0x2b')][_0x6e9c('0x34')]);_0x25831[_0x6e9c('0x35')]=qs['filters'](_[_0x6e9c('0x36')](_0x23e51b['query'],_0x35894b[_0x6e9c('0x2d')]));if(_0x23e51b['query'][_0x6e9c('0x37')]){_0x25831['where']=_[_0x6e9c('0x38')](_0x25831['where'],{'$or':_[_0x6e9c('0x25')](_0x25831['attributes'],function(_0x13d5f2){var _0x5d743b={};_0x5d743b[_0x13d5f2]={'$like':'%'+_0x23e51b[_0x6e9c('0x2b')][_0x6e9c('0x37')]+'%'};return _0x5d743b;})});}_0x25831=_[_0x6e9c('0x38')]({},_0x25831,_0x23e51b[_0x6e9c('0x3a')]);return _0x325bec[_0x6e9c('0x48')](_0x25831);}})[_0x6e9c('0x1e')](function(_0x1507af){if(_0x1507af){_0x2e97dc=_0x1507af[_0x6e9c('0x31')];if(!_0x23e51b[_0x6e9c('0x2b')][_0x6e9c('0x32')](_0x6e9c('0x33'))){_0x25831[_0x6e9c('0x18')]=qs[_0x6e9c('0x18')](_0x23e51b[_0x6e9c('0x2b')][_0x6e9c('0x18')]);_0x25831[_0x6e9c('0x16')]=qs[_0x6e9c('0x16')](_0x23e51b[_0x6e9c('0x2b')][_0x6e9c('0x16')]);}return _0x325bec['getSubjects'](_0x25831);}})[_0x6e9c('0x1e')](function(_0x184d47){if(_0x184d47){return _0x184d47?{'count':_0x2e97dc,'rows':_0x184d47}:null;}})[_0x6e9c('0x1e')](respondWithResult(_0x13e249,null))['catch'](handleError(_0x13e249,null));};exports[_0x6e9c('0x49')]=function(_0x5ebc7a,_0x5182a6,_0xeb53c8){var _0x417bf0={};var _0x10316d={};var _0xd07d20;var _0x4122a9;return db[_0x6e9c('0x26')][_0x6e9c('0x44')]({'where':{'id':_0x5ebc7a['params']['id']}})['then'](handleEntityNotFound(_0x5182a6,null))['then'](function(_0x458609){if(_0x458609){_0xd07d20=_0x458609;_0x10316d[_0x6e9c('0x2a')]=_[_0x6e9c('0x2c')](db['ZendeskField'][_0x6e9c('0x27')]);_0x10316d['query']=_[_0x6e9c('0x2c')](_0x5ebc7a[_0x6e9c('0x2b')]);_0x10316d[_0x6e9c('0x2d')]=_[_0x6e9c('0x2f')](_0x10316d[_0x6e9c('0x2a')],_0x10316d[_0x6e9c('0x2b')]);_0x417bf0[_0x6e9c('0x2e')]=_['intersection'](_0x10316d[_0x6e9c('0x2a')],qs[_0x6e9c('0x30')](_0x5ebc7a[_0x6e9c('0x2b')]['fields']));_0x417bf0[_0x6e9c('0x2e')]=_0x417bf0['attributes']['length']?_0x417bf0['attributes']:_0x10316d[_0x6e9c('0x2a')];_0x417bf0[_0x6e9c('0x46')]=qs['sort'](_0x5ebc7a[_0x6e9c('0x2b')][_0x6e9c('0x34')]);_0x417bf0[_0x6e9c('0x35')]=qs[_0x6e9c('0x2d')](_[_0x6e9c('0x36')](_0x5ebc7a[_0x6e9c('0x2b')],_0x10316d[_0x6e9c('0x2d')]));if(_0x5ebc7a[_0x6e9c('0x2b')]['filter']){_0x417bf0[_0x6e9c('0x35')]=_['merge'](_0x417bf0['where'],{'$or':_[_0x6e9c('0x25')](_0x417bf0['attributes'],function(_0x383905){var _0x59d567={};_0x59d567[_0x383905]={'$like':'%'+_0x5ebc7a['query']['filter']+'%'};return _0x59d567;})});}_0x417bf0=_[_0x6e9c('0x38')]({},_0x417bf0,_0x5ebc7a[_0x6e9c('0x3a')]);return _0xd07d20[_0x6e9c('0x49')](_0x417bf0);}})[_0x6e9c('0x1e')](function(_0x4b7fe5){if(_0x4b7fe5){_0x4122a9=_0x4b7fe5[_0x6e9c('0x31')];if(!_0x5ebc7a['query'][_0x6e9c('0x32')](_0x6e9c('0x33'))){_0x417bf0[_0x6e9c('0x18')]=qs['limit'](_0x5ebc7a[_0x6e9c('0x2b')][_0x6e9c('0x18')]);_0x417bf0[_0x6e9c('0x16')]=qs['offset'](_0x5ebc7a[_0x6e9c('0x2b')][_0x6e9c('0x16')]);}return _0xd07d20[_0x6e9c('0x49')](_0x417bf0);}})[_0x6e9c('0x1e')](function(_0x3fea3c){if(_0x3fea3c){return _0x3fea3c?{'count':_0x4122a9,'rows':_0x3fea3c}:null;}})[_0x6e9c('0x1e')](respondWithResult(_0x5182a6,null))[_0x6e9c('0x3d')](handleError(_0x5182a6,null));};exports['getTags']=function(_0x19005f,_0x367c39,_0x3d9398){var _0x55997a={};var _0x108168={};var _0x31f2ac;var _0x38b0a3;return db[_0x6e9c('0x26')]['findOne']({'where':{'id':_0x19005f[_0x6e9c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x367c39,null))[_0x6e9c('0x1e')](function(_0x19d501){if(_0x19d501){_0x31f2ac=_0x19d501;_0x108168[_0x6e9c('0x2a')]=_['keys'](db[_0x6e9c('0x4a')][_0x6e9c('0x27')]);_0x108168[_0x6e9c('0x2b')]=_[_0x6e9c('0x2c')](_0x19005f[_0x6e9c('0x2b')]);_0x108168[_0x6e9c('0x2d')]=_[_0x6e9c('0x2f')](_0x108168[_0x6e9c('0x2a')],_0x108168[_0x6e9c('0x2b')]);_0x55997a[_0x6e9c('0x2e')]=_['intersection'](_0x108168['model'],qs[_0x6e9c('0x30')](_0x19005f[_0x6e9c('0x2b')][_0x6e9c('0x30')]));_0x55997a[_0x6e9c('0x2e')]=_0x55997a['attributes'][_0x6e9c('0x31')]?_0x55997a['attributes']:_0x108168[_0x6e9c('0x2a')];_0x55997a[_0x6e9c('0x46')]=qs[_0x6e9c('0x34')](_0x19005f[_0x6e9c('0x2b')][_0x6e9c('0x34')]);_0x55997a[_0x6e9c('0x35')]=qs['filters'](_[_0x6e9c('0x36')](_0x19005f[_0x6e9c('0x2b')],_0x108168[_0x6e9c('0x2d')]));if(_0x19005f['query'][_0x6e9c('0x37')]){_0x55997a[_0x6e9c('0x35')]=_['merge'](_0x55997a['where'],{'$or':_[_0x6e9c('0x25')](_0x55997a['attributes'],function(_0x5ecd70){var _0x5e4ba9={};_0x5e4ba9[_0x5ecd70]={'$like':'%'+_0x19005f[_0x6e9c('0x2b')][_0x6e9c('0x37')]+'%'};return _0x5e4ba9;})});}_0x55997a=_[_0x6e9c('0x38')]({},_0x55997a,_0x19005f[_0x6e9c('0x3a')]);return _0x31f2ac[_0x6e9c('0x4b')](_0x55997a);}})[_0x6e9c('0x1e')](function(_0x4fab9e){if(_0x4fab9e){_0x38b0a3=_0x4fab9e[_0x6e9c('0x31')];if(!_0x19005f[_0x6e9c('0x2b')][_0x6e9c('0x32')](_0x6e9c('0x33'))){_0x55997a[_0x6e9c('0x18')]=qs[_0x6e9c('0x18')](_0x19005f['query']['limit']);_0x55997a[_0x6e9c('0x16')]=qs[_0x6e9c('0x16')](_0x19005f['query'][_0x6e9c('0x16')]);}return _0x31f2ac[_0x6e9c('0x4b')](_0x55997a);}})['then'](function(_0x212cbe){if(_0x212cbe){return _0x212cbe?{'count':_0x38b0a3,'rows':_0x212cbe}:null;}})[_0x6e9c('0x1e')](respondWithResult(_0x367c39,null))[_0x6e9c('0x3d')](handleError(_0x367c39,null));};exports[_0x6e9c('0x4c')]=function(_0x3b68d4,_0x31f9b0,_0x31a781){if(_0x3b68d4['body']['id']){delete _0x3b68d4['body']['id'];}return db[_0x6e9c('0x26')]['findOne']({'where':{'id':_0x3b68d4[_0x6e9c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x31f9b0,null))[_0x6e9c('0x1e')](function(_0x53d78a){if(_0x53d78a){return _0x53d78a['setTags'](_0x3b68d4[_0x6e9c('0x43')]['ids']||[]);}return null;})[_0x6e9c('0x1e')](respondWithResult(_0x31f9b0,null))[_0x6e9c('0x3d')](handleError(_0x31f9b0,null));}; \ No newline at end of file +var _0x351f=['fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','count','set','json','apply','save','update','then','destroy','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','includeAll','rows','catch','show','include','options','find','create','body','params','getFields','intersection','pick','hasOwnProperty','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs'];(function(_0x2a2cdf,_0x3f2801){var _0x5e8e12=function(_0x3cc5ef){while(--_0x3cc5ef){_0x2a2cdf['push'](_0x2a2cdf['shift']());}};_0x5e8e12(++_0x3f2801);}(_0x351f,0x187));var _0xf351=function(_0x244786,_0x310db4){_0x244786=_0x244786-0x0;var _0x3351c5=_0x351f[_0x244786];return _0x3351c5;};'use strict';var emlformat=require(_0xf351('0x0'));var rimraf=require(_0xf351('0x1'));var zipdir=require(_0xf351('0x2'));var jsonpatch=require(_0xf351('0x3'));var rp=require('request-promise');var moment=require(_0xf351('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf351('0x5'));var util=require(_0xf351('0x6'));var path=require(_0xf351('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf351('0x8'));var fs=require('fs');var fs_extra=require(_0xf351('0x9'));var _=require('lodash');var squel=require(_0xf351('0xa'));var crypto=require(_0xf351('0xb'));var jsforce=require(_0xf351('0xc'));var deskjs=require(_0xf351('0xd'));var toCsv=require(_0xf351('0xe'));var querystring=require('querystring');var Papa=require(_0xf351('0xf'));var Redis=require(_0xf351('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf351('0x11'));var as=require(_0xf351('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf351('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf351('0x14'));var db=require(_0xf351('0x15'))['db'];function respondWithStatusCode(_0x270480,_0x28606e){_0x28606e=_0x28606e||0xcc;return function(_0x1b7f8e){if(_0x1b7f8e){return _0x270480[_0xf351('0x16')](_0x28606e);}return _0x270480['status'](_0x28606e)[_0xf351('0x17')]();};}function respondWithResult(_0x2b149e,_0x2ae8a0){_0x2ae8a0=_0x2ae8a0||0xc8;return function(_0x132fe8){if(_0x132fe8){return _0x2b149e[_0xf351('0x18')](_0x2ae8a0)['json'](_0x132fe8);}};}function respondWithFilteredResult(_0x3ae9aa,_0x502689){return function(_0xa3a96a){if(_0xa3a96a){var _0x2c7452=typeof _0x502689[_0xf351('0x19')]==='undefined'&&typeof _0x502689[_0xf351('0x1a')]==='undefined';var _0x2c553a=_0xa3a96a[_0xf351('0x1b')];var _0x4c6948=_0x2c7452?0x0:_0x502689['offset'];var _0x41e465=_0x2c7452?_0xa3a96a['count']:_0x502689[_0xf351('0x19')]+_0x502689[_0xf351('0x1a')];var _0x4eb663;if(_0x41e465>=_0x2c553a){_0x41e465=_0x2c553a;_0x4eb663=0xc8;}else{_0x4eb663=0xce;}_0x3ae9aa[_0xf351('0x18')](_0x4eb663);return _0x3ae9aa[_0xf351('0x1c')]('Content-Range',_0x4c6948+'-'+_0x41e465+'/'+_0x2c553a)[_0xf351('0x1d')](_0xa3a96a);}return null;};}function patchUpdates(_0x2073d0){return function(_0x26db61){try{jsonpatch[_0xf351('0x1e')](_0x26db61,_0x2073d0,!![]);}catch(_0x1efd98){return BPromise['reject'](_0x1efd98);}return _0x26db61[_0xf351('0x1f')]();};}function saveUpdates(_0x3eaf4c,_0x4681e4){return function(_0x319f0d){if(_0x319f0d){return _0x319f0d[_0xf351('0x20')](_0x3eaf4c)[_0xf351('0x21')](function(_0x13473f){return _0x13473f;});}return null;};}function removeEntity(_0x2c5d80,_0x5204f4){return function(_0x5438c5){if(_0x5438c5){return _0x5438c5[_0xf351('0x22')]()[_0xf351('0x21')](function(){_0x2c5d80[_0xf351('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xee052,_0x1dcf96){return function(_0x38a2db){if(!_0x38a2db){_0xee052['sendStatus'](0x194);}return _0x38a2db;};}function handleError(_0x4f8583,_0x350d94){_0x350d94=_0x350d94||0x1f4;return function(_0x1ea9bf){logger[_0xf351('0x23')](_0x1ea9bf[_0xf351('0x24')]);if(_0x1ea9bf[_0xf351('0x25')]){delete _0x1ea9bf[_0xf351('0x25')];}_0x4f8583[_0xf351('0x18')](_0x350d94)['send'](_0x1ea9bf);};}exports[_0xf351('0x26')]=function(_0x4903b7,_0x525122){var _0x150a0c={},_0x5781e0={},_0x1036c5={'count':0x0,'rows':[]};var _0x42012d=_[_0xf351('0x27')](db[_0xf351('0x28')][_0xf351('0x29')],function(_0x933ecf){return{'name':_0x933ecf[_0xf351('0x2a')],'type':_0x933ecf['type']['key']};});_0x5781e0[_0xf351('0x2b')]=_[_0xf351('0x27')](_0x42012d,'name');_0x5781e0[_0xf351('0x2c')]=_[_0xf351('0x2d')](_0x4903b7[_0xf351('0x2c')]);_0x5781e0[_0xf351('0x2e')]=_['intersection'](_0x5781e0[_0xf351('0x2b')],_0x5781e0['query']);_0x150a0c[_0xf351('0x2f')]=_['intersection'](_0x5781e0[_0xf351('0x2b')],qs['fields'](_0x4903b7[_0xf351('0x2c')][_0xf351('0x30')]));_0x150a0c[_0xf351('0x2f')]=_0x150a0c[_0xf351('0x2f')][_0xf351('0x31')]?_0x150a0c[_0xf351('0x2f')]:_0x5781e0['model'];if(!_0x4903b7[_0xf351('0x2c')]['hasOwnProperty'](_0xf351('0x32'))){_0x150a0c[_0xf351('0x1a')]=qs[_0xf351('0x1a')](_0x4903b7[_0xf351('0x2c')][_0xf351('0x1a')]);_0x150a0c[_0xf351('0x19')]=qs['offset'](_0x4903b7[_0xf351('0x2c')][_0xf351('0x19')]);}_0x150a0c[_0xf351('0x33')]=qs[_0xf351('0x34')](_0x4903b7['query'][_0xf351('0x34')]);_0x150a0c[_0xf351('0x35')]=qs[_0xf351('0x2e')](_['pick'](_0x4903b7['query'],_0x5781e0[_0xf351('0x2e')]),_0x42012d);if(_0x4903b7['query']['filter']){_0x150a0c[_0xf351('0x35')]=_[_0xf351('0x36')](_0x150a0c['where'],{'$or':_['map'](_0x42012d,function(_0x2d956c){if(_0x2d956c[_0xf351('0x37')]!==_0xf351('0x38')){var _0x6b6962={};_0x6b6962[_0x2d956c[_0xf351('0x25')]]={'$like':'%'+_0x4903b7[_0xf351('0x2c')][_0xf351('0x39')]+'%'};return _0x6b6962;}})});}_0x150a0c=_[_0xf351('0x36')]({},_0x150a0c,_0x4903b7['options']);var _0x57a18c={'where':_0x150a0c[_0xf351('0x35')]};return db[_0xf351('0x28')][_0xf351('0x1b')](_0x57a18c)[_0xf351('0x21')](function(_0x331ca8){_0x1036c5[_0xf351('0x1b')]=_0x331ca8;if(_0x4903b7[_0xf351('0x2c')][_0xf351('0x3a')]){_0x150a0c['include']=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x150a0c);})[_0xf351('0x21')](function(_0x30c2e8){_0x1036c5[_0xf351('0x3b')]=_0x30c2e8;return _0x1036c5;})[_0xf351('0x21')](respondWithFilteredResult(_0x525122,_0x150a0c))[_0xf351('0x3c')](handleError(_0x525122,null));};exports[_0xf351('0x3d')]=function(_0xa33927,_0x2dece7){var _0x4e7dff={'raw':![],'where':{'id':_0xa33927['params']['id']}},_0x2de5ce={};_0x2de5ce[_0xf351('0x2b')]=_[_0xf351('0x2d')](db['ZendeskConfiguration'][_0xf351('0x29')]);_0x2de5ce[_0xf351('0x2c')]=_[_0xf351('0x2d')](_0xa33927['query']);_0x2de5ce[_0xf351('0x2e')]=_['intersection'](_0x2de5ce['model'],_0x2de5ce[_0xf351('0x2c')]);_0x4e7dff[_0xf351('0x2f')]=_['intersection'](_0x2de5ce[_0xf351('0x2b')],qs[_0xf351('0x30')](_0xa33927[_0xf351('0x2c')][_0xf351('0x30')]));_0x4e7dff[_0xf351('0x2f')]=_0x4e7dff['attributes'][_0xf351('0x31')]?_0x4e7dff[_0xf351('0x2f')]:_0x2de5ce['model'];if(_0xa33927[_0xf351('0x2c')][_0xf351('0x3a')]){_0x4e7dff[_0xf351('0x3e')]=[{'all':!![]}];}_0x4e7dff=_['merge']({},_0x4e7dff,_0xa33927[_0xf351('0x3f')]);return db['ZendeskConfiguration'][_0xf351('0x40')](_0x4e7dff)[_0xf351('0x21')](handleEntityNotFound(_0x2dece7,null))['then'](respondWithResult(_0x2dece7,null))[_0xf351('0x3c')](handleError(_0x2dece7,null));};exports[_0xf351('0x41')]=function(_0x167298,_0x27eb6e){return db[_0xf351('0x28')][_0xf351('0x41')](_0x167298[_0xf351('0x42')],{})[_0xf351('0x21')](respondWithResult(_0x27eb6e,0xc9))[_0xf351('0x3c')](handleError(_0x27eb6e,null));};exports[_0xf351('0x20')]=function(_0x4e6e87,_0xa9414d){if(_0x4e6e87[_0xf351('0x42')]['id']){delete _0x4e6e87['body']['id'];}return db['ZendeskConfiguration'][_0xf351('0x40')]({'where':{'id':_0x4e6e87[_0xf351('0x43')]['id']}})[_0xf351('0x21')](handleEntityNotFound(_0xa9414d,null))[_0xf351('0x21')](saveUpdates(_0x4e6e87[_0xf351('0x42')],null))['then'](respondWithResult(_0xa9414d,null))[_0xf351('0x3c')](handleError(_0xa9414d,null));};exports[_0xf351('0x22')]=function(_0x16ebe4,_0x1bc4cb){return db[_0xf351('0x28')][_0xf351('0x40')]({'where':{'id':_0x16ebe4[_0xf351('0x43')]['id']}})[_0xf351('0x21')](handleEntityNotFound(_0x1bc4cb,null))['then'](removeEntity(_0x1bc4cb,null))[_0xf351('0x3c')](handleError(_0x1bc4cb,null));};exports[_0xf351('0x44')]=function(_0x225497,_0x1d5ac8,_0x2f2692){var _0x18b386={};var _0x3df1dd={};var _0x249a73;var _0x51631c;return db[_0xf351('0x28')]['findOne']({'where':{'id':_0x225497['params']['id']}})[_0xf351('0x21')](handleEntityNotFound(_0x1d5ac8,null))[_0xf351('0x21')](function(_0x5cec07){if(_0x5cec07){_0x249a73=_0x5cec07;_0x3df1dd[_0xf351('0x2b')]=_['keys'](db['ZendeskField'][_0xf351('0x29')]);_0x3df1dd[_0xf351('0x2c')]=_[_0xf351('0x2d')](_0x225497[_0xf351('0x2c')]);_0x3df1dd[_0xf351('0x2e')]=_[_0xf351('0x45')](_0x3df1dd['model'],_0x3df1dd['query']);_0x18b386['attributes']=_[_0xf351('0x45')](_0x3df1dd['model'],qs[_0xf351('0x30')](_0x225497[_0xf351('0x2c')][_0xf351('0x30')]));_0x18b386[_0xf351('0x2f')]=_0x18b386[_0xf351('0x2f')][_0xf351('0x31')]?_0x18b386[_0xf351('0x2f')]:_0x3df1dd[_0xf351('0x2b')];_0x18b386[_0xf351('0x33')]=qs[_0xf351('0x34')](_0x225497[_0xf351('0x2c')][_0xf351('0x34')]);_0x18b386['where']=qs[_0xf351('0x2e')](_[_0xf351('0x46')](_0x225497[_0xf351('0x2c')],_0x3df1dd[_0xf351('0x2e')]));if(_0x225497['query']['filter']){_0x18b386[_0xf351('0x35')]=_[_0xf351('0x36')](_0x18b386[_0xf351('0x35')],{'$or':_[_0xf351('0x27')](_0x18b386[_0xf351('0x2f')],function(_0x3ff0ae){var _0x207741={};_0x207741[_0x3ff0ae]={'$like':'%'+_0x225497[_0xf351('0x2c')][_0xf351('0x39')]+'%'};return _0x207741;})});}_0x18b386=_[_0xf351('0x36')]({},_0x18b386,_0x225497[_0xf351('0x3f')]);return _0x249a73['getFields'](_0x18b386);}})['then'](function(_0x1c20ac){if(_0x1c20ac){_0x51631c=_0x1c20ac[_0xf351('0x31')];if(!_0x225497['query'][_0xf351('0x47')](_0xf351('0x32'))){_0x18b386['limit']=qs['limit'](_0x225497[_0xf351('0x2c')][_0xf351('0x1a')]);_0x18b386['offset']=qs[_0xf351('0x19')](_0x225497['query'][_0xf351('0x19')]);}return _0x249a73[_0xf351('0x44')](_0x18b386);}})[_0xf351('0x21')](function(_0x35283b){if(_0x35283b){return _0x35283b?{'count':_0x51631c,'rows':_0x35283b}:null;}})[_0xf351('0x21')](respondWithResult(_0x1d5ac8,null))['catch'](handleError(_0x1d5ac8,null));};exports[_0xf351('0x48')]=function(_0x2c46c7,_0x52dedf,_0xddbba){var _0x138a61={};var _0x27cbfe={};var _0x165549;var _0x4a6d98;return db['ZendeskConfiguration'][_0xf351('0x49')]({'where':{'id':_0x2c46c7[_0xf351('0x43')]['id']}})['then'](handleEntityNotFound(_0x52dedf,null))[_0xf351('0x21')](function(_0x389c21){if(_0x389c21){_0x165549=_0x389c21;_0x27cbfe['model']=_[_0xf351('0x2d')](db[_0xf351('0x4a')][_0xf351('0x29')]);_0x27cbfe['query']=_[_0xf351('0x2d')](_0x2c46c7[_0xf351('0x2c')]);_0x27cbfe[_0xf351('0x2e')]=_[_0xf351('0x45')](_0x27cbfe[_0xf351('0x2b')],_0x27cbfe['query']);_0x138a61[_0xf351('0x2f')]=_[_0xf351('0x45')](_0x27cbfe['model'],qs['fields'](_0x2c46c7[_0xf351('0x2c')][_0xf351('0x30')]));_0x138a61[_0xf351('0x2f')]=_0x138a61[_0xf351('0x2f')][_0xf351('0x31')]?_0x138a61[_0xf351('0x2f')]:_0x27cbfe[_0xf351('0x2b')];_0x138a61['order']=qs[_0xf351('0x34')](_0x2c46c7[_0xf351('0x2c')][_0xf351('0x34')]);_0x138a61[_0xf351('0x35')]=qs['filters'](_[_0xf351('0x46')](_0x2c46c7['query'],_0x27cbfe[_0xf351('0x2e')]));if(_0x2c46c7[_0xf351('0x2c')][_0xf351('0x39')]){_0x138a61[_0xf351('0x35')]=_[_0xf351('0x36')](_0x138a61[_0xf351('0x35')],{'$or':_['map'](_0x138a61[_0xf351('0x2f')],function(_0x456786){var _0x298a8d={};_0x298a8d[_0x456786]={'$like':'%'+_0x2c46c7[_0xf351('0x2c')][_0xf351('0x39')]+'%'};return _0x298a8d;})});}_0x138a61=_[_0xf351('0x36')]({},_0x138a61,_0x2c46c7[_0xf351('0x3f')]);return _0x165549[_0xf351('0x48')](_0x138a61);}})[_0xf351('0x21')](function(_0x5bd35f){if(_0x5bd35f){_0x4a6d98=_0x5bd35f[_0xf351('0x31')];if(!_0x2c46c7[_0xf351('0x2c')][_0xf351('0x47')](_0xf351('0x32'))){_0x138a61[_0xf351('0x1a')]=qs[_0xf351('0x1a')](_0x2c46c7[_0xf351('0x2c')][_0xf351('0x1a')]);_0x138a61['offset']=qs[_0xf351('0x19')](_0x2c46c7[_0xf351('0x2c')][_0xf351('0x19')]);}return _0x165549['getSubjects'](_0x138a61);}})['then'](function(_0x35dbf9){if(_0x35dbf9){return _0x35dbf9?{'count':_0x4a6d98,'rows':_0x35dbf9}:null;}})['then'](respondWithResult(_0x52dedf,null))[_0xf351('0x3c')](handleError(_0x52dedf,null));};exports['getDescriptions']=function(_0x51c93e,_0x36a3c3,_0x2b9ab9){var _0x330ec8={};var _0x44a1e9={};var _0x24fe6c;var _0x5b422c;return db[_0xf351('0x28')][_0xf351('0x49')]({'where':{'id':_0x51c93e[_0xf351('0x43')]['id']}})[_0xf351('0x21')](handleEntityNotFound(_0x36a3c3,null))[_0xf351('0x21')](function(_0xae25de){if(_0xae25de){_0x24fe6c=_0xae25de;_0x44a1e9[_0xf351('0x2b')]=_[_0xf351('0x2d')](db['ZendeskField']['rawAttributes']);_0x44a1e9[_0xf351('0x2c')]=_['keys'](_0x51c93e['query']);_0x44a1e9['filters']=_[_0xf351('0x45')](_0x44a1e9[_0xf351('0x2b')],_0x44a1e9[_0xf351('0x2c')]);_0x330ec8[_0xf351('0x2f')]=_[_0xf351('0x45')](_0x44a1e9[_0xf351('0x2b')],qs[_0xf351('0x30')](_0x51c93e[_0xf351('0x2c')][_0xf351('0x30')]));_0x330ec8[_0xf351('0x2f')]=_0x330ec8['attributes'][_0xf351('0x31')]?_0x330ec8[_0xf351('0x2f')]:_0x44a1e9[_0xf351('0x2b')];_0x330ec8[_0xf351('0x33')]=qs[_0xf351('0x34')](_0x51c93e[_0xf351('0x2c')][_0xf351('0x34')]);_0x330ec8[_0xf351('0x35')]=qs[_0xf351('0x2e')](_[_0xf351('0x46')](_0x51c93e['query'],_0x44a1e9['filters']));if(_0x51c93e[_0xf351('0x2c')][_0xf351('0x39')]){_0x330ec8[_0xf351('0x35')]=_[_0xf351('0x36')](_0x330ec8[_0xf351('0x35')],{'$or':_['map'](_0x330ec8[_0xf351('0x2f')],function(_0xa258c8){var _0x243a6e={};_0x243a6e[_0xa258c8]={'$like':'%'+_0x51c93e['query']['filter']+'%'};return _0x243a6e;})});}_0x330ec8=_['merge']({},_0x330ec8,_0x51c93e[_0xf351('0x3f')]);return _0x24fe6c[_0xf351('0x4b')](_0x330ec8);}})[_0xf351('0x21')](function(_0x734393){if(_0x734393){_0x5b422c=_0x734393[_0xf351('0x31')];if(!_0x51c93e[_0xf351('0x2c')][_0xf351('0x47')]('nolimit')){_0x330ec8['limit']=qs['limit'](_0x51c93e[_0xf351('0x2c')][_0xf351('0x1a')]);_0x330ec8[_0xf351('0x19')]=qs[_0xf351('0x19')](_0x51c93e[_0xf351('0x2c')][_0xf351('0x19')]);}return _0x24fe6c['getDescriptions'](_0x330ec8);}})[_0xf351('0x21')](function(_0x16cc0e){if(_0x16cc0e){return _0x16cc0e?{'count':_0x5b422c,'rows':_0x16cc0e}:null;}})['then'](respondWithResult(_0x36a3c3,null))[_0xf351('0x3c')](handleError(_0x36a3c3,null));};exports[_0xf351('0x4c')]=function(_0x3b719e,_0x20a2be,_0x2b8098){var _0x20ff02={};var _0x329fef={};var _0x32ea89;var _0x171dbb;return db['ZendeskConfiguration'][_0xf351('0x49')]({'where':{'id':_0x3b719e[_0xf351('0x43')]['id']}})['then'](handleEntityNotFound(_0x20a2be,null))['then'](function(_0x4e3b04){if(_0x4e3b04){_0x32ea89=_0x4e3b04;_0x329fef['model']=_['keys'](db[_0xf351('0x4d')]['rawAttributes']);_0x329fef['query']=_['keys'](_0x3b719e[_0xf351('0x2c')]);_0x329fef[_0xf351('0x2e')]=_[_0xf351('0x45')](_0x329fef['model'],_0x329fef[_0xf351('0x2c')]);_0x20ff02[_0xf351('0x2f')]=_[_0xf351('0x45')](_0x329fef[_0xf351('0x2b')],qs[_0xf351('0x30')](_0x3b719e['query']['fields']));_0x20ff02[_0xf351('0x2f')]=_0x20ff02[_0xf351('0x2f')]['length']?_0x20ff02[_0xf351('0x2f')]:_0x329fef[_0xf351('0x2b')];_0x20ff02['order']=qs[_0xf351('0x34')](_0x3b719e[_0xf351('0x2c')][_0xf351('0x34')]);_0x20ff02[_0xf351('0x35')]=qs['filters'](_[_0xf351('0x46')](_0x3b719e['query'],_0x329fef[_0xf351('0x2e')]));if(_0x3b719e[_0xf351('0x2c')][_0xf351('0x39')]){_0x20ff02['where']=_['merge'](_0x20ff02[_0xf351('0x35')],{'$or':_[_0xf351('0x27')](_0x20ff02[_0xf351('0x2f')],function(_0x149a9){var _0xf0b9f2={};_0xf0b9f2[_0x149a9]={'$like':'%'+_0x3b719e[_0xf351('0x2c')][_0xf351('0x39')]+'%'};return _0xf0b9f2;})});}_0x20ff02=_['merge']({},_0x20ff02,_0x3b719e[_0xf351('0x3f')]);return _0x32ea89['getTags'](_0x20ff02);}})['then'](function(_0x2fc86a){if(_0x2fc86a){_0x171dbb=_0x2fc86a[_0xf351('0x31')];if(!_0x3b719e['query'][_0xf351('0x47')](_0xf351('0x32'))){_0x20ff02['limit']=qs[_0xf351('0x1a')](_0x3b719e[_0xf351('0x2c')]['limit']);_0x20ff02[_0xf351('0x19')]=qs[_0xf351('0x19')](_0x3b719e[_0xf351('0x2c')][_0xf351('0x19')]);}return _0x32ea89[_0xf351('0x4c')](_0x20ff02);}})[_0xf351('0x21')](function(_0x3b96d8){if(_0x3b96d8){return _0x3b96d8?{'count':_0x171dbb,'rows':_0x3b96d8}:null;}})[_0xf351('0x21')](respondWithResult(_0x20a2be,null))['catch'](handleError(_0x20a2be,null));};exports['setTags']=function(_0x226792,_0x5da339,_0x3b8616){if(_0x226792[_0xf351('0x42')]['id']){delete _0x226792[_0xf351('0x42')]['id'];}return db[_0xf351('0x28')]['findOne']({'where':{'id':_0x226792['params']['id']}})[_0xf351('0x21')](handleEntityNotFound(_0x5da339,null))[_0xf351('0x21')](function(_0x8664a1){if(_0x8664a1){return _0x8664a1[_0xf351('0x4e')](_0x226792['body'][_0xf351('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x5da339,null))['catch'](handleError(_0x5da339,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 2f1ac26..5aa92ff 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0972=['util','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x0972,0x64));var _0x2097=function(_0x36e30e,_0x40caec){_0x36e30e=_0x36e30e-0x0;var _0x43703b=_0x0972[_0x36e30e];return _0x43703b;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var logger=require('../../config/logger')(_0x2097('0x1'));var moment=require('moment');var BPromise=require(_0x2097('0x2'));var rp=require(_0x2097('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x2f84d8,_0x11ed13){return _0x2f84d8[_0x2097('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x2097('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb78e=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define'];(function(_0x39bab2,_0x3e46e2){var _0x56c8b0=function(_0x48f68c){while(--_0x48f68c){_0x39bab2['push'](_0x39bab2['shift']());}};_0x56c8b0(++_0x3e46e2);}(_0xb78e,0x1c9));var _0xeb78=function(_0x16cadb,_0x2c2293){_0x16cadb=_0x16cadb-0x0;var _0x14f8b1=_0xb78e[_0x16cadb];return _0x14f8b1;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var logger=require('../../config/logger')(_0xeb78('0x2'));var moment=require(_0xeb78('0x3'));var BPromise=require(_0xeb78('0x4'));var rp=require(_0xeb78('0x5'));var fs=require('fs');var path=require(_0xeb78('0x6'));var rimraf=require(_0xeb78('0x7'));var config=require(_0xeb78('0x8'));var attributes=require(_0xeb78('0x9'));module['exports']=function(_0x3c35e7,_0x17a736){return _0x3c35e7[_0xeb78('0xa')](_0xeb78('0xb'),attributes,{'tableName':_0xeb78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index ac8f42f..a355297 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b52=['info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x1b52,0x1cf));var _0x21b5=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x1b52[_0x1deee5];return _0x1d6c3a;};'use strict';var _=require('lodash');var util=require(_0x21b5('0x0'));var moment=require(_0x21b5('0x1'));var BPromise=require(_0x21b5('0x2'));var rs=require(_0x21b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21b5('0x4'))['db'];var utils=require(_0x21b5('0x5'));var logger=require('../../config/logger')(_0x21b5('0x6'));var config=require(_0x21b5('0x7'));var jayson=require(_0x21b5('0x8'));var client=jayson[_0x21b5('0x9')][_0x21b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x524ef9,_0x3ff639,_0x5a5f82){return new BPromise(function(_0x324c58,_0x59b4f8){return client[_0x21b5('0xb')](_0x524ef9,_0x5a5f82)[_0x21b5('0xc')](function(_0x11d6cd){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x3ff639,_0x21b5('0xd'));logger[_0x21b5('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3ff639,_0x21b5('0xd'),JSON[_0x21b5('0xf')](_0x11d6cd));if(_0x11d6cd[_0x21b5('0x10')]){if(_0x11d6cd[_0x21b5('0x10')][_0x21b5('0x11')]===0x1f4){logger[_0x21b5('0x10')](_0x21b5('0x12'),_0x3ff639,_0x11d6cd['error'][_0x21b5('0x13')]);return _0x59b4f8(_0x11d6cd[_0x21b5('0x10')][_0x21b5('0x13')]);}logger[_0x21b5('0x10')](_0x21b5('0x12'),_0x3ff639,_0x11d6cd['error'][_0x21b5('0x13')]);return _0x324c58(_0x11d6cd[_0x21b5('0x10')]['message']);}else{logger[_0x21b5('0x14')](_0x21b5('0x12'),_0x3ff639,_0x21b5('0xd'));_0x324c58(_0x11d6cd['result'][_0x21b5('0x13')]);}})['catch'](function(_0x47078e){logger[_0x21b5('0x10')](_0x21b5('0x12'),_0x3ff639,_0x47078e);_0x59b4f8(_0x47078e);});});} \ No newline at end of file +var _0xde0d=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x19ac89,_0x2d5b73){var _0x375966=function(_0x12bc3b){while(--_0x12bc3b){_0x19ac89['push'](_0x19ac89['shift']());}};_0x375966(++_0x2d5b73);}(_0xde0d,0x13a));var _0xdde0=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xde0d[_0x2f3848];return _0x102668;};'use strict';var _=require(_0xdde0('0x0'));var util=require(_0xdde0('0x1'));var moment=require(_0xdde0('0x2'));var BPromise=require(_0xdde0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdde0('0x4'));var db=require(_0xdde0('0x5'))['db'];var utils=require(_0xdde0('0x6'));var logger=require(_0xdde0('0x7'))(_0xdde0('0x8'));var config=require(_0xdde0('0x9'));var jayson=require(_0xdde0('0xa'));var client=jayson[_0xdde0('0xb')][_0xdde0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52ba63,_0x20be96,_0xdc75bc){return new BPromise(function(_0x4f63fd,_0x1ff520){return client[_0xdde0('0xd')](_0x52ba63,_0xdc75bc)['then'](function(_0x49a839){logger[_0xdde0('0xe')](_0xdde0('0xf'),_0x20be96,'request\x20sent');logger[_0xdde0('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x20be96,'request\x20sent',JSON[_0xdde0('0x11')](_0x49a839));if(_0x49a839[_0xdde0('0x12')]){if(_0x49a839[_0xdde0('0x12')][_0xdde0('0x13')]===0x1f4){logger[_0xdde0('0x12')](_0xdde0('0xf'),_0x20be96,_0x49a839[_0xdde0('0x12')][_0xdde0('0x14')]);return _0x1ff520(_0x49a839[_0xdde0('0x12')]['message']);}logger['error'](_0xdde0('0xf'),_0x20be96,_0x49a839[_0xdde0('0x12')]['message']);return _0x4f63fd(_0x49a839['error'][_0xdde0('0x14')]);}else{logger['info'](_0xdde0('0xf'),_0x20be96,_0xdde0('0x15'));_0x4f63fd(_0x49a839[_0xdde0('0x16')][_0xdde0('0x14')]);}})[_0xdde0('0x17')](function(_0x391557){logger[_0xdde0('0x12')](_0xdde0('0xf'),_0x20be96,_0x391557);_0x1ff520(_0x391557);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ec5be43..67690c9 100644 --- a/server/api/intZendeskField/index.js +++ b/server/api/intZendeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2097=['express','Router','fs-extra','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5e8dfa,_0x195ecf){var _0x53c7ba=function(_0x40fe37){while(--_0x40fe37){_0x5e8dfa['push'](_0x5e8dfa['shift']());}};_0x53c7ba(++_0x195ecf);}(_0x2097,0x1a1));var _0x7209=function(_0x39f754,_0xd54375){_0x39f754=_0x39f754-0x0;var _0x525ba4=_0x2097[_0x39f754];return _0x525ba4;};'use strict';var multer=require('multer');var util=require(_0x7209('0x0'));var path=require(_0x7209('0x1'));var timeout=require(_0x7209('0x2'));var express=require(_0x7209('0x3'));var router=express[_0x7209('0x4')]();var fs_extra=require(_0x7209('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x7209('0x6')]('/',auth[_0x7209('0x7')](),controller[_0x7209('0x8')]);router[_0x7209('0x6')](_0x7209('0x9'),auth[_0x7209('0x7')](),controller['show']);router['post']('/',auth[_0x7209('0x7')](),controller[_0x7209('0xa')]);router[_0x7209('0xb')]('/:id',auth[_0x7209('0x7')](),controller['update']);router[_0x7209('0xc')](_0x7209('0x9'),auth['isAuthenticated'](),controller[_0x7209('0xd')]);module[_0x7209('0xe')]=router; \ No newline at end of file +var _0x8387=['delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','show','create','/:id','update'];(function(_0x33010a,_0x299780){var _0x2a675f=function(_0x272b41){while(--_0x272b41){_0x33010a['push'](_0x33010a['shift']());}};_0x2a675f(++_0x299780);}(_0x8387,0x158));var _0x7838=function(_0x4360ce,_0xa1d8f4){_0x4360ce=_0x4360ce-0x0;var _0x47518=_0x8387[_0x4360ce];return _0x47518;};'use strict';var multer=require(_0x7838('0x0'));var util=require(_0x7838('0x1'));var path=require(_0x7838('0x2'));var timeout=require(_0x7838('0x3'));var express=require(_0x7838('0x4'));var router=express[_0x7838('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7838('0x6'));var interaction=require(_0x7838('0x7'));var config=require(_0x7838('0x8'));var controller=require(_0x7838('0x9'));router[_0x7838('0xa')]('/',auth['isAuthenticated'](),controller[_0x7838('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7838('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7838('0xd')]);router['put'](_0x7838('0xe'),auth['isAuthenticated'](),controller[_0x7838('0xf')]);router[_0x7838('0x10')](_0x7838('0xe'),auth[_0x7838('0x11')](),controller[_0x7838('0x12')]);module[_0x7838('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 5060120..a5f859d 100644 --- a/server/api/intZendeskField/intZendeskField.attributes.js +++ b/server/api/intZendeskField/intZendeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21fc=['sequelize','exports','ENUM','string','variable','picklist','STRING','customVariable'];(function(_0x3f35ce,_0x4a0e1f){var _0x1b0c8f=function(_0x3dd909){while(--_0x3dd909){_0x3f35ce['push'](_0x3f35ce['shift']());}};_0x1b0c8f(++_0x4a0e1f);}(_0x21fc,0x168));var _0xc21f=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0x21fc[_0x4d67b8];return _0x55af3b;};'use strict';var Sequelize=require(_0xc21f('0x0'));module[_0xc21f('0x1')]={'type':{'type':Sequelize[_0xc21f('0x2')](_0xc21f('0x3'),_0xc21f('0x4'),'customVariable','keyValue',_0xc21f('0x5')),'defaultValue':_0xc21f('0x3')},'content':{'type':Sequelize[_0xc21f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc21f('0x2')](_0xc21f('0x3'),_0xc21f('0x4'),_0xc21f('0x7'))},'keyContent':{'type':Sequelize[_0xc21f('0x6')]},'idField':{'type':Sequelize[_0xc21f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc21f('0x6')]}}; \ No newline at end of file +var _0x0983=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0983,0x1a5));var _0x3098=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x0983[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x3098('0x0'));module[_0x3098('0x1')]={'type':{'type':Sequelize[_0x3098('0x2')](_0x3098('0x3'),_0x3098('0x4'),_0x3098('0x5'),_0x3098('0x6'),_0x3098('0x7')),'defaultValue':_0x3098('0x3')},'content':{'type':Sequelize[_0x3098('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3098('0x2')]('string','variable',_0x3098('0x5'))},'keyContent':{'type':Sequelize[_0x3098('0x8')]},'idField':{'type':Sequelize[_0x3098('0x8')]},'nameField':{'type':Sequelize[_0x3098('0x8')]},'customField':{'type':Sequelize[_0x3098('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 39b9dd4..f010677 100644 --- a/server/api/intZendeskField/intZendeskField.controller.js +++ b/server/api/intZendeskField/intZendeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc02=['catch','show','params','find','create','eml-format','fast-json-patch','moment','bluebird','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','ZendeskField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xfc02,0x1da));var _0x2fc0=function(_0x2d88fd,_0x4e4302){_0x2d88fd=_0x2d88fd-0x0;var _0x2d8996=_0xfc02[_0x2d88fd];return _0x2d8996;};'use strict';var emlformat=require(_0x2fc0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2fc0('0x1'));var rp=require('request-promise');var moment=require(_0x2fc0('0x2'));var BPromise=require(_0x2fc0('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2fc0('0x4'));var csv=require(_0x2fc0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fc0('0x6'));var _=require(_0x2fc0('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2fc0('0x8'));var toCsv=require('to-csv');var querystring=require(_0x2fc0('0x9'));var Papa=require(_0x2fc0('0xa'));var Redis=require(_0x2fc0('0xb'));var authService=require(_0x2fc0('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x2fc0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2fc0('0xe'));var utils=require(_0x2fc0('0xf'));var config=require(_0x2fc0('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fc0('0x11'))['db'];function respondWithStatusCode(_0x528013,_0x2eb2dd){_0x2eb2dd=_0x2eb2dd||0xcc;return function(_0x1957eb){if(_0x1957eb){return _0x528013[_0x2fc0('0x12')](_0x2eb2dd);}return _0x528013['status'](_0x2eb2dd)['end']();};}function respondWithResult(_0x378a72,_0x1d7b06){_0x1d7b06=_0x1d7b06||0xc8;return function(_0x1f5e7b){if(_0x1f5e7b){return _0x378a72[_0x2fc0('0x13')](_0x1d7b06)[_0x2fc0('0x14')](_0x1f5e7b);}};}function respondWithFilteredResult(_0x37aaea,_0x548ce9){return function(_0x4e5ce4){if(_0x4e5ce4){var _0x23f8f6=typeof _0x548ce9[_0x2fc0('0x15')]===_0x2fc0('0x16')&&typeof _0x548ce9['limit']==='undefined';var _0x4c4595=_0x4e5ce4[_0x2fc0('0x17')];var _0x3b43f4=_0x23f8f6?0x0:_0x548ce9[_0x2fc0('0x15')];var _0x4a6ef4=_0x23f8f6?_0x4e5ce4[_0x2fc0('0x17')]:_0x548ce9['offset']+_0x548ce9['limit'];var _0x4ce223;if(_0x4a6ef4>=_0x4c4595){_0x4a6ef4=_0x4c4595;_0x4ce223=0xc8;}else{_0x4ce223=0xce;}_0x37aaea[_0x2fc0('0x13')](_0x4ce223);return _0x37aaea[_0x2fc0('0x18')]('Content-Range',_0x3b43f4+'-'+_0x4a6ef4+'/'+_0x4c4595)[_0x2fc0('0x14')](_0x4e5ce4);}return null;};}function patchUpdates(_0x46fc4a){return function(_0x3e6059){try{jsonpatch[_0x2fc0('0x19')](_0x3e6059,_0x46fc4a,!![]);}catch(_0x3cc6ea){return BPromise[_0x2fc0('0x1a')](_0x3cc6ea);}return _0x3e6059[_0x2fc0('0x1b')]();};}function saveUpdates(_0x270c97,_0x35e22f){return function(_0x2bf22c){if(_0x2bf22c){return _0x2bf22c[_0x2fc0('0x1c')](_0x270c97)['then'](function(_0x5d64c0){return _0x5d64c0;});}return null;};}function removeEntity(_0x239bec,_0x2fa9fb){return function(_0x1ff736){if(_0x1ff736){return _0x1ff736[_0x2fc0('0x1d')]()['then'](function(){_0x239bec['status'](0xcc)[_0x2fc0('0x1e')]();});}};}function handleEntityNotFound(_0x89afbe,_0x158b44){return function(_0x346b08){if(!_0x346b08){_0x89afbe[_0x2fc0('0x12')](0x194);}return _0x346b08;};}function handleError(_0x38f468,_0x26aa49){_0x26aa49=_0x26aa49||0x1f4;return function(_0x5667f9){logger['error'](_0x5667f9[_0x2fc0('0x1f')]);if(_0x5667f9[_0x2fc0('0x20')]){delete _0x5667f9[_0x2fc0('0x20')];}_0x38f468[_0x2fc0('0x13')](_0x26aa49)[_0x2fc0('0x21')](_0x5667f9);};}exports[_0x2fc0('0x22')]=function(_0x1245ee,_0x4d0f60){var _0x3e0585={},_0x5d0d75={},_0x1f67c9={'count':0x0,'rows':[]};var _0x21a022=_[_0x2fc0('0x23')](db[_0x2fc0('0x24')]['rawAttributes'],function(_0x1c9436){return{'name':_0x1c9436[_0x2fc0('0x25')],'type':_0x1c9436[_0x2fc0('0x26')][_0x2fc0('0x27')]};});_0x5d0d75[_0x2fc0('0x28')]=_[_0x2fc0('0x23')](_0x21a022,_0x2fc0('0x20'));_0x5d0d75[_0x2fc0('0x29')]=_[_0x2fc0('0x2a')](_0x1245ee[_0x2fc0('0x29')]);_0x5d0d75[_0x2fc0('0x2b')]=_[_0x2fc0('0x2c')](_0x5d0d75[_0x2fc0('0x28')],_0x5d0d75[_0x2fc0('0x29')]);_0x3e0585[_0x2fc0('0x2d')]=_[_0x2fc0('0x2c')](_0x5d0d75[_0x2fc0('0x28')],qs[_0x2fc0('0x2e')](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x2e')]));_0x3e0585[_0x2fc0('0x2d')]=_0x3e0585[_0x2fc0('0x2d')][_0x2fc0('0x2f')]?_0x3e0585[_0x2fc0('0x2d')]:_0x5d0d75[_0x2fc0('0x28')];if(!_0x1245ee[_0x2fc0('0x29')]['hasOwnProperty'](_0x2fc0('0x30'))){_0x3e0585[_0x2fc0('0x31')]=qs['limit'](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x31')]);_0x3e0585['offset']=qs[_0x2fc0('0x15')](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x15')]);}_0x3e0585['order']=qs['sort'](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x32')]);_0x3e0585['where']=qs[_0x2fc0('0x2b')](_[_0x2fc0('0x33')](_0x1245ee[_0x2fc0('0x29')],_0x5d0d75[_0x2fc0('0x2b')]),_0x21a022);if(_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x34')]){_0x3e0585[_0x2fc0('0x35')]=_[_0x2fc0('0x36')](_0x3e0585[_0x2fc0('0x35')],{'$or':_[_0x2fc0('0x23')](_0x21a022,function(_0x3711d3){if(_0x3711d3['type']!==_0x2fc0('0x37')){var _0x2f4893={};_0x2f4893[_0x3711d3['name']]={'$like':'%'+_0x1245ee[_0x2fc0('0x29')]['filter']+'%'};return _0x2f4893;}})});}_0x3e0585=_[_0x2fc0('0x36')]({},_0x3e0585,_0x1245ee[_0x2fc0('0x38')]);var _0x27e4d1={'where':_0x3e0585[_0x2fc0('0x35')]};return db[_0x2fc0('0x24')][_0x2fc0('0x17')](_0x27e4d1)['then'](function(_0x191a1e){_0x1f67c9['count']=_0x191a1e;if(_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x39')]){_0x3e0585[_0x2fc0('0x3a')]=[{'all':!![]}];}return db['ZendeskField'][_0x2fc0('0x3b')](_0x3e0585);})[_0x2fc0('0x3c')](function(_0x5b4a43){_0x1f67c9[_0x2fc0('0x3d')]=_0x5b4a43;return _0x1f67c9;})[_0x2fc0('0x3c')](respondWithFilteredResult(_0x4d0f60,_0x3e0585))[_0x2fc0('0x3e')](handleError(_0x4d0f60,null));};exports[_0x2fc0('0x3f')]=function(_0x3533cc,_0x115878){var _0x58323a={'raw':!![],'where':{'id':_0x3533cc[_0x2fc0('0x40')]['id']}},_0x512c3b={};_0x512c3b['model']=_['keys'](db[_0x2fc0('0x24')]['rawAttributes']);_0x512c3b[_0x2fc0('0x29')]=_[_0x2fc0('0x2a')](_0x3533cc[_0x2fc0('0x29')]);_0x512c3b['filters']=_[_0x2fc0('0x2c')](_0x512c3b[_0x2fc0('0x28')],_0x512c3b[_0x2fc0('0x29')]);_0x58323a[_0x2fc0('0x2d')]=_[_0x2fc0('0x2c')](_0x512c3b['model'],qs['fields'](_0x3533cc['query']['fields']));_0x58323a[_0x2fc0('0x2d')]=_0x58323a[_0x2fc0('0x2d')]['length']?_0x58323a[_0x2fc0('0x2d')]:_0x512c3b['model'];if(_0x3533cc[_0x2fc0('0x29')][_0x2fc0('0x39')]){_0x58323a[_0x2fc0('0x3a')]=[{'all':!![]}];}_0x58323a=_[_0x2fc0('0x36')]({},_0x58323a,_0x3533cc[_0x2fc0('0x38')]);return db['ZendeskField'][_0x2fc0('0x41')](_0x58323a)['then'](handleEntityNotFound(_0x115878,null))[_0x2fc0('0x3c')](respondWithResult(_0x115878,null))[_0x2fc0('0x3e')](handleError(_0x115878,null));};exports[_0x2fc0('0x42')]=function(_0x3eb932,_0x465341){return db[_0x2fc0('0x24')][_0x2fc0('0x42')](_0x3eb932['body'],{})[_0x2fc0('0x3c')](respondWithResult(_0x465341,0xc9))[_0x2fc0('0x3e')](handleError(_0x465341,null));};exports[_0x2fc0('0x1c')]=function(_0x3c1040,_0xbc991c){if(_0x3c1040['body']['id']){delete _0x3c1040['body']['id'];}return db[_0x2fc0('0x24')][_0x2fc0('0x41')]({'where':{'id':_0x3c1040[_0x2fc0('0x40')]['id']}})['then'](handleEntityNotFound(_0xbc991c,null))[_0x2fc0('0x3c')](saveUpdates(_0x3c1040['body'],null))['then'](respondWithResult(_0xbc991c,null))['catch'](handleError(_0xbc991c,null));};exports[_0x2fc0('0x1d')]=function(_0x5eac1d,_0x264a1a){return db[_0x2fc0('0x24')]['find']({'where':{'id':_0x5eac1d[_0x2fc0('0x40')]['id']}})['then'](handleEntityNotFound(_0x264a1a,null))['then'](removeEntity(_0x264a1a,null))[_0x2fc0('0x3e')](handleError(_0x264a1a,null));}; \ No newline at end of file +var _0x5d25=['api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','end','error','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','nolimit','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x3e013e,_0x4adb91){var _0x385690=function(_0x2ec9a9){while(--_0x2ec9a9){_0x3e013e['push'](_0x3e013e['shift']());}};_0x385690(++_0x4adb91);}(_0x5d25,0x103));var _0x55d2=function(_0x3583b0,_0x590ed5){_0x3583b0=_0x3583b0-0x0;var _0x48a67f=_0x5d25[_0x3583b0];return _0x48a67f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55d2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55d2('0x1'));var rp=require(_0x55d2('0x2'));var moment=require(_0x55d2('0x3'));var BPromise=require(_0x55d2('0x4'));var Mustache=require(_0x55d2('0x5'));var util=require('util');var path=require(_0x55d2('0x6'));var sox=require('sox');var csv=require(_0x55d2('0x7'));var ejs=require(_0x55d2('0x8'));var fs=require('fs');var fs_extra=require(_0x55d2('0x9'));var _=require(_0x55d2('0xa'));var squel=require(_0x55d2('0xb'));var crypto=require(_0x55d2('0xc'));var jsforce=require(_0x55d2('0xd'));var deskjs=require(_0x55d2('0xe'));var toCsv=require(_0x55d2('0x7'));var querystring=require(_0x55d2('0xf'));var Papa=require(_0x55d2('0x10'));var Redis=require('ioredis');var authService=require(_0x55d2('0x11'));var qs=require(_0x55d2('0x12'));var as=require(_0x55d2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55d2('0x14'))(_0x55d2('0x15'));var utils=require(_0x55d2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x55d2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x369b52,_0x5c2321){_0x5c2321=_0x5c2321||0xcc;return function(_0xb5b67e){if(_0xb5b67e){return _0x369b52[_0x55d2('0x18')](_0x5c2321);}return _0x369b52[_0x55d2('0x19')](_0x5c2321)['end']();};}function respondWithResult(_0x5cd05b,_0x3b4fe7){_0x3b4fe7=_0x3b4fe7||0xc8;return function(_0x1f6d11){if(_0x1f6d11){return _0x5cd05b[_0x55d2('0x19')](_0x3b4fe7)[_0x55d2('0x1a')](_0x1f6d11);}};}function respondWithFilteredResult(_0x9457ba,_0x4bbd08){return function(_0x2ba0fb){if(_0x2ba0fb){var _0x47f4c4=typeof _0x4bbd08[_0x55d2('0x1b')]===_0x55d2('0x1c')&&typeof _0x4bbd08[_0x55d2('0x1d')]===_0x55d2('0x1c');var _0x2b2909=_0x2ba0fb['count'];var _0x20f73b=_0x47f4c4?0x0:_0x4bbd08['offset'];var _0x21385c=_0x47f4c4?_0x2ba0fb[_0x55d2('0x1e')]:_0x4bbd08[_0x55d2('0x1b')]+_0x4bbd08[_0x55d2('0x1d')];var _0xb381b8;if(_0x21385c>=_0x2b2909){_0x21385c=_0x2b2909;_0xb381b8=0xc8;}else{_0xb381b8=0xce;}_0x9457ba[_0x55d2('0x19')](_0xb381b8);return _0x9457ba[_0x55d2('0x1f')](_0x55d2('0x20'),_0x20f73b+'-'+_0x21385c+'/'+_0x2b2909)[_0x55d2('0x1a')](_0x2ba0fb);}return null;};}function patchUpdates(_0x2e6cae){return function(_0x5d9487){try{jsonpatch[_0x55d2('0x21')](_0x5d9487,_0x2e6cae,!![]);}catch(_0x5ccaf1){return BPromise['reject'](_0x5ccaf1);}return _0x5d9487['save']();};}function saveUpdates(_0x14e5cf,_0x374460){return function(_0x30f4b2){if(_0x30f4b2){return _0x30f4b2[_0x55d2('0x22')](_0x14e5cf)[_0x55d2('0x23')](function(_0x2904c1){return _0x2904c1;});}return null;};}function removeEntity(_0x276875,_0x593120){return function(_0x4cc06e){if(_0x4cc06e){return _0x4cc06e['destroy']()[_0x55d2('0x23')](function(){_0x276875['status'](0xcc)[_0x55d2('0x24')]();});}};}function handleEntityNotFound(_0x4eaa63,_0x4aa36b){return function(_0x1a0a16){if(!_0x1a0a16){_0x4eaa63[_0x55d2('0x18')](0x194);}return _0x1a0a16;};}function handleError(_0x28efa0,_0x2339bd){_0x2339bd=_0x2339bd||0x1f4;return function(_0x300c02){logger[_0x55d2('0x25')](_0x300c02['stack']);if(_0x300c02['name']){delete _0x300c02[_0x55d2('0x26')];}_0x28efa0[_0x55d2('0x19')](_0x2339bd)[_0x55d2('0x27')](_0x300c02);};}exports[_0x55d2('0x28')]=function(_0x461352,_0x29571d){var _0x1aa12c={},_0xab0b82={},_0x39f2e7={'count':0x0,'rows':[]};var _0x46b849=_['map'](db[_0x55d2('0x29')][_0x55d2('0x2a')],function(_0x46e0b2){return{'name':_0x46e0b2[_0x55d2('0x2b')],'type':_0x46e0b2[_0x55d2('0x2c')][_0x55d2('0x2d')]};});_0xab0b82['model']=_['map'](_0x46b849,_0x55d2('0x26'));_0xab0b82['query']=_[_0x55d2('0x2e')](_0x461352[_0x55d2('0x2f')]);_0xab0b82[_0x55d2('0x30')]=_[_0x55d2('0x31')](_0xab0b82['model'],_0xab0b82['query']);_0x1aa12c[_0x55d2('0x32')]=_['intersection'](_0xab0b82[_0x55d2('0x33')],qs['fields'](_0x461352[_0x55d2('0x2f')][_0x55d2('0x34')]));_0x1aa12c[_0x55d2('0x32')]=_0x1aa12c[_0x55d2('0x32')]['length']?_0x1aa12c[_0x55d2('0x32')]:_0xab0b82[_0x55d2('0x33')];if(!_0x461352[_0x55d2('0x2f')]['hasOwnProperty'](_0x55d2('0x35'))){_0x1aa12c[_0x55d2('0x1d')]=qs[_0x55d2('0x1d')](_0x461352[_0x55d2('0x2f')][_0x55d2('0x1d')]);_0x1aa12c[_0x55d2('0x1b')]=qs[_0x55d2('0x1b')](_0x461352[_0x55d2('0x2f')][_0x55d2('0x1b')]);}_0x1aa12c['order']=qs['sort'](_0x461352[_0x55d2('0x2f')]['sort']);_0x1aa12c[_0x55d2('0x36')]=qs[_0x55d2('0x30')](_['pick'](_0x461352[_0x55d2('0x2f')],_0xab0b82[_0x55d2('0x30')]),_0x46b849);if(_0x461352[_0x55d2('0x2f')][_0x55d2('0x37')]){_0x1aa12c[_0x55d2('0x36')]=_['merge'](_0x1aa12c[_0x55d2('0x36')],{'$or':_['map'](_0x46b849,function(_0x45cee2){if(_0x45cee2[_0x55d2('0x2c')]!==_0x55d2('0x38')){var _0x4bf190={};_0x4bf190[_0x45cee2[_0x55d2('0x26')]]={'$like':'%'+_0x461352['query']['filter']+'%'};return _0x4bf190;}})});}_0x1aa12c=_[_0x55d2('0x39')]({},_0x1aa12c,_0x461352[_0x55d2('0x3a')]);var _0x4a0fa4={'where':_0x1aa12c[_0x55d2('0x36')]};return db[_0x55d2('0x29')][_0x55d2('0x1e')](_0x4a0fa4)[_0x55d2('0x23')](function(_0x2ccdfa){_0x39f2e7[_0x55d2('0x1e')]=_0x2ccdfa;if(_0x461352[_0x55d2('0x2f')][_0x55d2('0x3b')]){_0x1aa12c[_0x55d2('0x3c')]=[{'all':!![]}];}return db[_0x55d2('0x29')][_0x55d2('0x3d')](_0x1aa12c);})[_0x55d2('0x23')](function(_0x1df5dd){_0x39f2e7[_0x55d2('0x3e')]=_0x1df5dd;return _0x39f2e7;})[_0x55d2('0x23')](respondWithFilteredResult(_0x29571d,_0x1aa12c))[_0x55d2('0x3f')](handleError(_0x29571d,null));};exports[_0x55d2('0x40')]=function(_0x3be8cd,_0x42b969){var _0x101f00={'raw':!![],'where':{'id':_0x3be8cd[_0x55d2('0x41')]['id']}},_0x5d260b={};_0x5d260b[_0x55d2('0x33')]=_[_0x55d2('0x2e')](db['ZendeskField'][_0x55d2('0x2a')]);_0x5d260b[_0x55d2('0x2f')]=_[_0x55d2('0x2e')](_0x3be8cd[_0x55d2('0x2f')]);_0x5d260b[_0x55d2('0x30')]=_[_0x55d2('0x31')](_0x5d260b['model'],_0x5d260b[_0x55d2('0x2f')]);_0x101f00[_0x55d2('0x32')]=_[_0x55d2('0x31')](_0x5d260b[_0x55d2('0x33')],qs[_0x55d2('0x34')](_0x3be8cd[_0x55d2('0x2f')][_0x55d2('0x34')]));_0x101f00[_0x55d2('0x32')]=_0x101f00[_0x55d2('0x32')]['length']?_0x101f00[_0x55d2('0x32')]:_0x5d260b['model'];if(_0x3be8cd['query'][_0x55d2('0x3b')]){_0x101f00[_0x55d2('0x3c')]=[{'all':!![]}];}_0x101f00=_[_0x55d2('0x39')]({},_0x101f00,_0x3be8cd[_0x55d2('0x3a')]);return db[_0x55d2('0x29')]['find'](_0x101f00)[_0x55d2('0x23')](handleEntityNotFound(_0x42b969,null))[_0x55d2('0x23')](respondWithResult(_0x42b969,null))[_0x55d2('0x3f')](handleError(_0x42b969,null));};exports['create']=function(_0x5ed333,_0x302230){return db[_0x55d2('0x29')][_0x55d2('0x42')](_0x5ed333[_0x55d2('0x43')],{})[_0x55d2('0x23')](respondWithResult(_0x302230,0xc9))['catch'](handleError(_0x302230,null));};exports[_0x55d2('0x22')]=function(_0x609df9,_0x21cfba){if(_0x609df9[_0x55d2('0x43')]['id']){delete _0x609df9['body']['id'];}return db[_0x55d2('0x29')][_0x55d2('0x44')]({'where':{'id':_0x609df9['params']['id']}})[_0x55d2('0x23')](handleEntityNotFound(_0x21cfba,null))['then'](saveUpdates(_0x609df9[_0x55d2('0x43')],null))[_0x55d2('0x23')](respondWithResult(_0x21cfba,null))['catch'](handleError(_0x21cfba,null));};exports[_0x55d2('0x45')]=function(_0x3dd8cc,_0x15fc5d){return db[_0x55d2('0x29')][_0x55d2('0x44')]({'where':{'id':_0x3dd8cc[_0x55d2('0x41')]['id']}})['then'](handleEntityNotFound(_0x15fc5d,null))['then'](removeEntity(_0x15fc5d,null))[_0x55d2('0x3f')](handleError(_0x15fc5d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 9db5bed..120f1c6 100644 --- a/server/api/intZendeskField/intZendeskField.model.js +++ b/server/api/intZendeskField/intZendeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd054=['zendesk_unique_index','idField','FieldId','api','moment','bluebird','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField'];(function(_0x10014d,_0xbbf813){var _0x36f353=function(_0x42430b){while(--_0x42430b){_0x10014d['push'](_0x10014d['shift']());}};_0x36f353(++_0xbbf813);}(_0xd054,0xff));var _0x4d05=function(_0x4715aa,_0xd40b42){_0x4715aa=_0x4715aa-0x0;var _0x30d071=_0xd054[_0x4715aa];return _0x30d071;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4d05('0x0'));var moment=require(_0x4d05('0x1'));var BPromise=require(_0x4d05('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4d05('0x3'));var config=require(_0x4d05('0x4'));var attributes=require(_0x4d05('0x5'));module[_0x4d05('0x6')]=function(_0x568369,_0x5dfb46){return _0x568369[_0x4d05('0x7')](_0x4d05('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x4d05('0x9'),'fields':[_0x4d05('0xa'),_0x4d05('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49d1=['moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','api'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x49d1,0x1ab));var _0x149d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x49d1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x149d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x149d('0x1'));var moment=require(_0x149d('0x2'));var BPromise=require(_0x149d('0x3'));var rp=require(_0x149d('0x4'));var fs=require('fs');var path=require(_0x149d('0x5'));var rimraf=require('rimraf');var config=require(_0x149d('0x6'));var attributes=require(_0x149d('0x7'));module['exports']=function(_0x504b55,_0x1fa6c8){return _0x504b55[_0x149d('0x8')](_0x149d('0x9'),attributes,{'tableName':_0x149d('0xa'),'paranoid':![],'indexes':[{'name':_0x149d('0xb'),'fields':['idField',_0x149d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 1f32a76..49e7578 100644 --- a/server/api/intZendeskField/intZendeskField.rpc.js +++ b/server/api/intZendeskField/intZendeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd005=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd005,0x19d));var _0x5d00=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd005[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5d00('0x0'));var util=require(_0x5d00('0x1'));var moment=require(_0x5d00('0x2'));var BPromise=require(_0x5d00('0x3'));var rs=require(_0x5d00('0x4'));var fs=require('fs');var Redis=require(_0x5d00('0x5'));var db=require(_0x5d00('0x6'))['db'];var utils=require(_0x5d00('0x7'));var logger=require(_0x5d00('0x8'))(_0x5d00('0x9'));var config=require(_0x5d00('0xa'));var jayson=require(_0x5d00('0xb'));var client=jayson[_0x5d00('0xc')][_0x5d00('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xf425cb,_0x326262,_0x13c819){return new BPromise(function(_0x45244,_0x46f026){return client[_0x5d00('0xe')](_0xf425cb,_0x13c819)[_0x5d00('0xf')](function(_0x3d14d6){logger[_0x5d00('0x10')](_0x5d00('0x11'),_0x326262,'request\x20sent');logger[_0x5d00('0x12')](_0x5d00('0x13'),_0x326262,_0x5d00('0x14'),JSON[_0x5d00('0x15')](_0x3d14d6));if(_0x3d14d6['error']){if(_0x3d14d6[_0x5d00('0x16')][_0x5d00('0x17')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x326262,_0x3d14d6['error'][_0x5d00('0x18')]);return _0x46f026(_0x3d14d6[_0x5d00('0x16')][_0x5d00('0x18')]);}logger['error'](_0x5d00('0x11'),_0x326262,_0x3d14d6[_0x5d00('0x16')][_0x5d00('0x18')]);return _0x45244(_0x3d14d6[_0x5d00('0x16')][_0x5d00('0x18')]);}else{logger['info'](_0x5d00('0x11'),_0x326262,_0x5d00('0x14'));_0x45244(_0x3d14d6['result'][_0x5d00('0x18')]);}})[_0x5d00('0x19')](function(_0x130bf3){logger['error'](_0x5d00('0x11'),_0x326262,_0x130bf3);_0x46f026(_0x130bf3);});});} \ No newline at end of file +var _0x55d2=['stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x4d2938,_0x332d65){var _0x5e7d9b=function(_0x135e24){while(--_0x135e24){_0x4d2938['push'](_0x4d2938['shift']());}};_0x5e7d9b(++_0x332d65);}(_0x55d2,0x70));var _0x255d=function(_0x1a8207,_0x576621){_0x1a8207=_0x1a8207-0x0;var _0x4bc774=_0x55d2[_0x1a8207];return _0x4bc774;};'use strict';var _=require(_0x255d('0x0'));var util=require(_0x255d('0x1'));var moment=require(_0x255d('0x2'));var BPromise=require(_0x255d('0x3'));var rs=require(_0x255d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x255d('0x5'))(_0x255d('0x6'));var config=require('../../config/environment');var jayson=require(_0x255d('0x7'));var client=jayson[_0x255d('0x8')][_0x255d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x336087,_0x532067,_0x2de9c3){return new BPromise(function(_0x14f479,_0x187070){return client[_0x255d('0xa')](_0x336087,_0x2de9c3)['then'](function(_0x624577){logger[_0x255d('0xb')]('ZendeskField,\x20%s,\x20%s',_0x532067,_0x255d('0xc'));logger[_0x255d('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x532067,'request\x20sent',JSON[_0x255d('0xe')](_0x624577));if(_0x624577[_0x255d('0xf')]){if(_0x624577[_0x255d('0xf')][_0x255d('0x10')]===0x1f4){logger[_0x255d('0xf')](_0x255d('0x11'),_0x532067,_0x624577[_0x255d('0xf')]['message']);return _0x187070(_0x624577[_0x255d('0xf')][_0x255d('0x12')]);}logger[_0x255d('0xf')]('ZendeskField,\x20%s,\x20%s',_0x532067,_0x624577[_0x255d('0xf')]['message']);return _0x14f479(_0x624577[_0x255d('0xf')][_0x255d('0x12')]);}else{logger[_0x255d('0xb')](_0x255d('0x11'),_0x532067,'request\x20sent');_0x14f479(_0x624577[_0x255d('0x13')]['message']);}})[_0x255d('0x14')](function(_0x56909d){logger[_0x255d('0xf')]('ZendeskField,\x20%s,\x20%s',_0x532067,_0x56909d);_0x187070(_0x56909d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 67f4d09..076b46b 100644 --- a/server/api/intZohoAccount/index.js +++ b/server/api/intZohoAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bf7=['update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','put'];(function(_0x5736de,_0x5cd852){var _0x5cee34=function(_0x5b6e59){while(--_0x5b6e59){_0x5736de['push'](_0x5736de['shift']());}};_0x5cee34(++_0x5cd852);}(_0x5bf7,0x7b));var _0x75bf=function(_0x4c71b4,_0x44f0c7){_0x4c71b4=_0x4c71b4-0x0;var _0x4b1102=_0x5bf7[_0x4c71b4];return _0x4b1102;};'use strict';var multer=require('multer');var util=require(_0x75bf('0x0'));var path=require('path');var timeout=require(_0x75bf('0x1'));var express=require('express');var router=express[_0x75bf('0x2')]();var fs_extra=require(_0x75bf('0x3'));var auth=require(_0x75bf('0x4'));var interaction=require(_0x75bf('0x5'));var config=require('../../config/environment');var controller=require(_0x75bf('0x6'));router['get']('/',auth[_0x75bf('0x7')](),controller['index']);router[_0x75bf('0x8')](_0x75bf('0x9'),auth[_0x75bf('0x7')](),controller[_0x75bf('0xa')]);router[_0x75bf('0x8')]('/:id/configurations',auth[_0x75bf('0x7')](),controller['getConfigurations']);router['get'](_0x75bf('0xb'),auth['isAuthenticated'](),controller[_0x75bf('0xc')]);router[_0x75bf('0xd')]('/',auth[_0x75bf('0x7')](),controller[_0x75bf('0xe')]);router['post'](_0x75bf('0xf'),auth[_0x75bf('0x7')](),controller['addConfiguration']);router[_0x75bf('0x10')](_0x75bf('0x9'),auth[_0x75bf('0x7')](),controller[_0x75bf('0x11')]);router[_0x75bf('0x12')](_0x75bf('0x9'),auth[_0x75bf('0x7')](),controller['destroy']);module[_0x75bf('0x13')]=router; \ No newline at end of file +var _0xaa30=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller'];(function(_0x126b00,_0x5bd297){var _0xa6bd2d=function(_0xe1c709){while(--_0xe1c709){_0x126b00['push'](_0x126b00['shift']());}};_0xa6bd2d(++_0x5bd297);}(_0xaa30,0x1c3));var _0x0aa3=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xaa30[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0aa3('0x0'));var util=require(_0x0aa3('0x1'));var path=require(_0x0aa3('0x2'));var timeout=require('connect-timeout');var express=require(_0x0aa3('0x3'));var router=express['Router']();var fs_extra=require(_0x0aa3('0x4'));var auth=require(_0x0aa3('0x5'));var interaction=require(_0x0aa3('0x6'));var config=require(_0x0aa3('0x7'));var controller=require(_0x0aa3('0x8'));router[_0x0aa3('0x9')]('/',auth[_0x0aa3('0xa')](),controller[_0x0aa3('0xb')]);router[_0x0aa3('0x9')](_0x0aa3('0xc'),auth[_0x0aa3('0xa')](),controller['show']);router[_0x0aa3('0x9')](_0x0aa3('0xd'),auth[_0x0aa3('0xa')](),controller[_0x0aa3('0xe')]);router['get']('/:id/fields',auth[_0x0aa3('0xa')](),controller[_0x0aa3('0xf')]);router[_0x0aa3('0x10')]('/',auth[_0x0aa3('0xa')](),controller[_0x0aa3('0x11')]);router[_0x0aa3('0x10')](_0x0aa3('0xd'),auth[_0x0aa3('0xa')](),controller[_0x0aa3('0x12')]);router[_0x0aa3('0x13')](_0x0aa3('0xc'),auth[_0x0aa3('0xa')](),controller[_0x0aa3('0x14')]);router[_0x0aa3('0x15')](_0x0aa3('0xc'),auth[_0x0aa3('0xa')](),controller[_0x0aa3('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 2d7fba8..7a06b35 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84ab=['sequelize','exports','STRING'];(function(_0x239e77,_0x3d19ed){var _0x2a99dc=function(_0x4aa976){while(--_0x4aa976){_0x239e77['push'](_0x239e77['shift']());}};_0x2a99dc(++_0x3d19ed);}(_0x84ab,0x12f));var _0xb84a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x84ab[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'name':{'type':Sequelize[_0xb84a('0x2')]},'description':{'type':Sequelize[_0xb84a('0x2')]},'host':{'type':Sequelize[_0xb84a('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb84a('0x2')]},'clientSecret':{'type':Sequelize[_0xb84a('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb84a('0x2')]},'refreshToken':{'type':Sequelize[_0xb84a('0x2')]}}; \ No newline at end of file +var _0x153f=['exports','STRING','sequelize'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x153f,0x15b));var _0xf153=function(_0x21d350,_0x2ee05d){_0x21d350=_0x21d350-0x0;var _0x4545a8=_0x153f[_0x21d350];return _0x4545a8;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'name':{'type':Sequelize[_0xf153('0x2')]},'description':{'type':Sequelize[_0xf153('0x2')]},'host':{'type':Sequelize[_0xf153('0x2')]},'zone':{'type':Sequelize[_0xf153('0x2')]},'clientId':{'type':Sequelize[_0xf153('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf153('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xf153('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 67a329a..f057db2 100644 --- a/server/api/intZohoAccount/intZohoAccount.controller.js +++ b/server/api/intZohoAccount/intZohoAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00b1=['../../config/utils','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','then','includeAll','include','findAll','rows','show','params','options','find','create','catch','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','data_type','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3690f3,_0x5245bf){var _0x3539e3=function(_0x4882c9){while(--_0x4882c9){_0x3690f3['push'](_0x3690f3['shift']());}};_0x3539e3(++_0x5245bf);}(_0x00b1,0x1f0));var _0x100b=function(_0x47f3f3,_0x3c1a42){_0x47f3f3=_0x47f3f3-0x0;var _0x333e78=_0x00b1[_0x47f3f3];return _0x333e78;};'use strict';var emlformat=require(_0x100b('0x0'));var rimraf=require(_0x100b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x100b('0x2'));var rp=require(_0x100b('0x3'));var moment=require(_0x100b('0x4'));var BPromise=require(_0x100b('0x5'));var Mustache=require(_0x100b('0x6'));var util=require('util');var path=require(_0x100b('0x7'));var sox=require(_0x100b('0x8'));var csv=require('to-csv');var ejs=require(_0x100b('0x9'));var fs=require('fs');var fs_extra=require(_0x100b('0xa'));var _=require(_0x100b('0xb'));var squel=require(_0x100b('0xc'));var crypto=require(_0x100b('0xd'));var jsforce=require(_0x100b('0xe'));var deskjs=require(_0x100b('0xf'));var toCsv=require(_0x100b('0x10'));var querystring=require('querystring');var Papa=require(_0x100b('0x11'));var Redis=require(_0x100b('0x12'));var authService=require(_0x100b('0x13'));var qs=require(_0x100b('0x14'));var as=require(_0x100b('0x15'));var hardwareService=require(_0x100b('0x16'));var logger=require('../../config/logger')(_0x100b('0x17'));var utils=require(_0x100b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x100b('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x239cbb,_0x3b2b06){_0x3b2b06=_0x3b2b06||0xcc;return function(_0x1788bd){if(_0x1788bd){return _0x239cbb[_0x100b('0x1a')](_0x3b2b06);}return _0x239cbb['status'](_0x3b2b06)[_0x100b('0x1b')]();};}function respondWithResult(_0x5b61b3,_0x3b278f){_0x3b278f=_0x3b278f||0xc8;return function(_0x5a9341){if(_0x5a9341){return _0x5b61b3[_0x100b('0x1c')](_0x3b278f)[_0x100b('0x1d')](_0x5a9341);}};}function respondWithFilteredResult(_0x17890b,_0x8e9dc3){return function(_0x2b9291){if(_0x2b9291){var _0x422a65=typeof _0x8e9dc3['offset']===_0x100b('0x1e')&&typeof _0x8e9dc3[_0x100b('0x1f')]==='undefined';var _0x48297a=_0x2b9291[_0x100b('0x20')];var _0x3a79d2=_0x422a65?0x0:_0x8e9dc3['offset'];var _0x35839e=_0x422a65?_0x2b9291[_0x100b('0x20')]:_0x8e9dc3[_0x100b('0x21')]+_0x8e9dc3['limit'];var _0xe821e9;if(_0x35839e>=_0x48297a){_0x35839e=_0x48297a;_0xe821e9=0xc8;}else{_0xe821e9=0xce;}_0x17890b[_0x100b('0x1c')](_0xe821e9);return _0x17890b[_0x100b('0x22')](_0x100b('0x23'),_0x3a79d2+'-'+_0x35839e+'/'+_0x48297a)[_0x100b('0x1d')](_0x2b9291);}return null;};}function patchUpdates(_0xcbe094){return function(_0x2ce5f0){try{jsonpatch[_0x100b('0x24')](_0x2ce5f0,_0xcbe094,!![]);}catch(_0x46960d){return BPromise['reject'](_0x46960d);}return _0x2ce5f0[_0x100b('0x25')]();};}function saveUpdates(_0x435b59,_0x4231b4){return function(_0x190838){if(_0x190838){return _0x190838[_0x100b('0x26')](_0x435b59)['then'](function(_0x43e35c){return _0x43e35c;});}return null;};}function removeEntity(_0x56c97d,_0x125775){return function(_0x502160){if(_0x502160){return _0x502160[_0x100b('0x27')]()['then'](function(){_0x56c97d['status'](0xcc)[_0x100b('0x1b')]();});}};}function handleEntityNotFound(_0x546941,_0xb1dbd7){return function(_0xc85cff){if(!_0xc85cff){_0x546941[_0x100b('0x1a')](0x194);}return _0xc85cff;};}function handleError(_0x437f69,_0x1f6a21){_0x1f6a21=_0x1f6a21||0x1f4;return function(_0x4dfa5b){logger['error'](_0x4dfa5b[_0x100b('0x28')]);if(_0x4dfa5b[_0x100b('0x29')]){delete _0x4dfa5b['name'];}_0x437f69[_0x100b('0x1c')](_0x1f6a21)['send'](_0x4dfa5b);};}exports[_0x100b('0x2a')]=function(_0x5d191f,_0x2300ce){var _0x4d6637={},_0x30c57f={},_0x55a320={'count':0x0,'rows':[]};var _0x1e7e10=_[_0x100b('0x2b')](db[_0x100b('0x2c')][_0x100b('0x2d')],function(_0x140d33){return{'name':_0x140d33[_0x100b('0x2e')],'type':_0x140d33[_0x100b('0x2f')]['key']};});_0x30c57f[_0x100b('0x30')]=_['map'](_0x1e7e10,'name');_0x30c57f[_0x100b('0x31')]=_[_0x100b('0x32')](_0x5d191f[_0x100b('0x31')]);_0x30c57f[_0x100b('0x33')]=_[_0x100b('0x34')](_0x30c57f[_0x100b('0x30')],_0x30c57f['query']);_0x4d6637[_0x100b('0x35')]=_[_0x100b('0x34')](_0x30c57f['model'],qs[_0x100b('0x36')](_0x5d191f[_0x100b('0x31')][_0x100b('0x36')]));_0x4d6637[_0x100b('0x35')]=_0x4d6637['attributes'][_0x100b('0x37')]?_0x4d6637[_0x100b('0x35')]:_0x30c57f[_0x100b('0x30')];if(!_0x5d191f[_0x100b('0x31')][_0x100b('0x38')](_0x100b('0x39'))){_0x4d6637['limit']=qs['limit'](_0x5d191f[_0x100b('0x31')][_0x100b('0x1f')]);_0x4d6637[_0x100b('0x21')]=qs[_0x100b('0x21')](_0x5d191f[_0x100b('0x31')][_0x100b('0x21')]);}_0x4d6637[_0x100b('0x3a')]=qs['sort'](_0x5d191f[_0x100b('0x31')][_0x100b('0x3b')]);_0x4d6637[_0x100b('0x3c')]=qs[_0x100b('0x33')](_[_0x100b('0x3d')](_0x5d191f['query'],_0x30c57f[_0x100b('0x33')]),_0x1e7e10);if(_0x5d191f[_0x100b('0x31')]['filter']){_0x4d6637[_0x100b('0x3c')]=_['merge'](_0x4d6637['where'],{'$or':_[_0x100b('0x2b')](_0x1e7e10,function(_0x2509d7){if(_0x2509d7[_0x100b('0x2f')]!=='VIRTUAL'){var _0x17b611={};_0x17b611[_0x2509d7[_0x100b('0x29')]]={'$like':'%'+_0x5d191f[_0x100b('0x31')][_0x100b('0x3e')]+'%'};return _0x17b611;}})});}_0x4d6637=_[_0x100b('0x3f')]({},_0x4d6637,_0x5d191f['options']);var _0x16e600={'where':_0x4d6637[_0x100b('0x3c')]};return db[_0x100b('0x2c')][_0x100b('0x20')](_0x16e600)[_0x100b('0x40')](function(_0x5afeef){_0x55a320[_0x100b('0x20')]=_0x5afeef;if(_0x5d191f[_0x100b('0x31')][_0x100b('0x41')]){_0x4d6637[_0x100b('0x42')]=[{'all':!![]}];}return db[_0x100b('0x2c')][_0x100b('0x43')](_0x4d6637);})[_0x100b('0x40')](function(_0x38a3d6){_0x55a320[_0x100b('0x44')]=_0x38a3d6;return _0x55a320;})[_0x100b('0x40')](respondWithFilteredResult(_0x2300ce,_0x4d6637))['catch'](handleError(_0x2300ce,null));};exports[_0x100b('0x45')]=function(_0x12f869,_0x3c8ff8){var _0x46031b={'raw':![],'where':{'id':_0x12f869[_0x100b('0x46')]['id']}},_0x3a5e68={};_0x3a5e68[_0x100b('0x30')]=_[_0x100b('0x32')](db[_0x100b('0x2c')][_0x100b('0x2d')]);_0x3a5e68[_0x100b('0x31')]=_[_0x100b('0x32')](_0x12f869[_0x100b('0x31')]);_0x3a5e68['filters']=_[_0x100b('0x34')](_0x3a5e68[_0x100b('0x30')],_0x3a5e68[_0x100b('0x31')]);_0x46031b[_0x100b('0x35')]=_[_0x100b('0x34')](_0x3a5e68[_0x100b('0x30')],qs['fields'](_0x12f869[_0x100b('0x31')]['fields']));_0x46031b[_0x100b('0x35')]=_0x46031b[_0x100b('0x35')][_0x100b('0x37')]?_0x46031b['attributes']:_0x3a5e68[_0x100b('0x30')];if(_0x12f869['query'][_0x100b('0x41')]){_0x46031b[_0x100b('0x42')]=[{'all':!![]}];}_0x46031b=_[_0x100b('0x3f')]({},_0x46031b,_0x12f869[_0x100b('0x47')]);return db['ZohoAccount'][_0x100b('0x48')](_0x46031b)['then'](handleEntityNotFound(_0x3c8ff8,null))[_0x100b('0x40')](respondWithResult(_0x3c8ff8,null))['catch'](handleError(_0x3c8ff8,null));};exports[_0x100b('0x49')]=function(_0x3c1936,_0xb29487){return db[_0x100b('0x2c')][_0x100b('0x49')](_0x3c1936['body'],{})[_0x100b('0x40')](respondWithResult(_0xb29487,0xc9))[_0x100b('0x4a')](handleError(_0xb29487,null));};exports[_0x100b('0x26')]=function(_0x11a912,_0x5949e3){if(_0x11a912[_0x100b('0x4b')]['id']){delete _0x11a912[_0x100b('0x4b')]['id'];}return db[_0x100b('0x2c')]['find']({'where':{'id':_0x11a912[_0x100b('0x46')]['id']}})[_0x100b('0x40')](handleEntityNotFound(_0x5949e3,null))['then'](saveUpdates(_0x11a912['body'],null))[_0x100b('0x40')](respondWithResult(_0x5949e3,null))['catch'](handleError(_0x5949e3,null));};exports['destroy']=function(_0x57ae25,_0x2b1700){return db['ZohoAccount'][_0x100b('0x48')]({'where':{'id':_0x57ae25[_0x100b('0x46')]['id']}})[_0x100b('0x40')](handleEntityNotFound(_0x2b1700,null))[_0x100b('0x40')](removeEntity(_0x2b1700,null))['catch'](handleError(_0x2b1700,null));};exports[_0x100b('0x4c')]=function(_0x41781a,_0x4e73b7,_0x40019f){var _0x1d844d={};var _0x2bb3cb={};var _0x18931e;var _0x3212da;return db['ZohoAccount'][_0x100b('0x4d')]({'where':{'id':_0x41781a['params']['id']}})['then'](handleEntityNotFound(_0x4e73b7,null))[_0x100b('0x40')](function(_0x19b8ba){if(_0x19b8ba){_0x18931e=_0x19b8ba;_0x2bb3cb[_0x100b('0x30')]=_[_0x100b('0x32')](db['ZohoConfiguration'][_0x100b('0x2d')]);_0x2bb3cb['query']=_[_0x100b('0x32')](_0x41781a[_0x100b('0x31')]);_0x2bb3cb[_0x100b('0x33')]=_[_0x100b('0x34')](_0x2bb3cb[_0x100b('0x30')],_0x2bb3cb[_0x100b('0x31')]);_0x1d844d[_0x100b('0x35')]=_['intersection'](_0x2bb3cb[_0x100b('0x30')],qs[_0x100b('0x36')](_0x41781a['query'][_0x100b('0x36')]));_0x1d844d[_0x100b('0x35')]=_0x1d844d[_0x100b('0x35')]['length']?_0x1d844d[_0x100b('0x35')]:_0x2bb3cb['model'];_0x1d844d[_0x100b('0x3a')]=qs[_0x100b('0x3b')](_0x41781a[_0x100b('0x31')][_0x100b('0x3b')]);_0x1d844d['where']=qs[_0x100b('0x33')](_[_0x100b('0x3d')](_0x41781a[_0x100b('0x31')],_0x2bb3cb[_0x100b('0x33')]));if(_0x41781a[_0x100b('0x31')][_0x100b('0x3e')]){_0x1d844d[_0x100b('0x3c')]=_['merge'](_0x1d844d[_0x100b('0x3c')],{'$or':_[_0x100b('0x2b')](_0x1d844d[_0x100b('0x35')],function(_0x14b9f5){var _0x44d294={};_0x44d294[_0x14b9f5]={'$like':'%'+_0x41781a[_0x100b('0x31')][_0x100b('0x3e')]+'%'};return _0x44d294;})});}_0x1d844d=_['merge']({},_0x1d844d,_0x41781a[_0x100b('0x47')]);return _0x18931e['getConfigurations'](_0x1d844d);}})[_0x100b('0x40')](function(_0x4124ac){if(_0x4124ac){_0x3212da=_0x4124ac[_0x100b('0x37')];if(!_0x41781a['query'][_0x100b('0x38')](_0x100b('0x39'))){_0x1d844d[_0x100b('0x1f')]=qs[_0x100b('0x1f')](_0x41781a[_0x100b('0x31')][_0x100b('0x1f')]);_0x1d844d[_0x100b('0x21')]=qs[_0x100b('0x21')](_0x41781a[_0x100b('0x31')]['offset']);}return _0x18931e[_0x100b('0x4c')](_0x1d844d);}})[_0x100b('0x40')](function(_0x57537a){if(_0x57537a){return _0x57537a?{'count':_0x3212da,'rows':_0x57537a}:null;}})[_0x100b('0x40')](respondWithResult(_0x4e73b7,null))[_0x100b('0x4a')](handleError(_0x4e73b7,null));};exports[_0x100b('0x4e')]=function(_0x1af77d,_0x4efded,_0x541a99){if(_0x1af77d[_0x100b('0x4b')]['id']){delete _0x1af77d['body']['id'];}return db[_0x100b('0x2c')][_0x100b('0x4d')]({'where':{'id':_0x1af77d[_0x100b('0x46')]['id']}})[_0x100b('0x40')](handleEntityNotFound(_0x4efded,null))[_0x100b('0x40')](function(_0x1eb70f){if(_0x1eb70f){_0x1af77d[_0x100b('0x4b')][_0x100b('0x4f')]=_0x1eb70f['id'];_0x1af77d[_0x100b('0x4b')][_0x100b('0x50')]=integrations[_0x100b('0x51')](_0x1af77d[_0x100b('0x4b')]['channel'],_0x1af77d[_0x100b('0x4b')][_0x100b('0x2f')]);_0x1af77d['body'][_0x100b('0x52')]=integrations['getDescriptions'](_0x1af77d[_0x100b('0x4b')][_0x100b('0x53')],_0x1af77d['body'][_0x100b('0x2f')]);return db[_0x100b('0x54')][_0x100b('0x49')](_0x1af77d[_0x100b('0x4b')],{'include':[{'model':db['ZohoField'],'as':_0x100b('0x50')},{'model':db[_0x100b('0x55')],'as':_0x100b('0x52')}]});}return null;})[_0x100b('0x40')](respondWithResult(_0x4efded,null))['catch'](handleError(_0x4efded,null));};function getAccessToken(_0x439b7b){return new Promise(function(_0x282163,_0x368791){var _0x5c4343;switch(_0x439b7b[_0x100b('0x56')]){case'US':_0x5c4343=_0x100b('0x57');break;case'AU':_0x5c4343='https://accounts.zoho.com.au';break;case'EU':_0x5c4343=_0x100b('0x58');break;case'IN':_0x5c4343=_0x100b('0x59');break;case'CN':_0x5c4343=_0x100b('0x5a');break;default:_0x5c4343='https://accounts.zoho.eu';break;}var _0x373324={'method':'POST','uri':_0x5c4343+'/oauth/v2/token','qs':{'refresh_token':_0x439b7b['refreshToken'],'client_id':_0x439b7b[_0x100b('0x5b')],'client_secret':_0x439b7b['clientSecret'],'grant_type':_0x100b('0x5c')},'json':!![]};return rp(_0x373324)['then'](function(_0x37a923){if(_0x37a923[_0x100b('0x5d')]){_0x282163(_0x37a923[_0x100b('0x5d')]);}else{_0x368791(_0x100b('0x5e'));}})[_0x100b('0x4a')](function(_0x3104c1){_0x368791(_0x3104c1);});});}exports[_0x100b('0x5f')]=function(_0x15e9bb,_0x38ad49,_0xd641b8){var _0x95155e,_0x4efeb4,_0x3940b2,_0x16873a,_0x378331;return db[_0x100b('0x2c')][_0x100b('0x4d')]({'where':{'id':_0x15e9bb[_0x100b('0x46')]['id']},'attributes':['id',_0x100b('0x60'),_0x100b('0x56'),_0x100b('0x5b'),_0x100b('0x61'),_0x100b('0x62'),_0x100b('0x63'),'refreshToken']})['then'](handleEntityNotFound(_0x38ad49,null))[_0x100b('0x40')](function(_0x43b77e){_0x378331=_0x43b77e;_0x95155e=_0x378331[_0x100b('0x60')];_0x4efeb4=_0x95155e==='zoho.eu'?'eu':_0x100b('0x64');_0x3940b2=_0x378331[_0x100b('0x62')];var _0x20fbeb=_0x3940b2[_0x100b('0x65')](-0x1);if(_0x20fbeb==='/'||_0x20fbeb==='\x5c'||_0x20fbeb===':'){_0x3940b2=_0x3940b2[_0x100b('0x66')](0x0,_0x3940b2[_0x100b('0x67')](_0x20fbeb));}if(!_0x378331['refreshToken']){throw new Error(_0x100b('0x68'));}return getAccessToken(_0x378331);})[_0x100b('0x40')](function(_0x255357){if(_0x255357){return rp({'method':_0x100b('0x69'),'uri':util[_0x100b('0x6a')](_0x100b('0x6b'),_0x4efeb4),'qs':{'module':_0x100b('0x6c')},'headers':{'Authorization':_0x100b('0x6d')+_0x255357},'json':!![]});}})['then'](function(_0x55359c){if(_0x55359c){if(_0x55359c[_0x100b('0x6e')]&&_0x55359c[_0x100b('0x6e')][_0x100b('0x6f')]){throw new Error(_0x55359c[_0x100b('0x6e')][_0x100b('0x6f')][_0x100b('0x70')]);}var _0x9d3770=[];var _0x54fd83=[];var _0x4b5a58=[_0x100b('0x71'),_0x100b('0x72'),'Description','WhoId',_0x100b('0x73'),_0x100b('0x74'),_0x100b('0x75'),_0x100b('0x76')];_0x54fd83=_[_0x100b('0x77')](_0x55359c[_0x100b('0x36')],function(_0x45405a){return _0x4b5a58[_0x100b('0x78')](_0x45405a['api_name']);});for(var _0x2c64bb=0x0;_0x2c64bb<_0x54fd83[_0x100b('0x37')];_0x2c64bb++){if(_0x54fd83[_0x2c64bb][_0x100b('0x79')]===![]){_0x9d3770['push']({'id':_0x54fd83[_0x2c64bb]['id'],'name':_0x54fd83[_0x2c64bb]['display_label'],'custom':_0x54fd83[_0x2c64bb]['custom_field'],'options':_0x54fd83[_0x2c64bb][_0x100b('0x7a')]===_0x100b('0x7b')&&_0x54fd83[_0x2c64bb][_0x100b('0x7c')][_0x100b('0x37')]>-0x1?_[_0x100b('0x2b')](_0x54fd83[_0x2c64bb][_0x100b('0x7c')],function(_0x54ca37){return{'name':_0x54ca37,'value':_0x54ca37};}):[]});}}return{'count':_0x9d3770['length'],'rows':_0x9d3770};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x38ad49,null))['catch'](function(_0x4adf0c){var _0x2558af=_0x15e9bb[_0x100b('0x31')][_0x100b('0x7d')]?0x1f4:_0x4adf0c[_0x100b('0x7e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x100b('0x5f'),_0x2558af,JSON[_0x100b('0x7f')](_0x4adf0c));delete _0x4adf0c[_0x100b('0x29')];if(_0x2558af===0x191){_0x2558af=0x190;}_0x38ad49[_0x100b('0x1c')](_0x2558af)[_0x100b('0x80')](_0x15e9bb['query']['test']?{'message':_0x100b('0x81'),'statusCode':_0x4adf0c[_0x100b('0x7e')]}:_0x4adf0c);});}; \ No newline at end of file +var _0x325f=['then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','rows','catch','show','keys','ZohoAccount','create','body','find','params','getConfigurations','findOne','ZohoConfiguration','pick','nolimit','addConfiguration','AccountId','Descriptions','getDescriptions','channel','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','refreshToken','zoho.eu','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','apply','save','update'];(function(_0x40c3b,_0x320f73){var _0x118c58=function(_0x13dad9){while(--_0x13dad9){_0x40c3b['push'](_0x40c3b['shift']());}};_0x118c58(++_0x320f73);}(_0x325f,0x161));var _0xf325=function(_0x4fcbc4,_0x43f789){_0x4fcbc4=_0x4fcbc4-0x0;var _0x2a2c23=_0x325f[_0x4fcbc4];return _0x2a2c23;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf325('0x0'));var zipdir=require(_0xf325('0x1'));var jsonpatch=require(_0xf325('0x2'));var rp=require(_0xf325('0x3'));var moment=require(_0xf325('0x4'));var BPromise=require(_0xf325('0x5'));var Mustache=require(_0xf325('0x6'));var util=require(_0xf325('0x7'));var path=require(_0xf325('0x8'));var sox=require(_0xf325('0x9'));var csv=require(_0xf325('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf325('0xb'));var _=require(_0xf325('0xc'));var squel=require(_0xf325('0xd'));var crypto=require('crypto');var jsforce=require(_0xf325('0xe'));var deskjs=require(_0xf325('0xf'));var toCsv=require(_0xf325('0xa'));var querystring=require(_0xf325('0x10'));var Papa=require(_0xf325('0x11'));var Redis=require(_0xf325('0x12'));var authService=require(_0xf325('0x13'));var qs=require(_0xf325('0x14'));var as=require(_0xf325('0x15'));var hardwareService=require(_0xf325('0x16'));var logger=require(_0xf325('0x17'))(_0xf325('0x18'));var utils=require(_0xf325('0x19'));var config=require(_0xf325('0x1a'));var licenseUtil=require(_0xf325('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf325('0x1c'));function respondWithStatusCode(_0x3807aa,_0x18614c){_0x18614c=_0x18614c||0xcc;return function(_0x1c9ec1){if(_0x1c9ec1){return _0x3807aa[_0xf325('0x1d')](_0x18614c);}return _0x3807aa['status'](_0x18614c)[_0xf325('0x1e')]();};}function respondWithResult(_0x47d0b5,_0x42942a){_0x42942a=_0x42942a||0xc8;return function(_0x5a587d){if(_0x5a587d){return _0x47d0b5[_0xf325('0x1f')](_0x42942a)[_0xf325('0x20')](_0x5a587d);}};}function respondWithFilteredResult(_0x4b36da,_0x340c06){return function(_0x1d285b){if(_0x1d285b){var _0x2bb335=typeof _0x340c06[_0xf325('0x21')]===_0xf325('0x22')&&typeof _0x340c06['limit']===_0xf325('0x22');var _0x28d7ef=_0x1d285b[_0xf325('0x23')];var _0x1bcde2=_0x2bb335?0x0:_0x340c06[_0xf325('0x21')];var _0x50de34=_0x2bb335?_0x1d285b['count']:_0x340c06[_0xf325('0x21')]+_0x340c06[_0xf325('0x24')];var _0x58a861;if(_0x50de34>=_0x28d7ef){_0x50de34=_0x28d7ef;_0x58a861=0xc8;}else{_0x58a861=0xce;}_0x4b36da['status'](_0x58a861);return _0x4b36da['set']('Content-Range',_0x1bcde2+'-'+_0x50de34+'/'+_0x28d7ef)[_0xf325('0x20')](_0x1d285b);}return null;};}function patchUpdates(_0xc2997){return function(_0x283956){try{jsonpatch[_0xf325('0x25')](_0x283956,_0xc2997,!![]);}catch(_0x174700){return BPromise['reject'](_0x174700);}return _0x283956[_0xf325('0x26')]();};}function saveUpdates(_0xa8d38b,_0x216870){return function(_0x2aa4cf){if(_0x2aa4cf){return _0x2aa4cf[_0xf325('0x27')](_0xa8d38b)[_0xf325('0x28')](function(_0x31dd17){return _0x31dd17;});}return null;};}function removeEntity(_0x274d70,_0x455e41){return function(_0x167e19){if(_0x167e19){return _0x167e19[_0xf325('0x29')]()[_0xf325('0x28')](function(){_0x274d70[_0xf325('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ceedf,_0x48d505){return function(_0x263b4c){if(!_0x263b4c){_0x5ceedf['sendStatus'](0x194);}return _0x263b4c;};}function handleError(_0x4782db,_0x57776e){_0x57776e=_0x57776e||0x1f4;return function(_0x5de7e1){logger[_0xf325('0x2a')](_0x5de7e1[_0xf325('0x2b')]);if(_0x5de7e1[_0xf325('0x2c')]){delete _0x5de7e1['name'];}_0x4782db[_0xf325('0x1f')](_0x57776e)[_0xf325('0x2d')](_0x5de7e1);};}exports[_0xf325('0x2e')]=function(_0x33ca91,_0x4ace9a){var _0x34b17b={},_0x2aa3bd={},_0x165c0e={'count':0x0,'rows':[]};var _0x7855af=_[_0xf325('0x2f')](db['ZohoAccount'][_0xf325('0x30')],function(_0x563d6d){return{'name':_0x563d6d[_0xf325('0x31')],'type':_0x563d6d[_0xf325('0x32')][_0xf325('0x33')]};});_0x2aa3bd[_0xf325('0x34')]=_[_0xf325('0x2f')](_0x7855af,'name');_0x2aa3bd['query']=_['keys'](_0x33ca91[_0xf325('0x35')]);_0x2aa3bd[_0xf325('0x36')]=_[_0xf325('0x37')](_0x2aa3bd[_0xf325('0x34')],_0x2aa3bd[_0xf325('0x35')]);_0x34b17b[_0xf325('0x38')]=_[_0xf325('0x37')](_0x2aa3bd[_0xf325('0x34')],qs[_0xf325('0x39')](_0x33ca91[_0xf325('0x35')]['fields']));_0x34b17b[_0xf325('0x38')]=_0x34b17b[_0xf325('0x38')][_0xf325('0x3a')]?_0x34b17b[_0xf325('0x38')]:_0x2aa3bd[_0xf325('0x34')];if(!_0x33ca91[_0xf325('0x35')][_0xf325('0x3b')]('nolimit')){_0x34b17b[_0xf325('0x24')]=qs['limit'](_0x33ca91['query'][_0xf325('0x24')]);_0x34b17b[_0xf325('0x21')]=qs[_0xf325('0x21')](_0x33ca91[_0xf325('0x35')][_0xf325('0x21')]);}_0x34b17b['order']=qs[_0xf325('0x3c')](_0x33ca91[_0xf325('0x35')][_0xf325('0x3c')]);_0x34b17b[_0xf325('0x3d')]=qs[_0xf325('0x36')](_['pick'](_0x33ca91[_0xf325('0x35')],_0x2aa3bd[_0xf325('0x36')]),_0x7855af);if(_0x33ca91['query'][_0xf325('0x3e')]){_0x34b17b[_0xf325('0x3d')]=_[_0xf325('0x3f')](_0x34b17b['where'],{'$or':_[_0xf325('0x2f')](_0x7855af,function(_0x38f030){if(_0x38f030[_0xf325('0x32')]!=='VIRTUAL'){var _0x3059aa={};_0x3059aa[_0x38f030[_0xf325('0x2c')]]={'$like':'%'+_0x33ca91[_0xf325('0x35')][_0xf325('0x3e')]+'%'};return _0x3059aa;}})});}_0x34b17b=_[_0xf325('0x3f')]({},_0x34b17b,_0x33ca91[_0xf325('0x40')]);var _0x2cc616={'where':_0x34b17b[_0xf325('0x3d')]};return db['ZohoAccount'][_0xf325('0x23')](_0x2cc616)[_0xf325('0x28')](function(_0x13da5b){_0x165c0e[_0xf325('0x23')]=_0x13da5b;if(_0x33ca91[_0xf325('0x35')][_0xf325('0x41')]){_0x34b17b[_0xf325('0x42')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x34b17b);})[_0xf325('0x28')](function(_0x1132cc){_0x165c0e[_0xf325('0x43')]=_0x1132cc;return _0x165c0e;})[_0xf325('0x28')](respondWithFilteredResult(_0x4ace9a,_0x34b17b))[_0xf325('0x44')](handleError(_0x4ace9a,null));};exports[_0xf325('0x45')]=function(_0x41c900,_0x3c0b63){var _0x2dd9e8={'raw':![],'where':{'id':_0x41c900['params']['id']}},_0x2e185c={};_0x2e185c[_0xf325('0x34')]=_[_0xf325('0x46')](db[_0xf325('0x47')][_0xf325('0x30')]);_0x2e185c[_0xf325('0x35')]=_[_0xf325('0x46')](_0x41c900[_0xf325('0x35')]);_0x2e185c[_0xf325('0x36')]=_['intersection'](_0x2e185c[_0xf325('0x34')],_0x2e185c[_0xf325('0x35')]);_0x2dd9e8[_0xf325('0x38')]=_[_0xf325('0x37')](_0x2e185c['model'],qs['fields'](_0x41c900[_0xf325('0x35')]['fields']));_0x2dd9e8['attributes']=_0x2dd9e8['attributes'][_0xf325('0x3a')]?_0x2dd9e8[_0xf325('0x38')]:_0x2e185c[_0xf325('0x34')];if(_0x41c900[_0xf325('0x35')][_0xf325('0x41')]){_0x2dd9e8[_0xf325('0x42')]=[{'all':!![]}];}_0x2dd9e8=_[_0xf325('0x3f')]({},_0x2dd9e8,_0x41c900['options']);return db[_0xf325('0x47')]['find'](_0x2dd9e8)[_0xf325('0x28')](handleEntityNotFound(_0x3c0b63,null))['then'](respondWithResult(_0x3c0b63,null))[_0xf325('0x44')](handleError(_0x3c0b63,null));};exports[_0xf325('0x48')]=function(_0x583a17,_0x3a1346){return db[_0xf325('0x47')][_0xf325('0x48')](_0x583a17[_0xf325('0x49')],{})[_0xf325('0x28')](respondWithResult(_0x3a1346,0xc9))[_0xf325('0x44')](handleError(_0x3a1346,null));};exports[_0xf325('0x27')]=function(_0x4d8050,_0x49ff98){if(_0x4d8050[_0xf325('0x49')]['id']){delete _0x4d8050[_0xf325('0x49')]['id'];}return db[_0xf325('0x47')][_0xf325('0x4a')]({'where':{'id':_0x4d8050[_0xf325('0x4b')]['id']}})[_0xf325('0x28')](handleEntityNotFound(_0x49ff98,null))[_0xf325('0x28')](saveUpdates(_0x4d8050['body'],null))[_0xf325('0x28')](respondWithResult(_0x49ff98,null))['catch'](handleError(_0x49ff98,null));};exports[_0xf325('0x29')]=function(_0x50b502,_0x191067){return db[_0xf325('0x47')][_0xf325('0x4a')]({'where':{'id':_0x50b502[_0xf325('0x4b')]['id']}})[_0xf325('0x28')](handleEntityNotFound(_0x191067,null))[_0xf325('0x28')](removeEntity(_0x191067,null))['catch'](handleError(_0x191067,null));};exports[_0xf325('0x4c')]=function(_0x2d43e2,_0x3ff9df,_0x1c3547){var _0x15dc71={};var _0x23065f={};var _0x51bb3d;var _0x2fe2d0;return db[_0xf325('0x47')][_0xf325('0x4d')]({'where':{'id':_0x2d43e2[_0xf325('0x4b')]['id']}})[_0xf325('0x28')](handleEntityNotFound(_0x3ff9df,null))[_0xf325('0x28')](function(_0x5801a6){if(_0x5801a6){_0x51bb3d=_0x5801a6;_0x23065f[_0xf325('0x34')]=_[_0xf325('0x46')](db[_0xf325('0x4e')][_0xf325('0x30')]);_0x23065f[_0xf325('0x35')]=_[_0xf325('0x46')](_0x2d43e2[_0xf325('0x35')]);_0x23065f[_0xf325('0x36')]=_['intersection'](_0x23065f[_0xf325('0x34')],_0x23065f['query']);_0x15dc71['attributes']=_[_0xf325('0x37')](_0x23065f[_0xf325('0x34')],qs[_0xf325('0x39')](_0x2d43e2[_0xf325('0x35')][_0xf325('0x39')]));_0x15dc71['attributes']=_0x15dc71[_0xf325('0x38')][_0xf325('0x3a')]?_0x15dc71[_0xf325('0x38')]:_0x23065f['model'];_0x15dc71['order']=qs[_0xf325('0x3c')](_0x2d43e2[_0xf325('0x35')][_0xf325('0x3c')]);_0x15dc71[_0xf325('0x3d')]=qs[_0xf325('0x36')](_[_0xf325('0x4f')](_0x2d43e2[_0xf325('0x35')],_0x23065f['filters']));if(_0x2d43e2[_0xf325('0x35')][_0xf325('0x3e')]){_0x15dc71['where']=_['merge'](_0x15dc71['where'],{'$or':_['map'](_0x15dc71[_0xf325('0x38')],function(_0x2332e0){var _0x2aaae9={};_0x2aaae9[_0x2332e0]={'$like':'%'+_0x2d43e2[_0xf325('0x35')][_0xf325('0x3e')]+'%'};return _0x2aaae9;})});}_0x15dc71=_[_0xf325('0x3f')]({},_0x15dc71,_0x2d43e2['options']);return _0x51bb3d[_0xf325('0x4c')](_0x15dc71);}})[_0xf325('0x28')](function(_0x1f9b74){if(_0x1f9b74){_0x2fe2d0=_0x1f9b74['length'];if(!_0x2d43e2[_0xf325('0x35')][_0xf325('0x3b')](_0xf325('0x50'))){_0x15dc71['limit']=qs[_0xf325('0x24')](_0x2d43e2[_0xf325('0x35')][_0xf325('0x24')]);_0x15dc71[_0xf325('0x21')]=qs[_0xf325('0x21')](_0x2d43e2['query'][_0xf325('0x21')]);}return _0x51bb3d[_0xf325('0x4c')](_0x15dc71);}})[_0xf325('0x28')](function(_0x5dcc19){if(_0x5dcc19){return _0x5dcc19?{'count':_0x2fe2d0,'rows':_0x5dcc19}:null;}})[_0xf325('0x28')](respondWithResult(_0x3ff9df,null))[_0xf325('0x44')](handleError(_0x3ff9df,null));};exports[_0xf325('0x51')]=function(_0x1b1a05,_0x3b0f88,_0x575de1){if(_0x1b1a05[_0xf325('0x49')]['id']){delete _0x1b1a05['body']['id'];}return db[_0xf325('0x47')]['findOne']({'where':{'id':_0x1b1a05['params']['id']}})[_0xf325('0x28')](handleEntityNotFound(_0x3b0f88,null))[_0xf325('0x28')](function(_0x191869){if(_0x191869){_0x1b1a05[_0xf325('0x49')][_0xf325('0x52')]=_0x191869['id'];_0x1b1a05[_0xf325('0x49')]['Subjects']=integrations['getSubjects'](_0x1b1a05[_0xf325('0x49')]['channel'],_0x1b1a05[_0xf325('0x49')][_0xf325('0x32')]);_0x1b1a05[_0xf325('0x49')][_0xf325('0x53')]=integrations[_0xf325('0x54')](_0x1b1a05['body'][_0xf325('0x55')],_0x1b1a05[_0xf325('0x49')][_0xf325('0x32')]);return db['ZohoConfiguration'][_0xf325('0x48')](_0x1b1a05[_0xf325('0x49')],{'include':[{'model':db[_0xf325('0x56')],'as':_0xf325('0x57')},{'model':db[_0xf325('0x56')],'as':_0xf325('0x53')}]});}return null;})[_0xf325('0x28')](respondWithResult(_0x3b0f88,null))[_0xf325('0x44')](handleError(_0x3b0f88,null));};function getAccessToken(_0x32eb36){return new Promise(function(_0x40af6a,_0x39db1f){var _0x40fcdd;switch(_0x32eb36[_0xf325('0x58')]){case'US':_0x40fcdd=_0xf325('0x59');break;case'AU':_0x40fcdd=_0xf325('0x5a');break;case'EU':_0x40fcdd='https://accounts.zoho.eu';break;case'IN':_0x40fcdd='https://accounts.zoho.in';break;case'CN':_0x40fcdd=_0xf325('0x5b');break;default:_0x40fcdd=_0xf325('0x5c');break;}var _0x1438a2={'method':_0xf325('0x5d'),'uri':_0x40fcdd+'/oauth/v2/token','qs':{'refresh_token':_0x32eb36['refreshToken'],'client_id':_0x32eb36['clientId'],'client_secret':_0x32eb36['clientSecret'],'grant_type':_0xf325('0x5e')},'json':!![]};return rp(_0x1438a2)[_0xf325('0x28')](function(_0x11ff70){if(_0x11ff70[_0xf325('0x5f')]){_0x40af6a(_0x11ff70['access_token']);}else{_0x39db1f(_0xf325('0x60'));}})[_0xf325('0x44')](function(_0x141d18){_0x39db1f(_0x141d18);});});}exports[_0xf325('0x61')]=function(_0x45ee29,_0x5aac23,_0x1a6c22){var _0x3c6bbb,_0x3eea3c,_0x25f73c,_0x312d37,_0x25622b;return db[_0xf325('0x47')][_0xf325('0x4d')]({'where':{'id':_0x45ee29[_0xf325('0x4b')]['id']},'attributes':['id',_0xf325('0x62'),'zone','clientId',_0xf325('0x63'),_0xf325('0x64'),_0xf325('0x65'),_0xf325('0x66')]})['then'](handleEntityNotFound(_0x5aac23,null))[_0xf325('0x28')](function(_0x83f506){_0x25622b=_0x83f506;_0x3c6bbb=_0x25622b['host'];_0x3eea3c=_0x3c6bbb===_0xf325('0x67')?'eu':'com';_0x25f73c=_0x25622b[_0xf325('0x64')];var _0x210372=_0x25f73c['slice'](-0x1);if(_0x210372==='/'||_0x210372==='\x5c'||_0x210372===':'){_0x25f73c=_0x25f73c['substring'](0x0,_0x25f73c[_0xf325('0x68')](_0x210372));}if(!_0x25622b[_0xf325('0x66')]){throw new Error(_0xf325('0x69'));}return getAccessToken(_0x25622b);})['then'](function(_0x5b56a3){if(_0x5b56a3){return rp({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3eea3c),'qs':{'module':_0xf325('0x6a')},'headers':{'Authorization':_0xf325('0x6b')+_0x5b56a3},'json':!![]});}})[_0xf325('0x28')](function(_0x2eba7d){if(_0x2eba7d){if(_0x2eba7d[_0xf325('0x6c')]&&_0x2eba7d[_0xf325('0x6c')][_0xf325('0x2a')]){throw new Error(_0x2eba7d[_0xf325('0x6c')][_0xf325('0x2a')][_0xf325('0x6d')]);}var _0x3a1223=[];var _0x485791=[];var _0x41339b=[_0xf325('0x6e'),_0xf325('0x6f'),_0xf325('0x70'),_0xf325('0x71'),_0xf325('0x72'),_0xf325('0x73'),_0xf325('0x74'),_0xf325('0x75')];_0x485791=_[_0xf325('0x76')](_0x2eba7d[_0xf325('0x39')],function(_0x231f40){return _0x41339b[_0xf325('0x77')](_0x231f40[_0xf325('0x78')]);});for(var _0x41463f=0x0;_0x41463f<_0x485791['length'];_0x41463f++){if(_0x485791[_0x41463f]['system_mandatory']===![]){_0x3a1223[_0xf325('0x79')]({'id':_0x485791[_0x41463f]['id'],'name':_0x485791[_0x41463f]['display_label'],'custom':_0x485791[_0x41463f][_0xf325('0x7a')],'options':_0x485791[_0x41463f][_0xf325('0x7b')]===_0xf325('0x7c')&&_0x485791[_0x41463f][_0xf325('0x7d')][_0xf325('0x3a')]>-0x1?_[_0xf325('0x2f')](_0x485791[_0x41463f][_0xf325('0x7d')],function(_0x43f85b){return{'name':_0x43f85b,'value':_0x43f85b};}):[]});}}return{'count':_0x3a1223[_0xf325('0x3a')],'rows':_0x3a1223};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5aac23,null))[_0xf325('0x44')](function(_0x5a9f46){var _0x3b9bf0=_0x45ee29['query'][_0xf325('0x7e')]?0x1f4:_0x5a9f46[_0xf325('0x7f')]||0x1f4;logger[_0xf325('0x2a')](_0xf325('0x80'),_0xf325('0x61'),_0x3b9bf0,JSON[_0xf325('0x81')](_0x5a9f46));delete _0x5a9f46['name'];if(_0x3b9bf0===0x191){_0x3b9bf0=0x190;}_0x5aac23[_0xf325('0x1f')](_0x3b9bf0)[_0xf325('0x2d')](_0x45ee29[_0xf325('0x35')]['test']?{'message':_0xf325('0x82'),'statusCode':_0x5a9f46[_0xf325('0x7f')]}:_0x5a9f46);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 490ecfd..3809cea 100644 --- a/server/api/intZohoAccount/intZohoAccount.model.js +++ b/server/api/intZohoAccount/intZohoAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1418=['https://accounts.zoho.com','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','code','host','slice','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','parse','refresh_token','info','format','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','inspect','substring'];(function(_0x15b58d,_0x5557d5){var _0x30de4c=function(_0x1c18f8){while(--_0x1c18f8){_0x15b58d['push'](_0x15b58d['shift']());}};_0x30de4c(++_0x5557d5);}(_0x1418,0x86));var _0x8141=function(_0x38d310,_0x308b3c){_0x38d310=_0x38d310-0x0;var _0x2f9edd=_0x1418[_0x38d310];return _0x2f9edd;};'use strict';var _=require(_0x8141('0x0'));var util=require(_0x8141('0x1'));var logger=require(_0x8141('0x2'))(_0x8141('0x3'));var moment=require(_0x8141('0x4'));var BPromise=require(_0x8141('0x5'));var rp=require(_0x8141('0x6'));var fs=require('fs');var path=require(_0x8141('0x7'));var rimraf=require(_0x8141('0x8'));var config=require('../../config/environment');var attributes=require(_0x8141('0x9'));var integrations=require(_0x8141('0xa'));module[_0x8141('0xb')]=function(_0x222b26,_0x31dadb){return _0x222b26[_0x8141('0xc')](_0x8141('0xd'),attributes,{'tableName':_0x8141('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2a6431,_0x594a79,_0x124c4c){if(_0x2a6431['changed']('zone')||_0x2a6431[_0x8141('0xf')](_0x8141('0x10'))||_0x2a6431['changed'](_0x8141('0x11'))||_0x2a6431[_0x8141('0xf')]('clientSecret')||_0x2a6431['changed'](_0x8141('0x12'))||_0x2a6431[_0x8141('0xf')](_0x8141('0x13'))){var _0x5240b2,_0x162951;_0x5240b2=_0x2a6431['serverUrl'];var _0x37645e=_0x5240b2[_0x8141('0x14')](-0x1);if(_0x37645e==='/'||_0x37645e==='\x5c'||_0x37645e===':'){_0x5240b2=_0x5240b2['substring'](0x0,_0x5240b2[_0x8141('0x15')](_0x37645e));}switch(_0x2a6431[_0x8141('0x16')]){case'US':_0x162951='https://accounts.zoho.com';break;case'AU':_0x162951=_0x8141('0x17');break;case'IN':_0x162951=_0x8141('0x18');break;case'CN':_0x162951=_0x8141('0x19');break;default:_0x162951=_0x8141('0x1a');break;}var _0x35bcaa={'method':_0x8141('0x1b'),'uri':_0x162951+_0x8141('0x1c'),'form':{'grant_type':_0x8141('0x1d'),'client_id':_0x2a6431[_0x8141('0x11')],'client_secret':_0x2a6431[_0x8141('0x1e')],'redirect_uri':_0x2a6431[_0x8141('0x10')],'code':_0x2a6431[_0x8141('0x12')]},'headers':{'Content-Type':_0x8141('0x1f')}};return rp(_0x35bcaa)['then'](function(_0x542634){var _0x1edf97=JSON[_0x8141('0x20')](_0x542634);if(_0x1edf97[_0x8141('0x21')]){_0x2a6431['refreshToken']=_0x1edf97[_0x8141('0x21')];logger[_0x8141('0x22')](util[_0x8141('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2a6431['name'],_0x2a6431['id']));}else{logger[_0x8141('0x24')](util[_0x8141('0x23')](_0x8141('0x25'),_0x2a6431[_0x8141('0x26')],_0x2a6431['id']),util['inspect'](_0x1edf97,{'showHidden':![],'depth':null}));}return _0x124c4c(null,_0x594a79);})[_0x8141('0x27')](function(_0x41346c){logger[_0x8141('0x24')](util[_0x8141('0x23')](_0x8141('0x25'),_0x2a6431[_0x8141('0x26')],_0x2a6431['id']),util[_0x8141('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x124c4c(_0x41346c);});}else{return _0x124c4c(null,_0x594a79);}},'beforeUpdate':function(_0x50555d,_0x386998,_0x29cb8a){if(_0x50555d[_0x8141('0xf')](_0x8141('0x16'))||_0x50555d[_0x8141('0xf')](_0x8141('0x10'))||_0x50555d[_0x8141('0xf')](_0x8141('0x11'))||_0x50555d[_0x8141('0xf')]('clientSecret')||_0x50555d[_0x8141('0xf')](_0x8141('0x12'))||_0x50555d['changed'](_0x8141('0x13'))){var _0x48bfa4,_0x1f9570;_0x48bfa4=_0x50555d[_0x8141('0x10')];var _0x1ba0fe=_0x48bfa4[_0x8141('0x14')](-0x1);if(_0x1ba0fe==='/'||_0x1ba0fe==='\x5c'||_0x1ba0fe===':'){_0x48bfa4=_0x48bfa4[_0x8141('0x29')](0x0,_0x48bfa4['lastIndexOf'](_0x1ba0fe));}switch(_0x50555d[_0x8141('0x16')]){case'US':_0x1f9570=_0x8141('0x2a');break;case'AU':_0x1f9570=_0x8141('0x17');break;case'IN':_0x1f9570='https://accounts.zoho.in';break;case'CN':_0x1f9570=_0x8141('0x19');break;default:_0x1f9570='https://accounts.zoho.eu';break;}var _0xd4614b={'method':'POST','uri':_0x1f9570+_0x8141('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x50555d['clientId'],'client_secret':_0x50555d['clientSecret'],'redirect_uri':_0x50555d[_0x8141('0x10')],'code':_0x50555d[_0x8141('0x12')]},'headers':{'Content-Type':_0x8141('0x1f')}};return rp(_0xd4614b)['then'](function(_0x4df3bf){var _0x509511=JSON[_0x8141('0x20')](_0x4df3bf);if(_0x509511[_0x8141('0x21')]){_0x50555d['refreshToken']=_0x509511[_0x8141('0x21')];logger[_0x8141('0x22')](util['format'](_0x8141('0x2b'),_0x50555d[_0x8141('0x26')],_0x50555d['id']));}else{logger['error'](util['format'](_0x8141('0x25'),_0x50555d[_0x8141('0x26')],_0x50555d['id']),util[_0x8141('0x28')](_0x509511,{'showHidden':![],'depth':null}));}return _0x29cb8a(null,_0x386998);})['catch'](function(_0x326b65){logger[_0x8141('0x24')](util[_0x8141('0x23')](_0x8141('0x25'),_0x50555d[_0x8141('0x26')],_0x50555d['id']),util[_0x8141('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x29cb8a(_0x326b65);});}else{return _0x29cb8a(null,_0x386998);}}}});}; \ No newline at end of file +var _0x92e4=['POST','/oauth/v2/token','catch','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','serverUrl','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','code','https://accounts.zoho.com'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x92e4,0x1bb));var _0x492e=function(_0x51e035,_0x21d027){_0x51e035=_0x51e035-0x0;var _0xdbd9fc=_0x92e4[_0x51e035];return _0xdbd9fc;};'use strict';var _=require(_0x492e('0x0'));var util=require(_0x492e('0x1'));var logger=require(_0x492e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x492e('0x3'));var rp=require(_0x492e('0x4'));var fs=require('fs');var path=require(_0x492e('0x5'));var rimraf=require(_0x492e('0x6'));var config=require(_0x492e('0x7'));var attributes=require(_0x492e('0x8'));var integrations=require(_0x492e('0x9'));module['exports']=function(_0x5c69f6,_0x47f147){return _0x5c69f6[_0x492e('0xa')](_0x492e('0xb'),attributes,{'tableName':_0x492e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x51782c,_0x2d4d3a,_0x5c114e){if(_0x51782c[_0x492e('0xd')](_0x492e('0xe'))||_0x51782c[_0x492e('0xd')]('serverUrl')||_0x51782c[_0x492e('0xd')](_0x492e('0xf'))||_0x51782c[_0x492e('0xd')](_0x492e('0x10'))||_0x51782c['changed']('code')||_0x51782c['changed'](_0x492e('0x11'))){var _0x36a0d5,_0x39d770;_0x36a0d5=_0x51782c['serverUrl'];var _0x304600=_0x36a0d5[_0x492e('0x12')](-0x1);if(_0x304600==='/'||_0x304600==='\x5c'||_0x304600===':'){_0x36a0d5=_0x36a0d5[_0x492e('0x13')](0x0,_0x36a0d5[_0x492e('0x14')](_0x304600));}switch(_0x51782c[_0x492e('0xe')]){case'US':_0x39d770='https://accounts.zoho.com';break;case'AU':_0x39d770=_0x492e('0x15');break;case'IN':_0x39d770=_0x492e('0x16');break;case'CN':_0x39d770=_0x492e('0x17');break;default:_0x39d770=_0x492e('0x18');break;}var _0x53c5b2={'method':'POST','uri':_0x39d770+'/oauth/v2/token','form':{'grant_type':_0x492e('0x19'),'client_id':_0x51782c[_0x492e('0xf')],'client_secret':_0x51782c[_0x492e('0x10')],'redirect_uri':_0x51782c[_0x492e('0x1a')],'code':_0x51782c['code']},'headers':{'Content-Type':_0x492e('0x1b')}};return rp(_0x53c5b2)[_0x492e('0x1c')](function(_0x1ed9d1){var _0x4b9e8e=JSON[_0x492e('0x1d')](_0x1ed9d1);if(_0x4b9e8e['refresh_token']){_0x51782c[_0x492e('0x1e')]=_0x4b9e8e[_0x492e('0x1f')];logger[_0x492e('0x20')](util[_0x492e('0x21')](_0x492e('0x22'),_0x51782c[_0x492e('0x23')],_0x51782c['id']));}else{logger[_0x492e('0x24')](util['format'](_0x492e('0x25'),_0x51782c[_0x492e('0x23')],_0x51782c['id']),util['inspect'](_0x4b9e8e,{'showHidden':![],'depth':null}));}return _0x5c114e(null,_0x2d4d3a);})['catch'](function(_0x527c7c){logger['error'](util['format'](_0x492e('0x25'),_0x51782c[_0x492e('0x23')],_0x51782c['id']),util[_0x492e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x5c114e(_0x527c7c);});}else{return _0x5c114e(null,_0x2d4d3a);}},'beforeUpdate':function(_0x294f34,_0x35309c,_0x40911f){if(_0x294f34[_0x492e('0xd')](_0x492e('0xe'))||_0x294f34[_0x492e('0xd')](_0x492e('0x1a'))||_0x294f34['changed'](_0x492e('0xf'))||_0x294f34[_0x492e('0xd')](_0x492e('0x10'))||_0x294f34['changed'](_0x492e('0x27'))||_0x294f34[_0x492e('0xd')](_0x492e('0x11'))){var _0xfae1a4,_0x597718;_0xfae1a4=_0x294f34[_0x492e('0x1a')];var _0x3f562d=_0xfae1a4[_0x492e('0x12')](-0x1);if(_0x3f562d==='/'||_0x3f562d==='\x5c'||_0x3f562d===':'){_0xfae1a4=_0xfae1a4[_0x492e('0x13')](0x0,_0xfae1a4['lastIndexOf'](_0x3f562d));}switch(_0x294f34[_0x492e('0xe')]){case'US':_0x597718=_0x492e('0x28');break;case'AU':_0x597718=_0x492e('0x15');break;case'IN':_0x597718='https://accounts.zoho.in';break;case'CN':_0x597718=_0x492e('0x17');break;default:_0x597718=_0x492e('0x18');break;}var _0x3c4c2d={'method':_0x492e('0x29'),'uri':_0x597718+_0x492e('0x2a'),'form':{'grant_type':_0x492e('0x19'),'client_id':_0x294f34[_0x492e('0xf')],'client_secret':_0x294f34[_0x492e('0x10')],'redirect_uri':_0x294f34['serverUrl'],'code':_0x294f34[_0x492e('0x27')]},'headers':{'Content-Type':_0x492e('0x1b')}};return rp(_0x3c4c2d)[_0x492e('0x1c')](function(_0x1dbb63){var _0x19b464=JSON[_0x492e('0x1d')](_0x1dbb63);if(_0x19b464['refresh_token']){_0x294f34[_0x492e('0x1e')]=_0x19b464[_0x492e('0x1f')];logger[_0x492e('0x20')](util[_0x492e('0x21')](_0x492e('0x22'),_0x294f34[_0x492e('0x23')],_0x294f34['id']));}else{logger[_0x492e('0x24')](util[_0x492e('0x21')](_0x492e('0x25'),_0x294f34[_0x492e('0x23')],_0x294f34['id']),util[_0x492e('0x26')](_0x19b464,{'showHidden':![],'depth':null}));}return _0x40911f(null,_0x35309c);})[_0x492e('0x2b')](function(_0x507ea7){logger[_0x492e('0x24')](util[_0x492e('0x21')](_0x492e('0x25'),_0x294f34[_0x492e('0x23')],_0x294f34['id']),util[_0x492e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x40911f(_0x507ea7);});}else{return _0x40911f(null,_0x35309c);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 02fb76f..ec17ec5 100644 --- a/server/api/intZohoAccount/intZohoAccount.rpc.js +++ b/server/api/intZohoAccount/intZohoAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb78e=['raw','ShowZohoAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','model','map','find'];(function(_0x5d42fe,_0x5071ff){var _0x5b4597=function(_0x3ac70c){while(--_0x3ac70c){_0x5d42fe['push'](_0x5d42fe['shift']());}};_0x5b4597(++_0x5071ff);}(_0xb78e,0x1c9));var _0xeb78=function(_0x436776,_0xc5c90){_0x436776=_0x436776-0x0;var _0x518925=_0xb78e[_0x436776];return _0x518925;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc2f,_0x30c884,_0x2b7925){return new BPromise(function(_0x36963f,_0x5259aa){return client['request'](_0x1ccc2f,_0x2b7925)[_0xeb78('0xc')](function(_0x1c941d){logger[_0xeb78('0xd')](_0xeb78('0xe'),_0x30c884,_0xeb78('0xf'));logger[_0xeb78('0x10')](_0xeb78('0x11'),_0x30c884,_0xeb78('0xf'),JSON[_0xeb78('0x12')](_0x1c941d));if(_0x1c941d['error']){if(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x14')]===0x1f4){logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);return _0x5259aa(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);}logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d['error'][_0xeb78('0x15')]);return _0x36963f(_0x1c941d[_0xeb78('0x13')]['message']);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x30c884,_0xeb78('0xf'));_0x36963f(_0x1c941d['result'][_0xeb78('0x15')]);}})[_0xeb78('0x16')](function(_0x49123d){logger[_0xeb78('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x30c884,_0x49123d);_0x5259aa(_0x49123d);});});}exports[_0xeb78('0x17')]=function(_0x92e410){var _0x576802=this;return new Promise(function(_0x45176e,_0xb97756){return db[_0xeb78('0x18')]['findAll']({'raw':_0x92e410[_0xeb78('0x19')]?_0x92e410[_0xeb78('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x92e410['options']?_0x92e410[_0xeb78('0x19')][_0xeb78('0x1a')]||null:null,'attributes':_0x92e410[_0xeb78('0x19')]?_0x92e410[_0xeb78('0x19')][_0xeb78('0x1b')]||null:null,'limit':_0x92e410[_0xeb78('0x19')]?_0x92e410[_0xeb78('0x19')][_0xeb78('0x1c')]||null:null,'include':_0x92e410[_0xeb78('0x19')]?_0x92e410['options']['include']?_['map'](_0x92e410['options'][_0xeb78('0x1d')],function(_0x5b15d8){return{'model':db[_0x5b15d8[_0xeb78('0x1e')]],'as':_0x5b15d8['as'],'attributes':_0x5b15d8[_0xeb78('0x1b')],'include':_0x5b15d8['include']?_[_0xeb78('0x1f')](_0x5b15d8['include'],function(_0x9a00b){return{'model':db[_0x9a00b[_0xeb78('0x1e')]],'as':_0x9a00b['as'],'attributes':_0x9a00b[_0xeb78('0x1b')],'include':_0x9a00b[_0xeb78('0x1d')]?_['map'](_0x9a00b[_0xeb78('0x1d')],function(_0x515158){return{'model':db[_0x515158[_0xeb78('0x1e')]],'as':_0x515158['as'],'attributes':_0x515158[_0xeb78('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xeb78('0xc')](function(_0x5263fc){logger[_0xeb78('0xd')](_0xeb78('0x17'),_0x92e410);logger[_0xeb78('0x10')](_0xeb78('0x17'),_0x92e410,JSON[_0xeb78('0x12')](_0x5263fc));_0x45176e(_0x5263fc);})[_0xeb78('0x16')](function(_0x1131a9){logger[_0xeb78('0x13')](_0xeb78('0x17'),_0x1131a9[_0xeb78('0x15')],_0x92e410);_0xb97756(_0x576802[_0xeb78('0x13')](0x1f4,_0x1131a9['message']));});});};exports['ShowZohoAccount']=function(_0x4d12a3){var _0xb3a935=this;return new Promise(function(_0x4253ea,_0x15327f){return db['ZohoAccount'][_0xeb78('0x20')]({'raw':_0x4d12a3[_0xeb78('0x19')]?_0x4d12a3[_0xeb78('0x19')][_0xeb78('0x21')]===undefined?!![]:![]:!![],'where':_0x4d12a3[_0xeb78('0x19')]?_0x4d12a3[_0xeb78('0x19')][_0xeb78('0x1a')]||null:null,'attributes':_0x4d12a3[_0xeb78('0x19')]?_0x4d12a3[_0xeb78('0x19')]['attributes']||null:null,'include':_0x4d12a3[_0xeb78('0x19')]?_0x4d12a3['options'][_0xeb78('0x1d')]?_[_0xeb78('0x1f')](_0x4d12a3[_0xeb78('0x19')][_0xeb78('0x1d')],function(_0x2d1e1b){return{'model':db[_0x2d1e1b[_0xeb78('0x1e')]],'as':_0x2d1e1b['as'],'attributes':_0x2d1e1b['attributes'],'include':_0x2d1e1b['include']?_[_0xeb78('0x1f')](_0x2d1e1b[_0xeb78('0x1d')],function(_0x13dec8){return{'model':db[_0x13dec8[_0xeb78('0x1e')]],'as':_0x13dec8['as'],'attributes':_0x13dec8[_0xeb78('0x1b')],'include':_0x13dec8['include']?_[_0xeb78('0x1f')](_0x13dec8[_0xeb78('0x1d')],function(_0x286107){return{'model':db[_0x286107[_0xeb78('0x1e')]],'as':_0x286107['as'],'attributes':_0x286107[_0xeb78('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xeb78('0xc')](function(_0x55b3d4){logger['info']('ShowZohoAccount',_0x4d12a3);logger['debug'](_0xeb78('0x22'),_0x4d12a3,JSON[_0xeb78('0x12')](_0x55b3d4));_0x4253ea(_0x55b3d4);})[_0xeb78('0x16')](function(_0x58348b){logger[_0xeb78('0x13')](_0xeb78('0x22'),_0x58348b['message'],_0x4d12a3);_0x15327f(_0xb3a935['error'](0x1f4,_0x58348b['message']));});});}; \ No newline at end of file +var _0x9e2e=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetZohoAccount','findAll','options','where','attributes','include','map','model','info','debug','ShowZohoAccount','ZohoAccount','find','lodash','util','moment'];(function(_0x286e80,_0x625296){var _0x29b719=function(_0x549be3){while(--_0x549be3){_0x286e80['push'](_0x286e80['shift']());}};_0x29b719(++_0x625296);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x32291f,_0x80bff6){_0x32291f=_0x32291f-0x0;var _0x238609=_0x9e2e[_0x32291f];return _0x238609;};'use strict';var _=require(_0xe9e2('0x0'));var util=require(_0xe9e2('0x1'));var moment=require(_0xe9e2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9e2('0x4'));var logger=require(_0xe9e2('0x5'))(_0xe9e2('0x6'));var config=require(_0xe9e2('0x7'));var jayson=require(_0xe9e2('0x8'));var client=jayson[_0xe9e2('0x9')][_0xe9e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ca0aa,_0x118600,_0x4f1ef7){return new BPromise(function(_0x2bec58,_0x1ade12){return client['request'](_0x5ca0aa,_0x4f1ef7)[_0xe9e2('0xb')](function(_0x48882a){logger['info'](_0xe9e2('0xc'),_0x118600,_0xe9e2('0xd'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x118600,_0xe9e2('0xd'),JSON[_0xe9e2('0xe')](_0x48882a));if(_0x48882a[_0xe9e2('0xf')]){if(_0x48882a[_0xe9e2('0xf')]['code']===0x1f4){logger['error'](_0xe9e2('0xc'),_0x118600,_0x48882a[_0xe9e2('0xf')][_0xe9e2('0x10')]);return _0x1ade12(_0x48882a[_0xe9e2('0xf')][_0xe9e2('0x10')]);}logger[_0xe9e2('0xf')](_0xe9e2('0xc'),_0x118600,_0x48882a[_0xe9e2('0xf')][_0xe9e2('0x10')]);return _0x2bec58(_0x48882a[_0xe9e2('0xf')]['message']);}else{logger['info'](_0xe9e2('0xc'),_0x118600,'request\x20sent');_0x2bec58(_0x48882a['result'][_0xe9e2('0x10')]);}})[_0xe9e2('0x11')](function(_0x3550ce){logger[_0xe9e2('0xf')](_0xe9e2('0xc'),_0x118600,_0x3550ce);_0x1ade12(_0x3550ce);});});}exports[_0xe9e2('0x12')]=function(_0x5f3fc8){var _0xdf6f78=this;return new Promise(function(_0x2094fc,_0x3b6637){return db['ZohoAccount'][_0xe9e2('0x13')]({'raw':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x15')]||null:null,'attributes':_0x5f3fc8['options']?_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x16')]||null:null,'limit':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')]['limit']||null:null,'include':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x17')],function(_0x26ce3d){return{'model':db[_0x26ce3d[_0xe9e2('0x19')]],'as':_0x26ce3d['as'],'attributes':_0x26ce3d[_0xe9e2('0x16')],'include':_0x26ce3d[_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x26ce3d[_0xe9e2('0x17')],function(_0x2a3d69){return{'model':db[_0x2a3d69[_0xe9e2('0x19')]],'as':_0x2a3d69['as'],'attributes':_0x2a3d69[_0xe9e2('0x16')],'include':_0x2a3d69[_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x2a3d69['include'],function(_0x43445d){return{'model':db[_0x43445d[_0xe9e2('0x19')]],'as':_0x43445d['as'],'attributes':_0x43445d[_0xe9e2('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe9e2('0xb')](function(_0x57254c){logger[_0xe9e2('0x1a')](_0xe9e2('0x12'),_0x5f3fc8);logger[_0xe9e2('0x1b')](_0xe9e2('0x12'),_0x5f3fc8,JSON[_0xe9e2('0xe')](_0x57254c));_0x2094fc(_0x57254c);})['catch'](function(_0x4cf43f){logger[_0xe9e2('0xf')](_0xe9e2('0x12'),_0x4cf43f[_0xe9e2('0x10')],_0x5f3fc8);_0x3b6637(_0xdf6f78[_0xe9e2('0xf')](0x1f4,_0x4cf43f[_0xe9e2('0x10')]));});});};exports[_0xe9e2('0x1c')]=function(_0x5da7b3){var _0x29d238=this;return new Promise(function(_0x546961,_0x227b7e){return db[_0xe9e2('0x1d')][_0xe9e2('0x1e')]({'raw':_0x5da7b3[_0xe9e2('0x14')]?_0x5da7b3[_0xe9e2('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5da7b3['options']?_0x5da7b3[_0xe9e2('0x14')][_0xe9e2('0x15')]||null:null,'attributes':_0x5da7b3['options']?_0x5da7b3[_0xe9e2('0x14')][_0xe9e2('0x16')]||null:null,'include':_0x5da7b3[_0xe9e2('0x14')]?_0x5da7b3['options'][_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x5da7b3[_0xe9e2('0x14')][_0xe9e2('0x17')],function(_0x573038){return{'model':db[_0x573038[_0xe9e2('0x19')]],'as':_0x573038['as'],'attributes':_0x573038[_0xe9e2('0x16')],'include':_0x573038[_0xe9e2('0x17')]?_['map'](_0x573038['include'],function(_0x3f66ab){return{'model':db[_0x3f66ab[_0xe9e2('0x19')]],'as':_0x3f66ab['as'],'attributes':_0x3f66ab[_0xe9e2('0x16')],'include':_0x3f66ab[_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x3f66ab[_0xe9e2('0x17')],function(_0x2fa4aa){return{'model':db[_0x2fa4aa['model']],'as':_0x2fa4aa['as'],'attributes':_0x2fa4aa['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9e2('0xb')](function(_0x4b3184){logger[_0xe9e2('0x1a')](_0xe9e2('0x1c'),_0x5da7b3);logger['debug'](_0xe9e2('0x1c'),_0x5da7b3,JSON[_0xe9e2('0xe')](_0x4b3184));_0x546961(_0x4b3184);})['catch'](function(_0x13a916){logger[_0xe9e2('0xf')]('ShowZohoAccount',_0x13a916['message'],_0x5da7b3);_0x227b7e(_0x29d238[_0xe9e2('0xf')](0x1f4,_0x13a916[_0xe9e2('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 571bce7..57a5386 100644 --- a/server/api/intZohoConfiguration/index.js +++ b/server/api/intZohoConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0b2=['/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','isAuthenticated','getDescriptions','post','put','update','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index'];(function(_0x12fd43,_0x4e43d5){var _0x9390ea=function(_0x3496b8){while(--_0x3496b8){_0x12fd43['push'](_0x12fd43['shift']());}};_0x9390ea(++_0x4e43d5);}(_0xe0b2,0xa7));var _0x2e0b=function(_0x328379,_0x10cce1){_0x328379=_0x328379-0x0;var _0x23ca38=_0xe0b2[_0x328379];return _0x23ca38;};'use strict';var multer=require(_0x2e0b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2e0b('0x1'));var express=require('express');var router=express[_0x2e0b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2e0b('0x3'));var interaction=require(_0x2e0b('0x4'));var config=require(_0x2e0b('0x5'));var controller=require(_0x2e0b('0x6'));router[_0x2e0b('0x7')]('/',auth['isAuthenticated'](),controller[_0x2e0b('0x8')]);router[_0x2e0b('0x7')](_0x2e0b('0x9'),auth['isAuthenticated'](),controller[_0x2e0b('0xa')]);router[_0x2e0b('0x7')](_0x2e0b('0xb'),auth['isAuthenticated'](),controller[_0x2e0b('0xc')]);router[_0x2e0b('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x2e0b('0xd')]);router[_0x2e0b('0x7')](_0x2e0b('0xe'),auth[_0x2e0b('0xf')](),controller[_0x2e0b('0x10')]);router[_0x2e0b('0x11')]('/',auth[_0x2e0b('0xf')](),controller['create']);router[_0x2e0b('0x12')](_0x2e0b('0x9'),auth[_0x2e0b('0xf')](),controller[_0x2e0b('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2e0b('0x14')]);module[_0x2e0b('0x15')]=router; \ No newline at end of file +var _0x980b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','delete','exports','multer','path'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x980b,0x140));var _0xb980=function(_0x24a8e1,_0x549bd5){_0x24a8e1=_0x24a8e1-0x0;var _0x264874=_0x980b[_0x24a8e1];return _0x264874;};'use strict';var multer=require(_0xb980('0x0'));var util=require('util');var path=require(_0xb980('0x1'));var timeout=require(_0xb980('0x2'));var express=require('express');var router=express[_0xb980('0x3')]();var fs_extra=require(_0xb980('0x4'));var auth=require(_0xb980('0x5'));var interaction=require(_0xb980('0x6'));var config=require(_0xb980('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0xb980('0x8')]('/',auth[_0xb980('0x9')](),controller[_0xb980('0xa')]);router[_0xb980('0x8')](_0xb980('0xb'),auth[_0xb980('0x9')](),controller[_0xb980('0xc')]);router[_0xb980('0x8')](_0xb980('0xd'),auth[_0xb980('0x9')](),controller[_0xb980('0xe')]);router['get'](_0xb980('0xf'),auth[_0xb980('0x9')](),controller[_0xb980('0x10')]);router['get'](_0xb980('0x11'),auth[_0xb980('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xb980('0x9')](),controller[_0xb980('0x12')]);router[_0xb980('0x13')]('/:id',auth[_0xb980('0x9')](),controller[_0xb980('0x14')]);router[_0xb980('0x15')](_0xb980('0xb'),auth[_0xb980('0x9')](),controller['destroy']);module[_0xb980('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index b5eabef..31a1e88 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfca8=['STRING','lead','contact','nothing','contact_lead','sequelize','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfca8,0x1c5));var _0x8fca=function(_0x544675,_0x146934){_0x544675=_0x544675-0x0;var _0x391bc9=_0xfca8[_0x544675];return _0x391bc9;};'use strict';var Sequelize=require(_0x8fca('0x0'));module[_0x8fca('0x1')]={'name':{'type':Sequelize[_0x8fca('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x8fca('0x3'),_0x8fca('0x4'),_0x8fca('0x5')),'defaultValue':_0x8fca('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x8fca('0x6'),'contact',_0x8fca('0x3')),'defaultValue':_0x8fca('0x6')},'description':{'type':Sequelize[_0x8fca('0x2')]}}; \ No newline at end of file +var _0x113e=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x1cd40d,_0x3d408b){var _0x2d3ebc=function(_0x173d53){while(--_0x173d53){_0x1cd40d['push'](_0x1cd40d['shift']());}};_0x2d3ebc(++_0x3d408b);}(_0x113e,0xe5));var _0xe113=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x113e[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0xe113('0x0'));module[_0xe113('0x1')]={'name':{'type':Sequelize[_0xe113('0x2')]},'moduleCreate':{'type':Sequelize[_0xe113('0x3')](_0xe113('0x4'),_0xe113('0x5'),_0xe113('0x6')),'defaultValue':_0xe113('0x4')},'moduleSearch':{'type':Sequelize[_0xe113('0x3')](_0xe113('0x7'),_0xe113('0x5'),_0xe113('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xe113('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 4aab281..cd66080 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13ec=['bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','params','merge','find','create','findOne','ZohoField','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x70a317,_0x463add){var _0x52d4e8=function(_0x3023f3){while(--_0x3023f3){_0x70a317['push'](_0x70a317['shift']());}};_0x52d4e8(++_0x463add);}(_0x13ec,0x1d4));var _0xc13e=function(_0x192b71,_0x316c9c){_0x192b71=_0x192b71-0x0;var _0x505d0a=_0x13ec[_0x192b71];return _0x505d0a;};'use strict';var emlformat=require(_0xc13e('0x0'));var rimraf=require(_0xc13e('0x1'));var zipdir=require(_0xc13e('0x2'));var jsonpatch=require(_0xc13e('0x3'));var rp=require(_0xc13e('0x4'));var moment=require(_0xc13e('0x5'));var BPromise=require(_0xc13e('0x6'));var Mustache=require('mustache');var util=require(_0xc13e('0x7'));var path=require(_0xc13e('0x8'));var sox=require('sox');var csv=require(_0xc13e('0x9'));var ejs=require(_0xc13e('0xa'));var fs=require('fs');var fs_extra=require(_0xc13e('0xb'));var _=require('lodash');var squel=require(_0xc13e('0xc'));var crypto=require(_0xc13e('0xd'));var jsforce=require(_0xc13e('0xe'));var deskjs=require(_0xc13e('0xf'));var toCsv=require(_0xc13e('0x9'));var querystring=require(_0xc13e('0x10'));var Papa=require(_0xc13e('0x11'));var Redis=require(_0xc13e('0x12'));var authService=require(_0xc13e('0x13'));var qs=require(_0xc13e('0x14'));var as=require(_0xc13e('0x15'));var hardwareService=require(_0xc13e('0x16'));var logger=require('../../config/logger')(_0xc13e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc13e('0x18'));var db=require(_0xc13e('0x19'))['db'];function respondWithStatusCode(_0x321a5b,_0x40d9d8){_0x40d9d8=_0x40d9d8||0xcc;return function(_0x29b802){if(_0x29b802){return _0x321a5b['sendStatus'](_0x40d9d8);}return _0x321a5b[_0xc13e('0x1a')](_0x40d9d8)[_0xc13e('0x1b')]();};}function respondWithResult(_0x87e89d,_0x4519f9){_0x4519f9=_0x4519f9||0xc8;return function(_0x16b4dc){if(_0x16b4dc){return _0x87e89d[_0xc13e('0x1a')](_0x4519f9)[_0xc13e('0x1c')](_0x16b4dc);}};}function respondWithFilteredResult(_0x30b56d,_0x52b43f){return function(_0x5ebbc3){if(_0x5ebbc3){var _0x3c4964=typeof _0x52b43f[_0xc13e('0x1d')]===_0xc13e('0x1e')&&typeof _0x52b43f[_0xc13e('0x1f')]===_0xc13e('0x1e');var _0x1ce93e=_0x5ebbc3['count'];var _0x19371a=_0x3c4964?0x0:_0x52b43f[_0xc13e('0x1d')];var _0xef5475=_0x3c4964?_0x5ebbc3[_0xc13e('0x20')]:_0x52b43f[_0xc13e('0x1d')]+_0x52b43f[_0xc13e('0x1f')];var _0x356516;if(_0xef5475>=_0x1ce93e){_0xef5475=_0x1ce93e;_0x356516=0xc8;}else{_0x356516=0xce;}_0x30b56d[_0xc13e('0x1a')](_0x356516);return _0x30b56d[_0xc13e('0x21')](_0xc13e('0x22'),_0x19371a+'-'+_0xef5475+'/'+_0x1ce93e)[_0xc13e('0x1c')](_0x5ebbc3);}return null;};}function patchUpdates(_0x5d8c77){return function(_0x67f3dc){try{jsonpatch['apply'](_0x67f3dc,_0x5d8c77,!![]);}catch(_0x3d1d44){return BPromise['reject'](_0x3d1d44);}return _0x67f3dc['save']();};}function saveUpdates(_0x54d48b,_0x4df048){return function(_0x253a1d){if(_0x253a1d){return _0x253a1d[_0xc13e('0x23')](_0x54d48b)[_0xc13e('0x24')](function(_0x148833){return _0x148833;});}return null;};}function removeEntity(_0x2f8571,_0x32c29c){return function(_0x2a207e){if(_0x2a207e){return _0x2a207e[_0xc13e('0x25')]()['then'](function(){_0x2f8571[_0xc13e('0x1a')](0xcc)[_0xc13e('0x1b')]();});}};}function handleEntityNotFound(_0x216a03,_0x40ac59){return function(_0x5b8d31){if(!_0x5b8d31){_0x216a03[_0xc13e('0x26')](0x194);}return _0x5b8d31;};}function handleError(_0x197f8f,_0x5ae32e){_0x5ae32e=_0x5ae32e||0x1f4;return function(_0x2afbce){logger['error'](_0x2afbce[_0xc13e('0x27')]);if(_0x2afbce[_0xc13e('0x28')]){delete _0x2afbce[_0xc13e('0x28')];}_0x197f8f['status'](_0x5ae32e)[_0xc13e('0x29')](_0x2afbce);};}exports[_0xc13e('0x2a')]=function(_0x362a8f,_0x12995f){var _0x40e32b={},_0x58c00b={},_0x3f75a6={'count':0x0,'rows':[]};var _0x969413=_[_0xc13e('0x2b')](db[_0xc13e('0x2c')][_0xc13e('0x2d')],function(_0x21f72f){return{'name':_0x21f72f[_0xc13e('0x2e')],'type':_0x21f72f[_0xc13e('0x2f')][_0xc13e('0x30')]};});_0x58c00b[_0xc13e('0x31')]=_['map'](_0x969413,'name');_0x58c00b[_0xc13e('0x32')]=_[_0xc13e('0x33')](_0x362a8f[_0xc13e('0x32')]);_0x58c00b[_0xc13e('0x34')]=_[_0xc13e('0x35')](_0x58c00b['model'],_0x58c00b[_0xc13e('0x32')]);_0x40e32b['attributes']=_[_0xc13e('0x35')](_0x58c00b[_0xc13e('0x31')],qs['fields'](_0x362a8f[_0xc13e('0x32')][_0xc13e('0x36')]));_0x40e32b[_0xc13e('0x37')]=_0x40e32b[_0xc13e('0x37')][_0xc13e('0x38')]?_0x40e32b[_0xc13e('0x37')]:_0x58c00b[_0xc13e('0x31')];if(!_0x362a8f[_0xc13e('0x32')][_0xc13e('0x39')]('nolimit')){_0x40e32b[_0xc13e('0x1f')]=qs[_0xc13e('0x1f')](_0x362a8f[_0xc13e('0x32')]['limit']);_0x40e32b[_0xc13e('0x1d')]=qs[_0xc13e('0x1d')](_0x362a8f[_0xc13e('0x32')]['offset']);}_0x40e32b[_0xc13e('0x3a')]=qs[_0xc13e('0x3b')](_0x362a8f[_0xc13e('0x32')][_0xc13e('0x3b')]);_0x40e32b[_0xc13e('0x3c')]=qs[_0xc13e('0x34')](_[_0xc13e('0x3d')](_0x362a8f[_0xc13e('0x32')],_0x58c00b['filters']),_0x969413);if(_0x362a8f[_0xc13e('0x32')][_0xc13e('0x3e')]){_0x40e32b['where']=_['merge'](_0x40e32b[_0xc13e('0x3c')],{'$or':_[_0xc13e('0x2b')](_0x969413,function(_0x3d151e){if(_0x3d151e[_0xc13e('0x2f')]!=='VIRTUAL'){var _0x1f47cb={};_0x1f47cb[_0x3d151e[_0xc13e('0x28')]]={'$like':'%'+_0x362a8f[_0xc13e('0x32')][_0xc13e('0x3e')]+'%'};return _0x1f47cb;}})});}_0x40e32b=_['merge']({},_0x40e32b,_0x362a8f[_0xc13e('0x3f')]);var _0x2cacf0={'where':_0x40e32b['where']};return db[_0xc13e('0x2c')][_0xc13e('0x20')](_0x2cacf0)[_0xc13e('0x24')](function(_0x73375b){_0x3f75a6['count']=_0x73375b;if(_0x362a8f[_0xc13e('0x32')][_0xc13e('0x40')]){_0x40e32b[_0xc13e('0x41')]=[{'all':!![]}];}return db[_0xc13e('0x2c')][_0xc13e('0x42')](_0x40e32b);})[_0xc13e('0x24')](function(_0xbecd4f){_0x3f75a6[_0xc13e('0x43')]=_0xbecd4f;return _0x3f75a6;})[_0xc13e('0x24')](respondWithFilteredResult(_0x12995f,_0x40e32b))[_0xc13e('0x44')](handleError(_0x12995f,null));};exports['show']=function(_0x5e1957,_0x45f4bf){var _0x26cf2e={'raw':![],'where':{'id':_0x5e1957[_0xc13e('0x45')]['id']}},_0x566dce={};_0x566dce[_0xc13e('0x31')]=_[_0xc13e('0x33')](db['ZohoConfiguration'][_0xc13e('0x2d')]);_0x566dce['query']=_[_0xc13e('0x33')](_0x5e1957[_0xc13e('0x32')]);_0x566dce[_0xc13e('0x34')]=_[_0xc13e('0x35')](_0x566dce[_0xc13e('0x31')],_0x566dce[_0xc13e('0x32')]);_0x26cf2e[_0xc13e('0x37')]=_[_0xc13e('0x35')](_0x566dce[_0xc13e('0x31')],qs[_0xc13e('0x36')](_0x5e1957[_0xc13e('0x32')]['fields']));_0x26cf2e[_0xc13e('0x37')]=_0x26cf2e['attributes']['length']?_0x26cf2e[_0xc13e('0x37')]:_0x566dce[_0xc13e('0x31')];if(_0x5e1957[_0xc13e('0x32')][_0xc13e('0x40')]){_0x26cf2e[_0xc13e('0x41')]=[{'all':!![]}];}_0x26cf2e=_[_0xc13e('0x46')]({},_0x26cf2e,_0x5e1957['options']);return db[_0xc13e('0x2c')][_0xc13e('0x47')](_0x26cf2e)[_0xc13e('0x24')](handleEntityNotFound(_0x45f4bf,null))[_0xc13e('0x24')](respondWithResult(_0x45f4bf,null))[_0xc13e('0x44')](handleError(_0x45f4bf,null));};exports['create']=function(_0x82b60,_0x34f674){return db[_0xc13e('0x2c')][_0xc13e('0x48')](_0x82b60['body'],{})[_0xc13e('0x24')](respondWithResult(_0x34f674,0xc9))[_0xc13e('0x44')](handleError(_0x34f674,null));};exports[_0xc13e('0x23')]=function(_0x30b99c,_0x5b1408){if(_0x30b99c['body']['id']){delete _0x30b99c['body']['id'];}return db[_0xc13e('0x2c')][_0xc13e('0x47')]({'where':{'id':_0x30b99c[_0xc13e('0x45')]['id']}})[_0xc13e('0x24')](handleEntityNotFound(_0x5b1408,null))[_0xc13e('0x24')](saveUpdates(_0x30b99c['body'],null))[_0xc13e('0x24')](respondWithResult(_0x5b1408,null))[_0xc13e('0x44')](handleError(_0x5b1408,null));};exports[_0xc13e('0x25')]=function(_0x5ce57a,_0x49bcad){return db[_0xc13e('0x2c')][_0xc13e('0x47')]({'where':{'id':_0x5ce57a['params']['id']}})[_0xc13e('0x24')](handleEntityNotFound(_0x49bcad,null))[_0xc13e('0x24')](removeEntity(_0x49bcad,null))['catch'](handleError(_0x49bcad,null));};exports['getFields']=function(_0xe58a94,_0x54a566,_0x12b7a8){var _0x47ed82={};var _0x346c88={};var _0x263fd8;var _0x5726aa;return db['ZohoConfiguration'][_0xc13e('0x49')]({'where':{'id':_0xe58a94[_0xc13e('0x45')]['id']}})[_0xc13e('0x24')](handleEntityNotFound(_0x54a566,null))[_0xc13e('0x24')](function(_0x25f53b){if(_0x25f53b){_0x263fd8=_0x25f53b;_0x346c88[_0xc13e('0x31')]=_['keys'](db[_0xc13e('0x4a')][_0xc13e('0x2d')]);_0x346c88[_0xc13e('0x32')]=_[_0xc13e('0x33')](_0xe58a94[_0xc13e('0x32')]);_0x346c88[_0xc13e('0x34')]=_[_0xc13e('0x35')](_0x346c88[_0xc13e('0x31')],_0x346c88['query']);_0x47ed82[_0xc13e('0x37')]=_[_0xc13e('0x35')](_0x346c88[_0xc13e('0x31')],qs['fields'](_0xe58a94[_0xc13e('0x32')]['fields']));_0x47ed82[_0xc13e('0x37')]=_0x47ed82[_0xc13e('0x37')][_0xc13e('0x38')]?_0x47ed82[_0xc13e('0x37')]:_0x346c88[_0xc13e('0x31')];_0x47ed82[_0xc13e('0x3a')]=qs[_0xc13e('0x3b')](_0xe58a94[_0xc13e('0x32')][_0xc13e('0x3b')]);_0x47ed82[_0xc13e('0x3c')]=qs[_0xc13e('0x34')](_['pick'](_0xe58a94['query'],_0x346c88[_0xc13e('0x34')]));if(_0xe58a94[_0xc13e('0x32')]['filter']){_0x47ed82[_0xc13e('0x3c')]=_[_0xc13e('0x46')](_0x47ed82['where'],{'$or':_['map'](_0x47ed82[_0xc13e('0x37')],function(_0x361e23){var _0x2887b6={};_0x2887b6[_0x361e23]={'$like':'%'+_0xe58a94[_0xc13e('0x32')]['filter']+'%'};return _0x2887b6;})});}_0x47ed82=_[_0xc13e('0x46')]({},_0x47ed82,_0xe58a94[_0xc13e('0x3f')]);return _0x263fd8[_0xc13e('0x4b')](_0x47ed82);}})[_0xc13e('0x24')](function(_0x50165c){if(_0x50165c){_0x5726aa=_0x50165c[_0xc13e('0x38')];if(!_0xe58a94[_0xc13e('0x32')][_0xc13e('0x39')](_0xc13e('0x4c'))){_0x47ed82[_0xc13e('0x1f')]=qs[_0xc13e('0x1f')](_0xe58a94[_0xc13e('0x32')][_0xc13e('0x1f')]);_0x47ed82[_0xc13e('0x1d')]=qs[_0xc13e('0x1d')](_0xe58a94[_0xc13e('0x32')]['offset']);}return _0x263fd8[_0xc13e('0x4b')](_0x47ed82);}})['then'](function(_0x280a26){if(_0x280a26){return _0x280a26?{'count':_0x5726aa,'rows':_0x280a26}:null;}})[_0xc13e('0x24')](respondWithResult(_0x54a566,null))['catch'](handleError(_0x54a566,null));};exports[_0xc13e('0x4d')]=function(_0x5f39d9,_0x26552c,_0x419dda){var _0x57bd9a={};var _0x4ef548={};var _0x1cc476;var _0x3277c5;return db[_0xc13e('0x2c')][_0xc13e('0x49')]({'where':{'id':_0x5f39d9[_0xc13e('0x45')]['id']}})[_0xc13e('0x24')](handleEntityNotFound(_0x26552c,null))[_0xc13e('0x24')](function(_0x519b89){if(_0x519b89){_0x1cc476=_0x519b89;_0x4ef548[_0xc13e('0x31')]=_['keys'](db[_0xc13e('0x4a')][_0xc13e('0x2d')]);_0x4ef548[_0xc13e('0x32')]=_[_0xc13e('0x33')](_0x5f39d9[_0xc13e('0x32')]);_0x4ef548[_0xc13e('0x34')]=_['intersection'](_0x4ef548[_0xc13e('0x31')],_0x4ef548['query']);_0x57bd9a[_0xc13e('0x37')]=_[_0xc13e('0x35')](_0x4ef548[_0xc13e('0x31')],qs['fields'](_0x5f39d9[_0xc13e('0x32')][_0xc13e('0x36')]));_0x57bd9a[_0xc13e('0x37')]=_0x57bd9a[_0xc13e('0x37')]['length']?_0x57bd9a[_0xc13e('0x37')]:_0x4ef548['model'];_0x57bd9a[_0xc13e('0x3a')]=qs['sort'](_0x5f39d9[_0xc13e('0x32')][_0xc13e('0x3b')]);_0x57bd9a['where']=qs[_0xc13e('0x34')](_[_0xc13e('0x3d')](_0x5f39d9[_0xc13e('0x32')],_0x4ef548[_0xc13e('0x34')]));if(_0x5f39d9[_0xc13e('0x32')]['filter']){_0x57bd9a[_0xc13e('0x3c')]=_[_0xc13e('0x46')](_0x57bd9a['where'],{'$or':_[_0xc13e('0x2b')](_0x57bd9a[_0xc13e('0x37')],function(_0x31d7c9){var _0x4b384e={};_0x4b384e[_0x31d7c9]={'$like':'%'+_0x5f39d9[_0xc13e('0x32')][_0xc13e('0x3e')]+'%'};return _0x4b384e;})});}_0x57bd9a=_[_0xc13e('0x46')]({},_0x57bd9a,_0x5f39d9[_0xc13e('0x3f')]);return _0x1cc476['getSubjects'](_0x57bd9a);}})[_0xc13e('0x24')](function(_0x1285e1){if(_0x1285e1){_0x3277c5=_0x1285e1[_0xc13e('0x38')];if(!_0x5f39d9['query'][_0xc13e('0x39')]('nolimit')){_0x57bd9a[_0xc13e('0x1f')]=qs[_0xc13e('0x1f')](_0x5f39d9[_0xc13e('0x32')][_0xc13e('0x1f')]);_0x57bd9a[_0xc13e('0x1d')]=qs[_0xc13e('0x1d')](_0x5f39d9[_0xc13e('0x32')][_0xc13e('0x1d')]);}return _0x1cc476[_0xc13e('0x4d')](_0x57bd9a);}})['then'](function(_0x224c9e){if(_0x224c9e){return _0x224c9e?{'count':_0x3277c5,'rows':_0x224c9e}:null;}})[_0xc13e('0x24')](respondWithResult(_0x26552c,null))[_0xc13e('0x44')](handleError(_0x26552c,null));};exports[_0xc13e('0x4e')]=function(_0x22d81a,_0x150da8,_0x226892){var _0x24d1be={};var _0x921885={};var _0x2c91b5;var _0x47043d;return db['ZohoConfiguration'][_0xc13e('0x49')]({'where':{'id':_0x22d81a[_0xc13e('0x45')]['id']}})['then'](handleEntityNotFound(_0x150da8,null))[_0xc13e('0x24')](function(_0x3ec95c){if(_0x3ec95c){_0x2c91b5=_0x3ec95c;_0x921885[_0xc13e('0x31')]=_['keys'](db[_0xc13e('0x4a')][_0xc13e('0x2d')]);_0x921885['query']=_['keys'](_0x22d81a[_0xc13e('0x32')]);_0x921885[_0xc13e('0x34')]=_[_0xc13e('0x35')](_0x921885['model'],_0x921885['query']);_0x24d1be[_0xc13e('0x37')]=_[_0xc13e('0x35')](_0x921885['model'],qs['fields'](_0x22d81a['query'][_0xc13e('0x36')]));_0x24d1be[_0xc13e('0x37')]=_0x24d1be[_0xc13e('0x37')]['length']?_0x24d1be[_0xc13e('0x37')]:_0x921885[_0xc13e('0x31')];_0x24d1be[_0xc13e('0x3a')]=qs[_0xc13e('0x3b')](_0x22d81a[_0xc13e('0x32')][_0xc13e('0x3b')]);_0x24d1be[_0xc13e('0x3c')]=qs['filters'](_[_0xc13e('0x3d')](_0x22d81a[_0xc13e('0x32')],_0x921885[_0xc13e('0x34')]));if(_0x22d81a[_0xc13e('0x32')][_0xc13e('0x3e')]){_0x24d1be[_0xc13e('0x3c')]=_[_0xc13e('0x46')](_0x24d1be['where'],{'$or':_[_0xc13e('0x2b')](_0x24d1be[_0xc13e('0x37')],function(_0x2772cf){var _0x5525b0={};_0x5525b0[_0x2772cf]={'$like':'%'+_0x22d81a[_0xc13e('0x32')][_0xc13e('0x3e')]+'%'};return _0x5525b0;})});}_0x24d1be=_[_0xc13e('0x46')]({},_0x24d1be,_0x22d81a[_0xc13e('0x3f')]);return _0x2c91b5[_0xc13e('0x4e')](_0x24d1be);}})[_0xc13e('0x24')](function(_0x28bff3){if(_0x28bff3){_0x47043d=_0x28bff3[_0xc13e('0x38')];if(!_0x22d81a[_0xc13e('0x32')][_0xc13e('0x39')](_0xc13e('0x4c'))){_0x24d1be['limit']=qs[_0xc13e('0x1f')](_0x22d81a[_0xc13e('0x32')]['limit']);_0x24d1be[_0xc13e('0x1d')]=qs[_0xc13e('0x1d')](_0x22d81a[_0xc13e('0x32')]['offset']);}return _0x2c91b5[_0xc13e('0x4e')](_0x24d1be);}})[_0xc13e('0x24')](function(_0x36d648){if(_0x36d648){return _0x36d648?{'count':_0x47043d,'rows':_0x36d648}:null;}})[_0xc13e('0x24')](respondWithResult(_0x150da8,null))[_0xc13e('0x44')](handleError(_0x150da8,null));}; \ No newline at end of file +var _0x5d80=['../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','index','map','ZohoConfiguration','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','findOne','ZohoField','order','filter','getFields','getSubjects','getDescriptions','eml-format','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x71b9ce,_0xb04066){var _0x49b2c1=function(_0x210908){while(--_0x210908){_0x71b9ce['push'](_0x71b9ce['shift']());}};_0x49b2c1(++_0xb04066);}(_0x5d80,0x1a4));var _0x05d8=function(_0x217cc1,_0x591a7f){_0x217cc1=_0x217cc1-0x0;var _0x2f8527=_0x5d80[_0x217cc1];return _0x2f8527;};'use strict';var emlformat=require(_0x05d8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x05d8('0x1'));var rp=require('request-promise');var moment=require(_0x05d8('0x2'));var BPromise=require(_0x05d8('0x3'));var Mustache=require('mustache');var util=require(_0x05d8('0x4'));var path=require('path');var sox=require(_0x05d8('0x5'));var csv=require('to-csv');var ejs=require(_0x05d8('0x6'));var fs=require('fs');var fs_extra=require(_0x05d8('0x7'));var _=require(_0x05d8('0x8'));var squel=require(_0x05d8('0x9'));var crypto=require('crypto');var jsforce=require(_0x05d8('0xa'));var deskjs=require(_0x05d8('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x05d8('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05d8('0xd'));var utils=require('../../config/utils');var config=require(_0x05d8('0xe'));var licenseUtil=require(_0x05d8('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8df3b7,_0x3a69f2){_0x3a69f2=_0x3a69f2||0xcc;return function(_0xfe9491){if(_0xfe9491){return _0x8df3b7['sendStatus'](_0x3a69f2);}return _0x8df3b7[_0x05d8('0x10')](_0x3a69f2)[_0x05d8('0x11')]();};}function respondWithResult(_0x273c0f,_0x221daa){_0x221daa=_0x221daa||0xc8;return function(_0xbf0bc4){if(_0xbf0bc4){return _0x273c0f[_0x05d8('0x10')](_0x221daa)[_0x05d8('0x12')](_0xbf0bc4);}};}function respondWithFilteredResult(_0x5e1bbb,_0x3a4808){return function(_0x1dc47c){if(_0x1dc47c){var _0x639502=typeof _0x3a4808['offset']===_0x05d8('0x13')&&typeof _0x3a4808[_0x05d8('0x14')]===_0x05d8('0x13');var _0x51674f=_0x1dc47c['count'];var _0x2c7c3f=_0x639502?0x0:_0x3a4808[_0x05d8('0x15')];var _0xf00369=_0x639502?_0x1dc47c[_0x05d8('0x16')]:_0x3a4808[_0x05d8('0x15')]+_0x3a4808[_0x05d8('0x14')];var _0x306b21;if(_0xf00369>=_0x51674f){_0xf00369=_0x51674f;_0x306b21=0xc8;}else{_0x306b21=0xce;}_0x5e1bbb['status'](_0x306b21);return _0x5e1bbb[_0x05d8('0x17')](_0x05d8('0x18'),_0x2c7c3f+'-'+_0xf00369+'/'+_0x51674f)[_0x05d8('0x12')](_0x1dc47c);}return null;};}function patchUpdates(_0x51b3e0){return function(_0x3a6851){try{jsonpatch[_0x05d8('0x19')](_0x3a6851,_0x51b3e0,!![]);}catch(_0x1adc2a){return BPromise[_0x05d8('0x1a')](_0x1adc2a);}return _0x3a6851[_0x05d8('0x1b')]();};}function saveUpdates(_0x56520f,_0xac30a3){return function(_0x4e1dda){if(_0x4e1dda){return _0x4e1dda[_0x05d8('0x1c')](_0x56520f)[_0x05d8('0x1d')](function(_0x5c6962){return _0x5c6962;});}return null;};}function removeEntity(_0x324bc8,_0x364335){return function(_0x463c03){if(_0x463c03){return _0x463c03[_0x05d8('0x1e')]()['then'](function(){_0x324bc8['status'](0xcc)[_0x05d8('0x11')]();});}};}function handleEntityNotFound(_0x333112,_0x31e712){return function(_0x3d147a){if(!_0x3d147a){_0x333112[_0x05d8('0x1f')](0x194);}return _0x3d147a;};}function handleError(_0x52f874,_0x3e2edb){_0x3e2edb=_0x3e2edb||0x1f4;return function(_0x154f4f){logger['error'](_0x154f4f[_0x05d8('0x20')]);if(_0x154f4f['name']){delete _0x154f4f['name'];}_0x52f874[_0x05d8('0x10')](_0x3e2edb)['send'](_0x154f4f);};}exports[_0x05d8('0x21')]=function(_0x2e7f93,_0x43a6ba){var _0x51ebbb={},_0x422c8e={},_0x702124={'count':0x0,'rows':[]};var _0x355d28=_[_0x05d8('0x22')](db[_0x05d8('0x23')][_0x05d8('0x24')],function(_0x120ff1){return{'name':_0x120ff1['fieldName'],'type':_0x120ff1[_0x05d8('0x25')][_0x05d8('0x26')]};});_0x422c8e[_0x05d8('0x27')]=_[_0x05d8('0x22')](_0x355d28,_0x05d8('0x28'));_0x422c8e[_0x05d8('0x29')]=_[_0x05d8('0x2a')](_0x2e7f93['query']);_0x422c8e[_0x05d8('0x2b')]=_[_0x05d8('0x2c')](_0x422c8e[_0x05d8('0x27')],_0x422c8e[_0x05d8('0x29')]);_0x51ebbb[_0x05d8('0x2d')]=_['intersection'](_0x422c8e[_0x05d8('0x27')],qs[_0x05d8('0x2e')](_0x2e7f93['query']['fields']));_0x51ebbb[_0x05d8('0x2d')]=_0x51ebbb[_0x05d8('0x2d')]['length']?_0x51ebbb[_0x05d8('0x2d')]:_0x422c8e[_0x05d8('0x27')];if(!_0x2e7f93['query'][_0x05d8('0x2f')](_0x05d8('0x30'))){_0x51ebbb['limit']=qs['limit'](_0x2e7f93[_0x05d8('0x29')]['limit']);_0x51ebbb[_0x05d8('0x15')]=qs[_0x05d8('0x15')](_0x2e7f93[_0x05d8('0x29')][_0x05d8('0x15')]);}_0x51ebbb['order']=qs[_0x05d8('0x31')](_0x2e7f93['query'][_0x05d8('0x31')]);_0x51ebbb['where']=qs[_0x05d8('0x2b')](_[_0x05d8('0x32')](_0x2e7f93[_0x05d8('0x29')],_0x422c8e[_0x05d8('0x2b')]),_0x355d28);if(_0x2e7f93[_0x05d8('0x29')]['filter']){_0x51ebbb['where']=_[_0x05d8('0x33')](_0x51ebbb[_0x05d8('0x34')],{'$or':_[_0x05d8('0x22')](_0x355d28,function(_0x421dc4){if(_0x421dc4[_0x05d8('0x25')]!==_0x05d8('0x35')){var _0x47b079={};_0x47b079[_0x421dc4[_0x05d8('0x28')]]={'$like':'%'+_0x2e7f93['query']['filter']+'%'};return _0x47b079;}})});}_0x51ebbb=_['merge']({},_0x51ebbb,_0x2e7f93['options']);var _0x3265ff={'where':_0x51ebbb['where']};return db[_0x05d8('0x23')][_0x05d8('0x16')](_0x3265ff)['then'](function(_0x179af1){_0x702124[_0x05d8('0x16')]=_0x179af1;if(_0x2e7f93['query'][_0x05d8('0x36')]){_0x51ebbb[_0x05d8('0x37')]=[{'all':!![]}];}return db[_0x05d8('0x23')]['findAll'](_0x51ebbb);})['then'](function(_0x2946c3){_0x702124[_0x05d8('0x38')]=_0x2946c3;return _0x702124;})[_0x05d8('0x1d')](respondWithFilteredResult(_0x43a6ba,_0x51ebbb))[_0x05d8('0x39')](handleError(_0x43a6ba,null));};exports[_0x05d8('0x3a')]=function(_0x225ec2,_0x38ebbd){var _0x46d8b6={'raw':![],'where':{'id':_0x225ec2[_0x05d8('0x3b')]['id']}},_0x42e012={};_0x42e012[_0x05d8('0x27')]=_[_0x05d8('0x2a')](db[_0x05d8('0x23')][_0x05d8('0x24')]);_0x42e012[_0x05d8('0x29')]=_[_0x05d8('0x2a')](_0x225ec2[_0x05d8('0x29')]);_0x42e012[_0x05d8('0x2b')]=_[_0x05d8('0x2c')](_0x42e012[_0x05d8('0x27')],_0x42e012[_0x05d8('0x29')]);_0x46d8b6['attributes']=_[_0x05d8('0x2c')](_0x42e012[_0x05d8('0x27')],qs[_0x05d8('0x2e')](_0x225ec2[_0x05d8('0x29')][_0x05d8('0x2e')]));_0x46d8b6[_0x05d8('0x2d')]=_0x46d8b6['attributes'][_0x05d8('0x3c')]?_0x46d8b6['attributes']:_0x42e012[_0x05d8('0x27')];if(_0x225ec2['query'][_0x05d8('0x36')]){_0x46d8b6[_0x05d8('0x37')]=[{'all':!![]}];}_0x46d8b6=_['merge']({},_0x46d8b6,_0x225ec2[_0x05d8('0x3d')]);return db['ZohoConfiguration'][_0x05d8('0x3e')](_0x46d8b6)[_0x05d8('0x1d')](handleEntityNotFound(_0x38ebbd,null))[_0x05d8('0x1d')](respondWithResult(_0x38ebbd,null))['catch'](handleError(_0x38ebbd,null));};exports['create']=function(_0x27e7e5,_0x5225ce){return db[_0x05d8('0x23')][_0x05d8('0x3f')](_0x27e7e5['body'],{})[_0x05d8('0x1d')](respondWithResult(_0x5225ce,0xc9))[_0x05d8('0x39')](handleError(_0x5225ce,null));};exports['update']=function(_0x49bdea,_0x4087b8){if(_0x49bdea[_0x05d8('0x40')]['id']){delete _0x49bdea['body']['id'];}return db[_0x05d8('0x23')][_0x05d8('0x3e')]({'where':{'id':_0x49bdea[_0x05d8('0x3b')]['id']}})[_0x05d8('0x1d')](handleEntityNotFound(_0x4087b8,null))[_0x05d8('0x1d')](saveUpdates(_0x49bdea[_0x05d8('0x40')],null))[_0x05d8('0x1d')](respondWithResult(_0x4087b8,null))[_0x05d8('0x39')](handleError(_0x4087b8,null));};exports[_0x05d8('0x1e')]=function(_0x2992b4,_0x5273c6){return db[_0x05d8('0x23')][_0x05d8('0x3e')]({'where':{'id':_0x2992b4['params']['id']}})[_0x05d8('0x1d')](handleEntityNotFound(_0x5273c6,null))[_0x05d8('0x1d')](removeEntity(_0x5273c6,null))[_0x05d8('0x39')](handleError(_0x5273c6,null));};exports['getFields']=function(_0x290a83,_0x14dcce,_0x5c64e5){var _0x2f02a8={};var _0xe3950b={};var _0x166c46;var _0x3259ba;return db[_0x05d8('0x23')][_0x05d8('0x41')]({'where':{'id':_0x290a83[_0x05d8('0x3b')]['id']}})[_0x05d8('0x1d')](handleEntityNotFound(_0x14dcce,null))[_0x05d8('0x1d')](function(_0x344be3){if(_0x344be3){_0x166c46=_0x344be3;_0xe3950b[_0x05d8('0x27')]=_[_0x05d8('0x2a')](db[_0x05d8('0x42')][_0x05d8('0x24')]);_0xe3950b[_0x05d8('0x29')]=_['keys'](_0x290a83[_0x05d8('0x29')]);_0xe3950b['filters']=_[_0x05d8('0x2c')](_0xe3950b[_0x05d8('0x27')],_0xe3950b[_0x05d8('0x29')]);_0x2f02a8[_0x05d8('0x2d')]=_[_0x05d8('0x2c')](_0xe3950b[_0x05d8('0x27')],qs[_0x05d8('0x2e')](_0x290a83[_0x05d8('0x29')]['fields']));_0x2f02a8[_0x05d8('0x2d')]=_0x2f02a8['attributes'][_0x05d8('0x3c')]?_0x2f02a8['attributes']:_0xe3950b[_0x05d8('0x27')];_0x2f02a8[_0x05d8('0x43')]=qs[_0x05d8('0x31')](_0x290a83[_0x05d8('0x29')]['sort']);_0x2f02a8[_0x05d8('0x34')]=qs[_0x05d8('0x2b')](_[_0x05d8('0x32')](_0x290a83[_0x05d8('0x29')],_0xe3950b[_0x05d8('0x2b')]));if(_0x290a83['query'][_0x05d8('0x44')]){_0x2f02a8[_0x05d8('0x34')]=_[_0x05d8('0x33')](_0x2f02a8['where'],{'$or':_[_0x05d8('0x22')](_0x2f02a8[_0x05d8('0x2d')],function(_0x2ab906){var _0x35b812={};_0x35b812[_0x2ab906]={'$like':'%'+_0x290a83[_0x05d8('0x29')]['filter']+'%'};return _0x35b812;})});}_0x2f02a8=_[_0x05d8('0x33')]({},_0x2f02a8,_0x290a83[_0x05d8('0x3d')]);return _0x166c46[_0x05d8('0x45')](_0x2f02a8);}})[_0x05d8('0x1d')](function(_0x9ca874){if(_0x9ca874){_0x3259ba=_0x9ca874[_0x05d8('0x3c')];if(!_0x290a83[_0x05d8('0x29')][_0x05d8('0x2f')](_0x05d8('0x30'))){_0x2f02a8['limit']=qs[_0x05d8('0x14')](_0x290a83[_0x05d8('0x29')][_0x05d8('0x14')]);_0x2f02a8['offset']=qs[_0x05d8('0x15')](_0x290a83[_0x05d8('0x29')][_0x05d8('0x15')]);}return _0x166c46['getFields'](_0x2f02a8);}})[_0x05d8('0x1d')](function(_0x568cd5){if(_0x568cd5){return _0x568cd5?{'count':_0x3259ba,'rows':_0x568cd5}:null;}})['then'](respondWithResult(_0x14dcce,null))[_0x05d8('0x39')](handleError(_0x14dcce,null));};exports['getSubjects']=function(_0x2f085e,_0x11f9d5,_0x4c13e5){var _0x3d1afc={};var _0x5103d6={};var _0x11bab6;var _0x3f690d;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x2f085e[_0x05d8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x11f9d5,null))[_0x05d8('0x1d')](function(_0x1f6b87){if(_0x1f6b87){_0x11bab6=_0x1f6b87;_0x5103d6[_0x05d8('0x27')]=_[_0x05d8('0x2a')](db['ZohoField']['rawAttributes']);_0x5103d6[_0x05d8('0x29')]=_['keys'](_0x2f085e[_0x05d8('0x29')]);_0x5103d6[_0x05d8('0x2b')]=_[_0x05d8('0x2c')](_0x5103d6[_0x05d8('0x27')],_0x5103d6[_0x05d8('0x29')]);_0x3d1afc[_0x05d8('0x2d')]=_[_0x05d8('0x2c')](_0x5103d6[_0x05d8('0x27')],qs['fields'](_0x2f085e[_0x05d8('0x29')]['fields']));_0x3d1afc['attributes']=_0x3d1afc[_0x05d8('0x2d')][_0x05d8('0x3c')]?_0x3d1afc[_0x05d8('0x2d')]:_0x5103d6[_0x05d8('0x27')];_0x3d1afc[_0x05d8('0x43')]=qs[_0x05d8('0x31')](_0x2f085e[_0x05d8('0x29')][_0x05d8('0x31')]);_0x3d1afc[_0x05d8('0x34')]=qs[_0x05d8('0x2b')](_[_0x05d8('0x32')](_0x2f085e[_0x05d8('0x29')],_0x5103d6[_0x05d8('0x2b')]));if(_0x2f085e[_0x05d8('0x29')][_0x05d8('0x44')]){_0x3d1afc[_0x05d8('0x34')]=_['merge'](_0x3d1afc[_0x05d8('0x34')],{'$or':_['map'](_0x3d1afc[_0x05d8('0x2d')],function(_0x516df3){var _0x15e4b1={};_0x15e4b1[_0x516df3]={'$like':'%'+_0x2f085e[_0x05d8('0x29')][_0x05d8('0x44')]+'%'};return _0x15e4b1;})});}_0x3d1afc=_[_0x05d8('0x33')]({},_0x3d1afc,_0x2f085e['options']);return _0x11bab6[_0x05d8('0x46')](_0x3d1afc);}})['then'](function(_0x5a71f3){if(_0x5a71f3){_0x3f690d=_0x5a71f3[_0x05d8('0x3c')];if(!_0x2f085e[_0x05d8('0x29')][_0x05d8('0x2f')](_0x05d8('0x30'))){_0x3d1afc['limit']=qs[_0x05d8('0x14')](_0x2f085e['query'][_0x05d8('0x14')]);_0x3d1afc[_0x05d8('0x15')]=qs['offset'](_0x2f085e[_0x05d8('0x29')][_0x05d8('0x15')]);}return _0x11bab6[_0x05d8('0x46')](_0x3d1afc);}})['then'](function(_0x320020){if(_0x320020){return _0x320020?{'count':_0x3f690d,'rows':_0x320020}:null;}})[_0x05d8('0x1d')](respondWithResult(_0x11f9d5,null))[_0x05d8('0x39')](handleError(_0x11f9d5,null));};exports['getDescriptions']=function(_0x10e685,_0x311d32,_0x34ef0f){var _0xcf4393={};var _0x5d934f={};var _0x1825d7;var _0x42faa3;return db['ZohoConfiguration'][_0x05d8('0x41')]({'where':{'id':_0x10e685[_0x05d8('0x3b')]['id']}})[_0x05d8('0x1d')](handleEntityNotFound(_0x311d32,null))[_0x05d8('0x1d')](function(_0x526829){if(_0x526829){_0x1825d7=_0x526829;_0x5d934f[_0x05d8('0x27')]=_[_0x05d8('0x2a')](db[_0x05d8('0x42')][_0x05d8('0x24')]);_0x5d934f['query']=_[_0x05d8('0x2a')](_0x10e685[_0x05d8('0x29')]);_0x5d934f[_0x05d8('0x2b')]=_['intersection'](_0x5d934f[_0x05d8('0x27')],_0x5d934f[_0x05d8('0x29')]);_0xcf4393[_0x05d8('0x2d')]=_[_0x05d8('0x2c')](_0x5d934f[_0x05d8('0x27')],qs[_0x05d8('0x2e')](_0x10e685[_0x05d8('0x29')][_0x05d8('0x2e')]));_0xcf4393[_0x05d8('0x2d')]=_0xcf4393[_0x05d8('0x2d')][_0x05d8('0x3c')]?_0xcf4393[_0x05d8('0x2d')]:_0x5d934f[_0x05d8('0x27')];_0xcf4393[_0x05d8('0x43')]=qs[_0x05d8('0x31')](_0x10e685[_0x05d8('0x29')][_0x05d8('0x31')]);_0xcf4393[_0x05d8('0x34')]=qs[_0x05d8('0x2b')](_[_0x05d8('0x32')](_0x10e685['query'],_0x5d934f[_0x05d8('0x2b')]));if(_0x10e685['query'][_0x05d8('0x44')]){_0xcf4393[_0x05d8('0x34')]=_[_0x05d8('0x33')](_0xcf4393[_0x05d8('0x34')],{'$or':_[_0x05d8('0x22')](_0xcf4393[_0x05d8('0x2d')],function(_0x5a0709){var _0x4130cd={};_0x4130cd[_0x5a0709]={'$like':'%'+_0x10e685[_0x05d8('0x29')][_0x05d8('0x44')]+'%'};return _0x4130cd;})});}_0xcf4393=_[_0x05d8('0x33')]({},_0xcf4393,_0x10e685[_0x05d8('0x3d')]);return _0x1825d7['getDescriptions'](_0xcf4393);}})[_0x05d8('0x1d')](function(_0x323c7e){if(_0x323c7e){_0x42faa3=_0x323c7e[_0x05d8('0x3c')];if(!_0x10e685[_0x05d8('0x29')][_0x05d8('0x2f')]('nolimit')){_0xcf4393[_0x05d8('0x14')]=qs[_0x05d8('0x14')](_0x10e685[_0x05d8('0x29')][_0x05d8('0x14')]);_0xcf4393['offset']=qs['offset'](_0x10e685[_0x05d8('0x29')][_0x05d8('0x15')]);}return _0x1825d7[_0x05d8('0x47')](_0xcf4393);}})[_0x05d8('0x1d')](function(_0x841188){if(_0x841188){return _0x841188?{'count':_0x42faa3,'rows':_0x841188}:null;}})[_0x05d8('0x1d')](respondWithResult(_0x311d32,null))['catch'](handleError(_0x311d32,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 0708da7..67f25d7 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.model.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4969=['rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x51c6a7,_0x59ea49){var _0x1e6962=function(_0x33739e){while(--_0x33739e){_0x51c6a7['push'](_0x51c6a7['shift']());}};_0x1e6962(++_0x59ea49);}(_0x4969,0xbc));var _0x9496=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x4969[_0x2459fd];return _0x364cd2;};'use strict';var _=require(_0x9496('0x0'));var util=require('util');var logger=require(_0x9496('0x1'))(_0x9496('0x2'));var moment=require(_0x9496('0x3'));var BPromise=require(_0x9496('0x4'));var rp=require(_0x9496('0x5'));var fs=require('fs');var path=require(_0x9496('0x6'));var rimraf=require(_0x9496('0x7'));var config=require('../../config/environment');var attributes=require(_0x9496('0x8'));module[_0x9496('0x9')]=function(_0x1e7e1a,_0x27461){return _0x1e7e1a[_0x9496('0xa')](_0x9496('0xb'),attributes,{'tableName':_0x9496('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dc3=['../../config/environment','./intZohoConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x3dc3,0x6c));var _0x33dc=function(_0x33daeb,_0x2c5f4b){_0x33daeb=_0x33daeb-0x0;var _0xaa5215=_0x3dc3[_0x33daeb];return _0xaa5215;};'use strict';var _=require(_0x33dc('0x0'));var util=require(_0x33dc('0x1'));var logger=require(_0x33dc('0x2'))(_0x33dc('0x3'));var moment=require(_0x33dc('0x4'));var BPromise=require(_0x33dc('0x5'));var rp=require(_0x33dc('0x6'));var fs=require('fs');var path=require(_0x33dc('0x7'));var rimraf=require(_0x33dc('0x8'));var config=require(_0x33dc('0x9'));var attributes=require(_0x33dc('0xa'));module[_0x33dc('0xb')]=function(_0x4458e1,_0x35e0e8){return _0x4458e1[_0x33dc('0xc')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index a5335a2..faa85b5 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22e9=['catch','util','moment','bluebird','randomstring','ioredis','jayson/promise','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0x22e9,0x1c9));var _0x922e=function(_0x1efed4,_0x3e803b){_0x1efed4=_0x1efed4-0x0;var _0x2e76e9=_0x22e9[_0x1efed4];return _0x2e76e9;};'use strict';var _=require('lodash');var util=require(_0x922e('0x0'));var moment=require(_0x922e('0x1'));var BPromise=require(_0x922e('0x2'));var rs=require(_0x922e('0x3'));var fs=require('fs');var Redis=require(_0x922e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x922e('0x5'));var client=jayson['client'][_0x922e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a391c,_0x253470,_0x1f3995){return new BPromise(function(_0x27f03f,_0x2266bb){return client[_0x922e('0x7')](_0x4a391c,_0x1f3995)[_0x922e('0x8')](function(_0x5f0a94){logger[_0x922e('0x9')](_0x922e('0xa'),_0x253470,_0x922e('0xb'));logger[_0x922e('0xc')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x253470,_0x922e('0xb'),JSON[_0x922e('0xd')](_0x5f0a94));if(_0x5f0a94[_0x922e('0xe')]){if(_0x5f0a94[_0x922e('0xe')][_0x922e('0xf')]===0x1f4){logger['error'](_0x922e('0xa'),_0x253470,_0x5f0a94[_0x922e('0xe')][_0x922e('0x10')]);return _0x2266bb(_0x5f0a94['error'][_0x922e('0x10')]);}logger[_0x922e('0xe')](_0x922e('0xa'),_0x253470,_0x5f0a94['error'][_0x922e('0x10')]);return _0x27f03f(_0x5f0a94[_0x922e('0xe')][_0x922e('0x10')]);}else{logger[_0x922e('0x9')](_0x922e('0xa'),_0x253470,_0x922e('0xb'));_0x27f03f(_0x5f0a94[_0x922e('0x11')][_0x922e('0x10')]);}})[_0x922e('0x12')](function(_0x1cc602){logger[_0x922e('0xe')](_0x922e('0xa'),_0x253470,_0x1cc602);_0x2266bb(_0x1cc602);});});} \ No newline at end of file +var _0x66a0=['jayson/promise','client','http','request','then','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1b9ddf,_0x32e7f5){var _0x5f4baa=function(_0x537180){while(--_0x537180){_0x1b9ddf['push'](_0x1b9ddf['shift']());}};_0x5f4baa(++_0x32e7f5);}(_0x66a0,0x17e));var _0x066a=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0x66a0[_0x3a6e4b];return _0x36572d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x066a('0x0'));var BPromise=require(_0x066a('0x1'));var rs=require(_0x066a('0x2'));var fs=require('fs');var Redis=require(_0x066a('0x3'));var db=require(_0x066a('0x4'))['db'];var utils=require(_0x066a('0x5'));var logger=require(_0x066a('0x6'))(_0x066a('0x7'));var config=require(_0x066a('0x8'));var jayson=require(_0x066a('0x9'));var client=jayson[_0x066a('0xa')][_0x066a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52134b,_0xb50bbe,_0x1224ee){return new BPromise(function(_0x34f8b5,_0x123c10){return client[_0x066a('0xc')](_0x52134b,_0x1224ee)[_0x066a('0xd')](function(_0x1e4ea8){logger[_0x066a('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0xb50bbe,_0x066a('0xf'));logger['debug'](_0x066a('0x10'),_0xb50bbe,_0x066a('0xf'),JSON[_0x066a('0x11')](_0x1e4ea8));if(_0x1e4ea8[_0x066a('0x12')]){if(_0x1e4ea8['error'][_0x066a('0x13')]===0x1f4){logger[_0x066a('0x12')](_0x066a('0x14'),_0xb50bbe,_0x1e4ea8[_0x066a('0x12')][_0x066a('0x15')]);return _0x123c10(_0x1e4ea8[_0x066a('0x12')]['message']);}logger[_0x066a('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0xb50bbe,_0x1e4ea8[_0x066a('0x12')][_0x066a('0x15')]);return _0x34f8b5(_0x1e4ea8[_0x066a('0x12')][_0x066a('0x15')]);}else{logger[_0x066a('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0xb50bbe,_0x066a('0xf'));_0x34f8b5(_0x1e4ea8['result'][_0x066a('0x15')]);}})[_0x066a('0x16')](function(_0x5e8a25){logger[_0x066a('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0xb50bbe,_0x5e8a25);_0x123c10(_0x5e8a25);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 844d38c..6ad903e 100644 --- a/server/api/intZohoField/index.js +++ b/server/api/intZohoField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63f8=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x63f8,0x189));var _0x863f=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x63f8[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x863f('0x0'));var util=require('util');var path=require(_0x863f('0x1'));var timeout=require('connect-timeout');var express=require(_0x863f('0x2'));var router=express[_0x863f('0x3')]();var fs_extra=require(_0x863f('0x4'));var auth=require(_0x863f('0x5'));var interaction=require(_0x863f('0x6'));var config=require(_0x863f('0x7'));var controller=require('./intZohoField.controller');router[_0x863f('0x8')]('/',auth[_0x863f('0x9')](),controller[_0x863f('0xa')]);router['get']('/:id',auth[_0x863f('0x9')](),controller[_0x863f('0xb')]);router[_0x863f('0xc')]('/',auth[_0x863f('0x9')](),controller[_0x863f('0xd')]);router[_0x863f('0xe')]('/:id',auth[_0x863f('0x9')](),controller['update']);router[_0x863f('0xf')](_0x863f('0x10'),auth[_0x863f('0x9')](),controller[_0x863f('0x11')]);module[_0x863f('0x12')]=router; \ No newline at end of file +var _0x705f=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports'];(function(_0x25c988,_0xce8221){var _0x45fcc2=function(_0x47fba5){while(--_0x47fba5){_0x25c988['push'](_0x25c988['shift']());}};_0x45fcc2(++_0xce8221);}(_0x705f,0x1a4));var _0xf705=function(_0x76bd2,_0x487abe){_0x76bd2=_0x76bd2-0x0;var _0x2e50f3=_0x705f[_0x76bd2];return _0x2e50f3;};'use strict';var multer=require(_0xf705('0x0'));var util=require('util');var path=require(_0xf705('0x1'));var timeout=require(_0xf705('0x2'));var express=require(_0xf705('0x3'));var router=express[_0xf705('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf705('0x5'));var interaction=require(_0xf705('0x6'));var config=require(_0xf705('0x7'));var controller=require(_0xf705('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf705('0x9')]);router[_0xf705('0xa')](_0xf705('0xb'),auth[_0xf705('0xc')](),controller[_0xf705('0xd')]);router[_0xf705('0xe')]('/',auth[_0xf705('0xc')](),controller[_0xf705('0xf')]);router[_0xf705('0x10')]('/:id',auth[_0xf705('0xc')](),controller[_0xf705('0x11')]);router['delete'](_0xf705('0xb'),auth[_0xf705('0xc')](),controller[_0xf705('0x12')]);module[_0xf705('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index b4c93fd..76d44a6 100644 --- a/server/api/intZohoField/intZohoField.attributes.js +++ b/server/api/intZohoField/intZohoField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b62=['exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x9b62,0x1a7));var _0x29b6=function(_0x14c157,_0x27ff28){_0x14c157=_0x14c157-0x0;var _0x53b71c=_0x9b62[_0x14c157];return _0x53b71c;};'use strict';var Sequelize=require('sequelize');module[_0x29b6('0x0')]={'type':{'type':Sequelize[_0x29b6('0x1')](_0x29b6('0x2'),_0x29b6('0x3'),'customVariable',_0x29b6('0x4'),_0x29b6('0x5')),'defaultValue':_0x29b6('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x29b6('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x29b6('0x2'),_0x29b6('0x3'),_0x29b6('0x7'))},'keyContent':{'type':Sequelize[_0x29b6('0x6')]},'idField':{'type':Sequelize[_0x29b6('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x29b6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x29b6('0x6')]}}; \ No newline at end of file +var _0x4894=['variable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x21f144,_0x5598d3){var _0x311a30=function(_0x1a927d){while(--_0x1a927d){_0x21f144['push'](_0x21f144['shift']());}};_0x311a30(++_0x5598d3);}(_0x4894,0x153));var _0x4489=function(_0x1554eb,_0x42d2d0){_0x1554eb=_0x1554eb-0x0;var _0x3fd1eb=_0x4894[_0x1554eb];return _0x3fd1eb;};'use strict';var Sequelize=require(_0x4489('0x0'));module[_0x4489('0x1')]={'type':{'type':Sequelize[_0x4489('0x2')](_0x4489('0x3'),_0x4489('0x4'),'customVariable','keyValue',_0x4489('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4489('0x6')]},'key':{'type':Sequelize[_0x4489('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4489('0x3'),_0x4489('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x4489('0x6')]},'idField':{'type':Sequelize[_0x4489('0x6')]},'nameField':{'type':Sequelize[_0x4489('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4489('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 77e9616..a59d304 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdb4=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','ZohoField','include','rows','show','params','includeAll','options','find','create','catch','body','destroy','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','querystring'];(function(_0xc84036,_0xdb9a90){var _0x27beda=function(_0xdec583){while(--_0xdec583){_0xc84036['push'](_0xc84036['shift']());}};_0x27beda(++_0xdb9a90);}(_0xcdb4,0x1f3));var _0x4cdb=function(_0x3ee96f,_0x2057b8){_0x3ee96f=_0x3ee96f-0x0;var _0x4678fe=_0xcdb4[_0x3ee96f];return _0x4678fe;};'use strict';var emlformat=require(_0x4cdb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4cdb('0x1'));var moment=require(_0x4cdb('0x2'));var BPromise=require(_0x4cdb('0x3'));var Mustache=require(_0x4cdb('0x4'));var util=require(_0x4cdb('0x5'));var path=require(_0x4cdb('0x6'));var sox=require(_0x4cdb('0x7'));var csv=require(_0x4cdb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4cdb('0x9'));var crypto=require('crypto');var jsforce=require(_0x4cdb('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4cdb('0x8'));var querystring=require(_0x4cdb('0xb'));var Papa=require(_0x4cdb('0xc'));var Redis=require(_0x4cdb('0xd'));var authService=require(_0x4cdb('0xe'));var qs=require(_0x4cdb('0xf'));var as=require(_0x4cdb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4cdb('0x11'))('api');var utils=require(_0x4cdb('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x4cdb('0x13'));var db=require(_0x4cdb('0x14'))['db'];function respondWithStatusCode(_0x6376c1,_0x28d6d0){_0x28d6d0=_0x28d6d0||0xcc;return function(_0x3f0698){if(_0x3f0698){return _0x6376c1[_0x4cdb('0x15')](_0x28d6d0);}return _0x6376c1[_0x4cdb('0x16')](_0x28d6d0)[_0x4cdb('0x17')]();};}function respondWithResult(_0x2251ba,_0x1bbc19){_0x1bbc19=_0x1bbc19||0xc8;return function(_0x1dd042){if(_0x1dd042){return _0x2251ba[_0x4cdb('0x16')](_0x1bbc19)['json'](_0x1dd042);}};}function respondWithFilteredResult(_0x191c2f,_0x1b597d){return function(_0x28e7c6){if(_0x28e7c6){var _0x4ac3e1=typeof _0x1b597d[_0x4cdb('0x18')]===_0x4cdb('0x19')&&typeof _0x1b597d[_0x4cdb('0x1a')]===_0x4cdb('0x19');var _0x380eb7=_0x28e7c6[_0x4cdb('0x1b')];var _0x2711bb=_0x4ac3e1?0x0:_0x1b597d[_0x4cdb('0x18')];var _0x38c015=_0x4ac3e1?_0x28e7c6[_0x4cdb('0x1b')]:_0x1b597d[_0x4cdb('0x18')]+_0x1b597d[_0x4cdb('0x1a')];var _0x5c25fa;if(_0x38c015>=_0x380eb7){_0x38c015=_0x380eb7;_0x5c25fa=0xc8;}else{_0x5c25fa=0xce;}_0x191c2f[_0x4cdb('0x16')](_0x5c25fa);return _0x191c2f[_0x4cdb('0x1c')](_0x4cdb('0x1d'),_0x2711bb+'-'+_0x38c015+'/'+_0x380eb7)[_0x4cdb('0x1e')](_0x28e7c6);}return null;};}function patchUpdates(_0x115d12){return function(_0x21b688){try{jsonpatch[_0x4cdb('0x1f')](_0x21b688,_0x115d12,!![]);}catch(_0x58cf9e){return BPromise[_0x4cdb('0x20')](_0x58cf9e);}return _0x21b688[_0x4cdb('0x21')]();};}function saveUpdates(_0x117cdf,_0x3afe49){return function(_0x269151){if(_0x269151){return _0x269151[_0x4cdb('0x22')](_0x117cdf)[_0x4cdb('0x23')](function(_0x456a91){return _0x456a91;});}return null;};}function removeEntity(_0x44b1c5,_0x38dc80){return function(_0x10587c){if(_0x10587c){return _0x10587c['destroy']()[_0x4cdb('0x23')](function(){_0x44b1c5[_0x4cdb('0x16')](0xcc)[_0x4cdb('0x17')]();});}};}function handleEntityNotFound(_0x44a4a6,_0x4c664c){return function(_0x794807){if(!_0x794807){_0x44a4a6[_0x4cdb('0x15')](0x194);}return _0x794807;};}function handleError(_0x2b8047,_0xa36cc2){_0xa36cc2=_0xa36cc2||0x1f4;return function(_0xe56e41){logger['error'](_0xe56e41['stack']);if(_0xe56e41[_0x4cdb('0x24')]){delete _0xe56e41[_0x4cdb('0x24')];}_0x2b8047[_0x4cdb('0x16')](_0xa36cc2)[_0x4cdb('0x25')](_0xe56e41);};}exports[_0x4cdb('0x26')]=function(_0x48ce9e,_0x413171){var _0x2d15b3={},_0x203cdf={},_0x112565={'count':0x0,'rows':[]};var _0x44baee=_['map'](db['ZohoField'][_0x4cdb('0x27')],function(_0x135ef0){return{'name':_0x135ef0[_0x4cdb('0x28')],'type':_0x135ef0[_0x4cdb('0x29')][_0x4cdb('0x2a')]};});_0x203cdf[_0x4cdb('0x2b')]=_[_0x4cdb('0x2c')](_0x44baee,_0x4cdb('0x24'));_0x203cdf[_0x4cdb('0x2d')]=_[_0x4cdb('0x2e')](_0x48ce9e[_0x4cdb('0x2d')]);_0x203cdf['filters']=_[_0x4cdb('0x2f')](_0x203cdf[_0x4cdb('0x2b')],_0x203cdf['query']);_0x2d15b3[_0x4cdb('0x30')]=_[_0x4cdb('0x2f')](_0x203cdf['model'],qs[_0x4cdb('0x31')](_0x48ce9e['query']['fields']));_0x2d15b3[_0x4cdb('0x30')]=_0x2d15b3[_0x4cdb('0x30')][_0x4cdb('0x32')]?_0x2d15b3[_0x4cdb('0x30')]:_0x203cdf[_0x4cdb('0x2b')];if(!_0x48ce9e[_0x4cdb('0x2d')][_0x4cdb('0x33')](_0x4cdb('0x34'))){_0x2d15b3[_0x4cdb('0x1a')]=qs[_0x4cdb('0x1a')](_0x48ce9e['query'][_0x4cdb('0x1a')]);_0x2d15b3[_0x4cdb('0x18')]=qs[_0x4cdb('0x18')](_0x48ce9e[_0x4cdb('0x2d')][_0x4cdb('0x18')]);}_0x2d15b3[_0x4cdb('0x35')]=qs[_0x4cdb('0x36')](_0x48ce9e[_0x4cdb('0x2d')]['sort']);_0x2d15b3[_0x4cdb('0x37')]=qs[_0x4cdb('0x38')](_[_0x4cdb('0x39')](_0x48ce9e[_0x4cdb('0x2d')],_0x203cdf[_0x4cdb('0x38')]),_0x44baee);if(_0x48ce9e[_0x4cdb('0x2d')][_0x4cdb('0x3a')]){_0x2d15b3[_0x4cdb('0x37')]=_[_0x4cdb('0x3b')](_0x2d15b3['where'],{'$or':_[_0x4cdb('0x2c')](_0x44baee,function(_0x40d4c6){if(_0x40d4c6[_0x4cdb('0x29')]!==_0x4cdb('0x3c')){var _0x4fa43b={};_0x4fa43b[_0x40d4c6['name']]={'$like':'%'+_0x48ce9e[_0x4cdb('0x2d')][_0x4cdb('0x3a')]+'%'};return _0x4fa43b;}})});}_0x2d15b3=_[_0x4cdb('0x3b')]({},_0x2d15b3,_0x48ce9e['options']);var _0x17486e={'where':_0x2d15b3[_0x4cdb('0x37')]};return db[_0x4cdb('0x3d')][_0x4cdb('0x1b')](_0x17486e)['then'](function(_0x3d920b){_0x112565[_0x4cdb('0x1b')]=_0x3d920b;if(_0x48ce9e[_0x4cdb('0x2d')]['includeAll']){_0x2d15b3[_0x4cdb('0x3e')]=[{'all':!![]}];}return db[_0x4cdb('0x3d')]['findAll'](_0x2d15b3);})[_0x4cdb('0x23')](function(_0x164718){_0x112565[_0x4cdb('0x3f')]=_0x164718;return _0x112565;})[_0x4cdb('0x23')](respondWithFilteredResult(_0x413171,_0x2d15b3))['catch'](handleError(_0x413171,null));};exports[_0x4cdb('0x40')]=function(_0x562b78,_0x41c451){var _0x29140a={'raw':!![],'where':{'id':_0x562b78[_0x4cdb('0x41')]['id']}},_0x2a82c6={};_0x2a82c6[_0x4cdb('0x2b')]=_[_0x4cdb('0x2e')](db[_0x4cdb('0x3d')][_0x4cdb('0x27')]);_0x2a82c6[_0x4cdb('0x2d')]=_[_0x4cdb('0x2e')](_0x562b78[_0x4cdb('0x2d')]);_0x2a82c6['filters']=_[_0x4cdb('0x2f')](_0x2a82c6[_0x4cdb('0x2b')],_0x2a82c6[_0x4cdb('0x2d')]);_0x29140a['attributes']=_[_0x4cdb('0x2f')](_0x2a82c6['model'],qs[_0x4cdb('0x31')](_0x562b78['query'][_0x4cdb('0x31')]));_0x29140a[_0x4cdb('0x30')]=_0x29140a[_0x4cdb('0x30')][_0x4cdb('0x32')]?_0x29140a[_0x4cdb('0x30')]:_0x2a82c6[_0x4cdb('0x2b')];if(_0x562b78[_0x4cdb('0x2d')][_0x4cdb('0x42')]){_0x29140a[_0x4cdb('0x3e')]=[{'all':!![]}];}_0x29140a=_[_0x4cdb('0x3b')]({},_0x29140a,_0x562b78[_0x4cdb('0x43')]);return db[_0x4cdb('0x3d')][_0x4cdb('0x44')](_0x29140a)[_0x4cdb('0x23')](handleEntityNotFound(_0x41c451,null))[_0x4cdb('0x23')](respondWithResult(_0x41c451,null))['catch'](handleError(_0x41c451,null));};exports['create']=function(_0x57072c,_0x159fa8){return db['ZohoField'][_0x4cdb('0x45')](_0x57072c['body'],{})[_0x4cdb('0x23')](respondWithResult(_0x159fa8,0xc9))[_0x4cdb('0x46')](handleError(_0x159fa8,null));};exports[_0x4cdb('0x22')]=function(_0x443ff4,_0x298830){if(_0x443ff4['body']['id']){delete _0x443ff4[_0x4cdb('0x47')]['id'];}return db[_0x4cdb('0x3d')][_0x4cdb('0x44')]({'where':{'id':_0x443ff4[_0x4cdb('0x41')]['id']}})[_0x4cdb('0x23')](handleEntityNotFound(_0x298830,null))[_0x4cdb('0x23')](saveUpdates(_0x443ff4[_0x4cdb('0x47')],null))[_0x4cdb('0x23')](respondWithResult(_0x298830,null))[_0x4cdb('0x46')](handleError(_0x298830,null));};exports[_0x4cdb('0x48')]=function(_0x3e5383,_0x3fa341){return db[_0x4cdb('0x3d')][_0x4cdb('0x44')]({'where':{'id':_0x3e5383[_0x4cdb('0x41')]['id']}})[_0x4cdb('0x23')](handleEntityNotFound(_0x3fa341,null))['then'](removeEntity(_0x3fa341,null))['catch'](handleError(_0x3fa341,null));}; \ No newline at end of file +var _0xa039=['end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','ZohoField','includeAll','include','findAll','rows','catch','params','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x1c1dc6,_0x1b61dc){var _0x15c4f5=function(_0xf736e7){while(--_0xf736e7){_0x1c1dc6['push'](_0x1c1dc6['shift']());}};_0x15c4f5(++_0x1b61dc);}(_0xa039,0x1c4));var _0x9a03=function(_0x2cf08,_0x3149fb){_0x2cf08=_0x2cf08-0x0;var _0x27cce0=_0xa039[_0x2cf08];return _0x27cce0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a03('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a03('0x1'));var rp=require(_0x9a03('0x2'));var moment=require(_0x9a03('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9a03('0x4'));var util=require(_0x9a03('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a03('0x6'));var fs=require('fs');var fs_extra=require(_0x9a03('0x7'));var _=require('lodash');var squel=require(_0x9a03('0x8'));var crypto=require(_0x9a03('0x9'));var jsforce=require(_0x9a03('0xa'));var deskjs=require(_0x9a03('0xb'));var toCsv=require(_0x9a03('0xc'));var querystring=require(_0x9a03('0xd'));var Papa=require(_0x9a03('0xe'));var Redis=require(_0x9a03('0xf'));var authService=require(_0x9a03('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a03('0x11'));var logger=require(_0x9a03('0x12'))(_0x9a03('0x13'));var utils=require(_0x9a03('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9a03('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x198c5f,_0x96a876){_0x96a876=_0x96a876||0xcc;return function(_0x333e91){if(_0x333e91){return _0x198c5f[_0x9a03('0x16')](_0x96a876);}return _0x198c5f[_0x9a03('0x17')](_0x96a876)[_0x9a03('0x18')]();};}function respondWithResult(_0x318417,_0x217ae4){_0x217ae4=_0x217ae4||0xc8;return function(_0x3401f7){if(_0x3401f7){return _0x318417['status'](_0x217ae4)[_0x9a03('0x19')](_0x3401f7);}};}function respondWithFilteredResult(_0x383525,_0x2787b2){return function(_0x59aede){if(_0x59aede){var _0x39907c=typeof _0x2787b2[_0x9a03('0x1a')]===_0x9a03('0x1b')&&typeof _0x2787b2[_0x9a03('0x1c')]==='undefined';var _0xf1858c=_0x59aede[_0x9a03('0x1d')];var _0xdef92a=_0x39907c?0x0:_0x2787b2['offset'];var _0x5a16cb=_0x39907c?_0x59aede[_0x9a03('0x1d')]:_0x2787b2[_0x9a03('0x1a')]+_0x2787b2[_0x9a03('0x1c')];var _0x3ab363;if(_0x5a16cb>=_0xf1858c){_0x5a16cb=_0xf1858c;_0x3ab363=0xc8;}else{_0x3ab363=0xce;}_0x383525[_0x9a03('0x17')](_0x3ab363);return _0x383525[_0x9a03('0x1e')]('Content-Range',_0xdef92a+'-'+_0x5a16cb+'/'+_0xf1858c)[_0x9a03('0x19')](_0x59aede);}return null;};}function patchUpdates(_0x59de5b){return function(_0x1de96e){try{jsonpatch[_0x9a03('0x1f')](_0x1de96e,_0x59de5b,!![]);}catch(_0x59d231){return BPromise['reject'](_0x59d231);}return _0x1de96e[_0x9a03('0x20')]();};}function saveUpdates(_0x3657bb,_0x552f88){return function(_0x6e2d5a){if(_0x6e2d5a){return _0x6e2d5a[_0x9a03('0x21')](_0x3657bb)['then'](function(_0x596326){return _0x596326;});}return null;};}function removeEntity(_0x13d0fa,_0x166d1f){return function(_0x4b6d25){if(_0x4b6d25){return _0x4b6d25[_0x9a03('0x22')]()[_0x9a03('0x23')](function(){_0x13d0fa[_0x9a03('0x17')](0xcc)[_0x9a03('0x18')]();});}};}function handleEntityNotFound(_0x3000f7,_0x532f9c){return function(_0x2e641a){if(!_0x2e641a){_0x3000f7[_0x9a03('0x16')](0x194);}return _0x2e641a;};}function handleError(_0x5e52a7,_0x1ed8b4){_0x1ed8b4=_0x1ed8b4||0x1f4;return function(_0x313090){logger['error'](_0x313090['stack']);if(_0x313090[_0x9a03('0x24')]){delete _0x313090[_0x9a03('0x24')];}_0x5e52a7[_0x9a03('0x17')](_0x1ed8b4)['send'](_0x313090);};}exports[_0x9a03('0x25')]=function(_0x4681cc,_0x8d96fc){var _0x372102={},_0x29c5fb={},_0x20c9b0={'count':0x0,'rows':[]};var _0x24808b=_[_0x9a03('0x26')](db['ZohoField'][_0x9a03('0x27')],function(_0x16bb23){return{'name':_0x16bb23[_0x9a03('0x28')],'type':_0x16bb23[_0x9a03('0x29')]['key']};});_0x29c5fb[_0x9a03('0x2a')]=_[_0x9a03('0x26')](_0x24808b,_0x9a03('0x24'));_0x29c5fb['query']=_[_0x9a03('0x2b')](_0x4681cc[_0x9a03('0x2c')]);_0x29c5fb[_0x9a03('0x2d')]=_[_0x9a03('0x2e')](_0x29c5fb[_0x9a03('0x2a')],_0x29c5fb['query']);_0x372102[_0x9a03('0x2f')]=_[_0x9a03('0x2e')](_0x29c5fb[_0x9a03('0x2a')],qs[_0x9a03('0x30')](_0x4681cc[_0x9a03('0x2c')][_0x9a03('0x30')]));_0x372102['attributes']=_0x372102['attributes'][_0x9a03('0x31')]?_0x372102[_0x9a03('0x2f')]:_0x29c5fb[_0x9a03('0x2a')];if(!_0x4681cc[_0x9a03('0x2c')]['hasOwnProperty'](_0x9a03('0x32'))){_0x372102[_0x9a03('0x1c')]=qs[_0x9a03('0x1c')](_0x4681cc[_0x9a03('0x2c')]['limit']);_0x372102[_0x9a03('0x1a')]=qs[_0x9a03('0x1a')](_0x4681cc[_0x9a03('0x2c')][_0x9a03('0x1a')]);}_0x372102[_0x9a03('0x33')]=qs[_0x9a03('0x34')](_0x4681cc['query'][_0x9a03('0x34')]);_0x372102['where']=qs[_0x9a03('0x2d')](_[_0x9a03('0x35')](_0x4681cc[_0x9a03('0x2c')],_0x29c5fb[_0x9a03('0x2d')]),_0x24808b);if(_0x4681cc[_0x9a03('0x2c')][_0x9a03('0x36')]){_0x372102['where']=_[_0x9a03('0x37')](_0x372102['where'],{'$or':_[_0x9a03('0x26')](_0x24808b,function(_0x27c81d){if(_0x27c81d['type']!==_0x9a03('0x38')){var _0xa6fc52={};_0xa6fc52[_0x27c81d[_0x9a03('0x24')]]={'$like':'%'+_0x4681cc[_0x9a03('0x2c')][_0x9a03('0x36')]+'%'};return _0xa6fc52;}})});}_0x372102=_[_0x9a03('0x37')]({},_0x372102,_0x4681cc[_0x9a03('0x39')]);var _0x41fd44={'where':_0x372102[_0x9a03('0x3a')]};return db[_0x9a03('0x3b')][_0x9a03('0x1d')](_0x41fd44)['then'](function(_0x5579bf){_0x20c9b0[_0x9a03('0x1d')]=_0x5579bf;if(_0x4681cc[_0x9a03('0x2c')][_0x9a03('0x3c')]){_0x372102[_0x9a03('0x3d')]=[{'all':!![]}];}return db[_0x9a03('0x3b')][_0x9a03('0x3e')](_0x372102);})[_0x9a03('0x23')](function(_0x2563e8){_0x20c9b0[_0x9a03('0x3f')]=_0x2563e8;return _0x20c9b0;})[_0x9a03('0x23')](respondWithFilteredResult(_0x8d96fc,_0x372102))[_0x9a03('0x40')](handleError(_0x8d96fc,null));};exports['show']=function(_0x1c550a,_0x2d6481){var _0x2d4a2a={'raw':!![],'where':{'id':_0x1c550a[_0x9a03('0x41')]['id']}},_0x4363ad={};_0x4363ad[_0x9a03('0x2a')]=_[_0x9a03('0x2b')](db['ZohoField'][_0x9a03('0x27')]);_0x4363ad[_0x9a03('0x2c')]=_['keys'](_0x1c550a[_0x9a03('0x2c')]);_0x4363ad[_0x9a03('0x2d')]=_[_0x9a03('0x2e')](_0x4363ad['model'],_0x4363ad[_0x9a03('0x2c')]);_0x2d4a2a[_0x9a03('0x2f')]=_[_0x9a03('0x2e')](_0x4363ad[_0x9a03('0x2a')],qs[_0x9a03('0x30')](_0x1c550a['query']['fields']));_0x2d4a2a[_0x9a03('0x2f')]=_0x2d4a2a[_0x9a03('0x2f')]['length']?_0x2d4a2a['attributes']:_0x4363ad['model'];if(_0x1c550a[_0x9a03('0x2c')]['includeAll']){_0x2d4a2a[_0x9a03('0x3d')]=[{'all':!![]}];}_0x2d4a2a=_[_0x9a03('0x37')]({},_0x2d4a2a,_0x1c550a[_0x9a03('0x39')]);return db['ZohoField']['find'](_0x2d4a2a)[_0x9a03('0x23')](handleEntityNotFound(_0x2d6481,null))[_0x9a03('0x23')](respondWithResult(_0x2d6481,null))[_0x9a03('0x40')](handleError(_0x2d6481,null));};exports['create']=function(_0x136731,_0x3de6f3){return db[_0x9a03('0x3b')][_0x9a03('0x42')](_0x136731[_0x9a03('0x43')],{})[_0x9a03('0x23')](respondWithResult(_0x3de6f3,0xc9))[_0x9a03('0x40')](handleError(_0x3de6f3,null));};exports[_0x9a03('0x21')]=function(_0x101ddc,_0x4baf1d){if(_0x101ddc[_0x9a03('0x43')]['id']){delete _0x101ddc[_0x9a03('0x43')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x101ddc[_0x9a03('0x41')]['id']}})[_0x9a03('0x23')](handleEntityNotFound(_0x4baf1d,null))[_0x9a03('0x23')](saveUpdates(_0x101ddc['body'],null))[_0x9a03('0x23')](respondWithResult(_0x4baf1d,null))['catch'](handleError(_0x4baf1d,null));};exports[_0x9a03('0x22')]=function(_0x4acd71,_0x16bd8d){return db[_0x9a03('0x3b')]['find']({'where':{'id':_0x4acd71[_0x9a03('0x41')]['id']}})[_0x9a03('0x23')](handleEntityNotFound(_0x16bd8d,null))[_0x9a03('0x23')](removeEntity(_0x16bd8d,null))[_0x9a03('0x40')](handleError(_0x16bd8d,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 6231ad2..1f98a0c 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf61e=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index'];(function(_0x3072e2,_0x648a09){var _0x42c45b=function(_0x2ddff5){while(--_0x2ddff5){_0x3072e2['push'](_0x3072e2['shift']());}};_0x42c45b(++_0x648a09);}(_0xf61e,0x191));var _0xef61=function(_0x4ec6ec,_0x35a8b4){_0x4ec6ec=_0x4ec6ec-0x0;var _0x4a3c98=_0xf61e[_0x4ec6ec];return _0x4a3c98;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('ZohoField',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6050=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','zoho_unique_index','idField','FieldId','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6050,0x196));var _0x0605=function(_0x2814c8,_0x4e9211){_0x2814c8=_0x2814c8-0x0;var _0x34be58=_0x6050[_0x2814c8];return _0x34be58;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x4aca21,_0xd78d96){return _0x4aca21['define']('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x0605('0x9'),'fields':[_0x0605('0xa'),_0x0605('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 6975265..e15d744 100644 --- a/server/api/intZohoField/intZohoField.rpc.js +++ b/server/api/intZohoField/intZohoField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb046=['jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x73e5b0,_0x241ec0){var _0x23ed6f=function(_0x12825c){while(--_0x12825c){_0x73e5b0['push'](_0x73e5b0['shift']());}};_0x23ed6f(++_0x241ec0);}(_0xb046,0xbf));var _0x6b04=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0xb046[_0x112fe3];return _0x1ec903;};'use strict';var _=require(_0x6b04('0x0'));var util=require('util');var moment=require(_0x6b04('0x1'));var BPromise=require('bluebird');var rs=require(_0x6b04('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6b04('0x3'));var logger=require(_0x6b04('0x4'))(_0x6b04('0x5'));var config=require(_0x6b04('0x6'));var jayson=require(_0x6b04('0x7'));var client=jayson[_0x6b04('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x328640,_0x4f0ac0,_0x25cf0c){return new BPromise(function(_0x2c6f44,_0x1a4bd0){return client[_0x6b04('0x9')](_0x328640,_0x25cf0c)[_0x6b04('0xa')](function(_0x52ed26){logger[_0x6b04('0xb')](_0x6b04('0xc'),_0x4f0ac0,_0x6b04('0xd'));logger['debug'](_0x6b04('0xe'),_0x4f0ac0,'request\x20sent',JSON['stringify'](_0x52ed26));if(_0x52ed26[_0x6b04('0xf')]){if(_0x52ed26['error'][_0x6b04('0x10')]===0x1f4){logger[_0x6b04('0xf')](_0x6b04('0xc'),_0x4f0ac0,_0x52ed26[_0x6b04('0xf')]['message']);return _0x1a4bd0(_0x52ed26[_0x6b04('0xf')][_0x6b04('0x11')]);}logger[_0x6b04('0xf')]('ZohoField,\x20%s,\x20%s',_0x4f0ac0,_0x52ed26[_0x6b04('0xf')]['message']);return _0x2c6f44(_0x52ed26['error'][_0x6b04('0x11')]);}else{logger['info'](_0x6b04('0xc'),_0x4f0ac0,_0x6b04('0xd'));_0x2c6f44(_0x52ed26['result'][_0x6b04('0x11')]);}})['catch'](function(_0x4460b3){logger[_0x6b04('0xf')](_0x6b04('0xc'),_0x4f0ac0,_0x4460b3);_0x1a4bd0(_0x4460b3);});});} \ No newline at end of file +var _0x0f2b=['util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','info','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0x0f2b,0x1f3));var _0xb0f2=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x0f2b[_0x53b8e0];return _0x10630c;};'use strict';var _=require(_0xb0f2('0x0'));var util=require(_0xb0f2('0x1'));var moment=require(_0xb0f2('0x2'));var BPromise=require(_0xb0f2('0x3'));var rs=require(_0xb0f2('0x4'));var fs=require('fs');var Redis=require(_0xb0f2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb0f2('0x6'));var config=require(_0xb0f2('0x7'));var jayson=require(_0xb0f2('0x8'));var client=jayson['client'][_0xb0f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f0bf8,_0x20d6e9,_0xbd3792){return new BPromise(function(_0x2f901b,_0x59ac8a){return client['request'](_0x1f0bf8,_0xbd3792)['then'](function(_0x1568d8){logger[_0xb0f2('0xa')](_0xb0f2('0xb'),_0x20d6e9,'request\x20sent');logger[_0xb0f2('0xc')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x20d6e9,_0xb0f2('0xd'),JSON[_0xb0f2('0xe')](_0x1568d8));if(_0x1568d8['error']){if(_0x1568d8['error'][_0xb0f2('0xf')]===0x1f4){logger[_0xb0f2('0x10')]('ZohoField,\x20%s,\x20%s',_0x20d6e9,_0x1568d8['error'][_0xb0f2('0x11')]);return _0x59ac8a(_0x1568d8[_0xb0f2('0x10')][_0xb0f2('0x11')]);}logger[_0xb0f2('0x10')](_0xb0f2('0xb'),_0x20d6e9,_0x1568d8[_0xb0f2('0x10')][_0xb0f2('0x11')]);return _0x2f901b(_0x1568d8[_0xb0f2('0x10')][_0xb0f2('0x11')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x20d6e9,_0xb0f2('0xd'));_0x2f901b(_0x1568d8[_0xb0f2('0x12')][_0xb0f2('0x11')]);}})[_0xb0f2('0x13')](function(_0xf53672){logger['error'](_0xb0f2('0xb'),_0x20d6e9,_0xf53672);_0x59ac8a(_0xf53672);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index e174219..b0fe4fb 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3e9bc8,_0x129a12){var _0x5b40b7=function(_0x198276){while(--_0x198276){_0x3e9bc8['push'](_0x3e9bc8['shift']());}};_0x5b40b7(++_0x129a12);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x326ed8,_0x4e7b88){var _0x4dcc87=function(_0xadff40){while(--_0xadff40){_0x326ed8['push'](_0x326ed8['shift']());}};_0x4dcc87(++_0x4e7b88);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index b08be17..1e4b526 100644 --- a/server/api/integration/integration.attributes.js +++ b/server/api/integration/integration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4b1=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xa4b1,0x133));var _0x1a4b=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xa4b1[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0x1a4b('0x0'));module[_0x1a4b('0x1')]={'name':{'type':Sequelize[_0x1a4b('0x2')],'allowNull':![],'unique':_0x1a4b('0x3')},'version':{'type':Sequelize[_0x1a4b('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x1a4b('0x2')],'defaultValue':_0x1a4b('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x1a4b('0x2')]},'type':{'type':Sequelize[_0x1a4b('0x2')]},'size':{'type':Sequelize[_0x1a4b('0x5')]},'active':{'type':Sequelize[_0x1a4b('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x1a4b('0x2')]},'state':{'type':Sequelize[_0x1a4b('0x2')],'unique':_0x1a4b('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x1a4b('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xc8fc=['state','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x569505,_0x218f9b){var _0x38d6d6=function(_0x34c3c6){while(--_0x34c3c6){_0x569505['push'](_0x569505['shift']());}};_0x38d6d6(++_0x218f9b);}(_0xc8fc,0x78));var _0xcc8f=function(_0x4936d5,_0xae666f){_0x4936d5=_0x4936d5-0x0;var _0x5abe4e=_0xc8fc[_0x4936d5];return _0x5abe4e;};'use strict';var Sequelize=require('sequelize');module[_0xcc8f('0x0')]={'name':{'type':Sequelize[_0xcc8f('0x1')],'allowNull':![],'unique':_0xcc8f('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcc8f('0x2')},'main':{'type':Sequelize[_0xcc8f('0x1')],'defaultValue':_0xcc8f('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xcc8f('0x1')]},'type':{'type':Sequelize[_0xcc8f('0x1')]},'size':{'type':Sequelize[_0xcc8f('0x4')]},'active':{'type':Sequelize[_0xcc8f('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xcc8f('0x1')]},'state':{'type':Sequelize[_0xcc8f('0x1')],'unique':_0xcc8f('0x6')},'description':{'type':Sequelize[_0xcc8f('0x1')]},'title':{'type':Sequelize[_0xcc8f('0x1')]},'remoteUri':{'type':Sequelize[_0xcc8f('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index d0c1355..13019b4 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01d9=['map','Integration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index'];(function(_0x356297,_0x550ee6){var _0x511a00=function(_0x1138bf){while(--_0x1138bf){_0x356297['push'](_0x356297['shift']());}};_0x511a00(++_0x550ee6);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['Integration'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['Integration'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));}; \ No newline at end of file +var _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x5496,0x175));var _0x6549=function(_0x4f20c4,_0x38d30f){_0x4f20c4=_0x4f20c4-0x0;var _0x4db545=_0x5496[_0x4f20c4];return _0x4db545;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 3f0f5ba..b3ffc2d 100644 --- a/server/api/integration/integration.model.js +++ b/server/api/integration/integration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01e7=['bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x199d5f,_0x398246){var _0x131812=function(_0x20f124){while(--_0x20f124){_0x199d5f['push'](_0x199d5f['shift']());}};_0x131812(++_0x398246);}(_0x01e7,0x1db));var _0x701e=function(_0x285389,_0x8e8108){_0x285389=_0x285389-0x0;var _0x135cdf=_0x01e7[_0x285389];return _0x135cdf;};'use strict';var _=require(_0x701e('0x0'));var util=require(_0x701e('0x1'));var logger=require(_0x701e('0x2'))(_0x701e('0x3'));var moment=require(_0x701e('0x4'));var BPromise=require(_0x701e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x701e('0x6'));var rimraf=require(_0x701e('0x7'));var config=require(_0x701e('0x8'));var attributes=require(_0x701e('0x9'));module[_0x701e('0xa')]=function(_0x209a13,_0x160a7e){return _0x209a13[_0x701e('0xb')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x873a=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','Integration','integrations','lodash'];(function(_0x2853b7,_0x4847f4){var _0x467271=function(_0x26b57e){while(--_0x26b57e){_0x2853b7['push'](_0x2853b7['shift']());}};_0x467271(++_0x4847f4);}(_0x873a,0x113));var _0xa873=function(_0x4a8ac4,_0x13d48e){_0x4a8ac4=_0x4a8ac4-0x0;var _0x1e7e12=_0x873a[_0x4a8ac4];return _0x1e7e12;};'use strict';var _=require(_0xa873('0x0'));var util=require(_0xa873('0x1'));var logger=require(_0xa873('0x2'))(_0xa873('0x3'));var moment=require(_0xa873('0x4'));var BPromise=require(_0xa873('0x5'));var rp=require(_0xa873('0x6'));var fs=require('fs');var path=require(_0xa873('0x7'));var rimraf=require('rimraf');var config=require(_0xa873('0x8'));var attributes=require('./integration.attributes');module[_0xa873('0x9')]=function(_0x974f7e,_0x2e45d0){return _0x974f7e['define'](_0xa873('0xa'),attributes,{'tableName':_0xa873('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 43a6e6a..421c872 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x24e50d,_0x5855ca){var _0x4cba71=function(_0x21e152){while(--_0x21e152){_0x24e50d['push'](_0x24e50d['shift']());}};_0x4cba71(++_0x5855ca);}(_0x0295,0x1f0));var _0x5029=function(_0x229a03,_0x36fefc){_0x229a03=_0x229a03-0x0;var _0x2d6e11=_0x0295[_0x229a03];return _0x2d6e11;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('Integration,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3f4cc1,_0x56b92b){var _0x57d476=function(_0x369f3b){while(--_0x369f3b){_0x3f4cc1['push'](_0x3f4cc1['shift']());}};_0x57d476(++_0x56b92b);}(_0x2542,0x169));var _0x2254=function(_0x12c026,_0x42aaf4){_0x12c026=_0x12c026-0x0;var _0x5737a8=_0x2542[_0x12c026];return _0x5737a8;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 43571ae..60931dd 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x1efb29,_0x41cd3b){var _0xae79e9=function(_0x59c502){while(--_0x59c502){_0x1efb29['push'](_0x1efb29['shift']());}};_0xae79e9(++_0x41cd3b);}(_0x187d,0x93));var _0xd187=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x187d[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x21e8ec,_0x2aa0ad){var _0x5028f5=function(_0x24d88){while(--_0x24d88){_0x21e8ec['push'](_0x21e8ec['shift']());}};_0x5028f5(++_0x2aa0ad);}(_0x2ef3,0xba));var _0x32ef=function(_0x5150ba,_0x24094a){_0x5150ba=_0x5150ba-0x0;var _0x597057=_0x2ef3[_0x5150ba];return _0x597057;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index d3ff321..bd067f7 100644 --- a/server/api/integrationReport/integrationReport.attributes.js +++ b/server/api/integrationReport/integrationReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4941=['BOOLEAN','TEXT','ENUM','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x2bc56a,_0x3b822d){var _0x17dc8b=function(_0x400bcb){while(--_0x400bcb){_0x2bc56a['push'](_0x2bc56a['shift']());}};_0x17dc8b(++_0x3b822d);}(_0x4941,0x16d));var _0x1494=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0x4941[_0x4b4d43];return _0x5706ba;};'use strict';var Sequelize=require(_0x1494('0x0'));module[_0x1494('0x1')]={'integration':{'type':Sequelize[_0x1494('0x2')]},'eventChannel':{'type':Sequelize[_0x1494('0x2')]},'exitStatus':{'type':Sequelize[_0x1494('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x1494('0x3')]},'contacts':{'type':Sequelize[_0x1494('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1494('0x2')]},'calleridname':{'type':Sequelize[_0x1494('0x2')]},'queue':{'type':Sequelize[_0x1494('0x2')]},'interface':{'type':Sequelize[_0x1494('0x2')]},'membername':{'type':Sequelize[_0x1494('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x1494('0x4')]},'holdtime':{'type':Sequelize[_0x1494('0x3')]},'agentcomplete':{'type':Sequelize[_0x1494('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1494('0x4')]},'talktime':{'type':Sequelize[_0x1494('0x3')]},'agentacw':{'type':Sequelize[_0x1494('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1494('0x3')]},'reason':{'type':Sequelize[_0x1494('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x1494('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1494('0x4')]},'lastevent':{'type':Sequelize[_0x1494('0x2')]},'channel':{'type':Sequelize[_0x1494('0x2')]},'channelstate':{'type':Sequelize[_0x1494('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1494('0x2')]},'connectedlinename':{'type':Sequelize[_0x1494('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1494('0x2')]},'exten':{'type':Sequelize[_0x1494('0x2')]},'priority':{'type':Sequelize[_0x1494('0x2')]},'destchannel':{'type':Sequelize[_0x1494('0x2')]},'destchannelstate':{'type':Sequelize[_0x1494('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x1494('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1494('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1494('0x2')]},'destlanguage':{'type':Sequelize[_0x1494('0x2')]},'destaccountcode':{'type':Sequelize[_0x1494('0x2')]},'destcontext':{'type':Sequelize[_0x1494('0x2')]},'destexten':{'type':Sequelize[_0x1494('0x2')]},'destpriority':{'type':Sequelize[_0x1494('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x1494('0x2')]},'inReplyTo':{'type':Sequelize[_0x1494('0x2')]},'subject':{'type':Sequelize[_0x1494('0x2')]},'from':{'type':Sequelize[_0x1494('0x2')]},'to':{'type':Sequelize[_0x1494('0x2')]},'cc':{'type':Sequelize[_0x1494('0x2')]},'attachment':{'type':Sequelize[_0x1494('0x6')]},'html':{'type':Sequelize[_0x1494('0x6')]},'text':{'type':Sequelize[_0x1494('0x6')]},'status':{'type':Sequelize[_0x1494('0x7')]('SENT','SENDING',_0x1494('0x8'),_0x1494('0x9'))},'url':{'type':Sequelize[_0x1494('0x2')]},'app':{'type':Sequelize[_0x1494('0x2')]},'appdata':{'type':Sequelize[_0x1494('0x2')]},'projectId':{'type':Sequelize[_0x1494('0x3')]}}; \ No newline at end of file +var _0xc81e=['SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x332c9a,_0x5de27d){var _0x26973c=function(_0x223037){while(--_0x223037){_0x332c9a['push'](_0x332c9a['shift']());}};_0x26973c(++_0x5de27d);}(_0xc81e,0xca));var _0xec81=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0xc81e[_0x7feb90];return _0x3c5b33;};'use strict';var Sequelize=require('sequelize');module[_0xec81('0x0')]={'integration':{'type':Sequelize[_0xec81('0x1')]},'eventChannel':{'type':Sequelize[_0xec81('0x1')]},'exitStatus':{'type':Sequelize[_0xec81('0x1')]},'ticketId':{'type':Sequelize[_0xec81('0x1')]},'integrationId':{'type':Sequelize[_0xec81('0x2')]},'contacts':{'type':Sequelize[_0xec81('0x1')]},'uniqueid':{'type':Sequelize[_0xec81('0x1')]},'calleridnum':{'type':Sequelize[_0xec81('0x1')]},'calleridname':{'type':Sequelize[_0xec81('0x1')]},'queue':{'type':Sequelize[_0xec81('0x1')]},'interface':{'type':Sequelize[_0xec81('0x1')]},'membername':{'type':Sequelize[_0xec81('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xec81('0x3')]},'holdtime':{'type':Sequelize[_0xec81('0x2')]},'agentcomplete':{'type':Sequelize[_0xec81('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xec81('0x3')]},'talktime':{'type':Sequelize[_0xec81('0x2')]},'agentacw':{'type':Sequelize[_0xec81('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xec81('0x2')]},'reason':{'type':Sequelize[_0xec81('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xec81('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xec81('0x3')]},'agentdump':{'type':Sequelize[_0xec81('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xec81('0x1')]},'channel':{'type':Sequelize[_0xec81('0x1')]},'channelstate':{'type':Sequelize[_0xec81('0x2')]},'channelstatedesc':{'type':Sequelize[_0xec81('0x1')]},'connectedlinenum':{'type':Sequelize[_0xec81('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xec81('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xec81('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xec81('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xec81('0x1')]},'destcalleridnum':{'type':Sequelize[_0xec81('0x1')]},'destcalleridname':{'type':Sequelize[_0xec81('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xec81('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xec81('0x1')]},'destlanguage':{'type':Sequelize[_0xec81('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xec81('0x1')]},'destexten':{'type':Sequelize[_0xec81('0x1')]},'destpriority':{'type':Sequelize[_0xec81('0x1')]},'destuniqueid':{'type':Sequelize[_0xec81('0x1')]},'messageId':{'type':Sequelize[_0xec81('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xec81('0x1')]},'from':{'type':Sequelize[_0xec81('0x1')]},'to':{'type':Sequelize[_0xec81('0x1')]},'cc':{'type':Sequelize[_0xec81('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xec81('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xec81('0x6')](_0xec81('0x7'),_0xec81('0x8'),_0xec81('0x9'),_0xec81('0xa'))},'url':{'type':Sequelize[_0xec81('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xec81('0x1')]},'projectId':{'type':Sequelize[_0xec81('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 713fc23..80f1ac4 100644 --- a/server/api/integrationReport/integrationReport.controller.js +++ b/server/api/integrationReport/integrationReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb8=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','IntegrationReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','rows','catch','show','length','create','params','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1d9fc5,_0x18fd8e){var _0x2658e5=function(_0x36a1ae){while(--_0x36a1ae){_0x1d9fc5['push'](_0x1d9fc5['shift']());}};_0x2658e5(++_0x18fd8e);}(_0xadb8,0x89));var _0x8adb=function(_0x4080dd,_0x5b595d){_0x4080dd=_0x4080dd-0x0;var _0x4ecf85=_0xadb8[_0x4080dd];return _0x4ecf85;};'use strict';var emlformat=require(_0x8adb('0x0'));var rimraf=require(_0x8adb('0x1'));var zipdir=require(_0x8adb('0x2'));var jsonpatch=require(_0x8adb('0x3'));var rp=require(_0x8adb('0x4'));var moment=require('moment');var BPromise=require(_0x8adb('0x5'));var Mustache=require(_0x8adb('0x6'));var util=require(_0x8adb('0x7'));var path=require(_0x8adb('0x8'));var sox=require(_0x8adb('0x9'));var csv=require('to-csv');var ejs=require(_0x8adb('0xa'));var fs=require('fs');var fs_extra=require(_0x8adb('0xb'));var _=require('lodash');var squel=require(_0x8adb('0xc'));var crypto=require(_0x8adb('0xd'));var jsforce=require(_0x8adb('0xe'));var deskjs=require(_0x8adb('0xf'));var toCsv=require(_0x8adb('0x10'));var querystring=require(_0x8adb('0x11'));var Papa=require(_0x8adb('0x12'));var Redis=require(_0x8adb('0x13'));var authService=require(_0x8adb('0x14'));var qs=require(_0x8adb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8adb('0x16'));var logger=require(_0x8adb('0x17'))(_0x8adb('0x18'));var utils=require(_0x8adb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8adb('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd518df,_0x5711d4){_0x5711d4=_0x5711d4||0xcc;return function(_0x23ec34){if(_0x23ec34){return _0xd518df['sendStatus'](_0x5711d4);}return _0xd518df[_0x8adb('0x1b')](_0x5711d4)[_0x8adb('0x1c')]();};}function respondWithResult(_0x468775,_0xb8a211){_0xb8a211=_0xb8a211||0xc8;return function(_0x19474c){if(_0x19474c){return _0x468775['status'](_0xb8a211)[_0x8adb('0x1d')](_0x19474c);}};}function respondWithFilteredResult(_0x313311,_0x1598f0){return function(_0x51500d){if(_0x51500d){var _0x268a07=typeof _0x1598f0[_0x8adb('0x1e')]===_0x8adb('0x1f')&&typeof _0x1598f0[_0x8adb('0x20')]===_0x8adb('0x1f');var _0x1902bf=_0x51500d[_0x8adb('0x21')];var _0x9323b9=_0x268a07?0x0:_0x1598f0['offset'];var _0x28d471=_0x268a07?_0x51500d[_0x8adb('0x21')]:_0x1598f0[_0x8adb('0x1e')]+_0x1598f0[_0x8adb('0x20')];var _0x471373;if(_0x28d471>=_0x1902bf){_0x28d471=_0x1902bf;_0x471373=0xc8;}else{_0x471373=0xce;}_0x313311[_0x8adb('0x1b')](_0x471373);return _0x313311[_0x8adb('0x22')](_0x8adb('0x23'),_0x9323b9+'-'+_0x28d471+'/'+_0x1902bf)[_0x8adb('0x1d')](_0x51500d);}return null;};}function patchUpdates(_0x55d7fb){return function(_0x464376){try{jsonpatch[_0x8adb('0x24')](_0x464376,_0x55d7fb,!![]);}catch(_0x26692d){return BPromise[_0x8adb('0x25')](_0x26692d);}return _0x464376[_0x8adb('0x26')]();};}function saveUpdates(_0x10e421,_0x49518c){return function(_0x55d085){if(_0x55d085){return _0x55d085[_0x8adb('0x27')](_0x10e421)[_0x8adb('0x28')](function(_0x352e97){return _0x352e97;});}return null;};}function removeEntity(_0x568e38,_0x3e09e3){return function(_0x5d0a2a){if(_0x5d0a2a){return _0x5d0a2a[_0x8adb('0x29')]()[_0x8adb('0x28')](function(){_0x568e38[_0x8adb('0x1b')](0xcc)[_0x8adb('0x1c')]();});}};}function handleEntityNotFound(_0x32d732,_0x493339){return function(_0x56283f){if(!_0x56283f){_0x32d732[_0x8adb('0x2a')](0x194);}return _0x56283f;};}function handleError(_0x4fc7e4,_0x112b5c){_0x112b5c=_0x112b5c||0x1f4;return function(_0x619d06){logger[_0x8adb('0x2b')](_0x619d06[_0x8adb('0x2c')]);if(_0x619d06[_0x8adb('0x2d')]){delete _0x619d06['name'];}_0x4fc7e4[_0x8adb('0x1b')](_0x112b5c)[_0x8adb('0x2e')](_0x619d06);};}exports[_0x8adb('0x2f')]=function(_0x1127d6,_0x37dc2e){var _0x4eb474={},_0x1fb92f={},_0x26bcf3={'count':0x0,'rows':[]};var _0x46a582=_[_0x8adb('0x30')](db[_0x8adb('0x31')][_0x8adb('0x32')],function(_0x36eccd){return{'name':_0x36eccd['fieldName'],'type':_0x36eccd['type'][_0x8adb('0x33')]};});_0x1fb92f[_0x8adb('0x34')]=_[_0x8adb('0x30')](_0x46a582,_0x8adb('0x2d'));_0x1fb92f[_0x8adb('0x35')]=_[_0x8adb('0x36')](_0x1127d6[_0x8adb('0x35')]);_0x1fb92f[_0x8adb('0x37')]=_[_0x8adb('0x38')](_0x1fb92f[_0x8adb('0x34')],_0x1fb92f[_0x8adb('0x35')]);_0x4eb474[_0x8adb('0x39')]=_['intersection'](_0x1fb92f[_0x8adb('0x34')],qs[_0x8adb('0x3a')](_0x1127d6['query'][_0x8adb('0x3a')]));_0x4eb474[_0x8adb('0x39')]=_0x4eb474[_0x8adb('0x39')]['length']?_0x4eb474['attributes']:_0x1fb92f[_0x8adb('0x34')];if(!_0x1127d6['query'][_0x8adb('0x3b')](_0x8adb('0x3c'))){_0x4eb474['limit']=qs[_0x8adb('0x20')](_0x1127d6[_0x8adb('0x35')][_0x8adb('0x20')]);_0x4eb474['offset']=qs[_0x8adb('0x1e')](_0x1127d6[_0x8adb('0x35')][_0x8adb('0x1e')]);}_0x4eb474[_0x8adb('0x3d')]=qs['sort'](_0x1127d6[_0x8adb('0x35')][_0x8adb('0x3e')]);_0x4eb474[_0x8adb('0x3f')]=qs[_0x8adb('0x37')](_['pick'](_0x1127d6[_0x8adb('0x35')],_0x1fb92f['filters']),_0x46a582);if(_0x1127d6['query'][_0x8adb('0x40')]){_0x4eb474['where']=_[_0x8adb('0x41')](_0x4eb474['where'],{'$or':_[_0x8adb('0x30')](_0x46a582,function(_0x23853e){if(_0x23853e[_0x8adb('0x42')]!==_0x8adb('0x43')){var _0x415753={};_0x415753[_0x23853e[_0x8adb('0x2d')]]={'$like':'%'+_0x1127d6['query'][_0x8adb('0x40')]+'%'};return _0x415753;}})});}_0x4eb474=_[_0x8adb('0x41')]({},_0x4eb474,_0x1127d6[_0x8adb('0x44')]);var _0x33316e={'where':_0x4eb474[_0x8adb('0x3f')]};return db[_0x8adb('0x31')]['count'](_0x33316e)[_0x8adb('0x28')](function(_0x2e47d9){_0x26bcf3[_0x8adb('0x21')]=_0x2e47d9;if(_0x1127d6[_0x8adb('0x35')]['includeAll']){_0x4eb474[_0x8adb('0x45')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x4eb474);})[_0x8adb('0x28')](function(_0x4126bd){_0x26bcf3[_0x8adb('0x46')]=_0x4126bd;return _0x26bcf3;})[_0x8adb('0x28')](respondWithFilteredResult(_0x37dc2e,_0x4eb474))[_0x8adb('0x47')](handleError(_0x37dc2e,null));};exports[_0x8adb('0x48')]=function(_0x5863ec,_0x512d89){var _0x3fb1f8={'raw':![],'where':{'id':_0x5863ec['params']['id']}},_0x21fb90={};_0x21fb90[_0x8adb('0x34')]=_[_0x8adb('0x36')](db[_0x8adb('0x31')][_0x8adb('0x32')]);_0x21fb90['query']=_['keys'](_0x5863ec[_0x8adb('0x35')]);_0x21fb90[_0x8adb('0x37')]=_[_0x8adb('0x38')](_0x21fb90[_0x8adb('0x34')],_0x21fb90[_0x8adb('0x35')]);_0x3fb1f8[_0x8adb('0x39')]=_[_0x8adb('0x38')](_0x21fb90[_0x8adb('0x34')],qs[_0x8adb('0x3a')](_0x5863ec[_0x8adb('0x35')]['fields']));_0x3fb1f8[_0x8adb('0x39')]=_0x3fb1f8[_0x8adb('0x39')][_0x8adb('0x49')]?_0x3fb1f8[_0x8adb('0x39')]:_0x21fb90[_0x8adb('0x34')];if(_0x5863ec['query']['includeAll']){_0x3fb1f8[_0x8adb('0x45')]=[{'all':!![]}];}_0x3fb1f8=_['merge']({},_0x3fb1f8,_0x5863ec[_0x8adb('0x44')]);return db[_0x8adb('0x31')]['find'](_0x3fb1f8)[_0x8adb('0x28')](handleEntityNotFound(_0x512d89,null))[_0x8adb('0x28')](respondWithResult(_0x512d89,null))[_0x8adb('0x47')](handleError(_0x512d89,null));};exports[_0x8adb('0x4a')]=function(_0x54eb37,_0x105c01){return db['IntegrationReport'][_0x8adb('0x4a')](_0x54eb37['body'],{})[_0x8adb('0x28')](respondWithResult(_0x105c01,0xc9))['catch'](handleError(_0x105c01,null));};exports[_0x8adb('0x27')]=function(_0x2ece7e,_0x544275){if(_0x2ece7e['body']['id']){delete _0x2ece7e['body']['id'];}return db[_0x8adb('0x31')]['find']({'where':{'id':_0x2ece7e[_0x8adb('0x4b')]['id']}})[_0x8adb('0x28')](handleEntityNotFound(_0x544275,null))[_0x8adb('0x28')](saveUpdates(_0x2ece7e[_0x8adb('0x4c')],null))[_0x8adb('0x28')](respondWithResult(_0x544275,null))[_0x8adb('0x47')](handleError(_0x544275,null));};exports[_0x8adb('0x29')]=function(_0x1f4025,_0x279713){return db[_0x8adb('0x31')][_0x8adb('0x4d')]({'where':{'id':_0x1f4025['params']['id']}})['then'](handleEntityNotFound(_0x279713,null))[_0x8adb('0x28')](removeEntity(_0x279713,null))[_0x8adb('0x47')](handleError(_0x279713,null));};exports['describe']=function(_0x3ba38a,_0x2b6861){return db['IntegrationReport'][_0x8adb('0x4e')]()[_0x8adb('0x28')](respondWithResult(_0x2b6861,null))[_0x8adb('0x47')](handleError(_0x2b6861,null));}; \ No newline at end of file +var _0x9f73=['filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','limit','count','status','set','update','then','destroy','sendStatus','error','send','index','map','IntegrationReport','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9f73,0x132));var _0x39f7=function(_0x1b9e5a,_0x278990){_0x1b9e5a=_0x1b9e5a-0x0;var _0x596038=_0x9f73[_0x1b9e5a];return _0x596038;};'use strict';var emlformat=require(_0x39f7('0x0'));var rimraf=require(_0x39f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39f7('0x2'));var rp=require(_0x39f7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x39f7('0x4'));var util=require(_0x39f7('0x5'));var path=require(_0x39f7('0x6'));var sox=require(_0x39f7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39f7('0x8'));var _=require(_0x39f7('0x9'));var squel=require(_0x39f7('0xa'));var crypto=require('crypto');var jsforce=require(_0x39f7('0xb'));var deskjs=require(_0x39f7('0xc'));var toCsv=require(_0x39f7('0xd'));var querystring=require(_0x39f7('0xe'));var Papa=require('papaparse');var Redis=require(_0x39f7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x39f7('0x10'));var as=require(_0x39f7('0x11'));var hardwareService=require(_0x39f7('0x12'));var logger=require(_0x39f7('0x13'))(_0x39f7('0x14'));var utils=require(_0x39f7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x39f7('0x16'));var db=require(_0x39f7('0x17'))['db'];function respondWithStatusCode(_0x1b69ad,_0xd82f6e){_0xd82f6e=_0xd82f6e||0xcc;return function(_0x14c20d){if(_0x14c20d){return _0x1b69ad['sendStatus'](_0xd82f6e);}return _0x1b69ad['status'](_0xd82f6e)[_0x39f7('0x18')]();};}function respondWithResult(_0x356229,_0x1616ad){_0x1616ad=_0x1616ad||0xc8;return function(_0x24fc15){if(_0x24fc15){return _0x356229['status'](_0x1616ad)[_0x39f7('0x19')](_0x24fc15);}};}function respondWithFilteredResult(_0x2fe2e0,_0x33930e){return function(_0x10e5b1){if(_0x10e5b1){var _0x4fb2c3=typeof _0x33930e[_0x39f7('0x1a')]==='undefined'&&typeof _0x33930e[_0x39f7('0x1b')]==='undefined';var _0x484569=_0x10e5b1['count'];var _0x5035fa=_0x4fb2c3?0x0:_0x33930e['offset'];var _0x7d5d48=_0x4fb2c3?_0x10e5b1[_0x39f7('0x1c')]:_0x33930e[_0x39f7('0x1a')]+_0x33930e[_0x39f7('0x1b')];var _0x38b8df;if(_0x7d5d48>=_0x484569){_0x7d5d48=_0x484569;_0x38b8df=0xc8;}else{_0x38b8df=0xce;}_0x2fe2e0[_0x39f7('0x1d')](_0x38b8df);return _0x2fe2e0[_0x39f7('0x1e')]('Content-Range',_0x5035fa+'-'+_0x7d5d48+'/'+_0x484569)['json'](_0x10e5b1);}return null;};}function patchUpdates(_0xf596e7){return function(_0x577d1f){try{jsonpatch['apply'](_0x577d1f,_0xf596e7,!![]);}catch(_0x309ccf){return BPromise['reject'](_0x309ccf);}return _0x577d1f['save']();};}function saveUpdates(_0x414fc4,_0x500c8b){return function(_0x4f09cc){if(_0x4f09cc){return _0x4f09cc[_0x39f7('0x1f')](_0x414fc4)[_0x39f7('0x20')](function(_0x2ad285){return _0x2ad285;});}return null;};}function removeEntity(_0x1edb2f,_0x423de9){return function(_0x52994d){if(_0x52994d){return _0x52994d[_0x39f7('0x21')]()['then'](function(){_0x1edb2f[_0x39f7('0x1d')](0xcc)[_0x39f7('0x18')]();});}};}function handleEntityNotFound(_0x1f1fbd,_0x15bf1b){return function(_0x3396d7){if(!_0x3396d7){_0x1f1fbd[_0x39f7('0x22')](0x194);}return _0x3396d7;};}function handleError(_0xccd9e1,_0x4989ef){_0x4989ef=_0x4989ef||0x1f4;return function(_0x1ce6f3){logger[_0x39f7('0x23')](_0x1ce6f3['stack']);if(_0x1ce6f3['name']){delete _0x1ce6f3['name'];}_0xccd9e1[_0x39f7('0x1d')](_0x4989ef)[_0x39f7('0x24')](_0x1ce6f3);};}exports[_0x39f7('0x25')]=function(_0x34564c,_0x91df39){var _0x5ae41e={},_0x46d6ab={},_0x84aa4a={'count':0x0,'rows':[]};var _0x1cd9b8=_[_0x39f7('0x26')](db[_0x39f7('0x27')]['rawAttributes'],function(_0x4c5b68){return{'name':_0x4c5b68['fieldName'],'type':_0x4c5b68[_0x39f7('0x28')][_0x39f7('0x29')]};});_0x46d6ab[_0x39f7('0x2a')]=_[_0x39f7('0x26')](_0x1cd9b8,_0x39f7('0x2b'));_0x46d6ab['query']=_[_0x39f7('0x2c')](_0x34564c[_0x39f7('0x2d')]);_0x46d6ab['filters']=_[_0x39f7('0x2e')](_0x46d6ab[_0x39f7('0x2a')],_0x46d6ab[_0x39f7('0x2d')]);_0x5ae41e[_0x39f7('0x2f')]=_[_0x39f7('0x2e')](_0x46d6ab[_0x39f7('0x2a')],qs[_0x39f7('0x30')](_0x34564c['query'][_0x39f7('0x30')]));_0x5ae41e[_0x39f7('0x2f')]=_0x5ae41e[_0x39f7('0x2f')][_0x39f7('0x31')]?_0x5ae41e['attributes']:_0x46d6ab[_0x39f7('0x2a')];if(!_0x34564c['query'][_0x39f7('0x32')](_0x39f7('0x33'))){_0x5ae41e[_0x39f7('0x1b')]=qs['limit'](_0x34564c['query']['limit']);_0x5ae41e[_0x39f7('0x1a')]=qs[_0x39f7('0x1a')](_0x34564c[_0x39f7('0x2d')][_0x39f7('0x1a')]);}_0x5ae41e[_0x39f7('0x34')]=qs[_0x39f7('0x35')](_0x34564c[_0x39f7('0x2d')][_0x39f7('0x35')]);_0x5ae41e['where']=qs[_0x39f7('0x36')](_[_0x39f7('0x37')](_0x34564c['query'],_0x46d6ab[_0x39f7('0x36')]),_0x1cd9b8);if(_0x34564c[_0x39f7('0x2d')]['filter']){_0x5ae41e['where']=_[_0x39f7('0x38')](_0x5ae41e[_0x39f7('0x39')],{'$or':_[_0x39f7('0x26')](_0x1cd9b8,function(_0xe62bf7){if(_0xe62bf7[_0x39f7('0x28')]!==_0x39f7('0x3a')){var _0x489ba9={};_0x489ba9[_0xe62bf7[_0x39f7('0x2b')]]={'$like':'%'+_0x34564c[_0x39f7('0x2d')][_0x39f7('0x3b')]+'%'};return _0x489ba9;}})});}_0x5ae41e=_[_0x39f7('0x38')]({},_0x5ae41e,_0x34564c[_0x39f7('0x3c')]);var _0x36fa8c={'where':_0x5ae41e['where']};return db[_0x39f7('0x27')][_0x39f7('0x1c')](_0x36fa8c)[_0x39f7('0x20')](function(_0x3642a7){_0x84aa4a[_0x39f7('0x1c')]=_0x3642a7;if(_0x34564c[_0x39f7('0x2d')][_0x39f7('0x3d')]){_0x5ae41e[_0x39f7('0x3e')]=[{'all':!![]}];}return db[_0x39f7('0x27')][_0x39f7('0x3f')](_0x5ae41e);})['then'](function(_0x5c097f){_0x84aa4a['rows']=_0x5c097f;return _0x84aa4a;})[_0x39f7('0x20')](respondWithFilteredResult(_0x91df39,_0x5ae41e))[_0x39f7('0x40')](handleError(_0x91df39,null));};exports[_0x39f7('0x41')]=function(_0x40f36a,_0x4f28ab){var _0x567621={'raw':![],'where':{'id':_0x40f36a[_0x39f7('0x42')]['id']}},_0x414991={};_0x414991[_0x39f7('0x2a')]=_[_0x39f7('0x2c')](db['IntegrationReport'][_0x39f7('0x43')]);_0x414991[_0x39f7('0x2d')]=_['keys'](_0x40f36a[_0x39f7('0x2d')]);_0x414991[_0x39f7('0x36')]=_[_0x39f7('0x2e')](_0x414991[_0x39f7('0x2a')],_0x414991[_0x39f7('0x2d')]);_0x567621['attributes']=_['intersection'](_0x414991[_0x39f7('0x2a')],qs[_0x39f7('0x30')](_0x40f36a['query']['fields']));_0x567621[_0x39f7('0x2f')]=_0x567621[_0x39f7('0x2f')][_0x39f7('0x31')]?_0x567621[_0x39f7('0x2f')]:_0x414991[_0x39f7('0x2a')];if(_0x40f36a[_0x39f7('0x2d')][_0x39f7('0x3d')]){_0x567621[_0x39f7('0x3e')]=[{'all':!![]}];}_0x567621=_[_0x39f7('0x38')]({},_0x567621,_0x40f36a[_0x39f7('0x3c')]);return db['IntegrationReport'][_0x39f7('0x44')](_0x567621)[_0x39f7('0x20')](handleEntityNotFound(_0x4f28ab,null))['then'](respondWithResult(_0x4f28ab,null))['catch'](handleError(_0x4f28ab,null));};exports['create']=function(_0x422835,_0xd8c2dc){return db[_0x39f7('0x27')][_0x39f7('0x45')](_0x422835[_0x39f7('0x46')],{})[_0x39f7('0x20')](respondWithResult(_0xd8c2dc,0xc9))[_0x39f7('0x40')](handleError(_0xd8c2dc,null));};exports[_0x39f7('0x1f')]=function(_0xba1157,_0x2d5e81){if(_0xba1157['body']['id']){delete _0xba1157['body']['id'];}return db[_0x39f7('0x27')][_0x39f7('0x44')]({'where':{'id':_0xba1157[_0x39f7('0x42')]['id']}})[_0x39f7('0x20')](handleEntityNotFound(_0x2d5e81,null))['then'](saveUpdates(_0xba1157[_0x39f7('0x46')],null))[_0x39f7('0x20')](respondWithResult(_0x2d5e81,null))[_0x39f7('0x40')](handleError(_0x2d5e81,null));};exports[_0x39f7('0x21')]=function(_0x41af86,_0x95fdb6){return db[_0x39f7('0x27')][_0x39f7('0x44')]({'where':{'id':_0x41af86[_0x39f7('0x42')]['id']}})['then'](handleEntityNotFound(_0x95fdb6,null))['then'](removeEntity(_0x95fdb6,null))[_0x39f7('0x40')](handleError(_0x95fdb6,null));};exports[_0x39f7('0x47')]=function(_0x533773,_0x44d0d2){return db[_0x39f7('0x27')]['describe']()[_0x39f7('0x20')](respondWithResult(_0x44d0d2,null))[_0x39f7('0x40')](handleError(_0x44d0d2,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 8b5e815..3a09eed 100644 --- a/server/api/integrationReport/integrationReport.model.js +++ b/server/api/integrationReport/integrationReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9338=['bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','../../config/logger','api'];(function(_0x7a3240,_0x3b498c){var _0x57fe4c=function(_0x498a08){while(--_0x498a08){_0x7a3240['push'](_0x7a3240['shift']());}};_0x57fe4c(++_0x3b498c);}(_0x9338,0x1e1));var _0x8933=function(_0x282f96,_0x2be4be){_0x282f96=_0x282f96-0x0;var _0x12d02b=_0x9338[_0x282f96];return _0x12d02b;};'use strict';var _=require(_0x8933('0x0'));var util=require('util');var logger=require(_0x8933('0x1'))(_0x8933('0x2'));var moment=require('moment');var BPromise=require(_0x8933('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8933('0x4'));var rimraf=require(_0x8933('0x5'));var config=require(_0x8933('0x6'));var attributes=require(_0x8933('0x7'));module[_0x8933('0x8')]=function(_0x2c0d6c,_0xa6e838){return _0x2c0d6c[_0x8933('0x9')](_0x8933('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1534=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','report_integration','lodash'];(function(_0x360ea1,_0x16249a){var _0x4ce845=function(_0x4a5a9a){while(--_0x4a5a9a){_0x360ea1['push'](_0x360ea1['shift']());}};_0x4ce845(++_0x16249a);}(_0x1534,0xb3));var _0x4153=function(_0x5cfce3,_0x326c9b){_0x5cfce3=_0x5cfce3-0x0;var _0x5bc798=_0x1534[_0x5cfce3];return _0x5bc798;};'use strict';var _=require(_0x4153('0x0'));var util=require(_0x4153('0x1'));var logger=require(_0x4153('0x2'))('api');var moment=require(_0x4153('0x3'));var BPromise=require(_0x4153('0x4'));var rp=require(_0x4153('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4153('0x6'));var config=require(_0x4153('0x7'));var attributes=require(_0x4153('0x8'));module[_0x4153('0x9')]=function(_0x44592c,_0x60074f){return _0x44592c[_0x4153('0xa')]('IntegrationReport',attributes,{'tableName':_0x4153('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 3f541cc..1129c0c 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37ca75,_0x10fb14){var _0x486f04=function(_0xc8532f){while(--_0xc8532f){_0x37ca75['push'](_0x37ca75['shift']());}};_0x486f04(++_0x10fb14);}(_0x0295,0x1f0));var _0x5029=function(_0x24b33c,_0x33cb97){_0x24b33c=_0x24b33c-0x0;var _0x33becf=_0x0295[_0x24b33c];return _0x33becf;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x326f=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x20b943,_0x4f6465){var _0x240006=function(_0x24e3cc){while(--_0x24e3cc){_0x20b943['push'](_0x20b943['shift']());}};_0x240006(++_0x4f6465);}(_0x326f,0xd1));var _0xf326=function(_0x2395ce,_0x14a9f8){_0x2395ce=_0x2395ce-0x0;var _0x13eed1=_0x326f[_0x2395ce];return _0x13eed1;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d822f60..9fb0034 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22e3=['get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','create','/:id/sub_intervals/create_many','put','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x22e3,0xf3));var _0x322e=function(_0x39b657,_0x418f71){_0x39b657=_0x39b657-0x0;var _0x5b1a66=_0x22e3[_0x39b657];return _0x5b1a66;};'use strict';var multer=require(_0x322e('0x0'));var util=require(_0x322e('0x1'));var path=require(_0x322e('0x2'));var timeout=require('connect-timeout');var express=require(_0x322e('0x3'));var router=express[_0x322e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x322e('0x5'));var interaction=require(_0x322e('0x6'));var config=require(_0x322e('0x7'));var controller=require(_0x322e('0x8'));router[_0x322e('0x9')]('/',auth['isAuthenticated'](),controller[_0x322e('0xa')]);router[_0x322e('0x9')](_0x322e('0xb'),auth[_0x322e('0xc')](),controller[_0x322e('0xd')]);router[_0x322e('0x9')](_0x322e('0xe'),auth[_0x322e('0xc')](),controller[_0x322e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x322e('0x10')]);router['post'](_0x322e('0xe'),auth['isAuthenticated'](),controller['addInterval']);router['post'](_0x322e('0x11'),auth[_0x322e('0xc')](),controller['addIntervals']);router[_0x322e('0x12')](_0x322e('0xb'),auth[_0x322e('0xc')](),controller['update']);router[_0x322e('0x13')](_0x322e('0xb'),auth[_0x322e('0xc')](),controller[_0x322e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9a96=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports'];(function(_0x5bb31e,_0x30ceb9){var _0x24c927=function(_0x1e2a96){while(--_0x1e2a96){_0x5bb31e['push'](_0x5bb31e['shift']());}};_0x24c927(++_0x30ceb9);}(_0x9a96,0xd0));var _0x69a9=function(_0x53ffac,_0x2fc915){_0x53ffac=_0x53ffac-0x0;var _0x4306da=_0x9a96[_0x53ffac];return _0x4306da;};'use strict';var multer=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var path=require(_0x69a9('0x2'));var timeout=require(_0x69a9('0x3'));var express=require(_0x69a9('0x4'));var router=express[_0x69a9('0x5')]();var fs_extra=require(_0x69a9('0x6'));var auth=require(_0x69a9('0x7'));var interaction=require(_0x69a9('0x8'));var config=require(_0x69a9('0x9'));var controller=require(_0x69a9('0xa'));router[_0x69a9('0xb')]('/',auth['isAuthenticated'](),controller[_0x69a9('0xc')]);router[_0x69a9('0xb')](_0x69a9('0xd'),auth[_0x69a9('0xe')](),controller['show']);router[_0x69a9('0xb')](_0x69a9('0xf'),auth[_0x69a9('0xe')](),controller[_0x69a9('0x10')]);router[_0x69a9('0x11')]('/',auth[_0x69a9('0xe')](),controller[_0x69a9('0x12')]);router['post'](_0x69a9('0xf'),auth['isAuthenticated'](),controller[_0x69a9('0x13')]);router[_0x69a9('0x11')](_0x69a9('0x14'),auth['isAuthenticated'](),controller[_0x69a9('0x15')]);router[_0x69a9('0x16')](_0x69a9('0xd'),auth[_0x69a9('0xe')](),controller[_0x69a9('0x17')]);router[_0x69a9('0x18')](_0x69a9('0xd'),auth[_0x69a9('0xe')](),controller['destroy']);module[_0x69a9('0x19')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 7805c58..d7b9b82 100644 --- a/server/api/interval/interval.attributes.js +++ b/server/api/interval/interval.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3850=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3850,0x11d));var _0x0385=function(_0x2e88d5,_0x430f6f){_0x2e88d5=_0x2e88d5-0x0;var _0xc5b7ec=_0x3850[_0x2e88d5];return _0xc5b7ec;};'use strict';var Sequelize=require(_0x0385('0x0'));module[_0x0385('0x1')]={'name':{'type':Sequelize[_0x0385('0x2')]},'description':{'type':Sequelize[_0x0385('0x2')]},'interval':{'type':Sequelize[_0x0385('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x58ed=['exports','STRING'];(function(_0x4f17b3,_0x348196){var _0x4f5726=function(_0x1a9d0c){while(--_0x1a9d0c){_0x4f17b3['push'](_0x4f17b3['shift']());}};_0x4f5726(++_0x348196);}(_0x58ed,0x18c));var _0xd58e=function(_0xb783f0,_0x2d28c4){_0xb783f0=_0xb783f0-0x0;var _0x17f9a2=_0x58ed[_0xb783f0];return _0x17f9a2;};'use strict';var Sequelize=require('sequelize');module[_0xd58e('0x0')]={'name':{'type':Sequelize[_0xd58e('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd58e('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c511321..85bbf8c 100644 --- a/server/api/interval/interval.controller.js +++ b/server/api/interval/interval.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0752=['show','params','rawAttributes','length','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','sort','hasOwnProperty','sequelize','IntervalId','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','map','Interval','fieldName','key','keys','query','filters','intersection','attributes','model','fields','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x0752,0x1d6));var _0x2075=function(_0x149b42,_0x25b787){_0x149b42=_0x149b42-0x0;var _0x3ee410=_0x0752[_0x149b42];return _0x3ee410;};'use strict';var emlformat=require(_0x2075('0x0'));var rimraf=require(_0x2075('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2075('0x2'));var rp=require(_0x2075('0x3'));var moment=require('moment');var BPromise=require(_0x2075('0x4'));var Mustache=require(_0x2075('0x5'));var util=require(_0x2075('0x6'));var path=require(_0x2075('0x7'));var sox=require('sox');var csv=require(_0x2075('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2075('0x9'));var _=require(_0x2075('0xa'));var squel=require(_0x2075('0xb'));var crypto=require('crypto');var jsforce=require(_0x2075('0xc'));var deskjs=require(_0x2075('0xd'));var toCsv=require(_0x2075('0x8'));var querystring=require(_0x2075('0xe'));var Papa=require(_0x2075('0xf'));var Redis=require(_0x2075('0x10'));var authService=require(_0x2075('0x11'));var qs=require(_0x2075('0x12'));var as=require(_0x2075('0x13'));var hardwareService=require(_0x2075('0x14'));var logger=require(_0x2075('0x15'))(_0x2075('0x16'));var utils=require(_0x2075('0x17'));var config=require(_0x2075('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2075('0x19'))['db'];var extensions=require(_0x2075('0x1a'));function respondWithStatusCode(_0x302b99,_0x9f4821){_0x9f4821=_0x9f4821||0xcc;return function(_0x5a241b){if(_0x5a241b){return _0x302b99['sendStatus'](_0x9f4821);}return _0x302b99[_0x2075('0x1b')](_0x9f4821)['end']();};}function respondWithResult(_0x2c340b,_0x4c2279){_0x4c2279=_0x4c2279||0xc8;return function(_0x896fc2){if(_0x896fc2){return _0x2c340b['status'](_0x4c2279)['json'](_0x896fc2);}};}function respondWithFilteredResult(_0x214778,_0x153c77){return function(_0x1989ff){if(_0x1989ff){var _0x525052=typeof _0x153c77[_0x2075('0x1c')]===_0x2075('0x1d')&&typeof _0x153c77['limit']===_0x2075('0x1d');var _0x4280af=_0x1989ff[_0x2075('0x1e')];var _0x1b6596=_0x525052?0x0:_0x153c77[_0x2075('0x1c')];var _0x44da39=_0x525052?_0x1989ff['count']:_0x153c77[_0x2075('0x1c')]+_0x153c77[_0x2075('0x1f')];var _0x1bc48f;if(_0x44da39>=_0x4280af){_0x44da39=_0x4280af;_0x1bc48f=0xc8;}else{_0x1bc48f=0xce;}_0x214778[_0x2075('0x1b')](_0x1bc48f);return _0x214778[_0x2075('0x20')]('Content-Range',_0x1b6596+'-'+_0x44da39+'/'+_0x4280af)[_0x2075('0x21')](_0x1989ff);}return null;};}function patchUpdates(_0x2cbf3e){return function(_0x27f57e){try{jsonpatch[_0x2075('0x22')](_0x27f57e,_0x2cbf3e,!![]);}catch(_0x2e1fa8){return BPromise[_0x2075('0x23')](_0x2e1fa8);}return _0x27f57e[_0x2075('0x24')]();};}function saveUpdates(_0x521542,_0x228eb6){return function(_0xe702b3){if(_0xe702b3){return _0xe702b3[_0x2075('0x25')](_0x521542)[_0x2075('0x26')](function(_0x35920c){return _0x35920c;});}return null;};}function removeEntity(_0x5023ff,_0x293aff){return function(_0x501e9e){if(_0x501e9e){return _0x501e9e['destroy']()[_0x2075('0x26')](function(){var _0x3f7ec2=_0x501e9e['get']({'plain':!![]});var _0x12ecc1='Intervals';return db[_0x2075('0x27')][_0x2075('0x28')]({'where':{'type':_0x12ecc1,'resourceId':_0x3f7ec2['id']}})['then'](function(){return _0x501e9e;});})[_0x2075('0x26')](function(){_0x5023ff['status'](0xcc)[_0x2075('0x29')]();});}};}function handleEntityNotFound(_0x531ab6,_0x134a3c){return function(_0xc90500){if(!_0xc90500){_0x531ab6[_0x2075('0x2a')](0x194);}return _0xc90500;};}function handleError(_0x20a5d5,_0x26857e){_0x26857e=_0x26857e||0x1f4;return function(_0x9fd45f){logger[_0x2075('0x2b')](_0x9fd45f[_0x2075('0x2c')]);if(_0x9fd45f[_0x2075('0x2d')]){delete _0x9fd45f[_0x2075('0x2d')];}_0x20a5d5[_0x2075('0x1b')](_0x26857e)[_0x2075('0x2e')](_0x9fd45f);};}exports['index']=function(_0x19ee9f,_0x1468f0){var _0x34ab78={},_0x561fbc={},_0x3d4fb1={'count':0x0,'rows':[]};var _0x469f8e=_[_0x2075('0x2f')](db[_0x2075('0x30')]['rawAttributes'],function(_0x191ee0){return{'name':_0x191ee0[_0x2075('0x31')],'type':_0x191ee0['type'][_0x2075('0x32')]};});_0x561fbc['model']=_[_0x2075('0x2f')](_0x469f8e,_0x2075('0x2d'));_0x561fbc['query']=_[_0x2075('0x33')](_0x19ee9f[_0x2075('0x34')]);_0x561fbc[_0x2075('0x35')]=_[_0x2075('0x36')](_0x561fbc['model'],_0x561fbc[_0x2075('0x34')]);_0x34ab78[_0x2075('0x37')]=_['intersection'](_0x561fbc[_0x2075('0x38')],qs[_0x2075('0x39')](_0x19ee9f['query'][_0x2075('0x39')]));_0x34ab78['attributes']=_0x34ab78[_0x2075('0x37')]['length']?_0x34ab78['attributes']:_0x561fbc[_0x2075('0x38')];if(!_0x19ee9f[_0x2075('0x34')]['hasOwnProperty'](_0x2075('0x3a'))){_0x34ab78[_0x2075('0x1f')]=qs[_0x2075('0x1f')](_0x19ee9f['query'][_0x2075('0x1f')]);_0x34ab78[_0x2075('0x1c')]=qs[_0x2075('0x1c')](_0x19ee9f[_0x2075('0x34')]['offset']);}_0x34ab78[_0x2075('0x3b')]=qs['sort'](_0x19ee9f['query']['sort']);_0x34ab78[_0x2075('0x3c')]=qs['filters'](_[_0x2075('0x3d')](_0x19ee9f[_0x2075('0x34')],_0x561fbc[_0x2075('0x35')]),_0x469f8e);if(_0x19ee9f[_0x2075('0x34')][_0x2075('0x3e')]){_0x34ab78[_0x2075('0x3c')]=_[_0x2075('0x3f')](_0x34ab78[_0x2075('0x3c')],{'$or':_[_0x2075('0x2f')](_0x469f8e,function(_0x33b915){if(_0x33b915[_0x2075('0x40')]!==_0x2075('0x41')){var _0x2ee3fb={};_0x2ee3fb[_0x33b915[_0x2075('0x2d')]]={'$like':'%'+_0x19ee9f[_0x2075('0x34')]['filter']+'%'};return _0x2ee3fb;}})});}_0x34ab78=_['merge']({},_0x34ab78,_0x19ee9f[_0x2075('0x42')]);var _0x3d2f4b={'where':_0x34ab78[_0x2075('0x3c')]};return db[_0x2075('0x30')][_0x2075('0x1e')](_0x3d2f4b)[_0x2075('0x26')](function(_0x2b462f){_0x3d4fb1['count']=_0x2b462f;if(_0x19ee9f['query'][_0x2075('0x43')]){_0x34ab78[_0x2075('0x44')]=[{'all':!![]}];}return db[_0x2075('0x30')][_0x2075('0x45')](_0x34ab78);})[_0x2075('0x26')](function(_0x2e2596){_0x3d4fb1['rows']=_0x2e2596;return _0x3d4fb1;})[_0x2075('0x26')](respondWithFilteredResult(_0x1468f0,_0x34ab78))['catch'](handleError(_0x1468f0,null));};exports[_0x2075('0x46')]=function(_0x5ce19f,_0x162bb8){var _0x2b8a56={'raw':!![],'where':{'id':_0x5ce19f[_0x2075('0x47')]['id']}},_0x46b7cc={};_0x46b7cc[_0x2075('0x38')]=_[_0x2075('0x33')](db['Interval'][_0x2075('0x48')]);_0x46b7cc[_0x2075('0x34')]=_[_0x2075('0x33')](_0x5ce19f[_0x2075('0x34')]);_0x46b7cc[_0x2075('0x35')]=_[_0x2075('0x36')](_0x46b7cc[_0x2075('0x38')],_0x46b7cc['query']);_0x2b8a56[_0x2075('0x37')]=_[_0x2075('0x36')](_0x46b7cc['model'],qs[_0x2075('0x39')](_0x5ce19f[_0x2075('0x34')][_0x2075('0x39')]));_0x2b8a56['attributes']=_0x2b8a56['attributes'][_0x2075('0x49')]?_0x2b8a56['attributes']:_0x46b7cc[_0x2075('0x38')];if(_0x5ce19f[_0x2075('0x34')]['includeAll']){_0x2b8a56['include']=[{'all':!![]}];}_0x2b8a56=_[_0x2075('0x3f')]({},_0x2b8a56,_0x5ce19f[_0x2075('0x42')]);return db[_0x2075('0x30')]['find'](_0x2b8a56)[_0x2075('0x26')](handleEntityNotFound(_0x162bb8,null))[_0x2075('0x26')](respondWithResult(_0x162bb8,null))[_0x2075('0x4a')](handleError(_0x162bb8,null));};exports[_0x2075('0x4b')]=function(_0x1f2056,_0x4ca898){return db[_0x2075('0x30')][_0x2075('0x4b')](_0x1f2056[_0x2075('0x4c')],{})[_0x2075('0x26')](function(_0x316dfb){var _0xf5411b=_0x1f2056['user'][_0x2075('0x4d')]({'plain':!![]});if(!_0xf5411b)throw new Error(_0x2075('0x4e'));if(_0xf5411b['role']==='user'){var _0x2b37ff=_0x316dfb[_0x2075('0x4d')]({'plain':!![]});var _0x4c9cc6=_0x2075('0x4f');return db['UserProfileSection'][_0x2075('0x50')]({'where':{'name':_0x4c9cc6,'userProfileId':_0xf5411b[_0x2075('0x51')]},'raw':!![]})[_0x2075('0x26')](function(_0xfda68b){if(_0xfda68b&&_0xfda68b['autoAssociation']===0x0){return db['UserProfileResource'][_0x2075('0x4b')]({'name':_0x2b37ff['name'],'resourceId':_0x2b37ff['id'],'type':_0xfda68b[_0x2075('0x2d')],'sectionId':_0xfda68b['id']},{})[_0x2075('0x26')](function(){return _0x316dfb;});}else{return _0x316dfb;}})[_0x2075('0x4a')](function(_0x5c5ae7){logger[_0x2075('0x2b')](_0x2075('0x52'),_0x5c5ae7);throw _0x5c5ae7;});}return _0x316dfb;})[_0x2075('0x26')](respondWithResult(_0x4ca898,0xc9))[_0x2075('0x4a')](handleError(_0x4ca898,null));};exports[_0x2075('0x25')]=function(_0x869c5a,_0x1c6199){if(_0x869c5a[_0x2075('0x4c')]['id']){delete _0x869c5a[_0x2075('0x4c')]['id'];}return db[_0x2075('0x30')][_0x2075('0x50')]({'where':{'id':_0x869c5a['params']['id']}})[_0x2075('0x26')](handleEntityNotFound(_0x1c6199,null))[_0x2075('0x26')](saveUpdates(_0x869c5a[_0x2075('0x4c')],null))[_0x2075('0x26')](respondWithResult(_0x1c6199,null))['catch'](handleError(_0x1c6199,null));};exports[_0x2075('0x28')]=function(_0x400016,_0x67c144){return db[_0x2075('0x30')][_0x2075('0x50')]({'where':{'id':_0x400016[_0x2075('0x47')]['id']}})['then'](handleEntityNotFound(_0x67c144,null))['then'](removeEntity(_0x67c144,null))[_0x2075('0x4a')](handleError(_0x67c144,null));};exports[_0x2075('0x53')]=function(_0xe15cff,_0xdb9863,_0x4a97d3){if(_0xe15cff[_0x2075('0x4c')]['id']){delete _0xe15cff[_0x2075('0x4c')]['id'];}return db['Interval'][_0x2075('0x50')]({'where':{'id':_0xe15cff[_0x2075('0x47')]['id']}})[_0x2075('0x26')](handleEntityNotFound(_0xdb9863,null))['then'](function(_0x1722ea){if(_0x1722ea){_0xe15cff[_0x2075('0x4c')]['IntervalId']=_0x1722ea['id'];return db[_0x2075('0x30')][_0x2075('0x4b')](_0xe15cff['body']);}})['then'](respondWithResult(_0xdb9863,null))[_0x2075('0x4a')](handleError(_0xdb9863,null));};exports[_0x2075('0x54')]=function(_0x5870dd,_0x485fd4,_0x33826c){var _0x1e1b01={};var _0x187a81={};var _0x3f7d45;var _0x437b33;return db['Interval'][_0x2075('0x55')]({'where':{'id':_0x5870dd[_0x2075('0x47')]['id']}})[_0x2075('0x26')](handleEntityNotFound(_0x485fd4,null))[_0x2075('0x26')](function(_0x29fe92){if(_0x29fe92){_0x3f7d45=_0x29fe92;_0x187a81['model']=_[_0x2075('0x33')](db[_0x2075('0x30')]['rawAttributes']);_0x187a81[_0x2075('0x34')]=_['keys'](_0x5870dd['query']);_0x187a81[_0x2075('0x35')]=_['intersection'](_0x187a81[_0x2075('0x38')],_0x187a81[_0x2075('0x34')]);_0x1e1b01['attributes']=_[_0x2075('0x36')](_0x187a81[_0x2075('0x38')],qs[_0x2075('0x39')](_0x5870dd[_0x2075('0x34')][_0x2075('0x39')]));_0x1e1b01[_0x2075('0x37')]=_0x1e1b01[_0x2075('0x37')][_0x2075('0x49')]?_0x1e1b01['attributes']:_0x187a81[_0x2075('0x38')];_0x1e1b01['order']=qs['sort'](_0x5870dd[_0x2075('0x34')][_0x2075('0x56')]);_0x1e1b01[_0x2075('0x3c')]=qs[_0x2075('0x35')](_[_0x2075('0x3d')](_0x5870dd['query'],_0x187a81[_0x2075('0x35')]));if(_0x5870dd['query'][_0x2075('0x3e')]){_0x1e1b01['where']=_[_0x2075('0x3f')](_0x1e1b01[_0x2075('0x3c')],{'$or':_[_0x2075('0x2f')](_0x1e1b01[_0x2075('0x37')],function(_0x1cdfc2){var _0x5a8f31={};_0x5a8f31[_0x1cdfc2]={'$like':'%'+_0x5870dd['query'][_0x2075('0x3e')]+'%'};return _0x5a8f31;})});}_0x1e1b01=_['merge']({},_0x1e1b01,_0x5870dd[_0x2075('0x42')]);return _0x3f7d45[_0x2075('0x54')](_0x1e1b01);}})[_0x2075('0x26')](function(_0x19e8c6){if(_0x19e8c6){_0x437b33=_0x19e8c6[_0x2075('0x49')];if(!_0x5870dd[_0x2075('0x34')][_0x2075('0x57')](_0x2075('0x3a'))){_0x1e1b01['limit']=qs[_0x2075('0x1f')](_0x5870dd['query'][_0x2075('0x1f')]);_0x1e1b01[_0x2075('0x1c')]=qs['offset'](_0x5870dd[_0x2075('0x34')][_0x2075('0x1c')]);}return _0x3f7d45[_0x2075('0x54')](_0x1e1b01);}})[_0x2075('0x26')](function(_0x5b8a10){if(_0x5b8a10){return _0x5b8a10?{'count':_0x437b33,'rows':_0x5b8a10}:null;}})[_0x2075('0x26')](respondWithResult(_0x485fd4,null))[_0x2075('0x4a')](handleError(_0x485fd4,null));};exports['addIntervals']=function(_0x52f3bb,_0x11a701,_0x3184ec){return db[_0x2075('0x30')][_0x2075('0x55')]({'where':{'id':_0x52f3bb[_0x2075('0x47')]['id']}})[_0x2075('0x26')](handleEntityNotFound(_0x11a701,null))[_0x2075('0x26')](function(_0x536368){if(_0x536368){return db[_0x2075('0x58')]['transaction'](function(_0x4ec2c5){return db[_0x2075('0x30')][_0x2075('0x28')]({'where':{'IntervalId':_0x52f3bb[_0x2075('0x47')]['id']},'transaction':_0x4ec2c5})[_0x2075('0x26')](function(_0x325e70){var _0x1e40f7=_['map'](_0x52f3bb[_0x2075('0x4c')],function(_0xe340bf){delete _0xe340bf['id'];_0xe340bf[_0x2075('0x59')]=_0x52f3bb[_0x2075('0x47')]['id'];return _0xe340bf;});return db[_0x2075('0x30')]['bulkCreate'](_0x1e40f7,{'transaction':_0x4ec2c5});});})[_0x2075('0x26')](function(){return db[_0x2075('0x30')][_0x2075('0x45')]({'where':{'IntervalId':_0x52f3bb[_0x2075('0x47')]['id']}});});}})[_0x2075('0x26')](respondWithResult(_0x11a701,null))[_0x2075('0x4a')](handleError(_0x11a701,null));}; \ No newline at end of file +var _0x3e14=['Intervals','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Interval','include','findAll','rows','params','keys','includeAll','find','catch','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','body','create','getIntervals','findOne','addIntervals','sequelize','transaction','IntervalId','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x5e480c,_0x530a79){var _0x42db51=function(_0xe56849){while(--_0xe56849){_0x5e480c['push'](_0x5e480c['shift']());}};_0x42db51(++_0x530a79);}(_0x3e14,0xe8));var _0x43e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e14[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x43e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x43e1('0x2'));var BPromise=require(_0x43e1('0x3'));var Mustache=require('mustache');var util=require(_0x43e1('0x4'));var path=require(_0x43e1('0x5'));var sox=require(_0x43e1('0x6'));var csv=require(_0x43e1('0x7'));var ejs=require(_0x43e1('0x8'));var fs=require('fs');var fs_extra=require(_0x43e1('0x9'));var _=require(_0x43e1('0xa'));var squel=require(_0x43e1('0xb'));var crypto=require(_0x43e1('0xc'));var jsforce=require(_0x43e1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x43e1('0x7'));var querystring=require('querystring');var Papa=require(_0x43e1('0xe'));var Redis=require(_0x43e1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x43e1('0x10'));var as=require(_0x43e1('0x11'));var hardwareService=require(_0x43e1('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x43e1('0x13'));var config=require(_0x43e1('0x14'));var licenseUtil=require(_0x43e1('0x15'));var db=require(_0x43e1('0x16'))['db'];var extensions=require(_0x43e1('0x17'));function respondWithStatusCode(_0x8f57b5,_0x17267d){_0x17267d=_0x17267d||0xcc;return function(_0x2ea2a7){if(_0x2ea2a7){return _0x8f57b5[_0x43e1('0x18')](_0x17267d);}return _0x8f57b5[_0x43e1('0x19')](_0x17267d)[_0x43e1('0x1a')]();};}function respondWithResult(_0x364cb3,_0x4c4840){_0x4c4840=_0x4c4840||0xc8;return function(_0x2ca99e){if(_0x2ca99e){return _0x364cb3['status'](_0x4c4840)[_0x43e1('0x1b')](_0x2ca99e);}};}function respondWithFilteredResult(_0x33b89b,_0x209f54){return function(_0x3db610){if(_0x3db610){var _0x270e2f=typeof _0x209f54[_0x43e1('0x1c')]===_0x43e1('0x1d')&&typeof _0x209f54[_0x43e1('0x1e')]===_0x43e1('0x1d');var _0x4fa4b9=_0x3db610[_0x43e1('0x1f')];var _0x49c25d=_0x270e2f?0x0:_0x209f54['offset'];var _0x197cba=_0x270e2f?_0x3db610[_0x43e1('0x1f')]:_0x209f54[_0x43e1('0x1c')]+_0x209f54[_0x43e1('0x1e')];var _0xeba4fa;if(_0x197cba>=_0x4fa4b9){_0x197cba=_0x4fa4b9;_0xeba4fa=0xc8;}else{_0xeba4fa=0xce;}_0x33b89b[_0x43e1('0x19')](_0xeba4fa);return _0x33b89b[_0x43e1('0x20')](_0x43e1('0x21'),_0x49c25d+'-'+_0x197cba+'/'+_0x4fa4b9)['json'](_0x3db610);}return null;};}function patchUpdates(_0x214548){return function(_0x22b8af){try{jsonpatch[_0x43e1('0x22')](_0x22b8af,_0x214548,!![]);}catch(_0x3cdc17){return BPromise[_0x43e1('0x23')](_0x3cdc17);}return _0x22b8af[_0x43e1('0x24')]();};}function saveUpdates(_0x123cbb,_0x190525){return function(_0x4d8292){if(_0x4d8292){return _0x4d8292[_0x43e1('0x25')](_0x123cbb)[_0x43e1('0x26')](function(_0x23ee91){return _0x23ee91;});}return null;};}function removeEntity(_0x2ddbc4,_0x4098bd){return function(_0x1b047b){if(_0x1b047b){return _0x1b047b[_0x43e1('0x27')]()[_0x43e1('0x26')](function(){var _0x51c321=_0x1b047b[_0x43e1('0x28')]({'plain':!![]});var _0x27ada7=_0x43e1('0x29');return db[_0x43e1('0x2a')][_0x43e1('0x27')]({'where':{'type':_0x27ada7,'resourceId':_0x51c321['id']}})[_0x43e1('0x26')](function(){return _0x1b047b;});})[_0x43e1('0x26')](function(){_0x2ddbc4[_0x43e1('0x19')](0xcc)[_0x43e1('0x1a')]();});}};}function handleEntityNotFound(_0x34d117,_0x2517b3){return function(_0x848847){if(!_0x848847){_0x34d117['sendStatus'](0x194);}return _0x848847;};}function handleError(_0x1c227a,_0x4cd5e9){_0x4cd5e9=_0x4cd5e9||0x1f4;return function(_0x3a6857){logger[_0x43e1('0x2b')](_0x3a6857[_0x43e1('0x2c')]);if(_0x3a6857['name']){delete _0x3a6857[_0x43e1('0x2d')];}_0x1c227a['status'](_0x4cd5e9)[_0x43e1('0x2e')](_0x3a6857);};}exports[_0x43e1('0x2f')]=function(_0xa853fe,_0x18b850){var _0xe98ae7={},_0x4def49={},_0x43c534={'count':0x0,'rows':[]};var _0x1e68fa=_[_0x43e1('0x30')](db['Interval'][_0x43e1('0x31')],function(_0x1196c5){return{'name':_0x1196c5[_0x43e1('0x32')],'type':_0x1196c5[_0x43e1('0x33')]['key']};});_0x4def49['model']=_[_0x43e1('0x30')](_0x1e68fa,_0x43e1('0x2d'));_0x4def49['query']=_['keys'](_0xa853fe[_0x43e1('0x34')]);_0x4def49[_0x43e1('0x35')]=_['intersection'](_0x4def49[_0x43e1('0x36')],_0x4def49[_0x43e1('0x34')]);_0xe98ae7[_0x43e1('0x37')]=_[_0x43e1('0x38')](_0x4def49[_0x43e1('0x36')],qs['fields'](_0xa853fe['query'][_0x43e1('0x39')]));_0xe98ae7[_0x43e1('0x37')]=_0xe98ae7[_0x43e1('0x37')][_0x43e1('0x3a')]?_0xe98ae7[_0x43e1('0x37')]:_0x4def49[_0x43e1('0x36')];if(!_0xa853fe[_0x43e1('0x34')]['hasOwnProperty'](_0x43e1('0x3b'))){_0xe98ae7[_0x43e1('0x1e')]=qs[_0x43e1('0x1e')](_0xa853fe[_0x43e1('0x34')][_0x43e1('0x1e')]);_0xe98ae7[_0x43e1('0x1c')]=qs[_0x43e1('0x1c')](_0xa853fe[_0x43e1('0x34')][_0x43e1('0x1c')]);}_0xe98ae7[_0x43e1('0x3c')]=qs[_0x43e1('0x3d')](_0xa853fe[_0x43e1('0x34')][_0x43e1('0x3d')]);_0xe98ae7['where']=qs[_0x43e1('0x35')](_[_0x43e1('0x3e')](_0xa853fe[_0x43e1('0x34')],_0x4def49[_0x43e1('0x35')]),_0x1e68fa);if(_0xa853fe[_0x43e1('0x34')][_0x43e1('0x3f')]){_0xe98ae7[_0x43e1('0x40')]=_[_0x43e1('0x41')](_0xe98ae7[_0x43e1('0x40')],{'$or':_[_0x43e1('0x30')](_0x1e68fa,function(_0x6a9bd6){if(_0x6a9bd6['type']!==_0x43e1('0x42')){var _0x280c17={};_0x280c17[_0x6a9bd6[_0x43e1('0x2d')]]={'$like':'%'+_0xa853fe[_0x43e1('0x34')]['filter']+'%'};return _0x280c17;}})});}_0xe98ae7=_[_0x43e1('0x41')]({},_0xe98ae7,_0xa853fe[_0x43e1('0x43')]);var _0x5074f4={'where':_0xe98ae7[_0x43e1('0x40')]};return db[_0x43e1('0x44')][_0x43e1('0x1f')](_0x5074f4)[_0x43e1('0x26')](function(_0x225ef3){_0x43c534['count']=_0x225ef3;if(_0xa853fe[_0x43e1('0x34')]['includeAll']){_0xe98ae7[_0x43e1('0x45')]=[{'all':!![]}];}return db[_0x43e1('0x44')][_0x43e1('0x46')](_0xe98ae7);})[_0x43e1('0x26')](function(_0xef2418){_0x43c534[_0x43e1('0x47')]=_0xef2418;return _0x43c534;})[_0x43e1('0x26')](respondWithFilteredResult(_0x18b850,_0xe98ae7))['catch'](handleError(_0x18b850,null));};exports['show']=function(_0x17fa08,_0x4fc07f){var _0x5637a2={'raw':!![],'where':{'id':_0x17fa08[_0x43e1('0x48')]['id']}},_0x5f1e5b={};_0x5f1e5b[_0x43e1('0x36')]=_['keys'](db[_0x43e1('0x44')][_0x43e1('0x31')]);_0x5f1e5b[_0x43e1('0x34')]=_[_0x43e1('0x49')](_0x17fa08[_0x43e1('0x34')]);_0x5f1e5b[_0x43e1('0x35')]=_['intersection'](_0x5f1e5b[_0x43e1('0x36')],_0x5f1e5b[_0x43e1('0x34')]);_0x5637a2[_0x43e1('0x37')]=_[_0x43e1('0x38')](_0x5f1e5b[_0x43e1('0x36')],qs[_0x43e1('0x39')](_0x17fa08['query'][_0x43e1('0x39')]));_0x5637a2['attributes']=_0x5637a2[_0x43e1('0x37')][_0x43e1('0x3a')]?_0x5637a2['attributes']:_0x5f1e5b['model'];if(_0x17fa08[_0x43e1('0x34')][_0x43e1('0x4a')]){_0x5637a2[_0x43e1('0x45')]=[{'all':!![]}];}_0x5637a2=_['merge']({},_0x5637a2,_0x17fa08[_0x43e1('0x43')]);return db[_0x43e1('0x44')][_0x43e1('0x4b')](_0x5637a2)[_0x43e1('0x26')](handleEntityNotFound(_0x4fc07f,null))[_0x43e1('0x26')](respondWithResult(_0x4fc07f,null))[_0x43e1('0x4c')](handleError(_0x4fc07f,null));};exports['create']=function(_0x47e34e,_0x1759a1){return db[_0x43e1('0x44')]['create'](_0x47e34e['body'],{})[_0x43e1('0x26')](function(_0x549818){var _0x5d8a2e=_0x47e34e[_0x43e1('0x4d')]['get']({'plain':!![]});if(!_0x5d8a2e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d8a2e[_0x43e1('0x4e')]===_0x43e1('0x4d')){var _0x323c24=_0x549818[_0x43e1('0x28')]({'plain':!![]});var _0x52915c=_0x43e1('0x29');return db[_0x43e1('0x4f')][_0x43e1('0x4b')]({'where':{'name':_0x52915c,'userProfileId':_0x5d8a2e['userProfileId']},'raw':!![]})['then'](function(_0xcbfec0){if(_0xcbfec0&&_0xcbfec0[_0x43e1('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x323c24[_0x43e1('0x2d')],'resourceId':_0x323c24['id'],'type':_0xcbfec0[_0x43e1('0x2d')],'sectionId':_0xcbfec0['id']},{})[_0x43e1('0x26')](function(){return _0x549818;});}else{return _0x549818;}})[_0x43e1('0x4c')](function(_0x587115){logger[_0x43e1('0x2b')](_0x43e1('0x51'),_0x587115);throw _0x587115;});}return _0x549818;})[_0x43e1('0x26')](respondWithResult(_0x1759a1,0xc9))[_0x43e1('0x4c')](handleError(_0x1759a1,null));};exports[_0x43e1('0x25')]=function(_0x577e56,_0xf564c4){if(_0x577e56['body']['id']){delete _0x577e56['body']['id'];}return db[_0x43e1('0x44')][_0x43e1('0x4b')]({'where':{'id':_0x577e56[_0x43e1('0x48')]['id']}})[_0x43e1('0x26')](handleEntityNotFound(_0xf564c4,null))[_0x43e1('0x26')](saveUpdates(_0x577e56['body'],null))[_0x43e1('0x26')](respondWithResult(_0xf564c4,null))['catch'](handleError(_0xf564c4,null));};exports['destroy']=function(_0x4895e0,_0x20e021){return db[_0x43e1('0x44')][_0x43e1('0x4b')]({'where':{'id':_0x4895e0[_0x43e1('0x48')]['id']}})[_0x43e1('0x26')](handleEntityNotFound(_0x20e021,null))[_0x43e1('0x26')](removeEntity(_0x20e021,null))[_0x43e1('0x4c')](handleError(_0x20e021,null));};exports[_0x43e1('0x52')]=function(_0x4be4c0,_0x40d497,_0x292ed1){if(_0x4be4c0['body']['id']){delete _0x4be4c0[_0x43e1('0x53')]['id'];}return db[_0x43e1('0x44')][_0x43e1('0x4b')]({'where':{'id':_0x4be4c0[_0x43e1('0x48')]['id']}})[_0x43e1('0x26')](handleEntityNotFound(_0x40d497,null))[_0x43e1('0x26')](function(_0x2f9083){if(_0x2f9083){_0x4be4c0['body']['IntervalId']=_0x2f9083['id'];return db[_0x43e1('0x44')][_0x43e1('0x54')](_0x4be4c0[_0x43e1('0x53')]);}})[_0x43e1('0x26')](respondWithResult(_0x40d497,null))[_0x43e1('0x4c')](handleError(_0x40d497,null));};exports[_0x43e1('0x55')]=function(_0x5229bf,_0x4a5ced,_0x4f8645){var _0x36ffaf={};var _0x5afcc1={};var _0x233f8c;var _0x3fca99;return db[_0x43e1('0x44')][_0x43e1('0x56')]({'where':{'id':_0x5229bf[_0x43e1('0x48')]['id']}})[_0x43e1('0x26')](handleEntityNotFound(_0x4a5ced,null))['then'](function(_0x1b5551){if(_0x1b5551){_0x233f8c=_0x1b5551;_0x5afcc1[_0x43e1('0x36')]=_['keys'](db[_0x43e1('0x44')][_0x43e1('0x31')]);_0x5afcc1[_0x43e1('0x34')]=_[_0x43e1('0x49')](_0x5229bf[_0x43e1('0x34')]);_0x5afcc1[_0x43e1('0x35')]=_[_0x43e1('0x38')](_0x5afcc1[_0x43e1('0x36')],_0x5afcc1[_0x43e1('0x34')]);_0x36ffaf[_0x43e1('0x37')]=_[_0x43e1('0x38')](_0x5afcc1[_0x43e1('0x36')],qs[_0x43e1('0x39')](_0x5229bf[_0x43e1('0x34')][_0x43e1('0x39')]));_0x36ffaf['attributes']=_0x36ffaf[_0x43e1('0x37')][_0x43e1('0x3a')]?_0x36ffaf[_0x43e1('0x37')]:_0x5afcc1[_0x43e1('0x36')];_0x36ffaf['order']=qs[_0x43e1('0x3d')](_0x5229bf[_0x43e1('0x34')][_0x43e1('0x3d')]);_0x36ffaf[_0x43e1('0x40')]=qs[_0x43e1('0x35')](_['pick'](_0x5229bf['query'],_0x5afcc1[_0x43e1('0x35')]));if(_0x5229bf[_0x43e1('0x34')][_0x43e1('0x3f')]){_0x36ffaf[_0x43e1('0x40')]=_[_0x43e1('0x41')](_0x36ffaf[_0x43e1('0x40')],{'$or':_[_0x43e1('0x30')](_0x36ffaf[_0x43e1('0x37')],function(_0x278bf5){var _0x7d371={};_0x7d371[_0x278bf5]={'$like':'%'+_0x5229bf['query']['filter']+'%'};return _0x7d371;})});}_0x36ffaf=_['merge']({},_0x36ffaf,_0x5229bf['options']);return _0x233f8c['getIntervals'](_0x36ffaf);}})[_0x43e1('0x26')](function(_0x1ff74b){if(_0x1ff74b){_0x3fca99=_0x1ff74b[_0x43e1('0x3a')];if(!_0x5229bf[_0x43e1('0x34')]['hasOwnProperty'](_0x43e1('0x3b'))){_0x36ffaf[_0x43e1('0x1e')]=qs['limit'](_0x5229bf[_0x43e1('0x34')][_0x43e1('0x1e')]);_0x36ffaf[_0x43e1('0x1c')]=qs[_0x43e1('0x1c')](_0x5229bf['query'][_0x43e1('0x1c')]);}return _0x233f8c[_0x43e1('0x55')](_0x36ffaf);}})[_0x43e1('0x26')](function(_0x40aa62){if(_0x40aa62){return _0x40aa62?{'count':_0x3fca99,'rows':_0x40aa62}:null;}})[_0x43e1('0x26')](respondWithResult(_0x4a5ced,null))[_0x43e1('0x4c')](handleError(_0x4a5ced,null));};exports[_0x43e1('0x57')]=function(_0x397d58,_0x21a93c,_0x5a76da){return db['Interval']['findOne']({'where':{'id':_0x397d58[_0x43e1('0x48')]['id']}})[_0x43e1('0x26')](handleEntityNotFound(_0x21a93c,null))[_0x43e1('0x26')](function(_0x554984){if(_0x554984){return db[_0x43e1('0x58')][_0x43e1('0x59')](function(_0x15a24f){return db['Interval'][_0x43e1('0x27')]({'where':{'IntervalId':_0x397d58[_0x43e1('0x48')]['id']},'transaction':_0x15a24f})[_0x43e1('0x26')](function(_0x414cb6){var _0xd12765=_[_0x43e1('0x30')](_0x397d58['body'],function(_0x5b0658){delete _0x5b0658['id'];_0x5b0658[_0x43e1('0x5a')]=_0x397d58[_0x43e1('0x48')]['id'];return _0x5b0658;});return db[_0x43e1('0x44')]['bulkCreate'](_0xd12765,{'transaction':_0x15a24f});});})['then'](function(){return db['Interval'][_0x43e1('0x46')]({'where':{'IntervalId':_0x397d58[_0x43e1('0x48')]['id']}});});}})['then'](respondWithResult(_0x21a93c,null))['catch'](handleError(_0x21a93c,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index c6b3810..3935e10 100644 --- a/server/api/interval/interval.model.js +++ b/server/api/interval/interval.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadea=['api','moment','bluebird','request-promise','path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger'];(function(_0x139b0a,_0x1f5544){var _0x2ff357=function(_0x3cb065){while(--_0x3cb065){_0x139b0a['push'](_0x139b0a['shift']());}};_0x2ff357(++_0x1f5544);}(_0xadea,0xad));var _0xaade=function(_0x2d7836,_0x5a5412){_0x2d7836=_0x2d7836-0x0;var _0x491179=_0xadea[_0x2d7836];return _0x491179;};'use strict';var _=require(_0xaade('0x0'));var util=require(_0xaade('0x1'));var logger=require(_0xaade('0x2'))(_0xaade('0x3'));var moment=require(_0xaade('0x4'));var BPromise=require(_0xaade('0x5'));var rp=require(_0xaade('0x6'));var fs=require('fs');var path=require(_0xaade('0x7'));var rimraf=require(_0xaade('0x8'));var config=require('../../config/environment');var attributes=require(_0xaade('0x9'));var extensions=require(_0xaade('0xa'));module[_0xaade('0xb')]=function(_0x2eb891,_0x1b9639){return _0x2eb891[_0xaade('0xc')](_0xaade('0xd'),attributes,{'tableName':_0xaade('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x472055,_0x5b35a1){extensions[_0xaade('0xf')](_0x2eb891,_0x472055);},'afterBulkCreate':function(_0xa61137,_0x288d59,_0x82cf98){_0x82cf98();extensions['rewrite'](_0x2eb891,_0xa61137[0x0]);},'afterUpdate':function(_0x1715d5,_0x3fa01b){extensions[_0xaade('0xf')](_0x2eb891,_0x1715d5);},'afterDestroy':function(_0x429cdc,_0x37d79d){extensions[_0xaade('0xf')](_0x2eb891,_0x429cdc);}}});}; \ No newline at end of file +var _0x534e=['request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define','rewrite','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x27c581,_0x32a779){var _0xf94f08=function(_0x56c34a){while(--_0x56c34a){_0x27c581['push'](_0x27c581['shift']());}};_0xf94f08(++_0x32a779);}(_0x534e,0x1c8));var _0xe534=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x534e[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0xe534('0x0'));var util=require(_0xe534('0x1'));var logger=require(_0xe534('0x2'))(_0xe534('0x3'));var moment=require(_0xe534('0x4'));var BPromise=require(_0xe534('0x5'));var rp=require(_0xe534('0x6'));var fs=require('fs');var path=require(_0xe534('0x7'));var rimraf=require(_0xe534('0x8'));var config=require(_0xe534('0x9'));var attributes=require('./interval.attributes');var extensions=require(_0xe534('0xa'));module[_0xe534('0xb')]=function(_0x37cccd,_0x5e71b1){return _0x37cccd[_0xe534('0xc')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3aa940,_0x3a5874){extensions['rewrite'](_0x37cccd,_0x3aa940);},'afterBulkCreate':function(_0x3a1fc0,_0x57048c,_0x37d451){_0x37d451();extensions[_0xe534('0xd')](_0x37cccd,_0x3a1fc0[0x0]);},'afterUpdate':function(_0x1b4c5d,_0x4a39c5){extensions[_0xe534('0xd')](_0x37cccd,_0x1b4c5d);},'afterDestroy':function(_0x303d91,_0x1714c9){extensions['rewrite'](_0x37cccd,_0x303d91);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5512409..a639988 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x5c768b,_0x5e88a6){var _0x335af8=function(_0x39b04f){while(--_0x39b04f){_0x5c768b['push'](_0x5c768b['shift']());}};_0x335af8(++_0x5e88a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 9982a60..63cf475 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x2c6075,_0x50c95b){var _0x1ec271=function(_0x4507a6){while(--_0x4507a6){_0x2c6075['push'](_0x2c6075['shift']());}};_0x1ec271(++_0x50c95b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1a1108,_0x126d3c){_0x1a1108=_0x1a1108-0x0;var _0x43bf22=_0x5f2f[_0x1a1108];return _0x43bf22;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x1fea01,_0x59ec97){var _0x45de5d=function(_0x1747bb){while(--_0x1747bb){_0x1fea01['push'](_0x1fea01['shift']());}};_0x45de5d(++_0x59ec97);}(_0xadb5,0xad));var _0x5adb=function(_0xb33b37,_0x9ef33a){_0xb33b37=_0xb33b37-0x0;var _0x402dd4=_0xadb5[_0xb33b37];return _0x402dd4;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index f571b6e..8f606e5 100644 --- a/server/api/jira/jira.controller.js +++ b/server/api/jira/jira.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9952=['customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','POST','toString','base64','request','setEncoding','utf8','data','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','api','key','MOTGUI','summary','description','stringify','issuetype','fields','customfield_11500','email'];(function(_0xb34af0,_0xebc6a4){var _0x4d7146=function(_0x59bc8c){while(--_0x59bc8c){_0xb34af0['push'](_0xb34af0['shift']());}};_0x4d7146(++_0xebc6a4);}(_0x9952,0x184));var _0x2995=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0x9952[_0x7275e9];return _0x17b99d;};'use strict';var BPromise=require(_0x2995('0x0'));var https=require(_0x2995('0x1'));var logger=require('../../config/logger')(_0x2995('0x2'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x3461a3,_0x123c9f){var _0x2ce9c1={'fields':{'project':{'key':_0x3461a3[_0x2995('0x3')]||_0x2995('0x4')},'summary':(_0x3461a3[_0x2995('0x5')]||'Report')+'\x20from\x20'+_0x3461a3['ip'],'description':_0x3461a3[_0x2995('0x6')]||JSON[_0x2995('0x7')](_0x3461a3),'issuetype':{'name':_0x3461a3[_0x2995('0x8')]||'Bug'}}};_0x2ce9c1[_0x2995('0x9')][_0x2995('0xa')]=_0x3461a3[_0x2995('0xb')];_0x2ce9c1[_0x2995('0x9')][_0x2995('0xc')]=_0x3461a3[_0x2995('0xd')];_0x2ce9c1[_0x2995('0x9')][_0x2995('0xe')]=_0x3461a3[_0x2995('0xf')];_0x2ce9c1['fields'][_0x2995('0x10')]=_0x3461a3[_0x2995('0x11')];_0x2ce9c1[_0x2995('0x9')]['customfield_11504']=_0x3461a3['reason'];_0x2ce9c1[_0x2995('0x9')][_0x2995('0x12')]=_0x3461a3['ip'];var _0x414d84={'host':_0x2995('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x2995('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x2995('0x15')](_0x2995('0x16'))}};var _0x17e14a=JSON[_0x2995('0x7')](_0x2ce9c1);var _0x2b9117=https[_0x2995('0x17')](_0x414d84,function(_0x25a2e4){_0x25a2e4[_0x2995('0x18')](_0x2995('0x19'));var _0x18309a='';_0x25a2e4['on'](_0x2995('0x1a'),function(_0x26a9a1){_0x18309a+=_0x26a9a1;});_0x25a2e4['on']('end',function(){if(_0x123c9f){return _0x123c9f[_0x2995('0x1b')](_0x25a2e4[_0x2995('0x1c')])[_0x2995('0x1d')](JSON[_0x2995('0x1e')](_0x18309a));}});});_0x2b9117['on']('error',function(_0xcb0952){if(_0x123c9f){return _0x123c9f[_0x2995('0x1b')](0x1f4)[_0x2995('0x1d')]({'errors':[{'message':_0x2995('0x1f'),'type':_0x2995('0x20')}]});}});_0x2b9117[_0x2995('0x21')](_0x17e14a);_0x2b9117['end']();}exports['openIssue']=openIssue;exports[_0x2995('0x22')]=function(_0x56ba03,_0x365f95){_0x56ba03['body']['ip']=_0x56ba03[_0x2995('0x23')][_0x2995('0x24')]||_0x56ba03['connection'][_0x2995('0x25')]||_0x56ba03[_0x2995('0x26')]['remoteAddress']||_0x56ba03[_0x2995('0x27')][_0x2995('0x26')][_0x2995('0x25')];return openIssue(_0x56ba03['body'],_0x365f95);}; \ No newline at end of file +var _0xee8c=['status','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','3eAmWpBVP0','key','summary','Report','description','issuetype','customfield_11500','email','fields','customfield_11501','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','stringify','request','setEncoding','utf8','data','end'];(function(_0x503790,_0x525c78){var _0x388092=function(_0x2ab2b8){while(--_0x2ab2b8){_0x503790['push'](_0x503790['shift']());}};_0x388092(++_0x525c78);}(_0xee8c,0xb0));var _0xcee8=function(_0x2697a7,_0x36d1e3){_0x2697a7=_0x2697a7-0x0;var _0x18b624=_0xee8c[_0x2697a7];return _0x18b624;};'use strict';var BPromise=require('bluebird');var https=require(_0xcee8('0x0'));var logger=require(_0xcee8('0x1'))(_0xcee8('0x2'));var USERNAME='support';var PASSWORD=_0xcee8('0x3');function openIssue(_0x46cae6,_0x228b1f){var _0x4b7528={'fields':{'project':{'key':_0x46cae6[_0xcee8('0x4')]||'MOTGUI'},'summary':(_0x46cae6[_0xcee8('0x5')]||_0xcee8('0x6'))+'\x20from\x20'+_0x46cae6['ip'],'description':_0x46cae6[_0xcee8('0x7')]||JSON['stringify'](_0x46cae6),'issuetype':{'name':_0x46cae6[_0xcee8('0x8')]||'Bug'}}};_0x4b7528['fields'][_0xcee8('0x9')]=_0x46cae6[_0xcee8('0xa')];_0x4b7528[_0xcee8('0xb')][_0xcee8('0xc')]=_0x46cae6['oldToken'];_0x4b7528['fields'][_0xcee8('0xd')]=_0x46cae6[_0xcee8('0xe')];_0x4b7528[_0xcee8('0xb')][_0xcee8('0xf')]=_0x46cae6['name'];_0x4b7528[_0xcee8('0xb')][_0xcee8('0x10')]=_0x46cae6[_0xcee8('0x11')];_0x4b7528[_0xcee8('0xb')][_0xcee8('0x12')]=_0x46cae6['ip'];var _0x37b48a={'host':_0xcee8('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xcee8('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xcee8('0x15'),'Authorization':_0xcee8('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x2631af=JSON[_0xcee8('0x17')](_0x4b7528);var _0x142dc0=https[_0xcee8('0x18')](_0x37b48a,function(_0x4d34c5){_0x4d34c5[_0xcee8('0x19')](_0xcee8('0x1a'));var _0x1c50a6='';_0x4d34c5['on'](_0xcee8('0x1b'),function(_0x40b2e7){_0x1c50a6+=_0x40b2e7;});_0x4d34c5['on'](_0xcee8('0x1c'),function(){if(_0x228b1f){return _0x228b1f[_0xcee8('0x1d')](_0x4d34c5['statusCode'])['json'](JSON['parse'](_0x1c50a6));}});});_0x142dc0['on'](_0xcee8('0x1e'),function(_0x11fa32){if(_0x228b1f){return _0x228b1f[_0xcee8('0x1d')](0x1f4)[_0xcee8('0x1f')]({'errors':[{'message':_0xcee8('0x20'),'type':_0xcee8('0x21')}]});}});_0x142dc0['write'](_0x2631af);_0x142dc0[_0xcee8('0x1c')]();}exports[_0xcee8('0x22')]=openIssue;exports['send']=function(_0x3a09b6,_0xd739de){_0x3a09b6[_0xcee8('0x23')]['ip']=_0x3a09b6[_0xcee8('0x24')][_0xcee8('0x25')]||_0x3a09b6[_0xcee8('0x26')][_0xcee8('0x27')]||_0x3a09b6[_0xcee8('0x28')][_0xcee8('0x27')]||_0x3a09b6[_0xcee8('0x26')][_0xcee8('0x28')][_0xcee8('0x27')];return openIssue(_0x3a09b6[_0xcee8('0x23')],_0xd739de);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index cbe9a19..2da8cad 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','util','connect-timeout','Router'];(function(_0x59e01c,_0x1b1c1a){var _0x23fa77=function(_0x2021dd){while(--_0x2021dd){_0x59e01c['push'](_0x59e01c['shift']());}};_0x23fa77(++_0x1b1c1a);}(_0x9bde,0xe1));var _0xe9bd=function(_0xadfe9e,_0x2e6351){_0xadfe9e=_0xadfe9e-0x0;var _0x5e8c6c=_0x9bde[_0xadfe9e];return _0x5e8c6c;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe9bd('0x10')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x11')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9bde=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','util','connect-timeout','Router'];(function(_0x142233,_0x3a4cec){var _0x33017a=function(_0x368f38){while(--_0x368f38){_0x142233['push'](_0x142233['shift']());}};_0x33017a(++_0x3a4cec);}(_0x9bde,0xe1));var _0xe9bd=function(_0xb8b50,_0x9304f3){_0xb8b50=_0xb8b50-0x0;var _0x52ec84=_0x9bde[_0xb8b50];return _0x52ec84;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe9bd('0x10')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x11')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 482dd67..82ef384 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x2d0986,_0x2b3276){_0x2d0986=_0x2d0986-0x0;var _0x298551=_0x7a54[_0x2d0986];return _0x298551;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x35ba50,_0x4d4411){_0x35ba50=_0x35ba50-0x0;var _0x1de1e1=_0x7a54[_0x35ba50];return _0x1de1e1;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 5034072..8287c5e 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef17=['key','map','intersection','model','attributes','fields','length','query','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','offset','json','apply','reject','save','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName'];(function(_0x29707a,_0xcbc0cf){var _0x108e41=function(_0x523021){while(--_0x523021){_0x29707a['push'](_0x29707a['shift']());}};_0x108e41(++_0xcbc0cf);}(_0xef17,0x136));var _0x7ef1=function(_0x2f8923,_0x5ccb5f){_0x2f8923=_0x2f8923-0x0;var _0x337af5=_0xef17[_0x2f8923];return _0x337af5;};'use strict';var emlformat=require(_0x7ef1('0x0'));var rimraf=require(_0x7ef1('0x1'));var zipdir=require(_0x7ef1('0x2'));var jsonpatch=require(_0x7ef1('0x3'));var rp=require(_0x7ef1('0x4'));var moment=require(_0x7ef1('0x5'));var BPromise=require(_0x7ef1('0x6'));var Mustache=require(_0x7ef1('0x7'));var util=require(_0x7ef1('0x8'));var path=require('path');var sox=require(_0x7ef1('0x9'));var csv=require('to-csv');var ejs=require(_0x7ef1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ef1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ef1('0xc'));var deskjs=require(_0x7ef1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7ef1('0xe'));var Papa=require(_0x7ef1('0xf'));var Redis=require(_0x7ef1('0x10'));var authService=require(_0x7ef1('0x11'));var qs=require(_0x7ef1('0x12'));var as=require(_0x7ef1('0x13'));var hardwareService=require(_0x7ef1('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7ef1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x122c8a,_0x51e226){_0x51e226=_0x51e226||0xcc;return function(_0x36ddf9){if(_0x36ddf9){return _0x122c8a[_0x7ef1('0x16')](_0x51e226);}return _0x122c8a[_0x7ef1('0x17')](_0x51e226)[_0x7ef1('0x18')]();};}function respondWithResult(_0x39ea9c,_0x317125){_0x317125=_0x317125||0xc8;return function(_0x26e9fb){if(_0x26e9fb){return _0x39ea9c[_0x7ef1('0x17')](_0x317125)['json'](_0x26e9fb);}};}function respondWithFilteredResult(_0x4de80f,_0x267f0e){return function(_0x5d0499){if(_0x5d0499){var _0x20b843=typeof _0x267f0e[_0x7ef1('0x19')]==='undefined'&&typeof _0x267f0e['limit']==='undefined';var _0x300645=_0x5d0499['count'];var _0x3a5835=_0x20b843?0x0:_0x267f0e['offset'];var _0x5a7b2b=_0x20b843?_0x5d0499['count']:_0x267f0e[_0x7ef1('0x19')]+_0x267f0e['limit'];var _0x38c5a7;if(_0x5a7b2b>=_0x300645){_0x5a7b2b=_0x300645;_0x38c5a7=0xc8;}else{_0x38c5a7=0xce;}_0x4de80f[_0x7ef1('0x17')](_0x38c5a7);return _0x4de80f['set']('Content-Range',_0x3a5835+'-'+_0x5a7b2b+'/'+_0x300645)[_0x7ef1('0x1a')](_0x5d0499);}return null;};}function patchUpdates(_0x5490b9){return function(_0x458459){try{jsonpatch[_0x7ef1('0x1b')](_0x458459,_0x5490b9,!![]);}catch(_0x2f8164){return BPromise[_0x7ef1('0x1c')](_0x2f8164);}return _0x458459[_0x7ef1('0x1d')]();};}function saveUpdates(_0xf24942,_0x20887b){return function(_0xd71594){if(_0xd71594){return _0xd71594['update'](_0xf24942)[_0x7ef1('0x1e')](function(_0x3b118f){return _0x3b118f;});}return null;};}function removeEntity(_0x3f26fb,_0x3324d4){return function(_0x31b5bf){if(_0x31b5bf){return _0x31b5bf[_0x7ef1('0x1f')]()[_0x7ef1('0x1e')](function(){_0x3f26fb[_0x7ef1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1ace,_0x33e008){return function(_0x12ef5a){if(!_0x12ef5a){_0x4b1ace[_0x7ef1('0x16')](0x194);}return _0x12ef5a;};}function handleError(_0xcfce5e,_0x19c2c2){_0x19c2c2=_0x19c2c2||0x1f4;return function(_0x4cfa16){logger[_0x7ef1('0x20')](_0x4cfa16[_0x7ef1('0x21')]);if(_0x4cfa16[_0x7ef1('0x22')]){delete _0x4cfa16[_0x7ef1('0x22')];}_0xcfce5e[_0x7ef1('0x17')](_0x19c2c2)[_0x7ef1('0x23')](_0x4cfa16);};}exports[_0x7ef1('0x24')]=function(_0x58e7ee,_0x2e8f1b){var _0x4b0380={},_0x3306b0={},_0x2546bf={'count':0x0,'rows':[]};var _0x4b5fde=_['map'](db[_0x7ef1('0x25')][_0x7ef1('0x26')],function(_0x5ab3a5){return{'name':_0x5ab3a5[_0x7ef1('0x27')],'type':_0x5ab3a5['type'][_0x7ef1('0x28')]};});_0x3306b0['model']=_[_0x7ef1('0x29')](_0x4b5fde,_0x7ef1('0x22'));_0x3306b0['query']=_['keys'](_0x58e7ee['query']);_0x3306b0['filters']=_[_0x7ef1('0x2a')](_0x3306b0[_0x7ef1('0x2b')],_0x3306b0['query']);_0x4b0380[_0x7ef1('0x2c')]=_['intersection'](_0x3306b0['model'],qs[_0x7ef1('0x2d')](_0x58e7ee['query'][_0x7ef1('0x2d')]));_0x4b0380[_0x7ef1('0x2c')]=_0x4b0380[_0x7ef1('0x2c')][_0x7ef1('0x2e')]?_0x4b0380['attributes']:_0x3306b0[_0x7ef1('0x2b')];if(!_0x58e7ee[_0x7ef1('0x2f')]['hasOwnProperty']('nolimit')){_0x4b0380['limit']=qs['limit'](_0x58e7ee[_0x7ef1('0x2f')]['limit']);_0x4b0380[_0x7ef1('0x19')]=qs[_0x7ef1('0x19')](_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x19')]);}_0x4b0380[_0x7ef1('0x30')]=qs[_0x7ef1('0x31')](_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x31')]);_0x4b0380[_0x7ef1('0x32')]=qs[_0x7ef1('0x33')](_[_0x7ef1('0x34')](_0x58e7ee['query'],_0x3306b0[_0x7ef1('0x33')]),_0x4b5fde);if(_0x58e7ee[_0x7ef1('0x2f')]['filter']){_0x4b0380[_0x7ef1('0x32')]=_[_0x7ef1('0x35')](_0x4b0380[_0x7ef1('0x32')],{'$or':_[_0x7ef1('0x29')](_0x4b5fde,function(_0x8ef5b3){if(_0x8ef5b3['type']!==_0x7ef1('0x36')){var _0x1ccbfb={};_0x1ccbfb[_0x8ef5b3[_0x7ef1('0x22')]]={'$like':'%'+_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x37')]+'%'};return _0x1ccbfb;}})});}_0x4b0380=_[_0x7ef1('0x35')]({},_0x4b0380,_0x58e7ee[_0x7ef1('0x38')]);var _0x238aa7={'where':_0x4b0380[_0x7ef1('0x32')]};return db[_0x7ef1('0x25')][_0x7ef1('0x39')](_0x238aa7)[_0x7ef1('0x1e')](function(_0x2da912){_0x2546bf[_0x7ef1('0x39')]=_0x2da912;if(_0x58e7ee[_0x7ef1('0x2f')]['includeAll']){_0x4b0380[_0x7ef1('0x3a')]=[{'all':!![]}];}return db[_0x7ef1('0x25')][_0x7ef1('0x3b')](_0x4b0380);})[_0x7ef1('0x1e')](function(_0x3889d7){_0x2546bf[_0x7ef1('0x3c')]=_0x3889d7;return _0x2546bf;})[_0x7ef1('0x1e')](respondWithFilteredResult(_0x2e8f1b,_0x4b0380))[_0x7ef1('0x3d')](handleError(_0x2e8f1b,null));};exports[_0x7ef1('0x3e')]=function(_0x1cff0b,_0x3e5ecd){var _0x374bf5={'raw':!![],'where':{'id':_0x1cff0b['params']['id']}},_0x2fb6c4={};_0x2fb6c4[_0x7ef1('0x2b')]=_[_0x7ef1('0x3f')](db[_0x7ef1('0x25')][_0x7ef1('0x26')]);_0x2fb6c4[_0x7ef1('0x2f')]=_[_0x7ef1('0x3f')](_0x1cff0b['query']);_0x2fb6c4[_0x7ef1('0x33')]=_[_0x7ef1('0x2a')](_0x2fb6c4[_0x7ef1('0x2b')],_0x2fb6c4[_0x7ef1('0x2f')]);_0x374bf5[_0x7ef1('0x2c')]=_[_0x7ef1('0x2a')](_0x2fb6c4['model'],qs[_0x7ef1('0x2d')](_0x1cff0b[_0x7ef1('0x2f')][_0x7ef1('0x2d')]));_0x374bf5[_0x7ef1('0x2c')]=_0x374bf5['attributes'][_0x7ef1('0x2e')]?_0x374bf5['attributes']:_0x2fb6c4['model'];if(_0x1cff0b[_0x7ef1('0x2f')]['includeAll']){_0x374bf5[_0x7ef1('0x3a')]=[{'all':!![]}];}_0x374bf5=_['merge']({},_0x374bf5,_0x1cff0b[_0x7ef1('0x38')]);return db[_0x7ef1('0x25')][_0x7ef1('0x40')](_0x374bf5)[_0x7ef1('0x1e')](handleEntityNotFound(_0x3e5ecd,null))[_0x7ef1('0x1e')](respondWithResult(_0x3e5ecd,null))[_0x7ef1('0x3d')](handleError(_0x3e5ecd,null));};exports[_0x7ef1('0x41')]=function(_0x106096,_0x49e089){return db['JscriptyAnswerReport'][_0x7ef1('0x41')](_0x106096[_0x7ef1('0x42')],{})['then'](respondWithResult(_0x49e089,0xc9))[_0x7ef1('0x3d')](handleError(_0x49e089,null));};exports[_0x7ef1('0x43')]=function(_0xd06ca9,_0x5ce876){if(_0xd06ca9['body']['id']){delete _0xd06ca9[_0x7ef1('0x42')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0xd06ca9[_0x7ef1('0x44')]['id']}})[_0x7ef1('0x1e')](handleEntityNotFound(_0x5ce876,null))[_0x7ef1('0x1e')](saveUpdates(_0xd06ca9[_0x7ef1('0x42')],null))[_0x7ef1('0x1e')](respondWithResult(_0x5ce876,null))['catch'](handleError(_0x5ce876,null));};exports[_0x7ef1('0x1f')]=function(_0x4e425b,_0x350dde){return db['JscriptyAnswerReport'][_0x7ef1('0x40')]({'where':{'id':_0x4e425b['params']['id']}})['then'](handleEntityNotFound(_0x350dde,null))[_0x7ef1('0x1e')](removeEntity(_0x350dde,null))['catch'](handleError(_0x350dde,null));};exports[_0x7ef1('0x45')]=function(_0x30a4ce,_0x54a0bb){return db[_0x7ef1('0x25')][_0x7ef1('0x45')]()[_0x7ef1('0x1e')](respondWithResult(_0x54a0bb,null))['catch'](handleError(_0x54a0bb,null));}; \ No newline at end of file +var _0x41ec=['merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','JscriptyAnswerReport','include','create','body','find','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x1c20bc,_0xfad293){var _0x1f2917=function(_0x36f9ab){while(--_0x36f9ab){_0x1c20bc['push'](_0x1c20bc['shift']());}};_0x1f2917(++_0xfad293);}(_0x41ec,0x143));var _0xc41e=function(_0x2a0f64,_0x5520a6){_0x2a0f64=_0x2a0f64-0x0;var _0x2a1c1f=_0x41ec[_0x2a0f64];return _0x2a1c1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc41e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc41e('0x1'));var rp=require(_0xc41e('0x2'));var moment=require('moment');var BPromise=require(_0xc41e('0x3'));var Mustache=require(_0xc41e('0x4'));var util=require(_0xc41e('0x5'));var path=require(_0xc41e('0x6'));var sox=require(_0xc41e('0x7'));var csv=require(_0xc41e('0x8'));var ejs=require(_0xc41e('0x9'));var fs=require('fs');var fs_extra=require(_0xc41e('0xa'));var _=require(_0xc41e('0xb'));var squel=require(_0xc41e('0xc'));var crypto=require(_0xc41e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc41e('0xe'));var toCsv=require(_0xc41e('0x8'));var querystring=require(_0xc41e('0xf'));var Papa=require(_0xc41e('0x10'));var Redis=require(_0xc41e('0x11'));var authService=require(_0xc41e('0x12'));var qs=require(_0xc41e('0x13'));var as=require(_0xc41e('0x14'));var hardwareService=require(_0xc41e('0x15'));var logger=require(_0xc41e('0x16'))(_0xc41e('0x17'));var utils=require('../../config/utils');var config=require(_0xc41e('0x18'));var licenseUtil=require(_0xc41e('0x19'));var db=require(_0xc41e('0x1a'))['db'];function respondWithStatusCode(_0x3d7280,_0x11a117){_0x11a117=_0x11a117||0xcc;return function(_0x433ca9){if(_0x433ca9){return _0x3d7280[_0xc41e('0x1b')](_0x11a117);}return _0x3d7280[_0xc41e('0x1c')](_0x11a117)['end']();};}function respondWithResult(_0x3b3900,_0x6b614a){_0x6b614a=_0x6b614a||0xc8;return function(_0xcd58a0){if(_0xcd58a0){return _0x3b3900[_0xc41e('0x1c')](_0x6b614a)['json'](_0xcd58a0);}};}function respondWithFilteredResult(_0x5c705e,_0x4f960d){return function(_0x28eb53){if(_0x28eb53){var _0x4293a5=typeof _0x4f960d['offset']===_0xc41e('0x1d')&&typeof _0x4f960d[_0xc41e('0x1e')]==='undefined';var _0x4e7aa3=_0x28eb53[_0xc41e('0x1f')];var _0x5c0517=_0x4293a5?0x0:_0x4f960d[_0xc41e('0x20')];var _0x23c9b6=_0x4293a5?_0x28eb53['count']:_0x4f960d[_0xc41e('0x20')]+_0x4f960d[_0xc41e('0x1e')];var _0xee0f01;if(_0x23c9b6>=_0x4e7aa3){_0x23c9b6=_0x4e7aa3;_0xee0f01=0xc8;}else{_0xee0f01=0xce;}_0x5c705e[_0xc41e('0x1c')](_0xee0f01);return _0x5c705e[_0xc41e('0x21')](_0xc41e('0x22'),_0x5c0517+'-'+_0x23c9b6+'/'+_0x4e7aa3)[_0xc41e('0x23')](_0x28eb53);}return null;};}function patchUpdates(_0x57e0c4){return function(_0x239c25){try{jsonpatch[_0xc41e('0x24')](_0x239c25,_0x57e0c4,!![]);}catch(_0x3f26d5){return BPromise['reject'](_0x3f26d5);}return _0x239c25[_0xc41e('0x25')]();};}function saveUpdates(_0x408d27,_0x814a72){return function(_0x490cc3){if(_0x490cc3){return _0x490cc3[_0xc41e('0x26')](_0x408d27)[_0xc41e('0x27')](function(_0x602bd7){return _0x602bd7;});}return null;};}function removeEntity(_0x4adaad,_0x5a06dd){return function(_0x4c20b1){if(_0x4c20b1){return _0x4c20b1[_0xc41e('0x28')]()[_0xc41e('0x27')](function(){_0x4adaad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a3e0d,_0x1c33a6){return function(_0x1ad4c7){if(!_0x1ad4c7){_0x5a3e0d[_0xc41e('0x1b')](0x194);}return _0x1ad4c7;};}function handleError(_0x467672,_0x1c6a2a){_0x1c6a2a=_0x1c6a2a||0x1f4;return function(_0x580b9e){logger[_0xc41e('0x29')](_0x580b9e[_0xc41e('0x2a')]);if(_0x580b9e[_0xc41e('0x2b')]){delete _0x580b9e['name'];}_0x467672[_0xc41e('0x1c')](_0x1c6a2a)[_0xc41e('0x2c')](_0x580b9e);};}exports['index']=function(_0x25b319,_0x12536e){var _0x5c2c62={},_0xcb3a15={},_0x2fa98a={'count':0x0,'rows':[]};var _0x17246e=_[_0xc41e('0x2d')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x541ac4){return{'name':_0x541ac4[_0xc41e('0x2e')],'type':_0x541ac4[_0xc41e('0x2f')][_0xc41e('0x30')]};});_0xcb3a15[_0xc41e('0x31')]=_[_0xc41e('0x2d')](_0x17246e,_0xc41e('0x2b'));_0xcb3a15[_0xc41e('0x32')]=_['keys'](_0x25b319[_0xc41e('0x32')]);_0xcb3a15[_0xc41e('0x33')]=_[_0xc41e('0x34')](_0xcb3a15['model'],_0xcb3a15[_0xc41e('0x32')]);_0x5c2c62['attributes']=_[_0xc41e('0x34')](_0xcb3a15[_0xc41e('0x31')],qs[_0xc41e('0x35')](_0x25b319[_0xc41e('0x32')]['fields']));_0x5c2c62['attributes']=_0x5c2c62[_0xc41e('0x36')][_0xc41e('0x37')]?_0x5c2c62[_0xc41e('0x36')]:_0xcb3a15[_0xc41e('0x31')];if(!_0x25b319[_0xc41e('0x32')][_0xc41e('0x38')]('nolimit')){_0x5c2c62[_0xc41e('0x1e')]=qs[_0xc41e('0x1e')](_0x25b319[_0xc41e('0x32')]['limit']);_0x5c2c62[_0xc41e('0x20')]=qs[_0xc41e('0x20')](_0x25b319['query'][_0xc41e('0x20')]);}_0x5c2c62[_0xc41e('0x39')]=qs[_0xc41e('0x3a')](_0x25b319[_0xc41e('0x32')][_0xc41e('0x3a')]);_0x5c2c62['where']=qs['filters'](_[_0xc41e('0x3b')](_0x25b319[_0xc41e('0x32')],_0xcb3a15[_0xc41e('0x33')]),_0x17246e);if(_0x25b319[_0xc41e('0x32')][_0xc41e('0x3c')]){_0x5c2c62[_0xc41e('0x3d')]=_[_0xc41e('0x3e')](_0x5c2c62[_0xc41e('0x3d')],{'$or':_[_0xc41e('0x2d')](_0x17246e,function(_0x4de59a){if(_0x4de59a['type']!==_0xc41e('0x3f')){var _0xfd6ff6={};_0xfd6ff6[_0x4de59a[_0xc41e('0x2b')]]={'$like':'%'+_0x25b319[_0xc41e('0x32')][_0xc41e('0x3c')]+'%'};return _0xfd6ff6;}})});}_0x5c2c62=_[_0xc41e('0x3e')]({},_0x5c2c62,_0x25b319[_0xc41e('0x40')]);var _0x150f30={'where':_0x5c2c62['where']};return db['JscriptyAnswerReport'][_0xc41e('0x1f')](_0x150f30)[_0xc41e('0x27')](function(_0x10cfed){_0x2fa98a['count']=_0x10cfed;if(_0x25b319['query'][_0xc41e('0x41')]){_0x5c2c62['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x5c2c62);})['then'](function(_0x3c30e2){_0x2fa98a[_0xc41e('0x42')]=_0x3c30e2;return _0x2fa98a;})[_0xc41e('0x27')](respondWithFilteredResult(_0x12536e,_0x5c2c62))[_0xc41e('0x43')](handleError(_0x12536e,null));};exports[_0xc41e('0x44')]=function(_0x206aa1,_0x4bb1f6){var _0x28d15d={'raw':!![],'where':{'id':_0x206aa1[_0xc41e('0x45')]['id']}},_0x1a3e67={};_0x1a3e67[_0xc41e('0x31')]=_[_0xc41e('0x46')](db[_0xc41e('0x47')]['rawAttributes']);_0x1a3e67[_0xc41e('0x32')]=_[_0xc41e('0x46')](_0x206aa1['query']);_0x1a3e67[_0xc41e('0x33')]=_[_0xc41e('0x34')](_0x1a3e67['model'],_0x1a3e67[_0xc41e('0x32')]);_0x28d15d['attributes']=_[_0xc41e('0x34')](_0x1a3e67[_0xc41e('0x31')],qs[_0xc41e('0x35')](_0x206aa1['query'][_0xc41e('0x35')]));_0x28d15d[_0xc41e('0x36')]=_0x28d15d['attributes']['length']?_0x28d15d['attributes']:_0x1a3e67['model'];if(_0x206aa1[_0xc41e('0x32')]['includeAll']){_0x28d15d[_0xc41e('0x48')]=[{'all':!![]}];}_0x28d15d=_['merge']({},_0x28d15d,_0x206aa1['options']);return db[_0xc41e('0x47')]['find'](_0x28d15d)[_0xc41e('0x27')](handleEntityNotFound(_0x4bb1f6,null))[_0xc41e('0x27')](respondWithResult(_0x4bb1f6,null))[_0xc41e('0x43')](handleError(_0x4bb1f6,null));};exports[_0xc41e('0x49')]=function(_0x46aef6,_0x31b393){return db[_0xc41e('0x47')][_0xc41e('0x49')](_0x46aef6[_0xc41e('0x4a')],{})[_0xc41e('0x27')](respondWithResult(_0x31b393,0xc9))[_0xc41e('0x43')](handleError(_0x31b393,null));};exports['update']=function(_0x4b67d4,_0x1cdf49){if(_0x4b67d4[_0xc41e('0x4a')]['id']){delete _0x4b67d4[_0xc41e('0x4a')]['id'];}return db['JscriptyAnswerReport'][_0xc41e('0x4b')]({'where':{'id':_0x4b67d4[_0xc41e('0x45')]['id']}})[_0xc41e('0x27')](handleEntityNotFound(_0x1cdf49,null))[_0xc41e('0x27')](saveUpdates(_0x4b67d4[_0xc41e('0x4a')],null))[_0xc41e('0x27')](respondWithResult(_0x1cdf49,null))[_0xc41e('0x43')](handleError(_0x1cdf49,null));};exports['destroy']=function(_0x3c867a,_0x317eba){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x3c867a[_0xc41e('0x45')]['id']}})[_0xc41e('0x27')](handleEntityNotFound(_0x317eba,null))[_0xc41e('0x27')](removeEntity(_0x317eba,null))[_0xc41e('0x43')](handleError(_0x317eba,null));};exports[_0xc41e('0x4c')]=function(_0x53a799,_0x576831){return db[_0xc41e('0x47')]['describe']()[_0xc41e('0x27')](respondWithResult(_0x576831,null))['catch'](handleError(_0x576831,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index fbd18af..b320056 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7100=['lodash','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport'];(function(_0x57c87e,_0x2413fe){var _0x10fde1=function(_0x39aaeb){while(--_0x39aaeb){_0x57c87e['push'](_0x57c87e['shift']());}};_0x10fde1(++_0x2413fe);}(_0x7100,0x19d));var _0x0710=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x7100[_0x30faec];return _0x29484f;};'use strict';var _=require(_0x0710('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0710('0x1'));var rimraf=require(_0x0710('0x2'));var config=require(_0x0710('0x3'));var attributes=require(_0x0710('0x4'));module[_0x0710('0x5')]=function(_0x58e1bd,_0x4188d3){return _0x58e1bd['define'](_0x0710('0x6'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x728e=['./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3fa4bd,_0x14a72d){var _0x358c95=function(_0x55c7fc){while(--_0x55c7fc){_0x3fa4bd['push'](_0x3fa4bd['shift']());}};_0x358c95(++_0x14a72d);}(_0x728e,0x18b));var _0xe728=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x728e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe728('0x0'));var util=require(_0xe728('0x1'));var logger=require(_0xe728('0x2'))(_0xe728('0x3'));var moment=require(_0xe728('0x4'));var BPromise=require(_0xe728('0x5'));var rp=require(_0xe728('0x6'));var fs=require('fs');var path=require(_0xe728('0x7'));var rimraf=require(_0xe728('0x8'));var config=require(_0xe728('0x9'));var attributes=require(_0xe728('0xa'));module[_0xe728('0xb')]=function(_0x4c68f7,_0x224436){return _0x4c68f7[_0xe728('0xc')](_0xe728('0xd'),attributes,{'tableName':_0xe728('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index ac73eb9..648876e 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf558=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xf558,0x1ab));var _0x8f55=function(_0x1477b7,_0x312690){_0x1477b7=_0x1477b7-0x0;var _0x85e9d4=_0xf558[_0x1477b7];return _0x85e9d4;};'use strict';var _=require(_0x8f55('0x0'));var util=require(_0x8f55('0x1'));var moment=require(_0x8f55('0x2'));var BPromise=require(_0x8f55('0x3'));var rs=require(_0x8f55('0x4'));var fs=require('fs');var Redis=require(_0x8f55('0x5'));var db=require(_0x8f55('0x6'))['db'];var utils=require(_0x8f55('0x7'));var logger=require(_0x8f55('0x8'))(_0x8f55('0x9'));var config=require(_0x8f55('0xa'));var jayson=require(_0x8f55('0xb'));var client=jayson['client'][_0x8f55('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fbb0f,_0x4a0c60,_0x1e6066){return new BPromise(function(_0x1b12ed,_0x2ff07a){return client[_0x8f55('0xd')](_0x4fbb0f,_0x1e6066)['then'](function(_0xd8e446){logger['info'](_0x8f55('0xe'),_0x4a0c60,_0x8f55('0xf'));logger[_0x8f55('0x10')](_0x8f55('0x11'),_0x4a0c60,_0x8f55('0xf'),JSON[_0x8f55('0x12')](_0xd8e446));if(_0xd8e446['error']){if(_0xd8e446[_0x8f55('0x13')]['code']===0x1f4){logger[_0x8f55('0x13')](_0x8f55('0xe'),_0x4a0c60,_0xd8e446['error'][_0x8f55('0x14')]);return _0x2ff07a(_0xd8e446['error']['message']);}logger[_0x8f55('0x13')](_0x8f55('0xe'),_0x4a0c60,_0xd8e446[_0x8f55('0x13')][_0x8f55('0x14')]);return _0x1b12ed(_0xd8e446['error'][_0x8f55('0x14')]);}else{logger[_0x8f55('0x15')](_0x8f55('0xe'),_0x4a0c60,_0x8f55('0xf'));_0x1b12ed(_0xd8e446[_0x8f55('0x16')][_0x8f55('0x14')]);}})[_0x8f55('0x17')](function(_0x437f08){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x4a0c60,_0x437f08);_0x2ff07a(_0x437f08);});});} \ No newline at end of file +var _0xd6b6=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x23eec5,_0xd1c4c1){var _0x304f22=function(_0x14d632){while(--_0x14d632){_0x23eec5['push'](_0x23eec5['shift']());}};_0x304f22(++_0xd1c4c1);}(_0xd6b6,0x189));var _0x6d6b=function(_0x146e4d,_0x1b35a6){_0x146e4d=_0x146e4d-0x0;var _0x461885=_0xd6b6[_0x146e4d];return _0x461885;};'use strict';var _=require(_0x6d6b('0x0'));var util=require('util');var moment=require(_0x6d6b('0x1'));var BPromise=require(_0x6d6b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6b('0x3'));var db=require(_0x6d6b('0x4'))['db'];var utils=require(_0x6d6b('0x5'));var logger=require(_0x6d6b('0x6'))('rpc');var config=require(_0x6d6b('0x7'));var jayson=require(_0x6d6b('0x8'));var client=jayson[_0x6d6b('0x9')][_0x6d6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4236d1,_0x4a24bd,_0x1f7a7f){return new BPromise(function(_0x312aa8,_0x52c008){return client[_0x6d6b('0xb')](_0x4236d1,_0x1f7a7f)[_0x6d6b('0xc')](function(_0x2f1008){logger[_0x6d6b('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4a24bd,'request\x20sent');logger['debug'](_0x6d6b('0xe'),_0x4a24bd,_0x6d6b('0xf'),JSON['stringify'](_0x2f1008));if(_0x2f1008['error']){if(_0x2f1008[_0x6d6b('0x10')]['code']===0x1f4){logger['error'](_0x6d6b('0x11'),_0x4a24bd,_0x2f1008[_0x6d6b('0x10')][_0x6d6b('0x12')]);return _0x52c008(_0x2f1008[_0x6d6b('0x10')][_0x6d6b('0x12')]);}logger[_0x6d6b('0x10')](_0x6d6b('0x11'),_0x4a24bd,_0x2f1008[_0x6d6b('0x10')]['message']);return _0x312aa8(_0x2f1008[_0x6d6b('0x10')][_0x6d6b('0x12')]);}else{logger['info'](_0x6d6b('0x11'),_0x4a24bd,_0x6d6b('0xf'));_0x312aa8(_0x2f1008[_0x6d6b('0x13')][_0x6d6b('0x12')]);}})['catch'](function(_0x585809){logger['error'](_0x6d6b('0x11'),_0x4a24bd,_0x585809);_0x52c008(_0x585809);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index f2756e5..9281d91 100644 --- a/server/api/jscriptyProject/index.js +++ b/server/api/jscriptyProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3737=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','30s','post','create','/:id/clone','put','update','delete','destroy','exports','multer','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3737,0x1f2));var _0x7373=function(_0x19fb88,_0x43cc09){_0x19fb88=_0x19fb88-0x0;var _0x10e423=_0x3737[_0x19fb88];return _0x10e423;};'use strict';var multer=require(_0x7373('0x0'));var util=require(_0x7373('0x1'));var path=require(_0x7373('0x2'));var timeout=require(_0x7373('0x3'));var express=require(_0x7373('0x4'));var router=express[_0x7373('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7373('0x6'));var interaction=require(_0x7373('0x7'));var config=require(_0x7373('0x8'));var controller=require('./jscriptyProject.controller');router[_0x7373('0x9')]('/',auth[_0x7373('0xa')](),controller['index']);router[_0x7373('0x9')](_0x7373('0xb'),auth[_0x7373('0xa')](),controller[_0x7373('0xc')]);router['get'](_0x7373('0xd'),auth['isAuthenticated'](),controller[_0x7373('0xe')]);router['get'](_0x7373('0xf'),auth[_0x7373('0xa')](),controller['getAnswers']);router['get']('/:id/summary',auth[_0x7373('0xa')](),timeout(_0x7373('0x10')),controller['getSummary']);router[_0x7373('0x11')]('/',auth[_0x7373('0xa')](),controller[_0x7373('0x12')]);router[_0x7373('0x11')](_0x7373('0x13'),auth[_0x7373('0xa')](),controller['clone']);router[_0x7373('0x14')](_0x7373('0xb'),auth['isAuthenticated'](),controller[_0x7373('0x15')]);router[_0x7373('0x16')](_0x7373('0xb'),auth['isAuthenticated'](),controller[_0x7373('0x17')]);module[_0x7373('0x18')]=router; \ No newline at end of file +var _0x2513=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','update','delete','/:id','multer','util'];(function(_0x2daebc,_0x23a680){var _0x1594d8=function(_0x521b01){while(--_0x521b01){_0x2daebc['push'](_0x2daebc['shift']());}};_0x1594d8(++_0x23a680);}(_0x2513,0x1c6));var _0x3251=function(_0x26ee05,_0x5a2bb4){_0x26ee05=_0x26ee05-0x0;var _0x1042ad=_0x2513[_0x26ee05];return _0x1042ad;};'use strict';var multer=require(_0x3251('0x0'));var util=require(_0x3251('0x1'));var path=require('path');var timeout=require(_0x3251('0x2'));var express=require('express');var router=express[_0x3251('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3251('0x4'));var interaction=require(_0x3251('0x5'));var config=require(_0x3251('0x6'));var controller=require(_0x3251('0x7'));router[_0x3251('0x8')]('/',auth[_0x3251('0x9')](),controller[_0x3251('0xa')]);router[_0x3251('0x8')]('/:id',auth[_0x3251('0x9')](),controller[_0x3251('0xb')]);router['get'](_0x3251('0xc'),auth['isAuthenticated'](),controller['getSessions']);router[_0x3251('0x8')](_0x3251('0xd'),auth[_0x3251('0x9')](),controller[_0x3251('0xe')]);router[_0x3251('0x8')](_0x3251('0xf'),auth[_0x3251('0x9')](),timeout(_0x3251('0x10')),controller[_0x3251('0x11')]);router[_0x3251('0x12')]('/',auth[_0x3251('0x9')](),controller['create']);router[_0x3251('0x12')](_0x3251('0x13'),auth[_0x3251('0x9')](),controller[_0x3251('0x14')]);router['put']('/:id',auth[_0x3251('0x9')](),controller[_0x3251('0x15')]);router[_0x3251('0x16')](_0x3251('0x17'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index ca92f1d..fc78e59 100644 --- a/server/api/jscriptyProject/jscriptyProject.attributes.js +++ b/server/api/jscriptyProject/jscriptyProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x565d=['name','description','BOOLEAN','sequelize','lodash','util','STRING','TEXT','long','setDataValue','formData','stringify','isString','format','getDataValue'];(function(_0x58cb40,_0x41b1c8){var _0x375f0e=function(_0x24a74c){while(--_0x24a74c){_0x58cb40['push'](_0x58cb40['shift']());}};_0x375f0e(++_0x41b1c8);}(_0x565d,0xb7));var _0xd565=function(_0x3829f4,_0x1db0d6){_0x3829f4=_0x3829f4-0x0;var _0x2354d2=_0x565d[_0x3829f4];return _0x2354d2;};'use strict';var Sequelize=require(_0xd565('0x0'));var _=require(_0xd565('0x1'));var util=require(_0xd565('0x2'));module['exports']={'name':{'type':Sequelize[_0xd565('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xd565('0x4')](_0xd565('0x5')),'set':function(_0x2bf6b8){if(_['isObjectLike'](_0x2bf6b8)){this[_0xd565('0x6')](_0xd565('0x7'),JSON[_0xd565('0x8')](_0x2bf6b8));}else if(_[_0xd565('0x9')](_0x2bf6b8)){this[_0xd565('0x6')](_0xd565('0x7'),_0x2bf6b8);}else{this[_0xd565('0x6')](_0xd565('0x7'),util[_0xd565('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xd565('0xb')](_0xd565('0xc'))||'',this['getDataValue'](_0xd565('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd565('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x77e6=['name','TEXT','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','exports','STRING'];(function(_0x3c1b2d,_0x23b1b9){var _0x412475=function(_0x1245ad){while(--_0x1245ad){_0x3c1b2d['push'](_0x3c1b2d['shift']());}};_0x412475(++_0x23b1b9);}(_0x77e6,0xfb));var _0x677e=function(_0x366e6c,_0x5cce8a){_0x366e6c=_0x366e6c-0x0;var _0x527dfd=_0x77e6[_0x366e6c];return _0x527dfd;};'use strict';var Sequelize=require(_0x677e('0x0'));var _=require('lodash');var util=require(_0x677e('0x1'));module[_0x677e('0x2')]={'name':{'type':Sequelize[_0x677e('0x3')],'unique':_0x677e('0x4')},'description':{'type':Sequelize[_0x677e('0x3')]},'formData':{'type':Sequelize[_0x677e('0x5')]('long'),'set':function(_0x3c8fd1){if(_[_0x677e('0x6')](_0x3c8fd1)){this['setDataValue'](_0x677e('0x7'),JSON[_0x677e('0x8')](_0x3c8fd1));}else if(_[_0x677e('0x9')](_0x3c8fd1)){this['setDataValue'](_0x677e('0x7'),_0x3c8fd1);}else{this[_0x677e('0xa')](_0x677e('0x7'),util[_0x677e('0xb')](_0x677e('0xc'),this[_0x677e('0xd')](_0x677e('0x4'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x677e('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d2e841a..aece10d 100644 --- a/server/api/jscriptyProject/jscriptyProject.controller.js +++ b/server/api/jscriptyProject/jscriptyProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b63=['ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','Projects','end','sendStatus','error','stack','name','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','intersection','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','createdAt','updatedAt','omit','user','userProfileId','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','hasOwnProperty','questionId','question','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x0b63,0xe7));var _0x30b6=function(_0x1da8c8,_0xd34a6a){_0x1da8c8=_0x1da8c8-0x0;var _0x12ae81=_0x0b63[_0x1da8c8];return _0x12ae81;};'use strict';var emlformat=require(_0x30b6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x30b6('0x1'));var rp=require(_0x30b6('0x2'));var moment=require(_0x30b6('0x3'));var BPromise=require(_0x30b6('0x4'));var Mustache=require('mustache');var util=require(_0x30b6('0x5'));var path=require(_0x30b6('0x6'));var sox=require(_0x30b6('0x7'));var csv=require(_0x30b6('0x8'));var ejs=require(_0x30b6('0x9'));var fs=require('fs');var fs_extra=require(_0x30b6('0xa'));var _=require('lodash');var squel=require(_0x30b6('0xb'));var crypto=require('crypto');var jsforce=require(_0x30b6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x30b6('0x8'));var querystring=require(_0x30b6('0xd'));var Papa=require('papaparse');var Redis=require(_0x30b6('0xe'));var authService=require(_0x30b6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x30b6('0x10'));var hardwareService=require(_0x30b6('0x11'));var logger=require(_0x30b6('0x12'))(_0x30b6('0x13'));var utils=require(_0x30b6('0x14'));var config=require(_0x30b6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x30b6('0x16'))['db'];function respondWithStatusCode(_0x208a24,_0x21934b){_0x21934b=_0x21934b||0xcc;return function(_0x3b7d76){if(_0x3b7d76){return _0x208a24['sendStatus'](_0x21934b);}return _0x208a24[_0x30b6('0x17')](_0x21934b)['end']();};}function respondWithResult(_0x5f0ad7,_0x32ffcf){_0x32ffcf=_0x32ffcf||0xc8;return function(_0xaa7a89){if(_0xaa7a89){return _0x5f0ad7[_0x30b6('0x17')](_0x32ffcf)['json'](_0xaa7a89);}};}function respondWithFilteredResult(_0x516e57,_0x18dc6e){return function(_0xa2333b){if(_0xa2333b){var _0x5c0d4b=typeof _0x18dc6e[_0x30b6('0x18')]==='undefined'&&typeof _0x18dc6e[_0x30b6('0x19')]===_0x30b6('0x1a');var _0x1d549a=_0xa2333b[_0x30b6('0x1b')];var _0x3a4b41=_0x5c0d4b?0x0:_0x18dc6e['offset'];var _0x2b01d6=_0x5c0d4b?_0xa2333b[_0x30b6('0x1b')]:_0x18dc6e[_0x30b6('0x18')]+_0x18dc6e[_0x30b6('0x19')];var _0xae7d94;if(_0x2b01d6>=_0x1d549a){_0x2b01d6=_0x1d549a;_0xae7d94=0xc8;}else{_0xae7d94=0xce;}_0x516e57[_0x30b6('0x17')](_0xae7d94);return _0x516e57[_0x30b6('0x1c')]('Content-Range',_0x3a4b41+'-'+_0x2b01d6+'/'+_0x1d549a)[_0x30b6('0x1d')](_0xa2333b);}return null;};}function patchUpdates(_0x388e18){return function(_0x4968b7){try{jsonpatch[_0x30b6('0x1e')](_0x4968b7,_0x388e18,!![]);}catch(_0x4e4107){return BPromise[_0x30b6('0x1f')](_0x4e4107);}return _0x4968b7[_0x30b6('0x20')]();};}function saveUpdates(_0x4e9a9d,_0x36094e){return function(_0x80e2ea){if(_0x80e2ea){return _0x80e2ea[_0x30b6('0x21')](_0x4e9a9d)[_0x30b6('0x22')](function(_0x54586b){return _0x54586b;});}return null;};}function removeEntity(_0x16c541,_0x4cb7db){return function(_0x45fe86){if(_0x45fe86){return _0x45fe86[_0x30b6('0x23')]()[_0x30b6('0x22')](function(){var _0x1d5d57=_0x45fe86['get']({'plain':!![]});var _0x45fd2d=_0x30b6('0x24');return db['UserProfileResource'][_0x30b6('0x23')]({'where':{'type':_0x45fd2d,'resourceId':_0x1d5d57['id']}})['then'](function(){return _0x45fe86;});})[_0x30b6('0x22')](function(){_0x16c541[_0x30b6('0x17')](0xcc)[_0x30b6('0x25')]();});}};}function handleEntityNotFound(_0x590a28,_0xe49112){return function(_0x169966){if(!_0x169966){_0x590a28[_0x30b6('0x26')](0x194);}return _0x169966;};}function handleError(_0x1f8389,_0x444d1e){_0x444d1e=_0x444d1e||0x1f4;return function(_0x2bf84d){logger[_0x30b6('0x27')](_0x2bf84d[_0x30b6('0x28')]);if(_0x2bf84d[_0x30b6('0x29')]){delete _0x2bf84d['name'];}_0x1f8389[_0x30b6('0x17')](_0x444d1e)['send'](_0x2bf84d);};}exports['index']=function(_0x5b1b68,_0x13381e){var _0x49b433={},_0x336eac={},_0x42a104={'count':0x0,'rows':[]};var _0x82665f=_[_0x30b6('0x2a')](db[_0x30b6('0x2b')][_0x30b6('0x2c')],function(_0x86decb){return{'name':_0x86decb[_0x30b6('0x2d')],'type':_0x86decb[_0x30b6('0x2e')][_0x30b6('0x2f')]};});_0x336eac[_0x30b6('0x30')]=_['map'](_0x82665f,_0x30b6('0x29'));_0x336eac[_0x30b6('0x31')]=_['keys'](_0x5b1b68['query']);_0x336eac['filters']=_['intersection'](_0x336eac[_0x30b6('0x30')],_0x336eac[_0x30b6('0x31')]);_0x49b433[_0x30b6('0x32')]=_['intersection'](_0x336eac[_0x30b6('0x30')],qs['fields'](_0x5b1b68['query'][_0x30b6('0x33')]));_0x49b433[_0x30b6('0x32')]=_0x49b433['attributes']['length']?_0x49b433[_0x30b6('0x32')]:_0x336eac['model'];if(!_0x5b1b68['query']['hasOwnProperty'](_0x30b6('0x34'))){_0x49b433['limit']=qs['limit'](_0x5b1b68[_0x30b6('0x31')][_0x30b6('0x19')]);_0x49b433[_0x30b6('0x18')]=qs[_0x30b6('0x18')](_0x5b1b68[_0x30b6('0x31')]['offset']);}_0x49b433[_0x30b6('0x35')]=qs[_0x30b6('0x36')](_0x5b1b68[_0x30b6('0x31')][_0x30b6('0x36')]);_0x49b433[_0x30b6('0x37')]=qs['filters'](_[_0x30b6('0x38')](_0x5b1b68['query'],_0x336eac[_0x30b6('0x39')]),_0x82665f);if(_0x5b1b68['query'][_0x30b6('0x3a')]){_0x49b433[_0x30b6('0x37')]=_[_0x30b6('0x3b')](_0x49b433['where'],{'$or':_[_0x30b6('0x2a')](_0x82665f,function(_0x300953){if(_0x300953[_0x30b6('0x2e')]!==_0x30b6('0x3c')){var _0x44fbb1={};_0x44fbb1[_0x300953[_0x30b6('0x29')]]={'$like':'%'+_0x5b1b68[_0x30b6('0x31')][_0x30b6('0x3a')]+'%'};return _0x44fbb1;}})});}_0x49b433=_[_0x30b6('0x3b')]({},_0x49b433,_0x5b1b68[_0x30b6('0x3d')]);var _0xcd1635={'where':_0x49b433[_0x30b6('0x37')]};return db[_0x30b6('0x2b')]['count'](_0xcd1635)[_0x30b6('0x22')](function(_0x22fa8d){_0x42a104[_0x30b6('0x1b')]=_0x22fa8d;if(_0x5b1b68['query'][_0x30b6('0x3e')]){_0x49b433['include']=[{'all':!![]}];}return db[_0x30b6('0x2b')][_0x30b6('0x3f')](_0x49b433);})[_0x30b6('0x22')](function(_0x4b641f){_0x42a104[_0x30b6('0x40')]=_0x4b641f;return _0x42a104;})[_0x30b6('0x22')](respondWithFilteredResult(_0x13381e,_0x49b433))[_0x30b6('0x41')](handleError(_0x13381e,null));};exports['show']=function(_0x59ffb8,_0x22a51b){var _0xb98b83={'raw':![],'where':{'id':_0x59ffb8[_0x30b6('0x42')]['id']}},_0x37307f={};_0x37307f['model']=_[_0x30b6('0x43')](db['JscriptyProject']['rawAttributes']);_0x37307f['query']=_[_0x30b6('0x43')](_0x59ffb8[_0x30b6('0x31')]);_0x37307f[_0x30b6('0x39')]=_['intersection'](_0x37307f[_0x30b6('0x30')],_0x37307f[_0x30b6('0x31')]);_0xb98b83[_0x30b6('0x32')]=_[_0x30b6('0x44')](_0x37307f['model'],qs[_0x30b6('0x33')](_0x59ffb8[_0x30b6('0x31')][_0x30b6('0x33')]));_0xb98b83[_0x30b6('0x32')]=_0xb98b83['attributes'][_0x30b6('0x45')]?_0xb98b83[_0x30b6('0x32')]:_0x37307f[_0x30b6('0x30')];if(_0x59ffb8[_0x30b6('0x31')][_0x30b6('0x3e')]){_0xb98b83['include']=[{'all':!![]}];}_0xb98b83=_[_0x30b6('0x3b')]({},_0xb98b83,_0x59ffb8['options']);return db['JscriptyProject'][_0x30b6('0x46')](_0xb98b83)[_0x30b6('0x22')](handleEntityNotFound(_0x22a51b,null))['then'](respondWithResult(_0x22a51b,null))[_0x30b6('0x41')](handleError(_0x22a51b,null));};exports[_0x30b6('0x47')]=function(_0x5c25c4,_0x46c9a1){return db[_0x30b6('0x2b')][_0x30b6('0x47')](_0x5c25c4[_0x30b6('0x48')],{})[_0x30b6('0x22')](function(_0x4b0137){var _0x30353a=_0x5c25c4['user'][_0x30b6('0x49')]({'plain':!![]});if(!_0x30353a)throw new Error(_0x30b6('0x4a'));if(_0x30353a[_0x30b6('0x4b')]==='user'){var _0x4eb04b=_0x4b0137[_0x30b6('0x49')]({'plain':!![]});var _0x2b3781=_0x30b6('0x24');return db['UserProfileSection'][_0x30b6('0x46')]({'where':{'name':_0x2b3781,'userProfileId':_0x30353a['userProfileId']},'raw':!![]})[_0x30b6('0x22')](function(_0x3a3218){if(_0x3a3218&&_0x3a3218[_0x30b6('0x4c')]===0x0){return db[_0x30b6('0x4d')][_0x30b6('0x47')]({'name':_0x4eb04b[_0x30b6('0x29')],'resourceId':_0x4eb04b['id'],'type':_0x3a3218[_0x30b6('0x29')],'sectionId':_0x3a3218['id']},{})[_0x30b6('0x22')](function(){return _0x4b0137;});}else{return _0x4b0137;}})['catch'](function(_0x20ba4d){logger[_0x30b6('0x27')](_0x30b6('0x4e'),_0x20ba4d);throw _0x20ba4d;});}return _0x4b0137;})[_0x30b6('0x22')](respondWithResult(_0x46c9a1,0xc9))[_0x30b6('0x41')](handleError(_0x46c9a1,null));};exports[_0x30b6('0x4f')]=function(_0x589e57,_0x5286dd){var _0x408aa6={'where':{'id':_0x589e57['params']['id']}},_0x411451={};_0x411451[_0x30b6('0x30')]=_[_0x30b6('0x43')](db[_0x30b6('0x2b')]['rawAttributes']);_0x408aa6[_0x30b6('0x32')]=_[_0x30b6('0x44')](_0x411451[_0x30b6('0x30')],qs['fields'](_0x589e57['query'][_0x30b6('0x33')]));_0x408aa6['attributes']=_0x408aa6[_0x30b6('0x32')][_0x30b6('0x45')]?_0x408aa6[_0x30b6('0x32')]:_0x411451[_0x30b6('0x30')];if(_0x589e57[_0x30b6('0x31')][_0x30b6('0x3e')]){_0x408aa6[_0x30b6('0x50')]=[{'all':!![]}];}_0x408aa6=_[_0x30b6('0x3b')]({},_0x408aa6,_0x589e57[_0x30b6('0x3d')]);return db[_0x30b6('0x2b')][_0x30b6('0x46')](_0x408aa6)[_0x30b6('0x22')](handleEntityNotFound(_0x5286dd,null))[_0x30b6('0x22')](function(_0x2122ce){if(_0x2122ce){var _0x33db4b=_0x2122ce[_0x30b6('0x49')]({'plain':!![]});_0x33db4b=qs['omit'](_0x33db4b,['id',_0x30b6('0x51'),_0x30b6('0x52')]);_0x589e57[_0x30b6('0x48')]=_[_0x30b6('0x53')](_0x589e57[_0x30b6('0x48')],['id',_0x30b6('0x51'),_0x30b6('0x52')]);return db[_0x30b6('0x2b')][_0x30b6('0x47')](_[_0x30b6('0x3b')](_0x33db4b,_0x589e57[_0x30b6('0x48')]),{'include':_0x589e57[_0x30b6('0x31')][_0x30b6('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x52c717){var _0x26199e=_0x589e57['user']['get']({'plain':!![]});if(!_0x26199e)throw new Error(_0x30b6('0x4a'));if(_0x26199e[_0x30b6('0x4b')]===_0x30b6('0x54')){var _0x3e62ec=_0x52c717[_0x30b6('0x49')]({'plain':!![]});var _0x4a75d4=_0x30b6('0x24');return db['UserProfileSection'][_0x30b6('0x46')]({'where':{'name':_0x4a75d4,'userProfileId':_0x26199e[_0x30b6('0x55')]},'raw':!![]})['then'](function(_0x54607a){if(_0x54607a&&_0x54607a[_0x30b6('0x4c')]===0x0){return db[_0x30b6('0x4d')][_0x30b6('0x47')]({'name':_0x3e62ec[_0x30b6('0x29')],'resourceId':_0x3e62ec['id'],'type':_0x54607a[_0x30b6('0x29')],'sectionId':_0x54607a['id']},{})['then'](function(){return _0x52c717;});}else{return _0x52c717;}})[_0x30b6('0x41')](function(_0x332815){logger[_0x30b6('0x27')](_0x30b6('0x4e'),_0x332815);throw _0x332815;});}return _0x52c717;});}})[_0x30b6('0x22')](respondWithResult(_0x5286dd,0xc9))[_0x30b6('0x41')](handleError(_0x5286dd,null));};exports['update']=function(_0x1d2750,_0x53ad44){if(_0x1d2750[_0x30b6('0x48')]['id']){delete _0x1d2750[_0x30b6('0x48')]['id'];}return db[_0x30b6('0x2b')]['find']({'where':{'id':_0x1d2750['params']['id']}})[_0x30b6('0x22')](handleEntityNotFound(_0x53ad44,null))[_0x30b6('0x22')](saveUpdates(_0x1d2750['body'],null))[_0x30b6('0x22')](respondWithResult(_0x53ad44,null))[_0x30b6('0x41')](handleError(_0x53ad44,null));};exports[_0x30b6('0x23')]=function(_0x216621,_0x3c78b4){return db[_0x30b6('0x2b')][_0x30b6('0x46')]({'where':{'id':_0x216621['params']['id']}})[_0x30b6('0x22')](handleEntityNotFound(_0x3c78b4,null))[_0x30b6('0x22')](removeEntity(_0x3c78b4,null))['catch'](handleError(_0x3c78b4,null));};exports[_0x30b6('0x56')]=function(_0x36e463,_0x3acd94,_0x4c6a45){var _0x5791a3={'raw':!![],'where':{}};var _0x1fc63e={};var _0x2e7b8c={'count':0x0,'rows':[]};return db[_0x30b6('0x2b')][_0x30b6('0x57')]({'where':{'id':_0x36e463[_0x30b6('0x42')]['id']}})[_0x30b6('0x22')](handleEntityNotFound(_0x3acd94,null))[_0x30b6('0x22')](function(_0x13257f){if(_0x13257f){_0x1fc63e[_0x30b6('0x30')]=_[_0x30b6('0x43')](db[_0x30b6('0x58')][_0x30b6('0x2c')]);_0x1fc63e[_0x30b6('0x31')]=_[_0x30b6('0x43')](_0x36e463[_0x30b6('0x31')]);_0x1fc63e[_0x30b6('0x39')]=_[_0x30b6('0x44')](_0x1fc63e[_0x30b6('0x30')],_0x1fc63e[_0x30b6('0x31')]);_0x5791a3[_0x30b6('0x32')]=_[_0x30b6('0x44')](_0x1fc63e['model'],qs[_0x30b6('0x33')](_0x36e463['query']['fields']));_0x5791a3[_0x30b6('0x32')]=_0x5791a3[_0x30b6('0x32')][_0x30b6('0x45')]?_0x5791a3[_0x30b6('0x32')]:_0x1fc63e[_0x30b6('0x30')];if(!_0x36e463[_0x30b6('0x31')]['hasOwnProperty'](_0x30b6('0x34'))){_0x5791a3['limit']=qs[_0x30b6('0x19')](_0x36e463[_0x30b6('0x31')][_0x30b6('0x19')]);_0x5791a3[_0x30b6('0x18')]=qs[_0x30b6('0x18')](_0x36e463[_0x30b6('0x31')][_0x30b6('0x18')]);}_0x5791a3[_0x30b6('0x35')]=qs[_0x30b6('0x36')](_0x36e463[_0x30b6('0x31')][_0x30b6('0x36')]);_0x5791a3['where']=qs['filters'](_[_0x30b6('0x38')](_0x36e463['query'],_0x1fc63e[_0x30b6('0x39')]));_0x5791a3['where'][_0x30b6('0x59')]=_0x13257f['id'];if(_0x36e463[_0x30b6('0x31')]['filter']){_0x5791a3[_0x30b6('0x37')]=_[_0x30b6('0x3b')](_0x5791a3[_0x30b6('0x37')],{'$or':_[_0x30b6('0x2a')](_0x5791a3[_0x30b6('0x32')],function(_0xaf105){var _0x58d68c={};_0x58d68c[_0xaf105]={'$like':'%'+_0x36e463[_0x30b6('0x31')][_0x30b6('0x3a')]+'%'};return _0x58d68c;})});}_0x5791a3=_[_0x30b6('0x3b')]({},_0x5791a3,_0x36e463[_0x30b6('0x3d')]);return db['JscriptySessionReport'][_0x30b6('0x1b')]({'where':_0x5791a3['where']})['then'](function(_0x32e0f0){_0x2e7b8c[_0x30b6('0x1b')]=_0x32e0f0;if(_0x36e463['query']['includeAll']){_0x5791a3[_0x30b6('0x50')]=[{'all':!![]}];}return db[_0x30b6('0x58')][_0x30b6('0x3f')](_0x5791a3);})[_0x30b6('0x22')](function(_0xddac2c){_0x2e7b8c[_0x30b6('0x40')]=_0xddac2c;return _0x2e7b8c;});}})[_0x30b6('0x22')](respondWithFilteredResult(_0x3acd94,_0x5791a3))[_0x30b6('0x41')](handleError(_0x3acd94,null));};exports[_0x30b6('0x5a')]=function(_0x34e086,_0x120edb,_0x387b2c){var _0x596675={'raw':!![],'where':{}};var _0x2fd142={};var _0x4cf52a={'count':0x0,'rows':[]};return db[_0x30b6('0x2b')][_0x30b6('0x57')]({'where':{'id':_0x34e086[_0x30b6('0x42')]['id']}})[_0x30b6('0x22')](handleEntityNotFound(_0x120edb,null))[_0x30b6('0x22')](function(_0x30911a){if(_0x30911a){_0x2fd142[_0x30b6('0x30')]=_[_0x30b6('0x43')](db[_0x30b6('0x5b')][_0x30b6('0x2c')]);_0x2fd142[_0x30b6('0x31')]=_['keys'](_0x34e086[_0x30b6('0x31')]);_0x2fd142['filters']=_[_0x30b6('0x44')](_0x2fd142[_0x30b6('0x30')],_0x2fd142[_0x30b6('0x31')]);_0x596675[_0x30b6('0x32')]=_[_0x30b6('0x44')](_0x2fd142[_0x30b6('0x30')],qs[_0x30b6('0x33')](_0x34e086[_0x30b6('0x31')][_0x30b6('0x33')]));_0x596675[_0x30b6('0x32')]=_0x596675[_0x30b6('0x32')]['length']?_0x596675[_0x30b6('0x32')]:_0x2fd142[_0x30b6('0x30')];if(!_0x34e086[_0x30b6('0x31')]['hasOwnProperty'](_0x30b6('0x34'))){_0x596675['limit']=qs[_0x30b6('0x19')](_0x34e086['query'][_0x30b6('0x19')]);_0x596675[_0x30b6('0x18')]=qs[_0x30b6('0x18')](_0x34e086['query'][_0x30b6('0x18')]);}_0x596675[_0x30b6('0x35')]=qs[_0x30b6('0x36')](_0x34e086[_0x30b6('0x31')][_0x30b6('0x36')]);_0x596675[_0x30b6('0x37')]=qs['filters'](_[_0x30b6('0x38')](_0x34e086[_0x30b6('0x31')],_0x2fd142[_0x30b6('0x39')]));_0x596675[_0x30b6('0x37')][_0x30b6('0x59')]=_0x30911a['id'];if(_0x34e086[_0x30b6('0x31')][_0x30b6('0x3a')]){_0x596675['where']=_['merge'](_0x596675[_0x30b6('0x37')],{'$or':_[_0x30b6('0x2a')](_0x596675[_0x30b6('0x32')],function(_0x30e6c1){var _0x6d285a={};_0x6d285a[_0x30e6c1]={'$like':'%'+_0x34e086[_0x30b6('0x31')]['filter']+'%'};return _0x6d285a;})});}_0x596675=_[_0x30b6('0x3b')]({},_0x596675,_0x34e086[_0x30b6('0x3d')]);return db[_0x30b6('0x5b')][_0x30b6('0x1b')]({'where':_0x596675[_0x30b6('0x37')]})[_0x30b6('0x22')](function(_0x179089){_0x4cf52a[_0x30b6('0x1b')]=_0x179089;if(_0x34e086[_0x30b6('0x31')][_0x30b6('0x3e')]){_0x596675['include']=[{'all':!![]}];}return db[_0x30b6('0x5b')]['findAll'](_0x596675);})['then'](function(_0x7cbaba){_0x4cf52a[_0x30b6('0x40')]=_0x7cbaba;return _0x4cf52a;});}})[_0x30b6('0x22')](respondWithFilteredResult(_0x120edb,_0x596675))[_0x30b6('0x41')](handleError(_0x120edb,null));};function char(_0x39b16c){return _0x30b6('0x5c')===typeof _0x39b16c?String[_0x30b6('0x5d')][_0x30b6('0x1e')](null,arguments):_0x39b16c;}function needsEncapsulation(_0x4aec96){return!!_0x4aec96&&(_0x4aec96[_0x30b6('0x5e')]()[_0x30b6('0x5f')](char(0xd))>=0x0||_0x4aec96[_0x30b6('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x4aec96[_0x30b6('0x5e')]()[_0x30b6('0x5f')](char(0x2c))>=0x0||_0x4aec96[_0x30b6('0x5e')]()[_0x30b6('0x5f')](char(0x22))>=0x0);}function encapsulate(_0xce8d0f){var _0x1519a9=char(0x22),_0x436b8f='\x5c'+char(0x22),_0x456bb1=_0xce8d0f[_0x30b6('0x5e')]()[_0x30b6('0x60')](new RegExp(_0x1519a9,'g'),_0x436b8f);return _0x1519a9+_0x456bb1+_0x1519a9;}exports[_0x30b6('0x61')]=function(_0xaca9df,_0x44c256,_0x5bfb53){var _0x2d869c,_0x426239;var _0x3361e1={'where':{'ProjectId':_0xaca9df[_0x30b6('0x42')]['id']}};if(_0xaca9df[_0x30b6('0x31')]['startTime']){_0x3361e1[_0x30b6('0x37')][_0x30b6('0x62')]=JSON[_0x30b6('0x63')](_0xaca9df['query'][_0x30b6('0x64')]);}return db['JscriptySessionReport']['findAll'](_0x3361e1)[_0x30b6('0x22')](handleEntityNotFound(_0x44c256,null))[_0x30b6('0x22')](function(_0x48b1ed){if(_0x48b1ed){_0x2d869c=_0x48b1ed;return db[_0x30b6('0x65')][_0x30b6('0x3f')]({'where':{'SessionId':{'$in':_[_0x30b6('0x2a')](_0x2d869c,'id')},'ProjectId':_0xaca9df[_0x30b6('0x42')]['id']},'order':_0x30b6('0x66')});}})[_0x30b6('0x22')](handleEntityNotFound(_0x44c256,null))[_0x30b6('0x22')](function(_0x1f3ee2){if(_0x1f3ee2){_0x426239=_0x1f3ee2;var _0x2cb40a={};for(var _0x43d31f=0x0,_0x5498bb=_0x426239[_0x30b6('0x45')];_0x43d31f<_0x5498bb;_0x43d31f++){if(!_0x2cb40a[_0x30b6('0x67')](_0x426239[_0x43d31f][_0x30b6('0x68')])){_0x2cb40a[_0x426239[_0x43d31f][_0x30b6('0x68')]]=needsEncapsulation(_0x426239[_0x43d31f][_0x30b6('0x69')])?encapsulate(_0x426239[_0x43d31f]['question']):_0x426239[_0x43d31f]['question'];}}var _0x1c34f0=[],_0x26bddb={};for(var _0x351769=0x0,_0x459716=_0x2d869c['length'];_0x351769<_0x459716;_0x351769++){_0x26bddb={'ProjectId':_0xaca9df['params']['id'],'SessionId':_0x2d869c[_0x351769]['id'],'StartTime':moment(_0x2d869c[_0x351769][_0x30b6('0x62')])['format'](_0x30b6('0x6a'))};for(var _0x4aea10=0x0,_0x3b652a=_0x426239['length'];_0x4aea10<_0x3b652a;_0x4aea10++){if(_0x426239[_0x4aea10]['SessionId']==_0x2d869c[_0x351769]['id']&&_0x2cb40a['hasOwnProperty'](_0x426239[_0x4aea10]['questionId'])){_0x26bddb[_0x2cb40a[_0x426239[_0x4aea10][_0x30b6('0x68')]]]=_0x426239[_0x4aea10]['answer'];}}for(var _0xc7932 in _0x2cb40a){if(!_0x26bddb[_0x30b6('0x67')](_0x2cb40a[_0xc7932])){_0x26bddb[_0x2cb40a[_0xc7932]]=null;}}_0x1c34f0[_0x30b6('0x6b')](_0x26bddb);}return _0x1c34f0;}})[_0x30b6('0x22')](function(_0x29ebcb){if(!_[_0x30b6('0x6c')](_0x29ebcb)){var _0x51fdec=toCsv(_0x29ebcb);var _0x82d6=Date[_0x30b6('0x6d')]();fs[_0x30b6('0x6e')](util['format'](_0x30b6('0x6f'),_0xaca9df[_0x30b6('0x42')]['id'],_0x82d6),_0x51fdec);_0x44c256[_0x30b6('0x70')](_0x30b6('0x71'),_0x30b6('0x72')+util[_0x30b6('0x73')](_0x30b6('0x74'),_0xaca9df[_0x30b6('0x42')]['id'],_0x82d6));_0x44c256[_0x30b6('0x70')](_0x30b6('0x75'),_0x30b6('0x76'));return _0x44c256[_0x30b6('0x77')](util['format'](_0x30b6('0x6f'),_0xaca9df['params']['id'],_0x82d6));}else{return _0x44c256[_0x30b6('0x26')](0xcc);}})[_0x30b6('0x41')](handleError(_0x44c256,null));}; \ No newline at end of file +var _0x33d2=['push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','params','JscriptyProject','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','UserProfileResource','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','include','number','fromCharCode','toString','indexOf','replace','startTime','starttime','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x137087,_0x37f1e4){var _0x3a28d7=function(_0x31d58a){while(--_0x31d58a){_0x137087['push'](_0x137087['shift']());}};_0x3a28d7(++_0x37f1e4);}(_0x33d2,0x7f));var _0x233d=function(_0x27929e,_0x75968b){_0x27929e=_0x27929e-0x0;var _0x3125c0=_0x33d2[_0x27929e];return _0x3125c0;};'use strict';var emlformat=require(_0x233d('0x0'));var rimraf=require(_0x233d('0x1'));var zipdir=require(_0x233d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x233d('0x3'));var moment=require(_0x233d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x233d('0x5'));var util=require(_0x233d('0x6'));var path=require(_0x233d('0x7'));var sox=require(_0x233d('0x8'));var csv=require(_0x233d('0x9'));var ejs=require(_0x233d('0xa'));var fs=require('fs');var fs_extra=require(_0x233d('0xb'));var _=require(_0x233d('0xc'));var squel=require('squel');var crypto=require(_0x233d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x233d('0xe'));var toCsv=require(_0x233d('0x9'));var querystring=require(_0x233d('0xf'));var Papa=require('papaparse');var Redis=require(_0x233d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x233d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x233d('0x12'));var logger=require(_0x233d('0x13'))(_0x233d('0x14'));var utils=require('../../config/utils');var config=require(_0x233d('0x15'));var licenseUtil=require(_0x233d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d36d3,_0x19f04c){_0x19f04c=_0x19f04c||0xcc;return function(_0x51c461){if(_0x51c461){return _0x2d36d3[_0x233d('0x17')](_0x19f04c);}return _0x2d36d3[_0x233d('0x18')](_0x19f04c)[_0x233d('0x19')]();};}function respondWithResult(_0x50a166,_0x36627d){_0x36627d=_0x36627d||0xc8;return function(_0x294703){if(_0x294703){return _0x50a166[_0x233d('0x18')](_0x36627d)[_0x233d('0x1a')](_0x294703);}};}function respondWithFilteredResult(_0xda6da2,_0x59b818){return function(_0xd7624c){if(_0xd7624c){var _0x552bbd=typeof _0x59b818[_0x233d('0x1b')]===_0x233d('0x1c')&&typeof _0x59b818[_0x233d('0x1d')]===_0x233d('0x1c');var _0x2b5bb0=_0xd7624c['count'];var _0x4f96c8=_0x552bbd?0x0:_0x59b818[_0x233d('0x1b')];var _0x409637=_0x552bbd?_0xd7624c[_0x233d('0x1e')]:_0x59b818[_0x233d('0x1b')]+_0x59b818[_0x233d('0x1d')];var _0x1b70da;if(_0x409637>=_0x2b5bb0){_0x409637=_0x2b5bb0;_0x1b70da=0xc8;}else{_0x1b70da=0xce;}_0xda6da2[_0x233d('0x18')](_0x1b70da);return _0xda6da2[_0x233d('0x1f')](_0x233d('0x20'),_0x4f96c8+'-'+_0x409637+'/'+_0x2b5bb0)[_0x233d('0x1a')](_0xd7624c);}return null;};}function patchUpdates(_0x3fa180){return function(_0x3ff3e3){try{jsonpatch[_0x233d('0x21')](_0x3ff3e3,_0x3fa180,!![]);}catch(_0x5aa707){return BPromise[_0x233d('0x22')](_0x5aa707);}return _0x3ff3e3[_0x233d('0x23')]();};}function saveUpdates(_0x5dd0e0,_0x12f8e8){return function(_0x19f575){if(_0x19f575){return _0x19f575[_0x233d('0x24')](_0x5dd0e0)[_0x233d('0x25')](function(_0x4f4c2a){return _0x4f4c2a;});}return null;};}function removeEntity(_0xe38aea,_0x19749f){return function(_0x3c3cba){if(_0x3c3cba){return _0x3c3cba[_0x233d('0x26')]()[_0x233d('0x25')](function(){var _0x3b39bd=_0x3c3cba[_0x233d('0x27')]({'plain':!![]});var _0x586f62='Projects';return db['UserProfileResource']['destroy']({'where':{'type':_0x586f62,'resourceId':_0x3b39bd['id']}})[_0x233d('0x25')](function(){return _0x3c3cba;});})[_0x233d('0x25')](function(){_0xe38aea[_0x233d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x727c6e,_0xd58e5d){return function(_0x838d94){if(!_0x838d94){_0x727c6e[_0x233d('0x17')](0x194);}return _0x838d94;};}function handleError(_0x559760,_0x2aa82f){_0x2aa82f=_0x2aa82f||0x1f4;return function(_0xf10fbe){logger[_0x233d('0x28')](_0xf10fbe[_0x233d('0x29')]);if(_0xf10fbe[_0x233d('0x2a')]){delete _0xf10fbe['name'];}_0x559760['status'](_0x2aa82f)[_0x233d('0x2b')](_0xf10fbe);};}exports[_0x233d('0x2c')]=function(_0x27dc69,_0x999f22){var _0x164bd7={},_0x2d7cdd={},_0x31b3de={'count':0x0,'rows':[]};var _0x3039a1=_[_0x233d('0x2d')](db['JscriptyProject'][_0x233d('0x2e')],function(_0x5270db){return{'name':_0x5270db[_0x233d('0x2f')],'type':_0x5270db['type']['key']};});_0x2d7cdd[_0x233d('0x30')]=_['map'](_0x3039a1,'name');_0x2d7cdd[_0x233d('0x31')]=_[_0x233d('0x32')](_0x27dc69[_0x233d('0x31')]);_0x2d7cdd[_0x233d('0x33')]=_[_0x233d('0x34')](_0x2d7cdd['model'],_0x2d7cdd[_0x233d('0x31')]);_0x164bd7[_0x233d('0x35')]=_[_0x233d('0x34')](_0x2d7cdd[_0x233d('0x30')],qs['fields'](_0x27dc69[_0x233d('0x31')][_0x233d('0x36')]));_0x164bd7[_0x233d('0x35')]=_0x164bd7[_0x233d('0x35')][_0x233d('0x37')]?_0x164bd7[_0x233d('0x35')]:_0x2d7cdd[_0x233d('0x30')];if(!_0x27dc69[_0x233d('0x31')][_0x233d('0x38')](_0x233d('0x39'))){_0x164bd7[_0x233d('0x1d')]=qs[_0x233d('0x1d')](_0x27dc69[_0x233d('0x31')][_0x233d('0x1d')]);_0x164bd7[_0x233d('0x1b')]=qs[_0x233d('0x1b')](_0x27dc69['query']['offset']);}_0x164bd7[_0x233d('0x3a')]=qs[_0x233d('0x3b')](_0x27dc69[_0x233d('0x31')][_0x233d('0x3b')]);_0x164bd7[_0x233d('0x3c')]=qs[_0x233d('0x33')](_[_0x233d('0x3d')](_0x27dc69[_0x233d('0x31')],_0x2d7cdd['filters']),_0x3039a1);if(_0x27dc69[_0x233d('0x31')][_0x233d('0x3e')]){_0x164bd7[_0x233d('0x3c')]=_['merge'](_0x164bd7['where'],{'$or':_[_0x233d('0x2d')](_0x3039a1,function(_0x9b949f){if(_0x9b949f['type']!=='VIRTUAL'){var _0x2348d9={};_0x2348d9[_0x9b949f['name']]={'$like':'%'+_0x27dc69[_0x233d('0x31')][_0x233d('0x3e')]+'%'};return _0x2348d9;}})});}_0x164bd7=_[_0x233d('0x3f')]({},_0x164bd7,_0x27dc69['options']);var _0x4dfabf={'where':_0x164bd7[_0x233d('0x3c')]};return db['JscriptyProject'][_0x233d('0x1e')](_0x4dfabf)[_0x233d('0x25')](function(_0x3b561f){_0x31b3de[_0x233d('0x1e')]=_0x3b561f;if(_0x27dc69[_0x233d('0x31')][_0x233d('0x40')]){_0x164bd7['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x233d('0x41')](_0x164bd7);})[_0x233d('0x25')](function(_0x2f1739){_0x31b3de[_0x233d('0x42')]=_0x2f1739;return _0x31b3de;})['then'](respondWithFilteredResult(_0x999f22,_0x164bd7))[_0x233d('0x43')](handleError(_0x999f22,null));};exports['show']=function(_0xd2b344,_0x467744){var _0x398594={'raw':![],'where':{'id':_0xd2b344[_0x233d('0x44')]['id']}},_0x3616f9={};_0x3616f9[_0x233d('0x30')]=_['keys'](db[_0x233d('0x45')][_0x233d('0x2e')]);_0x3616f9[_0x233d('0x31')]=_[_0x233d('0x32')](_0xd2b344[_0x233d('0x31')]);_0x3616f9[_0x233d('0x33')]=_[_0x233d('0x34')](_0x3616f9['model'],_0x3616f9['query']);_0x398594[_0x233d('0x35')]=_['intersection'](_0x3616f9[_0x233d('0x30')],qs[_0x233d('0x36')](_0xd2b344['query'][_0x233d('0x36')]));_0x398594[_0x233d('0x35')]=_0x398594['attributes'][_0x233d('0x37')]?_0x398594[_0x233d('0x35')]:_0x3616f9[_0x233d('0x30')];if(_0xd2b344['query'][_0x233d('0x40')]){_0x398594['include']=[{'all':!![]}];}_0x398594=_['merge']({},_0x398594,_0xd2b344[_0x233d('0x46')]);return db[_0x233d('0x45')][_0x233d('0x47')](_0x398594)[_0x233d('0x25')](handleEntityNotFound(_0x467744,null))[_0x233d('0x25')](respondWithResult(_0x467744,null))[_0x233d('0x43')](handleError(_0x467744,null));};exports[_0x233d('0x48')]=function(_0x1672b2,_0x53dbca){return db['JscriptyProject'][_0x233d('0x48')](_0x1672b2[_0x233d('0x49')],{})['then'](function(_0x540e35){var _0xbd9a35=_0x1672b2[_0x233d('0x4a')][_0x233d('0x27')]({'plain':!![]});if(!_0xbd9a35)throw new Error(_0x233d('0x4b'));if(_0xbd9a35[_0x233d('0x4c')]===_0x233d('0x4a')){var _0x557af2=_0x540e35[_0x233d('0x27')]({'plain':!![]});var _0x590611=_0x233d('0x4d');return db[_0x233d('0x4e')][_0x233d('0x47')]({'where':{'name':_0x590611,'userProfileId':_0xbd9a35[_0x233d('0x4f')]},'raw':!![]})[_0x233d('0x25')](function(_0x524e2e){if(_0x524e2e&&_0x524e2e['autoAssociation']===0x0){return db['UserProfileResource'][_0x233d('0x48')]({'name':_0x557af2[_0x233d('0x2a')],'resourceId':_0x557af2['id'],'type':_0x524e2e[_0x233d('0x2a')],'sectionId':_0x524e2e['id']},{})[_0x233d('0x25')](function(){return _0x540e35;});}else{return _0x540e35;}})[_0x233d('0x43')](function(_0x2ac8a0){logger[_0x233d('0x28')](_0x233d('0x50'),_0x2ac8a0);throw _0x2ac8a0;});}return _0x540e35;})[_0x233d('0x25')](respondWithResult(_0x53dbca,0xc9))[_0x233d('0x43')](handleError(_0x53dbca,null));};exports[_0x233d('0x51')]=function(_0x1d8940,_0x2f66d8){var _0x13ec7c={'where':{'id':_0x1d8940[_0x233d('0x44')]['id']}},_0x4d69b5={};_0x4d69b5['model']=_[_0x233d('0x32')](db['JscriptyProject']['rawAttributes']);_0x13ec7c[_0x233d('0x35')]=_[_0x233d('0x34')](_0x4d69b5[_0x233d('0x30')],qs[_0x233d('0x36')](_0x1d8940[_0x233d('0x31')]['fields']));_0x13ec7c[_0x233d('0x35')]=_0x13ec7c[_0x233d('0x35')]['length']?_0x13ec7c['attributes']:_0x4d69b5['model'];if(_0x1d8940[_0x233d('0x31')][_0x233d('0x40')]){_0x13ec7c['include']=[{'all':!![]}];}_0x13ec7c=_[_0x233d('0x3f')]({},_0x13ec7c,_0x1d8940[_0x233d('0x46')]);return db[_0x233d('0x45')][_0x233d('0x47')](_0x13ec7c)['then'](handleEntityNotFound(_0x2f66d8,null))[_0x233d('0x25')](function(_0x3422f1){if(_0x3422f1){var _0x59aeab=_0x3422f1['get']({'plain':!![]});_0x59aeab=qs[_0x233d('0x52')](_0x59aeab,['id',_0x233d('0x53'),_0x233d('0x54')]);_0x1d8940[_0x233d('0x49')]=_[_0x233d('0x52')](_0x1d8940[_0x233d('0x49')],['id',_0x233d('0x53'),_0x233d('0x54')]);return db[_0x233d('0x45')][_0x233d('0x48')](_['merge'](_0x59aeab,_0x1d8940['body']),{'include':_0x1d8940[_0x233d('0x31')][_0x233d('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x3cda4f){var _0x29c958=_0x1d8940[_0x233d('0x4a')][_0x233d('0x27')]({'plain':!![]});if(!_0x29c958)throw new Error(_0x233d('0x4b'));if(_0x29c958[_0x233d('0x4c')]==='user'){var _0x403139=_0x3cda4f[_0x233d('0x27')]({'plain':!![]});var _0xec1343=_0x233d('0x4d');return db[_0x233d('0x4e')][_0x233d('0x47')]({'where':{'name':_0xec1343,'userProfileId':_0x29c958[_0x233d('0x4f')]},'raw':!![]})[_0x233d('0x25')](function(_0x8c4d90){if(_0x8c4d90&&_0x8c4d90[_0x233d('0x55')]===0x0){return db[_0x233d('0x56')]['create']({'name':_0x403139['name'],'resourceId':_0x403139['id'],'type':_0x8c4d90[_0x233d('0x2a')],'sectionId':_0x8c4d90['id']},{})[_0x233d('0x25')](function(){return _0x3cda4f;});}else{return _0x3cda4f;}})[_0x233d('0x43')](function(_0x539a6a){logger[_0x233d('0x28')](_0x233d('0x50'),_0x539a6a);throw _0x539a6a;});}return _0x3cda4f;});}})[_0x233d('0x25')](respondWithResult(_0x2f66d8,0xc9))[_0x233d('0x43')](handleError(_0x2f66d8,null));};exports[_0x233d('0x24')]=function(_0x28cca0,_0x249a99){if(_0x28cca0[_0x233d('0x49')]['id']){delete _0x28cca0[_0x233d('0x49')]['id'];}return db[_0x233d('0x45')][_0x233d('0x47')]({'where':{'id':_0x28cca0[_0x233d('0x44')]['id']}})[_0x233d('0x25')](handleEntityNotFound(_0x249a99,null))[_0x233d('0x25')](saveUpdates(_0x28cca0[_0x233d('0x49')],null))[_0x233d('0x25')](respondWithResult(_0x249a99,null))[_0x233d('0x43')](handleError(_0x249a99,null));};exports[_0x233d('0x26')]=function(_0x175284,_0x4f5f5a){return db['JscriptyProject'][_0x233d('0x47')]({'where':{'id':_0x175284[_0x233d('0x44')]['id']}})[_0x233d('0x25')](handleEntityNotFound(_0x4f5f5a,null))['then'](removeEntity(_0x4f5f5a,null))[_0x233d('0x43')](handleError(_0x4f5f5a,null));};exports[_0x233d('0x57')]=function(_0x26549e,_0x58b667,_0x1b6d0b){var _0x450c3d={'raw':!![],'where':{}};var _0x16384f={};var _0x12d26a={'count':0x0,'rows':[]};return db[_0x233d('0x45')][_0x233d('0x58')]({'where':{'id':_0x26549e[_0x233d('0x44')]['id']}})[_0x233d('0x25')](handleEntityNotFound(_0x58b667,null))[_0x233d('0x25')](function(_0x488d2b){if(_0x488d2b){_0x16384f[_0x233d('0x30')]=_[_0x233d('0x32')](db['JscriptySessionReport'][_0x233d('0x2e')]);_0x16384f[_0x233d('0x31')]=_['keys'](_0x26549e['query']);_0x16384f[_0x233d('0x33')]=_[_0x233d('0x34')](_0x16384f[_0x233d('0x30')],_0x16384f[_0x233d('0x31')]);_0x450c3d[_0x233d('0x35')]=_[_0x233d('0x34')](_0x16384f[_0x233d('0x30')],qs[_0x233d('0x36')](_0x26549e[_0x233d('0x31')][_0x233d('0x36')]));_0x450c3d[_0x233d('0x35')]=_0x450c3d['attributes']['length']?_0x450c3d[_0x233d('0x35')]:_0x16384f[_0x233d('0x30')];if(!_0x26549e[_0x233d('0x31')][_0x233d('0x38')](_0x233d('0x39'))){_0x450c3d[_0x233d('0x1d')]=qs[_0x233d('0x1d')](_0x26549e['query'][_0x233d('0x1d')]);_0x450c3d[_0x233d('0x1b')]=qs['offset'](_0x26549e['query'][_0x233d('0x1b')]);}_0x450c3d['order']=qs[_0x233d('0x3b')](_0x26549e[_0x233d('0x31')][_0x233d('0x3b')]);_0x450c3d[_0x233d('0x3c')]=qs[_0x233d('0x33')](_[_0x233d('0x3d')](_0x26549e[_0x233d('0x31')],_0x16384f[_0x233d('0x33')]));_0x450c3d['where'][_0x233d('0x59')]=_0x488d2b['id'];if(_0x26549e[_0x233d('0x31')][_0x233d('0x3e')]){_0x450c3d[_0x233d('0x3c')]=_['merge'](_0x450c3d[_0x233d('0x3c')],{'$or':_[_0x233d('0x2d')](_0x450c3d[_0x233d('0x35')],function(_0x47af2c){var _0x5e1fc8={};_0x5e1fc8[_0x47af2c]={'$like':'%'+_0x26549e[_0x233d('0x31')][_0x233d('0x3e')]+'%'};return _0x5e1fc8;})});}_0x450c3d=_[_0x233d('0x3f')]({},_0x450c3d,_0x26549e[_0x233d('0x46')]);return db[_0x233d('0x5a')][_0x233d('0x1e')]({'where':_0x450c3d[_0x233d('0x3c')]})[_0x233d('0x25')](function(_0xe34b6c){_0x12d26a[_0x233d('0x1e')]=_0xe34b6c;if(_0x26549e[_0x233d('0x31')]['includeAll']){_0x450c3d['include']=[{'all':!![]}];}return db[_0x233d('0x5a')][_0x233d('0x41')](_0x450c3d);})['then'](function(_0x55b5f4){_0x12d26a[_0x233d('0x42')]=_0x55b5f4;return _0x12d26a;});}})[_0x233d('0x25')](respondWithFilteredResult(_0x58b667,_0x450c3d))[_0x233d('0x43')](handleError(_0x58b667,null));};exports[_0x233d('0x5b')]=function(_0x3a98c9,_0x5f5848,_0x2779f4){var _0x2f019f={'raw':!![],'where':{}};var _0x593cf5={};var _0x56af6b={'count':0x0,'rows':[]};return db[_0x233d('0x45')][_0x233d('0x58')]({'where':{'id':_0x3a98c9[_0x233d('0x44')]['id']}})['then'](handleEntityNotFound(_0x5f5848,null))['then'](function(_0x2ad651){if(_0x2ad651){_0x593cf5[_0x233d('0x30')]=_['keys'](db[_0x233d('0x5c')][_0x233d('0x2e')]);_0x593cf5[_0x233d('0x31')]=_[_0x233d('0x32')](_0x3a98c9['query']);_0x593cf5[_0x233d('0x33')]=_[_0x233d('0x34')](_0x593cf5[_0x233d('0x30')],_0x593cf5['query']);_0x2f019f['attributes']=_[_0x233d('0x34')](_0x593cf5[_0x233d('0x30')],qs[_0x233d('0x36')](_0x3a98c9[_0x233d('0x31')][_0x233d('0x36')]));_0x2f019f['attributes']=_0x2f019f[_0x233d('0x35')][_0x233d('0x37')]?_0x2f019f[_0x233d('0x35')]:_0x593cf5[_0x233d('0x30')];if(!_0x3a98c9[_0x233d('0x31')][_0x233d('0x38')]('nolimit')){_0x2f019f['limit']=qs[_0x233d('0x1d')](_0x3a98c9['query']['limit']);_0x2f019f[_0x233d('0x1b')]=qs[_0x233d('0x1b')](_0x3a98c9[_0x233d('0x31')][_0x233d('0x1b')]);}_0x2f019f[_0x233d('0x3a')]=qs['sort'](_0x3a98c9['query'][_0x233d('0x3b')]);_0x2f019f[_0x233d('0x3c')]=qs['filters'](_[_0x233d('0x3d')](_0x3a98c9['query'],_0x593cf5[_0x233d('0x33')]));_0x2f019f[_0x233d('0x3c')]['ProjectId']=_0x2ad651['id'];if(_0x3a98c9[_0x233d('0x31')][_0x233d('0x3e')]){_0x2f019f[_0x233d('0x3c')]=_['merge'](_0x2f019f['where'],{'$or':_[_0x233d('0x2d')](_0x2f019f[_0x233d('0x35')],function(_0x3bbece){var _0x9e8a79={};_0x9e8a79[_0x3bbece]={'$like':'%'+_0x3a98c9[_0x233d('0x31')][_0x233d('0x3e')]+'%'};return _0x9e8a79;})});}_0x2f019f=_[_0x233d('0x3f')]({},_0x2f019f,_0x3a98c9[_0x233d('0x46')]);return db['JscriptyAnswerReport']['count']({'where':_0x2f019f[_0x233d('0x3c')]})['then'](function(_0x5f500d){_0x56af6b[_0x233d('0x1e')]=_0x5f500d;if(_0x3a98c9['query'][_0x233d('0x40')]){_0x2f019f[_0x233d('0x5d')]=[{'all':!![]}];}return db[_0x233d('0x5c')]['findAll'](_0x2f019f);})['then'](function(_0x30a152){_0x56af6b[_0x233d('0x42')]=_0x30a152;return _0x56af6b;});}})[_0x233d('0x25')](respondWithFilteredResult(_0x5f5848,_0x2f019f))[_0x233d('0x43')](handleError(_0x5f5848,null));};function char(_0x2ba944){return _0x233d('0x5e')===typeof _0x2ba944?String[_0x233d('0x5f')]['apply'](null,arguments):_0x2ba944;}function needsEncapsulation(_0x2165bf){return!!_0x2165bf&&(_0x2165bf[_0x233d('0x60')]()['indexOf'](char(0xd))>=0x0||_0x2165bf['toString']()[_0x233d('0x61')](char(0xa))>=0x0||_0x2165bf[_0x233d('0x60')]()[_0x233d('0x61')](char(0x2c))>=0x0||_0x2165bf[_0x233d('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x273068){var _0x1fc0e0=char(0x22),_0xd201c='\x5c'+char(0x22),_0x1d9bb3=_0x273068['toString']()[_0x233d('0x62')](new RegExp(_0x1fc0e0,'g'),_0xd201c);return _0x1fc0e0+_0x1d9bb3+_0x1fc0e0;}exports['getSummary']=function(_0x38c990,_0x1a5263,_0xa27322){var _0x1135a6,_0x88b88a;var _0x29bbe5={'where':{'ProjectId':_0x38c990[_0x233d('0x44')]['id']}};if(_0x38c990[_0x233d('0x31')][_0x233d('0x63')]){_0x29bbe5[_0x233d('0x3c')][_0x233d('0x64')]=JSON['parse'](_0x38c990[_0x233d('0x31')]['startTime']);}return db['JscriptySessionReport']['findAll'](_0x29bbe5)[_0x233d('0x25')](handleEntityNotFound(_0x1a5263,null))[_0x233d('0x25')](function(_0x197682){if(_0x197682){_0x1135a6=_0x197682;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x233d('0x2d')](_0x1135a6,'id')},'ProjectId':_0x38c990[_0x233d('0x44')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x1a5263,null))[_0x233d('0x25')](function(_0x29756c){if(_0x29756c){_0x88b88a=_0x29756c;var _0x3cfbbe={};for(var _0xdfc8af=0x0,_0x39c9bc=_0x88b88a[_0x233d('0x37')];_0xdfc8af<_0x39c9bc;_0xdfc8af++){if(!_0x3cfbbe[_0x233d('0x38')](_0x88b88a[_0xdfc8af][_0x233d('0x65')])){_0x3cfbbe[_0x88b88a[_0xdfc8af]['questionId']]=needsEncapsulation(_0x88b88a[_0xdfc8af][_0x233d('0x66')])?encapsulate(_0x88b88a[_0xdfc8af]['question']):_0x88b88a[_0xdfc8af]['question'];}}var _0x27d025=[],_0x3a9c7e={};for(var _0x1c986d=0x0,_0x18093f=_0x1135a6[_0x233d('0x37')];_0x1c986d<_0x18093f;_0x1c986d++){_0x3a9c7e={'ProjectId':_0x38c990[_0x233d('0x44')]['id'],'SessionId':_0x1135a6[_0x1c986d]['id'],'StartTime':moment(_0x1135a6[_0x1c986d][_0x233d('0x64')])[_0x233d('0x67')](_0x233d('0x68'))};for(var _0x5bceb8=0x0,_0x320a95=_0x88b88a[_0x233d('0x37')];_0x5bceb8<_0x320a95;_0x5bceb8++){if(_0x88b88a[_0x5bceb8]['SessionId']==_0x1135a6[_0x1c986d]['id']&&_0x3cfbbe['hasOwnProperty'](_0x88b88a[_0x5bceb8][_0x233d('0x65')])){_0x3a9c7e[_0x3cfbbe[_0x88b88a[_0x5bceb8][_0x233d('0x65')]]]=_0x88b88a[_0x5bceb8]['answer'];}}for(var _0x19ab74 in _0x3cfbbe){if(!_0x3a9c7e[_0x233d('0x38')](_0x3cfbbe[_0x19ab74])){_0x3a9c7e[_0x3cfbbe[_0x19ab74]]=null;}}_0x27d025[_0x233d('0x69')](_0x3a9c7e);}return _0x27d025;}})[_0x233d('0x25')](function(_0x32c1e6){if(!_[_0x233d('0x6a')](_0x32c1e6)){var _0x10f8eb=toCsv(_0x32c1e6);var _0x1c5dc3=Date[_0x233d('0x6b')]();fs[_0x233d('0x6c')](util[_0x233d('0x67')](_0x233d('0x6d'),_0x38c990[_0x233d('0x44')]['id'],_0x1c5dc3),_0x10f8eb);_0x1a5263[_0x233d('0x6e')](_0x233d('0x6f'),'attachment;\x20filename='+util[_0x233d('0x67')](_0x233d('0x70'),_0x38c990[_0x233d('0x44')]['id'],_0x1c5dc3));_0x1a5263[_0x233d('0x6e')](_0x233d('0x71'),_0x233d('0x72'));return _0x1a5263[_0x233d('0x73')](util[_0x233d('0x67')](_0x233d('0x6d'),_0x38c990[_0x233d('0x44')]['id'],_0x1c5dc3));}else{return _0x1a5263[_0x233d('0x17')](0xcc);}})[_0x233d('0x43')](handleError(_0x1a5263,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 7cf039c..5731380 100644 --- a/server/api/jscriptyProject/jscriptyProject.model.js +++ b/server/api/jscriptyProject/jscriptyProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85d8=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','JscriptyProject','jscripty_projects'];(function(_0x39d544,_0x4d2221){var _0x2c9446=function(_0x5d98c1){while(--_0x5d98c1){_0x39d544['push'](_0x39d544['shift']());}};_0x2c9446(++_0x4d2221);}(_0x85d8,0x1b0));var _0x885d=function(_0x311dda,_0x406196){_0x311dda=_0x311dda-0x0;var _0x52b38d=_0x85d8[_0x311dda];return _0x52b38d;};'use strict';var _=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var logger=require(_0x885d('0x2'))(_0x885d('0x3'));var moment=require(_0x885d('0x4'));var BPromise=require('bluebird');var rp=require(_0x885d('0x5'));var fs=require('fs');var path=require(_0x885d('0x6'));var rimraf=require(_0x885d('0x7'));var config=require(_0x885d('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x186504,_0x30dcc2){return _0x186504[_0x885d('0x9')](_0x885d('0xa'),attributes,{'tableName':_0x885d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cd3=['jscripty_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x2cd3,0xf1));var _0x32cd=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0x2cd3[_0x5a7e3c];return _0x59252b;};'use strict';var _=require(_0x32cd('0x0'));var util=require('util');var logger=require(_0x32cd('0x1'))(_0x32cd('0x2'));var moment=require(_0x32cd('0x3'));var BPromise=require(_0x32cd('0x4'));var rp=require(_0x32cd('0x5'));var fs=require('fs');var path=require(_0x32cd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x32cd('0x7'));module[_0x32cd('0x8')]=function(_0x1af8c8,_0x1024e0){return _0x1af8c8[_0x32cd('0x9')](_0x32cd('0xa'),attributes,{'tableName':_0x32cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 06faf9c..db76564 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x5c97da,_0x5e21bb){var _0x36834f=function(_0x1cf122){while(--_0x1cf122){_0x5c97da['push'](_0x5c97da['shift']());}};_0x36834f(++_0x5e21bb);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x57b8ff,_0x21e054){var _0x3a805e=function(_0x3d08b3){while(--_0x3d08b3){_0x57b8ff['push'](_0x57b8ff['shift']());}};_0x3a805e(++_0x21e054);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 0cb82f5..8b79e0a 100644 --- a/server/api/jscriptyQuestionReport/index.js +++ b/server/api/jscriptyQuestionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa080=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xa080,0x14f));var _0x0a08=function(_0x357633,_0x254610){_0x357633=_0x357633-0x0;var _0x261faf=_0xa080[_0x357633];return _0x261faf;};'use strict';var multer=require(_0x0a08('0x0'));var util=require(_0x0a08('0x1'));var path=require(_0x0a08('0x2'));var timeout=require(_0x0a08('0x3'));var express=require(_0x0a08('0x4'));var router=express[_0x0a08('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0a08('0x6'));var interaction=require(_0x0a08('0x7'));var config=require(_0x0a08('0x8'));var controller=require(_0x0a08('0x9'));router[_0x0a08('0xa')]('/',auth[_0x0a08('0xb')](),controller['index']);router[_0x0a08('0xa')]('/describe',auth[_0x0a08('0xb')](),controller[_0x0a08('0xc')]);router[_0x0a08('0xa')](_0x0a08('0xd'),auth[_0x0a08('0xb')](),controller[_0x0a08('0xe')]);router[_0x0a08('0xf')]('/',auth[_0x0a08('0xb')](),controller['create']);router[_0x0a08('0x10')](_0x0a08('0xd'),auth[_0x0a08('0xb')](),controller[_0x0a08('0x11')]);router[_0x0a08('0x12')](_0x0a08('0xd'),auth[_0x0a08('0xb')](),controller[_0x0a08('0x13')]);module[_0x0a08('0x14')]=router; \ No newline at end of file +var _0xd901=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','/describe','/:id','isAuthenticated','show','post','create','put'];(function(_0x3b69e3,_0x40bb88){var _0x1f5b5e=function(_0x4fdd01){while(--_0x4fdd01){_0x3b69e3['push'](_0x3b69e3['shift']());}};_0x1f5b5e(++_0x40bb88);}(_0xd901,0x1e4));var _0x1d90=function(_0x1b0b88,_0x342ca1){_0x1b0b88=_0x1b0b88-0x0;var _0x18d921=_0xd901[_0x1b0b88];return _0x18d921;};'use strict';var multer=require(_0x1d90('0x0'));var util=require('util');var path=require(_0x1d90('0x1'));var timeout=require(_0x1d90('0x2'));var express=require(_0x1d90('0x3'));var router=express[_0x1d90('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1d90('0x5'));var config=require('../../config/environment');var controller=require(_0x1d90('0x6'));router[_0x1d90('0x7')]('/',auth['isAuthenticated'](),controller[_0x1d90('0x8')]);router[_0x1d90('0x7')](_0x1d90('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x1d90('0x7')](_0x1d90('0xa'),auth[_0x1d90('0xb')](),controller[_0x1d90('0xc')]);router[_0x1d90('0xd')]('/',auth[_0x1d90('0xb')](),controller[_0x1d90('0xe')]);router[_0x1d90('0xf')](_0x1d90('0xa'),auth['isAuthenticated'](),controller[_0x1d90('0x10')]);router[_0x1d90('0x11')](_0x1d90('0xa'),auth['isAuthenticated'](),controller[_0x1d90('0x12')]);module[_0x1d90('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index df28c0f..750fb8a 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x2dff53,_0x1a2fe4){_0x2dff53=_0x2dff53-0x0;var _0x48851d=_0x7a54[_0x2dff53];return _0x48851d;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7a54,0x106));var _0x47a5=function(_0x1c618d,_0x261c6c){_0x1c618d=_0x1c618d-0x0;var _0x2e8719=_0x7a54[_0x1c618d];return _0x2e8719;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index a3e6b02..4a86ab7 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a9e=['map','JscriptyQuestionReport','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','send','index'];(function(_0x15ccc1,_0x3c0184){var _0x2188e4=function(_0x3b1116){while(--_0x3b1116){_0x15ccc1['push'](_0x15ccc1['shift']());}};_0x2188e4(++_0x3c0184);}(_0x5a9e,0x1e3));var _0xe5a9=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x5a9e[_0x45783c];return _0x1161da;};'use strict';var emlformat=require(_0xe5a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe5a9('0x1'));var jsonpatch=require(_0xe5a9('0x2'));var rp=require('request-promise');var moment=require(_0xe5a9('0x3'));var BPromise=require(_0xe5a9('0x4'));var Mustache=require('mustache');var util=require(_0xe5a9('0x5'));var path=require(_0xe5a9('0x6'));var sox=require('sox');var csv=require(_0xe5a9('0x7'));var ejs=require(_0xe5a9('0x8'));var fs=require('fs');var fs_extra=require(_0xe5a9('0x9'));var _=require(_0xe5a9('0xa'));var squel=require(_0xe5a9('0xb'));var crypto=require(_0xe5a9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe5a9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe5a9('0xe'));var Papa=require(_0xe5a9('0xf'));var Redis=require('ioredis');var authService=require(_0xe5a9('0x10'));var qs=require(_0xe5a9('0x11'));var as=require(_0xe5a9('0x12'));var hardwareService=require(_0xe5a9('0x13'));var logger=require(_0xe5a9('0x14'))('api');var utils=require(_0xe5a9('0x15'));var config=require(_0xe5a9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe5a9('0x17'))['db'];function respondWithStatusCode(_0x3d1e04,_0x1da387){_0x1da387=_0x1da387||0xcc;return function(_0x2d1a55){if(_0x2d1a55){return _0x3d1e04[_0xe5a9('0x18')](_0x1da387);}return _0x3d1e04[_0xe5a9('0x19')](_0x1da387)[_0xe5a9('0x1a')]();};}function respondWithResult(_0x53de83,_0x292208){_0x292208=_0x292208||0xc8;return function(_0x4ba9f3){if(_0x4ba9f3){return _0x53de83['status'](_0x292208)[_0xe5a9('0x1b')](_0x4ba9f3);}};}function respondWithFilteredResult(_0x4f63b3,_0x17a025){return function(_0xd22a7e){if(_0xd22a7e){var _0x86f6de=typeof _0x17a025[_0xe5a9('0x1c')]==='undefined'&&typeof _0x17a025[_0xe5a9('0x1d')]===_0xe5a9('0x1e');var _0xae7a81=_0xd22a7e[_0xe5a9('0x1f')];var _0x99fcd4=_0x86f6de?0x0:_0x17a025[_0xe5a9('0x1c')];var _0x2d95df=_0x86f6de?_0xd22a7e[_0xe5a9('0x1f')]:_0x17a025[_0xe5a9('0x1c')]+_0x17a025[_0xe5a9('0x1d')];var _0x1bc3cb;if(_0x2d95df>=_0xae7a81){_0x2d95df=_0xae7a81;_0x1bc3cb=0xc8;}else{_0x1bc3cb=0xce;}_0x4f63b3[_0xe5a9('0x19')](_0x1bc3cb);return _0x4f63b3[_0xe5a9('0x20')](_0xe5a9('0x21'),_0x99fcd4+'-'+_0x2d95df+'/'+_0xae7a81)[_0xe5a9('0x1b')](_0xd22a7e);}return null;};}function patchUpdates(_0x1fb875){return function(_0x28410a){try{jsonpatch[_0xe5a9('0x22')](_0x28410a,_0x1fb875,!![]);}catch(_0x345f6d){return BPromise[_0xe5a9('0x23')](_0x345f6d);}return _0x28410a[_0xe5a9('0x24')]();};}function saveUpdates(_0xb6cf40,_0x5f0324){return function(_0x5ca3b0){if(_0x5ca3b0){return _0x5ca3b0['update'](_0xb6cf40)['then'](function(_0x75059e){return _0x75059e;});}return null;};}function removeEntity(_0x1c81fb,_0x34fdeb){return function(_0x1fbe9d){if(_0x1fbe9d){return _0x1fbe9d[_0xe5a9('0x25')]()[_0xe5a9('0x26')](function(){_0x1c81fb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20ea97,_0x14235f){return function(_0x3de59a){if(!_0x3de59a){_0x20ea97[_0xe5a9('0x18')](0x194);}return _0x3de59a;};}function handleError(_0x1ae87f,_0x4bcb02){_0x4bcb02=_0x4bcb02||0x1f4;return function(_0x32475d){logger[_0xe5a9('0x27')](_0x32475d['stack']);if(_0x32475d['name']){delete _0x32475d['name'];}_0x1ae87f['status'](_0x4bcb02)[_0xe5a9('0x28')](_0x32475d);};}exports[_0xe5a9('0x29')]=function(_0x59fec7,_0x185e02){var _0x42aa0c={},_0x5c9ce3={},_0x48684c={'count':0x0,'rows':[]};var _0x24b22e=_[_0xe5a9('0x2a')](db[_0xe5a9('0x2b')]['rawAttributes'],function(_0x436878){return{'name':_0x436878['fieldName'],'type':_0x436878[_0xe5a9('0x2c')][_0xe5a9('0x2d')]};});_0x5c9ce3['model']=_[_0xe5a9('0x2a')](_0x24b22e,_0xe5a9('0x2e'));_0x5c9ce3[_0xe5a9('0x2f')]=_[_0xe5a9('0x30')](_0x59fec7[_0xe5a9('0x2f')]);_0x5c9ce3[_0xe5a9('0x31')]=_[_0xe5a9('0x32')](_0x5c9ce3[_0xe5a9('0x33')],_0x5c9ce3[_0xe5a9('0x2f')]);_0x42aa0c['attributes']=_['intersection'](_0x5c9ce3[_0xe5a9('0x33')],qs['fields'](_0x59fec7['query'][_0xe5a9('0x34')]));_0x42aa0c['attributes']=_0x42aa0c[_0xe5a9('0x35')][_0xe5a9('0x36')]?_0x42aa0c['attributes']:_0x5c9ce3[_0xe5a9('0x33')];if(!_0x59fec7[_0xe5a9('0x2f')][_0xe5a9('0x37')](_0xe5a9('0x38'))){_0x42aa0c[_0xe5a9('0x1d')]=qs[_0xe5a9('0x1d')](_0x59fec7['query'][_0xe5a9('0x1d')]);_0x42aa0c[_0xe5a9('0x1c')]=qs['offset'](_0x59fec7[_0xe5a9('0x2f')][_0xe5a9('0x1c')]);}_0x42aa0c[_0xe5a9('0x39')]=qs[_0xe5a9('0x3a')](_0x59fec7[_0xe5a9('0x2f')][_0xe5a9('0x3a')]);_0x42aa0c[_0xe5a9('0x3b')]=qs['filters'](_[_0xe5a9('0x3c')](_0x59fec7[_0xe5a9('0x2f')],_0x5c9ce3[_0xe5a9('0x31')]),_0x24b22e);if(_0x59fec7[_0xe5a9('0x2f')][_0xe5a9('0x3d')]){_0x42aa0c['where']=_[_0xe5a9('0x3e')](_0x42aa0c[_0xe5a9('0x3b')],{'$or':_['map'](_0x24b22e,function(_0x45c45a){if(_0x45c45a['type']!=='VIRTUAL'){var _0x40172d={};_0x40172d[_0x45c45a[_0xe5a9('0x2e')]]={'$like':'%'+_0x59fec7[_0xe5a9('0x2f')][_0xe5a9('0x3d')]+'%'};return _0x40172d;}})});}_0x42aa0c=_[_0xe5a9('0x3e')]({},_0x42aa0c,_0x59fec7[_0xe5a9('0x3f')]);var _0x35cf8c={'where':_0x42aa0c[_0xe5a9('0x3b')]};return db[_0xe5a9('0x2b')][_0xe5a9('0x1f')](_0x35cf8c)['then'](function(_0x3094f6){_0x48684c[_0xe5a9('0x1f')]=_0x3094f6;if(_0x59fec7[_0xe5a9('0x2f')][_0xe5a9('0x40')]){_0x42aa0c[_0xe5a9('0x41')]=[{'all':!![]}];}return db[_0xe5a9('0x2b')][_0xe5a9('0x42')](_0x42aa0c);})[_0xe5a9('0x26')](function(_0xc06461){_0x48684c[_0xe5a9('0x43')]=_0xc06461;return _0x48684c;})[_0xe5a9('0x26')](respondWithFilteredResult(_0x185e02,_0x42aa0c))['catch'](handleError(_0x185e02,null));};exports[_0xe5a9('0x44')]=function(_0xce3cc9,_0x525f0b){var _0x26f160={'raw':!![],'where':{'id':_0xce3cc9[_0xe5a9('0x45')]['id']}},_0x578415={};_0x578415[_0xe5a9('0x33')]=_['keys'](db[_0xe5a9('0x2b')]['rawAttributes']);_0x578415[_0xe5a9('0x2f')]=_[_0xe5a9('0x30')](_0xce3cc9['query']);_0x578415['filters']=_['intersection'](_0x578415['model'],_0x578415[_0xe5a9('0x2f')]);_0x26f160[_0xe5a9('0x35')]=_[_0xe5a9('0x32')](_0x578415[_0xe5a9('0x33')],qs[_0xe5a9('0x34')](_0xce3cc9[_0xe5a9('0x2f')][_0xe5a9('0x34')]));_0x26f160[_0xe5a9('0x35')]=_0x26f160[_0xe5a9('0x35')]['length']?_0x26f160[_0xe5a9('0x35')]:_0x578415['model'];if(_0xce3cc9[_0xe5a9('0x2f')][_0xe5a9('0x40')]){_0x26f160['include']=[{'all':!![]}];}_0x26f160=_[_0xe5a9('0x3e')]({},_0x26f160,_0xce3cc9['options']);return db[_0xe5a9('0x2b')]['find'](_0x26f160)[_0xe5a9('0x26')](handleEntityNotFound(_0x525f0b,null))[_0xe5a9('0x26')](respondWithResult(_0x525f0b,null))[_0xe5a9('0x46')](handleError(_0x525f0b,null));};exports[_0xe5a9('0x47')]=function(_0x27078e,_0x2f3d31){return db[_0xe5a9('0x2b')]['create'](_0x27078e[_0xe5a9('0x48')],{})[_0xe5a9('0x26')](respondWithResult(_0x2f3d31,0xc9))[_0xe5a9('0x46')](handleError(_0x2f3d31,null));};exports['update']=function(_0x13c8c5,_0x83f8dd){if(_0x13c8c5[_0xe5a9('0x48')]['id']){delete _0x13c8c5[_0xe5a9('0x48')]['id'];}return db[_0xe5a9('0x2b')][_0xe5a9('0x49')]({'where':{'id':_0x13c8c5[_0xe5a9('0x45')]['id']}})[_0xe5a9('0x26')](handleEntityNotFound(_0x83f8dd,null))['then'](saveUpdates(_0x13c8c5[_0xe5a9('0x48')],null))['then'](respondWithResult(_0x83f8dd,null))['catch'](handleError(_0x83f8dd,null));};exports[_0xe5a9('0x25')]=function(_0x9eaa0b,_0x53059e){return db[_0xe5a9('0x2b')][_0xe5a9('0x49')]({'where':{'id':_0x9eaa0b['params']['id']}})[_0xe5a9('0x26')](handleEntityNotFound(_0x53059e,null))[_0xe5a9('0x26')](removeEntity(_0x53059e,null))['catch'](handleError(_0x53059e,null));};exports[_0xe5a9('0x4a')]=function(_0x34426f,_0x130274){return db['JscriptyQuestionReport'][_0xe5a9('0x4a')]()[_0xe5a9('0x26')](respondWithResult(_0x130274,null))[_0xe5a9('0x46')](handleError(_0x130274,null));}; \ No newline at end of file +var _0x539d=['then','sendStatus','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','fields','includeAll','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update'];(function(_0x596cdd,_0x939916){var _0x5b65ab=function(_0x465562){while(--_0x465562){_0x596cdd['push'](_0x596cdd['shift']());}};_0x5b65ab(++_0x939916);}(_0x539d,0x75));var _0xd539=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x539d[_0x4709c8];return _0x478cdd;};'use strict';var emlformat=require(_0xd539('0x0'));var rimraf=require(_0xd539('0x1'));var zipdir=require(_0xd539('0x2'));var jsonpatch=require(_0xd539('0x3'));var rp=require(_0xd539('0x4'));var moment=require(_0xd539('0x5'));var BPromise=require(_0xd539('0x6'));var Mustache=require(_0xd539('0x7'));var util=require(_0xd539('0x8'));var path=require(_0xd539('0x9'));var sox=require(_0xd539('0xa'));var csv=require(_0xd539('0xb'));var ejs=require(_0xd539('0xc'));var fs=require('fs');var fs_extra=require(_0xd539('0xd'));var _=require(_0xd539('0xe'));var squel=require(_0xd539('0xf'));var crypto=require(_0xd539('0x10'));var jsforce=require(_0xd539('0x11'));var deskjs=require(_0xd539('0x12'));var toCsv=require(_0xd539('0xb'));var querystring=require(_0xd539('0x13'));var Papa=require('papaparse');var Redis=require(_0xd539('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xd539('0x15'));var as=require(_0xd539('0x16'));var hardwareService=require(_0xd539('0x17'));var logger=require(_0xd539('0x18'))(_0xd539('0x19'));var utils=require(_0xd539('0x1a'));var config=require(_0xd539('0x1b'));var licenseUtil=require(_0xd539('0x1c'));var db=require(_0xd539('0x1d'))['db'];function respondWithStatusCode(_0x46c7a3,_0x129ac7){_0x129ac7=_0x129ac7||0xcc;return function(_0x33335b){if(_0x33335b){return _0x46c7a3['sendStatus'](_0x129ac7);}return _0x46c7a3[_0xd539('0x1e')](_0x129ac7)[_0xd539('0x1f')]();};}function respondWithResult(_0x417ae1,_0xe51993){_0xe51993=_0xe51993||0xc8;return function(_0x14aacd){if(_0x14aacd){return _0x417ae1['status'](_0xe51993)[_0xd539('0x20')](_0x14aacd);}};}function respondWithFilteredResult(_0x599a78,_0x51d2b6){return function(_0x2f4d60){if(_0x2f4d60){var _0x531677=typeof _0x51d2b6[_0xd539('0x21')]===_0xd539('0x22')&&typeof _0x51d2b6[_0xd539('0x23')]===_0xd539('0x22');var _0x2a9e1e=_0x2f4d60[_0xd539('0x24')];var _0x1119a7=_0x531677?0x0:_0x51d2b6['offset'];var _0x209294=_0x531677?_0x2f4d60[_0xd539('0x24')]:_0x51d2b6[_0xd539('0x21')]+_0x51d2b6[_0xd539('0x23')];var _0x2487c5;if(_0x209294>=_0x2a9e1e){_0x209294=_0x2a9e1e;_0x2487c5=0xc8;}else{_0x2487c5=0xce;}_0x599a78[_0xd539('0x1e')](_0x2487c5);return _0x599a78['set']('Content-Range',_0x1119a7+'-'+_0x209294+'/'+_0x2a9e1e)[_0xd539('0x20')](_0x2f4d60);}return null;};}function patchUpdates(_0x44dba4){return function(_0x3fc90d){try{jsonpatch[_0xd539('0x25')](_0x3fc90d,_0x44dba4,!![]);}catch(_0x593bf4){return BPromise[_0xd539('0x26')](_0x593bf4);}return _0x3fc90d[_0xd539('0x27')]();};}function saveUpdates(_0x49ce16,_0x4f9184){return function(_0x583f84){if(_0x583f84){return _0x583f84[_0xd539('0x28')](_0x49ce16)[_0xd539('0x29')](function(_0xf77f56){return _0xf77f56;});}return null;};}function removeEntity(_0xfa267c,_0x13a124){return function(_0x417bc2){if(_0x417bc2){return _0x417bc2['destroy']()['then'](function(){_0xfa267c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3caf4d,_0x351b2d){return function(_0x2afda0){if(!_0x2afda0){_0x3caf4d[_0xd539('0x2a')](0x194);}return _0x2afda0;};}function handleError(_0x4ec443,_0xa2f46a){_0xa2f46a=_0xa2f46a||0x1f4;return function(_0x117183){logger[_0xd539('0x2b')](_0x117183[_0xd539('0x2c')]);if(_0x117183['name']){delete _0x117183[_0xd539('0x2d')];}_0x4ec443['status'](_0xa2f46a)[_0xd539('0x2e')](_0x117183);};}exports[_0xd539('0x2f')]=function(_0x2c9df9,_0x47710e){var _0x538f6e={},_0x572115={},_0x30f6f9={'count':0x0,'rows':[]};var _0x1afd52=_['map'](db[_0xd539('0x30')][_0xd539('0x31')],function(_0x43a0b1){return{'name':_0x43a0b1[_0xd539('0x32')],'type':_0x43a0b1['type'][_0xd539('0x33')]};});_0x572115[_0xd539('0x34')]=_[_0xd539('0x35')](_0x1afd52,_0xd539('0x2d'));_0x572115[_0xd539('0x36')]=_[_0xd539('0x37')](_0x2c9df9[_0xd539('0x36')]);_0x572115[_0xd539('0x38')]=_[_0xd539('0x39')](_0x572115[_0xd539('0x34')],_0x572115[_0xd539('0x36')]);_0x538f6e['attributes']=_[_0xd539('0x39')](_0x572115[_0xd539('0x34')],qs['fields'](_0x2c9df9[_0xd539('0x36')]['fields']));_0x538f6e[_0xd539('0x3a')]=_0x538f6e[_0xd539('0x3a')][_0xd539('0x3b')]?_0x538f6e[_0xd539('0x3a')]:_0x572115[_0xd539('0x34')];if(!_0x2c9df9[_0xd539('0x36')]['hasOwnProperty']('nolimit')){_0x538f6e[_0xd539('0x23')]=qs[_0xd539('0x23')](_0x2c9df9[_0xd539('0x36')]['limit']);_0x538f6e[_0xd539('0x21')]=qs['offset'](_0x2c9df9[_0xd539('0x36')][_0xd539('0x21')]);}_0x538f6e['order']=qs[_0xd539('0x3c')](_0x2c9df9['query'][_0xd539('0x3c')]);_0x538f6e[_0xd539('0x3d')]=qs['filters'](_[_0xd539('0x3e')](_0x2c9df9[_0xd539('0x36')],_0x572115['filters']),_0x1afd52);if(_0x2c9df9[_0xd539('0x36')][_0xd539('0x3f')]){_0x538f6e[_0xd539('0x3d')]=_[_0xd539('0x40')](_0x538f6e[_0xd539('0x3d')],{'$or':_['map'](_0x1afd52,function(_0x36a7e0){if(_0x36a7e0[_0xd539('0x41')]!==_0xd539('0x42')){var _0x57aa18={};_0x57aa18[_0x36a7e0[_0xd539('0x2d')]]={'$like':'%'+_0x2c9df9['query'][_0xd539('0x3f')]+'%'};return _0x57aa18;}})});}_0x538f6e=_[_0xd539('0x40')]({},_0x538f6e,_0x2c9df9[_0xd539('0x43')]);var _0x25b0eb={'where':_0x538f6e[_0xd539('0x3d')]};return db[_0xd539('0x30')]['count'](_0x25b0eb)[_0xd539('0x29')](function(_0x3d5d01){_0x30f6f9[_0xd539('0x24')]=_0x3d5d01;if(_0x2c9df9[_0xd539('0x36')]['includeAll']){_0x538f6e[_0xd539('0x44')]=[{'all':!![]}];}return db[_0xd539('0x30')][_0xd539('0x45')](_0x538f6e);})[_0xd539('0x29')](function(_0x2809b4){_0x30f6f9[_0xd539('0x46')]=_0x2809b4;return _0x30f6f9;})['then'](respondWithFilteredResult(_0x47710e,_0x538f6e))[_0xd539('0x47')](handleError(_0x47710e,null));};exports['show']=function(_0x27c75c,_0x5eb19f){var _0x13cc3b={'raw':!![],'where':{'id':_0x27c75c['params']['id']}},_0x520658={};_0x520658[_0xd539('0x34')]=_[_0xd539('0x37')](db[_0xd539('0x30')][_0xd539('0x31')]);_0x520658[_0xd539('0x36')]=_[_0xd539('0x37')](_0x27c75c[_0xd539('0x36')]);_0x520658[_0xd539('0x38')]=_[_0xd539('0x39')](_0x520658[_0xd539('0x34')],_0x520658[_0xd539('0x36')]);_0x13cc3b['attributes']=_[_0xd539('0x39')](_0x520658['model'],qs[_0xd539('0x48')](_0x27c75c['query'][_0xd539('0x48')]));_0x13cc3b['attributes']=_0x13cc3b[_0xd539('0x3a')][_0xd539('0x3b')]?_0x13cc3b[_0xd539('0x3a')]:_0x520658[_0xd539('0x34')];if(_0x27c75c[_0xd539('0x36')][_0xd539('0x49')]){_0x13cc3b[_0xd539('0x44')]=[{'all':!![]}];}_0x13cc3b=_['merge']({},_0x13cc3b,_0x27c75c[_0xd539('0x43')]);return db[_0xd539('0x30')]['find'](_0x13cc3b)[_0xd539('0x29')](handleEntityNotFound(_0x5eb19f,null))[_0xd539('0x29')](respondWithResult(_0x5eb19f,null))[_0xd539('0x47')](handleError(_0x5eb19f,null));};exports[_0xd539('0x4a')]=function(_0x424000,_0x4e3cb6){return db[_0xd539('0x30')][_0xd539('0x4a')](_0x424000[_0xd539('0x4b')],{})[_0xd539('0x29')](respondWithResult(_0x4e3cb6,0xc9))['catch'](handleError(_0x4e3cb6,null));};exports['update']=function(_0x56c57f,_0x20d82b){if(_0x56c57f[_0xd539('0x4b')]['id']){delete _0x56c57f[_0xd539('0x4b')]['id'];}return db[_0xd539('0x30')][_0xd539('0x4c')]({'where':{'id':_0x56c57f[_0xd539('0x4d')]['id']}})[_0xd539('0x29')](handleEntityNotFound(_0x20d82b,null))[_0xd539('0x29')](saveUpdates(_0x56c57f['body'],null))[_0xd539('0x29')](respondWithResult(_0x20d82b,null))['catch'](handleError(_0x20d82b,null));};exports['destroy']=function(_0x354b0c,_0x523ebe){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x354b0c['params']['id']}})[_0xd539('0x29')](handleEntityNotFound(_0x523ebe,null))[_0xd539('0x29')](removeEntity(_0x523ebe,null))[_0xd539('0x47')](handleError(_0x523ebe,null));};exports[_0xd539('0x4e')]=function(_0x17d48e,_0x436f79){return db['JscriptyQuestionReport'][_0xd539('0x4e')]()[_0xd539('0x29')](respondWithResult(_0x436f79,null))[_0xd539('0x47')](handleError(_0x436f79,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 29bcc2f..bfaac0e 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa10c=['bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0xa10c,0xd4));var _0xca10=function(_0x2be933,_0x5e4ce9){_0x2be933=_0x2be933-0x0;var _0x4582a9=_0xa10c[_0x2be933];return _0x4582a9;};'use strict';var _=require('lodash');var util=require(_0xca10('0x0'));var logger=require(_0xca10('0x1'))(_0xca10('0x2'));var moment=require(_0xca10('0x3'));var BPromise=require(_0xca10('0x4'));var rp=require(_0xca10('0x5'));var fs=require('fs');var path=require(_0xca10('0x6'));var rimraf=require(_0xca10('0x7'));var config=require(_0xca10('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xca10('0x9')]=function(_0xa5ee60,_0x106032){return _0xa5ee60['define'](_0xca10('0xa'),attributes,{'tableName':_0xca10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6156=['define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x2bcc16,_0x1dbcef){var _0x3c4d92=function(_0xefbbfd){while(--_0xefbbfd){_0x2bcc16['push'](_0x2bcc16['shift']());}};_0x3c4d92(++_0x1dbcef);}(_0x6156,0x13b));var _0x6615=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x6156[_0x4ae625];return _0x31accf;};'use strict';var _=require('lodash');var util=require(_0x6615('0x0'));var logger=require(_0x6615('0x1'))(_0x6615('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6615('0x3'));var fs=require('fs');var path=require(_0x6615('0x4'));var rimraf=require(_0x6615('0x5'));var config=require(_0x6615('0x6'));var attributes=require(_0x6615('0x7'));module[_0x6615('0x8')]=function(_0x5c47d9,_0x4b1a5a){return _0x5c47d9[_0x6615('0x9')](_0x6615('0xa'),attributes,{'tableName':_0x6615('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 404d4d7..41027d7 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7cb=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4a6c7d,_0x5881c1){var _0x49a9a5=function(_0x205bc7){while(--_0x205bc7){_0x4a6c7d['push'](_0x4a6c7d['shift']());}};_0x49a9a5(++_0x5881c1);}(_0xd7cb,0x1ae));var _0xbd7c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd7cb[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xbd7c('0x0'));var moment=require(_0xbd7c('0x1'));var BPromise=require(_0xbd7c('0x2'));var rs=require(_0xbd7c('0x3'));var fs=require('fs');var Redis=require(_0xbd7c('0x4'));var db=require(_0xbd7c('0x5'))['db'];var utils=require(_0xbd7c('0x6'));var logger=require(_0xbd7c('0x7'))('rpc');var config=require(_0xbd7c('0x8'));var jayson=require(_0xbd7c('0x9'));var client=jayson[_0xbd7c('0xa')][_0xbd7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x395f93,_0x4a919f,_0x3f0937){return new BPromise(function(_0x5ab3ec,_0x92ecf0){return client[_0xbd7c('0xc')](_0x395f93,_0x3f0937)[_0xbd7c('0xd')](function(_0x2a6e44){logger[_0xbd7c('0xe')](_0xbd7c('0xf'),_0x4a919f,_0xbd7c('0x10'));logger[_0xbd7c('0x11')](_0xbd7c('0x12'),_0x4a919f,_0xbd7c('0x10'),JSON['stringify'](_0x2a6e44));if(_0x2a6e44[_0xbd7c('0x13')]){if(_0x2a6e44['error'][_0xbd7c('0x14')]===0x1f4){logger[_0xbd7c('0x13')](_0xbd7c('0xf'),_0x4a919f,_0x2a6e44[_0xbd7c('0x13')]['message']);return _0x92ecf0(_0x2a6e44['error'][_0xbd7c('0x15')]);}logger[_0xbd7c('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4a919f,_0x2a6e44['error'][_0xbd7c('0x15')]);return _0x5ab3ec(_0x2a6e44[_0xbd7c('0x13')][_0xbd7c('0x15')]);}else{logger['info'](_0xbd7c('0xf'),_0x4a919f,_0xbd7c('0x10'));_0x5ab3ec(_0x2a6e44['result']['message']);}})[_0xbd7c('0x16')](function(_0x1c0993){logger[_0xbd7c('0x13')](_0xbd7c('0xf'),_0x4a919f,_0x1c0993);_0x92ecf0(_0x1c0993);});});} \ No newline at end of file +var _0x08cf=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','catch','lodash'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x08cf,0x153));var _0xf08c=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x08cf[_0x413727];return _0x5f46d7;};'use strict';var _=require(_0xf08c('0x0'));var util=require(_0xf08c('0x1'));var moment=require(_0xf08c('0x2'));var BPromise=require(_0xf08c('0x3'));var rs=require(_0xf08c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf08c('0x5'));var logger=require(_0xf08c('0x6'))('rpc');var config=require(_0xf08c('0x7'));var jayson=require(_0xf08c('0x8'));var client=jayson[_0xf08c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x215edf,_0x424b8d,_0x11bf0e){return new BPromise(function(_0x5ae4df,_0x20e687){return client[_0xf08c('0xa')](_0x215edf,_0x11bf0e)[_0xf08c('0xb')](function(_0x2687af){logger[_0xf08c('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x424b8d,_0xf08c('0xd'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x424b8d,_0xf08c('0xd'),JSON[_0xf08c('0xe')](_0x2687af));if(_0x2687af[_0xf08c('0xf')]){if(_0x2687af['error'][_0xf08c('0x10')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x424b8d,_0x2687af['error']['message']);return _0x20e687(_0x2687af['error'][_0xf08c('0x11')]);}logger[_0xf08c('0xf')](_0xf08c('0x12'),_0x424b8d,_0x2687af[_0xf08c('0xf')][_0xf08c('0x11')]);return _0x5ae4df(_0x2687af[_0xf08c('0xf')][_0xf08c('0x11')]);}else{logger[_0xf08c('0xc')](_0xf08c('0x12'),_0x424b8d,'request\x20sent');_0x5ae4df(_0x2687af['result'][_0xf08c('0x11')]);}})[_0xf08c('0x13')](function(_0x287e5b){logger[_0xf08c('0xf')](_0xf08c('0x12'),_0x424b8d,_0x287e5b);_0x20e687(_0x287e5b);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 94e28bf..32043c4 100644 --- a/server/api/jscriptySessionReport/index.js +++ b/server/api/jscriptySessionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2a3=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','/describe','isAuthenticated','describe','get','/:id','/:id/questions','create','put','delete','destroy','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc2a3,0x1f4));var _0x3c2a=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0xc2a3[_0x57645b];return _0xe82f00;};'use strict';var multer=require(_0x3c2a('0x0'));var util=require('util');var path=require(_0x3c2a('0x1'));var timeout=require(_0x3c2a('0x2'));var express=require(_0x3c2a('0x3'));var router=express['Router']();var fs_extra=require(_0x3c2a('0x4'));var auth=require(_0x3c2a('0x5'));var interaction=require(_0x3c2a('0x6'));var config=require(_0x3c2a('0x7'));var controller=require(_0x3c2a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3c2a('0x9'),auth[_0x3c2a('0xa')](),controller[_0x3c2a('0xb')]);router[_0x3c2a('0xc')](_0x3c2a('0xd'),auth[_0x3c2a('0xa')](),controller['show']);router[_0x3c2a('0xc')](_0x3c2a('0xe'),auth[_0x3c2a('0xa')](),controller['getQuestions']);router['post']('/',auth[_0x3c2a('0xa')](),controller[_0x3c2a('0xf')]);router[_0x3c2a('0x10')](_0x3c2a('0xd'),auth[_0x3c2a('0xa')](),controller['update']);router[_0x3c2a('0x11')]('/:id',auth[_0x3c2a('0xa')](),controller[_0x3c2a('0x12')]);module[_0x3c2a('0x13')]=router; \ No newline at end of file +var _0xf509=['isAuthenticated','/describe','describe','/:id','getQuestions','post','create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0xf509,0x1ea));var _0x9f50=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xf509[_0x56482c];return _0x5aae7a;};'use strict';var multer=require('multer');var util=require(_0x9f50('0x0'));var path=require(_0x9f50('0x1'));var timeout=require('connect-timeout');var express=require(_0x9f50('0x2'));var router=express[_0x9f50('0x3')]();var fs_extra=require(_0x9f50('0x4'));var auth=require(_0x9f50('0x5'));var interaction=require(_0x9f50('0x6'));var config=require(_0x9f50('0x7'));var controller=require(_0x9f50('0x8'));router[_0x9f50('0x9')]('/',auth[_0x9f50('0xa')](),controller['index']);router['get'](_0x9f50('0xb'),auth[_0x9f50('0xa')](),controller[_0x9f50('0xc')]);router['get'](_0x9f50('0xd'),auth[_0x9f50('0xa')](),controller['show']);router[_0x9f50('0x9')]('/:id/questions',auth['isAuthenticated'](),controller[_0x9f50('0xe')]);router[_0x9f50('0xf')]('/',auth[_0x9f50('0xa')](),controller[_0x9f50('0x10')]);router['put'](_0x9f50('0xd'),auth[_0x9f50('0xa')](),controller['update']);router[_0x9f50('0x11')](_0x9f50('0xd'),auth['isAuthenticated'](),controller[_0x9f50('0x12')]);module[_0x9f50('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f015676..eb58161 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9f2=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue'];(function(_0x773893,_0x37802c){var _0x1a387c=function(_0x27388e){while(--_0x27388e){_0x773893['push'](_0x773893['shift']());}};_0x1a387c(++_0x37802c);}(_0xe9f2,0x10f));var _0x2e9f=function(_0x3a7811,_0xec4803){_0x3a7811=_0x3a7811-0x0;var _0x134845=_0xe9f2[_0x3a7811];return _0x134845;};'use strict';var moment=require(_0x2e9f('0x0'));var Sequelize=require(_0x2e9f('0x1'));module[_0x2e9f('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x25fb99){this[_0x2e9f('0x3')](_0x2e9f('0x4'),_0x25fb99);this[_0x2e9f('0x3')](_0x2e9f('0x5'),moment()[_0x2e9f('0x6')](_0x2e9f('0x7')));}},'endtime':{'type':Sequelize[_0x2e9f('0x8')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2e9f('0x9')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2e9f('0x9')]},'calleridnum':{'type':Sequelize[_0x2e9f('0x9')]},'completed':{'type':Sequelize[_0x2e9f('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0xd566=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format'];(function(_0x1c7950,_0xe5cb27){var _0x1954e0=function(_0xb48460){while(--_0xb48460){_0x1c7950['push'](_0x1c7950['shift']());}};_0x1954e0(++_0xe5cb27);}(_0xd566,0x8e));var _0x6d56=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd566[_0x19950b];return _0x3c6b41;};'use strict';var moment=require(_0x6d56('0x0'));var Sequelize=require(_0x6d56('0x1'));module[_0x6d56('0x2')]={'starttime':{'type':Sequelize[_0x6d56('0x3')],'set':function(_0x505be2){this[_0x6d56('0x4')](_0x6d56('0x5'),_0x505be2);this[_0x6d56('0x4')](_0x6d56('0x6'),moment()[_0x6d56('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x6d56('0x8')]},'projectname':{'type':Sequelize[_0x6d56('0x8')]},'queue':{'type':Sequelize[_0x6d56('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x6d56('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 01006ea..3fb54ff 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cfc=['end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','stack','name','map','JscriptySessionReport','rawAttributes','fieldName','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','params','keys','intersection','includeAll','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cfc,0xd6));var _0xc1cf=function(_0x4b6024,_0x258994){_0x4b6024=_0x4b6024-0x0;var _0x3557ec=_0x1cfc[_0x4b6024];return _0x3557ec;};'use strict';var emlformat=require(_0xc1cf('0x0'));var rimraf=require(_0xc1cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1cf('0x2'));var rp=require(_0xc1cf('0x3'));var moment=require(_0xc1cf('0x4'));var BPromise=require(_0xc1cf('0x5'));var Mustache=require(_0xc1cf('0x6'));var util=require(_0xc1cf('0x7'));var path=require(_0xc1cf('0x8'));var sox=require(_0xc1cf('0x9'));var csv=require(_0xc1cf('0xa'));var ejs=require(_0xc1cf('0xb'));var fs=require('fs');var fs_extra=require(_0xc1cf('0xc'));var _=require(_0xc1cf('0xd'));var squel=require(_0xc1cf('0xe'));var crypto=require('crypto');var jsforce=require(_0xc1cf('0xf'));var deskjs=require(_0xc1cf('0x10'));var toCsv=require(_0xc1cf('0xa'));var querystring=require(_0xc1cf('0x11'));var Papa=require(_0xc1cf('0x12'));var Redis=require(_0xc1cf('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1cf('0x14'));var logger=require('../../config/logger')(_0xc1cf('0x15'));var utils=require(_0xc1cf('0x16'));var config=require(_0xc1cf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1cf('0x18'))['db'];function respondWithStatusCode(_0x3a0501,_0x337022){_0x337022=_0x337022||0xcc;return function(_0x4c04e7){if(_0x4c04e7){return _0x3a0501[_0xc1cf('0x19')](_0x337022);}return _0x3a0501['status'](_0x337022)[_0xc1cf('0x1a')]();};}function respondWithResult(_0x189a95,_0xf251e8){_0xf251e8=_0xf251e8||0xc8;return function(_0x3d6c8f){if(_0x3d6c8f){return _0x189a95[_0xc1cf('0x1b')](_0xf251e8)['json'](_0x3d6c8f);}};}function respondWithFilteredResult(_0x3e320f,_0x3033d6){return function(_0x2b6fbe){if(_0x2b6fbe){var _0x4fad1e=typeof _0x3033d6[_0xc1cf('0x1c')]===_0xc1cf('0x1d')&&typeof _0x3033d6[_0xc1cf('0x1e')]===_0xc1cf('0x1d');var _0x484049=_0x2b6fbe['count'];var _0x3f52d7=_0x4fad1e?0x0:_0x3033d6[_0xc1cf('0x1c')];var _0x309abe=_0x4fad1e?_0x2b6fbe[_0xc1cf('0x1f')]:_0x3033d6['offset']+_0x3033d6[_0xc1cf('0x1e')];var _0x4ecbb4;if(_0x309abe>=_0x484049){_0x309abe=_0x484049;_0x4ecbb4=0xc8;}else{_0x4ecbb4=0xce;}_0x3e320f[_0xc1cf('0x1b')](_0x4ecbb4);return _0x3e320f[_0xc1cf('0x20')](_0xc1cf('0x21'),_0x3f52d7+'-'+_0x309abe+'/'+_0x484049)[_0xc1cf('0x22')](_0x2b6fbe);}return null;};}function patchUpdates(_0x4ecba6){return function(_0x12a9c7){try{jsonpatch[_0xc1cf('0x23')](_0x12a9c7,_0x4ecba6,!![]);}catch(_0x246f5a){return BPromise['reject'](_0x246f5a);}return _0x12a9c7[_0xc1cf('0x24')]();};}function saveUpdates(_0x41b820,_0x513c8f){return function(_0x2bb229){if(_0x2bb229){return _0x2bb229[_0xc1cf('0x25')](_0x41b820)[_0xc1cf('0x26')](function(_0x2f7776){return _0x2f7776;});}return null;};}function removeEntity(_0xef99b7,_0xcc7d45){return function(_0x18e3a5){if(_0x18e3a5){return _0x18e3a5['destroy']()['then'](function(){_0xef99b7['status'](0xcc)[_0xc1cf('0x1a')]();});}};}function handleEntityNotFound(_0x40bd95,_0x1ee08f){return function(_0x1af100){if(!_0x1af100){_0x40bd95[_0xc1cf('0x19')](0x194);}return _0x1af100;};}function handleError(_0x3965e6,_0x4f04d5){_0x4f04d5=_0x4f04d5||0x1f4;return function(_0x285df7){logger[_0xc1cf('0x27')](_0x285df7[_0xc1cf('0x28')]);if(_0x285df7[_0xc1cf('0x29')]){delete _0x285df7[_0xc1cf('0x29')];}_0x3965e6[_0xc1cf('0x1b')](_0x4f04d5)['send'](_0x285df7);};}exports['index']=function(_0x40b576,_0x3f67c5){var _0x69db1b={},_0x3799e7={},_0x4c5677={'count':0x0,'rows':[]};var _0x5daa08=_[_0xc1cf('0x2a')](db[_0xc1cf('0x2b')][_0xc1cf('0x2c')],function(_0x1a60e9){return{'name':_0x1a60e9[_0xc1cf('0x2d')],'type':_0x1a60e9['type']['key']};});_0x3799e7['model']=_['map'](_0x5daa08,_0xc1cf('0x29'));_0x3799e7[_0xc1cf('0x2e')]=_['keys'](_0x40b576[_0xc1cf('0x2e')]);_0x3799e7[_0xc1cf('0x2f')]=_['intersection'](_0x3799e7[_0xc1cf('0x30')],_0x3799e7['query']);_0x69db1b[_0xc1cf('0x31')]=_['intersection'](_0x3799e7[_0xc1cf('0x30')],qs['fields'](_0x40b576[_0xc1cf('0x2e')][_0xc1cf('0x32')]));_0x69db1b[_0xc1cf('0x31')]=_0x69db1b[_0xc1cf('0x31')][_0xc1cf('0x33')]?_0x69db1b[_0xc1cf('0x31')]:_0x3799e7[_0xc1cf('0x30')];if(!_0x40b576['query'][_0xc1cf('0x34')](_0xc1cf('0x35'))){_0x69db1b[_0xc1cf('0x1e')]=qs['limit'](_0x40b576[_0xc1cf('0x2e')][_0xc1cf('0x1e')]);_0x69db1b['offset']=qs[_0xc1cf('0x1c')](_0x40b576[_0xc1cf('0x2e')][_0xc1cf('0x1c')]);}_0x69db1b[_0xc1cf('0x36')]=qs['sort'](_0x40b576[_0xc1cf('0x2e')][_0xc1cf('0x37')]);_0x69db1b['where']=qs['filters'](_[_0xc1cf('0x38')](_0x40b576[_0xc1cf('0x2e')],_0x3799e7['filters']),_0x5daa08);if(_0x40b576[_0xc1cf('0x2e')]['filter']){_0x69db1b[_0xc1cf('0x39')]=_[_0xc1cf('0x3a')](_0x69db1b[_0xc1cf('0x39')],{'$or':_['map'](_0x5daa08,function(_0x1a9457){if(_0x1a9457[_0xc1cf('0x3b')]!==_0xc1cf('0x3c')){var _0x5561fd={};_0x5561fd[_0x1a9457[_0xc1cf('0x29')]]={'$like':'%'+_0x40b576[_0xc1cf('0x2e')][_0xc1cf('0x3d')]+'%'};return _0x5561fd;}})});}_0x69db1b=_[_0xc1cf('0x3a')]({},_0x69db1b,_0x40b576[_0xc1cf('0x3e')]);var _0x2c3611={'where':_0x69db1b[_0xc1cf('0x39')]};return db[_0xc1cf('0x2b')][_0xc1cf('0x1f')](_0x2c3611)[_0xc1cf('0x26')](function(_0xb1d5a9){_0x4c5677[_0xc1cf('0x1f')]=_0xb1d5a9;if(_0x40b576[_0xc1cf('0x2e')]['includeAll']){_0x69db1b[_0xc1cf('0x3f')]=[{'all':!![]}];}return db[_0xc1cf('0x2b')][_0xc1cf('0x40')](_0x69db1b);})[_0xc1cf('0x26')](function(_0x392f90){_0x4c5677[_0xc1cf('0x41')]=_0x392f90;return _0x4c5677;})[_0xc1cf('0x26')](respondWithFilteredResult(_0x3f67c5,_0x69db1b))[_0xc1cf('0x42')](handleError(_0x3f67c5,null));};exports['show']=function(_0x1fe9ce,_0x529fcb){var _0x4edb51={'raw':!![],'where':{'id':_0x1fe9ce[_0xc1cf('0x43')]['id']}},_0x4ce977={};_0x4ce977[_0xc1cf('0x30')]=_[_0xc1cf('0x44')](db[_0xc1cf('0x2b')][_0xc1cf('0x2c')]);_0x4ce977['query']=_[_0xc1cf('0x44')](_0x1fe9ce[_0xc1cf('0x2e')]);_0x4ce977['filters']=_[_0xc1cf('0x45')](_0x4ce977['model'],_0x4ce977['query']);_0x4edb51[_0xc1cf('0x31')]=_[_0xc1cf('0x45')](_0x4ce977['model'],qs['fields'](_0x1fe9ce[_0xc1cf('0x2e')][_0xc1cf('0x32')]));_0x4edb51['attributes']=_0x4edb51['attributes']['length']?_0x4edb51[_0xc1cf('0x31')]:_0x4ce977['model'];if(_0x1fe9ce['query'][_0xc1cf('0x46')]){_0x4edb51[_0xc1cf('0x3f')]=[{'all':!![]}];}_0x4edb51=_[_0xc1cf('0x3a')]({},_0x4edb51,_0x1fe9ce[_0xc1cf('0x3e')]);return db[_0xc1cf('0x2b')][_0xc1cf('0x47')](_0x4edb51)['then'](handleEntityNotFound(_0x529fcb,null))[_0xc1cf('0x26')](respondWithResult(_0x529fcb,null))[_0xc1cf('0x42')](handleError(_0x529fcb,null));};exports[_0xc1cf('0x48')]=function(_0x477553,_0x32c582){return db[_0xc1cf('0x2b')][_0xc1cf('0x48')](_0x477553[_0xc1cf('0x49')],{})[_0xc1cf('0x26')](respondWithResult(_0x32c582,0xc9))['catch'](handleError(_0x32c582,null));};exports['update']=function(_0x5f4e4c,_0x268cf8){if(_0x5f4e4c['body']['id']){delete _0x5f4e4c[_0xc1cf('0x49')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x5f4e4c[_0xc1cf('0x43')]['id']}})['then'](handleEntityNotFound(_0x268cf8,null))[_0xc1cf('0x26')](saveUpdates(_0x5f4e4c['body'],null))['then'](respondWithResult(_0x268cf8,null))[_0xc1cf('0x42')](handleError(_0x268cf8,null));};exports[_0xc1cf('0x4a')]=function(_0x1a6d51,_0x1a12d1){return db[_0xc1cf('0x2b')][_0xc1cf('0x47')]({'where':{'id':_0x1a6d51['params']['id']}})[_0xc1cf('0x26')](handleEntityNotFound(_0x1a12d1,null))['then'](removeEntity(_0x1a12d1,null))['catch'](handleError(_0x1a12d1,null));};exports['describe']=function(_0x39547c,_0x3342fc){return db[_0xc1cf('0x2b')][_0xc1cf('0x4b')]()[_0xc1cf('0x26')](respondWithResult(_0x3342fc,null))[_0xc1cf('0x42')](handleError(_0x3342fc,null));};exports[_0xc1cf('0x4c')]=function(_0x17a354,_0x14cce9,_0x4a31a2){var _0x1ed469={'raw':!![],'where':{}};var _0x57d0e4={};var _0x3494a3={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xc1cf('0x4d')]({'where':{'id':_0x17a354[_0xc1cf('0x43')]['id']}})['then'](handleEntityNotFound(_0x14cce9,null))[_0xc1cf('0x26')](function(_0x4d3783){if(_0x4d3783){_0x57d0e4[_0xc1cf('0x30')]=_['keys'](db[_0xc1cf('0x4e')][_0xc1cf('0x2c')]);_0x57d0e4['query']=_['keys'](_0x17a354[_0xc1cf('0x2e')]);_0x57d0e4[_0xc1cf('0x2f')]=_[_0xc1cf('0x45')](_0x57d0e4[_0xc1cf('0x30')],_0x57d0e4[_0xc1cf('0x2e')]);_0x1ed469['attributes']=_[_0xc1cf('0x45')](_0x57d0e4[_0xc1cf('0x30')],qs[_0xc1cf('0x32')](_0x17a354[_0xc1cf('0x2e')][_0xc1cf('0x32')]));_0x1ed469['attributes']=_0x1ed469[_0xc1cf('0x31')][_0xc1cf('0x33')]?_0x1ed469[_0xc1cf('0x31')]:_0x57d0e4[_0xc1cf('0x30')];if(!_0x17a354['query'][_0xc1cf('0x34')](_0xc1cf('0x35'))){_0x1ed469[_0xc1cf('0x1e')]=qs[_0xc1cf('0x1e')](_0x17a354[_0xc1cf('0x2e')][_0xc1cf('0x1e')]);_0x1ed469['offset']=qs['offset'](_0x17a354[_0xc1cf('0x2e')][_0xc1cf('0x1c')]);}_0x1ed469[_0xc1cf('0x36')]=qs[_0xc1cf('0x37')](_0x17a354[_0xc1cf('0x2e')][_0xc1cf('0x37')]);_0x1ed469[_0xc1cf('0x39')]=qs['filters'](_['pick'](_0x17a354[_0xc1cf('0x2e')],_0x57d0e4[_0xc1cf('0x2f')]));_0x1ed469[_0xc1cf('0x39')][_0xc1cf('0x4f')]=_0x4d3783['id'];if(_0x17a354[_0xc1cf('0x2e')][_0xc1cf('0x3d')]){_0x1ed469['where']=_[_0xc1cf('0x3a')](_0x1ed469[_0xc1cf('0x39')],{'$or':_[_0xc1cf('0x2a')](_0x1ed469[_0xc1cf('0x31')],function(_0x1d3a06){var _0x2d8d05={};_0x2d8d05[_0x1d3a06]={'$like':'%'+_0x17a354['query'][_0xc1cf('0x3d')]+'%'};return _0x2d8d05;})});}_0x1ed469=_['merge']({},_0x1ed469,_0x17a354['options']);return db[_0xc1cf('0x4e')]['count']({'where':_0x1ed469['where']})['then'](function(_0x16b3ed){_0x3494a3[_0xc1cf('0x1f')]=_0x16b3ed;if(_0x17a354[_0xc1cf('0x2e')]['includeAll']){_0x1ed469[_0xc1cf('0x3f')]=[{'all':!![]}];}return db[_0xc1cf('0x4e')]['findAll'](_0x1ed469);})[_0xc1cf('0x26')](function(_0x24fc48){_0x3494a3[_0xc1cf('0x41')]=_0x24fc48;return _0x3494a3;});}})['then'](respondWithFilteredResult(_0x14cce9,_0x1ed469))[_0xc1cf('0x42')](handleError(_0x14cce9,null));}; \ No newline at end of file +var _0xcf6b=['apply','save','then','stack','send','index','map','JscriptySessionReport','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','destroy','describe','getQuestions','order','SessionId','rows','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x599019,_0x542d8b){var _0x3f4e55=function(_0x23e5c8){while(--_0x23e5c8){_0x599019['push'](_0x599019['shift']());}};_0x3f4e55(++_0x542d8b);}(_0xcf6b,0x113));var _0xbcf6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcf6b[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcf6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcf6('0x1'));var rp=require(_0xbcf6('0x2'));var moment=require(_0xbcf6('0x3'));var BPromise=require(_0xbcf6('0x4'));var Mustache=require(_0xbcf6('0x5'));var util=require(_0xbcf6('0x6'));var path=require(_0xbcf6('0x7'));var sox=require(_0xbcf6('0x8'));var csv=require(_0xbcf6('0x9'));var ejs=require(_0xbcf6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbcf6('0xb'));var crypto=require(_0xbcf6('0xc'));var jsforce=require(_0xbcf6('0xd'));var deskjs=require(_0xbcf6('0xe'));var toCsv=require(_0xbcf6('0x9'));var querystring=require('querystring');var Papa=require(_0xbcf6('0xf'));var Redis=require(_0xbcf6('0x10'));var authService=require(_0xbcf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbcf6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcf6('0x13'))(_0xbcf6('0x14'));var utils=require(_0xbcf6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbcf6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d40bc,_0x77d590){_0x77d590=_0x77d590||0xcc;return function(_0x63ef14){if(_0x63ef14){return _0x3d40bc[_0xbcf6('0x17')](_0x77d590);}return _0x3d40bc[_0xbcf6('0x18')](_0x77d590)[_0xbcf6('0x19')]();};}function respondWithResult(_0x1a21ff,_0x594176){_0x594176=_0x594176||0xc8;return function(_0x17f80b){if(_0x17f80b){return _0x1a21ff[_0xbcf6('0x18')](_0x594176)['json'](_0x17f80b);}};}function respondWithFilteredResult(_0x36ca5e,_0x5b7a70){return function(_0x291a72){if(_0x291a72){var _0x8b022a=typeof _0x5b7a70[_0xbcf6('0x1a')]===_0xbcf6('0x1b')&&typeof _0x5b7a70[_0xbcf6('0x1c')]===_0xbcf6('0x1b');var _0x4f1e31=_0x291a72[_0xbcf6('0x1d')];var _0x2da3a7=_0x8b022a?0x0:_0x5b7a70[_0xbcf6('0x1a')];var _0x4fa69d=_0x8b022a?_0x291a72[_0xbcf6('0x1d')]:_0x5b7a70[_0xbcf6('0x1a')]+_0x5b7a70[_0xbcf6('0x1c')];var _0x2ba262;if(_0x4fa69d>=_0x4f1e31){_0x4fa69d=_0x4f1e31;_0x2ba262=0xc8;}else{_0x2ba262=0xce;}_0x36ca5e[_0xbcf6('0x18')](_0x2ba262);return _0x36ca5e[_0xbcf6('0x1e')](_0xbcf6('0x1f'),_0x2da3a7+'-'+_0x4fa69d+'/'+_0x4f1e31)[_0xbcf6('0x20')](_0x291a72);}return null;};}function patchUpdates(_0x43c2ad){return function(_0x31e977){try{jsonpatch[_0xbcf6('0x21')](_0x31e977,_0x43c2ad,!![]);}catch(_0xb92f52){return BPromise['reject'](_0xb92f52);}return _0x31e977[_0xbcf6('0x22')]();};}function saveUpdates(_0x1ad9f4,_0x5b9ea8){return function(_0x129c03){if(_0x129c03){return _0x129c03['update'](_0x1ad9f4)[_0xbcf6('0x23')](function(_0x582b93){return _0x582b93;});}return null;};}function removeEntity(_0x22b764,_0x1eebb7){return function(_0x5e1566){if(_0x5e1566){return _0x5e1566['destroy']()[_0xbcf6('0x23')](function(){_0x22b764[_0xbcf6('0x18')](0xcc)[_0xbcf6('0x19')]();});}};}function handleEntityNotFound(_0x268441,_0x39971f){return function(_0xbff69c){if(!_0xbff69c){_0x268441['sendStatus'](0x194);}return _0xbff69c;};}function handleError(_0x1ee97f,_0x2312ea){_0x2312ea=_0x2312ea||0x1f4;return function(_0x550fef){logger['error'](_0x550fef[_0xbcf6('0x24')]);if(_0x550fef['name']){delete _0x550fef['name'];}_0x1ee97f['status'](_0x2312ea)[_0xbcf6('0x25')](_0x550fef);};}exports[_0xbcf6('0x26')]=function(_0x15c5cd,_0x237791){var _0x15625f={},_0x46d93f={},_0x536cf6={'count':0x0,'rows':[]};var _0x2f4747=_[_0xbcf6('0x27')](db[_0xbcf6('0x28')]['rawAttributes'],function(_0x1adc76){return{'name':_0x1adc76[_0xbcf6('0x29')],'type':_0x1adc76[_0xbcf6('0x2a')]['key']};});_0x46d93f[_0xbcf6('0x2b')]=_[_0xbcf6('0x27')](_0x2f4747,_0xbcf6('0x2c'));_0x46d93f[_0xbcf6('0x2d')]=_[_0xbcf6('0x2e')](_0x15c5cd['query']);_0x46d93f[_0xbcf6('0x2f')]=_[_0xbcf6('0x30')](_0x46d93f[_0xbcf6('0x2b')],_0x46d93f[_0xbcf6('0x2d')]);_0x15625f[_0xbcf6('0x31')]=_[_0xbcf6('0x30')](_0x46d93f[_0xbcf6('0x2b')],qs['fields'](_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x32')]));_0x15625f[_0xbcf6('0x31')]=_0x15625f['attributes'][_0xbcf6('0x33')]?_0x15625f[_0xbcf6('0x31')]:_0x46d93f['model'];if(!_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x34')](_0xbcf6('0x35'))){_0x15625f[_0xbcf6('0x1c')]=qs[_0xbcf6('0x1c')](_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x1c')]);_0x15625f[_0xbcf6('0x1a')]=qs[_0xbcf6('0x1a')](_0x15c5cd['query'][_0xbcf6('0x1a')]);}_0x15625f['order']=qs[_0xbcf6('0x36')](_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x36')]);_0x15625f[_0xbcf6('0x37')]=qs[_0xbcf6('0x2f')](_[_0xbcf6('0x38')](_0x15c5cd[_0xbcf6('0x2d')],_0x46d93f[_0xbcf6('0x2f')]),_0x2f4747);if(_0x15c5cd['query'][_0xbcf6('0x39')]){_0x15625f[_0xbcf6('0x37')]=_[_0xbcf6('0x3a')](_0x15625f['where'],{'$or':_[_0xbcf6('0x27')](_0x2f4747,function(_0x1fe436){if(_0x1fe436[_0xbcf6('0x2a')]!==_0xbcf6('0x3b')){var _0x1b48a4={};_0x1b48a4[_0x1fe436[_0xbcf6('0x2c')]]={'$like':'%'+_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x39')]+'%'};return _0x1b48a4;}})});}_0x15625f=_[_0xbcf6('0x3a')]({},_0x15625f,_0x15c5cd[_0xbcf6('0x3c')]);var _0x5b69cc={'where':_0x15625f[_0xbcf6('0x37')]};return db[_0xbcf6('0x28')][_0xbcf6('0x1d')](_0x5b69cc)[_0xbcf6('0x23')](function(_0x3598f8){_0x536cf6['count']=_0x3598f8;if(_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x3d')]){_0x15625f[_0xbcf6('0x3e')]=[{'all':!![]}];}return db[_0xbcf6('0x28')][_0xbcf6('0x3f')](_0x15625f);})[_0xbcf6('0x23')](function(_0xee0d0b){_0x536cf6['rows']=_0xee0d0b;return _0x536cf6;})[_0xbcf6('0x23')](respondWithFilteredResult(_0x237791,_0x15625f))[_0xbcf6('0x40')](handleError(_0x237791,null));};exports[_0xbcf6('0x41')]=function(_0x4941d3,_0x529f49){var _0x3ae6e5={'raw':!![],'where':{'id':_0x4941d3[_0xbcf6('0x42')]['id']}},_0x360bfe={};_0x360bfe['model']=_[_0xbcf6('0x2e')](db[_0xbcf6('0x28')][_0xbcf6('0x43')]);_0x360bfe[_0xbcf6('0x2d')]=_[_0xbcf6('0x2e')](_0x4941d3[_0xbcf6('0x2d')]);_0x360bfe[_0xbcf6('0x2f')]=_['intersection'](_0x360bfe[_0xbcf6('0x2b')],_0x360bfe[_0xbcf6('0x2d')]);_0x3ae6e5[_0xbcf6('0x31')]=_['intersection'](_0x360bfe[_0xbcf6('0x2b')],qs[_0xbcf6('0x32')](_0x4941d3[_0xbcf6('0x2d')]['fields']));_0x3ae6e5['attributes']=_0x3ae6e5['attributes']['length']?_0x3ae6e5[_0xbcf6('0x31')]:_0x360bfe[_0xbcf6('0x2b')];if(_0x4941d3[_0xbcf6('0x2d')][_0xbcf6('0x3d')]){_0x3ae6e5['include']=[{'all':!![]}];}_0x3ae6e5=_[_0xbcf6('0x3a')]({},_0x3ae6e5,_0x4941d3[_0xbcf6('0x3c')]);return db[_0xbcf6('0x28')]['find'](_0x3ae6e5)['then'](handleEntityNotFound(_0x529f49,null))[_0xbcf6('0x23')](respondWithResult(_0x529f49,null))[_0xbcf6('0x40')](handleError(_0x529f49,null));};exports[_0xbcf6('0x44')]=function(_0x355c39,_0x30a6e5){return db[_0xbcf6('0x28')][_0xbcf6('0x44')](_0x355c39['body'],{})['then'](respondWithResult(_0x30a6e5,0xc9))[_0xbcf6('0x40')](handleError(_0x30a6e5,null));};exports['update']=function(_0x509f2c,_0x282109){if(_0x509f2c['body']['id']){delete _0x509f2c[_0xbcf6('0x45')]['id'];}return db[_0xbcf6('0x28')][_0xbcf6('0x46')]({'where':{'id':_0x509f2c[_0xbcf6('0x42')]['id']}})[_0xbcf6('0x23')](handleEntityNotFound(_0x282109,null))['then'](saveUpdates(_0x509f2c[_0xbcf6('0x45')],null))[_0xbcf6('0x23')](respondWithResult(_0x282109,null))[_0xbcf6('0x40')](handleError(_0x282109,null));};exports[_0xbcf6('0x47')]=function(_0x3d0bef,_0xa5af92){return db[_0xbcf6('0x28')][_0xbcf6('0x46')]({'where':{'id':_0x3d0bef[_0xbcf6('0x42')]['id']}})[_0xbcf6('0x23')](handleEntityNotFound(_0xa5af92,null))[_0xbcf6('0x23')](removeEntity(_0xa5af92,null))[_0xbcf6('0x40')](handleError(_0xa5af92,null));};exports['describe']=function(_0x5b22fe,_0x53eb2a){return db[_0xbcf6('0x28')][_0xbcf6('0x48')]()[_0xbcf6('0x23')](respondWithResult(_0x53eb2a,null))[_0xbcf6('0x40')](handleError(_0x53eb2a,null));};exports[_0xbcf6('0x49')]=function(_0x285242,_0x39a521,_0x2b70af){var _0x29dae3={'raw':!![],'where':{}};var _0x593027={};var _0x12323b={'count':0x0,'rows':[]};return db[_0xbcf6('0x28')]['findOne']({'where':{'id':_0x285242[_0xbcf6('0x42')]['id']}})[_0xbcf6('0x23')](handleEntityNotFound(_0x39a521,null))['then'](function(_0x36626c){if(_0x36626c){_0x593027[_0xbcf6('0x2b')]=_[_0xbcf6('0x2e')](db['JscriptyQuestionReport']['rawAttributes']);_0x593027['query']=_['keys'](_0x285242[_0xbcf6('0x2d')]);_0x593027[_0xbcf6('0x2f')]=_[_0xbcf6('0x30')](_0x593027[_0xbcf6('0x2b')],_0x593027['query']);_0x29dae3['attributes']=_[_0xbcf6('0x30')](_0x593027[_0xbcf6('0x2b')],qs[_0xbcf6('0x32')](_0x285242[_0xbcf6('0x2d')][_0xbcf6('0x32')]));_0x29dae3[_0xbcf6('0x31')]=_0x29dae3['attributes'][_0xbcf6('0x33')]?_0x29dae3[_0xbcf6('0x31')]:_0x593027[_0xbcf6('0x2b')];if(!_0x285242[_0xbcf6('0x2d')][_0xbcf6('0x34')](_0xbcf6('0x35'))){_0x29dae3[_0xbcf6('0x1c')]=qs[_0xbcf6('0x1c')](_0x285242['query']['limit']);_0x29dae3[_0xbcf6('0x1a')]=qs[_0xbcf6('0x1a')](_0x285242['query'][_0xbcf6('0x1a')]);}_0x29dae3[_0xbcf6('0x4a')]=qs['sort'](_0x285242[_0xbcf6('0x2d')][_0xbcf6('0x36')]);_0x29dae3['where']=qs[_0xbcf6('0x2f')](_[_0xbcf6('0x38')](_0x285242[_0xbcf6('0x2d')],_0x593027[_0xbcf6('0x2f')]));_0x29dae3[_0xbcf6('0x37')][_0xbcf6('0x4b')]=_0x36626c['id'];if(_0x285242[_0xbcf6('0x2d')][_0xbcf6('0x39')]){_0x29dae3['where']=_[_0xbcf6('0x3a')](_0x29dae3[_0xbcf6('0x37')],{'$or':_[_0xbcf6('0x27')](_0x29dae3[_0xbcf6('0x31')],function(_0x5ca194){var _0x3f0b3a={};_0x3f0b3a[_0x5ca194]={'$like':'%'+_0x285242['query'][_0xbcf6('0x39')]+'%'};return _0x3f0b3a;})});}_0x29dae3=_[_0xbcf6('0x3a')]({},_0x29dae3,_0x285242[_0xbcf6('0x3c')]);return db['JscriptyQuestionReport'][_0xbcf6('0x1d')]({'where':_0x29dae3[_0xbcf6('0x37')]})[_0xbcf6('0x23')](function(_0x2154ca){_0x12323b[_0xbcf6('0x1d')]=_0x2154ca;if(_0x285242['query'][_0xbcf6('0x3d')]){_0x29dae3[_0xbcf6('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xbcf6('0x3f')](_0x29dae3);})[_0xbcf6('0x23')](function(_0x4ed60c){_0x12323b[_0xbcf6('0x4c')]=_0x4ed60c;return _0x12323b;});}})[_0xbcf6('0x23')](respondWithFilteredResult(_0x39a521,_0x29dae3))[_0xbcf6('0x40')](handleError(_0x39a521,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 73b72d6..34e9b8e 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.model.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31f0=['./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x11923e,_0x6f4cdd){var _0x4f4b1f=function(_0x6228bd){while(--_0x6228bd){_0x11923e['push'](_0x11923e['shift']());}};_0x4f4b1f(++_0x6f4cdd);}(_0x31f0,0xb7));var _0x031f=function(_0x40dc8b,_0x3a60c2){_0x40dc8b=_0x40dc8b-0x0;var _0x530a48=_0x31f0[_0x40dc8b];return _0x530a48;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5c568e,_0x47fcc3){var _0x5cd62c=function(_0x519739){while(--_0x519739){_0x5c568e['push'](_0x5c568e['shift']());}};_0x5cd62c(++_0x47fcc3);}(_0x1883,0xab));var _0x3188=function(_0x5473a5,_0x38fc6b){_0x5473a5=_0x5473a5-0x0;var _0x58be1f=_0x1883[_0x5473a5];return _0x58be1f;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index a9ba8bb..e651799 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f4=['info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0x32f4,0x154));var _0x432f=function(_0x1e0da5,_0x2f24fb){_0x1e0da5=_0x1e0da5-0x0;var _0x51d21e=_0x32f4[_0x1e0da5];return _0x51d21e;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});} \ No newline at end of file +var _0x7ee1=['request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1bd230,_0x1da01e){var _0x19a3e3=function(_0x3cb9fa){while(--_0x3cb9fa){_0x1bd230['push'](_0x1bd230['shift']());}};_0x19a3e3(++_0x1da01e);}(_0x7ee1,0x8d));var _0x17ee=function(_0x552cd5,_0x4f0b16){_0x552cd5=_0x552cd5-0x0;var _0x2e519f=_0x7ee1[_0x552cd5];return _0x2e519f;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b9eb,_0x54b4f6,_0x3f61af){return new BPromise(function(_0x57e1d1,_0x3d767b){return client[_0x17ee('0x9')](_0x29b9eb,_0x3f61af)[_0x17ee('0xa')](function(_0x4af369){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x54b4f6,_0x17ee('0xb'));logger['debug'](_0x17ee('0xc'),_0x54b4f6,_0x17ee('0xb'),JSON[_0x17ee('0xd')](_0x4af369));if(_0x4af369[_0x17ee('0xe')]){if(_0x4af369['error'][_0x17ee('0xf')]===0x1f4){logger['error'](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x3d767b(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x57e1d1(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x54b4f6,'request\x20sent');_0x57e1d1(_0x4af369['result'][_0x17ee('0x11')]);}})[_0x17ee('0x12')](function(_0x1b87c3){logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x1b87c3);_0x3d767b(_0x1b87c3);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index cb81393..309d322 100644 --- a/server/api/license/index.js +++ b/server/api/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a71=['../../config/environment','index','put','/:id','isAuthenticated','update','get','/download_log_file','downloadLogFile','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x29c5a5,_0x1d8ff2){var _0x2443ce=function(_0x4ac1f2){while(--_0x4ac1f2){_0x29c5a5['push'](_0x29c5a5['shift']());}};_0x2443ce(++_0x1d8ff2);}(_0x7a71,0x18a));var _0x17a7=function(_0x572699,_0x5af96a){_0x572699=_0x572699-0x0;var _0x30b992=_0x7a71[_0x572699];return _0x30b992;};'use strict';var multer=require(_0x17a7('0x0'));var util=require(_0x17a7('0x1'));var path=require('path');var timeout=require(_0x17a7('0x2'));var express=require(_0x17a7('0x3'));var router=express['Router']();var fs_extra=require(_0x17a7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x17a7('0x5'));var config=require(_0x17a7('0x6'));var controller=require('./license.controller');router['get']('/',controller[_0x17a7('0x7')]);router[_0x17a7('0x8')](_0x17a7('0x9'),auth[_0x17a7('0xa')](),controller[_0x17a7('0xb')]);router[_0x17a7('0xc')](_0x17a7('0xd'),auth['isAuthenticated'](),controller[_0x17a7('0xe')]);module[_0x17a7('0xf')]=router; \ No newline at end of file +var _0x60b8=['get','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','util','connect-timeout','express','fs-extra','../../config/environment','./license.controller'];(function(_0x3397af,_0x2c8c5){var _0x229013=function(_0x4e9460){while(--_0x4e9460){_0x3397af['push'](_0x3397af['shift']());}};_0x229013(++_0x2c8c5);}(_0x60b8,0x1d6));var _0x860b=function(_0x5b4d63,_0x369c30){_0x5b4d63=_0x5b4d63-0x0;var _0xf23789=_0x60b8[_0x5b4d63];return _0xf23789;};'use strict';var multer=require('multer');var util=require(_0x860b('0x0'));var path=require('path');var timeout=require(_0x860b('0x1'));var express=require(_0x860b('0x2'));var router=express['Router']();var fs_extra=require(_0x860b('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x860b('0x4'));var controller=require(_0x860b('0x5'));router[_0x860b('0x6')]('/',controller['index']);router[_0x860b('0x7')](_0x860b('0x8'),auth[_0x860b('0x9')](),controller[_0x860b('0xa')]);router['get'](_0x860b('0xb'),auth[_0x860b('0x9')](),controller[_0x860b('0xc')]);module[_0x860b('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index ffa0c4e..d314889 100644 --- a/server/api/license/license.attributes.js +++ b/server/api/license/license.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56a6=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x494829,_0x34e5bf){var _0x13ed61=function(_0x33044c){while(--_0x33044c){_0x494829['push'](_0x494829['shift']());}};_0x13ed61(++_0x34e5bf);}(_0x56a6,0xe5));var _0x656a=function(_0x46d916,_0x5d68c5){_0x46d916=_0x46d916-0x0;var _0x171a7d=_0x56a6[_0x46d916];return _0x171a7d;};'use strict';var Sequelize=require(_0x656a('0x0'));module[_0x656a('0x1')]={'license':{'type':Sequelize[_0x656a('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x656a('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x656a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4094=['STRING','INTEGER','sequelize'];(function(_0x5fe3f2,_0x18d44e){var _0x5e26dc=function(_0x15b9cd){while(--_0x15b9cd){_0x5fe3f2['push'](_0x5fe3f2['shift']());}};_0x5e26dc(++_0x18d44e);}(_0x4094,0xd4));var _0x4409=function(_0x1cb35f,_0x3b9b71){_0x1cb35f=_0x1cb35f-0x0;var _0x2a26ce=_0x4094[_0x1cb35f];return _0x2a26ce;};'use strict';var Sequelize=require(_0x4409('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x4409('0x1')]},'data2':{'type':Sequelize[_0x4409('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x4409('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 9cfbc61..080910d 100644 --- a/server/api/license/license.controller.js +++ b/server/api/license/license.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc788=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','length','merge','options','getLicense','catch','body','find','get','checkLicense','key','demo','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xc788,0xb9));var _0x8c78=function(_0x3bee55,_0x4e25c8){_0x3bee55=_0x3bee55-0x0;var _0x5649d2=_0xc788[_0x3bee55];return _0x5649d2;};'use strict';var emlformat=require(_0x8c78('0x0'));var rimraf=require(_0x8c78('0x1'));var zipdir=require(_0x8c78('0x2'));var jsonpatch=require(_0x8c78('0x3'));var rp=require(_0x8c78('0x4'));var moment=require(_0x8c78('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8c78('0x6'));var sox=require(_0x8c78('0x7'));var csv=require(_0x8c78('0x8'));var ejs=require(_0x8c78('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c78('0xa'));var squel=require('squel');var crypto=require(_0x8c78('0xb'));var jsforce=require(_0x8c78('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8c78('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8c78('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8c78('0xe'));var as=require(_0x8c78('0xf'));var hardwareService=require(_0x8c78('0x10'));var logger=require(_0x8c78('0x11'))(_0x8c78('0x12'));var utils=require('../../config/utils');var config=require(_0x8c78('0x13'));var licenseUtil=require(_0x8c78('0x14'));var db=require(_0x8c78('0x15'))['db'];function respondWithStatusCode(_0x41d749,_0x178da6){_0x178da6=_0x178da6||0xcc;return function(_0x692260){if(_0x692260){return _0x41d749[_0x8c78('0x16')](_0x178da6);}return _0x41d749[_0x8c78('0x17')](_0x178da6)[_0x8c78('0x18')]();};}function respondWithResult(_0x1fd311,_0x45535e){_0x45535e=_0x45535e||0xc8;return function(_0xd12db1){if(_0xd12db1){return _0x1fd311['status'](_0x45535e)[_0x8c78('0x19')](_0xd12db1);}};}function respondWithFilteredResult(_0x13dc83,_0x314a89){return function(_0x5c5102){if(_0x5c5102){var _0x541d80=typeof _0x314a89['offset']===_0x8c78('0x1a')&&typeof _0x314a89[_0x8c78('0x1b')]===_0x8c78('0x1a');var _0x57ff00=_0x5c5102[_0x8c78('0x1c')];var _0x3037cc=_0x541d80?0x0:_0x314a89['offset'];var _0x494e44=_0x541d80?_0x5c5102[_0x8c78('0x1c')]:_0x314a89['offset']+_0x314a89['limit'];var _0x5ea830;if(_0x494e44>=_0x57ff00){_0x494e44=_0x57ff00;_0x5ea830=0xc8;}else{_0x5ea830=0xce;}_0x13dc83[_0x8c78('0x17')](_0x5ea830);return _0x13dc83[_0x8c78('0x1d')]('Content-Range',_0x3037cc+'-'+_0x494e44+'/'+_0x57ff00)[_0x8c78('0x19')](_0x5c5102);}return null;};}function patchUpdates(_0x5131d8){return function(_0x13a263){try{jsonpatch[_0x8c78('0x1e')](_0x13a263,_0x5131d8,!![]);}catch(_0x28d5f2){return BPromise['reject'](_0x28d5f2);}return _0x13a263[_0x8c78('0x1f')]();};}function saveUpdates(_0x32bedb,_0x369311){return function(_0x30bc56){if(_0x30bc56){return _0x30bc56[_0x8c78('0x20')](_0x32bedb)[_0x8c78('0x21')](function(_0x48eca3){return _0x48eca3;});}return null;};}function removeEntity(_0x33b7b7,_0x3e557a){return function(_0x5145ef){if(_0x5145ef){return _0x5145ef[_0x8c78('0x22')]()[_0x8c78('0x21')](function(){_0x33b7b7[_0x8c78('0x17')](0xcc)[_0x8c78('0x18')]();});}};}function handleEntityNotFound(_0x517ce0,_0x28a9d8){return function(_0xf6c994){if(!_0xf6c994){_0x517ce0['sendStatus'](0x194);}return _0xf6c994;};}function handleError(_0x3030ff,_0x6b5bc5){_0x6b5bc5=_0x6b5bc5||0x1f4;return function(_0x481aa6){logger[_0x8c78('0x23')](_0x481aa6[_0x8c78('0x24')]);if(_0x481aa6['name']){delete _0x481aa6['name'];}_0x3030ff[_0x8c78('0x17')](_0x6b5bc5)[_0x8c78('0x25')](_0x481aa6);};}var utilLicense=require('../../config/license/util');exports[_0x8c78('0x26')]=function(_0x46b2e9,_0x220779){var _0x396013={'raw':!![],'where':{'id':0x1}},_0x3be6a6={};_0x3be6a6[_0x8c78('0x27')]=_[_0x8c78('0x28')](db[_0x8c78('0x29')][_0x8c78('0x2a')]);_0x3be6a6[_0x8c78('0x2b')]=_['keys'](_0x46b2e9[_0x8c78('0x2b')]);_0x3be6a6[_0x8c78('0x2c')]=_[_0x8c78('0x2d')](_0x3be6a6[_0x8c78('0x27')],_0x3be6a6[_0x8c78('0x2b')]);_0x396013[_0x8c78('0x2e')]=_['intersection'](_0x3be6a6['model'],qs['fields'](_0x46b2e9[_0x8c78('0x2b')]['fields']));_0x396013[_0x8c78('0x2e')]=_0x396013[_0x8c78('0x2e')][_0x8c78('0x2f')]?_0x396013[_0x8c78('0x2e')]:_0x3be6a6['model'];_0x396013=_[_0x8c78('0x30')]({},_0x396013,_0x46b2e9[_0x8c78('0x31')]);return utilLicense[_0x8c78('0x32')](_0x396013)['then'](respondWithResult(_0x220779,null))[_0x8c78('0x33')](handleError(_0x220779,null));};exports[_0x8c78('0x20')]=function(_0x2e61d4,_0x5bd8c6){if(_0x2e61d4[_0x8c78('0x34')]['id']){delete _0x2e61d4[_0x8c78('0x34')]['id'];}return db['License'][_0x8c78('0x35')]({'where':{'id':_0x2e61d4['params']['id']}})[_0x8c78('0x21')](handleEntityNotFound(_0x5bd8c6,null))[_0x8c78('0x21')](function(_0x35c10c){var _0x2312fd=_0x35c10c[_0x8c78('0x36')]({'plain':!![]});return utilLicense[_0x8c78('0x37')](_0x2312fd,_0x2e61d4[_0x8c78('0x34')][_0x8c78('0x38')]);})['then'](function(_0x1f6e47){if(!_0x1f6e47[_0x8c78('0x39')]){return saveUpdates(_0x2e61d4[_0x8c78('0x34')],null);}return _0x1f6e47;})[_0x8c78('0x21')](respondWithResult(_0x5bd8c6,null))[_0x8c78('0x33')](handleError(_0x5bd8c6,null));};exports['downloadLogFile']=function(_0x38f47b,_0xf00106){var _0x5a4c7c=_0x8c78('0x3a');var _0x5737d2=path[_0x8c78('0x3b')](_0x8c78('0x3c'),_0x8c78('0x3d'),_0x8c78('0x3e'),_0x5a4c7c);_0xf00106[_0x8c78('0x3f')](_0x8c78('0x40'),_0x8c78('0x41')+_0x5a4c7c);_0xf00106['set'](_0x8c78('0x42'),'text/plain');_0xf00106['download'](_0x5737d2);}; \ No newline at end of file +var _0xbc49=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','model','License','rawAttributes','query','keys','filters','attributes','intersection','fields','length','merge','options','getLicense','catch','body','find','params','checkLicense','demo','license-info.log','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xbc49,0x11b));var _0x9bc4=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0xbc49[_0x3fa7d3];return _0x4c51bd;};'use strict';var emlformat=require(_0x9bc4('0x0'));var rimraf=require(_0x9bc4('0x1'));var zipdir=require(_0x9bc4('0x2'));var jsonpatch=require(_0x9bc4('0x3'));var rp=require(_0x9bc4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9bc4('0x5'));var util=require(_0x9bc4('0x6'));var path=require(_0x9bc4('0x7'));var sox=require(_0x9bc4('0x8'));var csv=require(_0x9bc4('0x9'));var ejs=require(_0x9bc4('0xa'));var fs=require('fs');var fs_extra=require(_0x9bc4('0xb'));var _=require(_0x9bc4('0xc'));var squel=require('squel');var crypto=require(_0x9bc4('0xd'));var jsforce=require(_0x9bc4('0xe'));var deskjs=require(_0x9bc4('0xf'));var toCsv=require(_0x9bc4('0x9'));var querystring=require(_0x9bc4('0x10'));var Papa=require(_0x9bc4('0x11'));var Redis=require(_0x9bc4('0x12'));var authService=require(_0x9bc4('0x13'));var qs=require(_0x9bc4('0x14'));var as=require(_0x9bc4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9bc4('0x16'))(_0x9bc4('0x17'));var utils=require(_0x9bc4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9bc4('0x19'));var db=require(_0x9bc4('0x1a'))['db'];function respondWithStatusCode(_0x510599,_0xe917dc){_0xe917dc=_0xe917dc||0xcc;return function(_0x3ebd10){if(_0x3ebd10){return _0x510599[_0x9bc4('0x1b')](_0xe917dc);}return _0x510599['status'](_0xe917dc)[_0x9bc4('0x1c')]();};}function respondWithResult(_0x2661f8,_0x315595){_0x315595=_0x315595||0xc8;return function(_0xbfde78){if(_0xbfde78){return _0x2661f8[_0x9bc4('0x1d')](_0x315595)[_0x9bc4('0x1e')](_0xbfde78);}};}function respondWithFilteredResult(_0x5855b1,_0x5412a5){return function(_0x58ad1a){if(_0x58ad1a){var _0x5e9067=typeof _0x5412a5[_0x9bc4('0x1f')]===_0x9bc4('0x20')&&typeof _0x5412a5[_0x9bc4('0x21')]===_0x9bc4('0x20');var _0x530e17=_0x58ad1a['count'];var _0x366171=_0x5e9067?0x0:_0x5412a5[_0x9bc4('0x1f')];var _0x15a840=_0x5e9067?_0x58ad1a[_0x9bc4('0x22')]:_0x5412a5[_0x9bc4('0x1f')]+_0x5412a5[_0x9bc4('0x21')];var _0x7bcc07;if(_0x15a840>=_0x530e17){_0x15a840=_0x530e17;_0x7bcc07=0xc8;}else{_0x7bcc07=0xce;}_0x5855b1[_0x9bc4('0x1d')](_0x7bcc07);return _0x5855b1[_0x9bc4('0x23')](_0x9bc4('0x24'),_0x366171+'-'+_0x15a840+'/'+_0x530e17)[_0x9bc4('0x1e')](_0x58ad1a);}return null;};}function patchUpdates(_0x5b05c4){return function(_0x2b512f){try{jsonpatch[_0x9bc4('0x25')](_0x2b512f,_0x5b05c4,!![]);}catch(_0x18cf53){return BPromise['reject'](_0x18cf53);}return _0x2b512f[_0x9bc4('0x26')]();};}function saveUpdates(_0x25b525,_0xfaeed9){return function(_0x154959){if(_0x154959){return _0x154959[_0x9bc4('0x27')](_0x25b525)[_0x9bc4('0x28')](function(_0x12e7dc){return _0x12e7dc;});}return null;};}function removeEntity(_0x3fcaba,_0x5c1e27){return function(_0x8095c4){if(_0x8095c4){return _0x8095c4[_0x9bc4('0x29')]()[_0x9bc4('0x28')](function(){_0x3fcaba[_0x9bc4('0x1d')](0xcc)[_0x9bc4('0x1c')]();});}};}function handleEntityNotFound(_0x15bdb8,_0x6e20d9){return function(_0x38320f){if(!_0x38320f){_0x15bdb8[_0x9bc4('0x1b')](0x194);}return _0x38320f;};}function handleError(_0x2c561f,_0x3253c3){_0x3253c3=_0x3253c3||0x1f4;return function(_0x524123){logger[_0x9bc4('0x2a')](_0x524123[_0x9bc4('0x2b')]);if(_0x524123[_0x9bc4('0x2c')]){delete _0x524123[_0x9bc4('0x2c')];}_0x2c561f[_0x9bc4('0x1d')](_0x3253c3)[_0x9bc4('0x2d')](_0x524123);};}var utilLicense=require(_0x9bc4('0x19'));exports['index']=function(_0x58f7f9,_0x23bf5d){var _0x4b2fb6={'raw':!![],'where':{'id':0x1}},_0x3dd15f={};_0x3dd15f[_0x9bc4('0x2e')]=_['keys'](db[_0x9bc4('0x2f')][_0x9bc4('0x30')]);_0x3dd15f[_0x9bc4('0x31')]=_[_0x9bc4('0x32')](_0x58f7f9[_0x9bc4('0x31')]);_0x3dd15f[_0x9bc4('0x33')]=_['intersection'](_0x3dd15f[_0x9bc4('0x2e')],_0x3dd15f['query']);_0x4b2fb6[_0x9bc4('0x34')]=_[_0x9bc4('0x35')](_0x3dd15f[_0x9bc4('0x2e')],qs[_0x9bc4('0x36')](_0x58f7f9[_0x9bc4('0x31')][_0x9bc4('0x36')]));_0x4b2fb6[_0x9bc4('0x34')]=_0x4b2fb6['attributes'][_0x9bc4('0x37')]?_0x4b2fb6['attributes']:_0x3dd15f[_0x9bc4('0x2e')];_0x4b2fb6=_[_0x9bc4('0x38')]({},_0x4b2fb6,_0x58f7f9[_0x9bc4('0x39')]);return utilLicense[_0x9bc4('0x3a')](_0x4b2fb6)['then'](respondWithResult(_0x23bf5d,null))[_0x9bc4('0x3b')](handleError(_0x23bf5d,null));};exports['update']=function(_0x5f351e,_0x132f60){if(_0x5f351e[_0x9bc4('0x3c')]['id']){delete _0x5f351e[_0x9bc4('0x3c')]['id'];}return db[_0x9bc4('0x2f')][_0x9bc4('0x3d')]({'where':{'id':_0x5f351e[_0x9bc4('0x3e')]['id']}})[_0x9bc4('0x28')](handleEntityNotFound(_0x132f60,null))[_0x9bc4('0x28')](function(_0x502d80){var _0x4a01a2=_0x502d80['get']({'plain':!![]});return utilLicense[_0x9bc4('0x3f')](_0x4a01a2,_0x5f351e[_0x9bc4('0x3c')]['key']);})['then'](function(_0xd45463){if(!_0xd45463[_0x9bc4('0x40')]){return saveUpdates(_0x5f351e[_0x9bc4('0x3c')],null);}return _0xd45463;})[_0x9bc4('0x28')](respondWithResult(_0x132f60,null))['catch'](handleError(_0x132f60,null));};exports['downloadLogFile']=function(_0x3fee95,_0x321686){var _0x3ac60b=_0x9bc4('0x41');var _0x32e13e=path[_0x9bc4('0x42')]('/var',_0x9bc4('0x43'),_0x9bc4('0x44'),_0x3ac60b);_0x321686[_0x9bc4('0x45')](_0x9bc4('0x46'),_0x9bc4('0x47')+_0x3ac60b);_0x321686[_0x9bc4('0x23')](_0x9bc4('0x48'),_0x9bc4('0x49'));_0x321686['download'](_0x32e13e);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4bcc913..2f4bc9a 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb53=['license','../../config/logger','moment','request-promise','path','rimraf','./license.attributes','define'];(function(_0x2721e1,_0x2a1074){var _0xfab2cf=function(_0x535a4f){while(--_0x535a4f){_0x2721e1['push'](_0x2721e1['shift']());}};_0xfab2cf(++_0x2a1074);}(_0xdb53,0x71));var _0x3db5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb53[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3db5('0x0'))('api');var moment=require(_0x3db5('0x1'));var BPromise=require('bluebird');var rp=require(_0x3db5('0x2'));var fs=require('fs');var path=require(_0x3db5('0x3'));var rimraf=require(_0x3db5('0x4'));var config=require('../../config/environment');var attributes=require(_0x3db5('0x5'));module['exports']=function(_0x1013bc,_0x895208){return _0x1013bc[_0x3db5('0x6')]('License',attributes,{'tableName':_0x3db5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73c0=['moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','util','../../config/logger','api'];(function(_0x515713,_0x38f39c){var _0x9a7337=function(_0x131519){while(--_0x131519){_0x515713['push'](_0x515713['shift']());}};_0x9a7337(++_0x38f39c);}(_0x73c0,0x171));var _0x073c=function(_0x38f7c5,_0x252608){_0x38f7c5=_0x38f7c5-0x0;var _0x216879=_0x73c0[_0x38f7c5];return _0x216879;};'use strict';var _=require('lodash');var util=require(_0x073c('0x0'));var logger=require(_0x073c('0x1'))(_0x073c('0x2'));var moment=require(_0x073c('0x3'));var BPromise=require(_0x073c('0x4'));var rp=require(_0x073c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x073c('0x6'));var config=require(_0x073c('0x7'));var attributes=require(_0x073c('0x8'));module[_0x073c('0x9')]=function(_0x9de3ce,_0x275dc7){return _0x9de3ce[_0x073c('0xa')](_0x073c('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 91c2c32..d79904d 100644 --- a/server/api/license/license.rpc.js +++ b/server/api/license/license.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf33=['error','code','message','License,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbf33,0xb6));var _0x3bf3=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xbf33[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x3bf3('0x0'));var util=require(_0x3bf3('0x1'));var moment=require(_0x3bf3('0x2'));var BPromise=require(_0x3bf3('0x3'));var rs=require(_0x3bf3('0x4'));var fs=require('fs');var Redis=require(_0x3bf3('0x5'));var db=require(_0x3bf3('0x6'))['db'];var utils=require(_0x3bf3('0x7'));var logger=require(_0x3bf3('0x8'))(_0x3bf3('0x9'));var config=require(_0x3bf3('0xa'));var jayson=require(_0x3bf3('0xb'));var client=jayson[_0x3bf3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41971d,_0x1c32ec,_0xc19eb4){return new BPromise(function(_0x1d2294,_0x1b964e){return client[_0x3bf3('0xd')](_0x41971d,_0xc19eb4)[_0x3bf3('0xe')](function(_0x23315b){logger['info']('License,\x20%s,\x20%s',_0x1c32ec,_0x3bf3('0xf'));logger['debug'](_0x3bf3('0x10'),_0x1c32ec,_0x3bf3('0xf'),JSON[_0x3bf3('0x11')](_0x23315b));if(_0x23315b[_0x3bf3('0x12')]){if(_0x23315b[_0x3bf3('0x12')][_0x3bf3('0x13')]===0x1f4){logger[_0x3bf3('0x12')]('License,\x20%s,\x20%s',_0x1c32ec,_0x23315b['error'][_0x3bf3('0x14')]);return _0x1b964e(_0x23315b[_0x3bf3('0x12')][_0x3bf3('0x14')]);}logger['error'](_0x3bf3('0x15'),_0x1c32ec,_0x23315b['error']['message']);return _0x1d2294(_0x23315b[_0x3bf3('0x12')][_0x3bf3('0x14')]);}else{logger[_0x3bf3('0x16')]('License,\x20%s,\x20%s',_0x1c32ec,_0x3bf3('0xf'));_0x1d2294(_0x23315b[_0x3bf3('0x17')]['message']);}})[_0x3bf3('0x18')](function(_0x3233a9){logger['error']('License,\x20%s,\x20%s',_0x1c32ec,_0x3233a9);_0x1b964e(_0x3233a9);});});} \ No newline at end of file +var _0x02bd=['../../config/environment','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1bcb17,_0x492d13){var _0x21432d=function(_0x11b25a){while(--_0x11b25a){_0x1bcb17['push'](_0x1bcb17['shift']());}};_0x21432d(++_0x492d13);}(_0x02bd,0x116));var _0xd02b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x02bd[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd02b('0x0'));var util=require(_0xd02b('0x1'));var moment=require(_0xd02b('0x2'));var BPromise=require('bluebird');var rs=require(_0xd02b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd02b('0x4'))['db'];var utils=require(_0xd02b('0x5'));var logger=require(_0xd02b('0x6'))('rpc');var config=require(_0xd02b('0x7'));var jayson=require(_0xd02b('0x8'));var client=jayson[_0xd02b('0x9')][_0xd02b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x223127,_0x28defd,_0x5898c2){return new BPromise(function(_0x686967,_0x17d375){return client[_0xd02b('0xb')](_0x223127,_0x5898c2)['then'](function(_0x4c37ea){logger[_0xd02b('0xc')](_0xd02b('0xd'),_0x28defd,_0xd02b('0xe'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x28defd,_0xd02b('0xe'),JSON['stringify'](_0x4c37ea));if(_0x4c37ea[_0xd02b('0xf')]){if(_0x4c37ea[_0xd02b('0xf')]['code']===0x1f4){logger[_0xd02b('0xf')]('License,\x20%s,\x20%s',_0x28defd,_0x4c37ea[_0xd02b('0xf')]['message']);return _0x17d375(_0x4c37ea[_0xd02b('0xf')][_0xd02b('0x10')]);}logger[_0xd02b('0xf')]('License,\x20%s,\x20%s',_0x28defd,_0x4c37ea[_0xd02b('0xf')]['message']);return _0x686967(_0x4c37ea['error'][_0xd02b('0x10')]);}else{logger['info'](_0xd02b('0xd'),_0x28defd,'request\x20sent');_0x686967(_0x4c37ea[_0xd02b('0x11')]['message']);}})[_0xd02b('0x12')](function(_0x2f1f9c){logger['error']('License,\x20%s,\x20%s',_0x28defd,_0x2f1f9c);_0x17d375(_0x2f1f9c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 2d07f69..0c664fa 100644 --- a/server/api/mailAccount/index.js +++ b/server/api/mailAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x119a=['destroy','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','post','addAnswer','create','addImap','addSmtp','addApplications','/:id/send','send','addAgents','put','update','removeDispositions','delete','removeAnswers','removeImap'];(function(_0x47562c,_0x11ecb0){var _0x25e3ad=function(_0x591eeb){while(--_0x591eeb){_0x47562c['push'](_0x47562c['shift']());}};_0x25e3ad(++_0x11ecb0);}(_0x119a,0x1bd));var _0xa119=function(_0x1b4196,_0xb73443){_0x1b4196=_0x1b4196-0x0;var _0x5963e3=_0x119a[_0x1b4196];return _0x5963e3;};'use strict';var multer=require(_0xa119('0x0'));var util=require(_0xa119('0x1'));var path=require(_0xa119('0x2'));var timeout=require(_0xa119('0x3'));var express=require(_0xa119('0x4'));var router=express[_0xa119('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa119('0x6'));var interaction=require(_0xa119('0x7'));var config=require(_0xa119('0x8'));var controller=require(_0xa119('0x9'));router[_0xa119('0xa')]('/',auth[_0xa119('0xb')](),controller[_0xa119('0xc')]);router[_0xa119('0xa')]('/describe',auth[_0xa119('0xb')](),controller[_0xa119('0xd')]);router['get'](_0xa119('0xe'),auth[_0xa119('0xb')](),controller[_0xa119('0xf')]);router[_0xa119('0xa')](_0xa119('0x10'),auth[_0xa119('0xb')](),controller[_0xa119('0x11')]);router[_0xa119('0xa')](_0xa119('0x12'),auth[_0xa119('0xb')](),controller[_0xa119('0x13')]);router['get'](_0xa119('0x14'),auth['isAuthenticated'](),controller[_0xa119('0x15')]);router['get'](_0xa119('0x16'),auth[_0xa119('0xb')](),controller[_0xa119('0x17')]);router[_0xa119('0xa')](_0xa119('0x18'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xa119('0xa')](_0xa119('0x19'),auth[_0xa119('0xb')](),controller[_0xa119('0x1a')]);router['get'](_0xa119('0x1b'),auth[_0xa119('0xb')](),controller[_0xa119('0x1c')]);router[_0xa119('0xa')](_0xa119('0x1d'),auth[_0xa119('0xb')](),controller['verifySmtp']);router[_0xa119('0xa')]('/:id/users',auth[_0xa119('0xb')](),controller['getAgents']);router[_0xa119('0x1e')]('/:id/dispositions',auth[_0xa119('0xb')](),controller['addDisposition']);router[_0xa119('0x1e')]('/:id/canned_answers',auth[_0xa119('0xb')](),controller[_0xa119('0x1f')]);router[_0xa119('0x1e')]('/',auth[_0xa119('0xb')](),controller[_0xa119('0x20')]);router[_0xa119('0x1e')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xa119('0x21')]);router[_0xa119('0x1e')](_0xa119('0x16'),auth[_0xa119('0xb')](),controller[_0xa119('0x22')]);router['post']('/:id/interactions',auth[_0xa119('0xb')](),controller['addInteraction']);router[_0xa119('0x1e')](_0xa119('0x19'),auth[_0xa119('0xb')](),controller[_0xa119('0x23')]);router['post'](_0xa119('0x24'),auth[_0xa119('0xb')](),controller[_0xa119('0x25')]);router[_0xa119('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0xa119('0x26')]);router[_0xa119('0x27')](_0xa119('0xe'),auth[_0xa119('0xb')](),controller[_0xa119('0x28')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xa119('0x29')]);router[_0xa119('0x2a')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xa119('0x2b')]);router['delete'](_0xa119('0x14'),auth[_0xa119('0xb')](),controller[_0xa119('0x2c')]);router[_0xa119('0x2a')]('/:id/out_servers',auth['isAuthenticated'](),controller['removeSmtp']);router[_0xa119('0x2a')](_0xa119('0xe'),auth[_0xa119('0xb')](),controller[_0xa119('0x2d')]);router[_0xa119('0x2a')](_0xa119('0x2e'),auth[_0xa119('0xb')](),controller[_0xa119('0x2f')]);module[_0xa119('0x30')]=router; \ No newline at end of file +var _0xe2b2=['/:id/users','getAgents','post','/:id/canned_answers','create','/:id/in_servers','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send','send','addAgents','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','verifySmtp'];(function(_0x9e3ad3,_0x362185){var _0x5cf34c=function(_0x59aeb8){while(--_0x59aeb8){_0x9e3ad3['push'](_0x9e3ad3['shift']());}};_0x5cf34c(++_0x362185);}(_0xe2b2,0x1e1));var _0x2e2b=function(_0x5c8439,_0x25be06){_0x5c8439=_0x5c8439-0x0;var _0x30f3ec=_0xe2b2[_0x5c8439];return _0x30f3ec;};'use strict';var multer=require(_0x2e2b('0x0'));var util=require(_0x2e2b('0x1'));var path=require('path');var timeout=require(_0x2e2b('0x2'));var express=require(_0x2e2b('0x3'));var router=express['Router']();var fs_extra=require(_0x2e2b('0x4'));var auth=require(_0x2e2b('0x5'));var interaction=require(_0x2e2b('0x6'));var config=require(_0x2e2b('0x7'));var controller=require('./mailAccount.controller');router[_0x2e2b('0x8')]('/',auth['isAuthenticated'](),controller[_0x2e2b('0x9')]);router[_0x2e2b('0x8')](_0x2e2b('0xa'),auth['isAuthenticated'](),controller[_0x2e2b('0xb')]);router[_0x2e2b('0x8')](_0x2e2b('0xc'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0xe')]);router['get'](_0x2e2b('0xf'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x10')]);router['get']('/:id/canned_answers',auth[_0x2e2b('0xd')](),controller['getAnswers']);router[_0x2e2b('0x8')]('/:id/in_servers',auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x11')]);router[_0x2e2b('0x8')]('/:id/out_servers',auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x12')]);router[_0x2e2b('0x8')](_0x2e2b('0x13'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x14')]);router['get'](_0x2e2b('0x15'),auth[_0x2e2b('0xd')](),controller['getApplications']);router['get'](_0x2e2b('0x16'),auth[_0x2e2b('0xd')](),controller['getMessages']);router['get'](_0x2e2b('0x17'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x18')]);router['get'](_0x2e2b('0x19'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x1a')]);router[_0x2e2b('0x1b')](_0x2e2b('0xf'),auth[_0x2e2b('0xd')](),controller['addDisposition']);router[_0x2e2b('0x1b')](_0x2e2b('0x1c'),auth[_0x2e2b('0xd')](),controller['addAnswer']);router[_0x2e2b('0x1b')]('/',auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x1d')]);router[_0x2e2b('0x1b')](_0x2e2b('0x1e'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x1f')]);router[_0x2e2b('0x1b')](_0x2e2b('0x20'),auth['isAuthenticated'](),controller[_0x2e2b('0x21')]);router[_0x2e2b('0x1b')](_0x2e2b('0x13'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x22')]);router['post'](_0x2e2b('0x15'),auth[_0x2e2b('0xd')](),controller['addApplications']);router['post'](_0x2e2b('0x23'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x24')]);router[_0x2e2b('0x1b')](_0x2e2b('0x19'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x25')]);router['put'](_0x2e2b('0xc'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x26')]);router['delete'](_0x2e2b('0xf'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x27')]);router[_0x2e2b('0x28')](_0x2e2b('0x1c'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x29')]);router[_0x2e2b('0x28')](_0x2e2b('0x1e'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x2a')]);router[_0x2e2b('0x28')](_0x2e2b('0x20'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x2b')]);router[_0x2e2b('0x28')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x2e2b('0x28')]('/:id/users',auth['isAuthenticated'](),controller[_0x2e2b('0x2c')]);module[_0x2e2b('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 6003d2e..41d0f5b 100644 --- a/server/api/mailAccount/mailAccount.attributes.js +++ b/server/api/mailAccount/mailAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4880=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x59befd,_0x228cd4){var _0x15eed8=function(_0xb0e3e5){while(--_0xb0e3e5){_0x59befd['push'](_0x59befd['shift']());}};_0x15eed8(++_0x228cd4);}(_0x4880,0x19c));var _0x0488=function(_0x71d87c,_0x3c81be){_0x71d87c=_0x71d87c-0x0;var _0x16e697=_0x4880[_0x71d87c];return _0x16e697;};'use strict';var Sequelize=require(_0x0488('0x0'));module[_0x0488('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x0488('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x0488('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x0488('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x0488('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x0488('0x4')]},'markAsUnread':{'type':Sequelize[_0x0488('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0488('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x0488('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x0488('0x4')],'defaultValue':function(){return _0x0488('0x7');}},'notificationSound':{'type':Sequelize[_0x0488('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0488('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0488('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0488('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0488('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0488('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0488('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0488('0x3')],'defaultValue':![],'comment':_0x0488('0x9'),'set':function(_0x23525c){if(!_0x23525c)this[_0x0488('0xa')](_0x0488('0xb'),null);this['setDataValue'](_0x0488('0xc'),_0x23525c);}},'provider':{'type':Sequelize[_0x0488('0xd')](_0x0488('0xe'),_0x0488('0xf'),_0x0488('0x10'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x0488('0x11')](_0x0488('0x12')))return _0x0488('0x13');return this[_0x0488('0x11')](_0x0488('0x12'));},'set':function(_0x456e7b){if(_0x456e7b==='custom')_0x456e7b=null;return this[_0x0488('0xa')](_0x0488('0x12'),_0x456e7b);}}}; \ No newline at end of file +var _0x3f7c=['custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','hotmail','outlook365','getDataValue','provider'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f7c,0x91));var _0xc3f7=function(_0x1ac0fa,_0x5ca1dc){_0x1ac0fa=_0x1ac0fa-0x0;var _0x150a14=_0x3f7c[_0x1ac0fa];return _0x150a14;};'use strict';var Sequelize=require(_0xc3f7('0x0'));module[_0xc3f7('0x1')]={'description':{'type':Sequelize[_0xc3f7('0x2')]},'name':{'type':Sequelize[_0xc3f7('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xc3f7('0x4')]},'markAsUnread':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc3f7('0x2')],'allowNull':![],'defaultValue':_0xc3f7('0x5')},'fontSize':{'type':Sequelize[_0xc3f7('0x6')](0x2)[_0xc3f7('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc3f7('0x4')],'defaultValue':function(){return _0xc3f7('0x8');}},'notificationSound':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc3f7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc3f7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':![],'comment':_0xc3f7('0x9'),'set':function(_0x72eaff){if(!_0x72eaff)this[_0xc3f7('0xa')]('mandatoryDispositionPauseId',null);this[_0xc3f7('0xa')](_0xc3f7('0xb'),_0x72eaff);}},'provider':{'type':Sequelize[_0xc3f7('0xc')]('gmail',_0xc3f7('0xd'),'yahoo',_0xc3f7('0xe')),'defaultValue':null,'get':function(){if(!this[_0xc3f7('0xf')](_0xc3f7('0x10')))return _0xc3f7('0x11');return this[_0xc3f7('0xf')](_0xc3f7('0x10'));},'set':function(_0x59b36c){if(_0x59b36c==='custom')_0x59b36c=null;return this[_0xc3f7('0xa')](_0xc3f7('0x10'),_0x59b36c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 7ef8753..35eda85 100644 --- a/server/api/mailAccount/mailAccount.controller.js +++ b/server/api/mailAccount/mailAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8c9=['moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','api','../../mysqldb','redis','./mailAccount.socket','register','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','destroy','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','MailAccount','includeAll','include','rows','catch','show','params','filters','length','body','provider','custom','secure','find','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','hasOwnProperty','findAll','removeDispositions','ids','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','findOne','addImap','removeImap','getSmtp','removeSmtp','setSmtp','omit','MailInteraction','CmContact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','inlineCss','true','split','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','defaults','subject','attach','out','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents'];(function(_0x395eeb,_0xf3852c){var _0x124703=function(_0xe0a366){while(--_0xe0a366){_0x395eeb['push'](_0x395eeb['shift']());}};_0x124703(++_0xf3852c);}(_0xa8c9,0x180));var _0x9a8c=function(_0x5ca8fa,_0x1d118f){_0x5ca8fa=_0x5ca8fa-0x0;var _0x101935=_0xa8c9[_0x5ca8fa];return _0x101935;};'use strict';var moment=require(_0x9a8c('0x0'));var BPromise=require(_0x9a8c('0x1'));var util=require(_0x9a8c('0x2'));var path=require(_0x9a8c('0x3'));var _=require(_0x9a8c('0x4'));var juice=require(_0x9a8c('0x5'));var Redis=require('ioredis');var qs=require(_0x9a8c('0x6'));var logger=require('../../config/logger')(_0x9a8c('0x7'));var config=require('../../config/environment');var db=require(_0x9a8c('0x8'))['db'];config['redis']=_['defaults'](config[_0x9a8c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a8c('0x9')]));require(_0x9a8c('0xa'))[_0x9a8c('0xb')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9a8c('0xc')][_0x9a8c('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x43ff3d,_0x168559,_0x449d81,_0x2e5c48){return new BPromise(function(_0x3f735f,_0x365653){var _0x7c50b9=_0x2e5c48||client;return _0x7c50b9['request'](_0x43ff3d,_0x449d81)[_0x9a8c('0xe')](function(_0x51bf4){logger[_0x9a8c('0xf')](_0x9a8c('0x10'),_0x168559,_0x9a8c('0x11'));logger['debug'](_0x9a8c('0x12'),_0x168559,_0x9a8c('0x11'),JSON[_0x9a8c('0x13')](_0x51bf4));if(_0x51bf4['error']){if(_0x51bf4['error'][_0x9a8c('0x14')]===0x1f4){logger[_0x9a8c('0x15')](_0x9a8c('0x10'),_0x168559,_0x51bf4[_0x9a8c('0x15')][_0x9a8c('0x16')]);return _0x365653(_0x51bf4[_0x9a8c('0x15')]['message']);}logger['error'](_0x9a8c('0x10'),_0x168559,_0x51bf4['error'][_0x9a8c('0x16')]);return _0x3f735f(_0x51bf4[_0x9a8c('0x15')]['message']);}else{logger[_0x9a8c('0xf')](_0x9a8c('0x10'),_0x168559,_0x9a8c('0x11'));_0x3f735f(_0x51bf4[_0x9a8c('0x17')][_0x9a8c('0x16')]);}})['catch'](function(_0x1c1322){logger[_0x9a8c('0x15')](_0x9a8c('0x10'),_0x168559,_0x1c1322);_0x365653(_0x1c1322);});});}function respondWithStatusCode(_0x5ee13c,_0x58b353){_0x58b353=_0x58b353||0xcc;return function(_0x1dfd25){if(_0x1dfd25){return _0x5ee13c[_0x9a8c('0x18')](_0x58b353);}return _0x5ee13c[_0x9a8c('0x19')](_0x58b353)[_0x9a8c('0x1a')]();};}function respondWithResult(_0x83bb42,_0x52e849){_0x52e849=_0x52e849||0xc8;return function(_0x1bcf72){if(_0x1bcf72){return _0x83bb42[_0x9a8c('0x19')](_0x52e849)[_0x9a8c('0x1b')](_0x1bcf72);}};}function respondWithFilteredResult(_0x10755e,_0x2e36e4){return function(_0x5c1860){if(_0x5c1860){var _0x1aa573=typeof _0x2e36e4['offset']===_0x9a8c('0x1c')&&typeof _0x2e36e4['limit']===_0x9a8c('0x1c');var _0x3dece6=_0x5c1860[_0x9a8c('0x1d')];var _0x549924=_0x1aa573?0x0:_0x2e36e4[_0x9a8c('0x1e')];var _0x12177b=_0x1aa573?_0x5c1860[_0x9a8c('0x1d')]:_0x2e36e4[_0x9a8c('0x1e')]+_0x2e36e4[_0x9a8c('0x1f')];var _0x5cc486;if(_0x12177b>=_0x3dece6){_0x12177b=_0x3dece6;_0x5cc486=0xc8;}else{_0x5cc486=0xce;}_0x10755e[_0x9a8c('0x19')](_0x5cc486);return _0x10755e[_0x9a8c('0x20')](_0x9a8c('0x21'),_0x549924+'-'+_0x12177b+'/'+_0x3dece6)[_0x9a8c('0x1b')](_0x5c1860);}return null;};}function saveUpdates(_0x14b89a){return function(_0x45be68){if(_0x45be68){return _0x45be68[_0x9a8c('0x22')](_0x14b89a)[_0x9a8c('0xe')](function(_0x481295){return _0x481295;});}return null;};}function removeEntity(_0x23935e){return function(_0x441478){if(_0x441478){return _0x441478[_0x9a8c('0x23')]()[_0x9a8c('0xe')](function(){var _0x48d9df=_0x441478['get']({'plain':!![]});var _0x43829b='MailAccounts';return db['UserProfileResource'][_0x9a8c('0x23')]({'where':{'type':_0x43829b,'resourceId':_0x48d9df['id']}})[_0x9a8c('0xe')](function(){return _0x441478;});})['then'](function(){_0x23935e[_0x9a8c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0f2d){return function(_0x293c00){if(!_0x293c00){_0x3b0f2d[_0x9a8c('0x18')](0x194);}return _0x293c00;};}function handleError(_0x5b8086,_0x2e188a){_0x2e188a=_0x2e188a||0x1f4;return function(_0x25aed5){logger[_0x9a8c('0x15')](_0x25aed5[_0x9a8c('0x24')]);if(_0x25aed5['name']){delete _0x25aed5[_0x9a8c('0x25')];}_0x5b8086[_0x9a8c('0x19')](_0x2e188a)[_0x9a8c('0x26')](_0x25aed5);};}function getImapHost(_0x48f364){switch(_0x48f364){case _0x9a8c('0x27'):return _0x9a8c('0x28');case _0x9a8c('0x29'):return _0x9a8c('0x2a');case _0x9a8c('0x2b'):return'imap-mail.outlook.com';case _0x9a8c('0x2c'):return _0x9a8c('0x2d');}throw new Error(_0x9a8c('0x2e'),_0x48f364);}function getSmtpHost(_0x3c4216){switch(_0x3c4216){case'gmail':return _0x9a8c('0x2f');case _0x9a8c('0x29'):return _0x9a8c('0x30');case _0x9a8c('0x2b'):return _0x9a8c('0x31');case _0x9a8c('0x2c'):return _0x9a8c('0x32');}throw new Error(_0x9a8c('0x2e'),_0x3c4216);}function getAuthenticationOptions(_0xced740,_0x55cd0d){var _0x5ee562={};var _0x16c035={};if(_0xced740){_0x5ee562['user']=_0x16c035[_0x9a8c('0x33')]=_0x55cd0d[_0x9a8c('0x34')];_0x5ee562[_0x9a8c('0x35')]=_0x16c035[_0x9a8c('0x36')]=_0x55cd0d[_0x9a8c('0x35')];if(_0x55cd0d[_0x9a8c('0x37')]){_0x5ee562['modernAuthentication']=_0x16c035[_0x9a8c('0x37')]=!![];_0x5ee562[_0x9a8c('0x38')]=_0x16c035['CloudProviderId']=_0x55cd0d['CloudProviderId'];_0x5ee562[_0x9a8c('0x35')]=_0x16c035[_0x9a8c('0x36')]=null;}else{_0x5ee562['CloudProviderId']=_0x16c035[_0x9a8c('0x38')]=null;}_0x5ee562[_0x9a8c('0x39')]=getImapHost(_0xced740);_0x5ee562[_0x9a8c('0x3a')]=0x3e1;_0x16c035['host']=getSmtpHost(_0xced740);_0x16c035[_0x9a8c('0x3a')]=0x24b;_0x16c035['secure']=![];_0x5ee562['service']=_0x16c035[_0x9a8c('0x3b')]=null;}else{if(_0x55cd0d[_0x9a8c('0x3c')]){_0x5ee562['user']=_0x16c035[_0x9a8c('0x33')]=_0x55cd0d['username'];_0x5ee562[_0x9a8c('0x35')]=_0x16c035[_0x9a8c('0x36')]=_0x55cd0d[_0x9a8c('0x35')];}else{_0x5ee562[_0x9a8c('0x3c')]=_0x16c035[_0x9a8c('0x3c')]=![];_0x5ee562[_0x9a8c('0x33')]=_0x16c035['user']=null;_0x5ee562[_0x9a8c('0x35')]=_0x16c035[_0x9a8c('0x36')]=null;}_0x5ee562[_0x9a8c('0x39')]=_0x55cd0d['Imap']['host'];_0x5ee562[_0x9a8c('0x3a')]=_0x55cd0d[_0x9a8c('0x3d')][_0x9a8c('0x3a')];_0x16c035['host']=_0x55cd0d[_0x9a8c('0x3e')][_0x9a8c('0x39')];_0x16c035[_0x9a8c('0x3a')]=_0x55cd0d['Smtp'][_0x9a8c('0x3a')];}return{'Imap':_0x5ee562,'Smtp':_0x16c035};}exports[_0x9a8c('0x3f')]=function(_0x17acce,_0x113cf8){var _0x412a2f={'include':[{'model':db[_0x9a8c('0x40')],'as':_0x9a8c('0x3d')},{'model':db[_0x9a8c('0x41')],'as':_0x9a8c('0x3e')},{'model':db[_0x9a8c('0x42')],'as':_0x9a8c('0x43')}]},_0x3a584e={},_0x5570a5={'count':0x0,'rows':[]};var _0x386649=_[_0x9a8c('0x44')](db['MailAccount'][_0x9a8c('0x45')],function(_0x3cce43){return{'name':_0x3cce43[_0x9a8c('0x46')],'type':_0x3cce43['type'][_0x9a8c('0x47')]};});_0x3a584e[_0x9a8c('0x48')]=_['map'](_0x386649,_0x9a8c('0x25'));_0x3a584e[_0x9a8c('0x49')]=_[_0x9a8c('0x4a')](_0x17acce[_0x9a8c('0x49')]);_0x3a584e['filters']=_[_0x9a8c('0x4b')](_0x3a584e[_0x9a8c('0x48')],_0x3a584e[_0x9a8c('0x49')]);_0x412a2f[_0x9a8c('0x4c')]=_['intersection'](_0x3a584e[_0x9a8c('0x48')],qs[_0x9a8c('0x4d')](_0x17acce['query'][_0x9a8c('0x4d')]));_0x412a2f[_0x9a8c('0x4c')]=_0x412a2f['attributes']['length']?_0x412a2f[_0x9a8c('0x4c')]:_0x3a584e[_0x9a8c('0x48')];if(!_0x17acce[_0x9a8c('0x49')]['hasOwnProperty'](_0x9a8c('0x4e'))){_0x412a2f[_0x9a8c('0x1f')]=qs['limit'](_0x17acce['query'][_0x9a8c('0x1f')]);_0x412a2f[_0x9a8c('0x1e')]=qs[_0x9a8c('0x1e')](_0x17acce['query'][_0x9a8c('0x1e')]);}_0x412a2f[_0x9a8c('0x4f')]=qs[_0x9a8c('0x50')](_0x17acce[_0x9a8c('0x49')][_0x9a8c('0x50')]);_0x412a2f[_0x9a8c('0x51')]=qs['filters'](_[_0x9a8c('0x52')](_0x17acce['query'],_0x3a584e['filters']),_0x386649);if(_0x17acce[_0x9a8c('0x49')]['filter']){_0x412a2f[_0x9a8c('0x51')]=_['merge'](_0x412a2f[_0x9a8c('0x51')],{'$or':_[_0x9a8c('0x44')](_0x386649,function(_0x4e2287){if(_0x4e2287[_0x9a8c('0x53')]!==_0x9a8c('0x54')){var _0x17f0cf={};_0x17f0cf[_0x4e2287[_0x9a8c('0x25')]]={'$like':'%'+_0x17acce[_0x9a8c('0x49')][_0x9a8c('0x55')]+'%'};return _0x17f0cf;}})});}_0x412a2f=_[_0x9a8c('0x56')]({},_0x412a2f,_0x17acce[_0x9a8c('0x57')]);var _0x485eae={'where':_0x412a2f['where']};return db[_0x9a8c('0x58')][_0x9a8c('0x1d')](_0x485eae)['then'](function(_0x1d0b59){_0x5570a5['count']=_0x1d0b59;if(_0x17acce[_0x9a8c('0x49')][_0x9a8c('0x59')]){_0x412a2f[_0x9a8c('0x5a')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x412a2f);})[_0x9a8c('0xe')](function(_0x182752){_0x5570a5[_0x9a8c('0x5b')]=_0x182752;return _0x5570a5;})['then'](respondWithFilteredResult(_0x113cf8,_0x412a2f))[_0x9a8c('0x5c')](handleError(_0x113cf8,null));};exports[_0x9a8c('0x5d')]=function(_0x33b309,_0x2e8ea5){var _0x53ea77={'raw':![],'where':{'id':_0x33b309[_0x9a8c('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x9a8c('0x3d')},{'model':db[_0x9a8c('0x41')],'as':_0x9a8c('0x3e')},{'model':db[_0x9a8c('0x42')],'as':_0x9a8c('0x43')}]},_0x22c96c={};_0x22c96c[_0x9a8c('0x48')]=_['keys'](db[_0x9a8c('0x58')][_0x9a8c('0x45')]);_0x22c96c['query']=_[_0x9a8c('0x4a')](_0x33b309['query']);_0x22c96c[_0x9a8c('0x5f')]=_['intersection'](_0x22c96c[_0x9a8c('0x48')],_0x22c96c['query']);_0x53ea77['attributes']=_[_0x9a8c('0x4b')](_0x22c96c[_0x9a8c('0x48')],qs['fields'](_0x33b309[_0x9a8c('0x49')]['fields']));_0x53ea77['attributes']=_0x53ea77['attributes'][_0x9a8c('0x60')]?_0x53ea77['attributes']:_0x22c96c[_0x9a8c('0x48')];if(_0x33b309[_0x9a8c('0x49')][_0x9a8c('0x59')]){_0x53ea77[_0x9a8c('0x5a')]=[{'all':!![]}];}_0x53ea77=_[_0x9a8c('0x56')]({},_0x53ea77,_0x33b309['options']);return db[_0x9a8c('0x58')]['find'](_0x53ea77)[_0x9a8c('0xe')](handleEntityNotFound(_0x2e8ea5,null))['then'](respondWithResult(_0x2e8ea5,null))[_0x9a8c('0x5c')](handleError(_0x2e8ea5,null));};exports[_0x9a8c('0x22')]=function(_0x442a51,_0x2fd851){if(_0x442a51[_0x9a8c('0x61')]['id']){delete _0x442a51[_0x9a8c('0x61')]['id'];}var _0x2244c0=_0x442a51[_0x9a8c('0x61')][_0x9a8c('0x62')]===_0x9a8c('0x63')?null:_0x442a51[_0x9a8c('0x61')][_0x9a8c('0x62')];var _0x52e4dd=_0x442a51[_0x9a8c('0x61')][_0x9a8c('0x3d')]||{};var _0x487cca=_0x442a51[_0x9a8c('0x61')][_0x9a8c('0x3e')]||{};if(_0x2244c0){_0x52e4dd[_0x9a8c('0x39')]=getImapHost(_0x2244c0);_0x52e4dd[_0x9a8c('0x3a')]=0x3e1;_0x487cca[_0x9a8c('0x39')]=getSmtpHost(_0x2244c0);_0x487cca[_0x9a8c('0x3a')]=0x24b;_0x487cca[_0x9a8c('0x64')]=![];}if(_0x487cca[_0x9a8c('0x37')]){_0x487cca['secure']=![];}else{_0x487cca['CloudProviderId']=null;}if(!_0x52e4dd[_0x9a8c('0x37')])_0x52e4dd[_0x9a8c('0x38')]=null;_0x442a51[_0x9a8c('0x61')][_0x9a8c('0x3d')]=_0x52e4dd;_0x442a51[_0x9a8c('0x61')]['Smtp']=_0x487cca;return db[_0x9a8c('0x58')][_0x9a8c('0x65')]({'where':{'id':_0x442a51['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x9a8c('0x3d')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x9a8c('0x42')],'as':'mandatoryDispositionPause'}]})[_0x9a8c('0xe')](handleEntityNotFound(_0x2fd851,null))[_0x9a8c('0xe')](function(_0x4206c6){if(!_0x4206c6)throw new Error(_0x9a8c('0x66'));if(_0x4206c6['service'])delete _0x442a51[_0x9a8c('0x61')]['Imap'];return _0x4206c6;})[_0x9a8c('0xe')](saveUpdates(_0x442a51['body'],null))[_0x9a8c('0xe')](function(_0x452a1f){if(!_0x442a51['body'][_0x9a8c('0x3d')])return _0x452a1f;return db[_0x9a8c('0x40')]['update'](_0x442a51[_0x9a8c('0x61')]['Imap'],{'where':{'MailAccountId':_0x452a1f['id']}})[_0x9a8c('0xe')](function(){return _0x452a1f;});})[_0x9a8c('0xe')](function(_0x4ace9f){if(!_0x442a51[_0x9a8c('0x61')][_0x9a8c('0x3e')])return _0x4ace9f;return db[_0x9a8c('0x41')]['update'](_0x442a51['body'][_0x9a8c('0x3e')],{'where':{'MailAccountId':_0x4ace9f['id']}})[_0x9a8c('0xe')](function(){return _0x4ace9f;});})[_0x9a8c('0xe')](respondWithResult(_0x2fd851,null))['catch'](handleError(_0x2fd851,null));};exports[_0x9a8c('0x67')]=function(_0x3c1d7b,_0x28169b){return db[_0x9a8c('0x58')]['describe']()[_0x9a8c('0xe')](respondWithResult(_0x28169b,null))[_0x9a8c('0x5c')](handleError(_0x28169b,null));};exports[_0x9a8c('0x68')]=function(_0x3f7aa5,_0x545c73){if(_0x3f7aa5[_0x9a8c('0x61')]['id']){delete _0x3f7aa5[_0x9a8c('0x61')]['id'];}return db['MailAccount'][_0x9a8c('0x65')]({'where':{'id':_0x3f7aa5[_0x9a8c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x545c73,null))[_0x9a8c('0xe')](function(_0xc9fc91){if(_0xc9fc91){_0x3f7aa5[_0x9a8c('0x61')][_0x9a8c('0x69')]=_0xc9fc91['id'];return db[_0x9a8c('0x6a')][_0x9a8c('0x6b')](_0x3f7aa5['body']);}})[_0x9a8c('0xe')](respondWithResult(_0x545c73,null))[_0x9a8c('0x5c')](handleError(_0x545c73,null));};exports[_0x9a8c('0x6c')]=function(_0x50c6fc,_0x238786){var _0x59e8cb={'raw':![],'where':{}};var _0xfc079c={};var _0x45981e={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x50c6fc[_0x9a8c('0x5e')]['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x238786,null))[_0x9a8c('0xe')](function(_0x602250){if(_0x602250){_0xfc079c[_0x9a8c('0x48')]=_[_0x9a8c('0x4a')](db[_0x9a8c('0x6a')][_0x9a8c('0x45')]);_0xfc079c[_0x9a8c('0x49')]=_[_0x9a8c('0x4a')](_0x50c6fc['query']);_0xfc079c['filters']=_[_0x9a8c('0x4b')](_0xfc079c[_0x9a8c('0x48')],_0xfc079c['query']);_0x59e8cb[_0x9a8c('0x4c')]=_[_0x9a8c('0x4b')](_0xfc079c['model'],qs[_0x9a8c('0x4d')](_0x50c6fc[_0x9a8c('0x49')][_0x9a8c('0x4d')]));_0x59e8cb[_0x9a8c('0x4c')]=_0x59e8cb[_0x9a8c('0x4c')][_0x9a8c('0x60')]?_0x59e8cb[_0x9a8c('0x4c')]:_0xfc079c['model'];if(!_0x50c6fc[_0x9a8c('0x49')][_0x9a8c('0x6d')]('nolimit')){_0x59e8cb[_0x9a8c('0x1f')]=qs[_0x9a8c('0x1f')](_0x50c6fc[_0x9a8c('0x49')][_0x9a8c('0x1f')]);_0x59e8cb['offset']=qs[_0x9a8c('0x1e')](_0x50c6fc[_0x9a8c('0x49')][_0x9a8c('0x1e')]);}_0x59e8cb[_0x9a8c('0x4f')]=qs[_0x9a8c('0x50')](_0x50c6fc['query'][_0x9a8c('0x50')]);_0x59e8cb[_0x9a8c('0x51')]=qs[_0x9a8c('0x5f')](_[_0x9a8c('0x52')](_0x50c6fc[_0x9a8c('0x49')],_0xfc079c[_0x9a8c('0x5f')]));_0x59e8cb['where'][_0x9a8c('0x69')]=_0x602250['id'];if(_0x50c6fc['query'][_0x9a8c('0x55')]){_0x59e8cb[_0x9a8c('0x51')]=_[_0x9a8c('0x56')](_0x59e8cb[_0x9a8c('0x51')],{'$or':_[_0x9a8c('0x44')](_0x59e8cb[_0x9a8c('0x4c')],function(_0x2d4c35){var _0x464ccd={};_0x464ccd[_0x2d4c35]={'$like':'%'+_0x50c6fc[_0x9a8c('0x49')][_0x9a8c('0x55')]+'%'};return _0x464ccd;})});}_0x59e8cb=_['merge']({},_0x59e8cb,_0x50c6fc[_0x9a8c('0x57')]);return db['Disposition'][_0x9a8c('0x1d')]({'where':_0x59e8cb[_0x9a8c('0x51')]})[_0x9a8c('0xe')](function(_0x420de2){_0x45981e[_0x9a8c('0x1d')]=_0x420de2;if(_0x50c6fc[_0x9a8c('0x49')][_0x9a8c('0x59')]){_0x59e8cb[_0x9a8c('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x9a8c('0x6e')](_0x59e8cb);})['then'](function(_0x3c5f39){_0x45981e[_0x9a8c('0x5b')]=_0x3c5f39;return _0x45981e;});}})[_0x9a8c('0xe')](respondWithFilteredResult(_0x238786,_0x59e8cb))[_0x9a8c('0x5c')](handleError(_0x238786,null));};exports[_0x9a8c('0x6f')]=function(_0x1cf461,_0x43ca75){return db[_0x9a8c('0x58')][_0x9a8c('0x65')]({'where':{'id':_0x1cf461[_0x9a8c('0x5e')]['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x43ca75,null))[_0x9a8c('0xe')](function(_0xce3c86){if(_0xce3c86){return _0xce3c86['removeDispositions'](_0x1cf461['query'][_0x9a8c('0x70')]);}})['then'](respondWithStatusCode(_0x43ca75,null))[_0x9a8c('0x5c')](handleError(_0x43ca75,null));};exports['addAnswer']=function(_0x157c1f,_0x72a1ff){if(_0x157c1f[_0x9a8c('0x61')]['id']){delete _0x157c1f[_0x9a8c('0x61')]['id'];}return db[_0x9a8c('0x58')]['find']({'where':{'id':_0x157c1f['params']['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x72a1ff,null))['then'](function(_0x41cbec){if(_0x41cbec){_0x157c1f['body'][_0x9a8c('0x69')]=_0x41cbec['id'];return db[_0x9a8c('0x71')][_0x9a8c('0x6b')](_0x157c1f[_0x9a8c('0x61')]);}})[_0x9a8c('0xe')](respondWithResult(_0x72a1ff,null))[_0x9a8c('0x5c')](handleError(_0x72a1ff,null));};exports['getAnswers']=function(_0x5e2e38,_0x38a68d){var _0xefd056={'raw':![],'where':{}};var _0x1150ed={};var _0x5d4184={'count':0x0,'rows':[]};return db[_0x9a8c('0x58')]['findOne']({'where':{'id':_0x5e2e38[_0x9a8c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x38a68d,null))[_0x9a8c('0xe')](function(_0x301aaa){if(_0x301aaa){_0x1150ed[_0x9a8c('0x48')]=_[_0x9a8c('0x4a')](db['CannedAnswer'][_0x9a8c('0x45')]);_0x1150ed['query']=_[_0x9a8c('0x4a')](_0x5e2e38[_0x9a8c('0x49')]);_0x1150ed[_0x9a8c('0x5f')]=_['intersection'](_0x1150ed[_0x9a8c('0x48')],_0x1150ed['query']);_0xefd056[_0x9a8c('0x4c')]=_[_0x9a8c('0x4b')](_0x1150ed['model'],qs[_0x9a8c('0x4d')](_0x5e2e38['query'][_0x9a8c('0x4d')]));_0xefd056['attributes']=_0xefd056[_0x9a8c('0x4c')][_0x9a8c('0x60')]?_0xefd056[_0x9a8c('0x4c')]:_0x1150ed[_0x9a8c('0x48')];if(!_0x5e2e38[_0x9a8c('0x49')][_0x9a8c('0x6d')](_0x9a8c('0x4e'))){_0xefd056[_0x9a8c('0x1f')]=qs[_0x9a8c('0x1f')](_0x5e2e38[_0x9a8c('0x49')][_0x9a8c('0x1f')]);_0xefd056['offset']=qs[_0x9a8c('0x1e')](_0x5e2e38[_0x9a8c('0x49')][_0x9a8c('0x1e')]);}_0xefd056[_0x9a8c('0x4f')]=qs[_0x9a8c('0x50')](_0x5e2e38[_0x9a8c('0x49')][_0x9a8c('0x50')]);_0xefd056[_0x9a8c('0x51')]=qs['filters'](_[_0x9a8c('0x52')](_0x5e2e38[_0x9a8c('0x49')],_0x1150ed[_0x9a8c('0x5f')]));_0xefd056[_0x9a8c('0x51')][_0x9a8c('0x69')]=_0x301aaa['id'];if(_0x5e2e38[_0x9a8c('0x49')]['filter']){_0xefd056['where']=_['merge'](_0xefd056[_0x9a8c('0x51')],{'$or':_[_0x9a8c('0x44')](_0xefd056['attributes'],function(_0x38b7e3){var _0x5f15b7={};_0x5f15b7[_0x38b7e3]={'$like':'%'+_0x5e2e38['query']['filter']+'%'};return _0x5f15b7;})});}_0xefd056=_[_0x9a8c('0x56')]({},_0xefd056,_0x5e2e38[_0x9a8c('0x57')]);return db['CannedAnswer']['count']({'where':_0xefd056[_0x9a8c('0x51')]})['then'](function(_0x466eb7){_0x5d4184[_0x9a8c('0x1d')]=_0x466eb7;if(_0x5e2e38[_0x9a8c('0x49')][_0x9a8c('0x59')]){_0xefd056['include']=[{'all':!![]}];}return db[_0x9a8c('0x71')]['findAll'](_0xefd056);})[_0x9a8c('0xe')](function(_0x234f9a){_0x5d4184[_0x9a8c('0x5b')]=_0x234f9a;return _0x5d4184;});}})[_0x9a8c('0xe')](respondWithFilteredResult(_0x38a68d,_0xefd056))[_0x9a8c('0x5c')](handleError(_0x38a68d,null));};exports[_0x9a8c('0x72')]=function(_0x2847a5,_0x26088d){return db[_0x9a8c('0x58')]['find']({'where':{'id':_0x2847a5[_0x9a8c('0x5e')]['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x26088d,null))['then'](function(_0x343951){if(_0x343951){return _0x343951[_0x9a8c('0x72')](_0x2847a5[_0x9a8c('0x49')][_0x9a8c('0x70')]);}})[_0x9a8c('0xe')](respondWithStatusCode(_0x26088d,null))['catch'](handleError(_0x26088d,null));};exports['create']=function(_0x2a65cc,_0x8a032d){var _0xde8398={'name':_0x2a65cc[_0x9a8c('0x61')][_0x9a8c('0x25')],'key':_0x2a65cc[_0x9a8c('0x61')][_0x9a8c('0x47')],'provider':_0x2a65cc[_0x9a8c('0x61')][_0x9a8c('0x62')]===_0x9a8c('0x63')?null:_0x2a65cc[_0x9a8c('0x61')][_0x9a8c('0x62')],'email':_0x2a65cc[_0x9a8c('0x61')][_0x9a8c('0x73')],'ListId':_0x2a65cc['body'][_0x9a8c('0x74')],'active':!_[_0x9a8c('0x75')](_0x2a65cc[_0x9a8c('0x61')][_0x9a8c('0x76')])?_0x2a65cc[_0x9a8c('0x61')][_0x9a8c('0x76')]:!![],'description':_0x2a65cc[_0x9a8c('0x61')][_0x9a8c('0x77')]||null};var _0x5b6e03=getAuthenticationOptions(_0xde8398[_0x9a8c('0x62')],_0x2a65cc[_0x9a8c('0x61')]);_0xde8398['Imap']=_0x5b6e03['Imap'];_0xde8398[_0x9a8c('0x3e')]=_0x5b6e03[_0x9a8c('0x3e')];return db['MailAccount']['create'](_0xde8398,{'include':[{'model':db[_0x9a8c('0x41')],'as':'Smtp'},{'model':db[_0x9a8c('0x40')],'as':_0x9a8c('0x3d')}]})['then'](function(_0x5acca1){var _0x3bad8d=_0x2a65cc[_0x9a8c('0x33')][_0x9a8c('0x78')]({'plain':!![]});if(!_0x3bad8d)throw new Error(_0x9a8c('0x79'));if(_0x3bad8d[_0x9a8c('0x7a')]==='user'){var _0x3f5db0=_0x5acca1['get']({'plain':!![]});return db['UserProfileSection'][_0x9a8c('0x65')]({'where':{'name':'MailAccounts','userProfileId':_0x3bad8d[_0x9a8c('0x7b')]},'raw':!![]})[_0x9a8c('0xe')](function(_0x55d574){if(_0x55d574&&_0x55d574[_0x9a8c('0x7c')]===0x0){return db[_0x9a8c('0x7d')][_0x9a8c('0x6b')]({'name':_0x3f5db0['name'],'resourceId':_0x3f5db0['id'],'type':_0x55d574[_0x9a8c('0x25')],'sectionId':_0x55d574['id']},{})[_0x9a8c('0xe')](function(){return _0x5acca1;});}else{return _0x5acca1;}})[_0x9a8c('0x5c')](function(_0x2c3748){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c3748);throw _0x2c3748;});}return _0x5acca1;})['then'](respondWithResult(_0x8a032d,0xc9))['catch'](handleError(_0x8a032d,null));};exports['getImap']=function(_0x446a61,_0x429898){return db[_0x9a8c('0x58')][_0x9a8c('0x7e')]({'where':{'id':_0x446a61[_0x9a8c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x429898,null))[_0x9a8c('0xe')](function(_0xdf1fdc){if(_0xdf1fdc){return _0xdf1fdc['getImap']();}return null;})['then'](respondWithResult(_0x429898,null))[_0x9a8c('0x5c')](handleError(_0x429898,null));};exports[_0x9a8c('0x7f')]=function(_0xc78615,_0x12ddad){if(_0xc78615[_0x9a8c('0x61')]['id']){delete _0xc78615[_0x9a8c('0x61')]['id'];}return db[_0x9a8c('0x58')][_0x9a8c('0x65')]({'where':{'id':_0xc78615[_0x9a8c('0x5e')]['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x12ddad,null))[_0x9a8c('0xe')](function(_0x127986){if(_0x127986){_0xc78615[_0x9a8c('0x61')][_0x9a8c('0x69')]=_0x127986['id'];return db['MailServerIn'][_0x9a8c('0x6b')](_0xc78615[_0x9a8c('0x61')]);}})['then'](respondWithResult(_0x12ddad,null))[_0x9a8c('0x5c')](handleError(_0x12ddad,null));};exports[_0x9a8c('0x80')]=function(_0x7df23f,_0x374840){return db['MailAccount'][_0x9a8c('0x7e')]({'where':{'id':_0x7df23f[_0x9a8c('0x5e')]['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x374840,null))['then'](function(_0x8aa169){if(_0x8aa169){return _0x8aa169['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x374840,null))[_0x9a8c('0x5c')](handleError(_0x374840,null));};exports[_0x9a8c('0x81')]=function(_0xb0677a,_0x57a260){return db[_0x9a8c('0x58')][_0x9a8c('0x7e')]({'where':{'id':_0xb0677a[_0x9a8c('0x5e')]['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x57a260,null))['then'](function(_0x4e52dc){if(_0x4e52dc){return _0x4e52dc[_0x9a8c('0x81')]();}return null;})[_0x9a8c('0xe')](respondWithResult(_0x57a260,null))['catch'](handleError(_0x57a260,null));};exports['addSmtp']=function(_0x27fdb,_0x53ce39){if(_0x27fdb[_0x9a8c('0x61')]['id']){delete _0x27fdb[_0x9a8c('0x61')]['id'];}return db[_0x9a8c('0x58')][_0x9a8c('0x65')]({'where':{'id':_0x27fdb[_0x9a8c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x53ce39,null))[_0x9a8c('0xe')](function(_0x5b2dab){if(_0x5b2dab){_0x27fdb[_0x9a8c('0x61')]['MailAccountId']=_0x5b2dab['id'];return db[_0x9a8c('0x41')][_0x9a8c('0x6b')](_0x27fdb[_0x9a8c('0x61')]);}})[_0x9a8c('0xe')](respondWithResult(_0x53ce39,null))[_0x9a8c('0x5c')](handleError(_0x53ce39,null));};exports[_0x9a8c('0x82')]=function(_0xd29aa2,_0x2394c8){return db[_0x9a8c('0x58')][_0x9a8c('0x7e')]({'where':{'id':_0xd29aa2[_0x9a8c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2394c8,null))[_0x9a8c('0xe')](function(_0x49647a){if(_0x49647a){return _0x49647a[_0x9a8c('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x2394c8,null))[_0x9a8c('0x5c')](handleError(_0x2394c8,null));};exports['addInteraction']=function(_0x585ce1,_0x30fa6d){return db['MailInteraction'][_0x9a8c('0x65')]({'where':{'id':_0x585ce1[_0x9a8c('0x5e')]['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x30fa6d,null))['then'](function(_0x1eef15){if(_0x1eef15){return _0x1eef15['addInteraction'](_0x585ce1[_0x9a8c('0x61')][_0x9a8c('0x70')],_[_0x9a8c('0x84')](_0x585ce1[_0x9a8c('0x61')],[_0x9a8c('0x70'),'id'])||{});}})[_0x9a8c('0xe')](respondWithResult(_0x30fa6d,null))[_0x9a8c('0x5c')](handleError(_0x30fa6d,null));};exports['getInteractions']=function(_0x4506d5,_0x19a698){var _0x505363={'raw':![],'where':{}};var _0x2b869d={};var _0x33438d={'count':0x0,'rows':[]};return db[_0x9a8c('0x58')][_0x9a8c('0x7e')]({'where':{'id':_0x4506d5[_0x9a8c('0x5e')]['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x19a698,null))[_0x9a8c('0xe')](function(_0x317a1d){if(_0x317a1d){_0x2b869d[_0x9a8c('0x48')]=_[_0x9a8c('0x4a')](db['MailInteraction'][_0x9a8c('0x45')]);_0x2b869d[_0x9a8c('0x49')]=_[_0x9a8c('0x4a')](_0x4506d5[_0x9a8c('0x49')]);_0x2b869d[_0x9a8c('0x5f')]=_['intersection'](_0x2b869d[_0x9a8c('0x48')],_0x2b869d[_0x9a8c('0x49')]);_0x505363[_0x9a8c('0x4c')]=_['intersection'](_0x2b869d[_0x9a8c('0x48')],qs[_0x9a8c('0x4d')](_0x4506d5[_0x9a8c('0x49')]['fields']));_0x505363['attributes']=_0x505363['attributes'][_0x9a8c('0x60')]?_0x505363['attributes']:_0x2b869d[_0x9a8c('0x48')];if(!_0x4506d5[_0x9a8c('0x49')]['hasOwnProperty'](_0x9a8c('0x4e'))){_0x505363[_0x9a8c('0x1f')]=qs['limit'](_0x4506d5[_0x9a8c('0x49')][_0x9a8c('0x1f')]);_0x505363[_0x9a8c('0x1e')]=qs[_0x9a8c('0x1e')](_0x4506d5[_0x9a8c('0x49')][_0x9a8c('0x1e')]);}_0x505363[_0x9a8c('0x4f')]=qs[_0x9a8c('0x50')](_0x4506d5[_0x9a8c('0x49')]['sort']);_0x505363['where']=qs[_0x9a8c('0x5f')](_[_0x9a8c('0x52')](_0x4506d5[_0x9a8c('0x49')],_0x2b869d[_0x9a8c('0x5f')]));_0x505363['where'][_0x9a8c('0x69')]=_0x317a1d['id'];if(_0x4506d5['query'][_0x9a8c('0x55')]){_0x505363[_0x9a8c('0x51')]=_['merge'](_0x505363[_0x9a8c('0x51')],{'$or':_[_0x9a8c('0x44')](_0x505363[_0x9a8c('0x4c')],function(_0x29335d){var _0x4d2b17={};_0x4d2b17[_0x29335d]={'$like':'%'+_0x4506d5[_0x9a8c('0x49')][_0x9a8c('0x55')]+'%'};return _0x4d2b17;})});}_0x505363=_[_0x9a8c('0x56')]({},_0x505363,_0x4506d5[_0x9a8c('0x57')]);return db[_0x9a8c('0x85')][_0x9a8c('0x1d')]({'where':_0x505363[_0x9a8c('0x51')]})[_0x9a8c('0xe')](function(_0x3aebb1){_0x33438d[_0x9a8c('0x1d')]=_0x3aebb1;if(_0x4506d5[_0x9a8c('0x49')][_0x9a8c('0x59')]){_0x505363['include']=[{'model':db[_0x9a8c('0x86')],'as':'Contact','required':![]},{'model':db[_0x9a8c('0x87')],'as':_0x9a8c('0x88'),'attributes':['name',_0x9a8c('0x89'),_0x9a8c('0x8a')],'required':![]},{'model':db[_0x9a8c('0x8b')],'as':_0x9a8c('0x8c'),'attributes':['id',_0x9a8c('0x25'),'color'],'where':_0x4506d5[_0x9a8c('0x49')][_0x9a8c('0x8d')]?{'id':_0x4506d5[_0x9a8c('0x49')]['tag']}:undefined,'required':_0x4506d5[_0x9a8c('0x49')][_0x9a8c('0x8d')]?!![]:![]}];}return db[_0x9a8c('0x85')]['findAll'](_0x505363);})[_0x9a8c('0xe')](function(_0x1405cf){_0x33438d['rows']=_0x1405cf;return _0x33438d;});}})[_0x9a8c('0xe')](respondWithFilteredResult(_0x19a698,_0x505363))[_0x9a8c('0x5c')](handleError(_0x19a698,null));};exports[_0x9a8c('0x8e')]=function addApplications(_0x128c15,_0x1dd459){var _0x3a0013=_0x128c15[_0x9a8c('0x5e')]['id'];var _0x377f37=_0x128c15[_0x9a8c('0x61')];var _0x1e7905=0xc8;var _0x2d5d0f=null;return db[_0x9a8c('0x8f')][_0x9a8c('0x90')]({'isolationLevel':db['sequelize']['Transaction'][_0x9a8c('0x91')]['READ_COMMITTED']},function(_0x50fb92){return db['MailAccount']['findOne']({'where':{'id':_0x3a0013},'transaction':_0x50fb92})['then'](function(_0x1b33e5){if(_0x1b33e5){return db[_0x9a8c('0x92')][_0x9a8c('0x23')]({'where':{'MailAccountId':_0x3a0013},'transaction':_0x50fb92})[_0x9a8c('0xe')](function(){var _0x28a1fc=_['map'](_0x377f37,function(_0xb3519a){_0xb3519a[_0x9a8c('0x69')]=_0x3a0013;return _0xb3519a;});return db['MailApplication'][_0x9a8c('0x93')](_0x28a1fc,{'transaction':_0x50fb92});});}else{_0x1e7905=0x194;_0x2d5d0f=[];}});})['then'](function(){if(_0x1e7905!==0x194){return db[_0x9a8c('0x92')][_0x9a8c('0x94')]({'where':{'MailAccountId':_0x3a0013},'order':'priority'})[_0x9a8c('0xe')](function(_0x4b966a){_0x2d5d0f=_0x4b966a;});}})[_0x9a8c('0x5c')](function(_0x592c8f){_0x1e7905=0x1f4;logger[_0x9a8c('0x15')](_0x592c8f[_0x9a8c('0x24')]);if(_0x592c8f[_0x9a8c('0x25')]){delete _0x592c8f[_0x9a8c('0x25')];}_0x2d5d0f=_0x592c8f;})[_0x9a8c('0x95')](function(){if(_0x2d5d0f===null){_0x1dd459[_0x9a8c('0x18')](_0x1e7905);}else{if(_0x1e7905===0x1f4){_0x1dd459[_0x9a8c('0x19')](_0x1e7905)[_0x9a8c('0x26')](_0x2d5d0f);}else{_0x1dd459[_0x9a8c('0x19')](_0x1e7905)[_0x9a8c('0x1b')](_0x2d5d0f);}}});};exports['getApplications']=function(_0x2cf35c,_0x3495d9){var _0x38a1b6={};var _0x4bb436={};var _0xae9e9;var _0x3cfc20;return db['MailAccount'][_0x9a8c('0x7e')]({'where':{'id':_0x2cf35c[_0x9a8c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3495d9,null))[_0x9a8c('0xe')](function(_0x3f4e7a){if(_0x3f4e7a){_0xae9e9=_0x3f4e7a;_0x4bb436['model']=_[_0x9a8c('0x4a')](db['MailApplication'][_0x9a8c('0x45')]);_0x4bb436[_0x9a8c('0x49')]=_[_0x9a8c('0x4a')](_0x2cf35c[_0x9a8c('0x49')]);_0x4bb436['filters']=_[_0x9a8c('0x4b')](_0x4bb436[_0x9a8c('0x48')],_0x4bb436[_0x9a8c('0x49')]);_0x38a1b6[_0x9a8c('0x4c')]=_[_0x9a8c('0x4b')](_0x4bb436[_0x9a8c('0x48')],qs[_0x9a8c('0x4d')](_0x2cf35c[_0x9a8c('0x49')][_0x9a8c('0x4d')]));_0x38a1b6[_0x9a8c('0x4c')]=_0x38a1b6['attributes'][_0x9a8c('0x60')]?_0x38a1b6[_0x9a8c('0x4c')]:_0x4bb436[_0x9a8c('0x48')];_0x38a1b6[_0x9a8c('0x4f')]=qs['sort'](_0x2cf35c[_0x9a8c('0x49')]['sort']);_0x38a1b6[_0x9a8c('0x51')]=qs[_0x9a8c('0x5f')](_[_0x9a8c('0x52')](_0x2cf35c[_0x9a8c('0x49')],_0x4bb436[_0x9a8c('0x5f')]));if(_0x2cf35c[_0x9a8c('0x49')]['filter']){_0x38a1b6[_0x9a8c('0x51')]=_[_0x9a8c('0x56')](_0x38a1b6['where'],{'$or':_[_0x9a8c('0x44')](_0x38a1b6['attributes'],function(_0x1b7080){var _0xa1fc06={};_0xa1fc06[_0x1b7080]={'$like':'%'+_0x2cf35c[_0x9a8c('0x49')]['filter']+'%'};return _0xa1fc06;})});}_0x38a1b6=_[_0x9a8c('0x56')]({},_0x38a1b6,_0x2cf35c['options']);return _0xae9e9[_0x9a8c('0x96')](_0x38a1b6);}})['then'](function(_0x30eca5){if(_0x30eca5){_0x3cfc20=_0x30eca5[_0x9a8c('0x60')];if(!_0x2cf35c[_0x9a8c('0x49')][_0x9a8c('0x6d')](_0x9a8c('0x4e'))){_0x38a1b6[_0x9a8c('0x1f')]=qs['limit'](_0x2cf35c[_0x9a8c('0x49')]['limit']);_0x38a1b6['offset']=qs[_0x9a8c('0x1e')](_0x2cf35c[_0x9a8c('0x49')][_0x9a8c('0x1e')]);}return _0xae9e9[_0x9a8c('0x96')](_0x38a1b6);}})[_0x9a8c('0xe')](function(_0x587df9){if(_0x587df9){return _0x587df9?{'count':_0x3cfc20,'rows':_0x587df9}:null;}})[_0x9a8c('0xe')](respondWithResult(_0x3495d9,null))['catch'](handleError(_0x3495d9,null));};exports[_0x9a8c('0x97')]=function(_0x1d7d60,_0x214dc7){var _0x1529d4={'raw':!![],'where':{}};var _0x58d676={};var _0x3e89f9={'count':0x0,'rows':[]};return db[_0x9a8c('0x58')][_0x9a8c('0x7e')]({'where':{'id':_0x1d7d60[_0x9a8c('0x5e')]['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x214dc7,null))[_0x9a8c('0xe')](function(_0x5da0fd){if(_0x5da0fd){_0x58d676[_0x9a8c('0x48')]=_[_0x9a8c('0x4a')](db[_0x9a8c('0x98')][_0x9a8c('0x45')]);_0x58d676[_0x9a8c('0x49')]=_[_0x9a8c('0x4a')](_0x1d7d60[_0x9a8c('0x49')]);_0x58d676['filters']=_['intersection'](_0x58d676['model'],_0x58d676[_0x9a8c('0x49')]);_0x1529d4[_0x9a8c('0x4c')]=_['intersection'](_0x58d676[_0x9a8c('0x48')],qs[_0x9a8c('0x4d')](_0x1d7d60[_0x9a8c('0x49')]['fields']));_0x1529d4[_0x9a8c('0x4c')]=_0x1529d4['attributes'][_0x9a8c('0x60')]?_0x1529d4[_0x9a8c('0x4c')]:_0x58d676['model'];if(!_0x1d7d60[_0x9a8c('0x49')][_0x9a8c('0x6d')](_0x9a8c('0x4e'))){_0x1529d4[_0x9a8c('0x1f')]=qs['limit'](_0x1d7d60[_0x9a8c('0x49')][_0x9a8c('0x1f')]);_0x1529d4[_0x9a8c('0x1e')]=qs[_0x9a8c('0x1e')](_0x1d7d60[_0x9a8c('0x49')][_0x9a8c('0x1e')]);}_0x1529d4[_0x9a8c('0x4f')]=qs[_0x9a8c('0x50')](_0x1d7d60[_0x9a8c('0x49')]['sort']);_0x1529d4[_0x9a8c('0x51')]=qs[_0x9a8c('0x5f')](_['pick'](_0x1d7d60[_0x9a8c('0x49')],_0x58d676[_0x9a8c('0x5f')]));_0x1529d4[_0x9a8c('0x51')][_0x9a8c('0x69')]=_0x5da0fd['id'];if(_0x1d7d60[_0x9a8c('0x49')][_0x9a8c('0x55')]){_0x1529d4['where']=_[_0x9a8c('0x56')](_0x1529d4[_0x9a8c('0x51')],{'$or':_[_0x9a8c('0x44')](_0x1529d4[_0x9a8c('0x4c')],function(_0x2bf7d1){var _0x12c607={};_0x12c607[_0x2bf7d1]={'$like':'%'+_0x1d7d60[_0x9a8c('0x49')][_0x9a8c('0x55')]+'%'};return _0x12c607;})});}if(_0x1d7d60[_0x9a8c('0x49')][_0x9a8c('0x99')]){var _0x5ad4b7=_0x1d7d60[_0x9a8c('0x49')][_0x9a8c('0x99')]['split'](',');var _0xc96d4f={};_0xc96d4f[_0x5ad4b7[0x0]]={'$gte':moment(_0x5ad4b7[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1529d4[_0x9a8c('0x51')]=_['merge'](_0x1529d4[_0x9a8c('0x51')],_0xc96d4f);}_0x1529d4=_['merge']({},_0x1529d4,_0x1d7d60[_0x9a8c('0x57')]);return db[_0x9a8c('0x98')][_0x9a8c('0x1d')]({'where':_0x1529d4[_0x9a8c('0x51')]})[_0x9a8c('0xe')](function(_0x3b4f2e){_0x3e89f9[_0x9a8c('0x1d')]=_0x3b4f2e;if(_0x1d7d60[_0x9a8c('0x49')][_0x9a8c('0x59')]){_0x1529d4[_0x9a8c('0x5a')]=[{'all':!![]}];}return db[_0x9a8c('0x98')][_0x9a8c('0x6e')](_0x1529d4);})['then'](function(_0x17d108){if(_0x1d7d60[_0x9a8c('0x49')][_0x9a8c('0x9a')]===_0x9a8c('0x9b')){for(var _0x30acec=0x0;_0x30acec<_0x17d108[_0x9a8c('0x60')];_0x30acec++){_0x17d108[_0x30acec][_0x9a8c('0x61')]=juice(_0x17d108[_0x30acec][_0x9a8c('0x61')]);}}_0x3e89f9[_0x9a8c('0x5b')]=_0x17d108;return _0x3e89f9;});}})['then'](respondWithFilteredResult(_0x214dc7,_0x1529d4))[_0x9a8c('0x5c')](handleError(_0x214dc7,null));};exports[_0x9a8c('0x26')]=function(_0x4da437,_0x4b90f5){var _0x25f944,_0xa02ac7={},_0x1f3c61;if(_0x4da437['body']['to']){_0x1f3c61=_0x4da437[_0x9a8c('0x61')]['to'][_0x9a8c('0x9c')](',')[0x0];}return db['MailAccount'][_0x9a8c('0x65')]({'where':{'id':_0x4da437[_0x9a8c('0x5e')]['id']},'include':[{'model':db[_0x9a8c('0x9d')],'as':_0x9a8c('0x9e'),'include':[{'model':db[_0x9a8c('0x86')],'as':_0x9a8c('0x9f'),'where':{'email':_0x1f3c61},'limit':0x1,'order':[[_0x9a8c('0xa0'),'DESC']]}]},{'model':db[_0x9a8c('0x41')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x9a8c('0xa1')],'as':_0x9a8c('0xa1'),'raw':!![]}]}]})[_0x9a8c('0xe')](handleEntityNotFound(_0x4b90f5,null))[_0x9a8c('0xe')](function(_0x5b1fb5){if(!_0x5b1fb5)return;_0x25f944=_0x5b1fb5;if(!_0x5b1fb5[_0x9a8c('0x3e')])throw new Error(_0x9a8c('0xa2'));if(_[_0x9a8c('0x75')](_0x4da437[_0x9a8c('0x61')][_0x9a8c('0xa3')])){_0x4da437[_0x9a8c('0x61')][_0x9a8c('0xa3')]=util['format'](_0x9a8c('0xa4'),_0x5b1fb5[_0x9a8c('0x25')],_0x5b1fb5[_0x9a8c('0x73')]||_0x5b1fb5[_0x9a8c('0x3e')][_0x9a8c('0x33')]);}if(_0x4da437[_0x9a8c('0x61')][_0x9a8c('0xa5')]&&_0x4da437['body'][_0x9a8c('0xa5')][_0x9a8c('0x60')]){for(var _0x41618f=0x0;_0x41618f<_0x4da437[_0x9a8c('0x61')]['attachments']['length'];_0x41618f+=0x1){_0x4da437[_0x9a8c('0x61')][_0x9a8c('0xa5')][_0x41618f]={'filename':_0x4da437[_0x9a8c('0x61')][_0x9a8c('0xa5')][_0x41618f][_0x9a8c('0x25')],'path':path[_0x9a8c('0xa6')](config[_0x9a8c('0xa7')],_0x9a8c('0xa8'),_0x4da437[_0x9a8c('0x61')][_0x9a8c('0xa5')][_0x41618f][_0x9a8c('0xa9')])};}}var _0x3bfd5c=_0x5b1fb5['getSmtpOptions']();return respondWithRpcPromise(_0x9a8c('0xaa'),_0x9a8c('0xab'),{'account':_0x3bfd5c,'message':_0x4da437[_0x9a8c('0x61')]});})[_0x9a8c('0xe')](function(_0x440ec8){if(!_0x440ec8)return;_0xa02ac7=_0x440ec8;if(!_0x25f944['List'])throw new Error(_0x9a8c('0xac'));if(_0x25f944['List'][_0x9a8c('0x9f')]['length'])return _0x25f944[_0x9a8c('0x9e')][_0x9a8c('0x9f')][0x0];return db[_0x9a8c('0x86')][_0x9a8c('0x6b')](_[_0x9a8c('0xad')](_0x4da437[_0x9a8c('0x61')],{'firstName':_0x4da437[_0x9a8c('0x61')]['to'],'email':_0x4da437['body']['to'],'phone':_0x4da437[_0x9a8c('0x61')]['to'],'ListId':_0x25f944[_0x9a8c('0x74')]}));})[_0x9a8c('0xe')](function(_0xe07ebd){if(!_0xe07ebd)return;var _0x581587={'UserId':_0x4da437[_0x9a8c('0x33')]['id'],'ContactId':_0xe07ebd['id'],'MailAccountId':_0x25f944['id'],'inReplyTo':_0xa02ac7['messageId'],'to':_0x4da437[_0x9a8c('0x61')][_0x9a8c('0xa3')],'cc':_0x4da437[_0x9a8c('0x61')]['cc'],'subject':_0x4da437[_0x9a8c('0x61')][_0x9a8c('0xae')],'attach':_0x4da437['body'][_0x9a8c('0xaf')],'firstMsgDirection':_0x9a8c('0xb0'),'lastMsgAt':moment()[_0x9a8c('0xb1')](_0x9a8c('0xb2')),'lastMsgDirection':_0x9a8c('0xb0'),'Messages':[_[_0x9a8c('0x56')](_0x4da437[_0x9a8c('0x61')],{'messageId':_0xa02ac7['messageId'],'sentAt':moment()['format'](_0x9a8c('0xb2')),'read':!![],'MailAccountId':_0x25f944['id'],'UserId':_0x4da437['user']['id'],'ContactId':_0xe07ebd['id']})]};if(_0x4da437[_0x9a8c('0x61')]['Interaction']){_0x581587=_[_0x9a8c('0x56')](_0x581587,_0x4da437[_0x9a8c('0x61')][_0x9a8c('0xb3')]);}return db[_0x9a8c('0x85')][_0x9a8c('0x6b')](_0x581587,{'include':[{'model':db[_0x9a8c('0x98')],'as':_0x9a8c('0xb4')}]});})[_0x9a8c('0xe')](respondWithResult(_0x4b90f5,null))['catch'](handleError(_0x4b90f5,null));};exports[_0x9a8c('0xb5')]=function(_0x5da336,_0x417413){return db['MailAccount'][_0x9a8c('0x65')]({'where':{'id':_0x5da336[_0x9a8c('0x5e')]['id']},'include':[{'model':db[_0x9a8c('0x41')],'as':_0x9a8c('0x3e'),'raw':!![],'include':[{'model':db[_0x9a8c('0xa1')],'as':_0x9a8c('0xa1'),'raw':!![]}]}]})[_0x9a8c('0xe')](handleEntityNotFound(_0x417413,null))[_0x9a8c('0xe')](function(_0x1c48f1){if(!_0x1c48f1[_0x9a8c('0x3e')])return;var _0x75239b=_0x1c48f1[_0x9a8c('0xb6')]();return respondWithRpcPromise(_0x9a8c('0xb7'),'verifySmtp',{'account':_0x75239b});})[_0x9a8c('0xe')](respondWithResult(_0x417413,null))[_0x9a8c('0x5c')](handleError(_0x417413,null));};exports[_0x9a8c('0x23')]=function(_0xf2a74c,_0x4db0ff){return db[_0x9a8c('0x58')]['find']({'where':{'id':_0xf2a74c[_0x9a8c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4db0ff,null))['then'](function(_0x3f5348){if(_0x3f5348&&_0x3f5348[_0x9a8c('0x3b')]){throw new db[(_0x9a8c('0xb8'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3f5348;})[_0x9a8c('0xe')](removeEntity(_0x4db0ff,null))[_0x9a8c('0x5c')](handleError(_0x4db0ff,null));};exports['addAgents']=function(_0x5c056f,_0x1ce005){return db[_0x9a8c('0x58')][_0x9a8c('0x65')]({'where':{'id':_0x5c056f[_0x9a8c('0x5e')]['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x1ce005,null))['then'](function(_0x271c4b){if(_0x271c4b){return _0x271c4b[_0x9a8c('0xb9')](_0x5c056f[_0x9a8c('0x61')]['ids'],_[_0x9a8c('0x84')](_0x5c056f['body'],['ids','id'])||{})[_0x9a8c('0xba')](function(_0x19d372){for(var _0x81e579=0x0;_0x81e579<_0x5c056f[_0x9a8c('0x61')][_0x9a8c('0x70')][_0x9a8c('0x60')];_0x81e579+=0x1){socket[_0x9a8c('0xbb')](_0x9a8c('0xbc'),{'UserId':Number(_0x5c056f[_0x9a8c('0x61')][_0x9a8c('0x70')][_0x81e579]),'MailAccountId':Number(_0x5c056f[_0x9a8c('0x5e')]['id'])});}return _0x19d372;});}})['then'](respondWithResult(_0x1ce005,null))[_0x9a8c('0x5c')](handleError(_0x1ce005,null));};exports[_0x9a8c('0xbd')]=function(_0x16448c,_0xb390e4){return db[_0x9a8c('0x58')][_0x9a8c('0x65')]({'where':{'id':_0x16448c[_0x9a8c('0x5e')]['id']}})['then'](handleEntityNotFound(_0xb390e4,null))[_0x9a8c('0xe')](function(_0x215bae){if(_0x215bae){return _0x215bae[_0x9a8c('0xbd')](_0x16448c[_0x9a8c('0x49')][_0x9a8c('0x70')])[_0x9a8c('0xe')](function(){if(_['isArray'](_0x16448c[_0x9a8c('0x49')][_0x9a8c('0x70')])){for(var _0x2ac541=0x0;_0x2ac541<_0x16448c[_0x9a8c('0x49')]['ids'][_0x9a8c('0x60')];_0x2ac541+=0x1){socket[_0x9a8c('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x16448c[_0x9a8c('0x49')][_0x9a8c('0x70')][_0x2ac541]),'MailAccountId':Number(_0x16448c[_0x9a8c('0x5e')]['id'])});}}else{socket[_0x9a8c('0xbb')](_0x9a8c('0xbe'),{'UserId':Number(_0x16448c[_0x9a8c('0x49')]['ids']),'MailAccountId':Number(_0x16448c[_0x9a8c('0x5e')]['id'])});}});}})[_0x9a8c('0xe')](respondWithStatusCode(_0xb390e4,null))[_0x9a8c('0x5c')](handleError(_0xb390e4,null));};exports[_0x9a8c('0xbf')]=function(_0x2cad14,_0x2a248f){var _0x2070e3={};var _0x5072c7={};var _0x116e0c;var _0x11a1f7;return db[_0x9a8c('0x58')][_0x9a8c('0x7e')]({'where':{'id':_0x2cad14[_0x9a8c('0x5e')]['id']}})[_0x9a8c('0xe')](handleEntityNotFound(_0x2a248f,null))[_0x9a8c('0xe')](function(_0x2b8e2a){if(_0x2b8e2a){_0x116e0c=_0x2b8e2a;_0x5072c7[_0x9a8c('0x48')]=_[_0x9a8c('0x4a')](db[_0x9a8c('0x87')]['rawAttributes']);_0x5072c7['query']=_[_0x9a8c('0x4a')](_0x2cad14[_0x9a8c('0x49')]);_0x5072c7[_0x9a8c('0x5f')]=_[_0x9a8c('0x4b')](_0x5072c7[_0x9a8c('0x48')],_0x5072c7[_0x9a8c('0x49')]);_0x2070e3[_0x9a8c('0x4c')]=_[_0x9a8c('0x4b')](_0x5072c7[_0x9a8c('0x48')],qs[_0x9a8c('0x4d')](_0x2cad14[_0x9a8c('0x49')][_0x9a8c('0x4d')]));_0x2070e3[_0x9a8c('0x4c')]=_0x2070e3[_0x9a8c('0x4c')][_0x9a8c('0x60')]?_0x2070e3[_0x9a8c('0x4c')]:_0x5072c7[_0x9a8c('0x48')];_0x2070e3[_0x9a8c('0x4f')]=qs[_0x9a8c('0x50')](_0x2cad14['query']['sort']);_0x2070e3[_0x9a8c('0x51')]=qs['filters'](_[_0x9a8c('0x52')](_0x2cad14['query'],_0x5072c7[_0x9a8c('0x5f')]));if(_0x2cad14[_0x9a8c('0x49')][_0x9a8c('0x55')]){_0x2070e3[_0x9a8c('0x51')]=_[_0x9a8c('0x56')](_0x2070e3['where'],{'$or':_[_0x9a8c('0x44')](_0x2070e3['attributes'],function(_0x18d361){var _0x18b740={};_0x18b740[_0x18d361]={'$like':'%'+_0x2cad14[_0x9a8c('0x49')]['filter']+'%'};return _0x18b740;})});}_0x2070e3=_[_0x9a8c('0x56')]({},_0x2070e3,_0x2cad14[_0x9a8c('0x57')]);return _0x116e0c[_0x9a8c('0xbf')](_0x2070e3);}})[_0x9a8c('0xe')](function(_0x4af070){if(_0x4af070){_0x11a1f7=_0x4af070[_0x9a8c('0x60')];if(!_0x2cad14[_0x9a8c('0x49')][_0x9a8c('0x6d')](_0x9a8c('0x4e'))){_0x2070e3[_0x9a8c('0x1f')]=qs[_0x9a8c('0x1f')](_0x2cad14[_0x9a8c('0x49')][_0x9a8c('0x1f')]);_0x2070e3[_0x9a8c('0x1e')]=qs['offset'](_0x2cad14['query']['offset']);}return _0x116e0c[_0x9a8c('0xbf')](_0x2070e3);}})[_0x9a8c('0xe')](function(_0x408e3f){if(_0x408e3f){return _0x408e3f?{'count':_0x11a1f7,'rows':_0x408e3f}:null;}})[_0x9a8c('0xe')](respondWithResult(_0x2a248f,null))['catch'](handleError(_0x2a248f,null));}; \ No newline at end of file +var _0x0dea=['nolimit','removeAnswers','email','ListId','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','setSmtp','MailInteraction','CmContact','Contact','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List','defaults','subject','out','messageId','Interaction','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','bluebird','util','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','stack','name','gmail','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','MailServerIn','keys','rawAttributes','include','find','catch','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer'];(function(_0x51a710,_0x5ce2a3){var _0x58e717=function(_0x40e436){while(--_0x40e436){_0x51a710['push'](_0x51a710['shift']());}};_0x58e717(++_0x5ce2a3);}(_0x0dea,0x10b));var _0xa0de=function(_0x38894d,_0x1883d8){_0x38894d=_0x38894d-0x0;var _0x5614fe=_0x0dea[_0x38894d];return _0x5614fe;};'use strict';var moment=require('moment');var BPromise=require(_0xa0de('0x0'));var util=require(_0xa0de('0x1'));var path=require('path');var _=require('lodash');var juice=require('juice');var Redis=require('ioredis');var qs=require(_0xa0de('0x2'));var logger=require('../../config/logger')(_0xa0de('0x3'));var config=require(_0xa0de('0x4'));var db=require(_0xa0de('0x5'))['db'];config[_0xa0de('0x6')]=_['defaults'](config[_0xa0de('0x6')],{'host':_0xa0de('0x7'),'port':0x18eb});var socket=require(_0xa0de('0x8'))(new Redis(config[_0xa0de('0x6')]));require('./mailAccount.socket')[_0xa0de('0x9')](socket);var jayson=require(_0xa0de('0xa'));var client=jayson[_0xa0de('0xb')][_0xa0de('0xc')]({'port':0x232b});function respondWithRpcPromise(_0x11bb9d,_0x49c71a,_0x52a3dd,_0x4e9551){return new BPromise(function(_0x2a23f9,_0x548d7a){var _0x36957e=_0x4e9551||client;return _0x36957e['request'](_0x11bb9d,_0x52a3dd)['then'](function(_0x35ae44){logger[_0xa0de('0xd')](_0xa0de('0xe'),_0x49c71a,_0xa0de('0xf'));logger[_0xa0de('0x10')](_0xa0de('0x11'),_0x49c71a,'request\x20sent',JSON[_0xa0de('0x12')](_0x35ae44));if(_0x35ae44[_0xa0de('0x13')]){if(_0x35ae44[_0xa0de('0x13')]['code']===0x1f4){logger[_0xa0de('0x13')](_0xa0de('0xe'),_0x49c71a,_0x35ae44[_0xa0de('0x13')][_0xa0de('0x14')]);return _0x548d7a(_0x35ae44[_0xa0de('0x13')][_0xa0de('0x14')]);}logger[_0xa0de('0x13')]('MailAccount,\x20%s,\x20%s',_0x49c71a,_0x35ae44[_0xa0de('0x13')]['message']);return _0x2a23f9(_0x35ae44[_0xa0de('0x13')][_0xa0de('0x14')]);}else{logger['info'](_0xa0de('0xe'),_0x49c71a,'request\x20sent');_0x2a23f9(_0x35ae44['result'][_0xa0de('0x14')]);}})['catch'](function(_0x276f92){logger[_0xa0de('0x13')]('MailAccount,\x20%s,\x20%s',_0x49c71a,_0x276f92);_0x548d7a(_0x276f92);});});}function respondWithStatusCode(_0x1c139e,_0xe11813){_0xe11813=_0xe11813||0xcc;return function(_0xc957d3){if(_0xc957d3){return _0x1c139e[_0xa0de('0x15')](_0xe11813);}return _0x1c139e[_0xa0de('0x16')](_0xe11813)[_0xa0de('0x17')]();};}function respondWithResult(_0x3b185f,_0x29159c){_0x29159c=_0x29159c||0xc8;return function(_0x54b17a){if(_0x54b17a){return _0x3b185f[_0xa0de('0x16')](_0x29159c)[_0xa0de('0x18')](_0x54b17a);}};}function respondWithFilteredResult(_0x5a6450,_0xffb03a){return function(_0x13a379){if(_0x13a379){var _0x2cf4bb=typeof _0xffb03a[_0xa0de('0x19')]===_0xa0de('0x1a')&&typeof _0xffb03a[_0xa0de('0x1b')]===_0xa0de('0x1a');var _0x134114=_0x13a379[_0xa0de('0x1c')];var _0x50408e=_0x2cf4bb?0x0:_0xffb03a[_0xa0de('0x19')];var _0x18a783=_0x2cf4bb?_0x13a379[_0xa0de('0x1c')]:_0xffb03a[_0xa0de('0x19')]+_0xffb03a[_0xa0de('0x1b')];var _0xb4f83;if(_0x18a783>=_0x134114){_0x18a783=_0x134114;_0xb4f83=0xc8;}else{_0xb4f83=0xce;}_0x5a6450[_0xa0de('0x16')](_0xb4f83);return _0x5a6450[_0xa0de('0x1d')]('Content-Range',_0x50408e+'-'+_0x18a783+'/'+_0x134114)['json'](_0x13a379);}return null;};}function saveUpdates(_0x588e13){return function(_0x3c24de){if(_0x3c24de){return _0x3c24de[_0xa0de('0x1e')](_0x588e13)[_0xa0de('0x1f')](function(_0x36646e){return _0x36646e;});}return null;};}function removeEntity(_0x199214){return function(_0x2155a7){if(_0x2155a7){return _0x2155a7[_0xa0de('0x20')]()[_0xa0de('0x1f')](function(){var _0x193149=_0x2155a7[_0xa0de('0x21')]({'plain':!![]});var _0x5d5aa2='MailAccounts';return db[_0xa0de('0x22')][_0xa0de('0x20')]({'where':{'type':_0x5d5aa2,'resourceId':_0x193149['id']}})[_0xa0de('0x1f')](function(){return _0x2155a7;});})[_0xa0de('0x1f')](function(){_0x199214['status'](0xcc)[_0xa0de('0x17')]();});}};}function handleEntityNotFound(_0x1d416b){return function(_0x1a07fc){if(!_0x1a07fc){_0x1d416b[_0xa0de('0x15')](0x194);}return _0x1a07fc;};}function handleError(_0x2d3b1a,_0x3af2e2){_0x3af2e2=_0x3af2e2||0x1f4;return function(_0x426e46){logger[_0xa0de('0x13')](_0x426e46[_0xa0de('0x23')]);if(_0x426e46['name']){delete _0x426e46[_0xa0de('0x24')];}_0x2d3b1a['status'](_0x3af2e2)['send'](_0x426e46);};}function getImapHost(_0x227a0d){switch(_0x227a0d){case _0xa0de('0x25'):return'imap.gmail.com';case'yahoo':return _0xa0de('0x26');case _0xa0de('0x27'):return _0xa0de('0x28');case _0xa0de('0x29'):return _0xa0de('0x2a');}throw new Error(_0xa0de('0x2b'),_0x227a0d);}function getSmtpHost(_0x1f824a){switch(_0x1f824a){case _0xa0de('0x25'):return _0xa0de('0x2c');case'yahoo':return _0xa0de('0x2d');case'hotmail':return'smtp-mail.outlook.com';case _0xa0de('0x29'):return _0xa0de('0x2e');}throw new Error(_0xa0de('0x2b'),_0x1f824a);}function getAuthenticationOptions(_0x276a2d,_0x341fcd){var _0x21dd8a={};var _0x42850d={};if(_0x276a2d){_0x21dd8a[_0xa0de('0x2f')]=_0x42850d['user']=_0x341fcd[_0xa0de('0x30')];_0x21dd8a[_0xa0de('0x31')]=_0x42850d[_0xa0de('0x32')]=_0x341fcd[_0xa0de('0x31')];if(_0x341fcd[_0xa0de('0x33')]){_0x21dd8a[_0xa0de('0x33')]=_0x42850d[_0xa0de('0x33')]=!![];_0x21dd8a[_0xa0de('0x34')]=_0x42850d[_0xa0de('0x34')]=_0x341fcd[_0xa0de('0x34')];_0x21dd8a[_0xa0de('0x31')]=_0x42850d[_0xa0de('0x32')]=null;}else{_0x21dd8a[_0xa0de('0x34')]=_0x42850d[_0xa0de('0x34')]=null;}_0x21dd8a[_0xa0de('0x35')]=getImapHost(_0x276a2d);_0x21dd8a[_0xa0de('0x36')]=0x3e1;_0x42850d[_0xa0de('0x35')]=getSmtpHost(_0x276a2d);_0x42850d[_0xa0de('0x36')]=0x24b;_0x42850d['secure']=![];_0x21dd8a[_0xa0de('0x37')]=_0x42850d['service']=null;}else{if(_0x341fcd[_0xa0de('0x38')]){_0x21dd8a[_0xa0de('0x2f')]=_0x42850d[_0xa0de('0x2f')]=_0x341fcd['username'];_0x21dd8a[_0xa0de('0x31')]=_0x42850d[_0xa0de('0x32')]=_0x341fcd[_0xa0de('0x31')];}else{_0x21dd8a[_0xa0de('0x38')]=_0x42850d[_0xa0de('0x38')]=![];_0x21dd8a[_0xa0de('0x2f')]=_0x42850d[_0xa0de('0x2f')]=null;_0x21dd8a[_0xa0de('0x31')]=_0x42850d[_0xa0de('0x32')]=null;}_0x21dd8a[_0xa0de('0x35')]=_0x341fcd['Imap'][_0xa0de('0x35')];_0x21dd8a[_0xa0de('0x36')]=_0x341fcd[_0xa0de('0x39')][_0xa0de('0x36')];_0x42850d[_0xa0de('0x35')]=_0x341fcd['Smtp'][_0xa0de('0x35')];_0x42850d[_0xa0de('0x36')]=_0x341fcd[_0xa0de('0x3a')][_0xa0de('0x36')];}return{'Imap':_0x21dd8a,'Smtp':_0x42850d};}exports['index']=function(_0x5d9ef0,_0x2978f7){var _0x3ca82a={'include':[{'model':db['MailServerIn'],'as':_0xa0de('0x39')},{'model':db[_0xa0de('0x3b')],'as':_0xa0de('0x3a')},{'model':db[_0xa0de('0x3c')],'as':_0xa0de('0x3d')}]},_0x2e8587={},_0x50f9b4={'count':0x0,'rows':[]};var _0x596d7f=_['map'](db[_0xa0de('0x3e')]['rawAttributes'],function(_0x4f2ae4){return{'name':_0x4f2ae4[_0xa0de('0x3f')],'type':_0x4f2ae4[_0xa0de('0x40')][_0xa0de('0x41')]};});_0x2e8587['model']=_[_0xa0de('0x42')](_0x596d7f,_0xa0de('0x24'));_0x2e8587[_0xa0de('0x43')]=_['keys'](_0x5d9ef0[_0xa0de('0x43')]);_0x2e8587[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x2e8587['model'],_0x2e8587['query']);_0x3ca82a[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x2e8587[_0xa0de('0x47')],qs[_0xa0de('0x48')](_0x5d9ef0['query']['fields']));_0x3ca82a['attributes']=_0x3ca82a[_0xa0de('0x46')][_0xa0de('0x49')]?_0x3ca82a[_0xa0de('0x46')]:_0x2e8587[_0xa0de('0x47')];if(!_0x5d9ef0[_0xa0de('0x43')]['hasOwnProperty']('nolimit')){_0x3ca82a['limit']=qs[_0xa0de('0x1b')](_0x5d9ef0['query'][_0xa0de('0x1b')]);_0x3ca82a['offset']=qs[_0xa0de('0x19')](_0x5d9ef0[_0xa0de('0x43')]['offset']);}_0x3ca82a[_0xa0de('0x4a')]=qs[_0xa0de('0x4b')](_0x5d9ef0[_0xa0de('0x43')][_0xa0de('0x4b')]);_0x3ca82a[_0xa0de('0x4c')]=qs['filters'](_[_0xa0de('0x4d')](_0x5d9ef0['query'],_0x2e8587[_0xa0de('0x44')]),_0x596d7f);if(_0x5d9ef0[_0xa0de('0x43')][_0xa0de('0x4e')]){_0x3ca82a[_0xa0de('0x4c')]=_['merge'](_0x3ca82a[_0xa0de('0x4c')],{'$or':_[_0xa0de('0x42')](_0x596d7f,function(_0x5e076d){if(_0x5e076d['type']!=='VIRTUAL'){var _0x2cb9f8={};_0x2cb9f8[_0x5e076d[_0xa0de('0x24')]]={'$like':'%'+_0x5d9ef0[_0xa0de('0x43')][_0xa0de('0x4e')]+'%'};return _0x2cb9f8;}})});}_0x3ca82a=_[_0xa0de('0x4f')]({},_0x3ca82a,_0x5d9ef0[_0xa0de('0x50')]);var _0x57f105={'where':_0x3ca82a['where']};return db[_0xa0de('0x3e')][_0xa0de('0x1c')](_0x57f105)[_0xa0de('0x1f')](function(_0x2bbd9b){_0x50f9b4[_0xa0de('0x1c')]=_0x2bbd9b;if(_0x5d9ef0[_0xa0de('0x43')][_0xa0de('0x51')]){_0x3ca82a['include']=[{'all':!![]}];}return db[_0xa0de('0x3e')][_0xa0de('0x52')](_0x3ca82a);})[_0xa0de('0x1f')](function(_0x30bed5){_0x50f9b4[_0xa0de('0x53')]=_0x30bed5;return _0x50f9b4;})['then'](respondWithFilteredResult(_0x2978f7,_0x3ca82a))['catch'](handleError(_0x2978f7,null));};exports[_0xa0de('0x54')]=function(_0x1d1c14,_0x24f6df){var _0x11afa9={'raw':![],'where':{'id':_0x1d1c14[_0xa0de('0x55')]['id']},'include':[{'model':db[_0xa0de('0x56')],'as':_0xa0de('0x39')},{'model':db[_0xa0de('0x3b')],'as':_0xa0de('0x3a')},{'model':db[_0xa0de('0x3c')],'as':_0xa0de('0x3d')}]},_0x5bfac0={};_0x5bfac0[_0xa0de('0x47')]=_[_0xa0de('0x57')](db['MailAccount'][_0xa0de('0x58')]);_0x5bfac0[_0xa0de('0x43')]=_['keys'](_0x1d1c14[_0xa0de('0x43')]);_0x5bfac0[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x5bfac0[_0xa0de('0x47')],_0x5bfac0['query']);_0x11afa9[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x5bfac0[_0xa0de('0x47')],qs[_0xa0de('0x48')](_0x1d1c14['query'][_0xa0de('0x48')]));_0x11afa9[_0xa0de('0x46')]=_0x11afa9[_0xa0de('0x46')][_0xa0de('0x49')]?_0x11afa9[_0xa0de('0x46')]:_0x5bfac0['model'];if(_0x1d1c14[_0xa0de('0x43')][_0xa0de('0x51')]){_0x11afa9[_0xa0de('0x59')]=[{'all':!![]}];}_0x11afa9=_[_0xa0de('0x4f')]({},_0x11afa9,_0x1d1c14[_0xa0de('0x50')]);return db[_0xa0de('0x3e')][_0xa0de('0x5a')](_0x11afa9)[_0xa0de('0x1f')](handleEntityNotFound(_0x24f6df,null))[_0xa0de('0x1f')](respondWithResult(_0x24f6df,null))[_0xa0de('0x5b')](handleError(_0x24f6df,null));};exports[_0xa0de('0x1e')]=function(_0x3b4d20,_0x4d5489){if(_0x3b4d20[_0xa0de('0x5c')]['id']){delete _0x3b4d20['body']['id'];}var _0x4d8603=_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x5d')]===_0xa0de('0x5e')?null:_0x3b4d20['body'][_0xa0de('0x5d')];var _0x425c4e=_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x39')]||{};var _0x1cfdd4=_0x3b4d20[_0xa0de('0x5c')]['Smtp']||{};if(_0x4d8603){_0x425c4e[_0xa0de('0x35')]=getImapHost(_0x4d8603);_0x425c4e[_0xa0de('0x36')]=0x3e1;_0x1cfdd4['host']=getSmtpHost(_0x4d8603);_0x1cfdd4[_0xa0de('0x36')]=0x24b;_0x1cfdd4[_0xa0de('0x5f')]=![];}if(_0x1cfdd4['modernAuthentication']){_0x1cfdd4[_0xa0de('0x5f')]=![];}else{_0x1cfdd4[_0xa0de('0x34')]=null;}if(!_0x425c4e[_0xa0de('0x33')])_0x425c4e['CloudProviderId']=null;_0x3b4d20[_0xa0de('0x5c')]['Imap']=_0x425c4e;_0x3b4d20['body'][_0xa0de('0x3a')]=_0x1cfdd4;return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x3b4d20[_0xa0de('0x55')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xa0de('0x39')},{'model':db[_0xa0de('0x3b')],'as':_0xa0de('0x3a')},{'model':db[_0xa0de('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xa0de('0x1f')](handleEntityNotFound(_0x4d5489,null))[_0xa0de('0x1f')](function(_0x5940f6){if(!_0x5940f6)throw new Error(_0xa0de('0x60'));if(_0x5940f6[_0xa0de('0x37')])delete _0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x39')];return _0x5940f6;})[_0xa0de('0x1f')](saveUpdates(_0x3b4d20[_0xa0de('0x5c')],null))['then'](function(_0x4322fe){if(!_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x39')])return _0x4322fe;return db[_0xa0de('0x56')][_0xa0de('0x1e')](_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x39')],{'where':{'MailAccountId':_0x4322fe['id']}})['then'](function(){return _0x4322fe;});})[_0xa0de('0x1f')](function(_0x4b245d){if(!_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x3a')])return _0x4b245d;return db[_0xa0de('0x3b')][_0xa0de('0x1e')](_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x3a')],{'where':{'MailAccountId':_0x4b245d['id']}})[_0xa0de('0x1f')](function(){return _0x4b245d;});})[_0xa0de('0x1f')](respondWithResult(_0x4d5489,null))[_0xa0de('0x5b')](handleError(_0x4d5489,null));};exports[_0xa0de('0x61')]=function(_0x276df6,_0x34d7af){return db[_0xa0de('0x3e')][_0xa0de('0x61')]()[_0xa0de('0x1f')](respondWithResult(_0x34d7af,null))[_0xa0de('0x5b')](handleError(_0x34d7af,null));};exports[_0xa0de('0x62')]=function(_0x362acf,_0x1c4ea8){if(_0x362acf[_0xa0de('0x5c')]['id']){delete _0x362acf[_0xa0de('0x5c')]['id'];}return db[_0xa0de('0x3e')]['find']({'where':{'id':_0x362acf[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x1c4ea8,null))[_0xa0de('0x1f')](function(_0x211a4f){if(_0x211a4f){_0x362acf[_0xa0de('0x5c')][_0xa0de('0x63')]=_0x211a4f['id'];return db[_0xa0de('0x64')][_0xa0de('0x65')](_0x362acf[_0xa0de('0x5c')]);}})[_0xa0de('0x1f')](respondWithResult(_0x1c4ea8,null))[_0xa0de('0x5b')](handleError(_0x1c4ea8,null));};exports[_0xa0de('0x66')]=function(_0x31a66a,_0x5a9197){var _0x1194ef={'raw':![],'where':{}};var _0x12ce87={};var _0x592da8={'count':0x0,'rows':[]};return db[_0xa0de('0x3e')][_0xa0de('0x67')]({'where':{'id':_0x31a66a[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x5a9197,null))[_0xa0de('0x1f')](function(_0xd963b4){if(_0xd963b4){_0x12ce87[_0xa0de('0x47')]=_[_0xa0de('0x57')](db[_0xa0de('0x64')][_0xa0de('0x58')]);_0x12ce87[_0xa0de('0x43')]=_['keys'](_0x31a66a[_0xa0de('0x43')]);_0x12ce87['filters']=_[_0xa0de('0x45')](_0x12ce87[_0xa0de('0x47')],_0x12ce87[_0xa0de('0x43')]);_0x1194ef[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x12ce87['model'],qs[_0xa0de('0x48')](_0x31a66a['query']['fields']));_0x1194ef['attributes']=_0x1194ef[_0xa0de('0x46')][_0xa0de('0x49')]?_0x1194ef[_0xa0de('0x46')]:_0x12ce87['model'];if(!_0x31a66a[_0xa0de('0x43')][_0xa0de('0x68')]('nolimit')){_0x1194ef[_0xa0de('0x1b')]=qs[_0xa0de('0x1b')](_0x31a66a[_0xa0de('0x43')][_0xa0de('0x1b')]);_0x1194ef[_0xa0de('0x19')]=qs[_0xa0de('0x19')](_0x31a66a[_0xa0de('0x43')][_0xa0de('0x19')]);}_0x1194ef[_0xa0de('0x4a')]=qs[_0xa0de('0x4b')](_0x31a66a[_0xa0de('0x43')]['sort']);_0x1194ef[_0xa0de('0x4c')]=qs[_0xa0de('0x44')](_[_0xa0de('0x4d')](_0x31a66a['query'],_0x12ce87[_0xa0de('0x44')]));_0x1194ef['where'][_0xa0de('0x63')]=_0xd963b4['id'];if(_0x31a66a['query']['filter']){_0x1194ef[_0xa0de('0x4c')]=_[_0xa0de('0x4f')](_0x1194ef['where'],{'$or':_[_0xa0de('0x42')](_0x1194ef[_0xa0de('0x46')],function(_0x25813b){var _0x952aa4={};_0x952aa4[_0x25813b]={'$like':'%'+_0x31a66a[_0xa0de('0x43')][_0xa0de('0x4e')]+'%'};return _0x952aa4;})});}_0x1194ef=_[_0xa0de('0x4f')]({},_0x1194ef,_0x31a66a['options']);return db['Disposition']['count']({'where':_0x1194ef[_0xa0de('0x4c')]})[_0xa0de('0x1f')](function(_0x1c2607){_0x592da8[_0xa0de('0x1c')]=_0x1c2607;if(_0x31a66a[_0xa0de('0x43')]['includeAll']){_0x1194ef[_0xa0de('0x59')]=[{'all':!![]}];}return db[_0xa0de('0x64')][_0xa0de('0x52')](_0x1194ef);})['then'](function(_0x593187){_0x592da8[_0xa0de('0x53')]=_0x593187;return _0x592da8;});}})['then'](respondWithFilteredResult(_0x5a9197,_0x1194ef))['catch'](handleError(_0x5a9197,null));};exports[_0xa0de('0x69')]=function(_0xe85da9,_0x1664b9){return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0xe85da9[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x1664b9,null))['then'](function(_0x5d754a){if(_0x5d754a){return _0x5d754a['removeDispositions'](_0xe85da9[_0xa0de('0x43')][_0xa0de('0x6a')]);}})['then'](respondWithStatusCode(_0x1664b9,null))['catch'](handleError(_0x1664b9,null));};exports[_0xa0de('0x6b')]=function(_0x4b007b,_0x10786c){if(_0x4b007b['body']['id']){delete _0x4b007b[_0xa0de('0x5c')]['id'];}return db[_0xa0de('0x3e')]['find']({'where':{'id':_0x4b007b[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x10786c,null))[_0xa0de('0x1f')](function(_0x1e8334){if(_0x1e8334){_0x4b007b[_0xa0de('0x5c')]['MailAccountId']=_0x1e8334['id'];return db[_0xa0de('0x6c')][_0xa0de('0x65')](_0x4b007b['body']);}})[_0xa0de('0x1f')](respondWithResult(_0x10786c,null))[_0xa0de('0x5b')](handleError(_0x10786c,null));};exports['getAnswers']=function(_0x1c6a22,_0x2195ce){var _0x48620d={'raw':![],'where':{}};var _0x3deda4={};var _0xb7bc6b={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1c6a22[_0xa0de('0x55')]['id']}})['then'](handleEntityNotFound(_0x2195ce,null))[_0xa0de('0x1f')](function(_0x3c4ea9){if(_0x3c4ea9){_0x3deda4[_0xa0de('0x47')]=_[_0xa0de('0x57')](db['CannedAnswer'][_0xa0de('0x58')]);_0x3deda4[_0xa0de('0x43')]=_[_0xa0de('0x57')](_0x1c6a22[_0xa0de('0x43')]);_0x3deda4[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x3deda4[_0xa0de('0x47')],_0x3deda4[_0xa0de('0x43')]);_0x48620d['attributes']=_[_0xa0de('0x45')](_0x3deda4[_0xa0de('0x47')],qs[_0xa0de('0x48')](_0x1c6a22[_0xa0de('0x43')][_0xa0de('0x48')]));_0x48620d[_0xa0de('0x46')]=_0x48620d['attributes'][_0xa0de('0x49')]?_0x48620d[_0xa0de('0x46')]:_0x3deda4[_0xa0de('0x47')];if(!_0x1c6a22[_0xa0de('0x43')][_0xa0de('0x68')](_0xa0de('0x6d'))){_0x48620d[_0xa0de('0x1b')]=qs[_0xa0de('0x1b')](_0x1c6a22[_0xa0de('0x43')]['limit']);_0x48620d[_0xa0de('0x19')]=qs['offset'](_0x1c6a22['query'][_0xa0de('0x19')]);}_0x48620d[_0xa0de('0x4a')]=qs[_0xa0de('0x4b')](_0x1c6a22['query'][_0xa0de('0x4b')]);_0x48620d['where']=qs[_0xa0de('0x44')](_[_0xa0de('0x4d')](_0x1c6a22['query'],_0x3deda4[_0xa0de('0x44')]));_0x48620d[_0xa0de('0x4c')][_0xa0de('0x63')]=_0x3c4ea9['id'];if(_0x1c6a22[_0xa0de('0x43')][_0xa0de('0x4e')]){_0x48620d[_0xa0de('0x4c')]=_[_0xa0de('0x4f')](_0x48620d['where'],{'$or':_[_0xa0de('0x42')](_0x48620d[_0xa0de('0x46')],function(_0x48c9ef){var _0x227ba7={};_0x227ba7[_0x48c9ef]={'$like':'%'+_0x1c6a22[_0xa0de('0x43')][_0xa0de('0x4e')]+'%'};return _0x227ba7;})});}_0x48620d=_[_0xa0de('0x4f')]({},_0x48620d,_0x1c6a22[_0xa0de('0x50')]);return db['CannedAnswer']['count']({'where':_0x48620d[_0xa0de('0x4c')]})[_0xa0de('0x1f')](function(_0x5922aa){_0xb7bc6b[_0xa0de('0x1c')]=_0x5922aa;if(_0x1c6a22[_0xa0de('0x43')][_0xa0de('0x51')]){_0x48620d[_0xa0de('0x59')]=[{'all':!![]}];}return db[_0xa0de('0x6c')][_0xa0de('0x52')](_0x48620d);})[_0xa0de('0x1f')](function(_0x58d8b1){_0xb7bc6b[_0xa0de('0x53')]=_0x58d8b1;return _0xb7bc6b;});}})['then'](respondWithFilteredResult(_0x2195ce,_0x48620d))['catch'](handleError(_0x2195ce,null));};exports['removeAnswers']=function(_0x1b1900,_0xaf40fd){return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x1b1900[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0xaf40fd,null))[_0xa0de('0x1f')](function(_0x563159){if(_0x563159){return _0x563159[_0xa0de('0x6e')](_0x1b1900[_0xa0de('0x43')]['ids']);}})[_0xa0de('0x1f')](respondWithStatusCode(_0xaf40fd,null))[_0xa0de('0x5b')](handleError(_0xaf40fd,null));};exports[_0xa0de('0x65')]=function(_0x60a866,_0x1a3a14){var _0x9c7746={'name':_0x60a866[_0xa0de('0x5c')][_0xa0de('0x24')],'key':_0x60a866['body'][_0xa0de('0x41')],'provider':_0x60a866[_0xa0de('0x5c')][_0xa0de('0x5d')]===_0xa0de('0x5e')?null:_0x60a866['body'][_0xa0de('0x5d')],'email':_0x60a866['body'][_0xa0de('0x6f')],'ListId':_0x60a866['body'][_0xa0de('0x70')],'active':!_['isNil'](_0x60a866[_0xa0de('0x5c')]['active'])?_0x60a866[_0xa0de('0x5c')][_0xa0de('0x71')]:!![],'description':_0x60a866[_0xa0de('0x5c')]['description']||null};var _0x538ebf=getAuthenticationOptions(_0x9c7746[_0xa0de('0x5d')],_0x60a866[_0xa0de('0x5c')]);_0x9c7746[_0xa0de('0x39')]=_0x538ebf[_0xa0de('0x39')];_0x9c7746[_0xa0de('0x3a')]=_0x538ebf[_0xa0de('0x3a')];return db['MailAccount'][_0xa0de('0x65')](_0x9c7746,{'include':[{'model':db[_0xa0de('0x3b')],'as':_0xa0de('0x3a')},{'model':db[_0xa0de('0x56')],'as':_0xa0de('0x39')}]})[_0xa0de('0x1f')](function(_0x5dc8f5){var _0x3b14c6=_0x60a866[_0xa0de('0x2f')]['get']({'plain':!![]});if(!_0x3b14c6)throw new Error(_0xa0de('0x72'));if(_0x3b14c6['role']===_0xa0de('0x2f')){var _0x4707d1=_0x5dc8f5[_0xa0de('0x21')]({'plain':!![]});return db['UserProfileSection'][_0xa0de('0x5a')]({'where':{'name':_0xa0de('0x73'),'userProfileId':_0x3b14c6[_0xa0de('0x74')]},'raw':!![]})[_0xa0de('0x1f')](function(_0x50bfbb){if(_0x50bfbb&&_0x50bfbb[_0xa0de('0x75')]===0x0){return db[_0xa0de('0x22')][_0xa0de('0x65')]({'name':_0x4707d1[_0xa0de('0x24')],'resourceId':_0x4707d1['id'],'type':_0x50bfbb['name'],'sectionId':_0x50bfbb['id']},{})[_0xa0de('0x1f')](function(){return _0x5dc8f5;});}else{return _0x5dc8f5;}})[_0xa0de('0x5b')](function(_0x388ebc){logger['error'](_0xa0de('0x76'),_0x388ebc);throw _0x388ebc;});}return _0x5dc8f5;})[_0xa0de('0x1f')](respondWithResult(_0x1a3a14,0xc9))[_0xa0de('0x5b')](handleError(_0x1a3a14,null));};exports[_0xa0de('0x77')]=function(_0x422ae8,_0x3d8213){return db[_0xa0de('0x3e')][_0xa0de('0x67')]({'where':{'id':_0x422ae8[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x3d8213,null))[_0xa0de('0x1f')](function(_0x507d9d){if(_0x507d9d){return _0x507d9d[_0xa0de('0x77')]();}return null;})[_0xa0de('0x1f')](respondWithResult(_0x3d8213,null))[_0xa0de('0x5b')](handleError(_0x3d8213,null));};exports['addImap']=function(_0x111a5b,_0x5494e4){if(_0x111a5b[_0xa0de('0x5c')]['id']){delete _0x111a5b[_0xa0de('0x5c')]['id'];}return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x111a5b[_0xa0de('0x55')]['id']}})['then'](handleEntityNotFound(_0x5494e4,null))[_0xa0de('0x1f')](function(_0x234d01){if(_0x234d01){_0x111a5b[_0xa0de('0x5c')]['MailAccountId']=_0x234d01['id'];return db[_0xa0de('0x56')][_0xa0de('0x65')](_0x111a5b[_0xa0de('0x5c')]);}})['then'](respondWithResult(_0x5494e4,null))[_0xa0de('0x5b')](handleError(_0x5494e4,null));};exports['removeImap']=function(_0x54eeb2,_0x44099a){return db[_0xa0de('0x3e')]['findOne']({'where':{'id':_0x54eeb2[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x44099a,null))[_0xa0de('0x1f')](function(_0x57d0e6){if(_0x57d0e6){return _0x57d0e6[_0xa0de('0x78')](null);}return null;})['then'](respondWithStatusCode(_0x44099a,null))[_0xa0de('0x5b')](handleError(_0x44099a,null));};exports[_0xa0de('0x79')]=function(_0x2a707d,_0x47662e){return db[_0xa0de('0x3e')]['findOne']({'where':{'id':_0x2a707d[_0xa0de('0x55')]['id']}})['then'](handleEntityNotFound(_0x47662e,null))[_0xa0de('0x1f')](function(_0x23d3d2){if(_0x23d3d2){return _0x23d3d2[_0xa0de('0x79')]();}return null;})[_0xa0de('0x1f')](respondWithResult(_0x47662e,null))['catch'](handleError(_0x47662e,null));};exports[_0xa0de('0x7a')]=function(_0x115a4a,_0x3e2267){if(_0x115a4a[_0xa0de('0x5c')]['id']){delete _0x115a4a[_0xa0de('0x5c')]['id'];}return db[_0xa0de('0x3e')]['find']({'where':{'id':_0x115a4a['params']['id']}})['then'](handleEntityNotFound(_0x3e2267,null))['then'](function(_0x290879){if(_0x290879){_0x115a4a[_0xa0de('0x5c')]['MailAccountId']=_0x290879['id'];return db[_0xa0de('0x3b')][_0xa0de('0x65')](_0x115a4a[_0xa0de('0x5c')]);}})['then'](respondWithResult(_0x3e2267,null))[_0xa0de('0x5b')](handleError(_0x3e2267,null));};exports['removeSmtp']=function(_0x94013,_0x17cbde){return db['MailAccount']['findOne']({'where':{'id':_0x94013[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x17cbde,null))['then'](function(_0xd4c399){if(_0xd4c399){return _0xd4c399[_0xa0de('0x7b')](null);}return null;})['then'](respondWithStatusCode(_0x17cbde,null))[_0xa0de('0x5b')](handleError(_0x17cbde,null));};exports['addInteraction']=function(_0x206a1a,_0x132f6e){return db['MailInteraction']['find']({'where':{'id':_0x206a1a[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x132f6e,null))[_0xa0de('0x1f')](function(_0x57ccd7){if(_0x57ccd7){return _0x57ccd7['addInteraction'](_0x206a1a[_0xa0de('0x5c')]['ids'],_['omit'](_0x206a1a[_0xa0de('0x5c')],[_0xa0de('0x6a'),'id'])||{});}})[_0xa0de('0x1f')](respondWithResult(_0x132f6e,null))[_0xa0de('0x5b')](handleError(_0x132f6e,null));};exports['getInteractions']=function(_0x5397aa,_0xdc26f4){var _0x26a963={'raw':![],'where':{}};var _0xef57d0={};var _0x31da28={'count':0x0,'rows':[]};return db[_0xa0de('0x3e')]['findOne']({'where':{'id':_0x5397aa[_0xa0de('0x55')]['id']}})['then'](handleEntityNotFound(_0xdc26f4,null))['then'](function(_0x24c7e5){if(_0x24c7e5){_0xef57d0['model']=_[_0xa0de('0x57')](db[_0xa0de('0x7c')]['rawAttributes']);_0xef57d0[_0xa0de('0x43')]=_[_0xa0de('0x57')](_0x5397aa[_0xa0de('0x43')]);_0xef57d0[_0xa0de('0x44')]=_['intersection'](_0xef57d0[_0xa0de('0x47')],_0xef57d0[_0xa0de('0x43')]);_0x26a963['attributes']=_['intersection'](_0xef57d0[_0xa0de('0x47')],qs[_0xa0de('0x48')](_0x5397aa[_0xa0de('0x43')][_0xa0de('0x48')]));_0x26a963[_0xa0de('0x46')]=_0x26a963[_0xa0de('0x46')][_0xa0de('0x49')]?_0x26a963[_0xa0de('0x46')]:_0xef57d0[_0xa0de('0x47')];if(!_0x5397aa[_0xa0de('0x43')]['hasOwnProperty'](_0xa0de('0x6d'))){_0x26a963[_0xa0de('0x1b')]=qs[_0xa0de('0x1b')](_0x5397aa[_0xa0de('0x43')]['limit']);_0x26a963[_0xa0de('0x19')]=qs[_0xa0de('0x19')](_0x5397aa[_0xa0de('0x43')][_0xa0de('0x19')]);}_0x26a963[_0xa0de('0x4a')]=qs['sort'](_0x5397aa[_0xa0de('0x43')]['sort']);_0x26a963['where']=qs[_0xa0de('0x44')](_['pick'](_0x5397aa[_0xa0de('0x43')],_0xef57d0[_0xa0de('0x44')]));_0x26a963[_0xa0de('0x4c')]['MailAccountId']=_0x24c7e5['id'];if(_0x5397aa['query'][_0xa0de('0x4e')]){_0x26a963[_0xa0de('0x4c')]=_[_0xa0de('0x4f')](_0x26a963[_0xa0de('0x4c')],{'$or':_['map'](_0x26a963[_0xa0de('0x46')],function(_0x4069cc){var _0x4fad84={};_0x4fad84[_0x4069cc]={'$like':'%'+_0x5397aa[_0xa0de('0x43')][_0xa0de('0x4e')]+'%'};return _0x4fad84;})});}_0x26a963=_[_0xa0de('0x4f')]({},_0x26a963,_0x5397aa[_0xa0de('0x50')]);return db[_0xa0de('0x7c')]['count']({'where':_0x26a963[_0xa0de('0x4c')]})[_0xa0de('0x1f')](function(_0x1e1025){_0x31da28['count']=_0x1e1025;if(_0x5397aa[_0xa0de('0x43')][_0xa0de('0x51')]){_0x26a963[_0xa0de('0x59')]=[{'model':db[_0xa0de('0x7d')],'as':_0xa0de('0x7e'),'required':![]},{'model':db['User'],'as':_0xa0de('0x7f'),'attributes':['name','fullname',_0xa0de('0x80')],'required':![]},{'model':db[_0xa0de('0x81')],'as':'Tags','attributes':['id','name',_0xa0de('0x82')],'where':_0x5397aa[_0xa0de('0x43')][_0xa0de('0x83')]?{'id':_0x5397aa[_0xa0de('0x43')][_0xa0de('0x83')]}:undefined,'required':_0x5397aa[_0xa0de('0x43')]['tag']?!![]:![]}];}return db[_0xa0de('0x7c')]['findAll'](_0x26a963);})[_0xa0de('0x1f')](function(_0x2f43dd){_0x31da28[_0xa0de('0x53')]=_0x2f43dd;return _0x31da28;});}})[_0xa0de('0x1f')](respondWithFilteredResult(_0xdc26f4,_0x26a963))[_0xa0de('0x5b')](handleError(_0xdc26f4,null));};exports[_0xa0de('0x84')]=function addApplications(_0x2cfbec,_0x191cbc){var _0x19147d=_0x2cfbec['params']['id'];var _0x282316=_0x2cfbec[_0xa0de('0x5c')];var _0x540855=0xc8;var _0x2a3ca7=null;return db[_0xa0de('0x85')][_0xa0de('0x86')]({'isolationLevel':db['sequelize'][_0xa0de('0x87')][_0xa0de('0x88')][_0xa0de('0x89')]},function(_0x473c8f){return db[_0xa0de('0x3e')][_0xa0de('0x67')]({'where':{'id':_0x19147d},'transaction':_0x473c8f})[_0xa0de('0x1f')](function(_0x42952c){if(_0x42952c){return db[_0xa0de('0x8a')][_0xa0de('0x20')]({'where':{'MailAccountId':_0x19147d},'transaction':_0x473c8f})[_0xa0de('0x1f')](function(){var _0x36bddd=_[_0xa0de('0x42')](_0x282316,function(_0x503ce3){_0x503ce3[_0xa0de('0x63')]=_0x19147d;return _0x503ce3;});return db['MailApplication'][_0xa0de('0x8b')](_0x36bddd,{'transaction':_0x473c8f});});}else{_0x540855=0x194;_0x2a3ca7=[];}});})[_0xa0de('0x1f')](function(){if(_0x540855!==0x194){return db[_0xa0de('0x8a')][_0xa0de('0x8c')]({'where':{'MailAccountId':_0x19147d},'order':_0xa0de('0x8d')})[_0xa0de('0x1f')](function(_0x105eee){_0x2a3ca7=_0x105eee;});}})[_0xa0de('0x5b')](function(_0x19c70b){_0x540855=0x1f4;logger[_0xa0de('0x13')](_0x19c70b[_0xa0de('0x23')]);if(_0x19c70b[_0xa0de('0x24')]){delete _0x19c70b[_0xa0de('0x24')];}_0x2a3ca7=_0x19c70b;})[_0xa0de('0x8e')](function(){if(_0x2a3ca7===null){_0x191cbc[_0xa0de('0x15')](_0x540855);}else{if(_0x540855===0x1f4){_0x191cbc[_0xa0de('0x16')](_0x540855)[_0xa0de('0x8f')](_0x2a3ca7);}else{_0x191cbc[_0xa0de('0x16')](_0x540855)[_0xa0de('0x18')](_0x2a3ca7);}}});};exports['getApplications']=function(_0x4317af,_0x1537bd){var _0x24437b={};var _0x1e4759={};var _0x2fcd7f;var _0x19f25f;return db[_0xa0de('0x3e')]['findOne']({'where':{'id':_0x4317af[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x1537bd,null))[_0xa0de('0x1f')](function(_0x436f13){if(_0x436f13){_0x2fcd7f=_0x436f13;_0x1e4759[_0xa0de('0x47')]=_[_0xa0de('0x57')](db[_0xa0de('0x8a')]['rawAttributes']);_0x1e4759[_0xa0de('0x43')]=_[_0xa0de('0x57')](_0x4317af[_0xa0de('0x43')]);_0x1e4759[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x1e4759[_0xa0de('0x47')],_0x1e4759[_0xa0de('0x43')]);_0x24437b[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x1e4759[_0xa0de('0x47')],qs['fields'](_0x4317af['query'][_0xa0de('0x48')]));_0x24437b[_0xa0de('0x46')]=_0x24437b['attributes']['length']?_0x24437b['attributes']:_0x1e4759[_0xa0de('0x47')];_0x24437b[_0xa0de('0x4a')]=qs[_0xa0de('0x4b')](_0x4317af[_0xa0de('0x43')][_0xa0de('0x4b')]);_0x24437b['where']=qs['filters'](_[_0xa0de('0x4d')](_0x4317af[_0xa0de('0x43')],_0x1e4759[_0xa0de('0x44')]));if(_0x4317af[_0xa0de('0x43')][_0xa0de('0x4e')]){_0x24437b[_0xa0de('0x4c')]=_['merge'](_0x24437b[_0xa0de('0x4c')],{'$or':_[_0xa0de('0x42')](_0x24437b[_0xa0de('0x46')],function(_0x5830f6){var _0x2a243e={};_0x2a243e[_0x5830f6]={'$like':'%'+_0x4317af['query'][_0xa0de('0x4e')]+'%'};return _0x2a243e;})});}_0x24437b=_[_0xa0de('0x4f')]({},_0x24437b,_0x4317af['options']);return _0x2fcd7f[_0xa0de('0x90')](_0x24437b);}})[_0xa0de('0x1f')](function(_0x4dbc4c){if(_0x4dbc4c){_0x19f25f=_0x4dbc4c[_0xa0de('0x49')];if(!_0x4317af[_0xa0de('0x43')]['hasOwnProperty'](_0xa0de('0x6d'))){_0x24437b['limit']=qs[_0xa0de('0x1b')](_0x4317af[_0xa0de('0x43')][_0xa0de('0x1b')]);_0x24437b[_0xa0de('0x19')]=qs[_0xa0de('0x19')](_0x4317af[_0xa0de('0x43')][_0xa0de('0x19')]);}return _0x2fcd7f[_0xa0de('0x90')](_0x24437b);}})[_0xa0de('0x1f')](function(_0x33f918){if(_0x33f918){return _0x33f918?{'count':_0x19f25f,'rows':_0x33f918}:null;}})[_0xa0de('0x1f')](respondWithResult(_0x1537bd,null))[_0xa0de('0x5b')](handleError(_0x1537bd,null));};exports[_0xa0de('0x91')]=function(_0x23821d,_0x4c3e11){var _0x3a90dd={'raw':!![],'where':{}};var _0x2e6858={};var _0x2a59ef={'count':0x0,'rows':[]};return db[_0xa0de('0x3e')]['findOne']({'where':{'id':_0x23821d[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x4c3e11,null))['then'](function(_0xf5f591){if(_0xf5f591){_0x2e6858[_0xa0de('0x47')]=_[_0xa0de('0x57')](db[_0xa0de('0x92')]['rawAttributes']);_0x2e6858[_0xa0de('0x43')]=_[_0xa0de('0x57')](_0x23821d[_0xa0de('0x43')]);_0x2e6858[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x2e6858[_0xa0de('0x47')],_0x2e6858['query']);_0x3a90dd[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x2e6858['model'],qs[_0xa0de('0x48')](_0x23821d[_0xa0de('0x43')][_0xa0de('0x48')]));_0x3a90dd[_0xa0de('0x46')]=_0x3a90dd['attributes'][_0xa0de('0x49')]?_0x3a90dd['attributes']:_0x2e6858[_0xa0de('0x47')];if(!_0x23821d[_0xa0de('0x43')][_0xa0de('0x68')](_0xa0de('0x6d'))){_0x3a90dd[_0xa0de('0x1b')]=qs[_0xa0de('0x1b')](_0x23821d[_0xa0de('0x43')][_0xa0de('0x1b')]);_0x3a90dd[_0xa0de('0x19')]=qs[_0xa0de('0x19')](_0x23821d['query'][_0xa0de('0x19')]);}_0x3a90dd[_0xa0de('0x4a')]=qs['sort'](_0x23821d[_0xa0de('0x43')][_0xa0de('0x4b')]);_0x3a90dd['where']=qs['filters'](_[_0xa0de('0x4d')](_0x23821d[_0xa0de('0x43')],_0x2e6858[_0xa0de('0x44')]));_0x3a90dd[_0xa0de('0x4c')]['MailAccountId']=_0xf5f591['id'];if(_0x23821d['query'][_0xa0de('0x4e')]){_0x3a90dd['where']=_[_0xa0de('0x4f')](_0x3a90dd['where'],{'$or':_['map'](_0x3a90dd[_0xa0de('0x46')],function(_0x42bdec){var _0x38d9ca={};_0x38d9ca[_0x42bdec]={'$like':'%'+_0x23821d[_0xa0de('0x43')][_0xa0de('0x4e')]+'%'};return _0x38d9ca;})});}if(_0x23821d['query'][_0xa0de('0x93')]){var _0x5a24a2=_0x23821d[_0xa0de('0x43')][_0xa0de('0x93')][_0xa0de('0x94')](',');var _0x337969={};_0x337969[_0x5a24a2[0x0]]={'$gte':moment(_0x5a24a2[0x1])[_0xa0de('0x95')](_0xa0de('0x96'))};_0x3a90dd[_0xa0de('0x4c')]=_[_0xa0de('0x4f')](_0x3a90dd[_0xa0de('0x4c')],_0x337969);}_0x3a90dd=_[_0xa0de('0x4f')]({},_0x3a90dd,_0x23821d['options']);return db[_0xa0de('0x92')][_0xa0de('0x1c')]({'where':_0x3a90dd[_0xa0de('0x4c')]})[_0xa0de('0x1f')](function(_0x1e77b3){_0x2a59ef[_0xa0de('0x1c')]=_0x1e77b3;if(_0x23821d[_0xa0de('0x43')][_0xa0de('0x51')]){_0x3a90dd[_0xa0de('0x59')]=[{'all':!![]}];}return db[_0xa0de('0x92')]['findAll'](_0x3a90dd);})[_0xa0de('0x1f')](function(_0x5c80b1){if(_0x23821d[_0xa0de('0x43')][_0xa0de('0x97')]===_0xa0de('0x98')){for(var _0xd36fc5=0x0;_0xd36fc5<_0x5c80b1[_0xa0de('0x49')];_0xd36fc5++){_0x5c80b1[_0xd36fc5][_0xa0de('0x5c')]=juice(_0x5c80b1[_0xd36fc5][_0xa0de('0x5c')]);}}_0x2a59ef[_0xa0de('0x53')]=_0x5c80b1;return _0x2a59ef;});}})[_0xa0de('0x1f')](respondWithFilteredResult(_0x4c3e11,_0x3a90dd))[_0xa0de('0x5b')](handleError(_0x4c3e11,null));};exports[_0xa0de('0x8f')]=function(_0x2254d8,_0x4c88a6){var _0x180d73,_0x22b414={},_0x1d2e9b;if(_0x2254d8[_0xa0de('0x5c')]['to']){_0x1d2e9b=_0x2254d8[_0xa0de('0x5c')]['to'][_0xa0de('0x94')](',')[0x0];}return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x2254d8['params']['id']},'include':[{'model':db[_0xa0de('0x99')],'as':'List','include':[{'model':db[_0xa0de('0x7d')],'as':_0xa0de('0x9a'),'where':{'email':_0x1d2e9b},'limit':0x1,'order':[[_0xa0de('0x9b'),'DESC']]}]},{'model':db[_0xa0de('0x3b')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xa0de('0x9c')],'as':_0xa0de('0x9c'),'raw':!![]}]}]})[_0xa0de('0x1f')](handleEntityNotFound(_0x4c88a6,null))[_0xa0de('0x1f')](function(_0x5992ef){if(!_0x5992ef)return;_0x180d73=_0x5992ef;if(!_0x5992ef[_0xa0de('0x3a')])throw new Error(_0xa0de('0x9d'));if(_[_0xa0de('0x9e')](_0x2254d8[_0xa0de('0x5c')][_0xa0de('0x9f')])){_0x2254d8[_0xa0de('0x5c')][_0xa0de('0x9f')]=util[_0xa0de('0x95')](_0xa0de('0xa0'),_0x5992ef[_0xa0de('0x24')],_0x5992ef[_0xa0de('0x6f')]||_0x5992ef['Smtp'][_0xa0de('0x2f')]);}if(_0x2254d8[_0xa0de('0x5c')]['attachments']&&_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xa1')][_0xa0de('0x49')]){for(var _0xea9eb9=0x0;_0xea9eb9<_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xa1')][_0xa0de('0x49')];_0xea9eb9+=0x1){_0x2254d8['body'][_0xa0de('0xa1')][_0xea9eb9]={'filename':_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xa1')][_0xea9eb9]['name'],'path':path[_0xa0de('0xa2')](config[_0xa0de('0xa3')],_0xa0de('0xa4'),_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xa1')][_0xea9eb9][_0xa0de('0xa5')])};}}var _0x4fd2d8=_0x5992ef['getSmtpOptions']();return respondWithRpcPromise(_0xa0de('0xa6'),_0xa0de('0xa7'),{'account':_0x4fd2d8,'message':_0x2254d8[_0xa0de('0x5c')]});})['then'](function(_0x468651){if(!_0x468651)return;_0x22b414=_0x468651;if(!_0x180d73[_0xa0de('0xa8')])throw new Error('List\x20not\x20found');if(_0x180d73[_0xa0de('0xa8')][_0xa0de('0x9a')][_0xa0de('0x49')])return _0x180d73[_0xa0de('0xa8')]['Contacts'][0x0];return db[_0xa0de('0x7d')][_0xa0de('0x65')](_[_0xa0de('0xa9')](_0x2254d8['body'],{'firstName':_0x2254d8[_0xa0de('0x5c')]['to'],'email':_0x2254d8[_0xa0de('0x5c')]['to'],'phone':_0x2254d8['body']['to'],'ListId':_0x180d73[_0xa0de('0x70')]}));})['then'](function(_0x460bd1){if(!_0x460bd1)return;var _0x2c8083={'UserId':_0x2254d8['user']['id'],'ContactId':_0x460bd1['id'],'MailAccountId':_0x180d73['id'],'inReplyTo':_0x22b414['messageId'],'to':_0x2254d8[_0xa0de('0x5c')][_0xa0de('0x9f')],'cc':_0x2254d8[_0xa0de('0x5c')]['cc'],'subject':_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xaa')],'attach':_0x2254d8[_0xa0de('0x5c')]['attach'],'firstMsgDirection':_0xa0de('0xab'),'lastMsgAt':moment()['format'](_0xa0de('0x96')),'lastMsgDirection':_0xa0de('0xab'),'Messages':[_[_0xa0de('0x4f')](_0x2254d8['body'],{'messageId':_0x22b414[_0xa0de('0xac')],'sentAt':moment()['format'](_0xa0de('0x96')),'read':!![],'MailAccountId':_0x180d73['id'],'UserId':_0x2254d8['user']['id'],'ContactId':_0x460bd1['id']})]};if(_0x2254d8[_0xa0de('0x5c')]['Interaction']){_0x2c8083=_[_0xa0de('0x4f')](_0x2c8083,_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xad')]);}return db[_0xa0de('0x7c')][_0xa0de('0x65')](_0x2c8083,{'include':[{'model':db[_0xa0de('0x92')],'as':'Messages'}]});})[_0xa0de('0x1f')](respondWithResult(_0x4c88a6,null))[_0xa0de('0x5b')](handleError(_0x4c88a6,null));};exports[_0xa0de('0xae')]=function(_0x24f424,_0x5176fc){return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x24f424[_0xa0de('0x55')]['id']},'include':[{'model':db[_0xa0de('0x3b')],'as':_0xa0de('0x3a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa0de('0x9c'),'raw':!![]}]}]})[_0xa0de('0x1f')](handleEntityNotFound(_0x5176fc,null))[_0xa0de('0x1f')](function(_0x3bd308){if(!_0x3bd308['Smtp'])return;var _0x15d218=_0x3bd308[_0xa0de('0xaf')]();return respondWithRpcPromise(_0xa0de('0xb0'),_0xa0de('0xae'),{'account':_0x15d218});})[_0xa0de('0x1f')](respondWithResult(_0x5176fc,null))[_0xa0de('0x5b')](handleError(_0x5176fc,null));};exports[_0xa0de('0x20')]=function(_0xf95408,_0x5e9db1){return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0xf95408[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x5e9db1,null))[_0xa0de('0x1f')](function(_0x1e995b){if(_0x1e995b&&_0x1e995b['service']){throw new db[(_0xa0de('0xb1'))][(_0xa0de('0xb2'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x1e995b;})[_0xa0de('0x1f')](removeEntity(_0x5e9db1,null))[_0xa0de('0x5b')](handleError(_0x5e9db1,null));};exports[_0xa0de('0xb3')]=function(_0x365664,_0x1fcead){return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x365664[_0xa0de('0x55')]['id']}})['then'](handleEntityNotFound(_0x1fcead,null))['then'](function(_0x15b95c){if(_0x15b95c){return _0x15b95c[_0xa0de('0xb3')](_0x365664['body'][_0xa0de('0x6a')],_['omit'](_0x365664[_0xa0de('0x5c')],[_0xa0de('0x6a'),'id'])||{})[_0xa0de('0xb4')](function(_0x57f161){for(var _0x40ddc8=0x0;_0x40ddc8<_0x365664[_0xa0de('0x5c')][_0xa0de('0x6a')]['length'];_0x40ddc8+=0x1){socket[_0xa0de('0xb5')](_0xa0de('0xb6'),{'UserId':Number(_0x365664[_0xa0de('0x5c')][_0xa0de('0x6a')][_0x40ddc8]),'MailAccountId':Number(_0x365664['params']['id'])});}return _0x57f161;});}})[_0xa0de('0x1f')](respondWithResult(_0x1fcead,null))['catch'](handleError(_0x1fcead,null));};exports[_0xa0de('0xb7')]=function(_0x407a35,_0x21bde3){return db[_0xa0de('0x3e')]['find']({'where':{'id':_0x407a35[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x21bde3,null))[_0xa0de('0x1f')](function(_0x368b9a){if(_0x368b9a){return _0x368b9a[_0xa0de('0xb7')](_0x407a35[_0xa0de('0x43')]['ids'])[_0xa0de('0x1f')](function(){if(_[_0xa0de('0xb8')](_0x407a35[_0xa0de('0x43')]['ids'])){for(var _0x106998=0x0;_0x106998<_0x407a35[_0xa0de('0x43')][_0xa0de('0x6a')][_0xa0de('0x49')];_0x106998+=0x1){socket[_0xa0de('0xb5')](_0xa0de('0xb9'),{'UserId':Number(_0x407a35[_0xa0de('0x43')][_0xa0de('0x6a')][_0x106998]),'MailAccountId':Number(_0x407a35[_0xa0de('0x55')]['id'])});}}else{socket[_0xa0de('0xb5')]('userMailAccount:remove',{'UserId':Number(_0x407a35[_0xa0de('0x43')]['ids']),'MailAccountId':Number(_0x407a35[_0xa0de('0x55')]['id'])});}});}})[_0xa0de('0x1f')](respondWithStatusCode(_0x21bde3,null))['catch'](handleError(_0x21bde3,null));};exports[_0xa0de('0xba')]=function(_0x31cb82,_0x1e4834){var _0x3fd7f6={};var _0x470c1b={};var _0x3edef5;var _0x2ee0a2;return db[_0xa0de('0x3e')][_0xa0de('0x67')]({'where':{'id':_0x31cb82[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x1e4834,null))['then'](function(_0x22ae58){if(_0x22ae58){_0x3edef5=_0x22ae58;_0x470c1b[_0xa0de('0x47')]=_[_0xa0de('0x57')](db[_0xa0de('0xbb')]['rawAttributes']);_0x470c1b[_0xa0de('0x43')]=_[_0xa0de('0x57')](_0x31cb82[_0xa0de('0x43')]);_0x470c1b[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x470c1b['model'],_0x470c1b[_0xa0de('0x43')]);_0x3fd7f6[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x470c1b[_0xa0de('0x47')],qs[_0xa0de('0x48')](_0x31cb82[_0xa0de('0x43')][_0xa0de('0x48')]));_0x3fd7f6[_0xa0de('0x46')]=_0x3fd7f6[_0xa0de('0x46')]['length']?_0x3fd7f6[_0xa0de('0x46')]:_0x470c1b['model'];_0x3fd7f6[_0xa0de('0x4a')]=qs[_0xa0de('0x4b')](_0x31cb82[_0xa0de('0x43')][_0xa0de('0x4b')]);_0x3fd7f6[_0xa0de('0x4c')]=qs[_0xa0de('0x44')](_['pick'](_0x31cb82[_0xa0de('0x43')],_0x470c1b[_0xa0de('0x44')]));if(_0x31cb82[_0xa0de('0x43')][_0xa0de('0x4e')]){_0x3fd7f6[_0xa0de('0x4c')]=_[_0xa0de('0x4f')](_0x3fd7f6[_0xa0de('0x4c')],{'$or':_['map'](_0x3fd7f6[_0xa0de('0x46')],function(_0x26e4ea){var _0x20d581={};_0x20d581[_0x26e4ea]={'$like':'%'+_0x31cb82[_0xa0de('0x43')]['filter']+'%'};return _0x20d581;})});}_0x3fd7f6=_['merge']({},_0x3fd7f6,_0x31cb82[_0xa0de('0x50')]);return _0x3edef5['getAgents'](_0x3fd7f6);}})[_0xa0de('0x1f')](function(_0x1cba1c){if(_0x1cba1c){_0x2ee0a2=_0x1cba1c['length'];if(!_0x31cb82[_0xa0de('0x43')][_0xa0de('0x68')](_0xa0de('0x6d'))){_0x3fd7f6[_0xa0de('0x1b')]=qs['limit'](_0x31cb82[_0xa0de('0x43')][_0xa0de('0x1b')]);_0x3fd7f6[_0xa0de('0x19')]=qs[_0xa0de('0x19')](_0x31cb82[_0xa0de('0x43')][_0xa0de('0x19')]);}return _0x3edef5[_0xa0de('0xba')](_0x3fd7f6);}})[_0xa0de('0x1f')](function(_0x1dc7b6){if(_0x1dc7b6){return _0x1dc7b6?{'count':_0x2ee0a2,'rows':_0x1dc7b6}:null;}})['then'](respondWithResult(_0x1e4834,null))[_0xa0de('0x5b')](handleError(_0x1e4834,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index d6abda1..2ea297f 100644 --- a/server/api/mailAccount/mailAccount.events.js +++ b/server/api/mailAccount/mailAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96ae=['emit','hasOwnProperty','events','../../mysqldb','MailAccount','setMaxListeners','update','remove'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x96ae,0xda));var _0xe96a=function(_0x297fe8,_0x2c9c7e){_0x297fe8=_0x297fe8-0x0;var _0x337023=_0x96ae[_0x297fe8];return _0x337023;};'use strict';var EventEmitter=require(_0xe96a('0x0'));var MailAccount=require(_0xe96a('0x1'))['db'][_0xe96a('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe96a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe96a('0x4'),'afterDestroy':_0xe96a('0x5')};function emitEvent(_0x4c3ce4){return function(_0x198334,_0x22c7d0,_0x111605){MailAccountEvents[_0xe96a('0x6')](_0x4c3ce4+':'+_0x198334['id'],_0x198334);MailAccountEvents[_0xe96a('0x6')](_0x4c3ce4,_0x198334);_0x111605(null);};}for(var e in events){if(events[_0xe96a('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x3d41=['../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x3d41,0xea));var _0x13d4=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0x3d41[_0x3dc538];return _0x72c2fd;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x13d4('0x0'))['db'][_0x13d4('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x13d4('0x2')](0x0);var events={'afterCreate':_0x13d4('0x3'),'afterUpdate':_0x13d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4bfcac){return function(_0x1162f2,_0x2c05f1,_0x52bd3e){MailAccountEvents[_0x13d4('0x5')](_0x4bfcac+':'+_0x1162f2['id'],_0x1162f2);MailAccountEvents[_0x13d4('0x5')](_0x4bfcac,_0x1162f2);_0x52bd3e(null);};}for(var e in events){if(events[_0x13d4('0x6')](e)){var event=events[e];MailAccount[_0x13d4('0x7')](e,emitEvent(event));}}module[_0x13d4('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f1b249f..490dff0 100644 --- a/server/api/mailAccount/mailAccount.model.js +++ b/server/api/mailAccount/mailAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x223b=['provider','host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','service'];(function(_0x35e0ba,_0x47dca0){var _0x24682e=function(_0x1fb7ea){while(--_0x1fb7ea){_0x35e0ba['push'](_0x35e0ba['shift']());}};_0x24682e(++_0x47dca0);}(_0x223b,0xb7));var _0xb223=function(_0x2717fc,_0x59fff6){_0x2717fc=_0x2717fc-0x0;var _0x2f08c9=_0x223b[_0x2717fc];return _0x2f08c9;};'use strict';var attributes=require(_0xb223('0x0'));module[_0xb223('0x1')]=function(_0x1036f8){return _0x1036f8[_0xb223('0x2')](_0xb223('0x3'),attributes,{'tableName':_0xb223('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x26a921=this;var _0x22c177={'id':_0x26a921['id'],'tls':{'rejectUnauthorized':![]}};if(_0x26a921['provider']!==_0xb223('0x5')){_0x22c177[_0xb223('0x6')]=_0x26a921[_0xb223('0x7')];}else{_0x22c177[_0xb223('0x8')]=_0x26a921[_0xb223('0x9')][_0xb223('0x8')];_0x22c177['port']=_0x26a921[_0xb223('0x9')][_0xb223('0xa')];_0x22c177[_0xb223('0xb')]=_0x26a921['Smtp'][_0xb223('0xb')];}if(_0x26a921[_0xb223('0x9')]['authentication']){if(_0x26a921[_0xb223('0x9')][_0xb223('0xc')]){if(!_0x26a921[_0xb223('0x9')][_0xb223('0xd')])throw new Error(_0xb223('0xe'));_0x22c177[_0xb223('0xf')]={'type':_0xb223('0x10'),'user':_0x26a921['Smtp']['user'],'accessToken':_0x26a921[_0xb223('0x9')][_0xb223('0xd')][_0xb223('0x11')]};}else{_0x22c177['auth']={'user':_0x26a921['Smtp']['user'],'pass':_0x26a921[_0xb223('0x9')][_0xb223('0x12')]};}}return _0x22c177;}}});}; \ No newline at end of file +var _0x0fd6=['authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','user','data5','auth','exports','define','custom','service','provider','host','Smtp','port','secure'];(function(_0x1b246e,_0x290280){var _0x8cfa0a=function(_0x57ccee){while(--_0x57ccee){_0x1b246e['push'](_0x1b246e['shift']());}};_0x8cfa0a(++_0x290280);}(_0x0fd6,0x123));var _0x60fd=function(_0x3f4c4e,_0x19f5aa){_0x3f4c4e=_0x3f4c4e-0x0;var _0x5cc5bd=_0x0fd6[_0x3f4c4e];return _0x5cc5bd;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x60fd('0x0')]=function(_0x244cd9){return _0x244cd9[_0x60fd('0x1')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x8570f9=this;var _0x1b28f3={'id':_0x8570f9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x8570f9['provider']!==_0x60fd('0x2')){_0x1b28f3[_0x60fd('0x3')]=_0x8570f9[_0x60fd('0x4')];}else{_0x1b28f3[_0x60fd('0x5')]=_0x8570f9[_0x60fd('0x6')]['host'];_0x1b28f3[_0x60fd('0x7')]=_0x8570f9[_0x60fd('0x6')][_0x60fd('0x7')];_0x1b28f3['secure']=_0x8570f9[_0x60fd('0x6')][_0x60fd('0x8')];}if(_0x8570f9['Smtp'][_0x60fd('0x9')]){if(_0x8570f9['Smtp']['modernAuthentication']){if(!_0x8570f9[_0x60fd('0x6')][_0x60fd('0xa')])throw new Error(_0x60fd('0xb'));_0x1b28f3['auth']={'type':'OAuth2','user':_0x8570f9[_0x60fd('0x6')][_0x60fd('0xc')],'accessToken':_0x8570f9[_0x60fd('0x6')]['CloudProvider'][_0x60fd('0xd')]};}else{_0x1b28f3[_0x60fd('0xe')]={'user':_0x8570f9['Smtp']['user'],'pass':_0x8570f9[_0x60fd('0x6')]['pass']};}}return _0x1b28f3;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index e3278e7..cc9bae4 100644 --- a/server/api/mailAccount/mailAccount.rpc.js +++ b/server/api/mailAccount/mailAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd943=['MailServerOut','Smtp','CloudProvider','get','account','omit','smtpOptions','applications','list','asc','autoclose','close','Contacts','length','defaults','ListId','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','create','spread','attach','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','MailAccount','findAll','options','where','attributes','limit','include','map','model','stringify','GetMailAccount','ShowMailAccount','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','isNil','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','DESC','MailApplication','Applications'];(function(_0x394224,_0x1a3ef9){var _0x5bfd39=function(_0x8ffaac){while(--_0x8ffaac){_0x394224['push'](_0x394224['shift']());}};_0x5bfd39(++_0x1a3ef9);}(_0xd943,0x15d));var _0x3d94=function(_0x201683,_0x29e2f7){_0x201683=_0x201683-0x0;var _0x931f3c=_0xd943[_0x201683];return _0x931f3c;};'use strict';var _=require(_0x3d94('0x0'));var moment=require(_0x3d94('0x1'));var BPromise=require(_0x3d94('0x2'));var rs=require(_0x3d94('0x3'));var Redis=require('ioredis');var db=require(_0x3d94('0x4'))['db'];var logger=require(_0x3d94('0x5'))(_0x3d94('0x6'));var config=require(_0x3d94('0x7'));var jayson=require(_0x3d94('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x3d94('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3d94('0xa'))(new Redis(config[_0x3d94('0x9')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3984a3,_0x27e381,_0x1cc58c){return new BPromise(function(_0x5908a7,_0x182066){return client['request'](_0x3984a3,_0x1cc58c)[_0x3d94('0xb')](function(_0x301536){logger['info'](_0x3d94('0xc'),_0x27e381,_0x3d94('0xd'));logger[_0x3d94('0xe')](_0x3d94('0xf'),_0x27e381,_0x3d94('0xd'),JSON['stringify'](_0x301536));if(_0x301536[_0x3d94('0x10')]){if(_0x301536[_0x3d94('0x10')][_0x3d94('0x11')]===0x1f4){logger['error'](_0x3d94('0xc'),_0x27e381,_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);return _0x182066(_0x301536['error'][_0x3d94('0x12')]);}logger[_0x3d94('0x10')](_0x3d94('0xc'),_0x27e381,_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);return _0x5908a7(_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);}else{logger[_0x3d94('0x13')]('MailAccount,\x20%s,\x20%s',_0x27e381,_0x3d94('0xd'));_0x5908a7(_0x301536[_0x3d94('0x14')][_0x3d94('0x12')]);}})[_0x3d94('0x15')](function(_0x4afc92){logger[_0x3d94('0x10')](_0x3d94('0xc'),_0x27e381,_0x4afc92);_0x182066(_0x4afc92);});});}exports['GetMailAccount']=function(_0x9bca24){var _0x59b741=this;return new Promise(function(_0x28bead,_0x193934){return db[_0x3d94('0x16')][_0x3d94('0x17')]({'raw':_0x9bca24[_0x3d94('0x18')]?_0x9bca24['options']['raw']===undefined?!![]:![]:!![],'where':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x19')]||null:null,'attributes':_0x9bca24['options']?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1a')]||null:null,'limit':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1b')]||null:null,'include':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1c')],function(_0x192839){return{'model':db[_0x192839[_0x3d94('0x1e')]],'as':_0x192839['as'],'attributes':_0x192839[_0x3d94('0x1a')],'include':_0x192839[_0x3d94('0x1c')]?_['map'](_0x192839[_0x3d94('0x1c')],function(_0x558fd2){return{'model':db[_0x558fd2[_0x3d94('0x1e')]],'as':_0x558fd2['as'],'attributes':_0x558fd2[_0x3d94('0x1a')],'include':_0x558fd2[_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x558fd2[_0x3d94('0x1c')],function(_0x82b568){return{'model':db[_0x82b568[_0x3d94('0x1e')]],'as':_0x82b568['as'],'attributes':_0x82b568['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x362642){logger['info']('GetMailAccount',_0x9bca24);logger[_0x3d94('0xe')]('GetMailAccount',_0x9bca24,JSON[_0x3d94('0x1f')](_0x362642));_0x28bead(_0x362642);})[_0x3d94('0x15')](function(_0x32403a){logger['error'](_0x3d94('0x20'),_0x32403a['message'],_0x9bca24);_0x193934(_0x59b741[_0x3d94('0x10')](0x1f4,_0x32403a['message']));});});};exports[_0x3d94('0x21')]=function(_0x215ad7){var _0x29b1ff=this;return new Promise(function(_0x246f88,_0x50560c){return db[_0x3d94('0x16')]['find']({'raw':_0x215ad7[_0x3d94('0x18')]?_0x215ad7[_0x3d94('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x215ad7['options']?_0x215ad7[_0x3d94('0x18')][_0x3d94('0x19')]||null:null,'attributes':_0x215ad7[_0x3d94('0x18')]?_0x215ad7['options'][_0x3d94('0x1a')]||null:null,'include':_0x215ad7[_0x3d94('0x18')]?_0x215ad7['options'][_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x215ad7[_0x3d94('0x18')][_0x3d94('0x1c')],function(_0x782c1){return{'model':db[_0x782c1['model']],'as':_0x782c1['as'],'attributes':_0x782c1[_0x3d94('0x1a')],'include':_0x782c1[_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x782c1[_0x3d94('0x1c')],function(_0xb493f1){return{'model':db[_0xb493f1[_0x3d94('0x1e')]],'as':_0xb493f1['as'],'attributes':_0xb493f1['attributes'],'include':_0xb493f1['include']?_[_0x3d94('0x1d')](_0xb493f1[_0x3d94('0x1c')],function(_0x1c1b25){return{'model':db[_0x1c1b25[_0x3d94('0x1e')]],'as':_0x1c1b25['as'],'attributes':_0x1c1b25[_0x3d94('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3d94('0xb')](function(_0x2ef743){if(_0x215ad7[_0x3d94('0x18')][_0x3d94('0x22')]===!![])_0x2ef743[_0x3d94('0x23')]('smtpOptions',_0x2ef743[_0x3d94('0x24')]());logger[_0x3d94('0x13')](_0x3d94('0x21'),_0x215ad7);logger[_0x3d94('0xe')]('ShowMailAccount',_0x215ad7,JSON[_0x3d94('0x1f')](_0x2ef743));_0x246f88(_0x2ef743);})[_0x3d94('0x15')](function(_0x35e0e6){logger[_0x3d94('0x10')](_0x3d94('0x21'),_0x35e0e6['message'],_0x215ad7);_0x50560c(_0x29b1ff[_0x3d94('0x10')](0x1f4,_0x35e0e6[_0x3d94('0x12')]));});});};exports[_0x3d94('0x25')]=function(_0x485066){var _0x4eee4d=this;return new Promise(function(_0x4d8a8f,_0x47905e){var _0x3b3550={'body':_0x485066[_0x3d94('0x26')],'channel':_0x3d94('0x27')};var _0x146ccb=_[_0x3d94('0x28')](_[_0x3d94('0x29')](db[_0x3d94('0x2a')]['rawAttributes']),['createdAt',_0x3d94('0x2b'),_0x3d94('0x2c'),'ListId']);var _0x2d0aa2=![];if(_0x485066['body']['id']){delete _0x485066[_0x3d94('0x26')]['id'];}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x26')])||_0x485066['body'][_0x3d94('0x26')]===''){return _0x47905e(_0x4eee4d['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x146ccb));}if(!_[_0x3d94('0x30')](_0x146ccb,_0x485066['body'][_0x3d94('0x2f')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,_0x3d94('0x31')+_0x146ccb));}var _0x15c8e7={};_0x15c8e7[_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')]]=_0x485066[_0x3d94('0x26')]['from'];return db[_0x3d94('0x16')][_0x3d94('0x32')]({'where':{'id':_0x485066['account']['id']},'include':[{'model':db['CmList'],'as':_0x3d94('0x33'),'include':[{'model':db[_0x3d94('0x2a')],'as':'Contacts','where':_0x15c8e7,'limit':0x1,'order':[[_0x3d94('0x2b'),_0x3d94('0x34')]]}]},{'model':db[_0x3d94('0x35')],'as':_0x3d94('0x36')},{'model':db[_0x3d94('0x37')],'as':_0x3d94('0x38'),'include':[{'model':db[_0x3d94('0x39')],'as':_0x3d94('0x39')}]}]})[_0x3d94('0xb')](function(_0x2429bc){if(_0x2429bc&&_0x2429bc[_0x3d94('0x33')]){var _0x29682b=_0x2429bc[_0x3d94('0x3a')]({'plain':!![]});_0x3b3550[_0x3d94('0x3b')]=_[_0x3d94('0x3c')](_0x29682b,['Applications',_0x3d94('0x33')]);_0x3b3550[_0x3d94('0x3b')][_0x3d94('0x3d')]=_0x2429bc[_0x3d94('0x24')]();_0x3b3550[_0x3d94('0x3e')]=_0x29682b[_0x3d94('0x36')];_0x3b3550[_0x3d94('0x3f')]=_0x29682b[_0x3d94('0x33')];_0x3b3550[_0x3d94('0x3e')]=_['orderBy'](_0x3b3550[_0x3d94('0x3e')],['priority'],[_0x3d94('0x40')]);if(_0x3b3550[_0x3d94('0x3b')]&&_0x3b3550['account'][_0x3d94('0x41')]){_0x3b3550['applications']['push']({'id':0x0,'priority':_0x3b3550[_0x3d94('0x3e')]['length']+0x1,'app':_0x3d94('0x42'),'appdata':_0x3d94('0x41'),'interval':'*,*,*,*'});}if(_0x3b3550[_0x3d94('0x3b')]['Applications']){delete _0x3b3550['account'][_0x3d94('0x36')];}if(_0x3b3550[_0x3d94('0x3b')][_0x3d94('0x33')]){delete _0x3b3550[_0x3d94('0x3b')][_0x3d94('0x33')];}if(_0x29682b[_0x3d94('0x33')][_0x3d94('0x43')][_0x3d94('0x44')]){return _0x29682b[_0x3d94('0x33')]['Contacts'][0x0];}var _0x28cfbb=_[_0x3d94('0x45')](_0x485066[_0x3d94('0x26')],{'firstName':_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')],'ListId':_0x29682b[_0x3d94('0x46')]});_0x28cfbb[_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')]]=_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')];return db[_0x3d94('0x2a')]['create'](_0x28cfbb);}else{throw new Error(_0x3d94('0x47'));}})['then'](function(_0x709841){_0x3b3550[_0x3d94('0x48')]=_0x709841;if(_0x709841){if(!_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')]){_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')]=rs[_0x3d94('0x4a')]()+'\x20'+_0x485066['body']['message'][_0x3d94('0x2e')];}var _0x4bd97c={'ContactId':_0x709841['id'],'MailAccountId':_0x485066[_0x3d94('0x3b')]['id'],'inReplyTo':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x49')],'to':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x2e')],'cc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['cc'],'subject':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x4b')],'attach':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['attach'],'lastMsgAt':moment()[_0x3d94('0x4c')](_0x3d94('0x4d')),'lastMsgDirection':'in'};return db[_0x3d94('0x4e')][_0x3d94('0x32')]({'where':{'closed':![],'MailAccountId':_0x485066['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x3d94('0x4f'),'attributes':[_0x3d94('0x49')],'where':{'messageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['inReplyTo']}}]})[_0x3d94('0xb')](function(_0x1c99d1){if(_0x1c99d1){return[_0x1c99d1,![]];}return db['MailInteraction'][_0x3d94('0x50')](_0x4bd97c)[_0x3d94('0xb')](function(_0x336e36){return[_0x336e36,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3d94('0x51')](function(_0x227372,_0x585531){if(_0x227372){_0x2d0aa2=_0x585531;if(!_0x585531){return _0x227372['update']({'inReplyTo':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['messageId'],'to':_0x485066['body']['message'][_0x3d94('0x2e')],'cc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['cc'],'subject':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['subject'],'attach':_0x227372[_0x3d94('0x52')]?_0x227372[_0x3d94('0x52')]:_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x52')],'substatus':null,'substatusAt':moment()[_0x3d94('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x3d94('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x227372;}}})[_0x3d94('0xb')](function(_0x41d561){_0x3b3550[_0x3d94('0x53')]=_0x41d561[_0x3d94('0x3a')]({'plain':!![]});_0x3b3550[_0x3d94('0x53')][_0x3d94('0x54')]=_0x2d0aa2;return db['MailMessage']['create']({'body':_0x485066[_0x3d94('0x26')]['body'],'MailAccountId':_0x485066['account']['id'],'MailInteractionId':_0x41d561['id'],'direction':'in','ContactId':_0x3b3550['contact']['id'],'messageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')],'from':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x2e')],'to':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['to'],'cc':_0x485066['body'][_0x3d94('0x12')]['cc'],'subject':_0x485066['body'][_0x3d94('0x12')][_0x3d94('0x4b')],'attach':_0x485066[_0x3d94('0x26')]['message']['attach'],'Attachments':_0x485066['body'][_0x3d94('0x12')][_0x3d94('0x55')],'originTo':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x56')],'originCc':_0x485066['body']['message'][_0x3d94('0x57')],'bcc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['bcc'],'ChatWebsiteId':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x58')]||null,'originChannel':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x59')]||_0x3d94('0x5a'),'ChatOfflineMessageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x5b')]||null},{'include':[{'model':db[_0x3d94('0x5c')],'as':_0x3d94('0x5d')}]});})[_0x3d94('0xb')](function(_0xe6cfd1){_0x3b3550[_0x3d94('0x12')]=_0xe6cfd1;if(_0x3b3550['interaction'][_0x3d94('0x5e')]){return db[_0x3d94('0x5f')][_0x3d94('0x32')]({'attributes':['id',_0x3d94('0x60')],'where':{'id':_0x3b3550['interaction'][_0x3d94('0x5e')]}})['then'](function(_0x4f217f){if(_0x4f217f){_0x3b3550[_0x3d94('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3d94('0x61'),'appdata':_0x4f217f[_0x3d94('0x60')]+','+(_0x3b3550['account'][_0x3d94('0x62')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3d94('0x63'),_0x3d94('0x64'),_0x3b3550);});}return respondWithRpcPromise('Start','startRouting',_0x3b3550);})['then'](function(_0x833d96){_0x4d8a8f(_0x833d96);})['catch'](function(_0x5a8114){_0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,_0x5a8114[_0x3d94('0x12')]));});});}; \ No newline at end of file +var _0x2542=['MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','push','length','*,*,*,*','Contacts','contact','messageId','generate','attach','format','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originCc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','map','include','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','Applications'];(function(_0x4e11d5,_0x1ce514){var _0x5e4e4c=function(_0xbee63d){while(--_0xbee63d){_0x4e11d5['push'](_0x4e11d5['shift']());}};_0x5e4e4c(++_0x1ce514);}(_0x2542,0x169));var _0x2254=function(_0x1ca2f2,_0x2193b7){_0x1ca2f2=_0x1ca2f2-0x0;var _0x89924f=_0x2542[_0x1ca2f2];return _0x89924f;};'use strict';var _=require(_0x2254('0x0'));var moment=require(_0x2254('0x1'));var BPromise=require(_0x2254('0x2'));var rs=require(_0x2254('0x3'));var Redis=require('ioredis');var db=require(_0x2254('0x4'))['db'];var logger=require('../../config/logger')(_0x2254('0x5'));var config=require(_0x2254('0x6'));var jayson=require(_0x2254('0x7'));var client=jayson[_0x2254('0x8')][_0x2254('0x9')]({'port':0x232c});config['redis']=_[_0x2254('0xa')](config[_0x2254('0xb')],{'host':_0x2254('0xc'),'port':0x18eb});var socket=require(_0x2254('0xd'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xe'))[_0x2254('0xf')](socket);function respondWithRpcPromise(_0xbf1c18,_0xb395da,_0x1ae415){return new BPromise(function(_0x38fb2b,_0x5b1ab9){return client[_0x2254('0x10')](_0xbf1c18,_0x1ae415)[_0x2254('0x11')](function(_0x506abe){logger[_0x2254('0x12')]('MailAccount,\x20%s,\x20%s',_0xb395da,'request\x20sent');logger[_0x2254('0x13')](_0x2254('0x14'),_0xb395da,_0x2254('0x15'),JSON[_0x2254('0x16')](_0x506abe));if(_0x506abe[_0x2254('0x17')]){if(_0x506abe[_0x2254('0x17')]['code']===0x1f4){logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe['error'][_0x2254('0x19')]);return _0x5b1ab9(_0x506abe[_0x2254('0x17')][_0x2254('0x19')]);}logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe[_0x2254('0x17')]['message']);return _0x38fb2b(_0x506abe[_0x2254('0x17')]['message']);}else{logger[_0x2254('0x12')](_0x2254('0x18'),_0xb395da,_0x2254('0x15'));_0x38fb2b(_0x506abe[_0x2254('0x1a')][_0x2254('0x19')]);}})[_0x2254('0x1b')](function(_0x497724){logger['error']('MailAccount,\x20%s,\x20%s',_0xb395da,_0x497724);_0x5b1ab9(_0x497724);});});}exports[_0x2254('0x1c')]=function(_0x3a79f8){var _0x3c3a98=this;return new Promise(function(_0x1f1163,_0x2801d9){return db[_0x2254('0x1d')]['findAll']({'raw':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a79f8['options']?_0x3a79f8['options']['where']||null:null,'attributes':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'limit':_0x3a79f8['options']?_0x3a79f8['options']['limit']||null:null,'include':_0x3a79f8['options']?_0x3a79f8['options']['include']?_[_0x2254('0x21')](_0x3a79f8[_0x2254('0x1e')][_0x2254('0x22')],function(_0x265467){return{'model':db[_0x265467[_0x2254('0x23')]],'as':_0x265467['as'],'attributes':_0x265467[_0x2254('0x20')],'include':_0x265467['include']?_['map'](_0x265467[_0x2254('0x22')],function(_0x4f6877){return{'model':db[_0x4f6877[_0x2254('0x23')]],'as':_0x4f6877['as'],'attributes':_0x4f6877[_0x2254('0x20')],'include':_0x4f6877[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4f6877[_0x2254('0x22')],function(_0x482688){return{'model':db[_0x482688[_0x2254('0x23')]],'as':_0x482688['as'],'attributes':_0x482688[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x37af8b){logger[_0x2254('0x12')](_0x2254('0x1c'),_0x3a79f8);logger[_0x2254('0x13')](_0x2254('0x1c'),_0x3a79f8,JSON[_0x2254('0x16')](_0x37af8b));_0x1f1163(_0x37af8b);})[_0x2254('0x1b')](function(_0x21c641){logger[_0x2254('0x17')](_0x2254('0x1c'),_0x21c641[_0x2254('0x19')],_0x3a79f8);_0x2801d9(_0x3c3a98[_0x2254('0x17')](0x1f4,_0x21c641[_0x2254('0x19')]));});});};exports[_0x2254('0x24')]=function(_0x291894){var _0x2f32f8=this;return new Promise(function(_0x4e3658,_0xe29526){return db[_0x2254('0x1d')][_0x2254('0x25')]({'raw':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x26')]||null:null,'attributes':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'include':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x22')]?_[_0x2254('0x21')](_0x291894[_0x2254('0x1e')]['include'],function(_0x4a2df0){return{'model':db[_0x4a2df0[_0x2254('0x23')]],'as':_0x4a2df0['as'],'attributes':_0x4a2df0['attributes'],'include':_0x4a2df0[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4a2df0[_0x2254('0x22')],function(_0x141ddc){return{'model':db[_0x141ddc[_0x2254('0x23')]],'as':_0x141ddc['as'],'attributes':_0x141ddc[_0x2254('0x20')],'include':_0x141ddc[_0x2254('0x22')]?_['map'](_0x141ddc[_0x2254('0x22')],function(_0x192e9f){return{'model':db[_0x192e9f[_0x2254('0x23')]],'as':_0x192e9f['as'],'attributes':_0x192e9f[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x3f6007){if(_0x291894[_0x2254('0x1e')][_0x2254('0x27')]===!![])_0x3f6007[_0x2254('0x28')](_0x2254('0x29'),_0x3f6007['getSmtpOptions']());logger[_0x2254('0x12')](_0x2254('0x24'),_0x291894);logger[_0x2254('0x13')](_0x2254('0x24'),_0x291894,JSON['stringify'](_0x3f6007));_0x4e3658(_0x3f6007);})[_0x2254('0x1b')](function(_0x160fec){logger[_0x2254('0x17')](_0x2254('0x24'),_0x160fec[_0x2254('0x19')],_0x291894);_0xe29526(_0x2f32f8[_0x2254('0x17')](0x1f4,_0x160fec[_0x2254('0x19')]));});});};exports[_0x2254('0x2a')]=function(_0x4db9a8){var _0x362ad1=this;return new Promise(function(_0x5c15d7,_0x1df9c3){var _0x19b580={'body':_0x4db9a8[_0x2254('0x2b')],'channel':_0x2254('0x2c')};var _0x460bb3=_[_0x2254('0x2d')](_[_0x2254('0x2e')](db['CmContact'][_0x2254('0x2f')]),[_0x2254('0x30'),_0x2254('0x31'),_0x2254('0x32'),_0x2254('0x33')]);var _0x57cda2=![];if(_0x4db9a8[_0x2254('0x2b')]['id']){delete _0x4db9a8[_0x2254('0x2b')]['id'];}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')])){return _0x1df9c3(_0x362ad1['error'](0x1f4,_0x2254('0x36')));}if(_['isNil'](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')])||_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')]===''){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x37')));}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x39')+_0x460bb3));}if(!_[_0x2254('0x3a')](_0x460bb3,_0x4db9a8[_0x2254('0x2b')]['mapKey'])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x3b')+_0x460bb3));}var _0x2c5609={};_0x2c5609[_0x4db9a8['body'][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x1d')][_0x2254('0x25')]({'where':{'id':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x3d')],'as':_0x2254('0x3e'),'include':[{'model':db[_0x2254('0x3f')],'as':'Contacts','where':_0x2c5609,'limit':0x1,'order':[[_0x2254('0x31'),_0x2254('0x40')]]}]},{'model':db[_0x2254('0x41')],'as':_0x2254('0x42')},{'model':db[_0x2254('0x43')],'as':_0x2254('0x44'),'include':[{'model':db[_0x2254('0x45')],'as':_0x2254('0x45')}]}]})[_0x2254('0x11')](function(_0xa103ea){if(_0xa103ea&&_0xa103ea['List']){var _0x36b977=_0xa103ea[_0x2254('0x46')]({'plain':!![]});_0x19b580['account']=_[_0x2254('0x47')](_0x36b977,[_0x2254('0x42'),_0x2254('0x3e')]);_0x19b580[_0x2254('0x3c')]['smtpOptions']=_0xa103ea[_0x2254('0x48')]();_0x19b580[_0x2254('0x49')]=_0x36b977['Applications'];_0x19b580[_0x2254('0x4a')]=_0x36b977[_0x2254('0x3e')];_0x19b580[_0x2254('0x49')]=_[_0x2254('0x4b')](_0x19b580['applications'],[_0x2254('0x4c')],[_0x2254('0x4d')]);if(_0x19b580[_0x2254('0x3c')]&&_0x19b580['account']['autoclose']){_0x19b580[_0x2254('0x49')][_0x2254('0x4e')]({'id':0x0,'priority':_0x19b580['applications'][_0x2254('0x4f')]+0x1,'app':'close','appdata':'autoclose','interval':_0x2254('0x50')});}if(_0x19b580[_0x2254('0x3c')][_0x2254('0x42')]){delete _0x19b580[_0x2254('0x3c')][_0x2254('0x42')];}if(_0x19b580['account']['List']){delete _0x19b580[_0x2254('0x3c')]['List'];}if(_0x36b977[_0x2254('0x3e')][_0x2254('0x51')][_0x2254('0x4f')]){return _0x36b977[_0x2254('0x3e')]['Contacts'][0x0];}var _0xd5fb20=_[_0x2254('0xa')](_0x4db9a8['body'],{'firstName':_0x4db9a8['body'][_0x2254('0x35')],'ListId':_0x36b977['ListId']});_0xd5fb20[_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x3f')]['create'](_0xd5fb20);}else{throw new Error('List\x20not\x20found');}})[_0x2254('0x11')](function(_0x5b1bd8){_0x19b580[_0x2254('0x52')]=_0x5b1bd8;if(_0x5b1bd8){if(!_0x4db9a8['body']['message']['messageId']){_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')]=rs[_0x2254('0x54')]()+'\x20'+_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')];}var _0x25137c={'ContactId':_0x5b1bd8['id'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')],'to':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'lastMsgAt':moment()[_0x2254('0x56')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x2254('0x25')]({'where':{'closed':![],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x57')],'as':_0x2254('0x58'),'attributes':[_0x2254('0x53')],'where':{'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x59')]}}]})[_0x2254('0x11')](function(_0x4a7d36){if(_0x4a7d36){return[_0x4a7d36,![]];}return db['MailInteraction'][_0x2254('0x5a')](_0x25137c)['then'](function(_0x294931){return[_0x294931,!![]];});});}else{throw new Error(_0x2254('0x5b'));}})['spread'](function(_0x3c091e,_0x1b154f){if(_0x3c091e){_0x57cda2=_0x1b154f;if(!_0x1b154f){return _0x3c091e['update']({'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['messageId'],'to':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8['body']['message']['cc'],'subject':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x5c')],'attach':_0x3c091e['attach']?_0x3c091e[_0x2254('0x55')]:_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'substatus':null,'substatusAt':moment()['format'](_0x2254('0x5d')),'lastMsgAt':moment()['format'](_0x2254('0x5d')),'lastMsgDirection':'in'});}else{return _0x3c091e;}}})[_0x2254('0x11')](function(_0x5ed07f){_0x19b580[_0x2254('0x5e')]=_0x5ed07f[_0x2254('0x46')]({'plain':!![]});_0x19b580['interaction'][_0x2254('0x5f')]=_0x57cda2;return db[_0x2254('0x57')][_0x2254('0x5a')]({'body':_0x4db9a8[_0x2254('0x2b')]['body'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'MailInteractionId':_0x5ed07f['id'],'direction':'in','ContactId':_0x19b580[_0x2254('0x52')]['id'],'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x53')],'from':_0x4db9a8['body'][_0x2254('0x19')]['from'],'to':_0x4db9a8[_0x2254('0x2b')]['message']['to'],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8['body'][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'Attachments':_0x4db9a8['body'][_0x2254('0x19')]['attachments'],'originTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['originTo'],'originCc':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x60')],'bcc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['bcc'],'ChatWebsiteId':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x61')]||null,'originChannel':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x62')]||_0x2254('0x63'),'ChatOfflineMessageId':_0x4db9a8['body'][_0x2254('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x2254('0x64')],'as':'Attachments'}]});})['then'](function(_0x4efb07){_0x19b580[_0x2254('0x19')]=_0x4efb07;if(_0x19b580['interaction'][_0x2254('0x65')]){return db[_0x2254('0x66')]['find']({'attributes':['id',_0x2254('0x67')],'where':{'id':_0x19b580[_0x2254('0x5e')][_0x2254('0x65')]}})[_0x2254('0x11')](function(_0x259e10){if(_0x259e10){_0x19b580[_0x2254('0x49')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x259e10[_0x2254('0x67')]+','+(_0x19b580[_0x2254('0x3c')][_0x2254('0x68')]||0xa),'interval':_0x2254('0x50')});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);})[_0x2254('0x11')](function(_0x39b95b){_0x5c15d7(_0x39b95b);})['catch'](function(_0x25eb17){_0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x25eb17['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 100def5..b1576bb 100644 --- a/server/api/mailAccount/mailAccount.socket.js +++ b/server/api/mailAccount/mailAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce89=['length','mailAccount:','./mailAccount.events','save','remove','update','emit','register'];(function(_0x45aed4,_0xd8dfcc){var _0x5c5e20=function(_0x576bd7){while(--_0x576bd7){_0x45aed4['push'](_0x45aed4['shift']());}};_0x5c5e20(++_0xd8dfcc);}(_0xce89,0x1aa));var _0x9ce8=function(_0x20f3c7,_0x24c827){_0x20f3c7=_0x20f3c7-0x0;var _0x234881=_0xce89[_0x20f3c7];return _0x234881;};'use strict';var MailAccountEvents=require(_0x9ce8('0x0'));var events=[_0x9ce8('0x1'),_0x9ce8('0x2'),_0x9ce8('0x3')];function createListener(_0x5bdabc,_0x1d248e){return function(_0xde5380){_0x1d248e[_0x9ce8('0x4')](_0x5bdabc,_0xde5380);};}function removeListener(_0x2ad6fc,_0x4d88c7){return function(){MailAccountEvents['removeListener'](_0x2ad6fc,_0x4d88c7);};}exports[_0x9ce8('0x5')]=function(_0x313de4){for(var _0x51b1e4=0x0,_0x58adea=events[_0x9ce8('0x6')];_0x51b1e4<_0x58adea;_0x51b1e4++){var _0x4eab2d=events[_0x51b1e4];var _0x4f1d91=createListener(_0x9ce8('0x7')+_0x4eab2d,_0x313de4);MailAccountEvents['on'](_0x4eab2d,_0x4f1d91);}}; \ No newline at end of file +var _0xbf31=['remove','update','emit','removeListener','mailAccount:','./mailAccount.events','save'];(function(_0x5d4eb3,_0x2311ad){var _0xfd2513=function(_0x1aae2e){while(--_0x1aae2e){_0x5d4eb3['push'](_0x5d4eb3['shift']());}};_0xfd2513(++_0x2311ad);}(_0xbf31,0xbb));var _0x1bf3=function(_0x53dc13,_0x57fa2a){_0x53dc13=_0x53dc13-0x0;var _0x41fdb1=_0xbf31[_0x53dc13];return _0x41fdb1;};'use strict';var MailAccountEvents=require(_0x1bf3('0x0'));var events=[_0x1bf3('0x1'),_0x1bf3('0x2'),_0x1bf3('0x3')];function createListener(_0x5d273a,_0x39c2ac){return function(_0x4563f6){_0x39c2ac[_0x1bf3('0x4')](_0x5d273a,_0x4563f6);};}function removeListener(_0x3eadd6,_0x54ba2f){return function(){MailAccountEvents[_0x1bf3('0x5')](_0x3eadd6,_0x54ba2f);};}exports['register']=function(_0x739cf){for(var _0xebf36c=0x0,_0x157686=events['length'];_0xebf36c<_0x157686;_0xebf36c++){var _0x37cb13=events[_0xebf36c];var _0x4ace18=createListener(_0x1bf3('0x6')+_0x37cb13,_0x739cf);MailAccountEvents['on'](_0x37cb13,_0x4ace18);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 2b02df5..e940a8e 100644 --- a/server/api/mailApplication/index.js +++ b/server/api/mailApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe28e=['get','isAuthenticated','show','put','/:id','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe28e,0xca));var _0xee28=function(_0x3400a8,_0x55b0eb){_0x3400a8=_0x3400a8-0x0;var _0x2d4a3d=_0xe28e[_0x3400a8];return _0x2d4a3d;};'use strict';var multer=require(_0xee28('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xee28('0x1')]();var fs_extra=require(_0xee28('0x2'));var auth=require(_0xee28('0x3'));var interaction=require(_0xee28('0x4'));var config=require('../../config/environment');var controller=require(_0xee28('0x5'));router[_0xee28('0x6')]('/:id',auth[_0xee28('0x7')](),controller[_0xee28('0x8')]);router[_0xee28('0x9')](_0xee28('0xa'),auth[_0xee28('0x7')](),controller['update']);router['delete']('/:id',auth[_0xee28('0x7')](),controller[_0xee28('0xb')]);module[_0xee28('0xc')]=router; \ No newline at end of file +var _0xd7bc=['update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put'];(function(_0x38bb02,_0x4918b2){var _0xd872c4=function(_0x35e0dc){while(--_0x35e0dc){_0x38bb02['push'](_0x38bb02['shift']());}};_0xd872c4(++_0x4918b2);}(_0xd7bc,0x13f));var _0xcd7b=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0xd7bc[_0x270a54];return _0x4d07d0;};'use strict';var multer=require(_0xcd7b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd7b('0x1'));var router=express[_0xcd7b('0x2')]();var fs_extra=require(_0xcd7b('0x3'));var auth=require(_0xcd7b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd7b('0x5'));var controller=require(_0xcd7b('0x6'));router[_0xcd7b('0x7')](_0xcd7b('0x8'),auth[_0xcd7b('0x9')](),controller['show']);router[_0xcd7b('0xa')](_0xcd7b('0x8'),auth[_0xcd7b('0x9')](),controller[_0xcd7b('0xb')]);router[_0xcd7b('0xc')]('/:id',auth[_0xcd7b('0x9')](),controller[_0xcd7b('0xd')]);module[_0xcd7b('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 1c0e2bb..b9b748c 100644 --- a/server/api/mailApplication/mailApplication.attributes.js +++ b/server/api/mailApplication/mailApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22f7=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x22f7,0x194));var _0x722f=function(_0x44b85b,_0x23553c){_0x44b85b=_0x44b85b-0x0;var _0x5acc75=_0x22f7[_0x44b85b];return _0x5acc75;};'use strict';var Sequelize=require(_0x722f('0x0'));module[_0x722f('0x1')]={'priority':{'type':Sequelize[_0x722f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x722f('0x3')],'allowNull':![],'defaultValue':_0x722f('0x4')},'appdata':{'type':Sequelize[_0x722f('0x5')]()},'description':{'type':Sequelize[_0x722f('0x3')]},'interval':{'type':Sequelize[_0x722f('0x3')],'defaultValue':_0x722f('0x6')}}; \ No newline at end of file +var _0x0e1a=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x2cb4f4,_0x51dc79){var _0x165f91=function(_0x17b00f){while(--_0x17b00f){_0x2cb4f4['push'](_0x2cb4f4['shift']());}};_0x165f91(++_0x51dc79);}(_0x0e1a,0x11f));var _0xa0e1=function(_0x122296,_0x15efed){_0x122296=_0x122296-0x0;var _0x43efc2=_0x0e1a[_0x122296];return _0x43efc2;};'use strict';var Sequelize=require(_0xa0e1('0x0'));module[_0xa0e1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa0e1('0x2')},'appdata':{'type':Sequelize[_0xa0e1('0x3')]()},'description':{'type':Sequelize[_0xa0e1('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa0e1('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 1ffe583..8464612 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x59904f,_0x4bc36d){var _0x16d547=function(_0x3c6fb8){while(--_0x3c6fb8){_0x59904f['push'](_0x59904f['shift']());}};_0x16d547(++_0x4bc36d);}(_0x54ef,0x112));var _0xf54e=function(_0x183bc4,_0x4bad9b){_0x183bc4=_0x183bc4-0x0;var _0x4db7d4=_0x54ef[_0x183bc4];return _0x4db7d4;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x87c8fe,_0x344255){var _0x4c9c58=function(_0x6adadf){while(--_0x6adadf){_0x87c8fe['push'](_0x87c8fe['shift']());}};_0x4c9c58(++_0x344255);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0xcb91[_0x4be8ba];return _0x1af822;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7d1b1c8..4309a6e 100644 --- a/server/api/mailApplication/mailApplication.model.js +++ b/server/api/mailApplication/mailApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2683=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications'];(function(_0x426dd2,_0x4b0012){var _0x4bc76c=function(_0x4c0732){while(--_0x4c0732){_0x426dd2['push'](_0x426dd2['shift']());}};_0x4bc76c(++_0x4b0012);}(_0x2683,0x12e));var _0x3268=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0x2683[_0x403fc7];return _0x5d0827;};'use strict';var _=require(_0x3268('0x0'));var util=require(_0x3268('0x1'));var logger=require(_0x3268('0x2'))(_0x3268('0x3'));var moment=require(_0x3268('0x4'));var BPromise=require(_0x3268('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3268('0x6'));var rimraf=require('rimraf');var config=require(_0x3268('0x7'));var attributes=require(_0x3268('0x8'));module[_0x3268('0x9')]=function(_0x2637ca,_0x3aa191){return _0x2637ca[_0x3268('0xa')](_0x3268('0xb'),attributes,{'tableName':_0x3268('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3268('0xd'),'collate':_0x3268('0xe')});}; \ No newline at end of file +var _0xea0b=['rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','../../config/logger','bluebird','request-promise'];(function(_0x45fa47,_0x14781d){var _0x247a41=function(_0x16e4f6){while(--_0x16e4f6){_0x45fa47['push'](_0x45fa47['shift']());}};_0x247a41(++_0x14781d);}(_0xea0b,0xe0));var _0xbea0=function(_0x4cbc15,_0x10f442){_0x4cbc15=_0x4cbc15-0x0;var _0x4452c9=_0xea0b[_0x4cbc15];return _0x4452c9;};'use strict';var _=require(_0xbea0('0x0'));var util=require('util');var logger=require(_0xbea0('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbea0('0x2'));var rp=require(_0xbea0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbea0('0x4'));var config=require(_0xbea0('0x5'));var attributes=require(_0xbea0('0x6'));module[_0xbea0('0x7')]=function(_0x488345,_0x38d616){return _0x488345[_0xbea0('0x8')](_0xbea0('0x9'),attributes,{'tableName':_0xbea0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbea0('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index c0c8711..c29855a 100644 --- a/server/api/mailApplication/mailApplication.rpc.js +++ b/server/api/mailApplication/mailApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8344=['message','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x303f72,_0x521bb4){var _0x2bf830=function(_0x1ca333){while(--_0x1ca333){_0x303f72['push'](_0x303f72['shift']());}};_0x2bf830(++_0x521bb4);}(_0x8344,0xf1));var _0x4834=function(_0x30567a,_0x25484c){_0x30567a=_0x30567a-0x0;var _0x18d97f=_0x8344[_0x30567a];return _0x18d97f;};'use strict';var _=require(_0x4834('0x0'));var util=require(_0x4834('0x1'));var moment=require(_0x4834('0x2'));var BPromise=require(_0x4834('0x3'));var rs=require(_0x4834('0x4'));var fs=require('fs');var Redis=require(_0x4834('0x5'));var db=require(_0x4834('0x6'))['db'];var utils=require(_0x4834('0x7'));var logger=require(_0x4834('0x8'))(_0x4834('0x9'));var config=require(_0x4834('0xa'));var jayson=require(_0x4834('0xb'));var client=jayson[_0x4834('0xc')][_0x4834('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1f03ed,_0x2d48aa,_0xb50cb4){return new BPromise(function(_0x57e056,_0x1ada30){return client[_0x4834('0xe')](_0x1f03ed,_0xb50cb4)[_0x4834('0xf')](function(_0x55aeb4){logger[_0x4834('0x10')](_0x4834('0x11'),_0x2d48aa,_0x4834('0x12'));logger[_0x4834('0x13')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x2d48aa,_0x4834('0x12'),JSON[_0x4834('0x14')](_0x55aeb4));if(_0x55aeb4['error']){if(_0x55aeb4[_0x4834('0x15')][_0x4834('0x16')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x2d48aa,_0x55aeb4['error'][_0x4834('0x17')]);return _0x1ada30(_0x55aeb4['error']['message']);}logger[_0x4834('0x15')](_0x4834('0x11'),_0x2d48aa,_0x55aeb4[_0x4834('0x15')]['message']);return _0x57e056(_0x55aeb4['error'][_0x4834('0x17')]);}else{logger[_0x4834('0x10')](_0x4834('0x11'),_0x2d48aa,_0x4834('0x12'));_0x57e056(_0x55aeb4['result'][_0x4834('0x17')]);}})[_0x4834('0x18')](function(_0x1e7e53){logger[_0x4834('0x15')](_0x4834('0x11'),_0x2d48aa,_0x1e7e53);_0x1ada30(_0x1e7e53);});});}exports[_0x4834('0x19')]=function(_0x5593f0){var _0x458ada=this;return new Promise(function(_0x1920eb,_0x57b4a7){return db[_0x4834('0x1a')][_0x4834('0x1b')](_0x5593f0[_0x4834('0x1c')],{'raw':_0x5593f0[_0x4834('0x1d')]?_0x5593f0[_0x4834('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5593f0['options']?_0x5593f0[_0x4834('0x1d')][_0x4834('0x1e')]||null:null,'attributes':_0x5593f0[_0x4834('0x1d')]?_0x5593f0[_0x4834('0x1d')][_0x4834('0x1f')]||null:null,'limit':_0x5593f0['options']?_0x5593f0[_0x4834('0x1d')][_0x4834('0x20')]||null:null})['then'](function(_0x2bb115){logger[_0x4834('0x10')](_0x4834('0x19'),_0x5593f0);logger[_0x4834('0x13')](_0x4834('0x19'),_0x5593f0,JSON[_0x4834('0x14')](_0x2bb115));_0x1920eb(_0x2bb115);})[_0x4834('0x18')](function(_0x1a3ff1){logger[_0x4834('0x15')](_0x4834('0x19'),_0x1a3ff1[_0x4834('0x17')],_0x5593f0);_0x57b4a7(_0x458ada[_0x4834('0x15')](0x1f4,_0x1a3ff1['message']));});});}; \ No newline at end of file +var _0x6f89=['../../config/utils','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','attributes','limit','lodash','util','randomstring','ioredis'];(function(_0x2e3a6a,_0x4eeb24){var _0x463cef=function(_0x3c2e85){while(--_0x3c2e85){_0x2e3a6a['push'](_0x2e3a6a['shift']());}};_0x463cef(++_0x4eeb24);}(_0x6f89,0x1d8));var _0x96f8=function(_0x48b8ba,_0x4d1bb9){_0x48b8ba=_0x48b8ba-0x0;var _0x7c4e05=_0x6f89[_0x48b8ba];return _0x7c4e05;};'use strict';var _=require(_0x96f8('0x0'));var util=require(_0x96f8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x96f8('0x2'));var fs=require('fs');var Redis=require(_0x96f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x96f8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x96f8('0x5'));var jayson=require(_0x96f8('0x6'));var client=jayson[_0x96f8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ae0b3,_0x58301d,_0x3b5e15){return new BPromise(function(_0x4dc734,_0x2122f5){return client[_0x96f8('0x8')](_0x5ae0b3,_0x3b5e15)[_0x96f8('0x9')](function(_0x4bdf69){logger[_0x96f8('0xa')](_0x96f8('0xb'),_0x58301d,_0x96f8('0xc'));logger[_0x96f8('0xd')](_0x96f8('0xe'),_0x58301d,'request\x20sent',JSON[_0x96f8('0xf')](_0x4bdf69));if(_0x4bdf69[_0x96f8('0x10')]){if(_0x4bdf69[_0x96f8('0x10')][_0x96f8('0x11')]===0x1f4){logger[_0x96f8('0x10')](_0x96f8('0xb'),_0x58301d,_0x4bdf69[_0x96f8('0x10')][_0x96f8('0x12')]);return _0x2122f5(_0x4bdf69[_0x96f8('0x10')][_0x96f8('0x12')]);}logger['error'](_0x96f8('0xb'),_0x58301d,_0x4bdf69[_0x96f8('0x10')][_0x96f8('0x12')]);return _0x4dc734(_0x4bdf69['error']['message']);}else{logger[_0x96f8('0xa')](_0x96f8('0xb'),_0x58301d,_0x96f8('0xc'));_0x4dc734(_0x4bdf69[_0x96f8('0x13')]['message']);}})[_0x96f8('0x14')](function(_0x1c3641){logger[_0x96f8('0x10')]('MailApplication,\x20%s,\x20%s',_0x58301d,_0x1c3641);_0x2122f5(_0x1c3641);});});}exports[_0x96f8('0x15')]=function(_0x40eccb){var _0x4ede5a=this;return new Promise(function(_0x5bcee2,_0x41d300){return db[_0x96f8('0x16')][_0x96f8('0x17')](_0x40eccb['body'],{'raw':_0x40eccb[_0x96f8('0x18')]?_0x40eccb[_0x96f8('0x18')][_0x96f8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40eccb['options']?_0x40eccb[_0x96f8('0x18')]['where']||null:null,'attributes':_0x40eccb[_0x96f8('0x18')]?_0x40eccb[_0x96f8('0x18')][_0x96f8('0x1a')]||null:null,'limit':_0x40eccb['options']?_0x40eccb['options'][_0x96f8('0x1b')]||null:null})[_0x96f8('0x9')](function(_0x2ac61c){logger['info']('UpdateMailApplication',_0x40eccb);logger[_0x96f8('0xd')](_0x96f8('0x15'),_0x40eccb,JSON[_0x96f8('0xf')](_0x2ac61c));_0x5bcee2(_0x2ac61c);})[_0x96f8('0x14')](function(_0xf682bc){logger[_0x96f8('0x10')](_0x96f8('0x15'),_0xf682bc[_0x96f8('0x12')],_0x40eccb);_0x41d300(_0x4ede5a['error'](0x1f4,_0xf682bc[_0x96f8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index c46224c..be88b89 100644 --- a/server/api/mailInteraction/index.js +++ b/server/api/mailInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0709=['put','/:id','mailinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','mail','mailinteraction:addtags','addTags'];(function(_0x40b884,_0x5955d3){var _0x42d11b=function(_0x3d63f9){while(--_0x3d63f9){_0x40b884['push'](_0x40b884['shift']());}};_0x42d11b(++_0x5955d3);}(_0x0709,0x13d));var _0x9070=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0x0709[_0x2e78e9];return _0x35aad4;};'use strict';var express=require(_0x9070('0x0'));var router=express['Router']();var auth=require(_0x9070('0x1'));var interaction=require(_0x9070('0x2'));var controller=require(_0x9070('0x3'));router[_0x9070('0x4')]('/',auth[_0x9070('0x5')](),controller['index']);router[_0x9070('0x4')](_0x9070('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x9070('0x4')]('/:id',auth[_0x9070('0x5')](),controller[_0x9070('0x7')]);router['get'](_0x9070('0x8'),auth[_0x9070('0x5')](),controller[_0x9070('0x9')]);router[_0x9070('0x4')](_0x9070('0xa'),auth['isAuthenticated'](),controller[_0x9070('0xb')]);router[_0x9070('0xc')]('/',auth[_0x9070('0x5')](),controller[_0x9070('0xd')]);router[_0x9070('0xc')](_0x9070('0x8'),auth[_0x9070('0x5')](),controller[_0x9070('0xe')]);router[_0x9070('0xc')]('/:id/tags',auth[_0x9070('0x5')](),interaction[_0x9070('0xf')](_0x9070('0x10'),_0x9070('0x11')),controller[_0x9070('0x12')]);router[_0x9070('0x13')](_0x9070('0x14'),auth['isAuthenticated'](),interaction[_0x9070('0xf')](_0x9070('0x10'),_0x9070('0x15')),controller[_0x9070('0x16')]);router[_0x9070('0x17')](_0x9070('0x14'),auth['isAuthenticated'](),interaction[_0x9070('0xf')]('mail','mailinteraction:destroy'),controller[_0x9070('0x18')]);router[_0x9070('0x17')](_0x9070('0x19'),auth[_0x9070('0x5')](),controller[_0x9070('0x1a')]);module[_0x9070('0x1b')]=router; \ No newline at end of file +var _0x808f=['destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','mail','mailinteraction:addtags','mailinteraction:update','delete','mailinteraction:destroy'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x808f,0x6b));var _0xf808=function(_0x5525b4,_0x4f6596){_0x5525b4=_0x5525b4-0x0;var _0x5827c7=_0x808f[_0x5525b4];return _0x5827c7;};'use strict';var express=require(_0xf808('0x0'));var router=express[_0xf808('0x1')]();var auth=require(_0xf808('0x2'));var interaction=require(_0xf808('0x3'));var controller=require('./mailInteraction.controller');router[_0xf808('0x4')]('/',auth[_0xf808('0x5')](),controller[_0xf808('0x6')]);router[_0xf808('0x4')](_0xf808('0x7'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf808('0x8'),auth['isAuthenticated'](),controller[_0xf808('0x9')]);router[_0xf808('0x4')]('/:id/messages',auth[_0xf808('0x5')](),controller[_0xf808('0xa')]);router['get'](_0xf808('0xb'),auth[_0xf808('0x5')](),controller[_0xf808('0xc')]);router[_0xf808('0xd')]('/',auth[_0xf808('0x5')](),controller[_0xf808('0xe')]);router[_0xf808('0xd')](_0xf808('0xf'),auth[_0xf808('0x5')](),controller['addMessage']);router[_0xf808('0xd')](_0xf808('0x10'),auth['isAuthenticated'](),interaction[_0xf808('0x11')](_0xf808('0x12'),_0xf808('0x13')),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xf808('0x12'),_0xf808('0x14')),controller['update']);router[_0xf808('0x15')](_0xf808('0x8'),auth[_0xf808('0x5')](),interaction[_0xf808('0x11')](_0xf808('0x12'),_0xf808('0x16')),controller[_0xf808('0x17')]);router['delete'](_0xf808('0x10'),auth[_0xf808('0x5')](),controller[_0xf808('0x18')]);module[_0xf808('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 75dd2d2..3327b55 100644 --- a/server/api/mailInteraction/mailInteraction.attributes.js +++ b/server/api/mailInteraction/mailInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dc0=['sequelize','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out'];(function(_0x40bd56,_0x2491d1){var _0x20947d=function(_0x26a39c){while(--_0x26a39c){_0x40bd56['push'](_0x40bd56['shift']());}};_0x20947d(++_0x2491d1);}(_0x6dc0,0x18c));var _0x06dc=function(_0x2fd8d8,_0x4ead5a){_0x2fd8d8=_0x2fd8d8-0x0;var _0x1ff820=_0x6dc0[_0x2fd8d8];return _0x1ff820;};'use strict';var Sequelize=require(_0x06dc('0x0'));var iconv=require('iconv');module[_0x06dc('0x1')]={'closed':{'type':Sequelize[_0x06dc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x06dc('0x3')]},'disposition':{'type':Sequelize[_0x06dc('0x4')]},'secondDisposition':{'type':Sequelize[_0x06dc('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x06dc('0x4')](0x1fe)},'to':{'type':Sequelize[_0x06dc('0x4')]},'cc':{'type':Sequelize['TEXT'](_0x06dc('0x5'))},'subject':{'type':Sequelize[_0x06dc('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x06dc('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x06dc('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x06dc('0x7')]('in',_0x06dc('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x06dc('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x06dc('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x06dc('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xfbc6=['TEXT','DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x4794a1,_0x1ae822){var _0x111a41=function(_0x3819c5){while(--_0x3819c5){_0x4794a1['push'](_0x4794a1['shift']());}};_0x111a41(++_0x1ae822);}(_0xfbc6,0x13c));var _0x6fbc=function(_0x5f0c5f,_0x1a58ae){_0x5f0c5f=_0x5f0c5f-0x0;var _0x2112e3=_0xfbc6[_0x5f0c5f];return _0x2112e3;};'use strict';var Sequelize=require(_0x6fbc('0x0'));var iconv=require('iconv');module[_0x6fbc('0x1')]={'closed':{'type':Sequelize[_0x6fbc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6fbc('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6fbc('0x3')]},'note':{'type':Sequelize[_0x6fbc('0x3')]},'inReplyTo':{'type':Sequelize[_0x6fbc('0x3')](0x1fe)},'to':{'type':Sequelize[_0x6fbc('0x3')]},'cc':{'type':Sequelize[_0x6fbc('0x4')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6fbc('0x5')]},'substatus':{'type':Sequelize[_0x6fbc('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x6fbc('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x6fbc('0x6')]('in',_0x6fbc('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6fbc('0x6')]('in',_0x6fbc('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6fbc('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 2dc299b..3579ba6 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x292c=['CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','MailInteraction','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.lastName','c.email','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','describe','addMessage','ids','omit','format','YYYY-MM-DD\x20HH:mm:ss','true','spread','findAll','removeTags','download','unix','join','server','files','root','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','get','mkdirSync','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','update','then','destroy','stack','name','send','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','length','find','having','Contact','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','read','`unreadMessages`\x20>\x200','tag'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x292c,0x66));var _0xc292=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x292c[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require(_0xc292('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc292('0x1'));var moment=require(_0xc292('0x2'));var BPromise=require(_0xc292('0x3'));var util=require(_0xc292('0x4'));var path=require(_0xc292('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc292('0x6'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0xc292('0x7'));var as=require(_0xc292('0x8'));var logger=require(_0xc292('0x9'))(_0xc292('0xa'));var config=require(_0xc292('0xb'));var db=require(_0xc292('0xc'))['db'];var htmlEntities=require(_0xc292('0xd'));config[_0xc292('0xe')]=_[_0xc292('0xf')](config[_0xc292('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xc292('0x10'))(new Redis(config[_0xc292('0xe')]));require(_0xc292('0x11'))[_0xc292('0x12')](socket);function respondWithStatusCode(_0x556537,_0x51fff4){_0x51fff4=_0x51fff4||0xcc;return function(_0x2ab730){if(_0x2ab730){return _0x556537[_0xc292('0x13')](_0x51fff4);}return _0x556537[_0xc292('0x14')](_0x51fff4)[_0xc292('0x15')]();};}function respondWithResult(_0x1c6488,_0x3ead77){_0x3ead77=_0x3ead77||0xc8;return function(_0x4f4e98){if(_0x4f4e98){return _0x1c6488[_0xc292('0x14')](_0x3ead77)[_0xc292('0x16')](_0x4f4e98);}};}function respondWithFilteredResult(_0x2a3a0a,_0x1779f0){return function(_0x38c865){if(_0x38c865){var _0x51ab23=typeof _0x1779f0['offset']===_0xc292('0x17')&&typeof _0x1779f0[_0xc292('0x18')]==='undefined';var _0x290138=_0x38c865['count'];var _0x5e765a=_0x51ab23?0x0:_0x1779f0[_0xc292('0x19')];var _0x5bde28=_0x51ab23?_0x38c865[_0xc292('0x1a')]:_0x1779f0[_0xc292('0x19')]+_0x1779f0[_0xc292('0x18')];var _0x5c2de4;if(_0x5bde28>=_0x290138){_0x5bde28=_0x290138;_0x5c2de4=0xc8;}else{_0x5c2de4=0xce;}_0x2a3a0a[_0xc292('0x14')](_0x5c2de4);return _0x2a3a0a['set']('Content-Range',_0x5e765a+'-'+_0x5bde28+'/'+_0x290138)[_0xc292('0x16')](_0x38c865);}return null;};}function saveUpdates(_0x502f23){return function(_0x5808f1){if(_0x5808f1){return _0x5808f1[_0xc292('0x1b')](_0x502f23)[_0xc292('0x1c')](function(_0x314f3b){return _0x314f3b;});}return null;};}function removeEntity(_0x5a9873){return function(_0x4b7c83){if(_0x4b7c83){return _0x4b7c83[_0xc292('0x1d')]()[_0xc292('0x1c')](function(){_0x5a9873[_0xc292('0x14')](0xcc)[_0xc292('0x15')]();});}};}function handleEntityNotFound(_0x1c1119){return function(_0x14d94c){if(!_0x14d94c){_0x1c1119[_0xc292('0x13')](0x194);}return _0x14d94c;};}function handleError(_0x2a4618,_0x3e638b){_0x3e638b=_0x3e638b||0x1f4;return function(_0x51e142){logger['error'](_0x51e142[_0xc292('0x1e')]);if(_0x51e142[_0xc292('0x1f')]){delete _0x51e142['name'];}_0x2a4618[_0xc292('0x14')](_0x3e638b)[_0xc292('0x20')](_0x51e142);};}function getInteractionUsers(_0x351907,_0x595f4b){return new BPromise(function(_0x315057,_0x342d73){try{if(_0x595f4b[_0x351907['id']]){_0x351907['Users']=_['map'](_0x595f4b[_0x351907['id']],function(_0x46066d){return{'id':_0x46066d['id'],'fullname':_0x46066d[_0xc292('0x21')]};});}}catch(_0x53fcb9){_0x342d73(_0x53fcb9);}_0x315057(_0x351907);});}function getInteractionTags(_0x51314f,_0x4f697b){return new BPromise(function(_0x3933c6,_0x10b77e){try{if(_0x51314f['TagIds']){_0x51314f[_0xc292('0x22')]=[];_0x51314f['TagIds'][_0xc292('0x23')](',')[_0xc292('0x24')](function(_0x4ae177){_0x51314f['Tags'][_0xc292('0x25')](_0x4f697b[_0x4ae177]);});}delete _0x51314f[_0xc292('0x26')];}catch(_0x4f169b){_0x10b77e(_0x4f169b);}_0x3933c6(_0x51314f);});}function getLastMessageText(_0x4f694d){return new BPromise(function(_0x939e19,_0x47e88a){return db[_0xc292('0x27')][_0xc292('0x28')]({'where':{'$and':[{'MailInteractionId':_0x4f694d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xc292('0x29')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xc292('0x2a'),'raw':!![]})[_0xc292('0x1c')](function(_0x1ffd9f){if(_0x1ffd9f&&_0x1ffd9f[_0xc292('0x2b')]){_0x4f694d[_0xc292('0x2c')]=_['trimStart'](_0x1ffd9f[_0xc292('0x2b')]);}_0x939e19(_0x4f694d);})[_0xc292('0x2d')](function(_0x3c8387){_0x47e88a(_0x3c8387);});});}function updateMailInteraction(_0x253f7c,_0x4e1582,_0x5462e1,_0x4d6c60){return new BPromise(function(_0x3443ce,_0x7c960c){return getInteractionUsers(_0x253f7c,_0x5462e1)[_0xc292('0x1c')](function(_0x261792){return getInteractionTags(_0x261792,_0x4e1582);})[_0xc292('0x1c')](function(_0x4ab9c5){return getStateInteraction(_0x4ab9c5);})['then'](function(_0x1771de){if(_0x4d6c60){_0x3443ce(getLastMessageText(_0x1771de));}else{_0x3443ce(_0x1771de);}})[_0xc292('0x2d')](function(_0x4e57e8){_0x7c960c(_0x4e57e8);});});}function getStateInteraction(_0x2653a7){return new BPromise(function(_0x3c3184){_0x2653a7[_0xc292('0x2e')]=0x0;_0x2653a7[_0xc292('0x2f')]=0x0;_0x2653a7[_0xc292('0x30')]=0x0;_0x2653a7['unmanaged']=0x0;_0x2653a7[_0xc292('0x31')]=0x0;if(!_0x2653a7[_0xc292('0x32')]&&!_0x2653a7[_0xc292('0x33')]){_0x2653a7[_0xc292('0x2e')]+=0x1;}if(!_0x2653a7[_0xc292('0x32')]&&_0x2653a7[_0xc292('0x33')]){_0x2653a7['talking']+=0x1;if(_0x2653a7[_0xc292('0x2e')]){_0x2653a7[_0xc292('0x2e')]-=0x1;}}if(_0x2653a7[_0xc292('0x32')]&&_0x2653a7[_0xc292('0x33')]){_0x2653a7[_0xc292('0x30')]+=0x1;if(_0x2653a7['talking']){_0x2653a7[_0xc292('0x2f')]-=0x1;}}if(_0x2653a7[_0xc292('0x32')]&&!_0x2653a7[_0xc292('0x33')]){_0x2653a7[_0xc292('0x34')]+=0x1;if(_0x2653a7[_0xc292('0x2e')]){_0x2653a7['waiting']-=0x1;}}_0x2653a7['total']+=0x1;_0x3c3184(_0x2653a7);});}exports[_0xc292('0x35')]=function(_0x284a06,_0x5a2e4c){var _0x2c95fa={},_0x406f9f={},_0x4f4fb5={'count':0x0,'rows':[]};var _0x2f6df7=_[_0xc292('0x36')](db['MailInteraction'][_0xc292('0x37')],function(_0x375cb3){return{'name':_0x375cb3[_0xc292('0x38')],'type':_0x375cb3[_0xc292('0x39')][_0xc292('0x3a')]};});_0x406f9f[_0xc292('0x3b')]=_['map'](_0x2f6df7,_0xc292('0x1f'));_0x406f9f[_0xc292('0x3c')]=_[_0xc292('0x3d')](_0x284a06['query']);_0x406f9f[_0xc292('0x3e')]=_['intersection'](_0x406f9f['model'],_0x406f9f[_0xc292('0x3c')]);_0x2c95fa[_0xc292('0x3f')]=_[_0xc292('0x40')](_0x406f9f['model'],qs[_0xc292('0x41')](_0x284a06['query'][_0xc292('0x41')]));_0x2c95fa[_0xc292('0x3f')]=_0x2c95fa[_0xc292('0x3f')]['length']?_0x2c95fa['attributes']:_0x406f9f[_0xc292('0x3b')];if(!_0x284a06[_0xc292('0x3c')]['hasOwnProperty']('nolimit')){_0x2c95fa[_0xc292('0x18')]=qs[_0xc292('0x18')](_0x284a06[_0xc292('0x3c')]['limit']);_0x2c95fa[_0xc292('0x19')]=qs['offset'](_0x284a06['query'][_0xc292('0x19')]);}_0x2c95fa['order']=qs[_0xc292('0x42')](_0x284a06['query'][_0xc292('0x42')]);_0x2c95fa[_0xc292('0x43')]=qs[_0xc292('0x3e')](_[_0xc292('0x44')](_0x284a06[_0xc292('0x3c')],_0x406f9f[_0xc292('0x3e')]),_0x2f6df7);var _0x55bd05=[];var _0x47710f=squel[_0xc292('0x45')]()['field']('id')[_0xc292('0x46')](_0xc292('0x1f'))[_0xc292('0x46')](_0xc292('0x47'))[_0xc292('0x48')](_0xc292('0x49'));var _0x541219=squel[_0xc292('0x45')]()[_0xc292('0x46')](_0xc292('0x4a'))[_0xc292('0x46')](_0xc292('0x4b'))[_0xc292('0x46')](_0xc292('0x4c'))[_0xc292('0x48')](_0xc292('0x4d'),'ui')[_0xc292('0x4e')](_0xc292('0x4f'),'u',_0xc292('0x50'));var _0x411e43=squel[_0xc292('0x45')]()[_0xc292('0x48')](_0xc292('0x51'),'i')['left_join'](_0xc292('0x52'),'c',_0xc292('0x53'))[_0xc292('0x4e')](_0xc292('0x4f'),'o','o.id\x20=\x20i.UserId')[_0xc292('0x4e')](_0xc292('0x54'),'a',_0xc292('0x55'))[_0xc292('0x4e')](_0xc292('0x56'),'me','me.MailInteractionId\x20=\x20i.id')[_0xc292('0x4e')]('mail_interaction_has_tags','it',_0xc292('0x57'))[_0xc292('0x4e')](_0xc292('0x49'),'t',_0xc292('0x58'));var _0xb1d3dd=squel[_0xc292('0x59')]();var _0x5ea370=[];var _0x71b80d=squel['expr']();var _0x184711;if(_0x284a06[_0xc292('0x3c')][_0xc292('0x5a')]){_0x184711=as['parseSearch'](_0x284a06['query']['search']);var _0x136992=_0x184711['sqlOperator'];for(var _0x5376d8=0x0;_0x5376d8<_0x184711[_0xc292('0x5b')][_0xc292('0x5c')];_0x5376d8++){var _0x5b8191=_0x184711[_0xc292('0x5b')][_0x5376d8];var _0x490a78='i';var _0x9b4bff=_[_0xc292('0x5d')](_0x2f6df7,[_0xc292('0x1f'),_0x5b8191[_0xc292('0x46')]]);if(!_0x9b4bff){switch(_0x5b8191[_0xc292('0x46')]){case'unreadMessages':if(_0x5b8191['value']==0x1){_0x411e43['having']('`'+_0x5b8191['field']+'`\x20=\x200');}else{_0x411e43[_0xc292('0x5e')]('`'+_0x5b8191[_0xc292('0x46')]+'`\x20>\x200');}break;case _0xc292('0x5f'):if(_0x5b8191[_0xc292('0x60')]===_0xc292('0x61')){if(_0x5b8191[_0xc292('0x62')][_0xc292('0x23')]('\x20')[_0xc292('0x5c')]>0x1){_0xb1d3dd[_0x136992]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5b8191[_0xc292('0x62')]),null);}else{var _0x28a798='%'+_0x5b8191['value']+'%';_0xb1d3dd[_0x136992](_0xc292('0x63'),_0x28a798,_0x28a798,_0x28a798);}}else{_0x9b4bff=_[_0xc292('0x5d')](_0x2f6df7,[_0xc292('0x1f'),_0xc292('0x64')]);_0x5b8191[_0xc292('0x46')]=_0xc292('0x64');_0x16d4b4=as[_0xc292('0x65')](_0x490a78,_0x9b4bff[_0xc292('0x39')],_0x5b8191);_0xb1d3dd[_0x136992](_0x16d4b4[_0xc292('0x66')],_0x16d4b4['value'][_0xc292('0x67')],_0x16d4b4[_0xc292('0x62')][_0xc292('0x15')]);}break;case _0xc292('0x68'):var _0xf39dad=_0x5b8191[_0xc292('0x62')]['split'](',')['map'](function(_0xcdcf5b){return Number(_0xcdcf5b);});_0xf39dad[_0xc292('0x24')](function(_0x517445){_0x71b80d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x517445+',%');});_0x5ea370=_[_0xc292('0x69')](_0x5ea370,_0xf39dad);break;case _0xc292('0x6a'):if(_0x5b8191['operator']===_0xc292('0x61')){_0xb1d3dd[_0x136992](_0xc292('0x6b'),'%'+_0x5b8191[_0xc292('0x62')]+'%',null);}else{_0x9b4bff=_[_0xc292('0x5d')](_0x2f6df7,[_0xc292('0x1f'),_0xc292('0x33')]);_0x5b8191[_0xc292('0x46')]=_0xc292('0x33');_0x16d4b4=as['buildExpression'](_0x490a78,_0x9b4bff[_0xc292('0x39')],_0x5b8191);_0xb1d3dd[_0x136992](_0x16d4b4[_0xc292('0x66')],_0x16d4b4[_0xc292('0x62')][_0xc292('0x67')],_0x16d4b4[_0xc292('0x62')][_0xc292('0x15')]);}break;case _0xc292('0x2b'):_0x16d4b4=as[_0xc292('0x65')]('me',null,_0x5b8191);_0xb1d3dd[_0x136992](_0x16d4b4['text'],_0x16d4b4['value'][_0xc292('0x67')],_0x16d4b4[_0xc292('0x62')][_0xc292('0x15')]);break;}}else{var _0x16d4b4=as['buildExpression'](_0x490a78,_0x9b4bff[_0xc292('0x39')],_0x5b8191);_0xb1d3dd[_0x136992](_0x16d4b4[_0xc292('0x66')],_0x16d4b4[_0xc292('0x62')][_0xc292('0x67')],_0x16d4b4[_0xc292('0x62')]['end']);}}}else{var _0x8a8678=_(_0x284a06[_0xc292('0x3c')])[_0xc292('0x3d')]()[_0xc292('0x36')](function(_0x31a1a9){return _[_0xc292('0x6c')](_0x2f6df7,[_0xc292('0x1f'),_0x31a1a9])?_0x31a1a9:undefined;})['compact']()[_0xc292('0x62')]();if(!_[_0xc292('0x6d')](_0x8a8678)){_0x8a8678[_0xc292('0x24')](function(_0x578ebe){if(_0x578ebe===_0xc292('0x6e')){_0x411e43[_0xc292('0x43')](_0xc292('0x6f'),[]['concat'](_0x284a06['query'][_0x578ebe]));}else if(_0x578ebe===_0xc292('0x70')){var _0x38c1fe=JSON[_0xc292('0x71')](_0x284a06[_0xc292('0x3c')][_0x578ebe])[_0xc292('0x72')];var _0x1d777a=JSON['parse'](_0x284a06[_0xc292('0x3c')][_0x578ebe])[_0xc292('0x73')];_0x411e43['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x38c1fe,_0x1d777a);}else{if(_0x284a06[_0xc292('0x3c')][_0x578ebe]===_0xc292('0x74')){_0x411e43['where']('i.'+_0x578ebe+'\x20IS\x20NULL');}else{_0x411e43[_0xc292('0x43')]('i.'+_0x578ebe+'\x20=\x20?',_0x284a06[_0xc292('0x3c')][_0x578ebe]);}}});}if(_0x284a06[_0xc292('0x3c')][_0xc292('0x75')]){if(_0x284a06[_0xc292('0x3c')][_0xc292('0x75')]==0x1){_0x411e43['having']('`unreadMessages`\x20=\x200');}else{_0x411e43[_0xc292('0x5e')](_0xc292('0x76'));}}if(_0x284a06[_0xc292('0x3c')][_0xc292('0x77')]){_0x5ea370=_['isArray'](_0x284a06['query']['tag'])?_0x284a06[_0xc292('0x3c')][_0xc292('0x77')]:new Array(_0x284a06[_0xc292('0x3c')]['tag']);_0x5ea370[_0xc292('0x24')](function(_0x2ce5e0){_0x71b80d['or'](_0xc292('0x78'),'%,'+_0x2ce5e0+',%');});}if(_0x284a06[_0xc292('0x3c')][_0xc292('0x79')]){var _0x55d1f8=_0x284a06[_0xc292('0x3c')][_0xc292('0x79')]['replace']('\x5c','\x5c\x5c')[_0xc292('0x7a')](/'/g,'\x27\x27');if(qs[_0xc292('0x7b')](_0x55d1f8)){_0xb1d3dd['or'](_0xc292('0x7c'),_0x55d1f8+'%');}else if(qs[_0xc292('0x7d')](_0x55d1f8)){_0xb1d3dd['or'](_0xc292('0x7e'),_0x55d1f8+'%');}else{_0xb1d3dd['or'](_0xc292('0x7f'),qs[_0xc292('0x80')](_0x55d1f8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc292('0x80')](_0x55d1f8));}}}_0x411e43[_0xc292('0x43')](_0xb1d3dd);_0x411e43[_0xc292('0x81')](_0xc292('0x82'));var _0xfbde9f={'type':db[_0xc292('0x83')][_0xc292('0x84')][_0xc292('0x85')],'raw':!![]};var _0x2bad70=_0x411e43[_0xc292('0x86')]();_0x2bad70[_0xc292('0x46')](_0xc292('0x82'));_0x2bad70[_0xc292('0x46')](_0xc292('0x87'),_0xc292('0x88'));if(_0x2c95fa['order']){_0x2c95fa[_0xc292('0x89')]['forEach'](function(_0xa0b68a){var _0x4e931c=_0xa0b68a[0x0]==='contactName'?_0xa0b68a[0x0]:'i.'+_0xa0b68a[0x0];_0x411e43['order'](_0x4e931c,_0xa0b68a[0x1]===_0xc292('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x5ea370)){_0x411e43[_0xc292('0x5e')](_0x71b80d);_0x2bad70['where'](_0xc292('0x8b'),_0x5ea370);}BPromise['resolve']()[_0xc292('0x1c')](function(){if(!_0x184711){if(_0x284a06[_0xc292('0x3c')]['MailAccountId'])return;_0x2bad70[_0xc292('0x43')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x411e43[_0xc292('0x43')](_0xc292('0x8c'));return;}if(_0x284a06[_0xc292('0x8d')]['role']!==_0xc292('0x8e'))return;return _0x284a06[_0xc292('0x8d')][_0xc292('0x8f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x39d9a5){if(_[_0xc292('0x6d')](_0x39d9a5)){_0x2bad70[_0xc292('0x43')](_0xc292('0x90'));_0x411e43['where'](_0xc292('0x90'));}else{_0x2bad70[_0xc292('0x43')](_0xc292('0x6f'),_['map'](_0x39d9a5,'id'));_0x411e43[_0xc292('0x43')](_0xc292('0x6f'),_[_0xc292('0x36')](_0x39d9a5,'id'));}});})[_0xc292('0x1c')](function(){if(_0x284a06[_0xc292('0x8d')][_0xc292('0x91')]===_0xc292('0x8e')&&!_0x184711&&!_0x284a06[_0xc292('0x3c')][_0xc292('0x6e')])return[];return db[_0xc292('0x92')][_0xc292('0x3c')](_0x2bad70['toString'](),_0xfbde9f);})[_0xc292('0x1c')](function(_0x298a21){_0x4f4fb5[_0xc292('0x1a')]=_0x298a21[_0xc292('0x5c')];if(_0x4f4fb5[_0xc292('0x1a')]===0x0)return[];return db['sequelize'][_0xc292('0x3c')](_0x47710f[_0xc292('0x93')](),_0xfbde9f)[_0xc292('0x1c')](function(_0x390b11){_0x55bd05=_[_0xc292('0x94')](_0x390b11,'id');_0xfbde9f=_[_0xc292('0x95')](_0xfbde9f,{'model':db[_0xc292('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x284a06[_0xc292('0x3c')][_0xc292('0x41')]){_0x2c95fa['attributes']['forEach'](function(_0x9b2b4){_0x411e43[_0xc292('0x46')]('i.'+_0x9b2b4);});}else{_0x411e43[_0xc292('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc292('0x88'));_0x411e43[_0xc292('0x46')](_0xc292('0x97'),'Account.key');_0x411e43['field'](_0xc292('0x98'),'Account.mandatoryDisposition');_0x411e43['field'](_0xc292('0x99'),_0xc292('0x9a'));_0x411e43[_0xc292('0x46')]('i.id');_0x411e43[_0xc292('0x46')](_0xc292('0x9b'));_0x411e43[_0xc292('0x46')](_0xc292('0x9c'));_0x411e43[_0xc292('0x46')](_0xc292('0x9d'));_0x411e43[_0xc292('0x46')]('i.closedAt');_0x411e43[_0xc292('0x46')]('i.attach');_0x411e43[_0xc292('0x46')](_0xc292('0x9e'));_0x411e43[_0xc292('0x46')](_0xc292('0x9f'));_0x411e43[_0xc292('0x46')](_0xc292('0xa0'));_0x411e43['field'](_0xc292('0xa1'));_0x411e43['field']('i.secondDisposition');_0x411e43[_0xc292('0x46')](_0xc292('0xa2'));_0x411e43[_0xc292('0x46')]('i.substatus');_0x411e43[_0xc292('0x46')](_0xc292('0xa3'));_0x411e43['field'](_0xc292('0xa4'));_0x411e43['field'](_0xc292('0xa5'));_0x411e43[_0xc292('0x46')](_0xc292('0xa6'));_0x411e43['field']('c.firstName','Contact.firstName');_0x411e43['field'](_0xc292('0xa7'),'Contact.lastName');_0x411e43[_0xc292('0x46')](_0xc292('0xa8'),'Contact.email');_0x411e43[_0xc292('0x46')]('c.phone',_0xc292('0xa9'));_0x411e43[_0xc292('0x46')]('c.mobile',_0xc292('0xaa'));_0x411e43[_0xc292('0x46')](_0xc292('0xab'),'Contact.fax');_0x411e43[_0xc292('0x46')](_0xc292('0xac'),_0xc292('0xad'));_0x411e43[_0xc292('0x46')](_0xc292('0xae'),'Owner.internal');_0x411e43[_0xc292('0x46')](_0xc292('0xaf'),_0xc292('0x26'));}if(_0x2c95fa[_0xc292('0x18')])_0x411e43['limit'](_0x2c95fa[_0xc292('0x18')]);if(_0x2c95fa[_0xc292('0x19')])_0x411e43[_0xc292('0x19')](_0x2c95fa[_0xc292('0x19')]);return db[_0xc292('0x92')][_0xc292('0x3c')](_0x411e43[_0xc292('0x93')](),_0xfbde9f);})[_0xc292('0x1c')](function(_0x403331){if(_0x403331[_0xc292('0x5c')]>0x0)_0x541219[_0xc292('0x43')](_0xc292('0xb0'),_['map'](_0x403331,'id'));return db['sequelize'][_0xc292('0x3c')](_0x541219[_0xc292('0x93')](),_0xfbde9f)[_0xc292('0x1c')](function(_0x2e2d93){var _0x4be69a=_[_0xc292('0xb1')](_0x2e2d93,_0xc292('0xb2'));var _0x11bc4b=[];return db[_0xc292('0xb3')][_0xc292('0x28')]({'attributes':[_0xc292('0xb4')],'raw':!![]})[_0xc292('0x1c')](function(_0x5bb838){var _0x262ac1=_0x5bb838[_0xc292('0xb4')];_0x403331[_0xc292('0x24')](function(_0x39867d){_0x11bc4b['push'](updateMailInteraction(_0x39867d,_0x55bd05,_0x4be69a,_0x262ac1));});return BPromise[_0xc292('0xb5')](_0x11bc4b);});});});})[_0xc292('0x1c')](function(_0x66cbd7){_0x4f4fb5[_0xc292('0xb6')]=_0x66cbd7;return _0x4f4fb5;})['then'](respondWithFilteredResult(_0x5a2e4c,_0x2c95fa))[_0xc292('0x2d')](handleError(_0x5a2e4c,null));};exports[_0xc292('0xb7')]=function(_0xc76ff8,_0x13a82c){var _0x4d3763={'raw':![],'where':{'id':_0xc76ff8[_0xc292('0xb8')]['id']}},_0x576722={};_0x576722[_0xc292('0x3b')]=_[_0xc292('0x3d')](db['MailInteraction'][_0xc292('0x37')]);_0x576722[_0xc292('0x3c')]=_[_0xc292('0x3d')](_0xc76ff8['query']);_0x576722[_0xc292('0x3e')]=_[_0xc292('0x40')](_0x576722[_0xc292('0x3b')],_0x576722['query']);_0x4d3763[_0xc292('0x3f')]=_['intersection'](_0x576722[_0xc292('0x3b')],qs[_0xc292('0x41')](_0xc76ff8[_0xc292('0x3c')]['fields']));_0x4d3763[_0xc292('0x3f')]=_0x4d3763[_0xc292('0x3f')]['length']?_0x4d3763[_0xc292('0x3f')]:_0x576722[_0xc292('0x3b')];if(_0xc76ff8[_0xc292('0x3c')][_0xc292('0xb9')]){_0x4d3763[_0xc292('0xba')]=[{'all':!![]}];}_0x4d3763=_[_0xc292('0x95')]({},_0x4d3763,_0xc76ff8[_0xc292('0xbb')]);return db[_0xc292('0x96')][_0xc292('0x5d')](_0x4d3763)[_0xc292('0x1c')](handleEntityNotFound(_0x13a82c,null))[_0xc292('0x1c')](respondWithResult(_0x13a82c,null))[_0xc292('0x2d')](handleError(_0x13a82c,null));};exports[_0xc292('0xbc')]=function(_0x2a140e,_0x405ada){return db[_0xc292('0x96')][_0xc292('0xbc')](_0x2a140e[_0xc292('0xbd')],{})[_0xc292('0x1c')](respondWithResult(_0x405ada,0xc9))[_0xc292('0x2d')](handleError(_0x405ada,null));};exports[_0xc292('0x1b')]=function(_0x3010a0,_0x5b1cc4){if(_0x3010a0[_0xc292('0xbd')]['id']){delete _0x3010a0[_0xc292('0xbd')]['id'];}return db['MailInteraction'][_0xc292('0x5d')]({'where':{'id':_0x3010a0[_0xc292('0xb8')]['id']}})['then'](handleEntityNotFound(_0x5b1cc4,null))['then'](saveUpdates(_0x3010a0['body'],null))[_0xc292('0x1c')](respondWithResult(_0x5b1cc4,null))[_0xc292('0x2d')](handleError(_0x5b1cc4,null));};exports[_0xc292('0x1d')]=function(_0x2f3db2,_0x128d84){return db[_0xc292('0x96')][_0xc292('0x5d')]({'where':{'id':_0x2f3db2[_0xc292('0xb8')]['id']}})[_0xc292('0x1c')](handleEntityNotFound(_0x128d84,null))[_0xc292('0x1c')](removeEntity(_0x128d84,null))[_0xc292('0x2d')](handleError(_0x128d84,null));};exports[_0xc292('0xbe')]=function(_0x57f663,_0x3794e6){return db[_0xc292('0x96')][_0xc292('0xbe')]()[_0xc292('0x1c')](respondWithResult(_0x3794e6,null))[_0xc292('0x2d')](handleError(_0x3794e6,null));};exports[_0xc292('0xbf')]=function(_0x743cd7,_0xa808bd){return db[_0xc292('0x27')][_0xc292('0x5d')]({'where':{'id':_0x743cd7['params']['id']}})[_0xc292('0x1c')](handleEntityNotFound(_0xa808bd,null))[_0xc292('0x1c')](function(_0xda293e){if(_0xda293e){return _0xda293e[_0xc292('0xbf')](_0x743cd7[_0xc292('0xbd')][_0xc292('0xc0')],_[_0xc292('0xc1')](_0x743cd7[_0xc292('0xbd')],[_0xc292('0xc0'),'id'])||{});}})[_0xc292('0x1c')](respondWithResult(_0xa808bd,null))['catch'](handleError(_0xa808bd,null));};exports['getMessages']=function(_0x261ed9,_0x5deb75){var _0x38ee46={'raw':![],'where':{}};var _0x3861a4={};var _0x4f05af={'count':0x0,'rows':[]};return db[_0xc292('0x96')][_0xc292('0x28')]({'where':{'id':_0x261ed9['params']['id']}})['then'](handleEntityNotFound(_0x5deb75,null))[_0xc292('0x1c')](function(_0x3ff589){if(_0x3ff589){_0x3861a4[_0xc292('0x3b')]=_[_0xc292('0x3d')](db['MailMessage']['rawAttributes']);_0x3861a4[_0xc292('0x3c')]=_[_0xc292('0x3d')](_0x261ed9['query']);_0x3861a4[_0xc292('0x3e')]=_['intersection'](_0x3861a4[_0xc292('0x3b')],_0x3861a4[_0xc292('0x3c')]);_0x38ee46[_0xc292('0x3f')]=_['intersection'](_0x3861a4[_0xc292('0x3b')],qs[_0xc292('0x41')](_0x261ed9[_0xc292('0x3c')][_0xc292('0x41')]));_0x38ee46[_0xc292('0x3f')]=_0x38ee46['attributes'][_0xc292('0x5c')]?_0x38ee46[_0xc292('0x3f')]:_0x3861a4[_0xc292('0x3b')];if(!_0x261ed9['query']['hasOwnProperty']('nolimit')){_0x38ee46[_0xc292('0x18')]=qs['limit'](_0x261ed9[_0xc292('0x3c')][_0xc292('0x18')]);_0x38ee46[_0xc292('0x19')]=qs[_0xc292('0x19')](_0x261ed9[_0xc292('0x3c')]['offset']);}_0x38ee46['order']=qs['sort'](_0x261ed9[_0xc292('0x3c')][_0xc292('0x42')]);_0x38ee46[_0xc292('0x43')]=qs[_0xc292('0x3e')](_['pick'](_0x261ed9[_0xc292('0x3c')],_0x3861a4['filters']));_0x38ee46[_0xc292('0x43')]['MailInteractionId']=_0x3ff589['id'];if(_0x261ed9[_0xc292('0x3c')][_0xc292('0x79')]){_0x38ee46[_0xc292('0x43')]=_[_0xc292('0x95')](_0x38ee46[_0xc292('0x43')],{'$or':_['map'](_0x38ee46[_0xc292('0x3f')],function(_0x360ef4){var _0x4748b6={};_0x4748b6[_0x360ef4]={'$like':'%'+_0x261ed9[_0xc292('0x3c')]['filter']+'%'};return _0x4748b6;})});}if(_0x261ed9[_0xc292('0x3c')][_0xc292('0x72')]){var _0x4835e1=_0x261ed9[_0xc292('0x3c')][_0xc292('0x72')]['split'](',');var _0x145a2f={};_0x145a2f[_0x4835e1[0x0]]={'$gte':moment(_0x4835e1[0x1])[_0xc292('0xc2')](_0xc292('0xc3'))};_0x38ee46[_0xc292('0x43')]=_[_0xc292('0x95')](_0x38ee46[_0xc292('0x43')],_0x145a2f);}_0x38ee46=_[_0xc292('0x95')]({},_0x38ee46,_0x261ed9[_0xc292('0xbb')]);return db[_0xc292('0x27')][_0xc292('0x1a')]({'where':_0x38ee46['where']})[_0xc292('0x1c')](function(_0x52f6f3){_0x4f05af[_0xc292('0x1a')]=_0x52f6f3;if(_0x261ed9[_0xc292('0x3c')][_0xc292('0xb9')]){_0x38ee46['include']=[{'all':!![]}];}return db[_0xc292('0x27')]['findAll'](_0x38ee46);})[_0xc292('0x1c')](function(_0x3c2588){if(_0x261ed9[_0xc292('0x3c')]['inlineCss']===_0xc292('0xc4')){for(var _0x278ff3=0x0;_0x278ff3<_0x3c2588['length'];_0x278ff3++){_0x3c2588[_0x278ff3][_0xc292('0xbd')]=juice(_0x3c2588[_0x278ff3][_0xc292('0xbd')]);}}_0x4f05af['rows']=_0x3c2588;return _0x4f05af;});}})['then'](respondWithFilteredResult(_0x5deb75,_0x38ee46))[_0xc292('0x2d')](handleError(_0x5deb75,null));};exports['addTags']=function(_0x128a5d,_0x126467){return db[_0xc292('0x96')][_0xc292('0x5d')]({'where':{'id':_0x128a5d[_0xc292('0xb8')]['id']}})['then'](handleEntityNotFound(_0x126467,null))['then'](function(_0x415fb4){if(_0x415fb4){return _0x415fb4['setTags'](_0x128a5d['body'][_0xc292('0xc0')],_['omit'](_0x128a5d[_0xc292('0xbd')],['ids','id'])||{})[_0xc292('0xc5')](function(){return db[_0xc292('0x68')][_0xc292('0xc6')]({'attributes':['id','name','color'],'where':{'id':_0x128a5d[_0xc292('0xbd')]['ids']}});})[_0xc292('0x1c')](function(_0x3a1976){socket['emit']('mailInteractionTags:save',{'id':Number(_0x128a5d[_0xc292('0xb8')]['id']),'tags':_0x3a1976||[]});return{'id':Number(_0x128a5d[_0xc292('0xb8')]['id']),'tags':_0x3a1976||[]};});}})['then'](respondWithResult(_0x126467,null))[_0xc292('0x2d')](handleError(_0x126467,null));};exports['removeTags']=function(_0x5f07b4,_0x5626aa){return db[_0xc292('0x96')][_0xc292('0x5d')]({'where':{'id':_0x5f07b4['params']['id']}})[_0xc292('0x1c')](handleEntityNotFound(_0x5626aa,null))['then'](function(_0x5d3ef3){if(_0x5d3ef3){return _0x5d3ef3[_0xc292('0xc7')](_0x5f07b4['query'][_0xc292('0xc0')]);}})[_0xc292('0x1c')](respondWithStatusCode(_0x5626aa,null))[_0xc292('0x2d')](handleError(_0x5626aa,null));};exports[_0xc292('0xc8')]=function(_0x296591,_0x2ae0ad){var _0xcd439f=moment()[_0xc292('0xc9')]()['toString']();var _0x54bf37=path[_0xc292('0xca')](config['root'],_0xc292('0xcb'),_0xc292('0xcc'),'tmp');var _0x2d73c7=path[_0xc292('0xca')](config[_0xc292('0xcd')],'server',_0xc292('0xcc'),_0xc292('0xce'));var _0x452408=path[_0xc292('0xca')](_0x54bf37,_0xcd439f);var _0x599cd5=util[_0xc292('0xc2')](_0xc292('0xcf'),_0x296591['params']['id'],_0xcd439f);var _0x3fb064=path[_0xc292('0xca')](_0x54bf37,_0x599cd5);var _0x3ec2b6=[];if(_0x296591[_0xc292('0x3c')][_0xc292('0xce')]){_0x3ec2b6[_0xc292('0x25')]({'model':db[_0xc292('0xd0')],'as':_0xc292('0xd1'),'raw':!![]});}var _0x44ceb6=[{'model':db[_0xc292('0x27')],'as':_0xc292('0xd2'),'attributes':['id','body',_0xc292('0x48'),'to','cc',_0xc292('0xd3'),'subject',_0xc292('0x70')],'where':{'secret':![]},'order':qs[_0xc292('0x42')]('id'),'include':_0x3ec2b6}];return db['MailInteraction']['find']({'where':{'id':_0x296591[_0xc292('0xb8')]['id']},'include':_0x44ceb6})[_0xc292('0x1c')](handleEntityNotFound(_0x2ae0ad,null))[_0xc292('0x1c')](function(_0x494e44){if(_0x494e44&&_0x494e44[_0xc292('0xd2')]){var _0x311499=_0x494e44[_0xc292('0xd4')]({'plain':!![]});fs[_0xc292('0xd5')](_0x452408);return BPromise['each'](_0x311499[_0xc292('0xd2')],function(_0x5abfaf,_0x5ebaaa){var _0x21c46c={'from':_0x5abfaf[_0xc292('0x48')],'to':_0x5abfaf['to'],'subject':_0x5abfaf[_0xc292('0xd6')],'html':htmlEntities['decode'](_0x5abfaf[_0xc292('0xbd')]),'headers':{'Date':moment(_0x5abfaf[_0xc292('0x70')])['format'](_0xc292('0xd7'))},'attachments':[]};if(_0x5abfaf['cc']){_0x21c46c[_0xc292('0xd8')]['Cc']=_0x5abfaf['cc'];}if(_0x5abfaf[_0xc292('0xd3')]){_0x21c46c[_0xc292('0xd8')][_0xc292('0xd9')]=_0x5abfaf[_0xc292('0xd3')];}return new BPromise(function(_0x153a55,_0x338379){if(_0x5abfaf[_0xc292('0xd1')]){for(var _0x3729e6=0x0;_0x3729e6<_0x5abfaf[_0xc292('0xd1')][_0xc292('0x5c')];_0x3729e6++){var _0x35f811=_0x5abfaf['Attachments'][_0x3729e6];var _0x2ff34c=path['join'](_0x2d73c7,_0x35f811['basename']);if(fs[_0xc292('0xda')](_0x2ff34c)){_0x21c46c[_0xc292('0xce')][_0xc292('0x25')]({'name':_0x35f811[_0xc292('0x1f')],'contentType':_0x35f811[_0xc292('0x39')],'data':fs[_0xc292('0xdb')](_0x2ff34c)});}}}emlformat['build'](_0x21c46c,function(_0x2e0319,_0x9961f1){if(_0x2e0319)return _0x338379(_0x2e0319);fs['writeFileSync'](path[_0xc292('0xca')](_0x452408,util[_0xc292('0xc2')](_0xc292('0xdc'),_0x5ebaaa)),_0x9961f1);return _0x153a55(_0x9961f1);});});})[_0xc292('0x1c')](function(){return new BPromise(function(_0x101884,_0x4afd03){zipdir(_0x452408,{'saveTo':_0x3fb064},function(_0x1237ce,_0x5bf786){if(_0x1237ce)return _0x4afd03(_0x1237ce);return _0x101884(_0x5bf786);});})[_0xc292('0x1c')](function(){return new BPromise(function(_0x3f18bd,_0x3601bc){rimraf(_0x452408,function(_0x26f0bb){if(_0x26f0bb)_0x3601bc(_0x26f0bb);return _0x3f18bd();});});})[_0xc292('0x1c')](function(){return _0x2ae0ad[_0xc292('0xc8')](_0x3fb064,_0x599cd5,function(_0x542175){if(!_0x542175)fs[_0xc292('0xdd')](_0x3fb064);});});});}else{return _0x2ae0ad['sendStatus'](0xc8);}})[_0xc292('0x2d')](handleError(_0x2ae0ad,null));}; \ No newline at end of file +var _0xe574=['attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','createdAt','get','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','writeFileSync','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','stack','name','send','Users','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','plainBody','-id','trimStart','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','map','MailInteraction','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','length','find','value','having','`\x20>\x200','Contact','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','compact','isEmpty','MailAccountId','where','concat','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','all','rows','show','params','options','create','body','describe','addMessage','ids','getMessages','MailInteractionId','format','inlineCss','true','addTags','setTags','omit','Tag','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp'];(function(_0x570af6,_0x2cc5b9){var _0x222bd6=function(_0x25ad3e){while(--_0x25ad3e){_0x570af6['push'](_0x570af6['shift']());}};_0x222bd6(++_0x2cc5b9);}(_0xe574,0x100));var _0x4e57=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe574[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x4e57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e57('0x1'));var moment=require(_0x4e57('0x2'));var BPromise=require(_0x4e57('0x3'));var util=require(_0x4e57('0x4'));var path=require(_0x4e57('0x5'));var fs=require('fs');var _=require(_0x4e57('0x6'));var squel=require(_0x4e57('0x7'));var juice=require(_0x4e57('0x8'));var Redis=require(_0x4e57('0x9'));var qs=require(_0x4e57('0xa'));var as=require(_0x4e57('0xb'));var logger=require(_0x4e57('0xc'))('api');var config=require('../../config/environment');var db=require(_0x4e57('0xd'))['db'];var htmlEntities=require('html-entities');config['redis']=_[_0x4e57('0xe')](config[_0x4e57('0xf')],{'host':_0x4e57('0x10'),'port':0x18eb});var socket=require(_0x4e57('0x11'))(new Redis(config[_0x4e57('0xf')]));require('./mailInteraction.socket')[_0x4e57('0x12')](socket);function respondWithStatusCode(_0x2dbdd5,_0x3393ce){_0x3393ce=_0x3393ce||0xcc;return function(_0x1e9cf8){if(_0x1e9cf8){return _0x2dbdd5[_0x4e57('0x13')](_0x3393ce);}return _0x2dbdd5[_0x4e57('0x14')](_0x3393ce)[_0x4e57('0x15')]();};}function respondWithResult(_0x21db21,_0xed8cbc){_0xed8cbc=_0xed8cbc||0xc8;return function(_0x40c8c8){if(_0x40c8c8){return _0x21db21[_0x4e57('0x14')](_0xed8cbc)[_0x4e57('0x16')](_0x40c8c8);}};}function respondWithFilteredResult(_0x1e3361,_0x1c1e8b){return function(_0x28f876){if(_0x28f876){var _0x2e9fa8=typeof _0x1c1e8b['offset']===_0x4e57('0x17')&&typeof _0x1c1e8b['limit']===_0x4e57('0x17');var _0x4af0a6=_0x28f876[_0x4e57('0x18')];var _0x214957=_0x2e9fa8?0x0:_0x1c1e8b['offset'];var _0x295d5f=_0x2e9fa8?_0x28f876[_0x4e57('0x18')]:_0x1c1e8b[_0x4e57('0x19')]+_0x1c1e8b[_0x4e57('0x1a')];var _0x5377cf;if(_0x295d5f>=_0x4af0a6){_0x295d5f=_0x4af0a6;_0x5377cf=0xc8;}else{_0x5377cf=0xce;}_0x1e3361[_0x4e57('0x14')](_0x5377cf);return _0x1e3361[_0x4e57('0x1b')](_0x4e57('0x1c'),_0x214957+'-'+_0x295d5f+'/'+_0x4af0a6)[_0x4e57('0x16')](_0x28f876);}return null;};}function saveUpdates(_0x1acce1){return function(_0x5b8760){if(_0x5b8760){return _0x5b8760[_0x4e57('0x1d')](_0x1acce1)[_0x4e57('0x1e')](function(_0x7cf030){return _0x7cf030;});}return null;};}function removeEntity(_0x43e77f){return function(_0x49c9cc){if(_0x49c9cc){return _0x49c9cc[_0x4e57('0x1f')]()['then'](function(){_0x43e77f[_0x4e57('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4586b3){return function(_0x4251e6){if(!_0x4251e6){_0x4586b3[_0x4e57('0x13')](0x194);}return _0x4251e6;};}function handleError(_0x43c9a7,_0x45f9cd){_0x45f9cd=_0x45f9cd||0x1f4;return function(_0x595bba){logger['error'](_0x595bba[_0x4e57('0x20')]);if(_0x595bba['name']){delete _0x595bba[_0x4e57('0x21')];}_0x43c9a7['status'](_0x45f9cd)[_0x4e57('0x22')](_0x595bba);};}function getInteractionUsers(_0x352051,_0x38bcaa){return new BPromise(function(_0x2477f8,_0x29df93){try{if(_0x38bcaa[_0x352051['id']]){_0x352051[_0x4e57('0x23')]=_['map'](_0x38bcaa[_0x352051['id']],function(_0x417105){return{'id':_0x417105['id'],'fullname':_0x417105[_0x4e57('0x24')]};});}}catch(_0x503eaa){_0x29df93(_0x503eaa);}_0x2477f8(_0x352051);});}function getInteractionTags(_0x36b415,_0x3001b7){return new BPromise(function(_0x24b9b5,_0x2ccc1f){try{if(_0x36b415[_0x4e57('0x25')]){_0x36b415[_0x4e57('0x26')]=[];_0x36b415[_0x4e57('0x25')]['split'](',')[_0x4e57('0x27')](function(_0x431794){_0x36b415[_0x4e57('0x26')][_0x4e57('0x28')](_0x3001b7[_0x431794]);});}delete _0x36b415[_0x4e57('0x25')];}catch(_0x5d55b9){_0x2ccc1f(_0x5d55b9);}_0x24b9b5(_0x36b415);});}function getLastMessageText(_0x56238e){return new BPromise(function(_0x1735ba,_0x59dd4e){return db[_0x4e57('0x29')][_0x4e57('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x56238e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4e57('0x2b')],'order':_0x4e57('0x2c'),'raw':!![]})[_0x4e57('0x1e')](function(_0x2540f7){if(_0x2540f7&&_0x2540f7[_0x4e57('0x2b')]){_0x56238e['lastMsgText']=_[_0x4e57('0x2d')](_0x2540f7[_0x4e57('0x2b')]);}_0x1735ba(_0x56238e);})['catch'](function(_0x149397){_0x59dd4e(_0x149397);});});}function updateMailInteraction(_0x486f33,_0x4d5817,_0x2e8916,_0x431c23){return new BPromise(function(_0x248ce2,_0x53d39b){return getInteractionUsers(_0x486f33,_0x2e8916)[_0x4e57('0x1e')](function(_0x581db8){return getInteractionTags(_0x581db8,_0x4d5817);})[_0x4e57('0x1e')](function(_0x1b2042){return getStateInteraction(_0x1b2042);})[_0x4e57('0x1e')](function(_0x5a3da5){if(_0x431c23){_0x248ce2(getLastMessageText(_0x5a3da5));}else{_0x248ce2(_0x5a3da5);}})[_0x4e57('0x2e')](function(_0x165df9){_0x53d39b(_0x165df9);});});}function getStateInteraction(_0x2773ee){return new BPromise(function(_0x407c94){_0x2773ee[_0x4e57('0x2f')]=0x0;_0x2773ee[_0x4e57('0x30')]=0x0;_0x2773ee[_0x4e57('0x31')]=0x0;_0x2773ee[_0x4e57('0x32')]=0x0;_0x2773ee[_0x4e57('0x33')]=0x0;if(!_0x2773ee[_0x4e57('0x34')]&&!_0x2773ee[_0x4e57('0x35')]){_0x2773ee['waiting']+=0x1;}if(!_0x2773ee[_0x4e57('0x34')]&&_0x2773ee['UserId']){_0x2773ee[_0x4e57('0x30')]+=0x1;if(_0x2773ee[_0x4e57('0x2f')]){_0x2773ee[_0x4e57('0x2f')]-=0x1;}}if(_0x2773ee[_0x4e57('0x34')]&&_0x2773ee['UserId']){_0x2773ee['answered']+=0x1;if(_0x2773ee[_0x4e57('0x30')]){_0x2773ee[_0x4e57('0x30')]-=0x1;}}if(_0x2773ee[_0x4e57('0x34')]&&!_0x2773ee[_0x4e57('0x35')]){_0x2773ee[_0x4e57('0x32')]+=0x1;if(_0x2773ee[_0x4e57('0x2f')]){_0x2773ee[_0x4e57('0x2f')]-=0x1;}}_0x2773ee[_0x4e57('0x33')]+=0x1;_0x407c94(_0x2773ee);});}exports[_0x4e57('0x36')]=function(_0x4ac448,_0x4231eb){var _0x5af6fc={},_0x118f50={},_0x1c976a={'count':0x0,'rows':[]};var _0x526ea6=_[_0x4e57('0x37')](db[_0x4e57('0x38')][_0x4e57('0x39')],function(_0x1a043e){return{'name':_0x1a043e[_0x4e57('0x3a')],'type':_0x1a043e[_0x4e57('0x3b')][_0x4e57('0x3c')]};});_0x118f50['model']=_[_0x4e57('0x37')](_0x526ea6,_0x4e57('0x21'));_0x118f50['query']=_[_0x4e57('0x3d')](_0x4ac448[_0x4e57('0x3e')]);_0x118f50[_0x4e57('0x3f')]=_[_0x4e57('0x40')](_0x118f50[_0x4e57('0x41')],_0x118f50[_0x4e57('0x3e')]);_0x5af6fc['attributes']=_[_0x4e57('0x40')](_0x118f50[_0x4e57('0x41')],qs[_0x4e57('0x42')](_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x42')]));_0x5af6fc[_0x4e57('0x43')]=_0x5af6fc[_0x4e57('0x43')]['length']?_0x5af6fc[_0x4e57('0x43')]:_0x118f50[_0x4e57('0x41')];if(!_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x44')](_0x4e57('0x45'))){_0x5af6fc['limit']=qs[_0x4e57('0x1a')](_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x1a')]);_0x5af6fc[_0x4e57('0x19')]=qs[_0x4e57('0x19')](_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x19')]);}_0x5af6fc[_0x4e57('0x46')]=qs[_0x4e57('0x47')](_0x4ac448[_0x4e57('0x3e')]['sort']);_0x5af6fc['where']=qs['filters'](_[_0x4e57('0x48')](_0x4ac448[_0x4e57('0x3e')],_0x118f50[_0x4e57('0x3f')]),_0x526ea6);var _0x206618=[];var _0x3f2029=squel[_0x4e57('0x49')]()[_0x4e57('0x4a')]('id')[_0x4e57('0x4a')](_0x4e57('0x21'))[_0x4e57('0x4a')](_0x4e57('0x4b'))[_0x4e57('0x4c')](_0x4e57('0x4d'));var _0x4954a3=squel[_0x4e57('0x49')]()[_0x4e57('0x4a')](_0x4e57('0x4e'))[_0x4e57('0x4a')](_0x4e57('0x4f'))[_0x4e57('0x4a')]('ui.MailInteractionId')[_0x4e57('0x4c')](_0x4e57('0x50'),'ui')[_0x4e57('0x51')](_0x4e57('0x52'),'u',_0x4e57('0x53'));var _0x3bacfb=squel[_0x4e57('0x49')]()[_0x4e57('0x4c')]('mail_interactions','i')[_0x4e57('0x51')]('cm_contacts','c',_0x4e57('0x54'))[_0x4e57('0x51')](_0x4e57('0x52'),'o','o.id\x20=\x20i.UserId')[_0x4e57('0x51')]('mail_accounts','a',_0x4e57('0x55'))[_0x4e57('0x51')](_0x4e57('0x56'),'me',_0x4e57('0x57'))[_0x4e57('0x51')](_0x4e57('0x58'),'it',_0x4e57('0x59'))['left_join']('tools_tags','t',_0x4e57('0x5a'));var _0x2e6a8f=squel[_0x4e57('0x5b')]();var _0x487bd7=[];var _0x4738fa=squel[_0x4e57('0x5b')]();var _0x1a54a2;if(_0x4ac448[_0x4e57('0x3e')]['search']){_0x1a54a2=as[_0x4e57('0x5c')](_0x4ac448['query']['search']);var _0xc1c632=_0x1a54a2[_0x4e57('0x5d')];for(var _0x36a84a=0x0;_0x36a84a<_0x1a54a2[_0x4e57('0x5e')][_0x4e57('0x5f')];_0x36a84a++){var _0x30588c=_0x1a54a2[_0x4e57('0x5e')][_0x36a84a];var _0x1c0e45='i';var _0x279383=_[_0x4e57('0x60')](_0x526ea6,[_0x4e57('0x21'),_0x30588c[_0x4e57('0x4a')]]);if(!_0x279383){switch(_0x30588c[_0x4e57('0x4a')]){case'unreadMessages':if(_0x30588c[_0x4e57('0x61')]==0x1){_0x3bacfb[_0x4e57('0x62')]('`'+_0x30588c[_0x4e57('0x4a')]+'`\x20=\x200');}else{_0x3bacfb[_0x4e57('0x62')]('`'+_0x30588c[_0x4e57('0x4a')]+_0x4e57('0x63'));}break;case _0x4e57('0x64'):if(_0x30588c[_0x4e57('0x65')]===_0x4e57('0x66')){if(_0x30588c[_0x4e57('0x61')][_0x4e57('0x67')]('\x20')[_0x4e57('0x5f')]>0x1){_0x2e6a8f[_0xc1c632]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4e57('0x68')](_0x30588c[_0x4e57('0x61')]),null);}else{var _0x18a28e='%'+_0x30588c[_0x4e57('0x61')]+'%';_0x2e6a8f[_0xc1c632](_0x4e57('0x69'),_0x18a28e,_0x18a28e,_0x18a28e);}}else{_0x279383=_[_0x4e57('0x60')](_0x526ea6,['name',_0x4e57('0x6a')]);_0x30588c[_0x4e57('0x4a')]=_0x4e57('0x6a');_0x56aab9=as[_0x4e57('0x6b')](_0x1c0e45,_0x279383[_0x4e57('0x3b')],_0x30588c);_0x2e6a8f[_0xc1c632](_0x56aab9[_0x4e57('0x6c')],_0x56aab9[_0x4e57('0x61')][_0x4e57('0x6d')],_0x56aab9['value'][_0x4e57('0x15')]);}break;case'Tag':var _0x44b5f6=_0x30588c[_0x4e57('0x61')][_0x4e57('0x67')](',')['map'](function(_0x59f1c2){return Number(_0x59f1c2);});_0x44b5f6[_0x4e57('0x27')](function(_0x5b6422){_0x4738fa['or'](_0x4e57('0x6e'),'%,'+_0x5b6422+',%');});_0x487bd7=_[_0x4e57('0x6f')](_0x487bd7,_0x44b5f6);break;case'User':if(_0x30588c[_0x4e57('0x65')]===_0x4e57('0x66')){_0x2e6a8f[_0xc1c632]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x30588c[_0x4e57('0x61')]+'%',null);}else{_0x279383=_[_0x4e57('0x60')](_0x526ea6,['name',_0x4e57('0x35')]);_0x30588c[_0x4e57('0x4a')]=_0x4e57('0x35');_0x56aab9=as[_0x4e57('0x6b')](_0x1c0e45,_0x279383[_0x4e57('0x3b')],_0x30588c);_0x2e6a8f[_0xc1c632](_0x56aab9[_0x4e57('0x6c')],_0x56aab9['value'][_0x4e57('0x6d')],_0x56aab9['value']['end']);}break;case'plainBody':_0x56aab9=as['buildExpression']('me',null,_0x30588c);_0x2e6a8f[_0xc1c632](_0x56aab9[_0x4e57('0x6c')],_0x56aab9[_0x4e57('0x61')][_0x4e57('0x6d')],_0x56aab9[_0x4e57('0x61')][_0x4e57('0x15')]);break;}}else{var _0x56aab9=as[_0x4e57('0x6b')](_0x1c0e45,_0x279383[_0x4e57('0x3b')],_0x30588c);_0x2e6a8f[_0xc1c632](_0x56aab9[_0x4e57('0x6c')],_0x56aab9[_0x4e57('0x61')][_0x4e57('0x6d')],_0x56aab9['value'][_0x4e57('0x15')]);}}}else{var _0x25b123=_(_0x4ac448[_0x4e57('0x3e')])[_0x4e57('0x3d')]()[_0x4e57('0x37')](function(_0x2a57e6){return _['some'](_0x526ea6,[_0x4e57('0x21'),_0x2a57e6])?_0x2a57e6:undefined;})[_0x4e57('0x70')]()['value']();if(!_[_0x4e57('0x71')](_0x25b123)){_0x25b123[_0x4e57('0x27')](function(_0x3ddaf8){if(_0x3ddaf8===_0x4e57('0x72')){_0x3bacfb[_0x4e57('0x73')]('i.MailAccountId\x20IN\x20?',[][_0x4e57('0x74')](_0x4ac448[_0x4e57('0x3e')][_0x3ddaf8]));}else if(_0x3ddaf8==='createdAt'){var _0x2d5d11=JSON[_0x4e57('0x75')](_0x4ac448[_0x4e57('0x3e')][_0x3ddaf8])[_0x4e57('0x76')];var _0x38e08a=JSON[_0x4e57('0x75')](_0x4ac448[_0x4e57('0x3e')][_0x3ddaf8])[_0x4e57('0x77')];_0x3bacfb[_0x4e57('0x73')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2d5d11,_0x38e08a);}else{if(_0x4ac448[_0x4e57('0x3e')][_0x3ddaf8]===_0x4e57('0x78')){_0x3bacfb[_0x4e57('0x73')]('i.'+_0x3ddaf8+_0x4e57('0x79'));}else{_0x3bacfb[_0x4e57('0x73')]('i.'+_0x3ddaf8+_0x4e57('0x7a'),_0x4ac448['query'][_0x3ddaf8]);}}});}if(_0x4ac448[_0x4e57('0x3e')]['read']){if(_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x7b')]==0x1){_0x3bacfb['having'](_0x4e57('0x7c'));}else{_0x3bacfb['having'](_0x4e57('0x7d'));}}if(_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x7e')]){_0x487bd7=_[_0x4e57('0x7f')](_0x4ac448['query'][_0x4e57('0x7e')])?_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x7e')]:new Array(_0x4ac448[_0x4e57('0x3e')]['tag']);_0x487bd7[_0x4e57('0x27')](function(_0x481f4f){_0x4738fa['or'](_0x4e57('0x6e'),'%,'+_0x481f4f+',%');});}if(_0x4ac448['query'][_0x4e57('0x80')]){var _0x19a8d2=_0x4ac448['query'][_0x4e57('0x80')][_0x4e57('0x81')]('\x5c','\x5c\x5c')[_0x4e57('0x81')](/'/g,'\x27\x27');if(qs[_0x4e57('0x82')](_0x19a8d2)){_0x2e6a8f['or'](_0x4e57('0x83'),_0x19a8d2+'%');}else if(qs['isEmail'](_0x19a8d2)){_0x2e6a8f['or'](_0x4e57('0x84'),_0x19a8d2+'%');}else{_0x2e6a8f['or'](_0x4e57('0x85'),qs[_0x4e57('0x68')](_0x19a8d2))['or'](_0x4e57('0x86'),qs[_0x4e57('0x68')](_0x19a8d2));}}}_0x3bacfb[_0x4e57('0x73')](_0x2e6a8f);_0x3bacfb[_0x4e57('0x87')](_0x4e57('0x88'));var _0x1d03ab={'type':db[_0x4e57('0x89')][_0x4e57('0x8a')][_0x4e57('0x8b')],'raw':!![]};var _0x605bfe=_0x3bacfb[_0x4e57('0x8c')]();_0x605bfe[_0x4e57('0x4a')](_0x4e57('0x88'));_0x605bfe[_0x4e57('0x4a')](_0x4e57('0x8d'),_0x4e57('0x8e'));if(_0x5af6fc[_0x4e57('0x46')]){_0x5af6fc[_0x4e57('0x46')][_0x4e57('0x27')](function(_0x4c48af){var _0x56cc80=_0x4c48af[0x0]===_0x4e57('0x8f')?_0x4c48af[0x0]:'i.'+_0x4c48af[0x0];_0x3bacfb[_0x4e57('0x46')](_0x56cc80,_0x4c48af[0x1]===_0x4e57('0x90')?![]:!![]);});}if(!_[_0x4e57('0x71')](_0x487bd7)){_0x3bacfb[_0x4e57('0x62')](_0x4738fa);_0x605bfe[_0x4e57('0x73')](_0x4e57('0x91'),_0x487bd7);}BPromise[_0x4e57('0x92')]()[_0x4e57('0x1e')](function(){if(!_0x1a54a2){if(_0x4ac448[_0x4e57('0x3e')]['MailAccountId'])return;_0x605bfe['where'](_0x4e57('0x93'));_0x3bacfb[_0x4e57('0x73')](_0x4e57('0x93'));return;}if(_0x4ac448[_0x4e57('0x94')][_0x4e57('0x95')]!==_0x4e57('0x96'))return;return _0x4ac448['user'][_0x4e57('0x97')]({'attributes':['id'],'raw':!![]})[_0x4e57('0x1e')](function(_0x1ddb8b){if(_[_0x4e57('0x71')](_0x1ddb8b)){_0x605bfe[_0x4e57('0x73')](_0x4e57('0x98'));_0x3bacfb['where'](_0x4e57('0x98'));}else{_0x605bfe[_0x4e57('0x73')](_0x4e57('0x99'),_[_0x4e57('0x37')](_0x1ddb8b,'id'));_0x3bacfb[_0x4e57('0x73')](_0x4e57('0x99'),_[_0x4e57('0x37')](_0x1ddb8b,'id'));}});})[_0x4e57('0x1e')](function(){if(_0x4ac448[_0x4e57('0x94')][_0x4e57('0x95')]===_0x4e57('0x96')&&!_0x1a54a2&&!_0x4ac448['query'][_0x4e57('0x72')])return[];return db['sequelize'][_0x4e57('0x3e')](_0x605bfe[_0x4e57('0x9a')](),_0x1d03ab);})['then'](function(_0x19b419){_0x1c976a[_0x4e57('0x18')]=_0x19b419[_0x4e57('0x5f')];if(_0x1c976a[_0x4e57('0x18')]===0x0)return[];return db[_0x4e57('0x9b')][_0x4e57('0x3e')](_0x3f2029['toString'](),_0x1d03ab)['then'](function(_0x5013d2){_0x206618=_[_0x4e57('0x9c')](_0x5013d2,'id');_0x1d03ab=_[_0x4e57('0x9d')](_0x1d03ab,{'model':db[_0x4e57('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4ac448[_0x4e57('0x3e')]['fields']){_0x5af6fc[_0x4e57('0x43')][_0x4e57('0x27')](function(_0x4c3a38){_0x3bacfb[_0x4e57('0x4a')]('i.'+_0x4c3a38);});}else{_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0x8d'),_0x4e57('0x8e'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0x9e'),_0x4e57('0x9f'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa0'),_0x4e57('0xa1'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa2'),_0x4e57('0x8f'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0x88'));_0x3bacfb['field'](_0x4e57('0xa3'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa4'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa5'));_0x3bacfb[_0x4e57('0x4a')]('i.closedAt');_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa6'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa7'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa8'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa9'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xaa'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xab'));_0x3bacfb[_0x4e57('0x4a')]('i.thirdDisposition');_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xac'));_0x3bacfb['field'](_0x4e57('0xad'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xae'));_0x3bacfb['field'](_0x4e57('0xaf'));_0x3bacfb[_0x4e57('0x4a')]('i.UserId');_0x3bacfb['field'](_0x4e57('0xb0'),'Contact.firstName');_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xb1'),'Contact.lastName');_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xb2'),'Contact.email');_0x3bacfb['field'](_0x4e57('0xb3'),_0x4e57('0xb4'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xb5'),_0x4e57('0xb6'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xb7'),_0x4e57('0xb8'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xb9'),_0x4e57('0xba'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xbb'),'Owner.internal');_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xbc'),_0x4e57('0x25'));}if(_0x5af6fc[_0x4e57('0x1a')])_0x3bacfb[_0x4e57('0x1a')](_0x5af6fc[_0x4e57('0x1a')]);if(_0x5af6fc['offset'])_0x3bacfb[_0x4e57('0x19')](_0x5af6fc[_0x4e57('0x19')]);return db[_0x4e57('0x9b')][_0x4e57('0x3e')](_0x3bacfb[_0x4e57('0x9a')](),_0x1d03ab);})[_0x4e57('0x1e')](function(_0x1b4fc4){if(_0x1b4fc4[_0x4e57('0x5f')]>0x0)_0x4954a3[_0x4e57('0x73')](_0x4e57('0xbd'),_[_0x4e57('0x37')](_0x1b4fc4,'id'));return db[_0x4e57('0x9b')][_0x4e57('0x3e')](_0x4954a3['toString'](),_0x1d03ab)[_0x4e57('0x1e')](function(_0x2f2c35){var _0x274627=_[_0x4e57('0xbe')](_0x2f2c35,'MailInteractionId');var _0x4d3dee=[];return db[_0x4e57('0xbf')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]})[_0x4e57('0x1e')](function(_0x1eaecb){var _0x415ef1=_0x1eaecb['enableEmailPreview'];_0x1b4fc4[_0x4e57('0x27')](function(_0x3de2d8){_0x4d3dee[_0x4e57('0x28')](updateMailInteraction(_0x3de2d8,_0x206618,_0x274627,_0x415ef1));});return BPromise[_0x4e57('0xc0')](_0x4d3dee);});});});})['then'](function(_0x1ba46d){_0x1c976a[_0x4e57('0xc1')]=_0x1ba46d;return _0x1c976a;})[_0x4e57('0x1e')](respondWithFilteredResult(_0x4231eb,_0x5af6fc))[_0x4e57('0x2e')](handleError(_0x4231eb,null));};exports[_0x4e57('0xc2')]=function(_0x496506,_0x1faaeb){var _0x1dbece={'raw':![],'where':{'id':_0x496506[_0x4e57('0xc3')]['id']}},_0x17d3b6={};_0x17d3b6[_0x4e57('0x41')]=_[_0x4e57('0x3d')](db[_0x4e57('0x38')][_0x4e57('0x39')]);_0x17d3b6[_0x4e57('0x3e')]=_['keys'](_0x496506['query']);_0x17d3b6[_0x4e57('0x3f')]=_['intersection'](_0x17d3b6[_0x4e57('0x41')],_0x17d3b6[_0x4e57('0x3e')]);_0x1dbece[_0x4e57('0x43')]=_[_0x4e57('0x40')](_0x17d3b6['model'],qs[_0x4e57('0x42')](_0x496506[_0x4e57('0x3e')]['fields']));_0x1dbece['attributes']=_0x1dbece[_0x4e57('0x43')][_0x4e57('0x5f')]?_0x1dbece[_0x4e57('0x43')]:_0x17d3b6[_0x4e57('0x41')];if(_0x496506[_0x4e57('0x3e')]['includeAll']){_0x1dbece['include']=[{'all':!![]}];}_0x1dbece=_[_0x4e57('0x9d')]({},_0x1dbece,_0x496506[_0x4e57('0xc4')]);return db[_0x4e57('0x38')]['find'](_0x1dbece)['then'](handleEntityNotFound(_0x1faaeb,null))[_0x4e57('0x1e')](respondWithResult(_0x1faaeb,null))['catch'](handleError(_0x1faaeb,null));};exports['create']=function(_0x20028d,_0x3f0f97){return db[_0x4e57('0x38')][_0x4e57('0xc5')](_0x20028d['body'],{})[_0x4e57('0x1e')](respondWithResult(_0x3f0f97,0xc9))['catch'](handleError(_0x3f0f97,null));};exports[_0x4e57('0x1d')]=function(_0x109404,_0x1d49d1){if(_0x109404[_0x4e57('0xc6')]['id']){delete _0x109404['body']['id'];}return db[_0x4e57('0x38')][_0x4e57('0x60')]({'where':{'id':_0x109404[_0x4e57('0xc3')]['id']}})[_0x4e57('0x1e')](handleEntityNotFound(_0x1d49d1,null))[_0x4e57('0x1e')](saveUpdates(_0x109404[_0x4e57('0xc6')],null))['then'](respondWithResult(_0x1d49d1,null))['catch'](handleError(_0x1d49d1,null));};exports['destroy']=function(_0x4104f0,_0x564b40){return db['MailInteraction'][_0x4e57('0x60')]({'where':{'id':_0x4104f0[_0x4e57('0xc3')]['id']}})['then'](handleEntityNotFound(_0x564b40,null))[_0x4e57('0x1e')](removeEntity(_0x564b40,null))[_0x4e57('0x2e')](handleError(_0x564b40,null));};exports[_0x4e57('0xc7')]=function(_0x3b1153,_0x9c1a61){return db[_0x4e57('0x38')][_0x4e57('0xc7')]()[_0x4e57('0x1e')](respondWithResult(_0x9c1a61,null))['catch'](handleError(_0x9c1a61,null));};exports[_0x4e57('0xc8')]=function(_0x18ba79,_0x7ed2b4){return db['MailMessage'][_0x4e57('0x60')]({'where':{'id':_0x18ba79['params']['id']}})[_0x4e57('0x1e')](handleEntityNotFound(_0x7ed2b4,null))[_0x4e57('0x1e')](function(_0x292314){if(_0x292314){return _0x292314['addMessage'](_0x18ba79[_0x4e57('0xc6')]['ids'],_['omit'](_0x18ba79[_0x4e57('0xc6')],[_0x4e57('0xc9'),'id'])||{});}})[_0x4e57('0x1e')](respondWithResult(_0x7ed2b4,null))[_0x4e57('0x2e')](handleError(_0x7ed2b4,null));};exports[_0x4e57('0xca')]=function(_0x506dac,_0x4b1b24){var _0x1d415a={'raw':![],'where':{}};var _0x7d3cbd={};var _0x4f2379={'count':0x0,'rows':[]};return db['MailInteraction'][_0x4e57('0x2a')]({'where':{'id':_0x506dac['params']['id']}})[_0x4e57('0x1e')](handleEntityNotFound(_0x4b1b24,null))[_0x4e57('0x1e')](function(_0xc8b69f){if(_0xc8b69f){_0x7d3cbd[_0x4e57('0x41')]=_[_0x4e57('0x3d')](db[_0x4e57('0x29')]['rawAttributes']);_0x7d3cbd['query']=_['keys'](_0x506dac['query']);_0x7d3cbd[_0x4e57('0x3f')]=_[_0x4e57('0x40')](_0x7d3cbd[_0x4e57('0x41')],_0x7d3cbd['query']);_0x1d415a[_0x4e57('0x43')]=_[_0x4e57('0x40')](_0x7d3cbd[_0x4e57('0x41')],qs[_0x4e57('0x42')](_0x506dac[_0x4e57('0x3e')][_0x4e57('0x42')]));_0x1d415a[_0x4e57('0x43')]=_0x1d415a['attributes'][_0x4e57('0x5f')]?_0x1d415a[_0x4e57('0x43')]:_0x7d3cbd[_0x4e57('0x41')];if(!_0x506dac[_0x4e57('0x3e')][_0x4e57('0x44')](_0x4e57('0x45'))){_0x1d415a[_0x4e57('0x1a')]=qs['limit'](_0x506dac[_0x4e57('0x3e')]['limit']);_0x1d415a[_0x4e57('0x19')]=qs['offset'](_0x506dac[_0x4e57('0x3e')][_0x4e57('0x19')]);}_0x1d415a['order']=qs[_0x4e57('0x47')](_0x506dac[_0x4e57('0x3e')][_0x4e57('0x47')]);_0x1d415a['where']=qs[_0x4e57('0x3f')](_[_0x4e57('0x48')](_0x506dac[_0x4e57('0x3e')],_0x7d3cbd['filters']));_0x1d415a[_0x4e57('0x73')][_0x4e57('0xcb')]=_0xc8b69f['id'];if(_0x506dac['query']['filter']){_0x1d415a[_0x4e57('0x73')]=_[_0x4e57('0x9d')](_0x1d415a[_0x4e57('0x73')],{'$or':_[_0x4e57('0x37')](_0x1d415a[_0x4e57('0x43')],function(_0x27b852){var _0x387c83={};_0x387c83[_0x27b852]={'$like':'%'+_0x506dac[_0x4e57('0x3e')][_0x4e57('0x80')]+'%'};return _0x387c83;})});}if(_0x506dac[_0x4e57('0x3e')]['$gte']){var _0x2d2b11=_0x506dac['query']['$gte']['split'](',');var _0x16782e={};_0x16782e[_0x2d2b11[0x0]]={'$gte':moment(_0x2d2b11[0x1])[_0x4e57('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d415a[_0x4e57('0x73')]=_[_0x4e57('0x9d')](_0x1d415a[_0x4e57('0x73')],_0x16782e);}_0x1d415a=_[_0x4e57('0x9d')]({},_0x1d415a,_0x506dac[_0x4e57('0xc4')]);return db[_0x4e57('0x29')][_0x4e57('0x18')]({'where':_0x1d415a[_0x4e57('0x73')]})[_0x4e57('0x1e')](function(_0xf2eb2b){_0x4f2379[_0x4e57('0x18')]=_0xf2eb2b;if(_0x506dac[_0x4e57('0x3e')]['includeAll']){_0x1d415a['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x1d415a);})[_0x4e57('0x1e')](function(_0x4b4cc2){if(_0x506dac['query'][_0x4e57('0xcd')]===_0x4e57('0xce')){for(var _0x487df9=0x0;_0x487df9<_0x4b4cc2[_0x4e57('0x5f')];_0x487df9++){_0x4b4cc2[_0x487df9][_0x4e57('0xc6')]=juice(_0x4b4cc2[_0x487df9]['body']);}}_0x4f2379[_0x4e57('0xc1')]=_0x4b4cc2;return _0x4f2379;});}})[_0x4e57('0x1e')](respondWithFilteredResult(_0x4b1b24,_0x1d415a))['catch'](handleError(_0x4b1b24,null));};exports[_0x4e57('0xcf')]=function(_0x281249,_0x4e016d){return db[_0x4e57('0x38')][_0x4e57('0x60')]({'where':{'id':_0x281249[_0x4e57('0xc3')]['id']}})['then'](handleEntityNotFound(_0x4e016d,null))['then'](function(_0x1f8f03){if(_0x1f8f03){return _0x1f8f03[_0x4e57('0xd0')](_0x281249[_0x4e57('0xc6')][_0x4e57('0xc9')],_[_0x4e57('0xd1')](_0x281249['body'],[_0x4e57('0xc9'),'id'])||{})['spread'](function(){return db[_0x4e57('0xd2')][_0x4e57('0xd3')]({'attributes':['id',_0x4e57('0x21'),_0x4e57('0x4b')],'where':{'id':_0x281249[_0x4e57('0xc6')]['ids']}});})[_0x4e57('0x1e')](function(_0x1c70de){socket[_0x4e57('0xd4')](_0x4e57('0xd5'),{'id':Number(_0x281249[_0x4e57('0xc3')]['id']),'tags':_0x1c70de||[]});return{'id':Number(_0x281249[_0x4e57('0xc3')]['id']),'tags':_0x1c70de||[]};});}})[_0x4e57('0x1e')](respondWithResult(_0x4e016d,null))['catch'](handleError(_0x4e016d,null));};exports[_0x4e57('0xd6')]=function(_0x312906,_0x329d08){return db[_0x4e57('0x38')][_0x4e57('0x60')]({'where':{'id':_0x312906['params']['id']}})['then'](handleEntityNotFound(_0x329d08,null))[_0x4e57('0x1e')](function(_0x3fbc1e){if(_0x3fbc1e){return _0x3fbc1e[_0x4e57('0xd6')](_0x312906[_0x4e57('0x3e')]['ids']);}})[_0x4e57('0x1e')](respondWithStatusCode(_0x329d08,null))[_0x4e57('0x2e')](handleError(_0x329d08,null));};exports[_0x4e57('0xd7')]=function(_0x4ebdef,_0x11c5a0){var _0x743376=moment()[_0x4e57('0xd8')]()[_0x4e57('0x9a')]();var _0x47717f=path[_0x4e57('0xd9')](config[_0x4e57('0xda')],_0x4e57('0xdb'),_0x4e57('0xdc'),_0x4e57('0xdd'));var _0x22cc12=path[_0x4e57('0xd9')](config[_0x4e57('0xda')],_0x4e57('0xdb'),_0x4e57('0xdc'),_0x4e57('0xde'));var _0x162a05=path[_0x4e57('0xd9')](_0x47717f,_0x743376);var _0x5b83b2=util[_0x4e57('0xcc')](_0x4e57('0xdf'),_0x4ebdef[_0x4e57('0xc3')]['id'],_0x743376);var _0x13a847=path[_0x4e57('0xd9')](_0x47717f,_0x5b83b2);var _0x136656=[];if(_0x4ebdef[_0x4e57('0x3e')][_0x4e57('0xde')]){_0x136656[_0x4e57('0x28')]({'model':db[_0x4e57('0xe0')],'as':_0x4e57('0xe1'),'raw':!![]});}var _0x3ac4db=[{'model':db[_0x4e57('0x29')],'as':_0x4e57('0xe2'),'attributes':['id',_0x4e57('0xc6'),_0x4e57('0x4c'),'to','cc',_0x4e57('0xe3'),'subject',_0x4e57('0xe4')],'where':{'secret':![]},'order':qs[_0x4e57('0x47')]('id'),'include':_0x136656}];return db[_0x4e57('0x38')][_0x4e57('0x60')]({'where':{'id':_0x4ebdef[_0x4e57('0xc3')]['id']},'include':_0x3ac4db})['then'](handleEntityNotFound(_0x11c5a0,null))['then'](function(_0x408437){if(_0x408437&&_0x408437[_0x4e57('0xe2')]){var _0x199d3d=_0x408437[_0x4e57('0xe5')]({'plain':!![]});fs['mkdirSync'](_0x162a05);return BPromise[_0x4e57('0xe6')](_0x199d3d[_0x4e57('0xe2')],function(_0x5c2bab,_0x304b8f){var _0x49be82={'from':_0x5c2bab[_0x4e57('0x4c')],'to':_0x5c2bab['to'],'subject':_0x5c2bab[_0x4e57('0xe7')],'html':htmlEntities['decode'](_0x5c2bab[_0x4e57('0xc6')]),'headers':{'Date':moment(_0x5c2bab[_0x4e57('0xe4')])[_0x4e57('0xcc')](_0x4e57('0xe8'))},'attachments':[]};if(_0x5c2bab['cc']){_0x49be82[_0x4e57('0xe9')]['Cc']=_0x5c2bab['cc'];}if(_0x5c2bab['bcc']){_0x49be82[_0x4e57('0xe9')]['Bcc']=_0x5c2bab[_0x4e57('0xe3')];}return new BPromise(function(_0x1110b1,_0xaedcc2){if(_0x5c2bab[_0x4e57('0xe1')]){for(var _0x1625d1=0x0;_0x1625d1<_0x5c2bab['Attachments'][_0x4e57('0x5f')];_0x1625d1++){var _0x1d548a=_0x5c2bab['Attachments'][_0x1625d1];var _0xcb2f07=path[_0x4e57('0xd9')](_0x22cc12,_0x1d548a[_0x4e57('0xea')]);if(fs[_0x4e57('0xeb')](_0xcb2f07)){_0x49be82[_0x4e57('0xde')]['push']({'name':_0x1d548a[_0x4e57('0x21')],'contentType':_0x1d548a[_0x4e57('0x3b')],'data':fs[_0x4e57('0xec')](_0xcb2f07)});}}}emlformat['build'](_0x49be82,function(_0x25459a,_0x112270){if(_0x25459a)return _0xaedcc2(_0x25459a);fs[_0x4e57('0xed')](path['join'](_0x162a05,util[_0x4e57('0xcc')]('message%d.eml',_0x304b8f)),_0x112270);return _0x1110b1(_0x112270);});});})['then'](function(){return new BPromise(function(_0x4a39a6,_0x47ef2f){zipdir(_0x162a05,{'saveTo':_0x13a847},function(_0x2d7b7f,_0xf8dac1){if(_0x2d7b7f)return _0x47ef2f(_0x2d7b7f);return _0x4a39a6(_0xf8dac1);});})[_0x4e57('0x1e')](function(){return new BPromise(function(_0x5d9378,_0x4f2572){rimraf(_0x162a05,function(_0x51d470){if(_0x51d470)_0x4f2572(_0x51d470);return _0x5d9378();});});})[_0x4e57('0x1e')](function(){return _0x11c5a0[_0x4e57('0xd7')](_0x13a847,_0x5b83b2,function(_0x1b4772){if(!_0x1b4772)fs[_0x4e57('0xee')](_0x13a847);});});});}else{return _0x11c5a0['sendStatus'](0xc8);}})[_0x4e57('0x2e')](handleError(_0x11c5a0,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 5022ff7..a920ec4 100644 --- a/server/api/mailInteraction/mailInteraction.events.js +++ b/server/api/mailInteraction/mailInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02fd=['unreadMessages','emit','hook','exports','../../mysqldb','MailInteraction','save','remove','then','Users','map','findAll','setDataValue'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x02fd,0x1b1));var _0xd02f=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x02fd[_0x456fb1];return _0x4083d6;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xd02f('0x0'))['db'][_0xd02f('0x1')];var MailMessage=require(_0xd02f('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd02f('0x2'),'afterUpdate':'update','afterDestroy':_0xd02f('0x3')};function emitEvent(_0x358c27){return function(_0x14ee18,_0x7f00d4,_0x487217){_0x14ee18['getUsers']({'attributes':['id'],'raw':!![]})[_0xd02f('0x4')](function(_0x4e9976){_0x14ee18['setDataValue'](_0xd02f('0x5'),_0x4e9976[_0xd02f('0x6')](function(_0x3beba9){return{'id':_0x3beba9['id']};}));return MailMessage[_0xd02f('0x7')]({'where':{'MailInteractionId':_0x14ee18['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd02f('0x4')](function(_0xf4bff4){_0x14ee18[_0xd02f('0x8')](_0xd02f('0x9'),_0xf4bff4['length']);MailInteractionEvents[_0xd02f('0xa')](_0x358c27+':'+_0x14ee18['id'],_0x14ee18);MailInteractionEvents['emit'](_0x358c27,_0x14ee18);_0x487217(null);})['catch'](_0x487217(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xd02f('0xb')](e,emitEvent(event));}}module[_0xd02f('0xc')]=MailInteractionEvents; \ No newline at end of file +var _0x3fe6=['getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove'];(function(_0x386d15,_0x165f56){var _0x240e80=function(_0xa51117){while(--_0xa51117){_0x386d15['push'](_0x386d15['shift']());}};_0x240e80(++_0x165f56);}(_0x3fe6,0x1a1));var _0x63fe=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0x3fe6[_0x2bb66c];return _0x1e0f98;};'use strict';var EventEmitter=require(_0x63fe('0x0'));var MailInteraction=require(_0x63fe('0x1'))['db'][_0x63fe('0x2')];var MailMessage=require(_0x63fe('0x1'))['db'][_0x63fe('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x63fe('0x4')](0x0);var events={'afterCreate':_0x63fe('0x5'),'afterUpdate':_0x63fe('0x6'),'afterDestroy':_0x63fe('0x7')};function emitEvent(_0x3e8024){return function(_0x2c40f6,_0x594a72,_0x20c0f5){_0x2c40f6[_0x63fe('0x8')]({'attributes':['id'],'raw':!![]})[_0x63fe('0x9')](function(_0x29055a){_0x2c40f6[_0x63fe('0xa')](_0x63fe('0xb'),_0x29055a[_0x63fe('0xc')](function(_0x3840d6){return{'id':_0x3840d6['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2c40f6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x63fe('0x9')](function(_0x1a3f28){_0x2c40f6[_0x63fe('0xa')](_0x63fe('0xd'),_0x1a3f28['length']);MailInteractionEvents[_0x63fe('0xe')](_0x3e8024+':'+_0x2c40f6['id'],_0x2c40f6);MailInteractionEvents[_0x63fe('0xe')](_0x3e8024,_0x2c40f6);_0x20c0f5(null);})[_0x63fe('0xf')](_0x20c0f5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x63fe('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 818ac9c..c723aa6 100644 --- a/server/api/mailInteraction/mailInteraction.model.js +++ b/server/api/mailInteraction/mailInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x939e=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','closed','YYYY-MM-DD\x20HH:mm:ss','changed','closedAt','models','update','then','catch','utf8mb4_unicode_ci','lodash'];(function(_0x4ddfe1,_0x35939d){var _0x4aaf51=function(_0x1e99a0){while(--_0x1e99a0){_0x4ddfe1['push'](_0x4ddfe1['shift']());}};_0x4aaf51(++_0x35939d);}(_0x939e,0x137));var _0xe939=function(_0x35f18a,_0x4e66d3){_0x35f18a=_0x35f18a-0x0;var _0x52d4e0=_0x939e[_0x35f18a];return _0x52d4e0;};'use strict';var _=require(_0xe939('0x0'));var util=require('util');var logger=require(_0xe939('0x1'))(_0xe939('0x2'));var moment=require(_0xe939('0x3'));var BPromise=require(_0xe939('0x4'));var rp=require(_0xe939('0x5'));var fs=require('fs');var path=require(_0xe939('0x6'));var rimraf=require('rimraf');var config=require(_0xe939('0x7'));var attributes=require('./mailInteraction.attributes');module[_0xe939('0x8')]=function(_0x517506,_0x502dd8){return _0x517506[_0xe939('0x9')](_0xe939('0xa'),attributes,{'tableName':_0xe939('0xb'),'paranoid':![],'indexes':[{'name':_0xe939('0xc'),'fields':['subject','to'],'type':_0xe939('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3017d1,_0x115894,_0x36e9ff){if(_0x3017d1[_0xe939('0xe')]){_0x3017d1[_0xe939('0xf')]=moment()[_0xe939('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3017d1[_0xe939('0x11')]){_0x3017d1['closedAt']=moment()[_0xe939('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x36e9ff(null,_0x115894);},'beforeUpdate':function(_0x496347,_0x258ffb,_0x3db6c8){if(_0x496347['changed'](_0xe939('0xe'))){_0x496347['substatusAt']=_0x496347[_0xe939('0xe')]?moment()[_0xe939('0x10')](_0xe939('0x12')):null;}if(_0x496347[_0xe939('0x13')](_0xe939('0x11'))){_0x496347[_0xe939('0x14')]=moment()[_0xe939('0x10')](_0xe939('0x12'));_0x496347[_0xe939('0xe')]=null;_0x496347[_0xe939('0xf')]=null;}_0x3db6c8(null,_0x496347);},'afterUpdate':function(_0x38ddcc,_0x3a5462,_0x17c00a){var _0x5dbe2c=_0x517506[_0xe939('0x15')];var _0x26a75d=_0x38ddcc['get']({'plain':!![]});if(_0x26a75d['closed']){return _0x5dbe2c['MailMessage'][_0xe939('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x26a75d['id']}})[_0xe939('0x17')](function(){_0x17c00a();})[_0xe939('0x18')](function(_0x4e986e){_0x17c00a(_0x4e986e);});}else{_0x17c00a();}}},'charset':'utf8mb4','collate':_0xe939('0x19')});}; \ No newline at end of file +var _0xa3f5=['changed','substatusAt','models','update','then','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x486f13,_0x31944b){var _0x490f0b=function(_0x547440){while(--_0x547440){_0x486f13['push'](_0x486f13['shift']());}};_0x490f0b(++_0x31944b);}(_0xa3f5,0x6e));var _0x5a3f=function(_0x27bc9d,_0x22788a){_0x27bc9d=_0x27bc9d-0x0;var _0x405866=_0xa3f5[_0x27bc9d];return _0x405866;};'use strict';var _=require(_0x5a3f('0x0'));var util=require(_0x5a3f('0x1'));var logger=require(_0x5a3f('0x2'))(_0x5a3f('0x3'));var moment=require(_0x5a3f('0x4'));var BPromise=require(_0x5a3f('0x5'));var rp=require(_0x5a3f('0x6'));var fs=require('fs');var path=require(_0x5a3f('0x7'));var rimraf=require(_0x5a3f('0x8'));var config=require('../../config/environment');var attributes=require(_0x5a3f('0x9'));module[_0x5a3f('0xa')]=function(_0x272dec,_0x332376){return _0x272dec[_0x5a3f('0xb')](_0x5a3f('0xc'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x5a3f('0xd'),'fields':['subject','to'],'type':_0x5a3f('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x20054d,_0x413846,_0x33bad4){if(_0x20054d[_0x5a3f('0xf')]){_0x20054d['substatusAt']=moment()[_0x5a3f('0x10')](_0x5a3f('0x11'));}if(_0x20054d[_0x5a3f('0x12')]){_0x20054d[_0x5a3f('0x13')]=moment()[_0x5a3f('0x10')](_0x5a3f('0x11'));}_0x33bad4(null,_0x413846);},'beforeUpdate':function(_0x59352e,_0xdec304,_0x43c2c7){if(_0x59352e[_0x5a3f('0x14')](_0x5a3f('0xf'))){_0x59352e[_0x5a3f('0x15')]=_0x59352e[_0x5a3f('0xf')]?moment()[_0x5a3f('0x10')](_0x5a3f('0x11')):null;}if(_0x59352e['changed'](_0x5a3f('0x12'))){_0x59352e['closedAt']=moment()[_0x5a3f('0x10')](_0x5a3f('0x11'));_0x59352e['substatus']=null;_0x59352e[_0x5a3f('0x15')]=null;}_0x43c2c7(null,_0x59352e);},'afterUpdate':function(_0x574f16,_0x1ec38f,_0x26d3ee){var _0x4b04d9=_0x272dec[_0x5a3f('0x16')];var _0x22e2fc=_0x574f16['get']({'plain':!![]});if(_0x22e2fc[_0x5a3f('0x12')]){return _0x4b04d9['MailMessage'][_0x5a3f('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x22e2fc['id']}})[_0x5a3f('0x18')](function(){_0x26d3ee();})['catch'](function(_0x11f399){_0x26d3ee(_0x11f399);});}else{_0x26d3ee();}}},'charset':'utf8mb4','collate':_0x5a3f('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index fa346c4..9f878f0 100644 --- a/server/api/mailInteraction/mailInteraction.rpc.js +++ b/server/api/mailInteraction/mailInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ae8=['stringify','error','message','MailInteraction,\x20%s,\x20%s','result','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','catch','find','addTags','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x1466b3,_0x4e341c){var _0x51baf8=function(_0x24172a){while(--_0x24172a){_0x1466b3['push'](_0x1466b3['shift']());}};_0x51baf8(++_0x4e341c);}(_0x7ae8,0x142));var _0x87ae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ae8[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x87ae('0x0'));var moment=require('moment');var BPromise=require(_0x87ae('0x1'));var rs=require(_0x87ae('0x2'));var fs=require('fs');var Redis=require(_0x87ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x87ae('0x4'));var logger=require(_0x87ae('0x5'))(_0x87ae('0x6'));var config=require(_0x87ae('0x7'));var jayson=require(_0x87ae('0x8'));var client=jayson[_0x87ae('0x9')][_0x87ae('0xa')]({'port':0x232a});config[_0x87ae('0xb')]=_[_0x87ae('0xc')](config['redis'],{'host':_0x87ae('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87ae('0xb')]));require(_0x87ae('0xe'))[_0x87ae('0xf')](socket);function respondWithRpcPromise(_0x44cdd2,_0xfeca19,_0x4da429){return new BPromise(function(_0x151b16,_0x511d81){return client[_0x87ae('0x10')](_0x44cdd2,_0x4da429)[_0x87ae('0x11')](function(_0x5591a4){logger[_0x87ae('0x12')]('MailInteraction,\x20%s,\x20%s',_0xfeca19,_0x87ae('0x13'));logger[_0x87ae('0x14')](_0x87ae('0x15'),_0xfeca19,_0x87ae('0x13'),JSON[_0x87ae('0x16')](_0x5591a4));if(_0x5591a4[_0x87ae('0x17')]){if(_0x5591a4['error']['code']===0x1f4){logger[_0x87ae('0x17')]('MailInteraction,\x20%s,\x20%s',_0xfeca19,_0x5591a4['error']['message']);return _0x511d81(_0x5591a4[_0x87ae('0x17')][_0x87ae('0x18')]);}logger[_0x87ae('0x17')](_0x87ae('0x19'),_0xfeca19,_0x5591a4['error'][_0x87ae('0x18')]);return _0x151b16(_0x5591a4[_0x87ae('0x17')]['message']);}else{logger['info'](_0x87ae('0x19'),_0xfeca19,_0x87ae('0x13'));_0x151b16(_0x5591a4[_0x87ae('0x1a')][_0x87ae('0x18')]);}})['catch'](function(_0x4e5394){logger[_0x87ae('0x17')](_0x87ae('0x19'),_0xfeca19,_0x4e5394);_0x511d81(_0x4e5394);});});}exports['UpdateMailInteraction']=function(_0x5b9e28){var _0x3371fd=this;return new Promise(function(_0x1b027b,_0x480235){return db[_0x87ae('0x1b')][_0x87ae('0x1c')](_0x5b9e28[_0x87ae('0x1d')],{'raw':_0x5b9e28[_0x87ae('0x1e')]?_0x5b9e28[_0x87ae('0x1e')][_0x87ae('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b9e28[_0x87ae('0x1e')]?_0x5b9e28[_0x87ae('0x1e')][_0x87ae('0x20')]||null:null,'attributes':_0x5b9e28[_0x87ae('0x1e')]?_0x5b9e28[_0x87ae('0x1e')][_0x87ae('0x21')]||null:null,'limit':_0x5b9e28[_0x87ae('0x1e')]?_0x5b9e28[_0x87ae('0x1e')][_0x87ae('0x22')]||null:null})[_0x87ae('0x11')](function(_0x5a97a0){logger[_0x87ae('0x12')](_0x87ae('0x23'),_0x5b9e28);logger[_0x87ae('0x14')](_0x87ae('0x23'),_0x5b9e28,JSON[_0x87ae('0x16')](_0x5a97a0));_0x1b027b(_0x5a97a0);})[_0x87ae('0x24')](function(_0x11d1ee){logger[_0x87ae('0x17')]('UpdateMailInteraction',_0x11d1ee[_0x87ae('0x18')],_0x5b9e28);_0x480235(_0x3371fd[_0x87ae('0x17')](0x1f4,_0x11d1ee['message']));});});};exports['AddTagsToMailInteraction']=function(_0x32e4a7){return new Promise(function(_0x40830a,_0xfadb67){return db[_0x87ae('0x1b')][_0x87ae('0x25')]({'where':_0x32e4a7[_0x87ae('0x1e')]?_0x32e4a7[_0x87ae('0x1e')]['where']||null:null})['then'](function(_0x39cbc0){if(_0x39cbc0){return _0x39cbc0[_0x87ae('0x26')](_0x32e4a7[_0x87ae('0x1d')][_0x87ae('0x27')],_[_0x87ae('0x28')](_0x32e4a7['body'],[_0x87ae('0x27'),'id'])||{});}})[_0x87ae('0x29')](function(_0x531903){logger[_0x87ae('0x12')](_0x87ae('0x2a'),_0x32e4a7);logger[_0x87ae('0x14')](_0x87ae('0x2a'),_0x32e4a7,JSON[_0x87ae('0x16')](_0x531903));_0x40830a(_0x531903);})[_0x87ae('0x24')](function(_0x501dd8){logger[_0x87ae('0x17')](_0x87ae('0x2a'),_0x501dd8[_0x87ae('0x18')],_0x32e4a7);_0xfadb67(_this[_0x87ae('0x17')](0x1f4,_0x501dd8['message']));});});}; \ No newline at end of file +var _0x66ae=['limit','UpdateMailInteraction','stringify','AddTagsToMailInteraction','MailInteraction','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','catch','update','body','options','raw','where','attributes'];(function(_0x48b25b,_0x3339f6){var _0x1cec56=function(_0x27a37b){while(--_0x27a37b){_0x48b25b['push'](_0x48b25b['shift']());}};_0x1cec56(++_0x3339f6);}(_0x66ae,0x117));var _0xe66a=function(_0x370895,_0x5670fd){_0x370895=_0x370895-0x0;var _0x468589=_0x66ae[_0x370895];return _0x468589;};'use strict';var _=require(_0xe66a('0x0'));var util=require(_0xe66a('0x1'));var moment=require(_0xe66a('0x2'));var BPromise=require(_0xe66a('0x3'));var rs=require(_0xe66a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe66a('0x5'))['db'];var utils=require(_0xe66a('0x6'));var logger=require(_0xe66a('0x7'))(_0xe66a('0x8'));var config=require(_0xe66a('0x9'));var jayson=require(_0xe66a('0xa'));var client=jayson[_0xe66a('0xb')][_0xe66a('0xc')]({'port':0x232a});config[_0xe66a('0xd')]=_[_0xe66a('0xe')](config[_0xe66a('0xd')],{'host':_0xe66a('0xf'),'port':0x18eb});var socket=require(_0xe66a('0x10'))(new Redis(config[_0xe66a('0xd')]));require(_0xe66a('0x11'))[_0xe66a('0x12')](socket);function respondWithRpcPromise(_0x43e183,_0x53c49e,_0x16657e){return new BPromise(function(_0x493509,_0x5c8ec9){return client[_0xe66a('0x13')](_0x43e183,_0x16657e)[_0xe66a('0x14')](function(_0x4d22d0){logger[_0xe66a('0x15')]('MailInteraction,\x20%s,\x20%s',_0x53c49e,_0xe66a('0x16'));logger[_0xe66a('0x17')](_0xe66a('0x18'),_0x53c49e,'request\x20sent',JSON['stringify'](_0x4d22d0));if(_0x4d22d0[_0xe66a('0x19')]){if(_0x4d22d0[_0xe66a('0x19')][_0xe66a('0x1a')]===0x1f4){logger['error'](_0xe66a('0x1b'),_0x53c49e,_0x4d22d0[_0xe66a('0x19')][_0xe66a('0x1c')]);return _0x5c8ec9(_0x4d22d0[_0xe66a('0x19')][_0xe66a('0x1c')]);}logger[_0xe66a('0x19')](_0xe66a('0x1b'),_0x53c49e,_0x4d22d0[_0xe66a('0x19')]['message']);return _0x493509(_0x4d22d0['error'][_0xe66a('0x1c')]);}else{logger[_0xe66a('0x15')](_0xe66a('0x1b'),_0x53c49e,_0xe66a('0x16'));_0x493509(_0x4d22d0['result'][_0xe66a('0x1c')]);}})[_0xe66a('0x1d')](function(_0x19ed83){logger[_0xe66a('0x19')](_0xe66a('0x1b'),_0x53c49e,_0x19ed83);_0x5c8ec9(_0x19ed83);});});}exports['UpdateMailInteraction']=function(_0x10504b){var _0x19fb28=this;return new Promise(function(_0x24f936,_0x316ca9){return db['MailInteraction'][_0xe66a('0x1e')](_0x10504b[_0xe66a('0x1f')],{'raw':_0x10504b[_0xe66a('0x20')]?_0x10504b['options'][_0xe66a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10504b[_0xe66a('0x20')]?_0x10504b[_0xe66a('0x20')][_0xe66a('0x22')]||null:null,'attributes':_0x10504b['options']?_0x10504b[_0xe66a('0x20')][_0xe66a('0x23')]||null:null,'limit':_0x10504b[_0xe66a('0x20')]?_0x10504b[_0xe66a('0x20')][_0xe66a('0x24')]||null:null})[_0xe66a('0x14')](function(_0x2c74f0){logger[_0xe66a('0x15')](_0xe66a('0x25'),_0x10504b);logger[_0xe66a('0x17')](_0xe66a('0x25'),_0x10504b,JSON[_0xe66a('0x26')](_0x2c74f0));_0x24f936(_0x2c74f0);})[_0xe66a('0x1d')](function(_0x42b2d4){logger['error'](_0xe66a('0x25'),_0x42b2d4[_0xe66a('0x1c')],_0x10504b);_0x316ca9(_0x19fb28[_0xe66a('0x19')](0x1f4,_0x42b2d4[_0xe66a('0x1c')]));});});};exports[_0xe66a('0x27')]=function(_0x2e3995){return new Promise(function(_0x5c23cd,_0x3ec87d){return db[_0xe66a('0x28')]['find']({'where':_0x2e3995[_0xe66a('0x20')]?_0x2e3995[_0xe66a('0x20')]['where']||null:null})['then'](function(_0x318686){if(_0x318686){return _0x318686[_0xe66a('0x29')](_0x2e3995[_0xe66a('0x1f')]['ids'],_['omit'](_0x2e3995[_0xe66a('0x1f')],[_0xe66a('0x2a'),'id'])||{});}})[_0xe66a('0x2b')](function(_0x54f039){logger[_0xe66a('0x15')](_0xe66a('0x2c'),_0x2e3995);logger[_0xe66a('0x17')]('AddTags',_0x2e3995,JSON['stringify'](_0x54f039));_0x5c23cd(_0x54f039);})[_0xe66a('0x1d')](function(_0x3e34e0){logger[_0xe66a('0x19')](_0xe66a('0x2c'),_0x3e34e0['message'],_0x2e3995);_0x3ec87d(_this['error'](0x1f4,_0x3e34e0[_0xe66a('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6893b6e..2fa66fa 100644 --- a/server/api/mailInteraction/mailInteraction.socket.js +++ b/server/api/mailInteraction/mailInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8c1=['update','removeListener','register','length','./mailInteraction.events'];(function(_0x25e607,_0x12ebef){var _0x2d355f=function(_0x4cf6dd){while(--_0x4cf6dd){_0x25e607['push'](_0x25e607['shift']());}};_0x2d355f(++_0x12ebef);}(_0xe8c1,0xf4));var _0x1e8c=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xe8c1[_0x1e172a];return _0x96338b;};'use strict';var MailInteractionEvents=require(_0x1e8c('0x0'));var events=['save','remove',_0x1e8c('0x1')];function createListener(_0x38f795,_0x47824d){return function(_0x1d61a8){_0x47824d['emit'](_0x38f795,_0x1d61a8);};}function removeListener(_0x252cf9,_0x6754a8){return function(){MailInteractionEvents[_0x1e8c('0x2')](_0x252cf9,_0x6754a8);};}exports[_0x1e8c('0x3')]=function(_0x3d139e){for(var _0x361f62=0x0,_0x203866=events[_0x1e8c('0x4')];_0x361f62<_0x203866;_0x361f62++){var _0x58bcc5=events[_0x361f62];var _0x3d39f0=createListener('mailInteraction:'+_0x58bcc5,_0x3d139e);MailInteractionEvents['on'](_0x58bcc5,_0x3d39f0);}}; \ No newline at end of file +var _0x86a3=['emit','removeListener','mailInteraction:','./mailInteraction.events','save','update'];(function(_0x5a1e60,_0x9201e1){var _0x53c6fd=function(_0x4a2f74){while(--_0x4a2f74){_0x5a1e60['push'](_0x5a1e60['shift']());}};_0x53c6fd(++_0x9201e1);}(_0x86a3,0xb1));var _0x386a=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x86a3[_0x1dd532];return _0x3732aa;};'use strict';var MailInteractionEvents=require(_0x386a('0x0'));var events=[_0x386a('0x1'),'remove',_0x386a('0x2')];function createListener(_0x4934b5,_0x5c278a){return function(_0x44014b){_0x5c278a[_0x386a('0x3')](_0x4934b5,_0x44014b);};}function removeListener(_0x2d43bd,_0x5d537e){return function(){MailInteractionEvents[_0x386a('0x4')](_0x2d43bd,_0x5d537e);};}exports['register']=function(_0xd6606f){for(var _0x10390b=0x0,_0x218b94=events['length'];_0x10390b<_0x218b94;_0x10390b++){var _0x30aa1d=events[_0x10390b];var _0x3bef2f=createListener(_0x386a('0x5')+_0x30aa1d,_0xd6606f);MailInteractionEvents['on'](_0x30aa1d,_0x3bef2f);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6858da0..00c43bc 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0c0=['/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','download','post','tracked','mail','mailmessage:create','create','/:id','put','/:id/accept','accept'];(function(_0x480e77,_0x46c110){var _0x3a2bb5=function(_0x431b3c){while(--_0x431b3c){_0x480e77['push'](_0x480e77['shift']());}};_0x3a2bb5(++_0x46c110);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x4df3f5,_0x3d635f){_0x4df3f5=_0x4df3f5-0x0;var _0x134cbf=_0xe0c0[_0x4df3f5];return _0x134cbf;};'use strict';var multer=require(_0x0e0c('0x0'));var util=require('util');var path=require(_0x0e0c('0x1'));var timeout=require(_0x0e0c('0x2'));var express=require(_0x0e0c('0x3'));var router=express[_0x0e0c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e0c('0x5'));var interaction=require(_0x0e0c('0x6'));var config=require(_0x0e0c('0x7'));var controller=require('./mailMessage.controller');router[_0x0e0c('0x8')]('/',auth[_0x0e0c('0x9')](),controller['index']);router[_0x0e0c('0x8')](_0x0e0c('0xa'),auth[_0x0e0c('0x9')](),controller[_0x0e0c('0xb')]);router[_0x0e0c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0e0c('0x8')]('/:id/download',auth[_0x0e0c('0x9')](),controller[_0x0e0c('0xc')]);router[_0x0e0c('0xd')]('/',auth[_0x0e0c('0x9')](),interaction[_0x0e0c('0xe')](_0x0e0c('0xf'),_0x0e0c('0x10')),controller[_0x0e0c('0x11')]);router['put'](_0x0e0c('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x0e0c('0x13')](_0x0e0c('0x14'),auth[_0x0e0c('0x9')](),controller[_0x0e0c('0x15')]);router[_0x0e0c('0x13')](_0x0e0c('0x16'),auth['isAuthenticated'](),controller[_0x0e0c('0x17')]);router[_0x0e0c('0x18')](_0x0e0c('0x12'),auth['isAuthenticated'](),controller[_0x0e0c('0x19')]);module[_0x0e0c('0x1a')]=router; \ No newline at end of file +var _0x7c21=['/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','update','put'];(function(_0x57bd50,_0x3ccd59){var _0x1034c0=function(_0x221946){while(--_0x221946){_0x57bd50['push'](_0x57bd50['shift']());}};_0x1034c0(++_0x3ccd59);}(_0x7c21,0x1e2));var _0x17c2=function(_0x39c140,_0x3e9bd9){_0x39c140=_0x39c140-0x0;var _0x1ee589=_0x7c21[_0x39c140];return _0x1ee589;};'use strict';var multer=require(_0x17c2('0x0'));var util=require(_0x17c2('0x1'));var path=require(_0x17c2('0x2'));var timeout=require('connect-timeout');var express=require(_0x17c2('0x3'));var router=express[_0x17c2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x17c2('0x5'));var interaction=require(_0x17c2('0x6'));var config=require(_0x17c2('0x7'));var controller=require(_0x17c2('0x8'));router['get']('/',auth[_0x17c2('0x9')](),controller['index']);router['get'](_0x17c2('0xa'),auth[_0x17c2('0x9')](),controller[_0x17c2('0xb')]);router[_0x17c2('0xc')](_0x17c2('0xd'),auth[_0x17c2('0x9')](),controller[_0x17c2('0xe')]);router['get'](_0x17c2('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x17c2('0x10')]('/',auth['isAuthenticated'](),interaction[_0x17c2('0x11')](_0x17c2('0x12'),_0x17c2('0x13')),controller['create']);router['put'](_0x17c2('0xd'),auth['isAuthenticated'](),controller[_0x17c2('0x14')]);router[_0x17c2('0x15')](_0x17c2('0x16'),auth[_0x17c2('0x9')](),controller['accept']);router[_0x17c2('0x15')](_0x17c2('0x17'),auth[_0x17c2('0x9')](),controller[_0x17c2('0x18')]);router[_0x17c2('0x19')]('/:id',auth[_0x17c2('0x9')](),controller[_0x17c2('0x1a')]);module[_0x17c2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 3a6f37a..fd783d1 100644 --- a/server/api/mailMessage/mailMessage.attributes.js +++ b/server/api/mailMessage/mailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2625=['Chat','sequelize','lodash','exports','long','TEXT','ENUM','INTEGER','DATE'];(function(_0x49bb29,_0x3a3c7b){var _0x38802c=function(_0x27a77d){while(--_0x27a77d){_0x49bb29['push'](_0x49bb29['shift']());}};_0x38802c(++_0x3a3c7b);}(_0x2625,0xe2));var _0x5262=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x2625[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x5262('0x0'));var _=require(_0x5262('0x1'));module[_0x5262('0x2')]={'body':{'type':Sequelize['TEXT'](_0x5262('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5262('0x4')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5262('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x5262('0x4')](_0x5262('0x3'))},'cc':{'type':Sequelize[_0x5262('0x4')](_0x5262('0x3'))},'bcc':{'type':Sequelize[_0x5262('0x4')](_0x5262('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x5262('0x6')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5262('0x7')]},'originTo':{'type':Sequelize[_0x5262('0x4')](_0x5262('0x3'))},'originCc':{'type':Sequelize[_0x5262('0x4')](_0x5262('0x3'))},'originChannel':{'type':Sequelize[_0x5262('0x5')]('Email',_0x5262('0x8')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xb954=['DATE','BOOLEAN','Email','Chat','sequelize','lodash','exports','TEXT','medium','ENUM','out','STRING','long'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0xb954,0x115));var _0x4b95=function(_0x25f8e8,_0x519d8e){_0x25f8e8=_0x25f8e8-0x0;var _0x1df02c=_0xb954[_0x25f8e8];return _0x1df02c;};'use strict';var Sequelize=require(_0x4b95('0x0'));var _=require(_0x4b95('0x1'));module[_0x4b95('0x2')]={'body':{'type':Sequelize[_0x4b95('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x4b95('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4b95('0x5')]('in',_0x4b95('0x6')),'defaultValue':_0x4b95('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4b95('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x4b95('0x3')](_0x4b95('0x8'))},'cc':{'type':Sequelize[_0x4b95('0x3')](_0x4b95('0x8'))},'bcc':{'type':Sequelize[_0x4b95('0x3')](_0x4b95('0x8'))},'subject':{'type':Sequelize[_0x4b95('0x3')]},'sentAt':{'type':Sequelize[_0x4b95('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4b95('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4b95('0x9')]},'originTo':{'type':Sequelize[_0x4b95('0x3')]('long')},'originCc':{'type':Sequelize[_0x4b95('0x3')](_0x4b95('0x8'))},'originChannel':{'type':Sequelize['ENUM'](_0x4b95('0xb'),_0x4b95('0xc')),'defaultValue':_0x4b95('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index d499acf..a2deaf9 100644 --- a/server/api/mailMessage/mailMessage.controller.js +++ b/server/api/mailMessage/mailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc877=['join','root','basename','defaults','ListId','List\x20not\x20found','messageId','format','accept','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','YYYY-MM-DD\x20HH:mm:ss','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','SIP/%s','download','unix','toString','server','files','tmp','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','undefined','count','offset','limit','status','set','Content-Range','update','destroy','end','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','MailMessage','include','findAll','includeAll','body','params','find','describe','create','direction','secret','split','MailAccount','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc877,0xd9));var _0x7c87=function(_0x83751a,_0x5c9b18){_0x83751a=_0x83751a-0x0;var _0x511107=_0xc877[_0x83751a];return _0x511107;};'use strict';var emlformat=require(_0x7c87('0x0'));var moment=require(_0x7c87('0x1'));var BPromise=require('bluebird');var util=require(_0x7c87('0x2'));var path=require(_0x7c87('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x7c87('0x4'));var htmlToText=require('html-to-text');var qs=require(_0x7c87('0x5'));var logger=require(_0x7c87('0x6'))(_0x7c87('0x7'));var interaction_log=require('../../config/logger')(_0x7c87('0x8'));var config=require(_0x7c87('0x9'));var db=require('../../mysqldb')['db'];config[_0x7c87('0xa')]=_['defaults'](config[_0x7c87('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c87('0xb'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x7c87('0xc')](socket);var jayson=require(_0x7c87('0xd'));var client=jayson[_0x7c87('0xe')][_0x7c87('0xf')]({'port':0x232c});var client9003=jayson[_0x7c87('0xe')][_0x7c87('0xf')]({'port':0x232b});var client9002=jayson[_0x7c87('0xe')][_0x7c87('0xf')]({'port':0x232a});function respondWithRpcPromise(_0xe506d6,_0x48e457,_0x4e4b74,_0x476981){return new BPromise(function(_0x4ca27d,_0x29fab7){var _0x450cb5=_0x476981||client;return _0x450cb5[_0x7c87('0x10')](_0xe506d6,_0x4e4b74)[_0x7c87('0x11')](function(_0x119ff0){logger[_0x7c87('0x12')](_0x7c87('0x13'),_0x48e457,_0x7c87('0x14'));logger[_0x7c87('0x15')](_0x7c87('0x16'),_0x48e457,_0x7c87('0x14'),JSON[_0x7c87('0x17')](_0x119ff0));if(_0x119ff0[_0x7c87('0x18')]){if(_0x119ff0[_0x7c87('0x18')][_0x7c87('0x19')]===0x1f4){logger[_0x7c87('0x18')](_0x7c87('0x13'),_0x48e457,_0x119ff0[_0x7c87('0x18')]['message']);return _0x29fab7(_0x119ff0[_0x7c87('0x18')][_0x7c87('0x1a')]);}logger[_0x7c87('0x18')](_0x7c87('0x13'),_0x48e457,_0x119ff0[_0x7c87('0x18')]['message']);return _0x4ca27d(_0x119ff0[_0x7c87('0x18')][_0x7c87('0x1a')]);}else{logger['info'](_0x7c87('0x13'),_0x48e457,_0x7c87('0x14'));_0x4ca27d(_0x119ff0[_0x7c87('0x1b')][_0x7c87('0x1a')]);}})[_0x7c87('0x1c')](function(_0x3e4577){logger[_0x7c87('0x18')](_0x7c87('0x13'),_0x48e457,_0x3e4577);_0x29fab7(_0x3e4577);});});}function respondWithResult(_0x3d072a,_0x303db1){_0x303db1=_0x303db1||0xc8;return function(_0x4068ed){if(_0x4068ed){return _0x3d072a['status'](_0x303db1)[_0x7c87('0x1d')](_0x4068ed);}};}function respondWithFilteredResult(_0x4d36f0,_0x41c3c0){return function(_0xe83415){if(_0xe83415){var _0x22cfe8=typeof _0x41c3c0['offset']===_0x7c87('0x1e')&&typeof _0x41c3c0['limit']==='undefined';var _0x878b86=_0xe83415[_0x7c87('0x1f')];var _0x1e6cf7=_0x22cfe8?0x0:_0x41c3c0[_0x7c87('0x20')];var _0x337c7c=_0x22cfe8?_0xe83415['count']:_0x41c3c0[_0x7c87('0x20')]+_0x41c3c0[_0x7c87('0x21')];var _0x1ae307;if(_0x337c7c>=_0x878b86){_0x337c7c=_0x878b86;_0x1ae307=0xc8;}else{_0x1ae307=0xce;}_0x4d36f0[_0x7c87('0x22')](_0x1ae307);return _0x4d36f0[_0x7c87('0x23')](_0x7c87('0x24'),_0x1e6cf7+'-'+_0x337c7c+'/'+_0x878b86)[_0x7c87('0x1d')](_0xe83415);}return null;};}function saveUpdates(_0x440321){return function(_0x2f01d8){if(_0x2f01d8){return _0x2f01d8[_0x7c87('0x25')](_0x440321)[_0x7c87('0x11')](function(_0x3bd2d9){return _0x3bd2d9;});}return null;};}function removeEntity(_0x276580){return function(_0x553737){if(_0x553737){return _0x553737[_0x7c87('0x26')]()[_0x7c87('0x11')](function(){_0x276580[_0x7c87('0x22')](0xcc)[_0x7c87('0x27')]();});}};}function handleEntityNotFound(_0x46932d){return function(_0x5373bc){if(!_0x5373bc){_0x46932d[_0x7c87('0x28')](0x194);}return _0x5373bc;};}function handleError(_0x20b5a8,_0x4dfd7d){_0x4dfd7d=_0x4dfd7d||0x1f4;return function(_0x547d86){logger[_0x7c87('0x18')](_0x547d86[_0x7c87('0x29')]);if(_0x547d86['name']){delete _0x547d86['name'];}_0x20b5a8[_0x7c87('0x22')](_0x4dfd7d)[_0x7c87('0x2a')](_0x547d86);};}exports[_0x7c87('0x2b')]=function(_0x4c921d,_0x21ff37){var _0x2a5129={},_0x25e9ed={},_0x20bbc6={'count':0x0,'rows':[]};var _0x3caa35=_[_0x7c87('0x2c')](db['MailMessage'][_0x7c87('0x2d')],function(_0x21d429){return{'name':_0x21d429[_0x7c87('0x2e')],'type':_0x21d429[_0x7c87('0x2f')][_0x7c87('0x30')]};});_0x25e9ed[_0x7c87('0x31')]=_[_0x7c87('0x2c')](_0x3caa35,_0x7c87('0x32'));_0x25e9ed[_0x7c87('0x33')]=_[_0x7c87('0x34')](_0x4c921d[_0x7c87('0x33')]);_0x25e9ed[_0x7c87('0x35')]=_[_0x7c87('0x36')](_0x25e9ed[_0x7c87('0x31')],_0x25e9ed['query']);_0x2a5129['attributes']=_[_0x7c87('0x36')](_0x25e9ed[_0x7c87('0x31')],qs[_0x7c87('0x37')](_0x4c921d[_0x7c87('0x33')][_0x7c87('0x37')]));_0x2a5129[_0x7c87('0x38')]=_0x2a5129[_0x7c87('0x38')][_0x7c87('0x39')]?_0x2a5129[_0x7c87('0x38')]:_0x25e9ed[_0x7c87('0x31')];if(!_0x4c921d[_0x7c87('0x33')]['hasOwnProperty'](_0x7c87('0x3a'))){_0x2a5129['limit']=qs[_0x7c87('0x21')](_0x4c921d['query'][_0x7c87('0x21')]);_0x2a5129[_0x7c87('0x20')]=qs[_0x7c87('0x20')](_0x4c921d['query'][_0x7c87('0x20')]);}_0x2a5129[_0x7c87('0x3b')]=qs[_0x7c87('0x3c')](_0x4c921d[_0x7c87('0x33')]['sort']);_0x2a5129[_0x7c87('0x3d')]=qs['filters'](_['pick'](_0x4c921d[_0x7c87('0x33')],_0x25e9ed[_0x7c87('0x35')]),_0x3caa35);if(_0x4c921d[_0x7c87('0x33')][_0x7c87('0x3e')]){_0x2a5129[_0x7c87('0x3d')]=_[_0x7c87('0x3f')](_0x2a5129[_0x7c87('0x3d')],{'$or':_[_0x7c87('0x2c')](_0x3caa35,function(_0x489bff){if(_0x489bff['type']!==_0x7c87('0x40')){var _0x51be4d={};_0x51be4d[_0x489bff[_0x7c87('0x32')]]={'$like':'%'+_0x4c921d[_0x7c87('0x33')][_0x7c87('0x3e')]+'%'};return _0x51be4d;}})});}_0x2a5129=_['merge']({},_0x2a5129,_0x4c921d[_0x7c87('0x41')]);var _0x19ab4f={'where':_0x2a5129[_0x7c87('0x3d')]};return db[_0x7c87('0x42')][_0x7c87('0x1f')](_0x19ab4f)[_0x7c87('0x11')](function(_0x3aafe6){_0x20bbc6[_0x7c87('0x1f')]=_0x3aafe6;if(_0x4c921d[_0x7c87('0x33')]['includeAll']){_0x2a5129[_0x7c87('0x43')]=[{'all':!![]}];}return db[_0x7c87('0x42')][_0x7c87('0x44')](_0x2a5129);})[_0x7c87('0x11')](function(_0x5b52e9){_0x20bbc6['rows']=_0x5b52e9;return _0x20bbc6;})['then'](respondWithFilteredResult(_0x21ff37,_0x2a5129))[_0x7c87('0x1c')](handleError(_0x21ff37,null));};exports['show']=function(_0xded8ff,_0x306285){var _0x5ed306={'raw':!![],'where':{'id':_0xded8ff['params']['id']}},_0x21fb98={};_0x21fb98[_0x7c87('0x31')]=_['keys'](db[_0x7c87('0x42')][_0x7c87('0x2d')]);_0x21fb98[_0x7c87('0x33')]=_[_0x7c87('0x34')](_0xded8ff[_0x7c87('0x33')]);_0x21fb98['filters']=_[_0x7c87('0x36')](_0x21fb98[_0x7c87('0x31')],_0x21fb98[_0x7c87('0x33')]);_0x5ed306[_0x7c87('0x38')]=_[_0x7c87('0x36')](_0x21fb98[_0x7c87('0x31')],qs['fields'](_0xded8ff[_0x7c87('0x33')][_0x7c87('0x37')]));_0x5ed306['attributes']=_0x5ed306[_0x7c87('0x38')][_0x7c87('0x39')]?_0x5ed306[_0x7c87('0x38')]:_0x21fb98[_0x7c87('0x31')];if(_0xded8ff[_0x7c87('0x33')][_0x7c87('0x45')]){_0x5ed306[_0x7c87('0x43')]=[{'all':!![]}];}_0x5ed306=_[_0x7c87('0x3f')]({},_0x5ed306,_0xded8ff[_0x7c87('0x41')]);return db[_0x7c87('0x42')]['find'](_0x5ed306)[_0x7c87('0x11')](handleEntityNotFound(_0x306285,null))[_0x7c87('0x11')](respondWithResult(_0x306285,null))[_0x7c87('0x1c')](handleError(_0x306285,null));};exports[_0x7c87('0x25')]=function(_0x458dd6,_0x4463c6){if(_0x458dd6[_0x7c87('0x46')]['id']){delete _0x458dd6['body']['id'];}return db[_0x7c87('0x42')]['find']({'where':{'id':_0x458dd6[_0x7c87('0x47')]['id']}})[_0x7c87('0x11')](handleEntityNotFound(_0x4463c6,null))[_0x7c87('0x11')](saveUpdates(_0x458dd6[_0x7c87('0x46')],null))[_0x7c87('0x11')](respondWithResult(_0x4463c6,null))[_0x7c87('0x1c')](handleError(_0x4463c6,null));};exports[_0x7c87('0x26')]=function(_0x4df0d6,_0x104fa1){return db[_0x7c87('0x42')][_0x7c87('0x48')]({'where':{'id':_0x4df0d6['params']['id']}})[_0x7c87('0x11')](handleEntityNotFound(_0x104fa1,null))[_0x7c87('0x11')](removeEntity(_0x104fa1,null))[_0x7c87('0x1c')](handleError(_0x104fa1,null));};exports[_0x7c87('0x49')]=function(_0x52cfe6,_0x171de5){return db[_0x7c87('0x42')]['describe']()[_0x7c87('0x11')](respondWithResult(_0x171de5,null))['catch'](handleError(_0x171de5,null));};exports[_0x7c87('0x4a')]=function(_0x3d2be7,_0x290ef8){return db['MailMessage'][_0x7c87('0x4a')](_0x3d2be7[_0x7c87('0x46')])['then'](function(_0x1794eb){if(_0x1794eb){if(_0x1794eb[_0x7c87('0x4b')]==='out'&&!_0x1794eb[_0x7c87('0x4c')]){var _0x47ac26,_0x124fcf,_0x435cf4;if(_0x3d2be7[_0x7c87('0x46')]['to']){_0x124fcf=_0x3d2be7[_0x7c87('0x46')]['to'][_0x7c87('0x4d')](',')[0x0];}return db[_0x7c87('0x4e')]['findOne']({'where':{'id':_0x1794eb['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x7c87('0x4f'),'include':[{'model':db[_0x7c87('0x50')],'as':_0x7c87('0x51'),'where':{'email':_0x124fcf},'limit':0x1,'order':[[_0x7c87('0x52'),_0x7c87('0x53')]]}]},{'model':db[_0x7c87('0x54')],'as':_0x7c87('0x55'),'raw':!![],'include':[{'model':db[_0x7c87('0x56')],'as':_0x7c87('0x56'),'raw':!![]}]}]})[_0x7c87('0x11')](function(_0x35fe4d){_0x47ac26=_0x35fe4d;if(!_0x47ac26||!_0x47ac26[_0x7c87('0x55')])return;var _0x5af385=_0x47ac26[_0x7c87('0x57')]();if(_0x3d2be7['body'][_0x7c87('0x58')]&&_0x3d2be7[_0x7c87('0x46')][_0x7c87('0x58')]['length']){for(var _0x233c85=0x0;_0x233c85<_0x3d2be7['body'][_0x7c87('0x58')][_0x7c87('0x39')];_0x233c85+=0x1){_0x3d2be7['body'][_0x7c87('0x58')][_0x233c85]={'filename':_0x3d2be7[_0x7c87('0x46')][_0x7c87('0x58')][_0x233c85][_0x7c87('0x32')],'path':path[_0x7c87('0x59')](config[_0x7c87('0x5a')],'server/files/attachments',_0x3d2be7[_0x7c87('0x46')][_0x7c87('0x58')][_0x233c85][_0x7c87('0x5b')])};}}_0x435cf4={'account':_0x5af385,'message':_0x3d2be7[_0x7c87('0x46')]};return;})[_0x7c87('0x11')](function(){if(_0x47ac26['List']){if(_0x47ac26[_0x7c87('0x4f')][_0x7c87('0x51')][_0x7c87('0x39')]){return _0x47ac26[_0x7c87('0x4f')]['Contacts'][0x0];}else{return db[_0x7c87('0x50')][_0x7c87('0x4a')](_[_0x7c87('0x5c')](_0x3d2be7[_0x7c87('0x46')],{'firstName':_0x3d2be7[_0x7c87('0x46')]['to'],'email':_0x3d2be7['body']['to'],'phone':_0x3d2be7[_0x7c87('0x46')]['to'],'ListId':_0x47ac26[_0x7c87('0x5d')]}));}}else{throw new Error(_0x7c87('0x5e'));}})['then'](function(){if(_0x435cf4){return respondWithRpcPromise('SendMail','sendMail',_0x435cf4,client9003)[_0x7c87('0x11')](function(_0x4414c6){return _0x1794eb[_0x7c87('0x25')]({'read':!![],'messageId':_0x4414c6[_0x7c87('0x5f')],'sentAt':moment()[_0x7c87('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x7c87('0x1c')](function(_0x5c0006){logger[_0x7c87('0x18')]('%s',JSON['stringify'](_0x5c0006));return _0x1794eb;});}return _0x1794eb;});}return _0x1794eb;}})[_0x7c87('0x11')](respondWithResult(_0x290ef8,0xc9))[_0x7c87('0x1c')](handleError(_0x290ef8,null));};exports[_0x7c87('0x61')]=function(_0x319889,_0x1c1412){var _0x80dbac={'agent':{},'channel':'mail'};if(_0x319889[_0x7c87('0x46')]['id']){delete _0x319889[_0x7c87('0x46')]['id'];}_0x319889[_0x7c87('0x46')]['read']=!![];_0x319889['body'][_0x7c87('0x62')]=moment()[_0x7c87('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x319889[_0x7c87('0x46')]['UserId']=_0x319889[_0x7c87('0x46')][_0x7c87('0x63')]||_0x319889[_0x7c87('0x64')]['id'];_0x80dbac[_0x7c87('0x65')]['id']=_0x319889['body'][_0x7c87('0x63')];return db[_0x7c87('0x42')][_0x7c87('0x48')]({'where':{'id':_0x319889[_0x7c87('0x47')]['id'],'UserId':null}})[_0x7c87('0x11')](handleEntityNotFound(_0x1c1412,null))[_0x7c87('0x11')](saveUpdates(_0x319889['body'],null))[_0x7c87('0x11')](function(_0x37c035){if(_0x37c035){_0x80dbac[_0x7c87('0x1a')]=_0x37c035[_0x7c87('0x66')]({'plain':!![]});return db[_0x7c87('0x67')][_0x7c87('0x48')]({'where':{'id':_0x37c035[_0x7c87('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x1c1412,null))[_0x7c87('0x11')](function(_0x25f89a){if(_0x25f89a){return _0x25f89a[_0x7c87('0x25')]({'UserId':_0x319889['body'][_0x7c87('0x63')],'read1stAt':_['isNil'](_0x25f89a['read1stAt'])?moment()[_0x7c87('0x60')](_0x7c87('0x69')):undefined});}return null;})[_0x7c87('0x11')](function(_0x82985){if(_0x82985){_0x80dbac[_0x7c87('0x6a')]=_0x82985[_0x7c87('0x66')]({'plain':!![]});interaction_log[_0x7c87('0x12')](_0x7c87('0x6b'),_0x319889[_0x7c87('0x64')]['id'],_0x319889[_0x7c87('0x64')]['name'],_0x319889[_0x7c87('0x64')][_0x7c87('0x6c')],_0x80dbac[_0x7c87('0x6a')]['id'],_0x319889[_0x7c87('0x46')]?JSON['stringify'](_0x319889[_0x7c87('0x46')]):_0x7c87('0x6d'));return respondWithRpcPromise(_0x7c87('0x6e'),_0x7c87('0x6f'),_0x80dbac);}return null;})[_0x7c87('0x11')](function(_0x38f474){var _0x111a3=_0x7c87('0x70')+_0x38f474[_0x7c87('0x1a')][_0x7c87('0x71')];return db[_0x7c87('0x72')]['query'](_0x111a3,{'type':db['Sequelize'][_0x7c87('0x73')]['SELECT'],'raw':!![]})['then'](function(_0x5a453c){return _0x5a453c;});})['then'](function(_0x1600e6){if(_0x1600e6){_0x80dbac[_0x7c87('0x1a')][_0x7c87('0x74')]=_0x1600e6[0x0];if(!_0x319889[_0x7c87('0x46')][_0x7c87('0x63')])return;return db[_0x7c87('0x75')][_0x7c87('0x48')]({'where':{'id':_0x319889[_0x7c87('0x46')]['UserId'],'role':_0x7c87('0x65')},'attributes':['id',_0x7c87('0x32'),_0x7c87('0x76'),_0x7c87('0x77'),_0x7c87('0x78')],'raw':!![]});}return null;})[_0x7c87('0x11')](function(_0x1065fc){if(!_0x1065fc)return null;_0x80dbac[_0x7c87('0x1a')]['agent']=_0x1065fc;return _0x80dbac;})['then'](function(_0x1cf35e){if(_0x1cf35e){if(_0x319889[_0x7c87('0x46')][_0x7c87('0x79')]){_0x80dbac['message'][_0x7c87('0x7a')]=util[_0x7c87('0x60')]('SIP/%s',_0x319889['user'][_0x7c87('0x32')]);_0x80dbac[_0x7c87('0x1a')][_0x7c87('0x7b')]=_0x80dbac[_0x7c87('0x7b')];_0x80dbac[_0x7c87('0x1a')][_0x7c87('0x7c')]=_0x80dbac['channel'];_0x80dbac[_0x7c87('0x1a')]['event']=_0x7c87('0x61');_0x80dbac[_0x7c87('0x1a')][_0x7c87('0x46')]=htmlToText[_0x7c87('0x7d')](_0x80dbac[_0x7c87('0x1a')][_0x7c87('0x46')]);return respondWithRpcPromise(_0x7c87('0x7e'),_0x7c87('0x7e'),{'event':_0x7c87('0x7f'),'message':_0x80dbac[_0x7c87('0x1a')]},client9002)['then'](function(){return _0x80dbac;});}return _0x80dbac;}return null;})[_0x7c87('0x11')](respondWithResult(_0x1c1412,null))[_0x7c87('0x1c')](handleError(_0x1c1412,null));};exports[_0x7c87('0x80')]=function(_0x1be18e,_0x126ddf){var _0xb1cc94={'agent':{},'channel':_0x7c87('0x81')};if(_0x1be18e[_0x7c87('0x46')]['id']){delete _0x1be18e[_0x7c87('0x46')]['id'];}_0x1be18e[_0x7c87('0x46')][_0x7c87('0x63')]=_0x1be18e[_0x7c87('0x46')][_0x7c87('0x63')]||_0x1be18e[_0x7c87('0x64')]['id'];_0xb1cc94['agent']['id']=_0x1be18e[_0x7c87('0x46')]['UserId'];return db[_0x7c87('0x42')][_0x7c87('0x48')]({'where':{'id':_0x1be18e[_0x7c87('0x47')]['id'],'UserId':null}})[_0x7c87('0x11')](handleEntityNotFound(_0x126ddf,null))[_0x7c87('0x11')](function(_0x1cb819){if(_0x1cb819){_0xb1cc94[_0x7c87('0x1a')]=_0x1cb819['get']({'plain':!![]});return db['MailInteraction'][_0x7c87('0x48')]({'where':{'id':_0x1cb819[_0x7c87('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x126ddf,null))['then'](function(_0x2ff173){if(_0x2ff173){_0xb1cc94['interaction']=_0x2ff173[_0x7c87('0x66')]({'plain':!![]});interaction_log[_0x7c87('0x12')](_0x7c87('0x82'),_0x1be18e[_0x7c87('0x64')]['id'],_0x1be18e[_0x7c87('0x64')][_0x7c87('0x32')],_0x1be18e[_0x7c87('0x64')][_0x7c87('0x6c')],_0xb1cc94[_0x7c87('0x6a')]['id'],_0x1be18e[_0x7c87('0x46')]?JSON['stringify'](_0x1be18e[_0x7c87('0x46')]):_0x7c87('0x6d'));return respondWithRpcPromise(_0x7c87('0x83'),_0x7c87('0x84'),_0xb1cc94);}return null;})[_0x7c87('0x11')](function(_0x4fb56a){var _0x3a8362=_0x7c87('0x70')+_0x4fb56a[_0x7c87('0x1a')][_0x7c87('0x71')];return db['sequelize'][_0x7c87('0x33')](_0x3a8362,{'type':db[_0x7c87('0x85')][_0x7c87('0x73')]['SELECT'],'raw':!![]})[_0x7c87('0x11')](function(_0x383cf3){return _0x383cf3;});})['then'](function(_0x18463c){if(_0x18463c){_0xb1cc94[_0x7c87('0x1a')][_0x7c87('0x74')]=_0x18463c[0x0];if(!_0x1be18e[_0x7c87('0x46')]['UserId'])return;return db[_0x7c87('0x75')][_0x7c87('0x48')]({'where':{'id':_0x1be18e['body'][_0x7c87('0x63')],'role':_0x7c87('0x65')},'attributes':['id',_0x7c87('0x32'),_0x7c87('0x76'),_0x7c87('0x77'),_0x7c87('0x78')],'raw':!![]});}return null;})[_0x7c87('0x11')](function(_0x260197){if(!_0x260197)return null;_0xb1cc94[_0x7c87('0x1a')][_0x7c87('0x65')]=_0x260197;return _0xb1cc94;})[_0x7c87('0x11')](function(_0x3136f4){if(_0x3136f4){_0x3136f4[_0x7c87('0x1a')][_0x7c87('0x7a')]=util['format'](_0x7c87('0x86'),_0x1be18e['user'][_0x7c87('0x32')]);_0x3136f4[_0x7c87('0x1a')][_0x7c87('0x7b')]=_0xb1cc94[_0x7c87('0x7b')];_0x3136f4[_0x7c87('0x1a')]['motionChannel']=_0xb1cc94['channel'];_0x3136f4[_0x7c87('0x1a')]['event']='reject';_0x3136f4[_0x7c87('0x1a')][_0x7c87('0x46')]=htmlToText['fromString'](_0xb1cc94[_0x7c87('0x1a')]['body']);respondWithRpcPromise(_0x7c87('0x7e'),_0x7c87('0x7e'),{'event':'rejectmessage','message':_0x3136f4[_0x7c87('0x1a')]},client9002);return _0xb1cc94;}return null;})[_0x7c87('0x11')](respondWithResult(_0x126ddf,null))[_0x7c87('0x1c')](handleError(_0x126ddf,null));};exports[_0x7c87('0x87')]=function(_0x179773,_0x199378){var _0x581dd1=moment()[_0x7c87('0x88')]()[_0x7c87('0x89')]();var _0x562ba8=path[_0x7c87('0x59')](config['root'],_0x7c87('0x8a'),_0x7c87('0x8b'),_0x7c87('0x8c'));var _0x33db67=path['join'](config[_0x7c87('0x5a')],_0x7c87('0x8a'),'files',_0x7c87('0x58'));var _0x450676=util['format']('message-%s.eml',_0x581dd1);return db[_0x7c87('0x42')]['find']({'where':{'id':_0x179773['params']['id']},'attributes':['id',_0x7c87('0x46'),'from','to','cc','bcc','subject',_0x7c87('0x8d')],'include':_0x179773['query'][_0x7c87('0x58')]?[{'model':db[_0x7c87('0x8e')],'as':_0x7c87('0x8f')}]:undefined})[_0x7c87('0x11')](handleEntityNotFound(_0x199378,null))[_0x7c87('0x11')](function(_0x16472b){if(_0x16472b){var _0x14b257=_0x16472b;var _0x1e7f49={'from':_0x14b257[_0x7c87('0x90')],'to':_0x14b257['to'],'subject':_0x14b257['subject'],'html':htmlEntities[_0x7c87('0x91')](_0x14b257[_0x7c87('0x46')]),'headers':{'Date':moment(_0x14b257[_0x7c87('0x8d')])[_0x7c87('0x60')](_0x7c87('0x92'))},'attachments':[]};if(_0x16472b['cc']){_0x1e7f49['headers']['Cc']=_0x16472b['cc'];}if(_0x16472b[_0x7c87('0x93')]){_0x1e7f49[_0x7c87('0x94')]['Bcc']=_0x16472b[_0x7c87('0x93')];}return new BPromise(function(_0x459609,_0x37e94f){if(_0x16472b[_0x7c87('0x8f')]){for(var _0x4b9389=0x0;_0x4b9389<_0x16472b['Attachments']['length'];_0x4b9389++){var _0x46d9f6=_0x16472b[_0x7c87('0x8f')][_0x4b9389];var _0x410e9c=path[_0x7c87('0x59')](_0x33db67,_0x46d9f6['basename']);if(fs['existsSync'](_0x410e9c)){_0x1e7f49[_0x7c87('0x58')]['push']({'name':_0x46d9f6['name'],'contentType':_0x46d9f6[_0x7c87('0x2f')],'data':fs[_0x7c87('0x95')](_0x410e9c)});}}}emlformat[_0x7c87('0x96')](_0x1e7f49,function(_0x5bee02,_0xa07966){if(_0x5bee02)return _0x37e94f(_0x5bee02);fs[_0x7c87('0x97')](path[_0x7c87('0x59')](_0x562ba8,_0x450676),_0xa07966);return _0x459609(_0xa07966);});});}})[_0x7c87('0x11')](function(_0x2c51df){if(_0x2c51df){return _0x199378['download'](path['join'](_0x562ba8,_0x450676),_0x450676,function(_0x28737d){if(!_0x28737d)fs[_0x7c87('0x98')](path['join'](_0x562ba8,_0x450676));});}})[_0x7c87('0x1c')](handleError(_0x199378,null));}; \ No newline at end of file +var _0x86e1=['getSmtpOptions','attachments','root','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','email','event','rejectmessage','toString','join','server','files','tmp','from','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','Attachments','existsSync','readFileSync','download','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','order','sort','pick','filter','merge','VIRTUAL','options','findAll','show','params','keys','includeAll','include','body','find','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','DESC','Smtp','CloudProvider'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x86e1,0x180));var _0x186e=function(_0x284c1e,_0x5b7587){_0x284c1e=_0x284c1e-0x0;var _0x5a41a9=_0x86e1[_0x284c1e];return _0x5a41a9;};'use strict';var emlformat=require('eml-format');var moment=require(_0x186e('0x0'));var BPromise=require(_0x186e('0x1'));var util=require(_0x186e('0x2'));var path=require(_0x186e('0x3'));var fs=require('fs');var _=require(_0x186e('0x4'));var Redis=require(_0x186e('0x5'));var htmlToText=require(_0x186e('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x186e('0x7'));var interaction_log=require(_0x186e('0x8'))('mail-interactions');var config=require(_0x186e('0x9'));var db=require(_0x186e('0xa'))['db'];config[_0x186e('0xb')]=_[_0x186e('0xc')](config[_0x186e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x186e('0xd'))(new Redis(config[_0x186e('0xb')]));var htmlEntities=require(_0x186e('0xe'));require(_0x186e('0xf'))[_0x186e('0x10')](socket);var jayson=require(_0x186e('0x11'));var client=jayson['client'][_0x186e('0x12')]({'port':0x232c});var client9003=jayson['client'][_0x186e('0x12')]({'port':0x232b});var client9002=jayson['client'][_0x186e('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x234ff5,_0x2163d6,_0x490efa,_0x17bbc7){return new BPromise(function(_0x2f2641,_0x1c40f8){var _0x191760=_0x17bbc7||client;return _0x191760[_0x186e('0x13')](_0x234ff5,_0x490efa)[_0x186e('0x14')](function(_0x3e260c){logger['info'](_0x186e('0x15'),_0x2163d6,_0x186e('0x16'));logger['debug'](_0x186e('0x17'),_0x2163d6,_0x186e('0x16'),JSON[_0x186e('0x18')](_0x3e260c));if(_0x3e260c[_0x186e('0x19')]){if(_0x3e260c['error'][_0x186e('0x1a')]===0x1f4){logger[_0x186e('0x19')](_0x186e('0x15'),_0x2163d6,_0x3e260c[_0x186e('0x19')]['message']);return _0x1c40f8(_0x3e260c[_0x186e('0x19')][_0x186e('0x1b')]);}logger[_0x186e('0x19')](_0x186e('0x15'),_0x2163d6,_0x3e260c['error'][_0x186e('0x1b')]);return _0x2f2641(_0x3e260c['error'][_0x186e('0x1b')]);}else{logger[_0x186e('0x1c')]('MailMessage,\x20%s,\x20%s',_0x2163d6,_0x186e('0x16'));_0x2f2641(_0x3e260c[_0x186e('0x1d')][_0x186e('0x1b')]);}})[_0x186e('0x1e')](function(_0x301166){logger[_0x186e('0x19')](_0x186e('0x15'),_0x2163d6,_0x301166);_0x1c40f8(_0x301166);});});}function respondWithResult(_0x33df18,_0x2a6865){_0x2a6865=_0x2a6865||0xc8;return function(_0x3ea4d5){if(_0x3ea4d5){return _0x33df18[_0x186e('0x1f')](_0x2a6865)[_0x186e('0x20')](_0x3ea4d5);}};}function respondWithFilteredResult(_0x5c48d6,_0x48a074){return function(_0x9334f4){if(_0x9334f4){var _0x5ec3b5=typeof _0x48a074[_0x186e('0x21')]===_0x186e('0x22')&&typeof _0x48a074[_0x186e('0x23')]===_0x186e('0x22');var _0x2dbd1a=_0x9334f4[_0x186e('0x24')];var _0x4df50d=_0x5ec3b5?0x0:_0x48a074[_0x186e('0x21')];var _0x1e97d8=_0x5ec3b5?_0x9334f4[_0x186e('0x24')]:_0x48a074['offset']+_0x48a074[_0x186e('0x23')];var _0x30471e;if(_0x1e97d8>=_0x2dbd1a){_0x1e97d8=_0x2dbd1a;_0x30471e=0xc8;}else{_0x30471e=0xce;}_0x5c48d6['status'](_0x30471e);return _0x5c48d6[_0x186e('0x25')](_0x186e('0x26'),_0x4df50d+'-'+_0x1e97d8+'/'+_0x2dbd1a)[_0x186e('0x20')](_0x9334f4);}return null;};}function saveUpdates(_0x224bf7){return function(_0x10d8aa){if(_0x10d8aa){return _0x10d8aa[_0x186e('0x27')](_0x224bf7)[_0x186e('0x14')](function(_0x5200aa){return _0x5200aa;});}return null;};}function removeEntity(_0x55b497){return function(_0x5f01f5){if(_0x5f01f5){return _0x5f01f5[_0x186e('0x28')]()[_0x186e('0x14')](function(){_0x55b497[_0x186e('0x1f')](0xcc)[_0x186e('0x29')]();});}};}function handleEntityNotFound(_0xac018b){return function(_0x23047c){if(!_0x23047c){_0xac018b[_0x186e('0x2a')](0x194);}return _0x23047c;};}function handleError(_0x599e8e,_0x2ac08c){_0x2ac08c=_0x2ac08c||0x1f4;return function(_0x9f0dcd){logger[_0x186e('0x19')](_0x9f0dcd[_0x186e('0x2b')]);if(_0x9f0dcd[_0x186e('0x2c')]){delete _0x9f0dcd[_0x186e('0x2c')];}_0x599e8e[_0x186e('0x1f')](_0x2ac08c)[_0x186e('0x2d')](_0x9f0dcd);};}exports[_0x186e('0x2e')]=function(_0x4bd334,_0x2ee3a5){var _0x2b6b7a={},_0x5abaea={},_0x3158ea={'count':0x0,'rows':[]};var _0x5b5201=_[_0x186e('0x2f')](db[_0x186e('0x30')][_0x186e('0x31')],function(_0x3fe43a){return{'name':_0x3fe43a[_0x186e('0x32')],'type':_0x3fe43a[_0x186e('0x33')][_0x186e('0x34')]};});_0x5abaea['model']=_[_0x186e('0x2f')](_0x5b5201,_0x186e('0x2c'));_0x5abaea[_0x186e('0x35')]=_['keys'](_0x4bd334[_0x186e('0x35')]);_0x5abaea[_0x186e('0x36')]=_[_0x186e('0x37')](_0x5abaea[_0x186e('0x38')],_0x5abaea[_0x186e('0x35')]);_0x2b6b7a[_0x186e('0x39')]=_[_0x186e('0x37')](_0x5abaea['model'],qs['fields'](_0x4bd334[_0x186e('0x35')][_0x186e('0x3a')]));_0x2b6b7a[_0x186e('0x39')]=_0x2b6b7a[_0x186e('0x39')][_0x186e('0x3b')]?_0x2b6b7a[_0x186e('0x39')]:_0x5abaea[_0x186e('0x38')];if(!_0x4bd334[_0x186e('0x35')]['hasOwnProperty']('nolimit')){_0x2b6b7a[_0x186e('0x23')]=qs['limit'](_0x4bd334[_0x186e('0x35')][_0x186e('0x23')]);_0x2b6b7a[_0x186e('0x21')]=qs[_0x186e('0x21')](_0x4bd334[_0x186e('0x35')][_0x186e('0x21')]);}_0x2b6b7a[_0x186e('0x3c')]=qs[_0x186e('0x3d')](_0x4bd334[_0x186e('0x35')][_0x186e('0x3d')]);_0x2b6b7a['where']=qs[_0x186e('0x36')](_[_0x186e('0x3e')](_0x4bd334[_0x186e('0x35')],_0x5abaea['filters']),_0x5b5201);if(_0x4bd334[_0x186e('0x35')][_0x186e('0x3f')]){_0x2b6b7a['where']=_[_0x186e('0x40')](_0x2b6b7a['where'],{'$or':_['map'](_0x5b5201,function(_0x1bfef7){if(_0x1bfef7[_0x186e('0x33')]!==_0x186e('0x41')){var _0x835479={};_0x835479[_0x1bfef7[_0x186e('0x2c')]]={'$like':'%'+_0x4bd334[_0x186e('0x35')][_0x186e('0x3f')]+'%'};return _0x835479;}})});}_0x2b6b7a=_[_0x186e('0x40')]({},_0x2b6b7a,_0x4bd334[_0x186e('0x42')]);var _0x4746a3={'where':_0x2b6b7a['where']};return db[_0x186e('0x30')][_0x186e('0x24')](_0x4746a3)['then'](function(_0x5ed296){_0x3158ea[_0x186e('0x24')]=_0x5ed296;if(_0x4bd334[_0x186e('0x35')]['includeAll']){_0x2b6b7a['include']=[{'all':!![]}];}return db[_0x186e('0x30')][_0x186e('0x43')](_0x2b6b7a);})[_0x186e('0x14')](function(_0xd97bd0){_0x3158ea['rows']=_0xd97bd0;return _0x3158ea;})[_0x186e('0x14')](respondWithFilteredResult(_0x2ee3a5,_0x2b6b7a))[_0x186e('0x1e')](handleError(_0x2ee3a5,null));};exports[_0x186e('0x44')]=function(_0x3aadd5,_0x13a647){var _0x25a259={'raw':!![],'where':{'id':_0x3aadd5[_0x186e('0x45')]['id']}},_0x498702={};_0x498702[_0x186e('0x38')]=_[_0x186e('0x46')](db['MailMessage'][_0x186e('0x31')]);_0x498702['query']=_[_0x186e('0x46')](_0x3aadd5[_0x186e('0x35')]);_0x498702[_0x186e('0x36')]=_[_0x186e('0x37')](_0x498702[_0x186e('0x38')],_0x498702[_0x186e('0x35')]);_0x25a259[_0x186e('0x39')]=_[_0x186e('0x37')](_0x498702['model'],qs[_0x186e('0x3a')](_0x3aadd5[_0x186e('0x35')][_0x186e('0x3a')]));_0x25a259[_0x186e('0x39')]=_0x25a259[_0x186e('0x39')][_0x186e('0x3b')]?_0x25a259[_0x186e('0x39')]:_0x498702[_0x186e('0x38')];if(_0x3aadd5[_0x186e('0x35')][_0x186e('0x47')]){_0x25a259[_0x186e('0x48')]=[{'all':!![]}];}_0x25a259=_[_0x186e('0x40')]({},_0x25a259,_0x3aadd5[_0x186e('0x42')]);return db[_0x186e('0x30')]['find'](_0x25a259)['then'](handleEntityNotFound(_0x13a647,null))[_0x186e('0x14')](respondWithResult(_0x13a647,null))[_0x186e('0x1e')](handleError(_0x13a647,null));};exports[_0x186e('0x27')]=function(_0xfb05d8,_0x3ee62e){if(_0xfb05d8[_0x186e('0x49')]['id']){delete _0xfb05d8[_0x186e('0x49')]['id'];}return db[_0x186e('0x30')]['find']({'where':{'id':_0xfb05d8['params']['id']}})[_0x186e('0x14')](handleEntityNotFound(_0x3ee62e,null))['then'](saveUpdates(_0xfb05d8[_0x186e('0x49')],null))[_0x186e('0x14')](respondWithResult(_0x3ee62e,null))[_0x186e('0x1e')](handleError(_0x3ee62e,null));};exports['destroy']=function(_0x29876c,_0x582370){return db[_0x186e('0x30')][_0x186e('0x4a')]({'where':{'id':_0x29876c[_0x186e('0x45')]['id']}})[_0x186e('0x14')](handleEntityNotFound(_0x582370,null))[_0x186e('0x14')](removeEntity(_0x582370,null))[_0x186e('0x1e')](handleError(_0x582370,null));};exports[_0x186e('0x4b')]=function(_0x658b43,_0x169b38){return db[_0x186e('0x30')][_0x186e('0x4b')]()[_0x186e('0x14')](respondWithResult(_0x169b38,null))[_0x186e('0x1e')](handleError(_0x169b38,null));};exports['create']=function(_0x333340,_0x576abb){return db[_0x186e('0x30')][_0x186e('0x4c')](_0x333340[_0x186e('0x49')])[_0x186e('0x14')](function(_0x158b5c){if(_0x158b5c){if(_0x158b5c[_0x186e('0x4d')]===_0x186e('0x4e')&&!_0x158b5c[_0x186e('0x4f')]){var _0x472c82,_0x145fa5,_0x1d7c10;if(_0x333340[_0x186e('0x49')]['to']){_0x145fa5=_0x333340['body']['to'][_0x186e('0x50')](',')[0x0];}return db[_0x186e('0x51')][_0x186e('0x52')]({'where':{'id':_0x158b5c[_0x186e('0x53')]},'include':[{'model':db[_0x186e('0x54')],'as':'List','include':[{'model':db[_0x186e('0x55')],'as':_0x186e('0x56'),'where':{'email':_0x145fa5},'limit':0x1,'order':[['updatedAt',_0x186e('0x57')]]}]},{'model':db['MailServerOut'],'as':_0x186e('0x58'),'raw':!![],'include':[{'model':db[_0x186e('0x59')],'as':_0x186e('0x59'),'raw':!![]}]}]})['then'](function(_0x42f7e3){_0x472c82=_0x42f7e3;if(!_0x472c82||!_0x472c82[_0x186e('0x58')])return;var _0x5cb476=_0x472c82[_0x186e('0x5a')]();if(_0x333340[_0x186e('0x49')][_0x186e('0x5b')]&&_0x333340[_0x186e('0x49')][_0x186e('0x5b')][_0x186e('0x3b')]){for(var _0x431cd2=0x0;_0x431cd2<_0x333340[_0x186e('0x49')][_0x186e('0x5b')][_0x186e('0x3b')];_0x431cd2+=0x1){_0x333340[_0x186e('0x49')]['attachments'][_0x431cd2]={'filename':_0x333340[_0x186e('0x49')][_0x186e('0x5b')][_0x431cd2]['name'],'path':path['join'](config[_0x186e('0x5c')],'server/files/attachments',_0x333340[_0x186e('0x49')][_0x186e('0x5b')][_0x431cd2][_0x186e('0x5d')])};}}_0x1d7c10={'account':_0x5cb476,'message':_0x333340[_0x186e('0x49')]};return;})[_0x186e('0x14')](function(){if(_0x472c82[_0x186e('0x5e')]){if(_0x472c82[_0x186e('0x5e')][_0x186e('0x56')][_0x186e('0x3b')]){return _0x472c82['List'][_0x186e('0x56')][0x0];}else{return db[_0x186e('0x55')][_0x186e('0x4c')](_[_0x186e('0xc')](_0x333340['body'],{'firstName':_0x333340[_0x186e('0x49')]['to'],'email':_0x333340['body']['to'],'phone':_0x333340[_0x186e('0x49')]['to'],'ListId':_0x472c82[_0x186e('0x5f')]}));}}else{throw new Error(_0x186e('0x60'));}})[_0x186e('0x14')](function(){if(_0x1d7c10){return respondWithRpcPromise(_0x186e('0x61'),_0x186e('0x62'),_0x1d7c10,client9003)['then'](function(_0x25034a){return _0x158b5c[_0x186e('0x27')]({'read':!![],'messageId':_0x25034a[_0x186e('0x63')],'sentAt':moment()[_0x186e('0x64')](_0x186e('0x65'))});})['catch'](function(_0x3acb6e){logger['error']('%s',JSON[_0x186e('0x18')](_0x3acb6e));return _0x158b5c;});}return _0x158b5c;});}return _0x158b5c;}})[_0x186e('0x14')](respondWithResult(_0x576abb,0xc9))['catch'](handleError(_0x576abb,null));};exports[_0x186e('0x66')]=function(_0x51b802,_0x54df9c){var _0xb39ace={'agent':{},'channel':'mail'};if(_0x51b802[_0x186e('0x49')]['id']){delete _0x51b802[_0x186e('0x49')]['id'];}_0x51b802['body']['read']=!![];_0x51b802[_0x186e('0x49')]['readAt']=moment()[_0x186e('0x64')](_0x186e('0x65'));_0x51b802[_0x186e('0x49')]['UserId']=_0x51b802[_0x186e('0x49')][_0x186e('0x67')]||_0x51b802[_0x186e('0x68')]['id'];_0xb39ace[_0x186e('0x69')]['id']=_0x51b802[_0x186e('0x49')][_0x186e('0x67')];return db['MailMessage'][_0x186e('0x4a')]({'where':{'id':_0x51b802[_0x186e('0x45')]['id'],'UserId':null}})[_0x186e('0x14')](handleEntityNotFound(_0x54df9c,null))[_0x186e('0x14')](saveUpdates(_0x51b802[_0x186e('0x49')],null))[_0x186e('0x14')](function(_0x14aab6){if(_0x14aab6){_0xb39ace[_0x186e('0x1b')]=_0x14aab6[_0x186e('0x6a')]({'plain':!![]});return db[_0x186e('0x6b')][_0x186e('0x4a')]({'where':{'id':_0x14aab6[_0x186e('0x6c')]}});}return null;})[_0x186e('0x14')](handleEntityNotFound(_0x54df9c,null))['then'](function(_0x438acb){if(_0x438acb){return _0x438acb[_0x186e('0x27')]({'UserId':_0x51b802[_0x186e('0x49')][_0x186e('0x67')],'read1stAt':_[_0x186e('0x6d')](_0x438acb[_0x186e('0x6e')])?moment()[_0x186e('0x64')](_0x186e('0x65')):undefined});}return null;})[_0x186e('0x14')](function(_0x69f9d6){if(_0x69f9d6){_0xb39ace[_0x186e('0x6f')]=_0x69f9d6[_0x186e('0x6a')]({'plain':!![]});interaction_log[_0x186e('0x1c')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51b802[_0x186e('0x68')]['id'],_0x51b802[_0x186e('0x68')][_0x186e('0x2c')],_0x51b802[_0x186e('0x68')][_0x186e('0x70')],_0xb39ace[_0x186e('0x6f')]['id'],_0x51b802[_0x186e('0x49')]?JSON[_0x186e('0x18')](_0x51b802['body']):_0x186e('0x71'));return respondWithRpcPromise(_0x186e('0x72'),_0x186e('0x73'),_0xb39ace);}return null;})[_0x186e('0x14')](function(_0x4650c4){var _0x61b9ef=_0x186e('0x74')+_0x4650c4[_0x186e('0x1b')][_0x186e('0x75')];return db[_0x186e('0x76')][_0x186e('0x35')](_0x61b9ef,{'type':db[_0x186e('0x77')][_0x186e('0x78')][_0x186e('0x79')],'raw':!![]})[_0x186e('0x14')](function(_0x266fa6){return _0x266fa6;});})[_0x186e('0x14')](function(_0x591af3){if(_0x591af3){_0xb39ace[_0x186e('0x1b')][_0x186e('0x7a')]=_0x591af3[0x0];if(!_0x51b802[_0x186e('0x49')][_0x186e('0x67')])return;return db[_0x186e('0x7b')]['find']({'where':{'id':_0x51b802['body']['UserId'],'role':_0x186e('0x69')},'attributes':['id',_0x186e('0x2c'),_0x186e('0x7c'),'email',_0x186e('0x7d')],'raw':!![]});}return null;})[_0x186e('0x14')](function(_0x3ef2df){if(!_0x3ef2df)return null;_0xb39ace[_0x186e('0x1b')][_0x186e('0x69')]=_0x3ef2df;return _0xb39ace;})[_0x186e('0x14')](function(_0x3beb5b){if(_0x3beb5b){if(_0x51b802['body'][_0x186e('0x7e')]){_0xb39ace[_0x186e('0x1b')][_0x186e('0x7f')]=util[_0x186e('0x64')](_0x186e('0x80'),_0x51b802[_0x186e('0x68')][_0x186e('0x2c')]);_0xb39ace['message'][_0x186e('0x81')]=_0xb39ace[_0x186e('0x81')];_0xb39ace[_0x186e('0x1b')][_0x186e('0x82')]=_0xb39ace[_0x186e('0x81')];_0xb39ace[_0x186e('0x1b')]['event']=_0x186e('0x66');_0xb39ace['message']['body']=htmlToText[_0x186e('0x83')](_0xb39ace['message'][_0x186e('0x49')]);return respondWithRpcPromise(_0x186e('0x84'),_0x186e('0x84'),{'event':_0x186e('0x85'),'message':_0xb39ace['message']},client9002)[_0x186e('0x14')](function(){return _0xb39ace;});}return _0xb39ace;}return null;})[_0x186e('0x14')](respondWithResult(_0x54df9c,null))[_0x186e('0x1e')](handleError(_0x54df9c,null));};exports[_0x186e('0x86')]=function(_0x4649d4,_0x3f3f1f){var _0x400a96={'agent':{},'channel':_0x186e('0x87')};if(_0x4649d4[_0x186e('0x49')]['id']){delete _0x4649d4[_0x186e('0x49')]['id'];}_0x4649d4[_0x186e('0x49')][_0x186e('0x67')]=_0x4649d4[_0x186e('0x49')][_0x186e('0x67')]||_0x4649d4[_0x186e('0x68')]['id'];_0x400a96['agent']['id']=_0x4649d4['body']['UserId'];return db[_0x186e('0x30')][_0x186e('0x4a')]({'where':{'id':_0x4649d4[_0x186e('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3f3f1f,null))[_0x186e('0x14')](function(_0xc3005a){if(_0xc3005a){_0x400a96['message']=_0xc3005a[_0x186e('0x6a')]({'plain':!![]});return db[_0x186e('0x6b')][_0x186e('0x4a')]({'where':{'id':_0xc3005a['MailInteractionId']}});}return null;})[_0x186e('0x14')](handleEntityNotFound(_0x3f3f1f,null))['then'](function(_0x1bf97f){if(_0x1bf97f){_0x400a96[_0x186e('0x6f')]=_0x1bf97f['get']({'plain':!![]});interaction_log[_0x186e('0x1c')](_0x186e('0x88'),_0x4649d4['user']['id'],_0x4649d4[_0x186e('0x68')][_0x186e('0x2c')],_0x4649d4[_0x186e('0x68')][_0x186e('0x70')],_0x400a96[_0x186e('0x6f')]['id'],_0x4649d4['body']?JSON[_0x186e('0x18')](_0x4649d4[_0x186e('0x49')]):'null');return respondWithRpcPromise('RejectMessage',_0x186e('0x89'),_0x400a96);}return null;})[_0x186e('0x14')](function(_0x532f90){var _0x1d3c1f=_0x186e('0x74')+_0x532f90[_0x186e('0x1b')][_0x186e('0x75')];return db[_0x186e('0x76')]['query'](_0x1d3c1f,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x186e('0x14')](function(_0x3a9827){return _0x3a9827;});})[_0x186e('0x14')](function(_0x5164f1){if(_0x5164f1){_0x400a96[_0x186e('0x1b')][_0x186e('0x7a')]=_0x5164f1[0x0];if(!_0x4649d4['body']['UserId'])return;return db[_0x186e('0x7b')][_0x186e('0x4a')]({'where':{'id':_0x4649d4[_0x186e('0x49')]['UserId'],'role':_0x186e('0x69')},'attributes':['id',_0x186e('0x2c'),'fullname',_0x186e('0x8a'),_0x186e('0x7d')],'raw':!![]});}return null;})[_0x186e('0x14')](function(_0xc104e2){if(!_0xc104e2)return null;_0x400a96[_0x186e('0x1b')][_0x186e('0x69')]=_0xc104e2;return _0x400a96;})['then'](function(_0x27c73a){if(_0x27c73a){_0x27c73a[_0x186e('0x1b')][_0x186e('0x7f')]=util[_0x186e('0x64')](_0x186e('0x80'),_0x4649d4[_0x186e('0x68')]['name']);_0x27c73a['message']['channel']=_0x400a96[_0x186e('0x81')];_0x27c73a[_0x186e('0x1b')][_0x186e('0x82')]=_0x400a96[_0x186e('0x81')];_0x27c73a[_0x186e('0x1b')][_0x186e('0x8b')]='reject';_0x27c73a[_0x186e('0x1b')]['body']=htmlToText[_0x186e('0x83')](_0x400a96['message'][_0x186e('0x49')]);respondWithRpcPromise(_0x186e('0x84'),_0x186e('0x84'),{'event':_0x186e('0x8c'),'message':_0x27c73a['message']},client9002);return _0x400a96;}return null;})['then'](respondWithResult(_0x3f3f1f,null))[_0x186e('0x1e')](handleError(_0x3f3f1f,null));};exports['download']=function(_0x1b379c,_0x4baeb3){var _0x56c003=moment()['unix']()[_0x186e('0x8d')]();var _0x587257=path[_0x186e('0x8e')](config[_0x186e('0x5c')],_0x186e('0x8f'),_0x186e('0x90'),_0x186e('0x91'));var _0x1b59fa=path[_0x186e('0x8e')](config[_0x186e('0x5c')],_0x186e('0x8f'),_0x186e('0x90'),'attachments');var _0x2c9cd8=util['format']('message-%s.eml',_0x56c003);return db['MailMessage'][_0x186e('0x4a')]({'where':{'id':_0x1b379c[_0x186e('0x45')]['id']},'attributes':['id',_0x186e('0x49'),_0x186e('0x92'),'to','cc','bcc','subject',_0x186e('0x93')],'include':_0x1b379c[_0x186e('0x35')]['attachments']?[{'model':db[_0x186e('0x94')],'as':'Attachments'}]:undefined})[_0x186e('0x14')](handleEntityNotFound(_0x4baeb3,null))['then'](function(_0x36a9fe){if(_0x36a9fe){var _0x682ea=_0x36a9fe;var _0x343acf={'from':_0x682ea[_0x186e('0x92')],'to':_0x682ea['to'],'subject':_0x682ea['subject'],'html':htmlEntities['decode'](_0x682ea[_0x186e('0x49')]),'headers':{'Date':moment(_0x682ea[_0x186e('0x93')])[_0x186e('0x64')](_0x186e('0x95'))},'attachments':[]};if(_0x36a9fe['cc']){_0x343acf[_0x186e('0x96')]['Cc']=_0x36a9fe['cc'];}if(_0x36a9fe[_0x186e('0x97')]){_0x343acf[_0x186e('0x96')][_0x186e('0x98')]=_0x36a9fe[_0x186e('0x97')];}return new BPromise(function(_0x42a603,_0x3430ce){if(_0x36a9fe[_0x186e('0x99')]){for(var _0x23316d=0x0;_0x23316d<_0x36a9fe['Attachments']['length'];_0x23316d++){var _0x7630e4=_0x36a9fe[_0x186e('0x99')][_0x23316d];var _0x34b0bb=path[_0x186e('0x8e')](_0x1b59fa,_0x7630e4['basename']);if(fs[_0x186e('0x9a')](_0x34b0bb)){_0x343acf[_0x186e('0x5b')]['push']({'name':_0x7630e4[_0x186e('0x2c')],'contentType':_0x7630e4[_0x186e('0x33')],'data':fs[_0x186e('0x9b')](_0x34b0bb)});}}}emlformat['build'](_0x343acf,function(_0x463b8a,_0x572163){if(_0x463b8a)return _0x3430ce(_0x463b8a);fs['writeFileSync'](path[_0x186e('0x8e')](_0x587257,_0x2c9cd8),_0x572163);return _0x42a603(_0x572163);});});}})[_0x186e('0x14')](function(_0x2ef61c){if(_0x2ef61c){return _0x4baeb3[_0x186e('0x9c')](path['join'](_0x587257,_0x2c9cd8),_0x2c9cd8,function(_0x7a6c1a){if(!_0x7a6c1a)fs[_0x186e('0x9d')](path[_0x186e('0x8e')](_0x587257,_0x2c9cd8));});}})[_0x186e('0x1e')](handleError(_0x4baeb3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index faae74d..bdb90fa 100644 --- a/server/api/mailMessage/mailMessage.events.js +++ b/server/api/mailMessage/mailMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf04e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','update','remove'];(function(_0xc1a4cf,_0x17141b){var _0x2930d1=function(_0x2e6e7a){while(--_0x2e6e7a){_0xc1a4cf['push'](_0xc1a4cf['shift']());}};_0x2930d1(++_0x17141b);}(_0xf04e,0xdc));var _0xef04=function(_0x5d7c2d,_0x30062a){_0x5d7c2d=_0x5d7c2d-0x0;var _0x890dd=_0xf04e[_0x5d7c2d];return _0x890dd;};'use strict';var EventEmitter=require(_0xef04('0x0'));var MailMessage=require(_0xef04('0x1'))['db'][_0xef04('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xef04('0x3'),'afterDestroy':_0xef04('0x4')};function emitEvent(_0x5a5181){return function(_0x4f4c58,_0x38e5d6,_0x40ffac){MailMessageEvents[_0xef04('0x5')](_0x5a5181+':'+_0x4f4c58['id'],_0x4f4c58);MailMessageEvents['emit'](_0x5a5181,_0x4f4c58);_0x40ffac(null);};}for(var e in events){if(events[_0xef04('0x6')](e)){var event=events[e];MailMessage[_0xef04('0x7')](e,emitEvent(event));}}module[_0xef04('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xcad6=['remove','emit','hook','exports','events','../../mysqldb','save','update'];(function(_0x11717d,_0x2a0cd2){var _0x20a355=function(_0x4563c8){while(--_0x4563c8){_0x11717d['push'](_0x11717d['shift']());}};_0x20a355(++_0x2a0cd2);}(_0xcad6,0x13c));var _0x6cad=function(_0x14d894,_0x44a207){_0x14d894=_0x14d894-0x0;var _0xcf56ac=_0xcad6[_0x14d894];return _0xcf56ac;};'use strict';var EventEmitter=require(_0x6cad('0x0'));var MailMessage=require(_0x6cad('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6cad('0x2'),'afterUpdate':_0x6cad('0x3'),'afterDestroy':_0x6cad('0x4')};function emitEvent(_0x39d0db){return function(_0x2ab689,_0x126103,_0x3fff04){MailMessageEvents[_0x6cad('0x5')](_0x39d0db+':'+_0x2ab689['id'],_0x2ab689);MailMessageEvents['emit'](_0x39d0db,_0x2ab689);_0x3fff04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x6cad('0x6')](e,emitEvent(event));}}module[_0x6cad('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index d6f8a25..b270b2d 100644 --- a/server/api/mailMessage/mailMessage.model.js +++ b/server/api/mailMessage/mailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80ce=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','plainBody','fromString','body','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4'];(function(_0x4d4b16,_0x2e1d97){var _0x985aca=function(_0x3e6902){while(--_0x3e6902){_0x4d4b16['push'](_0x4d4b16['shift']());}};_0x985aca(++_0x2e1d97);}(_0x80ce,0x15f));var _0xe80c=function(_0x13cefa,_0x3aec7a){_0x13cefa=_0x13cefa-0x0;var _0x2183ff=_0x80ce[_0x13cefa];return _0x2183ff;};'use strict';var _=require(_0xe80c('0x0'));var util=require(_0xe80c('0x1'));var logger=require(_0xe80c('0x2'))(_0xe80c('0x3'));var moment=require(_0xe80c('0x4'));var BPromise=require(_0xe80c('0x5'));var rp=require('request-promise');var htmlToText=require(_0xe80c('0x6'));var fs=require('fs');var path=require(_0xe80c('0x7'));var rimraf=require(_0xe80c('0x8'));var config=require('../../config/environment');var attributes=require(_0xe80c('0x9'));module[_0xe80c('0xa')]=function(_0x643783,_0x58e8ad){return _0x643783[_0xe80c('0xb')](_0xe80c('0xc'),attributes,{'tableName':_0xe80c('0xd'),'paranoid':![],'indexes':[{'name':_0xe80c('0xe'),'fields':[_0xe80c('0xe')]},{'name':_0xe80c('0xf'),'fields':['plainBody',_0xe80c('0x10')],'type':_0xe80c('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4488ab,_0x462cbd,_0x15710c){if(_0x4488ab['body']){_0x4488ab[_0xe80c('0x12')]=htmlToText[_0xe80c('0x13')](_0x4488ab[_0xe80c('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x15710c(null,_0x462cbd);},'afterCreate':function(_0x38bb31,_0x372fb6,_0x17fce9){var _0x1d7453=_0x643783['models'];var _0x2328a6=_0x38bb31['get']({'plain':!![]});if(_0x2328a6[_0xe80c('0x15')]['toLowerCase']()==='in'||_0x2328a6['direction'][_0xe80c('0x16')]()===_0xe80c('0x17')&&!_0x2328a6[_0xe80c('0x18')]&&!_[_0xe80c('0x19')](_0x2328a6[_0xe80c('0x1a')])){_0x1d7453['MailInteraction'][_0xe80c('0x1b')]({'where':{'id':_0x2328a6[_0xe80c('0x1c')]}})[_0xe80c('0x1d')](function(_0x14a246){if(_0x14a246){_0x14a246[_0xe80c('0x1e')]({'lastMsgAt':_0x2328a6[_0xe80c('0x1f')],'lastMsgDirection':_0x2328a6[_0xe80c('0x15')][_0xe80c('0x16')]()});}})['catch'](function(_0x13767a){console[_0xe80c('0x20')](_0x13767a);});}_0x17fce9();}},'charset':_0xe80c('0x21'),'collate':_0xe80c('0x22')});}; \ No newline at end of file +var _0x5d9c=['../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','subject','body','plainBody','fromString','models','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf'];(function(_0x498ab9,_0x239846){var _0x301028=function(_0x2eed03){while(--_0x2eed03){_0x498ab9['push'](_0x498ab9['shift']());}};_0x301028(++_0x239846);}(_0x5d9c,0xde));var _0xc5d9=function(_0x23b55d,_0x12ec69){_0x23b55d=_0x23b55d-0x0;var _0x5d1109=_0x5d9c[_0x23b55d];return _0x5d1109;};'use strict';var _=require(_0xc5d9('0x0'));var util=require(_0xc5d9('0x1'));var logger=require('../../config/logger')(_0xc5d9('0x2'));var moment=require(_0xc5d9('0x3'));var BPromise=require(_0xc5d9('0x4'));var rp=require(_0xc5d9('0x5'));var htmlToText=require(_0xc5d9('0x6'));var fs=require('fs');var path=require(_0xc5d9('0x7'));var rimraf=require(_0xc5d9('0x8'));var config=require(_0xc5d9('0x9'));var attributes=require(_0xc5d9('0xa'));module[_0xc5d9('0xb')]=function(_0x4a84ef,_0x37d54e){return _0x4a84ef[_0xc5d9('0xc')]('MailMessage',attributes,{'tableName':_0xc5d9('0xd'),'paranoid':![],'indexes':[{'name':_0xc5d9('0xe'),'fields':[_0xc5d9('0xe')]},{'name':_0xc5d9('0xf'),'fields':['plainBody',_0xc5d9('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a367e,_0x5da7cd,_0x128476){if(_0x3a367e[_0xc5d9('0x11')]){_0x3a367e[_0xc5d9('0x12')]=htmlToText[_0xc5d9('0x13')](_0x3a367e[_0xc5d9('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x128476(null,_0x5da7cd);},'afterCreate':function(_0x5c103a,_0x4b10db,_0x201cbd){var _0x2b4706=_0x4a84ef[_0xc5d9('0x14')];var _0x31490a=_0x5c103a['get']({'plain':!![]});if(_0x31490a[_0xc5d9('0x15')]['toLowerCase']()==='in'||_0x31490a[_0xc5d9('0x15')][_0xc5d9('0x16')]()===_0xc5d9('0x17')&&!_0x31490a[_0xc5d9('0x18')]&&!_[_0xc5d9('0x19')](_0x31490a['UserId'])){_0x2b4706[_0xc5d9('0x1a')][_0xc5d9('0x1b')]({'where':{'id':_0x31490a[_0xc5d9('0x1c')]}})[_0xc5d9('0x1d')](function(_0xf67838){if(_0xf67838){_0xf67838[_0xc5d9('0x1e')]({'lastMsgAt':_0x31490a['createdAt'],'lastMsgDirection':_0x31490a[_0xc5d9('0x15')][_0xc5d9('0x16')]()});}})['catch'](function(_0x5b08b2){console[_0xc5d9('0x1f')](_0x5b08b2);});}_0x201cbd();}},'charset':_0xc5d9('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1b79524..49bdf41 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea28=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateMailMessage','MailMessage','body','options','raw','stringify','lodash'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0xea28,0x13a));var _0x8ea2=function(_0x2c9edc,_0x5599a6){_0x2c9edc=_0x2c9edc-0x0;var _0x1751f4=_0xea28[_0x2c9edc];return _0x1751f4;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});config[_0x8ea2('0xc')]=_[_0x8ea2('0xd')](config[_0x8ea2('0xc')],{'host':_0x8ea2('0xe'),'port':0x18eb});var socket=require(_0x8ea2('0xf'))(new Redis(config[_0x8ea2('0xc')]));require(_0x8ea2('0x10'))[_0x8ea2('0x11')](socket);function respondWithRpcPromise(_0x3000f9,_0x3d0b35,_0x21ae3d){return new BPromise(function(_0x500b82,_0x4da3b1){return client[_0x8ea2('0x12')](_0x3000f9,_0x21ae3d)[_0x8ea2('0x13')](function(_0x374973){logger['info'](_0x8ea2('0x14'),_0x3d0b35,_0x8ea2('0x15'));logger[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x3d0b35,_0x8ea2('0x15'),JSON['stringify'](_0x374973));if(_0x374973[_0x8ea2('0x18')]){if(_0x374973['error']['code']===0x1f4){logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);return _0x4da3b1(_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);}logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);return _0x500b82(_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);}else{logger[_0x8ea2('0x1a')](_0x8ea2('0x14'),_0x3d0b35,_0x8ea2('0x15'));_0x500b82(_0x374973[_0x8ea2('0x1b')][_0x8ea2('0x19')]);}})[_0x8ea2('0x1c')](function(_0x1068b6){logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x1068b6);_0x4da3b1(_0x1068b6);});});}exports[_0x8ea2('0x1d')]=function(_0x52b58c){var _0x4be7c9=this;return new Promise(function(_0x3790e9,_0x248c18){return db[_0x8ea2('0x1e')]['create'](_0x52b58c[_0x8ea2('0x1f')],{'raw':_0x52b58c[_0x8ea2('0x20')]?_0x52b58c['options'][_0x8ea2('0x21')]===undefined?!![]:![]:!![]})[_0x8ea2('0x13')](function(_0x37229a){logger[_0x8ea2('0x1a')](_0x8ea2('0x1d'),_0x52b58c);logger[_0x8ea2('0x16')](_0x8ea2('0x1d'),_0x52b58c,JSON[_0x8ea2('0x22')](_0x37229a));_0x3790e9(_0x37229a);})[_0x8ea2('0x1c')](function(_0x4d5030){logger[_0x8ea2('0x18')]('CreateMailMessage',_0x4d5030[_0x8ea2('0x19')],_0x52b58c);_0x248c18(_0x4be7c9[_0x8ea2('0x18')](0x1f4,_0x4d5030[_0x8ea2('0x19')]));});});}; \ No newline at end of file +var _0x1893=['result','MailMessage','body','options','CreateMailMessage','debug','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xed22fb,_0xe4034d){var _0xf02612=function(_0x3fe620){while(--_0x3fe620){_0xed22fb['push'](_0xed22fb['shift']());}};_0xf02612(++_0xe4034d);}(_0x1893,0xa2));var _0x3189=function(_0x19a2eb,_0x2df439){_0x19a2eb=_0x19a2eb-0x0;var _0x3c8514=_0x1893[_0x19a2eb];return _0x3c8514;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});config[_0x3189('0xb')]=_[_0x3189('0xc')](config[_0x3189('0xb')],{'host':_0x3189('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3189('0xb')]));require('./mailMessage.socket')[_0x3189('0xe')](socket);function respondWithRpcPromise(_0x4ac683,_0x3ec9d0,_0x33cdfb){return new BPromise(function(_0xca480c,_0x176799){return client['request'](_0x4ac683,_0x33cdfb)[_0x3189('0xf')](function(_0x149428){logger[_0x3189('0x10')](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));logger['debug'](_0x3189('0x13'),_0x3ec9d0,_0x3189('0x12'),JSON[_0x3189('0x14')](_0x149428));if(_0x149428[_0x3189('0x15')]){if(_0x149428[_0x3189('0x15')][_0x3189('0x16')]===0x1f4){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0x149428['error'][_0x3189('0x17')]);return _0x176799(_0x149428[_0x3189('0x15')][_0x3189('0x17')]);}logger[_0x3189('0x15')]('MailMessage,\x20%s,\x20%s',_0x3ec9d0,_0x149428[_0x3189('0x15')]['message']);return _0xca480c(_0x149428['error'][_0x3189('0x17')]);}else{logger['info'](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));_0xca480c(_0x149428[_0x3189('0x18')][_0x3189('0x17')]);}})['catch'](function(_0xd3d5a){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0xd3d5a);_0x176799(_0xd3d5a);});});}exports['CreateMailMessage']=function(_0x561265){var _0xb0e89b=this;return new Promise(function(_0x306ed3,_0x2c1e59){return db[_0x3189('0x19')]['create'](_0x561265[_0x3189('0x1a')],{'raw':_0x561265[_0x3189('0x1b')]?_0x561265[_0x3189('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3189('0xf')](function(_0x47abb4){logger[_0x3189('0x10')](_0x3189('0x1c'),_0x561265);logger[_0x3189('0x1d')](_0x3189('0x1c'),_0x561265,JSON[_0x3189('0x14')](_0x47abb4));_0x306ed3(_0x47abb4);})[_0x3189('0x1e')](function(_0x5a08dc){logger['error'](_0x3189('0x1c'),_0x5a08dc[_0x3189('0x17')],_0x561265);_0x2c1e59(_0xb0e89b[_0x3189('0x15')](0x1f4,_0x5a08dc[_0x3189('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 2eb3e5c..5fd43b1 100644 --- a/server/api/mailMessage/mailMessage.socket.js +++ b/server/api/mailMessage/mailMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c7b=['remove','update','removeListener','length','mailMessage:','./mailMessage.events','save'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x316582,_0x2e622b){_0x316582=_0x316582-0x0;var _0x3c569b=_0x3c7b[_0x316582];return _0x3c569b;};'use strict';var MailMessageEvents=require(_0xb3c7('0x0'));var events=[_0xb3c7('0x1'),_0xb3c7('0x2'),_0xb3c7('0x3')];function createListener(_0x22a73c,_0x4e4405){return function(_0x4a83a4){_0x4e4405['emit'](_0x22a73c,_0x4a83a4);};}function removeListener(_0x5b34ef,_0x234fe5){return function(){MailMessageEvents[_0xb3c7('0x4')](_0x5b34ef,_0x234fe5);};}exports['register']=function(_0x396a46){for(var _0x5b810b=0x0,_0x255f3d=events[_0xb3c7('0x5')];_0x5b810b<_0x255f3d;_0x5b810b++){var _0x341a27=events[_0x5b810b];var _0x1851a5=createListener(_0xb3c7('0x6')+_0x341a27,_0x396a46);MailMessageEvents['on'](_0x341a27,_0x1851a5);}}; \ No newline at end of file +var _0x98fc=['remove','update','removeListener','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x402b4b,_0x46a6c2){var _0x4ec558=function(_0x3dd09f){while(--_0x3dd09f){_0x402b4b['push'](_0x402b4b['shift']());}};_0x4ec558(++_0x46a6c2);}(_0x98fc,0x156));var _0xc98f=function(_0x3cec45,_0x37d817){_0x3cec45=_0x3cec45-0x0;var _0x51d691=_0x98fc[_0x3cec45];return _0x51d691;};'use strict';var MailMessageEvents=require(_0xc98f('0x0'));var events=[_0xc98f('0x1'),_0xc98f('0x2'),_0xc98f('0x3')];function createListener(_0x95aeea,_0x5af26a){return function(_0xf22d8e){_0x5af26a['emit'](_0x95aeea,_0xf22d8e);};}function removeListener(_0x15f9da,_0x5c0de6){return function(){MailMessageEvents[_0xc98f('0x4')](_0x15f9da,_0x5c0de6);};}exports[_0xc98f('0x5')]=function(_0x184990){for(var _0x45d113=0x0,_0x3237e1=events[_0xc98f('0x6')];_0x45d113<_0x3237e1;_0x45d113++){var _0x28f276=events[_0x45d113];var _0x191b3f=createListener(_0xc98f('0x7')+_0x28f276,_0x184990);MailMessageEvents['on'](_0x28f276,_0x191b3f);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index be31127..6874f0f 100644 --- a/server/api/mailQueue/index.js +++ b/server/api/mailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdba7=['/:id','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','index','/describe','isAuthenticated','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','put'];(function(_0x5279d3,_0x250104){var _0x1bc295=function(_0x4c6d21){while(--_0x4c6d21){_0x5279d3['push'](_0x5279d3['shift']());}};_0x1bc295(++_0x250104);}(_0xdba7,0x1ca));var _0x7dba=function(_0x2cdd80,_0x1edcd0){_0x2cdd80=_0x2cdd80-0x0;var _0x4d81e3=_0xdba7[_0x2cdd80];return _0x4d81e3;};'use strict';var multer=require(_0x7dba('0x0'));var util=require(_0x7dba('0x1'));var path=require(_0x7dba('0x2'));var timeout=require(_0x7dba('0x3'));var express=require(_0x7dba('0x4'));var router=express[_0x7dba('0x5')]();var fs_extra=require(_0x7dba('0x6'));var auth=require(_0x7dba('0x7'));var interaction=require(_0x7dba('0x8'));var config=require('../../config/environment');var controller=require(_0x7dba('0x9'));router[_0x7dba('0xa')]('/',auth['isAuthenticated'](),controller[_0x7dba('0xb')]);router[_0x7dba('0xa')](_0x7dba('0xc'),auth[_0x7dba('0xd')](),controller['describe']);router[_0x7dba('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7dba('0xa')](_0x7dba('0xe'),auth[_0x7dba('0xd')](),controller[_0x7dba('0xf')]);router[_0x7dba('0xa')](_0x7dba('0x10'),auth[_0x7dba('0xd')](),controller[_0x7dba('0x11')]);router[_0x7dba('0xa')]('/:id/users',auth[_0x7dba('0xd')](),controller[_0x7dba('0x12')]);router[_0x7dba('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7dba('0x13')](_0x7dba('0x10'),auth[_0x7dba('0xd')](),controller[_0x7dba('0x14')]);router[_0x7dba('0x13')]('/:id/users',auth[_0x7dba('0xd')](),controller['addAgents']);router[_0x7dba('0x15')](_0x7dba('0x16'),auth[_0x7dba('0xd')](),controller[_0x7dba('0x17')]);router[_0x7dba('0x18')](_0x7dba('0x16'),auth[_0x7dba('0xd')](),controller[_0x7dba('0x19')]);router[_0x7dba('0x18')](_0x7dba('0x10'),auth[_0x7dba('0xd')](),controller[_0x7dba('0x1a')]);router[_0x7dba('0x18')](_0x7dba('0x1b'),auth[_0x7dba('0xd')](),controller[_0x7dba('0x1c')]);module[_0x7dba('0x1d')]=router; \ No newline at end of file +var _0x0770=['./mailQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','delete','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x4f0968,_0xe7d989){var _0x1abf00=function(_0x23071c){while(--_0x23071c){_0x4f0968['push'](_0x4f0968['shift']());}};_0x1abf00(++_0xe7d989);}(_0x0770,0x1d4));var _0x0077=function(_0xda127b,_0x3792b4){_0xda127b=_0xda127b-0x0;var _0x4f9ddb=_0x0770[_0xda127b];return _0x4f9ddb;};'use strict';var multer=require(_0x0077('0x0'));var util=require(_0x0077('0x1'));var path=require(_0x0077('0x2'));var timeout=require(_0x0077('0x3'));var express=require(_0x0077('0x4'));var router=express['Router']();var fs_extra=require(_0x0077('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0077('0x6'));var controller=require(_0x0077('0x7'));router['get']('/',auth[_0x0077('0x8')](),controller['index']);router[_0x0077('0x9')](_0x0077('0xa'),auth[_0x0077('0x8')](),controller[_0x0077('0xb')]);router['get'](_0x0077('0xc'),auth['isAuthenticated'](),controller[_0x0077('0xd')]);router[_0x0077('0x9')]('/:id/members',auth[_0x0077('0x8')](),controller[_0x0077('0xe')]);router[_0x0077('0x9')](_0x0077('0xf'),auth['isAuthenticated'](),controller[_0x0077('0x10')]);router[_0x0077('0x9')](_0x0077('0x11'),auth[_0x0077('0x8')](),controller[_0x0077('0x12')]);router[_0x0077('0x13')]('/',auth[_0x0077('0x8')](),controller['create']);router[_0x0077('0x13')]('/:id/teams',auth[_0x0077('0x8')](),controller['addTeams']);router[_0x0077('0x13')](_0x0077('0x11'),auth[_0x0077('0x8')](),controller[_0x0077('0x14')]);router[_0x0077('0x15')](_0x0077('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0077('0x16')]('/:id',auth[_0x0077('0x8')](),controller['destroy']);router['delete'](_0x0077('0xf'),auth[_0x0077('0x8')](),controller[_0x0077('0x17')]);router[_0x0077('0x16')](_0x0077('0x11'),auth[_0x0077('0x8')](),controller['removeAgents']);module[_0x0077('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 761a8b9..ff7990b 100644 --- a/server/api/mailQueue/mailQueue.attributes.js +++ b/server/api/mailQueue/mailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3207=['INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3db0a6,_0x48f0de){var _0x224b08=function(_0x1ea941){while(--_0x1ea941){_0x3db0a6['push'](_0x3db0a6['shift']());}};_0x224b08(++_0x48f0de);}(_0x3207,0x82));var _0x7320=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x3207[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x7320('0x0'));module[_0x7320('0x1')]={'name':{'type':Sequelize[_0x7320('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7320('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7320('0x4')]('rrmemory',_0x7320('0x5'),_0x7320('0x6'))}}; \ No newline at end of file +var _0x9ca9=['exports','rrmemory','beepall','roundrobin'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0x9ca9,0xa8));var _0x99ca=function(_0x487b43,_0x210e39){_0x487b43=_0x487b43-0x0;var _0x822e7=_0x9ca9[_0x487b43];return _0x822e7;};'use strict';var Sequelize=require('sequelize');module[_0x99ca('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x99ca('0x1'),_0x99ca('0x2'),_0x99ca('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 489eb8f..69e2abb 100644 --- a/server/api/mailQueue/mailQueue.controller.js +++ b/server/api/mailQueue/mailQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe79c=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','MailQueues','UserProfileResource','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','hasOwnProperty','sort','where','pick','filter','merge','options','MailQueue','includeAll','include','catch','show','params','fields','find','create','body','user','get','UserProfileSection','describe','findOne','length','nolimit','order','MailQueueId','findAll','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','rows','%s/%s','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','UserMailQueue','findOrCreate','emit','userMailQueue:save','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x1e5284,_0x105087){var _0x53f607=function(_0x532c3a){while(--_0x532c3a){_0x1e5284['push'](_0x1e5284['shift']());}};_0x53f607(++_0x105087);}(_0xe79c,0x106));var _0xce79=function(_0x3b9db5,_0x23c06e){_0x3b9db5=_0x3b9db5-0x0;var _0xf70c3=_0xe79c[_0x3b9db5];return _0xf70c3;};'use strict';var emlformat=require(_0xce79('0x0'));var rimraf=require(_0xce79('0x1'));var zipdir=require(_0xce79('0x2'));var jsonpatch=require(_0xce79('0x3'));var rp=require(_0xce79('0x4'));var moment=require(_0xce79('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xce79('0x6'));var util=require(_0xce79('0x7'));var path=require(_0xce79('0x8'));var sox=require(_0xce79('0x9'));var csv=require('to-csv');var ejs=require(_0xce79('0xa'));var fs=require('fs');var fs_extra=require(_0xce79('0xb'));var _=require(_0xce79('0xc'));var squel=require(_0xce79('0xd'));var crypto=require('crypto');var jsforce=require(_0xce79('0xe'));var deskjs=require(_0xce79('0xf'));var toCsv=require(_0xce79('0x10'));var querystring=require(_0xce79('0x11'));var Papa=require(_0xce79('0x12'));var Redis=require(_0xce79('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xce79('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce79('0x15'));var logger=require('../../config/logger')(_0xce79('0x16'));var utils=require(_0xce79('0x17'));var config=require(_0xce79('0x18'));var licenseUtil=require(_0xce79('0x19'));var db=require(_0xce79('0x1a'))['db'];config[_0xce79('0x1b')]=_[_0xce79('0x1c')](config['redis'],{'host':_0xce79('0x1d'),'port':0x18eb});var socket=require(_0xce79('0x1e'))(new Redis(config['redis']));require(_0xce79('0x1f'))[_0xce79('0x20')](socket);function respondWithStatusCode(_0x284654,_0x654fb3){_0x654fb3=_0x654fb3||0xcc;return function(_0x5c7131){if(_0x5c7131){return _0x284654[_0xce79('0x21')](_0x654fb3);}return _0x284654[_0xce79('0x22')](_0x654fb3)[_0xce79('0x23')]();};}function respondWithResult(_0xdc66f4,_0x1e4193){_0x1e4193=_0x1e4193||0xc8;return function(_0x468a0c){if(_0x468a0c){return _0xdc66f4['status'](_0x1e4193)[_0xce79('0x24')](_0x468a0c);}};}function respondWithFilteredResult(_0x1ac9f0,_0x3dd570){return function(_0x25bf5b){if(_0x25bf5b){var _0x1ca1b8=typeof _0x3dd570[_0xce79('0x25')]==='undefined'&&typeof _0x3dd570[_0xce79('0x26')]===_0xce79('0x27');var _0xad1e44=_0x25bf5b[_0xce79('0x28')];var _0x4b4b6b=_0x1ca1b8?0x0:_0x3dd570['offset'];var _0x369363=_0x1ca1b8?_0x25bf5b['count']:_0x3dd570[_0xce79('0x25')]+_0x3dd570[_0xce79('0x26')];var _0x29a4a2;if(_0x369363>=_0xad1e44){_0x369363=_0xad1e44;_0x29a4a2=0xc8;}else{_0x29a4a2=0xce;}_0x1ac9f0[_0xce79('0x22')](_0x29a4a2);return _0x1ac9f0[_0xce79('0x29')](_0xce79('0x2a'),_0x4b4b6b+'-'+_0x369363+'/'+_0xad1e44)[_0xce79('0x24')](_0x25bf5b);}return null;};}function patchUpdates(_0xef1c8e){return function(_0x3dfb1f){try{jsonpatch['apply'](_0x3dfb1f,_0xef1c8e,!![]);}catch(_0x19dd37){return BPromise[_0xce79('0x2b')](_0x19dd37);}return _0x3dfb1f['save']();};}function saveUpdates(_0x577914,_0xb68817){return function(_0x3f34a0){if(_0x3f34a0){return _0x3f34a0[_0xce79('0x2c')](_0x577914)['then'](function(_0x2f13aa){return _0x2f13aa;});}return null;};}function removeEntity(_0x3b4c17,_0x290606){return function(_0xecce63){if(_0xecce63){return _0xecce63[_0xce79('0x2d')]()['then'](function(){var _0x56ed51=_0xecce63['get']({'plain':!![]});var _0x48b6c4=_0xce79('0x2e');return db[_0xce79('0x2f')]['destroy']({'where':{'type':_0x48b6c4,'resourceId':_0x56ed51['id']}})[_0xce79('0x30')](function(){return _0xecce63;});})[_0xce79('0x30')](function(){_0x3b4c17[_0xce79('0x22')](0xcc)[_0xce79('0x23')]();});}};}function handleEntityNotFound(_0x106af4,_0x242401){return function(_0x9fd379){if(!_0x9fd379){_0x106af4['sendStatus'](0x194);}return _0x9fd379;};}function handleError(_0x33d2b0,_0x2d763d){_0x2d763d=_0x2d763d||0x1f4;return function(_0x338c75){logger[_0xce79('0x31')](_0x338c75['stack']);if(_0x338c75['name']){delete _0x338c75[_0xce79('0x32')];}_0x33d2b0[_0xce79('0x22')](_0x2d763d)[_0xce79('0x33')](_0x338c75);};}exports[_0xce79('0x34')]=function(_0x43ad99,_0x4bc845){var _0x5c8d2f={},_0xe9b05a={},_0x20eee7={'count':0x0,'rows':[]};var _0x3b10e8=_[_0xce79('0x35')](db['MailQueue'][_0xce79('0x36')],function(_0x211fe1){return{'name':_0x211fe1[_0xce79('0x37')],'type':_0x211fe1[_0xce79('0x38')][_0xce79('0x39')]};});_0xe9b05a[_0xce79('0x3a')]=_['map'](_0x3b10e8,'name');_0xe9b05a['query']=_[_0xce79('0x3b')](_0x43ad99['query']);_0xe9b05a[_0xce79('0x3c')]=_[_0xce79('0x3d')](_0xe9b05a['model'],_0xe9b05a[_0xce79('0x3e')]);_0x5c8d2f[_0xce79('0x3f')]=_[_0xce79('0x3d')](_0xe9b05a[_0xce79('0x3a')],qs['fields'](_0x43ad99[_0xce79('0x3e')]['fields']));_0x5c8d2f[_0xce79('0x3f')]=_0x5c8d2f['attributes']['length']?_0x5c8d2f['attributes']:_0xe9b05a[_0xce79('0x3a')];if(!_0x43ad99['query'][_0xce79('0x40')]('nolimit')){_0x5c8d2f[_0xce79('0x26')]=qs[_0xce79('0x26')](_0x43ad99[_0xce79('0x3e')]['limit']);_0x5c8d2f[_0xce79('0x25')]=qs[_0xce79('0x25')](_0x43ad99[_0xce79('0x3e')][_0xce79('0x25')]);}_0x5c8d2f['order']=qs[_0xce79('0x41')](_0x43ad99[_0xce79('0x3e')][_0xce79('0x41')]);_0x5c8d2f[_0xce79('0x42')]=qs['filters'](_[_0xce79('0x43')](_0x43ad99[_0xce79('0x3e')],_0xe9b05a['filters']),_0x3b10e8);if(_0x43ad99[_0xce79('0x3e')][_0xce79('0x44')]){_0x5c8d2f[_0xce79('0x42')]=_[_0xce79('0x45')](_0x5c8d2f[_0xce79('0x42')],{'$or':_['map'](_0x3b10e8,function(_0xcfa543){if(_0xcfa543[_0xce79('0x38')]!=='VIRTUAL'){var _0x32a2a2={};_0x32a2a2[_0xcfa543[_0xce79('0x32')]]={'$like':'%'+_0x43ad99[_0xce79('0x3e')][_0xce79('0x44')]+'%'};return _0x32a2a2;}})});}_0x5c8d2f=_[_0xce79('0x45')]({},_0x5c8d2f,_0x43ad99[_0xce79('0x46')]);var _0x1615ac={'where':_0x5c8d2f[_0xce79('0x42')]};return db[_0xce79('0x47')][_0xce79('0x28')](_0x1615ac)[_0xce79('0x30')](function(_0x3cdf3d){_0x20eee7[_0xce79('0x28')]=_0x3cdf3d;if(_0x43ad99['query'][_0xce79('0x48')]){_0x5c8d2f[_0xce79('0x49')]=[{'all':!![]}];}return db[_0xce79('0x47')]['findAll'](_0x5c8d2f);})[_0xce79('0x30')](function(_0x1b83a0){_0x20eee7['rows']=_0x1b83a0;return _0x20eee7;})[_0xce79('0x30')](respondWithFilteredResult(_0x4bc845,_0x5c8d2f))[_0xce79('0x4a')](handleError(_0x4bc845,null));};exports[_0xce79('0x4b')]=function(_0x1b05b7,_0x27f2ff){var _0x40164e={'raw':!![],'where':{'id':_0x1b05b7[_0xce79('0x4c')]['id']}},_0x1984b7={};_0x1984b7[_0xce79('0x3a')]=_['keys'](db[_0xce79('0x47')][_0xce79('0x36')]);_0x1984b7[_0xce79('0x3e')]=_[_0xce79('0x3b')](_0x1b05b7['query']);_0x1984b7[_0xce79('0x3c')]=_[_0xce79('0x3d')](_0x1984b7[_0xce79('0x3a')],_0x1984b7[_0xce79('0x3e')]);_0x40164e['attributes']=_[_0xce79('0x3d')](_0x1984b7[_0xce79('0x3a')],qs[_0xce79('0x4d')](_0x1b05b7[_0xce79('0x3e')][_0xce79('0x4d')]));_0x40164e[_0xce79('0x3f')]=_0x40164e[_0xce79('0x3f')]['length']?_0x40164e[_0xce79('0x3f')]:_0x1984b7['model'];if(_0x1b05b7[_0xce79('0x3e')][_0xce79('0x48')]){_0x40164e[_0xce79('0x49')]=[{'all':!![]}];}_0x40164e=_['merge']({},_0x40164e,_0x1b05b7[_0xce79('0x46')]);return db[_0xce79('0x47')][_0xce79('0x4e')](_0x40164e)[_0xce79('0x30')](handleEntityNotFound(_0x27f2ff,null))[_0xce79('0x30')](respondWithResult(_0x27f2ff,null))[_0xce79('0x4a')](handleError(_0x27f2ff,null));};exports['create']=function(_0x33bee4,_0x5126c1){return db[_0xce79('0x47')][_0xce79('0x4f')](_0x33bee4[_0xce79('0x50')],{})[_0xce79('0x30')](function(_0x2a4c14){var _0x420228=_0x33bee4[_0xce79('0x51')][_0xce79('0x52')]({'plain':!![]});if(!_0x420228)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x420228['role']===_0xce79('0x51')){var _0x5d413b=_0x2a4c14[_0xce79('0x52')]({'plain':!![]});var _0x17026a='MailQueues';return db[_0xce79('0x53')][_0xce79('0x4e')]({'where':{'name':_0x17026a,'userProfileId':_0x420228['userProfileId']},'raw':!![]})[_0xce79('0x30')](function(_0x421b8d){if(_0x421b8d&&_0x421b8d['autoAssociation']===0x0){return db[_0xce79('0x2f')][_0xce79('0x4f')]({'name':_0x5d413b[_0xce79('0x32')],'resourceId':_0x5d413b['id'],'type':_0x421b8d['name'],'sectionId':_0x421b8d['id']},{})[_0xce79('0x30')](function(){return _0x2a4c14;});}else{return _0x2a4c14;}})[_0xce79('0x4a')](function(_0x8e5944){logger[_0xce79('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8e5944);throw _0x8e5944;});}return _0x2a4c14;})[_0xce79('0x30')](respondWithResult(_0x5126c1,0xc9))[_0xce79('0x4a')](handleError(_0x5126c1,null));};exports[_0xce79('0x2c')]=function(_0x2681b7,_0x383dd3){if(_0x2681b7[_0xce79('0x50')]['id']){delete _0x2681b7[_0xce79('0x50')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x2681b7[_0xce79('0x4c')]['id']}})[_0xce79('0x30')](handleEntityNotFound(_0x383dd3,null))['then'](saveUpdates(_0x2681b7[_0xce79('0x50')],null))[_0xce79('0x30')](respondWithResult(_0x383dd3,null))['catch'](handleError(_0x383dd3,null));};exports['destroy']=function(_0x8e0f8b,_0x4bcb2b){return db[_0xce79('0x47')][_0xce79('0x4e')]({'where':{'id':_0x8e0f8b[_0xce79('0x4c')]['id']}})[_0xce79('0x30')](handleEntityNotFound(_0x4bcb2b,null))[_0xce79('0x30')](removeEntity(_0x4bcb2b,null))[_0xce79('0x4a')](handleError(_0x4bcb2b,null));};exports[_0xce79('0x54')]=function(_0x2ef43e,_0x40e446){return db['MailQueue'][_0xce79('0x54')]()[_0xce79('0x30')](respondWithResult(_0x40e446,null))['catch'](handleError(_0x40e446,null));};exports['getMembers']=function(_0x511a04,_0x5d19e2,_0x4c7b3d){var _0x4c65a8={'raw':!![],'where':{}},_0x2b588c={},_0x51cd95;return db[_0xce79('0x47')][_0xce79('0x55')]({'where':{'id':_0x511a04[_0xce79('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d19e2,null))['then'](function(_0x483af3){if(_0x483af3){_0x51cd95=_0x483af3[_0xce79('0x52')]({'plain':!![]});_0x2b588c['model']=_['keys'](db['UserMailQueue'][_0xce79('0x36')]);_0x2b588c[_0xce79('0x3e')]=_[_0xce79('0x3b')](_0x511a04[_0xce79('0x3e')]);_0x2b588c['filters']=_['intersection'](_0x2b588c[_0xce79('0x3a')],_0x2b588c[_0xce79('0x3e')]);_0x4c65a8['attributes']=_[_0xce79('0x3d')](_0x2b588c[_0xce79('0x3a')],qs['fields'](_0x511a04['query'][_0xce79('0x4d')]));_0x4c65a8['attributes']=_0x4c65a8[_0xce79('0x3f')][_0xce79('0x56')]?_0x4c65a8['attributes']:_0x2b588c[_0xce79('0x3a')];if(!_0x511a04[_0xce79('0x3e')][_0xce79('0x40')](_0xce79('0x57'))){_0x4c65a8[_0xce79('0x26')]=qs[_0xce79('0x26')](_0x511a04['query'][_0xce79('0x26')]);_0x4c65a8[_0xce79('0x25')]=qs[_0xce79('0x25')](_0x511a04[_0xce79('0x3e')]['offset']);}_0x4c65a8[_0xce79('0x58')]=qs[_0xce79('0x41')](_0x511a04[_0xce79('0x3e')][_0xce79('0x41')]);_0x4c65a8[_0xce79('0x42')]=qs[_0xce79('0x3c')](_[_0xce79('0x43')](_0x511a04[_0xce79('0x3e')],_0x2b588c['filters']));_0x4c65a8[_0xce79('0x42')][_0xce79('0x59')]=_0x483af3['id'];if(_0x511a04[_0xce79('0x3e')][_0xce79('0x44')]){_0x4c65a8[_0xce79('0x42')]=_[_0xce79('0x45')](_0x4c65a8['where'],{'$or':_[_0xce79('0x35')](_0x4c65a8[_0xce79('0x3f')],function(_0x1268b7){var _0x173f88={};_0x173f88[_0x1268b7]={'$like':'%'+_0x511a04[_0xce79('0x3e')][_0xce79('0x44')]+'%'};return _0x173f88;})});}_0x4c65a8=_[_0xce79('0x45')]({},_0x4c65a8,_0x511a04[_0xce79('0x46')]);return db['UserMailQueue'][_0xce79('0x5a')](_0x4c65a8);}})['then'](function(_0x5da67d){if(_0x5da67d){return db[_0xce79('0x5b')][_0xce79('0x5c')]({'where':{'id':_[_0xce79('0x35')](_0x5da67d,'UserId'),'role':_0xce79('0x5d')},'attributes':['id',_0xce79('0x32'),_0xce79('0x5e'),_0xce79('0x5f'),_0xce79('0x60')]});}})[_0xce79('0x30')](function(_0x4ff55c){if(_0x4ff55c){return{'count':_0x4ff55c[_0xce79('0x28')],'rows':_[_0xce79('0x35')](_0x4ff55c[_0xce79('0x61')],function(_0x559549){return{'membername':_0x559549['name'],'UserId':_0x559549['id'],'queue_name':_0x51cd95[_0xce79('0x32')],'MailQueueId':_0x51cd95['id'],'interface':util['format'](_0xce79('0x62'),'SIP',_0x559549[_0xce79('0x32')]),'penalty':0x0,'paused':_0x559549['mailPause'],'createdAt':_0x559549[_0xce79('0x60')],'updatedAt':_0x559549[_0xce79('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xce79('0x30')](respondWithFilteredResult(_0x5d19e2,_0x4c65a8))[_0xce79('0x4a')](handleError(_0x5d19e2,null));};exports[_0xce79('0x63')]=function(_0x18f9e3,_0x48c8bc,_0x276930){var _0xc28ae7={};var _0xe2de5a={};var _0x5c09e0;var _0x5e4ee8;return db[_0xce79('0x47')]['findOne']({'where':{'id':_0x18f9e3['params']['id']}})[_0xce79('0x30')](handleEntityNotFound(_0x48c8bc,null))[_0xce79('0x30')](function(_0x2a2544){if(_0x2a2544){_0x5c09e0=_0x2a2544;_0xe2de5a['model']=_[_0xce79('0x3b')](db['Team'][_0xce79('0x36')]);_0xe2de5a[_0xce79('0x3e')]=_[_0xce79('0x3b')](_0x18f9e3['query']);_0xe2de5a['filters']=_[_0xce79('0x3d')](_0xe2de5a[_0xce79('0x3a')],_0xe2de5a['query']);_0xc28ae7[_0xce79('0x3f')]=_[_0xce79('0x3d')](_0xe2de5a[_0xce79('0x3a')],qs[_0xce79('0x4d')](_0x18f9e3[_0xce79('0x3e')][_0xce79('0x4d')]));_0xc28ae7[_0xce79('0x3f')]=_0xc28ae7[_0xce79('0x3f')][_0xce79('0x56')]?_0xc28ae7[_0xce79('0x3f')]:_0xe2de5a[_0xce79('0x3a')];_0xc28ae7[_0xce79('0x58')]=qs[_0xce79('0x41')](_0x18f9e3[_0xce79('0x3e')][_0xce79('0x41')]);_0xc28ae7['where']=qs['filters'](_[_0xce79('0x43')](_0x18f9e3[_0xce79('0x3e')],_0xe2de5a[_0xce79('0x3c')]));if(_0x18f9e3[_0xce79('0x3e')][_0xce79('0x44')]){_0xc28ae7[_0xce79('0x42')]=_[_0xce79('0x45')](_0xc28ae7[_0xce79('0x42')],{'$or':_[_0xce79('0x35')](_0xc28ae7[_0xce79('0x3f')],function(_0x2b5362){var _0x3ced31={};_0x3ced31[_0x2b5362]={'$like':'%'+_0x18f9e3[_0xce79('0x3e')][_0xce79('0x44')]+'%'};return _0x3ced31;})});}_0xc28ae7=_['merge']({},_0xc28ae7,_0x18f9e3[_0xce79('0x46')]);return _0x5c09e0[_0xce79('0x63')](_0xc28ae7);}})[_0xce79('0x30')](function(_0x57d4d7){if(_0x57d4d7){_0x5e4ee8=_0x57d4d7[_0xce79('0x56')];if(!_0x18f9e3[_0xce79('0x3e')][_0xce79('0x40')](_0xce79('0x57'))){_0xc28ae7[_0xce79('0x26')]=qs[_0xce79('0x26')](_0x18f9e3[_0xce79('0x3e')]['limit']);_0xc28ae7[_0xce79('0x25')]=qs[_0xce79('0x25')](_0x18f9e3[_0xce79('0x3e')][_0xce79('0x25')]);}return _0x5c09e0['getTeams'](_0xc28ae7);}})[_0xce79('0x30')](function(_0x49b1fd){if(_0x49b1fd){return _0x49b1fd?{'count':_0x5e4ee8,'rows':_0x49b1fd}:null;}})['then'](respondWithResult(_0x48c8bc,null))[_0xce79('0x4a')](handleError(_0x48c8bc,null));};exports[_0xce79('0x64')]=function(_0x17ce23,_0x37eaa6,_0x32a018){var _0xb2e62b=_0x17ce23[_0xce79('0x50')][_0xce79('0x65')];return db[_0xce79('0x66')]['findAll']({'where':{'id':_0xb2e62b},'attributes':['id'],'include':[{'model':db[_0xce79('0x5b')],'as':_0xce79('0x67'),'attributes':['id',_0xce79('0x32'),'online',_0xce79('0x68'),_0xce79('0x69')],'raw':!![]}]})[_0xce79('0x30')](function(_0x1dfd1e){if(_0x1dfd1e){var _0xb46f36=_[_0xce79('0x6a')](_0x1dfd1e,function(_0x401025){var _0x18f661=_0x401025[_0xce79('0x52')]({'plain':!![]});return _0x18f661['Agents'];});return db[_0xce79('0x47')][_0xce79('0x4e')]({'where':{'id':_0x17ce23[_0xce79('0x4c')]['id']}})[_0xce79('0x30')](function(_0x5708a9){return db[_0xce79('0x6b')][_0xce79('0x6c')](function(_0x235295){return _0x5708a9[_0xce79('0x64')](_0xb2e62b,{'transaction':_0x235295})[_0xce79('0x30')](function(){return BPromise[_0xce79('0x6d')](_0xb46f36,function(_0xa204b7){return db[_0xce79('0x6e')][_0xce79('0x6f')]({'where':{'UserId':_0xa204b7['id'],'MailQueueId':_0x17ce23[_0xce79('0x4c')]['id']},'transaction':_0x235295});});})[_0xce79('0x30')](function(){_0xb46f36['forEach'](function(_0x14ed40){socket[_0xce79('0x70')](_0xce79('0x71'),{'UserId':_0x14ed40['id'],'MailQueueId':_0x5708a9['id']});});});});});}})[_0xce79('0x30')](respondWithStatusCode(_0x37eaa6,null))[_0xce79('0x4a')](handleError(_0x37eaa6,null));};exports['removeTeams']=function(_0x282106,_0x5f4208,_0x3f868b){return db[_0xce79('0x66')][_0xce79('0x5a')]({'where':{'id':_0x282106[_0xce79('0x3e')][_0xce79('0x65')]},'attributes':['id'],'include':[{'model':db[_0xce79('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xce79('0x30')](handleEntityNotFound(_0x5f4208,null))[_0xce79('0x30')](function(_0x98fac){var _0xbb87e5=_[_0xce79('0x35')](_0x98fac,'id');var _0x1c2a5c=[];var _0x26f0c6=[];var _0x3bf6bf=squel['select']();_0x3bf6bf[_0xce79('0x72')](_0xce79('0x73'))[_0xce79('0x74')](_0xce79('0x75'),'tq')[_0xce79('0x76')](_0xce79('0x77'),'ut',_0xce79('0x78'))[_0xce79('0x42')](_0xce79('0x79'),_0x282106[_0xce79('0x4c')]['id']);for(var _0x1b0d35=0x0;_0x1b0d35<_0x98fac[_0xce79('0x56')];_0x1b0d35+=0x1){let _0x10fc4a=_0x98fac[_0x1b0d35];for(var _0x104931=0x0;_0x104931<_0x10fc4a[_0xce79('0x67')]['length'];_0x104931+=0x1){let _0x49d9ea=_0x10fc4a[_0xce79('0x67')][_0x104931];var _0x38c623=_0x3bf6bf[_0xce79('0x7a')]();_0x38c623[_0xce79('0x42')](_0xce79('0x7b'),_0x49d9ea['id']);_0x26f0c6[_0xce79('0x7c')](db[_0xce79('0x6b')][_0xce79('0x3e')](_0x38c623[_0xce79('0x7d')](),{'type':db[_0xce79('0x6b')][_0xce79('0x7e')]['SELECT']})['then'](function(_0x4197e6){if(_0x4197e6[_0xce79('0x56')]===0x1){return _0x49d9ea['id'];}else{var _0x5ac6be=_[_0xce79('0x7f')](_[_0xce79('0x35')](_0x4197e6,_0xce79('0x80')),function(_0x54e18e){return _[_0xce79('0x81')](_0xbb87e5,_0x54e18e);});if(_0x5ac6be){return _0x49d9ea['id'];}}}));}}return BPromise[_0xce79('0x82')](_0x26f0c6)[_0xce79('0x30')](function(_0x184384){_0x1c2a5c=_(_0x1c2a5c)['union'](_0x184384)[_0xce79('0x83')]()[_0xce79('0x84')]();return db[_0xce79('0x47')]['find']({'where':{'id':_0x282106['params']['id']}})['then'](function(_0x48f897){return db['sequelize'][_0xce79('0x6c')](function(_0x2b9517){return _0x48f897[_0xce79('0x85')](_0x282106[_0xce79('0x3e')][_0xce79('0x65')],{'transaction':_0x2b9517})[_0xce79('0x30')](function(){if(!_[_0xce79('0x86')](_0x1c2a5c)){return _0x48f897[_0xce79('0x87')](_0x1c2a5c,{'transaction':_0x2b9517});}})[_0xce79('0x30')](function(){_0x1c2a5c[_0xce79('0x88')](function(_0x279bf4){socket[_0xce79('0x70')](_0xce79('0x89'),{'UserId':_0x279bf4,'MailQueueId':_0x48f897['id']});});});});});});})[_0xce79('0x30')](respondWithStatusCode(_0x5f4208,null))[_0xce79('0x4a')](handleError(_0x5f4208,null));};exports[_0xce79('0x8a')]=function(_0x2eddcb,_0x1ed3ac,_0x5e7abc){return db[_0xce79('0x47')][_0xce79('0x4e')]({'where':{'id':_0x2eddcb[_0xce79('0x4c')]['id']}})[_0xce79('0x30')](handleEntityNotFound(_0x1ed3ac,null))[_0xce79('0x30')](function(_0xbcee13){if(_0xbcee13){return _0xbcee13[_0xce79('0x8a')](_0x2eddcb[_0xce79('0x50')][_0xce79('0x65')],_[_0xce79('0x8b')](_0x2eddcb['body'],[_0xce79('0x65'),'id'])||{})[_0xce79('0x8c')](function(_0x275472){for(var _0x283a42=0x0;_0x283a42<_0x2eddcb[_0xce79('0x50')][_0xce79('0x65')][_0xce79('0x56')];_0x283a42+=0x1){socket['emit'](_0xce79('0x71'),{'UserId':Number(_0x2eddcb['body'][_0xce79('0x65')][_0x283a42]),'MailQueueId':Number(_0x2eddcb[_0xce79('0x4c')]['id'])});}return _0x275472;});}})[_0xce79('0x30')](respondWithResult(_0x1ed3ac,null))['catch'](handleError(_0x1ed3ac,null));};exports[_0xce79('0x87')]=function(_0x371ddc,_0x4c21e5,_0x14797c){return db[_0xce79('0x47')][_0xce79('0x4e')]({'where':{'id':_0x371ddc[_0xce79('0x4c')]['id']}})[_0xce79('0x30')](handleEntityNotFound(_0x4c21e5,null))[_0xce79('0x30')](function(_0xe65b5c){if(_0xe65b5c){return _0xe65b5c[_0xce79('0x87')](_0x371ddc[_0xce79('0x3e')][_0xce79('0x65')])[_0xce79('0x30')](function(){if(_['isArray'](_0x371ddc[_0xce79('0x3e')]['ids'])){for(var _0x45454f=0x0;_0x45454f<_0x371ddc[_0xce79('0x3e')][_0xce79('0x65')][_0xce79('0x56')];_0x45454f+=0x1){socket[_0xce79('0x70')](_0xce79('0x89'),{'UserId':Number(_0x371ddc[_0xce79('0x3e')]['ids'][_0x45454f]),'MailQueueId':Number(_0x371ddc[_0xce79('0x4c')]['id'])});}}else{socket[_0xce79('0x70')]('userMailQueue:remove',{'UserId':Number(_0x371ddc[_0xce79('0x3e')][_0xce79('0x65')]),'MailQueueId':Number(_0x371ddc['params']['id'])});}});}})[_0xce79('0x30')](respondWithStatusCode(_0x4c21e5,null))[_0xce79('0x4a')](handleError(_0x4c21e5,null));};exports['getAgents']=function(_0x5789ee,_0x3f3207,_0x11688f){var _0x445ad2={};var _0x2ab5aa={};var _0x3c4cee;var _0x2d80e5;return db[_0xce79('0x47')][_0xce79('0x55')]({'where':{'id':_0x5789ee[_0xce79('0x4c')]['id']}})[_0xce79('0x30')](handleEntityNotFound(_0x3f3207,null))[_0xce79('0x30')](function(_0x36ebfa){if(_0x36ebfa){_0x3c4cee=_0x36ebfa;_0x2ab5aa[_0xce79('0x3a')]=_['keys'](db[_0xce79('0x5b')][_0xce79('0x36')]);_0x2ab5aa[_0xce79('0x3e')]=_[_0xce79('0x3b')](_0x5789ee['query']);_0x2ab5aa[_0xce79('0x3c')]=_[_0xce79('0x3d')](_0x2ab5aa[_0xce79('0x3a')],_0x2ab5aa['query']);_0x445ad2[_0xce79('0x3f')]=_[_0xce79('0x3d')](_0x2ab5aa[_0xce79('0x3a')],qs[_0xce79('0x4d')](_0x5789ee[_0xce79('0x3e')][_0xce79('0x4d')]));_0x445ad2[_0xce79('0x3f')]=_0x445ad2[_0xce79('0x3f')][_0xce79('0x56')]?_0x445ad2[_0xce79('0x3f')]:_0x2ab5aa[_0xce79('0x3a')];_0x445ad2[_0xce79('0x58')]=qs[_0xce79('0x41')](_0x5789ee[_0xce79('0x3e')][_0xce79('0x41')]);_0x445ad2['where']=qs[_0xce79('0x3c')](_[_0xce79('0x43')](_0x5789ee[_0xce79('0x3e')],_0x2ab5aa[_0xce79('0x3c')]));if(_0x5789ee[_0xce79('0x3e')]['filter']){_0x445ad2[_0xce79('0x42')]=_[_0xce79('0x45')](_0x445ad2[_0xce79('0x42')],{'$or':_[_0xce79('0x35')](_0x445ad2[_0xce79('0x3f')],function(_0x41468a){var _0x118e17={};_0x118e17[_0x41468a]={'$like':'%'+_0x5789ee[_0xce79('0x3e')][_0xce79('0x44')]+'%'};return _0x118e17;})});}_0x445ad2=_[_0xce79('0x45')]({},_0x445ad2,_0x5789ee['options']);return _0x3c4cee['getAgents'](_0x445ad2);}})[_0xce79('0x30')](function(_0xe63e18){if(_0xe63e18){_0x2d80e5=_0xe63e18[_0xce79('0x56')];if(!_0x5789ee[_0xce79('0x3e')][_0xce79('0x40')](_0xce79('0x57'))){_0x445ad2[_0xce79('0x26')]=qs[_0xce79('0x26')](_0x5789ee[_0xce79('0x3e')]['limit']);_0x445ad2[_0xce79('0x25')]=qs[_0xce79('0x25')](_0x5789ee[_0xce79('0x3e')][_0xce79('0x25')]);}return _0x3c4cee[_0xce79('0x8d')](_0x445ad2);}})[_0xce79('0x30')](function(_0x3273ee){if(_0x3273ee){return _0x3273ee?{'count':_0x2d80e5,'rows':_0x3273ee}:null;}})['then'](respondWithResult(_0x3f3207,null))['catch'](handleError(_0x3f3207,null));}; \ No newline at end of file +var _0x3eed=['includes','all','union','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','MailQueues','destroy','end','sendStatus','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','nolimit','sort','where','filter','merge','includeAll','findAll','catch','show','params','length','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','hasOwnProperty','order','pick','MailQueueId','User','findAndCountAll','UserId','agent','createdAt','rows','format','SIP','mailPause','updatedAt','getTeams','Team','fields','ids','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId'];(function(_0x37eb5c,_0x477cc0){var _0x243e31=function(_0x2ebb5a){while(--_0x2ebb5a){_0x37eb5c['push'](_0x37eb5c['shift']());}};_0x243e31(++_0x477cc0);}(_0x3eed,0x1b9));var _0xd3ee=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3eed[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3ee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3ee('0x1'));var rp=require('request-promise');var moment=require(_0xd3ee('0x2'));var BPromise=require(_0xd3ee('0x3'));var Mustache=require(_0xd3ee('0x4'));var util=require(_0xd3ee('0x5'));var path=require(_0xd3ee('0x6'));var sox=require('sox');var csv=require(_0xd3ee('0x7'));var ejs=require(_0xd3ee('0x8'));var fs=require('fs');var fs_extra=require(_0xd3ee('0x9'));var _=require('lodash');var squel=require(_0xd3ee('0xa'));var crypto=require(_0xd3ee('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd3ee('0x7'));var querystring=require(_0xd3ee('0xc'));var Papa=require('papaparse');var Redis=require(_0xd3ee('0xd'));var authService=require(_0xd3ee('0xe'));var qs=require(_0xd3ee('0xf'));var as=require(_0xd3ee('0x10'));var hardwareService=require(_0xd3ee('0x11'));var logger=require('../../config/logger')(_0xd3ee('0x12'));var utils=require(_0xd3ee('0x13'));var config=require(_0xd3ee('0x14'));var licenseUtil=require(_0xd3ee('0x15'));var db=require(_0xd3ee('0x16'))['db'];config[_0xd3ee('0x17')]=_[_0xd3ee('0x18')](config[_0xd3ee('0x17')],{'host':_0xd3ee('0x19'),'port':0x18eb});var socket=require(_0xd3ee('0x1a'))(new Redis(config['redis']));require(_0xd3ee('0x1b'))[_0xd3ee('0x1c')](socket);function respondWithStatusCode(_0x3fdd6b,_0x465a7f){_0x465a7f=_0x465a7f||0xcc;return function(_0x11e5df){if(_0x11e5df){return _0x3fdd6b['sendStatus'](_0x465a7f);}return _0x3fdd6b[_0xd3ee('0x1d')](_0x465a7f)['end']();};}function respondWithResult(_0x4f8490,_0x460cdc){_0x460cdc=_0x460cdc||0xc8;return function(_0x637b82){if(_0x637b82){return _0x4f8490['status'](_0x460cdc)[_0xd3ee('0x1e')](_0x637b82);}};}function respondWithFilteredResult(_0x283b40,_0x3bef4e){return function(_0x1d4d09){if(_0x1d4d09){var _0x57ece8=typeof _0x3bef4e[_0xd3ee('0x1f')]==='undefined'&&typeof _0x3bef4e['limit']===_0xd3ee('0x20');var _0x4ba9c6=_0x1d4d09['count'];var _0x37cd7a=_0x57ece8?0x0:_0x3bef4e[_0xd3ee('0x1f')];var _0x484a93=_0x57ece8?_0x1d4d09[_0xd3ee('0x21')]:_0x3bef4e[_0xd3ee('0x1f')]+_0x3bef4e[_0xd3ee('0x22')];var _0x1d1542;if(_0x484a93>=_0x4ba9c6){_0x484a93=_0x4ba9c6;_0x1d1542=0xc8;}else{_0x1d1542=0xce;}_0x283b40['status'](_0x1d1542);return _0x283b40[_0xd3ee('0x23')](_0xd3ee('0x24'),_0x37cd7a+'-'+_0x484a93+'/'+_0x4ba9c6)[_0xd3ee('0x1e')](_0x1d4d09);}return null;};}function patchUpdates(_0x4a76fa){return function(_0x2e599f){try{jsonpatch[_0xd3ee('0x25')](_0x2e599f,_0x4a76fa,!![]);}catch(_0x51d79a){return BPromise[_0xd3ee('0x26')](_0x51d79a);}return _0x2e599f[_0xd3ee('0x27')]();};}function saveUpdates(_0x3b3f0f,_0x10ffd0){return function(_0x4c4aa4){if(_0x4c4aa4){return _0x4c4aa4[_0xd3ee('0x28')](_0x3b3f0f)[_0xd3ee('0x29')](function(_0x3f849a){return _0x3f849a;});}return null;};}function removeEntity(_0x353670,_0x5677a){return function(_0x221e7e){if(_0x221e7e){return _0x221e7e['destroy']()[_0xd3ee('0x29')](function(){var _0x26af5e=_0x221e7e['get']({'plain':!![]});var _0x42d221=_0xd3ee('0x2a');return db['UserProfileResource'][_0xd3ee('0x2b')]({'where':{'type':_0x42d221,'resourceId':_0x26af5e['id']}})['then'](function(){return _0x221e7e;});})[_0xd3ee('0x29')](function(){_0x353670[_0xd3ee('0x1d')](0xcc)[_0xd3ee('0x2c')]();});}};}function handleEntityNotFound(_0x3c2682,_0x5114d0){return function(_0x43367e){if(!_0x43367e){_0x3c2682[_0xd3ee('0x2d')](0x194);}return _0x43367e;};}function handleError(_0x1021c4,_0x23ecec){_0x23ecec=_0x23ecec||0x1f4;return function(_0x73dd01){logger['error'](_0x73dd01[_0xd3ee('0x2e')]);if(_0x73dd01[_0xd3ee('0x2f')]){delete _0x73dd01['name'];}_0x1021c4[_0xd3ee('0x1d')](_0x23ecec)[_0xd3ee('0x30')](_0x73dd01);};}exports[_0xd3ee('0x31')]=function(_0x2c6bfb,_0x4ccc31){var _0x36a9f7={},_0x1c9f6f={},_0x63aa20={'count':0x0,'rows':[]};var _0x3925b6=_['map'](db[_0xd3ee('0x32')][_0xd3ee('0x33')],function(_0x123e47){return{'name':_0x123e47[_0xd3ee('0x34')],'type':_0x123e47[_0xd3ee('0x35')][_0xd3ee('0x36')]};});_0x1c9f6f[_0xd3ee('0x37')]=_[_0xd3ee('0x38')](_0x3925b6,_0xd3ee('0x2f'));_0x1c9f6f[_0xd3ee('0x39')]=_[_0xd3ee('0x3a')](_0x2c6bfb[_0xd3ee('0x39')]);_0x1c9f6f[_0xd3ee('0x3b')]=_[_0xd3ee('0x3c')](_0x1c9f6f[_0xd3ee('0x37')],_0x1c9f6f[_0xd3ee('0x39')]);_0x36a9f7[_0xd3ee('0x3d')]=_['intersection'](_0x1c9f6f[_0xd3ee('0x37')],qs['fields'](_0x2c6bfb[_0xd3ee('0x39')]['fields']));_0x36a9f7[_0xd3ee('0x3d')]=_0x36a9f7[_0xd3ee('0x3d')]['length']?_0x36a9f7['attributes']:_0x1c9f6f['model'];if(!_0x2c6bfb[_0xd3ee('0x39')]['hasOwnProperty'](_0xd3ee('0x3e'))){_0x36a9f7[_0xd3ee('0x22')]=qs[_0xd3ee('0x22')](_0x2c6bfb['query'][_0xd3ee('0x22')]);_0x36a9f7['offset']=qs['offset'](_0x2c6bfb[_0xd3ee('0x39')][_0xd3ee('0x1f')]);}_0x36a9f7['order']=qs['sort'](_0x2c6bfb['query'][_0xd3ee('0x3f')]);_0x36a9f7[_0xd3ee('0x40')]=qs[_0xd3ee('0x3b')](_['pick'](_0x2c6bfb[_0xd3ee('0x39')],_0x1c9f6f[_0xd3ee('0x3b')]),_0x3925b6);if(_0x2c6bfb[_0xd3ee('0x39')][_0xd3ee('0x41')]){_0x36a9f7[_0xd3ee('0x40')]=_[_0xd3ee('0x42')](_0x36a9f7['where'],{'$or':_[_0xd3ee('0x38')](_0x3925b6,function(_0x56a3a8){if(_0x56a3a8['type']!=='VIRTUAL'){var _0x270d42={};_0x270d42[_0x56a3a8[_0xd3ee('0x2f')]]={'$like':'%'+_0x2c6bfb[_0xd3ee('0x39')][_0xd3ee('0x41')]+'%'};return _0x270d42;}})});}_0x36a9f7=_[_0xd3ee('0x42')]({},_0x36a9f7,_0x2c6bfb['options']);var _0x270227={'where':_0x36a9f7[_0xd3ee('0x40')]};return db['MailQueue'][_0xd3ee('0x21')](_0x270227)['then'](function(_0x57059f){_0x63aa20[_0xd3ee('0x21')]=_0x57059f;if(_0x2c6bfb[_0xd3ee('0x39')][_0xd3ee('0x43')]){_0x36a9f7['include']=[{'all':!![]}];}return db[_0xd3ee('0x32')][_0xd3ee('0x44')](_0x36a9f7);})[_0xd3ee('0x29')](function(_0x5dc3a3){_0x63aa20['rows']=_0x5dc3a3;return _0x63aa20;})[_0xd3ee('0x29')](respondWithFilteredResult(_0x4ccc31,_0x36a9f7))[_0xd3ee('0x45')](handleError(_0x4ccc31,null));};exports[_0xd3ee('0x46')]=function(_0x46b5de,_0x3885f9){var _0x20b7f9={'raw':!![],'where':{'id':_0x46b5de[_0xd3ee('0x47')]['id']}},_0x362dad={};_0x362dad[_0xd3ee('0x37')]=_[_0xd3ee('0x3a')](db[_0xd3ee('0x32')][_0xd3ee('0x33')]);_0x362dad[_0xd3ee('0x39')]=_[_0xd3ee('0x3a')](_0x46b5de['query']);_0x362dad['filters']=_[_0xd3ee('0x3c')](_0x362dad[_0xd3ee('0x37')],_0x362dad['query']);_0x20b7f9[_0xd3ee('0x3d')]=_['intersection'](_0x362dad[_0xd3ee('0x37')],qs['fields'](_0x46b5de[_0xd3ee('0x39')]['fields']));_0x20b7f9[_0xd3ee('0x3d')]=_0x20b7f9[_0xd3ee('0x3d')][_0xd3ee('0x48')]?_0x20b7f9[_0xd3ee('0x3d')]:_0x362dad[_0xd3ee('0x37')];if(_0x46b5de['query'][_0xd3ee('0x43')]){_0x20b7f9[_0xd3ee('0x49')]=[{'all':!![]}];}_0x20b7f9=_[_0xd3ee('0x42')]({},_0x20b7f9,_0x46b5de[_0xd3ee('0x4a')]);return db[_0xd3ee('0x32')][_0xd3ee('0x4b')](_0x20b7f9)[_0xd3ee('0x29')](handleEntityNotFound(_0x3885f9,null))[_0xd3ee('0x29')](respondWithResult(_0x3885f9,null))['catch'](handleError(_0x3885f9,null));};exports['create']=function(_0x2c665d,_0x794605){return db[_0xd3ee('0x32')][_0xd3ee('0x4c')](_0x2c665d[_0xd3ee('0x4d')],{})[_0xd3ee('0x29')](function(_0x46b14c){var _0x4cb82e=_0x2c665d[_0xd3ee('0x4e')][_0xd3ee('0x4f')]({'plain':!![]});if(!_0x4cb82e)throw new Error(_0xd3ee('0x50'));if(_0x4cb82e[_0xd3ee('0x51')]===_0xd3ee('0x4e')){var _0xf82f7b=_0x46b14c[_0xd3ee('0x4f')]({'plain':!![]});var _0x8e598f=_0xd3ee('0x2a');return db['UserProfileSection'][_0xd3ee('0x4b')]({'where':{'name':_0x8e598f,'userProfileId':_0x4cb82e[_0xd3ee('0x52')]},'raw':!![]})['then'](function(_0x3069bd){if(_0x3069bd&&_0x3069bd[_0xd3ee('0x53')]===0x0){return db[_0xd3ee('0x54')]['create']({'name':_0xf82f7b['name'],'resourceId':_0xf82f7b['id'],'type':_0x3069bd['name'],'sectionId':_0x3069bd['id']},{})[_0xd3ee('0x29')](function(){return _0x46b14c;});}else{return _0x46b14c;}})[_0xd3ee('0x45')](function(_0x1de47f){logger[_0xd3ee('0x55')](_0xd3ee('0x56'),_0x1de47f);throw _0x1de47f;});}return _0x46b14c;})[_0xd3ee('0x29')](respondWithResult(_0x794605,0xc9))[_0xd3ee('0x45')](handleError(_0x794605,null));};exports[_0xd3ee('0x28')]=function(_0x4ff37b,_0x5853a7){if(_0x4ff37b[_0xd3ee('0x4d')]['id']){delete _0x4ff37b[_0xd3ee('0x4d')]['id'];}return db[_0xd3ee('0x32')][_0xd3ee('0x4b')]({'where':{'id':_0x4ff37b[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x5853a7,null))[_0xd3ee('0x29')](saveUpdates(_0x4ff37b[_0xd3ee('0x4d')],null))[_0xd3ee('0x29')](respondWithResult(_0x5853a7,null))['catch'](handleError(_0x5853a7,null));};exports[_0xd3ee('0x2b')]=function(_0x1dcc5,_0x219d7d){return db[_0xd3ee('0x32')][_0xd3ee('0x4b')]({'where':{'id':_0x1dcc5[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x219d7d,null))[_0xd3ee('0x29')](removeEntity(_0x219d7d,null))[_0xd3ee('0x45')](handleError(_0x219d7d,null));};exports[_0xd3ee('0x57')]=function(_0x3b714a,_0x31906c){return db[_0xd3ee('0x32')][_0xd3ee('0x57')]()[_0xd3ee('0x29')](respondWithResult(_0x31906c,null))[_0xd3ee('0x45')](handleError(_0x31906c,null));};exports['getMembers']=function(_0x15ec1b,_0x4bf608,_0x13b2e7){var _0x21eb92={'raw':!![],'where':{}},_0x1d1b66={},_0x46e315;return db['MailQueue'][_0xd3ee('0x58')]({'where':{'id':_0x15ec1b[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x4bf608,null))[_0xd3ee('0x29')](function(_0x30efa3){if(_0x30efa3){_0x46e315=_0x30efa3[_0xd3ee('0x4f')]({'plain':!![]});_0x1d1b66[_0xd3ee('0x37')]=_[_0xd3ee('0x3a')](db[_0xd3ee('0x59')]['rawAttributes']);_0x1d1b66['query']=_[_0xd3ee('0x3a')](_0x15ec1b[_0xd3ee('0x39')]);_0x1d1b66[_0xd3ee('0x3b')]=_['intersection'](_0x1d1b66[_0xd3ee('0x37')],_0x1d1b66[_0xd3ee('0x39')]);_0x21eb92[_0xd3ee('0x3d')]=_['intersection'](_0x1d1b66[_0xd3ee('0x37')],qs['fields'](_0x15ec1b['query']['fields']));_0x21eb92[_0xd3ee('0x3d')]=_0x21eb92['attributes']['length']?_0x21eb92[_0xd3ee('0x3d')]:_0x1d1b66[_0xd3ee('0x37')];if(!_0x15ec1b[_0xd3ee('0x39')][_0xd3ee('0x5a')](_0xd3ee('0x3e'))){_0x21eb92['limit']=qs['limit'](_0x15ec1b[_0xd3ee('0x39')]['limit']);_0x21eb92[_0xd3ee('0x1f')]=qs[_0xd3ee('0x1f')](_0x15ec1b[_0xd3ee('0x39')][_0xd3ee('0x1f')]);}_0x21eb92[_0xd3ee('0x5b')]=qs['sort'](_0x15ec1b[_0xd3ee('0x39')]['sort']);_0x21eb92[_0xd3ee('0x40')]=qs[_0xd3ee('0x3b')](_[_0xd3ee('0x5c')](_0x15ec1b[_0xd3ee('0x39')],_0x1d1b66[_0xd3ee('0x3b')]));_0x21eb92[_0xd3ee('0x40')][_0xd3ee('0x5d')]=_0x30efa3['id'];if(_0x15ec1b[_0xd3ee('0x39')]['filter']){_0x21eb92['where']=_[_0xd3ee('0x42')](_0x21eb92[_0xd3ee('0x40')],{'$or':_[_0xd3ee('0x38')](_0x21eb92[_0xd3ee('0x3d')],function(_0x261ce6){var _0x464193={};_0x464193[_0x261ce6]={'$like':'%'+_0x15ec1b['query'][_0xd3ee('0x41')]+'%'};return _0x464193;})});}_0x21eb92=_[_0xd3ee('0x42')]({},_0x21eb92,_0x15ec1b[_0xd3ee('0x4a')]);return db[_0xd3ee('0x59')][_0xd3ee('0x44')](_0x21eb92);}})[_0xd3ee('0x29')](function(_0x4b1e38){if(_0x4b1e38){return db[_0xd3ee('0x5e')][_0xd3ee('0x5f')]({'where':{'id':_[_0xd3ee('0x38')](_0x4b1e38,_0xd3ee('0x60')),'role':_0xd3ee('0x61')},'attributes':['id',_0xd3ee('0x2f'),'mailPause','updatedAt',_0xd3ee('0x62')]});}})[_0xd3ee('0x29')](function(_0x17d382){if(_0x17d382){return{'count':_0x17d382[_0xd3ee('0x21')],'rows':_[_0xd3ee('0x38')](_0x17d382[_0xd3ee('0x63')],function(_0x11de08){return{'membername':_0x11de08[_0xd3ee('0x2f')],'UserId':_0x11de08['id'],'queue_name':_0x46e315['name'],'MailQueueId':_0x46e315['id'],'interface':util[_0xd3ee('0x64')]('%s/%s',_0xd3ee('0x65'),_0x11de08[_0xd3ee('0x2f')]),'penalty':0x0,'paused':_0x11de08[_0xd3ee('0x66')],'createdAt':_0x11de08['createdAt'],'updatedAt':_0x11de08[_0xd3ee('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd3ee('0x29')](respondWithFilteredResult(_0x4bf608,_0x21eb92))[_0xd3ee('0x45')](handleError(_0x4bf608,null));};exports[_0xd3ee('0x68')]=function(_0x3429c7,_0x108032,_0x31acb8){var _0x4470b7={};var _0x2003e2={};var _0x1dc952;var _0x1a9baf;return db[_0xd3ee('0x32')]['findOne']({'where':{'id':_0x3429c7['params']['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x108032,null))['then'](function(_0x41c18e){if(_0x41c18e){_0x1dc952=_0x41c18e;_0x2003e2[_0xd3ee('0x37')]=_['keys'](db[_0xd3ee('0x69')]['rawAttributes']);_0x2003e2['query']=_[_0xd3ee('0x3a')](_0x3429c7['query']);_0x2003e2['filters']=_[_0xd3ee('0x3c')](_0x2003e2[_0xd3ee('0x37')],_0x2003e2[_0xd3ee('0x39')]);_0x4470b7[_0xd3ee('0x3d')]=_[_0xd3ee('0x3c')](_0x2003e2[_0xd3ee('0x37')],qs['fields'](_0x3429c7['query'][_0xd3ee('0x6a')]));_0x4470b7[_0xd3ee('0x3d')]=_0x4470b7[_0xd3ee('0x3d')][_0xd3ee('0x48')]?_0x4470b7['attributes']:_0x2003e2['model'];_0x4470b7[_0xd3ee('0x5b')]=qs[_0xd3ee('0x3f')](_0x3429c7[_0xd3ee('0x39')][_0xd3ee('0x3f')]);_0x4470b7[_0xd3ee('0x40')]=qs[_0xd3ee('0x3b')](_[_0xd3ee('0x5c')](_0x3429c7[_0xd3ee('0x39')],_0x2003e2['filters']));if(_0x3429c7['query']['filter']){_0x4470b7[_0xd3ee('0x40')]=_[_0xd3ee('0x42')](_0x4470b7[_0xd3ee('0x40')],{'$or':_[_0xd3ee('0x38')](_0x4470b7['attributes'],function(_0x22942d){var _0x475171={};_0x475171[_0x22942d]={'$like':'%'+_0x3429c7[_0xd3ee('0x39')][_0xd3ee('0x41')]+'%'};return _0x475171;})});}_0x4470b7=_[_0xd3ee('0x42')]({},_0x4470b7,_0x3429c7[_0xd3ee('0x4a')]);return _0x1dc952[_0xd3ee('0x68')](_0x4470b7);}})['then'](function(_0x28a896){if(_0x28a896){_0x1a9baf=_0x28a896['length'];if(!_0x3429c7['query']['hasOwnProperty'](_0xd3ee('0x3e'))){_0x4470b7[_0xd3ee('0x22')]=qs[_0xd3ee('0x22')](_0x3429c7['query'][_0xd3ee('0x22')]);_0x4470b7[_0xd3ee('0x1f')]=qs[_0xd3ee('0x1f')](_0x3429c7[_0xd3ee('0x39')][_0xd3ee('0x1f')]);}return _0x1dc952[_0xd3ee('0x68')](_0x4470b7);}})[_0xd3ee('0x29')](function(_0x9031d8){if(_0x9031d8){return _0x9031d8?{'count':_0x1a9baf,'rows':_0x9031d8}:null;}})['then'](respondWithResult(_0x108032,null))['catch'](handleError(_0x108032,null));};exports['addTeams']=function(_0x99a44a,_0x522d73,_0x4f4cb0){var _0x54b77e=_0x99a44a[_0xd3ee('0x4d')][_0xd3ee('0x6b')];return db[_0xd3ee('0x69')][_0xd3ee('0x44')]({'where':{'id':_0x54b77e},'attributes':['id'],'include':[{'model':db[_0xd3ee('0x5e')],'as':'Agents','attributes':['id',_0xd3ee('0x2f'),'online','voicePause',_0xd3ee('0x6c')],'raw':!![]}]})[_0xd3ee('0x29')](function(_0x3384ce){if(_0x3384ce){var _0x155e1f=_[_0xd3ee('0x6d')](_0x3384ce,function(_0x46ebd3){var _0x13afce=_0x46ebd3[_0xd3ee('0x4f')]({'plain':!![]});return _0x13afce[_0xd3ee('0x6e')];});return db[_0xd3ee('0x32')][_0xd3ee('0x4b')]({'where':{'id':_0x99a44a[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](function(_0x827833){return db[_0xd3ee('0x6f')][_0xd3ee('0x70')](function(_0x41157b){return _0x827833['addTeams'](_0x54b77e,{'transaction':_0x41157b})[_0xd3ee('0x29')](function(){return BPromise[_0xd3ee('0x71')](_0x155e1f,function(_0x38ca86){return db[_0xd3ee('0x59')][_0xd3ee('0x72')]({'where':{'UserId':_0x38ca86['id'],'MailQueueId':_0x99a44a[_0xd3ee('0x47')]['id']},'transaction':_0x41157b});});})[_0xd3ee('0x29')](function(){_0x155e1f[_0xd3ee('0x73')](function(_0x5127e1){socket[_0xd3ee('0x74')](_0xd3ee('0x75'),{'UserId':_0x5127e1['id'],'MailQueueId':_0x827833['id']});});});});});}})['then'](respondWithStatusCode(_0x522d73,null))[_0xd3ee('0x45')](handleError(_0x522d73,null));};exports[_0xd3ee('0x76')]=function(_0xc301fb,_0x4f958d,_0x21e189){return db[_0xd3ee('0x69')]['findAll']({'where':{'id':_0xc301fb[_0xd3ee('0x39')][_0xd3ee('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xd3ee('0x5e')],'as':_0xd3ee('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4f958d,null))[_0xd3ee('0x29')](function(_0x3130e2){var _0x13db3d=_[_0xd3ee('0x38')](_0x3130e2,'id');var _0xf2854b=[];var _0x2914bb=[];var _0x3974c3=squel[_0xd3ee('0x77')]();_0x3974c3[_0xd3ee('0x78')](_0xd3ee('0x79'))[_0xd3ee('0x7a')](_0xd3ee('0x7b'),'tq')['join'](_0xd3ee('0x7c'),'ut',_0xd3ee('0x7d'))[_0xd3ee('0x40')]('MailQueueId\x20=\x20?',_0xc301fb['params']['id']);for(var _0x1e4a56=0x0;_0x1e4a56<_0x3130e2[_0xd3ee('0x48')];_0x1e4a56+=0x1){let _0x23b8c3=_0x3130e2[_0x1e4a56];for(var _0x23e862=0x0;_0x23e862<_0x23b8c3[_0xd3ee('0x6e')][_0xd3ee('0x48')];_0x23e862+=0x1){let _0x5c8eaf=_0x23b8c3[_0xd3ee('0x6e')][_0x23e862];var _0x34d875=_0x3974c3['clone']();_0x34d875[_0xd3ee('0x40')](_0xd3ee('0x7e'),_0x5c8eaf['id']);_0x2914bb['push'](db['sequelize'][_0xd3ee('0x39')](_0x34d875[_0xd3ee('0x7f')](),{'type':db['sequelize'][_0xd3ee('0x80')]['SELECT']})[_0xd3ee('0x29')](function(_0xfe5084){if(_0xfe5084['length']===0x1){return _0x5c8eaf['id'];}else{var _0x2f462a=_[_0xd3ee('0x81')](_[_0xd3ee('0x38')](_0xfe5084,_0xd3ee('0x82')),function(_0x3e605a){return _[_0xd3ee('0x83')](_0x13db3d,_0x3e605a);});if(_0x2f462a){return _0x5c8eaf['id'];}}}));}}return BPromise[_0xd3ee('0x84')](_0x2914bb)[_0xd3ee('0x29')](function(_0x43719f){_0xf2854b=_(_0xf2854b)[_0xd3ee('0x85')](_0x43719f)[_0xd3ee('0x86')]()[_0xd3ee('0x87')]();return db['MailQueue'][_0xd3ee('0x4b')]({'where':{'id':_0xc301fb[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](function(_0x8fa8ec){return db[_0xd3ee('0x6f')][_0xd3ee('0x70')](function(_0x201b6d){return _0x8fa8ec[_0xd3ee('0x76')](_0xc301fb[_0xd3ee('0x39')][_0xd3ee('0x6b')],{'transaction':_0x201b6d})[_0xd3ee('0x29')](function(){if(!_[_0xd3ee('0x88')](_0xf2854b)){return _0x8fa8ec['removeAgents'](_0xf2854b,{'transaction':_0x201b6d});}})[_0xd3ee('0x29')](function(){_0xf2854b[_0xd3ee('0x73')](function(_0x25686a){socket[_0xd3ee('0x74')](_0xd3ee('0x89'),{'UserId':_0x25686a,'MailQueueId':_0x8fa8ec['id']});});});});});});})[_0xd3ee('0x29')](respondWithStatusCode(_0x4f958d,null))[_0xd3ee('0x45')](handleError(_0x4f958d,null));};exports['addAgents']=function(_0x35d804,_0x2d284f,_0x31ebf8){return db[_0xd3ee('0x32')][_0xd3ee('0x4b')]({'where':{'id':_0x35d804[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x2d284f,null))[_0xd3ee('0x29')](function(_0x1bdf65){if(_0x1bdf65){return _0x1bdf65[_0xd3ee('0x8a')](_0x35d804[_0xd3ee('0x4d')][_0xd3ee('0x6b')],_[_0xd3ee('0x8b')](_0x35d804[_0xd3ee('0x4d')],['ids','id'])||{})[_0xd3ee('0x8c')](function(_0x433e7e){for(var _0xf0d297=0x0;_0xf0d297<_0x35d804[_0xd3ee('0x4d')][_0xd3ee('0x6b')][_0xd3ee('0x48')];_0xf0d297+=0x1){socket[_0xd3ee('0x74')](_0xd3ee('0x75'),{'UserId':Number(_0x35d804[_0xd3ee('0x4d')][_0xd3ee('0x6b')][_0xf0d297]),'MailQueueId':Number(_0x35d804[_0xd3ee('0x47')]['id'])});}return _0x433e7e;});}})[_0xd3ee('0x29')](respondWithResult(_0x2d284f,null))[_0xd3ee('0x45')](handleError(_0x2d284f,null));};exports['removeAgents']=function(_0x46d30f,_0x258713,_0x1a8ccd){return db[_0xd3ee('0x32')][_0xd3ee('0x4b')]({'where':{'id':_0x46d30f[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x258713,null))[_0xd3ee('0x29')](function(_0x289775){if(_0x289775){return _0x289775['removeAgents'](_0x46d30f[_0xd3ee('0x39')]['ids'])[_0xd3ee('0x29')](function(){if(_[_0xd3ee('0x8d')](_0x46d30f['query']['ids'])){for(var _0x14d1bd=0x0;_0x14d1bd<_0x46d30f['query'][_0xd3ee('0x6b')][_0xd3ee('0x48')];_0x14d1bd+=0x1){socket[_0xd3ee('0x74')]('userMailQueue:remove',{'UserId':Number(_0x46d30f[_0xd3ee('0x39')][_0xd3ee('0x6b')][_0x14d1bd]),'MailQueueId':Number(_0x46d30f[_0xd3ee('0x47')]['id'])});}}else{socket['emit'](_0xd3ee('0x89'),{'UserId':Number(_0x46d30f[_0xd3ee('0x39')][_0xd3ee('0x6b')]),'MailQueueId':Number(_0x46d30f[_0xd3ee('0x47')]['id'])});}});}})[_0xd3ee('0x29')](respondWithStatusCode(_0x258713,null))[_0xd3ee('0x45')](handleError(_0x258713,null));};exports[_0xd3ee('0x8e')]=function(_0x466444,_0x576e1d,_0x32a300){var _0xc5c043={};var _0x38d8ee={};var _0x4a46a6;var _0x524ffd;return db[_0xd3ee('0x32')][_0xd3ee('0x58')]({'where':{'id':_0x466444[_0xd3ee('0x47')]['id']}})['then'](handleEntityNotFound(_0x576e1d,null))[_0xd3ee('0x29')](function(_0x397484){if(_0x397484){_0x4a46a6=_0x397484;_0x38d8ee[_0xd3ee('0x37')]=_[_0xd3ee('0x3a')](db[_0xd3ee('0x5e')][_0xd3ee('0x33')]);_0x38d8ee[_0xd3ee('0x39')]=_[_0xd3ee('0x3a')](_0x466444[_0xd3ee('0x39')]);_0x38d8ee[_0xd3ee('0x3b')]=_['intersection'](_0x38d8ee[_0xd3ee('0x37')],_0x38d8ee[_0xd3ee('0x39')]);_0xc5c043[_0xd3ee('0x3d')]=_[_0xd3ee('0x3c')](_0x38d8ee['model'],qs[_0xd3ee('0x6a')](_0x466444['query'][_0xd3ee('0x6a')]));_0xc5c043[_0xd3ee('0x3d')]=_0xc5c043[_0xd3ee('0x3d')][_0xd3ee('0x48')]?_0xc5c043[_0xd3ee('0x3d')]:_0x38d8ee['model'];_0xc5c043[_0xd3ee('0x5b')]=qs[_0xd3ee('0x3f')](_0x466444[_0xd3ee('0x39')][_0xd3ee('0x3f')]);_0xc5c043[_0xd3ee('0x40')]=qs[_0xd3ee('0x3b')](_[_0xd3ee('0x5c')](_0x466444[_0xd3ee('0x39')],_0x38d8ee[_0xd3ee('0x3b')]));if(_0x466444[_0xd3ee('0x39')][_0xd3ee('0x41')]){_0xc5c043['where']=_[_0xd3ee('0x42')](_0xc5c043['where'],{'$or':_[_0xd3ee('0x38')](_0xc5c043[_0xd3ee('0x3d')],function(_0x2400ad){var _0x554d0f={};_0x554d0f[_0x2400ad]={'$like':'%'+_0x466444[_0xd3ee('0x39')][_0xd3ee('0x41')]+'%'};return _0x554d0f;})});}_0xc5c043=_['merge']({},_0xc5c043,_0x466444[_0xd3ee('0x4a')]);return _0x4a46a6[_0xd3ee('0x8e')](_0xc5c043);}})[_0xd3ee('0x29')](function(_0x401ff3){if(_0x401ff3){_0x524ffd=_0x401ff3[_0xd3ee('0x48')];if(!_0x466444[_0xd3ee('0x39')]['hasOwnProperty'](_0xd3ee('0x3e'))){_0xc5c043['limit']=qs[_0xd3ee('0x22')](_0x466444[_0xd3ee('0x39')][_0xd3ee('0x22')]);_0xc5c043[_0xd3ee('0x1f')]=qs[_0xd3ee('0x1f')](_0x466444['query']['offset']);}return _0x4a46a6[_0xd3ee('0x8e')](_0xc5c043);}})['then'](function(_0x45416c){if(_0x45416c){return _0x45416c?{'count':_0x524ffd,'rows':_0x45416c}:null;}})[_0xd3ee('0x29')](respondWithResult(_0x576e1d,null))['catch'](handleError(_0x576e1d,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 0109e0c..cadbfda 100644 --- a/server/api/mailQueue/mailQueue.events.js +++ b/server/api/mailQueue/mailQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4661=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','hasOwnProperty','exports'];(function(_0xfe712f,_0x3b9494){var _0x2a8db5=function(_0x5dd6ef){while(--_0x5dd6ef){_0xfe712f['push'](_0xfe712f['shift']());}};_0x2a8db5(++_0x3b9494);}(_0x4661,0x1dd));var _0x1466=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4661[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x1466('0x0'));var MailQueue=require(_0x1466('0x1'))['db'][_0x1466('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1466('0x3')](0x0);var events={'afterCreate':_0x1466('0x4'),'afterUpdate':_0x1466('0x5'),'afterDestroy':_0x1466('0x6')};function emitEvent(_0x2ec6c8){return function(_0x5bf4d0,_0x2c027a,_0x2a9b3b){MailQueueEvents['emit'](_0x2ec6c8+':'+_0x5bf4d0['id'],_0x5bf4d0);MailQueueEvents['emit'](_0x2ec6c8,_0x5bf4d0);_0x2a9b3b(null);};}for(var e in events){if(events[_0x1466('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x1466('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xe26d=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb','MailQueue'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xe26d,0x11d));var _0xde26=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe26d[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xde26('0x0'));var MailQueue=require(_0xde26('0x1'))['db'][_0xde26('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xde26('0x3')](0x0);var events={'afterCreate':_0xde26('0x4'),'afterUpdate':'update','afterDestroy':_0xde26('0x5')};function emitEvent(_0x5e7597){return function(_0x3f5571,_0x46feeb,_0x199ec7){MailQueueEvents[_0xde26('0x6')](_0x5e7597+':'+_0x3f5571['id'],_0x3f5571);MailQueueEvents[_0xde26('0x6')](_0x5e7597,_0x3f5571);_0x199ec7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xde26('0x7')](e,emitEvent(event));}}module[_0xde26('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 66f9edf..412ccf4 100644 --- a/server/api/mailQueue/mailQueue.model.js +++ b/server/api/mailQueue/mailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x316d=['api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x316d,0x193));var _0xd316=function(_0x10ed03,_0x3a672a){_0x10ed03=_0x10ed03-0x0;var _0x26d8b8=_0x316d[_0x10ed03];return _0x26d8b8;};'use strict';var _=require(_0xd316('0x0'));var util=require(_0xd316('0x1'));var logger=require(_0xd316('0x2'))(_0xd316('0x3'));var moment=require(_0xd316('0x4'));var BPromise=require(_0xd316('0x5'));var rp=require(_0xd316('0x6'));var fs=require('fs');var path=require(_0xd316('0x7'));var rimraf=require('rimraf');var config=require(_0xd316('0x8'));var attributes=require(_0xd316('0x9'));module[_0xd316('0xa')]=function(_0x1bd5d1,_0x5dac3a){return _0x1bd5d1[_0xd316('0xb')](_0xd316('0xc'),attributes,{'tableName':_0xd316('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd25d=['MailQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x2582f1,_0x5210fd){var _0x2a2252=function(_0x5e6871){while(--_0x5e6871){_0x2582f1['push'](_0x2582f1['shift']());}};_0x2a2252(++_0x5210fd);}(_0xd25d,0x18d));var _0xdd25=function(_0x206049,_0x29d6fb){_0x206049=_0x206049-0x0;var _0x56161a=_0xd25d[_0x206049];return _0x56161a;};'use strict';var _=require(_0xdd25('0x0'));var util=require('util');var logger=require(_0xdd25('0x1'))(_0xdd25('0x2'));var moment=require(_0xdd25('0x3'));var BPromise=require(_0xdd25('0x4'));var rp=require(_0xdd25('0x5'));var fs=require('fs');var path=require(_0xdd25('0x6'));var rimraf=require(_0xdd25('0x7'));var config=require(_0xdd25('0x8'));var attributes=require(_0xdd25('0x9'));module[_0xdd25('0xa')]=function(_0x2915c5,_0xe2197b){return _0x2915c5['define'](_0xdd25('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 2d26684..65845b5 100644 --- a/server/api/mailQueue/mailQueue.rpc.js +++ b/server/api/mailQueue/mailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb48d=['MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetMailQueue','findAll','options','raw','where','limit','map','include','model','attributes','ShowMailQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./mailQueue.socket','request','then','info'];(function(_0x2b4895,_0x20c70a){var _0x569215=function(_0x26ddf4){while(--_0x26ddf4){_0x2b4895['push'](_0x2b4895['shift']());}};_0x569215(++_0x20c70a);}(_0xb48d,0x194));var _0xdb48=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xb48d[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xdb48('0x0'));var util=require('util');var moment=require(_0xdb48('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb48('0x2'));var fs=require('fs');var Redis=require(_0xdb48('0x3'));var db=require(_0xdb48('0x4'))['db'];var utils=require(_0xdb48('0x5'));var logger=require('../../config/logger')(_0xdb48('0x6'));var config=require('../../config/environment');var jayson=require(_0xdb48('0x7'));var client=jayson[_0xdb48('0x8')][_0xdb48('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdb48('0xa')],{'host':_0xdb48('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb48('0xa')]));require(_0xdb48('0xc'))['register'](socket);function respondWithRpcPromise(_0x3aeb5b,_0x1ea481,_0x4d8e52){return new BPromise(function(_0x484243,_0x43dabf){return client[_0xdb48('0xd')](_0x3aeb5b,_0x4d8e52)[_0xdb48('0xe')](function(_0x547538){logger[_0xdb48('0xf')](_0xdb48('0x10'),_0x1ea481,'request\x20sent');logger[_0xdb48('0x11')](_0xdb48('0x12'),_0x1ea481,_0xdb48('0x13'),JSON[_0xdb48('0x14')](_0x547538));if(_0x547538[_0xdb48('0x15')]){if(_0x547538[_0xdb48('0x15')]['code']===0x1f4){logger[_0xdb48('0x15')](_0xdb48('0x10'),_0x1ea481,_0x547538[_0xdb48('0x15')]['message']);return _0x43dabf(_0x547538[_0xdb48('0x15')]['message']);}logger[_0xdb48('0x15')](_0xdb48('0x10'),_0x1ea481,_0x547538[_0xdb48('0x15')][_0xdb48('0x16')]);return _0x484243(_0x547538[_0xdb48('0x15')]['message']);}else{logger['info'](_0xdb48('0x10'),_0x1ea481,_0xdb48('0x13'));_0x484243(_0x547538['result'][_0xdb48('0x16')]);}})[_0xdb48('0x17')](function(_0x4917c1){logger['error'](_0xdb48('0x10'),_0x1ea481,_0x4917c1);_0x43dabf(_0x4917c1);});});}exports[_0xdb48('0x18')]=function(_0x370f5b){var _0x59f3e8=this;return new Promise(function(_0x287ddd,_0x3d1b69){return db['MailQueue'][_0xdb48('0x19')]({'raw':_0x370f5b[_0xdb48('0x1a')]?_0x370f5b[_0xdb48('0x1a')][_0xdb48('0x1b')]===undefined?!![]:![]:!![],'where':_0x370f5b[_0xdb48('0x1a')]?_0x370f5b['options'][_0xdb48('0x1c')]||null:null,'attributes':_0x370f5b[_0xdb48('0x1a')]?_0x370f5b[_0xdb48('0x1a')]['attributes']||null:null,'limit':_0x370f5b['options']?_0x370f5b['options'][_0xdb48('0x1d')]||null:null,'include':_0x370f5b[_0xdb48('0x1a')]?_0x370f5b[_0xdb48('0x1a')]['include']?_[_0xdb48('0x1e')](_0x370f5b['options'][_0xdb48('0x1f')],function(_0x3a5bdd){return{'model':db[_0x3a5bdd[_0xdb48('0x20')]],'as':_0x3a5bdd['as'],'attributes':_0x3a5bdd['attributes'],'include':_0x3a5bdd['include']?_[_0xdb48('0x1e')](_0x3a5bdd[_0xdb48('0x1f')],function(_0xf473a0){return{'model':db[_0xf473a0['model']],'as':_0xf473a0['as'],'attributes':_0xf473a0[_0xdb48('0x21')],'include':_0xf473a0[_0xdb48('0x1f')]?_['map'](_0xf473a0['include'],function(_0x31edb6){return{'model':db[_0x31edb6[_0xdb48('0x20')]],'as':_0x31edb6['as'],'attributes':_0x31edb6[_0xdb48('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdb48('0xe')](function(_0x549b18){logger[_0xdb48('0xf')](_0xdb48('0x18'),_0x370f5b);logger[_0xdb48('0x11')]('GetMailQueue',_0x370f5b,JSON[_0xdb48('0x14')](_0x549b18));_0x287ddd(_0x549b18);})[_0xdb48('0x17')](function(_0x9972c0){logger[_0xdb48('0x15')](_0xdb48('0x18'),_0x9972c0[_0xdb48('0x16')],_0x370f5b);_0x3d1b69(_0x59f3e8['error'](0x1f4,_0x9972c0[_0xdb48('0x16')]));});});};exports[_0xdb48('0x22')]=function(_0x1a9385){var _0x63201d=this;return new Promise(function(_0x27371a,_0x387182){return db['MailQueue']['find']({'raw':_0x1a9385[_0xdb48('0x1a')]?_0x1a9385[_0xdb48('0x1a')][_0xdb48('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a9385[_0xdb48('0x1a')]?_0x1a9385[_0xdb48('0x1a')][_0xdb48('0x1c')]||null:null,'attributes':_0x1a9385[_0xdb48('0x1a')]?_0x1a9385[_0xdb48('0x1a')][_0xdb48('0x21')]||null:null,'include':_0x1a9385['options']?_0x1a9385[_0xdb48('0x1a')][_0xdb48('0x1f')]?_[_0xdb48('0x1e')](_0x1a9385[_0xdb48('0x1a')]['include'],function(_0x4d05d0){return{'model':db[_0x4d05d0[_0xdb48('0x20')]],'as':_0x4d05d0['as'],'attributes':_0x4d05d0[_0xdb48('0x21')],'include':_0x4d05d0[_0xdb48('0x1f')]?_[_0xdb48('0x1e')](_0x4d05d0[_0xdb48('0x1f')],function(_0x3c92a4){return{'model':db[_0x3c92a4[_0xdb48('0x20')]],'as':_0x3c92a4['as'],'attributes':_0x3c92a4[_0xdb48('0x21')],'include':_0x3c92a4['include']?_['map'](_0x3c92a4[_0xdb48('0x1f')],function(_0x484cb2){return{'model':db[_0x484cb2[_0xdb48('0x20')]],'as':_0x484cb2['as'],'attributes':_0x484cb2[_0xdb48('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdb48('0xe')](function(_0x16c913){logger[_0xdb48('0xf')](_0xdb48('0x22'),_0x1a9385);logger[_0xdb48('0x11')](_0xdb48('0x22'),_0x1a9385,JSON['stringify'](_0x16c913));_0x27371a(_0x16c913);})[_0xdb48('0x17')](function(_0x1f71ad){logger['error'](_0xdb48('0x22'),_0x1f71ad[_0xdb48('0x16')],_0x1a9385);_0x387182(_0x63201d[_0xdb48('0x15')](0x1f4,_0x1f71ad[_0xdb48('0x16')]));});});}; \ No newline at end of file +var _0x292b=['then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailQueue','findAll','options','raw','attributes','limit','include','map','model','MailQueue','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x36d20f,_0x133196){var _0x324a71=function(_0x2153b3){while(--_0x2153b3){_0x36d20f['push'](_0x36d20f['shift']());}};_0x324a71(++_0x133196);}(_0x292b,0x64));var _0xb292=function(_0x21c09f,_0x6ce866){_0x21c09f=_0x21c09f-0x0;var _0x164d58=_0x292b[_0x21c09f];return _0x164d58;};'use strict';var _=require(_0xb292('0x0'));var util=require(_0xb292('0x1'));var moment=require(_0xb292('0x2'));var BPromise=require(_0xb292('0x3'));var rs=require(_0xb292('0x4'));var fs=require('fs');var Redis=require(_0xb292('0x5'));var db=require(_0xb292('0x6'))['db'];var utils=require(_0xb292('0x7'));var logger=require(_0xb292('0x8'))(_0xb292('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb292('0xa')]({'port':0x232a});config[_0xb292('0xb')]=_[_0xb292('0xc')](config['redis'],{'host':_0xb292('0xd'),'port':0x18eb});var socket=require(_0xb292('0xe'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xb292('0xf')](socket);function respondWithRpcPromise(_0xa30857,_0x36be8a,_0x5b4b7a){return new BPromise(function(_0x36517c,_0x3e4ac2){return client[_0xb292('0x10')](_0xa30857,_0x5b4b7a)[_0xb292('0x11')](function(_0x537d8b){logger[_0xb292('0x12')](_0xb292('0x13'),_0x36be8a,_0xb292('0x14'));logger[_0xb292('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x36be8a,_0xb292('0x14'),JSON[_0xb292('0x16')](_0x537d8b));if(_0x537d8b['error']){if(_0x537d8b['error']['code']===0x1f4){logger[_0xb292('0x17')](_0xb292('0x13'),_0x36be8a,_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);return _0x3e4ac2(_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);}logger[_0xb292('0x17')]('MailQueue,\x20%s,\x20%s',_0x36be8a,_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);return _0x36517c(_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);}else{logger[_0xb292('0x12')](_0xb292('0x13'),_0x36be8a,'request\x20sent');_0x36517c(_0x537d8b[_0xb292('0x19')][_0xb292('0x18')]);}})[_0xb292('0x1a')](function(_0x3ad738){logger[_0xb292('0x17')](_0xb292('0x13'),_0x36be8a,_0x3ad738);_0x3e4ac2(_0x3ad738);});});}exports[_0xb292('0x1b')]=function(_0x50e400){var _0x3a56eb=this;return new Promise(function(_0x336785,_0x4437d6){return db['MailQueue'][_0xb292('0x1c')]({'raw':_0x50e400[_0xb292('0x1d')]?_0x50e400['options'][_0xb292('0x1e')]===undefined?!![]:![]:!![],'where':_0x50e400['options']?_0x50e400[_0xb292('0x1d')]['where']||null:null,'attributes':_0x50e400[_0xb292('0x1d')]?_0x50e400['options'][_0xb292('0x1f')]||null:null,'limit':_0x50e400['options']?_0x50e400[_0xb292('0x1d')][_0xb292('0x20')]||null:null,'include':_0x50e400[_0xb292('0x1d')]?_0x50e400[_0xb292('0x1d')][_0xb292('0x21')]?_[_0xb292('0x22')](_0x50e400['options']['include'],function(_0x5537ee){return{'model':db[_0x5537ee['model']],'as':_0x5537ee['as'],'attributes':_0x5537ee[_0xb292('0x1f')],'include':_0x5537ee[_0xb292('0x21')]?_[_0xb292('0x22')](_0x5537ee['include'],function(_0x4a1575){return{'model':db[_0x4a1575[_0xb292('0x23')]],'as':_0x4a1575['as'],'attributes':_0x4a1575[_0xb292('0x1f')],'include':_0x4a1575['include']?_['map'](_0x4a1575[_0xb292('0x21')],function(_0xde939c){return{'model':db[_0xde939c[_0xb292('0x23')]],'as':_0xde939c['as'],'attributes':_0xde939c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb292('0x11')](function(_0x5e5a29){logger[_0xb292('0x12')](_0xb292('0x1b'),_0x50e400);logger[_0xb292('0x15')](_0xb292('0x1b'),_0x50e400,JSON[_0xb292('0x16')](_0x5e5a29));_0x336785(_0x5e5a29);})[_0xb292('0x1a')](function(_0xe01a3b){logger['error'](_0xb292('0x1b'),_0xe01a3b[_0xb292('0x18')],_0x50e400);_0x4437d6(_0x3a56eb[_0xb292('0x17')](0x1f4,_0xe01a3b[_0xb292('0x18')]));});});};exports['ShowMailQueue']=function(_0x234fdc){var _0x110384=this;return new Promise(function(_0x444dc0,_0x33b8cf){return db[_0xb292('0x24')][_0xb292('0x25')]({'raw':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')][_0xb292('0x1e')]===undefined?!![]:![]:!![],'where':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')]['where']||null:null,'attributes':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')][_0xb292('0x1f')]||null:null,'include':_0x234fdc[_0xb292('0x1d')]?_0x234fdc['options']['include']?_[_0xb292('0x22')](_0x234fdc[_0xb292('0x1d')][_0xb292('0x21')],function(_0x7c58e3){return{'model':db[_0x7c58e3['model']],'as':_0x7c58e3['as'],'attributes':_0x7c58e3['attributes'],'include':_0x7c58e3[_0xb292('0x21')]?_[_0xb292('0x22')](_0x7c58e3[_0xb292('0x21')],function(_0xd1f9ae){return{'model':db[_0xd1f9ae[_0xb292('0x23')]],'as':_0xd1f9ae['as'],'attributes':_0xd1f9ae['attributes'],'include':_0xd1f9ae[_0xb292('0x21')]?_[_0xb292('0x22')](_0xd1f9ae[_0xb292('0x21')],function(_0x335d9c){return{'model':db[_0x335d9c[_0xb292('0x23')]],'as':_0x335d9c['as'],'attributes':_0x335d9c[_0xb292('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb292('0x11')](function(_0x1907e1){logger[_0xb292('0x12')](_0xb292('0x26'),_0x234fdc);logger[_0xb292('0x15')](_0xb292('0x26'),_0x234fdc,JSON[_0xb292('0x16')](_0x1907e1));_0x444dc0(_0x1907e1);})['catch'](function(_0x40d82c){logger[_0xb292('0x17')](_0xb292('0x26'),_0x40d82c[_0xb292('0x18')],_0x234fdc);_0x33b8cf(_0x110384[_0xb292('0x17')](0x1f4,_0x40d82c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 49a195d..beda90e 100644 --- a/server/api/mailQueue/mailQueue.socket.js +++ b/server/api/mailQueue/mailQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf742=['register','length','mailQueue:','save','remove','emit'];(function(_0x2b7c74,_0x5a34cc){var _0x41f858=function(_0xb3cd70){while(--_0xb3cd70){_0x2b7c74['push'](_0x2b7c74['shift']());}};_0x41f858(++_0x5a34cc);}(_0xf742,0x75));var _0x2f74=function(_0x3f7608,_0x51adb3){_0x3f7608=_0x3f7608-0x0;var _0x983f01=_0xf742[_0x3f7608];return _0x983f01;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x2f74('0x0'),_0x2f74('0x1'),'update'];function createListener(_0x21cd13,_0x3ebd4c){return function(_0x3e3a2a){_0x3ebd4c[_0x2f74('0x2')](_0x21cd13,_0x3e3a2a);};}function removeListener(_0x4124af,_0x1bfe02){return function(){MailQueueEvents['removeListener'](_0x4124af,_0x1bfe02);};}exports[_0x2f74('0x3')]=function(_0x2cfaf0){for(var _0x110912=0x0,_0x295685=events[_0x2f74('0x4')];_0x110912<_0x295685;_0x110912++){var _0x14c97d=events[_0x110912];var _0x3093ae=createListener(_0x2f74('0x5')+_0x14c97d,_0x2cfaf0);MailQueueEvents['on'](_0x14c97d,_0x3093ae);}}; \ No newline at end of file +var _0xbbec=['removeListener','register','mailQueue:','./mailQueue.events','remove','emit'];(function(_0x5b2507,_0x480601){var _0x35b4d2=function(_0x1b2c69){while(--_0x1b2c69){_0x5b2507['push'](_0x5b2507['shift']());}};_0x35b4d2(++_0x480601);}(_0xbbec,0x7b));var _0xcbbe=function(_0x3659ce,_0x35f715){_0x3659ce=_0x3659ce-0x0;var _0x26bf29=_0xbbec[_0x3659ce];return _0x26bf29;};'use strict';var MailQueueEvents=require(_0xcbbe('0x0'));var events=['save',_0xcbbe('0x1'),'update'];function createListener(_0x2e2a6c,_0x204af5){return function(_0x1c4354){_0x204af5[_0xcbbe('0x2')](_0x2e2a6c,_0x1c4354);};}function removeListener(_0x4e53a7,_0x13c2aa){return function(){MailQueueEvents[_0xcbbe('0x3')](_0x4e53a7,_0x13c2aa);};}exports[_0xcbbe('0x4')]=function(_0x444a06){for(var _0x4aee98=0x0,_0x4b89bb=events['length'];_0x4aee98<_0x4b89bb;_0x4aee98++){var _0x477274=events[_0x4aee98];var _0x1d23d5=createListener(_0xcbbe('0x5')+_0x477274,_0x444a06);MailQueueEvents['on'](_0x477274,_0x1d23d5);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1a71400..ee70264 100644 --- a/server/api/mailQueueReport/index.js +++ b/server/api/mailQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x554f=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy'];(function(_0x3efdca,_0xa17654){var _0x2d9479=function(_0xe3cf18){while(--_0xe3cf18){_0x3efdca['push'](_0x3efdca['shift']());}};_0x2d9479(++_0xa17654);}(_0x554f,0x190));var _0xf554=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x554f[_0x57d13b];return _0x467696;};'use strict';var multer=require(_0xf554('0x0'));var util=require(_0xf554('0x1'));var path=require('path');var timeout=require(_0xf554('0x2'));var express=require('express');var router=express[_0xf554('0x3')]();var fs_extra=require(_0xf554('0x4'));var auth=require(_0xf554('0x5'));var interaction=require(_0xf554('0x6'));var config=require(_0xf554('0x7'));var controller=require(_0xf554('0x8'));router[_0xf554('0x9')]('/',auth[_0xf554('0xa')](),controller['index']);router['get'](_0xf554('0xb'),auth['isAuthenticated'](),controller[_0xf554('0xc')]);router[_0xf554('0x9')](_0xf554('0xd'),auth['isAuthenticated'](),controller[_0xf554('0xe')]);router[_0xf554('0xf')]('/',auth[_0xf554('0xa')](),controller[_0xf554('0x10')]);router[_0xf554('0x11')](_0xf554('0xd'),auth[_0xf554('0xa')](),controller[_0xf554('0x12')]);router['delete'](_0xf554('0xd'),auth['isAuthenticated'](),controller[_0xf554('0x13')]);module['exports']=router; \ No newline at end of file +var _0x87e1=['isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x87e1,0x185));var _0x187e=function(_0x2a91f8,_0x449a8b){_0x2a91f8=_0x2a91f8-0x0;var _0x8e0541=_0x87e1[_0x2a91f8];return _0x8e0541;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x187e('0x0'));var express=require(_0x187e('0x1'));var router=express['Router']();var fs_extra=require(_0x187e('0x2'));var auth=require(_0x187e('0x3'));var interaction=require(_0x187e('0x4'));var config=require('../../config/environment');var controller=require(_0x187e('0x5'));router[_0x187e('0x6')]('/',auth[_0x187e('0x7')](),controller[_0x187e('0x8')]);router[_0x187e('0x6')](_0x187e('0x9'),auth['isAuthenticated'](),controller[_0x187e('0xa')]);router[_0x187e('0x6')]('/:id',auth[_0x187e('0x7')](),controller[_0x187e('0xb')]);router['post']('/',auth[_0x187e('0x7')](),controller[_0x187e('0xc')]);router[_0x187e('0xd')](_0x187e('0xe'),auth[_0x187e('0x7')](),controller[_0x187e('0xf')]);router[_0x187e('0x10')]('/:id',auth[_0x187e('0x7')](),controller[_0x187e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 1fcba87..5db87af 100644 --- a/server/api/mailQueueReport/mailQueueReport.attributes.js +++ b/server/api/mailQueueReport/mailQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd78e=['exports','DATE','STRING','moment','sequelize'];(function(_0x3e2f72,_0xdb9260){var _0x2cc495=function(_0x2fed3f){while(--_0x2fed3f){_0x3e2f72['push'](_0x3e2f72['shift']());}};_0x2cc495(++_0xdb9260);}(_0xd78e,0xc1));var _0xed78=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0xd78e[_0xa9a245];return _0x2d0eaa;};'use strict';var moment=require(_0xed78('0x0'));var Sequelize=require(_0xed78('0x1'));module[_0xed78('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xed78('0x3')]},'leaveAt':{'type':Sequelize[_0xed78('0x3')]},'acceptAt':{'type':Sequelize[_0xed78('0x3')]},'exitAt':{'type':Sequelize[_0xed78('0x3')]},'reason':{'type':Sequelize[_0xed78('0x4')]}}; \ No newline at end of file +var _0x6eb0=['DATE','moment','sequelize','exports','STRING'];(function(_0x4334ce,_0x3e72b9){var _0x5c03d1=function(_0x59a0f1){while(--_0x59a0f1){_0x4334ce['push'](_0x4334ce['shift']());}};_0x5c03d1(++_0x3e72b9);}(_0x6eb0,0x114));var _0x06eb=function(_0x35bda9,_0x3b0c01){_0x35bda9=_0x35bda9-0x0;var _0x26eefc=_0x6eb0[_0x35bda9];return _0x26eefc;};'use strict';var moment=require(_0x06eb('0x0'));var Sequelize=require(_0x06eb('0x1'));module[_0x06eb('0x2')]={'uniqueid':{'type':Sequelize[_0x06eb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x06eb('0x3')]},'joinAt':{'type':Sequelize[_0x06eb('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x06eb('0x4')]},'exitAt':{'type':Sequelize[_0x06eb('0x4')]},'reason':{'type':Sequelize[_0x06eb('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 98250e4..02f0604 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb016=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','MailQueueReport','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body','describe','eml-format','rimraf','request-promise','bluebird','mustache'];(function(_0x2474b3,_0x289ae6){var _0x5e9679=function(_0x736ada){while(--_0x736ada){_0x2474b3['push'](_0x2474b3['shift']());}};_0x5e9679(++_0x289ae6);}(_0xb016,0x159));var _0x6b01=function(_0x181e19,_0x39c63d){_0x181e19=_0x181e19-0x0;var _0x114d96=_0xb016[_0x181e19];return _0x114d96;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':!![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['MailQueueReport'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));};exports[_0x6b01('0x45')]=function(_0x13ab4f,_0x5617d7){return db[_0x6b01('0x29')][_0x6b01('0x45')]()[_0x6b01('0x21')](respondWithResult(_0x5617d7,null))[_0x6b01('0x40')](handleError(_0x5617d7,null));}; \ No newline at end of file +var _0x0424=['index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','MailQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send'];(function(_0x30be39,_0xfb49ad){var _0x4d99d6=function(_0x1e7665){while(--_0x1e7665){_0x30be39['push'](_0x30be39['shift']());}};_0x4d99d6(++_0xfb49ad);}(_0x0424,0x159));var _0x4042=function(_0x8cb470,_0x2b9757){_0x8cb470=_0x8cb470-0x0;var _0x2ca139=_0x0424[_0x8cb470];return _0x2ca139;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4042('0x0'));var jsonpatch=require(_0x4042('0x1'));var rp=require(_0x4042('0x2'));var moment=require(_0x4042('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4042('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4042('0x5'));var csv=require(_0x4042('0x6'));var ejs=require(_0x4042('0x7'));var fs=require('fs');var fs_extra=require(_0x4042('0x8'));var _=require(_0x4042('0x9'));var squel=require(_0x4042('0xa'));var crypto=require(_0x4042('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4042('0x6'));var querystring=require(_0x4042('0xc'));var Papa=require(_0x4042('0xd'));var Redis=require('ioredis');var authService=require(_0x4042('0xe'));var qs=require(_0x4042('0xf'));var as=require(_0x4042('0x10'));var hardwareService=require(_0x4042('0x11'));var logger=require(_0x4042('0x12'))(_0x4042('0x13'));var utils=require(_0x4042('0x14'));var config=require(_0x4042('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4042('0x16'))['db'];function respondWithStatusCode(_0x357838,_0x59a068){_0x59a068=_0x59a068||0xcc;return function(_0x25fd0a){if(_0x25fd0a){return _0x357838[_0x4042('0x17')](_0x59a068);}return _0x357838[_0x4042('0x18')](_0x59a068)[_0x4042('0x19')]();};}function respondWithResult(_0x35f82a,_0x1ff3ca){_0x1ff3ca=_0x1ff3ca||0xc8;return function(_0xc115bd){if(_0xc115bd){return _0x35f82a['status'](_0x1ff3ca)[_0x4042('0x1a')](_0xc115bd);}};}function respondWithFilteredResult(_0x291e5c,_0x50206f){return function(_0x28087d){if(_0x28087d){var _0x3f99f8=typeof _0x50206f[_0x4042('0x1b')]===_0x4042('0x1c')&&typeof _0x50206f[_0x4042('0x1d')]===_0x4042('0x1c');var _0x62cb76=_0x28087d[_0x4042('0x1e')];var _0x466077=_0x3f99f8?0x0:_0x50206f['offset'];var _0xe5c1ec=_0x3f99f8?_0x28087d['count']:_0x50206f[_0x4042('0x1b')]+_0x50206f['limit'];var _0xca9ca6;if(_0xe5c1ec>=_0x62cb76){_0xe5c1ec=_0x62cb76;_0xca9ca6=0xc8;}else{_0xca9ca6=0xce;}_0x291e5c[_0x4042('0x18')](_0xca9ca6);return _0x291e5c[_0x4042('0x1f')](_0x4042('0x20'),_0x466077+'-'+_0xe5c1ec+'/'+_0x62cb76)['json'](_0x28087d);}return null;};}function patchUpdates(_0xb72021){return function(_0x4561e3){try{jsonpatch[_0x4042('0x21')](_0x4561e3,_0xb72021,!![]);}catch(_0xd1ddb){return BPromise['reject'](_0xd1ddb);}return _0x4561e3[_0x4042('0x22')]();};}function saveUpdates(_0xf0e0c6,_0xd6fe6c){return function(_0x83ce71){if(_0x83ce71){return _0x83ce71[_0x4042('0x23')](_0xf0e0c6)['then'](function(_0x1f9d4a){return _0x1f9d4a;});}return null;};}function removeEntity(_0x6d12a5,_0x519f2c){return function(_0x1daee8){if(_0x1daee8){return _0x1daee8['destroy']()[_0x4042('0x24')](function(){_0x6d12a5[_0x4042('0x18')](0xcc)[_0x4042('0x19')]();});}};}function handleEntityNotFound(_0x5d5c6d,_0x461c5e){return function(_0x3b9e78){if(!_0x3b9e78){_0x5d5c6d[_0x4042('0x17')](0x194);}return _0x3b9e78;};}function handleError(_0xbdadc8,_0x1c4d9f){_0x1c4d9f=_0x1c4d9f||0x1f4;return function(_0x52e575){logger['error'](_0x52e575[_0x4042('0x25')]);if(_0x52e575[_0x4042('0x26')]){delete _0x52e575[_0x4042('0x26')];}_0xbdadc8[_0x4042('0x18')](_0x1c4d9f)[_0x4042('0x27')](_0x52e575);};}exports[_0x4042('0x28')]=function(_0x5eb84b,_0x33733b){var _0x1e9bd7={},_0x4a6a6e={},_0xae26c2={'count':0x0,'rows':[]};var _0x89e16=_[_0x4042('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x3d1f48){return{'name':_0x3d1f48[_0x4042('0x2a')],'type':_0x3d1f48['type'][_0x4042('0x2b')]};});_0x4a6a6e[_0x4042('0x2c')]=_[_0x4042('0x29')](_0x89e16,_0x4042('0x26'));_0x4a6a6e[_0x4042('0x2d')]=_[_0x4042('0x2e')](_0x5eb84b[_0x4042('0x2d')]);_0x4a6a6e[_0x4042('0x2f')]=_[_0x4042('0x30')](_0x4a6a6e['model'],_0x4a6a6e[_0x4042('0x2d')]);_0x1e9bd7[_0x4042('0x31')]=_['intersection'](_0x4a6a6e[_0x4042('0x2c')],qs[_0x4042('0x32')](_0x5eb84b['query'][_0x4042('0x32')]));_0x1e9bd7[_0x4042('0x31')]=_0x1e9bd7[_0x4042('0x31')][_0x4042('0x33')]?_0x1e9bd7[_0x4042('0x31')]:_0x4a6a6e[_0x4042('0x2c')];if(!_0x5eb84b[_0x4042('0x2d')][_0x4042('0x34')](_0x4042('0x35'))){_0x1e9bd7[_0x4042('0x1d')]=qs[_0x4042('0x1d')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x1d')]);_0x1e9bd7[_0x4042('0x1b')]=qs[_0x4042('0x1b')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x1b')]);}_0x1e9bd7[_0x4042('0x36')]=qs[_0x4042('0x37')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x37')]);_0x1e9bd7['where']=qs[_0x4042('0x2f')](_[_0x4042('0x38')](_0x5eb84b[_0x4042('0x2d')],_0x4a6a6e[_0x4042('0x2f')]),_0x89e16);if(_0x5eb84b['query'][_0x4042('0x39')]){_0x1e9bd7[_0x4042('0x3a')]=_[_0x4042('0x3b')](_0x1e9bd7[_0x4042('0x3a')],{'$or':_[_0x4042('0x29')](_0x89e16,function(_0x13da64){if(_0x13da64[_0x4042('0x3c')]!==_0x4042('0x3d')){var _0x341083={};_0x341083[_0x13da64[_0x4042('0x26')]]={'$like':'%'+_0x5eb84b['query'][_0x4042('0x39')]+'%'};return _0x341083;}})});}_0x1e9bd7=_[_0x4042('0x3b')]({},_0x1e9bd7,_0x5eb84b[_0x4042('0x3e')]);var _0x1eab87={'where':_0x1e9bd7[_0x4042('0x3a')]};return db[_0x4042('0x3f')][_0x4042('0x1e')](_0x1eab87)[_0x4042('0x24')](function(_0x52b1bd){_0xae26c2['count']=_0x52b1bd;if(_0x5eb84b[_0x4042('0x2d')][_0x4042('0x40')]){_0x1e9bd7[_0x4042('0x41')]=[{'all':!![]}];}return db[_0x4042('0x3f')][_0x4042('0x42')](_0x1e9bd7);})[_0x4042('0x24')](function(_0xdfb5cb){_0xae26c2[_0x4042('0x43')]=_0xdfb5cb;return _0xae26c2;})[_0x4042('0x24')](respondWithFilteredResult(_0x33733b,_0x1e9bd7))[_0x4042('0x44')](handleError(_0x33733b,null));};exports[_0x4042('0x45')]=function(_0x35fdc2,_0x5666ed){var _0x5dea57={'raw':!![],'where':{'id':_0x35fdc2[_0x4042('0x46')]['id']}},_0x929884={};_0x929884['model']=_[_0x4042('0x2e')](db['MailQueueReport'][_0x4042('0x47')]);_0x929884[_0x4042('0x2d')]=_[_0x4042('0x2e')](_0x35fdc2['query']);_0x929884[_0x4042('0x2f')]=_[_0x4042('0x30')](_0x929884['model'],_0x929884[_0x4042('0x2d')]);_0x5dea57[_0x4042('0x31')]=_[_0x4042('0x30')](_0x929884[_0x4042('0x2c')],qs[_0x4042('0x32')](_0x35fdc2['query']['fields']));_0x5dea57['attributes']=_0x5dea57[_0x4042('0x31')][_0x4042('0x33')]?_0x5dea57['attributes']:_0x929884['model'];if(_0x35fdc2['query'][_0x4042('0x40')]){_0x5dea57['include']=[{'all':!![]}];}_0x5dea57=_['merge']({},_0x5dea57,_0x35fdc2[_0x4042('0x3e')]);return db[_0x4042('0x3f')][_0x4042('0x48')](_0x5dea57)[_0x4042('0x24')](handleEntityNotFound(_0x5666ed,null))[_0x4042('0x24')](respondWithResult(_0x5666ed,null))[_0x4042('0x44')](handleError(_0x5666ed,null));};exports[_0x4042('0x49')]=function(_0x2abc13,_0x198209){return db['MailQueueReport']['create'](_0x2abc13['body'],{})['then'](respondWithResult(_0x198209,0xc9))[_0x4042('0x44')](handleError(_0x198209,null));};exports[_0x4042('0x23')]=function(_0xd898ea,_0x250434){if(_0xd898ea[_0x4042('0x4a')]['id']){delete _0xd898ea[_0x4042('0x4a')]['id'];}return db[_0x4042('0x3f')][_0x4042('0x48')]({'where':{'id':_0xd898ea['params']['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x250434,null))[_0x4042('0x24')](saveUpdates(_0xd898ea[_0x4042('0x4a')],null))[_0x4042('0x24')](respondWithResult(_0x250434,null))[_0x4042('0x44')](handleError(_0x250434,null));};exports[_0x4042('0x4b')]=function(_0xf5f38a,_0x591a0f){return db['MailQueueReport']['find']({'where':{'id':_0xf5f38a[_0x4042('0x46')]['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x591a0f,null))['then'](removeEntity(_0x591a0f,null))[_0x4042('0x44')](handleError(_0x591a0f,null));};exports[_0x4042('0x4c')]=function(_0x5d42a7,_0x4ec047){return db[_0x4042('0x3f')][_0x4042('0x4c')]()[_0x4042('0x24')](respondWithResult(_0x4ec047,null))[_0x4042('0x44')](handleError(_0x4ec047,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 7e356b7..894b8a1 100644 --- a/server/api/mailQueueReport/mailQueueReport.model.js +++ b/server/api/mailQueueReport/mailQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a2d=['./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x9a2d,0x6d));var _0xd9a2=function(_0x394a30,_0x12b99f){_0x394a30=_0x394a30-0x0;var _0x20ae5d=_0x9a2d[_0x394a30];return _0x20ae5d;};'use strict';var _=require(_0xd9a2('0x0'));var util=require(_0xd9a2('0x1'));var logger=require('../../config/logger')(_0xd9a2('0x2'));var moment=require(_0xd9a2('0x3'));var BPromise=require(_0xd9a2('0x4'));var rp=require(_0xd9a2('0x5'));var fs=require('fs');var path=require(_0xd9a2('0x6'));var rimraf=require(_0xd9a2('0x7'));var config=require('../../config/environment');var attributes=require(_0xd9a2('0x8'));module[_0xd9a2('0x9')]=function(_0x49fb38,_0x289a23){return _0x49fb38[_0xd9a2('0xa')](_0xd9a2('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xd9a2('0xc'),'fields':[_0xd9a2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x342a=['api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x13d2ef,_0x22e4b5){var _0x2d859e=function(_0x3516f1){while(--_0x3516f1){_0x13d2ef['push'](_0x13d2ef['shift']());}};_0x2d859e(++_0x22e4b5);}(_0x342a,0xa2));var _0xa342=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x342a[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xa342('0x0'));var util=require(_0xa342('0x1'));var logger=require(_0xa342('0x2'))(_0xa342('0x3'));var moment=require('moment');var BPromise=require(_0xa342('0x4'));var rp=require(_0xa342('0x5'));var fs=require('fs');var path=require(_0xa342('0x6'));var rimraf=require(_0xa342('0x7'));var config=require(_0xa342('0x8'));var attributes=require(_0xa342('0x9'));module[_0xa342('0xa')]=function(_0xe4f458,_0x125618){return _0xe4f458[_0xa342('0xb')](_0xa342('0xc'),attributes,{'tableName':_0xa342('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa342('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3f73301..d1ce6b7 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x1c33dc,_0x177c7e){var _0x405580=function(_0x556105){while(--_0x556105){_0x1c33dc['push'](_0x1c33dc['shift']());}};_0x405580(++_0x177c7e);}(_0x2ef3,0xba));var _0x32ef=function(_0x3eeeb7,_0x2f067d){_0x3eeeb7=_0x3eeeb7-0x0;var _0x3866dc=_0x2ef3[_0x3eeeb7];return _0x3866dc;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x25f837,_0x2acc67){var _0x522be5=function(_0x25cc9b){while(--_0x25cc9b){_0x25f837['push'](_0x25f837['shift']());}};_0x522be5(++_0x2acc67);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21ec39,_0xde5801){_0x21ec39=_0x21ec39-0x0;var _0x229f6f=_0x5f2f[_0x21ec39];return _0x229f6f;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index e2266f0..6924041 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3c6d98,_0x46ee36){var _0x54a0ad=function(_0x2b0267){while(--_0x2b0267){_0x3c6d98['push'](_0x3c6d98['shift']());}};_0x54a0ad(++_0x46ee36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x429868,_0x222e94){var _0x2df411=function(_0x418006){while(--_0x418006){_0x429868['push'](_0x429868['shift']());}};_0x2df411(++_0x222e94);}(_0xedd9,0xfc));var _0x9edd=function(_0x45a2e2,_0x92d820){_0x45a2e2=_0x45a2e2-0x0;var _0x9cdd87=_0xedd9[_0x45a2e2];return _0x9cdd87;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 0a27ee2..7d7c176 100644 --- a/server/api/mailServerIn/mailServerIn.attributes.js +++ b/server/api/mailServerIn/mailServerIn.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf35d=['STRING','INTEGER','BOOLEAN'];(function(_0x756c38,_0x9de750){var _0x4c51dd=function(_0x171577){while(--_0x171577){_0x756c38['push'](_0x756c38['shift']());}};_0x4c51dd(++_0x9de750);}(_0xf35d,0xcc));var _0xdf35=function(_0xbde8f8,_0x200950){_0xbde8f8=_0xbde8f8-0x0;var _0x15a357=_0xf35d[_0xbde8f8];return _0x15a357;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xdf35('0x0')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xdf35('0x0')]},'password':{'type':Sequelize[_0xdf35('0x0')]},'port':{'type':Sequelize[_0xdf35('0x1')]},'tls':{'type':Sequelize[_0xdf35('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xdf35('0x0')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xdf35('0x1')],'defaultValue':0x5},'service':{'type':Sequelize[_0xdf35('0x0')]},'modernAuthentication':{'type':Sequelize[_0xdf35('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd8af=['BOOLEAN','exports','STRING','INTEGER','INBOX'];(function(_0x9731b4,_0x26aac3){var _0x3d7a66=function(_0x4be24c){while(--_0x4be24c){_0x9731b4['push'](_0x9731b4['shift']());}};_0x3d7a66(++_0x26aac3);}(_0xd8af,0x1d7));var _0xfd8a=function(_0xbe6878,_0x1615a7){_0xbe6878=_0xbe6878-0x0;var _0x37df8d=_0xd8af[_0xbe6878];return _0x37df8d;};'use strict';var Sequelize=require('sequelize');module[_0xfd8a('0x0')]={'description':{'type':Sequelize[_0xfd8a('0x1')]},'host':{'type':Sequelize[_0xfd8a('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfd8a('0x1')]},'port':{'type':Sequelize[_0xfd8a('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xfd8a('0x1')],'defaultValue':_0xfd8a('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xfd8a('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xfd8a('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5192e8b..ebdf713 100644 --- a/server/api/mailServerIn/mailServerIn.model.js +++ b/server/api/mailServerIn/mailServerIn.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2741=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','MailServerIn','mail_servers_in','lodash'];(function(_0x550ea4,_0x182e72){var _0x203d77=function(_0x1f5984){while(--_0x1f5984){_0x550ea4['push'](_0x550ea4['shift']());}};_0x203d77(++_0x182e72);}(_0x2741,0x1bb));var _0x1274=function(_0x1b2395,_0x3048ee){_0x1b2395=_0x1b2395-0x0;var _0x166b29=_0x2741[_0x1b2395];return _0x166b29;};'use strict';var _=require(_0x1274('0x0'));var util=require(_0x1274('0x1'));var logger=require(_0x1274('0x2'))(_0x1274('0x3'));var moment=require(_0x1274('0x4'));var BPromise=require(_0x1274('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1274('0x6'));var rimraf=require(_0x1274('0x7'));var config=require(_0x1274('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x1274('0x9')]=function(_0x5a9778,_0x132cd0){return _0x5a9778['define'](_0x1274('0xa'),attributes,{'tableName':_0x1274('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42df=['request-promise','path','../../config/environment','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x59cd25,_0x55b586){var _0x1efadf=function(_0x4b66dc){while(--_0x4b66dc){_0x59cd25['push'](_0x59cd25['shift']());}};_0x1efadf(++_0x55b586);}(_0x42df,0x8a));var _0xf42d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x42df[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf42d('0x0'));var util=require(_0xf42d('0x1'));var logger=require(_0xf42d('0x2'))(_0xf42d('0x3'));var moment=require(_0xf42d('0x4'));var BPromise=require(_0xf42d('0x5'));var rp=require(_0xf42d('0x6'));var fs=require('fs');var path=require(_0xf42d('0x7'));var rimraf=require('rimraf');var config=require(_0xf42d('0x8'));var attributes=require('./mailServerIn.attributes');module[_0xf42d('0x9')]=function(_0x3b782e,_0x3d8096){return _0x3b782e['define'](_0xf42d('0xa'),attributes,{'tableName':_0xf42d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index fb3e555..34b8a8f 100644 --- a/server/api/mailServerIn/mailServerIn.rpc.js +++ b/server/api/mailServerIn/mailServerIn.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c50=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s,\x20%s','error','MailServerIn,\x20%s,\x20%s','message','request\x20sent','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','map','include','model','debug','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x4b1608,_0x2b6b73){var _0x3033e1=function(_0x13660a){while(--_0x13660a){_0x4b1608['push'](_0x4b1608['shift']());}};_0x3033e1(++_0x2b6b73);}(_0x6c50,0xa4));var _0x06c5=function(_0x23851f,_0x534508){_0x23851f=_0x23851f-0x0;var _0x1582da=_0x6c50[_0x23851f];return _0x1582da;};'use strict';var _=require(_0x06c5('0x0'));var util=require(_0x06c5('0x1'));var moment=require(_0x06c5('0x2'));var BPromise=require(_0x06c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06c5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x06c5('0x5'));var logger=require(_0x06c5('0x6'))(_0x06c5('0x7'));var config=require(_0x06c5('0x8'));var jayson=require(_0x06c5('0x9'));var client=jayson[_0x06c5('0xa')][_0x06c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x427dd6,_0x181c7f,_0x17c636){return new BPromise(function(_0x154b0a,_0x546ae5){return client[_0x06c5('0xc')](_0x427dd6,_0x17c636)[_0x06c5('0xd')](function(_0x3010af){logger[_0x06c5('0xe')]('MailServerIn,\x20%s,\x20%s',_0x181c7f,'request\x20sent');logger['debug'](_0x06c5('0xf'),_0x181c7f,'request\x20sent',JSON['stringify'](_0x3010af));if(_0x3010af['error']){if(_0x3010af[_0x06c5('0x10')]['code']===0x1f4){logger[_0x06c5('0x10')](_0x06c5('0x11'),_0x181c7f,_0x3010af[_0x06c5('0x10')]['message']);return _0x546ae5(_0x3010af[_0x06c5('0x10')][_0x06c5('0x12')]);}logger[_0x06c5('0x10')](_0x06c5('0x11'),_0x181c7f,_0x3010af['error']['message']);return _0x154b0a(_0x3010af[_0x06c5('0x10')][_0x06c5('0x12')]);}else{logger[_0x06c5('0xe')]('MailServerIn,\x20%s,\x20%s',_0x181c7f,_0x06c5('0x13'));_0x154b0a(_0x3010af[_0x06c5('0x14')]['message']);}})[_0x06c5('0x15')](function(_0x9045e6){logger[_0x06c5('0x10')](_0x06c5('0x11'),_0x181c7f,_0x9045e6);_0x546ae5(_0x9045e6);});});}exports[_0x06c5('0x16')]=function(_0x36b9e9){var _0x44d14e=this;return new Promise(function(_0x18a070,_0x1393f5){return db[_0x06c5('0x17')][_0x06c5('0x18')]({'raw':_0x36b9e9[_0x06c5('0x19')]?_0x36b9e9[_0x06c5('0x19')][_0x06c5('0x1a')]===undefined?!![]:![]:!![],'where':_0x36b9e9[_0x06c5('0x19')]?_0x36b9e9[_0x06c5('0x19')][_0x06c5('0x1b')]||null:null,'attributes':_0x36b9e9['options']?_0x36b9e9[_0x06c5('0x19')][_0x06c5('0x1c')]||null:null,'limit':_0x36b9e9[_0x06c5('0x19')]?_0x36b9e9[_0x06c5('0x19')][_0x06c5('0x1d')]||null:null,'include':_0x36b9e9[_0x06c5('0x19')]?_0x36b9e9[_0x06c5('0x19')]['include']?_[_0x06c5('0x1e')](_0x36b9e9[_0x06c5('0x19')][_0x06c5('0x1f')],function(_0x20ba9e){return{'model':db[_0x20ba9e[_0x06c5('0x20')]],'as':_0x20ba9e['as'],'attributes':_0x20ba9e[_0x06c5('0x1c')],'include':_0x20ba9e[_0x06c5('0x1f')]?_['map'](_0x20ba9e[_0x06c5('0x1f')],function(_0x5aeb6c){return{'model':db[_0x5aeb6c['model']],'as':_0x5aeb6c['as'],'attributes':_0x5aeb6c['attributes'],'include':_0x5aeb6c['include']?_[_0x06c5('0x1e')](_0x5aeb6c[_0x06c5('0x1f')],function(_0x1067e1){return{'model':db[_0x1067e1[_0x06c5('0x20')]],'as':_0x1067e1['as'],'attributes':_0x1067e1[_0x06c5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x221965){logger[_0x06c5('0xe')](_0x06c5('0x16'),_0x36b9e9);logger[_0x06c5('0x21')](_0x06c5('0x16'),_0x36b9e9,JSON['stringify'](_0x221965));_0x18a070(_0x221965);})[_0x06c5('0x15')](function(_0x432de5){logger[_0x06c5('0x10')]('GetMailServerIn',_0x432de5[_0x06c5('0x12')],_0x36b9e9);_0x1393f5(_0x44d14e[_0x06c5('0x10')](0x1f4,_0x432de5[_0x06c5('0x12')]));});});}; \ No newline at end of file +var _0x3339=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailServerIn,\x20%s,\x20%s','MailServerIn','findAll','options','raw','where','attributes','include','map','model','GetMailServerIn','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x513259,_0x50c3c0){var _0x5374fe=function(_0x15368b){while(--_0x15368b){_0x513259['push'](_0x513259['shift']());}};_0x5374fe(++_0x50c3c0);}(_0x3339,0x1a7));var _0x9333=function(_0x2a8b57,_0x427fd7){_0x2a8b57=_0x2a8b57-0x0;var _0x4bfb25=_0x3339[_0x2a8b57];return _0x4bfb25;};'use strict';var _=require(_0x9333('0x0'));var util=require('util');var moment=require(_0x9333('0x1'));var BPromise=require(_0x9333('0x2'));var rs=require(_0x9333('0x3'));var fs=require('fs');var Redis=require(_0x9333('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9333('0x5'));var logger=require('../../config/logger')(_0x9333('0x6'));var config=require(_0x9333('0x7'));var jayson=require(_0x9333('0x8'));var client=jayson[_0x9333('0x9')][_0x9333('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e5510,_0x303ff7,_0x886510){return new BPromise(function(_0x30e421,_0x32150f){return client[_0x9333('0xb')](_0x1e5510,_0x886510)[_0x9333('0xc')](function(_0x4f4698){logger[_0x9333('0xd')]('MailServerIn,\x20%s,\x20%s',_0x303ff7,_0x9333('0xe'));logger['debug'](_0x9333('0xf'),_0x303ff7,_0x9333('0xe'),JSON[_0x9333('0x10')](_0x4f4698));if(_0x4f4698[_0x9333('0x11')]){if(_0x4f4698['error'][_0x9333('0x12')]===0x1f4){logger[_0x9333('0x11')]('MailServerIn,\x20%s,\x20%s',_0x303ff7,_0x4f4698[_0x9333('0x11')]['message']);return _0x32150f(_0x4f4698[_0x9333('0x11')][_0x9333('0x13')]);}logger[_0x9333('0x11')]('MailServerIn,\x20%s,\x20%s',_0x303ff7,_0x4f4698[_0x9333('0x11')][_0x9333('0x13')]);return _0x30e421(_0x4f4698[_0x9333('0x11')]['message']);}else{logger[_0x9333('0xd')](_0x9333('0x14'),_0x303ff7,_0x9333('0xe'));_0x30e421(_0x4f4698['result']['message']);}})['catch'](function(_0x327036){logger[_0x9333('0x11')]('MailServerIn,\x20%s,\x20%s',_0x303ff7,_0x327036);_0x32150f(_0x327036);});});}exports['GetMailServerIn']=function(_0x3060d6){var _0x573fcd=this;return new Promise(function(_0x2102aa,_0x57f984){return db[_0x9333('0x15')][_0x9333('0x16')]({'raw':_0x3060d6[_0x9333('0x17')]?_0x3060d6[_0x9333('0x17')][_0x9333('0x18')]===undefined?!![]:![]:!![],'where':_0x3060d6['options']?_0x3060d6[_0x9333('0x17')][_0x9333('0x19')]||null:null,'attributes':_0x3060d6[_0x9333('0x17')]?_0x3060d6[_0x9333('0x17')][_0x9333('0x1a')]||null:null,'limit':_0x3060d6[_0x9333('0x17')]?_0x3060d6[_0x9333('0x17')]['limit']||null:null,'include':_0x3060d6[_0x9333('0x17')]?_0x3060d6[_0x9333('0x17')][_0x9333('0x1b')]?_[_0x9333('0x1c')](_0x3060d6[_0x9333('0x17')][_0x9333('0x1b')],function(_0x6e32eb){return{'model':db[_0x6e32eb[_0x9333('0x1d')]],'as':_0x6e32eb['as'],'attributes':_0x6e32eb['attributes'],'include':_0x6e32eb['include']?_[_0x9333('0x1c')](_0x6e32eb[_0x9333('0x1b')],function(_0x2bd79a){return{'model':db[_0x2bd79a[_0x9333('0x1d')]],'as':_0x2bd79a['as'],'attributes':_0x2bd79a[_0x9333('0x1a')],'include':_0x2bd79a['include']?_[_0x9333('0x1c')](_0x2bd79a[_0x9333('0x1b')],function(_0x3236e1){return{'model':db[_0x3236e1[_0x9333('0x1d')]],'as':_0x3236e1['as'],'attributes':_0x3236e1[_0x9333('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x271072){logger[_0x9333('0xd')](_0x9333('0x1e'),_0x3060d6);logger[_0x9333('0x1f')]('GetMailServerIn',_0x3060d6,JSON['stringify'](_0x271072));_0x2102aa(_0x271072);})[_0x9333('0x20')](function(_0x185f56){logger[_0x9333('0x11')](_0x9333('0x1e'),_0x185f56['message'],_0x3060d6);_0x57f984(_0x573fcd[_0x9333('0x11')](0x1f4,_0x185f56['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index dee78d3..670d6da 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7a54,0x106));var _0x47a5=function(_0x1ccc7f,_0x5868bc){_0x1ccc7f=_0x1ccc7f-0x0;var _0x211784=_0x7a54[_0x1ccc7f];return _0x211784;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index ec61a79..8bd7eb1 100644 --- a/server/api/mailServerOut/mailServerOut.attributes.js +++ b/server/api/mailServerOut/mailServerOut.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb78e=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb78e,0x1c9));var _0xeb78=function(_0x204e96,_0x241a67){_0x204e96=_0x204e96-0x0;var _0x4ca1a8=_0xb78e[_0x204e96];return _0x4ca1a8;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xeb78('0x2')]},'user':{'type':Sequelize[_0xeb78('0x2')]},'pass':{'type':Sequelize[_0xeb78('0x2')]},'port':{'type':Sequelize[_0xeb78('0x3')]},'secure':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xeb78('0x2')]},'authentication':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x878f=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x213a98,_0x4c5d94){var _0x4709a6=function(_0x127cb0){while(--_0x127cb0){_0x213a98['push'](_0x213a98['shift']());}};_0x4709a6(++_0x4c5d94);}(_0x878f,0x173));var _0xf878=function(_0x4d6548,_0x5633ef){_0x4d6548=_0x4d6548-0x0;var _0xf385c9=_0x878f[_0x4d6548];return _0xf385c9;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'description':{'type':Sequelize[_0xf878('0x1')]},'host':{'type':Sequelize[_0xf878('0x1')]},'user':{'type':Sequelize[_0xf878('0x1')]},'pass':{'type':Sequelize[_0xf878('0x1')]},'port':{'type':Sequelize[_0xf878('0x2')]},'secure':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xf878('0x1')]},'authentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index b483225..a6d37f8 100644 --- a/server/api/mailServerOut/mailServerOut.controller.js +++ b/server/api/mailServerOut/mailServerOut.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c18=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailServerOut','fieldName','type','model'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x6c18,0xf9));var _0x86c1=function(_0x3e3819,_0x562054){_0x3e3819=_0x3e3819-0x0;var _0x148457=_0x6c18[_0x3e3819];return _0x148457;};'use strict';var emlformat=require(_0x86c1('0x0'));var rimraf=require(_0x86c1('0x1'));var zipdir=require(_0x86c1('0x2'));var jsonpatch=require(_0x86c1('0x3'));var rp=require('request-promise');var moment=require(_0x86c1('0x4'));var BPromise=require(_0x86c1('0x5'));var Mustache=require('mustache');var util=require(_0x86c1('0x6'));var path=require(_0x86c1('0x7'));var sox=require(_0x86c1('0x8'));var csv=require(_0x86c1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x86c1('0xa'));var _=require(_0x86c1('0xb'));var squel=require(_0x86c1('0xc'));var crypto=require('crypto');var jsforce=require(_0x86c1('0xd'));var deskjs=require(_0x86c1('0xe'));var toCsv=require(_0x86c1('0x9'));var querystring=require(_0x86c1('0xf'));var Papa=require(_0x86c1('0x10'));var Redis=require('ioredis');var authService=require(_0x86c1('0x11'));var qs=require(_0x86c1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86c1('0x13'));var logger=require('../../config/logger')(_0x86c1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x86c1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c2260,_0x1911f2){_0x1911f2=_0x1911f2||0xcc;return function(_0x2fbff1){if(_0x2fbff1){return _0x3c2260[_0x86c1('0x16')](_0x1911f2);}return _0x3c2260[_0x86c1('0x17')](_0x1911f2)[_0x86c1('0x18')]();};}function respondWithResult(_0x501620,_0x295cc6){_0x295cc6=_0x295cc6||0xc8;return function(_0x23050c){if(_0x23050c){return _0x501620[_0x86c1('0x17')](_0x295cc6)[_0x86c1('0x19')](_0x23050c);}};}function respondWithFilteredResult(_0x142be5,_0x126731){return function(_0x264466){if(_0x264466){var _0x13e561=typeof _0x126731[_0x86c1('0x1a')]===_0x86c1('0x1b')&&typeof _0x126731['limit']===_0x86c1('0x1b');var _0x3a4bb0=_0x264466[_0x86c1('0x1c')];var _0x889e73=_0x13e561?0x0:_0x126731[_0x86c1('0x1a')];var _0x32f328=_0x13e561?_0x264466['count']:_0x126731[_0x86c1('0x1a')]+_0x126731[_0x86c1('0x1d')];var _0x418caa;if(_0x32f328>=_0x3a4bb0){_0x32f328=_0x3a4bb0;_0x418caa=0xc8;}else{_0x418caa=0xce;}_0x142be5['status'](_0x418caa);return _0x142be5[_0x86c1('0x1e')](_0x86c1('0x1f'),_0x889e73+'-'+_0x32f328+'/'+_0x3a4bb0)[_0x86c1('0x19')](_0x264466);}return null;};}function patchUpdates(_0x9c7ad5){return function(_0x1e97aa){try{jsonpatch[_0x86c1('0x20')](_0x1e97aa,_0x9c7ad5,!![]);}catch(_0x551dc6){return BPromise[_0x86c1('0x21')](_0x551dc6);}return _0x1e97aa[_0x86c1('0x22')]();};}function saveUpdates(_0xeb09ab,_0x11b89a){return function(_0x3669e8){if(_0x3669e8){return _0x3669e8[_0x86c1('0x23')](_0xeb09ab)[_0x86c1('0x24')](function(_0x338296){return _0x338296;});}return null;};}function removeEntity(_0x450007,_0x482cf9){return function(_0x2043db){if(_0x2043db){return _0x2043db[_0x86c1('0x25')]()[_0x86c1('0x24')](function(){_0x450007[_0x86c1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f8c0,_0x36a0d7){return function(_0x384816){if(!_0x384816){_0x29f8c0[_0x86c1('0x16')](0x194);}return _0x384816;};}function handleError(_0x1d3ef2,_0x3b424c){_0x3b424c=_0x3b424c||0x1f4;return function(_0x108711){logger['error'](_0x108711[_0x86c1('0x26')]);if(_0x108711[_0x86c1('0x27')]){delete _0x108711['name'];}_0x1d3ef2['status'](_0x3b424c)[_0x86c1('0x28')](_0x108711);};}exports[_0x86c1('0x29')]=function(_0x2f8d62,_0x5538f6){var _0xe4c9c={},_0x3bc85f={},_0x316615={'count':0x0,'rows':[]};var _0x273cca=_[_0x86c1('0x2a')](db[_0x86c1('0x2b')]['rawAttributes'],function(_0x3360b5){return{'name':_0x3360b5[_0x86c1('0x2c')],'type':_0x3360b5[_0x86c1('0x2d')]['key']};});_0x3bc85f[_0x86c1('0x2e')]=_[_0x86c1('0x2a')](_0x273cca,'name');_0x3bc85f[_0x86c1('0x2f')]=_[_0x86c1('0x30')](_0x2f8d62['query']);_0x3bc85f[_0x86c1('0x31')]=_[_0x86c1('0x32')](_0x3bc85f[_0x86c1('0x2e')],_0x3bc85f[_0x86c1('0x2f')]);_0xe4c9c['attributes']=_[_0x86c1('0x32')](_0x3bc85f[_0x86c1('0x2e')],qs[_0x86c1('0x33')](_0x2f8d62[_0x86c1('0x2f')]['fields']));_0xe4c9c[_0x86c1('0x34')]=_0xe4c9c[_0x86c1('0x34')][_0x86c1('0x35')]?_0xe4c9c['attributes']:_0x3bc85f[_0x86c1('0x2e')];if(!_0x2f8d62[_0x86c1('0x2f')][_0x86c1('0x36')](_0x86c1('0x37'))){_0xe4c9c[_0x86c1('0x1d')]=qs['limit'](_0x2f8d62[_0x86c1('0x2f')][_0x86c1('0x1d')]);_0xe4c9c['offset']=qs[_0x86c1('0x1a')](_0x2f8d62[_0x86c1('0x2f')][_0x86c1('0x1a')]);}_0xe4c9c['order']=qs['sort'](_0x2f8d62[_0x86c1('0x2f')][_0x86c1('0x38')]);_0xe4c9c[_0x86c1('0x39')]=qs[_0x86c1('0x31')](_[_0x86c1('0x3a')](_0x2f8d62[_0x86c1('0x2f')],_0x3bc85f[_0x86c1('0x31')]),_0x273cca);if(_0x2f8d62[_0x86c1('0x2f')][_0x86c1('0x3b')]){_0xe4c9c['where']=_[_0x86c1('0x3c')](_0xe4c9c[_0x86c1('0x39')],{'$or':_[_0x86c1('0x2a')](_0x273cca,function(_0x468ce8){if(_0x468ce8[_0x86c1('0x2d')]!==_0x86c1('0x3d')){var _0x3183c1={};_0x3183c1[_0x468ce8[_0x86c1('0x27')]]={'$like':'%'+_0x2f8d62[_0x86c1('0x2f')]['filter']+'%'};return _0x3183c1;}})});}_0xe4c9c=_[_0x86c1('0x3c')]({},_0xe4c9c,_0x2f8d62[_0x86c1('0x3e')]);var _0x1f224a={'where':_0xe4c9c[_0x86c1('0x39')]};return db[_0x86c1('0x2b')][_0x86c1('0x1c')](_0x1f224a)[_0x86c1('0x24')](function(_0x55ada2){_0x316615['count']=_0x55ada2;if(_0x2f8d62[_0x86c1('0x2f')]['includeAll']){_0xe4c9c[_0x86c1('0x3f')]=[{'all':!![]}];}return db[_0x86c1('0x2b')][_0x86c1('0x40')](_0xe4c9c);})[_0x86c1('0x24')](function(_0x4e398a){_0x316615[_0x86c1('0x41')]=_0x4e398a;return _0x316615;})[_0x86c1('0x24')](respondWithFilteredResult(_0x5538f6,_0xe4c9c))[_0x86c1('0x42')](handleError(_0x5538f6,null));};exports[_0x86c1('0x43')]=function(_0x3c9401,_0x3fed4c){var _0x573c88={'raw':!![],'where':{'id':_0x3c9401[_0x86c1('0x44')]['id']}},_0x28307e={};_0x28307e[_0x86c1('0x2e')]=_[_0x86c1('0x30')](db[_0x86c1('0x2b')][_0x86c1('0x45')]);_0x28307e[_0x86c1('0x2f')]=_[_0x86c1('0x30')](_0x3c9401[_0x86c1('0x2f')]);_0x28307e[_0x86c1('0x31')]=_[_0x86c1('0x32')](_0x28307e[_0x86c1('0x2e')],_0x28307e[_0x86c1('0x2f')]);_0x573c88[_0x86c1('0x34')]=_[_0x86c1('0x32')](_0x28307e[_0x86c1('0x2e')],qs[_0x86c1('0x33')](_0x3c9401[_0x86c1('0x2f')][_0x86c1('0x33')]));_0x573c88[_0x86c1('0x34')]=_0x573c88['attributes'][_0x86c1('0x35')]?_0x573c88[_0x86c1('0x34')]:_0x28307e['model'];if(_0x3c9401['query'][_0x86c1('0x46')]){_0x573c88[_0x86c1('0x3f')]=[{'all':!![]}];}_0x573c88=_[_0x86c1('0x3c')]({},_0x573c88,_0x3c9401[_0x86c1('0x3e')]);return db[_0x86c1('0x2b')][_0x86c1('0x47')](_0x573c88)[_0x86c1('0x24')](handleEntityNotFound(_0x3fed4c,null))['then'](respondWithResult(_0x3fed4c,null))[_0x86c1('0x42')](handleError(_0x3fed4c,null));};exports['create']=function(_0x310406,_0x350153){return db[_0x86c1('0x2b')][_0x86c1('0x48')](_0x310406[_0x86c1('0x49')],{})['then'](respondWithResult(_0x350153,0xc9))[_0x86c1('0x42')](handleError(_0x350153,null));};exports[_0x86c1('0x23')]=function(_0x277032,_0x42a278){if(_0x277032[_0x86c1('0x49')]['id']){delete _0x277032['body']['id'];}return db[_0x86c1('0x2b')][_0x86c1('0x47')]({'where':{'id':_0x277032['params']['id']}})[_0x86c1('0x24')](handleEntityNotFound(_0x42a278,null))[_0x86c1('0x24')](saveUpdates(_0x277032[_0x86c1('0x49')],null))[_0x86c1('0x24')](respondWithResult(_0x42a278,null))[_0x86c1('0x42')](handleError(_0x42a278,null));};exports[_0x86c1('0x25')]=function(_0x47126c,_0x164d15){return db[_0x86c1('0x2b')]['find']({'where':{'id':_0x47126c[_0x86c1('0x44')]['id']}})[_0x86c1('0x24')](handleEntityNotFound(_0x164d15,null))[_0x86c1('0x24')](removeEntity(_0x164d15,null))[_0x86c1('0x42')](handleError(_0x164d15,null));}; \ No newline at end of file +var _0xea0f=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','index','MailServerOut','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x295771,_0x11e035){var _0x5130ee=function(_0x4f0ab4){while(--_0x4f0ab4){_0x295771['push'](_0x295771['shift']());}};_0x5130ee(++_0x11e035);}(_0xea0f,0x18d));var _0xfea0=function(_0x41b0d5,_0x2f7baa){_0x41b0d5=_0x41b0d5-0x0;var _0xb9c58b=_0xea0f[_0x41b0d5];return _0xb9c58b;};'use strict';var emlformat=require(_0xfea0('0x0'));var rimraf=require(_0xfea0('0x1'));var zipdir=require(_0xfea0('0x2'));var jsonpatch=require(_0xfea0('0x3'));var rp=require(_0xfea0('0x4'));var moment=require(_0xfea0('0x5'));var BPromise=require(_0xfea0('0x6'));var Mustache=require(_0xfea0('0x7'));var util=require('util');var path=require(_0xfea0('0x8'));var sox=require(_0xfea0('0x9'));var csv=require(_0xfea0('0xa'));var ejs=require(_0xfea0('0xb'));var fs=require('fs');var fs_extra=require(_0xfea0('0xc'));var _=require(_0xfea0('0xd'));var squel=require(_0xfea0('0xe'));var crypto=require(_0xfea0('0xf'));var jsforce=require(_0xfea0('0x10'));var deskjs=require(_0xfea0('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfea0('0x12'));var Redis=require(_0xfea0('0x13'));var authService=require(_0xfea0('0x14'));var qs=require(_0xfea0('0x15'));var as=require(_0xfea0('0x16'));var hardwareService=require(_0xfea0('0x17'));var logger=require(_0xfea0('0x18'))(_0xfea0('0x19'));var utils=require(_0xfea0('0x1a'));var config=require(_0xfea0('0x1b'));var licenseUtil=require(_0xfea0('0x1c'));var db=require(_0xfea0('0x1d'))['db'];function respondWithStatusCode(_0x14b04e,_0xd94404){_0xd94404=_0xd94404||0xcc;return function(_0x3f5d48){if(_0x3f5d48){return _0x14b04e[_0xfea0('0x1e')](_0xd94404);}return _0x14b04e[_0xfea0('0x1f')](_0xd94404)[_0xfea0('0x20')]();};}function respondWithResult(_0x5d14b6,_0x200492){_0x200492=_0x200492||0xc8;return function(_0x4fbc5f){if(_0x4fbc5f){return _0x5d14b6['status'](_0x200492)[_0xfea0('0x21')](_0x4fbc5f);}};}function respondWithFilteredResult(_0x36ca60,_0x104211){return function(_0x28b12a){if(_0x28b12a){var _0x3ebf48=typeof _0x104211[_0xfea0('0x22')]===_0xfea0('0x23')&&typeof _0x104211[_0xfea0('0x24')]===_0xfea0('0x23');var _0x57cc3c=_0x28b12a[_0xfea0('0x25')];var _0x2897c8=_0x3ebf48?0x0:_0x104211['offset'];var _0xbabbdc=_0x3ebf48?_0x28b12a[_0xfea0('0x25')]:_0x104211['offset']+_0x104211[_0xfea0('0x24')];var _0x1d13ca;if(_0xbabbdc>=_0x57cc3c){_0xbabbdc=_0x57cc3c;_0x1d13ca=0xc8;}else{_0x1d13ca=0xce;}_0x36ca60[_0xfea0('0x1f')](_0x1d13ca);return _0x36ca60[_0xfea0('0x26')]('Content-Range',_0x2897c8+'-'+_0xbabbdc+'/'+_0x57cc3c)[_0xfea0('0x21')](_0x28b12a);}return null;};}function patchUpdates(_0x3d0c7d){return function(_0x26066b){try{jsonpatch[_0xfea0('0x27')](_0x26066b,_0x3d0c7d,!![]);}catch(_0x12d8db){return BPromise[_0xfea0('0x28')](_0x12d8db);}return _0x26066b[_0xfea0('0x29')]();};}function saveUpdates(_0x1112ac,_0x3af332){return function(_0x2c6283){if(_0x2c6283){return _0x2c6283[_0xfea0('0x2a')](_0x1112ac)[_0xfea0('0x2b')](function(_0x2d30dc){return _0x2d30dc;});}return null;};}function removeEntity(_0x1233b1,_0x5aeac1){return function(_0x2d157d){if(_0x2d157d){return _0x2d157d['destroy']()['then'](function(){_0x1233b1[_0xfea0('0x1f')](0xcc)[_0xfea0('0x20')]();});}};}function handleEntityNotFound(_0x1d265c,_0x433b66){return function(_0x11fe25){if(!_0x11fe25){_0x1d265c[_0xfea0('0x1e')](0x194);}return _0x11fe25;};}function handleError(_0x34adca,_0xb5af60){_0xb5af60=_0xb5af60||0x1f4;return function(_0x395594){logger['error'](_0x395594[_0xfea0('0x2c')]);if(_0x395594[_0xfea0('0x2d')]){delete _0x395594[_0xfea0('0x2d')];}_0x34adca[_0xfea0('0x1f')](_0xb5af60)[_0xfea0('0x2e')](_0x395594);};}exports[_0xfea0('0x2f')]=function(_0x51b491,_0xdbd26){var _0x567ed1={},_0x84dc68={},_0x30d035={'count':0x0,'rows':[]};var _0x2fffe5=_['map'](db[_0xfea0('0x30')]['rawAttributes'],function(_0x1cf975){return{'name':_0x1cf975[_0xfea0('0x31')],'type':_0x1cf975[_0xfea0('0x32')][_0xfea0('0x33')]};});_0x84dc68[_0xfea0('0x34')]=_[_0xfea0('0x35')](_0x2fffe5,_0xfea0('0x2d'));_0x84dc68[_0xfea0('0x36')]=_[_0xfea0('0x37')](_0x51b491[_0xfea0('0x36')]);_0x84dc68['filters']=_[_0xfea0('0x38')](_0x84dc68['model'],_0x84dc68[_0xfea0('0x36')]);_0x567ed1['attributes']=_[_0xfea0('0x38')](_0x84dc68['model'],qs['fields'](_0x51b491['query'][_0xfea0('0x39')]));_0x567ed1['attributes']=_0x567ed1[_0xfea0('0x3a')][_0xfea0('0x3b')]?_0x567ed1['attributes']:_0x84dc68[_0xfea0('0x34')];if(!_0x51b491['query'][_0xfea0('0x3c')](_0xfea0('0x3d'))){_0x567ed1[_0xfea0('0x24')]=qs[_0xfea0('0x24')](_0x51b491[_0xfea0('0x36')][_0xfea0('0x24')]);_0x567ed1[_0xfea0('0x22')]=qs['offset'](_0x51b491['query'][_0xfea0('0x22')]);}_0x567ed1['order']=qs[_0xfea0('0x3e')](_0x51b491[_0xfea0('0x36')]['sort']);_0x567ed1[_0xfea0('0x3f')]=qs[_0xfea0('0x40')](_[_0xfea0('0x41')](_0x51b491[_0xfea0('0x36')],_0x84dc68[_0xfea0('0x40')]),_0x2fffe5);if(_0x51b491[_0xfea0('0x36')][_0xfea0('0x42')]){_0x567ed1[_0xfea0('0x3f')]=_[_0xfea0('0x43')](_0x567ed1[_0xfea0('0x3f')],{'$or':_['map'](_0x2fffe5,function(_0x1e44ef){if(_0x1e44ef[_0xfea0('0x32')]!==_0xfea0('0x44')){var _0x5732f5={};_0x5732f5[_0x1e44ef[_0xfea0('0x2d')]]={'$like':'%'+_0x51b491['query'][_0xfea0('0x42')]+'%'};return _0x5732f5;}})});}_0x567ed1=_[_0xfea0('0x43')]({},_0x567ed1,_0x51b491[_0xfea0('0x45')]);var _0x38d94b={'where':_0x567ed1[_0xfea0('0x3f')]};return db['MailServerOut'][_0xfea0('0x25')](_0x38d94b)[_0xfea0('0x2b')](function(_0x111e51){_0x30d035[_0xfea0('0x25')]=_0x111e51;if(_0x51b491[_0xfea0('0x36')][_0xfea0('0x46')]){_0x567ed1[_0xfea0('0x47')]=[{'all':!![]}];}return db[_0xfea0('0x30')][_0xfea0('0x48')](_0x567ed1);})[_0xfea0('0x2b')](function(_0x2ea90d){_0x30d035['rows']=_0x2ea90d;return _0x30d035;})['then'](respondWithFilteredResult(_0xdbd26,_0x567ed1))[_0xfea0('0x49')](handleError(_0xdbd26,null));};exports[_0xfea0('0x4a')]=function(_0x1113bb,_0x4c9a2a){var _0x4944c0={'raw':!![],'where':{'id':_0x1113bb[_0xfea0('0x4b')]['id']}},_0x19be5b={};_0x19be5b[_0xfea0('0x34')]=_[_0xfea0('0x37')](db['MailServerOut'][_0xfea0('0x4c')]);_0x19be5b[_0xfea0('0x36')]=_[_0xfea0('0x37')](_0x1113bb[_0xfea0('0x36')]);_0x19be5b[_0xfea0('0x40')]=_[_0xfea0('0x38')](_0x19be5b[_0xfea0('0x34')],_0x19be5b[_0xfea0('0x36')]);_0x4944c0[_0xfea0('0x3a')]=_['intersection'](_0x19be5b['model'],qs[_0xfea0('0x39')](_0x1113bb['query']['fields']));_0x4944c0[_0xfea0('0x3a')]=_0x4944c0[_0xfea0('0x3a')][_0xfea0('0x3b')]?_0x4944c0[_0xfea0('0x3a')]:_0x19be5b[_0xfea0('0x34')];if(_0x1113bb[_0xfea0('0x36')][_0xfea0('0x46')]){_0x4944c0[_0xfea0('0x47')]=[{'all':!![]}];}_0x4944c0=_[_0xfea0('0x43')]({},_0x4944c0,_0x1113bb[_0xfea0('0x45')]);return db[_0xfea0('0x30')]['find'](_0x4944c0)[_0xfea0('0x2b')](handleEntityNotFound(_0x4c9a2a,null))[_0xfea0('0x2b')](respondWithResult(_0x4c9a2a,null))['catch'](handleError(_0x4c9a2a,null));};exports[_0xfea0('0x4d')]=function(_0x2d0b1d,_0x167f19){return db[_0xfea0('0x30')]['create'](_0x2d0b1d['body'],{})[_0xfea0('0x2b')](respondWithResult(_0x167f19,0xc9))[_0xfea0('0x49')](handleError(_0x167f19,null));};exports[_0xfea0('0x2a')]=function(_0x236566,_0x41a73c){if(_0x236566[_0xfea0('0x4e')]['id']){delete _0x236566[_0xfea0('0x4e')]['id'];}return db[_0xfea0('0x30')][_0xfea0('0x4f')]({'where':{'id':_0x236566['params']['id']}})['then'](handleEntityNotFound(_0x41a73c,null))[_0xfea0('0x2b')](saveUpdates(_0x236566[_0xfea0('0x4e')],null))[_0xfea0('0x2b')](respondWithResult(_0x41a73c,null))['catch'](handleError(_0x41a73c,null));};exports[_0xfea0('0x50')]=function(_0x5a1776,_0x5c1c5d){return db[_0xfea0('0x30')][_0xfea0('0x4f')]({'where':{'id':_0x5a1776[_0xfea0('0x4b')]['id']}})[_0xfea0('0x2b')](handleEntityNotFound(_0x5c1c5d,null))[_0xfea0('0x2b')](removeEntity(_0x5c1c5d,null))[_0xfea0('0x49')](handleError(_0x5c1c5d,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 2a947bd..6ef1e19 100644 --- a/server/api/mailServerOut/mailServerOut.model.js +++ b/server/api/mailServerOut/mailServerOut.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce6f=['../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','path'];(function(_0x50b750,_0xe5817b){var _0x1b60a8=function(_0x23a6e8){while(--_0x23a6e8){_0x50b750['push'](_0x50b750['shift']());}};_0x1b60a8(++_0xe5817b);}(_0xce6f,0x10e));var _0xfce6=function(_0x41198f,_0x55dbc7){_0x41198f=_0x41198f-0x0;var _0x3634bc=_0xce6f[_0x41198f];return _0x3634bc;};'use strict';var _=require(_0xfce6('0x0'));var util=require(_0xfce6('0x1'));var logger=require('../../config/logger')(_0xfce6('0x2'));var moment=require(_0xfce6('0x3'));var BPromise=require(_0xfce6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfce6('0x5'));var rimraf=require('rimraf');var config=require(_0xfce6('0x6'));var attributes=require(_0xfce6('0x7'));module[_0xfce6('0x8')]=function(_0x1216fc,_0x1fae07){return _0x1216fc[_0xfce6('0x9')](_0xfce6('0xa'),attributes,{'tableName':_0xfce6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc5b=['define','MailServerOut','mail_servers_out','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x16ac19,_0x9740b1){var _0xccec95=function(_0x272d58){while(--_0x272d58){_0x16ac19['push'](_0x16ac19['shift']());}};_0xccec95(++_0x9740b1);}(_0xfc5b,0x137));var _0xbfc5=function(_0x5e0d97,_0x283c1e){_0x5e0d97=_0x5e0d97-0x0;var _0xb2cd12=_0xfc5b[_0x5e0d97];return _0xb2cd12;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbfc5('0x0'))('api');var moment=require('moment');var BPromise=require(_0xbfc5('0x1'));var rp=require(_0xbfc5('0x2'));var fs=require('fs');var path=require(_0xbfc5('0x3'));var rimraf=require(_0xbfc5('0x4'));var config=require(_0xbfc5('0x5'));var attributes=require(_0xbfc5('0x6'));module[_0xbfc5('0x7')]=function(_0x1d70ad,_0x2a9ed9){return _0x1d70ad[_0xbfc5('0x8')](_0xbfc5('0x9'),attributes,{'tableName':_0xbfc5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index d793ad4..e42c062 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5ea2f9,_0x320917){var _0x36e586=function(_0x2e79a2){while(--_0x2e79a2){_0x5ea2f9['push'](_0x5ea2f9['shift']());}};_0x36e586(++_0x320917);}(_0xadb5,0xad));var _0x5adb=function(_0x580418,_0x293d21){_0x580418=_0x580418-0x0;var _0x42815a=_0xadb5[_0x580418];return _0x42815a;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x39ee9f,_0x22397e){var _0x1391ba=function(_0x472e87){while(--_0x472e87){_0x39ee9f['push'](_0x39ee9f['shift']());}};_0x1391ba(++_0x22397e);}(_0xdb28,0x106));var _0x8db2=function(_0x2a1ced,_0xb724e3){_0x2a1ced=_0x2a1ced-0x0;var _0x41d57c=_0xdb28[_0x2a1ced];return _0x41d57c;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index c14670c..51e02b0 100644 --- a/server/api/mailSubstatus/index.js +++ b/server/api/mailSubstatus/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcf6=['isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xdcf6,0x1ee));var _0x6dcf=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0xdcf6[_0x2706da];return _0x3ba87e;};'use strict';var multer=require(_0x6dcf('0x0'));var util=require(_0x6dcf('0x1'));var path=require(_0x6dcf('0x2'));var timeout=require(_0x6dcf('0x3'));var express=require(_0x6dcf('0x4'));var router=express['Router']();var fs_extra=require(_0x6dcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6dcf('0x6'));var config=require(_0x6dcf('0x7'));var controller=require(_0x6dcf('0x8'));router[_0x6dcf('0x9')]('/',auth[_0x6dcf('0xa')](),controller[_0x6dcf('0xb')]);router[_0x6dcf('0x9')](_0x6dcf('0xc'),auth[_0x6dcf('0xa')](),controller[_0x6dcf('0xd')]);router['get']('/:id',auth[_0x6dcf('0xa')](),controller[_0x6dcf('0xe')]);router[_0x6dcf('0xf')]('/',auth[_0x6dcf('0xa')](),controller[_0x6dcf('0x10')]);router[_0x6dcf('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6dcf('0x12')]);router[_0x6dcf('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6dcf('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb4f7=['describe','/:id','post','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index'];(function(_0x3e61d4,_0x224d2d){var _0x40bd4e=function(_0x21432f){while(--_0x21432f){_0x3e61d4['push'](_0x3e61d4['shift']());}};_0x40bd4e(++_0x224d2d);}(_0xb4f7,0x7e));var _0x7b4f=function(_0x23f3b3,_0xef0281){_0x23f3b3=_0x23f3b3-0x0;var _0x3c8316=_0xb4f7[_0x23f3b3];return _0x3c8316;};'use strict';var multer=require('multer');var util=require(_0x7b4f('0x0'));var path=require(_0x7b4f('0x1'));var timeout=require(_0x7b4f('0x2'));var express=require('express');var router=express[_0x7b4f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7b4f('0x4'));var config=require(_0x7b4f('0x5'));var controller=require(_0x7b4f('0x6'));router[_0x7b4f('0x7')]('/',auth[_0x7b4f('0x8')](),controller[_0x7b4f('0x9')]);router[_0x7b4f('0x7')]('/describe',auth[_0x7b4f('0x8')](),controller[_0x7b4f('0xa')]);router[_0x7b4f('0x7')](_0x7b4f('0xb'),auth[_0x7b4f('0x8')](),controller['show']);router[_0x7b4f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7b4f('0xd')]('/:id',auth[_0x7b4f('0x8')](),controller[_0x7b4f('0xe')]);router[_0x7b4f('0xf')](_0x7b4f('0xb'),auth['isAuthenticated'](),controller[_0x7b4f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e969428..bd20410 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0ae=['name','STRING'];(function(_0x28761e,_0x36ce83){var _0x554031=function(_0x3498d7){while(--_0x3498d7){_0x28761e['push'](_0x28761e['shift']());}};_0x554031(++_0x36ce83);}(_0xe0ae,0xa1));var _0xee0a=function(_0x409fb8,_0x5ab3d3){_0x409fb8=_0x409fb8-0x0;var _0x278270=_0xe0ae[_0x409fb8];return _0x278270;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee0a('0x0')],'unique':_0xee0a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe0ae=['name','STRING'];(function(_0x1e1922,_0x96d52f){var _0x218fee=function(_0x346c41){while(--_0x346c41){_0x1e1922['push'](_0x1e1922['shift']());}};_0x218fee(++_0x96d52f);}(_0xe0ae,0xa1));var _0xee0a=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0xe0ae[_0x1a3e23];return _0x5ee0d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee0a('0x0')],'unique':_0xee0a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 54d4ba1..44b5e10 100644 --- a/server/api/mailSubstatus/mailSubstatus.controller.js +++ b/server/api/mailSubstatus/mailSubstatus.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2180=['fields','length','model','nolimit','order','sort','where','merge','type','filter','includeAll','include','findAll','show','params','rawAttributes','options','find','catch','create','body','describe','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','stack','name','send','map','MailSubstatus','fieldName','key','query','keys','filters','intersection','attributes'];(function(_0x4f61b5,_0x3fc7a7){var _0xf16be4=function(_0x17e570){while(--_0x17e570){_0x4f61b5['push'](_0x4f61b5['shift']());}};_0xf16be4(++_0x3fc7a7);}(_0x2180,0xa0));var _0x0218=function(_0x381372,_0xf0a5a){_0x381372=_0x381372-0x0;var _0x4e959a=_0x2180[_0x381372];return _0x4e959a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0218('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0218('0x1'));var moment=require(_0x0218('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0218('0x3'));var path=require(_0x0218('0x4'));var sox=require(_0x0218('0x5'));var csv=require(_0x0218('0x6'));var ejs=require(_0x0218('0x7'));var fs=require('fs');var fs_extra=require(_0x0218('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0218('0x9'));var jsforce=require(_0x0218('0xa'));var deskjs=require(_0x0218('0xb'));var toCsv=require(_0x0218('0x6'));var querystring=require(_0x0218('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0218('0xd'));var qs=require(_0x0218('0xe'));var as=require(_0x0218('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0218('0x10'))(_0x0218('0x11'));var utils=require(_0x0218('0x12'));var config=require(_0x0218('0x13'));var licenseUtil=require(_0x0218('0x14'));var db=require(_0x0218('0x15'))['db'];function respondWithStatusCode(_0x191f84,_0x4653d1){_0x4653d1=_0x4653d1||0xcc;return function(_0x534f52){if(_0x534f52){return _0x191f84[_0x0218('0x16')](_0x4653d1);}return _0x191f84['status'](_0x4653d1)[_0x0218('0x17')]();};}function respondWithResult(_0x13c06b,_0x56163f){_0x56163f=_0x56163f||0xc8;return function(_0x267701){if(_0x267701){return _0x13c06b[_0x0218('0x18')](_0x56163f)[_0x0218('0x19')](_0x267701);}};}function respondWithFilteredResult(_0x5707bf,_0x43d2c8){return function(_0x29bc99){if(_0x29bc99){var _0x3beaf5=typeof _0x43d2c8[_0x0218('0x1a')]===_0x0218('0x1b')&&typeof _0x43d2c8[_0x0218('0x1c')]===_0x0218('0x1b');var _0x540351=_0x29bc99[_0x0218('0x1d')];var _0x4fa1a5=_0x3beaf5?0x0:_0x43d2c8[_0x0218('0x1a')];var _0x293644=_0x3beaf5?_0x29bc99[_0x0218('0x1d')]:_0x43d2c8[_0x0218('0x1a')]+_0x43d2c8[_0x0218('0x1c')];var _0x89ec93;if(_0x293644>=_0x540351){_0x293644=_0x540351;_0x89ec93=0xc8;}else{_0x89ec93=0xce;}_0x5707bf['status'](_0x89ec93);return _0x5707bf[_0x0218('0x1e')](_0x0218('0x1f'),_0x4fa1a5+'-'+_0x293644+'/'+_0x540351)['json'](_0x29bc99);}return null;};}function patchUpdates(_0x4b8c8e){return function(_0x252d63){try{jsonpatch['apply'](_0x252d63,_0x4b8c8e,!![]);}catch(_0x4b812e){return BPromise['reject'](_0x4b812e);}return _0x252d63['save']();};}function saveUpdates(_0x125f01,_0x27402d){return function(_0x5bf232){if(_0x5bf232){return _0x5bf232[_0x0218('0x20')](_0x125f01)['then'](function(_0x2c79c4){return _0x2c79c4;});}return null;};}function removeEntity(_0x5c146e,_0x486cd4){return function(_0x4ca2da){if(_0x4ca2da){return _0x4ca2da[_0x0218('0x21')]()[_0x0218('0x22')](function(){_0x5c146e[_0x0218('0x18')](0xcc)[_0x0218('0x17')]();});}};}function handleEntityNotFound(_0x11b5c0,_0x3653f3){return function(_0x41a63f){if(!_0x41a63f){_0x11b5c0[_0x0218('0x16')](0x194);}return _0x41a63f;};}function handleError(_0x1e35bd,_0x4f8b59){_0x4f8b59=_0x4f8b59||0x1f4;return function(_0x206f91){logger['error'](_0x206f91[_0x0218('0x23')]);if(_0x206f91[_0x0218('0x24')]){delete _0x206f91[_0x0218('0x24')];}_0x1e35bd[_0x0218('0x18')](_0x4f8b59)[_0x0218('0x25')](_0x206f91);};}exports['index']=function(_0x3642ae,_0x120e7f){var _0x396099={},_0x4c7960={},_0x4d80ac={'count':0x0,'rows':[]};var _0x4b14f3=_[_0x0218('0x26')](db[_0x0218('0x27')]['rawAttributes'],function(_0x1826eb){return{'name':_0x1826eb[_0x0218('0x28')],'type':_0x1826eb['type'][_0x0218('0x29')]};});_0x4c7960['model']=_['map'](_0x4b14f3,'name');_0x4c7960[_0x0218('0x2a')]=_[_0x0218('0x2b')](_0x3642ae['query']);_0x4c7960[_0x0218('0x2c')]=_[_0x0218('0x2d')](_0x4c7960['model'],_0x4c7960[_0x0218('0x2a')]);_0x396099[_0x0218('0x2e')]=_[_0x0218('0x2d')](_0x4c7960['model'],qs[_0x0218('0x2f')](_0x3642ae[_0x0218('0x2a')][_0x0218('0x2f')]));_0x396099[_0x0218('0x2e')]=_0x396099['attributes'][_0x0218('0x30')]?_0x396099[_0x0218('0x2e')]:_0x4c7960[_0x0218('0x31')];if(!_0x3642ae[_0x0218('0x2a')]['hasOwnProperty'](_0x0218('0x32'))){_0x396099[_0x0218('0x1c')]=qs[_0x0218('0x1c')](_0x3642ae[_0x0218('0x2a')]['limit']);_0x396099[_0x0218('0x1a')]=qs[_0x0218('0x1a')](_0x3642ae['query'][_0x0218('0x1a')]);}_0x396099[_0x0218('0x33')]=qs[_0x0218('0x34')](_0x3642ae[_0x0218('0x2a')][_0x0218('0x34')]);_0x396099['where']=qs[_0x0218('0x2c')](_['pick'](_0x3642ae['query'],_0x4c7960[_0x0218('0x2c')]),_0x4b14f3);if(_0x3642ae[_0x0218('0x2a')]['filter']){_0x396099[_0x0218('0x35')]=_[_0x0218('0x36')](_0x396099[_0x0218('0x35')],{'$or':_[_0x0218('0x26')](_0x4b14f3,function(_0x408477){if(_0x408477[_0x0218('0x37')]!=='VIRTUAL'){var _0x422726={};_0x422726[_0x408477[_0x0218('0x24')]]={'$like':'%'+_0x3642ae[_0x0218('0x2a')][_0x0218('0x38')]+'%'};return _0x422726;}})});}_0x396099=_['merge']({},_0x396099,_0x3642ae['options']);var _0x43bba9={'where':_0x396099['where']};return db[_0x0218('0x27')][_0x0218('0x1d')](_0x43bba9)['then'](function(_0x410442){_0x4d80ac[_0x0218('0x1d')]=_0x410442;if(_0x3642ae[_0x0218('0x2a')][_0x0218('0x39')]){_0x396099[_0x0218('0x3a')]=[{'all':!![]}];}return db['MailSubstatus'][_0x0218('0x3b')](_0x396099);})[_0x0218('0x22')](function(_0x248e1d){_0x4d80ac['rows']=_0x248e1d;return _0x4d80ac;})[_0x0218('0x22')](respondWithFilteredResult(_0x120e7f,_0x396099))['catch'](handleError(_0x120e7f,null));};exports[_0x0218('0x3c')]=function(_0x265c77,_0x1a45ac){var _0x322be4={'raw':!![],'where':{'id':_0x265c77[_0x0218('0x3d')]['id']}},_0x5e34d9={};_0x5e34d9[_0x0218('0x31')]=_[_0x0218('0x2b')](db[_0x0218('0x27')][_0x0218('0x3e')]);_0x5e34d9['query']=_[_0x0218('0x2b')](_0x265c77['query']);_0x5e34d9[_0x0218('0x2c')]=_[_0x0218('0x2d')](_0x5e34d9[_0x0218('0x31')],_0x5e34d9['query']);_0x322be4[_0x0218('0x2e')]=_[_0x0218('0x2d')](_0x5e34d9[_0x0218('0x31')],qs[_0x0218('0x2f')](_0x265c77[_0x0218('0x2a')]['fields']));_0x322be4[_0x0218('0x2e')]=_0x322be4[_0x0218('0x2e')][_0x0218('0x30')]?_0x322be4[_0x0218('0x2e')]:_0x5e34d9['model'];if(_0x265c77['query'][_0x0218('0x39')]){_0x322be4[_0x0218('0x3a')]=[{'all':!![]}];}_0x322be4=_[_0x0218('0x36')]({},_0x322be4,_0x265c77[_0x0218('0x3f')]);return db['MailSubstatus'][_0x0218('0x40')](_0x322be4)[_0x0218('0x22')](handleEntityNotFound(_0x1a45ac,null))[_0x0218('0x22')](respondWithResult(_0x1a45ac,null))[_0x0218('0x41')](handleError(_0x1a45ac,null));};exports[_0x0218('0x42')]=function(_0x5a879c,_0x2b4d15){return db[_0x0218('0x27')][_0x0218('0x42')](_0x5a879c[_0x0218('0x43')],{})[_0x0218('0x22')](respondWithResult(_0x2b4d15,0xc9))[_0x0218('0x41')](handleError(_0x2b4d15,null));};exports[_0x0218('0x20')]=function(_0x238d7c,_0x1a2675){if(_0x238d7c[_0x0218('0x43')]['id']){delete _0x238d7c[_0x0218('0x43')]['id'];}return db[_0x0218('0x27')][_0x0218('0x40')]({'where':{'id':_0x238d7c[_0x0218('0x3d')]['id']}})[_0x0218('0x22')](handleEntityNotFound(_0x1a2675,null))['then'](saveUpdates(_0x238d7c[_0x0218('0x43')],null))[_0x0218('0x22')](respondWithResult(_0x1a2675,null))[_0x0218('0x41')](handleError(_0x1a2675,null));};exports[_0x0218('0x21')]=function(_0x9d9cb6,_0x34baa0){return db[_0x0218('0x27')][_0x0218('0x40')]({'where':{'id':_0x9d9cb6['params']['id']}})[_0x0218('0x22')](handleEntityNotFound(_0x34baa0,null))[_0x0218('0x22')](removeEntity(_0x34baa0,null))[_0x0218('0x41')](handleError(_0x34baa0,null));};exports[_0x0218('0x44')]=function(_0x52224e,_0xeb652){return db['MailSubstatus'][_0x0218('0x44')]()['then'](respondWithResult(_0xeb652,null))['catch'](handleError(_0xeb652,null));}; \ No newline at end of file +var _0xb77f=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','MailSubstatus','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x2be824,_0x3e35a6){var _0x355dbc=function(_0x2f12f3){while(--_0x2f12f3){_0x2be824['push'](_0x2be824['shift']());}};_0x355dbc(++_0x3e35a6);}(_0xb77f,0x1ab));var _0xfb77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb77f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfb77('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb77('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb77('0x2'));var moment=require(_0xfb77('0x3'));var BPromise=require(_0xfb77('0x4'));var Mustache=require(_0xfb77('0x5'));var util=require(_0xfb77('0x6'));var path=require('path');var sox=require(_0xfb77('0x7'));var csv=require(_0xfb77('0x8'));var ejs=require(_0xfb77('0x9'));var fs=require('fs');var fs_extra=require(_0xfb77('0xa'));var _=require(_0xfb77('0xb'));var squel=require(_0xfb77('0xc'));var crypto=require('crypto');var jsforce=require(_0xfb77('0xd'));var deskjs=require(_0xfb77('0xe'));var toCsv=require(_0xfb77('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfb77('0xf'));var hardwareService=require(_0xfb77('0x10'));var logger=require(_0xfb77('0x11'))(_0xfb77('0x12'));var utils=require('../../config/utils');var config=require(_0xfb77('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb77('0x14'))['db'];function respondWithStatusCode(_0x3a146a,_0x2c0d07){_0x2c0d07=_0x2c0d07||0xcc;return function(_0x47a7fa){if(_0x47a7fa){return _0x3a146a[_0xfb77('0x15')](_0x2c0d07);}return _0x3a146a[_0xfb77('0x16')](_0x2c0d07)['end']();};}function respondWithResult(_0x237a1b,_0x1fba7a){_0x1fba7a=_0x1fba7a||0xc8;return function(_0x1567cc){if(_0x1567cc){return _0x237a1b[_0xfb77('0x16')](_0x1fba7a)[_0xfb77('0x17')](_0x1567cc);}};}function respondWithFilteredResult(_0x2da640,_0x1eb3f9){return function(_0x2386f3){if(_0x2386f3){var _0x5adfda=typeof _0x1eb3f9[_0xfb77('0x18')]===_0xfb77('0x19')&&typeof _0x1eb3f9[_0xfb77('0x1a')]===_0xfb77('0x19');var _0x27780d=_0x2386f3[_0xfb77('0x1b')];var _0x4c4566=_0x5adfda?0x0:_0x1eb3f9[_0xfb77('0x18')];var _0x5c630d=_0x5adfda?_0x2386f3[_0xfb77('0x1b')]:_0x1eb3f9[_0xfb77('0x18')]+_0x1eb3f9[_0xfb77('0x1a')];var _0x5c477f;if(_0x5c630d>=_0x27780d){_0x5c630d=_0x27780d;_0x5c477f=0xc8;}else{_0x5c477f=0xce;}_0x2da640[_0xfb77('0x16')](_0x5c477f);return _0x2da640['set'](_0xfb77('0x1c'),_0x4c4566+'-'+_0x5c630d+'/'+_0x27780d)[_0xfb77('0x17')](_0x2386f3);}return null;};}function patchUpdates(_0x342414){return function(_0x51332e){try{jsonpatch[_0xfb77('0x1d')](_0x51332e,_0x342414,!![]);}catch(_0xb58ebf){return BPromise[_0xfb77('0x1e')](_0xb58ebf);}return _0x51332e[_0xfb77('0x1f')]();};}function saveUpdates(_0x3e8025,_0x15ad2e){return function(_0x21b3d0){if(_0x21b3d0){return _0x21b3d0[_0xfb77('0x20')](_0x3e8025)[_0xfb77('0x21')](function(_0x432a94){return _0x432a94;});}return null;};}function removeEntity(_0x748279,_0x1a7a77){return function(_0x30d185){if(_0x30d185){return _0x30d185[_0xfb77('0x22')]()[_0xfb77('0x21')](function(){_0x748279[_0xfb77('0x16')](0xcc)[_0xfb77('0x23')]();});}};}function handleEntityNotFound(_0x2c6284,_0x2aa969){return function(_0x52d250){if(!_0x52d250){_0x2c6284[_0xfb77('0x15')](0x194);}return _0x52d250;};}function handleError(_0x4104c4,_0x4f7f4f){_0x4f7f4f=_0x4f7f4f||0x1f4;return function(_0xb21208){logger[_0xfb77('0x24')](_0xb21208[_0xfb77('0x25')]);if(_0xb21208[_0xfb77('0x26')]){delete _0xb21208[_0xfb77('0x26')];}_0x4104c4['status'](_0x4f7f4f)['send'](_0xb21208);};}exports[_0xfb77('0x27')]=function(_0x1a9134,_0x4c8b6d){var _0x5037ec={},_0x34a30={},_0x22f6b0={'count':0x0,'rows':[]};var _0x1390af=_['map'](db[_0xfb77('0x28')]['rawAttributes'],function(_0xd1e240){return{'name':_0xd1e240['fieldName'],'type':_0xd1e240[_0xfb77('0x29')][_0xfb77('0x2a')]};});_0x34a30['model']=_[_0xfb77('0x2b')](_0x1390af,_0xfb77('0x26'));_0x34a30['query']=_[_0xfb77('0x2c')](_0x1a9134[_0xfb77('0x2d')]);_0x34a30[_0xfb77('0x2e')]=_[_0xfb77('0x2f')](_0x34a30[_0xfb77('0x30')],_0x34a30[_0xfb77('0x2d')]);_0x5037ec[_0xfb77('0x31')]=_[_0xfb77('0x2f')](_0x34a30[_0xfb77('0x30')],qs['fields'](_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x32')]));_0x5037ec[_0xfb77('0x31')]=_0x5037ec['attributes'][_0xfb77('0x33')]?_0x5037ec['attributes']:_0x34a30[_0xfb77('0x30')];if(!_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x34')](_0xfb77('0x35'))){_0x5037ec[_0xfb77('0x1a')]=qs[_0xfb77('0x1a')](_0x1a9134[_0xfb77('0x2d')]['limit']);_0x5037ec['offset']=qs[_0xfb77('0x18')](_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x18')]);}_0x5037ec['order']=qs[_0xfb77('0x36')](_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x36')]);_0x5037ec[_0xfb77('0x37')]=qs[_0xfb77('0x2e')](_[_0xfb77('0x38')](_0x1a9134[_0xfb77('0x2d')],_0x34a30[_0xfb77('0x2e')]),_0x1390af);if(_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x39')]){_0x5037ec[_0xfb77('0x37')]=_['merge'](_0x5037ec[_0xfb77('0x37')],{'$or':_[_0xfb77('0x2b')](_0x1390af,function(_0x2f1505){if(_0x2f1505[_0xfb77('0x29')]!==_0xfb77('0x3a')){var _0x1fa435={};_0x1fa435[_0x2f1505[_0xfb77('0x26')]]={'$like':'%'+_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x39')]+'%'};return _0x1fa435;}})});}_0x5037ec=_[_0xfb77('0x3b')]({},_0x5037ec,_0x1a9134[_0xfb77('0x3c')]);var _0x563f7a={'where':_0x5037ec['where']};return db[_0xfb77('0x28')][_0xfb77('0x1b')](_0x563f7a)['then'](function(_0x3e0c11){_0x22f6b0[_0xfb77('0x1b')]=_0x3e0c11;if(_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x3d')]){_0x5037ec[_0xfb77('0x3e')]=[{'all':!![]}];}return db[_0xfb77('0x28')][_0xfb77('0x3f')](_0x5037ec);})['then'](function(_0x488861){_0x22f6b0[_0xfb77('0x40')]=_0x488861;return _0x22f6b0;})['then'](respondWithFilteredResult(_0x4c8b6d,_0x5037ec))[_0xfb77('0x41')](handleError(_0x4c8b6d,null));};exports['show']=function(_0x75a7b4,_0x50ad7c){var _0x55059a={'raw':!![],'where':{'id':_0x75a7b4[_0xfb77('0x42')]['id']}},_0x24ca02={};_0x24ca02[_0xfb77('0x30')]=_[_0xfb77('0x2c')](db['MailSubstatus'][_0xfb77('0x43')]);_0x24ca02[_0xfb77('0x2d')]=_[_0xfb77('0x2c')](_0x75a7b4[_0xfb77('0x2d')]);_0x24ca02[_0xfb77('0x2e')]=_['intersection'](_0x24ca02[_0xfb77('0x30')],_0x24ca02[_0xfb77('0x2d')]);_0x55059a[_0xfb77('0x31')]=_[_0xfb77('0x2f')](_0x24ca02[_0xfb77('0x30')],qs[_0xfb77('0x32')](_0x75a7b4[_0xfb77('0x2d')][_0xfb77('0x32')]));_0x55059a[_0xfb77('0x31')]=_0x55059a['attributes'][_0xfb77('0x33')]?_0x55059a[_0xfb77('0x31')]:_0x24ca02[_0xfb77('0x30')];if(_0x75a7b4[_0xfb77('0x2d')]['includeAll']){_0x55059a['include']=[{'all':!![]}];}_0x55059a=_[_0xfb77('0x3b')]({},_0x55059a,_0x75a7b4[_0xfb77('0x3c')]);return db[_0xfb77('0x28')][_0xfb77('0x44')](_0x55059a)[_0xfb77('0x21')](handleEntityNotFound(_0x50ad7c,null))['then'](respondWithResult(_0x50ad7c,null))[_0xfb77('0x41')](handleError(_0x50ad7c,null));};exports[_0xfb77('0x45')]=function(_0x1569f6,_0x5234f0){return db[_0xfb77('0x28')][_0xfb77('0x45')](_0x1569f6[_0xfb77('0x46')],{})[_0xfb77('0x21')](respondWithResult(_0x5234f0,0xc9))['catch'](handleError(_0x5234f0,null));};exports[_0xfb77('0x20')]=function(_0x2a53a2,_0x432536){if(_0x2a53a2[_0xfb77('0x46')]['id']){delete _0x2a53a2[_0xfb77('0x46')]['id'];}return db[_0xfb77('0x28')][_0xfb77('0x44')]({'where':{'id':_0x2a53a2['params']['id']}})[_0xfb77('0x21')](handleEntityNotFound(_0x432536,null))['then'](saveUpdates(_0x2a53a2['body'],null))['then'](respondWithResult(_0x432536,null))[_0xfb77('0x41')](handleError(_0x432536,null));};exports[_0xfb77('0x22')]=function(_0x1abcaa,_0x19d35a){return db[_0xfb77('0x28')][_0xfb77('0x44')]({'where':{'id':_0x1abcaa[_0xfb77('0x42')]['id']}})['then'](handleEntityNotFound(_0x19d35a,null))['then'](removeEntity(_0x19d35a,null))['catch'](handleError(_0x19d35a,null));};exports[_0xfb77('0x47')]=function(_0x53bcb5,_0x3a604a){return db['MailSubstatus'][_0xfb77('0x47')]()[_0xfb77('0x21')](respondWithResult(_0x3a604a,null))[_0xfb77('0x41')](handleError(_0x3a604a,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 01b9dc9..8ea40c2 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e0e=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x2cd33a,_0x3f3908){var _0x2e5e90=function(_0x1711d5){while(--_0x1711d5){_0x2cd33a['push'](_0x2cd33a['shift']());}};_0x2e5e90(++_0x3f3908);}(_0x5e0e,0x1af));var _0xe5e0=function(_0x329421,_0x414a49){_0x329421=_0x329421-0x0;var _0x5b31e8=_0x5e0e[_0x329421];return _0x5b31e8;};'use strict';var EventEmitter=require(_0xe5e0('0x0'));var MailSubstatus=require(_0xe5e0('0x1'))['db'][_0xe5e0('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xe5e0('0x3')](0x0);var events={'afterUpdate':_0xe5e0('0x4')};function emitEvent(_0x2a36bb){return function(_0xe8ba90,_0x40dd38,_0x469739){MailSubstatusEvents[_0xe5e0('0x5')](_0x2a36bb+':'+_0xe8ba90['id'],_0xe8ba90);MailSubstatusEvents['emit'](_0x2a36bb,_0xe8ba90);_0x469739(null);};}for(var e in events){if(events[_0xe5e0('0x6')](e)){var event=events[e];MailSubstatus[_0xe5e0('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x0a1e=['MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x43309c,_0x14f9a6){var _0x29d98f=function(_0x20494c){while(--_0x20494c){_0x43309c['push'](_0x43309c['shift']());}};_0x29d98f(++_0x14f9a6);}(_0x0a1e,0xae));var _0xe0a1=function(_0x1ebcc8,_0x5127e5){_0x1ebcc8=_0x1ebcc8-0x0;var _0x5e06e8=_0x0a1e[_0x1ebcc8];return _0x5e06e8;};'use strict';var EventEmitter=require(_0xe0a1('0x0'));var MailSubstatus=require(_0xe0a1('0x1'))['db'][_0xe0a1('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xe0a1('0x3')](0x0);var events={'afterUpdate':_0xe0a1('0x4')};function emitEvent(_0x52cd86){return function(_0x4aa89e,_0x515e2d,_0x3380c2){MailSubstatusEvents[_0xe0a1('0x5')](_0x52cd86+':'+_0x4aa89e['id'],_0x4aa89e);MailSubstatusEvents[_0xe0a1('0x5')](_0x52cd86,_0x4aa89e);_0x3380c2(null);};}for(var e in events){if(events[_0xe0a1('0x6')](e)){var event=events[e];MailSubstatus[_0xe0a1('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index cce7055..5f93197 100644 --- a/server/api/mailSubstatus/mailSubstatus.model.js +++ b/server/api/mailSubstatus/mailSubstatus.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9454=['mail_substatuses','Condition','mailSubstatus','_previousDataValues','catch','./mailSubstatus.attributes','exports','models','MailSubstatus'];(function(_0x34c043,_0x4d0f0e){var _0x368338=function(_0x3ff7a4){while(--_0x3ff7a4){_0x34c043['push'](_0x34c043['shift']());}};_0x368338(++_0x4d0f0e);}(_0x9454,0x1e2));var _0x4945=function(_0x315585,_0x1acf90){_0x315585=_0x315585-0x0;var _0x2d9542=_0x9454[_0x315585];return _0x2d9542;};'use strict';var attributes=require(_0x4945('0x0'));module[_0x4945('0x1')]=function(_0x50012e){var _0x12b236=_0x50012e[_0x4945('0x2')];return _0x50012e['define'](_0x4945('0x3'),attributes,{'tableName':_0x4945('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x59713a,_0x4132e6,_0x152f09){return _0x12b236[_0x4945('0x5')]['update']({'value':_0x59713a['name']},{'where':{'field':_0x4945('0x6'),'value':_0x59713a[_0x4945('0x7')]['name']}})['then'](function(){_0x152f09();})[_0x4945('0x8')](function(_0x384fd7){_0x152f09(_0x384fd7);});}}});}; \ No newline at end of file +var _0x9ead=['then','catch','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','update','name','mailSubstatus','_previousDataValues'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9ead,0x70));var _0xd9ea=function(_0x5f150e,_0x5e3a1e){_0x5f150e=_0x5f150e-0x0;var _0x2f6957=_0x9ead[_0x5f150e];return _0x2f6957;};'use strict';var attributes=require(_0xd9ea('0x0'));module[_0xd9ea('0x1')]=function(_0x1e1e97){var _0x217351=_0x1e1e97['models'];return _0x1e1e97[_0xd9ea('0x2')](_0xd9ea('0x3'),attributes,{'tableName':_0xd9ea('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5884f9,_0x334310,_0x5858e4){return _0x217351['Condition'][_0xd9ea('0x5')]({'value':_0x5884f9[_0xd9ea('0x6')]},{'where':{'field':_0xd9ea('0x7'),'value':_0x5884f9[_0xd9ea('0x8')]['name']}})[_0xd9ea('0x9')](function(){_0x5858e4();})[_0xd9ea('0xa')](function(_0x570df0){_0x5858e4(_0x570df0);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a1a13b6..ce750a5 100644 --- a/server/api/mailSubstatus/mailSubstatus.rpc.js +++ b/server/api/mailSubstatus/mailSubstatus.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb24d=['MailSubstatus,\x20%s,\x20%s,\x20%s','code','error','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug'];(function(_0x565faf,_0x5f3718){var _0x42292f=function(_0x514b49){while(--_0x514b49){_0x565faf['push'](_0x565faf['shift']());}};_0x42292f(++_0x5f3718);}(_0xb24d,0x124));var _0xdb24=function(_0x6b046b,_0x266a14){_0x6b046b=_0x6b046b-0x0;var _0xac2a06=_0xb24d[_0x6b046b];return _0xac2a06;};'use strict';var _=require(_0xdb24('0x0'));var util=require(_0xdb24('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdb24('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb24('0x3'));var logger=require('../../config/logger')(_0xdb24('0x4'));var config=require(_0xdb24('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdb24('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c98d5,_0x146e36,_0x1ca744){return new BPromise(function(_0x3b64bb,_0x2d8a0a){return client[_0xdb24('0x7')](_0x4c98d5,_0x1ca744)[_0xdb24('0x8')](function(_0x29e5f2){logger[_0xdb24('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x146e36,_0xdb24('0xa'));logger[_0xdb24('0xb')](_0xdb24('0xc'),_0x146e36,_0xdb24('0xa'),JSON['stringify'](_0x29e5f2));if(_0x29e5f2['error']){if(_0x29e5f2['error'][_0xdb24('0xd')]===0x1f4){logger[_0xdb24('0xe')](_0xdb24('0xf'),_0x146e36,_0x29e5f2[_0xdb24('0xe')]['message']);return _0x2d8a0a(_0x29e5f2[_0xdb24('0xe')][_0xdb24('0x10')]);}logger[_0xdb24('0xe')](_0xdb24('0xf'),_0x146e36,_0x29e5f2[_0xdb24('0xe')][_0xdb24('0x10')]);return _0x3b64bb(_0x29e5f2[_0xdb24('0xe')][_0xdb24('0x10')]);}else{logger[_0xdb24('0x9')](_0xdb24('0xf'),_0x146e36,'request\x20sent');_0x3b64bb(_0x29e5f2[_0xdb24('0x11')][_0xdb24('0x10')]);}})[_0xdb24('0x12')](function(_0x228217){logger[_0xdb24('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x146e36,_0x228217);_0x2d8a0a(_0x228217);});});} \ No newline at end of file +var _0x4ba7=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x421646,_0x505f8d){var _0x43f8e2=function(_0x6d4c63){while(--_0x6d4c63){_0x421646['push'](_0x421646['shift']());}};_0x43f8e2(++_0x505f8d);}(_0x4ba7,0x1d3));var _0x74ba=function(_0x566544,_0x1d1aa1){_0x566544=_0x566544-0x0;var _0x4d8e33=_0x4ba7[_0x566544];return _0x4d8e33;};'use strict';var _=require(_0x74ba('0x0'));var util=require(_0x74ba('0x1'));var moment=require(_0x74ba('0x2'));var BPromise=require(_0x74ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x74ba('0x5'))(_0x74ba('0x6'));var config=require(_0x74ba('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x74ba('0x8')][_0x74ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11408d,_0x554764,_0xff1688){return new BPromise(function(_0x5e20c6,_0x25fd0d){return client[_0x74ba('0xa')](_0x11408d,_0xff1688)[_0x74ba('0xb')](function(_0x47977c){logger[_0x74ba('0xc')](_0x74ba('0xd'),_0x554764,_0x74ba('0xe'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x554764,_0x74ba('0xe'),JSON[_0x74ba('0xf')](_0x47977c));if(_0x47977c[_0x74ba('0x10')]){if(_0x47977c[_0x74ba('0x10')][_0x74ba('0x11')]===0x1f4){logger[_0x74ba('0x10')](_0x74ba('0xd'),_0x554764,_0x47977c[_0x74ba('0x10')][_0x74ba('0x12')]);return _0x25fd0d(_0x47977c[_0x74ba('0x10')][_0x74ba('0x12')]);}logger[_0x74ba('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x554764,_0x47977c[_0x74ba('0x10')][_0x74ba('0x12')]);return _0x5e20c6(_0x47977c[_0x74ba('0x10')][_0x74ba('0x12')]);}else{logger[_0x74ba('0xc')](_0x74ba('0xd'),_0x554764,_0x74ba('0xe'));_0x5e20c6(_0x47977c[_0x74ba('0x13')][_0x74ba('0x12')]);}})[_0x74ba('0x14')](function(_0x57f2e5){logger[_0x74ba('0x10')](_0x74ba('0xd'),_0x554764,_0x57f2e5);_0x25fd0d(_0x57f2e5);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8f163a1..6530607 100644 --- a/server/api/mailTransferReport/index.js +++ b/server/api/mailTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe527=['show','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0xe527,0x1bf));var _0x7e52=function(_0x5d1c00,_0x13c95d){_0x5d1c00=_0x5d1c00-0x0;var _0x23ac42=_0xe527[_0x5d1c00];return _0x23ac42;};'use strict';var multer=require('multer');var util=require(_0x7e52('0x0'));var path=require(_0x7e52('0x1'));var timeout=require(_0x7e52('0x2'));var express=require(_0x7e52('0x3'));var router=express[_0x7e52('0x4')]();var fs_extra=require(_0x7e52('0x5'));var auth=require(_0x7e52('0x6'));var interaction=require(_0x7e52('0x7'));var config=require(_0x7e52('0x8'));var controller=require(_0x7e52('0x9'));router['get']('/',auth[_0x7e52('0xa')](),controller[_0x7e52('0xb')]);router[_0x7e52('0xc')](_0x7e52('0xd'),auth[_0x7e52('0xa')](),controller[_0x7e52('0xe')]);router[_0x7e52('0xc')]('/:id',auth[_0x7e52('0xa')](),controller[_0x7e52('0xf')]);router['post']('/',auth[_0x7e52('0xa')](),controller[_0x7e52('0x10')]);router[_0x7e52('0x11')](_0x7e52('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x7e52('0x13')](_0x7e52('0x12'),auth['isAuthenticated'](),controller[_0x7e52('0x14')]);module[_0x7e52('0x15')]=router; \ No newline at end of file +var _0x69ba=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','multer'];(function(_0x28f153,_0x4852ed){var _0x56b861=function(_0x3cbf02){while(--_0x3cbf02){_0x28f153['push'](_0x28f153['shift']());}};_0x56b861(++_0x4852ed);}(_0x69ba,0x13f));var _0xa69b=function(_0x483afd,_0x1c6414){_0x483afd=_0x483afd-0x0;var _0x2ab4e8=_0x69ba[_0x483afd];return _0x2ab4e8;};'use strict';var multer=require(_0xa69b('0x0'));var util=require(_0xa69b('0x1'));var path=require(_0xa69b('0x2'));var timeout=require(_0xa69b('0x3'));var express=require('express');var router=express[_0xa69b('0x4')]();var fs_extra=require(_0xa69b('0x5'));var auth=require(_0xa69b('0x6'));var interaction=require(_0xa69b('0x7'));var config=require('../../config/environment');var controller=require(_0xa69b('0x8'));router[_0xa69b('0x9')]('/',auth[_0xa69b('0xa')](),controller[_0xa69b('0xb')]);router[_0xa69b('0x9')](_0xa69b('0xc'),auth[_0xa69b('0xa')](),controller[_0xa69b('0xd')]);router[_0xa69b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa69b('0xe')]);router[_0xa69b('0xf')]('/',auth[_0xa69b('0xa')](),controller[_0xa69b('0x10')]);router[_0xa69b('0x11')]('/:id',auth[_0xa69b('0xa')](),controller[_0xa69b('0x12')]);router[_0xa69b('0x13')]('/:id',auth[_0xa69b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 79551bd..2b26200 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2b857d,_0x4ff791){var _0x4b31c4=function(_0x3d35bd){while(--_0x3d35bd){_0x2b857d['push'](_0x2b857d['shift']());}};_0x4b31c4(++_0x4ff791);}(_0xf4eb,0xec));var _0xbf4e=function(_0x51fa6a,_0x29a616){_0x51fa6a=_0x51fa6a-0x0;var _0x38080b=_0xf4eb[_0x51fa6a];return _0x38080b;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x558711,_0x3de772){var _0x488714=function(_0xc5bc20){while(--_0xc5bc20){_0x558711['push'](_0x558711['shift']());}};_0x488714(++_0x3de772);}(_0xaa88,0x137));var _0x8aa8=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xaa88[_0x58fc2f];return _0x3a1312;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 76cd284..790c33f 100644 --- a/server/api/mailTransferReport/mailTransferReport.controller.js +++ b/server/api/mailTransferReport/mailTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x474a=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order'];(function(_0xf2ac09,_0x4381c7){var _0x434fa3=function(_0x3eb859){while(--_0x3eb859){_0xf2ac09['push'](_0xf2ac09['shift']());}};_0x434fa3(++_0x4381c7);}(_0x474a,0x141));var _0xa474=function(_0x4bf497,_0x30f242){_0x4bf497=_0x4bf497-0x0;var _0xb5f818=_0x474a[_0x4bf497];return _0xb5f818;};'use strict';var emlformat=require(_0xa474('0x0'));var rimraf=require(_0xa474('0x1'));var zipdir=require(_0xa474('0x2'));var jsonpatch=require(_0xa474('0x3'));var rp=require(_0xa474('0x4'));var moment=require(_0xa474('0x5'));var BPromise=require(_0xa474('0x6'));var Mustache=require('mustache');var util=require(_0xa474('0x7'));var path=require('path');var sox=require(_0xa474('0x8'));var csv=require(_0xa474('0x9'));var ejs=require(_0xa474('0xa'));var fs=require('fs');var fs_extra=require(_0xa474('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa474('0xc'));var jsforce=require(_0xa474('0xd'));var deskjs=require(_0xa474('0xe'));var toCsv=require(_0xa474('0x9'));var querystring=require(_0xa474('0xf'));var Papa=require(_0xa474('0x10'));var Redis=require(_0xa474('0x11'));var authService=require(_0xa474('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa474('0x13'));var logger=require(_0xa474('0x14'))(_0xa474('0x15'));var utils=require(_0xa474('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa474('0x17'));var db=require(_0xa474('0x18'))['db'];function respondWithStatusCode(_0x101ce3,_0x11683a){_0x11683a=_0x11683a||0xcc;return function(_0x5093a9){if(_0x5093a9){return _0x101ce3[_0xa474('0x19')](_0x11683a);}return _0x101ce3[_0xa474('0x1a')](_0x11683a)[_0xa474('0x1b')]();};}function respondWithResult(_0x3ce17c,_0xa15353){_0xa15353=_0xa15353||0xc8;return function(_0x1ad2f7){if(_0x1ad2f7){return _0x3ce17c['status'](_0xa15353)['json'](_0x1ad2f7);}};}function respondWithFilteredResult(_0xe76a08,_0x4f3dc0){return function(_0x30868d){if(_0x30868d){var _0x56916e=typeof _0x4f3dc0[_0xa474('0x1c')]==='undefined'&&typeof _0x4f3dc0[_0xa474('0x1d')]===_0xa474('0x1e');var _0x2c202b=_0x30868d[_0xa474('0x1f')];var _0x39cd9a=_0x56916e?0x0:_0x4f3dc0[_0xa474('0x1c')];var _0x1f48d9=_0x56916e?_0x30868d[_0xa474('0x1f')]:_0x4f3dc0[_0xa474('0x1c')]+_0x4f3dc0[_0xa474('0x1d')];var _0x255259;if(_0x1f48d9>=_0x2c202b){_0x1f48d9=_0x2c202b;_0x255259=0xc8;}else{_0x255259=0xce;}_0xe76a08[_0xa474('0x1a')](_0x255259);return _0xe76a08[_0xa474('0x20')]('Content-Range',_0x39cd9a+'-'+_0x1f48d9+'/'+_0x2c202b)[_0xa474('0x21')](_0x30868d);}return null;};}function patchUpdates(_0x4d8469){return function(_0x5ce538){try{jsonpatch[_0xa474('0x22')](_0x5ce538,_0x4d8469,!![]);}catch(_0x5d4349){return BPromise['reject'](_0x5d4349);}return _0x5ce538[_0xa474('0x23')]();};}function saveUpdates(_0x1725f8,_0x3fa9f6){return function(_0x5a78a0){if(_0x5a78a0){return _0x5a78a0[_0xa474('0x24')](_0x1725f8)[_0xa474('0x25')](function(_0x1f09c3){return _0x1f09c3;});}return null;};}function removeEntity(_0x43ac28,_0x119b8e){return function(_0x41c414){if(_0x41c414){return _0x41c414[_0xa474('0x26')]()[_0xa474('0x25')](function(){_0x43ac28[_0xa474('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b94eb,_0x59e8c7){return function(_0x2dc6ec){if(!_0x2dc6ec){_0x3b94eb[_0xa474('0x19')](0x194);}return _0x2dc6ec;};}function handleError(_0x3c9cde,_0x449aee){_0x449aee=_0x449aee||0x1f4;return function(_0x2efe03){logger[_0xa474('0x27')](_0x2efe03[_0xa474('0x28')]);if(_0x2efe03[_0xa474('0x29')]){delete _0x2efe03[_0xa474('0x29')];}_0x3c9cde[_0xa474('0x1a')](_0x449aee)[_0xa474('0x2a')](_0x2efe03);};}exports[_0xa474('0x2b')]=function(_0x1f1975,_0x256228){var _0x111c7b={},_0x4449b3={},_0x411d97={'count':0x0,'rows':[]};var _0x1bc40d=_[_0xa474('0x2c')](db[_0xa474('0x2d')][_0xa474('0x2e')],function(_0x20695f){return{'name':_0x20695f[_0xa474('0x2f')],'type':_0x20695f[_0xa474('0x30')]['key']};});_0x4449b3['model']=_[_0xa474('0x2c')](_0x1bc40d,_0xa474('0x29'));_0x4449b3[_0xa474('0x31')]=_[_0xa474('0x32')](_0x1f1975['query']);_0x4449b3[_0xa474('0x33')]=_[_0xa474('0x34')](_0x4449b3[_0xa474('0x35')],_0x4449b3['query']);_0x111c7b[_0xa474('0x36')]=_['intersection'](_0x4449b3['model'],qs[_0xa474('0x37')](_0x1f1975[_0xa474('0x31')][_0xa474('0x37')]));_0x111c7b['attributes']=_0x111c7b[_0xa474('0x36')][_0xa474('0x38')]?_0x111c7b['attributes']:_0x4449b3['model'];if(!_0x1f1975[_0xa474('0x31')]['hasOwnProperty'](_0xa474('0x39'))){_0x111c7b['limit']=qs[_0xa474('0x1d')](_0x1f1975[_0xa474('0x31')][_0xa474('0x1d')]);_0x111c7b['offset']=qs[_0xa474('0x1c')](_0x1f1975[_0xa474('0x31')][_0xa474('0x1c')]);}_0x111c7b[_0xa474('0x3a')]=qs[_0xa474('0x3b')](_0x1f1975[_0xa474('0x31')][_0xa474('0x3b')]);_0x111c7b[_0xa474('0x3c')]=qs[_0xa474('0x33')](_[_0xa474('0x3d')](_0x1f1975[_0xa474('0x31')],_0x4449b3[_0xa474('0x33')]),_0x1bc40d);if(_0x1f1975['query'][_0xa474('0x3e')]){_0x111c7b['where']=_[_0xa474('0x3f')](_0x111c7b[_0xa474('0x3c')],{'$or':_[_0xa474('0x2c')](_0x1bc40d,function(_0x1e355c){if(_0x1e355c[_0xa474('0x30')]!==_0xa474('0x40')){var _0x439628={};_0x439628[_0x1e355c[_0xa474('0x29')]]={'$like':'%'+_0x1f1975[_0xa474('0x31')][_0xa474('0x3e')]+'%'};return _0x439628;}})});}_0x111c7b=_[_0xa474('0x3f')]({},_0x111c7b,_0x1f1975[_0xa474('0x41')]);var _0x4e4ee0={'where':_0x111c7b[_0xa474('0x3c')]};return db['MailTransferReport'][_0xa474('0x1f')](_0x4e4ee0)[_0xa474('0x25')](function(_0x4719ec){_0x411d97[_0xa474('0x1f')]=_0x4719ec;if(_0x1f1975['query'][_0xa474('0x42')]){_0x111c7b[_0xa474('0x43')]=[{'all':!![]}];}return db[_0xa474('0x2d')]['findAll'](_0x111c7b);})['then'](function(_0x17b6a5){_0x411d97[_0xa474('0x44')]=_0x17b6a5;return _0x411d97;})['then'](respondWithFilteredResult(_0x256228,_0x111c7b))['catch'](handleError(_0x256228,null));};exports[_0xa474('0x45')]=function(_0x4ae30b,_0x405627){var _0x64cbe2={'raw':!![],'where':{'id':_0x4ae30b[_0xa474('0x46')]['id']}},_0x572131={};_0x572131[_0xa474('0x35')]=_['keys'](db['MailTransferReport'][_0xa474('0x2e')]);_0x572131[_0xa474('0x31')]=_[_0xa474('0x32')](_0x4ae30b[_0xa474('0x31')]);_0x572131[_0xa474('0x33')]=_[_0xa474('0x34')](_0x572131[_0xa474('0x35')],_0x572131[_0xa474('0x31')]);_0x64cbe2[_0xa474('0x36')]=_['intersection'](_0x572131[_0xa474('0x35')],qs['fields'](_0x4ae30b['query'][_0xa474('0x37')]));_0x64cbe2[_0xa474('0x36')]=_0x64cbe2[_0xa474('0x36')][_0xa474('0x38')]?_0x64cbe2[_0xa474('0x36')]:_0x572131[_0xa474('0x35')];if(_0x4ae30b[_0xa474('0x31')][_0xa474('0x42')]){_0x64cbe2[_0xa474('0x43')]=[{'all':!![]}];}_0x64cbe2=_[_0xa474('0x3f')]({},_0x64cbe2,_0x4ae30b[_0xa474('0x41')]);return db[_0xa474('0x2d')][_0xa474('0x47')](_0x64cbe2)[_0xa474('0x25')](handleEntityNotFound(_0x405627,null))[_0xa474('0x25')](respondWithResult(_0x405627,null))[_0xa474('0x48')](handleError(_0x405627,null));};exports[_0xa474('0x49')]=function(_0x105ab6,_0x114044){return db['MailTransferReport'][_0xa474('0x49')](_0x105ab6[_0xa474('0x4a')],{})[_0xa474('0x25')](respondWithResult(_0x114044,0xc9))[_0xa474('0x48')](handleError(_0x114044,null));};exports['update']=function(_0x473232,_0x4c6b95){if(_0x473232[_0xa474('0x4a')]['id']){delete _0x473232[_0xa474('0x4a')]['id'];}return db['MailTransferReport'][_0xa474('0x47')]({'where':{'id':_0x473232[_0xa474('0x46')]['id']}})[_0xa474('0x25')](handleEntityNotFound(_0x4c6b95,null))[_0xa474('0x25')](saveUpdates(_0x473232['body'],null))[_0xa474('0x25')](respondWithResult(_0x4c6b95,null))[_0xa474('0x48')](handleError(_0x4c6b95,null));};exports[_0xa474('0x26')]=function(_0x5f3a5b,_0x5844da){return db['MailTransferReport'][_0xa474('0x47')]({'where':{'id':_0x5f3a5b[_0xa474('0x46')]['id']}})[_0xa474('0x25')](handleEntityNotFound(_0x5844da,null))[_0xa474('0x25')](removeEntity(_0x5844da,null))[_0xa474('0x48')](handleError(_0x5844da,null));};exports[_0xa474('0x4b')]=function(_0x2f1d5c,_0x1e14ea){return db[_0xa474('0x2d')]['describe']()[_0xa474('0x25')](respondWithResult(_0x1e14ea,null))[_0xa474('0x48')](handleError(_0x1e14ea,null));}; \ No newline at end of file +var _0x110e=['util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x110e,0x121));var _0xe110=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x110e[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require(_0xe110('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe110('0x1'));var jsonpatch=require(_0xe110('0x2'));var rp=require(_0xe110('0x3'));var moment=require(_0xe110('0x4'));var BPromise=require(_0xe110('0x5'));var Mustache=require(_0xe110('0x6'));var util=require(_0xe110('0x7'));var path=require(_0xe110('0x8'));var sox=require(_0xe110('0x9'));var csv=require('to-csv');var ejs=require(_0xe110('0xa'));var fs=require('fs');var fs_extra=require(_0xe110('0xb'));var _=require(_0xe110('0xc'));var squel=require('squel');var crypto=require(_0xe110('0xd'));var jsforce=require(_0xe110('0xe'));var deskjs=require(_0xe110('0xf'));var toCsv=require(_0xe110('0x10'));var querystring=require(_0xe110('0x11'));var Papa=require(_0xe110('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe110('0x13'));var as=require(_0xe110('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe110('0x15'));var db=require(_0xe110('0x16'))['db'];function respondWithStatusCode(_0x1fd8e9,_0x5d2b12){_0x5d2b12=_0x5d2b12||0xcc;return function(_0x423c7b){if(_0x423c7b){return _0x1fd8e9['sendStatus'](_0x5d2b12);}return _0x1fd8e9[_0xe110('0x17')](_0x5d2b12)[_0xe110('0x18')]();};}function respondWithResult(_0x5d73a3,_0x466310){_0x466310=_0x466310||0xc8;return function(_0x238013){if(_0x238013){return _0x5d73a3[_0xe110('0x17')](_0x466310)[_0xe110('0x19')](_0x238013);}};}function respondWithFilteredResult(_0x16ac21,_0x58746c){return function(_0x229ece){if(_0x229ece){var _0x492e62=typeof _0x58746c[_0xe110('0x1a')]==='undefined'&&typeof _0x58746c[_0xe110('0x1b')]===_0xe110('0x1c');var _0x1a58db=_0x229ece[_0xe110('0x1d')];var _0x106490=_0x492e62?0x0:_0x58746c[_0xe110('0x1a')];var _0x118675=_0x492e62?_0x229ece[_0xe110('0x1d')]:_0x58746c['offset']+_0x58746c[_0xe110('0x1b')];var _0x4089c1;if(_0x118675>=_0x1a58db){_0x118675=_0x1a58db;_0x4089c1=0xc8;}else{_0x4089c1=0xce;}_0x16ac21['status'](_0x4089c1);return _0x16ac21['set'](_0xe110('0x1e'),_0x106490+'-'+_0x118675+'/'+_0x1a58db)[_0xe110('0x19')](_0x229ece);}return null;};}function patchUpdates(_0x4054cf){return function(_0x2db72f){try{jsonpatch[_0xe110('0x1f')](_0x2db72f,_0x4054cf,!![]);}catch(_0x1291a7){return BPromise['reject'](_0x1291a7);}return _0x2db72f[_0xe110('0x20')]();};}function saveUpdates(_0x48a594,_0x5a8447){return function(_0x129c4a){if(_0x129c4a){return _0x129c4a[_0xe110('0x21')](_0x48a594)['then'](function(_0x32e06a){return _0x32e06a;});}return null;};}function removeEntity(_0x3cfbf6,_0x1feb7b){return function(_0x34a754){if(_0x34a754){return _0x34a754[_0xe110('0x22')]()[_0xe110('0x23')](function(){_0x3cfbf6['status'](0xcc)[_0xe110('0x18')]();});}};}function handleEntityNotFound(_0x41923d,_0x3831a0){return function(_0x1a31ed){if(!_0x1a31ed){_0x41923d[_0xe110('0x24')](0x194);}return _0x1a31ed;};}function handleError(_0x3350ee,_0x30bc20){_0x30bc20=_0x30bc20||0x1f4;return function(_0x4d3e73){logger['error'](_0x4d3e73[_0xe110('0x25')]);if(_0x4d3e73['name']){delete _0x4d3e73[_0xe110('0x26')];}_0x3350ee['status'](_0x30bc20)[_0xe110('0x27')](_0x4d3e73);};}exports[_0xe110('0x28')]=function(_0x5329a7,_0x189965){var _0x59af6b={},_0x333474={},_0x37a303={'count':0x0,'rows':[]};var _0x24b8eb=_[_0xe110('0x29')](db[_0xe110('0x2a')][_0xe110('0x2b')],function(_0xe1debf){return{'name':_0xe1debf[_0xe110('0x2c')],'type':_0xe1debf['type'][_0xe110('0x2d')]};});_0x333474['model']=_[_0xe110('0x29')](_0x24b8eb,_0xe110('0x26'));_0x333474[_0xe110('0x2e')]=_[_0xe110('0x2f')](_0x5329a7[_0xe110('0x2e')]);_0x333474[_0xe110('0x30')]=_[_0xe110('0x31')](_0x333474['model'],_0x333474[_0xe110('0x2e')]);_0x59af6b[_0xe110('0x32')]=_[_0xe110('0x31')](_0x333474[_0xe110('0x33')],qs[_0xe110('0x34')](_0x5329a7[_0xe110('0x2e')][_0xe110('0x34')]));_0x59af6b[_0xe110('0x32')]=_0x59af6b[_0xe110('0x32')][_0xe110('0x35')]?_0x59af6b['attributes']:_0x333474[_0xe110('0x33')];if(!_0x5329a7['query'][_0xe110('0x36')]('nolimit')){_0x59af6b['limit']=qs[_0xe110('0x1b')](_0x5329a7[_0xe110('0x2e')][_0xe110('0x1b')]);_0x59af6b[_0xe110('0x1a')]=qs[_0xe110('0x1a')](_0x5329a7['query'][_0xe110('0x1a')]);}_0x59af6b[_0xe110('0x37')]=qs[_0xe110('0x38')](_0x5329a7[_0xe110('0x2e')][_0xe110('0x38')]);_0x59af6b[_0xe110('0x39')]=qs[_0xe110('0x30')](_['pick'](_0x5329a7[_0xe110('0x2e')],_0x333474[_0xe110('0x30')]),_0x24b8eb);if(_0x5329a7['query'][_0xe110('0x3a')]){_0x59af6b[_0xe110('0x39')]=_['merge'](_0x59af6b[_0xe110('0x39')],{'$or':_[_0xe110('0x29')](_0x24b8eb,function(_0x5720ab){if(_0x5720ab[_0xe110('0x3b')]!==_0xe110('0x3c')){var _0x550e95={};_0x550e95[_0x5720ab[_0xe110('0x26')]]={'$like':'%'+_0x5329a7[_0xe110('0x2e')][_0xe110('0x3a')]+'%'};return _0x550e95;}})});}_0x59af6b=_[_0xe110('0x3d')]({},_0x59af6b,_0x5329a7[_0xe110('0x3e')]);var _0x3a7661={'where':_0x59af6b[_0xe110('0x39')]};return db[_0xe110('0x2a')][_0xe110('0x1d')](_0x3a7661)['then'](function(_0x3db1f0){_0x37a303[_0xe110('0x1d')]=_0x3db1f0;if(_0x5329a7[_0xe110('0x2e')][_0xe110('0x3f')]){_0x59af6b['include']=[{'all':!![]}];}return db[_0xe110('0x2a')][_0xe110('0x40')](_0x59af6b);})[_0xe110('0x23')](function(_0x2d5fe3){_0x37a303[_0xe110('0x41')]=_0x2d5fe3;return _0x37a303;})[_0xe110('0x23')](respondWithFilteredResult(_0x189965,_0x59af6b))['catch'](handleError(_0x189965,null));};exports[_0xe110('0x42')]=function(_0xf28c61,_0x5d5fcb){var _0x24d1ff={'raw':!![],'where':{'id':_0xf28c61[_0xe110('0x43')]['id']}},_0x5a8e2f={};_0x5a8e2f[_0xe110('0x33')]=_[_0xe110('0x2f')](db[_0xe110('0x2a')][_0xe110('0x2b')]);_0x5a8e2f[_0xe110('0x2e')]=_[_0xe110('0x2f')](_0xf28c61['query']);_0x5a8e2f[_0xe110('0x30')]=_[_0xe110('0x31')](_0x5a8e2f[_0xe110('0x33')],_0x5a8e2f[_0xe110('0x2e')]);_0x24d1ff[_0xe110('0x32')]=_[_0xe110('0x31')](_0x5a8e2f['model'],qs[_0xe110('0x34')](_0xf28c61[_0xe110('0x2e')]['fields']));_0x24d1ff[_0xe110('0x32')]=_0x24d1ff[_0xe110('0x32')][_0xe110('0x35')]?_0x24d1ff[_0xe110('0x32')]:_0x5a8e2f[_0xe110('0x33')];if(_0xf28c61[_0xe110('0x2e')][_0xe110('0x3f')]){_0x24d1ff[_0xe110('0x44')]=[{'all':!![]}];}_0x24d1ff=_[_0xe110('0x3d')]({},_0x24d1ff,_0xf28c61[_0xe110('0x3e')]);return db[_0xe110('0x2a')]['find'](_0x24d1ff)['then'](handleEntityNotFound(_0x5d5fcb,null))[_0xe110('0x23')](respondWithResult(_0x5d5fcb,null))[_0xe110('0x45')](handleError(_0x5d5fcb,null));};exports[_0xe110('0x46')]=function(_0x32a355,_0x450cc2){return db[_0xe110('0x2a')][_0xe110('0x46')](_0x32a355[_0xe110('0x47')],{})[_0xe110('0x23')](respondWithResult(_0x450cc2,0xc9))[_0xe110('0x45')](handleError(_0x450cc2,null));};exports[_0xe110('0x21')]=function(_0x148818,_0x2d752e){if(_0x148818[_0xe110('0x47')]['id']){delete _0x148818[_0xe110('0x47')]['id'];}return db['MailTransferReport'][_0xe110('0x48')]({'where':{'id':_0x148818['params']['id']}})[_0xe110('0x23')](handleEntityNotFound(_0x2d752e,null))['then'](saveUpdates(_0x148818['body'],null))[_0xe110('0x23')](respondWithResult(_0x2d752e,null))[_0xe110('0x45')](handleError(_0x2d752e,null));};exports[_0xe110('0x22')]=function(_0x9b76e9,_0x63f296){return db['MailTransferReport'][_0xe110('0x48')]({'where':{'id':_0x9b76e9['params']['id']}})[_0xe110('0x23')](handleEntityNotFound(_0x63f296,null))[_0xe110('0x23')](removeEntity(_0x63f296,null))['catch'](handleError(_0x63f296,null));};exports[_0xe110('0x49')]=function(_0x5b8596,_0x460faa){return db[_0xe110('0x2a')][_0xe110('0x49')]()[_0xe110('0x23')](respondWithResult(_0x460faa,null))['catch'](handleError(_0x460faa,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b76e4e4..45fd7d8 100644 --- a/server/api/mailTransferReport/mailTransferReport.model.js +++ b/server/api/mailTransferReport/mailTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8eb=['bluebird','request-promise','rimraf','../../config/environment','exports','MailTransferReport','report_mail_transfer','lodash','../../config/logger','moment'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xa8eb,0x179));var _0xba8e=function(_0xbfa54f,_0x5896e4){_0xbfa54f=_0xbfa54f-0x0;var _0x192f42=_0xa8eb[_0xbfa54f];return _0x192f42;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))('api');var moment=require(_0xba8e('0x2'));var BPromise=require(_0xba8e('0x3'));var rp=require(_0xba8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0xba8e('0x7')]=function(_0x57e345,_0x14c3ac){return _0x57e345['define'](_0xba8e('0x8'),attributes,{'tableName':_0xba8e('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7aa7=['uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x7aa7,0xfd));var _0x77aa=function(_0x441dd0,_0xa02a45){_0x441dd0=_0x441dd0-0x0;var _0x3840a2=_0x7aa7[_0x441dd0];return _0x3840a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x77aa('0x0'))(_0x77aa('0x1'));var moment=require(_0x77aa('0x2'));var BPromise=require('bluebird');var rp=require(_0x77aa('0x3'));var fs=require('fs');var path=require(_0x77aa('0x4'));var rimraf=require(_0x77aa('0x5'));var config=require(_0x77aa('0x6'));var attributes=require(_0x77aa('0x7'));module[_0x77aa('0x8')]=function(_0x211587,_0x4726da){return _0x211587['define'](_0x77aa('0x9'),attributes,{'tableName':_0x77aa('0xa'),'paranoid':![],'indexes':[{'name':_0x77aa('0xb'),'fields':[_0x77aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 1316a81..68b3019 100644 --- a/server/api/mailTransferReport/mailTransferReport.rpc.js +++ b/server/api/mailTransferReport/mailTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f95=['client','http','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2d7c57,_0x5d4859){var _0x461118=function(_0x186c48){while(--_0x186c48){_0x2d7c57['push'](_0x2d7c57['shift']());}};_0x461118(++_0x5d4859);}(_0x1f95,0x97));var _0x51f9=function(_0x296a70,_0x1b54fb){_0x296a70=_0x296a70-0x0;var _0x321284=_0x1f95[_0x296a70];return _0x321284;};'use strict';var _=require('lodash');var util=require(_0x51f9('0x0'));var moment=require(_0x51f9('0x1'));var BPromise=require(_0x51f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51f9('0x3'));var db=require(_0x51f9('0x4'))['db'];var utils=require(_0x51f9('0x5'));var logger=require(_0x51f9('0x6'))(_0x51f9('0x7'));var config=require(_0x51f9('0x8'));var jayson=require(_0x51f9('0x9'));var client=jayson[_0x51f9('0xa')][_0x51f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b2960,_0x34b254,_0x1664b8){return new BPromise(function(_0x5ae323,_0xcf23e1){return client['request'](_0x2b2960,_0x1664b8)['then'](function(_0x58dec2){logger[_0x51f9('0xc')](_0x51f9('0xd'),_0x34b254,'request\x20sent');logger[_0x51f9('0xe')](_0x51f9('0xf'),_0x34b254,_0x51f9('0x10'),JSON[_0x51f9('0x11')](_0x58dec2));if(_0x58dec2[_0x51f9('0x12')]){if(_0x58dec2[_0x51f9('0x12')][_0x51f9('0x13')]===0x1f4){logger[_0x51f9('0x12')](_0x51f9('0xd'),_0x34b254,_0x58dec2['error']['message']);return _0xcf23e1(_0x58dec2[_0x51f9('0x12')][_0x51f9('0x14')]);}logger[_0x51f9('0x12')](_0x51f9('0xd'),_0x34b254,_0x58dec2[_0x51f9('0x12')][_0x51f9('0x14')]);return _0x5ae323(_0x58dec2['error'][_0x51f9('0x14')]);}else{logger[_0x51f9('0xc')](_0x51f9('0xd'),_0x34b254,_0x51f9('0x10'));_0x5ae323(_0x58dec2[_0x51f9('0x15')][_0x51f9('0x14')]);}})[_0x51f9('0x16')](function(_0x204e26){logger[_0x51f9('0x12')](_0x51f9('0xd'),_0x34b254,_0x204e26);_0xcf23e1(_0x204e26);});});} \ No newline at end of file +var _0x5bf2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5d5100,_0x40a375){var _0x3ea212=function(_0x16baf4){while(--_0x16baf4){_0x5d5100['push'](_0x5d5100['shift']());}};_0x3ea212(++_0x40a375);}(_0x5bf2,0x1f3));var _0x25bf=function(_0x40f321,_0x3ecb2b){_0x40f321=_0x40f321-0x0;var _0xc72793=_0x5bf2[_0x40f321];return _0xc72793;};'use strict';var _=require(_0x25bf('0x0'));var util=require(_0x25bf('0x1'));var moment=require(_0x25bf('0x2'));var BPromise=require(_0x25bf('0x3'));var rs=require(_0x25bf('0x4'));var fs=require('fs');var Redis=require(_0x25bf('0x5'));var db=require(_0x25bf('0x6'))['db'];var utils=require(_0x25bf('0x7'));var logger=require(_0x25bf('0x8'))(_0x25bf('0x9'));var config=require(_0x25bf('0xa'));var jayson=require(_0x25bf('0xb'));var client=jayson['client'][_0x25bf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa90862,_0x51fe15,_0x322220){return new BPromise(function(_0x49c734,_0x400b04){return client['request'](_0xa90862,_0x322220)['then'](function(_0x4ee7f2){logger[_0x25bf('0xd')](_0x25bf('0xe'),_0x51fe15,_0x25bf('0xf'));logger[_0x25bf('0x10')](_0x25bf('0x11'),_0x51fe15,_0x25bf('0xf'),JSON[_0x25bf('0x12')](_0x4ee7f2));if(_0x4ee7f2[_0x25bf('0x13')]){if(_0x4ee7f2['error'][_0x25bf('0x14')]===0x1f4){logger[_0x25bf('0x13')](_0x25bf('0xe'),_0x51fe15,_0x4ee7f2['error'][_0x25bf('0x15')]);return _0x400b04(_0x4ee7f2['error']['message']);}logger['error'](_0x25bf('0xe'),_0x51fe15,_0x4ee7f2[_0x25bf('0x13')][_0x25bf('0x15')]);return _0x49c734(_0x4ee7f2[_0x25bf('0x13')][_0x25bf('0x15')]);}else{logger[_0x25bf('0xd')](_0x25bf('0xe'),_0x51fe15,_0x25bf('0xf'));_0x49c734(_0x4ee7f2[_0x25bf('0x16')][_0x25bf('0x15')]);}})['catch'](function(_0x2d59f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x51fe15,_0x2d59f4);_0x400b04(_0x2d59f4);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index aee6250..21fcc87 100644 --- a/server/api/memberReport/index.js +++ b/server/api/memberReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98d6=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util'];(function(_0x1f4e6d,_0x1ab8a2){var _0x355a1d=function(_0x4f1569){while(--_0x4f1569){_0x1f4e6d['push'](_0x1f4e6d['shift']());}};_0x355a1d(++_0x1ab8a2);}(_0x98d6,0x10f));var _0x698d=function(_0x4c4795,_0xedc01c){_0x4c4795=_0x4c4795-0x0;var _0x1e32b1=_0x98d6[_0x4c4795];return _0x1e32b1;};'use strict';var multer=require(_0x698d('0x0'));var util=require(_0x698d('0x1'));var path=require(_0x698d('0x2'));var timeout=require(_0x698d('0x3'));var express=require(_0x698d('0x4'));var router=express['Router']();var fs_extra=require(_0x698d('0x5'));var auth=require(_0x698d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x698d('0x7'));var controller=require(_0x698d('0x8'));router['get']('/',auth[_0x698d('0x9')](),controller[_0x698d('0xa')]);router[_0x698d('0xb')](_0x698d('0xc'),auth[_0x698d('0x9')](),controller[_0x698d('0xd')]);router[_0x698d('0xb')](_0x698d('0xe'),auth[_0x698d('0x9')](),controller['show']);router[_0x698d('0xf')]('/',auth['isAuthenticated'](),controller[_0x698d('0x10')]);router[_0x698d('0x11')](_0x698d('0xe'),auth[_0x698d('0x9')](),controller[_0x698d('0x12')]);router[_0x698d('0x13')](_0x698d('0xe'),auth[_0x698d('0x9')](),controller[_0x698d('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd3cb=['index','/describe','describe','/:id','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated'];(function(_0x1189a1,_0x2d9466){var _0x248890=function(_0x43e63d){while(--_0x43e63d){_0x1189a1['push'](_0x1189a1['shift']());}};_0x248890(++_0x2d9466);}(_0xd3cb,0x11a));var _0xbd3c=function(_0x4c5743,_0x3fd3ff){_0x4c5743=_0x4c5743-0x0;var _0x1cdffb=_0xd3cb[_0x4c5743];return _0x1cdffb;};'use strict';var multer=require(_0xbd3c('0x0'));var util=require(_0xbd3c('0x1'));var path=require(_0xbd3c('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd3c('0x3'));var router=express[_0xbd3c('0x4')]();var fs_extra=require(_0xbd3c('0x5'));var auth=require(_0xbd3c('0x6'));var interaction=require(_0xbd3c('0x7'));var config=require(_0xbd3c('0x8'));var controller=require(_0xbd3c('0x9'));router[_0xbd3c('0xa')]('/',auth[_0xbd3c('0xb')](),controller[_0xbd3c('0xc')]);router[_0xbd3c('0xa')](_0xbd3c('0xd'),auth[_0xbd3c('0xb')](),controller[_0xbd3c('0xe')]);router[_0xbd3c('0xa')](_0xbd3c('0xf'),auth[_0xbd3c('0xb')](),controller['show']);router[_0xbd3c('0x10')]('/',auth[_0xbd3c('0xb')](),controller[_0xbd3c('0x11')]);router[_0xbd3c('0x12')](_0xbd3c('0xf'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xbd3c('0xb')](),controller[_0xbd3c('0x13')]);module[_0xbd3c('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 4eeb205..04ba6d1 100644 --- a/server/api/memberReport/memberReport.attributes.js +++ b/server/api/memberReport/memberReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd79=['moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbd79,0x17f));var _0x9bd7=function(_0x510e69,_0x13e19d){_0x510e69=_0x510e69-0x0;var _0x1e1226=_0xbd79[_0x510e69];return _0x1e1226;};'use strict';var Sequelize=require(_0x9bd7('0x0'));var moment=require(_0x9bd7('0x1'));module[_0x9bd7('0x2')]={'channel':{'type':Sequelize[_0x9bd7('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9bd7('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x9bd7('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x9bd7('0x5')]},'exitAt':{'type':Sequelize[_0x9bd7('0x5')],'set':function(_0x52cc09){var _0x2833de=moment(_0x52cc09);var _0x47871f=moment(this[_0x9bd7('0x6')]('enterAt'));var _0x4919fc=_0x2833de['diff'](_0x47871f,_0x9bd7('0x7'));this[_0x9bd7('0x8')](_0x9bd7('0x9'),_0x52cc09);this[_0x9bd7('0x8')](_0x9bd7('0xa'),_0x4919fc>=0x0?_0x4919fc:null);}},'data1':{'type':Sequelize[_0x9bd7('0x3')],'comment':_0x9bd7('0xb')},'data2':{'type':Sequelize[_0x9bd7('0x3')],'comment':_0x9bd7('0xc')},'data3':{'type':Sequelize[_0x9bd7('0x3')],'comment':_0x9bd7('0xd')},'data4':{'type':Sequelize[_0x9bd7('0x3')],'comment':_0x9bd7('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0x9bd7('0xf')},'role':{'type':Sequelize[_0x9bd7('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9bd7('0x3')]}}; \ No newline at end of file +var _0x9da0=['talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x2ffd69,_0x5d94e){var _0x1be9ae=function(_0x1371c7){while(--_0x1371c7){_0x2ffd69['push'](_0x2ffd69['shift']());}};_0x1be9ae(++_0x5d94e);}(_0x9da0,0x1f1));var _0x09da=function(_0x1beccf,_0x363c1a){_0x1beccf=_0x1beccf-0x0;var _0x688d70=_0x9da0[_0x1beccf];return _0x688d70;};'use strict';var Sequelize=require(_0x09da('0x0'));var moment=require(_0x09da('0x1'));module[_0x09da('0x2')]={'channel':{'type':Sequelize[_0x09da('0x3')]},'membername':{'type':Sequelize[_0x09da('0x3')]},'interface':{'type':Sequelize[_0x09da('0x3')]},'type':{'type':Sequelize[_0x09da('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x09da('0x4')},'duration':{'type':Sequelize[_0x09da('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x09da('0x6')],'set':function(_0x17ccf4){var _0x57b8ee=moment(_0x17ccf4);var _0x14b51e=moment(this['getDataValue']('enterAt'));var _0x1ef1b2=_0x57b8ee['diff'](_0x14b51e,_0x09da('0x7'));this[_0x09da('0x8')]('exitAt',_0x17ccf4);this[_0x09da('0x8')](_0x09da('0x9'),_0x1ef1b2>=0x0?_0x1ef1b2:null);}},'data1':{'type':Sequelize[_0x09da('0x3')],'comment':_0x09da('0xa')},'data2':{'type':Sequelize[_0x09da('0x3')],'comment':_0x09da('0xb')},'data3':{'type':Sequelize[_0x09da('0x3')],'comment':_0x09da('0xc')},'data4':{'type':Sequelize[_0x09da('0x3')],'comment':_0x09da('0xd')},'data5':{'type':Sequelize[_0x09da('0x3')],'comment':_0x09da('0xe')},'role':{'type':Sequelize[_0x09da('0x3')]},'internal':{'type':Sequelize[_0x09da('0x5')]},'uniqueid':{'type':Sequelize[_0x09da('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index db4bb1a..8a5154f 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x359ad6,_0x55bb28){var _0x3fa06d=function(_0x47d58e){while(--_0x47d58e){_0x359ad6['push'](_0x359ad6['shift']());}};_0x3fa06d(++_0x55bb28);}(_0x008c,0x188));var _0xc008=function(_0x586319,_0xf3ac9a){_0x586319=_0x586319-0x0;var _0x2127d2=_0x008c[_0x586319];return _0x2127d2;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x22de09,_0x3db597){var _0x4a13dc=function(_0x2b02eb){while(--_0x2b02eb){_0x22de09['push'](_0x22de09['shift']());}};_0x4a13dc(++_0x3db597);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index da08c93..1956cd5 100644 --- a/server/api/memberReport/memberReport.model.js +++ b/server/api/memberReport/memberReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa25a=['membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member'];(function(_0x51effc,_0x258813){var _0x496ae5=function(_0x590863){while(--_0x590863){_0x51effc['push'](_0x51effc['shift']());}};_0x496ae5(++_0x258813);}(_0xa25a,0x133));var _0xaa25=function(_0x45cb97,_0x2aedc4){_0x45cb97=_0x45cb97-0x0;var _0x65fa86=_0xa25a[_0x45cb97];return _0x65fa86;};'use strict';var _=require(_0xaa25('0x0'));var util=require(_0xaa25('0x1'));var logger=require(_0xaa25('0x2'))(_0xaa25('0x3'));var moment=require('moment');var BPromise=require(_0xaa25('0x4'));var rp=require(_0xaa25('0x5'));var fs=require('fs');var path=require(_0xaa25('0x6'));var rimraf=require(_0xaa25('0x7'));var config=require(_0xaa25('0x8'));var attributes=require(_0xaa25('0x9'));module[_0xaa25('0xa')]=function(_0x2e8785,_0x20562b){return _0x2e8785[_0xaa25('0xb')]('MemberReport',attributes,{'tableName':_0xaa25('0xc'),'paranoid':![],'indexes':[{'name':_0xaa25('0xd'),'fields':[_0xaa25('0xe'),_0xaa25('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8cb=['membername','interface','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface'];(function(_0x71defb,_0x229141){var _0x109c53=function(_0x3ffc17){while(--_0x3ffc17){_0x71defb['push'](_0x71defb['shift']());}};_0x109c53(++_0x229141);}(_0xa8cb,0x1de));var _0xba8c=function(_0x4bce1c,_0x1dd853){_0x4bce1c=_0x4bce1c-0x0;var _0x2f517f=_0xa8cb[_0x4bce1c];return _0x2f517f;};'use strict';var _=require(_0xba8c('0x0'));var util=require(_0xba8c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xba8c('0x2'));var BPromise=require(_0xba8c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba8c('0x4'));var rimraf=require(_0xba8c('0x5'));var config=require(_0xba8c('0x6'));var attributes=require(_0xba8c('0x7'));module[_0xba8c('0x8')]=function(_0x5d82bb,_0x2a713f){return _0x5d82bb['define'](_0xba8c('0x9'),attributes,{'tableName':_0xba8c('0xa'),'paranoid':![],'indexes':[{'name':_0xba8c('0xb'),'fields':[_0xba8c('0xc'),_0xba8c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f34c58c..80b67a3 100644 --- a/server/api/memberReport/memberReport.rpc.js +++ b/server/api/memberReport/memberReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbfa=['model','map','GetMemberReport','create','CreateMemberReport','UpdateMemberReport','update','body','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','MemberReport','findAll','options','raw','where','attributes','limit','include'];(function(_0x5f41de,_0x1d3e30){var _0x12cbf7=function(_0x499a00){while(--_0x499a00){_0x5f41de['push'](_0x5f41de['shift']());}};_0x12cbf7(++_0x1d3e30);}(_0xdbfa,0x128));var _0xadbf=function(_0x111cc5,_0x50d807){_0x111cc5=_0x111cc5-0x0;var _0x485464=_0xdbfa[_0x111cc5];return _0x485464;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xadbf('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadbf('0x1'));var db=require(_0xadbf('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xadbf('0x3'))(_0xadbf('0x4'));var config=require(_0xadbf('0x5'));var jayson=require(_0xadbf('0x6'));var client=jayson[_0xadbf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1204f4,_0x30f643,_0x16704e){return new BPromise(function(_0x2bbd13,_0x4daabe){return client[_0xadbf('0x8')](_0x1204f4,_0x16704e)[_0xadbf('0x9')](function(_0x39e467){logger['info'](_0xadbf('0xa'),_0x30f643,_0xadbf('0xb'));logger[_0xadbf('0xc')](_0xadbf('0xd'),_0x30f643,_0xadbf('0xb'),JSON[_0xadbf('0xe')](_0x39e467));if(_0x39e467[_0xadbf('0xf')]){if(_0x39e467[_0xadbf('0xf')]['code']===0x1f4){logger[_0xadbf('0xf')](_0xadbf('0xa'),_0x30f643,_0x39e467['error'][_0xadbf('0x10')]);return _0x4daabe(_0x39e467[_0xadbf('0xf')]['message']);}logger['error'](_0xadbf('0xa'),_0x30f643,_0x39e467['error'][_0xadbf('0x10')]);return _0x2bbd13(_0x39e467[_0xadbf('0xf')][_0xadbf('0x10')]);}else{logger[_0xadbf('0x11')](_0xadbf('0xa'),_0x30f643,_0xadbf('0xb'));_0x2bbd13(_0x39e467[_0xadbf('0x12')][_0xadbf('0x10')]);}})[_0xadbf('0x13')](function(_0x59712){logger[_0xadbf('0xf')](_0xadbf('0xa'),_0x30f643,_0x59712);_0x4daabe(_0x59712);});});}exports['GetMemberReport']=function(_0x1b8639){var _0x353028=this;return new Promise(function(_0x38e3f2,_0x3585e0){return db[_0xadbf('0x14')][_0xadbf('0x15')]({'raw':_0x1b8639['options']?_0x1b8639[_0xadbf('0x16')][_0xadbf('0x17')]===undefined?!![]:![]:!![],'where':_0x1b8639[_0xadbf('0x16')]?_0x1b8639[_0xadbf('0x16')][_0xadbf('0x18')]||null:null,'attributes':_0x1b8639[_0xadbf('0x16')]?_0x1b8639[_0xadbf('0x16')][_0xadbf('0x19')]||null:null,'limit':_0x1b8639[_0xadbf('0x16')]?_0x1b8639['options'][_0xadbf('0x1a')]||null:null,'include':_0x1b8639[_0xadbf('0x16')]?_0x1b8639[_0xadbf('0x16')][_0xadbf('0x1b')]?_['map'](_0x1b8639[_0xadbf('0x16')][_0xadbf('0x1b')],function(_0x1d49c6){return{'model':db[_0x1d49c6[_0xadbf('0x1c')]],'as':_0x1d49c6['as'],'attributes':_0x1d49c6[_0xadbf('0x19')],'include':_0x1d49c6['include']?_['map'](_0x1d49c6['include'],function(_0x52da57){return{'model':db[_0x52da57[_0xadbf('0x1c')]],'as':_0x52da57['as'],'attributes':_0x52da57[_0xadbf('0x19')],'include':_0x52da57[_0xadbf('0x1b')]?_[_0xadbf('0x1d')](_0x52da57[_0xadbf('0x1b')],function(_0x5a17e7){return{'model':db[_0x5a17e7[_0xadbf('0x1c')]],'as':_0x5a17e7['as'],'attributes':_0x5a17e7[_0xadbf('0x19')]};}):[]};}):[]};}):[]:[]})[_0xadbf('0x9')](function(_0x4c0a5b){logger[_0xadbf('0x11')](_0xadbf('0x1e'),_0x1b8639);logger[_0xadbf('0xc')](_0xadbf('0x1e'),_0x1b8639,JSON[_0xadbf('0xe')](_0x4c0a5b));_0x38e3f2(_0x4c0a5b);})[_0xadbf('0x13')](function(_0x35d8ba){logger['error']('GetMemberReport',_0x35d8ba[_0xadbf('0x10')],_0x1b8639);_0x3585e0(_0x353028[_0xadbf('0xf')](0x1f4,_0x35d8ba[_0xadbf('0x10')]));});});};exports['CreateMemberReport']=function(_0xf422d6){var _0x41fdb6=this;return new Promise(function(_0x2555b0,_0x5f27bc){return db[_0xadbf('0x14')][_0xadbf('0x1f')](_0xf422d6['body'],{'raw':_0xf422d6[_0xadbf('0x16')]?_0xf422d6[_0xadbf('0x16')][_0xadbf('0x17')]===undefined?!![]:![]:!![]})[_0xadbf('0x9')](function(_0x1a54f8){logger[_0xadbf('0x11')](_0xadbf('0x20'),_0xf422d6);logger[_0xadbf('0xc')](_0xadbf('0x20'),_0xf422d6,JSON[_0xadbf('0xe')](_0x1a54f8));_0x2555b0(_0x1a54f8);})[_0xadbf('0x13')](function(_0x20f8ce){logger[_0xadbf('0xf')]('CreateMemberReport',_0x20f8ce[_0xadbf('0x10')],_0xf422d6);_0x5f27bc(_0x41fdb6['error'](0x1f4,_0x20f8ce[_0xadbf('0x10')]));});});};exports[_0xadbf('0x21')]=function(_0x1fe146){var _0x11cedb=this;return new Promise(function(_0x1ff22c,_0x13d400){return db[_0xadbf('0x14')][_0xadbf('0x22')](_0x1fe146[_0xadbf('0x23')],{'raw':_0x1fe146[_0xadbf('0x16')]?_0x1fe146[_0xadbf('0x16')][_0xadbf('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fe146['options']?_0x1fe146[_0xadbf('0x16')][_0xadbf('0x18')]||null:null,'attributes':_0x1fe146[_0xadbf('0x16')]?_0x1fe146[_0xadbf('0x16')][_0xadbf('0x19')]||null:null,'limit':_0x1fe146['options']?_0x1fe146[_0xadbf('0x16')][_0xadbf('0x1a')]||null:null})[_0xadbf('0x9')](function(_0x3ac4c8){logger[_0xadbf('0x11')](_0xadbf('0x21'),_0x1fe146);logger[_0xadbf('0xc')](_0xadbf('0x21'),_0x1fe146,JSON[_0xadbf('0xe')](_0x3ac4c8));_0x1ff22c(_0x3ac4c8);})[_0xadbf('0x13')](function(_0x4c400b){logger['error']('UpdateMemberReport',_0x4c400b['message'],_0x1fe146);_0x13d400(_0x11cedb[_0xadbf('0xf')](0x1f4,_0x4c400b['message']));});});}; \ No newline at end of file +var _0x2f4a=['MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','MemberReport','options','where','attributes','limit','include','model','map','GetMemberReport','catch','create','body','then','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x2f4a,0x8f));var _0xa2f4=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x2f4a[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xa2f4('0x0'));var util=require(_0xa2f4('0x1'));var moment=require(_0xa2f4('0x2'));var BPromise=require(_0xa2f4('0x3'));var rs=require(_0xa2f4('0x4'));var fs=require('fs');var Redis=require(_0xa2f4('0x5'));var db=require(_0xa2f4('0x6'))['db'];var utils=require(_0xa2f4('0x7'));var logger=require(_0xa2f4('0x8'))(_0xa2f4('0x9'));var config=require('../../config/environment');var jayson=require(_0xa2f4('0xa'));var client=jayson[_0xa2f4('0xb')][_0xa2f4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x151045,_0x2cd086,_0x194ee8){return new BPromise(function(_0x582a36,_0x2a79d5){return client['request'](_0x151045,_0x194ee8)['then'](function(_0x53e687){logger['info'](_0xa2f4('0xd'),_0x2cd086,_0xa2f4('0xe'));logger[_0xa2f4('0xf')](_0xa2f4('0x10'),_0x2cd086,'request\x20sent',JSON[_0xa2f4('0x11')](_0x53e687));if(_0x53e687['error']){if(_0x53e687[_0xa2f4('0x12')][_0xa2f4('0x13')]===0x1f4){logger['error'](_0xa2f4('0xd'),_0x2cd086,_0x53e687['error'][_0xa2f4('0x14')]);return _0x2a79d5(_0x53e687['error'][_0xa2f4('0x14')]);}logger['error'](_0xa2f4('0xd'),_0x2cd086,_0x53e687[_0xa2f4('0x12')][_0xa2f4('0x14')]);return _0x582a36(_0x53e687[_0xa2f4('0x12')][_0xa2f4('0x14')]);}else{logger[_0xa2f4('0x15')]('MemberReport,\x20%s,\x20%s',_0x2cd086,_0xa2f4('0xe'));_0x582a36(_0x53e687[_0xa2f4('0x16')]['message']);}})['catch'](function(_0x68fe57){logger[_0xa2f4('0x12')](_0xa2f4('0xd'),_0x2cd086,_0x68fe57);_0x2a79d5(_0x68fe57);});});}exports['GetMemberReport']=function(_0x540d43){var _0x47ea46=this;return new Promise(function(_0x5a0aa3,_0x35e356){return db[_0xa2f4('0x17')]['findAll']({'raw':_0x540d43[_0xa2f4('0x18')]?_0x540d43[_0xa2f4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x540d43[_0xa2f4('0x18')]?_0x540d43[_0xa2f4('0x18')][_0xa2f4('0x19')]||null:null,'attributes':_0x540d43[_0xa2f4('0x18')]?_0x540d43[_0xa2f4('0x18')][_0xa2f4('0x1a')]||null:null,'limit':_0x540d43[_0xa2f4('0x18')]?_0x540d43[_0xa2f4('0x18')][_0xa2f4('0x1b')]||null:null,'include':_0x540d43[_0xa2f4('0x18')]?_0x540d43['options'][_0xa2f4('0x1c')]?_['map'](_0x540d43[_0xa2f4('0x18')]['include'],function(_0x192707){return{'model':db[_0x192707[_0xa2f4('0x1d')]],'as':_0x192707['as'],'attributes':_0x192707[_0xa2f4('0x1a')],'include':_0x192707[_0xa2f4('0x1c')]?_['map'](_0x192707[_0xa2f4('0x1c')],function(_0x5770af){return{'model':db[_0x5770af[_0xa2f4('0x1d')]],'as':_0x5770af['as'],'attributes':_0x5770af[_0xa2f4('0x1a')],'include':_0x5770af['include']?_[_0xa2f4('0x1e')](_0x5770af[_0xa2f4('0x1c')],function(_0x25c907){return{'model':db[_0x25c907[_0xa2f4('0x1d')]],'as':_0x25c907['as'],'attributes':_0x25c907[_0xa2f4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c36a9){logger[_0xa2f4('0x15')](_0xa2f4('0x1f'),_0x540d43);logger[_0xa2f4('0xf')](_0xa2f4('0x1f'),_0x540d43,JSON[_0xa2f4('0x11')](_0x2c36a9));_0x5a0aa3(_0x2c36a9);})[_0xa2f4('0x20')](function(_0xf4217d){logger[_0xa2f4('0x12')](_0xa2f4('0x1f'),_0xf4217d[_0xa2f4('0x14')],_0x540d43);_0x35e356(_0x47ea46[_0xa2f4('0x12')](0x1f4,_0xf4217d[_0xa2f4('0x14')]));});});};exports['CreateMemberReport']=function(_0x2ca758){var _0x4bfd92=this;return new Promise(function(_0x12ed15,_0x249485){return db[_0xa2f4('0x17')][_0xa2f4('0x21')](_0x2ca758[_0xa2f4('0x22')],{'raw':_0x2ca758[_0xa2f4('0x18')]?_0x2ca758[_0xa2f4('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xa2f4('0x23')](function(_0x218795){logger[_0xa2f4('0x15')]('CreateMemberReport',_0x2ca758);logger['debug'](_0xa2f4('0x24'),_0x2ca758,JSON[_0xa2f4('0x11')](_0x218795));_0x12ed15(_0x218795);})[_0xa2f4('0x20')](function(_0x392b62){logger['error'](_0xa2f4('0x24'),_0x392b62['message'],_0x2ca758);_0x249485(_0x4bfd92[_0xa2f4('0x12')](0x1f4,_0x392b62[_0xa2f4('0x14')]));});});};exports[_0xa2f4('0x25')]=function(_0x21342e){var _0x44e5bc=this;return new Promise(function(_0x241d7c,_0x1e4aae){return db[_0xa2f4('0x17')][_0xa2f4('0x26')](_0x21342e[_0xa2f4('0x22')],{'raw':_0x21342e[_0xa2f4('0x18')]?_0x21342e[_0xa2f4('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21342e[_0xa2f4('0x18')]?_0x21342e['options'][_0xa2f4('0x19')]||null:null,'attributes':_0x21342e[_0xa2f4('0x18')]?_0x21342e[_0xa2f4('0x18')][_0xa2f4('0x1a')]||null:null,'limit':_0x21342e[_0xa2f4('0x18')]?_0x21342e[_0xa2f4('0x18')][_0xa2f4('0x1b')]||null:null})[_0xa2f4('0x23')](function(_0x573932){logger['info'](_0xa2f4('0x25'),_0x21342e);logger[_0xa2f4('0xf')](_0xa2f4('0x25'),_0x21342e,JSON[_0xa2f4('0x11')](_0x573932));_0x241d7c(_0x573932);})[_0xa2f4('0x20')](function(_0x20a003){logger[_0xa2f4('0x12')](_0xa2f4('0x25'),_0x20a003[_0xa2f4('0x14')],_0x21342e);_0x1e4aae(_0x44e5bc[_0xa2f4('0x12')](0x1f4,_0x20a003[_0xa2f4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e297568..576b583 100644 --- a/server/api/migration/index.js +++ b/server/api/migration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0845=['./migration.controller','get','index','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x0845,0x125));var _0x5084=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x0845[_0x265aa2];return _0x447a3a;};'use strict';var multer=require(_0x5084('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5084('0x1'));var express=require(_0x5084('0x2'));var router=express[_0x5084('0x3')]();var fs_extra=require(_0x5084('0x4'));var auth=require(_0x5084('0x5'));var interaction=require(_0x5084('0x6'));var config=require('../../config/environment');var controller=require(_0x5084('0x7'));router[_0x5084('0x8')]('/',controller[_0x5084('0x9')]);module['exports']=router; \ No newline at end of file +var _0xb4b5=['../../components/interaction/service','./migration.controller','index','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb4b5,0x159));var _0x5b4b=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0xb4b5[_0x1f1a97];return _0x29fc6a;};'use strict';var multer=require(_0x5b4b('0x0'));var util=require(_0x5b4b('0x1'));var path=require(_0x5b4b('0x2'));var timeout=require(_0x5b4b('0x3'));var express=require(_0x5b4b('0x4'));var router=express['Router']();var fs_extra=require(_0x5b4b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5b4b('0x6'));var config=require('../../config/environment');var controller=require(_0x5b4b('0x7'));router['get']('/',controller[_0x5b4b('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 2eca1b4..f905ba3 100644 --- a/server/api/migration/migration.attributes.js +++ b/server/api/migration/migration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x696d=['sequelize','STRING','version'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x696d,0x1e6));var _0xd696=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x696d[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0xd696('0x0'));module['exports']={'version':{'type':Sequelize[_0xd696('0x1')],'unique':_0xd696('0x2')}}; \ No newline at end of file +var _0xb433=['version','exports'];(function(_0x20e171,_0x37aa03){var _0x447219=function(_0xd5d07e){while(--_0xd5d07e){_0x20e171['push'](_0x20e171['shift']());}};_0x447219(++_0x37aa03);}(_0xb433,0x1db));var _0x3b43=function(_0x594dc7,_0x269225){_0x594dc7=_0x594dc7-0x0;var _0x2e287d=_0xb433[_0x594dc7];return _0x2e287d;};'use strict';var Sequelize=require('sequelize');module[_0x3b43('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x3b43('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 808b8d3..cbb7ffd 100644 --- a/server/api/migration/migration.controller.js +++ b/server/api/migration/migration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed3e=['sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','then','includeAll','include','Migration','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util'];(function(_0x477165,_0x48f04c){var _0x3e02dd=function(_0x5d1e21){while(--_0x5d1e21){_0x477165['push'](_0x477165['shift']());}};_0x3e02dd(++_0x48f04c);}(_0xed3e,0x17b));var _0xeed3=function(_0x20d889,_0x31d46e){_0x20d889=_0x20d889-0x0;var _0x1cd7d2=_0xed3e[_0x20d889];return _0x1cd7d2;};'use strict';var emlformat=require(_0xeed3('0x0'));var rimraf=require(_0xeed3('0x1'));var zipdir=require(_0xeed3('0x2'));var jsonpatch=require(_0xeed3('0x3'));var rp=require(_0xeed3('0x4'));var moment=require(_0xeed3('0x5'));var BPromise=require(_0xeed3('0x6'));var Mustache=require(_0xeed3('0x7'));var util=require(_0xeed3('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeed3('0x9'));var ejs=require(_0xeed3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeed3('0xb'));var squel=require('squel');var crypto=require(_0xeed3('0xc'));var jsforce=require(_0xeed3('0xd'));var deskjs=require(_0xeed3('0xe'));var toCsv=require(_0xeed3('0x9'));var querystring=require(_0xeed3('0xf'));var Papa=require(_0xeed3('0x10'));var Redis=require('ioredis');var authService=require(_0xeed3('0x11'));var qs=require(_0xeed3('0x12'));var as=require(_0xeed3('0x13'));var hardwareService=require(_0xeed3('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xeed3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeed3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fcf7d,_0x238a7c){_0x238a7c=_0x238a7c||0xcc;return function(_0x1298f4){if(_0x1298f4){return _0x2fcf7d[_0xeed3('0x17')](_0x238a7c);}return _0x2fcf7d[_0xeed3('0x18')](_0x238a7c)[_0xeed3('0x19')]();};}function respondWithResult(_0x1c45ae,_0x15ed4b){_0x15ed4b=_0x15ed4b||0xc8;return function(_0x9c9d05){if(_0x9c9d05){return _0x1c45ae['status'](_0x15ed4b)[_0xeed3('0x1a')](_0x9c9d05);}};}function respondWithFilteredResult(_0x46036a,_0x2caa54){return function(_0x2d5967){if(_0x2d5967){var _0x348bd1=typeof _0x2caa54[_0xeed3('0x1b')]==='undefined'&&typeof _0x2caa54[_0xeed3('0x1c')]===_0xeed3('0x1d');var _0x150183=_0x2d5967[_0xeed3('0x1e')];var _0x5f1058=_0x348bd1?0x0:_0x2caa54[_0xeed3('0x1b')];var _0x4f0781=_0x348bd1?_0x2d5967[_0xeed3('0x1e')]:_0x2caa54['offset']+_0x2caa54[_0xeed3('0x1c')];var _0x3fc1ac;if(_0x4f0781>=_0x150183){_0x4f0781=_0x150183;_0x3fc1ac=0xc8;}else{_0x3fc1ac=0xce;}_0x46036a[_0xeed3('0x18')](_0x3fc1ac);return _0x46036a['set'](_0xeed3('0x1f'),_0x5f1058+'-'+_0x4f0781+'/'+_0x150183)[_0xeed3('0x1a')](_0x2d5967);}return null;};}function patchUpdates(_0x598d9f){return function(_0x226c21){try{jsonpatch[_0xeed3('0x20')](_0x226c21,_0x598d9f,!![]);}catch(_0x5449fc){return BPromise[_0xeed3('0x21')](_0x5449fc);}return _0x226c21[_0xeed3('0x22')]();};}function saveUpdates(_0x55ecf9,_0x4272d4){return function(_0x458f7d){if(_0x458f7d){return _0x458f7d[_0xeed3('0x23')](_0x55ecf9)['then'](function(_0x53e958){return _0x53e958;});}return null;};}function removeEntity(_0x1c4c35,_0x22c543){return function(_0x3e9660){if(_0x3e9660){return _0x3e9660[_0xeed3('0x24')]()['then'](function(){_0x1c4c35[_0xeed3('0x18')](0xcc)[_0xeed3('0x19')]();});}};}function handleEntityNotFound(_0x403dff,_0x4300a2){return function(_0x248d99){if(!_0x248d99){_0x403dff[_0xeed3('0x17')](0x194);}return _0x248d99;};}function handleError(_0x1a1119,_0x31e3e8){_0x31e3e8=_0x31e3e8||0x1f4;return function(_0x4b7360){logger['error'](_0x4b7360[_0xeed3('0x25')]);if(_0x4b7360[_0xeed3('0x26')]){delete _0x4b7360[_0xeed3('0x26')];}_0x1a1119['status'](_0x31e3e8)[_0xeed3('0x27')](_0x4b7360);};}exports[_0xeed3('0x28')]=function(_0x4338d6,_0x53309d){var _0x1bef80={},_0x4008b2={},_0x5ae4c3={'count':0x0,'rows':[]};var _0x58e91b=_[_0xeed3('0x29')](db['Migration'][_0xeed3('0x2a')],function(_0x36ee03){return{'name':_0x36ee03[_0xeed3('0x2b')],'type':_0x36ee03[_0xeed3('0x2c')]['key']};});_0x4008b2['model']=_[_0xeed3('0x29')](_0x58e91b,_0xeed3('0x26'));_0x4008b2['query']=_[_0xeed3('0x2d')](_0x4338d6['query']);_0x4008b2['filters']=_[_0xeed3('0x2e')](_0x4008b2[_0xeed3('0x2f')],_0x4008b2[_0xeed3('0x30')]);_0x1bef80[_0xeed3('0x31')]=_['intersection'](_0x4008b2['model'],qs[_0xeed3('0x32')](_0x4338d6[_0xeed3('0x30')][_0xeed3('0x32')]));_0x1bef80[_0xeed3('0x31')]=_0x1bef80['attributes'][_0xeed3('0x33')]?_0x1bef80['attributes']:_0x4008b2[_0xeed3('0x2f')];if(!_0x4338d6[_0xeed3('0x30')][_0xeed3('0x34')](_0xeed3('0x35'))){_0x1bef80[_0xeed3('0x1c')]=qs[_0xeed3('0x1c')](_0x4338d6['query'][_0xeed3('0x1c')]);_0x1bef80['offset']=qs[_0xeed3('0x1b')](_0x4338d6[_0xeed3('0x30')]['offset']);}_0x1bef80[_0xeed3('0x36')]=qs[_0xeed3('0x37')](_0x4338d6[_0xeed3('0x30')]['sort']);_0x1bef80[_0xeed3('0x38')]=qs['filters'](_[_0xeed3('0x39')](_0x4338d6[_0xeed3('0x30')],_0x4008b2[_0xeed3('0x3a')]),_0x58e91b);if(_0x4338d6['query'][_0xeed3('0x3b')]){_0x1bef80[_0xeed3('0x38')]=_[_0xeed3('0x3c')](_0x1bef80[_0xeed3('0x38')],{'$or':_[_0xeed3('0x29')](_0x58e91b,function(_0x52796f){if(_0x52796f[_0xeed3('0x2c')]!=='VIRTUAL'){var _0x581a90={};_0x581a90[_0x52796f[_0xeed3('0x26')]]={'$like':'%'+_0x4338d6[_0xeed3('0x30')][_0xeed3('0x3b')]+'%'};return _0x581a90;}})});}_0x1bef80=_['merge']({},_0x1bef80,_0x4338d6['options']);var _0x1a5fc7={'where':_0x1bef80[_0xeed3('0x38')]};return db['Migration'][_0xeed3('0x1e')](_0x1a5fc7)[_0xeed3('0x3d')](function(_0x193a34){_0x5ae4c3[_0xeed3('0x1e')]=_0x193a34;if(_0x4338d6[_0xeed3('0x30')][_0xeed3('0x3e')]){_0x1bef80[_0xeed3('0x3f')]=[{'all':!![]}];}return db[_0xeed3('0x40')][_0xeed3('0x41')](_0x1bef80);})['then'](function(_0x4f3842){_0x5ae4c3['rows']=_0x4f3842;return _0x5ae4c3;})['then'](respondWithFilteredResult(_0x53309d,_0x1bef80))[_0xeed3('0x42')](handleError(_0x53309d,null));}; \ No newline at end of file +var _0xaa71=['send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','include','Migration','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa71,0x65));var _0x1aa7=function(_0x59273c,_0x27ed56){_0x59273c=_0x59273c-0x0;var _0x55dd5c=_0xaa71[_0x59273c];return _0x55dd5c;};'use strict';var emlformat=require(_0x1aa7('0x0'));var rimraf=require(_0x1aa7('0x1'));var zipdir=require(_0x1aa7('0x2'));var jsonpatch=require(_0x1aa7('0x3'));var rp=require(_0x1aa7('0x4'));var moment=require(_0x1aa7('0x5'));var BPromise=require(_0x1aa7('0x6'));var Mustache=require('mustache');var util=require(_0x1aa7('0x7'));var path=require(_0x1aa7('0x8'));var sox=require(_0x1aa7('0x9'));var csv=require(_0x1aa7('0xa'));var ejs=require(_0x1aa7('0xb'));var fs=require('fs');var fs_extra=require(_0x1aa7('0xc'));var _=require(_0x1aa7('0xd'));var squel=require(_0x1aa7('0xe'));var crypto=require(_0x1aa7('0xf'));var jsforce=require(_0x1aa7('0x10'));var deskjs=require(_0x1aa7('0x11'));var toCsv=require(_0x1aa7('0xa'));var querystring=require('querystring');var Papa=require(_0x1aa7('0x12'));var Redis=require(_0x1aa7('0x13'));var authService=require(_0x1aa7('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1aa7('0x15'));var logger=require(_0x1aa7('0x16'))(_0x1aa7('0x17'));var utils=require('../../config/utils');var config=require(_0x1aa7('0x18'));var licenseUtil=require(_0x1aa7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46e3e2,_0x40d883){_0x40d883=_0x40d883||0xcc;return function(_0xa4aba5){if(_0xa4aba5){return _0x46e3e2[_0x1aa7('0x1a')](_0x40d883);}return _0x46e3e2['status'](_0x40d883)[_0x1aa7('0x1b')]();};}function respondWithResult(_0x345d9a,_0x2943a8){_0x2943a8=_0x2943a8||0xc8;return function(_0xe2a0a0){if(_0xe2a0a0){return _0x345d9a[_0x1aa7('0x1c')](_0x2943a8)['json'](_0xe2a0a0);}};}function respondWithFilteredResult(_0x3d6812,_0x553697){return function(_0x2b5a9c){if(_0x2b5a9c){var _0x27952d=typeof _0x553697[_0x1aa7('0x1d')]===_0x1aa7('0x1e')&&typeof _0x553697[_0x1aa7('0x1f')]==='undefined';var _0x34d586=_0x2b5a9c[_0x1aa7('0x20')];var _0x532da5=_0x27952d?0x0:_0x553697[_0x1aa7('0x1d')];var _0x14b83a=_0x27952d?_0x2b5a9c[_0x1aa7('0x20')]:_0x553697[_0x1aa7('0x1d')]+_0x553697[_0x1aa7('0x1f')];var _0x221b2a;if(_0x14b83a>=_0x34d586){_0x14b83a=_0x34d586;_0x221b2a=0xc8;}else{_0x221b2a=0xce;}_0x3d6812[_0x1aa7('0x1c')](_0x221b2a);return _0x3d6812[_0x1aa7('0x21')](_0x1aa7('0x22'),_0x532da5+'-'+_0x14b83a+'/'+_0x34d586)[_0x1aa7('0x23')](_0x2b5a9c);}return null;};}function patchUpdates(_0x14d37){return function(_0x49e9be){try{jsonpatch['apply'](_0x49e9be,_0x14d37,!![]);}catch(_0x578789){return BPromise[_0x1aa7('0x24')](_0x578789);}return _0x49e9be[_0x1aa7('0x25')]();};}function saveUpdates(_0x18766e,_0x588782){return function(_0x47d8c2){if(_0x47d8c2){return _0x47d8c2[_0x1aa7('0x26')](_0x18766e)[_0x1aa7('0x27')](function(_0x1146c1){return _0x1146c1;});}return null;};}function removeEntity(_0x50ed66,_0x4012e9){return function(_0x528321){if(_0x528321){return _0x528321[_0x1aa7('0x28')]()[_0x1aa7('0x27')](function(){_0x50ed66[_0x1aa7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c8700,_0x5b4754){return function(_0x30d69f){if(!_0x30d69f){_0x4c8700[_0x1aa7('0x1a')](0x194);}return _0x30d69f;};}function handleError(_0x1a64d0,_0x12b9de){_0x12b9de=_0x12b9de||0x1f4;return function(_0x15f981){logger[_0x1aa7('0x29')](_0x15f981[_0x1aa7('0x2a')]);if(_0x15f981['name']){delete _0x15f981['name'];}_0x1a64d0[_0x1aa7('0x1c')](_0x12b9de)[_0x1aa7('0x2b')](_0x15f981);};}exports[_0x1aa7('0x2c')]=function(_0x354729,_0x200fcd){var _0xbc4327={},_0x20666d={},_0x59d83e={'count':0x0,'rows':[]};var _0x136de1=_[_0x1aa7('0x2d')](db['Migration'][_0x1aa7('0x2e')],function(_0x3ceb2e){return{'name':_0x3ceb2e[_0x1aa7('0x2f')],'type':_0x3ceb2e[_0x1aa7('0x30')][_0x1aa7('0x31')]};});_0x20666d[_0x1aa7('0x32')]=_['map'](_0x136de1,_0x1aa7('0x33'));_0x20666d['query']=_[_0x1aa7('0x34')](_0x354729[_0x1aa7('0x35')]);_0x20666d[_0x1aa7('0x36')]=_[_0x1aa7('0x37')](_0x20666d[_0x1aa7('0x32')],_0x20666d[_0x1aa7('0x35')]);_0xbc4327['attributes']=_[_0x1aa7('0x37')](_0x20666d['model'],qs[_0x1aa7('0x38')](_0x354729[_0x1aa7('0x35')][_0x1aa7('0x38')]));_0xbc4327[_0x1aa7('0x39')]=_0xbc4327[_0x1aa7('0x39')][_0x1aa7('0x3a')]?_0xbc4327[_0x1aa7('0x39')]:_0x20666d['model'];if(!_0x354729[_0x1aa7('0x35')]['hasOwnProperty'](_0x1aa7('0x3b'))){_0xbc4327[_0x1aa7('0x1f')]=qs[_0x1aa7('0x1f')](_0x354729[_0x1aa7('0x35')]['limit']);_0xbc4327[_0x1aa7('0x1d')]=qs[_0x1aa7('0x1d')](_0x354729[_0x1aa7('0x35')][_0x1aa7('0x1d')]);}_0xbc4327[_0x1aa7('0x3c')]=qs['sort'](_0x354729[_0x1aa7('0x35')][_0x1aa7('0x3d')]);_0xbc4327[_0x1aa7('0x3e')]=qs[_0x1aa7('0x36')](_[_0x1aa7('0x3f')](_0x354729[_0x1aa7('0x35')],_0x20666d['filters']),_0x136de1);if(_0x354729[_0x1aa7('0x35')][_0x1aa7('0x40')]){_0xbc4327['where']=_['merge'](_0xbc4327[_0x1aa7('0x3e')],{'$or':_[_0x1aa7('0x2d')](_0x136de1,function(_0x2092b9){if(_0x2092b9[_0x1aa7('0x30')]!=='VIRTUAL'){var _0x25160d={};_0x25160d[_0x2092b9[_0x1aa7('0x33')]]={'$like':'%'+_0x354729['query'][_0x1aa7('0x40')]+'%'};return _0x25160d;}})});}_0xbc4327=_[_0x1aa7('0x41')]({},_0xbc4327,_0x354729[_0x1aa7('0x42')]);var _0x12703f={'where':_0xbc4327[_0x1aa7('0x3e')]};return db['Migration']['count'](_0x12703f)[_0x1aa7('0x27')](function(_0x120946){_0x59d83e[_0x1aa7('0x20')]=_0x120946;if(_0x354729[_0x1aa7('0x35')]['includeAll']){_0xbc4327[_0x1aa7('0x43')]=[{'all':!![]}];}return db[_0x1aa7('0x44')][_0x1aa7('0x45')](_0xbc4327);})[_0x1aa7('0x27')](function(_0x50740e){_0x59d83e[_0x1aa7('0x46')]=_0x50740e;return _0x59d83e;})['then'](respondWithFilteredResult(_0x200fcd,_0xbc4327))[_0x1aa7('0x47')](handleError(_0x200fcd,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a47c366..b4ae021 100644 --- a/server/api/migration/migration.model.js +++ b/server/api/migration/migration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1ba=['Migration','migrations','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./migration.attributes','define'];(function(_0x1cc2a9,_0x2c5885){var _0xdcc257=function(_0x3b0739){while(--_0x3b0739){_0x1cc2a9['push'](_0x1cc2a9['shift']());}};_0xdcc257(++_0x2c5885);}(_0xd1ba,0x14c));var _0xad1b=function(_0x506662,_0x10974d){_0x506662=_0x506662-0x0;var _0x5e1d81=_0xd1ba[_0x506662];return _0x5e1d81;};'use strict';var _=require(_0xad1b('0x0'));var util=require(_0xad1b('0x1'));var logger=require(_0xad1b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xad1b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad1b('0x4'));var rimraf=require(_0xad1b('0x5'));var config=require(_0xad1b('0x6'));var attributes=require(_0xad1b('0x7'));module['exports']=function(_0x5870b0,_0x2530d3){return _0x5870b0[_0xad1b('0x8')](_0xad1b('0x9'),attributes,{'tableName':_0xad1b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4eb6=['exports','define','Migration','migrations','../../config/logger','request-promise','path','rimraf','../../config/environment','./migration.attributes'];(function(_0x322d5f,_0x348a9d){var _0x4fec46=function(_0x2e9064){while(--_0x2e9064){_0x322d5f['push'](_0x322d5f['shift']());}};_0x4fec46(++_0x348a9d);}(_0x4eb6,0x1b2));var _0x64eb=function(_0x30c226,_0x433169){_0x30c226=_0x30c226-0x0;var _0xdfc0ec=_0x4eb6[_0x30c226];return _0xdfc0ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x64eb('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x64eb('0x1'));var fs=require('fs');var path=require(_0x64eb('0x2'));var rimraf=require(_0x64eb('0x3'));var config=require(_0x64eb('0x4'));var attributes=require(_0x64eb('0x5'));module[_0x64eb('0x6')]=function(_0x3ba88a,_0x4ff5c6){return _0x3ba88a[_0x64eb('0x7')](_0x64eb('0x8'),attributes,{'tableName':_0x64eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 3da996f..51eeaa8 100644 --- a/server/api/migration/migration.rpc.js +++ b/server/api/migration/migration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbe1=['then','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x292ebe,_0x3ca65c){var _0x4ca687=function(_0x39c17a){while(--_0x39c17a){_0x292ebe['push'](_0x292ebe['shift']());}};_0x4ca687(++_0x3ca65c);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0xcbe1[_0x589f71];return _0x5763bd;};'use strict';var _=require('lodash');var util=require(_0x1cbe('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cbe('0x1'))['db'];var utils=require(_0x1cbe('0x2'));var logger=require('../../config/logger')(_0x1cbe('0x3'));var config=require('../../config/environment');var jayson=require(_0x1cbe('0x4'));var client=jayson[_0x1cbe('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a02c7,_0x21342a,_0x3882e1){return new BPromise(function(_0x18e76b,_0x21b2a5){return client[_0x1cbe('0x6')](_0x1a02c7,_0x3882e1)[_0x1cbe('0x7')](function(_0x42232d){logger['info'](_0x1cbe('0x8'),_0x21342a,'request\x20sent');logger[_0x1cbe('0x9')](_0x1cbe('0xa'),_0x21342a,_0x1cbe('0xb'),JSON[_0x1cbe('0xc')](_0x42232d));if(_0x42232d['error']){if(_0x42232d[_0x1cbe('0xd')]['code']===0x1f4){logger[_0x1cbe('0xd')](_0x1cbe('0x8'),_0x21342a,_0x42232d['error'][_0x1cbe('0xe')]);return _0x21b2a5(_0x42232d[_0x1cbe('0xd')][_0x1cbe('0xe')]);}logger['error'](_0x1cbe('0x8'),_0x21342a,_0x42232d[_0x1cbe('0xd')][_0x1cbe('0xe')]);return _0x18e76b(_0x42232d[_0x1cbe('0xd')][_0x1cbe('0xe')]);}else{logger[_0x1cbe('0xf')](_0x1cbe('0x8'),_0x21342a,_0x1cbe('0xb'));_0x18e76b(_0x42232d[_0x1cbe('0x10')][_0x1cbe('0xe')]);}})['catch'](function(_0x228488){logger[_0x1cbe('0xd')](_0x1cbe('0x8'),_0x21342a,_0x228488);_0x21b2a5(_0x228488);});});} \ No newline at end of file +var _0x18a5=['../../config/logger','rpc','../../config/environment','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x18a5,0x164));var _0x518a=function(_0x3559ca,_0x3d450c){_0x3559ca=_0x3559ca-0x0;var _0x371c97=_0x18a5[_0x3559ca];return _0x371c97;};'use strict';var _=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x518a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x518a('0x3'))['db'];var utils=require(_0x518a('0x4'));var logger=require(_0x518a('0x5'))(_0x518a('0x6'));var config=require(_0x518a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea311,_0x1d4199,_0x19a2df){return new BPromise(function(_0x2a5fa6,_0x8bd966){return client[_0x518a('0x8')](_0x2ea311,_0x19a2df)[_0x518a('0x9')](function(_0xb996c3){logger[_0x518a('0xa')](_0x518a('0xb'),_0x1d4199,_0x518a('0xc'));logger[_0x518a('0xd')](_0x518a('0xe'),_0x1d4199,_0x518a('0xc'),JSON[_0x518a('0xf')](_0xb996c3));if(_0xb996c3['error']){if(_0xb996c3[_0x518a('0x10')]['code']===0x1f4){logger[_0x518a('0x10')]('Migration,\x20%s,\x20%s',_0x1d4199,_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);return _0x8bd966(_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);}logger[_0x518a('0x10')](_0x518a('0xb'),_0x1d4199,_0xb996c3[_0x518a('0x10')]['message']);return _0x2a5fa6(_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);}else{logger[_0x518a('0xa')]('Migration,\x20%s,\x20%s',_0x1d4199,_0x518a('0xc'));_0x2a5fa6(_0xb996c3[_0x518a('0x12')]['message']);}})['catch'](function(_0x177882){logger['error'](_0x518a('0xb'),_0x1d4199,_0x177882);_0x8bd966(_0x177882);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 96fd6b8..7448e70 100644 --- a/server/api/network/index.js +++ b/server/api/network/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1883=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','post','put','update'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0x1883,0xab));var _0x3188=function(_0x57b5e1,_0x3c3ed2){_0x57b5e1=_0x57b5e1-0x0;var _0x18dec6=_0x1883[_0x57b5e1];return _0x18dec6;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['show']);router[_0x3188('0xf')]('/',auth[_0x3188('0xc')](),controller['create']);router[_0x3188('0x10')]('/:id',auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')](_0x3188('0xe'),auth['isAuthenticated'](),controller[_0x3188('0x13')]);module[_0x3188('0x14')]=router; \ No newline at end of file +var _0xfed6=['../../config/environment','./network.controller','get','index','/:id','post','put','isAuthenticated','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x8730db,_0x2c6bd0){var _0x4e9b19=function(_0x2ec15b){while(--_0x2ec15b){_0x8730db['push'](_0x8730db['shift']());}};_0x4e9b19(++_0x2c6bd0);}(_0xfed6,0x14a));var _0x6fed=function(_0x7844b9,_0x579e6a){_0x7844b9=_0x7844b9-0x0;var _0x4e9db6=_0xfed6[_0x7844b9];return _0x4e9db6;};'use strict';var multer=require(_0x6fed('0x0'));var util=require(_0x6fed('0x1'));var path=require(_0x6fed('0x2'));var timeout=require(_0x6fed('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6fed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6fed('0x5'));var config=require(_0x6fed('0x6'));var controller=require(_0x6fed('0x7'));router[_0x6fed('0x8')]('/',auth['isAuthenticated'](),controller[_0x6fed('0x9')]);router[_0x6fed('0x8')](_0x6fed('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6fed('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6fed('0xc')](_0x6fed('0xa'),auth[_0x6fed('0xd')](),controller['update']);router[_0x6fed('0xe')](_0x6fed('0xa'),auth[_0x6fed('0xd')](),controller[_0x6fed('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index ef1d914..7f67aea 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee1f=['sequelize','exports','ENUM','externip','stun','turn','STRING'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xee1f,0xfc));var _0xfee1=function(_0x56882e,_0x32a4e6){_0x56882e=_0x56882e-0x0;var _0x238af0=_0xee1f[_0x56882e];return _0x238af0;};'use strict';var Sequelize=require(_0xfee1('0x0'));module[_0xfee1('0x1')]={'type':{'type':Sequelize[_0xfee1('0x2')]('localnet',_0xfee1('0x3'),_0xfee1('0x4'),_0xfee1('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfee1('0x6')]}}; \ No newline at end of file +var _0x59c2=['exports','ENUM','localnet','externip','stun','STRING','sequelize'];(function(_0x57c3f8,_0x5635d4){var _0x4feba5=function(_0x2503b3){while(--_0x2503b3){_0x57c3f8['push'](_0x57c3f8['shift']());}};_0x4feba5(++_0x5635d4);}(_0x59c2,0xa0));var _0x259c=function(_0x1ffff7,_0x2f9ff6){_0x1ffff7=_0x1ffff7-0x0;var _0x49d017=_0x59c2[_0x1ffff7];return _0x49d017;};'use strict';var Sequelize=require(_0x259c('0x0'));module[_0x259c('0x1')]={'type':{'type':Sequelize[_0x259c('0x2')](_0x259c('0x3'),_0x259c('0x4'),_0x259c('0x5'),'turn')},'value':{'type':Sequelize[_0x259c('0x6')]},'username':{'type':Sequelize[_0x259c('0x6')]},'password':{'type':Sequelize[_0x259c('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 3cc33c7..aa5743c 100644 --- a/server/api/network/network.controller.js +++ b/server/api/network/network.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93b6=['server/files/templates/network.ejs','format','chan_sip.so','findAll','TURN','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','index','Network','rawAttributes','type','key','model','map','keys','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','params','length','find','create','sequelize','transaction','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','server/files/templates/turn_multiple.ejs','utf8'];(function(_0x4045af,_0x3e7f3f){var _0x2a8e35=function(_0x198cd2){while(--_0x198cd2){_0x4045af['push'](_0x4045af['shift']());}};_0x2a8e35(++_0x3e7f3f);}(_0x93b6,0x151));var _0x693b=function(_0x9009cc,_0x18f4c3){_0x9009cc=_0x9009cc-0x0;var _0x39ce76=_0x93b6[_0x9009cc];return _0x39ce76;};'use strict';var emlformat=require(_0x693b('0x0'));var rimraf=require(_0x693b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x693b('0x2'));var rp=require(_0x693b('0x3'));var moment=require('moment');var BPromise=require(_0x693b('0x4'));var Mustache=require(_0x693b('0x5'));var util=require(_0x693b('0x6'));var path=require(_0x693b('0x7'));var sox=require(_0x693b('0x8'));var csv=require(_0x693b('0x9'));var ejs=require(_0x693b('0xa'));var fs=require('fs');var fs_extra=require(_0x693b('0xb'));var _=require(_0x693b('0xc'));var squel=require(_0x693b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x693b('0x9'));var querystring=require(_0x693b('0xe'));var Papa=require(_0x693b('0xf'));var Redis=require(_0x693b('0x10'));var authService=require(_0x693b('0x11'));var qs=require(_0x693b('0x12'));var as=require(_0x693b('0x13'));var hardwareService=require(_0x693b('0x14'));var logger=require('../../config/logger')(_0x693b('0x15'));var utils=require(_0x693b('0x16'));var config=require(_0x693b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x693b('0x18'))['db'];var jayson=require(_0x693b('0x19'));var client=jayson[_0x693b('0x1a')][_0x693b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xda1c38,_0x1ce8bb,_0xfd842,_0x48a7ec){return new BPromise(function(_0x1b5a9d,_0x1cf1ed){var _0xd617c6=_0x48a7ec||client;return _0xd617c6[_0x693b('0x1c')](_0xda1c38,_0xfd842)[_0x693b('0x1d')](function(_0x14cfaa){logger[_0x693b('0x1e')](_0x693b('0x1f'),_0x1ce8bb,_0x693b('0x20'));logger[_0x693b('0x21')](_0x693b('0x22'),_0x1ce8bb,_0x693b('0x20'),JSON['stringify'](_0x14cfaa));if(_0x14cfaa[_0x693b('0x23')]){if(_0x14cfaa[_0x693b('0x23')][_0x693b('0x24')]===0x1f4){logger[_0x693b('0x23')](_0x693b('0x1f'),_0x1ce8bb,_0x14cfaa['error'][_0x693b('0x25')]);return _0x1cf1ed(_0x14cfaa[_0x693b('0x23')][_0x693b('0x25')]);}logger['error'](_0x693b('0x1f'),_0x1ce8bb,_0x14cfaa[_0x693b('0x23')][_0x693b('0x25')]);return _0x1b5a9d(_0x14cfaa[_0x693b('0x23')][_0x693b('0x25')]);}else{logger[_0x693b('0x1e')]('Network,\x20%s,\x20%s',_0x1ce8bb,_0x693b('0x20'));_0x1b5a9d(_0x14cfaa[_0x693b('0x26')][_0x693b('0x25')]);}})[_0x693b('0x27')](function(_0x3780a1){logger['error'](_0x693b('0x1f'),_0x1ce8bb,_0x3780a1);_0x1cf1ed(_0x3780a1);});});}function respondWithStatusCode(_0x3a5899,_0x580b77){_0x580b77=_0x580b77||0xcc;return function(_0x443cdf){if(_0x443cdf){return _0x3a5899[_0x693b('0x28')](_0x580b77);}return _0x3a5899[_0x693b('0x29')](_0x580b77)['end']();};}function respondWithResult(_0x1fc3c1,_0x3267a8){_0x3267a8=_0x3267a8||0xc8;return function(_0x31ab0b){if(_0x31ab0b){return _0x1fc3c1[_0x693b('0x29')](_0x3267a8)['json'](_0x31ab0b);}};}function respondWithFilteredResult(_0x44335d,_0xee164b){return function(_0x1597ea){if(_0x1597ea){var _0x1ed1d2=typeof _0xee164b[_0x693b('0x2a')]===_0x693b('0x2b')&&typeof _0xee164b[_0x693b('0x2c')]==='undefined';var _0x4c2c82=_0x1597ea[_0x693b('0x2d')];var _0x40a469=_0x1ed1d2?0x0:_0xee164b[_0x693b('0x2a')];var _0x39d3ac=_0x1ed1d2?_0x1597ea[_0x693b('0x2d')]:_0xee164b[_0x693b('0x2a')]+_0xee164b['limit'];var _0x1b7917;if(_0x39d3ac>=_0x4c2c82){_0x39d3ac=_0x4c2c82;_0x1b7917=0xc8;}else{_0x1b7917=0xce;}_0x44335d['status'](_0x1b7917);return _0x44335d[_0x693b('0x2e')](_0x693b('0x2f'),_0x40a469+'-'+_0x39d3ac+'/'+_0x4c2c82)[_0x693b('0x30')](_0x1597ea);}return null;};}function patchUpdates(_0x2a71fe){return function(_0x3f1b33){try{jsonpatch[_0x693b('0x31')](_0x3f1b33,_0x2a71fe,!![]);}catch(_0x44bac4){return BPromise[_0x693b('0x32')](_0x44bac4);}return _0x3f1b33[_0x693b('0x33')]();};}function saveUpdates(_0x1c92d6,_0x43a46f){return function(_0x2ee025){if(_0x2ee025){return _0x2ee025[_0x693b('0x34')](_0x1c92d6)[_0x693b('0x1d')](function(_0x3cde36){return _0x3cde36;});}return null;};}function removeEntity(_0x445add,_0x389705){return function(_0x42ec88){if(_0x42ec88){return _0x42ec88[_0x693b('0x35')]()['then'](function(){_0x445add[_0x693b('0x29')](0xcc)[_0x693b('0x36')]();});}};}function handleEntityNotFound(_0x8b0f08,_0x308874){return function(_0x28eff5){if(!_0x28eff5){_0x8b0f08[_0x693b('0x28')](0x194);}return _0x28eff5;};}function handleError(_0x15c670,_0x33f672){_0x33f672=_0x33f672||0x1f4;return function(_0x3c943f){logger[_0x693b('0x23')](_0x3c943f[_0x693b('0x37')]);if(_0x3c943f[_0x693b('0x38')]){delete _0x3c943f[_0x693b('0x38')];}_0x15c670[_0x693b('0x29')](_0x33f672)[_0x693b('0x39')](_0x3c943f);};}exports[_0x693b('0x3a')]=function(_0x589606,_0x1bc7d8){var _0x2a5f37={},_0x46b5b2={},_0x291e4d={'count':0x0,'rows':[]};var _0x5ad9c0=_['map'](db[_0x693b('0x3b')][_0x693b('0x3c')],function(_0x571ab5){return{'name':_0x571ab5['fieldName'],'type':_0x571ab5[_0x693b('0x3d')][_0x693b('0x3e')]};});_0x46b5b2[_0x693b('0x3f')]=_[_0x693b('0x40')](_0x5ad9c0,'name');_0x46b5b2['query']=_[_0x693b('0x41')](_0x589606['query']);_0x46b5b2[_0x693b('0x42')]=_['intersection'](_0x46b5b2[_0x693b('0x3f')],_0x46b5b2[_0x693b('0x43')]);_0x2a5f37[_0x693b('0x44')]=_[_0x693b('0x45')](_0x46b5b2['model'],qs[_0x693b('0x46')](_0x589606[_0x693b('0x43')][_0x693b('0x46')]));_0x2a5f37[_0x693b('0x44')]=_0x2a5f37[_0x693b('0x44')]['length']?_0x2a5f37['attributes']:_0x46b5b2['model'];if(!_0x589606['query'][_0x693b('0x47')](_0x693b('0x48'))){_0x2a5f37['limit']=qs[_0x693b('0x2c')](_0x589606['query'][_0x693b('0x2c')]);_0x2a5f37[_0x693b('0x2a')]=qs[_0x693b('0x2a')](_0x589606[_0x693b('0x43')][_0x693b('0x2a')]);}_0x2a5f37[_0x693b('0x49')]=qs['sort'](_0x589606['query'][_0x693b('0x4a')]);_0x2a5f37[_0x693b('0x4b')]=qs[_0x693b('0x42')](_['pick'](_0x589606[_0x693b('0x43')],_0x46b5b2['filters']),_0x5ad9c0);if(_0x589606[_0x693b('0x43')][_0x693b('0x4c')]){_0x2a5f37['where']=_[_0x693b('0x4d')](_0x2a5f37[_0x693b('0x4b')],{'$or':_[_0x693b('0x40')](_0x5ad9c0,function(_0x59ae55){if(_0x59ae55[_0x693b('0x3d')]!==_0x693b('0x4e')){var _0x8484e4={};_0x8484e4[_0x59ae55[_0x693b('0x38')]]={'$like':'%'+_0x589606['query'][_0x693b('0x4c')]+'%'};return _0x8484e4;}})});}_0x2a5f37=_[_0x693b('0x4d')]({},_0x2a5f37,_0x589606[_0x693b('0x4f')]);var _0x4a86d9={'where':_0x2a5f37[_0x693b('0x4b')]};return db[_0x693b('0x3b')][_0x693b('0x2d')](_0x4a86d9)['then'](function(_0x2b86e0){_0x291e4d['count']=_0x2b86e0;if(_0x589606['query'][_0x693b('0x50')]){_0x2a5f37[_0x693b('0x51')]=[{'all':!![]}];}return db[_0x693b('0x3b')]['findAll'](_0x2a5f37);})[_0x693b('0x1d')](function(_0x3134fe){_0x291e4d[_0x693b('0x52')]=_0x3134fe;return _0x291e4d;})[_0x693b('0x1d')](respondWithFilteredResult(_0x1bc7d8,_0x2a5f37))['catch'](handleError(_0x1bc7d8,null));};exports['show']=function(_0x457164,_0x4736eb){var _0x188ff3={'raw':!![],'where':{'id':_0x457164[_0x693b('0x53')]['id']}},_0x7aec10={};_0x7aec10[_0x693b('0x3f')]=_[_0x693b('0x41')](db[_0x693b('0x3b')][_0x693b('0x3c')]);_0x7aec10[_0x693b('0x43')]=_[_0x693b('0x41')](_0x457164[_0x693b('0x43')]);_0x7aec10[_0x693b('0x42')]=_[_0x693b('0x45')](_0x7aec10[_0x693b('0x3f')],_0x7aec10['query']);_0x188ff3['attributes']=_['intersection'](_0x7aec10[_0x693b('0x3f')],qs[_0x693b('0x46')](_0x457164['query'][_0x693b('0x46')]));_0x188ff3[_0x693b('0x44')]=_0x188ff3[_0x693b('0x44')][_0x693b('0x54')]?_0x188ff3[_0x693b('0x44')]:_0x7aec10[_0x693b('0x3f')];if(_0x457164[_0x693b('0x43')][_0x693b('0x50')]){_0x188ff3[_0x693b('0x51')]=[{'all':!![]}];}_0x188ff3=_[_0x693b('0x4d')]({},_0x188ff3,_0x457164[_0x693b('0x4f')]);return db[_0x693b('0x3b')][_0x693b('0x55')](_0x188ff3)['then'](handleEntityNotFound(_0x4736eb,null))[_0x693b('0x1d')](respondWithResult(_0x4736eb,null))[_0x693b('0x27')](handleError(_0x4736eb,null));};exports[_0x693b('0x56')]=function(_0x591ff0,_0x1ad078,_0x476e5a){var _0x3e1a9a;return db[_0x693b('0x57')][_0x693b('0x58')](function(_0x12accc){return db[_0x693b('0x3b')][_0x693b('0x56')](_0x591ff0[_0x693b('0x59')],{'raw':!![]})['then'](function(_0x10c71b){_0x3e1a9a=_0x10c71b;return db[_0x693b('0x3b')]['findAll']({'where':{'type':_0x591ff0[_0x693b('0x59')][_0x693b('0x3d')]},'raw':!![]});})[_0x693b('0x1d')](function(_0x35f7cf){if(_0x3e1a9a[_0x693b('0x3d')]['toUpperCase']()==_0x693b('0x5a')){var _0x2b5515=fs[_0x693b('0x5b')](path[_0x693b('0x5c')](config[_0x693b('0x5d')],_0x693b('0x5e')),'utf8');var _0x450504=ejs[_0x693b('0x5f')](_0x2b5515,{'networks':_0x35f7cf||[]});fs[_0x693b('0x60')](_0x693b('0x61'),_0x450504);return respondWithRpcPromise(_0x693b('0x62'),_0x693b('0x56'),{'module':_0x693b('0x63')});}else if(_0x3e1a9a['type'][_0x693b('0x64')]()=='TURN'){var _0x167415=fs[_0x693b('0x5b')](path[_0x693b('0x5c')](config[_0x693b('0x5d')],_0x693b('0x65')),_0x693b('0x66'));var _0x251425=ejs['render'](_0x167415,{'networks':_0x35f7cf||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x251425);return respondWithRpcPromise(_0x693b('0x62'),_0x693b('0x56'),{'module':'res_stun_monitor.so'});}else{var _0x31b1d8=fs[_0x693b('0x5b')](path[_0x693b('0x5c')](config['root'],_0x693b('0x67')),_0x693b('0x66'));var _0x30ee04=ejs['render'](_0x31b1d8,{'networks':_0x35f7cf||[]});fs[_0x693b('0x60')](util[_0x693b('0x68')]('/etc/asterisk/sip_xcally_%s.conf',_0x591ff0[_0x693b('0x59')][_0x693b('0x3d')]['toLowerCase']()),_0x30ee04);return respondWithRpcPromise(_0x693b('0x62'),'create',{'module':_0x693b('0x69')});}return null;})[_0x693b('0x1d')](function(){return _0x3e1a9a;});})[_0x693b('0x1d')](respondWithResult(_0x1ad078,0xc9))['catch'](handleError(_0x1ad078,null));};exports[_0x693b('0x34')]=function(_0x49d4d4,_0x2592bd,_0xa11adc){var _0xcbc35b;return db[_0x693b('0x57')]['transaction'](function(_0x1fa3d0){return db[_0x693b('0x3b')][_0x693b('0x55')]({'where':{'id':_0x49d4d4['params']['id']}})[_0x693b('0x1d')](handleEntityNotFound(_0x2592bd,null))[_0x693b('0x1d')](saveUpdates(_0x49d4d4['body'],null))[_0x693b('0x1d')](function(_0x51ec2d){if(_0x51ec2d){_0xcbc35b=_0x51ec2d;return db[_0x693b('0x3b')][_0x693b('0x6a')]({'where':{'type':_0xcbc35b['type']},'raw':!![]});}return null;})['then'](function(_0x1b4903){if(_0xcbc35b[_0x693b('0x3d')]['toUpperCase']()==_0x693b('0x5a')){var _0x314537=fs[_0x693b('0x5b')](path[_0x693b('0x5c')](config[_0x693b('0x5d')],_0x693b('0x5e')),_0x693b('0x66'));var _0x465f61=ejs[_0x693b('0x5f')](_0x314537,{'networks':_0x1b4903||[]});fs[_0x693b('0x60')]('/etc/asterisk/stun_xcally.conf',_0x465f61);return respondWithRpcPromise(_0x693b('0x62'),'update',{'module':'res_stun_monitor.so'});}else if(_0xcbc35b['type'][_0x693b('0x64')]()==_0x693b('0x6b')){var _0x11a2c4=fs[_0x693b('0x5b')](path['join'](config[_0x693b('0x5d')],_0x693b('0x65')),_0x693b('0x66'));var _0x5a2428=ejs['render'](_0x11a2c4,{'networks':_0x1b4903||[]});fs['writeFileSync'](_0x693b('0x6c'),_0x5a2428);return respondWithRpcPromise(_0x693b('0x62'),_0x693b('0x34'),{'module':_0x693b('0x63')});}else{var _0x2a1e1d=fs['readFileSync'](path[_0x693b('0x5c')](config[_0x693b('0x5d')],_0x693b('0x67')),'utf8');var _0x1b488b=ejs[_0x693b('0x5f')](_0x2a1e1d,{'networks':_0x1b4903||[]});fs[_0x693b('0x60')](util[_0x693b('0x68')](_0x693b('0x6d'),_0x49d4d4[_0x693b('0x59')]['type']['toLowerCase']()),_0x1b488b);return respondWithRpcPromise(_0x693b('0x62'),_0x693b('0x34'),{'module':'chan_sip.so'});}return null;})[_0x693b('0x1d')](function(_0x5e0077){if(_0x5e0077){return _0xcbc35b;}return null;});})['then'](respondWithResult(_0x2592bd,null))[_0x693b('0x27')](handleError(_0x2592bd,null));};exports[_0x693b('0x35')]=function(_0x5518b0,_0x26b10b,_0x1f2e5b){var _0x23bd6f;return db[_0x693b('0x3b')]['find']({'where':{'id':_0x5518b0[_0x693b('0x53')]['id']}})[_0x693b('0x1d')](function(_0x526951){_0x23bd6f=_0x526951;return _0x526951;})[_0x693b('0x1d')](handleEntityNotFound(_0x26b10b,null))[_0x693b('0x1d')](removeEntity(_0x26b10b,null))['then'](function(){if(_0x23bd6f){return db[_0x693b('0x3b')][_0x693b('0x6a')]({'where':{'type':_0x23bd6f[_0x693b('0x3d')]},'raw':!![]});}})[_0x693b('0x1d')](function(_0x3a8249){if(_0x23bd6f[_0x693b('0x3d')][_0x693b('0x64')]()==_0x693b('0x5a')){var _0x55cfc3=fs[_0x693b('0x5b')](path[_0x693b('0x5c')](config[_0x693b('0x5d')],_0x693b('0x5e')),_0x693b('0x66'));var _0x50c358=ejs[_0x693b('0x5f')](_0x55cfc3,{'networks':_0x3a8249||[]});fs[_0x693b('0x60')]('/etc/asterisk/stun_xcally.conf',_0x50c358);return respondWithRpcPromise(_0x693b('0x62'),_0x693b('0x35'),{'module':_0x693b('0x63')});}else if(_0x23bd6f[_0x693b('0x3d')]['toUpperCase']()==_0x693b('0x6b')){var _0x2d6500=fs[_0x693b('0x5b')](path['join'](config[_0x693b('0x5d')],_0x693b('0x65')),'utf8');var _0x1a1a9f=ejs['render'](_0x2d6500,{'networks':_0x3a8249||[]});fs[_0x693b('0x60')](_0x693b('0x6c'),_0x1a1a9f);return respondWithRpcPromise(_0x693b('0x62'),_0x693b('0x35'),{'module':_0x693b('0x63')});}else{var _0x202735=fs[_0x693b('0x5b')](path['join'](config[_0x693b('0x5d')],'server/files/templates/network.ejs'),_0x693b('0x66'));var _0x3d1835=ejs[_0x693b('0x5f')](_0x202735,{'networks':_0x3a8249||[]});fs[_0x693b('0x60')](util[_0x693b('0x68')]('/etc/asterisk/sip_xcally_%s.conf',_0x5518b0[_0x693b('0x59')][_0x693b('0x3d')]['toLowerCase']()),_0x3d1835);return respondWithRpcPromise(_0x693b('0x62'),_0x693b('0x35'),{'module':_0x693b('0x69')});}return null;})[_0x693b('0x27')](handleError(_0x26b10b,null));}; \ No newline at end of file +var _0xcc1b=['include','findAll','show','params','rawAttributes','find','create','transaction','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','sequelize','root','res_stun_monitor.so','/etc/asterisk/sip_xcally_%s.conf','TURN','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','catch','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','map','Network','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll'];(function(_0x547053,_0x37cc21){var _0xb00198=function(_0x5a9104){while(--_0x5a9104){_0x547053['push'](_0x547053['shift']());}};_0xb00198(++_0x37cc21);}(_0xcc1b,0x8c));var _0xbcc1=function(_0x31db33,_0x5e13f4){_0x31db33=_0x31db33-0x0;var _0x22bdab=_0xcc1b[_0x31db33];return _0x22bdab;};'use strict';var emlformat=require(_0xbcc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcc1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbcc1('0x2'));var moment=require(_0xbcc1('0x3'));var BPromise=require(_0xbcc1('0x4'));var Mustache=require(_0xbcc1('0x5'));var util=require(_0xbcc1('0x6'));var path=require(_0xbcc1('0x7'));var sox=require(_0xbcc1('0x8'));var csv=require('to-csv');var ejs=require(_0xbcc1('0x9'));var fs=require('fs');var fs_extra=require(_0xbcc1('0xa'));var _=require(_0xbcc1('0xb'));var squel=require('squel');var crypto=require(_0xbcc1('0xc'));var jsforce=require(_0xbcc1('0xd'));var deskjs=require(_0xbcc1('0xe'));var toCsv=require(_0xbcc1('0xf'));var querystring=require(_0xbcc1('0x10'));var Papa=require(_0xbcc1('0x11'));var Redis=require(_0xbcc1('0x12'));var authService=require(_0xbcc1('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcc1('0x14'))('api');var utils=require(_0xbcc1('0x15'));var config=require(_0xbcc1('0x16'));var licenseUtil=require(_0xbcc1('0x17'));var db=require(_0xbcc1('0x18'))['db'];var jayson=require(_0xbcc1('0x19'));var client=jayson[_0xbcc1('0x1a')][_0xbcc1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x35f66d,_0x379c92,_0x7cfa6,_0x521fa9){return new BPromise(function(_0x29d8ff,_0x45a372){var _0x35dda1=_0x521fa9||client;return _0x35dda1['request'](_0x35f66d,_0x7cfa6)[_0xbcc1('0x1c')](function(_0x15675b){logger[_0xbcc1('0x1d')]('Network,\x20%s,\x20%s',_0x379c92,_0xbcc1('0x1e'));logger['debug'](_0xbcc1('0x1f'),_0x379c92,'request\x20sent',JSON[_0xbcc1('0x20')](_0x15675b));if(_0x15675b[_0xbcc1('0x21')]){if(_0x15675b[_0xbcc1('0x21')][_0xbcc1('0x22')]===0x1f4){logger[_0xbcc1('0x21')](_0xbcc1('0x23'),_0x379c92,_0x15675b[_0xbcc1('0x21')][_0xbcc1('0x24')]);return _0x45a372(_0x15675b[_0xbcc1('0x21')][_0xbcc1('0x24')]);}logger[_0xbcc1('0x21')](_0xbcc1('0x23'),_0x379c92,_0x15675b[_0xbcc1('0x21')][_0xbcc1('0x24')]);return _0x29d8ff(_0x15675b['error']['message']);}else{logger[_0xbcc1('0x1d')](_0xbcc1('0x23'),_0x379c92,_0xbcc1('0x1e'));_0x29d8ff(_0x15675b['result'][_0xbcc1('0x24')]);}})[_0xbcc1('0x25')](function(_0x19fcc5){logger[_0xbcc1('0x21')]('Network,\x20%s,\x20%s',_0x379c92,_0x19fcc5);_0x45a372(_0x19fcc5);});});}function respondWithStatusCode(_0x2dfbe4,_0x4cb32f){_0x4cb32f=_0x4cb32f||0xcc;return function(_0x364f40){if(_0x364f40){return _0x2dfbe4[_0xbcc1('0x26')](_0x4cb32f);}return _0x2dfbe4['status'](_0x4cb32f)[_0xbcc1('0x27')]();};}function respondWithResult(_0xd51ae,_0x1086e6){_0x1086e6=_0x1086e6||0xc8;return function(_0x1ffe10){if(_0x1ffe10){return _0xd51ae[_0xbcc1('0x28')](_0x1086e6)['json'](_0x1ffe10);}};}function respondWithFilteredResult(_0x1b3888,_0x10d937){return function(_0x9393e3){if(_0x9393e3){var _0x59bbc8=typeof _0x10d937[_0xbcc1('0x29')]===_0xbcc1('0x2a')&&typeof _0x10d937[_0xbcc1('0x2b')]===_0xbcc1('0x2a');var _0x1eaea4=_0x9393e3['count'];var _0x24eed2=_0x59bbc8?0x0:_0x10d937[_0xbcc1('0x29')];var _0x307dc0=_0x59bbc8?_0x9393e3['count']:_0x10d937[_0xbcc1('0x29')]+_0x10d937[_0xbcc1('0x2b')];var _0x46060e;if(_0x307dc0>=_0x1eaea4){_0x307dc0=_0x1eaea4;_0x46060e=0xc8;}else{_0x46060e=0xce;}_0x1b3888[_0xbcc1('0x28')](_0x46060e);return _0x1b3888[_0xbcc1('0x2c')](_0xbcc1('0x2d'),_0x24eed2+'-'+_0x307dc0+'/'+_0x1eaea4)[_0xbcc1('0x2e')](_0x9393e3);}return null;};}function patchUpdates(_0x1f4f74){return function(_0x221b0b){try{jsonpatch[_0xbcc1('0x2f')](_0x221b0b,_0x1f4f74,!![]);}catch(_0x2ced3a){return BPromise['reject'](_0x2ced3a);}return _0x221b0b[_0xbcc1('0x30')]();};}function saveUpdates(_0x5e73d0,_0xe306a7){return function(_0x962b68){if(_0x962b68){return _0x962b68[_0xbcc1('0x31')](_0x5e73d0)[_0xbcc1('0x1c')](function(_0xa8ebc3){return _0xa8ebc3;});}return null;};}function removeEntity(_0xba3a8,_0x8b5fb2){return function(_0x2cb733){if(_0x2cb733){return _0x2cb733[_0xbcc1('0x32')]()['then'](function(){_0xba3a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48589b,_0x304730){return function(_0x77eee7){if(!_0x77eee7){_0x48589b[_0xbcc1('0x26')](0x194);}return _0x77eee7;};}function handleError(_0x13ed4a,_0x54fee4){_0x54fee4=_0x54fee4||0x1f4;return function(_0x5001a6){logger[_0xbcc1('0x21')](_0x5001a6[_0xbcc1('0x33')]);if(_0x5001a6[_0xbcc1('0x34')]){delete _0x5001a6[_0xbcc1('0x34')];}_0x13ed4a[_0xbcc1('0x28')](_0x54fee4)[_0xbcc1('0x35')](_0x5001a6);};}exports[_0xbcc1('0x36')]=function(_0x707fc7,_0x51a07e){var _0x32c2f8={},_0x111980={},_0x12230a={'count':0x0,'rows':[]};var _0x2dbc1c=_[_0xbcc1('0x37')](db[_0xbcc1('0x38')]['rawAttributes'],function(_0x42dccc){return{'name':_0x42dccc[_0xbcc1('0x39')],'type':_0x42dccc[_0xbcc1('0x3a')][_0xbcc1('0x3b')]};});_0x111980['model']=_[_0xbcc1('0x37')](_0x2dbc1c,_0xbcc1('0x34'));_0x111980['query']=_[_0xbcc1('0x3c')](_0x707fc7[_0xbcc1('0x3d')]);_0x111980[_0xbcc1('0x3e')]=_['intersection'](_0x111980['model'],_0x111980[_0xbcc1('0x3d')]);_0x32c2f8[_0xbcc1('0x3f')]=_[_0xbcc1('0x40')](_0x111980[_0xbcc1('0x41')],qs['fields'](_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x42')]));_0x32c2f8[_0xbcc1('0x3f')]=_0x32c2f8[_0xbcc1('0x3f')][_0xbcc1('0x43')]?_0x32c2f8[_0xbcc1('0x3f')]:_0x111980[_0xbcc1('0x41')];if(!_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x44')](_0xbcc1('0x45'))){_0x32c2f8[_0xbcc1('0x2b')]=qs[_0xbcc1('0x2b')](_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x2b')]);_0x32c2f8[_0xbcc1('0x29')]=qs[_0xbcc1('0x29')](_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x29')]);}_0x32c2f8[_0xbcc1('0x46')]=qs[_0xbcc1('0x47')](_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x47')]);_0x32c2f8[_0xbcc1('0x48')]=qs[_0xbcc1('0x3e')](_[_0xbcc1('0x49')](_0x707fc7[_0xbcc1('0x3d')],_0x111980[_0xbcc1('0x3e')]),_0x2dbc1c);if(_0x707fc7[_0xbcc1('0x3d')]['filter']){_0x32c2f8[_0xbcc1('0x48')]=_[_0xbcc1('0x4a')](_0x32c2f8[_0xbcc1('0x48')],{'$or':_[_0xbcc1('0x37')](_0x2dbc1c,function(_0x234975){if(_0x234975[_0xbcc1('0x3a')]!==_0xbcc1('0x4b')){var _0x4e3f6b={};_0x4e3f6b[_0x234975[_0xbcc1('0x34')]]={'$like':'%'+_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x4c')]+'%'};return _0x4e3f6b;}})});}_0x32c2f8=_[_0xbcc1('0x4a')]({},_0x32c2f8,_0x707fc7[_0xbcc1('0x4d')]);var _0x42f8de={'where':_0x32c2f8[_0xbcc1('0x48')]};return db[_0xbcc1('0x38')][_0xbcc1('0x4e')](_0x42f8de)[_0xbcc1('0x1c')](function(_0x55f0e2){_0x12230a['count']=_0x55f0e2;if(_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x4f')]){_0x32c2f8[_0xbcc1('0x50')]=[{'all':!![]}];}return db[_0xbcc1('0x38')][_0xbcc1('0x51')](_0x32c2f8);})[_0xbcc1('0x1c')](function(_0xfa024b){_0x12230a['rows']=_0xfa024b;return _0x12230a;})[_0xbcc1('0x1c')](respondWithFilteredResult(_0x51a07e,_0x32c2f8))[_0xbcc1('0x25')](handleError(_0x51a07e,null));};exports[_0xbcc1('0x52')]=function(_0x57b802,_0x242a34){var _0x594199={'raw':!![],'where':{'id':_0x57b802[_0xbcc1('0x53')]['id']}},_0x359da6={};_0x359da6[_0xbcc1('0x41')]=_['keys'](db[_0xbcc1('0x38')][_0xbcc1('0x54')]);_0x359da6[_0xbcc1('0x3d')]=_[_0xbcc1('0x3c')](_0x57b802[_0xbcc1('0x3d')]);_0x359da6['filters']=_['intersection'](_0x359da6[_0xbcc1('0x41')],_0x359da6['query']);_0x594199['attributes']=_[_0xbcc1('0x40')](_0x359da6[_0xbcc1('0x41')],qs[_0xbcc1('0x42')](_0x57b802[_0xbcc1('0x3d')][_0xbcc1('0x42')]));_0x594199[_0xbcc1('0x3f')]=_0x594199[_0xbcc1('0x3f')][_0xbcc1('0x43')]?_0x594199[_0xbcc1('0x3f')]:_0x359da6[_0xbcc1('0x41')];if(_0x57b802['query']['includeAll']){_0x594199['include']=[{'all':!![]}];}_0x594199=_[_0xbcc1('0x4a')]({},_0x594199,_0x57b802['options']);return db[_0xbcc1('0x38')][_0xbcc1('0x55')](_0x594199)['then'](handleEntityNotFound(_0x242a34,null))['then'](respondWithResult(_0x242a34,null))[_0xbcc1('0x25')](handleError(_0x242a34,null));};exports[_0xbcc1('0x56')]=function(_0x58322e,_0x539bb1,_0xafd24e){var _0x2abffd;return db['sequelize'][_0xbcc1('0x57')](function(_0x3ebe57){return db[_0xbcc1('0x38')][_0xbcc1('0x56')](_0x58322e[_0xbcc1('0x58')],{'raw':!![]})[_0xbcc1('0x1c')](function(_0x26392f){_0x2abffd=_0x26392f;return db['Network'][_0xbcc1('0x51')]({'where':{'type':_0x58322e[_0xbcc1('0x58')]['type']},'raw':!![]});})['then'](function(_0x1a9980){if(_0x2abffd[_0xbcc1('0x3a')][_0xbcc1('0x59')]()==_0xbcc1('0x5a')){var _0x2ca35a=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config['root'],_0xbcc1('0x5d')),'utf8');var _0x260e6b=ejs[_0xbcc1('0x5e')](_0x2ca35a,{'networks':_0x1a9980||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x60'),_0x260e6b);return respondWithRpcPromise(_0xbcc1('0x61'),_0xbcc1('0x56'),{'module':'res_stun_monitor.so'});}else if(_0x2abffd[_0xbcc1('0x3a')]['toUpperCase']()=='TURN'){var _0x4f2f16=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config['root'],_0xbcc1('0x62')),_0xbcc1('0x63'));var _0x3d7e1b=ejs[_0xbcc1('0x5e')](_0x4f2f16,{'networks':_0x1a9980||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x64'),_0x3d7e1b);return respondWithRpcPromise(_0xbcc1('0x61'),'create',{'module':'res_stun_monitor.so'});}else{var _0x2a46de=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config['root'],_0xbcc1('0x65')),_0xbcc1('0x63'));var _0x4d4e02=ejs[_0xbcc1('0x5e')](_0x2a46de,{'networks':_0x1a9980||[]});fs[_0xbcc1('0x5f')](util[_0xbcc1('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x58322e[_0xbcc1('0x58')][_0xbcc1('0x3a')][_0xbcc1('0x67')]()),_0x4d4e02);return respondWithRpcPromise(_0xbcc1('0x61'),'create',{'module':_0xbcc1('0x68')});}return null;})[_0xbcc1('0x1c')](function(){return _0x2abffd;});})[_0xbcc1('0x1c')](respondWithResult(_0x539bb1,0xc9))[_0xbcc1('0x25')](handleError(_0x539bb1,null));};exports[_0xbcc1('0x31')]=function(_0x3a1494,_0xfe20d5,_0xc930fc){var _0x505b6c;return db[_0xbcc1('0x69')][_0xbcc1('0x57')](function(_0x7541fe){return db[_0xbcc1('0x38')]['find']({'where':{'id':_0x3a1494['params']['id']}})[_0xbcc1('0x1c')](handleEntityNotFound(_0xfe20d5,null))[_0xbcc1('0x1c')](saveUpdates(_0x3a1494[_0xbcc1('0x58')],null))[_0xbcc1('0x1c')](function(_0x50c327){if(_0x50c327){_0x505b6c=_0x50c327;return db[_0xbcc1('0x38')][_0xbcc1('0x51')]({'where':{'type':_0x505b6c[_0xbcc1('0x3a')]},'raw':!![]});}return null;})[_0xbcc1('0x1c')](function(_0x27e314){if(_0x505b6c[_0xbcc1('0x3a')]['toUpperCase']()==_0xbcc1('0x5a')){var _0x64f2ab=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config[_0xbcc1('0x6a')],'server/files/templates/stun_multiple.ejs'),_0xbcc1('0x63'));var _0x4fb512=ejs[_0xbcc1('0x5e')](_0x64f2ab,{'networks':_0x27e314||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x60'),_0x4fb512);return respondWithRpcPromise('Reload',_0xbcc1('0x31'),{'module':_0xbcc1('0x6b')});}else if(_0x505b6c[_0xbcc1('0x3a')][_0xbcc1('0x59')]()=='TURN'){var _0x28a8ee=fs[_0xbcc1('0x5b')](path['join'](config['root'],_0xbcc1('0x62')),_0xbcc1('0x63'));var _0x5daaae=ejs[_0xbcc1('0x5e')](_0x28a8ee,{'networks':_0x27e314||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x64'),_0x5daaae);return respondWithRpcPromise(_0xbcc1('0x61'),_0xbcc1('0x31'),{'module':_0xbcc1('0x6b')});}else{var _0x5a7bc9=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config['root'],_0xbcc1('0x65')),_0xbcc1('0x63'));var _0x3d1386=ejs[_0xbcc1('0x5e')](_0x5a7bc9,{'networks':_0x27e314||[]});fs[_0xbcc1('0x5f')](util[_0xbcc1('0x66')](_0xbcc1('0x6c'),_0x3a1494[_0xbcc1('0x58')]['type'][_0xbcc1('0x67')]()),_0x3d1386);return respondWithRpcPromise(_0xbcc1('0x61'),_0xbcc1('0x31'),{'module':_0xbcc1('0x68')});}return null;})['then'](function(_0x5621b8){if(_0x5621b8){return _0x505b6c;}return null;});})[_0xbcc1('0x1c')](respondWithResult(_0xfe20d5,null))[_0xbcc1('0x25')](handleError(_0xfe20d5,null));};exports['destroy']=function(_0x4ea0a1,_0x392a6b,_0x346738){var _0x478151;return db[_0xbcc1('0x38')][_0xbcc1('0x55')]({'where':{'id':_0x4ea0a1[_0xbcc1('0x53')]['id']}})[_0xbcc1('0x1c')](function(_0x51b548){_0x478151=_0x51b548;return _0x51b548;})[_0xbcc1('0x1c')](handleEntityNotFound(_0x392a6b,null))[_0xbcc1('0x1c')](removeEntity(_0x392a6b,null))[_0xbcc1('0x1c')](function(){if(_0x478151){return db[_0xbcc1('0x38')][_0xbcc1('0x51')]({'where':{'type':_0x478151[_0xbcc1('0x3a')]},'raw':!![]});}})[_0xbcc1('0x1c')](function(_0x3b9f64){if(_0x478151['type'][_0xbcc1('0x59')]()==_0xbcc1('0x5a')){var _0x4f79b5=fs['readFileSync'](path[_0xbcc1('0x5c')](config[_0xbcc1('0x6a')],_0xbcc1('0x5d')),_0xbcc1('0x63'));var _0x37cfe8=ejs[_0xbcc1('0x5e')](_0x4f79b5,{'networks':_0x3b9f64||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x60'),_0x37cfe8);return respondWithRpcPromise(_0xbcc1('0x61'),'destroy',{'module':_0xbcc1('0x6b')});}else if(_0x478151[_0xbcc1('0x3a')][_0xbcc1('0x59')]()==_0xbcc1('0x6d')){var _0x20b548=fs['readFileSync'](path[_0xbcc1('0x5c')](config[_0xbcc1('0x6a')],_0xbcc1('0x62')),'utf8');var _0x3683f2=ejs['render'](_0x20b548,{'networks':_0x3b9f64||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x64'),_0x3683f2);return respondWithRpcPromise(_0xbcc1('0x61'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x537ac9=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config[_0xbcc1('0x6a')],'server/files/templates/network.ejs'),_0xbcc1('0x63'));var _0x9805d6=ejs[_0xbcc1('0x5e')](_0x537ac9,{'networks':_0x3b9f64||[]});fs[_0xbcc1('0x5f')](util[_0xbcc1('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x4ea0a1[_0xbcc1('0x58')][_0xbcc1('0x3a')][_0xbcc1('0x67')]()),_0x9805d6);return respondWithRpcPromise(_0xbcc1('0x61'),_0xbcc1('0x32'),{'module':'chan_sip.so'});}return null;})[_0xbcc1('0x25')](handleError(_0x392a6b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index c8085e8..a29f86b 100644 --- a/server/api/network/network.model.js +++ b/server/api/network/network.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74f0=['define','Network','network','util','moment','bluebird','request-promise','path','./network.attributes','exports'];(function(_0x483234,_0x8abfc6){var _0x488339=function(_0x46ec76){while(--_0x46ec76){_0x483234['push'](_0x483234['shift']());}};_0x488339(++_0x8abfc6);}(_0x74f0,0xf3));var _0x074f=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0x74f0[_0x366388];return _0x41c97e;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x074f('0x1'));var BPromise=require(_0x074f('0x2'));var rp=require(_0x074f('0x3'));var fs=require('fs');var path=require(_0x074f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x074f('0x5'));module[_0x074f('0x6')]=function(_0x203f47,_0x126607){return _0x203f47[_0x074f('0x7')](_0x074f('0x8'),attributes,{'tableName':_0x074f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce3=['./network.attributes','Network','network','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x24dbd2,_0x301ea6){var _0x5c6153=function(_0x2fbe33){while(--_0x2fbe33){_0x24dbd2['push'](_0x24dbd2['shift']());}};_0x5c6153(++_0x301ea6);}(_0x8ce3,0xc3));var _0x38ce=function(_0x4b2993,_0xd46430){_0x4b2993=_0x4b2993-0x0;var _0x480074=_0x8ce3[_0x4b2993];return _0x480074;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var moment=require(_0x38ce('0x3'));var BPromise=require(_0x38ce('0x4'));var rp=require(_0x38ce('0x5'));var fs=require('fs');var path=require(_0x38ce('0x6'));var rimraf=require(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var attributes=require(_0x38ce('0x9'));module['exports']=function(_0x372f86,_0xb24f4c){return _0x372f86['define'](_0x38ce('0xa'),attributes,{'tableName':_0x38ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index a4825e1..0ff98d0 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xd04fe8,_0x2197f6){var _0x8c9001=function(_0x24da4c){while(--_0x24da4c){_0xd04fe8['push'](_0xd04fe8['shift']());}};_0x8c9001(++_0x2197f6);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x18fe30,_0x3bfe7a){_0x18fe30=_0x18fe30-0x0;var _0x194ee9=_0x7a54[_0x18fe30];return _0x194ee9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 902c64c..bce27ce 100644 --- a/server/api/openchannelAccount/index.js +++ b/server/api/openchannelAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9295=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','/describe','isAuthenticated','describe','/:id/canned_answers','/:id/applications','getApplications','getInteractions','post','create','/:id/dispositions','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions'];(function(_0x568760,_0x538d94){var _0x319cfa=function(_0xff8470){while(--_0xff8470){_0x568760['push'](_0x568760['shift']());}};_0x319cfa(++_0x538d94);}(_0x9295,0x118));var _0x5929=function(_0x31989f,_0x454f1b){_0x31989f=_0x31989f-0x0;var _0x228861=_0x9295[_0x31989f];return _0x228861;};'use strict';var multer=require(_0x5929('0x0'));var util=require(_0x5929('0x1'));var path=require(_0x5929('0x2'));var timeout=require(_0x5929('0x3'));var express=require(_0x5929('0x4'));var router=express[_0x5929('0x5')]();var fs_extra=require(_0x5929('0x6'));var auth=require(_0x5929('0x7'));var interaction=require(_0x5929('0x8'));var config=require(_0x5929('0x9'));var controller=require(_0x5929('0xa'));router[_0x5929('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5929('0xb')](_0x5929('0xc'),auth[_0x5929('0xd')](),controller[_0x5929('0xe')]);router[_0x5929('0xb')]('/:id',auth[_0x5929('0xd')](),controller['show']);router[_0x5929('0xb')]('/:id/dispositions',auth[_0x5929('0xd')](),controller['getDispositions']);router[_0x5929('0xb')](_0x5929('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x5929('0xb')](_0x5929('0x10'),auth[_0x5929('0xd')](),controller[_0x5929('0x11')]);router[_0x5929('0xb')]('/:id/interactions',auth[_0x5929('0xd')](),controller[_0x5929('0x12')]);router[_0x5929('0xb')]('/:id/users',auth[_0x5929('0xd')](),controller['getAgents']);router[_0x5929('0x13')]('/',auth[_0x5929('0xd')](),controller[_0x5929('0x14')]);router[_0x5929('0x13')](_0x5929('0x15'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x5929('0x13')](_0x5929('0xf'),auth[_0x5929('0xd')](),controller['addAnswer']);router[_0x5929('0x13')](_0x5929('0x16'),controller[_0x5929('0x17')]);router[_0x5929('0x13')](_0x5929('0x10'),auth[_0x5929('0xd')](),controller[_0x5929('0x18')]);router[_0x5929('0x13')](_0x5929('0x19'),auth[_0x5929('0xd')](),controller[_0x5929('0x1a')]);router[_0x5929('0x13')](_0x5929('0x1b'),auth[_0x5929('0xd')](),controller[_0x5929('0x1c')]);router[_0x5929('0x1d')](_0x5929('0x1e'),auth['isAuthenticated'](),controller[_0x5929('0x1f')]);router[_0x5929('0x20')](_0x5929('0x1e'),auth[_0x5929('0xd')](),controller[_0x5929('0x21')]);router[_0x5929('0x20')](_0x5929('0x15'),auth['isAuthenticated'](),controller[_0x5929('0x22')]);router['delete'](_0x5929('0xf'),auth[_0x5929('0xd')](),controller['removeAnswers']);router[_0x5929('0x20')](_0x5929('0x19'),auth[_0x5929('0xd')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xd5bc=['../../config/environment','./openchannelAccount.controller','index','get','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','getAgents','create','addDisposition','addAnswer','post','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','update','/:id','destroy','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5de754,_0x277417){var _0x404421=function(_0x310e7a){while(--_0x310e7a){_0x5de754['push'](_0x5de754['shift']());}};_0x404421(++_0x277417);}(_0xd5bc,0x74));var _0xcd5b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd5bc[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xcd5b('0x0'));var util=require(_0xcd5b('0x1'));var path=require(_0xcd5b('0x2'));var timeout=require(_0xcd5b('0x3'));var express=require(_0xcd5b('0x4'));var router=express[_0xcd5b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcd5b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcd5b('0x7'));var controller=require(_0xcd5b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcd5b('0x9')]);router[_0xcd5b('0xa')](_0xcd5b('0xb'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0xd')]);router[_0xcd5b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xcd5b('0xe')]);router[_0xcd5b('0xa')](_0xcd5b('0xf'),auth['isAuthenticated'](),controller[_0xcd5b('0x10')]);router[_0xcd5b('0xa')]('/:id/canned_answers',auth[_0xcd5b('0xc')](),controller['getAnswers']);router['get'](_0xcd5b('0x11'),auth['isAuthenticated'](),controller[_0xcd5b('0x12')]);router[_0xcd5b('0xa')]('/:id/interactions',auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x13')]);router[_0xcd5b('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xcd5b('0x14')]);router['post']('/',auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x15')]);router['post'](_0xcd5b('0xf'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x16')]);router['post']('/:id/canned_answers',auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x17')]);router[_0xcd5b('0x18')](_0xcd5b('0x19'),controller[_0xcd5b('0x1a')]);router['post'](_0xcd5b('0x11'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x1b')]);router[_0xcd5b('0x18')](_0xcd5b('0x1c'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x1d')]);router['post'](_0xcd5b('0x1e'),auth['isAuthenticated'](),controller[_0xcd5b('0x1f')]);router['put']('/:id',auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x20')]);router['delete'](_0xcd5b('0x21'),auth['isAuthenticated'](),controller[_0xcd5b('0x22')]);router[_0xcd5b('0x23')](_0xcd5b('0xf'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x24')]);router['delete'](_0xcd5b('0x25'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x26')]);router['delete']('/:id/users',auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x27')]);module[_0xcd5b('0x28')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 36cebc9..14e6aaa 100644 --- a/server/api/openchannelAccount/openchannelAccount.attributes.js +++ b/server/api/openchannelAccount/openchannelAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cd8=['exports','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring'];(function(_0x5c0411,_0x4e88e9){var _0x510a72=function(_0x2dcb35){while(--_0x2dcb35){_0x5c0411['push'](_0x5c0411['shift']());}};_0x510a72(++_0x4e88e9);}(_0x1cd8,0x111));var _0x81cd=function(_0x478bcf,_0x11eb51){_0x478bcf=_0x478bcf-0x0;var _0x4b84e0=_0x1cd8[_0x478bcf];return _0x4b84e0;};'use strict';var Sequelize=require(_0x81cd('0x0'));var rs=require(_0x81cd('0x1'));module[_0x81cd('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x81cd('0x3')]},'token':{'type':Sequelize[_0x81cd('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x81cd('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x81cd('0x4')],'defaultValue':function(){return _0x81cd('0x5');}},'notificationSound':{'type':Sequelize[_0x81cd('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x81cd('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x81cd('0x3')]},'queueTransfer':{'type':Sequelize[_0x81cd('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x81cd('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x81cd('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x81cd('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x81cd('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x81cd('0x6')],'defaultValue':![],'comment':_0x81cd('0x9'),'set':function(_0x1ed63a){if(!_0x1ed63a)this[_0x81cd('0xa')]('mandatoryDispositionPauseId',null);this[_0x81cd('0xa')]('mandatoryDisposition',_0x1ed63a);}}}; \ No newline at end of file +var _0x22e9=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x1ee81d,_0x492ff9){var _0x24e22d=function(_0x4cee2c){while(--_0x4cee2c){_0x1ee81d['push'](_0x1ee81d['shift']());}};_0x24e22d(++_0x492ff9);}(_0x22e9,0xad));var _0x922e=function(_0x2e249d,_0x41b7e7){_0x2e249d=_0x2e249d-0x0;var _0x1faa37=_0x22e9[_0x2e249d];return _0x1faa37;};'use strict';var Sequelize=require(_0x922e('0x0'));var rs=require(_0x922e('0x1'));module[_0x922e('0x2')]={'name':{'type':Sequelize[_0x922e('0x3')],'unique':_0x922e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x922e('0x3')]},'token':{'type':Sequelize[_0x922e('0x3')],'defaultValue':function(){return rs[_0x922e('0x5')]();}},'replyUri':{'type':Sequelize[_0x922e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x922e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x922e('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x922e('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x922e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x922e('0x3')]},'queueTransfer':{'type':Sequelize[_0x922e('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x922e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x922e('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x922e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x922e('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x922e('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x922e('0x6')],'defaultValue':![],'comment':_0x922e('0x9'),'set':function(_0x4deed4){if(!_0x4deed4)this[_0x922e('0xa')](_0x922e('0xb'),null);this[_0x922e('0xa')](_0x922e('0xc'),_0x4deed4);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index af1dd20..f6898d6 100644 --- a/server/api/openchannelAccount/openchannelAccount.controller.js +++ b/server/api/openchannelAccount/openchannelAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2ad=['keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','params','Pause','includeAll','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','rawAttributes','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','Applications','account','applications','orderBy','priority','asc','Contacts','from','CmContact','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','firstName','messageId','interaction','created','push','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','stack','finally','json','getApplications','Contact','internal','Tags','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','model'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0xf2ad,0x78));var _0xdf2a=function(_0x385467,_0x298239){_0x385467=_0x385467-0x0;var _0x5ed67e=_0xf2ad[_0x385467];return _0x5ed67e;};'use strict';var emlformat=require(_0xdf2a('0x0'));var rimraf=require(_0xdf2a('0x1'));var zipdir=require(_0xdf2a('0x2'));var jsonpatch=require(_0xdf2a('0x3'));var rp=require(_0xdf2a('0x4'));var moment=require(_0xdf2a('0x5'));var BPromise=require(_0xdf2a('0x6'));var Mustache=require('mustache');var util=require(_0xdf2a('0x7'));var path=require(_0xdf2a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdf2a('0x9'));var fs=require('fs');var fs_extra=require(_0xdf2a('0xa'));var _=require(_0xdf2a('0xb'));var squel=require('squel');var crypto=require(_0xdf2a('0xc'));var jsforce=require(_0xdf2a('0xd'));var deskjs=require(_0xdf2a('0xe'));var toCsv=require(_0xdf2a('0xf'));var querystring=require(_0xdf2a('0x10'));var Papa=require('papaparse');var Redis=require(_0xdf2a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf2a('0x12'));var logger=require(_0xdf2a('0x13'))('api');var utils=require(_0xdf2a('0x14'));var config=require(_0xdf2a('0x15'));var licenseUtil=require(_0xdf2a('0x16'));var db=require('../../mysqldb')['db'];config[_0xdf2a('0x17')]=_[_0xdf2a('0x18')](config[_0xdf2a('0x17')],{'host':_0xdf2a('0x19'),'port':0x18eb});var socket=require(_0xdf2a('0x1a'))(new Redis(config['redis']));require(_0xdf2a('0x1b'))['register'](socket);var jayson=require(_0xdf2a('0x1c'));var client=jayson['client'][_0xdf2a('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39a5cf,_0x48121d,_0x24917b,_0x14ee6f){return new BPromise(function(_0x47c024,_0x3f33e9){var _0x1b8f17=_0x14ee6f||client;return _0x1b8f17[_0xdf2a('0x1e')](_0x39a5cf,_0x24917b)['then'](function(_0x424cdd){logger[_0xdf2a('0x1f')](_0xdf2a('0x20'),_0x48121d,_0xdf2a('0x21'));logger['debug'](_0xdf2a('0x22'),_0x48121d,_0xdf2a('0x21'),JSON[_0xdf2a('0x23')](_0x424cdd));if(_0x424cdd[_0xdf2a('0x24')]){if(_0x424cdd[_0xdf2a('0x24')][_0xdf2a('0x25')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x48121d,_0x424cdd[_0xdf2a('0x24')]['message']);return _0x3f33e9(_0x424cdd[_0xdf2a('0x24')][_0xdf2a('0x26')]);}logger[_0xdf2a('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x48121d,_0x424cdd[_0xdf2a('0x24')][_0xdf2a('0x26')]);return _0x47c024(_0x424cdd[_0xdf2a('0x24')][_0xdf2a('0x26')]);}else{logger[_0xdf2a('0x1f')](_0xdf2a('0x20'),_0x48121d,_0xdf2a('0x21'));_0x47c024(_0x424cdd[_0xdf2a('0x27')][_0xdf2a('0x26')]);}})[_0xdf2a('0x28')](function(_0x5d21ac){logger[_0xdf2a('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x48121d,_0x5d21ac);_0x3f33e9(_0x5d21ac);});});}function respondWithStatusCode(_0x5a7ad4,_0x35119b){_0x35119b=_0x35119b||0xcc;return function(_0x3d1f8b){if(_0x3d1f8b){return _0x5a7ad4[_0xdf2a('0x29')](_0x35119b);}return _0x5a7ad4[_0xdf2a('0x2a')](_0x35119b)[_0xdf2a('0x2b')]();};}function respondWithResult(_0x3809be,_0x1b640f){_0x1b640f=_0x1b640f||0xc8;return function(_0x1397e1){if(_0x1397e1){return _0x3809be[_0xdf2a('0x2a')](_0x1b640f)['json'](_0x1397e1);}};}function respondWithFilteredResult(_0x2ee82b,_0x3ca075){return function(_0x547828){if(_0x547828){var _0x3a1796=typeof _0x3ca075[_0xdf2a('0x2c')]==='undefined'&&typeof _0x3ca075[_0xdf2a('0x2d')]===_0xdf2a('0x2e');var _0x8009e5=_0x547828[_0xdf2a('0x2f')];var _0x74ebbd=_0x3a1796?0x0:_0x3ca075[_0xdf2a('0x2c')];var _0x19a325=_0x3a1796?_0x547828['count']:_0x3ca075['offset']+_0x3ca075[_0xdf2a('0x2d')];var _0x5cdb98;if(_0x19a325>=_0x8009e5){_0x19a325=_0x8009e5;_0x5cdb98=0xc8;}else{_0x5cdb98=0xce;}_0x2ee82b[_0xdf2a('0x2a')](_0x5cdb98);return _0x2ee82b[_0xdf2a('0x30')](_0xdf2a('0x31'),_0x74ebbd+'-'+_0x19a325+'/'+_0x8009e5)['json'](_0x547828);}return null;};}function patchUpdates(_0x441253){return function(_0x3bacf5){try{jsonpatch[_0xdf2a('0x32')](_0x3bacf5,_0x441253,!![]);}catch(_0x17eb90){return BPromise[_0xdf2a('0x33')](_0x17eb90);}return _0x3bacf5[_0xdf2a('0x34')]();};}function saveUpdates(_0x34d615,_0x5d45de){return function(_0xf657f8){if(_0xf657f8){return _0xf657f8[_0xdf2a('0x35')](_0x34d615)[_0xdf2a('0x36')](function(_0x1b6b99){return _0x1b6b99;});}return null;};}function removeEntity(_0x46ae55,_0x128a91){return function(_0x3a0947){if(_0x3a0947){return _0x3a0947[_0xdf2a('0x37')]()[_0xdf2a('0x36')](function(){var _0x494950=_0x3a0947[_0xdf2a('0x38')]({'plain':!![]});var _0x59287d=_0xdf2a('0x39');return db[_0xdf2a('0x3a')][_0xdf2a('0x37')]({'where':{'type':_0x59287d,'resourceId':_0x494950['id']}})['then'](function(){return _0x3a0947;});})['then'](function(){_0x46ae55[_0xdf2a('0x2a')](0xcc)[_0xdf2a('0x2b')]();});}};}function handleEntityNotFound(_0xc90a92,_0x50e18f){return function(_0x243167){if(!_0x243167){_0xc90a92['sendStatus'](0x194);}return _0x243167;};}function handleError(_0x846a6f,_0x431298){_0x431298=_0x431298||0x1f4;return function(_0xb4e2cf){logger[_0xdf2a('0x24')](_0xb4e2cf['stack']);if(_0xb4e2cf[_0xdf2a('0x3b')]){delete _0xb4e2cf[_0xdf2a('0x3b')];}_0x846a6f[_0xdf2a('0x2a')](_0x431298)[_0xdf2a('0x3c')](_0xb4e2cf);};}exports[_0xdf2a('0x3d')]=function(_0x1496b0,_0x1c0fec){var _0x342b45={'include':[{'model':db['Pause'],'as':_0xdf2a('0x3e')}]},_0x1ebb2c={},_0x5cf4f9={'count':0x0,'rows':[]};var _0x71143f=_[_0xdf2a('0x3f')](db[_0xdf2a('0x40')]['rawAttributes'],function(_0x1ec100){return{'name':_0x1ec100[_0xdf2a('0x41')],'type':_0x1ec100[_0xdf2a('0x42')]['key']};});_0x1ebb2c[_0xdf2a('0x43')]=_[_0xdf2a('0x3f')](_0x71143f,_0xdf2a('0x3b'));_0x1ebb2c['query']=_[_0xdf2a('0x44')](_0x1496b0[_0xdf2a('0x45')]);_0x1ebb2c['filters']=_['intersection'](_0x1ebb2c[_0xdf2a('0x43')],_0x1ebb2c[_0xdf2a('0x45')]);_0x342b45[_0xdf2a('0x46')]=_[_0xdf2a('0x47')](_0x1ebb2c[_0xdf2a('0x43')],qs['fields'](_0x1496b0[_0xdf2a('0x45')][_0xdf2a('0x48')]));_0x342b45[_0xdf2a('0x46')]=_0x342b45[_0xdf2a('0x46')][_0xdf2a('0x49')]?_0x342b45[_0xdf2a('0x46')]:_0x1ebb2c[_0xdf2a('0x43')];if(!_0x1496b0[_0xdf2a('0x45')][_0xdf2a('0x4a')](_0xdf2a('0x4b'))){_0x342b45['limit']=qs[_0xdf2a('0x2d')](_0x1496b0[_0xdf2a('0x45')]['limit']);_0x342b45[_0xdf2a('0x2c')]=qs[_0xdf2a('0x2c')](_0x1496b0[_0xdf2a('0x45')][_0xdf2a('0x2c')]);}_0x342b45['order']=qs['sort'](_0x1496b0[_0xdf2a('0x45')][_0xdf2a('0x4c')]);_0x342b45[_0xdf2a('0x4d')]=qs[_0xdf2a('0x4e')](_[_0xdf2a('0x4f')](_0x1496b0[_0xdf2a('0x45')],_0x1ebb2c['filters']),_0x71143f);if(_0x1496b0[_0xdf2a('0x45')]['filter']){_0x342b45[_0xdf2a('0x4d')]=_[_0xdf2a('0x50')](_0x342b45[_0xdf2a('0x4d')],{'$or':_[_0xdf2a('0x3f')](_0x71143f,function(_0x440539){if(_0x440539['type']!==_0xdf2a('0x51')){var _0xf40dba={};_0xf40dba[_0x440539[_0xdf2a('0x3b')]]={'$like':'%'+_0x1496b0[_0xdf2a('0x45')][_0xdf2a('0x52')]+'%'};return _0xf40dba;}})});}_0x342b45=_[_0xdf2a('0x50')]({},_0x342b45,_0x1496b0[_0xdf2a('0x53')]);var _0x15cba4={'where':_0x342b45[_0xdf2a('0x4d')]};return db[_0xdf2a('0x40')][_0xdf2a('0x2f')](_0x15cba4)[_0xdf2a('0x36')](function(_0x37e75e){_0x5cf4f9[_0xdf2a('0x2f')]=_0x37e75e;if(_0x1496b0[_0xdf2a('0x45')]['includeAll']){_0x342b45['include']=[{'all':!![]}];}return db[_0xdf2a('0x40')][_0xdf2a('0x54')](_0x342b45);})['then'](function(_0xed1262){_0x5cf4f9[_0xdf2a('0x55')]=_0xed1262;return _0x5cf4f9;})[_0xdf2a('0x36')](respondWithFilteredResult(_0x1c0fec,_0x342b45))[_0xdf2a('0x28')](handleError(_0x1c0fec,null));};exports['show']=function(_0x4f69fe,_0x465afe){var _0x50d520={'raw':![],'where':{'id':_0x4f69fe[_0xdf2a('0x56')]['id']},'include':[{'model':db[_0xdf2a('0x57')],'as':_0xdf2a('0x3e')}]},_0x1eb304={};_0x1eb304[_0xdf2a('0x43')]=_[_0xdf2a('0x44')](db[_0xdf2a('0x40')]['rawAttributes']);_0x1eb304[_0xdf2a('0x45')]=_['keys'](_0x4f69fe['query']);_0x1eb304['filters']=_[_0xdf2a('0x47')](_0x1eb304[_0xdf2a('0x43')],_0x1eb304[_0xdf2a('0x45')]);_0x50d520['attributes']=_[_0xdf2a('0x47')](_0x1eb304[_0xdf2a('0x43')],qs['fields'](_0x4f69fe[_0xdf2a('0x45')][_0xdf2a('0x48')]));_0x50d520[_0xdf2a('0x46')]=_0x50d520[_0xdf2a('0x46')][_0xdf2a('0x49')]?_0x50d520['attributes']:_0x1eb304[_0xdf2a('0x43')];if(_0x4f69fe[_0xdf2a('0x45')][_0xdf2a('0x58')]){_0x50d520[_0xdf2a('0x59')]=[{'all':!![]}];}_0x50d520=_[_0xdf2a('0x50')]({},_0x50d520,_0x4f69fe['options']);return db['OpenchannelAccount'][_0xdf2a('0x5a')](_0x50d520)[_0xdf2a('0x36')](handleEntityNotFound(_0x465afe,null))['then'](respondWithResult(_0x465afe,null))[_0xdf2a('0x28')](handleError(_0x465afe,null));};exports[_0xdf2a('0x5b')]=function(_0x2ddab4,_0x14e56b){return db[_0xdf2a('0x40')][_0xdf2a('0x5b')](_0x2ddab4[_0xdf2a('0x5c')],{})['then'](function(_0xa944d6){var _0x4b8450=_0x2ddab4[_0xdf2a('0x5d')][_0xdf2a('0x38')]({'plain':!![]});if(!_0x4b8450)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b8450[_0xdf2a('0x5e')]===_0xdf2a('0x5d')){var _0x482945=_0xa944d6[_0xdf2a('0x38')]({'plain':!![]});var _0x514b84=_0xdf2a('0x39');return db[_0xdf2a('0x5f')][_0xdf2a('0x5a')]({'where':{'name':_0x514b84,'userProfileId':_0x4b8450[_0xdf2a('0x60')]},'raw':!![]})['then'](function(_0x29bf0a){if(_0x29bf0a&&_0x29bf0a[_0xdf2a('0x61')]===0x0){return db['UserProfileResource'][_0xdf2a('0x5b')]({'name':_0x482945[_0xdf2a('0x3b')],'resourceId':_0x482945['id'],'type':_0x29bf0a[_0xdf2a('0x3b')],'sectionId':_0x29bf0a['id']},{})[_0xdf2a('0x36')](function(){return _0xa944d6;});}else{return _0xa944d6;}})[_0xdf2a('0x28')](function(_0x486ec8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x486ec8);throw _0x486ec8;});}return _0xa944d6;})['then'](respondWithResult(_0x14e56b,0xc9))['catch'](handleError(_0x14e56b,null));};exports[_0xdf2a('0x35')]=function(_0x46b1e6,_0x2dd69f){if(_0x46b1e6[_0xdf2a('0x5c')]['id']){delete _0x46b1e6['body']['id'];}return db[_0xdf2a('0x40')]['find']({'where':{'id':_0x46b1e6[_0xdf2a('0x56')]['id']},'include':[{'model':db[_0xdf2a('0x57')],'as':_0xdf2a('0x3e')}]})[_0xdf2a('0x36')](handleEntityNotFound(_0x2dd69f,null))[_0xdf2a('0x36')](saveUpdates(_0x46b1e6[_0xdf2a('0x5c')],null))[_0xdf2a('0x36')](respondWithResult(_0x2dd69f,null))[_0xdf2a('0x28')](handleError(_0x2dd69f,null));};exports['destroy']=function(_0x4dfcaf,_0xe2a8a7){return db['OpenchannelAccount']['find']({'where':{'id':_0x4dfcaf[_0xdf2a('0x56')]['id']}})[_0xdf2a('0x36')](handleEntityNotFound(_0xe2a8a7,null))[_0xdf2a('0x36')](removeEntity(_0xe2a8a7,null))[_0xdf2a('0x28')](handleError(_0xe2a8a7,null));};exports[_0xdf2a('0x62')]=function(_0x593d2f,_0x394b92){return db[_0xdf2a('0x40')]['describe']()[_0xdf2a('0x36')](respondWithResult(_0x394b92,null))[_0xdf2a('0x28')](handleError(_0x394b92,null));};exports[_0xdf2a('0x63')]=function(_0x29b328,_0x319146,_0x7ca1cf){if(_0x29b328[_0xdf2a('0x5c')]['id']){delete _0x29b328[_0xdf2a('0x5c')]['id'];}return db[_0xdf2a('0x40')][_0xdf2a('0x5a')]({'where':{'id':_0x29b328['params']['id']}})[_0xdf2a('0x36')](handleEntityNotFound(_0x319146,null))[_0xdf2a('0x36')](function(_0x33b7f4){if(_0x33b7f4){_0x29b328[_0xdf2a('0x5c')][_0xdf2a('0x64')]=_0x33b7f4['id'];return db['Disposition'][_0xdf2a('0x5b')](_0x29b328[_0xdf2a('0x5c')]);}})['then'](respondWithResult(_0x319146,null))[_0xdf2a('0x28')](handleError(_0x319146,null));};exports[_0xdf2a('0x65')]=function(_0x2d205d,_0x1c2a27,_0x432acd){var _0xf0696={'raw':![],'where':{}};var _0x4ba8b1={};var _0x5db8a4={'count':0x0,'rows':[]};return db[_0xdf2a('0x40')]['findOne']({'where':{'id':_0x2d205d[_0xdf2a('0x56')]['id']}})[_0xdf2a('0x36')](handleEntityNotFound(_0x1c2a27,null))['then'](function(_0x17a6fe){if(_0x17a6fe){_0x4ba8b1['model']=_['keys'](db[_0xdf2a('0x66')][_0xdf2a('0x67')]);_0x4ba8b1[_0xdf2a('0x45')]=_[_0xdf2a('0x44')](_0x2d205d[_0xdf2a('0x45')]);_0x4ba8b1[_0xdf2a('0x4e')]=_[_0xdf2a('0x47')](_0x4ba8b1[_0xdf2a('0x43')],_0x4ba8b1[_0xdf2a('0x45')]);_0xf0696['attributes']=_['intersection'](_0x4ba8b1[_0xdf2a('0x43')],qs[_0xdf2a('0x48')](_0x2d205d[_0xdf2a('0x45')]['fields']));_0xf0696[_0xdf2a('0x46')]=_0xf0696['attributes'][_0xdf2a('0x49')]?_0xf0696['attributes']:_0x4ba8b1[_0xdf2a('0x43')];if(!_0x2d205d['query'][_0xdf2a('0x4a')](_0xdf2a('0x4b'))){_0xf0696[_0xdf2a('0x2d')]=qs[_0xdf2a('0x2d')](_0x2d205d[_0xdf2a('0x45')][_0xdf2a('0x2d')]);_0xf0696[_0xdf2a('0x2c')]=qs[_0xdf2a('0x2c')](_0x2d205d[_0xdf2a('0x45')][_0xdf2a('0x2c')]);}_0xf0696[_0xdf2a('0x68')]=qs[_0xdf2a('0x4c')](_0x2d205d['query'][_0xdf2a('0x4c')]);_0xf0696['where']=qs['filters'](_['pick'](_0x2d205d['query'],_0x4ba8b1[_0xdf2a('0x4e')]));_0xf0696['where'][_0xdf2a('0x64')]=_0x17a6fe['id'];if(_0x2d205d['query'][_0xdf2a('0x52')]){_0xf0696[_0xdf2a('0x4d')]=_['merge'](_0xf0696['where'],{'$or':_[_0xdf2a('0x3f')](_0xf0696['attributes'],function(_0xe0c189){var _0xdbc989={};_0xdbc989[_0xe0c189]={'$like':'%'+_0x2d205d[_0xdf2a('0x45')][_0xdf2a('0x52')]+'%'};return _0xdbc989;})});}_0xf0696=_[_0xdf2a('0x50')]({},_0xf0696,_0x2d205d['options']);return db['Disposition']['count']({'where':_0xf0696[_0xdf2a('0x4d')]})[_0xdf2a('0x36')](function(_0x3c8d91){_0x5db8a4['count']=_0x3c8d91;if(_0x2d205d[_0xdf2a('0x45')][_0xdf2a('0x58')]){_0xf0696['include']=[{'all':!![]}];}return db[_0xdf2a('0x66')][_0xdf2a('0x54')](_0xf0696);})['then'](function(_0x34fc7c){_0x5db8a4['rows']=_0x34fc7c;return _0x5db8a4;});}})[_0xdf2a('0x36')](respondWithFilteredResult(_0x1c2a27,_0xf0696))['catch'](handleError(_0x1c2a27,null));};exports[_0xdf2a('0x69')]=function(_0x10c9c4,_0x3faf7e,_0x16f810){return db['OpenchannelAccount'][_0xdf2a('0x5a')]({'where':{'id':_0x10c9c4[_0xdf2a('0x56')]['id']}})[_0xdf2a('0x36')](handleEntityNotFound(_0x3faf7e,null))[_0xdf2a('0x36')](function(_0x53a4e5){if(_0x53a4e5){return _0x53a4e5[_0xdf2a('0x69')](_0x10c9c4[_0xdf2a('0x45')][_0xdf2a('0x6a')]);}})['then'](respondWithStatusCode(_0x3faf7e,null))['catch'](handleError(_0x3faf7e,null));};exports[_0xdf2a('0x6b')]=function(_0x1dbb66,_0x4ea078,_0x5641c5){if(_0x1dbb66[_0xdf2a('0x5c')]['id']){delete _0x1dbb66[_0xdf2a('0x5c')]['id'];}return db[_0xdf2a('0x40')][_0xdf2a('0x5a')]({'where':{'id':_0x1dbb66[_0xdf2a('0x56')]['id']}})[_0xdf2a('0x36')](handleEntityNotFound(_0x4ea078,null))[_0xdf2a('0x36')](function(_0x2cc43e){if(_0x2cc43e){_0x1dbb66['body'][_0xdf2a('0x64')]=_0x2cc43e['id'];return db[_0xdf2a('0x6c')][_0xdf2a('0x5b')](_0x1dbb66[_0xdf2a('0x5c')]);}})[_0xdf2a('0x36')](respondWithResult(_0x4ea078,null))['catch'](handleError(_0x4ea078,null));};exports[_0xdf2a('0x6d')]=function(_0x1d45ed,_0x523996,_0x5e589c){var _0x3f4183={'raw':![],'where':{}};var _0x1f08d9={};var _0x3dc292={'count':0x0,'rows':[]};return db[_0xdf2a('0x40')][_0xdf2a('0x6e')]({'where':{'id':_0x1d45ed[_0xdf2a('0x56')]['id']}})['then'](handleEntityNotFound(_0x523996,null))[_0xdf2a('0x36')](function(_0x222213){if(_0x222213){_0x1f08d9[_0xdf2a('0x43')]=_[_0xdf2a('0x44')](db[_0xdf2a('0x6c')][_0xdf2a('0x67')]);_0x1f08d9[_0xdf2a('0x45')]=_[_0xdf2a('0x44')](_0x1d45ed[_0xdf2a('0x45')]);_0x1f08d9[_0xdf2a('0x4e')]=_[_0xdf2a('0x47')](_0x1f08d9[_0xdf2a('0x43')],_0x1f08d9[_0xdf2a('0x45')]);_0x3f4183['attributes']=_[_0xdf2a('0x47')](_0x1f08d9['model'],qs[_0xdf2a('0x48')](_0x1d45ed[_0xdf2a('0x45')][_0xdf2a('0x48')]));_0x3f4183['attributes']=_0x3f4183[_0xdf2a('0x46')][_0xdf2a('0x49')]?_0x3f4183[_0xdf2a('0x46')]:_0x1f08d9['model'];if(!_0x1d45ed[_0xdf2a('0x45')]['hasOwnProperty'](_0xdf2a('0x4b'))){_0x3f4183[_0xdf2a('0x2d')]=qs[_0xdf2a('0x2d')](_0x1d45ed[_0xdf2a('0x45')][_0xdf2a('0x2d')]);_0x3f4183[_0xdf2a('0x2c')]=qs[_0xdf2a('0x2c')](_0x1d45ed[_0xdf2a('0x45')][_0xdf2a('0x2c')]);}_0x3f4183['order']=qs[_0xdf2a('0x4c')](_0x1d45ed[_0xdf2a('0x45')][_0xdf2a('0x4c')]);_0x3f4183['where']=qs['filters'](_['pick'](_0x1d45ed['query'],_0x1f08d9[_0xdf2a('0x4e')]));_0x3f4183[_0xdf2a('0x4d')][_0xdf2a('0x64')]=_0x222213['id'];if(_0x1d45ed['query'][_0xdf2a('0x52')]){_0x3f4183[_0xdf2a('0x4d')]=_[_0xdf2a('0x50')](_0x3f4183['where'],{'$or':_[_0xdf2a('0x3f')](_0x3f4183[_0xdf2a('0x46')],function(_0x20d923){var _0x3380c9={};_0x3380c9[_0x20d923]={'$like':'%'+_0x1d45ed[_0xdf2a('0x45')][_0xdf2a('0x52')]+'%'};return _0x3380c9;})});}_0x3f4183=_[_0xdf2a('0x50')]({},_0x3f4183,_0x1d45ed[_0xdf2a('0x53')]);return db[_0xdf2a('0x6c')][_0xdf2a('0x2f')]({'where':_0x3f4183[_0xdf2a('0x4d')]})[_0xdf2a('0x36')](function(_0xf22a01){_0x3dc292['count']=_0xf22a01;if(_0x1d45ed[_0xdf2a('0x45')]['includeAll']){_0x3f4183[_0xdf2a('0x59')]=[{'all':!![]}];}return db[_0xdf2a('0x6c')][_0xdf2a('0x54')](_0x3f4183);})[_0xdf2a('0x36')](function(_0x5e5e0b){_0x3dc292[_0xdf2a('0x55')]=_0x5e5e0b;return _0x3dc292;});}})['then'](respondWithFilteredResult(_0x523996,_0x3f4183))['catch'](handleError(_0x523996,null));};exports['removeAnswers']=function(_0x35c539,_0x4a19ca,_0x550147){return db[_0xdf2a('0x40')]['find']({'where':{'id':_0x35c539[_0xdf2a('0x56')]['id']}})[_0xdf2a('0x36')](handleEntityNotFound(_0x4a19ca,null))[_0xdf2a('0x36')](function(_0x3e1dcd){if(_0x3e1dcd){return _0x3e1dcd[_0xdf2a('0x6f')](_0x35c539[_0xdf2a('0x45')][_0xdf2a('0x6a')]);}})[_0xdf2a('0x36')](respondWithStatusCode(_0x4a19ca,null))['catch'](handleError(_0x4a19ca,null));};exports[_0xdf2a('0x70')]=function(_0x8aebf6,_0x41d828,_0x12ab06){var _0x5b8b0a={'body':_0x8aebf6[_0xdf2a('0x5c')],'channel':_0xdf2a('0x71')};var _0x1792ca=[];var _0x599cac=[];var _0x4d2f1f={};var _0x3e4dc2=![];return db['CmContact'][_0xdf2a('0x62')]()[_0xdf2a('0x36')](function(_0x440bf2){if(!_0x440bf2){throw new db[(_0xdf2a('0x72'))]['ValidationError'](_0xdf2a('0x73'));}_0x1792ca=_[_0xdf2a('0x74')](_['keys'](_0x440bf2),[_0xdf2a('0x75'),_0xdf2a('0x76')]);_0x599cac=_[_0xdf2a('0x74')](_[_0xdf2a('0x44')](_0x440bf2),[_0xdf2a('0x75'),_0xdf2a('0x76'),_0xdf2a('0x77'),_0xdf2a('0x78')]);if(_0x8aebf6['body']['id']){delete _0x8aebf6[_0xdf2a('0x5c')]['id'];}if(_[_0xdf2a('0x79')](_0x8aebf6[_0xdf2a('0x5c')]['from'])){throw new db[(_0xdf2a('0x72'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x8aebf6['body'][_0xdf2a('0x5c')])||_0x8aebf6['body'][_0xdf2a('0x5c')]===''){throw new db[(_0xdf2a('0x72'))][(_0xdf2a('0x7a'))](_0xdf2a('0x7b'));}if(_['isNil'](_0x8aebf6[_0xdf2a('0x5c')]['mapKey'])){throw new db['Sequelize'][(_0xdf2a('0x7a'))](_0xdf2a('0x7c')+_0x599cac);}if(!_[_0xdf2a('0x7d')](_0x599cac,_0x8aebf6[_0xdf2a('0x5c')][_0xdf2a('0x7e')])){throw new db[(_0xdf2a('0x72'))][(_0xdf2a('0x7a'))](_0xdf2a('0x7f')+_0x599cac);}_0x4d2f1f[_0x8aebf6[_0xdf2a('0x5c')][_0xdf2a('0x7e')]]=_0x8aebf6[_0xdf2a('0x5c')]['from'];})[_0xdf2a('0x36')](function(){return db[_0xdf2a('0x40')][_0xdf2a('0x5a')]({'where':{'id':_0x8aebf6[_0xdf2a('0x56')]['id']},'include':[{'model':db[_0xdf2a('0x80')],'as':_0xdf2a('0x81'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4d2f1f,'limit':0x1,'order':[[_0xdf2a('0x76'),_0xdf2a('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':_0xdf2a('0x83')}]});})['then'](handleEntityNotFound(_0x41d828,null))[_0xdf2a('0x36')](function(_0x1b01ac){if(_0x1b01ac&&_0x1b01ac[_0xdf2a('0x81')]){_0x5b8b0a[_0xdf2a('0x84')]=_0x1b01ac;_0x5b8b0a[_0xdf2a('0x85')]=_0x1b01ac[_0xdf2a('0x83')];_0x5b8b0a['list']=_0x1b01ac[_0xdf2a('0x81')];_0x5b8b0a[_0xdf2a('0x85')]=_[_0xdf2a('0x86')](_0x5b8b0a[_0xdf2a('0x85')],[_0xdf2a('0x87')],[_0xdf2a('0x88')]);if(_0x5b8b0a[_0xdf2a('0x84')]['Applications']){delete _0x5b8b0a[_0xdf2a('0x84')]['Applications'];}if(_0x5b8b0a[_0xdf2a('0x84')][_0xdf2a('0x81')]&&_0x5b8b0a['account'][_0xdf2a('0x81')][_0xdf2a('0x89')][_0xdf2a('0x49')]){return _0x5b8b0a['account'][_0xdf2a('0x81')]['Contacts'][0x0];}var _0x21eb84=_[_0xdf2a('0x18')](_0x8aebf6[_0xdf2a('0x5c')],{'firstName':_0x8aebf6[_0xdf2a('0x5c')][_0xdf2a('0x8a')],'ListId':_0x1b01ac[_0xdf2a('0x78')]});_0x21eb84[_0x8aebf6[_0xdf2a('0x5c')][_0xdf2a('0x7e')]]=_0x8aebf6['body'][_0xdf2a('0x8a')];return db[_0xdf2a('0x8b')][_0xdf2a('0x5b')](_0x21eb84,{'fields':_0x1792ca,'raw':!![]});}})[_0xdf2a('0x36')](handleEntityNotFound(_0x41d828,null))[_0xdf2a('0x36')](function(_0x4934a1){_0x5b8b0a['contact']=_0x4934a1;if(_0x4934a1){var _0x576b5d={'ContactId':_0x4934a1['id'],'OpenchannelAccountId':_0x8aebf6[_0xdf2a('0x56')]['id'],'from':(_0x4934a1['firstName']||'')+'\x20'+(_0x4934a1['lastName']||'')};var _0x36c1d4={'OpenchannelAccountId':_0x8aebf6['params']['id'],'closed':![]};if(_0x8aebf6['body']['threadId']){_0x36c1d4['threadId']=_0x8aebf6[_0xdf2a('0x5c')][_0xdf2a('0x8c')];return db[_0xdf2a('0x8d')][_0xdf2a('0x5a')]({'where':_0x36c1d4})[_0xdf2a('0x36')](function(_0x42ec04){if(_0x42ec04){return[_0x42ec04,![]];}_0x576b5d[_0xdf2a('0x8c')]=_0x8aebf6['body'][_0xdf2a('0x8c')];_0x576b5d[_0xdf2a('0x8e')]=_0x8aebf6[_0xdf2a('0x5c')][_0xdf2a('0x8e')];return db[_0xdf2a('0x8d')][_0xdf2a('0x5b')](_0x576b5d)[_0xdf2a('0x36')](function(_0xb108fc){return[_0xb108fc,!![]];});});}else{_0x36c1d4[_0xdf2a('0x8c')]=null;}_0x36c1d4[_0xdf2a('0x8f')]=_0x4934a1['id'];return db['OpenchannelInteraction'][_0xdf2a('0x5a')]({'where':_0x36c1d4})[_0xdf2a('0x36')](function(_0x1cc046){if(_0x1cc046){return[_0x1cc046,![]];}return db[_0xdf2a('0x8d')][_0xdf2a('0x5b')](_0x576b5d)[_0xdf2a('0x36')](function(_0x40082c){return[_0x40082c,!![]];});});}})[_0xdf2a('0x90')](function(_0x4d5cab,_0x64fbba){if(_0x4d5cab){_0x3e4dc2=_0x64fbba;if(!_0x64fbba){var _0xa16ace={'from':(_0x5b8b0a[_0xdf2a('0x91')][_0xdf2a('0x92')]||'')+'\x20'+(_0x5b8b0a[_0xdf2a('0x91')]['lastName']||'')};if(_0x8aebf6['body']['threadId']&&_0x8aebf6[_0xdf2a('0x5c')][_0xdf2a('0x93')]&&_0x8aebf6[_0xdf2a('0x5c')][_0xdf2a('0x8c')]!=_0x8aebf6[_0xdf2a('0x5c')][_0xdf2a('0x93')]){_0xa16ace[_0xdf2a('0x8c')]=_0x8aebf6[_0xdf2a('0x5c')][_0xdf2a('0x93')];}return _0x4d5cab['update'](_0xa16ace);}else{return _0x4d5cab;}}})[_0xdf2a('0x36')](function(_0x6f0292){_0x5b8b0a[_0xdf2a('0x94')]=_0x6f0292[_0xdf2a('0x38')]({'plain':!![]});_0x5b8b0a[_0xdf2a('0x94')][_0xdf2a('0x95')]=_0x3e4dc2;if(_0x5b8b0a[_0xdf2a('0x94')]['created']){if(_0x5b8b0a[_0xdf2a('0x84')]['autoclose']){_0x5b8b0a['applications'][_0xdf2a('0x96')]({'id':0x0,'priority':_0x5b8b0a['applications']['length']+0x1,'app':'close','appdata':_0xdf2a('0x97'),'interval':'*,*,*,*'});}}return db[_0xdf2a('0x98')][_0xdf2a('0x5b')]({'body':_0x8aebf6['body']['body'],'OpenchannelAccountId':_0x8aebf6[_0xdf2a('0x56')]['id'],'OpenchannelInteractionId':_0x6f0292['id'],'direction':'in','ContactId':_0x5b8b0a[_0xdf2a('0x91')]['id'],'AttachmentId':_0x8aebf6['body'][_0xdf2a('0x99')]});})[_0xdf2a('0x36')](function(_0x1620a2){_0x5b8b0a[_0xdf2a('0x26')]=_0x1620a2;if(_0x5b8b0a[_0xdf2a('0x94')][_0xdf2a('0x9a')]){return db[_0xdf2a('0x9b')][_0xdf2a('0x5a')]({'attributes':['id','name'],'where':{'id':_0x5b8b0a[_0xdf2a('0x94')]['UserId']}})['then'](function(_0x323e1f){if(_0x323e1f){_0x5b8b0a[_0xdf2a('0x85')][_0xdf2a('0x9c')]({'id':0x0,'priority':0x0,'app':_0xdf2a('0x9d'),'appdata':_0x323e1f[_0xdf2a('0x3b')]+','+(_0x5b8b0a[_0xdf2a('0x84')][_0xdf2a('0x9e')]||0xa),'interval':'*,*,*,*'});_0x5b8b0a['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0xdf2a('0x9f'),_0x5b8b0a);});}return respondWithRpcPromise(_0xdf2a('0xa0'),_0xdf2a('0x9f'),_0x5b8b0a);})['then'](function(_0x35e368){respondWithRpcPromise('EventManager',_0xdf2a('0xa1'),{'event':_0xdf2a('0x70'),'message':_0x35e368},client9002);return _0x35e368;})[_0xdf2a('0x36')](respondWithResult(_0x41d828,null))[_0xdf2a('0x28')](handleError(_0x41d828,null));};exports[_0xdf2a('0xa2')]=function(_0x3ae51b,_0x537c63){var _0x3b0eb9=_0x3ae51b[_0xdf2a('0x56')]['id'];var _0x5e2bdc=_0x3ae51b[_0xdf2a('0x5c')];var _0x47fcc4=0xc8;var _0x274e5c=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xdf2a('0xa3')][_0xdf2a('0xa4')][_0xdf2a('0xa5')][_0xdf2a('0xa6')]},function(_0x36bc63){return db[_0xdf2a('0x40')][_0xdf2a('0x6e')]({'where':{'id':_0x3b0eb9},'transaction':_0x36bc63})[_0xdf2a('0x36')](function(_0x3f2e3f){if(_0x3f2e3f){return db[_0xdf2a('0xa7')]['destroy']({'where':{'OpenchannelAccountId':_0x3b0eb9},'transaction':_0x36bc63})[_0xdf2a('0x36')](function(){var _0x168eb3=_[_0xdf2a('0x3f')](_0x5e2bdc,function(_0x47b26e){_0x47b26e[_0xdf2a('0x64')]=_0x3b0eb9;return _0x47b26e;});return db[_0xdf2a('0xa7')][_0xdf2a('0xa8')](_0x168eb3,{'transaction':_0x36bc63});});}else{_0x47fcc4=0x194;_0x274e5c=[];}});})[_0xdf2a('0x36')](function(){if(_0x47fcc4!==0x194){return db['OpenchannelApplication'][_0xdf2a('0xa9')]({'where':{'OpenchannelAccountId':_0x3b0eb9},'order':_0xdf2a('0x87')})['then'](function(_0x5221d3){_0x274e5c=_0x5221d3;});}})[_0xdf2a('0x28')](function(_0x5d5fc1){_0x47fcc4=0x1f4;logger[_0xdf2a('0x24')](_0x5d5fc1[_0xdf2a('0xaa')]);if(_0x5d5fc1[_0xdf2a('0x3b')]){delete _0x5d5fc1['name'];}_0x274e5c=_0x5d5fc1;})[_0xdf2a('0xab')](function(){if(_0x274e5c===null){_0x537c63[_0xdf2a('0x29')](_0x47fcc4);}else{if(_0x47fcc4===0x1f4){_0x537c63[_0xdf2a('0x2a')](_0x47fcc4)[_0xdf2a('0x3c')](_0x274e5c);}else{_0x537c63[_0xdf2a('0x2a')](_0x47fcc4)[_0xdf2a('0xac')](_0x274e5c);}}});};exports[_0xdf2a('0xad')]=function(_0x4f094a,_0x2f06e4,_0x3fd07e){var _0xf79be9={};var _0x517988={};var _0x110507;var _0x45b464;return db['OpenchannelAccount'][_0xdf2a('0x6e')]({'where':{'id':_0x4f094a['params']['id']}})['then'](handleEntityNotFound(_0x2f06e4,null))[_0xdf2a('0x36')](function(_0x275245){if(_0x275245){_0x110507=_0x275245;_0x517988[_0xdf2a('0x43')]=_[_0xdf2a('0x44')](db[_0xdf2a('0xa7')][_0xdf2a('0x67')]);_0x517988[_0xdf2a('0x45')]=_[_0xdf2a('0x44')](_0x4f094a[_0xdf2a('0x45')]);_0x517988[_0xdf2a('0x4e')]=_['intersection'](_0x517988[_0xdf2a('0x43')],_0x517988['query']);_0xf79be9[_0xdf2a('0x46')]=_[_0xdf2a('0x47')](_0x517988[_0xdf2a('0x43')],qs[_0xdf2a('0x48')](_0x4f094a[_0xdf2a('0x45')][_0xdf2a('0x48')]));_0xf79be9[_0xdf2a('0x46')]=_0xf79be9[_0xdf2a('0x46')][_0xdf2a('0x49')]?_0xf79be9[_0xdf2a('0x46')]:_0x517988[_0xdf2a('0x43')];_0xf79be9[_0xdf2a('0x68')]=qs[_0xdf2a('0x4c')](_0x4f094a[_0xdf2a('0x45')]['sort']);_0xf79be9[_0xdf2a('0x4d')]=qs[_0xdf2a('0x4e')](_[_0xdf2a('0x4f')](_0x4f094a[_0xdf2a('0x45')],_0x517988[_0xdf2a('0x4e')]));if(_0x4f094a[_0xdf2a('0x45')][_0xdf2a('0x52')]){_0xf79be9[_0xdf2a('0x4d')]=_[_0xdf2a('0x50')](_0xf79be9['where'],{'$or':_[_0xdf2a('0x3f')](_0xf79be9[_0xdf2a('0x46')],function(_0x26eebc){var _0xde047f={};_0xde047f[_0x26eebc]={'$like':'%'+_0x4f094a[_0xdf2a('0x45')]['filter']+'%'};return _0xde047f;})});}_0xf79be9=_['merge']({},_0xf79be9,_0x4f094a[_0xdf2a('0x53')]);return _0x110507[_0xdf2a('0xad')](_0xf79be9);}})['then'](function(_0x3146a9){if(_0x3146a9){_0x45b464=_0x3146a9[_0xdf2a('0x49')];if(!_0x4f094a[_0xdf2a('0x45')]['hasOwnProperty'](_0xdf2a('0x4b'))){_0xf79be9['limit']=qs['limit'](_0x4f094a['query'][_0xdf2a('0x2d')]);_0xf79be9[_0xdf2a('0x2c')]=qs[_0xdf2a('0x2c')](_0x4f094a[_0xdf2a('0x45')][_0xdf2a('0x2c')]);}return _0x110507['getApplications'](_0xf79be9);}})[_0xdf2a('0x36')](function(_0xcbcdef){if(_0xcbcdef){return _0xcbcdef?{'count':_0x45b464,'rows':_0xcbcdef}:null;}})[_0xdf2a('0x36')](respondWithResult(_0x2f06e4,null))[_0xdf2a('0x28')](handleError(_0x2f06e4,null));};exports['getInteractions']=function(_0x39afcc,_0x3d0b69,_0x171b5a){var _0x4be582={'raw':![],'where':{}};var _0x2529ac={};var _0x252a16={'count':0x0,'rows':[]};return db[_0xdf2a('0x40')]['findOne']({'where':{'id':_0x39afcc['params']['id']}})[_0xdf2a('0x36')](handleEntityNotFound(_0x3d0b69,null))[_0xdf2a('0x36')](function(_0xc1e851){if(_0xc1e851){_0x2529ac[_0xdf2a('0x43')]=_[_0xdf2a('0x44')](db[_0xdf2a('0x8d')][_0xdf2a('0x67')]);_0x2529ac[_0xdf2a('0x45')]=_[_0xdf2a('0x44')](_0x39afcc[_0xdf2a('0x45')]);_0x2529ac[_0xdf2a('0x4e')]=_[_0xdf2a('0x47')](_0x2529ac[_0xdf2a('0x43')],_0x2529ac['query']);_0x4be582[_0xdf2a('0x46')]=_[_0xdf2a('0x47')](_0x2529ac[_0xdf2a('0x43')],qs[_0xdf2a('0x48')](_0x39afcc['query']['fields']));_0x4be582['attributes']=_0x4be582[_0xdf2a('0x46')][_0xdf2a('0x49')]?_0x4be582[_0xdf2a('0x46')]:_0x2529ac[_0xdf2a('0x43')];if(!_0x39afcc[_0xdf2a('0x45')][_0xdf2a('0x4a')](_0xdf2a('0x4b'))){_0x4be582[_0xdf2a('0x2d')]=qs[_0xdf2a('0x2d')](_0x39afcc[_0xdf2a('0x45')][_0xdf2a('0x2d')]);_0x4be582[_0xdf2a('0x2c')]=qs[_0xdf2a('0x2c')](_0x39afcc[_0xdf2a('0x45')][_0xdf2a('0x2c')]);}_0x4be582[_0xdf2a('0x68')]=qs[_0xdf2a('0x4c')](_0x39afcc[_0xdf2a('0x45')][_0xdf2a('0x4c')]);_0x4be582[_0xdf2a('0x4d')]=qs['filters'](_['pick'](_0x39afcc[_0xdf2a('0x45')],_0x2529ac[_0xdf2a('0x4e')]));_0x4be582['where'][_0xdf2a('0x64')]=_0xc1e851['id'];if(_0x39afcc[_0xdf2a('0x45')][_0xdf2a('0x52')]){_0x4be582[_0xdf2a('0x4d')]=_[_0xdf2a('0x50')](_0x4be582[_0xdf2a('0x4d')],{'$or':_[_0xdf2a('0x3f')](_0x4be582[_0xdf2a('0x46')],function(_0x5f4cae){var _0x3547d0={};_0x3547d0[_0x5f4cae]={'$like':'%'+_0x39afcc[_0xdf2a('0x45')]['filter']+'%'};return _0x3547d0;})});}_0x4be582=_['merge']({},_0x4be582,_0x39afcc['options']);return db[_0xdf2a('0x8d')]['count']({'where':_0x4be582[_0xdf2a('0x4d')]})[_0xdf2a('0x36')](function(_0x1d9e43){_0x252a16[_0xdf2a('0x2f')]=_0x1d9e43;if(_0x39afcc[_0xdf2a('0x45')][_0xdf2a('0x58')]){_0x4be582[_0xdf2a('0x59')]=[{'model':db[_0xdf2a('0x8b')],'as':_0xdf2a('0xae'),'required':![]},{'model':db[_0xdf2a('0x9b')],'as':'Owner','attributes':['name','fullname',_0xdf2a('0xaf')],'required':![]},{'model':db['Tag'],'as':_0xdf2a('0xb0'),'attributes':['id',_0xdf2a('0x3b'),'color'],'where':_0x39afcc[_0xdf2a('0x45')][_0xdf2a('0xb1')]?{'id':_0x39afcc[_0xdf2a('0x45')][_0xdf2a('0xb1')]}:undefined,'required':_0x39afcc[_0xdf2a('0x45')]['tag']?!![]:![]}];}return db[_0xdf2a('0x8d')]['findAll'](_0x4be582);})[_0xdf2a('0x36')](function(_0x169972){_0x252a16[_0xdf2a('0x55')]=_0x169972;return _0x252a16;});}})[_0xdf2a('0x36')](respondWithFilteredResult(_0x3d0b69,_0x4be582))['catch'](handleError(_0x3d0b69,null));};exports['addAgents']=function(_0x3e923f,_0x13a8db,_0x4ecccf){return db[_0xdf2a('0x40')][_0xdf2a('0x5a')]({'where':{'id':_0x3e923f['params']['id']}})[_0xdf2a('0x36')](handleEntityNotFound(_0x13a8db,null))['then'](function(_0x4eaad9){if(_0x4eaad9){return _0x4eaad9[_0xdf2a('0xb2')](_0x3e923f[_0xdf2a('0x5c')][_0xdf2a('0x6a')],_['omit'](_0x3e923f[_0xdf2a('0x5c')],['ids','id'])||{})[_0xdf2a('0x90')](function(_0x140b2a){for(var _0x2bfd43=0x0;_0x2bfd43<_0x3e923f['body'][_0xdf2a('0x6a')][_0xdf2a('0x49')];_0x2bfd43+=0x1){socket[_0xdf2a('0xb3')](_0xdf2a('0xb4'),{'UserId':Number(_0x3e923f[_0xdf2a('0x5c')]['ids'][_0x2bfd43]),'OpenchannelAccountId':Number(_0x3e923f[_0xdf2a('0x56')]['id'])});}return _0x140b2a;});}})['then'](respondWithResult(_0x13a8db,null))['catch'](handleError(_0x13a8db,null));};exports['removeAgents']=function(_0x42e762,_0x5d517d,_0x1779ee){return db[_0xdf2a('0x40')][_0xdf2a('0x5a')]({'where':{'id':_0x42e762[_0xdf2a('0x56')]['id']}})[_0xdf2a('0x36')](handleEntityNotFound(_0x5d517d,null))[_0xdf2a('0x36')](function(_0x106cd0){if(_0x106cd0){return _0x106cd0[_0xdf2a('0xb5')](_0x42e762[_0xdf2a('0x45')]['ids'])['then'](function(){if(_[_0xdf2a('0xb6')](_0x42e762['query'][_0xdf2a('0x6a')])){for(var _0x449f5a=0x0;_0x449f5a<_0x42e762['query'][_0xdf2a('0x6a')][_0xdf2a('0x49')];_0x449f5a+=0x1){socket[_0xdf2a('0xb3')](_0xdf2a('0xb7'),{'UserId':Number(_0x42e762[_0xdf2a('0x45')][_0xdf2a('0x6a')][_0x449f5a]),'OpenchannelAccountId':Number(_0x42e762[_0xdf2a('0x56')]['id'])});}}else{socket[_0xdf2a('0xb3')](_0xdf2a('0xb7'),{'UserId':Number(_0x42e762[_0xdf2a('0x45')][_0xdf2a('0x6a')]),'OpenchannelAccountId':Number(_0x42e762[_0xdf2a('0x56')]['id'])});}});}})[_0xdf2a('0x36')](respondWithStatusCode(_0x5d517d,null))[_0xdf2a('0x28')](handleError(_0x5d517d,null));};exports[_0xdf2a('0xb8')]=function(_0x2c9055,_0x1365bd,_0x195805){var _0x385348={};var _0x39c006={};var _0x37333d;var _0xabcbb5;return db['OpenchannelAccount'][_0xdf2a('0x6e')]({'where':{'id':_0x2c9055['params']['id']}})[_0xdf2a('0x36')](handleEntityNotFound(_0x1365bd,null))['then'](function(_0x50b48a){if(_0x50b48a){_0x37333d=_0x50b48a;_0x39c006['model']=_[_0xdf2a('0x44')](db[_0xdf2a('0x9b')][_0xdf2a('0x67')]);_0x39c006[_0xdf2a('0x45')]=_[_0xdf2a('0x44')](_0x2c9055['query']);_0x39c006['filters']=_[_0xdf2a('0x47')](_0x39c006[_0xdf2a('0x43')],_0x39c006[_0xdf2a('0x45')]);_0x385348[_0xdf2a('0x46')]=_['intersection'](_0x39c006[_0xdf2a('0x43')],qs[_0xdf2a('0x48')](_0x2c9055['query'][_0xdf2a('0x48')]));_0x385348[_0xdf2a('0x46')]=_0x385348[_0xdf2a('0x46')]['length']?_0x385348[_0xdf2a('0x46')]:_0x39c006[_0xdf2a('0x43')];_0x385348[_0xdf2a('0x68')]=qs['sort'](_0x2c9055[_0xdf2a('0x45')][_0xdf2a('0x4c')]);_0x385348[_0xdf2a('0x4d')]=qs[_0xdf2a('0x4e')](_[_0xdf2a('0x4f')](_0x2c9055[_0xdf2a('0x45')],_0x39c006[_0xdf2a('0x4e')]));if(_0x2c9055['query']['filter']){_0x385348[_0xdf2a('0x4d')]=_[_0xdf2a('0x50')](_0x385348[_0xdf2a('0x4d')],{'$or':_['map'](_0x385348[_0xdf2a('0x46')],function(_0x4a6298){var _0xe69e01={};_0xe69e01[_0x4a6298]={'$like':'%'+_0x2c9055[_0xdf2a('0x45')][_0xdf2a('0x52')]+'%'};return _0xe69e01;})});}_0x385348=_[_0xdf2a('0x50')]({},_0x385348,_0x2c9055[_0xdf2a('0x53')]);return _0x37333d[_0xdf2a('0xb8')](_0x385348);}})[_0xdf2a('0x36')](function(_0x123e77){if(_0x123e77){_0xabcbb5=_0x123e77[_0xdf2a('0x49')];if(!_0x2c9055[_0xdf2a('0x45')][_0xdf2a('0x4a')](_0xdf2a('0x4b'))){_0x385348[_0xdf2a('0x2d')]=qs[_0xdf2a('0x2d')](_0x2c9055[_0xdf2a('0x45')]['limit']);_0x385348[_0xdf2a('0x2c')]=qs[_0xdf2a('0x2c')](_0x2c9055[_0xdf2a('0x45')][_0xdf2a('0x2c')]);}return _0x37333d[_0xdf2a('0xb8')](_0x385348);}})['then'](function(_0x51fb06){if(_0x51fb06){return _0x51fb06?{'count':_0xabcbb5,'rows':_0x51fb06}:null;}})[_0xdf2a('0x36')](respondWithResult(_0x1365bd,null))[_0xdf2a('0x28')](handleError(_0x1365bd,null));};exports['send']=function(_0x428007,_0x252085,_0x1e33da){var _0x516eb0,_0x1b0b03,_0x2fa468;if(_[_0xdf2a('0x79')](_0x428007[_0xdf2a('0x5c')][_0xdf2a('0x5c')])||_0x428007[_0xdf2a('0x5c')][_0xdf2a('0x5c')]===''){throw new db[(_0xdf2a('0x72'))][(_0xdf2a('0x7a'))](_0xdf2a('0x7b'));}if(_[_0xdf2a('0x79')](_0x428007[_0xdf2a('0x5c')]['to'])){}_0x516eb0=_0x428007['body']['to'];return db[_0xdf2a('0x40')][_0xdf2a('0x6e')]({'where':{'id':_0x428007[_0xdf2a('0x56')]['id']}})[_0xdf2a('0x36')](handleEntityNotFound(_0x252085,null))[_0xdf2a('0x36')](function(_0x41b181){if(_0x41b181){return db[_0xdf2a('0x40')][_0xdf2a('0x5a')]({'where':{'id':_0x41b181['id']},'include':[{'model':db['CmList'],'as':_0xdf2a('0x81'),'include':[{'model':db[_0xdf2a('0x8b')],'as':'Contacts','where':{[_0x41b181['mapKey']]:_0x516eb0},'limit':0x1,'order':[[_0xdf2a('0x76'),_0xdf2a('0x82')]]}]}]})['then'](handleEntityNotFound(_0x252085,null))[_0xdf2a('0x36')](function(_0x39fb38){if(_0x39fb38&&_0x39fb38[_0xdf2a('0x81')]){_0x1b0b03=_0x39fb38[_0xdf2a('0x38')]({'plain':!![]});if(_0x1b0b03[_0xdf2a('0x81')]&&_0x1b0b03[_0xdf2a('0x81')][_0xdf2a('0x89')][_0xdf2a('0x49')]){return _0x1b0b03['List'][_0xdf2a('0x89')][0x0];}return db[_0xdf2a('0x8b')][_0xdf2a('0x5b')](_[_0xdf2a('0x18')](_0x428007[_0xdf2a('0x5c')],{'firstName':_0x516eb0,[_0x39fb38['mapKey']]:_0x516eb0,'phone':_0x516eb0,'ListId':_0x1b0b03['ListId']}));}})['then'](handleEntityNotFound(_0x252085,null))[_0xdf2a('0x36')](function(_0x8f04){if(_0x8f04){_0x2fa468=_0x8f04;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x2fa468['id'],'closed':![],'OpenchannelAccountId':_0x1b0b03['id']}})[_0xdf2a('0x36')](function(_0x5d717a){if(_0x5d717a){return[_0x5d717a,![]];}return db[_0xdf2a('0x8d')][_0xdf2a('0x5b')]({'UserId':_0x428007['user']['id'],'ContactId':_0x2fa468['id'],'OpenchannelAccountId':_0x1b0b03['id'],'lastMsgDirection':_0xdf2a('0xb9'),'Messages':[_['merge'](_0x428007[_0xdf2a('0x5c')],{'read':![],'body':_0x428007[_0xdf2a('0x5c')][_0xdf2a('0x5c')],'OpenchannelAccountId':_0x1b0b03['id'],'UserId':_0x428007[_0xdf2a('0x5d')]['id'],'ContactId':_0x2fa468['id']})]},{'include':[{'model':db[_0xdf2a('0x98')],'as':_0xdf2a('0xba')}]})[_0xdf2a('0x36')](function(_0x510d98){return[_0x510d98,!![]];});});}})[_0xdf2a('0x90')](function(_0x49111f,_0x2ad85d){if(_0x2ad85d){return _0x49111f;}return db[_0xdf2a('0x98')][_0xdf2a('0x5b')](_['merge'](_0x428007[_0xdf2a('0x5c')],{'read':![],'body':_0x428007[_0xdf2a('0x5c')]['body'],'OpenchannelAccountId':_0x1b0b03['id'],'OpenchannelInteractionId':_0x49111f['id'],'UserId':_0x428007[_0xdf2a('0x5d')]['id'],'ContactId':_0x2fa468['id']}))[_0xdf2a('0x36')](function(_0x43a11f){_0x49111f[_0xdf2a('0xbb')]['Messages']=[];_0x49111f[_0xdf2a('0xbb')][_0xdf2a('0xba')]['push'](_0x43a11f[_0xdf2a('0xbb')]);return _0x49111f;});});}})['then'](respondWithResult(_0x252085,null))[_0xdf2a('0x28')](handleError(_0x252085,null));}; \ No newline at end of file +var _0x2ce2=['name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','keys','include','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','create','getDispositions','hasOwnProperty','Disposition','count','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','Contacts','from','ListId','contact','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','firstName','lastName','messageId','interaction','created','autoclose','close','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','EventManager','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','internal','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','save','update','destroy','then','get','OpenchannelAccounts','UserProfileResource','stack','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map'];(function(_0x3fe68c,_0x5cca7c){var _0x71adc0=function(_0x3a32c4){while(--_0x3a32c4){_0x3fe68c['push'](_0x3fe68c['shift']());}};_0x71adc0(++_0x5cca7c);}(_0x2ce2,0x74));var _0x22ce=function(_0x1658ad,_0x487c1f){_0x1658ad=_0x1658ad-0x0;var _0x3b1927=_0x2ce2[_0x1658ad];return _0x3b1927;};'use strict';var emlformat=require(_0x22ce('0x0'));var rimraf=require(_0x22ce('0x1'));var zipdir=require(_0x22ce('0x2'));var jsonpatch=require(_0x22ce('0x3'));var rp=require(_0x22ce('0x4'));var moment=require(_0x22ce('0x5'));var BPromise=require(_0x22ce('0x6'));var Mustache=require(_0x22ce('0x7'));var util=require(_0x22ce('0x8'));var path=require(_0x22ce('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22ce('0xa'));var _=require('lodash');var squel=require(_0x22ce('0xb'));var crypto=require(_0x22ce('0xc'));var jsforce=require(_0x22ce('0xd'));var deskjs=require(_0x22ce('0xe'));var toCsv=require(_0x22ce('0xf'));var querystring=require(_0x22ce('0x10'));var Papa=require('papaparse');var Redis=require(_0x22ce('0x11'));var authService=require(_0x22ce('0x12'));var qs=require(_0x22ce('0x13'));var as=require(_0x22ce('0x14'));var hardwareService=require(_0x22ce('0x15'));var logger=require(_0x22ce('0x16'))(_0x22ce('0x17'));var utils=require(_0x22ce('0x18'));var config=require(_0x22ce('0x19'));var licenseUtil=require(_0x22ce('0x1a'));var db=require(_0x22ce('0x1b'))['db'];config[_0x22ce('0x1c')]=_[_0x22ce('0x1d')](config[_0x22ce('0x1c')],{'host':_0x22ce('0x1e'),'port':0x18eb});var socket=require(_0x22ce('0x1f'))(new Redis(config[_0x22ce('0x1c')]));require(_0x22ce('0x20'))[_0x22ce('0x21')](socket);var jayson=require(_0x22ce('0x22'));var client=jayson[_0x22ce('0x23')][_0x22ce('0x24')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x294ea2,_0xbcda04,_0x345f2f,_0x4fc7e2){return new BPromise(function(_0x4437d6,_0x5566ee){var _0x1d0fd0=_0x4fc7e2||client;return _0x1d0fd0[_0x22ce('0x25')](_0x294ea2,_0x345f2f)['then'](function(_0x26ca5b){logger[_0x22ce('0x26')](_0x22ce('0x27'),_0xbcda04,_0x22ce('0x28'));logger[_0x22ce('0x29')](_0x22ce('0x2a'),_0xbcda04,_0x22ce('0x28'),JSON[_0x22ce('0x2b')](_0x26ca5b));if(_0x26ca5b['error']){if(_0x26ca5b[_0x22ce('0x2c')][_0x22ce('0x2d')]===0x1f4){logger['error'](_0x22ce('0x27'),_0xbcda04,_0x26ca5b[_0x22ce('0x2c')][_0x22ce('0x2e')]);return _0x5566ee(_0x26ca5b[_0x22ce('0x2c')][_0x22ce('0x2e')]);}logger[_0x22ce('0x2c')](_0x22ce('0x27'),_0xbcda04,_0x26ca5b[_0x22ce('0x2c')]['message']);return _0x4437d6(_0x26ca5b[_0x22ce('0x2c')]['message']);}else{logger[_0x22ce('0x26')](_0x22ce('0x27'),_0xbcda04,'request\x20sent');_0x4437d6(_0x26ca5b[_0x22ce('0x2f')][_0x22ce('0x2e')]);}})[_0x22ce('0x30')](function(_0x47192b){logger[_0x22ce('0x2c')](_0x22ce('0x27'),_0xbcda04,_0x47192b);_0x5566ee(_0x47192b);});});}function respondWithStatusCode(_0x5c009e,_0x2c4c8f){_0x2c4c8f=_0x2c4c8f||0xcc;return function(_0x1820d8){if(_0x1820d8){return _0x5c009e[_0x22ce('0x31')](_0x2c4c8f);}return _0x5c009e['status'](_0x2c4c8f)[_0x22ce('0x32')]();};}function respondWithResult(_0x58213e,_0x467be7){_0x467be7=_0x467be7||0xc8;return function(_0x5a826e){if(_0x5a826e){return _0x58213e[_0x22ce('0x33')](_0x467be7)[_0x22ce('0x34')](_0x5a826e);}};}function respondWithFilteredResult(_0x5f5d2a,_0x3a1f39){return function(_0x4fe2e6){if(_0x4fe2e6){var _0x143c9c=typeof _0x3a1f39[_0x22ce('0x35')]===_0x22ce('0x36')&&typeof _0x3a1f39[_0x22ce('0x37')]==='undefined';var _0x4059e1=_0x4fe2e6['count'];var _0x136e5f=_0x143c9c?0x0:_0x3a1f39['offset'];var _0x209250=_0x143c9c?_0x4fe2e6['count']:_0x3a1f39[_0x22ce('0x35')]+_0x3a1f39[_0x22ce('0x37')];var _0x3f53c2;if(_0x209250>=_0x4059e1){_0x209250=_0x4059e1;_0x3f53c2=0xc8;}else{_0x3f53c2=0xce;}_0x5f5d2a[_0x22ce('0x33')](_0x3f53c2);return _0x5f5d2a[_0x22ce('0x38')]('Content-Range',_0x136e5f+'-'+_0x209250+'/'+_0x4059e1)['json'](_0x4fe2e6);}return null;};}function patchUpdates(_0x1a13c7){return function(_0x606f7b){try{jsonpatch[_0x22ce('0x39')](_0x606f7b,_0x1a13c7,!![]);}catch(_0x9a9fc){return BPromise[_0x22ce('0x3a')](_0x9a9fc);}return _0x606f7b[_0x22ce('0x3b')]();};}function saveUpdates(_0x2b9803,_0x52b4fe){return function(_0x8a9e15){if(_0x8a9e15){return _0x8a9e15[_0x22ce('0x3c')](_0x2b9803)['then'](function(_0x15354f){return _0x15354f;});}return null;};}function removeEntity(_0x4ddbee,_0x1e3424){return function(_0x47f91b){if(_0x47f91b){return _0x47f91b[_0x22ce('0x3d')]()[_0x22ce('0x3e')](function(){var _0x1a43e8=_0x47f91b[_0x22ce('0x3f')]({'plain':!![]});var _0x1ecaba=_0x22ce('0x40');return db[_0x22ce('0x41')][_0x22ce('0x3d')]({'where':{'type':_0x1ecaba,'resourceId':_0x1a43e8['id']}})['then'](function(){return _0x47f91b;});})[_0x22ce('0x3e')](function(){_0x4ddbee[_0x22ce('0x33')](0xcc)[_0x22ce('0x32')]();});}};}function handleEntityNotFound(_0x51fc97,_0x1321db){return function(_0x2a1044){if(!_0x2a1044){_0x51fc97['sendStatus'](0x194);}return _0x2a1044;};}function handleError(_0x5372e0,_0x4020e9){_0x4020e9=_0x4020e9||0x1f4;return function(_0x420f08){logger[_0x22ce('0x2c')](_0x420f08[_0x22ce('0x42')]);if(_0x420f08['name']){delete _0x420f08['name'];}_0x5372e0[_0x22ce('0x33')](_0x4020e9)[_0x22ce('0x43')](_0x420f08);};}exports['index']=function(_0x3fa0ee,_0x2850fc){var _0x17f98c={'include':[{'model':db[_0x22ce('0x44')],'as':_0x22ce('0x45')}]},_0x9f07ab={},_0x1a0d6d={'count':0x0,'rows':[]};var _0x4f45b3=_['map'](db[_0x22ce('0x46')][_0x22ce('0x47')],function(_0x5a4aad){return{'name':_0x5a4aad[_0x22ce('0x48')],'type':_0x5a4aad[_0x22ce('0x49')][_0x22ce('0x4a')]};});_0x9f07ab[_0x22ce('0x4b')]=_[_0x22ce('0x4c')](_0x4f45b3,_0x22ce('0x4d'));_0x9f07ab['query']=_['keys'](_0x3fa0ee[_0x22ce('0x4e')]);_0x9f07ab[_0x22ce('0x4f')]=_[_0x22ce('0x50')](_0x9f07ab['model'],_0x9f07ab[_0x22ce('0x4e')]);_0x17f98c[_0x22ce('0x51')]=_[_0x22ce('0x50')](_0x9f07ab[_0x22ce('0x4b')],qs[_0x22ce('0x52')](_0x3fa0ee[_0x22ce('0x4e')]['fields']));_0x17f98c[_0x22ce('0x51')]=_0x17f98c['attributes'][_0x22ce('0x53')]?_0x17f98c[_0x22ce('0x51')]:_0x9f07ab[_0x22ce('0x4b')];if(!_0x3fa0ee['query']['hasOwnProperty'](_0x22ce('0x54'))){_0x17f98c[_0x22ce('0x37')]=qs[_0x22ce('0x37')](_0x3fa0ee[_0x22ce('0x4e')][_0x22ce('0x37')]);_0x17f98c[_0x22ce('0x35')]=qs[_0x22ce('0x35')](_0x3fa0ee[_0x22ce('0x4e')][_0x22ce('0x35')]);}_0x17f98c[_0x22ce('0x55')]=qs[_0x22ce('0x56')](_0x3fa0ee['query'][_0x22ce('0x56')]);_0x17f98c['where']=qs['filters'](_[_0x22ce('0x57')](_0x3fa0ee['query'],_0x9f07ab[_0x22ce('0x4f')]),_0x4f45b3);if(_0x3fa0ee[_0x22ce('0x4e')][_0x22ce('0x58')]){_0x17f98c[_0x22ce('0x59')]=_[_0x22ce('0x5a')](_0x17f98c[_0x22ce('0x59')],{'$or':_[_0x22ce('0x4c')](_0x4f45b3,function(_0x195b52){if(_0x195b52[_0x22ce('0x49')]!==_0x22ce('0x5b')){var _0x149616={};_0x149616[_0x195b52[_0x22ce('0x4d')]]={'$like':'%'+_0x3fa0ee[_0x22ce('0x4e')][_0x22ce('0x58')]+'%'};return _0x149616;}})});}_0x17f98c=_[_0x22ce('0x5a')]({},_0x17f98c,_0x3fa0ee[_0x22ce('0x5c')]);var _0x34d4f3={'where':_0x17f98c[_0x22ce('0x59')]};return db['OpenchannelAccount']['count'](_0x34d4f3)[_0x22ce('0x3e')](function(_0x369e70){_0x1a0d6d['count']=_0x369e70;if(_0x3fa0ee[_0x22ce('0x4e')][_0x22ce('0x5d')]){_0x17f98c['include']=[{'all':!![]}];}return db[_0x22ce('0x46')]['findAll'](_0x17f98c);})[_0x22ce('0x3e')](function(_0x352b76){_0x1a0d6d[_0x22ce('0x5e')]=_0x352b76;return _0x1a0d6d;})[_0x22ce('0x3e')](respondWithFilteredResult(_0x2850fc,_0x17f98c))[_0x22ce('0x30')](handleError(_0x2850fc,null));};exports[_0x22ce('0x5f')]=function(_0x21fe5a,_0x59c0d0){var _0x4fc1e7={'raw':![],'where':{'id':_0x21fe5a['params']['id']},'include':[{'model':db['Pause'],'as':_0x22ce('0x45')}]},_0x4a276d={};_0x4a276d[_0x22ce('0x4b')]=_[_0x22ce('0x60')](db[_0x22ce('0x46')][_0x22ce('0x47')]);_0x4a276d[_0x22ce('0x4e')]=_['keys'](_0x21fe5a[_0x22ce('0x4e')]);_0x4a276d[_0x22ce('0x4f')]=_[_0x22ce('0x50')](_0x4a276d[_0x22ce('0x4b')],_0x4a276d['query']);_0x4fc1e7[_0x22ce('0x51')]=_[_0x22ce('0x50')](_0x4a276d[_0x22ce('0x4b')],qs[_0x22ce('0x52')](_0x21fe5a[_0x22ce('0x4e')]['fields']));_0x4fc1e7[_0x22ce('0x51')]=_0x4fc1e7['attributes']['length']?_0x4fc1e7[_0x22ce('0x51')]:_0x4a276d[_0x22ce('0x4b')];if(_0x21fe5a[_0x22ce('0x4e')][_0x22ce('0x5d')]){_0x4fc1e7[_0x22ce('0x61')]=[{'all':!![]}];}_0x4fc1e7=_[_0x22ce('0x5a')]({},_0x4fc1e7,_0x21fe5a[_0x22ce('0x5c')]);return db[_0x22ce('0x46')][_0x22ce('0x62')](_0x4fc1e7)[_0x22ce('0x3e')](handleEntityNotFound(_0x59c0d0,null))[_0x22ce('0x3e')](respondWithResult(_0x59c0d0,null))[_0x22ce('0x30')](handleError(_0x59c0d0,null));};exports['create']=function(_0x2a7965,_0x2f58d0){return db['OpenchannelAccount']['create'](_0x2a7965[_0x22ce('0x63')],{})['then'](function(_0x3e030e){var _0x236ec3=_0x2a7965['user'][_0x22ce('0x3f')]({'plain':!![]});if(!_0x236ec3)throw new Error(_0x22ce('0x64'));if(_0x236ec3['role']===_0x22ce('0x65')){var _0xdf609d=_0x3e030e['get']({'plain':!![]});var _0x3da212=_0x22ce('0x40');return db['UserProfileSection'][_0x22ce('0x62')]({'where':{'name':_0x3da212,'userProfileId':_0x236ec3[_0x22ce('0x66')]},'raw':!![]})[_0x22ce('0x3e')](function(_0x5d5f01){if(_0x5d5f01&&_0x5d5f01[_0x22ce('0x67')]===0x0){return db['UserProfileResource']['create']({'name':_0xdf609d['name'],'resourceId':_0xdf609d['id'],'type':_0x5d5f01[_0x22ce('0x4d')],'sectionId':_0x5d5f01['id']},{})[_0x22ce('0x3e')](function(){return _0x3e030e;});}else{return _0x3e030e;}})['catch'](function(_0x6829e4){logger['error'](_0x22ce('0x68'),_0x6829e4);throw _0x6829e4;});}return _0x3e030e;})[_0x22ce('0x3e')](respondWithResult(_0x2f58d0,0xc9))['catch'](handleError(_0x2f58d0,null));};exports[_0x22ce('0x3c')]=function(_0x4d9eaa,_0x4f99ef){if(_0x4d9eaa[_0x22ce('0x63')]['id']){delete _0x4d9eaa['body']['id'];}return db['OpenchannelAccount'][_0x22ce('0x62')]({'where':{'id':_0x4d9eaa[_0x22ce('0x69')]['id']},'include':[{'model':db[_0x22ce('0x44')],'as':_0x22ce('0x45')}]})[_0x22ce('0x3e')](handleEntityNotFound(_0x4f99ef,null))[_0x22ce('0x3e')](saveUpdates(_0x4d9eaa[_0x22ce('0x63')],null))['then'](respondWithResult(_0x4f99ef,null))['catch'](handleError(_0x4f99ef,null));};exports[_0x22ce('0x3d')]=function(_0x1848e2,_0x45c879){return db[_0x22ce('0x46')][_0x22ce('0x62')]({'where':{'id':_0x1848e2[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x45c879,null))[_0x22ce('0x3e')](removeEntity(_0x45c879,null))[_0x22ce('0x30')](handleError(_0x45c879,null));};exports[_0x22ce('0x6a')]=function(_0x484c4e,_0x21f165){return db[_0x22ce('0x46')][_0x22ce('0x6a')]()[_0x22ce('0x3e')](respondWithResult(_0x21f165,null))['catch'](handleError(_0x21f165,null));};exports[_0x22ce('0x6b')]=function(_0x359ea5,_0x4b184f,_0x4202f8){if(_0x359ea5[_0x22ce('0x63')]['id']){delete _0x359ea5['body']['id'];}return db[_0x22ce('0x46')][_0x22ce('0x62')]({'where':{'id':_0x359ea5[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x4b184f,null))['then'](function(_0x309693){if(_0x309693){_0x359ea5[_0x22ce('0x63')][_0x22ce('0x6c')]=_0x309693['id'];return db['Disposition'][_0x22ce('0x6d')](_0x359ea5['body']);}})['then'](respondWithResult(_0x4b184f,null))[_0x22ce('0x30')](handleError(_0x4b184f,null));};exports[_0x22ce('0x6e')]=function(_0x7e72cd,_0x163a97,_0x1d23f2){var _0x5eef07={'raw':![],'where':{}};var _0x57dfa8={};var _0x342a34={'count':0x0,'rows':[]};return db[_0x22ce('0x46')]['findOne']({'where':{'id':_0x7e72cd['params']['id']}})['then'](handleEntityNotFound(_0x163a97,null))[_0x22ce('0x3e')](function(_0x4cdf13){if(_0x4cdf13){_0x57dfa8[_0x22ce('0x4b')]=_[_0x22ce('0x60')](db['Disposition'][_0x22ce('0x47')]);_0x57dfa8[_0x22ce('0x4e')]=_[_0x22ce('0x60')](_0x7e72cd[_0x22ce('0x4e')]);_0x57dfa8[_0x22ce('0x4f')]=_['intersection'](_0x57dfa8[_0x22ce('0x4b')],_0x57dfa8[_0x22ce('0x4e')]);_0x5eef07['attributes']=_[_0x22ce('0x50')](_0x57dfa8['model'],qs['fields'](_0x7e72cd['query'][_0x22ce('0x52')]));_0x5eef07[_0x22ce('0x51')]=_0x5eef07[_0x22ce('0x51')]['length']?_0x5eef07[_0x22ce('0x51')]:_0x57dfa8[_0x22ce('0x4b')];if(!_0x7e72cd['query'][_0x22ce('0x6f')](_0x22ce('0x54'))){_0x5eef07['limit']=qs[_0x22ce('0x37')](_0x7e72cd[_0x22ce('0x4e')]['limit']);_0x5eef07['offset']=qs[_0x22ce('0x35')](_0x7e72cd['query'][_0x22ce('0x35')]);}_0x5eef07[_0x22ce('0x55')]=qs[_0x22ce('0x56')](_0x7e72cd[_0x22ce('0x4e')]['sort']);_0x5eef07[_0x22ce('0x59')]=qs[_0x22ce('0x4f')](_[_0x22ce('0x57')](_0x7e72cd['query'],_0x57dfa8[_0x22ce('0x4f')]));_0x5eef07[_0x22ce('0x59')][_0x22ce('0x6c')]=_0x4cdf13['id'];if(_0x7e72cd[_0x22ce('0x4e')][_0x22ce('0x58')]){_0x5eef07[_0x22ce('0x59')]=_[_0x22ce('0x5a')](_0x5eef07[_0x22ce('0x59')],{'$or':_[_0x22ce('0x4c')](_0x5eef07['attributes'],function(_0x2f83ec){var _0x49e5b6={};_0x49e5b6[_0x2f83ec]={'$like':'%'+_0x7e72cd[_0x22ce('0x4e')][_0x22ce('0x58')]+'%'};return _0x49e5b6;})});}_0x5eef07=_['merge']({},_0x5eef07,_0x7e72cd[_0x22ce('0x5c')]);return db[_0x22ce('0x70')][_0x22ce('0x71')]({'where':_0x5eef07[_0x22ce('0x59')]})[_0x22ce('0x3e')](function(_0x3c5dfe){_0x342a34[_0x22ce('0x71')]=_0x3c5dfe;if(_0x7e72cd['query'][_0x22ce('0x5d')]){_0x5eef07['include']=[{'all':!![]}];}return db[_0x22ce('0x70')][_0x22ce('0x72')](_0x5eef07);})['then'](function(_0x22937c){_0x342a34[_0x22ce('0x5e')]=_0x22937c;return _0x342a34;});}})['then'](respondWithFilteredResult(_0x163a97,_0x5eef07))[_0x22ce('0x30')](handleError(_0x163a97,null));};exports['removeDispositions']=function(_0x866d,_0x5610e8,_0x20e208){return db['OpenchannelAccount'][_0x22ce('0x62')]({'where':{'id':_0x866d[_0x22ce('0x69')]['id']}})['then'](handleEntityNotFound(_0x5610e8,null))['then'](function(_0x2c4ad4){if(_0x2c4ad4){return _0x2c4ad4[_0x22ce('0x73')](_0x866d['query'][_0x22ce('0x74')]);}})[_0x22ce('0x3e')](respondWithStatusCode(_0x5610e8,null))[_0x22ce('0x30')](handleError(_0x5610e8,null));};exports[_0x22ce('0x75')]=function(_0x597951,_0x42a542,_0x1d7764){if(_0x597951[_0x22ce('0x63')]['id']){delete _0x597951['body']['id'];}return db[_0x22ce('0x46')][_0x22ce('0x62')]({'where':{'id':_0x597951[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x42a542,null))['then'](function(_0x149f1f){if(_0x149f1f){_0x597951['body'][_0x22ce('0x6c')]=_0x149f1f['id'];return db[_0x22ce('0x76')]['create'](_0x597951[_0x22ce('0x63')]);}})[_0x22ce('0x3e')](respondWithResult(_0x42a542,null))['catch'](handleError(_0x42a542,null));};exports[_0x22ce('0x77')]=function(_0x176010,_0x8ed73,_0xf9ecf4){var _0x5e3f17={'raw':![],'where':{}};var _0x4b9345={};var _0x2764f7={'count':0x0,'rows':[]};return db[_0x22ce('0x46')][_0x22ce('0x78')]({'where':{'id':_0x176010['params']['id']}})['then'](handleEntityNotFound(_0x8ed73,null))['then'](function(_0x48cdeb){if(_0x48cdeb){_0x4b9345[_0x22ce('0x4b')]=_['keys'](db[_0x22ce('0x76')]['rawAttributes']);_0x4b9345[_0x22ce('0x4e')]=_['keys'](_0x176010[_0x22ce('0x4e')]);_0x4b9345[_0x22ce('0x4f')]=_[_0x22ce('0x50')](_0x4b9345[_0x22ce('0x4b')],_0x4b9345[_0x22ce('0x4e')]);_0x5e3f17[_0x22ce('0x51')]=_['intersection'](_0x4b9345[_0x22ce('0x4b')],qs[_0x22ce('0x52')](_0x176010[_0x22ce('0x4e')][_0x22ce('0x52')]));_0x5e3f17['attributes']=_0x5e3f17[_0x22ce('0x51')][_0x22ce('0x53')]?_0x5e3f17[_0x22ce('0x51')]:_0x4b9345[_0x22ce('0x4b')];if(!_0x176010[_0x22ce('0x4e')]['hasOwnProperty'](_0x22ce('0x54'))){_0x5e3f17[_0x22ce('0x37')]=qs[_0x22ce('0x37')](_0x176010['query'][_0x22ce('0x37')]);_0x5e3f17['offset']=qs[_0x22ce('0x35')](_0x176010[_0x22ce('0x4e')][_0x22ce('0x35')]);}_0x5e3f17['order']=qs[_0x22ce('0x56')](_0x176010['query']['sort']);_0x5e3f17['where']=qs[_0x22ce('0x4f')](_['pick'](_0x176010[_0x22ce('0x4e')],_0x4b9345[_0x22ce('0x4f')]));_0x5e3f17[_0x22ce('0x59')][_0x22ce('0x6c')]=_0x48cdeb['id'];if(_0x176010[_0x22ce('0x4e')][_0x22ce('0x58')]){_0x5e3f17[_0x22ce('0x59')]=_[_0x22ce('0x5a')](_0x5e3f17[_0x22ce('0x59')],{'$or':_[_0x22ce('0x4c')](_0x5e3f17[_0x22ce('0x51')],function(_0x8f627a){var _0x21b7a7={};_0x21b7a7[_0x8f627a]={'$like':'%'+_0x176010[_0x22ce('0x4e')][_0x22ce('0x58')]+'%'};return _0x21b7a7;})});}_0x5e3f17=_[_0x22ce('0x5a')]({},_0x5e3f17,_0x176010[_0x22ce('0x5c')]);return db[_0x22ce('0x76')][_0x22ce('0x71')]({'where':_0x5e3f17[_0x22ce('0x59')]})[_0x22ce('0x3e')](function(_0x478557){_0x2764f7[_0x22ce('0x71')]=_0x478557;if(_0x176010[_0x22ce('0x4e')][_0x22ce('0x5d')]){_0x5e3f17[_0x22ce('0x61')]=[{'all':!![]}];}return db[_0x22ce('0x76')][_0x22ce('0x72')](_0x5e3f17);})[_0x22ce('0x3e')](function(_0x380a03){_0x2764f7['rows']=_0x380a03;return _0x2764f7;});}})[_0x22ce('0x3e')](respondWithFilteredResult(_0x8ed73,_0x5e3f17))[_0x22ce('0x30')](handleError(_0x8ed73,null));};exports[_0x22ce('0x79')]=function(_0x92f4c4,_0x55ef30,_0x43dcb4){return db['OpenchannelAccount'][_0x22ce('0x62')]({'where':{'id':_0x92f4c4[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x55ef30,null))[_0x22ce('0x3e')](function(_0x80f63a){if(_0x80f63a){return _0x80f63a[_0x22ce('0x79')](_0x92f4c4[_0x22ce('0x4e')][_0x22ce('0x74')]);}})[_0x22ce('0x3e')](respondWithStatusCode(_0x55ef30,null))['catch'](handleError(_0x55ef30,null));};exports[_0x22ce('0x7a')]=function(_0x209b1d,_0x50ae3a,_0x598a06){var _0xaf68d3={'body':_0x209b1d[_0x22ce('0x63')],'channel':_0x22ce('0x7b')};var _0x34c360=[];var _0x4a137b=[];var _0x2cd6be={};var _0x4311d6=![];return db[_0x22ce('0x7c')][_0x22ce('0x6a')]()['then'](function(_0x4bd580){if(!_0x4bd580){throw new db[(_0x22ce('0x7d'))][(_0x22ce('0x7e'))]('no\x20available\x20attributes');}_0x34c360=_[_0x22ce('0x7f')](_[_0x22ce('0x60')](_0x4bd580),[_0x22ce('0x80'),_0x22ce('0x81')]);_0x4a137b=_[_0x22ce('0x7f')](_[_0x22ce('0x60')](_0x4bd580),[_0x22ce('0x80'),_0x22ce('0x81'),'CompanyId','ListId']);if(_0x209b1d[_0x22ce('0x63')]['id']){delete _0x209b1d['body']['id'];}if(_[_0x22ce('0x82')](_0x209b1d['body']['from'])){throw new db[(_0x22ce('0x7d'))][(_0x22ce('0x7e'))](_0x22ce('0x83'));}if(_[_0x22ce('0x82')](_0x209b1d['body']['body'])||_0x209b1d[_0x22ce('0x63')][_0x22ce('0x63')]===''){throw new db[(_0x22ce('0x7d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x22ce('0x82')](_0x209b1d[_0x22ce('0x63')][_0x22ce('0x84')])){throw new db[(_0x22ce('0x7d'))][(_0x22ce('0x7e'))](_0x22ce('0x85')+_0x4a137b);}if(!_[_0x22ce('0x86')](_0x4a137b,_0x209b1d[_0x22ce('0x63')]['mapKey'])){throw new db[(_0x22ce('0x7d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a137b);}_0x2cd6be[_0x209b1d[_0x22ce('0x63')][_0x22ce('0x84')]]=_0x209b1d[_0x22ce('0x63')]['from'];})[_0x22ce('0x3e')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x209b1d[_0x22ce('0x69')]['id']},'include':[{'model':db[_0x22ce('0x87')],'as':_0x22ce('0x88'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2cd6be,'limit':0x1,'order':[[_0x22ce('0x81'),_0x22ce('0x89')]]}]},{'model':db[_0x22ce('0x8a')],'as':_0x22ce('0x8b')}]});})[_0x22ce('0x3e')](handleEntityNotFound(_0x50ae3a,null))[_0x22ce('0x3e')](function(_0x5070a7){if(_0x5070a7&&_0x5070a7[_0x22ce('0x88')]){_0xaf68d3[_0x22ce('0x8c')]=_0x5070a7;_0xaf68d3[_0x22ce('0x8d')]=_0x5070a7[_0x22ce('0x8b')];_0xaf68d3[_0x22ce('0x8e')]=_0x5070a7[_0x22ce('0x88')];_0xaf68d3[_0x22ce('0x8d')]=_[_0x22ce('0x8f')](_0xaf68d3[_0x22ce('0x8d')],['priority'],['asc']);if(_0xaf68d3[_0x22ce('0x8c')][_0x22ce('0x8b')]){delete _0xaf68d3[_0x22ce('0x8c')][_0x22ce('0x8b')];}if(_0xaf68d3['account']['List']&&_0xaf68d3['account'][_0x22ce('0x88')][_0x22ce('0x90')][_0x22ce('0x53')]){return _0xaf68d3[_0x22ce('0x8c')]['List']['Contacts'][0x0];}var _0x3134fa=_['defaults'](_0x209b1d[_0x22ce('0x63')],{'firstName':_0x209b1d[_0x22ce('0x63')][_0x22ce('0x91')],'ListId':_0x5070a7[_0x22ce('0x92')]});_0x3134fa[_0x209b1d[_0x22ce('0x63')][_0x22ce('0x84')]]=_0x209b1d['body'][_0x22ce('0x91')];return db['CmContact']['create'](_0x3134fa,{'fields':_0x34c360,'raw':!![]});}})['then'](handleEntityNotFound(_0x50ae3a,null))[_0x22ce('0x3e')](function(_0x358b52){_0xaf68d3[_0x22ce('0x93')]=_0x358b52;if(_0x358b52){var _0x4f25d0={'ContactId':_0x358b52['id'],'OpenchannelAccountId':_0x209b1d[_0x22ce('0x69')]['id'],'from':(_0x358b52['firstName']||'')+'\x20'+(_0x358b52['lastName']||'')};var _0x532f01={'OpenchannelAccountId':_0x209b1d[_0x22ce('0x69')]['id'],'closed':![]};if(_0x209b1d[_0x22ce('0x63')][_0x22ce('0x94')]){_0x532f01[_0x22ce('0x94')]=_0x209b1d['body']['threadId'];return db['OpenchannelInteraction'][_0x22ce('0x62')]({'where':_0x532f01})[_0x22ce('0x3e')](function(_0x54a4bb){if(_0x54a4bb){return[_0x54a4bb,![]];}_0x4f25d0[_0x22ce('0x94')]=_0x209b1d[_0x22ce('0x63')][_0x22ce('0x94')];_0x4f25d0[_0x22ce('0x95')]=_0x209b1d[_0x22ce('0x63')][_0x22ce('0x95')];return db[_0x22ce('0x96')][_0x22ce('0x6d')](_0x4f25d0)[_0x22ce('0x3e')](function(_0x1a752b){return[_0x1a752b,!![]];});});}else{_0x532f01[_0x22ce('0x94')]=null;}_0x532f01[_0x22ce('0x97')]=_0x358b52['id'];return db['OpenchannelInteraction'][_0x22ce('0x62')]({'where':_0x532f01})[_0x22ce('0x3e')](function(_0x496ee1){if(_0x496ee1){return[_0x496ee1,![]];}return db['OpenchannelInteraction']['create'](_0x4f25d0)[_0x22ce('0x3e')](function(_0x5abc00){return[_0x5abc00,!![]];});});}})[_0x22ce('0x98')](function(_0x43c7ef,_0x31b0c9){if(_0x43c7ef){_0x4311d6=_0x31b0c9;if(!_0x31b0c9){var _0x37ded3={'from':(_0xaf68d3[_0x22ce('0x93')][_0x22ce('0x99')]||'')+'\x20'+(_0xaf68d3[_0x22ce('0x93')][_0x22ce('0x9a')]||'')};if(_0x209b1d[_0x22ce('0x63')][_0x22ce('0x94')]&&_0x209b1d[_0x22ce('0x63')][_0x22ce('0x9b')]&&_0x209b1d['body'][_0x22ce('0x94')]!=_0x209b1d[_0x22ce('0x63')][_0x22ce('0x9b')]){_0x37ded3[_0x22ce('0x94')]=_0x209b1d['body'][_0x22ce('0x9b')];}return _0x43c7ef[_0x22ce('0x3c')](_0x37ded3);}else{return _0x43c7ef;}}})[_0x22ce('0x3e')](function(_0x429a4c){_0xaf68d3[_0x22ce('0x9c')]=_0x429a4c['get']({'plain':!![]});_0xaf68d3[_0x22ce('0x9c')][_0x22ce('0x9d')]=_0x4311d6;if(_0xaf68d3[_0x22ce('0x9c')][_0x22ce('0x9d')]){if(_0xaf68d3[_0x22ce('0x8c')][_0x22ce('0x9e')]){_0xaf68d3[_0x22ce('0x8d')]['push']({'id':0x0,'priority':_0xaf68d3[_0x22ce('0x8d')][_0x22ce('0x53')]+0x1,'app':_0x22ce('0x9f'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x22ce('0xa0')][_0x22ce('0x6d')]({'body':_0x209b1d[_0x22ce('0x63')][_0x22ce('0x63')],'OpenchannelAccountId':_0x209b1d[_0x22ce('0x69')]['id'],'OpenchannelInteractionId':_0x429a4c['id'],'direction':'in','ContactId':_0xaf68d3[_0x22ce('0x93')]['id'],'AttachmentId':_0x209b1d[_0x22ce('0x63')][_0x22ce('0xa1')]});})[_0x22ce('0x3e')](function(_0x57d6cd){_0xaf68d3['message']=_0x57d6cd;if(_0xaf68d3[_0x22ce('0x9c')]['UserId']){return db[_0x22ce('0xa2')][_0x22ce('0x62')]({'attributes':['id',_0x22ce('0x4d')],'where':{'id':_0xaf68d3[_0x22ce('0x9c')]['UserId']}})[_0x22ce('0x3e')](function(_0x435052){if(_0x435052){_0xaf68d3['applications'][_0x22ce('0xa3')]({'id':0x0,'priority':0x0,'app':_0x22ce('0xa4'),'appdata':_0x435052[_0x22ce('0x4d')]+','+(_0xaf68d3[_0x22ce('0x8c')][_0x22ce('0xa5')]||0xa),'interval':_0x22ce('0xa6')});_0xaf68d3['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x22ce('0xa7'),_0xaf68d3);});}return respondWithRpcPromise(_0x22ce('0xa8'),_0x22ce('0xa7'),_0xaf68d3);})[_0x22ce('0x3e')](function(_0xe2b56){respondWithRpcPromise(_0x22ce('0xa9'),_0x22ce('0xa9'),{'event':_0x22ce('0x7a'),'message':_0xe2b56},client9002);return _0xe2b56;})[_0x22ce('0x3e')](respondWithResult(_0x50ae3a,null))[_0x22ce('0x30')](handleError(_0x50ae3a,null));};exports[_0x22ce('0xaa')]=function(_0x46c18b,_0x848f04){var _0x2b2435=_0x46c18b[_0x22ce('0x69')]['id'];var _0x589146=_0x46c18b[_0x22ce('0x63')];var _0x4f1e74=0xc8;var _0x156620=null;return db['sequelize'][_0x22ce('0xab')]({'isolationLevel':db[_0x22ce('0xac')][_0x22ce('0xad')]['ISOLATION_LEVELS'][_0x22ce('0xae')]},function(_0x2865c0){return db['OpenchannelAccount'][_0x22ce('0x78')]({'where':{'id':_0x2b2435},'transaction':_0x2865c0})[_0x22ce('0x3e')](function(_0x55fba1){if(_0x55fba1){return db[_0x22ce('0x8a')][_0x22ce('0x3d')]({'where':{'OpenchannelAccountId':_0x2b2435},'transaction':_0x2865c0})[_0x22ce('0x3e')](function(){var _0x239d34=_['map'](_0x589146,function(_0x57f0a1){_0x57f0a1[_0x22ce('0x6c')]=_0x2b2435;return _0x57f0a1;});return db[_0x22ce('0x8a')]['bulkCreate'](_0x239d34,{'transaction':_0x2865c0});});}else{_0x4f1e74=0x194;_0x156620=[];}});})[_0x22ce('0x3e')](function(){if(_0x4f1e74!==0x194){return db[_0x22ce('0x8a')][_0x22ce('0xaf')]({'where':{'OpenchannelAccountId':_0x2b2435},'order':_0x22ce('0xb0')})[_0x22ce('0x3e')](function(_0x34106f){_0x156620=_0x34106f;});}})[_0x22ce('0x30')](function(_0x43ba78){_0x4f1e74=0x1f4;logger[_0x22ce('0x2c')](_0x43ba78[_0x22ce('0x42')]);if(_0x43ba78[_0x22ce('0x4d')]){delete _0x43ba78[_0x22ce('0x4d')];}_0x156620=_0x43ba78;})[_0x22ce('0xb1')](function(){if(_0x156620===null){_0x848f04[_0x22ce('0x31')](_0x4f1e74);}else{if(_0x4f1e74===0x1f4){_0x848f04[_0x22ce('0x33')](_0x4f1e74)['send'](_0x156620);}else{_0x848f04['status'](_0x4f1e74)['json'](_0x156620);}}});};exports['getApplications']=function(_0x1f4e76,_0x39be9e,_0x4d5cb3){var _0x8e5396={};var _0x1e5513={};var _0x639ab4;var _0x452e12;return db[_0x22ce('0x46')]['findOne']({'where':{'id':_0x1f4e76[_0x22ce('0x69')]['id']}})['then'](handleEntityNotFound(_0x39be9e,null))[_0x22ce('0x3e')](function(_0x5ef9b5){if(_0x5ef9b5){_0x639ab4=_0x5ef9b5;_0x1e5513[_0x22ce('0x4b')]=_[_0x22ce('0x60')](db[_0x22ce('0x8a')][_0x22ce('0x47')]);_0x1e5513[_0x22ce('0x4e')]=_[_0x22ce('0x60')](_0x1f4e76['query']);_0x1e5513[_0x22ce('0x4f')]=_[_0x22ce('0x50')](_0x1e5513[_0x22ce('0x4b')],_0x1e5513[_0x22ce('0x4e')]);_0x8e5396['attributes']=_['intersection'](_0x1e5513[_0x22ce('0x4b')],qs[_0x22ce('0x52')](_0x1f4e76['query'][_0x22ce('0x52')]));_0x8e5396[_0x22ce('0x51')]=_0x8e5396[_0x22ce('0x51')][_0x22ce('0x53')]?_0x8e5396[_0x22ce('0x51')]:_0x1e5513[_0x22ce('0x4b')];_0x8e5396[_0x22ce('0x55')]=qs['sort'](_0x1f4e76[_0x22ce('0x4e')]['sort']);_0x8e5396['where']=qs[_0x22ce('0x4f')](_['pick'](_0x1f4e76[_0x22ce('0x4e')],_0x1e5513[_0x22ce('0x4f')]));if(_0x1f4e76[_0x22ce('0x4e')][_0x22ce('0x58')]){_0x8e5396['where']=_[_0x22ce('0x5a')](_0x8e5396[_0x22ce('0x59')],{'$or':_['map'](_0x8e5396[_0x22ce('0x51')],function(_0x11ff59){var _0x54d042={};_0x54d042[_0x11ff59]={'$like':'%'+_0x1f4e76[_0x22ce('0x4e')]['filter']+'%'};return _0x54d042;})});}_0x8e5396=_[_0x22ce('0x5a')]({},_0x8e5396,_0x1f4e76[_0x22ce('0x5c')]);return _0x639ab4['getApplications'](_0x8e5396);}})[_0x22ce('0x3e')](function(_0x3413c0){if(_0x3413c0){_0x452e12=_0x3413c0[_0x22ce('0x53')];if(!_0x1f4e76[_0x22ce('0x4e')][_0x22ce('0x6f')](_0x22ce('0x54'))){_0x8e5396[_0x22ce('0x37')]=qs['limit'](_0x1f4e76['query'][_0x22ce('0x37')]);_0x8e5396[_0x22ce('0x35')]=qs['offset'](_0x1f4e76[_0x22ce('0x4e')][_0x22ce('0x35')]);}return _0x639ab4[_0x22ce('0xb2')](_0x8e5396);}})[_0x22ce('0x3e')](function(_0x2ab5a0){if(_0x2ab5a0){return _0x2ab5a0?{'count':_0x452e12,'rows':_0x2ab5a0}:null;}})['then'](respondWithResult(_0x39be9e,null))[_0x22ce('0x30')](handleError(_0x39be9e,null));};exports[_0x22ce('0xb3')]=function(_0xa1a672,_0x309327,_0xc9401a){var _0x1f441e={'raw':![],'where':{}};var _0x168b74={};var _0x4f698c={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0xa1a672[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x309327,null))[_0x22ce('0x3e')](function(_0x4492d9){if(_0x4492d9){_0x168b74[_0x22ce('0x4b')]=_[_0x22ce('0x60')](db[_0x22ce('0x96')][_0x22ce('0x47')]);_0x168b74[_0x22ce('0x4e')]=_['keys'](_0xa1a672[_0x22ce('0x4e')]);_0x168b74[_0x22ce('0x4f')]=_['intersection'](_0x168b74[_0x22ce('0x4b')],_0x168b74['query']);_0x1f441e[_0x22ce('0x51')]=_['intersection'](_0x168b74[_0x22ce('0x4b')],qs[_0x22ce('0x52')](_0xa1a672['query'][_0x22ce('0x52')]));_0x1f441e[_0x22ce('0x51')]=_0x1f441e['attributes'][_0x22ce('0x53')]?_0x1f441e[_0x22ce('0x51')]:_0x168b74[_0x22ce('0x4b')];if(!_0xa1a672[_0x22ce('0x4e')]['hasOwnProperty'](_0x22ce('0x54'))){_0x1f441e['limit']=qs['limit'](_0xa1a672[_0x22ce('0x4e')][_0x22ce('0x37')]);_0x1f441e[_0x22ce('0x35')]=qs[_0x22ce('0x35')](_0xa1a672['query']['offset']);}_0x1f441e[_0x22ce('0x55')]=qs[_0x22ce('0x56')](_0xa1a672[_0x22ce('0x4e')][_0x22ce('0x56')]);_0x1f441e[_0x22ce('0x59')]=qs['filters'](_[_0x22ce('0x57')](_0xa1a672[_0x22ce('0x4e')],_0x168b74['filters']));_0x1f441e[_0x22ce('0x59')][_0x22ce('0x6c')]=_0x4492d9['id'];if(_0xa1a672[_0x22ce('0x4e')]['filter']){_0x1f441e[_0x22ce('0x59')]=_['merge'](_0x1f441e[_0x22ce('0x59')],{'$or':_[_0x22ce('0x4c')](_0x1f441e[_0x22ce('0x51')],function(_0x503842){var _0x3df6c3={};_0x3df6c3[_0x503842]={'$like':'%'+_0xa1a672[_0x22ce('0x4e')][_0x22ce('0x58')]+'%'};return _0x3df6c3;})});}_0x1f441e=_[_0x22ce('0x5a')]({},_0x1f441e,_0xa1a672['options']);return db['OpenchannelInteraction'][_0x22ce('0x71')]({'where':_0x1f441e['where']})['then'](function(_0x5a79ea){_0x4f698c[_0x22ce('0x71')]=_0x5a79ea;if(_0xa1a672['query'][_0x22ce('0x5d')]){_0x1f441e[_0x22ce('0x61')]=[{'model':db[_0x22ce('0x7c')],'as':_0x22ce('0xb4'),'required':![]},{'model':db[_0x22ce('0xa2')],'as':_0x22ce('0xb5'),'attributes':[_0x22ce('0x4d'),'fullname',_0x22ce('0xb6')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0xa1a672[_0x22ce('0x4e')][_0x22ce('0xb7')]?{'id':_0xa1a672[_0x22ce('0x4e')][_0x22ce('0xb7')]}:undefined,'required':_0xa1a672['query'][_0x22ce('0xb7')]?!![]:![]}];}return db[_0x22ce('0x96')][_0x22ce('0x72')](_0x1f441e);})[_0x22ce('0x3e')](function(_0x1e91d6){_0x4f698c[_0x22ce('0x5e')]=_0x1e91d6;return _0x4f698c;});}})[_0x22ce('0x3e')](respondWithFilteredResult(_0x309327,_0x1f441e))['catch'](handleError(_0x309327,null));};exports[_0x22ce('0xb8')]=function(_0x34da10,_0x476fa4,_0x277940){return db['OpenchannelAccount']['find']({'where':{'id':_0x34da10[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x476fa4,null))[_0x22ce('0x3e')](function(_0x54bbc5){if(_0x54bbc5){return _0x54bbc5[_0x22ce('0xb8')](_0x34da10[_0x22ce('0x63')][_0x22ce('0x74')],_['omit'](_0x34da10['body'],[_0x22ce('0x74'),'id'])||{})[_0x22ce('0x98')](function(_0x5b744f){for(var _0x134c3c=0x0;_0x134c3c<_0x34da10[_0x22ce('0x63')][_0x22ce('0x74')][_0x22ce('0x53')];_0x134c3c+=0x1){socket[_0x22ce('0xb9')](_0x22ce('0xba'),{'UserId':Number(_0x34da10[_0x22ce('0x63')][_0x22ce('0x74')][_0x134c3c]),'OpenchannelAccountId':Number(_0x34da10['params']['id'])});}return _0x5b744f;});}})['then'](respondWithResult(_0x476fa4,null))[_0x22ce('0x30')](handleError(_0x476fa4,null));};exports[_0x22ce('0xbb')]=function(_0x3af018,_0x55b9c3,_0x17096b){return db['OpenchannelAccount'][_0x22ce('0x62')]({'where':{'id':_0x3af018[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x55b9c3,null))[_0x22ce('0x3e')](function(_0x2b8318){if(_0x2b8318){return _0x2b8318[_0x22ce('0xbb')](_0x3af018['query']['ids'])[_0x22ce('0x3e')](function(){if(_[_0x22ce('0xbc')](_0x3af018[_0x22ce('0x4e')][_0x22ce('0x74')])){for(var _0x17d432=0x0;_0x17d432<_0x3af018[_0x22ce('0x4e')][_0x22ce('0x74')][_0x22ce('0x53')];_0x17d432+=0x1){socket[_0x22ce('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3af018['query']['ids'][_0x17d432]),'OpenchannelAccountId':Number(_0x3af018[_0x22ce('0x69')]['id'])});}}else{socket[_0x22ce('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3af018[_0x22ce('0x4e')][_0x22ce('0x74')]),'OpenchannelAccountId':Number(_0x3af018[_0x22ce('0x69')]['id'])});}});}})[_0x22ce('0x3e')](respondWithStatusCode(_0x55b9c3,null))['catch'](handleError(_0x55b9c3,null));};exports['getAgents']=function(_0x3fbe3b,_0x15b2db,_0x6acd7e){var _0x819d6d={};var _0x5281fc={};var _0x1de53b;var _0x5325b6;return db[_0x22ce('0x46')][_0x22ce('0x78')]({'where':{'id':_0x3fbe3b[_0x22ce('0x69')]['id']}})['then'](handleEntityNotFound(_0x15b2db,null))['then'](function(_0x584ca0){if(_0x584ca0){_0x1de53b=_0x584ca0;_0x5281fc[_0x22ce('0x4b')]=_[_0x22ce('0x60')](db[_0x22ce('0xa2')][_0x22ce('0x47')]);_0x5281fc[_0x22ce('0x4e')]=_['keys'](_0x3fbe3b[_0x22ce('0x4e')]);_0x5281fc[_0x22ce('0x4f')]=_[_0x22ce('0x50')](_0x5281fc[_0x22ce('0x4b')],_0x5281fc[_0x22ce('0x4e')]);_0x819d6d[_0x22ce('0x51')]=_[_0x22ce('0x50')](_0x5281fc['model'],qs[_0x22ce('0x52')](_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x52')]));_0x819d6d[_0x22ce('0x51')]=_0x819d6d['attributes'][_0x22ce('0x53')]?_0x819d6d[_0x22ce('0x51')]:_0x5281fc[_0x22ce('0x4b')];_0x819d6d['order']=qs[_0x22ce('0x56')](_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x56')]);_0x819d6d['where']=qs[_0x22ce('0x4f')](_[_0x22ce('0x57')](_0x3fbe3b[_0x22ce('0x4e')],_0x5281fc[_0x22ce('0x4f')]));if(_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x58')]){_0x819d6d[_0x22ce('0x59')]=_[_0x22ce('0x5a')](_0x819d6d['where'],{'$or':_[_0x22ce('0x4c')](_0x819d6d['attributes'],function(_0x3921df){var _0x13d77e={};_0x13d77e[_0x3921df]={'$like':'%'+_0x3fbe3b[_0x22ce('0x4e')]['filter']+'%'};return _0x13d77e;})});}_0x819d6d=_[_0x22ce('0x5a')]({},_0x819d6d,_0x3fbe3b[_0x22ce('0x5c')]);return _0x1de53b['getAgents'](_0x819d6d);}})[_0x22ce('0x3e')](function(_0x330295){if(_0x330295){_0x5325b6=_0x330295[_0x22ce('0x53')];if(!_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x6f')](_0x22ce('0x54'))){_0x819d6d[_0x22ce('0x37')]=qs[_0x22ce('0x37')](_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x37')]);_0x819d6d[_0x22ce('0x35')]=qs[_0x22ce('0x35')](_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x35')]);}return _0x1de53b[_0x22ce('0xbd')](_0x819d6d);}})[_0x22ce('0x3e')](function(_0x28337a){if(_0x28337a){return _0x28337a?{'count':_0x5325b6,'rows':_0x28337a}:null;}})[_0x22ce('0x3e')](respondWithResult(_0x15b2db,null))[_0x22ce('0x30')](handleError(_0x15b2db,null));};exports[_0x22ce('0x43')]=function(_0x11442f,_0x53ee5a,_0x91ca75){var _0x47a294,_0x3754d7,_0x43c6b3;if(_[_0x22ce('0x82')](_0x11442f['body'][_0x22ce('0x63')])||_0x11442f[_0x22ce('0x63')]['body']===''){throw new db[(_0x22ce('0x7d'))][(_0x22ce('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x22ce('0x82')](_0x11442f[_0x22ce('0x63')]['to'])){}_0x47a294=_0x11442f['body']['to'];return db[_0x22ce('0x46')]['findOne']({'where':{'id':_0x11442f[_0x22ce('0x69')]['id']}})['then'](handleEntityNotFound(_0x53ee5a,null))[_0x22ce('0x3e')](function(_0x4e766d){if(_0x4e766d){return db[_0x22ce('0x46')]['find']({'where':{'id':_0x4e766d['id']},'include':[{'model':db[_0x22ce('0x87')],'as':_0x22ce('0x88'),'include':[{'model':db['CmContact'],'as':_0x22ce('0x90'),'where':{[_0x4e766d['mapKey']]:_0x47a294},'limit':0x1,'order':[[_0x22ce('0x81'),'DESC']]}]}]})[_0x22ce('0x3e')](handleEntityNotFound(_0x53ee5a,null))[_0x22ce('0x3e')](function(_0x54afa9){if(_0x54afa9&&_0x54afa9[_0x22ce('0x88')]){_0x3754d7=_0x54afa9[_0x22ce('0x3f')]({'plain':!![]});if(_0x3754d7[_0x22ce('0x88')]&&_0x3754d7[_0x22ce('0x88')][_0x22ce('0x90')][_0x22ce('0x53')]){return _0x3754d7[_0x22ce('0x88')]['Contacts'][0x0];}return db[_0x22ce('0x7c')][_0x22ce('0x6d')](_[_0x22ce('0x1d')](_0x11442f[_0x22ce('0x63')],{'firstName':_0x47a294,[_0x54afa9[_0x22ce('0x84')]]:_0x47a294,'phone':_0x47a294,'ListId':_0x3754d7[_0x22ce('0x92')]}));}})[_0x22ce('0x3e')](handleEntityNotFound(_0x53ee5a,null))[_0x22ce('0x3e')](function(_0x18bb99){if(_0x18bb99){_0x43c6b3=_0x18bb99;return db['OpenchannelInteraction'][_0x22ce('0x62')]({'where':{'ContactId':_0x43c6b3['id'],'closed':![],'OpenchannelAccountId':_0x3754d7['id']}})[_0x22ce('0x3e')](function(_0x4397a6){if(_0x4397a6){return[_0x4397a6,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x11442f[_0x22ce('0x65')]['id'],'ContactId':_0x43c6b3['id'],'OpenchannelAccountId':_0x3754d7['id'],'lastMsgDirection':_0x22ce('0xbe'),'Messages':[_[_0x22ce('0x5a')](_0x11442f['body'],{'read':![],'body':_0x11442f[_0x22ce('0x63')][_0x22ce('0x63')],'OpenchannelAccountId':_0x3754d7['id'],'UserId':_0x11442f[_0x22ce('0x65')]['id'],'ContactId':_0x43c6b3['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x22ce('0xbf')}]})[_0x22ce('0x3e')](function(_0x1d29cd){return[_0x1d29cd,!![]];});});}})[_0x22ce('0x98')](function(_0x58be84,_0x180731){if(_0x180731){return _0x58be84;}return db[_0x22ce('0xa0')][_0x22ce('0x6d')](_[_0x22ce('0x5a')](_0x11442f['body'],{'read':![],'body':_0x11442f[_0x22ce('0x63')][_0x22ce('0x63')],'OpenchannelAccountId':_0x3754d7['id'],'OpenchannelInteractionId':_0x58be84['id'],'UserId':_0x11442f['user']['id'],'ContactId':_0x43c6b3['id']}))['then'](function(_0x5665f4){_0x58be84[_0x22ce('0xc0')][_0x22ce('0xbf')]=[];_0x58be84[_0x22ce('0xc0')][_0x22ce('0xbf')]['push'](_0x5665f4['dataValues']);return _0x58be84;});});}})[_0x22ce('0x3e')](respondWithResult(_0x53ee5a,null))[_0x22ce('0x30')](handleError(_0x53ee5a,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index be864d4..c9521b4 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0xfaa013,_0x3bc26e){var _0x518a38=function(_0x28a2fd){while(--_0x28a2fd){_0xfaa013['push'](_0xfaa013['shift']());}};_0x518a38(++_0x3bc26e);}(_0x13f6,0x124));var _0x613f=function(_0x2fb7de,_0x2c6fa7){_0x2fb7de=_0x2fb7de-0x0;var _0x4bbfc6=_0x13f6[_0x2fb7de];return _0x4bbfc6;};'use strict';var EventEmitter=require(_0x613f('0x0'));var OpenchannelAccount=require(_0x613f('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){OpenchannelAccountEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);OpenchannelAccountEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update'];(function(_0x324a3d,_0x89378){var _0x5f5323=function(_0x35ac36){while(--_0x35ac36){_0x324a3d['push'](_0x324a3d['shift']());}};_0x5f5323(++_0x89378);}(_0x54ef,0x112));var _0xf54e=function(_0x7c78b,_0x372311){_0x7c78b=_0x7c78b-0x0;var _0x54089d=_0x54ef[_0x7c78b];return _0x54089d;};'use strict';var EventEmitter=require(_0xf54e('0x0'));var OpenchannelAccount=require(_0xf54e('0x1'))['db'][_0xf54e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf54e('0x3'),'afterUpdate':_0xf54e('0x4'),'afterDestroy':_0xf54e('0x5')};function emitEvent(_0x42b9b2){return function(_0x8b6bb6,_0x431e36,_0x12d43f){OpenchannelAccountEvents['emit'](_0x42b9b2+':'+_0x8b6bb6['id'],_0x8b6bb6);OpenchannelAccountEvents['emit'](_0x42b9b2,_0x8b6bb6);_0x12d43f(null);};}for(var e in events){if(events[_0xf54e('0x6')](e)){var event=events[e];OpenchannelAccount[_0xf54e('0x7')](e,emitEvent(event));}}module[_0xf54e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index dcf5769..61c7586 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5e7700,_0x2107a2){var _0x333bc4=function(_0x25a01b){while(--_0x25a01b){_0x5e7700['push'](_0x5e7700['shift']());}};_0x333bc4(++_0x2107a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x362e21,_0x4e0d72){var _0x575127=function(_0x4a009c){while(--_0x4a009c){_0x362e21['push'](_0x362e21['shift']());}};_0x575127(++_0x4e0d72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index b9d98f6..dfccbf2 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f4d=['defaults','localhost','socket.io-emitter','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis'];(function(_0x52e857,_0x38ff1e){var _0x2e50a2=function(_0x17c683){while(--_0x17c683){_0x52e857['push'](_0x52e857['shift']());}};_0x2e50a2(++_0x38ff1e);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x5d3394,_0x5e5dce){_0x5d3394=_0x5d3394-0x0;var _0x102ca5=_0x9f4d[_0x5d3394];return _0x102ca5;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require(_0xd9f4('0x4'));var fs=require('fs');var Redis=require(_0xd9f4('0x5'));var db=require(_0xd9f4('0x6'))['db'];var utils=require(_0xd9f4('0x7'));var logger=require(_0xd9f4('0x8'))('rpc');var config=require(_0xd9f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0xa')][_0xd9f4('0xb')]({'port':0x232a});config[_0xd9f4('0xc')]=_[_0xd9f4('0xd')](config['redis'],{'host':_0xd9f4('0xe'),'port':0x18eb});var socket=require(_0xd9f4('0xf'))(new Redis(config['redis']));require(_0xd9f4('0x10'))['register'](socket);function respondWithRpcPromise(_0x16cacf,_0x41709a,_0x2deeb5){return new BPromise(function(_0x429d90,_0x2bd084){return client['request'](_0x16cacf,_0x2deeb5)[_0xd9f4('0x11')](function(_0x312d09){logger[_0xd9f4('0x12')](_0xd9f4('0x13'),_0x41709a,_0xd9f4('0x14'));logger[_0xd9f4('0x15')](_0xd9f4('0x16'),_0x41709a,_0xd9f4('0x14'),JSON['stringify'](_0x312d09));if(_0x312d09[_0xd9f4('0x17')]){if(_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x18')]===0x1f4){logger[_0xd9f4('0x17')](_0xd9f4('0x13'),_0x41709a,_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x19')]);return _0x2bd084(_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x19')]);}logger[_0xd9f4('0x17')](_0xd9f4('0x13'),_0x41709a,_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x19')]);return _0x429d90(_0x312d09['error']['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x41709a,_0xd9f4('0x14'));_0x429d90(_0x312d09[_0xd9f4('0x1a')][_0xd9f4('0x19')]);}})['catch'](function(_0x45f93c){logger[_0xd9f4('0x17')](_0xd9f4('0x13'),_0x41709a,_0x45f93c);_0x2bd084(_0x45f93c);});});} \ No newline at end of file +var _0x0972=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0972,0x64));var _0x2097=function(_0x2f2553,_0x3e2871){_0x2f2553=_0x2f2553-0x0;var _0x31b076=_0x0972[_0x2f2553];return _0x31b076;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});config[_0x2097('0xa')]=_['defaults'](config[_0x2097('0xa')],{'host':_0x2097('0xb'),'port':0x18eb});var socket=require(_0x2097('0xc'))(new Redis(config[_0x2097('0xa')]));require(_0x2097('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e0024,_0x3b8b76,_0x131f06){return new BPromise(function(_0x430754,_0x7baeb3){return client[_0x2097('0xe')](_0x2e0024,_0x131f06)[_0x2097('0xf')](function(_0x1d1166){logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));logger[_0x2097('0x13')](_0x2097('0x14'),_0x3b8b76,_0x2097('0x12'),JSON[_0x2097('0x15')](_0x1d1166));if(_0x1d1166[_0x2097('0x16')]){if(_0x1d1166[_0x2097('0x16')][_0x2097('0x17')]===0x1f4){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x1d1166['error'][_0x2097('0x18')]);return _0x7baeb3(_0x1d1166[_0x2097('0x16')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3b8b76,_0x1d1166[_0x2097('0x16')]['message']);return _0x430754(_0x1d1166[_0x2097('0x16')][_0x2097('0x18')]);}else{logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));_0x430754(_0x1d1166['result'][_0x2097('0x18')]);}})[_0x2097('0x19')](function(_0x451584){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x451584);_0x7baeb3(_0x451584);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 875c606..c330214 100644 --- a/server/api/openchannelAccount/openchannelAccount.socket.js +++ b/server/api/openchannelAccount/openchannelAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e54=['register','length','./openchannelAccount.events','update','emit'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2e54,0x1dd));var _0x42e5=function(_0x18378c,_0x574c41){_0x18378c=_0x18378c-0x0;var _0x29688e=_0x2e54[_0x18378c];return _0x29688e;};'use strict';var OpenchannelAccountEvents=require(_0x42e5('0x0'));var events=['save','remove',_0x42e5('0x1')];function createListener(_0x23f008,_0x3cf9bd){return function(_0x1c62bb){_0x3cf9bd[_0x42e5('0x2')](_0x23f008,_0x1c62bb);};}function removeListener(_0x153440,_0x42736b){return function(){OpenchannelAccountEvents['removeListener'](_0x153440,_0x42736b);};}exports[_0x42e5('0x3')]=function(_0x455f48){for(var _0x38cb1b=0x0,_0x4bed10=events[_0x42e5('0x4')];_0x38cb1b<_0x4bed10;_0x38cb1b++){var _0x56be20=events[_0x38cb1b];var _0x335b92=createListener('openchannelAccount:'+_0x56be20,_0x455f48);OpenchannelAccountEvents['on'](_0x56be20,_0x335b92);}}; \ No newline at end of file +var _0x195e=['save','remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x815712,_0x27a650){var _0x234dc8=function(_0x687a24){while(--_0x687a24){_0x815712['push'](_0x815712['shift']());}};_0x234dc8(++_0x27a650);}(_0x195e,0xfb));var _0xe195=function(_0x5057ce,_0x549c32){_0x5057ce=_0x5057ce-0x0;var _0x3a5581=_0x195e[_0x5057ce];return _0x3a5581;};'use strict';var OpenchannelAccountEvents=require(_0xe195('0x0'));var events=[_0xe195('0x1'),_0xe195('0x2'),_0xe195('0x3')];function createListener(_0x40fe4d,_0x3975a9){return function(_0x31ca3b){_0x3975a9[_0xe195('0x4')](_0x40fe4d,_0x31ca3b);};}function removeListener(_0x2243e9,_0x30011c){return function(){OpenchannelAccountEvents[_0xe195('0x5')](_0x2243e9,_0x30011c);};}exports[_0xe195('0x6')]=function(_0x11cc55){for(var _0x595c13=0x0,_0x2a1acc=events[_0xe195('0x7')];_0x595c13<_0x2a1acc;_0x595c13++){var _0x2ead59=events[_0x595c13];var _0x28c1a9=createListener(_0xe195('0x8')+_0x2ead59,_0x11cc55);OpenchannelAccountEvents['on'](_0x2ead59,_0x28c1a9);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 55999aa..9635abc 100644 --- a/server/api/openchannelApplication/index.js +++ b/server/api/openchannelApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc615=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','path'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0xc615,0xa0));var _0x5c61=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0xc615[_0x3a2a3c];return _0x50ac9a;};'use strict';var multer=require(_0x5c61('0x0'));var util=require('util');var path=require(_0x5c61('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c61('0x2'));var router=express[_0x5c61('0x3')]();var fs_extra=require(_0x5c61('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5c61('0x5'));var config=require(_0x5c61('0x6'));var controller=require(_0x5c61('0x7'));router[_0x5c61('0x8')]('/',auth[_0x5c61('0x9')](),controller[_0x5c61('0xa')]);router[_0x5c61('0x8')](_0x5c61('0xb'),auth[_0x5c61('0x9')](),controller[_0x5c61('0xc')]);router['post']('/',auth[_0x5c61('0x9')](),controller[_0x5c61('0xd')]);router[_0x5c61('0xe')](_0x5c61('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5c61('0xf')](_0x5c61('0xb'),auth[_0x5c61('0x9')](),controller[_0x5c61('0x10')]);module[_0x5c61('0x11')]=router; \ No newline at end of file +var _0x0f2c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','util','connect-timeout'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x0f2c,0x18a));var _0xc0f2=function(_0x4d3b42,_0x3eb19){_0x4d3b42=_0x4d3b42-0x0;var _0x5e0d42=_0x0f2c[_0x4d3b42];return _0x5e0d42;};'use strict';var multer=require('multer');var util=require(_0xc0f2('0x0'));var path=require('path');var timeout=require(_0xc0f2('0x1'));var express=require(_0xc0f2('0x2'));var router=express[_0xc0f2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc0f2('0x4'));var interaction=require(_0xc0f2('0x5'));var config=require(_0xc0f2('0x6'));var controller=require(_0xc0f2('0x7'));router[_0xc0f2('0x8')]('/',auth[_0xc0f2('0x9')](),controller[_0xc0f2('0xa')]);router[_0xc0f2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc0f2('0xb')]);router[_0xc0f2('0xc')]('/',auth['isAuthenticated'](),controller[_0xc0f2('0xd')]);router['put'](_0xc0f2('0xe'),auth[_0xc0f2('0x9')](),controller[_0xc0f2('0xf')]);router[_0xc0f2('0x10')](_0xc0f2('0xe'),auth[_0xc0f2('0x9')](),controller[_0xc0f2('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 67e0aad..9690946 100644 --- a/server/api/openchannelApplication/openchannelApplication.attributes.js +++ b/server/api/openchannelApplication/openchannelApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x992b=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x992b,0xde));var _0xb992=function(_0x179d80,_0x52a7b8){_0x179d80=_0x179d80-0x0;var _0x575a8d=_0x992b[_0x179d80];return _0x575a8d;};'use strict';var Sequelize=require(_0xb992('0x0'));module[_0xb992('0x1')]={'priority':{'type':Sequelize[_0xb992('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb992('0x3')],'allowNull':![],'defaultValue':_0xb992('0x4')},'appdata':{'type':Sequelize[_0xb992('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb992('0x3')],'defaultValue':_0xb992('0x6')}}; \ No newline at end of file +var _0xd85f=['STRING','exports','noop','TEXT'];(function(_0x22af8a,_0x5cdd45){var _0x4ca03f=function(_0x32b3bb){while(--_0x32b3bb){_0x22af8a['push'](_0x22af8a['shift']());}};_0x4ca03f(++_0x5cdd45);}(_0xd85f,0xa5));var _0xfd85=function(_0x3cebf7,_0x455fac){_0x3cebf7=_0x3cebf7-0x0;var _0x2b2860=_0xd85f[_0x3cebf7];return _0x2b2860;};'use strict';var Sequelize=require('sequelize');module[_0xfd85('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfd85('0x1')},'appdata':{'type':Sequelize[_0xfd85('0x2')]()},'description':{'type':Sequelize[_0xfd85('0x3')]},'interval':{'type':Sequelize[_0xfd85('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 70c2559..886f3b9 100644 --- a/server/api/openchannelApplication/openchannelApplication.controller.js +++ b/server/api/openchannelApplication/openchannelApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x902c=['limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','merge','where','OpenchannelApplication','includeAll','include','findAll','show','params','length','options','find','create','body','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x50aa2c,_0x2657d4){var _0x4cca6a=function(_0x45b1a8){while(--_0x45b1a8){_0x50aa2c['push'](_0x50aa2c['shift']());}};_0x4cca6a(++_0x2657d4);}(_0x902c,0xb4));var _0xc902=function(_0x3eb7e3,_0x1c9df8){_0x3eb7e3=_0x3eb7e3-0x0;var _0x486eef=_0x902c[_0x3eb7e3];return _0x486eef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc902('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc902('0x1'));var rp=require(_0xc902('0x2'));var moment=require(_0xc902('0x3'));var BPromise=require(_0xc902('0x4'));var Mustache=require('mustache');var util=require(_0xc902('0x5'));var path=require('path');var sox=require(_0xc902('0x6'));var csv=require(_0xc902('0x7'));var ejs=require(_0xc902('0x8'));var fs=require('fs');var fs_extra=require(_0xc902('0x9'));var _=require(_0xc902('0xa'));var squel=require('squel');var crypto=require(_0xc902('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc902('0xc'));var Papa=require(_0xc902('0xd'));var Redis=require('ioredis');var authService=require(_0xc902('0xe'));var qs=require(_0xc902('0xf'));var as=require(_0xc902('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc902('0x11'))(_0xc902('0x12'));var utils=require('../../config/utils');var config=require(_0xc902('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc902('0x14'))['db'];function respondWithStatusCode(_0x557593,_0x2c568a){_0x2c568a=_0x2c568a||0xcc;return function(_0x3baf98){if(_0x3baf98){return _0x557593[_0xc902('0x15')](_0x2c568a);}return _0x557593[_0xc902('0x16')](_0x2c568a)[_0xc902('0x17')]();};}function respondWithResult(_0x1e2981,_0x53786f){_0x53786f=_0x53786f||0xc8;return function(_0x3c2c82){if(_0x3c2c82){return _0x1e2981[_0xc902('0x16')](_0x53786f)[_0xc902('0x18')](_0x3c2c82);}};}function respondWithFilteredResult(_0x5657fa,_0x2e68d3){return function(_0x5cd5bb){if(_0x5cd5bb){var _0x5ca918=typeof _0x2e68d3[_0xc902('0x19')]===_0xc902('0x1a')&&typeof _0x2e68d3[_0xc902('0x1b')]==='undefined';var _0x2f8fa8=_0x5cd5bb[_0xc902('0x1c')];var _0x356283=_0x5ca918?0x0:_0x2e68d3['offset'];var _0x29f0f8=_0x5ca918?_0x5cd5bb[_0xc902('0x1c')]:_0x2e68d3[_0xc902('0x19')]+_0x2e68d3[_0xc902('0x1b')];var _0x1c8afa;if(_0x29f0f8>=_0x2f8fa8){_0x29f0f8=_0x2f8fa8;_0x1c8afa=0xc8;}else{_0x1c8afa=0xce;}_0x5657fa[_0xc902('0x16')](_0x1c8afa);return _0x5657fa[_0xc902('0x1d')](_0xc902('0x1e'),_0x356283+'-'+_0x29f0f8+'/'+_0x2f8fa8)[_0xc902('0x18')](_0x5cd5bb);}return null;};}function patchUpdates(_0x54b199){return function(_0x2cac0d){try{jsonpatch['apply'](_0x2cac0d,_0x54b199,!![]);}catch(_0x3f4366){return BPromise[_0xc902('0x1f')](_0x3f4366);}return _0x2cac0d[_0xc902('0x20')]();};}function saveUpdates(_0x48fa47,_0x68d736){return function(_0x2490aa){if(_0x2490aa){return _0x2490aa[_0xc902('0x21')](_0x48fa47)[_0xc902('0x22')](function(_0x3a1eb3){return _0x3a1eb3;});}return null;};}function removeEntity(_0x42c0ac,_0xbb4eb1){return function(_0x151043){if(_0x151043){return _0x151043[_0xc902('0x23')]()[_0xc902('0x22')](function(){_0x42c0ac['status'](0xcc)[_0xc902('0x17')]();});}};}function handleEntityNotFound(_0x260a6e,_0x427b32){return function(_0x21a81e){if(!_0x21a81e){_0x260a6e[_0xc902('0x15')](0x194);}return _0x21a81e;};}function handleError(_0x5bc594,_0x5e28d9){_0x5e28d9=_0x5e28d9||0x1f4;return function(_0x418dae){logger[_0xc902('0x24')](_0x418dae[_0xc902('0x25')]);if(_0x418dae[_0xc902('0x26')]){delete _0x418dae[_0xc902('0x26')];}_0x5bc594[_0xc902('0x16')](_0x5e28d9)['send'](_0x418dae);};}exports[_0xc902('0x27')]=function(_0xc6dd4d,_0x55645f){var _0x39f099={},_0x479657={},_0x413304={'count':0x0,'rows':[]};var _0x10a052=_[_0xc902('0x28')](db['OpenchannelApplication'][_0xc902('0x29')],function(_0x426ba3){return{'name':_0x426ba3[_0xc902('0x2a')],'type':_0x426ba3[_0xc902('0x2b')]['key']};});_0x479657[_0xc902('0x2c')]=_[_0xc902('0x28')](_0x10a052,_0xc902('0x26'));_0x479657[_0xc902('0x2d')]=_[_0xc902('0x2e')](_0xc6dd4d[_0xc902('0x2d')]);_0x479657[_0xc902('0x2f')]=_[_0xc902('0x30')](_0x479657[_0xc902('0x2c')],_0x479657[_0xc902('0x2d')]);_0x39f099['attributes']=_[_0xc902('0x30')](_0x479657[_0xc902('0x2c')],qs[_0xc902('0x31')](_0xc6dd4d['query']['fields']));_0x39f099[_0xc902('0x32')]=_0x39f099[_0xc902('0x32')]['length']?_0x39f099[_0xc902('0x32')]:_0x479657[_0xc902('0x2c')];if(!_0xc6dd4d['query'][_0xc902('0x33')](_0xc902('0x34'))){_0x39f099[_0xc902('0x1b')]=qs[_0xc902('0x1b')](_0xc6dd4d['query'][_0xc902('0x1b')]);_0x39f099[_0xc902('0x19')]=qs['offset'](_0xc6dd4d[_0xc902('0x2d')][_0xc902('0x19')]);}_0x39f099['order']=qs['sort'](_0xc6dd4d['query'][_0xc902('0x35')]);_0x39f099['where']=qs['filters'](_['pick'](_0xc6dd4d[_0xc902('0x2d')],_0x479657[_0xc902('0x2f')]),_0x10a052);if(_0xc6dd4d['query'][_0xc902('0x36')]){_0x39f099['where']=_['merge'](_0x39f099['where'],{'$or':_[_0xc902('0x28')](_0x10a052,function(_0x3146cd){if(_0x3146cd['type']!=='VIRTUAL'){var _0x409a88={};_0x409a88[_0x3146cd[_0xc902('0x26')]]={'$like':'%'+_0xc6dd4d['query'][_0xc902('0x36')]+'%'};return _0x409a88;}})});}_0x39f099=_[_0xc902('0x37')]({},_0x39f099,_0xc6dd4d['options']);var _0x3647f3={'where':_0x39f099[_0xc902('0x38')]};return db[_0xc902('0x39')][_0xc902('0x1c')](_0x3647f3)[_0xc902('0x22')](function(_0x15be8d){_0x413304['count']=_0x15be8d;if(_0xc6dd4d['query'][_0xc902('0x3a')]){_0x39f099[_0xc902('0x3b')]=[{'all':!![]}];}return db[_0xc902('0x39')][_0xc902('0x3c')](_0x39f099);})[_0xc902('0x22')](function(_0x1ad141){_0x413304['rows']=_0x1ad141;return _0x413304;})[_0xc902('0x22')](respondWithFilteredResult(_0x55645f,_0x39f099))['catch'](handleError(_0x55645f,null));};exports[_0xc902('0x3d')]=function(_0x3fe004,_0x5800bd){var _0x4b6bac={'raw':!![],'where':{'id':_0x3fe004[_0xc902('0x3e')]['id']}},_0x2ac361={};_0x2ac361[_0xc902('0x2c')]=_[_0xc902('0x2e')](db['OpenchannelApplication'][_0xc902('0x29')]);_0x2ac361[_0xc902('0x2d')]=_['keys'](_0x3fe004[_0xc902('0x2d')]);_0x2ac361[_0xc902('0x2f')]=_[_0xc902('0x30')](_0x2ac361[_0xc902('0x2c')],_0x2ac361[_0xc902('0x2d')]);_0x4b6bac[_0xc902('0x32')]=_[_0xc902('0x30')](_0x2ac361['model'],qs['fields'](_0x3fe004[_0xc902('0x2d')][_0xc902('0x31')]));_0x4b6bac[_0xc902('0x32')]=_0x4b6bac[_0xc902('0x32')][_0xc902('0x3f')]?_0x4b6bac[_0xc902('0x32')]:_0x2ac361['model'];if(_0x3fe004['query']['includeAll']){_0x4b6bac[_0xc902('0x3b')]=[{'all':!![]}];}_0x4b6bac=_[_0xc902('0x37')]({},_0x4b6bac,_0x3fe004[_0xc902('0x40')]);return db[_0xc902('0x39')][_0xc902('0x41')](_0x4b6bac)[_0xc902('0x22')](handleEntityNotFound(_0x5800bd,null))[_0xc902('0x22')](respondWithResult(_0x5800bd,null))['catch'](handleError(_0x5800bd,null));};exports[_0xc902('0x42')]=function(_0x167f5d,_0x346d49){return db['OpenchannelApplication'][_0xc902('0x42')](_0x167f5d['body'],{})[_0xc902('0x22')](respondWithResult(_0x346d49,0xc9))['catch'](handleError(_0x346d49,null));};exports[_0xc902('0x21')]=function(_0x5e7e51,_0x1f1b3c){if(_0x5e7e51[_0xc902('0x43')]['id']){delete _0x5e7e51['body']['id'];}return db[_0xc902('0x39')][_0xc902('0x41')]({'where':{'id':_0x5e7e51['params']['id']}})[_0xc902('0x22')](handleEntityNotFound(_0x1f1b3c,null))['then'](saveUpdates(_0x5e7e51[_0xc902('0x43')],null))[_0xc902('0x22')](respondWithResult(_0x1f1b3c,null))[_0xc902('0x44')](handleError(_0x1f1b3c,null));};exports['destroy']=function(_0x1e2831,_0x404c53){return db['OpenchannelApplication'][_0xc902('0x41')]({'where':{'id':_0x1e2831[_0xc902('0x3e')]['id']}})[_0xc902('0x22')](handleEntityNotFound(_0x404c53,null))['then'](removeEntity(_0x404c53,null))[_0xc902('0x44')](handleError(_0x404c53,null));}; \ No newline at end of file +var _0x6619=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','type','where','OpenchannelApplication','includeAll','include','findAll','rows','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x1729c5,_0x3e8797){var _0x5b3d6c=function(_0x5cc7b9){while(--_0x5cc7b9){_0x1729c5['push'](_0x1729c5['shift']());}};_0x5b3d6c(++_0x3e8797);}(_0x6619,0x1be));var _0x9661=function(_0x19eafc,_0x22b84a){_0x19eafc=_0x19eafc-0x0;var _0x56ff62=_0x6619[_0x19eafc];return _0x56ff62;};'use strict';var emlformat=require(_0x9661('0x0'));var rimraf=require(_0x9661('0x1'));var zipdir=require(_0x9661('0x2'));var jsonpatch=require(_0x9661('0x3'));var rp=require(_0x9661('0x4'));var moment=require('moment');var BPromise=require(_0x9661('0x5'));var Mustache=require('mustache');var util=require(_0x9661('0x6'));var path=require(_0x9661('0x7'));var sox=require('sox');var csv=require(_0x9661('0x8'));var ejs=require(_0x9661('0x9'));var fs=require('fs');var fs_extra=require(_0x9661('0xa'));var _=require(_0x9661('0xb'));var squel=require(_0x9661('0xc'));var crypto=require(_0x9661('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9661('0xe'));var toCsv=require(_0x9661('0x8'));var querystring=require(_0x9661('0xf'));var Papa=require(_0x9661('0x10'));var Redis=require('ioredis');var authService=require(_0x9661('0x11'));var qs=require(_0x9661('0x12'));var as=require(_0x9661('0x13'));var hardwareService=require(_0x9661('0x14'));var logger=require(_0x9661('0x15'))(_0x9661('0x16'));var utils=require(_0x9661('0x17'));var config=require(_0x9661('0x18'));var licenseUtil=require(_0x9661('0x19'));var db=require(_0x9661('0x1a'))['db'];function respondWithStatusCode(_0x4aff3a,_0x111944){_0x111944=_0x111944||0xcc;return function(_0x2cac04){if(_0x2cac04){return _0x4aff3a['sendStatus'](_0x111944);}return _0x4aff3a[_0x9661('0x1b')](_0x111944)['end']();};}function respondWithResult(_0x2227c4,_0x2d48a8){_0x2d48a8=_0x2d48a8||0xc8;return function(_0x4931a4){if(_0x4931a4){return _0x2227c4[_0x9661('0x1b')](_0x2d48a8)[_0x9661('0x1c')](_0x4931a4);}};}function respondWithFilteredResult(_0x5ae076,_0x110f62){return function(_0x3d06a6){if(_0x3d06a6){var _0x39d2bf=typeof _0x110f62['offset']===_0x9661('0x1d')&&typeof _0x110f62[_0x9661('0x1e')]==='undefined';var _0x5b5b81=_0x3d06a6[_0x9661('0x1f')];var _0x414eb5=_0x39d2bf?0x0:_0x110f62[_0x9661('0x20')];var _0x1d94a4=_0x39d2bf?_0x3d06a6[_0x9661('0x1f')]:_0x110f62[_0x9661('0x20')]+_0x110f62[_0x9661('0x1e')];var _0x28998e;if(_0x1d94a4>=_0x5b5b81){_0x1d94a4=_0x5b5b81;_0x28998e=0xc8;}else{_0x28998e=0xce;}_0x5ae076['status'](_0x28998e);return _0x5ae076[_0x9661('0x21')](_0x9661('0x22'),_0x414eb5+'-'+_0x1d94a4+'/'+_0x5b5b81)[_0x9661('0x1c')](_0x3d06a6);}return null;};}function patchUpdates(_0x4a37f2){return function(_0x5cd4fd){try{jsonpatch[_0x9661('0x23')](_0x5cd4fd,_0x4a37f2,!![]);}catch(_0x4e7103){return BPromise[_0x9661('0x24')](_0x4e7103);}return _0x5cd4fd[_0x9661('0x25')]();};}function saveUpdates(_0x332083,_0x2e8daa){return function(_0x3d685b){if(_0x3d685b){return _0x3d685b[_0x9661('0x26')](_0x332083)[_0x9661('0x27')](function(_0x233ed3){return _0x233ed3;});}return null;};}function removeEntity(_0x542138,_0xb88760){return function(_0x17dfb8){if(_0x17dfb8){return _0x17dfb8[_0x9661('0x28')]()[_0x9661('0x27')](function(){_0x542138[_0x9661('0x1b')](0xcc)[_0x9661('0x29')]();});}};}function handleEntityNotFound(_0x5a83ac,_0x24f87a){return function(_0x220bd0){if(!_0x220bd0){_0x5a83ac[_0x9661('0x2a')](0x194);}return _0x220bd0;};}function handleError(_0x3307ff,_0x4e7abe){_0x4e7abe=_0x4e7abe||0x1f4;return function(_0x8d63d3){logger[_0x9661('0x2b')](_0x8d63d3[_0x9661('0x2c')]);if(_0x8d63d3[_0x9661('0x2d')]){delete _0x8d63d3[_0x9661('0x2d')];}_0x3307ff[_0x9661('0x1b')](_0x4e7abe)[_0x9661('0x2e')](_0x8d63d3);};}exports[_0x9661('0x2f')]=function(_0x2eea0a,_0x53e30b){var _0xdfc324={},_0x5ac326={},_0xb6c566={'count':0x0,'rows':[]};var _0x16a48d=_[_0x9661('0x30')](db['OpenchannelApplication'][_0x9661('0x31')],function(_0xe295b3){return{'name':_0xe295b3[_0x9661('0x32')],'type':_0xe295b3['type'][_0x9661('0x33')]};});_0x5ac326[_0x9661('0x34')]=_[_0x9661('0x30')](_0x16a48d,'name');_0x5ac326[_0x9661('0x35')]=_[_0x9661('0x36')](_0x2eea0a[_0x9661('0x35')]);_0x5ac326[_0x9661('0x37')]=_[_0x9661('0x38')](_0x5ac326[_0x9661('0x34')],_0x5ac326[_0x9661('0x35')]);_0xdfc324[_0x9661('0x39')]=_[_0x9661('0x38')](_0x5ac326[_0x9661('0x34')],qs[_0x9661('0x3a')](_0x2eea0a['query']['fields']));_0xdfc324[_0x9661('0x39')]=_0xdfc324[_0x9661('0x39')][_0x9661('0x3b')]?_0xdfc324[_0x9661('0x39')]:_0x5ac326[_0x9661('0x34')];if(!_0x2eea0a['query'][_0x9661('0x3c')](_0x9661('0x3d'))){_0xdfc324[_0x9661('0x1e')]=qs[_0x9661('0x1e')](_0x2eea0a['query']['limit']);_0xdfc324[_0x9661('0x20')]=qs['offset'](_0x2eea0a[_0x9661('0x35')][_0x9661('0x20')]);}_0xdfc324[_0x9661('0x3e')]=qs['sort'](_0x2eea0a[_0x9661('0x35')]['sort']);_0xdfc324['where']=qs[_0x9661('0x37')](_[_0x9661('0x3f')](_0x2eea0a['query'],_0x5ac326[_0x9661('0x37')]),_0x16a48d);if(_0x2eea0a[_0x9661('0x35')][_0x9661('0x40')]){_0xdfc324['where']=_[_0x9661('0x41')](_0xdfc324['where'],{'$or':_['map'](_0x16a48d,function(_0x3d081d){if(_0x3d081d[_0x9661('0x42')]!=='VIRTUAL'){var _0xe62ccf={};_0xe62ccf[_0x3d081d[_0x9661('0x2d')]]={'$like':'%'+_0x2eea0a[_0x9661('0x35')][_0x9661('0x40')]+'%'};return _0xe62ccf;}})});}_0xdfc324=_[_0x9661('0x41')]({},_0xdfc324,_0x2eea0a['options']);var _0x53c2e9={'where':_0xdfc324[_0x9661('0x43')]};return db[_0x9661('0x44')]['count'](_0x53c2e9)['then'](function(_0x3dc1e3){_0xb6c566[_0x9661('0x1f')]=_0x3dc1e3;if(_0x2eea0a[_0x9661('0x35')][_0x9661('0x45')]){_0xdfc324[_0x9661('0x46')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x9661('0x47')](_0xdfc324);})[_0x9661('0x27')](function(_0x1bcb3b){_0xb6c566[_0x9661('0x48')]=_0x1bcb3b;return _0xb6c566;})[_0x9661('0x27')](respondWithFilteredResult(_0x53e30b,_0xdfc324))['catch'](handleError(_0x53e30b,null));};exports['show']=function(_0x276ee1,_0x4b83f9){var _0x3dd958={'raw':!![],'where':{'id':_0x276ee1['params']['id']}},_0x1762ab={};_0x1762ab[_0x9661('0x34')]=_['keys'](db[_0x9661('0x44')]['rawAttributes']);_0x1762ab[_0x9661('0x35')]=_[_0x9661('0x36')](_0x276ee1['query']);_0x1762ab[_0x9661('0x37')]=_['intersection'](_0x1762ab[_0x9661('0x34')],_0x1762ab[_0x9661('0x35')]);_0x3dd958['attributes']=_[_0x9661('0x38')](_0x1762ab[_0x9661('0x34')],qs[_0x9661('0x3a')](_0x276ee1['query'][_0x9661('0x3a')]));_0x3dd958[_0x9661('0x39')]=_0x3dd958[_0x9661('0x39')][_0x9661('0x3b')]?_0x3dd958['attributes']:_0x1762ab[_0x9661('0x34')];if(_0x276ee1[_0x9661('0x35')][_0x9661('0x45')]){_0x3dd958[_0x9661('0x46')]=[{'all':!![]}];}_0x3dd958=_[_0x9661('0x41')]({},_0x3dd958,_0x276ee1[_0x9661('0x49')]);return db['OpenchannelApplication'][_0x9661('0x4a')](_0x3dd958)[_0x9661('0x27')](handleEntityNotFound(_0x4b83f9,null))[_0x9661('0x27')](respondWithResult(_0x4b83f9,null))[_0x9661('0x4b')](handleError(_0x4b83f9,null));};exports['create']=function(_0x958bd0,_0x5b8733){return db['OpenchannelApplication']['create'](_0x958bd0[_0x9661('0x4c')],{})['then'](respondWithResult(_0x5b8733,0xc9))['catch'](handleError(_0x5b8733,null));};exports['update']=function(_0x1f71c6,_0x4a06f3){if(_0x1f71c6['body']['id']){delete _0x1f71c6[_0x9661('0x4c')]['id'];}return db['OpenchannelApplication'][_0x9661('0x4a')]({'where':{'id':_0x1f71c6['params']['id']}})['then'](handleEntityNotFound(_0x4a06f3,null))['then'](saveUpdates(_0x1f71c6[_0x9661('0x4c')],null))['then'](respondWithResult(_0x4a06f3,null))[_0x9661('0x4b')](handleError(_0x4a06f3,null));};exports[_0x9661('0x28')]=function(_0x3d4fdd,_0x808f97){return db[_0x9661('0x44')]['find']({'where':{'id':_0x3d4fdd['params']['id']}})[_0x9661('0x27')](handleEntityNotFound(_0x808f97,null))[_0x9661('0x27')](removeEntity(_0x808f97,null))[_0x9661('0x4b')](handleError(_0x808f97,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8f34a5e..8cd3d00 100644 --- a/server/api/openchannelApplication/openchannelApplication.model.js +++ b/server/api/openchannelApplication/openchannelApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2490=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelApplication.attributes','OpenchannelApplication'];(function(_0x467f61,_0x23a9e5){var _0x1ceb60=function(_0x1488f6){while(--_0x1488f6){_0x467f61['push'](_0x467f61['shift']());}};_0x1ceb60(++_0x23a9e5);}(_0x2490,0x1e3));var _0x0249=function(_0x5a47de,_0x202904){_0x5a47de=_0x5a47de-0x0;var _0x4263d6=_0x2490[_0x5a47de];return _0x4263d6;};'use strict';var _=require(_0x0249('0x0'));var util=require('util');var logger=require(_0x0249('0x1'))(_0x0249('0x2'));var moment=require(_0x0249('0x3'));var BPromise=require(_0x0249('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0249('0x5'));var config=require(_0x0249('0x6'));var attributes=require(_0x0249('0x7'));module['exports']=function(_0x3fe0b0,_0x20a735){return _0x3fe0b0['define'](_0x0249('0x8'),attributes,{'tableName':_0x0249('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0249('0xa'),'collate':_0x0249('0xb')});}; \ No newline at end of file +var _0x1590=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x574ce3,_0x59eef4){var _0x3447a0=function(_0x27f8cb){while(--_0x27f8cb){_0x574ce3['push'](_0x574ce3['shift']());}};_0x3447a0(++_0x59eef4);}(_0x1590,0x10e));var _0x0159=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1590[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x0159('0x0'));var util=require(_0x0159('0x1'));var logger=require(_0x0159('0x2'))(_0x0159('0x3'));var moment=require(_0x0159('0x4'));var BPromise=require(_0x0159('0x5'));var rp=require(_0x0159('0x6'));var fs=require('fs');var path=require(_0x0159('0x7'));var rimraf=require('rimraf');var config=require(_0x0159('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0x0159('0x9')]=function(_0x214a46,_0x3b74ad){return _0x214a46[_0x0159('0xa')](_0x0159('0xb'),attributes,{'tableName':_0x0159('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0159('0xd'),'collate':_0x0159('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6c4ced1..8d732bf 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbd5=['error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','where','attributes','limit','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0xcbd5,0xfb));var _0x5cbd=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0xcbd5[_0x274638];return _0x5755df;};'use strict';var _=require(_0x5cbd('0x0'));var util=require(_0x5cbd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5cbd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cbd('0x3'))['db'];var utils=require(_0x5cbd('0x4'));var logger=require(_0x5cbd('0x5'))(_0x5cbd('0x6'));var config=require(_0x5cbd('0x7'));var jayson=require(_0x5cbd('0x8'));var client=jayson[_0x5cbd('0x9')][_0x5cbd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f8dcd,_0x3c7dc3,_0x7fbac7){return new BPromise(function(_0x2e2b53,_0x136fd4){return client[_0x5cbd('0xb')](_0x4f8dcd,_0x7fbac7)[_0x5cbd('0xc')](function(_0x3b0963){logger[_0x5cbd('0xd')](_0x5cbd('0xe'),_0x3c7dc3,_0x5cbd('0xf'));logger[_0x5cbd('0x10')](_0x5cbd('0x11'),_0x3c7dc3,_0x5cbd('0xf'),JSON[_0x5cbd('0x12')](_0x3b0963));if(_0x3b0963[_0x5cbd('0x13')]){if(_0x3b0963[_0x5cbd('0x13')][_0x5cbd('0x14')]===0x1f4){logger['error'](_0x5cbd('0xe'),_0x3c7dc3,_0x3b0963['error']['message']);return _0x136fd4(_0x3b0963[_0x5cbd('0x13')][_0x5cbd('0x15')]);}logger[_0x5cbd('0x13')](_0x5cbd('0xe'),_0x3c7dc3,_0x3b0963[_0x5cbd('0x13')][_0x5cbd('0x15')]);return _0x2e2b53(_0x3b0963[_0x5cbd('0x13')][_0x5cbd('0x15')]);}else{logger[_0x5cbd('0xd')](_0x5cbd('0xe'),_0x3c7dc3,_0x5cbd('0xf'));_0x2e2b53(_0x3b0963['result']['message']);}})[_0x5cbd('0x16')](function(_0x1acca6){logger[_0x5cbd('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x3c7dc3,_0x1acca6);_0x136fd4(_0x1acca6);});});}exports[_0x5cbd('0x17')]=function(_0x16221d){var _0x324811=this;return new Promise(function(_0x15ca45,_0x5a4c5d){return db[_0x5cbd('0x18')]['update'](_0x16221d[_0x5cbd('0x19')],{'raw':_0x16221d[_0x5cbd('0x1a')]?_0x16221d[_0x5cbd('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16221d['options']?_0x16221d[_0x5cbd('0x1a')][_0x5cbd('0x1b')]||null:null,'attributes':_0x16221d[_0x5cbd('0x1a')]?_0x16221d['options'][_0x5cbd('0x1c')]||null:null,'limit':_0x16221d[_0x5cbd('0x1a')]?_0x16221d['options'][_0x5cbd('0x1d')]||null:null})[_0x5cbd('0xc')](function(_0x2e1687){logger[_0x5cbd('0xd')](_0x5cbd('0x17'),_0x16221d);logger[_0x5cbd('0x10')]('UpdateOpenchannelApplication',_0x16221d,JSON[_0x5cbd('0x12')](_0x2e1687));_0x15ca45(_0x2e1687);})[_0x5cbd('0x16')](function(_0x1c0d52){logger[_0x5cbd('0x13')](_0x5cbd('0x17'),_0x1c0d52[_0x5cbd('0x15')],_0x16221d);_0x5a4c5d(_0x324811['error'](0x1f4,_0x1c0d52[_0x5cbd('0x15')]));});});}; \ No newline at end of file +var _0x0195=['options','raw','attributes','debug','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelApplication,\x20%s,\x20%s','UpdateOpenchannelApplication','OpenchannelApplication','body'];(function(_0x1f73c3,_0xa8af11){var _0x20450e=function(_0x2f30fb){while(--_0x2f30fb){_0x1f73c3['push'](_0x1f73c3['shift']());}};_0x20450e(++_0xa8af11);}(_0x0195,0x13d));var _0x5019=function(_0x5edaf1,_0x5322d8){_0x5edaf1=_0x5edaf1-0x0;var _0x256476=_0x0195[_0x5edaf1];return _0x256476;};'use strict';var _=require(_0x5019('0x0'));var util=require(_0x5019('0x1'));var moment=require(_0x5019('0x2'));var BPromise=require(_0x5019('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5019('0x4'))['db'];var utils=require(_0x5019('0x5'));var logger=require(_0x5019('0x6'))('rpc');var config=require(_0x5019('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5019('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45f258,_0x15ebf3,_0x4d46ca){return new BPromise(function(_0x32b2f4,_0x40faed){return client['request'](_0x45f258,_0x4d46ca)[_0x5019('0x9')](function(_0x582cf3){logger[_0x5019('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x15ebf3,_0x5019('0xb'));logger['debug'](_0x5019('0xc'),_0x15ebf3,_0x5019('0xb'),JSON[_0x5019('0xd')](_0x582cf3));if(_0x582cf3[_0x5019('0xe')]){if(_0x582cf3[_0x5019('0xe')][_0x5019('0xf')]===0x1f4){logger[_0x5019('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x15ebf3,_0x582cf3[_0x5019('0xe')][_0x5019('0x10')]);return _0x40faed(_0x582cf3[_0x5019('0xe')][_0x5019('0x10')]);}logger[_0x5019('0xe')](_0x5019('0x11'),_0x15ebf3,_0x582cf3['error'][_0x5019('0x10')]);return _0x32b2f4(_0x582cf3['error'][_0x5019('0x10')]);}else{logger[_0x5019('0xa')](_0x5019('0x11'),_0x15ebf3,_0x5019('0xb'));_0x32b2f4(_0x582cf3['result'][_0x5019('0x10')]);}})['catch'](function(_0x1534a5){logger[_0x5019('0xe')](_0x5019('0x11'),_0x15ebf3,_0x1534a5);_0x40faed(_0x1534a5);});});}exports[_0x5019('0x12')]=function(_0x42067d){var _0x54c85d=this;return new Promise(function(_0xa6adcf,_0x4058e7){return db[_0x5019('0x13')]['update'](_0x42067d[_0x5019('0x14')],{'raw':_0x42067d[_0x5019('0x15')]?_0x42067d[_0x5019('0x15')][_0x5019('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42067d[_0x5019('0x15')]?_0x42067d[_0x5019('0x15')]['where']||null:null,'attributes':_0x42067d[_0x5019('0x15')]?_0x42067d[_0x5019('0x15')][_0x5019('0x17')]||null:null,'limit':_0x42067d[_0x5019('0x15')]?_0x42067d[_0x5019('0x15')]['limit']||null:null})[_0x5019('0x9')](function(_0x5cb356){logger[_0x5019('0xa')](_0x5019('0x12'),_0x42067d);logger[_0x5019('0x18')]('UpdateOpenchannelApplication',_0x42067d,JSON[_0x5019('0xd')](_0x5cb356));_0xa6adcf(_0x5cb356);})[_0x5019('0x19')](function(_0x519db6){logger['error'](_0x5019('0x12'),_0x519db6[_0x5019('0x10')],_0x42067d);_0x4058e7(_0x54c85d[_0x5019('0xe')](0x1f4,_0x519db6[_0x5019('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 8805030..eb2787d 100644 --- a/server/api/openchannelInteraction/index.js +++ b/server/api/openchannelInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a64=['describe','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','/:id','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','util','express','Router','../../components/interaction/service','get','index','/describe','isAuthenticated'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x2a64,0x75));var _0x42a6=function(_0x103932,_0x480ed6){_0x103932=_0x103932-0x0;var _0xa2ac2c=_0x2a64[_0x103932];return _0xa2ac2c;};'use strict';var multer=require('multer');var util=require(_0x42a6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x42a6('0x1'));var router=express[_0x42a6('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x42a6('0x3'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x42a6('0x4')]('/',auth['isAuthenticated'](),controller[_0x42a6('0x5')]);router[_0x42a6('0x4')](_0x42a6('0x6'),auth[_0x42a6('0x7')](),controller[_0x42a6('0x8')]);router[_0x42a6('0x4')]('/:id',auth[_0x42a6('0x7')](),controller[_0x42a6('0x9')]);router[_0x42a6('0x4')](_0x42a6('0xa'),auth[_0x42a6('0x7')](),controller[_0x42a6('0xb')]);router[_0x42a6('0x4')](_0x42a6('0xc'),auth[_0x42a6('0x7')](),controller['download']);router[_0x42a6('0xd')]('/',auth[_0x42a6('0x7')](),controller['create']);router[_0x42a6('0xd')](_0x42a6('0xa'),auth['isAuthenticated'](),controller[_0x42a6('0xe')]);router[_0x42a6('0xd')](_0x42a6('0xf'),auth[_0x42a6('0x7')](),interaction[_0x42a6('0x10')]('openchannel','openchannelinteraction:addtags'),controller['addTags']);router['put'](_0x42a6('0x11'),auth[_0x42a6('0x7')](),interaction[_0x42a6('0x10')](_0x42a6('0x12'),_0x42a6('0x13')),controller[_0x42a6('0x14')]);router[_0x42a6('0x15')]('/:id',auth[_0x42a6('0x7')](),interaction['tracked'](_0x42a6('0x12'),_0x42a6('0x16')),controller['destroy']);router[_0x42a6('0x15')]('/:id/tags',auth[_0x42a6('0x7')](),controller[_0x42a6('0x17')]);module[_0x42a6('0x18')]=router; \ No newline at end of file +var _0x3b92=['openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','post','addMessage','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete'];(function(_0x15be4e,_0x28d775){var _0x27e898=function(_0x25b225){while(--_0x25b225){_0x15be4e['push'](_0x15be4e['shift']());}};_0x27e898(++_0x28d775);}(_0x3b92,0x85));var _0x23b9=function(_0x44cb5c,_0x4afe83){_0x44cb5c=_0x44cb5c-0x0;var _0x451357=_0x3b92[_0x44cb5c];return _0x451357;};'use strict';var multer=require(_0x23b9('0x0'));var util=require(_0x23b9('0x1'));var path=require(_0x23b9('0x2'));var timeout=require(_0x23b9('0x3'));var express=require(_0x23b9('0x4'));var router=express[_0x23b9('0x5')]();var fs_extra=require(_0x23b9('0x6'));var auth=require(_0x23b9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x23b9('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x23b9('0x9')]('/',auth[_0x23b9('0xa')](),controller[_0x23b9('0xb')]);router['get']('/describe',auth[_0x23b9('0xa')](),controller[_0x23b9('0xc')]);router[_0x23b9('0x9')](_0x23b9('0xd'),auth[_0x23b9('0xa')](),controller[_0x23b9('0xe')]);router[_0x23b9('0x9')](_0x23b9('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0x23b9('0x9')](_0x23b9('0x10'),auth[_0x23b9('0xa')](),controller[_0x23b9('0x11')]);router[_0x23b9('0x12')]('/',auth[_0x23b9('0xa')](),controller['create']);router['post'](_0x23b9('0xf'),auth[_0x23b9('0xa')](),controller[_0x23b9('0x13')]);router[_0x23b9('0x12')]('/:id/tags',auth[_0x23b9('0xa')](),interaction[_0x23b9('0x14')](_0x23b9('0x15'),_0x23b9('0x16')),controller['addTags']);router[_0x23b9('0x17')]('/:id',auth[_0x23b9('0xa')](),interaction[_0x23b9('0x14')](_0x23b9('0x15'),_0x23b9('0x18')),controller[_0x23b9('0x19')]);router[_0x23b9('0x1a')](_0x23b9('0xd'),auth[_0x23b9('0xa')](),interaction[_0x23b9('0x14')](_0x23b9('0x15'),_0x23b9('0x1b')),controller[_0x23b9('0x1c')]);router[_0x23b9('0x1a')](_0x23b9('0x1d'),auth[_0x23b9('0xa')](),controller[_0x23b9('0x1e')]);module[_0x23b9('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 0b11bad..74d7149 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.attributes.js +++ b/server/api/openchannelInteraction/openchannelInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde5f=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde5f,0x97));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfde5('0x0'));module[_0xfde5('0x1')]={'closed':{'type':Sequelize[_0xfde5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfde5('0x3')]},'disposition':{'type':Sequelize[_0xfde5('0x4')]},'secondDisposition':{'type':Sequelize[_0xfde5('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfde5('0x4')]},'note':{'type':Sequelize[_0xfde5('0x4')]},'read1stAt':{'type':Sequelize[_0xfde5('0x3')]},'threadId':{'type':Sequelize[_0xfde5('0x4')]},'externalUrl':{'type':Sequelize[_0xfde5('0x4')]},'lastMsgAt':{'type':Sequelize[_0xfde5('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xfde5('0x5')]('in',_0xfde5('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xfde5('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xac65=['BOOLEAN','STRING','DATE','ENUM','out','sequelize','exports'];(function(_0x3584a3,_0x577ad5){var _0x35ca83=function(_0x24e033){while(--_0x24e033){_0x3584a3['push'](_0x3584a3['shift']());}};_0x35ca83(++_0x577ad5);}(_0xac65,0x11d));var _0x5ac6=function(_0x14a2cc,_0x5abf6c){_0x14a2cc=_0x14a2cc-0x0;var _0x5e2de2=_0xac65[_0x14a2cc];return _0x5e2de2;};'use strict';var Sequelize=require(_0x5ac6('0x0'));module[_0x5ac6('0x1')]={'closed':{'type':Sequelize[_0x5ac6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5ac6('0x3')]},'secondDisposition':{'type':Sequelize[_0x5ac6('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5ac6('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5ac6('0x4')]},'threadId':{'type':Sequelize[_0x5ac6('0x3')]},'externalUrl':{'type':Sequelize[_0x5ac6('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5ac6('0x5')]('in',_0x5ac6('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5ac6('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x5ac6('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f8d8b88..e9aa459 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.controller.js +++ b/server/api/openchannelInteraction/openchannelInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33cf=['../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','talking','answered','total','closed','UserId','waiting','unmanaged','index','OpenchannelInteraction','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','pick','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','User','start','body','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','merge','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','rows','params','rawAttributes','options','create','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','sort','$gte','format','includeAll','include','addTags','setTags','omit','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','createdAt','secret','OpenchannelAccount','mkdirSync','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Private','existsSync','pipe','createWriteStream','System','basename','direction','out','renderFile','views','downloadInteraction.ejs','.pdf','Openchannel','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x30382f,_0x1df507){var _0x4e3368=function(_0x5e976a){while(--_0x5e976a){_0x30382f['push'](_0x30382f['shift']());}};_0x4e3368(++_0x1df507);}(_0x33cf,0xe3));var _0xf33c=function(_0x1ec858,_0x306d17){_0x1ec858=_0x1ec858-0x0;var _0x22746d=_0x33cf[_0x1ec858];return _0x22746d;};'use strict';var emlformat=require(_0xf33c('0x0'));var rimraf=require(_0xf33c('0x1'));var zipdir=require(_0xf33c('0x2'));var jsonpatch=require(_0xf33c('0x3'));var rp=require(_0xf33c('0x4'));var moment=require(_0xf33c('0x5'));var BPromise=require(_0xf33c('0x6'));var Mustache=require('mustache');var util=require(_0xf33c('0x7'));var path=require('path');var sox=require(_0xf33c('0x8'));var csv=require('to-csv');var ejs=require(_0xf33c('0x9'));var fs=require('fs');var fs_extra=require(_0xf33c('0xa'));var _=require(_0xf33c('0xb'));var squel=require(_0xf33c('0xc'));var crypto=require(_0xf33c('0xd'));var jsforce=require(_0xf33c('0xe'));var deskjs=require(_0xf33c('0xf'));var toCsv=require(_0xf33c('0x10'));var querystring=require(_0xf33c('0x11'));var Papa=require(_0xf33c('0x12'));var Redis=require(_0xf33c('0x13'));var authService=require(_0xf33c('0x14'));var qs=require(_0xf33c('0x15'));var as=require(_0xf33c('0x16'));var pdf=require(_0xf33c('0x17'));var hardwareService=require(_0xf33c('0x18'));var logger=require(_0xf33c('0x19'))('api');var utils=require(_0xf33c('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xf33c('0x1b'));var db=require(_0xf33c('0x1c'))['db'];config[_0xf33c('0x1d')]=_[_0xf33c('0x1e')](config[_0xf33c('0x1d')],{'host':_0xf33c('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf33c('0x20'))[_0xf33c('0x21')](socket);function respondWithStatusCode(_0x5f5cbe,_0x592cb8){_0x592cb8=_0x592cb8||0xcc;return function(_0x1377dc){if(_0x1377dc){return _0x5f5cbe[_0xf33c('0x22')](_0x592cb8);}return _0x5f5cbe[_0xf33c('0x23')](_0x592cb8)[_0xf33c('0x24')]();};}function respondWithResult(_0x275289,_0xb2416f){_0xb2416f=_0xb2416f||0xc8;return function(_0x45a1e3){if(_0x45a1e3){return _0x275289[_0xf33c('0x23')](_0xb2416f)[_0xf33c('0x25')](_0x45a1e3);}};}function respondWithFilteredResult(_0x53ef43,_0x3b4f99){return function(_0x48617b){if(_0x48617b){var _0x47d119=typeof _0x3b4f99[_0xf33c('0x26')]===_0xf33c('0x27')&&typeof _0x3b4f99[_0xf33c('0x28')]===_0xf33c('0x27');var _0xce9118=_0x48617b[_0xf33c('0x29')];var _0x16f1de=_0x47d119?0x0:_0x3b4f99[_0xf33c('0x26')];var _0x2b2897=_0x47d119?_0x48617b[_0xf33c('0x29')]:_0x3b4f99[_0xf33c('0x26')]+_0x3b4f99[_0xf33c('0x28')];var _0xadb020;if(_0x2b2897>=_0xce9118){_0x2b2897=_0xce9118;_0xadb020=0xc8;}else{_0xadb020=0xce;}_0x53ef43[_0xf33c('0x23')](_0xadb020);return _0x53ef43[_0xf33c('0x2a')](_0xf33c('0x2b'),_0x16f1de+'-'+_0x2b2897+'/'+_0xce9118)['json'](_0x48617b);}return null;};}function patchUpdates(_0x30ae09){return function(_0x25e4f8){try{jsonpatch[_0xf33c('0x2c')](_0x25e4f8,_0x30ae09,!![]);}catch(_0x58bfee){return BPromise['reject'](_0x58bfee);}return _0x25e4f8[_0xf33c('0x2d')]();};}function saveUpdates(_0x22cc02,_0x55b64c){return function(_0x1530e1){if(_0x1530e1){return _0x1530e1[_0xf33c('0x2e')](_0x22cc02)[_0xf33c('0x2f')](function(_0x20d17e){return _0x20d17e;});}return null;};}function removeEntity(_0x4f782c,_0x2270de){return function(_0x2f5608){if(_0x2f5608){return _0x2f5608[_0xf33c('0x30')]()[_0xf33c('0x2f')](function(){_0x4f782c['status'](0xcc)[_0xf33c('0x24')]();});}};}function handleEntityNotFound(_0xf7c61f,_0x3eef40){return function(_0x1945b3){if(!_0x1945b3){_0xf7c61f['sendStatus'](0x194);}return _0x1945b3;};}function handleError(_0x44db2e,_0x349b6f){_0x349b6f=_0x349b6f||0x1f4;return function(_0x4b544b){logger[_0xf33c('0x31')](_0x4b544b[_0xf33c('0x32')]);if(_0x4b544b[_0xf33c('0x33')]){delete _0x4b544b[_0xf33c('0x33')];}_0x44db2e['status'](_0x349b6f)[_0xf33c('0x34')](_0x4b544b);};}function getInteractionUsers(_0x4bb9c2,_0x1b0a01){return new BPromise(function(_0x21d8b1,_0x4042ab){try{if(_0x1b0a01[_0x4bb9c2['id']]){_0x4bb9c2[_0xf33c('0x35')]=_[_0xf33c('0x36')](_0x1b0a01[_0x4bb9c2['id']],function(_0x29bd90){return{'id':_0x29bd90['id'],'fullname':_0x29bd90[_0xf33c('0x37')]};});}}catch(_0x277d22){_0x4042ab(_0x277d22);}_0x21d8b1(_0x4bb9c2);});}function getInteractionTags(_0x89db44,_0x5207fd){return new BPromise(function(_0x3e2ea7,_0x5d8f33){try{if(_0x89db44[_0xf33c('0x38')]){_0x89db44[_0xf33c('0x39')]=[];_0x89db44[_0xf33c('0x38')][_0xf33c('0x3a')](',')[_0xf33c('0x3b')](function(_0x2441c0){_0x89db44['Tags'][_0xf33c('0x3c')](_0x5207fd[_0x2441c0]);});}delete _0x89db44[_0xf33c('0x38')];}catch(_0x5a42e){_0x5d8f33(_0x5a42e);}_0x3e2ea7(_0x89db44);});}function updateOpenchannelInteraction(_0x8a8199,_0x55fd6f,_0x1bda7b){return new BPromise(function(_0x3ea2be,_0x5475ab){return getInteractionUsers(_0x8a8199,_0x1bda7b)['then'](function(_0x5348a7){return getInteractionTags(_0x5348a7,_0x55fd6f);})[_0xf33c('0x2f')](function(_0x1bf3b4){return getStateInteraction(_0x1bf3b4);})['then'](function(_0x21112d){_0x3ea2be(_0x21112d);})[_0xf33c('0x3d')](function(_0x3a0169){_0x5475ab(_0x3a0169);});});}function getStateInteraction(_0x2023d2){return new BPromise(function(_0x27e1cd){_0x2023d2['waiting']=0x0;_0x2023d2[_0xf33c('0x3e')]=0x0;_0x2023d2[_0xf33c('0x3f')]=0x0;_0x2023d2['unmanaged']=0x0;_0x2023d2[_0xf33c('0x40')]=0x0;if(!_0x2023d2[_0xf33c('0x41')]&&!_0x2023d2[_0xf33c('0x42')]){_0x2023d2[_0xf33c('0x43')]+=0x1;}if(!_0x2023d2[_0xf33c('0x41')]&&_0x2023d2['UserId']){_0x2023d2[_0xf33c('0x3e')]+=0x1;if(_0x2023d2['waiting']){_0x2023d2[_0xf33c('0x43')]-=0x1;}}if(_0x2023d2['closed']&&_0x2023d2[_0xf33c('0x42')]){_0x2023d2[_0xf33c('0x3f')]+=0x1;if(_0x2023d2[_0xf33c('0x3e')]){_0x2023d2['talking']-=0x1;}}if(_0x2023d2[_0xf33c('0x41')]&&!_0x2023d2['UserId']){_0x2023d2[_0xf33c('0x44')]+=0x1;if(_0x2023d2[_0xf33c('0x43')]){_0x2023d2[_0xf33c('0x43')]-=0x1;}}_0x2023d2[_0xf33c('0x40')]+=0x1;_0x27e1cd(_0x2023d2);});}exports[_0xf33c('0x45')]=function(_0x2d3f3f,_0x583dc8){var _0x2bc3eb={},_0x4c2588={},_0x3942dd={'count':0x0,'rows':[]};var _0x3daa1d=_[_0xf33c('0x36')](db[_0xf33c('0x46')]['rawAttributes'],function(_0x134a9f){return{'name':_0x134a9f[_0xf33c('0x47')],'type':_0x134a9f['type']['key']};});_0x4c2588[_0xf33c('0x48')]=_[_0xf33c('0x36')](_0x3daa1d,_0xf33c('0x33'));_0x4c2588[_0xf33c('0x49')]=_[_0xf33c('0x4a')](_0x2d3f3f[_0xf33c('0x49')]);_0x4c2588[_0xf33c('0x4b')]=_[_0xf33c('0x4c')](_0x4c2588['model'],_0x4c2588[_0xf33c('0x49')]);_0x2bc3eb[_0xf33c('0x4d')]=_[_0xf33c('0x4c')](_0x4c2588[_0xf33c('0x48')],qs['fields'](_0x2d3f3f['query']['fields']));_0x2bc3eb['attributes']=_0x2bc3eb[_0xf33c('0x4d')][_0xf33c('0x4e')]?_0x2bc3eb[_0xf33c('0x4d')]:_0x4c2588['model'];if(!_0x2d3f3f[_0xf33c('0x49')][_0xf33c('0x4f')](_0xf33c('0x50'))){_0x2bc3eb['limit']=qs['limit'](_0x2d3f3f['query'][_0xf33c('0x28')]);_0x2bc3eb[_0xf33c('0x26')]=qs[_0xf33c('0x26')](_0x2d3f3f[_0xf33c('0x49')][_0xf33c('0x26')]);}_0x2bc3eb['order']=qs['sort'](_0x2d3f3f[_0xf33c('0x49')]['sort']);_0x2bc3eb['where']=qs[_0xf33c('0x4b')](_[_0xf33c('0x51')](_0x2d3f3f[_0xf33c('0x49')],_0x4c2588['filters']),_0x3daa1d);var _0x3e1121=[];var _0x3e42ba=squel[_0xf33c('0x52')]()[_0xf33c('0x53')]('id')['field'](_0xf33c('0x33'))[_0xf33c('0x53')](_0xf33c('0x54'))[_0xf33c('0x55')](_0xf33c('0x56'));var _0x14b2ba=squel[_0xf33c('0x52')]()[_0xf33c('0x53')]('u.id')[_0xf33c('0x53')](_0xf33c('0x57'))[_0xf33c('0x53')](_0xf33c('0x58'))[_0xf33c('0x55')](_0xf33c('0x59'),'ui')[_0xf33c('0x5a')](_0xf33c('0x5b'),'u',_0xf33c('0x5c'));var _0x788abd=squel[_0xf33c('0x52')]()[_0xf33c('0x55')](_0xf33c('0x5d'),'i')[_0xf33c('0x5a')]('cm_contacts','c',_0xf33c('0x5e'))[_0xf33c('0x5a')](_0xf33c('0x5b'),'o',_0xf33c('0x5f'))['left_join']('openchannel_accounts','a',_0xf33c('0x60'))['left_join'](_0xf33c('0x61'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xf33c('0x5a')]('openchannel_interaction_has_tags','it',_0xf33c('0x62'))['left_join']('tools_tags','t',_0xf33c('0x63'));var _0x5556f4=squel['expr']();var _0x2a9408=[];var _0x2045c7=squel['expr']();var _0x1d96b4;if(_0x2d3f3f[_0xf33c('0x49')][_0xf33c('0x64')]){_0x1d96b4=as['parseSearch'](_0x2d3f3f[_0xf33c('0x49')]['search']);var _0x3061bf=_0x1d96b4['sqlOperator'];for(var _0x132df8=0x0;_0x132df8<_0x1d96b4[_0xf33c('0x65')][_0xf33c('0x4e')];_0x132df8++){var _0x343057=_0x1d96b4[_0xf33c('0x65')][_0x132df8];var _0x4181b5='i';var _0xaf01e0=_[_0xf33c('0x66')](_0x3daa1d,[_0xf33c('0x33'),_0x343057[_0xf33c('0x53')]]);if(!_0xaf01e0){switch(_0x343057['field']){case _0xf33c('0x67'):if(_0x343057[_0xf33c('0x68')]==0x1){_0x788abd[_0xf33c('0x69')]('`'+_0x343057[_0xf33c('0x53')]+'`\x20=\x200');}else{_0x788abd[_0xf33c('0x69')]('`'+_0x343057[_0xf33c('0x53')]+_0xf33c('0x6a'));}break;case _0xf33c('0x6b'):if(_0x343057[_0xf33c('0x6c')]===_0xf33c('0x6d')){if(_0x343057[_0xf33c('0x68')]['split']('\x20')[_0xf33c('0x4e')]>0x1){_0x5556f4[_0x3061bf](_0xf33c('0x6e'),qs['getFullTextValue'](_0x343057['value']),null);}else{var _0x59dd44='%'+_0x343057[_0xf33c('0x68')]+'%';_0x5556f4[_0x3061bf](_0xf33c('0x6f'),_0x59dd44,_0x59dd44,_0x59dd44);}}else{_0xaf01e0=_[_0xf33c('0x66')](_0x3daa1d,[_0xf33c('0x33'),_0xf33c('0x70')]);_0x343057[_0xf33c('0x53')]=_0xf33c('0x70');_0x1cb887=as[_0xf33c('0x71')](_0x4181b5,_0xaf01e0[_0xf33c('0x72')],_0x343057);_0x5556f4[_0x3061bf](_0x1cb887[_0xf33c('0x73')],_0x1cb887[_0xf33c('0x68')]['start'],_0x1cb887['value'][_0xf33c('0x24')]);}break;case _0xf33c('0x74'):var _0x282cb7=_0x343057[_0xf33c('0x68')][_0xf33c('0x3a')](',')[_0xf33c('0x36')](function(_0x4be2d9){return Number(_0x4be2d9);});_0x282cb7[_0xf33c('0x3b')](function(_0x2615ac){_0x2045c7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2615ac+',%');});_0x2a9408=_['union'](_0x2a9408,_0x282cb7);break;case _0xf33c('0x75'):if(_0x343057[_0xf33c('0x6c')]===_0xf33c('0x6d')){_0x5556f4[_0x3061bf]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x343057[_0xf33c('0x68')]+'%',null);}else{_0xaf01e0=_[_0xf33c('0x66')](_0x3daa1d,[_0xf33c('0x33'),_0xf33c('0x42')]);_0x343057[_0xf33c('0x53')]=_0xf33c('0x42');_0x1cb887=as['buildExpression'](_0x4181b5,_0xaf01e0[_0xf33c('0x72')],_0x343057);_0x5556f4[_0x3061bf](_0x1cb887[_0xf33c('0x73')],_0x1cb887['value'][_0xf33c('0x76')],_0x1cb887[_0xf33c('0x68')]['end']);}break;case _0xf33c('0x77'):_0x1cb887=as[_0xf33c('0x71')]('me',null,_0x343057);_0x5556f4[_0x3061bf](_0x1cb887['text'],_0x1cb887[_0xf33c('0x68')][_0xf33c('0x76')],_0x1cb887[_0xf33c('0x68')][_0xf33c('0x24')]);break;}}else{var _0x1cb887=as[_0xf33c('0x71')](_0x4181b5,_0xaf01e0[_0xf33c('0x72')],_0x343057);_0x5556f4[_0x3061bf](_0x1cb887[_0xf33c('0x73')],_0x1cb887[_0xf33c('0x68')][_0xf33c('0x76')],_0x1cb887[_0xf33c('0x68')]['end']);}}}else{var _0x2904dd=_(_0x2d3f3f[_0xf33c('0x49')])[_0xf33c('0x4a')]()[_0xf33c('0x36')](function(_0xd3ce3){return _[_0xf33c('0x78')](_0x3daa1d,[_0xf33c('0x33'),_0xd3ce3])?_0xd3ce3:undefined;})[_0xf33c('0x79')]()[_0xf33c('0x68')]();if(!_[_0xf33c('0x7a')](_0x2904dd)){_0x2904dd['forEach'](function(_0x4dcdc1){if(_0x4dcdc1===_0xf33c('0x7b')){_0x788abd[_0xf33c('0x7c')](_0xf33c('0x7d'),[][_0xf33c('0x7e')](_0x2d3f3f[_0xf33c('0x49')][_0x4dcdc1]));}else if(_0x4dcdc1==='createdAt'){var _0x249858=JSON[_0xf33c('0x7f')](_0x2d3f3f[_0xf33c('0x49')][_0x4dcdc1])['$gte'];var _0x1172c9=JSON[_0xf33c('0x7f')](_0x2d3f3f[_0xf33c('0x49')][_0x4dcdc1])['$lte'];_0x788abd[_0xf33c('0x7c')](_0xf33c('0x80'),_0x249858,_0x1172c9);}else{if(_0x2d3f3f['query'][_0x4dcdc1]===_0xf33c('0x81')){_0x788abd[_0xf33c('0x7c')]('i.'+_0x4dcdc1+_0xf33c('0x82'));}else{_0x788abd[_0xf33c('0x7c')]('i.'+_0x4dcdc1+_0xf33c('0x83'),_0x2d3f3f['query'][_0x4dcdc1]);}}});}if(_0x2d3f3f[_0xf33c('0x49')][_0xf33c('0x84')]){if(_0x2d3f3f[_0xf33c('0x49')]['read']==0x1){_0x788abd['having'](_0xf33c('0x85'));}else{_0x788abd[_0xf33c('0x69')](_0xf33c('0x86'));}}if(_0x2d3f3f[_0xf33c('0x49')][_0xf33c('0x87')]){_0x2a9408=_[_0xf33c('0x88')](_0x2d3f3f['query'][_0xf33c('0x87')])?_0x2d3f3f['query'][_0xf33c('0x87')]:new Array(_0x2d3f3f[_0xf33c('0x49')]['tag']);_0x2a9408[_0xf33c('0x3b')](function(_0x448c2b){_0x2045c7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x448c2b+',%');});}if(_0x2d3f3f[_0xf33c('0x49')][_0xf33c('0x89')]){var _0x497a6c=_0x2d3f3f['query'][_0xf33c('0x89')]['replace']('\x5c','\x5c\x5c')[_0xf33c('0x8a')](/'/g,'\x27\x27');if(qs[_0xf33c('0x8b')](_0x497a6c)){_0x5556f4['or'](_0xf33c('0x8c'),_0x497a6c+'%');}else{_0x5556f4['or'](_0xf33c('0x8d'),qs[_0xf33c('0x8e')](_0x497a6c))['or'](_0xf33c('0x8f'),_0x497a6c+'%')['or'](_0xf33c('0x90'),_0x497a6c+'%');}}}_0x788abd[_0xf33c('0x7c')](_0x5556f4);_0x788abd[_0xf33c('0x91')](_0xf33c('0x92'));var _0x2737aa={'type':db[_0xf33c('0x93')][_0xf33c('0x94')][_0xf33c('0x95')],'raw':!![]};var _0x151ed1=_0x788abd[_0xf33c('0x96')]();_0x151ed1[_0xf33c('0x53')](_0xf33c('0x92'));_0x151ed1[_0xf33c('0x53')](_0xf33c('0x97'),_0xf33c('0x67'));if(_0x2bc3eb[_0xf33c('0x98')]){_0x2bc3eb[_0xf33c('0x98')][_0xf33c('0x3b')](function(_0x49daad){var _0x4aa5e8=_0x49daad[0x0]===_0xf33c('0x99')?_0x49daad[0x0]:'i.'+_0x49daad[0x0];_0x788abd['order'](_0x4aa5e8,_0x49daad[0x1]==='DESC'?![]:!![]);});}if(!_[_0xf33c('0x7a')](_0x2a9408)){_0x788abd[_0xf33c('0x69')](_0x2045c7);_0x151ed1[_0xf33c('0x7c')]('t.id\x20IN\x20?',_0x2a9408);}BPromise[_0xf33c('0x9a')]()['then'](function(){if(!_0x1d96b4){if(_0x2d3f3f[_0xf33c('0x49')]['OpenchannelAccountId'])return;_0x151ed1[_0xf33c('0x7c')](_0xf33c('0x9b'));_0x788abd[_0xf33c('0x7c')](_0xf33c('0x9b'));return;}if(_0x2d3f3f[_0xf33c('0x9c')]['role']!==_0xf33c('0x9d'))return;return _0x2d3f3f['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x53201f){if(_[_0xf33c('0x7a')](_0x53201f)){_0x151ed1[_0xf33c('0x7c')](_0xf33c('0x9e'));_0x788abd[_0xf33c('0x7c')](_0xf33c('0x9e'));}else{_0x151ed1[_0xf33c('0x7c')](_0xf33c('0x7d'),_[_0xf33c('0x36')](_0x53201f,'id'));_0x788abd[_0xf33c('0x7c')](_0xf33c('0x7d'),_[_0xf33c('0x36')](_0x53201f,'id'));}});})[_0xf33c('0x2f')](function(){if(_0x2d3f3f['user'][_0xf33c('0x9f')]===_0xf33c('0x9d')&&!_0x1d96b4&&!_0x2d3f3f[_0xf33c('0x49')][_0xf33c('0x7b')])return[];return db[_0xf33c('0xa0')]['query'](_0x151ed1['toString'](),_0x2737aa);})[_0xf33c('0x2f')](function(_0x30e3d3){_0x3942dd[_0xf33c('0x29')]=_0x30e3d3[_0xf33c('0x4e')];if(_0x3942dd[_0xf33c('0x29')]===0x0)return[];return db[_0xf33c('0xa0')][_0xf33c('0x49')](_0x3e42ba[_0xf33c('0xa1')](),_0x2737aa)['then'](function(_0x2ea5c4){_0x3e1121=_['keyBy'](_0x2ea5c4,'id');_0x2737aa=_[_0xf33c('0xa2')](_0x2737aa,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d3f3f[_0xf33c('0x49')][_0xf33c('0xa3')]){_0x2bc3eb[_0xf33c('0x4d')][_0xf33c('0x3b')](function(_0x331d8c){_0x788abd['field']('i.'+_0x331d8c);});}else{_0x788abd[_0xf33c('0x53')](_0xf33c('0x97'),_0xf33c('0x67'));_0x788abd[_0xf33c('0x53')](_0xf33c('0xa4'),_0xf33c('0xa5'));_0x788abd[_0xf33c('0x53')](_0xf33c('0xa6'),_0xf33c('0xa7'));_0x788abd['field'](_0xf33c('0xa8'),_0xf33c('0x99'));_0x788abd[_0xf33c('0x53')]('i.*');_0x788abd[_0xf33c('0x53')](_0xf33c('0xa9'),_0xf33c('0xaa'));_0x788abd[_0xf33c('0x53')](_0xf33c('0xab'),_0xf33c('0xac'));_0x788abd[_0xf33c('0x53')](_0xf33c('0xad'),_0xf33c('0xae'));_0x788abd[_0xf33c('0x53')](_0xf33c('0xaf'),'Contact.phone');_0x788abd['field'](_0xf33c('0xb0'),'Contact.mobile');_0x788abd[_0xf33c('0x53')]('c.fax',_0xf33c('0xb1'));_0x788abd[_0xf33c('0x53')](_0xf33c('0xb2'),_0xf33c('0xb3'));_0x788abd[_0xf33c('0x53')](_0xf33c('0xb4'),_0xf33c('0xb5'));_0x788abd[_0xf33c('0x53')](_0xf33c('0xb6'),'TagIds');}if(_0x2bc3eb[_0xf33c('0x28')])_0x788abd[_0xf33c('0x28')](_0x2bc3eb['limit']);if(_0x2bc3eb['offset'])_0x788abd['offset'](_0x2bc3eb[_0xf33c('0x26')]);return db[_0xf33c('0xa0')][_0xf33c('0x49')](_0x788abd['toString'](),_0x2737aa);})[_0xf33c('0x2f')](function(_0x9345d1){if(_0x9345d1['length']>0x0)_0x14b2ba[_0xf33c('0x7c')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xf33c('0x36')](_0x9345d1,'id'));return db[_0xf33c('0xa0')][_0xf33c('0x49')](_0x14b2ba[_0xf33c('0xa1')](),_0x2737aa)[_0xf33c('0x2f')](function(_0x2429da){var _0x5b1911=_[_0xf33c('0xb7')](_0x2429da,_0xf33c('0xb8'));var _0x1b292b=[];_0x9345d1[_0xf33c('0x3b')](function(_0x1b85ea){_0x1b292b[_0xf33c('0x3c')](updateOpenchannelInteraction(_0x1b85ea,_0x3e1121,_0x5b1911));});return BPromise[_0xf33c('0xb9')](_0x1b292b);});});})[_0xf33c('0x2f')](function(_0x16a4dd){_0x3942dd[_0xf33c('0xba')]=_0x16a4dd;return _0x3942dd;})[_0xf33c('0x2f')](respondWithFilteredResult(_0x583dc8,_0x2bc3eb))[_0xf33c('0x3d')](handleError(_0x583dc8,null));};exports['show']=function(_0x55baf0,_0x3ede53){var _0x14c283={};if(_0x55baf0[_0xf33c('0x49')][_0xf33c('0x72')]&&_0x55baf0[_0xf33c('0x49')][_0xf33c('0x72')]===_0xf33c('0x55')){_0x14c283[_0xf33c('0x55')]=_0x55baf0[_0xf33c('0xbb')]['id'];}else{_0x14c283['id']=_0x55baf0[_0xf33c('0xbb')]['id'];}var _0x2ed69e={'raw':![],'where':_0x14c283},_0x586881={};_0x586881['model']=_['keys'](db['OpenchannelInteraction'][_0xf33c('0xbc')]);_0x586881[_0xf33c('0x49')]=_[_0xf33c('0x4a')](_0x55baf0[_0xf33c('0x49')]);_0x586881[_0xf33c('0x4b')]=_[_0xf33c('0x4c')](_0x586881['model'],_0x586881['query']);_0x2ed69e[_0xf33c('0x4d')]=_[_0xf33c('0x4c')](_0x586881[_0xf33c('0x48')],qs[_0xf33c('0xa3')](_0x55baf0[_0xf33c('0x49')][_0xf33c('0xa3')]));_0x2ed69e[_0xf33c('0x4d')]=_0x2ed69e[_0xf33c('0x4d')][_0xf33c('0x4e')]?_0x2ed69e[_0xf33c('0x4d')]:_0x586881[_0xf33c('0x48')];if(_0x55baf0[_0xf33c('0x49')]['includeAll']){_0x2ed69e['include']=[{'all':!![]}];}_0x2ed69e=_['merge']({},_0x2ed69e,_0x55baf0[_0xf33c('0xbd')]);return db[_0xf33c('0x46')][_0xf33c('0x66')](_0x2ed69e)[_0xf33c('0x2f')](handleEntityNotFound(_0x3ede53,null))['then'](respondWithResult(_0x3ede53,null))[_0xf33c('0x3d')](handleError(_0x3ede53,null));};exports[_0xf33c('0xbe')]=function(_0x3a5185,_0x41385a){return db[_0xf33c('0x46')][_0xf33c('0xbe')](_0x3a5185['body'],{})[_0xf33c('0x2f')](respondWithResult(_0x41385a,0xc9))[_0xf33c('0x3d')](handleError(_0x41385a,null));};exports[_0xf33c('0x2e')]=function(_0x41feb2,_0x21044d){if(_0x41feb2[_0xf33c('0x77')]['id']){delete _0x41feb2[_0xf33c('0x77')]['id'];}return db[_0xf33c('0x46')][_0xf33c('0x66')]({'where':{'id':_0x41feb2[_0xf33c('0xbb')]['id']}})[_0xf33c('0x2f')](handleEntityNotFound(_0x21044d,null))[_0xf33c('0x2f')](saveUpdates(_0x41feb2[_0xf33c('0x77')],null))[_0xf33c('0x2f')](respondWithResult(_0x21044d,null))[_0xf33c('0x3d')](handleError(_0x21044d,null));};exports['destroy']=function(_0x4e9417,_0x29fc43){return db[_0xf33c('0x46')][_0xf33c('0x66')]({'where':{'id':_0x4e9417[_0xf33c('0xbb')]['id']}})[_0xf33c('0x2f')](handleEntityNotFound(_0x29fc43,null))[_0xf33c('0x2f')](removeEntity(_0x29fc43,null))[_0xf33c('0x3d')](handleError(_0x29fc43,null));};exports[_0xf33c('0xbf')]=function(_0x57ae51,_0x1c2191){return db[_0xf33c('0x46')][_0xf33c('0xbf')]()[_0xf33c('0x2f')](respondWithResult(_0x1c2191,null))[_0xf33c('0x3d')](handleError(_0x1c2191,null));};exports[_0xf33c('0xc0')]=function(_0xd1b245,_0x193873,_0x29dd99){return db[_0xf33c('0xc1')][_0xf33c('0x66')]({'where':{'id':_0xd1b245[_0xf33c('0xbb')]['id']}})[_0xf33c('0x2f')](handleEntityNotFound(_0x193873,null))[_0xf33c('0x2f')](function(_0x568f4c){if(_0x568f4c){return _0x568f4c['addMessage'](_0xd1b245[_0xf33c('0x77')][_0xf33c('0xc2')],_['omit'](_0xd1b245[_0xf33c('0x77')],[_0xf33c('0xc2'),'id'])||{});}})[_0xf33c('0x2f')](respondWithResult(_0x193873,null))[_0xf33c('0x3d')](handleError(_0x193873,null));};exports[_0xf33c('0xc3')]=function(_0x296f9c,_0xb9feb3,_0x5646f5){var _0x1ea3ab={'raw':![],'where':{}};var _0xb3e057={};var _0x3fad00={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xf33c('0xc4')]({'where':{'id':_0x296f9c[_0xf33c('0xbb')]['id']}})[_0xf33c('0x2f')](handleEntityNotFound(_0xb9feb3,null))[_0xf33c('0x2f')](function(_0x2c5da0){if(_0x2c5da0){_0xb3e057[_0xf33c('0x48')]=_[_0xf33c('0x4a')](db[_0xf33c('0xc1')][_0xf33c('0xbc')]);_0xb3e057[_0xf33c('0x49')]=_[_0xf33c('0x4a')](_0x296f9c[_0xf33c('0x49')]);_0xb3e057[_0xf33c('0x4b')]=_[_0xf33c('0x4c')](_0xb3e057[_0xf33c('0x48')],_0xb3e057[_0xf33c('0x49')]);_0x1ea3ab[_0xf33c('0x4d')]=_[_0xf33c('0x4c')](_0xb3e057['model'],qs[_0xf33c('0xa3')](_0x296f9c[_0xf33c('0x49')]['fields']));_0x1ea3ab['attributes']=_0x1ea3ab['attributes']['length']?_0x1ea3ab['attributes']:_0xb3e057[_0xf33c('0x48')];if(!_0x296f9c[_0xf33c('0x49')][_0xf33c('0x4f')]('nolimit')){_0x1ea3ab[_0xf33c('0x28')]=qs[_0xf33c('0x28')](_0x296f9c[_0xf33c('0x49')][_0xf33c('0x28')]);_0x1ea3ab[_0xf33c('0x26')]=qs['offset'](_0x296f9c[_0xf33c('0x49')][_0xf33c('0x26')]);}_0x1ea3ab['order']=qs[_0xf33c('0xc5')](_0x296f9c[_0xf33c('0x49')][_0xf33c('0xc5')]);_0x1ea3ab[_0xf33c('0x7c')]=qs[_0xf33c('0x4b')](_[_0xf33c('0x51')](_0x296f9c[_0xf33c('0x49')],_0xb3e057['filters']));_0x1ea3ab[_0xf33c('0x7c')]['OpenchannelInteractionId']=_0x2c5da0['id'];if(_0x296f9c[_0xf33c('0x49')][_0xf33c('0x89')]){_0x1ea3ab[_0xf33c('0x7c')]=_['merge'](_0x1ea3ab[_0xf33c('0x7c')],{'$or':_[_0xf33c('0x36')](_0x1ea3ab[_0xf33c('0x4d')],function(_0x4b023c){var _0x26f486={};_0x26f486[_0x4b023c]={'$like':'%'+_0x296f9c[_0xf33c('0x49')][_0xf33c('0x89')]+'%'};return _0x26f486;})});}if(_0x296f9c['query'][_0xf33c('0xc6')]){var _0x16d8eb=_0x296f9c[_0xf33c('0x49')][_0xf33c('0xc6')][_0xf33c('0x3a')](',');var _0x1d2380={};_0x1d2380[_0x16d8eb[0x0]]={'$gte':moment(_0x16d8eb[0x1])[_0xf33c('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1ea3ab[_0xf33c('0x7c')]=_[_0xf33c('0xa2')](_0x1ea3ab[_0xf33c('0x7c')],_0x1d2380);}_0x1ea3ab=_[_0xf33c('0xa2')]({},_0x1ea3ab,_0x296f9c[_0xf33c('0xbd')]);return db[_0xf33c('0xc1')][_0xf33c('0x29')]({'where':_0x1ea3ab[_0xf33c('0x7c')]})['then'](function(_0xbafe2b){_0x3fad00[_0xf33c('0x29')]=_0xbafe2b;if(_0x296f9c[_0xf33c('0x49')][_0xf33c('0xc8')]){_0x1ea3ab[_0xf33c('0xc9')]=[{'all':!![]}];}return db[_0xf33c('0xc1')]['findAll'](_0x1ea3ab);})[_0xf33c('0x2f')](function(_0x565c50){_0x3fad00[_0xf33c('0xba')]=_0x565c50;return _0x3fad00;});}})[_0xf33c('0x2f')](respondWithFilteredResult(_0xb9feb3,_0x1ea3ab))[_0xf33c('0x3d')](handleError(_0xb9feb3,null));};exports[_0xf33c('0xca')]=function(_0x1f85c3,_0x3145ac,_0xe1b070){return db[_0xf33c('0x46')][_0xf33c('0x66')]({'where':{'id':_0x1f85c3[_0xf33c('0xbb')]['id']}})[_0xf33c('0x2f')](handleEntityNotFound(_0x3145ac,null))[_0xf33c('0x2f')](function(_0x30c370){if(_0x30c370){return _0x30c370[_0xf33c('0xcb')](_0x1f85c3['body'][_0xf33c('0xc2')],_[_0xf33c('0xcc')](_0x1f85c3[_0xf33c('0x77')],[_0xf33c('0xc2'),'id'])||{})[_0xf33c('0xcd')](function(){return db[_0xf33c('0x74')][_0xf33c('0xce')]({'attributes':['id',_0xf33c('0x33'),_0xf33c('0x54')],'where':{'id':_0x1f85c3[_0xf33c('0x77')]['ids']}});})[_0xf33c('0x2f')](function(_0x141807){socket[_0xf33c('0xcf')](_0xf33c('0xd0'),{'id':Number(_0x1f85c3[_0xf33c('0xbb')]['id']),'tags':_0x141807||[]});return{'id':Number(_0x1f85c3[_0xf33c('0xbb')]['id']),'tags':_0x141807||[]};});}})[_0xf33c('0x2f')](respondWithResult(_0x3145ac,null))[_0xf33c('0x3d')](handleError(_0x3145ac,null));};exports['removeTags']=function(_0x307e30,_0x57b5cb,_0x1b4d91){return db[_0xf33c('0x46')][_0xf33c('0x66')]({'where':{'id':_0x307e30[_0xf33c('0xbb')]['id']}})['then'](handleEntityNotFound(_0x57b5cb,null))[_0xf33c('0x2f')](function(_0x3f9fda){if(_0x3f9fda){return _0x3f9fda[_0xf33c('0xd1')](_0x307e30[_0xf33c('0x49')][_0xf33c('0xc2')]);}})['then'](respondWithStatusCode(_0x57b5cb,null))[_0xf33c('0x3d')](handleError(_0x57b5cb,null));};exports[_0xf33c('0xd2')]=function(_0xb0c84f,_0x48339c){var _0x47ac3e=moment()[_0xf33c('0xd3')]()['toString']();var _0x20995b=path[_0xf33c('0xd4')](config[_0xf33c('0xd5')],'server','files','tmp');var _0xd7dec0=path[_0xf33c('0xd4')](config['root'],_0xf33c('0xd6'),_0xf33c('0xd7'),_0xf33c('0xd8'));var _0x4b4227=path[_0xf33c('0xd4')](_0x20995b,_0x47ac3e);var _0x152e35=util[_0xf33c('0xc7')](_0xf33c('0xd9'),_0xb0c84f['params']['id'],_0x47ac3e);var _0x2308ea=path[_0xf33c('0xd4')](_0x20995b,_0x152e35);var _0x30becd=[];_0x30becd[_0xf33c('0x3c')]({'model':db[_0xf33c('0x75')],'as':'User','attributes':['id',_0xf33c('0x37')],'raw':!![]});_0x30becd['push']({'model':db[_0xf33c('0xda')],'as':_0xf33c('0x6b'),'attributes':['id',_0xf33c('0xdb'),_0xf33c('0xdc')],'raw':!![]});if(_0xb0c84f['query']['attachments']){_0x30becd[_0xf33c('0x3c')]({'model':db[_0xf33c('0xdd')],'as':_0xf33c('0xdd'),'raw':!![]});}var _0x251e84=[{'model':db[_0xf33c('0xc1')],'as':_0xf33c('0xde'),'attributes':['id','body',_0xf33c('0xdf'),'direction',_0xf33c('0xe0'),_0xf33c('0x84')],'include':_0x30becd}];_0x251e84['push']({'model':db[_0xf33c('0xe1')],'as':'Account','attributes':['id','name']});_0x251e84[_0xf33c('0x3c')]({'model':db[_0xf33c('0x75')],'as':'Owner','attributes':['id',_0xf33c('0x37')]});return db['OpenchannelInteraction'][_0xf33c('0x66')]({'where':{'id':_0xb0c84f[_0xf33c('0xbb')]['id']},'include':_0x251e84})[_0xf33c('0x2f')](handleEntityNotFound(_0x48339c,null))[_0xf33c('0x2f')](function(_0x4f3749){if(_0x4f3749){var _0x522c45=_0x4f3749['get']({'plain':!![]});fs[_0xf33c('0xe2')](_0x4b4227);var _0x17d23c={'channel':'Openchannel','account':_0x522c45[_0xf33c('0xe3')][_0xf33c('0x33')],'agent':_0x522c45[_0xf33c('0xe4')]?_0x522c45['Owner'][_0xf33c('0x37')]:_0xf33c('0xe5'),'createdAt':moment(_0x522c45['createdAt'])[_0xf33c('0xc7')](_0xf33c('0xe6'))[_0xf33c('0xa1')](),'closedAt':_0x522c45[_0xf33c('0x41')]?moment(_0x522c45[_0xf33c('0xe7')])[_0xf33c('0xc7')](_0xf33c('0xe6'))['toString']():'','disposition':_0x522c45[_0xf33c('0xe8')],'visibility':_0x522c45['threadId']?'Public':_0xf33c('0xe9'),'messages':_(_0x522c45[_0xf33c('0xde')])[_0xf33c('0x89')]({'secret':![]})[_0xf33c('0x36')](function(_0x2137bc){if(_0x2137bc[_0xf33c('0xdd')]){var _0x17c318=path[_0xf33c('0xd4')](_0xd7dec0,_0x2137bc[_0xf33c('0xdd')]['basename']);if(fs[_0xf33c('0xea')](_0x17c318)){fs['createReadStream'](_0x17c318)[_0xf33c('0xeb')](fs[_0xf33c('0xec')](path['join'](_0x4b4227,_0x2137bc[_0xf33c('0xdd')]['basename'])));}}return{'date':moment(_0x2137bc[_0xf33c('0xdf')])[_0xf33c('0xc7')](_0xf33c('0xe6'))[_0xf33c('0xa1')](),'sender':_0x2137bc['direction']==='out'?_0x2137bc[_0xf33c('0x75')]?_0x2137bc[_0xf33c('0x75')]['fullname']:_0xf33c('0xed'):_0x2137bc[_0xf33c('0x6b')][_0xf33c('0xdb')]+(_0x2137bc[_0xf33c('0x6b')][_0xf33c('0xdc')]?'\x20'+_0x2137bc[_0xf33c('0x6b')]['lastName']:''),'body':_0x2137bc[_0xf33c('0xdd')]?_0x2137bc[_0xf33c('0xdd')][_0xf33c('0xee')]:_0x2137bc['body'],'direction':_0x2137bc[_0xf33c('0xef')]===_0xf33c('0xf0')?'A':'C','secret':_0x2137bc[_0xf33c('0xe0')],'read':_0x2137bc[_0xf33c('0x84')],'attachment':_0x2137bc['Attachment']};})[_0xf33c('0x68')]()};return ejs[_0xf33c('0xf1')](path[_0xf33c('0xd4')](config[_0xf33c('0xd5')],_0xf33c('0xd6'),_0xf33c('0xf2'),_0xf33c('0xf3')),{'interaction':_0x17d23c})[_0xf33c('0x2f')](function(_0x317b75){var _0x2feefd=path['join'](_0x4b4227,'transcript-'+_0x522c45['id']+'-'+_0x47ac3e+_0xf33c('0xf4'));var _0x2debc8={'path':_0x2feefd,'channel':_0xf33c('0xf5'),'interactionId':_0x522c45['id']};return pdf[_0xf33c('0xf6')](_0x317b75,_0x2debc8);})[_0xf33c('0x2f')](function(){return new BPromise(function(_0x41a6e0,_0x2abed6){zipdir(_0x4b4227,{'saveTo':_0x2308ea},function(_0x13665a,_0x7e4ed8){if(_0x13665a)return _0x2abed6(_0x13665a);return _0x41a6e0(_0x7e4ed8);});})['then'](function(){return new BPromise(function(_0x52d606,_0x162c8a){rimraf(_0x4b4227,function(_0x42d47e){if(_0x42d47e)_0x162c8a(_0x42d47e);return _0x52d606();});});})[_0xf33c('0x2f')](function(){return _0x48339c[_0xf33c('0xd2')](_0x2308ea,_0x152e35,function(_0x2bfc10){if(_0x2bfc10){console[_0xf33c('0xf7')](_0xf33c('0xf8'),_0x2bfc10);}else{fs[_0xf33c('0xf9')](_0x2308ea);}});});});}else{return _0x48339c['sendStatus'](0xc8);}})[_0xf33c('0x3d')](handleError(_0x48339c,null));}; \ No newline at end of file +var _0xb3d6=['body','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rows','show','params','includeAll','include','options','create','update','describe','addMessage','OpenchannelMessage','ids','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','join','root','files','tmp','attachments','transcript-%d-%s.zip','User','firstName','lastName','Attachment','Messages','direction','secret','Account','Owner','get','N.A.','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','then','destroy','stack','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','waiting','talking','unmanaged','total','closed','UserId','answered','index','OpenchannelInteraction','rawAttributes','fieldName','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start'];(function(_0x221241,_0x443cd8){var _0x1d94ea=function(_0x53f0b8){while(--_0x53f0b8){_0x221241['push'](_0x221241['shift']());}};_0x1d94ea(++_0x443cd8);}(_0xb3d6,0x75));var _0x6b3d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb3d6[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b3d('0x0'));var zipdir=require(_0x6b3d('0x1'));var jsonpatch=require(_0x6b3d('0x2'));var rp=require(_0x6b3d('0x3'));var moment=require('moment');var BPromise=require(_0x6b3d('0x4'));var Mustache=require(_0x6b3d('0x5'));var util=require(_0x6b3d('0x6'));var path=require('path');var sox=require(_0x6b3d('0x7'));var csv=require(_0x6b3d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b3d('0x9'));var _=require(_0x6b3d('0xa'));var squel=require(_0x6b3d('0xb'));var crypto=require(_0x6b3d('0xc'));var jsforce=require(_0x6b3d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6b3d('0x8'));var querystring=require(_0x6b3d('0xe'));var Papa=require(_0x6b3d('0xf'));var Redis=require(_0x6b3d('0x10'));var authService=require(_0x6b3d('0x11'));var qs=require(_0x6b3d('0x12'));var as=require(_0x6b3d('0x13'));var pdf=require(_0x6b3d('0x14'));var hardwareService=require(_0x6b3d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6b3d('0x16'));var config=require(_0x6b3d('0x17'));var licenseUtil=require(_0x6b3d('0x18'));var db=require(_0x6b3d('0x19'))['db'];config['redis']=_[_0x6b3d('0x1a')](config['redis'],{'host':_0x6b3d('0x1b'),'port':0x18eb});var socket=require(_0x6b3d('0x1c'))(new Redis(config[_0x6b3d('0x1d')]));require(_0x6b3d('0x1e'))['register'](socket);function respondWithStatusCode(_0x14a994,_0x1a6f24){_0x1a6f24=_0x1a6f24||0xcc;return function(_0x2fe635){if(_0x2fe635){return _0x14a994[_0x6b3d('0x1f')](_0x1a6f24);}return _0x14a994[_0x6b3d('0x20')](_0x1a6f24)[_0x6b3d('0x21')]();};}function respondWithResult(_0x273871,_0x5f4f8f){_0x5f4f8f=_0x5f4f8f||0xc8;return function(_0x46fd2e){if(_0x46fd2e){return _0x273871[_0x6b3d('0x20')](_0x5f4f8f)[_0x6b3d('0x22')](_0x46fd2e);}};}function respondWithFilteredResult(_0x4f3198,_0x7de452){return function(_0x25caf0){if(_0x25caf0){var _0x15c2bf=typeof _0x7de452[_0x6b3d('0x23')]===_0x6b3d('0x24')&&typeof _0x7de452[_0x6b3d('0x25')]===_0x6b3d('0x24');var _0x1f49e4=_0x25caf0[_0x6b3d('0x26')];var _0x556077=_0x15c2bf?0x0:_0x7de452[_0x6b3d('0x23')];var _0x5deb35=_0x15c2bf?_0x25caf0[_0x6b3d('0x26')]:_0x7de452[_0x6b3d('0x23')]+_0x7de452[_0x6b3d('0x25')];var _0x26cc95;if(_0x5deb35>=_0x1f49e4){_0x5deb35=_0x1f49e4;_0x26cc95=0xc8;}else{_0x26cc95=0xce;}_0x4f3198[_0x6b3d('0x20')](_0x26cc95);return _0x4f3198[_0x6b3d('0x27')]('Content-Range',_0x556077+'-'+_0x5deb35+'/'+_0x1f49e4)[_0x6b3d('0x22')](_0x25caf0);}return null;};}function patchUpdates(_0x1d1818){return function(_0x4a7cce){try{jsonpatch['apply'](_0x4a7cce,_0x1d1818,!![]);}catch(_0x4b5bea){return BPromise[_0x6b3d('0x28')](_0x4b5bea);}return _0x4a7cce['save']();};}function saveUpdates(_0xdbf0be,_0x19d833){return function(_0xb3d866){if(_0xb3d866){return _0xb3d866['update'](_0xdbf0be)[_0x6b3d('0x29')](function(_0x23bdfd){return _0x23bdfd;});}return null;};}function removeEntity(_0x414e72,_0x54e219){return function(_0x398488){if(_0x398488){return _0x398488[_0x6b3d('0x2a')]()[_0x6b3d('0x29')](function(){_0x414e72['status'](0xcc)[_0x6b3d('0x21')]();});}};}function handleEntityNotFound(_0x278648,_0x51bdad){return function(_0x1302eb){if(!_0x1302eb){_0x278648[_0x6b3d('0x1f')](0x194);}return _0x1302eb;};}function handleError(_0x477d6e,_0x519dfa){_0x519dfa=_0x519dfa||0x1f4;return function(_0x139b1d){logger['error'](_0x139b1d[_0x6b3d('0x2b')]);if(_0x139b1d['name']){delete _0x139b1d['name'];}_0x477d6e[_0x6b3d('0x20')](_0x519dfa)[_0x6b3d('0x2c')](_0x139b1d);};}function getInteractionUsers(_0x5e1f76,_0x362ea4){return new BPromise(function(_0x3126bc,_0x170885){try{if(_0x362ea4[_0x5e1f76['id']]){_0x5e1f76[_0x6b3d('0x2d')]=_[_0x6b3d('0x2e')](_0x362ea4[_0x5e1f76['id']],function(_0x6cbb51){return{'id':_0x6cbb51['id'],'fullname':_0x6cbb51[_0x6b3d('0x2f')]};});}}catch(_0x3dd0f5){_0x170885(_0x3dd0f5);}_0x3126bc(_0x5e1f76);});}function getInteractionTags(_0x29b128,_0x212b2a){return new BPromise(function(_0x3a548c,_0x20ef3a){try{if(_0x29b128[_0x6b3d('0x30')]){_0x29b128[_0x6b3d('0x31')]=[];_0x29b128[_0x6b3d('0x30')]['split'](',')[_0x6b3d('0x32')](function(_0x48c208){_0x29b128[_0x6b3d('0x31')][_0x6b3d('0x33')](_0x212b2a[_0x48c208]);});}delete _0x29b128[_0x6b3d('0x30')];}catch(_0x17fdcc){_0x20ef3a(_0x17fdcc);}_0x3a548c(_0x29b128);});}function updateOpenchannelInteraction(_0x16181b,_0x29f220,_0x1ccd31){return new BPromise(function(_0x5e7951,_0xb9ca2e){return getInteractionUsers(_0x16181b,_0x1ccd31)[_0x6b3d('0x29')](function(_0x240a3f){return getInteractionTags(_0x240a3f,_0x29f220);})[_0x6b3d('0x29')](function(_0x11a0d7){return getStateInteraction(_0x11a0d7);})[_0x6b3d('0x29')](function(_0x595e9c){_0x5e7951(_0x595e9c);})[_0x6b3d('0x34')](function(_0x45faaf){_0xb9ca2e(_0x45faaf);});});}function getStateInteraction(_0x3850ef){return new BPromise(function(_0x46ad21){_0x3850ef[_0x6b3d('0x35')]=0x0;_0x3850ef[_0x6b3d('0x36')]=0x0;_0x3850ef['answered']=0x0;_0x3850ef[_0x6b3d('0x37')]=0x0;_0x3850ef[_0x6b3d('0x38')]=0x0;if(!_0x3850ef[_0x6b3d('0x39')]&&!_0x3850ef[_0x6b3d('0x3a')]){_0x3850ef[_0x6b3d('0x35')]+=0x1;}if(!_0x3850ef['closed']&&_0x3850ef[_0x6b3d('0x3a')]){_0x3850ef[_0x6b3d('0x36')]+=0x1;if(_0x3850ef[_0x6b3d('0x35')]){_0x3850ef[_0x6b3d('0x35')]-=0x1;}}if(_0x3850ef[_0x6b3d('0x39')]&&_0x3850ef[_0x6b3d('0x3a')]){_0x3850ef[_0x6b3d('0x3b')]+=0x1;if(_0x3850ef[_0x6b3d('0x36')]){_0x3850ef['talking']-=0x1;}}if(_0x3850ef[_0x6b3d('0x39')]&&!_0x3850ef[_0x6b3d('0x3a')]){_0x3850ef[_0x6b3d('0x37')]+=0x1;if(_0x3850ef['waiting']){_0x3850ef['waiting']-=0x1;}}_0x3850ef[_0x6b3d('0x38')]+=0x1;_0x46ad21(_0x3850ef);});}exports[_0x6b3d('0x3c')]=function(_0x565dfe,_0x574677){var _0x34836b={},_0x1734c6={},_0x481b50={'count':0x0,'rows':[]};var _0x491f2a=_[_0x6b3d('0x2e')](db[_0x6b3d('0x3d')][_0x6b3d('0x3e')],function(_0x680a5f){return{'name':_0x680a5f[_0x6b3d('0x3f')],'type':_0x680a5f['type']['key']};});_0x1734c6['model']=_['map'](_0x491f2a,_0x6b3d('0x40'));_0x1734c6[_0x6b3d('0x41')]=_[_0x6b3d('0x42')](_0x565dfe[_0x6b3d('0x41')]);_0x1734c6[_0x6b3d('0x43')]=_['intersection'](_0x1734c6[_0x6b3d('0x44')],_0x1734c6[_0x6b3d('0x41')]);_0x34836b[_0x6b3d('0x45')]=_[_0x6b3d('0x46')](_0x1734c6[_0x6b3d('0x44')],qs[_0x6b3d('0x47')](_0x565dfe['query'][_0x6b3d('0x47')]));_0x34836b[_0x6b3d('0x45')]=_0x34836b[_0x6b3d('0x45')][_0x6b3d('0x48')]?_0x34836b[_0x6b3d('0x45')]:_0x1734c6[_0x6b3d('0x44')];if(!_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x49')](_0x6b3d('0x4a'))){_0x34836b[_0x6b3d('0x25')]=qs[_0x6b3d('0x25')](_0x565dfe['query'][_0x6b3d('0x25')]);_0x34836b[_0x6b3d('0x23')]=qs['offset'](_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x23')]);}_0x34836b[_0x6b3d('0x4b')]=qs['sort'](_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x4c')]);_0x34836b[_0x6b3d('0x4d')]=qs[_0x6b3d('0x43')](_[_0x6b3d('0x4e')](_0x565dfe['query'],_0x1734c6['filters']),_0x491f2a);var _0xf95d52=[];var _0x46a772=squel[_0x6b3d('0x4f')]()[_0x6b3d('0x50')]('id')['field']('name')['field'](_0x6b3d('0x51'))['from'](_0x6b3d('0x52'));var _0x17bc93=squel['select']()['field'](_0x6b3d('0x53'))['field'](_0x6b3d('0x54'))['field'](_0x6b3d('0x55'))[_0x6b3d('0x56')](_0x6b3d('0x57'),'ui')[_0x6b3d('0x58')](_0x6b3d('0x59'),'u',_0x6b3d('0x5a'));var _0x3f5949=squel[_0x6b3d('0x4f')]()[_0x6b3d('0x56')](_0x6b3d('0x5b'),'i')[_0x6b3d('0x58')](_0x6b3d('0x5c'),'c',_0x6b3d('0x5d'))['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x6b3d('0x58')]('openchannel_accounts','a',_0x6b3d('0x5e'))[_0x6b3d('0x58')](_0x6b3d('0x5f'),'me',_0x6b3d('0x60'))['left_join']('openchannel_interaction_has_tags','it',_0x6b3d('0x61'))['left_join'](_0x6b3d('0x52'),'t',_0x6b3d('0x62'));var _0xe6b8fe=squel[_0x6b3d('0x63')]();var _0x2d76ac=[];var _0x9265b4=squel[_0x6b3d('0x63')]();var _0x1fe55e;if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x64')]){_0x1fe55e=as[_0x6b3d('0x65')](_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x64')]);var _0x212b9f=_0x1fe55e['sqlOperator'];for(var _0x5881e0=0x0;_0x5881e0<_0x1fe55e[_0x6b3d('0x66')][_0x6b3d('0x48')];_0x5881e0++){var _0x34ac3a=_0x1fe55e[_0x6b3d('0x66')][_0x5881e0];var _0x5635f1='i';var _0x51294f=_[_0x6b3d('0x67')](_0x491f2a,['name',_0x34ac3a[_0x6b3d('0x50')]]);if(!_0x51294f){switch(_0x34ac3a[_0x6b3d('0x50')]){case _0x6b3d('0x68'):if(_0x34ac3a['value']==0x1){_0x3f5949[_0x6b3d('0x69')]('`'+_0x34ac3a[_0x6b3d('0x50')]+_0x6b3d('0x6a'));}else{_0x3f5949[_0x6b3d('0x69')]('`'+_0x34ac3a['field']+_0x6b3d('0x6b'));}break;case _0x6b3d('0x6c'):if(_0x34ac3a[_0x6b3d('0x6d')]===_0x6b3d('0x6e')){if(_0x34ac3a['value'][_0x6b3d('0x6f')]('\x20')[_0x6b3d('0x48')]>0x1){_0xe6b8fe[_0x212b9f](_0x6b3d('0x70'),qs[_0x6b3d('0x71')](_0x34ac3a[_0x6b3d('0x72')]),null);}else{var _0x2678e8='%'+_0x34ac3a[_0x6b3d('0x72')]+'%';_0xe6b8fe[_0x212b9f](_0x6b3d('0x73'),_0x2678e8,_0x2678e8,_0x2678e8);}}else{_0x51294f=_['find'](_0x491f2a,[_0x6b3d('0x40'),_0x6b3d('0x74')]);_0x34ac3a[_0x6b3d('0x50')]=_0x6b3d('0x74');_0x4161a8=as[_0x6b3d('0x75')](_0x5635f1,_0x51294f[_0x6b3d('0x76')],_0x34ac3a);_0xe6b8fe[_0x212b9f](_0x4161a8[_0x6b3d('0x77')],_0x4161a8[_0x6b3d('0x72')]['start'],_0x4161a8[_0x6b3d('0x72')]['end']);}break;case _0x6b3d('0x78'):var _0x25e15d=_0x34ac3a[_0x6b3d('0x72')][_0x6b3d('0x6f')](',')[_0x6b3d('0x2e')](function(_0x4d1e03){return Number(_0x4d1e03);});_0x25e15d[_0x6b3d('0x32')](function(_0x43100c){_0x9265b4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x43100c+',%');});_0x2d76ac=_[_0x6b3d('0x79')](_0x2d76ac,_0x25e15d);break;case'User':if(_0x34ac3a[_0x6b3d('0x6d')]==='$substring'){_0xe6b8fe[_0x212b9f](_0x6b3d('0x7a'),'%'+_0x34ac3a[_0x6b3d('0x72')]+'%',null);}else{_0x51294f=_[_0x6b3d('0x67')](_0x491f2a,['name',_0x6b3d('0x3a')]);_0x34ac3a[_0x6b3d('0x50')]='UserId';_0x4161a8=as[_0x6b3d('0x75')](_0x5635f1,_0x51294f[_0x6b3d('0x76')],_0x34ac3a);_0xe6b8fe[_0x212b9f](_0x4161a8[_0x6b3d('0x77')],_0x4161a8[_0x6b3d('0x72')][_0x6b3d('0x7b')],_0x4161a8[_0x6b3d('0x72')]['end']);}break;case _0x6b3d('0x7c'):_0x4161a8=as[_0x6b3d('0x75')]('me',null,_0x34ac3a);_0xe6b8fe[_0x212b9f](_0x4161a8[_0x6b3d('0x77')],_0x4161a8['value']['start'],_0x4161a8[_0x6b3d('0x72')]['end']);break;}}else{var _0x4161a8=as[_0x6b3d('0x75')](_0x5635f1,_0x51294f[_0x6b3d('0x76')],_0x34ac3a);_0xe6b8fe[_0x212b9f](_0x4161a8['text'],_0x4161a8[_0x6b3d('0x72')][_0x6b3d('0x7b')],_0x4161a8['value'][_0x6b3d('0x21')]);}}}else{var _0x3e1107=_(_0x565dfe[_0x6b3d('0x41')])[_0x6b3d('0x42')]()['map'](function(_0x5f0de1){return _['some'](_0x491f2a,[_0x6b3d('0x40'),_0x5f0de1])?_0x5f0de1:undefined;})[_0x6b3d('0x7d')]()[_0x6b3d('0x72')]();if(!_['isEmpty'](_0x3e1107)){_0x3e1107[_0x6b3d('0x32')](function(_0x4cb90a){if(_0x4cb90a===_0x6b3d('0x7e')){_0x3f5949[_0x6b3d('0x4d')](_0x6b3d('0x7f'),[][_0x6b3d('0x80')](_0x565dfe['query'][_0x4cb90a]));}else if(_0x4cb90a===_0x6b3d('0x81')){var _0xc0d854=JSON[_0x6b3d('0x82')](_0x565dfe[_0x6b3d('0x41')][_0x4cb90a])[_0x6b3d('0x83')];var _0x16bb01=JSON[_0x6b3d('0x82')](_0x565dfe[_0x6b3d('0x41')][_0x4cb90a])[_0x6b3d('0x84')];_0x3f5949['where'](_0x6b3d('0x85'),_0xc0d854,_0x16bb01);}else{if(_0x565dfe['query'][_0x4cb90a]===_0x6b3d('0x86')){_0x3f5949[_0x6b3d('0x4d')]('i.'+_0x4cb90a+_0x6b3d('0x87'));}else{_0x3f5949[_0x6b3d('0x4d')]('i.'+_0x4cb90a+_0x6b3d('0x88'),_0x565dfe['query'][_0x4cb90a]);}}});}if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x89')]){if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x89')]==0x1){_0x3f5949[_0x6b3d('0x69')](_0x6b3d('0x8a'));}else{_0x3f5949[_0x6b3d('0x69')](_0x6b3d('0x8b'));}}if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x8c')]){_0x2d76ac=_[_0x6b3d('0x8d')](_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x8c')])?_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x8c')]:new Array(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x8c')]);_0x2d76ac[_0x6b3d('0x32')](function(_0x5873d4){_0x9265b4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5873d4+',%');});}if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x8e')]){var _0x14a0ac=_0x565dfe[_0x6b3d('0x41')]['filter'][_0x6b3d('0x8f')]('\x5c','\x5c\x5c')[_0x6b3d('0x8f')](/'/g,'\x27\x27');if(qs[_0x6b3d('0x90')](_0x14a0ac)){_0xe6b8fe['or']('i.id\x20LIKE\x20?',_0x14a0ac+'%');}else{_0xe6b8fe['or'](_0x6b3d('0x91'),qs[_0x6b3d('0x71')](_0x14a0ac))['or']('i.from\x20LIKE\x20?',_0x14a0ac+'%')['or'](_0x6b3d('0x92'),_0x14a0ac+'%');}}}_0x3f5949[_0x6b3d('0x4d')](_0xe6b8fe);_0x3f5949[_0x6b3d('0x93')](_0x6b3d('0x94'));var _0x104489={'type':db[_0x6b3d('0x95')][_0x6b3d('0x96')][_0x6b3d('0x97')],'raw':!![]};var _0x440a57=_0x3f5949['clone']();_0x440a57['field'](_0x6b3d('0x94'));_0x440a57['field'](_0x6b3d('0x98'),'unreadMessages');if(_0x34836b[_0x6b3d('0x4b')]){_0x34836b[_0x6b3d('0x4b')]['forEach'](function(_0x3caf7d){var _0x227746=_0x3caf7d[0x0]===_0x6b3d('0x99')?_0x3caf7d[0x0]:'i.'+_0x3caf7d[0x0];_0x3f5949['order'](_0x227746,_0x3caf7d[0x1]==='DESC'?![]:!![]);});}if(!_[_0x6b3d('0x9a')](_0x2d76ac)){_0x3f5949[_0x6b3d('0x69')](_0x9265b4);_0x440a57[_0x6b3d('0x4d')](_0x6b3d('0x9b'),_0x2d76ac);}BPromise[_0x6b3d('0x9c')]()[_0x6b3d('0x29')](function(){if(!_0x1fe55e){if(_0x565dfe[_0x6b3d('0x41')]['OpenchannelAccountId'])return;_0x440a57[_0x6b3d('0x4d')](_0x6b3d('0x9d'));_0x3f5949[_0x6b3d('0x4d')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x565dfe[_0x6b3d('0x9e')][_0x6b3d('0x9f')]!==_0x6b3d('0xa0'))return;return _0x565dfe[_0x6b3d('0x9e')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x6b3d('0x29')](function(_0x1fa45a){if(_['isEmpty'](_0x1fa45a)){_0x440a57[_0x6b3d('0x4d')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x3f5949[_0x6b3d('0x4d')](_0x6b3d('0xa1'));}else{_0x440a57[_0x6b3d('0x4d')](_0x6b3d('0x7f'),_['map'](_0x1fa45a,'id'));_0x3f5949[_0x6b3d('0x4d')](_0x6b3d('0x7f'),_[_0x6b3d('0x2e')](_0x1fa45a,'id'));}});})['then'](function(){if(_0x565dfe[_0x6b3d('0x9e')][_0x6b3d('0x9f')]==='agent'&&!_0x1fe55e&&!_0x565dfe[_0x6b3d('0x41')]['OpenchannelAccountId'])return[];return db[_0x6b3d('0xa2')][_0x6b3d('0x41')](_0x440a57[_0x6b3d('0xa3')](),_0x104489);})['then'](function(_0x4be2a3){_0x481b50['count']=_0x4be2a3[_0x6b3d('0x48')];if(_0x481b50[_0x6b3d('0x26')]===0x0)return[];return db[_0x6b3d('0xa2')][_0x6b3d('0x41')](_0x46a772[_0x6b3d('0xa3')](),_0x104489)['then'](function(_0x224b26){_0xf95d52=_[_0x6b3d('0xa4')](_0x224b26,'id');_0x104489=_[_0x6b3d('0xa5')](_0x104489,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x47')]){_0x34836b[_0x6b3d('0x45')]['forEach'](function(_0x255fb8){_0x3f5949['field']('i.'+_0x255fb8);});}else{_0x3f5949['field'](_0x6b3d('0x98'),_0x6b3d('0x68'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xa6'),_0x6b3d('0xa7'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xa8'),'Account.mandatoryDisposition');_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xa9'),'contactName');_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xaa'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xab'),'Contact.firstName');_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xac'),_0x6b3d('0xad'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xae'),_0x6b3d('0xaf'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xb0'),_0x6b3d('0xb1'));_0x3f5949['field'](_0x6b3d('0xb2'),_0x6b3d('0xb3'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xb4'),_0x6b3d('0xb5'));_0x3f5949['field'](_0x6b3d('0xb6'),'Owner.fullname');_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xb7'),'Owner.internal');_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xb8'),_0x6b3d('0x30'));}if(_0x34836b[_0x6b3d('0x25')])_0x3f5949[_0x6b3d('0x25')](_0x34836b[_0x6b3d('0x25')]);if(_0x34836b[_0x6b3d('0x23')])_0x3f5949[_0x6b3d('0x23')](_0x34836b[_0x6b3d('0x23')]);return db[_0x6b3d('0xa2')][_0x6b3d('0x41')](_0x3f5949[_0x6b3d('0xa3')](),_0x104489);})[_0x6b3d('0x29')](function(_0x3ed13f){if(_0x3ed13f[_0x6b3d('0x48')]>0x0)_0x17bc93[_0x6b3d('0x4d')](_0x6b3d('0xb9'),_['map'](_0x3ed13f,'id'));return db['sequelize'][_0x6b3d('0x41')](_0x17bc93[_0x6b3d('0xa3')](),_0x104489)[_0x6b3d('0x29')](function(_0x61e8b9){var _0x4afcc4=_['groupBy'](_0x61e8b9,_0x6b3d('0xba'));var _0xb3a43f=[];_0x3ed13f[_0x6b3d('0x32')](function(_0x471223){_0xb3a43f[_0x6b3d('0x33')](updateOpenchannelInteraction(_0x471223,_0xf95d52,_0x4afcc4));});return BPromise['all'](_0xb3a43f);});});})[_0x6b3d('0x29')](function(_0x1905a4){_0x481b50[_0x6b3d('0xbb')]=_0x1905a4;return _0x481b50;})[_0x6b3d('0x29')](respondWithFilteredResult(_0x574677,_0x34836b))[_0x6b3d('0x34')](handleError(_0x574677,null));};exports[_0x6b3d('0xbc')]=function(_0x2e72bf,_0x508c54){var _0x1c6580={};if(_0x2e72bf[_0x6b3d('0x41')]['type']&&_0x2e72bf[_0x6b3d('0x41')][_0x6b3d('0x76')]===_0x6b3d('0x56')){_0x1c6580[_0x6b3d('0x56')]=_0x2e72bf[_0x6b3d('0xbd')]['id'];}else{_0x1c6580['id']=_0x2e72bf[_0x6b3d('0xbd')]['id'];}var _0x480c8c={'raw':![],'where':_0x1c6580},_0x6618a6={};_0x6618a6['model']=_[_0x6b3d('0x42')](db['OpenchannelInteraction'][_0x6b3d('0x3e')]);_0x6618a6[_0x6b3d('0x41')]=_[_0x6b3d('0x42')](_0x2e72bf[_0x6b3d('0x41')]);_0x6618a6['filters']=_[_0x6b3d('0x46')](_0x6618a6[_0x6b3d('0x44')],_0x6618a6[_0x6b3d('0x41')]);_0x480c8c[_0x6b3d('0x45')]=_['intersection'](_0x6618a6['model'],qs[_0x6b3d('0x47')](_0x2e72bf[_0x6b3d('0x41')]['fields']));_0x480c8c[_0x6b3d('0x45')]=_0x480c8c[_0x6b3d('0x45')][_0x6b3d('0x48')]?_0x480c8c[_0x6b3d('0x45')]:_0x6618a6['model'];if(_0x2e72bf[_0x6b3d('0x41')][_0x6b3d('0xbe')]){_0x480c8c[_0x6b3d('0xbf')]=[{'all':!![]}];}_0x480c8c=_['merge']({},_0x480c8c,_0x2e72bf[_0x6b3d('0xc0')]);return db[_0x6b3d('0x3d')][_0x6b3d('0x67')](_0x480c8c)[_0x6b3d('0x29')](handleEntityNotFound(_0x508c54,null))[_0x6b3d('0x29')](respondWithResult(_0x508c54,null))[_0x6b3d('0x34')](handleError(_0x508c54,null));};exports[_0x6b3d('0xc1')]=function(_0x4076dc,_0x14cc72){return db[_0x6b3d('0x3d')][_0x6b3d('0xc1')](_0x4076dc[_0x6b3d('0x7c')],{})['then'](respondWithResult(_0x14cc72,0xc9))[_0x6b3d('0x34')](handleError(_0x14cc72,null));};exports[_0x6b3d('0xc2')]=function(_0x5cfee4,_0x92b90a){if(_0x5cfee4[_0x6b3d('0x7c')]['id']){delete _0x5cfee4[_0x6b3d('0x7c')]['id'];}return db[_0x6b3d('0x3d')][_0x6b3d('0x67')]({'where':{'id':_0x5cfee4[_0x6b3d('0xbd')]['id']}})[_0x6b3d('0x29')](handleEntityNotFound(_0x92b90a,null))['then'](saveUpdates(_0x5cfee4[_0x6b3d('0x7c')],null))['then'](respondWithResult(_0x92b90a,null))[_0x6b3d('0x34')](handleError(_0x92b90a,null));};exports['destroy']=function(_0x488ff5,_0x12e2e9){return db['OpenchannelInteraction'][_0x6b3d('0x67')]({'where':{'id':_0x488ff5[_0x6b3d('0xbd')]['id']}})['then'](handleEntityNotFound(_0x12e2e9,null))[_0x6b3d('0x29')](removeEntity(_0x12e2e9,null))[_0x6b3d('0x34')](handleError(_0x12e2e9,null));};exports[_0x6b3d('0xc3')]=function(_0x47e86a,_0x163fa0){return db[_0x6b3d('0x3d')][_0x6b3d('0xc3')]()['then'](respondWithResult(_0x163fa0,null))[_0x6b3d('0x34')](handleError(_0x163fa0,null));};exports[_0x6b3d('0xc4')]=function(_0xa2029,_0x45fcb4,_0x250c1c){return db[_0x6b3d('0xc5')][_0x6b3d('0x67')]({'where':{'id':_0xa2029[_0x6b3d('0xbd')]['id']}})[_0x6b3d('0x29')](handleEntityNotFound(_0x45fcb4,null))['then'](function(_0x1b3aa6){if(_0x1b3aa6){return _0x1b3aa6[_0x6b3d('0xc4')](_0xa2029['body'][_0x6b3d('0xc6')],_['omit'](_0xa2029[_0x6b3d('0x7c')],[_0x6b3d('0xc6'),'id'])||{});}})[_0x6b3d('0x29')](respondWithResult(_0x45fcb4,null))[_0x6b3d('0x34')](handleError(_0x45fcb4,null));};exports['getMessages']=function(_0x4df181,_0x7a99bf,_0x288076){var _0x7d3047={'raw':![],'where':{}};var _0x48f94c={};var _0x171de7={'count':0x0,'rows':[]};return db[_0x6b3d('0x3d')][_0x6b3d('0xc7')]({'where':{'id':_0x4df181[_0x6b3d('0xbd')]['id']}})[_0x6b3d('0x29')](handleEntityNotFound(_0x7a99bf,null))[_0x6b3d('0x29')](function(_0x351f83){if(_0x351f83){_0x48f94c[_0x6b3d('0x44')]=_[_0x6b3d('0x42')](db[_0x6b3d('0xc5')]['rawAttributes']);_0x48f94c[_0x6b3d('0x41')]=_['keys'](_0x4df181['query']);_0x48f94c[_0x6b3d('0x43')]=_[_0x6b3d('0x46')](_0x48f94c[_0x6b3d('0x44')],_0x48f94c[_0x6b3d('0x41')]);_0x7d3047[_0x6b3d('0x45')]=_[_0x6b3d('0x46')](_0x48f94c[_0x6b3d('0x44')],qs['fields'](_0x4df181[_0x6b3d('0x41')][_0x6b3d('0x47')]));_0x7d3047[_0x6b3d('0x45')]=_0x7d3047[_0x6b3d('0x45')][_0x6b3d('0x48')]?_0x7d3047['attributes']:_0x48f94c[_0x6b3d('0x44')];if(!_0x4df181['query'][_0x6b3d('0x49')](_0x6b3d('0x4a'))){_0x7d3047[_0x6b3d('0x25')]=qs[_0x6b3d('0x25')](_0x4df181['query']['limit']);_0x7d3047['offset']=qs[_0x6b3d('0x23')](_0x4df181[_0x6b3d('0x41')][_0x6b3d('0x23')]);}_0x7d3047['order']=qs['sort'](_0x4df181[_0x6b3d('0x41')][_0x6b3d('0x4c')]);_0x7d3047[_0x6b3d('0x4d')]=qs[_0x6b3d('0x43')](_['pick'](_0x4df181[_0x6b3d('0x41')],_0x48f94c[_0x6b3d('0x43')]));_0x7d3047[_0x6b3d('0x4d')][_0x6b3d('0xba')]=_0x351f83['id'];if(_0x4df181['query'][_0x6b3d('0x8e')]){_0x7d3047[_0x6b3d('0x4d')]=_[_0x6b3d('0xa5')](_0x7d3047[_0x6b3d('0x4d')],{'$or':_[_0x6b3d('0x2e')](_0x7d3047[_0x6b3d('0x45')],function(_0x54c1ca){var _0x5680cc={};_0x5680cc[_0x54c1ca]={'$like':'%'+_0x4df181['query']['filter']+'%'};return _0x5680cc;})});}if(_0x4df181[_0x6b3d('0x41')]['$gte']){var _0x2c2343=_0x4df181[_0x6b3d('0x41')][_0x6b3d('0x83')][_0x6b3d('0x6f')](',');var _0xf6b36f={};_0xf6b36f[_0x2c2343[0x0]]={'$gte':moment(_0x2c2343[0x1])[_0x6b3d('0xc8')](_0x6b3d('0xc9'))};_0x7d3047[_0x6b3d('0x4d')]=_[_0x6b3d('0xa5')](_0x7d3047[_0x6b3d('0x4d')],_0xf6b36f);}_0x7d3047=_['merge']({},_0x7d3047,_0x4df181[_0x6b3d('0xc0')]);return db[_0x6b3d('0xc5')][_0x6b3d('0x26')]({'where':_0x7d3047[_0x6b3d('0x4d')]})[_0x6b3d('0x29')](function(_0x5eda1c){_0x171de7[_0x6b3d('0x26')]=_0x5eda1c;if(_0x4df181[_0x6b3d('0x41')][_0x6b3d('0xbe')]){_0x7d3047[_0x6b3d('0xbf')]=[{'all':!![]}];}return db[_0x6b3d('0xc5')][_0x6b3d('0xca')](_0x7d3047);})[_0x6b3d('0x29')](function(_0x2c6102){_0x171de7[_0x6b3d('0xbb')]=_0x2c6102;return _0x171de7;});}})[_0x6b3d('0x29')](respondWithFilteredResult(_0x7a99bf,_0x7d3047))[_0x6b3d('0x34')](handleError(_0x7a99bf,null));};exports[_0x6b3d('0xcb')]=function(_0x1f526d,_0x2e0457,_0x25eb46){return db[_0x6b3d('0x3d')][_0x6b3d('0x67')]({'where':{'id':_0x1f526d[_0x6b3d('0xbd')]['id']}})[_0x6b3d('0x29')](handleEntityNotFound(_0x2e0457,null))[_0x6b3d('0x29')](function(_0x39d3fe){if(_0x39d3fe){return _0x39d3fe[_0x6b3d('0xcc')](_0x1f526d[_0x6b3d('0x7c')][_0x6b3d('0xc6')],_[_0x6b3d('0xcd')](_0x1f526d[_0x6b3d('0x7c')],['ids','id'])||{})[_0x6b3d('0xce')](function(){return db[_0x6b3d('0x78')][_0x6b3d('0xca')]({'attributes':['id',_0x6b3d('0x40'),'color'],'where':{'id':_0x1f526d[_0x6b3d('0x7c')][_0x6b3d('0xc6')]}});})[_0x6b3d('0x29')](function(_0x3fe390){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x1f526d[_0x6b3d('0xbd')]['id']),'tags':_0x3fe390||[]});return{'id':Number(_0x1f526d[_0x6b3d('0xbd')]['id']),'tags':_0x3fe390||[]};});}})[_0x6b3d('0x29')](respondWithResult(_0x2e0457,null))['catch'](handleError(_0x2e0457,null));};exports['removeTags']=function(_0x41129c,_0x5ec2f2,_0x158ce5){return db['OpenchannelInteraction'][_0x6b3d('0x67')]({'where':{'id':_0x41129c[_0x6b3d('0xbd')]['id']}})['then'](handleEntityNotFound(_0x5ec2f2,null))[_0x6b3d('0x29')](function(_0x16464d){if(_0x16464d){return _0x16464d['removeTags'](_0x41129c[_0x6b3d('0x41')][_0x6b3d('0xc6')]);}})[_0x6b3d('0x29')](respondWithStatusCode(_0x5ec2f2,null))[_0x6b3d('0x34')](handleError(_0x5ec2f2,null));};exports['download']=function(_0x39f4f4,_0xe24e8a){var _0x2c72dc=moment()['unix']()[_0x6b3d('0xa3')]();var _0x371576=path[_0x6b3d('0xcf')](config[_0x6b3d('0xd0')],'server',_0x6b3d('0xd1'),_0x6b3d('0xd2'));var _0xa0512f=path[_0x6b3d('0xcf')](config[_0x6b3d('0xd0')],'server','files',_0x6b3d('0xd3'));var _0x4c38cc=path[_0x6b3d('0xcf')](_0x371576,_0x2c72dc);var _0x381906=util[_0x6b3d('0xc8')](_0x6b3d('0xd4'),_0x39f4f4['params']['id'],_0x2c72dc);var _0x1454fa=path[_0x6b3d('0xcf')](_0x371576,_0x381906);var _0x236ec3=[];_0x236ec3[_0x6b3d('0x33')]({'model':db[_0x6b3d('0xd5')],'as':_0x6b3d('0xd5'),'attributes':['id',_0x6b3d('0x2f')],'raw':!![]});_0x236ec3['push']({'model':db['CmContact'],'as':_0x6b3d('0x6c'),'attributes':['id',_0x6b3d('0xd6'),_0x6b3d('0xd7')],'raw':!![]});if(_0x39f4f4[_0x6b3d('0x41')][_0x6b3d('0xd3')]){_0x236ec3[_0x6b3d('0x33')]({'model':db['Attachment'],'as':_0x6b3d('0xd8'),'raw':!![]});}var _0x1df448=[{'model':db[_0x6b3d('0xc5')],'as':_0x6b3d('0xd9'),'attributes':['id',_0x6b3d('0x7c'),'createdAt',_0x6b3d('0xda'),_0x6b3d('0xdb'),_0x6b3d('0x89')],'include':_0x236ec3}];_0x1df448['push']({'model':db['OpenchannelAccount'],'as':_0x6b3d('0xdc'),'attributes':['id',_0x6b3d('0x40')]});_0x1df448[_0x6b3d('0x33')]({'model':db[_0x6b3d('0xd5')],'as':_0x6b3d('0xdd'),'attributes':['id','fullname']});return db[_0x6b3d('0x3d')][_0x6b3d('0x67')]({'where':{'id':_0x39f4f4[_0x6b3d('0xbd')]['id']},'include':_0x1df448})[_0x6b3d('0x29')](handleEntityNotFound(_0xe24e8a,null))[_0x6b3d('0x29')](function(_0x5e9b37){if(_0x5e9b37){var _0x113c65=_0x5e9b37[_0x6b3d('0xde')]({'plain':!![]});fs['mkdirSync'](_0x4c38cc);var _0x27c198={'channel':'Openchannel','account':_0x113c65[_0x6b3d('0xdc')][_0x6b3d('0x40')],'agent':_0x113c65[_0x6b3d('0xdd')]?_0x113c65[_0x6b3d('0xdd')][_0x6b3d('0x2f')]:_0x6b3d('0xdf'),'createdAt':moment(_0x113c65[_0x6b3d('0x81')])[_0x6b3d('0xc8')](_0x6b3d('0xc9'))[_0x6b3d('0xa3')](),'closedAt':_0x113c65[_0x6b3d('0x39')]?moment(_0x113c65[_0x6b3d('0xe0')])[_0x6b3d('0xc8')](_0x6b3d('0xc9'))[_0x6b3d('0xa3')]():'','disposition':_0x113c65[_0x6b3d('0xe1')],'visibility':_0x113c65[_0x6b3d('0xe2')]?_0x6b3d('0xe3'):'Private','messages':_(_0x113c65[_0x6b3d('0xd9')])[_0x6b3d('0x8e')]({'secret':![]})[_0x6b3d('0x2e')](function(_0x144fb8){if(_0x144fb8['Attachment']){var _0x5b5da6=path['join'](_0xa0512f,_0x144fb8[_0x6b3d('0xd8')][_0x6b3d('0xe4')]);if(fs[_0x6b3d('0xe5')](_0x5b5da6)){fs[_0x6b3d('0xe6')](_0x5b5da6)[_0x6b3d('0xe7')](fs[_0x6b3d('0xe8')](path[_0x6b3d('0xcf')](_0x4c38cc,_0x144fb8[_0x6b3d('0xd8')][_0x6b3d('0xe4')])));}}return{'date':moment(_0x144fb8[_0x6b3d('0x81')])[_0x6b3d('0xc8')](_0x6b3d('0xc9'))[_0x6b3d('0xa3')](),'sender':_0x144fb8['direction']===_0x6b3d('0xe9')?_0x144fb8[_0x6b3d('0xd5')]?_0x144fb8['User'][_0x6b3d('0x2f')]:'System':_0x144fb8[_0x6b3d('0x6c')][_0x6b3d('0xd6')]+(_0x144fb8[_0x6b3d('0x6c')][_0x6b3d('0xd7')]?'\x20'+_0x144fb8[_0x6b3d('0x6c')][_0x6b3d('0xd7')]:''),'body':_0x144fb8[_0x6b3d('0xd8')]?_0x144fb8[_0x6b3d('0xd8')][_0x6b3d('0xe4')]:_0x144fb8['body'],'direction':_0x144fb8['direction']===_0x6b3d('0xe9')?'A':'C','secret':_0x144fb8['secret'],'read':_0x144fb8['read'],'attachment':_0x144fb8[_0x6b3d('0xd8')]};})[_0x6b3d('0x72')]()};return ejs[_0x6b3d('0xea')](path['join'](config['root'],'server','views',_0x6b3d('0xeb')),{'interaction':_0x27c198})[_0x6b3d('0x29')](function(_0x3fe31f){var _0x507979=path[_0x6b3d('0xcf')](_0x4c38cc,_0x6b3d('0xec')+_0x113c65['id']+'-'+_0x2c72dc+'.pdf');var _0x4a88e0={'path':_0x507979,'channel':'Openchannel','interactionId':_0x113c65['id']};return pdf[_0x6b3d('0xed')](_0x3fe31f,_0x4a88e0);})[_0x6b3d('0x29')](function(){return new BPromise(function(_0x159ea1,_0x50b4c0){zipdir(_0x4c38cc,{'saveTo':_0x1454fa},function(_0x54df32,_0x4cd4fb){if(_0x54df32)return _0x50b4c0(_0x54df32);return _0x159ea1(_0x4cd4fb);});})['then'](function(){return new BPromise(function(_0x563a82,_0x3958ee){rimraf(_0x4c38cc,function(_0xe37ac){if(_0xe37ac)_0x3958ee(_0xe37ac);return _0x563a82();});});})[_0x6b3d('0x29')](function(){return _0xe24e8a['download'](_0x1454fa,_0x381906,function(_0x159737){if(_0x159737){console[_0x6b3d('0xee')](_0x6b3d('0xef'),_0x159737);}else{fs[_0x6b3d('0xf0')](_0x1454fa);}});});});}else{return _0xe24e8a[_0x6b3d('0x1f')](0xc8);}})['catch'](handleError(_0xe24e8a,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c5c7dc7..cda946c 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.events.js +++ b/server/api/openchannelInteraction/openchannelInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2b1=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','getUsers','then','setDataValue'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0xa2b1,0x158));var _0x1a2b=function(_0x381a21,_0x510fda){_0x381a21=_0x381a21-0x0;var _0x36b482=_0xa2b1[_0x381a21];return _0x36b482;};'use strict';var EventEmitter=require(_0x1a2b('0x0'));var OpenchannelInteraction=require(_0x1a2b('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x1a2b('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1a2b('0x2'),'afterUpdate':_0x1a2b('0x3'),'afterDestroy':_0x1a2b('0x4')};function emitEvent(_0x2339e9){return function(_0x583657,_0x3af59e,_0x3aebac){_0x583657[_0x1a2b('0x5')]({'attributes':['id'],'raw':!![]})[_0x1a2b('0x6')](function(_0x1a3b1d){_0x583657[_0x1a2b('0x7')]('Users',_0x1a3b1d['map'](function(_0x4c2ae1){return{'id':_0x4c2ae1['id']};}));return OpenchannelMessage[_0x1a2b('0x8')]({'where':{'OpenchannelInteractionId':_0x583657['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xd9672a){_0x583657[_0x1a2b('0x7')](_0x1a2b('0x9'),_0xd9672a[_0x1a2b('0xa')]);OpenchannelInteractionEvents[_0x1a2b('0xb')](_0x2339e9+':'+_0x583657['id'],_0x583657);OpenchannelInteractionEvents[_0x1a2b('0xb')](_0x2339e9,_0x583657);_0x3aebac(null);})[_0x1a2b('0xc')](_0x3aebac(null));};}for(var e in events){if(events[_0x1a2b('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x1a2b('0xe')](e,emitEvent(event));}}module[_0x1a2b('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1557=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','length'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x1557,0x136));var _0x7155=function(_0x47c3d1,_0x340091){_0x47c3d1=_0x47c3d1-0x0;var _0x90cb6e=_0x1557[_0x47c3d1];return _0x90cb6e;};'use strict';var EventEmitter=require(_0x7155('0x0'));var OpenchannelInteraction=require(_0x7155('0x1'))['db'][_0x7155('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7155('0x3')](0x0);var events={'afterCreate':_0x7155('0x4'),'afterUpdate':_0x7155('0x5'),'afterDestroy':_0x7155('0x6')};function emitEvent(_0x213944){return function(_0x125698,_0x312802,_0x1a2af2){_0x125698[_0x7155('0x7')]({'attributes':['id'],'raw':!![]})[_0x7155('0x8')](function(_0x5c357b){_0x125698[_0x7155('0x9')](_0x7155('0xa'),_0x5c357b[_0x7155('0xb')](function(_0x5c8950){return{'id':_0x5c8950['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x125698['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7155('0x8')](function(_0x123aac){_0x125698['setDataValue']('unreadMessages',_0x123aac[_0x7155('0xc')]);OpenchannelInteractionEvents[_0x7155('0xd')](_0x213944+':'+_0x125698['id'],_0x125698);OpenchannelInteractionEvents[_0x7155('0xd')](_0x213944,_0x125698);_0x1a2af2(null);})[_0x7155('0xe')](_0x1a2af2(null));};}for(var e in events){if(events[_0x7155('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x7155('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 283ae91..31522b1 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.model.js +++ b/server/api/openchannelInteraction/openchannelInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5309=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci'];(function(_0x1a23b7,_0x142794){var _0x502113=function(_0x53860d){while(--_0x53860d){_0x1a23b7['push'](_0x1a23b7['shift']());}};_0x502113(++_0x142794);}(_0x5309,0x125));var _0x9530=function(_0x23ca4d,_0x5c2a32){_0x23ca4d=_0x23ca4d-0x0;var _0x435432=_0x5309[_0x23ca4d];return _0x435432;};'use strict';var _=require('lodash');var util=require(_0x9530('0x0'));var logger=require(_0x9530('0x1'))(_0x9530('0x2'));var moment=require(_0x9530('0x3'));var BPromise=require(_0x9530('0x4'));var rp=require(_0x9530('0x5'));var fs=require('fs');var path=require(_0x9530('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9530('0x7'));module[_0x9530('0x8')]=function(_0x590428,_0x36b3a0){return _0x590428[_0x9530('0x9')](_0x9530('0xa'),attributes,{'tableName':_0x9530('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9530('0xc'),'hooks':{'beforeUpdate':function(_0x48e86c,_0xf05309,_0x127f20){if(_0x48e86c[_0x9530('0xd')](_0x9530('0xe'))){_0x48e86c[_0x9530('0xf')]=moment()['format'](_0x9530('0x10'));}_0x127f20(null,_0x48e86c);}}});}; \ No newline at end of file +var _0x3402=['changed','closedAt','format','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5d212e,_0x3626de){var _0x48d3ff=function(_0x17e0dc){while(--_0x17e0dc){_0x5d212e['push'](_0x5d212e['shift']());}};_0x48d3ff(++_0x3626de);}(_0x3402,0x163));var _0x2340=function(_0x35ab11,_0x4309c8){_0x35ab11=_0x35ab11-0x0;var _0xdf9497=_0x3402[_0x35ab11];return _0xdf9497;};'use strict';var _=require(_0x2340('0x0'));var util=require('util');var logger=require(_0x2340('0x1'))('api');var moment=require(_0x2340('0x2'));var BPromise=require(_0x2340('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2340('0x4'));var rimraf=require('rimraf');var config=require(_0x2340('0x5'));var attributes=require(_0x2340('0x6'));module[_0x2340('0x7')]=function(_0x2e59db,_0xab3d80){return _0x2e59db[_0x2340('0x8')](_0x2340('0x9'),attributes,{'tableName':_0x2340('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2340('0xb'),'collate':_0x2340('0xc'),'hooks':{'beforeUpdate':function(_0x1fb156,_0x4e89d3,_0x3893b6){if(_0x1fb156[_0x2340('0xd')]('closed')){_0x1fb156[_0x2340('0xe')]=moment()[_0x2340('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3893b6(null,_0x1fb156);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e55bd6a..13b2014 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.rpc.js +++ b/server/api/openchannelInteraction/openchannelInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36bb=['jayson/promise','client','http','redis','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x439614,_0x4a3f3d){var _0x4a7560=function(_0x255301){while(--_0x255301){_0x439614['push'](_0x439614['shift']());}};_0x4a7560(++_0x4a3f3d);}(_0x36bb,0x1af));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb36b('0x0'));var util=require('util');var moment=require(_0xb36b('0x1'));var BPromise=require(_0xb36b('0x2'));var rs=require(_0xb36b('0x3'));var fs=require('fs');var Redis=require(_0xb36b('0x4'));var db=require(_0xb36b('0x5'))['db'];var utils=require(_0xb36b('0x6'));var logger=require('../../config/logger')(_0xb36b('0x7'));var config=require(_0xb36b('0x8'));var jayson=require(_0xb36b('0x9'));var client=jayson[_0xb36b('0xa')][_0xb36b('0xb')]({'port':0x232a});config[_0xb36b('0xc')]=_['defaults'](config['redis'],{'host':_0xb36b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb36b('0xc')]));require(_0xb36b('0xe'))[_0xb36b('0xf')](socket);function respondWithRpcPromise(_0x171f43,_0xa47b4b,_0x35b6e1){return new BPromise(function(_0x2889ad,_0x55f2bb){return client[_0xb36b('0x10')](_0x171f43,_0x35b6e1)[_0xb36b('0x11')](function(_0x39c435){logger[_0xb36b('0x12')](_0xb36b('0x13'),_0xa47b4b,_0xb36b('0x14'));logger[_0xb36b('0x15')](_0xb36b('0x16'),_0xa47b4b,_0xb36b('0x14'),JSON['stringify'](_0x39c435));if(_0x39c435[_0xb36b('0x17')]){if(_0x39c435[_0xb36b('0x17')][_0xb36b('0x18')]===0x1f4){logger[_0xb36b('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0xa47b4b,_0x39c435['error'][_0xb36b('0x19')]);return _0x55f2bb(_0x39c435[_0xb36b('0x17')]['message']);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0xa47b4b,_0x39c435[_0xb36b('0x17')][_0xb36b('0x19')]);return _0x2889ad(_0x39c435[_0xb36b('0x17')][_0xb36b('0x19')]);}else{logger[_0xb36b('0x12')](_0xb36b('0x13'),_0xa47b4b,_0xb36b('0x14'));_0x2889ad(_0x39c435[_0xb36b('0x1a')][_0xb36b('0x19')]);}})[_0xb36b('0x1b')](function(_0xbc41b){logger[_0xb36b('0x17')](_0xb36b('0x13'),_0xa47b4b,_0xbc41b);_0x55f2bb(_0xbc41b);});});}exports[_0xb36b('0x1c')]=function(_0x6dd02){var _0x2721b7=this;return new Promise(function(_0x2fce10,_0x15645){return db[_0xb36b('0x1d')][_0xb36b('0x1e')](_0x6dd02['body'],{'raw':_0x6dd02[_0xb36b('0x1f')]?_0x6dd02[_0xb36b('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6dd02[_0xb36b('0x1f')]?_0x6dd02[_0xb36b('0x1f')][_0xb36b('0x20')]||null:null,'attributes':_0x6dd02[_0xb36b('0x1f')]?_0x6dd02[_0xb36b('0x1f')][_0xb36b('0x21')]||null:null,'limit':_0x6dd02[_0xb36b('0x1f')]?_0x6dd02[_0xb36b('0x1f')][_0xb36b('0x22')]||null:null})['then'](function(_0x15ffc6){logger[_0xb36b('0x12')]('UpdateOpenchannelInteraction',_0x6dd02);logger[_0xb36b('0x15')](_0xb36b('0x1c'),_0x6dd02,JSON[_0xb36b('0x23')](_0x15ffc6));_0x2fce10(_0x15ffc6);})['catch'](function(_0x4daa43){logger[_0xb36b('0x17')]('UpdateOpenchannelInteraction',_0x4daa43[_0xb36b('0x19')],_0x6dd02);_0x15645(_0x2721b7[_0xb36b('0x17')](0x1f4,_0x4daa43[_0xb36b('0x19')]));});});};exports[_0xb36b('0x24')]=function(_0x3388d8){return new Promise(function(_0x52e6a5,_0x32077c){return db[_0xb36b('0x1d')][_0xb36b('0x25')]({'where':_0x3388d8[_0xb36b('0x1f')]?_0x3388d8[_0xb36b('0x1f')][_0xb36b('0x20')]||null:null})['then'](function(_0x2e4338){if(_0x2e4338){return _0x2e4338[_0xb36b('0x26')](_0x3388d8[_0xb36b('0x27')]['ids'],_[_0xb36b('0x28')](_0x3388d8[_0xb36b('0x27')],[_0xb36b('0x29'),'id'])||{});}})[_0xb36b('0x2a')](function(_0x2cf68a){logger[_0xb36b('0x12')](_0xb36b('0x2b'),_0x3388d8);logger[_0xb36b('0x15')](_0xb36b('0x2b'),_0x3388d8,JSON['stringify'](_0x2cf68a));_0x52e6a5(_0x2cf68a);})['catch'](function(_0x2d593d){logger[_0xb36b('0x17')](_0xb36b('0x2b'),_0x2d593d['message'],_0x3388d8);_0x32077c(_this[_0xb36b('0x17')](0x1f4,_0x2d593d['message']));});});}; \ No newline at end of file +var _0xd644=['catch','UpdateOpenchannelInteraction','update','body','options','raw','attributes','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','addTags','omit','ids','spread','AddTags','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','info','result'];(function(_0x2c4666,_0x5468c2){var _0x28777b=function(_0x3a679){while(--_0x3a679){_0x2c4666['push'](_0x2c4666['shift']());}};_0x28777b(++_0x5468c2);}(_0xd644,0x144));var _0x4d64=function(_0x3dd199,_0x3fc414){_0x3dd199=_0x3dd199-0x0;var _0x460438=_0xd644[_0x3dd199];return _0x460438;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4d64('0x0'));var rs=require(_0x4d64('0x1'));var fs=require('fs');var Redis=require(_0x4d64('0x2'));var db=require(_0x4d64('0x3'))['db'];var utils=require(_0x4d64('0x4'));var logger=require(_0x4d64('0x5'))(_0x4d64('0x6'));var config=require(_0x4d64('0x7'));var jayson=require(_0x4d64('0x8'));var client=jayson[_0x4d64('0x9')]['http']({'port':0x232a});config[_0x4d64('0xa')]=_[_0x4d64('0xb')](config['redis'],{'host':_0x4d64('0xc'),'port':0x18eb});var socket=require(_0x4d64('0xd'))(new Redis(config[_0x4d64('0xa')]));require(_0x4d64('0xe'))[_0x4d64('0xf')](socket);function respondWithRpcPromise(_0x1ee9ab,_0x492544,_0x2697e2){return new BPromise(function(_0x1a7ef5,_0x457b8c){return client[_0x4d64('0x10')](_0x1ee9ab,_0x2697e2)[_0x4d64('0x11')](function(_0x238887){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x492544,_0x4d64('0x12'));logger[_0x4d64('0x13')](_0x4d64('0x14'),_0x492544,_0x4d64('0x12'),JSON[_0x4d64('0x15')](_0x238887));if(_0x238887[_0x4d64('0x16')]){if(_0x238887[_0x4d64('0x16')][_0x4d64('0x17')]===0x1f4){logger[_0x4d64('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x492544,_0x238887[_0x4d64('0x16')][_0x4d64('0x18')]);return _0x457b8c(_0x238887[_0x4d64('0x16')][_0x4d64('0x18')]);}logger['error'](_0x4d64('0x19'),_0x492544,_0x238887[_0x4d64('0x16')][_0x4d64('0x18')]);return _0x1a7ef5(_0x238887[_0x4d64('0x16')][_0x4d64('0x18')]);}else{logger[_0x4d64('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x492544,_0x4d64('0x12'));_0x1a7ef5(_0x238887[_0x4d64('0x1b')][_0x4d64('0x18')]);}})[_0x4d64('0x1c')](function(_0x382368){logger[_0x4d64('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x492544,_0x382368);_0x457b8c(_0x382368);});});}exports[_0x4d64('0x1d')]=function(_0x579892){var _0x148054=this;return new Promise(function(_0x2c0579,_0x4c0268){return db['OpenchannelInteraction'][_0x4d64('0x1e')](_0x579892[_0x4d64('0x1f')],{'raw':_0x579892['options']?_0x579892[_0x4d64('0x20')][_0x4d64('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x579892[_0x4d64('0x20')]?_0x579892[_0x4d64('0x20')]['where']||null:null,'attributes':_0x579892['options']?_0x579892[_0x4d64('0x20')][_0x4d64('0x22')]||null:null,'limit':_0x579892[_0x4d64('0x20')]?_0x579892[_0x4d64('0x20')]['limit']||null:null})[_0x4d64('0x11')](function(_0x55b9b4){logger[_0x4d64('0x1a')](_0x4d64('0x1d'),_0x579892);logger[_0x4d64('0x13')](_0x4d64('0x1d'),_0x579892,JSON[_0x4d64('0x15')](_0x55b9b4));_0x2c0579(_0x55b9b4);})[_0x4d64('0x1c')](function(_0x3c1614){logger[_0x4d64('0x16')]('UpdateOpenchannelInteraction',_0x3c1614['message'],_0x579892);_0x4c0268(_0x148054[_0x4d64('0x16')](0x1f4,_0x3c1614['message']));});});};exports[_0x4d64('0x23')]=function(_0x1108dc){return new Promise(function(_0x2ab8d0,_0x2e0278){return db[_0x4d64('0x24')][_0x4d64('0x25')]({'where':_0x1108dc[_0x4d64('0x20')]?_0x1108dc[_0x4d64('0x20')][_0x4d64('0x26')]||null:null})[_0x4d64('0x11')](function(_0x3814ef){if(_0x3814ef){return _0x3814ef[_0x4d64('0x27')](_0x1108dc[_0x4d64('0x1f')]['ids'],_[_0x4d64('0x28')](_0x1108dc['body'],[_0x4d64('0x29'),'id'])||{});}})[_0x4d64('0x2a')](function(_0x2708cd){logger[_0x4d64('0x1a')]('AddTags',_0x1108dc);logger[_0x4d64('0x13')](_0x4d64('0x2b'),_0x1108dc,JSON[_0x4d64('0x15')](_0x2708cd));_0x2ab8d0(_0x2708cd);})[_0x4d64('0x1c')](function(_0x343239){logger[_0x4d64('0x16')](_0x4d64('0x2b'),_0x343239[_0x4d64('0x18')],_0x1108dc);_0x2e0278(_this[_0x4d64('0x16')](0x1f4,_0x343239[_0x4d64('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7edbe1b..b68e4be 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.socket.js +++ b/server/api/openchannelInteraction/openchannelInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae6f=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','update','removeListener'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xae6f,0x9d));var _0xfae6=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xae6f[_0x2070da];return _0x4f9fe1;};'use strict';var OpenchannelInteractionEvents=require(_0xfae6('0x0'));var events=[_0xfae6('0x1'),'remove',_0xfae6('0x2')];function createListener(_0x2daabd,_0x39792c){return function(_0x3e39d0){_0x39792c['emit'](_0x2daabd,_0x3e39d0);};}function removeListener(_0x386447,_0x17bdf5){return function(){OpenchannelInteractionEvents[_0xfae6('0x3')](_0x386447,_0x17bdf5);};}exports[_0xfae6('0x4')]=function(_0x300f41){for(var _0x22c953=0x0,_0x3633d5=events[_0xfae6('0x5')];_0x22c953<_0x3633d5;_0x22c953++){var _0x3b3c54=events[_0x22c953];var _0x2cea59=createListener(_0xfae6('0x6')+_0x3b3c54,_0x300f41);OpenchannelInteractionEvents['on'](_0x3b3c54,_0x2cea59);}}; \ No newline at end of file +var _0xc7cc=['remove','update','emit','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x35662d,_0x48e79f){var _0x230925=function(_0x56a9ab){while(--_0x56a9ab){_0x35662d['push'](_0x35662d['shift']());}};_0x230925(++_0x48e79f);}(_0xc7cc,0x1b6));var _0xcc7c=function(_0x5e8049,_0x3acac3){_0x5e8049=_0x5e8049-0x0;var _0x38f524=_0xc7cc[_0x5e8049];return _0x38f524;};'use strict';var OpenchannelInteractionEvents=require(_0xcc7c('0x0'));var events=[_0xcc7c('0x1'),_0xcc7c('0x2'),_0xcc7c('0x3')];function createListener(_0x329985,_0x105ef9){return function(_0x3dd685){_0x105ef9[_0xcc7c('0x4')](_0x329985,_0x3dd685);};}function removeListener(_0x1b343b,_0xd2b355){return function(){OpenchannelInteractionEvents['removeListener'](_0x1b343b,_0xd2b355);};}exports[_0xcc7c('0x5')]=function(_0x45651c){for(var _0x55a72a=0x0,_0x56a30f=events[_0xcc7c('0x6')];_0x55a72a<_0x56a30f;_0x55a72a++){var _0x3f642e=events[_0x55a72a];var _0x475bd2=createListener(_0xcc7c('0x7')+_0x3f642e,_0x45651c);OpenchannelInteractionEvents['on'](_0x3f642e,_0x475bd2);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 0e3b6ea..8701d30 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x4b2c18,_0x3c00c2){var _0x2d80cc=function(_0x4c05cf){while(--_0x4c05cf){_0x4b2c18['push'](_0x4b2c18['shift']());}};_0x2d80cc(++_0x3c00c2);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x5e99b8,_0x330770){var _0x3389d3=function(_0x5e3cd2){while(--_0x5e3cd2){_0x5e99b8['push'](_0x5e99b8['shift']());}};_0x3389d3(++_0x330770);}(_0xedd9,0xfc));var _0x9edd=function(_0x220a18,_0xa726e5){_0x220a18=_0x220a18-0x0;var _0x561c7d=_0xedd9[_0x220a18];return _0x561c7d;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index f69a95b..b9d8aa9 100644 --- a/server/api/openchannelMessage/openchannelMessage.attributes.js +++ b/server/api/openchannelMessage/openchannelMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fad=['out','DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x5d8547,_0x491b64){var _0x2d83b5=function(_0x1dca69){while(--_0x1dca69){_0x5d8547['push'](_0x5d8547['shift']());}};_0x2d83b5(++_0x491b64);}(_0x4fad,0xcb));var _0xd4fa=function(_0x310e15,_0x1c3135){_0x310e15=_0x310e15-0x0;var _0x5e6799=_0x4fad[_0x310e15];return _0x5e6799;};'use strict';var Sequelize=require(_0xd4fa('0x0'));module[_0xd4fa('0x1')]={'body':{'type':Sequelize[_0xd4fa('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd4fa('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd4fa('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd4fa('0x4')]('in',_0xd4fa('0x5')),'defaultValue':_0xd4fa('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd4fa('0x6')]},'providerName':{'type':Sequelize[_0xd4fa('0x7')]},'providerResponse':{'type':Sequelize[_0xd4fa('0x2')]}}; \ No newline at end of file +var _0xd2bf=['DATE','STRING','TEXT','sequelize','BOOLEAN','out'];(function(_0x1cfc3f,_0x219f0c){var _0x12b295=function(_0x1f61ce){while(--_0x1f61ce){_0x1cfc3f['push'](_0x1cfc3f['shift']());}};_0x12b295(++_0x219f0c);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0xd2bf[_0x301c34];return _0x1a8c5a;};'use strict';var Sequelize=require(_0xfd2b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xfd2b('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfd2b('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfd2b('0x2')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xfd2b('0x3')]},'providerName':{'type':Sequelize[_0xfd2b('0x4')]},'providerResponse':{'type':Sequelize[_0xfd2b('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 6a14060..e1953dd 100644 --- a/server/api/openchannelMessage/openchannelMessage.controller.js +++ b/server/api/openchannelMessage/openchannelMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e8a=['fields','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','create','body','find','destroy','describe','openchannel-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','contact','User','fullname','internal','interface','channel','motionChannel','EventManager','acceptmessage','reject','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','Sequelize','SELECT','email','event','rejectmessage','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','client','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','update','sendStatus','stack','name','send','index','map','OpenchannelMessage','fieldName','key','model','query','keys','attributes','intersection'];(function(_0x5a889d,_0x5d738b){var _0x500397=function(_0x1a4f14){while(--_0x1a4f14){_0x5a889d['push'](_0x5a889d['shift']());}};_0x500397(++_0x5d738b);}(_0x1e8a,0x1c6));var _0xa1e8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1e8a[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xa1e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1e8('0x1'));var jsonpatch=require(_0xa1e8('0x2'));var rp=require('request-promise');var moment=require(_0xa1e8('0x3'));var BPromise=require(_0xa1e8('0x4'));var Mustache=require(_0xa1e8('0x5'));var util=require(_0xa1e8('0x6'));var path=require(_0xa1e8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa1e8('0x8'));var fs=require('fs');var fs_extra=require(_0xa1e8('0x9'));var _=require(_0xa1e8('0xa'));var squel=require('squel');var crypto=require(_0xa1e8('0xb'));var jsforce=require(_0xa1e8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1e8('0xd'));var querystring=require(_0xa1e8('0xe'));var Papa=require('papaparse');var Redis=require(_0xa1e8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1e8('0x10'));var as=require(_0xa1e8('0x11'));var hardwareService=require(_0xa1e8('0x12'));var logger=require(_0xa1e8('0x13'))(_0xa1e8('0x14'));var utils=require(_0xa1e8('0x15'));var config=require(_0xa1e8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1e8('0x17'))['db'];config[_0xa1e8('0x18')]=_[_0xa1e8('0x19')](config['redis'],{'host':_0xa1e8('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1e8('0x18')]));require(_0xa1e8('0x1b'))[_0xa1e8('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa1e8('0x1d')][_0xa1e8('0x1e')]({'port':0x232c});var client9002=jayson[_0xa1e8('0x1d')][_0xa1e8('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3a266d,_0x31260e,_0x515e8c,_0x36cb89){return new BPromise(function(_0x2312fe,_0x3e52ac){var _0x363d91=_0x36cb89||client;return _0x363d91['request'](_0x3a266d,_0x515e8c)[_0xa1e8('0x1f')](function(_0x2875f8){logger['info'](_0xa1e8('0x20'),_0x31260e,_0xa1e8('0x21'));logger['debug'](_0xa1e8('0x22'),_0x31260e,'request\x20sent',JSON[_0xa1e8('0x23')](_0x2875f8));if(_0x2875f8[_0xa1e8('0x24')]){if(_0x2875f8[_0xa1e8('0x24')]['code']===0x1f4){logger[_0xa1e8('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x31260e,_0x2875f8['error'][_0xa1e8('0x25')]);return _0x3e52ac(_0x2875f8[_0xa1e8('0x24')][_0xa1e8('0x25')]);}logger['error'](_0xa1e8('0x20'),_0x31260e,_0x2875f8[_0xa1e8('0x24')]['message']);return _0x2312fe(_0x2875f8[_0xa1e8('0x24')][_0xa1e8('0x25')]);}else{logger[_0xa1e8('0x26')](_0xa1e8('0x20'),_0x31260e,_0xa1e8('0x21'));_0x2312fe(_0x2875f8[_0xa1e8('0x27')][_0xa1e8('0x25')]);}})[_0xa1e8('0x28')](function(_0x458792){logger['error'](_0xa1e8('0x20'),_0x31260e,_0x458792);_0x3e52ac(_0x458792);});});}function respondWithStatusCode(_0x1db05c,_0x184dc6){_0x184dc6=_0x184dc6||0xcc;return function(_0x1e28e3){if(_0x1e28e3){return _0x1db05c['sendStatus'](_0x184dc6);}return _0x1db05c[_0xa1e8('0x29')](_0x184dc6)[_0xa1e8('0x2a')]();};}function respondWithResult(_0x1d7fb2,_0xbb4f90){_0xbb4f90=_0xbb4f90||0xc8;return function(_0x3f5c23){if(_0x3f5c23){return _0x1d7fb2[_0xa1e8('0x29')](_0xbb4f90)[_0xa1e8('0x2b')](_0x3f5c23);}};}function respondWithFilteredResult(_0x2a8a3d,_0x207f6f){return function(_0x20ba0c){if(_0x20ba0c){var _0xf0759b=typeof _0x207f6f['offset']==='undefined'&&typeof _0x207f6f[_0xa1e8('0x2c')]===_0xa1e8('0x2d');var _0x306edd=_0x20ba0c[_0xa1e8('0x2e')];var _0x4530bf=_0xf0759b?0x0:_0x207f6f[_0xa1e8('0x2f')];var _0x1fd6c3=_0xf0759b?_0x20ba0c['count']:_0x207f6f[_0xa1e8('0x2f')]+_0x207f6f['limit'];var _0x51c0ef;if(_0x1fd6c3>=_0x306edd){_0x1fd6c3=_0x306edd;_0x51c0ef=0xc8;}else{_0x51c0ef=0xce;}_0x2a8a3d[_0xa1e8('0x29')](_0x51c0ef);return _0x2a8a3d[_0xa1e8('0x30')](_0xa1e8('0x31'),_0x4530bf+'-'+_0x1fd6c3+'/'+_0x306edd)[_0xa1e8('0x2b')](_0x20ba0c);}return null;};}function patchUpdates(_0x2132b7){return function(_0x22a563){try{jsonpatch[_0xa1e8('0x32')](_0x22a563,_0x2132b7,!![]);}catch(_0x1336a9){return BPromise['reject'](_0x1336a9);}return _0x22a563['save']();};}function saveUpdates(_0x9b42c6,_0x50583a){return function(_0x5b79d9){if(_0x5b79d9){return _0x5b79d9[_0xa1e8('0x33')](_0x9b42c6)['then'](function(_0x1bd74c){return _0x1bd74c;});}return null;};}function removeEntity(_0x36e72d,_0x49dbab){return function(_0x3f081a){if(_0x3f081a){return _0x3f081a['destroy']()[_0xa1e8('0x1f')](function(){_0x36e72d[_0xa1e8('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b007,_0x243305){return function(_0x30f1d2){if(!_0x30f1d2){_0x19b007[_0xa1e8('0x34')](0x194);}return _0x30f1d2;};}function handleError(_0x2bb4d2,_0x37ed97){_0x37ed97=_0x37ed97||0x1f4;return function(_0x73aecf){logger['error'](_0x73aecf[_0xa1e8('0x35')]);if(_0x73aecf[_0xa1e8('0x36')]){delete _0x73aecf['name'];}_0x2bb4d2['status'](_0x37ed97)[_0xa1e8('0x37')](_0x73aecf);};}exports[_0xa1e8('0x38')]=function(_0x5778de,_0x4f6505){var _0x4baf81={},_0x2ecf76={},_0x3360f5={'count':0x0,'rows':[]};var _0x249224=_[_0xa1e8('0x39')](db[_0xa1e8('0x3a')]['rawAttributes'],function(_0x52d249){return{'name':_0x52d249[_0xa1e8('0x3b')],'type':_0x52d249['type'][_0xa1e8('0x3c')]};});_0x2ecf76[_0xa1e8('0x3d')]=_[_0xa1e8('0x39')](_0x249224,_0xa1e8('0x36'));_0x2ecf76[_0xa1e8('0x3e')]=_[_0xa1e8('0x3f')](_0x5778de[_0xa1e8('0x3e')]);_0x2ecf76['filters']=_['intersection'](_0x2ecf76['model'],_0x2ecf76[_0xa1e8('0x3e')]);_0x4baf81[_0xa1e8('0x40')]=_[_0xa1e8('0x41')](_0x2ecf76[_0xa1e8('0x3d')],qs[_0xa1e8('0x42')](_0x5778de['query'][_0xa1e8('0x42')]));_0x4baf81['attributes']=_0x4baf81[_0xa1e8('0x40')]['length']?_0x4baf81[_0xa1e8('0x40')]:_0x2ecf76[_0xa1e8('0x3d')];if(!_0x5778de[_0xa1e8('0x3e')]['hasOwnProperty'](_0xa1e8('0x43'))){_0x4baf81['limit']=qs[_0xa1e8('0x2c')](_0x5778de[_0xa1e8('0x3e')]['limit']);_0x4baf81[_0xa1e8('0x2f')]=qs[_0xa1e8('0x2f')](_0x5778de[_0xa1e8('0x3e')][_0xa1e8('0x2f')]);}_0x4baf81[_0xa1e8('0x44')]=qs[_0xa1e8('0x45')](_0x5778de['query']['sort']);_0x4baf81['where']=qs[_0xa1e8('0x46')](_[_0xa1e8('0x47')](_0x5778de[_0xa1e8('0x3e')],_0x2ecf76['filters']),_0x249224);if(_0x5778de[_0xa1e8('0x3e')][_0xa1e8('0x48')]){_0x4baf81[_0xa1e8('0x49')]=_['merge'](_0x4baf81[_0xa1e8('0x49')],{'$or':_[_0xa1e8('0x39')](_0x249224,function(_0x31ef56){if(_0x31ef56['type']!=='VIRTUAL'){var _0x294d66={};_0x294d66[_0x31ef56['name']]={'$like':'%'+_0x5778de[_0xa1e8('0x3e')][_0xa1e8('0x48')]+'%'};return _0x294d66;}})});}_0x4baf81=_[_0xa1e8('0x4a')]({},_0x4baf81,_0x5778de[_0xa1e8('0x4b')]);var _0xc52cc1={'where':_0x4baf81[_0xa1e8('0x49')]};return db[_0xa1e8('0x3a')]['count'](_0xc52cc1)[_0xa1e8('0x1f')](function(_0x3cb155){_0x3360f5[_0xa1e8('0x2e')]=_0x3cb155;if(_0x5778de[_0xa1e8('0x3e')][_0xa1e8('0x4c')]){_0x4baf81[_0xa1e8('0x4d')]=[{'all':!![]}];}return db[_0xa1e8('0x3a')][_0xa1e8('0x4e')](_0x4baf81);})['then'](function(_0xb24055){_0x3360f5[_0xa1e8('0x4f')]=_0xb24055;return _0x3360f5;})[_0xa1e8('0x1f')](respondWithFilteredResult(_0x4f6505,_0x4baf81))['catch'](handleError(_0x4f6505,null));};exports[_0xa1e8('0x50')]=function(_0x116c5a,_0x614bdb){var _0x4a6596={'raw':!![],'where':{'id':_0x116c5a[_0xa1e8('0x51')]['id']}},_0x433319={};_0x433319[_0xa1e8('0x3d')]=_[_0xa1e8('0x3f')](db['OpenchannelMessage'][_0xa1e8('0x52')]);_0x433319[_0xa1e8('0x3e')]=_[_0xa1e8('0x3f')](_0x116c5a[_0xa1e8('0x3e')]);_0x433319[_0xa1e8('0x46')]=_[_0xa1e8('0x41')](_0x433319[_0xa1e8('0x3d')],_0x433319[_0xa1e8('0x3e')]);_0x4a6596[_0xa1e8('0x40')]=_[_0xa1e8('0x41')](_0x433319['model'],qs[_0xa1e8('0x42')](_0x116c5a['query']['fields']));_0x4a6596[_0xa1e8('0x40')]=_0x4a6596[_0xa1e8('0x40')][_0xa1e8('0x53')]?_0x4a6596[_0xa1e8('0x40')]:_0x433319[_0xa1e8('0x3d')];if(_0x116c5a[_0xa1e8('0x3e')][_0xa1e8('0x4c')]){_0x4a6596[_0xa1e8('0x4d')]=[{'all':!![]}];}_0x4a6596=_['merge']({},_0x4a6596,_0x116c5a[_0xa1e8('0x4b')]);return db[_0xa1e8('0x3a')]['find'](_0x4a6596)[_0xa1e8('0x1f')](handleEntityNotFound(_0x614bdb,null))[_0xa1e8('0x1f')](respondWithResult(_0x614bdb,null))['catch'](handleError(_0x614bdb,null));};exports[_0xa1e8('0x54')]=function(_0x5dd7d5,_0x2c82c4){return db[_0xa1e8('0x3a')][_0xa1e8('0x54')](_0x5dd7d5[_0xa1e8('0x55')],{})['then'](respondWithResult(_0x2c82c4,0xc9))[_0xa1e8('0x28')](handleError(_0x2c82c4,null));};exports[_0xa1e8('0x33')]=function(_0x3996d7,_0x126cc0){if(_0x3996d7[_0xa1e8('0x55')]['id']){delete _0x3996d7[_0xa1e8('0x55')]['id'];}return db[_0xa1e8('0x3a')][_0xa1e8('0x56')]({'where':{'id':_0x3996d7[_0xa1e8('0x51')]['id']}})[_0xa1e8('0x1f')](handleEntityNotFound(_0x126cc0,null))[_0xa1e8('0x1f')](saveUpdates(_0x3996d7[_0xa1e8('0x55')],null))[_0xa1e8('0x1f')](respondWithResult(_0x126cc0,null))[_0xa1e8('0x28')](handleError(_0x126cc0,null));};exports[_0xa1e8('0x57')]=function(_0x49634e,_0x8c241){return db[_0xa1e8('0x3a')][_0xa1e8('0x56')]({'where':{'id':_0x49634e[_0xa1e8('0x51')]['id']}})[_0xa1e8('0x1f')](handleEntityNotFound(_0x8c241,null))['then'](removeEntity(_0x8c241,null))[_0xa1e8('0x28')](handleError(_0x8c241,null));};exports[_0xa1e8('0x58')]=function(_0x455473,_0x463233){return db[_0xa1e8('0x3a')][_0xa1e8('0x58')]()[_0xa1e8('0x1f')](respondWithResult(_0x463233,null))[_0xa1e8('0x28')](handleError(_0x463233,null));};var interaction_log=require(_0xa1e8('0x13'))(_0xa1e8('0x59'));exports[_0xa1e8('0x5a')]=function(_0x31dd1a,_0x19d712,_0x33c353){var _0x4f0b90={'agent':{},'channel':'openchannel'};if(_0x31dd1a[_0xa1e8('0x55')]['id']){delete _0x31dd1a[_0xa1e8('0x55')]['id'];}_0x31dd1a[_0xa1e8('0x55')][_0xa1e8('0x5b')]=!![];_0x31dd1a[_0xa1e8('0x55')][_0xa1e8('0x5c')]=moment()['format'](_0xa1e8('0x5d'));_0x31dd1a['body'][_0xa1e8('0x5e')]=_0x31dd1a[_0xa1e8('0x55')][_0xa1e8('0x5e')]||_0x31dd1a['user']['id'];_0x4f0b90[_0xa1e8('0x5f')]['id']=_0x31dd1a['body'][_0xa1e8('0x5e')];return db['OpenchannelMessage'][_0xa1e8('0x56')]({'where':{'id':_0x31dd1a[_0xa1e8('0x51')]['id'],'UserId':null}})[_0xa1e8('0x1f')](handleEntityNotFound(_0x19d712,null))['then'](saveUpdates(_0x31dd1a[_0xa1e8('0x55')],null))[_0xa1e8('0x1f')](function(_0x553a92){if(_0x553a92){_0x4f0b90[_0xa1e8('0x25')]=_0x553a92[_0xa1e8('0x60')]({'plain':!![]});return db[_0xa1e8('0x61')][_0xa1e8('0x56')]({'where':{'id':_0x553a92[_0xa1e8('0x62')]}});}return null;})[_0xa1e8('0x1f')](handleEntityNotFound(_0x19d712,null))[_0xa1e8('0x1f')](function(_0x30c9bd){if(_0x30c9bd){return _0x30c9bd[_0xa1e8('0x33')]({'UserId':_0x31dd1a[_0xa1e8('0x55')][_0xa1e8('0x5e')],'read1stAt':_[_0xa1e8('0x63')](_0x30c9bd[_0xa1e8('0x64')])?moment()[_0xa1e8('0x65')](_0xa1e8('0x5d')):undefined});}return null;})[_0xa1e8('0x1f')](function(_0x41aedc){if(_0x41aedc){_0x4f0b90[_0xa1e8('0x66')]=_0x41aedc[_0xa1e8('0x60')]({'plain':!![]});interaction_log[_0xa1e8('0x26')](_0xa1e8('0x67'),_0x31dd1a['user']['id'],_0x31dd1a[_0xa1e8('0x68')]['name'],_0x31dd1a['user'][_0xa1e8('0x69')],_0x4f0b90[_0xa1e8('0x66')]['id'],_0x31dd1a[_0xa1e8('0x55')]?JSON['stringify'](_0x31dd1a['body']):_0xa1e8('0x6a'));return respondWithRpcPromise(_0xa1e8('0x6b'),'acceptMessage',_0x4f0b90);}return null;})[_0xa1e8('0x1f')](function(_0x2182dd){var _0x1875f0=_0xa1e8('0x6c')+_0x2182dd[_0xa1e8('0x25')][_0xa1e8('0x6d')];return db['sequelize'][_0xa1e8('0x3e')](_0x1875f0,{'type':db['Sequelize'][_0xa1e8('0x6e')]['SELECT'],'raw':!![]})[_0xa1e8('0x1f')](function(_0x4a07b2){return _0x4a07b2;});})[_0xa1e8('0x1f')](function(_0x2b2d19){if(_0x2b2d19){_0x4f0b90[_0xa1e8('0x25')][_0xa1e8('0x6f')]=_0x2b2d19[0x0];if(!_0x31dd1a[_0xa1e8('0x55')][_0xa1e8('0x5e')])return;return db[_0xa1e8('0x70')][_0xa1e8('0x56')]({'where':{'id':_0x31dd1a[_0xa1e8('0x55')][_0xa1e8('0x5e')],'role':'agent'},'attributes':['id',_0xa1e8('0x36'),_0xa1e8('0x71'),'email',_0xa1e8('0x72')],'raw':!![]});}return null;})[_0xa1e8('0x1f')](function(_0x3dea8e){if(!_0x3dea8e)return null;_0x4f0b90[_0xa1e8('0x25')][_0xa1e8('0x5f')]=_0x3dea8e;return _0x4f0b90;})['then'](function(_0x4ac64d){if(_0x4ac64d){if(_0x31dd1a['body']['manual']){_0x4f0b90[_0xa1e8('0x25')][_0xa1e8('0x73')]=util[_0xa1e8('0x65')]('SIP/%s',_0x31dd1a[_0xa1e8('0x68')][_0xa1e8('0x36')]);_0x4f0b90[_0xa1e8('0x25')]['channel']=_0x4f0b90[_0xa1e8('0x74')];_0x4f0b90[_0xa1e8('0x25')][_0xa1e8('0x75')]=_0x4f0b90[_0xa1e8('0x74')];_0x4f0b90[_0xa1e8('0x25')]['event']=_0xa1e8('0x5a');return respondWithRpcPromise(_0xa1e8('0x76'),_0xa1e8('0x76'),{'event':_0xa1e8('0x77'),'message':_0x4f0b90[_0xa1e8('0x25')]},client9002)[_0xa1e8('0x1f')](function(){return _0x4f0b90;});}return _0x4f0b90;}return null;})[_0xa1e8('0x1f')](respondWithResult(_0x19d712,null))[_0xa1e8('0x28')](handleError(_0x19d712,null));};var interaction_log=require(_0xa1e8('0x13'))(_0xa1e8('0x59'));exports[_0xa1e8('0x78')]=function(_0x2efab1,_0x1d089b,_0x2a56ba){var _0x52b4ec={'agent':{},'channel':_0xa1e8('0x79')};if(_0x2efab1[_0xa1e8('0x55')]['id']){delete _0x2efab1[_0xa1e8('0x55')]['id'];}_0x2efab1['body'][_0xa1e8('0x5e')]=_0x2efab1[_0xa1e8('0x55')]['UserId']||_0x2efab1[_0xa1e8('0x68')]['id'];_0x52b4ec['agent']['id']=_0x2efab1[_0xa1e8('0x55')]['UserId'];return db[_0xa1e8('0x3a')][_0xa1e8('0x56')]({'where':{'id':_0x2efab1[_0xa1e8('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1d089b,null))['then'](function(_0x3a9c3f){if(_0x3a9c3f){_0x52b4ec[_0xa1e8('0x25')]=_0x3a9c3f['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x3a9c3f[_0xa1e8('0x62')]}});}return null;})[_0xa1e8('0x1f')](handleEntityNotFound(_0x1d089b,null))[_0xa1e8('0x1f')](function(_0x1db1e1){if(_0x1db1e1){_0x52b4ec[_0xa1e8('0x66')]=_0x1db1e1['get']({'plain':!![]});interaction_log['info'](_0xa1e8('0x7a'),_0x2efab1[_0xa1e8('0x68')]['id'],_0x2efab1['user'][_0xa1e8('0x36')],_0x2efab1[_0xa1e8('0x68')][_0xa1e8('0x69')],_0x52b4ec['interaction']['id'],_0x2efab1[_0xa1e8('0x55')]?JSON[_0xa1e8('0x23')](_0x2efab1[_0xa1e8('0x55')]):_0xa1e8('0x6a'));return respondWithRpcPromise(_0xa1e8('0x7b'),'rejectMessage',_0x52b4ec);}return null;})[_0xa1e8('0x1f')](function(_0x2b24ac){var _0x9fe95f=_0xa1e8('0x6c')+_0x2b24ac[_0xa1e8('0x25')][_0xa1e8('0x6d')];return db[_0xa1e8('0x7c')][_0xa1e8('0x3e')](_0x9fe95f,{'type':db[_0xa1e8('0x7d')]['QueryTypes'][_0xa1e8('0x7e')],'raw':!![]})[_0xa1e8('0x1f')](function(_0x2e3c1d){return _0x2e3c1d;});})['then'](function(_0x4710d9){if(_0x4710d9){_0x52b4ec['message']['contact']=_0x4710d9[0x0];if(!_0x2efab1['body'][_0xa1e8('0x5e')])return;return db[_0xa1e8('0x70')][_0xa1e8('0x56')]({'where':{'id':_0x2efab1[_0xa1e8('0x55')][_0xa1e8('0x5e')],'role':_0xa1e8('0x5f')},'attributes':['id','name','fullname',_0xa1e8('0x7f'),'internal'],'raw':!![]});}return null;})[_0xa1e8('0x1f')](function(_0x36c1ec){if(!_0x36c1ec)return null;_0x52b4ec[_0xa1e8('0x25')][_0xa1e8('0x5f')]=_0x36c1ec;return _0x52b4ec;})[_0xa1e8('0x1f')](function(_0x3f0302){if(_0x3f0302){_0x3f0302[_0xa1e8('0x25')][_0xa1e8('0x73')]=util[_0xa1e8('0x65')]('SIP/%s',_0x2efab1[_0xa1e8('0x68')][_0xa1e8('0x36')]);_0x3f0302[_0xa1e8('0x25')][_0xa1e8('0x74')]=_0x52b4ec[_0xa1e8('0x74')];_0x3f0302[_0xa1e8('0x25')]['motionChannel']=_0x52b4ec['channel'];_0x3f0302['message'][_0xa1e8('0x80')]='reject';respondWithRpcPromise(_0xa1e8('0x76'),_0xa1e8('0x76'),{'event':_0xa1e8('0x81'),'message':_0x3f0302[_0xa1e8('0x25')]},client9002);return _0x52b4ec;}return null;})[_0xa1e8('0x1f')](respondWithResult(_0x1d089b,null))[_0xa1e8('0x28')](handleError(_0x1d089b,null));}; \ No newline at end of file +var _0xab9f=['map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','describe','../../config/logger','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','channel','motionChannel','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','null','ContactId','contact','internal','SIP/%s','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','name','send'];(function(_0xd60067,_0x54ed68){var _0xdb7f3e=function(_0x252dea){while(--_0x252dea){_0xd60067['push'](_0xd60067['shift']());}};_0xdb7f3e(++_0x54ed68);}(_0xab9f,0x1bd));var _0xfab9=function(_0x2ec073,_0x7f954a){_0x2ec073=_0x2ec073-0x0;var _0x257215=_0xab9f[_0x2ec073];return _0x257215;};'use strict';var emlformat=require(_0xfab9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfab9('0x1'));var jsonpatch=require(_0xfab9('0x2'));var rp=require(_0xfab9('0x3'));var moment=require('moment');var BPromise=require(_0xfab9('0x4'));var Mustache=require(_0xfab9('0x5'));var util=require('util');var path=require(_0xfab9('0x6'));var sox=require('sox');var csv=require(_0xfab9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfab9('0x8'));var _=require(_0xfab9('0x9'));var squel=require(_0xfab9('0xa'));var crypto=require(_0xfab9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfab9('0xc'));var toCsv=require(_0xfab9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfab9('0xd'));var authService=require(_0xfab9('0xe'));var qs=require(_0xfab9('0xf'));var as=require(_0xfab9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfab9('0x11'));var utils=require(_0xfab9('0x12'));var config=require(_0xfab9('0x13'));var licenseUtil=require(_0xfab9('0x14'));var db=require(_0xfab9('0x15'))['db'];config[_0xfab9('0x16')]=_[_0xfab9('0x17')](config[_0xfab9('0x16')],{'host':_0xfab9('0x18'),'port':0x18eb});var socket=require(_0xfab9('0x19'))(new Redis(config['redis']));require(_0xfab9('0x1a'))[_0xfab9('0x1b')](socket);var jayson=require(_0xfab9('0x1c'));var client=jayson[_0xfab9('0x1d')][_0xfab9('0x1e')]({'port':0x232c});var client9002=jayson[_0xfab9('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4213b4,_0x144fe2,_0x30a85a,_0x479db4){return new BPromise(function(_0x4ade7f,_0x27e011){var _0x5a830b=_0x479db4||client;return _0x5a830b[_0xfab9('0x1f')](_0x4213b4,_0x30a85a)[_0xfab9('0x20')](function(_0xca41e){logger[_0xfab9('0x21')](_0xfab9('0x22'),_0x144fe2,'request\x20sent');logger[_0xfab9('0x23')](_0xfab9('0x24'),_0x144fe2,_0xfab9('0x25'),JSON[_0xfab9('0x26')](_0xca41e));if(_0xca41e[_0xfab9('0x27')]){if(_0xca41e[_0xfab9('0x27')][_0xfab9('0x28')]===0x1f4){logger[_0xfab9('0x27')](_0xfab9('0x22'),_0x144fe2,_0xca41e[_0xfab9('0x27')][_0xfab9('0x29')]);return _0x27e011(_0xca41e['error'][_0xfab9('0x29')]);}logger[_0xfab9('0x27')](_0xfab9('0x22'),_0x144fe2,_0xca41e[_0xfab9('0x27')]['message']);return _0x4ade7f(_0xca41e[_0xfab9('0x27')][_0xfab9('0x29')]);}else{logger[_0xfab9('0x21')](_0xfab9('0x22'),_0x144fe2,_0xfab9('0x25'));_0x4ade7f(_0xca41e[_0xfab9('0x2a')][_0xfab9('0x29')]);}})[_0xfab9('0x2b')](function(_0x40e42e){logger[_0xfab9('0x27')](_0xfab9('0x22'),_0x144fe2,_0x40e42e);_0x27e011(_0x40e42e);});});}function respondWithStatusCode(_0x406b96,_0x276b9b){_0x276b9b=_0x276b9b||0xcc;return function(_0x33bb6a){if(_0x33bb6a){return _0x406b96[_0xfab9('0x2c')](_0x276b9b);}return _0x406b96[_0xfab9('0x2d')](_0x276b9b)['end']();};}function respondWithResult(_0x1bb377,_0x40a821){_0x40a821=_0x40a821||0xc8;return function(_0x162020){if(_0x162020){return _0x1bb377[_0xfab9('0x2d')](_0x40a821)['json'](_0x162020);}};}function respondWithFilteredResult(_0x20fe4f,_0x2a6e95){return function(_0x43f44d){if(_0x43f44d){var _0x803cfe=typeof _0x2a6e95[_0xfab9('0x2e')]===_0xfab9('0x2f')&&typeof _0x2a6e95[_0xfab9('0x30')]===_0xfab9('0x2f');var _0x1c9cb5=_0x43f44d[_0xfab9('0x31')];var _0x25aa01=_0x803cfe?0x0:_0x2a6e95[_0xfab9('0x2e')];var _0x3cc50d=_0x803cfe?_0x43f44d[_0xfab9('0x31')]:_0x2a6e95[_0xfab9('0x2e')]+_0x2a6e95[_0xfab9('0x30')];var _0x10cca4;if(_0x3cc50d>=_0x1c9cb5){_0x3cc50d=_0x1c9cb5;_0x10cca4=0xc8;}else{_0x10cca4=0xce;}_0x20fe4f[_0xfab9('0x2d')](_0x10cca4);return _0x20fe4f[_0xfab9('0x32')](_0xfab9('0x33'),_0x25aa01+'-'+_0x3cc50d+'/'+_0x1c9cb5)[_0xfab9('0x34')](_0x43f44d);}return null;};}function patchUpdates(_0x3c7761){return function(_0x1b4c47){try{jsonpatch['apply'](_0x1b4c47,_0x3c7761,!![]);}catch(_0x45a1d2){return BPromise[_0xfab9('0x35')](_0x45a1d2);}return _0x1b4c47[_0xfab9('0x36')]();};}function saveUpdates(_0x1ee945,_0x130ffc){return function(_0x42068a){if(_0x42068a){return _0x42068a[_0xfab9('0x37')](_0x1ee945)[_0xfab9('0x20')](function(_0x2d172a){return _0x2d172a;});}return null;};}function removeEntity(_0x268349,_0x44dd46){return function(_0x3ad7ff){if(_0x3ad7ff){return _0x3ad7ff[_0xfab9('0x38')]()[_0xfab9('0x20')](function(){_0x268349[_0xfab9('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b142,_0x5a7453){return function(_0x4de7c9){if(!_0x4de7c9){_0x25b142['sendStatus'](0x194);}return _0x4de7c9;};}function handleError(_0xfe4003,_0x12ceff){_0x12ceff=_0x12ceff||0x1f4;return function(_0x2b0b77){logger['error'](_0x2b0b77['stack']);if(_0x2b0b77[_0xfab9('0x39')]){delete _0x2b0b77[_0xfab9('0x39')];}_0xfe4003[_0xfab9('0x2d')](_0x12ceff)[_0xfab9('0x3a')](_0x2b0b77);};}exports['index']=function(_0x21bde8,_0x32b1c4){var _0x29c1fa={},_0x2dcc81={},_0x5360ec={'count':0x0,'rows':[]};var _0x37b11a=_[_0xfab9('0x3b')](db[_0xfab9('0x3c')][_0xfab9('0x3d')],function(_0x18eaf8){return{'name':_0x18eaf8[_0xfab9('0x3e')],'type':_0x18eaf8[_0xfab9('0x3f')][_0xfab9('0x40')]};});_0x2dcc81[_0xfab9('0x41')]=_[_0xfab9('0x3b')](_0x37b11a,_0xfab9('0x39'));_0x2dcc81[_0xfab9('0x42')]=_[_0xfab9('0x43')](_0x21bde8[_0xfab9('0x42')]);_0x2dcc81[_0xfab9('0x44')]=_[_0xfab9('0x45')](_0x2dcc81['model'],_0x2dcc81[_0xfab9('0x42')]);_0x29c1fa[_0xfab9('0x46')]=_[_0xfab9('0x45')](_0x2dcc81['model'],qs[_0xfab9('0x47')](_0x21bde8[_0xfab9('0x42')][_0xfab9('0x47')]));_0x29c1fa[_0xfab9('0x46')]=_0x29c1fa[_0xfab9('0x46')][_0xfab9('0x48')]?_0x29c1fa['attributes']:_0x2dcc81[_0xfab9('0x41')];if(!_0x21bde8[_0xfab9('0x42')][_0xfab9('0x49')]('nolimit')){_0x29c1fa[_0xfab9('0x30')]=qs[_0xfab9('0x30')](_0x21bde8[_0xfab9('0x42')][_0xfab9('0x30')]);_0x29c1fa[_0xfab9('0x2e')]=qs[_0xfab9('0x2e')](_0x21bde8[_0xfab9('0x42')][_0xfab9('0x2e')]);}_0x29c1fa[_0xfab9('0x4a')]=qs[_0xfab9('0x4b')](_0x21bde8[_0xfab9('0x42')][_0xfab9('0x4b')]);_0x29c1fa[_0xfab9('0x4c')]=qs[_0xfab9('0x44')](_[_0xfab9('0x4d')](_0x21bde8[_0xfab9('0x42')],_0x2dcc81[_0xfab9('0x44')]),_0x37b11a);if(_0x21bde8['query'][_0xfab9('0x4e')]){_0x29c1fa[_0xfab9('0x4c')]=_[_0xfab9('0x4f')](_0x29c1fa[_0xfab9('0x4c')],{'$or':_[_0xfab9('0x3b')](_0x37b11a,function(_0x469976){if(_0x469976[_0xfab9('0x3f')]!==_0xfab9('0x50')){var _0x324921={};_0x324921[_0x469976[_0xfab9('0x39')]]={'$like':'%'+_0x21bde8[_0xfab9('0x42')][_0xfab9('0x4e')]+'%'};return _0x324921;}})});}_0x29c1fa=_[_0xfab9('0x4f')]({},_0x29c1fa,_0x21bde8[_0xfab9('0x51')]);var _0x4eba38={'where':_0x29c1fa['where']};return db['OpenchannelMessage'][_0xfab9('0x31')](_0x4eba38)[_0xfab9('0x20')](function(_0x10c7f8){_0x5360ec['count']=_0x10c7f8;if(_0x21bde8[_0xfab9('0x42')][_0xfab9('0x52')]){_0x29c1fa[_0xfab9('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xfab9('0x54')](_0x29c1fa);})[_0xfab9('0x20')](function(_0x4c25c3){_0x5360ec[_0xfab9('0x55')]=_0x4c25c3;return _0x5360ec;})[_0xfab9('0x20')](respondWithFilteredResult(_0x32b1c4,_0x29c1fa))[_0xfab9('0x2b')](handleError(_0x32b1c4,null));};exports['show']=function(_0x1eaa8f,_0x148119){var _0x3e848a={'raw':!![],'where':{'id':_0x1eaa8f[_0xfab9('0x56')]['id']}},_0x6dfd04={};_0x6dfd04[_0xfab9('0x41')]=_['keys'](db[_0xfab9('0x3c')][_0xfab9('0x3d')]);_0x6dfd04['query']=_['keys'](_0x1eaa8f[_0xfab9('0x42')]);_0x6dfd04[_0xfab9('0x44')]=_['intersection'](_0x6dfd04[_0xfab9('0x41')],_0x6dfd04['query']);_0x3e848a[_0xfab9('0x46')]=_[_0xfab9('0x45')](_0x6dfd04[_0xfab9('0x41')],qs[_0xfab9('0x47')](_0x1eaa8f[_0xfab9('0x42')][_0xfab9('0x47')]));_0x3e848a[_0xfab9('0x46')]=_0x3e848a['attributes'][_0xfab9('0x48')]?_0x3e848a[_0xfab9('0x46')]:_0x6dfd04['model'];if(_0x1eaa8f[_0xfab9('0x42')]['includeAll']){_0x3e848a[_0xfab9('0x53')]=[{'all':!![]}];}_0x3e848a=_[_0xfab9('0x4f')]({},_0x3e848a,_0x1eaa8f[_0xfab9('0x51')]);return db[_0xfab9('0x3c')][_0xfab9('0x57')](_0x3e848a)['then'](handleEntityNotFound(_0x148119,null))['then'](respondWithResult(_0x148119,null))[_0xfab9('0x2b')](handleError(_0x148119,null));};exports[_0xfab9('0x58')]=function(_0x122c23,_0x215df1){return db[_0xfab9('0x3c')][_0xfab9('0x58')](_0x122c23[_0xfab9('0x59')],{})[_0xfab9('0x20')](respondWithResult(_0x215df1,0xc9))[_0xfab9('0x2b')](handleError(_0x215df1,null));};exports[_0xfab9('0x37')]=function(_0x3b1f15,_0x1a6fc4){if(_0x3b1f15['body']['id']){delete _0x3b1f15[_0xfab9('0x59')]['id'];}return db[_0xfab9('0x3c')][_0xfab9('0x57')]({'where':{'id':_0x3b1f15[_0xfab9('0x56')]['id']}})[_0xfab9('0x20')](handleEntityNotFound(_0x1a6fc4,null))[_0xfab9('0x20')](saveUpdates(_0x3b1f15[_0xfab9('0x59')],null))[_0xfab9('0x20')](respondWithResult(_0x1a6fc4,null))[_0xfab9('0x2b')](handleError(_0x1a6fc4,null));};exports[_0xfab9('0x38')]=function(_0x3bc202,_0xfc22cc){return db['OpenchannelMessage']['find']({'where':{'id':_0x3bc202['params']['id']}})[_0xfab9('0x20')](handleEntityNotFound(_0xfc22cc,null))[_0xfab9('0x20')](removeEntity(_0xfc22cc,null))[_0xfab9('0x2b')](handleError(_0xfc22cc,null));};exports[_0xfab9('0x5a')]=function(_0x942a14,_0x6a1c2c){return db[_0xfab9('0x3c')][_0xfab9('0x5a')]()[_0xfab9('0x20')](respondWithResult(_0x6a1c2c,null))[_0xfab9('0x2b')](handleError(_0x6a1c2c,null));};var interaction_log=require(_0xfab9('0x5b'))('openchannel-interactions');exports[_0xfab9('0x5c')]=function(_0x14b8dc,_0x5011a0,_0x376fbf){var _0x17114b={'agent':{},'channel':_0xfab9('0x5d')};if(_0x14b8dc['body']['id']){delete _0x14b8dc[_0xfab9('0x59')]['id'];}_0x14b8dc['body'][_0xfab9('0x5e')]=!![];_0x14b8dc[_0xfab9('0x59')][_0xfab9('0x5f')]=moment()[_0xfab9('0x60')](_0xfab9('0x61'));_0x14b8dc['body'][_0xfab9('0x62')]=_0x14b8dc[_0xfab9('0x59')][_0xfab9('0x62')]||_0x14b8dc[_0xfab9('0x63')]['id'];_0x17114b[_0xfab9('0x64')]['id']=_0x14b8dc[_0xfab9('0x59')][_0xfab9('0x62')];return db[_0xfab9('0x3c')]['find']({'where':{'id':_0x14b8dc['params']['id'],'UserId':null}})[_0xfab9('0x20')](handleEntityNotFound(_0x5011a0,null))[_0xfab9('0x20')](saveUpdates(_0x14b8dc[_0xfab9('0x59')],null))[_0xfab9('0x20')](function(_0x465238){if(_0x465238){_0x17114b['message']=_0x465238['get']({'plain':!![]});return db[_0xfab9('0x65')]['find']({'where':{'id':_0x465238['OpenchannelInteractionId']}});}return null;})[_0xfab9('0x20')](handleEntityNotFound(_0x5011a0,null))[_0xfab9('0x20')](function(_0x334d0b){if(_0x334d0b){return _0x334d0b[_0xfab9('0x37')]({'UserId':_0x14b8dc[_0xfab9('0x59')][_0xfab9('0x62')],'read1stAt':_['isNil'](_0x334d0b['read1stAt'])?moment()[_0xfab9('0x60')](_0xfab9('0x61')):undefined});}return null;})['then'](function(_0x266b63){if(_0x266b63){_0x17114b[_0xfab9('0x66')]=_0x266b63[_0xfab9('0x67')]({'plain':!![]});interaction_log[_0xfab9('0x21')](_0xfab9('0x68'),_0x14b8dc[_0xfab9('0x63')]['id'],_0x14b8dc[_0xfab9('0x63')]['name'],_0x14b8dc[_0xfab9('0x63')][_0xfab9('0x69')],_0x17114b['interaction']['id'],_0x14b8dc[_0xfab9('0x59')]?JSON[_0xfab9('0x26')](_0x14b8dc['body']):'null');return respondWithRpcPromise(_0xfab9('0x6a'),_0xfab9('0x6b'),_0x17114b);}return null;})[_0xfab9('0x20')](function(_0x578892){var _0x25c083=_0xfab9('0x6c')+_0x578892[_0xfab9('0x29')]['ContactId'];return db[_0xfab9('0x6d')][_0xfab9('0x42')](_0x25c083,{'type':db[_0xfab9('0x6e')][_0xfab9('0x6f')][_0xfab9('0x70')],'raw':!![]})['then'](function(_0x202136){return _0x202136;});})[_0xfab9('0x20')](function(_0x1dad5f){if(_0x1dad5f){_0x17114b[_0xfab9('0x29')]['contact']=_0x1dad5f[0x0];if(!_0x14b8dc[_0xfab9('0x59')]['UserId'])return;return db[_0xfab9('0x71')]['find']({'where':{'id':_0x14b8dc[_0xfab9('0x59')]['UserId'],'role':_0xfab9('0x64')},'attributes':['id',_0xfab9('0x39'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x3e466c){if(!_0x3e466c)return null;_0x17114b['message'][_0xfab9('0x64')]=_0x3e466c;return _0x17114b;})[_0xfab9('0x20')](function(_0x581da4){if(_0x581da4){if(_0x14b8dc[_0xfab9('0x59')]['manual']){_0x17114b[_0xfab9('0x29')]['interface']=util[_0xfab9('0x60')]('SIP/%s',_0x14b8dc[_0xfab9('0x63')][_0xfab9('0x39')]);_0x17114b[_0xfab9('0x29')][_0xfab9('0x72')]=_0x17114b[_0xfab9('0x72')];_0x17114b[_0xfab9('0x29')][_0xfab9('0x73')]=_0x17114b[_0xfab9('0x72')];_0x17114b[_0xfab9('0x29')]['event']='accept';return respondWithRpcPromise(_0xfab9('0x74'),'EventManager',{'event':_0xfab9('0x75'),'message':_0x17114b['message']},client9002)[_0xfab9('0x20')](function(){return _0x17114b;});}return _0x17114b;}return null;})[_0xfab9('0x20')](respondWithResult(_0x5011a0,null))[_0xfab9('0x2b')](handleError(_0x5011a0,null));};var interaction_log=require(_0xfab9('0x5b'))(_0xfab9('0x76'));exports[_0xfab9('0x35')]=function(_0x14de5e,_0x1f356c,_0x4f8f95){var _0x57ee69={'agent':{},'channel':'openchannel'};if(_0x14de5e[_0xfab9('0x59')]['id']){delete _0x14de5e['body']['id'];}_0x14de5e[_0xfab9('0x59')]['UserId']=_0x14de5e['body'][_0xfab9('0x62')]||_0x14de5e[_0xfab9('0x63')]['id'];_0x57ee69[_0xfab9('0x64')]['id']=_0x14de5e[_0xfab9('0x59')]['UserId'];return db[_0xfab9('0x3c')][_0xfab9('0x57')]({'where':{'id':_0x14de5e['params']['id'],'UserId':null}})[_0xfab9('0x20')](handleEntityNotFound(_0x1f356c,null))[_0xfab9('0x20')](function(_0x8ac990){if(_0x8ac990){_0x57ee69['message']=_0x8ac990[_0xfab9('0x67')]({'plain':!![]});return db[_0xfab9('0x65')][_0xfab9('0x57')]({'where':{'id':_0x8ac990[_0xfab9('0x77')]}});}return null;})[_0xfab9('0x20')](handleEntityNotFound(_0x1f356c,null))[_0xfab9('0x20')](function(_0xe18799){if(_0xe18799){_0x57ee69[_0xfab9('0x66')]=_0xe18799[_0xfab9('0x67')]({'plain':!![]});interaction_log[_0xfab9('0x21')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x14de5e[_0xfab9('0x63')]['id'],_0x14de5e[_0xfab9('0x63')][_0xfab9('0x39')],_0x14de5e[_0xfab9('0x63')]['role'],_0x57ee69[_0xfab9('0x66')]['id'],_0x14de5e[_0xfab9('0x59')]?JSON[_0xfab9('0x26')](_0x14de5e[_0xfab9('0x59')]):_0xfab9('0x78'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x57ee69);}return null;})[_0xfab9('0x20')](function(_0xab7314){var _0x482521='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xab7314['message'][_0xfab9('0x79')];return db[_0xfab9('0x6d')][_0xfab9('0x42')](_0x482521,{'type':db[_0xfab9('0x6e')]['QueryTypes'][_0xfab9('0x70')],'raw':!![]})[_0xfab9('0x20')](function(_0x24b2f5){return _0x24b2f5;});})[_0xfab9('0x20')](function(_0x4fc611){if(_0x4fc611){_0x57ee69[_0xfab9('0x29')][_0xfab9('0x7a')]=_0x4fc611[0x0];if(!_0x14de5e[_0xfab9('0x59')]['UserId'])return;return db[_0xfab9('0x71')][_0xfab9('0x57')]({'where':{'id':_0x14de5e[_0xfab9('0x59')]['UserId'],'role':'agent'},'attributes':['id',_0xfab9('0x39'),'fullname','email',_0xfab9('0x7b')],'raw':!![]});}return null;})[_0xfab9('0x20')](function(_0x23cf44){if(!_0x23cf44)return null;_0x57ee69[_0xfab9('0x29')]['agent']=_0x23cf44;return _0x57ee69;})[_0xfab9('0x20')](function(_0x34017b){if(_0x34017b){_0x34017b[_0xfab9('0x29')]['interface']=util[_0xfab9('0x60')](_0xfab9('0x7c'),_0x14de5e[_0xfab9('0x63')][_0xfab9('0x39')]);_0x34017b[_0xfab9('0x29')][_0xfab9('0x72')]=_0x57ee69[_0xfab9('0x72')];_0x34017b[_0xfab9('0x29')]['motionChannel']=_0x57ee69['channel'];_0x34017b[_0xfab9('0x29')]['event']=_0xfab9('0x35');respondWithRpcPromise(_0xfab9('0x74'),_0xfab9('0x74'),{'event':_0xfab9('0x7d'),'message':_0x34017b[_0xfab9('0x29')]},client9002);return _0x57ee69;}return null;})['then'](respondWithResult(_0x1f356c,null))[_0xfab9('0x2b')](handleError(_0x1f356c,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c848e86..6758025 100644 --- a/server/api/openchannelMessage/openchannelMessage.events.js +++ b/server/api/openchannelMessage/openchannelMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf314=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xf314,0x18f));var _0x4f31=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xf314[_0x42245d];return _0x4b211a;};'use strict';var EventEmitter=require(_0x4f31('0x0'));var OpenchannelMessage=require(_0x4f31('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x4f31('0x2')](0x0);var events={'afterCreate':_0x4f31('0x3'),'afterUpdate':_0x4f31('0x4'),'afterDestroy':_0x4f31('0x5')};function emitEvent(_0x290661){return function(_0x3b1232,_0x1620a5,_0x4b7828){OpenchannelMessageEvents[_0x4f31('0x6')](_0x290661+':'+_0x3b1232['id'],_0x3b1232);OpenchannelMessageEvents[_0x4f31('0x6')](_0x290661,_0x3b1232);_0x4b7828(null);};}for(var e in events){if(events[_0x4f31('0x7')](e)){var event=events[e];OpenchannelMessage[_0x4f31('0x8')](e,emitEvent(event));}}module[_0x4f31('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x49dc=['hasOwnProperty','hook','events','OpenchannelMessage','save','emit'];(function(_0x2c7ff6,_0x5b2555){var _0xbb1d41=function(_0xc20b37){while(--_0xc20b37){_0x2c7ff6['push'](_0x2c7ff6['shift']());}};_0xbb1d41(++_0x5b2555);}(_0x49dc,0x1ee));var _0xc49d=function(_0x853bbd,_0x1bb105){_0x853bbd=_0x853bbd-0x0;var _0x2c1a0f=_0x49dc[_0x853bbd];return _0x2c1a0f;};'use strict';var EventEmitter=require(_0xc49d('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xc49d('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc49d('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xca68ae){return function(_0x340be3,_0x58c368,_0x420e85){OpenchannelMessageEvents['emit'](_0xca68ae+':'+_0x340be3['id'],_0x340be3);OpenchannelMessageEvents[_0xc49d('0x3')](_0xca68ae,_0x340be3);_0x420e85(null);};}for(var e in events){if(events[_0xc49d('0x4')](e)){var event=events[e];OpenchannelMessage[_0xc49d('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 03d371f..8a52949 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb62e=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','then','update','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Interactions','GET','POST','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect'];(function(_0x2489b0,_0x4cd6e2){var _0x5bcb2d=function(_0xd4cae7){while(--_0xd4cae7){_0x2489b0['push'](_0x2489b0['shift']());}};_0x5bcb2d(++_0x4cd6e2);}(_0xb62e,0x1de));var _0xeb62=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb62e[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var fs=require('fs');var path=require(_0xeb62('0x6'));var rimraf=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var attributes=require(_0xeb62('0x9'));module['exports']=function(_0x3ec879,_0x455e1a){return _0x3ec879[_0xeb62('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xeb62('0xb'),'paranoid':![],'indexes':[{'name':_0xeb62('0xc'),'fields':[_0xeb62('0xd')],'type':_0xeb62('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4967c0,_0x5cdef3,_0x4693c9){var _0x40584b=_0x3ec879[_0xeb62('0xf')];var _0xf93c21=_0x4967c0[_0xeb62('0x10')]({'plain':!![]});if(_0xf93c21[_0xeb62('0x11')][_0xeb62('0x12')]()==='in'||_0xf93c21[_0xeb62('0x11')][_0xeb62('0x12')]()===_0xeb62('0x13')&&!_0xf93c21['secret']&&!_[_0xeb62('0x14')](_0xf93c21[_0xeb62('0x15')])){_0x40584b[_0xeb62('0x16')][_0xeb62('0x17')]({'where':{'id':_0xf93c21['OpenchannelInteractionId']}})[_0xeb62('0x18')](function(_0x2fbad2){if(_0x2fbad2){_0x2fbad2[_0xeb62('0x19')]({'lastMsgAt':_0xf93c21['createdAt'],'lastMsgDirection':_0xf93c21[_0xeb62('0x11')][_0xeb62('0x12')]()});}})[_0xeb62('0x1a')](function(_0x4ce9fa){console[_0xeb62('0x1b')](_0x4ce9fa);});}if(_0xf93c21[_0xeb62('0x11')]===_0xeb62('0x13')&&!_0xf93c21[_0xeb62('0x1c')]){var _0x3fb280;_0x40584b[_0xeb62('0x1d')][_0xeb62('0x1e')]()[_0xeb62('0x18')](function(_0x39b138){return _0x40584b[_0xeb62('0x1f')][_0xeb62('0x20')]({'where':{'id':_0xf93c21[_0xeb62('0x21')]},'include':[{'model':_0x40584b[_0xeb62('0x16')],'as':'Interactions','where':{'id':_0xf93c21[_0xeb62('0x22')]},'limit':0x1,'include':[{'model':_0x40584b[_0xeb62('0x1d')],'as':_0xeb62('0x23'),'attributes':_[_0xeb62('0x24')](_0x39b138)}]}]});})[_0xeb62('0x18')](function(_0x24cbf3){_0x3fb280=_0x24cbf3[_0xeb62('0x10')]({'plain':!![]});if(_0x3fb280&&_0x3fb280['replyUri']){logger['info'](_0xeb62('0x25'),_0xeb62('0x26'),util[_0xeb62('0x27')](_0xeb62('0x28'),_0xf93c21['id'],_0x3fb280[_0xeb62('0x29')]));if(_0x3fb280['Interactions']&&_0x3fb280['Interactions'][_0xeb62('0x2a')]){_0xf93c21[_0xeb62('0x2b')]=_[_0xeb62('0x2c')](_0x3fb280[_0xeb62('0x2d')][0x0],'Contact');_0xf93c21['Contact']=_0x3fb280[_0xeb62('0x2d')][0x0]['Contact'];}var _0x5cdef3={'method':'POST','uri':encodeURI(_0x3fb280[_0xeb62('0x29')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5cdef3['method']){case _0xeb62('0x2e'):_0x5cdef3['qs']=_0xf93c21;break;case _0xeb62('0x2f'):_0x5cdef3[_0xeb62('0xd')]=_0xf93c21;break;}return rp(_0x5cdef3)['then'](function(_0x3ef784){logger[_0xeb62('0x30')](_0xeb62('0x25'),_0xeb62('0x26'),util[_0xeb62('0x27')](_0xeb62('0x31'),_0xf93c21['id'],_0x3fb280['replyUri']));if(_0x3ef784[_0xeb62('0xd')][_0xeb62('0x32')]&&_0x3ef784['body'][_0xeb62('0x32')]!=_0xf93c21[_0xeb62('0x2b')][_0xeb62('0x32')]){return _0x40584b[_0xeb62('0x16')][_0xeb62('0x19')]({'threadId':_0x3ef784['body']['threadId']},{'logging':!![],'where':{'id':_0xf93c21[_0xeb62('0x2b')]['id']}});}else{return;}})[_0xeb62('0x18')](function(){return _0x4967c0[_0xeb62('0x19')]({'read':!![]});})[_0xeb62('0x1a')](function(_0x42b197){logger[_0xeb62('0x1b')](_0xeb62('0x25'),'afterCreate',util[_0xeb62('0x33')](_0x42b197,{'showHidden':![],'depth':null}));_0x4693c9();});}else{_0x4693c9();}})['finally'](function(){_0x4693c9();});}else{_0x4693c9();}}},'charset':'utf8mb4','collate':_0xeb62('0x34')});}; \ No newline at end of file +var _0x34b7=['moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x34b7,0x196));var _0x734b=function(_0x158f5a,_0xaacc25){_0x158f5a=_0x158f5a-0x0;var _0xb3722e=_0x34b7[_0x158f5a];return _0xb3722e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x734b('0x0'))(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var BPromise=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var fs=require('fs');var path=require(_0x734b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x734b('0x6'));module[_0x734b('0x7')]=function(_0x2f3128,_0x34fd70){return _0x2f3128[_0x734b('0x8')](_0x734b('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x734b('0xa'),'fields':[_0x734b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53f163,_0x5f4b3a,_0x19a88e){var _0x598dee=_0x2f3128[_0x734b('0xc')];var _0x333738=_0x53f163[_0x734b('0xd')]({'plain':!![]});if(_0x333738[_0x734b('0xe')][_0x734b('0xf')]()==='in'||_0x333738[_0x734b('0xe')][_0x734b('0xf')]()===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]&&!_[_0x734b('0x12')](_0x333738[_0x734b('0x13')])){_0x598dee[_0x734b('0x14')][_0x734b('0x15')]({'where':{'id':_0x333738[_0x734b('0x16')]}})['then'](function(_0x18fc18){if(_0x18fc18){_0x18fc18[_0x734b('0x17')]({'lastMsgAt':_0x333738[_0x734b('0x18')],'lastMsgDirection':_0x333738[_0x734b('0xe')][_0x734b('0xf')]()});}})[_0x734b('0x19')](function(_0x2372bd){console[_0x734b('0x1a')](_0x2372bd);});}if(_0x333738[_0x734b('0xe')]===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]){var _0x4d2d23;_0x598dee[_0x734b('0x1b')][_0x734b('0x1c')]()[_0x734b('0x1d')](function(_0x5edbe9){return _0x598dee['OpenchannelAccount']['find']({'where':{'id':_0x333738[_0x734b('0x1e')]},'include':[{'model':_0x598dee[_0x734b('0x14')],'as':_0x734b('0x1f'),'where':{'id':_0x333738[_0x734b('0x16')]},'limit':0x1,'include':[{'model':_0x598dee[_0x734b('0x1b')],'as':_0x734b('0x20'),'attributes':_[_0x734b('0x21')](_0x5edbe9)}]}]});})[_0x734b('0x1d')](function(_0x67eed){_0x4d2d23=_0x67eed[_0x734b('0xd')]({'plain':!![]});if(_0x4d2d23&&_0x4d2d23[_0x734b('0x22')]){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util['format'](_0x734b('0x26'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x4d2d23['Interactions']&&_0x4d2d23[_0x734b('0x1f')][_0x734b('0x27')]){_0x333738[_0x734b('0x28')]=_[_0x734b('0x29')](_0x4d2d23[_0x734b('0x1f')][0x0],_0x734b('0x20'));_0x333738[_0x734b('0x20')]=_0x4d2d23[_0x734b('0x1f')][0x0][_0x734b('0x20')];}var _0x5f4b3a={'method':_0x734b('0x2a'),'uri':encodeURI(_0x4d2d23[_0x734b('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5f4b3a[_0x734b('0x2b')]){case'GET':_0x5f4b3a['qs']=_0x333738;break;case'POST':_0x5f4b3a[_0x734b('0xb')]=_0x333738;break;}return rp(_0x5f4b3a)[_0x734b('0x1d')](function(_0x47a0a9){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2c')](_0x734b('0x2d'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x47a0a9[_0x734b('0xb')]['threadId']&&_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]!=_0x333738[_0x734b('0x28')][_0x734b('0x2e')]){return _0x598dee[_0x734b('0x14')][_0x734b('0x17')]({'threadId':_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]},{'logging':!![],'where':{'id':_0x333738[_0x734b('0x28')]['id']}});}else{return;}})[_0x734b('0x1d')](function(){return _0x53f163['update']({'read':!![]});})[_0x734b('0x19')](function(_0x37f1a1){logger['error'](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2f')](_0x37f1a1,{'showHidden':![],'depth':null}));_0x19a88e();});}else{_0x19a88e();}})[_0x734b('0x30')](function(){_0x19a88e();});}else{_0x19a88e();}}},'charset':_0x734b('0x31'),'collate':_0x734b('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index d252b58..ad7d54d 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4b685c,_0x15f705){var _0x27d2fb=function(_0x471c44){while(--_0x471c44){_0x4b685c['push'](_0x4b685c['shift']());}};_0x27d2fb(++_0x15f705);}(_0x7a54,0x106));var _0x47a5=function(_0x322e19,_0x5adbe3){_0x322e19=_0x322e19-0x0;var _0x5ac228=_0x7a54[_0x322e19];return _0x5ac228;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x161846,_0x2ade6d){var _0x4141c1=function(_0x70cdfb){while(--_0x70cdfb){_0x161846['push'](_0x161846['shift']());}};_0x4141c1(++_0x2ade6d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 1482b4b..2eb36f9 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f2f=['length','openchannelMessage:','save','remove','emit','removeListener'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x7f2f,0x11c));var _0xf7f2=function(_0x3018fb,_0x507e28){_0x3018fb=_0x3018fb-0x0;var _0x557c8c=_0x7f2f[_0x3018fb];return _0x557c8c;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xf7f2('0x0'),_0xf7f2('0x1'),'update'];function createListener(_0xbc06c1,_0x433a4b){return function(_0x2e1189){_0x433a4b[_0xf7f2('0x2')](_0xbc06c1,_0x2e1189);};}function removeListener(_0xb09d0c,_0x4a5aa5){return function(){OpenchannelMessageEvents[_0xf7f2('0x3')](_0xb09d0c,_0x4a5aa5);};}exports['register']=function(_0x137d16){for(var _0x1ae289=0x0,_0x57ab63=events[_0xf7f2('0x4')];_0x1ae289<_0x57ab63;_0x1ae289++){var _0x30b018=events[_0x1ae289];var _0x3985a8=createListener(_0xf7f2('0x5')+_0x30b018,_0x137d16);OpenchannelMessageEvents['on'](_0x30b018,_0x3985a8);}}; \ No newline at end of file +var _0xfcfc=['register','length','openchannelMessage:','save','remove','update'];(function(_0xe66628,_0x579c0f){var _0x5a9678=function(_0x436f3f){while(--_0x436f3f){_0xe66628['push'](_0xe66628['shift']());}};_0x5a9678(++_0x579c0f);}(_0xfcfc,0xf9));var _0xcfcf=function(_0x1613fb,_0x213a3d){_0x1613fb=_0x1613fb-0x0;var _0x19b2fe=_0xfcfc[_0x1613fb];return _0x19b2fe;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xcfcf('0x0'),_0xcfcf('0x1'),_0xcfcf('0x2')];function createListener(_0xf5347,_0x497abd){return function(_0x579265){_0x497abd['emit'](_0xf5347,_0x579265);};}function removeListener(_0x291517,_0x391eab){return function(){OpenchannelMessageEvents['removeListener'](_0x291517,_0x391eab);};}exports[_0xcfcf('0x3')]=function(_0x192a69){for(var _0x39cfea=0x0,_0x13d2a8=events[_0xcfcf('0x4')];_0x39cfea<_0x13d2a8;_0x39cfea++){var _0xf42453=events[_0x39cfea];var _0x50aaab=createListener(_0xcfcf('0x5')+_0xf42453,_0x192a69);OpenchannelMessageEvents['on'](_0xf42453,_0x50aaab);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 7523157..e8f32b8 100644 --- a/server/api/openchannelQueue/index.js +++ b/server/api/openchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24e3=['/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0x24e3,0x194));var _0x324e=function(_0xeeef1b,_0x1def09){_0xeeef1b=_0xeeef1b-0x0;var _0x55be6d=_0x24e3[_0xeeef1b];return _0x55be6d;};'use strict';var multer=require(_0x324e('0x0'));var util=require(_0x324e('0x1'));var path=require(_0x324e('0x2'));var timeout=require(_0x324e('0x3'));var express=require(_0x324e('0x4'));var router=express[_0x324e('0x5')]();var fs_extra=require(_0x324e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x324e('0x7'));var controller=require('./openchannelQueue.controller');router[_0x324e('0x8')]('/',auth[_0x324e('0x9')](),controller['index']);router[_0x324e('0x8')](_0x324e('0xa'),auth['isAuthenticated'](),controller[_0x324e('0xb')]);router[_0x324e('0x8')](_0x324e('0xc'),auth[_0x324e('0x9')](),controller[_0x324e('0xd')]);router['get']('/:id/members',auth[_0x324e('0x9')](),controller[_0x324e('0xe')]);router[_0x324e('0x8')](_0x324e('0xf'),auth[_0x324e('0x9')](),controller[_0x324e('0x10')]);router['get'](_0x324e('0x11'),auth[_0x324e('0x9')](),controller[_0x324e('0x12')]);router[_0x324e('0x13')]('/',auth[_0x324e('0x9')](),controller[_0x324e('0x14')]);router['post'](_0x324e('0xf'),auth[_0x324e('0x9')](),controller[_0x324e('0x15')]);router[_0x324e('0x13')](_0x324e('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x324e('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x324e('0x17')](_0x324e('0xc'),auth[_0x324e('0x9')](),controller[_0x324e('0x18')]);router['delete'](_0x324e('0xf'),auth[_0x324e('0x9')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x324e('0x9')](),controller['removeAgents']);module[_0x324e('0x19')]=router; \ No newline at end of file +var _0xc8e9=['update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put'];(function(_0x2c40b1,_0xb58d65){var _0x596aa9=function(_0xf363cf){while(--_0xf363cf){_0x2c40b1['push'](_0x2c40b1['shift']());}};_0x596aa9(++_0xb58d65);}(_0xc8e9,0x1b9));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9c8e('0x0'));var util=require(_0x9c8e('0x1'));var path=require(_0x9c8e('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c8e('0x3'));var router=express[_0x9c8e('0x4')]();var fs_extra=require(_0x9c8e('0x5'));var auth=require(_0x9c8e('0x6'));var interaction=require(_0x9c8e('0x7'));var config=require('../../config/environment');var controller=require(_0x9c8e('0x8'));router[_0x9c8e('0x9')]('/',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0xb')]);router[_0x9c8e('0x9')](_0x9c8e('0xc'),auth['isAuthenticated'](),controller[_0x9c8e('0xd')]);router[_0x9c8e('0x9')]('/:id',auth[_0x9c8e('0xa')](),controller['show']);router['get']('/:id/members',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0xe')]);router[_0x9c8e('0x9')](_0x9c8e('0xf'),auth[_0x9c8e('0xa')](),controller['getTeams']);router[_0x9c8e('0x9')](_0x9c8e('0x10'),auth['isAuthenticated'](),controller[_0x9c8e('0x11')]);router[_0x9c8e('0x12')]('/',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0x13')]);router[_0x9c8e('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9c8e('0x14')]);router[_0x9c8e('0x12')]('/:id/users',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0x15')]);router[_0x9c8e('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x9c8e('0x17')]);router['delete']('/:id',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0x18')]);router[_0x9c8e('0x19')]('/:id/teams',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0x1a')]);router['delete'](_0x9c8e('0x10'),auth[_0x9c8e('0xa')](),controller[_0x9c8e('0x1b')]);module[_0x9c8e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index e3d51fa..b4e0324 100644 --- a/server/api/openchannelQueue/openchannelQueue.attributes.js +++ b/server/api/openchannelQueue/openchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29fe=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x29fe,0xd5));var _0xe29f=function(_0x577db4,_0x19b893){_0x577db4=_0x577db4-0x0;var _0x953a28=_0x29fe[_0x577db4];return _0x953a28;};'use strict';var Sequelize=require(_0xe29f('0x0'));module[_0xe29f('0x1')]={'name':{'type':Sequelize[_0xe29f('0x2')],'unique':_0xe29f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe29f('0x4')]('rrmemory',_0xe29f('0x5'),_0xe29f('0x6'))}}; \ No newline at end of file +var _0x7c59=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x22a55d,_0x4556ae){var _0x2b2f20=function(_0x21a6fc){while(--_0x21a6fc){_0x22a55d['push'](_0x22a55d['shift']());}};_0x2b2f20(++_0x4556ae);}(_0x7c59,0x195));var _0x97c5=function(_0x22eb8f,_0x31401e){_0x22eb8f=_0x22eb8f-0x0;var _0x445848=_0x7c59[_0x22eb8f];return _0x445848;};'use strict';var Sequelize=require('sequelize');module[_0x97c5('0x0')]={'name':{'type':Sequelize[_0x97c5('0x1')],'unique':_0x97c5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97c5('0x1')]},'timeout':{'type':Sequelize[_0x97c5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x97c5('0x4'),_0x97c5('0x5'),_0x97c5('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index cd3deb6..390d158 100644 --- a/server/api/openchannelQueue/openchannelQueue.controller.js +++ b/server/api/openchannelQueue/openchannelQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c5f=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','OpenchannelQueues','name','send','index','OpenchannelQueue','fieldName','key','map','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','intersection','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','create','error','find','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','Agents','online','flatMap','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','all','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','lodash','crypto','jsforce','querystring'];(function(_0x1308ec,_0x32c99e){var _0x1a43c8=function(_0x18ff62){while(--_0x18ff62){_0x1308ec['push'](_0x1308ec['shift']());}};_0x1a43c8(++_0x32c99e);}(_0x3c5f,0x18c));var _0xf3c5=function(_0x403b41,_0x37372a){_0x403b41=_0x403b41-0x0;var _0x40ed87=_0x3c5f[_0x403b41];return _0x40ed87;};'use strict';var emlformat=require(_0xf3c5('0x0'));var rimraf=require(_0xf3c5('0x1'));var zipdir=require(_0xf3c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3c5('0x3'));var moment=require(_0xf3c5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf3c5('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf3c5('0x6'));var csv=require(_0xf3c5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf3c5('0x8'));var squel=require('squel');var crypto=require(_0xf3c5('0x9'));var jsforce=require(_0xf3c5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf3c5('0x7'));var querystring=require(_0xf3c5('0xb'));var Papa=require(_0xf3c5('0xc'));var Redis=require(_0xf3c5('0xd'));var authService=require(_0xf3c5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf3c5('0xf'));var hardwareService=require(_0xf3c5('0x10'));var logger=require(_0xf3c5('0x11'))(_0xf3c5('0x12'));var utils=require(_0xf3c5('0x13'));var config=require(_0xf3c5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf3c5('0x15'))['db'];config[_0xf3c5('0x16')]=_[_0xf3c5('0x17')](config[_0xf3c5('0x16')],{'host':_0xf3c5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3c5('0x16')]));require(_0xf3c5('0x19'))['register'](socket);function respondWithStatusCode(_0x239e9f,_0x3f4f1a){_0x3f4f1a=_0x3f4f1a||0xcc;return function(_0x17fa92){if(_0x17fa92){return _0x239e9f[_0xf3c5('0x1a')](_0x3f4f1a);}return _0x239e9f[_0xf3c5('0x1b')](_0x3f4f1a)[_0xf3c5('0x1c')]();};}function respondWithResult(_0x3461f9,_0x399a52){_0x399a52=_0x399a52||0xc8;return function(_0x2603ce){if(_0x2603ce){return _0x3461f9[_0xf3c5('0x1b')](_0x399a52)[_0xf3c5('0x1d')](_0x2603ce);}};}function respondWithFilteredResult(_0x27cae5,_0x5349a8){return function(_0x5e90e1){if(_0x5e90e1){var _0x299ae9=typeof _0x5349a8[_0xf3c5('0x1e')]===_0xf3c5('0x1f')&&typeof _0x5349a8['limit']===_0xf3c5('0x1f');var _0xc11cd8=_0x5e90e1[_0xf3c5('0x20')];var _0x28cc9e=_0x299ae9?0x0:_0x5349a8[_0xf3c5('0x1e')];var _0x53ac68=_0x299ae9?_0x5e90e1[_0xf3c5('0x20')]:_0x5349a8['offset']+_0x5349a8[_0xf3c5('0x21')];var _0x142a30;if(_0x53ac68>=_0xc11cd8){_0x53ac68=_0xc11cd8;_0x142a30=0xc8;}else{_0x142a30=0xce;}_0x27cae5[_0xf3c5('0x1b')](_0x142a30);return _0x27cae5[_0xf3c5('0x22')]('Content-Range',_0x28cc9e+'-'+_0x53ac68+'/'+_0xc11cd8)[_0xf3c5('0x1d')](_0x5e90e1);}return null;};}function patchUpdates(_0x18ea62){return function(_0x8c9499){try{jsonpatch[_0xf3c5('0x23')](_0x8c9499,_0x18ea62,!![]);}catch(_0x526346){return BPromise[_0xf3c5('0x24')](_0x526346);}return _0x8c9499[_0xf3c5('0x25')]();};}function saveUpdates(_0x5cef3f,_0x1fc2af){return function(_0x4b2825){if(_0x4b2825){return _0x4b2825[_0xf3c5('0x26')](_0x5cef3f)[_0xf3c5('0x27')](function(_0xebc376){return _0xebc376;});}return null;};}function removeEntity(_0x295464,_0x2aa217){return function(_0x3ade7e){if(_0x3ade7e){return _0x3ade7e[_0xf3c5('0x28')]()[_0xf3c5('0x27')](function(){var _0x51917d=_0x3ade7e[_0xf3c5('0x29')]({'plain':!![]});var _0x339d7c=_0xf3c5('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x339d7c,'resourceId':_0x51917d['id']}})[_0xf3c5('0x27')](function(){return _0x3ade7e;});})[_0xf3c5('0x27')](function(){_0x295464[_0xf3c5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15f39f,_0x59b383){return function(_0x51a94b){if(!_0x51a94b){_0x15f39f[_0xf3c5('0x1a')](0x194);}return _0x51a94b;};}function handleError(_0x4b46ba,_0x31bb15){_0x31bb15=_0x31bb15||0x1f4;return function(_0x57d493){logger['error'](_0x57d493['stack']);if(_0x57d493[_0xf3c5('0x2b')]){delete _0x57d493[_0xf3c5('0x2b')];}_0x4b46ba[_0xf3c5('0x1b')](_0x31bb15)[_0xf3c5('0x2c')](_0x57d493);};}exports[_0xf3c5('0x2d')]=function(_0xbdca3,_0x5146e3){var _0x2b5d3d={},_0x60543e={},_0xd84b76={'count':0x0,'rows':[]};var _0x42a206=_['map'](db[_0xf3c5('0x2e')]['rawAttributes'],function(_0x4c177c){return{'name':_0x4c177c[_0xf3c5('0x2f')],'type':_0x4c177c['type'][_0xf3c5('0x30')]};});_0x60543e['model']=_[_0xf3c5('0x31')](_0x42a206,'name');_0x60543e[_0xf3c5('0x32')]=_[_0xf3c5('0x33')](_0xbdca3['query']);_0x60543e['filters']=_['intersection'](_0x60543e[_0xf3c5('0x34')],_0x60543e[_0xf3c5('0x32')]);_0x2b5d3d[_0xf3c5('0x35')]=_['intersection'](_0x60543e[_0xf3c5('0x34')],qs[_0xf3c5('0x36')](_0xbdca3['query'][_0xf3c5('0x36')]));_0x2b5d3d[_0xf3c5('0x35')]=_0x2b5d3d[_0xf3c5('0x35')][_0xf3c5('0x37')]?_0x2b5d3d[_0xf3c5('0x35')]:_0x60543e[_0xf3c5('0x34')];if(!_0xbdca3[_0xf3c5('0x32')][_0xf3c5('0x38')](_0xf3c5('0x39'))){_0x2b5d3d['limit']=qs[_0xf3c5('0x21')](_0xbdca3[_0xf3c5('0x32')][_0xf3c5('0x21')]);_0x2b5d3d[_0xf3c5('0x1e')]=qs['offset'](_0xbdca3['query'][_0xf3c5('0x1e')]);}_0x2b5d3d[_0xf3c5('0x3a')]=qs[_0xf3c5('0x3b')](_0xbdca3[_0xf3c5('0x32')]['sort']);_0x2b5d3d[_0xf3c5('0x3c')]=qs[_0xf3c5('0x3d')](_[_0xf3c5('0x3e')](_0xbdca3[_0xf3c5('0x32')],_0x60543e[_0xf3c5('0x3d')]),_0x42a206);if(_0xbdca3[_0xf3c5('0x32')][_0xf3c5('0x3f')]){_0x2b5d3d[_0xf3c5('0x3c')]=_[_0xf3c5('0x40')](_0x2b5d3d[_0xf3c5('0x3c')],{'$or':_['map'](_0x42a206,function(_0x48fad0){if(_0x48fad0['type']!==_0xf3c5('0x41')){var _0x579cf7={};_0x579cf7[_0x48fad0[_0xf3c5('0x2b')]]={'$like':'%'+_0xbdca3['query']['filter']+'%'};return _0x579cf7;}})});}_0x2b5d3d=_['merge']({},_0x2b5d3d,_0xbdca3[_0xf3c5('0x42')]);var _0x4b3a8e={'where':_0x2b5d3d['where']};return db['OpenchannelQueue']['count'](_0x4b3a8e)[_0xf3c5('0x27')](function(_0x7e9c1f){_0xd84b76[_0xf3c5('0x20')]=_0x7e9c1f;if(_0xbdca3['query'][_0xf3c5('0x43')]){_0x2b5d3d['include']=[{'all':!![]}];}return db[_0xf3c5('0x2e')][_0xf3c5('0x44')](_0x2b5d3d);})['then'](function(_0x393d54){_0xd84b76[_0xf3c5('0x45')]=_0x393d54;return _0xd84b76;})['then'](respondWithFilteredResult(_0x5146e3,_0x2b5d3d))[_0xf3c5('0x46')](handleError(_0x5146e3,null));};exports['show']=function(_0x1ee287,_0x344b0b){var _0x5dca50={'raw':!![],'where':{'id':_0x1ee287[_0xf3c5('0x47')]['id']}},_0x5385e7={};_0x5385e7[_0xf3c5('0x34')]=_['keys'](db['OpenchannelQueue'][_0xf3c5('0x48')]);_0x5385e7[_0xf3c5('0x32')]=_[_0xf3c5('0x33')](_0x1ee287[_0xf3c5('0x32')]);_0x5385e7['filters']=_[_0xf3c5('0x49')](_0x5385e7['model'],_0x5385e7[_0xf3c5('0x32')]);_0x5dca50[_0xf3c5('0x35')]=_['intersection'](_0x5385e7[_0xf3c5('0x34')],qs[_0xf3c5('0x36')](_0x1ee287[_0xf3c5('0x32')][_0xf3c5('0x36')]));_0x5dca50[_0xf3c5('0x35')]=_0x5dca50[_0xf3c5('0x35')]['length']?_0x5dca50[_0xf3c5('0x35')]:_0x5385e7['model'];if(_0x1ee287[_0xf3c5('0x32')][_0xf3c5('0x43')]){_0x5dca50[_0xf3c5('0x4a')]=[{'all':!![]}];}_0x5dca50=_[_0xf3c5('0x40')]({},_0x5dca50,_0x1ee287[_0xf3c5('0x42')]);return db[_0xf3c5('0x2e')]['find'](_0x5dca50)[_0xf3c5('0x27')](handleEntityNotFound(_0x344b0b,null))[_0xf3c5('0x27')](respondWithResult(_0x344b0b,null))[_0xf3c5('0x46')](handleError(_0x344b0b,null));};exports['create']=function(_0x1e3c9a,_0x322982){return db[_0xf3c5('0x2e')]['create'](_0x1e3c9a[_0xf3c5('0x4b')],{})[_0xf3c5('0x27')](function(_0x51afae){var _0x549c77=_0x1e3c9a[_0xf3c5('0x4c')]['get']({'plain':!![]});if(!_0x549c77)throw new Error(_0xf3c5('0x4d'));if(_0x549c77[_0xf3c5('0x4e')]===_0xf3c5('0x4c')){var _0x589525=_0x51afae[_0xf3c5('0x29')]({'plain':!![]});var _0x2de3c3='OpenchannelQueues';return db[_0xf3c5('0x4f')]['find']({'where':{'name':_0x2de3c3,'userProfileId':_0x549c77['userProfileId']},'raw':!![]})[_0xf3c5('0x27')](function(_0xa1e990){if(_0xa1e990&&_0xa1e990[_0xf3c5('0x50')]===0x0){return db[_0xf3c5('0x51')][_0xf3c5('0x52')]({'name':_0x589525[_0xf3c5('0x2b')],'resourceId':_0x589525['id'],'type':_0xa1e990['name'],'sectionId':_0xa1e990['id']},{})[_0xf3c5('0x27')](function(){return _0x51afae;});}else{return _0x51afae;}})[_0xf3c5('0x46')](function(_0x147ce3){logger[_0xf3c5('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x147ce3);throw _0x147ce3;});}return _0x51afae;})[_0xf3c5('0x27')](respondWithResult(_0x322982,0xc9))[_0xf3c5('0x46')](handleError(_0x322982,null));};exports[_0xf3c5('0x26')]=function(_0x44cce8,_0x3db7c6){if(_0x44cce8[_0xf3c5('0x4b')]['id']){delete _0x44cce8[_0xf3c5('0x4b')]['id'];}return db[_0xf3c5('0x2e')][_0xf3c5('0x54')]({'where':{'id':_0x44cce8[_0xf3c5('0x47')]['id']}})[_0xf3c5('0x27')](handleEntityNotFound(_0x3db7c6,null))['then'](saveUpdates(_0x44cce8[_0xf3c5('0x4b')],null))['then'](respondWithResult(_0x3db7c6,null))[_0xf3c5('0x46')](handleError(_0x3db7c6,null));};exports[_0xf3c5('0x28')]=function(_0xa8c02,_0x4cae4d){return db['OpenchannelQueue'][_0xf3c5('0x54')]({'where':{'id':_0xa8c02['params']['id']}})[_0xf3c5('0x27')](handleEntityNotFound(_0x4cae4d,null))[_0xf3c5('0x27')](removeEntity(_0x4cae4d,null))[_0xf3c5('0x46')](handleError(_0x4cae4d,null));};exports[_0xf3c5('0x55')]=function(_0x89b873,_0x3d39f5){return db[_0xf3c5('0x2e')][_0xf3c5('0x55')]()[_0xf3c5('0x27')](respondWithResult(_0x3d39f5,null))[_0xf3c5('0x46')](handleError(_0x3d39f5,null));};exports[_0xf3c5('0x56')]=function(_0xbce730,_0x2f4aa7,_0x5d9974){var _0x258deb={'raw':!![],'where':{}},_0x4c2767={},_0x13a4cc;return db[_0xf3c5('0x2e')][_0xf3c5('0x57')]({'where':{'id':_0xbce730[_0xf3c5('0x47')]['id']}})[_0xf3c5('0x27')](handleEntityNotFound(_0x2f4aa7,null))[_0xf3c5('0x27')](function(_0x5a8e35){if(_0x5a8e35){_0x13a4cc=_0x5a8e35[_0xf3c5('0x29')]({'plain':!![]});_0x4c2767['model']=_[_0xf3c5('0x33')](db[_0xf3c5('0x58')][_0xf3c5('0x48')]);_0x4c2767[_0xf3c5('0x32')]=_[_0xf3c5('0x33')](_0xbce730[_0xf3c5('0x32')]);_0x4c2767['filters']=_[_0xf3c5('0x49')](_0x4c2767['model'],_0x4c2767[_0xf3c5('0x32')]);_0x258deb[_0xf3c5('0x35')]=_[_0xf3c5('0x49')](_0x4c2767[_0xf3c5('0x34')],qs['fields'](_0xbce730['query'][_0xf3c5('0x36')]));_0x258deb[_0xf3c5('0x35')]=_0x258deb[_0xf3c5('0x35')][_0xf3c5('0x37')]?_0x258deb['attributes']:_0x4c2767[_0xf3c5('0x34')];if(!_0xbce730[_0xf3c5('0x32')][_0xf3c5('0x38')](_0xf3c5('0x39'))){_0x258deb[_0xf3c5('0x21')]=qs[_0xf3c5('0x21')](_0xbce730[_0xf3c5('0x32')][_0xf3c5('0x21')]);_0x258deb[_0xf3c5('0x1e')]=qs['offset'](_0xbce730['query'][_0xf3c5('0x1e')]);}_0x258deb[_0xf3c5('0x3a')]=qs[_0xf3c5('0x3b')](_0xbce730[_0xf3c5('0x32')][_0xf3c5('0x3b')]);_0x258deb[_0xf3c5('0x3c')]=qs['filters'](_[_0xf3c5('0x3e')](_0xbce730[_0xf3c5('0x32')],_0x4c2767['filters']));_0x258deb[_0xf3c5('0x3c')][_0xf3c5('0x59')]=_0x5a8e35['id'];if(_0xbce730[_0xf3c5('0x32')]['filter']){_0x258deb[_0xf3c5('0x3c')]=_[_0xf3c5('0x40')](_0x258deb[_0xf3c5('0x3c')],{'$or':_[_0xf3c5('0x31')](_0x258deb[_0xf3c5('0x35')],function(_0x2e9316){var _0x2679bf={};_0x2679bf[_0x2e9316]={'$like':'%'+_0xbce730['query'][_0xf3c5('0x3f')]+'%'};return _0x2679bf;})});}_0x258deb=_[_0xf3c5('0x40')]({},_0x258deb,_0xbce730[_0xf3c5('0x42')]);return db['UserOpenchannelQueue'][_0xf3c5('0x44')](_0x258deb);}})[_0xf3c5('0x27')](function(_0x424292){if(_0x424292){return db[_0xf3c5('0x5a')][_0xf3c5('0x5b')]({'where':{'id':_[_0xf3c5('0x31')](_0x424292,_0xf3c5('0x5c')),'role':_0xf3c5('0x5d')},'attributes':['id',_0xf3c5('0x2b'),_0xf3c5('0x5e'),_0xf3c5('0x5f'),_0xf3c5('0x60')]});}})['then'](function(_0x891bd7){if(_0x891bd7){return{'count':_0x891bd7[_0xf3c5('0x20')],'rows':_[_0xf3c5('0x31')](_0x891bd7[_0xf3c5('0x45')],function(_0x529c55){return{'membername':_0x529c55[_0xf3c5('0x2b')],'UserId':_0x529c55['id'],'queue_name':_0x13a4cc[_0xf3c5('0x2b')],'OpenchannelQueueId':_0x13a4cc['id'],'interface':util[_0xf3c5('0x61')]('%s/%s',_0xf3c5('0x62'),_0x529c55[_0xf3c5('0x2b')]),'penalty':0x0,'paused':_0x529c55[_0xf3c5('0x5e')],'createdAt':_0x529c55[_0xf3c5('0x60')],'updatedAt':_0x529c55[_0xf3c5('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2f4aa7,_0x258deb))[_0xf3c5('0x46')](handleError(_0x2f4aa7,null));};exports['getTeams']=function(_0x46d473,_0x3cd0fb,_0x299423){var _0x2bb135={};var _0x340d76={};var _0x55d53f;var _0x534d7d;return db[_0xf3c5('0x2e')][_0xf3c5('0x57')]({'where':{'id':_0x46d473[_0xf3c5('0x47')]['id']}})[_0xf3c5('0x27')](handleEntityNotFound(_0x3cd0fb,null))['then'](function(_0x5611ca){if(_0x5611ca){_0x55d53f=_0x5611ca;_0x340d76['model']=_[_0xf3c5('0x33')](db[_0xf3c5('0x63')][_0xf3c5('0x48')]);_0x340d76['query']=_[_0xf3c5('0x33')](_0x46d473[_0xf3c5('0x32')]);_0x340d76[_0xf3c5('0x3d')]=_[_0xf3c5('0x49')](_0x340d76[_0xf3c5('0x34')],_0x340d76['query']);_0x2bb135[_0xf3c5('0x35')]=_[_0xf3c5('0x49')](_0x340d76[_0xf3c5('0x34')],qs[_0xf3c5('0x36')](_0x46d473[_0xf3c5('0x32')][_0xf3c5('0x36')]));_0x2bb135[_0xf3c5('0x35')]=_0x2bb135[_0xf3c5('0x35')][_0xf3c5('0x37')]?_0x2bb135[_0xf3c5('0x35')]:_0x340d76[_0xf3c5('0x34')];_0x2bb135[_0xf3c5('0x3a')]=qs['sort'](_0x46d473[_0xf3c5('0x32')][_0xf3c5('0x3b')]);_0x2bb135['where']=qs[_0xf3c5('0x3d')](_[_0xf3c5('0x3e')](_0x46d473[_0xf3c5('0x32')],_0x340d76[_0xf3c5('0x3d')]));if(_0x46d473[_0xf3c5('0x32')]['filter']){_0x2bb135[_0xf3c5('0x3c')]=_[_0xf3c5('0x40')](_0x2bb135['where'],{'$or':_[_0xf3c5('0x31')](_0x2bb135[_0xf3c5('0x35')],function(_0x420d95){var _0x33598d={};_0x33598d[_0x420d95]={'$like':'%'+_0x46d473[_0xf3c5('0x32')][_0xf3c5('0x3f')]+'%'};return _0x33598d;})});}_0x2bb135=_[_0xf3c5('0x40')]({},_0x2bb135,_0x46d473[_0xf3c5('0x42')]);return _0x55d53f[_0xf3c5('0x64')](_0x2bb135);}})[_0xf3c5('0x27')](function(_0x464875){if(_0x464875){_0x534d7d=_0x464875[_0xf3c5('0x37')];if(!_0x46d473['query']['hasOwnProperty'](_0xf3c5('0x39'))){_0x2bb135[_0xf3c5('0x21')]=qs['limit'](_0x46d473[_0xf3c5('0x32')][_0xf3c5('0x21')]);_0x2bb135[_0xf3c5('0x1e')]=qs[_0xf3c5('0x1e')](_0x46d473[_0xf3c5('0x32')][_0xf3c5('0x1e')]);}return _0x55d53f[_0xf3c5('0x64')](_0x2bb135);}})[_0xf3c5('0x27')](function(_0x4978dc){if(_0x4978dc){return _0x4978dc?{'count':_0x534d7d,'rows':_0x4978dc}:null;}})[_0xf3c5('0x27')](respondWithResult(_0x3cd0fb,null))[_0xf3c5('0x46')](handleError(_0x3cd0fb,null));};exports[_0xf3c5('0x65')]=function(_0x48742d,_0x7a838c,_0x49c3a3){var _0x36b9f5=_0x48742d[_0xf3c5('0x4b')][_0xf3c5('0x66')];return db['Team']['findAll']({'where':{'id':_0x36b9f5},'attributes':['id'],'include':[{'model':db[_0xf3c5('0x5a')],'as':_0xf3c5('0x67'),'attributes':['id','name',_0xf3c5('0x68'),'voicePause','interface'],'raw':!![]}]})[_0xf3c5('0x27')](function(_0x194dcd){if(_0x194dcd){var _0x3a5ef7=_[_0xf3c5('0x69')](_0x194dcd,function(_0x3f0cfd){var _0x3574ed=_0x3f0cfd['get']({'plain':!![]});return _0x3574ed['Agents'];});return db[_0xf3c5('0x2e')][_0xf3c5('0x54')]({'where':{'id':_0x48742d[_0xf3c5('0x47')]['id']}})[_0xf3c5('0x27')](function(_0x1a40dc){return db['sequelize']['transaction'](function(_0x3d2a7b){return _0x1a40dc['addTeams'](_0x36b9f5,{'transaction':_0x3d2a7b})[_0xf3c5('0x27')](function(){return BPromise['each'](_0x3a5ef7,function(_0xac95b7){return db[_0xf3c5('0x58')]['findOrCreate']({'where':{'UserId':_0xac95b7['id'],'OpenchannelQueueId':_0x48742d[_0xf3c5('0x47')]['id']},'transaction':_0x3d2a7b});});})[_0xf3c5('0x27')](function(){_0x3a5ef7[_0xf3c5('0x6a')](function(_0x683ab0){socket[_0xf3c5('0x6b')](_0xf3c5('0x6c'),{'UserId':_0x683ab0['id'],'OpenchannelQueueId':_0x1a40dc['id']});});});});});}})[_0xf3c5('0x27')](respondWithStatusCode(_0x7a838c,null))[_0xf3c5('0x46')](handleError(_0x7a838c,null));};exports[_0xf3c5('0x6d')]=function(_0x108ead,_0x2eaa7b,_0x253a46){return db[_0xf3c5('0x63')][_0xf3c5('0x44')]({'where':{'id':_0x108ead[_0xf3c5('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf3c5('0x5a')],'as':_0xf3c5('0x67'),'attributes':['id'],'raw':!![]}]})[_0xf3c5('0x27')](handleEntityNotFound(_0x2eaa7b,null))[_0xf3c5('0x27')](function(_0x379a5a){var _0x140ba5=_[_0xf3c5('0x31')](_0x379a5a,'id');var _0xa79549=[];var _0x1ee5e8=[];var _0x14d01d=squel['select']();_0x14d01d[_0xf3c5('0x6e')](_0xf3c5('0x6f'))[_0xf3c5('0x70')]('team_has_openchannel_queues','tq')[_0xf3c5('0x71')](_0xf3c5('0x72'),'ut',_0xf3c5('0x73'))[_0xf3c5('0x3c')](_0xf3c5('0x74'),_0x108ead[_0xf3c5('0x47')]['id']);for(var _0x5947e7=0x0;_0x5947e7<_0x379a5a[_0xf3c5('0x37')];_0x5947e7+=0x1){let _0x2753a1=_0x379a5a[_0x5947e7];for(var _0x1d833f=0x0;_0x1d833f<_0x2753a1[_0xf3c5('0x67')][_0xf3c5('0x37')];_0x1d833f+=0x1){let _0x3276a8=_0x2753a1['Agents'][_0x1d833f];var _0x22fcb6=_0x14d01d[_0xf3c5('0x75')]();_0x22fcb6[_0xf3c5('0x3c')](_0xf3c5('0x76'),_0x3276a8['id']);_0x1ee5e8[_0xf3c5('0x77')](db[_0xf3c5('0x78')]['query'](_0x22fcb6['toString'](),{'type':db[_0xf3c5('0x78')][_0xf3c5('0x79')][_0xf3c5('0x7a')]})['then'](function(_0x3a9edd){if(_0x3a9edd[_0xf3c5('0x37')]===0x1){return _0x3276a8['id'];}else{var _0x3d638d=_['every'](_[_0xf3c5('0x31')](_0x3a9edd,'TeamId'),function(_0x125569){return _['includes'](_0x140ba5,_0x125569);});if(_0x3d638d){return _0x3276a8['id'];}}}));}}return BPromise[_0xf3c5('0x7b')](_0x1ee5e8)['then'](function(_0x39c478){_0xa79549=_(_0xa79549)[_0xf3c5('0x7c')](_0x39c478)[_0xf3c5('0x7d')]()[_0xf3c5('0x7e')]();return db[_0xf3c5('0x2e')][_0xf3c5('0x54')]({'where':{'id':_0x108ead[_0xf3c5('0x47')]['id']}})[_0xf3c5('0x27')](function(_0x2e6148){return db[_0xf3c5('0x78')][_0xf3c5('0x7f')](function(_0x5be2dc){return _0x2e6148[_0xf3c5('0x6d')](_0x108ead['query']['ids'],{'transaction':_0x5be2dc})[_0xf3c5('0x27')](function(){if(!_[_0xf3c5('0x80')](_0xa79549)){return _0x2e6148[_0xf3c5('0x81')](_0xa79549,{'transaction':_0x5be2dc});}})[_0xf3c5('0x27')](function(){_0xa79549[_0xf3c5('0x6a')](function(_0x5abed9){socket['emit'](_0xf3c5('0x82'),{'UserId':_0x5abed9,'OpenchannelQueueId':_0x2e6148['id']});});});});});});})[_0xf3c5('0x27')](respondWithStatusCode(_0x2eaa7b,null))[_0xf3c5('0x46')](handleError(_0x2eaa7b,null));};exports[_0xf3c5('0x83')]=function(_0x32f07d,_0x989499,_0x4fe712){return db['OpenchannelQueue'][_0xf3c5('0x54')]({'where':{'id':_0x32f07d[_0xf3c5('0x47')]['id']}})[_0xf3c5('0x27')](handleEntityNotFound(_0x989499,null))[_0xf3c5('0x27')](function(_0x197d38){if(_0x197d38){return _0x197d38[_0xf3c5('0x83')](_0x32f07d['body'][_0xf3c5('0x66')],_[_0xf3c5('0x84')](_0x32f07d[_0xf3c5('0x4b')],[_0xf3c5('0x66'),'id'])||{})[_0xf3c5('0x85')](function(_0x24ff9b){for(var _0x41de2a=0x0;_0x41de2a<_0x32f07d['body']['ids'][_0xf3c5('0x37')];_0x41de2a+=0x1){socket[_0xf3c5('0x6b')](_0xf3c5('0x6c'),{'UserId':Number(_0x32f07d[_0xf3c5('0x4b')][_0xf3c5('0x66')][_0x41de2a]),'OpenchannelQueueId':Number(_0x32f07d['params']['id'])});}return _0x24ff9b;});}})[_0xf3c5('0x27')](respondWithResult(_0x989499,null))[_0xf3c5('0x46')](handleError(_0x989499,null));};exports['removeAgents']=function(_0xefe984,_0x15fdf3,_0x2212ed){return db[_0xf3c5('0x2e')][_0xf3c5('0x54')]({'where':{'id':_0xefe984[_0xf3c5('0x47')]['id']}})[_0xf3c5('0x27')](handleEntityNotFound(_0x15fdf3,null))[_0xf3c5('0x27')](function(_0x5be7e7){if(_0x5be7e7){return _0x5be7e7[_0xf3c5('0x81')](_0xefe984[_0xf3c5('0x32')][_0xf3c5('0x66')])[_0xf3c5('0x27')](function(){if(_[_0xf3c5('0x86')](_0xefe984['query'][_0xf3c5('0x66')])){for(var _0x555010=0x0;_0x555010<_0xefe984['query']['ids'][_0xf3c5('0x37')];_0x555010+=0x1){socket[_0xf3c5('0x6b')](_0xf3c5('0x82'),{'UserId':Number(_0xefe984[_0xf3c5('0x32')]['ids'][_0x555010]),'OpenchannelQueueId':Number(_0xefe984[_0xf3c5('0x47')]['id'])});}}else{socket['emit'](_0xf3c5('0x82'),{'UserId':Number(_0xefe984['query'][_0xf3c5('0x66')]),'OpenchannelQueueId':Number(_0xefe984[_0xf3c5('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x15fdf3,null))[_0xf3c5('0x46')](handleError(_0x15fdf3,null));};exports['getAgents']=function(_0x8d79d0,_0xcbf944,_0x2350df){var _0x2a24d6={};var _0x32df5d={};var _0x1add42;var _0x3865af;return db[_0xf3c5('0x2e')]['findOne']({'where':{'id':_0x8d79d0['params']['id']}})[_0xf3c5('0x27')](handleEntityNotFound(_0xcbf944,null))[_0xf3c5('0x27')](function(_0x402c9e){if(_0x402c9e){_0x1add42=_0x402c9e;_0x32df5d[_0xf3c5('0x34')]=_[_0xf3c5('0x33')](db[_0xf3c5('0x5a')][_0xf3c5('0x48')]);_0x32df5d[_0xf3c5('0x32')]=_[_0xf3c5('0x33')](_0x8d79d0[_0xf3c5('0x32')]);_0x32df5d[_0xf3c5('0x3d')]=_['intersection'](_0x32df5d['model'],_0x32df5d['query']);_0x2a24d6[_0xf3c5('0x35')]=_[_0xf3c5('0x49')](_0x32df5d[_0xf3c5('0x34')],qs[_0xf3c5('0x36')](_0x8d79d0['query'][_0xf3c5('0x36')]));_0x2a24d6[_0xf3c5('0x35')]=_0x2a24d6[_0xf3c5('0x35')][_0xf3c5('0x37')]?_0x2a24d6[_0xf3c5('0x35')]:_0x32df5d[_0xf3c5('0x34')];_0x2a24d6[_0xf3c5('0x3a')]=qs[_0xf3c5('0x3b')](_0x8d79d0[_0xf3c5('0x32')]['sort']);_0x2a24d6['where']=qs[_0xf3c5('0x3d')](_['pick'](_0x8d79d0[_0xf3c5('0x32')],_0x32df5d[_0xf3c5('0x3d')]));if(_0x8d79d0[_0xf3c5('0x32')][_0xf3c5('0x3f')]){_0x2a24d6[_0xf3c5('0x3c')]=_[_0xf3c5('0x40')](_0x2a24d6['where'],{'$or':_[_0xf3c5('0x31')](_0x2a24d6[_0xf3c5('0x35')],function(_0x58a0b3){var _0x3e2f62={};_0x3e2f62[_0x58a0b3]={'$like':'%'+_0x8d79d0[_0xf3c5('0x32')][_0xf3c5('0x3f')]+'%'};return _0x3e2f62;})});}_0x2a24d6=_[_0xf3c5('0x40')]({},_0x2a24d6,_0x8d79d0[_0xf3c5('0x42')]);return _0x1add42[_0xf3c5('0x87')](_0x2a24d6);}})[_0xf3c5('0x27')](function(_0x576b5e){if(_0x576b5e){_0x3865af=_0x576b5e['length'];if(!_0x8d79d0[_0xf3c5('0x32')][_0xf3c5('0x38')](_0xf3c5('0x39'))){_0x2a24d6[_0xf3c5('0x21')]=qs[_0xf3c5('0x21')](_0x8d79d0[_0xf3c5('0x32')][_0xf3c5('0x21')]);_0x2a24d6['offset']=qs['offset'](_0x8d79d0[_0xf3c5('0x32')]['offset']);}return _0x1add42[_0xf3c5('0x87')](_0x2a24d6);}})[_0xf3c5('0x27')](function(_0x1e342e){if(_0x1e342e){return _0x1e342e?{'count':_0x3865af,'rows':_0x1e342e}:null;}})['then'](respondWithResult(_0xcbf944,null))[_0xf3c5('0x46')](handleError(_0xcbf944,null));}; \ No newline at end of file +var _0x71c8=['updatedAt','createdAt','format','%s/%s','openchannelPause','getTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','field','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','push','sequelize','toString','SELECT','every','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','isArray','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelQueue','include','rows','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','describe','getMembers','findOne','UserOpenchannelQueue','findAll','UserId'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x71c8,0x1bf));var _0x871c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x71c8[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x871c('0x0'));var rimraf=require(_0x871c('0x1'));var zipdir=require(_0x871c('0x2'));var jsonpatch=require(_0x871c('0x3'));var rp=require(_0x871c('0x4'));var moment=require('moment');var BPromise=require(_0x871c('0x5'));var Mustache=require('mustache');var util=require(_0x871c('0x6'));var path=require(_0x871c('0x7'));var sox=require(_0x871c('0x8'));var csv=require('to-csv');var ejs=require(_0x871c('0x9'));var fs=require('fs');var fs_extra=require(_0x871c('0xa'));var _=require('lodash');var squel=require(_0x871c('0xb'));var crypto=require(_0x871c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x871c('0xd'));var toCsv=require(_0x871c('0xe'));var querystring=require('querystring');var Papa=require(_0x871c('0xf'));var Redis=require(_0x871c('0x10'));var authService=require(_0x871c('0x11'));var qs=require(_0x871c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x871c('0x13'));var logger=require(_0x871c('0x14'))(_0x871c('0x15'));var utils=require(_0x871c('0x16'));var config=require(_0x871c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x871c('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x871c('0x19')]));require('./openchannelQueue.socket')[_0x871c('0x1a')](socket);function respondWithStatusCode(_0x4b41dc,_0x2c2dc5){_0x2c2dc5=_0x2c2dc5||0xcc;return function(_0x32cfc9){if(_0x32cfc9){return _0x4b41dc[_0x871c('0x1b')](_0x2c2dc5);}return _0x4b41dc[_0x871c('0x1c')](_0x2c2dc5)['end']();};}function respondWithResult(_0x431c48,_0x563261){_0x563261=_0x563261||0xc8;return function(_0x16f16c){if(_0x16f16c){return _0x431c48['status'](_0x563261)[_0x871c('0x1d')](_0x16f16c);}};}function respondWithFilteredResult(_0x22e990,_0x1a8424){return function(_0x27ccfe){if(_0x27ccfe){var _0x50ed12=typeof _0x1a8424[_0x871c('0x1e')]==='undefined'&&typeof _0x1a8424['limit']===_0x871c('0x1f');var _0x46f9b6=_0x27ccfe[_0x871c('0x20')];var _0x24a78f=_0x50ed12?0x0:_0x1a8424[_0x871c('0x1e')];var _0x5675ce=_0x50ed12?_0x27ccfe[_0x871c('0x20')]:_0x1a8424['offset']+_0x1a8424[_0x871c('0x21')];var _0x15917e;if(_0x5675ce>=_0x46f9b6){_0x5675ce=_0x46f9b6;_0x15917e=0xc8;}else{_0x15917e=0xce;}_0x22e990[_0x871c('0x1c')](_0x15917e);return _0x22e990[_0x871c('0x22')](_0x871c('0x23'),_0x24a78f+'-'+_0x5675ce+'/'+_0x46f9b6)[_0x871c('0x1d')](_0x27ccfe);}return null;};}function patchUpdates(_0x377aaf){return function(_0x17608f){try{jsonpatch[_0x871c('0x24')](_0x17608f,_0x377aaf,!![]);}catch(_0x53b524){return BPromise[_0x871c('0x25')](_0x53b524);}return _0x17608f['save']();};}function saveUpdates(_0x5c7f23,_0x465696){return function(_0x20dae9){if(_0x20dae9){return _0x20dae9[_0x871c('0x26')](_0x5c7f23)[_0x871c('0x27')](function(_0x5cb3ec){return _0x5cb3ec;});}return null;};}function removeEntity(_0x2ded4c,_0x514837){return function(_0xf9d185){if(_0xf9d185){return _0xf9d185[_0x871c('0x28')]()[_0x871c('0x27')](function(){var _0x48b1ea=_0xf9d185[_0x871c('0x29')]({'plain':!![]});var _0x39c257='OpenchannelQueues';return db[_0x871c('0x2a')][_0x871c('0x28')]({'where':{'type':_0x39c257,'resourceId':_0x48b1ea['id']}})['then'](function(){return _0xf9d185;});})[_0x871c('0x27')](function(){_0x2ded4c[_0x871c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51dd57,_0x106c69){return function(_0x42129e){if(!_0x42129e){_0x51dd57['sendStatus'](0x194);}return _0x42129e;};}function handleError(_0x81337d,_0x5089f7){_0x5089f7=_0x5089f7||0x1f4;return function(_0x4b0feb){logger[_0x871c('0x2b')](_0x4b0feb['stack']);if(_0x4b0feb[_0x871c('0x2c')]){delete _0x4b0feb['name'];}_0x81337d[_0x871c('0x1c')](_0x5089f7)[_0x871c('0x2d')](_0x4b0feb);};}exports['index']=function(_0x296290,_0x4ff5e8){var _0x38a4f2={},_0x4faf86={},_0x4ed527={'count':0x0,'rows':[]};var _0x232bbf=_[_0x871c('0x2e')](db['OpenchannelQueue'][_0x871c('0x2f')],function(_0x2bf121){return{'name':_0x2bf121[_0x871c('0x30')],'type':_0x2bf121['type'][_0x871c('0x31')]};});_0x4faf86[_0x871c('0x32')]=_[_0x871c('0x2e')](_0x232bbf,_0x871c('0x2c'));_0x4faf86[_0x871c('0x33')]=_[_0x871c('0x34')](_0x296290[_0x871c('0x33')]);_0x4faf86[_0x871c('0x35')]=_[_0x871c('0x36')](_0x4faf86[_0x871c('0x32')],_0x4faf86['query']);_0x38a4f2['attributes']=_[_0x871c('0x36')](_0x4faf86[_0x871c('0x32')],qs['fields'](_0x296290['query'][_0x871c('0x37')]));_0x38a4f2[_0x871c('0x38')]=_0x38a4f2[_0x871c('0x38')][_0x871c('0x39')]?_0x38a4f2[_0x871c('0x38')]:_0x4faf86[_0x871c('0x32')];if(!_0x296290[_0x871c('0x33')][_0x871c('0x3a')]('nolimit')){_0x38a4f2['limit']=qs['limit'](_0x296290[_0x871c('0x33')][_0x871c('0x21')]);_0x38a4f2[_0x871c('0x1e')]=qs['offset'](_0x296290[_0x871c('0x33')][_0x871c('0x1e')]);}_0x38a4f2[_0x871c('0x3b')]=qs[_0x871c('0x3c')](_0x296290[_0x871c('0x33')][_0x871c('0x3c')]);_0x38a4f2[_0x871c('0x3d')]=qs['filters'](_[_0x871c('0x3e')](_0x296290[_0x871c('0x33')],_0x4faf86[_0x871c('0x35')]),_0x232bbf);if(_0x296290[_0x871c('0x33')][_0x871c('0x3f')]){_0x38a4f2[_0x871c('0x3d')]=_[_0x871c('0x40')](_0x38a4f2['where'],{'$or':_['map'](_0x232bbf,function(_0x48c05e){if(_0x48c05e[_0x871c('0x41')]!==_0x871c('0x42')){var _0x1a19d9={};_0x1a19d9[_0x48c05e[_0x871c('0x2c')]]={'$like':'%'+_0x296290[_0x871c('0x33')][_0x871c('0x3f')]+'%'};return _0x1a19d9;}})});}_0x38a4f2=_[_0x871c('0x40')]({},_0x38a4f2,_0x296290[_0x871c('0x43')]);var _0x101bf5={'where':_0x38a4f2[_0x871c('0x3d')]};return db[_0x871c('0x44')][_0x871c('0x20')](_0x101bf5)[_0x871c('0x27')](function(_0x5b24fa){_0x4ed527[_0x871c('0x20')]=_0x5b24fa;if(_0x296290[_0x871c('0x33')]['includeAll']){_0x38a4f2[_0x871c('0x45')]=[{'all':!![]}];}return db[_0x871c('0x44')]['findAll'](_0x38a4f2);})[_0x871c('0x27')](function(_0x44984b){_0x4ed527[_0x871c('0x46')]=_0x44984b;return _0x4ed527;})[_0x871c('0x27')](respondWithFilteredResult(_0x4ff5e8,_0x38a4f2))['catch'](handleError(_0x4ff5e8,null));};exports['show']=function(_0x23f39c,_0x37903c){var _0x198edf={'raw':!![],'where':{'id':_0x23f39c['params']['id']}},_0x4bc537={};_0x4bc537[_0x871c('0x32')]=_['keys'](db[_0x871c('0x44')]['rawAttributes']);_0x4bc537[_0x871c('0x33')]=_[_0x871c('0x34')](_0x23f39c['query']);_0x4bc537[_0x871c('0x35')]=_['intersection'](_0x4bc537[_0x871c('0x32')],_0x4bc537['query']);_0x198edf[_0x871c('0x38')]=_[_0x871c('0x36')](_0x4bc537[_0x871c('0x32')],qs['fields'](_0x23f39c[_0x871c('0x33')]['fields']));_0x198edf[_0x871c('0x38')]=_0x198edf[_0x871c('0x38')][_0x871c('0x39')]?_0x198edf[_0x871c('0x38')]:_0x4bc537[_0x871c('0x32')];if(_0x23f39c[_0x871c('0x33')]['includeAll']){_0x198edf[_0x871c('0x45')]=[{'all':!![]}];}_0x198edf=_[_0x871c('0x40')]({},_0x198edf,_0x23f39c['options']);return db[_0x871c('0x44')][_0x871c('0x47')](_0x198edf)[_0x871c('0x27')](handleEntityNotFound(_0x37903c,null))[_0x871c('0x27')](respondWithResult(_0x37903c,null))['catch'](handleError(_0x37903c,null));};exports[_0x871c('0x48')]=function(_0x55ab86,_0x2b19cd){return db[_0x871c('0x44')]['create'](_0x55ab86[_0x871c('0x49')],{})[_0x871c('0x27')](function(_0x41074f){var _0x5bafe7=_0x55ab86[_0x871c('0x4a')][_0x871c('0x29')]({'plain':!![]});if(!_0x5bafe7)throw new Error(_0x871c('0x4b'));if(_0x5bafe7[_0x871c('0x4c')]===_0x871c('0x4a')){var _0x46c899=_0x41074f[_0x871c('0x29')]({'plain':!![]});var _0x323740=_0x871c('0x4d');return db[_0x871c('0x4e')][_0x871c('0x47')]({'where':{'name':_0x323740,'userProfileId':_0x5bafe7['userProfileId']},'raw':!![]})['then'](function(_0x1254d4){if(_0x1254d4&&_0x1254d4[_0x871c('0x4f')]===0x0){return db[_0x871c('0x2a')]['create']({'name':_0x46c899[_0x871c('0x2c')],'resourceId':_0x46c899['id'],'type':_0x1254d4[_0x871c('0x2c')],'sectionId':_0x1254d4['id']},{})[_0x871c('0x27')](function(){return _0x41074f;});}else{return _0x41074f;}})['catch'](function(_0x538185){logger['error'](_0x871c('0x50'),_0x538185);throw _0x538185;});}return _0x41074f;})[_0x871c('0x27')](respondWithResult(_0x2b19cd,0xc9))[_0x871c('0x51')](handleError(_0x2b19cd,null));};exports[_0x871c('0x26')]=function(_0x35d15a,_0x386b82){if(_0x35d15a[_0x871c('0x49')]['id']){delete _0x35d15a[_0x871c('0x49')]['id'];}return db[_0x871c('0x44')][_0x871c('0x47')]({'where':{'id':_0x35d15a[_0x871c('0x52')]['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x386b82,null))[_0x871c('0x27')](saveUpdates(_0x35d15a[_0x871c('0x49')],null))[_0x871c('0x27')](respondWithResult(_0x386b82,null))[_0x871c('0x51')](handleError(_0x386b82,null));};exports[_0x871c('0x28')]=function(_0x115f98,_0x5ee9e3){return db[_0x871c('0x44')][_0x871c('0x47')]({'where':{'id':_0x115f98['params']['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x5ee9e3,null))['then'](removeEntity(_0x5ee9e3,null))[_0x871c('0x51')](handleError(_0x5ee9e3,null));};exports[_0x871c('0x53')]=function(_0x65a50e,_0x5b1758){return db[_0x871c('0x44')][_0x871c('0x53')]()[_0x871c('0x27')](respondWithResult(_0x5b1758,null))[_0x871c('0x51')](handleError(_0x5b1758,null));};exports[_0x871c('0x54')]=function(_0x47236d,_0x3a86fb,_0x2ba3ce){var _0x177be3={'raw':!![],'where':{}},_0x40db5d={},_0x4f3eae;return db[_0x871c('0x44')][_0x871c('0x55')]({'where':{'id':_0x47236d[_0x871c('0x52')]['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x3a86fb,null))['then'](function(_0x586d11){if(_0x586d11){_0x4f3eae=_0x586d11[_0x871c('0x29')]({'plain':!![]});_0x40db5d[_0x871c('0x32')]=_[_0x871c('0x34')](db['UserOpenchannelQueue'][_0x871c('0x2f')]);_0x40db5d[_0x871c('0x33')]=_[_0x871c('0x34')](_0x47236d[_0x871c('0x33')]);_0x40db5d['filters']=_[_0x871c('0x36')](_0x40db5d['model'],_0x40db5d[_0x871c('0x33')]);_0x177be3[_0x871c('0x38')]=_[_0x871c('0x36')](_0x40db5d[_0x871c('0x32')],qs[_0x871c('0x37')](_0x47236d[_0x871c('0x33')]['fields']));_0x177be3[_0x871c('0x38')]=_0x177be3['attributes'][_0x871c('0x39')]?_0x177be3[_0x871c('0x38')]:_0x40db5d[_0x871c('0x32')];if(!_0x47236d['query'][_0x871c('0x3a')]('nolimit')){_0x177be3['limit']=qs[_0x871c('0x21')](_0x47236d[_0x871c('0x33')][_0x871c('0x21')]);_0x177be3[_0x871c('0x1e')]=qs['offset'](_0x47236d[_0x871c('0x33')][_0x871c('0x1e')]);}_0x177be3[_0x871c('0x3b')]=qs[_0x871c('0x3c')](_0x47236d[_0x871c('0x33')][_0x871c('0x3c')]);_0x177be3[_0x871c('0x3d')]=qs[_0x871c('0x35')](_[_0x871c('0x3e')](_0x47236d[_0x871c('0x33')],_0x40db5d['filters']));_0x177be3[_0x871c('0x3d')]['OpenchannelQueueId']=_0x586d11['id'];if(_0x47236d[_0x871c('0x33')][_0x871c('0x3f')]){_0x177be3[_0x871c('0x3d')]=_['merge'](_0x177be3[_0x871c('0x3d')],{'$or':_[_0x871c('0x2e')](_0x177be3[_0x871c('0x38')],function(_0x534452){var _0xf6d01f={};_0xf6d01f[_0x534452]={'$like':'%'+_0x47236d['query']['filter']+'%'};return _0xf6d01f;})});}_0x177be3=_[_0x871c('0x40')]({},_0x177be3,_0x47236d['options']);return db[_0x871c('0x56')][_0x871c('0x57')](_0x177be3);}})[_0x871c('0x27')](function(_0x463b20){if(_0x463b20){return db['User']['findAndCountAll']({'where':{'id':_[_0x871c('0x2e')](_0x463b20,_0x871c('0x58')),'role':'agent'},'attributes':['id',_0x871c('0x2c'),'openchannelPause',_0x871c('0x59'),_0x871c('0x5a')]});}})['then'](function(_0x1452a5){if(_0x1452a5){return{'count':_0x1452a5[_0x871c('0x20')],'rows':_[_0x871c('0x2e')](_0x1452a5[_0x871c('0x46')],function(_0x5542d1){return{'membername':_0x5542d1[_0x871c('0x2c')],'UserId':_0x5542d1['id'],'queue_name':_0x4f3eae[_0x871c('0x2c')],'OpenchannelQueueId':_0x4f3eae['id'],'interface':util[_0x871c('0x5b')](_0x871c('0x5c'),'SIP',_0x5542d1[_0x871c('0x2c')]),'penalty':0x0,'paused':_0x5542d1[_0x871c('0x5d')],'createdAt':_0x5542d1[_0x871c('0x5a')],'updatedAt':_0x5542d1[_0x871c('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x871c('0x27')](respondWithFilteredResult(_0x3a86fb,_0x177be3))['catch'](handleError(_0x3a86fb,null));};exports['getTeams']=function(_0x5b7bad,_0x34cecc,_0x7536a6){var _0x49e398={};var _0x45516c={};var _0x2cabcf;var _0x29381f;return db['OpenchannelQueue'][_0x871c('0x55')]({'where':{'id':_0x5b7bad[_0x871c('0x52')]['id']}})['then'](handleEntityNotFound(_0x34cecc,null))['then'](function(_0x5c3c4b){if(_0x5c3c4b){_0x2cabcf=_0x5c3c4b;_0x45516c[_0x871c('0x32')]=_[_0x871c('0x34')](db['Team']['rawAttributes']);_0x45516c[_0x871c('0x33')]=_[_0x871c('0x34')](_0x5b7bad[_0x871c('0x33')]);_0x45516c['filters']=_[_0x871c('0x36')](_0x45516c[_0x871c('0x32')],_0x45516c[_0x871c('0x33')]);_0x49e398['attributes']=_[_0x871c('0x36')](_0x45516c[_0x871c('0x32')],qs[_0x871c('0x37')](_0x5b7bad[_0x871c('0x33')][_0x871c('0x37')]));_0x49e398['attributes']=_0x49e398[_0x871c('0x38')][_0x871c('0x39')]?_0x49e398[_0x871c('0x38')]:_0x45516c['model'];_0x49e398[_0x871c('0x3b')]=qs['sort'](_0x5b7bad['query'][_0x871c('0x3c')]);_0x49e398[_0x871c('0x3d')]=qs[_0x871c('0x35')](_[_0x871c('0x3e')](_0x5b7bad[_0x871c('0x33')],_0x45516c['filters']));if(_0x5b7bad[_0x871c('0x33')][_0x871c('0x3f')]){_0x49e398[_0x871c('0x3d')]=_[_0x871c('0x40')](_0x49e398[_0x871c('0x3d')],{'$or':_[_0x871c('0x2e')](_0x49e398[_0x871c('0x38')],function(_0x2d2f28){var _0x235048={};_0x235048[_0x2d2f28]={'$like':'%'+_0x5b7bad['query']['filter']+'%'};return _0x235048;})});}_0x49e398=_[_0x871c('0x40')]({},_0x49e398,_0x5b7bad[_0x871c('0x43')]);return _0x2cabcf[_0x871c('0x5e')](_0x49e398);}})['then'](function(_0x1eacad){if(_0x1eacad){_0x29381f=_0x1eacad[_0x871c('0x39')];if(!_0x5b7bad[_0x871c('0x33')][_0x871c('0x3a')]('nolimit')){_0x49e398['limit']=qs['limit'](_0x5b7bad[_0x871c('0x33')][_0x871c('0x21')]);_0x49e398[_0x871c('0x1e')]=qs['offset'](_0x5b7bad['query']['offset']);}return _0x2cabcf[_0x871c('0x5e')](_0x49e398);}})[_0x871c('0x27')](function(_0x29f039){if(_0x29f039){return _0x29f039?{'count':_0x29381f,'rows':_0x29f039}:null;}})['then'](respondWithResult(_0x34cecc,null))[_0x871c('0x51')](handleError(_0x34cecc,null));};exports['addTeams']=function(_0x45f68b,_0x48f64e,_0x4f5097){var _0x169b6a=_0x45f68b[_0x871c('0x49')][_0x871c('0x5f')];return db[_0x871c('0x60')][_0x871c('0x57')]({'where':{'id':_0x169b6a},'attributes':['id'],'include':[{'model':db[_0x871c('0x61')],'as':_0x871c('0x62'),'attributes':['id',_0x871c('0x2c'),_0x871c('0x63'),_0x871c('0x64'),_0x871c('0x65')],'raw':!![]}]})[_0x871c('0x27')](function(_0x2f4481){if(_0x2f4481){var _0x1285b1=_[_0x871c('0x66')](_0x2f4481,function(_0x2d1f18){var _0x7fbb41=_0x2d1f18[_0x871c('0x29')]({'plain':!![]});return _0x7fbb41['Agents'];});return db[_0x871c('0x44')]['find']({'where':{'id':_0x45f68b[_0x871c('0x52')]['id']}})[_0x871c('0x27')](function(_0x4e0180){return db['sequelize'][_0x871c('0x67')](function(_0x31ecac){return _0x4e0180[_0x871c('0x68')](_0x169b6a,{'transaction':_0x31ecac})[_0x871c('0x27')](function(){return BPromise[_0x871c('0x69')](_0x1285b1,function(_0x2d4d61){return db[_0x871c('0x56')][_0x871c('0x6a')]({'where':{'UserId':_0x2d4d61['id'],'OpenchannelQueueId':_0x45f68b[_0x871c('0x52')]['id']},'transaction':_0x31ecac});});})['then'](function(){_0x1285b1[_0x871c('0x6b')](function(_0xbed52e){socket[_0x871c('0x6c')]('userOpenchannelQueue:save',{'UserId':_0xbed52e['id'],'OpenchannelQueueId':_0x4e0180['id']});});});});});}})[_0x871c('0x27')](respondWithStatusCode(_0x48f64e,null))[_0x871c('0x51')](handleError(_0x48f64e,null));};exports['removeTeams']=function(_0x1ff8d4,_0x427185,_0x1361d2){return db[_0x871c('0x60')][_0x871c('0x57')]({'where':{'id':_0x1ff8d4[_0x871c('0x33')][_0x871c('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x427185,null))['then'](function(_0x583665){var _0x5f4e7e=_[_0x871c('0x2e')](_0x583665,'id');var _0x5f1859=[];var _0x1e2c00=[];var _0x2089ab=squel['select']();_0x2089ab[_0x871c('0x6d')]('tq.TeamId')['from'](_0x871c('0x6e'),'tq')['join'](_0x871c('0x6f'),'ut',_0x871c('0x70'))[_0x871c('0x3d')](_0x871c('0x71'),_0x1ff8d4[_0x871c('0x52')]['id']);for(var _0x3dce26=0x0;_0x3dce26<_0x583665['length'];_0x3dce26+=0x1){let _0x2b08f4=_0x583665[_0x3dce26];for(var _0x333d75=0x0;_0x333d75<_0x2b08f4[_0x871c('0x62')][_0x871c('0x39')];_0x333d75+=0x1){let _0x357fb3=_0x2b08f4[_0x871c('0x62')][_0x333d75];var _0x535088=_0x2089ab['clone']();_0x535088[_0x871c('0x3d')]('ut.UserId\x20=\x20?',_0x357fb3['id']);_0x1e2c00[_0x871c('0x72')](db[_0x871c('0x73')][_0x871c('0x33')](_0x535088[_0x871c('0x74')](),{'type':db['sequelize']['QueryTypes'][_0x871c('0x75')]})[_0x871c('0x27')](function(_0x29b335){if(_0x29b335['length']===0x1){return _0x357fb3['id'];}else{var _0x2fcb62=_[_0x871c('0x76')](_[_0x871c('0x2e')](_0x29b335,'TeamId'),function(_0x521485){return _[_0x871c('0x77')](_0x5f4e7e,_0x521485);});if(_0x2fcb62){return _0x357fb3['id'];}}}));}}return BPromise[_0x871c('0x78')](_0x1e2c00)[_0x871c('0x27')](function(_0x2ef051){_0x5f1859=_(_0x5f1859)[_0x871c('0x79')](_0x2ef051)[_0x871c('0x7a')]()[_0x871c('0x7b')]();return db[_0x871c('0x44')]['find']({'where':{'id':_0x1ff8d4[_0x871c('0x52')]['id']}})['then'](function(_0x2fa050){return db[_0x871c('0x73')][_0x871c('0x67')](function(_0x204816){return _0x2fa050[_0x871c('0x7c')](_0x1ff8d4['query'][_0x871c('0x5f')],{'transaction':_0x204816})[_0x871c('0x27')](function(){if(!_[_0x871c('0x7d')](_0x5f1859)){return _0x2fa050[_0x871c('0x7e')](_0x5f1859,{'transaction':_0x204816});}})[_0x871c('0x27')](function(){_0x5f1859[_0x871c('0x6b')](function(_0x386d40){socket[_0x871c('0x6c')](_0x871c('0x7f'),{'UserId':_0x386d40,'OpenchannelQueueId':_0x2fa050['id']});});});});});});})[_0x871c('0x27')](respondWithStatusCode(_0x427185,null))[_0x871c('0x51')](handleError(_0x427185,null));};exports[_0x871c('0x80')]=function(_0x36fbda,_0x5be768,_0x270da2){return db[_0x871c('0x44')][_0x871c('0x47')]({'where':{'id':_0x36fbda[_0x871c('0x52')]['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x5be768,null))['then'](function(_0x289b0c){if(_0x289b0c){return _0x289b0c[_0x871c('0x80')](_0x36fbda['body'][_0x871c('0x5f')],_['omit'](_0x36fbda[_0x871c('0x49')],[_0x871c('0x5f'),'id'])||{})[_0x871c('0x81')](function(_0x25a9e0){for(var _0x465e0a=0x0;_0x465e0a<_0x36fbda[_0x871c('0x49')][_0x871c('0x5f')][_0x871c('0x39')];_0x465e0a+=0x1){socket[_0x871c('0x6c')](_0x871c('0x82'),{'UserId':Number(_0x36fbda[_0x871c('0x49')][_0x871c('0x5f')][_0x465e0a]),'OpenchannelQueueId':Number(_0x36fbda[_0x871c('0x52')]['id'])});}return _0x25a9e0;});}})[_0x871c('0x27')](respondWithResult(_0x5be768,null))[_0x871c('0x51')](handleError(_0x5be768,null));};exports[_0x871c('0x7e')]=function(_0xbe5d3c,_0x494a57,_0x5af200){return db[_0x871c('0x44')][_0x871c('0x47')]({'where':{'id':_0xbe5d3c[_0x871c('0x52')]['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x494a57,null))[_0x871c('0x27')](function(_0x799d4c){if(_0x799d4c){return _0x799d4c[_0x871c('0x7e')](_0xbe5d3c[_0x871c('0x33')][_0x871c('0x5f')])[_0x871c('0x27')](function(){if(_[_0x871c('0x83')](_0xbe5d3c[_0x871c('0x33')][_0x871c('0x5f')])){for(var _0xbe79af=0x0;_0xbe79af<_0xbe5d3c['query'][_0x871c('0x5f')][_0x871c('0x39')];_0xbe79af+=0x1){socket[_0x871c('0x6c')](_0x871c('0x7f'),{'UserId':Number(_0xbe5d3c[_0x871c('0x33')]['ids'][_0xbe79af]),'OpenchannelQueueId':Number(_0xbe5d3c['params']['id'])});}}else{socket[_0x871c('0x6c')]('userOpenchannelQueue:remove',{'UserId':Number(_0xbe5d3c['query'][_0x871c('0x5f')]),'OpenchannelQueueId':Number(_0xbe5d3c[_0x871c('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x494a57,null))[_0x871c('0x51')](handleError(_0x494a57,null));};exports[_0x871c('0x84')]=function(_0x5b66d6,_0x346831,_0x4b3452){var _0x43a703={};var _0x330403={};var _0x4b1b8a;var _0x17c40d;return db[_0x871c('0x44')][_0x871c('0x55')]({'where':{'id':_0x5b66d6['params']['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x346831,null))['then'](function(_0x2cac9a){if(_0x2cac9a){_0x4b1b8a=_0x2cac9a;_0x330403[_0x871c('0x32')]=_[_0x871c('0x34')](db['User'][_0x871c('0x2f')]);_0x330403[_0x871c('0x33')]=_[_0x871c('0x34')](_0x5b66d6[_0x871c('0x33')]);_0x330403[_0x871c('0x35')]=_[_0x871c('0x36')](_0x330403[_0x871c('0x32')],_0x330403[_0x871c('0x33')]);_0x43a703[_0x871c('0x38')]=_['intersection'](_0x330403[_0x871c('0x32')],qs[_0x871c('0x37')](_0x5b66d6[_0x871c('0x33')][_0x871c('0x37')]));_0x43a703[_0x871c('0x38')]=_0x43a703[_0x871c('0x38')][_0x871c('0x39')]?_0x43a703[_0x871c('0x38')]:_0x330403[_0x871c('0x32')];_0x43a703['order']=qs[_0x871c('0x3c')](_0x5b66d6[_0x871c('0x33')][_0x871c('0x3c')]);_0x43a703['where']=qs[_0x871c('0x35')](_['pick'](_0x5b66d6[_0x871c('0x33')],_0x330403[_0x871c('0x35')]));if(_0x5b66d6[_0x871c('0x33')][_0x871c('0x3f')]){_0x43a703[_0x871c('0x3d')]=_[_0x871c('0x40')](_0x43a703['where'],{'$or':_[_0x871c('0x2e')](_0x43a703[_0x871c('0x38')],function(_0x26660a){var _0x3f0f41={};_0x3f0f41[_0x26660a]={'$like':'%'+_0x5b66d6[_0x871c('0x33')][_0x871c('0x3f')]+'%'};return _0x3f0f41;})});}_0x43a703=_[_0x871c('0x40')]({},_0x43a703,_0x5b66d6[_0x871c('0x43')]);return _0x4b1b8a[_0x871c('0x84')](_0x43a703);}})[_0x871c('0x27')](function(_0x45bf66){if(_0x45bf66){_0x17c40d=_0x45bf66[_0x871c('0x39')];if(!_0x5b66d6[_0x871c('0x33')][_0x871c('0x3a')](_0x871c('0x85'))){_0x43a703[_0x871c('0x21')]=qs[_0x871c('0x21')](_0x5b66d6[_0x871c('0x33')][_0x871c('0x21')]);_0x43a703[_0x871c('0x1e')]=qs[_0x871c('0x1e')](_0x5b66d6[_0x871c('0x33')][_0x871c('0x1e')]);}return _0x4b1b8a[_0x871c('0x84')](_0x43a703);}})[_0x871c('0x27')](function(_0x4e383b){if(_0x4e383b){return _0x4e383b?{'count':_0x17c40d,'rows':_0x4e383b}:null;}})['then'](respondWithResult(_0x346831,null))[_0x871c('0x51')](handleError(_0x346831,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 343884d..0a53066 100644 --- a/server/api/openchannelQueue/openchannelQueue.events.js +++ b/server/api/openchannelQueue/openchannelQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x004c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x1d30e4,_0x5e44c7){var _0x416b9e=function(_0x461f04){while(--_0x461f04){_0x1d30e4['push'](_0x1d30e4['shift']());}};_0x416b9e(++_0x5e44c7);}(_0x004c,0x110));var _0xc004=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x004c[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xc004('0x0'));var OpenchannelQueue=require(_0xc004('0x1'))['db'][_0xc004('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc004('0x3')](0x0);var events={'afterCreate':_0xc004('0x4'),'afterUpdate':_0xc004('0x5'),'afterDestroy':_0xc004('0x6')};function emitEvent(_0x2c3a5c){return function(_0x3e4f9f,_0x414827,_0x26b271){OpenchannelQueueEvents[_0xc004('0x7')](_0x2c3a5c+':'+_0x3e4f9f['id'],_0x3e4f9f);OpenchannelQueueEvents[_0xc004('0x7')](_0x2c3a5c,_0x3e4f9f);_0x26b271(null);};}for(var e in events){if(events[_0xc004('0x8')](e)){var event=events[e];OpenchannelQueue[_0xc004('0x9')](e,emitEvent(event));}}module[_0xc004('0xa')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x58af=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','emit'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x58af,0x162));var _0xf58a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x58af[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0xf58a('0x0'));var OpenchannelQueue=require(_0xf58a('0x1'))['db'][_0xf58a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf58a('0x3')](0x0);var events={'afterCreate':_0xf58a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x31ebef){return function(_0x3891db,_0x528f9f,_0x482ce9){OpenchannelQueueEvents[_0xf58a('0x5')](_0x31ebef+':'+_0x3891db['id'],_0x3891db);OpenchannelQueueEvents[_0xf58a('0x5')](_0x31ebef,_0x3891db);_0x482ce9(null);};}for(var e in events){if(events[_0xf58a('0x6')](e)){var event=events[e];OpenchannelQueue[_0xf58a('0x7')](e,emitEvent(event));}}module[_0xf58a('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 5141efe..1bd3024 100644 --- a/server/api/openchannelQueue/openchannelQueue.model.js +++ b/server/api/openchannelQueue/openchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6015=['bluebird','request-promise','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x3f52b4,_0x23081b){var _0xe36166=function(_0x19dddc){while(--_0x19dddc){_0x3f52b4['push'](_0x3f52b4['shift']());}};_0xe36166(++_0x23081b);}(_0x6015,0x1bf));var _0x5601=function(_0x222850,_0x4d1163){_0x222850=_0x222850-0x0;var _0x87ee5b=_0x6015[_0x222850];return _0x87ee5b;};'use strict';var _=require(_0x5601('0x0'));var util=require(_0x5601('0x1'));var logger=require(_0x5601('0x2'))(_0x5601('0x3'));var moment=require('moment');var BPromise=require(_0x5601('0x4'));var rp=require(_0x5601('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5601('0x6'));var attributes=require(_0x5601('0x7'));module[_0x5601('0x8')]=function(_0x297cb1,_0x3425d7){return _0x297cb1[_0x5601('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x5601('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x194e=['rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1e4fc2,_0x49a029){var _0x51fda0=function(_0x32c991){while(--_0x32c991){_0x1e4fc2['push'](_0x1e4fc2['shift']());}};_0x51fda0(++_0x49a029);}(_0x194e,0x14f));var _0xe194=function(_0x8b3dad,_0x5e5c9a){_0x8b3dad=_0x8b3dad-0x0;var _0x462109=_0x194e[_0x8b3dad];return _0x462109;};'use strict';var _=require(_0xe194('0x0'));var util=require(_0xe194('0x1'));var logger=require(_0xe194('0x2'))('api');var moment=require(_0xe194('0x3'));var BPromise=require('bluebird');var rp=require(_0xe194('0x4'));var fs=require('fs');var path=require(_0xe194('0x5'));var rimraf=require(_0xe194('0x6'));var config=require(_0xe194('0x7'));var attributes=require(_0xe194('0x8'));module['exports']=function(_0x1ac97b,_0x11d614){return _0x1ac97b[_0xe194('0x9')](_0xe194('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index e86398c..89b3bd7 100644 --- a/server/api/openchannelQueue/openchannelQueue.rpc.js +++ b/server/api/openchannelQueue/openchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3538=['./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','limit','include','model','attributes','map','debug','find','raw','ShowOpenchannelQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','defaults','redis','localhost','socket.io-emitter'];(function(_0x388f3e,_0x453d03){var _0x57745d=function(_0x2ba62a){while(--_0x2ba62a){_0x388f3e['push'](_0x388f3e['shift']());}};_0x57745d(++_0x453d03);}(_0x3538,0x1a1));var _0x8353=function(_0x38e197,_0x3efb57){_0x38e197=_0x38e197-0x0;var _0x299148=_0x3538[_0x38e197];return _0x299148;};'use strict';var _=require('lodash');var util=require(_0x8353('0x0'));var moment=require(_0x8353('0x1'));var BPromise=require(_0x8353('0x2'));var rs=require(_0x8353('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8353('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8353('0x5'))(_0x8353('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8353('0x7')]['http']({'port':0x232a});config['redis']=_[_0x8353('0x8')](config[_0x8353('0x9')],{'host':_0x8353('0xa'),'port':0x18eb});var socket=require(_0x8353('0xb'))(new Redis(config[_0x8353('0x9')]));require(_0x8353('0xc'))[_0x8353('0xd')](socket);function respondWithRpcPromise(_0x1e5581,_0x5a9a91,_0x10931d){return new BPromise(function(_0x49d7e1,_0x1f54dd){return client['request'](_0x1e5581,_0x10931d)[_0x8353('0xe')](function(_0x1d21fc){logger[_0x8353('0xf')](_0x8353('0x10'),_0x5a9a91,_0x8353('0x11'));logger['debug'](_0x8353('0x12'),_0x5a9a91,_0x8353('0x11'),JSON[_0x8353('0x13')](_0x1d21fc));if(_0x1d21fc[_0x8353('0x14')]){if(_0x1d21fc[_0x8353('0x14')][_0x8353('0x15')]===0x1f4){logger[_0x8353('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x5a9a91,_0x1d21fc[_0x8353('0x14')][_0x8353('0x16')]);return _0x1f54dd(_0x1d21fc[_0x8353('0x14')][_0x8353('0x16')]);}logger[_0x8353('0x14')](_0x8353('0x10'),_0x5a9a91,_0x1d21fc[_0x8353('0x14')][_0x8353('0x16')]);return _0x49d7e1(_0x1d21fc['error'][_0x8353('0x16')]);}else{logger[_0x8353('0xf')](_0x8353('0x10'),_0x5a9a91,'request\x20sent');_0x49d7e1(_0x1d21fc[_0x8353('0x17')][_0x8353('0x16')]);}})[_0x8353('0x18')](function(_0x247a88){logger[_0x8353('0x14')](_0x8353('0x10'),_0x5a9a91,_0x247a88);_0x1f54dd(_0x247a88);});});}exports[_0x8353('0x19')]=function(_0x522216){var _0x5f1396=this;return new Promise(function(_0x5b338d,_0x3d6d09){return db[_0x8353('0x1a')][_0x8353('0x1b')]({'raw':_0x522216[_0x8353('0x1c')]?_0x522216['options']['raw']===undefined?!![]:![]:!![],'where':_0x522216[_0x8353('0x1c')]?_0x522216[_0x8353('0x1c')][_0x8353('0x1d')]||null:null,'attributes':_0x522216[_0x8353('0x1c')]?_0x522216[_0x8353('0x1c')]['attributes']||null:null,'limit':_0x522216[_0x8353('0x1c')]?_0x522216[_0x8353('0x1c')][_0x8353('0x1e')]||null:null,'include':_0x522216['options']?_0x522216[_0x8353('0x1c')][_0x8353('0x1f')]?_['map'](_0x522216[_0x8353('0x1c')][_0x8353('0x1f')],function(_0x2fc465){return{'model':db[_0x2fc465[_0x8353('0x20')]],'as':_0x2fc465['as'],'attributes':_0x2fc465[_0x8353('0x21')],'include':_0x2fc465[_0x8353('0x1f')]?_[_0x8353('0x22')](_0x2fc465[_0x8353('0x1f')],function(_0x5ba83e){return{'model':db[_0x5ba83e[_0x8353('0x20')]],'as':_0x5ba83e['as'],'attributes':_0x5ba83e[_0x8353('0x21')],'include':_0x5ba83e[_0x8353('0x1f')]?_['map'](_0x5ba83e[_0x8353('0x1f')],function(_0x4617fa){return{'model':db[_0x4617fa[_0x8353('0x20')]],'as':_0x4617fa['as'],'attributes':_0x4617fa[_0x8353('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8353('0xe')](function(_0x874c0a){logger[_0x8353('0xf')](_0x8353('0x19'),_0x522216);logger[_0x8353('0x23')]('GetOpenchannelQueue',_0x522216,JSON[_0x8353('0x13')](_0x874c0a));_0x5b338d(_0x874c0a);})['catch'](function(_0x2c0561){logger['error'](_0x8353('0x19'),_0x2c0561[_0x8353('0x16')],_0x522216);_0x3d6d09(_0x5f1396['error'](0x1f4,_0x2c0561[_0x8353('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x33f585){var _0x1fb6a8=this;return new Promise(function(_0x34245e,_0x16e891){return db[_0x8353('0x1a')][_0x8353('0x24')]({'raw':_0x33f585[_0x8353('0x1c')]?_0x33f585[_0x8353('0x1c')][_0x8353('0x25')]===undefined?!![]:![]:!![],'where':_0x33f585[_0x8353('0x1c')]?_0x33f585['options']['where']||null:null,'attributes':_0x33f585['options']?_0x33f585[_0x8353('0x1c')]['attributes']||null:null,'include':_0x33f585[_0x8353('0x1c')]?_0x33f585['options']['include']?_['map'](_0x33f585[_0x8353('0x1c')][_0x8353('0x1f')],function(_0x322e15){return{'model':db[_0x322e15[_0x8353('0x20')]],'as':_0x322e15['as'],'attributes':_0x322e15[_0x8353('0x21')],'include':_0x322e15['include']?_[_0x8353('0x22')](_0x322e15[_0x8353('0x1f')],function(_0x29bc3d){return{'model':db[_0x29bc3d[_0x8353('0x20')]],'as':_0x29bc3d['as'],'attributes':_0x29bc3d[_0x8353('0x21')],'include':_0x29bc3d[_0x8353('0x1f')]?_[_0x8353('0x22')](_0x29bc3d[_0x8353('0x1f')],function(_0x463781){return{'model':db[_0x463781[_0x8353('0x20')]],'as':_0x463781['as'],'attributes':_0x463781[_0x8353('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8353('0xe')](function(_0x366dca){logger[_0x8353('0xf')](_0x8353('0x26'),_0x33f585);logger[_0x8353('0x23')](_0x8353('0x26'),_0x33f585,JSON['stringify'](_0x366dca));_0x34245e(_0x366dca);})[_0x8353('0x18')](function(_0x23ce64){logger[_0x8353('0x14')](_0x8353('0x26'),_0x23ce64['message'],_0x33f585);_0x16e891(_0x1fb6a8['error'](0x1f4,_0x23ce64[_0x8353('0x16')]));});});}; \ No newline at end of file +var _0xea60=['info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','model','include','ShowOpenchannelQueue','OpenchannelQueue','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x277dd2,_0x1cd1ce){var _0x399b6e=function(_0x31c215){while(--_0x31c215){_0x277dd2['push'](_0x277dd2['shift']());}};_0x399b6e(++_0x1cd1ce);}(_0xea60,0x19a));var _0x0ea6=function(_0x6baaf,_0x51e460){_0x6baaf=_0x6baaf-0x0;var _0x2e1351=_0xea60[_0x6baaf];return _0x2e1351;};'use strict';var _=require(_0x0ea6('0x0'));var util=require(_0x0ea6('0x1'));var moment=require(_0x0ea6('0x2'));var BPromise=require(_0x0ea6('0x3'));var rs=require(_0x0ea6('0x4'));var fs=require('fs');var Redis=require(_0x0ea6('0x5'));var db=require(_0x0ea6('0x6'))['db'];var utils=require(_0x0ea6('0x7'));var logger=require(_0x0ea6('0x8'))(_0x0ea6('0x9'));var config=require(_0x0ea6('0xa'));var jayson=require(_0x0ea6('0xb'));var client=jayson['client'][_0x0ea6('0xc')]({'port':0x232a});config['redis']=_[_0x0ea6('0xd')](config[_0x0ea6('0xe')],{'host':_0x0ea6('0xf'),'port':0x18eb});var socket=require(_0x0ea6('0x10'))(new Redis(config[_0x0ea6('0xe')]));require('./openchannelQueue.socket')[_0x0ea6('0x11')](socket);function respondWithRpcPromise(_0x1ddf3f,_0x2653d1,_0x1860aa){return new BPromise(function(_0x3b3a9c,_0x5195ef){return client[_0x0ea6('0x12')](_0x1ddf3f,_0x1860aa)[_0x0ea6('0x13')](function(_0xd593ae){logger[_0x0ea6('0x14')](_0x0ea6('0x15'),_0x2653d1,_0x0ea6('0x16'));logger[_0x0ea6('0x17')](_0x0ea6('0x18'),_0x2653d1,_0x0ea6('0x16'),JSON[_0x0ea6('0x19')](_0xd593ae));if(_0xd593ae[_0x0ea6('0x1a')]){if(_0xd593ae[_0x0ea6('0x1a')][_0x0ea6('0x1b')]===0x1f4){logger[_0x0ea6('0x1a')](_0x0ea6('0x15'),_0x2653d1,_0xd593ae[_0x0ea6('0x1a')][_0x0ea6('0x1c')]);return _0x5195ef(_0xd593ae[_0x0ea6('0x1a')][_0x0ea6('0x1c')]);}logger[_0x0ea6('0x1a')](_0x0ea6('0x15'),_0x2653d1,_0xd593ae[_0x0ea6('0x1a')]['message']);return _0x3b3a9c(_0xd593ae[_0x0ea6('0x1a')][_0x0ea6('0x1c')]);}else{logger[_0x0ea6('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x2653d1,_0x0ea6('0x16'));_0x3b3a9c(_0xd593ae[_0x0ea6('0x1d')][_0x0ea6('0x1c')]);}})[_0x0ea6('0x1e')](function(_0x244afd){logger[_0x0ea6('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0x2653d1,_0x244afd);_0x5195ef(_0x244afd);});});}exports[_0x0ea6('0x1f')]=function(_0x489ff0){var _0x5e8dc8=this;return new Promise(function(_0x3486ce,_0x55d3c9){return db['OpenchannelQueue'][_0x0ea6('0x20')]({'raw':_0x489ff0[_0x0ea6('0x21')]?_0x489ff0[_0x0ea6('0x21')][_0x0ea6('0x22')]===undefined?!![]:![]:!![],'where':_0x489ff0[_0x0ea6('0x21')]?_0x489ff0[_0x0ea6('0x21')][_0x0ea6('0x23')]||null:null,'attributes':_0x489ff0[_0x0ea6('0x21')]?_0x489ff0['options'][_0x0ea6('0x24')]||null:null,'limit':_0x489ff0[_0x0ea6('0x21')]?_0x489ff0['options']['limit']||null:null,'include':_0x489ff0[_0x0ea6('0x21')]?_0x489ff0['options']['include']?_['map'](_0x489ff0[_0x0ea6('0x21')]['include'],function(_0x18d52f){return{'model':db[_0x18d52f[_0x0ea6('0x25')]],'as':_0x18d52f['as'],'attributes':_0x18d52f[_0x0ea6('0x24')],'include':_0x18d52f[_0x0ea6('0x26')]?_['map'](_0x18d52f[_0x0ea6('0x26')],function(_0x26b61f){return{'model':db[_0x26b61f[_0x0ea6('0x25')]],'as':_0x26b61f['as'],'attributes':_0x26b61f[_0x0ea6('0x24')],'include':_0x26b61f[_0x0ea6('0x26')]?_['map'](_0x26b61f[_0x0ea6('0x26')],function(_0x5ea7f7){return{'model':db[_0x5ea7f7['model']],'as':_0x5ea7f7['as'],'attributes':_0x5ea7f7[_0x0ea6('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0ea6('0x13')](function(_0x4d21a1){logger[_0x0ea6('0x14')](_0x0ea6('0x1f'),_0x489ff0);logger[_0x0ea6('0x17')]('GetOpenchannelQueue',_0x489ff0,JSON['stringify'](_0x4d21a1));_0x3486ce(_0x4d21a1);})[_0x0ea6('0x1e')](function(_0x2334c2){logger[_0x0ea6('0x1a')](_0x0ea6('0x1f'),_0x2334c2[_0x0ea6('0x1c')],_0x489ff0);_0x55d3c9(_0x5e8dc8[_0x0ea6('0x1a')](0x1f4,_0x2334c2[_0x0ea6('0x1c')]));});});};exports[_0x0ea6('0x27')]=function(_0x24daa3){var _0x435619=this;return new Promise(function(_0x2ad07d,_0xb60eff){return db[_0x0ea6('0x28')][_0x0ea6('0x29')]({'raw':_0x24daa3[_0x0ea6('0x21')]?_0x24daa3['options']['raw']===undefined?!![]:![]:!![],'where':_0x24daa3['options']?_0x24daa3[_0x0ea6('0x21')][_0x0ea6('0x23')]||null:null,'attributes':_0x24daa3[_0x0ea6('0x21')]?_0x24daa3['options'][_0x0ea6('0x24')]||null:null,'include':_0x24daa3[_0x0ea6('0x21')]?_0x24daa3[_0x0ea6('0x21')][_0x0ea6('0x26')]?_[_0x0ea6('0x2a')](_0x24daa3[_0x0ea6('0x21')][_0x0ea6('0x26')],function(_0x449b7f){return{'model':db[_0x449b7f[_0x0ea6('0x25')]],'as':_0x449b7f['as'],'attributes':_0x449b7f[_0x0ea6('0x24')],'include':_0x449b7f[_0x0ea6('0x26')]?_['map'](_0x449b7f[_0x0ea6('0x26')],function(_0x6ee387){return{'model':db[_0x6ee387[_0x0ea6('0x25')]],'as':_0x6ee387['as'],'attributes':_0x6ee387[_0x0ea6('0x24')],'include':_0x6ee387[_0x0ea6('0x26')]?_[_0x0ea6('0x2a')](_0x6ee387[_0x0ea6('0x26')],function(_0xad7738){return{'model':db[_0xad7738['model']],'as':_0xad7738['as'],'attributes':_0xad7738[_0x0ea6('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0ea6('0x13')](function(_0x1224c1){logger[_0x0ea6('0x14')](_0x0ea6('0x27'),_0x24daa3);logger[_0x0ea6('0x17')](_0x0ea6('0x27'),_0x24daa3,JSON[_0x0ea6('0x19')](_0x1224c1));_0x2ad07d(_0x1224c1);})[_0x0ea6('0x1e')](function(_0x5e63f1){logger['error'](_0x0ea6('0x27'),_0x5e63f1[_0x0ea6('0x1c')],_0x24daa3);_0xb60eff(_0x435619['error'](0x1f4,_0x5e63f1[_0x0ea6('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 36c1a7d..466512e 100644 --- a/server/api/openchannelQueue/openchannelQueue.socket.js +++ b/server/api/openchannelQueue/openchannelQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6f5=['register','./openchannelQueue.events','save','remove','update','emit'];(function(_0x9ddad9,_0x4d475c){var _0x363c96=function(_0x5954bb){while(--_0x5954bb){_0x9ddad9['push'](_0x9ddad9['shift']());}};_0x363c96(++_0x4d475c);}(_0xe6f5,0x1e7));var _0x5e6f=function(_0x115faa,_0x5cd9a8){_0x115faa=_0x115faa-0x0;var _0x499e59=_0xe6f5[_0x115faa];return _0x499e59;};'use strict';var OpenchannelQueueEvents=require(_0x5e6f('0x0'));var events=[_0x5e6f('0x1'),_0x5e6f('0x2'),_0x5e6f('0x3')];function createListener(_0x11e3dd,_0x227250){return function(_0x801841){_0x227250[_0x5e6f('0x4')](_0x11e3dd,_0x801841);};}function removeListener(_0x29a7f9,_0x338835){return function(){OpenchannelQueueEvents['removeListener'](_0x29a7f9,_0x338835);};}exports[_0x5e6f('0x5')]=function(_0x3a8192){for(var _0x1c0a2f=0x0,_0x2193c8=events['length'];_0x1c0a2f<_0x2193c8;_0x1c0a2f++){var _0xf1d7fb=events[_0x1c0a2f];var _0x772191=createListener('openchannelQueue:'+_0xf1d7fb,_0x3a8192);OpenchannelQueueEvents['on'](_0xf1d7fb,_0x772191);}}; \ No newline at end of file +var _0x220d=['removeListener','length','./openchannelQueue.events','save','emit'];(function(_0x5ad67c,_0x144860){var _0xccce2e=function(_0x2dd95c){while(--_0x2dd95c){_0x5ad67c['push'](_0x5ad67c['shift']());}};_0xccce2e(++_0x144860);}(_0x220d,0xe3));var _0xd220=function(_0x5d6b75,_0x48aa6f){_0x5d6b75=_0x5d6b75-0x0;var _0x1db122=_0x220d[_0x5d6b75];return _0x1db122;};'use strict';var OpenchannelQueueEvents=require(_0xd220('0x0'));var events=[_0xd220('0x1'),'remove','update'];function createListener(_0x295f17,_0x71b44a){return function(_0x2c3490){_0x71b44a[_0xd220('0x2')](_0x295f17,_0x2c3490);};}function removeListener(_0x2f96dc,_0x1b65aa){return function(){OpenchannelQueueEvents[_0xd220('0x3')](_0x2f96dc,_0x1b65aa);};}exports['register']=function(_0x1a51b2){for(var _0x53b411=0x0,_0x5bd0d4=events[_0xd220('0x4')];_0x53b411<_0x5bd0d4;_0x53b411++){var _0x2c30c5=events[_0x53b411];var _0x33319f=createListener('openchannelQueue:'+_0x2c30c5,_0x1a51b2);OpenchannelQueueEvents['on'](_0x2c30c5,_0x33319f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 6141ca2..a7f8d88 100644 --- a/server/api/openchannelQueueReport/index.js +++ b/server/api/openchannelQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6084=['./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x28c89b,_0x2510b3){var _0x176500=function(_0x3dfee2){while(--_0x3dfee2){_0x28c89b['push'](_0x28c89b['shift']());}};_0x176500(++_0x2510b3);}(_0x6084,0xdf));var _0x4608=function(_0x36563d,_0x24d901){_0x36563d=_0x36563d-0x0;var _0x2116e6=_0x6084[_0x36563d];return _0x2116e6;};'use strict';var multer=require(_0x4608('0x0'));var util=require(_0x4608('0x1'));var path=require(_0x4608('0x2'));var timeout=require('connect-timeout');var express=require(_0x4608('0x3'));var router=express[_0x4608('0x4')]();var fs_extra=require(_0x4608('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4608('0x6'));var config=require(_0x4608('0x7'));var controller=require(_0x4608('0x8'));router[_0x4608('0x9')]('/',auth[_0x4608('0xa')](),controller[_0x4608('0xb')]);router[_0x4608('0x9')](_0x4608('0xc'),auth[_0x4608('0xa')](),controller[_0x4608('0xd')]);router['get'](_0x4608('0xe'),auth['isAuthenticated'](),controller[_0x4608('0xf')]);router['post']('/',auth[_0x4608('0xa')](),controller[_0x4608('0x10')]);router['put'](_0x4608('0xe'),auth[_0x4608('0xa')](),controller[_0x4608('0x11')]);router[_0x4608('0x12')](_0x4608('0xe'),auth[_0x4608('0xa')](),controller[_0x4608('0x13')]);module[_0x4608('0x14')]=router; \ No newline at end of file +var _0xba11=['get','describe','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xba11,0xfb));var _0x1ba1=function(_0x4648e2,_0x38b3a2){_0x4648e2=_0x4648e2-0x0;var _0x4e6005=_0xba11[_0x4648e2];return _0x4e6005;};'use strict';var multer=require('multer');var util=require(_0x1ba1('0x0'));var path=require(_0x1ba1('0x1'));var timeout=require(_0x1ba1('0x2'));var express=require(_0x1ba1('0x3'));var router=express['Router']();var fs_extra=require(_0x1ba1('0x4'));var auth=require(_0x1ba1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1ba1('0x6'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x1ba1('0x7')](),controller[_0x1ba1('0x8')]);router[_0x1ba1('0x9')]('/describe',auth[_0x1ba1('0x7')](),controller[_0x1ba1('0xa')]);router[_0x1ba1('0x9')]('/:id',auth[_0x1ba1('0x7')](),controller[_0x1ba1('0xb')]);router[_0x1ba1('0xc')]('/',auth[_0x1ba1('0x7')](),controller[_0x1ba1('0xd')]);router[_0x1ba1('0xe')](_0x1ba1('0xf'),auth[_0x1ba1('0x7')](),controller[_0x1ba1('0x10')]);router[_0x1ba1('0x11')](_0x1ba1('0xf'),auth[_0x1ba1('0x7')](),controller[_0x1ba1('0x12')]);module[_0x1ba1('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 36bfdbe..5409220 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5daf=['STRING','DATE','moment','sequelize'];(function(_0x372bff,_0x2bb900){var _0x25b72b=function(_0x37e576){while(--_0x37e576){_0x372bff['push'](_0x372bff['shift']());}};_0x25b72b(++_0x2bb900);}(_0x5daf,0x19a));var _0xf5da=function(_0x2c9ebf,_0x466637){_0x2c9ebf=_0x2c9ebf-0x0;var _0x3d65a1=_0x5daf[_0x2c9ebf];return _0x3d65a1;};'use strict';var moment=require(_0xf5da('0x0'));var Sequelize=require(_0xf5da('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xf5da('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf5da('0x2')]},'joinAt':{'type':Sequelize[_0xf5da('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf5da('0x3')]},'reason':{'type':Sequelize[_0xf5da('0x2')]}}; \ No newline at end of file +var _0xad05=['moment','sequelize','exports','STRING','DATE'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xad05,0x96));var _0x5ad0=function(_0x44474f,_0x431580){_0x44474f=_0x44474f-0x0;var _0x427d97=_0xad05[_0x44474f];return _0x427d97;};'use strict';var moment=require(_0x5ad0('0x0'));var Sequelize=require(_0x5ad0('0x1'));module[_0x5ad0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5ad0('0x3')]},'joinAt':{'type':Sequelize[_0x5ad0('0x4')]},'leaveAt':{'type':Sequelize[_0x5ad0('0x4')]},'acceptAt':{'type':Sequelize[_0x5ad0('0x4')]},'exitAt':{'type':Sequelize[_0x5ad0('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index c3e66ca..e762f7c 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe42=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x3fa8af,_0x413ef6){var _0x516293=function(_0x1c140c){while(--_0x1c140c){_0x3fa8af['push'](_0x3fa8af['shift']());}};_0x516293(++_0x413ef6);}(_0xfe42,0xd4));var _0x2fe4=function(_0x1de5b9,_0x3bc9f6){_0x1de5b9=_0x1de5b9-0x0;var _0x39d50d=_0xfe42[_0x1de5b9];return _0x39d50d;};'use strict';var emlformat=require(_0x2fe4('0x0'));var rimraf=require(_0x2fe4('0x1'));var zipdir=require(_0x2fe4('0x2'));var jsonpatch=require(_0x2fe4('0x3'));var rp=require(_0x2fe4('0x4'));var moment=require('moment');var BPromise=require(_0x2fe4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2fe4('0x6'));var sox=require(_0x2fe4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fe4('0x8'));var _=require(_0x2fe4('0x9'));var squel=require(_0x2fe4('0xa'));var crypto=require(_0x2fe4('0xb'));var jsforce=require(_0x2fe4('0xc'));var deskjs=require(_0x2fe4('0xd'));var toCsv=require(_0x2fe4('0xe'));var querystring=require(_0x2fe4('0xf'));var Papa=require(_0x2fe4('0x10'));var Redis=require('ioredis');var authService=require(_0x2fe4('0x11'));var qs=require(_0x2fe4('0x12'));var as=require(_0x2fe4('0x13'));var hardwareService=require(_0x2fe4('0x14'));var logger=require(_0x2fe4('0x15'))('api');var utils=require(_0x2fe4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2fe4('0x17'));var db=require(_0x2fe4('0x18'))['db'];function respondWithStatusCode(_0x47c162,_0x46d223){_0x46d223=_0x46d223||0xcc;return function(_0x185cef){if(_0x185cef){return _0x47c162[_0x2fe4('0x19')](_0x46d223);}return _0x47c162[_0x2fe4('0x1a')](_0x46d223)[_0x2fe4('0x1b')]();};}function respondWithResult(_0xc64d55,_0x98b189){_0x98b189=_0x98b189||0xc8;return function(_0x1786e7){if(_0x1786e7){return _0xc64d55[_0x2fe4('0x1a')](_0x98b189)['json'](_0x1786e7);}};}function respondWithFilteredResult(_0x5638ce,_0x120e55){return function(_0x3b05aa){if(_0x3b05aa){var _0x16d152=typeof _0x120e55[_0x2fe4('0x1c')]===_0x2fe4('0x1d')&&typeof _0x120e55[_0x2fe4('0x1e')]===_0x2fe4('0x1d');var _0x33b302=_0x3b05aa[_0x2fe4('0x1f')];var _0x69cd31=_0x16d152?0x0:_0x120e55[_0x2fe4('0x1c')];var _0x1a54ed=_0x16d152?_0x3b05aa[_0x2fe4('0x1f')]:_0x120e55[_0x2fe4('0x1c')]+_0x120e55[_0x2fe4('0x1e')];var _0x12adc0;if(_0x1a54ed>=_0x33b302){_0x1a54ed=_0x33b302;_0x12adc0=0xc8;}else{_0x12adc0=0xce;}_0x5638ce['status'](_0x12adc0);return _0x5638ce[_0x2fe4('0x20')]('Content-Range',_0x69cd31+'-'+_0x1a54ed+'/'+_0x33b302)[_0x2fe4('0x21')](_0x3b05aa);}return null;};}function patchUpdates(_0x2dc79b){return function(_0x42e5a0){try{jsonpatch[_0x2fe4('0x22')](_0x42e5a0,_0x2dc79b,!![]);}catch(_0x32c181){return BPromise[_0x2fe4('0x23')](_0x32c181);}return _0x42e5a0[_0x2fe4('0x24')]();};}function saveUpdates(_0x5434e8,_0x3ea9d7){return function(_0x9264dd){if(_0x9264dd){return _0x9264dd['update'](_0x5434e8)[_0x2fe4('0x25')](function(_0x133c94){return _0x133c94;});}return null;};}function removeEntity(_0x26ff21,_0x1b1076){return function(_0x4662d0){if(_0x4662d0){return _0x4662d0['destroy']()['then'](function(){_0x26ff21[_0x2fe4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x460e2c,_0x282368){return function(_0x497371){if(!_0x497371){_0x460e2c[_0x2fe4('0x19')](0x194);}return _0x497371;};}function handleError(_0x405194,_0x88fa80){_0x88fa80=_0x88fa80||0x1f4;return function(_0x5ad0bb){logger[_0x2fe4('0x26')](_0x5ad0bb[_0x2fe4('0x27')]);if(_0x5ad0bb[_0x2fe4('0x28')]){delete _0x5ad0bb[_0x2fe4('0x28')];}_0x405194[_0x2fe4('0x1a')](_0x88fa80)['send'](_0x5ad0bb);};}exports[_0x2fe4('0x29')]=function(_0x1cc3c6,_0x576f16){var _0x597acf={},_0x5dc6f6={},_0x3e1fce={'count':0x0,'rows':[]};var _0x39dcea=_[_0x2fe4('0x2a')](db[_0x2fe4('0x2b')][_0x2fe4('0x2c')],function(_0x336265){return{'name':_0x336265[_0x2fe4('0x2d')],'type':_0x336265[_0x2fe4('0x2e')][_0x2fe4('0x2f')]};});_0x5dc6f6[_0x2fe4('0x30')]=_['map'](_0x39dcea,'name');_0x5dc6f6[_0x2fe4('0x31')]=_[_0x2fe4('0x32')](_0x1cc3c6[_0x2fe4('0x31')]);_0x5dc6f6[_0x2fe4('0x33')]=_[_0x2fe4('0x34')](_0x5dc6f6[_0x2fe4('0x30')],_0x5dc6f6['query']);_0x597acf[_0x2fe4('0x35')]=_[_0x2fe4('0x34')](_0x5dc6f6[_0x2fe4('0x30')],qs['fields'](_0x1cc3c6[_0x2fe4('0x31')][_0x2fe4('0x36')]));_0x597acf[_0x2fe4('0x35')]=_0x597acf[_0x2fe4('0x35')]['length']?_0x597acf[_0x2fe4('0x35')]:_0x5dc6f6[_0x2fe4('0x30')];if(!_0x1cc3c6[_0x2fe4('0x31')]['hasOwnProperty'](_0x2fe4('0x37'))){_0x597acf[_0x2fe4('0x1e')]=qs[_0x2fe4('0x1e')](_0x1cc3c6[_0x2fe4('0x31')][_0x2fe4('0x1e')]);_0x597acf['offset']=qs[_0x2fe4('0x1c')](_0x1cc3c6[_0x2fe4('0x31')][_0x2fe4('0x1c')]);}_0x597acf[_0x2fe4('0x38')]=qs[_0x2fe4('0x39')](_0x1cc3c6[_0x2fe4('0x31')]['sort']);_0x597acf['where']=qs[_0x2fe4('0x33')](_[_0x2fe4('0x3a')](_0x1cc3c6[_0x2fe4('0x31')],_0x5dc6f6['filters']),_0x39dcea);if(_0x1cc3c6[_0x2fe4('0x31')]['filter']){_0x597acf['where']=_[_0x2fe4('0x3b')](_0x597acf[_0x2fe4('0x3c')],{'$or':_['map'](_0x39dcea,function(_0x31c1ba){if(_0x31c1ba[_0x2fe4('0x2e')]!==_0x2fe4('0x3d')){var _0x2e4070={};_0x2e4070[_0x31c1ba['name']]={'$like':'%'+_0x1cc3c6[_0x2fe4('0x31')][_0x2fe4('0x3e')]+'%'};return _0x2e4070;}})});}_0x597acf=_[_0x2fe4('0x3b')]({},_0x597acf,_0x1cc3c6[_0x2fe4('0x3f')]);var _0x2e4755={'where':_0x597acf[_0x2fe4('0x3c')]};return db['OpenchannelQueueReport'][_0x2fe4('0x1f')](_0x2e4755)[_0x2fe4('0x25')](function(_0x3145c2){_0x3e1fce[_0x2fe4('0x1f')]=_0x3145c2;if(_0x1cc3c6[_0x2fe4('0x31')][_0x2fe4('0x40')]){_0x597acf[_0x2fe4('0x41')]=[{'all':!![]}];}return db[_0x2fe4('0x2b')][_0x2fe4('0x42')](_0x597acf);})[_0x2fe4('0x25')](function(_0x1b1968){_0x3e1fce[_0x2fe4('0x43')]=_0x1b1968;return _0x3e1fce;})[_0x2fe4('0x25')](respondWithFilteredResult(_0x576f16,_0x597acf))[_0x2fe4('0x44')](handleError(_0x576f16,null));};exports[_0x2fe4('0x45')]=function(_0x4112f9,_0x446aca){var _0x36a338={'raw':!![],'where':{'id':_0x4112f9[_0x2fe4('0x46')]['id']}},_0x107348={};_0x107348[_0x2fe4('0x30')]=_[_0x2fe4('0x32')](db[_0x2fe4('0x2b')][_0x2fe4('0x2c')]);_0x107348[_0x2fe4('0x31')]=_[_0x2fe4('0x32')](_0x4112f9[_0x2fe4('0x31')]);_0x107348[_0x2fe4('0x33')]=_['intersection'](_0x107348[_0x2fe4('0x30')],_0x107348[_0x2fe4('0x31')]);_0x36a338[_0x2fe4('0x35')]=_['intersection'](_0x107348[_0x2fe4('0x30')],qs[_0x2fe4('0x36')](_0x4112f9[_0x2fe4('0x31')]['fields']));_0x36a338['attributes']=_0x36a338[_0x2fe4('0x35')]['length']?_0x36a338[_0x2fe4('0x35')]:_0x107348[_0x2fe4('0x30')];if(_0x4112f9[_0x2fe4('0x31')]['includeAll']){_0x36a338['include']=[{'all':!![]}];}_0x36a338=_[_0x2fe4('0x3b')]({},_0x36a338,_0x4112f9['options']);return db[_0x2fe4('0x2b')][_0x2fe4('0x47')](_0x36a338)[_0x2fe4('0x25')](handleEntityNotFound(_0x446aca,null))['then'](respondWithResult(_0x446aca,null))[_0x2fe4('0x44')](handleError(_0x446aca,null));};exports[_0x2fe4('0x48')]=function(_0x5b7be2,_0x154f67){return db['OpenchannelQueueReport'][_0x2fe4('0x48')](_0x5b7be2[_0x2fe4('0x49')],{})[_0x2fe4('0x25')](respondWithResult(_0x154f67,0xc9))['catch'](handleError(_0x154f67,null));};exports['update']=function(_0x4bf39a,_0xfb49cb){if(_0x4bf39a[_0x2fe4('0x49')]['id']){delete _0x4bf39a[_0x2fe4('0x49')]['id'];}return db[_0x2fe4('0x2b')]['find']({'where':{'id':_0x4bf39a[_0x2fe4('0x46')]['id']}})[_0x2fe4('0x25')](handleEntityNotFound(_0xfb49cb,null))[_0x2fe4('0x25')](saveUpdates(_0x4bf39a[_0x2fe4('0x49')],null))[_0x2fe4('0x25')](respondWithResult(_0xfb49cb,null))[_0x2fe4('0x44')](handleError(_0xfb49cb,null));};exports[_0x2fe4('0x4a')]=function(_0xb863ad,_0x351e4d){return db[_0x2fe4('0x2b')][_0x2fe4('0x47')]({'where':{'id':_0xb863ad['params']['id']}})['then'](handleEntityNotFound(_0x351e4d,null))[_0x2fe4('0x25')](removeEntity(_0x351e4d,null))['catch'](handleError(_0x351e4d,null));};exports['describe']=function(_0xad044b,_0x3456a5){return db['OpenchannelQueueReport'][_0x2fe4('0x4b')]()['then'](respondWithResult(_0x3456a5,null))[_0x2fe4('0x44')](handleError(_0x3456a5,null));}; \ No newline at end of file +var _0x1832=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','catch','show','params','includeAll','options','find','create','body','update','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x493a3c,_0x424b3f){var _0x3343b4=function(_0x1228fe){while(--_0x1228fe){_0x493a3c['push'](_0x493a3c['shift']());}};_0x3343b4(++_0x424b3f);}(_0x1832,0xcd));var _0x2183=function(_0x10e147,_0x401dc5){_0x10e147=_0x10e147-0x0;var _0x3c95aa=_0x1832[_0x10e147];return _0x3c95aa;};'use strict';var emlformat=require(_0x2183('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2183('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2183('0x2'));var BPromise=require(_0x2183('0x3'));var Mustache=require(_0x2183('0x4'));var util=require(_0x2183('0x5'));var path=require(_0x2183('0x6'));var sox=require(_0x2183('0x7'));var csv=require(_0x2183('0x8'));var ejs=require(_0x2183('0x9'));var fs=require('fs');var fs_extra=require(_0x2183('0xa'));var _=require(_0x2183('0xb'));var squel=require(_0x2183('0xc'));var crypto=require(_0x2183('0xd'));var jsforce=require(_0x2183('0xe'));var deskjs=require(_0x2183('0xf'));var toCsv=require(_0x2183('0x8'));var querystring=require(_0x2183('0x10'));var Papa=require('papaparse');var Redis=require(_0x2183('0x11'));var authService=require(_0x2183('0x12'));var qs=require(_0x2183('0x13'));var as=require(_0x2183('0x14'));var hardwareService=require(_0x2183('0x15'));var logger=require(_0x2183('0x16'))(_0x2183('0x17'));var utils=require(_0x2183('0x18'));var config=require(_0x2183('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2183('0x1a'))['db'];function respondWithStatusCode(_0x2e62e6,_0x26a248){_0x26a248=_0x26a248||0xcc;return function(_0x50bedc){if(_0x50bedc){return _0x2e62e6[_0x2183('0x1b')](_0x26a248);}return _0x2e62e6[_0x2183('0x1c')](_0x26a248)[_0x2183('0x1d')]();};}function respondWithResult(_0x15babb,_0x217ee8){_0x217ee8=_0x217ee8||0xc8;return function(_0x202c1a){if(_0x202c1a){return _0x15babb[_0x2183('0x1c')](_0x217ee8)[_0x2183('0x1e')](_0x202c1a);}};}function respondWithFilteredResult(_0x3e9b83,_0x2d5abd){return function(_0x3d4722){if(_0x3d4722){var _0x3e5982=typeof _0x2d5abd[_0x2183('0x1f')]===_0x2183('0x20')&&typeof _0x2d5abd[_0x2183('0x21')]==='undefined';var _0x50bf32=_0x3d4722['count'];var _0x4407da=_0x3e5982?0x0:_0x2d5abd[_0x2183('0x1f')];var _0x3657fd=_0x3e5982?_0x3d4722[_0x2183('0x22')]:_0x2d5abd[_0x2183('0x1f')]+_0x2d5abd['limit'];var _0x3196f0;if(_0x3657fd>=_0x50bf32){_0x3657fd=_0x50bf32;_0x3196f0=0xc8;}else{_0x3196f0=0xce;}_0x3e9b83[_0x2183('0x1c')](_0x3196f0);return _0x3e9b83[_0x2183('0x23')](_0x2183('0x24'),_0x4407da+'-'+_0x3657fd+'/'+_0x50bf32)[_0x2183('0x1e')](_0x3d4722);}return null;};}function patchUpdates(_0x5723a2){return function(_0x11b7c5){try{jsonpatch['apply'](_0x11b7c5,_0x5723a2,!![]);}catch(_0x1a91a7){return BPromise[_0x2183('0x25')](_0x1a91a7);}return _0x11b7c5[_0x2183('0x26')]();};}function saveUpdates(_0xc32c4f,_0x56a9c2){return function(_0x5440f1){if(_0x5440f1){return _0x5440f1['update'](_0xc32c4f)[_0x2183('0x27')](function(_0x109637){return _0x109637;});}return null;};}function removeEntity(_0x3ed5c3,_0x148dc0){return function(_0x28aa6f){if(_0x28aa6f){return _0x28aa6f[_0x2183('0x28')]()['then'](function(){_0x3ed5c3[_0x2183('0x1c')](0xcc)[_0x2183('0x1d')]();});}};}function handleEntityNotFound(_0x3eab08,_0x4a1b52){return function(_0x2b30c4){if(!_0x2b30c4){_0x3eab08[_0x2183('0x1b')](0x194);}return _0x2b30c4;};}function handleError(_0x58f2a7,_0x1b5fe2){_0x1b5fe2=_0x1b5fe2||0x1f4;return function(_0x58f50e){logger[_0x2183('0x29')](_0x58f50e['stack']);if(_0x58f50e[_0x2183('0x2a')]){delete _0x58f50e[_0x2183('0x2a')];}_0x58f2a7[_0x2183('0x1c')](_0x1b5fe2)['send'](_0x58f50e);};}exports['index']=function(_0x54c745,_0x582540){var _0x46e6b9={},_0x29ac2a={},_0x1f174a={'count':0x0,'rows':[]};var _0x389807=_[_0x2183('0x2b')](db[_0x2183('0x2c')][_0x2183('0x2d')],function(_0x37d733){return{'name':_0x37d733[_0x2183('0x2e')],'type':_0x37d733[_0x2183('0x2f')][_0x2183('0x30')]};});_0x29ac2a[_0x2183('0x31')]=_[_0x2183('0x2b')](_0x389807,'name');_0x29ac2a['query']=_[_0x2183('0x32')](_0x54c745[_0x2183('0x33')]);_0x29ac2a[_0x2183('0x34')]=_[_0x2183('0x35')](_0x29ac2a['model'],_0x29ac2a['query']);_0x46e6b9[_0x2183('0x36')]=_[_0x2183('0x35')](_0x29ac2a[_0x2183('0x31')],qs[_0x2183('0x37')](_0x54c745['query'][_0x2183('0x37')]));_0x46e6b9['attributes']=_0x46e6b9[_0x2183('0x36')][_0x2183('0x38')]?_0x46e6b9['attributes']:_0x29ac2a[_0x2183('0x31')];if(!_0x54c745[_0x2183('0x33')][_0x2183('0x39')](_0x2183('0x3a'))){_0x46e6b9[_0x2183('0x21')]=qs[_0x2183('0x21')](_0x54c745[_0x2183('0x33')][_0x2183('0x21')]);_0x46e6b9[_0x2183('0x1f')]=qs[_0x2183('0x1f')](_0x54c745[_0x2183('0x33')][_0x2183('0x1f')]);}_0x46e6b9[_0x2183('0x3b')]=qs[_0x2183('0x3c')](_0x54c745[_0x2183('0x33')]['sort']);_0x46e6b9[_0x2183('0x3d')]=qs[_0x2183('0x34')](_[_0x2183('0x3e')](_0x54c745[_0x2183('0x33')],_0x29ac2a[_0x2183('0x34')]),_0x389807);if(_0x54c745[_0x2183('0x33')]['filter']){_0x46e6b9['where']=_[_0x2183('0x3f')](_0x46e6b9[_0x2183('0x3d')],{'$or':_['map'](_0x389807,function(_0x1728c8){if(_0x1728c8['type']!==_0x2183('0x40')){var _0x4d1dbd={};_0x4d1dbd[_0x1728c8[_0x2183('0x2a')]]={'$like':'%'+_0x54c745[_0x2183('0x33')][_0x2183('0x41')]+'%'};return _0x4d1dbd;}})});}_0x46e6b9=_[_0x2183('0x3f')]({},_0x46e6b9,_0x54c745['options']);var _0x37bd22={'where':_0x46e6b9[_0x2183('0x3d')]};return db['OpenchannelQueueReport']['count'](_0x37bd22)['then'](function(_0x4d4b3d){_0x1f174a['count']=_0x4d4b3d;if(_0x54c745[_0x2183('0x33')]['includeAll']){_0x46e6b9[_0x2183('0x42')]=[{'all':!![]}];}return db[_0x2183('0x2c')]['findAll'](_0x46e6b9);})[_0x2183('0x27')](function(_0x3b885b){_0x1f174a['rows']=_0x3b885b;return _0x1f174a;})[_0x2183('0x27')](respondWithFilteredResult(_0x582540,_0x46e6b9))[_0x2183('0x43')](handleError(_0x582540,null));};exports[_0x2183('0x44')]=function(_0x991eef,_0x32ee2a){var _0xb5587b={'raw':!![],'where':{'id':_0x991eef[_0x2183('0x45')]['id']}},_0x8e03bc={};_0x8e03bc[_0x2183('0x31')]=_[_0x2183('0x32')](db[_0x2183('0x2c')][_0x2183('0x2d')]);_0x8e03bc[_0x2183('0x33')]=_[_0x2183('0x32')](_0x991eef[_0x2183('0x33')]);_0x8e03bc[_0x2183('0x34')]=_['intersection'](_0x8e03bc[_0x2183('0x31')],_0x8e03bc[_0x2183('0x33')]);_0xb5587b[_0x2183('0x36')]=_['intersection'](_0x8e03bc['model'],qs[_0x2183('0x37')](_0x991eef[_0x2183('0x33')][_0x2183('0x37')]));_0xb5587b['attributes']=_0xb5587b[_0x2183('0x36')][_0x2183('0x38')]?_0xb5587b[_0x2183('0x36')]:_0x8e03bc['model'];if(_0x991eef[_0x2183('0x33')][_0x2183('0x46')]){_0xb5587b[_0x2183('0x42')]=[{'all':!![]}];}_0xb5587b=_[_0x2183('0x3f')]({},_0xb5587b,_0x991eef[_0x2183('0x47')]);return db['OpenchannelQueueReport'][_0x2183('0x48')](_0xb5587b)[_0x2183('0x27')](handleEntityNotFound(_0x32ee2a,null))['then'](respondWithResult(_0x32ee2a,null))[_0x2183('0x43')](handleError(_0x32ee2a,null));};exports[_0x2183('0x49')]=function(_0x5e424b,_0x4ca785){return db[_0x2183('0x2c')][_0x2183('0x49')](_0x5e424b[_0x2183('0x4a')],{})[_0x2183('0x27')](respondWithResult(_0x4ca785,0xc9))[_0x2183('0x43')](handleError(_0x4ca785,null));};exports[_0x2183('0x4b')]=function(_0x3fb16f,_0xf71730){if(_0x3fb16f['body']['id']){delete _0x3fb16f['body']['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x3fb16f[_0x2183('0x45')]['id']}})[_0x2183('0x27')](handleEntityNotFound(_0xf71730,null))[_0x2183('0x27')](saveUpdates(_0x3fb16f[_0x2183('0x4a')],null))['then'](respondWithResult(_0xf71730,null))[_0x2183('0x43')](handleError(_0xf71730,null));};exports[_0x2183('0x28')]=function(_0x10ff3b,_0x30662b){return db[_0x2183('0x2c')][_0x2183('0x48')]({'where':{'id':_0x10ff3b[_0x2183('0x45')]['id']}})[_0x2183('0x27')](handleEntityNotFound(_0x30662b,null))[_0x2183('0x27')](removeEntity(_0x30662b,null))[_0x2183('0x43')](handleError(_0x30662b,null));};exports[_0x2183('0x4c')]=function(_0x1d082c,_0x424eff){return db[_0x2183('0x2c')]['describe']()['then'](respondWithResult(_0x424eff,null))[_0x2183('0x43')](handleError(_0x424eff,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 259569c..cf601fb 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x4dc792,_0x5d8bbd){var _0x2331a9=function(_0x26878e){while(--_0x26878e){_0x4dc792['push'](_0x4dc792['shift']());}};_0x2331a9(++_0x5d8bbd);}(_0x326f,0xd1));var _0xf326=function(_0x1370a6,_0x279341){_0x1370a6=_0x1370a6-0x0;var _0x1ce0af=_0x326f[_0x1370a6];return _0x1ce0af;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x441bce,_0x349add){var _0x5aee7f=function(_0x1f98ef){while(--_0x1f98ef){_0x441bce['push'](_0x441bce['shift']());}};_0x5aee7f(++_0x349add);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 0f002dd..89bdf97 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3264=['moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','create','body','options','raw','info','CreateOpenchannelQueueReport','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','util'];(function(_0x2055f8,_0x518f3d){var _0xf11764=function(_0x3b72a4){while(--_0x3b72a4){_0x2055f8['push'](_0x2055f8['shift']());}};_0xf11764(++_0x518f3d);}(_0x3264,0x7f));var _0x4326=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x3264[_0x2283dc];return _0x16db90;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var moment=require(_0x4326('0x1'));var BPromise=require(_0x4326('0x2'));var rs=require(_0x4326('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4326('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4326('0x5'));var jayson=require(_0x4326('0x6'));var client=jayson[_0x4326('0x7')][_0x4326('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56bcce,_0x3a7544,_0x2993a1){return new BPromise(function(_0x22071c,_0x129365){return client[_0x4326('0x9')](_0x56bcce,_0x2993a1)[_0x4326('0xa')](function(_0x1609f){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3a7544,_0x4326('0xb'));logger[_0x4326('0xc')](_0x4326('0xd'),_0x3a7544,_0x4326('0xb'),JSON['stringify'](_0x1609f));if(_0x1609f['error']){if(_0x1609f[_0x4326('0xe')]['code']===0x1f4){logger[_0x4326('0xe')](_0x4326('0xf'),_0x3a7544,_0x1609f[_0x4326('0xe')]['message']);return _0x129365(_0x1609f['error'][_0x4326('0x10')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3a7544,_0x1609f[_0x4326('0xe')][_0x4326('0x10')]);return _0x22071c(_0x1609f[_0x4326('0xe')][_0x4326('0x10')]);}else{logger['info'](_0x4326('0xf'),_0x3a7544,_0x4326('0xb'));_0x22071c(_0x1609f[_0x4326('0x11')]['message']);}})[_0x4326('0x12')](function(_0x40c169){logger[_0x4326('0xe')](_0x4326('0xf'),_0x3a7544,_0x40c169);_0x129365(_0x40c169);});});}exports['CreateOpenchannelQueueReport']=function(_0x425897){var _0x494d7b=this;return new Promise(function(_0x312f6d,_0x2b91b4){return db[_0x4326('0x13')][_0x4326('0x14')](_0x425897[_0x4326('0x15')],{'raw':_0x425897['options']?_0x425897[_0x4326('0x16')][_0x4326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x377a83){logger[_0x4326('0x18')](_0x4326('0x19'),_0x425897);logger['debug'](_0x4326('0x19'),_0x425897,JSON[_0x4326('0x1a')](_0x377a83));_0x312f6d(_0x377a83);})[_0x4326('0x12')](function(_0x40012e){logger[_0x4326('0xe')](_0x4326('0x19'),_0x40012e[_0x4326('0x10')],_0x425897);_0x2b91b4(_0x494d7b[_0x4326('0xe')](0x1f4,_0x40012e['message']));});});};exports[_0x4326('0x1b')]=function(_0x2b5c52){var _0x4dab78=this;return new Promise(function(_0x430a95,_0x3d5e8f){return db[_0x4326('0x13')][_0x4326('0x1c')](_0x2b5c52[_0x4326('0x15')],{'raw':_0x2b5c52['options']?_0x2b5c52['options'][_0x4326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b5c52[_0x4326('0x16')]?_0x2b5c52[_0x4326('0x16')][_0x4326('0x1d')]||null:null,'attributes':_0x2b5c52['options']?_0x2b5c52[_0x4326('0x16')][_0x4326('0x1e')]||null:null,'limit':_0x2b5c52[_0x4326('0x16')]?_0x2b5c52['options'][_0x4326('0x1f')]||null:null})['then'](function(_0x10509a){logger[_0x4326('0x18')]('UpdateOpenchannelQueueReport',_0x2b5c52);logger[_0x4326('0xc')](_0x4326('0x1b'),_0x2b5c52,JSON[_0x4326('0x1a')](_0x10509a));_0x430a95(_0x10509a);})[_0x4326('0x12')](function(_0x5baa56){logger['error']('UpdateOpenchannelQueueReport',_0x5baa56[_0x4326('0x10')],_0x2b5c52);_0x3d5e8f(_0x4dab78[_0x4326('0xe')](0x1f4,_0x5baa56[_0x4326('0x10')]));});});}; \ No newline at end of file +var _0xb78e=['rpc','../../config/environment','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','update','where','limit','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x210931,_0x373fb7){var _0x535fbf=function(_0x5de7ae){while(--_0x5de7ae){_0x210931['push'](_0x210931['shift']());}};_0x535fbf(++_0x373fb7);}(_0xb78e,0x1c9));var _0xeb78=function(_0x45cc29,_0x22288d){_0x45cc29=_0x45cc29-0x0;var _0xd44e22=_0xb78e[_0x45cc29];return _0xd44e22;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc2f,_0x30c884,_0x2b7925){return new BPromise(function(_0x36963f,_0x5259aa){return client['request'](_0x1ccc2f,_0x2b7925)[_0xeb78('0xc')](function(_0x1c941d){logger[_0xeb78('0xd')](_0xeb78('0xe'),_0x30c884,_0xeb78('0xf'));logger[_0xeb78('0x10')](_0xeb78('0x11'),_0x30c884,_0xeb78('0xf'),JSON[_0xeb78('0x12')](_0x1c941d));if(_0x1c941d['error']){if(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x14')]===0x1f4){logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);return _0x5259aa(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);}logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d['error'][_0xeb78('0x15')]);return _0x36963f(_0x1c941d[_0xeb78('0x13')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x30c884,_0xeb78('0xf'));_0x36963f(_0x1c941d['result'][_0xeb78('0x15')]);}})[_0xeb78('0x16')](function(_0x49123d){logger[_0xeb78('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30c884,_0x49123d);_0x5259aa(_0x49123d);});});}exports[_0xeb78('0x17')]=function(_0x92e410){var _0x576802=this;return new Promise(function(_0x45176e,_0xb97756){return db[_0xeb78('0x18')]['create'](_0x92e410[_0xeb78('0x19')],{'raw':_0x92e410[_0xeb78('0x1a')]?_0x92e410['options']['raw']===undefined?!![]:![]:!![]})[_0xeb78('0xc')](function(_0x106c5d){logger[_0xeb78('0xd')](_0xeb78('0x17'),_0x92e410);logger[_0xeb78('0x10')](_0xeb78('0x17'),_0x92e410,JSON[_0xeb78('0x12')](_0x106c5d));_0x45176e(_0x106c5d);})[_0xeb78('0x16')](function(_0x18f08d){logger['error']('CreateOpenchannelQueueReport',_0x18f08d['message'],_0x92e410);_0xb97756(_0x576802['error'](0x1f4,_0x18f08d[_0xeb78('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2159c1){var _0x1fbf2f=this;return new Promise(function(_0x566336,_0x777ca3){return db['OpenchannelQueueReport'][_0xeb78('0x1b')](_0x2159c1[_0xeb78('0x19')],{'raw':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1['options'][_0xeb78('0x1c')]||null:null,'attributes':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['attributes']||null:null,'limit':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')][_0xeb78('0x1d')]||null:null})[_0xeb78('0xc')](function(_0x3d4a97){logger[_0xeb78('0xd')](_0xeb78('0x1e'),_0x2159c1);logger[_0xeb78('0x10')](_0xeb78('0x1e'),_0x2159c1,JSON[_0xeb78('0x12')](_0x3d4a97));_0x566336(_0x3d4a97);})[_0xeb78('0x16')](function(_0x505468){logger['error']('UpdateOpenchannelQueueReport',_0x505468[_0xeb78('0x15')],_0x2159c1);_0x777ca3(_0x1fbf2f[_0xeb78('0x13')](0x1f4,_0x505468[_0xeb78('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c1fb9c6..1a164fb 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f36=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x212865,_0x45fe08){var _0x4cfb48=function(_0x37b7ad){while(--_0x37b7ad){_0x212865['push'](_0x212865['shift']());}};_0x4cfb48(++_0x45fe08);}(_0x2f36,0xca));var _0x62f3=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x2f36[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x62f3('0x0'));var util=require(_0x62f3('0x1'));var path=require(_0x62f3('0x2'));var timeout=require(_0x62f3('0x3'));var express=require(_0x62f3('0x4'));var router=express[_0x62f3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x62f3('0x6'));var interaction=require(_0x62f3('0x7'));var config=require(_0x62f3('0x8'));var controller=require(_0x62f3('0x9'));router[_0x62f3('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x62f3('0xa')](_0x62f3('0xb'),auth[_0x62f3('0xc')](),controller[_0x62f3('0xd')]);router[_0x62f3('0xa')]('/:id',auth[_0x62f3('0xc')](),controller[_0x62f3('0xe')]);router[_0x62f3('0xf')]('/',auth[_0x62f3('0xc')](),controller[_0x62f3('0x10')]);router[_0x62f3('0x11')](_0x62f3('0x12'),auth[_0x62f3('0xc')](),controller[_0x62f3('0x13')]);router[_0x62f3('0x14')](_0x62f3('0x12'),auth[_0x62f3('0xc')](),controller[_0x62f3('0x15')]);module[_0x62f3('0x16')]=router; \ No newline at end of file +var _0x232c=['Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','connect-timeout','express'];(function(_0x4420de,_0x4cc181){var _0x468454=function(_0x2bf20b){while(--_0x2bf20b){_0x4420de['push'](_0x4420de['shift']());}};_0x468454(++_0x4cc181);}(_0x232c,0x11e));var _0xc232=function(_0x45af47,_0x1de157){_0x45af47=_0x45af47-0x0;var _0x30d2cc=_0x232c[_0x45af47];return _0x30d2cc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc232('0x0'));var express=require(_0xc232('0x1'));var router=express[_0xc232('0x2')]();var fs_extra=require(_0xc232('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc232('0x4'));var config=require(_0xc232('0x5'));var controller=require(_0xc232('0x6'));router[_0xc232('0x7')]('/',auth[_0xc232('0x8')](),controller['index']);router[_0xc232('0x7')]('/describe',auth[_0xc232('0x8')](),controller[_0xc232('0x9')]);router[_0xc232('0x7')](_0xc232('0xa'),auth[_0xc232('0x8')](),controller[_0xc232('0xb')]);router[_0xc232('0xc')]('/',auth[_0xc232('0x8')](),controller[_0xc232('0xd')]);router[_0xc232('0xe')](_0xc232('0xa'),auth[_0xc232('0x8')](),controller[_0xc232('0xf')]);router[_0xc232('0x10')](_0xc232('0xa'),auth[_0xc232('0x8')](),controller['destroy']);module[_0xc232('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index ce6ce00..dfbac37 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1ebfc8,_0x4d309c){_0x1ebfc8=_0x1ebfc8-0x0;var _0x2350b2=_0x9bde[_0x1ebfc8];return _0x2350b2;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5da8e0,_0x2007cf){var _0x1c37ad=function(_0x534f11){while(--_0x534f11){_0x5da8e0['push'](_0x5da8e0['shift']());}};_0x1c37ad(++_0x2007cf);}(_0x70e0,0x17b));var _0x070e=function(_0x397023,_0x5c5bc7){_0x397023=_0x397023-0x0;var _0x5ed0b7=_0x70e0[_0x397023];return _0x5ed0b7;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 5d149d5..07b7528 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29d1=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','end','error','name','send','index','OpenchannelTransferReport','rawAttributes','key','model','map','query'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x29d1,0x1d3));var _0x129d=function(_0xc8f5a3,_0x4a02a5){_0xc8f5a3=_0xc8f5a3-0x0;var _0x55041a=_0x29d1[_0xc8f5a3];return _0x55041a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x129d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x129d('0x1'));var moment=require(_0x129d('0x2'));var BPromise=require(_0x129d('0x3'));var Mustache=require(_0x129d('0x4'));var util=require(_0x129d('0x5'));var path=require('path');var sox=require(_0x129d('0x6'));var csv=require(_0x129d('0x7'));var ejs=require(_0x129d('0x8'));var fs=require('fs');var fs_extra=require(_0x129d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x129d('0xa'));var jsforce=require(_0x129d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x129d('0x7'));var querystring=require('querystring');var Papa=require(_0x129d('0xc'));var Redis=require(_0x129d('0xd'));var authService=require(_0x129d('0xe'));var qs=require(_0x129d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x129d('0x10'));var logger=require(_0x129d('0x11'))(_0x129d('0x12'));var utils=require(_0x129d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x129d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3176d8,_0x69c2e1){_0x69c2e1=_0x69c2e1||0xcc;return function(_0x4b9e8a){if(_0x4b9e8a){return _0x3176d8[_0x129d('0x15')](_0x69c2e1);}return _0x3176d8['status'](_0x69c2e1)['end']();};}function respondWithResult(_0x59f181,_0x355445){_0x355445=_0x355445||0xc8;return function(_0x18908c){if(_0x18908c){return _0x59f181[_0x129d('0x16')](_0x355445)[_0x129d('0x17')](_0x18908c);}};}function respondWithFilteredResult(_0x503c1e,_0x157fcf){return function(_0x1d03cf){if(_0x1d03cf){var _0x560627=typeof _0x157fcf[_0x129d('0x18')]===_0x129d('0x19')&&typeof _0x157fcf[_0x129d('0x1a')]===_0x129d('0x19');var _0x3f39e6=_0x1d03cf[_0x129d('0x1b')];var _0x40fad5=_0x560627?0x0:_0x157fcf['offset'];var _0x157fb6=_0x560627?_0x1d03cf[_0x129d('0x1b')]:_0x157fcf[_0x129d('0x18')]+_0x157fcf[_0x129d('0x1a')];var _0x1d2a80;if(_0x157fb6>=_0x3f39e6){_0x157fb6=_0x3f39e6;_0x1d2a80=0xc8;}else{_0x1d2a80=0xce;}_0x503c1e[_0x129d('0x16')](_0x1d2a80);return _0x503c1e[_0x129d('0x1c')]('Content-Range',_0x40fad5+'-'+_0x157fb6+'/'+_0x3f39e6)['json'](_0x1d03cf);}return null;};}function patchUpdates(_0x565867){return function(_0x9cce11){try{jsonpatch[_0x129d('0x1d')](_0x9cce11,_0x565867,!![]);}catch(_0x15974f){return BPromise[_0x129d('0x1e')](_0x15974f);}return _0x9cce11[_0x129d('0x1f')]();};}function saveUpdates(_0x1e39d4,_0x1dadf5){return function(_0x44c451){if(_0x44c451){return _0x44c451['update'](_0x1e39d4)[_0x129d('0x20')](function(_0x166827){return _0x166827;});}return null;};}function removeEntity(_0x1d0190,_0x21f5c6){return function(_0x1e6545){if(_0x1e6545){return _0x1e6545['destroy']()[_0x129d('0x20')](function(){_0x1d0190[_0x129d('0x16')](0xcc)[_0x129d('0x21')]();});}};}function handleEntityNotFound(_0x37982c,_0x2ecaa2){return function(_0x3e5d31){if(!_0x3e5d31){_0x37982c[_0x129d('0x15')](0x194);}return _0x3e5d31;};}function handleError(_0x2edbed,_0x1e3241){_0x1e3241=_0x1e3241||0x1f4;return function(_0x2db8f7){logger[_0x129d('0x22')](_0x2db8f7['stack']);if(_0x2db8f7[_0x129d('0x23')]){delete _0x2db8f7['name'];}_0x2edbed[_0x129d('0x16')](_0x1e3241)[_0x129d('0x24')](_0x2db8f7);};}exports[_0x129d('0x25')]=function(_0xed9d5,_0x291c8f){var _0x2e45b2={},_0x5ab434={},_0x31d74c={'count':0x0,'rows':[]};var _0x15872e=_['map'](db[_0x129d('0x26')][_0x129d('0x27')],function(_0x189da7){return{'name':_0x189da7['fieldName'],'type':_0x189da7['type'][_0x129d('0x28')]};});_0x5ab434[_0x129d('0x29')]=_[_0x129d('0x2a')](_0x15872e,_0x129d('0x23'));_0x5ab434[_0x129d('0x2b')]=_[_0x129d('0x2c')](_0xed9d5['query']);_0x5ab434[_0x129d('0x2d')]=_[_0x129d('0x2e')](_0x5ab434[_0x129d('0x29')],_0x5ab434[_0x129d('0x2b')]);_0x2e45b2[_0x129d('0x2f')]=_['intersection'](_0x5ab434['model'],qs[_0x129d('0x30')](_0xed9d5[_0x129d('0x2b')][_0x129d('0x30')]));_0x2e45b2['attributes']=_0x2e45b2['attributes'][_0x129d('0x31')]?_0x2e45b2[_0x129d('0x2f')]:_0x5ab434['model'];if(!_0xed9d5[_0x129d('0x2b')][_0x129d('0x32')](_0x129d('0x33'))){_0x2e45b2[_0x129d('0x1a')]=qs[_0x129d('0x1a')](_0xed9d5['query'][_0x129d('0x1a')]);_0x2e45b2[_0x129d('0x18')]=qs['offset'](_0xed9d5['query'][_0x129d('0x18')]);}_0x2e45b2[_0x129d('0x34')]=qs[_0x129d('0x35')](_0xed9d5['query'][_0x129d('0x35')]);_0x2e45b2['where']=qs[_0x129d('0x2d')](_[_0x129d('0x36')](_0xed9d5[_0x129d('0x2b')],_0x5ab434[_0x129d('0x2d')]),_0x15872e);if(_0xed9d5[_0x129d('0x2b')][_0x129d('0x37')]){_0x2e45b2[_0x129d('0x38')]=_[_0x129d('0x39')](_0x2e45b2[_0x129d('0x38')],{'$or':_[_0x129d('0x2a')](_0x15872e,function(_0x5e3298){if(_0x5e3298[_0x129d('0x3a')]!=='VIRTUAL'){var _0x21f182={};_0x21f182[_0x5e3298[_0x129d('0x23')]]={'$like':'%'+_0xed9d5[_0x129d('0x2b')][_0x129d('0x37')]+'%'};return _0x21f182;}})});}_0x2e45b2=_[_0x129d('0x39')]({},_0x2e45b2,_0xed9d5[_0x129d('0x3b')]);var _0xdd716d={'where':_0x2e45b2[_0x129d('0x38')]};return db[_0x129d('0x26')][_0x129d('0x1b')](_0xdd716d)['then'](function(_0x146767){_0x31d74c[_0x129d('0x1b')]=_0x146767;if(_0xed9d5['query'][_0x129d('0x3c')]){_0x2e45b2[_0x129d('0x3d')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x129d('0x3e')](_0x2e45b2);})['then'](function(_0x27ee00){_0x31d74c[_0x129d('0x3f')]=_0x27ee00;return _0x31d74c;})[_0x129d('0x20')](respondWithFilteredResult(_0x291c8f,_0x2e45b2))[_0x129d('0x40')](handleError(_0x291c8f,null));};exports[_0x129d('0x41')]=function(_0x2d3383,_0x4c4d6d){var _0x4bd14c={'raw':!![],'where':{'id':_0x2d3383[_0x129d('0x42')]['id']}},_0x5b14ce={};_0x5b14ce[_0x129d('0x29')]=_['keys'](db[_0x129d('0x26')][_0x129d('0x27')]);_0x5b14ce[_0x129d('0x2b')]=_['keys'](_0x2d3383[_0x129d('0x2b')]);_0x5b14ce['filters']=_[_0x129d('0x2e')](_0x5b14ce['model'],_0x5b14ce['query']);_0x4bd14c[_0x129d('0x2f')]=_[_0x129d('0x2e')](_0x5b14ce[_0x129d('0x29')],qs[_0x129d('0x30')](_0x2d3383['query'][_0x129d('0x30')]));_0x4bd14c[_0x129d('0x2f')]=_0x4bd14c[_0x129d('0x2f')][_0x129d('0x31')]?_0x4bd14c['attributes']:_0x5b14ce[_0x129d('0x29')];if(_0x2d3383[_0x129d('0x2b')][_0x129d('0x3c')]){_0x4bd14c[_0x129d('0x3d')]=[{'all':!![]}];}_0x4bd14c=_[_0x129d('0x39')]({},_0x4bd14c,_0x2d3383['options']);return db[_0x129d('0x26')][_0x129d('0x43')](_0x4bd14c)[_0x129d('0x20')](handleEntityNotFound(_0x4c4d6d,null))[_0x129d('0x20')](respondWithResult(_0x4c4d6d,null))[_0x129d('0x40')](handleError(_0x4c4d6d,null));};exports[_0x129d('0x44')]=function(_0x19bdd6,_0x59c0a0){return db['OpenchannelTransferReport'][_0x129d('0x44')](_0x19bdd6[_0x129d('0x45')],{})[_0x129d('0x20')](respondWithResult(_0x59c0a0,0xc9))[_0x129d('0x40')](handleError(_0x59c0a0,null));};exports[_0x129d('0x46')]=function(_0x55cb8e,_0x429f13){if(_0x55cb8e[_0x129d('0x45')]['id']){delete _0x55cb8e['body']['id'];}return db[_0x129d('0x26')][_0x129d('0x43')]({'where':{'id':_0x55cb8e[_0x129d('0x42')]['id']}})[_0x129d('0x20')](handleEntityNotFound(_0x429f13,null))[_0x129d('0x20')](saveUpdates(_0x55cb8e['body'],null))['then'](respondWithResult(_0x429f13,null))[_0x129d('0x40')](handleError(_0x429f13,null));};exports[_0x129d('0x47')]=function(_0x28c25f,_0x191c47){return db[_0x129d('0x26')][_0x129d('0x43')]({'where':{'id':_0x28c25f[_0x129d('0x42')]['id']}})['then'](handleEntityNotFound(_0x191c47,null))['then'](removeEntity(_0x191c47,null))[_0x129d('0x40')](handleError(_0x191c47,null));};exports[_0x129d('0x48')]=function(_0x2e8f34,_0x2a3503){return db[_0x129d('0x26')]['describe']()[_0x129d('0x20')](respondWithResult(_0x2a3503,null))[_0x129d('0x40')](handleError(_0x2a3503,null));}; \ No newline at end of file +var _0x4124=['hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','name','index','map','OpenchannelTransferReport','fieldName','type','key','query','keys','intersection','model','fields','attributes','length'];(function(_0x5918f3,_0x561082){var _0x4eae6f=function(_0x34e5e1){while(--_0x34e5e1){_0x5918f3['push'](_0x5918f3['shift']());}};_0x4eae6f(++_0x561082);}(_0x4124,0x128));var _0x4412=function(_0x387ab7,_0x39e57c){_0x387ab7=_0x387ab7-0x0;var _0x1055ac=_0x4124[_0x387ab7];return _0x1055ac;};'use strict';var emlformat=require(_0x4412('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4412('0x1'));var jsonpatch=require(_0x4412('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4412('0x3'));var Mustache=require(_0x4412('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4412('0x5'));var csv=require(_0x4412('0x6'));var ejs=require(_0x4412('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4412('0x8'));var squel=require(_0x4412('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4412('0xa'));var toCsv=require(_0x4412('0x6'));var querystring=require(_0x4412('0xb'));var Papa=require(_0x4412('0xc'));var Redis=require('ioredis');var authService=require(_0x4412('0xd'));var qs=require(_0x4412('0xe'));var as=require(_0x4412('0xf'));var hardwareService=require(_0x4412('0x10'));var logger=require('../../config/logger')(_0x4412('0x11'));var utils=require('../../config/utils');var config=require(_0x4412('0x12'));var licenseUtil=require(_0x4412('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32472a,_0x11c299){_0x11c299=_0x11c299||0xcc;return function(_0x53cfb1){if(_0x53cfb1){return _0x32472a[_0x4412('0x14')](_0x11c299);}return _0x32472a[_0x4412('0x15')](_0x11c299)[_0x4412('0x16')]();};}function respondWithResult(_0x3cc6fc,_0x5c1a7a){_0x5c1a7a=_0x5c1a7a||0xc8;return function(_0x4f1670){if(_0x4f1670){return _0x3cc6fc[_0x4412('0x15')](_0x5c1a7a)[_0x4412('0x17')](_0x4f1670);}};}function respondWithFilteredResult(_0x5f2769,_0x1ae385){return function(_0x29b630){if(_0x29b630){var _0x5dd429=typeof _0x1ae385[_0x4412('0x18')]==='undefined'&&typeof _0x1ae385[_0x4412('0x19')]===_0x4412('0x1a');var _0x52f052=_0x29b630[_0x4412('0x1b')];var _0x5b4b09=_0x5dd429?0x0:_0x1ae385['offset'];var _0x4bb8fc=_0x5dd429?_0x29b630[_0x4412('0x1b')]:_0x1ae385['offset']+_0x1ae385['limit'];var _0x37318e;if(_0x4bb8fc>=_0x52f052){_0x4bb8fc=_0x52f052;_0x37318e=0xc8;}else{_0x37318e=0xce;}_0x5f2769[_0x4412('0x15')](_0x37318e);return _0x5f2769[_0x4412('0x1c')](_0x4412('0x1d'),_0x5b4b09+'-'+_0x4bb8fc+'/'+_0x52f052)[_0x4412('0x17')](_0x29b630);}return null;};}function patchUpdates(_0x38989f){return function(_0x3a248b){try{jsonpatch[_0x4412('0x1e')](_0x3a248b,_0x38989f,!![]);}catch(_0x41d525){return BPromise[_0x4412('0x1f')](_0x41d525);}return _0x3a248b['save']();};}function saveUpdates(_0x4a4ab3,_0x24f817){return function(_0x4ac023){if(_0x4ac023){return _0x4ac023[_0x4412('0x20')](_0x4a4ab3)['then'](function(_0x35e4a2){return _0x35e4a2;});}return null;};}function removeEntity(_0x44f81b,_0x399dd1){return function(_0x348787){if(_0x348787){return _0x348787[_0x4412('0x21')]()[_0x4412('0x22')](function(){_0x44f81b[_0x4412('0x15')](0xcc)[_0x4412('0x16')]();});}};}function handleEntityNotFound(_0x308a02,_0x569f5b){return function(_0x4ea49c){if(!_0x4ea49c){_0x308a02[_0x4412('0x14')](0x194);}return _0x4ea49c;};}function handleError(_0x74be29,_0x380fb8){_0x380fb8=_0x380fb8||0x1f4;return function(_0x4630e0){logger['error'](_0x4630e0['stack']);if(_0x4630e0[_0x4412('0x23')]){delete _0x4630e0[_0x4412('0x23')];}_0x74be29[_0x4412('0x15')](_0x380fb8)['send'](_0x4630e0);};}exports[_0x4412('0x24')]=function(_0x4db15c,_0xd06d2f){var _0xb9f6a={},_0x19d0c8={},_0x104108={'count':0x0,'rows':[]};var _0x3d0465=_[_0x4412('0x25')](db[_0x4412('0x26')]['rawAttributes'],function(_0x1285da){return{'name':_0x1285da[_0x4412('0x27')],'type':_0x1285da[_0x4412('0x28')][_0x4412('0x29')]};});_0x19d0c8['model']=_['map'](_0x3d0465,_0x4412('0x23'));_0x19d0c8[_0x4412('0x2a')]=_[_0x4412('0x2b')](_0x4db15c[_0x4412('0x2a')]);_0x19d0c8['filters']=_[_0x4412('0x2c')](_0x19d0c8[_0x4412('0x2d')],_0x19d0c8[_0x4412('0x2a')]);_0xb9f6a['attributes']=_[_0x4412('0x2c')](_0x19d0c8['model'],qs[_0x4412('0x2e')](_0x4db15c['query'][_0x4412('0x2e')]));_0xb9f6a[_0x4412('0x2f')]=_0xb9f6a['attributes'][_0x4412('0x30')]?_0xb9f6a['attributes']:_0x19d0c8[_0x4412('0x2d')];if(!_0x4db15c['query'][_0x4412('0x31')]('nolimit')){_0xb9f6a[_0x4412('0x19')]=qs['limit'](_0x4db15c[_0x4412('0x2a')]['limit']);_0xb9f6a[_0x4412('0x18')]=qs[_0x4412('0x18')](_0x4db15c[_0x4412('0x2a')]['offset']);}_0xb9f6a[_0x4412('0x32')]=qs[_0x4412('0x33')](_0x4db15c[_0x4412('0x2a')]['sort']);_0xb9f6a[_0x4412('0x34')]=qs['filters'](_[_0x4412('0x35')](_0x4db15c[_0x4412('0x2a')],_0x19d0c8[_0x4412('0x36')]),_0x3d0465);if(_0x4db15c[_0x4412('0x2a')][_0x4412('0x37')]){_0xb9f6a[_0x4412('0x34')]=_[_0x4412('0x38')](_0xb9f6a[_0x4412('0x34')],{'$or':_[_0x4412('0x25')](_0x3d0465,function(_0x1aca37){if(_0x1aca37[_0x4412('0x28')]!==_0x4412('0x39')){var _0x356a72={};_0x356a72[_0x1aca37[_0x4412('0x23')]]={'$like':'%'+_0x4db15c[_0x4412('0x2a')][_0x4412('0x37')]+'%'};return _0x356a72;}})});}_0xb9f6a=_[_0x4412('0x38')]({},_0xb9f6a,_0x4db15c[_0x4412('0x3a')]);var _0x58f838={'where':_0xb9f6a[_0x4412('0x34')]};return db[_0x4412('0x26')][_0x4412('0x1b')](_0x58f838)['then'](function(_0x2748d4){_0x104108['count']=_0x2748d4;if(_0x4db15c[_0x4412('0x2a')][_0x4412('0x3b')]){_0xb9f6a[_0x4412('0x3c')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0xb9f6a);})[_0x4412('0x22')](function(_0xe7744b){_0x104108['rows']=_0xe7744b;return _0x104108;})[_0x4412('0x22')](respondWithFilteredResult(_0xd06d2f,_0xb9f6a))[_0x4412('0x3d')](handleError(_0xd06d2f,null));};exports[_0x4412('0x3e')]=function(_0x14ab8b,_0x12a1bb){var _0x1a8a83={'raw':!![],'where':{'id':_0x14ab8b['params']['id']}},_0x4d8b36={};_0x4d8b36[_0x4412('0x2d')]=_[_0x4412('0x2b')](db['OpenchannelTransferReport'][_0x4412('0x3f')]);_0x4d8b36['query']=_[_0x4412('0x2b')](_0x14ab8b[_0x4412('0x2a')]);_0x4d8b36[_0x4412('0x36')]=_['intersection'](_0x4d8b36[_0x4412('0x2d')],_0x4d8b36[_0x4412('0x2a')]);_0x1a8a83[_0x4412('0x2f')]=_[_0x4412('0x2c')](_0x4d8b36[_0x4412('0x2d')],qs[_0x4412('0x2e')](_0x14ab8b[_0x4412('0x2a')]['fields']));_0x1a8a83[_0x4412('0x2f')]=_0x1a8a83[_0x4412('0x2f')]['length']?_0x1a8a83[_0x4412('0x2f')]:_0x4d8b36[_0x4412('0x2d')];if(_0x14ab8b[_0x4412('0x2a')][_0x4412('0x3b')]){_0x1a8a83[_0x4412('0x3c')]=[{'all':!![]}];}_0x1a8a83=_[_0x4412('0x38')]({},_0x1a8a83,_0x14ab8b[_0x4412('0x3a')]);return db[_0x4412('0x26')][_0x4412('0x40')](_0x1a8a83)[_0x4412('0x22')](handleEntityNotFound(_0x12a1bb,null))['then'](respondWithResult(_0x12a1bb,null))[_0x4412('0x3d')](handleError(_0x12a1bb,null));};exports[_0x4412('0x41')]=function(_0x8312ac,_0x2a63b3){return db[_0x4412('0x26')]['create'](_0x8312ac[_0x4412('0x42')],{})[_0x4412('0x22')](respondWithResult(_0x2a63b3,0xc9))['catch'](handleError(_0x2a63b3,null));};exports['update']=function(_0xce3727,_0x472ac6){if(_0xce3727[_0x4412('0x42')]['id']){delete _0xce3727[_0x4412('0x42')]['id'];}return db[_0x4412('0x26')][_0x4412('0x40')]({'where':{'id':_0xce3727['params']['id']}})[_0x4412('0x22')](handleEntityNotFound(_0x472ac6,null))[_0x4412('0x22')](saveUpdates(_0xce3727['body'],null))['then'](respondWithResult(_0x472ac6,null))['catch'](handleError(_0x472ac6,null));};exports[_0x4412('0x21')]=function(_0x2d9b98,_0x44a8fd){return db[_0x4412('0x26')][_0x4412('0x40')]({'where':{'id':_0x2d9b98[_0x4412('0x43')]['id']}})['then'](handleEntityNotFound(_0x44a8fd,null))[_0x4412('0x22')](removeEntity(_0x44a8fd,null))[_0x4412('0x3d')](handleError(_0x44a8fd,null));};exports['describe']=function(_0x235e5f,_0x30df90){return db[_0x4412('0x26')][_0x4412('0x44')]()[_0x4412('0x22')](respondWithResult(_0x30df90,null))['catch'](handleError(_0x30df90,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 81ab27b..f17da63 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.model.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x800f=['rimraf','../../config/environment','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1c6090,_0x3883bf){var _0x59f349=function(_0x461868){while(--_0x461868){_0x1c6090['push'](_0x1c6090['shift']());}};_0x59f349(++_0x3883bf);}(_0x800f,0xde));var _0xf800=function(_0x1c4846,_0x53286){_0x1c4846=_0x1c4846-0x0;var _0xaac318=_0x800f[_0x1c4846];return _0xaac318;};'use strict';var _=require(_0xf800('0x0'));var util=require(_0xf800('0x1'));var logger=require(_0xf800('0x2'))(_0xf800('0x3'));var moment=require(_0xf800('0x4'));var BPromise=require(_0xf800('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf800('0x6'));var config=require(_0xf800('0x7'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x1ee9a4,_0x37f4b8){return _0x1ee9a4[_0xf800('0x8')](_0xf800('0x9'),attributes,{'tableName':_0xf800('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf800('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf026=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','OpenchannelTransferReport'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf026,0x1af));var _0x6f02=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xf026[_0x58547b];return _0x1d3fd2;};'use strict';var _=require(_0x6f02('0x0'));var util=require(_0x6f02('0x1'));var logger=require(_0x6f02('0x2'))(_0x6f02('0x3'));var moment=require(_0x6f02('0x4'));var BPromise=require(_0x6f02('0x5'));var rp=require(_0x6f02('0x6'));var fs=require('fs');var path=require(_0x6f02('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x6f02('0x8')]=function(_0x1cfd69,_0x366b92){return _0x1cfd69[_0x6f02('0x9')](_0x6f02('0xa'),attributes,{'tableName':_0x6f02('0xb'),'paranoid':![],'indexes':[{'name':_0x6f02('0xc'),'fields':[_0x6f02('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 98bd333..043b781 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26d1=['OpenchannelTransferReport,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x26d1,0x8e));var _0x126d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x26d1[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x126d('0x0'));var util=require('util');var moment=require(_0x126d('0x1'));var BPromise=require(_0x126d('0x2'));var rs=require(_0x126d('0x3'));var fs=require('fs');var Redis=require(_0x126d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x126d('0x5'))('rpc');var config=require(_0x126d('0x6'));var jayson=require(_0x126d('0x7'));var client=jayson[_0x126d('0x8')][_0x126d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4dfc,_0x4e5e87,_0x2e668c){return new BPromise(function(_0x25ccc2,_0x7d6e4c){return client[_0x126d('0xa')](_0x2b4dfc,_0x2e668c)[_0x126d('0xb')](function(_0x1cf6fb){logger[_0x126d('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4e5e87,_0x126d('0xd'));logger[_0x126d('0xe')](_0x126d('0xf'),_0x4e5e87,_0x126d('0xd'),JSON[_0x126d('0x10')](_0x1cf6fb));if(_0x1cf6fb['error']){if(_0x1cf6fb[_0x126d('0x11')]['code']===0x1f4){logger[_0x126d('0x11')](_0x126d('0x12'),_0x4e5e87,_0x1cf6fb[_0x126d('0x11')]['message']);return _0x7d6e4c(_0x1cf6fb[_0x126d('0x11')][_0x126d('0x13')]);}logger[_0x126d('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4e5e87,_0x1cf6fb['error'][_0x126d('0x13')]);return _0x25ccc2(_0x1cf6fb[_0x126d('0x11')][_0x126d('0x13')]);}else{logger[_0x126d('0xc')](_0x126d('0x12'),_0x4e5e87,_0x126d('0xd'));_0x25ccc2(_0x1cf6fb['result'][_0x126d('0x13')]);}})['catch'](function(_0x352d72){logger['error'](_0x126d('0x12'),_0x4e5e87,_0x352d72);_0x7d6e4c(_0x352d72);});});} \ No newline at end of file +var _0x0960=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','bluebird','randomstring'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x0960,0xc2));var _0x0096=function(_0x41686b,_0x3874af){_0x41686b=_0x41686b-0x0;var _0x19c3c5=_0x0960[_0x41686b];return _0x19c3c5;};'use strict';var _=require(_0x0096('0x0'));var util=require(_0x0096('0x1'));var moment=require('moment');var BPromise=require(_0x0096('0x2'));var rs=require(_0x0096('0x3'));var fs=require('fs');var Redis=require(_0x0096('0x4'));var db=require(_0x0096('0x5'))['db'];var utils=require(_0x0096('0x6'));var logger=require(_0x0096('0x7'))(_0x0096('0x8'));var config=require(_0x0096('0x9'));var jayson=require(_0x0096('0xa'));var client=jayson[_0x0096('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x81cc41,_0x57390a,_0x1d35f1){return new BPromise(function(_0x44e168,_0x407f3a){return client['request'](_0x81cc41,_0x1d35f1)[_0x0096('0xc')](function(_0x3e97ce){logger[_0x0096('0xd')](_0x0096('0xe'),_0x57390a,'request\x20sent');logger[_0x0096('0xf')](_0x0096('0x10'),_0x57390a,'request\x20sent',JSON[_0x0096('0x11')](_0x3e97ce));if(_0x3e97ce['error']){if(_0x3e97ce[_0x0096('0x12')]['code']===0x1f4){logger[_0x0096('0x12')](_0x0096('0xe'),_0x57390a,_0x3e97ce['error'][_0x0096('0x13')]);return _0x407f3a(_0x3e97ce[_0x0096('0x12')]['message']);}logger['error'](_0x0096('0xe'),_0x57390a,_0x3e97ce[_0x0096('0x12')][_0x0096('0x13')]);return _0x44e168(_0x3e97ce[_0x0096('0x12')][_0x0096('0x13')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x57390a,_0x0096('0x14'));_0x44e168(_0x3e97ce['result']['message']);}})[_0x0096('0x15')](function(_0x37f0e4){logger['error'](_0x0096('0xe'),_0x57390a,_0x37f0e4);_0x407f3a(_0x37f0e4);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 94b9fd3..00902da 100644 --- a/server/api/pause/index.js +++ b/server/api/pause/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0fa=['../../config/environment','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x569970,_0x16f028){var _0x13cc81=function(_0x313dc2){while(--_0x313dc2){_0x569970['push'](_0x569970['shift']());}};_0x13cc81(++_0x16f028);}(_0xc0fa,0xfa));var _0xac0f=function(_0x4a3c24,_0x5ec8a9){_0x4a3c24=_0x4a3c24-0x0;var _0x1b0ff0=_0xc0fa[_0x4a3c24];return _0x1b0ff0;};'use strict';var multer=require('multer');var util=require(_0xac0f('0x0'));var path=require('path');var timeout=require(_0xac0f('0x1'));var express=require(_0xac0f('0x2'));var router=express[_0xac0f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xac0f('0x4'));var interaction=require(_0xac0f('0x5'));var config=require(_0xac0f('0x6'));var controller=require('./pause.controller');router['get']('/',auth[_0xac0f('0x7')](),controller['index']);router['get'](_0xac0f('0x8'),auth[_0xac0f('0x7')](),controller[_0xac0f('0x9')]);router[_0xac0f('0xa')]('/',auth[_0xac0f('0x7')](),controller['create']);router[_0xac0f('0xb')](_0xac0f('0x8'),auth['isAuthenticated'](),controller[_0xac0f('0xc')]);router[_0xac0f('0xd')](_0xac0f('0x8'),auth['isAuthenticated'](),controller[_0xac0f('0xe')]);module[_0xac0f('0xf')]=router; \ No newline at end of file +var _0xf869=['delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','post','put','update'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xf869,0xbd));var _0x9f86=function(_0x4e1119,_0x32dc78){_0x4e1119=_0x4e1119-0x0;var _0x35f53d=_0xf869[_0x4e1119];return _0x35f53d;};'use strict';var multer=require(_0x9f86('0x0'));var util=require(_0x9f86('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9f86('0x2'));var router=express[_0x9f86('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9f86('0x4'));var interaction=require(_0x9f86('0x5'));var config=require(_0x9f86('0x6'));var controller=require(_0x9f86('0x7'));router['get']('/',auth[_0x9f86('0x8')](),controller[_0x9f86('0x9')]);router[_0x9f86('0xa')](_0x9f86('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9f86('0xc')]('/',auth[_0x9f86('0x8')](),controller['create']);router[_0x9f86('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9f86('0xe')]);router[_0x9f86('0xf')](_0x9f86('0xb'),auth[_0x9f86('0x8')](),controller[_0x9f86('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 745d86b..2a1be5d 100644 --- a/server/api/pause/pause.attributes.js +++ b/server/api/pause/pause.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b63=['STRING','name'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x5b63,0x16a));var _0x35b6=function(_0x461f68,_0x316570){_0x461f68=_0x461f68-0x0;var _0x445dc5=_0x5b63[_0x461f68];return _0x445dc5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x35b6('0x0')],'unique':_0x35b6('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x35b6('0x0')]}}; \ No newline at end of file +var _0xda95=['sequelize','exports','STRING','name'];(function(_0x1b2eac,_0x2df0eb){var _0x23225c=function(_0x4be048){while(--_0x4be048){_0x1b2eac['push'](_0x1b2eac['shift']());}};_0x23225c(++_0x2df0eb);}(_0xda95,0x104));var _0x5da9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xda95[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x5da9('0x0'));module[_0x5da9('0x1')]={'name':{'type':Sequelize[_0x5da9('0x2')],'unique':_0x5da9('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ca5b6f1..e27df57 100644 --- a/server/api/pause/pause.controller.js +++ b/server/api/pause/pause.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f1e=['rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','Pauses','UserProfileResource','sendStatus','error','stack','name','send','map','Pause','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll'];(function(_0x352806,_0x5f0470){var _0x423dfe=function(_0x28df7e){while(--_0x28df7e){_0x352806['push'](_0x352806['shift']());}};_0x423dfe(++_0x5f0470);}(_0x7f1e,0xb1));var _0xe7f1=function(_0x4d80f2,_0x55214d){_0x4d80f2=_0x4d80f2-0x0;var _0x53e777=_0x7f1e[_0x4d80f2];return _0x53e777;};'use strict';var emlformat=require(_0xe7f1('0x0'));var rimraf=require(_0xe7f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7f1('0x2'));var rp=require(_0xe7f1('0x3'));var moment=require(_0xe7f1('0x4'));var BPromise=require(_0xe7f1('0x5'));var Mustache=require('mustache');var util=require(_0xe7f1('0x6'));var path=require(_0xe7f1('0x7'));var sox=require(_0xe7f1('0x8'));var csv=require(_0xe7f1('0x9'));var ejs=require(_0xe7f1('0xa'));var fs=require('fs');var fs_extra=require(_0xe7f1('0xb'));var _=require(_0xe7f1('0xc'));var squel=require(_0xe7f1('0xd'));var crypto=require(_0xe7f1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe7f1('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe7f1('0x10'));var Papa=require('papaparse');var Redis=require(_0xe7f1('0x11'));var authService=require(_0xe7f1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe7f1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe7f1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe7f1('0x15'));var db=require(_0xe7f1('0x16'))['db'];function respondWithStatusCode(_0x3a54bb,_0x22f235){_0x22f235=_0x22f235||0xcc;return function(_0x41619b){if(_0x41619b){return _0x3a54bb['sendStatus'](_0x22f235);}return _0x3a54bb['status'](_0x22f235)[_0xe7f1('0x17')]();};}function respondWithResult(_0x38a89e,_0x431fda){_0x431fda=_0x431fda||0xc8;return function(_0x47bdb2){if(_0x47bdb2){return _0x38a89e[_0xe7f1('0x18')](_0x431fda)[_0xe7f1('0x19')](_0x47bdb2);}};}function respondWithFilteredResult(_0x2f2516,_0x4e244b){return function(_0x3ba145){if(_0x3ba145){var _0x5a6904=typeof _0x4e244b[_0xe7f1('0x1a')]===_0xe7f1('0x1b')&&typeof _0x4e244b[_0xe7f1('0x1c')]==='undefined';var _0x287458=_0x3ba145[_0xe7f1('0x1d')];var _0x582ddb=_0x5a6904?0x0:_0x4e244b[_0xe7f1('0x1a')];var _0x1c6b39=_0x5a6904?_0x3ba145['count']:_0x4e244b[_0xe7f1('0x1a')]+_0x4e244b['limit'];var _0xf82818;if(_0x1c6b39>=_0x287458){_0x1c6b39=_0x287458;_0xf82818=0xc8;}else{_0xf82818=0xce;}_0x2f2516['status'](_0xf82818);return _0x2f2516[_0xe7f1('0x1e')](_0xe7f1('0x1f'),_0x582ddb+'-'+_0x1c6b39+'/'+_0x287458)[_0xe7f1('0x19')](_0x3ba145);}return null;};}function patchUpdates(_0x2d1676){return function(_0x22ce82){try{jsonpatch[_0xe7f1('0x20')](_0x22ce82,_0x2d1676,!![]);}catch(_0x2c42a9){return BPromise[_0xe7f1('0x21')](_0x2c42a9);}return _0x22ce82['save']();};}function saveUpdates(_0x2c1ef7,_0x449607){return function(_0x5009f9){if(_0x5009f9){return _0x5009f9[_0xe7f1('0x22')](_0x2c1ef7)[_0xe7f1('0x23')](function(_0x5200de){return _0x5200de;});}return null;};}function removeEntity(_0x22d913,_0x3ea9d1){return function(_0x4fbc67){if(_0x4fbc67){return _0x4fbc67[_0xe7f1('0x24')]()[_0xe7f1('0x23')](function(){var _0x213e12=_0x4fbc67['get']({'plain':!![]});var _0x5dc298=_0xe7f1('0x25');return db[_0xe7f1('0x26')][_0xe7f1('0x24')]({'where':{'type':_0x5dc298,'resourceId':_0x213e12['id']}})[_0xe7f1('0x23')](function(){return _0x4fbc67;});})[_0xe7f1('0x23')](function(){_0x22d913[_0xe7f1('0x18')](0xcc)[_0xe7f1('0x17')]();});}};}function handleEntityNotFound(_0x478e42,_0x5bf16f){return function(_0x2e59a9){if(!_0x2e59a9){_0x478e42[_0xe7f1('0x27')](0x194);}return _0x2e59a9;};}function handleError(_0x5cf475,_0x2c44f4){_0x2c44f4=_0x2c44f4||0x1f4;return function(_0x3d4830){logger[_0xe7f1('0x28')](_0x3d4830[_0xe7f1('0x29')]);if(_0x3d4830[_0xe7f1('0x2a')]){delete _0x3d4830[_0xe7f1('0x2a')];}_0x5cf475[_0xe7f1('0x18')](_0x2c44f4)[_0xe7f1('0x2b')](_0x3d4830);};}exports['index']=function(_0x587469,_0x5f44a4){var _0x50bb9f={},_0x821996={},_0x3a9c7c={'count':0x0,'rows':[]};var _0x136392=_[_0xe7f1('0x2c')](db[_0xe7f1('0x2d')]['rawAttributes'],function(_0x17da14){return{'name':_0x17da14['fieldName'],'type':_0x17da14[_0xe7f1('0x2e')][_0xe7f1('0x2f')]};});_0x821996[_0xe7f1('0x30')]=_['map'](_0x136392,_0xe7f1('0x2a'));_0x821996[_0xe7f1('0x31')]=_[_0xe7f1('0x32')](_0x587469[_0xe7f1('0x31')]);_0x821996[_0xe7f1('0x33')]=_[_0xe7f1('0x34')](_0x821996['model'],_0x821996[_0xe7f1('0x31')]);_0x50bb9f[_0xe7f1('0x35')]=_[_0xe7f1('0x34')](_0x821996[_0xe7f1('0x30')],qs[_0xe7f1('0x36')](_0x587469[_0xe7f1('0x31')]['fields']));_0x50bb9f['attributes']=_0x50bb9f[_0xe7f1('0x35')][_0xe7f1('0x37')]?_0x50bb9f[_0xe7f1('0x35')]:_0x821996[_0xe7f1('0x30')];if(!_0x587469[_0xe7f1('0x31')][_0xe7f1('0x38')](_0xe7f1('0x39'))){_0x50bb9f[_0xe7f1('0x1c')]=qs['limit'](_0x587469[_0xe7f1('0x31')]['limit']);_0x50bb9f[_0xe7f1('0x1a')]=qs[_0xe7f1('0x1a')](_0x587469[_0xe7f1('0x31')][_0xe7f1('0x1a')]);}_0x50bb9f[_0xe7f1('0x3a')]=qs[_0xe7f1('0x3b')](_0x587469[_0xe7f1('0x31')][_0xe7f1('0x3b')]);_0x50bb9f[_0xe7f1('0x3c')]=qs[_0xe7f1('0x33')](_[_0xe7f1('0x3d')](_0x587469[_0xe7f1('0x31')],_0x821996[_0xe7f1('0x33')]),_0x136392);if(_0x587469[_0xe7f1('0x31')]['filter']){_0x50bb9f['where']=_[_0xe7f1('0x3e')](_0x50bb9f[_0xe7f1('0x3c')],{'$or':_['map'](_0x136392,function(_0x235759){if(_0x235759[_0xe7f1('0x2e')]!==_0xe7f1('0x3f')){var _0x3b3b6d={};_0x3b3b6d[_0x235759[_0xe7f1('0x2a')]]={'$like':'%'+_0x587469[_0xe7f1('0x31')][_0xe7f1('0x40')]+'%'};return _0x3b3b6d;}})});}_0x50bb9f=_[_0xe7f1('0x3e')]({},_0x50bb9f,_0x587469[_0xe7f1('0x41')]);var _0x26fdf0={'where':_0x50bb9f[_0xe7f1('0x3c')]};return db[_0xe7f1('0x2d')][_0xe7f1('0x1d')](_0x26fdf0)[_0xe7f1('0x23')](function(_0x29a6d8){_0x3a9c7c['count']=_0x29a6d8;if(_0x587469[_0xe7f1('0x31')][_0xe7f1('0x42')]){_0x50bb9f[_0xe7f1('0x43')]=[{'all':!![]}];}return db[_0xe7f1('0x2d')][_0xe7f1('0x44')](_0x50bb9f);})['then'](function(_0x2486d3){_0x3a9c7c[_0xe7f1('0x45')]=_0x2486d3;return _0x3a9c7c;})[_0xe7f1('0x23')](respondWithFilteredResult(_0x5f44a4,_0x50bb9f))[_0xe7f1('0x46')](handleError(_0x5f44a4,null));};exports[_0xe7f1('0x47')]=function(_0x249c29,_0x1cf77a){var _0x583578={'raw':!![],'where':{'id':_0x249c29[_0xe7f1('0x48')]['id']}},_0x28999f={};_0x28999f[_0xe7f1('0x30')]=_['keys'](db[_0xe7f1('0x2d')]['rawAttributes']);_0x28999f[_0xe7f1('0x31')]=_[_0xe7f1('0x32')](_0x249c29[_0xe7f1('0x31')]);_0x28999f['filters']=_[_0xe7f1('0x34')](_0x28999f[_0xe7f1('0x30')],_0x28999f['query']);_0x583578['attributes']=_[_0xe7f1('0x34')](_0x28999f[_0xe7f1('0x30')],qs['fields'](_0x249c29[_0xe7f1('0x31')][_0xe7f1('0x36')]));_0x583578[_0xe7f1('0x35')]=_0x583578[_0xe7f1('0x35')]['length']?_0x583578['attributes']:_0x28999f[_0xe7f1('0x30')];if(_0x249c29['query'][_0xe7f1('0x42')]){_0x583578[_0xe7f1('0x43')]=[{'all':!![]}];}_0x583578=_['merge']({},_0x583578,_0x249c29[_0xe7f1('0x41')]);return db[_0xe7f1('0x2d')][_0xe7f1('0x49')](_0x583578)['then'](handleEntityNotFound(_0x1cf77a,null))[_0xe7f1('0x23')](respondWithResult(_0x1cf77a,null))['catch'](handleError(_0x1cf77a,null));};exports[_0xe7f1('0x4a')]=function(_0x1d4ff8,_0x110a16){return db[_0xe7f1('0x2d')][_0xe7f1('0x4a')](_0x1d4ff8[_0xe7f1('0x4b')],{})[_0xe7f1('0x23')](function(_0x585d88){var _0x104ae2=_0x1d4ff8[_0xe7f1('0x4c')][_0xe7f1('0x4d')]({'plain':!![]});if(!_0x104ae2)throw new Error(_0xe7f1('0x4e'));if(_0x104ae2[_0xe7f1('0x4f')]===_0xe7f1('0x4c')){var _0xf57312=_0x585d88['get']({'plain':!![]});var _0x59965a=_0xe7f1('0x25');return db[_0xe7f1('0x50')][_0xe7f1('0x49')]({'where':{'name':_0x59965a,'userProfileId':_0x104ae2[_0xe7f1('0x51')]},'raw':!![]})[_0xe7f1('0x23')](function(_0x35fbf3){if(_0x35fbf3&&_0x35fbf3['autoAssociation']===0x0){return db[_0xe7f1('0x26')][_0xe7f1('0x4a')]({'name':_0xf57312[_0xe7f1('0x2a')],'resourceId':_0xf57312['id'],'type':_0x35fbf3[_0xe7f1('0x2a')],'sectionId':_0x35fbf3['id']},{})[_0xe7f1('0x23')](function(){return _0x585d88;});}else{return _0x585d88;}})[_0xe7f1('0x46')](function(_0x579e4c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x579e4c);throw _0x579e4c;});}return _0x585d88;})[_0xe7f1('0x23')](respondWithResult(_0x110a16,0xc9))['catch'](handleError(_0x110a16,null));};exports[_0xe7f1('0x22')]=function(_0x5662c7,_0x2d9012){if(_0x5662c7[_0xe7f1('0x4b')]['id']){delete _0x5662c7['body']['id'];}return db['Pause'][_0xe7f1('0x49')]({'where':{'id':_0x5662c7['params']['id']}})['then'](handleEntityNotFound(_0x2d9012,null))[_0xe7f1('0x23')](saveUpdates(_0x5662c7[_0xe7f1('0x4b')],null))[_0xe7f1('0x23')](respondWithResult(_0x2d9012,null))['catch'](handleError(_0x2d9012,null));};exports[_0xe7f1('0x24')]=function(_0xd700a9,_0x522b1d){return db[_0xe7f1('0x2d')][_0xe7f1('0x49')]({'where':{'id':_0xd700a9[_0xe7f1('0x48')]['id']}})[_0xe7f1('0x23')](handleEntityNotFound(_0x522b1d,null))[_0xe7f1('0x23')](removeEntity(_0x522b1d,null))[_0xe7f1('0x46')](handleError(_0x522b1d,null));}; \ No newline at end of file +var _0x407c=['undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','error','stack','send','map','rawAttributes','fieldName','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','Pause','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','autoAssociation','update','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../mysqldb','status','end','json'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x407c,0x11f));var _0xc407=function(_0x1731bd,_0x4830f0){_0x1731bd=_0x1731bd-0x0;var _0x33e629=_0x407c[_0x1731bd];return _0x33e629;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc407('0x0'));var rp=require(_0xc407('0x1'));var moment=require('moment');var BPromise=require(_0xc407('0x2'));var Mustache=require(_0xc407('0x3'));var util=require('util');var path=require(_0xc407('0x4'));var sox=require(_0xc407('0x5'));var csv=require(_0xc407('0x6'));var ejs=require(_0xc407('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc407('0x8'));var squel=require(_0xc407('0x9'));var crypto=require(_0xc407('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc407('0xb'));var toCsv=require(_0xc407('0x6'));var querystring=require(_0xc407('0xc'));var Papa=require(_0xc407('0xd'));var Redis=require(_0xc407('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc407('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc407('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc407('0x11'))['db'];function respondWithStatusCode(_0x5bb6b3,_0x15ee16){_0x15ee16=_0x15ee16||0xcc;return function(_0xf33d2d){if(_0xf33d2d){return _0x5bb6b3['sendStatus'](_0x15ee16);}return _0x5bb6b3[_0xc407('0x12')](_0x15ee16)[_0xc407('0x13')]();};}function respondWithResult(_0x4b1b5d,_0xd76f66){_0xd76f66=_0xd76f66||0xc8;return function(_0x18eeeb){if(_0x18eeeb){return _0x4b1b5d['status'](_0xd76f66)[_0xc407('0x14')](_0x18eeeb);}};}function respondWithFilteredResult(_0x62908e,_0xdd8d56){return function(_0x15ed96){if(_0x15ed96){var _0x1389af=typeof _0xdd8d56['offset']===_0xc407('0x15')&&typeof _0xdd8d56['limit']===_0xc407('0x15');var _0x22aab7=_0x15ed96[_0xc407('0x16')];var _0x1eb987=_0x1389af?0x0:_0xdd8d56[_0xc407('0x17')];var _0x149239=_0x1389af?_0x15ed96[_0xc407('0x16')]:_0xdd8d56[_0xc407('0x17')]+_0xdd8d56['limit'];var _0x306ca8;if(_0x149239>=_0x22aab7){_0x149239=_0x22aab7;_0x306ca8=0xc8;}else{_0x306ca8=0xce;}_0x62908e[_0xc407('0x12')](_0x306ca8);return _0x62908e[_0xc407('0x18')](_0xc407('0x19'),_0x1eb987+'-'+_0x149239+'/'+_0x22aab7)['json'](_0x15ed96);}return null;};}function patchUpdates(_0xe1c9f8){return function(_0x1b7033){try{jsonpatch[_0xc407('0x1a')](_0x1b7033,_0xe1c9f8,!![]);}catch(_0x2a54ae){return BPromise[_0xc407('0x1b')](_0x2a54ae);}return _0x1b7033[_0xc407('0x1c')]();};}function saveUpdates(_0x587a4c,_0x9b004f){return function(_0x5b0941){if(_0x5b0941){return _0x5b0941['update'](_0x587a4c)[_0xc407('0x1d')](function(_0x66e0a2){return _0x66e0a2;});}return null;};}function removeEntity(_0x133712,_0xe2f2c0){return function(_0x52ca15){if(_0x52ca15){return _0x52ca15[_0xc407('0x1e')]()[_0xc407('0x1d')](function(){var _0x298d7d=_0x52ca15[_0xc407('0x1f')]({'plain':!![]});var _0x1197d5=_0xc407('0x20');return db[_0xc407('0x21')][_0xc407('0x1e')]({'where':{'type':_0x1197d5,'resourceId':_0x298d7d['id']}})['then'](function(){return _0x52ca15;});})[_0xc407('0x1d')](function(){_0x133712[_0xc407('0x12')](0xcc)[_0xc407('0x13')]();});}};}function handleEntityNotFound(_0x4be228,_0x3c6f18){return function(_0x48d8b6){if(!_0x48d8b6){_0x4be228['sendStatus'](0x194);}return _0x48d8b6;};}function handleError(_0xb62877,_0x5709d5){_0x5709d5=_0x5709d5||0x1f4;return function(_0x57f196){logger[_0xc407('0x22')](_0x57f196[_0xc407('0x23')]);if(_0x57f196['name']){delete _0x57f196['name'];}_0xb62877[_0xc407('0x12')](_0x5709d5)[_0xc407('0x24')](_0x57f196);};}exports['index']=function(_0x29db29,_0x28723f){var _0x1957a4={},_0x28df4d={},_0x4d424d={'count':0x0,'rows':[]};var _0x3145d5=_[_0xc407('0x25')](db['Pause'][_0xc407('0x26')],function(_0x42794f){return{'name':_0x42794f[_0xc407('0x27')],'type':_0x42794f['type']['key']};});_0x28df4d['model']=_[_0xc407('0x25')](_0x3145d5,_0xc407('0x28'));_0x28df4d[_0xc407('0x29')]=_[_0xc407('0x2a')](_0x29db29[_0xc407('0x29')]);_0x28df4d['filters']=_[_0xc407('0x2b')](_0x28df4d[_0xc407('0x2c')],_0x28df4d[_0xc407('0x29')]);_0x1957a4[_0xc407('0x2d')]=_[_0xc407('0x2b')](_0x28df4d[_0xc407('0x2c')],qs[_0xc407('0x2e')](_0x29db29[_0xc407('0x29')]['fields']));_0x1957a4['attributes']=_0x1957a4['attributes'][_0xc407('0x2f')]?_0x1957a4[_0xc407('0x2d')]:_0x28df4d[_0xc407('0x2c')];if(!_0x29db29[_0xc407('0x29')][_0xc407('0x30')](_0xc407('0x31'))){_0x1957a4[_0xc407('0x32')]=qs[_0xc407('0x32')](_0x29db29[_0xc407('0x29')][_0xc407('0x32')]);_0x1957a4[_0xc407('0x17')]=qs['offset'](_0x29db29['query'][_0xc407('0x17')]);}_0x1957a4[_0xc407('0x33')]=qs[_0xc407('0x34')](_0x29db29[_0xc407('0x29')]['sort']);_0x1957a4[_0xc407('0x35')]=qs[_0xc407('0x36')](_[_0xc407('0x37')](_0x29db29[_0xc407('0x29')],_0x28df4d['filters']),_0x3145d5);if(_0x29db29[_0xc407('0x29')][_0xc407('0x38')]){_0x1957a4[_0xc407('0x35')]=_[_0xc407('0x39')](_0x1957a4[_0xc407('0x35')],{'$or':_['map'](_0x3145d5,function(_0x2c017e){if(_0x2c017e[_0xc407('0x3a')]!==_0xc407('0x3b')){var _0x57519d={};_0x57519d[_0x2c017e[_0xc407('0x28')]]={'$like':'%'+_0x29db29['query'][_0xc407('0x38')]+'%'};return _0x57519d;}})});}_0x1957a4=_['merge']({},_0x1957a4,_0x29db29[_0xc407('0x3c')]);var _0x3b7b51={'where':_0x1957a4[_0xc407('0x35')]};return db[_0xc407('0x3d')][_0xc407('0x16')](_0x3b7b51)[_0xc407('0x1d')](function(_0x2ba4ea){_0x4d424d[_0xc407('0x16')]=_0x2ba4ea;if(_0x29db29[_0xc407('0x29')]['includeAll']){_0x1957a4[_0xc407('0x3e')]=[{'all':!![]}];}return db[_0xc407('0x3d')][_0xc407('0x3f')](_0x1957a4);})[_0xc407('0x1d')](function(_0x4f6362){_0x4d424d[_0xc407('0x40')]=_0x4f6362;return _0x4d424d;})[_0xc407('0x1d')](respondWithFilteredResult(_0x28723f,_0x1957a4))[_0xc407('0x41')](handleError(_0x28723f,null));};exports[_0xc407('0x42')]=function(_0x29ace0,_0x5a556a){var _0x7fd4fb={'raw':!![],'where':{'id':_0x29ace0[_0xc407('0x43')]['id']}},_0x5cb1cf={};_0x5cb1cf[_0xc407('0x2c')]=_[_0xc407('0x2a')](db['Pause'][_0xc407('0x26')]);_0x5cb1cf[_0xc407('0x29')]=_['keys'](_0x29ace0[_0xc407('0x29')]);_0x5cb1cf[_0xc407('0x36')]=_['intersection'](_0x5cb1cf[_0xc407('0x2c')],_0x5cb1cf['query']);_0x7fd4fb[_0xc407('0x2d')]=_[_0xc407('0x2b')](_0x5cb1cf[_0xc407('0x2c')],qs['fields'](_0x29ace0['query'][_0xc407('0x2e')]));_0x7fd4fb['attributes']=_0x7fd4fb[_0xc407('0x2d')][_0xc407('0x2f')]?_0x7fd4fb[_0xc407('0x2d')]:_0x5cb1cf['model'];if(_0x29ace0[_0xc407('0x29')][_0xc407('0x44')]){_0x7fd4fb[_0xc407('0x3e')]=[{'all':!![]}];}_0x7fd4fb=_[_0xc407('0x39')]({},_0x7fd4fb,_0x29ace0[_0xc407('0x3c')]);return db[_0xc407('0x3d')][_0xc407('0x45')](_0x7fd4fb)['then'](handleEntityNotFound(_0x5a556a,null))[_0xc407('0x1d')](respondWithResult(_0x5a556a,null))['catch'](handleError(_0x5a556a,null));};exports[_0xc407('0x46')]=function(_0x1ca2fc,_0xec1bb3){return db[_0xc407('0x3d')][_0xc407('0x46')](_0x1ca2fc[_0xc407('0x47')],{})[_0xc407('0x1d')](function(_0x51021a){var _0xd49fce=_0x1ca2fc[_0xc407('0x48')][_0xc407('0x1f')]({'plain':!![]});if(!_0xd49fce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd49fce[_0xc407('0x49')]===_0xc407('0x48')){var _0x5bd1d0=_0x51021a['get']({'plain':!![]});var _0x5d783b=_0xc407('0x20');return db[_0xc407('0x4a')][_0xc407('0x45')]({'where':{'name':_0x5d783b,'userProfileId':_0xd49fce['userProfileId']},'raw':!![]})[_0xc407('0x1d')](function(_0x2dbae2){if(_0x2dbae2&&_0x2dbae2[_0xc407('0x4b')]===0x0){return db[_0xc407('0x21')][_0xc407('0x46')]({'name':_0x5bd1d0[_0xc407('0x28')],'resourceId':_0x5bd1d0['id'],'type':_0x2dbae2[_0xc407('0x28')],'sectionId':_0x2dbae2['id']},{})[_0xc407('0x1d')](function(){return _0x51021a;});}else{return _0x51021a;}})['catch'](function(_0x436529){logger[_0xc407('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x436529);throw _0x436529;});}return _0x51021a;})['then'](respondWithResult(_0xec1bb3,0xc9))[_0xc407('0x41')](handleError(_0xec1bb3,null));};exports[_0xc407('0x4c')]=function(_0x36c111,_0x327a97){if(_0x36c111[_0xc407('0x47')]['id']){delete _0x36c111[_0xc407('0x47')]['id'];}return db['Pause'][_0xc407('0x45')]({'where':{'id':_0x36c111[_0xc407('0x43')]['id']}})['then'](handleEntityNotFound(_0x327a97,null))[_0xc407('0x1d')](saveUpdates(_0x36c111[_0xc407('0x47')],null))['then'](respondWithResult(_0x327a97,null))[_0xc407('0x41')](handleError(_0x327a97,null));};exports['destroy']=function(_0x3aa4d4,_0x5114ac){return db[_0xc407('0x3d')]['find']({'where':{'id':_0x3aa4d4[_0xc407('0x43')]['id']}})[_0xc407('0x1d')](handleEntityNotFound(_0x5114ac,null))['then'](removeEntity(_0x5114ac,null))[_0xc407('0x41')](handleError(_0x5114ac,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 97e5bc1..2d22506 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x1c8e4e,_0x25bf52){var _0x240570=function(_0x501469){while(--_0x501469){_0x1c8e4e['push'](_0x1c8e4e['shift']());}};_0x240570(++_0x25bf52);}(_0x814b,0x1a2));var _0xb814=function(_0x28c4db,_0x2ccd05){_0x28c4db=_0x28c4db-0x0;var _0x5907ed=_0x814b[_0x28c4db];return _0x5907ed;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 0dbc433..8a0849b 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5695f1,_0x58d772){var _0x41be9f=function(_0x433772){while(--_0x433772){_0x5695f1['push'](_0x5695f1['shift']());}};_0x41be9f(++_0x58d772);}(_0xb10b,0x12a));var _0xbb10=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0xb10b[_0x16cb03];return _0x10944e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x325888,_0x163485){var _0x2edbd1=function(_0x7631b1){while(--_0x7631b1){_0x325888['push'](_0x325888['shift']());}};_0x2edbd1(++_0x163485);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a98e3,_0x488997){_0x2a98e3=_0x2a98e3-0x0;var _0x370a71=_0xb10b[_0x2a98e3];return _0x370a71;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index f60e39f..c237e46 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5178=['root','server/files/plugins','originalname','replace','format','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/webhook','webhookGet','isAuthenticated','/:id/download','diskStorage','join'];(function(_0x358d87,_0x2bc563){var _0x5c3050=function(_0x5a92b0){while(--_0x5a92b0){_0x358d87['push'](_0x358d87['shift']());}};_0x5c3050(++_0x2bc563);}(_0x5178,0x171));var _0x8517=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5178[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./plugin.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),controller[_0x8517('0xa')]);router[_0x8517('0x7')]('/:id',auth[_0x8517('0xb')](),controller['show']);router['get'](_0x8517('0xc'),auth[_0x8517('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x8517('0xd')]({'destination':function(_0x24172f,_0x203154,_0x3be6b0){_0x3be6b0(null,path[_0x8517('0xe')](config[_0x8517('0xf')],_0x8517('0x10')));},'filename':function(_0x12388f,_0x4b9768,_0x9c57de){_0x4b9768[_0x8517('0x11')]=_0x4b9768[_0x8517('0x11')][_0x8517('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9c57de(null,util[_0x8517('0x13')]('%s-%s%s',path[_0x8517('0x14')](_0x4b9768[_0x8517('0x11')],path[_0x8517('0x15')](_0x4b9768[_0x8517('0x11')])),Date[_0x8517('0x16')](),path[_0x8517('0x15')](_0x4b9768[_0x8517('0x11')])));}})});router[_0x8517('0x17')]('/',upload[_0x8517('0x18')](_0x8517('0x19')),controller[_0x8517('0x1a')]);router[_0x8517('0x17')]('/webhook',controller[_0x8517('0x1b')]);router[_0x8517('0x1c')](_0x8517('0x1d'),auth[_0x8517('0xb')](),controller[_0x8517('0x1e')]);router[_0x8517('0x1f')](_0x8517('0x1d'),auth['isAuthenticated'](),controller[_0x8517('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x3140=['../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','single','file','upload','delete','multer','util','path','connect-timeout','fs-extra'];(function(_0xec6b69,_0x5dd17c){var _0x4ac162=function(_0x2631e1){while(--_0x2631e1){_0xec6b69['push'](_0xec6b69['shift']());}};_0x4ac162(++_0x5dd17c);}(_0x3140,0xaf));var _0x0314=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x3140[_0x162780];return _0x1ea2dc;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),controller[_0x0314('0xd')]);router['get'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['show']);router['get'](_0x0314('0xf'),auth['isAuthenticated'](),controller[_0x0314('0x10')]);var upload=multer({'storage':multer[_0x0314('0x11')]({'destination':function(_0x3a7713,_0x376da9,_0x375416){_0x375416(null,path[_0x0314('0x12')](config['root'],_0x0314('0x13')));},'filename':function(_0x2bc151,_0xd85ddf,_0x4602ec){_0xd85ddf[_0x0314('0x14')]=_0xd85ddf[_0x0314('0x14')][_0x0314('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4602ec(null,util['format'](_0x0314('0x16'),path[_0x0314('0x17')](_0xd85ddf[_0x0314('0x14')],path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])),Date[_0x0314('0x19')](),path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])));}})});router['post']('/',upload[_0x0314('0x1a')](_0x0314('0x1b')),controller[_0x0314('0x1c')]);router['post'](_0x0314('0xc'),controller['webhookPost']);router['put'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['update']);router[_0x0314('0x1d')](_0x0314('0xe'),auth['isAuthenticated'](),controller[_0x0314('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 388c0b5..be4ff7c 100644 --- a/server/api/plugin/plugin.attributes.js +++ b/server/api/plugin/plugin.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6795=['STRING','ENUM','html','script','TEXT','BOOLEAN','adminOnly','agentOnly','always','sequelize'];(function(_0x567ea1,_0x3cb026){var _0x20964d=function(_0x2a7102){while(--_0x2a7102){_0x567ea1['push'](_0x567ea1['shift']());}};_0x20964d(++_0x3cb026);}(_0x6795,0xd1));var _0x5679=function(_0x205426,_0x604832){_0x205426=_0x205426-0x0;var _0x2aa1c0=_0x6795[_0x205426];return _0x2aa1c0;};'use strict';var Sequelize=require(_0x5679('0x0'));module['exports']={'name':{'type':Sequelize[_0x5679('0x1')]},'type':{'type':Sequelize[_0x5679('0x2')](_0x5679('0x3'),_0x5679('0x4'))},'description':{'type':Sequelize[_0x5679('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x5679('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x5679('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x5679('0x7'),_0x5679('0x8'),_0x5679('0x9'),'never'),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x5679('0x1')]},'adminUrl':{'type':Sequelize[_0x5679('0x1')]},'agentUrl':{'type':Sequelize[_0x5679('0x1')]},'scriptName':{'type':Sequelize[_0x5679('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1eca=['ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x5ed918,_0x130a32){var _0x250859=function(_0x19ec58){while(--_0x19ec58){_0x5ed918['push'](_0x5ed918['shift']());}};_0x250859(++_0x130a32);}(_0x1eca,0x10f));var _0xa1ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1eca[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa1ec('0x0'));module[_0xa1ec('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa1ec('0x2')](_0xa1ec('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xa1ec('0x4')]},'path':{'type':Sequelize[_0xa1ec('0x5')],'comment':_0xa1ec('0x6')},'active':{'type':Sequelize[_0xa1ec('0x7')],'defaultValue':0x0,'comment':_0xa1ec('0x8')},'sidebar':{'type':Sequelize[_0xa1ec('0x2')](_0xa1ec('0x9'),_0xa1ec('0xa'),_0xa1ec('0xb'),'never'),'defaultValue':'always','comment':_0xa1ec('0xc')},'icon':{'type':Sequelize[_0xa1ec('0x5')]},'adminUrl':{'type':Sequelize[_0xa1ec('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xa1ec('0x5')]},'scriptPath':{'type':Sequelize[_0xa1ec('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 0a50340..686ce33 100644 --- a/server/api/plugin/plugin.controller.js +++ b/server/api/plugin/plugin.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0b0=['Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','set','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','%s%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','findAll','catch','params','keys','includeAll','include','options','find','join','server/files/plugins','format','%s.zip','basename','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','file','filename','extname','root','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','some','manifest.json','readFileSync','parse'];(function(_0x5a7508,_0x2f8246){var _0x11e32b=function(_0x5e30b8){while(--_0x5e30b8){_0x5a7508['push'](_0x5a7508['shift']());}};_0x11e32b(++_0x2f8246);}(_0xb0b0,0xdd));var _0x0b0b=function(_0x2bec1d,_0x3ead52){_0x2bec1d=_0x2bec1d-0x0;var _0x416250=_0xb0b0[_0x2bec1d];return _0x416250;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b0b('0x0'));var zipdir=require(_0x0b0b('0x1'));var jsonpatch=require(_0x0b0b('0x2'));var rp=require(_0x0b0b('0x3'));var moment=require(_0x0b0b('0x4'));var BPromise=require(_0x0b0b('0x5'));var Mustache=require(_0x0b0b('0x6'));var util=require('util');var path=require(_0x0b0b('0x7'));var sox=require(_0x0b0b('0x8'));var csv=require(_0x0b0b('0x9'));var ejs=require(_0x0b0b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b0b('0xb'));var squel=require('squel');var crypto=require(_0x0b0b('0xc'));var jsforce=require(_0x0b0b('0xd'));var deskjs=require(_0x0b0b('0xe'));var toCsv=require(_0x0b0b('0x9'));var querystring=require(_0x0b0b('0xf'));var Papa=require(_0x0b0b('0x10'));var extract=require(_0x0b0b('0x11'));var rimraf=require(_0x0b0b('0x0'));var archiver=require(_0x0b0b('0x12'));var Redis=require(_0x0b0b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0b0b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0b0b('0x15'));var utils=require(_0x0b0b('0x16'));var config=require(_0x0b0b('0x17'));var licenseUtil=require(_0x0b0b('0x18'));var db=require(_0x0b0b('0x19'))['db'];config['redis']=_[_0x0b0b('0x1a')](config[_0x0b0b('0x1b')],{'host':_0x0b0b('0x1c'),'port':0x18eb});var socket=require(_0x0b0b('0x1d'))(new Redis(config[_0x0b0b('0x1b')]));require(_0x0b0b('0x1e'))['register'](socket);function respondWithStatusCode(_0x67871a,_0x5ed9ef){_0x5ed9ef=_0x5ed9ef||0xcc;return function(_0x335b4e){if(_0x335b4e){return _0x67871a[_0x0b0b('0x1f')](_0x5ed9ef);}return _0x67871a[_0x0b0b('0x20')](_0x5ed9ef)[_0x0b0b('0x21')]();};}function respondWithResult(_0x5ca1c0,_0x22e967){_0x22e967=_0x22e967||0xc8;return function(_0x209ec7){if(_0x209ec7){return _0x5ca1c0[_0x0b0b('0x20')](_0x22e967)['json'](_0x209ec7);}};}function respondWithFilteredResult(_0x1312f2,_0x3f1d29){return function(_0x3c4c3d){if(_0x3c4c3d){var _0x2eb699=typeof _0x3f1d29[_0x0b0b('0x22')]===_0x0b0b('0x23')&&typeof _0x3f1d29['limit']===_0x0b0b('0x23');var _0x59fcf3=_0x3c4c3d[_0x0b0b('0x24')];var _0xd291e8=_0x2eb699?0x0:_0x3f1d29[_0x0b0b('0x22')];var _0x211666=_0x2eb699?_0x3c4c3d[_0x0b0b('0x24')]:_0x3f1d29[_0x0b0b('0x22')]+_0x3f1d29[_0x0b0b('0x25')];var _0x149405;if(_0x211666>=_0x59fcf3){_0x211666=_0x59fcf3;_0x149405=0xc8;}else{_0x149405=0xce;}_0x1312f2[_0x0b0b('0x20')](_0x149405);return _0x1312f2['set']('Content-Range',_0xd291e8+'-'+_0x211666+'/'+_0x59fcf3)[_0x0b0b('0x26')](_0x3c4c3d);}return null;};}function patchUpdates(_0x414a30){return function(_0x79b44d){try{jsonpatch[_0x0b0b('0x27')](_0x79b44d,_0x414a30,!![]);}catch(_0x146164){return BPromise[_0x0b0b('0x28')](_0x146164);}return _0x79b44d[_0x0b0b('0x29')]();};}function saveUpdates(_0x2f601b,_0x49d2b8){return function(_0x393506){if(_0x393506){return _0x393506[_0x0b0b('0x2a')](_0x2f601b)[_0x0b0b('0x2b')](function(_0x215885){return _0x215885;});}return null;};}function removeEntity(_0xaf577,_0x1eb5d1){return function(_0x23f1c8){if(_0x23f1c8){return _0x23f1c8[_0x0b0b('0x2c')]()['then'](function(){var _0x111b48=_0x23f1c8[_0x0b0b('0x2d')]({'plain':!![]});var _0x2ddebc=_0x0b0b('0x2e');return db[_0x0b0b('0x2f')][_0x0b0b('0x2c')]({'where':{'type':_0x2ddebc,'resourceId':_0x111b48['id']}})[_0x0b0b('0x2b')](function(){return _0x23f1c8;});})[_0x0b0b('0x2b')](function(){_0xaf577[_0x0b0b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26ff15,_0x4318e9){return function(_0xcbc22){if(!_0xcbc22){_0x26ff15[_0x0b0b('0x1f')](0x194);}return _0xcbc22;};}function handleError(_0x37f22d,_0xbb7c89){_0xbb7c89=_0xbb7c89||0x1f4;return function(_0x18f23d){logger[_0x0b0b('0x30')](_0x18f23d[_0x0b0b('0x31')]);if(_0x18f23d[_0x0b0b('0x32')]){delete _0x18f23d[_0x0b0b('0x32')];}_0x37f22d[_0x0b0b('0x20')](_0xbb7c89)[_0x0b0b('0x33')](_0x18f23d);};}exports[_0x0b0b('0x34')]=function(_0x56ca13,_0x4d76c2){var _0x55b411={},_0x475cb5={},_0x66c9ed={'count':0x0,'rows':[]};var _0x48234a=_[_0x0b0b('0x35')](db[_0x0b0b('0x36')][_0x0b0b('0x37')],function(_0x4700cf){return{'name':_0x4700cf[_0x0b0b('0x38')],'type':_0x4700cf[_0x0b0b('0x39')]['key']};});_0x475cb5[_0x0b0b('0x3a')]=_['map'](_0x48234a,'name');_0x475cb5[_0x0b0b('0x3b')]=_['keys'](_0x56ca13[_0x0b0b('0x3b')]);_0x475cb5[_0x0b0b('0x3c')]=_[_0x0b0b('0x3d')](_0x475cb5[_0x0b0b('0x3a')],_0x475cb5[_0x0b0b('0x3b')]);_0x55b411[_0x0b0b('0x3e')]=_[_0x0b0b('0x3d')](_0x475cb5[_0x0b0b('0x3a')],qs['fields'](_0x56ca13['query'][_0x0b0b('0x3f')]));_0x55b411[_0x0b0b('0x3e')]=_0x55b411[_0x0b0b('0x3e')][_0x0b0b('0x40')]?_0x55b411[_0x0b0b('0x3e')]:_0x475cb5[_0x0b0b('0x3a')];if(!_0x56ca13[_0x0b0b('0x3b')][_0x0b0b('0x41')](_0x0b0b('0x42'))){_0x55b411[_0x0b0b('0x25')]=qs[_0x0b0b('0x25')](_0x56ca13[_0x0b0b('0x3b')][_0x0b0b('0x25')]);_0x55b411[_0x0b0b('0x22')]=qs[_0x0b0b('0x22')](_0x56ca13[_0x0b0b('0x3b')][_0x0b0b('0x22')]);}_0x55b411['order']=qs[_0x0b0b('0x43')](_0x56ca13[_0x0b0b('0x3b')][_0x0b0b('0x43')]);_0x55b411['where']=qs[_0x0b0b('0x3c')](_[_0x0b0b('0x44')](_0x56ca13['query'],_0x475cb5[_0x0b0b('0x3c')]),_0x48234a);if(_0x56ca13[_0x0b0b('0x3b')][_0x0b0b('0x45')]){_0x55b411[_0x0b0b('0x46')]=_[_0x0b0b('0x47')](_0x55b411['where'],{'$or':_[_0x0b0b('0x35')](_0x48234a,function(_0x3d02d6){if(_0x3d02d6['type']!==_0x0b0b('0x48')){var _0x591eb8={};_0x591eb8[_0x3d02d6[_0x0b0b('0x32')]]={'$like':'%'+_0x56ca13[_0x0b0b('0x3b')][_0x0b0b('0x45')]+'%'};return _0x591eb8;}})});}_0x55b411=_['merge']({},_0x55b411,_0x56ca13['options']);var _0x1c8951={'where':_0x55b411[_0x0b0b('0x46')]};return db[_0x0b0b('0x36')][_0x0b0b('0x24')](_0x1c8951)[_0x0b0b('0x2b')](function(_0x3267a7){_0x66c9ed['count']=_0x3267a7;if(_0x56ca13[_0x0b0b('0x3b')]['includeAll']){_0x55b411['include']=[{'all':!![]}];}return db['Plugin'][_0x0b0b('0x49')](_0x55b411);})[_0x0b0b('0x2b')](function(_0x40e5ff){_0x66c9ed['rows']=_0x40e5ff;return _0x66c9ed;})['then'](respondWithFilteredResult(_0x4d76c2,_0x55b411))[_0x0b0b('0x4a')](handleError(_0x4d76c2,null));};exports['show']=function(_0x21ca03,_0x4d6c40){var _0x1d2c37={'raw':!![],'where':{'id':_0x21ca03[_0x0b0b('0x4b')]['id']}},_0x30783f={};_0x30783f[_0x0b0b('0x3a')]=_[_0x0b0b('0x4c')](db['Plugin'][_0x0b0b('0x37')]);_0x30783f[_0x0b0b('0x3b')]=_[_0x0b0b('0x4c')](_0x21ca03['query']);_0x30783f[_0x0b0b('0x3c')]=_['intersection'](_0x30783f[_0x0b0b('0x3a')],_0x30783f[_0x0b0b('0x3b')]);_0x1d2c37['attributes']=_[_0x0b0b('0x3d')](_0x30783f['model'],qs[_0x0b0b('0x3f')](_0x21ca03['query']['fields']));_0x1d2c37[_0x0b0b('0x3e')]=_0x1d2c37['attributes'][_0x0b0b('0x40')]?_0x1d2c37['attributes']:_0x30783f[_0x0b0b('0x3a')];if(_0x21ca03[_0x0b0b('0x3b')][_0x0b0b('0x4d')]){_0x1d2c37[_0x0b0b('0x4e')]=[{'all':!![]}];}_0x1d2c37=_[_0x0b0b('0x47')]({},_0x1d2c37,_0x21ca03[_0x0b0b('0x4f')]);return db[_0x0b0b('0x36')]['find'](_0x1d2c37)['then'](handleEntityNotFound(_0x4d6c40,null))[_0x0b0b('0x2b')](respondWithResult(_0x4d6c40,null))['catch'](handleError(_0x4d6c40,null));};exports['download']=function(_0x323f09,_0x4f3069,_0x275f2e){return db[_0x0b0b('0x36')][_0x0b0b('0x50')]({'where':{'id':_0x323f09['params']['id']},'attributes':['name',_0x0b0b('0x7')],'raw':!![]})[_0x0b0b('0x2b')](handleEntityNotFound(_0x4f3069,null))[_0x0b0b('0x2b')](function(_0x48cf47){if(_0x48cf47){var _0xe8289=path[_0x0b0b('0x51')](config['root'],_0x0b0b('0x52'),util[_0x0b0b('0x53')](_0x0b0b('0x54'),path[_0x0b0b('0x55')](_0x48cf47[_0x0b0b('0x7')])));var _0x4df297=fs['createWriteStream'](_0xe8289);var _0xdb9d44=archiver('zip',{'zlib':{'level':0x9}});_0xdb9d44['on'](_0x0b0b('0x56'),function(_0x385803){if(_0x385803[_0x0b0b('0x57')]===_0x0b0b('0x58')){logger[_0x0b0b('0x30')](_0x385803);}else{throw new db[(_0x0b0b('0x59'))][(_0x0b0b('0x5a'))](_0x0b0b('0x5b'));}});_0xdb9d44['on']('error',function(_0x13dd91){throw new db[(_0x0b0b('0x59'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xdb9d44['pipe'](_0x4df297);_0xdb9d44['glob'](_0x0b0b('0x5c'),{'cwd':path[_0x0b0b('0x51')](config['root'],_0x0b0b('0x52'),path[_0x0b0b('0x5d')](_0x48cf47['path'])),'ignore':[path[_0x0b0b('0x51')](path[_0x0b0b('0x55')](_0x48cf47[_0x0b0b('0x7')]),_0x0b0b('0x5e')),path[_0x0b0b('0x51')](path['basename'](_0x48cf47[_0x0b0b('0x7')]),_0x0b0b('0x5f'))],'nodir':!![]})['finalize']();_0x4df297['on'](_0x0b0b('0x60'),function(){if(!fs[_0x0b0b('0x61')](_0xe8289)){throw new db[(_0x0b0b('0x59'))]['Error'](_0x0b0b('0x62'));}return _0x4f3069[_0x0b0b('0x63')](_0xe8289,util[_0x0b0b('0x53')](_0x0b0b('0x54'),path['basename'](_0x48cf47[_0x0b0b('0x7')])),function(_0x452db9){if(_0x452db9){throw new db[(_0x0b0b('0x59'))][(_0x0b0b('0x5a'))](_0x0b0b('0x64'));}fs[_0x0b0b('0x65')](_0xe8289);logger['info'](_0x0b0b('0x66'));logger[_0x0b0b('0x67')](_0x0b0b('0x68'));});});}return null;})[_0x0b0b('0x4a')](handleError(_0x4f3069,null));};exports['upload']=function(_0x233190,_0x2b9949,_0x159531){var _0x2af1d9=path[_0x0b0b('0x55')](_0x233190[_0x0b0b('0x69')][_0x0b0b('0x6a')],path[_0x0b0b('0x6b')](_0x233190[_0x0b0b('0x69')][_0x0b0b('0x6a')]));var _0x52d237=path[_0x0b0b('0x51')](config[_0x0b0b('0x6c')],_0x0b0b('0x52'),_0x233190[_0x0b0b('0x69')][_0x0b0b('0x6a')]);var _0x2503a2=path[_0x0b0b('0x51')](config[_0x0b0b('0x6c')],'server/files/plugins',_0x2af1d9);logger[_0x0b0b('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0x52d237);logger[_0x0b0b('0x67')]('Plugin\x20upload\x20destination:\x20%s',_0x2503a2);try{fs['chmodSync'](_0x52d237,parseInt('0777',0x8));extract(_0x52d237,{'dir':_0x2503a2},function(_0x181352){if(_0x181352){logger[_0x0b0b('0x30')](_0x181352);handleError(_0x181352,!![]);};var _0x13a38e=fs['readdirSync'](_0x2503a2);if(_0x13a38e[_0x0b0b('0x40')]>0x1){removeReferences(_0x52d237,_0x2503a2);logger[_0x0b0b('0x30')](_0x0b0b('0x6d'));return _0x159531(new Error(_0x0b0b('0x6d')));}var _0x512c9f=fs['lstatSync'](path[_0x0b0b('0x51')](_0x2503a2,_0x13a38e[0x0]));if(_0x512c9f[_0x0b0b('0x6e')]()){removeReferences(_0x52d237,_0x2503a2);logger[_0x0b0b('0x30')](_0x0b0b('0x6d'));return _0x159531(new Error(_0x0b0b('0x6d')));}if(_0x512c9f[_0x0b0b('0x6f')]()){var _0x563380=fs[_0x0b0b('0x70')](path[_0x0b0b('0x51')](_0x2503a2,_0x13a38e[0x0]));if(_0x563380['length']===0x0){removeReferences(_0x52d237,_0x2503a2);logger[_0x0b0b('0x30')](_0x0b0b('0x6d'));return _0x159531(new Error(_0x0b0b('0x6d')));}var _0x4a98e7=_0x563380[_0x0b0b('0x71')](function(_0x16f9bc){return _0x16f9bc===_0x0b0b('0x72');});if(!_0x4a98e7){return _0x159531(new Error('Plugin\x20manifest\x20missing'));}var _0xbf1edd=fs[_0x0b0b('0x73')](path[_0x0b0b('0x51')](_0x2503a2,_0x13a38e[0x0],_0x0b0b('0x72')));var _0x9963ed=JSON[_0x0b0b('0x74')](_0xbf1edd);if('undefined'==typeof _0x9963ed['name']){return _0x159531(new Error(_0x0b0b('0x75')));}if('undefined'==typeof _0x9963ed[_0x0b0b('0x39')]){return _0x159531(new Error(_0x0b0b('0x76')));}if('undefined'==typeof _0x9963ed[_0x0b0b('0x77')]){return _0x159531(new Error(_0x0b0b('0x78')));}if(_0x0b0b('0x23')==typeof _0x9963ed['parameters']){return _0x159531(new Error(_0x0b0b('0x79')));}if(_0x9963ed[_0x0b0b('0x39')]===_0x0b0b('0x7a')){if(_0x0b0b('0x23')==typeof _0x9963ed[_0x0b0b('0x7b')][_0x0b0b('0x7c')]){return _0x159531(new Error(_0x0b0b('0x7d')));}if(_0x0b0b('0x23')==typeof _0x9963ed['parameters']['views'][_0x0b0b('0x7e')]&&_0x0b0b('0x23')==typeof _0x9963ed['parameters'][_0x0b0b('0x7c')][_0x0b0b('0x7f')]){return _0x159531(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x9963ed['type']===_0x0b0b('0x80')){if(_0x0b0b('0x23')==typeof _0x9963ed['parameters']['scriptName']){return _0x159531(new Error(_0x0b0b('0x81')));}if(_0x0b0b('0x23')==typeof _0x9963ed[_0x0b0b('0x7b')][_0x0b0b('0x82')]){return _0x159531(new Error(_0x0b0b('0x83')));}}else{return _0x159531(new Error(_0x0b0b('0x84')));}var _0xe900a5=_0x9963ed[_0x0b0b('0x32')];var _0x5be9a9=_0x9963ed[_0x0b0b('0x85')];var _0x4043d1=_0x9963ed[_0x0b0b('0x39')];var _0x2474f4=_0x9963ed[_0x0b0b('0x86')]?_0x9963ed[_0x0b0b('0x86')]:_0x0b0b('0x87');var _0x271cef=_0x9963ed[_0x0b0b('0x88')]?_0x9963ed[_0x0b0b('0x88')]:_0x0b0b('0x89');var _0x1d034c='';var _0x1ad596='';var _0x15ba0b='';var _0x583d4d='';var _0x11f6c6=_0x9963ed[_0x0b0b('0x77')];if(_0x4043d1==='html'){if(_0x0b0b('0x23')!=typeof _0x9963ed[_0x0b0b('0x7b')]['views'][_0x0b0b('0x7e')]){var _0x4ca84d=_0x9963ed[_0x0b0b('0x7b')][_0x0b0b('0x7c')][_0x0b0b('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x0b0b('0x8a')](_0x4ca84d)){_0x1d034c=path[_0x0b0b('0x51')](_0x0b0b('0x8b'),_0x2af1d9,_0x13a38e[0x0],_0x4ca84d);}else{_0x1d034c=_0x4ca84d;}}else{logger[_0x0b0b('0x67')](_0x0b0b('0x8c'));}if(_0x0b0b('0x23')!=typeof _0x9963ed['parameters'][_0x0b0b('0x7c')][_0x0b0b('0x7f')]){var _0x439fd4=_0x9963ed[_0x0b0b('0x7b')]['views'][_0x0b0b('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x0b0b('0x8a')](_0x439fd4)){_0x1ad596=path[_0x0b0b('0x51')](_0x0b0b('0x8b'),_0x2af1d9,_0x13a38e[0x0],_0x439fd4);}else{_0x1ad596=_0x439fd4;}}else{logger[_0x0b0b('0x67')](_0x0b0b('0x8d'));}}else if(_0x4043d1===_0x0b0b('0x80')){_0x15ba0b=_0x9963ed['parameters']['scriptName'];_0x583d4d=_0x9963ed['parameters'][_0x0b0b('0x82')];if(_0x0b0b('0x23')!=typeof _0x9963ed['parameters'][_0x0b0b('0x7c')]){if(_0x0b0b('0x23')!=typeof _0x9963ed[_0x0b0b('0x7b')]['views'][_0x0b0b('0x7e')]){var _0x4ca84d=_0x9963ed['parameters']['views'][_0x0b0b('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x0b0b('0x8a')](_0x4ca84d)){_0x1d034c=path[_0x0b0b('0x51')](_0x0b0b('0x8b'),_0x2af1d9,_0x13a38e[0x0],_0x4ca84d);}else{_0x1d034c=_0x4ca84d;}}if('undefined'!=typeof _0x9963ed[_0x0b0b('0x7b')]['views']['agent']){var _0x439fd4=_0x9963ed[_0x0b0b('0x7b')][_0x0b0b('0x7c')][_0x0b0b('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x0b0b('0x8a')](_0x439fd4)){_0x1ad596=path[_0x0b0b('0x51')]('plugins',_0x2af1d9,_0x13a38e[0x0],_0x439fd4);}else{_0x1ad596=_0x439fd4;}}}}var _0x522854={'name':_0xe900a5,'description':_0x5be9a9,'path':path[_0x0b0b('0x51')](_0x2af1d9,_0x13a38e[0x0]),'type':_0x4043d1,'sidebar':_0x2474f4,'icon':_0x271cef,'adminUrl':_0x1d034c,'agentUrl':_0x1ad596,'scriptName':_0x15ba0b,'scriptPath':_0x583d4d,'version':_0x11f6c6};removeReferences(_0x52d237,null);return db[_0x0b0b('0x36')]['create'](_0x522854)[_0x0b0b('0x2b')](function(_0x5381a5){var _0x10430b={'role':_0x233190[_0x0b0b('0x8e')]['role'],'userProfileId':_0x233190[_0x0b0b('0x8e')][_0x0b0b('0x8f')]};if(!_0x10430b)throw new Error(_0x0b0b('0x90'));if(_0x10430b['role']===_0x0b0b('0x91')){var _0x17c4f7=_0x5381a5['get']({'plain':!![]});return db[_0x0b0b('0x92')][_0x0b0b('0x50')]({'where':{'name':_0x0b0b('0x2e'),'userProfileId':_0x10430b['userProfileId']},'raw':!![]})[_0x0b0b('0x2b')](function(_0x1b7f74){if(_0x1b7f74&&_0x1b7f74[_0x0b0b('0x93')]===0x0){return db['UserProfileResource'][_0x0b0b('0x94')]({'name':_0x17c4f7[_0x0b0b('0x32')],'resourceId':_0x17c4f7['id'],'type':_0x1b7f74[_0x0b0b('0x32')],'sectionId':_0x1b7f74['id']},{})['then'](function(){return _0x5381a5;});}else{return _0x5381a5;}})['catch'](function(_0x1922db){logger[_0x0b0b('0x30')](_0x0b0b('0x95'),_0x1922db);throw _0x1922db;});}return _0x5381a5;})[_0x0b0b('0x2b')](respondWithResult(_0x2b9949,null))['catch'](handleError(_0x2b9949,null));}});}catch(_0x3a3594){_0x2b9949[_0x0b0b('0x20')](0x1f4)[_0x0b0b('0x33')](_0x3a3594);}};function removeReferences(_0x3d2b6a,_0x1fc6aa){try{if(_0x3d2b6a){fs[_0x0b0b('0x65')](_0x3d2b6a);logger['info'](_0x0b0b('0x96'));}if(_0x1fc6aa){rimraf(_0x1fc6aa,function(){});logger['info'](_0x0b0b('0x97'));}}catch(_0x53753b){logger[_0x0b0b('0x30')](_0x53753b);}}exports[_0x0b0b('0x2a')]=function(_0x4549a2,_0x168f26,_0x5cbf8c){return db['Plugin'][_0x0b0b('0x50')]({'where':{'id':_0x4549a2[_0x0b0b('0x4b')]['id']}})[_0x0b0b('0x2b')](handleEntityNotFound(_0x168f26,null))[_0x0b0b('0x2b')](saveUpdates(_0x4549a2[_0x0b0b('0x8e')],null))[_0x0b0b('0x2b')](respondWithResult(_0x168f26,null))[_0x0b0b('0x4a')](handleError(_0x168f26,null));};exports[_0x0b0b('0x98')]=function(_0xc8bbd3,_0x165ac0,_0x3d47ea){return db[_0x0b0b('0x36')][_0x0b0b('0x50')]({'where':{'id':_0xc8bbd3['params']['id']}})[_0x0b0b('0x2b')](function(_0x6e00d7){if(_0x6e00d7){return _0x6e00d7[_0x0b0b('0x2c')]();}})['then'](function(_0x220dac){rimraf(path[_0x0b0b('0x51')](config['root'],'server/files/plugins',path[_0x0b0b('0x5d')](_0x220dac[_0x0b0b('0x7')])),function(){});return _0x220dac;})[_0x0b0b('0x2b')](handleEntityNotFound(_0x165ac0,null))[_0x0b0b('0x2b')](respondWithStatusCode(_0x165ac0,null))[_0x0b0b('0x4a')](handleError(_0x165ac0,null));};exports[_0x0b0b('0x99')]=function(_0x15fcdf,_0x40c06c,_0x348700){return BPromise[_0x0b0b('0x9a')]()[_0x0b0b('0x2b')](function(){if(!_0x15fcdf['query'][_0x0b0b('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x15fcdf[_0x0b0b('0x3b')][_0x0b0b('0x9b')]){throw new Error(_0x0b0b('0x9c'));}var _0x5a5293=_0x15fcdf[_0x0b0b('0x3b')][_0x0b0b('0x9d')]?_0x15fcdf[_0x0b0b('0x3b')][_0x0b0b('0x9d')]+':'+_0x15fcdf[_0x0b0b('0x3b')][_0x0b0b('0x9b')]:_0x0b0b('0x9e')+_0x15fcdf[_0x0b0b('0x3b')][_0x0b0b('0x9b')];var _0x265dd9=_0x15fcdf[_0x0b0b('0x3b')]['json']?_0x15fcdf[_0x0b0b('0x3b')][_0x0b0b('0x26')]:!![];var _0x5f435c=_0x15fcdf[_0x0b0b('0x3b')][_0x0b0b('0x9f')]?_0x15fcdf[_0x0b0b('0x3b')]['encoding']:null;var _0x3c12c9={'method':_0x15fcdf[_0x0b0b('0xa0')],'uri':util[_0x0b0b('0x53')]('%s%s',_0x5a5293,_0x15fcdf[_0x0b0b('0x3b')]['path']),'json':_0x265dd9,'resolveWithFullResponse':!![],'encoding':_0x5f435c,'qs':_0x15fcdf[_0x0b0b('0x3b')]};if(_0x15fcdf['headers']){_0x3c12c9[_0x0b0b('0xa1')]=_0x15fcdf[_0x0b0b('0xa1')];if(_0x3c12c9[_0x0b0b('0xa1')]['content-length']){delete _0x3c12c9[_0x0b0b('0xa1')][_0x0b0b('0xa2')];}}if(_0x3c12c9['headers']['content-type']){delete _0x3c12c9['headers'][_0x0b0b('0xa3')];}return rp(_0x3c12c9);})[_0x0b0b('0x2b')](function(_0xbd00d8){if(_0xbd00d8){_0x40c06c[_0x0b0b('0xa4')](_0xbd00d8[_0x0b0b('0xa1')]);logger[_0x0b0b('0x67')](_0xbd00d8[_0x0b0b('0x8e')]);if(_['endsWith'](_0x15fcdf[_0x0b0b('0x3b')][_0x0b0b('0x7')],_0x0b0b('0x63'))&&_0xbd00d8['statusCode']==0x1f4){return _0x40c06c[_0x0b0b('0x1f')](_0xbd00d8['statusCode']);}else{return _0x40c06c['status'](_0xbd00d8[_0x0b0b('0xa5')])[_0x0b0b('0x33')](_0xbd00d8[_0x0b0b('0x8e')]);}}else{return _0x40c06c[_0x0b0b('0x1f')](0xc8);}})[_0x0b0b('0x4a')](handleError(_0x40c06c,null));};exports[_0x0b0b('0xa6')]=function(_0x57ae49,_0x6c7c54,_0x258b8c){return BPromise[_0x0b0b('0x9a')]()['then'](function(){if(!_0x57ae49[_0x0b0b('0x3b')][_0x0b0b('0x7')]){throw new Error(_0x0b0b('0xa7'));}if(!_0x57ae49[_0x0b0b('0x3b')][_0x0b0b('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x29d5b2=_0x57ae49['query'][_0x0b0b('0x9d')]?_0x57ae49[_0x0b0b('0x3b')]['hostname']+':'+_0x57ae49[_0x0b0b('0x3b')]['port']:_0x0b0b('0x9e')+_0x57ae49[_0x0b0b('0x3b')][_0x0b0b('0x9b')];var _0x21c274=_0x57ae49[_0x0b0b('0x3b')][_0x0b0b('0x26')]?_0x57ae49[_0x0b0b('0x3b')][_0x0b0b('0x26')]:!![];var _0x3bb5e5=_0x57ae49[_0x0b0b('0x3b')][_0x0b0b('0x9f')]?_0x57ae49[_0x0b0b('0x3b')][_0x0b0b('0x9f')]:null;var _0x11510e={'method':_0x57ae49[_0x0b0b('0xa0')],'uri':util[_0x0b0b('0x53')](_0x0b0b('0xa8'),_0x29d5b2,_0x57ae49['query']['path']),'json':_0x21c274,'resolveWithFullResponse':!![],'encoding':_0x3bb5e5,'body':_0x57ae49[_0x0b0b('0x8e')]};if(_0x57ae49['headers']){_0x11510e[_0x0b0b('0xa1')]=_0x57ae49[_0x0b0b('0xa1')];if(_0x11510e[_0x0b0b('0xa1')][_0x0b0b('0xa2')]){delete _0x11510e[_0x0b0b('0xa1')][_0x0b0b('0xa2')];}}if(_0x11510e[_0x0b0b('0xa1')]['content-type']){delete _0x11510e[_0x0b0b('0xa1')][_0x0b0b('0xa3')];}return rp(_0x11510e);})['then'](function(_0x357c55){if(_0x357c55){_0x6c7c54[_0x0b0b('0xa4')](_0x357c55['headers']);logger[_0x0b0b('0x67')](_0x357c55[_0x0b0b('0x8e')]);return _0x6c7c54[_0x0b0b('0x20')](_0x357c55[_0x0b0b('0xa5')])[_0x0b0b('0x33')](_0x357c55[_0x0b0b('0x8e')]);}else{return _0x6c7c54[_0x0b0b('0x1f')](0xc8);}})[_0x0b0b('0x4a')](handleError(_0x6c7c54,null));}; \ No newline at end of file +var _0x86b6=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','limit','count','reject','update','Plugins','UserProfileResource','destroy','then','error','name','index','map','Plugin','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','sidebar','icon','icon-apps','test','plugins','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','create','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','headers','content-length','content-type','set','endsWith','statusCode','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','http://localhost:','%s%s','eml-format','zip-dir','request-promise','moment','mustache','path','to-csv','fs-extra','crypto','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x86b6,0x1d3));var _0x686b=function(_0x57ec65,_0x3154f3){_0x57ec65=_0x57ec65-0x0;var _0x518085=_0x86b6[_0x57ec65];return _0x518085;};'use strict';var emlformat=require(_0x686b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x686b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x686b('0x2'));var moment=require(_0x686b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x686b('0x4'));var util=require('util');var path=require(_0x686b('0x5'));var sox=require('sox');var csv=require(_0x686b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x686b('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x686b('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x686b('0x9'));var toCsv=require(_0x686b('0x6'));var querystring=require('querystring');var Papa=require(_0x686b('0xa'));var extract=require(_0x686b('0xb'));var rimraf=require('rimraf');var archiver=require(_0x686b('0xc'));var Redis=require(_0x686b('0xd'));var authService=require(_0x686b('0xe'));var qs=require(_0x686b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x686b('0x10'));var logger=require(_0x686b('0x11'))(_0x686b('0x12'));var utils=require(_0x686b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x686b('0x14'));var db=require(_0x686b('0x15'))['db'];config[_0x686b('0x16')]=_[_0x686b('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x686b('0x18'))(new Redis(config[_0x686b('0x16')]));require(_0x686b('0x19'))[_0x686b('0x1a')](socket);function respondWithStatusCode(_0x2a935f,_0x246175){_0x246175=_0x246175||0xcc;return function(_0x4cb117){if(_0x4cb117){return _0x2a935f[_0x686b('0x1b')](_0x246175);}return _0x2a935f[_0x686b('0x1c')](_0x246175)['end']();};}function respondWithResult(_0xc3b884,_0x36be76){_0x36be76=_0x36be76||0xc8;return function(_0x42c9b5){if(_0x42c9b5){return _0xc3b884[_0x686b('0x1c')](_0x36be76)[_0x686b('0x1d')](_0x42c9b5);}};}function respondWithFilteredResult(_0x10e9c3,_0x2177fe){return function(_0x305c82){if(_0x305c82){var _0x47ca1e=typeof _0x2177fe[_0x686b('0x1e')]==='undefined'&&typeof _0x2177fe[_0x686b('0x1f')]==='undefined';var _0x14b657=_0x305c82[_0x686b('0x20')];var _0x2e46a1=_0x47ca1e?0x0:_0x2177fe['offset'];var _0x5a8137=_0x47ca1e?_0x305c82[_0x686b('0x20')]:_0x2177fe[_0x686b('0x1e')]+_0x2177fe[_0x686b('0x1f')];var _0x4b4da1;if(_0x5a8137>=_0x14b657){_0x5a8137=_0x14b657;_0x4b4da1=0xc8;}else{_0x4b4da1=0xce;}_0x10e9c3[_0x686b('0x1c')](_0x4b4da1);return _0x10e9c3['set']('Content-Range',_0x2e46a1+'-'+_0x5a8137+'/'+_0x14b657)['json'](_0x305c82);}return null;};}function patchUpdates(_0x1b58cc){return function(_0xa55db4){try{jsonpatch['apply'](_0xa55db4,_0x1b58cc,!![]);}catch(_0x2927c1){return BPromise[_0x686b('0x21')](_0x2927c1);}return _0xa55db4['save']();};}function saveUpdates(_0x1f3e06,_0x3b615a){return function(_0x91ce89){if(_0x91ce89){return _0x91ce89[_0x686b('0x22')](_0x1f3e06)['then'](function(_0x1e5c77){return _0x1e5c77;});}return null;};}function removeEntity(_0x1397c0,_0x2b9d49){return function(_0x4c79cf){if(_0x4c79cf){return _0x4c79cf['destroy']()['then'](function(){var _0xbb5b01=_0x4c79cf['get']({'plain':!![]});var _0x3b2b97=_0x686b('0x23');return db[_0x686b('0x24')][_0x686b('0x25')]({'where':{'type':_0x3b2b97,'resourceId':_0xbb5b01['id']}})[_0x686b('0x26')](function(){return _0x4c79cf;});})[_0x686b('0x26')](function(){_0x1397c0[_0x686b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11660d,_0x5066ec){return function(_0x378119){if(!_0x378119){_0x11660d['sendStatus'](0x194);}return _0x378119;};}function handleError(_0x3db317,_0x14cfa8){_0x14cfa8=_0x14cfa8||0x1f4;return function(_0xd5dd9){logger[_0x686b('0x27')](_0xd5dd9['stack']);if(_0xd5dd9[_0x686b('0x28')]){delete _0xd5dd9[_0x686b('0x28')];}_0x3db317[_0x686b('0x1c')](_0x14cfa8)['send'](_0xd5dd9);};}exports[_0x686b('0x29')]=function(_0x452f74,_0x14a75f){var _0x18325e={},_0x1680c3={},_0x17adc1={'count':0x0,'rows':[]};var _0x2ce95f=_[_0x686b('0x2a')](db[_0x686b('0x2b')][_0x686b('0x2c')],function(_0x4fc40a){return{'name':_0x4fc40a[_0x686b('0x2d')],'type':_0x4fc40a[_0x686b('0x2e')][_0x686b('0x2f')]};});_0x1680c3['model']=_['map'](_0x2ce95f,_0x686b('0x28'));_0x1680c3['query']=_[_0x686b('0x30')](_0x452f74[_0x686b('0x31')]);_0x1680c3['filters']=_[_0x686b('0x32')](_0x1680c3[_0x686b('0x33')],_0x1680c3[_0x686b('0x31')]);_0x18325e[_0x686b('0x34')]=_[_0x686b('0x32')](_0x1680c3[_0x686b('0x33')],qs[_0x686b('0x35')](_0x452f74[_0x686b('0x31')][_0x686b('0x35')]));_0x18325e[_0x686b('0x34')]=_0x18325e[_0x686b('0x34')][_0x686b('0x36')]?_0x18325e[_0x686b('0x34')]:_0x1680c3[_0x686b('0x33')];if(!_0x452f74['query'][_0x686b('0x37')](_0x686b('0x38'))){_0x18325e[_0x686b('0x1f')]=qs[_0x686b('0x1f')](_0x452f74['query']['limit']);_0x18325e[_0x686b('0x1e')]=qs[_0x686b('0x1e')](_0x452f74[_0x686b('0x31')][_0x686b('0x1e')]);}_0x18325e[_0x686b('0x39')]=qs[_0x686b('0x3a')](_0x452f74['query'][_0x686b('0x3a')]);_0x18325e[_0x686b('0x3b')]=qs[_0x686b('0x3c')](_[_0x686b('0x3d')](_0x452f74[_0x686b('0x31')],_0x1680c3[_0x686b('0x3c')]),_0x2ce95f);if(_0x452f74[_0x686b('0x31')][_0x686b('0x3e')]){_0x18325e[_0x686b('0x3b')]=_['merge'](_0x18325e[_0x686b('0x3b')],{'$or':_[_0x686b('0x2a')](_0x2ce95f,function(_0x3b2fb0){if(_0x3b2fb0[_0x686b('0x2e')]!==_0x686b('0x3f')){var _0xb87899={};_0xb87899[_0x3b2fb0['name']]={'$like':'%'+_0x452f74['query'][_0x686b('0x3e')]+'%'};return _0xb87899;}})});}_0x18325e=_[_0x686b('0x40')]({},_0x18325e,_0x452f74[_0x686b('0x41')]);var _0xccedbc={'where':_0x18325e[_0x686b('0x3b')]};return db[_0x686b('0x2b')][_0x686b('0x20')](_0xccedbc)[_0x686b('0x26')](function(_0x3a9b68){_0x17adc1[_0x686b('0x20')]=_0x3a9b68;if(_0x452f74[_0x686b('0x31')][_0x686b('0x42')]){_0x18325e[_0x686b('0x43')]=[{'all':!![]}];}return db[_0x686b('0x2b')][_0x686b('0x44')](_0x18325e);})['then'](function(_0x2d4477){_0x17adc1[_0x686b('0x45')]=_0x2d4477;return _0x17adc1;})[_0x686b('0x26')](respondWithFilteredResult(_0x14a75f,_0x18325e))['catch'](handleError(_0x14a75f,null));};exports[_0x686b('0x46')]=function(_0x1e9e9e,_0xc60215){var _0x52d1ee={'raw':!![],'where':{'id':_0x1e9e9e[_0x686b('0x47')]['id']}},_0x4ec732={};_0x4ec732[_0x686b('0x33')]=_[_0x686b('0x30')](db[_0x686b('0x2b')][_0x686b('0x2c')]);_0x4ec732[_0x686b('0x31')]=_['keys'](_0x1e9e9e[_0x686b('0x31')]);_0x4ec732['filters']=_['intersection'](_0x4ec732[_0x686b('0x33')],_0x4ec732['query']);_0x52d1ee[_0x686b('0x34')]=_['intersection'](_0x4ec732[_0x686b('0x33')],qs[_0x686b('0x35')](_0x1e9e9e[_0x686b('0x31')][_0x686b('0x35')]));_0x52d1ee['attributes']=_0x52d1ee['attributes'][_0x686b('0x36')]?_0x52d1ee[_0x686b('0x34')]:_0x4ec732['model'];if(_0x1e9e9e['query'][_0x686b('0x42')]){_0x52d1ee[_0x686b('0x43')]=[{'all':!![]}];}_0x52d1ee=_['merge']({},_0x52d1ee,_0x1e9e9e[_0x686b('0x41')]);return db['Plugin'][_0x686b('0x48')](_0x52d1ee)[_0x686b('0x26')](handleEntityNotFound(_0xc60215,null))[_0x686b('0x26')](respondWithResult(_0xc60215,null))[_0x686b('0x49')](handleError(_0xc60215,null));};exports[_0x686b('0x4a')]=function(_0x562f0e,_0x18f665,_0x5ebea6){return db[_0x686b('0x2b')]['find']({'where':{'id':_0x562f0e[_0x686b('0x47')]['id']},'attributes':[_0x686b('0x28'),_0x686b('0x5')],'raw':!![]})[_0x686b('0x26')](handleEntityNotFound(_0x18f665,null))[_0x686b('0x26')](function(_0x3cc86a){if(_0x3cc86a){var _0x1cfd58=path[_0x686b('0x4b')](config[_0x686b('0x4c')],_0x686b('0x4d'),util[_0x686b('0x4e')](_0x686b('0x4f'),path[_0x686b('0x50')](_0x3cc86a[_0x686b('0x5')])));var _0xa98039=fs[_0x686b('0x51')](_0x1cfd58);var _0xaeb52b=archiver('zip',{'zlib':{'level':0x9}});_0xaeb52b['on'](_0x686b('0x52'),function(_0x1bf0be){if(_0x1bf0be[_0x686b('0x53')]===_0x686b('0x54')){logger[_0x686b('0x27')](_0x1bf0be);}else{throw new db[(_0x686b('0x55'))][(_0x686b('0x56'))](_0x686b('0x57'));}});_0xaeb52b['on']('error',function(_0x4ecdeb){throw new db[(_0x686b('0x55'))]['Error'](_0x686b('0x57'));});_0xaeb52b['pipe'](_0xa98039);_0xaeb52b[_0x686b('0x58')]('**/*',{'cwd':path[_0x686b('0x4b')](config['root'],_0x686b('0x4d'),path[_0x686b('0x59')](_0x3cc86a['path'])),'ignore':[path[_0x686b('0x4b')](path[_0x686b('0x50')](_0x3cc86a['path']),_0x686b('0x5a')),path[_0x686b('0x4b')](path['basename'](_0x3cc86a[_0x686b('0x5')]),_0x686b('0x5b'))],'nodir':!![]})[_0x686b('0x5c')]();_0xa98039['on'](_0x686b('0x5d'),function(){if(!fs[_0x686b('0x5e')](_0x1cfd58)){throw new db[(_0x686b('0x55'))][(_0x686b('0x56'))]('Plugin\x20not\x20found');}return _0x18f665['download'](_0x1cfd58,util[_0x686b('0x4e')](_0x686b('0x4f'),path[_0x686b('0x50')](_0x3cc86a['path'])),function(_0x59283d){if(_0x59283d){throw new db[(_0x686b('0x55'))][(_0x686b('0x56'))](_0x686b('0x5f'));}fs['unlinkSync'](_0x1cfd58);logger[_0x686b('0x60')](_0x686b('0x61'));logger[_0x686b('0x60')](_0x686b('0x62'));});});}return null;})[_0x686b('0x49')](handleError(_0x18f665,null));};exports['upload']=function(_0x4f0081,_0x4cd4c0,_0x4e36e8){var _0x490778=path[_0x686b('0x50')](_0x4f0081[_0x686b('0x63')]['filename'],path[_0x686b('0x64')](_0x4f0081[_0x686b('0x63')][_0x686b('0x65')]));var _0x94d3db=path[_0x686b('0x4b')](config[_0x686b('0x4c')],_0x686b('0x4d'),_0x4f0081[_0x686b('0x63')][_0x686b('0x65')]);var _0xe26bbb=path['join'](config[_0x686b('0x4c')],_0x686b('0x4d'),_0x490778);logger[_0x686b('0x60')](_0x686b('0x66'),_0x94d3db);logger[_0x686b('0x60')](_0x686b('0x67'),_0xe26bbb);try{fs['chmodSync'](_0x94d3db,parseInt(_0x686b('0x68'),0x8));extract(_0x94d3db,{'dir':_0xe26bbb},function(_0x4d13ef){if(_0x4d13ef){logger[_0x686b('0x27')](_0x4d13ef);handleError(_0x4d13ef,!![]);};var _0x35b9a3=fs[_0x686b('0x69')](_0xe26bbb);if(_0x35b9a3[_0x686b('0x36')]>0x1){removeReferences(_0x94d3db,_0xe26bbb);logger[_0x686b('0x27')]('Invalid\x20plugin\x20structure');return _0x4e36e8(new Error(_0x686b('0x6a')));}var _0x48254e=fs['lstatSync'](path[_0x686b('0x4b')](_0xe26bbb,_0x35b9a3[0x0]));if(_0x48254e['isFile']()){removeReferences(_0x94d3db,_0xe26bbb);logger['error'](_0x686b('0x6a'));return _0x4e36e8(new Error(_0x686b('0x6a')));}if(_0x48254e['isDirectory']()){var _0x3cd8ff=fs[_0x686b('0x69')](path[_0x686b('0x4b')](_0xe26bbb,_0x35b9a3[0x0]));if(_0x3cd8ff[_0x686b('0x36')]===0x0){removeReferences(_0x94d3db,_0xe26bbb);logger[_0x686b('0x27')]('Invalid\x20plugin\x20structure');return _0x4e36e8(new Error(_0x686b('0x6a')));}var _0x3b6958=_0x3cd8ff[_0x686b('0x6b')](function(_0xb98b8c){return _0xb98b8c===_0x686b('0x6c');});if(!_0x3b6958){return _0x4e36e8(new Error('Plugin\x20manifest\x20missing'));}var _0x2772f5=fs[_0x686b('0x6d')](path[_0x686b('0x4b')](_0xe26bbb,_0x35b9a3[0x0],'manifest.json'));var _0x5343f3=JSON[_0x686b('0x6e')](_0x2772f5);if('undefined'==typeof _0x5343f3[_0x686b('0x28')]){return _0x4e36e8(new Error(_0x686b('0x6f')));}if(_0x686b('0x70')==typeof _0x5343f3[_0x686b('0x2e')]){return _0x4e36e8(new Error(_0x686b('0x71')));}if(_0x686b('0x70')==typeof _0x5343f3[_0x686b('0x72')]){return _0x4e36e8(new Error(_0x686b('0x73')));}if('undefined'==typeof _0x5343f3['parameters']){return _0x4e36e8(new Error(_0x686b('0x74')));}if(_0x5343f3[_0x686b('0x2e')]===_0x686b('0x75')){if(_0x686b('0x70')==typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')]){return _0x4e36e8(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')][_0x686b('0x78')]&&_0x686b('0x70')==typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')][_0x686b('0x79')]){return _0x4e36e8(new Error(_0x686b('0x7a')));}}else if(_0x5343f3[_0x686b('0x2e')]===_0x686b('0x7b')){if(_0x686b('0x70')==typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x7c')]){return _0x4e36e8(new Error(_0x686b('0x7d')));}if('undefined'==typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x7e')]){return _0x4e36e8(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x4e36e8(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x50acda=_0x5343f3[_0x686b('0x28')];var _0x5f5724=_0x5343f3['description'];var _0x41d426=_0x5343f3[_0x686b('0x2e')];var _0xa6f6f5=_0x5343f3['sidebar']?_0x5343f3[_0x686b('0x7f')]:'always';var _0x546c6b=_0x5343f3[_0x686b('0x80')]?_0x5343f3['icon']:_0x686b('0x81');var _0x480cbe='';var _0x421fcc='';var _0x22bf97='';var _0x345682='';var _0x3ca44a=_0x5343f3[_0x686b('0x72')];if(_0x41d426===_0x686b('0x75')){if(_0x686b('0x70')!=typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')][_0x686b('0x78')]){var _0x347a2c=_0x5343f3[_0x686b('0x76')][_0x686b('0x77')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x686b('0x82')](_0x347a2c)){_0x480cbe=path[_0x686b('0x4b')](_0x686b('0x83'),_0x490778,_0x35b9a3[0x0],_0x347a2c);}else{_0x480cbe=_0x347a2c;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x686b('0x70')!=typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')]['agent']){var _0x4f7cb7=_0x5343f3['parameters'][_0x686b('0x77')][_0x686b('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x686b('0x82')](_0x4f7cb7)){_0x421fcc=path[_0x686b('0x4b')](_0x686b('0x83'),_0x490778,_0x35b9a3[0x0],_0x4f7cb7);}else{_0x421fcc=_0x4f7cb7;}}else{logger[_0x686b('0x60')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x41d426===_0x686b('0x7b')){_0x22bf97=_0x5343f3[_0x686b('0x76')]['scriptName'];_0x345682=_0x5343f3[_0x686b('0x76')][_0x686b('0x7e')];if('undefined'!=typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')]){if(_0x686b('0x70')!=typeof _0x5343f3['parameters']['views'][_0x686b('0x78')]){var _0x347a2c=_0x5343f3['parameters'][_0x686b('0x77')][_0x686b('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x686b('0x82')](_0x347a2c)){_0x480cbe=path[_0x686b('0x4b')](_0x686b('0x83'),_0x490778,_0x35b9a3[0x0],_0x347a2c);}else{_0x480cbe=_0x347a2c;}}if(_0x686b('0x70')!=typeof _0x5343f3[_0x686b('0x76')]['views'][_0x686b('0x79')]){var _0x4f7cb7=_0x5343f3[_0x686b('0x76')][_0x686b('0x77')][_0x686b('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x686b('0x82')](_0x4f7cb7)){_0x421fcc=path[_0x686b('0x4b')]('plugins',_0x490778,_0x35b9a3[0x0],_0x4f7cb7);}else{_0x421fcc=_0x4f7cb7;}}}}var _0x518f90={'name':_0x50acda,'description':_0x5f5724,'path':path[_0x686b('0x4b')](_0x490778,_0x35b9a3[0x0]),'type':_0x41d426,'sidebar':_0xa6f6f5,'icon':_0x546c6b,'adminUrl':_0x480cbe,'agentUrl':_0x421fcc,'scriptName':_0x22bf97,'scriptPath':_0x345682,'version':_0x3ca44a};removeReferences(_0x94d3db,null);return db['Plugin']['create'](_0x518f90)[_0x686b('0x26')](function(_0x5bec68){var _0x5d643={'role':_0x4f0081[_0x686b('0x84')][_0x686b('0x85')],'userProfileId':_0x4f0081['body'][_0x686b('0x86')]};if(!_0x5d643)throw new Error(_0x686b('0x87'));if(_0x5d643['role']===_0x686b('0x88')){var _0x204871=_0x5bec68[_0x686b('0x89')]({'plain':!![]});return db[_0x686b('0x8a')][_0x686b('0x48')]({'where':{'name':'Plugins','userProfileId':_0x5d643[_0x686b('0x86')]},'raw':!![]})[_0x686b('0x26')](function(_0x33caf8){if(_0x33caf8&&_0x33caf8[_0x686b('0x8b')]===0x0){return db['UserProfileResource'][_0x686b('0x8c')]({'name':_0x204871[_0x686b('0x28')],'resourceId':_0x204871['id'],'type':_0x33caf8[_0x686b('0x28')],'sectionId':_0x33caf8['id']},{})['then'](function(){return _0x5bec68;});}else{return _0x5bec68;}})['catch'](function(_0x32219d){logger[_0x686b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32219d);throw _0x32219d;});}return _0x5bec68;})[_0x686b('0x26')](respondWithResult(_0x4cd4c0,null))[_0x686b('0x49')](handleError(_0x4cd4c0,null));}});}catch(_0x5cc8fd){_0x4cd4c0[_0x686b('0x1c')](0x1f4)[_0x686b('0x8d')](_0x5cc8fd);}};function removeReferences(_0x55287a,_0x9c9f43){try{if(_0x55287a){fs[_0x686b('0x8e')](_0x55287a);logger[_0x686b('0x60')](_0x686b('0x8f'));}if(_0x9c9f43){rimraf(_0x9c9f43,function(){});logger[_0x686b('0x60')](_0x686b('0x90'));}}catch(_0x361fb0){logger[_0x686b('0x27')](_0x361fb0);}}exports[_0x686b('0x22')]=function(_0x353ec1,_0x54b3cf,_0xe00486){return db[_0x686b('0x2b')][_0x686b('0x48')]({'where':{'id':_0x353ec1[_0x686b('0x47')]['id']}})['then'](handleEntityNotFound(_0x54b3cf,null))[_0x686b('0x26')](saveUpdates(_0x353ec1[_0x686b('0x84')],null))['then'](respondWithResult(_0x54b3cf,null))[_0x686b('0x49')](handleError(_0x54b3cf,null));};exports['delete']=function(_0x4e6ca4,_0x3e4d93,_0x368454){return db[_0x686b('0x2b')]['find']({'where':{'id':_0x4e6ca4['params']['id']}})[_0x686b('0x26')](function(_0x25e56d){if(_0x25e56d){return _0x25e56d[_0x686b('0x25')]();}})['then'](function(_0x1a9c2b){rimraf(path[_0x686b('0x4b')](config[_0x686b('0x4c')],'server/files/plugins',path[_0x686b('0x59')](_0x1a9c2b[_0x686b('0x5')])),function(){});return _0x1a9c2b;})[_0x686b('0x26')](handleEntityNotFound(_0x3e4d93,null))['then'](respondWithStatusCode(_0x3e4d93,null))[_0x686b('0x49')](handleError(_0x3e4d93,null));};exports[_0x686b('0x91')]=function(_0x1c4d4c,_0x4154a7,_0x3c0c98){return BPromise['resolve']()[_0x686b('0x26')](function(){if(!_0x1c4d4c[_0x686b('0x31')][_0x686b('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1c4d4c['query']['port']){throw new Error(_0x686b('0x92'));}var _0x13a26f=_0x1c4d4c[_0x686b('0x31')][_0x686b('0x93')]?_0x1c4d4c['query']['hostname']+':'+_0x1c4d4c[_0x686b('0x31')][_0x686b('0x94')]:'http://localhost:'+_0x1c4d4c[_0x686b('0x31')][_0x686b('0x94')];var _0x58bd6e=_0x1c4d4c[_0x686b('0x31')]['json']?_0x1c4d4c[_0x686b('0x31')]['json']:!![];var _0x1f9433=_0x1c4d4c[_0x686b('0x31')][_0x686b('0x95')]?_0x1c4d4c[_0x686b('0x31')][_0x686b('0x95')]:null;var _0x2ff9f0={'method':_0x1c4d4c[_0x686b('0x96')],'uri':util[_0x686b('0x4e')]('%s%s',_0x13a26f,_0x1c4d4c[_0x686b('0x31')][_0x686b('0x5')]),'json':_0x58bd6e,'resolveWithFullResponse':!![],'encoding':_0x1f9433,'qs':_0x1c4d4c[_0x686b('0x31')]};if(_0x1c4d4c['headers']){_0x2ff9f0[_0x686b('0x97')]=_0x1c4d4c[_0x686b('0x97')];if(_0x2ff9f0[_0x686b('0x97')][_0x686b('0x98')]){delete _0x2ff9f0['headers']['content-length'];}}if(_0x2ff9f0[_0x686b('0x97')][_0x686b('0x99')]){delete _0x2ff9f0['headers']['content-type'];}return rp(_0x2ff9f0);})['then'](function(_0x5018b5){if(_0x5018b5){_0x4154a7[_0x686b('0x9a')](_0x5018b5[_0x686b('0x97')]);logger['info'](_0x5018b5[_0x686b('0x84')]);if(_[_0x686b('0x9b')](_0x1c4d4c['query'][_0x686b('0x5')],'download')&&_0x5018b5[_0x686b('0x9c')]==0x1f4){return _0x4154a7['sendStatus'](_0x5018b5[_0x686b('0x9c')]);}else{return _0x4154a7[_0x686b('0x1c')](_0x5018b5[_0x686b('0x9c')])[_0x686b('0x8d')](_0x5018b5['body']);}}else{return _0x4154a7[_0x686b('0x1b')](0xc8);}})[_0x686b('0x49')](handleError(_0x4154a7,null));};exports['webhookPost']=function(_0x1772f9,_0x561b86,_0x502054){return BPromise[_0x686b('0x9d')]()['then'](function(){if(!_0x1772f9[_0x686b('0x31')][_0x686b('0x5')]){throw new Error(_0x686b('0x9e'));}if(!_0x1772f9[_0x686b('0x31')][_0x686b('0x94')]){throw new Error(_0x686b('0x92'));}var _0x11a44c=_0x1772f9[_0x686b('0x31')]['hostname']?_0x1772f9[_0x686b('0x31')][_0x686b('0x93')]+':'+_0x1772f9[_0x686b('0x31')][_0x686b('0x94')]:_0x686b('0x9f')+_0x1772f9[_0x686b('0x31')][_0x686b('0x94')];var _0x189da7=_0x1772f9[_0x686b('0x31')]['json']?_0x1772f9[_0x686b('0x31')][_0x686b('0x1d')]:!![];var _0x25e62a=_0x1772f9[_0x686b('0x31')][_0x686b('0x95')]?_0x1772f9['query'][_0x686b('0x95')]:null;var _0x34700f={'method':_0x1772f9['method'],'uri':util[_0x686b('0x4e')](_0x686b('0xa0'),_0x11a44c,_0x1772f9[_0x686b('0x31')]['path']),'json':_0x189da7,'resolveWithFullResponse':!![],'encoding':_0x25e62a,'body':_0x1772f9[_0x686b('0x84')]};if(_0x1772f9[_0x686b('0x97')]){_0x34700f[_0x686b('0x97')]=_0x1772f9[_0x686b('0x97')];if(_0x34700f['headers'][_0x686b('0x98')]){delete _0x34700f['headers'][_0x686b('0x98')];}}if(_0x34700f[_0x686b('0x97')][_0x686b('0x99')]){delete _0x34700f[_0x686b('0x97')][_0x686b('0x99')];}return rp(_0x34700f);})[_0x686b('0x26')](function(_0x58d193){if(_0x58d193){_0x561b86['set'](_0x58d193[_0x686b('0x97')]);logger[_0x686b('0x60')](_0x58d193['body']);return _0x561b86[_0x686b('0x1c')](_0x58d193[_0x686b('0x9c')])[_0x686b('0x8d')](_0x58d193[_0x686b('0x84')]);}else{return _0x561b86[_0x686b('0x1b')](0xc8);}})[_0x686b('0x49')](handleError(_0x561b86,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ed484b6..c47dd3d 100644 --- a/server/api/plugin/plugin.events.js +++ b/server/api/plugin/plugin.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf5a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','Plugin'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0xaf5a,0x116));var _0xaaf5=function(_0x5b406e,_0xcd06bc){_0x5b406e=_0x5b406e-0x0;var _0xe7d242=_0xaf5a[_0x5b406e];return _0xe7d242;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xaaf5('0x0'))['db'][_0xaaf5('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xaaf5('0x2')](0x0);var events={'afterCreate':_0xaaf5('0x3'),'afterUpdate':_0xaaf5('0x4'),'afterDestroy':_0xaaf5('0x5')};function emitEvent(_0x5c55af){return function(_0x1bdf16,_0x4ae9ed,_0x23fbd9){PluginEvents[_0xaaf5('0x6')](_0x5c55af+':'+_0x1bdf16['id'],_0x1bdf16);PluginEvents[_0xaaf5('0x6')](_0x5c55af,_0x1bdf16);_0x23fbd9(null);};}for(var e in events){if(events[_0xaaf5('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x00b3=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x00b3,0x157));var _0x300b=function(_0xea7fdb,_0x583e65){_0xea7fdb=_0xea7fdb-0x0;var _0x5ba5f2=_0x00b3[_0xea7fdb];return _0x5ba5f2;};'use strict';var EventEmitter=require(_0x300b('0x0'));var Plugin=require(_0x300b('0x1'))['db'][_0x300b('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x300b('0x3')](0x0);var events={'afterCreate':_0x300b('0x4'),'afterUpdate':_0x300b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x968375){return function(_0x204f71,_0x494436,_0x2f3a41){PluginEvents['emit'](_0x968375+':'+_0x204f71['id'],_0x204f71);PluginEvents[_0x300b('0x6')](_0x968375,_0x204f71);_0x2f3a41(null);};}for(var e in events){if(events[_0x300b('0x7')](e)){var event=events[e];Plugin[_0x300b('0x8')](e,emitEvent(event));}}module[_0x300b('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 751d88b..abc7af1 100644 --- a/server/api/plugin/plugin.model.js +++ b/server/api/plugin/plugin.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b16=['util','../../config/logger','api','moment','rimraf','./plugin.attributes','exports','define','Plugin','lodash'];(function(_0x509c84,_0x23ee50){var _0xc71459=function(_0x49040a){while(--_0x49040a){_0x509c84['push'](_0x509c84['shift']());}};_0xc71459(++_0x23ee50);}(_0x3b16,0x1c1));var _0x63b1=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x3b16[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x63b1('0x0'));var util=require(_0x63b1('0x1'));var logger=require(_0x63b1('0x2'))(_0x63b1('0x3'));var moment=require(_0x63b1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x63b1('0x5'));var config=require('../../config/environment');var attributes=require(_0x63b1('0x6'));module[_0x63b1('0x7')]=function(_0x4a445a,_0x2243c3){return _0x4a445a[_0x63b1('0x8')](_0x63b1('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3072=['request-promise','path','rimraf','../../config/environment','exports','util','../../config/logger','api','moment','bluebird'];(function(_0x4f1d58,_0x64dbf){var _0x12dd38=function(_0x44ada3){while(--_0x44ada3){_0x4f1d58['push'](_0x4f1d58['shift']());}};_0x12dd38(++_0x64dbf);}(_0x3072,0xe1));var _0x2307=function(_0xf9b71d,_0x2547cb){_0xf9b71d=_0xf9b71d-0x0;var _0x30de83=_0x3072[_0xf9b71d];return _0x30de83;};'use strict';var _=require('lodash');var util=require(_0x2307('0x0'));var logger=require(_0x2307('0x1'))(_0x2307('0x2'));var moment=require(_0x2307('0x3'));var BPromise=require(_0x2307('0x4'));var rp=require(_0x2307('0x5'));var fs=require('fs');var path=require(_0x2307('0x6'));var rimraf=require(_0x2307('0x7'));var config=require(_0x2307('0x8'));var attributes=require('./plugin.attributes');module[_0x2307('0x9')]=function(_0x2ab878,_0xab1bd6){return _0x2ab878['define']('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 1dd1797..ff8195c 100644 --- a/server/api/plugin/plugin.rpc.js +++ b/server/api/plugin/plugin.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d8e=['debug','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','register','request','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreatePlugin','Plugin','create','body','options','raw','then'];(function(_0x3080f9,_0xe1278e){var _0x51e5f0=function(_0x1ab1bb){while(--_0x1ab1bb){_0x3080f9['push'](_0x3080f9['shift']());}};_0x51e5f0(++_0xe1278e);}(_0x7d8e,0x79));var _0xe7d8=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0x7d8e[_0x502598];return _0xbdee21;};'use strict';var _=require('lodash');var util=require(_0xe7d8('0x0'));var moment=require('moment');var BPromise=require(_0xe7d8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7d8('0x2'));var db=require(_0xe7d8('0x3'))['db'];var utils=require(_0xe7d8('0x4'));var logger=require(_0xe7d8('0x5'))(_0xe7d8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7d8('0x7')]['http']({'port':0x232a});config[_0xe7d8('0x8')]=_[_0xe7d8('0x9')](config[_0xe7d8('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe7d8('0xa'))(new Redis(config[_0xe7d8('0x8')]));require('./plugin.socket')[_0xe7d8('0xb')](socket);function respondWithRpcPromise(_0x488239,_0x47ea70,_0x5bde5a){return new BPromise(function(_0x549eaa,_0x58f96e){return client[_0xe7d8('0xc')](_0x488239,_0x5bde5a)['then'](function(_0x1f882b){logger['info'](_0xe7d8('0xd'),_0x47ea70,_0xe7d8('0xe'));logger['debug'](_0xe7d8('0xf'),_0x47ea70,_0xe7d8('0xe'),JSON[_0xe7d8('0x10')](_0x1f882b));if(_0x1f882b[_0xe7d8('0x11')]){if(_0x1f882b[_0xe7d8('0x11')][_0xe7d8('0x12')]===0x1f4){logger[_0xe7d8('0x11')](_0xe7d8('0xd'),_0x47ea70,_0x1f882b[_0xe7d8('0x11')][_0xe7d8('0x13')]);return _0x58f96e(_0x1f882b[_0xe7d8('0x11')][_0xe7d8('0x13')]);}logger[_0xe7d8('0x11')](_0xe7d8('0xd'),_0x47ea70,_0x1f882b['error'][_0xe7d8('0x13')]);return _0x549eaa(_0x1f882b[_0xe7d8('0x11')][_0xe7d8('0x13')]);}else{logger[_0xe7d8('0x14')](_0xe7d8('0xd'),_0x47ea70,'request\x20sent');_0x549eaa(_0x1f882b['result'][_0xe7d8('0x13')]);}})[_0xe7d8('0x15')](function(_0x4bb9a1){logger['error'](_0xe7d8('0xd'),_0x47ea70,_0x4bb9a1);_0x58f96e(_0x4bb9a1);});});}exports[_0xe7d8('0x16')]=function(_0x3689f0){var _0x19775e=this;return new Promise(function(_0x4400ca,_0x5a68af){return db[_0xe7d8('0x17')][_0xe7d8('0x18')](_0x3689f0[_0xe7d8('0x19')],{'raw':_0x3689f0[_0xe7d8('0x1a')]?_0x3689f0[_0xe7d8('0x1a')][_0xe7d8('0x1b')]===undefined?!![]:![]:!![]})[_0xe7d8('0x1c')](function(_0x5ba960){logger[_0xe7d8('0x14')]('CreatePlugin',_0x3689f0);logger[_0xe7d8('0x1d')]('CreatePlugin',_0x3689f0,JSON[_0xe7d8('0x10')](_0x5ba960));_0x4400ca(_0x5ba960);})['catch'](function(_0x557494){logger[_0xe7d8('0x11')](_0xe7d8('0x16'),_0x557494[_0xe7d8('0x13')],_0x3689f0);_0x5a68af(_0x19775e[_0xe7d8('0x11')](0x1f4,_0x557494[_0xe7d8('0x13')]));});});}; \ No newline at end of file +var _0x6fd3=['options','raw','then','CreatePlugin','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch','Plugin','create','body'];(function(_0x4e7653,_0x90ae39){var _0x3ad469=function(_0x23f7a2){while(--_0x23f7a2){_0x4e7653['push'](_0x4e7653['shift']());}};_0x3ad469(++_0x90ae39);}(_0x6fd3,0x1ee));var _0x36fd=function(_0x3b5c6a,_0x4a2b8e){_0x3b5c6a=_0x3b5c6a-0x0;var _0x168f02=_0x6fd3[_0x3b5c6a];return _0x168f02;};'use strict';var _=require(_0x36fd('0x0'));var util=require(_0x36fd('0x1'));var moment=require(_0x36fd('0x2'));var BPromise=require(_0x36fd('0x3'));var rs=require(_0x36fd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36fd('0x5'))['db'];var utils=require(_0x36fd('0x6'));var logger=require('../../config/logger')(_0x36fd('0x7'));var config=require(_0x36fd('0x8'));var jayson=require(_0x36fd('0x9'));var client=jayson[_0x36fd('0xa')][_0x36fd('0xb')]({'port':0x232a});config[_0x36fd('0xc')]=_[_0x36fd('0xd')](config[_0x36fd('0xc')],{'host':_0x36fd('0xe'),'port':0x18eb});var socket=require(_0x36fd('0xf'))(new Redis(config[_0x36fd('0xc')]));require(_0x36fd('0x10'))['register'](socket);function respondWithRpcPromise(_0x29ca1a,_0x497849,_0x19ca39){return new BPromise(function(_0x58317e,_0x2f0bdd){return client[_0x36fd('0x11')](_0x29ca1a,_0x19ca39)['then'](function(_0x379c98){logger[_0x36fd('0x12')]('Plugin,\x20%s,\x20%s',_0x497849,_0x36fd('0x13'));logger[_0x36fd('0x14')](_0x36fd('0x15'),_0x497849,'request\x20sent',JSON[_0x36fd('0x16')](_0x379c98));if(_0x379c98[_0x36fd('0x17')]){if(_0x379c98[_0x36fd('0x17')][_0x36fd('0x18')]===0x1f4){logger[_0x36fd('0x17')](_0x36fd('0x19'),_0x497849,_0x379c98['error'][_0x36fd('0x1a')]);return _0x2f0bdd(_0x379c98[_0x36fd('0x17')][_0x36fd('0x1a')]);}logger[_0x36fd('0x17')]('Plugin,\x20%s,\x20%s',_0x497849,_0x379c98['error'][_0x36fd('0x1a')]);return _0x58317e(_0x379c98['error'][_0x36fd('0x1a')]);}else{logger[_0x36fd('0x12')](_0x36fd('0x19'),_0x497849,_0x36fd('0x13'));_0x58317e(_0x379c98['result'][_0x36fd('0x1a')]);}})[_0x36fd('0x1b')](function(_0x433e40){logger[_0x36fd('0x17')](_0x36fd('0x19'),_0x497849,_0x433e40);_0x2f0bdd(_0x433e40);});});}exports['CreatePlugin']=function(_0x1b6a31){var _0x332939=this;return new Promise(function(_0xb8f43d,_0x131295){return db[_0x36fd('0x1c')][_0x36fd('0x1d')](_0x1b6a31[_0x36fd('0x1e')],{'raw':_0x1b6a31['options']?_0x1b6a31[_0x36fd('0x1f')][_0x36fd('0x20')]===undefined?!![]:![]:!![]})[_0x36fd('0x21')](function(_0x31fd61){logger[_0x36fd('0x12')](_0x36fd('0x22'),_0x1b6a31);logger['debug'](_0x36fd('0x22'),_0x1b6a31,JSON[_0x36fd('0x16')](_0x31fd61));_0xb8f43d(_0x31fd61);})[_0x36fd('0x1b')](function(_0x56336e){logger[_0x36fd('0x17')](_0x36fd('0x22'),_0x56336e[_0x36fd('0x1a')],_0x1b6a31);_0x131295(_0x332939[_0x36fd('0x17')](0x1f4,_0x56336e[_0x36fd('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f0d7b46..d7cbcce 100644 --- a/server/api/plugin/plugin.socket.js +++ b/server/api/plugin/plugin.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ed0=['save','remove','update','removeListener','register','plugin:','./plugin.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ed0,0xae));var _0x03ed=function(_0x254081,_0x20731a){_0x254081=_0x254081-0x0;var _0x5d1e2a=_0x3ed0[_0x254081];return _0x5d1e2a;};'use strict';var PluginEvents=require(_0x03ed('0x0'));var events=[_0x03ed('0x1'),_0x03ed('0x2'),_0x03ed('0x3')];function createListener(_0x5c0405,_0x3caaac){return function(_0x22ecb3){_0x3caaac['emit'](_0x5c0405,_0x22ecb3);};}function removeListener(_0x300905,_0x5f2a74){return function(){PluginEvents[_0x03ed('0x4')](_0x300905,_0x5f2a74);};}exports[_0x03ed('0x5')]=function(_0x48b243){for(var _0x3d05ad=0x0,_0x3e7e7f=events['length'];_0x3d05ad<_0x3e7e7f;_0x3d05ad++){var _0x395700=events[_0x3d05ad];var _0x42edfc=createListener(_0x03ed('0x6')+_0x395700,_0x48b243);PluginEvents['on'](_0x395700,_0x42edfc);}}; \ No newline at end of file +var _0xb0cf=['register','plugin:','save','remove','update','emit'];(function(_0x898cc2,_0x346605){var _0x10ec50=function(_0x4736b3){while(--_0x4736b3){_0x898cc2['push'](_0x898cc2['shift']());}};_0x10ec50(++_0x346605);}(_0xb0cf,0xb6));var _0xfb0c=function(_0x15d618,_0x210953){_0x15d618=_0x15d618-0x0;var _0x17291c=_0xb0cf[_0x15d618];return _0x17291c;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xfb0c('0x0'),_0xfb0c('0x1'),_0xfb0c('0x2')];function createListener(_0x47d0b7,_0x23ea92){return function(_0xd9f5de){_0x23ea92[_0xfb0c('0x3')](_0x47d0b7,_0xd9f5de);};}function removeListener(_0xb234fa,_0x51ee9d){return function(){PluginEvents['removeListener'](_0xb234fa,_0x51ee9d);};}exports[_0xfb0c('0x4')]=function(_0x60ebe2){for(var _0x29b763=0x0,_0x124ded=events['length'];_0x29b763<_0x124ded;_0x29b763++){var _0x19ed84=events[_0x29b763];var _0x21eff5=createListener(_0xfb0c('0x5')+_0x19ed84,_0x60ebe2);PluginEvents['on'](_0x19ed84,_0x21eff5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f51072c..a532ade 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x52900d,_0x5350d7){var _0x5b9522=function(_0x21c0a3){while(--_0x21c0a3){_0x52900d['push'](_0x52900d['shift']());}};_0x5b9522(++_0x5350d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x502f05,_0x31b51c){var _0x228962=function(_0x3327f4){while(--_0x3327f4){_0x502f05['push'](_0x502f05['shift']());}};_0x228962(++_0x31b51c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 29de06f..f0ba645 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb903=['../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','json','info','error','name','express','motion2','length','show','describe','params','then','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','catch','status','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','send','Unknown\x20status','destroy','delete','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb903,0x185));var _0x3b90=function(_0x14594d,_0x2f6ea9){_0x14594d=_0x14594d-0x0;var _0x3c8c69=_0xb903[_0x14594d];return _0x3c8c69;};'use strict';var _=require(_0x3b90('0x0'));var pm2=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var path=require('path');var exec=require(_0x3b90('0x4'))[_0x3b90('0x5')];var BPromise=require(_0x3b90('0x6'));function handleEntityNotFound(_0x1cd5d8,_0x30d8db){return function(_0x40f726){if(!_0x40f726){_0x1cd5d8[_0x3b90('0x7')](0x194);;}return _0x40f726;};}function respondWithResult(_0x5acd76,_0x15b68f){_0x15b68f=_0x15b68f||0xc8;return function(_0x5e845a){if(_0x5e845a){return _0x5acd76['status'](_0x15b68f)[_0x3b90('0x8')](_0x5e845a);}return null;};}function handleError(_0x2e4c06,_0x42efe8){_0x42efe8=_0x42efe8||0x1f4;return function(_0x1b1fbf){logger['error'](_0x1b1fbf['stack']);if(_0x1b1fbf['name']){delete _0x1b1fbf['name'];}_0x2e4c06['status'](_0x42efe8)['send'](_0x1b1fbf);};}function execChildProcess(){return new BPromise(function(_0x336913,_0x5af39c){exec('npm\x20install',function(_0x30c49c,_0x233509,_0x4bb8f4){logger[_0x3b90('0x9')](_0x233509);logger[_0x3b90('0x9')](_0x4bb8f4);if(_0x30c49c){logger[_0x3b90('0xa')](_0x30c49c);return _0x5af39c(_0x30c49c);}return _0x336913(_0x233509);});});}exports['index']=function(_0x5447df,_0x58c4d1){return pm2['list']()['then'](function(_0x3a0a55){if(_0x3a0a55){var _0x2c72fb=_['reject'](_0x3a0a55,function(_0x51fb66){return _0x51fb66[_0x3b90('0xb')]===_0x3b90('0xc')||_0x51fb66[_0x3b90('0xb')]===_0x3b90('0xd');});return{'rows':_0x2c72fb,'count':_0x2c72fb[_0x3b90('0xe')]};}return null;})['then'](respondWithResult(_0x58c4d1,null))['catch'](handleError(_0x58c4d1,null));};exports[_0x3b90('0xf')]=function(_0x5420dc,_0x4e9120){return pm2[_0x3b90('0x10')](_0x5420dc[_0x3b90('0x11')]['id'])[_0x3b90('0x12')](respondWithResult(_0x4e9120,null))[_0x3b90('0x12')](handleEntityNotFound(_0x4e9120,null))['catch'](handleError(_0x4e9120,null));};exports[_0x3b90('0x13')]=function(_0x5d140f,_0xd8d873){if(_0x5d140f[_0x3b90('0x14')]['name']&&_0x5d140f[_0x3b90('0x14')][_0x3b90('0x15')]){var _0x3642c0=path[_0x3b90('0x16')](__dirname,_0x3b90('0x17'),_0x5d140f[_0x3b90('0x14')][_0x3b90('0x15')]);var _0x2f4270=process[_0x3b90('0x18')]();process[_0x3b90('0x19')](path['dirname'](_0x3642c0));return execChildProcess()[_0x3b90('0x12')](function(_0x36b93e){process[_0x3b90('0x19')](_0x2f4270);return pm2[_0x3b90('0x1a')]({'name':_0x5d140f[_0x3b90('0x14')][_0x3b90('0xb')],'script':_0x3642c0});})['then'](function(_0x4b308c){pm2[_0x3b90('0x1b')]();return _0x4b308c[0x0];})[_0x3b90('0x12')](respondWithResult(_0xd8d873,0xc9))[_0x3b90('0x1c')](handleError(_0xd8d873,null));}else{return _0xd8d873[_0x3b90('0x1d')](0x1f4)['send']({'message':_0x3b90('0x1e')});}};exports[_0x3b90('0x1f')]=function(_0x1787d1,_0x4caead){if(_0x1787d1[_0x3b90('0x14')]['id']){delete _0x1787d1[_0x3b90('0x14')]['id'];}var _0x17ec7f={'online':_0x3b90('0x20'),'stopped':_0x3b90('0x21')};if(_0x17ec7f[_0x3b90('0x22')](_0x1787d1['body'][_0x3b90('0x1d')])){return pm2[_0x17ec7f[_0x1787d1['body'][_0x3b90('0x1d')]]](_0x1787d1[_0x3b90('0x11')]['id'])[_0x3b90('0x12')](respondWithResult(_0x4caead,0xc8))[_0x3b90('0x1c')](handleError(_0x4caead,null));}else{return _0x4caead[_0x3b90('0x1d')](0x1f4)[_0x3b90('0x23')]({'message':_0x3b90('0x24')});}};exports[_0x3b90('0x25')]=function(_0x500ceb,_0x4d1f31){if(_0x500ceb[_0x3b90('0x14')]['id']){delete _0x500ceb[_0x3b90('0x14')]['id'];}if(_0x500ceb[_0x3b90('0x11')]['id']){return pm2[_0x3b90('0x26')](_0x500ceb['params']['id'])['then'](function(_0xd33ac9){pm2[_0x3b90('0x1b')]();return _0xd33ac9[0x0];})[_0x3b90('0x12')](respondWithResult(_0x4d1f31,null))['catch'](handleError(_0x4d1f31,null));}else{return _0x4d1f31[_0x3b90('0x1d')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xde2c=['start','dump','update','restart','stop','hasOwnProperty','params','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','list','reject','express','motion2','then','catch','show','create','body','script','cwd','chdir','dirname'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xde2c,0x7f));var _0xcde2=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0xde2c[_0x152449];return _0x5b58b2;};'use strict';var _=require(_0xcde2('0x0'));var pm2=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var path=require(_0xcde2('0x4'));var exec=require(_0xcde2('0x5'))[_0xcde2('0x6')];var BPromise=require(_0xcde2('0x7'));function handleEntityNotFound(_0x55c175,_0x4353c8){return function(_0x196898){if(!_0x196898){_0x55c175[_0xcde2('0x8')](0x194);;}return _0x196898;};}function respondWithResult(_0x1398de,_0x401b16){_0x401b16=_0x401b16||0xc8;return function(_0x53c558){if(_0x53c558){return _0x1398de[_0xcde2('0x9')](_0x401b16)[_0xcde2('0xa')](_0x53c558);}return null;};}function handleError(_0x9c7036,_0x544235){_0x544235=_0x544235||0x1f4;return function(_0x582a6c){logger[_0xcde2('0xb')](_0x582a6c[_0xcde2('0xc')]);if(_0x582a6c['name']){delete _0x582a6c[_0xcde2('0xd')];}_0x9c7036[_0xcde2('0x9')](_0x544235)[_0xcde2('0xe')](_0x582a6c);};}function execChildProcess(){return new BPromise(function(_0x127358,_0x54b7c5){exec('npm\x20install',function(_0x25677f,_0x1bc697,_0x3b1333){logger[_0xcde2('0xf')](_0x1bc697);logger[_0xcde2('0xf')](_0x3b1333);if(_0x25677f){logger[_0xcde2('0xb')](_0x25677f);return _0x54b7c5(_0x25677f);}return _0x127358(_0x1bc697);});});}exports['index']=function(_0x211215,_0x577062){return pm2[_0xcde2('0x10')]()['then'](function(_0x4b0e0e){if(_0x4b0e0e){var _0x34e079=_[_0xcde2('0x11')](_0x4b0e0e,function(_0x417505){return _0x417505[_0xcde2('0xd')]===_0xcde2('0x12')||_0x417505['name']===_0xcde2('0x13');});return{'rows':_0x34e079,'count':_0x34e079['length']};}return null;})[_0xcde2('0x14')](respondWithResult(_0x577062,null))[_0xcde2('0x15')](handleError(_0x577062,null));};exports[_0xcde2('0x16')]=function(_0x1f1858,_0x5223f1){return pm2['describe'](_0x1f1858['params']['id'])[_0xcde2('0x14')](respondWithResult(_0x5223f1,null))['then'](handleEntityNotFound(_0x5223f1,null))[_0xcde2('0x15')](handleError(_0x5223f1,null));};exports[_0xcde2('0x17')]=function(_0x252372,_0x481fc0){if(_0x252372[_0xcde2('0x18')][_0xcde2('0xd')]&&_0x252372[_0xcde2('0x18')][_0xcde2('0x19')]){var _0x43df7a=path['join'](__dirname,'../../files/plugins',_0x252372['body'][_0xcde2('0x19')]);var _0x3e5170=process[_0xcde2('0x1a')]();process[_0xcde2('0x1b')](path[_0xcde2('0x1c')](_0x43df7a));return execChildProcess()['then'](function(_0x1104b8){process['chdir'](_0x3e5170);return pm2[_0xcde2('0x1d')]({'name':_0x252372[_0xcde2('0x18')][_0xcde2('0xd')],'script':_0x43df7a});})['then'](function(_0x593aa4){pm2[_0xcde2('0x1e')]();return _0x593aa4[0x0];})[_0xcde2('0x14')](respondWithResult(_0x481fc0,0xc9))[_0xcde2('0x15')](handleError(_0x481fc0,null));}else{return _0x481fc0[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xcde2('0x1f')]=function(_0x45275a,_0x1dce65){if(_0x45275a['body']['id']){delete _0x45275a[_0xcde2('0x18')]['id'];}var _0x348ca1={'online':_0xcde2('0x20'),'stopped':_0xcde2('0x21')};if(_0x348ca1[_0xcde2('0x22')](_0x45275a[_0xcde2('0x18')][_0xcde2('0x9')])){return pm2[_0x348ca1[_0x45275a[_0xcde2('0x18')]['status']]](_0x45275a[_0xcde2('0x23')]['id'])['then'](respondWithResult(_0x1dce65,0xc8))[_0xcde2('0x15')](handleError(_0x1dce65,null));}else{return _0x1dce65[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Unknown\x20status'});}};exports[_0xcde2('0x24')]=function(_0x28fedd,_0x58afb1){if(_0x28fedd[_0xcde2('0x18')]['id']){delete _0x28fedd[_0xcde2('0x18')]['id'];}if(_0x28fedd[_0xcde2('0x23')]['id']){return pm2[_0xcde2('0x25')](_0x28fedd[_0xcde2('0x23')]['id'])[_0xcde2('0x14')](function(_0x11b817){pm2[_0xcde2('0x1e')]();return _0x11b817[0x0];})['then'](respondWithResult(_0x58afb1,null))[_0xcde2('0x15')](handleError(_0x58afb1,null));}else{return _0x58afb1[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':_0xcde2('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 10decf7..85c4871 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe171=['/agents','isAuthenticated','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x4e76af,_0x495444){var _0x3a2183=function(_0x44dd23){while(--_0x44dd23){_0x4e76af['push'](_0x4e76af['shift']());}};_0x3a2183(++_0x495444);}(_0xe171,0x1e5));var _0x1e17=function(_0x23d7be,_0x962d96){_0x23d7be=_0x23d7be-0x0;var _0x1754e9=_0xe171[_0x23d7be];return _0x1754e9;};'use strict';var express=require(_0x1e17('0x0'));var router=express[_0x1e17('0x1')]();var auth=require(_0x1e17('0x2'));var controller=require(_0x1e17('0x3'));router[_0x1e17('0x4')](_0x1e17('0x5'),auth[_0x1e17('0x6')](),controller['getAgents']);router[_0x1e17('0x4')](_0x1e17('0x7'),auth[_0x1e17('0x6')](),controller[_0x1e17('0x8')]);module[_0x1e17('0x9')]=router; \ No newline at end of file +var _0x74e7=['getQueues','Router','../../components/auth/service','./realtime.controller','get','getAgents','isAuthenticated'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x74e7,0x135));var _0x774e=function(_0x26a922,_0x2ff12b){_0x26a922=_0x26a922-0x0;var _0x10955f=_0x74e7[_0x26a922];return _0x10955f;};'use strict';var express=require('express');var router=express[_0x774e('0x0')]();var auth=require(_0x774e('0x1'));var controller=require(_0x774e('0x2'));router[_0x774e('0x3')]('/agents',auth['isAuthenticated'](),controller[_0x774e('0x4')]);router[_0x774e('0x3')]('/queues',auth[_0x774e('0x5')](),controller[_0x774e('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 813772e..48e7a48 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0870=['findAll','QueueId','ringing','chatPause','faxPause','mailPause','smsPause','voicePause','whatsappPause','every','idle','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','mail','chat','sms','fax','whatsapp','toLowerCase','Invalid\x20channel','isArray','findOne','getAgents','all','uniq','value','split','includes','globalStatus','order','DESC','ASC','sort','pauseType','lastPauseAt','internal','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','openchannelPause','resolve','channel','query','fields','join','globalQueueFilter','role','agent','getOptions','where','isEmpty','user','userProfileId','nolimit','UserProfile','getResources','User','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','rawAttributes','fieldName','key','QueueCampaigns','type','util','lodash','../../config/logger','api','../../mysqldb','client','http','offset','undefined','count','limit','status','set','Content-Range','name','send','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','talking','paused','outbound','push','pTalking','message','startPredictive','startProgressive','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','waiting','busy','originated','pick','filter','queue','length','some','connectedlinenum','toString','find','getMembers','UserId','accountcode','online','voiceStatus','loggedInDb','Queue'];(function(_0x450eae,_0x2ad04d){var _0x2379d3=function(_0x4d7f9a){while(--_0x4d7f9a){_0x450eae['push'](_0x450eae['shift']());}};_0x2379d3(++_0x2ad04d);}(_0x0870,0x1a2));var _0x0087=function(_0x459168,_0x31b56c){_0x459168=_0x459168-0x0;var _0x4a9b2f=_0x0870[_0x459168];return _0x4a9b2f;};'use strict';var util=require(_0x0087('0x0'));var _=require(_0x0087('0x1'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0x0087('0x2'))(_0x0087('0x3'));var db=require(_0x0087('0x4'))['db'];var amiClient=jayson[_0x0087('0x5')][_0x0087('0x6')]({'port':0x232a});var routingClient=jayson[_0x0087('0x5')][_0x0087('0x6')]({'port':0x232c});function respondWithFilteredResult(_0xf2247f,_0x106367){return function(_0x273a3c){if(_0x273a3c){var _0xfafb1a=typeof _0x106367[_0x0087('0x7')]===_0x0087('0x8')&&typeof _0x106367['limit']===_0x0087('0x8');var _0x3f65b5=_0x273a3c[_0x0087('0x9')];var _0x1f2132=_0xfafb1a?0x0:_0x106367[_0x0087('0x7')];var _0x1a4aaf=_0xfafb1a?_0x273a3c[_0x0087('0x9')]:_0x106367[_0x0087('0x7')]+_0x106367[_0x0087('0xa')];var _0x12c4fa;if(_0x1a4aaf>=_0x3f65b5){_0x1a4aaf=_0x3f65b5;_0x12c4fa=0xc8;}else{_0x12c4fa=0xce;}_0xf2247f[_0x0087('0xb')](_0x12c4fa);return _0xf2247f[_0x0087('0xc')](_0x0087('0xd'),_0x1f2132+'-'+_0x1a4aaf+'/'+_0x3f65b5)['json'](_0x273a3c);}return null;};}function handleError(_0x4d6fa8,_0x962b69){_0x962b69=_0x962b69||0x1f4;return function(_0x3a05e1){logger['error'](_0x3a05e1['stack']);if(_0x3a05e1[_0x0087('0xe')]){delete _0x3a05e1[_0x0087('0xe')];}_0x4d6fa8[_0x0087('0xb')](_0x962b69)[_0x0087('0xf')](_0x3a05e1);};}function getRealtimeAgents(){return new Promise(function(_0x46710f,_0x946011){return amiClient[_0x0087('0x10')]('Agents',{})[_0x0087('0x11')](function(_0xb19897){if(_0xb19897[_0x0087('0x12')])throw new Error(_0x0087('0x13'));var _0x16817b=_0xb19897['result'];return routingClient[_0x0087('0x10')](_0x0087('0x14'),{})[_0x0087('0x11')](function(_0x2e3645){if(_0x2e3645[_0x0087('0x12')])throw new Error(_0x0087('0x15'));var _0x166db1=_0x2e3645[_0x0087('0x16')];return _0x46710f(_[_0x0087('0x17')]({},_0x16817b,_0x166db1));});})[_0x0087('0x18')](function(_0x5a93c0){_0x946011(_0x5a93c0);});});}function getRealtimeQueues(_0x374938,_0x9073fe){return new Promise(function(_0x13f987,_0x4aabd1){var _0x11b10f=_0x9073fe===_0x0087('0x19')?amiClient:routingClient;return _0x11b10f[_0x0087('0x10')](_[_0x0087('0x1a')](_0x9073fe)+_0x0087('0x1b'),_0x374938)[_0x0087('0x11')](function(_0x136ea1){if(_0x136ea1[_0x0087('0x12')])throw new Error(util[_0x0087('0x1c')](_0x0087('0x1d'),_0x9073fe));return _0x13f987(_0x136ea1[_0x0087('0x16')]);})[_0x0087('0x18')](function(_0x3627ea){_0x4aabd1(_0x3627ea);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x232e09,_0x2e321e){return amiClient['request'](_0x0087('0x1e'),{})[_0x0087('0x11')](function(_0x4089cc){if(_0x4089cc[_0x0087('0x12')])throw new Error(_0x0087('0x1f'));return _0x232e09(_0x4089cc[_0x0087('0x16')]);})['catch'](function(_0x2303c6){_0x2e321e(_0x2303c6);});});}function initializeQueues(_0x1dd7e4,_0x44c93e,_0x48315f,_0x354e42){var _0x6d873b=[_0x0087('0x20'),_0x0087('0x21'),'waiting',_0x0087('0x22'),_0x0087('0x23')];if(_0x48315f===_0x0087('0x19')&&_0x354e42===_0x0087('0x24')){_0x6d873b[_0x0087('0x25')](_0x0087('0x26'),'originated',_0x0087('0x27'),'dialActive','dialMethod','Trunk',_0x0087('0x28'),_0x0087('0x29'),'erlangCalls','erlangCallToSecond','erlangAbandonmentRate',_0x0087('0x2a'),'dialPredictiveInterval',_0x0087('0x2b'),'dialPredictiveIntervalMinThreshold',_0x0087('0x2c'),_0x0087('0x2d'),_0x0087('0x2e'),_0x0087('0x2f'),'predictiveIntervalDroppedCallsCallersExit',_0x0087('0x30'),_0x0087('0x31'));}return _0x1dd7e4[_0x0087('0x32')](function(_0x5786f8){var _0x1c9bd0=_0x5786f8[_0x0087('0x33')]({'plain':!![]});_0x1c9bd0[_0x0087('0x34')]=[];_0x1c9bd0[_0x0087('0x23')]=0x0;_0x1c9bd0['loggedInDb']=0x0;_0x1c9bd0[_0x0087('0x20')]=0x0;_0x1c9bd0[_0x0087('0x21')]=0x0;_0x1c9bd0[_0x0087('0x35')]=0x0;if(_0x48315f==='voice'){_0x1c9bd0['talking']=0x0;_0x1c9bd0[_0x0087('0x36')]=0x0;if(_0x354e42===_0x0087('0x24')){_0x1c9bd0['pTalking']=0x0;_0x1c9bd0[_0x0087('0x37')]=0x0;}}var _0x4ae8ed=_['find'](_0x44c93e,['id',_0x1c9bd0['id']]);if(_0x4ae8ed)_[_0x0087('0x17')](_0x1c9bd0,_[_0x0087('0x38')](_0x4ae8ed,_0x6d873b));return _0x1c9bd0;});}function updateAgentVoiceStatus(_0x1f8a4b,_0x825233,_0x5dbad7){var _0x37aa9c=_[_0x0087('0x39')](_0x5dbad7,[_0x0087('0x3a'),_0x825233[_0x0087('0xe')]]);if(_0x37aa9c[_0x0087('0x3b')]===0x0)return _0x1f8a4b['busy']=!![];if(_[_0x0087('0x3c')](_0x37aa9c,[_0x0087('0x3d'),_0x1f8a4b['internal'][_0x0087('0x3e')]()]))return _0x1f8a4b[_0x0087('0x22')]=!![];if(!_0x1f8a4b[_0x0087('0x22')])return _0x1f8a4b[_0x0087('0x36')]=!![];}function getVoiceQueueAgents(_0x31e947,_0x342765,_0x324481,_0x30eee3){var _0x130614=_[_0x0087('0x3f')](_0x342765,['id',_0x31e947['id']]);if(!_0x130614)return _0x31e947;return _0x130614[_0x0087('0x40')]({'raw':!![]})['then'](function(_0x478481){for(var _0x745385=0x0;_0x745385<_0x478481[_0x0087('0x3b')];_0x745385++){var _0xb9e11b=_[_0x0087('0x3f')](_0x324481,['id',_0x478481[_0x745385][_0x0087('0x41')]]);if(!_0xb9e11b){_0xb9e11b={'id':_0x478481[_0x745385][_0x0087('0x41')],'name':_0x478481[_0x745385][_0x0087('0x41')],'accountcode':'','online':![]};}var _0x1b3cb1={'id':_0xb9e11b['id'],'name':_0xb9e11b['name'],'internal':_0xb9e11b[_0x0087('0x42')],'online':Boolean(_0xb9e11b[_0x0087('0x43')]),'paused':Boolean(_0x478481[_0x745385][_0x0087('0x23')])};if(_0xb9e11b[_0x0087('0x44')]===_0x0087('0x22'))updateAgentVoiceStatus(_0x1b3cb1,_0x31e947,_0x30eee3);if(_0x1b3cb1['online'])_0x31e947[_0x0087('0x45')]++;if(_0x1b3cb1[_0x0087('0x36')])_0x31e947['busy']++;if(_0x1b3cb1['paused']&&!_0x1b3cb1[_0x0087('0x36')]&&!_0x1b3cb1[_0x0087('0x22')])_0x31e947[_0x0087('0x23')]++;_0x31e947['agents'][_0x0087('0x25')](_0x1b3cb1);}return _0x31e947;});}function getQueueAgents(_0x3ace4e,_0x3ed860,_0x39a2e9){var _0xf09068='User'+_[_0x0087('0x1a')](_0x39a2e9)+_0x0087('0x46');var _0x3c6db1=_0x39a2e9+'Pause';return db[_0xf09068][_0x0087('0x47')]({'where':{[_['startCase'](_0x39a2e9)+_0x0087('0x48')]:_0x3ace4e['id']},'raw':!![]})[_0x0087('0x11')](function(_0x15c6cd){for(var _0x1d444a=0x0;_0x1d444a<_0x15c6cd[_0x0087('0x3b')];_0x1d444a++){var _0x380ac0=_['find'](_0x3ed860,['id',_0x15c6cd[_0x1d444a][_0x0087('0x41')]]);if(!_0x380ac0){_0x380ac0={'id':_0x15c6cd[_0x1d444a][_0x0087('0x41')],'name':_0x15c6cd[_0x1d444a][_0x0087('0x41')],'online':![],['pauseField']:![]};}var _0x23daca={'id':_0x380ac0['id'],'name':_0x380ac0[_0x0087('0xe')],'online':Boolean(_0x380ac0[_0x0087('0x43')]),'paused':Boolean(_0x380ac0[_0x3c6db1])};if(_0x23daca['online'])_0x3ace4e[_0x0087('0x45')]++;_0x3ace4e[_0x0087('0x34')][_0x0087('0x25')](_0x23daca);}return _0x3ace4e;});}function isIdle(_0x571b3b){return _0x571b3b==='idle'||_0x571b3b==='unknown'||_0x571b3b==='unavailable'||_0x571b3b===_0x0087('0x49')||_['isNil'](_0x571b3b);}function isAgentPaused(_0x532d03,_0x3cdf0f){var _0x54add0=[_0x532d03[_0x0087('0x4a')],_0x532d03[_0x0087('0x4b')],_0x532d03[_0x0087('0x4c')],_0x532d03['openchannelPause'],_0x532d03[_0x0087('0x4d')],_0x532d03[_0x0087('0x4e')],_0x532d03[_0x0087('0x4f')]];if(!_0x3cdf0f)return _[_0x0087('0x50')](_0x54add0);var _0x1344bc=_[_0x0087('0x39')](_0x54add0);return _0x1344bc[_0x0087('0x3b')]>0x0&&_0x1344bc[_0x0087('0x3b')]<_0x54add0['length']?!![]:![];}function isAgentIdle(_0x58801c){if(_0x58801c[_0x0087('0x44')]!==_0x0087('0x51')&&_0x58801c[_0x0087('0x4e')]){_0x58801c[_0x0087('0x44')]=_0x0087('0x52');return![];}return _['every']([_0x58801c[_0x0087('0x53')],_0x58801c[_0x0087('0x54')],_0x58801c[_0x0087('0x55')],_0x58801c[_0x0087('0x56')],_0x58801c[_0x0087('0x57')],_0x58801c[_0x0087('0x44')],_0x58801c[_0x0087('0x58')]],isIdle);}function getAgentStatus(_0x51a760){var _0x44d440='unknown';if(isAgentPaused(_0x51a760))_0x44d440=_0x0087('0x52');else if(isAgentPaused(_0x51a760,!![]))_0x44d440=_0x0087('0x59');else if(isAgentIdle(_0x51a760))_0x44d440='idle';else _0x44d440=_0x0087('0x36');return _0x44d440;}function validateChannel(_0x5011f8){var _0x30a5fb=[_0x0087('0x5a'),_0x0087('0x5b'),_0x0087('0x5c'),'openchannel',_0x0087('0x5d'),_0x0087('0x5e'),_0x0087('0x19')];if(!_['includes'](_0x30a5fb,_0x5011f8[_0x0087('0x5f')]()))throw new Error(_0x0087('0x60'));return _0x5011f8[_0x0087('0x5f')]();}function getFilteredAgentIds(_0x5b9c47,_0x5cc426){var _0x4f1ced=_[_0x0087('0x61')](_0x5b9c47)?_0x5b9c47:[_0x5b9c47];var _0x38c085=_['map'](_0x4f1ced,function(_0x22e95d){return db[_0x5cc426][_0x0087('0x62')]({'where':{'name':_0x22e95d}})['then'](function(_0x1b1a16){if(!_0x1b1a16)return[];return _0x1b1a16[_0x0087('0x63')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x0087('0x64')](_0x38c085)[_0x0087('0x11')](function(_0x324326){var _0x695aa5=_(_0x324326)['flatten']()[_0x0087('0x32')]('id')[_0x0087('0x65')]()[_0x0087('0x66')]();return _0x695aa5;});}function getUpdatedSortOptions(_0x264a98){var _0x12b188={'fields':[],'order':null};var _0x5ba1ab=_0x264a98[_0x0087('0x67')](',');_0x12b188['fields']=_[_0x0087('0x39')](_0x5ba1ab,function(_0x3ffc5f){if(!_0x3ffc5f[_0x0087('0x68')](_0x0087('0x69')))return!![];_0x12b188[_0x0087('0x6a')]=_['startsWith'](_0x3ffc5f,'-')?_0x0087('0x6b'):_0x0087('0x6c');return![];});return _0x12b188;}function orderAgentsByStatus(_0x15aede,_0x3ac3d9){return _0x15aede[_0x0087('0x6d')](function(_0x252134,_0x415145){if(_0x252134['globalStatus']===_0x415145[_0x0087('0x69')]&&_0x252134[_0x0087('0x69')]==='pause'){if(_0x3ac3d9===_0x0087('0x6b'))return(_0x252134['pauseType']||'')<(_0x415145[_0x0087('0x6e')]||'')?0x1:-0x1;return _0x252134[_0x0087('0x6e')]<_0x415145[_0x0087('0x6e')]?-0x1:0x1;}else{if(_0x3ac3d9===_0x0087('0x6b'))return _0x252134[_0x0087('0x69')]<_0x415145['globalStatus']?0x1:-0x1;return _0x252134[_0x0087('0x69')]<_0x415145['globalStatus']?-0x1:0x1;}});}exports[_0x0087('0x63')]=function(_0x580890,_0xdf3cc0){var _0xf9e2bc={'count':0x0,'rows':[]},_0x32b33f={},_0x4b4660,_0x2b7848,_0x555d0d,_0x527cef,_0x6ca3a=['userpic',_0x0087('0x43'),'lastLoginAt',_0x0087('0x6f'),'pauseType',_0x0087('0x6f'),_0x0087('0x70'),'address',_0x0087('0x4a'),'openchannelPause','mailPause',_0x0087('0x4d'),'whatsappPause',_0x0087('0x4b'),_0x0087('0x4e'),_0x0087('0x71'),_0x0087('0x72'),_0x0087('0x73'),_0x0087('0x74'),_0x0087('0x75'),_0x0087('0x76'),_0x0087('0x77'),_0x0087('0x78'),_0x0087('0x79'),'smsCurrentCapacity',_0x0087('0x7a'),_0x0087('0x7b'),_0x0087('0x53'),_0x0087('0x56'),'mailStatus',_0x0087('0x57'),'whatsappStatus','faxStatus',_0x0087('0x44'),'chatStatusTime','openchannelStatusTime',_0x0087('0x7c'),_0x0087('0x7d'),_0x0087('0x7e'),_0x0087('0x7f'),_0x0087('0x80'),_0x0087('0x3a'),_0x0087('0x81'),_0x0087('0x82'),_0x0087('0x83'),_0x0087('0x84'),_0x0087('0x85')],_0x1e224e=[_0x0087('0x4a'),_0x0087('0x86'),_0x0087('0x4c'),_0x0087('0x4d'),_0x0087('0x4f'),_0x0087('0x4b'),'voicePause',_0x0087('0x43')];Promise[_0x0087('0x87')]()[_0x0087('0x11')](function(){if(_0x580890['query'][_0x0087('0x88')])_0x4b4660=validateChannel(_0x580890[_0x0087('0x89')][_0x0087('0x88')]);if(!_0x580890[_0x0087('0x89')]['sort']||!_0x580890['query'][_0x0087('0x6d')][_0x0087('0x68')]('globalStatus'))return;var _0x4157ca=getUpdatedSortOptions(_0x580890[_0x0087('0x89')]['sort']);_0x580890[_0x0087('0x89')][_0x0087('0x6d')]=_0x4157ca[_0x0087('0x8a')][_0x0087('0x8b')](',');_0x2b7848=_0x4157ca[_0x0087('0x6a')];})['then'](function(){if(!_0x580890['query'][_0x0087('0x8c')])return[];var _0x2f6094=_[_0x0087('0x1a')](_0x4b4660)+_0x0087('0x46');return getFilteredAgentIds(_0x580890[_0x0087('0x89')][_0x0087('0x8c')],_0x2f6094);})[_0x0087('0x11')](function(_0xd24eea){var _0x4bb393=_[_0x0087('0x32')](db['User']['rawAttributes'],function(_0x5235d2){return{'name':_0x5235d2['fieldName'],'type':_0x5235d2['type']['key']};});_0x580890['query'][_0x0087('0x8d')]=_0x0087('0x8e');_0x580890['query'][_0x0087('0x43')]=!![];_0x32b33f=qs[_0x0087('0x8f')](_0x4bb393,_0x580890);_0x32b33f['raw']=!![];if(!_['isEmpty'](_0xd24eea)){_0x32b33f[_0x0087('0x90')]=_['merge'](_0x32b33f[_0x0087('0x90')],{'$and':[{'id':{'$in':_0xd24eea}}]});}else if(!_[_0x0087('0x91')](_0x580890[_0x0087('0x89')]['globalQueueFilter'])){return _0xf9e2bc;}if(_0x580890[_0x0087('0x92')][_0x0087('0x8d')]===_0x0087('0x92')){var _0x6071d0={'params':{'id':_0x580890['user'][_0x0087('0x93')]},'query':{'section':_0x0087('0x14'),'role':_0x0087('0x8e'),'online':!![],'nolimit':_0x580890[_0x0087('0x89')][_0x0087('0x94')],'sort':_0x580890[_0x0087('0x89')]['sort'],'filter':_0x580890['query'][_0x0087('0x39')],'raw':!![],'ids':_0xd24eea}};return db[_0x0087('0x95')][_0x0087('0x96')](_0x6071d0);}return db[_0x0087('0x97')][_0x0087('0x98')](_0x32b33f);})[_0x0087('0x11')](function(_0x2f2767){_0xf9e2bc[_0x0087('0x9')]=_0x2f2767[_0x0087('0x9')];_0x555d0d=_0x2f2767[_0x0087('0x99')];return getRealtimeAgents();})[_0x0087('0x11')](function(_0x38b112){_0x527cef=_0x38b112['rows'];return _0x555d0d[_0x0087('0x32')](function(_0x2db98d){var _0x38427f=_['find'](_0x527cef,['id',_0x2db98d['id']]);if(_0x38427f)_[_0x0087('0x17')](_0x2db98d,_[_0x0087('0x38')](_[_0x0087('0x9a')](_0x38427f,_0x1e224e),_0x6ca3a));_0x2db98d[_0x0087('0x69')]=getAgentStatus(_0x2db98d);return _0x2db98d;});})['then'](function(_0x374cc7){var _0xe3b6d7;if(_0x580890[_0x0087('0x89')][_0x0087('0x9b')]){_0xe3b6d7=_[_0x0087('0x39')](_0x374cc7,[_0x0087('0x69'),_0x580890[_0x0087('0x89')]['globalStatusFilter']]);if(_0x580890['query'][_0x0087('0x9c')]){_0xe3b6d7=_[_0x0087('0x39')](_0xe3b6d7,[_0x0087('0x6e'),_0x580890[_0x0087('0x89')]['pauseTypeFilter']]);}}if(_0xe3b6d7)_0x374cc7=_0xe3b6d7;if(!_0x2b7848)return _0x374cc7;return orderAgentsByStatus(_0x374cc7,_0x2b7848);})['then'](function(_0x35b454){_0xf9e2bc['rows']=_0x35b454;return _0xf9e2bc;})[_0x0087('0x11')](respondWithFilteredResult(_0xdf3cc0,_0x32b33f))[_0x0087('0x18')](handleError(_0xdf3cc0,null));};exports[_0x0087('0x9d')]=function(_0x1628ad,_0x1ecf5d){var _0x55ebec={'count':0x0,'rows':[]},_0x4308e1={},_0x2634eb,_0x5b4030,_0x42bbca,_0x11c39c,_0x4e397f;Promise[_0x0087('0x87')]()[_0x0087('0x11')](function(){if(_0x1628ad['query'][_0x0087('0x88')])_0x2634eb=validateChannel(_0x1628ad[_0x0087('0x89')][_0x0087('0x88')]);var _0x552ae3=_[_0x0087('0x1a')](_0x2634eb)+_0x0087('0x46');var _0x4ba851=_[_0x0087('0x32')](db[_0x552ae3][_0x0087('0x9e')],function(_0x252544){return{'name':_0x252544[_0x0087('0x9f')],'type':_0x252544['type'][_0x0087('0xa0')]};});_0x4308e1=qs[_0x0087('0x8f')](_0x4ba851,_0x1628ad);if(_0x1628ad[_0x0087('0x92')][_0x0087('0x8d')]==='user'){var _0x554215={'params':{'id':_0x1628ad[_0x0087('0x92')][_0x0087('0x93')]},'query':{'section':_0x2634eb==='voice'&&_0x1628ad[_0x0087('0x89')]['type']===_0x0087('0x24')?_0x0087('0xa1'):_['startCase'](_0x2634eb)+_0x0087('0x1b'),'type':_0x1628ad['query'][_0x0087('0xa2')],'nolimit':!![],'sort':'name','filter':_0x1628ad['query'][_0x0087('0x39')]}};return db[_0x0087('0x95')][_0x0087('0x96')](_0x554215);}return db[_0x552ae3][_0x0087('0x98')](_0x4308e1);})[_0x0087('0x11')](function(_0xda451d){_0x55ebec[_0x0087('0x9')]=_0xda451d[_0x0087('0x9')];_0x5b4030=_0xda451d[_0x0087('0x99')];return getRealtimeQueues(_0x1628ad,_0x2634eb);})[_0x0087('0x11')](function(_0x4969e5){_0x11c39c=_0x4969e5['rows'];return getRealtimeAgents();})['then'](function(_0x2db02b){_0x42bbca=_0x2db02b[_0x0087('0x99')];if(_0x2634eb!=_0x0087('0x19'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x200911){_0x4e397f=_0x200911?_0x200911[_0x0087('0x99')]:[];return initializeQueues(_0x5b4030,_0x11c39c,_0x2634eb,_0x1628ad[_0x0087('0x89')][_0x0087('0xa2')]);})[_0x0087('0x11')](function(_0x496e1e){var _0x225864=_0x496e1e[_0x0087('0x32')](function(_0x42384e){if(_0x2634eb===_0x0087('0x19'))return getVoiceQueueAgents(_0x42384e,_0x5b4030,_0x42bbca,_0x4e397f);else return getQueueAgents(_0x42384e,_0x42bbca,_0x2634eb);});return Promise[_0x0087('0x64')](_0x225864);})[_0x0087('0x11')](function(_0x3b7ef7){_0x55ebec['rows']=_0x3b7ef7;return _0x55ebec;})[_0x0087('0x11')](respondWithFilteredResult(_0x1ecf5d,_0x4308e1))['catch'](handleError(_0x1ecf5d,null));}; \ No newline at end of file +var _0x68ed=['limit','count','status','set','Content-Range','json','error','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','originated','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','agents','pick','filter','queue','length','busy','some','connectedlinenum','internal','toString','find','getMembers','UserId','online','voiceStatus','loggedInDb','User','Queue','Pause','QueueId','ringing','isNil','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','idle','pause','faxStatus','unknown','*pause','mail','chat','sms','fax','includes','toLowerCase','Invalid\x20channel','map','findOne','getAgents','all','uniq','value','split','order','startsWith','DESC','ASC','globalStatus','pauseType','userpic','lastLoginAt','address','chatPause','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus','smsStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','resolve','query','channel','sort','globalQueueFilter','rawAttributes','fieldName','type','key','role','agent','raw','isEmpty','where','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','getOptions','QueueCampaigns','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','offset','undefined'];(function(_0x59f3e6,_0x327230){var _0x2c197b=function(_0x29a94e){while(--_0x29a94e){_0x59f3e6['push'](_0x59f3e6['shift']());}};_0x2c197b(++_0x327230);}(_0x68ed,0x140));var _0xd68e=function(_0x115ec0,_0x369dd8){_0x115ec0=_0x115ec0-0x0;var _0x4f4527=_0x68ed[_0x115ec0];return _0x4f4527;};'use strict';var util=require(_0xd68e('0x0'));var _=require(_0xd68e('0x1'));var jayson=require(_0xd68e('0x2'));var qs=require(_0xd68e('0x3'));var logger=require(_0xd68e('0x4'))('api');var db=require(_0xd68e('0x5'))['db'];var amiClient=jayson[_0xd68e('0x6')][_0xd68e('0x7')]({'port':0x232a});var routingClient=jayson[_0xd68e('0x6')][_0xd68e('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x1dae40,_0x387b68){return function(_0xc32891){if(_0xc32891){var _0x4b7600=typeof _0x387b68[_0xd68e('0x8')]===_0xd68e('0x9')&&typeof _0x387b68[_0xd68e('0xa')]==='undefined';var _0x220893=_0xc32891[_0xd68e('0xb')];var _0x2b264=_0x4b7600?0x0:_0x387b68['offset'];var _0x570aac=_0x4b7600?_0xc32891[_0xd68e('0xb')]:_0x387b68[_0xd68e('0x8')]+_0x387b68[_0xd68e('0xa')];var _0x225b26;if(_0x570aac>=_0x220893){_0x570aac=_0x220893;_0x225b26=0xc8;}else{_0x225b26=0xce;}_0x1dae40[_0xd68e('0xc')](_0x225b26);return _0x1dae40[_0xd68e('0xd')](_0xd68e('0xe'),_0x2b264+'-'+_0x570aac+'/'+_0x220893)[_0xd68e('0xf')](_0xc32891);}return null;};}function handleError(_0x3b2aab,_0x295d26){_0x295d26=_0x295d26||0x1f4;return function(_0x357f31){logger[_0xd68e('0x10')](_0x357f31['stack']);if(_0x357f31[_0xd68e('0x11')]){delete _0x357f31[_0xd68e('0x11')];}_0x3b2aab['status'](_0x295d26)[_0xd68e('0x12')](_0x357f31);};}function getRealtimeAgents(){return new Promise(function(_0x336e9e,_0x51f055){return amiClient[_0xd68e('0x13')](_0xd68e('0x14'),{})[_0xd68e('0x15')](function(_0x3bb8eb){if(_0x3bb8eb[_0xd68e('0x10')])throw new Error(_0xd68e('0x16'));var _0x100af4=_0x3bb8eb['result'];return routingClient['request'](_0xd68e('0x14'),{})[_0xd68e('0x15')](function(_0x15bf36){if(_0x15bf36[_0xd68e('0x10')])throw new Error(_0xd68e('0x17'));var _0x3dd49d=_0x15bf36['result'];return _0x336e9e(_[_0xd68e('0x18')]({},_0x100af4,_0x3dd49d));});})[_0xd68e('0x19')](function(_0x459a85){_0x51f055(_0x459a85);});});}function getRealtimeQueues(_0x2eb522,_0x7a7d83){return new Promise(function(_0x358505,_0xe016ee){var _0xe44234=_0x7a7d83===_0xd68e('0x1a')?amiClient:routingClient;return _0xe44234[_0xd68e('0x13')](_[_0xd68e('0x1b')](_0x7a7d83)+_0xd68e('0x1c'),_0x2eb522)[_0xd68e('0x15')](function(_0x334d8c){if(_0x334d8c[_0xd68e('0x10')])throw new Error(util[_0xd68e('0x1d')](_0xd68e('0x1e'),_0x7a7d83));return _0x358505(_0x334d8c[_0xd68e('0x1f')]);})[_0xd68e('0x19')](function(_0x3b00a3){_0xe016ee(_0x3b00a3);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x20b19e,_0x5c2c76){return amiClient[_0xd68e('0x13')](_0xd68e('0x20'),{})[_0xd68e('0x15')](function(_0x254da7){if(_0x254da7[_0xd68e('0x10')])throw new Error(_0xd68e('0x21'));return _0x20b19e(_0x254da7[_0xd68e('0x1f')]);})['catch'](function(_0x51816f){_0x5c2c76(_0x51816f);});});}function initializeQueues(_0x10cf36,_0x3d5d12,_0x5adc28,_0x2911e3){var _0x5aaf0a=[_0xd68e('0x22'),_0xd68e('0x23'),_0xd68e('0x24'),_0xd68e('0x25'),_0xd68e('0x26')];if(_0x5adc28===_0xd68e('0x1a')&&_0x2911e3===_0xd68e('0x27')){_0x5aaf0a[_0xd68e('0x28')](_0xd68e('0x29'),_0xd68e('0x2a'),'message',_0xd68e('0x2b'),'dialMethod',_0xd68e('0x2c'),_0xd68e('0x2d'),_0xd68e('0x2e'),_0xd68e('0x2f'),_0xd68e('0x30'),_0xd68e('0x31'),_0xd68e('0x32'),_0xd68e('0x33'),_0xd68e('0x34'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0xd68e('0x35'),_0xd68e('0x36'),_0xd68e('0x37'),_0xd68e('0x38'),_0xd68e('0x39'),_0xd68e('0x3a'));}return _0x10cf36['map'](function(_0x37b159){var _0x42a63b=_0x37b159['get']({'plain':!![]});_0x42a63b[_0xd68e('0x3b')]=[];_0x42a63b[_0xd68e('0x26')]=0x0;_0x42a63b['loggedInDb']=0x0;_0x42a63b[_0xd68e('0x22')]=0x0;_0x42a63b[_0xd68e('0x23')]=0x0;_0x42a63b[_0xd68e('0x24')]=0x0;if(_0x5adc28==='voice'){_0x42a63b[_0xd68e('0x25')]=0x0;_0x42a63b['busy']=0x0;if(_0x2911e3==='outbound'){_0x42a63b[_0xd68e('0x29')]=0x0;_0x42a63b[_0xd68e('0x2a')]=0x0;}}var _0xf8ccdc=_['find'](_0x3d5d12,['id',_0x42a63b['id']]);if(_0xf8ccdc)_['merge'](_0x42a63b,_[_0xd68e('0x3c')](_0xf8ccdc,_0x5aaf0a));return _0x42a63b;});}function updateAgentVoiceStatus(_0xd8fc12,_0x1762d1,_0x5926e8){var _0x387455=_[_0xd68e('0x3d')](_0x5926e8,[_0xd68e('0x3e'),_0x1762d1['name']]);if(_0x387455[_0xd68e('0x3f')]===0x0)return _0xd8fc12[_0xd68e('0x40')]=!![];if(_[_0xd68e('0x41')](_0x387455,[_0xd68e('0x42'),_0xd8fc12[_0xd68e('0x43')][_0xd68e('0x44')]()]))return _0xd8fc12[_0xd68e('0x25')]=!![];if(!_0xd8fc12[_0xd68e('0x25')])return _0xd8fc12[_0xd68e('0x40')]=!![];}function getVoiceQueueAgents(_0x2972db,_0x4ee1be,_0x530450,_0x353eb4){var _0x3ec581=_[_0xd68e('0x45')](_0x4ee1be,['id',_0x2972db['id']]);if(!_0x3ec581)return _0x2972db;return _0x3ec581[_0xd68e('0x46')]({'raw':!![]})[_0xd68e('0x15')](function(_0x501b4c){for(var _0x892e57=0x0;_0x892e57<_0x501b4c['length'];_0x892e57++){var _0x52e927=_[_0xd68e('0x45')](_0x530450,['id',_0x501b4c[_0x892e57][_0xd68e('0x47')]]);if(!_0x52e927){_0x52e927={'id':_0x501b4c[_0x892e57][_0xd68e('0x47')],'name':_0x501b4c[_0x892e57][_0xd68e('0x47')],'accountcode':'','online':![]};}var _0x294bc1={'id':_0x52e927['id'],'name':_0x52e927[_0xd68e('0x11')],'internal':_0x52e927['accountcode'],'online':Boolean(_0x52e927[_0xd68e('0x48')]),'paused':Boolean(_0x501b4c[_0x892e57][_0xd68e('0x26')])};if(_0x52e927[_0xd68e('0x49')]===_0xd68e('0x25'))updateAgentVoiceStatus(_0x294bc1,_0x2972db,_0x353eb4);if(_0x294bc1['online'])_0x2972db[_0xd68e('0x4a')]++;if(_0x294bc1[_0xd68e('0x40')])_0x2972db[_0xd68e('0x40')]++;if(_0x294bc1['paused']&&!_0x294bc1[_0xd68e('0x40')]&&!_0x294bc1[_0xd68e('0x25')])_0x2972db['paused']++;_0x2972db[_0xd68e('0x3b')][_0xd68e('0x28')](_0x294bc1);}return _0x2972db;});}function getQueueAgents(_0x28753c,_0x15c9f5,_0x50b9c4){var _0x518500=_0xd68e('0x4b')+_[_0xd68e('0x1b')](_0x50b9c4)+_0xd68e('0x4c');var _0x2b1b63=_0x50b9c4+_0xd68e('0x4d');return db[_0x518500]['findAll']({'where':{[_[_0xd68e('0x1b')](_0x50b9c4)+_0xd68e('0x4e')]:_0x28753c['id']},'raw':!![]})[_0xd68e('0x15')](function(_0x42d374){for(var _0x34ce2e=0x0;_0x34ce2e<_0x42d374[_0xd68e('0x3f')];_0x34ce2e++){var _0x23e1ff=_[_0xd68e('0x45')](_0x15c9f5,['id',_0x42d374[_0x34ce2e][_0xd68e('0x47')]]);if(!_0x23e1ff){_0x23e1ff={'id':_0x42d374[_0x34ce2e][_0xd68e('0x47')],'name':_0x42d374[_0x34ce2e]['UserId'],'online':![],['pauseField']:![]};}var _0x53da38={'id':_0x23e1ff['id'],'name':_0x23e1ff[_0xd68e('0x11')],'online':Boolean(_0x23e1ff[_0xd68e('0x48')]),'paused':Boolean(_0x23e1ff[_0x2b1b63])};if(_0x53da38['online'])_0x28753c['loggedInDb']++;_0x28753c['agents']['push'](_0x53da38);}return _0x28753c;});}function isIdle(_0x2426c4){return _0x2426c4==='idle'||_0x2426c4==='unknown'||_0x2426c4==='unavailable'||_0x2426c4===_0xd68e('0x4f')||_[_0xd68e('0x50')](_0x2426c4);}function isAgentPaused(_0x45fa0a,_0x3a59e3){var _0x4e31cf=[_0x45fa0a['chatPause'],_0x45fa0a[_0xd68e('0x51')],_0x45fa0a[_0xd68e('0x52')],_0x45fa0a[_0xd68e('0x53')],_0x45fa0a[_0xd68e('0x54')],_0x45fa0a[_0xd68e('0x55')],_0x45fa0a[_0xd68e('0x56')]];if(!_0x3a59e3)return _[_0xd68e('0x57')](_0x4e31cf);var _0xa20575=_[_0xd68e('0x3d')](_0x4e31cf);return _0xa20575[_0xd68e('0x3f')]>0x0&&_0xa20575[_0xd68e('0x3f')]<_0x4e31cf[_0xd68e('0x3f')]?!![]:![];}function isAgentIdle(_0x11ade6){if(_0x11ade6['voiceStatus']!==_0xd68e('0x58')&&_0x11ade6['voicePause']){_0x11ade6[_0xd68e('0x49')]=_0xd68e('0x59');return![];}return _[_0xd68e('0x57')]([_0x11ade6['chatStatus'],_0x11ade6[_0xd68e('0x5a')],_0x11ade6['mailStatus'],_0x11ade6['openchannelStatus'],_0x11ade6['smsStatus'],_0x11ade6['voiceStatus'],_0x11ade6['whatsappStatus']],isIdle);}function getAgentStatus(_0x18b101){var _0x361edf=_0xd68e('0x5b');if(isAgentPaused(_0x18b101))_0x361edf=_0xd68e('0x59');else if(isAgentPaused(_0x18b101,!![]))_0x361edf=_0xd68e('0x5c');else if(isAgentIdle(_0x18b101))_0x361edf=_0xd68e('0x58');else _0x361edf=_0xd68e('0x40');return _0x361edf;}function validateChannel(_0x15e8c3){var _0x3bafe8=[_0xd68e('0x5d'),_0xd68e('0x5e'),_0xd68e('0x5f'),'openchannel',_0xd68e('0x60'),'whatsapp','voice'];if(!_[_0xd68e('0x61')](_0x3bafe8,_0x15e8c3[_0xd68e('0x62')]()))throw new Error(_0xd68e('0x63'));return _0x15e8c3[_0xd68e('0x62')]();}function getFilteredAgentIds(_0x51af77,_0x5547d3){var _0x589798=_['isArray'](_0x51af77)?_0x51af77:[_0x51af77];var _0x2ee7a0=_[_0xd68e('0x64')](_0x589798,function(_0x2e6151){return db[_0x5547d3][_0xd68e('0x65')]({'where':{'name':_0x2e6151}})['then'](function(_0xa5dfe5){if(!_0xa5dfe5)return[];return _0xa5dfe5[_0xd68e('0x66')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd68e('0x67')](_0x2ee7a0)['then'](function(_0x131bab){var _0x738c64=_(_0x131bab)['flatten']()[_0xd68e('0x64')]('id')[_0xd68e('0x68')]()[_0xd68e('0x69')]();return _0x738c64;});}function getUpdatedSortOptions(_0x2a8a07){var _0x1af244={'fields':[],'order':null};var _0x49821c=_0x2a8a07[_0xd68e('0x6a')](',');_0x1af244['fields']=_['filter'](_0x49821c,function(_0xe8af62){if(!_0xe8af62['includes']('globalStatus'))return!![];_0x1af244[_0xd68e('0x6b')]=_[_0xd68e('0x6c')](_0xe8af62,'-')?_0xd68e('0x6d'):_0xd68e('0x6e');return![];});return _0x1af244;}function orderAgentsByStatus(_0x1eae38,_0x1dbb4d){return _0x1eae38['sort'](function(_0x5ae507,_0x34bebb){if(_0x5ae507[_0xd68e('0x6f')]===_0x34bebb[_0xd68e('0x6f')]&&_0x5ae507['globalStatus']===_0xd68e('0x59')){if(_0x1dbb4d==='DESC')return(_0x5ae507[_0xd68e('0x70')]||'')<(_0x34bebb['pauseType']||'')?0x1:-0x1;return _0x5ae507[_0xd68e('0x70')]<_0x34bebb[_0xd68e('0x70')]?-0x1:0x1;}else{if(_0x1dbb4d==='DESC')return _0x5ae507[_0xd68e('0x6f')]<_0x34bebb[_0xd68e('0x6f')]?0x1:-0x1;return _0x5ae507[_0xd68e('0x6f')]<_0x34bebb['globalStatus']?-0x1:0x1;}});}exports[_0xd68e('0x66')]=function(_0x463fc7,_0x46022f){var _0x3f0a57={'count':0x0,'rows':[]},_0x379eaf={},_0x416500,_0x4b330b,_0x45b70f,_0x582157,_0x4b6149=[_0xd68e('0x71'),_0xd68e('0x48'),_0xd68e('0x72'),'lastPauseAt',_0xd68e('0x70'),'lastPauseAt','internal',_0xd68e('0x73'),_0xd68e('0x74'),'openchannelPause','mailPause','smsPause',_0xd68e('0x56'),_0xd68e('0x51'),'voicePause',_0xd68e('0x75'),_0xd68e('0x76'),_0xd68e('0x77'),'smsCapacity',_0xd68e('0x78'),'faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity',_0xd68e('0x79'),_0xd68e('0x7a'),_0xd68e('0x7b'),_0xd68e('0x7c'),_0xd68e('0x7d'),_0xd68e('0x7e'),'mailStatus',_0xd68e('0x7f'),_0xd68e('0x80'),_0xd68e('0x5a'),_0xd68e('0x49'),_0xd68e('0x81'),_0xd68e('0x82'),_0xd68e('0x83'),_0xd68e('0x84'),'whatsappStatusTime',_0xd68e('0x85'),_0xd68e('0x86'),_0xd68e('0x3e'),_0xd68e('0x87'),_0xd68e('0x88'),'phoneBarEnableScreenRecordingByAgent',_0xd68e('0x89'),'routealias'],_0x1fa4b0=[_0xd68e('0x74'),_0xd68e('0x53'),_0xd68e('0x52'),_0xd68e('0x54'),_0xd68e('0x56'),_0xd68e('0x51'),_0xd68e('0x55'),_0xd68e('0x48')];Promise[_0xd68e('0x8a')]()[_0xd68e('0x15')](function(){if(_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x8c')])_0x416500=validateChannel(_0x463fc7['query']['channel']);if(!_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x8d')]||!_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x8d')]['includes'](_0xd68e('0x6f')))return;var _0x594086=getUpdatedSortOptions(_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x8d')]);_0x463fc7['query'][_0xd68e('0x8d')]=_0x594086['fields']['join'](',');_0x4b330b=_0x594086[_0xd68e('0x6b')];})[_0xd68e('0x15')](function(){if(!_0x463fc7[_0xd68e('0x8b')]['globalQueueFilter'])return[];var _0x295d65=_['startCase'](_0x416500)+_0xd68e('0x4c');return getFilteredAgentIds(_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x8e')],_0x295d65);})[_0xd68e('0x15')](function(_0x596778){var _0xbb1eea=_['map'](db[_0xd68e('0x4b')][_0xd68e('0x8f')],function(_0xf066ff){return{'name':_0xf066ff[_0xd68e('0x90')],'type':_0xf066ff[_0xd68e('0x91')][_0xd68e('0x92')]};});_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x93')]=_0xd68e('0x94');_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x48')]=!![];_0x379eaf=qs['getOptions'](_0xbb1eea,_0x463fc7);_0x379eaf[_0xd68e('0x95')]=!![];if(!_[_0xd68e('0x96')](_0x596778)){_0x379eaf[_0xd68e('0x97')]=_[_0xd68e('0x18')](_0x379eaf[_0xd68e('0x97')],{'$and':[{'id':{'$in':_0x596778}}]});}else if(!_[_0xd68e('0x96')](_0x463fc7['query'][_0xd68e('0x8e')])){return _0x3f0a57;}if(_0x463fc7[_0xd68e('0x98')]['role']===_0xd68e('0x98')){var _0x51483e={'params':{'id':_0x463fc7[_0xd68e('0x98')][_0xd68e('0x99')]},'query':{'section':_0xd68e('0x14'),'role':_0xd68e('0x94'),'online':!![],'nolimit':_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x9a')],'sort':_0x463fc7[_0xd68e('0x8b')]['sort'],'filter':_0x463fc7['query']['filter'],'raw':!![],'ids':_0x596778}};return db[_0xd68e('0x9b')][_0xd68e('0x9c')](_0x51483e);}return db[_0xd68e('0x4b')][_0xd68e('0x9d')](_0x379eaf);})[_0xd68e('0x15')](function(_0x5d41ec){_0x3f0a57[_0xd68e('0xb')]=_0x5d41ec[_0xd68e('0xb')];_0x45b70f=_0x5d41ec[_0xd68e('0x9e')];return getRealtimeAgents();})[_0xd68e('0x15')](function(_0x1ae042){_0x582157=_0x1ae042[_0xd68e('0x9e')];return _0x45b70f[_0xd68e('0x64')](function(_0x462690){var _0x15eed9=_[_0xd68e('0x45')](_0x582157,['id',_0x462690['id']]);if(_0x15eed9)_['merge'](_0x462690,_[_0xd68e('0x3c')](_[_0xd68e('0x9f')](_0x15eed9,_0x1fa4b0),_0x4b6149));_0x462690['globalStatus']=getAgentStatus(_0x462690);return _0x462690;});})['then'](function(_0x20fe17){var _0x4bc199;if(_0x463fc7['query'][_0xd68e('0xa0')]){_0x4bc199=_[_0xd68e('0x3d')](_0x20fe17,[_0xd68e('0x6f'),_0x463fc7[_0xd68e('0x8b')][_0xd68e('0xa0')]]);if(_0x463fc7[_0xd68e('0x8b')]['pauseTypeFilter']){_0x4bc199=_['filter'](_0x4bc199,[_0xd68e('0x70'),_0x463fc7[_0xd68e('0x8b')][_0xd68e('0xa1')]]);}}if(_0x4bc199)_0x20fe17=_0x4bc199;if(!_0x4b330b)return _0x20fe17;return orderAgentsByStatus(_0x20fe17,_0x4b330b);})['then'](function(_0x33d61e){_0x3f0a57[_0xd68e('0x9e')]=_0x33d61e;return _0x3f0a57;})[_0xd68e('0x15')](respondWithFilteredResult(_0x46022f,_0x379eaf))[_0xd68e('0x19')](handleError(_0x46022f,null));};exports[_0xd68e('0xa2')]=function(_0x128e79,_0x269815){var _0x14f139={'count':0x0,'rows':[]},_0x2ed161={},_0x5f3da6,_0x44088a,_0x4519bb,_0x1e0c9a,_0x3c614d;Promise[_0xd68e('0x8a')]()['then'](function(){if(_0x128e79['query'][_0xd68e('0x8c')])_0x5f3da6=validateChannel(_0x128e79['query'][_0xd68e('0x8c')]);var _0x47982b=_['startCase'](_0x5f3da6)+'Queue';var _0x1f46ff=_['map'](db[_0x47982b]['rawAttributes'],function(_0x25b561){return{'name':_0x25b561[_0xd68e('0x90')],'type':_0x25b561[_0xd68e('0x91')][_0xd68e('0x92')]};});_0x2ed161=qs[_0xd68e('0xa3')](_0x1f46ff,_0x128e79);if(_0x128e79[_0xd68e('0x98')]['role']===_0xd68e('0x98')){var _0x30279e={'params':{'id':_0x128e79['user'][_0xd68e('0x99')]},'query':{'section':_0x5f3da6===_0xd68e('0x1a')&&_0x128e79['query']['type']===_0xd68e('0x27')?_0xd68e('0xa4'):_[_0xd68e('0x1b')](_0x5f3da6)+'Queues','type':_0x128e79[_0xd68e('0x8b')]['type'],'nolimit':!![],'sort':_0xd68e('0x11'),'filter':_0x128e79[_0xd68e('0x8b')][_0xd68e('0x3d')]}};return db[_0xd68e('0x9b')]['getResources'](_0x30279e);}return db[_0x47982b]['findAndCountAll'](_0x2ed161);})[_0xd68e('0x15')](function(_0x5cee90){_0x14f139[_0xd68e('0xb')]=_0x5cee90[_0xd68e('0xb')];_0x44088a=_0x5cee90['rows'];return getRealtimeQueues(_0x128e79,_0x5f3da6);})[_0xd68e('0x15')](function(_0x425ec8){_0x1e0c9a=_0x425ec8[_0xd68e('0x9e')];return getRealtimeAgents();})['then'](function(_0x53b046){_0x4519bb=_0x53b046['rows'];if(_0x5f3da6!=_0xd68e('0x1a'))return;return getRealtimeVoiceQueueChannels();})[_0xd68e('0x15')](function(_0x26afc8){_0x3c614d=_0x26afc8?_0x26afc8['rows']:[];return initializeQueues(_0x44088a,_0x1e0c9a,_0x5f3da6,_0x128e79[_0xd68e('0x8b')][_0xd68e('0x91')]);})[_0xd68e('0x15')](function(_0x4f953c){var _0xe61fc=_0x4f953c[_0xd68e('0x64')](function(_0x2f517b){if(_0x5f3da6==='voice')return getVoiceQueueAgents(_0x2f517b,_0x44088a,_0x4519bb,_0x3c614d);else return getQueueAgents(_0x2f517b,_0x4519bb,_0x5f3da6);});return Promise['all'](_0xe61fc);})[_0xd68e('0x15')](function(_0x53edde){_0x14f139[_0xd68e('0x9e')]=_0x53edde;return _0x14f139;})[_0xd68e('0x15')](respondWithFilteredResult(_0x269815,_0x2ed161))[_0xd68e('0x19')](handleError(_0x269815,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 6d574bf..4678428 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x411c2e,_0x4ece66){var _0x5ed361=function(_0x193b6c){while(--_0x193b6c){_0x411c2e['push'](_0x411c2e['shift']());}};_0x5ed361(++_0x4ece66);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2fb0cf,_0x24e884){var _0x4ebe3f=function(_0x347eb0){while(--_0x347eb0){_0x2fb0cf['push'](_0x2fb0cf['shift']());}};_0x4ebe3f(++_0x24e884);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 49f40d2..9e4cf57 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.attributes.js +++ b/server/api/reportAgentPreview/reportAgentPreview.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c63=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9c63,0x1a7));var _0x39c6=function(_0x5213d4,_0x4b8fb4){_0x5213d4=_0x5213d4-0x0;var _0x1f40cb=_0x9c63[_0x5213d4];return _0x1f40cb;};'use strict';var Sequelize=require(_0x39c6('0x0'));module[_0x39c6('0x1')]={'state':{'type':Sequelize[_0x39c6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x39c6('0x3')]},'scheduledat':{'type':Sequelize[_0x39c6('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x39c6('0x4')]},'responsetime':{'type':Sequelize[_0x39c6('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x39c6('0x3')]},'membername':{'type':Sequelize[_0x39c6('0x3')]}}; \ No newline at end of file +var _0xf360=['INTEGER','DATE','STRING','sequelize','exports'];(function(_0x5a331b,_0x2e1e09){var _0x35be6c=function(_0x17ccb1){while(--_0x17ccb1){_0x5a331b['push'](_0x5a331b['shift']());}};_0x35be6c(++_0x2e1e09);}(_0xf360,0x9e));var _0x0f36=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf360[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0f36('0x0'));module[_0x0f36('0x1')]={'state':{'type':Sequelize[_0x0f36('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0f36('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0f36('0x3')]},'responsetime':{'type':Sequelize[_0x0f36('0x3')]},'ringtime':{'type':Sequelize[_0x0f36('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0f36('0x4')]},'membername':{'type':Sequelize[_0x0f36('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 2258c89..1016334 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.model.js +++ b/server/api/reportAgentPreview/reportAgentPreview.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7908=['api','moment','request-promise','path','rimraf','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x333298,_0x5a6ea4){var _0x1762ad=function(_0x3bb6ad){while(--_0x3bb6ad){_0x333298['push'](_0x333298['shift']());}};_0x1762ad(++_0x5a6ea4);}(_0x7908,0xa5));var _0x8790=function(_0x3d4436,_0x252d86){_0x3d4436=_0x3d4436-0x0;var _0x4331dc=_0x7908[_0x3d4436];return _0x4331dc;};'use strict';var _=require(_0x8790('0x0'));var util=require(_0x8790('0x1'));var logger=require(_0x8790('0x2'))(_0x8790('0x3'));var moment=require(_0x8790('0x4'));var BPromise=require('bluebird');var rp=require(_0x8790('0x5'));var fs=require('fs');var path=require(_0x8790('0x6'));var rimraf=require(_0x8790('0x7'));var config=require('../../config/environment');var attributes=require(_0x8790('0x8'));module['exports']=function(_0x161c9f,_0xaa08f){return _0x161c9f[_0x8790('0x9')](_0x8790('0xa'),attributes,{'tableName':_0x8790('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb25a=['report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview'];(function(_0x1ddde3,_0x3a23cd){var _0x758f08=function(_0x59bbbb){while(--_0x59bbbb){_0x1ddde3['push'](_0x1ddde3['shift']());}};_0x758f08(++_0x3a23cd);}(_0xb25a,0xa6));var _0xab25=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb25a[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xab25('0x0'));var util=require(_0xab25('0x1'));var logger=require(_0xab25('0x2'))(_0xab25('0x3'));var moment=require(_0xab25('0x4'));var BPromise=require(_0xab25('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab25('0x6'));var config=require(_0xab25('0x7'));var attributes=require(_0xab25('0x8'));module['exports']=function(_0x3c95b6,_0x44cf67){return _0x3c95b6['define'](_0xab25('0x9'),attributes,{'tableName':_0xab25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index b0932af..e67fd56 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.rpc.js +++ b/server/api/reportAgentPreview/reportAgentPreview.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1138=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','debug','catch','util'];(function(_0x2ec7a3,_0x1e6156){var _0x4640a5=function(_0x5c6c6c){while(--_0x5c6c6c){_0x2ec7a3['push'](_0x2ec7a3['shift']());}};_0x4640a5(++_0x1e6156);}(_0x1138,0x8f));var _0x8113=function(_0x2668c6,_0x137307){_0x2668c6=_0x2668c6-0x0;var _0x2a284c=_0x1138[_0x2668c6];return _0x2a284c;};'use strict';var _=require('lodash');var util=require(_0x8113('0x0'));var moment=require(_0x8113('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8113('0x2'));var db=require(_0x8113('0x3'))['db'];var utils=require(_0x8113('0x4'));var logger=require('../../config/logger')(_0x8113('0x5'));var config=require(_0x8113('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8113('0x7')][_0x8113('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23bc9e,_0x48578d,_0x4aff83){return new BPromise(function(_0x269052,_0x2b52ef){return client['request'](_0x23bc9e,_0x4aff83)[_0x8113('0x9')](function(_0x1475aa){logger[_0x8113('0xa')](_0x8113('0xb'),_0x48578d,_0x8113('0xc'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x48578d,_0x8113('0xc'),JSON[_0x8113('0xd')](_0x1475aa));if(_0x1475aa['error']){if(_0x1475aa[_0x8113('0xe')]['code']===0x1f4){logger['error'](_0x8113('0xb'),_0x48578d,_0x1475aa[_0x8113('0xe')]['message']);return _0x2b52ef(_0x1475aa[_0x8113('0xe')][_0x8113('0xf')]);}logger[_0x8113('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x48578d,_0x1475aa[_0x8113('0xe')]['message']);return _0x269052(_0x1475aa[_0x8113('0xe')]['message']);}else{logger['info'](_0x8113('0xb'),_0x48578d,_0x8113('0xc'));_0x269052(_0x1475aa[_0x8113('0x10')]['message']);}})['catch'](function(_0x4513d7){logger[_0x8113('0xe')](_0x8113('0xb'),_0x48578d,_0x4513d7);_0x2b52ef(_0x4513d7);});});}exports[_0x8113('0x11')]=function(_0x575992){var _0x4fd940=this;return new Promise(function(_0x32653f,_0x1dc1d1){return db[_0x8113('0x12')][_0x8113('0x13')](_0x575992[_0x8113('0x14')],{'raw':_0x575992['options']?_0x575992[_0x8113('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3caa8e){logger['info']('CreateReportAgentPreview',_0x575992);logger[_0x8113('0x16')](_0x8113('0x11'),_0x575992,JSON[_0x8113('0xd')](_0x3caa8e));_0x32653f(_0x3caa8e);})[_0x8113('0x17')](function(_0x3577c9){logger['error'](_0x8113('0x11'),_0x3577c9[_0x8113('0xf')],_0x575992);_0x1dc1d1(_0x4fd940[_0x8113('0xe')](0x1f4,_0x3577c9[_0x8113('0xf')]));});});}; \ No newline at end of file +var _0x1c72=['../../config/environment','jayson/promise','client','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x2ec9c6,_0x2c32b1){var _0x10561e=function(_0x20cb29){while(--_0x20cb29){_0x2ec9c6['push'](_0x2ec9c6['shift']());}};_0x10561e(++_0x2c32b1);}(_0x1c72,0x65));var _0x21c7=function(_0x3866cc,_0x1e8dca){_0x3866cc=_0x3866cc-0x0;var _0x2310a3=_0x1c72[_0x3866cc];return _0x2310a3;};'use strict';var _=require(_0x21c7('0x0'));var util=require(_0x21c7('0x1'));var moment=require(_0x21c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x21c7('0x3'));var fs=require('fs');var Redis=require(_0x21c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x21c7('0x5'))(_0x21c7('0x6'));var config=require(_0x21c7('0x7'));var jayson=require(_0x21c7('0x8'));var client=jayson[_0x21c7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f5323,_0x37bc96,_0xd5b076){return new BPromise(function(_0x2c449a,_0x4b92f7){return client[_0x21c7('0xa')](_0x4f5323,_0xd5b076)[_0x21c7('0xb')](function(_0x1c73b7){logger['info'](_0x21c7('0xc'),_0x37bc96,_0x21c7('0xd'));logger[_0x21c7('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x37bc96,_0x21c7('0xd'),JSON[_0x21c7('0xf')](_0x1c73b7));if(_0x1c73b7[_0x21c7('0x10')]){if(_0x1c73b7[_0x21c7('0x10')][_0x21c7('0x11')]===0x1f4){logger[_0x21c7('0x10')](_0x21c7('0xc'),_0x37bc96,_0x1c73b7[_0x21c7('0x10')][_0x21c7('0x12')]);return _0x4b92f7(_0x1c73b7[_0x21c7('0x10')][_0x21c7('0x12')]);}logger[_0x21c7('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x37bc96,_0x1c73b7['error'][_0x21c7('0x12')]);return _0x2c449a(_0x1c73b7[_0x21c7('0x10')][_0x21c7('0x12')]);}else{logger[_0x21c7('0x13')](_0x21c7('0xc'),_0x37bc96,_0x21c7('0xd'));_0x2c449a(_0x1c73b7[_0x21c7('0x14')][_0x21c7('0x12')]);}})[_0x21c7('0x15')](function(_0x5aa2f4){logger[_0x21c7('0x10')](_0x21c7('0xc'),_0x37bc96,_0x5aa2f4);_0x4b92f7(_0x5aa2f4);});});}exports[_0x21c7('0x16')]=function(_0x2fff71){var _0x20d717=this;return new Promise(function(_0x282a33,_0x8cd5a8){return db[_0x21c7('0x17')][_0x21c7('0x18')](_0x2fff71['body'],{'raw':_0x2fff71[_0x21c7('0x19')]?_0x2fff71[_0x21c7('0x19')][_0x21c7('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1be7e9){logger[_0x21c7('0x13')](_0x21c7('0x16'),_0x2fff71);logger[_0x21c7('0xe')]('CreateReportAgentPreview',_0x2fff71,JSON['stringify'](_0x1be7e9));_0x282a33(_0x1be7e9);})['catch'](function(_0x5ddc15){logger['error'](_0x21c7('0x16'),_0x5ddc15[_0x21c7('0x12')],_0x2fff71);_0x8cd5a8(_0x20d717['error'](0x1f4,_0x5ddc15[_0x21c7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c5ba880..a673cab 100644 --- a/server/api/rpc/index.js +++ b/server/api/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48af=['/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound/channels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','util','path','express','Router','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues'];(function(_0x4cc03b,_0x299f1c){var _0xf0358c=function(_0x3d0da8){while(--_0x3d0da8){_0x4cc03b['push'](_0x4cc03b['shift']());}};_0xf0358c(++_0x299f1c);}(_0x48af,0x95));var _0xf48a=function(_0xf8769b,_0xb5b74e){_0xf8769b=_0xf8769b-0x0;var _0x197c18=_0x48af[_0xf8769b];return _0x197c18;};'use strict';var multer=require(_0xf48a('0x0'));var util=require(_0xf48a('0x1'));var path=require(_0xf48a('0x2'));var express=require(_0xf48a('0x3'));var router=express[_0xf48a('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0xf48a('0x5'));router['get'](_0xf48a('0x6'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x8')]);router[_0xf48a('0x9')](_0xf48a('0xa'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xf48a('0x9')](_0xf48a('0xb'),auth['isAuthenticated'](),controller[_0xf48a('0xc')]);router['get'](_0xf48a('0xd'),auth[_0xf48a('0x7')](),controller[_0xf48a('0xe')]);router[_0xf48a('0x9')](_0xf48a('0xf'),auth[_0xf48a('0x7')](),controller['chatQueues']);router[_0xf48a('0x9')]('/mail/queues',auth[_0xf48a('0x7')](),controller['mailQueues']);router[_0xf48a('0x9')](_0xf48a('0x10'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x11')]);router['get'](_0xf48a('0x12'),auth['isAuthenticated'](),controller[_0xf48a('0x13')]);router[_0xf48a('0x9')](_0xf48a('0x14'),auth[_0xf48a('0x7')](),controller['smsQueues']);router[_0xf48a('0x9')](_0xf48a('0x15'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x16')]);router[_0xf48a('0x9')](_0xf48a('0x17'),auth['isAuthenticated'](),controller[_0xf48a('0x18')]);router[_0xf48a('0x9')](_0xf48a('0x19'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x1a')]);router['get'](_0xf48a('0x1b'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x1c')]);router['get'](_0xf48a('0x1d'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x1e')]);router[_0xf48a('0x9')](_0xf48a('0x1f'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x20')]);router[_0xf48a('0x9')](_0xf48a('0x21'),auth['isAuthenticated'](),controller[_0xf48a('0x22')]);router['get'](_0xf48a('0x23'),auth['isAuthenticated'](),controller[_0xf48a('0x24')]);router['put'](_0xf48a('0x23'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x25')]);router[_0xf48a('0x9')]('/outbound',auth[_0xf48a('0x7')](),controller['outbound']);router[_0xf48a('0x9')](_0xf48a('0x26'),auth[_0xf48a('0x7')](),controller['outboundChannels']);router[_0xf48a('0x9')]('/agents',auth[_0xf48a('0x7')](),controller[_0xf48a('0x27')]);router[_0xf48a('0x28')](_0xf48a('0x29'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x2a')]);router[_0xf48a('0x9')](_0xf48a('0x2b'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x2c')]);router['get']('/trunks',auth[_0xf48a('0x7')](),controller[_0xf48a('0x2d')]);router[_0xf48a('0x9')]('/campaigns',auth[_0xf48a('0x7')](),controller[_0xf48a('0x2e')]);router[_0xf48a('0x9')](_0xf48a('0x2f'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x30')]);router[_0xf48a('0x9')](_0xf48a('0x31'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x32')]);router['get']('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xf48a('0x33')]);router[_0xf48a('0x9')](_0xf48a('0x34'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x35')]);router[_0xf48a('0x9')](_0xf48a('0x36'),auth[_0xf48a('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xf48a('0x9')](_0xf48a('0x37'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x38')]);router['get'](_0xf48a('0x39'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x3a')]);router[_0xf48a('0x9')]('/fax/queues/waitinginteractions',auth[_0xf48a('0x7')](),controller[_0xf48a('0x3b')]);router[_0xf48a('0x3c')]('/mail/queues/:id/notify',auth[_0xf48a('0x7')](),controller[_0xf48a('0x3d')](_0xf48a('0x3e')));router[_0xf48a('0x9')](_0xf48a('0x3f'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x40')]);router['post'](_0xf48a('0x41'),auth['isAuthenticated'](),controller['queueNotify'](_0xf48a('0x42')));router['get'](_0xf48a('0x43'),auth[_0xf48a('0x7')](),controller['showChatQueues']);router['post'](_0xf48a('0x44'),auth['isAuthenticated'](),controller[_0xf48a('0x3d')](_0xf48a('0x45')));router[_0xf48a('0x9')](_0xf48a('0x46'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x47')]);router[_0xf48a('0x3c')](_0xf48a('0x48'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x3d')](_0xf48a('0x49')));router['get'](_0xf48a('0x4a'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x4b')]);router[_0xf48a('0x3c')](_0xf48a('0x4c'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x3d')](_0xf48a('0x4d')));router[_0xf48a('0x3c')](_0xf48a('0x4e'),auth['isAuthenticated'](),controller['queueNotify'](_0xf48a('0x4f')));router[_0xf48a('0x9')](_0xf48a('0x50'),auth[_0xf48a('0x7')](),controller[_0xf48a('0x51')]);router[_0xf48a('0x9')](_0xf48a('0x52'),auth['isAuthenticated'](),controller[_0xf48a('0x53')]);router['post'](_0xf48a('0x54'),auth['isAuthenticated'](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x4c9c=['/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','Router','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x4c9c,0x12e));var _0xc4c9=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0x4c9c[_0x1443eb];return _0x2b8810;};'use strict';var multer=require(_0xc4c9('0x0'));var util=require(_0xc4c9('0x1'));var path=require(_0xc4c9('0x2'));var express=require(_0xc4c9('0x3'));var router=express[_0xc4c9('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0xc4c9('0x5'));router[_0xc4c9('0x6')](_0xc4c9('0x7'),auth['isAuthenticated'](),controller[_0xc4c9('0x8')]);router[_0xc4c9('0x6')](_0xc4c9('0x9'),auth['isAuthenticated'](),controller[_0xc4c9('0xa')]);router[_0xc4c9('0x6')](_0xc4c9('0xb'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0xd')]);router[_0xc4c9('0x6')](_0xc4c9('0xe'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0xc4c9('0x6')](_0xc4c9('0xf'),auth[_0xc4c9('0xc')](),controller['chatQueues']);router[_0xc4c9('0x6')]('/mail/queues',auth['isAuthenticated'](),controller[_0xc4c9('0x10')]);router[_0xc4c9('0x6')](_0xc4c9('0x11'),auth[_0xc4c9('0xc')](),controller['mailAccounts']);router['get'](_0xc4c9('0x12'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x13')]);router[_0xc4c9('0x6')](_0xc4c9('0x14'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x15')]);router[_0xc4c9('0x6')](_0xc4c9('0x16'),auth['isAuthenticated'](),controller[_0xc4c9('0x17')]);router[_0xc4c9('0x6')](_0xc4c9('0x18'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x19')]);router[_0xc4c9('0x6')](_0xc4c9('0x1a'),auth[_0xc4c9('0xc')](),controller['voiceQueuesPreview']);router['get'](_0xc4c9('0x1b'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x1c')]);router[_0xc4c9('0x6')](_0xc4c9('0x1d'),auth[_0xc4c9('0xc')](),controller['voiceQueuesChannel']);router['get'](_0xc4c9('0x1e'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x1f')]);router['get'](_0xc4c9('0x20'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x21')]);router[_0xc4c9('0x6')](_0xc4c9('0x22'),auth['isAuthenticated'](),controller[_0xc4c9('0x23')]);router[_0xc4c9('0x24')](_0xc4c9('0x22'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x25')]);router['get'](_0xc4c9('0x26'),auth['isAuthenticated'](),controller[_0xc4c9('0x27')]);router['get'](_0xc4c9('0x28'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x29')]);router[_0xc4c9('0x6')](_0xc4c9('0x2a'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x2b')]);router[_0xc4c9('0x24')](_0xc4c9('0x2c'),auth['isAuthenticated'](),controller[_0xc4c9('0x2d')]);router[_0xc4c9('0x6')](_0xc4c9('0x2e'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x2f')]);router[_0xc4c9('0x6')]('/trunks',auth['isAuthenticated'](),controller[_0xc4c9('0x30')]);router[_0xc4c9('0x6')](_0xc4c9('0x31'),auth['isAuthenticated'](),controller['campaigns']);router[_0xc4c9('0x6')](_0xc4c9('0x32'),auth['isAuthenticated'](),controller[_0xc4c9('0x33')]);router['get'](_0xc4c9('0x34'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x35')]);router[_0xc4c9('0x6')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xc4c9('0x6')]('/openchannel/queues/waitinginteractions',auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x36')]);router[_0xc4c9('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x37')]);router['get'](_0xc4c9('0x38'),auth[_0xc4c9('0xc')](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x39')]);router[_0xc4c9('0x6')](_0xc4c9('0x3a'),auth['isAuthenticated'](),controller[_0xc4c9('0x3b')]);router['post'](_0xc4c9('0x3c'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x3d')]('mail'));router[_0xc4c9('0x6')](_0xc4c9('0x3e'),auth[_0xc4c9('0xc')](),controller['showMailQueues']);router[_0xc4c9('0x3f')](_0xc4c9('0x40'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x3d')](_0xc4c9('0x41')));router[_0xc4c9('0x6')](_0xc4c9('0x42'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x43')]);router['post'](_0xc4c9('0x44'),auth['isAuthenticated'](),controller[_0xc4c9('0x3d')](_0xc4c9('0x45')));router[_0xc4c9('0x6')](_0xc4c9('0x46'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x47')]);router[_0xc4c9('0x3f')](_0xc4c9('0x48'),auth['isAuthenticated'](),controller['queueNotify'](_0xc4c9('0x49')));router[_0xc4c9('0x6')](_0xc4c9('0x4a'),auth[_0xc4c9('0xc')](),controller['showOpenchannelQueues']);router[_0xc4c9('0x3f')](_0xc4c9('0x4b'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x3d')](_0xc4c9('0x4c')));router['post'](_0xc4c9('0x4d'),auth['isAuthenticated'](),controller[_0xc4c9('0x3d')]('whatsapp'));router['get']('/sms/queues/:id',auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x4e')]);router[_0xc4c9('0x6')](_0xc4c9('0x4f'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x50')]);router[_0xc4c9('0x3f')](_0xc4c9('0x51'),auth[_0xc4c9('0xc')](),controller['agentNotify']);module[_0xc4c9('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5e65739..f9af337 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','User','\x20Message\x20not\x20found','Start','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','status','json','sendStatus','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','format','length','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions'];(function(_0x17b8d4,_0x42d966){var _0x1f182e=function(_0x3e0801){while(--_0x3e0801){_0x17b8d4['push'](_0x17b8d4['shift']());}};_0x1f182e(++_0x42d966);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x5fc3[_0x4358f5];return _0x4d8104;};'use strict';var BPromise=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));var _=require('lodash');var util=require(_0x35fc('0x2'));var db=require(_0x35fc('0x3'))['db'];var logger=require(_0x35fc('0x4'))(_0x35fc('0x5'));var jayson=require(_0x35fc('0x6'));var amiClient=jayson['client'][_0x35fc('0x7')]({'port':0x232a});var mailClient=jayson[_0x35fc('0x8')][_0x35fc('0x7')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){var _0x1e5f90=_0x16e153?_0x16e153:amiClient;return _0x1e5f90[_0x35fc('0x9')](_0x19a0d1,_0x508b32)[_0x35fc('0xa')](function(_0x2051ab){if(_0x2051ab['error']){if(_0x2051ab[_0x35fc('0xb')][_0x35fc('0xc')]===0x1f4){return _0xc72d93(_0x2051ab['error'][_0x35fc('0xd')]);}return _0x27524f(_0x2051ab[_0x35fc('0xb')]['message']);}else{_0x27524f(_0x2051ab[_0x35fc('0xe')]);}})[_0x35fc('0xf')](function(_0x5469f5){_0xc72d93(_0x5469f5);});});}function respondWithResult(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xc8;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x10')](_0x409357)[_0x35fc('0x11')](_0x5d462a);}return _0x4cbe74[_0x35fc('0x12')](0x194);};}function handleError(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0x1f4;return function(_0x5cfe94){logger['error'](_0x5cfe94['stack']);if(_0x5cfe94['name']){delete _0x5cfe94[_0x35fc('0x13')];}_0x29730f[_0x35fc('0x10')](_0x38d9f2)[_0x35fc('0x14')](_0x5cfe94);};}function findById(_0x154958){return function(_0x227a49){if(!_[_0x35fc('0x15')](_0x154958)&&!_['isNil'](_0x227a49)&&!_[_0x35fc('0x15')](_0x227a49[_0x35fc('0x16')])){return _['find'](_0x227a49[_0x35fc('0x16')],function(_0x363e47){return _0x363e47['id']==_0x154958;});}return null;};}exports[_0x35fc('0x17')]=function(_0x5f56c6,_0x1a86e9){return respondWithRpcPromise(_0x35fc('0x18'),_0x5f56c6[_0x35fc('0x19')])['then'](respondWithResult(_0x1a86e9,null))[_0x35fc('0xf')](handleError(_0x1a86e9,null));};exports[_0x35fc('0x1a')]=function(_0x3229d1,_0x251a1f){return respondWithRpcPromise(_0x35fc('0x1b'),_[_0x35fc('0x1c')](_0x3229d1[_0x35fc('0x19')],_0x3229d1[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x251a1f,null))[_0x35fc('0xf')](handleError(_0x251a1f,null));};exports['voiceChannelStopMixMonitor']=function(_0x323aee,_0xd5399f){return respondWithRpcPromise(_0x35fc('0x1e'),_[_0x35fc('0x1c')](_0x323aee[_0x35fc('0x19')],_0x323aee['params']))[_0x35fc('0xa')](respondWithResult(_0xd5399f,null))[_0x35fc('0xf')](handleError(_0xd5399f,null));};exports['voiceQueues']=function(_0x265324,_0x5a93df){return respondWithRpcPromise(_0x35fc('0x1f'),_0x265324['query'])[_0x35fc('0xa')](respondWithResult(_0x5a93df,null))['catch'](handleError(_0x5a93df,null));};exports[_0x35fc('0x20')]=function(_0xdfab9f,_0x5cb986){return respondWithRpcPromise('VoiceQueues',_0xdfab9f[_0x35fc('0x19')])['then'](findById(_0xdfab9f[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x5cb986,null))['catch'](handleError(_0x5cb986,null));};exports[_0x35fc('0x21')]=function(_0x645eac,_0x383837){return respondWithRpcPromise(_0x35fc('0x22'),_[_0x35fc('0x1c')](_0x645eac[_0x35fc('0x23')],_0x645eac[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x383837,null))['catch'](handleError(_0x383837,null));};exports[_0x35fc('0x24')]=function(_0x220931,_0x22af18){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x35fc('0x1c')](_0x220931[_0x35fc('0x19')],_0x220931[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x22af18,null))[_0x35fc('0xf')](handleError(_0x22af18,null));};exports[_0x35fc('0x25')]=function(_0x222ddb,_0x37b435){return respondWithRpcPromise(_0x35fc('0x26'),_0x222ddb[_0x35fc('0x19')])['then'](respondWithResult(_0x37b435,null))['catch'](handleError(_0x37b435,null));};exports[_0x35fc('0x27')]=function(_0x4af5fe,_0x37b394){return respondWithRpcPromise(_0x35fc('0x28'),_[_0x35fc('0x1c')](_0x4af5fe[_0x35fc('0x19')],_0x4af5fe[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x37b394,null))['catch'](handleError(_0x37b394,null));};exports[_0x35fc('0x29')]=function(_0x330a14,_0x46b9ef){return respondWithRpcPromise(_0x35fc('0x2a'),_[_0x35fc('0x1c')](_0x330a14[_0x35fc('0x19')],_0x330a14['params']))[_0x35fc('0xa')](respondWithResult(_0x46b9ef,null))[_0x35fc('0xf')](handleError(_0x46b9ef,null));};exports[_0x35fc('0x2b')]=function(_0x52f53d,_0x2c657d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x35fc('0x1c')](_0x52f53d[_0x35fc('0x19')],_0x52f53d[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x2c657d,null))['catch'](handleError(_0x2c657d,null));};exports['outbound']=function(_0x59e4fb,_0x20f5fe){return respondWithRpcPromise('Outbound',_0x59e4fb[_0x35fc('0x19')])['then'](respondWithResult(_0x20f5fe,null))[_0x35fc('0xf')](handleError(_0x20f5fe,null));};exports[_0x35fc('0x2c')]=function(_0x2ca9ac,_0x22b724){return respondWithRpcPromise(_0x35fc('0x2d'),_0x2ca9ac[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x22b724,null))['catch'](handleError(_0x22b724,null));};exports[_0x35fc('0x2e')]=function(_0x16087d,_0x4e0ce3){var _0x1feda5;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d[_0x35fc('0x19')])[_0x35fc('0xa')](function(_0x813866){_0x1feda5=_0x813866;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d['query'],routingClient);})[_0x35fc('0xa')](function(_0x267858){return _[_0x35fc('0x1c')]({},_0x267858,_0x1feda5);})['then'](respondWithResult(_0x4e0ce3,null))[_0x35fc('0xf')](handleError(_0x4e0ce3,null));};exports[_0x35fc('0x30')]=function(_0x596919,_0x237548){if(_0x596919[_0x35fc('0x23')]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]&&_0x596919[_0x35fc('0x32')]&&_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]){for(var _0x3ec51f in _0x596919['body']['interaction']){if(_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]['hasOwnProperty'](_0x3ec51f)){db['MemberReport']['findAll']({'where':{'channel':_0x3ec51f,'membername':_0x596919[_0x35fc('0x32')][_0x35fc('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length']?{'$notIn':_0x596919['body']['interaction'][_0x3ec51f]}:{'$ne':null}}})['then'](function(_0x56bdb9){var _0xb26e3f=moment()[_0x35fc('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x119925=0x0,_0x56cf1f=_0x56bdb9[_0x35fc('0x34')];_0x119925<_0x56cf1f;_0x119925+=0x1){_0x56bdb9[_0x119925][_0x35fc('0x35')]({'exitAt':_0xb26e3f});}});for(var _0x350237=0x0;_0x350237<_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length'];_0x350237+=0x1){db[_0x35fc('0x36')][_0x35fc('0x37')]({'where':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'type':_0x35fc('0x38'),'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237],'exitAt':null},'defaults':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'interface':_['isNil'](_0x596919['user'][_0x35fc('0x39')])?util[_0x35fc('0x33')](_0x35fc('0x3a'),_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]):_0x596919[_0x35fc('0x32')][_0x35fc('0x39')],'type':_0x35fc('0x38'),'enterAt':moment()['format'](_0x35fc('0x3b')),'role':_0x35fc('0x3c'),'internal':_0x596919[_0x35fc('0x32')][_0x35fc('0x3d')],'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237]}});}}}}return respondWithRpcPromise(_0x35fc('0x3e'),{'id':_0x596919[_0x35fc('0x1d')]['id'],'capacity':_0x596919[_0x35fc('0x23')][_0x35fc('0x3f')]},routingClient)[_0x35fc('0xa')](respondWithResult(_0x237548,null))[_0x35fc('0xf')](handleError(_0x237548,null));};exports[_0x35fc('0x40')]=function(_0x3146e2,_0x59c666){return respondWithRpcPromise('Telephones',_0x3146e2[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x59c666,null))[_0x35fc('0xf')](handleError(_0x59c666,null));};exports[_0x35fc('0x41')]=function(_0x3ee296,_0x3e6494){return respondWithRpcPromise('Trunks',_0x3ee296['query'])[_0x35fc('0xa')](respondWithResult(_0x3e6494,null))[_0x35fc('0xf')](handleError(_0x3e6494,null));};exports[_0x35fc('0x42')]=function(_0x38bc78,_0x5b2595){return respondWithRpcPromise(_0x35fc('0x43'),_0x38bc78[_0x35fc('0x19')])['then'](respondWithResult(_0x5b2595,null))[_0x35fc('0xf')](handleError(_0x5b2595,null));};exports[_0x35fc('0x44')]=function(_0x590faa,_0x3e12e4){return respondWithRpcPromise(_0x35fc('0x45'),_0x590faa[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x3e12e4,null))['catch'](handleError(_0x3e12e4,null));};exports['showChatQueues']=function(_0x502a15,_0x240338){return respondWithRpcPromise(_0x35fc('0x45'),_0x502a15['query'],routingClient)[_0x35fc('0xa')](findById(_0x502a15[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x240338,null))[_0x35fc('0xf')](handleError(_0x240338,null));};exports[_0x35fc('0x46')]=function(_0x538be0,_0x2d9d45){return respondWithRpcPromise(_0x35fc('0x47'),_0x538be0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x2d9d45,null))[_0x35fc('0xf')](handleError(_0x2d9d45,null));};exports[_0x35fc('0x48')]=function(_0x47fb1a,_0x35a676){return respondWithRpcPromise(_0x35fc('0x47'),_0x47fb1a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x47fb1a[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x35a676,null))[_0x35fc('0xf')](handleError(_0x35a676,null));};exports[_0x35fc('0x49')]=function(_0x53a79d,_0x10a5b8){return respondWithRpcPromise(_0x35fc('0x4a'),_0x53a79d[_0x35fc('0x19')],mailClient)['then'](respondWithResult(_0x10a5b8,null))[_0x35fc('0xf')](handleError(_0x10a5b8,null));};exports['openchannelQueues']=function(_0x4ceacc,_0x5d4a39){return respondWithRpcPromise(_0x35fc('0x4b'),_0x4ceacc[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x5d4a39,null))[_0x35fc('0xf')](handleError(_0x5d4a39,null));};exports[_0x35fc('0x4c')]=function(_0x4bbea0,_0x579f5a){return respondWithRpcPromise('OpenchannelQueues',_0x4bbea0['query'],routingClient)['then'](findById(_0x4bbea0[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x579f5a,null))[_0x35fc('0xf')](handleError(_0x579f5a,null));};exports[_0x35fc('0x4d')]=function(_0x511e8b,_0x458eb8){return respondWithRpcPromise(_0x35fc('0x4e'),_0x511e8b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x458eb8,null))[_0x35fc('0xf')](handleError(_0x458eb8,null));};exports[_0x35fc('0x4f')]=function(_0x27071b,_0x2127e0){return respondWithRpcPromise(_0x35fc('0x4e'),_0x27071b['query'],routingClient)[_0x35fc('0xa')](findById(_0x27071b['params']['id']))[_0x35fc('0xa')](respondWithResult(_0x2127e0,null))[_0x35fc('0xf')](handleError(_0x2127e0,null));};exports[_0x35fc('0x50')]=function(_0x2bc76c,_0x4bdde7){return respondWithRpcPromise(_0x35fc('0x51'),_0x2bc76c['query'],routingClient)['then'](respondWithResult(_0x4bdde7,null))['catch'](handleError(_0x4bdde7,null));};exports[_0x35fc('0x52')]=function(_0x5dfeb7,_0x3c9027){return respondWithRpcPromise('WhatsappQueues',_0x5dfeb7[_0x35fc('0x19')],routingClient)['then'](findById(_0x5dfeb7[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x3c9027,null))[_0x35fc('0xf')](handleError(_0x3c9027,null));};exports[_0x35fc('0x53')]=function(_0x5c2ec0,_0x3d0ecc){return respondWithRpcPromise(_0x35fc('0x54'),_0x5c2ec0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x3d0ecc,null))[_0x35fc('0xf')](handleError(_0x3d0ecc,null));};exports[_0x35fc('0x55')]=function(_0x37764b,_0x3c1b56){return respondWithRpcPromise(_0x35fc('0x54'),_0x37764b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x37764b[_0x35fc('0x1d')]['id']))['then'](respondWithResult(_0x3c1b56,null))[_0x35fc('0xf')](handleError(_0x3c1b56,null));};exports[_0x35fc('0x56')]=function(_0x2600d2,_0x4a926d){return respondWithRpcPromise(_0x35fc('0x57'),_0x2600d2[_0x35fc('0x19')])['then'](respondWithResult(_0x4a926d,null))['catch'](handleError(_0x4a926d,null));};exports[_0x35fc('0x58')]=function(_0x4835c2,_0x223ad3){return respondWithRpcPromise(_0x35fc('0x59'),_0x4835c2[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x223ad3,null))[_0x35fc('0xf')](handleError(_0x223ad3,null));};exports[_0x35fc('0x5a')]=function(_0x13f602,_0x104b1d){return respondWithRpcPromise(_0x35fc('0x5b'),_0x13f602[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x104b1d,null))[_0x35fc('0xf')](handleError(_0x104b1d,null));};exports[_0x35fc('0x5c')]=function(_0x9f034e,_0x184f28){return respondWithRpcPromise(_0x35fc('0x5d'),_0x9f034e[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x184f28,null))[_0x35fc('0xf')](handleError(_0x184f28,null));};exports[_0x35fc('0x5e')]=function(_0x4ba1b0,_0x1797d0){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4ba1b0[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](function(_0x2185ce){if(_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')]!==undefined){var _0x3f56f4=_(_0x2185ce[_0x35fc('0x16')])[_0x35fc('0x60')]([_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')],_0x4ba1b0[_0x35fc('0x1d')]['id']])['map'](_0x35fc('0x61'))[_0x35fc('0x62')]()[_0x35fc('0x63')]();return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x41a6de){return _0x3f56f4['indexOf'](_0x41a6de[_0x35fc('0x61')])>-0x1;});}else{return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x23206d){return _0x23206d[_0x35fc('0x61')]===parseInt(_0x4ba1b0[_0x35fc('0x1d')]['id']);});}})[_0x35fc('0xa')](respondWithResult(_0x1797d0,null))[_0x35fc('0xf')](handleError(_0x1797d0,null));};exports[_0x35fc('0x64')]=function(_0x5f23d8,_0x28f02b){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x5f23d8[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x28f02b,null))['catch'](handleError(_0x28f02b,null));};exports[_0x35fc('0x65')]=function(_0x41002a,_0xcaa49){return respondWithRpcPromise(_0x35fc('0x66'),_0x41002a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0xcaa49,null))[_0x35fc('0xf')](handleError(_0xcaa49,null));};exports[_0x35fc('0x67')]=function(_0x25ee61,_0x5806bf){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x25ee61['query'],routingClient)['then'](respondWithResult(_0x5806bf,null))[_0x35fc('0xf')](handleError(_0x5806bf,null));};exports[_0x35fc('0x68')]=function(_0x8fc410){return function(_0x1f5cbc,_0x35ef53){var _0x4f535a,_0x226fdf;var _0x19682e=_[_0x35fc('0x69')](_0x8fc410);var _0x169ea2=_0x8fc410==='chat'?_0x35fc('0x6a'):_0x35fc('0x6b');return db[_0x19682e+_0x35fc('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x1f5cbc[_0x35fc('0x1d')]['id']}})[_0x35fc('0xa')](function(_0x319033){if(_[_0x35fc('0x15')](_0x319033)){throw new Error(_0x19682e+_0x35fc('0x6d'));}_0x4f535a=_0x319033;return db[_0x19682e+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x1f5cbc[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x19682e+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x19682e+_0x169ea2],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x221c5b){if(_[_0x35fc('0x15')](_0x221c5b)){throw new Error(_0x19682e+'\x20Message\x20not\x20found');}_0x226fdf=_0x221c5b;return _0x221c5b[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4855ee={'uniqueid':_0x8fc410+'.'+_0x226fdf['id']+'.'+_0x226fdf[_0x35fc('0x70')]['id'],'FromUserId':_0x1f5cbc['user']['id'],'type':_0x35fc('0x72')};_0x4855ee[_0x19682e+_0x35fc('0x73')]=_0x226fdf['id'];_0x4855ee[_0x19682e+_0x35fc('0x74')]=_0x226fdf['Interaction']['id'];_0x4855ee[_0x35fc('0x75')+_0x19682e+_0x169ea2+'Id']=_0x226fdf[_0x35fc('0x6b')]['id'];_0x4855ee['To'+_0x19682e+_0x35fc('0x76')]=_0x4f535a['id'];return db[_0x19682e+_0x35fc('0x77')][_0x35fc('0x78')](_0x4855ee);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x8fc410,'interaction':_0x226fdf['Interaction'],'message':_0x226fdf,'account':_0x226fdf[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f535a[_0x35fc('0x13')]+','+(_0x226fdf[_0x35fc('0x6b')][_0x35fc('0x79')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})['then'](respondWithResult(_0x35ef53,null))[_0x35fc('0xf')](handleError(_0x35ef53,null));};};exports[_0x35fc('0x7b')]=function(_0x312827,_0x47c507){var _0x128286,_0x175cc7;if(_[_0x35fc('0x15')](_0x312827['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x32b9e1=_0x312827[_0x35fc('0x23')][_0x35fc('0x7c')];var _0x3858a9=_['capitalize'](_0x32b9e1);var _0x3ead4e=_0x32b9e1===_0x35fc('0x7d')?'Website':'Account';return db[_0x35fc('0x7e')][_0x35fc('0x6f')]({'raw':!![],'where':{'id':_0x312827[_0x35fc('0x1d')]['id'],'role':'agent'}})['then'](function(_0x134e60){if(_[_0x35fc('0x15')](_0x134e60)){throw new Error('Agent\x20not\x20found');}_0x128286=_0x134e60;return db[_0x3858a9+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x312827[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x3858a9+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x3858a9+_0x3ead4e],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x4fd676){if(_[_0x35fc('0x15')](_0x4fd676)){throw new Error(_0x3858a9+_0x35fc('0x7f'));}_0x175cc7=_0x4fd676;return _0x4fd676[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x96dfc={'uniqueid':_0x32b9e1+'.'+_0x175cc7['id']+'.'+_0x175cc7[_0x35fc('0x70')]['id'],'FromUserId':_0x312827[_0x35fc('0x32')]['id'],'type':'queue','ToUserId':_0x128286['id']};_0x96dfc[_0x3858a9+_0x35fc('0x73')]=_0x175cc7['id'];_0x96dfc[_0x3858a9+_0x35fc('0x74')]=_0x175cc7['Interaction']['id'];_0x96dfc[_0x35fc('0x75')+_0x3858a9+_0x3ead4e+'Id']=_0x175cc7[_0x35fc('0x6b')]['id'];return db[_0x3858a9+_0x35fc('0x77')][_0x35fc('0x78')](_0x96dfc);})[_0x35fc('0xa')](function(){return respondWithRpcPromise(_0x35fc('0x80'),{'channel':_0x32b9e1,'interaction':_0x175cc7[_0x35fc('0x70')],'message':_0x175cc7,'account':_0x175cc7[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x35fc('0x3c'),'appdata':_0x128286['name']+','+(_0x175cc7[_0x35fc('0x6b')][_0x35fc('0x81')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})[_0x35fc('0xa')](respondWithResult(_0x47c507,null))['catch'](handleError(_0x47c507,null));}; \ No newline at end of file +var _0x6f47=['voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','agent','internal','telephones','trunks','Trunks','Campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','create','moment','lodash','../../mysqldb','api','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel'];(function(_0x29999b,_0x17b831){var _0x53e75a=function(_0x1f6d63){while(--_0x1f6d63){_0x29999b['push'](_0x29999b['shift']());}};_0x53e75a(++_0x17b831);}(_0x6f47,0xc7));var _0x76f4=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x6f47[_0x1e3c16];return _0x47a0c9;};'use strict';var BPromise=require('bluebird');var moment=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));var util=require('util');var db=require(_0x76f4('0x2'))['db'];var logger=require('../../config/logger')(_0x76f4('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232a});var mailClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x76f4('0x5')]({'port':0x232c});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){var _0x65d2c7=_0x497f99?_0x497f99:amiClient;return _0x65d2c7[_0x76f4('0x6')](_0xfc2405,_0x2176a7)[_0x76f4('0x7')](function(_0x4c6b5c){if(_0x4c6b5c['error']){if(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0x9')]===0x1f4){return _0x25656d(_0x4c6b5c['error']['message']);}return _0x1a3172(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0xa')]);}else{_0x1a3172(_0x4c6b5c[_0x76f4('0xb')]);}})[_0x76f4('0xc')](function(_0x1aee7f){_0x25656d(_0x1aee7f);});});}function respondWithResult(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xc8;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0xd')](_0xf7e347)['json'](_0x3ec740);}return _0xafd21e[_0x76f4('0xe')](0x194);};}function handleError(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0x1f4;return function(_0x4b6021){logger['error'](_0x4b6021[_0x76f4('0xf')]);if(_0x4b6021[_0x76f4('0x10')]){delete _0x4b6021[_0x76f4('0x10')];}_0x30dabf[_0x76f4('0xd')](_0x5da1ff)[_0x76f4('0x11')](_0x4b6021);};}function findById(_0x2b5e23){return function(_0x46ba51){if(!_[_0x76f4('0x12')](_0x2b5e23)&&!_[_0x76f4('0x12')](_0x46ba51)&&!_[_0x76f4('0x12')](_0x46ba51[_0x76f4('0x13')])){return _[_0x76f4('0x14')](_0x46ba51[_0x76f4('0x13')],function(_0x38450e){return _0x38450e['id']==_0x2b5e23;});}return null;};}exports[_0x76f4('0x15')]=function(_0x397360,_0xfedbe4){return respondWithRpcPromise(_0x76f4('0x16'),_0x397360[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0xfedbe4,null))[_0x76f4('0xc')](handleError(_0xfedbe4,null));};exports[_0x76f4('0x18')]=function(_0x5bf3d5,_0x262937){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x76f4('0x19')](_0x5bf3d5[_0x76f4('0x17')],_0x5bf3d5[_0x76f4('0x1a')]))['then'](respondWithResult(_0x262937,null))['catch'](handleError(_0x262937,null));};exports['voiceChannelStopMixMonitor']=function(_0x465240,_0x681d67){return respondWithRpcPromise(_0x76f4('0x1b'),_[_0x76f4('0x19')](_0x465240[_0x76f4('0x17')],_0x465240[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x681d67,null))['catch'](handleError(_0x681d67,null));};exports['voiceQueues']=function(_0x3794fa,_0x497913){return respondWithRpcPromise(_0x76f4('0x1c'),_0x3794fa['query'])['then'](respondWithResult(_0x497913,null))['catch'](handleError(_0x497913,null));};exports[_0x76f4('0x1d')]=function(_0x38300d,_0xd368a2){return respondWithRpcPromise(_0x76f4('0x1c'),_0x38300d[_0x76f4('0x17')])[_0x76f4('0x7')](findById(_0x38300d['params']['id']))[_0x76f4('0x7')](respondWithResult(_0xd368a2,null))['catch'](handleError(_0xd368a2,null));};exports['updateVoiceQueue']=function(_0x5b3f07,_0x10ddb4){return respondWithRpcPromise(_0x76f4('0x1e'),_[_0x76f4('0x19')](_0x5b3f07[_0x76f4('0x1f')],_0x5b3f07['params']))[_0x76f4('0x7')](respondWithResult(_0x10ddb4,null))['catch'](handleError(_0x10ddb4,null));};exports[_0x76f4('0x20')]=function(_0x3c7513,_0x43ac4a){return respondWithRpcPromise(_0x76f4('0x21'),_[_0x76f4('0x19')](_0x3c7513['query'],_0x3c7513['params']))[_0x76f4('0x7')](respondWithResult(_0x43ac4a,null))[_0x76f4('0xc')](handleError(_0x43ac4a,null));};exports[_0x76f4('0x22')]=function(_0x281db6,_0x1f2adf){return respondWithRpcPromise(_0x76f4('0x23'),_0x281db6[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x1f2adf,null))[_0x76f4('0xc')](handleError(_0x1f2adf,null));};exports[_0x76f4('0x24')]=function(_0x308af2,_0x2527a6){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x308af2['query'],_0x308af2['params']))[_0x76f4('0x7')](respondWithResult(_0x2527a6,null))[_0x76f4('0xc')](handleError(_0x2527a6,null));};exports[_0x76f4('0x25')]=function(_0x456b1f,_0x26fdd6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x76f4('0x19')](_0x456b1f[_0x76f4('0x17')],_0x456b1f[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x26fdd6,null))[_0x76f4('0xc')](handleError(_0x26fdd6,null));};exports[_0x76f4('0x26')]=function(_0xb806cc,_0x28d9d6){return respondWithRpcPromise(_0x76f4('0x27'),_[_0x76f4('0x19')](_0xb806cc[_0x76f4('0x17')],_0xb806cc[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x28d9d6,null))[_0x76f4('0xc')](handleError(_0x28d9d6,null));};exports[_0x76f4('0x28')]=function(_0x88506b,_0x3308e3){return respondWithRpcPromise(_0x76f4('0x29'),_0x88506b['query'])[_0x76f4('0x7')](respondWithResult(_0x3308e3,null))[_0x76f4('0xc')](handleError(_0x3308e3,null));};exports[_0x76f4('0x2a')]=function(_0x589637,_0x597e83){return respondWithRpcPromise(_0x76f4('0x2b'),_0x589637['query'])[_0x76f4('0x7')](respondWithResult(_0x597e83,null))['catch'](handleError(_0x597e83,null));};exports[_0x76f4('0x2c')]=function(_0x16f36d,_0x312243){var _0x378675;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')])[_0x76f4('0x7')](function(_0x109ad9){_0x378675=_0x109ad9;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')],routingClient);})['then'](function(_0x5b8d2d){return _[_0x76f4('0x19')]({},_0x5b8d2d,_0x378675);})[_0x76f4('0x7')](respondWithResult(_0x312243,null))[_0x76f4('0xc')](handleError(_0x312243,null));};exports[_0x76f4('0x2e')]=function(_0x2b7dc8,_0x2d6068){if(_0x2b7dc8[_0x76f4('0x1f')]&&_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')]&&_0x2b7dc8['user']&&_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')]){for(var _0x4f0d1a in _0x2b7dc8['body'][_0x76f4('0x2f')]){if(_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x76f4('0x31')](_0x4f0d1a)){db[_0x76f4('0x32')]['findAll']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'exitAt':null,'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]&&_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x76f4('0x34')]?{'$notIn':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]}:{'$ne':null}}})['then'](function(_0x571261){var _0x11ea58=moment()[_0x76f4('0x35')](_0x76f4('0x36'));for(var _0x2bea6d=0x0,_0x36fa03=_0x571261['length'];_0x2bea6d<_0x36fa03;_0x2bea6d+=0x1){_0x571261[_0x2bea6d]['updateAttributes']({'exitAt':_0x11ea58});}});for(var _0x8e5b60=0x0;_0x8e5b60<_0x2b7dc8['body'][_0x76f4('0x2f')][_0x4f0d1a][_0x76f4('0x34')];_0x8e5b60+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'uniqueid':_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x8e5b60],'exitAt':null},'defaults':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'interface':_[_0x76f4('0x12')](_0x2b7dc8['user'][_0x76f4('0x37')])?util[_0x76f4('0x35')]('SIP/%s',_0x2b7dc8['user'][_0x76f4('0x10')]):_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x37')],'type':_0x76f4('0x33'),'enterAt':moment()[_0x76f4('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x76f4('0x38'),'internal':_0x2b7dc8['user'][_0x76f4('0x39')],'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a][_0x8e5b60]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b7dc8[_0x76f4('0x1a')]['id'],'capacity':_0x2b7dc8[_0x76f4('0x1f')]['capacity']},routingClient)[_0x76f4('0x7')](respondWithResult(_0x2d6068,null))[_0x76f4('0xc')](handleError(_0x2d6068,null));};exports[_0x76f4('0x3a')]=function(_0x1c658c,_0x40ff20){return respondWithRpcPromise('Telephones',_0x1c658c[_0x76f4('0x17')])['then'](respondWithResult(_0x40ff20,null))[_0x76f4('0xc')](handleError(_0x40ff20,null));};exports[_0x76f4('0x3b')]=function(_0x154ba,_0x5121ec){return respondWithRpcPromise(_0x76f4('0x3c'),_0x154ba[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x5121ec,null))[_0x76f4('0xc')](handleError(_0x5121ec,null));};exports['campaigns']=function(_0x2028e9,_0xf11e07){return respondWithRpcPromise(_0x76f4('0x3d'),_0x2028e9[_0x76f4('0x17')])['then'](respondWithResult(_0xf11e07,null))[_0x76f4('0xc')](handleError(_0xf11e07,null));};exports['chatQueues']=function(_0x129048,_0x190c8d){return respondWithRpcPromise('ChatQueues',_0x129048['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x190c8d,null))[_0x76f4('0xc')](handleError(_0x190c8d,null));};exports[_0x76f4('0x3e')]=function(_0x596b51,_0x27ba06){return respondWithRpcPromise(_0x76f4('0x3f'),_0x596b51[_0x76f4('0x17')],routingClient)['then'](findById(_0x596b51['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x27ba06,null))[_0x76f4('0xc')](handleError(_0x27ba06,null));};exports['mailQueues']=function(_0x490ced,_0x3f1840){return respondWithRpcPromise(_0x76f4('0x40'),_0x490ced[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x3f1840,null))[_0x76f4('0xc')](handleError(_0x3f1840,null));};exports[_0x76f4('0x41')]=function(_0x97be11,_0x36a52a){return respondWithRpcPromise(_0x76f4('0x40'),_0x97be11['query'],routingClient)['then'](findById(_0x97be11['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x36a52a,null))[_0x76f4('0xc')](handleError(_0x36a52a,null));};exports[_0x76f4('0x42')]=function(_0x3b6c16,_0x4c9d64){return respondWithRpcPromise('MailAccounts',_0x3b6c16[_0x76f4('0x17')],mailClient)['then'](respondWithResult(_0x4c9d64,null))[_0x76f4('0xc')](handleError(_0x4c9d64,null));};exports['openchannelQueues']=function(_0x4285dd,_0x25e510){return respondWithRpcPromise(_0x76f4('0x43'),_0x4285dd[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x25e510,null))[_0x76f4('0xc')](handleError(_0x25e510,null));};exports[_0x76f4('0x44')]=function(_0x22a0cc,_0x40c170){return respondWithRpcPromise(_0x76f4('0x43'),_0x22a0cc[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x22a0cc['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x40c170,null))[_0x76f4('0xc')](handleError(_0x40c170,null));};exports[_0x76f4('0x45')]=function(_0x320a87,_0x28cf4c){return respondWithRpcPromise(_0x76f4('0x46'),_0x320a87[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x28cf4c,null))['catch'](handleError(_0x28cf4c,null));};exports['showSmsQueues']=function(_0xa3091a,_0x617924){return respondWithRpcPromise(_0x76f4('0x46'),_0xa3091a['query'],routingClient)[_0x76f4('0x7')](findById(_0xa3091a['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x617924,null))[_0x76f4('0xc')](handleError(_0x617924,null));};exports['whatsappQueues']=function(_0xda0ac2,_0x37b7f7){return respondWithRpcPromise(_0x76f4('0x47'),_0xda0ac2[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x37b7f7,null))[_0x76f4('0xc')](handleError(_0x37b7f7,null));};exports[_0x76f4('0x48')]=function(_0x410d83,_0x1f7257){return respondWithRpcPromise('WhatsappQueues',_0x410d83[_0x76f4('0x17')],routingClient)['then'](findById(_0x410d83[_0x76f4('0x1a')]['id']))[_0x76f4('0x7')](respondWithResult(_0x1f7257,null))[_0x76f4('0xc')](handleError(_0x1f7257,null));};exports[_0x76f4('0x49')]=function(_0xfbb52c,_0x8de630){return respondWithRpcPromise(_0x76f4('0x4a'),_0xfbb52c[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x8de630,null))[_0x76f4('0xc')](handleError(_0x8de630,null));};exports['showFaxQueues']=function(_0x30f3de,_0x6f874d){return respondWithRpcPromise('FaxQueues',_0x30f3de[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x30f3de[_0x76f4('0x1a')]['id']))['then'](respondWithResult(_0x6f874d,null))[_0x76f4('0xc')](handleError(_0x6f874d,null));};exports[_0x76f4('0x4b')]=function(_0x3e829f,_0x52610a){return respondWithRpcPromise(_0x76f4('0x4c'),_0x3e829f[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x52610a,null))[_0x76f4('0xc')](handleError(_0x52610a,null));};exports[_0x76f4('0x4d')]=function(_0x10ee07,_0x19b99c){return respondWithRpcPromise(_0x76f4('0x4e'),_0x10ee07[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x19b99c,null))[_0x76f4('0xc')](handleError(_0x19b99c,null));};exports[_0x76f4('0x4f')]=function(_0x19fdc3,_0x39c9af){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x19fdc3[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x39c9af,null))[_0x76f4('0xc')](handleError(_0x39c9af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x43b44d,_0x1375d5){return respondWithRpcPromise(_0x76f4('0x50'),_0x43b44d[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x1375d5,null))['catch'](handleError(_0x1375d5,null));};exports[_0x76f4('0x51')]=function(_0x4dd41f,_0x2b8467){return respondWithRpcPromise(_0x76f4('0x50'),_0x4dd41f['query'],routingClient)['then'](function(_0x58251e){if(_0x4dd41f[_0x76f4('0x17')][_0x76f4('0x52')]!==undefined){var _0x1e7b6=_(_0x58251e[_0x76f4('0x13')])[_0x76f4('0x53')]([_0x4dd41f[_0x76f4('0x17')]['type'],_0x4dd41f[_0x76f4('0x1a')]['id']])[_0x76f4('0x54')](_0x76f4('0x55'))[_0x76f4('0x56')]()[_0x76f4('0x57')]();return _0x58251e[_0x76f4('0x13')][_0x76f4('0x53')](function(_0x202fc8){return _0x1e7b6['indexOf'](_0x202fc8[_0x76f4('0x55')])>-0x1;});}else{return _0x58251e['rows'][_0x76f4('0x53')](function(_0x30358a){return _0x30358a[_0x76f4('0x55')]===parseInt(_0x4dd41f[_0x76f4('0x1a')]['id']);});}})[_0x76f4('0x7')](respondWithResult(_0x2b8467,null))[_0x76f4('0xc')](handleError(_0x2b8467,null));};exports[_0x76f4('0x58')]=function(_0x2a0491,_0x54729b){return respondWithRpcPromise(_0x76f4('0x59'),_0x2a0491['query'],routingClient)['then'](respondWithResult(_0x54729b,null))['catch'](handleError(_0x54729b,null));};exports[_0x76f4('0x5a')]=function(_0x402209,_0x279040){return respondWithRpcPromise(_0x76f4('0x5b'),_0x402209['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x279040,null))[_0x76f4('0xc')](handleError(_0x279040,null));};exports[_0x76f4('0x5c')]=function(_0x5f5c24,_0x12f16e){return respondWithRpcPromise(_0x76f4('0x5d'),_0x5f5c24[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x12f16e,null))[_0x76f4('0xc')](handleError(_0x12f16e,null));};exports[_0x76f4('0x5e')]=function(_0x3b5e15){return function(_0x4b562c,_0x2e991e){var _0xa49e2a,_0x4c7307;var _0x3bc914=_[_0x76f4('0x5f')](_0x3b5e15);var _0x5e6393=_0x3b5e15===_0x76f4('0x60')?_0x76f4('0x61'):_0x76f4('0x62');return db[_0x3bc914+_0x76f4('0x63')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x4b562c[_0x76f4('0x1a')]['id']}})['then'](function(_0x2dac86){if(_[_0x76f4('0x12')](_0x2dac86)){throw new Error(_0x3bc914+_0x76f4('0x65'));}_0xa49e2a=_0x2dac86;return db[_0x3bc914+_0x76f4('0x66')]['findOne']({'where':{'id':_0x4b562c[_0x76f4('0x1f')]['messageId']},'include':[{'model':db[_0x3bc914+_0x76f4('0x67')],'as':'Interaction'},{'model':db[_0x3bc914+_0x5e6393],'as':_0x76f4('0x62')}]});})[_0x76f4('0x7')](function(_0x59e9ed){if(_['isNil'](_0x59e9ed)){throw new Error(_0x3bc914+_0x76f4('0x68'));}_0x4c7307=_0x59e9ed;return _0x59e9ed[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x76f4('0x7')](function(){var _0x4a2969={'uniqueid':_0x3b5e15+'.'+_0x4c7307['id']+'.'+_0x4c7307['Interaction']['id'],'FromUserId':_0x4b562c[_0x76f4('0x30')]['id'],'type':_0x76f4('0x6a')};_0x4a2969[_0x3bc914+_0x76f4('0x6b')]=_0x4c7307['id'];_0x4a2969[_0x3bc914+_0x76f4('0x6c')]=_0x4c7307[_0x76f4('0x67')]['id'];_0x4a2969[_0x76f4('0x6d')+_0x3bc914+_0x5e6393+'Id']=_0x4c7307[_0x76f4('0x62')]['id'];_0x4a2969['To'+_0x3bc914+_0x76f4('0x6e')]=_0xa49e2a['id'];return db[_0x3bc914+'TransferReport']['create'](_0x4a2969);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x3b5e15,'interaction':_0x4c7307[_0x76f4('0x67')],'message':_0x4c7307,'account':_0x4c7307['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x6a'),'appdata':_0xa49e2a[_0x76f4('0x10')]+','+(_0x4c7307[_0x76f4('0x62')][_0x76f4('0x70')]||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x2e991e,null))[_0x76f4('0xc')](handleError(_0x2e991e,null));};};exports['agentNotify']=function(_0x13cf2a,_0x316f86){var _0x3e537b,_0x53252e;if(_[_0x76f4('0x12')](_0x13cf2a[_0x76f4('0x1f')][_0x76f4('0x72')])){throw new Error(_0x76f4('0x73'));}var _0x5080a9=_0x13cf2a[_0x76f4('0x1f')]['channel'];var _0xc80d4c=_['capitalize'](_0x5080a9);var _0x238df3=_0x5080a9===_0x76f4('0x60')?_0x76f4('0x61'):'Account';return db[_0x76f4('0x74')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x13cf2a[_0x76f4('0x1a')]['id'],'role':'agent'}})[_0x76f4('0x7')](function(_0x460867){if(_['isNil'](_0x460867)){throw new Error('Agent\x20not\x20found');}_0x3e537b=_0x460867;return db[_0xc80d4c+_0x76f4('0x66')][_0x76f4('0x64')]({'where':{'id':_0x13cf2a['body']['messageId']},'include':[{'model':db[_0xc80d4c+_0x76f4('0x67')],'as':_0x76f4('0x67')},{'model':db[_0xc80d4c+_0x238df3],'as':'Account'}]});})[_0x76f4('0x7')](function(_0x54ae6c){if(_['isNil'](_0x54ae6c)){throw new Error(_0xc80d4c+'\x20Message\x20not\x20found');}_0x53252e=_0x54ae6c;return _0x54ae6c[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x59265d={'uniqueid':_0x5080a9+'.'+_0x53252e['id']+'.'+_0x53252e[_0x76f4('0x67')]['id'],'FromUserId':_0x13cf2a['user']['id'],'type':'queue','ToUserId':_0x3e537b['id']};_0x59265d[_0xc80d4c+_0x76f4('0x6b')]=_0x53252e['id'];_0x59265d[_0xc80d4c+'InteractionId']=_0x53252e[_0x76f4('0x67')]['id'];_0x59265d[_0x76f4('0x6d')+_0xc80d4c+_0x238df3+'Id']=_0x53252e['Account']['id'];return db[_0xc80d4c+'TransferReport'][_0x76f4('0x75')](_0x59265d);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x5080a9,'interaction':_0x53252e['Interaction'],'message':_0x53252e,'account':_0x53252e[_0x76f4('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x38'),'appdata':_0x3e537b[_0x76f4('0x10')]+','+(_0x53252e[_0x76f4('0x62')]['agentTransferTimeout']||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x316f86,null))[_0x76f4('0xc')](handleError(_0x316f86,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e990a7c..f34ee23 100644 --- a/server/api/schedule/index.js +++ b/server/api/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56ba=['destroy','exports','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','isAuthenticated','show','run','create','update','delete','/:id'];(function(_0x4e9fbc,_0x43d175){var _0x596a10=function(_0x32c8fc){while(--_0x32c8fc){_0x4e9fbc['push'](_0x4e9fbc['shift']());}};_0x596a10(++_0x43d175);}(_0x56ba,0x1a2));var _0xa56b=function(_0x2ec960,_0x5c922f){_0x2ec960=_0x2ec960-0x0;var _0x2cf829=_0x56ba[_0x2ec960];return _0x2cf829;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa56b('0x0')]();var fs_extra=require('fs-extra');var auth=require(_0xa56b('0x1'));var interaction=require(_0xa56b('0x2'));var config=require(_0xa56b('0x3'));var controller=require(_0xa56b('0x4'));router[_0xa56b('0x5')]('/',auth['isAuthenticated'](),controller[_0xa56b('0x6')]);router[_0xa56b('0x5')]('/:id',auth[_0xa56b('0x7')](),controller[_0xa56b('0x8')]);router[_0xa56b('0x5')]('/:id/run',auth[_0xa56b('0x7')](),controller[_0xa56b('0x9')]);router['post']('/',auth[_0xa56b('0x7')](),controller[_0xa56b('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa56b('0xb')]);router[_0xa56b('0xc')](_0xa56b('0xd'),auth[_0xa56b('0x7')](),controller[_0xa56b('0xe')]);module[_0xa56b('0xf')]=router; \ No newline at end of file +var _0xc89c=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/run','post','put','update','delete','destroy','exports'];(function(_0x1fd52e,_0x18738c){var _0x279b03=function(_0x3f22d9){while(--_0x3f22d9){_0x1fd52e['push'](_0x1fd52e['shift']());}};_0x279b03(++_0x18738c);}(_0xc89c,0xa2));var _0xcc89=function(_0x1504f0,_0x10c013){_0x1504f0=_0x1504f0-0x0;var _0x47012b=_0xc89c[_0x1504f0];return _0x47012b;};'use strict';var multer=require('multer');var util=require(_0xcc89('0x0'));var path=require(_0xcc89('0x1'));var timeout=require(_0xcc89('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcc89('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcc89('0x4'));var config=require(_0xcc89('0x5'));var controller=require('./schedule.controller');router[_0xcc89('0x6')]('/',auth[_0xcc89('0x7')](),controller[_0xcc89('0x8')]);router[_0xcc89('0x6')](_0xcc89('0x9'),auth[_0xcc89('0x7')](),controller[_0xcc89('0xa')]);router[_0xcc89('0x6')](_0xcc89('0xb'),auth[_0xcc89('0x7')](),controller['run']);router[_0xcc89('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcc89('0xd')](_0xcc89('0x9'),auth['isAuthenticated'](),controller[_0xcc89('0xe')]);router[_0xcc89('0xf')](_0xcc89('0x9'),auth[_0xcc89('0x7')](),controller[_0xcc89('0x10')]);module[_0xcc89('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 849beeb..767d306 100644 --- a/server/api/schedule/schedule.attributes.js +++ b/server/api/schedule/schedule.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfce=['quarters','weeks','days','csv','xlsx','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xbfce,0x13f));var _0xebfc=function(_0x47191a,_0x312948){_0x47191a=_0x47191a-0x0;var _0x140ef7=_0xbfce[_0x47191a];return _0x140ef7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xebfc('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xebfc('0x0')]},'active':{'type':Sequelize[_0xebfc('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xebfc('0x0')],'allowNull':![],'defaultValue':_0xebfc('0x2')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xebfc('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xebfc('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xebfc('0x5')]('years',_0xebfc('0x6'),'months',_0xebfc('0x7'),_0xebfc('0x8'),'hours','minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0xebfc('0x9'),'pdf',_0xebfc('0xa')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xebfc('0x5')]('custom',_0xebfc('0xb')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xebfc('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xebfc('0x0')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xebfc('0xc')]},'sendIfEmpty':{'type':Sequelize[_0xebfc('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x06fb=['quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years'];(function(_0x54e65a,_0x116a10){var _0x559fb6=function(_0x66046){while(--_0x66046){_0x54e65a['push'](_0x54e65a['shift']());}};_0x559fb6(++_0x116a10);}(_0x06fb,0x1eb));var _0xb06f=function(_0x725bd2,_0x5de588){_0x725bd2=_0x725bd2-0x0;var _0x295210=_0x06fb[_0x725bd2];return _0x295210;};'use strict';var Sequelize=require(_0xb06f('0x0'));module[_0xb06f('0x1')]={'name':{'type':Sequelize[_0xb06f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb06f('0x2')]},'active':{'type':Sequelize[_0xb06f('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb06f('0x4')},'startAt':{'type':Sequelize[_0xb06f('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb06f('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb06f('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb06f('0x7')](_0xb06f('0x8'),_0xb06f('0x9'),_0xb06f('0xa'),_0xb06f('0xb'),_0xb06f('0xc'),_0xb06f('0xd'),_0xb06f('0xe')),'allowNull':![],'defaultValue':_0xb06f('0xc')},'output':{'type':Sequelize[_0xb06f('0x7')](_0xb06f('0xf'),_0xb06f('0x10'),_0xb06f('0x11')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xb06f('0x7')](_0xb06f('0x12'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xb06f('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xb06f('0x2')]},'cc':{'type':Sequelize[_0xb06f('0x13')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xb06f('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 851add7..09666bc 100644 --- a/server/api/schedule/schedule.controller.js +++ b/server/api/schedule/schedule.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5403=['../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','index','map','Schedule','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','run','../../config/schedule','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment'];(function(_0x1895cc,_0x2b96d1){var _0xb084be=function(_0x4d8812){while(--_0x4d8812){_0x1895cc['push'](_0x1895cc['shift']());}};_0xb084be(++_0x2b96d1);}(_0x5403,0x92));var _0x3540=function(_0x5bab05,_0x3259a2){_0x5bab05=_0x5bab05-0x0;var _0x4d404a=_0x5403[_0x5bab05];return _0x4d404a;};'use strict';var emlformat=require(_0x3540('0x0'));var rimraf=require(_0x3540('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3540('0x2'));var rp=require('request-promise');var moment=require(_0x3540('0x3'));var BPromise=require(_0x3540('0x4'));var Mustache=require(_0x3540('0x5'));var util=require(_0x3540('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3540('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3540('0x8'));var squel=require(_0x3540('0x9'));var crypto=require(_0x3540('0xa'));var jsforce=require(_0x3540('0xb'));var deskjs=require(_0x3540('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3540('0xd'));var Papa=require('papaparse');var Redis=require(_0x3540('0xe'));var authService=require(_0x3540('0xf'));var qs=require(_0x3540('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3540('0x11'));var utils=require(_0x3540('0x12'));var config=require(_0x3540('0x13'));var licenseUtil=require(_0x3540('0x14'));var db=require(_0x3540('0x15'))['db'];function respondWithStatusCode(_0x297191,_0x131d10){_0x131d10=_0x131d10||0xcc;return function(_0x36f85f){if(_0x36f85f){return _0x297191[_0x3540('0x16')](_0x131d10);}return _0x297191['status'](_0x131d10)[_0x3540('0x17')]();};}function respondWithResult(_0x55b75f,_0x286dd8){_0x286dd8=_0x286dd8||0xc8;return function(_0x145cbb){if(_0x145cbb){return _0x55b75f['status'](_0x286dd8)['json'](_0x145cbb);}};}function respondWithFilteredResult(_0x481a85,_0x1fa2a3){return function(_0x1d092b){if(_0x1d092b){var _0x2f1df0=typeof _0x1fa2a3[_0x3540('0x18')]===_0x3540('0x19')&&typeof _0x1fa2a3[_0x3540('0x1a')]===_0x3540('0x19');var _0x134c79=_0x1d092b[_0x3540('0x1b')];var _0x12f565=_0x2f1df0?0x0:_0x1fa2a3[_0x3540('0x18')];var _0x392556=_0x2f1df0?_0x1d092b[_0x3540('0x1b')]:_0x1fa2a3[_0x3540('0x18')]+_0x1fa2a3['limit'];var _0x4b028b;if(_0x392556>=_0x134c79){_0x392556=_0x134c79;_0x4b028b=0xc8;}else{_0x4b028b=0xce;}_0x481a85[_0x3540('0x1c')](_0x4b028b);return _0x481a85['set'](_0x3540('0x1d'),_0x12f565+'-'+_0x392556+'/'+_0x134c79)[_0x3540('0x1e')](_0x1d092b);}return null;};}function patchUpdates(_0x469e9b){return function(_0x13393b){try{jsonpatch['apply'](_0x13393b,_0x469e9b,!![]);}catch(_0x38df1c){return BPromise[_0x3540('0x1f')](_0x38df1c);}return _0x13393b[_0x3540('0x20')]();};}function saveUpdates(_0x297b7a,_0x1927ff){return function(_0x18e8e1){if(_0x18e8e1){return _0x18e8e1[_0x3540('0x21')](_0x297b7a)[_0x3540('0x22')](function(_0x5d6f52){return _0x5d6f52;});}return null;};}function removeEntity(_0x108c85,_0x4f245b){return function(_0x554167){if(_0x554167){return _0x554167[_0x3540('0x23')]()[_0x3540('0x22')](function(){var _0x16204c=_0x554167[_0x3540('0x24')]({'plain':!![]});var _0x312d4a=_0x3540('0x25');return db[_0x3540('0x26')][_0x3540('0x23')]({'where':{'type':_0x312d4a,'resourceId':_0x16204c['id']}})[_0x3540('0x22')](function(){return _0x554167;});})[_0x3540('0x22')](function(){_0x108c85['status'](0xcc)[_0x3540('0x17')]();});}};}function handleEntityNotFound(_0x16fc80,_0x4577f1){return function(_0x4549c9){if(!_0x4549c9){_0x16fc80['sendStatus'](0x194);}return _0x4549c9;};}function handleError(_0x45e494,_0x3c0f8e){_0x3c0f8e=_0x3c0f8e||0x1f4;return function(_0x4df8a5){logger[_0x3540('0x27')](_0x4df8a5[_0x3540('0x28')]);if(_0x4df8a5[_0x3540('0x29')]){delete _0x4df8a5['name'];}_0x45e494['status'](_0x3c0f8e)['send'](_0x4df8a5);};}exports[_0x3540('0x2a')]=function(_0x2faa46,_0xb14663){var _0x2290cf={},_0x289649={},_0x341bc3={'count':0x0,'rows':[]};var _0x5aaf78=_[_0x3540('0x2b')](db[_0x3540('0x2c')][_0x3540('0x2d')],function(_0x407f09){return{'name':_0x407f09['fieldName'],'type':_0x407f09[_0x3540('0x2e')][_0x3540('0x2f')]};});_0x289649[_0x3540('0x30')]=_['map'](_0x5aaf78,_0x3540('0x29'));_0x289649[_0x3540('0x31')]=_[_0x3540('0x32')](_0x2faa46['query']);_0x289649[_0x3540('0x33')]=_[_0x3540('0x34')](_0x289649[_0x3540('0x30')],_0x289649[_0x3540('0x31')]);_0x2290cf[_0x3540('0x35')]=_['intersection'](_0x289649[_0x3540('0x30')],qs[_0x3540('0x36')](_0x2faa46['query'][_0x3540('0x36')]));_0x2290cf['attributes']=_0x2290cf[_0x3540('0x35')]['length']?_0x2290cf[_0x3540('0x35')]:_0x289649[_0x3540('0x30')];if(!_0x2faa46[_0x3540('0x31')]['hasOwnProperty'](_0x3540('0x37'))){_0x2290cf[_0x3540('0x1a')]=qs[_0x3540('0x1a')](_0x2faa46[_0x3540('0x31')]['limit']);_0x2290cf['offset']=qs[_0x3540('0x18')](_0x2faa46['query']['offset']);}_0x2290cf[_0x3540('0x38')]=qs['sort'](_0x2faa46[_0x3540('0x31')][_0x3540('0x39')]);_0x2290cf['where']=qs[_0x3540('0x33')](_[_0x3540('0x3a')](_0x2faa46['query'],_0x289649[_0x3540('0x33')]),_0x5aaf78);if(_0x2faa46['query'][_0x3540('0x3b')]){_0x2290cf[_0x3540('0x3c')]=_[_0x3540('0x3d')](_0x2290cf['where'],{'$or':_[_0x3540('0x2b')](_0x5aaf78,function(_0x482214){if(_0x482214['type']!==_0x3540('0x3e')){var _0x328616={};_0x328616[_0x482214[_0x3540('0x29')]]={'$like':'%'+_0x2faa46[_0x3540('0x31')][_0x3540('0x3b')]+'%'};return _0x328616;}})});}_0x2290cf=_[_0x3540('0x3d')]({},_0x2290cf,_0x2faa46[_0x3540('0x3f')]);var _0x162c4d={'where':_0x2290cf[_0x3540('0x3c')]};return db[_0x3540('0x2c')]['count'](_0x162c4d)[_0x3540('0x22')](function(_0x3c96c5){_0x341bc3['count']=_0x3c96c5;if(_0x2faa46[_0x3540('0x31')][_0x3540('0x40')]){_0x2290cf[_0x3540('0x41')]=[{'all':!![]}];}return db[_0x3540('0x2c')][_0x3540('0x42')](_0x2290cf);})[_0x3540('0x22')](function(_0x434fc0){_0x341bc3[_0x3540('0x43')]=_0x434fc0;return _0x341bc3;})[_0x3540('0x22')](respondWithFilteredResult(_0xb14663,_0x2290cf))['catch'](handleError(_0xb14663,null));};exports[_0x3540('0x44')]=function(_0x3e466e,_0x39096d){var _0x5ebf7f={'raw':![],'where':{'id':_0x3e466e[_0x3540('0x45')]['id']}},_0x43b8b7={};_0x43b8b7[_0x3540('0x30')]=_[_0x3540('0x32')](db[_0x3540('0x2c')]['rawAttributes']);_0x43b8b7[_0x3540('0x31')]=_[_0x3540('0x32')](_0x3e466e['query']);_0x43b8b7[_0x3540('0x33')]=_[_0x3540('0x34')](_0x43b8b7[_0x3540('0x30')],_0x43b8b7[_0x3540('0x31')]);_0x5ebf7f['attributes']=_[_0x3540('0x34')](_0x43b8b7[_0x3540('0x30')],qs[_0x3540('0x36')](_0x3e466e['query']['fields']));_0x5ebf7f[_0x3540('0x35')]=_0x5ebf7f['attributes'][_0x3540('0x46')]?_0x5ebf7f[_0x3540('0x35')]:_0x43b8b7['model'];if(_0x3e466e['query'][_0x3540('0x40')]){_0x5ebf7f[_0x3540('0x41')]=[{'all':!![]}];}_0x5ebf7f=_[_0x3540('0x3d')]({},_0x5ebf7f,_0x3e466e[_0x3540('0x3f')]);return db['Schedule']['find'](_0x5ebf7f)[_0x3540('0x22')](handleEntityNotFound(_0x39096d,null))[_0x3540('0x22')](respondWithResult(_0x39096d,null))[_0x3540('0x47')](handleError(_0x39096d,null));};exports[_0x3540('0x48')]=function(_0x5e90b8,_0x3095ee){return db[_0x3540('0x2c')][_0x3540('0x48')](_0x5e90b8[_0x3540('0x49')],{})['then'](function(_0x50c1b4){var _0x276118=_0x5e90b8[_0x3540('0x4a')][_0x3540('0x24')]({'plain':!![]});if(!_0x276118)throw new Error(_0x3540('0x4b'));if(_0x276118[_0x3540('0x4c')]===_0x3540('0x4a')){var _0x1826a4=_0x50c1b4[_0x3540('0x24')]({'plain':!![]});var _0x20b60c='Scheduler';return db[_0x3540('0x4d')]['find']({'where':{'name':_0x20b60c,'userProfileId':_0x276118[_0x3540('0x4e')]},'raw':!![]})['then'](function(_0x31681f){if(_0x31681f&&_0x31681f[_0x3540('0x4f')]===0x0){return db['UserProfileResource'][_0x3540('0x48')]({'name':_0x1826a4[_0x3540('0x29')],'resourceId':_0x1826a4['id'],'type':_0x31681f[_0x3540('0x29')],'sectionId':_0x31681f['id']},{})[_0x3540('0x22')](function(){return _0x50c1b4;});}else{return _0x50c1b4;}})['catch'](function(_0x1073c9){logger[_0x3540('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1073c9);throw _0x1073c9;});}return _0x50c1b4;})[_0x3540('0x22')](respondWithResult(_0x3095ee,0xc9))[_0x3540('0x47')](handleError(_0x3095ee,null));};exports[_0x3540('0x21')]=function(_0x460524,_0x4a56d9){if(_0x460524['body']['id']){delete _0x460524[_0x3540('0x49')]['id'];}return db[_0x3540('0x2c')][_0x3540('0x50')]({'where':{'id':_0x460524[_0x3540('0x45')]['id']}})[_0x3540('0x22')](handleEntityNotFound(_0x4a56d9,null))[_0x3540('0x22')](saveUpdates(_0x460524[_0x3540('0x49')],null))[_0x3540('0x22')](respondWithResult(_0x4a56d9,null))[_0x3540('0x47')](handleError(_0x4a56d9,null));};exports[_0x3540('0x23')]=function(_0x16ab6b,_0x122c40){return db['Schedule'][_0x3540('0x50')]({'where':{'id':_0x16ab6b[_0x3540('0x45')]['id']}})[_0x3540('0x22')](handleEntityNotFound(_0x122c40,null))[_0x3540('0x22')](removeEntity(_0x122c40,null))[_0x3540('0x47')](handleError(_0x122c40,null));};exports[_0x3540('0x51')]=function(_0x1d9fc8,_0x33138e,_0x18ee68){var _0x599f19=require(_0x3540('0x52'));return db[_0x3540('0x2c')][_0x3540('0x50')]({'where':{'id':_0x1d9fc8['params']['id']},'raw':!![]})[_0x3540('0x22')](handleEntityNotFound(_0x33138e,null))[_0x3540('0x22')](function(){_0x599f19['run'](_0x1d9fc8[_0x3540('0x45')]['id']);})['then'](respondWithStatusCode(_0x33138e,null))[_0x3540('0x47')](handleError(_0x33138e,null));}; \ No newline at end of file +var _0x3618=['status','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource'];(function(_0x46dce0,_0x2e12a8){var _0x254615=function(_0x172af0){while(--_0x172af0){_0x46dce0['push'](_0x46dce0['shift']());}};_0x254615(++_0x2e12a8);}(_0x3618,0xe2));var _0x8361=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x3618[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0x8361('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8361('0x1'));var rp=require(_0x8361('0x2'));var moment=require(_0x8361('0x3'));var BPromise=require(_0x8361('0x4'));var Mustache=require(_0x8361('0x5'));var util=require(_0x8361('0x6'));var path=require(_0x8361('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8361('0x8'));var fs=require('fs');var fs_extra=require(_0x8361('0x9'));var _=require(_0x8361('0xa'));var squel=require(_0x8361('0xb'));var crypto=require(_0x8361('0xc'));var jsforce=require(_0x8361('0xd'));var deskjs=require(_0x8361('0xe'));var toCsv=require(_0x8361('0xf'));var querystring=require('querystring');var Papa=require(_0x8361('0x10'));var Redis=require(_0x8361('0x11'));var authService=require(_0x8361('0x12'));var qs=require(_0x8361('0x13'));var as=require(_0x8361('0x14'));var hardwareService=require(_0x8361('0x15'));var logger=require(_0x8361('0x16'))(_0x8361('0x17'));var utils=require('../../config/utils');var config=require(_0x8361('0x18'));var licenseUtil=require(_0x8361('0x19'));var db=require(_0x8361('0x1a'))['db'];function respondWithStatusCode(_0x48a87d,_0x1060f0){_0x1060f0=_0x1060f0||0xcc;return function(_0x471afd){if(_0x471afd){return _0x48a87d[_0x8361('0x1b')](_0x1060f0);}return _0x48a87d['status'](_0x1060f0)[_0x8361('0x1c')]();};}function respondWithResult(_0x55d45b,_0x45ffbc){_0x45ffbc=_0x45ffbc||0xc8;return function(_0x2cec9f){if(_0x2cec9f){return _0x55d45b['status'](_0x45ffbc)[_0x8361('0x1d')](_0x2cec9f);}};}function respondWithFilteredResult(_0x2100ae,_0x49261c){return function(_0x45e703){if(_0x45e703){var _0x101624=typeof _0x49261c[_0x8361('0x1e')]===_0x8361('0x1f')&&typeof _0x49261c['limit']===_0x8361('0x1f');var _0x4647d3=_0x45e703[_0x8361('0x20')];var _0x35f1c6=_0x101624?0x0:_0x49261c['offset'];var _0x381041=_0x101624?_0x45e703['count']:_0x49261c[_0x8361('0x1e')]+_0x49261c[_0x8361('0x21')];var _0x3215e9;if(_0x381041>=_0x4647d3){_0x381041=_0x4647d3;_0x3215e9=0xc8;}else{_0x3215e9=0xce;}_0x2100ae['status'](_0x3215e9);return _0x2100ae[_0x8361('0x22')](_0x8361('0x23'),_0x35f1c6+'-'+_0x381041+'/'+_0x4647d3)[_0x8361('0x1d')](_0x45e703);}return null;};}function patchUpdates(_0x4b93f4){return function(_0x278a69){try{jsonpatch[_0x8361('0x24')](_0x278a69,_0x4b93f4,!![]);}catch(_0x18bbed){return BPromise[_0x8361('0x25')](_0x18bbed);}return _0x278a69[_0x8361('0x26')]();};}function saveUpdates(_0x1ea6c8,_0x43fee2){return function(_0x168944){if(_0x168944){return _0x168944[_0x8361('0x27')](_0x1ea6c8)[_0x8361('0x28')](function(_0x30a97a){return _0x30a97a;});}return null;};}function removeEntity(_0x2a43b4,_0x239593){return function(_0x3678f6){if(_0x3678f6){return _0x3678f6[_0x8361('0x29')]()[_0x8361('0x28')](function(){var _0x1237b8=_0x3678f6[_0x8361('0x2a')]({'plain':!![]});var _0x252531='Scheduler';return db[_0x8361('0x2b')][_0x8361('0x29')]({'where':{'type':_0x252531,'resourceId':_0x1237b8['id']}})[_0x8361('0x28')](function(){return _0x3678f6;});})['then'](function(){_0x2a43b4[_0x8361('0x2c')](0xcc)[_0x8361('0x1c')]();});}};}function handleEntityNotFound(_0x2bf049,_0x459ccd){return function(_0x69a3b){if(!_0x69a3b){_0x2bf049['sendStatus'](0x194);}return _0x69a3b;};}function handleError(_0x4cd6b3,_0x5bd991){_0x5bd991=_0x5bd991||0x1f4;return function(_0x1e39b7){logger[_0x8361('0x2d')](_0x1e39b7[_0x8361('0x2e')]);if(_0x1e39b7[_0x8361('0x2f')]){delete _0x1e39b7[_0x8361('0x2f')];}_0x4cd6b3[_0x8361('0x2c')](_0x5bd991)[_0x8361('0x30')](_0x1e39b7);};}exports[_0x8361('0x31')]=function(_0xa07e67,_0x4cc803){var _0x48f779={},_0x2c8b0d={},_0x365747={'count':0x0,'rows':[]};var _0x31aae9=_['map'](db[_0x8361('0x32')][_0x8361('0x33')],function(_0x43c4a2){return{'name':_0x43c4a2[_0x8361('0x34')],'type':_0x43c4a2[_0x8361('0x35')][_0x8361('0x36')]};});_0x2c8b0d[_0x8361('0x37')]=_[_0x8361('0x38')](_0x31aae9,_0x8361('0x2f'));_0x2c8b0d[_0x8361('0x39')]=_['keys'](_0xa07e67[_0x8361('0x39')]);_0x2c8b0d[_0x8361('0x3a')]=_[_0x8361('0x3b')](_0x2c8b0d[_0x8361('0x37')],_0x2c8b0d[_0x8361('0x39')]);_0x48f779[_0x8361('0x3c')]=_[_0x8361('0x3b')](_0x2c8b0d[_0x8361('0x37')],qs[_0x8361('0x3d')](_0xa07e67['query'][_0x8361('0x3d')]));_0x48f779['attributes']=_0x48f779[_0x8361('0x3c')][_0x8361('0x3e')]?_0x48f779[_0x8361('0x3c')]:_0x2c8b0d[_0x8361('0x37')];if(!_0xa07e67[_0x8361('0x39')][_0x8361('0x3f')]('nolimit')){_0x48f779[_0x8361('0x21')]=qs['limit'](_0xa07e67[_0x8361('0x39')][_0x8361('0x21')]);_0x48f779[_0x8361('0x1e')]=qs['offset'](_0xa07e67[_0x8361('0x39')][_0x8361('0x1e')]);}_0x48f779[_0x8361('0x40')]=qs[_0x8361('0x41')](_0xa07e67[_0x8361('0x39')]['sort']);_0x48f779[_0x8361('0x42')]=qs[_0x8361('0x3a')](_[_0x8361('0x43')](_0xa07e67[_0x8361('0x39')],_0x2c8b0d[_0x8361('0x3a')]),_0x31aae9);if(_0xa07e67[_0x8361('0x39')][_0x8361('0x44')]){_0x48f779[_0x8361('0x42')]=_[_0x8361('0x45')](_0x48f779[_0x8361('0x42')],{'$or':_[_0x8361('0x38')](_0x31aae9,function(_0x662466){if(_0x662466[_0x8361('0x35')]!==_0x8361('0x46')){var _0x4dd8af={};_0x4dd8af[_0x662466[_0x8361('0x2f')]]={'$like':'%'+_0xa07e67['query'][_0x8361('0x44')]+'%'};return _0x4dd8af;}})});}_0x48f779=_[_0x8361('0x45')]({},_0x48f779,_0xa07e67[_0x8361('0x47')]);var _0x3a82e0={'where':_0x48f779['where']};return db[_0x8361('0x32')]['count'](_0x3a82e0)[_0x8361('0x28')](function(_0x576e85){_0x365747[_0x8361('0x20')]=_0x576e85;if(_0xa07e67[_0x8361('0x39')][_0x8361('0x48')]){_0x48f779['include']=[{'all':!![]}];}return db[_0x8361('0x32')][_0x8361('0x49')](_0x48f779);})['then'](function(_0x3da12c){_0x365747['rows']=_0x3da12c;return _0x365747;})[_0x8361('0x28')](respondWithFilteredResult(_0x4cc803,_0x48f779))[_0x8361('0x4a')](handleError(_0x4cc803,null));};exports[_0x8361('0x4b')]=function(_0x28b8e9,_0x4d8aac){var _0x558355={'raw':![],'where':{'id':_0x28b8e9['params']['id']}},_0x228615={};_0x228615['model']=_[_0x8361('0x4c')](db[_0x8361('0x32')]['rawAttributes']);_0x228615[_0x8361('0x39')]=_['keys'](_0x28b8e9[_0x8361('0x39')]);_0x228615['filters']=_['intersection'](_0x228615[_0x8361('0x37')],_0x228615[_0x8361('0x39')]);_0x558355[_0x8361('0x3c')]=_[_0x8361('0x3b')](_0x228615[_0x8361('0x37')],qs[_0x8361('0x3d')](_0x28b8e9['query'][_0x8361('0x3d')]));_0x558355[_0x8361('0x3c')]=_0x558355[_0x8361('0x3c')][_0x8361('0x3e')]?_0x558355['attributes']:_0x228615[_0x8361('0x37')];if(_0x28b8e9[_0x8361('0x39')][_0x8361('0x48')]){_0x558355[_0x8361('0x4d')]=[{'all':!![]}];}_0x558355=_[_0x8361('0x45')]({},_0x558355,_0x28b8e9['options']);return db[_0x8361('0x32')][_0x8361('0x4e')](_0x558355)[_0x8361('0x28')](handleEntityNotFound(_0x4d8aac,null))[_0x8361('0x28')](respondWithResult(_0x4d8aac,null))[_0x8361('0x4a')](handleError(_0x4d8aac,null));};exports[_0x8361('0x4f')]=function(_0x4c4cb6,_0x39397f){return db[_0x8361('0x32')][_0x8361('0x4f')](_0x4c4cb6[_0x8361('0x50')],{})[_0x8361('0x28')](function(_0x27e27a){var _0x5c6e7b=_0x4c4cb6[_0x8361('0x51')][_0x8361('0x2a')]({'plain':!![]});if(!_0x5c6e7b)throw new Error(_0x8361('0x52'));if(_0x5c6e7b[_0x8361('0x53')]===_0x8361('0x51')){var _0x4502a7=_0x27e27a[_0x8361('0x2a')]({'plain':!![]});var _0x554d68='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x554d68,'userProfileId':_0x5c6e7b[_0x8361('0x54')]},'raw':!![]})[_0x8361('0x28')](function(_0x2f428c){if(_0x2f428c&&_0x2f428c[_0x8361('0x55')]===0x0){return db['UserProfileResource'][_0x8361('0x4f')]({'name':_0x4502a7[_0x8361('0x2f')],'resourceId':_0x4502a7['id'],'type':_0x2f428c[_0x8361('0x2f')],'sectionId':_0x2f428c['id']},{})[_0x8361('0x28')](function(){return _0x27e27a;});}else{return _0x27e27a;}})[_0x8361('0x4a')](function(_0x57331f){logger[_0x8361('0x2d')](_0x8361('0x56'),_0x57331f);throw _0x57331f;});}return _0x27e27a;})['then'](respondWithResult(_0x39397f,0xc9))[_0x8361('0x4a')](handleError(_0x39397f,null));};exports[_0x8361('0x27')]=function(_0x44f978,_0x4b91a5){if(_0x44f978[_0x8361('0x50')]['id']){delete _0x44f978[_0x8361('0x50')]['id'];}return db[_0x8361('0x32')][_0x8361('0x4e')]({'where':{'id':_0x44f978[_0x8361('0x57')]['id']}})[_0x8361('0x28')](handleEntityNotFound(_0x4b91a5,null))[_0x8361('0x28')](saveUpdates(_0x44f978[_0x8361('0x50')],null))['then'](respondWithResult(_0x4b91a5,null))[_0x8361('0x4a')](handleError(_0x4b91a5,null));};exports[_0x8361('0x29')]=function(_0xa12cc9,_0x2c7b28){return db[_0x8361('0x32')][_0x8361('0x4e')]({'where':{'id':_0xa12cc9[_0x8361('0x57')]['id']}})[_0x8361('0x28')](handleEntityNotFound(_0x2c7b28,null))[_0x8361('0x28')](removeEntity(_0x2c7b28,null))[_0x8361('0x4a')](handleError(_0x2c7b28,null));};exports[_0x8361('0x58')]=function(_0x82388e,_0x2702b3,_0xb1409){var _0x21447f=require(_0x8361('0x59'));return db[_0x8361('0x32')][_0x8361('0x4e')]({'where':{'id':_0x82388e['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2702b3,null))[_0x8361('0x28')](function(){_0x21447f[_0x8361('0x58')](_0x82388e[_0x8361('0x57')]['id']);})['then'](respondWithStatusCode(_0x2702b3,null))[_0x8361('0x4a')](handleError(_0x2702b3,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 9482191..5331132 100644 --- a/server/api/schedule/schedule.model.js +++ b/server/api/schedule/schedule.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f6b=['./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x4f5374,_0x3d398e){var _0x4fc1d6=function(_0x13073d){while(--_0x13073d){_0x4f5374['push'](_0x4f5374['shift']());}};_0x4fc1d6(++_0x3d398e);}(_0x3f6b,0xb9));var _0xb3f6=function(_0x1570f8,_0x578077){_0x1570f8=_0x1570f8-0x0;var _0x496249=_0x3f6b[_0x1570f8];return _0x496249;};'use strict';var _=require(_0xb3f6('0x0'));var util=require(_0xb3f6('0x1'));var logger=require(_0xb3f6('0x2'))('api');var moment=require(_0xb3f6('0x3'));var BPromise=require('bluebird');var rp=require(_0xb3f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3f6('0x5'));var config=require(_0xb3f6('0x6'));var attributes=require(_0xb3f6('0x7'));module[_0xb3f6('0x8')]=function(_0x378e1b,_0x5496ea){return _0x378e1b[_0xb3f6('0x9')](_0xb3f6('0xa'),attributes,{'tableName':_0xb3f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c8a=['./schedule.attributes','Schedule','tools_schedules','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x599508,_0xff98c5){var _0xa7a8d6=function(_0xa4e236){while(--_0xa4e236){_0x599508['push'](_0x599508['shift']());}};_0xa7a8d6(++_0xff98c5);}(_0x8c8a,0x150));var _0xa8c8=function(_0x4d2abc,_0x29b228){_0x4d2abc=_0x4d2abc-0x0;var _0x5c4540=_0x8c8a[_0x4d2abc];return _0x5c4540;};'use strict';var _=require(_0xa8c8('0x0'));var util=require(_0xa8c8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa8c8('0x2'));var rp=require(_0xa8c8('0x3'));var fs=require('fs');var path=require(_0xa8c8('0x4'));var rimraf=require(_0xa8c8('0x5'));var config=require('../../config/environment');var attributes=require(_0xa8c8('0x6'));module['exports']=function(_0x49f92d,_0xfb5724){return _0x49f92d['define'](_0xa8c8('0x7'),attributes,{'tableName':_0xa8c8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index fb48b4f..bd16a75 100644 --- a/server/api/schedule/schedule.rpc.js +++ b/server/api/schedule/schedule.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7134=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Schedule,\x20%s,\x20%s','message','info','result','lodash','util','moment','randomstring'];(function(_0x281b3d,_0x159aac){var _0x5a196f=function(_0x2d18a4){while(--_0x2d18a4){_0x281b3d['push'](_0x281b3d['shift']());}};_0x5a196f(++_0x159aac);}(_0x7134,0x178));var _0x4713=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7134[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4713('0x0'));var util=require(_0x4713('0x1'));var moment=require(_0x4713('0x2'));var BPromise=require('bluebird');var rs=require(_0x4713('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4713('0x4'));var logger=require(_0x4713('0x5'))('rpc');var config=require(_0x4713('0x6'));var jayson=require(_0x4713('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55a980,_0xb7c79f,_0x108235){return new BPromise(function(_0x2612cd,_0x2cc245){return client['request'](_0x55a980,_0x108235)[_0x4713('0x8')](function(_0x55fcd7){logger['info']('Schedule,\x20%s,\x20%s',_0xb7c79f,'request\x20sent');logger[_0x4713('0x9')](_0x4713('0xa'),_0xb7c79f,_0x4713('0xb'),JSON[_0x4713('0xc')](_0x55fcd7));if(_0x55fcd7[_0x4713('0xd')]){if(_0x55fcd7[_0x4713('0xd')][_0x4713('0xe')]===0x1f4){logger['error'](_0x4713('0xf'),_0xb7c79f,_0x55fcd7['error'][_0x4713('0x10')]);return _0x2cc245(_0x55fcd7[_0x4713('0xd')][_0x4713('0x10')]);}logger[_0x4713('0xd')](_0x4713('0xf'),_0xb7c79f,_0x55fcd7[_0x4713('0xd')][_0x4713('0x10')]);return _0x2612cd(_0x55fcd7['error'][_0x4713('0x10')]);}else{logger[_0x4713('0x11')](_0x4713('0xf'),_0xb7c79f,'request\x20sent');_0x2612cd(_0x55fcd7[_0x4713('0x12')][_0x4713('0x10')]);}})['catch'](function(_0x5f3fe1){logger[_0x4713('0xd')](_0x4713('0xf'),_0xb7c79f,_0x5f3fe1);_0x2cc245(_0x5f3fe1);});});} \ No newline at end of file +var _0x2dc7=['Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug'];(function(_0x5b8d12,_0x50e01c){var _0x1929aa=function(_0x1c8b84){while(--_0x1c8b84){_0x5b8d12['push'](_0x5b8d12['shift']());}};_0x1929aa(++_0x50e01c);}(_0x2dc7,0x110));var _0x72dc=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0x2dc7[_0x174a72];return _0x32cecd;};'use strict';var _=require(_0x72dc('0x0'));var util=require(_0x72dc('0x1'));var moment=require(_0x72dc('0x2'));var BPromise=require(_0x72dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72dc('0x4'));var db=require(_0x72dc('0x5'))['db'];var utils=require(_0x72dc('0x6'));var logger=require('../../config/logger')(_0x72dc('0x7'));var config=require('../../config/environment');var jayson=require(_0x72dc('0x8'));var client=jayson[_0x72dc('0x9')][_0x72dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ebef6,_0x439b7d,_0x2639a6){return new BPromise(function(_0x92bf01,_0x332d0d){return client[_0x72dc('0xb')](_0x2ebef6,_0x2639a6)[_0x72dc('0xc')](function(_0xf931cb){logger[_0x72dc('0xd')](_0x72dc('0xe'),_0x439b7d,'request\x20sent');logger[_0x72dc('0xf')](_0x72dc('0x10'),_0x439b7d,_0x72dc('0x11'),JSON[_0x72dc('0x12')](_0xf931cb));if(_0xf931cb[_0x72dc('0x13')]){if(_0xf931cb[_0x72dc('0x13')][_0x72dc('0x14')]===0x1f4){logger[_0x72dc('0x13')](_0x72dc('0xe'),_0x439b7d,_0xf931cb[_0x72dc('0x13')]['message']);return _0x332d0d(_0xf931cb[_0x72dc('0x13')][_0x72dc('0x15')]);}logger[_0x72dc('0x13')](_0x72dc('0xe'),_0x439b7d,_0xf931cb[_0x72dc('0x13')]['message']);return _0x92bf01(_0xf931cb[_0x72dc('0x13')][_0x72dc('0x15')]);}else{logger[_0x72dc('0xd')](_0x72dc('0xe'),_0x439b7d,_0x72dc('0x11'));_0x92bf01(_0xf931cb[_0x72dc('0x16')][_0x72dc('0x15')]);}})[_0x72dc('0x17')](function(_0x10a535){logger[_0x72dc('0x13')](_0x72dc('0xe'),_0x439b7d,_0x10a535);_0x332d0d(_0x10a535);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 1e0c49a..a3fba76 100644 --- a/server/api/screenRecording/index.js +++ b/server/api/screenRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde10=['update','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','/:id','/:id/download','download','post','create'];(function(_0xdbd4f7,_0x4e3bdd){var _0x5c3f9d=function(_0xa7a35a){while(--_0xa7a35a){_0xdbd4f7['push'](_0xdbd4f7['shift']());}};_0x5c3f9d(++_0x4e3bdd);}(_0xde10,0x1bc));var _0x0de1=function(_0x1a8df9,_0x5151f2){_0x1a8df9=_0x1a8df9-0x0;var _0x3bb8fc=_0xde10[_0x1a8df9];return _0x3bb8fc;};'use strict';var multer=require(_0x0de1('0x0'));var util=require(_0x0de1('0x1'));var path=require(_0x0de1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0de1('0x3')]();var fs_extra=require(_0x0de1('0x4'));var auth=require(_0x0de1('0x5'));var interaction=require(_0x0de1('0x6'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x0de1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0de1('0x7')](_0x0de1('0x8'),auth[_0x0de1('0x9')](),controller['describe']);router['get'](_0x0de1('0xa'),auth[_0x0de1('0x9')](),controller['show']);router[_0x0de1('0x7')](_0x0de1('0xb'),auth['isAuthenticated'](),controller[_0x0de1('0xc')]);router[_0x0de1('0xd')]('/',auth[_0x0de1('0x9')](),controller[_0x0de1('0xe')]);router['put'](_0x0de1('0xa'),auth[_0x0de1('0x9')](),controller[_0x0de1('0xf')]);router['delete'](_0x0de1('0xa'),auth[_0x0de1('0x9')](),controller[_0x0de1('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe205=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','download'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0xe205,0xe2));var _0x5e20=function(_0x343e5a,_0x438aa6){_0x343e5a=_0x343e5a-0x0;var _0x37e87f=_0xe205[_0x343e5a];return _0x37e87f;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5e20('0x5'));var interaction=require(_0x5e20('0x6'));var config=require(_0x5e20('0x7'));var controller=require('./screenRecording.controller');router[_0x5e20('0x8')]('/',auth[_0x5e20('0x9')](),controller[_0x5e20('0xa')]);router['get'](_0x5e20('0xb'),auth['isAuthenticated'](),controller[_0x5e20('0xc')]);router['get'](_0x5e20('0xd'),auth[_0x5e20('0x9')](),controller[_0x5e20('0xe')]);router['get']('/:id/download',auth[_0x5e20('0x9')](),controller[_0x5e20('0xf')]);router[_0x5e20('0x10')]('/',auth['isAuthenticated'](),controller[_0x5e20('0x11')]);router[_0x5e20('0x12')](_0x5e20('0xd'),auth['isAuthenticated'](),controller[_0x5e20('0x13')]);router[_0x5e20('0x14')]('/:id',auth[_0x5e20('0x9')](),controller[_0x5e20('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 40d2761..954cb34 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eef=['DATE','createdAt','updatedAt','path','exports','getDataValue','value','extname','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x5eef,0x9c));var _0xf5ee=function(_0x2b3d9d,_0x2eef26){_0x2b3d9d=_0x2b3d9d-0x0;var _0x505a2b=_0x5eef[_0x2b3d9d];return _0x505a2b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0xf5ee('0x0'));var config=require('../../config/environment');module[_0xf5ee('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xf5ee('0x2')](_0xf5ee('0x3'))?path[_0xf5ee('0x4')](this[_0xf5ee('0x2')](_0xf5ee('0x3'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x3ae819){var _0x24e3a5=_0x3ae819['replace'](/\\/g,'/');this[_0xf5ee('0x5')](_0xf5ee('0x3'),_0x24e3a5);}},'rating':{'type':Sequelize[_0xf5ee('0x6')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xf5ee('0x6')],'set':function(_0x125def){this[_0xf5ee('0x5')](_0xf5ee('0x7'),moment()[_0xf5ee('0x8')](_0x125def,'ms'));this[_0xf5ee('0x5')](_0xf5ee('0x9'),moment());this['setDataValue'](_0xf5ee('0xa'),_0x125def);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xf5ee('0x2')]('startedAt'))[_0xf5ee('0xb')](_0xf5ee('0xc'))[_0xf5ee('0xd')]();}},'closedAt':{'type':Sequelize[_0xf5ee('0xe')],'get':function(){return moment(this['getDataValue'](_0xf5ee('0x9')))[_0xf5ee('0xb')](_0xf5ee('0xc'))[_0xf5ee('0xd')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xf5ee('0xf')))[_0xf5ee('0xb')](_0xf5ee('0xc'))[_0xf5ee('0xd')]();}},'updatedAt':{'type':Sequelize[_0xf5ee('0xe')],'get':function(){return moment(this['getDataValue'](_0xf5ee('0x10')))[_0xf5ee('0xb')]('MM-DD-YYYY\x20HH:mm')[_0xf5ee('0xd')]();}}}; \ No newline at end of file +var _0xda20=['VIRTUAL','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda20,0x1d9));var _0x0da2=function(_0x58ed03,_0x5d0c77){_0x58ed03=_0x58ed03-0x0;var _0x26d26f=_0xda20[_0x58ed03];return _0x26d26f;};'use strict';var Sequelize=require(_0x0da2('0x0'));var moment=require('moment');var path=require(_0x0da2('0x1'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x0da2('0x2')],'get':function(){return this['getDataValue'](_0x0da2('0x3'))?path[_0x0da2('0x4')](this['getDataValue'](_0x0da2('0x3'))):undefined;}},'interactionid':{'type':Sequelize[_0x0da2('0x5')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x0da2('0x5')],'set':function(_0x292ede){var _0x166a32=_0x292ede[_0x0da2('0x6')](/\\/g,'/');this[_0x0da2('0x7')](_0x0da2('0x3'),_0x166a32);}},'rating':{'type':Sequelize[_0x0da2('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0da2('0x8')],'set':function(_0x248bce){this['setDataValue'](_0x0da2('0x9'),moment()[_0x0da2('0xa')](_0x248bce,'ms'));this[_0x0da2('0x7')](_0x0da2('0xb'),moment());this['setDataValue']('duration',_0x248bce);}},'startedAt':{'type':Sequelize[_0x0da2('0xc')],'get':function(){return moment(this[_0x0da2('0xd')](_0x0da2('0x9')))[_0x0da2('0xe')](_0x0da2('0xf'))[_0x0da2('0x10')]();}},'closedAt':{'type':Sequelize[_0x0da2('0xc')],'get':function(){return moment(this['getDataValue'](_0x0da2('0xb')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x0da2('0xc')],'get':function(){return moment(this['getDataValue'](_0x0da2('0x11')))[_0x0da2('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x0da2('0x10')]();}},'updatedAt':{'type':Sequelize[_0x0da2('0xc')],'get':function(){return moment(this['getDataValue'](_0x0da2('0x12')))[_0x0da2('0xe')](_0x0da2('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index a1a20b4..e1a4dfd 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd50=['unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','update','duration','value','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','recording','server/files/screen_recordings','ValidationError','filename','extname','download','unlink','message','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x424aa8,_0x44d3cc){var _0x363cd3=function(_0xa39f2e){while(--_0xa39f2e){_0x424aa8['push'](_0x424aa8['shift']());}};_0x363cd3(++_0x44d3cc);}(_0xbd50,0x196));var _0x0bd5=function(_0x5e6ec1,_0x33ef76){_0x5e6ec1=_0x5e6ec1-0x0;var _0x97518b=_0xbd50[_0x5e6ec1];return _0x97518b;};'use strict';var emlformat=require(_0x0bd5('0x0'));var rimraf=require(_0x0bd5('0x1'));var zipdir=require(_0x0bd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd5('0x3'));var moment=require(_0x0bd5('0x4'));var BPromise=require(_0x0bd5('0x5'));var Mustache=require(_0x0bd5('0x6'));var util=require(_0x0bd5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bd5('0x8'));var fs=require('fs');var fs_extra=require(_0x0bd5('0x9'));var _=require(_0x0bd5('0xa'));var squel=require(_0x0bd5('0xb'));var crypto=require(_0x0bd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0xd'));var querystring=require(_0x0bd5('0xe'));var Papa=require(_0x0bd5('0xf'));var Redis=require('ioredis');var authService=require(_0x0bd5('0x10'));var qs=require(_0x0bd5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bd5('0x12'));var logger=require(_0x0bd5('0x13'))('api');var utils=require(_0x0bd5('0x14'));var config=require(_0x0bd5('0x15'));var licenseUtil=require(_0x0bd5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f7a0c,_0x23982f){_0x23982f=_0x23982f||0xcc;return function(_0x2f9588){if(_0x2f9588){return _0x2f7a0c[_0x0bd5('0x17')](_0x23982f);}return _0x2f7a0c[_0x0bd5('0x18')](_0x23982f)[_0x0bd5('0x19')]();};}function respondWithResult(_0x30765e,_0x1e961d){_0x1e961d=_0x1e961d||0xc8;return function(_0x4f485b){if(_0x4f485b){return _0x30765e[_0x0bd5('0x18')](_0x1e961d)[_0x0bd5('0x1a')](_0x4f485b);}};}function respondWithFilteredResult(_0x574315,_0x31349f){return function(_0x23ef4e){if(_0x23ef4e){var _0x3a34e4=typeof _0x31349f[_0x0bd5('0x1b')]==='undefined'&&typeof _0x31349f[_0x0bd5('0x1c')]===_0x0bd5('0x1d');var _0xa890be=_0x23ef4e[_0x0bd5('0x1e')];var _0x833c14=_0x3a34e4?0x0:_0x31349f[_0x0bd5('0x1b')];var _0xc58e12=_0x3a34e4?_0x23ef4e[_0x0bd5('0x1e')]:_0x31349f[_0x0bd5('0x1b')]+_0x31349f[_0x0bd5('0x1c')];var _0x27bc1e;if(_0xc58e12>=_0xa890be){_0xc58e12=_0xa890be;_0x27bc1e=0xc8;}else{_0x27bc1e=0xce;}_0x574315[_0x0bd5('0x18')](_0x27bc1e);return _0x574315[_0x0bd5('0x1f')](_0x0bd5('0x20'),_0x833c14+'-'+_0xc58e12+'/'+_0xa890be)['json'](_0x23ef4e);}return null;};}function patchUpdates(_0x5ba943){return function(_0x596b6a){try{jsonpatch['apply'](_0x596b6a,_0x5ba943,!![]);}catch(_0x47d74a){return BPromise[_0x0bd5('0x21')](_0x47d74a);}return _0x596b6a[_0x0bd5('0x22')]();};}function saveUpdates(_0x13ce46,_0x4a6910){return function(_0x6ee1a8){if(_0x6ee1a8){return _0x6ee1a8['update'](_0x13ce46)[_0x0bd5('0x23')](function(_0x3b235b){return _0x3b235b;});}return null;};}function removeEntity(_0x38c21d,_0x5a8139){return function(_0x5b6dde){if(_0x5b6dde){return _0x5b6dde['destroy']()['then'](function(){_0x38c21d[_0x0bd5('0x18')](0xcc)[_0x0bd5('0x19')]();});}};}function handleEntityNotFound(_0x184db3,_0x4fde84){return function(_0x42428c){if(!_0x42428c){_0x184db3['sendStatus'](0x194);}return _0x42428c;};}function handleError(_0x456e87,_0x3ffb08){_0x3ffb08=_0x3ffb08||0x1f4;return function(_0x18cec3){logger[_0x0bd5('0x24')](_0x18cec3[_0x0bd5('0x25')]);if(_0x18cec3[_0x0bd5('0x26')]){delete _0x18cec3[_0x0bd5('0x26')];}_0x456e87[_0x0bd5('0x18')](_0x3ffb08)[_0x0bd5('0x27')](_0x18cec3);};}exports[_0x0bd5('0x28')]=function(_0x15561b,_0xcbfc51){var _0x2e10ce={},_0x2704ee={},_0x5e5a33={'count':0x0,'rows':[]};var _0x461ae3=_[_0x0bd5('0x29')](db['ScreenRecording'][_0x0bd5('0x2a')],function(_0x8eccc9){return{'name':_0x8eccc9['fieldName'],'type':_0x8eccc9[_0x0bd5('0x2b')][_0x0bd5('0x2c')]};});_0x2704ee[_0x0bd5('0x2d')]=_[_0x0bd5('0x2e')](_['map'](_0x461ae3,_0x0bd5('0x26')),[_0x0bd5('0x2f')]);_0x2704ee[_0x0bd5('0x30')]=_[_0x0bd5('0x31')](_0x15561b[_0x0bd5('0x30')]);_0x2704ee[_0x0bd5('0x32')]=_['intersection'](_0x2704ee[_0x0bd5('0x2d')],_0x2704ee['query']);_0x2e10ce[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x2704ee[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x35')]));_0x2e10ce[_0x0bd5('0x33')]=_0x2e10ce[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x2e10ce[_0x0bd5('0x33')]:_0x2704ee[_0x0bd5('0x2d')];if(!_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x37')]('nolimit')){_0x2e10ce[_0x0bd5('0x1c')]=qs[_0x0bd5('0x1c')](_0x15561b['query']['limit']);_0x2e10ce[_0x0bd5('0x1b')]=qs[_0x0bd5('0x1b')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x1b')]);}_0x2e10ce[_0x0bd5('0x38')]=qs[_0x0bd5('0x39')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x39')]);_0x2e10ce[_0x0bd5('0x3a')]=qs[_0x0bd5('0x32')](_[_0x0bd5('0x3b')](_0x15561b[_0x0bd5('0x30')],_0x2704ee[_0x0bd5('0x32')]),_0x461ae3);if(_0x15561b['query'][_0x0bd5('0x3c')]){_0x2e10ce['where']=_[_0x0bd5('0x3d')](_0x2e10ce[_0x0bd5('0x3a')],{'$or':_[_0x0bd5('0x29')](_0x461ae3,function(_0x1fcc49){if(_0x1fcc49[_0x0bd5('0x2b')]!==_0x0bd5('0x3e')){var _0x53a682={};_0x53a682[_0x1fcc49[_0x0bd5('0x26')]]={'$like':'%'+_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x3c')]+'%'};return _0x53a682;}})});}_0x2e10ce=_[_0x0bd5('0x3d')]({},_0x2e10ce,_0x15561b[_0x0bd5('0x3f')]);var _0x493089={'where':_0x2e10ce[_0x0bd5('0x3a')]};return db[_0x0bd5('0x40')][_0x0bd5('0x1e')](_0x493089)['then'](function(_0x177aa3){_0x5e5a33['count']=_0x177aa3;if(_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x41')]){_0x2e10ce['include']=[{'all':!![]}];}return db[_0x0bd5('0x40')][_0x0bd5('0x42')](_0x2e10ce);})[_0x0bd5('0x23')](function(_0x3ec4b0){_0x5e5a33[_0x0bd5('0x43')]=_0x3ec4b0;return _0x5e5a33;})[_0x0bd5('0x23')](respondWithFilteredResult(_0xcbfc51,_0x2e10ce))[_0x0bd5('0x44')](handleError(_0xcbfc51,null));};exports['show']=function(_0x4d3ca5,_0x994f24){var _0x545b63={'raw':![],'where':{'id':_0x4d3ca5[_0x0bd5('0x45')]['id']}},_0x5dd42b={};_0x5dd42b[_0x0bd5('0x2d')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x5dd42b[_0x0bd5('0x30')]=_['keys'](_0x4d3ca5['query']);_0x5dd42b[_0x0bd5('0x32')]=_[_0x0bd5('0x34')](_0x5dd42b['model'],_0x5dd42b['query']);_0x545b63[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x5dd42b[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x4d3ca5['query'][_0x0bd5('0x35')]));_0x545b63[_0x0bd5('0x33')]=_0x545b63[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x545b63[_0x0bd5('0x33')]:_0x5dd42b[_0x0bd5('0x2d')];if(_0x4d3ca5['query'][_0x0bd5('0x41')]){_0x545b63[_0x0bd5('0x46')]=[{'all':!![]}];}_0x545b63=_[_0x0bd5('0x3d')]({},_0x545b63,_0x4d3ca5['options']);return db[_0x0bd5('0x40')][_0x0bd5('0x47')](_0x545b63)[_0x0bd5('0x23')](handleEntityNotFound(_0x994f24,null))['then'](respondWithResult(_0x994f24,null))[_0x0bd5('0x44')](handleError(_0x994f24,null));};exports[_0x0bd5('0x48')]=function(_0x54cd78,_0x18c7c7){return db[_0x0bd5('0x40')]['create'](_0x54cd78[_0x0bd5('0x49')],{})[_0x0bd5('0x23')](respondWithResult(_0x18c7c7,0xc9))['catch'](handleError(_0x18c7c7,null));};exports[_0x0bd5('0x4a')]=function(_0x20960a,_0x146bdc){if(_0x20960a[_0x0bd5('0x49')]['id']){delete _0x20960a[_0x0bd5('0x49')]['id'];}delete _0x20960a['body'][_0x0bd5('0x4b')];delete _0x20960a[_0x0bd5('0x49')]['createdAt'];delete _0x20960a[_0x0bd5('0x49')]['closedAt'];delete _0x20960a[_0x0bd5('0x49')][_0x0bd5('0x4c')];return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x20960a['params']['id']}})[_0x0bd5('0x23')](handleEntityNotFound(_0x146bdc,null))['then'](saveUpdates(_0x20960a['body'],null))[_0x0bd5('0x23')](respondWithResult(_0x146bdc,null))[_0x0bd5('0x44')](handleError(_0x146bdc,null));};exports[_0x0bd5('0x4d')]=function(_0x4c9a79,_0x424187){return db['ScreenRecording'][_0x0bd5('0x4d')]()[_0x0bd5('0x23')](respondWithResult(_0x424187,null))[_0x0bd5('0x44')](handleError(_0x424187,null));};exports['download']=function(_0x512fe3,_0x4f0467,_0x122f84){var _0x21db5d=require(_0x0bd5('0x4e'));var _0x5b06c6=![];var _0x2b174a={};if(_0x512fe3[_0x0bd5('0x30')]['type']&&_0x512fe3[_0x0bd5('0x30')]['type']==='uniqueid'){_0x2b174a[_0x0bd5('0x4f')]=_0x512fe3[_0x0bd5('0x45')]['id'];}else{_0x2b174a['id']=_0x512fe3[_0x0bd5('0x45')]['id'];}return db[_0x0bd5('0x40')]['find']({'where':_0x2b174a,'attributes':['id',_0x0bd5('0x4c')],'raw':!![]})[_0x0bd5('0x23')](handleEntityNotFound(_0x4f0467,null))[_0x0bd5('0x23')](function(_0x5cf2f2){if(_0x5cf2f2){var _0x504e46=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],'server/files/screen_recordings',_0x5cf2f2['value']);var _0x2b11e8=util['format'](_0x0bd5('0x52'),_0x504e46);if(fs[_0x0bd5('0x53')](_0x2b11e8)){_0x5b06c6=!![];return _0x21db5d[_0x0bd5('0x54')](_0x2b11e8,_0x504e46,config['secrets'][_0x0bd5('0x55')])[_0x0bd5('0x23')](function(){return _0x5cf2f2;});}return _0x5cf2f2;}})[_0x0bd5('0x23')](function(_0x38aae5){if(_0x38aae5){var _0x5e93fa=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],_0x0bd5('0x56'),_0x38aae5[_0x0bd5('0x4c')]);if(!fs[_0x0bd5('0x53')](_0x5e93fa)){throw new db['Sequelize'][(_0x0bd5('0x57'))]('ScreenRecording\x20not\x20found');}if(_0x38aae5[_0x0bd5('0x58')]){return _0x4f0467['download'](_0x5e93fa,_0x38aae5['filename']+path[_0x0bd5('0x59')](_0x5e93fa),function(){if(_0x5b06c6){fs['unlink'](_0x5e93fa);}});}else{return _0x4f0467[_0x0bd5('0x5a')](_0x5e93fa,function(_0x3087de){if(_0x5b06c6){fs[_0x0bd5('0x5b')](_0x5e93fa);}});}}})['catch'](function(_0x4f7e86){if(_0x4f7e86[_0x0bd5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x4f0467[_0x0bd5('0x18')](0x194)[_0x0bd5('0x27')]('Not\x20found');}else{return handleError(_0x4f0467,null);}});};exports[_0x0bd5('0x5d')]=function(_0x5a38b1,_0x45ccf5){return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x5a38b1[_0x0bd5('0x45')]['id']}})[_0x0bd5('0x23')](function(_0x467488){if(_[_0x0bd5('0x5e')](_0x467488)){throw new ReferenceError('Entity\x20not\x20found');}return _0x467488;})[_0x0bd5('0x23')](function(_0x1e5e7d){var _0x33c5eb=path['join'](config['root'],_0x0bd5('0x56'),_0x1e5e7d[_0x0bd5('0x4c')]);logger[_0x0bd5('0x5f')](_0x0bd5('0x60'),_0x33c5eb);if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs[_0x0bd5('0x63')](_0x33c5eb);}_0x33c5eb=_0x33c5eb+_0x0bd5('0x64');if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs['unlinkSync'](_0x33c5eb);}return _0x1e5e7d;})[_0x0bd5('0x23')](function(_0x32eaaf){if(!_0x32eaaf)throw new InternalError();return _0x32eaaf['destroy']();})[_0x0bd5('0x23')](function(){_0x45ccf5['status'](0xcc)[_0x0bd5('0x19')]();})[_0x0bd5('0x44')](handleError(_0x45ccf5,null));}; \ No newline at end of file +var _0x3eea=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','format','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','download','filename','extname','Not\x20found','isNil','root','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys'];(function(_0x49397c,_0x5054a8){var _0x3c4bbc=function(_0x4d3c80){while(--_0x4d3c80){_0x49397c['push'](_0x49397c['shift']());}};_0x3c4bbc(++_0x5054a8);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x18f668,_0x501235){_0x18f668=_0x18f668-0x0;var _0x36d137=_0x3eea[_0x18f668];return _0x36d137;};'use strict';var emlformat=require(_0xa3ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3ee('0x1'));var jsonpatch=require(_0xa3ee('0x2'));var rp=require(_0xa3ee('0x3'));var moment=require(_0xa3ee('0x4'));var BPromise=require(_0xa3ee('0x5'));var Mustache=require(_0xa3ee('0x6'));var util=require(_0xa3ee('0x7'));var path=require(_0xa3ee('0x8'));var sox=require(_0xa3ee('0x9'));var csv=require(_0xa3ee('0xa'));var ejs=require(_0xa3ee('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xa'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa3ee('0x14'));var db=require(_0xa3ee('0x15'))['db'];function respondWithStatusCode(_0x403518,_0x4363d1){_0x4363d1=_0x4363d1||0xcc;return function(_0x594c88){if(_0x594c88){return _0x403518[_0xa3ee('0x16')](_0x4363d1);}return _0x403518['status'](_0x4363d1)[_0xa3ee('0x17')]();};}function respondWithResult(_0x20535f,_0x2c34cf){_0x2c34cf=_0x2c34cf||0xc8;return function(_0x150e20){if(_0x150e20){return _0x20535f['status'](_0x2c34cf)[_0xa3ee('0x18')](_0x150e20);}};}function respondWithFilteredResult(_0x23df7d,_0x5da681){return function(_0x5358aa){if(_0x5358aa){var _0x4b2c66=typeof _0x5da681[_0xa3ee('0x19')]===_0xa3ee('0x1a')&&typeof _0x5da681[_0xa3ee('0x1b')]===_0xa3ee('0x1a');var _0x4cc8bb=_0x5358aa[_0xa3ee('0x1c')];var _0x40ffdb=_0x4b2c66?0x0:_0x5da681[_0xa3ee('0x19')];var _0x299b1e=_0x4b2c66?_0x5358aa[_0xa3ee('0x1c')]:_0x5da681['offset']+_0x5da681[_0xa3ee('0x1b')];var _0x18b738;if(_0x299b1e>=_0x4cc8bb){_0x299b1e=_0x4cc8bb;_0x18b738=0xc8;}else{_0x18b738=0xce;}_0x23df7d[_0xa3ee('0x1d')](_0x18b738);return _0x23df7d[_0xa3ee('0x1e')](_0xa3ee('0x1f'),_0x40ffdb+'-'+_0x299b1e+'/'+_0x4cc8bb)[_0xa3ee('0x18')](_0x5358aa);}return null;};}function patchUpdates(_0x4f8c56){return function(_0x3f5d70){try{jsonpatch[_0xa3ee('0x20')](_0x3f5d70,_0x4f8c56,!![]);}catch(_0x4b8445){return BPromise[_0xa3ee('0x21')](_0x4b8445);}return _0x3f5d70['save']();};}function saveUpdates(_0x2fab5,_0x29df43){return function(_0x1d3022){if(_0x1d3022){return _0x1d3022[_0xa3ee('0x22')](_0x2fab5)[_0xa3ee('0x23')](function(_0x47108f){return _0x47108f;});}return null;};}function removeEntity(_0x3ce61b,_0x12108e){return function(_0x5ae0a1){if(_0x5ae0a1){return _0x5ae0a1[_0xa3ee('0x24')]()['then'](function(){_0x3ce61b[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();});}};}function handleEntityNotFound(_0x157071,_0x1fe4b4){return function(_0x2c48db){if(!_0x2c48db){_0x157071['sendStatus'](0x194);}return _0x2c48db;};}function handleError(_0x3c68f9,_0x1b766e){_0x1b766e=_0x1b766e||0x1f4;return function(_0x146493){logger[_0xa3ee('0x25')](_0x146493[_0xa3ee('0x26')]);if(_0x146493[_0xa3ee('0x27')]){delete _0x146493[_0xa3ee('0x27')];}_0x3c68f9[_0xa3ee('0x1d')](_0x1b766e)[_0xa3ee('0x28')](_0x146493);};}exports[_0xa3ee('0x29')]=function(_0x59c6f9,_0x5ba571){var _0x4abf49={},_0x78e581={},_0x481358={'count':0x0,'rows':[]};var _0x3fa094=_[_0xa3ee('0x2a')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')],function(_0x26b222){return{'name':_0x26b222[_0xa3ee('0x2d')],'type':_0x26b222[_0xa3ee('0x2e')][_0xa3ee('0x2f')]};});_0x78e581[_0xa3ee('0x30')]=_[_0xa3ee('0x31')](_['map'](_0x3fa094,_0xa3ee('0x27')),['format']);_0x78e581[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x59c6f9['query']);_0x78e581[_0xa3ee('0x34')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],_0x78e581['query']);_0x4abf49[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x78e581[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x59c6f9[_0xa3ee('0x32')]['fields']));_0x4abf49[_0xa3ee('0x35')]=_0x4abf49[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x4abf49['attributes']:_0x78e581[_0xa3ee('0x30')];if(!_0x59c6f9['query'][_0xa3ee('0x39')]('nolimit')){_0x4abf49[_0xa3ee('0x1b')]=qs['limit'](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x1b')]);_0x4abf49[_0xa3ee('0x19')]=qs[_0xa3ee('0x19')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x19')]);}_0x4abf49[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3b')]);_0x4abf49[_0xa3ee('0x3c')]=qs[_0xa3ee('0x34')](_[_0xa3ee('0x3d')](_0x59c6f9['query'],_0x78e581[_0xa3ee('0x34')]),_0x3fa094);if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]){_0x4abf49[_0xa3ee('0x3c')]=_['merge'](_0x4abf49[_0xa3ee('0x3c')],{'$or':_[_0xa3ee('0x2a')](_0x3fa094,function(_0x1a9b63){if(_0x1a9b63['type']!==_0xa3ee('0x3f')){var _0x3554eb={};_0x3554eb[_0x1a9b63['name']]={'$like':'%'+_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]+'%'};return _0x3554eb;}})});}_0x4abf49=_['merge']({},_0x4abf49,_0x59c6f9[_0xa3ee('0x40')]);var _0x6dd235={'where':_0x4abf49[_0xa3ee('0x3c')]};return db[_0xa3ee('0x2b')][_0xa3ee('0x1c')](_0x6dd235)[_0xa3ee('0x23')](function(_0x2ca04f){_0x481358[_0xa3ee('0x1c')]=_0x2ca04f;if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x41')]){_0x4abf49[_0xa3ee('0x42')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x4abf49);})['then'](function(_0x45aeec){_0x481358[_0xa3ee('0x43')]=_0x45aeec;return _0x481358;})['then'](respondWithFilteredResult(_0x5ba571,_0x4abf49))[_0xa3ee('0x44')](handleError(_0x5ba571,null));};exports[_0xa3ee('0x45')]=function(_0x279834,_0x55f47f){var _0x1af10b={'raw':![],'where':{'id':_0x279834[_0xa3ee('0x46')]['id']}},_0x559cc1={};_0x559cc1[_0xa3ee('0x30')]=_[_0xa3ee('0x33')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')]);_0x559cc1[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x279834[_0xa3ee('0x32')]);_0x559cc1[_0xa3ee('0x34')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],_0x559cc1[_0xa3ee('0x32')]);_0x1af10b[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x279834[_0xa3ee('0x32')][_0xa3ee('0x37')]));_0x1af10b['attributes']=_0x1af10b[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x1af10b[_0xa3ee('0x35')]:_0x559cc1[_0xa3ee('0x30')];if(_0x279834['query'][_0xa3ee('0x41')]){_0x1af10b['include']=[{'all':!![]}];}_0x1af10b=_[_0xa3ee('0x47')]({},_0x1af10b,_0x279834[_0xa3ee('0x40')]);return db[_0xa3ee('0x2b')][_0xa3ee('0x48')](_0x1af10b)[_0xa3ee('0x23')](handleEntityNotFound(_0x55f47f,null))[_0xa3ee('0x23')](respondWithResult(_0x55f47f,null))[_0xa3ee('0x44')](handleError(_0x55f47f,null));};exports[_0xa3ee('0x49')]=function(_0x3c3677,_0xd6160e){return db['ScreenRecording'][_0xa3ee('0x49')](_0x3c3677['body'],{})['then'](respondWithResult(_0xd6160e,0xc9))[_0xa3ee('0x44')](handleError(_0xd6160e,null));};exports[_0xa3ee('0x22')]=function(_0x45029f,_0x1ec479){if(_0x45029f[_0xa3ee('0x4a')]['id']){delete _0x45029f[_0xa3ee('0x4a')]['id'];}delete _0x45029f[_0xa3ee('0x4a')]['duration'];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4b')];delete _0x45029f['body'][_0xa3ee('0x4c')];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x45029f[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](handleEntityNotFound(_0x1ec479,null))[_0xa3ee('0x23')](saveUpdates(_0x45029f[_0xa3ee('0x4a')],null))[_0xa3ee('0x23')](respondWithResult(_0x1ec479,null))['catch'](handleError(_0x1ec479,null));};exports['describe']=function(_0x15b55e,_0x441b23){return db['ScreenRecording'][_0xa3ee('0x4e')]()[_0xa3ee('0x23')](respondWithResult(_0x441b23,null))[_0xa3ee('0x44')](handleError(_0x441b23,null));};exports['download']=function(_0x505444,_0x2388f7,_0x49057c){var _0x172a73=require(_0xa3ee('0x4f'));var _0x5b8e79=![];var _0x4232e0={};if(_0x505444[_0xa3ee('0x32')][_0xa3ee('0x2e')]&&_0x505444['query'][_0xa3ee('0x2e')]===_0xa3ee('0x50')){_0x4232e0['uniqueid']=_0x505444[_0xa3ee('0x46')]['id'];}else{_0x4232e0['id']=_0x505444[_0xa3ee('0x46')]['id'];}return db[_0xa3ee('0x2b')]['find']({'where':_0x4232e0,'attributes':['id','value'],'raw':!![]})[_0xa3ee('0x23')](handleEntityNotFound(_0x2388f7,null))[_0xa3ee('0x23')](function(_0x4a1a2f){if(_0x4a1a2f){var _0x1f9913=path[_0xa3ee('0x51')](config['root'],'server/files/screen_recordings',_0x4a1a2f[_0xa3ee('0x4d')]);var _0x659491=util[_0xa3ee('0x52')]('%s.cypher',_0x1f9913);if(fs[_0xa3ee('0x53')](_0x659491)){_0x5b8e79=!![];return _0x172a73[_0xa3ee('0x54')](_0x659491,_0x1f9913,config[_0xa3ee('0x55')][_0xa3ee('0x56')])[_0xa3ee('0x23')](function(){return _0x4a1a2f;});}return _0x4a1a2f;}})[_0xa3ee('0x23')](function(_0x497be4){if(_0x497be4){var _0x10f508=path[_0xa3ee('0x51')](config['root'],_0xa3ee('0x57'),_0x497be4[_0xa3ee('0x4d')]);if(!fs[_0xa3ee('0x53')](_0x10f508)){throw new db[(_0xa3ee('0x58'))][(_0xa3ee('0x59'))](_0xa3ee('0x5a'));}if(_0x497be4['filename']){return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,_0x497be4[_0xa3ee('0x5c')]+path[_0xa3ee('0x5d')](_0x10f508),function(){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}else{return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,function(_0x13b81b){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}}})['catch'](function(_0x4df186){if(_0x4df186['message']===_0xa3ee('0x5a')){_0x2388f7[_0xa3ee('0x1d')](0x194)[_0xa3ee('0x28')](_0xa3ee('0x5e'));}else{return handleError(_0x2388f7,null);}});};exports[_0xa3ee('0x24')]=function(_0x18a164,_0x4000ee){return db['ScreenRecording'][_0xa3ee('0x48')]({'where':{'id':_0x18a164[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](function(_0xaff641){if(_[_0xa3ee('0x5f')](_0xaff641)){throw new ReferenceError('Entity\x20not\x20found');}return _0xaff641;})['then'](function(_0x7b1e97){var _0x303b71=path[_0xa3ee('0x51')](config[_0xa3ee('0x60')],_0xa3ee('0x57'),_0x7b1e97[_0xa3ee('0x4d')]);logger[_0xa3ee('0x61')](_0xa3ee('0x62'),_0x303b71);if(!_[_0xa3ee('0x5f')](_0x7b1e97[_0xa3ee('0x4d')])&&fs[_0xa3ee('0x53')](_0x303b71)){logger[_0xa3ee('0x61')](_0xa3ee('0x63')+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}_0x303b71=_0x303b71+'.cypher';if(!_[_0xa3ee('0x5f')](_0x7b1e97['value'])&&fs['existsSync'](_0x303b71)){logger[_0xa3ee('0x61')]('File:\x20\x22'+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}return _0x7b1e97;})[_0xa3ee('0x23')](function(_0x221deb){if(!_0x221deb)throw new InternalError();return _0x221deb['destroy']();})[_0xa3ee('0x23')](function(){_0x4000ee[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();})[_0xa3ee('0x44')](handleError(_0x4000ee,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index aa67645..037bff0 100644 --- a/server/api/screenRecording/screenRecording.model.js +++ b/server/api/screenRecording/screenRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d6f=['exports','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x4d4c7f,_0x42c05a){var _0x429bdb=function(_0x513e21){while(--_0x513e21){_0x4d4c7f['push'](_0x4d4c7f['shift']());}};_0x429bdb(++_0x42c05a);}(_0x4d6f,0x171));var _0xf4d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d6f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf4d6('0x0'));var logger=require(_0xf4d6('0x1'))(_0xf4d6('0x2'));var moment=require('moment');var BPromise=require(_0xf4d6('0x3'));var rp=require(_0xf4d6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf4d6('0x5'));var config=require(_0xf4d6('0x6'));var attributes=require(_0xf4d6('0x7'));module[_0xf4d6('0x8')]=function(_0x17dad2,_0x1fe3ef){return _0x17dad2[_0xf4d6('0x9')](_0xf4d6('0xa'),attributes,{'tableName':_0xf4d6('0xb'),'paranoid':![],'indexes':[{'name':_0xf4d6('0xc'),'fields':[_0xf4d6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb60d=['moment','bluebird','request-promise','rimraf','define','ScreenRecording','lodash','util','../../config/logger','api'];(function(_0x147342,_0x5698d3){var _0x5c4434=function(_0x36b5ef){while(--_0x36b5ef){_0x147342['push'](_0x147342['shift']());}};_0x5c4434(++_0x5698d3);}(_0xb60d,0x100));var _0xdb60=function(_0x342217,_0x1cbbd7){_0x342217=_0x342217-0x0;var _0x2098bc=_0xb60d[_0x342217];return _0x2098bc;};'use strict';var _=require(_0xdb60('0x0'));var util=require(_0xdb60('0x1'));var logger=require(_0xdb60('0x2'))(_0xdb60('0x3'));var moment=require(_0xdb60('0x4'));var BPromise=require(_0xdb60('0x5'));var rp=require(_0xdb60('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb60('0x7'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module['exports']=function(_0x4cc120,_0x4de7d2){return _0x4cc120[_0xdb60('0x8')](_0xdb60('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 434ea62..6186c91 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c8f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x6fd8ad,_0x597818){var _0x257d21=function(_0x2aad69){while(--_0x2aad69){_0x6fd8ad['push'](_0x6fd8ad['shift']());}};_0x257d21(++_0x597818);}(_0x6c8f,0x14b));var _0xf6c8=function(_0x1c1a8e,_0x445e99){_0x1c1a8e=_0x1c1a8e-0x0;var _0x608b56=_0x6c8f[_0x1c1a8e];return _0x608b56;};'use strict';var _=require(_0xf6c8('0x0'));var util=require(_0xf6c8('0x1'));var moment=require(_0xf6c8('0x2'));var BPromise=require(_0xf6c8('0x3'));var rs=require(_0xf6c8('0x4'));var fs=require('fs');var Redis=require(_0xf6c8('0x5'));var db=require(_0xf6c8('0x6'))['db'];var utils=require(_0xf6c8('0x7'));var logger=require(_0xf6c8('0x8'))(_0xf6c8('0x9'));var config=require(_0xf6c8('0xa'));var jayson=require(_0xf6c8('0xb'));var client=jayson[_0xf6c8('0xc')][_0xf6c8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x25724c,_0x388ed3,_0x394d4c){return new BPromise(function(_0x5093c1,_0x3472ca){return client['request'](_0x25724c,_0x394d4c)[_0xf6c8('0xe')](function(_0x3b0a9e){logger[_0xf6c8('0xf')](_0xf6c8('0x10'),_0x388ed3,'request\x20sent');logger[_0xf6c8('0x11')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x388ed3,_0xf6c8('0x12'),JSON['stringify'](_0x3b0a9e));if(_0x3b0a9e[_0xf6c8('0x13')]){if(_0x3b0a9e[_0xf6c8('0x13')][_0xf6c8('0x14')]===0x1f4){logger[_0xf6c8('0x13')](_0xf6c8('0x10'),_0x388ed3,_0x3b0a9e[_0xf6c8('0x13')]['message']);return _0x3472ca(_0x3b0a9e[_0xf6c8('0x13')][_0xf6c8('0x15')]);}logger[_0xf6c8('0x13')](_0xf6c8('0x10'),_0x388ed3,_0x3b0a9e[_0xf6c8('0x13')]['message']);return _0x5093c1(_0x3b0a9e[_0xf6c8('0x13')]['message']);}else{logger[_0xf6c8('0xf')](_0xf6c8('0x10'),_0x388ed3,'request\x20sent');_0x5093c1(_0x3b0a9e[_0xf6c8('0x16')]['message']);}})[_0xf6c8('0x17')](function(_0x169d94){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x388ed3,_0x169d94);_0x3472ca(_0x169d94);});});} \ No newline at end of file +var _0x35c0=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message'];(function(_0x2fb561,_0x579dbf){var _0x2b7be3=function(_0x578df4){while(--_0x578df4){_0x2fb561['push'](_0x2fb561['shift']());}};_0x2b7be3(++_0x579dbf);}(_0x35c0,0x8b));var _0x035c=function(_0xb12603,_0x142505){_0xb12603=_0xb12603-0x0;var _0x2bdc24=_0x35c0[_0xb12603];return _0x2bdc24;};'use strict';var _=require(_0x035c('0x0'));var util=require(_0x035c('0x1'));var moment=require(_0x035c('0x2'));var BPromise=require(_0x035c('0x3'));var rs=require(_0x035c('0x4'));var fs=require('fs');var Redis=require(_0x035c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x035c('0x6'));var logger=require(_0x035c('0x7'))(_0x035c('0x8'));var config=require(_0x035c('0x9'));var jayson=require(_0x035c('0xa'));var client=jayson[_0x035c('0xb')][_0x035c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a4ef2,_0x5e98cc,_0x5d3940){return new BPromise(function(_0x1e470f,_0x3db30e){return client[_0x035c('0xd')](_0x1a4ef2,_0x5d3940)['then'](function(_0x431ae6){logger[_0x035c('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x5e98cc,_0x035c('0xf'));logger[_0x035c('0x10')](_0x035c('0x11'),_0x5e98cc,_0x035c('0xf'),JSON[_0x035c('0x12')](_0x431ae6));if(_0x431ae6['error']){if(_0x431ae6[_0x035c('0x13')]['code']===0x1f4){logger[_0x035c('0x13')](_0x035c('0x14'),_0x5e98cc,_0x431ae6['error'][_0x035c('0x15')]);return _0x3db30e(_0x431ae6[_0x035c('0x13')]['message']);}logger[_0x035c('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x5e98cc,_0x431ae6['error'][_0x035c('0x15')]);return _0x1e470f(_0x431ae6[_0x035c('0x13')][_0x035c('0x15')]);}else{logger[_0x035c('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x5e98cc,_0x035c('0xf'));_0x1e470f(_0x431ae6[_0x035c('0x16')][_0x035c('0x15')]);}})['catch'](function(_0x2f3e34){logger[_0x035c('0x13')](_0x035c('0x14'),_0x5e98cc,_0x2f3e34);_0x3db30e(_0x2f3e34);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 78f6c72..2be3690 100644 --- a/server/api/setting/index.js +++ b/server/api/setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd122=['get','isAuthenticated','index','/now','getDate','/:id','show','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','logologin','/:id/logo_login','join','preferred','favicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller'];(function(_0x510abf,_0x145af5){var _0x575246=function(_0x3860a6){while(--_0x3860a6){_0x510abf['push'](_0x510abf['shift']());}};_0x575246(++_0x145af5);}(_0xd122,0x129));var _0x2d12=function(_0x36faa3,_0x1d4f57){_0x36faa3=_0x36faa3-0x0;var _0x2197db=_0xd122[_0x36faa3];return _0x2197db;};'use strict';var multer=require(_0x2d12('0x0'));var util=require(_0x2d12('0x1'));var path=require(_0x2d12('0x2'));var timeout=require(_0x2d12('0x3'));var express=require(_0x2d12('0x4'));var router=express[_0x2d12('0x5')]();var fs_extra=require(_0x2d12('0x6'));var auth=require(_0x2d12('0x7'));var interaction=require(_0x2d12('0x8'));var config=require(_0x2d12('0x9'));var controller=require(_0x2d12('0xa'));router[_0x2d12('0xb')]('/',auth[_0x2d12('0xc')](),controller[_0x2d12('0xd')]);router[_0x2d12('0xb')](_0x2d12('0xe'),controller[_0x2d12('0xf')]);router[_0x2d12('0xb')](_0x2d12('0x10'),controller[_0x2d12('0x11')]);router[_0x2d12('0xb')]('/:id/logo',controller['getLogo']);router['get']('/:id/logo_login',controller['getLogoLogin']);router[_0x2d12('0xb')](_0x2d12('0x12'),controller[_0x2d12('0x13')]);router[_0x2d12('0xb')](_0x2d12('0x14'),controller[_0x2d12('0x15')]);router['get'](_0x2d12('0x16'),controller[_0x2d12('0x17')]);var upload=multer({'storage':multer[_0x2d12('0x18')]({'destination':function(_0xfd1f24,_0x401009,_0x439c17){_0x439c17(null,path['join'](config[_0x2d12('0x19')],_0x2d12('0x1a')));},'filename':function(_0x30106c,_0x34f5a2,_0x3b0c9e){_0x3b0c9e(null,util[_0x2d12('0x1b')](_0x2d12('0x1c'),_0x2d12('0x1d'),path[_0x2d12('0x1e')](_0x34f5a2[_0x2d12('0x1f')])));}})});router[_0x2d12('0x20')]('/:id/logo',upload[_0x2d12('0x21')](_0x2d12('0x22')),controller[_0x2d12('0x23')]);var upload=multer({'storage':multer[_0x2d12('0x18')]({'destination':function(_0x5759ce,_0x25fe49,_0x12eac4){_0x12eac4(null,path['join'](config[_0x2d12('0x19')],_0x2d12('0x1a')));},'filename':function(_0x4b8c57,_0x237fc3,_0x3e707e){_0x3e707e(null,util['format']('%s%s',_0x2d12('0x24'),path[_0x2d12('0x1e')](_0x237fc3['originalname'])));}})});router[_0x2d12('0x20')](_0x2d12('0x25'),upload[_0x2d12('0x21')](_0x2d12('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x2d12('0x18')]({'destination':function(_0x3005cf,_0x477089,_0x39db74){_0x39db74(null,path[_0x2d12('0x26')](config['root'],_0x2d12('0x1a')));},'filename':function(_0x27538b,_0x55b3c7,_0x1c40dc){_0x1c40dc(null,util[_0x2d12('0x1b')](_0x2d12('0x1c'),_0x2d12('0x27'),path['extname'](_0x55b3c7['originalname'])));}})});router['post'](_0x2d12('0x14'),upload[_0x2d12('0x21')](_0x2d12('0x22')),controller['addPreferred']);var upload=multer({'storage':multer[_0x2d12('0x18')]({'destination':function(_0x4b6fdc,_0x3b583d,_0xb10282){_0xb10282(null,path[_0x2d12('0x26')](config[_0x2d12('0x19')],_0x2d12('0x1a')));},'filename':function(_0x1a2bf5,_0x36de97,_0x158b72){_0x158b72(null,util[_0x2d12('0x1b')](_0x2d12('0x1c'),_0x2d12('0x28'),path[_0x2d12('0x1e')](_0x36de97[_0x2d12('0x1f')])));}})});router[_0x2d12('0x20')](_0x2d12('0x16'),upload[_0x2d12('0x21')]('file'),controller['addFavicon']);router[_0x2d12('0x29')]('/:id',auth[_0x2d12('0xc')](),controller[_0x2d12('0x2a')]);module[_0x2d12('0x2b')]=router; \ No newline at end of file +var _0x81db=['getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','logo','extname','originalname','post','single','file','addLogo','join','%s%s','logologin','preferred','addPreferred','favicon','addFavicon','put','/:id','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/logo'];(function(_0x19ebfd,_0x5ae121){var _0x11017a=function(_0x24db17){while(--_0x24db17){_0x19ebfd['push'](_0x19ebfd['shift']());}};_0x11017a(++_0x5ae121);}(_0x81db,0x9f));var _0xb81d=function(_0x212e58,_0x498378){_0x212e58=_0x212e58-0x0;var _0x4f42e0=_0x81db[_0x212e58];return _0x4f42e0;};'use strict';var multer=require(_0xb81d('0x0'));var util=require('util');var path=require(_0xb81d('0x1'));var timeout=require(_0xb81d('0x2'));var express=require('express');var router=express[_0xb81d('0x3')]();var fs_extra=require(_0xb81d('0x4'));var auth=require(_0xb81d('0x5'));var interaction=require(_0xb81d('0x6'));var config=require(_0xb81d('0x7'));var controller=require('./setting.controller');router[_0xb81d('0x8')]('/',auth[_0xb81d('0x9')](),controller[_0xb81d('0xa')]);router['get']('/now',controller['getDate']);router[_0xb81d('0x8')]('/:id',controller[_0xb81d('0xb')]);router[_0xb81d('0x8')](_0xb81d('0xc'),controller[_0xb81d('0xd')]);router[_0xb81d('0x8')](_0xb81d('0xe'),controller[_0xb81d('0xf')]);router['get'](_0xb81d('0x10'),controller['gdpr']);router[_0xb81d('0x8')](_0xb81d('0x11'),controller[_0xb81d('0x12')]);router[_0xb81d('0x8')](_0xb81d('0x13'),controller[_0xb81d('0x14')]);var upload=multer({'storage':multer[_0xb81d('0x15')]({'destination':function(_0xbf4077,_0x2128d4,_0x1faf48){_0x1faf48(null,path['join'](config[_0xb81d('0x16')],_0xb81d('0x17')));},'filename':function(_0x569281,_0x374142,_0x7ba85e){_0x7ba85e(null,util[_0xb81d('0x18')]('%s%s',_0xb81d('0x19'),path[_0xb81d('0x1a')](_0x374142[_0xb81d('0x1b')])));}})});router[_0xb81d('0x1c')](_0xb81d('0xc'),upload[_0xb81d('0x1d')](_0xb81d('0x1e')),controller[_0xb81d('0x1f')]);var upload=multer({'storage':multer[_0xb81d('0x15')]({'destination':function(_0xd146f8,_0x2f613e,_0x3b53c9){_0x3b53c9(null,path[_0xb81d('0x20')](config[_0xb81d('0x16')],_0xb81d('0x17')));},'filename':function(_0x399f3e,_0x3de4a9,_0x26d1fa){_0x26d1fa(null,util[_0xb81d('0x18')](_0xb81d('0x21'),_0xb81d('0x22'),path['extname'](_0x3de4a9['originalname'])));}})});router[_0xb81d('0x1c')](_0xb81d('0xe'),upload[_0xb81d('0x1d')](_0xb81d('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xb81d('0x15')]({'destination':function(_0x5ca894,_0x40dcf8,_0x1ed9db){_0x1ed9db(null,path[_0xb81d('0x20')](config[_0xb81d('0x16')],_0xb81d('0x17')));},'filename':function(_0x4ac4b4,_0x3e2fd3,_0x4b8152){_0x4b8152(null,util[_0xb81d('0x18')]('%s%s',_0xb81d('0x23'),path[_0xb81d('0x1a')](_0x3e2fd3[_0xb81d('0x1b')])));}})});router[_0xb81d('0x1c')]('/:id/preferred',upload[_0xb81d('0x1d')](_0xb81d('0x1e')),controller[_0xb81d('0x24')]);var upload=multer({'storage':multer[_0xb81d('0x15')]({'destination':function(_0x5cf5ba,_0x55acb7,_0x2c2a29){_0x2c2a29(null,path[_0xb81d('0x20')](config[_0xb81d('0x16')],_0xb81d('0x17')));},'filename':function(_0x246d48,_0x228828,_0x2473e2){_0x2473e2(null,util[_0xb81d('0x18')](_0xb81d('0x21'),_0xb81d('0x25'),path[_0xb81d('0x1a')](_0x228828[_0xb81d('0x1b')])));}})});router['post'](_0xb81d('0x13'),upload['single'](_0xb81d('0x1e')),controller[_0xb81d('0x26')]);router[_0xb81d('0x27')](_0xb81d('0x28'),auth[_0xb81d('0x9')](),controller[_0xb81d('0x29')]);module[_0xb81d('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 04b195c..9b72b2c 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97e7=['BOOLEAN','UNSIGNED','sequelize','exports','min_internal','INTEGER','min_mailbox','STRING'];(function(_0xfc36d,_0xe58316){var _0x5c8f48=function(_0x12b717){while(--_0x12b717){_0xfc36d['push'](_0xfc36d['shift']());}};_0x5c8f48(++_0xe58316);}(_0x97e7,0x7a));var _0x797e=function(_0x4f8988,_0x45c1c7){_0x4f8988=_0x4f8988-0x0;var _0x4b4abc=_0x97e7[_0x4f8988];return _0x4b4abc;};'use strict';var Sequelize=require(_0x797e('0x0'));module[_0x797e('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x797e('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x797e('0x3')](0xb),'unique':_0x797e('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x797e('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x797e('0x5')]},'defaultLogo':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x797e('0x5')]},'turnusername':{'type':Sequelize[_0x797e('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x797e('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x797e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x797e('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x797e('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x797e('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x797e('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x797e('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x797e('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x797e('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x797e('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x797e('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x797e('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x797e('0x5')]},'defaultFavicon':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x797e('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x797e('0x3')]},'transcribeRegion':{'type':Sequelize[_0x797e('0x5')]},'sentiment':{'type':Sequelize[_0x797e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x797e('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x797e('0x3')]},'sentimentRegion':{'type':Sequelize[_0x797e('0x5')]},'language':{'type':Sequelize[_0x797e('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x797e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x797e('0x3')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x797e('0x3')](0x2)[_0x797e('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x797e('0x3')](0x2)[_0x797e('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x797e('0x3')](0x2)[_0x797e('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x797e('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x797e('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x797e('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x797e('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x797e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x797e('0x3')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x797e('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x797e('0x3')],'defaultValue':0x14}}; \ No newline at end of file +var _0xd481=['min_internal','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xd481,0x1e4));var _0x1d48=function(_0x1fdc33,_0x5cfe5a){_0x1fdc33=_0x1fdc33-0x0;var _0x761952=_0xd481[_0x1fdc33];return _0x761952;};'use strict';var Sequelize=require(_0x1d48('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x1d48('0x1')](0xb),'unique':_0x1d48('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x1d48('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1d48('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1d48('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x1d48('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x1d48('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1d48('0x4')]},'turnaddr':{'type':Sequelize[_0x1d48('0x4')]},'turnusername':{'type':Sequelize[_0x1d48('0x4')]},'turnpassword':{'type':Sequelize[_0x1d48('0x4')]},'pageTitle':{'type':Sequelize[_0x1d48('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1d48('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x1d48('0x6')},'enableEmailPreview':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1d48('0x4')],'defaultValue':_0x1d48('0x7')},'chatTimeout':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x1d48('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1d48('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x1d48('0x4')]},'sentiment':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1d48('0x1')]},'sentimentRegion':{'type':Sequelize[_0x1d48('0x4')]},'language':{'type':Sequelize[_0x1d48('0x4')]},'bucket':{'type':Sequelize[_0x1d48('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x1d48('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1d48('0x1')](0x2)[_0x1d48('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1d48('0x1')](0x2)[_0x1d48('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1d48('0x1')](0x2)[_0x1d48('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index d7ddfe8..426a496 100644 --- a/server/api/setting/setting.controller.js +++ b/server/api/setting/setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c34=['download','getLogoLogin','defaultLogo','default_loginLogo.svg','custom','ValidationError','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','map','Setting','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','body','addLogo','file','addLogoLogin','filename','loginLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','Sequelize','upperFirst','\x20not\x20found'];(function(_0x1b6c2d,_0x5ef8a2){var _0xba9d0=function(_0x273348){while(--_0x273348){_0x1b6c2d['push'](_0x1b6c2d['shift']());}};_0xba9d0(++_0x5ef8a2);}(_0x8c34,0x181));var _0x48c3=function(_0x496608,_0x5c62e4){_0x496608=_0x496608-0x0;var _0x1374de=_0x8c34[_0x496608];return _0x1374de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48c3('0x0'));var zipdir=require(_0x48c3('0x1'));var jsonpatch=require(_0x48c3('0x2'));var rp=require(_0x48c3('0x3'));var moment=require(_0x48c3('0x4'));var BPromise=require(_0x48c3('0x5'));var Mustache=require(_0x48c3('0x6'));var util=require(_0x48c3('0x7'));var path=require(_0x48c3('0x8'));var sox=require(_0x48c3('0x9'));var csv=require(_0x48c3('0xa'));var ejs=require(_0x48c3('0xb'));var fs=require('fs');var fs_extra=require(_0x48c3('0xc'));var _=require(_0x48c3('0xd'));var squel=require(_0x48c3('0xe'));var crypto=require(_0x48c3('0xf'));var jsforce=require(_0x48c3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x48c3('0xa'));var querystring=require('querystring');var Papa=require(_0x48c3('0x11'));var Redis=require(_0x48c3('0x12'));var authService=require(_0x48c3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x48c3('0x14'));var hardwareService=require(_0x48c3('0x15'));var logger=require(_0x48c3('0x16'))(_0x48c3('0x17'));var utils=require('../../config/utils');var config=require(_0x48c3('0x18'));var licenseUtil=require(_0x48c3('0x19'));var db=require(_0x48c3('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x48c3('0x1b')][_0x48c3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x9b1184,_0x1f8d91,_0x1de371,_0x46a48d){return new BPromise(function(_0x1231be,_0x30bde8){var _0x40e052=_0x46a48d||client;return _0x40e052[_0x48c3('0x1d')](_0x9b1184,_0x1de371)['then'](function(_0x2bb2ba){logger[_0x48c3('0x1e')](_0x48c3('0x1f'),_0x1f8d91,'request\x20sent');logger['debug'](_0x48c3('0x20'),_0x1f8d91,_0x48c3('0x21'),JSON[_0x48c3('0x22')](_0x2bb2ba));if(_0x2bb2ba[_0x48c3('0x23')]){if(_0x2bb2ba[_0x48c3('0x23')]['code']===0x1f4){logger[_0x48c3('0x23')](_0x48c3('0x1f'),_0x1f8d91,_0x2bb2ba[_0x48c3('0x23')][_0x48c3('0x24')]);return _0x30bde8(_0x2bb2ba['error'][_0x48c3('0x24')]);}logger[_0x48c3('0x23')](_0x48c3('0x1f'),_0x1f8d91,_0x2bb2ba[_0x48c3('0x23')][_0x48c3('0x24')]);return _0x1231be(_0x2bb2ba[_0x48c3('0x23')]['message']);}else{logger[_0x48c3('0x1e')]('Setting,\x20%s,\x20%s',_0x1f8d91,_0x48c3('0x21'));_0x1231be(_0x2bb2ba[_0x48c3('0x25')][_0x48c3('0x24')]);}})[_0x48c3('0x26')](function(_0x2c551d){logger[_0x48c3('0x23')](_0x48c3('0x1f'),_0x1f8d91,_0x2c551d);_0x30bde8(_0x2c551d);});});}function respondWithStatusCode(_0x13264a,_0x192fb8){_0x192fb8=_0x192fb8||0xcc;return function(_0x225bff){if(_0x225bff){return _0x13264a[_0x48c3('0x27')](_0x192fb8);}return _0x13264a['status'](_0x192fb8)[_0x48c3('0x28')]();};}function respondWithResult(_0x1e781b,_0xc664df){_0xc664df=_0xc664df||0xc8;return function(_0x1eff2e){if(_0x1eff2e){return _0x1e781b[_0x48c3('0x29')](_0xc664df)[_0x48c3('0x2a')](_0x1eff2e);}};}function respondWithFilteredResult(_0x4a5c6e,_0x31c4ab){return function(_0x558867){if(_0x558867){var _0x32f00f=typeof _0x31c4ab[_0x48c3('0x2b')]===_0x48c3('0x2c')&&typeof _0x31c4ab[_0x48c3('0x2d')]===_0x48c3('0x2c');var _0x9ceb80=_0x558867[_0x48c3('0x2e')];var _0x2a45c9=_0x32f00f?0x0:_0x31c4ab[_0x48c3('0x2b')];var _0x24529d=_0x32f00f?_0x558867[_0x48c3('0x2e')]:_0x31c4ab['offset']+_0x31c4ab[_0x48c3('0x2d')];var _0x35bc48;if(_0x24529d>=_0x9ceb80){_0x24529d=_0x9ceb80;_0x35bc48=0xc8;}else{_0x35bc48=0xce;}_0x4a5c6e[_0x48c3('0x29')](_0x35bc48);return _0x4a5c6e['set'](_0x48c3('0x2f'),_0x2a45c9+'-'+_0x24529d+'/'+_0x9ceb80)[_0x48c3('0x2a')](_0x558867);}return null;};}function patchUpdates(_0x362db7){return function(_0x1c21e1){try{jsonpatch[_0x48c3('0x30')](_0x1c21e1,_0x362db7,!![]);}catch(_0x1ec5cc){return BPromise[_0x48c3('0x31')](_0x1ec5cc);}return _0x1c21e1[_0x48c3('0x32')]();};}function saveUpdates(_0x15666f,_0x536b93){return function(_0x10cea3){if(_0x10cea3){return _0x10cea3[_0x48c3('0x33')](_0x15666f)[_0x48c3('0x34')](function(_0x2179d1){return _0x2179d1;});}return null;};}function removeEntity(_0x508d7a,_0x2c150d){return function(_0x3e4abf){if(_0x3e4abf){return _0x3e4abf[_0x48c3('0x35')]()[_0x48c3('0x34')](function(){_0x508d7a[_0x48c3('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55adec,_0xc92404){return function(_0x2c999c){if(!_0x2c999c){_0x55adec['sendStatus'](0x194);}return _0x2c999c;};}function handleError(_0x1c4278,_0x44cb69){_0x44cb69=_0x44cb69||0x1f4;return function(_0x475e3a){logger[_0x48c3('0x23')](_0x475e3a['stack']);if(_0x475e3a[_0x48c3('0x36')]){delete _0x475e3a['name'];}_0x1c4278[_0x48c3('0x29')](_0x44cb69)[_0x48c3('0x37')](_0x475e3a);};}exports['index']=function(_0x4efd5f,_0x5121dc){var _0x3a6b6a={},_0x9af3f3={},_0x1c0cba={'count':0x0,'rows':[]};var _0x25ced1=_[_0x48c3('0x38')](db[_0x48c3('0x39')][_0x48c3('0x3a')],function(_0x2344a5){return{'name':_0x2344a5[_0x48c3('0x3b')],'type':_0x2344a5[_0x48c3('0x3c')]['key']};});_0x9af3f3['model']=_[_0x48c3('0x38')](_0x25ced1,_0x48c3('0x36'));_0x9af3f3[_0x48c3('0x3d')]=_[_0x48c3('0x3e')](_0x4efd5f[_0x48c3('0x3d')]);_0x9af3f3[_0x48c3('0x3f')]=_['intersection'](_0x9af3f3[_0x48c3('0x40')],_0x9af3f3[_0x48c3('0x3d')]);_0x3a6b6a['attributes']=_[_0x48c3('0x41')](_0x9af3f3[_0x48c3('0x40')],qs[_0x48c3('0x42')](_0x4efd5f[_0x48c3('0x3d')][_0x48c3('0x42')]));_0x3a6b6a[_0x48c3('0x43')]=_0x3a6b6a[_0x48c3('0x43')][_0x48c3('0x44')]?_0x3a6b6a[_0x48c3('0x43')]:_0x9af3f3['model'];if(!_0x4efd5f[_0x48c3('0x3d')][_0x48c3('0x45')](_0x48c3('0x46'))){_0x3a6b6a[_0x48c3('0x2d')]=qs[_0x48c3('0x2d')](_0x4efd5f['query'][_0x48c3('0x2d')]);_0x3a6b6a[_0x48c3('0x2b')]=qs[_0x48c3('0x2b')](_0x4efd5f['query']['offset']);}_0x3a6b6a[_0x48c3('0x47')]=qs[_0x48c3('0x48')](_0x4efd5f['query']['sort']);_0x3a6b6a[_0x48c3('0x49')]=qs[_0x48c3('0x3f')](_[_0x48c3('0x4a')](_0x4efd5f[_0x48c3('0x3d')],_0x9af3f3['filters']),_0x25ced1);if(_0x4efd5f['query'][_0x48c3('0x4b')]){_0x3a6b6a['where']=_[_0x48c3('0x4c')](_0x3a6b6a[_0x48c3('0x49')],{'$or':_['map'](_0x25ced1,function(_0x51ce64){if(_0x51ce64['type']!=='VIRTUAL'){var _0x568b78={};_0x568b78[_0x51ce64[_0x48c3('0x36')]]={'$like':'%'+_0x4efd5f['query'][_0x48c3('0x4b')]+'%'};return _0x568b78;}})});}_0x3a6b6a=_[_0x48c3('0x4c')]({},_0x3a6b6a,_0x4efd5f[_0x48c3('0x4d')]);var _0x52d1d5={'where':_0x3a6b6a[_0x48c3('0x49')]};return db['Setting'][_0x48c3('0x2e')](_0x52d1d5)['then'](function(_0x36634d){_0x1c0cba[_0x48c3('0x2e')]=_0x36634d;if(_0x4efd5f[_0x48c3('0x3d')][_0x48c3('0x4e')]){_0x3a6b6a[_0x48c3('0x4f')]=[{'all':!![]}];}return db[_0x48c3('0x39')][_0x48c3('0x50')](_0x3a6b6a);})[_0x48c3('0x34')](function(_0x2622a3){_0x1c0cba[_0x48c3('0x51')]=_0x2622a3;return _0x1c0cba;})[_0x48c3('0x34')](respondWithFilteredResult(_0x5121dc,_0x3a6b6a))[_0x48c3('0x26')](handleError(_0x5121dc,null));};exports['show']=function(_0x3b6afd,_0x27aa2b){var _0x5023a5={'raw':![],'where':{'id':_0x3b6afd[_0x48c3('0x52')]['id']}},_0x7533fe={};_0x7533fe[_0x48c3('0x40')]=_['keys'](db[_0x48c3('0x39')][_0x48c3('0x3a')]);_0x7533fe[_0x48c3('0x3d')]=_[_0x48c3('0x3e')](_0x3b6afd[_0x48c3('0x3d')]);_0x7533fe[_0x48c3('0x3f')]=_['intersection'](_0x7533fe[_0x48c3('0x40')],_0x7533fe[_0x48c3('0x3d')]);_0x5023a5['attributes']=_[_0x48c3('0x41')](_0x7533fe[_0x48c3('0x40')],qs['fields'](_0x3b6afd['query'][_0x48c3('0x42')]));_0x5023a5['attributes']=_0x5023a5['attributes'][_0x48c3('0x44')]?_0x5023a5[_0x48c3('0x43')]:_0x7533fe[_0x48c3('0x40')];if(_0x3b6afd[_0x48c3('0x3d')]['includeAll']){_0x5023a5[_0x48c3('0x4f')]=[{'all':!![]}];}_0x5023a5=_[_0x48c3('0x4c')]({},_0x5023a5,_0x3b6afd['options']);return db['Setting'][_0x48c3('0x53')](_0x5023a5)[_0x48c3('0x34')](handleEntityNotFound(_0x27aa2b,null))[_0x48c3('0x34')](respondWithResult(_0x27aa2b,null))[_0x48c3('0x26')](handleError(_0x27aa2b,null));};exports[_0x48c3('0x33')]=function(_0x493272,_0x554fba){if(_0x493272[_0x48c3('0x54')]['id']){delete _0x493272['body']['id'];}return db[_0x48c3('0x39')][_0x48c3('0x53')]({'where':{'id':_0x493272['params']['id']}})[_0x48c3('0x34')](handleEntityNotFound(_0x554fba,null))[_0x48c3('0x34')](saveUpdates(_0x493272['body'],null))[_0x48c3('0x34')](respondWithResult(_0x554fba,null))[_0x48c3('0x26')](handleError(_0x554fba,null));};exports[_0x48c3('0x55')]=function(_0x579ba1,_0xd4308d,_0x2bb042){if(_0x579ba1[_0x48c3('0x56')]&&_0x579ba1['file']['filename']){_0x579ba1[_0x48c3('0x54')]['logo']=_0x579ba1[_0x48c3('0x56')]['filename'];}return db[_0x48c3('0x39')][_0x48c3('0x53')]({'where':{'id':_0x579ba1[_0x48c3('0x52')]['id']}})['then'](handleEntityNotFound(_0xd4308d,null))['then'](saveUpdates(_0x579ba1[_0x48c3('0x54')],null))['then'](respondWithResult(_0xd4308d,null))[_0x48c3('0x26')](handleError(_0xd4308d,null));};exports[_0x48c3('0x57')]=function(_0x3d4b9e,_0x1d223a,_0xe6a303){if(_0x3d4b9e['file']&&_0x3d4b9e[_0x48c3('0x56')][_0x48c3('0x58')]){_0x3d4b9e[_0x48c3('0x54')][_0x48c3('0x59')]=_0x3d4b9e[_0x48c3('0x56')][_0x48c3('0x58')];}return db['Setting'][_0x48c3('0x53')]({'where':{'id':_0x3d4b9e[_0x48c3('0x52')]['id']}})[_0x48c3('0x34')](handleEntityNotFound(_0x1d223a,null))['then'](saveUpdates(_0x3d4b9e[_0x48c3('0x54')],null))['then'](respondWithResult(_0x1d223a,null))['catch'](handleError(_0x1d223a,null));};var utilLicense=require(_0x48c3('0x19'));exports['getLogo']=function(_0x2a4b8f,_0x1cd89e,_0x35e30a){var _0x4aff48=_0x48c3('0x5a');var _0x59b690={'custom':![]};return utilLicense[_0x48c3('0x5b')]()[_0x48c3('0x34')](function(_0xb3b25b){if(_0xb3b25b){_0x59b690=_0xb3b25b;}return db[_0x48c3('0x39')]['find']({'where':{'id':_0x2a4b8f[_0x48c3('0x52')]['id']},'attributes':[_0x48c3('0x5c'),_0x48c3('0x59'),_0x48c3('0x5d'),_0x48c3('0x5e'),'defaultLogo',_0x48c3('0x5f'),_0x48c3('0x60'),_0x48c3('0x61')],'raw':!![]});})[_0x48c3('0x34')](handleEntityNotFound(_0x1cd89e,null))['then'](function(_0x29d372){if(_0x29d372){var _0x35d855=_0x29d372[_0x48c3('0x5c')]&&fs[_0x48c3('0x62')](path[_0x48c3('0x63')](config[_0x48c3('0x64')],_0x4aff48,_['toLower'](_0x29d372['logo'])))?path['join'](config['root'],_0x4aff48,_[_0x48c3('0x65')](_0x29d372[_0x48c3('0x5c')])):path[_0x48c3('0x63')](config['root'],_0x4aff48,_[_0x48c3('0x65')](_0x48c3('0x66')));var _0x8eb3d5=_0x48c3('0x67')+_['upperFirst']('logo');if(_0x29d372[_0x8eb3d5]||!_0x59b690['custom']){_0x35d855=path[_0x48c3('0x63')](config[_0x48c3('0x64')],_0x4aff48,_[_0x48c3('0x65')]('default_logo.svg'));}if(!fs[_0x48c3('0x62')](_0x35d855)){throw new db[(_0x48c3('0x68'))]['ValidationError'](_[_0x48c3('0x69')]('logo')+_0x48c3('0x6a'));}return _0x1cd89e[_0x48c3('0x6b')](_0x35d855);}})[_0x48c3('0x26')](handleError(_0x1cd89e,null));};var utilLicense=require(_0x48c3('0x19'));exports[_0x48c3('0x6c')]=function(_0x255627,_0x5b10b3,_0x22b528){var _0x382ab4=_0x48c3('0x5a');var _0x28b47f={'custom':![]};return utilLicense[_0x48c3('0x5b')]()[_0x48c3('0x34')](function(_0x497330){if(_0x497330){_0x28b47f=_0x497330;}return db[_0x48c3('0x39')]['find']({'where':{'id':_0x255627[_0x48c3('0x52')]['id']},'attributes':['logo',_0x48c3('0x59'),_0x48c3('0x5d'),_0x48c3('0x5e'),_0x48c3('0x6d'),_0x48c3('0x5f'),_0x48c3('0x60'),_0x48c3('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x5b10b3,null))['then'](function(_0xbf5ec8){if(_0xbf5ec8){var _0x9ca2ec=_0xbf5ec8[_0x48c3('0x59')]&&fs[_0x48c3('0x62')](path[_0x48c3('0x63')](config[_0x48c3('0x64')],_0x382ab4,_[_0x48c3('0x65')](_0xbf5ec8[_0x48c3('0x59')])))?path[_0x48c3('0x63')](config[_0x48c3('0x64')],_0x382ab4,_[_0x48c3('0x65')](_0xbf5ec8[_0x48c3('0x59')])):path[_0x48c3('0x63')](config[_0x48c3('0x64')],_0x382ab4,_[_0x48c3('0x65')](_0x48c3('0x6e')));var _0x4138ee='default'+_[_0x48c3('0x69')](_0x48c3('0x59'));if(_0xbf5ec8[_0x4138ee]||!_0x28b47f[_0x48c3('0x6f')]){_0x9ca2ec=path[_0x48c3('0x63')](config[_0x48c3('0x64')],_0x382ab4,_['toLower'](_0x48c3('0x6e')));}if(!fs[_0x48c3('0x62')](_0x9ca2ec)){throw new db[(_0x48c3('0x68'))][(_0x48c3('0x70'))](_[_0x48c3('0x69')]('loginLogo')+_0x48c3('0x6a'));}return _0x5b10b3[_0x48c3('0x6b')](_0x9ca2ec);}})[_0x48c3('0x26')](handleError(_0x5b10b3,null));};exports['gdpr']=function(_0x5cf6eb,_0x5ad14c){return db[_0x48c3('0x39')]['find']({'where':{'id':_0x5cf6eb[_0x48c3('0x52')]['id']},'attributes':['securePassword']})[_0x48c3('0x34')](respondWithResult(_0x5ad14c,null))[_0x48c3('0x26')](handleError(_0x5ad14c,null));};exports[_0x48c3('0x71')]=function(_0x584a91,_0xb6ddbb,_0x27d756){if(_0x584a91[_0x48c3('0x56')]&&_0x584a91[_0x48c3('0x56')][_0x48c3('0x58')]){_0x584a91[_0x48c3('0x54')][_0x48c3('0x5d')]=_0x584a91['file'][_0x48c3('0x58')];}return db[_0x48c3('0x39')][_0x48c3('0x53')]({'where':{'id':_0x584a91[_0x48c3('0x52')]['id']}})[_0x48c3('0x34')](handleEntityNotFound(_0xb6ddbb,null))[_0x48c3('0x34')](saveUpdates(_0x584a91[_0x48c3('0x54')],null))['then'](respondWithResult(_0xb6ddbb,null))[_0x48c3('0x26')](handleError(_0xb6ddbb,null));};var utilLicense=require(_0x48c3('0x19'));exports[_0x48c3('0x72')]=function(_0x5dd884,_0x48a4fb,_0x3844af){var _0x57dff9=_0x48c3('0x5a');var _0x2b1fed={'custom':![]};return utilLicense[_0x48c3('0x5b')]()[_0x48c3('0x34')](function(_0xec05f9){if(_0xec05f9){_0x2b1fed=_0xec05f9;}return db[_0x48c3('0x39')]['find']({'where':{'id':_0x5dd884[_0x48c3('0x52')]['id']},'attributes':[_0x48c3('0x5c'),_0x48c3('0x59'),_0x48c3('0x5d'),'favicon',_0x48c3('0x6d'),_0x48c3('0x5f'),_0x48c3('0x60'),_0x48c3('0x61')],'raw':!![]});})[_0x48c3('0x34')](handleEntityNotFound(_0x48a4fb,null))['then'](function(_0x3c1af9){if(_0x3c1af9){var _0x23fb5e=_0x3c1af9['preferred']&&fs[_0x48c3('0x62')](path[_0x48c3('0x63')](config['root'],_0x57dff9,_['toLower'](_0x3c1af9[_0x48c3('0x5d')])))?path[_0x48c3('0x63')](config[_0x48c3('0x64')],_0x57dff9,_[_0x48c3('0x65')](_0x3c1af9[_0x48c3('0x5d')])):path[_0x48c3('0x63')](config['root'],_0x57dff9,_[_0x48c3('0x65')](_0x48c3('0x73')));var _0x43e9eb=_0x48c3('0x67')+_['upperFirst'](_0x48c3('0x5d'));if(_0x3c1af9[_0x43e9eb]||!_0x2b1fed[_0x48c3('0x6f')]||!_0x2b1fed[_0x48c3('0x5d')]){_0x23fb5e=path['join'](config[_0x48c3('0x64')],_0x57dff9,_['toLower']('default_preferred.png'));}if(!fs[_0x48c3('0x62')](_0x23fb5e)){throw new db[(_0x48c3('0x68'))][(_0x48c3('0x70'))](_['upperFirst']('preferred')+_0x48c3('0x6a'));}return _0x48a4fb['download'](_0x23fb5e);}})['catch'](handleError(_0x48a4fb,null));};exports[_0x48c3('0x74')]=function(_0xd46993,_0x416eab,_0x425136){if(_0xd46993['file']&&_0xd46993[_0x48c3('0x56')][_0x48c3('0x58')]){_0xd46993[_0x48c3('0x54')][_0x48c3('0x5e')]=_0xd46993['file'][_0x48c3('0x58')];}return db[_0x48c3('0x39')][_0x48c3('0x53')]({'where':{'id':_0xd46993['params']['id']}})[_0x48c3('0x34')](handleEntityNotFound(_0x416eab,null))[_0x48c3('0x34')](saveUpdates(_0xd46993['body'],null))[_0x48c3('0x34')](respondWithResult(_0x416eab,null))[_0x48c3('0x26')](handleError(_0x416eab,null));};var utilLicense=require(_0x48c3('0x19'));exports[_0x48c3('0x75')]=function(_0x272ace,_0x43654f,_0x33e2b0){var _0x5cdbd4=_0x48c3('0x5a');var _0xc72fd3={'custom':![]};return utilLicense[_0x48c3('0x5b')]()[_0x48c3('0x34')](function(_0x403c33){if(_0x403c33){_0xc72fd3=_0x403c33;}return db[_0x48c3('0x39')][_0x48c3('0x53')]({'where':{'id':_0x272ace[_0x48c3('0x52')]['id']},'attributes':['logo',_0x48c3('0x59'),'preferred',_0x48c3('0x5e'),'defaultLogo','defaultLoginLogo',_0x48c3('0x60'),'defaultFavicon'],'raw':!![]});})[_0x48c3('0x34')](handleEntityNotFound(_0x43654f,null))[_0x48c3('0x34')](function(_0x49b588){if(_0x49b588){var _0x53e706=_0x49b588[_0x48c3('0x5e')]&&fs[_0x48c3('0x62')](path[_0x48c3('0x63')](config[_0x48c3('0x64')],_0x5cdbd4,_[_0x48c3('0x65')](_0x49b588['favicon'])))?path['join'](config['root'],_0x5cdbd4,_[_0x48c3('0x65')](_0x49b588['favicon'])):path[_0x48c3('0x63')](config[_0x48c3('0x64')],_0x5cdbd4,_[_0x48c3('0x65')]('default_favicon.ico'));var _0x4b3564=_0x48c3('0x67')+_[_0x48c3('0x69')](_0x48c3('0x5e'));if(_0x49b588[_0x4b3564]||!_0xc72fd3[_0x48c3('0x6f')]){_0x53e706=path[_0x48c3('0x63')](config[_0x48c3('0x64')],_0x5cdbd4,_[_0x48c3('0x65')](_0x48c3('0x76')));}if(!fs[_0x48c3('0x62')](_0x53e706)){throw new db[(_0x48c3('0x68'))][(_0x48c3('0x70'))](_['upperFirst'](_0x48c3('0x5e'))+_0x48c3('0x6a'));}return _0x43654f[_0x48c3('0x6b')](_0x53e706);}})[_0x48c3('0x26')](handleError(_0x43654f,null));};exports[_0x48c3('0x77')]=function(_0x22e3a8,_0x27e326){var _0x20daf0={'offset':moment()['utcOffset']()};_0x20daf0[_0x48c3('0x78')]=moment()[_0x48c3('0x79')](_0x20daf0[_0x48c3('0x2b')])[_0x48c3('0x7a')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x27e326['status'](0xc8)[_0x48c3('0x37')](_0x20daf0);}; \ No newline at end of file +var _0xa2cf=['sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','update','then','destroy','stack','name','index','map','Setting','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','options','includeAll','show','params','fields','merge','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','defaultPreferred','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','defaultFavicon','default_preferred.png','getFavicon','server/files/images/logos','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3ba9ec,_0x49c244){var _0x39f681=function(_0x5da9c0){while(--_0x5da9c0){_0x3ba9ec['push'](_0x3ba9ec['shift']());}};_0x39f681(++_0x49c244);}(_0xa2cf,0x15c));var _0xfa2c=function(_0x16be86,_0x143002){_0x16be86=_0x16be86-0x0;var _0x163033=_0xa2cf[_0x16be86];return _0x163033;};'use strict';var emlformat=require(_0xfa2c('0x0'));var rimraf=require(_0xfa2c('0x1'));var zipdir=require(_0xfa2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa2c('0x3'));var moment=require(_0xfa2c('0x4'));var BPromise=require(_0xfa2c('0x5'));var Mustache=require(_0xfa2c('0x6'));var util=require(_0xfa2c('0x7'));var path=require(_0xfa2c('0x8'));var sox=require(_0xfa2c('0x9'));var csv=require(_0xfa2c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa2c('0xb'));var _=require(_0xfa2c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfa2c('0xd'));var deskjs=require(_0xfa2c('0xe'));var toCsv=require(_0xfa2c('0xa'));var querystring=require(_0xfa2c('0xf'));var Papa=require(_0xfa2c('0x10'));var Redis=require('ioredis');var authService=require(_0xfa2c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfa2c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa2c('0x13'))(_0xfa2c('0x14'));var utils=require(_0xfa2c('0x15'));var config=require(_0xfa2c('0x16'));var licenseUtil=require(_0xfa2c('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xfa2c('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4091b2,_0x3605ff,_0x105582,_0x1ef93c){return new BPromise(function(_0x26e208,_0x2fa9cb){var _0x200858=_0x1ef93c||client;return _0x200858[_0xfa2c('0x19')](_0x4091b2,_0x105582)['then'](function(_0x443fdd){logger[_0xfa2c('0x1a')](_0xfa2c('0x1b'),_0x3605ff,_0xfa2c('0x1c'));logger['debug'](_0xfa2c('0x1d'),_0x3605ff,_0xfa2c('0x1c'),JSON['stringify'](_0x443fdd));if(_0x443fdd['error']){if(_0x443fdd[_0xfa2c('0x1e')][_0xfa2c('0x1f')]===0x1f4){logger[_0xfa2c('0x1e')](_0xfa2c('0x1b'),_0x3605ff,_0x443fdd[_0xfa2c('0x1e')][_0xfa2c('0x20')]);return _0x2fa9cb(_0x443fdd[_0xfa2c('0x1e')]['message']);}logger[_0xfa2c('0x1e')](_0xfa2c('0x1b'),_0x3605ff,_0x443fdd[_0xfa2c('0x1e')][_0xfa2c('0x20')]);return _0x26e208(_0x443fdd['error'][_0xfa2c('0x20')]);}else{logger[_0xfa2c('0x1a')](_0xfa2c('0x1b'),_0x3605ff,_0xfa2c('0x1c'));_0x26e208(_0x443fdd[_0xfa2c('0x21')]['message']);}})[_0xfa2c('0x22')](function(_0x588237){logger[_0xfa2c('0x1e')](_0xfa2c('0x1b'),_0x3605ff,_0x588237);_0x2fa9cb(_0x588237);});});}function respondWithStatusCode(_0x5e29aa,_0x1f5a09){_0x1f5a09=_0x1f5a09||0xcc;return function(_0x3a630b){if(_0x3a630b){return _0x5e29aa[_0xfa2c('0x23')](_0x1f5a09);}return _0x5e29aa[_0xfa2c('0x24')](_0x1f5a09)[_0xfa2c('0x25')]();};}function respondWithResult(_0x2a0812,_0x43dbae){_0x43dbae=_0x43dbae||0xc8;return function(_0xde5a3a){if(_0xde5a3a){return _0x2a0812['status'](_0x43dbae)[_0xfa2c('0x26')](_0xde5a3a);}};}function respondWithFilteredResult(_0x2ca781,_0x33035a){return function(_0x2cfb17){if(_0x2cfb17){var _0x1bb22c=typeof _0x33035a['offset']===_0xfa2c('0x27')&&typeof _0x33035a['limit']===_0xfa2c('0x27');var _0x410fbd=_0x2cfb17[_0xfa2c('0x28')];var _0x11dfa7=_0x1bb22c?0x0:_0x33035a[_0xfa2c('0x29')];var _0x3e0f68=_0x1bb22c?_0x2cfb17['count']:_0x33035a[_0xfa2c('0x29')]+_0x33035a[_0xfa2c('0x2a')];var _0x43f351;if(_0x3e0f68>=_0x410fbd){_0x3e0f68=_0x410fbd;_0x43f351=0xc8;}else{_0x43f351=0xce;}_0x2ca781['status'](_0x43f351);return _0x2ca781[_0xfa2c('0x2b')]('Content-Range',_0x11dfa7+'-'+_0x3e0f68+'/'+_0x410fbd)[_0xfa2c('0x26')](_0x2cfb17);}return null;};}function patchUpdates(_0x102988){return function(_0x1f9307){try{jsonpatch[_0xfa2c('0x2c')](_0x1f9307,_0x102988,!![]);}catch(_0x540d2a){return BPromise['reject'](_0x540d2a);}return _0x1f9307['save']();};}function saveUpdates(_0x4e7007,_0x399140){return function(_0x1b0628){if(_0x1b0628){return _0x1b0628[_0xfa2c('0x2d')](_0x4e7007)[_0xfa2c('0x2e')](function(_0x1a6372){return _0x1a6372;});}return null;};}function removeEntity(_0xdb1d52,_0x47dbf4){return function(_0x4a4f27){if(_0x4a4f27){return _0x4a4f27[_0xfa2c('0x2f')]()[_0xfa2c('0x2e')](function(){_0xdb1d52[_0xfa2c('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cd4e1,_0x297ab1){return function(_0x38a313){if(!_0x38a313){_0x2cd4e1[_0xfa2c('0x23')](0x194);}return _0x38a313;};}function handleError(_0x33ff49,_0x1210d5){_0x1210d5=_0x1210d5||0x1f4;return function(_0x508789){logger['error'](_0x508789[_0xfa2c('0x30')]);if(_0x508789[_0xfa2c('0x31')]){delete _0x508789['name'];}_0x33ff49[_0xfa2c('0x24')](_0x1210d5)['send'](_0x508789);};}exports[_0xfa2c('0x32')]=function(_0x2b31dc,_0x59357b){var _0x555616={},_0x1c077a={},_0x36e8f9={'count':0x0,'rows':[]};var _0x5f02a2=_[_0xfa2c('0x33')](db[_0xfa2c('0x34')]['rawAttributes'],function(_0x5cf3d6){return{'name':_0x5cf3d6[_0xfa2c('0x35')],'type':_0x5cf3d6[_0xfa2c('0x36')][_0xfa2c('0x37')]};});_0x1c077a[_0xfa2c('0x38')]=_[_0xfa2c('0x33')](_0x5f02a2,_0xfa2c('0x31'));_0x1c077a[_0xfa2c('0x39')]=_[_0xfa2c('0x3a')](_0x2b31dc[_0xfa2c('0x39')]);_0x1c077a[_0xfa2c('0x3b')]=_['intersection'](_0x1c077a[_0xfa2c('0x38')],_0x1c077a[_0xfa2c('0x39')]);_0x555616[_0xfa2c('0x3c')]=_[_0xfa2c('0x3d')](_0x1c077a[_0xfa2c('0x38')],qs['fields'](_0x2b31dc['query']['fields']));_0x555616[_0xfa2c('0x3c')]=_0x555616[_0xfa2c('0x3c')][_0xfa2c('0x3e')]?_0x555616[_0xfa2c('0x3c')]:_0x1c077a[_0xfa2c('0x38')];if(!_0x2b31dc[_0xfa2c('0x39')][_0xfa2c('0x3f')](_0xfa2c('0x40'))){_0x555616[_0xfa2c('0x2a')]=qs[_0xfa2c('0x2a')](_0x2b31dc[_0xfa2c('0x39')][_0xfa2c('0x2a')]);_0x555616[_0xfa2c('0x29')]=qs['offset'](_0x2b31dc[_0xfa2c('0x39')][_0xfa2c('0x29')]);}_0x555616[_0xfa2c('0x41')]=qs['sort'](_0x2b31dc[_0xfa2c('0x39')]['sort']);_0x555616['where']=qs[_0xfa2c('0x3b')](_[_0xfa2c('0x42')](_0x2b31dc[_0xfa2c('0x39')],_0x1c077a[_0xfa2c('0x3b')]),_0x5f02a2);if(_0x2b31dc[_0xfa2c('0x39')][_0xfa2c('0x43')]){_0x555616['where']=_['merge'](_0x555616[_0xfa2c('0x44')],{'$or':_[_0xfa2c('0x33')](_0x5f02a2,function(_0x142d31){if(_0x142d31['type']!==_0xfa2c('0x45')){var _0x1b7436={};_0x1b7436[_0x142d31[_0xfa2c('0x31')]]={'$like':'%'+_0x2b31dc[_0xfa2c('0x39')][_0xfa2c('0x43')]+'%'};return _0x1b7436;}})});}_0x555616=_['merge']({},_0x555616,_0x2b31dc[_0xfa2c('0x46')]);var _0x32443={'where':_0x555616[_0xfa2c('0x44')]};return db[_0xfa2c('0x34')]['count'](_0x32443)[_0xfa2c('0x2e')](function(_0x2b6bdd){_0x36e8f9[_0xfa2c('0x28')]=_0x2b6bdd;if(_0x2b31dc['query'][_0xfa2c('0x47')]){_0x555616['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x555616);})[_0xfa2c('0x2e')](function(_0x26f292){_0x36e8f9['rows']=_0x26f292;return _0x36e8f9;})[_0xfa2c('0x2e')](respondWithFilteredResult(_0x59357b,_0x555616))[_0xfa2c('0x22')](handleError(_0x59357b,null));};exports[_0xfa2c('0x48')]=function(_0x100076,_0x14dad9){var _0x532386={'raw':![],'where':{'id':_0x100076[_0xfa2c('0x49')]['id']}},_0x201913={};_0x201913[_0xfa2c('0x38')]=_[_0xfa2c('0x3a')](db[_0xfa2c('0x34')]['rawAttributes']);_0x201913[_0xfa2c('0x39')]=_[_0xfa2c('0x3a')](_0x100076[_0xfa2c('0x39')]);_0x201913['filters']=_[_0xfa2c('0x3d')](_0x201913[_0xfa2c('0x38')],_0x201913[_0xfa2c('0x39')]);_0x532386[_0xfa2c('0x3c')]=_[_0xfa2c('0x3d')](_0x201913[_0xfa2c('0x38')],qs[_0xfa2c('0x4a')](_0x100076[_0xfa2c('0x39')][_0xfa2c('0x4a')]));_0x532386[_0xfa2c('0x3c')]=_0x532386[_0xfa2c('0x3c')][_0xfa2c('0x3e')]?_0x532386['attributes']:_0x201913[_0xfa2c('0x38')];if(_0x100076[_0xfa2c('0x39')]['includeAll']){_0x532386['include']=[{'all':!![]}];}_0x532386=_[_0xfa2c('0x4b')]({},_0x532386,_0x100076[_0xfa2c('0x46')]);return db[_0xfa2c('0x34')][_0xfa2c('0x4c')](_0x532386)[_0xfa2c('0x2e')](handleEntityNotFound(_0x14dad9,null))['then'](respondWithResult(_0x14dad9,null))[_0xfa2c('0x22')](handleError(_0x14dad9,null));};exports[_0xfa2c('0x2d')]=function(_0x43a76e,_0x2b7ece){if(_0x43a76e['body']['id']){delete _0x43a76e['body']['id'];}return db['Setting'][_0xfa2c('0x4c')]({'where':{'id':_0x43a76e[_0xfa2c('0x49')]['id']}})[_0xfa2c('0x2e')](handleEntityNotFound(_0x2b7ece,null))[_0xfa2c('0x2e')](saveUpdates(_0x43a76e[_0xfa2c('0x4d')],null))['then'](respondWithResult(_0x2b7ece,null))[_0xfa2c('0x22')](handleError(_0x2b7ece,null));};exports[_0xfa2c('0x4e')]=function(_0x432a87,_0x2ee873,_0x4209e2){if(_0x432a87[_0xfa2c('0x4f')]&&_0x432a87[_0xfa2c('0x4f')][_0xfa2c('0x50')]){_0x432a87['body'][_0xfa2c('0x51')]=_0x432a87[_0xfa2c('0x4f')][_0xfa2c('0x50')];}return db['Setting'][_0xfa2c('0x4c')]({'where':{'id':_0x432a87[_0xfa2c('0x49')]['id']}})[_0xfa2c('0x2e')](handleEntityNotFound(_0x2ee873,null))[_0xfa2c('0x2e')](saveUpdates(_0x432a87[_0xfa2c('0x4d')],null))[_0xfa2c('0x2e')](respondWithResult(_0x2ee873,null))[_0xfa2c('0x22')](handleError(_0x2ee873,null));};exports[_0xfa2c('0x52')]=function(_0x1542e8,_0x3b435a,_0x35f27b){if(_0x1542e8[_0xfa2c('0x4f')]&&_0x1542e8[_0xfa2c('0x4f')]['filename']){_0x1542e8[_0xfa2c('0x4d')][_0xfa2c('0x53')]=_0x1542e8[_0xfa2c('0x4f')][_0xfa2c('0x50')];}return db[_0xfa2c('0x34')][_0xfa2c('0x4c')]({'where':{'id':_0x1542e8[_0xfa2c('0x49')]['id']}})[_0xfa2c('0x2e')](handleEntityNotFound(_0x3b435a,null))[_0xfa2c('0x2e')](saveUpdates(_0x1542e8['body'],null))[_0xfa2c('0x2e')](respondWithResult(_0x3b435a,null))[_0xfa2c('0x22')](handleError(_0x3b435a,null));};var utilLicense=require('../../config/license/util');exports[_0xfa2c('0x54')]=function(_0x13811f,_0x382a87,_0x306b00){var _0x34daa2='server/files/images/logos';var _0x4d776c={'custom':![]};return utilLicense[_0xfa2c('0x55')]()[_0xfa2c('0x2e')](function(_0xbd0e5b){if(_0xbd0e5b){_0x4d776c=_0xbd0e5b;}return db[_0xfa2c('0x34')][_0xfa2c('0x4c')]({'where':{'id':_0x13811f[_0xfa2c('0x49')]['id']},'attributes':[_0xfa2c('0x51'),_0xfa2c('0x53'),_0xfa2c('0x56'),_0xfa2c('0x57'),_0xfa2c('0x58'),_0xfa2c('0x59'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xfa2c('0x2e')](handleEntityNotFound(_0x382a87,null))[_0xfa2c('0x2e')](function(_0x4ff9fb){if(_0x4ff9fb){var _0x7ca811=_0x4ff9fb[_0xfa2c('0x51')]&&fs[_0xfa2c('0x5a')](path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x34daa2,_[_0xfa2c('0x5d')](_0x4ff9fb[_0xfa2c('0x51')])))?path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x34daa2,_['toLower'](_0x4ff9fb['logo'])):path[_0xfa2c('0x5b')](config['root'],_0x34daa2,_['toLower'](_0xfa2c('0x5e')));var _0x1d532f=_0xfa2c('0x5f')+_[_0xfa2c('0x60')](_0xfa2c('0x51'));if(_0x4ff9fb[_0x1d532f]||!_0x4d776c[_0xfa2c('0x61')]){_0x7ca811=path[_0xfa2c('0x5b')](config['root'],_0x34daa2,_[_0xfa2c('0x5d')]('default_logo.svg'));}if(!fs['existsSync'](_0x7ca811)){throw new db[(_0xfa2c('0x62'))][(_0xfa2c('0x63'))](_[_0xfa2c('0x60')](_0xfa2c('0x51'))+_0xfa2c('0x64'));}return _0x382a87[_0xfa2c('0x65')](_0x7ca811);}})[_0xfa2c('0x22')](handleError(_0x382a87,null));};var utilLicense=require(_0xfa2c('0x17'));exports['getLogoLogin']=function(_0x3e4fed,_0x14eb0e,_0x3b55f2){var _0x3850f2='server/files/images/logos';var _0x4a14ab={'custom':![]};return utilLicense['getLicense']()[_0xfa2c('0x2e')](function(_0x491719){if(_0x491719){_0x4a14ab=_0x491719;}return db['Setting'][_0xfa2c('0x4c')]({'where':{'id':_0x3e4fed[_0xfa2c('0x49')]['id']},'attributes':[_0xfa2c('0x51'),_0xfa2c('0x53'),_0xfa2c('0x56'),'favicon',_0xfa2c('0x58'),_0xfa2c('0x59'),_0xfa2c('0x66'),'defaultFavicon'],'raw':!![]});})[_0xfa2c('0x2e')](handleEntityNotFound(_0x14eb0e,null))[_0xfa2c('0x2e')](function(_0x47e290){if(_0x47e290){var _0x352157=_0x47e290[_0xfa2c('0x53')]&&fs[_0xfa2c('0x5a')](path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x3850f2,_[_0xfa2c('0x5d')](_0x47e290[_0xfa2c('0x53')])))?path[_0xfa2c('0x5b')](config['root'],_0x3850f2,_[_0xfa2c('0x5d')](_0x47e290['loginLogo'])):path[_0xfa2c('0x5b')](config['root'],_0x3850f2,_['toLower'](_0xfa2c('0x67')));var _0xa790a8='default'+_[_0xfa2c('0x60')](_0xfa2c('0x53'));if(_0x47e290[_0xa790a8]||!_0x4a14ab[_0xfa2c('0x61')]){_0x352157=path[_0xfa2c('0x5b')](config['root'],_0x3850f2,_['toLower'](_0xfa2c('0x67')));}if(!fs[_0xfa2c('0x5a')](_0x352157)){throw new db['Sequelize'][(_0xfa2c('0x63'))](_[_0xfa2c('0x60')](_0xfa2c('0x53'))+_0xfa2c('0x64'));}return _0x14eb0e[_0xfa2c('0x65')](_0x352157);}})[_0xfa2c('0x22')](handleError(_0x14eb0e,null));};exports[_0xfa2c('0x68')]=function(_0x4ad9c5,_0x1cae3a){return db[_0xfa2c('0x34')][_0xfa2c('0x4c')]({'where':{'id':_0x4ad9c5[_0xfa2c('0x49')]['id']},'attributes':[_0xfa2c('0x69')]})[_0xfa2c('0x2e')](respondWithResult(_0x1cae3a,null))['catch'](handleError(_0x1cae3a,null));};exports[_0xfa2c('0x6a')]=function(_0x3f8fcc,_0x4511c9,_0x35905c){if(_0x3f8fcc[_0xfa2c('0x4f')]&&_0x3f8fcc[_0xfa2c('0x4f')]['filename']){_0x3f8fcc[_0xfa2c('0x4d')]['preferred']=_0x3f8fcc[_0xfa2c('0x4f')]['filename'];}return db[_0xfa2c('0x34')]['find']({'where':{'id':_0x3f8fcc[_0xfa2c('0x49')]['id']}})[_0xfa2c('0x2e')](handleEntityNotFound(_0x4511c9,null))[_0xfa2c('0x2e')](saveUpdates(_0x3f8fcc[_0xfa2c('0x4d')],null))[_0xfa2c('0x2e')](respondWithResult(_0x4511c9,null))[_0xfa2c('0x22')](handleError(_0x4511c9,null));};var utilLicense=require(_0xfa2c('0x17'));exports[_0xfa2c('0x6b')]=function(_0x287fc1,_0x31024d,_0x1cc374){var _0x4f564f='server/files/images/logos';var _0x17e835={'custom':![]};return utilLicense['getLicense']()[_0xfa2c('0x2e')](function(_0x4c2380){if(_0x4c2380){_0x17e835=_0x4c2380;}return db[_0xfa2c('0x34')]['find']({'where':{'id':_0x287fc1['params']['id']},'attributes':['logo','loginLogo',_0xfa2c('0x56'),_0xfa2c('0x57'),'defaultLogo',_0xfa2c('0x59'),'defaultPreferred',_0xfa2c('0x6c')],'raw':!![]});})['then'](handleEntityNotFound(_0x31024d,null))[_0xfa2c('0x2e')](function(_0x17cfd2){if(_0x17cfd2){var _0x3fc545=_0x17cfd2[_0xfa2c('0x56')]&&fs[_0xfa2c('0x5a')](path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x4f564f,_['toLower'](_0x17cfd2[_0xfa2c('0x56')])))?path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x4f564f,_[_0xfa2c('0x5d')](_0x17cfd2[_0xfa2c('0x56')])):path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x4f564f,_[_0xfa2c('0x5d')](_0xfa2c('0x6d')));var _0x564f0e=_0xfa2c('0x5f')+_[_0xfa2c('0x60')]('preferred');if(_0x17cfd2[_0x564f0e]||!_0x17e835['custom']||!_0x17e835[_0xfa2c('0x56')]){_0x3fc545=path['join'](config[_0xfa2c('0x5c')],_0x4f564f,_[_0xfa2c('0x5d')](_0xfa2c('0x6d')));}if(!fs[_0xfa2c('0x5a')](_0x3fc545)){throw new db[(_0xfa2c('0x62'))][(_0xfa2c('0x63'))](_['upperFirst'](_0xfa2c('0x56'))+_0xfa2c('0x64'));}return _0x31024d['download'](_0x3fc545);}})[_0xfa2c('0x22')](handleError(_0x31024d,null));};exports['addFavicon']=function(_0x4cd827,_0x292f9d,_0x21c68d){if(_0x4cd827[_0xfa2c('0x4f')]&&_0x4cd827['file'][_0xfa2c('0x50')]){_0x4cd827[_0xfa2c('0x4d')][_0xfa2c('0x57')]=_0x4cd827[_0xfa2c('0x4f')][_0xfa2c('0x50')];}return db[_0xfa2c('0x34')][_0xfa2c('0x4c')]({'where':{'id':_0x4cd827[_0xfa2c('0x49')]['id']}})[_0xfa2c('0x2e')](handleEntityNotFound(_0x292f9d,null))[_0xfa2c('0x2e')](saveUpdates(_0x4cd827[_0xfa2c('0x4d')],null))[_0xfa2c('0x2e')](respondWithResult(_0x292f9d,null))['catch'](handleError(_0x292f9d,null));};var utilLicense=require(_0xfa2c('0x17'));exports[_0xfa2c('0x6e')]=function(_0x198fb3,_0x3a57bf,_0x24baea){var _0x472c10=_0xfa2c('0x6f');var _0x2df54e={'custom':![]};return utilLicense[_0xfa2c('0x55')]()['then'](function(_0x51055b){if(_0x51055b){_0x2df54e=_0x51055b;}return db[_0xfa2c('0x34')][_0xfa2c('0x4c')]({'where':{'id':_0x198fb3[_0xfa2c('0x49')]['id']},'attributes':['logo',_0xfa2c('0x53'),_0xfa2c('0x56'),_0xfa2c('0x57'),_0xfa2c('0x58'),_0xfa2c('0x59'),_0xfa2c('0x66'),_0xfa2c('0x6c')],'raw':!![]});})[_0xfa2c('0x2e')](handleEntityNotFound(_0x3a57bf,null))[_0xfa2c('0x2e')](function(_0x4b8bf5){if(_0x4b8bf5){var _0x46967f=_0x4b8bf5[_0xfa2c('0x57')]&&fs['existsSync'](path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x472c10,_[_0xfa2c('0x5d')](_0x4b8bf5[_0xfa2c('0x57')])))?path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x472c10,_[_0xfa2c('0x5d')](_0x4b8bf5['favicon'])):path[_0xfa2c('0x5b')](config['root'],_0x472c10,_[_0xfa2c('0x5d')](_0xfa2c('0x70')));var _0xcc0ad='default'+_['upperFirst'](_0xfa2c('0x57'));if(_0x4b8bf5[_0xcc0ad]||!_0x2df54e[_0xfa2c('0x61')]){_0x46967f=path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x472c10,_[_0xfa2c('0x5d')](_0xfa2c('0x70')));}if(!fs[_0xfa2c('0x5a')](_0x46967f)){throw new db[(_0xfa2c('0x62'))][(_0xfa2c('0x63'))](_[_0xfa2c('0x60')](_0xfa2c('0x57'))+'\x20not\x20found');}return _0x3a57bf[_0xfa2c('0x65')](_0x46967f);}})[_0xfa2c('0x22')](handleError(_0x3a57bf,null));};exports[_0xfa2c('0x71')]=function(_0x4be3b9,_0x3110a8){var _0x27168c={'offset':moment()[_0xfa2c('0x72')]()};_0x27168c[_0xfa2c('0x73')]=moment()[_0xfa2c('0x72')](_0x27168c[_0xfa2c('0x29')])[_0xfa2c('0x74')](_0xfa2c('0x75'));return _0x3110a8[_0xfa2c('0x24')](0xc8)[_0xfa2c('0x76')](_0x27168c);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 58dbf24..a57a54c 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x7217,0x19e));var _0x7721=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7217[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 3c47fe1..ddf180d 100644 --- a/server/api/setting/setting.rpc.js +++ b/server/api/setting/setting.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb383=['error','message','catch','ShowSetting','find','options','raw','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xb383,0x13f));var _0x3b38=function(_0x32a598,_0x34cbd1){_0x32a598=_0x32a598-0x0;var _0x239f91=_0xb383[_0x32a598];return _0x239f91;};'use strict';var _=require(_0x3b38('0x0'));var util=require(_0x3b38('0x1'));var moment=require(_0x3b38('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b38('0x3'));var fs=require('fs');var Redis=require(_0x3b38('0x4'));var db=require(_0x3b38('0x5'))['db'];var utils=require(_0x3b38('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3b38('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3b38('0x8')][_0x3b38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ebbc7,_0x26fee5,_0x58dd59){return new BPromise(function(_0xc8bee,_0x1c10cc){return client[_0x3b38('0xa')](_0x4ebbc7,_0x58dd59)[_0x3b38('0xb')](function(_0x3761dc){logger[_0x3b38('0xc')](_0x3b38('0xd'),_0x26fee5,_0x3b38('0xe'));logger['debug'](_0x3b38('0xf'),_0x26fee5,'request\x20sent',JSON[_0x3b38('0x10')](_0x3761dc));if(_0x3761dc['error']){if(_0x3761dc[_0x3b38('0x11')]['code']===0x1f4){logger['error'](_0x3b38('0xd'),_0x26fee5,_0x3761dc[_0x3b38('0x11')][_0x3b38('0x12')]);return _0x1c10cc(_0x3761dc[_0x3b38('0x11')]['message']);}logger[_0x3b38('0x11')](_0x3b38('0xd'),_0x26fee5,_0x3761dc[_0x3b38('0x11')][_0x3b38('0x12')]);return _0xc8bee(_0x3761dc['error']['message']);}else{logger['info'](_0x3b38('0xd'),_0x26fee5,_0x3b38('0xe'));_0xc8bee(_0x3761dc['result'][_0x3b38('0x12')]);}})[_0x3b38('0x13')](function(_0x1421b1){logger[_0x3b38('0x11')](_0x3b38('0xd'),_0x26fee5,_0x1421b1);_0x1c10cc(_0x1421b1);});});}exports[_0x3b38('0x14')]=function(_0x52b57e){var _0xed881e=this;return new Promise(function(_0x50718f,_0x2d3e7b){return db['Setting'][_0x3b38('0x15')]({'raw':_0x52b57e[_0x3b38('0x16')]?_0x52b57e[_0x3b38('0x16')][_0x3b38('0x17')]===undefined?!![]:![]:!![],'where':_0x52b57e['options']?_0x52b57e[_0x3b38('0x16')]['where']||null:null,'attributes':_0x52b57e['options']?_0x52b57e[_0x3b38('0x16')][_0x3b38('0x18')]||null:null,'include':_0x52b57e[_0x3b38('0x16')]?_0x52b57e[_0x3b38('0x16')][_0x3b38('0x19')]?_['map'](_0x52b57e['options'][_0x3b38('0x19')],function(_0x1164e0){return{'model':db[_0x1164e0['model']],'as':_0x1164e0['as'],'attributes':_0x1164e0[_0x3b38('0x18')],'include':_0x1164e0['include']?_[_0x3b38('0x1a')](_0x1164e0[_0x3b38('0x19')],function(_0x41cc87){return{'model':db[_0x41cc87[_0x3b38('0x1b')]],'as':_0x41cc87['as'],'attributes':_0x41cc87['attributes'],'include':_0x41cc87[_0x3b38('0x19')]?_[_0x3b38('0x1a')](_0x41cc87[_0x3b38('0x19')],function(_0x58645f){return{'model':db[_0x58645f[_0x3b38('0x1b')]],'as':_0x58645f['as'],'attributes':_0x58645f[_0x3b38('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b38('0xb')](function(_0x3219ff){logger[_0x3b38('0xc')](_0x3b38('0x14'),_0x52b57e);logger['debug'](_0x3b38('0x14'),_0x52b57e,JSON[_0x3b38('0x10')](_0x3219ff));_0x50718f(_0x3219ff);})[_0x3b38('0x13')](function(_0x359fea){logger[_0x3b38('0x11')](_0x3b38('0x14'),_0x359fea[_0x3b38('0x12')],_0x52b57e);_0x2d3e7b(_0xed881e[_0x3b38('0x11')](0x1f4,_0x359fea[_0x3b38('0x12')]));});});}; \ No newline at end of file +var _0x18c3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','Setting','options','raw','where','attributes','map','include','model','ShowSetting','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x18c3,0xe8));var _0x318c=function(_0x4c9143,_0x5cc26d){_0x4c9143=_0x4c9143-0x0;var _0x297b60=_0x18c3[_0x4c9143];return _0x297b60;};'use strict';var _=require(_0x318c('0x0'));var util=require(_0x318c('0x1'));var moment=require(_0x318c('0x2'));var BPromise=require(_0x318c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x318c('0x4'));var db=require(_0x318c('0x5'))['db'];var utils=require(_0x318c('0x6'));var logger=require(_0x318c('0x7'))('rpc');var config=require(_0x318c('0x8'));var jayson=require(_0x318c('0x9'));var client=jayson[_0x318c('0xa')][_0x318c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be9cd,_0x4d00b8,_0x32e9f8){return new BPromise(function(_0x15c735,_0x4c549a){return client[_0x318c('0xc')](_0x2be9cd,_0x32e9f8)[_0x318c('0xd')](function(_0x17ea7c){logger[_0x318c('0xe')]('Setting,\x20%s,\x20%s',_0x4d00b8,'request\x20sent');logger[_0x318c('0xf')](_0x318c('0x10'),_0x4d00b8,_0x318c('0x11'),JSON[_0x318c('0x12')](_0x17ea7c));if(_0x17ea7c['error']){if(_0x17ea7c[_0x318c('0x13')][_0x318c('0x14')]===0x1f4){logger['error'](_0x318c('0x15'),_0x4d00b8,_0x17ea7c[_0x318c('0x13')][_0x318c('0x16')]);return _0x4c549a(_0x17ea7c['error']['message']);}logger[_0x318c('0x13')](_0x318c('0x15'),_0x4d00b8,_0x17ea7c['error']['message']);return _0x15c735(_0x17ea7c[_0x318c('0x13')][_0x318c('0x16')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x4d00b8,_0x318c('0x11'));_0x15c735(_0x17ea7c[_0x318c('0x17')]['message']);}})[_0x318c('0x18')](function(_0x42a687){logger[_0x318c('0x13')](_0x318c('0x15'),_0x4d00b8,_0x42a687);_0x4c549a(_0x42a687);});});}exports['ShowSetting']=function(_0x131253){var _0x19fa50=this;return new Promise(function(_0x24a570,_0x313c55){return db[_0x318c('0x19')]['find']({'raw':_0x131253[_0x318c('0x1a')]?_0x131253['options'][_0x318c('0x1b')]===undefined?!![]:![]:!![],'where':_0x131253[_0x318c('0x1a')]?_0x131253[_0x318c('0x1a')][_0x318c('0x1c')]||null:null,'attributes':_0x131253[_0x318c('0x1a')]?_0x131253[_0x318c('0x1a')][_0x318c('0x1d')]||null:null,'include':_0x131253[_0x318c('0x1a')]?_0x131253[_0x318c('0x1a')]['include']?_[_0x318c('0x1e')](_0x131253[_0x318c('0x1a')][_0x318c('0x1f')],function(_0x5c9ae1){return{'model':db[_0x5c9ae1[_0x318c('0x20')]],'as':_0x5c9ae1['as'],'attributes':_0x5c9ae1[_0x318c('0x1d')],'include':_0x5c9ae1[_0x318c('0x1f')]?_[_0x318c('0x1e')](_0x5c9ae1['include'],function(_0x587c3d){return{'model':db[_0x587c3d['model']],'as':_0x587c3d['as'],'attributes':_0x587c3d['attributes'],'include':_0x587c3d[_0x318c('0x1f')]?_[_0x318c('0x1e')](_0x587c3d[_0x318c('0x1f')],function(_0x3a97a4){return{'model':db[_0x3a97a4[_0x318c('0x20')]],'as':_0x3a97a4['as'],'attributes':_0x3a97a4[_0x318c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x318c('0xd')](function(_0x506b6a){logger[_0x318c('0xe')](_0x318c('0x21'),_0x131253);logger[_0x318c('0xf')]('ShowSetting',_0x131253,JSON[_0x318c('0x12')](_0x506b6a));_0x24a570(_0x506b6a);})[_0x318c('0x18')](function(_0x39631c){logger[_0x318c('0x13')](_0x318c('0x21'),_0x39631c[_0x318c('0x16')],_0x131253);_0x313c55(_0x19fa50[_0x318c('0x13')](0x1f4,_0x39631c[_0x318c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 4ca5144..3db023d 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x83420c,_0x50fd91){var _0x1057d7=function(_0x80befc){while(--_0x80befc){_0x83420c['push'](_0x83420c['shift']());}};_0x1057d7(++_0x50fd91);}(_0x814b,0x1a2));var _0xb814=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x814b[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file +var _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7217,0x19e));var _0x7721=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7217[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 2635f40..2558c27 100644 --- a/server/api/smsAccount/smsAccount.attributes.js +++ b/server/api/smsAccount/smsAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc09=['randomstring','exports','STRING','generate','ENUM','skebby','connectel','clicksend','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x3cd4a1,_0x1fa023){var _0x2e3f77=function(_0x27c6b7){while(--_0x27c6b7){_0x3cd4a1['push'](_0x3cd4a1['shift']());}};_0x2e3f77(++_0x1fa023);}(_0xdc09,0x18f));var _0x9dc0=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xdc09[_0x1da04e];return _0xdd8c41;};'use strict';var Sequelize=require(_0x9dc0('0x0'));var rs=require(_0x9dc0('0x1'));module[_0x9dc0('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x9dc0('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9dc0('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x9dc0('0x3')],'defaultValue':function(){return rs[_0x9dc0('0x4')]();}},'phone':{'type':Sequelize[_0x9dc0('0x3')]},'type':{'type':Sequelize[_0x9dc0('0x5')]('twilio',_0x9dc0('0x6'),_0x9dc0('0x7'),_0x9dc0('0x8'),'plivo',_0x9dc0('0x9'),'bandwidth',_0x9dc0('0xa'),_0x9dc0('0xb'),_0x9dc0('0xc'))},'accountSid':{'type':Sequelize[_0x9dc0('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x9dc0('0x3')]},'smsMethod':{'type':Sequelize[_0x9dc0('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9dc0('0x3')]},'password':{'type':Sequelize[_0x9dc0('0x3')]},'apiKey':{'type':Sequelize[_0x9dc0('0x3')]},'applicationId':{'type':Sequelize[_0x9dc0('0x3')]},'accountId':{'type':Sequelize[_0x9dc0('0x3')]},'senderString':{'type':Sequelize[_0x9dc0('0x3')]},'deliveryReport':{'type':Sequelize[_0x9dc0('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x9dc0('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9dc0('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9dc0('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9dc0('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9dc0('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9dc0('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9dc0('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9dc0('0xf')],'comment':_0x9dc0('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x9dc0('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4374da){if(!_0x4374da)this[_0x9dc0('0x11')](_0x9dc0('0x12'),null);this[_0x9dc0('0x11')](_0x9dc0('0x13'),_0x4374da);}}}; \ No newline at end of file +var _0x26c4=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio','connectel','clicksend','clickatell','csc','infobip','intelepeer','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xd65f4,_0x61ddc5){var _0x543b25=function(_0x57edfa){while(--_0x57edfa){_0xd65f4['push'](_0xd65f4['shift']());}};_0x543b25(++_0x61ddc5);}(_0x26c4,0x1ce));var _0x426c=function(_0x418d70,_0x21a2f1){_0x418d70=_0x418d70-0x0;var _0x3d1295=_0x26c4[_0x418d70];return _0x3d1295;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x426c('0x0'));module[_0x426c('0x1')]={'name':{'type':Sequelize[_0x426c('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x426c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x426c('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x426c('0x2')],'defaultValue':function(){return rs[_0x426c('0x3')]();}},'phone':{'type':Sequelize[_0x426c('0x2')]},'type':{'type':Sequelize[_0x426c('0x4')](_0x426c('0x5'),'skebby',_0x426c('0x6'),_0x426c('0x7'),'plivo',_0x426c('0x8'),'bandwidth',_0x426c('0x9'),_0x426c('0xa'),_0x426c('0xb'))},'accountSid':{'type':Sequelize[_0x426c('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x426c('0x2')]},'smsMethod':{'type':Sequelize[_0x426c('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x426c('0x2')]},'password':{'type':Sequelize[_0x426c('0x2')]},'apiKey':{'type':Sequelize[_0x426c('0x2')]},'applicationId':{'type':Sequelize[_0x426c('0x2')]},'accountId':{'type':Sequelize[_0x426c('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x426c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x426c('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x426c('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x426c('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x426c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x426c('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x426c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x426c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x426c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x426c('0xe')],'comment':_0x426c('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x426c('0xd')],'defaultValue':![],'comment':_0x426c('0x10'),'set':function(_0xb928e7){if(!_0xb928e7)this[_0x426c('0x11')](_0x426c('0x12'),null);this['setDataValue'](_0x426c('0x13'),_0xb928e7);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ee462ac..c53e27a 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb17=['api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','rawAttributes','includeAll','find','create','body','user','UserProfileSection','userProfileId','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','text','connectel','clicksend','plivo','Text','infobip','results','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','startRouting','Start','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','rows','to\x20is\x20mandatory','List','out','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','update','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','intelepeer','statusGet','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4b2624,_0x228524){var _0x1de748=function(_0x4692f2){while(--_0x4692f2){_0x4b2624['push'](_0x4b2624['shift']());}};_0x1de748(++_0x228524);}(_0xeb17,0x1bd));var _0x7eb1=function(_0x329a21,_0x53201a){_0x329a21=_0x329a21-0x0;var _0x3acf4a=_0xeb17[_0x329a21];return _0x3acf4a;};'use strict';var emlformat=require(_0x7eb1('0x0'));var rimraf=require(_0x7eb1('0x1'));var zipdir=require(_0x7eb1('0x2'));var jsonpatch=require(_0x7eb1('0x3'));var rp=require(_0x7eb1('0x4'));var moment=require(_0x7eb1('0x5'));var BPromise=require(_0x7eb1('0x6'));var Mustache=require(_0x7eb1('0x7'));var util=require(_0x7eb1('0x8'));var path=require(_0x7eb1('0x9'));var sox=require(_0x7eb1('0xa'));var csv=require(_0x7eb1('0xb'));var ejs=require(_0x7eb1('0xc'));var fs=require('fs');var fs_extra=require(_0x7eb1('0xd'));var _=require(_0x7eb1('0xe'));var squel=require(_0x7eb1('0xf'));var crypto=require(_0x7eb1('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x7eb1('0x11'));var toCsv=require(_0x7eb1('0xb'));var querystring=require(_0x7eb1('0x12'));var Papa=require('papaparse');var Redis=require(_0x7eb1('0x13'));var authService=require(_0x7eb1('0x14'));var qs=require(_0x7eb1('0x15'));var as=require(_0x7eb1('0x16'));var hardwareService=require(_0x7eb1('0x17'));var logger=require(_0x7eb1('0x18'))(_0x7eb1('0x19'));var utils=require(_0x7eb1('0x1a'));var config=require(_0x7eb1('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7eb1('0x1c')]=_[_0x7eb1('0x1d')](config[_0x7eb1('0x1c')],{'host':_0x7eb1('0x1e'),'port':0x18eb});var socket=require(_0x7eb1('0x1f'))(new Redis(config[_0x7eb1('0x1c')]));require(_0x7eb1('0x20'))['register'](socket);var jayson=require(_0x7eb1('0x21'));var client=jayson['client'][_0x7eb1('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x45e5a2,_0x2a8eb4,_0x2e0800,_0x3c52c5){return new BPromise(function(_0x4e9105,_0x1fc4ba){var _0x21ecdc=_0x3c52c5||client;return _0x21ecdc['request'](_0x45e5a2,_0x2e0800)[_0x7eb1('0x23')](function(_0x503746){logger[_0x7eb1('0x24')](_0x7eb1('0x25'),_0x2a8eb4,_0x7eb1('0x26'));logger[_0x7eb1('0x27')](_0x7eb1('0x28'),_0x2a8eb4,'request\x20sent',JSON['stringify'](_0x503746));if(_0x503746['error']){if(_0x503746[_0x7eb1('0x29')][_0x7eb1('0x2a')]===0x1f4){logger[_0x7eb1('0x29')](_0x7eb1('0x25'),_0x2a8eb4,_0x503746[_0x7eb1('0x29')][_0x7eb1('0x2b')]);return _0x1fc4ba(_0x503746['error'][_0x7eb1('0x2b')]);}logger[_0x7eb1('0x29')]('SmsAccount,\x20%s,\x20%s',_0x2a8eb4,_0x503746['error']['message']);return _0x4e9105(_0x503746['error']['message']);}else{logger[_0x7eb1('0x24')]('SmsAccount,\x20%s,\x20%s',_0x2a8eb4,_0x7eb1('0x26'));_0x4e9105(_0x503746[_0x7eb1('0x2c')][_0x7eb1('0x2b')]);}})[_0x7eb1('0x2d')](function(_0x3e9b23){logger[_0x7eb1('0x29')](_0x7eb1('0x25'),_0x2a8eb4,_0x3e9b23);_0x1fc4ba(_0x3e9b23);});});}function respondWithStatusCode(_0x3f852a,_0x5c82c7){_0x5c82c7=_0x5c82c7||0xcc;return function(_0x9ad83f){if(_0x9ad83f){return _0x3f852a[_0x7eb1('0x2e')](_0x5c82c7);}return _0x3f852a[_0x7eb1('0x2f')](_0x5c82c7)['end']();};}function respondWithResult(_0x11e83f,_0x371f47){_0x371f47=_0x371f47||0xc8;return function(_0x6e9f27){if(_0x6e9f27){return _0x11e83f[_0x7eb1('0x2f')](_0x371f47)[_0x7eb1('0x30')](_0x6e9f27);}};}function respondWithFilteredResult(_0x14aa51,_0x51130a){return function(_0x269833){if(_0x269833){var _0x46c2a8=typeof _0x51130a['offset']===_0x7eb1('0x31')&&typeof _0x51130a[_0x7eb1('0x32')]==='undefined';var _0x4d6650=_0x269833['count'];var _0x182819=_0x46c2a8?0x0:_0x51130a[_0x7eb1('0x33')];var _0x5281a8=_0x46c2a8?_0x269833[_0x7eb1('0x34')]:_0x51130a[_0x7eb1('0x33')]+_0x51130a['limit'];var _0x5c2815;if(_0x5281a8>=_0x4d6650){_0x5281a8=_0x4d6650;_0x5c2815=0xc8;}else{_0x5c2815=0xce;}_0x14aa51[_0x7eb1('0x2f')](_0x5c2815);return _0x14aa51[_0x7eb1('0x35')](_0x7eb1('0x36'),_0x182819+'-'+_0x5281a8+'/'+_0x4d6650)['json'](_0x269833);}return null;};}function patchUpdates(_0x44b1c6){return function(_0x41b16b){try{jsonpatch[_0x7eb1('0x37')](_0x41b16b,_0x44b1c6,!![]);}catch(_0x5048ca){return BPromise[_0x7eb1('0x38')](_0x5048ca);}return _0x41b16b[_0x7eb1('0x39')]();};}function saveUpdates(_0x4b0e6b,_0x348458){return function(_0x22a56c){if(_0x22a56c){return _0x22a56c['update'](_0x4b0e6b)[_0x7eb1('0x23')](function(_0x1e68e3){return _0x1e68e3;});}return null;};}function removeEntity(_0x192fd1,_0x3ca175){return function(_0x1ad802){if(_0x1ad802){return _0x1ad802[_0x7eb1('0x3a')]()['then'](function(){var _0x75894a=_0x1ad802[_0x7eb1('0x3b')]({'plain':!![]});var _0x1a71bd='SmsAccounts';return db[_0x7eb1('0x3c')][_0x7eb1('0x3a')]({'where':{'type':_0x1a71bd,'resourceId':_0x75894a['id']}})[_0x7eb1('0x23')](function(){return _0x1ad802;});})[_0x7eb1('0x23')](function(){_0x192fd1[_0x7eb1('0x2f')](0xcc)[_0x7eb1('0x3d')]();});}};}function handleEntityNotFound(_0x5b43c2,_0x40bd15){return function(_0x5a537c){if(!_0x5a537c){_0x5b43c2[_0x7eb1('0x2e')](0x194);}return _0x5a537c;};}function handleError(_0x570e8c,_0x3bfd47){_0x3bfd47=_0x3bfd47||0x1f4;return function(_0x48dcac){logger['error'](_0x48dcac[_0x7eb1('0x3e')]);if(_0x48dcac[_0x7eb1('0x3f')]){delete _0x48dcac[_0x7eb1('0x3f')];}_0x570e8c[_0x7eb1('0x2f')](_0x3bfd47)[_0x7eb1('0x40')](_0x48dcac);};}exports['index']=function(_0x43d322,_0xb3fab1){var _0x2bb424={'include':[{'model':db[_0x7eb1('0x41')],'as':_0x7eb1('0x42')}]},_0x55ef28={},_0x40cb13={'count':0x0,'rows':[]};var _0x43c669=_[_0x7eb1('0x43')](db[_0x7eb1('0x44')]['rawAttributes'],function(_0x4f3b53){return{'name':_0x4f3b53[_0x7eb1('0x45')],'type':_0x4f3b53[_0x7eb1('0x46')][_0x7eb1('0x47')]};});_0x55ef28[_0x7eb1('0x48')]=_['map'](_0x43c669,'name');_0x55ef28[_0x7eb1('0x49')]=_[_0x7eb1('0x4a')](_0x43d322[_0x7eb1('0x49')]);_0x55ef28[_0x7eb1('0x4b')]=_[_0x7eb1('0x4c')](_0x55ef28[_0x7eb1('0x48')],_0x55ef28['query']);_0x2bb424[_0x7eb1('0x4d')]=_[_0x7eb1('0x4c')](_0x55ef28[_0x7eb1('0x48')],qs[_0x7eb1('0x4e')](_0x43d322[_0x7eb1('0x49')][_0x7eb1('0x4e')]));_0x2bb424[_0x7eb1('0x4d')]=_0x2bb424[_0x7eb1('0x4d')][_0x7eb1('0x4f')]?_0x2bb424[_0x7eb1('0x4d')]:_0x55ef28[_0x7eb1('0x48')];if(!_0x43d322[_0x7eb1('0x49')][_0x7eb1('0x50')](_0x7eb1('0x51'))){_0x2bb424[_0x7eb1('0x32')]=qs[_0x7eb1('0x32')](_0x43d322[_0x7eb1('0x49')]['limit']);_0x2bb424['offset']=qs['offset'](_0x43d322[_0x7eb1('0x49')][_0x7eb1('0x33')]);}_0x2bb424[_0x7eb1('0x52')]=qs[_0x7eb1('0x53')](_0x43d322['query']['sort']);_0x2bb424[_0x7eb1('0x54')]=qs[_0x7eb1('0x4b')](_[_0x7eb1('0x55')](_0x43d322['query'],_0x55ef28[_0x7eb1('0x4b')]),_0x43c669);if(_0x43d322[_0x7eb1('0x49')][_0x7eb1('0x56')]){_0x2bb424[_0x7eb1('0x54')]=_[_0x7eb1('0x57')](_0x2bb424['where'],{'$or':_[_0x7eb1('0x43')](_0x43c669,function(_0x2363e4){if(_0x2363e4[_0x7eb1('0x46')]!==_0x7eb1('0x58')){var _0x3aa43a={};_0x3aa43a[_0x2363e4['name']]={'$like':'%'+_0x43d322['query'][_0x7eb1('0x56')]+'%'};return _0x3aa43a;}})});}_0x2bb424=_[_0x7eb1('0x57')]({},_0x2bb424,_0x43d322[_0x7eb1('0x59')]);var _0x321024={'where':_0x2bb424[_0x7eb1('0x54')]};return db[_0x7eb1('0x44')][_0x7eb1('0x34')](_0x321024)[_0x7eb1('0x23')](function(_0x12df30){_0x40cb13[_0x7eb1('0x34')]=_0x12df30;if(_0x43d322[_0x7eb1('0x49')]['includeAll']){_0x2bb424[_0x7eb1('0x5a')]=[{'all':!![]}];}return db['SmsAccount'][_0x7eb1('0x5b')](_0x2bb424);})[_0x7eb1('0x23')](function(_0x4fe873){_0x40cb13['rows']=_0x4fe873;return _0x40cb13;})[_0x7eb1('0x23')](respondWithFilteredResult(_0xb3fab1,_0x2bb424))[_0x7eb1('0x2d')](handleError(_0xb3fab1,null));};exports[_0x7eb1('0x5c')]=function(_0x450c2e,_0x5e58a3){var _0x276df8={'raw':![],'where':{'id':_0x450c2e[_0x7eb1('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x7eb1('0x42')}]},_0x43f534={};_0x43f534[_0x7eb1('0x48')]=_[_0x7eb1('0x4a')](db[_0x7eb1('0x44')][_0x7eb1('0x5e')]);_0x43f534[_0x7eb1('0x49')]=_['keys'](_0x450c2e['query']);_0x43f534[_0x7eb1('0x4b')]=_[_0x7eb1('0x4c')](_0x43f534[_0x7eb1('0x48')],_0x43f534['query']);_0x276df8[_0x7eb1('0x4d')]=_[_0x7eb1('0x4c')](_0x43f534[_0x7eb1('0x48')],qs[_0x7eb1('0x4e')](_0x450c2e[_0x7eb1('0x49')][_0x7eb1('0x4e')]));_0x276df8['attributes']=_0x276df8[_0x7eb1('0x4d')][_0x7eb1('0x4f')]?_0x276df8['attributes']:_0x43f534[_0x7eb1('0x48')];if(_0x450c2e['query'][_0x7eb1('0x5f')]){_0x276df8[_0x7eb1('0x5a')]=[{'all':!![]}];}_0x276df8=_['merge']({},_0x276df8,_0x450c2e[_0x7eb1('0x59')]);return db[_0x7eb1('0x44')][_0x7eb1('0x60')](_0x276df8)['then'](handleEntityNotFound(_0x5e58a3,null))[_0x7eb1('0x23')](respondWithResult(_0x5e58a3,null))['catch'](handleError(_0x5e58a3,null));};exports[_0x7eb1('0x61')]=function(_0x38e4fc,_0x58284d){return db['SmsAccount'][_0x7eb1('0x61')](_0x38e4fc[_0x7eb1('0x62')],{})['then'](function(_0x41baa0){var _0x282516=_0x38e4fc[_0x7eb1('0x63')][_0x7eb1('0x3b')]({'plain':!![]});if(!_0x282516)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x282516['role']==='user'){var _0x10604d=_0x41baa0[_0x7eb1('0x3b')]({'plain':!![]});var _0x4877a0='SmsAccounts';return db[_0x7eb1('0x64')][_0x7eb1('0x60')]({'where':{'name':_0x4877a0,'userProfileId':_0x282516[_0x7eb1('0x65')]},'raw':!![]})[_0x7eb1('0x23')](function(_0x11866e){if(_0x11866e&&_0x11866e['autoAssociation']===0x0){return db[_0x7eb1('0x3c')][_0x7eb1('0x61')]({'name':_0x10604d[_0x7eb1('0x3f')],'resourceId':_0x10604d['id'],'type':_0x11866e[_0x7eb1('0x3f')],'sectionId':_0x11866e['id']},{})[_0x7eb1('0x23')](function(){return _0x41baa0;});}else{return _0x41baa0;}})[_0x7eb1('0x2d')](function(_0x542a05){logger[_0x7eb1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x542a05);throw _0x542a05;});}return _0x41baa0;})[_0x7eb1('0x23')](respondWithResult(_0x58284d,0xc9))['catch'](handleError(_0x58284d,null));};exports['update']=function(_0x1940fb,_0x1a09dd){if(_0x1940fb[_0x7eb1('0x62')]['id']){delete _0x1940fb['body']['id'];}return db[_0x7eb1('0x44')][_0x7eb1('0x60')]({'where':{'id':_0x1940fb[_0x7eb1('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x7eb1('0x42')}]})[_0x7eb1('0x23')](handleEntityNotFound(_0x1a09dd,null))[_0x7eb1('0x23')](saveUpdates(_0x1940fb['body'],null))['then'](respondWithResult(_0x1a09dd,null))[_0x7eb1('0x2d')](handleError(_0x1a09dd,null));};exports[_0x7eb1('0x3a')]=function(_0x5071df,_0x33bdd0){return db[_0x7eb1('0x44')][_0x7eb1('0x60')]({'where':{'id':_0x5071df[_0x7eb1('0x5d')]['id']}})[_0x7eb1('0x23')](handleEntityNotFound(_0x33bdd0,null))['then'](removeEntity(_0x33bdd0,null))[_0x7eb1('0x2d')](handleError(_0x33bdd0,null));};exports[_0x7eb1('0x66')]=function(_0xe9ba0c,_0x3b5c76){return db['SmsAccount'][_0x7eb1('0x66')]()[_0x7eb1('0x23')](respondWithResult(_0x3b5c76,null))[_0x7eb1('0x2d')](handleError(_0x3b5c76,null));};exports[_0x7eb1('0x67')]=function(_0x45af6a,_0xecd14a,_0x11873f){if(_0x45af6a[_0x7eb1('0x62')]['id']){delete _0x45af6a['body']['id'];}return db[_0x7eb1('0x44')][_0x7eb1('0x60')]({'where':{'id':_0x45af6a[_0x7eb1('0x5d')]['id']}})['then'](handleEntityNotFound(_0xecd14a,null))[_0x7eb1('0x23')](function(_0x2d0695){if(_0x2d0695){_0x45af6a[_0x7eb1('0x62')][_0x7eb1('0x68')]=_0x2d0695['id'];return db[_0x7eb1('0x69')][_0x7eb1('0x61')](_0x45af6a[_0x7eb1('0x62')]);}})[_0x7eb1('0x23')](respondWithResult(_0xecd14a,null))[_0x7eb1('0x2d')](handleError(_0xecd14a,null));};exports[_0x7eb1('0x6a')]=function(_0x52cfa5,_0x4e532a,_0x1d613c){var _0x419460={'raw':![],'where':{}};var _0xa53f70={};var _0x126dc0={'count':0x0,'rows':[]};return db[_0x7eb1('0x44')][_0x7eb1('0x6b')]({'where':{'id':_0x52cfa5[_0x7eb1('0x5d')]['id']}})[_0x7eb1('0x23')](handleEntityNotFound(_0x4e532a,null))['then'](function(_0x4bd6ae){if(_0x4bd6ae){_0xa53f70[_0x7eb1('0x48')]=_['keys'](db['Disposition']['rawAttributes']);_0xa53f70['query']=_[_0x7eb1('0x4a')](_0x52cfa5[_0x7eb1('0x49')]);_0xa53f70[_0x7eb1('0x4b')]=_[_0x7eb1('0x4c')](_0xa53f70['model'],_0xa53f70[_0x7eb1('0x49')]);_0x419460[_0x7eb1('0x4d')]=_[_0x7eb1('0x4c')](_0xa53f70['model'],qs[_0x7eb1('0x4e')](_0x52cfa5[_0x7eb1('0x49')]['fields']));_0x419460[_0x7eb1('0x4d')]=_0x419460[_0x7eb1('0x4d')][_0x7eb1('0x4f')]?_0x419460[_0x7eb1('0x4d')]:_0xa53f70[_0x7eb1('0x48')];if(!_0x52cfa5[_0x7eb1('0x49')][_0x7eb1('0x50')](_0x7eb1('0x51'))){_0x419460['limit']=qs[_0x7eb1('0x32')](_0x52cfa5['query'][_0x7eb1('0x32')]);_0x419460[_0x7eb1('0x33')]=qs['offset'](_0x52cfa5[_0x7eb1('0x49')]['offset']);}_0x419460['order']=qs['sort'](_0x52cfa5['query']['sort']);_0x419460['where']=qs[_0x7eb1('0x4b')](_[_0x7eb1('0x55')](_0x52cfa5['query'],_0xa53f70['filters']));_0x419460[_0x7eb1('0x54')][_0x7eb1('0x68')]=_0x4bd6ae['id'];if(_0x52cfa5[_0x7eb1('0x49')][_0x7eb1('0x56')]){_0x419460[_0x7eb1('0x54')]=_[_0x7eb1('0x57')](_0x419460[_0x7eb1('0x54')],{'$or':_[_0x7eb1('0x43')](_0x419460['attributes'],function(_0x1e1f8a){var _0x427a51={};_0x427a51[_0x1e1f8a]={'$like':'%'+_0x52cfa5[_0x7eb1('0x49')]['filter']+'%'};return _0x427a51;})});}_0x419460=_[_0x7eb1('0x57')]({},_0x419460,_0x52cfa5[_0x7eb1('0x59')]);return db[_0x7eb1('0x69')]['count']({'where':_0x419460[_0x7eb1('0x54')]})['then'](function(_0x3420c3){_0x126dc0[_0x7eb1('0x34')]=_0x3420c3;if(_0x52cfa5[_0x7eb1('0x49')][_0x7eb1('0x5f')]){_0x419460[_0x7eb1('0x5a')]=[{'all':!![]}];}return db[_0x7eb1('0x69')]['findAll'](_0x419460);})[_0x7eb1('0x23')](function(_0x4bf843){_0x126dc0['rows']=_0x4bf843;return _0x126dc0;});}})[_0x7eb1('0x23')](respondWithFilteredResult(_0x4e532a,_0x419460))[_0x7eb1('0x2d')](handleError(_0x4e532a,null));};exports[_0x7eb1('0x6c')]=function(_0x3ed9a3,_0x49b88b,_0x1f7d20){return db['SmsAccount']['find']({'where':{'id':_0x3ed9a3[_0x7eb1('0x5d')]['id']}})['then'](handleEntityNotFound(_0x49b88b,null))[_0x7eb1('0x23')](function(_0x1fd6d8){if(_0x1fd6d8){return _0x1fd6d8[_0x7eb1('0x6c')](_0x3ed9a3[_0x7eb1('0x49')][_0x7eb1('0x6d')]);}})[_0x7eb1('0x23')](respondWithStatusCode(_0x49b88b,null))['catch'](handleError(_0x49b88b,null));};exports[_0x7eb1('0x6e')]=function(_0x36498e,_0x1168af,_0x89b43c){if(_0x36498e[_0x7eb1('0x62')]['id']){delete _0x36498e['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x36498e['params']['id']}})['then'](handleEntityNotFound(_0x1168af,null))['then'](function(_0x3b1bb8){if(_0x3b1bb8){_0x36498e[_0x7eb1('0x62')][_0x7eb1('0x68')]=_0x3b1bb8['id'];return db[_0x7eb1('0x6f')][_0x7eb1('0x61')](_0x36498e[_0x7eb1('0x62')]);}})['then'](respondWithResult(_0x1168af,null))['catch'](handleError(_0x1168af,null));};exports[_0x7eb1('0x70')]=function(_0x296c8a,_0x225caa,_0x688f01){var _0x5cf888={'raw':![],'where':{}};var _0x4490c3={};var _0x156a18={'count':0x0,'rows':[]};return db[_0x7eb1('0x44')]['findOne']({'where':{'id':_0x296c8a[_0x7eb1('0x5d')]['id']}})[_0x7eb1('0x23')](handleEntityNotFound(_0x225caa,null))[_0x7eb1('0x23')](function(_0x5b4f86){if(_0x5b4f86){_0x4490c3[_0x7eb1('0x48')]=_[_0x7eb1('0x4a')](db[_0x7eb1('0x6f')][_0x7eb1('0x5e')]);_0x4490c3[_0x7eb1('0x49')]=_[_0x7eb1('0x4a')](_0x296c8a[_0x7eb1('0x49')]);_0x4490c3['filters']=_[_0x7eb1('0x4c')](_0x4490c3['model'],_0x4490c3[_0x7eb1('0x49')]);_0x5cf888[_0x7eb1('0x4d')]=_['intersection'](_0x4490c3[_0x7eb1('0x48')],qs[_0x7eb1('0x4e')](_0x296c8a[_0x7eb1('0x49')]['fields']));_0x5cf888[_0x7eb1('0x4d')]=_0x5cf888[_0x7eb1('0x4d')][_0x7eb1('0x4f')]?_0x5cf888['attributes']:_0x4490c3[_0x7eb1('0x48')];if(!_0x296c8a[_0x7eb1('0x49')]['hasOwnProperty']('nolimit')){_0x5cf888[_0x7eb1('0x32')]=qs['limit'](_0x296c8a[_0x7eb1('0x49')][_0x7eb1('0x32')]);_0x5cf888[_0x7eb1('0x33')]=qs[_0x7eb1('0x33')](_0x296c8a[_0x7eb1('0x49')][_0x7eb1('0x33')]);}_0x5cf888[_0x7eb1('0x52')]=qs[_0x7eb1('0x53')](_0x296c8a[_0x7eb1('0x49')][_0x7eb1('0x53')]);_0x5cf888[_0x7eb1('0x54')]=qs[_0x7eb1('0x4b')](_[_0x7eb1('0x55')](_0x296c8a['query'],_0x4490c3[_0x7eb1('0x4b')]));_0x5cf888[_0x7eb1('0x54')][_0x7eb1('0x68')]=_0x5b4f86['id'];if(_0x296c8a[_0x7eb1('0x49')][_0x7eb1('0x56')]){_0x5cf888['where']=_[_0x7eb1('0x57')](_0x5cf888[_0x7eb1('0x54')],{'$or':_[_0x7eb1('0x43')](_0x5cf888['attributes'],function(_0x325c02){var _0x5112b4={};_0x5112b4[_0x325c02]={'$like':'%'+_0x296c8a[_0x7eb1('0x49')][_0x7eb1('0x56')]+'%'};return _0x5112b4;})});}_0x5cf888=_[_0x7eb1('0x57')]({},_0x5cf888,_0x296c8a['options']);return db[_0x7eb1('0x6f')][_0x7eb1('0x34')]({'where':_0x5cf888['where']})['then'](function(_0x232367){_0x156a18[_0x7eb1('0x34')]=_0x232367;if(_0x296c8a[_0x7eb1('0x49')][_0x7eb1('0x5f')]){_0x5cf888['include']=[{'all':!![]}];}return db[_0x7eb1('0x6f')]['findAll'](_0x5cf888);})[_0x7eb1('0x23')](function(_0x16aacd){_0x156a18['rows']=_0x16aacd;return _0x156a18;});}})[_0x7eb1('0x23')](respondWithFilteredResult(_0x225caa,_0x5cf888))['catch'](handleError(_0x225caa,null));};exports[_0x7eb1('0x71')]=function(_0x5b907c,_0x20bfe2,_0x24b0c2){return db[_0x7eb1('0x44')][_0x7eb1('0x60')]({'where':{'id':_0x5b907c[_0x7eb1('0x5d')]['id']}})[_0x7eb1('0x23')](handleEntityNotFound(_0x20bfe2,null))[_0x7eb1('0x23')](function(_0x168ffb){if(_0x168ffb){return _0x168ffb[_0x7eb1('0x71')](_0x5b907c[_0x7eb1('0x49')][_0x7eb1('0x6d')]);}})[_0x7eb1('0x23')](respondWithStatusCode(_0x20bfe2,null))['catch'](handleError(_0x20bfe2,null));};exports[_0x7eb1('0x72')]=function(_0x324e08,_0x2b4b93,_0x3b3384){var _0x52b48b={'channel':_0x7eb1('0x73')};var _0x515b77=[];var _0x51d7e7=[];var _0x2dc7ab={};return db[_0x7eb1('0x44')][_0x7eb1('0x60')]({'where':{'id':_0x324e08[_0x7eb1('0x5d')]['id']},'include':[{'model':db[_0x7eb1('0x74')],'as':_0x7eb1('0x75')}]})[_0x7eb1('0x23')](handleEntityNotFound(_0x2b4b93,null))['then'](function(_0xff98e8){_0x52b48b['account']=_0xff98e8;_0x52b48b[_0x7eb1('0x76')]=_[_0x7eb1('0x77')](_0xff98e8[_0x7eb1('0x75')],[_0x7eb1('0x78')],[_0x7eb1('0x79')]);if(_0x52b48b[_0x7eb1('0x7a')][_0x7eb1('0x75')]){delete _0x52b48b['account']['Applications'];}return db['CmContact'][_0x7eb1('0x66')]();})[_0x7eb1('0x23')](function(_0x1212ee){if(!_0x1212ee){throw new db[(_0x7eb1('0x7b'))][(_0x7eb1('0x7c'))](_0x7eb1('0x7d'));}_0x515b77=_[_0x7eb1('0x7e')](_[_0x7eb1('0x4a')](_0x1212ee),['createdAt',_0x7eb1('0x7f')]);_0x51d7e7=_['difference'](_['keys'](_0x1212ee),[_0x7eb1('0x80'),'updatedAt','CompanyId',_0x7eb1('0x81')]);_0x52b48b[_0x7eb1('0x62')]={'mapKey':_0x7eb1('0x82')};if(_0x52b48b[_0x7eb1('0x7a')]['type']){switch(_0x52b48b[_0x7eb1('0x7a')]['type']){case _0x7eb1('0x83'):_0x52b48b['body'][_0x7eb1('0x84')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x85')];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x62')]=_0x324e08[_0x7eb1('0x62')]['Body'];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x86')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x87')];break;case _0x7eb1('0x88'):_0x52b48b['body'][_0x7eb1('0x84')]='+'+_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x89')];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x62')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x8a')];break;case _0x7eb1('0x8b'):_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x84')]=_0x324e08[_0x7eb1('0x62')]['from'];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x62')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x2b')];break;case _0x7eb1('0x8c'):_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x84')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x84')];_0x52b48b['body'][_0x7eb1('0x62')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x62')];_0x52b48b['body'][_0x7eb1('0x86')]=_0x324e08[_0x7eb1('0x62')]['message_id'];break;case _0x7eb1('0x8d'):_0x52b48b['body'][_0x7eb1('0x84')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x85')];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x62')]=_0x324e08['body'][_0x7eb1('0x8e')];_0x52b48b[_0x7eb1('0x62')]['messageId']=_0x324e08[_0x7eb1('0x62')]['MessageUUID'];break;case _0x7eb1('0x8f'):_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x84')]='+'+_0x324e08[_0x7eb1('0x62')]['results'][0x0][_0x7eb1('0x84')];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x62')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x90')][0x0][_0x7eb1('0x8a')];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x86')]=_0x324e08[_0x7eb1('0x62')]['results'][0x0][_0x7eb1('0x86')];break;case'csc':_0x52b48b['body']['from']=_0x324e08[_0x7eb1('0x62')]['originatingAddress'];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x62')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x91')]['message'];break;case _0x7eb1('0x92'):_0x52b48b['body'][_0x7eb1('0x84')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x93')];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x62')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x8a')];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x86')]=_0x324e08['body'][_0x7eb1('0x94')];break;case _0x7eb1('0x95'):_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x86')]=_0x324e08[_0x7eb1('0x62')][0x0][_0x7eb1('0x2b')]['id'];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x84')]=_0x324e08[_0x7eb1('0x62')][0x0][_0x7eb1('0x2b')][_0x7eb1('0x84')];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x62')]=_0x324e08['body'][0x0][_0x7eb1('0x2b')][_0x7eb1('0x8a')];break;case'intelepeer':_0x52b48b['body'][_0x7eb1('0x84')]=_0x324e08[_0x7eb1('0x62')]['from'];_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x62')]=_0x324e08[_0x7eb1('0x62')]['message'];_0x52b48b['body'][_0x7eb1('0x86')]=_0x324e08[_0x7eb1('0x62')][_0x7eb1('0x96')];break;}}if(_0x52b48b['body']['id']){delete _0x52b48b[_0x7eb1('0x62')]['id'];}if(_[_0x7eb1('0x97')](_0x52b48b['body']['from'])){throw new db[(_0x7eb1('0x7b'))][(_0x7eb1('0x7c'))](_0x7eb1('0x98'));}if(_['isNil'](_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x62')])||_0x52b48b['body'][_0x7eb1('0x62')]===''){throw new db[(_0x7eb1('0x7b'))]['ValidationError'](_0x7eb1('0x99'));}if(_['isNil'](_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x9a')])){throw new db[(_0x7eb1('0x7b'))][(_0x7eb1('0x7c'))](_0x7eb1('0x9b')+_0x51d7e7);}if(!_[_0x7eb1('0x9c')](_0x51d7e7,_0x52b48b[_0x7eb1('0x62')]['mapKey'])){throw new db[(_0x7eb1('0x7b'))][(_0x7eb1('0x7c'))](_0x7eb1('0x9d')+_0x51d7e7);}_0x2dc7ab[_0x52b48b['body'][_0x7eb1('0x9a')]]=_0x52b48b[_0x7eb1('0x62')]['from'];return db[_0x7eb1('0x9e')][_0x7eb1('0x60')]({'where':{'id':_0x52b48b['account'][_0x7eb1('0x81')]},'include':[{'model':db[_0x7eb1('0x9f')],'as':_0x7eb1('0xa0'),'where':_0x2dc7ab,'limit':0x1,'order':[[_0x7eb1('0x7f'),_0x7eb1('0xa1')]]}]});})[_0x7eb1('0x23')](handleEntityNotFound(_0x2b4b93,null))[_0x7eb1('0x23')](function(_0x43da05){if(_0x43da05){_0x52b48b['list']=_[_0x7eb1('0xa2')](_0x43da05,[_0x7eb1('0xa0')]);if(_0x43da05[_0x7eb1('0xa0')][_0x7eb1('0x4f')]){return _0x43da05['Contacts'][0x0];}var _0x476711=_['defaults'](_0x52b48b[_0x7eb1('0x62')],{'firstName':_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x84')],'ListId':_0x43da05['id']});_0x476711[_0x52b48b[_0x7eb1('0x62')]['mapKey']]=_0x52b48b['body'][_0x7eb1('0x84')];return db[_0x7eb1('0x9f')]['create'](_0x476711,{'fields':_0x515b77,'raw':!![]});}})[_0x7eb1('0x23')](handleEntityNotFound(_0x2b4b93,null))['then'](function(_0x19e6e8){if(_0x19e6e8){_0x52b48b[_0x7eb1('0xa3')]=_0x19e6e8;var _0x5ad835={'ContactId':_0x19e6e8['id'],'phone':_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x84')],'SmsAccountId':_0x324e08[_0x7eb1('0x5d')]['id']};var _0x396c5e={'ContactId':_0x19e6e8['id'],'SmsAccountId':_0x324e08[_0x7eb1('0x5d')]['id'],'closed':![]};return db[_0x7eb1('0xa4')][_0x7eb1('0x60')]({'where':_0x396c5e})[_0x7eb1('0x23')](function(_0xdf56c){if(_0xdf56c){return[_0xdf56c,![]];}return db[_0x7eb1('0xa4')][_0x7eb1('0x61')](_0x5ad835)[_0x7eb1('0x23')](function(_0x2a55b0){return[_0x2a55b0,!![]];});});}})[_0x7eb1('0xa5')](function(_0x3478e7,_0x1f2e7e){_0x52b48b[_0x7eb1('0xa6')]=_0x3478e7[_0x7eb1('0x3b')]({'plain':!![]});_0x52b48b[_0x7eb1('0xa6')][_0x7eb1('0xa7')]=![];if(_0x1f2e7e){if(_0x52b48b[_0x7eb1('0x7a')][_0x7eb1('0xa8')]){_0x52b48b[_0x7eb1('0x76')][_0x7eb1('0xa9')]({'id':0x0,'priority':_0x52b48b[_0x7eb1('0x76')]['length']+0x1,'app':_0x7eb1('0xaa'),'appdata':'unmanaged','interval':_0x7eb1('0xab')});}_0x52b48b['interaction']['created']=!![];}return db[_0x7eb1('0xac')][_0x7eb1('0x61')]({'phone':_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x84')],'messageId':_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x86')],'body':_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0x62')],'SmsAccountId':_0x324e08[_0x7eb1('0x5d')]['id'],'SmsInteractionId':_0x3478e7['id'],'direction':'in','ContactId':_0x3478e7[_0x7eb1('0xad')],'AttachmentId':_0x52b48b[_0x7eb1('0x62')][_0x7eb1('0xae')]});})[_0x7eb1('0x23')](function(_0x2dc508){_0x52b48b[_0x7eb1('0x2b')]=_0x2dc508;if(_0x52b48b['interaction'][_0x7eb1('0xaf')]){return db[_0x7eb1('0xb0')]['find']({'attributes':['id',_0x7eb1('0x3f')],'where':{'id':_0x52b48b['interaction'][_0x7eb1('0xaf')]}})[_0x7eb1('0x23')](function(_0x905b50){if(_0x905b50){_0x52b48b[_0x7eb1('0x76')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7eb1('0xb1'),'appdata':_0x905b50[_0x7eb1('0x3f')]+','+(_0x52b48b[_0x7eb1('0x7a')]['waitForTheAssignedAgent']||0xa),'interval':_0x7eb1('0xab')});}return respondWithRpcPromise('Start',_0x7eb1('0xb2'),_0x52b48b);});}return respondWithRpcPromise(_0x7eb1('0xb3'),_0x7eb1('0xb2'),_0x52b48b);})[_0x7eb1('0x23')](function(_0x41d951){if(_0x41d951){var _0x738e8c=0xc8;var _0x5955eb='receiveMessage';logger[_0x7eb1('0x24')](_0x7eb1('0x28'),_0x5955eb,_0x738e8c,'entity\x20found');logger[_0x7eb1('0x27')](_0x7eb1('0xb4'),_0x5955eb,_0x738e8c,_0x7eb1('0xb5'),JSON[_0x7eb1('0xb6')](_0x41d951));if(_0x52b48b[_0x7eb1('0x7a')][_0x7eb1('0x46')]===_0x7eb1('0x83')){return _0x2b4b93['status'](_0x738e8c)[_0x7eb1('0x35')](_0x7eb1('0xb7'),_0x7eb1('0xb8'))[_0x7eb1('0x40')](_0x7eb1('0xb9'));}else{return _0x2b4b93[_0x7eb1('0x2f')](_0x738e8c)[_0x7eb1('0x30')](_0x41d951);}}})['catch'](handleError(_0x2b4b93,null));};exports[_0x7eb1('0xba')]=function(_0x27a856,_0x1757fc){var _0x24b0b9=_0x27a856[_0x7eb1('0x5d')]['id'];var _0x27301f=_0x27a856['body'];var _0x45d72c=0xc8;var _0x4078df=null;return db[_0x7eb1('0xbb')][_0x7eb1('0xbc')]({'isolationLevel':db['sequelize']['Transaction'][_0x7eb1('0xbd')][_0x7eb1('0xbe')]},function(_0x45f6ef){return db[_0x7eb1('0x44')][_0x7eb1('0x6b')]({'where':{'id':_0x24b0b9},'transaction':_0x45f6ef})[_0x7eb1('0x23')](function(_0x4d0f68){if(_0x4d0f68){return db[_0x7eb1('0x74')]['destroy']({'where':{'SmsAccountId':_0x24b0b9},'transaction':_0x45f6ef})['then'](function(){var _0x575fff=_[_0x7eb1('0x43')](_0x27301f,function(_0x336a5a){_0x336a5a['SmsAccountId']=_0x24b0b9;return _0x336a5a;});return db[_0x7eb1('0x74')]['bulkCreate'](_0x575fff,{'transaction':_0x45f6ef});});}else{_0x45d72c=0x194;_0x4078df=[];}});})['then'](function(){if(_0x45d72c!==0x194){return db[_0x7eb1('0x74')][_0x7eb1('0xbf')]({'where':{'SmsAccountId':_0x24b0b9},'order':'priority'})[_0x7eb1('0x23')](function(_0x4d803f){_0x4078df=_0x4d803f;});}})[_0x7eb1('0x2d')](function(_0x5eb2be){_0x45d72c=0x1f4;logger[_0x7eb1('0x29')](_0x5eb2be[_0x7eb1('0x3e')]);if(_0x5eb2be[_0x7eb1('0x3f')]){delete _0x5eb2be[_0x7eb1('0x3f')];}_0x4078df=_0x5eb2be;})['finally'](function(){if(_0x4078df===null){_0x1757fc['sendStatus'](_0x45d72c);}else{if(_0x45d72c===0x1f4){_0x1757fc[_0x7eb1('0x2f')](_0x45d72c)[_0x7eb1('0x40')](_0x4078df);}else{_0x1757fc['status'](_0x45d72c)[_0x7eb1('0x30')](_0x4078df);}}});};exports[_0x7eb1('0xc0')]=function(_0x18d322,_0x1457e7,_0x308de4){var _0x3643e9={};var _0x5b9876={};var _0x5609ce;var _0x307be0;return db[_0x7eb1('0x44')][_0x7eb1('0x6b')]({'where':{'id':_0x18d322[_0x7eb1('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1457e7,null))[_0x7eb1('0x23')](function(_0x15ade5){if(_0x15ade5){_0x5609ce=_0x15ade5;_0x5b9876[_0x7eb1('0x48')]=_[_0x7eb1('0x4a')](db[_0x7eb1('0x74')][_0x7eb1('0x5e')]);_0x5b9876[_0x7eb1('0x49')]=_['keys'](_0x18d322['query']);_0x5b9876[_0x7eb1('0x4b')]=_[_0x7eb1('0x4c')](_0x5b9876[_0x7eb1('0x48')],_0x5b9876['query']);_0x3643e9['attributes']=_[_0x7eb1('0x4c')](_0x5b9876[_0x7eb1('0x48')],qs[_0x7eb1('0x4e')](_0x18d322[_0x7eb1('0x49')]['fields']));_0x3643e9['attributes']=_0x3643e9['attributes'][_0x7eb1('0x4f')]?_0x3643e9[_0x7eb1('0x4d')]:_0x5b9876[_0x7eb1('0x48')];_0x3643e9['order']=qs['sort'](_0x18d322[_0x7eb1('0x49')]['sort']);_0x3643e9[_0x7eb1('0x54')]=qs['filters'](_[_0x7eb1('0x55')](_0x18d322[_0x7eb1('0x49')],_0x5b9876[_0x7eb1('0x4b')]));if(_0x18d322[_0x7eb1('0x49')][_0x7eb1('0x56')]){_0x3643e9[_0x7eb1('0x54')]=_[_0x7eb1('0x57')](_0x3643e9['where'],{'$or':_[_0x7eb1('0x43')](_0x3643e9[_0x7eb1('0x4d')],function(_0x4afef3){var _0x14143d={};_0x14143d[_0x4afef3]={'$like':'%'+_0x18d322[_0x7eb1('0x49')]['filter']+'%'};return _0x14143d;})});}_0x3643e9=_[_0x7eb1('0x57')]({},_0x3643e9,_0x18d322[_0x7eb1('0x59')]);return _0x5609ce[_0x7eb1('0xc0')](_0x3643e9);}})[_0x7eb1('0x23')](function(_0x5c0061){if(_0x5c0061){_0x307be0=_0x5c0061[_0x7eb1('0x4f')];if(!_0x18d322[_0x7eb1('0x49')]['hasOwnProperty'](_0x7eb1('0x51'))){_0x3643e9[_0x7eb1('0x32')]=qs['limit'](_0x18d322[_0x7eb1('0x49')][_0x7eb1('0x32')]);_0x3643e9[_0x7eb1('0x33')]=qs[_0x7eb1('0x33')](_0x18d322[_0x7eb1('0x49')]['offset']);}return _0x5609ce[_0x7eb1('0xc0')](_0x3643e9);}})[_0x7eb1('0x23')](function(_0x166e74){if(_0x166e74){return _0x166e74?{'count':_0x307be0,'rows':_0x166e74}:null;}})[_0x7eb1('0x23')](respondWithResult(_0x1457e7,null))[_0x7eb1('0x2d')](handleError(_0x1457e7,null));};exports[_0x7eb1('0xc1')]=function(_0x16854a,_0x62e90d,_0x56f858){var _0x293e8b={'raw':![],'where':{}};var _0x14d0d4={};var _0x2cfe49={'count':0x0,'rows':[]};return db[_0x7eb1('0x44')]['findOne']({'where':{'id':_0x16854a[_0x7eb1('0x5d')]['id']}})[_0x7eb1('0x23')](handleEntityNotFound(_0x62e90d,null))[_0x7eb1('0x23')](function(_0x11ad53){if(_0x11ad53){_0x14d0d4[_0x7eb1('0x48')]=_[_0x7eb1('0x4a')](db[_0x7eb1('0xa4')][_0x7eb1('0x5e')]);_0x14d0d4[_0x7eb1('0x49')]=_[_0x7eb1('0x4a')](_0x16854a['query']);_0x14d0d4[_0x7eb1('0x4b')]=_[_0x7eb1('0x4c')](_0x14d0d4[_0x7eb1('0x48')],_0x14d0d4['query']);_0x293e8b[_0x7eb1('0x4d')]=_[_0x7eb1('0x4c')](_0x14d0d4[_0x7eb1('0x48')],qs[_0x7eb1('0x4e')](_0x16854a[_0x7eb1('0x49')][_0x7eb1('0x4e')]));_0x293e8b['attributes']=_0x293e8b[_0x7eb1('0x4d')][_0x7eb1('0x4f')]?_0x293e8b[_0x7eb1('0x4d')]:_0x14d0d4[_0x7eb1('0x48')];if(!_0x16854a[_0x7eb1('0x49')][_0x7eb1('0x50')]('nolimit')){_0x293e8b['limit']=qs[_0x7eb1('0x32')](_0x16854a[_0x7eb1('0x49')][_0x7eb1('0x32')]);_0x293e8b['offset']=qs[_0x7eb1('0x33')](_0x16854a['query']['offset']);}_0x293e8b[_0x7eb1('0x52')]=qs[_0x7eb1('0x53')](_0x16854a[_0x7eb1('0x49')]['sort']);_0x293e8b[_0x7eb1('0x54')]=qs[_0x7eb1('0x4b')](_[_0x7eb1('0x55')](_0x16854a[_0x7eb1('0x49')],_0x14d0d4[_0x7eb1('0x4b')]));_0x293e8b['where'][_0x7eb1('0x68')]=_0x11ad53['id'];if(_0x16854a[_0x7eb1('0x49')][_0x7eb1('0x56')]){_0x293e8b[_0x7eb1('0x54')]=_[_0x7eb1('0x57')](_0x293e8b[_0x7eb1('0x54')],{'$or':_[_0x7eb1('0x43')](_0x293e8b[_0x7eb1('0x4d')],function(_0x211e02){var _0x18ceef={};_0x18ceef[_0x211e02]={'$like':'%'+_0x16854a['query'][_0x7eb1('0x56')]+'%'};return _0x18ceef;})});}_0x293e8b=_['merge']({},_0x293e8b,_0x16854a[_0x7eb1('0x59')]);return db[_0x7eb1('0xa4')][_0x7eb1('0x34')]({'where':_0x293e8b['where']})[_0x7eb1('0x23')](function(_0x59d152){_0x2cfe49[_0x7eb1('0x34')]=_0x59d152;if(_0x16854a[_0x7eb1('0x49')]['includeAll']){_0x293e8b[_0x7eb1('0x5a')]=[{'model':db['CmContact'],'as':_0x7eb1('0xc2'),'required':![]},{'model':db[_0x7eb1('0xb0')],'as':_0x7eb1('0xc3'),'attributes':['name','fullname',_0x7eb1('0xc4')],'required':![]},{'model':db[_0x7eb1('0xc5')],'as':_0x7eb1('0xc6'),'attributes':['id','name',_0x7eb1('0xc7')],'where':_0x16854a[_0x7eb1('0x49')][_0x7eb1('0xc8')]?{'id':_0x16854a[_0x7eb1('0x49')][_0x7eb1('0xc8')]}:undefined,'required':_0x16854a[_0x7eb1('0x49')]['tag']?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x293e8b);})[_0x7eb1('0x23')](function(_0x5d6dd8){_0x2cfe49[_0x7eb1('0xc9')]=_0x5d6dd8;return _0x2cfe49;});}})['then'](respondWithFilteredResult(_0x62e90d,_0x293e8b))[_0x7eb1('0x2d')](handleError(_0x62e90d,null));};exports[_0x7eb1('0x40')]=function(_0x2ba2ea,_0x9925d6,_0x3ccfe1){var _0x4e63cf,_0x32f24f,_0x2ac155;if(_[_0x7eb1('0x97')](_0x2ba2ea[_0x7eb1('0x62')]['body'])||_0x2ba2ea[_0x7eb1('0x62')][_0x7eb1('0x62')]===''){throw new db[(_0x7eb1('0x7b'))][(_0x7eb1('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7eb1('0x97')](_0x2ba2ea['body']['to'])){throw new db[(_0x7eb1('0x7b'))]['ValidationError'](_0x7eb1('0xca'));}_0x4e63cf=_0x2ba2ea[_0x7eb1('0x62')]['to'];return db['SmsAccount'][_0x7eb1('0x60')]({'where':{'id':_0x2ba2ea[_0x7eb1('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7eb1('0x9f')],'as':_0x7eb1('0xa0'),'where':{'mobile':_0x4e63cf},'limit':0x1,'order':[[_0x7eb1('0x7f'),_0x7eb1('0xa1')]]}]}]})[_0x7eb1('0x23')](handleEntityNotFound(_0x9925d6,null))[_0x7eb1('0x23')](function(_0x831334){if(_0x831334&&_0x831334['List']){_0x32f24f=_0x831334[_0x7eb1('0x3b')]({'plain':!![]});if(_0x32f24f[_0x7eb1('0xcb')]&&_0x32f24f[_0x7eb1('0xcb')][_0x7eb1('0xa0')][_0x7eb1('0x4f')]){return _0x32f24f[_0x7eb1('0xcb')]['Contacts'][0x0];}return db['CmContact'][_0x7eb1('0x61')](_[_0x7eb1('0x1d')](_0x2ba2ea[_0x7eb1('0x62')],{'firstName':_0x4e63cf,'mobile':_0x4e63cf,'phone':_0x4e63cf,'ListId':_0x32f24f[_0x7eb1('0x81')]}));}})[_0x7eb1('0x23')](handleEntityNotFound(_0x9925d6,null))['then'](function(_0x12d08b){if(_0x12d08b){_0x2ac155=_0x12d08b;return db[_0x7eb1('0xa4')][_0x7eb1('0x60')]({'where':{'ContactId':_0x2ac155['id'],'closed':![],'SmsAccountId':_0x32f24f['id']}})[_0x7eb1('0x23')](function(_0x47c8e6){if(_0x47c8e6){return[_0x47c8e6,![]];}return db[_0x7eb1('0xa4')]['create']({'UserId':_0x2ba2ea[_0x7eb1('0x63')]['id'],'ContactId':_0x2ac155['id'],'SmsAccountId':_0x32f24f['id'],'phone':_0x4e63cf,'firstMsgDirection':_0x7eb1('0xcc'),'Messages':[_[_0x7eb1('0x57')](_0x2ba2ea[_0x7eb1('0x62')],{'read':![],'body':_0x2ba2ea[_0x7eb1('0x62')]['body'],'phone':_0x4e63cf,'SmsAccountId':_0x32f24f['id'],'UserId':_0x2ba2ea[_0x7eb1('0x63')]['id'],'ContactId':_0x2ac155['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x7eb1('0xcd')}]})[_0x7eb1('0x23')](function(_0x11a6ed){return[_0x11a6ed,!![]];});});}})[_0x7eb1('0xa5')](function(_0x1c6da5,_0x3df1a4){if(_0x3df1a4){return _0x1c6da5;}return db[_0x7eb1('0xac')]['create'](_['merge'](_0x2ba2ea[_0x7eb1('0x62')],{'read':![],'body':_0x2ba2ea[_0x7eb1('0x62')][_0x7eb1('0x62')],'phone':_0x4e63cf,'SmsAccountId':_0x32f24f['id'],'SmsInteractionId':_0x1c6da5['id'],'UserId':_0x2ba2ea[_0x7eb1('0x63')]['id'],'ContactId':_0x2ac155['id']}))[_0x7eb1('0x23')](function(_0x5ad611){_0x1c6da5[_0x7eb1('0xce')][_0x7eb1('0xcd')]=[];_0x1c6da5['dataValues']['Messages'][_0x7eb1('0xa9')](_0x5ad611[_0x7eb1('0xce')]);return _0x1c6da5;});})['then'](respondWithResult(_0x9925d6,null))[_0x7eb1('0x2d')](handleError(_0x9925d6,null));};exports[_0x7eb1('0x2f')]=function(_0xd76a29,_0x2f40d2,_0x129b47){if(_0xd76a29[_0x7eb1('0x62')]['id']){delete _0xd76a29[_0x7eb1('0x62')]['id'];}var _0x398210,_0x3c82e4,_0x457d69;return db[_0x7eb1('0x44')][_0x7eb1('0x60')]({'where':{'id':_0xd76a29[_0x7eb1('0x5d')]['id']}})[_0x7eb1('0x23')](handleEntityNotFound(_0x2f40d2,null))[_0x7eb1('0x23')](function(_0x3a11d5){if(_0x3a11d5){_0x457d69=_0x3a11d5;logger[_0x7eb1('0x27')](_0x7eb1('0x28'),_0x7eb1('0x2f'),'received\x20delivery\x20report\x20from',_0x3a11d5[_0x7eb1('0x46')],util[_0x7eb1('0xcf')](_0xd76a29[_0x7eb1('0x62')],{'showHidden':![],'depth':null}));switch(_0x3a11d5['type']){case _0x7eb1('0x88'):if(_0xd76a29['body'][_0x7eb1('0xd0')]&&_0xd76a29[_0x7eb1('0x62')]['status']){_0x3c82e4=_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0x2f')];return db[_0x7eb1('0xac')]['find']({'where':{'messageId':_0xd76a29[_0x7eb1('0x62')]['skebby_dispatch_id']}});}break;case _0x7eb1('0x8b'):if(_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0xd1')]&&_0xd76a29['body'][_0x7eb1('0xd2')]){_0x3c82e4=_0xd76a29[_0x7eb1('0x62')]['statusInt'];return db[_0x7eb1('0xac')][_0x7eb1('0x60')]({'where':{'messageId':_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0xd1')]}});}break;case _0x7eb1('0x8c'):if(_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0xd3')]&&_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0xd4')]){_0x3c82e4=_0xd76a29['body']['status_code'];return db[_0x7eb1('0xac')][_0x7eb1('0x60')]({'where':{'messageId':_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0xd3')]}});}break;case'infobip':var _0x45cc33=_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0x90')][0x0];if(_0x45cc33[_0x7eb1('0x86')]&&_0x45cc33['status'][_0x7eb1('0xd5')]===_0x7eb1('0xd6')){_0x3c82e4=_0x45cc33['status']['groupName'];return db[_0x7eb1('0xac')]['find']({'where':{'messageId':_0x45cc33[_0x7eb1('0x86')]}});}break;case'clickatell':if(_0xd76a29['body'][_0x7eb1('0x86')]&&_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0x2f')]){_0x3c82e4=_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0x2f')];return db[_0x7eb1('0xac')]['find']({'where':{'messageId':_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0x86')]}});}break;case _0x7eb1('0x95'):if(_0xd76a29[_0x7eb1('0x62')][0x0][_0x7eb1('0x2b')]['id']){_0x3c82e4=_0xd76a29[_0x7eb1('0x62')][0x0]['type'];return db[_0x7eb1('0xac')][_0x7eb1('0x60')]({'where':{'messageId':_0xd76a29['body'][0x0]['message']['id']}});}break;case'intelepeer':if(_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0xd7')]&&_0xd76a29['body'][_0x7eb1('0x2f')]){_0x3c82e4=_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0x2f')];return db[_0x7eb1('0xac')]['find']({'where':{'messageId':_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0xd7')]}});}break;}}})[_0x7eb1('0x23')](handleEntityNotFound(_0x2f40d2,null))[_0x7eb1('0x23')](function(_0x1580e3){if(_0x1580e3){_0x398210=_0x1580e3;switch(_0x457d69[_0x7eb1('0x46')]){case _0x7eb1('0x88'):if(_0x3c82e4===_0x7eb1('0xd6')){return _0x398210[_0x7eb1('0xd8')]({'read':!![]});}else{logger[_0x7eb1('0x29')](_0x7eb1('0x28'),_0x7eb1('0x2f'),_0x7eb1('0x88'),util['inspect'](_0xd76a29[_0x7eb1('0x62')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3c82e4==='1'){return _0x398210[_0x7eb1('0xd8')]({'read':!![]});}else{logger[_0x7eb1('0x29')](_0x7eb1('0x28'),'status',_0x7eb1('0x88'),util['inspect'](_0xd76a29[_0x7eb1('0x62')],{'showHidden':![],'depth':null}));}break;case _0x7eb1('0x8c'):if(!_0xd76a29['body'][_0x7eb1('0xd9')]&&_0x3c82e4>=0xc8&&_0x3c82e4<=0xce){return _0x398210[_0x7eb1('0xd8')]({'read':!![]});}else{logger[_0x7eb1('0x29')](_0x7eb1('0x28'),'status',_0x7eb1('0x8c'),util[_0x7eb1('0xcf')](_0xd76a29[_0x7eb1('0x62')],{'showHidden':![],'depth':null}));}break;case _0x7eb1('0x8f'):var _0x4ddb1d=_0xd76a29[_0x7eb1('0x62')][_0x7eb1('0x90')][0x0];if(_0x4ddb1d[_0x7eb1('0x2f')][_0x7eb1('0xd5')]===_0x7eb1('0xd6')){return _0x398210['update']({'read':!![]});}else{logger['error'](_0x7eb1('0x28'),_0x7eb1('0x2f'),_0x7eb1('0x8f'),util[_0x7eb1('0xcf')](_0xd76a29['body'],{'showHidden':![],'depth':null}));}break;case _0x7eb1('0x92'):if(_0x3c82e4==_0x7eb1('0xda')||_0x3c82e4==_0x7eb1('0xdb')){return _0x398210[_0x7eb1('0xd8')]({'read':!![]});}else{logger[_0x7eb1('0x29')](_0x7eb1('0x28'),_0x7eb1('0x2f'),_0x7eb1('0x92'),util[_0x7eb1('0xcf')](_0xd76a29[_0x7eb1('0x62')],{'showHidden':![],'depth':null}));}break;case _0x7eb1('0x95'):if(_0x3c82e4==_0x7eb1('0xdc')){return _0x398210[_0x7eb1('0xd8')]({'read':!![]});}else{logger['error'](_0x7eb1('0x28'),_0x7eb1('0x2f'),_0x7eb1('0x95'),util[_0x7eb1('0xcf')](_0xd76a29['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3c82e4===_0x7eb1('0xdd')||_0x3c82e4===_0x7eb1('0xde')){return _0x398210['update']({'read':!![]});}else{logger[_0x7eb1('0x29')](_0x7eb1('0x28'),_0x7eb1('0x2f'),_0x7eb1('0xdf'),util[_0x7eb1('0xcf')](_0xd76a29[_0x7eb1('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x398210;}})[_0x7eb1('0x23')](respondWithResult(_0x2f40d2,null))[_0x7eb1('0x2d')](handleError(_0x2f40d2,null));};exports[_0x7eb1('0xe0')]=function(_0x166f50,_0x5cfec0,_0x28277f){var _0x229f7d,_0x25454e,_0x17f729;return db['SmsAccount'][_0x7eb1('0x60')]({'where':{'id':_0x166f50[_0x7eb1('0x5d')]['id']}})[_0x7eb1('0x23')](handleEntityNotFound(_0x5cfec0,null))[_0x7eb1('0x23')](function(_0x476d03){if(_0x476d03){_0x17f729=_0x476d03;logger[_0x7eb1('0x27')](_0x7eb1('0x28'),_0x7eb1('0x2f'),_0x7eb1('0xe1'),_0x476d03['type'],util[_0x7eb1('0xcf')](_0x166f50[_0x7eb1('0x49')],{'showHidden':![],'depth':null}));switch(_0x476d03[_0x7eb1('0x46')]){case _0x7eb1('0xe2'):if(_0x166f50[_0x7eb1('0x49')][_0x7eb1('0xe3')]&&_0x166f50[_0x7eb1('0x49')][_0x7eb1('0xe4')]){_0x25454e=_0x166f50['query'][_0x7eb1('0xe4')];return db['SmsMessage'][_0x7eb1('0x60')]({'where':{'messageId':_0x166f50[_0x7eb1('0x49')][_0x7eb1('0xe3')]}});}break;}}})[_0x7eb1('0x23')](handleEntityNotFound(_0x5cfec0,null))[_0x7eb1('0x23')](function(_0x2aef85){if(_0x2aef85){_0x229f7d=_0x2aef85;switch(_0x17f729[_0x7eb1('0x46')]){case'csc':if(_0x25454e==='2'||_0x25454e==='6'){return _0x229f7d[_0x7eb1('0xd8')]({'read':!![]});}else{logger[_0x7eb1('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x7eb1('0xe2'),util[_0x7eb1('0xcf')](_0x166f50[_0x7eb1('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x229f7d;}})[_0x7eb1('0x23')](respondWithResult(_0x5cfec0,null))[_0x7eb1('0x2d')](handleError(_0x5cfec0,null));};exports[_0x7eb1('0xe5')]=function(_0x3aa99e,_0x3feb83,_0x20f38c){return db[_0x7eb1('0x44')]['find']({'where':{'id':_0x3aa99e[_0x7eb1('0x5d')]['id']}})[_0x7eb1('0x23')](handleEntityNotFound(_0x3feb83,null))[_0x7eb1('0x23')](function(_0x3f52c2){if(_0x3f52c2){return _0x3f52c2['addAgents'](_0x3aa99e[_0x7eb1('0x62')][_0x7eb1('0x6d')],_[_0x7eb1('0xa2')](_0x3aa99e['body'],[_0x7eb1('0x6d'),'id'])||{})[_0x7eb1('0xa5')](function(_0xfcfa29){for(var _0x4b9da0=0x0;_0x4b9da0<_0x3aa99e['body'][_0x7eb1('0x6d')][_0x7eb1('0x4f')];_0x4b9da0+=0x1){socket[_0x7eb1('0xe6')](_0x7eb1('0xe7'),{'UserId':Number(_0x3aa99e[_0x7eb1('0x62')]['ids'][_0x4b9da0]),'SmsAccountId':Number(_0x3aa99e[_0x7eb1('0x5d')]['id'])});}return _0xfcfa29;});}})[_0x7eb1('0x23')](respondWithResult(_0x3feb83,null))[_0x7eb1('0x2d')](handleError(_0x3feb83,null));};exports[_0x7eb1('0xe8')]=function(_0x66fbf4,_0x2762ee,_0x3ad2e3){return db['SmsAccount'][_0x7eb1('0x60')]({'where':{'id':_0x66fbf4[_0x7eb1('0x5d')]['id']}})[_0x7eb1('0x23')](handleEntityNotFound(_0x2762ee,null))[_0x7eb1('0x23')](function(_0x1b086a){if(_0x1b086a){return _0x1b086a[_0x7eb1('0xe8')](_0x66fbf4['query'][_0x7eb1('0x6d')])['then'](function(){if(_['isArray'](_0x66fbf4['query'][_0x7eb1('0x6d')])){for(var _0x3a93b9=0x0;_0x3a93b9<_0x66fbf4[_0x7eb1('0x49')][_0x7eb1('0x6d')]['length'];_0x3a93b9+=0x1){socket[_0x7eb1('0xe6')](_0x7eb1('0xe9'),{'UserId':Number(_0x66fbf4['query'][_0x7eb1('0x6d')][_0x3a93b9]),'SmsAccountId':Number(_0x66fbf4[_0x7eb1('0x5d')]['id'])});}}else{socket['emit'](_0x7eb1('0xe9'),{'UserId':Number(_0x66fbf4[_0x7eb1('0x49')]['ids']),'SmsAccountId':Number(_0x66fbf4[_0x7eb1('0x5d')]['id'])});}});}})[_0x7eb1('0x23')](respondWithStatusCode(_0x2762ee,null))[_0x7eb1('0x2d')](handleError(_0x2762ee,null));};exports['getAgents']=function(_0xb826d3,_0x200b47,_0x49f2e0){var _0x519ec0={};var _0x3f6e19={};var _0xbb8cfd;var _0x82a4f2;return db['SmsAccount'][_0x7eb1('0x6b')]({'where':{'id':_0xb826d3[_0x7eb1('0x5d')]['id']}})[_0x7eb1('0x23')](handleEntityNotFound(_0x200b47,null))[_0x7eb1('0x23')](function(_0x176fd5){if(_0x176fd5){_0xbb8cfd=_0x176fd5;_0x3f6e19[_0x7eb1('0x48')]=_[_0x7eb1('0x4a')](db[_0x7eb1('0xb0')][_0x7eb1('0x5e')]);_0x3f6e19['query']=_[_0x7eb1('0x4a')](_0xb826d3[_0x7eb1('0x49')]);_0x3f6e19[_0x7eb1('0x4b')]=_[_0x7eb1('0x4c')](_0x3f6e19[_0x7eb1('0x48')],_0x3f6e19[_0x7eb1('0x49')]);_0x519ec0[_0x7eb1('0x4d')]=_[_0x7eb1('0x4c')](_0x3f6e19[_0x7eb1('0x48')],qs['fields'](_0xb826d3['query'][_0x7eb1('0x4e')]));_0x519ec0[_0x7eb1('0x4d')]=_0x519ec0['attributes'][_0x7eb1('0x4f')]?_0x519ec0[_0x7eb1('0x4d')]:_0x3f6e19[_0x7eb1('0x48')];_0x519ec0[_0x7eb1('0x52')]=qs[_0x7eb1('0x53')](_0xb826d3[_0x7eb1('0x49')][_0x7eb1('0x53')]);_0x519ec0[_0x7eb1('0x54')]=qs[_0x7eb1('0x4b')](_[_0x7eb1('0x55')](_0xb826d3[_0x7eb1('0x49')],_0x3f6e19[_0x7eb1('0x4b')]));if(_0xb826d3['query'][_0x7eb1('0x56')]){_0x519ec0['where']=_[_0x7eb1('0x57')](_0x519ec0[_0x7eb1('0x54')],{'$or':_[_0x7eb1('0x43')](_0x519ec0[_0x7eb1('0x4d')],function(_0x46d10b){var _0x3dc5c5={};_0x3dc5c5[_0x46d10b]={'$like':'%'+_0xb826d3[_0x7eb1('0x49')][_0x7eb1('0x56')]+'%'};return _0x3dc5c5;})});}_0x519ec0=_[_0x7eb1('0x57')]({},_0x519ec0,_0xb826d3[_0x7eb1('0x59')]);return _0xbb8cfd[_0x7eb1('0xea')](_0x519ec0);}})[_0x7eb1('0x23')](function(_0x55d452){if(_0x55d452){_0x82a4f2=_0x55d452[_0x7eb1('0x4f')];if(!_0xb826d3[_0x7eb1('0x49')][_0x7eb1('0x50')]('nolimit')){_0x519ec0[_0x7eb1('0x32')]=qs[_0x7eb1('0x32')](_0xb826d3[_0x7eb1('0x49')]['limit']);_0x519ec0[_0x7eb1('0x33')]=qs[_0x7eb1('0x33')](_0xb826d3[_0x7eb1('0x49')][_0x7eb1('0x33')]);}return _0xbb8cfd[_0x7eb1('0xea')](_0x519ec0);}})[_0x7eb1('0x23')](function(_0x1c9320){if(_0x1c9320){return _0x1c9320?{'count':_0x82a4f2,'rows':_0x1c9320}:null;}})['then'](respondWithResult(_0x200b47,null))[_0x7eb1('0x2d')](handleError(_0x200b47,null));}; \ No newline at end of file +var _0xbb9e=['update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','params','options','create','body','SmsAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','applications','orderBy','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','From','Body','messageId','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','autoclose','push','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','User','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','user','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','groupName','clickatell','redif','error_code','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','state','message-id','addAgents','omit','emit','userSmsAccount:save','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save'];(function(_0x83aca8,_0x397dd5){var _0x5ad200=function(_0x3dea39){while(--_0x3dea39){_0x83aca8['push'](_0x83aca8['shift']());}};_0x5ad200(++_0x397dd5);}(_0xbb9e,0xb0));var _0xebb9=function(_0x30dbf0,_0x1b3add){_0x30dbf0=_0x30dbf0-0x0;var _0x5b9f27=_0xbb9e[_0x30dbf0];return _0x5b9f27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebb9('0x0'));var zipdir=require(_0xebb9('0x1'));var jsonpatch=require(_0xebb9('0x2'));var rp=require(_0xebb9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xebb9('0x4'));var util=require(_0xebb9('0x5'));var path=require('path');var sox=require(_0xebb9('0x6'));var csv=require(_0xebb9('0x7'));var ejs=require(_0xebb9('0x8'));var fs=require('fs');var fs_extra=require(_0xebb9('0x9'));var _=require(_0xebb9('0xa'));var squel=require(_0xebb9('0xb'));var crypto=require(_0xebb9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xebb9('0xd'));var toCsv=require(_0xebb9('0x7'));var querystring=require(_0xebb9('0xe'));var Papa=require(_0xebb9('0xf'));var Redis=require(_0xebb9('0x10'));var authService=require(_0xebb9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebb9('0x12'));var hardwareService=require(_0xebb9('0x13'));var logger=require(_0xebb9('0x14'))(_0xebb9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xebb9('0x16')]=_[_0xebb9('0x17')](config['redis'],{'host':_0xebb9('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebb9('0x16')]));require(_0xebb9('0x19'))[_0xebb9('0x1a')](socket);var jayson=require(_0xebb9('0x1b'));var client=jayson[_0xebb9('0x1c')][_0xebb9('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5c8ba3,_0x5dfbd8,_0x127493,_0x55d598){return new BPromise(function(_0x2dc054,_0x3a9bee){var _0x1c20ef=_0x55d598||client;return _0x1c20ef[_0xebb9('0x1e')](_0x5c8ba3,_0x127493)[_0xebb9('0x1f')](function(_0x3ece32){logger[_0xebb9('0x20')](_0xebb9('0x21'),_0x5dfbd8,_0xebb9('0x22'));logger['debug'](_0xebb9('0x23'),_0x5dfbd8,_0xebb9('0x22'),JSON[_0xebb9('0x24')](_0x3ece32));if(_0x3ece32[_0xebb9('0x25')]){if(_0x3ece32[_0xebb9('0x25')][_0xebb9('0x26')]===0x1f4){logger['error'](_0xebb9('0x21'),_0x5dfbd8,_0x3ece32[_0xebb9('0x25')][_0xebb9('0x27')]);return _0x3a9bee(_0x3ece32[_0xebb9('0x25')][_0xebb9('0x27')]);}logger[_0xebb9('0x25')](_0xebb9('0x21'),_0x5dfbd8,_0x3ece32['error'][_0xebb9('0x27')]);return _0x2dc054(_0x3ece32[_0xebb9('0x25')][_0xebb9('0x27')]);}else{logger['info'](_0xebb9('0x21'),_0x5dfbd8,_0xebb9('0x22'));_0x2dc054(_0x3ece32['result']['message']);}})[_0xebb9('0x28')](function(_0x15aa90){logger[_0xebb9('0x25')](_0xebb9('0x21'),_0x5dfbd8,_0x15aa90);_0x3a9bee(_0x15aa90);});});}function respondWithStatusCode(_0x25ba8f,_0x54d34f){_0x54d34f=_0x54d34f||0xcc;return function(_0x2de09f){if(_0x2de09f){return _0x25ba8f[_0xebb9('0x29')](_0x54d34f);}return _0x25ba8f[_0xebb9('0x2a')](_0x54d34f)[_0xebb9('0x2b')]();};}function respondWithResult(_0x3a1c90,_0x35eb59){_0x35eb59=_0x35eb59||0xc8;return function(_0x4c935e){if(_0x4c935e){return _0x3a1c90['status'](_0x35eb59)[_0xebb9('0x2c')](_0x4c935e);}};}function respondWithFilteredResult(_0x360927,_0x4593d4){return function(_0x3c3d15){if(_0x3c3d15){var _0x3de9b1=typeof _0x4593d4['offset']===_0xebb9('0x2d')&&typeof _0x4593d4[_0xebb9('0x2e')]===_0xebb9('0x2d');var _0x296a17=_0x3c3d15['count'];var _0xe6def8=_0x3de9b1?0x0:_0x4593d4[_0xebb9('0x2f')];var _0xad79a=_0x3de9b1?_0x3c3d15[_0xebb9('0x30')]:_0x4593d4[_0xebb9('0x2f')]+_0x4593d4[_0xebb9('0x2e')];var _0x2484e5;if(_0xad79a>=_0x296a17){_0xad79a=_0x296a17;_0x2484e5=0xc8;}else{_0x2484e5=0xce;}_0x360927['status'](_0x2484e5);return _0x360927[_0xebb9('0x31')](_0xebb9('0x32'),_0xe6def8+'-'+_0xad79a+'/'+_0x296a17)[_0xebb9('0x2c')](_0x3c3d15);}return null;};}function patchUpdates(_0x8f0cd1){return function(_0x4f4551){try{jsonpatch[_0xebb9('0x33')](_0x4f4551,_0x8f0cd1,!![]);}catch(_0x509068){return BPromise[_0xebb9('0x34')](_0x509068);}return _0x4f4551[_0xebb9('0x35')]();};}function saveUpdates(_0x31b44c,_0x353cbf){return function(_0x4127b9){if(_0x4127b9){return _0x4127b9[_0xebb9('0x36')](_0x31b44c)[_0xebb9('0x1f')](function(_0x50f295){return _0x50f295;});}return null;};}function removeEntity(_0x4035eb,_0x3a6dfc){return function(_0x219069){if(_0x219069){return _0x219069[_0xebb9('0x37')]()[_0xebb9('0x1f')](function(){var _0x506420=_0x219069[_0xebb9('0x38')]({'plain':!![]});var _0x182bf2='SmsAccounts';return db[_0xebb9('0x39')][_0xebb9('0x37')]({'where':{'type':_0x182bf2,'resourceId':_0x506420['id']}})[_0xebb9('0x1f')](function(){return _0x219069;});})[_0xebb9('0x1f')](function(){_0x4035eb[_0xebb9('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c855,_0x2e3953){return function(_0x2db5dd){if(!_0x2db5dd){_0x43c855[_0xebb9('0x29')](0x194);}return _0x2db5dd;};}function handleError(_0x4e334c,_0x317416){_0x317416=_0x317416||0x1f4;return function(_0x20b7f2){logger[_0xebb9('0x25')](_0x20b7f2[_0xebb9('0x3a')]);if(_0x20b7f2[_0xebb9('0x3b')]){delete _0x20b7f2[_0xebb9('0x3b')];}_0x4e334c[_0xebb9('0x2a')](_0x317416)[_0xebb9('0x3c')](_0x20b7f2);};}exports['index']=function(_0x4f5bdf,_0x428812){var _0x1ad131={'include':[{'model':db[_0xebb9('0x3d')],'as':_0xebb9('0x3e')}]},_0x2469e1={},_0x1419ee={'count':0x0,'rows':[]};var _0x630bc7=_[_0xebb9('0x3f')](db[_0xebb9('0x40')][_0xebb9('0x41')],function(_0x3f2b52){return{'name':_0x3f2b52['fieldName'],'type':_0x3f2b52[_0xebb9('0x42')][_0xebb9('0x43')]};});_0x2469e1[_0xebb9('0x44')]=_['map'](_0x630bc7,_0xebb9('0x3b'));_0x2469e1[_0xebb9('0x45')]=_[_0xebb9('0x46')](_0x4f5bdf['query']);_0x2469e1[_0xebb9('0x47')]=_['intersection'](_0x2469e1[_0xebb9('0x44')],_0x2469e1['query']);_0x1ad131['attributes']=_[_0xebb9('0x48')](_0x2469e1[_0xebb9('0x44')],qs[_0xebb9('0x49')](_0x4f5bdf[_0xebb9('0x45')]['fields']));_0x1ad131['attributes']=_0x1ad131[_0xebb9('0x4a')][_0xebb9('0x4b')]?_0x1ad131[_0xebb9('0x4a')]:_0x2469e1[_0xebb9('0x44')];if(!_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x4c')](_0xebb9('0x4d'))){_0x1ad131[_0xebb9('0x2e')]=qs[_0xebb9('0x2e')](_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x2e')]);_0x1ad131[_0xebb9('0x2f')]=qs[_0xebb9('0x2f')](_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x2f')]);}_0x1ad131['order']=qs['sort'](_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x4e')]);_0x1ad131[_0xebb9('0x4f')]=qs[_0xebb9('0x47')](_[_0xebb9('0x50')](_0x4f5bdf['query'],_0x2469e1[_0xebb9('0x47')]),_0x630bc7);if(_0x4f5bdf[_0xebb9('0x45')]['filter']){_0x1ad131[_0xebb9('0x4f')]=_[_0xebb9('0x51')](_0x1ad131[_0xebb9('0x4f')],{'$or':_[_0xebb9('0x3f')](_0x630bc7,function(_0x3df749){if(_0x3df749[_0xebb9('0x42')]!=='VIRTUAL'){var _0x5dbefe={};_0x5dbefe[_0x3df749[_0xebb9('0x3b')]]={'$like':'%'+_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x52')]+'%'};return _0x5dbefe;}})});}_0x1ad131=_['merge']({},_0x1ad131,_0x4f5bdf['options']);var _0x27030e={'where':_0x1ad131[_0xebb9('0x4f')]};return db[_0xebb9('0x40')][_0xebb9('0x30')](_0x27030e)[_0xebb9('0x1f')](function(_0x472091){_0x1419ee['count']=_0x472091;if(_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x53')]){_0x1ad131[_0xebb9('0x54')]=[{'all':!![]}];}return db[_0xebb9('0x40')][_0xebb9('0x55')](_0x1ad131);})[_0xebb9('0x1f')](function(_0x2dee75){_0x1419ee[_0xebb9('0x56')]=_0x2dee75;return _0x1419ee;})['then'](respondWithFilteredResult(_0x428812,_0x1ad131))['catch'](handleError(_0x428812,null));};exports[_0xebb9('0x57')]=function(_0x4c1af3,_0x36493b){var _0x1b8cfd={'raw':![],'where':{'id':_0x4c1af3[_0xebb9('0x58')]['id']},'include':[{'model':db[_0xebb9('0x3d')],'as':_0xebb9('0x3e')}]},_0x3db1f9={};_0x3db1f9['model']=_['keys'](db[_0xebb9('0x40')][_0xebb9('0x41')]);_0x3db1f9[_0xebb9('0x45')]=_[_0xebb9('0x46')](_0x4c1af3[_0xebb9('0x45')]);_0x3db1f9[_0xebb9('0x47')]=_[_0xebb9('0x48')](_0x3db1f9[_0xebb9('0x44')],_0x3db1f9[_0xebb9('0x45')]);_0x1b8cfd['attributes']=_[_0xebb9('0x48')](_0x3db1f9[_0xebb9('0x44')],qs[_0xebb9('0x49')](_0x4c1af3[_0xebb9('0x45')]['fields']));_0x1b8cfd[_0xebb9('0x4a')]=_0x1b8cfd['attributes'][_0xebb9('0x4b')]?_0x1b8cfd[_0xebb9('0x4a')]:_0x3db1f9[_0xebb9('0x44')];if(_0x4c1af3[_0xebb9('0x45')][_0xebb9('0x53')]){_0x1b8cfd['include']=[{'all':!![]}];}_0x1b8cfd=_[_0xebb9('0x51')]({},_0x1b8cfd,_0x4c1af3[_0xebb9('0x59')]);return db[_0xebb9('0x40')]['find'](_0x1b8cfd)[_0xebb9('0x1f')](handleEntityNotFound(_0x36493b,null))[_0xebb9('0x1f')](respondWithResult(_0x36493b,null))[_0xebb9('0x28')](handleError(_0x36493b,null));};exports[_0xebb9('0x5a')]=function(_0x204baa,_0x12b143){return db[_0xebb9('0x40')][_0xebb9('0x5a')](_0x204baa[_0xebb9('0x5b')],{})[_0xebb9('0x1f')](function(_0x5e14df){var _0x532d61=_0x204baa['user'][_0xebb9('0x38')]({'plain':!![]});if(!_0x532d61)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x532d61['role']==='user'){var _0x20a552=_0x5e14df[_0xebb9('0x38')]({'plain':!![]});var _0x8e2f51=_0xebb9('0x5c');return db[_0xebb9('0x5d')][_0xebb9('0x5e')]({'where':{'name':_0x8e2f51,'userProfileId':_0x532d61[_0xebb9('0x5f')]},'raw':!![]})[_0xebb9('0x1f')](function(_0x181cce){if(_0x181cce&&_0x181cce[_0xebb9('0x60')]===0x0){return db[_0xebb9('0x39')][_0xebb9('0x5a')]({'name':_0x20a552['name'],'resourceId':_0x20a552['id'],'type':_0x181cce[_0xebb9('0x3b')],'sectionId':_0x181cce['id']},{})[_0xebb9('0x1f')](function(){return _0x5e14df;});}else{return _0x5e14df;}})['catch'](function(_0x20da53){logger[_0xebb9('0x25')](_0xebb9('0x61'),_0x20da53);throw _0x20da53;});}return _0x5e14df;})[_0xebb9('0x1f')](respondWithResult(_0x12b143,0xc9))[_0xebb9('0x28')](handleError(_0x12b143,null));};exports[_0xebb9('0x36')]=function(_0xc3ac58,_0x4e4611){if(_0xc3ac58['body']['id']){delete _0xc3ac58['body']['id'];}return db[_0xebb9('0x40')]['find']({'where':{'id':_0xc3ac58['params']['id']},'include':[{'model':db['Pause'],'as':_0xebb9('0x3e')}]})[_0xebb9('0x1f')](handleEntityNotFound(_0x4e4611,null))[_0xebb9('0x1f')](saveUpdates(_0xc3ac58[_0xebb9('0x5b')],null))['then'](respondWithResult(_0x4e4611,null))[_0xebb9('0x28')](handleError(_0x4e4611,null));};exports[_0xebb9('0x37')]=function(_0x363951,_0x576c68){return db['SmsAccount']['find']({'where':{'id':_0x363951[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x576c68,null))[_0xebb9('0x1f')](removeEntity(_0x576c68,null))[_0xebb9('0x28')](handleError(_0x576c68,null));};exports[_0xebb9('0x62')]=function(_0x287c27,_0x4c813c){return db[_0xebb9('0x40')][_0xebb9('0x62')]()['then'](respondWithResult(_0x4c813c,null))[_0xebb9('0x28')](handleError(_0x4c813c,null));};exports[_0xebb9('0x63')]=function(_0x497aa0,_0xa2933d,_0x2d7091){if(_0x497aa0['body']['id']){delete _0x497aa0[_0xebb9('0x5b')]['id'];}return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x497aa0['params']['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0xa2933d,null))[_0xebb9('0x1f')](function(_0xf18e8){if(_0xf18e8){_0x497aa0['body'][_0xebb9('0x64')]=_0xf18e8['id'];return db[_0xebb9('0x65')][_0xebb9('0x5a')](_0x497aa0[_0xebb9('0x5b')]);}})[_0xebb9('0x1f')](respondWithResult(_0xa2933d,null))[_0xebb9('0x28')](handleError(_0xa2933d,null));};exports['getDispositions']=function(_0x488898,_0x1be633,_0x5ba617){var _0x101126={'raw':![],'where':{}};var _0x3bbda4={};var _0x239aeb={'count':0x0,'rows':[]};return db[_0xebb9('0x40')][_0xebb9('0x66')]({'where':{'id':_0x488898[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x1be633,null))[_0xebb9('0x1f')](function(_0x4890f9){if(_0x4890f9){_0x3bbda4[_0xebb9('0x44')]=_['keys'](db[_0xebb9('0x65')]['rawAttributes']);_0x3bbda4[_0xebb9('0x45')]=_['keys'](_0x488898[_0xebb9('0x45')]);_0x3bbda4[_0xebb9('0x47')]=_[_0xebb9('0x48')](_0x3bbda4[_0xebb9('0x44')],_0x3bbda4['query']);_0x101126['attributes']=_[_0xebb9('0x48')](_0x3bbda4['model'],qs[_0xebb9('0x49')](_0x488898[_0xebb9('0x45')][_0xebb9('0x49')]));_0x101126[_0xebb9('0x4a')]=_0x101126['attributes'][_0xebb9('0x4b')]?_0x101126[_0xebb9('0x4a')]:_0x3bbda4[_0xebb9('0x44')];if(!_0x488898[_0xebb9('0x45')][_0xebb9('0x4c')](_0xebb9('0x4d'))){_0x101126[_0xebb9('0x2e')]=qs[_0xebb9('0x2e')](_0x488898[_0xebb9('0x45')]['limit']);_0x101126[_0xebb9('0x2f')]=qs['offset'](_0x488898['query'][_0xebb9('0x2f')]);}_0x101126[_0xebb9('0x67')]=qs[_0xebb9('0x4e')](_0x488898['query'][_0xebb9('0x4e')]);_0x101126[_0xebb9('0x4f')]=qs['filters'](_[_0xebb9('0x50')](_0x488898[_0xebb9('0x45')],_0x3bbda4[_0xebb9('0x47')]));_0x101126[_0xebb9('0x4f')]['SmsAccountId']=_0x4890f9['id'];if(_0x488898['query'][_0xebb9('0x52')]){_0x101126[_0xebb9('0x4f')]=_[_0xebb9('0x51')](_0x101126['where'],{'$or':_[_0xebb9('0x3f')](_0x101126['attributes'],function(_0x2c0571){var _0x3a47a9={};_0x3a47a9[_0x2c0571]={'$like':'%'+_0x488898[_0xebb9('0x45')]['filter']+'%'};return _0x3a47a9;})});}_0x101126=_['merge']({},_0x101126,_0x488898[_0xebb9('0x59')]);return db[_0xebb9('0x65')][_0xebb9('0x30')]({'where':_0x101126[_0xebb9('0x4f')]})['then'](function(_0x21e124){_0x239aeb['count']=_0x21e124;if(_0x488898[_0xebb9('0x45')][_0xebb9('0x53')]){_0x101126[_0xebb9('0x54')]=[{'all':!![]}];}return db[_0xebb9('0x65')]['findAll'](_0x101126);})['then'](function(_0x18ac47){_0x239aeb[_0xebb9('0x56')]=_0x18ac47;return _0x239aeb;});}})['then'](respondWithFilteredResult(_0x1be633,_0x101126))[_0xebb9('0x28')](handleError(_0x1be633,null));};exports[_0xebb9('0x68')]=function(_0x19ca14,_0x4c9fa4,_0x3ba6aa){return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x19ca14['params']['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x4c9fa4,null))[_0xebb9('0x1f')](function(_0xea1e49){if(_0xea1e49){return _0xea1e49[_0xebb9('0x68')](_0x19ca14[_0xebb9('0x45')][_0xebb9('0x69')]);}})['then'](respondWithStatusCode(_0x4c9fa4,null))['catch'](handleError(_0x4c9fa4,null));};exports[_0xebb9('0x6a')]=function(_0x57dfdd,_0x347116,_0x1802a9){if(_0x57dfdd['body']['id']){delete _0x57dfdd[_0xebb9('0x5b')]['id'];}return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x57dfdd[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x347116,null))[_0xebb9('0x1f')](function(_0x2000f9){if(_0x2000f9){_0x57dfdd['body'][_0xebb9('0x64')]=_0x2000f9['id'];return db[_0xebb9('0x6b')][_0xebb9('0x5a')](_0x57dfdd['body']);}})[_0xebb9('0x1f')](respondWithResult(_0x347116,null))['catch'](handleError(_0x347116,null));};exports[_0xebb9('0x6c')]=function(_0x38b096,_0x516e7d,_0x5e384b){var _0x249b63={'raw':![],'where':{}};var _0x10a37c={};var _0x2c95c0={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x38b096[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x516e7d,null))['then'](function(_0x4fa6ff){if(_0x4fa6ff){_0x10a37c[_0xebb9('0x44')]=_[_0xebb9('0x46')](db[_0xebb9('0x6b')][_0xebb9('0x41')]);_0x10a37c[_0xebb9('0x45')]=_['keys'](_0x38b096[_0xebb9('0x45')]);_0x10a37c['filters']=_[_0xebb9('0x48')](_0x10a37c['model'],_0x10a37c[_0xebb9('0x45')]);_0x249b63['attributes']=_[_0xebb9('0x48')](_0x10a37c[_0xebb9('0x44')],qs['fields'](_0x38b096[_0xebb9('0x45')][_0xebb9('0x49')]));_0x249b63['attributes']=_0x249b63[_0xebb9('0x4a')]['length']?_0x249b63[_0xebb9('0x4a')]:_0x10a37c['model'];if(!_0x38b096[_0xebb9('0x45')][_0xebb9('0x4c')](_0xebb9('0x4d'))){_0x249b63[_0xebb9('0x2e')]=qs[_0xebb9('0x2e')](_0x38b096[_0xebb9('0x45')][_0xebb9('0x2e')]);_0x249b63[_0xebb9('0x2f')]=qs[_0xebb9('0x2f')](_0x38b096[_0xebb9('0x45')]['offset']);}_0x249b63['order']=qs[_0xebb9('0x4e')](_0x38b096[_0xebb9('0x45')]['sort']);_0x249b63[_0xebb9('0x4f')]=qs[_0xebb9('0x47')](_[_0xebb9('0x50')](_0x38b096[_0xebb9('0x45')],_0x10a37c[_0xebb9('0x47')]));_0x249b63['where'][_0xebb9('0x64')]=_0x4fa6ff['id'];if(_0x38b096[_0xebb9('0x45')]['filter']){_0x249b63[_0xebb9('0x4f')]=_[_0xebb9('0x51')](_0x249b63[_0xebb9('0x4f')],{'$or':_[_0xebb9('0x3f')](_0x249b63['attributes'],function(_0xb67fbb){var _0x375259={};_0x375259[_0xb67fbb]={'$like':'%'+_0x38b096[_0xebb9('0x45')][_0xebb9('0x52')]+'%'};return _0x375259;})});}_0x249b63=_[_0xebb9('0x51')]({},_0x249b63,_0x38b096['options']);return db[_0xebb9('0x6b')][_0xebb9('0x30')]({'where':_0x249b63[_0xebb9('0x4f')]})[_0xebb9('0x1f')](function(_0x5cf6f9){_0x2c95c0[_0xebb9('0x30')]=_0x5cf6f9;if(_0x38b096[_0xebb9('0x45')][_0xebb9('0x53')]){_0x249b63['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xebb9('0x55')](_0x249b63);})['then'](function(_0x2475ca){_0x2c95c0[_0xebb9('0x56')]=_0x2475ca;return _0x2c95c0;});}})[_0xebb9('0x1f')](respondWithFilteredResult(_0x516e7d,_0x249b63))['catch'](handleError(_0x516e7d,null));};exports[_0xebb9('0x6d')]=function(_0x33e3e9,_0x449604,_0x5bf14f){return db[_0xebb9('0x40')]['find']({'where':{'id':_0x33e3e9[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x449604,null))[_0xebb9('0x1f')](function(_0x270b70){if(_0x270b70){return _0x270b70[_0xebb9('0x6d')](_0x33e3e9[_0xebb9('0x45')][_0xebb9('0x69')]);}})[_0xebb9('0x1f')](respondWithStatusCode(_0x449604,null))[_0xebb9('0x28')](handleError(_0x449604,null));};exports['notify']=function(_0x13a02d,_0x1e23b4,_0x257a34){var _0xd3327d={'channel':_0xebb9('0x6e')};var _0x357d1d=[];var _0x21f32b=[];var _0x2b1ec7={};return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x13a02d[_0xebb9('0x58')]['id']},'include':[{'model':db[_0xebb9('0x6f')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x1e23b4,null))[_0xebb9('0x1f')](function(_0x52fb51){_0xd3327d['account']=_0x52fb51;_0xd3327d[_0xebb9('0x70')]=_[_0xebb9('0x71')](_0x52fb51[_0xebb9('0x72')],[_0xebb9('0x73')],[_0xebb9('0x74')]);if(_0xd3327d[_0xebb9('0x75')][_0xebb9('0x72')]){delete _0xd3327d[_0xebb9('0x75')][_0xebb9('0x72')];}return db[_0xebb9('0x76')][_0xebb9('0x62')]();})[_0xebb9('0x1f')](function(_0x15b55a){if(!_0x15b55a){throw new db[(_0xebb9('0x77'))][(_0xebb9('0x78'))](_0xebb9('0x79'));}_0x357d1d=_[_0xebb9('0x7a')](_[_0xebb9('0x46')](_0x15b55a),['createdAt',_0xebb9('0x7b')]);_0x21f32b=_[_0xebb9('0x7a')](_[_0xebb9('0x46')](_0x15b55a),['createdAt',_0xebb9('0x7b'),_0xebb9('0x7c'),_0xebb9('0x7d')]);_0xd3327d[_0xebb9('0x5b')]={'mapKey':'mobile'};if(_0xd3327d[_0xebb9('0x75')][_0xebb9('0x42')]){switch(_0xd3327d['account'][_0xebb9('0x42')]){case'twilio':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]=_0x13a02d['body'][_0xebb9('0x7f')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x80')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x81')]=_0x13a02d[_0xebb9('0x5b')]['MessageSid'];break;case'skebby':_0xd3327d['body'][_0xebb9('0x7e')]='+'+_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x82')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x83')];break;case _0xebb9('0x84'):_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]=_0x13a02d['body'][_0xebb9('0x7e')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x27')];break;case _0xebb9('0x85'):_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x7e')];_0xd3327d[_0xebb9('0x5b')]['body']=_0x13a02d['body'][_0xebb9('0x5b')];_0xd3327d[_0xebb9('0x5b')]['messageId']=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x86')];break;case _0xebb9('0x87'):_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x7f')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x88')];_0xd3327d[_0xebb9('0x5b')]['messageId']=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x89')];break;case'infobip':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]='+'+_0x13a02d[_0xebb9('0x5b')]['results'][0x0]['from'];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x8a')][0x0][_0xebb9('0x83')];_0xd3327d['body'][_0xebb9('0x81')]=_0x13a02d[_0xebb9('0x5b')]['results'][0x0]['messageId'];break;case _0xebb9('0x8b'):_0xd3327d['body'][_0xebb9('0x7e')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x8c')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x8d')]['message'];break;case'clickatell':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]=_0x13a02d['body'][_0xebb9('0x8e')];_0xd3327d['body']['body']=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x83')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x81')]=_0x13a02d['body'][_0xebb9('0x8f')];break;case _0xebb9('0x90'):_0xd3327d[_0xebb9('0x5b')]['messageId']=_0x13a02d[_0xebb9('0x5b')][0x0][_0xebb9('0x27')]['id'];_0xd3327d[_0xebb9('0x5b')]['from']=_0x13a02d[_0xebb9('0x5b')][0x0][_0xebb9('0x27')]['from'];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][0x0][_0xebb9('0x27')][_0xebb9('0x83')];break;case _0xebb9('0x91'):_0xd3327d['body'][_0xebb9('0x7e')]=_0x13a02d['body']['from'];_0xd3327d[_0xebb9('0x5b')]['body']=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x27')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x81')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x92')];break;}}if(_0xd3327d[_0xebb9('0x5b')]['id']){delete _0xd3327d[_0xebb9('0x5b')]['id'];}if(_[_0xebb9('0x93')](_0xd3327d['body'][_0xebb9('0x7e')])){throw new db[(_0xebb9('0x77'))]['ValidationError'](_0xebb9('0x94'));}if(_[_0xebb9('0x93')](_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')])||_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]===''){throw new db[(_0xebb9('0x77'))][(_0xebb9('0x78'))](_0xebb9('0x95'));}if(_[_0xebb9('0x93')](_0xd3327d[_0xebb9('0x5b')]['mapKey'])){throw new db[(_0xebb9('0x77'))][(_0xebb9('0x78'))](_0xebb9('0x96')+_0x21f32b);}if(!_[_0xebb9('0x97')](_0x21f32b,_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x98')])){throw new db['Sequelize'][(_0xebb9('0x78'))](_0xebb9('0x99')+_0x21f32b);}_0x2b1ec7[_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x98')]]=_0xd3327d[_0xebb9('0x5b')]['from'];return db[_0xebb9('0x9a')][_0xebb9('0x5e')]({'where':{'id':_0xd3327d['account'][_0xebb9('0x7d')]},'include':[{'model':db[_0xebb9('0x76')],'as':_0xebb9('0x9b'),'where':_0x2b1ec7,'limit':0x1,'order':[['updatedAt',_0xebb9('0x9c')]]}]});})[_0xebb9('0x1f')](handleEntityNotFound(_0x1e23b4,null))[_0xebb9('0x1f')](function(_0x5a7176){if(_0x5a7176){_0xd3327d[_0xebb9('0x9d')]=_['omit'](_0x5a7176,[_0xebb9('0x9b')]);if(_0x5a7176[_0xebb9('0x9b')][_0xebb9('0x4b')]){return _0x5a7176[_0xebb9('0x9b')][0x0];}var _0xadf3c0=_[_0xebb9('0x17')](_0xd3327d['body'],{'firstName':_0xd3327d[_0xebb9('0x5b')]['from'],'ListId':_0x5a7176['id']});_0xadf3c0[_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x98')]]=_0xd3327d['body']['from'];return db[_0xebb9('0x76')][_0xebb9('0x5a')](_0xadf3c0,{'fields':_0x357d1d,'raw':!![]});}})[_0xebb9('0x1f')](handleEntityNotFound(_0x1e23b4,null))[_0xebb9('0x1f')](function(_0x38358c){if(_0x38358c){_0xd3327d[_0xebb9('0x9e')]=_0x38358c;var _0x5381a2={'ContactId':_0x38358c['id'],'phone':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')],'SmsAccountId':_0x13a02d[_0xebb9('0x58')]['id']};var _0x240426={'ContactId':_0x38358c['id'],'SmsAccountId':_0x13a02d[_0xebb9('0x58')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x240426})[_0xebb9('0x1f')](function(_0x3fc7bb){if(_0x3fc7bb){return[_0x3fc7bb,![]];}return db[_0xebb9('0x9f')][_0xebb9('0x5a')](_0x5381a2)[_0xebb9('0x1f')](function(_0xa43cc3){return[_0xa43cc3,!![]];});});}})[_0xebb9('0xa0')](function(_0x5d4d30,_0x4ca9e4){_0xd3327d['interaction']=_0x5d4d30[_0xebb9('0x38')]({'plain':!![]});_0xd3327d[_0xebb9('0xa1')]['created']=![];if(_0x4ca9e4){if(_0xd3327d[_0xebb9('0x75')][_0xebb9('0xa2')]){_0xd3327d[_0xebb9('0x70')][_0xebb9('0xa3')]({'id':0x0,'priority':_0xd3327d[_0xebb9('0x70')]['length']+0x1,'app':'close','appdata':_0xebb9('0xa4'),'interval':_0xebb9('0xa5')});}_0xd3327d[_0xebb9('0xa1')][_0xebb9('0xa6')]=!![];}return db[_0xebb9('0xa7')][_0xebb9('0x5a')]({'phone':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')],'messageId':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x81')],'body':_0xd3327d['body']['body'],'SmsAccountId':_0x13a02d[_0xebb9('0x58')]['id'],'SmsInteractionId':_0x5d4d30['id'],'direction':'in','ContactId':_0x5d4d30[_0xebb9('0xa8')],'AttachmentId':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0xa9')]});})[_0xebb9('0x1f')](function(_0x801332){_0xd3327d[_0xebb9('0x27')]=_0x801332;if(_0xd3327d[_0xebb9('0xa1')][_0xebb9('0xaa')]){return db['User'][_0xebb9('0x5e')]({'attributes':['id',_0xebb9('0x3b')],'where':{'id':_0xd3327d[_0xebb9('0xa1')]['UserId']}})[_0xebb9('0x1f')](function(_0x301c46){if(_0x301c46){_0xd3327d[_0xebb9('0x70')]['unshift']({'id':0x0,'priority':0x0,'app':_0xebb9('0xab'),'appdata':_0x301c46['name']+','+(_0xd3327d['account'][_0xebb9('0xac')]||0xa),'interval':_0xebb9('0xa5')});}return respondWithRpcPromise(_0xebb9('0xad'),_0xebb9('0xae'),_0xd3327d);});}return respondWithRpcPromise('Start',_0xebb9('0xae'),_0xd3327d);})[_0xebb9('0x1f')](function(_0x5eba7e){if(_0x5eba7e){var _0x57ca03=0xc8;var _0xd1d6bd=_0xebb9('0xaf');logger[_0xebb9('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd1d6bd,_0x57ca03,_0xebb9('0xb0'));logger[_0xebb9('0xb1')](_0xebb9('0xb2'),_0xd1d6bd,_0x57ca03,_0xebb9('0xb0'),JSON['stringify'](_0x5eba7e));if(_0xd3327d[_0xebb9('0x75')][_0xebb9('0x42')]===_0xebb9('0xb3')){return _0x1e23b4[_0xebb9('0x2a')](_0x57ca03)[_0xebb9('0x31')]('Content-Type',_0xebb9('0xb4'))[_0xebb9('0x3c')](_0xebb9('0xb5'));}else{return _0x1e23b4[_0xebb9('0x2a')](_0x57ca03)[_0xebb9('0x2c')](_0x5eba7e);}}})[_0xebb9('0x28')](handleError(_0x1e23b4,null));};exports[_0xebb9('0xb6')]=function(_0xa9bb9e,_0x4d8874){var _0x4892e0=_0xa9bb9e[_0xebb9('0x58')]['id'];var _0x26aac9=_0xa9bb9e['body'];var _0x5e3a63=0xc8;var _0x2f326e=null;return db[_0xebb9('0xb7')][_0xebb9('0xb8')]({'isolationLevel':db[_0xebb9('0xb7')][_0xebb9('0xb9')]['ISOLATION_LEVELS'][_0xebb9('0xba')]},function(_0x5af110){return db[_0xebb9('0x40')][_0xebb9('0x66')]({'where':{'id':_0x4892e0},'transaction':_0x5af110})['then'](function(_0x55a901){if(_0x55a901){return db[_0xebb9('0x6f')][_0xebb9('0x37')]({'where':{'SmsAccountId':_0x4892e0},'transaction':_0x5af110})[_0xebb9('0x1f')](function(){var _0x2cb193=_['map'](_0x26aac9,function(_0x17b75f){_0x17b75f[_0xebb9('0x64')]=_0x4892e0;return _0x17b75f;});return db[_0xebb9('0x6f')][_0xebb9('0xbb')](_0x2cb193,{'transaction':_0x5af110});});}else{_0x5e3a63=0x194;_0x2f326e=[];}});})[_0xebb9('0x1f')](function(){if(_0x5e3a63!==0x194){return db[_0xebb9('0x6f')][_0xebb9('0xbc')]({'where':{'SmsAccountId':_0x4892e0},'order':_0xebb9('0x73')})['then'](function(_0x591c26){_0x2f326e=_0x591c26;});}})[_0xebb9('0x28')](function(_0x3fc8ad){_0x5e3a63=0x1f4;logger[_0xebb9('0x25')](_0x3fc8ad[_0xebb9('0x3a')]);if(_0x3fc8ad[_0xebb9('0x3b')]){delete _0x3fc8ad[_0xebb9('0x3b')];}_0x2f326e=_0x3fc8ad;})[_0xebb9('0xbd')](function(){if(_0x2f326e===null){_0x4d8874['sendStatus'](_0x5e3a63);}else{if(_0x5e3a63===0x1f4){_0x4d8874[_0xebb9('0x2a')](_0x5e3a63)[_0xebb9('0x3c')](_0x2f326e);}else{_0x4d8874['status'](_0x5e3a63)[_0xebb9('0x2c')](_0x2f326e);}}});};exports[_0xebb9('0xbe')]=function(_0x21a257,_0xf71c2,_0x132e50){var _0x5db5aa={};var _0x655272={};var _0x902495;var _0x2f27d4;return db['SmsAccount'][_0xebb9('0x66')]({'where':{'id':_0x21a257[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0xf71c2,null))['then'](function(_0x27ea45){if(_0x27ea45){_0x902495=_0x27ea45;_0x655272[_0xebb9('0x44')]=_['keys'](db['SmsApplication'][_0xebb9('0x41')]);_0x655272[_0xebb9('0x45')]=_[_0xebb9('0x46')](_0x21a257[_0xebb9('0x45')]);_0x655272[_0xebb9('0x47')]=_[_0xebb9('0x48')](_0x655272[_0xebb9('0x44')],_0x655272[_0xebb9('0x45')]);_0x5db5aa[_0xebb9('0x4a')]=_['intersection'](_0x655272[_0xebb9('0x44')],qs[_0xebb9('0x49')](_0x21a257[_0xebb9('0x45')]['fields']));_0x5db5aa[_0xebb9('0x4a')]=_0x5db5aa[_0xebb9('0x4a')][_0xebb9('0x4b')]?_0x5db5aa[_0xebb9('0x4a')]:_0x655272[_0xebb9('0x44')];_0x5db5aa[_0xebb9('0x67')]=qs[_0xebb9('0x4e')](_0x21a257[_0xebb9('0x45')][_0xebb9('0x4e')]);_0x5db5aa[_0xebb9('0x4f')]=qs[_0xebb9('0x47')](_[_0xebb9('0x50')](_0x21a257['query'],_0x655272['filters']));if(_0x21a257['query']['filter']){_0x5db5aa[_0xebb9('0x4f')]=_['merge'](_0x5db5aa['where'],{'$or':_['map'](_0x5db5aa[_0xebb9('0x4a')],function(_0x3f9745){var _0xb154f9={};_0xb154f9[_0x3f9745]={'$like':'%'+_0x21a257[_0xebb9('0x45')][_0xebb9('0x52')]+'%'};return _0xb154f9;})});}_0x5db5aa=_[_0xebb9('0x51')]({},_0x5db5aa,_0x21a257[_0xebb9('0x59')]);return _0x902495['getApplications'](_0x5db5aa);}})[_0xebb9('0x1f')](function(_0x555f90){if(_0x555f90){_0x2f27d4=_0x555f90[_0xebb9('0x4b')];if(!_0x21a257[_0xebb9('0x45')][_0xebb9('0x4c')](_0xebb9('0x4d'))){_0x5db5aa[_0xebb9('0x2e')]=qs['limit'](_0x21a257['query'][_0xebb9('0x2e')]);_0x5db5aa[_0xebb9('0x2f')]=qs['offset'](_0x21a257['query'][_0xebb9('0x2f')]);}return _0x902495[_0xebb9('0xbe')](_0x5db5aa);}})[_0xebb9('0x1f')](function(_0x21f625){if(_0x21f625){return _0x21f625?{'count':_0x2f27d4,'rows':_0x21f625}:null;}})[_0xebb9('0x1f')](respondWithResult(_0xf71c2,null))['catch'](handleError(_0xf71c2,null));};exports['getInteractions']=function(_0x3d67b9,_0x554cd4,_0x13a341){var _0x9fe801={'raw':![],'where':{}};var _0x37f9d4={};var _0x2439d4={'count':0x0,'rows':[]};return db[_0xebb9('0x40')][_0xebb9('0x66')]({'where':{'id':_0x3d67b9[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x554cd4,null))[_0xebb9('0x1f')](function(_0x3ef0cd){if(_0x3ef0cd){_0x37f9d4[_0xebb9('0x44')]=_['keys'](db['SmsInteraction'][_0xebb9('0x41')]);_0x37f9d4[_0xebb9('0x45')]=_[_0xebb9('0x46')](_0x3d67b9[_0xebb9('0x45')]);_0x37f9d4[_0xebb9('0x47')]=_['intersection'](_0x37f9d4['model'],_0x37f9d4[_0xebb9('0x45')]);_0x9fe801[_0xebb9('0x4a')]=_[_0xebb9('0x48')](_0x37f9d4[_0xebb9('0x44')],qs[_0xebb9('0x49')](_0x3d67b9['query'][_0xebb9('0x49')]));_0x9fe801[_0xebb9('0x4a')]=_0x9fe801[_0xebb9('0x4a')][_0xebb9('0x4b')]?_0x9fe801[_0xebb9('0x4a')]:_0x37f9d4['model'];if(!_0x3d67b9[_0xebb9('0x45')]['hasOwnProperty'](_0xebb9('0x4d'))){_0x9fe801[_0xebb9('0x2e')]=qs['limit'](_0x3d67b9[_0xebb9('0x45')][_0xebb9('0x2e')]);_0x9fe801[_0xebb9('0x2f')]=qs['offset'](_0x3d67b9['query'][_0xebb9('0x2f')]);}_0x9fe801[_0xebb9('0x67')]=qs['sort'](_0x3d67b9[_0xebb9('0x45')][_0xebb9('0x4e')]);_0x9fe801[_0xebb9('0x4f')]=qs[_0xebb9('0x47')](_[_0xebb9('0x50')](_0x3d67b9[_0xebb9('0x45')],_0x37f9d4[_0xebb9('0x47')]));_0x9fe801[_0xebb9('0x4f')]['SmsAccountId']=_0x3ef0cd['id'];if(_0x3d67b9['query'][_0xebb9('0x52')]){_0x9fe801['where']=_[_0xebb9('0x51')](_0x9fe801['where'],{'$or':_[_0xebb9('0x3f')](_0x9fe801['attributes'],function(_0x837224){var _0x3e86fe={};_0x3e86fe[_0x837224]={'$like':'%'+_0x3d67b9[_0xebb9('0x45')][_0xebb9('0x52')]+'%'};return _0x3e86fe;})});}_0x9fe801=_['merge']({},_0x9fe801,_0x3d67b9[_0xebb9('0x59')]);return db['SmsInteraction'][_0xebb9('0x30')]({'where':_0x9fe801['where']})[_0xebb9('0x1f')](function(_0x1c84fc){_0x2439d4[_0xebb9('0x30')]=_0x1c84fc;if(_0x3d67b9[_0xebb9('0x45')][_0xebb9('0x53')]){_0x9fe801['include']=[{'model':db[_0xebb9('0x76')],'as':'Contact','required':![]},{'model':db[_0xebb9('0xbf')],'as':_0xebb9('0xc0'),'attributes':[_0xebb9('0x3b'),_0xebb9('0xc1'),'internal'],'required':![]},{'model':db[_0xebb9('0xc2')],'as':_0xebb9('0xc3'),'attributes':['id',_0xebb9('0x3b'),_0xebb9('0xc4')],'where':_0x3d67b9[_0xebb9('0x45')]['tag']?{'id':_0x3d67b9[_0xebb9('0x45')][_0xebb9('0xc5')]}:undefined,'required':_0x3d67b9[_0xebb9('0x45')]['tag']?!![]:![]}];}return db[_0xebb9('0x9f')][_0xebb9('0x55')](_0x9fe801);})[_0xebb9('0x1f')](function(_0x5f24bb){_0x2439d4[_0xebb9('0x56')]=_0x5f24bb;return _0x2439d4;});}})[_0xebb9('0x1f')](respondWithFilteredResult(_0x554cd4,_0x9fe801))[_0xebb9('0x28')](handleError(_0x554cd4,null));};exports['send']=function(_0x38ccf5,_0x27580a,_0x354daa){var _0x443c00,_0xaad2d,_0x3ee0c3;if(_[_0xebb9('0x93')](_0x38ccf5['body']['body'])||_0x38ccf5[_0xebb9('0x5b')][_0xebb9('0x5b')]===''){throw new db['Sequelize'][(_0xebb9('0x78'))](_0xebb9('0x95'));}if(_['isNil'](_0x38ccf5['body']['to'])){throw new db[(_0xebb9('0x77'))][(_0xebb9('0x78'))](_0xebb9('0xc6'));}_0x443c00=_0x38ccf5[_0xebb9('0x5b')]['to'];return db['SmsAccount'][_0xebb9('0x5e')]({'where':{'id':_0x38ccf5[_0xebb9('0x58')]['id']},'include':[{'model':db[_0xebb9('0x9a')],'as':_0xebb9('0xc7'),'include':[{'model':db[_0xebb9('0x76')],'as':_0xebb9('0x9b'),'where':{'mobile':_0x443c00},'limit':0x1,'order':[[_0xebb9('0x7b'),'DESC']]}]}]})[_0xebb9('0x1f')](handleEntityNotFound(_0x27580a,null))['then'](function(_0x533751){if(_0x533751&&_0x533751[_0xebb9('0xc7')]){_0xaad2d=_0x533751[_0xebb9('0x38')]({'plain':!![]});if(_0xaad2d[_0xebb9('0xc7')]&&_0xaad2d[_0xebb9('0xc7')]['Contacts'][_0xebb9('0x4b')]){return _0xaad2d[_0xebb9('0xc7')][_0xebb9('0x9b')][0x0];}return db[_0xebb9('0x76')][_0xebb9('0x5a')](_[_0xebb9('0x17')](_0x38ccf5[_0xebb9('0x5b')],{'firstName':_0x443c00,'mobile':_0x443c00,'phone':_0x443c00,'ListId':_0xaad2d['ListId']}));}})[_0xebb9('0x1f')](handleEntityNotFound(_0x27580a,null))[_0xebb9('0x1f')](function(_0x21f4a8){if(_0x21f4a8){_0x3ee0c3=_0x21f4a8;return db['SmsInteraction'][_0xebb9('0x5e')]({'where':{'ContactId':_0x3ee0c3['id'],'closed':![],'SmsAccountId':_0xaad2d['id']}})['then'](function(_0x5ef8b8){if(_0x5ef8b8){return[_0x5ef8b8,![]];}return db[_0xebb9('0x9f')]['create']({'UserId':_0x38ccf5[_0xebb9('0xc8')]['id'],'ContactId':_0x3ee0c3['id'],'SmsAccountId':_0xaad2d['id'],'phone':_0x443c00,'firstMsgDirection':_0xebb9('0xc9'),'Messages':[_[_0xebb9('0x51')](_0x38ccf5[_0xebb9('0x5b')],{'read':![],'body':_0x38ccf5[_0xebb9('0x5b')]['body'],'phone':_0x443c00,'SmsAccountId':_0xaad2d['id'],'UserId':_0x38ccf5[_0xebb9('0xc8')]['id'],'ContactId':_0x3ee0c3['id']})]},{'include':[{'model':db[_0xebb9('0xa7')],'as':_0xebb9('0xca')}]})[_0xebb9('0x1f')](function(_0x3b5b5c){return[_0x3b5b5c,!![]];});});}})[_0xebb9('0xa0')](function(_0x19fa7f,_0x51833c){if(_0x51833c){return _0x19fa7f;}return db[_0xebb9('0xa7')][_0xebb9('0x5a')](_[_0xebb9('0x51')](_0x38ccf5[_0xebb9('0x5b')],{'read':![],'body':_0x38ccf5['body'][_0xebb9('0x5b')],'phone':_0x443c00,'SmsAccountId':_0xaad2d['id'],'SmsInteractionId':_0x19fa7f['id'],'UserId':_0x38ccf5['user']['id'],'ContactId':_0x3ee0c3['id']}))[_0xebb9('0x1f')](function(_0x311117){_0x19fa7f[_0xebb9('0xcb')][_0xebb9('0xca')]=[];_0x19fa7f[_0xebb9('0xcb')][_0xebb9('0xca')][_0xebb9('0xa3')](_0x311117['dataValues']);return _0x19fa7f;});})['then'](respondWithResult(_0x27580a,null))[_0xebb9('0x28')](handleError(_0x27580a,null));};exports[_0xebb9('0x2a')]=function(_0x33a176,_0x40b49f,_0x46af99){if(_0x33a176[_0xebb9('0x5b')]['id']){delete _0x33a176['body']['id'];}var _0x2cdf6d,_0x434d2a,_0x154759;return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x33a176[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x40b49f,null))[_0xebb9('0x1f')](function(_0x34e18a){if(_0x34e18a){_0x154759=_0x34e18a;logger[_0xebb9('0xb1')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xebb9('0xcc'),_0x34e18a[_0xebb9('0x42')],util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));switch(_0x34e18a[_0xebb9('0x42')]){case _0xebb9('0xce'):if(_0x33a176[_0xebb9('0x5b')][_0xebb9('0xcf')]&&_0x33a176[_0xebb9('0x5b')]['status']){_0x434d2a=_0x33a176[_0xebb9('0x5b')][_0xebb9('0x2a')];return db['SmsMessage'][_0xebb9('0x5e')]({'where':{'messageId':_0x33a176[_0xebb9('0x5b')][_0xebb9('0xcf')]}});}break;case'connectel':if(_0x33a176[_0xebb9('0x5b')][_0xebb9('0xd0')]&&_0x33a176[_0xebb9('0x5b')][_0xebb9('0xd1')]){_0x434d2a=_0x33a176[_0xebb9('0x5b')][_0xebb9('0xd1')];return db[_0xebb9('0xa7')]['find']({'where':{'messageId':_0x33a176['body'][_0xebb9('0xd0')]}});}break;case'clicksend':if(_0x33a176['body']['message_id']&&_0x33a176[_0xebb9('0x5b')][_0xebb9('0xd2')]){_0x434d2a=_0x33a176[_0xebb9('0x5b')][_0xebb9('0xd2')];return db[_0xebb9('0xa7')][_0xebb9('0x5e')]({'where':{'messageId':_0x33a176[_0xebb9('0x5b')][_0xebb9('0x86')]}});}break;case'infobip':var _0x3324d9=_0x33a176[_0xebb9('0x5b')][_0xebb9('0x8a')][0x0];if(_0x3324d9[_0xebb9('0x81')]&&_0x3324d9[_0xebb9('0x2a')]['groupName']===_0xebb9('0xd3')){_0x434d2a=_0x3324d9[_0xebb9('0x2a')][_0xebb9('0xd4')];return db[_0xebb9('0xa7')][_0xebb9('0x5e')]({'where':{'messageId':_0x3324d9[_0xebb9('0x81')]}});}break;case _0xebb9('0xd5'):if(_0x33a176[_0xebb9('0x5b')]['messageId']&&_0x33a176[_0xebb9('0x5b')][_0xebb9('0x2a')]){_0x434d2a=_0x33a176[_0xebb9('0x5b')][_0xebb9('0x2a')];return db[_0xebb9('0xa7')]['find']({'where':{'messageId':_0x33a176[_0xebb9('0x5b')][_0xebb9('0x81')]}});}break;case'bandwidth':if(_0x33a176[_0xebb9('0x5b')][0x0][_0xebb9('0x27')]['id']){_0x434d2a=_0x33a176[_0xebb9('0x5b')][0x0]['type'];return db[_0xebb9('0xa7')][_0xebb9('0x5e')]({'where':{'messageId':_0x33a176[_0xebb9('0x5b')][0x0]['message']['id']}});}break;case _0xebb9('0x91'):if(_0x33a176['body'][_0xebb9('0xd6')]&&_0x33a176[_0xebb9('0x5b')][_0xebb9('0x2a')]){_0x434d2a=_0x33a176[_0xebb9('0x5b')]['status'];return db[_0xebb9('0xa7')][_0xebb9('0x5e')]({'where':{'messageId':_0x33a176['body']['redif']}});}break;}}})['then'](handleEntityNotFound(_0x40b49f,null))[_0xebb9('0x1f')](function(_0x28fe31){if(_0x28fe31){_0x2cdf6d=_0x28fe31;switch(_0x154759[_0xebb9('0x42')]){case _0xebb9('0xce'):if(_0x434d2a===_0xebb9('0xd3')){return _0x2cdf6d['update']({'read':!![]});}else{logger['error'](_0xebb9('0x23'),_0xebb9('0x2a'),_0xebb9('0xce'),util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xebb9('0x84'):if(_0x434d2a==='1'){return _0x2cdf6d['update']({'read':!![]});}else{logger['error'](_0xebb9('0x23'),'status',_0xebb9('0xce'),util['inspect'](_0x33a176['body'],{'showHidden':![],'depth':null}));}break;case _0xebb9('0x85'):if(!_0x33a176['body'][_0xebb9('0xd7')]&&_0x434d2a>=0xc8&&_0x434d2a<=0xce){return _0x2cdf6d[_0xebb9('0x36')]({'read':!![]});}else{logger[_0xebb9('0x25')](_0xebb9('0x23'),_0xebb9('0x2a'),'clicksend',util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xebb9('0xd8'):var _0x2135cf=_0x33a176[_0xebb9('0x5b')]['results'][0x0];if(_0x2135cf[_0xebb9('0x2a')][_0xebb9('0xd4')]===_0xebb9('0xd3')){return _0x2cdf6d[_0xebb9('0x36')]({'read':!![]});}else{logger[_0xebb9('0x25')](_0xebb9('0x23'),'status',_0xebb9('0xd8'),util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xebb9('0xd5'):if(_0x434d2a==_0xebb9('0xd9')||_0x434d2a==_0xebb9('0xda')){return _0x2cdf6d[_0xebb9('0x36')]({'read':!![]});}else{logger[_0xebb9('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xebb9('0x2a'),_0xebb9('0xd5'),util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x434d2a=='message-delivered'){return _0x2cdf6d[_0xebb9('0x36')]({'read':!![]});}else{logger['error'](_0xebb9('0x23'),_0xebb9('0x2a'),_0xebb9('0x90'),util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xebb9('0x91'):if(_0x434d2a==='DELIVRD'||_0x434d2a===_0xebb9('0xdb')){return _0x2cdf6d[_0xebb9('0x36')]({'read':!![]});}else{logger[_0xebb9('0x25')](_0xebb9('0x23'),_0xebb9('0x2a'),_0xebb9('0x91'),util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x2cdf6d;}})[_0xebb9('0x1f')](respondWithResult(_0x40b49f,null))[_0xebb9('0x28')](handleError(_0x40b49f,null));};exports[_0xebb9('0xdc')]=function(_0x175bcd,_0x56d70e,_0x1270ac){var _0x1d2dd8,_0xb0fbce,_0x1abf76;return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x175bcd[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x56d70e,null))['then'](function(_0x136bca){if(_0x136bca){_0x1abf76=_0x136bca;logger[_0xebb9('0xb1')](_0xebb9('0x23'),_0xebb9('0x2a'),_0xebb9('0xcc'),_0x136bca[_0xebb9('0x42')],util[_0xebb9('0xcd')](_0x175bcd[_0xebb9('0x45')],{'showHidden':![],'depth':null}));switch(_0x136bca[_0xebb9('0x42')]){case _0xebb9('0x8b'):if(_0x175bcd['query']['message-id']&&_0x175bcd[_0xebb9('0x45')][_0xebb9('0xdd')]){_0xb0fbce=_0x175bcd[_0xebb9('0x45')][_0xebb9('0xdd')];return db[_0xebb9('0xa7')][_0xebb9('0x5e')]({'where':{'messageId':_0x175bcd['query'][_0xebb9('0xde')]}});}break;}}})[_0xebb9('0x1f')](handleEntityNotFound(_0x56d70e,null))[_0xebb9('0x1f')](function(_0x11fd91){if(_0x11fd91){_0x1d2dd8=_0x11fd91;switch(_0x1abf76['type']){case _0xebb9('0x8b'):if(_0xb0fbce==='2'||_0xb0fbce==='6'){return _0x1d2dd8[_0xebb9('0x36')]({'read':!![]});}else{logger[_0xebb9('0x25')](_0xebb9('0x23'),_0xebb9('0x2a'),_0xebb9('0x8b'),util[_0xebb9('0xcd')](_0x175bcd[_0xebb9('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x1d2dd8;}})[_0xebb9('0x1f')](respondWithResult(_0x56d70e,null))[_0xebb9('0x28')](handleError(_0x56d70e,null));};exports[_0xebb9('0xdf')]=function(_0x5160b2,_0x731960,_0x4fa267){return db[_0xebb9('0x40')]['find']({'where':{'id':_0x5160b2[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x731960,null))[_0xebb9('0x1f')](function(_0x3a632c){if(_0x3a632c){return _0x3a632c[_0xebb9('0xdf')](_0x5160b2[_0xebb9('0x5b')][_0xebb9('0x69')],_[_0xebb9('0xe0')](_0x5160b2['body'],['ids','id'])||{})[_0xebb9('0xa0')](function(_0x4aa9bd){for(var _0x5a2238=0x0;_0x5a2238<_0x5160b2[_0xebb9('0x5b')][_0xebb9('0x69')][_0xebb9('0x4b')];_0x5a2238+=0x1){socket[_0xebb9('0xe1')](_0xebb9('0xe2'),{'UserId':Number(_0x5160b2[_0xebb9('0x5b')][_0xebb9('0x69')][_0x5a2238]),'SmsAccountId':Number(_0x5160b2[_0xebb9('0x58')]['id'])});}return _0x4aa9bd;});}})['then'](respondWithResult(_0x731960,null))[_0xebb9('0x28')](handleError(_0x731960,null));};exports['removeAgents']=function(_0x7a009f,_0x2c8073,_0x2dbc4b){return db[_0xebb9('0x40')]['find']({'where':{'id':_0x7a009f['params']['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x2c8073,null))['then'](function(_0x3bcd51){if(_0x3bcd51){return _0x3bcd51['removeAgents'](_0x7a009f[_0xebb9('0x45')][_0xebb9('0x69')])[_0xebb9('0x1f')](function(){if(_[_0xebb9('0xe3')](_0x7a009f[_0xebb9('0x45')]['ids'])){for(var _0x2c4d2e=0x0;_0x2c4d2e<_0x7a009f['query'][_0xebb9('0x69')][_0xebb9('0x4b')];_0x2c4d2e+=0x1){socket[_0xebb9('0xe1')](_0xebb9('0xe4'),{'UserId':Number(_0x7a009f[_0xebb9('0x45')]['ids'][_0x2c4d2e]),'SmsAccountId':Number(_0x7a009f['params']['id'])});}}else{socket[_0xebb9('0xe1')]('userSmsAccount:remove',{'UserId':Number(_0x7a009f[_0xebb9('0x45')]['ids']),'SmsAccountId':Number(_0x7a009f[_0xebb9('0x58')]['id'])});}});}})[_0xebb9('0x1f')](respondWithStatusCode(_0x2c8073,null))[_0xebb9('0x28')](handleError(_0x2c8073,null));};exports['getAgents']=function(_0xc62b17,_0x294c76,_0x37cd1f){var _0x2d2f7e={};var _0x4b7527={};var _0x46d86e;var _0x8c98ba;return db[_0xebb9('0x40')]['findOne']({'where':{'id':_0xc62b17[_0xebb9('0x58')]['id']}})['then'](handleEntityNotFound(_0x294c76,null))['then'](function(_0x138b6d){if(_0x138b6d){_0x46d86e=_0x138b6d;_0x4b7527[_0xebb9('0x44')]=_[_0xebb9('0x46')](db[_0xebb9('0xbf')]['rawAttributes']);_0x4b7527[_0xebb9('0x45')]=_['keys'](_0xc62b17[_0xebb9('0x45')]);_0x4b7527[_0xebb9('0x47')]=_[_0xebb9('0x48')](_0x4b7527[_0xebb9('0x44')],_0x4b7527[_0xebb9('0x45')]);_0x2d2f7e['attributes']=_['intersection'](_0x4b7527[_0xebb9('0x44')],qs[_0xebb9('0x49')](_0xc62b17[_0xebb9('0x45')][_0xebb9('0x49')]));_0x2d2f7e[_0xebb9('0x4a')]=_0x2d2f7e[_0xebb9('0x4a')][_0xebb9('0x4b')]?_0x2d2f7e[_0xebb9('0x4a')]:_0x4b7527['model'];_0x2d2f7e[_0xebb9('0x67')]=qs[_0xebb9('0x4e')](_0xc62b17[_0xebb9('0x45')][_0xebb9('0x4e')]);_0x2d2f7e[_0xebb9('0x4f')]=qs[_0xebb9('0x47')](_[_0xebb9('0x50')](_0xc62b17[_0xebb9('0x45')],_0x4b7527[_0xebb9('0x47')]));if(_0xc62b17[_0xebb9('0x45')]['filter']){_0x2d2f7e[_0xebb9('0x4f')]=_['merge'](_0x2d2f7e[_0xebb9('0x4f')],{'$or':_[_0xebb9('0x3f')](_0x2d2f7e['attributes'],function(_0x2577bb){var _0x12e598={};_0x12e598[_0x2577bb]={'$like':'%'+_0xc62b17[_0xebb9('0x45')][_0xebb9('0x52')]+'%'};return _0x12e598;})});}_0x2d2f7e=_[_0xebb9('0x51')]({},_0x2d2f7e,_0xc62b17[_0xebb9('0x59')]);return _0x46d86e['getAgents'](_0x2d2f7e);}})[_0xebb9('0x1f')](function(_0xf52f97){if(_0xf52f97){_0x8c98ba=_0xf52f97['length'];if(!_0xc62b17[_0xebb9('0x45')][_0xebb9('0x4c')](_0xebb9('0x4d'))){_0x2d2f7e[_0xebb9('0x2e')]=qs[_0xebb9('0x2e')](_0xc62b17[_0xebb9('0x45')][_0xebb9('0x2e')]);_0x2d2f7e[_0xebb9('0x2f')]=qs['offset'](_0xc62b17[_0xebb9('0x45')][_0xebb9('0x2f')]);}return _0x46d86e[_0xebb9('0xe5')](_0x2d2f7e);}})['then'](function(_0x9138f9){if(_0x9138f9){return _0x9138f9?{'count':_0x8c98ba,'rows':_0x9138f9}:null;}})[_0xebb9('0x1f')](respondWithResult(_0x294c76,null))['catch'](handleError(_0x294c76,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 9920c62..3866e7a 100644 --- a/server/api/smsAccount/smsAccount.events.js +++ b/server/api/smsAccount/smsAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79dd=['hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit'];(function(_0x5dfe94,_0x1e975c){var _0x560635=function(_0xc319de){while(--_0xc319de){_0x5dfe94['push'](_0x5dfe94['shift']());}};_0x560635(++_0x1e975c);}(_0x79dd,0x1d8));var _0xd79d=function(_0x2644f8,_0x40977c){_0x2644f8=_0x2644f8-0x0;var _0x233fea=_0x79dd[_0x2644f8];return _0x233fea;};'use strict';var EventEmitter=require(_0xd79d('0x0'));var SmsAccount=require(_0xd79d('0x1'))['db'][_0xd79d('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd79d('0x3')](0x0);var events={'afterCreate':_0xd79d('0x4'),'afterUpdate':_0xd79d('0x5'),'afterDestroy':_0xd79d('0x6')};function emitEvent(_0x3ab05c){return function(_0x2f1d9e,_0x454812,_0x335c88){SmsAccountEvents[_0xd79d('0x7')](_0x3ab05c+':'+_0x2f1d9e['id'],_0x2f1d9e);SmsAccountEvents[_0xd79d('0x7')](_0x3ab05c,_0x2f1d9e);_0x335c88(null);};}for(var e in events){if(events[_0xd79d('0x8')](e)){var event=events[e];SmsAccount[_0xd79d('0x9')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x8c3f=['SmsAccount','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x53f47e,_0x5d6357){var _0x51d9c5=function(_0x2ce6d8){while(--_0x2ce6d8){_0x53f47e['push'](_0x53f47e['shift']());}};_0x51d9c5(++_0x5d6357);}(_0x8c3f,0x130));var _0xf8c3=function(_0x95c628,_0x2982c6){_0x95c628=_0x95c628-0x0;var _0x744c0b=_0x8c3f[_0x95c628];return _0x744c0b;};'use strict';var EventEmitter=require(_0xf8c3('0x0'));var SmsAccount=require(_0xf8c3('0x1'))['db'][_0xf8c3('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8c3('0x3'),'afterUpdate':_0xf8c3('0x4'),'afterDestroy':_0xf8c3('0x5')};function emitEvent(_0x412fc2){return function(_0x2ad6ab,_0x437103,_0x5df09b){SmsAccountEvents[_0xf8c3('0x6')](_0x412fc2+':'+_0x2ad6ab['id'],_0x2ad6ab);SmsAccountEvents[_0xf8c3('0x6')](_0x412fc2,_0x2ad6ab);_0x5df09b(null);};}for(var e in events){if(events[_0xf8c3('0x7')](e)){var event=events[e];SmsAccount[_0xf8c3('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index e92eee9..06ee978 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd339=['SmsAccount','sms_accounts','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./smsAccount.attributes','exports','define'];(function(_0xe81660,_0x4393fb){var _0x1df6e2=function(_0x306c6b){while(--_0x306c6b){_0xe81660['push'](_0xe81660['shift']());}};_0x1df6e2(++_0x4393fb);}(_0xd339,0x122));var _0x9d33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd339[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d33('0x0'));var util=require(_0x9d33('0x1'));var logger=require('../../config/logger')(_0x9d33('0x2'));var moment=require(_0x9d33('0x3'));var BPromise=require(_0x9d33('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9d33('0x5'));var config=require(_0x9d33('0x6'));var attributes=require(_0x9d33('0x7'));module[_0x9d33('0x8')]=function(_0x18d800,_0x50a301){return _0x18d800[_0x9d33('0x9')](_0x9d33('0xa'),attributes,{'tableName':_0x9d33('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52b6=['util','../../config/logger','moment','bluebird','request-promise','path','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x52b6,0xef));var _0x652b=function(_0x21799b,_0x4694af){_0x21799b=_0x21799b-0x0;var _0x317530=_0x52b6[_0x21799b];return _0x317530;};'use strict';var _=require(_0x652b('0x0'));var util=require(_0x652b('0x1'));var logger=require(_0x652b('0x2'))('api');var moment=require(_0x652b('0x3'));var BPromise=require(_0x652b('0x4'));var rp=require(_0x652b('0x5'));var fs=require('fs');var path=require(_0x652b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x652b('0x7'));module[_0x652b('0x8')]=function(_0x5e91b3,_0x5a3ac1){return _0x5e91b3[_0x652b('0x9')](_0x652b('0xa'),attributes,{'tableName':_0x652b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 6cd1ab0..3529c64 100644 --- a/server/api/smsAccount/smsAccount.rpc.js +++ b/server/api/smsAccount/smsAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x307a=['ShowSmsAccount','SmsAccount','find','options','attributes','include','map','model','util','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x9bf5cd,_0x5da166){var _0x2bf78e=function(_0x2ac870){while(--_0x2ac870){_0x9bf5cd['push'](_0x9bf5cd['shift']());}};_0x2bf78e(++_0x5da166);}(_0x307a,0x84));var _0xa307=function(_0x2ee59c,_0x11c185){_0x2ee59c=_0x2ee59c-0x0;var _0x18aa77=_0x307a[_0x2ee59c];return _0x18aa77;};'use strict';var _=require('lodash');var util=require(_0xa307('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa307('0x1'));var fs=require('fs');var Redis=require(_0xa307('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa307('0x3'));var jayson=require(_0xa307('0x4'));var client=jayson[_0xa307('0x5')][_0xa307('0x6')]({'port':0x232a});config[_0xa307('0x7')]=_[_0xa307('0x8')](config['redis'],{'host':_0xa307('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa307('0x7')]));require('./smsAccount.socket')[_0xa307('0xa')](socket);function respondWithRpcPromise(_0x8d011,_0x4464a8,_0x245bef){return new BPromise(function(_0x3d7cd3,_0x5eab32){return client[_0xa307('0xb')](_0x8d011,_0x245bef)[_0xa307('0xc')](function(_0x3eccc4){logger[_0xa307('0xd')](_0xa307('0xe'),_0x4464a8,_0xa307('0xf'));logger[_0xa307('0x10')](_0xa307('0x11'),_0x4464a8,_0xa307('0xf'),JSON[_0xa307('0x12')](_0x3eccc4));if(_0x3eccc4[_0xa307('0x13')]){if(_0x3eccc4[_0xa307('0x13')]['code']===0x1f4){logger['error'](_0xa307('0xe'),_0x4464a8,_0x3eccc4[_0xa307('0x13')]['message']);return _0x5eab32(_0x3eccc4[_0xa307('0x13')][_0xa307('0x14')]);}logger['error'](_0xa307('0xe'),_0x4464a8,_0x3eccc4[_0xa307('0x13')][_0xa307('0x14')]);return _0x3d7cd3(_0x3eccc4['error']['message']);}else{logger[_0xa307('0xd')](_0xa307('0xe'),_0x4464a8,_0xa307('0xf'));_0x3d7cd3(_0x3eccc4[_0xa307('0x15')]['message']);}})[_0xa307('0x16')](function(_0x103bd6){logger[_0xa307('0x13')](_0xa307('0xe'),_0x4464a8,_0x103bd6);_0x5eab32(_0x103bd6);});});}exports[_0xa307('0x17')]=function(_0x39ce11){var _0x569ad5=this;return new Promise(function(_0x2a1e9c,_0x430fc3){return db[_0xa307('0x18')][_0xa307('0x19')]({'raw':_0x39ce11[_0xa307('0x1a')]?_0x39ce11[_0xa307('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x39ce11['options']?_0x39ce11[_0xa307('0x1a')]['where']||null:null,'attributes':_0x39ce11['options']?_0x39ce11[_0xa307('0x1a')][_0xa307('0x1b')]||null:null,'include':_0x39ce11[_0xa307('0x1a')]?_0x39ce11[_0xa307('0x1a')][_0xa307('0x1c')]?_[_0xa307('0x1d')](_0x39ce11[_0xa307('0x1a')][_0xa307('0x1c')],function(_0x3d3165){return{'model':db[_0x3d3165[_0xa307('0x1e')]],'as':_0x3d3165['as'],'attributes':_0x3d3165[_0xa307('0x1b')],'include':_0x3d3165[_0xa307('0x1c')]?_[_0xa307('0x1d')](_0x3d3165[_0xa307('0x1c')],function(_0x1e1251){return{'model':db[_0x1e1251[_0xa307('0x1e')]],'as':_0x1e1251['as'],'attributes':_0x1e1251[_0xa307('0x1b')],'include':_0x1e1251[_0xa307('0x1c')]?_[_0xa307('0x1d')](_0x1e1251[_0xa307('0x1c')],function(_0x8d5dac){return{'model':db[_0x8d5dac['model']],'as':_0x8d5dac['as'],'attributes':_0x8d5dac[_0xa307('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa307('0xc')](function(_0xa9c419){logger['info']('ShowSmsAccount',_0x39ce11);logger['debug'](_0xa307('0x17'),_0x39ce11,JSON[_0xa307('0x12')](_0xa9c419));_0x2a1e9c(_0xa9c419);})[_0xa307('0x16')](function(_0x3063ab){logger[_0xa307('0x13')](_0xa307('0x17'),_0x3063ab[_0xa307('0x14')],_0x39ce11);_0x430fc3(_0x569ad5[_0xa307('0x13')](0x1f4,_0x3063ab['message']));});});}; \ No newline at end of file +var _0xe535=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','catch','lodash','util'];(function(_0x582d5d,_0x244b01){var _0x4d6811=function(_0x399667){while(--_0x399667){_0x582d5d['push'](_0x582d5d['shift']());}};_0x4d6811(++_0x244b01);}(_0xe535,0x136));var _0x5e53=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xe535[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x5e53('0x0'));var util=require(_0x5e53('0x1'));var moment=require(_0x5e53('0x2'));var BPromise=require(_0x5e53('0x3'));var rs=require(_0x5e53('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5e53('0x5'));var logger=require(_0x5e53('0x6'))(_0x5e53('0x7'));var config=require('../../config/environment');var jayson=require(_0x5e53('0x8'));var client=jayson[_0x5e53('0x9')][_0x5e53('0xa')]({'port':0x232a});config[_0x5e53('0xb')]=_[_0x5e53('0xc')](config[_0x5e53('0xb')],{'host':_0x5e53('0xd'),'port':0x18eb});var socket=require(_0x5e53('0xe'))(new Redis(config[_0x5e53('0xb')]));require(_0x5e53('0xf'))[_0x5e53('0x10')](socket);function respondWithRpcPromise(_0x1aaec3,_0x57f7cd,_0x41aede){return new BPromise(function(_0x5cefe5,_0xbebc60){return client[_0x5e53('0x11')](_0x1aaec3,_0x41aede)[_0x5e53('0x12')](function(_0xc2e527){logger[_0x5e53('0x13')](_0x5e53('0x14'),_0x57f7cd,_0x5e53('0x15'));logger[_0x5e53('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x57f7cd,_0x5e53('0x15'),JSON[_0x5e53('0x17')](_0xc2e527));if(_0xc2e527[_0x5e53('0x18')]){if(_0xc2e527[_0x5e53('0x18')][_0x5e53('0x19')]===0x1f4){logger[_0x5e53('0x18')]('SmsAccount,\x20%s,\x20%s',_0x57f7cd,_0xc2e527['error']['message']);return _0xbebc60(_0xc2e527[_0x5e53('0x18')][_0x5e53('0x1a')]);}logger[_0x5e53('0x18')]('SmsAccount,\x20%s,\x20%s',_0x57f7cd,_0xc2e527[_0x5e53('0x18')][_0x5e53('0x1a')]);return _0x5cefe5(_0xc2e527['error'][_0x5e53('0x1a')]);}else{logger[_0x5e53('0x13')]('SmsAccount,\x20%s,\x20%s',_0x57f7cd,_0x5e53('0x15'));_0x5cefe5(_0xc2e527[_0x5e53('0x1b')][_0x5e53('0x1a')]);}})['catch'](function(_0x549d2f){logger[_0x5e53('0x18')](_0x5e53('0x14'),_0x57f7cd,_0x549d2f);_0xbebc60(_0x549d2f);});});}exports[_0x5e53('0x1c')]=function(_0x46eba1){var _0x4dc887=this;return new Promise(function(_0x566716,_0x1ccc31){return db[_0x5e53('0x1d')][_0x5e53('0x1e')]({'raw':_0x46eba1[_0x5e53('0x1f')]?_0x46eba1[_0x5e53('0x1f')][_0x5e53('0x20')]===undefined?!![]:![]:!![],'where':_0x46eba1[_0x5e53('0x1f')]?_0x46eba1['options'][_0x5e53('0x21')]||null:null,'attributes':_0x46eba1[_0x5e53('0x1f')]?_0x46eba1[_0x5e53('0x1f')]['attributes']||null:null,'include':_0x46eba1[_0x5e53('0x1f')]?_0x46eba1[_0x5e53('0x1f')][_0x5e53('0x22')]?_[_0x5e53('0x23')](_0x46eba1[_0x5e53('0x1f')]['include'],function(_0x190ca8){return{'model':db[_0x190ca8[_0x5e53('0x24')]],'as':_0x190ca8['as'],'attributes':_0x190ca8['attributes'],'include':_0x190ca8['include']?_[_0x5e53('0x23')](_0x190ca8[_0x5e53('0x22')],function(_0x4d8bef){return{'model':db[_0x4d8bef[_0x5e53('0x24')]],'as':_0x4d8bef['as'],'attributes':_0x4d8bef[_0x5e53('0x25')],'include':_0x4d8bef[_0x5e53('0x22')]?_[_0x5e53('0x23')](_0x4d8bef[_0x5e53('0x22')],function(_0x5ddc78){return{'model':db[_0x5ddc78[_0x5e53('0x24')]],'as':_0x5ddc78['as'],'attributes':_0x5ddc78[_0x5e53('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e886f){logger[_0x5e53('0x13')](_0x5e53('0x1c'),_0x46eba1);logger[_0x5e53('0x16')](_0x5e53('0x1c'),_0x46eba1,JSON[_0x5e53('0x17')](_0x4e886f));_0x566716(_0x4e886f);})[_0x5e53('0x26')](function(_0x22eaff){logger['error'](_0x5e53('0x1c'),_0x22eaff[_0x5e53('0x1a')],_0x46eba1);_0x1ccc31(_0x4dc887[_0x5e53('0x18')](0x1f4,_0x22eaff[_0x5e53('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index a15ecaf..866abf1 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 6525a79..15f71a5 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x1d8005,_0x272160){var _0x237dc6=function(_0x7ef412){while(--_0x7ef412){_0x1d8005['push'](_0x1d8005['shift']());}};_0x237dc6(++_0x272160);}(_0x3e74,0x175));var _0x43e7=function(_0x5b43d5,_0x1d7db4){_0x5b43d5=_0x5b43d5-0x0;var _0x29d1cf=_0x3e74[_0x5b43d5];return _0x29d1cf;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x278392,_0x2f2662){var _0x525961=function(_0x4a34a3){while(--_0x4a34a3){_0x278392['push'](_0x278392['shift']());}};_0x525961(++_0x2f2662);}(_0xedd9,0xfc));var _0x9edd=function(_0x340f5f,_0x2cd7ab){_0x340f5f=_0x340f5f-0x0;var _0x2b1219=_0xedd9[_0x340f5f];return _0x2b1219;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 79ddeb2..6272890 100644 --- a/server/api/smsApplication/smsApplication.attributes.js +++ b/server/api/smsApplication/smsApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8de=['STRING','noop','TEXT','sequelize','exports'];(function(_0x1dac78,_0x3b832f){var _0x541302=function(_0x1d5041){while(--_0x1d5041){_0x1dac78['push'](_0x1dac78['shift']());}};_0x541302(++_0x3b832f);}(_0xa8de,0x175));var _0xea8d=function(_0x1c74e1,_0xe9deee){_0x1c74e1=_0x1c74e1-0x0;var _0x530c40=_0xa8de[_0x1c74e1];return _0x530c40;};'use strict';var Sequelize=require(_0xea8d('0x0'));module[_0xea8d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xea8d('0x2')],'allowNull':![],'defaultValue':_0xea8d('0x3')},'appdata':{'type':Sequelize[_0xea8d('0x4')]()},'description':{'type':Sequelize[_0xea8d('0x2')]},'interval':{'type':Sequelize[_0xea8d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xc0ac=['STRING','*,*,*,*','sequelize','exports','noop'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xc0ac,0x66));var _0xcc0a=function(_0x34ffc3,_0x234484){_0x34ffc3=_0x34ffc3-0x0;var _0x1725f3=_0xc0ac[_0x34ffc3];return _0x1725f3;};'use strict';var Sequelize=require(_0xcc0a('0x0'));module[_0xcc0a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc0a('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xcc0a('0x3')]},'interval':{'type':Sequelize[_0xcc0a('0x3')],'defaultValue':_0xcc0a('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a322324..bbbc73a 100644 --- a/server/api/smsApplication/smsApplication.controller.js +++ b/server/api/smsApplication/smsApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0484=['limit','count','set','Content-Range','apply','save','update','destroy','error','stack','name','send','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','findAll','then','rows','show','params','include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x59e5b6,_0xe1ffd6){var _0xd6dbdf=function(_0x458768){while(--_0x458768){_0x59e5b6['push'](_0x59e5b6['shift']());}};_0xd6dbdf(++_0xe1ffd6);}(_0x0484,0x112));var _0x4048=function(_0x138429,_0x10a919){_0x138429=_0x138429-0x0;var _0x4b273e=_0x0484[_0x138429];return _0x4b273e;};'use strict';var emlformat=require(_0x4048('0x0'));var rimraf=require(_0x4048('0x1'));var zipdir=require(_0x4048('0x2'));var jsonpatch=require(_0x4048('0x3'));var rp=require(_0x4048('0x4'));var moment=require(_0x4048('0x5'));var BPromise=require(_0x4048('0x6'));var Mustache=require(_0x4048('0x7'));var util=require(_0x4048('0x8'));var path=require(_0x4048('0x9'));var sox=require(_0x4048('0xa'));var csv=require('to-csv');var ejs=require(_0x4048('0xb'));var fs=require('fs');var fs_extra=require(_0x4048('0xc'));var _=require('lodash');var squel=require(_0x4048('0xd'));var crypto=require(_0x4048('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4048('0xf'));var querystring=require('querystring');var Papa=require(_0x4048('0x10'));var Redis=require(_0x4048('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4048('0x12'));var as=require(_0x4048('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4048('0x14'))(_0x4048('0x15'));var utils=require('../../config/utils');var config=require(_0x4048('0x16'));var licenseUtil=require(_0x4048('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2069a7,_0x391338){_0x391338=_0x391338||0xcc;return function(_0x24ec86){if(_0x24ec86){return _0x2069a7[_0x4048('0x18')](_0x391338);}return _0x2069a7[_0x4048('0x19')](_0x391338)[_0x4048('0x1a')]();};}function respondWithResult(_0x42be25,_0x2e9ad8){_0x2e9ad8=_0x2e9ad8||0xc8;return function(_0x548ea4){if(_0x548ea4){return _0x42be25['status'](_0x2e9ad8)[_0x4048('0x1b')](_0x548ea4);}};}function respondWithFilteredResult(_0x21c5e6,_0x10bba2){return function(_0x29f047){if(_0x29f047){var _0x402f50=typeof _0x10bba2[_0x4048('0x1c')]===_0x4048('0x1d')&&typeof _0x10bba2[_0x4048('0x1e')]===_0x4048('0x1d');var _0x3df86a=_0x29f047[_0x4048('0x1f')];var _0x338908=_0x402f50?0x0:_0x10bba2[_0x4048('0x1c')];var _0x269a27=_0x402f50?_0x29f047[_0x4048('0x1f')]:_0x10bba2[_0x4048('0x1c')]+_0x10bba2[_0x4048('0x1e')];var _0x58639f;if(_0x269a27>=_0x3df86a){_0x269a27=_0x3df86a;_0x58639f=0xc8;}else{_0x58639f=0xce;}_0x21c5e6['status'](_0x58639f);return _0x21c5e6[_0x4048('0x20')](_0x4048('0x21'),_0x338908+'-'+_0x269a27+'/'+_0x3df86a)[_0x4048('0x1b')](_0x29f047);}return null;};}function patchUpdates(_0x1914ef){return function(_0x38bbba){try{jsonpatch[_0x4048('0x22')](_0x38bbba,_0x1914ef,!![]);}catch(_0x42a8ed){return BPromise['reject'](_0x42a8ed);}return _0x38bbba[_0x4048('0x23')]();};}function saveUpdates(_0x563e73,_0x3e5c1b){return function(_0x396056){if(_0x396056){return _0x396056[_0x4048('0x24')](_0x563e73)['then'](function(_0x31ac1f){return _0x31ac1f;});}return null;};}function removeEntity(_0x1304d1,_0x515a8c){return function(_0x497e89){if(_0x497e89){return _0x497e89[_0x4048('0x25')]()['then'](function(){_0x1304d1[_0x4048('0x19')](0xcc)[_0x4048('0x1a')]();});}};}function handleEntityNotFound(_0x1ad8de,_0x1f2d3f){return function(_0x3b484f){if(!_0x3b484f){_0x1ad8de[_0x4048('0x18')](0x194);}return _0x3b484f;};}function handleError(_0xdd459c,_0x20ed1c){_0x20ed1c=_0x20ed1c||0x1f4;return function(_0x1ccd5f){logger[_0x4048('0x26')](_0x1ccd5f[_0x4048('0x27')]);if(_0x1ccd5f[_0x4048('0x28')]){delete _0x1ccd5f[_0x4048('0x28')];}_0xdd459c[_0x4048('0x19')](_0x20ed1c)[_0x4048('0x29')](_0x1ccd5f);};}exports['index']=function(_0x153b67,_0x2602f9){var _0x73e062={},_0x2c3f3c={},_0x510cf8={'count':0x0,'rows':[]};var _0x4d1862=_['map'](db[_0x4048('0x2a')][_0x4048('0x2b')],function(_0x3b1941){return{'name':_0x3b1941[_0x4048('0x2c')],'type':_0x3b1941[_0x4048('0x2d')][_0x4048('0x2e')]};});_0x2c3f3c[_0x4048('0x2f')]=_[_0x4048('0x30')](_0x4d1862,_0x4048('0x28'));_0x2c3f3c[_0x4048('0x31')]=_[_0x4048('0x32')](_0x153b67[_0x4048('0x31')]);_0x2c3f3c['filters']=_[_0x4048('0x33')](_0x2c3f3c[_0x4048('0x2f')],_0x2c3f3c['query']);_0x73e062['attributes']=_[_0x4048('0x33')](_0x2c3f3c['model'],qs[_0x4048('0x34')](_0x153b67[_0x4048('0x31')][_0x4048('0x34')]));_0x73e062[_0x4048('0x35')]=_0x73e062[_0x4048('0x35')][_0x4048('0x36')]?_0x73e062['attributes']:_0x2c3f3c['model'];if(!_0x153b67[_0x4048('0x31')][_0x4048('0x37')](_0x4048('0x38'))){_0x73e062['limit']=qs[_0x4048('0x1e')](_0x153b67['query'][_0x4048('0x1e')]);_0x73e062['offset']=qs['offset'](_0x153b67['query'][_0x4048('0x1c')]);}_0x73e062[_0x4048('0x39')]=qs[_0x4048('0x3a')](_0x153b67['query'][_0x4048('0x3a')]);_0x73e062['where']=qs[_0x4048('0x3b')](_['pick'](_0x153b67[_0x4048('0x31')],_0x2c3f3c[_0x4048('0x3b')]),_0x4d1862);if(_0x153b67[_0x4048('0x31')][_0x4048('0x3c')]){_0x73e062['where']=_[_0x4048('0x3d')](_0x73e062[_0x4048('0x3e')],{'$or':_[_0x4048('0x30')](_0x4d1862,function(_0x4f03d5){if(_0x4f03d5[_0x4048('0x2d')]!==_0x4048('0x3f')){var _0x306a88={};_0x306a88[_0x4f03d5['name']]={'$like':'%'+_0x153b67[_0x4048('0x31')][_0x4048('0x3c')]+'%'};return _0x306a88;}})});}_0x73e062=_[_0x4048('0x3d')]({},_0x73e062,_0x153b67[_0x4048('0x40')]);var _0x525dca={'where':_0x73e062[_0x4048('0x3e')]};return db[_0x4048('0x2a')]['count'](_0x525dca)['then'](function(_0x56ee9b){_0x510cf8[_0x4048('0x1f')]=_0x56ee9b;if(_0x153b67[_0x4048('0x31')][_0x4048('0x41')]){_0x73e062['include']=[{'all':!![]}];}return db[_0x4048('0x2a')][_0x4048('0x42')](_0x73e062);})[_0x4048('0x43')](function(_0x373278){_0x510cf8[_0x4048('0x44')]=_0x373278;return _0x510cf8;})[_0x4048('0x43')](respondWithFilteredResult(_0x2602f9,_0x73e062))['catch'](handleError(_0x2602f9,null));};exports[_0x4048('0x45')]=function(_0x2502a1,_0x1d233d){var _0x2a74c7={'raw':!![],'where':{'id':_0x2502a1[_0x4048('0x46')]['id']}},_0x1e7243={};_0x1e7243[_0x4048('0x2f')]=_[_0x4048('0x32')](db[_0x4048('0x2a')][_0x4048('0x2b')]);_0x1e7243[_0x4048('0x31')]=_['keys'](_0x2502a1[_0x4048('0x31')]);_0x1e7243[_0x4048('0x3b')]=_[_0x4048('0x33')](_0x1e7243[_0x4048('0x2f')],_0x1e7243[_0x4048('0x31')]);_0x2a74c7[_0x4048('0x35')]=_[_0x4048('0x33')](_0x1e7243['model'],qs[_0x4048('0x34')](_0x2502a1[_0x4048('0x31')][_0x4048('0x34')]));_0x2a74c7[_0x4048('0x35')]=_0x2a74c7[_0x4048('0x35')][_0x4048('0x36')]?_0x2a74c7['attributes']:_0x1e7243[_0x4048('0x2f')];if(_0x2502a1[_0x4048('0x31')][_0x4048('0x41')]){_0x2a74c7[_0x4048('0x47')]=[{'all':!![]}];}_0x2a74c7=_[_0x4048('0x3d')]({},_0x2a74c7,_0x2502a1['options']);return db[_0x4048('0x2a')]['find'](_0x2a74c7)['then'](handleEntityNotFound(_0x1d233d,null))['then'](respondWithResult(_0x1d233d,null))[_0x4048('0x48')](handleError(_0x1d233d,null));};exports[_0x4048('0x49')]=function(_0x5a0626,_0x5bc722){return db[_0x4048('0x2a')][_0x4048('0x49')](_0x5a0626[_0x4048('0x4a')],{})['then'](respondWithResult(_0x5bc722,0xc9))[_0x4048('0x48')](handleError(_0x5bc722,null));};exports[_0x4048('0x24')]=function(_0x35cc3c,_0x2225e0){if(_0x35cc3c[_0x4048('0x4a')]['id']){delete _0x35cc3c[_0x4048('0x4a')]['id'];}return db[_0x4048('0x2a')][_0x4048('0x4b')]({'where':{'id':_0x35cc3c[_0x4048('0x46')]['id']}})['then'](handleEntityNotFound(_0x2225e0,null))['then'](saveUpdates(_0x35cc3c[_0x4048('0x4a')],null))[_0x4048('0x43')](respondWithResult(_0x2225e0,null))['catch'](handleError(_0x2225e0,null));};exports['destroy']=function(_0x4684cf,_0x4f20b3){return db[_0x4048('0x2a')][_0x4048('0x4b')]({'where':{'id':_0x4684cf[_0x4048('0x46')]['id']}})[_0x4048('0x43')](handleEntityNotFound(_0x4f20b3,null))[_0x4048('0x43')](removeEntity(_0x4f20b3,null))['catch'](handleError(_0x4f20b3,null));}; \ No newline at end of file +var _0xab2d=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','type','key','model','keys','intersection','attributes','query','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xf6bb7d,_0x8af4f5){var _0x132764=function(_0x4f6309){while(--_0x4f6309){_0xf6bb7d['push'](_0xf6bb7d['shift']());}};_0x132764(++_0x8af4f5);}(_0xab2d,0x119));var _0xdab2=function(_0x1f19da,_0xa9bcad){_0x1f19da=_0x1f19da-0x0;var _0x41515b=_0xab2d[_0x1f19da];return _0x41515b;};'use strict';var emlformat=require(_0xdab2('0x0'));var rimraf=require(_0xdab2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdab2('0x2'));var rp=require(_0xdab2('0x3'));var moment=require(_0xdab2('0x4'));var BPromise=require(_0xdab2('0x5'));var Mustache=require(_0xdab2('0x6'));var util=require(_0xdab2('0x7'));var path=require(_0xdab2('0x8'));var sox=require(_0xdab2('0x9'));var csv=require(_0xdab2('0xa'));var ejs=require(_0xdab2('0xb'));var fs=require('fs');var fs_extra=require(_0xdab2('0xc'));var _=require(_0xdab2('0xd'));var squel=require(_0xdab2('0xe'));var crypto=require(_0xdab2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xdab2('0x10'));var toCsv=require(_0xdab2('0xa'));var querystring=require('querystring');var Papa=require(_0xdab2('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdab2('0x12'));var hardwareService=require(_0xdab2('0x13'));var logger=require(_0xdab2('0x14'))(_0xdab2('0x15'));var utils=require(_0xdab2('0x16'));var config=require(_0xdab2('0x17'));var licenseUtil=require(_0xdab2('0x18'));var db=require(_0xdab2('0x19'))['db'];function respondWithStatusCode(_0x2eaf40,_0x41feba){_0x41feba=_0x41feba||0xcc;return function(_0x18779f){if(_0x18779f){return _0x2eaf40[_0xdab2('0x1a')](_0x41feba);}return _0x2eaf40[_0xdab2('0x1b')](_0x41feba)[_0xdab2('0x1c')]();};}function respondWithResult(_0x1a646d,_0x2f7c08){_0x2f7c08=_0x2f7c08||0xc8;return function(_0x4d59aa){if(_0x4d59aa){return _0x1a646d[_0xdab2('0x1b')](_0x2f7c08)['json'](_0x4d59aa);}};}function respondWithFilteredResult(_0x59d602,_0x166908){return function(_0x3135fd){if(_0x3135fd){var _0xb28f97=typeof _0x166908[_0xdab2('0x1d')]===_0xdab2('0x1e')&&typeof _0x166908[_0xdab2('0x1f')]===_0xdab2('0x1e');var _0x4b05b9=_0x3135fd[_0xdab2('0x20')];var _0x416d38=_0xb28f97?0x0:_0x166908[_0xdab2('0x1d')];var _0x34ee9d=_0xb28f97?_0x3135fd[_0xdab2('0x20')]:_0x166908['offset']+_0x166908['limit'];var _0x337a6e;if(_0x34ee9d>=_0x4b05b9){_0x34ee9d=_0x4b05b9;_0x337a6e=0xc8;}else{_0x337a6e=0xce;}_0x59d602['status'](_0x337a6e);return _0x59d602['set'](_0xdab2('0x21'),_0x416d38+'-'+_0x34ee9d+'/'+_0x4b05b9)['json'](_0x3135fd);}return null;};}function patchUpdates(_0x5c0551){return function(_0x7545fd){try{jsonpatch['apply'](_0x7545fd,_0x5c0551,!![]);}catch(_0x4cb212){return BPromise[_0xdab2('0x22')](_0x4cb212);}return _0x7545fd[_0xdab2('0x23')]();};}function saveUpdates(_0x571751,_0x5ccca5){return function(_0x40bd53){if(_0x40bd53){return _0x40bd53[_0xdab2('0x24')](_0x571751)['then'](function(_0x3b45be){return _0x3b45be;});}return null;};}function removeEntity(_0x4dded7,_0x4bd85b){return function(_0x4b08a3){if(_0x4b08a3){return _0x4b08a3[_0xdab2('0x25')]()['then'](function(){_0x4dded7['status'](0xcc)[_0xdab2('0x1c')]();});}};}function handleEntityNotFound(_0x293855,_0x19fb5a){return function(_0x470907){if(!_0x470907){_0x293855[_0xdab2('0x1a')](0x194);}return _0x470907;};}function handleError(_0x271535,_0x1939a8){_0x1939a8=_0x1939a8||0x1f4;return function(_0x2f5ace){logger[_0xdab2('0x26')](_0x2f5ace[_0xdab2('0x27')]);if(_0x2f5ace[_0xdab2('0x28')]){delete _0x2f5ace[_0xdab2('0x28')];}_0x271535['status'](_0x1939a8)[_0xdab2('0x29')](_0x2f5ace);};}exports['index']=function(_0x357bce,_0xfa4ed2){var _0x7d6eca={},_0xa7974d={},_0x2e9283={'count':0x0,'rows':[]};var _0x1ac4eb=_[_0xdab2('0x2a')](db[_0xdab2('0x2b')][_0xdab2('0x2c')],function(_0x5e7953){return{'name':_0x5e7953['fieldName'],'type':_0x5e7953[_0xdab2('0x2d')][_0xdab2('0x2e')]};});_0xa7974d[_0xdab2('0x2f')]=_[_0xdab2('0x2a')](_0x1ac4eb,_0xdab2('0x28'));_0xa7974d['query']=_[_0xdab2('0x30')](_0x357bce['query']);_0xa7974d['filters']=_[_0xdab2('0x31')](_0xa7974d[_0xdab2('0x2f')],_0xa7974d['query']);_0x7d6eca[_0xdab2('0x32')]=_[_0xdab2('0x31')](_0xa7974d[_0xdab2('0x2f')],qs['fields'](_0x357bce[_0xdab2('0x33')][_0xdab2('0x34')]));_0x7d6eca['attributes']=_0x7d6eca[_0xdab2('0x32')]['length']?_0x7d6eca[_0xdab2('0x32')]:_0xa7974d[_0xdab2('0x2f')];if(!_0x357bce[_0xdab2('0x33')][_0xdab2('0x35')](_0xdab2('0x36'))){_0x7d6eca[_0xdab2('0x1f')]=qs[_0xdab2('0x1f')](_0x357bce[_0xdab2('0x33')][_0xdab2('0x1f')]);_0x7d6eca[_0xdab2('0x1d')]=qs[_0xdab2('0x1d')](_0x357bce[_0xdab2('0x33')]['offset']);}_0x7d6eca[_0xdab2('0x37')]=qs[_0xdab2('0x38')](_0x357bce['query']['sort']);_0x7d6eca['where']=qs['filters'](_[_0xdab2('0x39')](_0x357bce['query'],_0xa7974d['filters']),_0x1ac4eb);if(_0x357bce[_0xdab2('0x33')][_0xdab2('0x3a')]){_0x7d6eca[_0xdab2('0x3b')]=_[_0xdab2('0x3c')](_0x7d6eca[_0xdab2('0x3b')],{'$or':_[_0xdab2('0x2a')](_0x1ac4eb,function(_0x40560b){if(_0x40560b[_0xdab2('0x2d')]!==_0xdab2('0x3d')){var _0x259e1c={};_0x259e1c[_0x40560b[_0xdab2('0x28')]]={'$like':'%'+_0x357bce[_0xdab2('0x33')][_0xdab2('0x3a')]+'%'};return _0x259e1c;}})});}_0x7d6eca=_[_0xdab2('0x3c')]({},_0x7d6eca,_0x357bce[_0xdab2('0x3e')]);var _0x3b32b0={'where':_0x7d6eca[_0xdab2('0x3b')]};return db[_0xdab2('0x2b')][_0xdab2('0x20')](_0x3b32b0)[_0xdab2('0x3f')](function(_0x4c1751){_0x2e9283[_0xdab2('0x20')]=_0x4c1751;if(_0x357bce[_0xdab2('0x33')][_0xdab2('0x40')]){_0x7d6eca[_0xdab2('0x41')]=[{'all':!![]}];}return db[_0xdab2('0x2b')][_0xdab2('0x42')](_0x7d6eca);})[_0xdab2('0x3f')](function(_0xa655a4){_0x2e9283[_0xdab2('0x43')]=_0xa655a4;return _0x2e9283;})['then'](respondWithFilteredResult(_0xfa4ed2,_0x7d6eca))[_0xdab2('0x44')](handleError(_0xfa4ed2,null));};exports[_0xdab2('0x45')]=function(_0x3be724,_0x13fc0a){var _0x651eeb={'raw':!![],'where':{'id':_0x3be724[_0xdab2('0x46')]['id']}},_0x55d6a7={};_0x55d6a7[_0xdab2('0x2f')]=_['keys'](db[_0xdab2('0x2b')][_0xdab2('0x2c')]);_0x55d6a7['query']=_['keys'](_0x3be724[_0xdab2('0x33')]);_0x55d6a7[_0xdab2('0x47')]=_[_0xdab2('0x31')](_0x55d6a7[_0xdab2('0x2f')],_0x55d6a7[_0xdab2('0x33')]);_0x651eeb[_0xdab2('0x32')]=_[_0xdab2('0x31')](_0x55d6a7['model'],qs['fields'](_0x3be724[_0xdab2('0x33')][_0xdab2('0x34')]));_0x651eeb[_0xdab2('0x32')]=_0x651eeb['attributes'][_0xdab2('0x48')]?_0x651eeb[_0xdab2('0x32')]:_0x55d6a7[_0xdab2('0x2f')];if(_0x3be724[_0xdab2('0x33')][_0xdab2('0x40')]){_0x651eeb['include']=[{'all':!![]}];}_0x651eeb=_[_0xdab2('0x3c')]({},_0x651eeb,_0x3be724[_0xdab2('0x3e')]);return db[_0xdab2('0x2b')][_0xdab2('0x49')](_0x651eeb)[_0xdab2('0x3f')](handleEntityNotFound(_0x13fc0a,null))['then'](respondWithResult(_0x13fc0a,null))['catch'](handleError(_0x13fc0a,null));};exports[_0xdab2('0x4a')]=function(_0x562065,_0x1df946){return db['SmsApplication'][_0xdab2('0x4a')](_0x562065[_0xdab2('0x4b')],{})[_0xdab2('0x3f')](respondWithResult(_0x1df946,0xc9))[_0xdab2('0x44')](handleError(_0x1df946,null));};exports[_0xdab2('0x24')]=function(_0x384d78,_0x42cdde){if(_0x384d78[_0xdab2('0x4b')]['id']){delete _0x384d78[_0xdab2('0x4b')]['id'];}return db[_0xdab2('0x2b')][_0xdab2('0x49')]({'where':{'id':_0x384d78[_0xdab2('0x46')]['id']}})[_0xdab2('0x3f')](handleEntityNotFound(_0x42cdde,null))['then'](saveUpdates(_0x384d78['body'],null))['then'](respondWithResult(_0x42cdde,null))[_0xdab2('0x44')](handleError(_0x42cdde,null));};exports[_0xdab2('0x25')]=function(_0xb2be34,_0x9c416c){return db[_0xdab2('0x2b')][_0xdab2('0x49')]({'where':{'id':_0xb2be34[_0xdab2('0x46')]['id']}})[_0xdab2('0x3f')](handleEntityNotFound(_0x9c416c,null))[_0xdab2('0x3f')](removeEntity(_0x9c416c,null))[_0xdab2('0x44')](handleError(_0x9c416c,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b7c02a1..28e4305 100644 --- a/server/api/smsApplication/smsApplication.model.js +++ b/server/api/smsApplication/smsApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11b2=['sms_applications','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','SmsApplication'];(function(_0x15dec0,_0x274647){var _0x3d102b=function(_0x54d676){while(--_0x54d676){_0x15dec0['push'](_0x15dec0['shift']());}};_0x3d102b(++_0x274647);}(_0x11b2,0xd2));var _0x211b=function(_0x14cb8d,_0x1d61e0){_0x14cb8d=_0x14cb8d-0x0;var _0x3fac10=_0x11b2[_0x14cb8d];return _0x3fac10;};'use strict';var _=require(_0x211b('0x0'));var util=require('util');var logger=require(_0x211b('0x1'))('api');var moment=require(_0x211b('0x2'));var BPromise=require(_0x211b('0x3'));var rp=require(_0x211b('0x4'));var fs=require('fs');var path=require(_0x211b('0x5'));var rimraf=require('rimraf');var config=require(_0x211b('0x6'));var attributes=require(_0x211b('0x7'));module[_0x211b('0x8')]=function(_0x48a4df,_0x3aca46){return _0x48a4df['define'](_0x211b('0x9'),attributes,{'tableName':_0x211b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1354=['rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13bea0,_0x210a0c){var _0x3f12df=function(_0x11ef1c){while(--_0x11ef1c){_0x13bea0['push'](_0x13bea0['shift']());}};_0x3f12df(++_0x210a0c);}(_0x1354,0x95));var _0x4135=function(_0x454589,_0x3e852e){_0x454589=_0x454589-0x0;var _0x468c5c=_0x1354[_0x454589];return _0x468c5c;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var logger=require(_0x4135('0x2'))(_0x4135('0x3'));var moment=require(_0x4135('0x4'));var BPromise=require(_0x4135('0x5'));var rp=require(_0x4135('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4135('0x7'));var config=require(_0x4135('0x8'));var attributes=require(_0x4135('0x9'));module['exports']=function(_0x14ff47,_0x2bcd68){return _0x14ff47['define'](_0x4135('0xa'),attributes,{'tableName':_0x4135('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4135('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index fbcf774..1a13292 100644 --- a/server/api/smsApplication/smsApplication.rpc.js +++ b/server/api/smsApplication/smsApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x337f=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x147e0a,_0x1836ff){var _0x258532=function(_0x3216c0){while(--_0x3216c0){_0x147e0a['push'](_0x147e0a['shift']());}};_0x258532(++_0x1836ff);}(_0x337f,0x11c));var _0xf337=function(_0x1f43a6,_0x257d2f){_0x1f43a6=_0x1f43a6-0x0;var _0x5eed9e=_0x337f[_0x1f43a6];return _0x5eed9e;};'use strict';var _=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var moment=require(_0xf337('0x2'));var BPromise=require('bluebird');var rs=require(_0xf337('0x3'));var fs=require('fs');var Redis=require(_0xf337('0x4'));var db=require(_0xf337('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf337('0x6'))(_0xf337('0x7'));var config=require('../../config/environment');var jayson=require(_0xf337('0x8'));var client=jayson['client'][_0xf337('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ae4d6,_0x2be604,_0x56bd39){return new BPromise(function(_0x4b80a2,_0x1f0a95){return client[_0xf337('0xa')](_0x5ae4d6,_0x56bd39)[_0xf337('0xb')](function(_0x2a4619){logger[_0xf337('0xc')](_0xf337('0xd'),_0x2be604,_0xf337('0xe'));logger[_0xf337('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2be604,_0xf337('0xe'),JSON[_0xf337('0x10')](_0x2a4619));if(_0x2a4619[_0xf337('0x11')]){if(_0x2a4619[_0xf337('0x11')][_0xf337('0x12')]===0x1f4){logger[_0xf337('0x11')](_0xf337('0xd'),_0x2be604,_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);return _0x1f0a95(_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);}logger[_0xf337('0x11')]('SmsApplication,\x20%s,\x20%s',_0x2be604,_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);return _0x4b80a2(_0x2a4619[_0xf337('0x11')]['message']);}else{logger[_0xf337('0xc')](_0xf337('0xd'),_0x2be604,'request\x20sent');_0x4b80a2(_0x2a4619[_0xf337('0x14')][_0xf337('0x13')]);}})[_0xf337('0x15')](function(_0x4a7e4c){logger[_0xf337('0x11')]('SmsApplication,\x20%s,\x20%s',_0x2be604,_0x4a7e4c);_0x1f0a95(_0x4a7e4c);});});} \ No newline at end of file +var _0xd1f1=['request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5337ed,_0x5a8f8c){var _0x1181b0=function(_0x57c202){while(--_0x57c202){_0x5337ed['push'](_0x5337ed['shift']());}};_0x1181b0(++_0x5a8f8c);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x548e1d,_0x3534d3){_0x548e1d=_0x548e1d-0x0;var _0x398584=_0xd1f1[_0x548e1d];return _0x398584;};'use strict';var _=require(_0x1d1f('0x0'));var util=require(_0x1d1f('0x1'));var moment=require('moment');var BPromise=require(_0x1d1f('0x2'));var rs=require(_0x1d1f('0x3'));var fs=require('fs');var Redis=require(_0x1d1f('0x4'));var db=require(_0x1d1f('0x5'))['db'];var utils=require(_0x1d1f('0x6'));var logger=require(_0x1d1f('0x7'))(_0x1d1f('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d1f('0x9'));var client=jayson[_0x1d1f('0xa')][_0x1d1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x188cc3,_0x30a1f2,_0x5228f4){return new BPromise(function(_0x4836b3,_0x4d9d5e){return client[_0x1d1f('0xc')](_0x188cc3,_0x5228f4)[_0x1d1f('0xd')](function(_0xfae470){logger[_0x1d1f('0xe')]('SmsApplication,\x20%s,\x20%s',_0x30a1f2,_0x1d1f('0xf'));logger[_0x1d1f('0x10')](_0x1d1f('0x11'),_0x30a1f2,_0x1d1f('0xf'),JSON[_0x1d1f('0x12')](_0xfae470));if(_0xfae470['error']){if(_0xfae470['error'][_0x1d1f('0x13')]===0x1f4){logger[_0x1d1f('0x14')]('SmsApplication,\x20%s,\x20%s',_0x30a1f2,_0xfae470[_0x1d1f('0x14')][_0x1d1f('0x15')]);return _0x4d9d5e(_0xfae470[_0x1d1f('0x14')][_0x1d1f('0x15')]);}logger['error'](_0x1d1f('0x16'),_0x30a1f2,_0xfae470[_0x1d1f('0x14')][_0x1d1f('0x15')]);return _0x4836b3(_0xfae470[_0x1d1f('0x14')][_0x1d1f('0x15')]);}else{logger[_0x1d1f('0xe')](_0x1d1f('0x16'),_0x30a1f2,_0x1d1f('0xf'));_0x4836b3(_0xfae470[_0x1d1f('0x17')][_0x1d1f('0x15')]);}})[_0x1d1f('0x18')](function(_0xf9fb3c){logger[_0x1d1f('0x14')](_0x1d1f('0x16'),_0x30a1f2,_0xf9fb3c);_0x4d9d5e(_0xf9fb3c);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index ef58694..86cda23 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1eba=['put','/:id','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x25bb4c,_0x1a0b53){var _0x4c78b2=function(_0x437620){while(--_0x437620){_0x25bb4c['push'](_0x25bb4c['shift']());}};_0x4c78b2(++_0x1a0b53);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x1eba[_0x490be3];return _0x3f5140;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1eb('0x5'));var interaction=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var controller=require(_0xa1eb('0x8'));router[_0xa1eb('0x9')]('/',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xb')]);router[_0xa1eb('0x9')](_0xa1eb('0xc'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xd')]);router[_0xa1eb('0x9')]('/:id',auth[_0xa1eb('0xa')](),controller['show']);router[_0xa1eb('0x9')]('/:id/messages',auth[_0xa1eb('0xa')](),controller['getMessages']);router[_0xa1eb('0x9')]('/:id/download',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xe')]);router[_0xa1eb('0xf')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router[_0xa1eb('0xf')]('/:id/messages',auth[_0xa1eb('0xa')](),controller['addMessage']);router['post'](_0xa1eb('0x11'),auth['isAuthenticated'](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),_0xa1eb('0x14')),controller[_0xa1eb('0x15')]);router[_0xa1eb('0x16')](_0xa1eb('0x17'),auth[_0xa1eb('0xa')](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),'smsinteraction:update'),controller[_0xa1eb('0x18')]);router['delete'](_0xa1eb('0x17'),auth[_0xa1eb('0xa')](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),'smsinteraction:destroy'),controller[_0xa1eb('0x19')]);router[_0xa1eb('0x1a')](_0xa1eb('0x11'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0x1b')]);module[_0xa1eb('0x1c')]=router; \ No newline at end of file +var _0x0713=['put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','smsinteraction:addtags','addTags'];(function(_0x1858e8,_0x293115){var _0xf67db0=function(_0x3d8a66){while(--_0x3d8a66){_0x1858e8['push'](_0x1858e8['shift']());}};_0xf67db0(++_0x293115);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/download',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x11')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['post']('/:id/messages',auth[_0x3071('0x9')](),controller['addMessage']);router[_0x3071('0x11')](_0x3071('0x13'),auth['isAuthenticated'](),interaction[_0x3071('0x14')]('sms',_0x3071('0x15')),controller[_0x3071('0x16')]);router[_0x3071('0x17')](_0x3071('0xd'),auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x19')),controller[_0x3071('0x1a')]);router[_0x3071('0x1b')]('/:id',auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x1c')),controller[_0x3071('0x1d')]);router[_0x3071('0x1b')](_0x3071('0x13'),auth[_0x3071('0x9')](),controller['removeTags']);module[_0x3071('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 8426119..5ec532d 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2675=['ENUM','out','sequelize','DATE','STRING'];(function(_0xefb4e,_0xe56689){var _0x36c78c=function(_0x158fe3){while(--_0x158fe3){_0xefb4e['push'](_0xefb4e['shift']());}};_0x36c78c(++_0xe56689);}(_0x2675,0x75));var _0x5267=function(_0x421ccc,_0x35993e){_0x421ccc=_0x421ccc-0x0;var _0x969708=_0x2675[_0x421ccc];return _0x969708;};'use strict';var Sequelize=require(_0x5267('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5267('0x1')]},'disposition':{'type':Sequelize[_0x5267('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5267('0x2')]},'note':{'type':Sequelize[_0x5267('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5267('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x5267('0x3')]('in',_0x5267('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5267('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x5267('0x3')]('in',_0x5267('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8110=['STRING','DATE','ENUM','out','BOOLEAN','moment'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x8110,0x185));var _0x0811=function(_0x4a2874,_0xead3ad){_0x4a2874=_0x4a2874-0x0;var _0x353601=_0x8110[_0x4a2874];return _0x353601;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0811('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0811('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0811('0x1')]},'note':{'type':Sequelize[_0x0811('0x1')]},'phone':{'type':Sequelize[_0x0811('0x1')]},'read1stAt':{'type':Sequelize[_0x0811('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x0811('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0811('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0811('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0811('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 1b85b26..4187d1b 100644 --- a/server/api/smsInteraction/smsInteraction.controller.js +++ b/server/api/smsInteraction/smsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0f3=['rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','SmsInteraction','rawAttributes','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','compact','forEach','SmsAccountId','concat','createdAt','parse','$gte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.SmsInteractionId\x20IN\x20?','all','rows','show','params','includeAll','include','options','create','body','describe','addMessage','SmsMessage','ids','getMessages','findOne','SmsInteractionId','format','findAll','addTags','setTags','emit','smsInteractionTags:save','removeTags','download','server','files','root','attachments','transcript-%d-%s.zip','push','CmContact','firstName','lastName','Messages','secret','SmsAccount','Account','get','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','direction','out','System','renderFile','join','transcript-','err'];(function(_0x1e8f29,_0x44ad00){var _0x21fb45=function(_0x4819bf){while(--_0x4819bf){_0x1e8f29['push'](_0x1e8f29['shift']());}};_0x21fb45(++_0x44ad00);}(_0xc0f3,0x1d8));var _0x3c0f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc0f3[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c0f('0x0'));var zipdir=require(_0x3c0f('0x1'));var jsonpatch=require(_0x3c0f('0x2'));var rp=require('request-promise');var moment=require(_0x3c0f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3c0f('0x4'));var path=require(_0x3c0f('0x5'));var sox=require(_0x3c0f('0x6'));var csv=require(_0x3c0f('0x7'));var ejs=require(_0x3c0f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c0f('0x9'));var squel=require(_0x3c0f('0xa'));var crypto=require(_0x3c0f('0xb'));var jsforce=require(_0x3c0f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c0f('0x7'));var querystring=require(_0x3c0f('0xd'));var Papa=require(_0x3c0f('0xe'));var Redis=require(_0x3c0f('0xf'));var authService=require(_0x3c0f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3c0f('0x11'));var pdf=require(_0x3c0f('0x12'));var hardwareService=require(_0x3c0f('0x13'));var logger=require(_0x3c0f('0x14'))('api');var utils=require(_0x3c0f('0x15'));var config=require(_0x3c0f('0x16'));var licenseUtil=require(_0x3c0f('0x17'));var db=require(_0x3c0f('0x18'))['db'];config[_0x3c0f('0x19')]=_[_0x3c0f('0x1a')](config['redis'],{'host':_0x3c0f('0x1b'),'port':0x18eb});var socket=require(_0x3c0f('0x1c'))(new Redis(config['redis']));require(_0x3c0f('0x1d'))[_0x3c0f('0x1e')](socket);function respondWithStatusCode(_0xbfbf3d,_0x48846d){_0x48846d=_0x48846d||0xcc;return function(_0x5be32c){if(_0x5be32c){return _0xbfbf3d[_0x3c0f('0x1f')](_0x48846d);}return _0xbfbf3d[_0x3c0f('0x20')](_0x48846d)['end']();};}function respondWithResult(_0x226d5b,_0x2b3be3){_0x2b3be3=_0x2b3be3||0xc8;return function(_0xc014ae){if(_0xc014ae){return _0x226d5b[_0x3c0f('0x20')](_0x2b3be3)[_0x3c0f('0x21')](_0xc014ae);}};}function respondWithFilteredResult(_0x56e3be,_0x58a79c){return function(_0x19263e){if(_0x19263e){var _0x3b311f=typeof _0x58a79c['offset']==='undefined'&&typeof _0x58a79c['limit']===_0x3c0f('0x22');var _0x2e952f=_0x19263e[_0x3c0f('0x23')];var _0x53ad8a=_0x3b311f?0x0:_0x58a79c[_0x3c0f('0x24')];var _0x4ff754=_0x3b311f?_0x19263e['count']:_0x58a79c[_0x3c0f('0x24')]+_0x58a79c[_0x3c0f('0x25')];var _0x526936;if(_0x4ff754>=_0x2e952f){_0x4ff754=_0x2e952f;_0x526936=0xc8;}else{_0x526936=0xce;}_0x56e3be[_0x3c0f('0x20')](_0x526936);return _0x56e3be[_0x3c0f('0x26')](_0x3c0f('0x27'),_0x53ad8a+'-'+_0x4ff754+'/'+_0x2e952f)[_0x3c0f('0x21')](_0x19263e);}return null;};}function patchUpdates(_0x1d679e){return function(_0x49c0c3){try{jsonpatch[_0x3c0f('0x28')](_0x49c0c3,_0x1d679e,!![]);}catch(_0x375911){return BPromise[_0x3c0f('0x29')](_0x375911);}return _0x49c0c3[_0x3c0f('0x2a')]();};}function saveUpdates(_0x1217ed,_0x359682){return function(_0x1c41be){if(_0x1c41be){return _0x1c41be[_0x3c0f('0x2b')](_0x1217ed)[_0x3c0f('0x2c')](function(_0x3b0ec3){return _0x3b0ec3;});}return null;};}function removeEntity(_0x288a8b,_0x33071a){return function(_0x10b805){if(_0x10b805){return _0x10b805[_0x3c0f('0x2d')]()[_0x3c0f('0x2c')](function(){_0x288a8b[_0x3c0f('0x20')](0xcc)[_0x3c0f('0x2e')]();});}};}function handleEntityNotFound(_0x140c6d,_0x4012b1){return function(_0x2f85bd){if(!_0x2f85bd){_0x140c6d[_0x3c0f('0x1f')](0x194);}return _0x2f85bd;};}function handleError(_0x370281,_0x584ec6){_0x584ec6=_0x584ec6||0x1f4;return function(_0x48ab47){logger[_0x3c0f('0x2f')](_0x48ab47[_0x3c0f('0x30')]);if(_0x48ab47[_0x3c0f('0x31')]){delete _0x48ab47[_0x3c0f('0x31')];}_0x370281[_0x3c0f('0x20')](_0x584ec6)[_0x3c0f('0x32')](_0x48ab47);};}function getInteractionUsers(_0x1a2af3,_0x53e57d){return new BPromise(function(_0x5d68ea,_0x1bae89){try{if(_0x53e57d[_0x1a2af3['id']]){_0x1a2af3[_0x3c0f('0x33')]=_[_0x3c0f('0x34')](_0x53e57d[_0x1a2af3['id']],function(_0x502d2b){return{'id':_0x502d2b['id'],'fullname':_0x502d2b[_0x3c0f('0x35')]};});}}catch(_0x40384d){_0x1bae89(_0x40384d);}_0x5d68ea(_0x1a2af3);});}function getInteractionTags(_0x290c6a,_0x4222a3){return new BPromise(function(_0x56e270,_0x24a60b){try{if(_0x290c6a[_0x3c0f('0x36')]){_0x290c6a[_0x3c0f('0x37')]=[];_0x290c6a['TagIds'][_0x3c0f('0x38')](',')['forEach'](function(_0x765fd0){_0x290c6a['Tags']['push'](_0x4222a3[_0x765fd0]);});}delete _0x290c6a[_0x3c0f('0x36')];}catch(_0x13724c){_0x24a60b(_0x13724c);}_0x56e270(_0x290c6a);});}function updateSmsInteraction(_0x3536a5,_0x489e4c,_0x1682c6){return new BPromise(function(_0x5c2633,_0x10b471){return getInteractionUsers(_0x3536a5,_0x1682c6)[_0x3c0f('0x2c')](function(_0x44d035){return getInteractionTags(_0x44d035,_0x489e4c);})['then'](function(_0x1febc1){return getStateInteraction(_0x1febc1);})[_0x3c0f('0x2c')](function(_0x4a4fd3){_0x5c2633(_0x4a4fd3);})[_0x3c0f('0x39')](function(_0x1d567a){_0x10b471(_0x1d567a);});});}function getStateInteraction(_0x2e6e05){return new BPromise(function(_0x4d4319){_0x2e6e05[_0x3c0f('0x3a')]=0x0;_0x2e6e05[_0x3c0f('0x3b')]=0x0;_0x2e6e05[_0x3c0f('0x3c')]=0x0;_0x2e6e05['unmanaged']=0x0;_0x2e6e05[_0x3c0f('0x3d')]=0x0;if(!_0x2e6e05[_0x3c0f('0x3e')]&&!_0x2e6e05[_0x3c0f('0x3f')]){_0x2e6e05[_0x3c0f('0x3a')]+=0x1;}if(!_0x2e6e05[_0x3c0f('0x3e')]&&_0x2e6e05[_0x3c0f('0x3f')]){_0x2e6e05['talking']+=0x1;if(_0x2e6e05[_0x3c0f('0x3a')]){_0x2e6e05[_0x3c0f('0x3a')]-=0x1;}}if(_0x2e6e05[_0x3c0f('0x3e')]&&_0x2e6e05[_0x3c0f('0x3f')]){_0x2e6e05[_0x3c0f('0x3c')]+=0x1;if(_0x2e6e05[_0x3c0f('0x3b')]){_0x2e6e05[_0x3c0f('0x3b')]-=0x1;}}if(_0x2e6e05['closed']&&!_0x2e6e05['UserId']){_0x2e6e05[_0x3c0f('0x40')]+=0x1;if(_0x2e6e05[_0x3c0f('0x3a')]){_0x2e6e05[_0x3c0f('0x3a')]-=0x1;}}_0x2e6e05[_0x3c0f('0x3d')]+=0x1;_0x4d4319(_0x2e6e05);});}exports[_0x3c0f('0x41')]=function(_0x4680ba,_0x88995){var _0x449689={},_0x42ac94={},_0x14b3af={'count':0x0,'rows':[]};var _0x53a5e7=_[_0x3c0f('0x34')](db[_0x3c0f('0x42')][_0x3c0f('0x43')],function(_0x4a97ba){return{'name':_0x4a97ba['fieldName'],'type':_0x4a97ba['type'][_0x3c0f('0x44')]};});_0x42ac94[_0x3c0f('0x45')]=_[_0x3c0f('0x34')](_0x53a5e7,_0x3c0f('0x31'));_0x42ac94['query']=_[_0x3c0f('0x46')](_0x4680ba['query']);_0x42ac94[_0x3c0f('0x47')]=_['intersection'](_0x42ac94[_0x3c0f('0x45')],_0x42ac94[_0x3c0f('0x48')]);_0x449689[_0x3c0f('0x49')]=_[_0x3c0f('0x4a')](_0x42ac94[_0x3c0f('0x45')],qs[_0x3c0f('0x4b')](_0x4680ba['query']['fields']));_0x449689[_0x3c0f('0x49')]=_0x449689[_0x3c0f('0x49')][_0x3c0f('0x4c')]?_0x449689[_0x3c0f('0x49')]:_0x42ac94[_0x3c0f('0x45')];if(!_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x4d')](_0x3c0f('0x4e'))){_0x449689[_0x3c0f('0x25')]=qs[_0x3c0f('0x25')](_0x4680ba[_0x3c0f('0x48')]['limit']);_0x449689[_0x3c0f('0x24')]=qs[_0x3c0f('0x24')](_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x24')]);}_0x449689[_0x3c0f('0x4f')]=qs[_0x3c0f('0x50')](_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x50')]);_0x449689[_0x3c0f('0x51')]=qs[_0x3c0f('0x47')](_[_0x3c0f('0x52')](_0x4680ba[_0x3c0f('0x48')],_0x42ac94[_0x3c0f('0x47')]),_0x53a5e7);var _0x319c46=[];var _0x5f3289=squel[_0x3c0f('0x53')]()['field']('id')[_0x3c0f('0x54')](_0x3c0f('0x31'))[_0x3c0f('0x54')]('color')[_0x3c0f('0x55')](_0x3c0f('0x56'));var _0x283e2f=squel['select']()[_0x3c0f('0x54')](_0x3c0f('0x57'))[_0x3c0f('0x54')]('u.fullname')[_0x3c0f('0x54')](_0x3c0f('0x58'))[_0x3c0f('0x55')](_0x3c0f('0x59'),'ui')[_0x3c0f('0x5a')](_0x3c0f('0x5b'),'u',_0x3c0f('0x5c'));var _0x4a08ff=squel[_0x3c0f('0x53')]()['from'](_0x3c0f('0x5d'),'i')[_0x3c0f('0x5a')]('cm_contacts','c',_0x3c0f('0x5e'))[_0x3c0f('0x5a')](_0x3c0f('0x5b'),'o',_0x3c0f('0x5f'))[_0x3c0f('0x5a')](_0x3c0f('0x60'),'a',_0x3c0f('0x61'))[_0x3c0f('0x5a')](_0x3c0f('0x62'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x3c0f('0x5a')](_0x3c0f('0x63'),'it',_0x3c0f('0x64'))[_0x3c0f('0x5a')](_0x3c0f('0x56'),'t',_0x3c0f('0x65'));var _0x53d8c7=squel[_0x3c0f('0x66')]();var _0x2f9457=[];var _0x541edf=squel[_0x3c0f('0x66')]();var _0x40f2c0;if(_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x67')]){_0x40f2c0=as[_0x3c0f('0x68')](_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x67')]);var _0x82396a=_0x40f2c0[_0x3c0f('0x69')];for(var _0x4a418c=0x0;_0x4a418c<_0x40f2c0[_0x3c0f('0x6a')][_0x3c0f('0x4c')];_0x4a418c++){var _0x5ae606=_0x40f2c0[_0x3c0f('0x6a')][_0x4a418c];var _0xe87b88='i';var _0x43fb6e=_[_0x3c0f('0x6b')](_0x53a5e7,['name',_0x5ae606[_0x3c0f('0x54')]]);if(!_0x43fb6e){switch(_0x5ae606[_0x3c0f('0x54')]){case _0x3c0f('0x6c'):if(_0x5ae606['value']==0x1){_0x4a08ff['having']('`'+_0x5ae606[_0x3c0f('0x54')]+_0x3c0f('0x6d'));}else{_0x4a08ff[_0x3c0f('0x6e')]('`'+_0x5ae606[_0x3c0f('0x54')]+_0x3c0f('0x6f'));}break;case _0x3c0f('0x70'):if(_0x5ae606['operator']==='$substring'){if(_0x5ae606[_0x3c0f('0x71')]['split']('\x20')['length']>0x1){_0x53d8c7[_0x82396a](_0x3c0f('0x72'),qs[_0x3c0f('0x73')](_0x5ae606[_0x3c0f('0x71')]),null);}else{var _0x3b076a='%'+_0x5ae606['value']+'%';_0x53d8c7[_0x82396a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3b076a,_0x3b076a,_0x3b076a);}}else{_0x43fb6e=_['find'](_0x53a5e7,[_0x3c0f('0x31'),_0x3c0f('0x74')]);_0x5ae606['field']=_0x3c0f('0x74');_0x1ed448=as['buildExpression'](_0xe87b88,_0x43fb6e[_0x3c0f('0x75')],_0x5ae606);_0x53d8c7[_0x82396a](_0x1ed448[_0x3c0f('0x76')],_0x1ed448[_0x3c0f('0x71')][_0x3c0f('0x77')],_0x1ed448['value'][_0x3c0f('0x2e')]);}break;case _0x3c0f('0x78'):var _0x4e4a3c=_0x5ae606[_0x3c0f('0x71')][_0x3c0f('0x38')](',')['map'](function(_0x59872f){return Number(_0x59872f);});_0x4e4a3c['forEach'](function(_0x2c036b){_0x541edf['or'](_0x3c0f('0x79'),'%,'+_0x2c036b+',%');});_0x2f9457=_[_0x3c0f('0x7a')](_0x2f9457,_0x4e4a3c);break;case _0x3c0f('0x7b'):if(_0x5ae606[_0x3c0f('0x7c')]==='$substring'){_0x53d8c7[_0x82396a](_0x3c0f('0x7d'),'%'+_0x5ae606[_0x3c0f('0x71')]+'%',null);}else{_0x43fb6e=_[_0x3c0f('0x6b')](_0x53a5e7,[_0x3c0f('0x31'),_0x3c0f('0x3f')]);_0x5ae606['field']=_0x3c0f('0x3f');_0x1ed448=as[_0x3c0f('0x7e')](_0xe87b88,_0x43fb6e[_0x3c0f('0x75')],_0x5ae606);_0x53d8c7[_0x82396a](_0x1ed448[_0x3c0f('0x76')],_0x1ed448[_0x3c0f('0x71')]['start'],_0x1ed448['value'][_0x3c0f('0x2e')]);}break;case'body':_0x1ed448=as[_0x3c0f('0x7e')]('me',null,_0x5ae606);_0x53d8c7[_0x82396a](_0x1ed448[_0x3c0f('0x76')],_0x1ed448['value']['start'],_0x1ed448['value'][_0x3c0f('0x2e')]);break;}}else{var _0x1ed448=as[_0x3c0f('0x7e')](_0xe87b88,_0x43fb6e[_0x3c0f('0x75')],_0x5ae606);_0x53d8c7[_0x82396a](_0x1ed448[_0x3c0f('0x76')],_0x1ed448[_0x3c0f('0x71')][_0x3c0f('0x77')],_0x1ed448[_0x3c0f('0x71')]['end']);}}}else{var _0x1e20bb=_(_0x4680ba[_0x3c0f('0x48')])[_0x3c0f('0x46')]()[_0x3c0f('0x34')](function(_0x2bee36){return _['some'](_0x53a5e7,[_0x3c0f('0x31'),_0x2bee36])?_0x2bee36:undefined;})[_0x3c0f('0x7f')]()[_0x3c0f('0x71')]();if(!_['isEmpty'](_0x1e20bb)){_0x1e20bb[_0x3c0f('0x80')](function(_0x4651e5){if(_0x4651e5===_0x3c0f('0x81')){_0x4a08ff[_0x3c0f('0x51')]('i.SmsAccountId\x20IN\x20?',[][_0x3c0f('0x82')](_0x4680ba[_0x3c0f('0x48')][_0x4651e5]));}else if(_0x4651e5===_0x3c0f('0x83')){var _0x29399=JSON[_0x3c0f('0x84')](_0x4680ba[_0x3c0f('0x48')][_0x4651e5])[_0x3c0f('0x85')];var _0xfabc69=JSON[_0x3c0f('0x84')](_0x4680ba['query'][_0x4651e5])['$lte'];_0x4a08ff[_0x3c0f('0x51')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x29399,_0xfabc69);}else{if(_0x4680ba[_0x3c0f('0x48')][_0x4651e5]==='null'){_0x4a08ff['where']('i.'+_0x4651e5+_0x3c0f('0x86'));}else{_0x4a08ff[_0x3c0f('0x51')]('i.'+_0x4651e5+_0x3c0f('0x87'),_0x4680ba['query'][_0x4651e5]);}}});}if(_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x88')]){if(_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x88')]==0x1){_0x4a08ff[_0x3c0f('0x6e')]('`unreadMessages`\x20=\x200');}else{_0x4a08ff[_0x3c0f('0x6e')](_0x3c0f('0x89'));}}if(_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x8a')]){_0x2f9457=_[_0x3c0f('0x8b')](_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x8a')])?_0x4680ba[_0x3c0f('0x48')]['tag']:new Array(_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x8a')]);_0x2f9457[_0x3c0f('0x80')](function(_0x125af5){_0x541edf['or'](_0x3c0f('0x79'),'%,'+_0x125af5+',%');});}if(_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x8c')]){var _0xb18358=_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x8c')][_0x3c0f('0x8d')]('\x5c','\x5c\x5c')[_0x3c0f('0x8d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xb18358)){_0x53d8c7['or'](_0x3c0f('0x8e'),_0xb18358+'%')['or'](_0x3c0f('0x8f'),_0xb18358+'%');}else{_0x53d8c7['or'](_0x3c0f('0x90'),qs[_0x3c0f('0x73')](_0xb18358))['or'](_0x3c0f('0x91'),_0xb18358+'%');}}}_0x4a08ff['where'](_0x53d8c7);_0x4a08ff[_0x3c0f('0x92')](_0x3c0f('0x93'));var _0x3c60f8={'type':db[_0x3c0f('0x94')][_0x3c0f('0x95')][_0x3c0f('0x96')],'raw':!![]};var _0x397736=_0x4a08ff[_0x3c0f('0x97')]();_0x397736[_0x3c0f('0x54')](_0x3c0f('0x93'));_0x397736['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x449689[_0x3c0f('0x4f')]){_0x449689[_0x3c0f('0x4f')]['forEach'](function(_0x58bcd5){var _0x24fd93=_0x58bcd5[0x0]===_0x3c0f('0x98')?_0x58bcd5[0x0]:'i.'+_0x58bcd5[0x0];_0x4a08ff[_0x3c0f('0x4f')](_0x24fd93,_0x58bcd5[0x1]===_0x3c0f('0x99')?![]:!![]);});}if(!_[_0x3c0f('0x9a')](_0x2f9457)){_0x4a08ff['having'](_0x541edf);_0x397736[_0x3c0f('0x51')](_0x3c0f('0x9b'),_0x2f9457);}BPromise[_0x3c0f('0x9c')]()[_0x3c0f('0x2c')](function(){if(!_0x40f2c0){if(_0x4680ba['query'][_0x3c0f('0x81')])return;_0x397736[_0x3c0f('0x51')](_0x3c0f('0x9d'));_0x4a08ff[_0x3c0f('0x51')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4680ba[_0x3c0f('0x9e')][_0x3c0f('0x9f')]!==_0x3c0f('0xa0'))return;return _0x4680ba['user'][_0x3c0f('0xa1')]({'attributes':['id'],'raw':!![]})['then'](function(_0x20ce39){if(_[_0x3c0f('0x9a')](_0x20ce39)){_0x397736[_0x3c0f('0x51')](_0x3c0f('0xa2'));_0x4a08ff['where'](_0x3c0f('0xa2'));}else{_0x397736[_0x3c0f('0x51')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x20ce39,'id'));_0x4a08ff[_0x3c0f('0x51')](_0x3c0f('0xa3'),_['map'](_0x20ce39,'id'));}});})[_0x3c0f('0x2c')](function(){if(_0x4680ba[_0x3c0f('0x9e')]['role']===_0x3c0f('0xa0')&&!_0x40f2c0&&!_0x4680ba[_0x3c0f('0x48')]['SmsAccountId'])return[];return db[_0x3c0f('0xa4')]['query'](_0x397736['toString'](),_0x3c60f8);})[_0x3c0f('0x2c')](function(_0x6a4446){_0x14b3af[_0x3c0f('0x23')]=_0x6a4446['length'];if(_0x14b3af[_0x3c0f('0x23')]===0x0)return[];return db[_0x3c0f('0xa4')]['query'](_0x5f3289['toString'](),_0x3c60f8)['then'](function(_0x4c4dfe){_0x319c46=_['keyBy'](_0x4c4dfe,'id');_0x3c60f8=_[_0x3c0f('0xa5')](_0x3c60f8,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4680ba[_0x3c0f('0x48')][_0x3c0f('0x4b')]){_0x449689[_0x3c0f('0x49')][_0x3c0f('0x80')](function(_0x4923f7){_0x4a08ff[_0x3c0f('0x54')]('i.'+_0x4923f7);});}else{_0x4a08ff[_0x3c0f('0x54')](_0x3c0f('0xa6'),'unreadMessages');_0x4a08ff[_0x3c0f('0x54')](_0x3c0f('0xa7'),'Account.key');_0x4a08ff['field'](_0x3c0f('0xa8'),'Account.mandatoryDisposition');_0x4a08ff[_0x3c0f('0x54')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3c0f('0x98'));_0x4a08ff[_0x3c0f('0x54')](_0x3c0f('0xa9'));_0x4a08ff[_0x3c0f('0x54')](_0x3c0f('0xaa'),_0x3c0f('0xab'));_0x4a08ff[_0x3c0f('0x54')](_0x3c0f('0xac'),_0x3c0f('0xad'));_0x4a08ff[_0x3c0f('0x54')]('c.email',_0x3c0f('0xae'));_0x4a08ff[_0x3c0f('0x54')]('c.phone','Contact.phone');_0x4a08ff[_0x3c0f('0x54')](_0x3c0f('0xaf'),_0x3c0f('0xb0'));_0x4a08ff[_0x3c0f('0x54')](_0x3c0f('0xb1'),'Contact.fax');_0x4a08ff[_0x3c0f('0x54')](_0x3c0f('0xb2'),_0x3c0f('0xb3'));_0x4a08ff['field'](_0x3c0f('0xb4'),_0x3c0f('0xb5'));_0x4a08ff[_0x3c0f('0x54')](_0x3c0f('0xb6'),_0x3c0f('0x36'));}if(_0x449689[_0x3c0f('0x25')])_0x4a08ff[_0x3c0f('0x25')](_0x449689[_0x3c0f('0x25')]);if(_0x449689[_0x3c0f('0x24')])_0x4a08ff[_0x3c0f('0x24')](_0x449689[_0x3c0f('0x24')]);return db[_0x3c0f('0xa4')][_0x3c0f('0x48')](_0x4a08ff[_0x3c0f('0xb7')](),_0x3c60f8);})[_0x3c0f('0x2c')](function(_0x4c9216){if(_0x4c9216[_0x3c0f('0x4c')]>0x0)_0x283e2f[_0x3c0f('0x51')](_0x3c0f('0xb8'),_[_0x3c0f('0x34')](_0x4c9216,'id'));return db[_0x3c0f('0xa4')][_0x3c0f('0x48')](_0x283e2f[_0x3c0f('0xb7')](),_0x3c60f8)[_0x3c0f('0x2c')](function(_0x32eb21){var _0x4766d7=_['groupBy'](_0x32eb21,'SmsInteractionId');var _0x351ec4=[];_0x4c9216[_0x3c0f('0x80')](function(_0x5400d7){_0x351ec4['push'](updateSmsInteraction(_0x5400d7,_0x319c46,_0x4766d7));});return BPromise[_0x3c0f('0xb9')](_0x351ec4);});});})[_0x3c0f('0x2c')](function(_0x3900fe){_0x14b3af[_0x3c0f('0xba')]=_0x3900fe;return _0x14b3af;})[_0x3c0f('0x2c')](respondWithFilteredResult(_0x88995,_0x449689))[_0x3c0f('0x39')](handleError(_0x88995,null));};exports[_0x3c0f('0xbb')]=function(_0x364f2b,_0x13312b){var _0x162d7a={'raw':![],'where':{'id':_0x364f2b[_0x3c0f('0xbc')]['id']}},_0x41db8d={};_0x41db8d[_0x3c0f('0x45')]=_[_0x3c0f('0x46')](db[_0x3c0f('0x42')]['rawAttributes']);_0x41db8d[_0x3c0f('0x48')]=_[_0x3c0f('0x46')](_0x364f2b[_0x3c0f('0x48')]);_0x41db8d[_0x3c0f('0x47')]=_[_0x3c0f('0x4a')](_0x41db8d[_0x3c0f('0x45')],_0x41db8d[_0x3c0f('0x48')]);_0x162d7a[_0x3c0f('0x49')]=_[_0x3c0f('0x4a')](_0x41db8d[_0x3c0f('0x45')],qs[_0x3c0f('0x4b')](_0x364f2b['query'][_0x3c0f('0x4b')]));_0x162d7a[_0x3c0f('0x49')]=_0x162d7a[_0x3c0f('0x49')][_0x3c0f('0x4c')]?_0x162d7a[_0x3c0f('0x49')]:_0x41db8d[_0x3c0f('0x45')];if(_0x364f2b[_0x3c0f('0x48')][_0x3c0f('0xbd')]){_0x162d7a[_0x3c0f('0xbe')]=[{'all':!![]}];}_0x162d7a=_[_0x3c0f('0xa5')]({},_0x162d7a,_0x364f2b[_0x3c0f('0xbf')]);return db[_0x3c0f('0x42')][_0x3c0f('0x6b')](_0x162d7a)[_0x3c0f('0x2c')](handleEntityNotFound(_0x13312b,null))[_0x3c0f('0x2c')](respondWithResult(_0x13312b,null))[_0x3c0f('0x39')](handleError(_0x13312b,null));};exports[_0x3c0f('0xc0')]=function(_0x529841,_0x392a80){return db[_0x3c0f('0x42')][_0x3c0f('0xc0')](_0x529841[_0x3c0f('0xc1')],{})[_0x3c0f('0x2c')](respondWithResult(_0x392a80,0xc9))[_0x3c0f('0x39')](handleError(_0x392a80,null));};exports[_0x3c0f('0x2b')]=function(_0x2a8a10,_0x359b61){if(_0x2a8a10[_0x3c0f('0xc1')]['id']){delete _0x2a8a10[_0x3c0f('0xc1')]['id'];}return db['SmsInteraction'][_0x3c0f('0x6b')]({'where':{'id':_0x2a8a10[_0x3c0f('0xbc')]['id']}})[_0x3c0f('0x2c')](handleEntityNotFound(_0x359b61,null))[_0x3c0f('0x2c')](saveUpdates(_0x2a8a10[_0x3c0f('0xc1')],null))[_0x3c0f('0x2c')](respondWithResult(_0x359b61,null))[_0x3c0f('0x39')](handleError(_0x359b61,null));};exports[_0x3c0f('0x2d')]=function(_0x3780d4,_0x304b43){return db[_0x3c0f('0x42')]['find']({'where':{'id':_0x3780d4['params']['id']}})['then'](handleEntityNotFound(_0x304b43,null))['then'](removeEntity(_0x304b43,null))[_0x3c0f('0x39')](handleError(_0x304b43,null));};exports['describe']=function(_0x850f08,_0x2d1205){return db['SmsInteraction'][_0x3c0f('0xc2')]()[_0x3c0f('0x2c')](respondWithResult(_0x2d1205,null))['catch'](handleError(_0x2d1205,null));};exports[_0x3c0f('0xc3')]=function(_0xa1c70f,_0x44072b,_0x362ffe){return db[_0x3c0f('0xc4')][_0x3c0f('0x6b')]({'where':{'id':_0xa1c70f['params']['id']}})['then'](handleEntityNotFound(_0x44072b,null))[_0x3c0f('0x2c')](function(_0x562127){if(_0x562127){return _0x562127['addMessage'](_0xa1c70f[_0x3c0f('0xc1')][_0x3c0f('0xc5')],_['omit'](_0xa1c70f[_0x3c0f('0xc1')],[_0x3c0f('0xc5'),'id'])||{});}})[_0x3c0f('0x2c')](respondWithResult(_0x44072b,null))['catch'](handleError(_0x44072b,null));};exports[_0x3c0f('0xc6')]=function(_0x55800b,_0x514a21,_0x557272){var _0x342ea2={'raw':![],'where':{}};var _0x8809={};var _0x5d189a={'count':0x0,'rows':[]};return db[_0x3c0f('0x42')][_0x3c0f('0xc7')]({'where':{'id':_0x55800b[_0x3c0f('0xbc')]['id']}})[_0x3c0f('0x2c')](handleEntityNotFound(_0x514a21,null))['then'](function(_0x4473b8){if(_0x4473b8){_0x8809[_0x3c0f('0x45')]=_[_0x3c0f('0x46')](db[_0x3c0f('0xc4')][_0x3c0f('0x43')]);_0x8809[_0x3c0f('0x48')]=_['keys'](_0x55800b[_0x3c0f('0x48')]);_0x8809[_0x3c0f('0x47')]=_[_0x3c0f('0x4a')](_0x8809['model'],_0x8809[_0x3c0f('0x48')]);_0x342ea2[_0x3c0f('0x49')]=_['intersection'](_0x8809[_0x3c0f('0x45')],qs[_0x3c0f('0x4b')](_0x55800b[_0x3c0f('0x48')][_0x3c0f('0x4b')]));_0x342ea2[_0x3c0f('0x49')]=_0x342ea2['attributes'][_0x3c0f('0x4c')]?_0x342ea2[_0x3c0f('0x49')]:_0x8809['model'];if(!_0x55800b[_0x3c0f('0x48')][_0x3c0f('0x4d')](_0x3c0f('0x4e'))){_0x342ea2[_0x3c0f('0x25')]=qs[_0x3c0f('0x25')](_0x55800b['query'][_0x3c0f('0x25')]);_0x342ea2[_0x3c0f('0x24')]=qs[_0x3c0f('0x24')](_0x55800b[_0x3c0f('0x48')][_0x3c0f('0x24')]);}_0x342ea2[_0x3c0f('0x4f')]=qs['sort'](_0x55800b[_0x3c0f('0x48')][_0x3c0f('0x50')]);_0x342ea2['where']=qs[_0x3c0f('0x47')](_[_0x3c0f('0x52')](_0x55800b[_0x3c0f('0x48')],_0x8809[_0x3c0f('0x47')]));_0x342ea2[_0x3c0f('0x51')][_0x3c0f('0xc8')]=_0x4473b8['id'];if(_0x55800b[_0x3c0f('0x48')]['filter']){_0x342ea2['where']=_[_0x3c0f('0xa5')](_0x342ea2['where'],{'$or':_[_0x3c0f('0x34')](_0x342ea2[_0x3c0f('0x49')],function(_0x2b98af){var _0x4a9bd6={};_0x4a9bd6[_0x2b98af]={'$like':'%'+_0x55800b[_0x3c0f('0x48')][_0x3c0f('0x8c')]+'%'};return _0x4a9bd6;})});}if(_0x55800b[_0x3c0f('0x48')][_0x3c0f('0x85')]){var _0x36acdd=_0x55800b[_0x3c0f('0x48')][_0x3c0f('0x85')][_0x3c0f('0x38')](',');var _0xf345ac={};_0xf345ac[_0x36acdd[0x0]]={'$gte':moment(_0x36acdd[0x1])[_0x3c0f('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x342ea2[_0x3c0f('0x51')]=_[_0x3c0f('0xa5')](_0x342ea2[_0x3c0f('0x51')],_0xf345ac);}_0x342ea2=_[_0x3c0f('0xa5')]({},_0x342ea2,_0x55800b[_0x3c0f('0xbf')]);return db[_0x3c0f('0xc4')][_0x3c0f('0x23')]({'where':_0x342ea2['where']})[_0x3c0f('0x2c')](function(_0x5ea558){_0x5d189a[_0x3c0f('0x23')]=_0x5ea558;if(_0x55800b['query']['includeAll']){_0x342ea2[_0x3c0f('0xbe')]=[{'all':!![]}];}return db[_0x3c0f('0xc4')][_0x3c0f('0xca')](_0x342ea2);})['then'](function(_0x29a02f){_0x5d189a[_0x3c0f('0xba')]=_0x29a02f;return _0x5d189a;});}})['then'](respondWithFilteredResult(_0x514a21,_0x342ea2))[_0x3c0f('0x39')](handleError(_0x514a21,null));};exports[_0x3c0f('0xcb')]=function(_0x1d12a9,_0x1d2725,_0x55314a){return db[_0x3c0f('0x42')]['find']({'where':{'id':_0x1d12a9[_0x3c0f('0xbc')]['id']}})[_0x3c0f('0x2c')](handleEntityNotFound(_0x1d2725,null))[_0x3c0f('0x2c')](function(_0x36f1fa){if(_0x36f1fa){return _0x36f1fa[_0x3c0f('0xcc')](_0x1d12a9[_0x3c0f('0xc1')][_0x3c0f('0xc5')],_['omit'](_0x1d12a9[_0x3c0f('0xc1')],[_0x3c0f('0xc5'),'id'])||{})['spread'](function(){return db['Tag'][_0x3c0f('0xca')]({'attributes':['id','name','color'],'where':{'id':_0x1d12a9[_0x3c0f('0xc1')]['ids']}});})[_0x3c0f('0x2c')](function(_0x1110fe){socket[_0x3c0f('0xcd')](_0x3c0f('0xce'),{'id':Number(_0x1d12a9[_0x3c0f('0xbc')]['id']),'tags':_0x1110fe||[]});return{'id':Number(_0x1d12a9[_0x3c0f('0xbc')]['id']),'tags':_0x1110fe||[]};});}})[_0x3c0f('0x2c')](respondWithResult(_0x1d2725,null))['catch'](handleError(_0x1d2725,null));};exports['removeTags']=function(_0x461463,_0x554ff7,_0x35fcbd){return db[_0x3c0f('0x42')][_0x3c0f('0x6b')]({'where':{'id':_0x461463[_0x3c0f('0xbc')]['id']}})[_0x3c0f('0x2c')](handleEntityNotFound(_0x554ff7,null))[_0x3c0f('0x2c')](function(_0x210588){if(_0x210588){return _0x210588[_0x3c0f('0xcf')](_0x461463[_0x3c0f('0x48')]['ids']);}})[_0x3c0f('0x2c')](respondWithStatusCode(_0x554ff7,null))['catch'](handleError(_0x554ff7,null));};exports[_0x3c0f('0xd0')]=function(_0x4b5023,_0x2a727e){var _0x1ff9dc=moment()['unix']()['toString']();var _0x49c4f7=path['join'](config['root'],_0x3c0f('0xd1'),_0x3c0f('0xd2'),'tmp');var _0x51bc25=path['join'](config[_0x3c0f('0xd3')],_0x3c0f('0xd1'),_0x3c0f('0xd2'),_0x3c0f('0xd4'));var _0x5776a8=path['join'](_0x49c4f7,_0x1ff9dc);var _0x573919=util[_0x3c0f('0xc9')](_0x3c0f('0xd5'),_0x4b5023[_0x3c0f('0xbc')]['id'],_0x1ff9dc);var _0x9ca378=path['join'](_0x49c4f7,_0x573919);var _0x33a02e=[];_0x33a02e[_0x3c0f('0xd6')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x33a02e[_0x3c0f('0xd6')]({'model':db[_0x3c0f('0xd7')],'as':'Contact','attributes':['id',_0x3c0f('0xd8'),_0x3c0f('0xd9')],'raw':!![]});var _0x347a42=[{'model':db['SmsMessage'],'as':_0x3c0f('0xda'),'attributes':['id','body',_0x3c0f('0x83'),'direction',_0x3c0f('0xdb'),_0x3c0f('0x88')],'include':_0x33a02e}];_0x347a42[_0x3c0f('0xd6')]({'model':db[_0x3c0f('0xdc')],'as':_0x3c0f('0xdd'),'attributes':['id','name']});_0x347a42['push']({'model':db[_0x3c0f('0x7b')],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0x3c0f('0x6b')]({'where':{'id':_0x4b5023[_0x3c0f('0xbc')]['id']},'include':_0x347a42})['then'](handleEntityNotFound(_0x2a727e,null))[_0x3c0f('0x2c')](function(_0x2c75ca){if(_0x2c75ca){var _0x10c38c=_0x2c75ca[_0x3c0f('0xde')]({'plain':!![]});fs['mkdirSync'](_0x5776a8);var _0xc5e575={'channel':_0x3c0f('0xdf'),'account':_0x10c38c[_0x3c0f('0xdd')][_0x3c0f('0x31')],'agent':_0x10c38c[_0x3c0f('0xe0')]?_0x10c38c[_0x3c0f('0xe0')][_0x3c0f('0x35')]:_0x3c0f('0xe1'),'createdAt':moment(_0x10c38c[_0x3c0f('0x83')])[_0x3c0f('0xc9')](_0x3c0f('0xe2'))[_0x3c0f('0xb7')](),'closedAt':_0x10c38c[_0x3c0f('0x3e')]?moment(_0x10c38c[_0x3c0f('0xe3')])[_0x3c0f('0xc9')](_0x3c0f('0xe2'))[_0x3c0f('0xb7')]():'','disposition':_0x10c38c[_0x3c0f('0xe4')],'messages':_(_0x10c38c['Messages'])[_0x3c0f('0x8c')]({'secret':![]})[_0x3c0f('0x34')](function(_0x54cceb){return{'date':moment(_0x54cceb[_0x3c0f('0x83')])[_0x3c0f('0xc9')](_0x3c0f('0xe2'))[_0x3c0f('0xb7')](),'sender':_0x54cceb[_0x3c0f('0xe5')]===_0x3c0f('0xe6')?_0x54cceb['User']?_0x54cceb['User'][_0x3c0f('0x35')]:_0x3c0f('0xe7'):_0x54cceb[_0x3c0f('0x70')][_0x3c0f('0xd8')]+(_0x54cceb[_0x3c0f('0x70')][_0x3c0f('0xd9')]?'\x20'+_0x54cceb[_0x3c0f('0x70')][_0x3c0f('0xd9')]:''),'body':_0x54cceb[_0x3c0f('0xc1')],'direction':_0x54cceb[_0x3c0f('0xe5')]===_0x3c0f('0xe6')?'A':'C','secret':_0x54cceb['secret'],'read':_0x54cceb[_0x3c0f('0x88')]};})[_0x3c0f('0x71')]()};return ejs[_0x3c0f('0xe8')](path[_0x3c0f('0xe9')](config[_0x3c0f('0xd3')],_0x3c0f('0xd1'),'views','downloadInteraction.ejs'),{'interaction':_0xc5e575})[_0x3c0f('0x2c')](function(_0x9a2387){var _0x4691e7=path[_0x3c0f('0xe9')](_0x5776a8,_0x3c0f('0xea')+_0x10c38c['id']+'-'+_0x1ff9dc+'.pdf');var _0x59b1b2={'path':_0x4691e7,'channel':_0x3c0f('0xdf'),'interactionId':_0x10c38c['id']};return pdf['createPdfFromHTML'](_0x9a2387,_0x59b1b2);})[_0x3c0f('0x2c')](function(){return new BPromise(function(_0x550919,_0x3e86bd){zipdir(_0x5776a8,{'saveTo':_0x9ca378},function(_0xab7f1f,_0x2f79a0){if(_0xab7f1f)return _0x3e86bd(_0xab7f1f);return _0x550919(_0x2f79a0);});})[_0x3c0f('0x2c')](function(){return new BPromise(function(_0x52e991,_0x25310e){rimraf(_0x5776a8,function(_0x2469fe){if(_0x2469fe)_0x25310e(_0x2469fe);return _0x52e991();});});})[_0x3c0f('0x2c')](function(){return _0x2a727e[_0x3c0f('0xd0')](_0x9ca378,_0x573919,function(_0x185faa){if(_0x185faa){console['log'](_0x3c0f('0xeb'),_0x185faa);}else{fs['unlinkSync'](_0x9ca378);}});});});}else{return _0x2a727e['sendStatus'](0xc8);}})[_0x3c0f('0x39')](handleError(_0x2a727e,null));}; \ No newline at end of file +var _0xe189=['where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','isEmpty','SmsAccountId','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','SmsInteractionId','rows','params','includeAll','include','options','create','update','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','keys','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','unix','join','root','files','server','attachments','transcript-%d-%s.zip','push','User','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','get','Owner','N.A.','closedAt','disposition','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','download','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','status','offset','limit','count','set','Content-Range','json','save','then','destroy','end','sendStatus','stack','name','Users','map','fullname','Tags','TagIds','split','forEach','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','SmsInteraction','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x4610c8,_0x39b9ec){var _0x31e396=function(_0x2927ce){while(--_0x2927ce){_0x4610c8['push'](_0x4610c8['shift']());}};_0x31e396(++_0x39b9ec);}(_0xe189,0x194));var _0x9e18=function(_0x24decf,_0x4372bb){_0x24decf=_0x24decf-0x0;var _0x21bea1=_0xe189[_0x24decf];return _0x21bea1;};'use strict';var emlformat=require(_0x9e18('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9e18('0x1'));var rp=require(_0x9e18('0x2'));var moment=require(_0x9e18('0x3'));var BPromise=require(_0x9e18('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9e18('0x5'));var sox=require(_0x9e18('0x6'));var csv=require(_0x9e18('0x7'));var ejs=require(_0x9e18('0x8'));var fs=require('fs');var fs_extra=require(_0x9e18('0x9'));var _=require('lodash');var squel=require(_0x9e18('0xa'));var crypto=require(_0x9e18('0xb'));var jsforce=require(_0x9e18('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9e18('0x7'));var querystring=require(_0x9e18('0xd'));var Papa=require(_0x9e18('0xe'));var Redis=require('ioredis');var authService=require(_0x9e18('0xf'));var qs=require(_0x9e18('0x10'));var as=require(_0x9e18('0x11'));var pdf=require(_0x9e18('0x12'));var hardwareService=require(_0x9e18('0x13'));var logger=require(_0x9e18('0x14'))(_0x9e18('0x15'));var utils=require(_0x9e18('0x16'));var config=require(_0x9e18('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e18('0x18'))['db'];config['redis']=_[_0x9e18('0x19')](config[_0x9e18('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e18('0x1b'))(new Redis(config[_0x9e18('0x1a')]));require(_0x9e18('0x1c'))[_0x9e18('0x1d')](socket);function respondWithStatusCode(_0x566954,_0xbd877){_0xbd877=_0xbd877||0xcc;return function(_0x58c360){if(_0x58c360){return _0x566954['sendStatus'](_0xbd877);}return _0x566954[_0x9e18('0x1e')](_0xbd877)['end']();};}function respondWithResult(_0x691a51,_0x3a2ad9){_0x3a2ad9=_0x3a2ad9||0xc8;return function(_0x1f71fc){if(_0x1f71fc){return _0x691a51[_0x9e18('0x1e')](_0x3a2ad9)['json'](_0x1f71fc);}};}function respondWithFilteredResult(_0x4a5247,_0x15cf20){return function(_0x446098){if(_0x446098){var _0x57cd1f=typeof _0x15cf20[_0x9e18('0x1f')]==='undefined'&&typeof _0x15cf20[_0x9e18('0x20')]==='undefined';var _0x2ef267=_0x446098[_0x9e18('0x21')];var _0x20b492=_0x57cd1f?0x0:_0x15cf20[_0x9e18('0x1f')];var _0x1fb910=_0x57cd1f?_0x446098[_0x9e18('0x21')]:_0x15cf20[_0x9e18('0x1f')]+_0x15cf20[_0x9e18('0x20')];var _0x11619d;if(_0x1fb910>=_0x2ef267){_0x1fb910=_0x2ef267;_0x11619d=0xc8;}else{_0x11619d=0xce;}_0x4a5247['status'](_0x11619d);return _0x4a5247[_0x9e18('0x22')](_0x9e18('0x23'),_0x20b492+'-'+_0x1fb910+'/'+_0x2ef267)[_0x9e18('0x24')](_0x446098);}return null;};}function patchUpdates(_0x52039e){return function(_0x420ab0){try{jsonpatch['apply'](_0x420ab0,_0x52039e,!![]);}catch(_0x4b591){return BPromise['reject'](_0x4b591);}return _0x420ab0[_0x9e18('0x25')]();};}function saveUpdates(_0x4eabe9,_0x210547){return function(_0x1bd289){if(_0x1bd289){return _0x1bd289['update'](_0x4eabe9)[_0x9e18('0x26')](function(_0x4b6ab5){return _0x4b6ab5;});}return null;};}function removeEntity(_0x4c133b,_0x445f10){return function(_0x5efbde){if(_0x5efbde){return _0x5efbde[_0x9e18('0x27')]()['then'](function(){_0x4c133b[_0x9e18('0x1e')](0xcc)[_0x9e18('0x28')]();});}};}function handleEntityNotFound(_0x2cee0f,_0xd115f3){return function(_0x33fbd5){if(!_0x33fbd5){_0x2cee0f[_0x9e18('0x29')](0x194);}return _0x33fbd5;};}function handleError(_0x10c119,_0x3917fb){_0x3917fb=_0x3917fb||0x1f4;return function(_0xc75df0){logger['error'](_0xc75df0[_0x9e18('0x2a')]);if(_0xc75df0[_0x9e18('0x2b')]){delete _0xc75df0[_0x9e18('0x2b')];}_0x10c119[_0x9e18('0x1e')](_0x3917fb)['send'](_0xc75df0);};}function getInteractionUsers(_0x56cb83,_0x410655){return new BPromise(function(_0x1bb217,_0x3f6510){try{if(_0x410655[_0x56cb83['id']]){_0x56cb83[_0x9e18('0x2c')]=_[_0x9e18('0x2d')](_0x410655[_0x56cb83['id']],function(_0x53c35e){return{'id':_0x53c35e['id'],'fullname':_0x53c35e[_0x9e18('0x2e')]};});}}catch(_0x3862d9){_0x3f6510(_0x3862d9);}_0x1bb217(_0x56cb83);});}function getInteractionTags(_0x12f451,_0x1815e8){return new BPromise(function(_0x1a240d,_0x3412d5){try{if(_0x12f451['TagIds']){_0x12f451[_0x9e18('0x2f')]=[];_0x12f451[_0x9e18('0x30')][_0x9e18('0x31')](',')[_0x9e18('0x32')](function(_0x29942e){_0x12f451['Tags']['push'](_0x1815e8[_0x29942e]);});}delete _0x12f451[_0x9e18('0x30')];}catch(_0x38c8ec){_0x3412d5(_0x38c8ec);}_0x1a240d(_0x12f451);});}function updateSmsInteraction(_0x3cead0,_0xe49a38,_0x4b489a){return new BPromise(function(_0x3cb118,_0x1779a1){return getInteractionUsers(_0x3cead0,_0x4b489a)[_0x9e18('0x26')](function(_0x51b672){return getInteractionTags(_0x51b672,_0xe49a38);})[_0x9e18('0x26')](function(_0x48b9ed){return getStateInteraction(_0x48b9ed);})[_0x9e18('0x26')](function(_0x506ab8){_0x3cb118(_0x506ab8);})[_0x9e18('0x33')](function(_0x37b294){_0x1779a1(_0x37b294);});});}function getStateInteraction(_0xdc383c){return new BPromise(function(_0x984955){_0xdc383c[_0x9e18('0x34')]=0x0;_0xdc383c[_0x9e18('0x35')]=0x0;_0xdc383c[_0x9e18('0x36')]=0x0;_0xdc383c[_0x9e18('0x37')]=0x0;_0xdc383c[_0x9e18('0x38')]=0x0;if(!_0xdc383c[_0x9e18('0x39')]&&!_0xdc383c[_0x9e18('0x3a')]){_0xdc383c['waiting']+=0x1;}if(!_0xdc383c[_0x9e18('0x39')]&&_0xdc383c[_0x9e18('0x3a')]){_0xdc383c[_0x9e18('0x35')]+=0x1;if(_0xdc383c[_0x9e18('0x34')]){_0xdc383c[_0x9e18('0x34')]-=0x1;}}if(_0xdc383c[_0x9e18('0x39')]&&_0xdc383c[_0x9e18('0x3a')]){_0xdc383c[_0x9e18('0x36')]+=0x1;if(_0xdc383c[_0x9e18('0x35')]){_0xdc383c[_0x9e18('0x35')]-=0x1;}}if(_0xdc383c[_0x9e18('0x39')]&&!_0xdc383c[_0x9e18('0x3a')]){_0xdc383c[_0x9e18('0x37')]+=0x1;if(_0xdc383c[_0x9e18('0x34')]){_0xdc383c['waiting']-=0x1;}}_0xdc383c[_0x9e18('0x38')]+=0x1;_0x984955(_0xdc383c);});}exports[_0x9e18('0x3b')]=function(_0x3dc07c,_0x49ac7c){var _0x155695={},_0xf308ad={},_0x1821cb={'count':0x0,'rows':[]};var _0x2c9e9a=_[_0x9e18('0x2d')](db[_0x9e18('0x3c')][_0x9e18('0x3d')],function(_0x44b4fc){return{'name':_0x44b4fc[_0x9e18('0x3e')],'type':_0x44b4fc[_0x9e18('0x3f')]['key']};});_0xf308ad['model']=_['map'](_0x2c9e9a,_0x9e18('0x2b'));_0xf308ad['query']=_['keys'](_0x3dc07c[_0x9e18('0x40')]);_0xf308ad[_0x9e18('0x41')]=_[_0x9e18('0x42')](_0xf308ad['model'],_0xf308ad[_0x9e18('0x40')]);_0x155695[_0x9e18('0x43')]=_[_0x9e18('0x42')](_0xf308ad[_0x9e18('0x44')],qs[_0x9e18('0x45')](_0x3dc07c['query'][_0x9e18('0x45')]));_0x155695[_0x9e18('0x43')]=_0x155695[_0x9e18('0x43')][_0x9e18('0x46')]?_0x155695['attributes']:_0xf308ad[_0x9e18('0x44')];if(!_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x47')](_0x9e18('0x48'))){_0x155695[_0x9e18('0x20')]=qs['limit'](_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x20')]);_0x155695[_0x9e18('0x1f')]=qs[_0x9e18('0x1f')](_0x3dc07c[_0x9e18('0x40')]['offset']);}_0x155695['order']=qs['sort'](_0x3dc07c['query'][_0x9e18('0x49')]);_0x155695[_0x9e18('0x4a')]=qs[_0x9e18('0x41')](_[_0x9e18('0x4b')](_0x3dc07c[_0x9e18('0x40')],_0xf308ad['filters']),_0x2c9e9a);var _0x2bba5b=[];var _0x36eeaf=squel[_0x9e18('0x4c')]()[_0x9e18('0x4d')]('id')['field']('name')[_0x9e18('0x4d')](_0x9e18('0x4e'))[_0x9e18('0x4f')](_0x9e18('0x50'));var _0xda11e3=squel[_0x9e18('0x4c')]()['field'](_0x9e18('0x51'))['field'](_0x9e18('0x52'))[_0x9e18('0x4d')](_0x9e18('0x53'))[_0x9e18('0x4f')](_0x9e18('0x54'),'ui')[_0x9e18('0x55')](_0x9e18('0x56'),'u',_0x9e18('0x57'));var _0x352ca5=squel[_0x9e18('0x4c')]()[_0x9e18('0x4f')](_0x9e18('0x58'),'i')[_0x9e18('0x55')](_0x9e18('0x59'),'c',_0x9e18('0x5a'))['left_join'](_0x9e18('0x56'),'o',_0x9e18('0x5b'))[_0x9e18('0x55')](_0x9e18('0x5c'),'a',_0x9e18('0x5d'))['left_join'](_0x9e18('0x5e'),'me',_0x9e18('0x5f'))[_0x9e18('0x55')](_0x9e18('0x60'),'it',_0x9e18('0x61'))[_0x9e18('0x55')](_0x9e18('0x50'),'t',_0x9e18('0x62'));var _0x1ba96e=squel[_0x9e18('0x63')]();var _0x212c29=[];var _0x4047aa=squel[_0x9e18('0x63')]();var _0x1f19b8;if(_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x64')]){_0x1f19b8=as[_0x9e18('0x65')](_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x64')]);var _0x1c1f3f=_0x1f19b8[_0x9e18('0x66')];for(var _0x177f5c=0x0;_0x177f5c<_0x1f19b8[_0x9e18('0x67')][_0x9e18('0x46')];_0x177f5c++){var _0x474577=_0x1f19b8[_0x9e18('0x67')][_0x177f5c];var _0x3e6d71='i';var _0x5b2f8d=_[_0x9e18('0x68')](_0x2c9e9a,[_0x9e18('0x2b'),_0x474577[_0x9e18('0x4d')]]);if(!_0x5b2f8d){switch(_0x474577[_0x9e18('0x4d')]){case _0x9e18('0x69'):if(_0x474577[_0x9e18('0x6a')]==0x1){_0x352ca5[_0x9e18('0x6b')]('`'+_0x474577['field']+_0x9e18('0x6c'));}else{_0x352ca5[_0x9e18('0x6b')]('`'+_0x474577[_0x9e18('0x4d')]+_0x9e18('0x6d'));}break;case _0x9e18('0x6e'):if(_0x474577[_0x9e18('0x6f')]===_0x9e18('0x70')){if(_0x474577[_0x9e18('0x6a')][_0x9e18('0x31')]('\x20')['length']>0x1){_0x1ba96e[_0x1c1f3f](_0x9e18('0x71'),qs[_0x9e18('0x72')](_0x474577['value']),null);}else{var _0x354862='%'+_0x474577[_0x9e18('0x6a')]+'%';_0x1ba96e[_0x1c1f3f](_0x9e18('0x73'),_0x354862,_0x354862,_0x354862);}}else{_0x5b2f8d=_[_0x9e18('0x68')](_0x2c9e9a,[_0x9e18('0x2b'),_0x9e18('0x74')]);_0x474577[_0x9e18('0x4d')]=_0x9e18('0x74');_0x532678=as[_0x9e18('0x75')](_0x3e6d71,_0x5b2f8d['type'],_0x474577);_0x1ba96e[_0x1c1f3f](_0x532678[_0x9e18('0x76')],_0x532678[_0x9e18('0x6a')][_0x9e18('0x77')],_0x532678[_0x9e18('0x6a')]['end']);}break;case _0x9e18('0x78'):var _0x4eb9d7=_0x474577[_0x9e18('0x6a')][_0x9e18('0x31')](',')[_0x9e18('0x2d')](function(_0x46d568){return Number(_0x46d568);});_0x4eb9d7[_0x9e18('0x32')](function(_0x157a66){_0x4047aa['or'](_0x9e18('0x79'),'%,'+_0x157a66+',%');});_0x212c29=_[_0x9e18('0x7a')](_0x212c29,_0x4eb9d7);break;case'User':if(_0x474577[_0x9e18('0x6f')]===_0x9e18('0x70')){_0x1ba96e[_0x1c1f3f](_0x9e18('0x7b'),'%'+_0x474577[_0x9e18('0x6a')]+'%',null);}else{_0x5b2f8d=_['find'](_0x2c9e9a,['name',_0x9e18('0x3a')]);_0x474577[_0x9e18('0x4d')]=_0x9e18('0x3a');_0x532678=as[_0x9e18('0x75')](_0x3e6d71,_0x5b2f8d[_0x9e18('0x3f')],_0x474577);_0x1ba96e[_0x1c1f3f](_0x532678[_0x9e18('0x76')],_0x532678['value']['start'],_0x532678[_0x9e18('0x6a')][_0x9e18('0x28')]);}break;case _0x9e18('0x7c'):_0x532678=as[_0x9e18('0x75')]('me',null,_0x474577);_0x1ba96e[_0x1c1f3f](_0x532678[_0x9e18('0x76')],_0x532678[_0x9e18('0x6a')]['start'],_0x532678[_0x9e18('0x6a')]['end']);break;}}else{var _0x532678=as['buildExpression'](_0x3e6d71,_0x5b2f8d['type'],_0x474577);_0x1ba96e[_0x1c1f3f](_0x532678[_0x9e18('0x76')],_0x532678[_0x9e18('0x6a')][_0x9e18('0x77')],_0x532678[_0x9e18('0x6a')][_0x9e18('0x28')]);}}}else{var _0xd083f9=_(_0x3dc07c[_0x9e18('0x40')])['keys']()[_0x9e18('0x2d')](function(_0x1e241d){return _['some'](_0x2c9e9a,['name',_0x1e241d])?_0x1e241d:undefined;})['compact']()['value']();if(!_[_0x9e18('0x7d')](_0xd083f9)){_0xd083f9[_0x9e18('0x32')](function(_0x1fffbe){if(_0x1fffbe===_0x9e18('0x7e')){_0x352ca5['where']('i.SmsAccountId\x20IN\x20?',[][_0x9e18('0x7f')](_0x3dc07c[_0x9e18('0x40')][_0x1fffbe]));}else if(_0x1fffbe===_0x9e18('0x80')){var _0x3ffd6b=JSON['parse'](_0x3dc07c['query'][_0x1fffbe])['$gte'];var _0x25565e=JSON['parse'](_0x3dc07c[_0x9e18('0x40')][_0x1fffbe])[_0x9e18('0x81')];_0x352ca5[_0x9e18('0x4a')](_0x9e18('0x82'),_0x3ffd6b,_0x25565e);}else{if(_0x3dc07c[_0x9e18('0x40')][_0x1fffbe]===_0x9e18('0x83')){_0x352ca5[_0x9e18('0x4a')]('i.'+_0x1fffbe+_0x9e18('0x84'));}else{_0x352ca5[_0x9e18('0x4a')]('i.'+_0x1fffbe+'\x20=\x20?',_0x3dc07c[_0x9e18('0x40')][_0x1fffbe]);}}});}if(_0x3dc07c['query']['read']){if(_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x85')]==0x1){_0x352ca5[_0x9e18('0x6b')](_0x9e18('0x86'));}else{_0x352ca5[_0x9e18('0x6b')]('`unreadMessages`\x20>\x200');}}if(_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x87')]){_0x212c29=_[_0x9e18('0x88')](_0x3dc07c['query'][_0x9e18('0x87')])?_0x3dc07c[_0x9e18('0x40')]['tag']:new Array(_0x3dc07c[_0x9e18('0x40')]['tag']);_0x212c29['forEach'](function(_0x4f9876){_0x4047aa['or'](_0x9e18('0x79'),'%,'+_0x4f9876+',%');});}if(_0x3dc07c[_0x9e18('0x40')]['filter']){var _0x55d48=_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x89')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x9e18('0x8a')](_0x55d48)){_0x1ba96e['or']('i.id\x20LIKE\x20?',_0x55d48+'%')['or'](_0x9e18('0x8b'),_0x55d48+'%');}else{_0x1ba96e['or'](_0x9e18('0x8c'),qs['getFullTextValue'](_0x55d48))['or'](_0x9e18('0x8d'),_0x55d48+'%');}}}_0x352ca5['where'](_0x1ba96e);_0x352ca5[_0x9e18('0x8e')](_0x9e18('0x8f'));var _0x547a65={'type':db[_0x9e18('0x90')][_0x9e18('0x91')]['SELECT'],'raw':!![]};var _0x393def=_0x352ca5[_0x9e18('0x92')]();_0x393def[_0x9e18('0x4d')](_0x9e18('0x8f'));_0x393def[_0x9e18('0x4d')](_0x9e18('0x93'),_0x9e18('0x69'));if(_0x155695[_0x9e18('0x94')]){_0x155695[_0x9e18('0x94')][_0x9e18('0x32')](function(_0x3610b1){var _0x42ec02=_0x3610b1[0x0]===_0x9e18('0x95')?_0x3610b1[0x0]:'i.'+_0x3610b1[0x0];_0x352ca5['order'](_0x42ec02,_0x3610b1[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9e18('0x7d')](_0x212c29)){_0x352ca5[_0x9e18('0x6b')](_0x4047aa);_0x393def['where'](_0x9e18('0x96'),_0x212c29);}BPromise[_0x9e18('0x97')]()[_0x9e18('0x26')](function(){if(!_0x1f19b8){if(_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x7e')])return;_0x393def['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x352ca5[_0x9e18('0x4a')](_0x9e18('0x98'));return;}if(_0x3dc07c['user'][_0x9e18('0x99')]!==_0x9e18('0x9a'))return;return _0x3dc07c[_0x9e18('0x9b')][_0x9e18('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2a7575){if(_['isEmpty'](_0x2a7575)){_0x393def[_0x9e18('0x4a')](_0x9e18('0x9d'));_0x352ca5[_0x9e18('0x4a')](_0x9e18('0x9d'));}else{_0x393def[_0x9e18('0x4a')](_0x9e18('0x9e'),_[_0x9e18('0x2d')](_0x2a7575,'id'));_0x352ca5[_0x9e18('0x4a')]('i.SmsAccountId\x20IN\x20?',_[_0x9e18('0x2d')](_0x2a7575,'id'));}});})[_0x9e18('0x26')](function(){if(_0x3dc07c[_0x9e18('0x9b')][_0x9e18('0x99')]==='agent'&&!_0x1f19b8&&!_0x3dc07c['query'][_0x9e18('0x7e')])return[];return db[_0x9e18('0x9f')][_0x9e18('0x40')](_0x393def[_0x9e18('0xa0')](),_0x547a65);})[_0x9e18('0x26')](function(_0x46edce){_0x1821cb[_0x9e18('0x21')]=_0x46edce[_0x9e18('0x46')];if(_0x1821cb[_0x9e18('0x21')]===0x0)return[];return db[_0x9e18('0x9f')][_0x9e18('0x40')](_0x36eeaf[_0x9e18('0xa0')](),_0x547a65)[_0x9e18('0x26')](function(_0x4f0fa0){_0x2bba5b=_[_0x9e18('0xa1')](_0x4f0fa0,'id');_0x547a65=_[_0x9e18('0xa2')](_0x547a65,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x45')]){_0x155695[_0x9e18('0x43')][_0x9e18('0x32')](function(_0x1a4041){_0x352ca5[_0x9e18('0x4d')]('i.'+_0x1a4041);});}else{_0x352ca5[_0x9e18('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9e18('0x69'));_0x352ca5['field'](_0x9e18('0xa3'),_0x9e18('0xa4'));_0x352ca5[_0x9e18('0x4d')](_0x9e18('0xa5'),_0x9e18('0xa6'));_0x352ca5[_0x9e18('0x4d')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x352ca5['field'](_0x9e18('0xa7'));_0x352ca5[_0x9e18('0x4d')]('c.firstName',_0x9e18('0xa8'));_0x352ca5['field'](_0x9e18('0xa9'),'Contact.lastName');_0x352ca5[_0x9e18('0x4d')](_0x9e18('0xaa'),_0x9e18('0xab'));_0x352ca5[_0x9e18('0x4d')](_0x9e18('0xac'),'Contact.phone');_0x352ca5['field'](_0x9e18('0xad'),'Contact.mobile');_0x352ca5['field'](_0x9e18('0xae'),_0x9e18('0xaf'));_0x352ca5[_0x9e18('0x4d')](_0x9e18('0xb0'),_0x9e18('0xb1'));_0x352ca5[_0x9e18('0x4d')]('o.internal',_0x9e18('0xb2'));_0x352ca5[_0x9e18('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x9e18('0x30'));}if(_0x155695['limit'])_0x352ca5[_0x9e18('0x20')](_0x155695[_0x9e18('0x20')]);if(_0x155695[_0x9e18('0x1f')])_0x352ca5[_0x9e18('0x1f')](_0x155695['offset']);return db['sequelize'][_0x9e18('0x40')](_0x352ca5['toString'](),_0x547a65);})['then'](function(_0x3aa08c){if(_0x3aa08c[_0x9e18('0x46')]>0x0)_0xda11e3['where']('ui.SmsInteractionId\x20IN\x20?',_[_0x9e18('0x2d')](_0x3aa08c,'id'));return db[_0x9e18('0x9f')]['query'](_0xda11e3['toString'](),_0x547a65)[_0x9e18('0x26')](function(_0x50abc1){var _0x1c9e8a=_['groupBy'](_0x50abc1,_0x9e18('0xb3'));var _0x2e89d1=[];_0x3aa08c['forEach'](function(_0x1aefc5){_0x2e89d1['push'](updateSmsInteraction(_0x1aefc5,_0x2bba5b,_0x1c9e8a));});return BPromise['all'](_0x2e89d1);});});})[_0x9e18('0x26')](function(_0x2b9650){_0x1821cb[_0x9e18('0xb4')]=_0x2b9650;return _0x1821cb;})['then'](respondWithFilteredResult(_0x49ac7c,_0x155695))['catch'](handleError(_0x49ac7c,null));};exports['show']=function(_0x4acad9,_0x1d2526){var _0x59359b={'raw':![],'where':{'id':_0x4acad9[_0x9e18('0xb5')]['id']}},_0x24021c={};_0x24021c[_0x9e18('0x44')]=_['keys'](db[_0x9e18('0x3c')]['rawAttributes']);_0x24021c['query']=_['keys'](_0x4acad9[_0x9e18('0x40')]);_0x24021c[_0x9e18('0x41')]=_[_0x9e18('0x42')](_0x24021c[_0x9e18('0x44')],_0x24021c[_0x9e18('0x40')]);_0x59359b[_0x9e18('0x43')]=_['intersection'](_0x24021c['model'],qs[_0x9e18('0x45')](_0x4acad9[_0x9e18('0x40')][_0x9e18('0x45')]));_0x59359b[_0x9e18('0x43')]=_0x59359b[_0x9e18('0x43')][_0x9e18('0x46')]?_0x59359b[_0x9e18('0x43')]:_0x24021c[_0x9e18('0x44')];if(_0x4acad9[_0x9e18('0x40')][_0x9e18('0xb6')]){_0x59359b[_0x9e18('0xb7')]=[{'all':!![]}];}_0x59359b=_['merge']({},_0x59359b,_0x4acad9[_0x9e18('0xb8')]);return db['SmsInteraction'][_0x9e18('0x68')](_0x59359b)[_0x9e18('0x26')](handleEntityNotFound(_0x1d2526,null))[_0x9e18('0x26')](respondWithResult(_0x1d2526,null))[_0x9e18('0x33')](handleError(_0x1d2526,null));};exports[_0x9e18('0xb9')]=function(_0x46fd42,_0x5125d0){return db[_0x9e18('0x3c')]['create'](_0x46fd42[_0x9e18('0x7c')],{})[_0x9e18('0x26')](respondWithResult(_0x5125d0,0xc9))[_0x9e18('0x33')](handleError(_0x5125d0,null));};exports[_0x9e18('0xba')]=function(_0x12572b,_0x5264c0){if(_0x12572b[_0x9e18('0x7c')]['id']){delete _0x12572b[_0x9e18('0x7c')]['id'];}return db[_0x9e18('0x3c')]['find']({'where':{'id':_0x12572b[_0x9e18('0xb5')]['id']}})['then'](handleEntityNotFound(_0x5264c0,null))['then'](saveUpdates(_0x12572b['body'],null))[_0x9e18('0x26')](respondWithResult(_0x5264c0,null))[_0x9e18('0x33')](handleError(_0x5264c0,null));};exports[_0x9e18('0x27')]=function(_0x2c7795,_0x1e9e05){return db['SmsInteraction'][_0x9e18('0x68')]({'where':{'id':_0x2c7795[_0x9e18('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1e9e05,null))[_0x9e18('0x26')](removeEntity(_0x1e9e05,null))[_0x9e18('0x33')](handleError(_0x1e9e05,null));};exports[_0x9e18('0xbb')]=function(_0xcf671a,_0x4ff729){return db['SmsInteraction'][_0x9e18('0xbb')]()[_0x9e18('0x26')](respondWithResult(_0x4ff729,null))[_0x9e18('0x33')](handleError(_0x4ff729,null));};exports[_0x9e18('0xbc')]=function(_0x3422a0,_0x222b25,_0x575716){return db[_0x9e18('0xbd')][_0x9e18('0x68')]({'where':{'id':_0x3422a0['params']['id']}})['then'](handleEntityNotFound(_0x222b25,null))[_0x9e18('0x26')](function(_0x58e3a4){if(_0x58e3a4){return _0x58e3a4['addMessage'](_0x3422a0['body'][_0x9e18('0xbe')],_[_0x9e18('0xbf')](_0x3422a0['body'],[_0x9e18('0xbe'),'id'])||{});}})[_0x9e18('0x26')](respondWithResult(_0x222b25,null))['catch'](handleError(_0x222b25,null));};exports[_0x9e18('0xc0')]=function(_0xdffa05,_0x5c5173,_0x2ee383){var _0x210fc8={'raw':![],'where':{}};var _0xd5485a={};var _0x39508d={'count':0x0,'rows':[]};return db[_0x9e18('0x3c')][_0x9e18('0xc1')]({'where':{'id':_0xdffa05[_0x9e18('0xb5')]['id']}})[_0x9e18('0x26')](handleEntityNotFound(_0x5c5173,null))[_0x9e18('0x26')](function(_0xf24544){if(_0xf24544){_0xd5485a[_0x9e18('0x44')]=_[_0x9e18('0xc2')](db[_0x9e18('0xbd')]['rawAttributes']);_0xd5485a[_0x9e18('0x40')]=_[_0x9e18('0xc2')](_0xdffa05[_0x9e18('0x40')]);_0xd5485a[_0x9e18('0x41')]=_[_0x9e18('0x42')](_0xd5485a[_0x9e18('0x44')],_0xd5485a[_0x9e18('0x40')]);_0x210fc8[_0x9e18('0x43')]=_[_0x9e18('0x42')](_0xd5485a[_0x9e18('0x44')],qs[_0x9e18('0x45')](_0xdffa05[_0x9e18('0x40')][_0x9e18('0x45')]));_0x210fc8[_0x9e18('0x43')]=_0x210fc8['attributes'][_0x9e18('0x46')]?_0x210fc8['attributes']:_0xd5485a[_0x9e18('0x44')];if(!_0xdffa05['query'][_0x9e18('0x47')](_0x9e18('0x48'))){_0x210fc8['limit']=qs['limit'](_0xdffa05[_0x9e18('0x40')][_0x9e18('0x20')]);_0x210fc8[_0x9e18('0x1f')]=qs['offset'](_0xdffa05['query']['offset']);}_0x210fc8[_0x9e18('0x94')]=qs[_0x9e18('0x49')](_0xdffa05[_0x9e18('0x40')][_0x9e18('0x49')]);_0x210fc8[_0x9e18('0x4a')]=qs['filters'](_[_0x9e18('0x4b')](_0xdffa05[_0x9e18('0x40')],_0xd5485a[_0x9e18('0x41')]));_0x210fc8[_0x9e18('0x4a')]['SmsInteractionId']=_0xf24544['id'];if(_0xdffa05[_0x9e18('0x40')][_0x9e18('0x89')]){_0x210fc8[_0x9e18('0x4a')]=_[_0x9e18('0xa2')](_0x210fc8[_0x9e18('0x4a')],{'$or':_['map'](_0x210fc8[_0x9e18('0x43')],function(_0x29e13b){var _0xb330bd={};_0xb330bd[_0x29e13b]={'$like':'%'+_0xdffa05['query'][_0x9e18('0x89')]+'%'};return _0xb330bd;})});}if(_0xdffa05[_0x9e18('0x40')][_0x9e18('0xc3')]){var _0x4b475a=_0xdffa05[_0x9e18('0x40')][_0x9e18('0xc3')][_0x9e18('0x31')](',');var _0x6da0d4={};_0x6da0d4[_0x4b475a[0x0]]={'$gte':moment(_0x4b475a[0x1])[_0x9e18('0xc4')](_0x9e18('0xc5'))};_0x210fc8[_0x9e18('0x4a')]=_['merge'](_0x210fc8['where'],_0x6da0d4);}_0x210fc8=_['merge']({},_0x210fc8,_0xdffa05[_0x9e18('0xb8')]);return db['SmsMessage']['count']({'where':_0x210fc8[_0x9e18('0x4a')]})['then'](function(_0x61cd9d){_0x39508d['count']=_0x61cd9d;if(_0xdffa05[_0x9e18('0x40')]['includeAll']){_0x210fc8['include']=[{'all':!![]}];}return db['SmsMessage'][_0x9e18('0xc6')](_0x210fc8);})[_0x9e18('0x26')](function(_0x2252e1){_0x39508d[_0x9e18('0xb4')]=_0x2252e1;return _0x39508d;});}})['then'](respondWithFilteredResult(_0x5c5173,_0x210fc8))['catch'](handleError(_0x5c5173,null));};exports[_0x9e18('0xc7')]=function(_0xb1cec,_0x14f2ef,_0x21c873){return db[_0x9e18('0x3c')][_0x9e18('0x68')]({'where':{'id':_0xb1cec[_0x9e18('0xb5')]['id']}})[_0x9e18('0x26')](handleEntityNotFound(_0x14f2ef,null))[_0x9e18('0x26')](function(_0x25cadb){if(_0x25cadb){return _0x25cadb[_0x9e18('0xc8')](_0xb1cec['body']['ids'],_['omit'](_0xb1cec[_0x9e18('0x7c')],[_0x9e18('0xbe'),'id'])||{})[_0x9e18('0xc9')](function(){return db[_0x9e18('0x78')]['findAll']({'attributes':['id',_0x9e18('0x2b'),_0x9e18('0x4e')],'where':{'id':_0xb1cec[_0x9e18('0x7c')][_0x9e18('0xbe')]}});})['then'](function(_0x946390){socket[_0x9e18('0xca')](_0x9e18('0xcb'),{'id':Number(_0xb1cec[_0x9e18('0xb5')]['id']),'tags':_0x946390||[]});return{'id':Number(_0xb1cec[_0x9e18('0xb5')]['id']),'tags':_0x946390||[]};});}})[_0x9e18('0x26')](respondWithResult(_0x14f2ef,null))[_0x9e18('0x33')](handleError(_0x14f2ef,null));};exports[_0x9e18('0xcc')]=function(_0x47655c,_0x3c46be,_0x5cbd3c){return db[_0x9e18('0x3c')][_0x9e18('0x68')]({'where':{'id':_0x47655c[_0x9e18('0xb5')]['id']}})[_0x9e18('0x26')](handleEntityNotFound(_0x3c46be,null))[_0x9e18('0x26')](function(_0x1c1170){if(_0x1c1170){return _0x1c1170[_0x9e18('0xcc')](_0x47655c[_0x9e18('0x40')][_0x9e18('0xbe')]);}})[_0x9e18('0x26')](respondWithStatusCode(_0x3c46be,null))['catch'](handleError(_0x3c46be,null));};exports['download']=function(_0x28e3f8,_0x467ee7){var _0x46536e=moment()[_0x9e18('0xcd')]()['toString']();var _0x5e104d=path[_0x9e18('0xce')](config[_0x9e18('0xcf')],'server',_0x9e18('0xd0'),'tmp');var _0x7faaa7=path[_0x9e18('0xce')](config[_0x9e18('0xcf')],_0x9e18('0xd1'),_0x9e18('0xd0'),_0x9e18('0xd2'));var _0x1eb79d=path['join'](_0x5e104d,_0x46536e);var _0x4c991a=util[_0x9e18('0xc4')](_0x9e18('0xd3'),_0x28e3f8[_0x9e18('0xb5')]['id'],_0x46536e);var _0x461de2=path[_0x9e18('0xce')](_0x5e104d,_0x4c991a);var _0xfbf5c=[];_0xfbf5c[_0x9e18('0xd4')]({'model':db['User'],'as':_0x9e18('0xd5'),'attributes':['id',_0x9e18('0x2e')],'raw':!![]});_0xfbf5c[_0x9e18('0xd4')]({'model':db[_0x9e18('0xd6')],'as':_0x9e18('0x6e'),'attributes':['id',_0x9e18('0xd7'),_0x9e18('0xd8')],'raw':!![]});var _0x230a90=[{'model':db[_0x9e18('0xbd')],'as':_0x9e18('0xd9'),'attributes':['id',_0x9e18('0x7c'),_0x9e18('0x80'),_0x9e18('0xda'),_0x9e18('0xdb'),_0x9e18('0x85')],'include':_0xfbf5c}];_0x230a90[_0x9e18('0xd4')]({'model':db[_0x9e18('0xdc')],'as':_0x9e18('0xdd'),'attributes':['id',_0x9e18('0x2b')]});_0x230a90[_0x9e18('0xd4')]({'model':db[_0x9e18('0xd5')],'as':'Owner','attributes':['id',_0x9e18('0x2e')]});return db[_0x9e18('0x3c')][_0x9e18('0x68')]({'where':{'id':_0x28e3f8[_0x9e18('0xb5')]['id']},'include':_0x230a90})[_0x9e18('0x26')](handleEntityNotFound(_0x467ee7,null))[_0x9e18('0x26')](function(_0x3f1ca5){if(_0x3f1ca5){var _0x1e109b=_0x3f1ca5[_0x9e18('0xde')]({'plain':!![]});fs['mkdirSync'](_0x1eb79d);var _0x1ab2cf={'channel':'Sms','account':_0x1e109b[_0x9e18('0xdd')]['name'],'agent':_0x1e109b[_0x9e18('0xdf')]?_0x1e109b[_0x9e18('0xdf')][_0x9e18('0x2e')]:_0x9e18('0xe0'),'createdAt':moment(_0x1e109b['createdAt'])[_0x9e18('0xc4')](_0x9e18('0xc5'))[_0x9e18('0xa0')](),'closedAt':_0x1e109b[_0x9e18('0x39')]?moment(_0x1e109b[_0x9e18('0xe1')])[_0x9e18('0xc4')](_0x9e18('0xc5'))[_0x9e18('0xa0')]():'','disposition':_0x1e109b[_0x9e18('0xe2')],'messages':_(_0x1e109b[_0x9e18('0xd9')])['filter']({'secret':![]})['map'](function(_0x6ec43){return{'date':moment(_0x6ec43[_0x9e18('0x80')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9e18('0xa0')](),'sender':_0x6ec43[_0x9e18('0xda')]===_0x9e18('0xe3')?_0x6ec43[_0x9e18('0xd5')]?_0x6ec43[_0x9e18('0xd5')][_0x9e18('0x2e')]:_0x9e18('0xe4'):_0x6ec43['Contact'][_0x9e18('0xd7')]+(_0x6ec43[_0x9e18('0x6e')]['lastName']?'\x20'+_0x6ec43[_0x9e18('0x6e')][_0x9e18('0xd8')]:''),'body':_0x6ec43[_0x9e18('0x7c')],'direction':_0x6ec43[_0x9e18('0xda')]===_0x9e18('0xe3')?'A':'C','secret':_0x6ec43[_0x9e18('0xdb')],'read':_0x6ec43[_0x9e18('0x85')]};})['value']()};return ejs[_0x9e18('0xe5')](path[_0x9e18('0xce')](config['root'],_0x9e18('0xd1'),'views',_0x9e18('0xe6')),{'interaction':_0x1ab2cf})['then'](function(_0x462f65){var _0xa7aeea=path[_0x9e18('0xce')](_0x1eb79d,_0x9e18('0xe7')+_0x1e109b['id']+'-'+_0x46536e+_0x9e18('0xe8'));var _0x104589={'path':_0xa7aeea,'channel':_0x9e18('0xe9'),'interactionId':_0x1e109b['id']};return pdf[_0x9e18('0xea')](_0x462f65,_0x104589);})[_0x9e18('0x26')](function(){return new BPromise(function(_0x518891,_0x4460bc){zipdir(_0x1eb79d,{'saveTo':_0x461de2},function(_0x1fe2b7,_0x20f271){if(_0x1fe2b7)return _0x4460bc(_0x1fe2b7);return _0x518891(_0x20f271);});})[_0x9e18('0x26')](function(){return new BPromise(function(_0x52c5fb,_0x369785){rimraf(_0x1eb79d,function(_0x5ac806){if(_0x5ac806)_0x369785(_0x5ac806);return _0x52c5fb();});});})[_0x9e18('0x26')](function(){return _0x467ee7[_0x9e18('0xeb')](_0x461de2,_0x4c991a,function(_0x2fdc10){if(_0x2fdc10){console[_0x9e18('0xec')](_0x9e18('0xed'),_0x2fdc10);}else{fs[_0x9e18('0xee')](_0x461de2);}});});});}else{return _0x467ee7[_0x9e18('0x29')](0xc8);}})[_0x9e18('0x33')](handleError(_0x467ee7,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index ff52e10..ed65624 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d04=['SmsInteraction','SmsMessage','setMaxListeners','save','update','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3d04,0xbe));var _0x43d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3d04[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x43d0('0x0'));var SmsInteraction=require(_0x43d0('0x1'))['db'][_0x43d0('0x2')];var SmsMessage=require(_0x43d0('0x1'))['db'][_0x43d0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x43d0('0x4')](0x0);var events={'afterCreate':_0x43d0('0x5'),'afterUpdate':_0x43d0('0x6'),'afterDestroy':'remove'};function emitEvent(_0x2a4d4c){return function(_0x1a75d4,_0x746f5e,_0x617bf){_0x1a75d4['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x50919e){_0x1a75d4['setDataValue'](_0x43d0('0x7'),_0x50919e[_0x43d0('0x8')](function(_0x331421){return{'id':_0x331421['id']};}));return SmsMessage[_0x43d0('0x9')]({'where':{'SmsInteractionId':_0x1a75d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x43d0('0xa')](function(_0x4d75d9){_0x1a75d4['setDataValue'](_0x43d0('0xb'),_0x4d75d9['length']);SmsInteractionEvents['emit'](_0x2a4d4c+':'+_0x1a75d4['id'],_0x1a75d4);SmsInteractionEvents[_0x43d0('0xc')](_0x2a4d4c,_0x1a75d4);_0x617bf(null);})[_0x43d0('0xd')](_0x617bf(null));};}for(var e in events){if(events[_0x43d0('0xe')](e)){var event=events[e];SmsInteraction[_0x43d0('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x93e9=['getUsers','then','setDataValue','map','findAll','unreadMessages','emit','hook','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x44b4ba,_0x4c479f){var _0x21bef9=function(_0x546389){while(--_0x546389){_0x44b4ba['push'](_0x44b4ba['shift']());}};_0x21bef9(++_0x4c479f);}(_0x93e9,0xcc));var _0x993e=function(_0x2c862e,_0x13279c){_0x2c862e=_0x2c862e-0x0;var _0x2ec7ab=_0x93e9[_0x2c862e];return _0x2ec7ab;};'use strict';var EventEmitter=require(_0x993e('0x0'));var SmsInteraction=require(_0x993e('0x1'))['db'][_0x993e('0x2')];var SmsMessage=require(_0x993e('0x1'))['db'][_0x993e('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x993e('0x4')](0x0);var events={'afterCreate':_0x993e('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b762e){return function(_0x255045,_0x15ce9b,_0x45f52e){_0x255045[_0x993e('0x6')]({'attributes':['id'],'raw':!![]})[_0x993e('0x7')](function(_0x12ac94){_0x255045[_0x993e('0x8')]('Users',_0x12ac94[_0x993e('0x9')](function(_0x69ff1){return{'id':_0x69ff1['id']};}));return SmsMessage[_0x993e('0xa')]({'where':{'SmsInteractionId':_0x255045['id'],'direction':'in','read':![]},'raw':!![]});})[_0x993e('0x7')](function(_0x2cd389){_0x255045[_0x993e('0x8')](_0x993e('0xb'),_0x2cd389['length']);SmsInteractionEvents[_0x993e('0xc')](_0x1b762e+':'+_0x255045['id'],_0x255045);SmsInteractionEvents[_0x993e('0xc')](_0x1b762e,_0x255045);_0x45f52e(null);})['catch'](_0x45f52e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x993e('0xd')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 01311fb..e86fb88 100644 --- a/server/api/smsInteraction/smsInteraction.model.js +++ b/server/api/smsInteraction/smsInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0e9=['../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x4990dd,_0xe8dbe8){var _0x2628ff=function(_0x589013){while(--_0x589013){_0x4990dd['push'](_0x4990dd['shift']());}};_0x2628ff(++_0xe8dbe8);}(_0xd0e9,0x11c));var _0x9d0e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd0e9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9d0e('0x0'));var util=require('util');var logger=require(_0x9d0e('0x1'))(_0x9d0e('0x2'));var moment=require(_0x9d0e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d0e('0x4'));var rimraf=require(_0x9d0e('0x5'));var config=require(_0x9d0e('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x9d0e('0x7')]=function(_0x2904a3,_0x4af70f){return _0x2904a3[_0x9d0e('0x8')](_0x9d0e('0x9'),attributes,{'tableName':_0x9d0e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a1451,_0x205985,_0x93ce6){if(_0x5a1451[_0x9d0e('0xb')](_0x9d0e('0xc'))){_0x5a1451['closedAt']=moment()[_0x9d0e('0xd')](_0x9d0e('0xe'));}_0x93ce6(null,_0x5a1451);}}});}; \ No newline at end of file +var _0x83d6=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','util','api','bluebird','request-promise','path'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0x83d6,0x1db));var _0x683d=function(_0x1ef3fd,_0x2532fd){_0x1ef3fd=_0x1ef3fd-0x0;var _0x2a31a1=_0x83d6[_0x1ef3fd];return _0x2a31a1;};'use strict';var _=require('lodash');var util=require(_0x683d('0x0'));var logger=require('../../config/logger')(_0x683d('0x1'));var moment=require('moment');var BPromise=require(_0x683d('0x2'));var rp=require(_0x683d('0x3'));var fs=require('fs');var path=require(_0x683d('0x4'));var rimraf=require('rimraf');var config=require(_0x683d('0x5'));var attributes=require(_0x683d('0x6'));module[_0x683d('0x7')]=function(_0x3f5279,_0x4ff1d2){return _0x3f5279[_0x683d('0x8')](_0x683d('0x9'),attributes,{'tableName':_0x683d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x148c79,_0x3edfdb,_0x15e3dd){if(_0x148c79[_0x683d('0xb')](_0x683d('0xc'))){_0x148c79[_0x683d('0xd')]=moment()[_0x683d('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x15e3dd(null,_0x148c79);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 8ac9395..835b9f6 100644 --- a/server/api/smsInteraction/smsInteraction.rpc.js +++ b/server/api/smsInteraction/smsInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a96=['./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x270696,_0x4aacdd){var _0x285ee7=function(_0x43823d){while(--_0x43823d){_0x270696['push'](_0x270696['shift']());}};_0x285ee7(++_0x4aacdd);}(_0x4a96,0x1de));var _0x64a9=function(_0xe09cd,_0x4ddfd1){_0xe09cd=_0xe09cd-0x0;var _0x2ab735=_0x4a96[_0xe09cd];return _0x2ab735;};'use strict';var _=require(_0x64a9('0x0'));var util=require('util');var moment=require(_0x64a9('0x1'));var BPromise=require(_0x64a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64a9('0x3'));var db=require(_0x64a9('0x4'))['db'];var utils=require(_0x64a9('0x5'));var logger=require(_0x64a9('0x6'))('rpc');var config=require(_0x64a9('0x7'));var jayson=require(_0x64a9('0x8'));var client=jayson['client'][_0x64a9('0x9')]({'port':0x232a});config[_0x64a9('0xa')]=_[_0x64a9('0xb')](config[_0x64a9('0xa')],{'host':_0x64a9('0xc'),'port':0x18eb});var socket=require(_0x64a9('0xd'))(new Redis(config[_0x64a9('0xa')]));require(_0x64a9('0xe'))[_0x64a9('0xf')](socket);function respondWithRpcPromise(_0x2b1c43,_0x2de7a0,_0x59e455){return new BPromise(function(_0xa6ce38,_0x3e1288){return client['request'](_0x2b1c43,_0x59e455)[_0x64a9('0x10')](function(_0x383c60){logger[_0x64a9('0x11')](_0x64a9('0x12'),_0x2de7a0,_0x64a9('0x13'));logger[_0x64a9('0x14')](_0x64a9('0x15'),_0x2de7a0,_0x64a9('0x13'),JSON[_0x64a9('0x16')](_0x383c60));if(_0x383c60[_0x64a9('0x17')]){if(_0x383c60[_0x64a9('0x17')][_0x64a9('0x18')]===0x1f4){logger[_0x64a9('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x2de7a0,_0x383c60['error'][_0x64a9('0x19')]);return _0x3e1288(_0x383c60[_0x64a9('0x17')]['message']);}logger[_0x64a9('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x2de7a0,_0x383c60[_0x64a9('0x17')][_0x64a9('0x19')]);return _0xa6ce38(_0x383c60[_0x64a9('0x17')]['message']);}else{logger['info'](_0x64a9('0x12'),_0x2de7a0,'request\x20sent');_0xa6ce38(_0x383c60[_0x64a9('0x1a')][_0x64a9('0x19')]);}})[_0x64a9('0x1b')](function(_0x17ae5a){logger[_0x64a9('0x17')](_0x64a9('0x12'),_0x2de7a0,_0x17ae5a);_0x3e1288(_0x17ae5a);});});}exports[_0x64a9('0x1c')]=function(_0x2d7254){var _0x39a7a7=this;return new Promise(function(_0x58a82b,_0x14ac13){return db[_0x64a9('0x1d')][_0x64a9('0x1e')](_0x2d7254[_0x64a9('0x1f')],{'raw':_0x2d7254[_0x64a9('0x20')]?_0x2d7254[_0x64a9('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d7254[_0x64a9('0x20')]?_0x2d7254[_0x64a9('0x20')][_0x64a9('0x21')]||null:null,'attributes':_0x2d7254[_0x64a9('0x20')]?_0x2d7254[_0x64a9('0x20')][_0x64a9('0x22')]||null:null,'limit':_0x2d7254[_0x64a9('0x20')]?_0x2d7254[_0x64a9('0x20')][_0x64a9('0x23')]||null:null})[_0x64a9('0x10')](function(_0x4dad9a){logger[_0x64a9('0x11')]('UpdateSmsInteraction',_0x2d7254);logger[_0x64a9('0x14')](_0x64a9('0x1c'),_0x2d7254,JSON[_0x64a9('0x16')](_0x4dad9a));_0x58a82b(_0x4dad9a);})[_0x64a9('0x1b')](function(_0xd85743){logger[_0x64a9('0x17')](_0x64a9('0x1c'),_0xd85743[_0x64a9('0x19')],_0x2d7254);_0x14ac13(_0x39a7a7[_0x64a9('0x17')](0x1f4,_0xd85743[_0x64a9('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1fe638){return new Promise(function(_0x44e380,_0x53674f){return db['SmsInteraction'][_0x64a9('0x24')]({'where':_0x1fe638[_0x64a9('0x20')]?_0x1fe638[_0x64a9('0x20')][_0x64a9('0x21')]||null:null})[_0x64a9('0x10')](function(_0x35d603){if(_0x35d603){return _0x35d603[_0x64a9('0x25')](_0x1fe638[_0x64a9('0x1f')][_0x64a9('0x26')],_[_0x64a9('0x27')](_0x1fe638[_0x64a9('0x1f')],[_0x64a9('0x26'),'id'])||{});}})['spread'](function(_0x2a269b){logger[_0x64a9('0x11')](_0x64a9('0x28'),_0x1fe638);logger[_0x64a9('0x14')](_0x64a9('0x28'),_0x1fe638,JSON[_0x64a9('0x16')](_0x2a269b));_0x44e380(_0x2a269b);})[_0x64a9('0x1b')](function(_0x5f39b2){logger[_0x64a9('0x17')](_0x64a9('0x28'),_0x5f39b2['message'],_0x1fe638);_0x53674f(_this[_0x64a9('0x17')](0x1f4,_0x5f39b2[_0x64a9('0x19')]));});});}; \ No newline at end of file +var _0x8a70=['body','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsInteraction','update','options','raw','where','attributes','limit','UpdateSmsInteraction','stringify','find','addTags'];(function(_0x1d949c,_0x596176){var _0x29e31b=function(_0x15c93a){while(--_0x15c93a){_0x1d949c['push'](_0x1d949c['shift']());}};_0x29e31b(++_0x596176);}(_0x8a70,0xfb));var _0x08a7=function(_0x3a9bde,_0x5886ae){_0x3a9bde=_0x3a9bde-0x0;var _0x58efa2=_0x8a70[_0x3a9bde];return _0x58efa2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08a7('0x0'));var BPromise=require(_0x08a7('0x1'));var rs=require(_0x08a7('0x2'));var fs=require('fs');var Redis=require(_0x08a7('0x3'));var db=require(_0x08a7('0x4'))['db'];var utils=require(_0x08a7('0x5'));var logger=require('../../config/logger')(_0x08a7('0x6'));var config=require('../../config/environment');var jayson=require(_0x08a7('0x7'));var client=jayson[_0x08a7('0x8')]['http']({'port':0x232a});config[_0x08a7('0x9')]=_[_0x08a7('0xa')](config['redis'],{'host':_0x08a7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x08a7('0x9')]));require(_0x08a7('0xc'))[_0x08a7('0xd')](socket);function respondWithRpcPromise(_0x38467e,_0x505994,_0x281a1e){return new BPromise(function(_0x63d654,_0x9a1085){return client['request'](_0x38467e,_0x281a1e)[_0x08a7('0xe')](function(_0x3ca388){logger[_0x08a7('0xf')](_0x08a7('0x10'),_0x505994,_0x08a7('0x11'));logger[_0x08a7('0x12')](_0x08a7('0x13'),_0x505994,'request\x20sent',JSON['stringify'](_0x3ca388));if(_0x3ca388[_0x08a7('0x14')]){if(_0x3ca388[_0x08a7('0x14')][_0x08a7('0x15')]===0x1f4){logger[_0x08a7('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x505994,_0x3ca388['error'][_0x08a7('0x16')]);return _0x9a1085(_0x3ca388['error']['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x505994,_0x3ca388['error'][_0x08a7('0x16')]);return _0x63d654(_0x3ca388['error'][_0x08a7('0x16')]);}else{logger['info'](_0x08a7('0x10'),_0x505994,_0x08a7('0x11'));_0x63d654(_0x3ca388[_0x08a7('0x17')]['message']);}})[_0x08a7('0x18')](function(_0x516989){logger[_0x08a7('0x14')](_0x08a7('0x10'),_0x505994,_0x516989);_0x9a1085(_0x516989);});});}exports['UpdateSmsInteraction']=function(_0x45f1dd){var _0x1b21a9=this;return new Promise(function(_0xba6c63,_0x3b5137){return db[_0x08a7('0x19')][_0x08a7('0x1a')](_0x45f1dd['body'],{'raw':_0x45f1dd[_0x08a7('0x1b')]?_0x45f1dd[_0x08a7('0x1b')][_0x08a7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f1dd['options']?_0x45f1dd[_0x08a7('0x1b')][_0x08a7('0x1d')]||null:null,'attributes':_0x45f1dd['options']?_0x45f1dd['options'][_0x08a7('0x1e')]||null:null,'limit':_0x45f1dd[_0x08a7('0x1b')]?_0x45f1dd[_0x08a7('0x1b')][_0x08a7('0x1f')]||null:null})[_0x08a7('0xe')](function(_0x4ea08c){logger[_0x08a7('0xf')](_0x08a7('0x20'),_0x45f1dd);logger[_0x08a7('0x12')](_0x08a7('0x20'),_0x45f1dd,JSON[_0x08a7('0x21')](_0x4ea08c));_0xba6c63(_0x4ea08c);})[_0x08a7('0x18')](function(_0x11698f){logger[_0x08a7('0x14')]('UpdateSmsInteraction',_0x11698f['message'],_0x45f1dd);_0x3b5137(_0x1b21a9[_0x08a7('0x14')](0x1f4,_0x11698f['message']));});});};exports['AddTagsToSmsInteraction']=function(_0xd26fff){return new Promise(function(_0x128802,_0x5980f3){return db[_0x08a7('0x19')][_0x08a7('0x22')]({'where':_0xd26fff[_0x08a7('0x1b')]?_0xd26fff['options'][_0x08a7('0x1d')]||null:null})['then'](function(_0x3f60dc){if(_0x3f60dc){return _0x3f60dc[_0x08a7('0x23')](_0xd26fff[_0x08a7('0x24')][_0x08a7('0x25')],_[_0x08a7('0x26')](_0xd26fff[_0x08a7('0x24')],[_0x08a7('0x25'),'id'])||{});}})[_0x08a7('0x27')](function(_0x3139b6){logger['info'](_0x08a7('0x28'),_0xd26fff);logger[_0x08a7('0x12')](_0x08a7('0x28'),_0xd26fff,JSON[_0x08a7('0x21')](_0x3139b6));_0x128802(_0x3139b6);})[_0x08a7('0x18')](function(_0x2f87bb){logger[_0x08a7('0x14')](_0x08a7('0x28'),_0x2f87bb[_0x08a7('0x16')],_0xd26fff);_0x5980f3(_this[_0x08a7('0x14')](0x1f4,_0x2f87bb['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d87728c..a05c30c 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd539=['length','./smsInteraction.events','save','remove','update','removeListener','register'];(function(_0x25f372,_0x18327c){var _0x1069b7=function(_0x4566dc){while(--_0x4566dc){_0x25f372['push'](_0x25f372['shift']());}};_0x1069b7(++_0x18327c);}(_0xd539,0x8d));var _0x9d53=function(_0x1425de,_0x2f9311){_0x1425de=_0x1425de-0x0;var _0x1992e0=_0xd539[_0x1425de];return _0x1992e0;};'use strict';var SmsInteractionEvents=require(_0x9d53('0x0'));var events=[_0x9d53('0x1'),_0x9d53('0x2'),_0x9d53('0x3')];function createListener(_0x53aa61,_0x5380fa){return function(_0x244500){_0x5380fa['emit'](_0x53aa61,_0x244500);};}function removeListener(_0x139b69,_0x334856){return function(){SmsInteractionEvents[_0x9d53('0x4')](_0x139b69,_0x334856);};}exports[_0x9d53('0x5')]=function(_0x566459){for(var _0x219465=0x0,_0x349370=events[_0x9d53('0x6')];_0x219465<_0x349370;_0x219465++){var _0x2f82ed=events[_0x219465];var _0x14fcef=createListener('smsInteraction:'+_0x2f82ed,_0x566459);SmsInteractionEvents['on'](_0x2f82ed,_0x14fcef);}}; \ No newline at end of file +var _0xb3aa=['smsInteraction:','./smsInteraction.events','update','emit','register','length'];(function(_0x469ae2,_0x24cd30){var _0x5e33e4=function(_0x1aaeb1){while(--_0x1aaeb1){_0x469ae2['push'](_0x469ae2['shift']());}};_0x5e33e4(++_0x24cd30);}(_0xb3aa,0xaf));var _0xab3a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3aa[_0x20a584];return _0x4b41a8;};'use strict';var SmsInteractionEvents=require(_0xab3a('0x0'));var events=['save','remove',_0xab3a('0x1')];function createListener(_0x153f92,_0x2a2174){return function(_0x1a63a6){_0x2a2174[_0xab3a('0x2')](_0x153f92,_0x1a63a6);};}function removeListener(_0x34241a,_0x3858b1){return function(){SmsInteractionEvents['removeListener'](_0x34241a,_0x3858b1);};}exports[_0xab3a('0x3')]=function(_0x131a8b){for(var _0x594c6a=0x0,_0x55841e=events[_0xab3a('0x4')];_0x594c6a<_0x55841e;_0x594c6a++){var _0x12b0a8=events[_0x594c6a];var _0x4e4919=createListener(_0xab3a('0x5')+_0x12b0a8,_0x131a8b);SmsInteractionEvents['on'](_0x12b0a8,_0x4e4919);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ea7932e..feb2e21 100644 --- a/server/api/smsMessage/index.js +++ b/server/api/smsMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49f5=['isAuthenticated','index','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x49f5,0x18c));var _0x549f=function(_0x525308,_0x5898c9){_0x525308=_0x525308-0x0;var _0x5a6e40=_0x49f5[_0x525308];return _0x5a6e40;};'use strict';var multer=require(_0x549f('0x0'));var util=require(_0x549f('0x1'));var path=require('path');var timeout=require(_0x549f('0x2'));var express=require(_0x549f('0x3'));var router=express[_0x549f('0x4')]();var fs_extra=require(_0x549f('0x5'));var auth=require(_0x549f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x549f('0x7'));var controller=require(_0x549f('0x8'));router[_0x549f('0x9')]('/',auth[_0x549f('0xa')](),controller[_0x549f('0xb')]);router[_0x549f('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x549f('0x9')](_0x549f('0xc'),auth[_0x549f('0xa')](),controller[_0x549f('0xd')]);router[_0x549f('0xe')]('/',auth[_0x549f('0xa')](),interaction[_0x549f('0xf')](_0x549f('0x10'),_0x549f('0x11')),controller[_0x549f('0x12')]);router[_0x549f('0xe')](_0x549f('0x13'),controller[_0x549f('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x549f('0x15')]);router[_0x549f('0x16')]('/:id/accept',auth[_0x549f('0xa')](),controller[_0x549f('0x17')]);router[_0x549f('0x16')](_0x549f('0x18'),auth['isAuthenticated'](),controller[_0x549f('0x19')]);router[_0x549f('0x1a')](_0x549f('0xc'),auth[_0x549f('0xa')](),controller[_0x549f('0x1b')]);module[_0x549f('0x1c')]=router; \ No newline at end of file +var _0x3e05=['sms','smsmessage:create','create','/:id/status','status','put','/:id','update','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked'];(function(_0x32c7b5,_0x102aa2){var _0x1b1532=function(_0x208550){while(--_0x208550){_0x32c7b5['push'](_0x32c7b5['shift']());}};_0x1b1532(++_0x102aa2);}(_0x3e05,0x64));var _0x53e0=function(_0x2cfd53,_0x55a1d5){_0x2cfd53=_0x2cfd53-0x0;var _0x1df864=_0x3e05[_0x2cfd53];return _0x1df864;};'use strict';var multer=require('multer');var util=require(_0x53e0('0x0'));var path=require(_0x53e0('0x1'));var timeout=require(_0x53e0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x53e0('0x3'));var auth=require(_0x53e0('0x4'));var interaction=require(_0x53e0('0x5'));var config=require(_0x53e0('0x6'));var controller=require(_0x53e0('0x7'));router[_0x53e0('0x8')]('/',auth[_0x53e0('0x9')](),controller[_0x53e0('0xa')]);router[_0x53e0('0x8')](_0x53e0('0xb'),auth['isAuthenticated'](),controller[_0x53e0('0xc')]);router['get']('/:id',auth[_0x53e0('0x9')](),controller[_0x53e0('0xd')]);router[_0x53e0('0xe')]('/',auth[_0x53e0('0x9')](),interaction[_0x53e0('0xf')](_0x53e0('0x10'),_0x53e0('0x11')),controller[_0x53e0('0x12')]);router['post'](_0x53e0('0x13'),controller[_0x53e0('0x14')]);router[_0x53e0('0x15')](_0x53e0('0x16'),auth[_0x53e0('0x9')](),controller[_0x53e0('0x17')]);router[_0x53e0('0x15')]('/:id/accept',auth['isAuthenticated'](),controller[_0x53e0('0x18')]);router[_0x53e0('0x15')](_0x53e0('0x19'),auth[_0x53e0('0x9')](),controller[_0x53e0('0x1a')]);router['delete'](_0x53e0('0x16'),auth[_0x53e0('0x9')](),controller[_0x53e0('0x1b')]);module[_0x53e0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 5996da0..5c18b42 100644 --- a/server/api/smsMessage/smsMessage.attributes.js +++ b/server/api/smsMessage/smsMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a14=['TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0xedeb50,_0x5481cf){var _0x48ded6=function(_0x14af51){while(--_0x14af51){_0xedeb50['push'](_0xedeb50['shift']());}};_0x48ded6(++_0x5481cf);}(_0x9a14,0xa8));var _0x49a1=function(_0x15fdf6,_0x346502){_0x15fdf6=_0x15fdf6-0x0;var _0x9244d=_0x9a14[_0x15fdf6];return _0x9244d;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x49a1('0x0')](_0x49a1('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x49a1('0x3')]('in',_0x49a1('0x4')),'defaultValue':_0x49a1('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x49a1('0x5')](0xbe)},'phone':{'type':Sequelize[_0x49a1('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7250=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x4aed0a,_0x3f4a74){var _0x2a2430=function(_0x43639b){while(--_0x43639b){_0x4aed0a['push'](_0x4aed0a['shift']());}};_0x2a2430(++_0x3f4a74);}(_0x7250,0x1b1));var _0x0725=function(_0x3bded1,_0x485fa1){_0x3bded1=_0x3bded1-0x0;var _0x184881=_0x7250[_0x3bded1];return _0x184881;};'use strict';var Sequelize=require(_0x0725('0x0'));module[_0x0725('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0725('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0725('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0725('0x4')]('in',_0x0725('0x5')),'defaultValue':_0x0725('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0725('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0725('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0725('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 361c4c2..f2c404f 100644 --- a/server/api/smsMessage/smsMessage.controller.js +++ b/server/api/smsMessage/smsMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb8d=['ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','manual','interface','channel','motionChannel','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','email','SIP/%s','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','plivio','infobip','results','groupName','eml-format','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','rawAttributes','type','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SmsMessage','then','include','rows','catch','keys','includeAll','create','body','find','params','describe','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','SmsInteractionId','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'];(function(_0x21288b,_0x4b0d32){var _0x4f999e=function(_0x846a62){while(--_0x846a62){_0x21288b['push'](_0x21288b['shift']());}};_0x4f999e(++_0x4b0d32);}(_0xbb8d,0x146));var _0xdbb8=function(_0x47305c,_0x45ca6d){_0x47305c=_0x47305c-0x0;var _0x12b94d=_0xbb8d[_0x47305c];return _0x12b94d;};'use strict';var emlformat=require(_0xdbb8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdbb8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdbb8('0x2'));var Mustache=require(_0xdbb8('0x3'));var util=require(_0xdbb8('0x4'));var path=require(_0xdbb8('0x5'));var sox=require(_0xdbb8('0x6'));var csv=require('to-csv');var ejs=require(_0xdbb8('0x7'));var fs=require('fs');var fs_extra=require(_0xdbb8('0x8'));var _=require(_0xdbb8('0x9'));var squel=require(_0xdbb8('0xa'));var crypto=require('crypto');var jsforce=require(_0xdbb8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdbb8('0xc'));var querystring=require(_0xdbb8('0xd'));var Papa=require('papaparse');var Redis=require(_0xdbb8('0xe'));var authService=require(_0xdbb8('0xf'));var qs=require(_0xdbb8('0x10'));var as=require(_0xdbb8('0x11'));var hardwareService=require(_0xdbb8('0x12'));var logger=require(_0xdbb8('0x13'))(_0xdbb8('0x14'));var utils=require(_0xdbb8('0x15'));var config=require(_0xdbb8('0x16'));var licenseUtil=require(_0xdbb8('0x17'));var db=require('../../mysqldb')['db'];config[_0xdbb8('0x18')]=_[_0xdbb8('0x19')](config[_0xdbb8('0x18')],{'host':_0xdbb8('0x1a'),'port':0x18eb});var socket=require(_0xdbb8('0x1b'))(new Redis(config[_0xdbb8('0x18')]));require(_0xdbb8('0x1c'))[_0xdbb8('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdbb8('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xdbb8('0x1e')][_0xdbb8('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2f3b5f,_0x3180a7,_0x23904e,_0x5457e2){return new BPromise(function(_0xcb4833,_0x5455c2){var _0x56532a=_0x5457e2||client;return _0x56532a[_0xdbb8('0x20')](_0x2f3b5f,_0x23904e)['then'](function(_0x3db30e){logger[_0xdbb8('0x21')](_0xdbb8('0x22'),_0x3180a7,_0xdbb8('0x23'));logger[_0xdbb8('0x24')](_0xdbb8('0x25'),_0x3180a7,_0xdbb8('0x23'),JSON[_0xdbb8('0x26')](_0x3db30e));if(_0x3db30e['error']){if(_0x3db30e['error'][_0xdbb8('0x27')]===0x1f4){logger[_0xdbb8('0x28')](_0xdbb8('0x22'),_0x3180a7,_0x3db30e[_0xdbb8('0x28')][_0xdbb8('0x29')]);return _0x5455c2(_0x3db30e[_0xdbb8('0x28')][_0xdbb8('0x29')]);}logger[_0xdbb8('0x28')](_0xdbb8('0x22'),_0x3180a7,_0x3db30e['error'][_0xdbb8('0x29')]);return _0xcb4833(_0x3db30e[_0xdbb8('0x28')][_0xdbb8('0x29')]);}else{logger['info'](_0xdbb8('0x22'),_0x3180a7,_0xdbb8('0x23'));_0xcb4833(_0x3db30e['result'][_0xdbb8('0x29')]);}})['catch'](function(_0x447af4){logger[_0xdbb8('0x28')](_0xdbb8('0x22'),_0x3180a7,_0x447af4);_0x5455c2(_0x447af4);});});}function respondWithStatusCode(_0x365da0,_0x582916){_0x582916=_0x582916||0xcc;return function(_0x581ee5){if(_0x581ee5){return _0x365da0[_0xdbb8('0x2a')](_0x582916);}return _0x365da0['status'](_0x582916)['end']();};}function respondWithResult(_0x2921f7,_0xc3965b){_0xc3965b=_0xc3965b||0xc8;return function(_0x5397f6){if(_0x5397f6){return _0x2921f7['status'](_0xc3965b)[_0xdbb8('0x2b')](_0x5397f6);}};}function respondWithFilteredResult(_0x2e907b,_0x4f2276){return function(_0x2331e2){if(_0x2331e2){var _0xf7e4ee=typeof _0x4f2276[_0xdbb8('0x2c')]===_0xdbb8('0x2d')&&typeof _0x4f2276[_0xdbb8('0x2e')]===_0xdbb8('0x2d');var _0xd86ac8=_0x2331e2[_0xdbb8('0x2f')];var _0x148763=_0xf7e4ee?0x0:_0x4f2276[_0xdbb8('0x2c')];var _0x3cf623=_0xf7e4ee?_0x2331e2[_0xdbb8('0x2f')]:_0x4f2276[_0xdbb8('0x2c')]+_0x4f2276[_0xdbb8('0x2e')];var _0x5dfd0d;if(_0x3cf623>=_0xd86ac8){_0x3cf623=_0xd86ac8;_0x5dfd0d=0xc8;}else{_0x5dfd0d=0xce;}_0x2e907b[_0xdbb8('0x30')](_0x5dfd0d);return _0x2e907b[_0xdbb8('0x31')](_0xdbb8('0x32'),_0x148763+'-'+_0x3cf623+'/'+_0xd86ac8)[_0xdbb8('0x2b')](_0x2331e2);}return null;};}function patchUpdates(_0x48d568){return function(_0x3f1eea){try{jsonpatch[_0xdbb8('0x33')](_0x3f1eea,_0x48d568,!![]);}catch(_0x14b1dd){return BPromise[_0xdbb8('0x34')](_0x14b1dd);}return _0x3f1eea[_0xdbb8('0x35')]();};}function saveUpdates(_0x3678e4,_0x9c191){return function(_0x221d58){if(_0x221d58){return _0x221d58[_0xdbb8('0x36')](_0x3678e4)['then'](function(_0x5a4c42){return _0x5a4c42;});}return null;};}function removeEntity(_0x4a3e42,_0x208a71){return function(_0x3c49ec){if(_0x3c49ec){return _0x3c49ec[_0xdbb8('0x37')]()['then'](function(){_0x4a3e42[_0xdbb8('0x30')](0xcc)[_0xdbb8('0x38')]();});}};}function handleEntityNotFound(_0x26659f,_0x4dd991){return function(_0x1c5c1e){if(!_0x1c5c1e){_0x26659f[_0xdbb8('0x2a')](0x194);}return _0x1c5c1e;};}function handleError(_0x1657b7,_0x45dd83){_0x45dd83=_0x45dd83||0x1f4;return function(_0x5187c8){logger[_0xdbb8('0x28')](_0x5187c8[_0xdbb8('0x39')]);if(_0x5187c8[_0xdbb8('0x3a')]){delete _0x5187c8[_0xdbb8('0x3a')];}_0x1657b7[_0xdbb8('0x30')](_0x45dd83)[_0xdbb8('0x3b')](_0x5187c8);};}exports['index']=function(_0x4564f1,_0x23ab07){var _0x14aa73={},_0x1c5b80={},_0x19aa14={'count':0x0,'rows':[]};var _0x2ffc8d=_['map'](db['SmsMessage'][_0xdbb8('0x3c')],function(_0x418909){return{'name':_0x418909['fieldName'],'type':_0x418909[_0xdbb8('0x3d')][_0xdbb8('0x3e')]};});_0x1c5b80['model']=_[_0xdbb8('0x3f')](_0x2ffc8d,_0xdbb8('0x3a'));_0x1c5b80[_0xdbb8('0x40')]=_['keys'](_0x4564f1[_0xdbb8('0x40')]);_0x1c5b80[_0xdbb8('0x41')]=_[_0xdbb8('0x42')](_0x1c5b80['model'],_0x1c5b80[_0xdbb8('0x40')]);_0x14aa73[_0xdbb8('0x43')]=_[_0xdbb8('0x42')](_0x1c5b80[_0xdbb8('0x44')],qs[_0xdbb8('0x45')](_0x4564f1[_0xdbb8('0x40')][_0xdbb8('0x45')]));_0x14aa73[_0xdbb8('0x43')]=_0x14aa73[_0xdbb8('0x43')][_0xdbb8('0x46')]?_0x14aa73[_0xdbb8('0x43')]:_0x1c5b80[_0xdbb8('0x44')];if(!_0x4564f1['query'][_0xdbb8('0x47')](_0xdbb8('0x48'))){_0x14aa73['limit']=qs[_0xdbb8('0x2e')](_0x4564f1[_0xdbb8('0x40')]['limit']);_0x14aa73[_0xdbb8('0x2c')]=qs[_0xdbb8('0x2c')](_0x4564f1[_0xdbb8('0x40')][_0xdbb8('0x2c')]);}_0x14aa73[_0xdbb8('0x49')]=qs[_0xdbb8('0x4a')](_0x4564f1['query'][_0xdbb8('0x4a')]);_0x14aa73[_0xdbb8('0x4b')]=qs[_0xdbb8('0x41')](_[_0xdbb8('0x4c')](_0x4564f1['query'],_0x1c5b80[_0xdbb8('0x41')]),_0x2ffc8d);if(_0x4564f1[_0xdbb8('0x40')][_0xdbb8('0x4d')]){_0x14aa73['where']=_['merge'](_0x14aa73[_0xdbb8('0x4b')],{'$or':_[_0xdbb8('0x3f')](_0x2ffc8d,function(_0x3ebdcb){if(_0x3ebdcb[_0xdbb8('0x3d')]!==_0xdbb8('0x4e')){var _0x4ee2af={};_0x4ee2af[_0x3ebdcb[_0xdbb8('0x3a')]]={'$like':'%'+_0x4564f1[_0xdbb8('0x40')]['filter']+'%'};return _0x4ee2af;}})});}_0x14aa73=_[_0xdbb8('0x4f')]({},_0x14aa73,_0x4564f1[_0xdbb8('0x50')]);var _0x4b4920={'where':_0x14aa73[_0xdbb8('0x4b')]};return db[_0xdbb8('0x51')][_0xdbb8('0x2f')](_0x4b4920)[_0xdbb8('0x52')](function(_0x55b1c2){_0x19aa14['count']=_0x55b1c2;if(_0x4564f1[_0xdbb8('0x40')]['includeAll']){_0x14aa73[_0xdbb8('0x53')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x14aa73);})[_0xdbb8('0x52')](function(_0x4105b2){_0x19aa14[_0xdbb8('0x54')]=_0x4105b2;return _0x19aa14;})['then'](respondWithFilteredResult(_0x23ab07,_0x14aa73))[_0xdbb8('0x55')](handleError(_0x23ab07,null));};exports['show']=function(_0x3610d7,_0x2d95b0){var _0x2579e4={'raw':!![],'where':{'id':_0x3610d7['params']['id']}},_0xa96802={};_0xa96802[_0xdbb8('0x44')]=_[_0xdbb8('0x56')](db[_0xdbb8('0x51')][_0xdbb8('0x3c')]);_0xa96802[_0xdbb8('0x40')]=_[_0xdbb8('0x56')](_0x3610d7[_0xdbb8('0x40')]);_0xa96802[_0xdbb8('0x41')]=_[_0xdbb8('0x42')](_0xa96802['model'],_0xa96802[_0xdbb8('0x40')]);_0x2579e4[_0xdbb8('0x43')]=_[_0xdbb8('0x42')](_0xa96802[_0xdbb8('0x44')],qs[_0xdbb8('0x45')](_0x3610d7[_0xdbb8('0x40')]['fields']));_0x2579e4[_0xdbb8('0x43')]=_0x2579e4[_0xdbb8('0x43')]['length']?_0x2579e4['attributes']:_0xa96802[_0xdbb8('0x44')];if(_0x3610d7[_0xdbb8('0x40')][_0xdbb8('0x57')]){_0x2579e4[_0xdbb8('0x53')]=[{'all':!![]}];}_0x2579e4=_[_0xdbb8('0x4f')]({},_0x2579e4,_0x3610d7[_0xdbb8('0x50')]);return db[_0xdbb8('0x51')]['find'](_0x2579e4)[_0xdbb8('0x52')](handleEntityNotFound(_0x2d95b0,null))[_0xdbb8('0x52')](respondWithResult(_0x2d95b0,null))[_0xdbb8('0x55')](handleError(_0x2d95b0,null));};exports[_0xdbb8('0x58')]=function(_0x374df9,_0x300d86){return db[_0xdbb8('0x51')][_0xdbb8('0x58')](_0x374df9[_0xdbb8('0x59')],{})[_0xdbb8('0x52')](respondWithResult(_0x300d86,0xc9))[_0xdbb8('0x55')](handleError(_0x300d86,null));};exports[_0xdbb8('0x36')]=function(_0x1d3a06,_0x4021e8){if(_0x1d3a06[_0xdbb8('0x59')]['id']){delete _0x1d3a06['body']['id'];}return db[_0xdbb8('0x51')][_0xdbb8('0x5a')]({'where':{'id':_0x1d3a06[_0xdbb8('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4021e8,null))[_0xdbb8('0x52')](saveUpdates(_0x1d3a06['body'],null))[_0xdbb8('0x52')](respondWithResult(_0x4021e8,null))[_0xdbb8('0x55')](handleError(_0x4021e8,null));};exports[_0xdbb8('0x37')]=function(_0x2c8806,_0x4f2a78){return db[_0xdbb8('0x51')][_0xdbb8('0x5a')]({'where':{'id':_0x2c8806[_0xdbb8('0x5b')]['id']}})[_0xdbb8('0x52')](handleEntityNotFound(_0x4f2a78,null))['then'](removeEntity(_0x4f2a78,null))['catch'](handleError(_0x4f2a78,null));};exports['describe']=function(_0x2f1051,_0x37d496){return db[_0xdbb8('0x51')][_0xdbb8('0x5c')]()[_0xdbb8('0x52')](respondWithResult(_0x37d496,null))[_0xdbb8('0x55')](handleError(_0x37d496,null));};var interaction_log=require(_0xdbb8('0x13'))(_0xdbb8('0x5d'));exports['accept']=function(_0x35eb2c,_0x1ec83e,_0x294c3f){var _0x3ef9a0={'agent':{},'channel':_0xdbb8('0x5e')};if(_0x35eb2c['body']['id']){delete _0x35eb2c['body']['id'];}_0x35eb2c[_0xdbb8('0x59')][_0xdbb8('0x5f')]=!![];_0x35eb2c[_0xdbb8('0x59')][_0xdbb8('0x60')]=moment()['format'](_0xdbb8('0x61'));_0x35eb2c[_0xdbb8('0x59')]['UserId']=_0x35eb2c[_0xdbb8('0x59')]['UserId']||_0x35eb2c[_0xdbb8('0x62')]['id'];_0x3ef9a0[_0xdbb8('0x63')]['id']=_0x35eb2c[_0xdbb8('0x59')][_0xdbb8('0x64')];return db[_0xdbb8('0x51')][_0xdbb8('0x5a')]({'where':{'id':_0x35eb2c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ec83e,null))[_0xdbb8('0x52')](saveUpdates(_0x35eb2c['body'],null))[_0xdbb8('0x52')](function(_0xf3f7e){if(_0xf3f7e){_0x3ef9a0[_0xdbb8('0x29')]=_0xf3f7e[_0xdbb8('0x65')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0xf3f7e[_0xdbb8('0x66')]}});}return null;})[_0xdbb8('0x52')](handleEntityNotFound(_0x1ec83e,null))['then'](function(_0x218423){if(_0x218423){return _0x218423[_0xdbb8('0x36')]({'UserId':_0x35eb2c[_0xdbb8('0x59')][_0xdbb8('0x64')],'read1stAt':_['isNil'](_0x218423[_0xdbb8('0x67')])?moment()[_0xdbb8('0x68')](_0xdbb8('0x61')):undefined});}return null;})[_0xdbb8('0x52')](function(_0x1cd5b1){if(_0x1cd5b1){_0x3ef9a0[_0xdbb8('0x69')]=_0x1cd5b1[_0xdbb8('0x65')]({'plain':!![]});interaction_log[_0xdbb8('0x21')](_0xdbb8('0x6a'),_0x35eb2c[_0xdbb8('0x62')]['id'],_0x35eb2c['user'][_0xdbb8('0x3a')],_0x35eb2c[_0xdbb8('0x62')][_0xdbb8('0x6b')],_0x3ef9a0[_0xdbb8('0x69')]['id'],_0x35eb2c['body']?JSON[_0xdbb8('0x26')](_0x35eb2c['body']):_0xdbb8('0x6c'));return respondWithRpcPromise(_0xdbb8('0x6d'),_0xdbb8('0x6e'),_0x3ef9a0);}return null;})[_0xdbb8('0x52')](function(_0x5d8192){var _0x3c774e=_0xdbb8('0x6f')+_0x5d8192[_0xdbb8('0x29')][_0xdbb8('0x70')];return db[_0xdbb8('0x71')][_0xdbb8('0x40')](_0x3c774e,{'type':db[_0xdbb8('0x72')]['QueryTypes'][_0xdbb8('0x73')],'raw':!![]})['then'](function(_0x32f434){return _0x32f434;});})[_0xdbb8('0x52')](function(_0x2df21e){if(_0x2df21e){_0x3ef9a0['message'][_0xdbb8('0x74')]=_0x2df21e[0x0];if(!_0x35eb2c[_0xdbb8('0x59')]['UserId'])return;return db[_0xdbb8('0x75')]['find']({'where':{'id':_0x35eb2c[_0xdbb8('0x59')][_0xdbb8('0x64')],'role':'agent'},'attributes':['id',_0xdbb8('0x3a'),_0xdbb8('0x76'),'email',_0xdbb8('0x77')],'raw':!![]});}return null;})[_0xdbb8('0x52')](function(_0x51dcad){if(!_0x51dcad)return null;_0x3ef9a0[_0xdbb8('0x29')][_0xdbb8('0x63')]=_0x51dcad;return _0x3ef9a0;})[_0xdbb8('0x52')](function(_0x32ccbc){if(_0x32ccbc){if(_0x35eb2c['body'][_0xdbb8('0x78')]){_0x3ef9a0[_0xdbb8('0x29')][_0xdbb8('0x79')]=util[_0xdbb8('0x68')]('SIP/%s',_0x35eb2c['user'][_0xdbb8('0x3a')]);_0x3ef9a0[_0xdbb8('0x29')][_0xdbb8('0x7a')]=_0x3ef9a0['channel'];_0x3ef9a0[_0xdbb8('0x29')][_0xdbb8('0x7b')]=_0x3ef9a0['channel'];_0x3ef9a0['message'][_0xdbb8('0x7c')]='accept';return respondWithRpcPromise(_0xdbb8('0x7d'),_0xdbb8('0x7d'),{'event':'acceptmessage','message':_0x3ef9a0[_0xdbb8('0x29')]},client9002)['then'](function(){return _0x3ef9a0;});}return _0x3ef9a0;}return null;})[_0xdbb8('0x52')](respondWithResult(_0x1ec83e,null))[_0xdbb8('0x55')](handleError(_0x1ec83e,null));};var interaction_log=require('../../config/logger')(_0xdbb8('0x5d'));exports[_0xdbb8('0x34')]=function(_0x4f0dba,_0x25a35c,_0x4e7694){var _0x308b9b={'agent':{},'channel':_0xdbb8('0x5e')};if(_0x4f0dba['body']['id']){delete _0x4f0dba['body']['id'];}_0x4f0dba[_0xdbb8('0x59')][_0xdbb8('0x64')]=_0x4f0dba['body'][_0xdbb8('0x64')]||_0x4f0dba['user']['id'];_0x308b9b[_0xdbb8('0x63')]['id']=_0x4f0dba[_0xdbb8('0x59')][_0xdbb8('0x64')];return db[_0xdbb8('0x51')][_0xdbb8('0x5a')]({'where':{'id':_0x4f0dba[_0xdbb8('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x25a35c,null))[_0xdbb8('0x52')](function(_0x152d8d){if(_0x152d8d){_0x308b9b[_0xdbb8('0x29')]=_0x152d8d[_0xdbb8('0x65')]({'plain':!![]});return db['SmsInteraction'][_0xdbb8('0x5a')]({'where':{'id':_0x152d8d['SmsInteractionId']}});}return null;})[_0xdbb8('0x52')](handleEntityNotFound(_0x25a35c,null))[_0xdbb8('0x52')](function(_0x555de3){if(_0x555de3){_0x308b9b['interaction']=_0x555de3[_0xdbb8('0x65')]({'plain':!![]});interaction_log[_0xdbb8('0x21')](_0xdbb8('0x7e'),_0x4f0dba[_0xdbb8('0x62')]['id'],_0x4f0dba[_0xdbb8('0x62')][_0xdbb8('0x3a')],_0x4f0dba['user'][_0xdbb8('0x6b')],_0x308b9b[_0xdbb8('0x69')]['id'],_0x4f0dba['body']?JSON[_0xdbb8('0x26')](_0x4f0dba[_0xdbb8('0x59')]):_0xdbb8('0x6c'));return respondWithRpcPromise(_0xdbb8('0x7f'),'rejectMessage',_0x308b9b);}return null;})[_0xdbb8('0x52')](function(_0xbcc6af){var _0x486344='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xbcc6af[_0xdbb8('0x29')][_0xdbb8('0x70')];return db[_0xdbb8('0x71')][_0xdbb8('0x40')](_0x486344,{'type':db[_0xdbb8('0x72')][_0xdbb8('0x80')]['SELECT'],'raw':!![]})[_0xdbb8('0x52')](function(_0x3feed0){return _0x3feed0;});})[_0xdbb8('0x52')](function(_0x26e4f9){if(_0x26e4f9){_0x308b9b['message']['contact']=_0x26e4f9[0x0];if(!_0x4f0dba[_0xdbb8('0x59')][_0xdbb8('0x64')])return;return db['User']['find']({'where':{'id':_0x4f0dba[_0xdbb8('0x59')][_0xdbb8('0x64')],'role':_0xdbb8('0x63')},'attributes':['id',_0xdbb8('0x3a'),_0xdbb8('0x76'),_0xdbb8('0x81'),'internal'],'raw':!![]});}return null;})[_0xdbb8('0x52')](function(_0x4b69b2){if(!_0x4b69b2)return null;_0x308b9b[_0xdbb8('0x29')]['agent']=_0x4b69b2;return _0x308b9b;})[_0xdbb8('0x52')](function(_0x2ac722){if(_0x2ac722){_0x2ac722[_0xdbb8('0x29')][_0xdbb8('0x79')]=util[_0xdbb8('0x68')](_0xdbb8('0x82'),_0x4f0dba[_0xdbb8('0x62')][_0xdbb8('0x3a')]);_0x2ac722[_0xdbb8('0x29')][_0xdbb8('0x7a')]=_0x308b9b['channel'];_0x2ac722[_0xdbb8('0x29')]['motionChannel']=_0x308b9b[_0xdbb8('0x7a')];_0x2ac722[_0xdbb8('0x29')][_0xdbb8('0x7c')]=_0xdbb8('0x34');respondWithRpcPromise(_0xdbb8('0x7d'),_0xdbb8('0x7d'),{'event':'rejectmessage','message':_0x2ac722[_0xdbb8('0x29')]},client9002);return _0x308b9b;}return null;})[_0xdbb8('0x52')](respondWithResult(_0x25a35c,null))[_0xdbb8('0x55')](handleError(_0x25a35c,null));};exports[_0xdbb8('0x30')]=function(_0x3b284c,_0x4f99d2,_0x9a9938){if(_0x3b284c['body']['id']){delete _0x3b284c[_0xdbb8('0x59')]['id'];}var _0x20b38a;return db[_0xdbb8('0x51')][_0xdbb8('0x5a')]({'where':{'id':_0x3b284c[_0xdbb8('0x5b')]['id']}})[_0xdbb8('0x52')](handleEntityNotFound(_0x4f99d2,null))['then'](function(_0x3f639e){if(_0x3f639e){_0x20b38a=_0x3f639e;return db[_0xdbb8('0x83')][_0xdbb8('0x5a')]({'where':{'id':_0x3f639e['SmsAccountId']}});}})[_0xdbb8('0x52')](handleEntityNotFound(_0x4f99d2,null))['then'](function(_0x55bace){if(_0x55bace){logger[_0xdbb8('0x24')](_0xdbb8('0x25'),_0xdbb8('0x30'),_0xdbb8('0x84'),_0x55bace[_0xdbb8('0x3d')],util[_0xdbb8('0x85')](_0x3b284c[_0xdbb8('0x59')],{'showHidden':![],'depth':null}));switch(_0x55bace[_0xdbb8('0x3d')]){case _0xdbb8('0x86'):if(_0x3b284c[_0xdbb8('0x59')]['MessageSid']&&_0x3b284c[_0xdbb8('0x59')][_0xdbb8('0x87')]===_0x20b38a[_0xdbb8('0x88')]){return _0x20b38a[_0xdbb8('0x36')]({'read':!![]});}else{logger[_0xdbb8('0x28')](_0xdbb8('0x89'),_0xdbb8('0x30'),_0xdbb8('0x86'),util[_0xdbb8('0x85')](_0x3b284c[_0xdbb8('0x59')],{'showHidden':![],'depth':null}));}break;case _0xdbb8('0x8a'):if(_0x3b284c[_0xdbb8('0x59')][_0xdbb8('0x8b')]&&_0x3b284c[_0xdbb8('0x59')][_0xdbb8('0x8b')]===_0x20b38a[_0xdbb8('0x88')]&&_[_0xdbb8('0x8c')](['sent',_0xdbb8('0x8d')],_0x3b284c[_0xdbb8('0x59')]['Status'])>=0x0){return _0x20b38a['update']({'read':!![]});}else{logger[_0xdbb8('0x28')](_0xdbb8('0x89'),'status',_0xdbb8('0x8e'),util[_0xdbb8('0x85')](_0x3b284c[_0xdbb8('0x59')],{'showHidden':![],'depth':null}));}break;case _0xdbb8('0x8f'):var _0x1fdb8f=_0x3b284c['body'][_0xdbb8('0x90')][0x0];if(_0x1fdb8f[_0xdbb8('0x30')][_0xdbb8('0x91')]==='DELIVERED'){return _0x20b38a[_0xdbb8('0x36')]({'read':!![]});}else{logger[_0xdbb8('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdbb8('0x30'),'infobip',util[_0xdbb8('0x85')](_0x3b284c['body'],{'showHidden':![],'depth':null}));}break;}return _0x20b38a;}})[_0xdbb8('0x52')](respondWithResult(_0x4f99d2,null))['catch'](handleError(_0x4f99d2,null));}; \ No newline at end of file +var _0x60ca=['groupName','DELIVERED','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','jayson/promise','client','http','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','limit','count','json','apply','save','update','destroy','stack','name','send','index','map','SmsMessage','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','QueryTypes','contact','reject','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','infobip','results'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x60ca,0x92));var _0xa60c=function(_0x3e1e52,_0x4fcf17){_0x3e1e52=_0x3e1e52-0x0;var _0x2c5a58=_0x60ca[_0x3e1e52];return _0x2c5a58;};'use strict';var emlformat=require(_0xa60c('0x0'));var rimraf=require(_0xa60c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa60c('0x2'));var moment=require(_0xa60c('0x3'));var BPromise=require(_0xa60c('0x4'));var Mustache=require(_0xa60c('0x5'));var util=require('util');var path=require(_0xa60c('0x6'));var sox=require(_0xa60c('0x7'));var csv=require(_0xa60c('0x8'));var ejs=require(_0xa60c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa60c('0xa'));var squel=require(_0xa60c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa60c('0xc'));var toCsv=require(_0xa60c('0x8'));var querystring=require(_0xa60c('0xd'));var Papa=require(_0xa60c('0xe'));var Redis=require(_0xa60c('0xf'));var authService=require(_0xa60c('0x10'));var qs=require(_0xa60c('0x11'));var as=require(_0xa60c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa60c('0x13'))(_0xa60c('0x14'));var utils=require(_0xa60c('0x15'));var config=require(_0xa60c('0x16'));var licenseUtil=require(_0xa60c('0x17'));var db=require(_0xa60c('0x18'))['db'];config[_0xa60c('0x19')]=_[_0xa60c('0x1a')](config[_0xa60c('0x19')],{'host':_0xa60c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa60c('0x19')]));require(_0xa60c('0x1c'))['register'](socket);var jayson=require(_0xa60c('0x1d'));var client=jayson[_0xa60c('0x1e')][_0xa60c('0x1f')]({'port':0x232c});var client9002=jayson[_0xa60c('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1caa26,_0x5f0ff4,_0x29a590,_0x54cccd){return new BPromise(function(_0x5d6b69,_0x2f3e75){var _0x298172=_0x54cccd||client;return _0x298172['request'](_0x1caa26,_0x29a590)[_0xa60c('0x20')](function(_0x188679){logger[_0xa60c('0x21')]('SmsMessage,\x20%s,\x20%s',_0x5f0ff4,_0xa60c('0x22'));logger['debug'](_0xa60c('0x23'),_0x5f0ff4,_0xa60c('0x22'),JSON[_0xa60c('0x24')](_0x188679));if(_0x188679[_0xa60c('0x25')]){if(_0x188679[_0xa60c('0x25')][_0xa60c('0x26')]===0x1f4){logger['error'](_0xa60c('0x27'),_0x5f0ff4,_0x188679['error']['message']);return _0x2f3e75(_0x188679['error'][_0xa60c('0x28')]);}logger[_0xa60c('0x25')]('SmsMessage,\x20%s,\x20%s',_0x5f0ff4,_0x188679[_0xa60c('0x25')][_0xa60c('0x28')]);return _0x5d6b69(_0x188679['error'][_0xa60c('0x28')]);}else{logger['info'](_0xa60c('0x27'),_0x5f0ff4,_0xa60c('0x22'));_0x5d6b69(_0x188679[_0xa60c('0x29')][_0xa60c('0x28')]);}})[_0xa60c('0x2a')](function(_0x2335af){logger[_0xa60c('0x25')](_0xa60c('0x27'),_0x5f0ff4,_0x2335af);_0x2f3e75(_0x2335af);});});}function respondWithStatusCode(_0x1b997a,_0x2d6495){_0x2d6495=_0x2d6495||0xcc;return function(_0x2bd8ce){if(_0x2bd8ce){return _0x1b997a[_0xa60c('0x2b')](_0x2d6495);}return _0x1b997a[_0xa60c('0x2c')](_0x2d6495)['end']();};}function respondWithResult(_0x34eb58,_0x2611ab){_0x2611ab=_0x2611ab||0xc8;return function(_0x2382ce){if(_0x2382ce){return _0x34eb58[_0xa60c('0x2c')](_0x2611ab)['json'](_0x2382ce);}};}function respondWithFilteredResult(_0x12f653,_0x33b7ad){return function(_0x2a3365){if(_0x2a3365){var _0x1781e8=typeof _0x33b7ad[_0xa60c('0x2d')]===_0xa60c('0x2e')&&typeof _0x33b7ad[_0xa60c('0x2f')]===_0xa60c('0x2e');var _0x1ca7c7=_0x2a3365['count'];var _0x457233=_0x1781e8?0x0:_0x33b7ad[_0xa60c('0x2d')];var _0x3c5658=_0x1781e8?_0x2a3365[_0xa60c('0x30')]:_0x33b7ad[_0xa60c('0x2d')]+_0x33b7ad['limit'];var _0x513963;if(_0x3c5658>=_0x1ca7c7){_0x3c5658=_0x1ca7c7;_0x513963=0xc8;}else{_0x513963=0xce;}_0x12f653[_0xa60c('0x2c')](_0x513963);return _0x12f653['set']('Content-Range',_0x457233+'-'+_0x3c5658+'/'+_0x1ca7c7)[_0xa60c('0x31')](_0x2a3365);}return null;};}function patchUpdates(_0xd2723a){return function(_0x1ecebc){try{jsonpatch[_0xa60c('0x32')](_0x1ecebc,_0xd2723a,!![]);}catch(_0x370968){return BPromise['reject'](_0x370968);}return _0x1ecebc[_0xa60c('0x33')]();};}function saveUpdates(_0xb11ee7,_0x4d1c7d){return function(_0x138546){if(_0x138546){return _0x138546[_0xa60c('0x34')](_0xb11ee7)['then'](function(_0x552d47){return _0x552d47;});}return null;};}function removeEntity(_0x2387ee,_0x3f75c7){return function(_0x48acd9){if(_0x48acd9){return _0x48acd9[_0xa60c('0x35')]()[_0xa60c('0x20')](function(){_0x2387ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c481e,_0x14bc20){return function(_0x10053c){if(!_0x10053c){_0x3c481e[_0xa60c('0x2b')](0x194);}return _0x10053c;};}function handleError(_0x4399dd,_0x32b334){_0x32b334=_0x32b334||0x1f4;return function(_0x3c4979){logger[_0xa60c('0x25')](_0x3c4979[_0xa60c('0x36')]);if(_0x3c4979[_0xa60c('0x37')]){delete _0x3c4979['name'];}_0x4399dd[_0xa60c('0x2c')](_0x32b334)[_0xa60c('0x38')](_0x3c4979);};}exports[_0xa60c('0x39')]=function(_0x55e5b7,_0x59a176){var _0xf3f14e={},_0x174b54={},_0x3f7ef8={'count':0x0,'rows':[]};var _0x14959d=_[_0xa60c('0x3a')](db[_0xa60c('0x3b')]['rawAttributes'],function(_0x427ddb){return{'name':_0x427ddb['fieldName'],'type':_0x427ddb[_0xa60c('0x3c')][_0xa60c('0x3d')]};});_0x174b54[_0xa60c('0x3e')]=_[_0xa60c('0x3a')](_0x14959d,_0xa60c('0x37'));_0x174b54['query']=_[_0xa60c('0x3f')](_0x55e5b7[_0xa60c('0x40')]);_0x174b54['filters']=_[_0xa60c('0x41')](_0x174b54[_0xa60c('0x3e')],_0x174b54[_0xa60c('0x40')]);_0xf3f14e[_0xa60c('0x42')]=_[_0xa60c('0x41')](_0x174b54[_0xa60c('0x3e')],qs['fields'](_0x55e5b7['query'][_0xa60c('0x43')]));_0xf3f14e[_0xa60c('0x42')]=_0xf3f14e[_0xa60c('0x42')][_0xa60c('0x44')]?_0xf3f14e['attributes']:_0x174b54[_0xa60c('0x3e')];if(!_0x55e5b7[_0xa60c('0x40')]['hasOwnProperty']('nolimit')){_0xf3f14e['limit']=qs[_0xa60c('0x2f')](_0x55e5b7['query'][_0xa60c('0x2f')]);_0xf3f14e[_0xa60c('0x2d')]=qs[_0xa60c('0x2d')](_0x55e5b7[_0xa60c('0x40')]['offset']);}_0xf3f14e[_0xa60c('0x45')]=qs[_0xa60c('0x46')](_0x55e5b7[_0xa60c('0x40')][_0xa60c('0x46')]);_0xf3f14e[_0xa60c('0x47')]=qs[_0xa60c('0x48')](_[_0xa60c('0x49')](_0x55e5b7[_0xa60c('0x40')],_0x174b54[_0xa60c('0x48')]),_0x14959d);if(_0x55e5b7['query'][_0xa60c('0x4a')]){_0xf3f14e[_0xa60c('0x47')]=_[_0xa60c('0x4b')](_0xf3f14e[_0xa60c('0x47')],{'$or':_[_0xa60c('0x3a')](_0x14959d,function(_0x22c6df){if(_0x22c6df[_0xa60c('0x3c')]!==_0xa60c('0x4c')){var _0x22d391={};_0x22d391[_0x22c6df[_0xa60c('0x37')]]={'$like':'%'+_0x55e5b7[_0xa60c('0x40')][_0xa60c('0x4a')]+'%'};return _0x22d391;}})});}_0xf3f14e=_[_0xa60c('0x4b')]({},_0xf3f14e,_0x55e5b7['options']);var _0x43dd2c={'where':_0xf3f14e[_0xa60c('0x47')]};return db[_0xa60c('0x3b')]['count'](_0x43dd2c)[_0xa60c('0x20')](function(_0x44dde5){_0x3f7ef8[_0xa60c('0x30')]=_0x44dde5;if(_0x55e5b7[_0xa60c('0x40')][_0xa60c('0x4d')]){_0xf3f14e[_0xa60c('0x4e')]=[{'all':!![]}];}return db['SmsMessage'][_0xa60c('0x4f')](_0xf3f14e);})[_0xa60c('0x20')](function(_0x2d9184){_0x3f7ef8[_0xa60c('0x50')]=_0x2d9184;return _0x3f7ef8;})[_0xa60c('0x20')](respondWithFilteredResult(_0x59a176,_0xf3f14e))[_0xa60c('0x2a')](handleError(_0x59a176,null));};exports[_0xa60c('0x51')]=function(_0x2bd54d,_0x2cc140){var _0x546080={'raw':!![],'where':{'id':_0x2bd54d[_0xa60c('0x52')]['id']}},_0x285bcc={};_0x285bcc[_0xa60c('0x3e')]=_[_0xa60c('0x3f')](db[_0xa60c('0x3b')][_0xa60c('0x53')]);_0x285bcc[_0xa60c('0x40')]=_['keys'](_0x2bd54d['query']);_0x285bcc[_0xa60c('0x48')]=_[_0xa60c('0x41')](_0x285bcc[_0xa60c('0x3e')],_0x285bcc[_0xa60c('0x40')]);_0x546080['attributes']=_[_0xa60c('0x41')](_0x285bcc[_0xa60c('0x3e')],qs['fields'](_0x2bd54d[_0xa60c('0x40')][_0xa60c('0x43')]));_0x546080['attributes']=_0x546080['attributes'][_0xa60c('0x44')]?_0x546080['attributes']:_0x285bcc[_0xa60c('0x3e')];if(_0x2bd54d[_0xa60c('0x40')]['includeAll']){_0x546080['include']=[{'all':!![]}];}_0x546080=_['merge']({},_0x546080,_0x2bd54d[_0xa60c('0x54')]);return db[_0xa60c('0x3b')][_0xa60c('0x55')](_0x546080)['then'](handleEntityNotFound(_0x2cc140,null))[_0xa60c('0x20')](respondWithResult(_0x2cc140,null))[_0xa60c('0x2a')](handleError(_0x2cc140,null));};exports[_0xa60c('0x56')]=function(_0x274138,_0x1bc43e){return db[_0xa60c('0x3b')][_0xa60c('0x56')](_0x274138['body'],{})['then'](respondWithResult(_0x1bc43e,0xc9))[_0xa60c('0x2a')](handleError(_0x1bc43e,null));};exports[_0xa60c('0x34')]=function(_0x1a0b92,_0x1729f5){if(_0x1a0b92[_0xa60c('0x57')]['id']){delete _0x1a0b92[_0xa60c('0x57')]['id'];}return db['SmsMessage'][_0xa60c('0x55')]({'where':{'id':_0x1a0b92[_0xa60c('0x52')]['id']}})[_0xa60c('0x20')](handleEntityNotFound(_0x1729f5,null))[_0xa60c('0x20')](saveUpdates(_0x1a0b92['body'],null))[_0xa60c('0x20')](respondWithResult(_0x1729f5,null))[_0xa60c('0x2a')](handleError(_0x1729f5,null));};exports[_0xa60c('0x35')]=function(_0x26d472,_0x52e179){return db['SmsMessage']['find']({'where':{'id':_0x26d472[_0xa60c('0x52')]['id']}})[_0xa60c('0x20')](handleEntityNotFound(_0x52e179,null))[_0xa60c('0x20')](removeEntity(_0x52e179,null))[_0xa60c('0x2a')](handleError(_0x52e179,null));};exports[_0xa60c('0x58')]=function(_0x18ab8b,_0x5b968b){return db['SmsMessage'][_0xa60c('0x58')]()[_0xa60c('0x20')](respondWithResult(_0x5b968b,null))[_0xa60c('0x2a')](handleError(_0x5b968b,null));};var interaction_log=require(_0xa60c('0x13'))(_0xa60c('0x59'));exports[_0xa60c('0x5a')]=function(_0x2f0457,_0x3f4853,_0x357526){var _0x2fd9d7={'agent':{},'channel':_0xa60c('0x5b')};if(_0x2f0457['body']['id']){delete _0x2f0457[_0xa60c('0x57')]['id'];}_0x2f0457['body'][_0xa60c('0x5c')]=!![];_0x2f0457['body'][_0xa60c('0x5d')]=moment()[_0xa60c('0x5e')](_0xa60c('0x5f'));_0x2f0457['body'][_0xa60c('0x60')]=_0x2f0457[_0xa60c('0x57')]['UserId']||_0x2f0457[_0xa60c('0x61')]['id'];_0x2fd9d7[_0xa60c('0x62')]['id']=_0x2f0457[_0xa60c('0x57')][_0xa60c('0x60')];return db['SmsMessage']['find']({'where':{'id':_0x2f0457[_0xa60c('0x52')]['id'],'UserId':null}})[_0xa60c('0x20')](handleEntityNotFound(_0x3f4853,null))[_0xa60c('0x20')](saveUpdates(_0x2f0457['body'],null))[_0xa60c('0x20')](function(_0x350538){if(_0x350538){_0x2fd9d7[_0xa60c('0x28')]=_0x350538[_0xa60c('0x63')]({'plain':!![]});return db[_0xa60c('0x64')][_0xa60c('0x55')]({'where':{'id':_0x350538[_0xa60c('0x65')]}});}return null;})[_0xa60c('0x20')](handleEntityNotFound(_0x3f4853,null))[_0xa60c('0x20')](function(_0x5b46a3){if(_0x5b46a3){return _0x5b46a3[_0xa60c('0x34')]({'UserId':_0x2f0457[_0xa60c('0x57')]['UserId'],'read1stAt':_['isNil'](_0x5b46a3[_0xa60c('0x66')])?moment()[_0xa60c('0x5e')](_0xa60c('0x5f')):undefined});}return null;})[_0xa60c('0x20')](function(_0x2ac444){if(_0x2ac444){_0x2fd9d7[_0xa60c('0x67')]=_0x2ac444[_0xa60c('0x63')]({'plain':!![]});interaction_log[_0xa60c('0x21')](_0xa60c('0x68'),_0x2f0457['user']['id'],_0x2f0457['user'][_0xa60c('0x37')],_0x2f0457[_0xa60c('0x61')]['role'],_0x2fd9d7[_0xa60c('0x67')]['id'],_0x2f0457[_0xa60c('0x57')]?JSON[_0xa60c('0x24')](_0x2f0457['body']):_0xa60c('0x69'));return respondWithRpcPromise('AcceptMessage',_0xa60c('0x6a'),_0x2fd9d7);}return null;})[_0xa60c('0x20')](function(_0x5d84b8){var _0x2dbd79=_0xa60c('0x6b')+_0x5d84b8[_0xa60c('0x28')]['ContactId'];return db[_0xa60c('0x6c')]['query'](_0x2dbd79,{'type':db['Sequelize']['QueryTypes'][_0xa60c('0x6d')],'raw':!![]})[_0xa60c('0x20')](function(_0x161b3f){return _0x161b3f;});})['then'](function(_0x3e79c4){if(_0x3e79c4){_0x2fd9d7[_0xa60c('0x28')]['contact']=_0x3e79c4[0x0];if(!_0x2f0457[_0xa60c('0x57')][_0xa60c('0x60')])return;return db['User'][_0xa60c('0x55')]({'where':{'id':_0x2f0457[_0xa60c('0x57')][_0xa60c('0x60')],'role':_0xa60c('0x62')},'attributes':['id',_0xa60c('0x37'),'fullname',_0xa60c('0x6e'),'internal'],'raw':!![]});}return null;})['then'](function(_0x10dfc4){if(!_0x10dfc4)return null;_0x2fd9d7[_0xa60c('0x28')][_0xa60c('0x62')]=_0x10dfc4;return _0x2fd9d7;})[_0xa60c('0x20')](function(_0x410b5c){if(_0x410b5c){if(_0x2f0457[_0xa60c('0x57')][_0xa60c('0x6f')]){_0x2fd9d7[_0xa60c('0x28')][_0xa60c('0x70')]=util[_0xa60c('0x5e')](_0xa60c('0x71'),_0x2f0457['user'][_0xa60c('0x37')]);_0x2fd9d7['message'][_0xa60c('0x72')]=_0x2fd9d7[_0xa60c('0x72')];_0x2fd9d7[_0xa60c('0x28')][_0xa60c('0x73')]=_0x2fd9d7[_0xa60c('0x72')];_0x2fd9d7[_0xa60c('0x28')][_0xa60c('0x74')]=_0xa60c('0x5a');return respondWithRpcPromise(_0xa60c('0x75'),_0xa60c('0x75'),{'event':_0xa60c('0x76'),'message':_0x2fd9d7[_0xa60c('0x28')]},client9002)[_0xa60c('0x20')](function(){return _0x2fd9d7;});}return _0x2fd9d7;}return null;})['then'](respondWithResult(_0x3f4853,null))['catch'](handleError(_0x3f4853,null));};var interaction_log=require(_0xa60c('0x13'))(_0xa60c('0x59'));exports['reject']=function(_0x291779,_0x38f896,_0x5be79c){var _0x21d356={'agent':{},'channel':_0xa60c('0x5b')};if(_0x291779['body']['id']){delete _0x291779[_0xa60c('0x57')]['id'];}_0x291779[_0xa60c('0x57')][_0xa60c('0x60')]=_0x291779[_0xa60c('0x57')][_0xa60c('0x60')]||_0x291779[_0xa60c('0x61')]['id'];_0x21d356[_0xa60c('0x62')]['id']=_0x291779[_0xa60c('0x57')][_0xa60c('0x60')];return db['SmsMessage'][_0xa60c('0x55')]({'where':{'id':_0x291779[_0xa60c('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x38f896,null))[_0xa60c('0x20')](function(_0x20eba1){if(_0x20eba1){_0x21d356[_0xa60c('0x28')]=_0x20eba1[_0xa60c('0x63')]({'plain':!![]});return db[_0xa60c('0x64')]['find']({'where':{'id':_0x20eba1['SmsInteractionId']}});}return null;})[_0xa60c('0x20')](handleEntityNotFound(_0x38f896,null))[_0xa60c('0x20')](function(_0x2e952f){if(_0x2e952f){_0x21d356['interaction']=_0x2e952f[_0xa60c('0x63')]({'plain':!![]});interaction_log[_0xa60c('0x21')](_0xa60c('0x77'),_0x291779[_0xa60c('0x61')]['id'],_0x291779[_0xa60c('0x61')]['name'],_0x291779[_0xa60c('0x61')]['role'],_0x21d356[_0xa60c('0x67')]['id'],_0x291779['body']?JSON[_0xa60c('0x24')](_0x291779[_0xa60c('0x57')]):_0xa60c('0x69'));return respondWithRpcPromise(_0xa60c('0x78'),_0xa60c('0x79'),_0x21d356);}return null;})[_0xa60c('0x20')](function(_0x677453){var _0x3bddbd=_0xa60c('0x6b')+_0x677453[_0xa60c('0x28')][_0xa60c('0x7a')];return db['sequelize']['query'](_0x3bddbd,{'type':db['Sequelize'][_0xa60c('0x7b')][_0xa60c('0x6d')],'raw':!![]})['then'](function(_0x4ddbf3){return _0x4ddbf3;});})[_0xa60c('0x20')](function(_0x3e8be7){if(_0x3e8be7){_0x21d356[_0xa60c('0x28')][_0xa60c('0x7c')]=_0x3e8be7[0x0];if(!_0x291779[_0xa60c('0x57')]['UserId'])return;return db['User'][_0xa60c('0x55')]({'where':{'id':_0x291779['body'][_0xa60c('0x60')],'role':'agent'},'attributes':['id',_0xa60c('0x37'),'fullname',_0xa60c('0x6e'),'internal'],'raw':!![]});}return null;})[_0xa60c('0x20')](function(_0x4aa81b){if(!_0x4aa81b)return null;_0x21d356[_0xa60c('0x28')][_0xa60c('0x62')]=_0x4aa81b;return _0x21d356;})[_0xa60c('0x20')](function(_0x32a5b5){if(_0x32a5b5){_0x32a5b5[_0xa60c('0x28')][_0xa60c('0x70')]=util['format']('SIP/%s',_0x291779[_0xa60c('0x61')][_0xa60c('0x37')]);_0x32a5b5[_0xa60c('0x28')][_0xa60c('0x72')]=_0x21d356[_0xa60c('0x72')];_0x32a5b5[_0xa60c('0x28')][_0xa60c('0x73')]=_0x21d356[_0xa60c('0x72')];_0x32a5b5[_0xa60c('0x28')][_0xa60c('0x74')]=_0xa60c('0x7d');respondWithRpcPromise(_0xa60c('0x75'),'EventManager',{'event':_0xa60c('0x7e'),'message':_0x32a5b5[_0xa60c('0x28')]},client9002);return _0x21d356;}return null;})['then'](respondWithResult(_0x38f896,null))[_0xa60c('0x2a')](handleError(_0x38f896,null));};exports[_0xa60c('0x2c')]=function(_0x3b211a,_0x22d3d3,_0x43f0f9){if(_0x3b211a[_0xa60c('0x57')]['id']){delete _0x3b211a[_0xa60c('0x57')]['id'];}var _0x418ec4;return db[_0xa60c('0x3b')][_0xa60c('0x55')]({'where':{'id':_0x3b211a[_0xa60c('0x52')]['id']}})[_0xa60c('0x20')](handleEntityNotFound(_0x22d3d3,null))[_0xa60c('0x20')](function(_0x56145b){if(_0x56145b){_0x418ec4=_0x56145b;return db[_0xa60c('0x7f')][_0xa60c('0x55')]({'where':{'id':_0x56145b[_0xa60c('0x80')]}});}})['then'](handleEntityNotFound(_0x22d3d3,null))[_0xa60c('0x20')](function(_0x455a84){if(_0x455a84){logger['debug'](_0xa60c('0x23'),_0xa60c('0x2c'),_0xa60c('0x81'),_0x455a84['type'],util['inspect'](_0x3b211a[_0xa60c('0x57')],{'showHidden':![],'depth':null}));switch(_0x455a84[_0xa60c('0x3c')]){case _0xa60c('0x82'):if(_0x3b211a[_0xa60c('0x57')][_0xa60c('0x83')]&&_0x3b211a['body'][_0xa60c('0x83')]===_0x418ec4[_0xa60c('0x84')]){return _0x418ec4['update']({'read':!![]});}else{logger[_0xa60c('0x25')](_0xa60c('0x85'),_0xa60c('0x2c'),_0xa60c('0x82'),util[_0xa60c('0x86')](_0x3b211a[_0xa60c('0x57')],{'showHidden':![],'depth':null}));}break;case _0xa60c('0x87'):if(_0x3b211a[_0xa60c('0x57')]['MessageUUID']&&_0x3b211a[_0xa60c('0x57')][_0xa60c('0x88')]===_0x418ec4[_0xa60c('0x84')]&&_[_0xa60c('0x89')]([_0xa60c('0x8a'),_0xa60c('0x8b')],_0x3b211a[_0xa60c('0x57')]['Status'])>=0x0){return _0x418ec4[_0xa60c('0x34')]({'read':!![]});}else{logger[_0xa60c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','plivio',util[_0xa60c('0x86')](_0x3b211a[_0xa60c('0x57')],{'showHidden':![],'depth':null}));}break;case _0xa60c('0x8c'):var _0x4295de=_0x3b211a[_0xa60c('0x57')][_0xa60c('0x8d')][0x0];if(_0x4295de[_0xa60c('0x2c')][_0xa60c('0x8e')]===_0xa60c('0x8f')){return _0x418ec4[_0xa60c('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa60c('0x2c'),'infobip',util[_0xa60c('0x86')](_0x3b211a[_0xa60c('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x418ec4;}})['then'](respondWithResult(_0x22d3d3,null))[_0xa60c('0x2a')](handleError(_0x22d3d3,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 45294c4..bfdbfa4 100644 --- a/server/api/smsMessage/smsMessage.events.js +++ b/server/api/smsMessage/smsMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6874=['exports','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x4e516d,_0x482c2f){var _0x4adae3=function(_0x28afb9){while(--_0x28afb9){_0x4e516d['push'](_0x4e516d['shift']());}};_0x4adae3(++_0x482c2f);}(_0x6874,0x1cf));var _0x4687=function(_0x19bf07,_0x30d022){_0x19bf07=_0x19bf07-0x0;var _0x379775=_0x6874[_0x19bf07];return _0x379775;};'use strict';var EventEmitter=require(_0x4687('0x0'));var SmsMessage=require(_0x4687('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4687('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4687('0x3')};function emitEvent(_0x14602d){return function(_0x5b2645,_0x400dd1,_0xe9277d){SmsMessageEvents[_0x4687('0x4')](_0x14602d+':'+_0x5b2645['id'],_0x5b2645);SmsMessageEvents[_0x4687('0x4')](_0x14602d,_0x5b2645);_0xe9277d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x4687('0x5')]=SmsMessageEvents; \ No newline at end of file +var _0xdf2a=['emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x4e4519,_0x392ae){var _0x340044=function(_0x11721f){while(--_0x11721f){_0x4e4519['push'](_0x4e4519['shift']());}};_0x340044(++_0x392ae);}(_0xdf2a,0x161));var _0xadf2=function(_0x521162,_0x19858b){_0x521162=_0x521162-0x0;var _0x5b3d7c=_0xdf2a[_0x521162];return _0x5b3d7c;};'use strict';var EventEmitter=require(_0xadf2('0x0'));var SmsMessage=require(_0xadf2('0x1'))['db'][_0xadf2('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xadf2('0x3')](0x0);var events={'afterCreate':_0xadf2('0x4'),'afterUpdate':_0xadf2('0x5'),'afterDestroy':_0xadf2('0x6')};function emitEvent(_0x4fb9c5){return function(_0x44dfff,_0x399d24,_0x434bdd){SmsMessageEvents[_0xadf2('0x7')](_0x4fb9c5+':'+_0x44dfff['id'],_0x44dfff);SmsMessageEvents[_0xadf2('0x7')](_0x4fb9c5,_0x44dfff);_0x434bdd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xadf2('0x8')](e,emitEvent(event));}}module[_0xadf2('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 54903f5..0b8ea00 100644 --- a/server/api/smsMessage/smsMessage.model.js +++ b/server/api/smsMessage/smsMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa8c=['senderString','POST','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','keys','sort','length','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','clickatell','https://platform.clickatell.com/messages','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','accountId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','type','twilio','accountSid','phone','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','user_key','session_key','total_sent','internal_order_id','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','authToken'];(function(_0x563a7e,_0x4d543a){var _0x4f7bd4=function(_0xb5d294){while(--_0xb5d294){_0x563a7e['push'](_0x563a7e['shift']());}};_0x4f7bd4(++_0x4d543a);}(_0xfa8c,0x136));var _0xcfa8=function(_0x48dc4a,_0x3a73c9){_0x48dc4a=_0x48dc4a-0x0;var _0x5c0e9d=_0xfa8c[_0x48dc4a];return _0x5c0e9d;};'use strict';var _=require(_0xcfa8('0x0'));var util=require(_0xcfa8('0x1'));var logger=require(_0xcfa8('0x2'))(_0xcfa8('0x3'));var moment=require('moment');var BPromise=require(_0xcfa8('0x4'));var rp=require(_0xcfa8('0x5'));var fs=require('fs');var path=require(_0xcfa8('0x6'));var rimraf=require(_0xcfa8('0x7'));var config=require(_0xcfa8('0x8'));var attributes=require('./smsMessage.attributes');module[_0xcfa8('0x9')]=function(_0x453bdd,_0x4a1369){return _0x453bdd[_0xcfa8('0xa')](_0xcfa8('0xb'),attributes,{'tableName':_0xcfa8('0xc'),'paranoid':![],'indexes':[{'name':_0xcfa8('0xd'),'fields':['messageId']},{'name':_0xcfa8('0xe'),'fields':[_0xcfa8('0xf')],'type':_0xcfa8('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23d44f,_0x49ca4d,_0x191e6e){var _0x42e732=_0x453bdd[_0xcfa8('0x11')];var _0x14d748=_0x23d44f[_0xcfa8('0x12')]({'plain':!![]});if(_0x14d748[_0xcfa8('0x13')]['toLowerCase']()==='in'||_0x14d748[_0xcfa8('0x13')]['toLowerCase']()===_0xcfa8('0x14')&&!_0x14d748[_0xcfa8('0x15')]&&!_[_0xcfa8('0x16')](_0x14d748[_0xcfa8('0x17')])&&!_[_0xcfa8('0x16')](_0x14d748['SmsInteractionId'])){_0x42e732[_0xcfa8('0x18')][_0xcfa8('0x19')]({'where':{'id':_0x14d748[_0xcfa8('0x1a')]}})[_0xcfa8('0x1b')](function(_0x3dd515){if(_0x3dd515){_0x3dd515[_0xcfa8('0x1c')]({'lastMsgAt':_0x14d748[_0xcfa8('0x1d')],'lastMsgDirection':_0x14d748[_0xcfa8('0x13')]['toLowerCase']()});}})[_0xcfa8('0x1e')](function(_0x4a75c5){console[_0xcfa8('0x1f')](_0x4a75c5);});}if(_0x14d748[_0xcfa8('0x13')]===_0xcfa8('0x14')&&!_0x14d748[_0xcfa8('0x15')]){var _0x2af7ec;_0x42e732[_0xcfa8('0x20')][_0xcfa8('0x21')]({'where':{'id':_0x14d748['SmsAccountId']},'raw':!![]})['then'](function(_0x48b99a){_0x2af7ec=_0x48b99a;if(_0x2af7ec&&_0x2af7ec[_0xcfa8('0x22')]){switch(_0x2af7ec[_0xcfa8('0x22')]){case _0xcfa8('0x23'):var _0x594d31=require(_0xcfa8('0x23'));if(_0x2af7ec[_0xcfa8('0x24')]&&_0x2af7ec['authToken']&&_0x2af7ec['phone']){var _0x2d38da=new _0x594d31(_0x2af7ec['accountSid'],_0x2af7ec['authToken']);_0x2d38da['messages']['create']({'body':_0x14d748[_0xcfa8('0xf')],'to':_0x14d748[_0xcfa8('0x25')],'from':_0x2af7ec[_0xcfa8('0x25')],'statusCallback':_0x2af7ec[_0xcfa8('0x26')]+_0xcfa8('0x27')+_0x14d748['id']+_0xcfa8('0x28')+_0x2af7ec[_0xcfa8('0x29')]})[_0xcfa8('0x1b')](function(_0x1450f0){if(_0x1450f0[_0xcfa8('0x2a')]){return _0x23d44f[_0xcfa8('0x1c')]({'messageId':_0x1450f0[_0xcfa8('0x2a')]});}})[_0xcfa8('0x1e')](function(_0x16b942){logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x23'),util['inspect'](_0x16b942,{'showHidden':![],'depth':null}));});}else{logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),'afterCreate','twilio',_0xcfa8('0x2d'));}break;case _0xcfa8('0x2e'):var _0x2405fc=_0xcfa8('0x2f');if(_0x2af7ec[_0xcfa8('0x30')]&&_0x2af7ec[_0xcfa8('0x31')]){var _0x346429={'recipient':[_0x14d748['phone']],'message':_0x14d748[_0xcfa8('0xf')],'message_type':_0x2af7ec[_0xcfa8('0x32')]};if(_0x2af7ec[_0xcfa8('0x32')]&&_0x2af7ec[_0xcfa8('0x32')]!=='SI'){_0x346429[_0xcfa8('0x33')]=_0x2af7ec[_0xcfa8('0x25')];}var _0x1115f8={'url':_0x2405fc+_0xcfa8('0x34')+_0x2af7ec['username']+_0xcfa8('0x35')+_0x2af7ec[_0xcfa8('0x31')],'method':'GET'};rp(_0x1115f8)[_0xcfa8('0x1b')](function(_0x58a1eb){var _0x2a91cd=_0x58a1eb[_0xcfa8('0x36')](';');var _0xa59f84={'user_key':_0x2a91cd[0x0],'session_key':_0x2a91cd[0x1]};_0x1115f8={'url':_0x2405fc+_0xcfa8('0x37'),'method':'POST','headers':{'user_key':_0xa59f84[_0xcfa8('0x38')],'Session_key':_0xa59f84[_0xcfa8('0x39')]},'json':!![],'body':_0x346429};return rp(_0x1115f8);})['then'](function(_0x3e1d48){if(_0x3e1d48[_0xcfa8('0x3a')]>=0x1){var _0x594a2f={'messageId':_0x3e1d48[_0xcfa8('0x3b')]};if(_0x2af7ec[_0xcfa8('0x32')]!=='GP'||!_0x2af7ec['deliveryReport']){_0x594a2f[_0xcfa8('0x3c')]=!![];}return _0x23d44f[_0xcfa8('0x1c')](_0x594a2f);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfa8('0x2c'),'skebby',util[_0xcfa8('0x3d')](_0x3e1d48,{'showHidden':![],'depth':null}));}})[_0xcfa8('0x1e')](function(_0x2782cd){return logger['error'](_0xcfa8('0x2b'),'afterCreate',_0xcfa8('0x2e'),util[_0xcfa8('0x3d')](_0x2782cd,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcfa8('0x2b'),'afterCreate',_0xcfa8('0x2e'),_0xcfa8('0x3e'));}break;case _0xcfa8('0x3f'):if(_0x2af7ec[_0xcfa8('0x40')]){var _0x50e03d={'recipient':_0x14d748['phone'],'message':_0x14d748['body'],'sender':_0x2af7ec[_0xcfa8('0x41')]||_0x2af7ec[_0xcfa8('0x25')],'authorization':_0x2af7ec[_0xcfa8('0x40')]};var _0x49ca4d={'method':_0xcfa8('0x42'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x50e03d,'json':!![]};rp(_0x49ca4d)[_0xcfa8('0x1b')](function(_0x346160){var _0x472c30={'messageId':_0x346160[_0xcfa8('0x43')]};if(!_0x2af7ec[_0xcfa8('0x44')]){_0x472c30[_0xcfa8('0x3c')]=!![];}return _0x23d44f[_0xcfa8('0x1c')](_0x472c30);})[_0xcfa8('0x1e')](function(_0xadf4df){logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),'afterCreate','connectel',util['inspect'](_0xadf4df,{'showHidden':![],'depth':null}));});}else{logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x3f'),_0xcfa8('0x45'));}break;case _0xcfa8('0x46'):if(_0x2af7ec[_0xcfa8('0x30')]&&_0x2af7ec[_0xcfa8('0x31')]){var _0x50e03d={'messages':[{'source':_0xcfa8('0x47'),'to':_0x14d748[_0xcfa8('0x25')],'body':_0x14d748[_0xcfa8('0xf')],'from':_0x2af7ec[_0xcfa8('0x41')]||_0x2af7ec[_0xcfa8('0x25')]}]};var _0x63d6b9=util[_0xcfa8('0x48')](_0xcfa8('0x49'),_0x2af7ec[_0xcfa8('0x30')],_0x2af7ec[_0xcfa8('0x31')]);var _0x49ca4d={'method':_0xcfa8('0x42'),'uri':_0xcfa8('0x4a'),'body':_0x50e03d,'headers':{'Authorization':util[_0xcfa8('0x48')](_0xcfa8('0x4b'),new Buffer(_0x63d6b9)[_0xcfa8('0x4c')]('base64'))},'json':!![]};rp(_0x49ca4d)[_0xcfa8('0x1b')](function(_0xe4e9ea){if(_0xe4e9ea[_0xcfa8('0x4d')]>=0xc8&&_0xe4e9ea['http_code']<=0xce){if(_0xe4e9ea[_0xcfa8('0x4e')]&&_0xe4e9ea[_0xcfa8('0x4e')][_0xcfa8('0x4f')]>0x0){var _0x5155d=_[_0xcfa8('0x50')](_0xe4e9ea[_0xcfa8('0x4e')][_0xcfa8('0x51')]);var _0x73c821={'messageId':_0x5155d[_0xcfa8('0x52')]};if(!_0x2af7ec[_0xcfa8('0x44')]){_0x73c821[_0xcfa8('0x3c')]=!![];}return _0x23d44f[_0xcfa8('0x1c')](_0x73c821);}else{logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),'afterCreate',_0xcfa8('0x53'),util['inspect'](_0xe4e9ea,{'showHidden':![],'depth':null}));}}else{logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x53'),util[_0xcfa8('0x3d')](_0xe4e9ea,{'showHidden':![],'depth':null}));}})[_0xcfa8('0x1e')](function(_0x147063){logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x53'),util[_0xcfa8('0x3d')](_0x147063,{'showHidden':![],'depth':null}));});}else{logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x53'),_0xcfa8('0x3e'));}break;case _0xcfa8('0x54'):if(_0x2af7ec[_0xcfa8('0x55')]&&_0x2af7ec[_0xcfa8('0x40')]){var _0x50e03d={'dst':_0x14d748[_0xcfa8('0x25')],'text':_0x14d748['body'],'src':_0x2af7ec[_0xcfa8('0x41')]||_0x2af7ec[_0xcfa8('0x25')],'url':_0x2af7ec[_0xcfa8('0x26')]+'/api/sms/messages/'+_0x14d748['id']+_0xcfa8('0x28')+_0x2af7ec[_0xcfa8('0x29')]};var _0x63d6b9=util[_0xcfa8('0x48')](_0xcfa8('0x49'),_0x2af7ec[_0xcfa8('0x55')],_0x2af7ec[_0xcfa8('0x40')]);var _0x49ca4d={'method':_0xcfa8('0x42'),'uri':util[_0xcfa8('0x48')]('https://api.plivo.com/v1/Account/%s/Message/',_0x2af7ec[_0xcfa8('0x55')]),'body':_0x50e03d,'headers':{'Authorization':util[_0xcfa8('0x48')](_0xcfa8('0x4b'),new Buffer(_0x63d6b9)[_0xcfa8('0x4c')](_0xcfa8('0x56')))},'json':!![]};rp(_0x49ca4d)['then'](function(_0x47afb1){var _0x24c6e8={'messageId':_0x47afb1[_0xcfa8('0x57')][0x0]};return _0x23d44f[_0xcfa8('0x1c')](_0x24c6e8);})[_0xcfa8('0x1e')](function(_0x52d89f){logger['error'](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x54'),util[_0xcfa8('0x3d')](_0x52d89f,{'showHidden':![],'depth':null}));});}else{logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),_0xcfa8('0x2c'),'plivo',_0xcfa8('0x58'));}break;case _0xcfa8('0x59'):if(_0x2af7ec[_0xcfa8('0x30')]&&_0x2af7ec['password']){if(_0x2af7ec[_0xcfa8('0x5a')]){var _0x2d79fb={'method':_0xcfa8('0x42'),'uri':_0x2af7ec['baseUrl']+_0xcfa8('0x5b'),'body':{'username':_0x2af7ec[_0xcfa8('0x30')],'password':_0x2af7ec['password']},'json':!![]};return rp(_0x2d79fb)[_0xcfa8('0x1b')](function(_0x169bbf){var _0x3b3fab={'method':_0xcfa8('0x42'),'uri':_0x2af7ec['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2af7ec[_0xcfa8('0x25')],'destinations':[{'to':_0x14d748['phone']}],'text':_0x14d748['body'],'notifyUrl':_0x2af7ec[_0xcfa8('0x26')]+_0xcfa8('0x27')+_0x14d748['id']+'/status?token='+_0x2af7ec[_0xcfa8('0x29')],'notifyContentType':_0xcfa8('0x5c'),'callbackData':_0x2af7ec[_0xcfa8('0x25')]+';'+_0x14d748[_0xcfa8('0xf')]}]},'headers':{'Authorization':_0xcfa8('0x5d')+_0x169bbf[_0xcfa8('0x29')]},'json':!![]};return rp(_0x3b3fab)['then'](function(_0x48c254){if(_0x48c254[_0xcfa8('0x51')]){var _0x463537={'messageId':_0x48c254[_0xcfa8('0x51')][0x0][_0xcfa8('0xd')]};if(!_0x2af7ec[_0xcfa8('0x44')]){_0x463537[_0xcfa8('0x3c')]=!![];}return _0x23d44f[_0xcfa8('0x1c')](_0x463537);}else{return logger['error'](_0xcfa8('0x2b'),'afterCreate','infobip',util[_0xcfa8('0x3d')](_0x48c254,{'showHidden':![],'depth':null}));}});})[_0xcfa8('0x1e')](function(_0xa00d98){return logger['error'](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x59'),util['inspect'](_0xa00d98,{'showHidden':![],'depth':null}));});}else{logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x59'),_0xcfa8('0x5e'));}}else{logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),'afterCreate',_0xcfa8('0x59'),_0xcfa8('0x3e'));}break;case _0xcfa8('0x5f'):var _0x3bce9f=require(_0xcfa8('0x60'));if(_0x2af7ec[_0xcfa8('0x61')]){var _0x2be0af={};_0x2be0af['login']=_0x2af7ec[_0xcfa8('0x30')];_0x2be0af[_0xcfa8('0x25')]=_0x14d748[_0xcfa8('0x25')];_0x2be0af['sender']=_0x2af7ec[_0xcfa8('0x25')];_0x2be0af[_0xcfa8('0x62')]=_0x14d748['body'];_0x2be0af['timestamp']=+new Date();var _0x176420='';var _0x2ad23e='';var _0x1b0824=Object[_0xcfa8('0x63')](_0x2be0af);_0x1b0824[_0xcfa8('0x64')]();for(var _0x2606e3=0x0;_0x2606e3<_0x1b0824[_0xcfa8('0x65')];_0x2606e3++){if(_0x176420!=''){_0x176420+='&';}_0x176420+=_0x1b0824[_0x2606e3]+'='+encodeURIComponent(_0x2be0af[_0x1b0824[_0x2606e3]]);_0x2ad23e+=_0x2be0af[_0x1b0824[_0x2606e3]];}_0x2ad23e+=_0x2af7ec['apiKey'];_0x2ad23e=_0x3bce9f[_0xcfa8('0x66')](_0xcfa8('0x67'))[_0xcfa8('0x1c')](_0x2ad23e)[_0xcfa8('0x68')](_0xcfa8('0x69'));if(_0x176420!==''){_0x176420+='&';}_0x176420+=_0xcfa8('0x6a')+_0x2ad23e;var _0x1115f8={'method':_0xcfa8('0x6b'),'uri':_0x2af7ec[_0xcfa8('0x5a')]+_0xcfa8('0x6c')+_0x176420,'json':!![]};return rp(_0x1115f8)[_0xcfa8('0x1b')](function(_0x5187d1){var _0x87622d=Object[_0xcfa8('0x63')](_0x5187d1);if(_0x5187d1[_0x87622d[0x0]][_0xcfa8('0x1f')]&&parseInt(_0x5187d1[_0x87622d[0x0]][_0xcfa8('0x1f')])===0x0){var _0x5e03eb={'messageId':_0x5187d1[_0x87622d[0x0]]['id_sms']};if(!_0x2af7ec[_0xcfa8('0x44')]){_0x5e03eb['read']=!![];}return _0x23d44f[_0xcfa8('0x1c')](_0x5e03eb);}else{return logger['error'](_0xcfa8('0x2b'),'afterCreate','csc',util[_0xcfa8('0x3d')](_0x5187d1[_0xcfa8('0x1f')],{'showHidden':![],'depth':null}));}})[_0xcfa8('0x1e')](function(_0x16e828){return logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x5f'),util[_0xcfa8('0x3d')](_0x16e828,{'showHidden':![],'depth':null}));});}else{logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),'afterCreate',_0xcfa8('0x5f'),'Missing\x20parameters:\x20apiKey');}break;case _0xcfa8('0x6d'):if(_0x2af7ec[_0xcfa8('0x61')]){var _0x3b4758={'method':_0xcfa8('0x42'),'uri':_0xcfa8('0x6e'),'headers':{'Authorization':_0x2af7ec[_0xcfa8('0x61')]},'body':{'content':_0x14d748[_0xcfa8('0xf')],'to':[_0x14d748[_0xcfa8('0x25')]],'from':_0x2af7ec[_0xcfa8('0x25')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x3b4758)['then'](function(_0x5a737f){if(!_0x5a737f['error']){var _0x134637={'messageId':_0x5a737f['messages'][0x0]['apiMessageId']};if(!_0x2af7ec['deliveryReport']){_0x134637[_0xcfa8('0x3c')]=!![];}return _0x23d44f[_0xcfa8('0x1c')](_0x134637);}else{return logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),'afterCreate',_0xcfa8('0x6d'),util[_0xcfa8('0x3d')](_0x5a737f[_0xcfa8('0x1f')],{'showHidden':![],'depth':null}));}})[_0xcfa8('0x1e')](function(_0xb254c3){return logger['error'](_0xcfa8('0x2b'),_0xcfa8('0x2c'),'clickatell',util[_0xcfa8('0x3d')](_0xb254c3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x6d'),_0xcfa8('0x6f'));}break;case'bandwidth':if(_0x2af7ec[_0xcfa8('0x30')]&&_0x2af7ec[_0xcfa8('0x31')]){var _0x63d6b9=util[_0xcfa8('0x48')]('%s:%s',_0x2af7ec[_0xcfa8('0x30')],_0x2af7ec[_0xcfa8('0x31')]);var _0x49ca4d={'method':_0xcfa8('0x42'),'uri':_0xcfa8('0x70')+_0x2af7ec[_0xcfa8('0x71')]+'/messages','body':{'to':[_0x14d748['phone']],'text':_0x14d748[_0xcfa8('0xf')],'from':_0x2af7ec[_0xcfa8('0x25')],'applicationId':_0x2af7ec['applicationId']},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x63d6b9)['toString']('base64'))},'json':!![]};rp(_0x49ca4d)[_0xcfa8('0x1b')](function(_0x3f9e78){if(_0x3f9e78['id']){var _0x26e6bb={'messageId':_0x3f9e78['id']};return _0x23d44f[_0xcfa8('0x1c')](_0x26e6bb);}else{logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x72'),util[_0xcfa8('0x3d')](_0x3f9e78,{'showHidden':![],'depth':null}));}})[_0xcfa8('0x1e')](function(_0x11b1f0){logger['error'](_0xcfa8('0x2b'),_0xcfa8('0x2c'),'bandwidth',util[_0xcfa8('0x3d')](_0x11b1f0,{'showHidden':![],'depth':null}));});}else{logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),'afterCreate',_0xcfa8('0x72'),_0xcfa8('0x3e'));}break;case _0xcfa8('0x73'):if(_0x2af7ec[_0xcfa8('0x61')]){var _0x351a97={};var _0x1115f8={'method':'POST','uri':_0xcfa8('0x74'),'headers':{'Authorization':_0xcfa8('0x75')+_0x2af7ec[_0xcfa8('0x61')],'Content-Type':_0xcfa8('0x5c')},'body':{'from':_0x2af7ec[_0xcfa8('0x25')],'to':_0x14d748[_0xcfa8('0x25')],'text':_0x14d748[_0xcfa8('0xf')]},'json':!![]};return rp(_0x1115f8)[_0xcfa8('0x1b')](function(_0x34d99f){if(_0x34d99f[_0xcfa8('0x76')]==0xca){_0x351a97['message']=_0x34d99f;var _0x2b7312={'method':'POST','uri':_0xcfa8('0x77'),'headers':{'Authorization':_0xcfa8('0x75')+_0x2af7ec[_0xcfa8('0x61')],'Content-Type':_0xcfa8('0x5c')},'body':{'refid':_0x351a97[_0xcfa8('0x78')][_0xcfa8('0x79')]},'json':!![]};return rp(_0x2b7312)[_0xcfa8('0x1b')](function(_0x313e5b){_0x351a97['status']=_0x313e5b;var _0x4cedbb={'messageId':_0x351a97[_0xcfa8('0x78')][_0xcfa8('0x79')],'read':!![]};return _0x23d44f[_0xcfa8('0x1c')](_0x4cedbb);});}else{return logger['error'](_0xcfa8('0x2b'),_0xcfa8('0x2c'),_0xcfa8('0x73'),util[_0xcfa8('0x3d')](_0x34d99f,{'showHidden':![],'depth':null}));}})[_0xcfa8('0x1e')](function(_0xb16cfa){return logger[_0xcfa8('0x1f')](_0xcfa8('0x2b'),_0xcfa8('0x2c'),'intelepeer',util[_0xcfa8('0x3d')](_0xb16cfa,{'showHidden':![],'depth':null}));});}else{return logger[_0xcfa8('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfa8('0x2c'),'intelepeer',_0xcfa8('0x7a'));}break;}}})[_0xcfa8('0x7b')](function(){_0x191e6e();});}else{_0x191e6e();}}},'charset':'utf8mb4','collate':_0xcfa8('0x7c')});}; \ No newline at end of file +var _0xa7aa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','messageId','body','FULLTEXT','models','get','direction','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','createdAt','catch','error','out','find','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','session_key','total_sent','internal_order_id','deliveryReport','update','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','read','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','clickSend','token','authId','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','Missing\x20parameters:\x20base_url','crypto','login','timestamp','keys','sort','length','apiKey','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','/messages','applicationId','base64','intelepeer','Bearer\x20','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','api'];(function(_0x1c0e78,_0x243bf3){var _0x581e0e=function(_0x28b7b5){while(--_0x28b7b5){_0x1c0e78['push'](_0x1c0e78['shift']());}};_0x581e0e(++_0x243bf3);}(_0xa7aa,0xf2));var _0xaa7a=function(_0x1bae8a,_0x494461){_0x1bae8a=_0x1bae8a-0x0;var _0xf33f33=_0xa7aa[_0x1bae8a];return _0xf33f33;};'use strict';var _=require('lodash');var util=require(_0xaa7a('0x0'));var logger=require('../../config/logger')(_0xaa7a('0x1'));var moment=require(_0xaa7a('0x2'));var BPromise=require(_0xaa7a('0x3'));var rp=require(_0xaa7a('0x4'));var fs=require('fs');var path=require(_0xaa7a('0x5'));var rimraf=require(_0xaa7a('0x6'));var config=require(_0xaa7a('0x7'));var attributes=require('./smsMessage.attributes');module[_0xaa7a('0x8')]=function(_0x3c8efb,_0x13c303){return _0x3c8efb[_0xaa7a('0x9')](_0xaa7a('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xaa7a('0xb'),'fields':[_0xaa7a('0xb')]},{'name':'fti_sms_messages','fields':[_0xaa7a('0xc')],'type':_0xaa7a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f6a6e,_0x5e631d,_0x562443){var _0x29f5d4=_0x3c8efb[_0xaa7a('0xe')];var _0x376127=_0x1f6a6e[_0xaa7a('0xf')]({'plain':!![]});if(_0x376127[_0xaa7a('0x10')]['toLowerCase']()==='in'||_0x376127[_0xaa7a('0x10')]['toLowerCase']()==='out'&&!_0x376127[_0xaa7a('0x11')]&&!_[_0xaa7a('0x12')](_0x376127[_0xaa7a('0x13')])&&!_[_0xaa7a('0x12')](_0x376127[_0xaa7a('0x14')])){_0x29f5d4[_0xaa7a('0x15')]['findOne']({'where':{'id':_0x376127[_0xaa7a('0x14')]}})[_0xaa7a('0x16')](function(_0x4a6d27){if(_0x4a6d27){_0x4a6d27['update']({'lastMsgAt':_0x376127[_0xaa7a('0x17')],'lastMsgDirection':_0x376127[_0xaa7a('0x10')]['toLowerCase']()});}})[_0xaa7a('0x18')](function(_0x52f0f4){console[_0xaa7a('0x19')](_0x52f0f4);});}if(_0x376127[_0xaa7a('0x10')]===_0xaa7a('0x1a')&&!_0x376127[_0xaa7a('0x11')]){var _0x5ecac6;_0x29f5d4['SmsAccount'][_0xaa7a('0x1b')]({'where':{'id':_0x376127['SmsAccountId']},'raw':!![]})['then'](function(_0x486aa2){_0x5ecac6=_0x486aa2;if(_0x5ecac6&&_0x5ecac6[_0xaa7a('0x1c')]){switch(_0x5ecac6['type']){case _0xaa7a('0x1d'):var _0xfcae77=require(_0xaa7a('0x1d'));if(_0x5ecac6['accountSid']&&_0x5ecac6[_0xaa7a('0x1e')]&&_0x5ecac6[_0xaa7a('0x1f')]){var _0x3456a1=new _0xfcae77(_0x5ecac6[_0xaa7a('0x20')],_0x5ecac6[_0xaa7a('0x1e')]);_0x3456a1[_0xaa7a('0x21')][_0xaa7a('0x22')]({'body':_0x376127[_0xaa7a('0xc')],'to':_0x376127[_0xaa7a('0x1f')],'from':_0x5ecac6[_0xaa7a('0x1f')],'statusCallback':_0x5ecac6[_0xaa7a('0x23')]+_0xaa7a('0x24')+_0x376127['id']+_0xaa7a('0x25')+_0x5ecac6['token']})['then'](function(_0x3e0f59){if(_0x3e0f59[_0xaa7a('0x26')]){return _0x1f6a6e['update']({'messageId':_0x3e0f59[_0xaa7a('0x26')]});}})[_0xaa7a('0x18')](function(_0x2de662){logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'twilio',util[_0xaa7a('0x29')](_0x2de662,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaa7a('0x27'),_0xaa7a('0x28'),'twilio',_0xaa7a('0x2a'));}break;case _0xaa7a('0x2b'):var _0x4b409c=_0xaa7a('0x2c');if(_0x5ecac6['username']&&_0x5ecac6[_0xaa7a('0x2d')]){var _0x2bd490={'recipient':[_0x376127[_0xaa7a('0x1f')]],'message':_0x376127['body'],'message_type':_0x5ecac6['smsMethod']};if(_0x5ecac6[_0xaa7a('0x2e')]&&_0x5ecac6[_0xaa7a('0x2e')]!=='SI'){_0x2bd490[_0xaa7a('0x2f')]=_0x5ecac6[_0xaa7a('0x1f')];}var _0x3ecefc={'url':_0x4b409c+_0xaa7a('0x30')+_0x5ecac6[_0xaa7a('0x31')]+_0xaa7a('0x32')+_0x5ecac6[_0xaa7a('0x2d')],'method':_0xaa7a('0x33')};rp(_0x3ecefc)['then'](function(_0x58b30e){var _0x4ce050=_0x58b30e[_0xaa7a('0x34')](';');var _0xe5f818={'user_key':_0x4ce050[0x0],'session_key':_0x4ce050[0x1]};_0x3ecefc={'url':_0x4b409c+_0xaa7a('0x35'),'method':'POST','headers':{'user_key':_0xe5f818['user_key'],'Session_key':_0xe5f818[_0xaa7a('0x36')]},'json':!![],'body':_0x2bd490};return rp(_0x3ecefc);})[_0xaa7a('0x16')](function(_0x49c3a5){if(_0x49c3a5[_0xaa7a('0x37')]>=0x1){var _0x12f7e1={'messageId':_0x49c3a5[_0xaa7a('0x38')]};if(_0x5ecac6[_0xaa7a('0x2e')]!=='GP'||!_0x5ecac6[_0xaa7a('0x39')]){_0x12f7e1['read']=!![];}return _0x1f6a6e[_0xaa7a('0x3a')](_0x12f7e1);}else{return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x2b'),util[_0xaa7a('0x29')](_0x49c3a5,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5e9b9c){return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x2b'),util['inspect'](_0x5e9b9c,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'skebby',_0xaa7a('0x3b'));}break;case _0xaa7a('0x3c'):if(_0x5ecac6[_0xaa7a('0x1e')]){var _0x4df9dd={'recipient':_0x376127['phone'],'message':_0x376127['body'],'sender':_0x5ecac6[_0xaa7a('0x3d')]||_0x5ecac6[_0xaa7a('0x1f')],'authorization':_0x5ecac6['authToken']};var _0x5e631d={'method':_0xaa7a('0x3e'),'uri':_0xaa7a('0x3f'),'body':_0x4df9dd,'json':!![]};rp(_0x5e631d)[_0xaa7a('0x16')](function(_0x9f3871){var _0x5747e9={'messageId':_0x9f3871[_0xaa7a('0x40')]};if(!_0x5ecac6[_0xaa7a('0x39')]){_0x5747e9[_0xaa7a('0x41')]=!![];}return _0x1f6a6e[_0xaa7a('0x3a')](_0x5747e9);})[_0xaa7a('0x18')](function(_0x5e5d6c){logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'connectel',util['inspect'](_0x5e5d6c,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x5ecac6[_0xaa7a('0x31')]&&_0x5ecac6[_0xaa7a('0x2d')]){var _0x4df9dd={'messages':[{'source':_0xaa7a('0x42'),'to':_0x376127[_0xaa7a('0x1f')],'body':_0x376127['body'],'from':_0x5ecac6[_0xaa7a('0x3d')]||_0x5ecac6[_0xaa7a('0x1f')]}]};var _0x6999dc=util[_0xaa7a('0x43')](_0xaa7a('0x44'),_0x5ecac6[_0xaa7a('0x31')],_0x5ecac6['password']);var _0x5e631d={'method':_0xaa7a('0x3e'),'uri':_0xaa7a('0x45'),'body':_0x4df9dd,'headers':{'Authorization':util['format'](_0xaa7a('0x46'),new Buffer(_0x6999dc)[_0xaa7a('0x47')]('base64'))},'json':!![]};rp(_0x5e631d)[_0xaa7a('0x16')](function(_0x16f532){if(_0x16f532[_0xaa7a('0x48')]>=0xc8&&_0x16f532[_0xaa7a('0x48')]<=0xce){if(_0x16f532[_0xaa7a('0x49')]&&_0x16f532[_0xaa7a('0x49')][_0xaa7a('0x4a')]>0x0){var _0x29507a=_[_0xaa7a('0x4b')](_0x16f532['data'][_0xaa7a('0x21')]);var _0x29fdd5={'messageId':_0x29507a['message_id']};if(!_0x5ecac6[_0xaa7a('0x39')]){_0x29fdd5[_0xaa7a('0x41')]=!![];}return _0x1f6a6e[_0xaa7a('0x3a')](_0x29fdd5);}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x4c'),util[_0xaa7a('0x29')](_0x16f532,{'showHidden':![],'depth':null}));}}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'clickSend',util['inspect'](_0x16f532,{'showHidden':![],'depth':null}));}})['catch'](function(_0x55b49d){logger[_0xaa7a('0x19')](_0xaa7a('0x27'),'afterCreate',_0xaa7a('0x4c'),util['inspect'](_0x55b49d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaa7a('0x27'),'afterCreate',_0xaa7a('0x4c'),_0xaa7a('0x3b'));}break;case'plivo':if(_0x5ecac6['authId']&&_0x5ecac6['authToken']){var _0x4df9dd={'dst':_0x376127[_0xaa7a('0x1f')],'text':_0x376127[_0xaa7a('0xc')],'src':_0x5ecac6[_0xaa7a('0x3d')]||_0x5ecac6[_0xaa7a('0x1f')],'url':_0x5ecac6['remote']+_0xaa7a('0x24')+_0x376127['id']+_0xaa7a('0x25')+_0x5ecac6[_0xaa7a('0x4d')]};var _0x6999dc=util[_0xaa7a('0x43')]('%s:%s',_0x5ecac6[_0xaa7a('0x4e')],_0x5ecac6['authToken']);var _0x5e631d={'method':_0xaa7a('0x3e'),'uri':util[_0xaa7a('0x43')]('https://api.plivo.com/v1/Account/%s/Message/',_0x5ecac6[_0xaa7a('0x4e')]),'body':_0x4df9dd,'headers':{'Authorization':util[_0xaa7a('0x43')](_0xaa7a('0x46'),new Buffer(_0x6999dc)[_0xaa7a('0x47')]('base64'))},'json':!![]};rp(_0x5e631d)['then'](function(_0x289409){var _0x1f290b={'messageId':_0x289409[_0xaa7a('0x4f')][0x0]};return _0x1f6a6e[_0xaa7a('0x3a')](_0x1f290b);})[_0xaa7a('0x18')](function(_0x134ad0){logger[_0xaa7a('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa7a('0x28'),'plivo',util[_0xaa7a('0x29')](_0x134ad0,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x50'),_0xaa7a('0x51'));}break;case _0xaa7a('0x52'):if(_0x5ecac6['username']&&_0x5ecac6[_0xaa7a('0x2d')]){if(_0x5ecac6['baseUrl']){var _0x13baac={'method':_0xaa7a('0x3e'),'uri':_0x5ecac6[_0xaa7a('0x53')]+_0xaa7a('0x54'),'body':{'username':_0x5ecac6['username'],'password':_0x5ecac6[_0xaa7a('0x2d')]},'json':!![]};return rp(_0x13baac)[_0xaa7a('0x16')](function(_0x32f010){var _0x331c33={'method':_0xaa7a('0x3e'),'uri':_0x5ecac6['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5ecac6['phone'],'destinations':[{'to':_0x376127[_0xaa7a('0x1f')]}],'text':_0x376127[_0xaa7a('0xc')],'notifyUrl':_0x5ecac6[_0xaa7a('0x23')]+_0xaa7a('0x24')+_0x376127['id']+_0xaa7a('0x25')+_0x5ecac6['token'],'notifyContentType':'application/json','callbackData':_0x5ecac6[_0xaa7a('0x1f')]+';'+_0x376127['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x32f010[_0xaa7a('0x4d')]},'json':!![]};return rp(_0x331c33)[_0xaa7a('0x16')](function(_0x4e0791){if(_0x4e0791[_0xaa7a('0x21')]){var _0x4d1963={'messageId':_0x4e0791[_0xaa7a('0x21')][0x0][_0xaa7a('0xb')]};if(!_0x5ecac6[_0xaa7a('0x39')]){_0x4d1963[_0xaa7a('0x41')]=!![];}return _0x1f6a6e['update'](_0x4d1963);}else{return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x52'),util['inspect'](_0x4e0791,{'showHidden':![],'depth':null}));}});})[_0xaa7a('0x18')](function(_0x1907d0){return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x52'),util[_0xaa7a('0x29')](_0x1907d0,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa7a('0x28'),'infobip',_0xaa7a('0x55'));}}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x1d06e0=require(_0xaa7a('0x56'));if(_0x5ecac6['apiKey']){var _0x572cf8={};_0x572cf8[_0xaa7a('0x57')]=_0x5ecac6[_0xaa7a('0x31')];_0x572cf8[_0xaa7a('0x1f')]=_0x376127['phone'];_0x572cf8['sender']=_0x5ecac6[_0xaa7a('0x1f')];_0x572cf8['text']=_0x376127[_0xaa7a('0xc')];_0x572cf8[_0xaa7a('0x58')]=+new Date();var _0x34f245='';var _0x281a13='';var _0x2a78fb=Object[_0xaa7a('0x59')](_0x572cf8);_0x2a78fb[_0xaa7a('0x5a')]();for(var _0x1ff896=0x0;_0x1ff896<_0x2a78fb[_0xaa7a('0x5b')];_0x1ff896++){if(_0x34f245!=''){_0x34f245+='&';}_0x34f245+=_0x2a78fb[_0x1ff896]+'='+encodeURIComponent(_0x572cf8[_0x2a78fb[_0x1ff896]]);_0x281a13+=_0x572cf8[_0x2a78fb[_0x1ff896]];}_0x281a13+=_0x5ecac6[_0xaa7a('0x5c')];_0x281a13=_0x1d06e0[_0xaa7a('0x5d')](_0xaa7a('0x5e'))[_0xaa7a('0x3a')](_0x281a13)[_0xaa7a('0x5f')]('hex');if(_0x34f245!==''){_0x34f245+='&';}_0x34f245+=_0xaa7a('0x60')+_0x281a13;var _0x3ecefc={'method':_0xaa7a('0x33'),'uri':_0x5ecac6['baseUrl']+_0xaa7a('0x61')+_0x34f245,'json':!![]};return rp(_0x3ecefc)[_0xaa7a('0x16')](function(_0x5d71b9){var _0x324b1b=Object['keys'](_0x5d71b9);if(_0x5d71b9[_0x324b1b[0x0]][_0xaa7a('0x19')]&&parseInt(_0x5d71b9[_0x324b1b[0x0]][_0xaa7a('0x19')])===0x0){var _0x2ce30c={'messageId':_0x5d71b9[_0x324b1b[0x0]][_0xaa7a('0x62')]};if(!_0x5ecac6['deliveryReport']){_0x2ce30c[_0xaa7a('0x41')]=!![];}return _0x1f6a6e[_0xaa7a('0x3a')](_0x2ce30c);}else{return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'csc',util[_0xaa7a('0x29')](_0x5d71b9[_0xaa7a('0x19')],{'showHidden':![],'depth':null}));}})[_0xaa7a('0x18')](function(_0x36cddc){return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x63'),util[_0xaa7a('0x29')](_0x36cddc,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x63'),_0xaa7a('0x64'));}break;case _0xaa7a('0x65'):if(_0x5ecac6[_0xaa7a('0x5c')]){var _0x358b9a={'method':_0xaa7a('0x3e'),'uri':_0xaa7a('0x66'),'headers':{'Authorization':_0x5ecac6[_0xaa7a('0x5c')]},'body':{'content':_0x376127[_0xaa7a('0xc')],'to':[_0x376127['phone']],'from':_0x5ecac6[_0xaa7a('0x1f')],'binary':![],'clientMessageId':_0xaa7a('0x67'),'charset':_0xaa7a('0x68')},'json':!![]};rp(_0x358b9a)[_0xaa7a('0x16')](function(_0x2cec4c){if(!_0x2cec4c['error']){var _0x4dd409={'messageId':_0x2cec4c['messages'][0x0][_0xaa7a('0x69')]};if(!_0x5ecac6[_0xaa7a('0x39')]){_0x4dd409[_0xaa7a('0x41')]=!![];}return _0x1f6a6e[_0xaa7a('0x3a')](_0x4dd409);}else{return logger[_0xaa7a('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa7a('0x28'),_0xaa7a('0x65'),util['inspect'](_0x2cec4c[_0xaa7a('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3f11d3){return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x65'),util[_0xaa7a('0x29')](_0x3f11d3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa7a('0x28'),_0xaa7a('0x65'),_0xaa7a('0x64'));}break;case _0xaa7a('0x6a'):if(_0x5ecac6[_0xaa7a('0x31')]&&_0x5ecac6[_0xaa7a('0x2d')]){var _0x6999dc=util['format'](_0xaa7a('0x44'),_0x5ecac6['username'],_0x5ecac6[_0xaa7a('0x2d')]);var _0x5e631d={'method':_0xaa7a('0x3e'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x5ecac6['accountId']+_0xaa7a('0x6b'),'body':{'to':[_0x376127[_0xaa7a('0x1f')]],'text':_0x376127['body'],'from':_0x5ecac6[_0xaa7a('0x1f')],'applicationId':_0x5ecac6[_0xaa7a('0x6c')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x6999dc)['toString'](_0xaa7a('0x6d')))},'json':!![]};rp(_0x5e631d)[_0xaa7a('0x16')](function(_0x32abc8){if(_0x32abc8['id']){var _0x50e8e4={'messageId':_0x32abc8['id']};return _0x1f6a6e[_0xaa7a('0x3a')](_0x50e8e4);}else{logger[_0xaa7a('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xaa7a('0x6a'),util[_0xaa7a('0x29')](_0x32abc8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4629ff){logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'bandwidth',util[_0xaa7a('0x29')](_0x4629ff,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'bandwidth',_0xaa7a('0x3b'));}break;case _0xaa7a('0x6e'):if(_0x5ecac6[_0xaa7a('0x5c')]){var _0x2ebe47={};var _0x3ecefc={'method':_0xaa7a('0x3e'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xaa7a('0x6f')+_0x5ecac6[_0xaa7a('0x5c')],'Content-Type':_0xaa7a('0x70')},'body':{'from':_0x5ecac6[_0xaa7a('0x1f')],'to':_0x376127[_0xaa7a('0x1f')],'text':_0x376127[_0xaa7a('0xc')]},'json':!![]};return rp(_0x3ecefc)['then'](function(_0xdd0df5){if(_0xdd0df5[_0xaa7a('0x71')]==0xca){_0x2ebe47['message']=_0xdd0df5;var _0x47a43a={'method':_0xaa7a('0x3e'),'uri':_0xaa7a('0x72'),'headers':{'Authorization':_0xaa7a('0x6f')+_0x5ecac6[_0xaa7a('0x5c')],'Content-Type':_0xaa7a('0x70')},'body':{'refid':_0x2ebe47['message'][_0xaa7a('0x73')]},'json':!![]};return rp(_0x47a43a)[_0xaa7a('0x16')](function(_0x483272){_0x2ebe47[_0xaa7a('0x74')]=_0x483272;var _0x4b330b={'messageId':_0x2ebe47[_0xaa7a('0x75')][_0xaa7a('0x73')],'read':!![]};return _0x1f6a6e['update'](_0x4b330b);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa7a('0x28'),_0xaa7a('0x6e'),util[_0xaa7a('0x29')](_0xdd0df5,{'showHidden':![],'depth':null}));}})[_0xaa7a('0x18')](function(_0x2602ed){return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x6e'),util['inspect'](_0x2602ed,{'showHidden':![],'depth':null}));});}else{return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x6e'),_0xaa7a('0x76'));}break;}}})[_0xaa7a('0x77')](function(){_0x562443();});}else{_0x562443();}}},'charset':_0xaa7a('0x78'),'collate':_0xaa7a('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 21c0f95..4e4d401 100644 --- a/server/api/smsMessage/smsMessage.rpc.js +++ b/server/api/smsMessage/smsMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30ff=['result','catch','create','body','options','raw','info','CreateSmsMessage','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0xef7cb2,_0x4588d5){var _0x35b493=function(_0x264ab3){while(--_0x264ab3){_0xef7cb2['push'](_0xef7cb2['shift']());}};_0x35b493(++_0x4588d5);}(_0x30ff,0x17f));var _0xf30f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x30ff[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf30f('0x0'));var util=require('util');var moment=require(_0xf30f('0x1'));var BPromise=require(_0xf30f('0x2'));var rs=require(_0xf30f('0x3'));var fs=require('fs');var Redis=require(_0xf30f('0x4'));var db=require(_0xf30f('0x5'))['db'];var utils=require(_0xf30f('0x6'));var logger=require('../../config/logger')(_0xf30f('0x7'));var config=require(_0xf30f('0x8'));var jayson=require(_0xf30f('0x9'));var client=jayson[_0xf30f('0xa')]['http']({'port':0x232a});config[_0xf30f('0xb')]=_[_0xf30f('0xc')](config[_0xf30f('0xb')],{'host':_0xf30f('0xd'),'port':0x18eb});var socket=require(_0xf30f('0xe'))(new Redis(config['redis']));require(_0xf30f('0xf'))[_0xf30f('0x10')](socket);function respondWithRpcPromise(_0x37ecac,_0x2d8d53,_0x173b4f){return new BPromise(function(_0x37fe09,_0x5243de){return client[_0xf30f('0x11')](_0x37ecac,_0x173b4f)[_0xf30f('0x12')](function(_0x44757d){logger['info'](_0xf30f('0x13'),_0x2d8d53,'request\x20sent');logger[_0xf30f('0x14')](_0xf30f('0x15'),_0x2d8d53,_0xf30f('0x16'),JSON['stringify'](_0x44757d));if(_0x44757d[_0xf30f('0x17')]){if(_0x44757d[_0xf30f('0x17')]['code']===0x1f4){logger[_0xf30f('0x17')](_0xf30f('0x13'),_0x2d8d53,_0x44757d[_0xf30f('0x17')]['message']);return _0x5243de(_0x44757d[_0xf30f('0x17')]['message']);}logger['error'](_0xf30f('0x13'),_0x2d8d53,_0x44757d[_0xf30f('0x17')][_0xf30f('0x18')]);return _0x37fe09(_0x44757d[_0xf30f('0x17')][_0xf30f('0x18')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x2d8d53,_0xf30f('0x16'));_0x37fe09(_0x44757d[_0xf30f('0x19')]['message']);}})[_0xf30f('0x1a')](function(_0x392cf8){logger[_0xf30f('0x17')](_0xf30f('0x13'),_0x2d8d53,_0x392cf8);_0x5243de(_0x392cf8);});});}exports['CreateSmsMessage']=function(_0x595899){var _0x325bb0=this;return new Promise(function(_0x596783,_0x108bec){return db['SmsMessage'][_0xf30f('0x1b')](_0x595899[_0xf30f('0x1c')],{'raw':_0x595899['options']?_0x595899[_0xf30f('0x1d')][_0xf30f('0x1e')]===undefined?!![]:![]:!![]})[_0xf30f('0x12')](function(_0x5be07c){logger[_0xf30f('0x1f')](_0xf30f('0x20'),_0x595899);logger[_0xf30f('0x14')](_0xf30f('0x20'),_0x595899,JSON[_0xf30f('0x21')](_0x5be07c));_0x596783(_0x5be07c);})[_0xf30f('0x1a')](function(_0x4832f2){logger[_0xf30f('0x17')](_0xf30f('0x20'),_0x4832f2['message'],_0x595899);_0x108bec(_0x325bb0[_0xf30f('0x17')](0x1f4,_0x4832f2[_0xf30f('0x18')]));});});}; \ No newline at end of file +var _0xc019=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','info','catch','create','options','then','CreateSmsMessage','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3e7b07,_0x19364a){var _0x33c396=function(_0x3aa3e3){while(--_0x3aa3e3){_0x3e7b07['push'](_0x3e7b07['shift']());}};_0x33c396(++_0x19364a);}(_0xc019,0xeb));var _0x9c01=function(_0x354b70,_0x2ef33d){_0x354b70=_0x354b70-0x0;var _0x40ede5=_0xc019[_0x354b70];return _0x40ede5;};'use strict';var _=require(_0x9c01('0x0'));var util=require('util');var moment=require(_0x9c01('0x1'));var BPromise=require(_0x9c01('0x2'));var rs=require(_0x9c01('0x3'));var fs=require('fs');var Redis=require(_0x9c01('0x4'));var db=require(_0x9c01('0x5'))['db'];var utils=require(_0x9c01('0x6'));var logger=require(_0x9c01('0x7'))('rpc');var config=require(_0x9c01('0x8'));var jayson=require(_0x9c01('0x9'));var client=jayson[_0x9c01('0xa')]['http']({'port':0x232a});config[_0x9c01('0xb')]=_[_0x9c01('0xc')](config[_0x9c01('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9c01('0xd'))(new Redis(config[_0x9c01('0xb')]));require(_0x9c01('0xe'))[_0x9c01('0xf')](socket);function respondWithRpcPromise(_0x48b2fc,_0x2c7ea1,_0x15e4e5){return new BPromise(function(_0x1c567c,_0x56d4be){return client[_0x9c01('0x10')](_0x48b2fc,_0x15e4e5)['then'](function(_0x41b1ca){logger['info']('SmsMessage,\x20%s,\x20%s',_0x2c7ea1,_0x9c01('0x11'));logger[_0x9c01('0x12')](_0x9c01('0x13'),_0x2c7ea1,_0x9c01('0x11'),JSON[_0x9c01('0x14')](_0x41b1ca));if(_0x41b1ca[_0x9c01('0x15')]){if(_0x41b1ca[_0x9c01('0x15')]['code']===0x1f4){logger['error'](_0x9c01('0x16'),_0x2c7ea1,_0x41b1ca['error'][_0x9c01('0x17')]);return _0x56d4be(_0x41b1ca[_0x9c01('0x15')][_0x9c01('0x17')]);}logger[_0x9c01('0x15')]('SmsMessage,\x20%s,\x20%s',_0x2c7ea1,_0x41b1ca[_0x9c01('0x15')][_0x9c01('0x17')]);return _0x1c567c(_0x41b1ca[_0x9c01('0x15')][_0x9c01('0x17')]);}else{logger[_0x9c01('0x18')]('SmsMessage,\x20%s,\x20%s',_0x2c7ea1,_0x9c01('0x11'));_0x1c567c(_0x41b1ca['result'][_0x9c01('0x17')]);}})[_0x9c01('0x19')](function(_0x4f25f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x2c7ea1,_0x4f25f4);_0x56d4be(_0x4f25f4);});});}exports['CreateSmsMessage']=function(_0x15b8ea){var _0x822b21=this;return new Promise(function(_0x5d80d7,_0x3d4f00){return db['SmsMessage'][_0x9c01('0x1a')](_0x15b8ea['body'],{'raw':_0x15b8ea[_0x9c01('0x1b')]?_0x15b8ea[_0x9c01('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x9c01('0x1c')](function(_0x211633){logger['info'](_0x9c01('0x1d'),_0x15b8ea);logger[_0x9c01('0x12')](_0x9c01('0x1d'),_0x15b8ea,JSON[_0x9c01('0x14')](_0x211633));_0x5d80d7(_0x211633);})[_0x9c01('0x19')](function(_0x352fa9){logger[_0x9c01('0x15')]('CreateSmsMessage',_0x352fa9['message'],_0x15b8ea);_0x3d4f00(_0x822b21[_0x9c01('0x15')](0x1f4,_0x352fa9[_0x9c01('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index fa4498e..50efd43 100644 --- a/server/api/smsMessage/smsMessage.socket.js +++ b/server/api/smsMessage/smsMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77f1=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x4e0eab,_0x529223){var _0x2cefca=function(_0x3c6186){while(--_0x3c6186){_0x4e0eab['push'](_0x4e0eab['shift']());}};_0x2cefca(++_0x529223);}(_0x77f1,0x91));var _0x177f=function(_0x272d4c,_0x4fb0c3){_0x272d4c=_0x272d4c-0x0;var _0x632a80=_0x77f1[_0x272d4c];return _0x632a80;};'use strict';var SmsMessageEvents=require(_0x177f('0x0'));var events=[_0x177f('0x1'),'remove','update'];function createListener(_0xa187e5,_0x57fc61){return function(_0x256d3a){_0x57fc61[_0x177f('0x2')](_0xa187e5,_0x256d3a);};}function removeListener(_0x207136,_0x3abe83){return function(){SmsMessageEvents[_0x177f('0x3')](_0x207136,_0x3abe83);};}exports[_0x177f('0x4')]=function(_0x2017ed){for(var _0x1d8e43=0x0,_0x1d59ba=events[_0x177f('0x5')];_0x1d8e43<_0x1d59ba;_0x1d8e43++){var _0x4ae648=events[_0x1d8e43];var _0x4fc6aa=createListener(_0x177f('0x6')+_0x4ae648,_0x2017ed);SmsMessageEvents['on'](_0x4ae648,_0x4fc6aa);}}; \ No newline at end of file +var _0x1093=['register','./smsMessage.events','save','remove','update','removeListener'];(function(_0x4bd0fc,_0x4aa602){var _0x1fbe2d=function(_0x299a31){while(--_0x299a31){_0x4bd0fc['push'](_0x4bd0fc['shift']());}};_0x1fbe2d(++_0x4aa602);}(_0x1093,0x17b));var _0x3109=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x1093[_0x5b78e8];return _0xf2c321;};'use strict';var SmsMessageEvents=require(_0x3109('0x0'));var events=[_0x3109('0x1'),_0x3109('0x2'),_0x3109('0x3')];function createListener(_0xe43ac2,_0x1c923e){return function(_0x61004b){_0x1c923e['emit'](_0xe43ac2,_0x61004b);};}function removeListener(_0x5f36bb,_0x82c5c3){return function(){SmsMessageEvents[_0x3109('0x4')](_0x5f36bb,_0x82c5c3);};}exports[_0x3109('0x5')]=function(_0xbb0b08){for(var _0x2555ea=0x0,_0x43dd28=events['length'];_0x2555ea<_0x43dd28;_0x2555ea++){var _0x23773c=events[_0x2555ea];var _0x321031=createListener('smsMessage:'+_0x23773c,_0xbb0b08);SmsMessageEvents['on'](_0x23773c,_0x321031);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index de46bac..ba5d320 100644 --- a/server/api/smsQueue/index.js +++ b/server/api/smsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e7f=['addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams'];(function(_0x1d1fa4,_0xf9d77f){var _0x30615f=function(_0x390c4a){while(--_0x390c4a){_0x1d1fa4['push'](_0x1d1fa4['shift']());}};_0x30615f(++_0xf9d77f);}(_0x7e7f,0x1bb));var _0xf7e7=function(_0x2598f5,_0x1a857e){_0x2598f5=_0x2598f5-0x0;var _0x3382bd=_0x7e7f[_0x2598f5];return _0x3382bd;};'use strict';var multer=require(_0xf7e7('0x0'));var util=require(_0xf7e7('0x1'));var path=require(_0xf7e7('0x2'));var timeout=require(_0xf7e7('0x3'));var express=require(_0xf7e7('0x4'));var router=express['Router']();var fs_extra=require(_0xf7e7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf7e7('0x6'));var config=require(_0xf7e7('0x7'));var controller=require('./smsQueue.controller');router[_0xf7e7('0x8')]('/',auth['isAuthenticated'](),controller[_0xf7e7('0x9')]);router[_0xf7e7('0x8')](_0xf7e7('0xa'),auth['isAuthenticated'](),controller[_0xf7e7('0xb')]);router['get'](_0xf7e7('0xc'),auth[_0xf7e7('0xd')](),controller[_0xf7e7('0xe')]);router[_0xf7e7('0x8')]('/:id/members',auth[_0xf7e7('0xd')](),controller['getMembers']);router[_0xf7e7('0x8')]('/:id/teams',auth[_0xf7e7('0xd')](),controller[_0xf7e7('0xf')]);router[_0xf7e7('0x8')](_0xf7e7('0x10'),auth['isAuthenticated'](),controller[_0xf7e7('0x11')]);router[_0xf7e7('0x12')]('/',auth[_0xf7e7('0xd')](),controller['create']);router[_0xf7e7('0x12')](_0xf7e7('0x13'),auth[_0xf7e7('0xd')](),controller[_0xf7e7('0x14')]);router[_0xf7e7('0x12')](_0xf7e7('0x10'),auth[_0xf7e7('0xd')](),controller[_0xf7e7('0x15')]);router[_0xf7e7('0x16')](_0xf7e7('0xc'),auth[_0xf7e7('0xd')](),controller[_0xf7e7('0x17')]);router['delete'](_0xf7e7('0xc'),auth[_0xf7e7('0xd')](),controller[_0xf7e7('0x18')]);router['delete']('/:id/teams',auth[_0xf7e7('0xd')](),controller[_0xf7e7('0x19')]);router[_0xf7e7('0x1a')](_0xf7e7('0x10'),auth['isAuthenticated'](),controller[_0xf7e7('0x1b')]);module[_0xf7e7('0x1c')]=router; \ No newline at end of file +var _0x0197=['put','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents'];(function(_0x4e4b57,_0x316659){var _0x5b44fc=function(_0x2cb2fb){while(--_0x2cb2fb){_0x4e4b57['push'](_0x4e4b57['shift']());}};_0x5b44fc(++_0x316659);}(_0x0197,0x1a9));var _0x7019=function(_0x3749a5,_0xcc88dc){_0x3749a5=_0x3749a5-0x0;var _0x27cecb=_0x0197[_0x3749a5];return _0x27cecb;};'use strict';var multer=require(_0x7019('0x0'));var util=require(_0x7019('0x1'));var path=require('path');var timeout=require(_0x7019('0x2'));var express=require(_0x7019('0x3'));var router=express[_0x7019('0x4')]();var fs_extra=require(_0x7019('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7019('0x6'));var controller=require(_0x7019('0x7'));router['get']('/',auth[_0x7019('0x8')](),controller[_0x7019('0x9')]);router[_0x7019('0xa')](_0x7019('0xb'),auth['isAuthenticated'](),controller[_0x7019('0xc')]);router[_0x7019('0xa')](_0x7019('0xd'),auth['isAuthenticated'](),controller[_0x7019('0xe')]);router[_0x7019('0xa')](_0x7019('0xf'),auth[_0x7019('0x8')](),controller[_0x7019('0x10')]);router['get']('/:id/teams',auth[_0x7019('0x8')](),controller[_0x7019('0x11')]);router[_0x7019('0xa')](_0x7019('0x12'),auth['isAuthenticated'](),controller[_0x7019('0x13')]);router[_0x7019('0x14')]('/',auth[_0x7019('0x8')](),controller[_0x7019('0x15')]);router[_0x7019('0x14')](_0x7019('0x16'),auth[_0x7019('0x8')](),controller[_0x7019('0x17')]);router['post'](_0x7019('0x12'),auth[_0x7019('0x8')](),controller[_0x7019('0x18')]);router[_0x7019('0x19')]('/:id',auth[_0x7019('0x8')](),controller['update']);router[_0x7019('0x1a')](_0x7019('0xd'),auth[_0x7019('0x8')](),controller[_0x7019('0x1b')]);router[_0x7019('0x1a')](_0x7019('0x16'),auth['isAuthenticated'](),controller[_0x7019('0x1c')]);router[_0x7019('0x1a')](_0x7019('0x12'),auth[_0x7019('0x8')](),controller[_0x7019('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 689c10b..ec92fce 100644 --- a/server/api/smsQueue/smsQueue.attributes.js +++ b/server/api/smsQueue/smsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xceda=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x31caee,_0x5ae79e){var _0x4d6a9e=function(_0x4301af){while(--_0x4301af){_0x31caee['push'](_0x31caee['shift']());}};_0x4d6a9e(++_0x5ae79e);}(_0xceda,0x6a));var _0xaced=function(_0x10dea5,_0x49aa8a){_0x10dea5=_0x10dea5-0x0;var _0x29a333=_0xceda[_0x10dea5];return _0x29a333;};'use strict';var Sequelize=require(_0xaced('0x0'));module[_0xaced('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xaced('0x2')]},'timeout':{'type':Sequelize[_0xaced('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaced('0x4')](_0xaced('0x5'),'beepall',_0xaced('0x6'))}}; \ No newline at end of file +var _0xb581=['ENUM','rrmemory','sequelize','exports','STRING','name'];(function(_0xddbee6,_0x31713a){var _0x337104=function(_0x326ab8){while(--_0x326ab8){_0xddbee6['push'](_0xddbee6['shift']());}};_0x337104(++_0x31713a);}(_0xb581,0x146));var _0x1b58=function(_0xa130e1,_0x9fef7a){_0xa130e1=_0xa130e1-0x0;var _0x2a15b1=_0xb581[_0xa130e1];return _0x2a15b1;};'use strict';var Sequelize=require(_0x1b58('0x0'));module[_0x1b58('0x1')]={'name':{'type':Sequelize[_0x1b58('0x2')],'unique':_0x1b58('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1b58('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b58('0x4')](_0x1b58('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f9146a7..fe5f26d 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8cc2=['findAndCountAll','UserId','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','SELECT','TeamId','includes','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','destroy','then','get','SmsQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','order','pick','filter','where','merge','VIRTUAL','options','SmsQueue','count','findAll','show','params','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','length','hasOwnProperty','sort','SmsQueueId','UserSmsQueue','User'];(function(_0x391cdf,_0x364e1d){var _0x12c9b7=function(_0xb7df5a){while(--_0xb7df5a){_0x391cdf['push'](_0x391cdf['shift']());}};_0x12c9b7(++_0x364e1d);}(_0x8cc2,0x1d8));var _0x28cc=function(_0x1a94d1,_0x217d11){_0x1a94d1=_0x1a94d1-0x0;var _0x5bee42=_0x8cc2[_0x1a94d1];return _0x5bee42;};'use strict';var emlformat=require(_0x28cc('0x0'));var rimraf=require(_0x28cc('0x1'));var zipdir=require(_0x28cc('0x2'));var jsonpatch=require(_0x28cc('0x3'));var rp=require(_0x28cc('0x4'));var moment=require(_0x28cc('0x5'));var BPromise=require(_0x28cc('0x6'));var Mustache=require(_0x28cc('0x7'));var util=require('util');var path=require(_0x28cc('0x8'));var sox=require('sox');var csv=require(_0x28cc('0x9'));var ejs=require(_0x28cc('0xa'));var fs=require('fs');var fs_extra=require(_0x28cc('0xb'));var _=require(_0x28cc('0xc'));var squel=require(_0x28cc('0xd'));var crypto=require(_0x28cc('0xe'));var jsforce=require(_0x28cc('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x28cc('0x10'));var Redis=require('ioredis');var authService=require(_0x28cc('0x11'));var qs=require(_0x28cc('0x12'));var as=require(_0x28cc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x28cc('0x14'))(_0x28cc('0x15'));var utils=require(_0x28cc('0x16'));var config=require(_0x28cc('0x17'));var licenseUtil=require(_0x28cc('0x18'));var db=require(_0x28cc('0x19'))['db'];config['redis']=_[_0x28cc('0x1a')](config[_0x28cc('0x1b')],{'host':_0x28cc('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x21c519,_0x25a352){_0x25a352=_0x25a352||0xcc;return function(_0x2318a7){if(_0x2318a7){return _0x21c519[_0x28cc('0x1d')](_0x25a352);}return _0x21c519[_0x28cc('0x1e')](_0x25a352)[_0x28cc('0x1f')]();};}function respondWithResult(_0x5e57b7,_0x170e84){_0x170e84=_0x170e84||0xc8;return function(_0x5bc3bd){if(_0x5bc3bd){return _0x5e57b7[_0x28cc('0x1e')](_0x170e84)['json'](_0x5bc3bd);}};}function respondWithFilteredResult(_0x3bce7c,_0x1829d6){return function(_0x2df9af){if(_0x2df9af){var _0x35200b=typeof _0x1829d6[_0x28cc('0x20')]===_0x28cc('0x21')&&typeof _0x1829d6[_0x28cc('0x22')]==='undefined';var _0x1f89f7=_0x2df9af['count'];var _0xf0f0fb=_0x35200b?0x0:_0x1829d6['offset'];var _0x2d6201=_0x35200b?_0x2df9af['count']:_0x1829d6[_0x28cc('0x20')]+_0x1829d6['limit'];var _0x42e9bc;if(_0x2d6201>=_0x1f89f7){_0x2d6201=_0x1f89f7;_0x42e9bc=0xc8;}else{_0x42e9bc=0xce;}_0x3bce7c['status'](_0x42e9bc);return _0x3bce7c[_0x28cc('0x23')]('Content-Range',_0xf0f0fb+'-'+_0x2d6201+'/'+_0x1f89f7)[_0x28cc('0x24')](_0x2df9af);}return null;};}function patchUpdates(_0x39e9a4){return function(_0x61a2d){try{jsonpatch[_0x28cc('0x25')](_0x61a2d,_0x39e9a4,!![]);}catch(_0x15dfea){return BPromise[_0x28cc('0x26')](_0x15dfea);}return _0x61a2d[_0x28cc('0x27')]();};}function saveUpdates(_0x18a800,_0x447fef){return function(_0x420159){if(_0x420159){return _0x420159['update'](_0x18a800)['then'](function(_0x3e6870){return _0x3e6870;});}return null;};}function removeEntity(_0x3f45e8,_0x79a99b){return function(_0x2bcb0d){if(_0x2bcb0d){return _0x2bcb0d[_0x28cc('0x28')]()[_0x28cc('0x29')](function(){var _0x1eb391=_0x2bcb0d[_0x28cc('0x2a')]({'plain':!![]});var _0x3f10a6=_0x28cc('0x2b');return db[_0x28cc('0x2c')][_0x28cc('0x28')]({'where':{'type':_0x3f10a6,'resourceId':_0x1eb391['id']}})[_0x28cc('0x29')](function(){return _0x2bcb0d;});})['then'](function(){_0x3f45e8['status'](0xcc)[_0x28cc('0x1f')]();});}};}function handleEntityNotFound(_0x25e19d,_0x84ed5c){return function(_0x56375d){if(!_0x56375d){_0x25e19d[_0x28cc('0x1d')](0x194);}return _0x56375d;};}function handleError(_0x50a11b,_0x4cfc27){_0x4cfc27=_0x4cfc27||0x1f4;return function(_0x48461e){logger[_0x28cc('0x2d')](_0x48461e[_0x28cc('0x2e')]);if(_0x48461e[_0x28cc('0x2f')]){delete _0x48461e['name'];}_0x50a11b['status'](_0x4cfc27)['send'](_0x48461e);};}exports[_0x28cc('0x30')]=function(_0x277871,_0x463d3c){var _0x22163c={},_0x3ef98d={},_0x311577={'count':0x0,'rows':[]};var _0x10d453=_[_0x28cc('0x31')](db['SmsQueue'][_0x28cc('0x32')],function(_0x3f3e44){return{'name':_0x3f3e44[_0x28cc('0x33')],'type':_0x3f3e44[_0x28cc('0x34')]['key']};});_0x3ef98d[_0x28cc('0x35')]=_[_0x28cc('0x31')](_0x10d453,_0x28cc('0x2f'));_0x3ef98d['query']=_['keys'](_0x277871[_0x28cc('0x36')]);_0x3ef98d[_0x28cc('0x37')]=_[_0x28cc('0x38')](_0x3ef98d['model'],_0x3ef98d[_0x28cc('0x36')]);_0x22163c[_0x28cc('0x39')]=_[_0x28cc('0x38')](_0x3ef98d['model'],qs[_0x28cc('0x3a')](_0x277871[_0x28cc('0x36')][_0x28cc('0x3a')]));_0x22163c['attributes']=_0x22163c[_0x28cc('0x39')]['length']?_0x22163c['attributes']:_0x3ef98d[_0x28cc('0x35')];if(!_0x277871[_0x28cc('0x36')]['hasOwnProperty'](_0x28cc('0x3b'))){_0x22163c['limit']=qs[_0x28cc('0x22')](_0x277871['query'][_0x28cc('0x22')]);_0x22163c[_0x28cc('0x20')]=qs[_0x28cc('0x20')](_0x277871[_0x28cc('0x36')][_0x28cc('0x20')]);}_0x22163c[_0x28cc('0x3c')]=qs['sort'](_0x277871[_0x28cc('0x36')]['sort']);_0x22163c['where']=qs[_0x28cc('0x37')](_[_0x28cc('0x3d')](_0x277871['query'],_0x3ef98d[_0x28cc('0x37')]),_0x10d453);if(_0x277871[_0x28cc('0x36')][_0x28cc('0x3e')]){_0x22163c[_0x28cc('0x3f')]=_[_0x28cc('0x40')](_0x22163c[_0x28cc('0x3f')],{'$or':_['map'](_0x10d453,function(_0x571c42){if(_0x571c42[_0x28cc('0x34')]!==_0x28cc('0x41')){var _0xd93e35={};_0xd93e35[_0x571c42['name']]={'$like':'%'+_0x277871[_0x28cc('0x36')][_0x28cc('0x3e')]+'%'};return _0xd93e35;}})});}_0x22163c=_['merge']({},_0x22163c,_0x277871[_0x28cc('0x42')]);var _0x4b73c8={'where':_0x22163c[_0x28cc('0x3f')]};return db[_0x28cc('0x43')][_0x28cc('0x44')](_0x4b73c8)[_0x28cc('0x29')](function(_0x5e30b6){_0x311577[_0x28cc('0x44')]=_0x5e30b6;if(_0x277871[_0x28cc('0x36')]['includeAll']){_0x22163c['include']=[{'all':!![]}];}return db[_0x28cc('0x43')][_0x28cc('0x45')](_0x22163c);})[_0x28cc('0x29')](function(_0x36473b){_0x311577['rows']=_0x36473b;return _0x311577;})['then'](respondWithFilteredResult(_0x463d3c,_0x22163c))['catch'](handleError(_0x463d3c,null));};exports[_0x28cc('0x46')]=function(_0x706f88,_0x4b2175){var _0x5899d5={'raw':!![],'where':{'id':_0x706f88[_0x28cc('0x47')]['id']}},_0x36fa1c={};_0x36fa1c[_0x28cc('0x35')]=_[_0x28cc('0x48')](db['SmsQueue'][_0x28cc('0x32')]);_0x36fa1c[_0x28cc('0x36')]=_['keys'](_0x706f88[_0x28cc('0x36')]);_0x36fa1c[_0x28cc('0x37')]=_['intersection'](_0x36fa1c[_0x28cc('0x35')],_0x36fa1c[_0x28cc('0x36')]);_0x5899d5[_0x28cc('0x39')]=_['intersection'](_0x36fa1c[_0x28cc('0x35')],qs[_0x28cc('0x3a')](_0x706f88['query'][_0x28cc('0x3a')]));_0x5899d5['attributes']=_0x5899d5[_0x28cc('0x39')]['length']?_0x5899d5[_0x28cc('0x39')]:_0x36fa1c[_0x28cc('0x35')];if(_0x706f88[_0x28cc('0x36')][_0x28cc('0x49')]){_0x5899d5[_0x28cc('0x4a')]=[{'all':!![]}];}_0x5899d5=_['merge']({},_0x5899d5,_0x706f88[_0x28cc('0x42')]);return db[_0x28cc('0x43')][_0x28cc('0x4b')](_0x5899d5)['then'](handleEntityNotFound(_0x4b2175,null))['then'](respondWithResult(_0x4b2175,null))['catch'](handleError(_0x4b2175,null));};exports[_0x28cc('0x4c')]=function(_0x4ac72e,_0x23f125){return db[_0x28cc('0x43')][_0x28cc('0x4c')](_0x4ac72e[_0x28cc('0x4d')],{})[_0x28cc('0x29')](function(_0x813287){var _0x5db411=_0x4ac72e[_0x28cc('0x4e')][_0x28cc('0x2a')]({'plain':!![]});if(!_0x5db411)throw new Error(_0x28cc('0x4f'));if(_0x5db411[_0x28cc('0x50')]===_0x28cc('0x4e')){var _0xe64e84=_0x813287[_0x28cc('0x2a')]({'plain':!![]});var _0x52d469=_0x28cc('0x2b');return db[_0x28cc('0x51')][_0x28cc('0x4b')]({'where':{'name':_0x52d469,'userProfileId':_0x5db411[_0x28cc('0x52')]},'raw':!![]})[_0x28cc('0x29')](function(_0x24b1f1){if(_0x24b1f1&&_0x24b1f1[_0x28cc('0x53')]===0x0){return db[_0x28cc('0x2c')]['create']({'name':_0xe64e84[_0x28cc('0x2f')],'resourceId':_0xe64e84['id'],'type':_0x24b1f1[_0x28cc('0x2f')],'sectionId':_0x24b1f1['id']},{})['then'](function(){return _0x813287;});}else{return _0x813287;}})[_0x28cc('0x54')](function(_0x8cdb6){logger['error'](_0x28cc('0x55'),_0x8cdb6);throw _0x8cdb6;});}return _0x813287;})[_0x28cc('0x29')](respondWithResult(_0x23f125,0xc9))[_0x28cc('0x54')](handleError(_0x23f125,null));};exports[_0x28cc('0x56')]=function(_0x52df6c,_0x2e49e3){if(_0x52df6c[_0x28cc('0x4d')]['id']){delete _0x52df6c['body']['id'];}return db['SmsQueue']['find']({'where':{'id':_0x52df6c[_0x28cc('0x47')]['id']}})[_0x28cc('0x29')](handleEntityNotFound(_0x2e49e3,null))[_0x28cc('0x29')](saveUpdates(_0x52df6c[_0x28cc('0x4d')],null))['then'](respondWithResult(_0x2e49e3,null))[_0x28cc('0x54')](handleError(_0x2e49e3,null));};exports['destroy']=function(_0x1064b4,_0x759c59){return db[_0x28cc('0x43')][_0x28cc('0x4b')]({'where':{'id':_0x1064b4[_0x28cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x759c59,null))['then'](removeEntity(_0x759c59,null))[_0x28cc('0x54')](handleError(_0x759c59,null));};exports[_0x28cc('0x57')]=function(_0x13dcdf,_0x2c232f){return db[_0x28cc('0x43')][_0x28cc('0x57')]()['then'](respondWithResult(_0x2c232f,null))['catch'](handleError(_0x2c232f,null));};exports[_0x28cc('0x58')]=function(_0x722b39,_0x1d447b,_0x456e3f){var _0x3d0bcf={'raw':!![],'where':{}},_0x3c3ec0={},_0x22a8fc;return db['SmsQueue'][_0x28cc('0x59')]({'where':{'id':_0x722b39[_0x28cc('0x47')]['id']}})[_0x28cc('0x29')](handleEntityNotFound(_0x1d447b,null))[_0x28cc('0x29')](function(_0x3cffa0){if(_0x3cffa0){_0x22a8fc=_0x3cffa0[_0x28cc('0x2a')]({'plain':!![]});_0x3c3ec0[_0x28cc('0x35')]=_[_0x28cc('0x48')](db['UserSmsQueue'][_0x28cc('0x32')]);_0x3c3ec0[_0x28cc('0x36')]=_[_0x28cc('0x48')](_0x722b39[_0x28cc('0x36')]);_0x3c3ec0[_0x28cc('0x37')]=_[_0x28cc('0x38')](_0x3c3ec0['model'],_0x3c3ec0[_0x28cc('0x36')]);_0x3d0bcf[_0x28cc('0x39')]=_[_0x28cc('0x38')](_0x3c3ec0['model'],qs[_0x28cc('0x3a')](_0x722b39[_0x28cc('0x36')]['fields']));_0x3d0bcf[_0x28cc('0x39')]=_0x3d0bcf[_0x28cc('0x39')][_0x28cc('0x5a')]?_0x3d0bcf['attributes']:_0x3c3ec0[_0x28cc('0x35')];if(!_0x722b39[_0x28cc('0x36')][_0x28cc('0x5b')](_0x28cc('0x3b'))){_0x3d0bcf[_0x28cc('0x22')]=qs[_0x28cc('0x22')](_0x722b39[_0x28cc('0x36')][_0x28cc('0x22')]);_0x3d0bcf['offset']=qs['offset'](_0x722b39[_0x28cc('0x36')][_0x28cc('0x20')]);}_0x3d0bcf[_0x28cc('0x3c')]=qs[_0x28cc('0x5c')](_0x722b39[_0x28cc('0x36')][_0x28cc('0x5c')]);_0x3d0bcf[_0x28cc('0x3f')]=qs['filters'](_[_0x28cc('0x3d')](_0x722b39[_0x28cc('0x36')],_0x3c3ec0['filters']));_0x3d0bcf[_0x28cc('0x3f')][_0x28cc('0x5d')]=_0x3cffa0['id'];if(_0x722b39[_0x28cc('0x36')][_0x28cc('0x3e')]){_0x3d0bcf[_0x28cc('0x3f')]=_[_0x28cc('0x40')](_0x3d0bcf['where'],{'$or':_[_0x28cc('0x31')](_0x3d0bcf[_0x28cc('0x39')],function(_0x4b8e2c){var _0x49a321={};_0x49a321[_0x4b8e2c]={'$like':'%'+_0x722b39[_0x28cc('0x36')][_0x28cc('0x3e')]+'%'};return _0x49a321;})});}_0x3d0bcf=_['merge']({},_0x3d0bcf,_0x722b39[_0x28cc('0x42')]);return db[_0x28cc('0x5e')][_0x28cc('0x45')](_0x3d0bcf);}})['then'](function(_0x3382b9){if(_0x3382b9){return db[_0x28cc('0x5f')][_0x28cc('0x60')]({'where':{'id':_['map'](_0x3382b9,_0x28cc('0x61')),'role':'agent'},'attributes':['id',_0x28cc('0x2f'),_0x28cc('0x62'),_0x28cc('0x63'),_0x28cc('0x64')]});}})[_0x28cc('0x29')](function(_0x4e40eb){if(_0x4e40eb){return{'count':_0x4e40eb['count'],'rows':_[_0x28cc('0x31')](_0x4e40eb['rows'],function(_0x5c423e){return{'membername':_0x5c423e[_0x28cc('0x2f')],'UserId':_0x5c423e['id'],'queue_name':_0x22a8fc['name'],'SmsQueueId':_0x22a8fc['id'],'interface':util['format'](_0x28cc('0x65'),_0x28cc('0x66'),_0x5c423e['name']),'penalty':0x0,'paused':_0x5c423e['smsPause'],'createdAt':_0x5c423e[_0x28cc('0x64')],'updatedAt':_0x5c423e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x28cc('0x29')](respondWithFilteredResult(_0x1d447b,_0x3d0bcf))[_0x28cc('0x54')](handleError(_0x1d447b,null));};exports[_0x28cc('0x67')]=function(_0x55a811,_0x4c0a7e,_0x16c1ac){var _0x28c471={};var _0x56240e={};var _0x5792bb;var _0x268299;return db[_0x28cc('0x43')]['findOne']({'where':{'id':_0x55a811[_0x28cc('0x47')]['id']}})[_0x28cc('0x29')](handleEntityNotFound(_0x4c0a7e,null))['then'](function(_0x31c2b9){if(_0x31c2b9){_0x5792bb=_0x31c2b9;_0x56240e['model']=_[_0x28cc('0x48')](db['Team']['rawAttributes']);_0x56240e[_0x28cc('0x36')]=_[_0x28cc('0x48')](_0x55a811['query']);_0x56240e[_0x28cc('0x37')]=_[_0x28cc('0x38')](_0x56240e[_0x28cc('0x35')],_0x56240e[_0x28cc('0x36')]);_0x28c471[_0x28cc('0x39')]=_[_0x28cc('0x38')](_0x56240e[_0x28cc('0x35')],qs[_0x28cc('0x3a')](_0x55a811[_0x28cc('0x36')][_0x28cc('0x3a')]));_0x28c471[_0x28cc('0x39')]=_0x28c471['attributes'][_0x28cc('0x5a')]?_0x28c471[_0x28cc('0x39')]:_0x56240e[_0x28cc('0x35')];_0x28c471[_0x28cc('0x3c')]=qs['sort'](_0x55a811[_0x28cc('0x36')][_0x28cc('0x5c')]);_0x28c471[_0x28cc('0x3f')]=qs[_0x28cc('0x37')](_[_0x28cc('0x3d')](_0x55a811[_0x28cc('0x36')],_0x56240e[_0x28cc('0x37')]));if(_0x55a811[_0x28cc('0x36')]['filter']){_0x28c471['where']=_['merge'](_0x28c471[_0x28cc('0x3f')],{'$or':_[_0x28cc('0x31')](_0x28c471[_0x28cc('0x39')],function(_0x1b1855){var _0x335b84={};_0x335b84[_0x1b1855]={'$like':'%'+_0x55a811[_0x28cc('0x36')][_0x28cc('0x3e')]+'%'};return _0x335b84;})});}_0x28c471=_[_0x28cc('0x40')]({},_0x28c471,_0x55a811['options']);return _0x5792bb[_0x28cc('0x67')](_0x28c471);}})[_0x28cc('0x29')](function(_0x3145d8){if(_0x3145d8){_0x268299=_0x3145d8[_0x28cc('0x5a')];if(!_0x55a811[_0x28cc('0x36')][_0x28cc('0x5b')]('nolimit')){_0x28c471[_0x28cc('0x22')]=qs['limit'](_0x55a811[_0x28cc('0x36')][_0x28cc('0x22')]);_0x28c471[_0x28cc('0x20')]=qs[_0x28cc('0x20')](_0x55a811[_0x28cc('0x36')][_0x28cc('0x20')]);}return _0x5792bb[_0x28cc('0x67')](_0x28c471);}})[_0x28cc('0x29')](function(_0x4f22e5){if(_0x4f22e5){return _0x4f22e5?{'count':_0x268299,'rows':_0x4f22e5}:null;}})[_0x28cc('0x29')](respondWithResult(_0x4c0a7e,null))[_0x28cc('0x54')](handleError(_0x4c0a7e,null));};exports['addTeams']=function(_0x5605ec,_0x99d616,_0x144a56){var _0x388d81=_0x5605ec['body'][_0x28cc('0x68')];return db[_0x28cc('0x69')]['findAll']({'where':{'id':_0x388d81},'attributes':['id'],'include':[{'model':db['User'],'as':_0x28cc('0x6a'),'attributes':['id',_0x28cc('0x2f'),'online',_0x28cc('0x6b'),_0x28cc('0x6c')],'raw':!![]}]})[_0x28cc('0x29')](function(_0x1b0843){if(_0x1b0843){var _0x1c59e9=_[_0x28cc('0x6d')](_0x1b0843,function(_0x1cf137){var _0x3a1aec=_0x1cf137['get']({'plain':!![]});return _0x3a1aec[_0x28cc('0x6a')];});return db[_0x28cc('0x43')][_0x28cc('0x4b')]({'where':{'id':_0x5605ec[_0x28cc('0x47')]['id']}})['then'](function(_0x17e268){return db[_0x28cc('0x6e')][_0x28cc('0x6f')](function(_0x183a79){return _0x17e268['addTeams'](_0x388d81,{'transaction':_0x183a79})['then'](function(){return BPromise[_0x28cc('0x70')](_0x1c59e9,function(_0xe74489){return db['UserSmsQueue'][_0x28cc('0x71')]({'where':{'UserId':_0xe74489['id'],'SmsQueueId':_0x5605ec[_0x28cc('0x47')]['id']},'transaction':_0x183a79});});})['then'](function(){_0x1c59e9['forEach'](function(_0x3baf17){socket['emit'](_0x28cc('0x72'),{'UserId':_0x3baf17['id'],'SmsQueueId':_0x17e268['id']});});});});});}})[_0x28cc('0x29')](respondWithStatusCode(_0x99d616,null))[_0x28cc('0x54')](handleError(_0x99d616,null));};exports['removeTeams']=function(_0x11650b,_0x13e399,_0x45b923){return db['Team']['findAll']({'where':{'id':_0x11650b[_0x28cc('0x36')][_0x28cc('0x68')]},'attributes':['id'],'include':[{'model':db[_0x28cc('0x5f')],'as':_0x28cc('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x28cc('0x29')](handleEntityNotFound(_0x13e399,null))[_0x28cc('0x29')](function(_0x498952){var _0x28e7d9=_[_0x28cc('0x31')](_0x498952,'id');var _0x279ee0=[];var _0x29d7d3=[];var _0x578910=squel[_0x28cc('0x73')]();_0x578910[_0x28cc('0x74')](_0x28cc('0x75'))[_0x28cc('0x76')](_0x28cc('0x77'),'tq')['join'](_0x28cc('0x78'),'ut',_0x28cc('0x79'))[_0x28cc('0x3f')]('SmsQueueId\x20=\x20?',_0x11650b['params']['id']);for(var _0x2d44ac=0x0;_0x2d44ac<_0x498952['length'];_0x2d44ac+=0x1){let _0x58f021=_0x498952[_0x2d44ac];for(var _0x757ce3=0x0;_0x757ce3<_0x58f021[_0x28cc('0x6a')][_0x28cc('0x5a')];_0x757ce3+=0x1){let _0x2bf619=_0x58f021[_0x28cc('0x6a')][_0x757ce3];var _0x68af80=_0x578910[_0x28cc('0x7a')]();_0x68af80[_0x28cc('0x3f')](_0x28cc('0x7b'),_0x2bf619['id']);_0x29d7d3[_0x28cc('0x7c')](db['sequelize'][_0x28cc('0x36')](_0x68af80['toString'](),{'type':db['sequelize']['QueryTypes'][_0x28cc('0x7d')]})[_0x28cc('0x29')](function(_0x134fdf){if(_0x134fdf['length']===0x1){return _0x2bf619['id'];}else{var _0x2fbbd0=_['every'](_[_0x28cc('0x31')](_0x134fdf,_0x28cc('0x7e')),function(_0xf70d60){return _[_0x28cc('0x7f')](_0x28e7d9,_0xf70d60);});if(_0x2fbbd0){return _0x2bf619['id'];}}}));}}return BPromise[_0x28cc('0x80')](_0x29d7d3)[_0x28cc('0x29')](function(_0x2ed4fc){_0x279ee0=_(_0x279ee0)['union'](_0x2ed4fc)[_0x28cc('0x81')]()[_0x28cc('0x82')]();return db[_0x28cc('0x43')][_0x28cc('0x4b')]({'where':{'id':_0x11650b[_0x28cc('0x47')]['id']}})[_0x28cc('0x29')](function(_0x3c840c){return db[_0x28cc('0x6e')][_0x28cc('0x6f')](function(_0x5020fe){return _0x3c840c[_0x28cc('0x83')](_0x11650b[_0x28cc('0x36')][_0x28cc('0x68')],{'transaction':_0x5020fe})[_0x28cc('0x29')](function(){if(!_[_0x28cc('0x84')](_0x279ee0)){return _0x3c840c[_0x28cc('0x85')](_0x279ee0,{'transaction':_0x5020fe});}})[_0x28cc('0x29')](function(){_0x279ee0[_0x28cc('0x86')](function(_0xa4be3a){socket[_0x28cc('0x87')](_0x28cc('0x88'),{'UserId':_0xa4be3a,'SmsQueueId':_0x3c840c['id']});});});});});});})[_0x28cc('0x29')](respondWithStatusCode(_0x13e399,null))[_0x28cc('0x54')](handleError(_0x13e399,null));};exports['addAgents']=function(_0x3680b3,_0x581790,_0x18763c){return db[_0x28cc('0x43')][_0x28cc('0x4b')]({'where':{'id':_0x3680b3[_0x28cc('0x47')]['id']}})[_0x28cc('0x29')](handleEntityNotFound(_0x581790,null))[_0x28cc('0x29')](function(_0x4025fd){if(_0x4025fd){return _0x4025fd[_0x28cc('0x89')](_0x3680b3[_0x28cc('0x4d')][_0x28cc('0x68')],_[_0x28cc('0x8a')](_0x3680b3[_0x28cc('0x4d')],[_0x28cc('0x68'),'id'])||{})[_0x28cc('0x8b')](function(_0x3d981a){for(var _0x1010e8=0x0;_0x1010e8<_0x3680b3['body'][_0x28cc('0x68')][_0x28cc('0x5a')];_0x1010e8+=0x1){socket[_0x28cc('0x87')]('userSmsQueue:save',{'UserId':Number(_0x3680b3[_0x28cc('0x4d')][_0x28cc('0x68')][_0x1010e8]),'SmsQueueId':Number(_0x3680b3[_0x28cc('0x47')]['id'])});}return _0x3d981a;});}})[_0x28cc('0x29')](respondWithResult(_0x581790,null))[_0x28cc('0x54')](handleError(_0x581790,null));};exports[_0x28cc('0x85')]=function(_0x5281bf,_0x46f5e8,_0x45ec53){return db['SmsQueue'][_0x28cc('0x4b')]({'where':{'id':_0x5281bf[_0x28cc('0x47')]['id']}})[_0x28cc('0x29')](handleEntityNotFound(_0x46f5e8,null))[_0x28cc('0x29')](function(_0x59d45b){if(_0x59d45b){return _0x59d45b[_0x28cc('0x85')](_0x5281bf[_0x28cc('0x36')][_0x28cc('0x68')])[_0x28cc('0x29')](function(){if(_[_0x28cc('0x8c')](_0x5281bf[_0x28cc('0x36')][_0x28cc('0x68')])){for(var _0xc2d2a=0x0;_0xc2d2a<_0x5281bf['query'][_0x28cc('0x68')]['length'];_0xc2d2a+=0x1){socket[_0x28cc('0x87')](_0x28cc('0x88'),{'UserId':Number(_0x5281bf['query'][_0x28cc('0x68')][_0xc2d2a]),'SmsQueueId':Number(_0x5281bf[_0x28cc('0x47')]['id'])});}}else{socket[_0x28cc('0x87')](_0x28cc('0x88'),{'UserId':Number(_0x5281bf[_0x28cc('0x36')]['ids']),'SmsQueueId':Number(_0x5281bf[_0x28cc('0x47')]['id'])});}});}})[_0x28cc('0x29')](respondWithStatusCode(_0x46f5e8,null))[_0x28cc('0x54')](handleError(_0x46f5e8,null));};exports[_0x28cc('0x8d')]=function(_0x26e2e9,_0xee99a,_0x1c36da){var _0x1ee04b={};var _0x4cc1c8={};var _0x4f30ea;var _0xbf54cb;return db['SmsQueue'][_0x28cc('0x59')]({'where':{'id':_0x26e2e9[_0x28cc('0x47')]['id']}})['then'](handleEntityNotFound(_0xee99a,null))['then'](function(_0x390313){if(_0x390313){_0x4f30ea=_0x390313;_0x4cc1c8[_0x28cc('0x35')]=_['keys'](db[_0x28cc('0x5f')][_0x28cc('0x32')]);_0x4cc1c8[_0x28cc('0x36')]=_[_0x28cc('0x48')](_0x26e2e9['query']);_0x4cc1c8[_0x28cc('0x37')]=_[_0x28cc('0x38')](_0x4cc1c8['model'],_0x4cc1c8[_0x28cc('0x36')]);_0x1ee04b['attributes']=_[_0x28cc('0x38')](_0x4cc1c8[_0x28cc('0x35')],qs['fields'](_0x26e2e9[_0x28cc('0x36')]['fields']));_0x1ee04b['attributes']=_0x1ee04b[_0x28cc('0x39')]['length']?_0x1ee04b[_0x28cc('0x39')]:_0x4cc1c8['model'];_0x1ee04b['order']=qs['sort'](_0x26e2e9[_0x28cc('0x36')][_0x28cc('0x5c')]);_0x1ee04b[_0x28cc('0x3f')]=qs[_0x28cc('0x37')](_[_0x28cc('0x3d')](_0x26e2e9[_0x28cc('0x36')],_0x4cc1c8[_0x28cc('0x37')]));if(_0x26e2e9[_0x28cc('0x36')]['filter']){_0x1ee04b['where']=_[_0x28cc('0x40')](_0x1ee04b[_0x28cc('0x3f')],{'$or':_[_0x28cc('0x31')](_0x1ee04b[_0x28cc('0x39')],function(_0x211bbf){var _0x4b3c1c={};_0x4b3c1c[_0x211bbf]={'$like':'%'+_0x26e2e9[_0x28cc('0x36')][_0x28cc('0x3e')]+'%'};return _0x4b3c1c;})});}_0x1ee04b=_[_0x28cc('0x40')]({},_0x1ee04b,_0x26e2e9[_0x28cc('0x42')]);return _0x4f30ea[_0x28cc('0x8d')](_0x1ee04b);}})[_0x28cc('0x29')](function(_0x12f1e4){if(_0x12f1e4){_0xbf54cb=_0x12f1e4[_0x28cc('0x5a')];if(!_0x26e2e9[_0x28cc('0x36')][_0x28cc('0x5b')](_0x28cc('0x3b'))){_0x1ee04b[_0x28cc('0x22')]=qs['limit'](_0x26e2e9[_0x28cc('0x36')][_0x28cc('0x22')]);_0x1ee04b[_0x28cc('0x20')]=qs[_0x28cc('0x20')](_0x26e2e9[_0x28cc('0x36')][_0x28cc('0x20')]);}return _0x4f30ea[_0x28cc('0x8d')](_0x1ee04b);}})[_0x28cc('0x29')](function(_0x2b5622){if(_0x2b5622){return _0x2b5622?{'count':_0xbf54cb,'rows':_0x2b5622}:null;}})[_0x28cc('0x29')](respondWithResult(_0xee99a,null))['catch'](handleError(_0xee99a,null));}; \ No newline at end of file +var _0x0b0e=['localhost','./smsQueue.socket','register','sendStatus','end','json','undefined','offset','limit','status','set','apply','save','update','destroy','get','SmsQueues','UserProfileResource','then','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','params','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','findOne','hasOwnProperty','nolimit','order','SmsQueueId','UserSmsQueue','UserId','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','online','voicePause','flatMap','Agents','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeAgents','userSmsQueue:remove','addAgents','omit','userSmsQueue:save','isArray','User','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x10a1f4,_0x42ca0b){var _0x401bef=function(_0x939b3c){while(--_0x939b3c){_0x10a1f4['push'](_0x10a1f4['shift']());}};_0x401bef(++_0x42ca0b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0x0b0e[_0x403c8d];return _0x4ca60d;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];config[_0xe0b0('0x18')]=_[_0xe0b0('0x19')](config[_0xe0b0('0x18')],{'host':_0xe0b0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0b0('0x18')]));require(_0xe0b0('0x1b'))[_0xe0b0('0x1c')](socket);function respondWithStatusCode(_0x24babd,_0x177c24){_0x177c24=_0x177c24||0xcc;return function(_0x55d884){if(_0x55d884){return _0x24babd[_0xe0b0('0x1d')](_0x177c24);}return _0x24babd['status'](_0x177c24)[_0xe0b0('0x1e')]();};}function respondWithResult(_0xadee6e,_0x519ae8){_0x519ae8=_0x519ae8||0xc8;return function(_0x11fdca){if(_0x11fdca){return _0xadee6e['status'](_0x519ae8)[_0xe0b0('0x1f')](_0x11fdca);}};}function respondWithFilteredResult(_0x100204,_0x56bcc7){return function(_0x54a3eb){if(_0x54a3eb){var _0x46bb44=typeof _0x56bcc7['offset']==='undefined'&&typeof _0x56bcc7['limit']===_0xe0b0('0x20');var _0x50fa4a=_0x54a3eb['count'];var _0x10cde1=_0x46bb44?0x0:_0x56bcc7['offset'];var _0x472286=_0x46bb44?_0x54a3eb['count']:_0x56bcc7[_0xe0b0('0x21')]+_0x56bcc7[_0xe0b0('0x22')];var _0x3e10b3;if(_0x472286>=_0x50fa4a){_0x472286=_0x50fa4a;_0x3e10b3=0xc8;}else{_0x3e10b3=0xce;}_0x100204[_0xe0b0('0x23')](_0x3e10b3);return _0x100204[_0xe0b0('0x24')]('Content-Range',_0x10cde1+'-'+_0x472286+'/'+_0x50fa4a)['json'](_0x54a3eb);}return null;};}function patchUpdates(_0x2fa820){return function(_0x5512bb){try{jsonpatch[_0xe0b0('0x25')](_0x5512bb,_0x2fa820,!![]);}catch(_0x31b5f8){return BPromise['reject'](_0x31b5f8);}return _0x5512bb[_0xe0b0('0x26')]();};}function saveUpdates(_0x503883,_0x2208d0){return function(_0x49a727){if(_0x49a727){return _0x49a727[_0xe0b0('0x27')](_0x503883)['then'](function(_0x3e5c88){return _0x3e5c88;});}return null;};}function removeEntity(_0x4de537,_0x4700cc){return function(_0x4aafbe){if(_0x4aafbe){return _0x4aafbe[_0xe0b0('0x28')]()['then'](function(){var _0x362aba=_0x4aafbe[_0xe0b0('0x29')]({'plain':!![]});var _0x1f1ebd=_0xe0b0('0x2a');return db[_0xe0b0('0x2b')][_0xe0b0('0x28')]({'where':{'type':_0x1f1ebd,'resourceId':_0x362aba['id']}})['then'](function(){return _0x4aafbe;});})[_0xe0b0('0x2c')](function(){_0x4de537[_0xe0b0('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e13b,_0x419b1f){return function(_0x36d137){if(!_0x36d137){_0x15e13b[_0xe0b0('0x1d')](0x194);}return _0x36d137;};}function handleError(_0x3cdbd5,_0x254cad){_0x254cad=_0x254cad||0x1f4;return function(_0x136bd4){logger['error'](_0x136bd4[_0xe0b0('0x2d')]);if(_0x136bd4[_0xe0b0('0x2e')]){delete _0x136bd4['name'];}_0x3cdbd5['status'](_0x254cad)[_0xe0b0('0x2f')](_0x136bd4);};}exports[_0xe0b0('0x30')]=function(_0x422575,_0x3f81d5){var _0x2ab1b1={},_0x5866e5={},_0x32acfe={'count':0x0,'rows':[]};var _0x3231fc=_[_0xe0b0('0x31')](db[_0xe0b0('0x32')][_0xe0b0('0x33')],function(_0x4fe835){return{'name':_0x4fe835[_0xe0b0('0x34')],'type':_0x4fe835[_0xe0b0('0x35')][_0xe0b0('0x36')]};});_0x5866e5[_0xe0b0('0x37')]=_[_0xe0b0('0x31')](_0x3231fc,_0xe0b0('0x2e'));_0x5866e5[_0xe0b0('0x38')]=_[_0xe0b0('0x39')](_0x422575[_0xe0b0('0x38')]);_0x5866e5[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x5866e5[_0xe0b0('0x37')],_0x5866e5[_0xe0b0('0x38')]);_0x2ab1b1[_0xe0b0('0x3c')]=_[_0xe0b0('0x3b')](_0x5866e5['model'],qs[_0xe0b0('0x3d')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x3d')]));_0x2ab1b1[_0xe0b0('0x3c')]=_0x2ab1b1[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x2ab1b1[_0xe0b0('0x3c')]:_0x5866e5['model'];if(!_0x422575['query']['hasOwnProperty']('nolimit')){_0x2ab1b1[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x422575[_0xe0b0('0x38')]['limit']);_0x2ab1b1[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x21')]);}_0x2ab1b1['order']=qs[_0xe0b0('0x3f')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x3f')]);_0x2ab1b1[_0xe0b0('0x40')]=qs[_0xe0b0('0x3a')](_[_0xe0b0('0x41')](_0x422575[_0xe0b0('0x38')],_0x5866e5[_0xe0b0('0x3a')]),_0x3231fc);if(_0x422575[_0xe0b0('0x38')]['filter']){_0x2ab1b1[_0xe0b0('0x40')]=_['merge'](_0x2ab1b1[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x3231fc,function(_0x46c4ea){if(_0x46c4ea[_0xe0b0('0x35')]!=='VIRTUAL'){var _0x3e1b6b={};_0x3e1b6b[_0x46c4ea[_0xe0b0('0x2e')]]={'$like':'%'+_0x422575[_0xe0b0('0x38')][_0xe0b0('0x42')]+'%'};return _0x3e1b6b;}})});}_0x2ab1b1=_[_0xe0b0('0x43')]({},_0x2ab1b1,_0x422575[_0xe0b0('0x44')]);var _0x3ad564={'where':_0x2ab1b1[_0xe0b0('0x40')]};return db['SmsQueue'][_0xe0b0('0x45')](_0x3ad564)[_0xe0b0('0x2c')](function(_0x528818){_0x32acfe['count']=_0x528818;if(_0x422575[_0xe0b0('0x38')][_0xe0b0('0x46')]){_0x2ab1b1['include']=[{'all':!![]}];}return db[_0xe0b0('0x32')][_0xe0b0('0x47')](_0x2ab1b1);})[_0xe0b0('0x2c')](function(_0x1c869d){_0x32acfe[_0xe0b0('0x48')]=_0x1c869d;return _0x32acfe;})['then'](respondWithFilteredResult(_0x3f81d5,_0x2ab1b1))['catch'](handleError(_0x3f81d5,null));};exports['show']=function(_0xc3235b,_0x38e715){var _0x5c2f3b={'raw':!![],'where':{'id':_0xc3235b[_0xe0b0('0x49')]['id']}},_0x9f7459={};_0x9f7459[_0xe0b0('0x37')]=_[_0xe0b0('0x39')](db[_0xe0b0('0x32')]['rawAttributes']);_0x9f7459['query']=_[_0xe0b0('0x39')](_0xc3235b[_0xe0b0('0x38')]);_0x9f7459[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x9f7459[_0xe0b0('0x37')],_0x9f7459['query']);_0x5c2f3b[_0xe0b0('0x3c')]=_[_0xe0b0('0x3b')](_0x9f7459['model'],qs['fields'](_0xc3235b['query'][_0xe0b0('0x3d')]));_0x5c2f3b[_0xe0b0('0x3c')]=_0x5c2f3b[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x5c2f3b['attributes']:_0x9f7459[_0xe0b0('0x37')];if(_0xc3235b[_0xe0b0('0x38')]['includeAll']){_0x5c2f3b['include']=[{'all':!![]}];}_0x5c2f3b=_[_0xe0b0('0x43')]({},_0x5c2f3b,_0xc3235b[_0xe0b0('0x44')]);return db['SmsQueue'][_0xe0b0('0x4a')](_0x5c2f3b)[_0xe0b0('0x2c')](handleEntityNotFound(_0x38e715,null))['then'](respondWithResult(_0x38e715,null))['catch'](handleError(_0x38e715,null));};exports[_0xe0b0('0x4b')]=function(_0x511679,_0x165dc8){return db[_0xe0b0('0x32')][_0xe0b0('0x4b')](_0x511679[_0xe0b0('0x4c')],{})[_0xe0b0('0x2c')](function(_0xf9e694){var _0x5f5486=_0x511679['user'][_0xe0b0('0x29')]({'plain':!![]});if(!_0x5f5486)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f5486['role']===_0xe0b0('0x4d')){var _0x222174=_0xf9e694['get']({'plain':!![]});var _0x4b65d1=_0xe0b0('0x2a');return db[_0xe0b0('0x4e')][_0xe0b0('0x4a')]({'where':{'name':_0x4b65d1,'userProfileId':_0x5f5486[_0xe0b0('0x4f')]},'raw':!![]})[_0xe0b0('0x2c')](function(_0x24115f){if(_0x24115f&&_0x24115f[_0xe0b0('0x50')]===0x0){return db['UserProfileResource'][_0xe0b0('0x4b')]({'name':_0x222174['name'],'resourceId':_0x222174['id'],'type':_0x24115f[_0xe0b0('0x2e')],'sectionId':_0x24115f['id']},{})['then'](function(){return _0xf9e694;});}else{return _0xf9e694;}})['catch'](function(_0x33822e){logger[_0xe0b0('0x51')](_0xe0b0('0x52'),_0x33822e);throw _0x33822e;});}return _0xf9e694;})[_0xe0b0('0x2c')](respondWithResult(_0x165dc8,0xc9))[_0xe0b0('0x53')](handleError(_0x165dc8,null));};exports[_0xe0b0('0x27')]=function(_0x4548da,_0xf9a61c){if(_0x4548da[_0xe0b0('0x4c')]['id']){delete _0x4548da['body']['id'];}return db[_0xe0b0('0x32')]['find']({'where':{'id':_0x4548da[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0xf9a61c,null))[_0xe0b0('0x2c')](saveUpdates(_0x4548da[_0xe0b0('0x4c')],null))[_0xe0b0('0x2c')](respondWithResult(_0xf9a61c,null))[_0xe0b0('0x53')](handleError(_0xf9a61c,null));};exports['destroy']=function(_0x1a057c,_0x16ea00){return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x1a057c[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x16ea00,null))[_0xe0b0('0x2c')](removeEntity(_0x16ea00,null))[_0xe0b0('0x53')](handleError(_0x16ea00,null));};exports[_0xe0b0('0x54')]=function(_0xf331df,_0x1eb5d6){return db[_0xe0b0('0x32')][_0xe0b0('0x54')]()[_0xe0b0('0x2c')](respondWithResult(_0x1eb5d6,null))[_0xe0b0('0x53')](handleError(_0x1eb5d6,null));};exports[_0xe0b0('0x55')]=function(_0x4c7661,_0x155738,_0x5aa79b){var _0x46627e={'raw':!![],'where':{}},_0xe7fbac={},_0x1182dc;return db[_0xe0b0('0x32')][_0xe0b0('0x56')]({'where':{'id':_0x4c7661[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x155738,null))['then'](function(_0x47dcc4){if(_0x47dcc4){_0x1182dc=_0x47dcc4[_0xe0b0('0x29')]({'plain':!![]});_0xe7fbac[_0xe0b0('0x37')]=_[_0xe0b0('0x39')](db['UserSmsQueue'][_0xe0b0('0x33')]);_0xe7fbac[_0xe0b0('0x38')]=_[_0xe0b0('0x39')](_0x4c7661[_0xe0b0('0x38')]);_0xe7fbac[_0xe0b0('0x3a')]=_['intersection'](_0xe7fbac[_0xe0b0('0x37')],_0xe7fbac[_0xe0b0('0x38')]);_0x46627e[_0xe0b0('0x3c')]=_['intersection'](_0xe7fbac[_0xe0b0('0x37')],qs[_0xe0b0('0x3d')](_0x4c7661['query'][_0xe0b0('0x3d')]));_0x46627e['attributes']=_0x46627e['attributes'][_0xe0b0('0x3e')]?_0x46627e['attributes']:_0xe7fbac['model'];if(!_0x4c7661[_0xe0b0('0x38')][_0xe0b0('0x57')](_0xe0b0('0x58'))){_0x46627e[_0xe0b0('0x22')]=qs['limit'](_0x4c7661[_0xe0b0('0x38')][_0xe0b0('0x22')]);_0x46627e[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x4c7661[_0xe0b0('0x38')][_0xe0b0('0x21')]);}_0x46627e[_0xe0b0('0x59')]=qs[_0xe0b0('0x3f')](_0x4c7661['query']['sort']);_0x46627e[_0xe0b0('0x40')]=qs[_0xe0b0('0x3a')](_[_0xe0b0('0x41')](_0x4c7661['query'],_0xe7fbac['filters']));_0x46627e[_0xe0b0('0x40')][_0xe0b0('0x5a')]=_0x47dcc4['id'];if(_0x4c7661['query']['filter']){_0x46627e[_0xe0b0('0x40')]=_[_0xe0b0('0x43')](_0x46627e[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x46627e[_0xe0b0('0x3c')],function(_0x15f0f8){var _0x1bc7a6={};_0x1bc7a6[_0x15f0f8]={'$like':'%'+_0x4c7661[_0xe0b0('0x38')]['filter']+'%'};return _0x1bc7a6;})});}_0x46627e=_[_0xe0b0('0x43')]({},_0x46627e,_0x4c7661[_0xe0b0('0x44')]);return db[_0xe0b0('0x5b')]['findAll'](_0x46627e);}})['then'](function(_0x4f4b45){if(_0x4f4b45){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x4f4b45,_0xe0b0('0x5c')),'role':'agent'},'attributes':['id','name',_0xe0b0('0x5d'),_0xe0b0('0x5e'),_0xe0b0('0x5f')]});}})[_0xe0b0('0x2c')](function(_0x3e7c9b){if(_0x3e7c9b){return{'count':_0x3e7c9b[_0xe0b0('0x45')],'rows':_[_0xe0b0('0x31')](_0x3e7c9b[_0xe0b0('0x48')],function(_0x599332){return{'membername':_0x599332[_0xe0b0('0x2e')],'UserId':_0x599332['id'],'queue_name':_0x1182dc[_0xe0b0('0x2e')],'SmsQueueId':_0x1182dc['id'],'interface':util[_0xe0b0('0x60')](_0xe0b0('0x61'),_0xe0b0('0x62'),_0x599332[_0xe0b0('0x2e')]),'penalty':0x0,'paused':_0x599332[_0xe0b0('0x5d')],'createdAt':_0x599332['createdAt'],'updatedAt':_0x599332[_0xe0b0('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x155738,_0x46627e))[_0xe0b0('0x53')](handleError(_0x155738,null));};exports[_0xe0b0('0x63')]=function(_0x255200,_0x9c7221,_0x4a78f8){var _0x311f79={};var _0x429ac3={};var _0x49deef;var _0x4cf60a;return db[_0xe0b0('0x32')][_0xe0b0('0x56')]({'where':{'id':_0x255200[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x9c7221,null))[_0xe0b0('0x2c')](function(_0x31dd21){if(_0x31dd21){_0x49deef=_0x31dd21;_0x429ac3[_0xe0b0('0x37')]=_[_0xe0b0('0x39')](db[_0xe0b0('0x64')][_0xe0b0('0x33')]);_0x429ac3['query']=_['keys'](_0x255200[_0xe0b0('0x38')]);_0x429ac3['filters']=_['intersection'](_0x429ac3['model'],_0x429ac3['query']);_0x311f79[_0xe0b0('0x3c')]=_['intersection'](_0x429ac3[_0xe0b0('0x37')],qs[_0xe0b0('0x3d')](_0x255200[_0xe0b0('0x38')][_0xe0b0('0x3d')]));_0x311f79['attributes']=_0x311f79[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x311f79['attributes']:_0x429ac3[_0xe0b0('0x37')];_0x311f79[_0xe0b0('0x59')]=qs[_0xe0b0('0x3f')](_0x255200[_0xe0b0('0x38')][_0xe0b0('0x3f')]);_0x311f79['where']=qs['filters'](_['pick'](_0x255200['query'],_0x429ac3['filters']));if(_0x255200[_0xe0b0('0x38')]['filter']){_0x311f79[_0xe0b0('0x40')]=_['merge'](_0x311f79[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x311f79[_0xe0b0('0x3c')],function(_0x380b4c){var _0x199929={};_0x199929[_0x380b4c]={'$like':'%'+_0x255200[_0xe0b0('0x38')]['filter']+'%'};return _0x199929;})});}_0x311f79=_['merge']({},_0x311f79,_0x255200['options']);return _0x49deef['getTeams'](_0x311f79);}})[_0xe0b0('0x2c')](function(_0x261381){if(_0x261381){_0x4cf60a=_0x261381[_0xe0b0('0x3e')];if(!_0x255200[_0xe0b0('0x38')][_0xe0b0('0x57')]('nolimit')){_0x311f79[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x255200[_0xe0b0('0x38')][_0xe0b0('0x22')]);_0x311f79[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x255200[_0xe0b0('0x38')][_0xe0b0('0x21')]);}return _0x49deef[_0xe0b0('0x63')](_0x311f79);}})['then'](function(_0x589c47){if(_0x589c47){return _0x589c47?{'count':_0x4cf60a,'rows':_0x589c47}:null;}})[_0xe0b0('0x2c')](respondWithResult(_0x9c7221,null))[_0xe0b0('0x53')](handleError(_0x9c7221,null));};exports['addTeams']=function(_0x7feff4,_0x4593f1,_0x44c475){var _0x3fcffd=_0x7feff4[_0xe0b0('0x4c')][_0xe0b0('0x65')];return db[_0xe0b0('0x64')][_0xe0b0('0x47')]({'where':{'id':_0x3fcffd},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xe0b0('0x66'),_0xe0b0('0x67'),'interface'],'raw':!![]}]})[_0xe0b0('0x2c')](function(_0x448694){if(_0x448694){var _0x396eec=_[_0xe0b0('0x68')](_0x448694,function(_0x5c45ae){var _0x56c4b9=_0x5c45ae['get']({'plain':!![]});return _0x56c4b9[_0xe0b0('0x69')];});return db[_0xe0b0('0x32')]['find']({'where':{'id':_0x7feff4[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](function(_0x5547ee){return db['sequelize'][_0xe0b0('0x6a')](function(_0x554181){return _0x5547ee[_0xe0b0('0x6b')](_0x3fcffd,{'transaction':_0x554181})['then'](function(){return BPromise[_0xe0b0('0x6c')](_0x396eec,function(_0x13995d){return db[_0xe0b0('0x5b')][_0xe0b0('0x6d')]({'where':{'UserId':_0x13995d['id'],'SmsQueueId':_0x7feff4[_0xe0b0('0x49')]['id']},'transaction':_0x554181});});})[_0xe0b0('0x2c')](function(){_0x396eec[_0xe0b0('0x6e')](function(_0x2ebbb5){socket[_0xe0b0('0x6f')]('userSmsQueue:save',{'UserId':_0x2ebbb5['id'],'SmsQueueId':_0x5547ee['id']});});});});});}})[_0xe0b0('0x2c')](respondWithStatusCode(_0x4593f1,null))[_0xe0b0('0x53')](handleError(_0x4593f1,null));};exports[_0xe0b0('0x70')]=function(_0x4e19f4,_0x1b7336,_0x4ad24f){return db[_0xe0b0('0x64')][_0xe0b0('0x47')]({'where':{'id':_0x4e19f4['query'][_0xe0b0('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe0b0('0x2c')](handleEntityNotFound(_0x1b7336,null))['then'](function(_0x5085b0){var _0x4f027c=_[_0xe0b0('0x31')](_0x5085b0,'id');var _0x238979=[];var _0x9e8b9c=[];var _0x42b591=squel[_0xe0b0('0x71')]();_0x42b591['field'](_0xe0b0('0x72'))[_0xe0b0('0x73')](_0xe0b0('0x74'),'tq')['join'](_0xe0b0('0x75'),'ut',_0xe0b0('0x76'))['where']('SmsQueueId\x20=\x20?',_0x4e19f4[_0xe0b0('0x49')]['id']);for(var _0x556d14=0x0;_0x556d14<_0x5085b0[_0xe0b0('0x3e')];_0x556d14+=0x1){let _0xadc32=_0x5085b0[_0x556d14];for(var _0x40a5c0=0x0;_0x40a5c0<_0xadc32[_0xe0b0('0x69')][_0xe0b0('0x3e')];_0x40a5c0+=0x1){let _0x333d53=_0xadc32[_0xe0b0('0x69')][_0x40a5c0];var _0x504483=_0x42b591[_0xe0b0('0x77')]();_0x504483[_0xe0b0('0x40')](_0xe0b0('0x78'),_0x333d53['id']);_0x9e8b9c[_0xe0b0('0x79')](db[_0xe0b0('0x7a')]['query'](_0x504483['toString'](),{'type':db[_0xe0b0('0x7a')][_0xe0b0('0x7b')][_0xe0b0('0x7c')]})[_0xe0b0('0x2c')](function(_0xaeec1f){if(_0xaeec1f[_0xe0b0('0x3e')]===0x1){return _0x333d53['id'];}else{var _0x38ae1f=_[_0xe0b0('0x7d')](_[_0xe0b0('0x31')](_0xaeec1f,_0xe0b0('0x7e')),function(_0x4fe048){return _[_0xe0b0('0x7f')](_0x4f027c,_0x4fe048);});if(_0x38ae1f){return _0x333d53['id'];}}}));}}return BPromise[_0xe0b0('0x80')](_0x9e8b9c)[_0xe0b0('0x2c')](function(_0x16ed11){_0x238979=_(_0x238979)['union'](_0x16ed11)[_0xe0b0('0x81')]()[_0xe0b0('0x82')]();return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x4e19f4[_0xe0b0('0x49')]['id']}})['then'](function(_0x294e13){return db['sequelize'][_0xe0b0('0x6a')](function(_0x196ab7){return _0x294e13[_0xe0b0('0x70')](_0x4e19f4[_0xe0b0('0x38')][_0xe0b0('0x65')],{'transaction':_0x196ab7})['then'](function(){if(!_['isEmpty'](_0x238979)){return _0x294e13[_0xe0b0('0x83')](_0x238979,{'transaction':_0x196ab7});}})['then'](function(){_0x238979[_0xe0b0('0x6e')](function(_0x4c82d6){socket[_0xe0b0('0x6f')](_0xe0b0('0x84'),{'UserId':_0x4c82d6,'SmsQueueId':_0x294e13['id']});});});});});});})[_0xe0b0('0x2c')](respondWithStatusCode(_0x1b7336,null))[_0xe0b0('0x53')](handleError(_0x1b7336,null));};exports[_0xe0b0('0x85')]=function(_0x1bb4da,_0x43ff30,_0x5d7cee){return db['SmsQueue'][_0xe0b0('0x4a')]({'where':{'id':_0x1bb4da[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x43ff30,null))[_0xe0b0('0x2c')](function(_0xd83992){if(_0xd83992){return _0xd83992[_0xe0b0('0x85')](_0x1bb4da[_0xe0b0('0x4c')][_0xe0b0('0x65')],_[_0xe0b0('0x86')](_0x1bb4da[_0xe0b0('0x4c')],['ids','id'])||{})['spread'](function(_0x3dd34e){for(var _0x26caf8=0x0;_0x26caf8<_0x1bb4da[_0xe0b0('0x4c')][_0xe0b0('0x65')][_0xe0b0('0x3e')];_0x26caf8+=0x1){socket[_0xe0b0('0x6f')](_0xe0b0('0x87'),{'UserId':Number(_0x1bb4da['body']['ids'][_0x26caf8]),'SmsQueueId':Number(_0x1bb4da[_0xe0b0('0x49')]['id'])});}return _0x3dd34e;});}})[_0xe0b0('0x2c')](respondWithResult(_0x43ff30,null))[_0xe0b0('0x53')](handleError(_0x43ff30,null));};exports[_0xe0b0('0x83')]=function(_0x382ba7,_0x19cc74,_0x4173e0){return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x382ba7[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x19cc74,null))[_0xe0b0('0x2c')](function(_0x3da9f8){if(_0x3da9f8){return _0x3da9f8['removeAgents'](_0x382ba7[_0xe0b0('0x38')][_0xe0b0('0x65')])[_0xe0b0('0x2c')](function(){if(_[_0xe0b0('0x88')](_0x382ba7[_0xe0b0('0x38')]['ids'])){for(var _0x14a778=0x0;_0x14a778<_0x382ba7[_0xe0b0('0x38')][_0xe0b0('0x65')][_0xe0b0('0x3e')];_0x14a778+=0x1){socket[_0xe0b0('0x6f')]('userSmsQueue:remove',{'UserId':Number(_0x382ba7[_0xe0b0('0x38')]['ids'][_0x14a778]),'SmsQueueId':Number(_0x382ba7[_0xe0b0('0x49')]['id'])});}}else{socket[_0xe0b0('0x6f')](_0xe0b0('0x84'),{'UserId':Number(_0x382ba7['query']['ids']),'SmsQueueId':Number(_0x382ba7[_0xe0b0('0x49')]['id'])});}});}})[_0xe0b0('0x2c')](respondWithStatusCode(_0x19cc74,null))[_0xe0b0('0x53')](handleError(_0x19cc74,null));};exports['getAgents']=function(_0x4d372a,_0x5da5eb,_0x5175e1){var _0x57694c={};var _0x52aa98={};var _0x3474ab;var _0x1c6674;return db['SmsQueue'][_0xe0b0('0x56')]({'where':{'id':_0x4d372a[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x5da5eb,null))[_0xe0b0('0x2c')](function(_0x437588){if(_0x437588){_0x3474ab=_0x437588;_0x52aa98['model']=_['keys'](db[_0xe0b0('0x89')][_0xe0b0('0x33')]);_0x52aa98[_0xe0b0('0x38')]=_['keys'](_0x4d372a[_0xe0b0('0x38')]);_0x52aa98[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x52aa98[_0xe0b0('0x37')],_0x52aa98[_0xe0b0('0x38')]);_0x57694c[_0xe0b0('0x3c')]=_['intersection'](_0x52aa98['model'],qs['fields'](_0x4d372a[_0xe0b0('0x38')][_0xe0b0('0x3d')]));_0x57694c[_0xe0b0('0x3c')]=_0x57694c[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x57694c[_0xe0b0('0x3c')]:_0x52aa98[_0xe0b0('0x37')];_0x57694c[_0xe0b0('0x59')]=qs['sort'](_0x4d372a['query'][_0xe0b0('0x3f')]);_0x57694c[_0xe0b0('0x40')]=qs[_0xe0b0('0x3a')](_['pick'](_0x4d372a[_0xe0b0('0x38')],_0x52aa98[_0xe0b0('0x3a')]));if(_0x4d372a[_0xe0b0('0x38')]['filter']){_0x57694c[_0xe0b0('0x40')]=_['merge'](_0x57694c[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x57694c[_0xe0b0('0x3c')],function(_0x3038e2){var _0x3b133a={};_0x3b133a[_0x3038e2]={'$like':'%'+_0x4d372a[_0xe0b0('0x38')][_0xe0b0('0x42')]+'%'};return _0x3b133a;})});}_0x57694c=_['merge']({},_0x57694c,_0x4d372a[_0xe0b0('0x44')]);return _0x3474ab[_0xe0b0('0x8a')](_0x57694c);}})['then'](function(_0x44e4a8){if(_0x44e4a8){_0x1c6674=_0x44e4a8[_0xe0b0('0x3e')];if(!_0x4d372a[_0xe0b0('0x38')]['hasOwnProperty'](_0xe0b0('0x58'))){_0x57694c[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x4d372a['query'][_0xe0b0('0x22')]);_0x57694c[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x4d372a[_0xe0b0('0x38')][_0xe0b0('0x21')]);}return _0x3474ab[_0xe0b0('0x8a')](_0x57694c);}})['then'](function(_0x44da91){if(_0x44da91){return _0x44da91?{'count':_0x1c6674,'rows':_0x44da91}:null;}})[_0xe0b0('0x2c')](respondWithResult(_0x5da5eb,null))[_0xe0b0('0x53')](handleError(_0x5da5eb,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a6cfe2b..4d7aaa2 100644 --- a/server/api/smsQueue/smsQueue.events.js +++ b/server/api/smsQueue/smsQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93b3=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb','SmsQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93b3,0x1ae));var _0x393b=function(_0xf15be4,_0x2c2591){_0xf15be4=_0xf15be4-0x0;var _0x2b6849=_0x93b3[_0xf15be4];return _0x2b6849;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x393b('0x0'))['db'][_0x393b('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x393b('0x2')](0x0);var events={'afterCreate':_0x393b('0x3'),'afterUpdate':'update','afterDestroy':_0x393b('0x4')};function emitEvent(_0x25f9d1){return function(_0x12513c,_0x12be4d,_0x17ebb9){SmsQueueEvents[_0x393b('0x5')](_0x25f9d1+':'+_0x12513c['id'],_0x12513c);SmsQueueEvents[_0x393b('0x5')](_0x25f9d1,_0x12513c);_0x17ebb9(null);};}for(var e in events){if(events[_0x393b('0x6')](e)){var event=events[e];SmsQueue[_0x393b('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x8f6b=['events','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8f6b,0x1a8));var _0xb8f6=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x8f6b[_0x3054be];return _0x3df150;};'use strict';var EventEmitter=require(_0xb8f6('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xb8f6('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb8f6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb8f6('0x3'),'afterDestroy':_0xb8f6('0x4')};function emitEvent(_0x3621a1){return function(_0x112c41,_0x19e5fd,_0x55ff29){SmsQueueEvents[_0xb8f6('0x5')](_0x3621a1+':'+_0x112c41['id'],_0x112c41);SmsQueueEvents[_0xb8f6('0x5')](_0x3621a1,_0x112c41);_0x55ff29(null);};}for(var e in events){if(events[_0xb8f6('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xb8f6('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index c37fed2..4d8d961 100644 --- a/server/api/smsQueue/smsQueue.model.js +++ b/server/api/smsQueue/smsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4da6=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0x494749,_0x4dd8d3){var _0x543d23=function(_0x264da9){while(--_0x264da9){_0x494749['push'](_0x494749['shift']());}};_0x543d23(++_0x4dd8d3);}(_0x4da6,0x162));var _0x64da=function(_0x3cbfbb,_0x61c906){_0x3cbfbb=_0x3cbfbb-0x0;var _0xf5ec92=_0x4da6[_0x3cbfbb];return _0xf5ec92;};'use strict';var _=require(_0x64da('0x0'));var util=require(_0x64da('0x1'));var logger=require(_0x64da('0x2'))(_0x64da('0x3'));var moment=require(_0x64da('0x4'));var BPromise=require(_0x64da('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x64da('0x6'));var config=require(_0x64da('0x7'));var attributes=require(_0x64da('0x8'));module[_0x64da('0x9')]=function(_0x1dca7a,_0x54d19f){return _0x1dca7a[_0x64da('0xa')](_0x64da('0xb'),attributes,{'tableName':_0x64da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1643=['sms_queues','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x1643,0x118));var _0x3164=function(_0x2e88f8,_0x34c51c){_0x2e88f8=_0x2e88f8-0x0;var _0xada200=_0x1643[_0x2e88f8];return _0xada200;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3164('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3164('0x1'));var rp=require(_0x3164('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3164('0x3'));var config=require(_0x3164('0x4'));var attributes=require(_0x3164('0x5'));module[_0x3164('0x6')]=function(_0x22e723,_0x597972){return _0x22e723[_0x3164('0x7')]('SmsQueue',attributes,{'tableName':_0x3164('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index a6ca327..509a2d8 100644 --- a/server/api/smsQueue/smsQueue.rpc.js +++ b/server/api/smsQueue/smsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe513=['socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowSmsQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x2f371e,_0x579eea){var _0x518ccc=function(_0x14992d){while(--_0x14992d){_0x2f371e['push'](_0x2f371e['shift']());}};_0x518ccc(++_0x579eea);}(_0xe513,0x18b));var _0x3e51=function(_0x1b8d17,_0x4f6c8b){_0x1b8d17=_0x1b8d17-0x0;var _0x206e6a=_0xe513[_0x1b8d17];return _0x206e6a;};'use strict';var _=require('lodash');var util=require(_0x3e51('0x0'));var moment=require(_0x3e51('0x1'));var BPromise=require(_0x3e51('0x2'));var rs=require(_0x3e51('0x3'));var fs=require('fs');var Redis=require(_0x3e51('0x4'));var db=require(_0x3e51('0x5'))['db'];var utils=require(_0x3e51('0x6'));var logger=require(_0x3e51('0x7'))(_0x3e51('0x8'));var config=require(_0x3e51('0x9'));var jayson=require(_0x3e51('0xa'));var client=jayson[_0x3e51('0xb')][_0x3e51('0xc')]({'port':0x232a});config[_0x3e51('0xd')]=_['defaults'](config[_0x3e51('0xd')],{'host':_0x3e51('0xe'),'port':0x18eb});var socket=require(_0x3e51('0xf'))(new Redis(config['redis']));require(_0x3e51('0x10'))[_0x3e51('0x11')](socket);function respondWithRpcPromise(_0x3cd704,_0x12a387,_0x400581){return new BPromise(function(_0x3a9327,_0x153cbf){return client[_0x3e51('0x12')](_0x3cd704,_0x400581)[_0x3e51('0x13')](function(_0x1dca40){logger[_0x3e51('0x14')](_0x3e51('0x15'),_0x12a387,'request\x20sent');logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x12a387,_0x3e51('0x16'),JSON['stringify'](_0x1dca40));if(_0x1dca40[_0x3e51('0x17')]){if(_0x1dca40[_0x3e51('0x17')][_0x3e51('0x18')]===0x1f4){logger[_0x3e51('0x17')]('SmsQueue,\x20%s,\x20%s',_0x12a387,_0x1dca40[_0x3e51('0x17')][_0x3e51('0x19')]);return _0x153cbf(_0x1dca40['error'][_0x3e51('0x19')]);}logger[_0x3e51('0x17')]('SmsQueue,\x20%s,\x20%s',_0x12a387,_0x1dca40['error'][_0x3e51('0x19')]);return _0x3a9327(_0x1dca40[_0x3e51('0x17')]['message']);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x12a387,_0x3e51('0x16'));_0x3a9327(_0x1dca40['result'][_0x3e51('0x19')]);}})[_0x3e51('0x1a')](function(_0x33738b){logger['error']('SmsQueue,\x20%s,\x20%s',_0x12a387,_0x33738b);_0x153cbf(_0x33738b);});});}exports[_0x3e51('0x1b')]=function(_0x2d8c1b){var _0x4fdb52=this;return new Promise(function(_0x5d03ba,_0x424ecd){return db[_0x3e51('0x1c')]['findAll']({'raw':_0x2d8c1b[_0x3e51('0x1d')]?_0x2d8c1b[_0x3e51('0x1d')][_0x3e51('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d8c1b[_0x3e51('0x1d')]?_0x2d8c1b[_0x3e51('0x1d')][_0x3e51('0x1f')]||null:null,'attributes':_0x2d8c1b[_0x3e51('0x1d')]?_0x2d8c1b[_0x3e51('0x1d')][_0x3e51('0x20')]||null:null,'limit':_0x2d8c1b['options']?_0x2d8c1b[_0x3e51('0x1d')][_0x3e51('0x21')]||null:null,'include':_0x2d8c1b['options']?_0x2d8c1b[_0x3e51('0x1d')][_0x3e51('0x22')]?_[_0x3e51('0x23')](_0x2d8c1b['options'][_0x3e51('0x22')],function(_0x194b39){return{'model':db[_0x194b39[_0x3e51('0x24')]],'as':_0x194b39['as'],'attributes':_0x194b39[_0x3e51('0x20')],'include':_0x194b39[_0x3e51('0x22')]?_[_0x3e51('0x23')](_0x194b39[_0x3e51('0x22')],function(_0x8500f0){return{'model':db[_0x8500f0[_0x3e51('0x24')]],'as':_0x8500f0['as'],'attributes':_0x8500f0[_0x3e51('0x20')],'include':_0x8500f0[_0x3e51('0x22')]?_['map'](_0x8500f0[_0x3e51('0x22')],function(_0x35d7cc){return{'model':db[_0x35d7cc[_0x3e51('0x24')]],'as':_0x35d7cc['as'],'attributes':_0x35d7cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e51('0x13')](function(_0x596ae6){logger[_0x3e51('0x14')]('GetSmsQueue',_0x2d8c1b);logger[_0x3e51('0x25')](_0x3e51('0x1b'),_0x2d8c1b,JSON[_0x3e51('0x26')](_0x596ae6));_0x5d03ba(_0x596ae6);})[_0x3e51('0x1a')](function(_0x554184){logger[_0x3e51('0x17')](_0x3e51('0x1b'),_0x554184[_0x3e51('0x19')],_0x2d8c1b);_0x424ecd(_0x4fdb52[_0x3e51('0x17')](0x1f4,_0x554184[_0x3e51('0x19')]));});});};exports[_0x3e51('0x27')]=function(_0x2f57da){var _0x25840a=this;return new Promise(function(_0x3e36a8,_0x3e7971){return db[_0x3e51('0x1c')][_0x3e51('0x28')]({'raw':_0x2f57da[_0x3e51('0x1d')]?_0x2f57da['options'][_0x3e51('0x1e')]===undefined?!![]:![]:!![],'where':_0x2f57da[_0x3e51('0x1d')]?_0x2f57da['options']['where']||null:null,'attributes':_0x2f57da[_0x3e51('0x1d')]?_0x2f57da[_0x3e51('0x1d')][_0x3e51('0x20')]||null:null,'include':_0x2f57da[_0x3e51('0x1d')]?_0x2f57da['options'][_0x3e51('0x22')]?_[_0x3e51('0x23')](_0x2f57da[_0x3e51('0x1d')][_0x3e51('0x22')],function(_0x5bc772){return{'model':db[_0x5bc772[_0x3e51('0x24')]],'as':_0x5bc772['as'],'attributes':_0x5bc772['attributes'],'include':_0x5bc772[_0x3e51('0x22')]?_[_0x3e51('0x23')](_0x5bc772[_0x3e51('0x22')],function(_0x4ef28c){return{'model':db[_0x4ef28c[_0x3e51('0x24')]],'as':_0x4ef28c['as'],'attributes':_0x4ef28c['attributes'],'include':_0x4ef28c[_0x3e51('0x22')]?_['map'](_0x4ef28c[_0x3e51('0x22')],function(_0x2606ea){return{'model':db[_0x2606ea[_0x3e51('0x24')]],'as':_0x2606ea['as'],'attributes':_0x2606ea[_0x3e51('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3e51('0x13')](function(_0x233def){logger[_0x3e51('0x14')]('ShowSmsQueue',_0x2f57da);logger[_0x3e51('0x25')](_0x3e51('0x27'),_0x2f57da,JSON[_0x3e51('0x26')](_0x233def));_0x3e36a8(_0x233def);})[_0x3e51('0x1a')](function(_0x1f5005){logger[_0x3e51('0x17')]('ShowSmsQueue',_0x1f5005['message'],_0x2f57da);_0x3e7971(_0x25840a[_0x3e51('0x17')](0x1f4,_0x1f5005[_0x3e51('0x19')]));});});}; \ No newline at end of file +var _0x7cd0=['./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','model','catch','ShowSmsQueue','find','map','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7cd0,0xb7));var _0x07cd=function(_0x14806a,_0x14d122){_0x14806a=_0x14806a-0x0;var _0x12e125=_0x7cd0[_0x14806a];return _0x12e125;};'use strict';var _=require('lodash');var util=require(_0x07cd('0x0'));var moment=require(_0x07cd('0x1'));var BPromise=require(_0x07cd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07cd('0x3'))['db'];var utils=require(_0x07cd('0x4'));var logger=require(_0x07cd('0x5'))('rpc');var config=require(_0x07cd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x07cd('0x7')][_0x07cd('0x8')]({'port':0x232a});config[_0x07cd('0x9')]=_[_0x07cd('0xa')](config[_0x07cd('0x9')],{'host':_0x07cd('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07cd('0x9')]));require(_0x07cd('0xc'))[_0x07cd('0xd')](socket);function respondWithRpcPromise(_0x1d5237,_0x277226,_0x5b84f7){return new BPromise(function(_0x5d5dcf,_0x3f6ca8){return client[_0x07cd('0xe')](_0x1d5237,_0x5b84f7)[_0x07cd('0xf')](function(_0x1d7710){logger[_0x07cd('0x10')]('SmsQueue,\x20%s,\x20%s',_0x277226,_0x07cd('0x11'));logger[_0x07cd('0x12')](_0x07cd('0x13'),_0x277226,_0x07cd('0x11'),JSON[_0x07cd('0x14')](_0x1d7710));if(_0x1d7710[_0x07cd('0x15')]){if(_0x1d7710[_0x07cd('0x15')][_0x07cd('0x16')]===0x1f4){logger[_0x07cd('0x15')](_0x07cd('0x17'),_0x277226,_0x1d7710[_0x07cd('0x15')][_0x07cd('0x18')]);return _0x3f6ca8(_0x1d7710[_0x07cd('0x15')][_0x07cd('0x18')]);}logger[_0x07cd('0x15')]('SmsQueue,\x20%s,\x20%s',_0x277226,_0x1d7710[_0x07cd('0x15')]['message']);return _0x5d5dcf(_0x1d7710[_0x07cd('0x15')][_0x07cd('0x18')]);}else{logger[_0x07cd('0x10')](_0x07cd('0x17'),_0x277226,_0x07cd('0x11'));_0x5d5dcf(_0x1d7710['result'][_0x07cd('0x18')]);}})['catch'](function(_0x142377){logger[_0x07cd('0x15')](_0x07cd('0x17'),_0x277226,_0x142377);_0x3f6ca8(_0x142377);});});}exports[_0x07cd('0x19')]=function(_0x57b100){var _0x5ed649=this;return new Promise(function(_0x37c30e,_0x54d44b){return db[_0x07cd('0x1a')][_0x07cd('0x1b')]({'raw':_0x57b100[_0x07cd('0x1c')]?_0x57b100[_0x07cd('0x1c')][_0x07cd('0x1d')]===undefined?!![]:![]:!![],'where':_0x57b100[_0x07cd('0x1c')]?_0x57b100[_0x07cd('0x1c')][_0x07cd('0x1e')]||null:null,'attributes':_0x57b100[_0x07cd('0x1c')]?_0x57b100[_0x07cd('0x1c')][_0x07cd('0x1f')]||null:null,'limit':_0x57b100['options']?_0x57b100['options'][_0x07cd('0x20')]||null:null,'include':_0x57b100[_0x07cd('0x1c')]?_0x57b100[_0x07cd('0x1c')][_0x07cd('0x21')]?_['map'](_0x57b100[_0x07cd('0x1c')][_0x07cd('0x21')],function(_0x3b4ce5){return{'model':db[_0x3b4ce5['model']],'as':_0x3b4ce5['as'],'attributes':_0x3b4ce5[_0x07cd('0x1f')],'include':_0x3b4ce5[_0x07cd('0x21')]?_['map'](_0x3b4ce5[_0x07cd('0x21')],function(_0x332354){return{'model':db[_0x332354[_0x07cd('0x22')]],'as':_0x332354['as'],'attributes':_0x332354[_0x07cd('0x1f')],'include':_0x332354[_0x07cd('0x21')]?_['map'](_0x332354[_0x07cd('0x21')],function(_0x428b3f){return{'model':db[_0x428b3f['model']],'as':_0x428b3f['as'],'attributes':_0x428b3f[_0x07cd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x07cd('0xf')](function(_0x1b8c20){logger[_0x07cd('0x10')]('GetSmsQueue',_0x57b100);logger[_0x07cd('0x12')]('GetSmsQueue',_0x57b100,JSON[_0x07cd('0x14')](_0x1b8c20));_0x37c30e(_0x1b8c20);})[_0x07cd('0x23')](function(_0x713722){logger[_0x07cd('0x15')](_0x07cd('0x19'),_0x713722['message'],_0x57b100);_0x54d44b(_0x5ed649[_0x07cd('0x15')](0x1f4,_0x713722[_0x07cd('0x18')]));});});};exports[_0x07cd('0x24')]=function(_0x248480){var _0x4a2a5b=this;return new Promise(function(_0x238279,_0x122b82){return db[_0x07cd('0x1a')][_0x07cd('0x25')]({'raw':_0x248480[_0x07cd('0x1c')]?_0x248480[_0x07cd('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x248480[_0x07cd('0x1c')]?_0x248480[_0x07cd('0x1c')]['where']||null:null,'attributes':_0x248480[_0x07cd('0x1c')]?_0x248480['options'][_0x07cd('0x1f')]||null:null,'include':_0x248480[_0x07cd('0x1c')]?_0x248480[_0x07cd('0x1c')][_0x07cd('0x21')]?_[_0x07cd('0x26')](_0x248480[_0x07cd('0x1c')][_0x07cd('0x21')],function(_0x20623e){return{'model':db[_0x20623e[_0x07cd('0x22')]],'as':_0x20623e['as'],'attributes':_0x20623e['attributes'],'include':_0x20623e[_0x07cd('0x21')]?_[_0x07cd('0x26')](_0x20623e[_0x07cd('0x21')],function(_0x570042){return{'model':db[_0x570042[_0x07cd('0x22')]],'as':_0x570042['as'],'attributes':_0x570042['attributes'],'include':_0x570042[_0x07cd('0x21')]?_[_0x07cd('0x26')](_0x570042['include'],function(_0x31c0d6){return{'model':db[_0x31c0d6[_0x07cd('0x22')]],'as':_0x31c0d6['as'],'attributes':_0x31c0d6['attributes']};}):[]};}):[]};}):[]:[]})[_0x07cd('0xf')](function(_0x5dad26){logger[_0x07cd('0x10')](_0x07cd('0x24'),_0x248480);logger['debug'](_0x07cd('0x24'),_0x248480,JSON[_0x07cd('0x14')](_0x5dad26));_0x238279(_0x5dad26);})['catch'](function(_0x4ba296){logger[_0x07cd('0x15')](_0x07cd('0x24'),_0x4ba296['message'],_0x248480);_0x122b82(_0x4a2a5b[_0x07cd('0x15')](0x1f4,_0x4ba296[_0x07cd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 38c5aae..e7d359c 100644 --- a/server/api/smsQueue/smsQueue.socket.js +++ b/server/api/smsQueue/smsQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa83c=['register','smsQueue:','./smsQueue.events','save','update','emit','removeListener'];(function(_0x19b6b5,_0x7c2b61){var _0x4a4352=function(_0x378939){while(--_0x378939){_0x19b6b5['push'](_0x19b6b5['shift']());}};_0x4a4352(++_0x7c2b61);}(_0xa83c,0x16e));var _0xca83=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0xa83c[_0x38aeea];return _0x5e8d2c;};'use strict';var SmsQueueEvents=require(_0xca83('0x0'));var events=[_0xca83('0x1'),'remove',_0xca83('0x2')];function createListener(_0x4f48a8,_0x398bea){return function(_0x1762ba){_0x398bea[_0xca83('0x3')](_0x4f48a8,_0x1762ba);};}function removeListener(_0x4e9033,_0x450676){return function(){SmsQueueEvents[_0xca83('0x4')](_0x4e9033,_0x450676);};}exports[_0xca83('0x5')]=function(_0x5949cf){for(var _0x3f2c52=0x0,_0x40b41a=events['length'];_0x3f2c52<_0x40b41a;_0x3f2c52++){var _0x4c0688=events[_0x3f2c52];var _0x42e3d9=createListener(_0xca83('0x6')+_0x4c0688,_0x5949cf);SmsQueueEvents['on'](_0x4c0688,_0x42e3d9);}}; \ No newline at end of file +var _0x96ab=['emit','removeListener','register','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x11e8d2,_0x386588){var _0x2012db=function(_0x5b5033){while(--_0x5b5033){_0x11e8d2['push'](_0x11e8d2['shift']());}};_0x2012db(++_0x386588);}(_0x96ab,0xec));var _0xb96a=function(_0x2c3ed5,_0x258e87){_0x2c3ed5=_0x2c3ed5-0x0;var _0x4c4067=_0x96ab[_0x2c3ed5];return _0x4c4067;};'use strict';var SmsQueueEvents=require(_0xb96a('0x0'));var events=[_0xb96a('0x1'),_0xb96a('0x2'),_0xb96a('0x3')];function createListener(_0x4582d5,_0x4f4bcf){return function(_0x28f5ee){_0x4f4bcf[_0xb96a('0x4')](_0x4582d5,_0x28f5ee);};}function removeListener(_0x6c381f,_0x1e27ca){return function(){SmsQueueEvents[_0xb96a('0x5')](_0x6c381f,_0x1e27ca);};}exports[_0xb96a('0x6')]=function(_0x25d97a){for(var _0x2776ad=0x0,_0x280880=events['length'];_0x2776ad<_0x280880;_0x2776ad++){var _0x2e69be=events[_0x2776ad];var _0x346b1c=createListener(_0xb96a('0x7')+_0x2e69be,_0x25d97a);SmsQueueEvents['on'](_0x2e69be,_0x346b1c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c4b383f..3033296 100644 --- a/server/api/smsQueueReport/index.js +++ b/server/api/smsQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa166=['put','delete','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','./smsQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x2aa534,_0x32c81a){var _0x3070f0=function(_0x1043d1){while(--_0x1043d1){_0x2aa534['push'](_0x2aa534['shift']());}};_0x3070f0(++_0x32c81a);}(_0xa166,0x1be));var _0x6a16=function(_0x46ecbb,_0x1ca801){_0x46ecbb=_0x46ecbb-0x0;var _0x55eefc=_0xa166[_0x46ecbb];return _0x55eefc;};'use strict';var multer=require(_0x6a16('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a16('0x1'));var router=express[_0x6a16('0x2')]();var fs_extra=require(_0x6a16('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6a16('0x4'));var config=require('../../config/environment');var controller=require(_0x6a16('0x5'));router[_0x6a16('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6a16('0x6')](_0x6a16('0x7'),auth[_0x6a16('0x8')](),controller[_0x6a16('0x9')]);router[_0x6a16('0x6')](_0x6a16('0xa'),auth[_0x6a16('0x8')](),controller['show']);router[_0x6a16('0xb')]('/',auth[_0x6a16('0x8')](),controller[_0x6a16('0xc')]);router[_0x6a16('0xd')](_0x6a16('0xa'),auth[_0x6a16('0x8')](),controller['update']);router[_0x6a16('0xe')](_0x6a16('0xa'),auth[_0x6a16('0x8')](),controller[_0x6a16('0xf')]);module[_0x6a16('0x10')]=router; \ No newline at end of file +var _0x6b24=['/:id','show','post','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0xfff675,_0x3ec3b0){var _0x45477c=function(_0x554bd9){while(--_0x554bd9){_0xfff675['push'](_0xfff675['shift']());}};_0x45477c(++_0x3ec3b0);}(_0x6b24,0xf7));var _0x46b2=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0x6b24[_0x623e7];return _0x121131;};'use strict';var multer=require(_0x46b2('0x0'));var util=require(_0x46b2('0x1'));var path=require(_0x46b2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x46b2('0x3')]();var fs_extra=require(_0x46b2('0x4'));var auth=require(_0x46b2('0x5'));var interaction=require(_0x46b2('0x6'));var config=require(_0x46b2('0x7'));var controller=require('./smsQueueReport.controller');router[_0x46b2('0x8')]('/',auth[_0x46b2('0x9')](),controller[_0x46b2('0xa')]);router[_0x46b2('0x8')](_0x46b2('0xb'),auth['isAuthenticated'](),controller[_0x46b2('0xc')]);router[_0x46b2('0x8')](_0x46b2('0xd'),auth[_0x46b2('0x9')](),controller[_0x46b2('0xe')]);router[_0x46b2('0xf')]('/',auth[_0x46b2('0x9')](),controller['create']);router['put']('/:id',auth[_0x46b2('0x9')](),controller[_0x46b2('0x10')]);router[_0x46b2('0x11')](_0x46b2('0xd'),auth[_0x46b2('0x9')](),controller[_0x46b2('0x12')]);module[_0x46b2('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index cd9c99c..e500229 100644 --- a/server/api/smsQueueReport/smsQueueReport.attributes.js +++ b/server/api/smsQueueReport/smsQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfea8=['exports','STRING','DATE','sequelize'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xfea8,0x9b));var _0x8fea=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0xfea8[_0x211632];return _0x5a1da1;};'use strict';var moment=require('moment');var Sequelize=require(_0x8fea('0x0'));module[_0x8fea('0x1')]={'uniqueid':{'type':Sequelize[_0x8fea('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8fea('0x2')]},'joinAt':{'type':Sequelize[_0x8fea('0x3')]},'leaveAt':{'type':Sequelize[_0x8fea('0x3')]},'acceptAt':{'type':Sequelize[_0x8fea('0x3')]},'exitAt':{'type':Sequelize[_0x8fea('0x3')]},'reason':{'type':Sequelize[_0x8fea('0x2')]}}; \ No newline at end of file +var _0xdbf7=['DATE','moment','sequelize','exports','STRING'];(function(_0x3064a3,_0x20e71a){var _0x4319b6=function(_0x2e5240){while(--_0x2e5240){_0x3064a3['push'](_0x3064a3['shift']());}};_0x4319b6(++_0x20e71a);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x19e71d,_0xf5732d){_0x19e71d=_0x19e71d-0x0;var _0x304813=_0xdbf7[_0x19e71d];return _0x304813;};'use strict';var moment=require(_0x7dbf('0x0'));var Sequelize=require(_0x7dbf('0x1'));module[_0x7dbf('0x2')]={'uniqueid':{'type':Sequelize[_0x7dbf('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7dbf('0x3')]},'joinAt':{'type':Sequelize[_0x7dbf('0x4')]},'leaveAt':{'type':Sequelize[_0x7dbf('0x4')]},'acceptAt':{'type':Sequelize[_0x7dbf('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7dbf('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a4581ba..011a5ef 100644 --- a/server/api/smsQueueReport/smsQueueReport.controller.js +++ b/server/api/smsQueueReport/smsQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd068=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','SmsQueueReport','findAll','rows','params','include','merge','find','catch','create','body','describe','eml-format','rimraf','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x2fd664,_0x18a259){var _0x149b86=function(_0x2b3078){while(--_0x2b3078){_0x2fd664['push'](_0x2fd664['shift']());}};_0x149b86(++_0x18a259);}(_0xd068,0x19d));var _0x8d06=function(_0x1a5b08,_0x1aec74){_0x1a5b08=_0x1a5b08-0x0;var _0x52e6f7=_0xd068[_0x1a5b08];return _0x52e6f7;};'use strict';var emlformat=require(_0x8d06('0x0'));var rimraf=require(_0x8d06('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8d06('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8d06('0x3'));var util=require('util');var path=require(_0x8d06('0x4'));var sox=require('sox');var csv=require(_0x8d06('0x5'));var ejs=require(_0x8d06('0x6'));var fs=require('fs');var fs_extra=require(_0x8d06('0x7'));var _=require(_0x8d06('0x8'));var squel=require(_0x8d06('0x9'));var crypto=require(_0x8d06('0xa'));var jsforce=require(_0x8d06('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8d06('0x5'));var querystring=require('querystring');var Papa=require(_0x8d06('0xc'));var Redis=require(_0x8d06('0xd'));var authService=require(_0x8d06('0xe'));var qs=require(_0x8d06('0xf'));var as=require(_0x8d06('0x10'));var hardwareService=require(_0x8d06('0x11'));var logger=require(_0x8d06('0x12'))(_0x8d06('0x13'));var utils=require(_0x8d06('0x14'));var config=require(_0x8d06('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d06('0x16'))['db'];function respondWithStatusCode(_0x4206ac,_0x1b9766){_0x1b9766=_0x1b9766||0xcc;return function(_0x417067){if(_0x417067){return _0x4206ac[_0x8d06('0x17')](_0x1b9766);}return _0x4206ac[_0x8d06('0x18')](_0x1b9766)['end']();};}function respondWithResult(_0x388e05,_0x5834a3){_0x5834a3=_0x5834a3||0xc8;return function(_0x5c2c7f){if(_0x5c2c7f){return _0x388e05['status'](_0x5834a3)[_0x8d06('0x19')](_0x5c2c7f);}};}function respondWithFilteredResult(_0x2019ea,_0x5c02b8){return function(_0x11c0e2){if(_0x11c0e2){var _0x4a87ee=typeof _0x5c02b8[_0x8d06('0x1a')]===_0x8d06('0x1b')&&typeof _0x5c02b8[_0x8d06('0x1c')]===_0x8d06('0x1b');var _0x4f4442=_0x11c0e2[_0x8d06('0x1d')];var _0x35088d=_0x4a87ee?0x0:_0x5c02b8[_0x8d06('0x1a')];var _0x10e454=_0x4a87ee?_0x11c0e2[_0x8d06('0x1d')]:_0x5c02b8[_0x8d06('0x1a')]+_0x5c02b8['limit'];var _0x110258;if(_0x10e454>=_0x4f4442){_0x10e454=_0x4f4442;_0x110258=0xc8;}else{_0x110258=0xce;}_0x2019ea[_0x8d06('0x18')](_0x110258);return _0x2019ea[_0x8d06('0x1e')](_0x8d06('0x1f'),_0x35088d+'-'+_0x10e454+'/'+_0x4f4442)[_0x8d06('0x19')](_0x11c0e2);}return null;};}function patchUpdates(_0x4f005e){return function(_0x267958){try{jsonpatch['apply'](_0x267958,_0x4f005e,!![]);}catch(_0x2b50ba){return BPromise['reject'](_0x2b50ba);}return _0x267958['save']();};}function saveUpdates(_0x319cd0,_0x4ac647){return function(_0x262d82){if(_0x262d82){return _0x262d82[_0x8d06('0x20')](_0x319cd0)[_0x8d06('0x21')](function(_0x5a50fd){return _0x5a50fd;});}return null;};}function removeEntity(_0x442840,_0x27c838){return function(_0x5ad157){if(_0x5ad157){return _0x5ad157[_0x8d06('0x22')]()[_0x8d06('0x21')](function(){_0x442840[_0x8d06('0x18')](0xcc)[_0x8d06('0x23')]();});}};}function handleEntityNotFound(_0x4cc79b,_0x4460f8){return function(_0x46ab96){if(!_0x46ab96){_0x4cc79b['sendStatus'](0x194);}return _0x46ab96;};}function handleError(_0x33c2be,_0x51dad5){_0x51dad5=_0x51dad5||0x1f4;return function(_0x2d3428){logger[_0x8d06('0x24')](_0x2d3428['stack']);if(_0x2d3428[_0x8d06('0x25')]){delete _0x2d3428[_0x8d06('0x25')];}_0x33c2be[_0x8d06('0x18')](_0x51dad5)[_0x8d06('0x26')](_0x2d3428);};}exports[_0x8d06('0x27')]=function(_0x20bd35,_0x796395){var _0x1c33c9={},_0x33e954={},_0xc598dc={'count':0x0,'rows':[]};var _0x58187f=_[_0x8d06('0x28')](db['SmsQueueReport']['rawAttributes'],function(_0x970fd5){return{'name':_0x970fd5[_0x8d06('0x29')],'type':_0x970fd5[_0x8d06('0x2a')][_0x8d06('0x2b')]};});_0x33e954[_0x8d06('0x2c')]=_[_0x8d06('0x28')](_0x58187f,_0x8d06('0x25'));_0x33e954[_0x8d06('0x2d')]=_[_0x8d06('0x2e')](_0x20bd35[_0x8d06('0x2d')]);_0x33e954[_0x8d06('0x2f')]=_[_0x8d06('0x30')](_0x33e954[_0x8d06('0x2c')],_0x33e954[_0x8d06('0x2d')]);_0x1c33c9[_0x8d06('0x31')]=_[_0x8d06('0x30')](_0x33e954[_0x8d06('0x2c')],qs[_0x8d06('0x32')](_0x20bd35[_0x8d06('0x2d')][_0x8d06('0x32')]));_0x1c33c9[_0x8d06('0x31')]=_0x1c33c9[_0x8d06('0x31')][_0x8d06('0x33')]?_0x1c33c9['attributes']:_0x33e954[_0x8d06('0x2c')];if(!_0x20bd35[_0x8d06('0x2d')][_0x8d06('0x34')]('nolimit')){_0x1c33c9[_0x8d06('0x1c')]=qs[_0x8d06('0x1c')](_0x20bd35[_0x8d06('0x2d')]['limit']);_0x1c33c9[_0x8d06('0x1a')]=qs['offset'](_0x20bd35[_0x8d06('0x2d')][_0x8d06('0x1a')]);}_0x1c33c9['order']=qs[_0x8d06('0x35')](_0x20bd35[_0x8d06('0x2d')]['sort']);_0x1c33c9['where']=qs['filters'](_[_0x8d06('0x36')](_0x20bd35[_0x8d06('0x2d')],_0x33e954[_0x8d06('0x2f')]),_0x58187f);if(_0x20bd35[_0x8d06('0x2d')][_0x8d06('0x37')]){_0x1c33c9[_0x8d06('0x38')]=_['merge'](_0x1c33c9[_0x8d06('0x38')],{'$or':_[_0x8d06('0x28')](_0x58187f,function(_0x144250){if(_0x144250['type']!==_0x8d06('0x39')){var _0xce0fa={};_0xce0fa[_0x144250[_0x8d06('0x25')]]={'$like':'%'+_0x20bd35[_0x8d06('0x2d')][_0x8d06('0x37')]+'%'};return _0xce0fa;}})});}_0x1c33c9=_['merge']({},_0x1c33c9,_0x20bd35[_0x8d06('0x3a')]);var _0x4eea76={'where':_0x1c33c9[_0x8d06('0x38')]};return db['SmsQueueReport'][_0x8d06('0x1d')](_0x4eea76)['then'](function(_0x1ebc2a){_0xc598dc['count']=_0x1ebc2a;if(_0x20bd35[_0x8d06('0x2d')][_0x8d06('0x3b')]){_0x1c33c9['include']=[{'all':!![]}];}return db[_0x8d06('0x3c')][_0x8d06('0x3d')](_0x1c33c9);})[_0x8d06('0x21')](function(_0x3e9b93){_0xc598dc[_0x8d06('0x3e')]=_0x3e9b93;return _0xc598dc;})[_0x8d06('0x21')](respondWithFilteredResult(_0x796395,_0x1c33c9))['catch'](handleError(_0x796395,null));};exports['show']=function(_0x45d2bf,_0x4f91d3){var _0x550c82={'raw':!![],'where':{'id':_0x45d2bf[_0x8d06('0x3f')]['id']}},_0x4be7f4={};_0x4be7f4[_0x8d06('0x2c')]=_[_0x8d06('0x2e')](db['SmsQueueReport']['rawAttributes']);_0x4be7f4['query']=_[_0x8d06('0x2e')](_0x45d2bf[_0x8d06('0x2d')]);_0x4be7f4[_0x8d06('0x2f')]=_[_0x8d06('0x30')](_0x4be7f4['model'],_0x4be7f4[_0x8d06('0x2d')]);_0x550c82[_0x8d06('0x31')]=_[_0x8d06('0x30')](_0x4be7f4[_0x8d06('0x2c')],qs[_0x8d06('0x32')](_0x45d2bf[_0x8d06('0x2d')][_0x8d06('0x32')]));_0x550c82[_0x8d06('0x31')]=_0x550c82[_0x8d06('0x31')]['length']?_0x550c82[_0x8d06('0x31')]:_0x4be7f4[_0x8d06('0x2c')];if(_0x45d2bf[_0x8d06('0x2d')][_0x8d06('0x3b')]){_0x550c82[_0x8d06('0x40')]=[{'all':!![]}];}_0x550c82=_[_0x8d06('0x41')]({},_0x550c82,_0x45d2bf[_0x8d06('0x3a')]);return db[_0x8d06('0x3c')][_0x8d06('0x42')](_0x550c82)[_0x8d06('0x21')](handleEntityNotFound(_0x4f91d3,null))[_0x8d06('0x21')](respondWithResult(_0x4f91d3,null))[_0x8d06('0x43')](handleError(_0x4f91d3,null));};exports[_0x8d06('0x44')]=function(_0x40266d,_0x170d1f){return db['SmsQueueReport'][_0x8d06('0x44')](_0x40266d[_0x8d06('0x45')],{})[_0x8d06('0x21')](respondWithResult(_0x170d1f,0xc9))[_0x8d06('0x43')](handleError(_0x170d1f,null));};exports[_0x8d06('0x20')]=function(_0x3cb544,_0x9b5d0b){if(_0x3cb544[_0x8d06('0x45')]['id']){delete _0x3cb544[_0x8d06('0x45')]['id'];}return db['SmsQueueReport'][_0x8d06('0x42')]({'where':{'id':_0x3cb544[_0x8d06('0x3f')]['id']}})['then'](handleEntityNotFound(_0x9b5d0b,null))[_0x8d06('0x21')](saveUpdates(_0x3cb544[_0x8d06('0x45')],null))[_0x8d06('0x21')](respondWithResult(_0x9b5d0b,null))[_0x8d06('0x43')](handleError(_0x9b5d0b,null));};exports[_0x8d06('0x22')]=function(_0x5246b2,_0x93a004){return db[_0x8d06('0x3c')][_0x8d06('0x42')]({'where':{'id':_0x5246b2[_0x8d06('0x3f')]['id']}})[_0x8d06('0x21')](handleEntityNotFound(_0x93a004,null))[_0x8d06('0x21')](removeEntity(_0x93a004,null))[_0x8d06('0x43')](handleError(_0x93a004,null));};exports[_0x8d06('0x46')]=function(_0x4ea9dc,_0x4067bf){return db[_0x8d06('0x3c')]['describe']()[_0x8d06('0x21')](respondWithResult(_0x4067bf,null))[_0x8d06('0x43')](handleError(_0x4067bf,null));}; \ No newline at end of file +var _0x0e6c=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','SmsQueueReport','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','options','catch','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse'];(function(_0x6da8a9,_0x2f2989){var _0x275eb1=function(_0x2afa34){while(--_0x2afa34){_0x6da8a9['push'](_0x6da8a9['shift']());}};_0x275eb1(++_0x2f2989);}(_0x0e6c,0xc2));var _0xc0e6=function(_0x225c9c,_0xf844d7){_0x225c9c=_0x225c9c-0x0;var _0x1540a5=_0x0e6c[_0x225c9c];return _0x1540a5;};'use strict';var emlformat=require(_0xc0e6('0x0'));var rimraf=require(_0xc0e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0e6('0x2'));var rp=require(_0xc0e6('0x3'));var moment=require(_0xc0e6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc0e6('0x5'));var util=require(_0xc0e6('0x6'));var path=require(_0xc0e6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc0e6('0x8'));var fs=require('fs');var fs_extra=require(_0xc0e6('0x9'));var _=require(_0xc0e6('0xa'));var squel=require(_0xc0e6('0xb'));var crypto=require(_0xc0e6('0xc'));var jsforce=require(_0xc0e6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc0e6('0xe'));var querystring=require('querystring');var Papa=require(_0xc0e6('0xf'));var Redis=require('ioredis');var authService=require(_0xc0e6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc0e6('0x11'));var hardwareService=require(_0xc0e6('0x12'));var logger=require(_0xc0e6('0x13'))(_0xc0e6('0x14'));var utils=require(_0xc0e6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc0e6('0x16'));var db=require(_0xc0e6('0x17'))['db'];function respondWithStatusCode(_0x3ac87d,_0x28aa9e){_0x28aa9e=_0x28aa9e||0xcc;return function(_0x1d1ddd){if(_0x1d1ddd){return _0x3ac87d[_0xc0e6('0x18')](_0x28aa9e);}return _0x3ac87d[_0xc0e6('0x19')](_0x28aa9e)['end']();};}function respondWithResult(_0x526277,_0x49d565){_0x49d565=_0x49d565||0xc8;return function(_0xf9e2e5){if(_0xf9e2e5){return _0x526277['status'](_0x49d565)['json'](_0xf9e2e5);}};}function respondWithFilteredResult(_0x3d474c,_0x33e88e){return function(_0x56c745){if(_0x56c745){var _0xe340ac=typeof _0x33e88e['offset']===_0xc0e6('0x1a')&&typeof _0x33e88e[_0xc0e6('0x1b')]===_0xc0e6('0x1a');var _0x50929e=_0x56c745[_0xc0e6('0x1c')];var _0x25632b=_0xe340ac?0x0:_0x33e88e[_0xc0e6('0x1d')];var _0x215cc4=_0xe340ac?_0x56c745[_0xc0e6('0x1c')]:_0x33e88e[_0xc0e6('0x1d')]+_0x33e88e[_0xc0e6('0x1b')];var _0x23fa8c;if(_0x215cc4>=_0x50929e){_0x215cc4=_0x50929e;_0x23fa8c=0xc8;}else{_0x23fa8c=0xce;}_0x3d474c[_0xc0e6('0x19')](_0x23fa8c);return _0x3d474c[_0xc0e6('0x1e')](_0xc0e6('0x1f'),_0x25632b+'-'+_0x215cc4+'/'+_0x50929e)[_0xc0e6('0x20')](_0x56c745);}return null;};}function patchUpdates(_0x11d62a){return function(_0x329473){try{jsonpatch[_0xc0e6('0x21')](_0x329473,_0x11d62a,!![]);}catch(_0x1be179){return BPromise[_0xc0e6('0x22')](_0x1be179);}return _0x329473[_0xc0e6('0x23')]();};}function saveUpdates(_0x3ecd5c,_0x38bd44){return function(_0x1ab520){if(_0x1ab520){return _0x1ab520[_0xc0e6('0x24')](_0x3ecd5c)[_0xc0e6('0x25')](function(_0x4b57a3){return _0x4b57a3;});}return null;};}function removeEntity(_0x296531,_0x80199e){return function(_0x3339f6){if(_0x3339f6){return _0x3339f6[_0xc0e6('0x26')]()['then'](function(){_0x296531[_0xc0e6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a1cc,_0x2149dc){return function(_0x5d7242){if(!_0x5d7242){_0x54a1cc[_0xc0e6('0x18')](0x194);}return _0x5d7242;};}function handleError(_0x871fa4,_0x4500c3){_0x4500c3=_0x4500c3||0x1f4;return function(_0x1d41a9){logger[_0xc0e6('0x27')](_0x1d41a9['stack']);if(_0x1d41a9[_0xc0e6('0x28')]){delete _0x1d41a9['name'];}_0x871fa4[_0xc0e6('0x19')](_0x4500c3)['send'](_0x1d41a9);};}exports[_0xc0e6('0x29')]=function(_0x496d51,_0x415c73){var _0x2b8fb1={},_0x2a3e2d={},_0x14897f={'count':0x0,'rows':[]};var _0x195817=_[_0xc0e6('0x2a')](db[_0xc0e6('0x2b')]['rawAttributes'],function(_0x21fae2){return{'name':_0x21fae2[_0xc0e6('0x2c')],'type':_0x21fae2[_0xc0e6('0x2d')]['key']};});_0x2a3e2d[_0xc0e6('0x2e')]=_[_0xc0e6('0x2a')](_0x195817,_0xc0e6('0x28'));_0x2a3e2d['query']=_[_0xc0e6('0x2f')](_0x496d51[_0xc0e6('0x30')]);_0x2a3e2d['filters']=_[_0xc0e6('0x31')](_0x2a3e2d[_0xc0e6('0x2e')],_0x2a3e2d[_0xc0e6('0x30')]);_0x2b8fb1[_0xc0e6('0x32')]=_[_0xc0e6('0x31')](_0x2a3e2d['model'],qs[_0xc0e6('0x33')](_0x496d51[_0xc0e6('0x30')][_0xc0e6('0x33')]));_0x2b8fb1['attributes']=_0x2b8fb1[_0xc0e6('0x32')][_0xc0e6('0x34')]?_0x2b8fb1['attributes']:_0x2a3e2d[_0xc0e6('0x2e')];if(!_0x496d51[_0xc0e6('0x30')][_0xc0e6('0x35')](_0xc0e6('0x36'))){_0x2b8fb1['limit']=qs[_0xc0e6('0x1b')](_0x496d51['query'][_0xc0e6('0x1b')]);_0x2b8fb1[_0xc0e6('0x1d')]=qs['offset'](_0x496d51['query']['offset']);}_0x2b8fb1['order']=qs[_0xc0e6('0x37')](_0x496d51['query']['sort']);_0x2b8fb1[_0xc0e6('0x38')]=qs[_0xc0e6('0x39')](_[_0xc0e6('0x3a')](_0x496d51['query'],_0x2a3e2d[_0xc0e6('0x39')]),_0x195817);if(_0x496d51[_0xc0e6('0x30')]['filter']){_0x2b8fb1['where']=_[_0xc0e6('0x3b')](_0x2b8fb1[_0xc0e6('0x38')],{'$or':_[_0xc0e6('0x2a')](_0x195817,function(_0xae0994){if(_0xae0994[_0xc0e6('0x2d')]!=='VIRTUAL'){var _0x2a5e09={};_0x2a5e09[_0xae0994['name']]={'$like':'%'+_0x496d51[_0xc0e6('0x30')][_0xc0e6('0x3c')]+'%'};return _0x2a5e09;}})});}_0x2b8fb1=_[_0xc0e6('0x3b')]({},_0x2b8fb1,_0x496d51[_0xc0e6('0x3d')]);var _0x594b07={'where':_0x2b8fb1[_0xc0e6('0x38')]};return db[_0xc0e6('0x2b')][_0xc0e6('0x1c')](_0x594b07)[_0xc0e6('0x25')](function(_0x1aaadf){_0x14897f[_0xc0e6('0x1c')]=_0x1aaadf;if(_0x496d51['query']['includeAll']){_0x2b8fb1['include']=[{'all':!![]}];}return db[_0xc0e6('0x2b')]['findAll'](_0x2b8fb1);})[_0xc0e6('0x25')](function(_0x33971d){_0x14897f['rows']=_0x33971d;return _0x14897f;})[_0xc0e6('0x25')](respondWithFilteredResult(_0x415c73,_0x2b8fb1))[_0xc0e6('0x3e')](handleError(_0x415c73,null));};exports['show']=function(_0x4aeb00,_0x36a0b3){var _0x514451={'raw':!![],'where':{'id':_0x4aeb00[_0xc0e6('0x3f')]['id']}},_0x1f3dc2={};_0x1f3dc2[_0xc0e6('0x2e')]=_[_0xc0e6('0x2f')](db['SmsQueueReport'][_0xc0e6('0x40')]);_0x1f3dc2[_0xc0e6('0x30')]=_['keys'](_0x4aeb00[_0xc0e6('0x30')]);_0x1f3dc2[_0xc0e6('0x39')]=_['intersection'](_0x1f3dc2[_0xc0e6('0x2e')],_0x1f3dc2['query']);_0x514451[_0xc0e6('0x32')]=_[_0xc0e6('0x31')](_0x1f3dc2[_0xc0e6('0x2e')],qs[_0xc0e6('0x33')](_0x4aeb00[_0xc0e6('0x30')][_0xc0e6('0x33')]));_0x514451[_0xc0e6('0x32')]=_0x514451[_0xc0e6('0x32')][_0xc0e6('0x34')]?_0x514451[_0xc0e6('0x32')]:_0x1f3dc2[_0xc0e6('0x2e')];if(_0x4aeb00[_0xc0e6('0x30')]['includeAll']){_0x514451[_0xc0e6('0x41')]=[{'all':!![]}];}_0x514451=_[_0xc0e6('0x3b')]({},_0x514451,_0x4aeb00[_0xc0e6('0x3d')]);return db['SmsQueueReport'][_0xc0e6('0x42')](_0x514451)[_0xc0e6('0x25')](handleEntityNotFound(_0x36a0b3,null))[_0xc0e6('0x25')](respondWithResult(_0x36a0b3,null))[_0xc0e6('0x3e')](handleError(_0x36a0b3,null));};exports[_0xc0e6('0x43')]=function(_0x524766,_0x5d7829){return db[_0xc0e6('0x2b')][_0xc0e6('0x43')](_0x524766[_0xc0e6('0x44')],{})[_0xc0e6('0x25')](respondWithResult(_0x5d7829,0xc9))[_0xc0e6('0x3e')](handleError(_0x5d7829,null));};exports[_0xc0e6('0x24')]=function(_0x14bdfe,_0x19e4e5){if(_0x14bdfe[_0xc0e6('0x44')]['id']){delete _0x14bdfe[_0xc0e6('0x44')]['id'];}return db[_0xc0e6('0x2b')]['find']({'where':{'id':_0x14bdfe[_0xc0e6('0x3f')]['id']}})[_0xc0e6('0x25')](handleEntityNotFound(_0x19e4e5,null))[_0xc0e6('0x25')](saveUpdates(_0x14bdfe[_0xc0e6('0x44')],null))[_0xc0e6('0x25')](respondWithResult(_0x19e4e5,null))[_0xc0e6('0x3e')](handleError(_0x19e4e5,null));};exports['destroy']=function(_0x34159c,_0x4ee064){return db[_0xc0e6('0x2b')][_0xc0e6('0x42')]({'where':{'id':_0x34159c[_0xc0e6('0x3f')]['id']}})[_0xc0e6('0x25')](handleEntityNotFound(_0x4ee064,null))[_0xc0e6('0x25')](removeEntity(_0x4ee064,null))['catch'](handleError(_0x4ee064,null));};exports[_0xc0e6('0x45')]=function(_0x4f49ef,_0x4e1063){return db['SmsQueueReport']['describe']()[_0xc0e6('0x25')](respondWithResult(_0x4e1063,null))[_0xc0e6('0x3e')](handleError(_0x4e1063,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b521603..0a993d3 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5188a5,_0x16b650){var _0x32a4c0=function(_0x3f7fd0){while(--_0x3f7fd0){_0x5188a5['push'](_0x5188a5['shift']());}};_0x32a4c0(++_0x16b650);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 3b0646d..f8033ed 100644 --- a/server/api/smsQueueReport/smsQueueReport.rpc.js +++ b/server/api/smsQueueReport/smsQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4d2=['CreateSmsQueueReport','stringify','UpdateSmsQueueReport','options','where','attributes','limit','lodash','bluebird','randomstring','rpc','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','SmsQueueReport','create','body','raw'];(function(_0x1b9a9f,_0x482c35){var _0x2552fd=function(_0x48839e){while(--_0x48839e){_0x1b9a9f['push'](_0x1b9a9f['shift']());}};_0x2552fd(++_0x482c35);}(_0xe4d2,0xcb));var _0x2e4d=function(_0x43b99a,_0x327ce5){_0x43b99a=_0x43b99a-0x0;var _0x13085b=_0xe4d2[_0x43b99a];return _0x13085b;};'use strict';var _=require(_0x2e4d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2e4d('0x1'));var rs=require(_0x2e4d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2e4d('0x3'));var config=require('../../config/environment');var jayson=require(_0x2e4d('0x4'));var client=jayson[_0x2e4d('0x5')][_0x2e4d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4897ab,_0x29ff1e,_0x483079){return new BPromise(function(_0x281c3f,_0x1633f6){return client['request'](_0x4897ab,_0x483079)[_0x2e4d('0x7')](function(_0x2218c0){logger[_0x2e4d('0x8')](_0x2e4d('0x9'),_0x29ff1e,_0x2e4d('0xa'));logger[_0x2e4d('0xb')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x29ff1e,_0x2e4d('0xa'),JSON['stringify'](_0x2218c0));if(_0x2218c0[_0x2e4d('0xc')]){if(_0x2218c0['error'][_0x2e4d('0xd')]===0x1f4){logger[_0x2e4d('0xc')](_0x2e4d('0x9'),_0x29ff1e,_0x2218c0[_0x2e4d('0xc')][_0x2e4d('0xe')]);return _0x1633f6(_0x2218c0[_0x2e4d('0xc')][_0x2e4d('0xe')]);}logger[_0x2e4d('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x29ff1e,_0x2218c0['error']['message']);return _0x281c3f(_0x2218c0['error'][_0x2e4d('0xe')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x29ff1e,_0x2e4d('0xa'));_0x281c3f(_0x2218c0[_0x2e4d('0xf')][_0x2e4d('0xe')]);}})[_0x2e4d('0x10')](function(_0x12e633){logger[_0x2e4d('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x29ff1e,_0x12e633);_0x1633f6(_0x12e633);});});}exports['CreateSmsQueueReport']=function(_0x44870d){var _0xfafa2b=this;return new Promise(function(_0x49243f,_0xd12917){return db[_0x2e4d('0x11')][_0x2e4d('0x12')](_0x44870d[_0x2e4d('0x13')],{'raw':_0x44870d['options']?_0x44870d['options'][_0x2e4d('0x14')]===undefined?!![]:![]:!![]})[_0x2e4d('0x7')](function(_0x584918){logger[_0x2e4d('0x8')](_0x2e4d('0x15'),_0x44870d);logger[_0x2e4d('0xb')](_0x2e4d('0x15'),_0x44870d,JSON[_0x2e4d('0x16')](_0x584918));_0x49243f(_0x584918);})[_0x2e4d('0x10')](function(_0x1f784a){logger['error'](_0x2e4d('0x15'),_0x1f784a[_0x2e4d('0xe')],_0x44870d);_0xd12917(_0xfafa2b[_0x2e4d('0xc')](0x1f4,_0x1f784a['message']));});});};exports[_0x2e4d('0x17')]=function(_0x3f4bae){var _0x15a8ac=this;return new Promise(function(_0x348345,_0x44bb6f){return db[_0x2e4d('0x11')]['update'](_0x3f4bae[_0x2e4d('0x13')],{'raw':_0x3f4bae['options']?_0x3f4bae['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4bae['options']?_0x3f4bae[_0x2e4d('0x18')][_0x2e4d('0x19')]||null:null,'attributes':_0x3f4bae[_0x2e4d('0x18')]?_0x3f4bae['options'][_0x2e4d('0x1a')]||null:null,'limit':_0x3f4bae[_0x2e4d('0x18')]?_0x3f4bae['options'][_0x2e4d('0x1b')]||null:null})['then'](function(_0xab59bf){logger[_0x2e4d('0x8')](_0x2e4d('0x17'),_0x3f4bae);logger[_0x2e4d('0xb')](_0x2e4d('0x17'),_0x3f4bae,JSON[_0x2e4d('0x16')](_0xab59bf));_0x348345(_0xab59bf);})['catch'](function(_0x1504b2){logger[_0x2e4d('0xc')](_0x2e4d('0x17'),_0x1504b2[_0x2e4d('0xe')],_0x3f4bae);_0x44bb6f(_0x15a8ac[_0x2e4d('0xc')](0x1f4,_0x1504b2[_0x2e4d('0xe')]));});});}; \ No newline at end of file +var _0x471a=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','create','body','raw','then','debug','UpdateSmsQueueReport','SmsQueueReport','update','options','attributes','limit','lodash','util','moment'];(function(_0x1902a7,_0x2039b1){var _0x213b5c=function(_0x5dc0e8){while(--_0x5dc0e8){_0x1902a7['push'](_0x1902a7['shift']());}};_0x213b5c(++_0x2039b1);}(_0x471a,0x85));var _0xa471=function(_0x57e3a7,_0x54a266){_0x57e3a7=_0x57e3a7-0x0;var _0x5421db=_0x471a[_0x57e3a7];return _0x5421db;};'use strict';var _=require(_0xa471('0x0'));var util=require(_0xa471('0x1'));var moment=require(_0xa471('0x2'));var BPromise=require(_0xa471('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa471('0x4'));var db=require(_0xa471('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa471('0x6'))(_0xa471('0x7'));var config=require(_0xa471('0x8'));var jayson=require(_0xa471('0x9'));var client=jayson[_0xa471('0xa')][_0xa471('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b03d5,_0xf1d256,_0xacd78){return new BPromise(function(_0x253b96,_0x1f09b4){return client[_0xa471('0xc')](_0x4b03d5,_0xacd78)['then'](function(_0x4c423a){logger[_0xa471('0xd')](_0xa471('0xe'),_0xf1d256,_0xa471('0xf'));logger['debug'](_0xa471('0x10'),_0xf1d256,_0xa471('0xf'),JSON[_0xa471('0x11')](_0x4c423a));if(_0x4c423a[_0xa471('0x12')]){if(_0x4c423a[_0xa471('0x12')]['code']===0x1f4){logger[_0xa471('0x12')](_0xa471('0xe'),_0xf1d256,_0x4c423a[_0xa471('0x12')][_0xa471('0x13')]);return _0x1f09b4(_0x4c423a[_0xa471('0x12')][_0xa471('0x13')]);}logger[_0xa471('0x12')](_0xa471('0xe'),_0xf1d256,_0x4c423a[_0xa471('0x12')]['message']);return _0x253b96(_0x4c423a['error'][_0xa471('0x13')]);}else{logger[_0xa471('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0xf1d256,_0xa471('0xf'));_0x253b96(_0x4c423a[_0xa471('0x14')][_0xa471('0x13')]);}})[_0xa471('0x15')](function(_0x1ae6a1){logger[_0xa471('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0xf1d256,_0x1ae6a1);_0x1f09b4(_0x1ae6a1);});});}exports[_0xa471('0x16')]=function(_0xfd55b6){var _0x233931=this;return new Promise(function(_0x2d81ca,_0x2d9f91){return db['SmsQueueReport'][_0xa471('0x17')](_0xfd55b6[_0xa471('0x18')],{'raw':_0xfd55b6['options']?_0xfd55b6['options'][_0xa471('0x19')]===undefined?!![]:![]:!![]})[_0xa471('0x1a')](function(_0x12b7c3){logger[_0xa471('0xd')](_0xa471('0x16'),_0xfd55b6);logger[_0xa471('0x1b')](_0xa471('0x16'),_0xfd55b6,JSON[_0xa471('0x11')](_0x12b7c3));_0x2d81ca(_0x12b7c3);})[_0xa471('0x15')](function(_0x30497f){logger[_0xa471('0x12')](_0xa471('0x16'),_0x30497f[_0xa471('0x13')],_0xfd55b6);_0x2d9f91(_0x233931[_0xa471('0x12')](0x1f4,_0x30497f['message']));});});};exports[_0xa471('0x1c')]=function(_0x1279bf){var _0x1a0951=this;return new Promise(function(_0x38d088,_0x79b164){return db[_0xa471('0x1d')][_0xa471('0x1e')](_0x1279bf['body'],{'raw':_0x1279bf[_0xa471('0x1f')]?_0x1279bf[_0xa471('0x1f')][_0xa471('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1279bf[_0xa471('0x1f')]?_0x1279bf[_0xa471('0x1f')]['where']||null:null,'attributes':_0x1279bf[_0xa471('0x1f')]?_0x1279bf[_0xa471('0x1f')][_0xa471('0x20')]||null:null,'limit':_0x1279bf[_0xa471('0x1f')]?_0x1279bf[_0xa471('0x1f')][_0xa471('0x21')]||null:null})[_0xa471('0x1a')](function(_0x38a706){logger['info'](_0xa471('0x1c'),_0x1279bf);logger['debug']('UpdateSmsQueueReport',_0x1279bf,JSON[_0xa471('0x11')](_0x38a706));_0x38d088(_0x38a706);})[_0xa471('0x15')](function(_0x36f3f7){logger['error'](_0xa471('0x1c'),_0x36f3f7[_0xa471('0x13')],_0x1279bf);_0x79b164(_0x1a0951[_0xa471('0x12')](0x1f4,_0x36f3f7[_0xa471('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 01aef5b..e3acfb3 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x446c=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','describe','get','/:id','post','create','put','update','delete'];(function(_0x328755,_0x5ea177){var _0x4351de=function(_0x46de6e){while(--_0x46de6e){_0x328755['push'](_0x328755['shift']());}};_0x4351de(++_0x5ea177);}(_0x446c,0x156));var _0xc446=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0x446c[_0x3bf925];return _0x2128a1;};'use strict';var multer=require(_0xc446('0x0'));var util=require(_0xc446('0x1'));var path=require(_0xc446('0x2'));var timeout=require(_0xc446('0x3'));var express=require('express');var router=express[_0xc446('0x4')]();var fs_extra=require(_0xc446('0x5'));var auth=require(_0xc446('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc446('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0xc446('0x8')](),controller[_0xc446('0x9')]);router['get']('/describe',auth[_0xc446('0x8')](),controller[_0xc446('0xa')]);router[_0xc446('0xb')](_0xc446('0xc'),auth[_0xc446('0x8')](),controller['show']);router[_0xc446('0xd')]('/',auth[_0xc446('0x8')](),controller[_0xc446('0xe')]);router[_0xc446('0xf')]('/:id',auth[_0xc446('0x8')](),controller[_0xc446('0x10')]);router[_0xc446('0x11')](_0xc446('0xc'),auth[_0xc446('0x8')](),controller[_0xc446('0x12')]);module[_0xc446('0x13')]=router; \ No newline at end of file +var _0xd2bb=['../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2a8381,_0x82ffab){var _0x280465=function(_0x42cf87){while(--_0x42cf87){_0x2a8381['push'](_0x2a8381['shift']());}};_0x280465(++_0x82ffab);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x5d9e8a,_0x11d5a2){_0x5d9e8a=_0x5d9e8a-0x0;var _0x4377d7=_0xd2bb[_0x5d9e8a];return _0x4377d7;};'use strict';var multer=require('multer');var util=require(_0xbd2b('0x0'));var path=require('path');var timeout=require(_0xbd2b('0x1'));var express=require(_0xbd2b('0x2'));var router=express[_0xbd2b('0x3')]();var fs_extra=require(_0xbd2b('0x4'));var auth=require(_0xbd2b('0x5'));var interaction=require(_0xbd2b('0x6'));var config=require('../../config/environment');var controller=require(_0xbd2b('0x7'));router[_0xbd2b('0x8')]('/',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xa')]);router[_0xbd2b('0x8')](_0xbd2b('0xb'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xc')]);router[_0xbd2b('0x8')](_0xbd2b('0xd'),auth['isAuthenticated'](),controller[_0xbd2b('0xe')]);router['post']('/',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xf')]);router['put'](_0xbd2b('0xd'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0x10')]);router[_0xbd2b('0x11')](_0xbd2b('0xd'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0x12')]);module[_0xbd2b('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 9add91f..10c19c8 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x4a8227,_0x27ab19){var _0x403b2c=function(_0x6e793d){while(--_0x6e793d){_0x4a8227['push'](_0x4a8227['shift']());}};_0x403b2c(++_0x27ab19);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x3c6516,_0x35f01b){var _0x1bb36d=function(_0x40de6a){while(--_0x40de6a){_0x3c6516['push'](_0x3c6516['shift']());}};_0x1bb36d(++_0x35f01b);}(_0x34e8,0x12c));var _0x834e=function(_0x2c733c,_0x101e59){_0x2c733c=_0x2c733c-0x0;var _0xe55e0c=_0x34e8[_0x2c733c];return _0xe55e0c;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 1db28c1..a9360cb 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x339b=['pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','catch','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','name','index','SmsTransferReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x339b,0x1c2));var _0xb339=function(_0x252ec2,_0x40c9b3){_0x252ec2=_0x252ec2-0x0;var _0x45b834=_0x339b[_0x252ec2];return _0x45b834;};'use strict';var emlformat=require(_0xb339('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb339('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb339('0x2'));var moment=require(_0xb339('0x3'));var BPromise=require(_0xb339('0x4'));var Mustache=require(_0xb339('0x5'));var util=require(_0xb339('0x6'));var path=require('path');var sox=require(_0xb339('0x7'));var csv=require('to-csv');var ejs=require(_0xb339('0x8'));var fs=require('fs');var fs_extra=require(_0xb339('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb339('0xa'));var deskjs=require(_0xb339('0xb'));var toCsv=require(_0xb339('0xc'));var querystring=require('querystring');var Papa=require(_0xb339('0xd'));var Redis=require(_0xb339('0xe'));var authService=require(_0xb339('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb339('0x10'));var logger=require(_0xb339('0x11'))(_0xb339('0x12'));var utils=require('../../config/utils');var config=require(_0xb339('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb339('0x14'))['db'];function respondWithStatusCode(_0x2568a2,_0x159b3c){_0x159b3c=_0x159b3c||0xcc;return function(_0x59c22b){if(_0x59c22b){return _0x2568a2[_0xb339('0x15')](_0x159b3c);}return _0x2568a2[_0xb339('0x16')](_0x159b3c)[_0xb339('0x17')]();};}function respondWithResult(_0x4fe55b,_0x4f37ee){_0x4f37ee=_0x4f37ee||0xc8;return function(_0x1a10c8){if(_0x1a10c8){return _0x4fe55b[_0xb339('0x16')](_0x4f37ee)[_0xb339('0x18')](_0x1a10c8);}};}function respondWithFilteredResult(_0x298fee,_0x45f831){return function(_0x48fd44){if(_0x48fd44){var _0x32860c=typeof _0x45f831[_0xb339('0x19')]===_0xb339('0x1a')&&typeof _0x45f831['limit']==='undefined';var _0x1b9ff5=_0x48fd44[_0xb339('0x1b')];var _0x36e7f0=_0x32860c?0x0:_0x45f831['offset'];var _0x6120a0=_0x32860c?_0x48fd44[_0xb339('0x1b')]:_0x45f831[_0xb339('0x19')]+_0x45f831['limit'];var _0x50cf4d;if(_0x6120a0>=_0x1b9ff5){_0x6120a0=_0x1b9ff5;_0x50cf4d=0xc8;}else{_0x50cf4d=0xce;}_0x298fee['status'](_0x50cf4d);return _0x298fee['set'](_0xb339('0x1c'),_0x36e7f0+'-'+_0x6120a0+'/'+_0x1b9ff5)[_0xb339('0x18')](_0x48fd44);}return null;};}function patchUpdates(_0x4a81ba){return function(_0x598941){try{jsonpatch[_0xb339('0x1d')](_0x598941,_0x4a81ba,!![]);}catch(_0x3cede7){return BPromise[_0xb339('0x1e')](_0x3cede7);}return _0x598941[_0xb339('0x1f')]();};}function saveUpdates(_0x440ae8,_0xc39a4f){return function(_0x15fb73){if(_0x15fb73){return _0x15fb73[_0xb339('0x20')](_0x440ae8)['then'](function(_0x49537d){return _0x49537d;});}return null;};}function removeEntity(_0x357003,_0x38551d){return function(_0x23fd44){if(_0x23fd44){return _0x23fd44[_0xb339('0x21')]()[_0xb339('0x22')](function(){_0x357003[_0xb339('0x16')](0xcc)[_0xb339('0x17')]();});}};}function handleEntityNotFound(_0xe022dc,_0x35ec2f){return function(_0x1de7d5){if(!_0x1de7d5){_0xe022dc['sendStatus'](0x194);}return _0x1de7d5;};}function handleError(_0x3e78b8,_0x3ec77a){_0x3ec77a=_0x3ec77a||0x1f4;return function(_0x59a0b2){logger[_0xb339('0x23')](_0x59a0b2['stack']);if(_0x59a0b2['name']){delete _0x59a0b2[_0xb339('0x24')];}_0x3e78b8[_0xb339('0x16')](_0x3ec77a)['send'](_0x59a0b2);};}exports[_0xb339('0x25')]=function(_0x1168b8,_0x44f225){var _0x533394={},_0x3e24a5={},_0x29215f={'count':0x0,'rows':[]};var _0x3a3417=_['map'](db[_0xb339('0x26')]['rawAttributes'],function(_0xa24f58){return{'name':_0xa24f58['fieldName'],'type':_0xa24f58[_0xb339('0x27')][_0xb339('0x28')]};});_0x3e24a5[_0xb339('0x29')]=_['map'](_0x3a3417,_0xb339('0x24'));_0x3e24a5[_0xb339('0x2a')]=_[_0xb339('0x2b')](_0x1168b8['query']);_0x3e24a5[_0xb339('0x2c')]=_[_0xb339('0x2d')](_0x3e24a5[_0xb339('0x29')],_0x3e24a5[_0xb339('0x2a')]);_0x533394[_0xb339('0x2e')]=_['intersection'](_0x3e24a5[_0xb339('0x29')],qs[_0xb339('0x2f')](_0x1168b8['query'][_0xb339('0x2f')]));_0x533394[_0xb339('0x2e')]=_0x533394[_0xb339('0x2e')][_0xb339('0x30')]?_0x533394[_0xb339('0x2e')]:_0x3e24a5['model'];if(!_0x1168b8[_0xb339('0x2a')][_0xb339('0x31')]('nolimit')){_0x533394[_0xb339('0x32')]=qs[_0xb339('0x32')](_0x1168b8['query'][_0xb339('0x32')]);_0x533394[_0xb339('0x19')]=qs[_0xb339('0x19')](_0x1168b8[_0xb339('0x2a')][_0xb339('0x19')]);}_0x533394[_0xb339('0x33')]=qs[_0xb339('0x34')](_0x1168b8[_0xb339('0x2a')][_0xb339('0x34')]);_0x533394[_0xb339('0x35')]=qs[_0xb339('0x2c')](_[_0xb339('0x36')](_0x1168b8[_0xb339('0x2a')],_0x3e24a5[_0xb339('0x2c')]),_0x3a3417);if(_0x1168b8[_0xb339('0x2a')]['filter']){_0x533394[_0xb339('0x35')]=_[_0xb339('0x37')](_0x533394[_0xb339('0x35')],{'$or':_[_0xb339('0x38')](_0x3a3417,function(_0x2c4cc0){if(_0x2c4cc0[_0xb339('0x27')]!==_0xb339('0x39')){var _0x3d5309={};_0x3d5309[_0x2c4cc0[_0xb339('0x24')]]={'$like':'%'+_0x1168b8[_0xb339('0x2a')][_0xb339('0x3a')]+'%'};return _0x3d5309;}})});}_0x533394=_[_0xb339('0x37')]({},_0x533394,_0x1168b8[_0xb339('0x3b')]);var _0x3a3157={'where':_0x533394[_0xb339('0x35')]};return db[_0xb339('0x26')][_0xb339('0x1b')](_0x3a3157)[_0xb339('0x22')](function(_0x369305){_0x29215f[_0xb339('0x1b')]=_0x369305;if(_0x1168b8[_0xb339('0x2a')][_0xb339('0x3c')]){_0x533394[_0xb339('0x3d')]=[{'all':!![]}];}return db[_0xb339('0x26')][_0xb339('0x3e')](_0x533394);})[_0xb339('0x22')](function(_0x468846){_0x29215f[_0xb339('0x3f')]=_0x468846;return _0x29215f;})['then'](respondWithFilteredResult(_0x44f225,_0x533394))['catch'](handleError(_0x44f225,null));};exports[_0xb339('0x40')]=function(_0x401c6e,_0x2e9447){var _0xc2f732={'raw':!![],'where':{'id':_0x401c6e[_0xb339('0x41')]['id']}},_0x5399a1={};_0x5399a1[_0xb339('0x29')]=_['keys'](db[_0xb339('0x26')][_0xb339('0x42')]);_0x5399a1[_0xb339('0x2a')]=_[_0xb339('0x2b')](_0x401c6e[_0xb339('0x2a')]);_0x5399a1[_0xb339('0x2c')]=_['intersection'](_0x5399a1['model'],_0x5399a1['query']);_0xc2f732[_0xb339('0x2e')]=_[_0xb339('0x2d')](_0x5399a1[_0xb339('0x29')],qs[_0xb339('0x2f')](_0x401c6e[_0xb339('0x2a')][_0xb339('0x2f')]));_0xc2f732[_0xb339('0x2e')]=_0xc2f732[_0xb339('0x2e')][_0xb339('0x30')]?_0xc2f732[_0xb339('0x2e')]:_0x5399a1[_0xb339('0x29')];if(_0x401c6e[_0xb339('0x2a')][_0xb339('0x3c')]){_0xc2f732[_0xb339('0x3d')]=[{'all':!![]}];}_0xc2f732=_[_0xb339('0x37')]({},_0xc2f732,_0x401c6e[_0xb339('0x3b')]);return db['SmsTransferReport'][_0xb339('0x43')](_0xc2f732)[_0xb339('0x22')](handleEntityNotFound(_0x2e9447,null))[_0xb339('0x22')](respondWithResult(_0x2e9447,null))['catch'](handleError(_0x2e9447,null));};exports[_0xb339('0x44')]=function(_0x31e746,_0x1d4728){return db[_0xb339('0x26')]['create'](_0x31e746['body'],{})[_0xb339('0x22')](respondWithResult(_0x1d4728,0xc9))[_0xb339('0x45')](handleError(_0x1d4728,null));};exports[_0xb339('0x20')]=function(_0xd9c4ce,_0x30206e){if(_0xd9c4ce['body']['id']){delete _0xd9c4ce[_0xb339('0x46')]['id'];}return db[_0xb339('0x26')][_0xb339('0x43')]({'where':{'id':_0xd9c4ce[_0xb339('0x41')]['id']}})[_0xb339('0x22')](handleEntityNotFound(_0x30206e,null))[_0xb339('0x22')](saveUpdates(_0xd9c4ce[_0xb339('0x46')],null))['then'](respondWithResult(_0x30206e,null))[_0xb339('0x45')](handleError(_0x30206e,null));};exports[_0xb339('0x21')]=function(_0x15c774,_0xad14ff){return db[_0xb339('0x26')]['find']({'where':{'id':_0x15c774[_0xb339('0x41')]['id']}})[_0xb339('0x22')](handleEntityNotFound(_0xad14ff,null))[_0xb339('0x22')](removeEntity(_0xad14ff,null))[_0xb339('0x45')](handleError(_0xad14ff,null));};exports['describe']=function(_0x45b988,_0x9bb9ef){return db[_0xb339('0x26')][_0xb339('0x47')]()[_0xb339('0x22')](respondWithResult(_0x9bb9ef,null))[_0xb339('0x45')](handleError(_0x9bb9ef,null));}; \ No newline at end of file +var _0x4637=['rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','params','intersection','length','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','SmsTransferReport'];(function(_0x12f4af,_0x4a2bb9){var _0x4c4d50=function(_0x25a7f7){while(--_0x25a7f7){_0x12f4af['push'](_0x12f4af['shift']());}};_0x4c4d50(++_0x4a2bb9);}(_0x4637,0xb3));var _0x7463=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x4637[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x7463('0x0'));var rimraf=require(_0x7463('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7463('0x2'));var rp=require(_0x7463('0x3'));var moment=require(_0x7463('0x4'));var BPromise=require(_0x7463('0x5'));var Mustache=require(_0x7463('0x6'));var util=require(_0x7463('0x7'));var path=require(_0x7463('0x8'));var sox=require('sox');var csv=require(_0x7463('0x9'));var ejs=require(_0x7463('0xa'));var fs=require('fs');var fs_extra=require(_0x7463('0xb'));var _=require(_0x7463('0xc'));var squel=require('squel');var crypto=require(_0x7463('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7463('0xe'));var toCsv=require(_0x7463('0x9'));var querystring=require(_0x7463('0xf'));var Papa=require('papaparse');var Redis=require(_0x7463('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7463('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7463('0x12'));var logger=require(_0x7463('0x13'))(_0x7463('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7463('0x15'));var db=require(_0x7463('0x16'))['db'];function respondWithStatusCode(_0x39cff1,_0x29c811){_0x29c811=_0x29c811||0xcc;return function(_0x506e0a){if(_0x506e0a){return _0x39cff1[_0x7463('0x17')](_0x29c811);}return _0x39cff1[_0x7463('0x18')](_0x29c811)['end']();};}function respondWithResult(_0x57a901,_0x25284d){_0x25284d=_0x25284d||0xc8;return function(_0x46076a){if(_0x46076a){return _0x57a901[_0x7463('0x18')](_0x25284d)['json'](_0x46076a);}};}function respondWithFilteredResult(_0x5b9b01,_0x2cac45){return function(_0x4878f6){if(_0x4878f6){var _0x49adad=typeof _0x2cac45['offset']===_0x7463('0x19')&&typeof _0x2cac45['limit']===_0x7463('0x19');var _0x1f63d7=_0x4878f6[_0x7463('0x1a')];var _0x149043=_0x49adad?0x0:_0x2cac45[_0x7463('0x1b')];var _0x5b56b6=_0x49adad?_0x4878f6[_0x7463('0x1a')]:_0x2cac45['offset']+_0x2cac45[_0x7463('0x1c')];var _0x560fd6;if(_0x5b56b6>=_0x1f63d7){_0x5b56b6=_0x1f63d7;_0x560fd6=0xc8;}else{_0x560fd6=0xce;}_0x5b9b01[_0x7463('0x18')](_0x560fd6);return _0x5b9b01['set'](_0x7463('0x1d'),_0x149043+'-'+_0x5b56b6+'/'+_0x1f63d7)['json'](_0x4878f6);}return null;};}function patchUpdates(_0x1bfbb5){return function(_0x36cf54){try{jsonpatch[_0x7463('0x1e')](_0x36cf54,_0x1bfbb5,!![]);}catch(_0x30e95c){return BPromise[_0x7463('0x1f')](_0x30e95c);}return _0x36cf54[_0x7463('0x20')]();};}function saveUpdates(_0x4b57d2,_0x3aacbc){return function(_0x1d9a94){if(_0x1d9a94){return _0x1d9a94[_0x7463('0x21')](_0x4b57d2)[_0x7463('0x22')](function(_0x33dc46){return _0x33dc46;});}return null;};}function removeEntity(_0xa1ca56,_0x59bc23){return function(_0x5128f9){if(_0x5128f9){return _0x5128f9[_0x7463('0x23')]()[_0x7463('0x22')](function(){_0xa1ca56[_0x7463('0x18')](0xcc)[_0x7463('0x24')]();});}};}function handleEntityNotFound(_0x62c8d2,_0x2af5be){return function(_0x9aa2e3){if(!_0x9aa2e3){_0x62c8d2[_0x7463('0x17')](0x194);}return _0x9aa2e3;};}function handleError(_0x2c6fdc,_0x2a8f2f){_0x2a8f2f=_0x2a8f2f||0x1f4;return function(_0x2b0338){logger[_0x7463('0x25')](_0x2b0338[_0x7463('0x26')]);if(_0x2b0338['name']){delete _0x2b0338[_0x7463('0x27')];}_0x2c6fdc[_0x7463('0x18')](_0x2a8f2f)['send'](_0x2b0338);};}exports[_0x7463('0x28')]=function(_0x2d2371,_0x46574b){var _0x47bb13={},_0x1e26b9={},_0xf527f4={'count':0x0,'rows':[]};var _0x427d2d=_[_0x7463('0x29')](db[_0x7463('0x2a')][_0x7463('0x2b')],function(_0x299982){return{'name':_0x299982[_0x7463('0x2c')],'type':_0x299982[_0x7463('0x2d')][_0x7463('0x2e')]};});_0x1e26b9[_0x7463('0x2f')]=_[_0x7463('0x29')](_0x427d2d,_0x7463('0x27'));_0x1e26b9[_0x7463('0x30')]=_[_0x7463('0x31')](_0x2d2371[_0x7463('0x30')]);_0x1e26b9[_0x7463('0x32')]=_['intersection'](_0x1e26b9[_0x7463('0x2f')],_0x1e26b9[_0x7463('0x30')]);_0x47bb13[_0x7463('0x33')]=_['intersection'](_0x1e26b9['model'],qs[_0x7463('0x34')](_0x2d2371['query'][_0x7463('0x34')]));_0x47bb13[_0x7463('0x33')]=_0x47bb13[_0x7463('0x33')]['length']?_0x47bb13['attributes']:_0x1e26b9[_0x7463('0x2f')];if(!_0x2d2371['query'][_0x7463('0x35')](_0x7463('0x36'))){_0x47bb13[_0x7463('0x1c')]=qs[_0x7463('0x1c')](_0x2d2371['query'][_0x7463('0x1c')]);_0x47bb13[_0x7463('0x1b')]=qs[_0x7463('0x1b')](_0x2d2371[_0x7463('0x30')][_0x7463('0x1b')]);}_0x47bb13[_0x7463('0x37')]=qs['sort'](_0x2d2371[_0x7463('0x30')][_0x7463('0x38')]);_0x47bb13[_0x7463('0x39')]=qs[_0x7463('0x32')](_[_0x7463('0x3a')](_0x2d2371[_0x7463('0x30')],_0x1e26b9[_0x7463('0x32')]),_0x427d2d);if(_0x2d2371[_0x7463('0x30')]['filter']){_0x47bb13[_0x7463('0x39')]=_[_0x7463('0x3b')](_0x47bb13[_0x7463('0x39')],{'$or':_[_0x7463('0x29')](_0x427d2d,function(_0x2ec4bb){if(_0x2ec4bb[_0x7463('0x2d')]!=='VIRTUAL'){var _0x3b8d4a={};_0x3b8d4a[_0x2ec4bb[_0x7463('0x27')]]={'$like':'%'+_0x2d2371[_0x7463('0x30')][_0x7463('0x3c')]+'%'};return _0x3b8d4a;}})});}_0x47bb13=_['merge']({},_0x47bb13,_0x2d2371[_0x7463('0x3d')]);var _0x4509ae={'where':_0x47bb13[_0x7463('0x39')]};return db[_0x7463('0x2a')][_0x7463('0x1a')](_0x4509ae)[_0x7463('0x22')](function(_0x2412b8){_0xf527f4[_0x7463('0x1a')]=_0x2412b8;if(_0x2d2371[_0x7463('0x30')][_0x7463('0x3e')]){_0x47bb13[_0x7463('0x3f')]=[{'all':!![]}];}return db[_0x7463('0x2a')][_0x7463('0x40')](_0x47bb13);})[_0x7463('0x22')](function(_0x24bd0a){_0xf527f4[_0x7463('0x41')]=_0x24bd0a;return _0xf527f4;})['then'](respondWithFilteredResult(_0x46574b,_0x47bb13))['catch'](handleError(_0x46574b,null));};exports['show']=function(_0x58434e,_0x1858c9){var _0x23352c={'raw':!![],'where':{'id':_0x58434e[_0x7463('0x42')]['id']}},_0x270237={};_0x270237[_0x7463('0x2f')]=_[_0x7463('0x31')](db[_0x7463('0x2a')][_0x7463('0x2b')]);_0x270237[_0x7463('0x30')]=_[_0x7463('0x31')](_0x58434e[_0x7463('0x30')]);_0x270237[_0x7463('0x32')]=_[_0x7463('0x43')](_0x270237[_0x7463('0x2f')],_0x270237[_0x7463('0x30')]);_0x23352c[_0x7463('0x33')]=_[_0x7463('0x43')](_0x270237['model'],qs['fields'](_0x58434e[_0x7463('0x30')][_0x7463('0x34')]));_0x23352c[_0x7463('0x33')]=_0x23352c[_0x7463('0x33')][_0x7463('0x44')]?_0x23352c[_0x7463('0x33')]:_0x270237[_0x7463('0x2f')];if(_0x58434e[_0x7463('0x30')][_0x7463('0x3e')]){_0x23352c[_0x7463('0x3f')]=[{'all':!![]}];}_0x23352c=_['merge']({},_0x23352c,_0x58434e[_0x7463('0x3d')]);return db[_0x7463('0x2a')][_0x7463('0x45')](_0x23352c)[_0x7463('0x22')](handleEntityNotFound(_0x1858c9,null))['then'](respondWithResult(_0x1858c9,null))[_0x7463('0x46')](handleError(_0x1858c9,null));};exports[_0x7463('0x47')]=function(_0xb5bece,_0x277932){return db['SmsTransferReport'][_0x7463('0x47')](_0xb5bece[_0x7463('0x48')],{})[_0x7463('0x22')](respondWithResult(_0x277932,0xc9))['catch'](handleError(_0x277932,null));};exports[_0x7463('0x21')]=function(_0x45ea42,_0x45e699){if(_0x45ea42['body']['id']){delete _0x45ea42[_0x7463('0x48')]['id'];}return db[_0x7463('0x2a')][_0x7463('0x45')]({'where':{'id':_0x45ea42['params']['id']}})['then'](handleEntityNotFound(_0x45e699,null))[_0x7463('0x22')](saveUpdates(_0x45ea42['body'],null))[_0x7463('0x22')](respondWithResult(_0x45e699,null))[_0x7463('0x46')](handleError(_0x45e699,null));};exports['destroy']=function(_0x578b03,_0x1196bc){return db[_0x7463('0x2a')][_0x7463('0x45')]({'where':{'id':_0x578b03[_0x7463('0x42')]['id']}})[_0x7463('0x22')](handleEntityNotFound(_0x1196bc,null))[_0x7463('0x22')](removeEntity(_0x1196bc,null))[_0x7463('0x46')](handleError(_0x1196bc,null));};exports[_0x7463('0x49')]=function(_0x560ffb,_0x32c6ff){return db[_0x7463('0x2a')][_0x7463('0x49')]()[_0x7463('0x22')](respondWithResult(_0x32c6ff,null))['catch'](handleError(_0x32c6ff,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 43a62a7..22aca94 100644 --- a/server/api/smsTransferReport/smsTransferReport.model.js +++ b/server/api/smsTransferReport/smsTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x749e=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3c4d46,_0x46ed6f){var _0x1572d9=function(_0x1d2db1){while(--_0x1d2db1){_0x3c4d46['push'](_0x3c4d46['shift']());}};_0x1572d9(++_0x46ed6f);}(_0x749e,0x171));var _0xe749=function(_0x3f0460,_0x20a57c){_0x3f0460=_0x3f0460-0x0;var _0x2cb9e3=_0x749e[_0x3f0460];return _0x2cb9e3;};'use strict';var _=require(_0xe749('0x0'));var util=require(_0xe749('0x1'));var logger=require(_0xe749('0x2'))(_0xe749('0x3'));var moment=require(_0xe749('0x4'));var BPromise=require('bluebird');var rp=require(_0xe749('0x5'));var fs=require('fs');var path=require(_0xe749('0x6'));var rimraf=require(_0xe749('0x7'));var config=require(_0xe749('0x8'));var attributes=require(_0xe749('0x9'));module[_0xe749('0xa')]=function(_0x17879f,_0x380a33){return _0x17879f[_0xe749('0xb')](_0xe749('0xc'),attributes,{'tableName':_0xe749('0xd'),'paranoid':![],'indexes':[{'name':_0xe749('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x319c=['moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x319c,0x1d9));var _0xc319=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x319c[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xc319('0x0'));var util=require('util');var logger=require(_0xc319('0x1'))(_0xc319('0x2'));var moment=require(_0xc319('0x3'));var BPromise=require('bluebird');var rp=require(_0xc319('0x4'));var fs=require('fs');var path=require(_0xc319('0x5'));var rimraf=require(_0xc319('0x6'));var config=require(_0xc319('0x7'));var attributes=require(_0xc319('0x8'));module[_0xc319('0x9')]=function(_0xd892a7,_0x1c6cc6){return _0xd892a7[_0xc319('0xa')](_0xc319('0xb'),attributes,{'tableName':_0xc319('0xc'),'paranoid':![],'indexes':[{'name':_0xc319('0xd'),'fields':[_0xc319('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 663583f..2abc4f7 100644 --- a/server/api/smsTransferReport/smsTransferReport.rpc.js +++ b/server/api/smsTransferReport/smsTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaced=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1caa1f,_0x2f3aca){var _0x30a8a3=function(_0x318883){while(--_0x318883){_0x1caa1f['push'](_0x1caa1f['shift']());}};_0x30a8a3(++_0x2f3aca);}(_0xaced,0x18c));var _0xdace=function(_0x3a694b,_0x1c690d){_0x3a694b=_0x3a694b-0x0;var _0x3f43ef=_0xaced[_0x3a694b];return _0x3f43ef;};'use strict';var _=require(_0xdace('0x0'));var util=require(_0xdace('0x1'));var moment=require(_0xdace('0x2'));var BPromise=require(_0xdace('0x3'));var rs=require(_0xdace('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdace('0x5'))['db'];var utils=require(_0xdace('0x6'));var logger=require(_0xdace('0x7'))(_0xdace('0x8'));var config=require('../../config/environment');var jayson=require(_0xdace('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x198ca1,_0x27d6f3,_0x3521d8){return new BPromise(function(_0x199697,_0x5d116a){return client['request'](_0x198ca1,_0x3521d8)[_0xdace('0xa')](function(_0x2b7631){logger[_0xdace('0xb')](_0xdace('0xc'),_0x27d6f3,'request\x20sent');logger[_0xdace('0xd')](_0xdace('0xe'),_0x27d6f3,_0xdace('0xf'),JSON[_0xdace('0x10')](_0x2b7631));if(_0x2b7631['error']){if(_0x2b7631[_0xdace('0x11')][_0xdace('0x12')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x27d6f3,_0x2b7631['error'][_0xdace('0x13')]);return _0x5d116a(_0x2b7631['error'][_0xdace('0x13')]);}logger[_0xdace('0x11')](_0xdace('0xc'),_0x27d6f3,_0x2b7631[_0xdace('0x11')][_0xdace('0x13')]);return _0x199697(_0x2b7631[_0xdace('0x11')]['message']);}else{logger[_0xdace('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x27d6f3,_0xdace('0xf'));_0x199697(_0x2b7631[_0xdace('0x14')][_0xdace('0x13')]);}})[_0xdace('0x15')](function(_0x32c93f){logger[_0xdace('0x11')](_0xdace('0xc'),_0x27d6f3,_0x32c93f);_0x5d116a(_0x32c93f);});});} \ No newline at end of file +var _0x8c32=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x199a1e,_0x4eabf2){var _0x50150c=function(_0x5c73d6){while(--_0x5c73d6){_0x199a1e['push'](_0x199a1e['shift']());}};_0x50150c(++_0x4eabf2);}(_0x8c32,0x130));var _0x28c3=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8c32[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x28c3('0x0'));var util=require(_0x28c3('0x1'));var moment=require(_0x28c3('0x2'));var BPromise=require(_0x28c3('0x3'));var rs=require(_0x28c3('0x4'));var fs=require('fs');var Redis=require(_0x28c3('0x5'));var db=require(_0x28c3('0x6'))['db'];var utils=require(_0x28c3('0x7'));var logger=require(_0x28c3('0x8'))(_0x28c3('0x9'));var config=require(_0x28c3('0xa'));var jayson=require(_0x28c3('0xb'));var client=jayson['client'][_0x28c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ed515,_0x2ce6c1,_0x482952){return new BPromise(function(_0xbaee6f,_0x2fb4cb){return client['request'](_0x4ed515,_0x482952)[_0x28c3('0xd')](function(_0x37bda3){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x2ce6c1,'request\x20sent');logger[_0x28c3('0xe')](_0x28c3('0xf'),_0x2ce6c1,'request\x20sent',JSON[_0x28c3('0x10')](_0x37bda3));if(_0x37bda3[_0x28c3('0x11')]){if(_0x37bda3[_0x28c3('0x11')]['code']===0x1f4){logger[_0x28c3('0x11')](_0x28c3('0x12'),_0x2ce6c1,_0x37bda3[_0x28c3('0x11')][_0x28c3('0x13')]);return _0x2fb4cb(_0x37bda3[_0x28c3('0x11')]['message']);}logger[_0x28c3('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x2ce6c1,_0x37bda3[_0x28c3('0x11')]['message']);return _0xbaee6f(_0x37bda3[_0x28c3('0x11')]['message']);}else{logger[_0x28c3('0x14')](_0x28c3('0x12'),_0x2ce6c1,'request\x20sent');_0xbaee6f(_0x37bda3[_0x28c3('0x15')]['message']);}})['catch'](function(_0x58e2b9){logger[_0x28c3('0x11')](_0x28c3('0x12'),_0x2ce6c1,_0x58e2b9);_0x2fb4cb(_0x58e2b9);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3059111..a166c4e 100644 --- a/server/api/sound/index.js +++ b/server/api/sound/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23fc=['format','basename','now','extname','single','file','create','put','update','/:id','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','show','isAuthenticated','download','diskStorage','originalname'];(function(_0x477b29,_0x1b79d3){var _0x3d6b04=function(_0x291a6a){while(--_0x291a6a){_0x477b29['push'](_0x477b29['shift']());}};_0x3d6b04(++_0x1b79d3);}(_0x23fc,0x1df));var _0xc23f=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0x23fc[_0x47c5bf];return _0x11b779;};'use strict';var multer=require(_0xc23f('0x0'));var util=require(_0xc23f('0x1'));var path=require(_0xc23f('0x2'));var timeout=require(_0xc23f('0x3'));var express=require(_0xc23f('0x4'));var router=express[_0xc23f('0x5')]();var fs_extra=require(_0xc23f('0x6'));var auth=require(_0xc23f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc23f('0x8'));var controller=require('./sound.controller');router[_0xc23f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc23f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc23f('0xa')]);router[_0xc23f('0x9')]('/:id/download',auth[_0xc23f('0xb')](),controller[_0xc23f('0xc')]);var upload=multer({'storage':multer[_0xc23f('0xd')]({'destination':function(_0x4107e1,_0x523518,_0x9200cb){_0x9200cb(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x554661,_0x11874b,_0x411bc0){_0x11874b[_0xc23f('0xe')]=_0x11874b['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x411bc0(null,util[_0xc23f('0xf')]('%s-%s%s',path[_0xc23f('0x10')](_0x11874b[_0xc23f('0xe')],path['extname'](_0x11874b['originalname'])),Date[_0xc23f('0x11')](),path[_0xc23f('0x12')](_0x11874b[_0xc23f('0xe')])));}})});router['post']('/',upload[_0xc23f('0x13')](_0xc23f('0x14')),controller[_0xc23f('0x15')]);router[_0xc23f('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xc23f('0x17')]);router['delete'](_0xc23f('0x18'),auth[_0xc23f('0xb')](),controller[_0xc23f('0x19')]);module['exports']=router; \ No newline at end of file +var _0x20dd=['./sound.controller','index','get','/:id','show','isAuthenticated','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x133b43,_0x3d1c28){var _0x54f4c5=function(_0x665dc4){while(--_0x665dc4){_0x133b43['push'](_0x133b43['shift']());}};_0x54f4c5(++_0x3d1c28);}(_0x20dd,0x157));var _0xd20d=function(_0x5873d3,_0x4f6a3f){_0x5873d3=_0x5873d3-0x0;var _0x18aef4=_0x20dd[_0x5873d3];return _0x18aef4;};'use strict';var multer=require(_0xd20d('0x0'));var util=require(_0xd20d('0x1'));var path=require('path');var timeout=require(_0xd20d('0x2'));var express=require(_0xd20d('0x3'));var router=express[_0xd20d('0x4')]();var fs_extra=require(_0xd20d('0x5'));var auth=require(_0xd20d('0x6'));var interaction=require(_0xd20d('0x7'));var config=require(_0xd20d('0x8'));var controller=require(_0xd20d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd20d('0xa')]);router[_0xd20d('0xb')](_0xd20d('0xc'),auth['isAuthenticated'](),controller[_0xd20d('0xd')]);router[_0xd20d('0xb')]('/:id/download',auth[_0xd20d('0xe')](),controller[_0xd20d('0xf')]);var upload=multer({'storage':multer[_0xd20d('0x10')]({'destination':function(_0x2c30a6,_0x21ceb1,_0x228dd4){_0x228dd4(null,path[_0xd20d('0x11')](config[_0xd20d('0x12')],_0xd20d('0x13')));},'filename':function(_0x4cfb3f,_0x584480,_0x33e4cc){_0x584480[_0xd20d('0x14')]=_0x584480[_0xd20d('0x14')][_0xd20d('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33e4cc(null,util[_0xd20d('0x16')]('%s-%s%s',path[_0xd20d('0x17')](_0x584480['originalname'],path[_0xd20d('0x18')](_0x584480[_0xd20d('0x14')])),Date[_0xd20d('0x19')](),path['extname'](_0x584480[_0xd20d('0x14')])));}})});router[_0xd20d('0x1a')]('/',upload[_0xd20d('0x1b')]('file'),controller[_0xd20d('0x1c')]);router[_0xd20d('0x1d')](_0xd20d('0xc'),auth[_0xd20d('0xe')](),controller[_0xd20d('0x1e')]);router['delete'](_0xd20d('0xc'),auth[_0xd20d('0xe')](),controller[_0xd20d('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 6fb07fb..d5cd9fd 100644 --- a/server/api/sound/sound.attributes.js +++ b/server/api/sound/sound.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x460b=['name','FLOAT','INTEGER','BIGINT','sequelize','exports','STRING'];(function(_0x54e855,_0x22ba6e){var _0x38cfea=function(_0x2b6bd4){while(--_0x2b6bd4){_0x54e855['push'](_0x54e855['shift']());}};_0x38cfea(++_0x22ba6e);}(_0x460b,0xe4));var _0xb460=function(_0x1e5725,_0x3f4e13){_0x1e5725=_0x1e5725-0x0;var _0x4b5cf8=_0x460b[_0x1e5725];return _0x4b5cf8;};'use strict';var Sequelize=require(_0xb460('0x0'));module[_0xb460('0x1')]={'name':{'type':Sequelize[_0xb460('0x2')],'unique':_0xb460('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb460('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xb460('0x2')]},'original_format':{'type':Sequelize[_0xb460('0x2')]},'original_duration':{'type':Sequelize[_0xb460('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xb460('0x5')]},'original_bitRate':{'type':Sequelize[_0xb460('0x6')]},'original_sampleRate':{'type':Sequelize[_0xb460('0x5')]},'converted_format':{'type':Sequelize[_0xb460('0x2')]},'converted_duration':{'type':Sequelize[_0xb460('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xb460('0x6')]},'converted_channelCount':{'type':Sequelize[_0xb460('0x5')]},'converted_bitRate':{'type':Sequelize[_0xb460('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xb460('0x5')]}}; \ No newline at end of file +var _0x9ac0=['BIGINT','INTEGER','exports','STRING','FLOAT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9ac0,0x179));var _0x09ac=function(_0x2925f5,_0x34cc05){_0x2925f5=_0x2925f5-0x0;var _0x2ef404=_0x9ac0[_0x2925f5];return _0x2ef404;};'use strict';var Sequelize=require('sequelize');module[_0x09ac('0x0')]={'name':{'type':Sequelize[_0x09ac('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x09ac('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x09ac('0x1')]},'original_duration':{'type':Sequelize[_0x09ac('0x2')]},'original_sampleCount':{'type':Sequelize[_0x09ac('0x3')]},'original_channelCount':{'type':Sequelize[_0x09ac('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x09ac('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x09ac('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x09ac('0x3')]},'converted_channelCount':{'type':Sequelize[_0x09ac('0x4')]},'converted_bitRate':{'type':Sequelize[_0x09ac('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index a863f3a..4ec8546 100644 --- a/server/api/sound/sound.controller.js +++ b/server/api/sound/sound.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8023=['channelCount','original_bitRate','bitRate','sampleRate','dest','duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','pick','description','destroy','original_format','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','then','get','Sounds','UserProfileResource','sendStatus','name','index','map','Sound','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','error','unlinkSync','src','original_duration','original_sampleCount','sampleCount','original_channelCount'];(function(_0x4f4993,_0x2b2197){var _0x25ca39=function(_0x5464e5){while(--_0x5464e5){_0x4f4993['push'](_0x4f4993['shift']());}};_0x25ca39(++_0x2b2197);}(_0x8023,0x102));var _0x3802=function(_0x395b3c,_0x155a6d){_0x395b3c=_0x395b3c-0x0;var _0x2b4bc3=_0x8023[_0x395b3c];return _0x2b4bc3;};'use strict';var emlformat=require(_0x3802('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3802('0x1'));var jsonpatch=require(_0x3802('0x2'));var rp=require('request-promise');var moment=require(_0x3802('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3802('0x4'));var util=require(_0x3802('0x5'));var path=require(_0x3802('0x6'));var sox=require(_0x3802('0x7'));var csv=require(_0x3802('0x8'));var ejs=require(_0x3802('0x9'));var fs=require('fs');var fs_extra=require(_0x3802('0xa'));var _=require(_0x3802('0xb'));var squel=require(_0x3802('0xc'));var crypto=require(_0x3802('0xd'));var jsforce=require(_0x3802('0xe'));var deskjs=require(_0x3802('0xf'));var toCsv=require(_0x3802('0x8'));var querystring=require('querystring');var Papa=require(_0x3802('0x10'));var Redis=require('ioredis');var authService=require(_0x3802('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3802('0x12'));var hardwareService=require(_0x3802('0x13'));var logger=require(_0x3802('0x14'))('api');var utils=require(_0x3802('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3802('0x16'))['db'];function respondWithStatusCode(_0x13ffb5,_0x32a5ed){_0x32a5ed=_0x32a5ed||0xcc;return function(_0x4faaba){if(_0x4faaba){return _0x13ffb5['sendStatus'](_0x32a5ed);}return _0x13ffb5[_0x3802('0x17')](_0x32a5ed)[_0x3802('0x18')]();};}function respondWithResult(_0x413c7b,_0x327580){_0x327580=_0x327580||0xc8;return function(_0x31fbb9){if(_0x31fbb9){return _0x413c7b[_0x3802('0x17')](_0x327580)[_0x3802('0x19')](_0x31fbb9);}};}function respondWithFilteredResult(_0x27f1ad,_0x27a468){return function(_0x28409c){if(_0x28409c){var _0x52a218=typeof _0x27a468[_0x3802('0x1a')]==='undefined'&&typeof _0x27a468[_0x3802('0x1b')]===_0x3802('0x1c');var _0x588c90=_0x28409c[_0x3802('0x1d')];var _0x5eba38=_0x52a218?0x0:_0x27a468[_0x3802('0x1a')];var _0x36cda0=_0x52a218?_0x28409c['count']:_0x27a468[_0x3802('0x1a')]+_0x27a468[_0x3802('0x1b')];var _0x34b894;if(_0x36cda0>=_0x588c90){_0x36cda0=_0x588c90;_0x34b894=0xc8;}else{_0x34b894=0xce;}_0x27f1ad['status'](_0x34b894);return _0x27f1ad[_0x3802('0x1e')](_0x3802('0x1f'),_0x5eba38+'-'+_0x36cda0+'/'+_0x588c90)[_0x3802('0x19')](_0x28409c);}return null;};}function patchUpdates(_0x1976b4){return function(_0x5a11dd){try{jsonpatch[_0x3802('0x20')](_0x5a11dd,_0x1976b4,!![]);}catch(_0x3a2170){return BPromise['reject'](_0x3a2170);}return _0x5a11dd['save']();};}function saveUpdates(_0xe550ad,_0x11f1dc){return function(_0x1a8e58){if(_0x1a8e58){return _0x1a8e58['update'](_0xe550ad)[_0x3802('0x21')](function(_0x3d71d3){return _0x3d71d3;});}return null;};}function removeEntity(_0x1b18b7,_0x9f04db){return function(_0x1e3360){if(_0x1e3360){return _0x1e3360['destroy']()[_0x3802('0x21')](function(){var _0x260f8a=_0x1e3360[_0x3802('0x22')]({'plain':!![]});var _0x14031c=_0x3802('0x23');return db[_0x3802('0x24')]['destroy']({'where':{'type':_0x14031c,'resourceId':_0x260f8a['id']}})[_0x3802('0x21')](function(){return _0x1e3360;});})[_0x3802('0x21')](function(){_0x1b18b7[_0x3802('0x17')](0xcc)[_0x3802('0x18')]();});}};}function handleEntityNotFound(_0x5d6166,_0x18bca3){return function(_0xabc365){if(!_0xabc365){_0x5d6166[_0x3802('0x25')](0x194);}return _0xabc365;};}function handleError(_0x176151,_0x43621b){_0x43621b=_0x43621b||0x1f4;return function(_0x11dcd9){logger['error'](_0x11dcd9['stack']);if(_0x11dcd9[_0x3802('0x26')]){delete _0x11dcd9[_0x3802('0x26')];}_0x176151[_0x3802('0x17')](_0x43621b)['send'](_0x11dcd9);};}exports[_0x3802('0x27')]=function(_0x411389,_0x216310){var _0x1adadb={},_0xa07e89={},_0x556070={'count':0x0,'rows':[]};var _0x2b4a96=_[_0x3802('0x28')](db[_0x3802('0x29')][_0x3802('0x2a')],function(_0x2e8e16){return{'name':_0x2e8e16[_0x3802('0x2b')],'type':_0x2e8e16['type']['key']};});_0xa07e89[_0x3802('0x2c')]=_[_0x3802('0x28')](_0x2b4a96,_0x3802('0x26'));_0xa07e89[_0x3802('0x2d')]=_[_0x3802('0x2e')](_0x411389[_0x3802('0x2d')]);_0xa07e89[_0x3802('0x2f')]=_[_0x3802('0x30')](_0xa07e89[_0x3802('0x2c')],_0xa07e89[_0x3802('0x2d')]);_0x1adadb[_0x3802('0x31')]=_[_0x3802('0x30')](_0xa07e89[_0x3802('0x2c')],qs[_0x3802('0x32')](_0x411389['query'][_0x3802('0x32')]));_0x1adadb[_0x3802('0x31')]=_0x1adadb[_0x3802('0x31')][_0x3802('0x33')]?_0x1adadb['attributes']:_0xa07e89[_0x3802('0x2c')];if(!_0x411389[_0x3802('0x2d')][_0x3802('0x34')](_0x3802('0x35'))){_0x1adadb[_0x3802('0x1b')]=qs[_0x3802('0x1b')](_0x411389['query'][_0x3802('0x1b')]);_0x1adadb[_0x3802('0x1a')]=qs[_0x3802('0x1a')](_0x411389[_0x3802('0x2d')][_0x3802('0x1a')]);}_0x1adadb[_0x3802('0x36')]=qs[_0x3802('0x37')](_0x411389[_0x3802('0x2d')][_0x3802('0x37')]);_0x1adadb[_0x3802('0x38')]=qs[_0x3802('0x2f')](_['pick'](_0x411389[_0x3802('0x2d')],_0xa07e89[_0x3802('0x2f')]),_0x2b4a96);if(_0x411389[_0x3802('0x2d')][_0x3802('0x39')]){_0x1adadb['where']=_['merge'](_0x1adadb[_0x3802('0x38')],{'$or':_['map'](_0x2b4a96,function(_0x459074){if(_0x459074[_0x3802('0x3a')]!==_0x3802('0x3b')){var _0x2e6823={};_0x2e6823[_0x459074[_0x3802('0x26')]]={'$like':'%'+_0x411389[_0x3802('0x2d')][_0x3802('0x39')]+'%'};return _0x2e6823;}})});}_0x1adadb=_[_0x3802('0x3c')]({},_0x1adadb,_0x411389[_0x3802('0x3d')]);var _0x15693e={'where':_0x1adadb[_0x3802('0x38')]};return db[_0x3802('0x29')][_0x3802('0x1d')](_0x15693e)[_0x3802('0x21')](function(_0xd3131c){_0x556070[_0x3802('0x1d')]=_0xd3131c;if(_0x411389[_0x3802('0x2d')][_0x3802('0x3e')]){_0x1adadb[_0x3802('0x3f')]=[{'all':!![]}];}return db[_0x3802('0x29')]['findAll'](_0x1adadb);})[_0x3802('0x21')](function(_0x19d788){_0x556070[_0x3802('0x40')]=_0x19d788;return _0x556070;})[_0x3802('0x21')](respondWithFilteredResult(_0x216310,_0x1adadb))[_0x3802('0x41')](handleError(_0x216310,null));};exports[_0x3802('0x42')]=function(_0x4d1d82,_0xec4aac){var _0x3ff8a3={'raw':!![],'where':{'id':_0x4d1d82[_0x3802('0x43')]['id']}},_0x3b6278={};_0x3b6278[_0x3802('0x2c')]=_['keys'](db[_0x3802('0x29')]['rawAttributes']);_0x3b6278[_0x3802('0x2d')]=_[_0x3802('0x2e')](_0x4d1d82[_0x3802('0x2d')]);_0x3b6278['filters']=_[_0x3802('0x30')](_0x3b6278['model'],_0x3b6278[_0x3802('0x2d')]);_0x3ff8a3[_0x3802('0x31')]=_[_0x3802('0x30')](_0x3b6278['model'],qs[_0x3802('0x32')](_0x4d1d82['query'][_0x3802('0x32')]));_0x3ff8a3['attributes']=_0x3ff8a3[_0x3802('0x31')]['length']?_0x3ff8a3['attributes']:_0x3b6278[_0x3802('0x2c')];if(_0x4d1d82[_0x3802('0x2d')]['includeAll']){_0x3ff8a3[_0x3802('0x3f')]=[{'all':!![]}];}_0x3ff8a3=_['merge']({},_0x3ff8a3,_0x4d1d82['options']);return db[_0x3802('0x29')][_0x3802('0x44')](_0x3ff8a3)[_0x3802('0x21')](handleEntityNotFound(_0xec4aac,null))[_0x3802('0x21')](respondWithResult(_0xec4aac,null))[_0x3802('0x41')](handleError(_0xec4aac,null));};exports[_0x3802('0x45')]=function(_0x5c2c9a,_0x4ef5b2,_0x4766b9){return db['Sound'][_0x3802('0x44')]({'where':{'id':_0x5c2c9a[_0x3802('0x43')]['id']},'attributes':['name',_0x3802('0x46'),_0x3802('0x47')],'raw':!![]})[_0x3802('0x21')](handleEntityNotFound(_0x4ef5b2,null))['then'](function(_0xfce48d){if(_0xfce48d){if(!fs[_0x3802('0x48')](path[_0x3802('0x49')](config[_0x3802('0x4a')],_0x3802('0x4b'),_0xfce48d['save_name']+'.'+_0xfce48d['converted_format']))){throw new db['Sequelize'][(_0x3802('0x4c'))]('Sound\x20not\x20found');}return _0x4ef5b2[_0x3802('0x45')](path[_0x3802('0x49')](config[_0x3802('0x4a')],_0x3802('0x4b'),util[_0x3802('0x4d')](_0x3802('0x4e'),_0xfce48d[_0x3802('0x46')],_0xfce48d[_0x3802('0x47')])),util[_0x3802('0x4d')](_0x3802('0x4e'),_0xfce48d[_0x3802('0x26')],_0xfce48d[_0x3802('0x47')]));}return null;})[_0x3802('0x41')](handleError(_0x4ef5b2,null));};exports[_0x3802('0x4f')]=function(_0x41b301,_0x314b88,_0x3b5faf){var _0x2bcc04={'name':path[_0x3802('0x50')](_0x41b301[_0x3802('0x51')][_0x3802('0x52')],path[_0x3802('0x53')](_0x41b301[_0x3802('0x51')]['originalname'])),'save_name':path['basename'](_0x41b301[_0x3802('0x51')]['filename'],path[_0x3802('0x53')](_0x41b301[_0x3802('0x51')][_0x3802('0x54')])),'original_format':path[_0x3802('0x53')](_0x41b301[_0x3802('0x51')][_0x3802('0x52')])[_0x3802('0x55')](0x1),'converted_format':_0x3802('0x56')};var _0x5e86f5=path['join'](config[_0x3802('0x4a')],_0x3802('0x57'),_0x41b301[_0x3802('0x51')][_0x3802('0x54')]);var _0x410497=path['join'](config[_0x3802('0x4a')],_0x3802('0x4b'),util[_0x3802('0x4d')]('%s.%s',path['basename'](_0x41b301[_0x3802('0x51')][_0x3802('0x54')],path[_0x3802('0x53')](_0x41b301['file'][_0x3802('0x54')])),_0x2bcc04[_0x3802('0x47')]));logger[_0x3802('0x58')](_0x3802('0x59'),_0x5e86f5);logger[_0x3802('0x58')]('Sound\x20upload\x20destination:\x20%s',_0x410497);try{fs[_0x3802('0x5a')](_0x5e86f5,parseInt(_0x3802('0x5b'),0x8));var _0x14a969=sox['transcode'](_0x5e86f5,_0x410497,{'sampleRate':0x1f40,'format':_0x3802('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x14a969['on'](_0x3802('0x5c'),function(_0x3350aa){fs[_0x3802('0x5d')](_0x5e86f5);_0x314b88['status'](0x1f4)['send'](_0x3350aa);});_0x14a969['on'](_0x3802('0x5e'),function(_0x49e9ff){_0x2bcc04[_0x3802('0x5f')]=isNaN(_0x49e9ff['duration'])?null:_0x49e9ff['duration']*0x3e8;_0x2bcc04[_0x3802('0x60')]=isNaN(_0x49e9ff['sampleCount'])?null:_0x49e9ff[_0x3802('0x61')];_0x2bcc04[_0x3802('0x62')]=isNaN(_0x49e9ff[_0x3802('0x63')])?null:_0x49e9ff[_0x3802('0x63')];_0x2bcc04[_0x3802('0x64')]=isNaN(_0x49e9ff[_0x3802('0x65')])?null:_0x49e9ff['bitRate'];_0x2bcc04['original_sampleRate']=isNaN(_0x49e9ff[_0x3802('0x66')])?null:_0x49e9ff[_0x3802('0x66')];});_0x14a969['on'](_0x3802('0x67'),function(_0x346fe4){_0x2bcc04['converted_duration']=isNaN(_0x346fe4[_0x3802('0x68')])?null:_0x346fe4['duration']*0x3e8;_0x2bcc04[_0x3802('0x69')]=isNaN(_0x346fe4[_0x3802('0x61')])?null:_0x346fe4[_0x3802('0x61')];_0x2bcc04[_0x3802('0x6a')]=isNaN(_0x346fe4['channelCount'])?null:_0x346fe4[_0x3802('0x63')];_0x2bcc04[_0x3802('0x6b')]=isNaN(_0x346fe4[_0x3802('0x65')])?null:_0x346fe4[_0x3802('0x65')];_0x2bcc04[_0x3802('0x6c')]=isNaN(_0x346fe4[_0x3802('0x66')])?null:_0x346fe4[_0x3802('0x66')];});_0x14a969['on'](_0x3802('0x18'),function(){fs['chmodSync'](_0x410497,parseInt(_0x3802('0x5b'),0x8));return db[_0x3802('0x29')][_0x3802('0x4f')](_0x2bcc04)[_0x3802('0x21')](function(_0x24371d){var _0x175b4d={'role':_0x41b301[_0x3802('0x6d')][_0x3802('0x6e')],'userProfileId':_0x41b301[_0x3802('0x6d')][_0x3802('0x6f')]};if(!_0x175b4d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175b4d[_0x3802('0x6e')]==='user'){var _0x27a94b=_0x24371d[_0x3802('0x22')]({'plain':!![]});return db['UserProfileSection'][_0x3802('0x44')]({'where':{'name':_0x3802('0x23'),'userProfileId':_0x175b4d['userProfileId']},'raw':!![]})[_0x3802('0x21')](function(_0x397ea3){if(_0x397ea3&&_0x397ea3[_0x3802('0x70')]===0x0){return db[_0x3802('0x24')][_0x3802('0x4f')]({'name':_0x27a94b[_0x3802('0x26')],'resourceId':_0x27a94b['id'],'type':_0x397ea3[_0x3802('0x26')],'sectionId':_0x397ea3['id']},{})[_0x3802('0x21')](function(){return _0x24371d;});}else{return _0x24371d;}})[_0x3802('0x41')](function(_0x5085b5){logger['error'](_0x3802('0x71'),_0x5085b5);throw _0x5085b5;});}return _0x24371d;})[_0x3802('0x21')](respondWithResult(_0x314b88,null))['catch'](handleError(_0x314b88,null));});_0x14a969['start']();}catch(_0x268369){_0x314b88[_0x3802('0x17')](0x1f4)[_0x3802('0x72')](_0x268369);}};exports['update']=function(_0x2bd092,_0x1217c9,_0x539632){return db[_0x3802('0x29')][_0x3802('0x44')]({'where':{'id':_0x2bd092[_0x3802('0x43')]['id']}})[_0x3802('0x21')](handleEntityNotFound(_0x1217c9,null))['then'](saveUpdates(_[_0x3802('0x73')](_0x2bd092[_0x3802('0x6d')],[_0x3802('0x26'),_0x3802('0x74')]),null))[_0x3802('0x21')](respondWithResult(_0x1217c9,null))[_0x3802('0x41')](handleError(_0x1217c9,null));};exports['delete']=function(_0x5a368e,_0x5e3aa3,_0x22f625){return db['Sound'][_0x3802('0x44')]({'where':{'id':_0x5a368e['params']['id']}})[_0x3802('0x21')](function(_0x7747c3){if(_0x7747c3){return _0x7747c3[_0x3802('0x75')]();}})[_0x3802('0x21')](function(_0x58199d){var _0x2afa11=path['join'](config[_0x3802('0x4a')],_0x3802('0x57'),util[_0x3802('0x4d')](_0x3802('0x4e'),_0x58199d[_0x3802('0x46')],_0x58199d[_0x3802('0x76')]));var _0x2a66c9=path[_0x3802('0x49')](config[_0x3802('0x4a')],_0x3802('0x4b'),util[_0x3802('0x4d')](_0x3802('0x4e'),_0x58199d[_0x3802('0x46')],_0x58199d[_0x3802('0x47')]));fs['unlinkSync'](_0x2afa11);fs[_0x3802('0x5d')](_0x2a66c9);return _0x58199d;})[_0x3802('0x21')](function(_0x2bcc5d){if(_0x2bcc5d){return _0x5e3aa3[_0x3802('0x17')](0xcc)[_0x3802('0x18')]();}})[_0x3802('0x21')](handleEntityNotFound(_0x5e3aa3,null))[_0x3802('0x41')](handleError(_0x5e3aa3,null));}; \ No newline at end of file +var _0x3cff=['lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','Sounds','UserProfileResource','error','stack','name','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','fields','find','download','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','save_name','create','basename','originalname','file','filename','extname','wav','server/files/sounds/original','root','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','start','send','update','description','delete','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x12b919,_0x2f43fa){var _0x5e2136=function(_0x4185ed){while(--_0x4185ed){_0x12b919['push'](_0x12b919['shift']());}};_0x5e2136(++_0x2f43fa);}(_0x3cff,0x177));var _0xf3cf=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0x3cff[_0x2867d8];return _0x3b8176;};'use strict';var emlformat=require(_0xf3cf('0x0'));var rimraf=require(_0xf3cf('0x1'));var zipdir=require(_0xf3cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3cf('0x3'));var moment=require(_0xf3cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf3cf('0x5'));var util=require(_0xf3cf('0x6'));var path=require(_0xf3cf('0x7'));var sox=require(_0xf3cf('0x8'));var csv=require(_0xf3cf('0x9'));var ejs=require(_0xf3cf('0xa'));var fs=require('fs');var fs_extra=require(_0xf3cf('0xb'));var _=require(_0xf3cf('0xc'));var squel=require(_0xf3cf('0xd'));var crypto=require(_0xf3cf('0xe'));var jsforce=require(_0xf3cf('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf3cf('0x9'));var querystring=require(_0xf3cf('0x10'));var Papa=require('papaparse');var Redis=require(_0xf3cf('0x11'));var authService=require(_0xf3cf('0x12'));var qs=require(_0xf3cf('0x13'));var as=require(_0xf3cf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3cf('0x15'))(_0xf3cf('0x16'));var utils=require(_0xf3cf('0x17'));var config=require(_0xf3cf('0x18'));var licenseUtil=require(_0xf3cf('0x19'));var db=require(_0xf3cf('0x1a'))['db'];function respondWithStatusCode(_0x3e195a,_0x1aa913){_0x1aa913=_0x1aa913||0xcc;return function(_0x6543a6){if(_0x6543a6){return _0x3e195a[_0xf3cf('0x1b')](_0x1aa913);}return _0x3e195a[_0xf3cf('0x1c')](_0x1aa913)[_0xf3cf('0x1d')]();};}function respondWithResult(_0x459d85,_0x36581c){_0x36581c=_0x36581c||0xc8;return function(_0x1eb72e){if(_0x1eb72e){return _0x459d85['status'](_0x36581c)[_0xf3cf('0x1e')](_0x1eb72e);}};}function respondWithFilteredResult(_0x45292a,_0xb36d3c){return function(_0x57a284){if(_0x57a284){var _0x3ac735=typeof _0xb36d3c[_0xf3cf('0x1f')]===_0xf3cf('0x20')&&typeof _0xb36d3c[_0xf3cf('0x21')]===_0xf3cf('0x20');var _0x3c4b92=_0x57a284[_0xf3cf('0x22')];var _0x3b1390=_0x3ac735?0x0:_0xb36d3c['offset'];var _0x3aa578=_0x3ac735?_0x57a284[_0xf3cf('0x22')]:_0xb36d3c['offset']+_0xb36d3c[_0xf3cf('0x21')];var _0x7f0d2b;if(_0x3aa578>=_0x3c4b92){_0x3aa578=_0x3c4b92;_0x7f0d2b=0xc8;}else{_0x7f0d2b=0xce;}_0x45292a[_0xf3cf('0x1c')](_0x7f0d2b);return _0x45292a[_0xf3cf('0x23')](_0xf3cf('0x24'),_0x3b1390+'-'+_0x3aa578+'/'+_0x3c4b92)['json'](_0x57a284);}return null;};}function patchUpdates(_0x27a235){return function(_0x4a0305){try{jsonpatch[_0xf3cf('0x25')](_0x4a0305,_0x27a235,!![]);}catch(_0x3f915d){return BPromise[_0xf3cf('0x26')](_0x3f915d);}return _0x4a0305[_0xf3cf('0x27')]();};}function saveUpdates(_0x2cd7a8,_0x14659f){return function(_0xad5994){if(_0xad5994){return _0xad5994['update'](_0x2cd7a8)[_0xf3cf('0x28')](function(_0x1ae4e5){return _0x1ae4e5;});}return null;};}function removeEntity(_0x11933a,_0x11d8d9){return function(_0x49a32b){if(_0x49a32b){return _0x49a32b[_0xf3cf('0x29')]()[_0xf3cf('0x28')](function(){var _0x2528d0=_0x49a32b['get']({'plain':!![]});var _0xc3d97d=_0xf3cf('0x2a');return db[_0xf3cf('0x2b')][_0xf3cf('0x29')]({'where':{'type':_0xc3d97d,'resourceId':_0x2528d0['id']}})[_0xf3cf('0x28')](function(){return _0x49a32b;});})[_0xf3cf('0x28')](function(){_0x11933a[_0xf3cf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5722a3,_0x6b2e7b){return function(_0x4b1f8c){if(!_0x4b1f8c){_0x5722a3[_0xf3cf('0x1b')](0x194);}return _0x4b1f8c;};}function handleError(_0x308c33,_0x41af52){_0x41af52=_0x41af52||0x1f4;return function(_0x294237){logger[_0xf3cf('0x2c')](_0x294237[_0xf3cf('0x2d')]);if(_0x294237['name']){delete _0x294237[_0xf3cf('0x2e')];}_0x308c33[_0xf3cf('0x1c')](_0x41af52)['send'](_0x294237);};}exports[_0xf3cf('0x2f')]=function(_0x2ca3ca,_0x2c4ef9){var _0x3a10a0={},_0x13370b={},_0x3a711c={'count':0x0,'rows':[]};var _0x5e4d95=_[_0xf3cf('0x30')](db[_0xf3cf('0x31')][_0xf3cf('0x32')],function(_0xc48df8){return{'name':_0xc48df8[_0xf3cf('0x33')],'type':_0xc48df8[_0xf3cf('0x34')][_0xf3cf('0x35')]};});_0x13370b[_0xf3cf('0x36')]=_[_0xf3cf('0x30')](_0x5e4d95,'name');_0x13370b[_0xf3cf('0x37')]=_[_0xf3cf('0x38')](_0x2ca3ca[_0xf3cf('0x37')]);_0x13370b['filters']=_[_0xf3cf('0x39')](_0x13370b[_0xf3cf('0x36')],_0x13370b[_0xf3cf('0x37')]);_0x3a10a0['attributes']=_[_0xf3cf('0x39')](_0x13370b[_0xf3cf('0x36')],qs['fields'](_0x2ca3ca[_0xf3cf('0x37')]['fields']));_0x3a10a0[_0xf3cf('0x3a')]=_0x3a10a0[_0xf3cf('0x3a')][_0xf3cf('0x3b')]?_0x3a10a0[_0xf3cf('0x3a')]:_0x13370b[_0xf3cf('0x36')];if(!_0x2ca3ca['query'][_0xf3cf('0x3c')](_0xf3cf('0x3d'))){_0x3a10a0['limit']=qs[_0xf3cf('0x21')](_0x2ca3ca[_0xf3cf('0x37')]['limit']);_0x3a10a0[_0xf3cf('0x1f')]=qs[_0xf3cf('0x1f')](_0x2ca3ca[_0xf3cf('0x37')][_0xf3cf('0x1f')]);}_0x3a10a0[_0xf3cf('0x3e')]=qs['sort'](_0x2ca3ca[_0xf3cf('0x37')][_0xf3cf('0x3f')]);_0x3a10a0[_0xf3cf('0x40')]=qs[_0xf3cf('0x41')](_[_0xf3cf('0x42')](_0x2ca3ca[_0xf3cf('0x37')],_0x13370b[_0xf3cf('0x41')]),_0x5e4d95);if(_0x2ca3ca[_0xf3cf('0x37')][_0xf3cf('0x43')]){_0x3a10a0[_0xf3cf('0x40')]=_[_0xf3cf('0x44')](_0x3a10a0['where'],{'$or':_[_0xf3cf('0x30')](_0x5e4d95,function(_0x78766f){if(_0x78766f[_0xf3cf('0x34')]!==_0xf3cf('0x45')){var _0x4cf855={};_0x4cf855[_0x78766f[_0xf3cf('0x2e')]]={'$like':'%'+_0x2ca3ca['query']['filter']+'%'};return _0x4cf855;}})});}_0x3a10a0=_[_0xf3cf('0x44')]({},_0x3a10a0,_0x2ca3ca[_0xf3cf('0x46')]);var _0x37fced={'where':_0x3a10a0[_0xf3cf('0x40')]};return db[_0xf3cf('0x31')]['count'](_0x37fced)[_0xf3cf('0x28')](function(_0xd447ab){_0x3a711c[_0xf3cf('0x22')]=_0xd447ab;if(_0x2ca3ca[_0xf3cf('0x37')]['includeAll']){_0x3a10a0[_0xf3cf('0x47')]=[{'all':!![]}];}return db[_0xf3cf('0x31')][_0xf3cf('0x48')](_0x3a10a0);})[_0xf3cf('0x28')](function(_0x361f97){_0x3a711c['rows']=_0x361f97;return _0x3a711c;})[_0xf3cf('0x28')](respondWithFilteredResult(_0x2c4ef9,_0x3a10a0))[_0xf3cf('0x49')](handleError(_0x2c4ef9,null));};exports['show']=function(_0x344a9f,_0x26404c){var _0x1d4a5e={'raw':!![],'where':{'id':_0x344a9f[_0xf3cf('0x4a')]['id']}},_0x271d09={};_0x271d09[_0xf3cf('0x36')]=_[_0xf3cf('0x38')](db[_0xf3cf('0x31')][_0xf3cf('0x32')]);_0x271d09[_0xf3cf('0x37')]=_[_0xf3cf('0x38')](_0x344a9f['query']);_0x271d09[_0xf3cf('0x41')]=_[_0xf3cf('0x39')](_0x271d09['model'],_0x271d09[_0xf3cf('0x37')]);_0x1d4a5e['attributes']=_[_0xf3cf('0x39')](_0x271d09['model'],qs[_0xf3cf('0x4b')](_0x344a9f[_0xf3cf('0x37')][_0xf3cf('0x4b')]));_0x1d4a5e[_0xf3cf('0x3a')]=_0x1d4a5e[_0xf3cf('0x3a')][_0xf3cf('0x3b')]?_0x1d4a5e[_0xf3cf('0x3a')]:_0x271d09[_0xf3cf('0x36')];if(_0x344a9f[_0xf3cf('0x37')]['includeAll']){_0x1d4a5e[_0xf3cf('0x47')]=[{'all':!![]}];}_0x1d4a5e=_[_0xf3cf('0x44')]({},_0x1d4a5e,_0x344a9f['options']);return db[_0xf3cf('0x31')][_0xf3cf('0x4c')](_0x1d4a5e)[_0xf3cf('0x28')](handleEntityNotFound(_0x26404c,null))[_0xf3cf('0x28')](respondWithResult(_0x26404c,null))[_0xf3cf('0x49')](handleError(_0x26404c,null));};exports[_0xf3cf('0x4d')]=function(_0x353255,_0xfe661e,_0x4d5d84){return db['Sound']['find']({'where':{'id':_0x353255[_0xf3cf('0x4a')]['id']},'attributes':[_0xf3cf('0x2e'),'save_name',_0xf3cf('0x4e')],'raw':!![]})[_0xf3cf('0x28')](handleEntityNotFound(_0xfe661e,null))[_0xf3cf('0x28')](function(_0x16d57d){if(_0x16d57d){if(!fs[_0xf3cf('0x4f')](path[_0xf3cf('0x50')](config['root'],_0xf3cf('0x51'),_0x16d57d['save_name']+'.'+_0x16d57d[_0xf3cf('0x4e')]))){throw new db[(_0xf3cf('0x52'))][(_0xf3cf('0x53'))]('Sound\x20not\x20found');}return _0xfe661e[_0xf3cf('0x4d')](path['join'](config['root'],_0xf3cf('0x51'),util[_0xf3cf('0x54')](_0xf3cf('0x55'),_0x16d57d[_0xf3cf('0x56')],_0x16d57d[_0xf3cf('0x4e')])),util['format'](_0xf3cf('0x55'),_0x16d57d[_0xf3cf('0x2e')],_0x16d57d['converted_format']));}return null;})[_0xf3cf('0x49')](handleError(_0xfe661e,null));};exports[_0xf3cf('0x57')]=function(_0x51bae7,_0x52743f,_0x1f32e3){var _0x1e5e9e={'name':path[_0xf3cf('0x58')](_0x51bae7['file'][_0xf3cf('0x59')],path['extname'](_0x51bae7[_0xf3cf('0x5a')][_0xf3cf('0x59')])),'save_name':path[_0xf3cf('0x58')](_0x51bae7['file'][_0xf3cf('0x5b')],path[_0xf3cf('0x5c')](_0x51bae7[_0xf3cf('0x5a')][_0xf3cf('0x5b')])),'original_format':path[_0xf3cf('0x5c')](_0x51bae7[_0xf3cf('0x5a')][_0xf3cf('0x59')])['substring'](0x1),'converted_format':_0xf3cf('0x5d')};var _0x9075c3=path['join'](config['root'],_0xf3cf('0x5e'),_0x51bae7[_0xf3cf('0x5a')]['filename']);var _0x4b484c=path[_0xf3cf('0x50')](config[_0xf3cf('0x5f')],_0xf3cf('0x51'),util[_0xf3cf('0x54')](_0xf3cf('0x55'),path[_0xf3cf('0x58')](_0x51bae7[_0xf3cf('0x5a')]['filename'],path[_0xf3cf('0x5c')](_0x51bae7[_0xf3cf('0x5a')]['filename'])),_0x1e5e9e['converted_format']));logger['info'](_0xf3cf('0x60'),_0x9075c3);logger[_0xf3cf('0x61')](_0xf3cf('0x62'),_0x4b484c);try{fs[_0xf3cf('0x63')](_0x9075c3,parseInt(_0xf3cf('0x64'),0x8));var _0x2d7ffe=sox[_0xf3cf('0x65')](_0x9075c3,_0x4b484c,{'sampleRate':0x1f40,'format':_0xf3cf('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2d7ffe['on']('error',function(_0xa2b262){fs[_0xf3cf('0x66')](_0x9075c3);_0x52743f[_0xf3cf('0x1c')](0x1f4)['send'](_0xa2b262);});_0x2d7ffe['on'](_0xf3cf('0x67'),function(_0x7fdf1e){_0x1e5e9e[_0xf3cf('0x68')]=isNaN(_0x7fdf1e[_0xf3cf('0x69')])?null:_0x7fdf1e[_0xf3cf('0x69')]*0x3e8;_0x1e5e9e[_0xf3cf('0x6a')]=isNaN(_0x7fdf1e[_0xf3cf('0x6b')])?null:_0x7fdf1e[_0xf3cf('0x6b')];_0x1e5e9e[_0xf3cf('0x6c')]=isNaN(_0x7fdf1e['channelCount'])?null:_0x7fdf1e[_0xf3cf('0x6d')];_0x1e5e9e[_0xf3cf('0x6e')]=isNaN(_0x7fdf1e[_0xf3cf('0x6f')])?null:_0x7fdf1e[_0xf3cf('0x6f')];_0x1e5e9e['original_sampleRate']=isNaN(_0x7fdf1e[_0xf3cf('0x70')])?null:_0x7fdf1e['sampleRate'];});_0x2d7ffe['on'](_0xf3cf('0x71'),function(_0xa40f97){_0x1e5e9e[_0xf3cf('0x72')]=isNaN(_0xa40f97[_0xf3cf('0x69')])?null:_0xa40f97[_0xf3cf('0x69')]*0x3e8;_0x1e5e9e[_0xf3cf('0x73')]=isNaN(_0xa40f97[_0xf3cf('0x6b')])?null:_0xa40f97['sampleCount'];_0x1e5e9e['converted_channelCount']=isNaN(_0xa40f97[_0xf3cf('0x6d')])?null:_0xa40f97[_0xf3cf('0x6d')];_0x1e5e9e[_0xf3cf('0x74')]=isNaN(_0xa40f97['bitRate'])?null:_0xa40f97[_0xf3cf('0x6f')];_0x1e5e9e['converted_sampleRate']=isNaN(_0xa40f97[_0xf3cf('0x70')])?null:_0xa40f97[_0xf3cf('0x70')];});_0x2d7ffe['on'](_0xf3cf('0x1d'),function(){fs[_0xf3cf('0x63')](_0x4b484c,parseInt(_0xf3cf('0x64'),0x8));return db[_0xf3cf('0x31')][_0xf3cf('0x57')](_0x1e5e9e)[_0xf3cf('0x28')](function(_0x3943f8){var _0x47d599={'role':_0x51bae7[_0xf3cf('0x75')]['role'],'userProfileId':_0x51bae7['body']['userProfileId']};if(!_0x47d599)throw new Error(_0xf3cf('0x76'));if(_0x47d599['role']===_0xf3cf('0x77')){var _0x5dbacc=_0x3943f8[_0xf3cf('0x78')]({'plain':!![]});return db[_0xf3cf('0x79')][_0xf3cf('0x4c')]({'where':{'name':'Sounds','userProfileId':_0x47d599[_0xf3cf('0x7a')]},'raw':!![]})[_0xf3cf('0x28')](function(_0x801bfb){if(_0x801bfb&&_0x801bfb[_0xf3cf('0x7b')]===0x0){return db[_0xf3cf('0x2b')][_0xf3cf('0x57')]({'name':_0x5dbacc[_0xf3cf('0x2e')],'resourceId':_0x5dbacc['id'],'type':_0x801bfb[_0xf3cf('0x2e')],'sectionId':_0x801bfb['id']},{})[_0xf3cf('0x28')](function(){return _0x3943f8;});}else{return _0x3943f8;}})['catch'](function(_0x334ed6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x334ed6);throw _0x334ed6;});}return _0x3943f8;})[_0xf3cf('0x28')](respondWithResult(_0x52743f,null))[_0xf3cf('0x49')](handleError(_0x52743f,null));});_0x2d7ffe[_0xf3cf('0x7c')]();}catch(_0x25bf33){_0x52743f['status'](0x1f4)[_0xf3cf('0x7d')](_0x25bf33);}};exports[_0xf3cf('0x7e')]=function(_0x2a4307,_0x511b79,_0xa78a65){return db[_0xf3cf('0x31')]['find']({'where':{'id':_0x2a4307[_0xf3cf('0x4a')]['id']}})[_0xf3cf('0x28')](handleEntityNotFound(_0x511b79,null))['then'](saveUpdates(_['pick'](_0x2a4307[_0xf3cf('0x75')],[_0xf3cf('0x2e'),_0xf3cf('0x7f')]),null))[_0xf3cf('0x28')](respondWithResult(_0x511b79,null))[_0xf3cf('0x49')](handleError(_0x511b79,null));};exports[_0xf3cf('0x80')]=function(_0x3d6958,_0x20c145,_0x323f16){return db['Sound'][_0xf3cf('0x4c')]({'where':{'id':_0x3d6958['params']['id']}})[_0xf3cf('0x28')](function(_0x2ac2bc){if(_0x2ac2bc){return _0x2ac2bc[_0xf3cf('0x29')]();}})[_0xf3cf('0x28')](function(_0x44b596){var _0x379e3f=path[_0xf3cf('0x50')](config[_0xf3cf('0x5f')],_0xf3cf('0x5e'),util[_0xf3cf('0x54')](_0xf3cf('0x55'),_0x44b596[_0xf3cf('0x56')],_0x44b596['original_format']));var _0x52eadf=path[_0xf3cf('0x50')](config[_0xf3cf('0x5f')],_0xf3cf('0x51'),util[_0xf3cf('0x54')](_0xf3cf('0x55'),_0x44b596[_0xf3cf('0x56')],_0x44b596[_0xf3cf('0x4e')]));fs[_0xf3cf('0x66')](_0x379e3f);fs[_0xf3cf('0x66')](_0x52eadf);return _0x44b596;})[_0xf3cf('0x28')](function(_0x3bfd6c){if(_0x3bfd6c){return _0x20c145[_0xf3cf('0x1c')](0xcc)[_0xf3cf('0x1d')]();}})[_0xf3cf('0x28')](handleEntityNotFound(_0x20c145,null))['catch'](handleError(_0x20c145,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 810118d..a9be54a 100644 --- a/server/api/sound/sound.model.js +++ b/server/api/sound/sound.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11ad=['bluebird','../../config/environment','./sound.attributes','exports','util','../../config/logger','api','moment'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x11ad,0xbc));var _0xd11a=function(_0x4ce827,_0x2e8edb){_0x4ce827=_0x4ce827-0x0;var _0x581401=_0x11ad[_0x4ce827];return _0x581401;};'use strict';var _=require('lodash');var util=require(_0xd11a('0x0'));var logger=require(_0xd11a('0x1'))(_0xd11a('0x2'));var moment=require(_0xd11a('0x3'));var BPromise=require(_0xd11a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd11a('0x5'));var attributes=require(_0xd11a('0x6'));module[_0xd11a('0x7')]=function(_0x3814d9,_0x2e9064){return _0x3814d9['define']('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7189=['rimraf','../../config/environment','./sound.attributes','exports','tools_sounds','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2a60fc,_0x2b1cf4){var _0x4dd1a6=function(_0x1fbab6){while(--_0x1fbab6){_0x2a60fc['push'](_0x2a60fc['shift']());}};_0x4dd1a6(++_0x2b1cf4);}(_0x7189,0x19c));var _0x9718=function(_0x58e29f,_0x475e63){_0x58e29f=_0x58e29f-0x0;var _0x32a7ab=_0x7189[_0x58e29f];return _0x32a7ab;};'use strict';var _=require(_0x9718('0x0'));var util=require(_0x9718('0x1'));var logger=require(_0x9718('0x2'))(_0x9718('0x3'));var moment=require(_0x9718('0x4'));var BPromise=require('bluebird');var rp=require(_0x9718('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9718('0x6'));var config=require(_0x9718('0x7'));var attributes=require(_0x9718('0x8'));module[_0x9718('0x9')]=function(_0x3b4923,_0x178e6a){return _0x3b4923['define']('Sound',attributes,{'tableName':_0x9718('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index da5d8c5..d386520 100644 --- a/server/api/sound/sound.rpc.js +++ b/server/api/sound/sound.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54f3=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','Sound,\x20%s,\x20%s','message','Sound','options','raw','where','attributes','include','map','model','ShowSound','stringify','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0xf7e04a,_0x32409a){var _0x3166fb=function(_0x3d60a9){while(--_0x3d60a9){_0xf7e04a['push'](_0xf7e04a['shift']());}};_0x3166fb(++_0x32409a);}(_0x54f3,0x145));var _0x354f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x54f3[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x354f('0x0'));var util=require('util');var moment=require(_0x354f('0x1'));var BPromise=require(_0x354f('0x2'));var rs=require(_0x354f('0x3'));var fs=require('fs');var Redis=require(_0x354f('0x4'));var db=require(_0x354f('0x5'))['db'];var utils=require(_0x354f('0x6'));var logger=require(_0x354f('0x7'))('rpc');var config=require(_0x354f('0x8'));var jayson=require(_0x354f('0x9'));var client=jayson[_0x354f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x117234,_0x2a66e4,_0x466513){return new BPromise(function(_0x18abee,_0x34ee56){return client['request'](_0x117234,_0x466513)[_0x354f('0xb')](function(_0x5b3ae4){logger[_0x354f('0xc')]('Sound,\x20%s,\x20%s',_0x2a66e4,_0x354f('0xd'));logger[_0x354f('0xe')](_0x354f('0xf'),_0x2a66e4,_0x354f('0xd'),JSON['stringify'](_0x5b3ae4));if(_0x5b3ae4['error']){if(_0x5b3ae4[_0x354f('0x10')]['code']===0x1f4){logger[_0x354f('0x10')](_0x354f('0x11'),_0x2a66e4,_0x5b3ae4[_0x354f('0x10')][_0x354f('0x12')]);return _0x34ee56(_0x5b3ae4[_0x354f('0x10')][_0x354f('0x12')]);}logger[_0x354f('0x10')](_0x354f('0x11'),_0x2a66e4,_0x5b3ae4[_0x354f('0x10')][_0x354f('0x12')]);return _0x18abee(_0x5b3ae4[_0x354f('0x10')][_0x354f('0x12')]);}else{logger[_0x354f('0xc')](_0x354f('0x11'),_0x2a66e4,_0x354f('0xd'));_0x18abee(_0x5b3ae4['result']['message']);}})['catch'](function(_0x33299d){logger[_0x354f('0x10')](_0x354f('0x11'),_0x2a66e4,_0x33299d);_0x34ee56(_0x33299d);});});}exports['ShowSound']=function(_0x56b1b5){var _0x488afc=this;return new Promise(function(_0x5737e4,_0x4bbd44){return db[_0x354f('0x13')]['find']({'raw':_0x56b1b5[_0x354f('0x14')]?_0x56b1b5[_0x354f('0x14')][_0x354f('0x15')]===undefined?!![]:![]:!![],'where':_0x56b1b5[_0x354f('0x14')]?_0x56b1b5['options'][_0x354f('0x16')]||null:null,'attributes':_0x56b1b5[_0x354f('0x14')]?_0x56b1b5[_0x354f('0x14')][_0x354f('0x17')]||null:null,'include':_0x56b1b5['options']?_0x56b1b5[_0x354f('0x14')][_0x354f('0x18')]?_[_0x354f('0x19')](_0x56b1b5[_0x354f('0x14')]['include'],function(_0x4774b1){return{'model':db[_0x4774b1['model']],'as':_0x4774b1['as'],'attributes':_0x4774b1['attributes'],'include':_0x4774b1[_0x354f('0x18')]?_[_0x354f('0x19')](_0x4774b1[_0x354f('0x18')],function(_0x627fdd){return{'model':db[_0x627fdd['model']],'as':_0x627fdd['as'],'attributes':_0x627fdd[_0x354f('0x17')],'include':_0x627fdd[_0x354f('0x18')]?_['map'](_0x627fdd['include'],function(_0x1834e3){return{'model':db[_0x1834e3[_0x354f('0x1a')]],'as':_0x1834e3['as'],'attributes':_0x1834e3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d9f49){logger[_0x354f('0xc')](_0x354f('0x1b'),_0x56b1b5);logger[_0x354f('0xe')](_0x354f('0x1b'),_0x56b1b5,JSON[_0x354f('0x1c')](_0x4d9f49));_0x5737e4(_0x4d9f49);})[_0x354f('0x1d')](function(_0x3406d5){logger[_0x354f('0x10')](_0x354f('0x1b'),_0x3406d5['message'],_0x56b1b5);_0x4bbd44(_0x488afc['error'](0x1f4,_0x3406d5[_0x354f('0x12')]));});});}; \ No newline at end of file +var _0x126f=['../../config/environment','jayson/promise','client','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','result','Sound','options','raw','where','attributes','include','map','model','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x46ef1d,_0x24926){var _0x49ce69=function(_0x5db4fc){while(--_0x5db4fc){_0x46ef1d['push'](_0x46ef1d['shift']());}};_0x49ce69(++_0x24926);}(_0x126f,0x18e));var _0xf126=function(_0x49a0b9,_0x8201dd){_0x49a0b9=_0x49a0b9-0x0;var _0x457f3e=_0x126f[_0x49a0b9];return _0x457f3e;};'use strict';var _=require(_0xf126('0x0'));var util=require(_0xf126('0x1'));var moment=require(_0xf126('0x2'));var BPromise=require(_0xf126('0x3'));var rs=require(_0xf126('0x4'));var fs=require('fs');var Redis=require(_0xf126('0x5'));var db=require(_0xf126('0x6'))['db'];var utils=require(_0xf126('0x7'));var logger=require(_0xf126('0x8'))(_0xf126('0x9'));var config=require(_0xf126('0xa'));var jayson=require(_0xf126('0xb'));var client=jayson[_0xf126('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41e81e,_0x248806,_0x3ea797){return new BPromise(function(_0x4f05b1,_0x3a9194){return client[_0xf126('0xd')](_0x41e81e,_0x3ea797)[_0xf126('0xe')](function(_0x5efe08){logger[_0xf126('0xf')]('Sound,\x20%s,\x20%s',_0x248806,'request\x20sent');logger[_0xf126('0x10')](_0xf126('0x11'),_0x248806,_0xf126('0x12'),JSON[_0xf126('0x13')](_0x5efe08));if(_0x5efe08[_0xf126('0x14')]){if(_0x5efe08[_0xf126('0x14')][_0xf126('0x15')]===0x1f4){logger[_0xf126('0x14')](_0xf126('0x16'),_0x248806,_0x5efe08[_0xf126('0x14')]['message']);return _0x3a9194(_0x5efe08[_0xf126('0x14')][_0xf126('0x17')]);}logger['error'](_0xf126('0x16'),_0x248806,_0x5efe08['error'][_0xf126('0x17')]);return _0x4f05b1(_0x5efe08['error'][_0xf126('0x17')]);}else{logger[_0xf126('0xf')](_0xf126('0x16'),_0x248806,_0xf126('0x12'));_0x4f05b1(_0x5efe08[_0xf126('0x18')][_0xf126('0x17')]);}})['catch'](function(_0x509dcf){logger[_0xf126('0x14')]('Sound,\x20%s,\x20%s',_0x248806,_0x509dcf);_0x3a9194(_0x509dcf);});});}exports['ShowSound']=function(_0x319f52){var _0x4e1747=this;return new Promise(function(_0x310d0f,_0x5dd1ff){return db[_0xf126('0x19')]['find']({'raw':_0x319f52[_0xf126('0x1a')]?_0x319f52[_0xf126('0x1a')][_0xf126('0x1b')]===undefined?!![]:![]:!![],'where':_0x319f52['options']?_0x319f52[_0xf126('0x1a')][_0xf126('0x1c')]||null:null,'attributes':_0x319f52['options']?_0x319f52[_0xf126('0x1a')][_0xf126('0x1d')]||null:null,'include':_0x319f52['options']?_0x319f52['options'][_0xf126('0x1e')]?_[_0xf126('0x1f')](_0x319f52[_0xf126('0x1a')][_0xf126('0x1e')],function(_0x189bd2){return{'model':db[_0x189bd2[_0xf126('0x20')]],'as':_0x189bd2['as'],'attributes':_0x189bd2['attributes'],'include':_0x189bd2[_0xf126('0x1e')]?_[_0xf126('0x1f')](_0x189bd2[_0xf126('0x1e')],function(_0x3e9e9c){return{'model':db[_0x3e9e9c['model']],'as':_0x3e9e9c['as'],'attributes':_0x3e9e9c[_0xf126('0x1d')],'include':_0x3e9e9c[_0xf126('0x1e')]?_[_0xf126('0x1f')](_0x3e9e9c[_0xf126('0x1e')],function(_0x55d086){return{'model':db[_0x55d086[_0xf126('0x20')]],'as':_0x55d086['as'],'attributes':_0x55d086['attributes']};}):[]};}):[]};}):[]:[]})[_0xf126('0xe')](function(_0x6c064c){logger[_0xf126('0xf')](_0xf126('0x21'),_0x319f52);logger[_0xf126('0x10')](_0xf126('0x21'),_0x319f52,JSON[_0xf126('0x13')](_0x6c064c));_0x310d0f(_0x6c064c);})['catch'](function(_0x1294b1){logger[_0xf126('0x14')](_0xf126('0x21'),_0x1294b1[_0xf126('0x17')],_0x319f52);_0x5dd1ff(_0x4e1747['error'](0x1f4,_0x1294b1['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 444c73e..630bc31 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xfe8644,_0xb7d779){var _0x38afa7=function(_0xed6135){while(--_0xed6135){_0xfe8644['push'](_0xfe8644['shift']());}};_0x38afa7(++_0xb7d779);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0xb10b[_0x4d180c];return _0x49b57e;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0x4fc2,0x111));var _0x24fc=function(_0x1a5e61,_0xf2cca5){_0x1a5e61=_0x1a5e61-0x0;var _0x56cef8=_0x4fc2[_0x1a5e61];return _0x56cef8;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 1aff698..920cca1 100644 --- a/server/api/squareMessage/squareMessage.attributes.js +++ b/server/api/squareMessage/squareMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87f8=['ENUM','out','sequelize','exports','STRING','medium'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87f8,0xe6));var _0x887f=function(_0x18f4ef,_0x291aa2){_0x18f4ef=_0x18f4ef-0x0;var _0x5e77ab=_0x87f8[_0x18f4ef];return _0x5e77ab;};'use strict';var Sequelize=require(_0x887f('0x0'));module[_0x887f('0x1')]={'uniqueid':{'type':Sequelize[_0x887f('0x2')]},'body':{'type':Sequelize['TEXT'](_0x887f('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x887f('0x4')]('in',_0x887f('0x5')),'defaultValue':_0x887f('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x887f('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb4f0=['ENUM','out','exports','STRING','TEXT','medium'];(function(_0x49af15,_0x551d7c){var _0xd0c010=function(_0x23ee07){while(--_0x23ee07){_0x49af15['push'](_0x49af15['shift']());}};_0xd0c010(++_0x551d7c);}(_0xb4f0,0x1c4));var _0x0b4f=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0xb4f0[_0x2eb5bc];return _0x51c7b1;};'use strict';var Sequelize=require('sequelize');module[_0x0b4f('0x0')]={'uniqueid':{'type':Sequelize[_0x0b4f('0x1')]},'body':{'type':Sequelize[_0x0b4f('0x2')](_0x0b4f('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x0b4f('0x4')]('in',_0x0b4f('0x5')),'defaultValue':_0x0b4f('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f723310..f7a004f 100644 --- a/server/api/squareMessage/squareMessage.controller.js +++ b/server/api/squareMessage/squareMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1219=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','SquareMessage','count','includeAll','include','findAll','rows','catch','keys','merge','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x42572b,_0x259433){var _0x4d50b3=function(_0x17a250){while(--_0x17a250){_0x42572b['push'](_0x42572b['shift']());}};_0x4d50b3(++_0x259433);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9121('0x0'));var rimraf=require(_0x9121('0x1'));var zipdir=require(_0x9121('0x2'));var jsonpatch=require(_0x9121('0x3'));var rp=require(_0x9121('0x4'));var moment=require('moment');var BPromise=require(_0x9121('0x5'));var Mustache=require('mustache');var util=require(_0x9121('0x6'));var path=require(_0x9121('0x7'));var sox=require(_0x9121('0x8'));var csv=require(_0x9121('0x9'));var ejs=require(_0x9121('0xa'));var fs=require('fs');var fs_extra=require(_0x9121('0xb'));var _=require(_0x9121('0xc'));var squel=require(_0x9121('0xd'));var crypto=require(_0x9121('0xe'));var jsforce=require(_0x9121('0xf'));var deskjs=require(_0x9121('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9121('0x11'));var Papa=require(_0x9121('0x12'));var Redis=require(_0x9121('0x13'));var authService=require(_0x9121('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9121('0x15'));var hardwareService=require(_0x9121('0x16'));var logger=require(_0x9121('0x17'))(_0x9121('0x18'));var utils=require(_0x9121('0x19'));var config=require(_0x9121('0x1a'));var licenseUtil=require(_0x9121('0x1b'));var db=require(_0x9121('0x1c'))['db'];function respondWithStatusCode(_0x4470d0,_0x8a3dd1){_0x8a3dd1=_0x8a3dd1||0xcc;return function(_0x3e54fc){if(_0x3e54fc){return _0x4470d0[_0x9121('0x1d')](_0x8a3dd1);}return _0x4470d0[_0x9121('0x1e')](_0x8a3dd1)[_0x9121('0x1f')]();};}function respondWithResult(_0x3d1213,_0x505265){_0x505265=_0x505265||0xc8;return function(_0x106fe1){if(_0x106fe1){return _0x3d1213[_0x9121('0x1e')](_0x505265)[_0x9121('0x20')](_0x106fe1);}};}function respondWithFilteredResult(_0x35b2bf,_0x292aa0){return function(_0x4606a2){if(_0x4606a2){var _0x49c6aa=typeof _0x292aa0['offset']===_0x9121('0x21')&&typeof _0x292aa0[_0x9121('0x22')]===_0x9121('0x21');var _0xb8873a=_0x4606a2['count'];var _0x5bc064=_0x49c6aa?0x0:_0x292aa0[_0x9121('0x23')];var _0x40e9cc=_0x49c6aa?_0x4606a2['count']:_0x292aa0[_0x9121('0x23')]+_0x292aa0[_0x9121('0x22')];var _0x88b2e4;if(_0x40e9cc>=_0xb8873a){_0x40e9cc=_0xb8873a;_0x88b2e4=0xc8;}else{_0x88b2e4=0xce;}_0x35b2bf[_0x9121('0x1e')](_0x88b2e4);return _0x35b2bf['set'](_0x9121('0x24'),_0x5bc064+'-'+_0x40e9cc+'/'+_0xb8873a)['json'](_0x4606a2);}return null;};}function patchUpdates(_0x47d5cc){return function(_0x33ac3f){try{jsonpatch[_0x9121('0x25')](_0x33ac3f,_0x47d5cc,!![]);}catch(_0x1e1d2a){return BPromise[_0x9121('0x26')](_0x1e1d2a);}return _0x33ac3f[_0x9121('0x27')]();};}function saveUpdates(_0x4d568e,_0x1d3174){return function(_0xefb0a5){if(_0xefb0a5){return _0xefb0a5[_0x9121('0x28')](_0x4d568e)[_0x9121('0x29')](function(_0x5a6cd1){return _0x5a6cd1;});}return null;};}function removeEntity(_0x510bb3,_0x40daca){return function(_0x29b864){if(_0x29b864){return _0x29b864[_0x9121('0x2a')]()['then'](function(){_0x510bb3[_0x9121('0x1e')](0xcc)[_0x9121('0x1f')]();});}};}function handleEntityNotFound(_0x59b142,_0x31f5ff){return function(_0x449317){if(!_0x449317){_0x59b142[_0x9121('0x1d')](0x194);}return _0x449317;};}function handleError(_0x3667eb,_0x1fbbd){_0x1fbbd=_0x1fbbd||0x1f4;return function(_0x1add9b){logger[_0x9121('0x2b')](_0x1add9b[_0x9121('0x2c')]);if(_0x1add9b[_0x9121('0x2d')]){delete _0x1add9b[_0x9121('0x2d')];}_0x3667eb[_0x9121('0x1e')](_0x1fbbd)[_0x9121('0x2e')](_0x1add9b);};}exports[_0x9121('0x2f')]=function(_0x71b6cf,_0x1dd5a7){var _0x34e970={},_0x4529b6={},_0x4ab110={'count':0x0,'rows':[]};var _0x4a23ec=_[_0x9121('0x30')](db['SquareMessage'][_0x9121('0x31')],function(_0x23b1ed){return{'name':_0x23b1ed['fieldName'],'type':_0x23b1ed[_0x9121('0x32')][_0x9121('0x33')]};});_0x4529b6[_0x9121('0x34')]=_[_0x9121('0x30')](_0x4a23ec,_0x9121('0x2d'));_0x4529b6['query']=_['keys'](_0x71b6cf['query']);_0x4529b6[_0x9121('0x35')]=_[_0x9121('0x36')](_0x4529b6['model'],_0x4529b6[_0x9121('0x37')]);_0x34e970[_0x9121('0x38')]=_[_0x9121('0x36')](_0x4529b6['model'],qs[_0x9121('0x39')](_0x71b6cf[_0x9121('0x37')][_0x9121('0x39')]));_0x34e970[_0x9121('0x38')]=_0x34e970[_0x9121('0x38')][_0x9121('0x3a')]?_0x34e970[_0x9121('0x38')]:_0x4529b6[_0x9121('0x34')];if(!_0x71b6cf[_0x9121('0x37')][_0x9121('0x3b')](_0x9121('0x3c'))){_0x34e970['limit']=qs[_0x9121('0x22')](_0x71b6cf[_0x9121('0x37')][_0x9121('0x22')]);_0x34e970[_0x9121('0x23')]=qs[_0x9121('0x23')](_0x71b6cf[_0x9121('0x37')]['offset']);}_0x34e970['order']=qs['sort'](_0x71b6cf[_0x9121('0x37')][_0x9121('0x3d')]);_0x34e970[_0x9121('0x3e')]=qs[_0x9121('0x35')](_['pick'](_0x71b6cf['query'],_0x4529b6[_0x9121('0x35')]),_0x4a23ec);if(_0x71b6cf[_0x9121('0x37')][_0x9121('0x3f')]){_0x34e970[_0x9121('0x3e')]=_['merge'](_0x34e970[_0x9121('0x3e')],{'$or':_[_0x9121('0x30')](_0x4a23ec,function(_0x1c0c93){if(_0x1c0c93['type']!==_0x9121('0x40')){var _0x2c6696={};_0x2c6696[_0x1c0c93[_0x9121('0x2d')]]={'$like':'%'+_0x71b6cf['query'][_0x9121('0x3f')]+'%'};return _0x2c6696;}})});}_0x34e970=_['merge']({},_0x34e970,_0x71b6cf[_0x9121('0x41')]);var _0x995111={'where':_0x34e970[_0x9121('0x3e')]};return db[_0x9121('0x42')][_0x9121('0x43')](_0x995111)[_0x9121('0x29')](function(_0x5c9e06){_0x4ab110[_0x9121('0x43')]=_0x5c9e06;if(_0x71b6cf[_0x9121('0x37')][_0x9121('0x44')]){_0x34e970[_0x9121('0x45')]=[{'all':!![]}];}return db['SquareMessage'][_0x9121('0x46')](_0x34e970);})['then'](function(_0x533628){_0x4ab110[_0x9121('0x47')]=_0x533628;return _0x4ab110;})['then'](respondWithFilteredResult(_0x1dd5a7,_0x34e970))[_0x9121('0x48')](handleError(_0x1dd5a7,null));};exports['show']=function(_0x4c6c42,_0x325c7e){var _0x47b06f={'raw':!![],'where':{'id':_0x4c6c42['params']['id']}},_0x24e009={};_0x24e009[_0x9121('0x34')]=_[_0x9121('0x49')](db[_0x9121('0x42')][_0x9121('0x31')]);_0x24e009[_0x9121('0x37')]=_[_0x9121('0x49')](_0x4c6c42[_0x9121('0x37')]);_0x24e009['filters']=_[_0x9121('0x36')](_0x24e009[_0x9121('0x34')],_0x24e009[_0x9121('0x37')]);_0x47b06f['attributes']=_[_0x9121('0x36')](_0x24e009[_0x9121('0x34')],qs[_0x9121('0x39')](_0x4c6c42[_0x9121('0x37')][_0x9121('0x39')]));_0x47b06f[_0x9121('0x38')]=_0x47b06f[_0x9121('0x38')][_0x9121('0x3a')]?_0x47b06f[_0x9121('0x38')]:_0x24e009['model'];if(_0x4c6c42[_0x9121('0x37')][_0x9121('0x44')]){_0x47b06f[_0x9121('0x45')]=[{'all':!![]}];}_0x47b06f=_[_0x9121('0x4a')]({},_0x47b06f,_0x4c6c42[_0x9121('0x41')]);return db[_0x9121('0x42')][_0x9121('0x4b')](_0x47b06f)[_0x9121('0x29')](handleEntityNotFound(_0x325c7e,null))[_0x9121('0x29')](respondWithResult(_0x325c7e,null))['catch'](handleError(_0x325c7e,null));};exports[_0x9121('0x4c')]=function(_0x1385ec,_0x327707){return db['SquareMessage'][_0x9121('0x4c')](_0x1385ec[_0x9121('0x4d')],{})[_0x9121('0x29')](respondWithResult(_0x327707,0xc9))[_0x9121('0x48')](handleError(_0x327707,null));};exports[_0x9121('0x28')]=function(_0x471de8,_0x31164a){if(_0x471de8[_0x9121('0x4d')]['id']){delete _0x471de8['body']['id'];}return db[_0x9121('0x42')][_0x9121('0x4b')]({'where':{'id':_0x471de8['params']['id']}})[_0x9121('0x29')](handleEntityNotFound(_0x31164a,null))[_0x9121('0x29')](saveUpdates(_0x471de8['body'],null))['then'](respondWithResult(_0x31164a,null))['catch'](handleError(_0x31164a,null));};exports[_0x9121('0x2a')]=function(_0x4ddc77,_0x3106ec){return db[_0x9121('0x42')][_0x9121('0x4b')]({'where':{'id':_0x4ddc77[_0x9121('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3106ec,null))[_0x9121('0x29')](removeEntity(_0x3106ec,null))['catch'](handleError(_0x3106ec,null));}; \ No newline at end of file +var _0x14d8=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SquareMessage','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','length','options','catch','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x14d8,0x87));var _0x814d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x14d8[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x814d('0x0'));var rimraf=require(_0x814d('0x1'));var zipdir=require(_0x814d('0x2'));var jsonpatch=require(_0x814d('0x3'));var rp=require(_0x814d('0x4'));var moment=require(_0x814d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x814d('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x814d('0x7'));var ejs=require(_0x814d('0x8'));var fs=require('fs');var fs_extra=require(_0x814d('0x9'));var _=require('lodash');var squel=require(_0x814d('0xa'));var crypto=require(_0x814d('0xb'));var jsforce=require(_0x814d('0xc'));var deskjs=require(_0x814d('0xd'));var toCsv=require(_0x814d('0x7'));var querystring=require(_0x814d('0xe'));var Papa=require(_0x814d('0xf'));var Redis=require('ioredis');var authService=require(_0x814d('0x10'));var qs=require(_0x814d('0x11'));var as=require(_0x814d('0x12'));var hardwareService=require(_0x814d('0x13'));var logger=require(_0x814d('0x14'))(_0x814d('0x15'));var utils=require(_0x814d('0x16'));var config=require(_0x814d('0x17'));var licenseUtil=require(_0x814d('0x18'));var db=require(_0x814d('0x19'))['db'];function respondWithStatusCode(_0x13d604,_0x2b6d1d){_0x2b6d1d=_0x2b6d1d||0xcc;return function(_0x21116f){if(_0x21116f){return _0x13d604[_0x814d('0x1a')](_0x2b6d1d);}return _0x13d604['status'](_0x2b6d1d)[_0x814d('0x1b')]();};}function respondWithResult(_0x37b123,_0x19d338){_0x19d338=_0x19d338||0xc8;return function(_0x4ded99){if(_0x4ded99){return _0x37b123[_0x814d('0x1c')](_0x19d338)[_0x814d('0x1d')](_0x4ded99);}};}function respondWithFilteredResult(_0x3a3834,_0xd4e77b){return function(_0x19ccd8){if(_0x19ccd8){var _0x2b6518=typeof _0xd4e77b['offset']===_0x814d('0x1e')&&typeof _0xd4e77b[_0x814d('0x1f')]===_0x814d('0x1e');var _0x57ccaa=_0x19ccd8[_0x814d('0x20')];var _0x2e7def=_0x2b6518?0x0:_0xd4e77b['offset'];var _0x18aa84=_0x2b6518?_0x19ccd8[_0x814d('0x20')]:_0xd4e77b[_0x814d('0x21')]+_0xd4e77b['limit'];var _0x3634fe;if(_0x18aa84>=_0x57ccaa){_0x18aa84=_0x57ccaa;_0x3634fe=0xc8;}else{_0x3634fe=0xce;}_0x3a3834[_0x814d('0x1c')](_0x3634fe);return _0x3a3834[_0x814d('0x22')](_0x814d('0x23'),_0x2e7def+'-'+_0x18aa84+'/'+_0x57ccaa)[_0x814d('0x1d')](_0x19ccd8);}return null;};}function patchUpdates(_0x24387c){return function(_0x16be40){try{jsonpatch['apply'](_0x16be40,_0x24387c,!![]);}catch(_0x1be432){return BPromise[_0x814d('0x24')](_0x1be432);}return _0x16be40[_0x814d('0x25')]();};}function saveUpdates(_0x441d47,_0x540a67){return function(_0x526be1){if(_0x526be1){return _0x526be1[_0x814d('0x26')](_0x441d47)[_0x814d('0x27')](function(_0x376c31){return _0x376c31;});}return null;};}function removeEntity(_0x26d998,_0xfc1f7b){return function(_0x486dcd){if(_0x486dcd){return _0x486dcd[_0x814d('0x28')]()[_0x814d('0x27')](function(){_0x26d998[_0x814d('0x1c')](0xcc)[_0x814d('0x1b')]();});}};}function handleEntityNotFound(_0x56e809,_0x31855c){return function(_0x4d0b06){if(!_0x4d0b06){_0x56e809['sendStatus'](0x194);}return _0x4d0b06;};}function handleError(_0x5007d9,_0x50a9e8){_0x50a9e8=_0x50a9e8||0x1f4;return function(_0x14a5e3){logger[_0x814d('0x29')](_0x14a5e3[_0x814d('0x2a')]);if(_0x14a5e3[_0x814d('0x2b')]){delete _0x14a5e3['name'];}_0x5007d9[_0x814d('0x1c')](_0x50a9e8)['send'](_0x14a5e3);};}exports[_0x814d('0x2c')]=function(_0x387acb,_0x23c9ab){var _0x3522ae={},_0x1cf59b={},_0x3d0669={'count':0x0,'rows':[]};var _0x26e041=_[_0x814d('0x2d')](db[_0x814d('0x2e')]['rawAttributes'],function(_0xc5e4be){return{'name':_0xc5e4be[_0x814d('0x2f')],'type':_0xc5e4be['type'][_0x814d('0x30')]};});_0x1cf59b[_0x814d('0x31')]=_['map'](_0x26e041,'name');_0x1cf59b[_0x814d('0x32')]=_[_0x814d('0x33')](_0x387acb['query']);_0x1cf59b['filters']=_[_0x814d('0x34')](_0x1cf59b[_0x814d('0x31')],_0x1cf59b[_0x814d('0x32')]);_0x3522ae[_0x814d('0x35')]=_['intersection'](_0x1cf59b[_0x814d('0x31')],qs[_0x814d('0x36')](_0x387acb[_0x814d('0x32')][_0x814d('0x36')]));_0x3522ae[_0x814d('0x35')]=_0x3522ae[_0x814d('0x35')]['length']?_0x3522ae['attributes']:_0x1cf59b['model'];if(!_0x387acb[_0x814d('0x32')][_0x814d('0x37')](_0x814d('0x38'))){_0x3522ae[_0x814d('0x1f')]=qs[_0x814d('0x1f')](_0x387acb[_0x814d('0x32')][_0x814d('0x1f')]);_0x3522ae[_0x814d('0x21')]=qs[_0x814d('0x21')](_0x387acb[_0x814d('0x32')][_0x814d('0x21')]);}_0x3522ae[_0x814d('0x39')]=qs[_0x814d('0x3a')](_0x387acb[_0x814d('0x32')][_0x814d('0x3a')]);_0x3522ae['where']=qs[_0x814d('0x3b')](_[_0x814d('0x3c')](_0x387acb[_0x814d('0x32')],_0x1cf59b[_0x814d('0x3b')]),_0x26e041);if(_0x387acb[_0x814d('0x32')][_0x814d('0x3d')]){_0x3522ae[_0x814d('0x3e')]=_[_0x814d('0x3f')](_0x3522ae[_0x814d('0x3e')],{'$or':_[_0x814d('0x2d')](_0x26e041,function(_0x1e6502){if(_0x1e6502[_0x814d('0x40')]!==_0x814d('0x41')){var _0x30b278={};_0x30b278[_0x1e6502['name']]={'$like':'%'+_0x387acb[_0x814d('0x32')][_0x814d('0x3d')]+'%'};return _0x30b278;}})});}_0x3522ae=_[_0x814d('0x3f')]({},_0x3522ae,_0x387acb['options']);var _0x43ff0d={'where':_0x3522ae[_0x814d('0x3e')]};return db[_0x814d('0x2e')]['count'](_0x43ff0d)[_0x814d('0x27')](function(_0x2dd467){_0x3d0669[_0x814d('0x20')]=_0x2dd467;if(_0x387acb['query'][_0x814d('0x42')]){_0x3522ae[_0x814d('0x43')]=[{'all':!![]}];}return db['SquareMessage'][_0x814d('0x44')](_0x3522ae);})[_0x814d('0x27')](function(_0x5db021){_0x3d0669[_0x814d('0x45')]=_0x5db021;return _0x3d0669;})[_0x814d('0x27')](respondWithFilteredResult(_0x23c9ab,_0x3522ae))['catch'](handleError(_0x23c9ab,null));};exports[_0x814d('0x46')]=function(_0x1f6713,_0x1435bc){var _0x370d7d={'raw':!![],'where':{'id':_0x1f6713['params']['id']}},_0x3fc827={};_0x3fc827[_0x814d('0x31')]=_[_0x814d('0x33')](db['SquareMessage'][_0x814d('0x47')]);_0x3fc827[_0x814d('0x32')]=_[_0x814d('0x33')](_0x1f6713['query']);_0x3fc827[_0x814d('0x3b')]=_['intersection'](_0x3fc827[_0x814d('0x31')],_0x3fc827[_0x814d('0x32')]);_0x370d7d[_0x814d('0x35')]=_[_0x814d('0x34')](_0x3fc827[_0x814d('0x31')],qs[_0x814d('0x36')](_0x1f6713[_0x814d('0x32')][_0x814d('0x36')]));_0x370d7d['attributes']=_0x370d7d['attributes'][_0x814d('0x48')]?_0x370d7d[_0x814d('0x35')]:_0x3fc827[_0x814d('0x31')];if(_0x1f6713[_0x814d('0x32')][_0x814d('0x42')]){_0x370d7d['include']=[{'all':!![]}];}_0x370d7d=_[_0x814d('0x3f')]({},_0x370d7d,_0x1f6713[_0x814d('0x49')]);return db['SquareMessage']['find'](_0x370d7d)['then'](handleEntityNotFound(_0x1435bc,null))[_0x814d('0x27')](respondWithResult(_0x1435bc,null))[_0x814d('0x4a')](handleError(_0x1435bc,null));};exports[_0x814d('0x4b')]=function(_0x32c441,_0x5bc8ee){return db[_0x814d('0x2e')]['create'](_0x32c441[_0x814d('0x4c')],{})['then'](respondWithResult(_0x5bc8ee,0xc9))[_0x814d('0x4a')](handleError(_0x5bc8ee,null));};exports[_0x814d('0x26')]=function(_0x49c8d4,_0x26bd56){if(_0x49c8d4[_0x814d('0x4c')]['id']){delete _0x49c8d4[_0x814d('0x4c')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x49c8d4[_0x814d('0x4d')]['id']}})[_0x814d('0x27')](handleEntityNotFound(_0x26bd56,null))[_0x814d('0x27')](saveUpdates(_0x49c8d4['body'],null))['then'](respondWithResult(_0x26bd56,null))[_0x814d('0x4a')](handleError(_0x26bd56,null));};exports[_0x814d('0x28')]=function(_0x5730fe,_0x129339){return db[_0x814d('0x2e')][_0x814d('0x4e')]({'where':{'id':_0x5730fe[_0x814d('0x4d')]['id']}})[_0x814d('0x27')](handleEntityNotFound(_0x129339,null))[_0x814d('0x27')](removeEntity(_0x129339,null))[_0x814d('0x4a')](handleError(_0x129339,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 4499fbd..ef652dd 100644 --- a/server/api/squareMessage/squareMessage.model.js +++ b/server/api/squareMessage/squareMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed84=['../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','api','moment','bluebird','path'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0xed84,0x89));var _0x4ed8=function(_0x579f2b,_0x19403d){_0x579f2b=_0x579f2b-0x0;var _0x11d671=_0xed84[_0x579f2b];return _0x11d671;};'use strict';var _=require(_0x4ed8('0x0'));var util=require(_0x4ed8('0x1'));var logger=require('../../config/logger')(_0x4ed8('0x2'));var moment=require(_0x4ed8('0x3'));var BPromise=require(_0x4ed8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ed8('0x5'));var rimraf=require('rimraf');var config=require(_0x4ed8('0x6'));var attributes=require(_0x4ed8('0x7'));module['exports']=function(_0x46824b,_0x487484){return _0x46824b[_0x4ed8('0x8')](_0x4ed8('0x9'),attributes,{'tableName':_0x4ed8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a69=['rimraf','./squareMessage.attributes','exports','define','square_messages','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x54b110,_0x28bd9d){var _0x28aae0=function(_0x15980f){while(--_0x15980f){_0x54b110['push'](_0x54b110['shift']());}};_0x28aae0(++_0x28bd9d);}(_0x3a69,0x9b));var _0x93a6=function(_0x2aa323,_0x1c492b){_0x2aa323=_0x2aa323-0x0;var _0x17fcab=_0x3a69[_0x2aa323];return _0x17fcab;};'use strict';var _=require(_0x93a6('0x0'));var util=require('util');var logger=require(_0x93a6('0x1'))(_0x93a6('0x2'));var moment=require('moment');var BPromise=require(_0x93a6('0x3'));var rp=require(_0x93a6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93a6('0x5'));var config=require('../../config/environment');var attributes=require(_0x93a6('0x6'));module[_0x93a6('0x7')]=function(_0x1258b8,_0xf1c7a3){return _0x1258b8[_0x93a6('0x8')]('SquareMessage',attributes,{'tableName':_0x93a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index e33e097..eb4d2e6 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e82=['stringify','error','code','message','SquareMessage,\x20%s,\x20%s','result','catch','CreateSquareMessage','SquareMessage','create','body','info','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1b5d4f,_0x11c495){var _0x3fb8ab=function(_0x3fb09f){while(--_0x3fb09f){_0x1b5d4f['push'](_0x1b5d4f['shift']());}};_0x3fb8ab(++_0x11c495);}(_0x5e82,0x93));var _0x25e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e82[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x25e8('0x0'));var util=require(_0x25e8('0x1'));var moment=require('moment');var BPromise=require(_0x25e8('0x2'));var rs=require(_0x25e8('0x3'));var fs=require('fs');var Redis=require(_0x25e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x25e8('0x5'));var logger=require(_0x25e8('0x6'))(_0x25e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x25e8('0x8'));var client=jayson[_0x25e8('0x9')][_0x25e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22100d,_0x5f50c5,_0x3cf389){return new BPromise(function(_0x1f4359,_0x3ae07c){return client['request'](_0x22100d,_0x3cf389)[_0x25e8('0xb')](function(_0x4ef882){logger['info']('SquareMessage,\x20%s,\x20%s',_0x5f50c5,'request\x20sent');logger[_0x25e8('0xc')](_0x25e8('0xd'),_0x5f50c5,_0x25e8('0xe'),JSON[_0x25e8('0xf')](_0x4ef882));if(_0x4ef882[_0x25e8('0x10')]){if(_0x4ef882[_0x25e8('0x10')][_0x25e8('0x11')]===0x1f4){logger[_0x25e8('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5f50c5,_0x4ef882['error'][_0x25e8('0x12')]);return _0x3ae07c(_0x4ef882[_0x25e8('0x10')]['message']);}logger[_0x25e8('0x10')](_0x25e8('0x13'),_0x5f50c5,_0x4ef882[_0x25e8('0x10')][_0x25e8('0x12')]);return _0x1f4359(_0x4ef882[_0x25e8('0x10')][_0x25e8('0x12')]);}else{logger['info'](_0x25e8('0x13'),_0x5f50c5,_0x25e8('0xe'));_0x1f4359(_0x4ef882[_0x25e8('0x14')][_0x25e8('0x12')]);}})[_0x25e8('0x15')](function(_0x5936c8){logger[_0x25e8('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5f50c5,_0x5936c8);_0x3ae07c(_0x5936c8);});});}exports[_0x25e8('0x16')]=function(_0x3bb1e0){var _0x2ebc54=this;return new Promise(function(_0x4a1800,_0x319a60){return db[_0x25e8('0x17')][_0x25e8('0x18')](_0x3bb1e0[_0x25e8('0x19')],{'raw':_0x3bb1e0['options']?_0x3bb1e0['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x10bc4a){logger[_0x25e8('0x1a')](_0x25e8('0x16'),_0x3bb1e0);logger[_0x25e8('0xc')]('CreateSquareMessage',_0x3bb1e0,JSON[_0x25e8('0xf')](_0x10bc4a));_0x4a1800(_0x10bc4a);})['catch'](function(_0x149c71){logger[_0x25e8('0x10')](_0x25e8('0x16'),_0x149c71['message'],_0x3bb1e0);_0x319a60(_0x2ebc54['error'](0x1f4,_0x149c71[_0x25e8('0x12')]));});});}; \ No newline at end of file +var _0x703d=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x703d,0x69));var _0xd703=function(_0x5ed4a8,_0x1cd519){_0x5ed4a8=_0x5ed4a8-0x0;var _0x26a0bf=_0x703d[_0x5ed4a8];return _0x26a0bf;};'use strict';var _=require(_0xd703('0x0'));var util=require('util');var moment=require(_0xd703('0x1'));var BPromise=require(_0xd703('0x2'));var rs=require(_0xd703('0x3'));var fs=require('fs');var Redis=require(_0xd703('0x4'));var db=require(_0xd703('0x5'))['db'];var utils=require(_0xd703('0x6'));var logger=require(_0xd703('0x7'))(_0xd703('0x8'));var config=require(_0xd703('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd703('0xa')][_0xd703('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15270,_0x52701c,_0x44291b){return new BPromise(function(_0x56e411,_0x41f02b){return client[_0xd703('0xc')](_0x15270,_0x44291b)[_0xd703('0xd')](function(_0x3e8f58){logger[_0xd703('0xe')](_0xd703('0xf'),_0x52701c,_0xd703('0x10'));logger[_0xd703('0x11')](_0xd703('0x12'),_0x52701c,'request\x20sent',JSON[_0xd703('0x13')](_0x3e8f58));if(_0x3e8f58[_0xd703('0x14')]){if(_0x3e8f58[_0xd703('0x14')][_0xd703('0x15')]===0x1f4){logger[_0xd703('0x14')](_0xd703('0xf'),_0x52701c,_0x3e8f58[_0xd703('0x14')]['message']);return _0x41f02b(_0x3e8f58['error'][_0xd703('0x16')]);}logger[_0xd703('0x14')](_0xd703('0xf'),_0x52701c,_0x3e8f58[_0xd703('0x14')][_0xd703('0x16')]);return _0x56e411(_0x3e8f58[_0xd703('0x14')][_0xd703('0x16')]);}else{logger[_0xd703('0xe')](_0xd703('0xf'),_0x52701c,_0xd703('0x10'));_0x56e411(_0x3e8f58['result'][_0xd703('0x16')]);}})[_0xd703('0x17')](function(_0x13accd){logger[_0xd703('0x14')](_0xd703('0xf'),_0x52701c,_0x13accd);_0x41f02b(_0x13accd);});});}exports[_0xd703('0x18')]=function(_0x51b3e9){var _0x461451=this;return new Promise(function(_0x1fc09a,_0x4237d3){return db['SquareMessage']['create'](_0x51b3e9[_0xd703('0x19')],{'raw':_0x51b3e9[_0xd703('0x1a')]?_0x51b3e9[_0xd703('0x1a')][_0xd703('0x1b')]===undefined?!![]:![]:!![]})[_0xd703('0xd')](function(_0x140368){logger[_0xd703('0xe')](_0xd703('0x18'),_0x51b3e9);logger[_0xd703('0x11')](_0xd703('0x18'),_0x51b3e9,JSON[_0xd703('0x13')](_0x140368));_0x1fc09a(_0x140368);})[_0xd703('0x17')](function(_0x38d997){logger[_0xd703('0x14')](_0xd703('0x18'),_0x38d997['message'],_0x51b3e9);_0x4237d3(_0x461451[_0xd703('0x14')](0x1f4,_0x38d997[_0xd703('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 8d6fc38..e2a3077 100644 --- a/server/api/squareOdbc/index.js +++ b/server/api/squareOdbc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34c3=['../../config/environment','isAuthenticated','index','/:id','get','/:id/test','15s','test','post','put','update','destroy','exports','util','path','express','../../components/interaction/service'];(function(_0x4f3021,_0x15bf04){var _0xd62bcd=function(_0x18ec51){while(--_0x18ec51){_0x4f3021['push'](_0x4f3021['shift']());}};_0xd62bcd(++_0x15bf04);}(_0x34c3,0xea));var _0x334c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x34c3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x334c('0x0'));var path=require(_0x334c('0x1'));var timeout=require('connect-timeout');var express=require(_0x334c('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x334c('0x3'));var config=require(_0x334c('0x4'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0x334c('0x5')](),controller[_0x334c('0x6')]);router['get'](_0x334c('0x7'),auth[_0x334c('0x5')](),controller['show']);router[_0x334c('0x8')](_0x334c('0x9'),auth[_0x334c('0x5')](),timeout(_0x334c('0xa')),controller[_0x334c('0xb')]);router[_0x334c('0xc')]('/',auth[_0x334c('0x5')](),controller['create']);router[_0x334c('0xd')](_0x334c('0x7'),auth[_0x334c('0x5')](),controller[_0x334c('0xe')]);router['delete'](_0x334c('0x7'),auth[_0x334c('0x5')](),controller[_0x334c('0xf')]);module[_0x334c('0x10')]=router; \ No newline at end of file +var _0xf223=['isAuthenticated','/:id','show','/:id/test','15s','test','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x39c9f2,_0x56b55f){var _0x3e5a71=function(_0x424f2f){while(--_0x424f2f){_0x39c9f2['push'](_0x39c9f2['shift']());}};_0x3e5a71(++_0x56b55f);}(_0xf223,0x115));var _0x3f22=function(_0x1dcccf,_0x11f94f){_0x1dcccf=_0x1dcccf-0x0;var _0x321d8e=_0xf223[_0x1dcccf];return _0x321d8e;};'use strict';var multer=require('multer');var util=require(_0x3f22('0x0'));var path=require(_0x3f22('0x1'));var timeout=require(_0x3f22('0x2'));var express=require(_0x3f22('0x3'));var router=express[_0x3f22('0x4')]();var fs_extra=require(_0x3f22('0x5'));var auth=require(_0x3f22('0x6'));var interaction=require(_0x3f22('0x7'));var config=require(_0x3f22('0x8'));var controller=require(_0x3f22('0x9'));router[_0x3f22('0xa')]('/',auth[_0x3f22('0xb')](),controller['index']);router[_0x3f22('0xa')](_0x3f22('0xc'),auth[_0x3f22('0xb')](),controller[_0x3f22('0xd')]);router[_0x3f22('0xa')](_0x3f22('0xe'),auth[_0x3f22('0xb')](),timeout(_0x3f22('0xf')),controller[_0x3f22('0x10')]);router[_0x3f22('0x11')]('/',auth[_0x3f22('0xb')](),controller[_0x3f22('0x12')]);router[_0x3f22('0x13')]('/:id',auth[_0x3f22('0xb')](),controller[_0x3f22('0x14')]);router[_0x3f22('0x15')]('/:id',auth[_0x3f22('0xb')](),controller[_0x3f22('0x16')]);module[_0x3f22('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 25cc70c..fd4264f 100644 --- a/server/api/squareOdbc/squareOdbc.attributes.js +++ b/server/api/squareOdbc/squareOdbc.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5dbc=['name','STRING','exports'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x5dbc,0xe0));var _0xc5db=function(_0xeda568,_0x301be7){_0xeda568=_0xeda568-0x0;var _0xf8656=_0x5dbc[_0xeda568];return _0xf8656;};'use strict';var Sequelize=require('sequelize');module[_0xc5db('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc5db('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xc5db('0x2')]},'description':{'type':Sequelize[_0xc5db('0x2')]}}; \ No newline at end of file +var _0xe6c1=['exports','STRING','name','sequelize'];(function(_0x5d819e,_0x580967){var _0x13bde2=function(_0x5c9ecb){while(--_0x5c9ecb){_0x5d819e['push'](_0x5d819e['shift']());}};_0x13bde2(++_0x580967);}(_0xe6c1,0x173));var _0x1e6c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6c1[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1e6c('0x0'));module[_0x1e6c('0x1')]={'name':{'type':Sequelize[_0x1e6c('0x2')],'unique':_0x1e6c('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x1e6c('0x2')]},'description':{'type':Sequelize[_0x1e6c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 246a7ab..33e6ae4 100644 --- a/server/api/squareOdbc/squareOdbc.controller.js +++ b/server/api/squareOdbc/squareOdbc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52de=['catch','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','ODBC','UserProfileResource','stack','name','map','SquareOdbc','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows'];(function(_0x1513e7,_0x4548f6){var _0x3b23d1=function(_0x3f20da){while(--_0x3f20da){_0x1513e7['push'](_0x1513e7['shift']());}};_0x3b23d1(++_0x4548f6);}(_0x52de,0x116));var _0xe52d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x52de[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe52d('0x0'));var zipdir=require(_0xe52d('0x1'));var jsonpatch=require(_0xe52d('0x2'));var rp=require(_0xe52d('0x3'));var moment=require(_0xe52d('0x4'));var BPromise=require(_0xe52d('0x5'));var Mustache=require(_0xe52d('0x6'));var util=require('util');var path=require(_0xe52d('0x7'));var sox=require(_0xe52d('0x8'));var csv=require(_0xe52d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe52d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe52d('0xb'));var jsforce=require(_0xe52d('0xc'));var deskjs=require(_0xe52d('0xd'));var toCsv=require(_0xe52d('0x9'));var querystring=require(_0xe52d('0xe'));var Papa=require(_0xe52d('0xf'));var Redis=require(_0xe52d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe52d('0x11'));var as=require(_0xe52d('0x12'));var hardwareService=require(_0xe52d('0x13'));var logger=require(_0xe52d('0x14'))(_0xe52d('0x15'));var utils=require(_0xe52d('0x16'));var config=require(_0xe52d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe52d('0x18'))['db'];function respondWithStatusCode(_0x21b848,_0x53aa4a){_0x53aa4a=_0x53aa4a||0xcc;return function(_0x55db69){if(_0x55db69){return _0x21b848[_0xe52d('0x19')](_0x53aa4a);}return _0x21b848[_0xe52d('0x1a')](_0x53aa4a)[_0xe52d('0x1b')]();};}function respondWithResult(_0x2519cb,_0x5ddea1){_0x5ddea1=_0x5ddea1||0xc8;return function(_0x5af452){if(_0x5af452){return _0x2519cb[_0xe52d('0x1a')](_0x5ddea1)[_0xe52d('0x1c')](_0x5af452);}};}function respondWithFilteredResult(_0x28d083,_0x11b4ef){return function(_0x3a5976){if(_0x3a5976){var _0x9499b1=typeof _0x11b4ef[_0xe52d('0x1d')]===_0xe52d('0x1e')&&typeof _0x11b4ef[_0xe52d('0x1f')]===_0xe52d('0x1e');var _0x4c42df=_0x3a5976[_0xe52d('0x20')];var _0x3ecc49=_0x9499b1?0x0:_0x11b4ef[_0xe52d('0x1d')];var _0x4b544d=_0x9499b1?_0x3a5976[_0xe52d('0x20')]:_0x11b4ef[_0xe52d('0x1d')]+_0x11b4ef['limit'];var _0x4bda57;if(_0x4b544d>=_0x4c42df){_0x4b544d=_0x4c42df;_0x4bda57=0xc8;}else{_0x4bda57=0xce;}_0x28d083[_0xe52d('0x1a')](_0x4bda57);return _0x28d083['set'](_0xe52d('0x21'),_0x3ecc49+'-'+_0x4b544d+'/'+_0x4c42df)[_0xe52d('0x1c')](_0x3a5976);}return null;};}function patchUpdates(_0x2971cc){return function(_0x212056){try{jsonpatch[_0xe52d('0x22')](_0x212056,_0x2971cc,!![]);}catch(_0x4da021){return BPromise['reject'](_0x4da021);}return _0x212056[_0xe52d('0x23')]();};}function saveUpdates(_0x23bc38,_0x238960){return function(_0x456151){if(_0x456151){return _0x456151[_0xe52d('0x24')](_0x23bc38)[_0xe52d('0x25')](function(_0x281690){return _0x281690;});}return null;};}function removeEntity(_0x4767a3,_0x3277e7){return function(_0x566e98){if(_0x566e98){return _0x566e98['destroy']()['then'](function(){var _0x2df4ae=_0x566e98[_0xe52d('0x26')]({'plain':!![]});var _0x170bef=_0xe52d('0x27');return db[_0xe52d('0x28')]['destroy']({'where':{'type':_0x170bef,'resourceId':_0x2df4ae['id']}})['then'](function(){return _0x566e98;});})['then'](function(){_0x4767a3[_0xe52d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x170a48,_0x11a69a){return function(_0x574469){if(!_0x574469){_0x170a48['sendStatus'](0x194);}return _0x574469;};}function handleError(_0x17d0bb,_0x327871){_0x327871=_0x327871||0x1f4;return function(_0x37c766){logger['error'](_0x37c766[_0xe52d('0x29')]);if(_0x37c766[_0xe52d('0x2a')]){delete _0x37c766[_0xe52d('0x2a')];}_0x17d0bb[_0xe52d('0x1a')](_0x327871)['send'](_0x37c766);};}exports['index']=function(_0x2e238d,_0x923a33){var _0x1518d7={},_0x43b2db={},_0x14f8dd={'count':0x0,'rows':[]};var _0x1d5995=_[_0xe52d('0x2b')](db[_0xe52d('0x2c')][_0xe52d('0x2d')],function(_0xbfc8f1){return{'name':_0xbfc8f1['fieldName'],'type':_0xbfc8f1[_0xe52d('0x2e')][_0xe52d('0x2f')]};});_0x43b2db[_0xe52d('0x30')]=_[_0xe52d('0x2b')](_0x1d5995,'name');_0x43b2db['query']=_['keys'](_0x2e238d[_0xe52d('0x31')]);_0x43b2db[_0xe52d('0x32')]=_[_0xe52d('0x33')](_0x43b2db[_0xe52d('0x30')],_0x43b2db[_0xe52d('0x31')]);_0x1518d7[_0xe52d('0x34')]=_[_0xe52d('0x33')](_0x43b2db[_0xe52d('0x30')],qs[_0xe52d('0x35')](_0x2e238d[_0xe52d('0x31')][_0xe52d('0x35')]));_0x1518d7[_0xe52d('0x34')]=_0x1518d7[_0xe52d('0x34')][_0xe52d('0x36')]?_0x1518d7[_0xe52d('0x34')]:_0x43b2db[_0xe52d('0x30')];if(!_0x2e238d['query'][_0xe52d('0x37')](_0xe52d('0x38'))){_0x1518d7[_0xe52d('0x1f')]=qs['limit'](_0x2e238d['query'][_0xe52d('0x1f')]);_0x1518d7[_0xe52d('0x1d')]=qs['offset'](_0x2e238d[_0xe52d('0x31')][_0xe52d('0x1d')]);}_0x1518d7[_0xe52d('0x39')]=qs[_0xe52d('0x3a')](_0x2e238d[_0xe52d('0x31')]['sort']);_0x1518d7[_0xe52d('0x3b')]=qs[_0xe52d('0x32')](_[_0xe52d('0x3c')](_0x2e238d[_0xe52d('0x31')],_0x43b2db[_0xe52d('0x32')]),_0x1d5995);if(_0x2e238d[_0xe52d('0x31')][_0xe52d('0x3d')]){_0x1518d7[_0xe52d('0x3b')]=_['merge'](_0x1518d7[_0xe52d('0x3b')],{'$or':_[_0xe52d('0x2b')](_0x1d5995,function(_0x472282){if(_0x472282[_0xe52d('0x2e')]!==_0xe52d('0x3e')){var _0x50b99a={};_0x50b99a[_0x472282[_0xe52d('0x2a')]]={'$like':'%'+_0x2e238d[_0xe52d('0x31')]['filter']+'%'};return _0x50b99a;}})});}_0x1518d7=_['merge']({},_0x1518d7,_0x2e238d[_0xe52d('0x3f')]);var _0x3697d7={'where':_0x1518d7[_0xe52d('0x3b')]};return db[_0xe52d('0x2c')][_0xe52d('0x20')](_0x3697d7)[_0xe52d('0x25')](function(_0x14845f){_0x14f8dd[_0xe52d('0x20')]=_0x14845f;if(_0x2e238d[_0xe52d('0x31')]['includeAll']){_0x1518d7['include']=[{'all':!![]}];}return db[_0xe52d('0x2c')][_0xe52d('0x40')](_0x1518d7);})[_0xe52d('0x25')](function(_0x117e79){_0x14f8dd[_0xe52d('0x41')]=_0x117e79;return _0x14f8dd;})[_0xe52d('0x25')](respondWithFilteredResult(_0x923a33,_0x1518d7))[_0xe52d('0x42')](handleError(_0x923a33,null));};exports[_0xe52d('0x43')]=function(_0x1af8ef,_0x5f4930){var _0x21e306={'raw':!![],'where':{'id':_0x1af8ef[_0xe52d('0x44')]['id']}},_0x4c9309={};_0x4c9309[_0xe52d('0x30')]=_[_0xe52d('0x45')](db[_0xe52d('0x2c')][_0xe52d('0x2d')]);_0x4c9309['query']=_[_0xe52d('0x45')](_0x1af8ef[_0xe52d('0x31')]);_0x4c9309['filters']=_[_0xe52d('0x33')](_0x4c9309['model'],_0x4c9309[_0xe52d('0x31')]);_0x21e306[_0xe52d('0x34')]=_[_0xe52d('0x33')](_0x4c9309[_0xe52d('0x30')],qs[_0xe52d('0x35')](_0x1af8ef[_0xe52d('0x31')][_0xe52d('0x35')]));_0x21e306[_0xe52d('0x34')]=_0x21e306[_0xe52d('0x34')][_0xe52d('0x36')]?_0x21e306[_0xe52d('0x34')]:_0x4c9309[_0xe52d('0x30')];if(_0x1af8ef[_0xe52d('0x31')][_0xe52d('0x46')]){_0x21e306['include']=[{'all':!![]}];}_0x21e306=_['merge']({},_0x21e306,_0x1af8ef[_0xe52d('0x3f')]);return db[_0xe52d('0x2c')]['find'](_0x21e306)['then'](handleEntityNotFound(_0x5f4930,null))['then'](respondWithResult(_0x5f4930,null))[_0xe52d('0x42')](handleError(_0x5f4930,null));};exports[_0xe52d('0x47')]=function(_0x33e50f,_0x5d6f14){return db['SquareOdbc'][_0xe52d('0x47')](_0x33e50f[_0xe52d('0x48')],{})[_0xe52d('0x25')](function(_0x16553f){var _0xc68575=_0x33e50f[_0xe52d('0x49')][_0xe52d('0x26')]({'plain':!![]});if(!_0xc68575)throw new Error(_0xe52d('0x4a'));if(_0xc68575[_0xe52d('0x4b')]===_0xe52d('0x49')){var _0x5c0510=_0x16553f[_0xe52d('0x26')]({'plain':!![]});var _0x57b693='ODBC';return db[_0xe52d('0x4c')][_0xe52d('0x4d')]({'where':{'name':_0x57b693,'userProfileId':_0xc68575[_0xe52d('0x4e')]},'raw':!![]})[_0xe52d('0x25')](function(_0x5b1a4a){if(_0x5b1a4a&&_0x5b1a4a['autoAssociation']===0x0){return db['UserProfileResource'][_0xe52d('0x47')]({'name':_0x5c0510[_0xe52d('0x2a')],'resourceId':_0x5c0510['id'],'type':_0x5b1a4a[_0xe52d('0x2a')],'sectionId':_0x5b1a4a['id']},{})[_0xe52d('0x25')](function(){return _0x16553f;});}else{return _0x16553f;}})[_0xe52d('0x42')](function(_0x22ee5e){logger[_0xe52d('0x4f')](_0xe52d('0x50'),_0x22ee5e);throw _0x22ee5e;});}return _0x16553f;})['then'](respondWithResult(_0x5d6f14,0xc9))[_0xe52d('0x42')](handleError(_0x5d6f14,null));};exports[_0xe52d('0x24')]=function(_0x17a1a8,_0x4de8f8){if(_0x17a1a8[_0xe52d('0x48')]['id']){delete _0x17a1a8[_0xe52d('0x48')]['id'];}return db[_0xe52d('0x2c')][_0xe52d('0x4d')]({'where':{'id':_0x17a1a8[_0xe52d('0x44')]['id']}})['then'](handleEntityNotFound(_0x4de8f8,null))[_0xe52d('0x25')](saveUpdates(_0x17a1a8['body'],null))[_0xe52d('0x25')](respondWithResult(_0x4de8f8,null))[_0xe52d('0x42')](handleError(_0x4de8f8,null));};exports['destroy']=function(_0x27a51a,_0x3bc485){return db[_0xe52d('0x2c')][_0xe52d('0x4d')]({'where':{'id':_0x27a51a[_0xe52d('0x44')]['id']}})[_0xe52d('0x25')](handleEntityNotFound(_0x3bc485,null))[_0xe52d('0x25')](removeEntity(_0x3bc485,null))[_0xe52d('0x42')](handleError(_0x3bc485,null));};exports[_0xe52d('0x51')]=function(_0x4bafe0,_0x3f6890,_0x3987bb){var _0x2fa4f4;return db[_0xe52d('0x2c')][_0xe52d('0x4d')]({'where':{'id':_0x4bafe0['params']['id']},'attributes':['id',_0xe52d('0x52')]})[_0xe52d('0x25')](handleEntityNotFound(_0x3f6890,null))[_0xe52d('0x25')](function(_0x179cee){if(_0x179cee){var _0x580042=require(_0xe52d('0x53'))();_0x580042[_0xe52d('0x54')](_0x179cee[_0xe52d('0x52')]);_0x580042[_0xe52d('0x55')]();return _0x179cee;}})['then'](respondWithResult(_0x3f6890,null))[_0xe52d('0x42')](handleError(_0x3f6890,null));}; \ No newline at end of file +var _0xb68c=['fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','save','then','destroy','get','ODBC','end','error','stack','name','send','index','SquareOdbc'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xb68c,0x1cc));var _0xcb68=function(_0x47fabe,_0x592302){_0x47fabe=_0x47fabe-0x0;var _0x217c68=_0xb68c[_0x47fabe];return _0x217c68;};'use strict';var emlformat=require(_0xcb68('0x0'));var rimraf=require(_0xcb68('0x1'));var zipdir=require(_0xcb68('0x2'));var jsonpatch=require(_0xcb68('0x3'));var rp=require('request-promise');var moment=require(_0xcb68('0x4'));var BPromise=require(_0xcb68('0x5'));var Mustache=require(_0xcb68('0x6'));var util=require(_0xcb68('0x7'));var path=require(_0xcb68('0x8'));var sox=require(_0xcb68('0x9'));var csv=require(_0xcb68('0xa'));var ejs=require(_0xcb68('0xb'));var fs=require('fs');var fs_extra=require(_0xcb68('0xc'));var _=require(_0xcb68('0xd'));var squel=require('squel');var crypto=require(_0xcb68('0xe'));var jsforce=require(_0xcb68('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcb68('0xa'));var querystring=require(_0xcb68('0x10'));var Papa=require(_0xcb68('0x11'));var Redis=require(_0xcb68('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcb68('0x13'));var as=require(_0xcb68('0x14'));var hardwareService=require(_0xcb68('0x15'));var logger=require('../../config/logger')(_0xcb68('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x120c23,_0x1d568c){_0x1d568c=_0x1d568c||0xcc;return function(_0x773c36){if(_0x773c36){return _0x120c23[_0xcb68('0x17')](_0x1d568c);}return _0x120c23[_0xcb68('0x18')](_0x1d568c)['end']();};}function respondWithResult(_0x21e1e3,_0x5720bd){_0x5720bd=_0x5720bd||0xc8;return function(_0x21935e){if(_0x21935e){return _0x21e1e3[_0xcb68('0x18')](_0x5720bd)[_0xcb68('0x19')](_0x21935e);}};}function respondWithFilteredResult(_0x193400,_0xa81779){return function(_0x552e6a){if(_0x552e6a){var _0x1a88a6=typeof _0xa81779['offset']==='undefined'&&typeof _0xa81779['limit']===_0xcb68('0x1a');var _0x2acc18=_0x552e6a[_0xcb68('0x1b')];var _0x3a247d=_0x1a88a6?0x0:_0xa81779[_0xcb68('0x1c')];var _0x32c030=_0x1a88a6?_0x552e6a[_0xcb68('0x1b')]:_0xa81779['offset']+_0xa81779[_0xcb68('0x1d')];var _0x46f17d;if(_0x32c030>=_0x2acc18){_0x32c030=_0x2acc18;_0x46f17d=0xc8;}else{_0x46f17d=0xce;}_0x193400[_0xcb68('0x18')](_0x46f17d);return _0x193400[_0xcb68('0x1e')](_0xcb68('0x1f'),_0x3a247d+'-'+_0x32c030+'/'+_0x2acc18)['json'](_0x552e6a);}return null;};}function patchUpdates(_0x16659f){return function(_0x55d053){try{jsonpatch['apply'](_0x55d053,_0x16659f,!![]);}catch(_0x28bf91){return BPromise['reject'](_0x28bf91);}return _0x55d053[_0xcb68('0x20')]();};}function saveUpdates(_0x5d40cf,_0x1de84d){return function(_0x41a8c8){if(_0x41a8c8){return _0x41a8c8['update'](_0x5d40cf)[_0xcb68('0x21')](function(_0x327638){return _0x327638;});}return null;};}function removeEntity(_0x404d57,_0xb84a6b){return function(_0x458539){if(_0x458539){return _0x458539[_0xcb68('0x22')]()[_0xcb68('0x21')](function(){var _0x9c2180=_0x458539[_0xcb68('0x23')]({'plain':!![]});var _0x24b9c5=_0xcb68('0x24');return db['UserProfileResource'][_0xcb68('0x22')]({'where':{'type':_0x24b9c5,'resourceId':_0x9c2180['id']}})[_0xcb68('0x21')](function(){return _0x458539;});})['then'](function(){_0x404d57[_0xcb68('0x18')](0xcc)[_0xcb68('0x25')]();});}};}function handleEntityNotFound(_0x4ca2ab,_0x40cde6){return function(_0x2d4037){if(!_0x2d4037){_0x4ca2ab[_0xcb68('0x17')](0x194);}return _0x2d4037;};}function handleError(_0x5cc661,_0x4dc13f){_0x4dc13f=_0x4dc13f||0x1f4;return function(_0x3e2530){logger[_0xcb68('0x26')](_0x3e2530[_0xcb68('0x27')]);if(_0x3e2530[_0xcb68('0x28')]){delete _0x3e2530[_0xcb68('0x28')];}_0x5cc661[_0xcb68('0x18')](_0x4dc13f)[_0xcb68('0x29')](_0x3e2530);};}exports[_0xcb68('0x2a')]=function(_0x5c27fc,_0x300494){var _0x497c1b={},_0x418375={},_0x420e4a={'count':0x0,'rows':[]};var _0x1afdcc=_['map'](db[_0xcb68('0x2b')]['rawAttributes'],function(_0x2d9341){return{'name':_0x2d9341[_0xcb68('0x2c')],'type':_0x2d9341[_0xcb68('0x2d')][_0xcb68('0x2e')]};});_0x418375[_0xcb68('0x2f')]=_[_0xcb68('0x30')](_0x1afdcc,_0xcb68('0x28'));_0x418375[_0xcb68('0x31')]=_['keys'](_0x5c27fc[_0xcb68('0x31')]);_0x418375[_0xcb68('0x32')]=_[_0xcb68('0x33')](_0x418375[_0xcb68('0x2f')],_0x418375[_0xcb68('0x31')]);_0x497c1b[_0xcb68('0x34')]=_[_0xcb68('0x33')](_0x418375[_0xcb68('0x2f')],qs[_0xcb68('0x35')](_0x5c27fc[_0xcb68('0x31')][_0xcb68('0x35')]));_0x497c1b[_0xcb68('0x34')]=_0x497c1b['attributes'][_0xcb68('0x36')]?_0x497c1b['attributes']:_0x418375[_0xcb68('0x2f')];if(!_0x5c27fc['query']['hasOwnProperty']('nolimit')){_0x497c1b[_0xcb68('0x1d')]=qs[_0xcb68('0x1d')](_0x5c27fc['query'][_0xcb68('0x1d')]);_0x497c1b[_0xcb68('0x1c')]=qs['offset'](_0x5c27fc[_0xcb68('0x31')][_0xcb68('0x1c')]);}_0x497c1b['order']=qs[_0xcb68('0x37')](_0x5c27fc['query'][_0xcb68('0x37')]);_0x497c1b[_0xcb68('0x38')]=qs[_0xcb68('0x32')](_[_0xcb68('0x39')](_0x5c27fc[_0xcb68('0x31')],_0x418375[_0xcb68('0x32')]),_0x1afdcc);if(_0x5c27fc['query'][_0xcb68('0x3a')]){_0x497c1b['where']=_[_0xcb68('0x3b')](_0x497c1b[_0xcb68('0x38')],{'$or':_[_0xcb68('0x30')](_0x1afdcc,function(_0x28e9d4){if(_0x28e9d4[_0xcb68('0x2d')]!==_0xcb68('0x3c')){var _0x209296={};_0x209296[_0x28e9d4[_0xcb68('0x28')]]={'$like':'%'+_0x5c27fc[_0xcb68('0x31')]['filter']+'%'};return _0x209296;}})});}_0x497c1b=_[_0xcb68('0x3b')]({},_0x497c1b,_0x5c27fc[_0xcb68('0x3d')]);var _0x248e6a={'where':_0x497c1b[_0xcb68('0x38')]};return db[_0xcb68('0x2b')][_0xcb68('0x1b')](_0x248e6a)['then'](function(_0x51621b){_0x420e4a[_0xcb68('0x1b')]=_0x51621b;if(_0x5c27fc[_0xcb68('0x31')][_0xcb68('0x3e')]){_0x497c1b['include']=[{'all':!![]}];}return db[_0xcb68('0x2b')][_0xcb68('0x3f')](_0x497c1b);})[_0xcb68('0x21')](function(_0x4be046){_0x420e4a[_0xcb68('0x40')]=_0x4be046;return _0x420e4a;})[_0xcb68('0x21')](respondWithFilteredResult(_0x300494,_0x497c1b))[_0xcb68('0x41')](handleError(_0x300494,null));};exports[_0xcb68('0x42')]=function(_0x3a94ff,_0x4adec5){var _0x27934f={'raw':!![],'where':{'id':_0x3a94ff[_0xcb68('0x43')]['id']}},_0xe58be6={};_0xe58be6[_0xcb68('0x2f')]=_[_0xcb68('0x44')](db[_0xcb68('0x2b')][_0xcb68('0x45')]);_0xe58be6['query']=_[_0xcb68('0x44')](_0x3a94ff['query']);_0xe58be6[_0xcb68('0x32')]=_[_0xcb68('0x33')](_0xe58be6[_0xcb68('0x2f')],_0xe58be6[_0xcb68('0x31')]);_0x27934f[_0xcb68('0x34')]=_['intersection'](_0xe58be6[_0xcb68('0x2f')],qs['fields'](_0x3a94ff[_0xcb68('0x31')][_0xcb68('0x35')]));_0x27934f['attributes']=_0x27934f['attributes'][_0xcb68('0x36')]?_0x27934f['attributes']:_0xe58be6['model'];if(_0x3a94ff[_0xcb68('0x31')][_0xcb68('0x3e')]){_0x27934f[_0xcb68('0x46')]=[{'all':!![]}];}_0x27934f=_[_0xcb68('0x3b')]({},_0x27934f,_0x3a94ff['options']);return db['SquareOdbc'][_0xcb68('0x47')](_0x27934f)[_0xcb68('0x21')](handleEntityNotFound(_0x4adec5,null))[_0xcb68('0x21')](respondWithResult(_0x4adec5,null))[_0xcb68('0x41')](handleError(_0x4adec5,null));};exports[_0xcb68('0x48')]=function(_0x3bd81e,_0x266bec){return db[_0xcb68('0x2b')][_0xcb68('0x48')](_0x3bd81e[_0xcb68('0x49')],{})[_0xcb68('0x21')](function(_0x24794f){var _0x164c2b=_0x3bd81e[_0xcb68('0x4a')][_0xcb68('0x23')]({'plain':!![]});if(!_0x164c2b)throw new Error(_0xcb68('0x4b'));if(_0x164c2b['role']===_0xcb68('0x4a')){var _0x1b7a55=_0x24794f[_0xcb68('0x23')]({'plain':!![]});var _0x4b4ed7=_0xcb68('0x24');return db[_0xcb68('0x4c')]['find']({'where':{'name':_0x4b4ed7,'userProfileId':_0x164c2b[_0xcb68('0x4d')]},'raw':!![]})[_0xcb68('0x21')](function(_0x37615d){if(_0x37615d&&_0x37615d[_0xcb68('0x4e')]===0x0){return db['UserProfileResource'][_0xcb68('0x48')]({'name':_0x1b7a55['name'],'resourceId':_0x1b7a55['id'],'type':_0x37615d[_0xcb68('0x28')],'sectionId':_0x37615d['id']},{})['then'](function(){return _0x24794f;});}else{return _0x24794f;}})['catch'](function(_0x1817e2){logger[_0xcb68('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1817e2);throw _0x1817e2;});}return _0x24794f;})[_0xcb68('0x21')](respondWithResult(_0x266bec,0xc9))['catch'](handleError(_0x266bec,null));};exports[_0xcb68('0x4f')]=function(_0x2feffd,_0x50eced){if(_0x2feffd[_0xcb68('0x49')]['id']){delete _0x2feffd[_0xcb68('0x49')]['id'];}return db[_0xcb68('0x2b')][_0xcb68('0x47')]({'where':{'id':_0x2feffd[_0xcb68('0x43')]['id']}})[_0xcb68('0x21')](handleEntityNotFound(_0x50eced,null))[_0xcb68('0x21')](saveUpdates(_0x2feffd[_0xcb68('0x49')],null))['then'](respondWithResult(_0x50eced,null))['catch'](handleError(_0x50eced,null));};exports[_0xcb68('0x22')]=function(_0x53d3a4,_0x459f59){return db[_0xcb68('0x2b')][_0xcb68('0x47')]({'where':{'id':_0x53d3a4[_0xcb68('0x43')]['id']}})[_0xcb68('0x21')](handleEntityNotFound(_0x459f59,null))[_0xcb68('0x21')](removeEntity(_0x459f59,null))[_0xcb68('0x41')](handleError(_0x459f59,null));};exports[_0xcb68('0x50')]=function(_0x3925c5,_0x2695b9,_0x10616a){var _0x1d45f7;return db['SquareOdbc'][_0xcb68('0x47')]({'where':{'id':_0x3925c5[_0xcb68('0x43')]['id']},'attributes':['id',_0xcb68('0x51')]})[_0xcb68('0x21')](handleEntityNotFound(_0x2695b9,null))[_0xcb68('0x21')](function(_0x807e98){if(_0x807e98){var _0x367e5b=require(_0xcb68('0x52'))();_0x367e5b[_0xcb68('0x53')](_0x807e98['dsn']);_0x367e5b['closeSync']();return _0x807e98;}})[_0xcb68('0x21')](respondWithResult(_0x2695b9,null))[_0xcb68('0x41')](handleError(_0x2695b9,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e78d9e3..f5292f0 100644 --- a/server/api/squareOdbc/squareOdbc.model.js +++ b/server/api/squareOdbc/squareOdbc.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81da=['exports','define','util','../../config/logger','api','moment','request-promise','path'];(function(_0x593204,_0x20a59b){var _0x19944d=function(_0x236e3d){while(--_0x236e3d){_0x593204['push'](_0x593204['shift']());}};_0x19944d(++_0x20a59b);}(_0x81da,0xea));var _0xa81d=function(_0xe1faf1,_0x5cbcc5){_0xe1faf1=_0xe1faf1-0x0;var _0x14359f=_0x81da[_0xe1faf1];return _0x14359f;};'use strict';var _=require('lodash');var util=require(_0xa81d('0x0'));var logger=require(_0xa81d('0x1'))(_0xa81d('0x2'));var moment=require(_0xa81d('0x3'));var BPromise=require('bluebird');var rp=require(_0xa81d('0x4'));var fs=require('fs');var path=require(_0xa81d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xa81d('0x6')]=function(_0x1c7b40,_0x1d9c4a){return _0x1c7b40[_0xa81d('0x7')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa914=['./squareOdbc.attributes','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3c3e20,_0x50ec3f){var _0x5e43e9=function(_0x169eec){while(--_0x169eec){_0x3c3e20['push'](_0x3c3e20['shift']());}};_0x5e43e9(++_0x50ec3f);}(_0xa914,0xce));var _0x4a91=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xa914[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0x4a91('0x0'));var util=require(_0x4a91('0x1'));var logger=require(_0x4a91('0x2'))(_0x4a91('0x3'));var moment=require(_0x4a91('0x4'));var BPromise=require(_0x4a91('0x5'));var rp=require(_0x4a91('0x6'));var fs=require('fs');var path=require(_0x4a91('0x7'));var rimraf=require(_0x4a91('0x8'));var config=require(_0x4a91('0x9'));var attributes=require(_0x4a91('0xa'));module['exports']=function(_0x16f463,_0x11b923){return _0x16f463['define']('SquareOdbc',attributes,{'tableName':_0x4a91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 6a1e3d2..39c543c 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5ab=['SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareOdbc','find','options','raw','where','map','include','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x237b0a,_0x3a5b91){var _0x2a0800=function(_0x1ddefa){while(--_0x1ddefa){_0x237b0a['push'](_0x237b0a['shift']());}};_0x2a0800(++_0x3a5b91);}(_0xb5ab,0x72));var _0xbb5a=function(_0xec39e1,_0x592d3c){_0xec39e1=_0xec39e1-0x0;var _0x455552=_0xb5ab[_0xec39e1];return _0x455552;};'use strict';var _=require(_0xbb5a('0x0'));var util=require('util');var moment=require(_0xbb5a('0x1'));var BPromise=require(_0xbb5a('0x2'));var rs=require(_0xbb5a('0x3'));var fs=require('fs');var Redis=require(_0xbb5a('0x4'));var db=require(_0xbb5a('0x5'))['db'];var utils=require(_0xbb5a('0x6'));var logger=require(_0xbb5a('0x7'))(_0xbb5a('0x8'));var config=require(_0xbb5a('0x9'));var jayson=require(_0xbb5a('0xa'));var client=jayson['client'][_0xbb5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f8619,_0x396ca8,_0x1d640c){return new BPromise(function(_0xc91ba6,_0x2641cf){return client[_0xbb5a('0xc')](_0x4f8619,_0x1d640c)[_0xbb5a('0xd')](function(_0x5e8515){logger[_0xbb5a('0xe')](_0xbb5a('0xf'),_0x396ca8,_0xbb5a('0x10'));logger[_0xbb5a('0x11')](_0xbb5a('0x12'),_0x396ca8,'request\x20sent',JSON[_0xbb5a('0x13')](_0x5e8515));if(_0x5e8515[_0xbb5a('0x14')]){if(_0x5e8515[_0xbb5a('0x14')]['code']===0x1f4){logger[_0xbb5a('0x14')](_0xbb5a('0xf'),_0x396ca8,_0x5e8515[_0xbb5a('0x14')][_0xbb5a('0x15')]);return _0x2641cf(_0x5e8515[_0xbb5a('0x14')][_0xbb5a('0x15')]);}logger[_0xbb5a('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x396ca8,_0x5e8515['error'][_0xbb5a('0x15')]);return _0xc91ba6(_0x5e8515[_0xbb5a('0x14')]['message']);}else{logger['info'](_0xbb5a('0xf'),_0x396ca8,_0xbb5a('0x10'));_0xc91ba6(_0x5e8515[_0xbb5a('0x16')][_0xbb5a('0x15')]);}})[_0xbb5a('0x17')](function(_0x3b4eba){logger[_0xbb5a('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x396ca8,_0x3b4eba);_0x2641cf(_0x3b4eba);});});}exports[_0xbb5a('0x18')]=function(_0x19932c){var _0x5b0046=this;return new Promise(function(_0x4a4970,_0x472729){return db['SquareOdbc'][_0xbb5a('0x19')]({'raw':_0x19932c[_0xbb5a('0x1a')]?_0x19932c[_0xbb5a('0x1a')][_0xbb5a('0x1b')]===undefined?!![]:![]:!![],'where':_0x19932c[_0xbb5a('0x1a')]?_0x19932c[_0xbb5a('0x1a')][_0xbb5a('0x1c')]||null:null,'attributes':_0x19932c[_0xbb5a('0x1a')]?_0x19932c['options']['attributes']||null:null,'include':_0x19932c['options']?_0x19932c['options']['include']?_[_0xbb5a('0x1d')](_0x19932c[_0xbb5a('0x1a')][_0xbb5a('0x1e')],function(_0xc15067){return{'model':db[_0xc15067[_0xbb5a('0x1f')]],'as':_0xc15067['as'],'attributes':_0xc15067['attributes'],'include':_0xc15067[_0xbb5a('0x1e')]?_[_0xbb5a('0x1d')](_0xc15067[_0xbb5a('0x1e')],function(_0x205d61){return{'model':db[_0x205d61[_0xbb5a('0x1f')]],'as':_0x205d61['as'],'attributes':_0x205d61[_0xbb5a('0x20')],'include':_0x205d61['include']?_['map'](_0x205d61[_0xbb5a('0x1e')],function(_0x18080e){return{'model':db[_0x18080e['model']],'as':_0x18080e['as'],'attributes':_0x18080e['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb5a('0xd')](function(_0x1a13cc){logger[_0xbb5a('0xe')](_0xbb5a('0x18'),_0x19932c);logger[_0xbb5a('0x11')](_0xbb5a('0x18'),_0x19932c,JSON['stringify'](_0x1a13cc));_0x4a4970(_0x1a13cc);})[_0xbb5a('0x17')](function(_0x1bce83){logger[_0xbb5a('0x14')](_0xbb5a('0x18'),_0x1bce83[_0xbb5a('0x15')],_0x19932c);_0x472729(_0x5b0046['error'](0x1f4,_0x1bce83[_0xbb5a('0x15')]));});});}; \ No newline at end of file +var _0x572b=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSquareOdbc','find','options','raw','attributes','include','map','model','then','catch','lodash'];(function(_0x57d95f,_0x638c94){var _0x20fddc=function(_0x22e28b){while(--_0x22e28b){_0x57d95f['push'](_0x57d95f['shift']());}};_0x20fddc(++_0x638c94);}(_0x572b,0x1b2));var _0xb572=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0x572b[_0x25701b];return _0x3a8a2c;};'use strict';var _=require(_0xb572('0x0'));var util=require(_0xb572('0x1'));var moment=require(_0xb572('0x2'));var BPromise=require(_0xb572('0x3'));var rs=require(_0xb572('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb572('0x5'))['db'];var utils=require(_0xb572('0x6'));var logger=require(_0xb572('0x7'))('rpc');var config=require(_0xb572('0x8'));var jayson=require(_0xb572('0x9'));var client=jayson[_0xb572('0xa')][_0xb572('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fa9a5,_0x46aafe,_0xe9c455){return new BPromise(function(_0x2166ee,_0x427949){return client[_0xb572('0xc')](_0x2fa9a5,_0xe9c455)['then'](function(_0x34b3df){logger['info'](_0xb572('0xd'),_0x46aafe,_0xb572('0xe'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x46aafe,_0xb572('0xe'),JSON[_0xb572('0xf')](_0x34b3df));if(_0x34b3df[_0xb572('0x10')]){if(_0x34b3df['error']['code']===0x1f4){logger[_0xb572('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x46aafe,_0x34b3df[_0xb572('0x10')][_0xb572('0x11')]);return _0x427949(_0x34b3df[_0xb572('0x10')]['message']);}logger[_0xb572('0x10')](_0xb572('0xd'),_0x46aafe,_0x34b3df[_0xb572('0x10')]['message']);return _0x2166ee(_0x34b3df[_0xb572('0x10')]['message']);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x46aafe,_0xb572('0xe'));_0x2166ee(_0x34b3df[_0xb572('0x12')][_0xb572('0x11')]);}})['catch'](function(_0x3285f9){logger[_0xb572('0x10')](_0xb572('0xd'),_0x46aafe,_0x3285f9);_0x427949(_0x3285f9);});});}exports[_0xb572('0x13')]=function(_0x583ea5){var _0x2b9c04=this;return new Promise(function(_0x18597b,_0x5b9a16){return db['SquareOdbc'][_0xb572('0x14')]({'raw':_0x583ea5[_0xb572('0x15')]?_0x583ea5['options'][_0xb572('0x16')]===undefined?!![]:![]:!![],'where':_0x583ea5['options']?_0x583ea5[_0xb572('0x15')]['where']||null:null,'attributes':_0x583ea5[_0xb572('0x15')]?_0x583ea5[_0xb572('0x15')][_0xb572('0x17')]||null:null,'include':_0x583ea5['options']?_0x583ea5[_0xb572('0x15')][_0xb572('0x18')]?_[_0xb572('0x19')](_0x583ea5['options'][_0xb572('0x18')],function(_0x1cc929){return{'model':db[_0x1cc929[_0xb572('0x1a')]],'as':_0x1cc929['as'],'attributes':_0x1cc929['attributes'],'include':_0x1cc929[_0xb572('0x18')]?_[_0xb572('0x19')](_0x1cc929[_0xb572('0x18')],function(_0x248d1a){return{'model':db[_0x248d1a['model']],'as':_0x248d1a['as'],'attributes':_0x248d1a[_0xb572('0x17')],'include':_0x248d1a[_0xb572('0x18')]?_[_0xb572('0x19')](_0x248d1a[_0xb572('0x18')],function(_0x5e8aba){return{'model':db[_0x5e8aba[_0xb572('0x1a')]],'as':_0x5e8aba['as'],'attributes':_0x5e8aba[_0xb572('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb572('0x1b')](function(_0x2f25ca){logger['info'](_0xb572('0x13'),_0x583ea5);logger['debug'](_0xb572('0x13'),_0x583ea5,JSON['stringify'](_0x2f25ca));_0x18597b(_0x2f25ca);})[_0xb572('0x1c')](function(_0x2c4b07){logger[_0xb572('0x10')](_0xb572('0x13'),_0x2c4b07[_0xb572('0x11')],_0x583ea5);_0x5b9a16(_0x2b9c04[_0xb572('0x10')](0x1f4,_0x2c4b07[_0xb572('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 672394e..d0fa9d2 100644 --- a/server/api/squareProject/index.js +++ b/server/api/squareProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0ee=['getUsers','post','create','addUsers','put','/:id','update','destroy','delete','removeUsers','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id/users'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd0ee,0x19a));var _0xed0e=function(_0x4b529f,_0x5d76c7){_0x4b529f=_0x4b529f-0x0;var _0x53319c=_0xd0ee[_0x4b529f];return _0x53319c;};'use strict';var multer=require('multer');var util=require(_0xed0e('0x0'));var path=require('path');var timeout=require(_0xed0e('0x1'));var express=require(_0xed0e('0x2'));var router=express['Router']();var fs_extra=require(_0xed0e('0x3'));var auth=require(_0xed0e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xed0e('0x5'));var controller=require(_0xed0e('0x6'));router[_0xed0e('0x7')]('/',auth[_0xed0e('0x8')](),controller['index']);router['get']('/:id',auth[_0xed0e('0x8')](),controller['show']);router[_0xed0e('0x7')](_0xed0e('0x9'),auth['isAuthenticated'](),controller[_0xed0e('0xa')]);router[_0xed0e('0xb')]('/',auth['isAuthenticated'](),controller[_0xed0e('0xc')]);router[_0xed0e('0xb')](_0xed0e('0x9'),auth['isAuthenticated'](),controller[_0xed0e('0xd')]);router[_0xed0e('0xe')](_0xed0e('0xf'),auth[_0xed0e('0x8')](),controller[_0xed0e('0x10')]);router['delete'](_0xed0e('0xf'),auth[_0xed0e('0x8')](),controller[_0xed0e('0x11')]);router[_0xed0e('0x12')](_0xed0e('0x9'),auth['isAuthenticated'](),controller[_0xed0e('0x13')]);module[_0xed0e('0x14')]=router; \ No newline at end of file +var _0x3da6=['getUsers','post','/:id/users','addUsers','put','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x3da6,0xc1));var _0x63da=function(_0x58d204,_0x24719a){_0x58d204=_0x58d204-0x0;var _0x26a36a=_0x3da6[_0x58d204];return _0x26a36a;};'use strict';var multer=require(_0x63da('0x0'));var util=require(_0x63da('0x1'));var path=require(_0x63da('0x2'));var timeout=require(_0x63da('0x3'));var express=require(_0x63da('0x4'));var router=express[_0x63da('0x5')]();var fs_extra=require(_0x63da('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x63da('0x7'));var config=require(_0x63da('0x8'));var controller=require('./squareProject.controller');router[_0x63da('0x9')]('/',auth['isAuthenticated'](),controller[_0x63da('0xa')]);router['get'](_0x63da('0xb'),auth[_0x63da('0xc')](),controller[_0x63da('0xd')]);router[_0x63da('0x9')]('/:id/users',auth[_0x63da('0xc')](),controller[_0x63da('0xe')]);router['post']('/',auth[_0x63da('0xc')](),controller['create']);router[_0x63da('0xf')](_0x63da('0x10'),auth[_0x63da('0xc')](),controller[_0x63da('0x11')]);router[_0x63da('0x12')]('/:id',auth[_0x63da('0xc')](),controller['update']);router[_0x63da('0x13')](_0x63da('0xb'),auth[_0x63da('0xc')](),controller[_0x63da('0x14')]);router[_0x63da('0x13')](_0x63da('0x10'),auth[_0x63da('0xc')](),controller[_0x63da('0x15')]);module[_0x63da('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 62ee3da..3732893 100644 --- a/server/api/squareProject/squareProject.attributes.js +++ b/server/api/squareProject/squareProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8137=['long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB'];(function(_0x40adfb,_0x5ab1a2){var _0x5b74d1=function(_0x51ce8a){while(--_0x51ce8a){_0x40adfb['push'](_0x40adfb['shift']());}};_0x5b74d1(++_0x5ab1a2);}(_0x8137,0x180));var _0x7813=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8137[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x7813('0x0'));module[_0x7813('0x1')]={'name':{'type':Sequelize[_0x7813('0x2')],'unique':_0x7813('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7813('0x2')]},'notes':{'type':Sequelize[_0x7813('0x4')]},'preproduction':{'type':Sequelize[_0x7813('0x5')](_0x7813('0x6')),'get':function(){if(this[_0x7813('0x7')]('preproduction')){return this[_0x7813('0x7')](_0x7813('0x8'))[_0x7813('0x9')](_0x7813('0xa'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0x7813('0xb'))){return this['getDataValue'](_0x7813('0xb'))[_0x7813('0x9')](_0x7813('0xa'));}}},'savedAt':{'type':Sequelize[_0x7813('0xc')]},'publishedAt':{'type':Sequelize[_0x7813('0xc')]}}; \ No newline at end of file +var _0xa1c9=['name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING'];(function(_0x1d1867,_0x31a490){var _0x31202e=function(_0xad696f){while(--_0xad696f){_0x1d1867['push'](_0x1d1867['shift']());}};_0x31202e(++_0x31a490);}(_0xa1c9,0x135));var _0x9a1c=function(_0x30ebcc,_0x307cf4){_0x30ebcc=_0x30ebcc-0x0;var _0x19b3d8=_0xa1c9[_0x30ebcc];return _0x19b3d8;};'use strict';var Sequelize=require(_0x9a1c('0x0'));module[_0x9a1c('0x1')]={'name':{'type':Sequelize[_0x9a1c('0x2')],'unique':_0x9a1c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9a1c('0x2')]},'notes':{'type':Sequelize[_0x9a1c('0x4')]},'preproduction':{'type':Sequelize[_0x9a1c('0x5')](_0x9a1c('0x6')),'get':function(){if(this[_0x9a1c('0x7')]('preproduction')){return this[_0x9a1c('0x7')](_0x9a1c('0x8'))[_0x9a1c('0x9')](_0x9a1c('0xa'));}}},'production':{'type':Sequelize[_0x9a1c('0x5')]('long'),'get':function(){if(this[_0x9a1c('0x7')](_0x9a1c('0xb'))){return this['getDataValue']('production')['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x9a1c('0xc')]},'publishedAt':{'type':Sequelize[_0x9a1c('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 4144128..ca76f72 100644 --- a/server/api/squareProject/squareProject.controller.js +++ b/server/api/squareProject/squareProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf74d=['length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','includeAll','findAll','rows','catch','params','rawAttributes','filters','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','merge','getUsers','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','SquareProjects','UserProfileResource','error','stack','index','map','SquareProject','fieldName','key','name','query','keys','intersection','model','fields','attributes'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xf74d,0xf3));var _0xdf74=function(_0x41a381,_0x2dc10d){_0x41a381=_0x41a381-0x0;var _0x12f565=_0xf74d[_0x41a381];return _0x12f565;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf74('0x0'));var zipdir=require(_0xdf74('0x1'));var jsonpatch=require(_0xdf74('0x2'));var rp=require(_0xdf74('0x3'));var moment=require(_0xdf74('0x4'));var BPromise=require(_0xdf74('0x5'));var Mustache=require(_0xdf74('0x6'));var util=require(_0xdf74('0x7'));var path=require(_0xdf74('0x8'));var sox=require('sox');var csv=require(_0xdf74('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf74('0xa'));var _=require(_0xdf74('0xb'));var squel=require(_0xdf74('0xc'));var crypto=require(_0xdf74('0xd'));var jsforce=require(_0xdf74('0xe'));var deskjs=require(_0xdf74('0xf'));var toCsv=require(_0xdf74('0x9'));var querystring=require('querystring');var Papa=require(_0xdf74('0x10'));var Redis=require(_0xdf74('0x11'));var authService=require(_0xdf74('0x12'));var qs=require(_0xdf74('0x13'));var as=require(_0xdf74('0x14'));var hardwareService=require(_0xdf74('0x15'));var logger=require(_0xdf74('0x16'))(_0xdf74('0x17'));var utils=require(_0xdf74('0x18'));var config=require(_0xdf74('0x19'));var licenseUtil=require(_0xdf74('0x1a'));var db=require('../../mysqldb')['db'];config[_0xdf74('0x1b')]=_[_0xdf74('0x1c')](config['redis'],{'host':_0xdf74('0x1d'),'port':0x18eb});var socket=require(_0xdf74('0x1e'))(new Redis(config[_0xdf74('0x1b')]));require(_0xdf74('0x1f'))['register'](socket);function respondWithStatusCode(_0x54e67c,_0xd88937){_0xd88937=_0xd88937||0xcc;return function(_0x2017d0){if(_0x2017d0){return _0x54e67c[_0xdf74('0x20')](_0xd88937);}return _0x54e67c[_0xdf74('0x21')](_0xd88937)['end']();};}function respondWithResult(_0x46e4ef,_0x3d4c35){_0x3d4c35=_0x3d4c35||0xc8;return function(_0x3f9e0a){if(_0x3f9e0a){return _0x46e4ef['status'](_0x3d4c35)['json'](_0x3f9e0a);}};}function respondWithFilteredResult(_0x2b3ea4,_0x34c305){return function(_0x11c983){if(_0x11c983){var _0x2719c0=typeof _0x34c305[_0xdf74('0x22')]==='undefined'&&typeof _0x34c305[_0xdf74('0x23')]===_0xdf74('0x24');var _0x473601=_0x11c983['count'];var _0x493592=_0x2719c0?0x0:_0x34c305['offset'];var _0x12630b=_0x2719c0?_0x11c983[_0xdf74('0x25')]:_0x34c305['offset']+_0x34c305[_0xdf74('0x23')];var _0x22985d;if(_0x12630b>=_0x473601){_0x12630b=_0x473601;_0x22985d=0xc8;}else{_0x22985d=0xce;}_0x2b3ea4[_0xdf74('0x21')](_0x22985d);return _0x2b3ea4[_0xdf74('0x26')](_0xdf74('0x27'),_0x493592+'-'+_0x12630b+'/'+_0x473601)[_0xdf74('0x28')](_0x11c983);}return null;};}function patchUpdates(_0x3f0792){return function(_0xe614ac){try{jsonpatch[_0xdf74('0x29')](_0xe614ac,_0x3f0792,!![]);}catch(_0x1aa3b6){return BPromise[_0xdf74('0x2a')](_0x1aa3b6);}return _0xe614ac[_0xdf74('0x2b')]();};}function saveUpdates(_0x52e3e2,_0x374cb0){return function(_0xba3a24){if(_0xba3a24){return _0xba3a24[_0xdf74('0x2c')](_0x52e3e2)['then'](function(_0x342c8d){return _0x342c8d;});}return null;};}function removeEntity(_0x4b055f,_0x30f6c1){return function(_0x4a2ffb){if(_0x4a2ffb){return _0x4a2ffb[_0xdf74('0x2d')]()[_0xdf74('0x2e')](function(){var _0x50e19e=_0x4a2ffb['get']({'plain':!![]});var _0x21f191=_0xdf74('0x2f');return db[_0xdf74('0x30')][_0xdf74('0x2d')]({'where':{'type':_0x21f191,'resourceId':_0x50e19e['id']}})['then'](function(){return _0x4a2ffb;});})['then'](function(){_0x4b055f[_0xdf74('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa00edc,_0x32fbae){return function(_0x555c12){if(!_0x555c12){_0xa00edc['sendStatus'](0x194);}return _0x555c12;};}function handleError(_0x1754d7,_0x539a3e){_0x539a3e=_0x539a3e||0x1f4;return function(_0x5063ff){logger[_0xdf74('0x31')](_0x5063ff[_0xdf74('0x32')]);if(_0x5063ff['name']){delete _0x5063ff['name'];}_0x1754d7[_0xdf74('0x21')](_0x539a3e)['send'](_0x5063ff);};}exports[_0xdf74('0x33')]=function(_0x59c4ec,_0x564912){var _0x4e3af8={},_0xc6aaf1={},_0x5d3073={'count':0x0,'rows':[]};var _0x4abbde=_[_0xdf74('0x34')](db[_0xdf74('0x35')]['rawAttributes'],function(_0x1c309b){return{'name':_0x1c309b[_0xdf74('0x36')],'type':_0x1c309b['type'][_0xdf74('0x37')]};});_0xc6aaf1['model']=_[_0xdf74('0x34')](_0x4abbde,_0xdf74('0x38'));_0xc6aaf1[_0xdf74('0x39')]=_[_0xdf74('0x3a')](_0x59c4ec[_0xdf74('0x39')]);_0xc6aaf1['filters']=_[_0xdf74('0x3b')](_0xc6aaf1[_0xdf74('0x3c')],_0xc6aaf1['query']);_0x4e3af8['attributes']=_['intersection'](_0xc6aaf1[_0xdf74('0x3c')],qs[_0xdf74('0x3d')](_0x59c4ec['query'][_0xdf74('0x3d')]));_0x4e3af8[_0xdf74('0x3e')]=_0x4e3af8[_0xdf74('0x3e')][_0xdf74('0x3f')]?_0x4e3af8[_0xdf74('0x3e')]:_0xc6aaf1[_0xdf74('0x3c')];if(!_0x59c4ec[_0xdf74('0x39')]['hasOwnProperty'](_0xdf74('0x40'))){_0x4e3af8[_0xdf74('0x23')]=qs[_0xdf74('0x23')](_0x59c4ec['query'][_0xdf74('0x23')]);_0x4e3af8[_0xdf74('0x22')]=qs[_0xdf74('0x22')](_0x59c4ec[_0xdf74('0x39')][_0xdf74('0x22')]);}_0x4e3af8[_0xdf74('0x41')]=qs[_0xdf74('0x42')](_0x59c4ec[_0xdf74('0x39')][_0xdf74('0x42')]);_0x4e3af8[_0xdf74('0x43')]=qs['filters'](_[_0xdf74('0x44')](_0x59c4ec[_0xdf74('0x39')],_0xc6aaf1['filters']),_0x4abbde);if(_0x59c4ec['query']['filter']){_0x4e3af8['where']=_['merge'](_0x4e3af8[_0xdf74('0x43')],{'$or':_[_0xdf74('0x34')](_0x4abbde,function(_0x49d1df){if(_0x49d1df[_0xdf74('0x45')]!==_0xdf74('0x46')){var _0x43aa2e={};_0x43aa2e[_0x49d1df[_0xdf74('0x38')]]={'$like':'%'+_0x59c4ec['query'][_0xdf74('0x47')]+'%'};return _0x43aa2e;}})});}_0x4e3af8=_['merge']({},_0x4e3af8,_0x59c4ec['options']);var _0x254378={'where':_0x4e3af8['where']};return db[_0xdf74('0x35')][_0xdf74('0x25')](_0x254378)[_0xdf74('0x2e')](function(_0x4482b3){_0x5d3073[_0xdf74('0x25')]=_0x4482b3;if(_0x59c4ec[_0xdf74('0x39')][_0xdf74('0x48')]){_0x4e3af8['include']=[{'all':!![]}];}return db[_0xdf74('0x35')][_0xdf74('0x49')](_0x4e3af8);})[_0xdf74('0x2e')](function(_0xc2df5a){_0x5d3073[_0xdf74('0x4a')]=_0xc2df5a;return _0x5d3073;})[_0xdf74('0x2e')](respondWithFilteredResult(_0x564912,_0x4e3af8))[_0xdf74('0x4b')](handleError(_0x564912,null));};exports['show']=function(_0x4a7b69,_0x1af831){var _0x1cfe9c={'raw':![],'where':{'id':_0x4a7b69[_0xdf74('0x4c')]['id']}},_0x1d70d9={};_0x1d70d9[_0xdf74('0x3c')]=_[_0xdf74('0x3a')](db[_0xdf74('0x35')][_0xdf74('0x4d')]);_0x1d70d9['query']=_[_0xdf74('0x3a')](_0x4a7b69[_0xdf74('0x39')]);_0x1d70d9[_0xdf74('0x4e')]=_[_0xdf74('0x3b')](_0x1d70d9[_0xdf74('0x3c')],_0x1d70d9['query']);_0x1cfe9c[_0xdf74('0x3e')]=_[_0xdf74('0x3b')](_0x1d70d9[_0xdf74('0x3c')],qs[_0xdf74('0x3d')](_0x4a7b69[_0xdf74('0x39')][_0xdf74('0x3d')]));_0x1cfe9c[_0xdf74('0x3e')]=_0x1cfe9c['attributes']['length']?_0x1cfe9c[_0xdf74('0x3e')]:_0x1d70d9['model'];if(_0x4a7b69[_0xdf74('0x39')]['includeAll']){_0x1cfe9c[_0xdf74('0x4f')]=[{'all':!![]}];}_0x1cfe9c=_['merge']({},_0x1cfe9c,_0x4a7b69[_0xdf74('0x50')]);return db[_0xdf74('0x35')][_0xdf74('0x51')](_0x1cfe9c)['then'](handleEntityNotFound(_0x1af831,null))[_0xdf74('0x2e')](respondWithResult(_0x1af831,null))[_0xdf74('0x4b')](handleError(_0x1af831,null));};exports['create']=function(_0x371e76,_0x39a476){return db[_0xdf74('0x35')][_0xdf74('0x52')](_0x371e76[_0xdf74('0x53')],{})[_0xdf74('0x2e')](function(_0x4d0a4b){var _0x32ee2a=_0x371e76[_0xdf74('0x54')]['get']({'plain':!![]});if(!_0x32ee2a)throw new Error(_0xdf74('0x55'));if(_0x32ee2a['role']===_0xdf74('0x54')){var _0x31fd70=_0x4d0a4b[_0xdf74('0x56')]({'plain':!![]});var _0x2d8cdd=_0xdf74('0x2f');return db['UserProfileSection'][_0xdf74('0x51')]({'where':{'name':_0x2d8cdd,'userProfileId':_0x32ee2a[_0xdf74('0x57')]},'raw':!![]})[_0xdf74('0x2e')](function(_0xfba867){if(_0xfba867&&_0xfba867[_0xdf74('0x58')]===0x0){return db[_0xdf74('0x30')][_0xdf74('0x52')]({'name':_0x31fd70[_0xdf74('0x38')],'resourceId':_0x31fd70['id'],'type':_0xfba867['name'],'sectionId':_0xfba867['id']},{})['then'](function(){return _0x4d0a4b;});}else{return _0x4d0a4b;}})[_0xdf74('0x4b')](function(_0x3a3def){logger[_0xdf74('0x31')](_0xdf74('0x59'),_0x3a3def);throw _0x3a3def;});}return _0x4d0a4b;})['then'](respondWithResult(_0x39a476,0xc9))[_0xdf74('0x4b')](handleError(_0x39a476,null));};exports[_0xdf74('0x2c')]=function(_0x244713,_0xd6a9e2){if(_0x244713[_0xdf74('0x53')]['id']){delete _0x244713[_0xdf74('0x53')]['id'];}return db[_0xdf74('0x35')][_0xdf74('0x51')]({'where':{'id':_0x244713[_0xdf74('0x4c')]['id']}})[_0xdf74('0x2e')](handleEntityNotFound(_0xd6a9e2,null))['then'](saveUpdates(_0x244713[_0xdf74('0x53')],null))[_0xdf74('0x2e')](respondWithResult(_0xd6a9e2,null))[_0xdf74('0x4b')](handleError(_0xd6a9e2,null));};exports[_0xdf74('0x2d')]=function(_0x1a31ab,_0x28b6e9){return db[_0xdf74('0x35')][_0xdf74('0x51')]({'where':{'id':_0x1a31ab[_0xdf74('0x4c')]['id']}})['then'](handleEntityNotFound(_0x28b6e9,null))['then'](removeEntity(_0x28b6e9,null))[_0xdf74('0x4b')](handleError(_0x28b6e9,null));};exports['addUsers']=function(_0x3faa35,_0x24473a,_0x3e204d){return db['SquareProject'][_0xdf74('0x51')]({'where':{'id':_0x3faa35[_0xdf74('0x4c')]['id']}})[_0xdf74('0x2e')](handleEntityNotFound(_0x24473a,null))[_0xdf74('0x2e')](function(_0x43707a){if(_0x43707a){return _0x43707a[_0xdf74('0x5a')](_0x3faa35[_0xdf74('0x53')][_0xdf74('0x5b')],_[_0xdf74('0x5c')](_0x3faa35[_0xdf74('0x53')],[_0xdf74('0x5b'),'id'])||{});}})[_0xdf74('0x2e')](respondWithResult(_0x24473a,null))[_0xdf74('0x4b')](handleError(_0x24473a,null));};exports['removeUsers']=function(_0x44aecd,_0x43f0ff,_0x58a27e){return db['SquareProject'][_0xdf74('0x51')]({'where':{'id':_0x44aecd[_0xdf74('0x4c')]['id']}})[_0xdf74('0x2e')](handleEntityNotFound(_0x43f0ff,null))['then'](function(_0x1a502f){if(_0x1a502f){return _0x1a502f[_0xdf74('0x5d')](_0x44aecd[_0xdf74('0x39')]['ids'])[_0xdf74('0x2e')](function(){if(_[_0xdf74('0x5e')](_0x44aecd['query'][_0xdf74('0x5b')])){for(var _0x2e1f65=0x0;_0x2e1f65<_0x44aecd[_0xdf74('0x39')][_0xdf74('0x5b')][_0xdf74('0x3f')];_0x2e1f65+=0x1){socket[_0xdf74('0x5f')](_0xdf74('0x60'),{'UserId':Number(_0x44aecd[_0xdf74('0x39')][_0xdf74('0x5b')][_0x2e1f65]),'SquareProjectId':Number(_0x44aecd[_0xdf74('0x4c')]['id'])});}}else{socket[_0xdf74('0x5f')](_0xdf74('0x60'),{'UserId':Number(_0x44aecd['query'][_0xdf74('0x5b')]),'SquareProjectId':Number(_0x44aecd['params']['id'])});}});}})['then'](respondWithStatusCode(_0x43f0ff,null))[_0xdf74('0x4b')](handleError(_0x43f0ff,null));};exports['getUsers']=function(_0x116933,_0x246f46,_0x3cc695){var _0x23aebf={};var _0x28470b={};var _0x3be7c1;var _0x4da422;return db[_0xdf74('0x35')][_0xdf74('0x61')]({'where':{'id':_0x116933[_0xdf74('0x4c')]['id']}})[_0xdf74('0x2e')](handleEntityNotFound(_0x246f46,null))[_0xdf74('0x2e')](function(_0x3eb375){if(_0x3eb375){_0x3be7c1=_0x3eb375;_0x28470b[_0xdf74('0x3c')]=_['keys'](db[_0xdf74('0x62')][_0xdf74('0x4d')]);_0x28470b['query']=_[_0xdf74('0x3a')](_0x116933[_0xdf74('0x39')]);_0x28470b[_0xdf74('0x4e')]=_[_0xdf74('0x3b')](_0x28470b[_0xdf74('0x3c')],_0x28470b[_0xdf74('0x39')]);_0x23aebf['attributes']=_[_0xdf74('0x3b')](_0x28470b[_0xdf74('0x3c')],qs[_0xdf74('0x3d')](_0x116933[_0xdf74('0x39')][_0xdf74('0x3d')]));_0x23aebf[_0xdf74('0x3e')]=_0x23aebf[_0xdf74('0x3e')][_0xdf74('0x3f')]?_0x23aebf['attributes']:_0x28470b[_0xdf74('0x3c')];_0x23aebf['order']=qs[_0xdf74('0x42')](_0x116933[_0xdf74('0x39')][_0xdf74('0x42')]);_0x23aebf[_0xdf74('0x43')]=qs[_0xdf74('0x4e')](_[_0xdf74('0x44')](_0x116933[_0xdf74('0x39')],_0x28470b[_0xdf74('0x4e')]));if(_0x116933[_0xdf74('0x39')]['filter']){_0x23aebf[_0xdf74('0x43')]=_[_0xdf74('0x63')](_0x23aebf['where'],{'$or':_[_0xdf74('0x34')](_0x23aebf[_0xdf74('0x3e')],function(_0x21a555){var _0x4b5763={};_0x4b5763[_0x21a555]={'$like':'%'+_0x116933['query']['filter']+'%'};return _0x4b5763;})});}_0x23aebf=_[_0xdf74('0x63')]({},_0x23aebf,_0x116933[_0xdf74('0x50')]);return _0x3be7c1[_0xdf74('0x64')](_0x23aebf);}})['then'](function(_0x689ab8){if(_0x689ab8){_0x4da422=_0x689ab8[_0xdf74('0x3f')];if(!_0x116933['query'][_0xdf74('0x65')](_0xdf74('0x40'))){_0x23aebf[_0xdf74('0x23')]=qs[_0xdf74('0x23')](_0x116933[_0xdf74('0x39')][_0xdf74('0x23')]);_0x23aebf[_0xdf74('0x22')]=qs[_0xdf74('0x22')](_0x116933[_0xdf74('0x39')][_0xdf74('0x22')]);}return _0x3be7c1['getUsers'](_0x23aebf);}})[_0xdf74('0x2e')](function(_0x2f2290){if(_0x2f2290){return _0x2f2290?{'count':_0x4da422,'rows':_0x2f2290}:null;}})[_0xdf74('0x2e')](respondWithResult(_0x246f46,null))[_0xdf74('0x4b')](handleError(_0x246f46,null));}; \ No newline at end of file +var _0xbd9e=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','limit','undefined','count','offset','apply','save','then','get','UserProfileResource','destroy','error','name','send','index','map','SquareProject','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','rawAttributes','filters','length','includeAll','find','catch','user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x39578c,_0x23635b){var _0x15ee51=function(_0x1fb117){while(--_0x1fb117){_0x39578c['push'](_0x39578c['shift']());}};_0x15ee51(++_0x23635b);}(_0xbd9e,0x113));var _0xebd9=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xbd9e[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require(_0xebd9('0x0'));var rimraf=require(_0xebd9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebd9('0x2'));var rp=require('request-promise');var moment=require(_0xebd9('0x3'));var BPromise=require(_0xebd9('0x4'));var Mustache=require(_0xebd9('0x5'));var util=require(_0xebd9('0x6'));var path=require(_0xebd9('0x7'));var sox=require(_0xebd9('0x8'));var csv=require(_0xebd9('0x9'));var ejs=require(_0xebd9('0xa'));var fs=require('fs');var fs_extra=require(_0xebd9('0xb'));var _=require('lodash');var squel=require(_0xebd9('0xc'));var crypto=require(_0xebd9('0xd'));var jsforce=require(_0xebd9('0xe'));var deskjs=require(_0xebd9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xebd9('0x10'));var Papa=require('papaparse');var Redis=require(_0xebd9('0x11'));var authService=require(_0xebd9('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebd9('0x13'));var logger=require('../../config/logger')(_0xebd9('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xebd9('0x15'));var db=require(_0xebd9('0x16'))['db'];config[_0xebd9('0x17')]=_[_0xebd9('0x18')](config[_0xebd9('0x17')],{'host':_0xebd9('0x19'),'port':0x18eb});var socket=require(_0xebd9('0x1a'))(new Redis(config['redis']));require(_0xebd9('0x1b'))['register'](socket);function respondWithStatusCode(_0x15709f,_0xa8a21d){_0xa8a21d=_0xa8a21d||0xcc;return function(_0x4e8471){if(_0x4e8471){return _0x15709f[_0xebd9('0x1c')](_0xa8a21d);}return _0x15709f[_0xebd9('0x1d')](_0xa8a21d)[_0xebd9('0x1e')]();};}function respondWithResult(_0x1779f8,_0x3fa01e){_0x3fa01e=_0x3fa01e||0xc8;return function(_0x2b40af){if(_0x2b40af){return _0x1779f8[_0xebd9('0x1d')](_0x3fa01e)[_0xebd9('0x1f')](_0x2b40af);}};}function respondWithFilteredResult(_0x304b3e,_0x33e527){return function(_0x5c0af1){if(_0x5c0af1){var _0xdd7cf9=typeof _0x33e527['offset']==='undefined'&&typeof _0x33e527[_0xebd9('0x20')]===_0xebd9('0x21');var _0x113116=_0x5c0af1[_0xebd9('0x22')];var _0x398d20=_0xdd7cf9?0x0:_0x33e527[_0xebd9('0x23')];var _0x50100d=_0xdd7cf9?_0x5c0af1[_0xebd9('0x22')]:_0x33e527[_0xebd9('0x23')]+_0x33e527[_0xebd9('0x20')];var _0x11df79;if(_0x50100d>=_0x113116){_0x50100d=_0x113116;_0x11df79=0xc8;}else{_0x11df79=0xce;}_0x304b3e[_0xebd9('0x1d')](_0x11df79);return _0x304b3e['set']('Content-Range',_0x398d20+'-'+_0x50100d+'/'+_0x113116)[_0xebd9('0x1f')](_0x5c0af1);}return null;};}function patchUpdates(_0x2d0396){return function(_0x305160){try{jsonpatch[_0xebd9('0x24')](_0x305160,_0x2d0396,!![]);}catch(_0x21f58b){return BPromise['reject'](_0x21f58b);}return _0x305160[_0xebd9('0x25')]();};}function saveUpdates(_0x44ae84,_0x2f4e43){return function(_0x543ea7){if(_0x543ea7){return _0x543ea7['update'](_0x44ae84)['then'](function(_0x342ad4){return _0x342ad4;});}return null;};}function removeEntity(_0x4361a6,_0x53e9c8){return function(_0x691f03){if(_0x691f03){return _0x691f03['destroy']()[_0xebd9('0x26')](function(){var _0x2da861=_0x691f03[_0xebd9('0x27')]({'plain':!![]});var _0x331c49='SquareProjects';return db[_0xebd9('0x28')][_0xebd9('0x29')]({'where':{'type':_0x331c49,'resourceId':_0x2da861['id']}})[_0xebd9('0x26')](function(){return _0x691f03;});})['then'](function(){_0x4361a6[_0xebd9('0x1d')](0xcc)[_0xebd9('0x1e')]();});}};}function handleEntityNotFound(_0x5b0b9f,_0x21bbdb){return function(_0x4ed50a){if(!_0x4ed50a){_0x5b0b9f[_0xebd9('0x1c')](0x194);}return _0x4ed50a;};}function handleError(_0x297bb4,_0x8bb54f){_0x8bb54f=_0x8bb54f||0x1f4;return function(_0x9fe7cb){logger[_0xebd9('0x2a')](_0x9fe7cb['stack']);if(_0x9fe7cb[_0xebd9('0x2b')]){delete _0x9fe7cb[_0xebd9('0x2b')];}_0x297bb4[_0xebd9('0x1d')](_0x8bb54f)[_0xebd9('0x2c')](_0x9fe7cb);};}exports[_0xebd9('0x2d')]=function(_0x15ef8e,_0x2974a0){var _0x420156={},_0x1a3067={},_0x550ef8={'count':0x0,'rows':[]};var _0x5b5c67=_[_0xebd9('0x2e')](db[_0xebd9('0x2f')]['rawAttributes'],function(_0xb1ea7f){return{'name':_0xb1ea7f[_0xebd9('0x30')],'type':_0xb1ea7f[_0xebd9('0x31')][_0xebd9('0x32')]};});_0x1a3067[_0xebd9('0x33')]=_[_0xebd9('0x2e')](_0x5b5c67,_0xebd9('0x2b'));_0x1a3067[_0xebd9('0x34')]=_[_0xebd9('0x35')](_0x15ef8e[_0xebd9('0x34')]);_0x1a3067['filters']=_[_0xebd9('0x36')](_0x1a3067['model'],_0x1a3067[_0xebd9('0x34')]);_0x420156[_0xebd9('0x37')]=_['intersection'](_0x1a3067[_0xebd9('0x33')],qs[_0xebd9('0x38')](_0x15ef8e[_0xebd9('0x34')][_0xebd9('0x38')]));_0x420156[_0xebd9('0x37')]=_0x420156[_0xebd9('0x37')]['length']?_0x420156[_0xebd9('0x37')]:_0x1a3067[_0xebd9('0x33')];if(!_0x15ef8e[_0xebd9('0x34')][_0xebd9('0x39')]('nolimit')){_0x420156['limit']=qs[_0xebd9('0x20')](_0x15ef8e[_0xebd9('0x34')]['limit']);_0x420156['offset']=qs[_0xebd9('0x23')](_0x15ef8e[_0xebd9('0x34')][_0xebd9('0x23')]);}_0x420156[_0xebd9('0x3a')]=qs[_0xebd9('0x3b')](_0x15ef8e[_0xebd9('0x34')]['sort']);_0x420156[_0xebd9('0x3c')]=qs['filters'](_[_0xebd9('0x3d')](_0x15ef8e[_0xebd9('0x34')],_0x1a3067['filters']),_0x5b5c67);if(_0x15ef8e[_0xebd9('0x34')][_0xebd9('0x3e')]){_0x420156['where']=_['merge'](_0x420156[_0xebd9('0x3c')],{'$or':_[_0xebd9('0x2e')](_0x5b5c67,function(_0x14ccaf){if(_0x14ccaf['type']!=='VIRTUAL'){var _0x275444={};_0x275444[_0x14ccaf[_0xebd9('0x2b')]]={'$like':'%'+_0x15ef8e[_0xebd9('0x34')][_0xebd9('0x3e')]+'%'};return _0x275444;}})});}_0x420156=_[_0xebd9('0x3f')]({},_0x420156,_0x15ef8e[_0xebd9('0x40')]);var _0x52f92b={'where':_0x420156[_0xebd9('0x3c')]};return db[_0xebd9('0x2f')][_0xebd9('0x22')](_0x52f92b)[_0xebd9('0x26')](function(_0x43bcdf){_0x550ef8[_0xebd9('0x22')]=_0x43bcdf;if(_0x15ef8e[_0xebd9('0x34')]['includeAll']){_0x420156[_0xebd9('0x41')]=[{'all':!![]}];}return db[_0xebd9('0x2f')][_0xebd9('0x42')](_0x420156);})[_0xebd9('0x26')](function(_0x5a5e46){_0x550ef8[_0xebd9('0x43')]=_0x5a5e46;return _0x550ef8;})[_0xebd9('0x26')](respondWithFilteredResult(_0x2974a0,_0x420156))['catch'](handleError(_0x2974a0,null));};exports['show']=function(_0x20be0e,_0x4afd31){var _0x3c3a85={'raw':![],'where':{'id':_0x20be0e[_0xebd9('0x44')]['id']}},_0x23acaa={};_0x23acaa[_0xebd9('0x33')]=_['keys'](db[_0xebd9('0x2f')][_0xebd9('0x45')]);_0x23acaa[_0xebd9('0x34')]=_[_0xebd9('0x35')](_0x20be0e[_0xebd9('0x34')]);_0x23acaa[_0xebd9('0x46')]=_[_0xebd9('0x36')](_0x23acaa[_0xebd9('0x33')],_0x23acaa['query']);_0x3c3a85[_0xebd9('0x37')]=_['intersection'](_0x23acaa['model'],qs[_0xebd9('0x38')](_0x20be0e['query'][_0xebd9('0x38')]));_0x3c3a85[_0xebd9('0x37')]=_0x3c3a85[_0xebd9('0x37')][_0xebd9('0x47')]?_0x3c3a85[_0xebd9('0x37')]:_0x23acaa[_0xebd9('0x33')];if(_0x20be0e[_0xebd9('0x34')][_0xebd9('0x48')]){_0x3c3a85[_0xebd9('0x41')]=[{'all':!![]}];}_0x3c3a85=_['merge']({},_0x3c3a85,_0x20be0e[_0xebd9('0x40')]);return db[_0xebd9('0x2f')][_0xebd9('0x49')](_0x3c3a85)[_0xebd9('0x26')](handleEntityNotFound(_0x4afd31,null))[_0xebd9('0x26')](respondWithResult(_0x4afd31,null))[_0xebd9('0x4a')](handleError(_0x4afd31,null));};exports['create']=function(_0x567384,_0x20158f){return db[_0xebd9('0x2f')]['create'](_0x567384['body'],{})[_0xebd9('0x26')](function(_0x421e62){var _0x29fb3b=_0x567384[_0xebd9('0x4b')][_0xebd9('0x27')]({'plain':!![]});if(!_0x29fb3b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29fb3b[_0xebd9('0x4c')]===_0xebd9('0x4b')){var _0x2c5104=_0x421e62[_0xebd9('0x27')]({'plain':!![]});var _0xf82ea5=_0xebd9('0x4d');return db[_0xebd9('0x4e')][_0xebd9('0x49')]({'where':{'name':_0xf82ea5,'userProfileId':_0x29fb3b[_0xebd9('0x4f')]},'raw':!![]})[_0xebd9('0x26')](function(_0x4f1fd8){if(_0x4f1fd8&&_0x4f1fd8[_0xebd9('0x50')]===0x0){return db[_0xebd9('0x28')][_0xebd9('0x51')]({'name':_0x2c5104[_0xebd9('0x2b')],'resourceId':_0x2c5104['id'],'type':_0x4f1fd8[_0xebd9('0x2b')],'sectionId':_0x4f1fd8['id']},{})[_0xebd9('0x26')](function(){return _0x421e62;});}else{return _0x421e62;}})[_0xebd9('0x4a')](function(_0x58b60c){logger[_0xebd9('0x2a')](_0xebd9('0x52'),_0x58b60c);throw _0x58b60c;});}return _0x421e62;})['then'](respondWithResult(_0x20158f,0xc9))[_0xebd9('0x4a')](handleError(_0x20158f,null));};exports[_0xebd9('0x53')]=function(_0x3d8a94,_0x50a3ac){if(_0x3d8a94[_0xebd9('0x54')]['id']){delete _0x3d8a94[_0xebd9('0x54')]['id'];}return db['SquareProject'][_0xebd9('0x49')]({'where':{'id':_0x3d8a94[_0xebd9('0x44')]['id']}})['then'](handleEntityNotFound(_0x50a3ac,null))[_0xebd9('0x26')](saveUpdates(_0x3d8a94[_0xebd9('0x54')],null))[_0xebd9('0x26')](respondWithResult(_0x50a3ac,null))[_0xebd9('0x4a')](handleError(_0x50a3ac,null));};exports[_0xebd9('0x29')]=function(_0x291d79,_0x384902){return db[_0xebd9('0x2f')][_0xebd9('0x49')]({'where':{'id':_0x291d79[_0xebd9('0x44')]['id']}})[_0xebd9('0x26')](handleEntityNotFound(_0x384902,null))[_0xebd9('0x26')](removeEntity(_0x384902,null))[_0xebd9('0x4a')](handleError(_0x384902,null));};exports[_0xebd9('0x55')]=function(_0x1e1b14,_0x1e5859,_0x1fe8c9){return db[_0xebd9('0x2f')][_0xebd9('0x49')]({'where':{'id':_0x1e1b14[_0xebd9('0x44')]['id']}})[_0xebd9('0x26')](handleEntityNotFound(_0x1e5859,null))[_0xebd9('0x26')](function(_0x57a977){if(_0x57a977){return _0x57a977[_0xebd9('0x55')](_0x1e1b14['body'][_0xebd9('0x56')],_[_0xebd9('0x57')](_0x1e1b14['body'],['ids','id'])||{});}})[_0xebd9('0x26')](respondWithResult(_0x1e5859,null))[_0xebd9('0x4a')](handleError(_0x1e5859,null));};exports[_0xebd9('0x58')]=function(_0x18cff0,_0x4f6b1f,_0x36622e){return db[_0xebd9('0x2f')][_0xebd9('0x49')]({'where':{'id':_0x18cff0[_0xebd9('0x44')]['id']}})[_0xebd9('0x26')](handleEntityNotFound(_0x4f6b1f,null))[_0xebd9('0x26')](function(_0x191071){if(_0x191071){return _0x191071[_0xebd9('0x58')](_0x18cff0[_0xebd9('0x34')]['ids'])[_0xebd9('0x26')](function(){if(_[_0xebd9('0x59')](_0x18cff0[_0xebd9('0x34')]['ids'])){for(var _0x2d3b65=0x0;_0x2d3b65<_0x18cff0[_0xebd9('0x34')]['ids'][_0xebd9('0x47')];_0x2d3b65+=0x1){socket[_0xebd9('0x5a')](_0xebd9('0x5b'),{'UserId':Number(_0x18cff0['query']['ids'][_0x2d3b65]),'SquareProjectId':Number(_0x18cff0[_0xebd9('0x44')]['id'])});}}else{socket[_0xebd9('0x5a')](_0xebd9('0x5b'),{'UserId':Number(_0x18cff0[_0xebd9('0x34')][_0xebd9('0x56')]),'SquareProjectId':Number(_0x18cff0[_0xebd9('0x44')]['id'])});}});}})[_0xebd9('0x26')](respondWithStatusCode(_0x4f6b1f,null))['catch'](handleError(_0x4f6b1f,null));};exports[_0xebd9('0x5c')]=function(_0x4ac1a4,_0x4454e4,_0x8418a4){var _0x163351={};var _0x4c1e1a={};var _0xecef0f;var _0x90d380;return db['SquareProject'][_0xebd9('0x5d')]({'where':{'id':_0x4ac1a4[_0xebd9('0x44')]['id']}})[_0xebd9('0x26')](handleEntityNotFound(_0x4454e4,null))[_0xebd9('0x26')](function(_0x1a1376){if(_0x1a1376){_0xecef0f=_0x1a1376;_0x4c1e1a['model']=_['keys'](db[_0xebd9('0x5e')]['rawAttributes']);_0x4c1e1a['query']=_[_0xebd9('0x35')](_0x4ac1a4[_0xebd9('0x34')]);_0x4c1e1a[_0xebd9('0x46')]=_[_0xebd9('0x36')](_0x4c1e1a[_0xebd9('0x33')],_0x4c1e1a[_0xebd9('0x34')]);_0x163351[_0xebd9('0x37')]=_['intersection'](_0x4c1e1a[_0xebd9('0x33')],qs[_0xebd9('0x38')](_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x38')]));_0x163351[_0xebd9('0x37')]=_0x163351[_0xebd9('0x37')][_0xebd9('0x47')]?_0x163351[_0xebd9('0x37')]:_0x4c1e1a['model'];_0x163351[_0xebd9('0x3a')]=qs[_0xebd9('0x3b')](_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x3b')]);_0x163351['where']=qs[_0xebd9('0x46')](_['pick'](_0x4ac1a4[_0xebd9('0x34')],_0x4c1e1a[_0xebd9('0x46')]));if(_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x3e')]){_0x163351['where']=_[_0xebd9('0x3f')](_0x163351[_0xebd9('0x3c')],{'$or':_[_0xebd9('0x2e')](_0x163351[_0xebd9('0x37')],function(_0x3d328a){var _0x31d7d9={};_0x31d7d9[_0x3d328a]={'$like':'%'+_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x3e')]+'%'};return _0x31d7d9;})});}_0x163351=_['merge']({},_0x163351,_0x4ac1a4[_0xebd9('0x40')]);return _0xecef0f[_0xebd9('0x5c')](_0x163351);}})[_0xebd9('0x26')](function(_0x579243){if(_0x579243){_0x90d380=_0x579243[_0xebd9('0x47')];if(!_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x39')](_0xebd9('0x5f'))){_0x163351[_0xebd9('0x20')]=qs[_0xebd9('0x20')](_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x20')]);_0x163351['offset']=qs['offset'](_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x23')]);}return _0xecef0f['getUsers'](_0x163351);}})['then'](function(_0x3dc866){if(_0x3dc866){return _0x3dc866?{'count':_0x90d380,'rows':_0x3dc866}:null;}})[_0xebd9('0x26')](respondWithResult(_0x4454e4,null))[_0xebd9('0x4a')](handleError(_0x4454e4,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 26cc6fa..7fc32a8 100644 --- a/server/api/squareProject/squareProject.events.js +++ b/server/api/squareProject/squareProject.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9c9=['hook','../../mysqldb','save','update','remove'];(function(_0x4e322c,_0x4c95b3){var _0x358af7=function(_0x3de861){while(--_0x3de861){_0x4e322c['push'](_0x4e322c['shift']());}};_0x358af7(++_0x4c95b3);}(_0xe9c9,0xb0));var _0x9e9c=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xe9c9[_0x487b0c];return _0x1adbdc;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x9e9c('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9e9c('0x1'),'afterUpdate':_0x9e9c('0x2'),'afterDestroy':_0x9e9c('0x3')};function emitEvent(_0x54b5ad){return function(_0x278611,_0x2c471a,_0x5c38d8){SquareProjectEvents['emit'](_0x54b5ad+':'+_0x278611['id'],_0x278611);SquareProjectEvents['emit'](_0x54b5ad,_0x278611);_0x5c38d8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x9e9c('0x4')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x8592=['../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0x8592,0xf1));var _0x2859=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0x8592[_0xbc1a4b];return _0x108b87;};'use strict';var EventEmitter=require(_0x2859('0x0'));var SquareProject=require(_0x2859('0x1'))['db'][_0x2859('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2859('0x3')](0x0);var events={'afterCreate':_0x2859('0x4'),'afterUpdate':_0x2859('0x5'),'afterDestroy':_0x2859('0x6')};function emitEvent(_0x56f847){return function(_0x24d2eb,_0x573918,_0x435cfc){SquareProjectEvents[_0x2859('0x7')](_0x56f847+':'+_0x24d2eb['id'],_0x24d2eb);SquareProjectEvents[_0x2859('0x7')](_0x56f847,_0x24d2eb);_0x435cfc(null);};}for(var e in events){if(events[_0x2859('0x8')](e)){var event=events[e];SquareProject[_0x2859('0x9')](e,emitEvent(event));}}module[_0x2859('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0df4667..7f19546 100644 --- a/server/api/squareProject/squareProject.model.js +++ b/server/api/squareProject/squareProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc43e=['square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','SquareProject'];(function(_0x2c823e,_0x1067c9){var _0x21b297=function(_0x67d218){while(--_0x67d218){_0x2c823e['push'](_0x2c823e['shift']());}};_0x21b297(++_0x1067c9);}(_0xc43e,0x7f));var _0xec43=function(_0x180c33,_0x14f43b){_0x180c33=_0x180c33-0x0;var _0x84f1e1=_0xc43e[_0x180c33];return _0x84f1e1;};'use strict';var _=require('lodash');var util=require(_0xec43('0x0'));var logger=require('../../config/logger')(_0xec43('0x1'));var moment=require(_0xec43('0x2'));var BPromise=require(_0xec43('0x3'));var rp=require(_0xec43('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec43('0x5'));var config=require(_0xec43('0x6'));var attributes=require(_0xec43('0x7'));module['exports']=function(_0x5d93dc,_0x3b4ae8){return _0x5d93dc['define'](_0xec43('0x8'),attributes,{'tableName':_0xec43('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c9d68,_0x4dad1d,_0x3dd477){if(_0x5c9d68['changed'](_0xec43('0xa'))){_0x5c9d68[_0xec43('0xb')]=moment()[_0xec43('0xc')](_0xec43('0xd'));}if(_0x5c9d68[_0xec43('0xe')](_0xec43('0xf'))){_0x5c9d68[_0xec43('0x10')]=moment()[_0xec43('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3dd477(null,_0x5c9d68);}}});}; \ No newline at end of file +var _0x3533=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','square_projects','changed','preproduction','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x1fdb3f,_0x50fa7b){var _0x30ff64=function(_0x24b9d9){while(--_0x24b9d9){_0x1fdb3f['push'](_0x1fdb3f['shift']());}};_0x30ff64(++_0x50fa7b);}(_0x3533,0x1ed));var _0x3353=function(_0x5d8c2f,_0x5042c3){_0x5d8c2f=_0x5d8c2f-0x0;var _0x20580f=_0x3533[_0x5d8c2f];return _0x20580f;};'use strict';var _=require(_0x3353('0x0'));var util=require(_0x3353('0x1'));var logger=require(_0x3353('0x2'))(_0x3353('0x3'));var moment=require(_0x3353('0x4'));var BPromise=require(_0x3353('0x5'));var rp=require(_0x3353('0x6'));var fs=require('fs');var path=require(_0x3353('0x7'));var rimraf=require(_0x3353('0x8'));var config=require(_0x3353('0x9'));var attributes=require('./squareProject.attributes');module[_0x3353('0xa')]=function(_0x3991aa,_0xebc090){return _0x3991aa[_0x3353('0xb')]('SquareProject',attributes,{'tableName':_0x3353('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x300e5d,_0x2bc4fe,_0x30976f){if(_0x300e5d[_0x3353('0xd')](_0x3353('0xe'))){_0x300e5d['savedAt']=moment()[_0x3353('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x300e5d['changed'](_0x3353('0x10'))){_0x300e5d[_0x3353('0x11')]=moment()[_0x3353('0xf')](_0x3353('0x12'));}_0x30976f(null,_0x300e5d);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 41b214a..a0ccd58 100644 --- a/server/api/squareProject/squareProject.rpc.js +++ b/server/api/squareProject/squareProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9cb3=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','info','request\x20sent','stringify','error','code','SquareProject,\x20%s,\x20%s','message','catch','ShowSquareProject','SquareProject','options','raw','where','include','map','model','attributes','debug'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0x9cb3,0x1dc));var _0x39cb=function(_0x5e8965,_0x744744){_0x5e8965=_0x5e8965-0x0;var _0x5efd03=_0x9cb3[_0x5e8965];return _0x5efd03;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x39cb('0x0'));var BPromise=require(_0x39cb('0x1'));var rs=require(_0x39cb('0x2'));var fs=require('fs');var Redis=require(_0x39cb('0x3'));var db=require(_0x39cb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x39cb('0x5'))(_0x39cb('0x6'));var config=require(_0x39cb('0x7'));var jayson=require(_0x39cb('0x8'));var client=jayson['client'][_0x39cb('0x9')]({'port':0x232a});config[_0x39cb('0xa')]=_['defaults'](config[_0x39cb('0xa')],{'host':_0x39cb('0xb'),'port':0x18eb});var socket=require(_0x39cb('0xc'))(new Redis(config[_0x39cb('0xa')]));require(_0x39cb('0xd'))[_0x39cb('0xe')](socket);function respondWithRpcPromise(_0x21694a,_0x2a81b0,_0x3c3641){return new BPromise(function(_0x4a50ce,_0x1b696f){return client[_0x39cb('0xf')](_0x21694a,_0x3c3641)['then'](function(_0x50d23c){logger[_0x39cb('0x10')]('SquareProject,\x20%s,\x20%s',_0x2a81b0,_0x39cb('0x11'));logger['debug']('SquareProject,\x20%s,\x20%s,\x20%s',_0x2a81b0,_0x39cb('0x11'),JSON[_0x39cb('0x12')](_0x50d23c));if(_0x50d23c['error']){if(_0x50d23c[_0x39cb('0x13')][_0x39cb('0x14')]===0x1f4){logger[_0x39cb('0x13')](_0x39cb('0x15'),_0x2a81b0,_0x50d23c[_0x39cb('0x13')][_0x39cb('0x16')]);return _0x1b696f(_0x50d23c[_0x39cb('0x13')][_0x39cb('0x16')]);}logger[_0x39cb('0x13')]('SquareProject,\x20%s,\x20%s',_0x2a81b0,_0x50d23c[_0x39cb('0x13')][_0x39cb('0x16')]);return _0x4a50ce(_0x50d23c[_0x39cb('0x13')][_0x39cb('0x16')]);}else{logger['info'](_0x39cb('0x15'),_0x2a81b0,_0x39cb('0x11'));_0x4a50ce(_0x50d23c['result'][_0x39cb('0x16')]);}})[_0x39cb('0x17')](function(_0x4325a8){logger[_0x39cb('0x13')](_0x39cb('0x15'),_0x2a81b0,_0x4325a8);_0x1b696f(_0x4325a8);});});}exports[_0x39cb('0x18')]=function(_0x2e9913){var _0x55c9e8=this;return new Promise(function(_0x42eb59,_0x570e3b){return db[_0x39cb('0x19')]['find']({'raw':_0x2e9913[_0x39cb('0x1a')]?_0x2e9913[_0x39cb('0x1a')][_0x39cb('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e9913[_0x39cb('0x1a')]?_0x2e9913[_0x39cb('0x1a')][_0x39cb('0x1c')]||null:null,'attributes':_0x2e9913[_0x39cb('0x1a')]?_0x2e9913['options']['attributes']||null:null,'include':_0x2e9913[_0x39cb('0x1a')]?_0x2e9913[_0x39cb('0x1a')][_0x39cb('0x1d')]?_[_0x39cb('0x1e')](_0x2e9913['options']['include'],function(_0x42e454){return{'model':db[_0x42e454[_0x39cb('0x1f')]],'as':_0x42e454['as'],'attributes':_0x42e454[_0x39cb('0x20')],'include':_0x42e454['include']?_[_0x39cb('0x1e')](_0x42e454[_0x39cb('0x1d')],function(_0x1ed38b){return{'model':db[_0x1ed38b[_0x39cb('0x1f')]],'as':_0x1ed38b['as'],'attributes':_0x1ed38b[_0x39cb('0x20')],'include':_0x1ed38b[_0x39cb('0x1d')]?_[_0x39cb('0x1e')](_0x1ed38b[_0x39cb('0x1d')],function(_0x4b87ad){return{'model':db[_0x4b87ad[_0x39cb('0x1f')]],'as':_0x4b87ad['as'],'attributes':_0x4b87ad[_0x39cb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xaabc04){logger[_0x39cb('0x10')]('ShowSquareProject',_0x2e9913);logger[_0x39cb('0x21')]('ShowSquareProject',_0x2e9913,JSON['stringify'](_0xaabc04));_0x42eb59(_0xaabc04);})['catch'](function(_0x49cb27){logger[_0x39cb('0x13')](_0x39cb('0x18'),_0x49cb27[_0x39cb('0x16')],_0x2e9913);_0x570e3b(_0x55c9e8[_0x39cb('0x13')](0x1f4,_0x49cb27['message']));});});}; \ No newline at end of file +var _0x69b2=['debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','find','options','raw','attributes','include','map','model','then','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','./squareProject.socket','register','request','info'];(function(_0x236e9f,_0x2a5adc){var _0x4203ea=function(_0x39e803){while(--_0x39e803){_0x236e9f['push'](_0x236e9f['shift']());}};_0x4203ea(++_0x2a5adc);}(_0x69b2,0xbd));var _0x269b=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x69b2[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x269b('0x0'));var util=require(_0x269b('0x1'));var moment=require(_0x269b('0x2'));var BPromise=require('bluebird');var rs=require(_0x269b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x269b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x269b('0x5'))(_0x269b('0x6'));var config=require(_0x269b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x269b('0x8')][_0x269b('0x9')]({'port':0x232a});config[_0x269b('0xa')]=_['defaults'](config[_0x269b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x269b('0xa')]));require(_0x269b('0xb'))[_0x269b('0xc')](socket);function respondWithRpcPromise(_0x1d32b3,_0x4af7ba,_0x236be5){return new BPromise(function(_0x5803d4,_0x33fd00){return client[_0x269b('0xd')](_0x1d32b3,_0x236be5)['then'](function(_0x4860f9){logger[_0x269b('0xe')]('SquareProject,\x20%s,\x20%s',_0x4af7ba,'request\x20sent');logger[_0x269b('0xf')](_0x269b('0x10'),_0x4af7ba,_0x269b('0x11'),JSON[_0x269b('0x12')](_0x4860f9));if(_0x4860f9[_0x269b('0x13')]){if(_0x4860f9[_0x269b('0x13')][_0x269b('0x14')]===0x1f4){logger[_0x269b('0x13')](_0x269b('0x15'),_0x4af7ba,_0x4860f9[_0x269b('0x13')][_0x269b('0x16')]);return _0x33fd00(_0x4860f9[_0x269b('0x13')][_0x269b('0x16')]);}logger['error'](_0x269b('0x15'),_0x4af7ba,_0x4860f9['error'][_0x269b('0x16')]);return _0x5803d4(_0x4860f9[_0x269b('0x13')][_0x269b('0x16')]);}else{logger[_0x269b('0xe')]('SquareProject,\x20%s,\x20%s',_0x4af7ba,_0x269b('0x11'));_0x5803d4(_0x4860f9[_0x269b('0x17')]['message']);}})[_0x269b('0x18')](function(_0x4bee6d){logger[_0x269b('0x13')]('SquareProject,\x20%s,\x20%s',_0x4af7ba,_0x4bee6d);_0x33fd00(_0x4bee6d);});});}exports[_0x269b('0x19')]=function(_0x4bd729){var _0x19680c=this;return new Promise(function(_0x500a19,_0x5128f7){return db['SquareProject'][_0x269b('0x1a')]({'raw':_0x4bd729[_0x269b('0x1b')]?_0x4bd729['options'][_0x269b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4bd729[_0x269b('0x1b')]?_0x4bd729[_0x269b('0x1b')]['where']||null:null,'attributes':_0x4bd729[_0x269b('0x1b')]?_0x4bd729[_0x269b('0x1b')][_0x269b('0x1d')]||null:null,'include':_0x4bd729[_0x269b('0x1b')]?_0x4bd729[_0x269b('0x1b')][_0x269b('0x1e')]?_[_0x269b('0x1f')](_0x4bd729[_0x269b('0x1b')][_0x269b('0x1e')],function(_0x581dfc){return{'model':db[_0x581dfc[_0x269b('0x20')]],'as':_0x581dfc['as'],'attributes':_0x581dfc[_0x269b('0x1d')],'include':_0x581dfc[_0x269b('0x1e')]?_[_0x269b('0x1f')](_0x581dfc[_0x269b('0x1e')],function(_0x19fe74){return{'model':db[_0x19fe74[_0x269b('0x20')]],'as':_0x19fe74['as'],'attributes':_0x19fe74['attributes'],'include':_0x19fe74['include']?_['map'](_0x19fe74[_0x269b('0x1e')],function(_0x5662f9){return{'model':db[_0x5662f9[_0x269b('0x20')]],'as':_0x5662f9['as'],'attributes':_0x5662f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x269b('0x21')](function(_0x310f39){logger[_0x269b('0xe')](_0x269b('0x19'),_0x4bd729);logger[_0x269b('0xf')](_0x269b('0x19'),_0x4bd729,JSON[_0x269b('0x12')](_0x310f39));_0x500a19(_0x310f39);})[_0x269b('0x18')](function(_0x3928ef){logger[_0x269b('0x13')]('ShowSquareProject',_0x3928ef[_0x269b('0x16')],_0x4bd729);_0x5128f7(_0x19680c['error'](0x1f4,_0x3928ef['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 22b9c70..9497748 100644 --- a/server/api/squareProject/squareProject.socket.js +++ b/server/api/squareProject/squareProject.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5a4=['emit','removeListener','length','squareProject:','./squareProject.events','update'];(function(_0x3b27ea,_0x40f42a){var _0x4feb43=function(_0x9843f){while(--_0x9843f){_0x3b27ea['push'](_0x3b27ea['shift']());}};_0x4feb43(++_0x40f42a);}(_0xe5a4,0x154));var _0x4e5a=function(_0x3894ad,_0x5543a7){_0x3894ad=_0x3894ad-0x0;var _0x56cc0c=_0xe5a4[_0x3894ad];return _0x56cc0c;};'use strict';var SquareProjectEvents=require(_0x4e5a('0x0'));var events=['save','remove',_0x4e5a('0x1')];function createListener(_0xf43d87,_0x16695f){return function(_0x16ee1e){_0x16695f[_0x4e5a('0x2')](_0xf43d87,_0x16ee1e);};}function removeListener(_0x29afdb,_0x59e010){return function(){SquareProjectEvents[_0x4e5a('0x3')](_0x29afdb,_0x59e010);};}exports['register']=function(_0x195198){for(var _0x4b67b7=0x0,_0x392980=events[_0x4e5a('0x4')];_0x4b67b7<_0x392980;_0x4b67b7++){var _0x13b224=events[_0x4b67b7];var _0x1e1821=createListener(_0x4e5a('0x5')+_0x13b224,_0x195198);SquareProjectEvents['on'](_0x13b224,_0x1e1821);}}; \ No newline at end of file +var _0x3d9c=['register','length','squareProject:','save','remove','update','removeListener'];(function(_0x38b19d,_0x287341){var _0x3d6ccd=function(_0x49f8a3){while(--_0x49f8a3){_0x38b19d['push'](_0x38b19d['shift']());}};_0x3d6ccd(++_0x287341);}(_0x3d9c,0xf8));var _0xc3d9=function(_0x7bb1df,_0x340ba5){_0x7bb1df=_0x7bb1df-0x0;var _0x181f48=_0x3d9c[_0x7bb1df];return _0x181f48;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xc3d9('0x0'),_0xc3d9('0x1'),_0xc3d9('0x2')];function createListener(_0x37baf8,_0x245bf1){return function(_0x359052){_0x245bf1['emit'](_0x37baf8,_0x359052);};}function removeListener(_0x45737c,_0x45e359){return function(){SquareProjectEvents[_0xc3d9('0x3')](_0x45737c,_0x45e359);};}exports[_0xc3d9('0x4')]=function(_0x49b3b4){for(var _0x177809=0x0,_0x6afa9=events[_0xc3d9('0x5')];_0x177809<_0x6afa9;_0x177809++){var _0x19db50=events[_0x177809];var _0x49a484=createListener(_0xc3d9('0x6')+_0x19db50,_0x49b3b4);SquareProjectEvents['on'](_0x19db50,_0x49a484);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 3de9247..baa78d3 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x26ab0d,_0x279697){var _0x465c21=function(_0x2a124e){while(--_0x2a124e){_0x26ab0d['push'](_0x26ab0d['shift']());}};_0x465c21(++_0x279697);}(_0x53ec,0x192));var _0xc53e=function(_0x48c2e9,_0x2ba941){_0x48c2e9=_0x48c2e9-0x0;var _0x3e6c24=_0x53ec[_0x48c2e9];return _0x3e6c24;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x362bde,_0x33aa22){var _0x176d28=function(_0x490e94){while(--_0x490e94){_0x362bde['push'](_0x362bde['shift']());}};_0x176d28(++_0x33aa22);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x29fc2c,_0x4ff86a){_0x29fc2c=_0x29fc2c-0x0;var _0x1adbc8=_0x7fbe[_0x29fc2c];return _0x1adbc8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 118a465..d74c3c3 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x1adaeb,_0x28e9a4){var _0x23ee24=function(_0x466d3f){while(--_0x466d3f){_0x1adaeb['push'](_0x1adaeb['shift']());}};_0x23ee24(++_0x28e9a4);}(_0x814b,0x1a2));var _0xb814=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x814b[_0x39c734];return _0xb2a2f9;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'uniqueid':{'type':Sequelize[_0xb814('0x2')]},'callerid':{'type':Sequelize[_0xb814('0x2')]},'calleridname':{'type':Sequelize[_0xb814('0x2')]},'context':{'type':Sequelize[_0xb814('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb814('0x2')]},'accountcode':{'type':Sequelize[_0xb814('0x2')]},'dnid':{'type':Sequelize[_0xb814('0x2')]},'projectName':{'type':Sequelize[_0xb814('0x2')]},'saveName':{'type':Sequelize[_0xb814('0x2')]},'filename':{'type':Sequelize[_0xb814('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb814('0x3')],'get':function(){var _0x2e6272='';var _0x5c8539=this[_0xb814('0x4')](_0xb814('0x5'));if(_0x5c8539){_0x2e6272=_0x5c8539[_0xb814('0x6')](_0x5c8539[_0xb814('0x7')]('.'));}return _0x2e6272;}}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','VIRTUAL','savePath','substring','lastIndexOf'];(function(_0x335cf5,_0x2713d2){var _0x59ace2=function(_0x236253){while(--_0x236253){_0x335cf5['push'](_0x335cf5['shift']());}};_0x59ace2(++_0x2713d2);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0x24ca[_0x5c3ae9];return _0x3f5950;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'callerid':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'dnid':{'type':Sequelize[_0xa24c('0x1')]},'projectName':{'type':Sequelize[_0xa24c('0x1')]},'saveName':{'type':Sequelize[_0xa24c('0x1')]},'filename':{'type':Sequelize[_0xa24c('0x1')]},'savePath':{'type':Sequelize[_0xa24c('0x1')]},'format':{'type':Sequelize[_0xa24c('0x2')],'get':function(){var _0x257264='';var _0x9a5013=this['getDataValue'](_0xa24c('0x3'));if(_0x9a5013){_0x257264=_0x9a5013[_0xa24c('0x4')](_0x9a5013[_0xa24c('0x5')]('.'));}return _0x257264;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8ee4d95..c95de96 100644 --- a/server/api/squareRecording/squareRecording.controller.js +++ b/server/api/squareRecording/squareRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc01e=['SquareRecording','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','existsSync','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','VIRTUAL','options'];(function(_0x3f0e45,_0x8e4372){var _0x5bb1aa=function(_0xd2079c){while(--_0xd2079c){_0x3f0e45['push'](_0x3f0e45['shift']());}};_0x5bb1aa(++_0x8e4372);}(_0xc01e,0xed));var _0xec01=function(_0xdcafe7,_0x3cb34d){_0xdcafe7=_0xdcafe7-0x0;var _0x1d7fb5=_0xc01e[_0xdcafe7];return _0x1d7fb5;};'use strict';var emlformat=require(_0xec01('0x0'));var rimraf=require(_0xec01('0x1'));var zipdir=require(_0xec01('0x2'));var jsonpatch=require(_0xec01('0x3'));var rp=require(_0xec01('0x4'));var moment=require(_0xec01('0x5'));var BPromise=require(_0xec01('0x6'));var Mustache=require(_0xec01('0x7'));var util=require(_0xec01('0x8'));var path=require('path');var sox=require(_0xec01('0x9'));var csv=require(_0xec01('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec01('0xb'));var squel=require(_0xec01('0xc'));var crypto=require(_0xec01('0xd'));var jsforce=require(_0xec01('0xe'));var deskjs=require(_0xec01('0xf'));var toCsv=require(_0xec01('0xa'));var querystring=require(_0xec01('0x10'));var Papa=require(_0xec01('0x11'));var Redis=require(_0xec01('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xec01('0x13'));var as=require(_0xec01('0x14'));var hardwareService=require(_0xec01('0x15'));var logger=require(_0xec01('0x16'))(_0xec01('0x17'));var utils=require(_0xec01('0x18'));var config=require(_0xec01('0x19'));var licenseUtil=require(_0xec01('0x1a'));var db=require(_0xec01('0x1b'))['db'];function respondWithStatusCode(_0x1ae0ad,_0x279367){_0x279367=_0x279367||0xcc;return function(_0x13f951){if(_0x13f951){return _0x1ae0ad[_0xec01('0x1c')](_0x279367);}return _0x1ae0ad[_0xec01('0x1d')](_0x279367)['end']();};}function respondWithResult(_0x2b6ee9,_0x43eb75){_0x43eb75=_0x43eb75||0xc8;return function(_0x5b8593){if(_0x5b8593){return _0x2b6ee9[_0xec01('0x1d')](_0x43eb75)[_0xec01('0x1e')](_0x5b8593);}};}function respondWithFilteredResult(_0x2d9b53,_0x47db57){return function(_0x2740f7){if(_0x2740f7){var _0x4834a3=typeof _0x47db57[_0xec01('0x1f')]===_0xec01('0x20')&&typeof _0x47db57[_0xec01('0x21')]===_0xec01('0x20');var _0x20aa2f=_0x2740f7[_0xec01('0x22')];var _0x98ff4b=_0x4834a3?0x0:_0x47db57[_0xec01('0x1f')];var _0xd9cf7e=_0x4834a3?_0x2740f7[_0xec01('0x22')]:_0x47db57[_0xec01('0x1f')]+_0x47db57[_0xec01('0x21')];var _0x2b80f9;if(_0xd9cf7e>=_0x20aa2f){_0xd9cf7e=_0x20aa2f;_0x2b80f9=0xc8;}else{_0x2b80f9=0xce;}_0x2d9b53[_0xec01('0x1d')](_0x2b80f9);return _0x2d9b53[_0xec01('0x23')](_0xec01('0x24'),_0x98ff4b+'-'+_0xd9cf7e+'/'+_0x20aa2f)[_0xec01('0x1e')](_0x2740f7);}return null;};}function patchUpdates(_0x5e8697){return function(_0x3c4880){try{jsonpatch['apply'](_0x3c4880,_0x5e8697,!![]);}catch(_0x43b3ce){return BPromise[_0xec01('0x25')](_0x43b3ce);}return _0x3c4880[_0xec01('0x26')]();};}function saveUpdates(_0x5bb1da,_0x5bdbef){return function(_0x23d8cf){if(_0x23d8cf){return _0x23d8cf[_0xec01('0x27')](_0x5bb1da)[_0xec01('0x28')](function(_0xf3fb1c){return _0xf3fb1c;});}return null;};}function removeEntity(_0x5d0cd5,_0x21de0e){return function(_0x269aa8){if(_0x269aa8){return _0x269aa8[_0xec01('0x29')]()[_0xec01('0x28')](function(){_0x5d0cd5[_0xec01('0x1d')](0xcc)[_0xec01('0x2a')]();});}};}function handleEntityNotFound(_0x32971c,_0x20edc2){return function(_0x23552d){if(!_0x23552d){_0x32971c[_0xec01('0x1c')](0x194);}return _0x23552d;};}function handleError(_0x321854,_0x3e411d){_0x3e411d=_0x3e411d||0x1f4;return function(_0x3dc760){logger[_0xec01('0x2b')](_0x3dc760['stack']);if(_0x3dc760[_0xec01('0x2c')]){delete _0x3dc760[_0xec01('0x2c')];}_0x321854[_0xec01('0x1d')](_0x3e411d)['send'](_0x3dc760);};}exports['index']=function(_0x4afa5e,_0x3f6b9f){var _0x3c0aaa={},_0x4aabde={},_0x59b93a={'count':0x0,'rows':[]};var _0x1b2ec1=_[_0xec01('0x2d')](db['SquareRecording'][_0xec01('0x2e')],function(_0x23b550){return{'name':_0x23b550[_0xec01('0x2f')],'type':_0x23b550['type'][_0xec01('0x30')]};});_0x4aabde[_0xec01('0x31')]=_['map'](_0x1b2ec1,_0xec01('0x2c'));_0x4aabde['query']=_[_0xec01('0x32')](_0x4afa5e[_0xec01('0x33')]);_0x4aabde[_0xec01('0x34')]=_[_0xec01('0x35')](_0x4aabde[_0xec01('0x31')],_0x4aabde[_0xec01('0x33')]);_0x3c0aaa['attributes']=_[_0xec01('0x35')](_0x4aabde['model'],qs[_0xec01('0x36')](_0x4afa5e[_0xec01('0x33')][_0xec01('0x36')]));_0x3c0aaa[_0xec01('0x37')]=_0x3c0aaa[_0xec01('0x37')]['length']?_0x3c0aaa[_0xec01('0x37')]:_0x4aabde[_0xec01('0x31')];if(!_0x4afa5e['query'][_0xec01('0x38')](_0xec01('0x39'))){_0x3c0aaa[_0xec01('0x21')]=qs['limit'](_0x4afa5e[_0xec01('0x33')][_0xec01('0x21')]);_0x3c0aaa[_0xec01('0x1f')]=qs[_0xec01('0x1f')](_0x4afa5e[_0xec01('0x33')][_0xec01('0x1f')]);}_0x3c0aaa[_0xec01('0x3a')]=qs['sort'](_0x4afa5e[_0xec01('0x33')]['sort']);_0x3c0aaa['where']=qs[_0xec01('0x34')](_[_0xec01('0x3b')](_0x4afa5e[_0xec01('0x33')],_0x4aabde['filters']),_0x1b2ec1);if(_0x4afa5e[_0xec01('0x33')][_0xec01('0x3c')]){_0x3c0aaa['where']=_[_0xec01('0x3d')](_0x3c0aaa[_0xec01('0x3e')],{'$or':_['map'](_0x1b2ec1,function(_0x444e4b){if(_0x444e4b[_0xec01('0x3f')]!==_0xec01('0x40')){var _0x236795={};_0x236795[_0x444e4b[_0xec01('0x2c')]]={'$like':'%'+_0x4afa5e[_0xec01('0x33')][_0xec01('0x3c')]+'%'};return _0x236795;}})});}_0x3c0aaa=_[_0xec01('0x3d')]({},_0x3c0aaa,_0x4afa5e[_0xec01('0x41')]);var _0x4140e7={'where':_0x3c0aaa[_0xec01('0x3e')]};return db[_0xec01('0x42')][_0xec01('0x22')](_0x4140e7)[_0xec01('0x28')](function(_0x21913a){_0x59b93a[_0xec01('0x22')]=_0x21913a;if(_0x4afa5e['query'][_0xec01('0x43')]){_0x3c0aaa[_0xec01('0x44')]=[{'all':!![]}];}return db['SquareRecording'][_0xec01('0x45')](_0x3c0aaa);})['then'](function(_0x56d11d){_0x59b93a[_0xec01('0x46')]=_0x56d11d;return _0x59b93a;})[_0xec01('0x28')](respondWithFilteredResult(_0x3f6b9f,_0x3c0aaa))[_0xec01('0x47')](handleError(_0x3f6b9f,null));};exports[_0xec01('0x48')]=function(_0x346eff,_0x1cc50e){var _0x40d533={'raw':!![],'where':{'id':_0x346eff[_0xec01('0x49')]['id']}},_0x18d33e={};_0x18d33e[_0xec01('0x31')]=_[_0xec01('0x32')](db[_0xec01('0x42')][_0xec01('0x2e')]);_0x18d33e[_0xec01('0x33')]=_[_0xec01('0x32')](_0x346eff['query']);_0x18d33e['filters']=_[_0xec01('0x35')](_0x18d33e['model'],_0x18d33e[_0xec01('0x33')]);_0x40d533[_0xec01('0x37')]=_[_0xec01('0x35')](_0x18d33e['model'],qs[_0xec01('0x36')](_0x346eff['query'][_0xec01('0x36')]));_0x40d533[_0xec01('0x37')]=_0x40d533[_0xec01('0x37')][_0xec01('0x4a')]?_0x40d533['attributes']:_0x18d33e[_0xec01('0x31')];if(_0x346eff[_0xec01('0x33')][_0xec01('0x43')]){_0x40d533[_0xec01('0x44')]=[{'all':!![]}];}_0x40d533=_[_0xec01('0x3d')]({},_0x40d533,_0x346eff[_0xec01('0x41')]);return db[_0xec01('0x42')][_0xec01('0x4b')](_0x40d533)[_0xec01('0x28')](handleEntityNotFound(_0x1cc50e,null))[_0xec01('0x28')](respondWithResult(_0x1cc50e,null))[_0xec01('0x47')](handleError(_0x1cc50e,null));};exports[_0xec01('0x4c')]=function(_0x45e4fa,_0x1996ff){return db[_0xec01('0x42')]['create'](_0x45e4fa[_0xec01('0x4d')],{})['then'](respondWithResult(_0x1996ff,0xc9))[_0xec01('0x47')](handleError(_0x1996ff,null));};exports['update']=function(_0x320491,_0x56601c){if(_0x320491[_0xec01('0x4d')]['id']){delete _0x320491[_0xec01('0x4d')]['id'];}return db['SquareRecording'][_0xec01('0x4b')]({'where':{'id':_0x320491['params']['id']}})['then'](handleEntityNotFound(_0x56601c,null))[_0xec01('0x28')](saveUpdates(_0x320491[_0xec01('0x4d')],null))[_0xec01('0x28')](respondWithResult(_0x56601c,null))[_0xec01('0x47')](handleError(_0x56601c,null));};exports[_0xec01('0x4e')]=function(_0x5b883f,_0x23b61a,_0x5e97ef){var _0x4266e4=require(_0xec01('0x4f'));var _0x1ea345=![];var _0x1faeb5={};if(_0x5b883f[_0xec01('0x33')][_0xec01('0x3f')]&&_0x5b883f[_0xec01('0x33')][_0xec01('0x3f')]===_0xec01('0x50')){_0x1faeb5[_0xec01('0x50')]=_0x5b883f['params']['id'];}else{_0x1faeb5['id']=_0x5b883f[_0xec01('0x49')]['id'];}return db['SquareRecording'][_0xec01('0x4b')]({'where':_0x1faeb5,'attributes':['id',_0xec01('0x51'),'filename'],'raw':!![]})[_0xec01('0x28')](handleEntityNotFound(_0x23b61a,null))[_0xec01('0x28')](function(_0x4c5b00){if(_0x4c5b00){var _0x5a6c6f=_0x4c5b00[_0xec01('0x51')];var _0x437c25=util[_0xec01('0x52')]('%s.cypher',_0x5a6c6f);if(fs[_0xec01('0x53')](_0x437c25)){_0x1ea345=!![];return _0x4266e4['decryptFile'](_0x437c25,_0x5a6c6f,config[_0xec01('0x54')]['recording'])['then'](function(){return _0x4c5b00;});}return _0x4c5b00;}})[_0xec01('0x28')](function(_0x24c4e5){if(_0x24c4e5){var _0x33de0c=_0x24c4e5['savePath'];if(!fs[_0xec01('0x53')](_0x33de0c)){throw new db[(_0xec01('0x55'))][(_0xec01('0x56'))](_0xec01('0x57'));}if(_0x24c4e5[_0xec01('0x58')]){return _0x23b61a['download'](_0x33de0c,_0x24c4e5[_0xec01('0x58')]+path[_0xec01('0x59')](_0x33de0c),function(){if(_0x1ea345){fs[_0xec01('0x5a')](_0x33de0c);}});}else{return _0x23b61a[_0xec01('0x4e')](_0x33de0c,function(_0x1dbd71){if(_0x1ea345){fs[_0xec01('0x5a')](_0x33de0c);}});}}})[_0xec01('0x47')](function(_0x104324){if(_0x104324[_0xec01('0x5b')]===_0xec01('0x57')){_0x23b61a[_0xec01('0x1d')](0x194)[_0xec01('0x5c')](_0xec01('0x5d'));}else{return handleError(_0x23b61a,null);}});};exports[_0xec01('0x29')]=function(_0xaab818,_0x535754){return db[_0xec01('0x42')][_0xec01('0x4b')]({'where':{'id':_0xaab818[_0xec01('0x49')]['id']}})[_0xec01('0x28')](function(_0x80de4b){if(_[_0xec01('0x5e')](_0x80de4b)){throw new ReferenceError(_0xec01('0x5f'));}return _0x80de4b;})[_0xec01('0x28')](function(_0x1827d8){var _0x311e0c=_0x1827d8['savePath'];logger[_0xec01('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x311e0c);if(!_[_0xec01('0x5e')](_0x1827d8[_0xec01('0x51')])&&fs[_0xec01('0x53')](_0x311e0c)){logger['info'](_0xec01('0x61')+_0x311e0c+_0xec01('0x62'));fs[_0xec01('0x63')](_0x311e0c);}_0x311e0c=_0x311e0c+_0xec01('0x64');if(!_[_0xec01('0x5e')](_0x1827d8[_0xec01('0x51')])&&fs[_0xec01('0x53')](_0x311e0c)){logger[_0xec01('0x60')]('File:\x20\x22'+_0x311e0c+_0xec01('0x62'));fs[_0xec01('0x63')](_0x311e0c);}return _0x1827d8;})[_0xec01('0x28')](function(_0x4f9382){if(!_0x4f9382)throw new InternalError();return _0x4f9382['destroy']();})[_0xec01('0x28')](function(){_0x535754[_0xec01('0x1d')](0xcc)[_0xec01('0x2a')]();})['catch'](handleError(_0x535754,null));}; \ No newline at end of file +var _0x0e16=['format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','count','apply','reject','save','then','destroy','status','sendStatus','error','stack','name','send','map','SquareRecording','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','update','body','find','download','../../components/encryptor','type','uniqueid','savePath','filename'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x0e16,0xde));var _0x60e1=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x0e16[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0x60e1('0x0'));var rimraf=require(_0x60e1('0x1'));var zipdir=require(_0x60e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60e1('0x3'));var moment=require('moment');var BPromise=require(_0x60e1('0x4'));var Mustache=require(_0x60e1('0x5'));var util=require(_0x60e1('0x6'));var path=require(_0x60e1('0x7'));var sox=require('sox');var csv=require(_0x60e1('0x8'));var ejs=require(_0x60e1('0x9'));var fs=require('fs');var fs_extra=require(_0x60e1('0xa'));var _=require(_0x60e1('0xb'));var squel=require(_0x60e1('0xc'));var crypto=require(_0x60e1('0xd'));var jsforce=require(_0x60e1('0xe'));var deskjs=require(_0x60e1('0xf'));var toCsv=require(_0x60e1('0x8'));var querystring=require(_0x60e1('0x10'));var Papa=require(_0x60e1('0x11'));var Redis=require(_0x60e1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x60e1('0x13'));var as=require(_0x60e1('0x14'));var hardwareService=require(_0x60e1('0x15'));var logger=require(_0x60e1('0x16'))(_0x60e1('0x17'));var utils=require('../../config/utils');var config=require(_0x60e1('0x18'));var licenseUtil=require(_0x60e1('0x19'));var db=require(_0x60e1('0x1a'))['db'];function respondWithStatusCode(_0x553240,_0x406648){_0x406648=_0x406648||0xcc;return function(_0x143453){if(_0x143453){return _0x553240['sendStatus'](_0x406648);}return _0x553240['status'](_0x406648)[_0x60e1('0x1b')]();};}function respondWithResult(_0x21f9d0,_0x477e5d){_0x477e5d=_0x477e5d||0xc8;return function(_0x53e561){if(_0x53e561){return _0x21f9d0['status'](_0x477e5d)['json'](_0x53e561);}};}function respondWithFilteredResult(_0x490bd5,_0x32ba20){return function(_0x27f9ec){if(_0x27f9ec){var _0x111bfd=typeof _0x32ba20[_0x60e1('0x1c')]===_0x60e1('0x1d')&&typeof _0x32ba20['limit']==='undefined';var _0x270a1e=_0x27f9ec[_0x60e1('0x1e')];var _0x4a6ae3=_0x111bfd?0x0:_0x32ba20[_0x60e1('0x1c')];var _0x59e08b=_0x111bfd?_0x27f9ec[_0x60e1('0x1e')]:_0x32ba20['offset']+_0x32ba20['limit'];var _0x47462b;if(_0x59e08b>=_0x270a1e){_0x59e08b=_0x270a1e;_0x47462b=0xc8;}else{_0x47462b=0xce;}_0x490bd5['status'](_0x47462b);return _0x490bd5['set']('Content-Range',_0x4a6ae3+'-'+_0x59e08b+'/'+_0x270a1e)['json'](_0x27f9ec);}return null;};}function patchUpdates(_0x5427d5){return function(_0x468243){try{jsonpatch[_0x60e1('0x1f')](_0x468243,_0x5427d5,!![]);}catch(_0x102cdd){return BPromise[_0x60e1('0x20')](_0x102cdd);}return _0x468243[_0x60e1('0x21')]();};}function saveUpdates(_0x4e97b7,_0x4f8ef4){return function(_0x25e239){if(_0x25e239){return _0x25e239['update'](_0x4e97b7)[_0x60e1('0x22')](function(_0x3ab642){return _0x3ab642;});}return null;};}function removeEntity(_0x512019,_0x169d53){return function(_0x33ec4d){if(_0x33ec4d){return _0x33ec4d[_0x60e1('0x23')]()[_0x60e1('0x22')](function(){_0x512019[_0x60e1('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cba94,_0x1adb70){return function(_0x3cf932){if(!_0x3cf932){_0x3cba94[_0x60e1('0x25')](0x194);}return _0x3cf932;};}function handleError(_0x509635,_0x1da0bb){_0x1da0bb=_0x1da0bb||0x1f4;return function(_0x29311a){logger[_0x60e1('0x26')](_0x29311a[_0x60e1('0x27')]);if(_0x29311a['name']){delete _0x29311a[_0x60e1('0x28')];}_0x509635['status'](_0x1da0bb)[_0x60e1('0x29')](_0x29311a);};}exports['index']=function(_0xe7f320,_0x549bd0){var _0x5e6069={},_0xe146a6={},_0x2d0771={'count':0x0,'rows':[]};var _0x3565ff=_[_0x60e1('0x2a')](db[_0x60e1('0x2b')][_0x60e1('0x2c')],function(_0x37e48e){return{'name':_0x37e48e['fieldName'],'type':_0x37e48e['type'][_0x60e1('0x2d')]};});_0xe146a6[_0x60e1('0x2e')]=_[_0x60e1('0x2a')](_0x3565ff,_0x60e1('0x28'));_0xe146a6['query']=_[_0x60e1('0x2f')](_0xe7f320[_0x60e1('0x30')]);_0xe146a6[_0x60e1('0x31')]=_[_0x60e1('0x32')](_0xe146a6[_0x60e1('0x2e')],_0xe146a6[_0x60e1('0x30')]);_0x5e6069[_0x60e1('0x33')]=_[_0x60e1('0x32')](_0xe146a6[_0x60e1('0x2e')],qs['fields'](_0xe7f320[_0x60e1('0x30')][_0x60e1('0x34')]));_0x5e6069[_0x60e1('0x33')]=_0x5e6069[_0x60e1('0x33')][_0x60e1('0x35')]?_0x5e6069[_0x60e1('0x33')]:_0xe146a6[_0x60e1('0x2e')];if(!_0xe7f320[_0x60e1('0x30')][_0x60e1('0x36')]('nolimit')){_0x5e6069[_0x60e1('0x37')]=qs[_0x60e1('0x37')](_0xe7f320['query'][_0x60e1('0x37')]);_0x5e6069['offset']=qs[_0x60e1('0x1c')](_0xe7f320[_0x60e1('0x30')]['offset']);}_0x5e6069[_0x60e1('0x38')]=qs[_0x60e1('0x39')](_0xe7f320[_0x60e1('0x30')]['sort']);_0x5e6069['where']=qs[_0x60e1('0x31')](_[_0x60e1('0x3a')](_0xe7f320[_0x60e1('0x30')],_0xe146a6[_0x60e1('0x31')]),_0x3565ff);if(_0xe7f320[_0x60e1('0x30')][_0x60e1('0x3b')]){_0x5e6069[_0x60e1('0x3c')]=_[_0x60e1('0x3d')](_0x5e6069[_0x60e1('0x3c')],{'$or':_['map'](_0x3565ff,function(_0x34a7b6){if(_0x34a7b6['type']!==_0x60e1('0x3e')){var _0x450b2e={};_0x450b2e[_0x34a7b6[_0x60e1('0x28')]]={'$like':'%'+_0xe7f320['query'][_0x60e1('0x3b')]+'%'};return _0x450b2e;}})});}_0x5e6069=_[_0x60e1('0x3d')]({},_0x5e6069,_0xe7f320[_0x60e1('0x3f')]);var _0x2051b4={'where':_0x5e6069[_0x60e1('0x3c')]};return db[_0x60e1('0x2b')][_0x60e1('0x1e')](_0x2051b4)[_0x60e1('0x22')](function(_0x682f64){_0x2d0771[_0x60e1('0x1e')]=_0x682f64;if(_0xe7f320[_0x60e1('0x30')][_0x60e1('0x40')]){_0x5e6069['include']=[{'all':!![]}];}return db['SquareRecording'][_0x60e1('0x41')](_0x5e6069);})['then'](function(_0x507b77){_0x2d0771[_0x60e1('0x42')]=_0x507b77;return _0x2d0771;})[_0x60e1('0x22')](respondWithFilteredResult(_0x549bd0,_0x5e6069))[_0x60e1('0x43')](handleError(_0x549bd0,null));};exports[_0x60e1('0x44')]=function(_0x35fe8c,_0x27bb62){var _0x39f3ce={'raw':!![],'where':{'id':_0x35fe8c[_0x60e1('0x45')]['id']}},_0x3b353d={};_0x3b353d[_0x60e1('0x2e')]=_[_0x60e1('0x2f')](db[_0x60e1('0x2b')][_0x60e1('0x2c')]);_0x3b353d[_0x60e1('0x30')]=_[_0x60e1('0x2f')](_0x35fe8c[_0x60e1('0x30')]);_0x3b353d[_0x60e1('0x31')]=_[_0x60e1('0x32')](_0x3b353d['model'],_0x3b353d['query']);_0x39f3ce[_0x60e1('0x33')]=_['intersection'](_0x3b353d['model'],qs[_0x60e1('0x34')](_0x35fe8c[_0x60e1('0x30')][_0x60e1('0x34')]));_0x39f3ce[_0x60e1('0x33')]=_0x39f3ce[_0x60e1('0x33')][_0x60e1('0x35')]?_0x39f3ce[_0x60e1('0x33')]:_0x3b353d[_0x60e1('0x2e')];if(_0x35fe8c[_0x60e1('0x30')][_0x60e1('0x40')]){_0x39f3ce[_0x60e1('0x46')]=[{'all':!![]}];}_0x39f3ce=_['merge']({},_0x39f3ce,_0x35fe8c['options']);return db[_0x60e1('0x2b')]['find'](_0x39f3ce)[_0x60e1('0x22')](handleEntityNotFound(_0x27bb62,null))[_0x60e1('0x22')](respondWithResult(_0x27bb62,null))[_0x60e1('0x43')](handleError(_0x27bb62,null));};exports[_0x60e1('0x47')]=function(_0x243bde,_0x538fa0){return db[_0x60e1('0x2b')][_0x60e1('0x47')](_0x243bde['body'],{})[_0x60e1('0x22')](respondWithResult(_0x538fa0,0xc9))['catch'](handleError(_0x538fa0,null));};exports[_0x60e1('0x48')]=function(_0x219789,_0x5a7ea8){if(_0x219789[_0x60e1('0x49')]['id']){delete _0x219789[_0x60e1('0x49')]['id'];}return db[_0x60e1('0x2b')][_0x60e1('0x4a')]({'where':{'id':_0x219789[_0x60e1('0x45')]['id']}})[_0x60e1('0x22')](handleEntityNotFound(_0x5a7ea8,null))[_0x60e1('0x22')](saveUpdates(_0x219789[_0x60e1('0x49')],null))[_0x60e1('0x22')](respondWithResult(_0x5a7ea8,null))[_0x60e1('0x43')](handleError(_0x5a7ea8,null));};exports[_0x60e1('0x4b')]=function(_0x14f35f,_0x2336c4,_0x4555f5){var _0x24e019=require(_0x60e1('0x4c'));var _0x402b3a=![];var _0x5548fe={};if(_0x14f35f[_0x60e1('0x30')][_0x60e1('0x4d')]&&_0x14f35f['query']['type']==='uniqueid'){_0x5548fe[_0x60e1('0x4e')]=_0x14f35f[_0x60e1('0x45')]['id'];}else{_0x5548fe['id']=_0x14f35f['params']['id'];}return db[_0x60e1('0x2b')][_0x60e1('0x4a')]({'where':_0x5548fe,'attributes':['id',_0x60e1('0x4f'),_0x60e1('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x2336c4,null))[_0x60e1('0x22')](function(_0x3fabbf){if(_0x3fabbf){var _0x5b5278=_0x3fabbf[_0x60e1('0x4f')];var _0x4fc7c8=util[_0x60e1('0x51')](_0x60e1('0x52'),_0x5b5278);if(fs[_0x60e1('0x53')](_0x4fc7c8)){_0x402b3a=!![];return _0x24e019[_0x60e1('0x54')](_0x4fc7c8,_0x5b5278,config[_0x60e1('0x55')][_0x60e1('0x56')])[_0x60e1('0x22')](function(){return _0x3fabbf;});}return _0x3fabbf;}})['then'](function(_0x5932d4){if(_0x5932d4){var _0x4faa4a=_0x5932d4[_0x60e1('0x4f')];if(!fs['existsSync'](_0x4faa4a)){throw new db[(_0x60e1('0x57'))][(_0x60e1('0x58'))](_0x60e1('0x59'));}if(_0x5932d4[_0x60e1('0x50')]){return _0x2336c4[_0x60e1('0x4b')](_0x4faa4a,_0x5932d4[_0x60e1('0x50')]+path[_0x60e1('0x5a')](_0x4faa4a),function(){if(_0x402b3a){fs[_0x60e1('0x5b')](_0x4faa4a);}});}else{return _0x2336c4[_0x60e1('0x4b')](_0x4faa4a,function(_0x1b9508){if(_0x402b3a){fs['unlink'](_0x4faa4a);}});}}})[_0x60e1('0x43')](function(_0x25f5f0){if(_0x25f5f0[_0x60e1('0x5c')]===_0x60e1('0x59')){_0x2336c4[_0x60e1('0x24')](0x194)[_0x60e1('0x29')](_0x60e1('0x5d'));}else{return handleError(_0x2336c4,null);}});};exports[_0x60e1('0x23')]=function(_0x1e9d02,_0x1fb7e7){return db[_0x60e1('0x2b')][_0x60e1('0x4a')]({'where':{'id':_0x1e9d02[_0x60e1('0x45')]['id']}})[_0x60e1('0x22')](function(_0x417bb1){if(_[_0x60e1('0x5e')](_0x417bb1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x417bb1;})['then'](function(_0x41e53e){var _0x36119b=_0x41e53e[_0x60e1('0x4f')];logger[_0x60e1('0x5f')](_0x60e1('0x60'),_0x36119b);if(!_[_0x60e1('0x5e')](_0x41e53e[_0x60e1('0x4f')])&&fs[_0x60e1('0x53')](_0x36119b)){logger[_0x60e1('0x5f')](_0x60e1('0x61')+_0x36119b+_0x60e1('0x62'));fs[_0x60e1('0x63')](_0x36119b);}_0x36119b=_0x36119b+_0x60e1('0x64');if(!_['isNil'](_0x41e53e['savePath'])&&fs[_0x60e1('0x53')](_0x36119b)){logger[_0x60e1('0x5f')](_0x60e1('0x61')+_0x36119b+_0x60e1('0x62'));fs[_0x60e1('0x63')](_0x36119b);}return _0x41e53e;})[_0x60e1('0x22')](function(_0x34f28e){if(!_0x34f28e)throw new InternalError();return _0x34f28e['destroy']();})[_0x60e1('0x22')](function(){_0x1fb7e7[_0x60e1('0x24')](0xcc)['end']();})['catch'](handleError(_0x1fb7e7,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index c9bca2f..0929479 100644 --- a/server/api/squareRecording/squareRecording.model.js +++ b/server/api/squareRecording/squareRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3f9=['SquareRecording','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0x22ec8b,_0x38902e){var _0x283645=function(_0xad2b55){while(--_0xad2b55){_0x22ec8b['push'](_0x22ec8b['shift']());}};_0x283645(++_0x38902e);}(_0xb3f9,0x7a));var _0x9b3f=function(_0x587f13,_0x442e65){_0x587f13=_0x587f13-0x0;var _0x3d9105=_0xb3f9[_0x587f13];return _0x3d9105;};'use strict';var _=require(_0x9b3f('0x0'));var util=require(_0x9b3f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9b3f('0x2'));var BPromise=require('bluebird');var rp=require(_0x9b3f('0x3'));var fs=require('fs');var path=require(_0x9b3f('0x4'));var rimraf=require(_0x9b3f('0x5'));var config=require(_0x9b3f('0x6'));var attributes=require(_0x9b3f('0x7'));module[_0x9b3f('0x8')]=function(_0x47dc65,_0x52889d){return _0x47dc65[_0x9b3f('0x9')](_0x9b3f('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c9d=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x296313,_0x5b9d39){var _0x5b3787=function(_0x388e9b){while(--_0x388e9b){_0x296313['push'](_0x296313['shift']());}};_0x5b3787(++_0x5b9d39);}(_0x4c9d,0x7c));var _0xd4c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c9d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd4c9('0x0'));var util=require(_0xd4c9('0x1'));var logger=require(_0xd4c9('0x2'))('api');var moment=require(_0xd4c9('0x3'));var BPromise=require(_0xd4c9('0x4'));var rp=require(_0xd4c9('0x5'));var fs=require('fs');var path=require(_0xd4c9('0x6'));var rimraf=require(_0xd4c9('0x7'));var config=require(_0xd4c9('0x8'));var attributes=require(_0xd4c9('0x9'));module[_0xd4c9('0xa')]=function(_0x2c81cb,_0x5980e0){return _0x2c81cb['define'](_0xd4c9('0xb'),attributes,{'tableName':_0xd4c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 1e63ff9..cf49862 100644 --- a/server/api/squareRecording/squareRecording.rpc.js +++ b/server/api/squareRecording/squareRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9961=['catch','body','options','raw','CreateSquareRecording','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xec22ea,_0x29ee8b){var _0x3d210d=function(_0x4c15c7){while(--_0x4c15c7){_0xec22ea['push'](_0xec22ea['shift']());}};_0x3d210d(++_0x29ee8b);}(_0x9961,0xdd));var _0x1996=function(_0x2f4dfc,_0x101381){_0x2f4dfc=_0x2f4dfc-0x0;var _0x7615=_0x9961[_0x2f4dfc];return _0x7615;};'use strict';var _=require('lodash');var util=require(_0x1996('0x0'));var moment=require(_0x1996('0x1'));var BPromise=require(_0x1996('0x2'));var rs=require(_0x1996('0x3'));var fs=require('fs');var Redis=require(_0x1996('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1996('0x5'));var logger=require(_0x1996('0x6'))(_0x1996('0x7'));var config=require('../../config/environment');var jayson=require(_0x1996('0x8'));var client=jayson['client'][_0x1996('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3307ee,_0x35ae59,_0x7c98bb){return new BPromise(function(_0x365fba,_0x380d50){return client[_0x1996('0xa')](_0x3307ee,_0x7c98bb)[_0x1996('0xb')](function(_0x3a2fe3){logger[_0x1996('0xc')](_0x1996('0xd'),_0x35ae59,_0x1996('0xe'));logger[_0x1996('0xf')](_0x1996('0x10'),_0x35ae59,_0x1996('0xe'),JSON[_0x1996('0x11')](_0x3a2fe3));if(_0x3a2fe3[_0x1996('0x12')]){if(_0x3a2fe3['error'][_0x1996('0x13')]===0x1f4){logger[_0x1996('0x12')]('SquareRecording,\x20%s,\x20%s',_0x35ae59,_0x3a2fe3[_0x1996('0x12')][_0x1996('0x14')]);return _0x380d50(_0x3a2fe3[_0x1996('0x12')][_0x1996('0x14')]);}logger['error'](_0x1996('0xd'),_0x35ae59,_0x3a2fe3[_0x1996('0x12')][_0x1996('0x14')]);return _0x365fba(_0x3a2fe3[_0x1996('0x12')][_0x1996('0x14')]);}else{logger[_0x1996('0xc')](_0x1996('0xd'),_0x35ae59,_0x1996('0xe'));_0x365fba(_0x3a2fe3[_0x1996('0x15')][_0x1996('0x14')]);}})[_0x1996('0x16')](function(_0x185489){logger[_0x1996('0x12')](_0x1996('0xd'),_0x35ae59,_0x185489);_0x380d50(_0x185489);});});}exports['CreateSquareRecording']=function(_0x598bf5){var _0x4e603a=this;return new Promise(function(_0x322976,_0x1b172a){return db['SquareRecording']['create'](_0x598bf5[_0x1996('0x17')],{'raw':_0x598bf5[_0x1996('0x18')]?_0x598bf5[_0x1996('0x18')][_0x1996('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x17e217){logger['info'](_0x1996('0x1a'),_0x598bf5);logger['debug'](_0x1996('0x1a'),_0x598bf5,JSON[_0x1996('0x11')](_0x17e217));_0x322976(_0x17e217);})[_0x1996('0x16')](function(_0x5e7a8c){logger[_0x1996('0x12')](_0x1996('0x1a'),_0x5e7a8c[_0x1996('0x14')],_0x598bf5);_0x1b172a(_0x4e603a[_0x1996('0x12')](0x1f4,_0x5e7a8c[_0x1996('0x14')]));});});}; \ No newline at end of file +var _0x222b=['request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','SquareRecording,\x20%s,\x20%s','message','info','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5a803a,_0xb0933c){var _0x5f2647=function(_0x420384){while(--_0x420384){_0x5a803a['push'](_0x5a803a['shift']());}};_0x5f2647(++_0xb0933c);}(_0x222b,0x1d3));var _0xb222=function(_0x1b999f,_0xada878){_0x1b999f=_0x1b999f-0x0;var _0x51d27a=_0x222b[_0x1b999f];return _0x51d27a;};'use strict';var _=require(_0xb222('0x0'));var util=require('util');var moment=require(_0xb222('0x1'));var BPromise=require(_0xb222('0x2'));var rs=require(_0xb222('0x3'));var fs=require('fs');var Redis=require(_0xb222('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb222('0x5'));var logger=require(_0xb222('0x6'))('rpc');var config=require(_0xb222('0x7'));var jayson=require(_0xb222('0x8'));var client=jayson[_0xb222('0x9')][_0xb222('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4677d1,_0x5c3cf4,_0x75199a){return new BPromise(function(_0x4832fe,_0x626bb6){return client[_0xb222('0xb')](_0x4677d1,_0x75199a)[_0xb222('0xc')](function(_0x1b5d75){logger['info']('SquareRecording,\x20%s,\x20%s',_0x5c3cf4,_0xb222('0xd'));logger[_0xb222('0xe')](_0xb222('0xf'),_0x5c3cf4,_0xb222('0xd'),JSON[_0xb222('0x10')](_0x1b5d75));if(_0x1b5d75['error']){if(_0x1b5d75['error'][_0xb222('0x11')]===0x1f4){logger[_0xb222('0x12')](_0xb222('0x13'),_0x5c3cf4,_0x1b5d75[_0xb222('0x12')]['message']);return _0x626bb6(_0x1b5d75[_0xb222('0x12')][_0xb222('0x14')]);}logger['error'](_0xb222('0x13'),_0x5c3cf4,_0x1b5d75[_0xb222('0x12')][_0xb222('0x14')]);return _0x4832fe(_0x1b5d75['error']['message']);}else{logger[_0xb222('0x15')](_0xb222('0x13'),_0x5c3cf4,'request\x20sent');_0x4832fe(_0x1b5d75[_0xb222('0x16')][_0xb222('0x14')]);}})[_0xb222('0x17')](function(_0x89b43f){logger[_0xb222('0x12')](_0xb222('0x13'),_0x5c3cf4,_0x89b43f);_0x626bb6(_0x89b43f);});});}exports['CreateSquareRecording']=function(_0x186d97){var _0x47dd89=this;return new Promise(function(_0x5354ad,_0x10a252){return db[_0xb222('0x18')][_0xb222('0x19')](_0x186d97[_0xb222('0x1a')],{'raw':_0x186d97[_0xb222('0x1b')]?_0x186d97[_0xb222('0x1b')][_0xb222('0x1c')]===undefined?!![]:![]:!![]})[_0xb222('0xc')](function(_0x449341){logger[_0xb222('0x15')](_0xb222('0x1d'),_0x186d97);logger[_0xb222('0xe')](_0xb222('0x1d'),_0x186d97,JSON[_0xb222('0x10')](_0x449341));_0x5354ad(_0x449341);})[_0xb222('0x17')](function(_0x4909cf){logger['error'](_0xb222('0x1d'),_0x4909cf['message'],_0x186d97);_0x10a252(_0x47dd89[_0xb222('0x12')](0x1f4,_0x4909cf[_0xb222('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 5c00213..5b4e516 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x4a4c7a,_0x51f058){var _0x3b2656=function(_0x3c62a9){while(--_0x3c62a9){_0x4a4c7a['push'](_0x4a4c7a['shift']());}};_0x3b2656(++_0x51f058);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 83b6302..fe1ba27 100644 --- a/server/api/squareReport/squareReport.attributes.js +++ b/server/api/squareReport/squareReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d30=['sequelize','exports','STRING'];(function(_0x2724ab,_0x4890a8){var _0x3e05d8=function(_0x13555d){while(--_0x13555d){_0x2724ab['push'](_0x2724ab['shift']());}};_0x3e05d8(++_0x4890a8);}(_0x5d30,0x135));var _0x05d3=function(_0x3f1710,_0x3877a2){_0x3f1710=_0x3f1710-0x0;var _0x528458=_0x5d30[_0x3f1710];return _0x528458;};'use strict';var Sequelize=require(_0x05d3('0x0'));module[_0x05d3('0x1')]={'network':{'type':Sequelize[_0x05d3('0x2')]},'network_script':{'type':Sequelize[_0x05d3('0x2')]},'request':{'type':Sequelize[_0x05d3('0x2')]},'channel':{'type':Sequelize[_0x05d3('0x2')]},'language':{'type':Sequelize[_0x05d3('0x2')]},'type':{'type':Sequelize[_0x05d3('0x2')]},'uniqueid':{'type':Sequelize[_0x05d3('0x2')]},'version':{'type':Sequelize[_0x05d3('0x2')]},'callerid':{'type':Sequelize[_0x05d3('0x2')]},'calleridname':{'type':Sequelize[_0x05d3('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x05d3('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x05d3('0x2')]},'dnid':{'type':Sequelize[_0x05d3('0x2')]},'rdnis':{'type':Sequelize[_0x05d3('0x2')]},'context':{'type':Sequelize[_0x05d3('0x2')]},'extension':{'type':Sequelize[_0x05d3('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x05d3('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x05d3('0x2')]},'project_name':{'type':Sequelize[_0x05d3('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5795=['DATE','sequelize','exports','STRING'];(function(_0x46a4b8,_0x3ffba0){var _0x4f8599=function(_0x591a9b){while(--_0x591a9b){_0x46a4b8['push'](_0x46a4b8['shift']());}};_0x4f8599(++_0x3ffba0);}(_0x5795,0xd1));var _0x5579=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x5795[_0x4d07cc];return _0x42de3b;};'use strict';var Sequelize=require(_0x5579('0x0'));module[_0x5579('0x1')]={'network':{'type':Sequelize[_0x5579('0x2')]},'network_script':{'type':Sequelize[_0x5579('0x2')]},'request':{'type':Sequelize[_0x5579('0x2')]},'channel':{'type':Sequelize[_0x5579('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x5579('0x2')]},'callerid':{'type':Sequelize[_0x5579('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x5579('0x2')]},'callingani2':{'type':Sequelize[_0x5579('0x2')]},'callington':{'type':Sequelize[_0x5579('0x2')]},'callingtns':{'type':Sequelize[_0x5579('0x2')]},'dnid':{'type':Sequelize[_0x5579('0x2')]},'rdnis':{'type':Sequelize[_0x5579('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5579('0x2')]},'priority':{'type':Sequelize[_0x5579('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x5579('0x2')]},'project_name':{'type':Sequelize[_0x5579('0x2')]},'joinAt':{'type':Sequelize[_0x5579('0x3')]},'leaveAt':{'type':Sequelize[_0x5579('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 75e818a..45b5fa1 100644 --- a/server/api/squareReport/squareReport.controller.js +++ b/server/api/squareReport/squareReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9f3=['ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','error','name','send','SquareReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','pick','filter','where','merge','type','VIRTUAL','options','then','includeAll','rows','catch','show','params','length','include','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x34f522,_0x723430){var _0x2503a7=function(_0x5d0c62){while(--_0x5d0c62){_0x34f522['push'](_0x34f522['shift']());}};_0x2503a7(++_0x723430);}(_0xd9f3,0x1b2));var _0x3d9f=function(_0xe8a6c,_0x52cfd6){_0xe8a6c=_0xe8a6c-0x0;var _0x5229fa=_0xd9f3[_0xe8a6c];return _0x5229fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d9f('0x0'));var zipdir=require(_0x3d9f('0x1'));var jsonpatch=require(_0x3d9f('0x2'));var rp=require(_0x3d9f('0x3'));var moment=require('moment');var BPromise=require(_0x3d9f('0x4'));var Mustache=require(_0x3d9f('0x5'));var util=require(_0x3d9f('0x6'));var path=require(_0x3d9f('0x7'));var sox=require(_0x3d9f('0x8'));var csv=require(_0x3d9f('0x9'));var ejs=require(_0x3d9f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d9f('0xb'));var squel=require('squel');var crypto=require(_0x3d9f('0xc'));var jsforce=require(_0x3d9f('0xd'));var deskjs=require(_0x3d9f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3d9f('0xf'));var Papa=require(_0x3d9f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3d9f('0x11'));var as=require(_0x3d9f('0x12'));var hardwareService=require(_0x3d9f('0x13'));var logger=require(_0x3d9f('0x14'))(_0x3d9f('0x15'));var utils=require(_0x3d9f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3d9f('0x17'));var db=require(_0x3d9f('0x18'))['db'];function respondWithStatusCode(_0xe70d5c,_0x403b40){_0x403b40=_0x403b40||0xcc;return function(_0x1084bb){if(_0x1084bb){return _0xe70d5c[_0x3d9f('0x19')](_0x403b40);}return _0xe70d5c[_0x3d9f('0x1a')](_0x403b40)[_0x3d9f('0x1b')]();};}function respondWithResult(_0x39399a,_0x4f9ed0){_0x4f9ed0=_0x4f9ed0||0xc8;return function(_0x478d93){if(_0x478d93){return _0x39399a[_0x3d9f('0x1a')](_0x4f9ed0)[_0x3d9f('0x1c')](_0x478d93);}};}function respondWithFilteredResult(_0x2cb289,_0x2a4136){return function(_0x33d5e4){if(_0x33d5e4){var _0x515b87=typeof _0x2a4136[_0x3d9f('0x1d')]===_0x3d9f('0x1e')&&typeof _0x2a4136[_0x3d9f('0x1f')]==='undefined';var _0x12b053=_0x33d5e4[_0x3d9f('0x20')];var _0x5ba493=_0x515b87?0x0:_0x2a4136['offset'];var _0x24d355=_0x515b87?_0x33d5e4[_0x3d9f('0x20')]:_0x2a4136['offset']+_0x2a4136[_0x3d9f('0x1f')];var _0x3d55ae;if(_0x24d355>=_0x12b053){_0x24d355=_0x12b053;_0x3d55ae=0xc8;}else{_0x3d55ae=0xce;}_0x2cb289['status'](_0x3d55ae);return _0x2cb289[_0x3d9f('0x21')](_0x3d9f('0x22'),_0x5ba493+'-'+_0x24d355+'/'+_0x12b053)[_0x3d9f('0x1c')](_0x33d5e4);}return null;};}function patchUpdates(_0x2a31e7){return function(_0x1618e5){try{jsonpatch[_0x3d9f('0x23')](_0x1618e5,_0x2a31e7,!![]);}catch(_0x2a1066){return BPromise[_0x3d9f('0x24')](_0x2a1066);}return _0x1618e5[_0x3d9f('0x25')]();};}function saveUpdates(_0x173910,_0x3745a4){return function(_0x198ea9){if(_0x198ea9){return _0x198ea9['update'](_0x173910)['then'](function(_0x1b6a1d){return _0x1b6a1d;});}return null;};}function removeEntity(_0x38e3c0,_0x4a1da8){return function(_0x23d63f){if(_0x23d63f){return _0x23d63f['destroy']()['then'](function(){_0x38e3c0[_0x3d9f('0x1a')](0xcc)[_0x3d9f('0x1b')]();});}};}function handleEntityNotFound(_0x9272d3,_0x4db3d9){return function(_0x236c95){if(!_0x236c95){_0x9272d3[_0x3d9f('0x19')](0x194);}return _0x236c95;};}function handleError(_0x232351,_0x530869){_0x530869=_0x530869||0x1f4;return function(_0x1d1159){logger[_0x3d9f('0x26')](_0x1d1159['stack']);if(_0x1d1159[_0x3d9f('0x27')]){delete _0x1d1159['name'];}_0x232351[_0x3d9f('0x1a')](_0x530869)[_0x3d9f('0x28')](_0x1d1159);};}exports['index']=function(_0x1d1d05,_0x1c2c24){var _0x1c9ed1={},_0x590b25={},_0x6e265d={'count':0x0,'rows':[]};var _0x94e658=_['map'](db[_0x3d9f('0x29')][_0x3d9f('0x2a')],function(_0x15dbc9){return{'name':_0x15dbc9[_0x3d9f('0x2b')],'type':_0x15dbc9['type'][_0x3d9f('0x2c')]};});_0x590b25[_0x3d9f('0x2d')]=_[_0x3d9f('0x2e')](_0x94e658,'name');_0x590b25[_0x3d9f('0x2f')]=_[_0x3d9f('0x30')](_0x1d1d05['query']);_0x590b25[_0x3d9f('0x31')]=_[_0x3d9f('0x32')](_0x590b25[_0x3d9f('0x2d')],_0x590b25[_0x3d9f('0x2f')]);_0x1c9ed1[_0x3d9f('0x33')]=_['intersection'](_0x590b25['model'],qs[_0x3d9f('0x34')](_0x1d1d05[_0x3d9f('0x2f')][_0x3d9f('0x34')]));_0x1c9ed1[_0x3d9f('0x33')]=_0x1c9ed1[_0x3d9f('0x33')]['length']?_0x1c9ed1[_0x3d9f('0x33')]:_0x590b25[_0x3d9f('0x2d')];if(!_0x1d1d05['query'][_0x3d9f('0x35')]('nolimit')){_0x1c9ed1[_0x3d9f('0x1f')]=qs[_0x3d9f('0x1f')](_0x1d1d05[_0x3d9f('0x2f')][_0x3d9f('0x1f')]);_0x1c9ed1['offset']=qs[_0x3d9f('0x1d')](_0x1d1d05['query']['offset']);}_0x1c9ed1['order']=qs['sort'](_0x1d1d05[_0x3d9f('0x2f')]['sort']);_0x1c9ed1['where']=qs[_0x3d9f('0x31')](_[_0x3d9f('0x36')](_0x1d1d05[_0x3d9f('0x2f')],_0x590b25['filters']),_0x94e658);if(_0x1d1d05[_0x3d9f('0x2f')][_0x3d9f('0x37')]){_0x1c9ed1[_0x3d9f('0x38')]=_[_0x3d9f('0x39')](_0x1c9ed1[_0x3d9f('0x38')],{'$or':_[_0x3d9f('0x2e')](_0x94e658,function(_0x50d6c5){if(_0x50d6c5[_0x3d9f('0x3a')]!==_0x3d9f('0x3b')){var _0x55a300={};_0x55a300[_0x50d6c5['name']]={'$like':'%'+_0x1d1d05[_0x3d9f('0x2f')][_0x3d9f('0x37')]+'%'};return _0x55a300;}})});}_0x1c9ed1=_[_0x3d9f('0x39')]({},_0x1c9ed1,_0x1d1d05[_0x3d9f('0x3c')]);var _0x3c3fb5={'where':_0x1c9ed1[_0x3d9f('0x38')]};return db['SquareReport'][_0x3d9f('0x20')](_0x3c3fb5)[_0x3d9f('0x3d')](function(_0x3fbcd5){_0x6e265d[_0x3d9f('0x20')]=_0x3fbcd5;if(_0x1d1d05[_0x3d9f('0x2f')][_0x3d9f('0x3e')]){_0x1c9ed1['include']=[{'all':!![]}];}return db[_0x3d9f('0x29')]['findAll'](_0x1c9ed1);})[_0x3d9f('0x3d')](function(_0x4030ee){_0x6e265d[_0x3d9f('0x3f')]=_0x4030ee;return _0x6e265d;})['then'](respondWithFilteredResult(_0x1c2c24,_0x1c9ed1))[_0x3d9f('0x40')](handleError(_0x1c2c24,null));};exports[_0x3d9f('0x41')]=function(_0x49a341,_0x1099ae){var _0xf94c43={'raw':!![],'where':{'id':_0x49a341[_0x3d9f('0x42')]['id']}},_0x584a3c={};_0x584a3c['model']=_['keys'](db[_0x3d9f('0x29')][_0x3d9f('0x2a')]);_0x584a3c[_0x3d9f('0x2f')]=_[_0x3d9f('0x30')](_0x49a341['query']);_0x584a3c['filters']=_['intersection'](_0x584a3c[_0x3d9f('0x2d')],_0x584a3c['query']);_0xf94c43['attributes']=_['intersection'](_0x584a3c['model'],qs[_0x3d9f('0x34')](_0x49a341[_0x3d9f('0x2f')][_0x3d9f('0x34')]));_0xf94c43[_0x3d9f('0x33')]=_0xf94c43[_0x3d9f('0x33')][_0x3d9f('0x43')]?_0xf94c43['attributes']:_0x584a3c['model'];if(_0x49a341[_0x3d9f('0x2f')][_0x3d9f('0x3e')]){_0xf94c43[_0x3d9f('0x44')]=[{'all':!![]}];}_0xf94c43=_[_0x3d9f('0x39')]({},_0xf94c43,_0x49a341[_0x3d9f('0x3c')]);return db[_0x3d9f('0x29')][_0x3d9f('0x45')](_0xf94c43)[_0x3d9f('0x3d')](handleEntityNotFound(_0x1099ae,null))[_0x3d9f('0x3d')](respondWithResult(_0x1099ae,null))[_0x3d9f('0x40')](handleError(_0x1099ae,null));};exports[_0x3d9f('0x46')]=function(_0x23dfd0,_0x531fc5){return db[_0x3d9f('0x29')][_0x3d9f('0x46')](_0x23dfd0[_0x3d9f('0x47')],{})[_0x3d9f('0x3d')](respondWithResult(_0x531fc5,0xc9))[_0x3d9f('0x40')](handleError(_0x531fc5,null));};exports['update']=function(_0x54ffa6,_0x3f72f6){if(_0x54ffa6[_0x3d9f('0x47')]['id']){delete _0x54ffa6[_0x3d9f('0x47')]['id'];}return db[_0x3d9f('0x29')][_0x3d9f('0x45')]({'where':{'id':_0x54ffa6[_0x3d9f('0x42')]['id']}})[_0x3d9f('0x3d')](handleEntityNotFound(_0x3f72f6,null))['then'](saveUpdates(_0x54ffa6[_0x3d9f('0x47')],null))['then'](respondWithResult(_0x3f72f6,null))[_0x3d9f('0x40')](handleError(_0x3f72f6,null));};exports[_0x3d9f('0x48')]=function(_0x1c6814,_0x433219){return db[_0x3d9f('0x29')][_0x3d9f('0x45')]({'where':{'id':_0x1c6814[_0x3d9f('0x42')]['id']}})[_0x3d9f('0x3d')](handleEntityNotFound(_0x433219,null))['then'](removeEntity(_0x433219,null))[_0x3d9f('0x40')](handleError(_0x433219,null));};exports[_0x3d9f('0x49')]=function(_0xaf6050,_0xd25c26){return db[_0x3d9f('0x29')][_0x3d9f('0x49')]()[_0x3d9f('0x3d')](respondWithResult(_0xd25c26,null))[_0x3d9f('0x40')](handleError(_0xd25c26,null));}; \ No newline at end of file +var _0xa57c=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','map','type'];(function(_0x2ebb98,_0x5f099c){var _0x163d87=function(_0x4e2bd7){while(--_0x4e2bd7){_0x2ebb98['push'](_0x2ebb98['shift']());}};_0x163d87(++_0x5f099c);}(_0xa57c,0xf1));var _0xca57=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xa57c[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0xca57('0x0'));var rimraf=require(_0xca57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca57('0x2'));var rp=require(_0xca57('0x3'));var moment=require('moment');var BPromise=require(_0xca57('0x4'));var Mustache=require('mustache');var util=require(_0xca57('0x5'));var path=require(_0xca57('0x6'));var sox=require(_0xca57('0x7'));var csv=require(_0xca57('0x8'));var ejs=require(_0xca57('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca57('0xa'));var squel=require('squel');var crypto=require(_0xca57('0xb'));var jsforce=require(_0xca57('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca57('0xd'));var Redis=require(_0xca57('0xe'));var authService=require(_0xca57('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xca57('0x10'));var hardwareService=require(_0xca57('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xca57('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xca57('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f1353,_0x2e7e9f){_0x2e7e9f=_0x2e7e9f||0xcc;return function(_0x240354){if(_0x240354){return _0x4f1353[_0xca57('0x14')](_0x2e7e9f);}return _0x4f1353[_0xca57('0x15')](_0x2e7e9f)[_0xca57('0x16')]();};}function respondWithResult(_0x24b8e6,_0x2586f2){_0x2586f2=_0x2586f2||0xc8;return function(_0x55277b){if(_0x55277b){return _0x24b8e6[_0xca57('0x15')](_0x2586f2)[_0xca57('0x17')](_0x55277b);}};}function respondWithFilteredResult(_0x4074b0,_0x3602ad){return function(_0x406c11){if(_0x406c11){var _0x2d7758=typeof _0x3602ad[_0xca57('0x18')]===_0xca57('0x19')&&typeof _0x3602ad[_0xca57('0x1a')]===_0xca57('0x19');var _0x583fe2=_0x406c11[_0xca57('0x1b')];var _0x4cbba8=_0x2d7758?0x0:_0x3602ad[_0xca57('0x18')];var _0x1e6cff=_0x2d7758?_0x406c11['count']:_0x3602ad[_0xca57('0x18')]+_0x3602ad['limit'];var _0x43d02a;if(_0x1e6cff>=_0x583fe2){_0x1e6cff=_0x583fe2;_0x43d02a=0xc8;}else{_0x43d02a=0xce;}_0x4074b0[_0xca57('0x15')](_0x43d02a);return _0x4074b0[_0xca57('0x1c')](_0xca57('0x1d'),_0x4cbba8+'-'+_0x1e6cff+'/'+_0x583fe2)[_0xca57('0x17')](_0x406c11);}return null;};}function patchUpdates(_0x33e432){return function(_0x338167){try{jsonpatch[_0xca57('0x1e')](_0x338167,_0x33e432,!![]);}catch(_0x272724){return BPromise['reject'](_0x272724);}return _0x338167[_0xca57('0x1f')]();};}function saveUpdates(_0x5b37b8,_0x337a50){return function(_0x4292dd){if(_0x4292dd){return _0x4292dd['update'](_0x5b37b8)[_0xca57('0x20')](function(_0x5406a9){return _0x5406a9;});}return null;};}function removeEntity(_0x57e8af,_0x5b63d0){return function(_0x49883c){if(_0x49883c){return _0x49883c[_0xca57('0x21')]()[_0xca57('0x20')](function(){_0x57e8af[_0xca57('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b1a41,_0x5e10b7){return function(_0x261e2b){if(!_0x261e2b){_0x3b1a41[_0xca57('0x14')](0x194);}return _0x261e2b;};}function handleError(_0x25c977,_0x32426b){_0x32426b=_0x32426b||0x1f4;return function(_0x9c39d2){logger[_0xca57('0x22')](_0x9c39d2['stack']);if(_0x9c39d2['name']){delete _0x9c39d2[_0xca57('0x23')];}_0x25c977['status'](_0x32426b)[_0xca57('0x24')](_0x9c39d2);};}exports['index']=function(_0x443c68,_0x5f33f7){var _0x272506={},_0x5d3511={},_0x38ed2a={'count':0x0,'rows':[]};var _0x2fbcda=_[_0xca57('0x25')](db['SquareReport']['rawAttributes'],function(_0x52a703){return{'name':_0x52a703['fieldName'],'type':_0x52a703[_0xca57('0x26')][_0xca57('0x27')]};});_0x5d3511[_0xca57('0x28')]=_[_0xca57('0x25')](_0x2fbcda,'name');_0x5d3511[_0xca57('0x29')]=_[_0xca57('0x2a')](_0x443c68[_0xca57('0x29')]);_0x5d3511[_0xca57('0x2b')]=_[_0xca57('0x2c')](_0x5d3511[_0xca57('0x28')],_0x5d3511[_0xca57('0x29')]);_0x272506[_0xca57('0x2d')]=_[_0xca57('0x2c')](_0x5d3511[_0xca57('0x28')],qs['fields'](_0x443c68[_0xca57('0x29')][_0xca57('0x2e')]));_0x272506[_0xca57('0x2d')]=_0x272506[_0xca57('0x2d')][_0xca57('0x2f')]?_0x272506[_0xca57('0x2d')]:_0x5d3511[_0xca57('0x28')];if(!_0x443c68['query'][_0xca57('0x30')](_0xca57('0x31'))){_0x272506['limit']=qs[_0xca57('0x1a')](_0x443c68['query'][_0xca57('0x1a')]);_0x272506[_0xca57('0x18')]=qs[_0xca57('0x18')](_0x443c68['query'][_0xca57('0x18')]);}_0x272506[_0xca57('0x32')]=qs[_0xca57('0x33')](_0x443c68[_0xca57('0x29')][_0xca57('0x33')]);_0x272506[_0xca57('0x34')]=qs[_0xca57('0x2b')](_[_0xca57('0x35')](_0x443c68[_0xca57('0x29')],_0x5d3511[_0xca57('0x2b')]),_0x2fbcda);if(_0x443c68[_0xca57('0x29')][_0xca57('0x36')]){_0x272506[_0xca57('0x34')]=_[_0xca57('0x37')](_0x272506[_0xca57('0x34')],{'$or':_[_0xca57('0x25')](_0x2fbcda,function(_0x2460f5){if(_0x2460f5[_0xca57('0x26')]!==_0xca57('0x38')){var _0x49146d={};_0x49146d[_0x2460f5[_0xca57('0x23')]]={'$like':'%'+_0x443c68[_0xca57('0x29')][_0xca57('0x36')]+'%'};return _0x49146d;}})});}_0x272506=_[_0xca57('0x37')]({},_0x272506,_0x443c68[_0xca57('0x39')]);var _0x58515b={'where':_0x272506[_0xca57('0x34')]};return db[_0xca57('0x3a')][_0xca57('0x1b')](_0x58515b)[_0xca57('0x20')](function(_0x566a4a){_0x38ed2a[_0xca57('0x1b')]=_0x566a4a;if(_0x443c68['query'][_0xca57('0x3b')]){_0x272506['include']=[{'all':!![]}];}return db['SquareReport'][_0xca57('0x3c')](_0x272506);})[_0xca57('0x20')](function(_0x1bc53b){_0x38ed2a[_0xca57('0x3d')]=_0x1bc53b;return _0x38ed2a;})[_0xca57('0x20')](respondWithFilteredResult(_0x5f33f7,_0x272506))[_0xca57('0x3e')](handleError(_0x5f33f7,null));};exports[_0xca57('0x3f')]=function(_0x239ccd,_0x34de7e){var _0x3f3c55={'raw':!![],'where':{'id':_0x239ccd[_0xca57('0x40')]['id']}},_0x4d078e={};_0x4d078e[_0xca57('0x28')]=_['keys'](db[_0xca57('0x3a')][_0xca57('0x41')]);_0x4d078e[_0xca57('0x29')]=_[_0xca57('0x2a')](_0x239ccd[_0xca57('0x29')]);_0x4d078e[_0xca57('0x2b')]=_[_0xca57('0x2c')](_0x4d078e[_0xca57('0x28')],_0x4d078e['query']);_0x3f3c55[_0xca57('0x2d')]=_[_0xca57('0x2c')](_0x4d078e[_0xca57('0x28')],qs[_0xca57('0x2e')](_0x239ccd[_0xca57('0x29')]['fields']));_0x3f3c55[_0xca57('0x2d')]=_0x3f3c55[_0xca57('0x2d')][_0xca57('0x2f')]?_0x3f3c55[_0xca57('0x2d')]:_0x4d078e['model'];if(_0x239ccd['query'][_0xca57('0x3b')]){_0x3f3c55['include']=[{'all':!![]}];}_0x3f3c55=_[_0xca57('0x37')]({},_0x3f3c55,_0x239ccd[_0xca57('0x39')]);return db[_0xca57('0x3a')][_0xca57('0x42')](_0x3f3c55)[_0xca57('0x20')](handleEntityNotFound(_0x34de7e,null))[_0xca57('0x20')](respondWithResult(_0x34de7e,null))['catch'](handleError(_0x34de7e,null));};exports[_0xca57('0x43')]=function(_0x538dde,_0x37ddf7){return db[_0xca57('0x3a')][_0xca57('0x43')](_0x538dde[_0xca57('0x44')],{})[_0xca57('0x20')](respondWithResult(_0x37ddf7,0xc9))[_0xca57('0x3e')](handleError(_0x37ddf7,null));};exports['update']=function(_0x30e0ea,_0x3f065f){if(_0x30e0ea['body']['id']){delete _0x30e0ea[_0xca57('0x44')]['id'];}return db['SquareReport'][_0xca57('0x42')]({'where':{'id':_0x30e0ea[_0xca57('0x40')]['id']}})[_0xca57('0x20')](handleEntityNotFound(_0x3f065f,null))[_0xca57('0x20')](saveUpdates(_0x30e0ea[_0xca57('0x44')],null))[_0xca57('0x20')](respondWithResult(_0x3f065f,null))[_0xca57('0x3e')](handleError(_0x3f065f,null));};exports[_0xca57('0x21')]=function(_0x9adb41,_0x43d658){return db[_0xca57('0x3a')][_0xca57('0x42')]({'where':{'id':_0x9adb41['params']['id']}})['then'](handleEntityNotFound(_0x43d658,null))[_0xca57('0x20')](removeEntity(_0x43d658,null))[_0xca57('0x3e')](handleError(_0x43d658,null));};exports[_0xca57('0x45')]=function(_0x5e1734,_0x375abd){return db[_0xca57('0x3a')]['describe']()[_0xca57('0x20')](respondWithResult(_0x375abd,null))[_0xca57('0x3e')](handleError(_0x375abd,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index eee6700..3ef02cd 100644 --- a/server/api/squareReport/squareReport.model.js +++ b/server/api/squareReport/squareReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf983=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash'];(function(_0x614ef4,_0x28a060){var _0x35e8e2=function(_0x55e81b){while(--_0x55e81b){_0x614ef4['push'](_0x614ef4['shift']());}};_0x35e8e2(++_0x28a060);}(_0xf983,0x131));var _0x3f98=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0xf983[_0x10d0f0];return _0x93e308;};'use strict';var _=require(_0x3f98('0x0'));var util=require(_0x3f98('0x1'));var logger=require(_0x3f98('0x2'))(_0x3f98('0x3'));var moment=require(_0x3f98('0x4'));var BPromise=require(_0x3f98('0x5'));var rp=require(_0x3f98('0x6'));var fs=require('fs');var path=require(_0x3f98('0x7'));var rimraf=require(_0x3f98('0x8'));var config=require(_0x3f98('0x9'));var attributes=require(_0x3f98('0xa'));module[_0x3f98('0xb')]=function(_0x70103d,_0x541c05){return _0x70103d['define'](_0x3f98('0xc'),attributes,{'tableName':_0x3f98('0xd'),'paranoid':![],'indexes':[{'name':_0x3f98('0xe'),'fields':[_0x3f98('0xf'),_0x3f98('0x10')]},{'name':_0x3f98('0x11'),'fields':[_0x3f98('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa76f=['project_name','leaveAt','lodash','util','../../config/logger','bluebird','path','./squareReport.attributes','exports','SquareReport','report_square','uniqueid'];(function(_0x4beff1,_0x26db76){var _0x1917b8=function(_0x329af3){while(--_0x329af3){_0x4beff1['push'](_0x4beff1['shift']());}};_0x1917b8(++_0x26db76);}(_0xa76f,0xfe));var _0xfa76=function(_0x4b10e1,_0x4a4196){_0x4b10e1=_0x4b10e1-0x0;var _0x13829a=_0xa76f[_0x4b10e1];return _0x13829a;};'use strict';var _=require(_0xfa76('0x0'));var util=require(_0xfa76('0x1'));var logger=require(_0xfa76('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfa76('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa76('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa76('0x5'));module[_0xfa76('0x6')]=function(_0x5b66f3,_0x4775f9){return _0x5b66f3['define'](_0xfa76('0x7'),attributes,{'tableName':_0xfa76('0x8'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xfa76('0x9'),_0xfa76('0xa')]},{'name':_0xfa76('0xb'),'fields':[_0xfa76('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 1b314bb..8072970 100644 --- a/server/api/squareReport/squareReport.rpc.js +++ b/server/api/squareReport/squareReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c06=['CreateSquareReport','create','body','options','raw','SquareReport','where','attributes','limit','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','info','request\x20sent','result','catch'];(function(_0x5dde68,_0x4b1b35){var _0x3ba8fc=function(_0x254627){while(--_0x254627){_0x5dde68['push'](_0x5dde68['shift']());}};_0x3ba8fc(++_0x4b1b35);}(_0x3c06,0x9e));var _0x63c0=function(_0x9cc63e,_0x6f7666){_0x9cc63e=_0x9cc63e-0x0;var _0x357bd5=_0x3c06[_0x9cc63e];return _0x357bd5;};'use strict';var _=require(_0x63c0('0x0'));var util=require(_0x63c0('0x1'));var moment=require(_0x63c0('0x2'));var BPromise=require(_0x63c0('0x3'));var rs=require(_0x63c0('0x4'));var fs=require('fs');var Redis=require(_0x63c0('0x5'));var db=require(_0x63c0('0x6'))['db'];var utils=require(_0x63c0('0x7'));var logger=require(_0x63c0('0x8'))(_0x63c0('0x9'));var config=require(_0x63c0('0xa'));var jayson=require(_0x63c0('0xb'));var client=jayson[_0x63c0('0xc')][_0x63c0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3ac3b3,_0x4a5b05,_0x45d2e4){return new BPromise(function(_0x28cc78,_0x14796b){return client[_0x63c0('0xe')](_0x3ac3b3,_0x45d2e4)[_0x63c0('0xf')](function(_0x2f0332){logger['info']('SquareReport,\x20%s,\x20%s',_0x4a5b05,'request\x20sent');logger[_0x63c0('0x10')](_0x63c0('0x11'),_0x4a5b05,'request\x20sent',JSON[_0x63c0('0x12')](_0x2f0332));if(_0x2f0332[_0x63c0('0x13')]){if(_0x2f0332['error'][_0x63c0('0x14')]===0x1f4){logger[_0x63c0('0x13')](_0x63c0('0x15'),_0x4a5b05,_0x2f0332['error'][_0x63c0('0x16')]);return _0x14796b(_0x2f0332[_0x63c0('0x13')][_0x63c0('0x16')]);}logger[_0x63c0('0x13')](_0x63c0('0x15'),_0x4a5b05,_0x2f0332[_0x63c0('0x13')][_0x63c0('0x16')]);return _0x28cc78(_0x2f0332['error'][_0x63c0('0x16')]);}else{logger[_0x63c0('0x17')](_0x63c0('0x15'),_0x4a5b05,_0x63c0('0x18'));_0x28cc78(_0x2f0332[_0x63c0('0x19')][_0x63c0('0x16')]);}})[_0x63c0('0x1a')](function(_0x3d25e2){logger[_0x63c0('0x13')](_0x63c0('0x15'),_0x4a5b05,_0x3d25e2);_0x14796b(_0x3d25e2);});});}exports[_0x63c0('0x1b')]=function(_0x46ad55){var _0x3976c6=this;return new Promise(function(_0x1c67ed,_0x241220){return db['SquareReport'][_0x63c0('0x1c')](_0x46ad55[_0x63c0('0x1d')],{'raw':_0x46ad55[_0x63c0('0x1e')]?_0x46ad55['options'][_0x63c0('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x2ac2f0){logger[_0x63c0('0x17')]('CreateSquareReport',_0x46ad55);logger[_0x63c0('0x10')]('CreateSquareReport',_0x46ad55,JSON['stringify'](_0x2ac2f0));_0x1c67ed(_0x2ac2f0);})[_0x63c0('0x1a')](function(_0x1b3c22){logger[_0x63c0('0x13')]('CreateSquareReport',_0x1b3c22[_0x63c0('0x16')],_0x46ad55);_0x241220(_0x3976c6[_0x63c0('0x13')](0x1f4,_0x1b3c22['message']));});});};exports['UpdateSquareReport']=function(_0x5d4534){var _0x26905e=this;return new Promise(function(_0x976177,_0xf23f5e){return db[_0x63c0('0x20')]['update'](_0x5d4534[_0x63c0('0x1d')],{'raw':_0x5d4534[_0x63c0('0x1e')]?_0x5d4534[_0x63c0('0x1e')][_0x63c0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d4534[_0x63c0('0x1e')]?_0x5d4534[_0x63c0('0x1e')][_0x63c0('0x21')]||null:null,'attributes':_0x5d4534[_0x63c0('0x1e')]?_0x5d4534['options'][_0x63c0('0x22')]||null:null,'limit':_0x5d4534[_0x63c0('0x1e')]?_0x5d4534[_0x63c0('0x1e')][_0x63c0('0x23')]||null:null})['then'](function(_0xc077bb){logger[_0x63c0('0x17')](_0x63c0('0x24'),_0x5d4534);logger[_0x63c0('0x10')](_0x63c0('0x24'),_0x5d4534,JSON['stringify'](_0xc077bb));_0x976177(_0xc077bb);})[_0x63c0('0x1a')](function(_0x1007e6){logger[_0x63c0('0x13')](_0x63c0('0x24'),_0x1007e6[_0x63c0('0x16')],_0x5d4534);_0xf23f5e(_0x26905e[_0x63c0('0x13')](0x1f4,_0x1007e6[_0x63c0('0x16')]));});});}; \ No newline at end of file +var _0x0765=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','then','stringify','catch','UpdateSquareReport','update','attributes','limit','lodash','moment','bluebird'];(function(_0x16a3b1,_0x34f0c6){var _0x4914b8=function(_0x198157){while(--_0x198157){_0x16a3b1['push'](_0x16a3b1['shift']());}};_0x4914b8(++_0x34f0c6);}(_0x0765,0x17e));var _0x5076=function(_0x5214e1,_0x30f6d2){_0x5214e1=_0x5214e1-0x0;var _0x3b7dd4=_0x0765[_0x5214e1];return _0x3b7dd4;};'use strict';var _=require(_0x5076('0x0'));var util=require('util');var moment=require(_0x5076('0x1'));var BPromise=require(_0x5076('0x2'));var rs=require(_0x5076('0x3'));var fs=require('fs');var Redis=require(_0x5076('0x4'));var db=require(_0x5076('0x5'))['db'];var utils=require(_0x5076('0x6'));var logger=require(_0x5076('0x7'))(_0x5076('0x8'));var config=require(_0x5076('0x9'));var jayson=require(_0x5076('0xa'));var client=jayson[_0x5076('0xb')][_0x5076('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21e06,_0xd1fd2f,_0x5996ba){return new BPromise(function(_0x5a6069,_0x1dcc73){return client[_0x5076('0xd')](_0x21e06,_0x5996ba)['then'](function(_0x3cd670){logger[_0x5076('0xe')](_0x5076('0xf'),_0xd1fd2f,_0x5076('0x10'));logger[_0x5076('0x11')](_0x5076('0x12'),_0xd1fd2f,_0x5076('0x10'),JSON['stringify'](_0x3cd670));if(_0x3cd670[_0x5076('0x13')]){if(_0x3cd670['error'][_0x5076('0x14')]===0x1f4){logger['error'](_0x5076('0xf'),_0xd1fd2f,_0x3cd670[_0x5076('0x13')]['message']);return _0x1dcc73(_0x3cd670['error'][_0x5076('0x15')]);}logger[_0x5076('0x13')](_0x5076('0xf'),_0xd1fd2f,_0x3cd670['error'][_0x5076('0x15')]);return _0x5a6069(_0x3cd670[_0x5076('0x13')]['message']);}else{logger[_0x5076('0xe')](_0x5076('0xf'),_0xd1fd2f,_0x5076('0x10'));_0x5a6069(_0x3cd670[_0x5076('0x16')]['message']);}})['catch'](function(_0x517020){logger[_0x5076('0x13')]('SquareReport,\x20%s,\x20%s',_0xd1fd2f,_0x517020);_0x1dcc73(_0x517020);});});}exports[_0x5076('0x17')]=function(_0x1e3625){var _0x203353=this;return new Promise(function(_0x2cbcc1,_0x4a6afe){return db[_0x5076('0x18')][_0x5076('0x19')](_0x1e3625[_0x5076('0x1a')],{'raw':_0x1e3625['options']?_0x1e3625[_0x5076('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x5076('0x1c')](function(_0x20b6b6){logger[_0x5076('0xe')]('CreateSquareReport',_0x1e3625);logger[_0x5076('0x11')](_0x5076('0x17'),_0x1e3625,JSON[_0x5076('0x1d')](_0x20b6b6));_0x2cbcc1(_0x20b6b6);})[_0x5076('0x1e')](function(_0x55cfaf){logger['error']('CreateSquareReport',_0x55cfaf[_0x5076('0x15')],_0x1e3625);_0x4a6afe(_0x203353[_0x5076('0x13')](0x1f4,_0x55cfaf[_0x5076('0x15')]));});});};exports[_0x5076('0x1f')]=function(_0x4cf7b6){var _0x58dfce=this;return new Promise(function(_0x17ad15,_0x3955fd){return db[_0x5076('0x18')][_0x5076('0x20')](_0x4cf7b6[_0x5076('0x1a')],{'raw':_0x4cf7b6['options']?_0x4cf7b6[_0x5076('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cf7b6[_0x5076('0x1b')]?_0x4cf7b6['options']['where']||null:null,'attributes':_0x4cf7b6[_0x5076('0x1b')]?_0x4cf7b6[_0x5076('0x1b')][_0x5076('0x21')]||null:null,'limit':_0x4cf7b6[_0x5076('0x1b')]?_0x4cf7b6[_0x5076('0x1b')][_0x5076('0x22')]||null:null})[_0x5076('0x1c')](function(_0x3dc96a){logger[_0x5076('0xe')](_0x5076('0x1f'),_0x4cf7b6);logger['debug'](_0x5076('0x1f'),_0x4cf7b6,JSON['stringify'](_0x3dc96a));_0x17ad15(_0x3dc96a);})[_0x5076('0x1e')](function(_0x3cd1f){logger[_0x5076('0x13')]('UpdateSquareReport',_0x3cd1f[_0x5076('0x15')],_0x4cf7b6);_0x3955fd(_0x58dfce[_0x5076('0x13')](0x1f4,_0x3cd1f[_0x5076('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 04ff5a2..b63b963 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1524=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','create','put','/:id','update','delete'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x1524,0xeb));var _0x4152=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0x1524[_0x2b305c];return _0x5d8c85;};'use strict';var multer=require(_0x4152('0x0'));var util=require('util');var path=require(_0x4152('0x1'));var timeout=require(_0x4152('0x2'));var express=require(_0x4152('0x3'));var router=express[_0x4152('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4152('0x5'));var config=require(_0x4152('0x6'));var controller=require('./squareReportDetail.controller');router[_0x4152('0x7')]('/',auth[_0x4152('0x8')](),controller[_0x4152('0x9')]);router[_0x4152('0x7')](_0x4152('0xa'),auth[_0x4152('0x8')](),controller['describe']);router[_0x4152('0x7')]('/:id',auth[_0x4152('0x8')](),controller[_0x4152('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4152('0xc')]);router[_0x4152('0xd')](_0x4152('0xe'),auth[_0x4152('0x8')](),controller[_0x4152('0xf')]);router[_0x4152('0x10')](_0x4152('0xe'),auth[_0x4152('0x8')](),controller['destroy']);module[_0x4152('0x11')]=router; \ No newline at end of file +var _0x1f0a=['delete','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x448ff8,_0x5254f){var _0x38eea7=function(_0x14df4c){while(--_0x14df4c){_0x448ff8['push'](_0x448ff8['shift']());}};_0x38eea7(++_0x5254f);}(_0x1f0a,0x155));var _0xa1f0=function(_0xe1d0b2,_0x522a62){_0xe1d0b2=_0xe1d0b2-0x0;var _0x361185=_0x1f0a[_0xe1d0b2];return _0x361185;};'use strict';var multer=require(_0xa1f0('0x0'));var util=require(_0xa1f0('0x1'));var path=require(_0xa1f0('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1f0('0x3'));var router=express['Router']();var fs_extra=require(_0xa1f0('0x4'));var auth=require(_0xa1f0('0x5'));var interaction=require(_0xa1f0('0x6'));var config=require(_0xa1f0('0x7'));var controller=require(_0xa1f0('0x8'));router[_0xa1f0('0x9')]('/',auth[_0xa1f0('0xa')](),controller[_0xa1f0('0xb')]);router[_0xa1f0('0x9')]('/describe',auth[_0xa1f0('0xa')](),controller[_0xa1f0('0xc')]);router[_0xa1f0('0x9')](_0xa1f0('0xd'),auth['isAuthenticated'](),controller[_0xa1f0('0xe')]);router[_0xa1f0('0xf')]('/',auth['isAuthenticated'](),controller[_0xa1f0('0x10')]);router[_0xa1f0('0x11')]('/:id',auth[_0xa1f0('0xa')](),controller[_0xa1f0('0x12')]);router[_0xa1f0('0x13')](_0xa1f0('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e6e360a..44494a9 100644 --- a/server/api/squareReportDetail/squareReportDetail.attributes.js +++ b/server/api/squareReportDetail/squareReportDetail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6263=['exports','STRING','sequelize'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x6263,0x19d));var _0x3626=function(_0x4f6ffd,_0x316dd8){_0x4f6ffd=_0x4f6ffd-0x0;var _0x34a32e=_0x6263[_0x4f6ffd];return _0x34a32e;};'use strict';var Sequelize=require(_0x3626('0x0'));module[_0x3626('0x1')]={'uniqueid':{'type':Sequelize[_0x3626('0x2')]},'node':{'type':Sequelize[_0x3626('0x2')]},'application':{'type':Sequelize[_0x3626('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x3626('0x2')]},'callerid':{'type':Sequelize[_0x3626('0x2')]}}; \ No newline at end of file +var _0xc686=['STRING'];(function(_0x707193,_0x5ae152){var _0xbaedaa=function(_0x46a1ef){while(--_0x46a1ef){_0x707193['push'](_0x707193['shift']());}};_0xbaedaa(++_0x5ae152);}(_0xc686,0x148));var _0x6c68=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xc686[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6c68('0x0')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x6c68('0x0')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x6c68('0x0')]},'callerid':{'type':Sequelize[_0x6c68('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 09449b5..cd025d0 100644 --- a/server/api/squareReportDetail/squareReportDetail.controller.js +++ b/server/api/squareReportDetail/squareReportDetail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1e8=['json','undefined','limit','count','offset','set','apply','reject','save','then','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','filter','where','type','options','includeAll','include','findAll','rows','show','params','merge','update','body','catch','destroy','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x3494a4,_0x1cafde){var _0x4de8d5=function(_0x45d4c4){while(--_0x45d4c4){_0x3494a4['push'](_0x3494a4['shift']());}};_0x4de8d5(++_0x1cafde);}(_0xc1e8,0x10c));var _0x8c1e=function(_0x3d34f0,_0x4a5dc0){_0x3d34f0=_0x3d34f0-0x0;var _0x135ecd=_0xc1e8[_0x3d34f0];return _0x135ecd;};'use strict';var emlformat=require(_0x8c1e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8c1e('0x1'));var rp=require(_0x8c1e('0x2'));var moment=require(_0x8c1e('0x3'));var BPromise=require(_0x8c1e('0x4'));var Mustache=require(_0x8c1e('0x5'));var util=require('util');var path=require(_0x8c1e('0x6'));var sox=require(_0x8c1e('0x7'));var csv=require(_0x8c1e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c1e('0x9'));var _=require(_0x8c1e('0xa'));var squel=require(_0x8c1e('0xb'));var crypto=require(_0x8c1e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8c1e('0xd'));var toCsv=require(_0x8c1e('0x8'));var querystring=require(_0x8c1e('0xe'));var Papa=require(_0x8c1e('0xf'));var Redis=require(_0x8c1e('0x10'));var authService=require(_0x8c1e('0x11'));var qs=require(_0x8c1e('0x12'));var as=require(_0x8c1e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c1e('0x14'))(_0x8c1e('0x15'));var utils=require(_0x8c1e('0x16'));var config=require(_0x8c1e('0x17'));var licenseUtil=require(_0x8c1e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1eb1b0,_0x5c4951){_0x5c4951=_0x5c4951||0xcc;return function(_0x19173d){if(_0x19173d){return _0x1eb1b0[_0x8c1e('0x19')](_0x5c4951);}return _0x1eb1b0[_0x8c1e('0x1a')](_0x5c4951)[_0x8c1e('0x1b')]();};}function respondWithResult(_0xbefd0f,_0x5abff7){_0x5abff7=_0x5abff7||0xc8;return function(_0x21692e){if(_0x21692e){return _0xbefd0f[_0x8c1e('0x1a')](_0x5abff7)[_0x8c1e('0x1c')](_0x21692e);}};}function respondWithFilteredResult(_0x468daa,_0x4b058a){return function(_0x1819dc){if(_0x1819dc){var _0x218bdf=typeof _0x4b058a['offset']===_0x8c1e('0x1d')&&typeof _0x4b058a[_0x8c1e('0x1e')]===_0x8c1e('0x1d');var _0x4e202a=_0x1819dc[_0x8c1e('0x1f')];var _0x16cc2d=_0x218bdf?0x0:_0x4b058a[_0x8c1e('0x20')];var _0x17ea6d=_0x218bdf?_0x1819dc['count']:_0x4b058a[_0x8c1e('0x20')]+_0x4b058a[_0x8c1e('0x1e')];var _0x32c65e;if(_0x17ea6d>=_0x4e202a){_0x17ea6d=_0x4e202a;_0x32c65e=0xc8;}else{_0x32c65e=0xce;}_0x468daa[_0x8c1e('0x1a')](_0x32c65e);return _0x468daa[_0x8c1e('0x21')]('Content-Range',_0x16cc2d+'-'+_0x17ea6d+'/'+_0x4e202a)[_0x8c1e('0x1c')](_0x1819dc);}return null;};}function patchUpdates(_0xf536ad){return function(_0x48a099){try{jsonpatch[_0x8c1e('0x22')](_0x48a099,_0xf536ad,!![]);}catch(_0x52802e){return BPromise[_0x8c1e('0x23')](_0x52802e);}return _0x48a099[_0x8c1e('0x24')]();};}function saveUpdates(_0x3d4c4a,_0x42eb04){return function(_0x392dde){if(_0x392dde){return _0x392dde['update'](_0x3d4c4a)[_0x8c1e('0x25')](function(_0x3331b8){return _0x3331b8;});}return null;};}function removeEntity(_0x47de53,_0x37ac9e){return function(_0x5692a3){if(_0x5692a3){return _0x5692a3['destroy']()[_0x8c1e('0x25')](function(){_0x47de53['status'](0xcc)[_0x8c1e('0x1b')]();});}};}function handleEntityNotFound(_0x184424,_0x386f73){return function(_0x11739e){if(!_0x11739e){_0x184424[_0x8c1e('0x19')](0x194);}return _0x11739e;};}function handleError(_0x19d6c8,_0x274f13){_0x274f13=_0x274f13||0x1f4;return function(_0x49cda8){logger[_0x8c1e('0x26')](_0x49cda8[_0x8c1e('0x27')]);if(_0x49cda8[_0x8c1e('0x28')]){delete _0x49cda8[_0x8c1e('0x28')];}_0x19d6c8[_0x8c1e('0x1a')](_0x274f13)[_0x8c1e('0x29')](_0x49cda8);};}exports[_0x8c1e('0x2a')]=function(_0x4a1bb2,_0x547eda){var _0x3f0141={},_0x2d9dd3={},_0x1604e1={'count':0x0,'rows':[]};var _0x916c43=_[_0x8c1e('0x2b')](db[_0x8c1e('0x2c')][_0x8c1e('0x2d')],function(_0x3c4e90){return{'name':_0x3c4e90[_0x8c1e('0x2e')],'type':_0x3c4e90['type']['key']};});_0x2d9dd3[_0x8c1e('0x2f')]=_[_0x8c1e('0x2b')](_0x916c43,_0x8c1e('0x28'));_0x2d9dd3[_0x8c1e('0x30')]=_[_0x8c1e('0x31')](_0x4a1bb2[_0x8c1e('0x30')]);_0x2d9dd3['filters']=_[_0x8c1e('0x32')](_0x2d9dd3[_0x8c1e('0x2f')],_0x2d9dd3[_0x8c1e('0x30')]);_0x3f0141[_0x8c1e('0x33')]=_[_0x8c1e('0x32')](_0x2d9dd3[_0x8c1e('0x2f')],qs[_0x8c1e('0x34')](_0x4a1bb2[_0x8c1e('0x30')][_0x8c1e('0x34')]));_0x3f0141[_0x8c1e('0x33')]=_0x3f0141[_0x8c1e('0x33')][_0x8c1e('0x35')]?_0x3f0141[_0x8c1e('0x33')]:_0x2d9dd3['model'];if(!_0x4a1bb2[_0x8c1e('0x30')]['hasOwnProperty'](_0x8c1e('0x36'))){_0x3f0141[_0x8c1e('0x1e')]=qs[_0x8c1e('0x1e')](_0x4a1bb2[_0x8c1e('0x30')]['limit']);_0x3f0141[_0x8c1e('0x20')]=qs[_0x8c1e('0x20')](_0x4a1bb2[_0x8c1e('0x30')][_0x8c1e('0x20')]);}_0x3f0141['order']=qs[_0x8c1e('0x37')](_0x4a1bb2[_0x8c1e('0x30')][_0x8c1e('0x37')]);_0x3f0141['where']=qs[_0x8c1e('0x38')](_['pick'](_0x4a1bb2[_0x8c1e('0x30')],_0x2d9dd3[_0x8c1e('0x38')]),_0x916c43);if(_0x4a1bb2[_0x8c1e('0x30')][_0x8c1e('0x39')]){_0x3f0141[_0x8c1e('0x3a')]=_['merge'](_0x3f0141[_0x8c1e('0x3a')],{'$or':_[_0x8c1e('0x2b')](_0x916c43,function(_0x12eeac){if(_0x12eeac[_0x8c1e('0x3b')]!=='VIRTUAL'){var _0x4f0c43={};_0x4f0c43[_0x12eeac[_0x8c1e('0x28')]]={'$like':'%'+_0x4a1bb2[_0x8c1e('0x30')][_0x8c1e('0x39')]+'%'};return _0x4f0c43;}})});}_0x3f0141=_['merge']({},_0x3f0141,_0x4a1bb2[_0x8c1e('0x3c')]);var _0x230cb9={'where':_0x3f0141[_0x8c1e('0x3a')]};return db[_0x8c1e('0x2c')][_0x8c1e('0x1f')](_0x230cb9)[_0x8c1e('0x25')](function(_0x5383d0){_0x1604e1['count']=_0x5383d0;if(_0x4a1bb2[_0x8c1e('0x30')][_0x8c1e('0x3d')]){_0x3f0141[_0x8c1e('0x3e')]=[{'all':!![]}];}return db[_0x8c1e('0x2c')][_0x8c1e('0x3f')](_0x3f0141);})[_0x8c1e('0x25')](function(_0x4ad846){_0x1604e1[_0x8c1e('0x40')]=_0x4ad846;return _0x1604e1;})[_0x8c1e('0x25')](respondWithFilteredResult(_0x547eda,_0x3f0141))['catch'](handleError(_0x547eda,null));};exports[_0x8c1e('0x41')]=function(_0x16c52d,_0x47db20){var _0x343a68={'raw':!![],'where':{'id':_0x16c52d[_0x8c1e('0x42')]['id']}},_0x4a9241={};_0x4a9241[_0x8c1e('0x2f')]=_['keys'](db['SquareDetailsReport'][_0x8c1e('0x2d')]);_0x4a9241['query']=_['keys'](_0x16c52d[_0x8c1e('0x30')]);_0x4a9241[_0x8c1e('0x38')]=_[_0x8c1e('0x32')](_0x4a9241['model'],_0x4a9241[_0x8c1e('0x30')]);_0x343a68[_0x8c1e('0x33')]=_[_0x8c1e('0x32')](_0x4a9241[_0x8c1e('0x2f')],qs['fields'](_0x16c52d['query'][_0x8c1e('0x34')]));_0x343a68[_0x8c1e('0x33')]=_0x343a68['attributes'][_0x8c1e('0x35')]?_0x343a68['attributes']:_0x4a9241[_0x8c1e('0x2f')];if(_0x16c52d[_0x8c1e('0x30')][_0x8c1e('0x3d')]){_0x343a68[_0x8c1e('0x3e')]=[{'all':!![]}];}_0x343a68=_[_0x8c1e('0x43')]({},_0x343a68,_0x16c52d[_0x8c1e('0x3c')]);return db['SquareDetailsReport']['find'](_0x343a68)['then'](handleEntityNotFound(_0x47db20,null))['then'](respondWithResult(_0x47db20,null))['catch'](handleError(_0x47db20,null));};exports['create']=function(_0x519e38,_0x28f159){return db[_0x8c1e('0x2c')]['create'](_0x519e38['body'],{})['then'](respondWithResult(_0x28f159,0xc9))['catch'](handleError(_0x28f159,null));};exports[_0x8c1e('0x44')]=function(_0x215255,_0x466efb){if(_0x215255[_0x8c1e('0x45')]['id']){delete _0x215255['body']['id'];}return db[_0x8c1e('0x2c')]['find']({'where':{'id':_0x215255[_0x8c1e('0x42')]['id']}})[_0x8c1e('0x25')](handleEntityNotFound(_0x466efb,null))[_0x8c1e('0x25')](saveUpdates(_0x215255[_0x8c1e('0x45')],null))['then'](respondWithResult(_0x466efb,null))[_0x8c1e('0x46')](handleError(_0x466efb,null));};exports[_0x8c1e('0x47')]=function(_0x59ee4e,_0xd91a22){return db[_0x8c1e('0x2c')][_0x8c1e('0x48')]({'where':{'id':_0x59ee4e[_0x8c1e('0x42')]['id']}})[_0x8c1e('0x25')](handleEntityNotFound(_0xd91a22,null))[_0x8c1e('0x25')](removeEntity(_0xd91a22,null))[_0x8c1e('0x46')](handleError(_0xd91a22,null));};exports[_0x8c1e('0x49')]=function(_0x449f81,_0x6e5356){return db[_0x8c1e('0x2c')][_0x8c1e('0x49')]()['then'](respondWithResult(_0x6e5356,null))[_0x8c1e('0x46')](handleError(_0x6e5356,null));}; \ No newline at end of file +var _0xf3e7=['findAll','rows','catch','params','keys','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','SquareDetailsReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include'];(function(_0x21ca85,_0x1c359d){var _0x116f7e=function(_0x2f15db){while(--_0x2f15db){_0x21ca85['push'](_0x21ca85['shift']());}};_0x116f7e(++_0x1c359d);}(_0xf3e7,0x1c9));var _0x7f3e=function(_0xe322c,_0x3226f9){_0xe322c=_0xe322c-0x0;var _0x3436b0=_0xf3e7[_0xe322c];return _0x3436b0;};'use strict';var emlformat=require(_0x7f3e('0x0'));var rimraf=require(_0x7f3e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f3e('0x2'));var rp=require('request-promise');var moment=require(_0x7f3e('0x3'));var BPromise=require(_0x7f3e('0x4'));var Mustache=require(_0x7f3e('0x5'));var util=require(_0x7f3e('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7f3e('0x7'));var fs=require('fs');var fs_extra=require(_0x7f3e('0x8'));var _=require(_0x7f3e('0x9'));var squel=require(_0x7f3e('0xa'));var crypto=require(_0x7f3e('0xb'));var jsforce=require(_0x7f3e('0xc'));var deskjs=require(_0x7f3e('0xd'));var toCsv=require(_0x7f3e('0xe'));var querystring=require(_0x7f3e('0xf'));var Papa=require(_0x7f3e('0x10'));var Redis=require(_0x7f3e('0x11'));var authService=require(_0x7f3e('0x12'));var qs=require(_0x7f3e('0x13'));var as=require(_0x7f3e('0x14'));var hardwareService=require(_0x7f3e('0x15'));var logger=require(_0x7f3e('0x16'))(_0x7f3e('0x17'));var utils=require(_0x7f3e('0x18'));var config=require(_0x7f3e('0x19'));var licenseUtil=require(_0x7f3e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4759a7,_0x29a100){_0x29a100=_0x29a100||0xcc;return function(_0x5bdc12){if(_0x5bdc12){return _0x4759a7[_0x7f3e('0x1b')](_0x29a100);}return _0x4759a7[_0x7f3e('0x1c')](_0x29a100)['end']();};}function respondWithResult(_0x4f7b9e,_0x360d8d){_0x360d8d=_0x360d8d||0xc8;return function(_0x1da648){if(_0x1da648){return _0x4f7b9e[_0x7f3e('0x1c')](_0x360d8d)[_0x7f3e('0x1d')](_0x1da648);}};}function respondWithFilteredResult(_0x775d13,_0x13fe18){return function(_0x14202e){if(_0x14202e){var _0x214212=typeof _0x13fe18[_0x7f3e('0x1e')]==='undefined'&&typeof _0x13fe18[_0x7f3e('0x1f')]===_0x7f3e('0x20');var _0x5034a3=_0x14202e[_0x7f3e('0x21')];var _0x13a354=_0x214212?0x0:_0x13fe18[_0x7f3e('0x1e')];var _0x458a71=_0x214212?_0x14202e[_0x7f3e('0x21')]:_0x13fe18[_0x7f3e('0x1e')]+_0x13fe18[_0x7f3e('0x1f')];var _0x99a4b4;if(_0x458a71>=_0x5034a3){_0x458a71=_0x5034a3;_0x99a4b4=0xc8;}else{_0x99a4b4=0xce;}_0x775d13[_0x7f3e('0x1c')](_0x99a4b4);return _0x775d13['set'](_0x7f3e('0x22'),_0x13a354+'-'+_0x458a71+'/'+_0x5034a3)[_0x7f3e('0x1d')](_0x14202e);}return null;};}function patchUpdates(_0x2b1421){return function(_0x19178a){try{jsonpatch[_0x7f3e('0x23')](_0x19178a,_0x2b1421,!![]);}catch(_0x4c8c7d){return BPromise[_0x7f3e('0x24')](_0x4c8c7d);}return _0x19178a[_0x7f3e('0x25')]();};}function saveUpdates(_0x55dc64,_0x5afdf6){return function(_0x49c89d){if(_0x49c89d){return _0x49c89d[_0x7f3e('0x26')](_0x55dc64)[_0x7f3e('0x27')](function(_0x24673b){return _0x24673b;});}return null;};}function removeEntity(_0x12f381,_0xb7cb54){return function(_0x15ee55){if(_0x15ee55){return _0x15ee55[_0x7f3e('0x28')]()[_0x7f3e('0x27')](function(){_0x12f381[_0x7f3e('0x1c')](0xcc)[_0x7f3e('0x29')]();});}};}function handleEntityNotFound(_0x1645c9,_0xd754c4){return function(_0x3b32e9){if(!_0x3b32e9){_0x1645c9['sendStatus'](0x194);}return _0x3b32e9;};}function handleError(_0x168cbd,_0x452167){_0x452167=_0x452167||0x1f4;return function(_0x1382c8){logger[_0x7f3e('0x2a')](_0x1382c8[_0x7f3e('0x2b')]);if(_0x1382c8['name']){delete _0x1382c8[_0x7f3e('0x2c')];}_0x168cbd[_0x7f3e('0x1c')](_0x452167)['send'](_0x1382c8);};}exports[_0x7f3e('0x2d')]=function(_0x51a080,_0x497aba){var _0x4437fd={},_0x4c6796={},_0x43da1e={'count':0x0,'rows':[]};var _0xe58f6=_['map'](db[_0x7f3e('0x2e')][_0x7f3e('0x2f')],function(_0x55f46b){return{'name':_0x55f46b['fieldName'],'type':_0x55f46b[_0x7f3e('0x30')][_0x7f3e('0x31')]};});_0x4c6796[_0x7f3e('0x32')]=_['map'](_0xe58f6,_0x7f3e('0x2c'));_0x4c6796[_0x7f3e('0x33')]=_['keys'](_0x51a080[_0x7f3e('0x33')]);_0x4c6796[_0x7f3e('0x34')]=_[_0x7f3e('0x35')](_0x4c6796[_0x7f3e('0x32')],_0x4c6796[_0x7f3e('0x33')]);_0x4437fd[_0x7f3e('0x36')]=_[_0x7f3e('0x35')](_0x4c6796['model'],qs[_0x7f3e('0x37')](_0x51a080['query']['fields']));_0x4437fd[_0x7f3e('0x36')]=_0x4437fd[_0x7f3e('0x36')][_0x7f3e('0x38')]?_0x4437fd[_0x7f3e('0x36')]:_0x4c6796['model'];if(!_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x39')](_0x7f3e('0x3a'))){_0x4437fd[_0x7f3e('0x1f')]=qs['limit'](_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x1f')]);_0x4437fd[_0x7f3e('0x1e')]=qs[_0x7f3e('0x1e')](_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x1e')]);}_0x4437fd['order']=qs['sort'](_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x3b')]);_0x4437fd[_0x7f3e('0x3c')]=qs[_0x7f3e('0x34')](_['pick'](_0x51a080[_0x7f3e('0x33')],_0x4c6796['filters']),_0xe58f6);if(_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x3d')]){_0x4437fd['where']=_['merge'](_0x4437fd[_0x7f3e('0x3c')],{'$or':_[_0x7f3e('0x3e')](_0xe58f6,function(_0x2872d8){if(_0x2872d8['type']!==_0x7f3e('0x3f')){var _0x4fe442={};_0x4fe442[_0x2872d8['name']]={'$like':'%'+_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x3d')]+'%'};return _0x4fe442;}})});}_0x4437fd=_[_0x7f3e('0x40')]({},_0x4437fd,_0x51a080[_0x7f3e('0x41')]);var _0x4b1f4e={'where':_0x4437fd[_0x7f3e('0x3c')]};return db['SquareDetailsReport']['count'](_0x4b1f4e)['then'](function(_0x3a3d47){_0x43da1e[_0x7f3e('0x21')]=_0x3a3d47;if(_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x42')]){_0x4437fd[_0x7f3e('0x43')]=[{'all':!![]}];}return db[_0x7f3e('0x2e')][_0x7f3e('0x44')](_0x4437fd);})[_0x7f3e('0x27')](function(_0x3e1acc){_0x43da1e[_0x7f3e('0x45')]=_0x3e1acc;return _0x43da1e;})[_0x7f3e('0x27')](respondWithFilteredResult(_0x497aba,_0x4437fd))[_0x7f3e('0x46')](handleError(_0x497aba,null));};exports['show']=function(_0x11056c,_0x422c17){var _0x58b9a4={'raw':!![],'where':{'id':_0x11056c[_0x7f3e('0x47')]['id']}},_0x79efb5={};_0x79efb5['model']=_[_0x7f3e('0x48')](db['SquareDetailsReport'][_0x7f3e('0x2f')]);_0x79efb5[_0x7f3e('0x33')]=_[_0x7f3e('0x48')](_0x11056c[_0x7f3e('0x33')]);_0x79efb5[_0x7f3e('0x34')]=_[_0x7f3e('0x35')](_0x79efb5[_0x7f3e('0x32')],_0x79efb5[_0x7f3e('0x33')]);_0x58b9a4[_0x7f3e('0x36')]=_[_0x7f3e('0x35')](_0x79efb5[_0x7f3e('0x32')],qs[_0x7f3e('0x37')](_0x11056c['query'][_0x7f3e('0x37')]));_0x58b9a4[_0x7f3e('0x36')]=_0x58b9a4[_0x7f3e('0x36')][_0x7f3e('0x38')]?_0x58b9a4[_0x7f3e('0x36')]:_0x79efb5[_0x7f3e('0x32')];if(_0x11056c[_0x7f3e('0x33')][_0x7f3e('0x42')]){_0x58b9a4['include']=[{'all':!![]}];}_0x58b9a4=_[_0x7f3e('0x40')]({},_0x58b9a4,_0x11056c[_0x7f3e('0x41')]);return db['SquareDetailsReport']['find'](_0x58b9a4)[_0x7f3e('0x27')](handleEntityNotFound(_0x422c17,null))[_0x7f3e('0x27')](respondWithResult(_0x422c17,null))[_0x7f3e('0x46')](handleError(_0x422c17,null));};exports[_0x7f3e('0x49')]=function(_0x2ac536,_0x14f474){return db[_0x7f3e('0x2e')]['create'](_0x2ac536[_0x7f3e('0x4a')],{})['then'](respondWithResult(_0x14f474,0xc9))[_0x7f3e('0x46')](handleError(_0x14f474,null));};exports['update']=function(_0x3412e3,_0x1620b3){if(_0x3412e3[_0x7f3e('0x4a')]['id']){delete _0x3412e3[_0x7f3e('0x4a')]['id'];}return db[_0x7f3e('0x2e')]['find']({'where':{'id':_0x3412e3['params']['id']}})['then'](handleEntityNotFound(_0x1620b3,null))[_0x7f3e('0x27')](saveUpdates(_0x3412e3[_0x7f3e('0x4a')],null))[_0x7f3e('0x27')](respondWithResult(_0x1620b3,null))[_0x7f3e('0x46')](handleError(_0x1620b3,null));};exports[_0x7f3e('0x28')]=function(_0x4d2199,_0x4e06c8){return db[_0x7f3e('0x2e')]['find']({'where':{'id':_0x4d2199[_0x7f3e('0x47')]['id']}})[_0x7f3e('0x27')](handleEntityNotFound(_0x4e06c8,null))[_0x7f3e('0x27')](removeEntity(_0x4e06c8,null))['catch'](handleError(_0x4e06c8,null));};exports['describe']=function(_0x2d0aac,_0x4044e9){return db[_0x7f3e('0x2e')]['describe']()['then'](respondWithResult(_0x4044e9,null))[_0x7f3e('0x46')](handleError(_0x4044e9,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 79a15de..6e7228c 100644 --- a/server/api/squareReportDetail/squareReportDetail.model.js +++ b/server/api/squareReportDetail/squareReportDetail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84bc=['exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./squareReportDetail.attributes'];(function(_0x5b945d,_0x489471){var _0x715e62=function(_0xd9f460){while(--_0xd9f460){_0x5b945d['push'](_0x5b945d['shift']());}};_0x715e62(++_0x489471);}(_0x84bc,0x64));var _0xc84b=function(_0xb09e79,_0x31e806){_0xb09e79=_0xb09e79-0x0;var _0x58b790=_0x84bc[_0xb09e79];return _0x58b790;};'use strict';var _=require(_0xc84b('0x0'));var util=require('util');var logger=require(_0xc84b('0x1'))(_0xc84b('0x2'));var moment=require(_0xc84b('0x3'));var BPromise=require(_0xc84b('0x4'));var rp=require(_0xc84b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc84b('0x6'));var attributes=require(_0xc84b('0x7'));module[_0xc84b('0x8')]=function(_0x7d2ce0,_0x3e61f1){return _0x7d2ce0[_0xc84b('0x9')](_0xc84b('0xa'),attributes,{'tableName':_0xc84b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68b9=['path','rimraf','./squareReportDetail.attributes','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','request-promise'];(function(_0x4899d2,_0x37e75d){var _0x1f849a=function(_0x1496e8){while(--_0x1496e8){_0x4899d2['push'](_0x4899d2['shift']());}};_0x1f849a(++_0x37e75d);}(_0x68b9,0x95));var _0x968b=function(_0x315aea,_0x318a80){_0x315aea=_0x315aea-0x0;var _0x4a4bdb=_0x68b9[_0x315aea];return _0x4a4bdb;};'use strict';var _=require(_0x968b('0x0'));var util=require(_0x968b('0x1'));var logger=require(_0x968b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x968b('0x3'));var fs=require('fs');var path=require(_0x968b('0x4'));var rimraf=require(_0x968b('0x5'));var config=require('../../config/environment');var attributes=require(_0x968b('0x6'));module['exports']=function(_0x11f62c,_0x196c69){return _0x11f62c['define'](_0x968b('0x7'),attributes,{'tableName':_0x968b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 2780a32..13f9689 100644 --- a/server/api/squareReportDetail/squareReportDetail.rpc.js +++ b/server/api/squareReportDetail/squareReportDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x531a=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x14af75,_0x2827dc){var _0x2caa5e=function(_0xd64e83){while(--_0xd64e83){_0x14af75['push'](_0x14af75['shift']());}};_0x2caa5e(++_0x2827dc);}(_0x531a,0x100));var _0xa531=function(_0x1aba9c,_0x465976){_0x1aba9c=_0x1aba9c-0x0;var _0x414891=_0x531a[_0x1aba9c];return _0x414891;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var moment=require(_0xa531('0x2'));var BPromise=require(_0xa531('0x3'));var rs=require(_0xa531('0x4'));var fs=require('fs');var Redis=require(_0xa531('0x5'));var db=require(_0xa531('0x6'))['db'];var utils=require(_0xa531('0x7'));var logger=require(_0xa531('0x8'))(_0xa531('0x9'));var config=require('../../config/environment');var jayson=require(_0xa531('0xa'));var client=jayson['client'][_0xa531('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4446b9,_0x3fd172,_0x286dc7){return new BPromise(function(_0x3b68a7,_0x5bd2f9){return client[_0xa531('0xc')](_0x4446b9,_0x286dc7)[_0xa531('0xd')](function(_0x4d07e4){logger[_0xa531('0xe')](_0xa531('0xf'),_0x3fd172,_0xa531('0x10'));logger[_0xa531('0x11')](_0xa531('0x12'),_0x3fd172,'request\x20sent',JSON[_0xa531('0x13')](_0x4d07e4));if(_0x4d07e4['error']){if(_0x4d07e4[_0xa531('0x14')][_0xa531('0x15')]===0x1f4){logger[_0xa531('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x5bd2f9(_0x4d07e4['error'][_0xa531('0x16')]);}logger[_0xa531('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x3b68a7(_0x4d07e4[_0xa531('0x14')]['message']);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0xa531('0x10'));_0x3b68a7(_0x4d07e4[_0xa531('0x17')][_0xa531('0x16')]);}})[_0xa531('0x18')](function(_0x324076){logger[_0xa531('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0x324076);_0x5bd2f9(_0x324076);});});}exports[_0xa531('0x19')]=function(_0x5124a1){var _0x412b84=this;return new Promise(function(_0x146013,_0x4fb62e){return db['SquareDetailsReport'][_0xa531('0x1a')](_0x5124a1[_0xa531('0x1b')],{'raw':_0x5124a1[_0xa531('0x1c')]?_0x5124a1['options'][_0xa531('0x1d')]===undefined?!![]:![]:!![]})[_0xa531('0xd')](function(_0x4096f0){logger['info'](_0xa531('0x19'),_0x5124a1);logger[_0xa531('0x11')]('CreateSquareDetailsReport',_0x5124a1,JSON[_0xa531('0x13')](_0x4096f0));_0x146013(_0x4096f0);})[_0xa531('0x18')](function(_0x3a2016){logger[_0xa531('0x14')](_0xa531('0x19'),_0x3a2016[_0xa531('0x16')],_0x5124a1);_0x4fb62e(_0x412b84[_0xa531('0x14')](0x1f4,_0x3a2016[_0xa531('0x16')]));});});}; \ No newline at end of file +var _0xd914=['client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1c9ee9,_0x49849f){var _0xf94757=function(_0x48df89){while(--_0x48df89){_0x1c9ee9['push'](_0x1c9ee9['shift']());}};_0xf94757(++_0x49849f);}(_0xd914,0x17f));var _0x4d91=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd914[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175ce3,_0x27c0d5,_0x22f2a4){return new BPromise(function(_0x150767,_0x3016c0){return client[_0x4d91('0xb')](_0x175ce3,_0x22f2a4)['then'](function(_0x37bde4){logger[_0x4d91('0xc')](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));logger[_0x4d91('0xf')](_0x4d91('0x10'),_0x27c0d5,'request\x20sent',JSON['stringify'](_0x37bde4));if(_0x37bde4[_0x4d91('0x11')]){if(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x12')]===0x1f4){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')]['message']);return _0x3016c0(_0x37bde4['error'][_0x4d91('0x13')]);}logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);return _0x150767(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);}else{logger['info'](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));_0x150767(_0x37bde4[_0x4d91('0x14')][_0x4d91('0x13')]);}})[_0x4d91('0x15')](function(_0x554ca8){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x554ca8);_0x3016c0(_0x554ca8);});});}exports[_0x4d91('0x16')]=function(_0x44b9a7){var _0x4cfa40=this;return new Promise(function(_0x350e23,_0x3b579b){return db[_0x4d91('0x17')]['create'](_0x44b9a7[_0x4d91('0x18')],{'raw':_0x44b9a7[_0x4d91('0x19')]?_0x44b9a7[_0x4d91('0x19')][_0x4d91('0x1a')]===undefined?!![]:![]:!![]})[_0x4d91('0x1b')](function(_0x40cde4){logger[_0x4d91('0xc')](_0x4d91('0x16'),_0x44b9a7);logger[_0x4d91('0xf')](_0x4d91('0x16'),_0x44b9a7,JSON['stringify'](_0x40cde4));_0x350e23(_0x40cde4);})[_0x4d91('0x15')](function(_0x5f5236){logger['error'](_0x4d91('0x16'),_0x5f5236[_0x4d91('0x13')],_0x44b9a7);_0x3b579b(_0x4cfa40[_0x4d91('0x11')](0x1f4,_0x5f5236[_0x4d91('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 89314fb..5fb18d4 100644 --- a/server/api/system/index.js +++ b/server/api/system/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc72f=['express','../../components/auth/service','./system.controller','index','get','/process/:pid/kill','killProcess'];(function(_0x300099,_0x56becf){var _0x5536f9=function(_0x206259){while(--_0x206259){_0x300099['push'](_0x300099['shift']());}};_0x5536f9(++_0x56becf);}(_0xc72f,0x1b2));var _0xfc72=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xc72f[_0x1d24eb];return _0x1dc576;};'use strict';var express=require(_0xfc72('0x0'));var router=express['Router']();var auth=require(_0xfc72('0x1'));var controller=require(_0xfc72('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0xfc72('0x3')]);router[_0xfc72('0x4')](_0xfc72('0x5'),auth['isAuthenticated'](),controller[_0xfc72('0x6')]);module['exports']=router; \ No newline at end of file +var _0xd680=['express','../../components/auth/service','./system.controller','get','isAuthenticated','killProcess','exports'];(function(_0x22e9e2,_0x2fccc3){var _0x8d7925=function(_0x430adc){while(--_0x430adc){_0x22e9e2['push'](_0x22e9e2['shift']());}};_0x8d7925(++_0x2fccc3);}(_0xd680,0xaf));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x0d68('0x0'));var router=express['Router']();var auth=require(_0x0d68('0x1'));var controller=require(_0x0d68('0x2'));router[_0x0d68('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0d68('0x3')]('/process/:pid/kill',auth[_0x0d68('0x4')](),controller[_0x0d68('0x5')]);module[_0x0d68('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 390d656..d00b681 100644 --- a/server/api/system/system.controller.js +++ b/server/api/system/system.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcb9=['getAllData','catch','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','then','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send'];(function(_0x3baa3b,_0xa01c3e){var _0x966112=function(_0x40d194){while(--_0x40d194){_0x3baa3b['push'](_0x3baa3b['shift']());}};_0x966112(++_0xa01c3e);}(_0xdcb9,0x1c0));var _0x9dcb=function(_0x3725a0,_0x531437){_0x3725a0=_0x3725a0-0x0;var _0x4c81f3=_0xdcb9[_0x3725a0];return _0x4c81f3;};'use strict';var info=require('systeminformation');var exec=require(_0x9dcb('0x0'))[_0x9dcb('0x1')];var logger=require('../../config/logger')(_0x9dcb('0x2'));var util=require('util');var BPromise=require(_0x9dcb('0x3'));var _=require(_0x9dcb('0x4'));function handleError(_0x32e49d,_0x35ecea,_0x4fab54){_0x35ecea=_0x35ecea||0x1f4;return function(_0x5a4b9c){logger[_0x9dcb('0x5')](_0x9dcb('0x6'),_0x4fab54,_0x35ecea,util[_0x9dcb('0x7')](_0x5a4b9c,{'showHidden':![],'depth':null}));delete _0x5a4b9c[_0x9dcb('0x8')];_0x32e49d[_0x9dcb('0x9')](_0x35ecea)[_0x9dcb('0xa')](_0x5a4b9c);};}exports['index']=function(_0x1b384f,_0x3145a0){return info[_0x9dcb('0xb')]()['then'](function(_0x48b92c){return _0x3145a0[_0x9dcb('0x9')](0xc8)['json'](_0x48b92c);})[_0x9dcb('0xc')](function(_0x30a9f6){return _0x3145a0[_0x9dcb('0x9')](0x1f4)[_0x9dcb('0xd')](_0x30a9f6);});};exports[_0x9dcb('0xe')]=function(_0x4933b2,_0x24f5d7){var _0x44d5c9=[_0x9dcb('0xf')];return new BPromise(function(_0x372970,_0x104ea3){return exec(util['format'](_0x9dcb('0x10'),_0x4933b2[_0x9dcb('0x11')]['pid']),function(_0x33396c,_0x36d169,_0x16489f){if(_0x33396c){return _0x104ea3(_0x33396c);}return _0x372970(_0x36d169);});})[_0x9dcb('0x12')](function(_0x334a15){var _0x3ea3be=![];var _0x397f23=_0x334a15[_0x9dcb('0x13')](/\n/);for(var _0xaf6fd7=0x0,_0x4b4275=_0x44d5c9[_0x9dcb('0x14')];_0xaf6fd7<_0x4b4275,_0x3ea3be===![];_0xaf6fd7+=0x1){if(_0x334a15[_0x9dcb('0x15')](_0x44d5c9[_0xaf6fd7])>=0x0){_0x3ea3be=!![];}}if(!_0x3ea3be){throw new Error(util[_0x9dcb('0x16')](_0x9dcb('0x17'),_0x4933b2[_0x9dcb('0x11')]['pid']));}process['kill'](_0x4933b2[_0x9dcb('0x11')][_0x9dcb('0x18')],_0x9dcb('0x19'));return _0x24f5d7[_0x9dcb('0x9')](0xc8)[_0x9dcb('0xd')]({'message':util[_0x9dcb('0x16')](_0x9dcb('0x1a'),_0x4933b2[_0x9dcb('0x11')][_0x9dcb('0x18')])});})[_0x9dcb('0xc')](handleError(_0x24f5d7,null,_0x9dcb('0xe')));}; \ No newline at end of file +var _0x9228=['getAllData','then','json','catch','killProcess','components/import/cm','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9228,0xf9));var _0x8922=function(_0x31b88d,_0x32e9ef){_0x31b88d=_0x31b88d-0x0;var _0x1128c9=_0x9228[_0x31b88d];return _0x1128c9;};'use strict';var info=require(_0x8922('0x0'));var exec=require('child_process')[_0x8922('0x1')];var logger=require('../../config/logger')(_0x8922('0x2'));var util=require(_0x8922('0x3'));var BPromise=require(_0x8922('0x4'));var _=require('lodash');function handleError(_0x440d18,_0xce79c0,_0xde2b45){_0xce79c0=_0xce79c0||0x1f4;return function(_0x1f0a7f){logger[_0x8922('0x5')](_0x8922('0x6'),_0xde2b45,_0xce79c0,util[_0x8922('0x7')](_0x1f0a7f,{'showHidden':![],'depth':null}));delete _0x1f0a7f[_0x8922('0x8')];_0x440d18[_0x8922('0x9')](_0xce79c0)['send'](_0x1f0a7f);};}exports[_0x8922('0xa')]=function(_0x49cb3c,_0x29b097){return info[_0x8922('0xb')]()[_0x8922('0xc')](function(_0x289a40){return _0x29b097[_0x8922('0x9')](0xc8)[_0x8922('0xd')](_0x289a40);})[_0x8922('0xe')](function(_0x4abd0f){return _0x29b097['status'](0x1f4)[_0x8922('0xd')](_0x4abd0f);});};exports[_0x8922('0xf')]=function(_0x44078e,_0x379aa0){var _0x571646=[_0x8922('0x10')];return new BPromise(function(_0x50a026,_0x4a0efa){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x44078e[_0x8922('0x11')][_0x8922('0x12')]),function(_0x253d91,_0x5d9fbd,_0x2539d5){if(_0x253d91){return _0x4a0efa(_0x253d91);}return _0x50a026(_0x5d9fbd);});})[_0x8922('0xc')](function(_0x3a582c){var _0x40e354=![];var _0x1f0a96=_0x3a582c[_0x8922('0x13')](/\n/);for(var _0x5637c1=0x0,_0xde78eb=_0x571646[_0x8922('0x14')];_0x5637c1<_0xde78eb,_0x40e354===![];_0x5637c1+=0x1){if(_0x3a582c['indexOf'](_0x571646[_0x5637c1])>=0x0){_0x40e354=!![];}}if(!_0x40e354){throw new Error(util['format'](_0x8922('0x15'),_0x44078e[_0x8922('0x11')][_0x8922('0x12')]));}process[_0x8922('0x16')](_0x44078e[_0x8922('0x11')][_0x8922('0x12')],_0x8922('0x17'));return _0x379aa0[_0x8922('0x9')](0xc8)['json']({'message':util[_0x8922('0x18')](_0x8922('0x19'),_0x44078e[_0x8922('0x11')][_0x8922('0x12')])});})['catch'](handleError(_0x379aa0,null,_0x8922('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7700a5f..158db34 100644 --- a/server/api/tag/index.js +++ b/server/api/tag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x184c=['Router','../../components/auth/service','./tag.controller','isAuthenticated','index','get','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2987e5,_0x4592f9){var _0x1b4bfb=function(_0x251201){while(--_0x251201){_0x2987e5['push'](_0x2987e5['shift']());}};_0x1b4bfb(++_0x4592f9);}(_0x184c,0x1c3));var _0xc184=function(_0x3a44e5,_0x1b0df3){_0x3a44e5=_0x3a44e5-0x0;var _0x4d0316=_0x184c[_0x3a44e5];return _0x4d0316;};'use strict';var multer=require(_0xc184('0x0'));var util=require(_0xc184('0x1'));var path=require(_0xc184('0x2'));var timeout=require(_0xc184('0x3'));var express=require(_0xc184('0x4'));var router=express[_0xc184('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc184('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc184('0x7'));router['get']('/',auth[_0xc184('0x8')](),controller[_0xc184('0x9')]);router[_0xc184('0xa')]('/:id',auth[_0xc184('0x8')](),controller[_0xc184('0xb')]);router[_0xc184('0xc')]('/',auth[_0xc184('0x8')](),controller['create']);router[_0xc184('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc184('0xe')]);router[_0xc184('0xf')](_0xc184('0x10'),auth[_0xc184('0x8')](),controller[_0xc184('0x11')]);module[_0xc184('0x12')]=router; \ No newline at end of file +var _0x98d1=['../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4947ca,_0x7f5359){var _0x415545=function(_0x289d3e){while(--_0x289d3e){_0x4947ca['push'](_0x4947ca['shift']());}};_0x415545(++_0x7f5359);}(_0x98d1,0x13e));var _0x198d=function(_0xad582f,_0x1e12df){_0xad582f=_0xad582f-0x0;var _0x2e938f=_0x98d1[_0xad582f];return _0x2e938f;};'use strict';var multer=require(_0x198d('0x0'));var util=require('util');var path=require(_0x198d('0x1'));var timeout=require('connect-timeout');var express=require(_0x198d('0x2'));var router=express[_0x198d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x198d('0x4'));var interaction=require(_0x198d('0x5'));var config=require(_0x198d('0x6'));var controller=require(_0x198d('0x7'));router[_0x198d('0x8')]('/',auth['isAuthenticated'](),controller[_0x198d('0x9')]);router[_0x198d('0x8')](_0x198d('0xa'),auth[_0x198d('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x198d('0xc')]);router[_0x198d('0xd')]('/:id',auth[_0x198d('0xb')](),controller[_0x198d('0xe')]);router[_0x198d('0xf')](_0x198d('0xa'),auth[_0x198d('0xb')](),controller[_0x198d('0x10')]);module[_0x198d('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 81f7f16..79eac45 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69af=['STRING','name','#0091EA','exports'];(function(_0x614ef4,_0x28a060){var _0x35e8e2=function(_0x55e81b){while(--_0x55e81b){_0x614ef4['push'](_0x614ef4['shift']());}};_0x35e8e2(++_0x28a060);}(_0x69af,0x17b));var _0xf69a=function(_0x50a74a,_0x1b1382){_0x50a74a=_0x50a74a-0x0;var _0x4629cd=_0x69af[_0x50a74a];return _0x4629cd;};'use strict';var Sequelize=require('sequelize');module[_0xf69a('0x0')]={'name':{'type':Sequelize[_0xf69a('0x1')],'unique':_0xf69a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf69a('0x1')],'defaultValue':_0xf69a('0x3')},'description':{'type':Sequelize[_0xf69a('0x1')]}}; \ No newline at end of file +var _0xea5b=['STRING','#0091EA','sequelize','exports'];(function(_0x3ef3ca,_0x4556f3){var _0x4a9930=function(_0x1eca22){while(--_0x1eca22){_0x3ef3ca['push'](_0x3ef3ca['shift']());}};_0x4a9930(++_0x4556f3);}(_0xea5b,0x152));var _0xbea5=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xea5b[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require(_0xbea5('0x0'));module[_0xbea5('0x1')]={'name':{'type':Sequelize[_0xbea5('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xbea5('0x3')},'description':{'type':Sequelize[_0xbea5('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 8d1f9d6..56e4378 100644 --- a/server/api/tag/tag.controller.js +++ b/server/api/tag/tag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17ba=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','get','Tags','UserProfileResource','destroy','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','options','then','findAll','rows','catch','show','length','includeAll','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x11fbc0,_0x55d9a6){var _0x5b265f=function(_0x240f68){while(--_0x240f68){_0x11fbc0['push'](_0x11fbc0['shift']());}};_0x5b265f(++_0x55d9a6);}(_0x17ba,0xab));var _0xa17b=function(_0x37ab01,_0x239370){_0x37ab01=_0x37ab01-0x0;var _0x4f1229=_0x17ba[_0x37ab01];return _0x4f1229;};'use strict';var emlformat=require(_0xa17b('0x0'));var rimraf=require(_0xa17b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa17b('0x2'));var rp=require(_0xa17b('0x3'));var moment=require(_0xa17b('0x4'));var BPromise=require(_0xa17b('0x5'));var Mustache=require(_0xa17b('0x6'));var util=require(_0xa17b('0x7'));var path=require(_0xa17b('0x8'));var sox=require(_0xa17b('0x9'));var csv=require(_0xa17b('0xa'));var ejs=require(_0xa17b('0xb'));var fs=require('fs');var fs_extra=require(_0xa17b('0xc'));var _=require(_0xa17b('0xd'));var squel=require(_0xa17b('0xe'));var crypto=require(_0xa17b('0xf'));var jsforce=require(_0xa17b('0x10'));var deskjs=require(_0xa17b('0x11'));var toCsv=require(_0xa17b('0xa'));var querystring=require(_0xa17b('0x12'));var Papa=require(_0xa17b('0x13'));var Redis=require('ioredis');var authService=require(_0xa17b('0x14'));var qs=require(_0xa17b('0x15'));var as=require(_0xa17b('0x16'));var hardwareService=require(_0xa17b('0x17'));var logger=require(_0xa17b('0x18'))(_0xa17b('0x19'));var utils=require(_0xa17b('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xa17b('0x1b'));var db=require(_0xa17b('0x1c'))['db'];function respondWithStatusCode(_0x3c3a8a,_0x52b7aa){_0x52b7aa=_0x52b7aa||0xcc;return function(_0x3abc59){if(_0x3abc59){return _0x3c3a8a[_0xa17b('0x1d')](_0x52b7aa);}return _0x3c3a8a[_0xa17b('0x1e')](_0x52b7aa)[_0xa17b('0x1f')]();};}function respondWithResult(_0x4a222e,_0x117ad9){_0x117ad9=_0x117ad9||0xc8;return function(_0x529910){if(_0x529910){return _0x4a222e[_0xa17b('0x1e')](_0x117ad9)[_0xa17b('0x20')](_0x529910);}};}function respondWithFilteredResult(_0x5de138,_0x112764){return function(_0x3c63e3){if(_0x3c63e3){var _0x1c0578=typeof _0x112764[_0xa17b('0x21')]==='undefined'&&typeof _0x112764[_0xa17b('0x22')]==='undefined';var _0x4d5592=_0x3c63e3['count'];var _0x36f985=_0x1c0578?0x0:_0x112764[_0xa17b('0x21')];var _0x53a0f7=_0x1c0578?_0x3c63e3[_0xa17b('0x23')]:_0x112764[_0xa17b('0x21')]+_0x112764[_0xa17b('0x22')];var _0x2fb679;if(_0x53a0f7>=_0x4d5592){_0x53a0f7=_0x4d5592;_0x2fb679=0xc8;}else{_0x2fb679=0xce;}_0x5de138[_0xa17b('0x1e')](_0x2fb679);return _0x5de138[_0xa17b('0x24')](_0xa17b('0x25'),_0x36f985+'-'+_0x53a0f7+'/'+_0x4d5592)['json'](_0x3c63e3);}return null;};}function patchUpdates(_0x610c2b){return function(_0x3f409a){try{jsonpatch[_0xa17b('0x26')](_0x3f409a,_0x610c2b,!![]);}catch(_0x52e75a){return BPromise[_0xa17b('0x27')](_0x52e75a);}return _0x3f409a[_0xa17b('0x28')]();};}function saveUpdates(_0x24d305,_0xbbbb62){return function(_0x3c7ec2){if(_0x3c7ec2){return _0x3c7ec2[_0xa17b('0x29')](_0x24d305)['then'](function(_0x3df11f){return _0x3df11f;});}return null;};}function removeEntity(_0x4d4a65,_0xa34739){return function(_0x13630d){if(_0x13630d){return _0x13630d['destroy']()['then'](function(){var _0x2a298c=_0x13630d[_0xa17b('0x2a')]({'plain':!![]});var _0x4216ca=_0xa17b('0x2b');return db[_0xa17b('0x2c')][_0xa17b('0x2d')]({'where':{'type':_0x4216ca,'resourceId':_0x2a298c['id']}})['then'](function(){return _0x13630d;});})['then'](function(){_0x4d4a65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b1708,_0x5ef356){return function(_0x295e67){if(!_0x295e67){_0x2b1708['sendStatus'](0x194);}return _0x295e67;};}function handleError(_0x14671b,_0x3b2ba6){_0x3b2ba6=_0x3b2ba6||0x1f4;return function(_0x32cad9){logger[_0xa17b('0x2e')](_0x32cad9[_0xa17b('0x2f')]);if(_0x32cad9[_0xa17b('0x30')]){delete _0x32cad9[_0xa17b('0x30')];}_0x14671b[_0xa17b('0x1e')](_0x3b2ba6)[_0xa17b('0x31')](_0x32cad9);};}exports[_0xa17b('0x32')]=function(_0xe84db5,_0x573585){var _0x57a2c4={},_0x58d7b6={},_0x404369={'count':0x0,'rows':[]};var _0x11070a=_[_0xa17b('0x33')](db[_0xa17b('0x34')][_0xa17b('0x35')],function(_0x156409){return{'name':_0x156409[_0xa17b('0x36')],'type':_0x156409[_0xa17b('0x37')]['key']};});_0x58d7b6[_0xa17b('0x38')]=_['map'](_0x11070a,_0xa17b('0x30'));_0x58d7b6[_0xa17b('0x39')]=_[_0xa17b('0x3a')](_0xe84db5[_0xa17b('0x39')]);_0x58d7b6[_0xa17b('0x3b')]=_[_0xa17b('0x3c')](_0x58d7b6['model'],_0x58d7b6[_0xa17b('0x39')]);_0x57a2c4[_0xa17b('0x3d')]=_[_0xa17b('0x3c')](_0x58d7b6[_0xa17b('0x38')],qs[_0xa17b('0x3e')](_0xe84db5['query'][_0xa17b('0x3e')]));_0x57a2c4['attributes']=_0x57a2c4[_0xa17b('0x3d')]['length']?_0x57a2c4[_0xa17b('0x3d')]:_0x58d7b6[_0xa17b('0x38')];if(!_0xe84db5['query'][_0xa17b('0x3f')](_0xa17b('0x40'))){_0x57a2c4['limit']=qs[_0xa17b('0x22')](_0xe84db5[_0xa17b('0x39')][_0xa17b('0x22')]);_0x57a2c4[_0xa17b('0x21')]=qs[_0xa17b('0x21')](_0xe84db5['query'][_0xa17b('0x21')]);}_0x57a2c4['order']=qs[_0xa17b('0x41')](_0xe84db5['query'][_0xa17b('0x41')]);_0x57a2c4['where']=qs[_0xa17b('0x3b')](_['pick'](_0xe84db5[_0xa17b('0x39')],_0x58d7b6['filters']),_0x11070a);if(_0xe84db5[_0xa17b('0x39')][_0xa17b('0x42')]){_0x57a2c4[_0xa17b('0x43')]=_[_0xa17b('0x44')](_0x57a2c4[_0xa17b('0x43')],{'$or':_[_0xa17b('0x33')](_0x11070a,function(_0xc4bb53){if(_0xc4bb53[_0xa17b('0x37')]!=='VIRTUAL'){var _0x468c92={};_0x468c92[_0xc4bb53[_0xa17b('0x30')]]={'$like':'%'+_0xe84db5['query'][_0xa17b('0x42')]+'%'};return _0x468c92;}})});}_0x57a2c4=_[_0xa17b('0x44')]({},_0x57a2c4,_0xe84db5[_0xa17b('0x45')]);var _0x318b3e={'where':_0x57a2c4[_0xa17b('0x43')]};return db[_0xa17b('0x34')]['count'](_0x318b3e)[_0xa17b('0x46')](function(_0x1521fe){_0x404369[_0xa17b('0x23')]=_0x1521fe;if(_0xe84db5['query']['includeAll']){_0x57a2c4['include']=[{'all':!![]}];}return db[_0xa17b('0x34')][_0xa17b('0x47')](_0x57a2c4);})[_0xa17b('0x46')](function(_0x1d6b35){_0x404369[_0xa17b('0x48')]=_0x1d6b35;return _0x404369;})[_0xa17b('0x46')](respondWithFilteredResult(_0x573585,_0x57a2c4))[_0xa17b('0x49')](handleError(_0x573585,null));};exports[_0xa17b('0x4a')]=function(_0x1704ba,_0x24f0de){var _0x1dda63={'raw':!![],'where':{'id':_0x1704ba['params']['id']}},_0x1267de={};_0x1267de[_0xa17b('0x38')]=_[_0xa17b('0x3a')](db[_0xa17b('0x34')][_0xa17b('0x35')]);_0x1267de[_0xa17b('0x39')]=_[_0xa17b('0x3a')](_0x1704ba['query']);_0x1267de[_0xa17b('0x3b')]=_[_0xa17b('0x3c')](_0x1267de[_0xa17b('0x38')],_0x1267de[_0xa17b('0x39')]);_0x1dda63[_0xa17b('0x3d')]=_['intersection'](_0x1267de[_0xa17b('0x38')],qs[_0xa17b('0x3e')](_0x1704ba[_0xa17b('0x39')][_0xa17b('0x3e')]));_0x1dda63['attributes']=_0x1dda63[_0xa17b('0x3d')][_0xa17b('0x4b')]?_0x1dda63[_0xa17b('0x3d')]:_0x1267de[_0xa17b('0x38')];if(_0x1704ba[_0xa17b('0x39')][_0xa17b('0x4c')]){_0x1dda63[_0xa17b('0x4d')]=[{'all':!![]}];}_0x1dda63=_['merge']({},_0x1dda63,_0x1704ba[_0xa17b('0x45')]);return db[_0xa17b('0x34')]['find'](_0x1dda63)[_0xa17b('0x46')](handleEntityNotFound(_0x24f0de,null))[_0xa17b('0x46')](respondWithResult(_0x24f0de,null))[_0xa17b('0x49')](handleError(_0x24f0de,null));};exports['create']=function(_0x187237,_0x4681ca){return db['Tag'][_0xa17b('0x4e')](_0x187237[_0xa17b('0x4f')],{})['then'](function(_0x2950ee){var _0x347436=_0x187237['user'][_0xa17b('0x2a')]({'plain':!![]});if(!_0x347436)throw new Error(_0xa17b('0x50'));if(_0x347436[_0xa17b('0x51')]===_0xa17b('0x52')){var _0x2f4a2c=_0x2950ee[_0xa17b('0x2a')]({'plain':!![]});var _0x32e7ce='Tags';return db[_0xa17b('0x53')][_0xa17b('0x54')]({'where':{'name':_0x32e7ce,'userProfileId':_0x347436[_0xa17b('0x55')]},'raw':!![]})[_0xa17b('0x46')](function(_0x13b3af){if(_0x13b3af&&_0x13b3af[_0xa17b('0x56')]===0x0){return db[_0xa17b('0x2c')][_0xa17b('0x4e')]({'name':_0x2f4a2c[_0xa17b('0x30')],'resourceId':_0x2f4a2c['id'],'type':_0x13b3af[_0xa17b('0x30')],'sectionId':_0x13b3af['id']},{})[_0xa17b('0x46')](function(){return _0x2950ee;});}else{return _0x2950ee;}})[_0xa17b('0x49')](function(_0x40abbf){logger['error'](_0xa17b('0x57'),_0x40abbf);throw _0x40abbf;});}return _0x2950ee;})[_0xa17b('0x46')](respondWithResult(_0x4681ca,0xc9))[_0xa17b('0x49')](handleError(_0x4681ca,null));};exports[_0xa17b('0x29')]=function(_0x43b54f,_0x134c44){if(_0x43b54f[_0xa17b('0x4f')]['id']){delete _0x43b54f[_0xa17b('0x4f')]['id'];}return db[_0xa17b('0x34')]['find']({'where':{'id':_0x43b54f['params']['id']}})[_0xa17b('0x46')](handleEntityNotFound(_0x134c44,null))[_0xa17b('0x46')](saveUpdates(_0x43b54f['body'],null))['then'](respondWithResult(_0x134c44,null))['catch'](handleError(_0x134c44,null));};exports[_0xa17b('0x2d')]=function(_0x402e6a,_0x3aeae5){return db[_0xa17b('0x34')][_0xa17b('0x54')]({'where':{'id':_0x402e6a[_0xa17b('0x58')]['id']}})['then'](handleEntityNotFound(_0x3aeae5,null))['then'](removeEntity(_0x3aeae5,null))['catch'](handleError(_0x3aeae5,null));}; \ No newline at end of file +var _0x80df=['fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Tags','end','sendStatus','error','stack','name','index','Tag','rawAttributes','type','key','map','query','filters','intersection','model'];(function(_0x5d02eb,_0x5bfe53){var _0x5aac6=function(_0x3e574b){while(--_0x3e574b){_0x5d02eb['push'](_0x5d02eb['shift']());}};_0x5aac6(++_0x5bfe53);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf80d('0x0'));var rimraf=require(_0xf80d('0x1'));var zipdir=require(_0xf80d('0x2'));var jsonpatch=require(_0xf80d('0x3'));var rp=require('request-promise');var moment=require(_0xf80d('0x4'));var BPromise=require(_0xf80d('0x5'));var Mustache=require(_0xf80d('0x6'));var util=require(_0xf80d('0x7'));var path=require(_0xf80d('0x8'));var sox=require(_0xf80d('0x9'));var csv=require(_0xf80d('0xa'));var ejs=require(_0xf80d('0xb'));var fs=require('fs');var fs_extra=require(_0xf80d('0xc'));var _=require(_0xf80d('0xd'));var squel=require('squel');var crypto=require(_0xf80d('0xe'));var jsforce=require(_0xf80d('0xf'));var deskjs=require(_0xf80d('0x10'));var toCsv=require(_0xf80d('0xa'));var querystring=require(_0xf80d('0x11'));var Papa=require(_0xf80d('0x12'));var Redis=require(_0xf80d('0x13'));var authService=require(_0xf80d('0x14'));var qs=require(_0xf80d('0x15'));var as=require(_0xf80d('0x16'));var hardwareService=require(_0xf80d('0x17'));var logger=require(_0xf80d('0x18'))(_0xf80d('0x19'));var utils=require(_0xf80d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf80d('0x1b'))['db'];function respondWithStatusCode(_0x74ce36,_0x489bdf){_0x489bdf=_0x489bdf||0xcc;return function(_0x34e130){if(_0x34e130){return _0x74ce36['sendStatus'](_0x489bdf);}return _0x74ce36[_0xf80d('0x1c')](_0x489bdf)['end']();};}function respondWithResult(_0x4285de,_0x50c968){_0x50c968=_0x50c968||0xc8;return function(_0x3be9a9){if(_0x3be9a9){return _0x4285de[_0xf80d('0x1c')](_0x50c968)[_0xf80d('0x1d')](_0x3be9a9);}};}function respondWithFilteredResult(_0x1e1b08,_0x2098d6){return function(_0x45751c){if(_0x45751c){var _0x482043=typeof _0x2098d6[_0xf80d('0x1e')]===_0xf80d('0x1f')&&typeof _0x2098d6[_0xf80d('0x20')]===_0xf80d('0x1f');var _0x27b2ea=_0x45751c[_0xf80d('0x21')];var _0x1d104a=_0x482043?0x0:_0x2098d6[_0xf80d('0x1e')];var _0x2ea2c1=_0x482043?_0x45751c[_0xf80d('0x21')]:_0x2098d6[_0xf80d('0x1e')]+_0x2098d6[_0xf80d('0x20')];var _0x5392c5;if(_0x2ea2c1>=_0x27b2ea){_0x2ea2c1=_0x27b2ea;_0x5392c5=0xc8;}else{_0x5392c5=0xce;}_0x1e1b08[_0xf80d('0x1c')](_0x5392c5);return _0x1e1b08[_0xf80d('0x22')]('Content-Range',_0x1d104a+'-'+_0x2ea2c1+'/'+_0x27b2ea)[_0xf80d('0x1d')](_0x45751c);}return null;};}function patchUpdates(_0x539c80){return function(_0x3f3a2a){try{jsonpatch[_0xf80d('0x23')](_0x3f3a2a,_0x539c80,!![]);}catch(_0x2d5e46){return BPromise[_0xf80d('0x24')](_0x2d5e46);}return _0x3f3a2a[_0xf80d('0x25')]();};}function saveUpdates(_0x25d031,_0x446153){return function(_0x269859){if(_0x269859){return _0x269859[_0xf80d('0x26')](_0x25d031)[_0xf80d('0x27')](function(_0x33d58c){return _0x33d58c;});}return null;};}function removeEntity(_0x739968,_0x570c99){return function(_0x32ad42){if(_0x32ad42){return _0x32ad42[_0xf80d('0x28')]()['then'](function(){var _0x3353a3=_0x32ad42[_0xf80d('0x29')]({'plain':!![]});var _0x323540=_0xf80d('0x2a');return db['UserProfileResource'][_0xf80d('0x28')]({'where':{'type':_0x323540,'resourceId':_0x3353a3['id']}})[_0xf80d('0x27')](function(){return _0x32ad42;});})[_0xf80d('0x27')](function(){_0x739968[_0xf80d('0x1c')](0xcc)[_0xf80d('0x2b')]();});}};}function handleEntityNotFound(_0xde054a,_0x2fc429){return function(_0x68f2c6){if(!_0x68f2c6){_0xde054a[_0xf80d('0x2c')](0x194);}return _0x68f2c6;};}function handleError(_0x4d2579,_0xe940d6){_0xe940d6=_0xe940d6||0x1f4;return function(_0x1603a4){logger[_0xf80d('0x2d')](_0x1603a4[_0xf80d('0x2e')]);if(_0x1603a4[_0xf80d('0x2f')]){delete _0x1603a4[_0xf80d('0x2f')];}_0x4d2579[_0xf80d('0x1c')](_0xe940d6)['send'](_0x1603a4);};}exports[_0xf80d('0x30')]=function(_0x27887e,_0x214bff){var _0x435e23={},_0x5c3a1d={},_0x487d2c={'count':0x0,'rows':[]};var _0x2359f1=_['map'](db[_0xf80d('0x31')][_0xf80d('0x32')],function(_0x45f76a){return{'name':_0x45f76a['fieldName'],'type':_0x45f76a[_0xf80d('0x33')][_0xf80d('0x34')]};});_0x5c3a1d['model']=_[_0xf80d('0x35')](_0x2359f1,_0xf80d('0x2f'));_0x5c3a1d[_0xf80d('0x36')]=_['keys'](_0x27887e[_0xf80d('0x36')]);_0x5c3a1d[_0xf80d('0x37')]=_[_0xf80d('0x38')](_0x5c3a1d[_0xf80d('0x39')],_0x5c3a1d[_0xf80d('0x36')]);_0x435e23['attributes']=_[_0xf80d('0x38')](_0x5c3a1d['model'],qs[_0xf80d('0x3a')](_0x27887e[_0xf80d('0x36')][_0xf80d('0x3a')]));_0x435e23[_0xf80d('0x3b')]=_0x435e23['attributes'][_0xf80d('0x3c')]?_0x435e23[_0xf80d('0x3b')]:_0x5c3a1d[_0xf80d('0x39')];if(!_0x27887e[_0xf80d('0x36')]['hasOwnProperty'](_0xf80d('0x3d'))){_0x435e23[_0xf80d('0x20')]=qs[_0xf80d('0x20')](_0x27887e[_0xf80d('0x36')][_0xf80d('0x20')]);_0x435e23[_0xf80d('0x1e')]=qs[_0xf80d('0x1e')](_0x27887e[_0xf80d('0x36')]['offset']);}_0x435e23[_0xf80d('0x3e')]=qs[_0xf80d('0x3f')](_0x27887e[_0xf80d('0x36')]['sort']);_0x435e23[_0xf80d('0x40')]=qs['filters'](_[_0xf80d('0x41')](_0x27887e[_0xf80d('0x36')],_0x5c3a1d[_0xf80d('0x37')]),_0x2359f1);if(_0x27887e[_0xf80d('0x36')]['filter']){_0x435e23['where']=_['merge'](_0x435e23[_0xf80d('0x40')],{'$or':_[_0xf80d('0x35')](_0x2359f1,function(_0x2d0ee5){if(_0x2d0ee5[_0xf80d('0x33')]!==_0xf80d('0x42')){var _0x100dc7={};_0x100dc7[_0x2d0ee5['name']]={'$like':'%'+_0x27887e[_0xf80d('0x36')][_0xf80d('0x43')]+'%'};return _0x100dc7;}})});}_0x435e23=_[_0xf80d('0x44')]({},_0x435e23,_0x27887e['options']);var _0x14314a={'where':_0x435e23['where']};return db[_0xf80d('0x31')][_0xf80d('0x21')](_0x14314a)[_0xf80d('0x27')](function(_0x2cd371){_0x487d2c[_0xf80d('0x21')]=_0x2cd371;if(_0x27887e[_0xf80d('0x36')][_0xf80d('0x45')]){_0x435e23[_0xf80d('0x46')]=[{'all':!![]}];}return db[_0xf80d('0x31')][_0xf80d('0x47')](_0x435e23);})[_0xf80d('0x27')](function(_0x437e44){_0x487d2c[_0xf80d('0x48')]=_0x437e44;return _0x487d2c;})[_0xf80d('0x27')](respondWithFilteredResult(_0x214bff,_0x435e23))[_0xf80d('0x49')](handleError(_0x214bff,null));};exports[_0xf80d('0x4a')]=function(_0x43474d,_0x9da271){var _0x19b7eb={'raw':!![],'where':{'id':_0x43474d[_0xf80d('0x4b')]['id']}},_0x24c1e4={};_0x24c1e4[_0xf80d('0x39')]=_[_0xf80d('0x4c')](db[_0xf80d('0x31')][_0xf80d('0x32')]);_0x24c1e4['query']=_[_0xf80d('0x4c')](_0x43474d[_0xf80d('0x36')]);_0x24c1e4[_0xf80d('0x37')]=_[_0xf80d('0x38')](_0x24c1e4[_0xf80d('0x39')],_0x24c1e4['query']);_0x19b7eb[_0xf80d('0x3b')]=_[_0xf80d('0x38')](_0x24c1e4[_0xf80d('0x39')],qs[_0xf80d('0x3a')](_0x43474d[_0xf80d('0x36')][_0xf80d('0x3a')]));_0x19b7eb[_0xf80d('0x3b')]=_0x19b7eb[_0xf80d('0x3b')][_0xf80d('0x3c')]?_0x19b7eb[_0xf80d('0x3b')]:_0x24c1e4[_0xf80d('0x39')];if(_0x43474d[_0xf80d('0x36')][_0xf80d('0x45')]){_0x19b7eb[_0xf80d('0x46')]=[{'all':!![]}];}_0x19b7eb=_[_0xf80d('0x44')]({},_0x19b7eb,_0x43474d[_0xf80d('0x4d')]);return db[_0xf80d('0x31')]['find'](_0x19b7eb)[_0xf80d('0x27')](handleEntityNotFound(_0x9da271,null))[_0xf80d('0x27')](respondWithResult(_0x9da271,null))[_0xf80d('0x49')](handleError(_0x9da271,null));};exports['create']=function(_0x3e5cf6,_0x1088ca){return db['Tag']['create'](_0x3e5cf6[_0xf80d('0x4e')],{})['then'](function(_0xcb5fe7){var _0x24c70e=_0x3e5cf6[_0xf80d('0x4f')][_0xf80d('0x29')]({'plain':!![]});if(!_0x24c70e)throw new Error(_0xf80d('0x50'));if(_0x24c70e[_0xf80d('0x51')]===_0xf80d('0x4f')){var _0x114132=_0xcb5fe7[_0xf80d('0x29')]({'plain':!![]});var _0x1f20a2=_0xf80d('0x2a');return db[_0xf80d('0x52')]['find']({'where':{'name':_0x1f20a2,'userProfileId':_0x24c70e[_0xf80d('0x53')]},'raw':!![]})[_0xf80d('0x27')](function(_0x3c25d7){if(_0x3c25d7&&_0x3c25d7['autoAssociation']===0x0){return db[_0xf80d('0x54')][_0xf80d('0x55')]({'name':_0x114132['name'],'resourceId':_0x114132['id'],'type':_0x3c25d7[_0xf80d('0x2f')],'sectionId':_0x3c25d7['id']},{})[_0xf80d('0x27')](function(){return _0xcb5fe7;});}else{return _0xcb5fe7;}})['catch'](function(_0xee12ae){logger[_0xf80d('0x2d')](_0xf80d('0x56'),_0xee12ae);throw _0xee12ae;});}return _0xcb5fe7;})[_0xf80d('0x27')](respondWithResult(_0x1088ca,0xc9))['catch'](handleError(_0x1088ca,null));};exports[_0xf80d('0x26')]=function(_0x374985,_0x1a4c08){if(_0x374985['body']['id']){delete _0x374985[_0xf80d('0x4e')]['id'];}return db[_0xf80d('0x31')][_0xf80d('0x57')]({'where':{'id':_0x374985[_0xf80d('0x4b')]['id']}})[_0xf80d('0x27')](handleEntityNotFound(_0x1a4c08,null))[_0xf80d('0x27')](saveUpdates(_0x374985[_0xf80d('0x4e')],null))[_0xf80d('0x27')](respondWithResult(_0x1a4c08,null))[_0xf80d('0x49')](handleError(_0x1a4c08,null));};exports[_0xf80d('0x28')]=function(_0x543dba,_0x112342){return db[_0xf80d('0x31')][_0xf80d('0x57')]({'where':{'id':_0x543dba[_0xf80d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x112342,null))['then'](removeEntity(_0x112342,null))[_0xf80d('0x49')](handleError(_0x112342,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index a241499..8f059d0 100644 --- a/server/api/tag/tag.model.js +++ b/server/api/tag/tag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe57a=['define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x54e534,_0x5211ba){var _0x31565a=function(_0x493a9d){while(--_0x493a9d){_0x54e534['push'](_0x54e534['shift']());}};_0x31565a(++_0x5211ba);}(_0xe57a,0x1b3));var _0xae57=function(_0x4abd58,_0x523c62){_0x4abd58=_0x4abd58-0x0;var _0x3608a8=_0xe57a[_0x4abd58];return _0x3608a8;};'use strict';var _=require(_0xae57('0x0'));var util=require(_0xae57('0x1'));var logger=require(_0xae57('0x2'))(_0xae57('0x3'));var moment=require(_0xae57('0x4'));var BPromise=require(_0xae57('0x5'));var rp=require(_0xae57('0x6'));var fs=require('fs');var path=require(_0xae57('0x7'));var rimraf=require('rimraf');var config=require(_0xae57('0x8'));var attributes=require('./tag.attributes');module['exports']=function(_0xfec755,_0x427baf){return _0xfec755[_0xae57('0x9')](_0xae57('0xa'),attributes,{'tableName':_0xae57('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89e3=['./tag.attributes','exports','define','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x404c37,_0x3839ae){var _0x45d73b=function(_0x19e719){while(--_0x19e719){_0x404c37['push'](_0x404c37['shift']());}};_0x45d73b(++_0x3839ae);}(_0x89e3,0x66));var _0x389e=function(_0x4f6812,_0x5cda55){_0x4f6812=_0x4f6812-0x0;var _0x3cca9e=_0x89e3[_0x4f6812];return _0x3cca9e;};'use strict';var _=require('lodash');var util=require(_0x389e('0x0'));var logger=require(_0x389e('0x1'))(_0x389e('0x2'));var moment=require(_0x389e('0x3'));var BPromise=require('bluebird');var rp=require(_0x389e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x389e('0x5'));var attributes=require(_0x389e('0x6'));module[_0x389e('0x7')]=function(_0x78a400,_0x11f26d){return _0x78a400[_0x389e('0x8')]('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 9e2b721..70d074e 100644 --- a/server/api/tag/tag.rpc.js +++ b/server/api/tag/tag.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9f7=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error'];(function(_0x2f0d37,_0x57f183){var _0x543fc1=function(_0x3eb031){while(--_0x3eb031){_0x2f0d37['push'](_0x2f0d37['shift']());}};_0x543fc1(++_0x57f183);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0xf9f7[_0x3ebb69];return _0x421e59;};'use strict';var _=require(_0x7f9f('0x0'));var util=require(_0x7f9f('0x1'));var moment=require(_0x7f9f('0x2'));var BPromise=require(_0x7f9f('0x3'));var rs=require(_0x7f9f('0x4'));var fs=require('fs');var Redis=require(_0x7f9f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f9f('0x6'))(_0x7f9f('0x7'));var config=require(_0x7f9f('0x8'));var jayson=require(_0x7f9f('0x9'));var client=jayson[_0x7f9f('0xa')][_0x7f9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5819,_0x37e39f,_0x3da87e){return new BPromise(function(_0x181328,_0x3e9e75){return client[_0x7f9f('0xc')](_0x5b5819,_0x3da87e)['then'](function(_0x3fda85){logger[_0x7f9f('0xd')](_0x7f9f('0xe'),_0x37e39f,_0x7f9f('0xf'));logger[_0x7f9f('0x10')](_0x7f9f('0x11'),_0x37e39f,_0x7f9f('0xf'),JSON['stringify'](_0x3fda85));if(_0x3fda85[_0x7f9f('0x12')]){if(_0x3fda85[_0x7f9f('0x12')]['code']===0x1f4){logger['error'](_0x7f9f('0xe'),_0x37e39f,_0x3fda85['error'][_0x7f9f('0x13')]);return _0x3e9e75(_0x3fda85[_0x7f9f('0x12')]['message']);}logger[_0x7f9f('0x12')]('Tag,\x20%s,\x20%s',_0x37e39f,_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);return _0x181328(_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);}else{logger[_0x7f9f('0xd')]('Tag,\x20%s,\x20%s',_0x37e39f,_0x7f9f('0xf'));_0x181328(_0x3fda85[_0x7f9f('0x14')]['message']);}})[_0x7f9f('0x15')](function(_0x4a36c8){logger[_0x7f9f('0x12')](_0x7f9f('0xe'),_0x37e39f,_0x4a36c8);_0x3e9e75(_0x4a36c8);});});} \ No newline at end of file +var _0xed1f=['request','then','info','Tag,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1902d3,_0x192697){var _0x2969ae=function(_0x222db8){while(--_0x222db8){_0x1902d3['push'](_0x1902d3['shift']());}};_0x2969ae(++_0x192697);}(_0xed1f,0x6a));var _0xfed1=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xed1f[_0x29d915];return _0x160f86;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('Tag,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 4b20be0..0b96c08 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index fd3e416..bacb5a7 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x1d5666,_0x1a10d8){var _0x44fab5=function(_0x2f1bbb){while(--_0x2f1bbb){_0x1d5666['push'](_0x1d5666['shift']());}};_0x44fab5(++_0x1a10d8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index df8719a..0db432e 100644 --- a/server/api/team/team.controller.js +++ b/server/api/team/team.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77cc=['removeQueues','remove','addAgents','isArray','Chat','Sms','Voice','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','spread','removeAgents','Fax','Openchannel','transaction','Queue:remove','getAgents','hasOwnProperty','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','create','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','isValidChannel','ValidationError','Unknown\x20channel','capitalize','channel','toLowerCase','Queue','order','addQueues','findOne','Queues','ids'];(function(_0x34ff3b,_0x2f15b5){var _0x52238a=function(_0x53d1b0){while(--_0x53d1b0){_0x34ff3b['push'](_0x34ff3b['shift']());}};_0x52238a(++_0x2f15b5);}(_0x77cc,0x149));var _0xc77c=function(_0x329406,_0x34ff27){_0x329406=_0x329406-0x0;var _0x42176f=_0x77cc[_0x329406];return _0x42176f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc77c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc77c('0x1'));var rp=require(_0xc77c('0x2'));var moment=require(_0xc77c('0x3'));var BPromise=require(_0xc77c('0x4'));var Mustache=require('mustache');var util=require(_0xc77c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xc77c('0x6'));var ejs=require(_0xc77c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc77c('0x8'));var crypto=require('crypto');var jsforce=require(_0xc77c('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc77c('0xa'));var Papa=require(_0xc77c('0xb'));var Redis=require(_0xc77c('0xc'));var authService=require(_0xc77c('0xd'));var qs=require(_0xc77c('0xe'));var as=require(_0xc77c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc77c('0x10'))(_0xc77c('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc77c('0x12'));var db=require(_0xc77c('0x13'))['db'];config[_0xc77c('0x14')]=_[_0xc77c('0x15')](config[_0xc77c('0x14')],{'host':_0xc77c('0x16'),'port':0x18eb});var socket=require(_0xc77c('0x17'))(new Redis(config['redis']));require(_0xc77c('0x18'))[_0xc77c('0x19')](socket);function respondWithStatusCode(_0x255a5b,_0x1eaee8){_0x1eaee8=_0x1eaee8||0xcc;return function(_0x32fc67){if(_0x32fc67){return _0x255a5b[_0xc77c('0x1a')](_0x1eaee8);}return _0x255a5b[_0xc77c('0x1b')](_0x1eaee8)[_0xc77c('0x1c')]();};}function respondWithResult(_0x192048,_0x44e387){_0x44e387=_0x44e387||0xc8;return function(_0x13efd4){if(_0x13efd4){return _0x192048[_0xc77c('0x1b')](_0x44e387)[_0xc77c('0x1d')](_0x13efd4);}};}function respondWithFilteredResult(_0x3cea10,_0x3691ad){return function(_0x584d5a){if(_0x584d5a){var _0x569825=typeof _0x3691ad[_0xc77c('0x1e')]==='undefined'&&typeof _0x3691ad[_0xc77c('0x1f')]===_0xc77c('0x20');var _0x3d7b1c=_0x584d5a[_0xc77c('0x21')];var _0x21f729=_0x569825?0x0:_0x3691ad[_0xc77c('0x1e')];var _0x33ad03=_0x569825?_0x584d5a[_0xc77c('0x21')]:_0x3691ad[_0xc77c('0x1e')]+_0x3691ad[_0xc77c('0x1f')];var _0x41803f;if(_0x33ad03>=_0x3d7b1c){_0x33ad03=_0x3d7b1c;_0x41803f=0xc8;}else{_0x41803f=0xce;}_0x3cea10['status'](_0x41803f);return _0x3cea10['set']('Content-Range',_0x21f729+'-'+_0x33ad03+'/'+_0x3d7b1c)['json'](_0x584d5a);}return null;};}function patchUpdates(_0xb5eb31){return function(_0x549335){try{jsonpatch[_0xc77c('0x22')](_0x549335,_0xb5eb31,!![]);}catch(_0x5a63a1){return BPromise[_0xc77c('0x23')](_0x5a63a1);}return _0x549335[_0xc77c('0x24')]();};}function saveUpdates(_0x3a3e09,_0x5e2219){return function(_0x3ec45f){if(_0x3ec45f){return _0x3ec45f[_0xc77c('0x25')](_0x3a3e09)[_0xc77c('0x26')](function(_0x872294){return _0x872294;});}return null;};}function handleEntityNotFound(_0x3bea98,_0x58340c){return function(_0x5c0a86){if(!_0x5c0a86){_0x3bea98[_0xc77c('0x1a')](0x194);}return _0x5c0a86;};}function handleError(_0x5146f7,_0x26746d){_0x26746d=_0x26746d||0x1f4;return function(_0x1b15a7){logger[_0xc77c('0x27')](_0x1b15a7[_0xc77c('0x28')]);if(_0x1b15a7['name']){delete _0x1b15a7[_0xc77c('0x29')];}_0x5146f7[_0xc77c('0x1b')](_0x26746d)[_0xc77c('0x2a')](_0x1b15a7);};}exports[_0xc77c('0x2b')]=function(_0x40f68c,_0x51f7f6){var _0x2f17d8={},_0x15d743={},_0x274479={'count':0x0,'rows':[]};var _0x1063ff=_[_0xc77c('0x2c')](db[_0xc77c('0x2d')][_0xc77c('0x2e')],function(_0x4fb189){return{'name':_0x4fb189[_0xc77c('0x2f')],'type':_0x4fb189[_0xc77c('0x30')]['key']};});_0x15d743[_0xc77c('0x31')]=_['map'](_0x1063ff,_0xc77c('0x29'));_0x15d743[_0xc77c('0x32')]=_[_0xc77c('0x33')](_0x40f68c[_0xc77c('0x32')]);_0x15d743[_0xc77c('0x34')]=_[_0xc77c('0x35')](_0x15d743[_0xc77c('0x31')],_0x15d743[_0xc77c('0x32')]);_0x2f17d8[_0xc77c('0x36')]=_['intersection'](_0x15d743[_0xc77c('0x31')],qs[_0xc77c('0x37')](_0x40f68c['query'][_0xc77c('0x37')]));_0x2f17d8[_0xc77c('0x36')]=_0x2f17d8[_0xc77c('0x36')][_0xc77c('0x38')]?_0x2f17d8[_0xc77c('0x36')]:_0x15d743[_0xc77c('0x31')];if(!_0x40f68c[_0xc77c('0x32')]['hasOwnProperty'](_0xc77c('0x39'))){_0x2f17d8[_0xc77c('0x1f')]=qs[_0xc77c('0x1f')](_0x40f68c['query'][_0xc77c('0x1f')]);_0x2f17d8[_0xc77c('0x1e')]=qs['offset'](_0x40f68c[_0xc77c('0x32')][_0xc77c('0x1e')]);}_0x2f17d8['order']=qs[_0xc77c('0x3a')](_0x40f68c[_0xc77c('0x32')]['sort']);_0x2f17d8['where']=qs['filters'](_[_0xc77c('0x3b')](_0x40f68c['query'],_0x15d743[_0xc77c('0x34')]),_0x1063ff);if(_0x40f68c[_0xc77c('0x32')][_0xc77c('0x3c')]){_0x2f17d8[_0xc77c('0x3d')]=_[_0xc77c('0x3e')](_0x2f17d8[_0xc77c('0x3d')],{'$or':_[_0xc77c('0x2c')](_0x1063ff,function(_0x3cc498){if(_0x3cc498[_0xc77c('0x30')]!==_0xc77c('0x3f')){var _0x1e0359={};_0x1e0359[_0x3cc498[_0xc77c('0x29')]]={'$like':'%'+_0x40f68c['query']['filter']+'%'};return _0x1e0359;}})});}_0x2f17d8=_[_0xc77c('0x3e')]({},_0x2f17d8,_0x40f68c[_0xc77c('0x40')]);var _0x2f6086={'where':_0x2f17d8['where']};return db['Team']['count'](_0x2f6086)[_0xc77c('0x26')](function(_0x20440e){_0x274479[_0xc77c('0x21')]=_0x20440e;if(_0x40f68c[_0xc77c('0x32')][_0xc77c('0x41')]){_0x2f17d8[_0xc77c('0x42')]=[{'all':!![]}];}return db[_0xc77c('0x2d')][_0xc77c('0x43')](_0x2f17d8);})[_0xc77c('0x26')](function(_0x40e5f9){_0x274479[_0xc77c('0x44')]=_0x40e5f9;return _0x274479;})[_0xc77c('0x26')](respondWithFilteredResult(_0x51f7f6,_0x2f17d8))[_0xc77c('0x45')](handleError(_0x51f7f6,null));};exports['show']=function(_0x2cac62,_0x41bb5e){var _0x564fa2={'raw':![],'where':{'id':_0x2cac62[_0xc77c('0x46')]['id']}},_0x200607={};_0x200607[_0xc77c('0x31')]=_[_0xc77c('0x33')](db[_0xc77c('0x2d')][_0xc77c('0x2e')]);_0x200607[_0xc77c('0x32')]=_[_0xc77c('0x33')](_0x2cac62['query']);_0x200607[_0xc77c('0x34')]=_[_0xc77c('0x35')](_0x200607[_0xc77c('0x31')],_0x200607[_0xc77c('0x32')]);_0x564fa2[_0xc77c('0x36')]=_[_0xc77c('0x35')](_0x200607[_0xc77c('0x31')],qs[_0xc77c('0x37')](_0x2cac62[_0xc77c('0x32')][_0xc77c('0x37')]));_0x564fa2[_0xc77c('0x36')]=_0x564fa2[_0xc77c('0x36')][_0xc77c('0x38')]?_0x564fa2[_0xc77c('0x36')]:_0x200607[_0xc77c('0x31')];if(_0x2cac62['query'][_0xc77c('0x41')]){_0x564fa2['include']=[{'all':!![]}];}_0x564fa2=_[_0xc77c('0x3e')]({},_0x564fa2,_0x2cac62[_0xc77c('0x40')]);return db[_0xc77c('0x2d')]['find'](_0x564fa2)['then'](handleEntityNotFound(_0x41bb5e,null))[_0xc77c('0x26')](respondWithResult(_0x41bb5e,null))[_0xc77c('0x45')](handleError(_0x41bb5e,null));};exports['create']=function(_0x264a56,_0x501131){return db[_0xc77c('0x2d')]['create'](_0x264a56[_0xc77c('0x47')],{})['then'](function(_0x530870){var _0x2c54db=_0x264a56[_0xc77c('0x48')][_0xc77c('0x49')]({'plain':!![]});if(!_0x2c54db)throw new Error(_0xc77c('0x4a'));if(_0x2c54db[_0xc77c('0x4b')]===_0xc77c('0x48')){var _0x5ad65b=_0x530870[_0xc77c('0x49')]({'plain':!![]});var _0x5b6dcd='Teams';return db['UserProfileSection'][_0xc77c('0x4c')]({'where':{'name':_0x5b6dcd,'userProfileId':_0x2c54db[_0xc77c('0x4d')]},'raw':!![]})['then'](function(_0x11f315){if(_0x11f315&&_0x11f315[_0xc77c('0x4e')]===0x0){return db['UserProfileResource'][_0xc77c('0x4f')]({'name':_0x5ad65b['name'],'resourceId':_0x5ad65b['id'],'type':_0x11f315[_0xc77c('0x29')],'sectionId':_0x11f315['id']},{})['then'](function(){return _0x530870;});}else{return _0x530870;}})[_0xc77c('0x45')](function(_0x38ea0f){logger[_0xc77c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38ea0f);throw _0x38ea0f;});}return _0x530870;})[_0xc77c('0x26')](respondWithResult(_0x501131,0xc9))[_0xc77c('0x45')](handleError(_0x501131,null));};exports[_0xc77c('0x25')]=function(_0x2d9d1c,_0x540041){if(_0x2d9d1c[_0xc77c('0x47')]['id']){delete _0x2d9d1c[_0xc77c('0x47')]['id'];}return db[_0xc77c('0x2d')][_0xc77c('0x4c')]({'where':{'id':_0x2d9d1c[_0xc77c('0x46')]['id']}})[_0xc77c('0x26')](handleEntityNotFound(_0x540041,null))[_0xc77c('0x26')](saveUpdates(_0x2d9d1c[_0xc77c('0x47')],null))[_0xc77c('0x26')](respondWithResult(_0x540041,null))[_0xc77c('0x45')](handleError(_0x540041,null));};exports['destroy']=function(_0x2b0c46,_0x389f45){var _0x17017c=_0x2b0c46[_0xc77c('0x46')]['id'];var _0x47c2ae=[];return db['sequelize']['transaction'](function(_0x23feb9){var _0xde63f8=_0xc77c('0x50')+_0x17017c;return db[_0xc77c('0x51')][_0xc77c('0x32')](_0xde63f8,{'type':db['Sequelize'][_0xc77c('0x52')][_0xc77c('0x53')],'raw':!![],'transaction':_0x23feb9})['then'](function(_0x1d5fa8){_0x47c2ae=_[_0xc77c('0x2c')](_0x1d5fa8,function(_0x3fbdb8){return Number(_0x3fbdb8[_0xc77c('0x54')]);});})[_0xc77c('0x26')](function(){var _0x47074a=_0xc77c('0x55')+_0x17017c;return db[_0xc77c('0x51')][_0xc77c('0x32')](_0x47074a,{'type':db['Sequelize']['QueryTypes'][_0xc77c('0x53')],'raw':!![],'transaction':_0x23feb9});})[_0xc77c('0x26')](function(_0x25e3dd){var _0x274c42=_[_0xc77c('0x2c')](_0x25e3dd,function(_0x4b838d){return Number(_0x4b838d[_0xc77c('0x56')]);});return db[_0xc77c('0x57')][_0xc77c('0x58')]({'where':{'UserId':{'$in':_0x47c2ae},'VoiceQueueId':{'$in':_0x274c42}},'transaction':_0x23feb9});})[_0xc77c('0x26')](function(){var _0x1db842=_0xc77c('0x59')+_0x17017c;return db['sequelize']['query'](_0x1db842,{'type':db[_0xc77c('0x5a')][_0xc77c('0x52')][_0xc77c('0x53')],'raw':!![],'transaction':_0x23feb9});})['then'](function(_0x9fccc1){var _0x6a25fa=_[_0xc77c('0x2c')](_0x9fccc1,function(_0x55860a){return Number(_0x55860a['MailQueueId']);});return db[_0xc77c('0x5b')][_0xc77c('0x58')]({'where':{'UserId':{'$in':_0x47c2ae},'MailQueueId':{'$in':_0x6a25fa}},'transaction':_0x23feb9});})['then'](function(){var _0x561e80=_0xc77c('0x5c')+_0x17017c;return db[_0xc77c('0x51')]['query'](_0x561e80,{'type':db[_0xc77c('0x5a')][_0xc77c('0x52')][_0xc77c('0x53')],'raw':!![],'transaction':_0x23feb9});})[_0xc77c('0x26')](function(_0x284931){var _0x3c1254=_['map'](_0x284931,function(_0x3d3a06){return Number(_0x3d3a06[_0xc77c('0x5d')]);});return db[_0xc77c('0x5e')][_0xc77c('0x58')]({'where':{'UserId':{'$in':_0x47c2ae},'SmsQueueId':{'$in':_0x3c1254}},'transaction':_0x23feb9});})[_0xc77c('0x26')](function(){var _0x9800f2=_0xc77c('0x5f')+_0x17017c;return db[_0xc77c('0x51')][_0xc77c('0x32')](_0x9800f2,{'type':db[_0xc77c('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x23feb9});})[_0xc77c('0x26')](function(_0x18c390){var _0x1a95eb=_[_0xc77c('0x2c')](_0x18c390,function(_0x4c6aab){return Number(_0x4c6aab[_0xc77c('0x60')]);});return db[_0xc77c('0x61')][_0xc77c('0x58')]({'where':{'UserId':{'$in':_0x47c2ae},'ChatQueueId':{'$in':_0x1a95eb}},'transaction':_0x23feb9});})[_0xc77c('0x26')](function(){var _0x4bf466=_0xc77c('0x62')+_0x17017c;return db['sequelize'][_0xc77c('0x32')](_0x4bf466,{'type':db[_0xc77c('0x5a')][_0xc77c('0x52')][_0xc77c('0x53')],'raw':!![],'transaction':_0x23feb9});})[_0xc77c('0x26')](function(_0x3626e1){var _0x42d14a=_[_0xc77c('0x2c')](_0x3626e1,function(_0x289f4d){return Number(_0x289f4d[_0xc77c('0x63')]);});return db[_0xc77c('0x64')][_0xc77c('0x58')]({'where':{'UserId':{'$in':_0x47c2ae},'FaxQueueId':{'$in':_0x42d14a}},'transaction':_0x23feb9});})[_0xc77c('0x26')](function(){var _0x7e9e07=_0xc77c('0x65')+_0x17017c;return db[_0xc77c('0x51')][_0xc77c('0x32')](_0x7e9e07,{'type':db[_0xc77c('0x5a')][_0xc77c('0x52')]['SELECT'],'raw':!![],'transaction':_0x23feb9});})[_0xc77c('0x26')](function(_0x169e0a){var _0x5b5284=_[_0xc77c('0x2c')](_0x169e0a,function(_0x34215d){return Number(_0x34215d[_0xc77c('0x66')]);});return db[_0xc77c('0x67')][_0xc77c('0x58')]({'where':{'UserId':{'$in':_0x47c2ae},'OpenchannelQueueId':{'$in':_0x5b5284}},'transaction':_0x23feb9});})[_0xc77c('0x26')](function(){var _0x5a3ba3=_0xc77c('0x68')+_0x17017c;return db[_0xc77c('0x51')][_0xc77c('0x32')](_0x5a3ba3,{'type':db[_0xc77c('0x5a')][_0xc77c('0x52')][_0xc77c('0x53')],'raw':!![],'transaction':_0x23feb9});})[_0xc77c('0x26')](function(_0x5e5b08){var _0x2497ab=_[_0xc77c('0x2c')](_0x5e5b08,function(_0x3c100f){return Number(_0x3c100f['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0xc77c('0x58')]({'where':{'UserId':{'$in':_0x47c2ae},'WhatsappQueueId':{'$in':_0x2497ab}},'transaction':_0x23feb9});})[_0xc77c('0x26')](function(){return db[_0xc77c('0x69')][_0xc77c('0x4c')]({'where':{'TeamId':_0x17017c}});})[_0xc77c('0x26')](function(_0x4a7d52){if(_0x4a7d52===null){return;}return db[_0xc77c('0x6a')][_0xc77c('0x58')]({'where':{'UserId':{'$in':_0x47c2ae},'VoicePrefixId':_0x4a7d52[_0xc77c('0x6b')]},'transaction':_0x23feb9});})['then'](function(){return db[_0xc77c('0x2d')][_0xc77c('0x58')]({'where':{'id':_0x17017c},'cascade':!![],'transaction':_0x23feb9});})[_0xc77c('0x26')](function(_0x290598){if(_0x290598===0x0){_0x389f45['sendStatus'](0x194);}else{return db[_0xc77c('0x6c')][_0xc77c('0x58')]({'where':{'type':'Teams','resourceId':_0x17017c},'cascade':!![],'transaction':_0x23feb9})['then'](function(){_0x389f45['status'](0xcc)[_0xc77c('0x1c')]();});}})[_0xc77c('0x45')](function(_0x1cf572){_0x389f45['status'](0x1f4)[_0xc77c('0x2a')](_0x1cf572);});});};exports['getQueues']=function(_0xa32083,_0x344597,_0x1bd515){return db[_0xc77c('0x2d')]['findOne']({'where':{'id':_0xa32083['params']['id']}})[_0xc77c('0x26')](handleEntityNotFound(_0x344597,null))[_0xc77c('0x26')](function(_0x581e4e){if(!_0xa32083[_0xc77c('0x32')]['channel']||!utils[_0xc77c('0x6d')](_0xa32083[_0xc77c('0x32')]['channel'])){throw new db[(_0xc77c('0x5a'))][(_0xc77c('0x6e'))](_0xc77c('0x6f'));}var _0x3f31b3={};var _0x3e53e9={};_0x3e53e9[_0xc77c('0x31')]=_[_0xc77c('0x33')](db[_[_0xc77c('0x70')](_0xa32083[_0xc77c('0x32')][_0xc77c('0x71')][_0xc77c('0x72')]())+_0xc77c('0x73')][_0xc77c('0x2e')]);_0x3e53e9[_0xc77c('0x32')]=_[_0xc77c('0x33')](_0xa32083[_0xc77c('0x32')]);_0x3e53e9[_0xc77c('0x34')]=_['intersection'](_0x3e53e9[_0xc77c('0x31')],_0x3e53e9[_0xc77c('0x32')]);_0x3f31b3[_0xc77c('0x36')]=_[_0xc77c('0x35')](_0x3e53e9[_0xc77c('0x31')],qs[_0xc77c('0x37')](_0xa32083[_0xc77c('0x32')][_0xc77c('0x37')]));_0x3f31b3[_0xc77c('0x36')]=_0x3f31b3['attributes'][_0xc77c('0x38')]?_0x3f31b3[_0xc77c('0x36')]:_0x3e53e9['model'];_0x3f31b3[_0xc77c('0x1f')]=qs['limit'](_0xa32083[_0xc77c('0x32')][_0xc77c('0x1f')]);_0x3f31b3[_0xc77c('0x1e')]=qs[_0xc77c('0x1e')](_0xa32083[_0xc77c('0x32')][_0xc77c('0x1e')]);_0x3f31b3[_0xc77c('0x74')]=qs[_0xc77c('0x3a')](_0xa32083['query']['sort']);_0x3f31b3['where']=qs['filters'](_[_0xc77c('0x3b')](_0xa32083[_0xc77c('0x32')],_0x3e53e9['filters']));_0x3f31b3=_[_0xc77c('0x3e')]({},_0x3f31b3,_0xa32083[_0xc77c('0x40')]);return _0x581e4e[_0xc77c('0x49')+_[_0xc77c('0x70')](_0xa32083[_0xc77c('0x32')]['channel']['toLowerCase']())+'Queues'](_0x3f31b3);})[_0xc77c('0x26')](respondWithResult(_0x344597,null))['catch'](handleError(_0x344597,null));};exports[_0xc77c('0x75')]=function(_0x8c0c00,_0x501ef6,_0xc3052e){return db['Team'][_0xc77c('0x76')]({'where':{'id':_0x8c0c00[_0xc77c('0x46')]['id']}})[_0xc77c('0x26')](function(_0x2ce309){if(_0x2ce309){if(!_0x8c0c00[_0xc77c('0x47')][_0xc77c('0x71')]||!utils['isValidChannel'](_0x8c0c00[_0xc77c('0x47')][_0xc77c('0x71')])){throw new db[(_0xc77c('0x5a'))][(_0xc77c('0x6e'))](_0xc77c('0x6f'));}return _0x2ce309['add'+_[_0xc77c('0x70')](_0x8c0c00[_0xc77c('0x47')][_0xc77c('0x71')][_0xc77c('0x72')]())+_0xc77c('0x77')](_0x8c0c00[_0xc77c('0x47')][_0xc77c('0x78')]);}return null;})['then'](handleEntityNotFound(_0x501ef6,null))[_0xc77c('0x26')](respondWithStatusCode(_0x501ef6,null))[_0xc77c('0x45')](handleError(_0x501ef6,null));};exports[_0xc77c('0x79')]=function(_0x2771ab,_0x25cf11,_0x2e27df){return db[_0xc77c('0x2d')]['findOne']({'where':{'id':_0x2771ab['params']['id']}})[_0xc77c('0x26')](function(_0x26a9bb){if(_0x26a9bb){if(!_0x2771ab[_0xc77c('0x32')][_0xc77c('0x71')]||!utils[_0xc77c('0x6d')](_0x2771ab[_0xc77c('0x32')]['channel'])){throw new db[(_0xc77c('0x5a'))][(_0xc77c('0x6e'))](_0xc77c('0x6f'));}return _0x26a9bb[_0xc77c('0x7a')+_[_0xc77c('0x70')](_0x2771ab['query'][_0xc77c('0x71')][_0xc77c('0x72')]())+_0xc77c('0x77')](_0x2771ab[_0xc77c('0x32')][_0xc77c('0x78')]);}return null;})[_0xc77c('0x26')](handleEntityNotFound(_0x25cf11,null))[_0xc77c('0x26')](respondWithStatusCode(_0x25cf11,null))[_0xc77c('0x45')](handleError(_0x25cf11,null));};exports[_0xc77c('0x7b')]=function(_0x41dbee,_0x1d181b){var _0x53c227=_[_0xc77c('0x7c')](_0x41dbee[_0xc77c('0x47')][_0xc77c('0x78')])?_0x41dbee['body'][_0xc77c('0x78')]:[_0x41dbee[_0xc77c('0x47')][_0xc77c('0x78')]];var _0x1e0e8a=_0x41dbee[_0xc77c('0x46')]['id'];return db[_0xc77c('0x2d')]['find']({'where':{'id':_0x1e0e8a}})[_0xc77c('0x26')](handleEntityNotFound(_0x1d181b,null))[_0xc77c('0x26')](function(_0xcc812){if(_0xcc812){var _0x5159f9=['Voice',_0xc77c('0x7d'),'Mail',_0xc77c('0x7e'),'Fax','Openchannel','Whatsapp'];return db[_0xc77c('0x51')]['transaction'](function(_0xc09d50){var _0x4c5778=_[_0xc77c('0x2c')](_0x5159f9,function(_0x4b9782){var _0x4ad140={'attributes':['id',_0xc77c('0x29')]};if(_0x4b9782===_0xc77c('0x7f')){_0x4ad140['through']={'attributes':[_0xc77c('0x80')]};}return _0xcc812[_0xc77c('0x49')+_0x4b9782+_0xc77c('0x77')](_0x4ad140)[_0xc77c('0x26')](function(_0x5f4eb2){var _0x40a926=_[_0xc77c('0x2c')](_0x5f4eb2,function(_0xf2f9d5){var _0x5cb019=_[_0xc77c('0x2c')](_0x53c227,function(_0x1d50aa){var _0x22dcb1={'where':{'UserId':_0x1d50aa,[_0x4b9782+_0xc77c('0x81')]:_0xf2f9d5['id']},'transaction':_0xc09d50};if(_0x4b9782==='Voice'){_0x22dcb1[_0xc77c('0x15')]={'penalty':_0xf2f9d5[_0xc77c('0x82')][_0xc77c('0x80')]};}return db[_0xc77c('0x83')+_0x4b9782+_0xc77c('0x73')][_0xc77c('0x84')](_0x22dcb1)[_0xc77c('0x26')](function(){socket[_0xc77c('0x85')](_0xc77c('0x48')+_0x4b9782+_0xc77c('0x86'),{'UserId':_0x1d50aa,[_0x4b9782+_0xc77c('0x81')]:_0xf2f9d5['id']});if(_0x4b9782!==_0xc77c('0x7f')){return;}return db['User'][_0xc77c('0x43')]({'where':{'id':_0x53c227,'online':0x1},'attributes':['id',_0xc77c('0x29'),'online',_0xc77c('0x87'),_0xc77c('0x88')],'raw':!![]})[_0xc77c('0x26')](function(_0x8af11c){var _0x2a669e=_['map'](_0x8af11c,function(_0x449f31){return db[_0xc77c('0x89')][_0xc77c('0x8a')]({'membername':_0x449f31[_0xc77c('0x29')],'UserId':_0x449f31['id'],'queue_name':_0xf2f9d5['name'],'VoiceQueueId':_0xf2f9d5['id'],'interface':_['isNil'](_0x449f31[_0xc77c('0x88')])?util[_0xc77c('0x8b')](_0xc77c('0x8c'),_0x449f31['name']):_0x449f31[_0xc77c('0x88')],'paused':_0x449f31[_0xc77c('0x87')]||![],'penalty':_0xf2f9d5[_0xc77c('0x82')][_0xc77c('0x80')]},{'transaction':_0xc09d50});});return Promise[_0xc77c('0x8d')](_0x2a669e);});});});return Promise[_0xc77c('0x8d')](_0x5cb019);});return Promise[_0xc77c('0x8d')](_0x40a926);})[_0xc77c('0x26')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x1e0e8a}})['then'](function(_0x59beea){if(_0x59beea){var _0x500e13=_['map'](_0x53c227,function(_0x82facb){db[_0xc77c('0x6a')]['upsert']({'UserId':_0x82facb,'VoicePrefixId':_0x59beea[_0xc77c('0x6b')]});});return Promise['all'](_0x500e13);}});});});return Promise[_0xc77c('0x8d')](_0x4c5778)['then'](function(){return _0xcc812[_0xc77c('0x7b')](_0x53c227,{'transaction':_0xc09d50})[_0xc77c('0x8e')](function(_0x1fd0c0){return _0x1fd0c0;});});});}})['then'](respondWithResult(_0x1d181b,null))[_0xc77c('0x45')](handleError(_0x1d181b,null));};exports[_0xc77c('0x8f')]=function(_0x43fe12,_0x3ebf41){var _0x28c638=_[_0xc77c('0x7c')](_0x43fe12[_0xc77c('0x32')][_0xc77c('0x78')])?_0x43fe12[_0xc77c('0x32')][_0xc77c('0x78')]:[_0x43fe12[_0xc77c('0x32')][_0xc77c('0x78')]];var _0x3f5d4c=_0x43fe12['params']['id'];return db[_0xc77c('0x2d')][_0xc77c('0x4c')]({'where':{'id':_0x3f5d4c}})[_0xc77c('0x26')](handleEntityNotFound(_0x3ebf41,null))[_0xc77c('0x26')](function(_0x310680){if(_0x310680){var _0x53afd1=[_0xc77c('0x7f'),_0xc77c('0x7d'),'Mail',_0xc77c('0x7e'),_0xc77c('0x90'),_0xc77c('0x91'),'Whatsapp'];return db['sequelize'][_0xc77c('0x92')](function(_0x4f5ade){var _0x451590=_[_0xc77c('0x2c')](_0x53afd1,function(_0x145b0b){var _0x6a4d9={'attributes':['id',_0xc77c('0x29')]};return _0x310680[_0xc77c('0x49')+_0x145b0b+_0xc77c('0x77')](_0x6a4d9)['then'](function(_0x19ebf8){var _0x580646=_['map'](_0x19ebf8,function(_0x539d12){return _0x539d12[_0xc77c('0x8f')](_0x28c638,{'transaction':_0x4f5ade})[_0xc77c('0x26')](function(){var _0x5b0d2e=_['map'](_0x28c638,function(_0x732cd8){socket['emit'](_0xc77c('0x48')+_0x145b0b+_0xc77c('0x93'),{'UserId':Number(_0x732cd8),[_0x145b0b+_0xc77c('0x81')]:_0x539d12['id']});if(_0x145b0b!==_0xc77c('0x7f')){return;}return db[_0xc77c('0x89')][_0xc77c('0x58')]({'where':{'VoiceQueueId':_0x539d12['id'],'UserId':_0x732cd8},'transaction':_0x4f5ade});});return Promise['all'](_0x5b0d2e);});});return Promise[_0xc77c('0x8d')](_0x580646);});});return Promise['all'](_0x451590)[_0xc77c('0x26')](function(){return _0x310680['removeAgents'](_0x28c638,{'transaction':_0x4f5ade});})[_0xc77c('0x26')](function(){return db[_0xc77c('0x69')]['findOne']({'where':{'teamId':_0x3f5d4c}})['then'](function(_0x2fee88){if(_0x2fee88){var _0x1d7ae0=_[_0xc77c('0x2c')](_0x28c638,function(_0x8bb6fe){db[_0xc77c('0x6a')][_0xc77c('0x58')]({'where':{'UserId':_0x8bb6fe,'VoicePrefixId':_0x2fee88[_0xc77c('0x6b')]}});});return Promise['all'](_0x1d7ae0);}});});});}})[_0xc77c('0x26')](respondWithStatusCode(_0x3ebf41,null))[_0xc77c('0x45')](handleError(_0x3ebf41,null));};exports[_0xc77c('0x94')]=function(_0x9e1c31,_0x5d785d,_0x1faad1){var _0x386f38={};var _0x4c8d3a={};var _0x2ed85b;var _0x556e43;return db[_0xc77c('0x2d')][_0xc77c('0x76')]({'where':{'id':_0x9e1c31[_0xc77c('0x46')]['id']}})[_0xc77c('0x26')](handleEntityNotFound(_0x5d785d,null))['then'](function(_0xea0fde){if(_0xea0fde){_0x2ed85b=_0xea0fde;_0x4c8d3a[_0xc77c('0x31')]=_[_0xc77c('0x33')](db['User'][_0xc77c('0x2e')]);_0x4c8d3a[_0xc77c('0x32')]=_['keys'](_0x9e1c31[_0xc77c('0x32')]);_0x4c8d3a[_0xc77c('0x34')]=_[_0xc77c('0x35')](_0x4c8d3a[_0xc77c('0x31')],_0x4c8d3a[_0xc77c('0x32')]);_0x386f38[_0xc77c('0x36')]=_[_0xc77c('0x35')](_0x4c8d3a[_0xc77c('0x31')],qs[_0xc77c('0x37')](_0x9e1c31[_0xc77c('0x32')][_0xc77c('0x37')]));_0x386f38[_0xc77c('0x36')]=_0x386f38[_0xc77c('0x36')][_0xc77c('0x38')]?_0x386f38[_0xc77c('0x36')]:_0x4c8d3a[_0xc77c('0x31')];_0x386f38[_0xc77c('0x74')]=qs[_0xc77c('0x3a')](_0x9e1c31[_0xc77c('0x32')][_0xc77c('0x3a')]);_0x386f38['where']=qs[_0xc77c('0x34')](_[_0xc77c('0x3b')](_0x9e1c31[_0xc77c('0x32')],_0x4c8d3a[_0xc77c('0x34')]));if(_0x9e1c31['query']['filter']){_0x386f38[_0xc77c('0x3d')]=_[_0xc77c('0x3e')](_0x386f38[_0xc77c('0x3d')],{'$or':_['map'](_0x386f38[_0xc77c('0x36')],function(_0x22712a){var _0x10f69f={};_0x10f69f[_0x22712a]={'$like':'%'+_0x9e1c31[_0xc77c('0x32')][_0xc77c('0x3c')]+'%'};return _0x10f69f;})});}_0x386f38=_[_0xc77c('0x3e')]({},_0x386f38,_0x9e1c31[_0xc77c('0x40')]);return _0x2ed85b['getAgents'](_0x386f38);}})[_0xc77c('0x26')](function(_0x1f3b80){if(_0x1f3b80){_0x556e43=_0x1f3b80[_0xc77c('0x38')];if(!_0x9e1c31[_0xc77c('0x32')][_0xc77c('0x95')](_0xc77c('0x39'))){_0x386f38['limit']=qs[_0xc77c('0x1f')](_0x9e1c31[_0xc77c('0x32')][_0xc77c('0x1f')]);_0x386f38[_0xc77c('0x1e')]=qs['offset'](_0x9e1c31[_0xc77c('0x32')][_0xc77c('0x1e')]);}return _0x2ed85b['getAgents'](_0x386f38);}})[_0xc77c('0x26')](function(_0x14ecc7){if(_0x14ecc7){return _0x14ecc7?{'count':_0x556e43,'rows':_0x14ecc7}:null;}})[_0xc77c('0x26')](respondWithResult(_0x5d785d,null))[_0xc77c('0x45')](handleError(_0x5d785d,null));}; \ No newline at end of file +var _0xcd8a=['findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','penalty','QueueId','findOrCreate','emit','User','interface','upsert','isNil','format','voicePause','all','TeamVoicePrefix','spread','removeAgents','Queue:remove','UserVoiceQueueRt','UserVoicePrefix','getAgents','hasOwnProperty','eml-format','rimraf','request-promise','bluebird','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','error','name','send','index','map','Team','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','VoicePrefixId','getQueues'];(function(_0x4a1081,_0x3ff2d9){var _0x5e07e7=function(_0x577282){while(--_0x577282){_0x4a1081['push'](_0x4a1081['shift']());}};_0x5e07e7(++_0x3ff2d9);}(_0xcd8a,0x14c));var _0xacd8=function(_0x14b93d,_0x284a01){_0x14b93d=_0x14b93d-0x0;var _0x3a4b7d=_0xcd8a[_0x14b93d];return _0x3a4b7d;};'use strict';var emlformat=require(_0xacd8('0x0'));var rimraf=require(_0xacd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xacd8('0x2'));var moment=require('moment');var BPromise=require(_0xacd8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xacd8('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xacd8('0x5'));var fs=require('fs');var fs_extra=require(_0xacd8('0x6'));var _=require('lodash');var squel=require(_0xacd8('0x7'));var crypto=require(_0xacd8('0x8'));var jsforce=require(_0xacd8('0x9'));var deskjs=require(_0xacd8('0xa'));var toCsv=require(_0xacd8('0xb'));var querystring=require(_0xacd8('0xc'));var Papa=require('papaparse');var Redis=require(_0xacd8('0xd'));var authService=require(_0xacd8('0xe'));var qs=require(_0xacd8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacd8('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xacd8('0x11'));var licenseUtil=require(_0xacd8('0x12'));var db=require(_0xacd8('0x13'))['db'];config[_0xacd8('0x14')]=_[_0xacd8('0x15')](config[_0xacd8('0x14')],{'host':_0xacd8('0x16'),'port':0x18eb});var socket=require(_0xacd8('0x17'))(new Redis(config[_0xacd8('0x14')]));require(_0xacd8('0x18'))[_0xacd8('0x19')](socket);function respondWithStatusCode(_0x1883e3,_0x564157){_0x564157=_0x564157||0xcc;return function(_0x1cc004){if(_0x1cc004){return _0x1883e3['sendStatus'](_0x564157);}return _0x1883e3[_0xacd8('0x1a')](_0x564157)[_0xacd8('0x1b')]();};}function respondWithResult(_0xea712c,_0x19bb0b){_0x19bb0b=_0x19bb0b||0xc8;return function(_0x5c09ca){if(_0x5c09ca){return _0xea712c[_0xacd8('0x1a')](_0x19bb0b)[_0xacd8('0x1c')](_0x5c09ca);}};}function respondWithFilteredResult(_0x293613,_0x1f65fa){return function(_0x151776){if(_0x151776){var _0x14dfb7=typeof _0x1f65fa[_0xacd8('0x1d')]===_0xacd8('0x1e')&&typeof _0x1f65fa[_0xacd8('0x1f')]==='undefined';var _0x4049ae=_0x151776['count'];var _0x280a7e=_0x14dfb7?0x0:_0x1f65fa[_0xacd8('0x1d')];var _0x3ed1c3=_0x14dfb7?_0x151776[_0xacd8('0x20')]:_0x1f65fa['offset']+_0x1f65fa[_0xacd8('0x1f')];var _0x20b4cb;if(_0x3ed1c3>=_0x4049ae){_0x3ed1c3=_0x4049ae;_0x20b4cb=0xc8;}else{_0x20b4cb=0xce;}_0x293613[_0xacd8('0x1a')](_0x20b4cb);return _0x293613[_0xacd8('0x21')](_0xacd8('0x22'),_0x280a7e+'-'+_0x3ed1c3+'/'+_0x4049ae)[_0xacd8('0x1c')](_0x151776);}return null;};}function patchUpdates(_0x3d43c5){return function(_0x2a74e4){try{jsonpatch['apply'](_0x2a74e4,_0x3d43c5,!![]);}catch(_0x5c1c50){return BPromise[_0xacd8('0x23')](_0x5c1c50);}return _0x2a74e4[_0xacd8('0x24')]();};}function saveUpdates(_0x43827f,_0x34c801){return function(_0x49b1b5){if(_0x49b1b5){return _0x49b1b5['update'](_0x43827f)['then'](function(_0xbff726){return _0xbff726;});}return null;};}function handleEntityNotFound(_0x4efc69,_0x508d98){return function(_0x23270f){if(!_0x23270f){_0x4efc69['sendStatus'](0x194);}return _0x23270f;};}function handleError(_0x1f9921,_0x411e0a){_0x411e0a=_0x411e0a||0x1f4;return function(_0x1c43bc){logger[_0xacd8('0x25')](_0x1c43bc['stack']);if(_0x1c43bc[_0xacd8('0x26')]){delete _0x1c43bc['name'];}_0x1f9921[_0xacd8('0x1a')](_0x411e0a)[_0xacd8('0x27')](_0x1c43bc);};}exports[_0xacd8('0x28')]=function(_0x4733f6,_0x524b53){var _0xe7a48={},_0x515b65={},_0x5a3864={'count':0x0,'rows':[]};var _0x310e64=_[_0xacd8('0x29')](db[_0xacd8('0x2a')][_0xacd8('0x2b')],function(_0x5adcd0){return{'name':_0x5adcd0[_0xacd8('0x2c')],'type':_0x5adcd0['type'][_0xacd8('0x2d')]};});_0x515b65[_0xacd8('0x2e')]=_[_0xacd8('0x29')](_0x310e64,_0xacd8('0x26'));_0x515b65['query']=_[_0xacd8('0x2f')](_0x4733f6[_0xacd8('0x30')]);_0x515b65[_0xacd8('0x31')]=_[_0xacd8('0x32')](_0x515b65[_0xacd8('0x2e')],_0x515b65[_0xacd8('0x30')]);_0xe7a48['attributes']=_[_0xacd8('0x32')](_0x515b65[_0xacd8('0x2e')],qs[_0xacd8('0x33')](_0x4733f6[_0xacd8('0x30')][_0xacd8('0x33')]));_0xe7a48[_0xacd8('0x34')]=_0xe7a48[_0xacd8('0x34')][_0xacd8('0x35')]?_0xe7a48[_0xacd8('0x34')]:_0x515b65[_0xacd8('0x2e')];if(!_0x4733f6[_0xacd8('0x30')]['hasOwnProperty'](_0xacd8('0x36'))){_0xe7a48['limit']=qs[_0xacd8('0x1f')](_0x4733f6[_0xacd8('0x30')][_0xacd8('0x1f')]);_0xe7a48[_0xacd8('0x1d')]=qs[_0xacd8('0x1d')](_0x4733f6[_0xacd8('0x30')][_0xacd8('0x1d')]);}_0xe7a48[_0xacd8('0x37')]=qs[_0xacd8('0x38')](_0x4733f6['query'][_0xacd8('0x38')]);_0xe7a48[_0xacd8('0x39')]=qs['filters'](_[_0xacd8('0x3a')](_0x4733f6['query'],_0x515b65['filters']),_0x310e64);if(_0x4733f6[_0xacd8('0x30')][_0xacd8('0x3b')]){_0xe7a48['where']=_[_0xacd8('0x3c')](_0xe7a48[_0xacd8('0x39')],{'$or':_[_0xacd8('0x29')](_0x310e64,function(_0x24bcca){if(_0x24bcca[_0xacd8('0x3d')]!=='VIRTUAL'){var _0x2b082a={};_0x2b082a[_0x24bcca[_0xacd8('0x26')]]={'$like':'%'+_0x4733f6[_0xacd8('0x30')]['filter']+'%'};return _0x2b082a;}})});}_0xe7a48=_[_0xacd8('0x3c')]({},_0xe7a48,_0x4733f6[_0xacd8('0x3e')]);var _0x52282a={'where':_0xe7a48[_0xacd8('0x39')]};return db[_0xacd8('0x2a')][_0xacd8('0x20')](_0x52282a)[_0xacd8('0x3f')](function(_0x57c1fa){_0x5a3864['count']=_0x57c1fa;if(_0x4733f6[_0xacd8('0x30')][_0xacd8('0x40')]){_0xe7a48[_0xacd8('0x41')]=[{'all':!![]}];}return db[_0xacd8('0x2a')][_0xacd8('0x42')](_0xe7a48);})[_0xacd8('0x3f')](function(_0x545e1f){_0x5a3864[_0xacd8('0x43')]=_0x545e1f;return _0x5a3864;})[_0xacd8('0x3f')](respondWithFilteredResult(_0x524b53,_0xe7a48))[_0xacd8('0x44')](handleError(_0x524b53,null));};exports[_0xacd8('0x45')]=function(_0x5b1604,_0x4d9099){var _0x54ee89={'raw':![],'where':{'id':_0x5b1604[_0xacd8('0x46')]['id']}},_0x3067a8={};_0x3067a8[_0xacd8('0x2e')]=_[_0xacd8('0x2f')](db['Team'][_0xacd8('0x2b')]);_0x3067a8[_0xacd8('0x30')]=_['keys'](_0x5b1604[_0xacd8('0x30')]);_0x3067a8[_0xacd8('0x31')]=_[_0xacd8('0x32')](_0x3067a8['model'],_0x3067a8[_0xacd8('0x30')]);_0x54ee89['attributes']=_[_0xacd8('0x32')](_0x3067a8['model'],qs[_0xacd8('0x33')](_0x5b1604[_0xacd8('0x30')]['fields']));_0x54ee89[_0xacd8('0x34')]=_0x54ee89['attributes'][_0xacd8('0x35')]?_0x54ee89[_0xacd8('0x34')]:_0x3067a8['model'];if(_0x5b1604['query'][_0xacd8('0x40')]){_0x54ee89[_0xacd8('0x41')]=[{'all':!![]}];}_0x54ee89=_[_0xacd8('0x3c')]({},_0x54ee89,_0x5b1604['options']);return db['Team'][_0xacd8('0x47')](_0x54ee89)['then'](handleEntityNotFound(_0x4d9099,null))[_0xacd8('0x3f')](respondWithResult(_0x4d9099,null))[_0xacd8('0x44')](handleError(_0x4d9099,null));};exports[_0xacd8('0x48')]=function(_0x2cabbf,_0x9eac8){return db[_0xacd8('0x2a')][_0xacd8('0x48')](_0x2cabbf[_0xacd8('0x49')],{})[_0xacd8('0x3f')](function(_0x2b47e7){var _0x359e29=_0x2cabbf[_0xacd8('0x4a')][_0xacd8('0x4b')]({'plain':!![]});if(!_0x359e29)throw new Error(_0xacd8('0x4c'));if(_0x359e29[_0xacd8('0x4d')]===_0xacd8('0x4a')){var _0x394be3=_0x2b47e7[_0xacd8('0x4b')]({'plain':!![]});var _0x1f0788=_0xacd8('0x4e');return db[_0xacd8('0x4f')][_0xacd8('0x47')]({'where':{'name':_0x1f0788,'userProfileId':_0x359e29['userProfileId']},'raw':!![]})[_0xacd8('0x3f')](function(_0x53cd34){if(_0x53cd34&&_0x53cd34[_0xacd8('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x394be3[_0xacd8('0x26')],'resourceId':_0x394be3['id'],'type':_0x53cd34[_0xacd8('0x26')],'sectionId':_0x53cd34['id']},{})[_0xacd8('0x3f')](function(){return _0x2b47e7;});}else{return _0x2b47e7;}})[_0xacd8('0x44')](function(_0x25d7a4){logger[_0xacd8('0x25')](_0xacd8('0x51'),_0x25d7a4);throw _0x25d7a4;});}return _0x2b47e7;})[_0xacd8('0x3f')](respondWithResult(_0x9eac8,0xc9))[_0xacd8('0x44')](handleError(_0x9eac8,null));};exports[_0xacd8('0x52')]=function(_0x2da627,_0x3e948d){if(_0x2da627['body']['id']){delete _0x2da627['body']['id'];}return db['Team']['find']({'where':{'id':_0x2da627[_0xacd8('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e948d,null))['then'](saveUpdates(_0x2da627[_0xacd8('0x49')],null))[_0xacd8('0x3f')](respondWithResult(_0x3e948d,null))['catch'](handleError(_0x3e948d,null));};exports[_0xacd8('0x53')]=function(_0x2613be,_0x4b61e6){var _0x75efbc=_0x2613be[_0xacd8('0x46')]['id'];var _0x1d916e=[];return db['sequelize'][_0xacd8('0x54')](function(_0x560c33){var _0x44e4b2=_0xacd8('0x55')+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x44e4b2,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')][_0xacd8('0x59')],'raw':!![],'transaction':_0x560c33})[_0xacd8('0x3f')](function(_0x5ae2a5){_0x1d916e=_[_0xacd8('0x29')](_0x5ae2a5,function(_0x567527){return Number(_0x567527['UserId']);});})[_0xacd8('0x3f')](function(){var _0x19b106=_0xacd8('0x5a')+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x19b106,{'type':db['Sequelize']['QueryTypes'][_0xacd8('0x59')],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x29a1e1){var _0x2b34e0=_['map'](_0x29a1e1,function(_0x2ab8a3){return Number(_0x2ab8a3['VoiceQueueId']);});return db[_0xacd8('0x5b')][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'VoiceQueueId':{'$in':_0x2b34e0}},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){var _0x15f24e=_0xacd8('0x5c')+_0x75efbc;return db[_0xacd8('0x56')]['query'](_0x15f24e,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')][_0xacd8('0x59')],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x7ffe5c){var _0x12d10b=_['map'](_0x7ffe5c,function(_0x3ee14b){return Number(_0x3ee14b['MailQueueId']);});return db[_0xacd8('0x5d')][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'MailQueueId':{'$in':_0x12d10b}},'transaction':_0x560c33});})['then'](function(){var _0x2cceb7='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x2cceb7,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')]['SELECT'],'raw':!![],'transaction':_0x560c33});})['then'](function(_0x558fa7){var _0x24fc0a=_[_0xacd8('0x29')](_0x558fa7,function(_0xd57dcc){return Number(_0xd57dcc[_0xacd8('0x5e')]);});return db['UserSmsQueue'][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'SmsQueueId':{'$in':_0x24fc0a}},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){var _0x8f38f8=_0xacd8('0x5f')+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x8f38f8,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')][_0xacd8('0x59')],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x104f01){var _0x5646e8=_['map'](_0x104f01,function(_0x5e4098){return Number(_0x5e4098[_0xacd8('0x60')]);});return db[_0xacd8('0x61')][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'ChatQueueId':{'$in':_0x5646e8}},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){var _0xa13ac1='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0xa13ac1,{'type':db[_0xacd8('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x24cc28){var _0x5ba812=_[_0xacd8('0x29')](_0x24cc28,function(_0x16527a){return Number(_0x16527a[_0xacd8('0x62')]);});return db[_0xacd8('0x63')][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'FaxQueueId':{'$in':_0x5ba812}},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){var _0x276d9a=_0xacd8('0x64')+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x276d9a,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')]['SELECT'],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x188fa3){var _0x2acfbd=_[_0xacd8('0x29')](_0x188fa3,function(_0x19425c){return Number(_0x19425c[_0xacd8('0x65')]);});return db[_0xacd8('0x66')]['destroy']({'where':{'UserId':{'$in':_0x1d916e},'OpenchannelQueueId':{'$in':_0x2acfbd}},'transaction':_0x560c33});})['then'](function(){var _0x3e2e50=_0xacd8('0x67')+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x3e2e50,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')][_0xacd8('0x59')],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x3c5b6d){var _0x5113ac=_[_0xacd8('0x29')](_0x3c5b6d,function(_0x4422ea){return Number(_0x4422ea['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'WhatsappQueueId':{'$in':_0x5113ac}},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){return db['TeamVoicePrefix'][_0xacd8('0x47')]({'where':{'TeamId':_0x75efbc}});})['then'](function(_0x3613eb){if(_0x3613eb===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x1d916e},'VoicePrefixId':_0x3613eb[_0xacd8('0x68')]},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){return db[_0xacd8('0x2a')][_0xacd8('0x53')]({'where':{'id':_0x75efbc},'cascade':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x323b59){if(_0x323b59===0x0){_0x4b61e6['sendStatus'](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':_0xacd8('0x4e'),'resourceId':_0x75efbc},'cascade':!![],'transaction':_0x560c33})[_0xacd8('0x3f')](function(){_0x4b61e6[_0xacd8('0x1a')](0xcc)[_0xacd8('0x1b')]();});}})['catch'](function(_0xae0283){_0x4b61e6[_0xacd8('0x1a')](0x1f4)[_0xacd8('0x27')](_0xae0283);});});};exports[_0xacd8('0x69')]=function(_0x542212,_0x58e9a4,_0x225200){return db['Team'][_0xacd8('0x6a')]({'where':{'id':_0x542212[_0xacd8('0x46')]['id']}})[_0xacd8('0x3f')](handleEntityNotFound(_0x58e9a4,null))[_0xacd8('0x3f')](function(_0x2be2ee){if(!_0x542212[_0xacd8('0x30')][_0xacd8('0x6b')]||!utils['isValidChannel'](_0x542212[_0xacd8('0x30')][_0xacd8('0x6b')])){throw new db['Sequelize'][(_0xacd8('0x6c'))](_0xacd8('0x6d'));}var _0x4c0a97={};var _0x4c2f05={};_0x4c2f05[_0xacd8('0x2e')]=_[_0xacd8('0x2f')](db[_[_0xacd8('0x6e')](_0x542212[_0xacd8('0x30')][_0xacd8('0x6b')][_0xacd8('0x6f')]())+_0xacd8('0x70')][_0xacd8('0x2b')]);_0x4c2f05[_0xacd8('0x30')]=_['keys'](_0x542212[_0xacd8('0x30')]);_0x4c2f05[_0xacd8('0x31')]=_[_0xacd8('0x32')](_0x4c2f05[_0xacd8('0x2e')],_0x4c2f05['query']);_0x4c0a97[_0xacd8('0x34')]=_['intersection'](_0x4c2f05[_0xacd8('0x2e')],qs[_0xacd8('0x33')](_0x542212[_0xacd8('0x30')][_0xacd8('0x33')]));_0x4c0a97['attributes']=_0x4c0a97[_0xacd8('0x34')][_0xacd8('0x35')]?_0x4c0a97[_0xacd8('0x34')]:_0x4c2f05[_0xacd8('0x2e')];_0x4c0a97['limit']=qs['limit'](_0x542212[_0xacd8('0x30')]['limit']);_0x4c0a97[_0xacd8('0x1d')]=qs[_0xacd8('0x1d')](_0x542212[_0xacd8('0x30')][_0xacd8('0x1d')]);_0x4c0a97[_0xacd8('0x37')]=qs[_0xacd8('0x38')](_0x542212[_0xacd8('0x30')]['sort']);_0x4c0a97[_0xacd8('0x39')]=qs[_0xacd8('0x31')](_[_0xacd8('0x3a')](_0x542212[_0xacd8('0x30')],_0x4c2f05['filters']));_0x4c0a97=_[_0xacd8('0x3c')]({},_0x4c0a97,_0x542212[_0xacd8('0x3e')]);return _0x2be2ee[_0xacd8('0x4b')+_[_0xacd8('0x6e')](_0x542212[_0xacd8('0x30')][_0xacd8('0x6b')]['toLowerCase']())+_0xacd8('0x71')](_0x4c0a97);})[_0xacd8('0x3f')](respondWithResult(_0x58e9a4,null))[_0xacd8('0x44')](handleError(_0x58e9a4,null));};exports[_0xacd8('0x72')]=function(_0x59a7d3,_0x4c4946,_0x21b95e){return db[_0xacd8('0x2a')]['findOne']({'where':{'id':_0x59a7d3[_0xacd8('0x46')]['id']}})['then'](function(_0x12c1cd){if(_0x12c1cd){if(!_0x59a7d3[_0xacd8('0x49')]['channel']||!utils['isValidChannel'](_0x59a7d3[_0xacd8('0x49')]['channel'])){throw new db['Sequelize'][(_0xacd8('0x6c'))](_0xacd8('0x6d'));}return _0x12c1cd[_0xacd8('0x73')+_[_0xacd8('0x6e')](_0x59a7d3['body']['channel'][_0xacd8('0x6f')]())+_0xacd8('0x71')](_0x59a7d3['body'][_0xacd8('0x74')]);}return null;})[_0xacd8('0x3f')](handleEntityNotFound(_0x4c4946,null))['then'](respondWithStatusCode(_0x4c4946,null))['catch'](handleError(_0x4c4946,null));};exports[_0xacd8('0x75')]=function(_0x1ef489,_0x13f683,_0x6de226){return db['Team']['findOne']({'where':{'id':_0x1ef489[_0xacd8('0x46')]['id']}})[_0xacd8('0x3f')](function(_0x5254b8){if(_0x5254b8){if(!_0x1ef489[_0xacd8('0x30')][_0xacd8('0x6b')]||!utils['isValidChannel'](_0x1ef489[_0xacd8('0x30')][_0xacd8('0x6b')])){throw new db[(_0xacd8('0x57'))]['ValidationError'](_0xacd8('0x6d'));}return _0x5254b8[_0xacd8('0x76')+_[_0xacd8('0x6e')](_0x1ef489[_0xacd8('0x30')][_0xacd8('0x6b')][_0xacd8('0x6f')]())+_0xacd8('0x71')](_0x1ef489[_0xacd8('0x30')][_0xacd8('0x74')]);}return null;})['then'](handleEntityNotFound(_0x13f683,null))[_0xacd8('0x3f')](respondWithStatusCode(_0x13f683,null))[_0xacd8('0x44')](handleError(_0x13f683,null));};exports[_0xacd8('0x77')]=function(_0x30dd48,_0x2cb547){var _0x21befa=_[_0xacd8('0x78')](_0x30dd48[_0xacd8('0x49')][_0xacd8('0x74')])?_0x30dd48[_0xacd8('0x49')][_0xacd8('0x74')]:[_0x30dd48[_0xacd8('0x49')][_0xacd8('0x74')]];var _0x1724af=_0x30dd48['params']['id'];return db[_0xacd8('0x2a')][_0xacd8('0x47')]({'where':{'id':_0x1724af}})[_0xacd8('0x3f')](handleEntityNotFound(_0x2cb547,null))[_0xacd8('0x3f')](function(_0x20fac8){if(_0x20fac8){var _0x2c2eca=[_0xacd8('0x79'),_0xacd8('0x7a'),_0xacd8('0x7b'),_0xacd8('0x7c'),_0xacd8('0x7d'),_0xacd8('0x7e'),'Whatsapp'];return db[_0xacd8('0x56')][_0xacd8('0x54')](function(_0x13ea06){var _0x3f9e2b=_['map'](_0x2c2eca,function(_0x2c6959){var _0x40073c={'attributes':['id','name']};if(_0x2c6959==='Voice'){_0x40073c['through']={'attributes':[_0xacd8('0x7f')]};}return _0x20fac8[_0xacd8('0x4b')+_0x2c6959+'Queues'](_0x40073c)[_0xacd8('0x3f')](function(_0x581be3){var _0x2acb91=_[_0xacd8('0x29')](_0x581be3,function(_0x1ddf69){var _0x53e343=_[_0xacd8('0x29')](_0x21befa,function(_0x4fe278){var _0x4949b6={'where':{'UserId':_0x4fe278,[_0x2c6959+_0xacd8('0x80')]:_0x1ddf69['id']},'transaction':_0x13ea06};if(_0x2c6959===_0xacd8('0x79')){_0x4949b6['defaults']={'penalty':_0x1ddf69['TeamVoiceQueue'][_0xacd8('0x7f')]};}return db['User'+_0x2c6959+'Queue'][_0xacd8('0x81')](_0x4949b6)['then'](function(){socket[_0xacd8('0x82')]('user'+_0x2c6959+'Queue:save',{'UserId':_0x4fe278,[_0x2c6959+_0xacd8('0x80')]:_0x1ddf69['id']});if(_0x2c6959!==_0xacd8('0x79')){return;}return db[_0xacd8('0x83')][_0xacd8('0x42')]({'where':{'id':_0x21befa,'online':0x1},'attributes':['id',_0xacd8('0x26'),'online','voicePause',_0xacd8('0x84')],'raw':!![]})[_0xacd8('0x3f')](function(_0x50d63c){var _0x4462e5=_['map'](_0x50d63c,function(_0x3f76dd){return db['UserVoiceQueueRt'][_0xacd8('0x85')]({'membername':_0x3f76dd['name'],'UserId':_0x3f76dd['id'],'queue_name':_0x1ddf69[_0xacd8('0x26')],'VoiceQueueId':_0x1ddf69['id'],'interface':_[_0xacd8('0x86')](_0x3f76dd[_0xacd8('0x84')])?util[_0xacd8('0x87')]('SIP/%s',_0x3f76dd[_0xacd8('0x26')]):_0x3f76dd['interface'],'paused':_0x3f76dd[_0xacd8('0x88')]||![],'penalty':_0x1ddf69['TeamVoiceQueue'][_0xacd8('0x7f')]},{'transaction':_0x13ea06});});return Promise[_0xacd8('0x89')](_0x4462e5);});});});return Promise['all'](_0x53e343);});return Promise[_0xacd8('0x89')](_0x2acb91);})['then'](function(){return db[_0xacd8('0x8a')][_0xacd8('0x6a')]({'where':{'teamId':_0x1724af}})[_0xacd8('0x3f')](function(_0x2b07e9){if(_0x2b07e9){var _0x4ff979=_[_0xacd8('0x29')](_0x21befa,function(_0x1e9c36){db['UserVoicePrefix']['upsert']({'UserId':_0x1e9c36,'VoicePrefixId':_0x2b07e9[_0xacd8('0x68')]});});return Promise[_0xacd8('0x89')](_0x4ff979);}});});});return Promise['all'](_0x3f9e2b)[_0xacd8('0x3f')](function(){return _0x20fac8[_0xacd8('0x77')](_0x21befa,{'transaction':_0x13ea06})[_0xacd8('0x8b')](function(_0x105d5d){return _0x105d5d;});});});}})[_0xacd8('0x3f')](respondWithResult(_0x2cb547,null))[_0xacd8('0x44')](handleError(_0x2cb547,null));};exports[_0xacd8('0x8c')]=function(_0x4d0cfc,_0xf90355){var _0x50c262=_['isArray'](_0x4d0cfc[_0xacd8('0x30')][_0xacd8('0x74')])?_0x4d0cfc[_0xacd8('0x30')]['ids']:[_0x4d0cfc[_0xacd8('0x30')]['ids']];var _0x55a4e2=_0x4d0cfc[_0xacd8('0x46')]['id'];return db[_0xacd8('0x2a')][_0xacd8('0x47')]({'where':{'id':_0x55a4e2}})[_0xacd8('0x3f')](handleEntityNotFound(_0xf90355,null))[_0xacd8('0x3f')](function(_0x1a249d){if(_0x1a249d){var _0x4c9114=['Voice',_0xacd8('0x7a'),_0xacd8('0x7b'),_0xacd8('0x7c'),_0xacd8('0x7d'),_0xacd8('0x7e'),'Whatsapp'];return db[_0xacd8('0x56')][_0xacd8('0x54')](function(_0x34d653){var _0x2f6a0a=_[_0xacd8('0x29')](_0x4c9114,function(_0x6372af){var _0x19be06={'attributes':['id',_0xacd8('0x26')]};return _0x1a249d[_0xacd8('0x4b')+_0x6372af+_0xacd8('0x71')](_0x19be06)['then'](function(_0x61f086){var _0x59043f=_[_0xacd8('0x29')](_0x61f086,function(_0x557c4f){return _0x557c4f['removeAgents'](_0x50c262,{'transaction':_0x34d653})[_0xacd8('0x3f')](function(){var _0x588169=_[_0xacd8('0x29')](_0x50c262,function(_0x476880){socket[_0xacd8('0x82')](_0xacd8('0x4a')+_0x6372af+_0xacd8('0x8d'),{'UserId':Number(_0x476880),[_0x6372af+_0xacd8('0x80')]:_0x557c4f['id']});if(_0x6372af!==_0xacd8('0x79')){return;}return db[_0xacd8('0x8e')][_0xacd8('0x53')]({'where':{'VoiceQueueId':_0x557c4f['id'],'UserId':_0x476880},'transaction':_0x34d653});});return Promise[_0xacd8('0x89')](_0x588169);});});return Promise[_0xacd8('0x89')](_0x59043f);});});return Promise['all'](_0x2f6a0a)[_0xacd8('0x3f')](function(){return _0x1a249d[_0xacd8('0x8c')](_0x50c262,{'transaction':_0x34d653});})[_0xacd8('0x3f')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x55a4e2}})[_0xacd8('0x3f')](function(_0x1216c9){if(_0x1216c9){var _0x4bd2c4=_[_0xacd8('0x29')](_0x50c262,function(_0x555b00){db[_0xacd8('0x8f')][_0xacd8('0x53')]({'where':{'UserId':_0x555b00,'VoicePrefixId':_0x1216c9[_0xacd8('0x68')]}});});return Promise[_0xacd8('0x89')](_0x4bd2c4);}});});});}})[_0xacd8('0x3f')](respondWithStatusCode(_0xf90355,null))[_0xacd8('0x44')](handleError(_0xf90355,null));};exports[_0xacd8('0x90')]=function(_0x15210f,_0x39fdfd,_0x4fcb6e){var _0x9214b={};var _0x5abaf4={};var _0x2a0b51;var _0x523233;return db[_0xacd8('0x2a')]['findOne']({'where':{'id':_0x15210f[_0xacd8('0x46')]['id']}})[_0xacd8('0x3f')](handleEntityNotFound(_0x39fdfd,null))[_0xacd8('0x3f')](function(_0x40c313){if(_0x40c313){_0x2a0b51=_0x40c313;_0x5abaf4[_0xacd8('0x2e')]=_[_0xacd8('0x2f')](db[_0xacd8('0x83')][_0xacd8('0x2b')]);_0x5abaf4[_0xacd8('0x30')]=_[_0xacd8('0x2f')](_0x15210f['query']);_0x5abaf4['filters']=_[_0xacd8('0x32')](_0x5abaf4['model'],_0x5abaf4[_0xacd8('0x30')]);_0x9214b[_0xacd8('0x34')]=_[_0xacd8('0x32')](_0x5abaf4[_0xacd8('0x2e')],qs[_0xacd8('0x33')](_0x15210f[_0xacd8('0x30')][_0xacd8('0x33')]));_0x9214b[_0xacd8('0x34')]=_0x9214b[_0xacd8('0x34')]['length']?_0x9214b[_0xacd8('0x34')]:_0x5abaf4[_0xacd8('0x2e')];_0x9214b[_0xacd8('0x37')]=qs[_0xacd8('0x38')](_0x15210f[_0xacd8('0x30')][_0xacd8('0x38')]);_0x9214b[_0xacd8('0x39')]=qs[_0xacd8('0x31')](_[_0xacd8('0x3a')](_0x15210f[_0xacd8('0x30')],_0x5abaf4[_0xacd8('0x31')]));if(_0x15210f[_0xacd8('0x30')]['filter']){_0x9214b['where']=_['merge'](_0x9214b[_0xacd8('0x39')],{'$or':_[_0xacd8('0x29')](_0x9214b['attributes'],function(_0x1cd998){var _0x33e15f={};_0x33e15f[_0x1cd998]={'$like':'%'+_0x15210f['query'][_0xacd8('0x3b')]+'%'};return _0x33e15f;})});}_0x9214b=_[_0xacd8('0x3c')]({},_0x9214b,_0x15210f[_0xacd8('0x3e')]);return _0x2a0b51[_0xacd8('0x90')](_0x9214b);}})['then'](function(_0x10a3ed){if(_0x10a3ed){_0x523233=_0x10a3ed[_0xacd8('0x35')];if(!_0x15210f[_0xacd8('0x30')][_0xacd8('0x91')]('nolimit')){_0x9214b[_0xacd8('0x1f')]=qs['limit'](_0x15210f['query'][_0xacd8('0x1f')]);_0x9214b[_0xacd8('0x1d')]=qs[_0xacd8('0x1d')](_0x15210f['query'][_0xacd8('0x1d')]);}return _0x2a0b51[_0xacd8('0x90')](_0x9214b);}})[_0xacd8('0x3f')](function(_0x21fca2){if(_0x21fca2){return _0x21fca2?{'count':_0x523233,'rows':_0x21fca2}:null;}})[_0xacd8('0x3f')](respondWithResult(_0x39fdfd,null))[_0xacd8('0x44')](handleError(_0x39fdfd,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 53b8b75..ff9616c 100644 --- a/server/api/team/team.events.js +++ b/server/api/team/team.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d5d=['Team','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x38fc5d,_0x1eb1e2){var _0x9145fb=function(_0x40a46b){while(--_0x40a46b){_0x38fc5d['push'](_0x38fc5d['shift']());}};_0x9145fb(++_0x1eb1e2);}(_0x0d5d,0xd7));var _0xd0d5=function(_0x466252,_0x1c1ac6){_0x466252=_0x466252-0x0;var _0x3f0e27=_0x0d5d[_0x466252];return _0x3f0e27;};'use strict';var EventEmitter=require('events');var Team=require(_0xd0d5('0x0'))['db'][_0xd0d5('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xd0d5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd0d5('0x3'),'afterDestroy':_0xd0d5('0x4')};function emitEvent(_0x14a7d7){return function(_0x410a69,_0xaa799e,_0x3d4345){TeamEvents[_0xd0d5('0x5')](_0x14a7d7+':'+_0x410a69['id'],_0x410a69);TeamEvents[_0xd0d5('0x5')](_0x14a7d7,_0x410a69);_0x3d4345(null);};}for(var e in events){if(events[_0xd0d5('0x6')](e)){var event=events[e];Team[_0xd0d5('0x7')](e,emitEvent(event));}}module[_0xd0d5('0x8')]=TeamEvents; \ No newline at end of file +var _0xdf0a=['hasOwnProperty','hook','setMaxListeners','save','remove','emit'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xdf0a,0xe6));var _0xadf0=function(_0x1e7480,_0x5783b3){_0x1e7480=_0x1e7480-0x0;var _0x453d99=_0xdf0a[_0x1e7480];return _0x453d99;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xadf0('0x0')](0x0);var events={'afterCreate':_0xadf0('0x1'),'afterUpdate':'update','afterDestroy':_0xadf0('0x2')};function emitEvent(_0x523cd1){return function(_0x3c2660,_0x2bd017,_0x50bd0f){TeamEvents[_0xadf0('0x3')](_0x523cd1+':'+_0x3c2660['id'],_0x3c2660);TeamEvents['emit'](_0x523cd1,_0x3c2660);_0x50bd0f(null);};}for(var e in events){if(events[_0xadf0('0x4')](e)){var event=events[e];Team[_0xadf0('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index e43b220..7953d6a 100644 --- a/server/api/team/team.model.js +++ b/server/api/team/team.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc15a=['request-promise','rimraf','../../config/environment','./team.attributes','exports','define','Team','lodash','../../config/logger','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc15a,0xa1));var _0xac15=function(_0x33ab19,_0x478424){_0x33ab19=_0x33ab19-0x0;var _0x5ee4a1=_0xc15a[_0x33ab19];return _0x5ee4a1;};'use strict';var _=require(_0xac15('0x0'));var util=require('util');var logger=require(_0xac15('0x1'))(_0xac15('0x2'));var moment=require(_0xac15('0x3'));var BPromise=require('bluebird');var rp=require(_0xac15('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac15('0x5'));var config=require(_0xac15('0x6'));var attributes=require(_0xac15('0x7'));module[_0xac15('0x8')]=function(_0x4c5657,_0x10c724){return _0x4c5657[_0xac15('0x9')](_0xac15('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9142=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Team','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9142,0xfb));var _0x2914=function(_0x208f04,_0x4b3bad){_0x208f04=_0x208f04-0x0;var _0x2ce8a5=_0x9142[_0x208f04];return _0x2ce8a5;};'use strict';var _=require(_0x2914('0x0'));var util=require(_0x2914('0x1'));var logger=require(_0x2914('0x2'))(_0x2914('0x3'));var moment=require('moment');var BPromise=require(_0x2914('0x4'));var rp=require(_0x2914('0x5'));var fs=require('fs');var path=require(_0x2914('0x6'));var rimraf=require(_0x2914('0x7'));var config=require(_0x2914('0x8'));var attributes=require('./team.attributes');module[_0x2914('0x9')]=function(_0x75f76d,_0x3d858c){return _0x75f76d[_0x2914('0xa')](_0x2914('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 4df1ff3..a7888cb 100644 --- a/server/api/team/team.rpc.js +++ b/server/api/team/team.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe008=['request','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./team.socket','register'];(function(_0x27ba16,_0x2fa13d){var _0x2db815=function(_0x41a594){while(--_0x41a594){_0x27ba16['push'](_0x27ba16['shift']());}};_0x2db815(++_0x2fa13d);}(_0xe008,0x14f));var _0x8e00=function(_0x437761,_0x32e65d){_0x437761=_0x437761-0x0;var _0x56fd3c=_0xe008[_0x437761];return _0x56fd3c;};'use strict';var _=require('lodash');var util=require(_0x8e00('0x0'));var moment=require(_0x8e00('0x1'));var BPromise=require(_0x8e00('0x2'));var rs=require(_0x8e00('0x3'));var fs=require('fs');var Redis=require(_0x8e00('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e00('0x5'));var logger=require(_0x8e00('0x6'))('rpc');var config=require(_0x8e00('0x7'));var jayson=require(_0x8e00('0x8'));var client=jayson['client'][_0x8e00('0x9')]({'port':0x232a});config[_0x8e00('0xa')]=_[_0x8e00('0xb')](config[_0x8e00('0xa')],{'host':_0x8e00('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e00('0xa')]));require(_0x8e00('0xd'))[_0x8e00('0xe')](socket);function respondWithRpcPromise(_0x52c212,_0x569fab,_0x3e7caf){return new BPromise(function(_0x33f92a,_0x568104){return client[_0x8e00('0xf')](_0x52c212,_0x3e7caf)['then'](function(_0x433187){logger['info'](_0x8e00('0x10'),_0x569fab,_0x8e00('0x11'));logger['debug'](_0x8e00('0x12'),_0x569fab,_0x8e00('0x11'),JSON[_0x8e00('0x13')](_0x433187));if(_0x433187[_0x8e00('0x14')]){if(_0x433187[_0x8e00('0x14')][_0x8e00('0x15')]===0x1f4){logger[_0x8e00('0x14')]('Team,\x20%s,\x20%s',_0x569fab,_0x433187[_0x8e00('0x14')]['message']);return _0x568104(_0x433187[_0x8e00('0x14')][_0x8e00('0x16')]);}logger[_0x8e00('0x14')](_0x8e00('0x10'),_0x569fab,_0x433187[_0x8e00('0x14')][_0x8e00('0x16')]);return _0x33f92a(_0x433187['error'][_0x8e00('0x16')]);}else{logger[_0x8e00('0x17')](_0x8e00('0x10'),_0x569fab,'request\x20sent');_0x33f92a(_0x433187[_0x8e00('0x18')]['message']);}})['catch'](function(_0x526f8d){logger['error'](_0x8e00('0x10'),_0x569fab,_0x526f8d);_0x568104(_0x526f8d);});});} \ No newline at end of file +var _0xe930=['then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x16cc5b,_0x15ed93){var _0x48d9e0=function(_0xa6b917){while(--_0xa6b917){_0x16cc5b['push'](_0x16cc5b['shift']());}};_0x48d9e0(++_0x15ed93);}(_0xe930,0xfb));var _0x0e93=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0xe930[_0x4bd950];return _0x5dc59a;};'use strict';var _=require('lodash');var util=require(_0x0e93('0x0'));var moment=require(_0x0e93('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e93('0x2'))['db'];var utils=require(_0x0e93('0x3'));var logger=require(_0x0e93('0x4'))(_0x0e93('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e93('0x6'));var client=jayson['client'][_0x0e93('0x7')]({'port':0x232a});config['redis']=_[_0x0e93('0x8')](config[_0x0e93('0x9')],{'host':_0x0e93('0xa'),'port':0x18eb});var socket=require(_0x0e93('0xb'))(new Redis(config['redis']));require('./team.socket')[_0x0e93('0xc')](socket);function respondWithRpcPromise(_0x83d6bb,_0x1f2909,_0x11e4bd){return new BPromise(function(_0x3c3dda,_0x49be3b){return client['request'](_0x83d6bb,_0x11e4bd)[_0x0e93('0xd')](function(_0x46c4b0){logger[_0x0e93('0xe')](_0x0e93('0xf'),_0x1f2909,_0x0e93('0x10'));logger[_0x0e93('0x11')](_0x0e93('0x12'),_0x1f2909,_0x0e93('0x10'),JSON[_0x0e93('0x13')](_0x46c4b0));if(_0x46c4b0[_0x0e93('0x14')]){if(_0x46c4b0[_0x0e93('0x14')]['code']===0x1f4){logger['error'](_0x0e93('0xf'),_0x1f2909,_0x46c4b0['error']['message']);return _0x49be3b(_0x46c4b0['error'][_0x0e93('0x15')]);}logger['error'](_0x0e93('0xf'),_0x1f2909,_0x46c4b0['error'][_0x0e93('0x15')]);return _0x3c3dda(_0x46c4b0[_0x0e93('0x14')][_0x0e93('0x15')]);}else{logger[_0x0e93('0xe')](_0x0e93('0xf'),_0x1f2909,_0x0e93('0x10'));_0x3c3dda(_0x46c4b0['result'][_0x0e93('0x15')]);}})['catch'](function(_0x2a7454){logger[_0x0e93('0x14')](_0x0e93('0xf'),_0x1f2909,_0x2a7454);_0x49be3b(_0x2a7454);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e27e6c9..879488f 100644 --- a/server/api/team/team.socket.js +++ b/server/api/team/team.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd64b=['emit','length','team:','./team.events','remove'];(function(_0x37a713,_0x59d661){var _0x4ee6b3=function(_0x22b2dd){while(--_0x22b2dd){_0x37a713['push'](_0x37a713['shift']());}};_0x4ee6b3(++_0x59d661);}(_0xd64b,0xc1));var _0xbd64=function(_0x4ee192,_0x1e8f15){_0x4ee192=_0x4ee192-0x0;var _0xe9538d=_0xd64b[_0x4ee192];return _0xe9538d;};'use strict';var TeamEvents=require(_0xbd64('0x0'));var events=['save',_0xbd64('0x1'),'update'];function createListener(_0x30b9b3,_0xcbecd5){return function(_0x64bd3b){_0xcbecd5[_0xbd64('0x2')](_0x30b9b3,_0x64bd3b);};}function removeListener(_0x30fe29,_0x5458d8){return function(){TeamEvents['removeListener'](_0x30fe29,_0x5458d8);};}exports['register']=function(_0x51e87d){for(var _0x58e9e7=0x0,_0x32995f=events[_0xbd64('0x3')];_0x58e9e7<_0x32995f;_0x58e9e7++){var _0x38204e=events[_0x58e9e7];var _0x3f1f17=createListener(_0xbd64('0x4')+_0x38204e,_0x51e87d);TeamEvents['on'](_0x38204e,_0x3f1f17);}}; \ No newline at end of file +var _0xb965=['register','team:','./team.events','save','emit'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xb965,0x9d));var _0x5b96=function(_0x2e740d,_0x531abe){_0x2e740d=_0x2e740d-0x0;var _0x2295e4=_0xb965[_0x2e740d];return _0x2295e4;};'use strict';var TeamEvents=require(_0x5b96('0x0'));var events=[_0x5b96('0x1'),'remove','update'];function createListener(_0x3a5c6a,_0x2d4f51){return function(_0x211e34){_0x2d4f51[_0x5b96('0x2')](_0x3a5c6a,_0x211e34);};}function removeListener(_0x844202,_0x4d599b){return function(){TeamEvents['removeListener'](_0x844202,_0x4d599b);};}exports[_0x5b96('0x3')]=function(_0x3d9d78){for(var _0x502072=0x0,_0x451426=events['length'];_0x502072<_0x451426;_0x502072++){var _0x3d2fa6=events[_0x502072];var _0x31a1fe=createListener(_0x5b96('0x4')+_0x3d2fa6,_0x3d9d78);TeamEvents['on'](_0x3d2fa6,_0x31a1fe);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 29edf32..7b94005 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fd9=['INTEGER','exports'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x0fd9,0xa3));var _0x90fd=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x0fd9[_0x10dbf6];return _0x452147;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'TeamId':{'type':Sequelize[_0x90fd('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x90fd('0x1')]}}; \ No newline at end of file +var _0xeffd=['INTEGER','sequelize'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0xeffd,0x6b));var _0xdeff=function(_0x28e88f,_0x3ea2e6){_0x28e88f=_0x28e88f-0x0;var _0x3be0c2=_0xeffd[_0x28e88f];return _0x3be0c2;};'use strict';var Sequelize=require(_0xdeff('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xdeff('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xdeff('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 5505963..3486fe6 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28f2=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes'];(function(_0x1265fb,_0x59af81){var _0x4dd9c7=function(_0xcf57da){while(--_0xcf57da){_0x1265fb['push'](_0x1265fb['shift']());}};_0x4dd9c7(++_0x59af81);}(_0x28f2,0x193));var _0x228f=function(_0x3859fb,_0x316c6d){_0x3859fb=_0x3859fb-0x0;var _0x1d30f6=_0x28f2[_0x3859fb];return _0x1d30f6;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var logger=require(_0x228f('0x2'))(_0x228f('0x3'));var moment=require(_0x228f('0x4'));var BPromise=require('bluebird');var rp=require(_0x228f('0x5'));var fs=require('fs');var path=require(_0x228f('0x6'));var rimraf=require(_0x228f('0x7'));var config=require(_0x228f('0x8'));var attributes=require(_0x228f('0x9'));module[_0x228f('0xa')]=function(_0x32c5c3,_0x485423){return _0x32c5c3[_0x228f('0xb')]('TeamVoicePrefix',attributes,{'tableName':_0x228f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x594d=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes'];(function(_0x3d3d09,_0x56a334){var _0x564d89=function(_0x10b78f){while(--_0x10b78f){_0x3d3d09['push'](_0x3d3d09['shift']());}};_0x564d89(++_0x56a334);}(_0x594d,0x92));var _0xd594=function(_0x22d164,_0x154075){_0x22d164=_0x22d164-0x0;var _0xae5f1a=_0x594d[_0x22d164];return _0xae5f1a;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd594('0x1'));var moment=require(_0xd594('0x2'));var BPromise=require(_0xd594('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd594('0x4'));var rimraf=require(_0xd594('0x5'));var config=require(_0xd594('0x6'));var attributes=require(_0xd594('0x7'));module['exports']=function(_0x3347cd,_0x498ef4){return _0x3347cd[_0xd594('0x8')](_0xd594('0x9'),attributes,{'tableName':_0xd594('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index e28ea40..c714baa 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xc6dd70,_0x40412e){var _0x3f809b=function(_0x5c3b2d){while(--_0x5c3b2d){_0xc6dd70['push'](_0xc6dd70['shift']());}};_0x3f809b(++_0x40412e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xcb91[_0x25701b];return _0x3a8a2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5e7fa3,_0x537559){var _0x323185=function(_0x5e7423){while(--_0x5e7423){_0x5e7fa3['push'](_0x5e7fa3['shift']());}};_0x323185(++_0x537559);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 4df1a75..2d0401e 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x843b=['team_has_voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x5cab7e,_0x464e20){var _0x35c71f=function(_0x5455e6){while(--_0x5455e6){_0x5cab7e['push'](_0x5cab7e['shift']());}};_0x35c71f(++_0x464e20);}(_0x843b,0xc5));var _0xb843=function(_0x2f7902,_0x3c590e){_0x2f7902=_0x2f7902-0x0;var _0x35fa72=_0x843b[_0x2f7902];return _0x35fa72;};'use strict';var _=require(_0xb843('0x0'));var util=require(_0xb843('0x1'));var logger=require(_0xb843('0x2'))('api');var moment=require(_0xb843('0x3'));var BPromise=require(_0xb843('0x4'));var rp=require(_0xb843('0x5'));var fs=require('fs');var path=require(_0xb843('0x6'));var rimraf=require(_0xb843('0x7'));var config=require(_0xb843('0x8'));var attributes=require(_0xb843('0x9'));module[_0xb843('0xa')]=function(_0x2ad5f3,_0x3987db){return _0x2ad5f3[_0xb843('0xb')](_0xb843('0xc'),attributes,{'tableName':_0xb843('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fde=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4fde,0x19f));var _0xe4fd=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x4fde[_0x413727];return _0x5f46d7;};'use strict';var _=require(_0xe4fd('0x0'));var util=require(_0xe4fd('0x1'));var logger=require(_0xe4fd('0x2'))(_0xe4fd('0x3'));var moment=require('moment');var BPromise=require(_0xe4fd('0x4'));var rp=require(_0xe4fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4fd('0x6'));var config=require(_0xe4fd('0x7'));var attributes=require(_0xe4fd('0x8'));module[_0xe4fd('0x9')]=function(_0x464a19,_0x73219e){return _0x464a19[_0xe4fd('0xa')](_0xe4fd('0xb'),attributes,{'tableName':_0xe4fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index b60f1f0..45c0f51 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x195e=['info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1ab738,_0x3826bf){var _0x109ba0=function(_0x50d2c7){while(--_0x50d2c7){_0x1ab738['push'](_0x1ab738['shift']());}};_0x109ba0(++_0x3826bf);}(_0x195e,0xfb));var _0xe195=function(_0x5be1c9,_0x5c907e){_0x5be1c9=_0x5be1c9-0x0;var _0x51c9dd=_0x195e[_0x5be1c9];return _0x51c9dd;};'use strict';var _=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var moment=require(_0xe195('0x2'));var BPromise=require(_0xe195('0x3'));var rs=require(_0xe195('0x4'));var fs=require('fs');var Redis=require(_0xe195('0x5'));var db=require(_0xe195('0x6'))['db'];var utils=require(_0xe195('0x7'));var logger=require(_0xe195('0x8'))(_0xe195('0x9'));var config=require(_0xe195('0xa'));var jayson=require(_0xe195('0xb'));var client=jayson[_0xe195('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1acc,_0x663106,_0x2ead59){return new BPromise(function(_0x28c1a9,_0x3164c3){return client['request'](_0x2a1acc,_0x2ead59)['then'](function(_0x5f333b){logger[_0xe195('0xd')](_0xe195('0xe'),_0x663106,_0xe195('0xf'));logger[_0xe195('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x663106,_0xe195('0xf'),JSON[_0xe195('0x11')](_0x5f333b));if(_0x5f333b[_0xe195('0x12')]){if(_0x5f333b['error'][_0xe195('0x13')]===0x1f4){logger[_0xe195('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x663106,_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);return _0x3164c3(_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);}logger['error'](_0xe195('0xe'),_0x663106,_0x5f333b[_0xe195('0x12')]['message']);return _0x28c1a9(_0x5f333b['error'][_0xe195('0x14')]);}else{logger['info'](_0xe195('0xe'),_0x663106,'request\x20sent');_0x28c1a9(_0x5f333b['result'][_0xe195('0x14')]);}})[_0xe195('0x15')](function(_0x277362){logger[_0xe195('0x12')](_0xe195('0xe'),_0x663106,_0x277362);_0x3164c3(_0x277362);});});} \ No newline at end of file +var _0x3f47=['then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x23402b,_0x421ac9){var _0x3a21c7=function(_0x3608ec){while(--_0x3608ec){_0x23402b['push'](_0x23402b['shift']());}};_0x3a21c7(++_0x421ac9);}(_0x3f47,0x10e));var _0x73f4=function(_0x2c44b9,_0x2870c9){_0x2c44b9=_0x2c44b9-0x0;var _0x5bec8a=_0x3f47[_0x2c44b9];return _0x5bec8a;};'use strict';var _=require(_0x73f4('0x0'));var util=require(_0x73f4('0x1'));var moment=require('moment');var BPromise=require(_0x73f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73f4('0x3'));var db=require(_0x73f4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x73f4('0x5'))(_0x73f4('0x6'));var config=require(_0x73f4('0x7'));var jayson=require(_0x73f4('0x8'));var client=jayson['client'][_0x73f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b06e2,_0x46e840,_0x28e2ab){return new BPromise(function(_0x2a06a6,_0x44b5eb){return client['request'](_0x2b06e2,_0x28e2ab)[_0x73f4('0xa')](function(_0x2a59d1){logger[_0x73f4('0xb')](_0x73f4('0xc'),_0x46e840,_0x73f4('0xd'));logger[_0x73f4('0xe')](_0x73f4('0xf'),_0x46e840,_0x73f4('0xd'),JSON[_0x73f4('0x10')](_0x2a59d1));if(_0x2a59d1[_0x73f4('0x11')]){if(_0x2a59d1['error']['code']===0x1f4){logger[_0x73f4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x46e840,_0x2a59d1[_0x73f4('0x11')][_0x73f4('0x12')]);return _0x44b5eb(_0x2a59d1[_0x73f4('0x11')][_0x73f4('0x12')]);}logger[_0x73f4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x46e840,_0x2a59d1[_0x73f4('0x11')][_0x73f4('0x12')]);return _0x2a06a6(_0x2a59d1[_0x73f4('0x11')][_0x73f4('0x12')]);}else{logger[_0x73f4('0xb')](_0x73f4('0xc'),_0x46e840,'request\x20sent');_0x2a06a6(_0x2a59d1[_0x73f4('0x13')]['message']);}})['catch'](function(_0x2a415e){logger[_0x73f4('0x11')](_0x73f4('0xc'),_0x46e840,_0x2a415e);_0x44b5eb(_0x2a415e);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 1b6340e..7b25480 100644 --- a/server/api/template/index.js +++ b/server/api/template/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeda7=['/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index'];(function(_0x23e5a5,_0x4a4809){var _0x3e4ebd=function(_0x3aa5d8){while(--_0x3aa5d8){_0x23e5a5['push'](_0x23e5a5['shift']());}};_0x3e4ebd(++_0x4a4809);}(_0xeda7,0x196));var _0x7eda=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xeda7[_0x2f3794];return _0x1c9fbe;};'use strict';var multer=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var path=require(_0x7eda('0x2'));var timeout=require(_0x7eda('0x3'));var express=require(_0x7eda('0x4'));var router=express[_0x7eda('0x5')]();var fs_extra=require(_0x7eda('0x6'));var auth=require(_0x7eda('0x7'));var interaction=require(_0x7eda('0x8'));var config=require(_0x7eda('0x9'));var controller=require(_0x7eda('0xa'));router[_0x7eda('0xb')]('/',auth[_0x7eda('0xc')](),controller[_0x7eda('0xd')]);router[_0x7eda('0xb')](_0x7eda('0xe'),auth[_0x7eda('0xc')](),controller[_0x7eda('0xf')]);router[_0x7eda('0x10')]('/',auth[_0x7eda('0xc')](),controller['create']);router[_0x7eda('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7eda('0x12')]);router[_0x7eda('0x13')](_0x7eda('0xe'),auth[_0x7eda('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x75dc=['delete','/:id','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','get','show','post','put','update'];(function(_0x237cf,_0x501864){var _0x3b3ad1=function(_0x2331ff){while(--_0x2331ff){_0x237cf['push'](_0x237cf['shift']());}};_0x3b3ad1(++_0x501864);}(_0x75dc,0x1d7));var _0xc75d=function(_0x1ed555,_0x163bb2){_0x1ed555=_0x1ed555-0x0;var _0x2ade3d=_0x75dc[_0x1ed555];return _0x2ade3d;};'use strict';var multer=require(_0xc75d('0x0'));var util=require(_0xc75d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc75d('0x2')]();var fs_extra=require(_0xc75d('0x3'));var auth=require(_0xc75d('0x4'));var interaction=require(_0xc75d('0x5'));var config=require(_0xc75d('0x6'));var controller=require(_0xc75d('0x7'));router['get']('/',auth[_0xc75d('0x8')](),controller[_0xc75d('0x9')]);router[_0xc75d('0xa')]('/:id',auth[_0xc75d('0x8')](),controller[_0xc75d('0xb')]);router[_0xc75d('0xc')]('/',auth[_0xc75d('0x8')](),controller['create']);router[_0xc75d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc75d('0xe')]);router[_0xc75d('0xf')](_0xc75d('0x10'),auth[_0xc75d('0x8')](),controller['destroy']);module[_0xc75d('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0a4e7f0..1872f73 100644 --- a/server/api/template/template.attributes.js +++ b/server/api/template/template.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ea6=['STRING','TEXT','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5ea6,0x1bb));var _0x65ea=function(_0x3f39ab,_0x16c981){_0x3f39ab=_0x3f39ab-0x0;var _0x170952=_0x5ea6[_0x3f39ab];return _0x170952;};'use strict';var Sequelize=require('sequelize');module[_0x65ea('0x0')]={'name':{'type':Sequelize[_0x65ea('0x1')]},'description':{'type':Sequelize[_0x65ea('0x1')]},'html':{'type':Sequelize[_0x65ea('0x2')]}}; \ No newline at end of file +var _0xa9bf=['sequelize','exports','STRING','TEXT'];(function(_0xdecfe0,_0x398f17){var _0x456db0=function(_0x2eedb9){while(--_0x2eedb9){_0xdecfe0['push'](_0xdecfe0['shift']());}};_0x456db0(++_0x398f17);}(_0xa9bf,0x118));var _0xfa9b=function(_0x387603,_0x5a2d1){_0x387603=_0x387603-0x0;var _0x55ea9e=_0xa9bf[_0x387603];return _0x55ea9e;};'use strict';var Sequelize=require(_0xfa9b('0x0'));module[_0xfa9b('0x1')]={'name':{'type':Sequelize[_0xfa9b('0x2')]},'description':{'type':Sequelize[_0xfa9b('0x2')]},'html':{'type':Sequelize[_0xfa9b('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 6fdb022..aba19a7 100644 --- a/server/api/template/template.controller.js +++ b/server/api/template/template.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0480=['limit','set','apply','reject','update','then','destroy','get','Templates','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','Template','count','includeAll','include','rows','catch','show','length','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x14820b,_0x320176){var _0x2345d3=function(_0x137f3d){while(--_0x137f3d){_0x14820b['push'](_0x14820b['shift']());}};_0x2345d3(++_0x320176);}(_0x0480,0x1d4));var _0x0048=function(_0x302f7d,_0x126b0d){_0x302f7d=_0x302f7d-0x0;var _0x491dbd=_0x0480[_0x302f7d];return _0x491dbd;};'use strict';var emlformat=require(_0x0048('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0048('0x1'));var jsonpatch=require(_0x0048('0x2'));var rp=require('request-promise');var moment=require(_0x0048('0x3'));var BPromise=require(_0x0048('0x4'));var Mustache=require(_0x0048('0x5'));var util=require(_0x0048('0x6'));var path=require(_0x0048('0x7'));var sox=require(_0x0048('0x8'));var csv=require(_0x0048('0x9'));var ejs=require(_0x0048('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0048('0xb'));var squel=require(_0x0048('0xc'));var crypto=require(_0x0048('0xd'));var jsforce=require(_0x0048('0xe'));var deskjs=require(_0x0048('0xf'));var toCsv=require(_0x0048('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0048('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0048('0x11'));var as=require(_0x0048('0x12'));var hardwareService=require(_0x0048('0x13'));var logger=require('../../config/logger')(_0x0048('0x14'));var utils=require('../../config/utils');var config=require(_0x0048('0x15'));var licenseUtil=require(_0x0048('0x16'));var db=require(_0x0048('0x17'))['db'];function respondWithStatusCode(_0x4d50c5,_0x357652){_0x357652=_0x357652||0xcc;return function(_0x39dbde){if(_0x39dbde){return _0x4d50c5[_0x0048('0x18')](_0x357652);}return _0x4d50c5[_0x0048('0x19')](_0x357652)[_0x0048('0x1a')]();};}function respondWithResult(_0x4ee9ab,_0x2d66f9){_0x2d66f9=_0x2d66f9||0xc8;return function(_0x3ce90d){if(_0x3ce90d){return _0x4ee9ab['status'](_0x2d66f9)[_0x0048('0x1b')](_0x3ce90d);}};}function respondWithFilteredResult(_0x4a350a,_0x29e328){return function(_0x25171b){if(_0x25171b){var _0x163b23=typeof _0x29e328[_0x0048('0x1c')]===_0x0048('0x1d')&&typeof _0x29e328['limit']===_0x0048('0x1d');var _0x565d73=_0x25171b['count'];var _0x4faa65=_0x163b23?0x0:_0x29e328[_0x0048('0x1c')];var _0x49c975=_0x163b23?_0x25171b['count']:_0x29e328[_0x0048('0x1c')]+_0x29e328[_0x0048('0x1e')];var _0x2db165;if(_0x49c975>=_0x565d73){_0x49c975=_0x565d73;_0x2db165=0xc8;}else{_0x2db165=0xce;}_0x4a350a[_0x0048('0x19')](_0x2db165);return _0x4a350a[_0x0048('0x1f')]('Content-Range',_0x4faa65+'-'+_0x49c975+'/'+_0x565d73)['json'](_0x25171b);}return null;};}function patchUpdates(_0x2262ee){return function(_0xc52736){try{jsonpatch[_0x0048('0x20')](_0xc52736,_0x2262ee,!![]);}catch(_0x1d7510){return BPromise[_0x0048('0x21')](_0x1d7510);}return _0xc52736['save']();};}function saveUpdates(_0x54e592,_0x532882){return function(_0x103ac8){if(_0x103ac8){return _0x103ac8[_0x0048('0x22')](_0x54e592)[_0x0048('0x23')](function(_0x23efb3){return _0x23efb3;});}return null;};}function removeEntity(_0x17c0fc,_0x1e13f4){return function(_0x2f7e73){if(_0x2f7e73){return _0x2f7e73[_0x0048('0x24')]()[_0x0048('0x23')](function(){var _0x33399d=_0x2f7e73[_0x0048('0x25')]({'plain':!![]});var _0x11c470=_0x0048('0x26');return db[_0x0048('0x27')][_0x0048('0x24')]({'where':{'type':_0x11c470,'resourceId':_0x33399d['id']}})['then'](function(){return _0x2f7e73;});})['then'](function(){_0x17c0fc[_0x0048('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x171dd5,_0x48bb2e){return function(_0x1713aa){if(!_0x1713aa){_0x171dd5[_0x0048('0x18')](0x194);}return _0x1713aa;};}function handleError(_0x24b184,_0x1ef653){_0x1ef653=_0x1ef653||0x1f4;return function(_0x521c56){logger['error'](_0x521c56[_0x0048('0x28')]);if(_0x521c56[_0x0048('0x29')]){delete _0x521c56[_0x0048('0x29')];}_0x24b184[_0x0048('0x19')](_0x1ef653)[_0x0048('0x2a')](_0x521c56);};}exports[_0x0048('0x2b')]=function(_0x32182d,_0x9f1a70){var _0x59ccb7={},_0x20c5ab={},_0x3c8d04={'count':0x0,'rows':[]};var _0x55b0cd=_[_0x0048('0x2c')](db['Template'][_0x0048('0x2d')],function(_0x16850d){return{'name':_0x16850d[_0x0048('0x2e')],'type':_0x16850d[_0x0048('0x2f')][_0x0048('0x30')]};});_0x20c5ab[_0x0048('0x31')]=_[_0x0048('0x2c')](_0x55b0cd,_0x0048('0x29'));_0x20c5ab['query']=_[_0x0048('0x32')](_0x32182d[_0x0048('0x33')]);_0x20c5ab[_0x0048('0x34')]=_[_0x0048('0x35')](_0x20c5ab[_0x0048('0x31')],_0x20c5ab[_0x0048('0x33')]);_0x59ccb7['attributes']=_[_0x0048('0x35')](_0x20c5ab[_0x0048('0x31')],qs[_0x0048('0x36')](_0x32182d[_0x0048('0x33')]['fields']));_0x59ccb7[_0x0048('0x37')]=_0x59ccb7[_0x0048('0x37')]['length']?_0x59ccb7[_0x0048('0x37')]:_0x20c5ab['model'];if(!_0x32182d['query'][_0x0048('0x38')]('nolimit')){_0x59ccb7[_0x0048('0x1e')]=qs[_0x0048('0x1e')](_0x32182d[_0x0048('0x33')][_0x0048('0x1e')]);_0x59ccb7[_0x0048('0x1c')]=qs[_0x0048('0x1c')](_0x32182d[_0x0048('0x33')][_0x0048('0x1c')]);}_0x59ccb7[_0x0048('0x39')]=qs[_0x0048('0x3a')](_0x32182d['query']['sort']);_0x59ccb7[_0x0048('0x3b')]=qs[_0x0048('0x34')](_[_0x0048('0x3c')](_0x32182d['query'],_0x20c5ab[_0x0048('0x34')]),_0x55b0cd);if(_0x32182d[_0x0048('0x33')][_0x0048('0x3d')]){_0x59ccb7['where']=_['merge'](_0x59ccb7[_0x0048('0x3b')],{'$or':_[_0x0048('0x2c')](_0x55b0cd,function(_0x5c8d4b){if(_0x5c8d4b[_0x0048('0x2f')]!==_0x0048('0x3e')){var _0x6b0a37={};_0x6b0a37[_0x5c8d4b['name']]={'$like':'%'+_0x32182d['query'][_0x0048('0x3d')]+'%'};return _0x6b0a37;}})});}_0x59ccb7=_['merge']({},_0x59ccb7,_0x32182d[_0x0048('0x3f')]);var _0x961104={'where':_0x59ccb7[_0x0048('0x3b')]};return db[_0x0048('0x40')]['count'](_0x961104)[_0x0048('0x23')](function(_0x4494ae){_0x3c8d04[_0x0048('0x41')]=_0x4494ae;if(_0x32182d[_0x0048('0x33')][_0x0048('0x42')]){_0x59ccb7[_0x0048('0x43')]=[{'all':!![]}];}return db['Template']['findAll'](_0x59ccb7);})[_0x0048('0x23')](function(_0x4bbfb9){_0x3c8d04[_0x0048('0x44')]=_0x4bbfb9;return _0x3c8d04;})[_0x0048('0x23')](respondWithFilteredResult(_0x9f1a70,_0x59ccb7))[_0x0048('0x45')](handleError(_0x9f1a70,null));};exports[_0x0048('0x46')]=function(_0x5756cf,_0x1b85c7){var _0x17b6c7={'raw':!![],'where':{'id':_0x5756cf['params']['id']}},_0x245728={};_0x245728[_0x0048('0x31')]=_[_0x0048('0x32')](db['Template']['rawAttributes']);_0x245728['query']=_[_0x0048('0x32')](_0x5756cf[_0x0048('0x33')]);_0x245728[_0x0048('0x34')]=_[_0x0048('0x35')](_0x245728[_0x0048('0x31')],_0x245728[_0x0048('0x33')]);_0x17b6c7['attributes']=_[_0x0048('0x35')](_0x245728[_0x0048('0x31')],qs[_0x0048('0x36')](_0x5756cf['query'][_0x0048('0x36')]));_0x17b6c7['attributes']=_0x17b6c7[_0x0048('0x37')][_0x0048('0x47')]?_0x17b6c7[_0x0048('0x37')]:_0x245728[_0x0048('0x31')];if(_0x5756cf['query'][_0x0048('0x42')]){_0x17b6c7[_0x0048('0x43')]=[{'all':!![]}];}_0x17b6c7=_[_0x0048('0x48')]({},_0x17b6c7,_0x5756cf[_0x0048('0x3f')]);return db[_0x0048('0x40')][_0x0048('0x49')](_0x17b6c7)[_0x0048('0x23')](handleEntityNotFound(_0x1b85c7,null))[_0x0048('0x23')](respondWithResult(_0x1b85c7,null))[_0x0048('0x45')](handleError(_0x1b85c7,null));};exports[_0x0048('0x4a')]=function(_0x654442,_0x3c5b4e){return db[_0x0048('0x40')][_0x0048('0x4a')](_0x654442[_0x0048('0x4b')],{})[_0x0048('0x23')](function(_0x44df88){var _0xdf8002=_0x654442['user'][_0x0048('0x25')]({'plain':!![]});if(!_0xdf8002)throw new Error(_0x0048('0x4c'));if(_0xdf8002[_0x0048('0x4d')]===_0x0048('0x4e')){var _0x29ba49=_0x44df88[_0x0048('0x25')]({'plain':!![]});var _0x2c4e99=_0x0048('0x26');return db[_0x0048('0x4f')]['find']({'where':{'name':_0x2c4e99,'userProfileId':_0xdf8002['userProfileId']},'raw':!![]})['then'](function(_0x15dc08){if(_0x15dc08&&_0x15dc08[_0x0048('0x50')]===0x0){return db[_0x0048('0x27')][_0x0048('0x4a')]({'name':_0x29ba49[_0x0048('0x29')],'resourceId':_0x29ba49['id'],'type':_0x15dc08[_0x0048('0x29')],'sectionId':_0x15dc08['id']},{})[_0x0048('0x23')](function(){return _0x44df88;});}else{return _0x44df88;}})['catch'](function(_0x5eaf25){logger['error'](_0x0048('0x51'),_0x5eaf25);throw _0x5eaf25;});}return _0x44df88;})[_0x0048('0x23')](respondWithResult(_0x3c5b4e,0xc9))['catch'](handleError(_0x3c5b4e,null));};exports[_0x0048('0x22')]=function(_0x5a66bb,_0x19e510){if(_0x5a66bb[_0x0048('0x4b')]['id']){delete _0x5a66bb[_0x0048('0x4b')]['id'];}return db[_0x0048('0x40')][_0x0048('0x49')]({'where':{'id':_0x5a66bb[_0x0048('0x52')]['id']}})[_0x0048('0x23')](handleEntityNotFound(_0x19e510,null))[_0x0048('0x23')](saveUpdates(_0x5a66bb[_0x0048('0x4b')],null))[_0x0048('0x23')](respondWithResult(_0x19e510,null))[_0x0048('0x45')](handleError(_0x19e510,null));};exports[_0x0048('0x24')]=function(_0x28faee,_0x55adb6){return db[_0x0048('0x40')][_0x0048('0x49')]({'where':{'id':_0x28faee[_0x0048('0x52')]['id']}})[_0x0048('0x23')](handleEntityNotFound(_0x55adb6,null))[_0x0048('0x23')](removeEntity(_0x55adb6,null))[_0x0048('0x45')](handleError(_0x55adb6,null));}; \ No newline at end of file +var _0x94bd=['Content-Range','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Template','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','include','findAll','catch','show','params','rawAttributes','includeAll','merge','options','find','create','user','role','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','set'];(function(_0x5c3a0a,_0x570cea){var _0x498445=function(_0x382dc5){while(--_0x382dc5){_0x5c3a0a['push'](_0x5c3a0a['shift']());}};_0x498445(++_0x570cea);}(_0x94bd,0x84));var _0xd94b=function(_0x42fe71,_0x344558){_0x42fe71=_0x42fe71-0x0;var _0x1bb9c6=_0x94bd[_0x42fe71];return _0x1bb9c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd94b('0x0'));var zipdir=require(_0xd94b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd94b('0x2'));var moment=require(_0xd94b('0x3'));var BPromise=require(_0xd94b('0x4'));var Mustache=require(_0xd94b('0x5'));var util=require(_0xd94b('0x6'));var path=require(_0xd94b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd94b('0x8'));var fs=require('fs');var fs_extra=require(_0xd94b('0x9'));var _=require(_0xd94b('0xa'));var squel=require(_0xd94b('0xb'));var crypto=require('crypto');var jsforce=require(_0xd94b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd94b('0xd'));var Papa=require(_0xd94b('0xe'));var Redis=require(_0xd94b('0xf'));var authService=require(_0xd94b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd94b('0x11'));var hardwareService=require(_0xd94b('0x12'));var logger=require('../../config/logger')(_0xd94b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd94b('0x14'));var db=require(_0xd94b('0x15'))['db'];function respondWithStatusCode(_0x1eb65a,_0x42d2fc){_0x42d2fc=_0x42d2fc||0xcc;return function(_0x34e0ab){if(_0x34e0ab){return _0x1eb65a[_0xd94b('0x16')](_0x42d2fc);}return _0x1eb65a[_0xd94b('0x17')](_0x42d2fc)[_0xd94b('0x18')]();};}function respondWithResult(_0x439528,_0x423ca5){_0x423ca5=_0x423ca5||0xc8;return function(_0x3df475){if(_0x3df475){return _0x439528[_0xd94b('0x17')](_0x423ca5)[_0xd94b('0x19')](_0x3df475);}};}function respondWithFilteredResult(_0x23795d,_0x4a98fb){return function(_0x33c7e7){if(_0x33c7e7){var _0x375310=typeof _0x4a98fb['offset']==='undefined'&&typeof _0x4a98fb[_0xd94b('0x1a')]==='undefined';var _0x149754=_0x33c7e7['count'];var _0x454b9b=_0x375310?0x0:_0x4a98fb[_0xd94b('0x1b')];var _0x921d0e=_0x375310?_0x33c7e7[_0xd94b('0x1c')]:_0x4a98fb[_0xd94b('0x1b')]+_0x4a98fb[_0xd94b('0x1a')];var _0x522535;if(_0x921d0e>=_0x149754){_0x921d0e=_0x149754;_0x522535=0xc8;}else{_0x522535=0xce;}_0x23795d['status'](_0x522535);return _0x23795d[_0xd94b('0x1d')](_0xd94b('0x1e'),_0x454b9b+'-'+_0x921d0e+'/'+_0x149754)[_0xd94b('0x19')](_0x33c7e7);}return null;};}function patchUpdates(_0x25b57c){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x25b57c,!![]);}catch(_0x59017c){return BPromise['reject'](_0x59017c);}return _0x1a3118[_0xd94b('0x1f')]();};}function saveUpdates(_0x1715df,_0x3b44bc){return function(_0x659c15){if(_0x659c15){return _0x659c15[_0xd94b('0x20')](_0x1715df)[_0xd94b('0x21')](function(_0x1c9787){return _0x1c9787;});}return null;};}function removeEntity(_0x3f570a,_0x193395){return function(_0x1a190d){if(_0x1a190d){return _0x1a190d[_0xd94b('0x22')]()['then'](function(){var _0x4ac82c=_0x1a190d[_0xd94b('0x23')]({'plain':!![]});var _0x9d42bc='Templates';return db[_0xd94b('0x24')][_0xd94b('0x22')]({'where':{'type':_0x9d42bc,'resourceId':_0x4ac82c['id']}})[_0xd94b('0x21')](function(){return _0x1a190d;});})[_0xd94b('0x21')](function(){_0x3f570a[_0xd94b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be72f,_0x386bee){return function(_0x1f6946){if(!_0x1f6946){_0x3be72f['sendStatus'](0x194);}return _0x1f6946;};}function handleError(_0x187f31,_0x27216f){_0x27216f=_0x27216f||0x1f4;return function(_0x39dde1){logger[_0xd94b('0x25')](_0x39dde1[_0xd94b('0x26')]);if(_0x39dde1[_0xd94b('0x27')]){delete _0x39dde1[_0xd94b('0x27')];}_0x187f31[_0xd94b('0x17')](_0x27216f)[_0xd94b('0x28')](_0x39dde1);};}exports[_0xd94b('0x29')]=function(_0xd94c93,_0x47117d){var _0x2e2fa9={},_0x1e478f={},_0x1fc732={'count':0x0,'rows':[]};var _0x2b0ca7=_[_0xd94b('0x2a')](db[_0xd94b('0x2b')]['rawAttributes'],function(_0x55fac6){return{'name':_0x55fac6[_0xd94b('0x2c')],'type':_0x55fac6['type'][_0xd94b('0x2d')]};});_0x1e478f[_0xd94b('0x2e')]=_[_0xd94b('0x2a')](_0x2b0ca7,'name');_0x1e478f[_0xd94b('0x2f')]=_[_0xd94b('0x30')](_0xd94c93[_0xd94b('0x2f')]);_0x1e478f[_0xd94b('0x31')]=_[_0xd94b('0x32')](_0x1e478f[_0xd94b('0x2e')],_0x1e478f[_0xd94b('0x2f')]);_0x2e2fa9['attributes']=_['intersection'](_0x1e478f[_0xd94b('0x2e')],qs[_0xd94b('0x33')](_0xd94c93['query']['fields']));_0x2e2fa9[_0xd94b('0x34')]=_0x2e2fa9[_0xd94b('0x34')][_0xd94b('0x35')]?_0x2e2fa9[_0xd94b('0x34')]:_0x1e478f[_0xd94b('0x2e')];if(!_0xd94c93['query'][_0xd94b('0x36')](_0xd94b('0x37'))){_0x2e2fa9[_0xd94b('0x1a')]=qs[_0xd94b('0x1a')](_0xd94c93[_0xd94b('0x2f')]['limit']);_0x2e2fa9['offset']=qs['offset'](_0xd94c93[_0xd94b('0x2f')][_0xd94b('0x1b')]);}_0x2e2fa9[_0xd94b('0x38')]=qs[_0xd94b('0x39')](_0xd94c93['query'][_0xd94b('0x39')]);_0x2e2fa9[_0xd94b('0x3a')]=qs[_0xd94b('0x31')](_[_0xd94b('0x3b')](_0xd94c93[_0xd94b('0x2f')],_0x1e478f[_0xd94b('0x31')]),_0x2b0ca7);if(_0xd94c93['query']['filter']){_0x2e2fa9[_0xd94b('0x3a')]=_['merge'](_0x2e2fa9[_0xd94b('0x3a')],{'$or':_[_0xd94b('0x2a')](_0x2b0ca7,function(_0x413b57){if(_0x413b57[_0xd94b('0x3c')]!=='VIRTUAL'){var _0x44d7da={};_0x44d7da[_0x413b57[_0xd94b('0x27')]]={'$like':'%'+_0xd94c93[_0xd94b('0x2f')][_0xd94b('0x3d')]+'%'};return _0x44d7da;}})});}_0x2e2fa9=_['merge']({},_0x2e2fa9,_0xd94c93['options']);var _0x30a2bb={'where':_0x2e2fa9[_0xd94b('0x3a')]};return db['Template']['count'](_0x30a2bb)[_0xd94b('0x21')](function(_0x12b965){_0x1fc732['count']=_0x12b965;if(_0xd94c93[_0xd94b('0x2f')]['includeAll']){_0x2e2fa9[_0xd94b('0x3e')]=[{'all':!![]}];}return db['Template'][_0xd94b('0x3f')](_0x2e2fa9);})['then'](function(_0x451163){_0x1fc732['rows']=_0x451163;return _0x1fc732;})[_0xd94b('0x21')](respondWithFilteredResult(_0x47117d,_0x2e2fa9))[_0xd94b('0x40')](handleError(_0x47117d,null));};exports[_0xd94b('0x41')]=function(_0x3561f6,_0x463934){var _0x80cf56={'raw':!![],'where':{'id':_0x3561f6[_0xd94b('0x42')]['id']}},_0x2159db={};_0x2159db[_0xd94b('0x2e')]=_[_0xd94b('0x30')](db[_0xd94b('0x2b')][_0xd94b('0x43')]);_0x2159db[_0xd94b('0x2f')]=_[_0xd94b('0x30')](_0x3561f6[_0xd94b('0x2f')]);_0x2159db[_0xd94b('0x31')]=_[_0xd94b('0x32')](_0x2159db['model'],_0x2159db['query']);_0x80cf56['attributes']=_[_0xd94b('0x32')](_0x2159db[_0xd94b('0x2e')],qs[_0xd94b('0x33')](_0x3561f6[_0xd94b('0x2f')][_0xd94b('0x33')]));_0x80cf56[_0xd94b('0x34')]=_0x80cf56[_0xd94b('0x34')][_0xd94b('0x35')]?_0x80cf56[_0xd94b('0x34')]:_0x2159db[_0xd94b('0x2e')];if(_0x3561f6['query'][_0xd94b('0x44')]){_0x80cf56[_0xd94b('0x3e')]=[{'all':!![]}];}_0x80cf56=_[_0xd94b('0x45')]({},_0x80cf56,_0x3561f6[_0xd94b('0x46')]);return db[_0xd94b('0x2b')][_0xd94b('0x47')](_0x80cf56)[_0xd94b('0x21')](handleEntityNotFound(_0x463934,null))[_0xd94b('0x21')](respondWithResult(_0x463934,null))[_0xd94b('0x40')](handleError(_0x463934,null));};exports['create']=function(_0x161aa1,_0x836e98){return db[_0xd94b('0x2b')][_0xd94b('0x48')](_0x161aa1['body'],{})[_0xd94b('0x21')](function(_0x4eb974){var _0x306900=_0x161aa1[_0xd94b('0x49')][_0xd94b('0x23')]({'plain':!![]});if(!_0x306900)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x306900[_0xd94b('0x4a')]===_0xd94b('0x49')){var _0x3b65df=_0x4eb974['get']({'plain':!![]});var _0x2e7b58=_0xd94b('0x4b');return db[_0xd94b('0x4c')][_0xd94b('0x47')]({'where':{'name':_0x2e7b58,'userProfileId':_0x306900[_0xd94b('0x4d')]},'raw':!![]})[_0xd94b('0x21')](function(_0x2213e7){if(_0x2213e7&&_0x2213e7[_0xd94b('0x4e')]===0x0){return db[_0xd94b('0x24')]['create']({'name':_0x3b65df[_0xd94b('0x27')],'resourceId':_0x3b65df['id'],'type':_0x2213e7[_0xd94b('0x27')],'sectionId':_0x2213e7['id']},{})[_0xd94b('0x21')](function(){return _0x4eb974;});}else{return _0x4eb974;}})[_0xd94b('0x40')](function(_0x4f2a21){logger[_0xd94b('0x25')](_0xd94b('0x4f'),_0x4f2a21);throw _0x4f2a21;});}return _0x4eb974;})[_0xd94b('0x21')](respondWithResult(_0x836e98,0xc9))[_0xd94b('0x40')](handleError(_0x836e98,null));};exports['update']=function(_0xbb6862,_0x539055){if(_0xbb6862[_0xd94b('0x50')]['id']){delete _0xbb6862[_0xd94b('0x50')]['id'];}return db[_0xd94b('0x2b')][_0xd94b('0x47')]({'where':{'id':_0xbb6862[_0xd94b('0x42')]['id']}})['then'](handleEntityNotFound(_0x539055,null))[_0xd94b('0x21')](saveUpdates(_0xbb6862[_0xd94b('0x50')],null))['then'](respondWithResult(_0x539055,null))[_0xd94b('0x40')](handleError(_0x539055,null));};exports[_0xd94b('0x22')]=function(_0x212f59,_0x45484d){return db[_0xd94b('0x2b')]['find']({'where':{'id':_0x212f59[_0xd94b('0x42')]['id']}})['then'](handleEntityNotFound(_0x45484d,null))[_0xd94b('0x21')](removeEntity(_0x45484d,null))[_0xd94b('0x40')](handleError(_0x45484d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 41396b9..7206abb 100644 --- a/server/api/template/template.model.js +++ b/server/api/template/template.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80ce=['path','../../config/environment','./template.attributes','define','Template','util','../../config/logger','api','moment','request-promise'];(function(_0x56dd5c,_0x75f627){var _0x15315d=function(_0x29b871){while(--_0x29b871){_0x56dd5c['push'](_0x56dd5c['shift']());}};_0x15315d(++_0x75f627);}(_0x80ce,0xb9));var _0xe80c=function(_0x10ad82,_0x462232){_0x10ad82=_0x10ad82-0x0;var _0x205004=_0x80ce[_0x10ad82];return _0x205004;};'use strict';var _=require('lodash');var util=require(_0xe80c('0x0'));var logger=require(_0xe80c('0x1'))(_0xe80c('0x2'));var moment=require(_0xe80c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe80c('0x4'));var fs=require('fs');var path=require(_0xe80c('0x5'));var rimraf=require('rimraf');var config=require(_0xe80c('0x6'));var attributes=require(_0xe80c('0x7'));module['exports']=function(_0x218a75,_0x47dbc3){return _0x218a75[_0xe80c('0x8')](_0xe80c('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff32=['request-promise','path','rimraf','../../config/environment','./template.attributes','define','tools_templates','lodash','../../config/logger','moment','bluebird'];(function(_0x3e5193,_0x2ddca8){var _0xf56de6=function(_0x1b98f6){while(--_0x1b98f6){_0x3e5193['push'](_0x3e5193['shift']());}};_0xf56de6(++_0x2ddca8);}(_0xff32,0x17d));var _0x2ff3=function(_0x470e3f,_0x3b513d){_0x470e3f=_0x470e3f-0x0;var _0x4fd22b=_0xff32[_0x470e3f];return _0x4fd22b;};'use strict';var _=require(_0x2ff3('0x0'));var util=require('util');var logger=require(_0x2ff3('0x1'))('api');var moment=require(_0x2ff3('0x2'));var BPromise=require(_0x2ff3('0x3'));var rp=require(_0x2ff3('0x4'));var fs=require('fs');var path=require(_0x2ff3('0x5'));var rimraf=require(_0x2ff3('0x6'));var config=require(_0x2ff3('0x7'));var attributes=require(_0x2ff3('0x8'));module['exports']=function(_0x12fd72,_0x37d52a){return _0x12fd72[_0x2ff3('0x9')]('Template',attributes,{'tableName':_0x2ff3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 0dc5722..0cfe74c 100644 --- a/server/api/template/template.rpc.js +++ b/server/api/template/template.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa184=['model','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetTemplate','Template','options','where','attributes','limit','map','include'];(function(_0x1bfa92,_0x43f387){var _0x135030=function(_0x4ea454){while(--_0x4ea454){_0x1bfa92['push'](_0x1bfa92['shift']());}};_0x135030(++_0x43f387);}(_0xa184,0x110));var _0x4a18=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xa184[_0x590a38];return _0xf36626;};'use strict';var _=require(_0x4a18('0x0'));var util=require(_0x4a18('0x1'));var moment=require(_0x4a18('0x2'));var BPromise=require(_0x4a18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a18('0x4'))['db'];var utils=require(_0x4a18('0x5'));var logger=require('../../config/logger')(_0x4a18('0x6'));var config=require(_0x4a18('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a18('0x8')][_0x4a18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24609f,_0x546947,_0x23669b){return new BPromise(function(_0x372522,_0x367a24){return client['request'](_0x24609f,_0x23669b)[_0x4a18('0xa')](function(_0x94be28){logger[_0x4a18('0xb')](_0x4a18('0xc'),_0x546947,_0x4a18('0xd'));logger[_0x4a18('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x546947,_0x4a18('0xd'),JSON[_0x4a18('0xf')](_0x94be28));if(_0x94be28[_0x4a18('0x10')]){if(_0x94be28['error'][_0x4a18('0x11')]===0x1f4){logger[_0x4a18('0x10')](_0x4a18('0xc'),_0x546947,_0x94be28[_0x4a18('0x10')][_0x4a18('0x12')]);return _0x367a24(_0x94be28[_0x4a18('0x10')][_0x4a18('0x12')]);}logger[_0x4a18('0x10')](_0x4a18('0xc'),_0x546947,_0x94be28['error'][_0x4a18('0x12')]);return _0x372522(_0x94be28[_0x4a18('0x10')][_0x4a18('0x12')]);}else{logger[_0x4a18('0xb')](_0x4a18('0xc'),_0x546947,'request\x20sent');_0x372522(_0x94be28[_0x4a18('0x13')][_0x4a18('0x12')]);}})['catch'](function(_0x5f1588){logger['error'](_0x4a18('0xc'),_0x546947,_0x5f1588);_0x367a24(_0x5f1588);});});}exports[_0x4a18('0x14')]=function(_0x3baf6d){var _0x27995a=this;return new Promise(function(_0xb44456,_0x13ae66){return db[_0x4a18('0x15')]['findAll']({'raw':_0x3baf6d[_0x4a18('0x16')]?_0x3baf6d[_0x4a18('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3baf6d[_0x4a18('0x16')]?_0x3baf6d[_0x4a18('0x16')][_0x4a18('0x17')]||null:null,'attributes':_0x3baf6d[_0x4a18('0x16')]?_0x3baf6d[_0x4a18('0x16')][_0x4a18('0x18')]||null:null,'limit':_0x3baf6d[_0x4a18('0x16')]?_0x3baf6d[_0x4a18('0x16')][_0x4a18('0x19')]||null:null,'include':_0x3baf6d[_0x4a18('0x16')]?_0x3baf6d['options']['include']?_[_0x4a18('0x1a')](_0x3baf6d[_0x4a18('0x16')][_0x4a18('0x1b')],function(_0x5e5531){return{'model':db[_0x5e5531[_0x4a18('0x1c')]],'as':_0x5e5531['as'],'attributes':_0x5e5531[_0x4a18('0x18')],'include':_0x5e5531['include']?_[_0x4a18('0x1a')](_0x5e5531['include'],function(_0xb99fed){return{'model':db[_0xb99fed['model']],'as':_0xb99fed['as'],'attributes':_0xb99fed[_0x4a18('0x18')],'include':_0xb99fed[_0x4a18('0x1b')]?_[_0x4a18('0x1a')](_0xb99fed[_0x4a18('0x1b')],function(_0xa360c3){return{'model':db[_0xa360c3['model']],'as':_0xa360c3['as'],'attributes':_0xa360c3[_0x4a18('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4a18('0xa')](function(_0xa597df){logger[_0x4a18('0xb')](_0x4a18('0x14'),_0x3baf6d);logger[_0x4a18('0xe')]('GetTemplate',_0x3baf6d,JSON['stringify'](_0xa597df));_0xb44456(_0xa597df);})[_0x4a18('0x1d')](function(_0x5cd8a1){logger[_0x4a18('0x10')]('GetTemplate',_0x5cd8a1[_0x4a18('0x12')],_0x3baf6d);_0x13ae66(_0x27995a[_0x4a18('0x10')](0x1f4,_0x5cd8a1['message']));});});}; \ No newline at end of file +var _0x1123=['GetTemplate','findAll','options','raw','attributes','limit','include','model','map','debug','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1f4381,_0x303b7b){var _0x44d236=function(_0x3a196a){while(--_0x3a196a){_0x1f4381['push'](_0x1f4381['shift']());}};_0x44d236(++_0x303b7b);}(_0x1123,0x118));var _0x3112=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1123[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3112('0x0'));var BPromise=require('bluebird');var rs=require(_0x3112('0x1'));var fs=require('fs');var Redis=require(_0x3112('0x2'));var db=require(_0x3112('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3112('0x4'));var config=require(_0x3112('0x5'));var jayson=require(_0x3112('0x6'));var client=jayson[_0x3112('0x7')][_0x3112('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e2b5c,_0x3bee38,_0x3f7ae4){return new BPromise(function(_0x3cd83c,_0x4849f9){return client[_0x3112('0x9')](_0x3e2b5c,_0x3f7ae4)[_0x3112('0xa')](function(_0x39b75b){logger[_0x3112('0xb')](_0x3112('0xc'),_0x3bee38,_0x3112('0xd'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x3bee38,_0x3112('0xd'),JSON[_0x3112('0xe')](_0x39b75b));if(_0x39b75b[_0x3112('0xf')]){if(_0x39b75b[_0x3112('0xf')][_0x3112('0x10')]===0x1f4){logger['error'](_0x3112('0xc'),_0x3bee38,_0x39b75b['error']['message']);return _0x4849f9(_0x39b75b[_0x3112('0xf')][_0x3112('0x11')]);}logger[_0x3112('0xf')]('Template,\x20%s,\x20%s',_0x3bee38,_0x39b75b['error'][_0x3112('0x11')]);return _0x3cd83c(_0x39b75b['error'][_0x3112('0x11')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x3bee38,_0x3112('0xd'));_0x3cd83c(_0x39b75b[_0x3112('0x12')]['message']);}})[_0x3112('0x13')](function(_0x3f5cfd){logger['error']('Template,\x20%s,\x20%s',_0x3bee38,_0x3f5cfd);_0x4849f9(_0x3f5cfd);});});}exports[_0x3112('0x14')]=function(_0x5ca7d9){var _0x254ffc=this;return new Promise(function(_0x22925b,_0x5e9262){return db['Template'][_0x3112('0x15')]({'raw':_0x5ca7d9[_0x3112('0x16')]?_0x5ca7d9[_0x3112('0x16')][_0x3112('0x17')]===undefined?!![]:![]:!![],'where':_0x5ca7d9[_0x3112('0x16')]?_0x5ca7d9[_0x3112('0x16')]['where']||null:null,'attributes':_0x5ca7d9[_0x3112('0x16')]?_0x5ca7d9['options'][_0x3112('0x18')]||null:null,'limit':_0x5ca7d9[_0x3112('0x16')]?_0x5ca7d9[_0x3112('0x16')][_0x3112('0x19')]||null:null,'include':_0x5ca7d9[_0x3112('0x16')]?_0x5ca7d9['options'][_0x3112('0x1a')]?_['map'](_0x5ca7d9[_0x3112('0x16')]['include'],function(_0x537e31){return{'model':db[_0x537e31[_0x3112('0x1b')]],'as':_0x537e31['as'],'attributes':_0x537e31['attributes'],'include':_0x537e31[_0x3112('0x1a')]?_[_0x3112('0x1c')](_0x537e31[_0x3112('0x1a')],function(_0x4d898d){return{'model':db[_0x4d898d[_0x3112('0x1b')]],'as':_0x4d898d['as'],'attributes':_0x4d898d[_0x3112('0x18')],'include':_0x4d898d[_0x3112('0x1a')]?_[_0x3112('0x1c')](_0x4d898d['include'],function(_0x34ca6d){return{'model':db[_0x34ca6d[_0x3112('0x1b')]],'as':_0x34ca6d['as'],'attributes':_0x34ca6d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3112('0xa')](function(_0x58f21f){logger[_0x3112('0xb')](_0x3112('0x14'),_0x5ca7d9);logger[_0x3112('0x1d')](_0x3112('0x14'),_0x5ca7d9,JSON[_0x3112('0xe')](_0x58f21f));_0x22925b(_0x58f21f);})['catch'](function(_0x1d1e4a){logger['error'](_0x3112('0x14'),_0x1d1e4a['message'],_0x5ca7d9);_0x5e9262(_0x254ffc[_0x3112('0xf')](0x1f4,_0x1d1e4a[_0x3112('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 6fb7971..11b6424 100644 --- a/server/api/trigger/index.js +++ b/server/api/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb346=['/:id/actions','addAction','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','/:id','isAuthenticated','show','get','/:id/all_conditions','getAllConditions','/:id/any_conditions','getActions','post','addAllCondition','addAnyCondition'];(function(_0xcf9fcf,_0x56d91f){var _0x13a5e5=function(_0x28f221){while(--_0x28f221){_0xcf9fcf['push'](_0xcf9fcf['shift']());}};_0x13a5e5(++_0x56d91f);}(_0xb346,0xcb));var _0x6b34=function(_0x5f0870,_0x387126){_0x5f0870=_0x5f0870-0x0;var _0x596802=_0xb346[_0x5f0870];return _0x596802;};'use strict';var multer=require(_0x6b34('0x0'));var util=require(_0x6b34('0x1'));var path=require('path');var timeout=require(_0x6b34('0x2'));var express=require(_0x6b34('0x3'));var router=express[_0x6b34('0x4')]();var fs_extra=require(_0x6b34('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6b34('0x6'),auth[_0x6b34('0x7')](),controller[_0x6b34('0x8')]);router[_0x6b34('0x9')](_0x6b34('0xa'),auth[_0x6b34('0x7')](),controller[_0x6b34('0xb')]);router[_0x6b34('0x9')](_0x6b34('0xc'),auth[_0x6b34('0x7')](),controller['getAnyConditions']);router['get']('/:id/actions',auth[_0x6b34('0x7')](),controller[_0x6b34('0xd')]);router[_0x6b34('0xe')]('/',auth[_0x6b34('0x7')](),controller['create']);router[_0x6b34('0xe')](_0x6b34('0xa'),auth[_0x6b34('0x7')](),controller[_0x6b34('0xf')]);router[_0x6b34('0xe')](_0x6b34('0xc'),auth[_0x6b34('0x7')](),controller[_0x6b34('0x10')]);router[_0x6b34('0xe')](_0x6b34('0x11'),auth[_0x6b34('0x7')](),controller[_0x6b34('0x12')]);router['put']('/:id',auth[_0x6b34('0x7')](),controller[_0x6b34('0x13')]);router['delete'](_0x6b34('0x6'),auth[_0x6b34('0x7')](),controller[_0x6b34('0x14')]);module[_0x6b34('0x15')]=router; \ No newline at end of file +var _0x72e7=['isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0x72e7,0x102));var _0x772e=function(_0x17196d,_0x4d2543){_0x17196d=_0x17196d-0x0;var _0xed7708=_0x72e7[_0x17196d];return _0xed7708;};'use strict';var multer=require(_0x772e('0x0'));var util=require(_0x772e('0x1'));var path=require(_0x772e('0x2'));var timeout=require(_0x772e('0x3'));var express=require(_0x772e('0x4'));var router=express[_0x772e('0x5')]();var fs_extra=require(_0x772e('0x6'));var auth=require(_0x772e('0x7'));var interaction=require(_0x772e('0x8'));var config=require(_0x772e('0x9'));var controller=require(_0x772e('0xa'));router[_0x772e('0xb')]('/',auth[_0x772e('0xc')](),controller[_0x772e('0xd')]);router[_0x772e('0xb')](_0x772e('0xe'),auth['isAuthenticated'](),controller[_0x772e('0xf')]);router[_0x772e('0xb')](_0x772e('0x10'),auth[_0x772e('0xc')](),controller[_0x772e('0x11')]);router['get'](_0x772e('0x12'),auth[_0x772e('0xc')](),controller['getAnyConditions']);router[_0x772e('0xb')](_0x772e('0x13'),auth[_0x772e('0xc')](),controller[_0x772e('0x14')]);router[_0x772e('0x15')]('/',auth[_0x772e('0xc')](),controller[_0x772e('0x16')]);router[_0x772e('0x15')](_0x772e('0x10'),auth[_0x772e('0xc')](),controller[_0x772e('0x17')]);router['post'](_0x772e('0x12'),auth[_0x772e('0xc')](),controller['addAnyCondition']);router[_0x772e('0x15')](_0x772e('0x13'),auth['isAuthenticated'](),controller[_0x772e('0x18')]);router[_0x772e('0x19')](_0x772e('0xe'),auth[_0x772e('0xc')](),controller[_0x772e('0x1a')]);router[_0x772e('0x1b')](_0x772e('0xe'),auth[_0x772e('0xc')](),controller[_0x772e('0x1c')]);module[_0x772e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index dbe2706..745ad59 100644 --- a/server/api/trigger/trigger.attributes.js +++ b/server/api/trigger/trigger.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3870=['sequelize','exports','STRING','BOOLEAN'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0x3870,0x114));var _0x0387=function(_0x3ce41c,_0x252d49){_0x3ce41c=_0x3ce41c-0x0;var _0x28ff40=_0x3870[_0x3ce41c];return _0x28ff40;};'use strict';var Sequelize=require(_0x0387('0x0'));module[_0x0387('0x1')]={'name':{'type':Sequelize[_0x0387('0x2')]},'channel':{'type':Sequelize[_0x0387('0x2')]},'description':{'type':Sequelize[_0x0387('0x2')]},'status':{'type':Sequelize[_0x0387('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xefe2=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xefe2,0x178));var _0x2efe=function(_0x5f3056,_0x3dd505){_0x5f3056=_0x5f3056-0x0;var _0x585675=_0xefe2[_0x5f3056];return _0x585675;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2efe('0x2')]},'description':{'type':Sequelize[_0x2efe('0x2')]},'status':{'type':Sequelize[_0x2efe('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 64b6af7..645b9ca 100644 --- a/server/api/trigger/trigger.controller.js +++ b/server/api/trigger/trigger.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c2b=['map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','Trigger','include','findAll','rows','catch','show','params','includeAll','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','find','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','pick','getAnyConditions','TriggerId','getActions','Action','eml-format','rimraf','request-promise','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','Triggers','UserProfileResource','destroy','stack','name','send','index'];(function(_0x16b14a,_0x54a5f5){var _0x4e38d9=function(_0xa85a18){while(--_0xa85a18){_0x16b14a['push'](_0x16b14a['shift']());}};_0x4e38d9(++_0x54a5f5);}(_0x1c2b,0xe4));var _0xb1c2=function(_0x3fefc7,_0x20a7dc){_0x3fefc7=_0x3fefc7-0x0;var _0x1fe591=_0x1c2b[_0x3fefc7];return _0x1fe591;};'use strict';var emlformat=require(_0xb1c2('0x0'));var rimraf=require(_0xb1c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb1c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb1c2('0x3'));var util=require(_0xb1c2('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb1c2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1c2('0x6'));var _=require(_0xb1c2('0x7'));var squel=require(_0xb1c2('0x8'));var crypto=require('crypto');var jsforce=require(_0xb1c2('0x9'));var deskjs=require(_0xb1c2('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb1c2('0xb'));var Redis=require('ioredis');var authService=require(_0xb1c2('0xc'));var qs=require(_0xb1c2('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1c2('0xe'));var logger=require(_0xb1c2('0xf'))(_0xb1c2('0x10'));var utils=require(_0xb1c2('0x11'));var config=require(_0xb1c2('0x12'));var licenseUtil=require(_0xb1c2('0x13'));var db=require(_0xb1c2('0x14'))['db'];function respondWithStatusCode(_0x2807c7,_0x15b974){_0x15b974=_0x15b974||0xcc;return function(_0x18a1ae){if(_0x18a1ae){return _0x2807c7[_0xb1c2('0x15')](_0x15b974);}return _0x2807c7[_0xb1c2('0x16')](_0x15b974)[_0xb1c2('0x17')]();};}function respondWithResult(_0x161f44,_0x58c3fc){_0x58c3fc=_0x58c3fc||0xc8;return function(_0x3f75b9){if(_0x3f75b9){return _0x161f44[_0xb1c2('0x16')](_0x58c3fc)[_0xb1c2('0x18')](_0x3f75b9);}};}function respondWithFilteredResult(_0x3bbe38,_0x13b58f){return function(_0x1666e5){if(_0x1666e5){var _0x5eaa0c=typeof _0x13b58f[_0xb1c2('0x19')]===_0xb1c2('0x1a')&&typeof _0x13b58f[_0xb1c2('0x1b')]==='undefined';var _0x5e99f0=_0x1666e5[_0xb1c2('0x1c')];var _0x1ee071=_0x5eaa0c?0x0:_0x13b58f[_0xb1c2('0x19')];var _0x1ce3bc=_0x5eaa0c?_0x1666e5[_0xb1c2('0x1c')]:_0x13b58f[_0xb1c2('0x19')]+_0x13b58f[_0xb1c2('0x1b')];var _0x2421cd;if(_0x1ce3bc>=_0x5e99f0){_0x1ce3bc=_0x5e99f0;_0x2421cd=0xc8;}else{_0x2421cd=0xce;}_0x3bbe38['status'](_0x2421cd);return _0x3bbe38['set'](_0xb1c2('0x1d'),_0x1ee071+'-'+_0x1ce3bc+'/'+_0x5e99f0)[_0xb1c2('0x18')](_0x1666e5);}return null;};}function patchUpdates(_0x50d7a4){return function(_0xcb7c6f){try{jsonpatch[_0xb1c2('0x1e')](_0xcb7c6f,_0x50d7a4,!![]);}catch(_0x2e03df){return BPromise[_0xb1c2('0x1f')](_0x2e03df);}return _0xcb7c6f['save']();};}function saveUpdates(_0x5498e0,_0x21098b){return function(_0x111291){if(_0x111291){return _0x111291[_0xb1c2('0x20')](_0x5498e0)[_0xb1c2('0x21')](function(_0x5d0516){return _0x5d0516;});}return null;};}function removeEntity(_0x17c3bd,_0x2e90bf){return function(_0x37a893){if(_0x37a893){return _0x37a893['destroy']()[_0xb1c2('0x21')](function(){var _0x38eef8=_0x37a893[_0xb1c2('0x22')]({'plain':!![]});var _0x1334c7=_0xb1c2('0x23');return db[_0xb1c2('0x24')][_0xb1c2('0x25')]({'where':{'type':_0x1334c7,'resourceId':_0x38eef8['id']}})['then'](function(){return _0x37a893;});})[_0xb1c2('0x21')](function(){_0x17c3bd[_0xb1c2('0x16')](0xcc)[_0xb1c2('0x17')]();});}};}function handleEntityNotFound(_0x489afd,_0x7dbd99){return function(_0x17ab98){if(!_0x17ab98){_0x489afd[_0xb1c2('0x15')](0x194);}return _0x17ab98;};}function handleError(_0x20e719,_0x311fe6){_0x311fe6=_0x311fe6||0x1f4;return function(_0x1254b9){logger['error'](_0x1254b9[_0xb1c2('0x26')]);if(_0x1254b9[_0xb1c2('0x27')]){delete _0x1254b9[_0xb1c2('0x27')];}_0x20e719[_0xb1c2('0x16')](_0x311fe6)[_0xb1c2('0x28')](_0x1254b9);};}exports[_0xb1c2('0x29')]=function(_0x2c3fc8,_0x28321e){var _0x207bdf={},_0x1abd41={},_0x38db3a={'count':0x0,'rows':[]};var _0x16cf46=_[_0xb1c2('0x2a')](db['Trigger'][_0xb1c2('0x2b')],function(_0x343df0){return{'name':_0x343df0['fieldName'],'type':_0x343df0[_0xb1c2('0x2c')]['key']};});_0x1abd41['model']=_[_0xb1c2('0x2a')](_0x16cf46,_0xb1c2('0x27'));_0x1abd41[_0xb1c2('0x2d')]=_[_0xb1c2('0x2e')](_0x2c3fc8['query']);_0x1abd41[_0xb1c2('0x2f')]=_[_0xb1c2('0x30')](_0x1abd41[_0xb1c2('0x31')],_0x1abd41['query']);_0x207bdf[_0xb1c2('0x32')]=_[_0xb1c2('0x30')](_0x1abd41[_0xb1c2('0x31')],qs[_0xb1c2('0x33')](_0x2c3fc8['query'][_0xb1c2('0x33')]));_0x207bdf['attributes']=_0x207bdf[_0xb1c2('0x32')][_0xb1c2('0x34')]?_0x207bdf['attributes']:_0x1abd41[_0xb1c2('0x31')];if(!_0x2c3fc8[_0xb1c2('0x2d')][_0xb1c2('0x35')](_0xb1c2('0x36'))){_0x207bdf[_0xb1c2('0x1b')]=qs['limit'](_0x2c3fc8['query']['limit']);_0x207bdf[_0xb1c2('0x19')]=qs[_0xb1c2('0x19')](_0x2c3fc8[_0xb1c2('0x2d')][_0xb1c2('0x19')]);}_0x207bdf[_0xb1c2('0x37')]=qs[_0xb1c2('0x38')](_0x2c3fc8[_0xb1c2('0x2d')][_0xb1c2('0x38')]);_0x207bdf['where']=qs[_0xb1c2('0x2f')](_['pick'](_0x2c3fc8[_0xb1c2('0x2d')],_0x1abd41[_0xb1c2('0x2f')]),_0x16cf46);if(_0x2c3fc8[_0xb1c2('0x2d')]['filter']){_0x207bdf[_0xb1c2('0x39')]=_[_0xb1c2('0x3a')](_0x207bdf[_0xb1c2('0x39')],{'$or':_['map'](_0x16cf46,function(_0x15789f){if(_0x15789f[_0xb1c2('0x2c')]!=='VIRTUAL'){var _0x15937c={};_0x15937c[_0x15789f[_0xb1c2('0x27')]]={'$like':'%'+_0x2c3fc8[_0xb1c2('0x2d')][_0xb1c2('0x3b')]+'%'};return _0x15937c;}})});}_0x207bdf=_[_0xb1c2('0x3a')]({},_0x207bdf,_0x2c3fc8['options']);var _0x34c8ea={'where':_0x207bdf['where']};return db[_0xb1c2('0x3c')]['count'](_0x34c8ea)['then'](function(_0x118479){_0x38db3a[_0xb1c2('0x1c')]=_0x118479;if(_0x2c3fc8[_0xb1c2('0x2d')]['includeAll']){_0x207bdf[_0xb1c2('0x3d')]=[{'all':!![]}];}return db['Trigger'][_0xb1c2('0x3e')](_0x207bdf);})[_0xb1c2('0x21')](function(_0x35e4e0){_0x38db3a[_0xb1c2('0x3f')]=_0x35e4e0;return _0x38db3a;})[_0xb1c2('0x21')](respondWithFilteredResult(_0x28321e,_0x207bdf))[_0xb1c2('0x40')](handleError(_0x28321e,null));};exports[_0xb1c2('0x41')]=function(_0x4d5ac8,_0x3924af){var _0x343e1b={'raw':![],'where':{'id':_0x4d5ac8[_0xb1c2('0x42')]['id']}},_0x27458d={};_0x27458d[_0xb1c2('0x31')]=_[_0xb1c2('0x2e')](db[_0xb1c2('0x3c')]['rawAttributes']);_0x27458d[_0xb1c2('0x2d')]=_['keys'](_0x4d5ac8[_0xb1c2('0x2d')]);_0x27458d[_0xb1c2('0x2f')]=_[_0xb1c2('0x30')](_0x27458d[_0xb1c2('0x31')],_0x27458d['query']);_0x343e1b[_0xb1c2('0x32')]=_[_0xb1c2('0x30')](_0x27458d['model'],qs['fields'](_0x4d5ac8[_0xb1c2('0x2d')][_0xb1c2('0x33')]));_0x343e1b[_0xb1c2('0x32')]=_0x343e1b[_0xb1c2('0x32')][_0xb1c2('0x34')]?_0x343e1b[_0xb1c2('0x32')]:_0x27458d[_0xb1c2('0x31')];if(_0x4d5ac8[_0xb1c2('0x2d')][_0xb1c2('0x43')]){_0x343e1b[_0xb1c2('0x3d')]=[{'all':!![]}];}_0x343e1b=_[_0xb1c2('0x3a')]({},_0x343e1b,_0x4d5ac8[_0xb1c2('0x44')]);return db[_0xb1c2('0x3c')]['find'](_0x343e1b)[_0xb1c2('0x21')](handleEntityNotFound(_0x3924af,null))[_0xb1c2('0x21')](respondWithResult(_0x3924af,null))[_0xb1c2('0x40')](handleError(_0x3924af,null));};exports['create']=function(_0x43f40c,_0x3f2ad5){return db[_0xb1c2('0x3c')]['create'](_0x43f40c[_0xb1c2('0x45')],{})['then'](function(_0x159757){var _0x3057a4=_0x43f40c[_0xb1c2('0x46')][_0xb1c2('0x22')]({'plain':!![]});if(!_0x3057a4)throw new Error(_0xb1c2('0x47'));if(_0x3057a4[_0xb1c2('0x48')]===_0xb1c2('0x46')){var _0xd713e8=_0x159757['get']({'plain':!![]});var _0x58388d=_0xb1c2('0x23');return db[_0xb1c2('0x49')]['find']({'where':{'name':_0x58388d,'userProfileId':_0x3057a4[_0xb1c2('0x4a')]},'raw':!![]})['then'](function(_0x2d95fa){if(_0x2d95fa&&_0x2d95fa[_0xb1c2('0x4b')]===0x0){return db[_0xb1c2('0x24')][_0xb1c2('0x4c')]({'name':_0xd713e8[_0xb1c2('0x27')],'resourceId':_0xd713e8['id'],'type':_0x2d95fa[_0xb1c2('0x27')],'sectionId':_0x2d95fa['id']},{})['then'](function(){return _0x159757;});}else{return _0x159757;}})[_0xb1c2('0x40')](function(_0x435cfb){logger[_0xb1c2('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x435cfb);throw _0x435cfb;});}return _0x159757;})[_0xb1c2('0x21')](respondWithResult(_0x3f2ad5,0xc9))[_0xb1c2('0x40')](handleError(_0x3f2ad5,null));};exports['update']=function(_0x3013e4,_0x5edb85){if(_0x3013e4[_0xb1c2('0x45')]['id']){delete _0x3013e4[_0xb1c2('0x45')]['id'];}return db[_0xb1c2('0x3c')][_0xb1c2('0x4e')]({'where':{'id':_0x3013e4[_0xb1c2('0x42')]['id']}})[_0xb1c2('0x21')](handleEntityNotFound(_0x5edb85,null))[_0xb1c2('0x21')](saveUpdates(_0x3013e4['body'],null))[_0xb1c2('0x21')](respondWithResult(_0x5edb85,null))[_0xb1c2('0x40')](handleError(_0x5edb85,null));};exports[_0xb1c2('0x25')]=function(_0x56ea70,_0x4cbc74){return db[_0xb1c2('0x3c')][_0xb1c2('0x4e')]({'where':{'id':_0x56ea70[_0xb1c2('0x42')]['id']}})[_0xb1c2('0x21')](handleEntityNotFound(_0x4cbc74,null))[_0xb1c2('0x21')](removeEntity(_0x4cbc74,null))[_0xb1c2('0x40')](handleError(_0x4cbc74,null));};exports[_0xb1c2('0x4f')]=function(_0x3a9a3e,_0x16e90c,_0x2fde6b){if(_0x3a9a3e[_0xb1c2('0x45')]['id']){delete _0x3a9a3e[_0xb1c2('0x45')]['id'];}return db[_0xb1c2('0x3c')]['find']({'where':{'id':_0x3a9a3e['params']['id']}})['then'](handleEntityNotFound(_0x16e90c,null))[_0xb1c2('0x21')](function(_0xf4aa66){if(_0xf4aa66){_0x3a9a3e[_0xb1c2('0x45')][_0xb1c2('0x50')]=_0xf4aa66['id'];return db[_0xb1c2('0x51')][_0xb1c2('0x4c')](_0x3a9a3e[_0xb1c2('0x45')]);}})[_0xb1c2('0x21')](respondWithResult(_0x16e90c,null))[_0xb1c2('0x40')](handleError(_0x16e90c,null));};exports['addAnyCondition']=function(_0x239e79,_0x50fa01,_0x43fdb5){if(_0x239e79[_0xb1c2('0x45')]['id']){delete _0x239e79[_0xb1c2('0x45')]['id'];}return db[_0xb1c2('0x3c')][_0xb1c2('0x4e')]({'where':{'id':_0x239e79[_0xb1c2('0x42')]['id']}})[_0xb1c2('0x21')](handleEntityNotFound(_0x50fa01,null))[_0xb1c2('0x21')](function(_0x5ac1e9){if(_0x5ac1e9){_0x239e79[_0xb1c2('0x45')][_0xb1c2('0x52')]=_0x5ac1e9['id'];return db[_0xb1c2('0x51')][_0xb1c2('0x4c')](_0x239e79[_0xb1c2('0x45')]);}})[_0xb1c2('0x21')](respondWithResult(_0x50fa01,null))['catch'](handleError(_0x50fa01,null));};exports[_0xb1c2('0x53')]=function(_0x55d162,_0x3c0315,_0x9fab12){var _0x4ff9c1={};var _0x424475={};var _0x32c242;var _0x5b1710;return db['Trigger'][_0xb1c2('0x54')]({'where':{'id':_0x55d162[_0xb1c2('0x42')]['id']}})[_0xb1c2('0x21')](handleEntityNotFound(_0x3c0315,null))[_0xb1c2('0x21')](function(_0x369e5a){if(_0x369e5a){_0x32c242=_0x369e5a;_0x424475['model']=_[_0xb1c2('0x2e')](db[_0xb1c2('0x51')][_0xb1c2('0x2b')]);_0x424475['query']=_[_0xb1c2('0x2e')](_0x55d162['query']);_0x424475['filters']=_[_0xb1c2('0x30')](_0x424475['model'],_0x424475['query']);_0x4ff9c1[_0xb1c2('0x32')]=_[_0xb1c2('0x30')](_0x424475[_0xb1c2('0x31')],qs[_0xb1c2('0x33')](_0x55d162[_0xb1c2('0x2d')]['fields']));_0x4ff9c1['attributes']=_0x4ff9c1[_0xb1c2('0x32')][_0xb1c2('0x34')]?_0x4ff9c1[_0xb1c2('0x32')]:_0x424475[_0xb1c2('0x31')];_0x4ff9c1[_0xb1c2('0x37')]=qs[_0xb1c2('0x38')](_0x55d162[_0xb1c2('0x2d')][_0xb1c2('0x38')]);_0x4ff9c1[_0xb1c2('0x39')]=qs['filters'](_[_0xb1c2('0x55')](_0x55d162[_0xb1c2('0x2d')],_0x424475[_0xb1c2('0x2f')]));if(_0x55d162['query']['filter']){_0x4ff9c1['where']=_[_0xb1c2('0x3a')](_0x4ff9c1['where'],{'$or':_['map'](_0x4ff9c1['attributes'],function(_0x1bd49f){var _0x46a354={};_0x46a354[_0x1bd49f]={'$like':'%'+_0x55d162[_0xb1c2('0x2d')][_0xb1c2('0x3b')]+'%'};return _0x46a354;})});}_0x4ff9c1=_['merge']({},_0x4ff9c1,_0x55d162[_0xb1c2('0x44')]);return _0x32c242[_0xb1c2('0x53')](_0x4ff9c1);}})[_0xb1c2('0x21')](function(_0x39ad18){if(_0x39ad18){_0x5b1710=_0x39ad18[_0xb1c2('0x34')];if(!_0x55d162[_0xb1c2('0x2d')][_0xb1c2('0x35')](_0xb1c2('0x36'))){_0x4ff9c1[_0xb1c2('0x1b')]=qs['limit'](_0x55d162['query'][_0xb1c2('0x1b')]);_0x4ff9c1[_0xb1c2('0x19')]=qs[_0xb1c2('0x19')](_0x55d162[_0xb1c2('0x2d')][_0xb1c2('0x19')]);}return _0x32c242[_0xb1c2('0x53')](_0x4ff9c1);}})[_0xb1c2('0x21')](function(_0x1ec448){if(_0x1ec448){return _0x1ec448?{'count':_0x5b1710,'rows':_0x1ec448}:null;}})['then'](respondWithResult(_0x3c0315,null))[_0xb1c2('0x40')](handleError(_0x3c0315,null));};exports[_0xb1c2('0x56')]=function(_0x592b43,_0x5ed2c9,_0x40f299){var _0x4b1f0b={};var _0x2735d8={};var _0x264caf;var _0x2a54d3;return db[_0xb1c2('0x3c')][_0xb1c2('0x54')]({'where':{'id':_0x592b43[_0xb1c2('0x42')]['id']}})[_0xb1c2('0x21')](handleEntityNotFound(_0x5ed2c9,null))[_0xb1c2('0x21')](function(_0x42c167){if(_0x42c167){_0x264caf=_0x42c167;_0x2735d8[_0xb1c2('0x31')]=_['keys'](db[_0xb1c2('0x51')][_0xb1c2('0x2b')]);_0x2735d8[_0xb1c2('0x2d')]=_['keys'](_0x592b43['query']);_0x2735d8['filters']=_[_0xb1c2('0x30')](_0x2735d8[_0xb1c2('0x31')],_0x2735d8[_0xb1c2('0x2d')]);_0x4b1f0b[_0xb1c2('0x32')]=_['intersection'](_0x2735d8[_0xb1c2('0x31')],qs[_0xb1c2('0x33')](_0x592b43[_0xb1c2('0x2d')][_0xb1c2('0x33')]));_0x4b1f0b[_0xb1c2('0x32')]=_0x4b1f0b[_0xb1c2('0x32')]['length']?_0x4b1f0b[_0xb1c2('0x32')]:_0x2735d8[_0xb1c2('0x31')];_0x4b1f0b[_0xb1c2('0x37')]=qs['sort'](_0x592b43[_0xb1c2('0x2d')]['sort']);_0x4b1f0b[_0xb1c2('0x39')]=qs[_0xb1c2('0x2f')](_['pick'](_0x592b43[_0xb1c2('0x2d')],_0x2735d8[_0xb1c2('0x2f')]));if(_0x592b43[_0xb1c2('0x2d')][_0xb1c2('0x3b')]){_0x4b1f0b[_0xb1c2('0x39')]=_[_0xb1c2('0x3a')](_0x4b1f0b[_0xb1c2('0x39')],{'$or':_[_0xb1c2('0x2a')](_0x4b1f0b[_0xb1c2('0x32')],function(_0x589c3b){var _0x173f48={};_0x173f48[_0x589c3b]={'$like':'%'+_0x592b43[_0xb1c2('0x2d')][_0xb1c2('0x3b')]+'%'};return _0x173f48;})});}_0x4b1f0b=_[_0xb1c2('0x3a')]({},_0x4b1f0b,_0x592b43[_0xb1c2('0x44')]);return _0x264caf['getAnyConditions'](_0x4b1f0b);}})[_0xb1c2('0x21')](function(_0x4823d5){if(_0x4823d5){_0x2a54d3=_0x4823d5[_0xb1c2('0x34')];if(!_0x592b43['query']['hasOwnProperty'](_0xb1c2('0x36'))){_0x4b1f0b[_0xb1c2('0x1b')]=qs['limit'](_0x592b43['query'][_0xb1c2('0x1b')]);_0x4b1f0b['offset']=qs[_0xb1c2('0x19')](_0x592b43['query'][_0xb1c2('0x19')]);}return _0x264caf[_0xb1c2('0x56')](_0x4b1f0b);}})[_0xb1c2('0x21')](function(_0x9e55d2){if(_0x9e55d2){return _0x9e55d2?{'count':_0x2a54d3,'rows':_0x9e55d2}:null;}})[_0xb1c2('0x21')](respondWithResult(_0x5ed2c9,null))[_0xb1c2('0x40')](handleError(_0x5ed2c9,null));};exports['addAction']=function(_0x3a6f8e,_0x73f561,_0x29773f){if(_0x3a6f8e[_0xb1c2('0x45')]['id']){delete _0x3a6f8e[_0xb1c2('0x45')]['id'];}return db[_0xb1c2('0x3c')]['find']({'where':{'id':_0x3a6f8e['params']['id']}})['then'](handleEntityNotFound(_0x73f561,null))['then'](function(_0x3fd979){if(_0x3fd979){_0x3a6f8e[_0xb1c2('0x45')][_0xb1c2('0x57')]=_0x3fd979['id'];return db['Action'][_0xb1c2('0x4c')](_0x3a6f8e[_0xb1c2('0x45')]);}})[_0xb1c2('0x21')](respondWithResult(_0x73f561,null))[_0xb1c2('0x40')](handleError(_0x73f561,null));};exports[_0xb1c2('0x58')]=function(_0x309533,_0x1c356c,_0xf23516){var _0x1eaae1={};var _0x380fa0={};var _0x2b10b3;var _0x571161;return db[_0xb1c2('0x3c')][_0xb1c2('0x54')]({'where':{'id':_0x309533[_0xb1c2('0x42')]['id']}})[_0xb1c2('0x21')](handleEntityNotFound(_0x1c356c,null))[_0xb1c2('0x21')](function(_0x208852){if(_0x208852){_0x2b10b3=_0x208852;_0x380fa0['model']=_['keys'](db[_0xb1c2('0x59')][_0xb1c2('0x2b')]);_0x380fa0['query']=_[_0xb1c2('0x2e')](_0x309533[_0xb1c2('0x2d')]);_0x380fa0[_0xb1c2('0x2f')]=_[_0xb1c2('0x30')](_0x380fa0[_0xb1c2('0x31')],_0x380fa0[_0xb1c2('0x2d')]);_0x1eaae1['attributes']=_['intersection'](_0x380fa0[_0xb1c2('0x31')],qs[_0xb1c2('0x33')](_0x309533[_0xb1c2('0x2d')][_0xb1c2('0x33')]));_0x1eaae1[_0xb1c2('0x32')]=_0x1eaae1[_0xb1c2('0x32')][_0xb1c2('0x34')]?_0x1eaae1[_0xb1c2('0x32')]:_0x380fa0['model'];_0x1eaae1[_0xb1c2('0x37')]=qs[_0xb1c2('0x38')](_0x309533['query']['sort']);_0x1eaae1[_0xb1c2('0x39')]=qs[_0xb1c2('0x2f')](_[_0xb1c2('0x55')](_0x309533[_0xb1c2('0x2d')],_0x380fa0[_0xb1c2('0x2f')]));if(_0x309533['query'][_0xb1c2('0x3b')]){_0x1eaae1[_0xb1c2('0x39')]=_[_0xb1c2('0x3a')](_0x1eaae1[_0xb1c2('0x39')],{'$or':_[_0xb1c2('0x2a')](_0x1eaae1[_0xb1c2('0x32')],function(_0x545291){var _0xde9447={};_0xde9447[_0x545291]={'$like':'%'+_0x309533['query'][_0xb1c2('0x3b')]+'%'};return _0xde9447;})});}_0x1eaae1=_[_0xb1c2('0x3a')]({},_0x1eaae1,_0x309533['options']);return _0x2b10b3[_0xb1c2('0x58')](_0x1eaae1);}})['then'](function(_0x4308e4){if(_0x4308e4){_0x571161=_0x4308e4[_0xb1c2('0x34')];if(!_0x309533[_0xb1c2('0x2d')]['hasOwnProperty'](_0xb1c2('0x36'))){_0x1eaae1[_0xb1c2('0x1b')]=qs[_0xb1c2('0x1b')](_0x309533['query']['limit']);_0x1eaae1['offset']=qs['offset'](_0x309533['query'][_0xb1c2('0x19')]);}return _0x2b10b3[_0xb1c2('0x58')](_0x1eaae1);}})['then'](function(_0x3fce3d){if(_0x3fce3d){return _0x3fce3d?{'count':_0x571161,'rows':_0x3fce3d}:null;}})[_0xb1c2('0x21')](respondWithResult(_0x1c356c,null))[_0xb1c2('0x40')](handleError(_0x1c356c,null));}; \ No newline at end of file +var _0x72e6=['params','keys','length','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','addAllCondition','TriggerAllId','addAnyCondition','Condition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Trigger','findAll','rows','catch'];(function(_0xd3bdab,_0x5d784a){var _0x1c3178=function(_0x4f7ef4){while(--_0x4f7ef4){_0xd3bdab['push'](_0xd3bdab['shift']());}};_0x1c3178(++_0x5d784a);}(_0x72e6,0x196));var _0x672e=function(_0x4bab29,_0x74443e){_0x4bab29=_0x4bab29-0x0;var _0x9316d7=_0x72e6[_0x4bab29];return _0x9316d7;};'use strict';var emlformat=require(_0x672e('0x0'));var rimraf=require(_0x672e('0x1'));var zipdir=require(_0x672e('0x2'));var jsonpatch=require(_0x672e('0x3'));var rp=require(_0x672e('0x4'));var moment=require('moment');var BPromise=require(_0x672e('0x5'));var Mustache=require(_0x672e('0x6'));var util=require(_0x672e('0x7'));var path=require(_0x672e('0x8'));var sox=require(_0x672e('0x9'));var csv=require(_0x672e('0xa'));var ejs=require(_0x672e('0xb'));var fs=require('fs');var fs_extra=require(_0x672e('0xc'));var _=require(_0x672e('0xd'));var squel=require(_0x672e('0xe'));var crypto=require(_0x672e('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x672e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x672e('0x10'));var qs=require(_0x672e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x672e('0x12'));var logger=require(_0x672e('0x13'))(_0x672e('0x14'));var utils=require(_0x672e('0x15'));var config=require(_0x672e('0x16'));var licenseUtil=require(_0x672e('0x17'));var db=require(_0x672e('0x18'))['db'];function respondWithStatusCode(_0x1146c9,_0x369ab8){_0x369ab8=_0x369ab8||0xcc;return function(_0x20bf91){if(_0x20bf91){return _0x1146c9['sendStatus'](_0x369ab8);}return _0x1146c9[_0x672e('0x19')](_0x369ab8)[_0x672e('0x1a')]();};}function respondWithResult(_0x3c5ecc,_0x45f903){_0x45f903=_0x45f903||0xc8;return function(_0x4838ca){if(_0x4838ca){return _0x3c5ecc[_0x672e('0x19')](_0x45f903)[_0x672e('0x1b')](_0x4838ca);}};}function respondWithFilteredResult(_0x4e165b,_0x4d9d03){return function(_0x49847e){if(_0x49847e){var _0x24ee53=typeof _0x4d9d03[_0x672e('0x1c')]==='undefined'&&typeof _0x4d9d03[_0x672e('0x1d')]===_0x672e('0x1e');var _0x2584a7=_0x49847e[_0x672e('0x1f')];var _0x3dff55=_0x24ee53?0x0:_0x4d9d03[_0x672e('0x1c')];var _0x8fbcf8=_0x24ee53?_0x49847e[_0x672e('0x1f')]:_0x4d9d03[_0x672e('0x1c')]+_0x4d9d03[_0x672e('0x1d')];var _0x25f23b;if(_0x8fbcf8>=_0x2584a7){_0x8fbcf8=_0x2584a7;_0x25f23b=0xc8;}else{_0x25f23b=0xce;}_0x4e165b[_0x672e('0x19')](_0x25f23b);return _0x4e165b[_0x672e('0x20')]('Content-Range',_0x3dff55+'-'+_0x8fbcf8+'/'+_0x2584a7)[_0x672e('0x1b')](_0x49847e);}return null;};}function patchUpdates(_0x1dbd06){return function(_0xc8ca7e){try{jsonpatch[_0x672e('0x21')](_0xc8ca7e,_0x1dbd06,!![]);}catch(_0x213f1b){return BPromise[_0x672e('0x22')](_0x213f1b);}return _0xc8ca7e[_0x672e('0x23')]();};}function saveUpdates(_0x148e18,_0x18f904){return function(_0x147ae0){if(_0x147ae0){return _0x147ae0[_0x672e('0x24')](_0x148e18)[_0x672e('0x25')](function(_0x524bb6){return _0x524bb6;});}return null;};}function removeEntity(_0x149bb9,_0x59ff96){return function(_0x1e7cc7){if(_0x1e7cc7){return _0x1e7cc7[_0x672e('0x26')]()[_0x672e('0x25')](function(){var _0x246b23=_0x1e7cc7['get']({'plain':!![]});var _0x462ee3=_0x672e('0x27');return db[_0x672e('0x28')][_0x672e('0x26')]({'where':{'type':_0x462ee3,'resourceId':_0x246b23['id']}})[_0x672e('0x25')](function(){return _0x1e7cc7;});})[_0x672e('0x25')](function(){_0x149bb9[_0x672e('0x19')](0xcc)[_0x672e('0x1a')]();});}};}function handleEntityNotFound(_0x307567,_0x5d31c9){return function(_0x5cdf61){if(!_0x5cdf61){_0x307567[_0x672e('0x29')](0x194);}return _0x5cdf61;};}function handleError(_0x5bb3f8,_0x3b3dfb){_0x3b3dfb=_0x3b3dfb||0x1f4;return function(_0x3f26f4){logger[_0x672e('0x2a')](_0x3f26f4[_0x672e('0x2b')]);if(_0x3f26f4['name']){delete _0x3f26f4[_0x672e('0x2c')];}_0x5bb3f8['status'](_0x3b3dfb)['send'](_0x3f26f4);};}exports['index']=function(_0x25cabb,_0x2286ab){var _0x35bf0d={},_0x4774d1={},_0x199fe4={'count':0x0,'rows':[]};var _0x44f38d=_[_0x672e('0x2d')](db['Trigger'][_0x672e('0x2e')],function(_0x3b1ea6){return{'name':_0x3b1ea6[_0x672e('0x2f')],'type':_0x3b1ea6[_0x672e('0x30')][_0x672e('0x31')]};});_0x4774d1[_0x672e('0x32')]=_[_0x672e('0x2d')](_0x44f38d,'name');_0x4774d1[_0x672e('0x33')]=_['keys'](_0x25cabb['query']);_0x4774d1[_0x672e('0x34')]=_[_0x672e('0x35')](_0x4774d1['model'],_0x4774d1[_0x672e('0x33')]);_0x35bf0d[_0x672e('0x36')]=_[_0x672e('0x35')](_0x4774d1[_0x672e('0x32')],qs[_0x672e('0x37')](_0x25cabb[_0x672e('0x33')][_0x672e('0x37')]));_0x35bf0d[_0x672e('0x36')]=_0x35bf0d['attributes']['length']?_0x35bf0d[_0x672e('0x36')]:_0x4774d1['model'];if(!_0x25cabb['query'][_0x672e('0x38')](_0x672e('0x39'))){_0x35bf0d[_0x672e('0x1d')]=qs['limit'](_0x25cabb[_0x672e('0x33')][_0x672e('0x1d')]);_0x35bf0d[_0x672e('0x1c')]=qs[_0x672e('0x1c')](_0x25cabb[_0x672e('0x33')][_0x672e('0x1c')]);}_0x35bf0d[_0x672e('0x3a')]=qs[_0x672e('0x3b')](_0x25cabb[_0x672e('0x33')][_0x672e('0x3b')]);_0x35bf0d[_0x672e('0x3c')]=qs[_0x672e('0x34')](_[_0x672e('0x3d')](_0x25cabb[_0x672e('0x33')],_0x4774d1[_0x672e('0x34')]),_0x44f38d);if(_0x25cabb['query'][_0x672e('0x3e')]){_0x35bf0d[_0x672e('0x3c')]=_[_0x672e('0x3f')](_0x35bf0d['where'],{'$or':_[_0x672e('0x2d')](_0x44f38d,function(_0xc5e1fa){if(_0xc5e1fa[_0x672e('0x30')]!==_0x672e('0x40')){var _0x5daaab={};_0x5daaab[_0xc5e1fa[_0x672e('0x2c')]]={'$like':'%'+_0x25cabb[_0x672e('0x33')][_0x672e('0x3e')]+'%'};return _0x5daaab;}})});}_0x35bf0d=_[_0x672e('0x3f')]({},_0x35bf0d,_0x25cabb['options']);var _0x149990={'where':_0x35bf0d[_0x672e('0x3c')]};return db[_0x672e('0x41')]['count'](_0x149990)[_0x672e('0x25')](function(_0x41b364){_0x199fe4[_0x672e('0x1f')]=_0x41b364;if(_0x25cabb[_0x672e('0x33')]['includeAll']){_0x35bf0d['include']=[{'all':!![]}];}return db[_0x672e('0x41')][_0x672e('0x42')](_0x35bf0d);})[_0x672e('0x25')](function(_0x381349){_0x199fe4[_0x672e('0x43')]=_0x381349;return _0x199fe4;})[_0x672e('0x25')](respondWithFilteredResult(_0x2286ab,_0x35bf0d))[_0x672e('0x44')](handleError(_0x2286ab,null));};exports['show']=function(_0x290129,_0x35111f){var _0x1f819c={'raw':![],'where':{'id':_0x290129[_0x672e('0x45')]['id']}},_0x3a82a5={};_0x3a82a5[_0x672e('0x32')]=_[_0x672e('0x46')](db[_0x672e('0x41')][_0x672e('0x2e')]);_0x3a82a5[_0x672e('0x33')]=_[_0x672e('0x46')](_0x290129['query']);_0x3a82a5[_0x672e('0x34')]=_[_0x672e('0x35')](_0x3a82a5[_0x672e('0x32')],_0x3a82a5[_0x672e('0x33')]);_0x1f819c[_0x672e('0x36')]=_[_0x672e('0x35')](_0x3a82a5[_0x672e('0x32')],qs['fields'](_0x290129[_0x672e('0x33')][_0x672e('0x37')]));_0x1f819c[_0x672e('0x36')]=_0x1f819c[_0x672e('0x36')][_0x672e('0x47')]?_0x1f819c[_0x672e('0x36')]:_0x3a82a5[_0x672e('0x32')];if(_0x290129[_0x672e('0x33')][_0x672e('0x48')]){_0x1f819c[_0x672e('0x49')]=[{'all':!![]}];}_0x1f819c=_['merge']({},_0x1f819c,_0x290129[_0x672e('0x4a')]);return db[_0x672e('0x41')][_0x672e('0x4b')](_0x1f819c)['then'](handleEntityNotFound(_0x35111f,null))['then'](respondWithResult(_0x35111f,null))[_0x672e('0x44')](handleError(_0x35111f,null));};exports['create']=function(_0x5913a3,_0x27e23b){return db['Trigger'][_0x672e('0x4c')](_0x5913a3[_0x672e('0x4d')],{})[_0x672e('0x25')](function(_0x22c6ec){var _0x3ddcf5=_0x5913a3[_0x672e('0x4e')][_0x672e('0x4f')]({'plain':!![]});if(!_0x3ddcf5)throw new Error(_0x672e('0x50'));if(_0x3ddcf5[_0x672e('0x51')]==='user'){var _0x9809d4=_0x22c6ec[_0x672e('0x4f')]({'plain':!![]});var _0x45ab50='Triggers';return db['UserProfileSection'][_0x672e('0x4b')]({'where':{'name':_0x45ab50,'userProfileId':_0x3ddcf5[_0x672e('0x52')]},'raw':!![]})[_0x672e('0x25')](function(_0x1e0c1e){if(_0x1e0c1e&&_0x1e0c1e[_0x672e('0x53')]===0x0){return db[_0x672e('0x28')][_0x672e('0x4c')]({'name':_0x9809d4['name'],'resourceId':_0x9809d4['id'],'type':_0x1e0c1e[_0x672e('0x2c')],'sectionId':_0x1e0c1e['id']},{})['then'](function(){return _0x22c6ec;});}else{return _0x22c6ec;}})[_0x672e('0x44')](function(_0x514e2b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x514e2b);throw _0x514e2b;});}return _0x22c6ec;})['then'](respondWithResult(_0x27e23b,0xc9))[_0x672e('0x44')](handleError(_0x27e23b,null));};exports[_0x672e('0x24')]=function(_0x3ba4e3,_0x46c214){if(_0x3ba4e3[_0x672e('0x4d')]['id']){delete _0x3ba4e3[_0x672e('0x4d')]['id'];}return db['Trigger'][_0x672e('0x4b')]({'where':{'id':_0x3ba4e3[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0x46c214,null))[_0x672e('0x25')](saveUpdates(_0x3ba4e3['body'],null))[_0x672e('0x25')](respondWithResult(_0x46c214,null))['catch'](handleError(_0x46c214,null));};exports[_0x672e('0x26')]=function(_0x5165f2,_0x22c561){return db[_0x672e('0x41')][_0x672e('0x4b')]({'where':{'id':_0x5165f2[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0x22c561,null))[_0x672e('0x25')](removeEntity(_0x22c561,null))[_0x672e('0x44')](handleError(_0x22c561,null));};exports[_0x672e('0x54')]=function(_0x2131b8,_0xd3a3aa,_0x206dd0){if(_0x2131b8[_0x672e('0x4d')]['id']){delete _0x2131b8[_0x672e('0x4d')]['id'];}return db[_0x672e('0x41')][_0x672e('0x4b')]({'where':{'id':_0x2131b8[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0xd3a3aa,null))['then'](function(_0x8723c6){if(_0x8723c6){_0x2131b8[_0x672e('0x4d')][_0x672e('0x55')]=_0x8723c6['id'];return db['Condition'][_0x672e('0x4c')](_0x2131b8[_0x672e('0x4d')]);}})[_0x672e('0x25')](respondWithResult(_0xd3a3aa,null))['catch'](handleError(_0xd3a3aa,null));};exports[_0x672e('0x56')]=function(_0x1b4e3f,_0x2076ca,_0x3a5bf2){if(_0x1b4e3f[_0x672e('0x4d')]['id']){delete _0x1b4e3f['body']['id'];}return db['Trigger'][_0x672e('0x4b')]({'where':{'id':_0x1b4e3f[_0x672e('0x45')]['id']}})['then'](handleEntityNotFound(_0x2076ca,null))[_0x672e('0x25')](function(_0x4d3d63){if(_0x4d3d63){_0x1b4e3f[_0x672e('0x4d')]['TriggerAnyId']=_0x4d3d63['id'];return db[_0x672e('0x57')][_0x672e('0x4c')](_0x1b4e3f['body']);}})[_0x672e('0x25')](respondWithResult(_0x2076ca,null))[_0x672e('0x44')](handleError(_0x2076ca,null));};exports[_0x672e('0x58')]=function(_0x46a37c,_0x25fade,_0x398a4d){var _0x11eaa5={};var _0x2fa02f={};var _0x888c2c;var _0x1ea305;return db['Trigger'][_0x672e('0x59')]({'where':{'id':_0x46a37c[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0x25fade,null))[_0x672e('0x25')](function(_0x4643c4){if(_0x4643c4){_0x888c2c=_0x4643c4;_0x2fa02f['model']=_[_0x672e('0x46')](db[_0x672e('0x57')][_0x672e('0x2e')]);_0x2fa02f[_0x672e('0x33')]=_[_0x672e('0x46')](_0x46a37c[_0x672e('0x33')]);_0x2fa02f[_0x672e('0x34')]=_[_0x672e('0x35')](_0x2fa02f[_0x672e('0x32')],_0x2fa02f[_0x672e('0x33')]);_0x11eaa5[_0x672e('0x36')]=_[_0x672e('0x35')](_0x2fa02f[_0x672e('0x32')],qs[_0x672e('0x37')](_0x46a37c[_0x672e('0x33')][_0x672e('0x37')]));_0x11eaa5[_0x672e('0x36')]=_0x11eaa5[_0x672e('0x36')][_0x672e('0x47')]?_0x11eaa5[_0x672e('0x36')]:_0x2fa02f['model'];_0x11eaa5[_0x672e('0x3a')]=qs[_0x672e('0x3b')](_0x46a37c['query'][_0x672e('0x3b')]);_0x11eaa5[_0x672e('0x3c')]=qs[_0x672e('0x34')](_[_0x672e('0x3d')](_0x46a37c[_0x672e('0x33')],_0x2fa02f['filters']));if(_0x46a37c[_0x672e('0x33')][_0x672e('0x3e')]){_0x11eaa5[_0x672e('0x3c')]=_[_0x672e('0x3f')](_0x11eaa5['where'],{'$or':_[_0x672e('0x2d')](_0x11eaa5[_0x672e('0x36')],function(_0x183819){var _0x1d7fa4={};_0x1d7fa4[_0x183819]={'$like':'%'+_0x46a37c[_0x672e('0x33')][_0x672e('0x3e')]+'%'};return _0x1d7fa4;})});}_0x11eaa5=_[_0x672e('0x3f')]({},_0x11eaa5,_0x46a37c[_0x672e('0x4a')]);return _0x888c2c['getAllConditions'](_0x11eaa5);}})['then'](function(_0x477d3b){if(_0x477d3b){_0x1ea305=_0x477d3b[_0x672e('0x47')];if(!_0x46a37c[_0x672e('0x33')][_0x672e('0x38')]('nolimit')){_0x11eaa5['limit']=qs[_0x672e('0x1d')](_0x46a37c[_0x672e('0x33')]['limit']);_0x11eaa5['offset']=qs[_0x672e('0x1c')](_0x46a37c[_0x672e('0x33')]['offset']);}return _0x888c2c[_0x672e('0x58')](_0x11eaa5);}})[_0x672e('0x25')](function(_0x2d7993){if(_0x2d7993){return _0x2d7993?{'count':_0x1ea305,'rows':_0x2d7993}:null;}})[_0x672e('0x25')](respondWithResult(_0x25fade,null))[_0x672e('0x44')](handleError(_0x25fade,null));};exports[_0x672e('0x5a')]=function(_0x288ee3,_0x106305,_0x52d5ed){var _0x1a7bc5={};var _0x106a65={};var _0x5aa980;var _0x3ca236;return db['Trigger'][_0x672e('0x59')]({'where':{'id':_0x288ee3[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0x106305,null))[_0x672e('0x25')](function(_0x4f6863){if(_0x4f6863){_0x5aa980=_0x4f6863;_0x106a65[_0x672e('0x32')]=_[_0x672e('0x46')](db[_0x672e('0x57')][_0x672e('0x2e')]);_0x106a65[_0x672e('0x33')]=_['keys'](_0x288ee3[_0x672e('0x33')]);_0x106a65['filters']=_[_0x672e('0x35')](_0x106a65[_0x672e('0x32')],_0x106a65[_0x672e('0x33')]);_0x1a7bc5[_0x672e('0x36')]=_['intersection'](_0x106a65[_0x672e('0x32')],qs['fields'](_0x288ee3[_0x672e('0x33')][_0x672e('0x37')]));_0x1a7bc5[_0x672e('0x36')]=_0x1a7bc5[_0x672e('0x36')][_0x672e('0x47')]?_0x1a7bc5[_0x672e('0x36')]:_0x106a65[_0x672e('0x32')];_0x1a7bc5[_0x672e('0x3a')]=qs[_0x672e('0x3b')](_0x288ee3[_0x672e('0x33')][_0x672e('0x3b')]);_0x1a7bc5['where']=qs['filters'](_[_0x672e('0x3d')](_0x288ee3[_0x672e('0x33')],_0x106a65['filters']));if(_0x288ee3[_0x672e('0x33')][_0x672e('0x3e')]){_0x1a7bc5['where']=_[_0x672e('0x3f')](_0x1a7bc5['where'],{'$or':_[_0x672e('0x2d')](_0x1a7bc5[_0x672e('0x36')],function(_0x22e675){var _0x148bc1={};_0x148bc1[_0x22e675]={'$like':'%'+_0x288ee3[_0x672e('0x33')][_0x672e('0x3e')]+'%'};return _0x148bc1;})});}_0x1a7bc5=_[_0x672e('0x3f')]({},_0x1a7bc5,_0x288ee3[_0x672e('0x4a')]);return _0x5aa980['getAnyConditions'](_0x1a7bc5);}})['then'](function(_0x2f494e){if(_0x2f494e){_0x3ca236=_0x2f494e[_0x672e('0x47')];if(!_0x288ee3['query'][_0x672e('0x38')](_0x672e('0x39'))){_0x1a7bc5['limit']=qs[_0x672e('0x1d')](_0x288ee3['query']['limit']);_0x1a7bc5['offset']=qs[_0x672e('0x1c')](_0x288ee3[_0x672e('0x33')][_0x672e('0x1c')]);}return _0x5aa980[_0x672e('0x5a')](_0x1a7bc5);}})[_0x672e('0x25')](function(_0x1767ad){if(_0x1767ad){return _0x1767ad?{'count':_0x3ca236,'rows':_0x1767ad}:null;}})[_0x672e('0x25')](respondWithResult(_0x106305,null))['catch'](handleError(_0x106305,null));};exports[_0x672e('0x5b')]=function(_0x3e88d0,_0x1c07a8,_0x49d200){if(_0x3e88d0[_0x672e('0x4d')]['id']){delete _0x3e88d0[_0x672e('0x4d')]['id'];}return db[_0x672e('0x41')][_0x672e('0x4b')]({'where':{'id':_0x3e88d0[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0x1c07a8,null))['then'](function(_0x2d6f24){if(_0x2d6f24){_0x3e88d0[_0x672e('0x4d')][_0x672e('0x5c')]=_0x2d6f24['id'];return db['Action'][_0x672e('0x4c')](_0x3e88d0[_0x672e('0x4d')]);}})[_0x672e('0x25')](respondWithResult(_0x1c07a8,null))[_0x672e('0x44')](handleError(_0x1c07a8,null));};exports[_0x672e('0x5d')]=function(_0x452224,_0x181b75,_0x362559){var _0x178ad3={};var _0x552167={};var _0x200368;var _0x294b14;return db[_0x672e('0x41')]['findOne']({'where':{'id':_0x452224[_0x672e('0x45')]['id']}})['then'](handleEntityNotFound(_0x181b75,null))[_0x672e('0x25')](function(_0x566b44){if(_0x566b44){_0x200368=_0x566b44;_0x552167['model']=_[_0x672e('0x46')](db[_0x672e('0x5e')]['rawAttributes']);_0x552167[_0x672e('0x33')]=_[_0x672e('0x46')](_0x452224['query']);_0x552167['filters']=_[_0x672e('0x35')](_0x552167[_0x672e('0x32')],_0x552167[_0x672e('0x33')]);_0x178ad3[_0x672e('0x36')]=_[_0x672e('0x35')](_0x552167[_0x672e('0x32')],qs[_0x672e('0x37')](_0x452224[_0x672e('0x33')]['fields']));_0x178ad3[_0x672e('0x36')]=_0x178ad3[_0x672e('0x36')][_0x672e('0x47')]?_0x178ad3[_0x672e('0x36')]:_0x552167[_0x672e('0x32')];_0x178ad3['order']=qs['sort'](_0x452224[_0x672e('0x33')][_0x672e('0x3b')]);_0x178ad3['where']=qs['filters'](_[_0x672e('0x3d')](_0x452224['query'],_0x552167[_0x672e('0x34')]));if(_0x452224['query'][_0x672e('0x3e')]){_0x178ad3[_0x672e('0x3c')]=_[_0x672e('0x3f')](_0x178ad3['where'],{'$or':_[_0x672e('0x2d')](_0x178ad3[_0x672e('0x36')],function(_0x11dae5){var _0xa6bd33={};_0xa6bd33[_0x11dae5]={'$like':'%'+_0x452224[_0x672e('0x33')][_0x672e('0x3e')]+'%'};return _0xa6bd33;})});}_0x178ad3=_[_0x672e('0x3f')]({},_0x178ad3,_0x452224[_0x672e('0x4a')]);return _0x200368[_0x672e('0x5d')](_0x178ad3);}})[_0x672e('0x25')](function(_0x5c9666){if(_0x5c9666){_0x294b14=_0x5c9666[_0x672e('0x47')];if(!_0x452224[_0x672e('0x33')][_0x672e('0x38')](_0x672e('0x39'))){_0x178ad3[_0x672e('0x1d')]=qs[_0x672e('0x1d')](_0x452224[_0x672e('0x33')]['limit']);_0x178ad3['offset']=qs[_0x672e('0x1c')](_0x452224[_0x672e('0x33')][_0x672e('0x1c')]);}return _0x200368[_0x672e('0x5d')](_0x178ad3);}})[_0x672e('0x25')](function(_0x1a0282){if(_0x1a0282){return _0x1a0282?{'count':_0x294b14,'rows':_0x1a0282}:null;}})[_0x672e('0x25')](respondWithResult(_0x181b75,null))[_0x672e('0x44')](handleError(_0x181b75,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c6f331f..d3785dd 100644 --- a/server/api/trigger/trigger.model.js +++ b/server/api/trigger/trigger.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe953=['Trigger','tools_triggers','bluebird','request-promise','rimraf','./trigger.attributes','define'];(function(_0x294b6,_0x2907ae){var _0x38bb97=function(_0x5aaa76){while(--_0x5aaa76){_0x294b6['push'](_0x294b6['shift']());}};_0x38bb97(++_0x2907ae);}(_0xe953,0x1d0));var _0x3e95=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xe953[_0x270adf];return _0x29eda9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3e95('0x0'));var rp=require(_0x3e95('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e95('0x2'));var config=require('../../config/environment');var attributes=require(_0x3e95('0x3'));module['exports']=function(_0x30637c,_0x3faa2b){return _0x30637c[_0x3e95('0x4')](_0x3e95('0x5'),attributes,{'tableName':_0x3e95('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd0f=['bluebird','path','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','api','moment'];(function(_0x1f3280,_0xec6845){var _0x50770f=function(_0x3edb5b){while(--_0x3edb5b){_0x1f3280['push'](_0x1f3280['shift']());}};_0x50770f(++_0xec6845);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x25c0ea,_0x15986d){_0x25c0ea=_0x25c0ea-0x0;var _0xb4e5bd=_0xfd0f[_0x25c0ea];return _0xb4e5bd;};'use strict';var _=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var logger=require('../../config/logger')(_0xffd0('0x2'));var moment=require(_0xffd0('0x3'));var BPromise=require(_0xffd0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffd0('0x5'));var rimraf=require('rimraf');var config=require(_0xffd0('0x6'));var attributes=require(_0xffd0('0x7'));module[_0xffd0('0x8')]=function(_0x9e9c1f,_0xd7f075){return _0x9e9c1f[_0xffd0('0x9')](_0xffd0('0xa'),attributes,{'tableName':_0xffd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index ad4c58c..ef1dd84 100644 --- a/server/api/trigger/trigger.rpc.js +++ b/server/api/trigger/trigger.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad1a=['../../config/environment','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Trigger','findAll','options','where','limit','map','include','model','attributes','GetTrigger','ShowTrigger','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xad1a,0x1d4));var _0xaad1=function(_0x3f3fe8,_0x3faba3){_0x3f3fe8=_0x3f3fe8-0x0;var _0x1e9bbe=_0xad1a[_0x3f3fe8];return _0x1e9bbe;};'use strict';var _=require(_0xaad1('0x0'));var util=require(_0xaad1('0x1'));var moment=require(_0xaad1('0x2'));var BPromise=require(_0xaad1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaad1('0x4'));var db=require(_0xaad1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaad1('0x6'))(_0xaad1('0x7'));var config=require(_0xaad1('0x8'));var jayson=require(_0xaad1('0x9'));var client=jayson[_0xaad1('0xa')][_0xaad1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x90f167,_0x40a4b4,_0x4aafe8){return new BPromise(function(_0x2dd9b3,_0x2bd98b){return client['request'](_0x90f167,_0x4aafe8)['then'](function(_0x29388d){logger[_0xaad1('0xc')](_0xaad1('0xd'),_0x40a4b4,_0xaad1('0xe'));logger[_0xaad1('0xf')](_0xaad1('0x10'),_0x40a4b4,_0xaad1('0xe'),JSON[_0xaad1('0x11')](_0x29388d));if(_0x29388d[_0xaad1('0x12')]){if(_0x29388d[_0xaad1('0x12')]['code']===0x1f4){logger[_0xaad1('0x12')](_0xaad1('0xd'),_0x40a4b4,_0x29388d[_0xaad1('0x12')]['message']);return _0x2bd98b(_0x29388d['error'][_0xaad1('0x13')]);}logger[_0xaad1('0x12')](_0xaad1('0xd'),_0x40a4b4,_0x29388d['error'][_0xaad1('0x13')]);return _0x2dd9b3(_0x29388d[_0xaad1('0x12')][_0xaad1('0x13')]);}else{logger[_0xaad1('0xc')](_0xaad1('0xd'),_0x40a4b4,_0xaad1('0xe'));_0x2dd9b3(_0x29388d['result'][_0xaad1('0x13')]);}})[_0xaad1('0x14')](function(_0x1c70ae){logger[_0xaad1('0x12')](_0xaad1('0xd'),_0x40a4b4,_0x1c70ae);_0x2bd98b(_0x1c70ae);});});}exports['GetTrigger']=function(_0x8c36b6){var _0x1e8883=this;return new Promise(function(_0x114f24,_0x358f58){return db[_0xaad1('0x15')][_0xaad1('0x16')]({'raw':_0x8c36b6[_0xaad1('0x17')]?_0x8c36b6['options']['raw']===undefined?!![]:![]:!![],'where':_0x8c36b6[_0xaad1('0x17')]?_0x8c36b6[_0xaad1('0x17')][_0xaad1('0x18')]||null:null,'attributes':_0x8c36b6['options']?_0x8c36b6[_0xaad1('0x17')]['attributes']||null:null,'limit':_0x8c36b6[_0xaad1('0x17')]?_0x8c36b6[_0xaad1('0x17')][_0xaad1('0x19')]||null:null,'include':_0x8c36b6[_0xaad1('0x17')]?_0x8c36b6[_0xaad1('0x17')]['include']?_[_0xaad1('0x1a')](_0x8c36b6[_0xaad1('0x17')][_0xaad1('0x1b')],function(_0x2547ed){return{'model':db[_0x2547ed[_0xaad1('0x1c')]],'as':_0x2547ed['as'],'attributes':_0x2547ed[_0xaad1('0x1d')],'include':_0x2547ed['include']?_[_0xaad1('0x1a')](_0x2547ed[_0xaad1('0x1b')],function(_0x24b591){return{'model':db[_0x24b591[_0xaad1('0x1c')]],'as':_0x24b591['as'],'attributes':_0x24b591['attributes'],'include':_0x24b591[_0xaad1('0x1b')]?_[_0xaad1('0x1a')](_0x24b591[_0xaad1('0x1b')],function(_0x51b660){return{'model':db[_0x51b660['model']],'as':_0x51b660['as'],'attributes':_0x51b660[_0xaad1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31d4d9){logger[_0xaad1('0xc')](_0xaad1('0x1e'),_0x8c36b6);logger[_0xaad1('0xf')]('GetTrigger',_0x8c36b6,JSON[_0xaad1('0x11')](_0x31d4d9));_0x114f24(_0x31d4d9);})['catch'](function(_0x2c8529){logger[_0xaad1('0x12')](_0xaad1('0x1e'),_0x2c8529['message'],_0x8c36b6);_0x358f58(_0x1e8883[_0xaad1('0x12')](0x1f4,_0x2c8529[_0xaad1('0x13')]));});});};exports[_0xaad1('0x1f')]=function(_0x58e022){var _0x298131=this;return new Promise(function(_0x431802,_0x16db17){return db['Trigger']['find']({'raw':_0x58e022[_0xaad1('0x17')]?_0x58e022['options'][_0xaad1('0x20')]===undefined?!![]:![]:!![],'where':_0x58e022['options']?_0x58e022[_0xaad1('0x17')][_0xaad1('0x18')]||null:null,'attributes':_0x58e022[_0xaad1('0x17')]?_0x58e022[_0xaad1('0x17')]['attributes']||null:null,'include':_0x58e022['options']?_0x58e022[_0xaad1('0x17')][_0xaad1('0x1b')]?_['map'](_0x58e022[_0xaad1('0x17')]['include'],function(_0x296774){return{'model':db[_0x296774[_0xaad1('0x1c')]],'as':_0x296774['as'],'attributes':_0x296774['attributes'],'include':_0x296774[_0xaad1('0x1b')]?_[_0xaad1('0x1a')](_0x296774['include'],function(_0x3891ee){return{'model':db[_0x3891ee['model']],'as':_0x3891ee['as'],'attributes':_0x3891ee[_0xaad1('0x1d')],'include':_0x3891ee[_0xaad1('0x1b')]?_[_0xaad1('0x1a')](_0x3891ee['include'],function(_0x1c579a){return{'model':db[_0x1c579a[_0xaad1('0x1c')]],'as':_0x1c579a['as'],'attributes':_0x1c579a[_0xaad1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaad1('0x21')](function(_0xe5828f){logger[_0xaad1('0xc')](_0xaad1('0x1f'),_0x58e022);logger[_0xaad1('0xf')]('ShowTrigger',_0x58e022,JSON[_0xaad1('0x11')](_0xe5828f));_0x431802(_0xe5828f);})[_0xaad1('0x14')](function(_0x2a7a0b){logger[_0xaad1('0x12')](_0xaad1('0x1f'),_0x2a7a0b[_0xaad1('0x13')],_0x58e022);_0x16db17(_0x298131[_0xaad1('0x12')](0x1f4,_0x2a7a0b[_0xaad1('0x13')]));});});}; \ No newline at end of file +var _0xf739=['include','model','map','ShowTrigger','Trigger','raw','debug','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','catch','GetTrigger','options','where','attributes','limit'];(function(_0x4f9d94,_0x392b6d){var _0x1757bd=function(_0x4c1d5c){while(--_0x4c1d5c){_0x4f9d94['push'](_0x4f9d94['shift']());}};_0x1757bd(++_0x392b6d);}(_0xf739,0x147));var _0x9f73=function(_0x214547,_0x5041f1){_0x214547=_0x214547-0x0;var _0x59405a=_0xf739[_0x214547];return _0x59405a;};'use strict';var _=require(_0x9f73('0x0'));var util=require('util');var moment=require(_0x9f73('0x1'));var BPromise=require(_0x9f73('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f73('0x3'))['db'];var utils=require(_0x9f73('0x4'));var logger=require(_0x9f73('0x5'))(_0x9f73('0x6'));var config=require(_0x9f73('0x7'));var jayson=require(_0x9f73('0x8'));var client=jayson[_0x9f73('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eb8af,_0x2a373e,_0x4bcceb){return new BPromise(function(_0x3adc12,_0x4acb83){return client[_0x9f73('0xa')](_0x2eb8af,_0x4bcceb)[_0x9f73('0xb')](function(_0x5997a7){logger[_0x9f73('0xc')]('Trigger,\x20%s,\x20%s',_0x2a373e,_0x9f73('0xd'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x2a373e,_0x9f73('0xd'),JSON[_0x9f73('0xe')](_0x5997a7));if(_0x5997a7[_0x9f73('0xf')]){if(_0x5997a7[_0x9f73('0xf')][_0x9f73('0x10')]===0x1f4){logger[_0x9f73('0xf')](_0x9f73('0x11'),_0x2a373e,_0x5997a7[_0x9f73('0xf')][_0x9f73('0x12')]);return _0x4acb83(_0x5997a7['error'][_0x9f73('0x12')]);}logger['error'](_0x9f73('0x11'),_0x2a373e,_0x5997a7[_0x9f73('0xf')][_0x9f73('0x12')]);return _0x3adc12(_0x5997a7[_0x9f73('0xf')][_0x9f73('0x12')]);}else{logger[_0x9f73('0xc')]('Trigger,\x20%s,\x20%s',_0x2a373e,_0x9f73('0xd'));_0x3adc12(_0x5997a7['result'][_0x9f73('0x12')]);}})[_0x9f73('0x13')](function(_0x41d43b){logger['error'](_0x9f73('0x11'),_0x2a373e,_0x41d43b);_0x4acb83(_0x41d43b);});});}exports[_0x9f73('0x14')]=function(_0x5a967d){var _0x2323f3=this;return new Promise(function(_0x3aace8,_0x211ab6){return db['Trigger']['findAll']({'raw':_0x5a967d[_0x9f73('0x15')]?_0x5a967d[_0x9f73('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a967d['options']?_0x5a967d[_0x9f73('0x15')][_0x9f73('0x16')]||null:null,'attributes':_0x5a967d[_0x9f73('0x15')]?_0x5a967d['options'][_0x9f73('0x17')]||null:null,'limit':_0x5a967d[_0x9f73('0x15')]?_0x5a967d[_0x9f73('0x15')][_0x9f73('0x18')]||null:null,'include':_0x5a967d[_0x9f73('0x15')]?_0x5a967d[_0x9f73('0x15')][_0x9f73('0x19')]?_['map'](_0x5a967d[_0x9f73('0x15')][_0x9f73('0x19')],function(_0x1bd2c4){return{'model':db[_0x1bd2c4[_0x9f73('0x1a')]],'as':_0x1bd2c4['as'],'attributes':_0x1bd2c4[_0x9f73('0x17')],'include':_0x1bd2c4['include']?_['map'](_0x1bd2c4[_0x9f73('0x19')],function(_0x513c2d){return{'model':db[_0x513c2d['model']],'as':_0x513c2d['as'],'attributes':_0x513c2d['attributes'],'include':_0x513c2d[_0x9f73('0x19')]?_[_0x9f73('0x1b')](_0x513c2d[_0x9f73('0x19')],function(_0x5e4466){return{'model':db[_0x5e4466['model']],'as':_0x5e4466['as'],'attributes':_0x5e4466[_0x9f73('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9f73('0xb')](function(_0x1052f6){logger[_0x9f73('0xc')](_0x9f73('0x14'),_0x5a967d);logger['debug']('GetTrigger',_0x5a967d,JSON[_0x9f73('0xe')](_0x1052f6));_0x3aace8(_0x1052f6);})[_0x9f73('0x13')](function(_0x34b6a8){logger[_0x9f73('0xf')](_0x9f73('0x14'),_0x34b6a8[_0x9f73('0x12')],_0x5a967d);_0x211ab6(_0x2323f3[_0x9f73('0xf')](0x1f4,_0x34b6a8[_0x9f73('0x12')]));});});};exports[_0x9f73('0x1c')]=function(_0x471ea6){var _0x366515=this;return new Promise(function(_0x5f36ae,_0x16594a){return db[_0x9f73('0x1d')]['find']({'raw':_0x471ea6[_0x9f73('0x15')]?_0x471ea6[_0x9f73('0x15')][_0x9f73('0x1e')]===undefined?!![]:![]:!![],'where':_0x471ea6[_0x9f73('0x15')]?_0x471ea6[_0x9f73('0x15')]['where']||null:null,'attributes':_0x471ea6[_0x9f73('0x15')]?_0x471ea6[_0x9f73('0x15')]['attributes']||null:null,'include':_0x471ea6[_0x9f73('0x15')]?_0x471ea6[_0x9f73('0x15')][_0x9f73('0x19')]?_['map'](_0x471ea6['options'][_0x9f73('0x19')],function(_0x1450e2){return{'model':db[_0x1450e2['model']],'as':_0x1450e2['as'],'attributes':_0x1450e2[_0x9f73('0x17')],'include':_0x1450e2[_0x9f73('0x19')]?_[_0x9f73('0x1b')](_0x1450e2[_0x9f73('0x19')],function(_0x2b7b13){return{'model':db[_0x2b7b13[_0x9f73('0x1a')]],'as':_0x2b7b13['as'],'attributes':_0x2b7b13[_0x9f73('0x17')],'include':_0x2b7b13[_0x9f73('0x19')]?_[_0x9f73('0x1b')](_0x2b7b13[_0x9f73('0x19')],function(_0x5c3047){return{'model':db[_0x5c3047[_0x9f73('0x1a')]],'as':_0x5c3047['as'],'attributes':_0x5c3047[_0x9f73('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37bb18){logger[_0x9f73('0xc')](_0x9f73('0x1c'),_0x471ea6);logger[_0x9f73('0x1f')](_0x9f73('0x1c'),_0x471ea6,JSON[_0x9f73('0xe')](_0x37bb18));_0x5f36ae(_0x37bb18);})['catch'](function(_0x483654){logger[_0x9f73('0xf')]('ShowTrigger',_0x483654[_0x9f73('0x12')],_0x471ea6);_0x16594a(_0x366515[_0x9f73('0xf')](0x1f4,_0x483654['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 612a41d..bf3bdd8 100644 --- a/server/api/trunk/index.js +++ b/server/api/trunk/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e26=['isAuthenticated','/:id','show','post','/:id/clone','clone','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x4e26,0xce));var _0x64e2=function(_0x2268c4,_0x1fbc21){_0x2268c4=_0x2268c4-0x0;var _0xc7bf62=_0x4e26[_0x2268c4];return _0xc7bf62;};'use strict';var multer=require(_0x64e2('0x0'));var util=require('util');var path=require(_0x64e2('0x1'));var timeout=require(_0x64e2('0x2'));var express=require(_0x64e2('0x3'));var router=express['Router']();var fs_extra=require(_0x64e2('0x4'));var auth=require(_0x64e2('0x5'));var interaction=require(_0x64e2('0x6'));var config=require(_0x64e2('0x7'));var controller=require(_0x64e2('0x8'));router[_0x64e2('0x9')]('/',auth[_0x64e2('0xa')](),controller['index']);router[_0x64e2('0x9')](_0x64e2('0xb'),auth[_0x64e2('0xa')](),controller[_0x64e2('0xc')]);router[_0x64e2('0xd')](_0x64e2('0xe'),auth[_0x64e2('0xa')](),controller[_0x64e2('0xf')]);router[_0x64e2('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x64e2('0xb'),auth[_0x64e2('0xa')](),controller[_0x64e2('0x10')]);router['delete'](_0x64e2('0xb'),auth[_0x64e2('0xa')](),controller['destroy']);module[_0x64e2('0x11')]=router; \ No newline at end of file +var _0xf664=['post','/:id/clone','clone','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','get','/:id','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf664,0x197));var _0x4f66=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0xf664[_0x5e8eae];return _0xdd09cd;};'use strict';var multer=require(_0x4f66('0x0'));var util=require(_0x4f66('0x1'));var path=require(_0x4f66('0x2'));var timeout=require(_0x4f66('0x3'));var express=require(_0x4f66('0x4'));var router=express['Router']();var fs_extra=require(_0x4f66('0x5'));var auth=require(_0x4f66('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f66('0x7'));var controller=require(_0x4f66('0x8'));router['get']('/',auth[_0x4f66('0x9')](),controller['index']);router[_0x4f66('0xa')](_0x4f66('0xb'),auth[_0x4f66('0x9')](),controller[_0x4f66('0xc')]);router[_0x4f66('0xd')](_0x4f66('0xe'),auth[_0x4f66('0x9')](),controller[_0x4f66('0xf')]);router[_0x4f66('0xd')]('/',auth[_0x4f66('0x9')](),controller[_0x4f66('0x10')]);router[_0x4f66('0x11')](_0x4f66('0xb'),auth[_0x4f66('0x9')](),controller['update']);router[_0x4f66('0x12')](_0x4f66('0xb'),auth[_0x4f66('0x9')](),controller[_0x4f66('0x13')]);module[_0x4f66('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 90b4b37..ee4f4da 100644 --- a/server/api/trunk/trunk.attributes.js +++ b/server/api/trunk/trunk.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa74=['INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','actpass','dynamic','BOOLEAN','exports','STRING','ENUM','friend','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>'];(function(_0x25aacb,_0x503c2b){var _0x4d64b4=function(_0x48f426){while(--_0x48f426){_0x25aacb['push'](_0x25aacb['shift']());}};_0x4d64b4(++_0x503c2b);}(_0xfa74,0x1c6));var _0x4fa7=function(_0x8b7d35,_0x2b94ee){_0x8b7d35=_0x8b7d35-0x0;var _0x3f2f86=_0xfa74[_0x8b7d35];return _0x3f2f86;};'use strict';var Sequelize=require('sequelize');module[_0x4fa7('0x0')]={'name':{'type':Sequelize[_0x4fa7('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x3'),'user',_0x4fa7('0x4')),'allowNull':![],'defaultValue':_0x4fa7('0x3')},'context':{'type':Sequelize[_0x4fa7('0x1')],'allowNull':![],'defaultValue':_0x4fa7('0x5')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x4fa7('0x6'),'ALLOWED_FAILED_SCREEN',_0x4fa7('0x7'),'PROHIB_NOT_SCREENED',_0x4fa7('0x8'),_0x4fa7('0x9'),'PROHIB')},'deny':{'type':Sequelize[_0x4fa7('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x4fa7('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x4fa7('0x1')]},'transport':{'type':Sequelize[_0x4fa7('0x1')],'defaultValue':_0x4fa7('0xa'),'set':function(_0x5b8e24){this[_0x4fa7('0xb')]('transport',_0x5b8e24?_0x5b8e24[_0x4fa7('0xc')](','):null);},'get':function(){return this[_0x4fa7('0xd')](_0x4fa7('0xe'))?this['getDataValue'](_0x4fa7('0xe'))['split'](','):null;},'comment':_0x4fa7('0xf')},'dtmfmode':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x10'),_0x4fa7('0x11'),_0x4fa7('0x12'),_0x4fa7('0x13'),'auto'),'defaultValue':_0x4fa7('0x10')},'directmedia':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no','nonat',_0x4fa7('0x15'),_0x4fa7('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4fa7('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x4fa7('0x1')],'defaultValue':_0x4fa7('0x17'),'set':function(_0x312c56){this[_0x4fa7('0xb')]('nat',_0x312c56?_0x312c56[_0x4fa7('0xc')](','):null);},'get':function(){return this[_0x4fa7('0xd')](_0x4fa7('0x18'))?this['getDataValue'](_0x4fa7('0x18'))[_0x4fa7('0x19')](','):null;},'comment':_0x4fa7('0x1a')},'callgroup':{'type':Sequelize[_0x4fa7('0x1')]},'namedcallgroup':{'type':Sequelize[_0x4fa7('0x1')]},'pickupgroup':{'type':Sequelize[_0x4fa7('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x4fa7('0x1')]},'language':{'type':Sequelize[_0x4fa7('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4fa7('0x1')],'defaultValue':_0x4fa7('0x1b')},'allow':{'type':Sequelize[_0x4fa7('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x44c58d){this['setDataValue'](_0x4fa7('0x1c'),_0x44c58d?_0x44c58d[_0x4fa7('0xc')](';'):_0x4fa7('0x1d'));},'get':function(){return this[_0x4fa7('0xd')](_0x4fa7('0x1c'))?this[_0x4fa7('0xd')](_0x4fa7('0x1c'))[_0x4fa7('0x19')](';'):null;},'comment':_0x4fa7('0x1e')},'autoframing':{'type':Sequelize[_0x4fa7('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0x4fa7('0x1')],'defaultValue':_0x4fa7('0x1f'),'set':function(_0x32d2af){this[_0x4fa7('0xb')]('insecure',_0x32d2af?_0x32d2af[_0x4fa7('0xc')](','):null);},'get':function(){return this['getDataValue'](_0x4fa7('0x20'))?this[_0x4fa7('0xd')](_0x4fa7('0x20'))['split'](','):null;},'comment':_0x4fa7('0x21')},'trustrpid':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no',_0x4fa7('0x22'))},'promiscredir':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x4fa7('0x2')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x4fa7('0x1')]},'callerid':{'type':Sequelize[_0x4fa7('0x1')],'defaultValue':_0x4fa7('0x23')},'amaflags':{'type':Sequelize[_0x4fa7('0x1')]},'callcounter':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no'),'defaultValue':_0x4fa7('0x14')},'busylevel':{'type':Sequelize[_0x4fa7('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x4fa7('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x4fa7('0x1')]},'template':{'type':Sequelize[_0x4fa7('0x1')]},'videosupport':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no',_0x4fa7('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4fa7('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4fa7('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0x4fa7('0x1')]},'session_timers':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x26'),_0x4fa7('0x27'),_0x4fa7('0x28'))},'session_expires':{'type':Sequelize[_0x4fa7('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x29'),_0x4fa7('0x2a')),'defaultValue':_0x4fa7('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x4fa7('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x4fa7('0x1')]},'port':{'type':Sequelize[_0x4fa7('0x24')](0x5)},'qualify':{'type':Sequelize[_0x4fa7('0x2')]('yes','no'),'defaultValue':_0x4fa7('0x14')},'keepalive':{'type':Sequelize[_0x4fa7('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x4fa7('0x1')]},'defaultuser':{'type':Sequelize[_0x4fa7('0x1')]},'rtptimeout':{'type':Sequelize[_0x4fa7('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4fa7('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x4fa7('0x14'),'no',_0x4fa7('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4fa7('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x4fa7('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x4fa7('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x4fa7('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x4fa7('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x4fa7('0x1')]},'use_q850_reason':{'type':Sequelize[_0x4fa7('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4fa7('0x2')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x4fa7('0x14'),'no')},'icesupport':{'type':Sequelize[_0x4fa7('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no',_0x4fa7('0x2c'),_0x4fa7('0x2d'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x4fa7('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x4fa7('0x1')]},'dtlscipher':{'type':Sequelize[_0x4fa7('0x1')]},'dtlscafile':{'type':Sequelize[_0x4fa7('0x1')]},'dtlscapath':{'type':Sequelize[_0x4fa7('0x1')]},'dtlssetup':{'type':Sequelize[_0x4fa7('0x2')]('active','passive',_0x4fa7('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4fa7('0x1')]},'recordofffeature':{'type':Sequelize[_0x4fa7('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x4fa7('0x2')](_0x4fa7('0x14'),'no')},'vmexten':{'type':Sequelize[_0x4fa7('0x1')]},'mohinterpret':{'type':Sequelize[_0x4fa7('0x1')]},'mohsuggest':{'type':Sequelize[_0x4fa7('0x1')]},'parkinglot':{'type':Sequelize[_0x4fa7('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x4fa7('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x4fa7('0x14'),'no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4fa7('0x1')]},'otherFields':{'type':Sequelize[_0x4fa7('0x1')]},'active':{'type':Sequelize[_0x4fa7('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4fa7('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x8426=['join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','INTEGER','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','ENUM','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport'];(function(_0x470c1c,_0x35f9e7){var _0x2aee1b=function(_0x5702ab){while(--_0x5702ab){_0x470c1c['push'](_0x470c1c['shift']());}};_0x2aee1b(++_0x35f9e7);}(_0x8426,0x1d2));var _0x6842=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x8426[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require('sequelize');module[_0x6842('0x0')]={'name':{'type':Sequelize[_0x6842('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6842('0x2')]('friend',_0x6842('0x3'),'peer'),'allowNull':![],'defaultValue':_0x6842('0x4')},'context':{'type':Sequelize[_0x6842('0x1')],'allowNull':![],'defaultValue':_0x6842('0x5')},'callingpres':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x6'),_0x6842('0x7'),_0x6842('0x8'),'ALLOWED','PROHIB_NOT_SCREENED',_0x6842('0x9'),_0x6842('0xa'),'PROHIB')},'deny':{'type':Sequelize[_0x6842('0x1')]},'permit':{'type':Sequelize[_0x6842('0x1')]},'secret':{'type':Sequelize[_0x6842('0x1')]},'md5secret':{'type':Sequelize[_0x6842('0x1')]},'remotesecret':{'type':Sequelize[_0x6842('0x1')]},'transport':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0xb'),'set':function(_0xbed057){this[_0x6842('0xc')](_0x6842('0xd'),_0xbed057?_0xbed057[_0x6842('0xe')](','):null);},'get':function(){return this[_0x6842('0xf')](_0x6842('0xd'))?this[_0x6842('0xf')]('transport')[_0x6842('0x10')](','):null;},'comment':_0x6842('0x11')},'dtmfmode':{'type':Sequelize[_0x6842('0x2')]('rfc2833',_0x6842('0x12'),'shortinfo',_0x6842('0x13'),'auto'),'defaultValue':_0x6842('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no',_0x6842('0x16'),_0x6842('0x17'),_0x6842('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6842('0x1')]},'directmediadeny':{'type':Sequelize[_0x6842('0x1')]},'nat':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x19'),'set':function(_0x14e6ca){this[_0x6842('0xc')](_0x6842('0x1a'),_0x14e6ca?_0x14e6ca[_0x6842('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x6842('0x1a'))?this[_0x6842('0xf')]('nat')[_0x6842('0x10')](','):null;},'comment':_0x6842('0x1b')},'callgroup':{'type':Sequelize[_0x6842('0x1')]},'namedcallgroup':{'type':Sequelize[_0x6842('0x1')]},'pickupgroup':{'type':Sequelize[_0x6842('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6842('0x1')]},'language':{'type':Sequelize[_0x6842('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6842('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6842('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x6842('0x1')],'allowNull':![],'defaultValue':_0x6842('0x1c'),'set':function(_0x88856a){this[_0x6842('0xc')](_0x6842('0x1d'),_0x88856a?_0x88856a['join'](';'):_0x6842('0x1c'));},'get':function(){return this[_0x6842('0xf')](_0x6842('0x1d'))?this['getDataValue']('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x6842('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x1e'),'set':function(_0x33a612){this['setDataValue'](_0x6842('0x1f'),_0x33a612?_0x33a612[_0x6842('0xe')](','):null);},'get':function(){return this[_0x6842('0xf')](_0x6842('0x1f'))?this['getDataValue'](_0x6842('0x1f'))[_0x6842('0x10')](','):null;},'comment':_0x6842('0x20')},'trustrpid':{'type':Sequelize[_0x6842('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no',_0x6842('0x21'))},'promiscredir':{'type':Sequelize[_0x6842('0x2')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x6842('0x1')]},'callerid':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x22')},'amaflags':{'type':Sequelize[_0x6842('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no'),'defaultValue':_0x6842('0x15')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x6842('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no',_0x6842('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6842('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x6842('0x2')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x6842('0x2')]('accept','refuse',_0x6842('0x25'))},'session_expires':{'type':Sequelize[_0x6842('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x26'),_0x6842('0x27')),'defaultValue':_0x6842('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x6842('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x6842('0x1')]},'fromuser':{'type':Sequelize[_0x6842('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no'),'defaultValue':_0x6842('0x15')},'keepalive':{'type':Sequelize[_0x6842('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x6842('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x6842('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6842('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x6842('0x2')]('yes','no',_0x6842('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6842('0x1')]},'callbackextension':{'type':Sequelize[_0x6842('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x6842('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x6842('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x6842('0x1')]},'contactdeny':{'type':Sequelize[_0x6842('0x1')]},'contactacl':{'type':Sequelize[_0x6842('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x6842('0x1')]},'use_q850_reason':{'type':Sequelize[_0x6842('0x1')]},'maxforwards':{'type':Sequelize[_0x6842('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'force_avp':{'type':Sequelize[_0x6842('0x2')]('yes','no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no',_0x6842('0x29'),_0x6842('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x6842('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x6842('0x1')]},'dtlscipher':{'type':Sequelize[_0x6842('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x6842('0x1')]},'dtlssetup':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x2b'),'passive',_0x6842('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6842('0x1')]},'recordofffeature':{'type':Sequelize[_0x6842('0x1')]},'call_limit':{'type':Sequelize[_0x6842('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'vmexten':{'type':Sequelize[_0x6842('0x1')]},'mohinterpret':{'type':Sequelize[_0x6842('0x1')]},'mohsuggest':{'type':Sequelize[_0x6842('0x1')]},'parkinglot':{'type':Sequelize[_0x6842('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x2d')},'canreinvite':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no',_0x6842('0x16'),_0x6842('0x17'),_0x6842('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x6842('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6842('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index ab9facc..10a6d00 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['clone','includeAll','merge','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','Trunk','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','options','include','rows','show','params','find'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23999f,_0x2bbe7a,_0x4cc004,_0x58f5ad){return new BPromise(function(_0x2b4e94,_0x2233dd){var _0x24b5bb=_0x58f5ad||client;return _0x24b5bb[_0x7995('0x1e')](_0x23999f,_0x4cc004)[_0x7995('0x1f')](function(_0x1a5310){logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,'request\x20sent');logger[_0x7995('0x22')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2bbe7a,_0x7995('0x23'),JSON[_0x7995('0x24')](_0x1a5310));if(_0x1a5310[_0x7995('0x25')]){if(_0x1a5310[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')]('Trunk,\x20%s,\x20%s',_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2233dd(_0x1a5310['error']['message']);}logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2b4e94(_0x1a5310['error']['message']);}else{logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,_0x7995('0x23'));_0x2b4e94(_0x1a5310[_0x7995('0x28')][_0x7995('0x27')]);}})[_0x7995('0x29')](function(_0x5d40ae){logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x5d40ae);_0x2233dd(_0x5d40ae);});});}function respondWithStatusCode(_0x204507,_0x285437){_0x285437=_0x285437||0xcc;return function(_0x563799){if(_0x563799){return _0x204507[_0x7995('0x2a')](_0x285437);}return _0x204507[_0x7995('0x2b')](_0x285437)[_0x7995('0x2c')]();};}function respondWithResult(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x59405a[_0x7995('0x2b')](_0x39df42)[_0x7995('0x2d')](_0x34e70c);}};}function respondWithFilteredResult(_0x3a3fcf,_0x2a307e){return function(_0x56691a){if(_0x56691a){var _0x47625f=typeof _0x2a307e['offset']===_0x7995('0x2e')&&typeof _0x2a307e[_0x7995('0x2f')]===_0x7995('0x2e');var _0x132a42=_0x56691a[_0x7995('0x30')];var _0x4b6f99=_0x47625f?0x0:_0x2a307e[_0x7995('0x31')];var _0x514445=_0x47625f?_0x56691a[_0x7995('0x30')]:_0x2a307e[_0x7995('0x31')]+_0x2a307e[_0x7995('0x2f')];var _0x574574;if(_0x514445>=_0x132a42){_0x514445=_0x132a42;_0x574574=0xc8;}else{_0x574574=0xce;}_0x3a3fcf['status'](_0x574574);return _0x3a3fcf['set'](_0x7995('0x32'),_0x4b6f99+'-'+_0x514445+'/'+_0x132a42)[_0x7995('0x2d')](_0x56691a);}return null;};}function patchUpdates(_0x327a81){return function(_0x2b874d){try{jsonpatch[_0x7995('0x33')](_0x2b874d,_0x327a81,!![]);}catch(_0x1ca460){return BPromise['reject'](_0x1ca460);}return _0x2b874d['save']();};}function saveUpdates(_0xfa8f15,_0x5524af){return function(_0x553671){if(_0x553671){return _0x553671[_0x7995('0x34')](_0xfa8f15)[_0x7995('0x1f')](function(_0x1e9fa4){return _0x1e9fa4;});}return null;};}function removeEntity(_0x1f7d27,_0x510841){return function(_0x44309d){if(_0x44309d){return _0x44309d[_0x7995('0x35')]()['then'](function(){var _0x48db25=_0x44309d['get']({'plain':!![]});var _0x45bc5e=_0x7995('0x36');return db['UserProfileResource'][_0x7995('0x35')]({'where':{'type':_0x45bc5e,'resourceId':_0x48db25['id']}})['then'](function(){return _0x44309d;});})[_0x7995('0x1f')](function(){_0x1f7d27[_0x7995('0x2b')](0xcc)[_0x7995('0x2c')]();});}};}function handleEntityNotFound(_0x5014d2,_0x52d76d){return function(_0x36d057){if(!_0x36d057){_0x5014d2['sendStatus'](0x194);}return _0x36d057;};}function handleError(_0x5d2428,_0x3e99cd){_0x3e99cd=_0x3e99cd||0x1f4;return function(_0xe328b1){logger['error'](_0xe328b1[_0x7995('0x37')]);if(_0xe328b1[_0x7995('0x38')]){delete _0xe328b1[_0x7995('0x38')];}_0x5d2428[_0x7995('0x2b')](_0x3e99cd)[_0x7995('0x39')](_0xe328b1);};}exports['index']=function(_0x2d4285,_0x242713){var _0xf612e6={},_0x1d60b8={},_0x4b1541={'count':0x0,'rows':[]};var _0x2be2c0=_[_0x7995('0x3a')](db[_0x7995('0x3b')][_0x7995('0x3c')],function(_0x1f5bee){return{'name':_0x1f5bee[_0x7995('0x3d')],'type':_0x1f5bee['type'][_0x7995('0x3e')]};});_0x1d60b8[_0x7995('0x3f')]=_[_0x7995('0x3a')](_0x2be2c0,_0x7995('0x38'));_0x1d60b8[_0x7995('0x40')]=_[_0x7995('0x41')](_0x2d4285[_0x7995('0x40')]);_0x1d60b8[_0x7995('0x42')]=_[_0x7995('0x43')](_0x1d60b8[_0x7995('0x3f')],_0x1d60b8[_0x7995('0x40')]);_0xf612e6[_0x7995('0x44')]=_[_0x7995('0x43')](_0x1d60b8['model'],qs['fields'](_0x2d4285[_0x7995('0x40')][_0x7995('0x45')]));_0xf612e6['attributes']=_0xf612e6['attributes'][_0x7995('0x46')]?_0xf612e6['attributes']:_0x1d60b8['model'];if(!_0x2d4285[_0x7995('0x40')][_0x7995('0x47')](_0x7995('0x48'))){_0xf612e6['limit']=qs[_0x7995('0x2f')](_0x2d4285['query'][_0x7995('0x2f')]);_0xf612e6['offset']=qs['offset'](_0x2d4285[_0x7995('0x40')][_0x7995('0x31')]);}_0xf612e6[_0x7995('0x49')]=qs[_0x7995('0x4a')](_0x2d4285['query'][_0x7995('0x4a')]);_0xf612e6[_0x7995('0x4b')]=qs[_0x7995('0x42')](_[_0x7995('0x4c')](_0x2d4285['query'],_0x1d60b8['filters']),_0x2be2c0);if(_0x2d4285[_0x7995('0x40')]['filter']){_0xf612e6[_0x7995('0x4b')]=_['merge'](_0xf612e6[_0x7995('0x4b')],{'$or':_['map'](_0x2be2c0,function(_0x1e795e){if(_0x1e795e[_0x7995('0x4d')]!=='VIRTUAL'){var _0x3e9e62={};_0x3e9e62[_0x1e795e[_0x7995('0x38')]]={'$like':'%'+_0x2d4285[_0x7995('0x40')][_0x7995('0x4e')]+'%'};return _0x3e9e62;}})});}_0xf612e6=_['merge']({},_0xf612e6,_0x2d4285[_0x7995('0x4f')]);var _0x3e787d={'where':_0xf612e6[_0x7995('0x4b')]};return db['Trunk'][_0x7995('0x30')](_0x3e787d)[_0x7995('0x1f')](function(_0x511567){_0x4b1541[_0x7995('0x30')]=_0x511567;if(_0x2d4285[_0x7995('0x40')]['includeAll']){_0xf612e6[_0x7995('0x50')]=[{'all':!![]}];}return db[_0x7995('0x3b')]['findAll'](_0xf612e6);})[_0x7995('0x1f')](function(_0x5843ba){_0x4b1541[_0x7995('0x51')]=_0x5843ba;return _0x4b1541;})[_0x7995('0x1f')](respondWithFilteredResult(_0x242713,_0xf612e6))[_0x7995('0x29')](handleError(_0x242713,null));};exports[_0x7995('0x52')]=function(_0xddf537,_0x14b537){var _0x1579b9={'raw':![],'where':{'id':_0xddf537[_0x7995('0x53')]['id']}},_0x4d46bc={};_0x4d46bc[_0x7995('0x3f')]=_[_0x7995('0x41')](db['Trunk'][_0x7995('0x3c')]);_0x4d46bc[_0x7995('0x40')]=_[_0x7995('0x41')](_0xddf537['query']);_0x4d46bc['filters']=_['intersection'](_0x4d46bc[_0x7995('0x3f')],_0x4d46bc[_0x7995('0x40')]);_0x1579b9['attributes']=_[_0x7995('0x43')](_0x4d46bc[_0x7995('0x3f')],qs[_0x7995('0x45')](_0xddf537[_0x7995('0x40')][_0x7995('0x45')]));_0x1579b9['attributes']=_0x1579b9[_0x7995('0x44')]['length']?_0x1579b9[_0x7995('0x44')]:_0x4d46bc[_0x7995('0x3f')];if(_0xddf537[_0x7995('0x40')]['includeAll']){_0x1579b9['include']=[{'all':!![]}];}_0x1579b9=_['merge']({},_0x1579b9,_0xddf537['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x1579b9)[_0x7995('0x1f')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x1f')](respondWithResult(_0x14b537,null))[_0x7995('0x29')](handleError(_0x14b537,null));};exports[_0x7995('0x55')]=function(_0x1f4270,_0xda6ce8){var _0x328671={'where':{'id':_0x1f4270[_0x7995('0x53')]['id']}},_0x17ecd3={};_0x17ecd3[_0x7995('0x3f')]=_[_0x7995('0x41')](db[_0x7995('0x3b')][_0x7995('0x3c')]);_0x328671[_0x7995('0x44')]=_[_0x7995('0x43')](_0x17ecd3[_0x7995('0x3f')],qs[_0x7995('0x45')](_0x1f4270['query'][_0x7995('0x45')]));_0x328671[_0x7995('0x44')]=_0x328671[_0x7995('0x44')][_0x7995('0x46')]?_0x328671['attributes']:_0x17ecd3['model'];if(_0x1f4270[_0x7995('0x40')][_0x7995('0x56')]){_0x328671[_0x7995('0x50')]=[{'all':!![]}];}_0x328671=_[_0x7995('0x57')]({},_0x328671,_0x1f4270['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x328671)[_0x7995('0x1f')](handleEntityNotFound(_0xda6ce8,null))[_0x7995('0x1f')](function(_0x502d43){if(_0x502d43){var _0x5e2d97=_0x502d43[_0x7995('0x58')]({'plain':!![]});_0x5e2d97=qs[_0x7995('0x59')](_0x5e2d97,['id',_0x7995('0x5a'),_0x7995('0x5b')]);_0x1f4270[_0x7995('0x5c')]=_[_0x7995('0x59')](_0x1f4270[_0x7995('0x5c')],['id',_0x7995('0x5a'),_0x7995('0x5b')]);return db['Trunk'][_0x7995('0x5d')](_[_0x7995('0x57')](_0x5e2d97,_0x1f4270[_0x7995('0x5c')]),{'include':_0x1f4270[_0x7995('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3053fd){var _0xebb5c8=_0x1f4270['user'][_0x7995('0x58')]({'plain':!![]});if(!_0xebb5c8)throw new Error(_0x7995('0x5e'));if(_0xebb5c8[_0x7995('0x5f')]===_0x7995('0x60')){var _0x32cb04=_0x3053fd['get']({'plain':!![]});var _0x457d09='Trunks';return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':_0x457d09,'userProfileId':_0xebb5c8[_0x7995('0x62')]},'raw':!![]})[_0x7995('0x1f')](function(_0x4388c1){if(_0x4388c1&&_0x4388c1[_0x7995('0x63')]===0x0){return db[_0x7995('0x64')][_0x7995('0x5d')]({'name':_0x32cb04[_0x7995('0x38')],'resourceId':_0x32cb04['id'],'type':_0x4388c1[_0x7995('0x38')],'sectionId':_0x4388c1['id']},{})[_0x7995('0x1f')](function(){return _0x3053fd;});}else{return _0x3053fd;}})[_0x7995('0x29')](function(_0x56eb85){logger[_0x7995('0x25')](_0x7995('0x65'),_0x56eb85);throw _0x56eb85;});}return _0x3053fd;});}})[_0x7995('0x1f')](respondWithResult(_0xda6ce8,0xc9))[_0x7995('0x29')](handleError(_0xda6ce8,null));};exports[_0x7995('0x5d')]=function(_0x54a2e0,_0x4b54f2,_0x268fde){var _0x87e38d;return db[_0x7995('0x3b')][_0x7995('0x5d')](_0x54a2e0['body'],{'raw':!![]})[_0x7995('0x1f')](function(_0x50a12e){_0x87e38d=_0x50a12e;return db['Trunk'][_0x7995('0x66')]({'raw':!![]});})[_0x7995('0x1f')](function(_0x3f0a71){var _0x44bf2b=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x2466df=fs['readFileSync'](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6c')),'utf8');var _0x1fe1cb=ejs[_0x7995('0x6d')](_0x44bf2b,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x1fe1cb);if(_0x87e38d[_0x7995('0x70')]){var _0x51ab1e=ejs[_0x7995('0x6d')](_0x2466df,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x51ab1e);}})[_0x7995('0x1f')](function(){return respondWithRpcPromise(_0x7995('0x72'),'create',{'module':'chan_sip.so'});})[_0x7995('0x1f')](function(){var _0xfe1105=_0x54a2e0[_0x7995('0x60')][_0x7995('0x58')]({'plain':!![]});if(!_0xfe1105)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfe1105[_0x7995('0x5f')]===_0x7995('0x60')){var _0x54b955=_0x87e38d['get']({'plain':!![]});return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':'Trunks','userProfileId':_0xfe1105[_0x7995('0x62')]},'raw':!![]})['then'](function(_0x3758f9){if(_0x3758f9&&_0x3758f9[_0x7995('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x54b955[_0x7995('0x38')],'resourceId':_0x54b955['id'],'type':_0x3758f9['name'],'sectionId':_0x3758f9['id']},{})[_0x7995('0x1f')](function(){return _0x87e38d;});}else{return _0x87e38d;}})[_0x7995('0x29')](function(_0x3dd197){logger[_0x7995('0x25')](_0x7995('0x65'),_0x3dd197);throw _0x3dd197;});}return _0x87e38d;})[_0x7995('0x1f')](respondWithResult(_0x4b54f2,0xc9))[_0x7995('0x29')](handleError(_0x4b54f2,null));};exports[_0x7995('0x34')]=function(_0x29e0ee,_0x117317,_0x1ab590){var _0x16108c;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x29e0ee[_0x7995('0x53')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x117317,null))[_0x7995('0x1f')](saveUpdates(_0x29e0ee[_0x7995('0x5c')],null))[_0x7995('0x1f')](function(_0xa2fc8e){if(_0xa2fc8e){_0x16108c=_0xa2fc8e;return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});}})[_0x7995('0x1f')](function(_0x280fbb){if(_0x280fbb){var _0x260ef1=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/trunk.ejs'),_0x7995('0x6b'));var _0x10f4ca=fs['readFileSync'](path['join'](config[_0x7995('0x69')],_0x7995('0x6c')),_0x7995('0x6b'));var _0x38acda=ejs[_0x7995('0x6d')](_0x260ef1,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x38acda);var _0x2f8a2d=ejs[_0x7995('0x6d')](_0x10f4ca,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x2f8a2d);return respondWithRpcPromise(_0x7995('0x72'),_0x7995('0x34'),{'module':_0x7995('0x73')});}return null;})[_0x7995('0x1f')](function(_0x560095){if(_0x560095){return _0x16108c;}})[_0x7995('0x1f')](respondWithResult(_0x117317,null))[_0x7995('0x29')](handleError(_0x117317,null));};exports['destroy']=function(_0x479271,_0xd24c64,_0xf8c2ed){var _0x18e1a2;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x479271['params']['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0xd24c64,null))[_0x7995('0x1f')](removeEntity(_0xd24c64,null))['then'](function(){return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});})['then'](function(_0x1535a3){var _0x4a5bc5=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x5d16da=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/registry.ejs'),_0x7995('0x6b'));var _0x3f3434=ejs[_0x7995('0x6d')](_0x4a5bc5,{'trunks':_0x1535a3});var _0x308a26=ejs['render'](_0x5d16da,{'trunks':_0x1535a3});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x3f3434);fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_registers.conf',_0x308a26);return respondWithRpcPromise('Reload',_0x7995('0x35'),{'module':_0x7995('0x73')});})['catch'](handleError(_0xd24c64,null));}; \ No newline at end of file +var _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x312484,_0x2605e6){var _0x5035e8=function(_0x5b4330){while(--_0x5b4330){_0x312484['push'](_0x312484['shift']());}};_0x5035e8(++_0x2605e6);}(_0xb821,0xa7));var _0x1b82=function(_0x35e29d,_0x4ae9bb){_0x35e29d=_0x35e29d-0x0;var _0x364f06=_0xb821[_0x35e29d];return _0x364f06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 26e4e36..7b38b66 100644 --- a/server/api/trunk/trunk.model.js +++ b/server/api/trunk/trunk.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa37e=['bluebird','path','exports','define','tools_trunks','util','../../config/logger','api'];(function(_0x3b3699,_0x2d90b7){var _0x33c7cb=function(_0x5e389a){while(--_0x5e389a){_0x3b3699['push'](_0x3b3699['shift']());}};_0x33c7cb(++_0x2d90b7);}(_0xa37e,0xe5));var _0xea37=function(_0x58902e,_0x44d612){_0x58902e=_0x58902e-0x0;var _0xb4fe02=_0xa37e[_0x58902e];return _0xb4fe02;};'use strict';var _=require('lodash');var util=require(_0xea37('0x0'));var logger=require(_0xea37('0x1'))(_0xea37('0x2'));var moment=require('moment');var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0xea37('0x5')]=function(_0x127629,_0x184b3a){return _0x127629[_0xea37('0x6')]('Trunk',attributes,{'tableName':_0xea37('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ffe=['lodash','../../config/logger','api','request-promise','path','rimraf','./trunk.attributes','exports','define','tools_trunks'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ffe,0x96));var _0xe8ff=function(_0x487ba5,_0x2297c0){_0x487ba5=_0x487ba5-0x0;var _0x472624=_0x8ffe[_0x487ba5];return _0x472624;};'use strict';var _=require(_0xe8ff('0x0'));var util=require('util');var logger=require(_0xe8ff('0x1'))(_0xe8ff('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe8ff('0x3'));var fs=require('fs');var path=require(_0xe8ff('0x4'));var rimraf=require(_0xe8ff('0x5'));var config=require('../../config/environment');var attributes=require(_0xe8ff('0x6'));module[_0xe8ff('0x7')]=function(_0x42a201,_0xde2ca5){return _0x42a201[_0xe8ff('0x8')]('Trunk',attributes,{'tableName':_0xe8ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 8e2668c..8bf0c05 100644 --- a/server/api/trunk/trunk.rpc.js +++ b/server/api/trunk/trunk.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x463e=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','lodash','util','moment','bluebird','ioredis'];(function(_0x4ed1ba,_0x437960){var _0x2cc328=function(_0x17b6b3){while(--_0x17b6b3){_0x4ed1ba['push'](_0x4ed1ba['shift']());}};_0x2cc328(++_0x437960);}(_0x463e,0x87));var _0xe463=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x463e[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xe463('0x0'));var util=require(_0xe463('0x1'));var moment=require(_0xe463('0x2'));var BPromise=require(_0xe463('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe463('0x4'));var db=require(_0xe463('0x5'))['db'];var utils=require(_0xe463('0x6'));var logger=require('../../config/logger')(_0xe463('0x7'));var config=require(_0xe463('0x8'));var jayson=require(_0xe463('0x9'));var client=jayson[_0xe463('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d0e87,_0x59a8ea,_0x38461a){return new BPromise(function(_0x3b9651,_0x287e06){return client[_0xe463('0xb')](_0x2d0e87,_0x38461a)[_0xe463('0xc')](function(_0x41c283){logger[_0xe463('0xd')](_0xe463('0xe'),_0x59a8ea,_0xe463('0xf'));logger[_0xe463('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x59a8ea,_0xe463('0xf'),JSON[_0xe463('0x11')](_0x41c283));if(_0x41c283[_0xe463('0x12')]){if(_0x41c283[_0xe463('0x12')][_0xe463('0x13')]===0x1f4){logger['error'](_0xe463('0xe'),_0x59a8ea,_0x41c283[_0xe463('0x12')][_0xe463('0x14')]);return _0x287e06(_0x41c283[_0xe463('0x12')][_0xe463('0x14')]);}logger['error'](_0xe463('0xe'),_0x59a8ea,_0x41c283['error'][_0xe463('0x14')]);return _0x3b9651(_0x41c283[_0xe463('0x12')][_0xe463('0x14')]);}else{logger[_0xe463('0xd')]('Trunk,\x20%s,\x20%s',_0x59a8ea,_0xe463('0xf'));_0x3b9651(_0x41c283['result'][_0xe463('0x14')]);}})[_0xe463('0x15')](function(_0x5db973){logger[_0xe463('0x12')](_0xe463('0xe'),_0x59a8ea,_0x5db973);_0x287e06(_0x5db973);});});}exports[_0xe463('0x16')]=function(_0x9461a4){var _0xb37220=this;return new Promise(function(_0x5a557d,_0x3cfcd9){return db[_0xe463('0x17')][_0xe463('0x18')]({'raw':_0x9461a4[_0xe463('0x19')]?_0x9461a4[_0xe463('0x19')][_0xe463('0x1a')]===undefined?!![]:![]:!![],'where':_0x9461a4[_0xe463('0x19')]?_0x9461a4['options'][_0xe463('0x1b')]||null:null,'attributes':_0x9461a4[_0xe463('0x19')]?_0x9461a4[_0xe463('0x19')][_0xe463('0x1c')]||null:null,'limit':_0x9461a4[_0xe463('0x19')]?_0x9461a4[_0xe463('0x19')][_0xe463('0x1d')]||null:null,'include':_0x9461a4[_0xe463('0x19')]?_0x9461a4['options'][_0xe463('0x1e')]?_[_0xe463('0x1f')](_0x9461a4[_0xe463('0x19')][_0xe463('0x1e')],function(_0x36a307){return{'model':db[_0x36a307[_0xe463('0x20')]],'as':_0x36a307['as'],'attributes':_0x36a307[_0xe463('0x1c')],'include':_0x36a307['include']?_[_0xe463('0x1f')](_0x36a307[_0xe463('0x1e')],function(_0x38097e){return{'model':db[_0x38097e['model']],'as':_0x38097e['as'],'attributes':_0x38097e[_0xe463('0x1c')],'include':_0x38097e[_0xe463('0x1e')]?_[_0xe463('0x1f')](_0x38097e['include'],function(_0x4d8f4d){return{'model':db[_0x4d8f4d[_0xe463('0x20')]],'as':_0x4d8f4d['as'],'attributes':_0x4d8f4d['attributes']};}):[]};}):[]};}):[]:[]})[_0xe463('0xc')](function(_0x3848cf){logger[_0xe463('0xd')](_0xe463('0x16'),_0x9461a4);logger['debug'](_0xe463('0x16'),_0x9461a4,JSON['stringify'](_0x3848cf));_0x5a557d(_0x3848cf);})[_0xe463('0x15')](function(_0x297c73){logger[_0xe463('0x12')](_0xe463('0x16'),_0x297c73[_0xe463('0x14')],_0x9461a4);_0x3cfcd9(_0xb37220[_0xe463('0x12')](0x1f4,_0x297c73[_0xe463('0x14')]));});});};exports[_0xe463('0x21')]=function(_0x19ebd7){var _0x1d0419=this;return new Promise(function(_0x5be655,_0x301950){return db[_0xe463('0x17')][_0xe463('0x22')]({'raw':_0x19ebd7[_0xe463('0x19')]?_0x19ebd7[_0xe463('0x19')][_0xe463('0x1a')]===undefined?!![]:![]:!![],'where':_0x19ebd7[_0xe463('0x19')]?_0x19ebd7[_0xe463('0x19')][_0xe463('0x1b')]||null:null,'attributes':_0x19ebd7['options']?_0x19ebd7[_0xe463('0x19')]['attributes']||null:null,'include':_0x19ebd7[_0xe463('0x19')]?_0x19ebd7[_0xe463('0x19')]['include']?_[_0xe463('0x1f')](_0x19ebd7[_0xe463('0x19')]['include'],function(_0x3b73ed){return{'model':db[_0x3b73ed['model']],'as':_0x3b73ed['as'],'attributes':_0x3b73ed['attributes'],'include':_0x3b73ed['include']?_[_0xe463('0x1f')](_0x3b73ed[_0xe463('0x1e')],function(_0xf283ed){return{'model':db[_0xf283ed[_0xe463('0x20')]],'as':_0xf283ed['as'],'attributes':_0xf283ed[_0xe463('0x1c')],'include':_0xf283ed[_0xe463('0x1e')]?_[_0xe463('0x1f')](_0xf283ed[_0xe463('0x1e')],function(_0x1762aa){return{'model':db[_0x1762aa['model']],'as':_0x1762aa['as'],'attributes':_0x1762aa[_0xe463('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe463('0xc')](function(_0x326952){logger[_0xe463('0xd')](_0xe463('0x21'),_0x19ebd7);logger[_0xe463('0x10')](_0xe463('0x21'),_0x19ebd7,JSON['stringify'](_0x326952));_0x5be655(_0x326952);})[_0xe463('0x15')](function(_0xf78324){logger[_0xe463('0x12')](_0xe463('0x21'),_0xf78324[_0xe463('0x14')],_0x19ebd7);_0x301950(_0x1d0419[_0xe463('0x12')](0x1f4,_0xf78324['message']));});});}; \ No newline at end of file +var _0x8546=['message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','find','ShowTrunk','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x8546,0xf7));var _0x6854=function(_0x484324,_0x650c9d){_0x484324=_0x484324-0x0;var _0x4aa095=_0x8546[_0x484324];return _0x4aa095;};'use strict';var _=require(_0x6854('0x0'));var util=require(_0x6854('0x1'));var moment=require('moment');var BPromise=require(_0x6854('0x2'));var rs=require(_0x6854('0x3'));var fs=require('fs');var Redis=require(_0x6854('0x4'));var db=require(_0x6854('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6854('0x6'));var client=jayson[_0x6854('0x7')][_0x6854('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x379f40,_0x140683,_0x422a38){return new BPromise(function(_0x379925,_0x380959){return client[_0x6854('0x9')](_0x379f40,_0x422a38)[_0x6854('0xa')](function(_0xae46d){logger['info'](_0x6854('0xb'),_0x140683,_0x6854('0xc'));logger[_0x6854('0xd')](_0x6854('0xe'),_0x140683,_0x6854('0xc'),JSON['stringify'](_0xae46d));if(_0xae46d[_0x6854('0xf')]){if(_0xae46d['error'][_0x6854('0x10')]===0x1f4){logger[_0x6854('0xf')]('Trunk,\x20%s,\x20%s',_0x140683,_0xae46d[_0x6854('0xf')]['message']);return _0x380959(_0xae46d['error'][_0x6854('0x11')]);}logger['error'](_0x6854('0xb'),_0x140683,_0xae46d['error']['message']);return _0x379925(_0xae46d[_0x6854('0xf')][_0x6854('0x11')]);}else{logger[_0x6854('0x12')](_0x6854('0xb'),_0x140683,_0x6854('0xc'));_0x379925(_0xae46d[_0x6854('0x13')][_0x6854('0x11')]);}})[_0x6854('0x14')](function(_0xb0aae7){logger[_0x6854('0xf')]('Trunk,\x20%s,\x20%s',_0x140683,_0xb0aae7);_0x380959(_0xb0aae7);});});}exports[_0x6854('0x15')]=function(_0x27ffb3){var _0x534309=this;return new Promise(function(_0x1fcb1f,_0x4a6796){return db[_0x6854('0x16')][_0x6854('0x17')]({'raw':_0x27ffb3[_0x6854('0x18')]?_0x27ffb3[_0x6854('0x18')][_0x6854('0x19')]===undefined?!![]:![]:!![],'where':_0x27ffb3['options']?_0x27ffb3['options'][_0x6854('0x1a')]||null:null,'attributes':_0x27ffb3[_0x6854('0x18')]?_0x27ffb3['options'][_0x6854('0x1b')]||null:null,'limit':_0x27ffb3[_0x6854('0x18')]?_0x27ffb3[_0x6854('0x18')]['limit']||null:null,'include':_0x27ffb3[_0x6854('0x18')]?_0x27ffb3['options'][_0x6854('0x1c')]?_[_0x6854('0x1d')](_0x27ffb3[_0x6854('0x18')]['include'],function(_0x5d8bc7){return{'model':db[_0x5d8bc7[_0x6854('0x1e')]],'as':_0x5d8bc7['as'],'attributes':_0x5d8bc7['attributes'],'include':_0x5d8bc7[_0x6854('0x1c')]?_[_0x6854('0x1d')](_0x5d8bc7[_0x6854('0x1c')],function(_0x36ea8e){return{'model':db[_0x36ea8e[_0x6854('0x1e')]],'as':_0x36ea8e['as'],'attributes':_0x36ea8e[_0x6854('0x1b')],'include':_0x36ea8e[_0x6854('0x1c')]?_['map'](_0x36ea8e[_0x6854('0x1c')],function(_0x491da1){return{'model':db[_0x491da1[_0x6854('0x1e')]],'as':_0x491da1['as'],'attributes':_0x491da1[_0x6854('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x468cd5){logger[_0x6854('0x12')](_0x6854('0x15'),_0x27ffb3);logger[_0x6854('0xd')](_0x6854('0x15'),_0x27ffb3,JSON['stringify'](_0x468cd5));_0x1fcb1f(_0x468cd5);})['catch'](function(_0x1af854){logger[_0x6854('0xf')](_0x6854('0x15'),_0x1af854[_0x6854('0x11')],_0x27ffb3);_0x4a6796(_0x534309[_0x6854('0xf')](0x1f4,_0x1af854[_0x6854('0x11')]));});});};exports['ShowTrunk']=function(_0x5859bb){var _0x277cb1=this;return new Promise(function(_0x8437f0,_0x5c8d07){return db['Trunk'][_0x6854('0x1f')]({'raw':_0x5859bb[_0x6854('0x18')]?_0x5859bb[_0x6854('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5859bb[_0x6854('0x18')]?_0x5859bb[_0x6854('0x18')][_0x6854('0x1a')]||null:null,'attributes':_0x5859bb[_0x6854('0x18')]?_0x5859bb[_0x6854('0x18')][_0x6854('0x1b')]||null:null,'include':_0x5859bb[_0x6854('0x18')]?_0x5859bb['options'][_0x6854('0x1c')]?_[_0x6854('0x1d')](_0x5859bb['options'][_0x6854('0x1c')],function(_0x513ab0){return{'model':db[_0x513ab0['model']],'as':_0x513ab0['as'],'attributes':_0x513ab0[_0x6854('0x1b')],'include':_0x513ab0[_0x6854('0x1c')]?_[_0x6854('0x1d')](_0x513ab0['include'],function(_0x3419f3){return{'model':db[_0x3419f3['model']],'as':_0x3419f3['as'],'attributes':_0x3419f3['attributes'],'include':_0x3419f3[_0x6854('0x1c')]?_[_0x6854('0x1d')](_0x3419f3[_0x6854('0x1c')],function(_0x1a5e67){return{'model':db[_0x1a5e67['model']],'as':_0x1a5e67['as'],'attributes':_0x1a5e67[_0x6854('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19a88f){logger['info'](_0x6854('0x20'),_0x5859bb);logger[_0x6854('0xd')](_0x6854('0x20'),_0x5859bb,JSON['stringify'](_0x19a88f));_0x8437f0(_0x19a88f);})['catch'](function(_0x5c4ded){logger[_0x6854('0xf')](_0x6854('0x20'),_0x5c4ded[_0x6854('0x11')],_0x5859bb);_0x5c8d07(_0x277cb1[_0x6854('0xf')](0x1f4,_0x5c4ded['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 9f7bd34..43bdf66 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64bc=['express','Router','../../components/auth/service','put','/:id','isAuthenticated','update','exports'];(function(_0x406459,_0x2a5eae){var _0x6895c3=function(_0x52bbf7){while(--_0x52bbf7){_0x406459['push'](_0x406459['shift']());}};_0x6895c3(++_0x2a5eae);}(_0x64bc,0x98));var _0xc64b=function(_0x262830,_0x157d9f){_0x262830=_0x262830-0x0;var _0x4a5d6b=_0x64bc[_0x262830];return _0x4a5d6b;};'use strict';var express=require(_0xc64b('0x0'));var router=express[_0xc64b('0x1')]();var auth=require(_0xc64b('0x2'));var controller=require('./user-setting.controller');router[_0xc64b('0x3')](_0xc64b('0x4'),auth[_0xc64b('0x5')](),controller[_0xc64b('0x6')]);module[_0xc64b('0x7')]=router; \ No newline at end of file +var _0x9f7e=['exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x3a63c4,_0x9fab5e){var _0x1dc75a=function(_0x15dedc){while(--_0x15dedc){_0x3a63c4['push'](_0x3a63c4['shift']());}};_0x1dc75a(++_0x9fab5e);}(_0x9f7e,0x79));var _0xe9f7=function(_0x37d799,_0x339c0d){_0x37d799=_0x37d799-0x0;var _0x1d353e=_0x9f7e[_0x37d799];return _0x1d353e;};'use strict';var express=require(_0xe9f7('0x0'));var router=express[_0xe9f7('0x1')]();var auth=require(_0xe9f7('0x2'));var controller=require(_0xe9f7('0x3'));router[_0xe9f7('0x4')](_0xe9f7('0x5'),auth[_0xe9f7('0x6')](),controller['update']);module[_0xe9f7('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 57bb3de..5385fe7 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7115=['INTEGER','UserId','sequelize','error','warning','debug','exports','ENUM','BOOLEAN','DATE'];(function(_0xf01579,_0x914885){var _0x146774=function(_0x57ebfc){while(--_0x57ebfc){_0xf01579['push'](_0xf01579['shift']());}};_0x146774(++_0x914885);}(_0x7115,0x160));var _0x5711=function(_0x1a9bc2,_0x5c2e82){_0x1a9bc2=_0x1a9bc2-0x0;var _0x387349=_0x7115[_0x1a9bc2];return _0x387349;};'use strict';var Sequelize=require(_0x5711('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x5711('0x1'),_0x5711('0x2'),'info',_0x5711('0x3')];module[_0x5711('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x5711('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x5711('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x5711('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x5711('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x5711('0x8')],'unique':_0x5711('0x9')}}; \ No newline at end of file +var _0x6911=['info','ENUM','TEXT','DATE','UserId','error'];(function(_0x146961,_0x9b5d75){var _0x17e6d0=function(_0x33ad43){while(--_0x33ad43){_0x146961['push'](_0x146961['shift']());}};_0x17e6d0(++_0x9b5d75);}(_0x6911,0xc5));var _0x1691=function(_0x18cd54,_0x182047){_0x18cd54=_0x18cd54-0x0;var _0x14207f=_0x6911[_0x18cd54];return _0x14207f;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x1691('0x0'),'warning',_0x1691('0x1'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x1691('0x2')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x1691('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x1691('0x3')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x1691('0x4')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x1691('0x5')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 7172ab4..9c9ade8 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe13a=['api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','ioredis','../../config/logger'];(function(_0x23676d,_0x30dce5){var _0x159d82=function(_0x1551bf){while(--_0x1551bf){_0x23676d['push'](_0x23676d['shift']());}};_0x159d82(++_0x30dce5);}(_0xe13a,0x178));var _0xae13=function(_0x493801,_0x966ae0){_0x493801=_0x493801-0x0;var _0x2fd1fa=_0xe13a[_0x493801];return _0x2fd1fa;};'use strict';var _=require('lodash');var Redis=require(_0xae13('0x0'));var logger=require(_0xae13('0x1'))(_0xae13('0x2'));var config=require(_0xae13('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xae13('0x4'))(new Redis(config[_0xae13('0x5')]));require(_0xae13('0x6'))[_0xae13('0x7')](socket);config[_0xae13('0x5')]=_[_0xae13('0x8')](config[_0xae13('0x5')],{'host':_0xae13('0x9'),'port':0x18eb});function respondWithResult(_0x341ba4,_0x4ae51f){_0x4ae51f=_0x4ae51f||0xc8;return function(_0x2f6d10){if(_0x2f6d10){return _0x341ba4[_0xae13('0xa')](_0x4ae51f)[_0xae13('0xb')](_0x2f6d10);}};}function saveUpdates(_0x2a793f){return function(_0x22027e){if(_0x22027e){return _0x22027e[_0xae13('0xc')](_0x2a793f)[_0xae13('0xd')](function(_0x2d1149){return _0x2d1149;});}return null;};}function handleEntityNotFound(_0x1f3451){return function(_0x5990e3){if(!_0x5990e3){_0x1f3451[_0xae13('0xe')](0x194);}return _0x5990e3;};}function handleError(_0x83de98,_0x3d6a85){_0x3d6a85=_0x3d6a85||0x1f4;return function(_0x3a6d41){logger[_0xae13('0xf')](_0x3a6d41[_0xae13('0x10')]);if(_0x3a6d41[_0xae13('0x11')]){delete _0x3a6d41['name'];}_0x83de98[_0xae13('0xa')](_0x3d6a85)[_0xae13('0x12')](_0x3a6d41);};}exports['update']=function(_0x589803,_0x506411){if(_0x589803['user']['role']!==_0xae13('0x13'))throw new Error(_0xae13('0x14'));if(isNaN(Number(_0x589803[_0xae13('0x15')]['id'])))throw new Error(_0xae13('0x16'));return db[_0xae13('0x17')][_0xae13('0x18')]({'where':{'id':_0x589803['params']['id']}})[_0xae13('0xd')](handleEntityNotFound(_0x506411,null))['then'](saveUpdates(_0x589803[_0xae13('0x19')],null))[_0xae13('0xd')](respondWithResult(_0x506411,null))[_0xae13('0x1a')](handleError(_0x506411,null));}; \ No newline at end of file +var _0x8e63=['Invalid\x20user\x20setting\x20id','find','body','catch','ioredis','../../config/environment','../../mysqldb','socket.io-emitter','register','redis','defaults','localhost','update','then','sendStatus','error','stack','name','status','user','role','admin','Unauthorized','params'];(function(_0x2caaef,_0x3c19ed){var _0xd011f8=function(_0x318656){while(--_0x318656){_0x2caaef['push'](_0x2caaef['shift']());}};_0xd011f8(++_0x3c19ed);}(_0x8e63,0x7c));var _0x38e6=function(_0x1bd33f,_0x29f836){_0x1bd33f=_0x1bd33f-0x0;var _0x33aee0=_0x8e63[_0x1bd33f];return _0x33aee0;};'use strict';var _=require('lodash');var Redis=require(_0x38e6('0x0'));var logger=require('../../config/logger')('api');var config=require(_0x38e6('0x1'));var db=require(_0x38e6('0x2'))['db'];var socket=require(_0x38e6('0x3'))(new Redis(config['redis']));require('./user-setting.socket')[_0x38e6('0x4')](socket);config[_0x38e6('0x5')]=_[_0x38e6('0x6')](config['redis'],{'host':_0x38e6('0x7'),'port':0x18eb});function respondWithResult(_0x19e7be,_0x9dd996){_0x9dd996=_0x9dd996||0xc8;return function(_0x315953){if(_0x315953){return _0x19e7be['status'](_0x9dd996)['json'](_0x315953);}};}function saveUpdates(_0x61cee2){return function(_0x1ea04f){if(_0x1ea04f){return _0x1ea04f[_0x38e6('0x8')](_0x61cee2)[_0x38e6('0x9')](function(_0x438258){return _0x438258;});}return null;};}function handleEntityNotFound(_0x58ccc2){return function(_0x563697){if(!_0x563697){_0x58ccc2[_0x38e6('0xa')](0x194);}return _0x563697;};}function handleError(_0x4c5e34,_0x36019a){_0x36019a=_0x36019a||0x1f4;return function(_0x4a97e3){logger[_0x38e6('0xb')](_0x4a97e3[_0x38e6('0xc')]);if(_0x4a97e3[_0x38e6('0xd')]){delete _0x4a97e3[_0x38e6('0xd')];}_0x4c5e34[_0x38e6('0xe')](_0x36019a)['send'](_0x4a97e3);};}exports[_0x38e6('0x8')]=function(_0x1059ab,_0x575b0b){if(_0x1059ab[_0x38e6('0xf')][_0x38e6('0x10')]!==_0x38e6('0x11'))throw new Error(_0x38e6('0x12'));if(isNaN(Number(_0x1059ab[_0x38e6('0x13')]['id'])))throw new Error(_0x38e6('0x14'));return db['UserSetting'][_0x38e6('0x15')]({'where':{'id':_0x1059ab[_0x38e6('0x13')]['id']}})[_0x38e6('0x9')](handleEntityNotFound(_0x575b0b,null))[_0x38e6('0x9')](saveUpdates(_0x1059ab[_0x38e6('0x16')],null))['then'](respondWithResult(_0x575b0b,null))[_0x38e6('0x17')](handleError(_0x575b0b,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 51e50ba..ec22a4a 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x115e=['save','update','remove','emit','hook','events','../../mysqldb','setMaxListeners'];(function(_0x4668a6,_0x4e8a1f){var _0x23215d=function(_0x4f4cfc){while(--_0x4f4cfc){_0x4668a6['push'](_0x4668a6['shift']());}};_0x23215d(++_0x4e8a1f);}(_0x115e,0x1ad));var _0xe115=function(_0x4ea5bf,_0x323a9a){_0x4ea5bf=_0x4ea5bf-0x0;var _0x14efb1=_0x115e[_0x4ea5bf];return _0x14efb1;};'use strict';var EventEmitter=require(_0xe115('0x0'));var UserSetting=require(_0xe115('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xe115('0x2')](0x0);var events={'afterCreate':_0xe115('0x3'),'afterUpdate':_0xe115('0x4'),'afterDestroy':_0xe115('0x5')};function emitEvent(_0x321713){return function(_0x1b3b6e,_0x467c51,_0x1e6f23){UserSettingEvents[_0xe115('0x6')](_0x321713+':'+_0x1b3b6e['id'],_0x1b3b6e);UserSettingEvents[_0xe115('0x6')](_0x321713,_0x1b3b6e);_0x1e6f23(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xe115('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xa4e4=['events','UserSetting','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x599c94,_0x464f0e){var _0x34e215=function(_0x36295a){while(--_0x36295a){_0x599c94['push'](_0x599c94['shift']());}};_0x34e215(++_0x464f0e);}(_0xa4e4,0x1d8));var _0x4a4e=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xa4e4[_0x126fb9];return _0xc8a3b1;};'use strict';var EventEmitter=require(_0x4a4e('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x4a4e('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4a4e('0x2')](0x0);var events={'afterCreate':_0x4a4e('0x3'),'afterUpdate':_0x4a4e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x298cfa){return function(_0x343613,_0x21d44f,_0x4174ee){UserSettingEvents[_0x4a4e('0x5')](_0x298cfa+':'+_0x343613['id'],_0x343613);UserSettingEvents[_0x4a4e('0x5')](_0x298cfa,_0x343613);_0x4174ee(null);};}for(var e in events){if(events[_0x4a4e('0x6')](e)){var event=events[e];UserSetting[_0x4a4e('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index d42d07d..2739604 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34b7=['clientSideLoggingEnabledSince','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x55bc37,_0x5b921f){var _0x212565=function(_0x5574d3){while(--_0x5574d3){_0x55bc37['push'](_0x55bc37['shift']());}};_0x212565(++_0x5b921f);}(_0x34b7,0x196));var _0x734b=function(_0x406ae7,_0x12181b){_0x406ae7=_0x406ae7-0x0;var _0x5a5b9d=_0x34b7[_0x406ae7];return _0x5a5b9d;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x43a5f1){return _0x43a5f1[_0x734b('0x0')](_0x734b('0x1'),attributes,{'tableName':_0x734b('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa2ff85){if(!_0xa2ff85[_0x734b('0x3')])_0xa2ff85['clientSideLoggingEnabledSince']=null;else if(_0xa2ff85['clientSideLoggingEnabledSince']===null)_0xa2ff85[_0x734b('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x06ef=['clientSideLoggingEnabledSince','clientSideLoggingEnabled'];(function(_0x2b698c,_0x5bbdd5){var _0x535317=function(_0x2e76c0){while(--_0x2e76c0){_0x2b698c['push'](_0x2b698c['shift']());}};_0x535317(++_0x5bbdd5);}(_0x06ef,0x185));var _0xf06e=function(_0x48a411,_0x544e48){_0x48a411=_0x48a411-0x0;var _0x4c7681=_0x06ef[_0x48a411];return _0x4c7681;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x44397a){return _0x44397a['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57d08f){if(!_0x57d08f[_0xf06e('0x0')])_0x57d08f[_0xf06e('0x1')]=null;else if(_0x57d08f[_0xf06e('0x1')]===null)_0x57d08f['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index a5dd359..a5b3bfd 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f53=['user-setting:update','UserId','register','user-setting:','./user-setting.events','remove','update','emit'];(function(_0x26ef45,_0xe8ca61){var _0x45d365=function(_0x5e242a){while(--_0x5e242a){_0x26ef45['push'](_0x26ef45['shift']());}};_0x45d365(++_0xe8ca61);}(_0x6f53,0x1e4));var _0x36f5=function(_0xcf029f,_0x369baa){_0xcf029f=_0xcf029f-0x0;var _0x3eb138=_0x6f53[_0xcf029f];return _0x3eb138;};'use strict';var UserSettingEvents=require(_0x36f5('0x0'));var events=['save',_0x36f5('0x1'),_0x36f5('0x2')];function createListener(_0x41c8a7,_0x55ba02){return function(_0x241700){_0x55ba02[_0x36f5('0x3')](_0x41c8a7,_0x241700);if(_0x41c8a7===_0x36f5('0x4')){_0x55ba02[_0x36f5('0x3')]('user-setting:update:user-'+_0x241700[_0x36f5('0x5')],_0x241700);}};}exports[_0x36f5('0x6')]=function(_0x5ab13d){for(var _0x13c990=0x0,_0x835552=events['length'];_0x13c990<_0x835552;_0x13c990++){var _0x581fef=events[_0x13c990];var _0x209892=createListener(_0x36f5('0x7')+_0x581fef,_0x5ab13d);UserSettingEvents['on'](_0x581fef,_0x209892);}}; \ No newline at end of file +var _0x6539=['user-setting:update','user-setting:update:user-','length','./user-setting.events','save','update','emit'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x6539,0xc7));var _0x9653=function(_0x599b8a,_0x2d9bad){_0x599b8a=_0x599b8a-0x0;var _0x533936=_0x6539[_0x599b8a];return _0x533936;};'use strict';var UserSettingEvents=require(_0x9653('0x0'));var events=[_0x9653('0x1'),'remove',_0x9653('0x2')];function createListener(_0x571a8f,_0x14e112){return function(_0x15a32e){_0x14e112[_0x9653('0x3')](_0x571a8f,_0x15a32e);if(_0x571a8f===_0x9653('0x4')){_0x14e112[_0x9653('0x3')](_0x9653('0x5')+_0x15a32e['UserId'],_0x15a32e);}};}exports['register']=function(_0x5a42e2){for(var _0x3c17a0=0x0,_0x48ed85=events[_0x9653('0x6')];_0x3c17a0<_0x48ed85;_0x3c17a0++){var _0x5bb540=events[_0x3c17a0];var _0x2378cf=createListener('user-setting:'+_0x5bb540,_0x5a42e2);UserSettingEvents['on'](_0x5bb540,_0x2378cf);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index bdf93bf..14cecea 100644 --- a/server/api/user/index.js +++ b/server/api/user/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ca6=['diskStorage','join','format','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','destroy','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate'];(function(_0x245888,_0xe33631){var _0x39f50c=function(_0x50d270){while(--_0x50d270){_0x245888['push'](_0x245888['shift']());}};_0x39f50c(++_0xe33631);}(_0x9ca6,0x111));var _0x69ca=function(_0xf537a8,_0x3f713a){_0xf537a8=_0xf537a8-0x0;var _0x5d9cc4=_0x9ca6[_0xf537a8];return _0x5d9cc4;};'use strict';var multer=require(_0x69ca('0x0'));var util=require(_0x69ca('0x1'));var path=require('path');var timeout=require(_0x69ca('0x2'));var express=require(_0x69ca('0x3'));var router=express[_0x69ca('0x4')]();var fs_extra=require(_0x69ca('0x5'));var auth=require(_0x69ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x69ca('0x7'));var controller=require('./user.controller');router[_0x69ca('0x8')]('/',auth[_0x69ca('0x9')](),controller[_0x69ca('0xa')]);router['get'](_0x69ca('0xb'),auth[_0x69ca('0x9')](),controller['describe']);router[_0x69ca('0x8')](_0x69ca('0xc'),auth[_0x69ca('0x9')](),controller['whoami']);router['get'](_0x69ca('0xd'),auth[_0x69ca('0x9')](),controller[_0x69ca('0xe')]);router['get'](_0x69ca('0xf'),auth[_0x69ca('0x9')](),controller['show']);router[_0x69ca('0x8')](_0x69ca('0x10'),controller[_0x69ca('0x11')]);router[_0x69ca('0x8')](_0x69ca('0x12'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x13')]);router['get'](_0x69ca('0x14'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x15')]);router['get'](_0x69ca('0x16'),auth['isAuthenticated'](),controller[_0x69ca('0x17')]);router[_0x69ca('0x8')](_0x69ca('0x18'),auth['isAuthenticated'](),controller[_0x69ca('0x19')]);router[_0x69ca('0x8')](_0x69ca('0x1a'),auth[_0x69ca('0x9')](),controller['getGroups']);router[_0x69ca('0x8')](_0x69ca('0x1b'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x1c')]);router[_0x69ca('0x8')](_0x69ca('0x1d'),auth['isAuthenticated'](),controller[_0x69ca('0x1e')]);router['get'](_0x69ca('0x1f'),auth['isAuthenticated'](),controller[_0x69ca('0x20')]);router[_0x69ca('0x8')](_0x69ca('0x21'),auth['isAuthenticated'](),controller[_0x69ca('0x22')]);router[_0x69ca('0x8')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x69ca('0x23')]);router[_0x69ca('0x8')](_0x69ca('0x24'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x69ca('0x8')](_0x69ca('0x25'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x69ca('0x8')](_0x69ca('0x26'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x27')]);router[_0x69ca('0x8')](_0x69ca('0x28'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x29')]);router[_0x69ca('0x8')](_0x69ca('0x2a'),auth[_0x69ca('0x9')](),controller['getLists']);router[_0x69ca('0x8')]('/:id/agents',auth[_0x69ca('0x9')](),controller[_0x69ca('0x2b')]);router['get'](_0x69ca('0x2c'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x2d')]);router[_0x69ca('0x8')](_0x69ca('0x2e'),auth['isAuthenticated'](),controller[_0x69ca('0x2f')]);router['get'](_0x69ca('0x30'),auth[_0x69ca('0x9')](),controller['getMailAccounts']);router[_0x69ca('0x8')](_0x69ca('0x31'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x32')]);router[_0x69ca('0x8')]('/:id/sms_accounts',auth[_0x69ca('0x9')](),controller[_0x69ca('0x33')]);router[_0x69ca('0x8')]('/:id/chat_websites',auth[_0x69ca('0x9')](),controller[_0x69ca('0x34')]);router['get'](_0x69ca('0x35'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x36')]);router[_0x69ca('0x8')]('/:id/square_projects',auth[_0x69ca('0x9')](),controller[_0x69ca('0x37')]);router['get'](_0x69ca('0x38'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0x69ca('0x8')](_0x69ca('0x39'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x3a')]);router[_0x69ca('0x3b')](_0x69ca('0x14'),auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth['isAuthenticated'](),controller[_0x69ca('0x3c')]);router[_0x69ca('0x3b')](_0x69ca('0x3d'),auth['isAuthenticated'](),controller[_0x69ca('0x3e')]);router['post']('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x69ca('0x3f')]({'destination':function(_0x9dff34,_0x2419b9,_0x158b45){_0x158b45(null,path[_0x69ca('0x40')](config['root'],'server/files/images/'));},'filename':function(_0x202521,_0x1bae24,_0x2a91d4){_0x2a91d4(null,util[_0x69ca('0x41')]('%s-%s',Date[_0x69ca('0x42')](),_0x1bae24[_0x69ca('0x43')]));}})});router[_0x69ca('0x3b')](_0x69ca('0x10'),upload[_0x69ca('0x44')](_0x69ca('0x45')),controller['addAvatar']);router[_0x69ca('0x3b')](_0x69ca('0x46'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x47')]);router['post'](_0x69ca('0x48'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x49')]);router[_0x69ca('0x3b')]('/:id/pause',auth['isAuthenticated'](),controller['pause']);router['post'](_0x69ca('0x4a'),auth[_0x69ca('0x9')](),controller['unpause']);router[_0x69ca('0x3b')](_0x69ca('0x28'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x4b')]);router['post'](_0x69ca('0x4c'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x4d')]);router[_0x69ca('0x3b')]('/:id/mail_interactions',auth[_0x69ca('0x9')](),controller['addMailInteractions']);router['post'](_0x69ca('0x4e'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x4f')]);router[_0x69ca('0x3b')](_0x69ca('0x50'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x69ca('0x3b')]('/:id/openchannel_interactions',auth[_0x69ca('0x9')](),controller[_0x69ca('0x51')]);router[_0x69ca('0x3b')](_0x69ca('0x52'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x53')]);router[_0x69ca('0x3b')](_0x69ca('0x2e'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x54')]);router[_0x69ca('0x3b')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x69ca('0x55')]);router['post']('/:id/openchannel_accounts',auth[_0x69ca('0x9')](),controller[_0x69ca('0x56')]);router[_0x69ca('0x3b')](_0x69ca('0x57'),auth[_0x69ca('0x9')](),controller['addSmsAccounts']);router[_0x69ca('0x3b')](_0x69ca('0x58'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x59')]);router['post']('/:id/whatsapp_accounts',auth[_0x69ca('0x9')](),controller[_0x69ca('0x5a')]);router[_0x69ca('0x3b')](_0x69ca('0x5b'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x5c')]);router[_0x69ca('0x3b')]('/:id/api_key',auth[_0x69ca('0x9')](),controller[_0x69ca('0x5d')]);router[_0x69ca('0x5e')](_0x69ca('0xf'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x5f')]);router[_0x69ca('0x5e')](_0x69ca('0x60'),auth['isAuthenticated'](),controller[_0x69ca('0x61')]);router['delete'](_0x69ca('0x16'),auth[_0x69ca('0x9')](),controller['removeQueues']);router[_0x69ca('0x62')]('/:id/teams',auth[_0x69ca('0x9')](),controller['removeTeams']);router[_0x69ca('0x62')]('/:id',auth['isAuthenticated'](),controller[_0x69ca('0x63')]);router[_0x69ca('0x62')](_0x69ca('0x4c'),auth[_0x69ca('0x9')](),controller['removeChatInteractions']);router[_0x69ca('0x62')](_0x69ca('0x64'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x65')]);router[_0x69ca('0x62')]('/:id/fax_interactions',auth[_0x69ca('0x9')](),controller[_0x69ca('0x66')]);router['delete'](_0x69ca('0x50'),auth[_0x69ca('0x9')](),controller['removeSmsInteractions']);router[_0x69ca('0x62')]('/:id/openchannel_interactions',auth[_0x69ca('0x9')](),controller[_0x69ca('0x67')]);router[_0x69ca('0x62')](_0x69ca('0x52'),auth['isAuthenticated'](),controller[_0x69ca('0x68')]);router[_0x69ca('0x62')]('/:id/fax_accounts',auth[_0x69ca('0x9')](),controller[_0x69ca('0x69')]);router[_0x69ca('0x62')](_0x69ca('0x30'),auth['isAuthenticated'](),controller[_0x69ca('0x6a')]);router[_0x69ca('0x62')](_0x69ca('0x31'),auth[_0x69ca('0x9')](),controller[_0x69ca('0x6b')]);router['delete'](_0x69ca('0x57'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router['delete'](_0x69ca('0x58'),auth['isAuthenticated'](),controller[_0x69ca('0x6c')]);router[_0x69ca('0x62')]('/:id/whatsapp_accounts',auth[_0x69ca('0x9')](),controller[_0x69ca('0x6d')]);router[_0x69ca('0x62')]('/:id/square_projects',auth[_0x69ca('0x9')](),controller[_0x69ca('0x6e')]);router[_0x69ca('0x62')]('/:id/api_key',auth[_0x69ca('0x9')](),controller['removeApiKey']);module[_0x69ca('0x6f')]=router; \ No newline at end of file +var _0x775b=['put','update','changePassword','delete','removeTeams','/:id','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','/:id/mail_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','addContacts','create','/create_many','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/pause','pause','/:id/unpause','unpause','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addSquareProjects','createApiKey'];(function(_0x126052,_0x5bd0af){var _0x5ab1eb=function(_0x5050f4){while(--_0x5050f4){_0x126052['push'](_0x126052['shift']());}};_0x5ab1eb(++_0x5bd0af);}(_0x775b,0xf4));var _0xb775=function(_0x2b902c,_0x48ceff){_0x2b902c=_0x2b902c-0x0;var _0x5ebb44=_0x775b[_0x2b902c];return _0x5ebb44;};'use strict';var multer=require('multer');var util=require(_0xb775('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb775('0x1'));var router=express['Router']();var fs_extra=require(_0xb775('0x2'));var auth=require(_0xb775('0x3'));var interaction=require(_0xb775('0x4'));var config=require(_0xb775('0x5'));var controller=require(_0xb775('0x6'));router[_0xb775('0x7')]('/',auth[_0xb775('0x8')](),controller['index']);router['get'](_0xb775('0x9'),auth['isAuthenticated'](),controller[_0xb775('0xa')]);router[_0xb775('0x7')](_0xb775('0xb'),auth['isAuthenticated'](),controller['whoami']);router['get']('/presence',auth[_0xb775('0x8')](),controller['getPresence']);router['get']('/:id',auth[_0xb775('0x8')](),controller['show']);router[_0xb775('0x7')](_0xb775('0xc'),controller['getAvatar']);router[_0xb775('0x7')](_0xb775('0xd'),auth[_0xb775('0x8')](),controller[_0xb775('0xe')]);router['get'](_0xb775('0xf'),auth[_0xb775('0x8')](),controller[_0xb775('0x10')]);router[_0xb775('0x7')](_0xb775('0x11'),auth[_0xb775('0x8')](),controller[_0xb775('0x12')]);router['get'](_0xb775('0x13'),auth[_0xb775('0x8')](),controller[_0xb775('0x14')]);router[_0xb775('0x7')](_0xb775('0x15'),auth[_0xb775('0x8')](),controller['getGroups']);router[_0xb775('0x7')](_0xb775('0x16'),auth[_0xb775('0x8')](),controller[_0xb775('0x17')]);router[_0xb775('0x7')](_0xb775('0x18'),auth[_0xb775('0x8')](),controller[_0xb775('0x19')]);router[_0xb775('0x7')](_0xb775('0x1a'),auth[_0xb775('0x8')](),controller['getChatInteractions']);router[_0xb775('0x7')](_0xb775('0x1b'),auth[_0xb775('0x8')](),controller[_0xb775('0x1c')]);router['get'](_0xb775('0x1d'),auth['isAuthenticated'](),controller[_0xb775('0x1e')]);router['get'](_0xb775('0x1f'),auth[_0xb775('0x8')](),controller[_0xb775('0x20')]);router[_0xb775('0x7')](_0xb775('0x21'),auth[_0xb775('0x8')](),controller['getFaxInteractions']);router[_0xb775('0x7')]('/:id/whatsapp/interactions',auth[_0xb775('0x8')](),controller[_0xb775('0x22')]);router['get'](_0xb775('0x23'),auth[_0xb775('0x8')](),controller[_0xb775('0x24')]);router[_0xb775('0x7')](_0xb775('0x25'),auth[_0xb775('0x8')](),controller['getLists']);router[_0xb775('0x7')](_0xb775('0x26'),auth[_0xb775('0x8')](),controller[_0xb775('0x27')]);router[_0xb775('0x7')]('/:id/prefixes',auth[_0xb775('0x8')](),controller[_0xb775('0x28')]);router['get'](_0xb775('0x29'),auth[_0xb775('0x8')](),controller[_0xb775('0x2a')]);router[_0xb775('0x7')]('/:id/mail_accounts',auth[_0xb775('0x8')](),controller[_0xb775('0x2b')]);router[_0xb775('0x7')](_0xb775('0x2c'),auth[_0xb775('0x8')](),controller[_0xb775('0x2d')]);router[_0xb775('0x7')](_0xb775('0x2e'),auth[_0xb775('0x8')](),controller[_0xb775('0x2f')]);router[_0xb775('0x7')]('/:id/chat_websites',auth[_0xb775('0x8')](),controller[_0xb775('0x30')]);router[_0xb775('0x7')](_0xb775('0x31'),auth[_0xb775('0x8')](),controller['getWhatsappAccounts']);router[_0xb775('0x7')](_0xb775('0x32'),auth[_0xb775('0x8')](),controller[_0xb775('0x33')]);router[_0xb775('0x7')](_0xb775('0x34'),auth[_0xb775('0x8')](),controller[_0xb775('0x35')]);router[_0xb775('0x7')]('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router[_0xb775('0x36')](_0xb775('0xf'),auth[_0xb775('0x8')](),controller[_0xb775('0x37')]);router[_0xb775('0x36')]('/',auth[_0xb775('0x8')](),controller[_0xb775('0x38')]);router[_0xb775('0x36')](_0xb775('0x39'),auth[_0xb775('0x8')](),controller['bulkCreate']);router['post'](_0xb775('0x11'),auth[_0xb775('0x8')](),controller[_0xb775('0x3a')]);var upload=multer({'storage':multer[_0xb775('0x3b')]({'destination':function(_0x3a6933,_0x2242ff,_0x7ac6c){_0x7ac6c(null,path['join'](config[_0xb775('0x3c')],_0xb775('0x3d')));},'filename':function(_0x2669d4,_0x3fb263,_0x54433a){_0x54433a(null,util[_0xb775('0x3e')](_0xb775('0x3f'),Date[_0xb775('0x40')](),_0x3fb263[_0xb775('0x41')]));}})});router[_0xb775('0x36')](_0xb775('0xc'),upload[_0xb775('0x42')](_0xb775('0x43')),controller[_0xb775('0x44')]);router[_0xb775('0x36')](_0xb775('0x45'),auth[_0xb775('0x8')](),controller[_0xb775('0x46')]);router[_0xb775('0x36')]('/:id/logout',auth[_0xb775('0x8')](),controller['logout']);router[_0xb775('0x36')](_0xb775('0x47'),auth[_0xb775('0x8')](),controller[_0xb775('0x48')]);router['post'](_0xb775('0x49'),auth[_0xb775('0x8')](),controller[_0xb775('0x4a')]);router[_0xb775('0x36')](_0xb775('0x23'),auth['isAuthenticated'](),controller['addTeams']);router[_0xb775('0x36')]('/:id/chat_interactions',auth[_0xb775('0x8')](),controller['addChatInteractions']);router[_0xb775('0x36')](_0xb775('0x4b'),auth[_0xb775('0x8')](),controller[_0xb775('0x4c')]);router[_0xb775('0x36')](_0xb775('0x4d'),auth[_0xb775('0x8')](),controller['addFaxInteractions']);router[_0xb775('0x36')](_0xb775('0x4e'),auth['isAuthenticated'](),controller[_0xb775('0x4f')]);router['post'](_0xb775('0x50'),auth[_0xb775('0x8')](),controller[_0xb775('0x51')]);router[_0xb775('0x36')](_0xb775('0x52'),auth[_0xb775('0x8')](),controller[_0xb775('0x53')]);router[_0xb775('0x36')](_0xb775('0x29'),auth[_0xb775('0x8')](),controller[_0xb775('0x54')]);router[_0xb775('0x36')]('/:id/mail_accounts',auth[_0xb775('0x8')](),controller[_0xb775('0x55')]);router[_0xb775('0x36')](_0xb775('0x2c'),auth[_0xb775('0x8')](),controller[_0xb775('0x56')]);router[_0xb775('0x36')](_0xb775('0x2e'),auth[_0xb775('0x8')](),controller[_0xb775('0x57')]);router['post'](_0xb775('0x58'),auth[_0xb775('0x8')](),controller[_0xb775('0x59')]);router[_0xb775('0x36')]('/:id/whatsapp_accounts',auth[_0xb775('0x8')](),controller['addWhatsappAccounts']);router[_0xb775('0x36')](_0xb775('0x32'),auth[_0xb775('0x8')](),controller[_0xb775('0x5a')]);router[_0xb775('0x36')]('/:id/api_key',auth[_0xb775('0x8')](),controller[_0xb775('0x5b')]);router[_0xb775('0x5c')]('/:id',auth[_0xb775('0x8')](),controller[_0xb775('0x5d')]);router[_0xb775('0x5c')]('/:id/password',auth['isAuthenticated'](),controller[_0xb775('0x5e')]);router[_0xb775('0x5f')](_0xb775('0x11'),auth[_0xb775('0x8')](),controller['removeQueues']);router[_0xb775('0x5f')](_0xb775('0x23'),auth[_0xb775('0x8')](),controller[_0xb775('0x60')]);router[_0xb775('0x5f')](_0xb775('0x61'),auth[_0xb775('0x8')](),controller[_0xb775('0x62')]);router[_0xb775('0x5f')]('/:id/chat_interactions',auth[_0xb775('0x8')](),controller[_0xb775('0x63')]);router[_0xb775('0x5f')](_0xb775('0x4b'),auth[_0xb775('0x8')](),controller[_0xb775('0x64')]);router[_0xb775('0x5f')]('/:id/fax_interactions',auth[_0xb775('0x8')](),controller[_0xb775('0x65')]);router[_0xb775('0x5f')](_0xb775('0x4e'),auth[_0xb775('0x8')](),controller[_0xb775('0x66')]);router[_0xb775('0x5f')](_0xb775('0x50'),auth['isAuthenticated'](),controller[_0xb775('0x67')]);router['delete'](_0xb775('0x52'),auth[_0xb775('0x8')](),controller[_0xb775('0x68')]);router[_0xb775('0x5f')](_0xb775('0x29'),auth[_0xb775('0x8')](),controller[_0xb775('0x69')]);router[_0xb775('0x5f')](_0xb775('0x6a'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0xb775('0x5f')](_0xb775('0x2c'),auth[_0xb775('0x8')](),controller['removeOpenchannelAccounts']);router[_0xb775('0x5f')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xb775('0x6b')]);router[_0xb775('0x5f')](_0xb775('0x58'),auth['isAuthenticated'](),controller[_0xb775('0x6c')]);router[_0xb775('0x5f')](_0xb775('0x31'),auth['isAuthenticated'](),controller[_0xb775('0x6d')]);router[_0xb775('0x5f')](_0xb775('0x32'),auth[_0xb775('0x8')](),controller[_0xb775('0x6e')]);router[_0xb775('0x5f')]('/:id/api_key',auth[_0xb775('0x8')](),controller['removeApiKey']);module[_0xb775('0x6f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 42a82a7..dc59a56 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x500b43,_0x1a1737){var _0x15a63d=function(_0x2829d0){while(--_0x2829d0){_0x500b43['push'](_0x500b43['shift']());}};_0x15a63d(++_0x1a1737);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0xcb91[_0x36436d];return _0x34615d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 0b81a45..af535a3 100644 --- a/server/api/user/user.controller.js +++ b/server/api/user/user.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfbf=['Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','online','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','VoiceQueue','voice','format','upsert','removeQueues','channel','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','server/files/images/logos/default_profile.png','download','existsSync','join','root','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','intersection','order','sort','pick','options','hasOwnProperty','CmList','List','Tags','tag','nolimit','getQueues','Unknown\x20channel','Queue','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','x-forwarded-for','socket','remoteAddress','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGININPAUSE','resolve','logout','QueuePause','pause','PAUSE','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','set','%s%s','Team','getTeams','addTeams','Voice','getChatQueues','setDataValue','Chat','getMailQueues','getWhatsappQueues','Whatsapp','getFaxQueues','getOpenchannelQueues','Openchannel','flatten','addAgent','getDataValue','Queue:save','UserVoicePrefix','removeTeams','Mail','getSmsQueues','Fax','transaction','TeamVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gte','$lt','$ne','$eq','$between','$notBetween','$in','$notIn','$iLike','$like','$overlap','$any','CmHopper','lastName','phone','Contact','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','queues','isEmpty','teams','inbound','col','toString','asc','result','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','slice','charAt','select','field','ui.','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','util','path','lodash','squel','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','http','request','then','info','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','code','User,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','count','offset','limit','Content-Range','update','get','role','admin','Users','user','Agents','agent','Telephones','filter','ignore','map','value','includes','find','name','UserProfileResource','destroy','end','stack','send','index','User','fieldName','key','password','salt','getOptions','where','query','includeAll','include','true','UserSetting','userSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','fax','mail','whatsapp','all','show','params','model','keys','rawAttributes','filters','fields','merge','openchannel','body','describe','addContacts','ids','internal','findById','securePassword','validatePasswordPattern','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','VoiceMail','fullname','email','permissions','101','103','104','105','106','107','108','100','111','114','115','create','Unauthorized','checkUserLimits','settingsEnabled','UserProfileSection','userProfileId','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','telephone','changePassword','Sequelize','ValidationError','authenticate','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword'];(function(_0x87f273,_0x321f97){var _0x1f6e0e=function(_0x4ab0c9){while(--_0x4ab0c9){_0x87f273['push'](_0x87f273['shift']());}};_0x1f6e0e(++_0x321f97);}(_0xbfbf,0x105));var _0xfbfb=function(_0x8efe57,_0x272d80){_0x8efe57=_0x8efe57-0x0;var _0x3c8735=_0xbfbf[_0x8efe57];return _0x3c8735;};'use strict';var moment=require(_0xfbfb('0x0'));var BPromise=require(_0xfbfb('0x1'));var util=require(_0xfbfb('0x2'));var path=require(_0xfbfb('0x3'));var fs=require('fs');var _=require(_0xfbfb('0x4'));var squel=require(_0xfbfb('0x5'));var jayson=require('jayson/promise');var Redis=require(_0xfbfb('0x6'));var authService=require(_0xfbfb('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xfbfb('0x8'));var utils=require('../../config/utils');var config=require(_0xfbfb('0x9'));var licenseUtil=require(_0xfbfb('0xa'));var db=require(_0xfbfb('0xb'))['db'];var socket=require(_0xfbfb('0xc'))(new Redis(config[_0xfbfb('0xd')]));require(_0xfbfb('0xe'))['register'](socket);config[_0xfbfb('0xd')]=_[_0xfbfb('0xf')](config[_0xfbfb('0xd')],{'host':_0xfbfb('0x10'),'port':0x18eb});var client=jayson['client'][_0xfbfb('0x11')]({'port':0x232a});var values;function respondWithRpcPromise(_0xa3a7c6,_0x22b596,_0x2d0dc1,_0x445af6){return new BPromise(function(_0x30627c,_0x3d3be9){var _0x2293e4=_0x445af6||client;return _0x2293e4[_0xfbfb('0x12')](_0xa3a7c6,_0x2d0dc1)[_0xfbfb('0x13')](function(_0x299220){logger[_0xfbfb('0x14')]('User,\x20%s,\x20%s',_0x22b596,_0xfbfb('0x15'));logger['debug'](_0xfbfb('0x16'),_0x22b596,'request\x20sent',JSON['stringify'](_0x299220));if(_0x299220[_0xfbfb('0x17')]){if(_0x299220[_0xfbfb('0x17')][_0xfbfb('0x18')]===0x1f4){logger[_0xfbfb('0x17')](_0xfbfb('0x19'),_0x22b596,_0x299220['error'][_0xfbfb('0x1a')]);return _0x3d3be9(_0x299220[_0xfbfb('0x17')][_0xfbfb('0x1a')]);}logger[_0xfbfb('0x17')](_0xfbfb('0x19'),_0x22b596,_0x299220[_0xfbfb('0x17')]['message']);return _0x30627c(_0x299220[_0xfbfb('0x17')]['message']);}else{logger[_0xfbfb('0x14')](_0xfbfb('0x19'),_0x22b596,'request\x20sent');_0x30627c(_0x299220['result'][_0xfbfb('0x1a')]);}})[_0xfbfb('0x1b')](function(_0x2132bd){logger[_0xfbfb('0x17')]('User,\x20%s,\x20%s',_0x22b596,_0x2132bd);_0x3d3be9(_0x2132bd);});});}function respondWithStatusCode(_0x193c7b,_0xbd8e34){_0xbd8e34=_0xbd8e34||0xcc;return function(_0x5231f6){if(_0x5231f6){return _0x193c7b[_0xfbfb('0x1c')](_0xbd8e34);}return _0x193c7b[_0xfbfb('0x1d')](_0xbd8e34)['end']();};}function respondWithResult(_0x12fbcf,_0x25f9ec){_0x25f9ec=_0x25f9ec||0xc8;return function(_0x256449){if(_0x256449){return _0x12fbcf[_0xfbfb('0x1d')](_0x25f9ec)[_0xfbfb('0x1e')](_0x256449);}};}function respondWithFilteredResult(_0x3b984f,_0x49f229){return function(_0x665c80){if(_0x665c80){var _0x4234cc=typeof _0x49f229['offset']===_0xfbfb('0x1f')&&typeof _0x49f229['limit']==='undefined';var _0x5ce89d=_0x665c80[_0xfbfb('0x20')];var _0x489a4f=_0x4234cc?0x0:_0x49f229['offset'];var _0x5d1bcb=_0x4234cc?_0x665c80[_0xfbfb('0x20')]:_0x49f229[_0xfbfb('0x21')]+_0x49f229[_0xfbfb('0x22')];var _0x311e7f;if(_0x5d1bcb>=_0x5ce89d){_0x5d1bcb=_0x5ce89d;_0x311e7f=0xc8;}else{_0x311e7f=0xce;}_0x3b984f[_0xfbfb('0x1d')](_0x311e7f);return _0x3b984f['set'](_0xfbfb('0x23'),_0x489a4f+'-'+_0x5d1bcb+'/'+_0x5ce89d)[_0xfbfb('0x1e')](_0x665c80);}return null;};}function saveUpdates(_0x3cb4f8){return function(_0x51cee6){if(_0x51cee6){return _0x51cee6[_0xfbfb('0x24')](_0x3cb4f8)[_0xfbfb('0x13')](function(_0x3db67d){return _0x3db67d;});}return null;};}function removeEntity(_0x2a6e92){return function(_0x4f67c7){if(_0x4f67c7){return _0x4f67c7['destroy']()[_0xfbfb('0x13')](function(){var _0x4e1aed=_0x4f67c7[_0xfbfb('0x25')]({'plain':!![]});if(_0x4e1aed[_0xfbfb('0x26')]===_0xfbfb('0x27'))return;var _0x1a40e6=[{'name':_0xfbfb('0x28'),'value':_0xfbfb('0x29'),'ignore':!![]},{'name':_0xfbfb('0x2a'),'value':_0xfbfb('0x2b'),'ignore':![]},{'name':_0xfbfb('0x2c'),'value':'telephone','ignore':![]}];var _0x333a46=_(_0x1a40e6)[_0xfbfb('0x2d')](_0xfbfb('0x2e'))[_0xfbfb('0x2f')]('value')[_0xfbfb('0x30')]();if(_[_0xfbfb('0x31')](_0x333a46,_0x4e1aed[_0xfbfb('0x26')])){return;}var _0x3e1816=_[_0xfbfb('0x32')](_0x1a40e6,[_0xfbfb('0x30'),_0x4e1aed[_0xfbfb('0x26')]])[_0xfbfb('0x33')];return db[_0xfbfb('0x34')][_0xfbfb('0x35')]({'where':{'type':_0x3e1816,'resourceId':_0x4e1aed['id']}})[_0xfbfb('0x13')](function(){return _0x4f67c7;});})[_0xfbfb('0x13')](function(){_0x2a6e92[_0xfbfb('0x1d')](0xcc)[_0xfbfb('0x36')]();});}};}function handleEntityNotFound(_0x6b1381){return function(_0x2190d1){if(!_0x2190d1){_0x6b1381[_0xfbfb('0x1c')](0x194);}return _0x2190d1;};}function handleError(_0x4963ad,_0x20398e){_0x20398e=_0x20398e||0x1f4;return function(_0x5f2cf2){logger[_0xfbfb('0x17')](_0x5f2cf2[_0xfbfb('0x37')]);if(_0x5f2cf2[_0xfbfb('0x33')]){delete _0x5f2cf2[_0xfbfb('0x33')];}_0x4963ad[_0xfbfb('0x1d')](_0x20398e)[_0xfbfb('0x38')](_0x5f2cf2);};}exports[_0xfbfb('0x39')]=function(_0x34ee0b,_0x14b605){var _0xe2d864={},_0x31356c={'count':0x0,'rows':[]};var _0x1787d2=_(db[_0xfbfb('0x3a')]['rawAttributes'])[_0xfbfb('0x2f')](function(_0x32cfb4){return{'name':_0x32cfb4[_0xfbfb('0x3b')],'type':_0x32cfb4['type'][_0xfbfb('0x3c')]};})[_0xfbfb('0x2d')](function(_0x2e6d3b){return!_[_0xfbfb('0x31')]([_0xfbfb('0x3d'),_0xfbfb('0x3e')],_0x2e6d3b[_0xfbfb('0x33')]);})['value']();_0xe2d864=qs[_0xfbfb('0x3f')](_0x1787d2,_0x34ee0b);var _0x82f93f={'where':_0xe2d864[_0xfbfb('0x40')]};return db['User']['count'](_0x82f93f)[_0xfbfb('0x13')](function(_0x1fd4cb){_0x31356c[_0xfbfb('0x20')]=_0x1fd4cb;if(_0x34ee0b[_0xfbfb('0x41')][_0xfbfb('0x42')]){_0xe2d864[_0xfbfb('0x43')]=[{'all':!![]}];}if(_0x34ee0b['query']['userSetting']===_0xfbfb('0x44')){_0xe2d864[_0xfbfb('0x43')]=[{'model':db[_0xfbfb('0x45')],'as':_0xfbfb('0x46')}];}if(!_[_0xfbfb('0x31')](_0xe2d864['attributes'],'id')){_0xe2d864[_0xfbfb('0x47')][_0xfbfb('0x48')]('id');}return db[_0xfbfb('0x3a')][_0xfbfb('0x49')](_0xe2d864);})[_0xfbfb('0x13')](function(_0x27704a){_0x31356c[_0xfbfb('0x4a')]=_0x27704a;if(_0x34ee0b[_0xfbfb('0x41')][_0xfbfb('0x4b')]===_0xfbfb('0x44')){var _0x39cbc0=[];for(var _0x3e11ac=0x0;_0x3e11ac<_0x31356c[_0xfbfb('0x4a')][_0xfbfb('0x4c')];_0x3e11ac++){_0x39cbc0[_0xfbfb('0x48')](get_open_tabs(_0xfbfb('0x4d'),_0x31356c['rows'][_0x3e11ac][_0xfbfb('0x4e')]));_0x39cbc0[_0xfbfb('0x48')](get_open_tabs(_0xfbfb('0x4f'),_0x31356c['rows'][_0x3e11ac]['dataValues']));_0x39cbc0['push'](get_open_tabs(_0xfbfb('0x50'),_0x31356c[_0xfbfb('0x4a')][_0x3e11ac][_0xfbfb('0x4e')]));_0x39cbc0['push'](get_open_tabs(_0xfbfb('0x51'),_0x31356c[_0xfbfb('0x4a')][_0x3e11ac]['dataValues']));_0x39cbc0['push'](get_open_tabs('openchannel',_0x31356c[_0xfbfb('0x4a')][_0x3e11ac]['dataValues']));_0x39cbc0[_0xfbfb('0x48')](get_open_tabs(_0xfbfb('0x52'),_0x31356c[_0xfbfb('0x4a')][_0x3e11ac][_0xfbfb('0x4e')]));}return BPromise[_0xfbfb('0x53')](_0x39cbc0)[_0xfbfb('0x13')](function(){return _0x31356c;});}else{return _0x31356c;}})[_0xfbfb('0x13')](respondWithFilteredResult(_0x14b605,_0xe2d864))['catch'](handleError(_0x14b605,null));};exports[_0xfbfb('0x54')]=function(_0x40032a,_0x28c58b){var _0x182a0c={'raw':![],'where':{'id':_0x40032a[_0xfbfb('0x55')]['id']}},_0x2c98b2={};_0x2c98b2[_0xfbfb('0x56')]=_['differenceBy'](_[_0xfbfb('0x57')](db[_0xfbfb('0x3a')][_0xfbfb('0x58')]),['password',_0xfbfb('0x3e')]);_0x2c98b2[_0xfbfb('0x41')]=_['keys'](_0x40032a[_0xfbfb('0x41')]);_0x2c98b2[_0xfbfb('0x59')]=_['intersection'](_0x2c98b2['model'],_0x2c98b2[_0xfbfb('0x41')]);_0x182a0c['attributes']=_['intersection'](_0x2c98b2[_0xfbfb('0x56')],qs['fields'](_0x40032a[_0xfbfb('0x41')][_0xfbfb('0x5a')]));_0x182a0c['attributes']=_0x182a0c['attributes'][_0xfbfb('0x4c')]?_0x182a0c[_0xfbfb('0x47')]:_0x2c98b2[_0xfbfb('0x56')];if(_0x40032a[_0xfbfb('0x41')]['includeAll']){_0x182a0c[_0xfbfb('0x43')]=[{'all':!![]}];}if(_0x40032a['query'][_0xfbfb('0x46')]===_0xfbfb('0x44')){_0x182a0c[_0xfbfb('0x43')]=[{'model':db[_0xfbfb('0x45')],'as':_0xfbfb('0x46')}];}_0x182a0c=_[_0xfbfb('0x5b')]({},_0x182a0c,_0x40032a['options']);if(!_['includes'](_0x182a0c[_0xfbfb('0x47')],'id')){_0x182a0c[_0xfbfb('0x47')][_0xfbfb('0x48')]('id');}return db['User'][_0xfbfb('0x32')](_0x182a0c)[_0xfbfb('0x13')](handleEntityNotFound(_0x28c58b,null))[_0xfbfb('0x13')](function(_0x423168){var _0x1b87c6=[];values=_0x423168;if(_0x40032a['query'][_0xfbfb('0x4b')]===_0xfbfb('0x44')){_0x1b87c6[_0xfbfb('0x48')](get_open_tabs(_0xfbfb('0x4d'),_0x423168[_0xfbfb('0x4e')]));_0x1b87c6[_0xfbfb('0x48')](get_open_tabs(_0xfbfb('0x4f'),_0x423168[_0xfbfb('0x4e')]));_0x1b87c6[_0xfbfb('0x48')](get_open_tabs(_0xfbfb('0x5c'),_0x423168['dataValues']));_0x1b87c6[_0xfbfb('0x48')](get_open_tabs(_0xfbfb('0x52'),_0x423168[_0xfbfb('0x4e')]));_0x1b87c6['push'](get_open_tabs('fax',_0x423168['dataValues']));_0x1b87c6[_0xfbfb('0x48')](get_open_tabs(_0xfbfb('0x51'),_0x423168[_0xfbfb('0x4e')]));return BPromise[_0xfbfb('0x53')](_0x1b87c6);}else{return values;}})[_0xfbfb('0x13')](function(){return values;})[_0xfbfb('0x13')](respondWithResult(_0x28c58b,null))['catch'](handleError(_0x28c58b,null));};exports[_0xfbfb('0x24')]=function(_0x38922a,_0x2ad037){if(_0x38922a['body']['id']){delete _0x38922a['body']['id'];}delete _0x38922a[_0xfbfb('0x5d')][_0xfbfb('0x26')];return db[_0xfbfb('0x3a')][_0xfbfb('0x32')]({'where':{'id':_0x38922a[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x2ad037,null))[_0xfbfb('0x13')](saveUpdates(_0x38922a[_0xfbfb('0x5d')],null))[_0xfbfb('0x13')](respondWithResult(_0x2ad037,null))['catch'](handleError(_0x2ad037,null));};exports[_0xfbfb('0x5e')]=function(_0x796c7c,_0x404473){return db['User'][_0xfbfb('0x5e')]()[_0xfbfb('0x13')](respondWithResult(_0x404473,null))[_0xfbfb('0x1b')](handleError(_0x404473,null));};exports[_0xfbfb('0x5f')]=function(_0x2f9f7c,_0x5bd267){return db[_0xfbfb('0x3a')][_0xfbfb('0x32')]({'where':{'id':_0x2f9f7c[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x5bd267,null))['then'](function(_0xe43640){if(_0xe43640){return _0xe43640[_0xfbfb('0x5f')](_0x2f9f7c[_0xfbfb('0x5d')][_0xfbfb('0x60')],_['omit'](_0x2f9f7c[_0xfbfb('0x5d')],[_0xfbfb('0x60'),'id'])||{});}})[_0xfbfb('0x13')](respondWithResult(_0x5bd267,null))[_0xfbfb('0x1b')](handleError(_0x5bd267,null));};function validateUser(_0xd17a65){return new BPromise(function(_0xc9ad9f,_0x430b0b){if(_0xd17a65[_0xfbfb('0x61')])return _0xc9ad9f(_0xd17a65);return db['Setting'][_0xfbfb('0x62')](0x1)[_0xfbfb('0x13')](function(_0x361595){if(_0x361595[_0xfbfb('0x63')])authService[_0xfbfb('0x64')](_0xd17a65['password']);db[_0xfbfb('0x3a')]['max'](_0xfbfb('0x61'))[_0xfbfb('0x13')](function(_0x335514){if(_['isNil'](_0x335514)){_0xd17a65['internal']=_0x361595['min_internal']||0x1;return;}if(_[_0xfbfb('0x65')](_0x361595[_0xfbfb('0x66')])||_0x361595[_0xfbfb('0x66')]===_0x335514){_0xd17a65[_0xfbfb('0x61')]=_0x335514+0x1;return;}if(_0x361595[_0xfbfb('0x66')]>_0x335514){_0xd17a65[_0xfbfb('0x61')]=_0x361595[_0xfbfb('0x66')];return;}return db[_0xfbfb('0x67')][_0xfbfb('0x41')](_0xfbfb('0x68'),{'type':db['sequelize'][_0xfbfb('0x69')][_0xfbfb('0x6a')]})['then'](function(_0x4217c9){if(_0x4217c9&&_0x4217c9['length']){for(var _0x5cf167=0x0,_0x42c763=_0x4217c9[_0xfbfb('0x4c')];_0x5cf167<_0x42c763&&_[_0xfbfb('0x65')](_0xd17a65['internal']);_0x5cf167++){if(_0x361595[_0xfbfb('0x66')]<=_0x4217c9[_0x5cf167]['from']){_0xd17a65[_0xfbfb('0x61')]=_0x4217c9[_0x5cf167][_0xfbfb('0x6b')];}else if(_0x361595[_0xfbfb('0x66')]>_0x4217c9[_0x5cf167]['from']&&_0x361595[_0xfbfb('0x66')]<=_0x4217c9[_0x5cf167]['to']){_0xd17a65[_0xfbfb('0x61')]=_0x361595[_0xfbfb('0x66')];}}}if(_[_0xfbfb('0x65')](_0xd17a65[_0xfbfb('0x61')])){_0xd17a65[_0xfbfb('0x61')]=_0x335514+0x1;}return _0xc9ad9f(_0xd17a65);});});})[_0xfbfb('0x1b')](function(_0x517bf9){_0x430b0b(_0x517bf9);});});}function updateUser(_0x122ced){return new BPromise(function(_0x184af4,_0x47f6ff){try{if(_0x122ced['voicemail']){_0x122ced['mailbox']=_0x122ced[_0xfbfb('0x61')];_0x122ced[_0xfbfb('0x6c')]={'mailbox':_0x122ced['internal'],'password':_0x122ced[_0xfbfb('0x3d')],'fullname':_0x122ced[_0xfbfb('0x6d')],'email':_0x122ced[_0xfbfb('0x6e')]};}if(_0x122ced[_0xfbfb('0x26')]===_0xfbfb('0x2b')){if(!_0x122ced[_0xfbfb('0x6f')])_0x122ced[_0xfbfb('0x6f')]=[_0xfbfb('0x70'),'102',_0xfbfb('0x71'),'113','110',_0xfbfb('0x72'),_0xfbfb('0x73'),_0xfbfb('0x74'),_0xfbfb('0x75'),_0xfbfb('0x76'),'109',_0xfbfb('0x77'),_0xfbfb('0x78'),_0xfbfb('0x79'),_0xfbfb('0x7a')];}_0x184af4(_0x122ced);}catch(_0x4e47f2){_0x47f6ff(_0x4e47f2);}});}exports[_0xfbfb('0x7b')]=function(_0x245bc7,_0x2323b8){if(_0x245bc7[_0xfbfb('0x29')][_0xfbfb('0x26')]===_0xfbfb('0x2b'))throw new Error(_0xfbfb('0x7c'));if(_0x245bc7[_0xfbfb('0x5d')]['role']===_0xfbfb('0x29')&&_0x245bc7[_0xfbfb('0x29')][_0xfbfb('0x26')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x245bc7['body']['role']===_0xfbfb('0x27')&&_0x245bc7['user'][_0xfbfb('0x26')]!==_0xfbfb('0x27')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xfbfb('0x7d')]([_0x245bc7[_0xfbfb('0x5d')]])[_0xfbfb('0x13')](function(){return validateUser(_0x245bc7[_0xfbfb('0x5d')]);})[_0xfbfb('0x13')](function(_0x53366f){return updateUser(_0x53366f)['then'](function(_0x4dc715){if(_0x4dc715['role']==='admin'){_0x4dc715[_0xfbfb('0x7e')]=_0x245bc7[_0xfbfb('0x29')]['settingsEnabled'];delete _0x4dc715['userProfileId'];}return _0x4dc715;});})[_0xfbfb('0x13')](function(_0xa075c5){return db[_0xfbfb('0x3a')]['create'](_0xa075c5,{'include':[{'model':db[_0xfbfb('0x6c')],'as':_0xfbfb('0x6c')}]});})['then'](function(_0x2b3357){if(_0x245bc7[_0xfbfb('0x5d')][_0xfbfb('0x26')]==='user')return _0x2b3357;if(_0x245bc7[_0xfbfb('0x29')][_0xfbfb('0x26')]!==_0xfbfb('0x29'))return _0x2b3357;return db[_0xfbfb('0x7f')][_0xfbfb('0x32')]({'where':{'name':_0x2b3357['role']===_0xfbfb('0x2b')?_0xfbfb('0x2a'):'Telephones','userProfileId':_0x245bc7[_0xfbfb('0x29')][_0xfbfb('0x80')]},'raw':!![]})[_0xfbfb('0x13')](function(_0x1f6bc3){if(!_0x1f6bc3||_0x1f6bc3[_0xfbfb('0x81')]!=0x0)return _0x2b3357;return db['UserProfileResource'][_0xfbfb('0x7b')]({'name':_0x2b3357[_0xfbfb('0x33')],'resourceId':_0x2b3357['id'],'type':_0x1f6bc3['name'],'sectionId':_0x1f6bc3['id']},{})[_0xfbfb('0x13')](function(){return _0x2b3357;});})[_0xfbfb('0x1b')](function(_0xc2e0){logger[_0xfbfb('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc2e0);throw _0xc2e0;});})['then'](respondWithResult(_0x2323b8,0xc9))[_0xfbfb('0x1b')](handleError(_0x2323b8,null));};exports[_0xfbfb('0x82')]=function(_0x331b59,_0x60ef9b){var _0x4bed9c=_0x331b59[_0xfbfb('0x5d')];var _0xec7af9=[];if(_0x331b59['user']['role']==='agent')throw new Error(_0xfbfb('0x7c'));if(_['some'](_0x4bed9c,[_0xfbfb('0x26'),'user'])&&_0x331b59['user'][_0xfbfb('0x26')]!==_0xfbfb('0x27')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xfbfb('0x83')](_0x4bed9c,[_0xfbfb('0x26'),_0xfbfb('0x27')])&&_0x331b59[_0xfbfb('0x29')][_0xfbfb('0x26')]!==_0xfbfb('0x27')){throw new Error(_0xfbfb('0x84'));}return licenseUtil['checkUserLimits'](_0x4bed9c)[_0xfbfb('0x13')](function(){return validateUser(_0x4bed9c[0x0]);})[_0xfbfb('0x13')](function(){for(var _0x365ac2=0x1;_0x365ac2<_0x4bed9c[_0xfbfb('0x4c')];_0x365ac2++){var _0x409834=_0x4bed9c[_0x365ac2-0x1][_0xfbfb('0x61')];if(!_0x4bed9c[_0x365ac2][_0xfbfb('0x61')])_0x4bed9c[_0x365ac2][_0xfbfb('0x61')]=_0x409834+0x1;_0xec7af9[_0xfbfb('0x48')](validateUser(_0x4bed9c[_0x365ac2]));}return BPromise[_0xfbfb('0x53')](_0xec7af9);})[_0xfbfb('0x13')](function(){_0xec7af9=[];for(var _0x5ceefb=0x0;_0x5ceefb<_0x4bed9c[_0xfbfb('0x4c')];_0x5ceefb++){_0xec7af9['push'](updateUser(_0x4bed9c[_0x5ceefb]));}return BPromise[_0xfbfb('0x53')](_0xec7af9);})[_0xfbfb('0x13')](function(){return BPromise[_0xfbfb('0x85')](_0x4bed9c,function(_0xe6d8ef){return db[_0xfbfb('0x3a')][_0xfbfb('0x7b')](_0xe6d8ef,{'include':[{'model':db[_0xfbfb('0x6c')],'as':_0xfbfb('0x6c')}]})[_0xfbfb('0x13')](function(_0x34c6c0){_0xe6d8ef['id']=_0x34c6c0['id'];return _0xe6d8ef;});});})[_0xfbfb('0x13')](function(_0x10ca42){if(_0x331b59[_0xfbfb('0x5d')][_0xfbfb('0x26')]===_0xfbfb('0x29'))return _0x10ca42;if(_0x331b59[_0xfbfb('0x29')][_0xfbfb('0x26')]!==_0xfbfb('0x29'))return _0x10ca42;var _0x13c492=_[_0xfbfb('0x83')](_0x10ca42,function(_0x11718b){return _0x11718b[_0xfbfb('0x26')]===_0xfbfb('0x2b')||_0x11718b[_0xfbfb('0x26')]===_0xfbfb('0x86');});if(!_0x13c492)return _0x10ca42;return db[_0xfbfb('0x7f')][_0xfbfb('0x49')]({'where':{'name':{'$or':[_0xfbfb('0x2a'),'Telephones']},'userProfileId':_0x331b59['user'][_0xfbfb('0x80')]},'raw':!![]})[_0xfbfb('0x13')](function(_0x55434f){if(_['isEmpty'](_0x55434f)||!_[_0xfbfb('0x83')](_0x55434f,[_0xfbfb('0x81'),0x0]))return _0x10ca42;_0xec7af9=[];var _0xa7eacd=_(_0x55434f)[_0xfbfb('0x2f')](function(_0xf39810){if(_0xf39810[_0xfbfb('0x81')]===0x1)return;return _0xf39810[_0xfbfb('0x33')]===_0xfbfb('0x2a')?_0xfbfb('0x2b'):_0xfbfb('0x86');})['compact']()[_0xfbfb('0x30')]();for(var _0x445e14=0x0;_0x445e14<_0x10ca42['length'];_0x445e14++){if(!_[_0xfbfb('0x31')](_0xa7eacd,_0x10ca42[_0x445e14]['role']))return;var _0x44e863=_0x10ca42[_0x445e14][_0xfbfb('0x26')]===_0xfbfb('0x2b')?_0xfbfb('0x2a'):_0xfbfb('0x2c');_0xec7af9[_0xfbfb('0x48')](db[_0xfbfb('0x34')][_0xfbfb('0x7b')]({'name':_0x10ca42[_0x445e14][_0xfbfb('0x33')],'resourceId':_0x10ca42[_0x445e14]['id'],'type':_0x44e863,'sectionId':_[_0xfbfb('0x32')](_0x55434f,[_0xfbfb('0x33'),_0x44e863])['id']},{}));}return BPromise[_0xfbfb('0x53')](_0xec7af9);});})[_0xfbfb('0x13')](respondWithResult(_0x60ef9b,0xc9))[_0xfbfb('0x1b')](handleError(_0x60ef9b,null));};exports[_0xfbfb('0x87')]=function(_0x53a69d,_0x559cab){if(_0x53a69d[_0xfbfb('0x5d')]['id']){delete _0x53a69d['body']['id'];}return db['User'][_0xfbfb('0x32')]({'where':{'id':_0x53a69d[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](function(_0x3734ef){if(!_0x3734ef)return null;if(_0x3734ef['id']===_0x53a69d['user']['id']){if(!_0x53a69d[_0xfbfb('0x5d')]['oldPassword']||!_0x53a69d[_0xfbfb('0x5d')]['newPassword']){throw new db[(_0xfbfb('0x88'))][(_0xfbfb('0x89'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3734ef[_0xfbfb('0x8a')](_0x53a69d['body'][_0xfbfb('0x8b')])){throw new db['Sequelize'][(_0xfbfb('0x89'))]('Wrong\x20credentials');}if(_0x53a69d['body']['oldPassword']===_0x53a69d['body'][_0xfbfb('0x8c')]){throw new db[(_0xfbfb('0x88'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x53a69d[_0xfbfb('0x29')][_0xfbfb('0x26')]===_0xfbfb('0x27')){if(!_0x53a69d[_0xfbfb('0x5d')][_0xfbfb('0x8c')]){throw new db[(_0xfbfb('0x88'))][(_0xfbfb('0x89'))](_0xfbfb('0x8d'));}}else if(_0x53a69d[_0xfbfb('0x29')][_0xfbfb('0x26')]===_0xfbfb('0x29')){if(!_0x53a69d[_0xfbfb('0x5d')][_0xfbfb('0x8c')]){throw new db['Sequelize']['ValidationError'](_0xfbfb('0x8d'));}if(_0x3734ef[_0xfbfb('0x26')]!==_0xfbfb('0x2b')){throw new db[(_0xfbfb('0x88'))]['ValidationError'](_0xfbfb('0x7c'));}}else{throw new db[(_0xfbfb('0x88'))][(_0xfbfb('0x89'))]('Unauthorized');}return _0x3734ef;})['then'](handleEntityNotFound(_0x559cab,null))[_0xfbfb('0x13')](function(_0x2e5858){return db[_0xfbfb('0x8e')][_0xfbfb('0x8f')]({'attributes':['id','securePassword',_0xfbfb('0x90'),_0xfbfb('0x91')]})[_0xfbfb('0x13')](function(_0x28c6d2){if(_0x28c6d2[_0xfbfb('0x63')])authService[_0xfbfb('0x64')](_0x53a69d[_0xfbfb('0x5d')][_0xfbfb('0x8c')]);if(!_0x28c6d2['enforcePasswordHistory']||!_0x2e5858[_0xfbfb('0x92')])return _0x2e5858;authService['validatePasswordHistory'](_0x53a69d[_0xfbfb('0x5d')][_0xfbfb('0x8c')],_0x2e5858[_0xfbfb('0x92')],_0x28c6d2['passwordHistoryLimit']);return _0x2e5858;})[_0xfbfb('0x13')](saveUpdates({'password':_0x53a69d[_0xfbfb('0x5d')][_0xfbfb('0x8c')],'passwordResetAt':_0x53a69d[_0xfbfb('0x29')]['id']==_0x53a69d[_0xfbfb('0x55')]['id']?moment():null,'previousPasswords':authService[_0xfbfb('0x93')](_0x53a69d[_0xfbfb('0x5d')][_0xfbfb('0x8c')],_0x2e5858['previousPasswords'])},null));})['then'](respondWithResult(_0x559cab,null))[_0xfbfb('0x1b')](handleError(_0x559cab,null));};exports['addQueues']=function(_0x207ae3,_0x306431){var _0x5e085b=_0x207ae3[_0xfbfb('0x5d')]['channel'];return db['User'][_0xfbfb('0x32')]({'where':{'id':_0x207ae3[_0xfbfb('0x55')]['id']},'attributes':['id',_0xfbfb('0x33'),'role',_0xfbfb('0x94'),'loginInPause',_0xfbfb('0x95'),_0xfbfb('0x96')]})[_0xfbfb('0x13')](handleEntityNotFound(_0x306431,null))['then'](function(_0x10556a){if(_0x10556a){if(!utils[_0xfbfb('0x97')](_0x5e085b)){throw new db[(_0xfbfb('0x88'))][(_0xfbfb('0x89'))]('Unknown\x20channel');}return _0x10556a[_0xfbfb('0x98')+_[_0xfbfb('0x99')](_0x5e085b[_0xfbfb('0x9a')]())+_0xfbfb('0x9b')](_0x207ae3[_0xfbfb('0x5d')][_0xfbfb('0x60')],{'penalty':_0x207ae3[_0xfbfb('0x5d')][_0xfbfb('0x9c')]||0x0})[_0xfbfb('0x9d')](function(_0x2ac7c1){for(var _0x44f007=0x0;_0x44f007<_0x207ae3['body']['ids'][_0xfbfb('0x4c')];_0x44f007+=0x1){var _0x16346e={'UserId':Number(_0x207ae3['params']['id'])};_0x16346e[_['capitalize'](_0x5e085b[_0xfbfb('0x9a')]())+_0xfbfb('0x9e')]=Number(_0x207ae3['body'][_0xfbfb('0x60')][_0x44f007]);socket[_0xfbfb('0x9f')](_0xfbfb('0x29')+_[_0xfbfb('0x99')](_0x5e085b[_0xfbfb('0x9a')]())+'Queue:save',_0x16346e);}return _0x2ac7c1;})['then'](function(){if(_0x5e085b==='voice'){return db[_0xfbfb('0xa0')]['findAll']({'where':{'id':_0x207ae3['body']['ids']||[]},'raw':!![],'attributes':['id',_0xfbfb('0x33')]});}})['then'](function(_0xa83d70){var _0x3f927d=_0x10556a['get']({'plain':!![]});var _0x3ad065=[];if(_0x5e085b===_0xfbfb('0xa1')&&_0x3f927d[_0xfbfb('0x26')]===_0xfbfb('0x2b')&&_0x3f927d[_0xfbfb('0x94')]){for(var _0x564e84=0x0;_0x564e84<_0xa83d70[_0xfbfb('0x4c')];_0x564e84+=0x1){_0x3ad065[_0xfbfb('0x48')]({'membername':_0x3f927d[_0xfbfb('0x33')],'UserId':_0x3f927d['id'],'queue_name':_0xa83d70[_0x564e84][_0xfbfb('0x33')],'VoiceQueueId':_0xa83d70[_0x564e84]['id'],'interface':_[_0xfbfb('0x65')](_0x3f927d[_0xfbfb('0x96')])?util[_0xfbfb('0xa2')]('SIP/%s',_0x3f927d['name']):_0x3f927d[_0xfbfb('0x96')],'paused':_0x3f927d[_0xfbfb('0x95')]||![],'penalty':_0x207ae3[_0xfbfb('0x5d')][_0xfbfb('0x9c')]||0x0});}return BPromise[_0xfbfb('0x85')](_0x3ad065,function(_0x1c41b0){return db['UserVoiceQueueRt'][_0xfbfb('0xa3')](_0x1c41b0);});}return _0x10556a;});}})['then'](respondWithStatusCode(_0x306431,null))[_0xfbfb('0x1b')](handleError(_0x306431,null));};exports[_0xfbfb('0xa4')]=function(_0x35db21,_0x4e6aa8){var _0x1b309d,_0x483d51;return db[_0xfbfb('0x3a')][_0xfbfb('0x32')]({'where':{'id':_0x35db21['params']['id']},'attributes':['id',_0xfbfb('0x33'),_0xfbfb('0x26')]})['then'](handleEntityNotFound(_0x4e6aa8,null))[_0xfbfb('0x13')](function(_0x284cc5){if(_0x284cc5){_0x1b309d=_0x284cc5;if(!_0x35db21[_0xfbfb('0x41')]['channel']||!utils[_0xfbfb('0x97')](_0x35db21['query'][_0xfbfb('0xa5')])){throw new db['Sequelize'][(_0xfbfb('0x89'))]('Unknown\x20channel');}return _0x284cc5['remove'+_['capitalize'](_0x35db21[_0xfbfb('0x41')][_0xfbfb('0xa5')][_0xfbfb('0x9a')]())+'Queues'](_0x35db21[_0xfbfb('0x41')][_0xfbfb('0x60')]);}})['then'](function(_0x1d5aab){if(_[_0xfbfb('0xa6')](_0x35db21[_0xfbfb('0x41')]['ids'])){for(var _0x3f776d=0x0;_0x3f776d<_0x35db21[_0xfbfb('0x41')][_0xfbfb('0x60')][_0xfbfb('0x4c')];_0x3f776d+=0x1){_0x483d51={'UserId':Number(_0x35db21[_0xfbfb('0x55')]['id'])};_0x483d51[_['capitalize'](_0x35db21[_0xfbfb('0x41')]['channel'][_0xfbfb('0x9a')]())+_0xfbfb('0x9e')]=Number(_0x35db21[_0xfbfb('0x41')][_0xfbfb('0x60')][_0x3f776d]);socket[_0xfbfb('0x9f')](_0xfbfb('0x29')+_[_0xfbfb('0x99')](_0x35db21[_0xfbfb('0x41')][_0xfbfb('0xa5')][_0xfbfb('0x9a')]())+_0xfbfb('0xa7'),_0x483d51);}}else{_0x483d51={'UserId':Number(_0x35db21[_0xfbfb('0x55')]['id'])};_0x483d51[_[_0xfbfb('0x99')](_0x35db21[_0xfbfb('0x41')][_0xfbfb('0xa5')][_0xfbfb('0x9a')]())+_0xfbfb('0x9e')]=Number(_0x35db21['query'][_0xfbfb('0x60')]);socket[_0xfbfb('0x9f')](_0xfbfb('0x29')+_[_0xfbfb('0x99')](_0x35db21['query'][_0xfbfb('0xa5')][_0xfbfb('0x9a')]())+'Queue:remove',_0x483d51);}return _0x1d5aab;})['then'](function(){if(_0x35db21[_0xfbfb('0x41')][_0xfbfb('0xa5')]===_0xfbfb('0xa1')){return db[_0xfbfb('0xa8')][_0xfbfb('0x35')]({'where':{'UserId':_0x35db21[_0xfbfb('0x55')]['id'],'VoiceQueueId':_0x35db21['query']['ids']},'individualHooks':!![]})[_0xfbfb('0x13')](function(){return _0x1b309d;});}return _0x1b309d;})[_0xfbfb('0x13')](respondWithStatusCode(_0x4e6aa8,null))[_0xfbfb('0x1b')](handleError(_0x4e6aa8,null));};exports[_0xfbfb('0xa9')]=function(_0x3a2652,_0x548f5e){_0x3a2652['body'][_0xfbfb('0xaa')]=_0x3a2652[_0xfbfb('0xab')]['filename'];return db[_0xfbfb('0x3a')][_0xfbfb('0x32')]({'where':{'id':_0x3a2652[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x548f5e,null))[_0xfbfb('0x13')](saveUpdates(_0x3a2652[_0xfbfb('0x5d')],null))[_0xfbfb('0x13')](respondWithResult(_0x548f5e,null))[_0xfbfb('0x1b')](handleError(_0x548f5e,null));};exports['getAvatar']=function(_0x5f059f,_0x386734){var _0x23eb72=path['join'](config['root'],_0xfbfb('0xac'));return db[_0xfbfb('0x3a')][_0xfbfb('0x32')]({'where':{'id':_0x5f059f[_0xfbfb('0x55')]['id']},'attributes':['id',_0xfbfb('0xaa')],'raw':!![]})[_0xfbfb('0x13')](handleEntityNotFound(_0x386734,null))[_0xfbfb('0x13')](function(_0x458589){if(_0x458589){if(_[_0xfbfb('0x65')](_0x458589[_0xfbfb('0xaa')])){return _0x386734[_0xfbfb('0xad')](_0x23eb72);}else{if(!fs[_0xfbfb('0xae')](path[_0xfbfb('0xaf')](config[_0xfbfb('0xb0')],_0xfbfb('0xb1'),_0x458589[_0xfbfb('0xaa')]))){return _0x386734[_0xfbfb('0xad')](_0x23eb72);}return _0x386734[_0xfbfb('0xad')](path[_0xfbfb('0xaf')](config[_0xfbfb('0xb0')],_0xfbfb('0xb1'),_0x458589[_0xfbfb('0xaa')]));}}})['catch'](handleError(_0x386734,null));};exports[_0xfbfb('0xb2')]=function(_0x57e6aa,_0x2e065e){return db[_0xfbfb('0x3a')][_0xfbfb('0x32')]({'where':{'id':_0x57e6aa[_0xfbfb('0x55')]['id']},'attributes':['id']})[_0xfbfb('0x13')](handleEntityNotFound(_0x2e065e,null))[_0xfbfb('0x13')](function(_0x187eb8){var _0x3ee5d0=[];values=_0x187eb8['dataValues'];_0x3ee5d0['push'](get_open_tabs(_0xfbfb('0x4d'),_0x187eb8[_0xfbfb('0x4e')]));_0x3ee5d0[_0xfbfb('0x48')](get_open_tabs(_0xfbfb('0x4f'),_0x187eb8[_0xfbfb('0x4e')]));_0x3ee5d0['push'](get_open_tabs(_0xfbfb('0x5c'),_0x187eb8[_0xfbfb('0x4e')]));_0x3ee5d0['push'](get_open_tabs(_0xfbfb('0x52'),_0x187eb8['dataValues']));_0x3ee5d0[_0xfbfb('0x48')](get_open_tabs(_0xfbfb('0x50'),_0x187eb8[_0xfbfb('0x4e')]));_0x3ee5d0[_0xfbfb('0x48')](get_open_tabs(_0xfbfb('0x51'),_0x187eb8[_0xfbfb('0x4e')]));return BPromise['all'](_0x3ee5d0);})['then'](function(_0x1d358c){if(_0x1d358c){var _0x5cc84f=_[_0xfbfb('0x2f')](values[_0xfbfb('0xb3')],function(_0xcbe587){return{'channel':_0xfbfb('0xb4'),'id':_0xcbe587['id'],'createdAt':_0xcbe587['createdAt']};});var _0x2e25cd=_[_0xfbfb('0x2f')](values[_0xfbfb('0xb5')],function(_0x111bda){return{'channel':_0xfbfb('0xb6'),'id':_0x111bda['id'],'createdAt':_0x111bda[_0xfbfb('0xb7')]};});var _0x2c5466=_[_0xfbfb('0x2f')](values[_0xfbfb('0xb8')],function(_0x58a5de){return{'channel':_0xfbfb('0xb9'),'id':_0x58a5de['id'],'createdAt':_0x58a5de[_0xfbfb('0xb7')]};});var _0x313106=_[_0xfbfb('0x2f')](values['MailOpenTabs'],function(_0x3ec063){return{'channel':_0xfbfb('0xba'),'id':_0x3ec063['id'],'createdAt':_0x3ec063[_0xfbfb('0xb7')]};});var _0x3283b4=_[_0xfbfb('0x2f')](values[_0xfbfb('0xbb')],function(_0x53bc50){return{'channel':_0xfbfb('0xbc'),'id':_0x53bc50['id'],'createdAt':_0x53bc50[_0xfbfb('0xb7')]};});var _0x27c129=_[_0xfbfb('0x2f')](values[_0xfbfb('0xbd')],function(_0xe8c419){return{'channel':_0xfbfb('0xbe'),'id':_0xe8c419['id'],'createdAt':_0xe8c419[_0xfbfb('0xb7')]};});var _0x55b5bc=_[_0xfbfb('0xbf')](_0x5cc84f,_0x2e25cd,_0x2c5466,_0x313106,_0x3283b4,_0x27c129);var _0x2a9ee6={'count':_0x55b5bc[_0xfbfb('0x4c')],'rows':_0x55b5bc};return _0x2a9ee6;}else return null;})['then'](respondWithResult(_0x2e065e,null))['catch'](handleError(_0x2e065e,null));};exports[_0xfbfb('0xc0')]=function(_0x1e577c,_0x3177ca){var _0x297c3e={};var _0x56abf1={};var _0x569914;var _0x511aef;return db[_0xfbfb('0x3a')][_0xfbfb('0x8f')]({'where':{'id':_0x1e577c['params']['id']}})['then'](handleEntityNotFound(_0x3177ca,null))[_0xfbfb('0x13')](function(_0x572dd6){if(_0x572dd6){_0x569914=_0x572dd6;_0x56abf1[_0xfbfb('0x56')]=_['keys'](db[_0xfbfb('0xc1')]['rawAttributes']);_0x56abf1['query']=_['keys'](_0x1e577c[_0xfbfb('0x41')]);_0x56abf1[_0xfbfb('0x59')]=_[_0xfbfb('0xc2')](_0x56abf1['model'],_0x56abf1['query']);_0x297c3e['attributes']=_[_0xfbfb('0xc2')](_0x56abf1['model'],qs['fields'](_0x1e577c[_0xfbfb('0x41')][_0xfbfb('0x5a')]));_0x297c3e['attributes']=_0x297c3e['attributes']['length']?_0x297c3e[_0xfbfb('0x47')]:_0x56abf1['model'];_0x297c3e[_0xfbfb('0xc3')]=qs[_0xfbfb('0xc4')](_0x1e577c[_0xfbfb('0x41')][_0xfbfb('0xc4')]);_0x297c3e[_0xfbfb('0x40')]=qs[_0xfbfb('0x59')](_[_0xfbfb('0xc5')](_0x1e577c[_0xfbfb('0x41')],_0x56abf1[_0xfbfb('0x59')]));if(_0x1e577c[_0xfbfb('0x41')][_0xfbfb('0x2d')]){_0x297c3e[_0xfbfb('0x40')]=_[_0xfbfb('0x5b')](_0x297c3e[_0xfbfb('0x40')],{'$or':_[_0xfbfb('0x2f')](_0x297c3e[_0xfbfb('0x47')],function(_0x50d526){var _0x13d96e={};_0x13d96e[_0x50d526]={'$like':'%'+_0x1e577c['query'][_0xfbfb('0x2d')]+'%'};return _0x13d96e;})});}_0x297c3e=_[_0xfbfb('0x5b')]({},_0x297c3e,_0x1e577c[_0xfbfb('0xc6')]);return _0x569914[_0xfbfb('0xc0')](_0x297c3e);}})[_0xfbfb('0x13')](function(_0x4a38e4){if(_0x4a38e4){_0x511aef=_0x4a38e4[_0xfbfb('0x4c')];if(_0x1e577c[_0xfbfb('0x41')][_0xfbfb('0xc7')]('includeAll')){_0x297c3e['include']=[{'model':db[_0xfbfb('0xc8')],'as':_0xfbfb('0xc9'),'required':![]},{'model':db['Tag'],'as':_0xfbfb('0xca'),'attributes':['id',_0xfbfb('0x33'),'color'],'where':_0x1e577c['query'][_0xfbfb('0xcb')]?{'id':_0x1e577c[_0xfbfb('0x41')]['tag']}:undefined,'required':_0x1e577c[_0xfbfb('0x41')]['tag']?!![]:![]}];}if(!_0x1e577c[_0xfbfb('0x41')][_0xfbfb('0xc7')](_0xfbfb('0xcc'))){_0x297c3e[_0xfbfb('0x22')]=qs[_0xfbfb('0x22')](_0x1e577c[_0xfbfb('0x41')][_0xfbfb('0x22')]);_0x297c3e[_0xfbfb('0x21')]=qs[_0xfbfb('0x21')](_0x1e577c[_0xfbfb('0x41')][_0xfbfb('0x21')]);}return _0x569914[_0xfbfb('0xc0')](_0x297c3e);}})[_0xfbfb('0x13')](function(_0x13e450){if(_0x13e450){return _0x13e450?{'count':_0x511aef,'rows':_0x13e450}:null;}})[_0xfbfb('0x13')](respondWithResult(_0x3177ca,null))[_0xfbfb('0x1b')](handleError(_0x3177ca,null));};exports[_0xfbfb('0xcd')]=function(_0xbcf065,_0x155745){var _0x2db9db;var _0x3db3c9={};var _0x21aab1;return db[_0xfbfb('0x3a')][_0xfbfb('0x8f')]({'where':{'id':_0xbcf065[_0xfbfb('0x55')]['id']},'attributes':['id','name',_0xfbfb('0x26')]})[_0xfbfb('0x13')](handleEntityNotFound(_0x155745,null))[_0xfbfb('0x13')](function(_0x159fd2){if(!utils[_0xfbfb('0x97')](_0xbcf065[_0xfbfb('0x41')][_0xfbfb('0xa5')])){throw new db[(_0xfbfb('0x88'))][(_0xfbfb('0x89'))](_0xfbfb('0xce'));}_0x2db9db=_0x159fd2;var _0x164457={};_0x164457[_0xfbfb('0x56')]=_[_0xfbfb('0x57')](db[_[_0xfbfb('0x99')](_0xbcf065[_0xfbfb('0x41')][_0xfbfb('0xa5')])+_0xfbfb('0xcf')][_0xfbfb('0x58')]);_0x164457['query']=_['keys'](_0xbcf065[_0xfbfb('0x41')]);_0x164457[_0xfbfb('0x59')]=_[_0xfbfb('0xc2')](_0x164457[_0xfbfb('0x56')],_0x164457[_0xfbfb('0x41')]);_0x3db3c9[_0xfbfb('0x47')]=_['intersection'](_0x164457[_0xfbfb('0x56')],qs[_0xfbfb('0x5a')](_0xbcf065[_0xfbfb('0x41')]['fields']));_0x3db3c9[_0xfbfb('0x47')]=_0x3db3c9[_0xfbfb('0x47')][_0xfbfb('0x4c')]?_0x3db3c9[_0xfbfb('0x47')]:_0x164457[_0xfbfb('0x56')];_0x3db3c9[_0xfbfb('0xc3')]=qs[_0xfbfb('0xc4')](_0xbcf065[_0xfbfb('0x41')][_0xfbfb('0xc4')]);_0x3db3c9[_0xfbfb('0x40')]=qs['filters'](_[_0xfbfb('0xc5')](_0xbcf065[_0xfbfb('0x41')],_0x164457[_0xfbfb('0x59')]));if(_0xbcf065[_0xfbfb('0x41')][_0xfbfb('0x2d')]){_0x3db3c9[_0xfbfb('0x40')]=_['merge'](_0x3db3c9[_0xfbfb('0x40')],{'$or':_[_0xfbfb('0x2f')](_0x3db3c9['attributes'],function(_0x3f56b9){var _0x5eb77d={};_0x5eb77d[_0x3f56b9]={'$like':'%'+_0xbcf065[_0xfbfb('0x41')][_0xfbfb('0x2d')]+'%'};return _0x5eb77d;})});}_0x3db3c9=_[_0xfbfb('0x5b')]({},_0x3db3c9,_0xbcf065['options']);switch(_0x2db9db[_0xfbfb('0x26')]){case'admin':return db[_[_0xfbfb('0x99')](_0xbcf065[_0xfbfb('0x41')][_0xfbfb('0xa5')])+_0xfbfb('0xcf')][_0xfbfb('0x49')](_0x3db3c9);case _0xfbfb('0x29'):case _0xfbfb('0x2b'):return _0x2db9db[_0xfbfb('0x25')+_[_0xfbfb('0x99')](_0xbcf065[_0xfbfb('0x41')][_0xfbfb('0xa5')])+_0xfbfb('0x9b')](_0x3db3c9);default:throw new db[(_0xfbfb('0x88'))]['ValidationError']('Unknown\x20role');}})[_0xfbfb('0x13')](function(_0x11257f){_0x21aab1=_0x11257f[_0xfbfb('0x4c')];if(!_0xbcf065['query'][_0xfbfb('0xc7')](_0xfbfb('0xcc'))){_0x3db3c9['limit']=qs['limit'](_0xbcf065['query'][_0xfbfb('0x22')]);_0x3db3c9['offset']=qs[_0xfbfb('0x21')](_0xbcf065[_0xfbfb('0x41')][_0xfbfb('0x21')]);}switch(_0x2db9db[_0xfbfb('0x26')]){case _0xfbfb('0x27'):return db[_[_0xfbfb('0x99')](_0xbcf065[_0xfbfb('0x41')][_0xfbfb('0xa5')])+_0xfbfb('0xcf')][_0xfbfb('0x49')](_0x3db3c9);case _0xfbfb('0x29'):case _0xfbfb('0x2b'):return _0x2db9db[_0xfbfb('0x25')+_['capitalize'](_0xbcf065['query'][_0xfbfb('0xa5')])+_0xfbfb('0x9b')](_0x3db3c9);}})['then'](function(_0x1ebf9b){return{'count':_0x21aab1,'rows':_0x1ebf9b};})['then'](respondWithResult(_0x155745,null))[_0xfbfb('0x1b')](handleError(_0x155745,null));};exports[_0xfbfb('0xd0')]=function(_0x569bcb,_0x2d8ba7){var _0xc11a98={};var _0x523170={};var _0x252836;var _0x13b26d;return db[_0xfbfb('0x3a')][_0xfbfb('0x8f')]({'where':{'id':_0x569bcb[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x2d8ba7,null))[_0xfbfb('0x13')](function(_0x4a959e){if(_0x4a959e){_0x252836=_0x4a959e;_0x523170[_0xfbfb('0x56')]=_[_0xfbfb('0x57')](db[_0xfbfb('0xa8')]['rawAttributes']);_0x523170[_0xfbfb('0x41')]=_[_0xfbfb('0x57')](_0x569bcb[_0xfbfb('0x41')]);_0x523170[_0xfbfb('0x59')]=_['intersection'](_0x523170['model'],_0x523170['query']);_0xc11a98[_0xfbfb('0x47')]=_[_0xfbfb('0xc2')](_0x523170[_0xfbfb('0x56')],qs[_0xfbfb('0x5a')](_0x569bcb['query'][_0xfbfb('0x5a')]));_0xc11a98[_0xfbfb('0x47')]=_0xc11a98[_0xfbfb('0x47')][_0xfbfb('0x4c')]?_0xc11a98[_0xfbfb('0x47')]:_0x523170[_0xfbfb('0x56')];_0xc11a98[_0xfbfb('0xc3')]=qs['sort'](_0x569bcb[_0xfbfb('0x41')][_0xfbfb('0xc4')]);_0xc11a98['where']=qs['filters'](_[_0xfbfb('0xc5')](_0x569bcb[_0xfbfb('0x41')],_0x523170[_0xfbfb('0x59')]));if(_0x569bcb[_0xfbfb('0x41')][_0xfbfb('0x2d')]){_0xc11a98[_0xfbfb('0x40')]=_[_0xfbfb('0x5b')](_0xc11a98[_0xfbfb('0x40')],{'$or':_[_0xfbfb('0x2f')](_0xc11a98[_0xfbfb('0x47')],function(_0x2da600){var _0x155526={};_0x155526[_0x2da600]={'$like':'%'+_0x569bcb[_0xfbfb('0x41')][_0xfbfb('0x2d')]+'%'};return _0x155526;})});}_0xc11a98=_[_0xfbfb('0x5b')]({},_0xc11a98,_0x569bcb[_0xfbfb('0xc6')]);return _0x252836[_0xfbfb('0xd0')](_0xc11a98);}})[_0xfbfb('0x13')](function(_0x4ea1f9){if(_0x4ea1f9){_0x13b26d=_0x4ea1f9[_0xfbfb('0x4c')];if(!_0x569bcb[_0xfbfb('0x41')]['hasOwnProperty'](_0xfbfb('0xcc'))){_0xc11a98[_0xfbfb('0x22')]=qs[_0xfbfb('0x22')](_0x569bcb[_0xfbfb('0x41')][_0xfbfb('0x22')]);_0xc11a98[_0xfbfb('0x21')]=qs[_0xfbfb('0x21')](_0x569bcb[_0xfbfb('0x41')]['offset']);}return _0x252836[_0xfbfb('0xd0')](_0xc11a98);}})[_0xfbfb('0x13')](function(_0x496f7d){if(_0x496f7d){return _0x496f7d?{'count':_0x13b26d,'rows':_0x496f7d}:null;}})[_0xfbfb('0x13')](respondWithResult(_0x2d8ba7,null))[_0xfbfb('0x1b')](handleError(_0x2d8ba7,null));};exports[_0xfbfb('0xd1')]=function(_0x40863f,_0x38cad5){var _0x33cf17={};var _0x5ae0ec={};var _0x2c1333;var _0x55deb6;return db['User'][_0xfbfb('0x8f')]({'where':{'id':_0x40863f[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x38cad5,null))['then'](function(_0x437639){if(_0x437639){_0x2c1333=_0x437639;_0x5ae0ec[_0xfbfb('0x56')]=_['keys'](db['ChatGroup'][_0xfbfb('0x58')]);_0x5ae0ec[_0xfbfb('0x41')]=_[_0xfbfb('0x57')](_0x40863f['query']);_0x5ae0ec[_0xfbfb('0x59')]=_[_0xfbfb('0xc2')](_0x5ae0ec[_0xfbfb('0x56')],_0x5ae0ec['query']);_0x33cf17[_0xfbfb('0x47')]=_[_0xfbfb('0xc2')](_0x5ae0ec[_0xfbfb('0x56')],qs[_0xfbfb('0x5a')](_0x40863f[_0xfbfb('0x41')]['fields']));_0x33cf17[_0xfbfb('0x47')]=_0x33cf17[_0xfbfb('0x47')]['length']?_0x33cf17[_0xfbfb('0x47')]:_0x5ae0ec['model'];_0x33cf17[_0xfbfb('0xc3')]=qs[_0xfbfb('0xc4')](_0x40863f[_0xfbfb('0x41')][_0xfbfb('0xc4')]);_0x33cf17[_0xfbfb('0x40')]=qs[_0xfbfb('0x59')](_['pick'](_0x40863f[_0xfbfb('0x41')],_0x5ae0ec['filters']));if(_0x40863f[_0xfbfb('0x41')][_0xfbfb('0x2d')]){_0x33cf17[_0xfbfb('0x40')]=_[_0xfbfb('0x5b')](_0x33cf17['where'],{'$or':_[_0xfbfb('0x2f')](_0x33cf17['attributes'],function(_0x31db3a){var _0x198661={};_0x198661[_0x31db3a]={'$like':'%'+_0x40863f[_0xfbfb('0x41')][_0xfbfb('0x2d')]+'%'};return _0x198661;})});}_0x33cf17=_[_0xfbfb('0x5b')]({},_0x33cf17,_0x40863f[_0xfbfb('0xc6')]);return _0x2c1333[_0xfbfb('0xd1')](_0x33cf17);}})[_0xfbfb('0x13')](function(_0x374ecd){if(_0x374ecd){_0x55deb6=_0x374ecd[_0xfbfb('0x4c')];if(!_0x40863f['query'][_0xfbfb('0xc7')]('nolimit')){_0x33cf17[_0xfbfb('0x22')]=qs['limit'](_0x40863f[_0xfbfb('0x41')][_0xfbfb('0x22')]);_0x33cf17['offset']=qs[_0xfbfb('0x21')](_0x40863f[_0xfbfb('0x41')]['offset']);}return _0x2c1333['getGroups'](_0x33cf17);}})[_0xfbfb('0x13')](function(_0x111068){if(_0x111068){return _0x111068?{'count':_0x55deb6,'rows':_0x111068}:null;}})['then'](respondWithResult(_0x38cad5,null))['catch'](handleError(_0x38cad5,null));};exports[_0xfbfb('0xd2')]=function(_0x2ad1c7,_0x3f46a5){var _0x584586={'raw':!![],'where':{}};var _0x5a10ad={};var _0x5d1bf5={'count':0x0,'rows':[]};return db[_0xfbfb('0x3a')]['findOne']({'where':{'id':_0x2ad1c7[_0xfbfb('0x55')]['id']}})['then'](handleEntityNotFound(_0x3f46a5,null))[_0xfbfb('0x13')](function(_0x143f8f){if(_0x143f8f){_0x5a10ad[_0xfbfb('0x56')]=_[_0xfbfb('0x57')](db[_0xfbfb('0xd3')][_0xfbfb('0x58')]);_0x5a10ad[_0xfbfb('0x41')]=_[_0xfbfb('0x57')](_0x2ad1c7[_0xfbfb('0x41')]);_0x5a10ad[_0xfbfb('0x59')]=_[_0xfbfb('0xc2')](_0x5a10ad['model'],_0x5a10ad[_0xfbfb('0x41')]);_0x584586[_0xfbfb('0x47')]=_['intersection'](_0x5a10ad[_0xfbfb('0x56')],qs[_0xfbfb('0x5a')](_0x2ad1c7[_0xfbfb('0x41')][_0xfbfb('0x5a')]));_0x584586['attributes']=_0x584586['attributes'][_0xfbfb('0x4c')]?_0x584586[_0xfbfb('0x47')]:_0x5a10ad[_0xfbfb('0x56')];if(!_0x2ad1c7[_0xfbfb('0x41')][_0xfbfb('0xc7')]('nolimit')){_0x584586['limit']=qs[_0xfbfb('0x22')](_0x2ad1c7['query'][_0xfbfb('0x22')]);_0x584586['offset']=qs[_0xfbfb('0x21')](_0x2ad1c7[_0xfbfb('0x41')][_0xfbfb('0x21')]);}_0x584586['order']=qs[_0xfbfb('0xc4')](_0x2ad1c7[_0xfbfb('0x41')][_0xfbfb('0xc4')]);_0x584586[_0xfbfb('0x40')]=qs['filters'](_[_0xfbfb('0xc5')](_0x2ad1c7[_0xfbfb('0x41')],_0x5a10ad[_0xfbfb('0x59')]));_0x584586[_0xfbfb('0x40')][_0xfbfb('0xd4')]=_0x143f8f['id'];if(_0x2ad1c7[_0xfbfb('0x41')][_0xfbfb('0x2d')]){_0x584586[_0xfbfb('0x40')]=_[_0xfbfb('0x5b')](_0x584586[_0xfbfb('0x40')],{'$or':_['map'](_0x584586['attributes'],function(_0x38b1ef){var _0x1ef5d1={};_0x1ef5d1[_0x38b1ef]={'$like':'%'+_0x2ad1c7['query'][_0xfbfb('0x2d')]+'%'};return _0x1ef5d1;})});}_0x584586=_[_0xfbfb('0x5b')]({},_0x584586,_0x2ad1c7[_0xfbfb('0xc6')]);return db[_0xfbfb('0xd3')]['count']({'where':_0x584586[_0xfbfb('0x40')]})[_0xfbfb('0x13')](function(_0x593b17){_0x5d1bf5['count']=_0x593b17;if(_0x2ad1c7[_0xfbfb('0x41')][_0xfbfb('0x42')]){_0x584586['include']=[{'all':!![]}];}return db[_0xfbfb('0xd3')][_0xfbfb('0x49')](_0x584586);})[_0xfbfb('0x13')](function(_0x1f6d35){_0x5d1bf5[_0xfbfb('0x4a')]=_0x1f6d35;return _0x5d1bf5;});}})['then'](respondWithFilteredResult(_0x3f46a5,_0x584586))['catch'](handleError(_0x3f46a5,null));};exports[_0xfbfb('0xd5')]=function(_0x55eb2c,_0x591ce4){var _0x157975={'raw':!![],'where':{}};var _0x35db72={};var _0x5bc863={'count':0x0,'rows':[]};return db[_0xfbfb('0x3a')]['findOne']({'where':{'id':_0x55eb2c[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x591ce4,null))['then'](function(_0x39e8a7){if(_0x39e8a7){_0x35db72[_0xfbfb('0x56')]=_[_0xfbfb('0x57')](db[_0xfbfb('0xd6')][_0xfbfb('0x58')]);_0x35db72['query']=_['keys'](_0x55eb2c[_0xfbfb('0x41')]);_0x35db72[_0xfbfb('0x59')]=_[_0xfbfb('0xc2')](_0x35db72[_0xfbfb('0x56')],_0x35db72[_0xfbfb('0x41')]);_0x157975['attributes']=_['intersection'](_0x35db72[_0xfbfb('0x56')],qs[_0xfbfb('0x5a')](_0x55eb2c[_0xfbfb('0x41')][_0xfbfb('0x5a')]));_0x157975[_0xfbfb('0x47')]=_0x157975[_0xfbfb('0x47')][_0xfbfb('0x4c')]?_0x157975[_0xfbfb('0x47')]:_0x35db72[_0xfbfb('0x56')];if(!_0x55eb2c[_0xfbfb('0x41')]['hasOwnProperty'](_0xfbfb('0xcc'))){_0x157975['limit']=qs['limit'](_0x55eb2c[_0xfbfb('0x41')][_0xfbfb('0x22')]);_0x157975[_0xfbfb('0x21')]=qs[_0xfbfb('0x21')](_0x55eb2c[_0xfbfb('0x41')][_0xfbfb('0x21')]);}_0x157975[_0xfbfb('0xc3')]=qs[_0xfbfb('0xc4')](_0x55eb2c[_0xfbfb('0x41')][_0xfbfb('0xc4')]);_0x157975[_0xfbfb('0x40')]=qs[_0xfbfb('0x59')](_[_0xfbfb('0xc5')](_0x55eb2c[_0xfbfb('0x41')],_0x35db72[_0xfbfb('0x59')]));_0x157975[_0xfbfb('0x40')]['UserId']=_0x39e8a7['id'];if(_0x55eb2c['query']['filter']){_0x157975[_0xfbfb('0x40')]=_[_0xfbfb('0x5b')](_0x157975[_0xfbfb('0x40')],{'$or':_['map'](_0x157975[_0xfbfb('0x47')],function(_0x4beb3f){var _0x815867={};_0x815867[_0x4beb3f]={'$like':'%'+_0x55eb2c[_0xfbfb('0x41')][_0xfbfb('0x2d')]+'%'};return _0x815867;})});}_0x157975=_[_0xfbfb('0x5b')]({},_0x157975,_0x55eb2c['options']);return db[_0xfbfb('0xd6')][_0xfbfb('0x20')]({'where':_0x157975[_0xfbfb('0x40')]})['then'](function(_0x3fc644){_0x5bc863[_0xfbfb('0x20')]=_0x3fc644;if(_0x55eb2c[_0xfbfb('0x41')][_0xfbfb('0x42')]){_0x157975[_0xfbfb('0x43')]=[{'all':!![]}];}return db[_0xfbfb('0xd6')][_0xfbfb('0x49')](_0x157975);})[_0xfbfb('0x13')](function(_0x31e1cb){_0x5bc863[_0xfbfb('0x4a')]=_0x31e1cb;return _0x5bc863;});}})[_0xfbfb('0x13')](respondWithFilteredResult(_0x591ce4,_0x157975))[_0xfbfb('0x1b')](handleError(_0x591ce4,null));};exports[_0xfbfb('0xd7')]=function(_0xec6ca5,_0x54278c){var _0x25111f={};var _0x3fe70f={};var _0x3ce34f;var _0x1b9b81;return db['User'][_0xfbfb('0x8f')]({'where':{'id':_0xec6ca5[_0xfbfb('0x55')]['id']}})['then'](handleEntityNotFound(_0x54278c,null))[_0xfbfb('0x13')](function(_0x43f7bd){if(_0x43f7bd){_0x3ce34f=_0x43f7bd;_0x3fe70f[_0xfbfb('0x56')]=_[_0xfbfb('0x57')](db[_0xfbfb('0xd8')][_0xfbfb('0x58')]);_0x3fe70f[_0xfbfb('0x41')]=_[_0xfbfb('0x57')](_0xec6ca5[_0xfbfb('0x41')]);_0x3fe70f[_0xfbfb('0x59')]=_[_0xfbfb('0xc2')](_0x3fe70f[_0xfbfb('0x56')],_0x3fe70f['query']);_0x25111f[_0xfbfb('0x47')]=_[_0xfbfb('0xc2')](_0x3fe70f[_0xfbfb('0x56')],qs['fields'](_0xec6ca5[_0xfbfb('0x41')][_0xfbfb('0x5a')]));_0x25111f[_0xfbfb('0x47')]=_0x25111f[_0xfbfb('0x47')][_0xfbfb('0x4c')]?_0x25111f[_0xfbfb('0x47')]:_0x3fe70f[_0xfbfb('0x56')];_0x25111f[_0xfbfb('0xc3')]=qs[_0xfbfb('0xc4')](_0xec6ca5['query']['sort']);_0x25111f[_0xfbfb('0x40')]=qs[_0xfbfb('0x59')](_[_0xfbfb('0xc5')](_0xec6ca5['query'],_0x3fe70f[_0xfbfb('0x59')]));if(_0xec6ca5[_0xfbfb('0x41')]['filter']){_0x25111f[_0xfbfb('0x40')]=_[_0xfbfb('0x5b')](_0x25111f['where'],{'$or':_[_0xfbfb('0x2f')](_0x25111f[_0xfbfb('0x47')],function(_0x221839){var _0x3485f2={};_0x3485f2[_0x221839]={'$like':'%'+_0xec6ca5['query'][_0xfbfb('0x2d')]+'%'};return _0x3485f2;})});}_0x25111f=_[_0xfbfb('0x5b')]({},_0x25111f,_0xec6ca5[_0xfbfb('0xc6')]);return _0x3ce34f[_0xfbfb('0xd7')](_0x25111f);}})[_0xfbfb('0x13')](function(_0x37bb61){if(_0x37bb61){_0x1b9b81=_0x37bb61[_0xfbfb('0x4c')];if(!_0xec6ca5['query']['hasOwnProperty'](_0xfbfb('0xcc'))){_0x25111f['limit']=qs[_0xfbfb('0x22')](_0xec6ca5[_0xfbfb('0x41')][_0xfbfb('0x22')]);_0x25111f[_0xfbfb('0x21')]=qs[_0xfbfb('0x21')](_0xec6ca5[_0xfbfb('0x41')][_0xfbfb('0x21')]);}return _0x3ce34f[_0xfbfb('0xd7')](_0x25111f);}})[_0xfbfb('0x13')](function(_0x35f3c2){if(_0x35f3c2){return _0x35f3c2?{'count':_0x1b9b81,'rows':_0x35f3c2}:null;}})[_0xfbfb('0x13')](respondWithResult(_0x54278c,null))[_0xfbfb('0x1b')](handleError(_0x54278c,null));};exports[_0xfbfb('0xd9')]=function(_0x2fea33,_0x38f7d7){var _0x270742={};var _0x33c9fc={};var _0x35119c;var _0x1163c0;return db[_0xfbfb('0x3a')]['findOne']({'where':{'id':_0x2fea33[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x38f7d7,null))[_0xfbfb('0x13')](function(_0x35cb21){if(_0x35cb21){_0x35119c=_0x35cb21;_0x33c9fc['model']=_['keys'](db[_0xfbfb('0xda')][_0xfbfb('0x58')]);_0x33c9fc[_0xfbfb('0x41')]=_[_0xfbfb('0x57')](_0x2fea33[_0xfbfb('0x41')]);_0x33c9fc['filters']=_[_0xfbfb('0xc2')](_0x33c9fc[_0xfbfb('0x56')],_0x33c9fc[_0xfbfb('0x41')]);_0x270742[_0xfbfb('0x47')]=_[_0xfbfb('0xc2')](_0x33c9fc[_0xfbfb('0x56')],qs[_0xfbfb('0x5a')](_0x2fea33[_0xfbfb('0x41')][_0xfbfb('0x5a')]));_0x270742[_0xfbfb('0x47')]=_0x270742[_0xfbfb('0x47')][_0xfbfb('0x4c')]?_0x270742['attributes']:_0x33c9fc[_0xfbfb('0x56')];_0x270742[_0xfbfb('0xc3')]=qs[_0xfbfb('0xc4')](_0x2fea33['query'][_0xfbfb('0xc4')]);_0x270742[_0xfbfb('0x40')]=qs[_0xfbfb('0x59')](_['pick'](_0x2fea33['query'],_0x33c9fc['filters']));if(_0x2fea33[_0xfbfb('0x41')][_0xfbfb('0x2d')]){_0x270742['where']=_[_0xfbfb('0x5b')](_0x270742['where'],{'$or':_['map'](_0x270742['attributes'],function(_0x532e7b){var _0x11e47b={};_0x11e47b[_0x532e7b]={'$like':'%'+_0x2fea33['query'][_0xfbfb('0x2d')]+'%'};return _0x11e47b;})});}_0x270742=_[_0xfbfb('0x5b')]({},_0x270742,_0x2fea33[_0xfbfb('0xc6')]);return _0x35119c[_0xfbfb('0xd9')](_0x270742);}})[_0xfbfb('0x13')](function(_0x3ede71){if(_0x3ede71){_0x1163c0=_0x3ede71[_0xfbfb('0x4c')];if(!_0x2fea33['query']['hasOwnProperty']('nolimit')){_0x270742['limit']=qs[_0xfbfb('0x22')](_0x2fea33[_0xfbfb('0x41')][_0xfbfb('0x22')]);_0x270742['offset']=qs['offset'](_0x2fea33[_0xfbfb('0x41')]['offset']);}return _0x35119c[_0xfbfb('0xd9')](_0x270742);}})[_0xfbfb('0x13')](function(_0x35800a){if(_0x35800a){return _0x35800a?{'count':_0x1163c0,'rows':_0x35800a}:null;}})[_0xfbfb('0x13')](respondWithResult(_0x38f7d7,null))[_0xfbfb('0x1b')](handleError(_0x38f7d7,null));};exports[_0xfbfb('0xdb')]=function(_0x30fdf4,_0x34f007){var _0x16c934={'raw':!![],'where':{}};var _0x2bb4d9={};var _0x3b492e={'count':0x0,'rows':[]};return db[_0xfbfb('0x3a')][_0xfbfb('0x8f')]({'where':{'id':_0x30fdf4['params']['id']}})['then'](handleEntityNotFound(_0x34f007,null))[_0xfbfb('0x13')](function(_0x34bff5){if(_0x34bff5){_0x2bb4d9[_0xfbfb('0x56')]=_[_0xfbfb('0x57')](db['MailInteraction'][_0xfbfb('0x58')]);_0x2bb4d9[_0xfbfb('0x41')]=_[_0xfbfb('0x57')](_0x30fdf4[_0xfbfb('0x41')]);_0x2bb4d9['filters']=_[_0xfbfb('0xc2')](_0x2bb4d9['model'],_0x2bb4d9[_0xfbfb('0x41')]);_0x16c934[_0xfbfb('0x47')]=_['intersection'](_0x2bb4d9[_0xfbfb('0x56')],qs[_0xfbfb('0x5a')](_0x30fdf4[_0xfbfb('0x41')][_0xfbfb('0x5a')]));_0x16c934['attributes']=_0x16c934['attributes']['length']?_0x16c934[_0xfbfb('0x47')]:_0x2bb4d9[_0xfbfb('0x56')];if(!_0x30fdf4[_0xfbfb('0x41')][_0xfbfb('0xc7')](_0xfbfb('0xcc'))){_0x16c934[_0xfbfb('0x22')]=qs['limit'](_0x30fdf4['query'][_0xfbfb('0x22')]);_0x16c934['offset']=qs[_0xfbfb('0x21')](_0x30fdf4[_0xfbfb('0x41')][_0xfbfb('0x21')]);}_0x16c934[_0xfbfb('0xc3')]=qs[_0xfbfb('0xc4')](_0x30fdf4[_0xfbfb('0x41')][_0xfbfb('0xc4')]);_0x16c934[_0xfbfb('0x40')]=qs[_0xfbfb('0x59')](_[_0xfbfb('0xc5')](_0x30fdf4['query'],_0x2bb4d9[_0xfbfb('0x59')]));_0x16c934[_0xfbfb('0x40')][_0xfbfb('0xd4')]=_0x34bff5['id'];if(_0x30fdf4['query']['filter']){_0x16c934['where']=_['merge'](_0x16c934[_0xfbfb('0x40')],{'$or':_[_0xfbfb('0x2f')](_0x16c934['attributes'],function(_0x56ae52){var _0x32015a={};_0x32015a[_0x56ae52]={'$like':'%'+_0x30fdf4[_0xfbfb('0x41')][_0xfbfb('0x2d')]+'%'};return _0x32015a;})});}_0x16c934=_[_0xfbfb('0x5b')]({},_0x16c934,_0x30fdf4[_0xfbfb('0xc6')]);return db[_0xfbfb('0xdc')][_0xfbfb('0x20')]({'where':_0x16c934[_0xfbfb('0x40')]})['then'](function(_0x24fc55){_0x3b492e[_0xfbfb('0x20')]=_0x24fc55;if(_0x30fdf4['query'][_0xfbfb('0x42')]){_0x16c934[_0xfbfb('0x43')]=[{'all':!![]}];}return db[_0xfbfb('0xdc')]['findAll'](_0x16c934);})['then'](function(_0x5604ec){_0x3b492e[_0xfbfb('0x4a')]=_0x5604ec;return _0x3b492e;});}})[_0xfbfb('0x13')](respondWithFilteredResult(_0x34f007,_0x16c934))[_0xfbfb('0x1b')](handleError(_0x34f007,null));};exports[_0xfbfb('0xdd')]=function(_0x564d95,_0x42c66c){var _0xf5dde7={};var _0x14aa82={};var _0x1e7191;var _0x53f4ba;return db[_0xfbfb('0x3a')][_0xfbfb('0x8f')]({'where':{'id':_0x564d95[_0xfbfb('0x55')]['id']}})['then'](handleEntityNotFound(_0x42c66c,null))[_0xfbfb('0x13')](function(_0x49292c){if(_0x49292c){_0x1e7191=_0x49292c;_0x14aa82['model']=_['keys'](db[_0xfbfb('0xde')][_0xfbfb('0x58')]);_0x14aa82[_0xfbfb('0x41')]=_[_0xfbfb('0x57')](_0x564d95[_0xfbfb('0x41')]);_0x14aa82[_0xfbfb('0x59')]=_['intersection'](_0x14aa82[_0xfbfb('0x56')],_0x14aa82[_0xfbfb('0x41')]);_0xf5dde7['attributes']=_['intersection'](_0x14aa82[_0xfbfb('0x56')],qs[_0xfbfb('0x5a')](_0x564d95[_0xfbfb('0x41')]['fields']));_0xf5dde7[_0xfbfb('0x47')]=_0xf5dde7[_0xfbfb('0x47')][_0xfbfb('0x4c')]?_0xf5dde7[_0xfbfb('0x47')]:_0x14aa82[_0xfbfb('0x56')];_0xf5dde7['order']=qs[_0xfbfb('0xc4')](_0x564d95['query'][_0xfbfb('0xc4')]);_0xf5dde7['where']=qs[_0xfbfb('0x59')](_['pick'](_0x564d95[_0xfbfb('0x41')],_0x14aa82[_0xfbfb('0x59')]));if(_0x564d95[_0xfbfb('0x41')]['filter']){_0xf5dde7[_0xfbfb('0x40')]=_['merge'](_0xf5dde7[_0xfbfb('0x40')],{'$or':_['map'](_0xf5dde7[_0xfbfb('0x47')],function(_0x2062b7){var _0x3fc7ab={};_0x3fc7ab[_0x2062b7]={'$like':'%'+_0x564d95[_0xfbfb('0x41')][_0xfbfb('0x2d')]+'%'};return _0x3fc7ab;})});}_0xf5dde7=_['merge']({},_0xf5dde7,_0x564d95[_0xfbfb('0xc6')]);return _0x1e7191[_0xfbfb('0xdd')](_0xf5dde7);}})[_0xfbfb('0x13')](function(_0x6b5b19){if(_0x6b5b19){_0x53f4ba=_0x6b5b19[_0xfbfb('0x4c')];if(!_0x564d95['query'][_0xfbfb('0xc7')]('nolimit')){_0xf5dde7['limit']=qs[_0xfbfb('0x22')](_0x564d95['query'][_0xfbfb('0x22')]);_0xf5dde7[_0xfbfb('0x21')]=qs[_0xfbfb('0x21')](_0x564d95[_0xfbfb('0x41')][_0xfbfb('0x21')]);}return _0x1e7191[_0xfbfb('0xdd')](_0xf5dde7);}})[_0xfbfb('0x13')](function(_0x3e8f36){if(_0x3e8f36){return _0x3e8f36?{'count':_0x53f4ba,'rows':_0x3e8f36}:null;}})[_0xfbfb('0x13')](respondWithResult(_0x42c66c,null))[_0xfbfb('0x1b')](handleError(_0x42c66c,null));};exports[_0xfbfb('0xdf')]=function(_0x16cc66,_0x469023){var _0x84e672={};var _0x19c890={};var _0x1de491;var _0xf2381f;return db['User'][_0xfbfb('0x8f')]({'where':{'id':_0x16cc66[_0xfbfb('0x55')]['id']}})['then'](handleEntityNotFound(_0x469023,null))[_0xfbfb('0x13')](function(_0x5c9933){if(_0x5c9933){_0x1de491=_0x5c9933;_0x19c890[_0xfbfb('0x56')]=_[_0xfbfb('0x57')](db[_0xfbfb('0xe0')][_0xfbfb('0x58')]);_0x19c890[_0xfbfb('0x41')]=_['keys'](_0x16cc66[_0xfbfb('0x41')]);_0x19c890['filters']=_['intersection'](_0x19c890[_0xfbfb('0x56')],_0x19c890['query']);_0x84e672[_0xfbfb('0x47')]=_['intersection'](_0x19c890[_0xfbfb('0x56')],qs[_0xfbfb('0x5a')](_0x16cc66[_0xfbfb('0x41')]['fields']));_0x84e672[_0xfbfb('0x47')]=_0x84e672[_0xfbfb('0x47')]['length']?_0x84e672[_0xfbfb('0x47')]:_0x19c890['model'];_0x84e672[_0xfbfb('0xc3')]=qs[_0xfbfb('0xc4')](_0x16cc66[_0xfbfb('0x41')][_0xfbfb('0xc4')]);_0x84e672[_0xfbfb('0x40')]=qs[_0xfbfb('0x59')](_['pick'](_0x16cc66[_0xfbfb('0x41')],_0x19c890['filters']));if(_0x16cc66[_0xfbfb('0x41')][_0xfbfb('0x2d')]){_0x84e672[_0xfbfb('0x40')]=_[_0xfbfb('0x5b')](_0x84e672[_0xfbfb('0x40')],{'$or':_[_0xfbfb('0x2f')](_0x84e672[_0xfbfb('0x47')],function(_0x5b6860){var _0x3d88f5={};_0x3d88f5[_0x5b6860]={'$like':'%'+_0x16cc66[_0xfbfb('0x41')]['filter']+'%'};return _0x3d88f5;})});}_0x84e672=_[_0xfbfb('0x5b')]({},_0x84e672,_0x16cc66['options']);return _0x1de491['getFaxInteractions'](_0x84e672);}})['then'](function(_0x458629){if(_0x458629){_0xf2381f=_0x458629[_0xfbfb('0x4c')];if(!_0x16cc66['query']['hasOwnProperty']('nolimit')){_0x84e672[_0xfbfb('0x22')]=qs[_0xfbfb('0x22')](_0x16cc66[_0xfbfb('0x41')][_0xfbfb('0x22')]);_0x84e672['offset']=qs[_0xfbfb('0x21')](_0x16cc66[_0xfbfb('0x41')][_0xfbfb('0x21')]);}return _0x1de491['getFaxInteractions'](_0x84e672);}})[_0xfbfb('0x13')](function(_0x4028f7){if(_0x4028f7){return _0x4028f7?{'count':_0xf2381f,'rows':_0x4028f7}:null;}})[_0xfbfb('0x13')](respondWithResult(_0x469023,null))[_0xfbfb('0x1b')](handleError(_0x469023,null));};exports[_0xfbfb('0xe1')]=function(_0x15181f,_0x31ffdc){var _0x26bb18={};var _0x250980={};var _0x437b64;var _0x11d993;return db[_0xfbfb('0x3a')]['findOne']({'where':{'id':_0x15181f[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x31ffdc,null))[_0xfbfb('0x13')](function(_0x5185fe){if(_0x5185fe){_0x437b64=_0x5185fe;_0x250980[_0xfbfb('0x56')]=_[_0xfbfb('0x57')](db[_0xfbfb('0xe2')][_0xfbfb('0x58')]);_0x250980['query']=_['keys'](_0x15181f[_0xfbfb('0x41')]);_0x250980[_0xfbfb('0x59')]=_[_0xfbfb('0xc2')](_0x250980[_0xfbfb('0x56')],_0x250980[_0xfbfb('0x41')]);_0x26bb18[_0xfbfb('0x47')]=_[_0xfbfb('0xc2')](_0x250980[_0xfbfb('0x56')],qs['fields'](_0x15181f['query'][_0xfbfb('0x5a')]));_0x26bb18[_0xfbfb('0x47')]=_0x26bb18[_0xfbfb('0x47')][_0xfbfb('0x4c')]?_0x26bb18['attributes']:_0x250980[_0xfbfb('0x56')];_0x26bb18[_0xfbfb('0xc3')]=qs['sort'](_0x15181f[_0xfbfb('0x41')]['sort']);_0x26bb18[_0xfbfb('0x40')]=qs[_0xfbfb('0x59')](_[_0xfbfb('0xc5')](_0x15181f[_0xfbfb('0x41')],_0x250980['filters']));if(_0x15181f[_0xfbfb('0x41')]['filter']){_0x26bb18[_0xfbfb('0x40')]=_[_0xfbfb('0x5b')](_0x26bb18[_0xfbfb('0x40')],{'$or':_[_0xfbfb('0x2f')](_0x26bb18[_0xfbfb('0x47')],function(_0x1aed68){var _0x5d5486={};_0x5d5486[_0x1aed68]={'$like':'%'+_0x15181f['query'][_0xfbfb('0x2d')]+'%'};return _0x5d5486;})});}_0x26bb18=_[_0xfbfb('0x5b')]({},_0x26bb18,_0x15181f[_0xfbfb('0xc6')]);return _0x437b64[_0xfbfb('0xe1')](_0x26bb18);}})[_0xfbfb('0x13')](function(_0xba94b0){if(_0xba94b0){_0x11d993=_0xba94b0[_0xfbfb('0x4c')];if(!_0x15181f[_0xfbfb('0x41')][_0xfbfb('0xc7')](_0xfbfb('0xcc'))){_0x26bb18[_0xfbfb('0x22')]=qs[_0xfbfb('0x22')](_0x15181f[_0xfbfb('0x41')][_0xfbfb('0x22')]);_0x26bb18['offset']=qs['offset'](_0x15181f[_0xfbfb('0x41')]['offset']);}return _0x437b64[_0xfbfb('0xe1')](_0x26bb18);}})['then'](function(_0x2b11a8){if(_0x2b11a8){return _0x2b11a8?{'count':_0x11d993,'rows':_0x2b11a8}:null;}})['then'](respondWithResult(_0x31ffdc,null))['catch'](handleError(_0x31ffdc,null));};exports[_0xfbfb('0xe3')]=function(_0x314f29,_0x28e787,_0x14fc2c){var _0x4f7a58;var _0x40abcc;var _0x3a6915;var _0x217b6d=!_[_0xfbfb('0x65')](_0x314f29[_0xfbfb('0x55')]['id'])?_0x314f29[_0xfbfb('0x55')]['id']:!_[_0xfbfb('0x65')](_0x314f29[_0xfbfb('0x29')]['id'])?_0x314f29[_0xfbfb('0x29')]['id']:null;return db[_0xfbfb('0x3a')]['find']({'where':{'id':_0x217b6d,'role':{'$or':['admin',_0xfbfb('0x29'),_0xfbfb('0x2b')]}},'attributes':['id',_0xfbfb('0x33'),'phone',_0xfbfb('0xe4'),_0xfbfb('0x26'),'internal',_0xfbfb('0xe5')]})[_0xfbfb('0x13')](function(_0x5b04f3){if(_0x5b04f3){if(_0x5b04f3[_0xfbfb('0x26')]===_0xfbfb('0x2b')){_0x4f7a58=_0x5b04f3;if(_0x314f29[_0xfbfb('0x5d')][_0xfbfb('0x96')]){_0x3a6915=util['format'](_0xfbfb('0xe6'),_0x4f7a58[_0x314f29[_0xfbfb('0x5d')][_0xfbfb('0x96')]]);}else if(_0x314f29[_0xfbfb('0x5d')][_0xfbfb('0xe7')]){_0x3a6915=util[_0xfbfb('0xa2')](_0xfbfb('0xe8'),_0x314f29[_0xfbfb('0x5d')][_0xfbfb('0xe7')]);}else{_0x3a6915=util[_0xfbfb('0xa2')](_0xfbfb('0xe8'),_0x4f7a58[_0xfbfb('0x33')]);}socket['to'](util[_0xfbfb('0xa2')](_0xfbfb('0xe9'),_0x4f7a58[_0xfbfb('0x33')]))[_0xfbfb('0x9f')]('user:forcelogout',{'user':{'id':_0x4f7a58['id'],'name':_0x4f7a58[_0xfbfb('0x33')]},'ip':_0x314f29['headers'][_0xfbfb('0xea')]||_0x314f29['connection']['remoteAddress']||_0x314f29[_0xfbfb('0xeb')][_0xfbfb('0xec')]||_0x314f29[_0xfbfb('0xed')][_0xfbfb('0xeb')][_0xfbfb('0xec')]});return db['UserVoiceQueueRt'][_0xfbfb('0x35')]({'where':{'membername':_0x4f7a58[_0xfbfb('0x33')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xfbfb('0x89'))](_0xfbfb('0xee'));}})[_0xfbfb('0x13')](function(){if(_0x4f7a58){return _0x4f7a58[_0xfbfb('0xef')]({'raw':!![]});}})[_0xfbfb('0x13')](function(_0x1a19c4){if(_0x4f7a58){var _0x218cd8=[];if(_0x1a19c4){_0x40abcc=_0x1a19c4;if(_0x40abcc[_0xfbfb('0x4c')]){for(var _0x19eeb0=0x0;_0x19eeb0<_0x40abcc['length'];_0x19eeb0++){_0x218cd8[_0xfbfb('0x48')]({'membername':_0x4f7a58[_0xfbfb('0x33')],'UserId':_0x4f7a58['id'],'queue_name':_0x40abcc[_0x19eeb0][_0xfbfb('0x33')],'VoiceQueueId':_0x40abcc[_0x19eeb0]['id'],'interface':_0x3a6915,'paused':_0x4f7a58['loginInPause']||![],'penalty':_0x40abcc[_0x19eeb0]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x218cd8,function(_0x3e8b1b){return db[_0xfbfb('0xa8')][_0xfbfb('0xa3')](_0x3e8b1b);});}}}})[_0xfbfb('0x13')](function(){if(_0x4f7a58){return db[_0xfbfb('0xf0')][_0xfbfb('0x49')]({'where':{'membername':_0x4f7a58[_0xfbfb('0x33')],'exitAt':null}});}})[_0xfbfb('0x13')](function(_0x550e59){if(_0x4f7a58){var _0x197321=[];_0x550e59[_0xfbfb('0xf1')](function(_0x5061fb){_0x197321[_0xfbfb('0x48')](_0x5061fb[_0xfbfb('0x24')]({'exitAt':moment()[_0xfbfb('0xa2')](_0xfbfb('0xf2'))}));});return BPromise[_0xfbfb('0x53')](_0x197321);}})[_0xfbfb('0x13')](function(){if(_0x4f7a58){var _0x5e430d=[];var _0x8f6d47=[];var _0x5472e6=utils[_0xfbfb('0xf3')]();var _0x3863ef={'membername':_0x4f7a58[_0xfbfb('0x33')],'interface':_0x3a6915,'enterAt':moment()[_0xfbfb('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4f7a58['role'],'internal':_0x4f7a58[_0xfbfb('0x61')]};_0x5472e6[_0xfbfb('0xf1')](function(_0x44fe4f){_0x5e430d[_0xfbfb('0x48')](_[_0xfbfb('0x5b')]({'channel':_0x44fe4f,'type':'LOGIN','data1':_0x314f29[_0xfbfb('0x5d')]['device'],'data2':_0x3a6915},_0x3863ef));if(_0x4f7a58['loginInPause']){_0x8f6d47[_0xfbfb('0x48')](_['merge']({'channel':_0x44fe4f,'type':'PAUSE','data1':'LOGININPAUSE'},_0x3863ef));}});return db[_0xfbfb('0xf0')]['bulkCreate'](_0x5e430d[_0xfbfb('0xbf')](_0x8f6d47),{'individualHooks':!![]});}})['then'](function(){if(_0x4f7a58){return _0x4f7a58[_0xfbfb('0x24')]({'online':!![],'lastLoginAt':moment()[_0xfbfb('0xa2')](_0xfbfb('0xf2')),'voicePause':_0x4f7a58[_0xfbfb('0xe5')]||![],'mailPause':_0x4f7a58['loginInPause']||![],'chatPause':_0x4f7a58['loginInPause']||![],'faxPause':_0x4f7a58[_0xfbfb('0xe5')]||![],'smsPause':_0x4f7a58['loginInPause']||![],'openchannelPause':_0x4f7a58[_0xfbfb('0xe5')]||![],'whatsappPause':_0x4f7a58[_0xfbfb('0xe5')]||![],'pauseType':_0x4f7a58[_0xfbfb('0xe5')]?_0xfbfb('0xf4'):null,'interface':_0x3a6915,'lastPauseAt':moment()['format'](_0xfbfb('0xf2'))});}})['then'](function(_0x2c75c1){if(_0x314f29['isMiddleware']){return _0x14fc2c();}else{return BPromise[_0xfbfb('0xf5')](_0x2c75c1)[_0xfbfb('0x13')](respondWithResult(_0x28e787,null));}})['catch'](handleError(_0x28e787,null));};exports[_0xfbfb('0xf6')]=function(_0x46490d,_0x570cb4){var _0xc785b7;return db[_0xfbfb('0x3a')][_0xfbfb('0x32')]({'where':{'id':_0x46490d[_0xfbfb('0x55')]['id'],'role':_0xfbfb('0x2b')},'attributes':['id',_0xfbfb('0x33'),_0xfbfb('0x26')]})[_0xfbfb('0x13')](handleEntityNotFound(_0x570cb4,null))[_0xfbfb('0x13')](function(_0x47c4d9){if(_0x47c4d9){_0xc785b7=_0x47c4d9;return db[_0xfbfb('0xa8')][_0xfbfb('0x35')]({'where':{'membername':_0xc785b7['name']},'individualHooks':!![]});}})[_0xfbfb('0x13')](function(){return db['MemberReport'][_0xfbfb('0x49')]({'where':{'membername':_0xc785b7[_0xfbfb('0x33')],'exitAt':null}});})['then'](function(_0x4a4a89){var _0x17b8d5=[];_0x4a4a89[_0xfbfb('0xf1')](function(_0x3d84fe){_0x17b8d5[_0xfbfb('0x48')](_0x3d84fe[_0xfbfb('0x24')]({'exitAt':moment()['format'](_0xfbfb('0xf2'))}));});return BPromise[_0xfbfb('0x53')](_0x17b8d5);})['then'](function(){return _0xc785b7['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x570cb4,null))[_0xfbfb('0x1b')](handleError(_0x570cb4,null));};exports['pause']=function(_0x559963,_0x175fa2){var _0x1f1cea;return db[_0xfbfb('0xa8')][_0xfbfb('0x24')]({'paused':0x1},{'where':{'UserId':_0x559963[_0xfbfb('0x55')]['id']},'individualHooks':!![]})[_0xfbfb('0x13')](function(){return db['User'][_0xfbfb('0x32')]({'where':{'id':_0x559963[_0xfbfb('0x55')]['id'],'role':_0xfbfb('0x2b')},'attributes':['id',_0xfbfb('0x33'),_0xfbfb('0x26'),_0xfbfb('0x61'),'interface']});})[_0xfbfb('0x13')](handleEntityNotFound(_0x175fa2,null))[_0xfbfb('0x13')](function(_0x485227){if(_0x485227){_0x1f1cea=_0x485227;return respondWithRpcPromise(_0xfbfb('0xf7'),_0xfbfb('0xf8'),{'id':_0x1f1cea['id'],'name':_0x1f1cea[_0xfbfb('0x33')],'pause':!![]});}})['then'](function(){if(_0x1f1cea){return db['MemberReport'][_0xfbfb('0x49')]({'where':{'membername':_0x1f1cea[_0xfbfb('0x33')],'type':_0xfbfb('0xf9'),'exitAt':null}});}})[_0xfbfb('0x13')](function(_0x285d2b){if(_0x285d2b[_0xfbfb('0x4c')]){var _0x1d5bce=moment()[_0xfbfb('0xa2')](_0xfbfb('0xf2'));for(var _0xbbef69=0x0,_0xb158c7=_0x285d2b[_0xfbfb('0x4c')];_0xbbef69<_0xb158c7;_0xbbef69++){_0x285d2b[_0xbbef69]['updateAttributes']({'exitAt':_0x1d5bce});}}})[_0xfbfb('0x13')](function(){var _0x404c17=[];var _0x277a76=utils[_0xfbfb('0xf3')]();_0x277a76[_0xfbfb('0xf1')](function(_0x4feed1){_0x404c17[_0xfbfb('0x48')]({'channel':_0x4feed1,'membername':_0x1f1cea[_0xfbfb('0x33')],'interface':_[_0xfbfb('0x65')](_0x1f1cea[_0xfbfb('0x96')])?util[_0xfbfb('0xa2')](_0xfbfb('0xe8'),_0x1f1cea[_0xfbfb('0x33')]):_0x1f1cea[_0xfbfb('0x96')],'type':_0xfbfb('0xf9'),'enterAt':moment()[_0xfbfb('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x559963[_0xfbfb('0x5d')][_0xfbfb('0xfa')]||'DEFAULT\x20PAUSE','role':_0x1f1cea[_0xfbfb('0x26')],'internal':_0x1f1cea[_0xfbfb('0x61')]});});return db[_0xfbfb('0xf0')][_0xfbfb('0x82')](_0x404c17,{'individualHooks':!![]});})[_0xfbfb('0x13')](function(){return _0x1f1cea[_0xfbfb('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x559963['body'][_0xfbfb('0xfa')]||_0xfbfb('0xfb'),'lastPauseAt':moment()[_0xfbfb('0xa2')](_0xfbfb('0xf2'))});})['then'](respondWithResult(_0x175fa2,null))['catch'](handleError(_0x175fa2,null));};exports[_0xfbfb('0xfc')]=function(_0x62b71f,_0x1f523a){var _0x236b25;return db[_0xfbfb('0x3a')][_0xfbfb('0x32')]({'where':{'id':_0x62b71f[_0xfbfb('0x55')]['id']},'attributes':['id',_0xfbfb('0x33'),_0xfbfb('0x26'),_0xfbfb('0x95'),_0xfbfb('0xfd'),_0xfbfb('0xfe'),_0xfbfb('0xff'),_0xfbfb('0x100'),_0xfbfb('0x101'),_0xfbfb('0x102'),_0xfbfb('0x103'),_0xfbfb('0x104')]})[_0xfbfb('0x13')](handleEntityNotFound(_0x1f523a,null))[_0xfbfb('0x13')](function(_0x187a00){if(_0x187a00){_0x236b25=_0x187a00;if(_0x62b71f[_0xfbfb('0x5d')][_0xfbfb('0xa5')]&&!utils[_0xfbfb('0x97')](_0x62b71f[_0xfbfb('0x5d')][_0xfbfb('0xa5')])){throw new db[(_0xfbfb('0x88'))][(_0xfbfb('0x89'))](_0xfbfb('0xce'));}switch(_0x62b71f[_0xfbfb('0x5d')][_0xfbfb('0xa5')]){case _0xfbfb('0xa1'):return respondWithRpcPromise('QueuePause',_0xfbfb('0xfc'),{'id':_0x236b25['id'],'name':_0x236b25[_0xfbfb('0x33')],'pause':![]})[_0xfbfb('0x13')](function(){return db[_0xfbfb('0xa8')][_0xfbfb('0x24')]({'paused':0x0},{'where':{'UserId':_0x236b25['id']},'individualHooks':!![]});})['then'](function(){return db[_0xfbfb('0xf0')][_0xfbfb('0x32')]({'where':{'channel':_0x62b71f[_0xfbfb('0x5d')][_0xfbfb('0xa5')],'membername':_0x236b25[_0xfbfb('0x33')],'type':_0xfbfb('0xf9'),'exitAt':null}});})[_0xfbfb('0x13')](function(_0x5c6cd4){if(_0x5c6cd4){return _0x5c6cd4['update']({'exitAt':moment()[_0xfbfb('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xfbfb('0x13')](function(){return _0x236b25[_0xfbfb('0x24')]({'voicePause':![]});});case _0xfbfb('0x51'):case _0xfbfb('0x4d'):case _0xfbfb('0x50'):case _0xfbfb('0x4f'):case _0xfbfb('0x52'):case _0xfbfb('0x5c'):return db[_0xfbfb('0xf0')][_0xfbfb('0x32')]({'where':{'channel':_0x62b71f[_0xfbfb('0x5d')][_0xfbfb('0xa5')],'membername':_0x236b25[_0xfbfb('0x33')],'type':'PAUSE','exitAt':null}})[_0xfbfb('0x13')](function(_0x19f320){if(_0x19f320){return _0x19f320['update']({'exitAt':moment()[_0xfbfb('0xa2')](_0xfbfb('0xf2')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xfbfb('0x13')](function(){var _0x18df98={};_[_0xfbfb('0x105')](_0x18df98,util['format'](_0xfbfb('0x106'),_0x62b71f['body']['channel'],'Pause'),![]);return _0x236b25['update'](_0x18df98);});default:return respondWithRpcPromise('QueuePause',_0xfbfb('0xfc'),{'id':_0x236b25['id'],'name':_0x236b25[_0xfbfb('0x33')],'pause':![]})[_0xfbfb('0x13')](function(){return db[_0xfbfb('0xa8')][_0xfbfb('0x24')]({'paused':0x0},{'where':{'UserId':_0x236b25['id']}});})['then'](function(){return db[_0xfbfb('0xf0')][_0xfbfb('0x49')]({'where':{'membername':_0x236b25[_0xfbfb('0x33')],'type':_0xfbfb('0xf9'),'exitAt':null}});})[_0xfbfb('0x13')](function(_0x1d677f){var _0x232298=[];_0x1d677f[_0xfbfb('0xf1')](function(_0x4d1025){_0x232298[_0xfbfb('0x48')](_0x4d1025[_0xfbfb('0x24')]({'exitAt':moment()[_0xfbfb('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'}));});return BPromise[_0xfbfb('0x53')](_0x232298);})['then'](function(){return _0x236b25[_0xfbfb('0x24')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x1f523a,null))[_0xfbfb('0x1b')](handleError(_0x1f523a,null));};exports['getTeams']=function(_0x57cb64,_0x1bba51){var _0x194b36={};var _0x5942b2={};var _0xfbac10;var _0x3a42a2;return db[_0xfbfb('0x3a')]['findOne']({'where':{'id':_0x57cb64[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x1bba51,null))[_0xfbfb('0x13')](function(_0x599f9b){if(_0x599f9b){_0xfbac10=_0x599f9b;_0x5942b2[_0xfbfb('0x56')]=_[_0xfbfb('0x57')](db[_0xfbfb('0x107')][_0xfbfb('0x58')]);_0x5942b2[_0xfbfb('0x41')]=_[_0xfbfb('0x57')](_0x57cb64[_0xfbfb('0x41')]);_0x5942b2[_0xfbfb('0x59')]=_['intersection'](_0x5942b2[_0xfbfb('0x56')],_0x5942b2['query']);_0x194b36[_0xfbfb('0x47')]=_['intersection'](_0x5942b2['model'],qs['fields'](_0x57cb64[_0xfbfb('0x41')][_0xfbfb('0x5a')]));_0x194b36[_0xfbfb('0x47')]=_0x194b36[_0xfbfb('0x47')]['length']?_0x194b36[_0xfbfb('0x47')]:_0x5942b2[_0xfbfb('0x56')];_0x194b36[_0xfbfb('0xc3')]=qs['sort'](_0x57cb64[_0xfbfb('0x41')][_0xfbfb('0xc4')]);_0x194b36['where']=qs[_0xfbfb('0x59')](_[_0xfbfb('0xc5')](_0x57cb64[_0xfbfb('0x41')],_0x5942b2[_0xfbfb('0x59')]));if(_0x57cb64[_0xfbfb('0x41')][_0xfbfb('0x2d')]){_0x194b36[_0xfbfb('0x40')]=_[_0xfbfb('0x5b')](_0x194b36['where'],{'$or':_[_0xfbfb('0x2f')](_0x194b36[_0xfbfb('0x47')],function(_0x1fbdb1){var _0x383f0e={};_0x383f0e[_0x1fbdb1]={'$like':'%'+_0x57cb64[_0xfbfb('0x41')][_0xfbfb('0x2d')]+'%'};return _0x383f0e;})});}_0x194b36=_[_0xfbfb('0x5b')]({},_0x194b36,_0x57cb64[_0xfbfb('0xc6')]);return _0xfbac10[_0xfbfb('0x108')](_0x194b36);}})[_0xfbfb('0x13')](function(_0x165108){if(_0x165108){_0x3a42a2=_0x165108[_0xfbfb('0x4c')];if(!_0x57cb64[_0xfbfb('0x41')][_0xfbfb('0xc7')]('nolimit')){_0x194b36[_0xfbfb('0x22')]=qs[_0xfbfb('0x22')](_0x57cb64[_0xfbfb('0x41')][_0xfbfb('0x22')]);_0x194b36[_0xfbfb('0x21')]=qs[_0xfbfb('0x21')](_0x57cb64['query']['offset']);}return _0xfbac10[_0xfbfb('0x108')](_0x194b36);}})['then'](function(_0xf3652){if(_0xf3652){return _0xf3652?{'count':_0x3a42a2,'rows':_0xf3652}:null;}})[_0xfbfb('0x13')](respondWithResult(_0x1bba51,null))['catch'](handleError(_0x1bba51,null));};exports[_0xfbfb('0x109')]=function(_0x3869fa,_0x21c77d){return db['User'][_0xfbfb('0x32')]({'where':{'id':_0x3869fa[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x21c77d,null))[_0xfbfb('0x13')](function(_0x1009d7){if(_0x1009d7){var _0x2267f3=_0x1009d7[_0xfbfb('0x25')]({'plain':!![]});return _0x1009d7[_0xfbfb('0x109')](_0x3869fa[_0xfbfb('0x5d')][_0xfbfb('0x60')],_['omit'](_0x3869fa[_0xfbfb('0x5d')],['ids','id'])||{})[_0xfbfb('0x13')](function(){for(var _0x3aef46=0x0;_0x3aef46<_0x3869fa['body']['ids'][_0xfbfb('0x4c')];_0x3aef46++){var _0x11b432=[];var _0x4314f8={};db[_0xfbfb('0x107')][_0xfbfb('0x8f')]({'where':{'id':_0x3869fa[_0xfbfb('0x5d')][_0xfbfb('0x60')][_0x3aef46]}})[_0xfbfb('0x13')](function(_0x45ac2e){_0x4314f8=_0x45ac2e[_0xfbfb('0x4e')];_0x11b432[_0xfbfb('0x48')](_0x45ac2e[_0xfbfb('0xef')]()[_0xfbfb('0x13')](function(_0xe6f525){for(var _0x15db6d=0x0;_0x15db6d<_0xe6f525[_0xfbfb('0x4c')];_0x15db6d++){_0xe6f525[_0x15db6d]['setDataValue'](_0xfbfb('0xa5'),_0xfbfb('0x10a'));}return _0xe6f525;}));_0x11b432[_0xfbfb('0x48')](_0x45ac2e[_0xfbfb('0x10b')]()[_0xfbfb('0x13')](function(_0x5a1868){for(var _0x166fcc=0x0;_0x166fcc<_0x5a1868['length'];_0x166fcc++){_0x5a1868[_0x166fcc][_0xfbfb('0x10c')]('channel',_0xfbfb('0x10d'));}return _0x5a1868;}));_0x11b432[_0xfbfb('0x48')](_0x45ac2e[_0xfbfb('0x10e')]()[_0xfbfb('0x13')](function(_0x2c6833){for(var _0x175278=0x0;_0x175278<_0x2c6833[_0xfbfb('0x4c')];_0x175278++){_0x2c6833[_0x175278][_0xfbfb('0x10c')](_0xfbfb('0xa5'),'Mail');}return _0x2c6833;}));_0x11b432[_0xfbfb('0x48')](_0x45ac2e['getSmsQueues']()['then'](function(_0x383251){for(var _0x25c4c7=0x0;_0x25c4c7<_0x383251[_0xfbfb('0x4c')];_0x25c4c7++){_0x383251[_0x25c4c7][_0xfbfb('0x10c')]('channel','Sms');}return _0x383251;}));_0x11b432[_0xfbfb('0x48')](_0x45ac2e[_0xfbfb('0x10f')]()[_0xfbfb('0x13')](function(_0x443a16){for(var _0x50d78c=0x0;_0x50d78c<_0x443a16[_0xfbfb('0x4c')];_0x50d78c++){_0x443a16[_0x50d78c][_0xfbfb('0x10c')](_0xfbfb('0xa5'),_0xfbfb('0x110'));}return _0x443a16;}));_0x11b432[_0xfbfb('0x48')](_0x45ac2e[_0xfbfb('0x111')]()[_0xfbfb('0x13')](function(_0x3662bb){for(var _0xffa8ae=0x0;_0xffa8ae<_0x3662bb[_0xfbfb('0x4c')];_0xffa8ae++){_0x3662bb[_0xffa8ae][_0xfbfb('0x10c')](_0xfbfb('0xa5'),'Fax');}return _0x3662bb;}));_0x11b432[_0xfbfb('0x48')](_0x45ac2e[_0xfbfb('0x112')]()[_0xfbfb('0x13')](function(_0xb680f8){for(var _0x48e12c=0x0;_0x48e12c<_0xb680f8[_0xfbfb('0x4c')];_0x48e12c++){_0xb680f8[_0x48e12c][_0xfbfb('0x10c')](_0xfbfb('0xa5'),_0xfbfb('0x113'));}return _0xb680f8;}));return BPromise[_0xfbfb('0x53')](_0x11b432);})['then'](function(_0x3ffe2f){var _0x440209=_[_0xfbfb('0x114')](_0x3ffe2f);_0x11b432=[];return db[_0xfbfb('0x67')]['transaction'](function(_0x616112){for(var _0x15d338=0x0;_0x15d338<_0x440209['length'];_0x15d338++){_0x11b432[_0xfbfb('0x48')](_0x440209[_0x15d338][_0xfbfb('0x115')](_0x2267f3['id']),{'transaction':_0x616112});}return BPromise[_0xfbfb('0x53')](_0x11b432)[_0xfbfb('0x13')](function(){if(_0x2267f3[_0xfbfb('0x94')]){return BPromise['each'](_[_0xfbfb('0x2d')](_0x440209,function(_0x1d6fac){return _0x1d6fac[_0xfbfb('0x116')](_0xfbfb('0xa5'))===_0xfbfb('0x10a');}),function(_0x110847){return db['UserVoiceQueueRt'][_0xfbfb('0xa3')]({'membername':_0x2267f3[_0xfbfb('0x33')],'UserId':_0x2267f3['id'],'queue_name':_0x110847[_0xfbfb('0x33')],'VoiceQueueId':_0x110847['id'],'interface':_[_0xfbfb('0x65')](_0x2267f3[_0xfbfb('0x96')])?util['format'](_0xfbfb('0xe8'),_0x2267f3[_0xfbfb('0x33')]):_0x2267f3[_0xfbfb('0x96')],'paused':_0x2267f3[_0xfbfb('0x95')]||![],'penalty':_0x2267f3['penalty']},{'transaction':_0x616112});});}else{return;}})[_0xfbfb('0x13')](function(){for(var _0x473467=0x0;_0x473467<_0x440209[_0xfbfb('0x4c')];_0x473467++){var _0x2a0d32=_0x440209[_0x473467][_0xfbfb('0x116')](_0xfbfb('0xa5'));var _0x5732e4=_0x2a0d32+_0xfbfb('0x9e');socket[_0xfbfb('0x9f')](_0xfbfb('0x29')+_0x2a0d32+_0xfbfb('0x117'),{'UserId':_0x2267f3['id'],['queueField']:_0x440209[_0x473467]['id']});}});});})[_0xfbfb('0x13')](function(){db['TeamVoicePrefix'][_0xfbfb('0x8f')]({'where':{'teamId':_0x4314f8['id']}})[_0xfbfb('0x13')](function(_0x2940f4){if(_0x2940f4){db[_0xfbfb('0x118')][_0xfbfb('0x7b')]({'UserId':_0x3869fa['params']['id'],'VoicePrefixId':_0x2940f4['VoicePrefixId']});}});});}});}})[_0xfbfb('0x13')](respondWithStatusCode(_0x21c77d,null))[_0xfbfb('0x1b')](handleError(_0x21c77d,null));};exports[_0xfbfb('0x119')]=function(_0x518b8c,_0x3f060a){return db['User'][_0xfbfb('0x8f')]({'where':{'id':_0x518b8c[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x3f060a,null))[_0xfbfb('0x13')](function(_0xa72b00){if(_0xa72b00){var _0x2f9912=_0xa72b00[_0xfbfb('0x25')]({'plain':!![]});var _0x423f72=_0x518b8c[_0xfbfb('0x41')][_0xfbfb('0x60')];return _0xa72b00[_0xfbfb('0x119')](_0x423f72)['then'](function(){for(var _0x435ad7=0x0;_0x435ad7<_0x423f72[_0xfbfb('0x4c')];_0x435ad7++){var _0x2bf6fd=[];var _0x205987={};db[_0xfbfb('0x107')][_0xfbfb('0x8f')]({'where':{'id':_0x423f72[_0x435ad7]}})[_0xfbfb('0x13')](function(_0x3b3008){_0x205987=_0x3b3008[_0xfbfb('0x4e')];_0x2bf6fd[_0xfbfb('0x48')](_0x3b3008[_0xfbfb('0xef')]()[_0xfbfb('0x13')](function(_0x34f0d5){for(var _0x287e9f=0x0;_0x287e9f<_0x34f0d5['length'];_0x287e9f++){_0x34f0d5[_0x287e9f][_0xfbfb('0x10c')](_0xfbfb('0xa5'),_0xfbfb('0x10a'));}return _0x34f0d5;}));_0x2bf6fd[_0xfbfb('0x48')](_0x3b3008[_0xfbfb('0x10b')]()[_0xfbfb('0x13')](function(_0x44d7c8){for(var _0x5a027c=0x0;_0x5a027c<_0x44d7c8['length'];_0x5a027c++){_0x44d7c8[_0x5a027c]['setDataValue']('channel',_0xfbfb('0x10d'));}return _0x44d7c8;}));_0x2bf6fd[_0xfbfb('0x48')](_0x3b3008[_0xfbfb('0x10e')]()[_0xfbfb('0x13')](function(_0x195391){for(var _0x2010fc=0x0;_0x2010fc<_0x195391[_0xfbfb('0x4c')];_0x2010fc++){_0x195391[_0x2010fc]['setDataValue'](_0xfbfb('0xa5'),_0xfbfb('0x11a'));}return _0x195391;}));_0x2bf6fd['push'](_0x3b3008[_0xfbfb('0x11b')]()[_0xfbfb('0x13')](function(_0x164db2){for(var _0x3318c6=0x0;_0x3318c6<_0x164db2[_0xfbfb('0x4c')];_0x3318c6++){_0x164db2[_0x3318c6][_0xfbfb('0x10c')](_0xfbfb('0xa5'),'Sms');}return _0x164db2;}));_0x2bf6fd[_0xfbfb('0x48')](_0x3b3008['getWhatsappQueues']()['then'](function(_0x38b240){for(var _0xdc8a37=0x0;_0xdc8a37<_0x38b240[_0xfbfb('0x4c')];_0xdc8a37++){_0x38b240[_0xdc8a37][_0xfbfb('0x10c')](_0xfbfb('0xa5'),_0xfbfb('0x110'));}return _0x38b240;}));_0x2bf6fd['push'](_0x3b3008['getFaxQueues']()[_0xfbfb('0x13')](function(_0x348955){for(var _0x5ba623=0x0;_0x5ba623<_0x348955['length'];_0x5ba623++){_0x348955[_0x5ba623][_0xfbfb('0x10c')]('channel',_0xfbfb('0x11c'));}return _0x348955;}));_0x2bf6fd['push'](_0x3b3008['getOpenchannelQueues']()[_0xfbfb('0x13')](function(_0x168cd8){for(var _0x4650cd=0x0;_0x4650cd<_0x168cd8['length'];_0x4650cd++){_0x168cd8[_0x4650cd][_0xfbfb('0x10c')]('channel',_0xfbfb('0x113'));}return _0x168cd8;}));return BPromise[_0xfbfb('0x53')](_0x2bf6fd);})[_0xfbfb('0x13')](function(_0x1a22f3){var _0x3dc72d=_[_0xfbfb('0x114')](_0x1a22f3);_0x2bf6fd=[];return db[_0xfbfb('0x67')][_0xfbfb('0x11d')](function(_0x514b46){for(var _0x16d2bd=0x0;_0x16d2bd<_0x3dc72d[_0xfbfb('0x4c')];_0x16d2bd++){_0x2bf6fd[_0xfbfb('0x48')](_0x3dc72d[_0x16d2bd]['removeAgent'](_0x2f9912['id']),{'transaction':_0x514b46});}return BPromise[_0xfbfb('0x53')](_0x2bf6fd)['then'](function(){if(_0x2f9912[_0xfbfb('0x94')]){return BPromise[_0xfbfb('0x85')](_['filter'](_0x3dc72d,function(_0x5b233c){return _0x5b233c[_0xfbfb('0x116')](_0xfbfb('0xa5'))==='Voice';}),function(_0x576c9c){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x576c9c['id'],'UserId':_0x2f9912['id']},'transaction':_0x514b46});});}else{return;}})[_0xfbfb('0x13')](function(){db[_0xfbfb('0x11e')]['findOne']({'where':{'teamId':_0x205987['id']}})[_0xfbfb('0x13')](function(_0x3d5552){if(_0x3d5552){return db['UserVoicePrefix'][_0xfbfb('0x35')]({'where':{'UserId':_0x2f9912['id'],'VoicePrefixId':_0x3d5552[_0xfbfb('0x4e')]['VoicePrefixId']}});}});})[_0xfbfb('0x13')](function(){for(var _0x50606a=0x0;_0x50606a<_0x3dc72d[_0xfbfb('0x4c')];_0x50606a++){var _0x1daf39=_0x3dc72d[_0x50606a][_0xfbfb('0x116')](_0xfbfb('0xa5'));var _0x3d25ce=_0x1daf39+_0xfbfb('0x9e');socket['emit']('user'+_0x1daf39+_0xfbfb('0xa7'),{'UserId':_0x2f9912['id'],['queueField']:_0x3dc72d[_0x50606a]['id']});}});});});}});}})[_0xfbfb('0x13')](respondWithStatusCode(_0x3f060a,null))[_0xfbfb('0x1b')](handleError(_0x3f060a,null));};exports[_0xfbfb('0x11f')]=function(_0x5ae058,_0x4e9223){var _0x2c4ce1={};var _0x3d11ef={};var _0x5bf946;var _0x30b5a8;return db['User']['findOne']({'where':{'id':_0x5ae058[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x4e9223,null))[_0xfbfb('0x13')](function(_0x20fd36){if(_0x20fd36){_0x5bf946=_0x20fd36;_0x3d11ef[_0xfbfb('0x56')]=_['keys'](db[_0xfbfb('0xc8')][_0xfbfb('0x58')]);_0x3d11ef['query']=_[_0xfbfb('0x57')](_0x5ae058[_0xfbfb('0x41')]);_0x3d11ef[_0xfbfb('0x59')]=_[_0xfbfb('0xc2')](_0x3d11ef[_0xfbfb('0x56')],_0x3d11ef[_0xfbfb('0x41')]);_0x2c4ce1[_0xfbfb('0x47')]=_[_0xfbfb('0xc2')](_0x3d11ef['model'],qs['fields'](_0x5ae058[_0xfbfb('0x41')][_0xfbfb('0x5a')]));_0x2c4ce1[_0xfbfb('0x47')]=_0x2c4ce1['attributes'][_0xfbfb('0x4c')]?_0x2c4ce1[_0xfbfb('0x47')]:_0x3d11ef['model'];_0x2c4ce1[_0xfbfb('0xc3')]=qs[_0xfbfb('0xc4')](_0x5ae058[_0xfbfb('0x41')][_0xfbfb('0xc4')]);_0x2c4ce1[_0xfbfb('0x40')]=qs[_0xfbfb('0x59')](_[_0xfbfb('0xc5')](_0x5ae058[_0xfbfb('0x41')],_0x3d11ef[_0xfbfb('0x59')]));if(_0x5ae058[_0xfbfb('0x41')][_0xfbfb('0x2d')]){_0x2c4ce1[_0xfbfb('0x40')]=_[_0xfbfb('0x5b')](_0x2c4ce1['where'],{'$or':_['map'](_0x2c4ce1['attributes'],function(_0x1d93e0){var _0x1e7722={};_0x1e7722[_0x1d93e0]={'$like':'%'+_0x5ae058[_0xfbfb('0x41')][_0xfbfb('0x2d')]+'%'};return _0x1e7722;})});}_0x2c4ce1=_[_0xfbfb('0x5b')]({},_0x2c4ce1,_0x5ae058[_0xfbfb('0xc6')]);return _0x5bf946[_0xfbfb('0x11f')](_0x2c4ce1);}})['then'](function(_0x445e11){if(_0x445e11){_0x30b5a8=_0x445e11['length'];if(!_0x5ae058[_0xfbfb('0x41')]['hasOwnProperty'](_0xfbfb('0xcc'))){_0x2c4ce1[_0xfbfb('0x22')]=qs[_0xfbfb('0x22')](_0x5ae058[_0xfbfb('0x41')][_0xfbfb('0x22')]);_0x2c4ce1[_0xfbfb('0x21')]=qs['offset'](_0x5ae058[_0xfbfb('0x41')]['offset']);}return _0x5bf946['getLists'](_0x2c4ce1);}})[_0xfbfb('0x13')](function(_0x14c3c0){if(_0x14c3c0){return _0x14c3c0?{'count':_0x30b5a8,'rows':_0x14c3c0}:null;}})['then'](respondWithResult(_0x4e9223,null))[_0xfbfb('0x1b')](handleError(_0x4e9223,null));};exports[_0xfbfb('0x120')]=function(_0x93927b,_0x410ca1){var _0x4ec03e={};var _0x3ecef2={};var _0x2878b6;return db[_0xfbfb('0x3a')]['findOne']({'where':{'id':_0x93927b[_0xfbfb('0x55')]['id']}})[_0xfbfb('0x13')](handleEntityNotFound(_0x410ca1,null))['then'](function(_0x4c3a30){if(_0x4c3a30){_0x2878b6=_0x4c3a30;_0x3ecef2['model']=_[_0xfbfb('0x57')](db['User'][_0xfbfb('0x58')]);_0x3ecef2[_0xfbfb('0x41')]=_[_0xfbfb('0x57')](_0x93927b['query']);_0x3ecef2[_0xfbfb('0x59')]=_[_0xfbfb('0xc2')](_0x3ecef2[_0xfbfb('0x56')],_0x3ecef2[_0xfbfb('0x41')]);_0x4ec03e[_0xfbfb('0x47')]=_[_0xfbfb('0xc2')](_0x3ecef2[_0xfbfb('0x56')],qs[_0xfbfb('0x5a')](_0x93927b['query'][_0xfbfb('0x5a')]));_0x4ec03e[_0xfbfb('0x47')]=_0x4ec03e[_0xfbfb('0x47')][_0xfbfb('0x4c')]?_0x4ec03e['attributes']:_0x3ecef2[_0xfbfb('0x56')];_0x4ec03e[_0xfbfb('0xc3')]=qs[_0xfbfb('0xc4')](_0x93927b[_0xfbfb('0x41')]['sort']);_0x4ec03e['where']=qs['filters'](_[_0xfbfb('0xc5')](_0x93927b[_0xfbfb('0x41')],_0x3ecef2[_0xfbfb('0x59')]));if(_0x93927b['query'][_0xfbfb('0x2d')]){_0x4ec03e['where']=_['merge'](_0x4ec03e[_0xfbfb('0x40')],{'$or':_[_0xfbfb('0x2f')](_0x4ec03e[_0xfbfb('0x47')],function(_0x3c5911){var _0x1a8d74={};_0x1a8d74[_0x3c5911]={'$like':'%'+_0x93927b[_0xfbfb('0x41')][_0xfbfb('0x2d')]+'%'};return _0x1a8d74;})});}_0x4ec03e[_0xfbfb('0x56')]=db[_0xfbfb('0x3a')];_0x4ec03e['as']='Agents';_0x4ec03e=_[_0xfbfb('0x5b')]({},_0x4ec03e,_0x93927b[_0xfbfb('0xc6')]);return _0x2878b6[_0xfbfb('0xef')]({'include':[_0x4ec03e]});}})[_0xfbfb('0x13')](function(_0x5c7f2b){if(_0x5c7f2b){var _0x71f716={},_0x5adb61=[];for(var _0x3c8b39=0x0;_0x3c8b39<_0x5c7f2b['length'];_0x3c8b39+=0x1){for(var _0x2178f4=0x0,_0x17d832;_0x2178f4<_0x5c7f2b[_0x3c8b39]['Agents'][_0xfbfb('0x4c')];_0x2178f4+=0x1){_0x17d832=_0x5c7f2b[_0x3c8b39][_0xfbfb('0x2a')][_0x2178f4][_0xfbfb('0x25')]({'plain':!![]});_0x71f716[_0x17d832['id']]=_0x17d832;}}_0x71f716=_[_0xfbfb('0x121')](_0x71f716);for(var _0x5f15a1=qs[_0xfbfb('0x21')](_0x93927b[_0xfbfb('0x41')][_0xfbfb('0x21')]);_0x5f15a1<_0x71f716[_0xfbfb('0x4c')]&&_0x5adb61[_0xfbfb('0x4c')]=_0x2f9089){_0x3ede52=_0x2f9089;_0x294560=0xc8;}else{_0x294560=0xce;}_0xdd3b87[_0x08b0('0x1b')](_0x294560);return _0xdd3b87['set'](_0x08b0('0x21'),_0x384ced+'-'+_0x3ede52+'/'+_0x2f9089)[_0x08b0('0x1c')](_0x48cd00);}return null;};}function saveUpdates(_0x51ef0b){return function(_0x4edc70){if(_0x4edc70){return _0x4edc70[_0x08b0('0x22')](_0x51ef0b)[_0x08b0('0x12')](function(_0x48de2c){return _0x48de2c;});}return null;};}function removeEntity(_0x4e0cf1){return function(_0x34aab5){if(_0x34aab5){return _0x34aab5['destroy']()[_0x08b0('0x12')](function(){var _0x21ca87=_0x34aab5[_0x08b0('0x23')]({'plain':!![]});if(_0x21ca87['role']===_0x08b0('0x24'))return;var _0x19fd4d=[{'name':_0x08b0('0x25'),'value':_0x08b0('0x26'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x08b0('0x27'),'value':_0x08b0('0x28'),'ignore':![]}];var _0x2e90af=_(_0x19fd4d)[_0x08b0('0x29')]('ignore')['map'](_0x08b0('0x2a'))[_0x08b0('0x2a')]();if(_['includes'](_0x2e90af,_0x21ca87[_0x08b0('0x2b')])){return;}var _0x521d9c=_[_0x08b0('0x2c')](_0x19fd4d,[_0x08b0('0x2a'),_0x21ca87[_0x08b0('0x2b')]])[_0x08b0('0x2d')];return db['UserProfileResource'][_0x08b0('0x2e')]({'where':{'type':_0x521d9c,'resourceId':_0x21ca87['id']}})['then'](function(){return _0x34aab5;});})['then'](function(){_0x4e0cf1[_0x08b0('0x1b')](0xcc)[_0x08b0('0x2f')]();});}};}function handleEntityNotFound(_0x1e18d7){return function(_0x2064d2){if(!_0x2064d2){_0x1e18d7[_0x08b0('0x1a')](0x194);}return _0x2064d2;};}function handleError(_0x205b24,_0x157008){_0x157008=_0x157008||0x1f4;return function(_0xb542ea){logger[_0x08b0('0x15')](_0xb542ea[_0x08b0('0x30')]);if(_0xb542ea[_0x08b0('0x2d')]){delete _0xb542ea[_0x08b0('0x2d')];}_0x205b24['status'](_0x157008)[_0x08b0('0x31')](_0xb542ea);};}exports[_0x08b0('0x32')]=function(_0x7a67bf,_0x7151f4){var _0x57fa0d={},_0xf88b0f={'count':0x0,'rows':[]};var _0x4061bb=_(db[_0x08b0('0x33')]['rawAttributes'])[_0x08b0('0x34')](function(_0x4a7c38){return{'name':_0x4a7c38['fieldName'],'type':_0x4a7c38['type']['key']};})['filter'](function(_0x2f641a){return!_[_0x08b0('0x35')](['password',_0x08b0('0x36')],_0x2f641a[_0x08b0('0x2d')]);})[_0x08b0('0x2a')]();_0x57fa0d=qs['getOptions'](_0x4061bb,_0x7a67bf);var _0x5405f3={'where':_0x57fa0d['where']};return db[_0x08b0('0x33')][_0x08b0('0x20')](_0x5405f3)[_0x08b0('0x12')](function(_0x155565){_0xf88b0f[_0x08b0('0x20')]=_0x155565;if(_0x7a67bf['query'][_0x08b0('0x37')]){_0x57fa0d[_0x08b0('0x38')]=[{'all':!![]}];}if(_0x7a67bf[_0x08b0('0x39')][_0x08b0('0x3a')]===_0x08b0('0x3b')){_0x57fa0d[_0x08b0('0x38')]=[{'model':db[_0x08b0('0x3c')],'as':_0x08b0('0x3a')}];}if(!_[_0x08b0('0x35')](_0x57fa0d[_0x08b0('0x3d')],'id')){_0x57fa0d[_0x08b0('0x3d')][_0x08b0('0x3e')]('id');}return db['User'][_0x08b0('0x3f')](_0x57fa0d);})[_0x08b0('0x12')](function(_0x20aee1){_0xf88b0f[_0x08b0('0x40')]=_0x20aee1;if(_0x7a67bf[_0x08b0('0x39')][_0x08b0('0x41')]==='true'){var _0x9f860=[];for(var _0x2c354d=0x0;_0x2c354d<_0xf88b0f[_0x08b0('0x40')][_0x08b0('0x42')];_0x2c354d++){_0x9f860[_0x08b0('0x3e')](get_open_tabs(_0x08b0('0x43'),_0xf88b0f[_0x08b0('0x40')][_0x2c354d][_0x08b0('0x44')]));_0x9f860[_0x08b0('0x3e')](get_open_tabs(_0x08b0('0x45'),_0xf88b0f[_0x08b0('0x40')][_0x2c354d][_0x08b0('0x44')]));_0x9f860[_0x08b0('0x3e')](get_open_tabs('fax',_0xf88b0f['rows'][_0x2c354d][_0x08b0('0x44')]));_0x9f860[_0x08b0('0x3e')](get_open_tabs('mail',_0xf88b0f['rows'][_0x2c354d][_0x08b0('0x44')]));_0x9f860[_0x08b0('0x3e')](get_open_tabs('openchannel',_0xf88b0f['rows'][_0x2c354d]['dataValues']));_0x9f860[_0x08b0('0x3e')](get_open_tabs('whatsapp',_0xf88b0f['rows'][_0x2c354d][_0x08b0('0x44')]));}return BPromise['all'](_0x9f860)['then'](function(){return _0xf88b0f;});}else{return _0xf88b0f;}})[_0x08b0('0x12')](respondWithFilteredResult(_0x7151f4,_0x57fa0d))['catch'](handleError(_0x7151f4,null));};exports[_0x08b0('0x46')]=function(_0x28fdd3,_0x468a16){var _0x3a0204={'raw':![],'where':{'id':_0x28fdd3[_0x08b0('0x47')]['id']}},_0xb00621={};_0xb00621[_0x08b0('0x48')]=_['differenceBy'](_[_0x08b0('0x49')](db[_0x08b0('0x33')][_0x08b0('0x4a')]),[_0x08b0('0x4b'),_0x08b0('0x36')]);_0xb00621['query']=_['keys'](_0x28fdd3[_0x08b0('0x39')]);_0xb00621[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0xb00621['model'],_0xb00621[_0x08b0('0x39')]);_0x3a0204[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0xb00621['model'],qs[_0x08b0('0x4e')](_0x28fdd3['query'][_0x08b0('0x4e')]));_0x3a0204['attributes']=_0x3a0204[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x3a0204[_0x08b0('0x3d')]:_0xb00621[_0x08b0('0x48')];if(_0x28fdd3['query'][_0x08b0('0x37')]){_0x3a0204[_0x08b0('0x38')]=[{'all':!![]}];}if(_0x28fdd3['query']['userSetting']==='true'){_0x3a0204[_0x08b0('0x38')]=[{'model':db[_0x08b0('0x3c')],'as':_0x08b0('0x3a')}];}_0x3a0204=_['merge']({},_0x3a0204,_0x28fdd3['options']);if(!_[_0x08b0('0x35')](_0x3a0204[_0x08b0('0x3d')],'id')){_0x3a0204[_0x08b0('0x3d')][_0x08b0('0x3e')]('id');}return db[_0x08b0('0x33')][_0x08b0('0x2c')](_0x3a0204)[_0x08b0('0x12')](handleEntityNotFound(_0x468a16,null))[_0x08b0('0x12')](function(_0x10dd99){var _0x2a4261=[];values=_0x10dd99;if(_0x28fdd3['query'][_0x08b0('0x41')]===_0x08b0('0x3b')){_0x2a4261[_0x08b0('0x3e')](get_open_tabs('chat',_0x10dd99['dataValues']));_0x2a4261['push'](get_open_tabs(_0x08b0('0x45'),_0x10dd99[_0x08b0('0x44')]));_0x2a4261[_0x08b0('0x3e')](get_open_tabs('openchannel',_0x10dd99[_0x08b0('0x44')]));_0x2a4261[_0x08b0('0x3e')](get_open_tabs(_0x08b0('0x4f'),_0x10dd99[_0x08b0('0x44')]));_0x2a4261[_0x08b0('0x3e')](get_open_tabs('fax',_0x10dd99[_0x08b0('0x44')]));_0x2a4261[_0x08b0('0x3e')](get_open_tabs('mail',_0x10dd99['dataValues']));return BPromise[_0x08b0('0x50')](_0x2a4261);}else{return values;}})[_0x08b0('0x12')](function(){return values;})[_0x08b0('0x12')](respondWithResult(_0x468a16,null))[_0x08b0('0x19')](handleError(_0x468a16,null));};exports[_0x08b0('0x22')]=function(_0x48faa0,_0x4bdb64){if(_0x48faa0['body']['id']){delete _0x48faa0[_0x08b0('0x51')]['id'];}delete _0x48faa0[_0x08b0('0x51')][_0x08b0('0x2b')];return db['User']['find']({'where':{'id':_0x48faa0['params']['id']}})['then'](handleEntityNotFound(_0x4bdb64,null))[_0x08b0('0x12')](saveUpdates(_0x48faa0[_0x08b0('0x51')],null))['then'](respondWithResult(_0x4bdb64,null))[_0x08b0('0x19')](handleError(_0x4bdb64,null));};exports['describe']=function(_0x1fc3b9,_0x279cd1){return db[_0x08b0('0x33')][_0x08b0('0x52')]()[_0x08b0('0x12')](respondWithResult(_0x279cd1,null))[_0x08b0('0x19')](handleError(_0x279cd1,null));};exports[_0x08b0('0x53')]=function(_0x1fab96,_0x2d536d){return db['User'][_0x08b0('0x2c')]({'where':{'id':_0x1fab96[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x2d536d,null))[_0x08b0('0x12')](function(_0x50c513){if(_0x50c513){return _0x50c513[_0x08b0('0x53')](_0x1fab96[_0x08b0('0x51')][_0x08b0('0x54')],_[_0x08b0('0x55')](_0x1fab96[_0x08b0('0x51')],[_0x08b0('0x54'),'id'])||{});}})[_0x08b0('0x12')](respondWithResult(_0x2d536d,null))[_0x08b0('0x19')](handleError(_0x2d536d,null));};function validateUser(_0x80ab52){return new BPromise(function(_0x298f88,_0x4ca5a2){if(_0x80ab52[_0x08b0('0x56')])return _0x298f88(_0x80ab52);return db['Setting']['findById'](0x1)[_0x08b0('0x12')](function(_0x38159e){if(_0x38159e[_0x08b0('0x57')])authService[_0x08b0('0x58')](_0x80ab52[_0x08b0('0x4b')]);db['User'][_0x08b0('0x59')](_0x08b0('0x56'))[_0x08b0('0x12')](function(_0x1d5af9){if(_['isNil'](_0x1d5af9)){_0x80ab52[_0x08b0('0x56')]=_0x38159e[_0x08b0('0x5a')]||0x1;return;}if(_[_0x08b0('0x5b')](_0x38159e[_0x08b0('0x5a')])||_0x38159e['min_internal']===_0x1d5af9){_0x80ab52[_0x08b0('0x56')]=_0x1d5af9+0x1;return;}if(_0x38159e[_0x08b0('0x5a')]>_0x1d5af9){_0x80ab52[_0x08b0('0x56')]=_0x38159e[_0x08b0('0x5a')];return;}return db['sequelize'][_0x08b0('0x39')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x08b0('0x5c')][_0x08b0('0x5d')][_0x08b0('0x5e')]})[_0x08b0('0x12')](function(_0x2b654c){if(_0x2b654c&&_0x2b654c[_0x08b0('0x42')]){for(var _0x18fd99=0x0,_0x10bc0e=_0x2b654c['length'];_0x18fd99<_0x10bc0e&&_[_0x08b0('0x5b')](_0x80ab52['internal']);_0x18fd99++){if(_0x38159e['min_internal']<=_0x2b654c[_0x18fd99][_0x08b0('0x5f')]){_0x80ab52[_0x08b0('0x56')]=_0x2b654c[_0x18fd99][_0x08b0('0x5f')];}else if(_0x38159e['min_internal']>_0x2b654c[_0x18fd99]['from']&&_0x38159e[_0x08b0('0x5a')]<=_0x2b654c[_0x18fd99]['to']){_0x80ab52[_0x08b0('0x56')]=_0x38159e[_0x08b0('0x5a')];}}}if(_[_0x08b0('0x5b')](_0x80ab52[_0x08b0('0x56')])){_0x80ab52['internal']=_0x1d5af9+0x1;}return _0x298f88(_0x80ab52);});});})['catch'](function(_0x4538db){_0x4ca5a2(_0x4538db);});});}function updateUser(_0x383280){return new BPromise(function(_0x2036be,_0x8644b5){try{if(_0x383280[_0x08b0('0x60')]){_0x383280[_0x08b0('0x61')]=_0x383280[_0x08b0('0x56')];_0x383280['VoiceMail']={'mailbox':_0x383280[_0x08b0('0x56')],'password':_0x383280[_0x08b0('0x4b')],'fullname':_0x383280[_0x08b0('0x62')],'email':_0x383280[_0x08b0('0x63')]};}if(_0x383280[_0x08b0('0x2b')]===_0x08b0('0x64')){if(!_0x383280[_0x08b0('0x65')])_0x383280['permissions']=[_0x08b0('0x66'),_0x08b0('0x67'),_0x08b0('0x68'),'113',_0x08b0('0x69'),_0x08b0('0x6a'),'105',_0x08b0('0x6b'),_0x08b0('0x6c'),_0x08b0('0x6d'),_0x08b0('0x6e'),_0x08b0('0x6f'),_0x08b0('0x70'),_0x08b0('0x71'),'115'];}_0x2036be(_0x383280);}catch(_0x3eb183){_0x8644b5(_0x3eb183);}});}exports[_0x08b0('0x72')]=function(_0x4dcfd5,_0x56cdff){if(_0x4dcfd5[_0x08b0('0x26')]['role']===_0x08b0('0x64'))throw new Error('Unauthorized');if(_0x4dcfd5['body']['role']===_0x08b0('0x26')&&_0x4dcfd5[_0x08b0('0x26')][_0x08b0('0x2b')]!==_0x08b0('0x24')){throw new Error(_0x08b0('0x73'));}if(_0x4dcfd5[_0x08b0('0x51')][_0x08b0('0x2b')]===_0x08b0('0x24')&&_0x4dcfd5[_0x08b0('0x26')][_0x08b0('0x2b')]!==_0x08b0('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x08b0('0x74')]([_0x4dcfd5[_0x08b0('0x51')]])[_0x08b0('0x12')](function(){return validateUser(_0x4dcfd5[_0x08b0('0x51')]);})[_0x08b0('0x12')](function(_0x1fb34d){return updateUser(_0x1fb34d)[_0x08b0('0x12')](function(_0x469050){if(_0x469050[_0x08b0('0x2b')]===_0x08b0('0x24')){_0x469050['settingsEnabled']=_0x4dcfd5[_0x08b0('0x26')][_0x08b0('0x75')];delete _0x469050[_0x08b0('0x76')];}return _0x469050;});})['then'](function(_0x128194){return db[_0x08b0('0x33')]['create'](_0x128194,{'include':[{'model':db['VoiceMail'],'as':_0x08b0('0x77')}]});})[_0x08b0('0x12')](function(_0x3faa13){if(_0x4dcfd5[_0x08b0('0x51')][_0x08b0('0x2b')]===_0x08b0('0x26'))return _0x3faa13;if(_0x4dcfd5[_0x08b0('0x26')][_0x08b0('0x2b')]!==_0x08b0('0x26'))return _0x3faa13;return db[_0x08b0('0x78')]['find']({'where':{'name':_0x3faa13[_0x08b0('0x2b')]==='agent'?_0x08b0('0x79'):_0x08b0('0x27'),'userProfileId':_0x4dcfd5[_0x08b0('0x26')]['userProfileId']},'raw':!![]})['then'](function(_0x3d908c){if(!_0x3d908c||_0x3d908c[_0x08b0('0x7a')]!=0x0)return _0x3faa13;return db[_0x08b0('0x7b')][_0x08b0('0x72')]({'name':_0x3faa13[_0x08b0('0x2d')],'resourceId':_0x3faa13['id'],'type':_0x3d908c[_0x08b0('0x2d')],'sectionId':_0x3d908c['id']},{})[_0x08b0('0x12')](function(){return _0x3faa13;});})['catch'](function(_0x271ee4){logger[_0x08b0('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ee4);throw _0x271ee4;});})[_0x08b0('0x12')](respondWithResult(_0x56cdff,0xc9))[_0x08b0('0x19')](handleError(_0x56cdff,null));};exports[_0x08b0('0x7c')]=function(_0x31979e,_0xc36cf4){var _0x514547=_0x31979e[_0x08b0('0x51')];var _0x9e6539=[];if(_0x31979e[_0x08b0('0x26')][_0x08b0('0x2b')]===_0x08b0('0x64'))throw new Error(_0x08b0('0x7d'));if(_[_0x08b0('0x7e')](_0x514547,['role',_0x08b0('0x26')])&&_0x31979e['user']['role']!=='admin'){throw new Error(_0x08b0('0x73'));}if(_[_0x08b0('0x7e')](_0x514547,[_0x08b0('0x2b'),'admin'])&&_0x31979e[_0x08b0('0x26')][_0x08b0('0x2b')]!==_0x08b0('0x24')){throw new Error(_0x08b0('0x7f'));}return licenseUtil['checkUserLimits'](_0x514547)[_0x08b0('0x12')](function(){return validateUser(_0x514547[0x0]);})['then'](function(){for(var _0x56c89c=0x1;_0x56c89c<_0x514547[_0x08b0('0x42')];_0x56c89c++){var _0x5eba9a=_0x514547[_0x56c89c-0x1][_0x08b0('0x56')];if(!_0x514547[_0x56c89c][_0x08b0('0x56')])_0x514547[_0x56c89c][_0x08b0('0x56')]=_0x5eba9a+0x1;_0x9e6539[_0x08b0('0x3e')](validateUser(_0x514547[_0x56c89c]));}return BPromise[_0x08b0('0x50')](_0x9e6539);})[_0x08b0('0x12')](function(){_0x9e6539=[];for(var _0x13a9a9=0x0;_0x13a9a9<_0x514547[_0x08b0('0x42')];_0x13a9a9++){_0x9e6539[_0x08b0('0x3e')](updateUser(_0x514547[_0x13a9a9]));}return BPromise['all'](_0x9e6539);})[_0x08b0('0x12')](function(){return BPromise[_0x08b0('0x80')](_0x514547,function(_0x41bb95){return db['User']['create'](_0x41bb95,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})['then'](function(_0x18c476){_0x41bb95['id']=_0x18c476['id'];return _0x41bb95;});});})['then'](function(_0x42795e){if(_0x31979e[_0x08b0('0x51')]['role']===_0x08b0('0x26'))return _0x42795e;if(_0x31979e[_0x08b0('0x26')][_0x08b0('0x2b')]!==_0x08b0('0x26'))return _0x42795e;var _0x409a4f=_['some'](_0x42795e,function(_0x1edd00){return _0x1edd00[_0x08b0('0x2b')]===_0x08b0('0x64')||_0x1edd00[_0x08b0('0x2b')]==='telephone';});if(!_0x409a4f)return _0x42795e;return db[_0x08b0('0x78')][_0x08b0('0x3f')]({'where':{'name':{'$or':[_0x08b0('0x79'),_0x08b0('0x27')]},'userProfileId':_0x31979e[_0x08b0('0x26')][_0x08b0('0x76')]},'raw':!![]})[_0x08b0('0x12')](function(_0x1524a1){if(_[_0x08b0('0x81')](_0x1524a1)||!_[_0x08b0('0x7e')](_0x1524a1,[_0x08b0('0x7a'),0x0]))return _0x42795e;_0x9e6539=[];var _0x351778=_(_0x1524a1)['map'](function(_0x2450f1){if(_0x2450f1['autoAssociation']===0x1)return;return _0x2450f1[_0x08b0('0x2d')]===_0x08b0('0x79')?_0x08b0('0x64'):_0x08b0('0x28');})[_0x08b0('0x82')]()[_0x08b0('0x2a')]();for(var _0x20cb68=0x0;_0x20cb68<_0x42795e[_0x08b0('0x42')];_0x20cb68++){if(!_[_0x08b0('0x35')](_0x351778,_0x42795e[_0x20cb68][_0x08b0('0x2b')]))return;var _0x28a827=_0x42795e[_0x20cb68][_0x08b0('0x2b')]===_0x08b0('0x64')?_0x08b0('0x79'):'Telephones';_0x9e6539[_0x08b0('0x3e')](db[_0x08b0('0x7b')]['create']({'name':_0x42795e[_0x20cb68]['name'],'resourceId':_0x42795e[_0x20cb68]['id'],'type':_0x28a827,'sectionId':_[_0x08b0('0x2c')](_0x1524a1,[_0x08b0('0x2d'),_0x28a827])['id']},{}));}return BPromise['all'](_0x9e6539);});})[_0x08b0('0x12')](respondWithResult(_0xc36cf4,0xc9))[_0x08b0('0x19')](handleError(_0xc36cf4,null));};exports[_0x08b0('0x83')]=function(_0x17c236,_0x1963bb){if(_0x17c236[_0x08b0('0x51')]['id']){delete _0x17c236[_0x08b0('0x51')]['id'];}return db[_0x08b0('0x33')]['find']({'where':{'id':_0x17c236['params']['id']}})[_0x08b0('0x12')](function(_0x37198d){if(!_0x37198d)return null;if(_0x37198d['id']===_0x17c236[_0x08b0('0x26')]['id']){if(!_0x17c236[_0x08b0('0x51')][_0x08b0('0x84')]||!_0x17c236['body']['newPassword']){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x87'));}if(!_0x37198d['authenticate'](_0x17c236[_0x08b0('0x51')][_0x08b0('0x84')])){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))]('Wrong\x20credentials');}if(_0x17c236[_0x08b0('0x51')][_0x08b0('0x84')]===_0x17c236[_0x08b0('0x51')][_0x08b0('0x88')]){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x89'));}}else if(_0x17c236[_0x08b0('0x26')][_0x08b0('0x2b')]===_0x08b0('0x24')){if(!_0x17c236[_0x08b0('0x51')][_0x08b0('0x88')]){throw new db[(_0x08b0('0x85'))]['ValidationError'](_0x08b0('0x8a'));}}else if(_0x17c236[_0x08b0('0x26')][_0x08b0('0x2b')]===_0x08b0('0x26')){if(!_0x17c236[_0x08b0('0x51')][_0x08b0('0x88')]){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x8a'));}if(_0x37198d[_0x08b0('0x2b')]!==_0x08b0('0x64')){throw new db[(_0x08b0('0x85'))]['ValidationError'](_0x08b0('0x7d'));}}else{throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x7d'));}return _0x37198d;})['then'](handleEntityNotFound(_0x1963bb,null))['then'](function(_0xe3327a){return db['Setting'][_0x08b0('0x8b')]({'attributes':['id',_0x08b0('0x57'),'enforcePasswordHistory',_0x08b0('0x8c')]})[_0x08b0('0x12')](function(_0xcdd843){if(_0xcdd843[_0x08b0('0x57')])authService[_0x08b0('0x58')](_0x17c236['body'][_0x08b0('0x88')]);if(!_0xcdd843[_0x08b0('0x8d')]||!_0xe3327a[_0x08b0('0x8e')])return _0xe3327a;authService[_0x08b0('0x8f')](_0x17c236[_0x08b0('0x51')]['newPassword'],_0xe3327a['previousPasswords'],_0xcdd843[_0x08b0('0x8c')]);return _0xe3327a;})['then'](saveUpdates({'password':_0x17c236['body'][_0x08b0('0x88')],'passwordResetAt':_0x17c236[_0x08b0('0x26')]['id']==_0x17c236[_0x08b0('0x47')]['id']?moment():null,'previousPasswords':authService[_0x08b0('0x90')](_0x17c236[_0x08b0('0x51')][_0x08b0('0x88')],_0xe3327a['previousPasswords'])},null));})[_0x08b0('0x12')](respondWithResult(_0x1963bb,null))[_0x08b0('0x19')](handleError(_0x1963bb,null));};exports[_0x08b0('0x91')]=function(_0x539333,_0x3d71cd){var _0x42f7d4=_0x539333[_0x08b0('0x51')][_0x08b0('0x92')];return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x539333[_0x08b0('0x47')]['id']},'attributes':['id',_0x08b0('0x2d'),_0x08b0('0x2b'),_0x08b0('0x93'),_0x08b0('0x94'),_0x08b0('0x95'),'interface']})[_0x08b0('0x12')](handleEntityNotFound(_0x3d71cd,null))[_0x08b0('0x12')](function(_0x297f73){if(_0x297f73){if(!utils['isValidChannel'](_0x42f7d4)){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x96'));}return _0x297f73[_0x08b0('0x97')+_[_0x08b0('0x98')](_0x42f7d4[_0x08b0('0x99')]())+'Queues'](_0x539333[_0x08b0('0x51')][_0x08b0('0x54')],{'penalty':_0x539333['body']['penalty']||0x0})[_0x08b0('0x9a')](function(_0x3d24df){for(var _0x1706f4=0x0;_0x1706f4<_0x539333[_0x08b0('0x51')][_0x08b0('0x54')][_0x08b0('0x42')];_0x1706f4+=0x1){var _0x5a4f49={'UserId':Number(_0x539333['params']['id'])};_0x5a4f49[_[_0x08b0('0x98')](_0x42f7d4[_0x08b0('0x99')]())+'QueueId']=Number(_0x539333[_0x08b0('0x51')][_0x08b0('0x54')][_0x1706f4]);socket[_0x08b0('0x9b')]('user'+_[_0x08b0('0x98')](_0x42f7d4['toLowerCase']())+_0x08b0('0x9c'),_0x5a4f49);}return _0x3d24df;})[_0x08b0('0x12')](function(){if(_0x42f7d4===_0x08b0('0x9d')){return db[_0x08b0('0x9e')][_0x08b0('0x3f')]({'where':{'id':_0x539333[_0x08b0('0x51')][_0x08b0('0x54')]||[]},'raw':!![],'attributes':['id',_0x08b0('0x2d')]});}})['then'](function(_0x5c05e2){var _0x1ec4f6=_0x297f73['get']({'plain':!![]});var _0x4691ce=[];if(_0x42f7d4===_0x08b0('0x9d')&&_0x1ec4f6[_0x08b0('0x2b')]==='agent'&&_0x1ec4f6[_0x08b0('0x93')]){for(var _0x51b273=0x0;_0x51b273<_0x5c05e2[_0x08b0('0x42')];_0x51b273+=0x1){_0x4691ce['push']({'membername':_0x1ec4f6[_0x08b0('0x2d')],'UserId':_0x1ec4f6['id'],'queue_name':_0x5c05e2[_0x51b273][_0x08b0('0x2d')],'VoiceQueueId':_0x5c05e2[_0x51b273]['id'],'interface':_[_0x08b0('0x5b')](_0x1ec4f6[_0x08b0('0x9f')])?util[_0x08b0('0xa0')](_0x08b0('0xa1'),_0x1ec4f6[_0x08b0('0x2d')]):_0x1ec4f6[_0x08b0('0x9f')],'paused':_0x1ec4f6[_0x08b0('0x95')]||![],'penalty':_0x539333[_0x08b0('0x51')][_0x08b0('0xa2')]||0x0});}return BPromise[_0x08b0('0x80')](_0x4691ce,function(_0x4135c8){return db[_0x08b0('0xa3')][_0x08b0('0xa4')](_0x4135c8);});}return _0x297f73;});}})['then'](respondWithStatusCode(_0x3d71cd,null))[_0x08b0('0x19')](handleError(_0x3d71cd,null));};exports['removeQueues']=function(_0x2026e7,_0xc003a7){var _0x332188,_0x30b008;return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x2026e7[_0x08b0('0x47')]['id']},'attributes':['id',_0x08b0('0x2d'),_0x08b0('0x2b')]})[_0x08b0('0x12')](handleEntityNotFound(_0xc003a7,null))['then'](function(_0x10e86f){if(_0x10e86f){_0x332188=_0x10e86f;if(!_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')]||!utils['isValidChannel'](_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')])){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x96'));}return _0x10e86f[_0x08b0('0xa5')+_['capitalize'](_0x2026e7[_0x08b0('0x39')]['channel'][_0x08b0('0x99')]())+_0x08b0('0xa6')](_0x2026e7[_0x08b0('0x39')]['ids']);}})[_0x08b0('0x12')](function(_0x410225){if(_[_0x08b0('0xa7')](_0x2026e7[_0x08b0('0x39')][_0x08b0('0x54')])){for(var _0x8f6417=0x0;_0x8f6417<_0x2026e7[_0x08b0('0x39')][_0x08b0('0x54')]['length'];_0x8f6417+=0x1){_0x30b008={'UserId':Number(_0x2026e7[_0x08b0('0x47')]['id'])};_0x30b008[_['capitalize'](_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')][_0x08b0('0x99')]())+'QueueId']=Number(_0x2026e7[_0x08b0('0x39')][_0x08b0('0x54')][_0x8f6417]);socket[_0x08b0('0x9b')](_0x08b0('0x26')+_['capitalize'](_0x2026e7['query']['channel'][_0x08b0('0x99')]())+_0x08b0('0xa8'),_0x30b008);}}else{_0x30b008={'UserId':Number(_0x2026e7[_0x08b0('0x47')]['id'])};_0x30b008[_['capitalize'](_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')][_0x08b0('0x99')]())+'QueueId']=Number(_0x2026e7[_0x08b0('0x39')][_0x08b0('0x54')]);socket[_0x08b0('0x9b')](_0x08b0('0x26')+_[_0x08b0('0x98')](_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')]['toLowerCase']())+_0x08b0('0xa8'),_0x30b008);}return _0x410225;})[_0x08b0('0x12')](function(){if(_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')]==='voice'){return db[_0x08b0('0xa3')][_0x08b0('0x2e')]({'where':{'UserId':_0x2026e7['params']['id'],'VoiceQueueId':_0x2026e7[_0x08b0('0x39')][_0x08b0('0x54')]},'individualHooks':!![]})[_0x08b0('0x12')](function(){return _0x332188;});}return _0x332188;})[_0x08b0('0x12')](respondWithStatusCode(_0xc003a7,null))[_0x08b0('0x19')](handleError(_0xc003a7,null));};exports[_0x08b0('0xa9')]=function(_0xfd190c,_0x51e332){_0xfd190c[_0x08b0('0x51')][_0x08b0('0xaa')]=_0xfd190c[_0x08b0('0xab')][_0x08b0('0xac')];return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0xfd190c[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x51e332,null))['then'](saveUpdates(_0xfd190c[_0x08b0('0x51')],null))[_0x08b0('0x12')](respondWithResult(_0x51e332,null))[_0x08b0('0x19')](handleError(_0x51e332,null));};exports[_0x08b0('0xad')]=function(_0x4b95f8,_0x1ea4aa){var _0x4b32d5=path[_0x08b0('0xae')](config[_0x08b0('0xaf')],_0x08b0('0xb0'));return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x4b95f8['params']['id']},'attributes':['id',_0x08b0('0xaa')],'raw':!![]})[_0x08b0('0x12')](handleEntityNotFound(_0x1ea4aa,null))['then'](function(_0x143f84){if(_0x143f84){if(_[_0x08b0('0x5b')](_0x143f84[_0x08b0('0xaa')])){return _0x1ea4aa[_0x08b0('0xb1')](_0x4b32d5);}else{if(!fs[_0x08b0('0xb2')](path[_0x08b0('0xae')](config[_0x08b0('0xaf')],_0x08b0('0xb3'),_0x143f84['userpic']))){return _0x1ea4aa[_0x08b0('0xb1')](_0x4b32d5);}return _0x1ea4aa['download'](path[_0x08b0('0xae')](config['root'],'server/files/images/',_0x143f84[_0x08b0('0xaa')]));}}})[_0x08b0('0x19')](handleError(_0x1ea4aa,null));};exports[_0x08b0('0xb4')]=function(_0x2325e6,_0x2ab28b){return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x2325e6[_0x08b0('0x47')]['id']},'attributes':['id']})[_0x08b0('0x12')](handleEntityNotFound(_0x2ab28b,null))['then'](function(_0x446848){var _0x5071fa=[];values=_0x446848[_0x08b0('0x44')];_0x5071fa[_0x08b0('0x3e')](get_open_tabs(_0x08b0('0x43'),_0x446848[_0x08b0('0x44')]));_0x5071fa['push'](get_open_tabs(_0x08b0('0x45'),_0x446848[_0x08b0('0x44')]));_0x5071fa[_0x08b0('0x3e')](get_open_tabs('openchannel',_0x446848['dataValues']));_0x5071fa[_0x08b0('0x3e')](get_open_tabs('whatsapp',_0x446848[_0x08b0('0x44')]));_0x5071fa[_0x08b0('0x3e')](get_open_tabs('fax',_0x446848['dataValues']));_0x5071fa['push'](get_open_tabs(_0x08b0('0xb5'),_0x446848['dataValues']));return BPromise[_0x08b0('0x50')](_0x5071fa);})[_0x08b0('0x12')](function(_0x2efeaa){if(_0x2efeaa){var _0x3d6516=_[_0x08b0('0x34')](values['ChatOpenTabs'],function(_0x53dc76){return{'channel':_0x08b0('0xb6'),'id':_0x53dc76['id'],'createdAt':_0x53dc76['createdAt']};});var _0x317a13=_[_0x08b0('0x34')](values[_0x08b0('0xb7')],function(_0x47565a){return{'channel':_0x08b0('0xb8'),'id':_0x47565a['id'],'createdAt':_0x47565a[_0x08b0('0xb9')]};});var _0x181f43=_[_0x08b0('0x34')](values['OpenchannelOpenTabs'],function(_0x1ef43f){return{'channel':_0x08b0('0xba'),'id':_0x1ef43f['id'],'createdAt':_0x1ef43f[_0x08b0('0xb9')]};});var _0x3e8e5b=_[_0x08b0('0x34')](values['MailOpenTabs'],function(_0xd18b4){return{'channel':_0x08b0('0xbb'),'id':_0xd18b4['id'],'createdAt':_0xd18b4[_0x08b0('0xb9')]};});var _0x5565aa=_[_0x08b0('0x34')](values[_0x08b0('0xbc')],function(_0x2d300e){return{'channel':_0x08b0('0xbd'),'id':_0x2d300e['id'],'createdAt':_0x2d300e['createdAt']};});var _0x42d7c4=_[_0x08b0('0x34')](values[_0x08b0('0xbe')],function(_0x14f57c){return{'channel':'WHATSAPP','id':_0x14f57c['id'],'createdAt':_0x14f57c[_0x08b0('0xb9')]};});var _0x5c7ea3=_['concat'](_0x3d6516,_0x317a13,_0x181f43,_0x3e8e5b,_0x5565aa,_0x42d7c4);var _0x4cc441={'count':_0x5c7ea3[_0x08b0('0x42')],'rows':_0x5c7ea3};return _0x4cc441;}else return null;})[_0x08b0('0x12')](respondWithResult(_0x2ab28b,null))[_0x08b0('0x19')](handleError(_0x2ab28b,null));};exports[_0x08b0('0xbf')]=function(_0x385a24,_0x24922a){var _0x1734d4={};var _0x7ca4ba={};var _0x525068;var _0x462746;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x385a24[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x24922a,null))[_0x08b0('0x12')](function(_0x3e0860){if(_0x3e0860){_0x525068=_0x3e0860;_0x7ca4ba['model']=_[_0x08b0('0x49')](db[_0x08b0('0xc0')]['rawAttributes']);_0x7ca4ba[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x385a24[_0x08b0('0x39')]);_0x7ca4ba[_0x08b0('0x4c')]=_['intersection'](_0x7ca4ba[_0x08b0('0x48')],_0x7ca4ba[_0x08b0('0x39')]);_0x1734d4['attributes']=_[_0x08b0('0x4d')](_0x7ca4ba[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x385a24[_0x08b0('0x39')]['fields']));_0x1734d4[_0x08b0('0x3d')]=_0x1734d4[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x1734d4[_0x08b0('0x3d')]:_0x7ca4ba[_0x08b0('0x48')];_0x1734d4['order']=qs[_0x08b0('0xc1')](_0x385a24[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x1734d4[_0x08b0('0xc2')]=qs['filters'](_[_0x08b0('0xc3')](_0x385a24[_0x08b0('0x39')],_0x7ca4ba[_0x08b0('0x4c')]));if(_0x385a24[_0x08b0('0x39')][_0x08b0('0x29')]){_0x1734d4[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x1734d4[_0x08b0('0xc2')],{'$or':_['map'](_0x1734d4['attributes'],function(_0x299990){var _0x126ca1={};_0x126ca1[_0x299990]={'$like':'%'+_0x385a24[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x126ca1;})});}_0x1734d4=_[_0x08b0('0xc4')]({},_0x1734d4,_0x385a24['options']);return _0x525068[_0x08b0('0xbf')](_0x1734d4);}})[_0x08b0('0x12')](function(_0x22de23){if(_0x22de23){_0x462746=_0x22de23[_0x08b0('0x42')];if(_0x385a24['query']['hasOwnProperty'](_0x08b0('0x37'))){_0x1734d4[_0x08b0('0x38')]=[{'model':db['CmList'],'as':_0x08b0('0xc5'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x08b0('0x2d'),'color'],'where':_0x385a24[_0x08b0('0x39')][_0x08b0('0xc6')]?{'id':_0x385a24[_0x08b0('0x39')][_0x08b0('0xc6')]}:undefined,'required':_0x385a24['query'][_0x08b0('0xc6')]?!![]:![]}];}if(!_0x385a24[_0x08b0('0x39')]['hasOwnProperty']('nolimit')){_0x1734d4[_0x08b0('0x1e')]=qs['limit'](_0x385a24['query'][_0x08b0('0x1e')]);_0x1734d4[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x385a24[_0x08b0('0x39')][_0x08b0('0x1d')]);}return _0x525068[_0x08b0('0xbf')](_0x1734d4);}})[_0x08b0('0x12')](function(_0x2eace7){if(_0x2eace7){return _0x2eace7?{'count':_0x462746,'rows':_0x2eace7}:null;}})[_0x08b0('0x12')](respondWithResult(_0x24922a,null))[_0x08b0('0x19')](handleError(_0x24922a,null));};exports[_0x08b0('0xc7')]=function(_0x509f5e,_0x59eaee){var _0x3276f6;var _0x3c8fb5={};var _0xf574fd;return db['User'][_0x08b0('0x8b')]({'where':{'id':_0x509f5e['params']['id']},'attributes':['id','name',_0x08b0('0x2b')]})[_0x08b0('0x12')](handleEntityNotFound(_0x59eaee,null))[_0x08b0('0x12')](function(_0x39a8c){if(!utils[_0x08b0('0xc8')](_0x509f5e['query'][_0x08b0('0x92')])){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x96'));}_0x3276f6=_0x39a8c;var _0x14baf0={};_0x14baf0[_0x08b0('0x48')]=_[_0x08b0('0x49')](db[_['capitalize'](_0x509f5e[_0x08b0('0x39')]['channel'])+'Queue'][_0x08b0('0x4a')]);_0x14baf0[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x509f5e[_0x08b0('0x39')]);_0x14baf0[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0x14baf0[_0x08b0('0x48')],_0x14baf0['query']);_0x3c8fb5[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x14baf0['model'],qs[_0x08b0('0x4e')](_0x509f5e['query'][_0x08b0('0x4e')]));_0x3c8fb5[_0x08b0('0x3d')]=_0x3c8fb5[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x3c8fb5[_0x08b0('0x3d')]:_0x14baf0['model'];_0x3c8fb5[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x509f5e[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x3c8fb5[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x509f5e[_0x08b0('0x39')],_0x14baf0[_0x08b0('0x4c')]));if(_0x509f5e[_0x08b0('0x39')][_0x08b0('0x29')]){_0x3c8fb5[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x3c8fb5['where'],{'$or':_[_0x08b0('0x34')](_0x3c8fb5[_0x08b0('0x3d')],function(_0x50297d){var _0x4046ea={};_0x4046ea[_0x50297d]={'$like':'%'+_0x509f5e['query']['filter']+'%'};return _0x4046ea;})});}_0x3c8fb5=_[_0x08b0('0xc4')]({},_0x3c8fb5,_0x509f5e[_0x08b0('0xca')]);switch(_0x3276f6['role']){case _0x08b0('0x24'):return db[_[_0x08b0('0x98')](_0x509f5e[_0x08b0('0x39')]['channel'])+'Queue'][_0x08b0('0x3f')](_0x3c8fb5);case _0x08b0('0x26'):case'agent':return _0x3276f6[_0x08b0('0x23')+_[_0x08b0('0x98')](_0x509f5e[_0x08b0('0x39')][_0x08b0('0x92')])+_0x08b0('0xa6')](_0x3c8fb5);default:throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0xcb'));}})[_0x08b0('0x12')](function(_0x549adf){_0xf574fd=_0x549adf['length'];if(!_0x509f5e[_0x08b0('0x39')]['hasOwnProperty'](_0x08b0('0xcc'))){_0x3c8fb5['limit']=qs[_0x08b0('0x1e')](_0x509f5e[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x3c8fb5[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x509f5e[_0x08b0('0x39')][_0x08b0('0x1d')]);}switch(_0x3276f6[_0x08b0('0x2b')]){case _0x08b0('0x24'):return db[_['capitalize'](_0x509f5e['query'][_0x08b0('0x92')])+_0x08b0('0xcd')][_0x08b0('0x3f')](_0x3c8fb5);case _0x08b0('0x26'):case _0x08b0('0x64'):return _0x3276f6[_0x08b0('0x23')+_[_0x08b0('0x98')](_0x509f5e['query'][_0x08b0('0x92')])+_0x08b0('0xa6')](_0x3c8fb5);}})[_0x08b0('0x12')](function(_0x43820f){return{'count':_0xf574fd,'rows':_0x43820f};})[_0x08b0('0x12')](respondWithResult(_0x59eaee,null))[_0x08b0('0x19')](handleError(_0x59eaee,null));};exports['getVoiceQueuesRt']=function(_0x103080,_0xb48600){var _0x379b00={};var _0x4aa842={};var _0x2e1331;var _0x2ca158;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x103080[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0xb48600,null))[_0x08b0('0x12')](function(_0x6208d6){if(_0x6208d6){_0x2e1331=_0x6208d6;_0x4aa842[_0x08b0('0x48')]=_['keys'](db[_0x08b0('0xa3')]['rawAttributes']);_0x4aa842[_0x08b0('0x39')]=_['keys'](_0x103080[_0x08b0('0x39')]);_0x4aa842['filters']=_[_0x08b0('0x4d')](_0x4aa842[_0x08b0('0x48')],_0x4aa842[_0x08b0('0x39')]);_0x379b00[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x4aa842[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x103080[_0x08b0('0x39')][_0x08b0('0x4e')]));_0x379b00[_0x08b0('0x3d')]=_0x379b00[_0x08b0('0x3d')]['length']?_0x379b00[_0x08b0('0x3d')]:_0x4aa842['model'];_0x379b00[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x103080[_0x08b0('0x39')]['sort']);_0x379b00['where']=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x103080[_0x08b0('0x39')],_0x4aa842[_0x08b0('0x4c')]));if(_0x103080[_0x08b0('0x39')]['filter']){_0x379b00[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x379b00['where'],{'$or':_['map'](_0x379b00[_0x08b0('0x3d')],function(_0x5586e9){var _0x38d71b={};_0x38d71b[_0x5586e9]={'$like':'%'+_0x103080[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x38d71b;})});}_0x379b00=_[_0x08b0('0xc4')]({},_0x379b00,_0x103080[_0x08b0('0xca')]);return _0x2e1331[_0x08b0('0xce')](_0x379b00);}})[_0x08b0('0x12')](function(_0x462723){if(_0x462723){_0x2ca158=_0x462723[_0x08b0('0x42')];if(!_0x103080[_0x08b0('0x39')][_0x08b0('0xcf')]('nolimit')){_0x379b00[_0x08b0('0x1e')]=qs['limit'](_0x103080[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x379b00['offset']=qs[_0x08b0('0x1d')](_0x103080[_0x08b0('0x39')]['offset']);}return _0x2e1331[_0x08b0('0xce')](_0x379b00);}})[_0x08b0('0x12')](function(_0x1d3b05){if(_0x1d3b05){return _0x1d3b05?{'count':_0x2ca158,'rows':_0x1d3b05}:null;}})[_0x08b0('0x12')](respondWithResult(_0xb48600,null))[_0x08b0('0x19')](handleError(_0xb48600,null));};exports[_0x08b0('0xd0')]=function(_0x5324c2,_0x39f669){var _0x3d2543={};var _0x4acc56={};var _0x1e2b58;var _0x526084;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x5324c2[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x39f669,null))[_0x08b0('0x12')](function(_0x3fd367){if(_0x3fd367){_0x1e2b58=_0x3fd367;_0x4acc56['model']=_[_0x08b0('0x49')](db[_0x08b0('0xd1')][_0x08b0('0x4a')]);_0x4acc56[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x5324c2[_0x08b0('0x39')]);_0x4acc56[_0x08b0('0x4c')]=_['intersection'](_0x4acc56[_0x08b0('0x48')],_0x4acc56[_0x08b0('0x39')]);_0x3d2543['attributes']=_[_0x08b0('0x4d')](_0x4acc56['model'],qs['fields'](_0x5324c2['query']['fields']));_0x3d2543['attributes']=_0x3d2543[_0x08b0('0x3d')]['length']?_0x3d2543['attributes']:_0x4acc56['model'];_0x3d2543['order']=qs['sort'](_0x5324c2[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x3d2543['where']=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x5324c2[_0x08b0('0x39')],_0x4acc56[_0x08b0('0x4c')]));if(_0x5324c2[_0x08b0('0x39')]['filter']){_0x3d2543[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x3d2543['where'],{'$or':_[_0x08b0('0x34')](_0x3d2543['attributes'],function(_0x215323){var _0x3b152c={};_0x3b152c[_0x215323]={'$like':'%'+_0x5324c2[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x3b152c;})});}_0x3d2543=_[_0x08b0('0xc4')]({},_0x3d2543,_0x5324c2[_0x08b0('0xca')]);return _0x1e2b58[_0x08b0('0xd0')](_0x3d2543);}})[_0x08b0('0x12')](function(_0x5cf2fa){if(_0x5cf2fa){_0x526084=_0x5cf2fa[_0x08b0('0x42')];if(!_0x5324c2[_0x08b0('0x39')]['hasOwnProperty'](_0x08b0('0xcc'))){_0x3d2543[_0x08b0('0x1e')]=qs[_0x08b0('0x1e')](_0x5324c2['query'][_0x08b0('0x1e')]);_0x3d2543[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x5324c2[_0x08b0('0x39')][_0x08b0('0x1d')]);}return _0x1e2b58['getGroups'](_0x3d2543);}})['then'](function(_0x28ea50){if(_0x28ea50){return _0x28ea50?{'count':_0x526084,'rows':_0x28ea50}:null;}})[_0x08b0('0x12')](respondWithResult(_0x39f669,null))[_0x08b0('0x19')](handleError(_0x39f669,null));};exports[_0x08b0('0xd2')]=function(_0x7b4690,_0x2e5e81){var _0x48fe86={'raw':!![],'where':{}};var _0x55ba56={};var _0x17f621={'count':0x0,'rows':[]};return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x7b4690[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x2e5e81,null))[_0x08b0('0x12')](function(_0x358165){if(_0x358165){_0x55ba56[_0x08b0('0x48')]=_[_0x08b0('0x49')](db[_0x08b0('0xd3')][_0x08b0('0x4a')]);_0x55ba56[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x7b4690['query']);_0x55ba56['filters']=_['intersection'](_0x55ba56[_0x08b0('0x48')],_0x55ba56[_0x08b0('0x39')]);_0x48fe86['attributes']=_[_0x08b0('0x4d')](_0x55ba56['model'],qs[_0x08b0('0x4e')](_0x7b4690[_0x08b0('0x39')]['fields']));_0x48fe86[_0x08b0('0x3d')]=_0x48fe86[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x48fe86['attributes']:_0x55ba56[_0x08b0('0x48')];if(!_0x7b4690['query'][_0x08b0('0xcf')](_0x08b0('0xcc'))){_0x48fe86['limit']=qs[_0x08b0('0x1e')](_0x7b4690['query'][_0x08b0('0x1e')]);_0x48fe86['offset']=qs[_0x08b0('0x1d')](_0x7b4690[_0x08b0('0x39')][_0x08b0('0x1d')]);}_0x48fe86[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x7b4690[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x48fe86[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x7b4690[_0x08b0('0x39')],_0x55ba56[_0x08b0('0x4c')]));_0x48fe86[_0x08b0('0xc2')]['UserId']=_0x358165['id'];if(_0x7b4690[_0x08b0('0x39')][_0x08b0('0x29')]){_0x48fe86['where']=_['merge'](_0x48fe86[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0x48fe86[_0x08b0('0x3d')],function(_0xdd2175){var _0x76d97a={};_0x76d97a[_0xdd2175]={'$like':'%'+_0x7b4690['query']['filter']+'%'};return _0x76d97a;})});}_0x48fe86=_[_0x08b0('0xc4')]({},_0x48fe86,_0x7b4690[_0x08b0('0xca')]);return db[_0x08b0('0xd3')]['count']({'where':_0x48fe86[_0x08b0('0xc2')]})['then'](function(_0x226eab){_0x17f621['count']=_0x226eab;if(_0x7b4690[_0x08b0('0x39')]['includeAll']){_0x48fe86[_0x08b0('0x38')]=[{'all':!![]}];}return db[_0x08b0('0xd3')][_0x08b0('0x3f')](_0x48fe86);})['then'](function(_0x3dbb9c){_0x17f621[_0x08b0('0x40')]=_0x3dbb9c;return _0x17f621;});}})[_0x08b0('0x12')](respondWithFilteredResult(_0x2e5e81,_0x48fe86))[_0x08b0('0x19')](handleError(_0x2e5e81,null));};exports[_0x08b0('0xd4')]=function(_0x52f4e3,_0x5d6066){var _0x395c08={'raw':!![],'where':{}};var _0xab444e={};var _0x18a91f={'count':0x0,'rows':[]};return db[_0x08b0('0x33')]['findOne']({'where':{'id':_0x52f4e3[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x5d6066,null))['then'](function(_0x5335b1){if(_0x5335b1){_0xab444e[_0x08b0('0x48')]=_[_0x08b0('0x49')](db['ScreenRecording']['rawAttributes']);_0xab444e['query']=_['keys'](_0x52f4e3[_0x08b0('0x39')]);_0xab444e[_0x08b0('0x4c')]=_['intersection'](_0xab444e[_0x08b0('0x48')],_0xab444e[_0x08b0('0x39')]);_0x395c08[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0xab444e[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x52f4e3['query'][_0x08b0('0x4e')]));_0x395c08['attributes']=_0x395c08['attributes']['length']?_0x395c08[_0x08b0('0x3d')]:_0xab444e[_0x08b0('0x48')];if(!_0x52f4e3[_0x08b0('0x39')][_0x08b0('0xcf')](_0x08b0('0xcc'))){_0x395c08[_0x08b0('0x1e')]=qs['limit'](_0x52f4e3[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x395c08[_0x08b0('0x1d')]=qs['offset'](_0x52f4e3[_0x08b0('0x39')][_0x08b0('0x1d')]);}_0x395c08[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x52f4e3[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x395c08['where']=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x52f4e3[_0x08b0('0x39')],_0xab444e[_0x08b0('0x4c')]));_0x395c08[_0x08b0('0xc2')][_0x08b0('0xd5')]=_0x5335b1['id'];if(_0x52f4e3[_0x08b0('0x39')]['filter']){_0x395c08['where']=_['merge'](_0x395c08['where'],{'$or':_['map'](_0x395c08[_0x08b0('0x3d')],function(_0x28f89a){var _0x5904eb={};_0x5904eb[_0x28f89a]={'$like':'%'+_0x52f4e3[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x5904eb;})});}_0x395c08=_[_0x08b0('0xc4')]({},_0x395c08,_0x52f4e3[_0x08b0('0xca')]);return db['ScreenRecording']['count']({'where':_0x395c08[_0x08b0('0xc2')]})[_0x08b0('0x12')](function(_0x4dc85a){_0x18a91f[_0x08b0('0x20')]=_0x4dc85a;if(_0x52f4e3[_0x08b0('0x39')]['includeAll']){_0x395c08[_0x08b0('0x38')]=[{'all':!![]}];}return db[_0x08b0('0xd6')]['findAll'](_0x395c08);})[_0x08b0('0x12')](function(_0x53115b){_0x18a91f['rows']=_0x53115b;return _0x18a91f;});}})[_0x08b0('0x12')](respondWithFilteredResult(_0x5d6066,_0x395c08))[_0x08b0('0x19')](handleError(_0x5d6066,null));};exports[_0x08b0('0xd7')]=function(_0x5e9711,_0x16ea70){var _0x3fb1be={};var _0x3ae739={};var _0x2268b2;var _0xaa792c;return db[_0x08b0('0x33')]['findOne']({'where':{'id':_0x5e9711[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x16ea70,null))[_0x08b0('0x12')](function(_0x312e3e){if(_0x312e3e){_0x2268b2=_0x312e3e;_0x3ae739['model']=_['keys'](db[_0x08b0('0xd8')][_0x08b0('0x4a')]);_0x3ae739[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x5e9711[_0x08b0('0x39')]);_0x3ae739['filters']=_[_0x08b0('0x4d')](_0x3ae739[_0x08b0('0x48')],_0x3ae739['query']);_0x3fb1be[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x3ae739[_0x08b0('0x48')],qs['fields'](_0x5e9711['query'][_0x08b0('0x4e')]));_0x3fb1be[_0x08b0('0x3d')]=_0x3fb1be[_0x08b0('0x3d')]['length']?_0x3fb1be[_0x08b0('0x3d')]:_0x3ae739[_0x08b0('0x48')];_0x3fb1be['order']=qs[_0x08b0('0xc1')](_0x5e9711[_0x08b0('0x39')]['sort']);_0x3fb1be[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x5e9711[_0x08b0('0x39')],_0x3ae739[_0x08b0('0x4c')]));if(_0x5e9711[_0x08b0('0x39')][_0x08b0('0x29')]){_0x3fb1be[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x3fb1be['where'],{'$or':_['map'](_0x3fb1be['attributes'],function(_0x397627){var _0x35b5e5={};_0x35b5e5[_0x397627]={'$like':'%'+_0x5e9711[_0x08b0('0x39')]['filter']+'%'};return _0x35b5e5;})});}_0x3fb1be=_[_0x08b0('0xc4')]({},_0x3fb1be,_0x5e9711[_0x08b0('0xca')]);return _0x2268b2[_0x08b0('0xd7')](_0x3fb1be);}})['then'](function(_0x5ec571){if(_0x5ec571){_0xaa792c=_0x5ec571[_0x08b0('0x42')];if(!_0x5e9711[_0x08b0('0x39')][_0x08b0('0xcf')](_0x08b0('0xcc'))){_0x3fb1be['limit']=qs[_0x08b0('0x1e')](_0x5e9711[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x3fb1be['offset']=qs[_0x08b0('0x1d')](_0x5e9711[_0x08b0('0x39')]['offset']);}return _0x2268b2['getChatInteractions'](_0x3fb1be);}})['then'](function(_0x2aa195){if(_0x2aa195){return _0x2aa195?{'count':_0xaa792c,'rows':_0x2aa195}:null;}})[_0x08b0('0x12')](respondWithResult(_0x16ea70,null))['catch'](handleError(_0x16ea70,null));};exports[_0x08b0('0xd9')]=function(_0x40f493,_0x5b9135){var _0x1bddff={};var _0x2452fc={};var _0x246b9b;var _0x13cd7a;return db['User'][_0x08b0('0x8b')]({'where':{'id':_0x40f493['params']['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x5b9135,null))['then'](function(_0xbe3d62){if(_0xbe3d62){_0x246b9b=_0xbe3d62;_0x2452fc[_0x08b0('0x48')]=_[_0x08b0('0x49')](db['OpenchannelInteraction'][_0x08b0('0x4a')]);_0x2452fc[_0x08b0('0x39')]=_['keys'](_0x40f493['query']);_0x2452fc['filters']=_[_0x08b0('0x4d')](_0x2452fc[_0x08b0('0x48')],_0x2452fc['query']);_0x1bddff[_0x08b0('0x3d')]=_['intersection'](_0x2452fc[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x40f493['query']['fields']));_0x1bddff[_0x08b0('0x3d')]=_0x1bddff[_0x08b0('0x3d')]['length']?_0x1bddff[_0x08b0('0x3d')]:_0x2452fc['model'];_0x1bddff['order']=qs[_0x08b0('0xc1')](_0x40f493[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x1bddff[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x40f493[_0x08b0('0x39')],_0x2452fc[_0x08b0('0x4c')]));if(_0x40f493[_0x08b0('0x39')][_0x08b0('0x29')]){_0x1bddff[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x1bddff[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0x1bddff[_0x08b0('0x3d')],function(_0x4a5bf9){var _0x3e8115={};_0x3e8115[_0x4a5bf9]={'$like':'%'+_0x40f493['query'][_0x08b0('0x29')]+'%'};return _0x3e8115;})});}_0x1bddff=_[_0x08b0('0xc4')]({},_0x1bddff,_0x40f493[_0x08b0('0xca')]);return _0x246b9b[_0x08b0('0xd9')](_0x1bddff);}})['then'](function(_0x510051){if(_0x510051){_0x13cd7a=_0x510051[_0x08b0('0x42')];if(!_0x40f493[_0x08b0('0x39')][_0x08b0('0xcf')](_0x08b0('0xcc'))){_0x1bddff[_0x08b0('0x1e')]=qs['limit'](_0x40f493[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x1bddff[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x40f493['query'][_0x08b0('0x1d')]);}return _0x246b9b[_0x08b0('0xd9')](_0x1bddff);}})[_0x08b0('0x12')](function(_0x14cf4e){if(_0x14cf4e){return _0x14cf4e?{'count':_0x13cd7a,'rows':_0x14cf4e}:null;}})['then'](respondWithResult(_0x5b9135,null))['catch'](handleError(_0x5b9135,null));};exports[_0x08b0('0xda')]=function(_0x50a992,_0x3d8ab5){var _0x1b9bdc={'raw':!![],'where':{}};var _0x37e536={};var _0x23dd41={'count':0x0,'rows':[]};return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x50a992[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x3d8ab5,null))['then'](function(_0x494102){if(_0x494102){_0x37e536[_0x08b0('0x48')]=_['keys'](db[_0x08b0('0xdb')][_0x08b0('0x4a')]);_0x37e536['query']=_[_0x08b0('0x49')](_0x50a992[_0x08b0('0x39')]);_0x37e536[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0x37e536[_0x08b0('0x48')],_0x37e536['query']);_0x1b9bdc[_0x08b0('0x3d')]=_['intersection'](_0x37e536[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x50a992['query'][_0x08b0('0x4e')]));_0x1b9bdc[_0x08b0('0x3d')]=_0x1b9bdc[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x1b9bdc[_0x08b0('0x3d')]:_0x37e536[_0x08b0('0x48')];if(!_0x50a992['query'][_0x08b0('0xcf')]('nolimit')){_0x1b9bdc[_0x08b0('0x1e')]=qs['limit'](_0x50a992[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x1b9bdc[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x50a992[_0x08b0('0x39')][_0x08b0('0x1d')]);}_0x1b9bdc[_0x08b0('0xc9')]=qs['sort'](_0x50a992['query'][_0x08b0('0xc1')]);_0x1b9bdc[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x50a992[_0x08b0('0x39')],_0x37e536[_0x08b0('0x4c')]));_0x1b9bdc['where']['UserId']=_0x494102['id'];if(_0x50a992['query'][_0x08b0('0x29')]){_0x1b9bdc[_0x08b0('0xc2')]=_['merge'](_0x1b9bdc[_0x08b0('0xc2')],{'$or':_['map'](_0x1b9bdc[_0x08b0('0x3d')],function(_0x2a4460){var _0x291a23={};_0x291a23[_0x2a4460]={'$like':'%'+_0x50a992[_0x08b0('0x39')]['filter']+'%'};return _0x291a23;})});}_0x1b9bdc=_[_0x08b0('0xc4')]({},_0x1b9bdc,_0x50a992[_0x08b0('0xca')]);return db[_0x08b0('0xdb')]['count']({'where':_0x1b9bdc[_0x08b0('0xc2')]})[_0x08b0('0x12')](function(_0xa23363){_0x23dd41['count']=_0xa23363;if(_0x50a992[_0x08b0('0x39')][_0x08b0('0x37')]){_0x1b9bdc[_0x08b0('0x38')]=[{'all':!![]}];}return db[_0x08b0('0xdb')][_0x08b0('0x3f')](_0x1b9bdc);})['then'](function(_0x3f2067){_0x23dd41['rows']=_0x3f2067;return _0x23dd41;});}})[_0x08b0('0x12')](respondWithFilteredResult(_0x3d8ab5,_0x1b9bdc))[_0x08b0('0x19')](handleError(_0x3d8ab5,null));};exports['getSmsInteractions']=function(_0x271236,_0x57f44e){var _0x54f612={};var _0x31fb67={};var _0x224823;var _0x1144a;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x271236[_0x08b0('0x47')]['id']}})['then'](handleEntityNotFound(_0x57f44e,null))[_0x08b0('0x12')](function(_0x114f4f){if(_0x114f4f){_0x224823=_0x114f4f;_0x31fb67['model']=_['keys'](db[_0x08b0('0xdc')][_0x08b0('0x4a')]);_0x31fb67[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x271236[_0x08b0('0x39')]);_0x31fb67['filters']=_['intersection'](_0x31fb67[_0x08b0('0x48')],_0x31fb67['query']);_0x54f612[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x31fb67['model'],qs[_0x08b0('0x4e')](_0x271236[_0x08b0('0x39')]['fields']));_0x54f612[_0x08b0('0x3d')]=_0x54f612[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x54f612['attributes']:_0x31fb67['model'];_0x54f612[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x271236[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x54f612['where']=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x271236[_0x08b0('0x39')],_0x31fb67[_0x08b0('0x4c')]));if(_0x271236[_0x08b0('0x39')][_0x08b0('0x29')]){_0x54f612[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x54f612[_0x08b0('0xc2')],{'$or':_['map'](_0x54f612[_0x08b0('0x3d')],function(_0x29641f){var _0x3f8ae0={};_0x3f8ae0[_0x29641f]={'$like':'%'+_0x271236['query'][_0x08b0('0x29')]+'%'};return _0x3f8ae0;})});}_0x54f612=_[_0x08b0('0xc4')]({},_0x54f612,_0x271236[_0x08b0('0xca')]);return _0x224823[_0x08b0('0xdd')](_0x54f612);}})[_0x08b0('0x12')](function(_0x4454a6){if(_0x4454a6){_0x1144a=_0x4454a6[_0x08b0('0x42')];if(!_0x271236[_0x08b0('0x39')]['hasOwnProperty']('nolimit')){_0x54f612[_0x08b0('0x1e')]=qs[_0x08b0('0x1e')](_0x271236[_0x08b0('0x39')]['limit']);_0x54f612[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x271236['query'][_0x08b0('0x1d')]);}return _0x224823[_0x08b0('0xdd')](_0x54f612);}})[_0x08b0('0x12')](function(_0x42a320){if(_0x42a320){return _0x42a320?{'count':_0x1144a,'rows':_0x42a320}:null;}})[_0x08b0('0x12')](respondWithResult(_0x57f44e,null))[_0x08b0('0x19')](handleError(_0x57f44e,null));};exports[_0x08b0('0xde')]=function(_0x50c7ad,_0x10e0da){var _0xb2dcd8={};var _0x34bd38={};var _0x440d67;var _0xe6c8d6;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x50c7ad['params']['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x10e0da,null))[_0x08b0('0x12')](function(_0x13de22){if(_0x13de22){_0x440d67=_0x13de22;_0x34bd38[_0x08b0('0x48')]=_['keys'](db['FaxInteraction'][_0x08b0('0x4a')]);_0x34bd38[_0x08b0('0x39')]=_['keys'](_0x50c7ad['query']);_0x34bd38['filters']=_[_0x08b0('0x4d')](_0x34bd38[_0x08b0('0x48')],_0x34bd38[_0x08b0('0x39')]);_0xb2dcd8['attributes']=_['intersection'](_0x34bd38['model'],qs[_0x08b0('0x4e')](_0x50c7ad['query'][_0x08b0('0x4e')]));_0xb2dcd8['attributes']=_0xb2dcd8[_0x08b0('0x3d')]['length']?_0xb2dcd8['attributes']:_0x34bd38[_0x08b0('0x48')];_0xb2dcd8['order']=qs['sort'](_0x50c7ad['query'][_0x08b0('0xc1')]);_0xb2dcd8[_0x08b0('0xc2')]=qs['filters'](_[_0x08b0('0xc3')](_0x50c7ad[_0x08b0('0x39')],_0x34bd38['filters']));if(_0x50c7ad['query'][_0x08b0('0x29')]){_0xb2dcd8['where']=_[_0x08b0('0xc4')](_0xb2dcd8[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0xb2dcd8[_0x08b0('0x3d')],function(_0x507c67){var _0x492bcc={};_0x492bcc[_0x507c67]={'$like':'%'+_0x50c7ad['query'][_0x08b0('0x29')]+'%'};return _0x492bcc;})});}_0xb2dcd8=_[_0x08b0('0xc4')]({},_0xb2dcd8,_0x50c7ad[_0x08b0('0xca')]);return _0x440d67['getFaxInteractions'](_0xb2dcd8);}})[_0x08b0('0x12')](function(_0x41344b){if(_0x41344b){_0xe6c8d6=_0x41344b[_0x08b0('0x42')];if(!_0x50c7ad[_0x08b0('0x39')]['hasOwnProperty']('nolimit')){_0xb2dcd8[_0x08b0('0x1e')]=qs[_0x08b0('0x1e')](_0x50c7ad[_0x08b0('0x39')][_0x08b0('0x1e')]);_0xb2dcd8[_0x08b0('0x1d')]=qs['offset'](_0x50c7ad[_0x08b0('0x39')]['offset']);}return _0x440d67[_0x08b0('0xde')](_0xb2dcd8);}})[_0x08b0('0x12')](function(_0x1994e5){if(_0x1994e5){return _0x1994e5?{'count':_0xe6c8d6,'rows':_0x1994e5}:null;}})[_0x08b0('0x12')](respondWithResult(_0x10e0da,null))[_0x08b0('0x19')](handleError(_0x10e0da,null));};exports[_0x08b0('0xdf')]=function(_0x9f112b,_0x2c159c){var _0x5f110f={};var _0x3aa239={};var _0x101cf8;var _0x32caa2;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x9f112b[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x2c159c,null))[_0x08b0('0x12')](function(_0x217180){if(_0x217180){_0x101cf8=_0x217180;_0x3aa239[_0x08b0('0x48')]=_['keys'](db['WhatsappInteraction'][_0x08b0('0x4a')]);_0x3aa239[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x9f112b[_0x08b0('0x39')]);_0x3aa239[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0x3aa239[_0x08b0('0x48')],_0x3aa239[_0x08b0('0x39')]);_0x5f110f[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x3aa239['model'],qs['fields'](_0x9f112b[_0x08b0('0x39')]['fields']));_0x5f110f['attributes']=_0x5f110f[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x5f110f[_0x08b0('0x3d')]:_0x3aa239[_0x08b0('0x48')];_0x5f110f[_0x08b0('0xc9')]=qs['sort'](_0x9f112b['query'][_0x08b0('0xc1')]);_0x5f110f[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x9f112b[_0x08b0('0x39')],_0x3aa239[_0x08b0('0x4c')]));if(_0x9f112b[_0x08b0('0x39')][_0x08b0('0x29')]){_0x5f110f[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x5f110f[_0x08b0('0xc2')],{'$or':_['map'](_0x5f110f[_0x08b0('0x3d')],function(_0x4783c9){var _0x409fbc={};_0x409fbc[_0x4783c9]={'$like':'%'+_0x9f112b[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x409fbc;})});}_0x5f110f=_[_0x08b0('0xc4')]({},_0x5f110f,_0x9f112b[_0x08b0('0xca')]);return _0x101cf8[_0x08b0('0xdf')](_0x5f110f);}})[_0x08b0('0x12')](function(_0x1e73e3){if(_0x1e73e3){_0x32caa2=_0x1e73e3['length'];if(!_0x9f112b['query'][_0x08b0('0xcf')]('nolimit')){_0x5f110f[_0x08b0('0x1e')]=qs['limit'](_0x9f112b[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x5f110f[_0x08b0('0x1d')]=qs['offset'](_0x9f112b[_0x08b0('0x39')][_0x08b0('0x1d')]);}return _0x101cf8['getWhatsappInteractions'](_0x5f110f);}})[_0x08b0('0x12')](function(_0x14d5e3){if(_0x14d5e3){return _0x14d5e3?{'count':_0x32caa2,'rows':_0x14d5e3}:null;}})[_0x08b0('0x12')](respondWithResult(_0x2c159c,null))[_0x08b0('0x19')](handleError(_0x2c159c,null));};exports['login']=function(_0x23c198,_0x515886,_0x5713e9){var _0x3dfbee;var _0x156d7b;var _0x566849;var _0x9f316e=!_[_0x08b0('0x5b')](_0x23c198[_0x08b0('0x47')]['id'])?_0x23c198[_0x08b0('0x47')]['id']:!_[_0x08b0('0x5b')](_0x23c198[_0x08b0('0x26')]['id'])?_0x23c198['user']['id']:null;return db[_0x08b0('0x33')]['find']({'where':{'id':_0x9f316e,'role':{'$or':[_0x08b0('0x24'),_0x08b0('0x26'),_0x08b0('0x64')]}},'attributes':['id',_0x08b0('0x2d'),'phone',_0x08b0('0xe0'),_0x08b0('0x2b'),_0x08b0('0x56'),_0x08b0('0x94')]})[_0x08b0('0x12')](function(_0x51dbe3){if(_0x51dbe3){if(_0x51dbe3[_0x08b0('0x2b')]===_0x08b0('0x64')){_0x3dfbee=_0x51dbe3;if(_0x23c198[_0x08b0('0x51')]['interface']){_0x566849=util['format'](_0x08b0('0xe1'),_0x3dfbee[_0x23c198[_0x08b0('0x51')][_0x08b0('0x9f')]]);}else if(_0x23c198[_0x08b0('0x51')][_0x08b0('0xe2')]){_0x566849=util['format'](_0x08b0('0xa1'),_0x23c198[_0x08b0('0x51')][_0x08b0('0xe2')]);}else{_0x566849=util['format']('SIP/%s',_0x3dfbee[_0x08b0('0x2d')]);}socket['to'](util['format'](_0x08b0('0xe3'),_0x3dfbee[_0x08b0('0x2d')]))[_0x08b0('0x9b')](_0x08b0('0xe4'),{'user':{'id':_0x3dfbee['id'],'name':_0x3dfbee[_0x08b0('0x2d')]},'ip':_0x23c198['headers'][_0x08b0('0xe5')]||_0x23c198[_0x08b0('0xe6')][_0x08b0('0xe7')]||_0x23c198[_0x08b0('0xe8')][_0x08b0('0xe7')]||_0x23c198[_0x08b0('0xe6')][_0x08b0('0xe8')][_0x08b0('0xe7')]});return db[_0x08b0('0xa3')]['destroy']({'where':{'membername':_0x3dfbee[_0x08b0('0x2d')]},'individualHooks':!![]});}}else{throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0xe9'));}})[_0x08b0('0x12')](function(){if(_0x3dfbee){return _0x3dfbee['getVoiceQueues']({'raw':!![]});}})[_0x08b0('0x12')](function(_0x3f276e){if(_0x3dfbee){var _0x4e224a=[];if(_0x3f276e){_0x156d7b=_0x3f276e;if(_0x156d7b[_0x08b0('0x42')]){for(var _0x5ba6e3=0x0;_0x5ba6e3<_0x156d7b[_0x08b0('0x42')];_0x5ba6e3++){_0x4e224a[_0x08b0('0x3e')]({'membername':_0x3dfbee['name'],'UserId':_0x3dfbee['id'],'queue_name':_0x156d7b[_0x5ba6e3]['name'],'VoiceQueueId':_0x156d7b[_0x5ba6e3]['id'],'interface':_0x566849,'paused':_0x3dfbee[_0x08b0('0x94')]||![],'penalty':_0x156d7b[_0x5ba6e3]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x08b0('0x80')](_0x4e224a,function(_0x17e160){return db[_0x08b0('0xa3')]['upsert'](_0x17e160);});}}}})[_0x08b0('0x12')](function(){if(_0x3dfbee){return db[_0x08b0('0xea')][_0x08b0('0x3f')]({'where':{'membername':_0x3dfbee[_0x08b0('0x2d')],'exitAt':null}});}})[_0x08b0('0x12')](function(_0x57398b){if(_0x3dfbee){var _0x3f17cd=[];_0x57398b[_0x08b0('0xeb')](function(_0x18e7dd){_0x3f17cd[_0x08b0('0x3e')](_0x18e7dd[_0x08b0('0x22')]({'exitAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec'))}));});return BPromise[_0x08b0('0x50')](_0x3f17cd);}})[_0x08b0('0x12')](function(){if(_0x3dfbee){var _0x296c5d=[];var _0xce7c59=[];var _0x405956=utils[_0x08b0('0xed')]();var _0x54e385={'membername':_0x3dfbee['name'],'interface':_0x566849,'enterAt':moment()[_0x08b0('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3dfbee['role'],'internal':_0x3dfbee[_0x08b0('0x56')]};_0x405956[_0x08b0('0xeb')](function(_0x4e4a29){_0x296c5d[_0x08b0('0x3e')](_[_0x08b0('0xc4')]({'channel':_0x4e4a29,'type':'LOGIN','data1':_0x23c198[_0x08b0('0x51')]['device'],'data2':_0x566849},_0x54e385));if(_0x3dfbee[_0x08b0('0x94')]){_0xce7c59['push'](_[_0x08b0('0xc4')]({'channel':_0x4e4a29,'type':_0x08b0('0xee'),'data1':_0x08b0('0xef')},_0x54e385));}});return db['MemberReport'][_0x08b0('0x7c')](_0x296c5d[_0x08b0('0xf0')](_0xce7c59),{'individualHooks':!![]});}})[_0x08b0('0x12')](function(){if(_0x3dfbee){return _0x3dfbee[_0x08b0('0x22')]({'online':!![],'lastLoginAt':moment()['format'](_0x08b0('0xec')),'voicePause':_0x3dfbee[_0x08b0('0x94')]||![],'mailPause':_0x3dfbee[_0x08b0('0x94')]||![],'chatPause':_0x3dfbee['loginInPause']||![],'faxPause':_0x3dfbee[_0x08b0('0x94')]||![],'smsPause':_0x3dfbee[_0x08b0('0x94')]||![],'openchannelPause':_0x3dfbee[_0x08b0('0x94')]||![],'whatsappPause':_0x3dfbee[_0x08b0('0x94')]||![],'pauseType':_0x3dfbee[_0x08b0('0x94')]?_0x08b0('0xef'):null,'interface':_0x566849,'lastPauseAt':moment()[_0x08b0('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x08b0('0x12')](function(_0x411ff6){if(_0x23c198[_0x08b0('0xf1')]){return _0x5713e9();}else{return BPromise[_0x08b0('0xf2')](_0x411ff6)[_0x08b0('0x12')](respondWithResult(_0x515886,null));}})[_0x08b0('0x19')](handleError(_0x515886,null));};exports[_0x08b0('0xf3')]=function(_0x42792d,_0x5107f4){var _0x2fe9b1;return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x42792d['params']['id'],'role':_0x08b0('0x64')},'attributes':['id','name','role']})[_0x08b0('0x12')](handleEntityNotFound(_0x5107f4,null))[_0x08b0('0x12')](function(_0x589d27){if(_0x589d27){_0x2fe9b1=_0x589d27;return db[_0x08b0('0xa3')]['destroy']({'where':{'membername':_0x2fe9b1[_0x08b0('0x2d')]},'individualHooks':!![]});}})['then'](function(){return db[_0x08b0('0xea')][_0x08b0('0x3f')]({'where':{'membername':_0x2fe9b1[_0x08b0('0x2d')],'exitAt':null}});})[_0x08b0('0x12')](function(_0x3468a9){var _0x5c818e=[];_0x3468a9[_0x08b0('0xeb')](function(_0x5c7250){_0x5c818e['push'](_0x5c7250[_0x08b0('0x22')]({'exitAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec'))}));});return BPromise[_0x08b0('0x50')](_0x5c818e);})[_0x08b0('0x12')](function(){return _0x2fe9b1[_0x08b0('0x22')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x5107f4,null))[_0x08b0('0x19')](handleError(_0x5107f4,null));};exports[_0x08b0('0xf4')]=function(_0x21fe5f,_0x542dee){var _0x310f6c;return db[_0x08b0('0xa3')]['update']({'paused':0x1},{'where':{'UserId':_0x21fe5f[_0x08b0('0x47')]['id']},'individualHooks':!![]})[_0x08b0('0x12')](function(){return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x21fe5f[_0x08b0('0x47')]['id'],'role':_0x08b0('0x64')},'attributes':['id',_0x08b0('0x2d'),_0x08b0('0x2b'),_0x08b0('0x56'),'interface']});})[_0x08b0('0x12')](handleEntityNotFound(_0x542dee,null))[_0x08b0('0x12')](function(_0x28a26e){if(_0x28a26e){_0x310f6c=_0x28a26e;return respondWithRpcPromise('QueuePause','pause',{'id':_0x310f6c['id'],'name':_0x310f6c['name'],'pause':!![]});}})[_0x08b0('0x12')](function(){if(_0x310f6c){return db[_0x08b0('0xea')][_0x08b0('0x3f')]({'where':{'membername':_0x310f6c[_0x08b0('0x2d')],'type':'PAUSE','exitAt':null}});}})[_0x08b0('0x12')](function(_0x18b826){if(_0x18b826['length']){var _0x4ee05f=moment()[_0x08b0('0xa0')](_0x08b0('0xec'));for(var _0x3672c2=0x0,_0x49afaf=_0x18b826[_0x08b0('0x42')];_0x3672c2<_0x49afaf;_0x3672c2++){_0x18b826[_0x3672c2][_0x08b0('0xf5')]({'exitAt':_0x4ee05f});}}})[_0x08b0('0x12')](function(){var _0x387a2a=[];var _0x16a8b6=utils[_0x08b0('0xed')]();_0x16a8b6[_0x08b0('0xeb')](function(_0x54f0af){_0x387a2a[_0x08b0('0x3e')]({'channel':_0x54f0af,'membername':_0x310f6c[_0x08b0('0x2d')],'interface':_[_0x08b0('0x5b')](_0x310f6c[_0x08b0('0x9f')])?util[_0x08b0('0xa0')](_0x08b0('0xa1'),_0x310f6c[_0x08b0('0x2d')]):_0x310f6c[_0x08b0('0x9f')],'type':_0x08b0('0xee'),'enterAt':moment()[_0x08b0('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x21fe5f['body']['type']||_0x08b0('0xf6'),'role':_0x310f6c[_0x08b0('0x2b')],'internal':_0x310f6c[_0x08b0('0x56')]});});return db[_0x08b0('0xea')][_0x08b0('0x7c')](_0x387a2a,{'individualHooks':!![]});})[_0x08b0('0x12')](function(){return _0x310f6c[_0x08b0('0x22')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x21fe5f['body'][_0x08b0('0xf7')]||_0x08b0('0xf6'),'lastPauseAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec'))});})[_0x08b0('0x12')](respondWithResult(_0x542dee,null))[_0x08b0('0x19')](handleError(_0x542dee,null));};exports['unpause']=function(_0x8793a6,_0x3d9cce){var _0x388dec;return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x8793a6['params']['id']},'attributes':['id','name',_0x08b0('0x2b'),_0x08b0('0x95'),_0x08b0('0xf8'),_0x08b0('0xf9'),_0x08b0('0xfa'),_0x08b0('0xfb'),'smsPause',_0x08b0('0xfc'),'pauseType',_0x08b0('0xfd')]})[_0x08b0('0x12')](handleEntityNotFound(_0x3d9cce,null))[_0x08b0('0x12')](function(_0x31edfd){if(_0x31edfd){_0x388dec=_0x31edfd;if(_0x8793a6[_0x08b0('0x51')]['channel']&&!utils['isValidChannel'](_0x8793a6[_0x08b0('0x51')][_0x08b0('0x92')])){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))]('Unknown\x20channel');}switch(_0x8793a6[_0x08b0('0x51')][_0x08b0('0x92')]){case _0x08b0('0x9d'):return respondWithRpcPromise(_0x08b0('0xfe'),_0x08b0('0xff'),{'id':_0x388dec['id'],'name':_0x388dec['name'],'pause':![]})['then'](function(){return db[_0x08b0('0xa3')][_0x08b0('0x22')]({'paused':0x0},{'where':{'UserId':_0x388dec['id']},'individualHooks':!![]});})[_0x08b0('0x12')](function(){return db[_0x08b0('0xea')]['find']({'where':{'channel':_0x8793a6[_0x08b0('0x51')][_0x08b0('0x92')],'membername':_0x388dec[_0x08b0('0x2d')],'type':_0x08b0('0xee'),'exitAt':null}});})[_0x08b0('0x12')](function(_0x2ce05c){if(_0x2ce05c){return _0x2ce05c[_0x08b0('0x22')]({'exitAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec')),'data2':_0x08b0('0x100')},{'individualHooks':!![]});}return null;})[_0x08b0('0x12')](function(){return _0x388dec[_0x08b0('0x22')]({'voicePause':![]});});case _0x08b0('0xb5'):case'chat':case'fax':case _0x08b0('0x45'):case'whatsapp':case _0x08b0('0x101'):return db[_0x08b0('0xea')][_0x08b0('0x2c')]({'where':{'channel':_0x8793a6[_0x08b0('0x51')][_0x08b0('0x92')],'membername':_0x388dec[_0x08b0('0x2d')],'type':_0x08b0('0xee'),'exitAt':null}})['then'](function(_0x5c0a5d){if(_0x5c0a5d){return _0x5c0a5d[_0x08b0('0x22')]({'exitAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec')),'data2':_0x08b0('0x100')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x364f81={};_['set'](_0x364f81,util[_0x08b0('0xa0')]('%s%s',_0x8793a6['body'][_0x08b0('0x92')],_0x08b0('0x102')),![]);return _0x388dec[_0x08b0('0x22')](_0x364f81);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x388dec['id'],'name':_0x388dec['name'],'pause':![]})['then'](function(){return db[_0x08b0('0xa3')]['update']({'paused':0x0},{'where':{'UserId':_0x388dec['id']}});})[_0x08b0('0x12')](function(){return db[_0x08b0('0xea')]['findAll']({'where':{'membername':_0x388dec[_0x08b0('0x2d')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x56b143){var _0x39607f=[];_0x56b143[_0x08b0('0xeb')](function(_0x5c78cf){_0x39607f[_0x08b0('0x3e')](_0x5c78cf[_0x08b0('0x22')]({'exitAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec')),'data2':'manual'}));});return BPromise[_0x08b0('0x50')](_0x39607f);})[_0x08b0('0x12')](function(){return _0x388dec['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x08b0('0x12')](respondWithResult(_0x3d9cce,null))[_0x08b0('0x19')](handleError(_0x3d9cce,null));};exports[_0x08b0('0x103')]=function(_0x23e198,_0x3463ec){var _0x1a4b9c={};var _0x4a845b={};var _0x3898cf;var _0x28f765;return db['User'][_0x08b0('0x8b')]({'where':{'id':_0x23e198[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x3463ec,null))[_0x08b0('0x12')](function(_0x18b46e){if(_0x18b46e){_0x3898cf=_0x18b46e;_0x4a845b['model']=_[_0x08b0('0x49')](db[_0x08b0('0x104')]['rawAttributes']);_0x4a845b[_0x08b0('0x39')]=_['keys'](_0x23e198[_0x08b0('0x39')]);_0x4a845b[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0x4a845b[_0x08b0('0x48')],_0x4a845b['query']);_0x1a4b9c[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x4a845b[_0x08b0('0x48')],qs['fields'](_0x23e198[_0x08b0('0x39')][_0x08b0('0x4e')]));_0x1a4b9c[_0x08b0('0x3d')]=_0x1a4b9c[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x1a4b9c[_0x08b0('0x3d')]:_0x4a845b[_0x08b0('0x48')];_0x1a4b9c[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x23e198[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x1a4b9c['where']=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x23e198[_0x08b0('0x39')],_0x4a845b[_0x08b0('0x4c')]));if(_0x23e198[_0x08b0('0x39')][_0x08b0('0x29')]){_0x1a4b9c[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x1a4b9c[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0x1a4b9c[_0x08b0('0x3d')],function(_0x183256){var _0xc0f72a={};_0xc0f72a[_0x183256]={'$like':'%'+_0x23e198[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0xc0f72a;})});}_0x1a4b9c=_[_0x08b0('0xc4')]({},_0x1a4b9c,_0x23e198[_0x08b0('0xca')]);return _0x3898cf[_0x08b0('0x103')](_0x1a4b9c);}})['then'](function(_0x48be78){if(_0x48be78){_0x28f765=_0x48be78[_0x08b0('0x42')];if(!_0x23e198['query']['hasOwnProperty'](_0x08b0('0xcc'))){_0x1a4b9c[_0x08b0('0x1e')]=qs['limit'](_0x23e198['query'][_0x08b0('0x1e')]);_0x1a4b9c[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x23e198[_0x08b0('0x39')]['offset']);}return _0x3898cf[_0x08b0('0x103')](_0x1a4b9c);}})[_0x08b0('0x12')](function(_0x2867b2){if(_0x2867b2){return _0x2867b2?{'count':_0x28f765,'rows':_0x2867b2}:null;}})['then'](respondWithResult(_0x3463ec,null))[_0x08b0('0x19')](handleError(_0x3463ec,null));};exports[_0x08b0('0x105')]=function(_0x5cfdd9,_0x433fc5){return db[_0x08b0('0x33')]['find']({'where':{'id':_0x5cfdd9[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x433fc5,null))[_0x08b0('0x12')](function(_0x50a5c3){if(_0x50a5c3){var _0x1abd59=_0x50a5c3[_0x08b0('0x23')]({'plain':!![]});return _0x50a5c3[_0x08b0('0x105')](_0x5cfdd9[_0x08b0('0x51')]['ids'],_[_0x08b0('0x55')](_0x5cfdd9['body'],['ids','id'])||{})[_0x08b0('0x12')](function(){for(var _0x4da5a3=0x0;_0x4da5a3<_0x5cfdd9['body'][_0x08b0('0x54')][_0x08b0('0x42')];_0x4da5a3++){var _0x5be695=[];var _0x5e0b50={};db['Team'][_0x08b0('0x8b')]({'where':{'id':_0x5cfdd9[_0x08b0('0x51')][_0x08b0('0x54')][_0x4da5a3]}})[_0x08b0('0x12')](function(_0x1fd3e1){_0x5e0b50=_0x1fd3e1[_0x08b0('0x44')];_0x5be695['push'](_0x1fd3e1['getVoiceQueues']()[_0x08b0('0x12')](function(_0x51ea76){for(var _0x10900f=0x0;_0x10900f<_0x51ea76['length'];_0x10900f++){_0x51ea76[_0x10900f][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x107'));}return _0x51ea76;}));_0x5be695[_0x08b0('0x3e')](_0x1fd3e1['getChatQueues']()['then'](function(_0x5d96d8){for(var _0x29610a=0x0;_0x29610a<_0x5d96d8[_0x08b0('0x42')];_0x29610a++){_0x5d96d8[_0x29610a][_0x08b0('0x106')](_0x08b0('0x92'),'Chat');}return _0x5d96d8;}));_0x5be695[_0x08b0('0x3e')](_0x1fd3e1['getMailQueues']()['then'](function(_0x14725d){for(var _0x3f3411=0x0;_0x3f3411<_0x14725d['length'];_0x3f3411++){_0x14725d[_0x3f3411][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x108'));}return _0x14725d;}));_0x5be695[_0x08b0('0x3e')](_0x1fd3e1[_0x08b0('0x109')]()[_0x08b0('0x12')](function(_0x54badb){for(var _0x31f729=0x0;_0x31f729<_0x54badb[_0x08b0('0x42')];_0x31f729++){_0x54badb[_0x31f729][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x10a'));}return _0x54badb;}));_0x5be695['push'](_0x1fd3e1[_0x08b0('0x10b')]()[_0x08b0('0x12')](function(_0x187f10){for(var _0x424599=0x0;_0x424599<_0x187f10['length'];_0x424599++){_0x187f10[_0x424599][_0x08b0('0x106')](_0x08b0('0x92'),'Whatsapp');}return _0x187f10;}));_0x5be695[_0x08b0('0x3e')](_0x1fd3e1[_0x08b0('0x10c')]()['then'](function(_0x26a999){for(var _0x322178=0x0;_0x322178<_0x26a999[_0x08b0('0x42')];_0x322178++){_0x26a999[_0x322178][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x10d'));}return _0x26a999;}));_0x5be695[_0x08b0('0x3e')](_0x1fd3e1[_0x08b0('0x10e')]()[_0x08b0('0x12')](function(_0x31c8bd){for(var _0x2d7687=0x0;_0x2d7687<_0x31c8bd[_0x08b0('0x42')];_0x2d7687++){_0x31c8bd[_0x2d7687][_0x08b0('0x106')](_0x08b0('0x92'),'Openchannel');}return _0x31c8bd;}));return BPromise['all'](_0x5be695);})[_0x08b0('0x12')](function(_0x3a9917){var _0x37df1c=_['flatten'](_0x3a9917);_0x5be695=[];return db[_0x08b0('0x5c')]['transaction'](function(_0x1ded3c){for(var _0x254881=0x0;_0x254881<_0x37df1c['length'];_0x254881++){_0x5be695[_0x08b0('0x3e')](_0x37df1c[_0x254881][_0x08b0('0x10f')](_0x1abd59['id']),{'transaction':_0x1ded3c});}return BPromise[_0x08b0('0x50')](_0x5be695)[_0x08b0('0x12')](function(){if(_0x1abd59[_0x08b0('0x93')]){return BPromise[_0x08b0('0x80')](_['filter'](_0x37df1c,function(_0xcd4ca4){return _0xcd4ca4[_0x08b0('0x110')]('channel')===_0x08b0('0x107');}),function(_0x339a0e){return db[_0x08b0('0xa3')][_0x08b0('0xa4')]({'membername':_0x1abd59[_0x08b0('0x2d')],'UserId':_0x1abd59['id'],'queue_name':_0x339a0e[_0x08b0('0x2d')],'VoiceQueueId':_0x339a0e['id'],'interface':_[_0x08b0('0x5b')](_0x1abd59[_0x08b0('0x9f')])?util['format'](_0x08b0('0xa1'),_0x1abd59[_0x08b0('0x2d')]):_0x1abd59[_0x08b0('0x9f')],'paused':_0x1abd59['voicePause']||![],'penalty':_0x1abd59['penalty']},{'transaction':_0x1ded3c});});}else{return;}})[_0x08b0('0x12')](function(){for(var _0x2a4965=0x0;_0x2a4965<_0x37df1c[_0x08b0('0x42')];_0x2a4965++){var _0x2cc619=_0x37df1c[_0x2a4965]['getDataValue'](_0x08b0('0x92'));var _0xcccdbc=_0x2cc619+_0x08b0('0x111');socket[_0x08b0('0x9b')](_0x08b0('0x26')+_0x2cc619+_0x08b0('0x9c'),{'UserId':_0x1abd59['id'],['queueField']:_0x37df1c[_0x2a4965]['id']});}});});})['then'](function(){db[_0x08b0('0x112')][_0x08b0('0x8b')]({'where':{'teamId':_0x5e0b50['id']}})[_0x08b0('0x12')](function(_0x21a22f){if(_0x21a22f){db[_0x08b0('0x113')][_0x08b0('0x72')]({'UserId':_0x5cfdd9[_0x08b0('0x47')]['id'],'VoicePrefixId':_0x21a22f[_0x08b0('0x114')]});}});});}});}})[_0x08b0('0x12')](respondWithStatusCode(_0x433fc5,null))['catch'](handleError(_0x433fc5,null));};exports[_0x08b0('0x115')]=function(_0x5c4638,_0x13b95e){return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x5c4638[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x13b95e,null))[_0x08b0('0x12')](function(_0x526c65){if(_0x526c65){var _0x1dbad1=_0x526c65[_0x08b0('0x23')]({'plain':!![]});var _0xd25135=_0x5c4638[_0x08b0('0x39')][_0x08b0('0x54')];return _0x526c65[_0x08b0('0x115')](_0xd25135)[_0x08b0('0x12')](function(){for(var _0x234ef1=0x0;_0x234ef1<_0xd25135[_0x08b0('0x42')];_0x234ef1++){var _0x2c9ec2=[];var _0x5462f6={};db['Team'][_0x08b0('0x8b')]({'where':{'id':_0xd25135[_0x234ef1]}})[_0x08b0('0x12')](function(_0x2c0022){_0x5462f6=_0x2c0022['dataValues'];_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x116')]()[_0x08b0('0x12')](function(_0x4c7c07){for(var _0x4e048b=0x0;_0x4e048b<_0x4c7c07['length'];_0x4e048b++){_0x4c7c07[_0x4e048b]['setDataValue'](_0x08b0('0x92'),_0x08b0('0x107'));}return _0x4c7c07;}));_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x117')]()[_0x08b0('0x12')](function(_0x40a4fc){for(var _0x1adfa1=0x0;_0x1adfa1<_0x40a4fc['length'];_0x1adfa1++){_0x40a4fc[_0x1adfa1][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x118'));}return _0x40a4fc;}));_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x119')]()[_0x08b0('0x12')](function(_0x400d81){for(var _0x38cfe4=0x0;_0x38cfe4<_0x400d81[_0x08b0('0x42')];_0x38cfe4++){_0x400d81[_0x38cfe4][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x108'));}return _0x400d81;}));_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x109')]()[_0x08b0('0x12')](function(_0x35162d){for(var _0xbb36f=0x0;_0xbb36f<_0x35162d[_0x08b0('0x42')];_0xbb36f++){_0x35162d[_0xbb36f][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x10a'));}return _0x35162d;}));_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x10b')]()['then'](function(_0x36dc90){for(var _0x12d77a=0x0;_0x12d77a<_0x36dc90[_0x08b0('0x42')];_0x12d77a++){_0x36dc90[_0x12d77a][_0x08b0('0x106')]('channel',_0x08b0('0x11a'));}return _0x36dc90;}));_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x10c')]()[_0x08b0('0x12')](function(_0x1ff18c){for(var _0x4a9142=0x0;_0x4a9142<_0x1ff18c[_0x08b0('0x42')];_0x4a9142++){_0x1ff18c[_0x4a9142]['setDataValue'](_0x08b0('0x92'),_0x08b0('0x10d'));}return _0x1ff18c;}));_0x2c9ec2['push'](_0x2c0022[_0x08b0('0x10e')]()[_0x08b0('0x12')](function(_0xea3ddc){for(var _0x69eb41=0x0;_0x69eb41<_0xea3ddc[_0x08b0('0x42')];_0x69eb41++){_0xea3ddc[_0x69eb41]['setDataValue']('channel',_0x08b0('0x11b'));}return _0xea3ddc;}));return BPromise['all'](_0x2c9ec2);})[_0x08b0('0x12')](function(_0x1c56f9){var _0x3dc7a2=_['flatten'](_0x1c56f9);_0x2c9ec2=[];return db[_0x08b0('0x5c')][_0x08b0('0x11c')](function(_0x1c5160){for(var _0x19c6b5=0x0;_0x19c6b5<_0x3dc7a2[_0x08b0('0x42')];_0x19c6b5++){_0x2c9ec2['push'](_0x3dc7a2[_0x19c6b5]['removeAgent'](_0x1dbad1['id']),{'transaction':_0x1c5160});}return BPromise['all'](_0x2c9ec2)[_0x08b0('0x12')](function(){if(_0x1dbad1['online']){return BPromise[_0x08b0('0x80')](_[_0x08b0('0x29')](_0x3dc7a2,function(_0x20c3d3){return _0x20c3d3['getDataValue'](_0x08b0('0x92'))==='Voice';}),function(_0x322f75){return db[_0x08b0('0xa3')][_0x08b0('0x2e')]({'where':{'VoiceQueueId':_0x322f75['id'],'UserId':_0x1dbad1['id']},'transaction':_0x1c5160});});}else{return;}})[_0x08b0('0x12')](function(){db['TeamVoicePrefix'][_0x08b0('0x8b')]({'where':{'teamId':_0x5462f6['id']}})[_0x08b0('0x12')](function(_0x20894f){if(_0x20894f){return db[_0x08b0('0x113')]['destroy']({'where':{'UserId':_0x1dbad1['id'],'VoicePrefixId':_0x20894f[_0x08b0('0x44')][_0x08b0('0x114')]}});}});})['then'](function(){for(var _0x4e1f16=0x0;_0x4e1f16<_0x3dc7a2[_0x08b0('0x42')];_0x4e1f16++){var _0x68d481=_0x3dc7a2[_0x4e1f16][_0x08b0('0x110')](_0x08b0('0x92'));var _0x1ff12d=_0x68d481+_0x08b0('0x111');socket[_0x08b0('0x9b')](_0x08b0('0x26')+_0x68d481+_0x08b0('0xa8'),{'UserId':_0x1dbad1['id'],['queueField']:_0x3dc7a2[_0x4e1f16]['id']});}});});});}});}})[_0x08b0('0x12')](respondWithStatusCode(_0x13b95e,null))['catch'](handleError(_0x13b95e,null));};exports[_0x08b0('0x11d')]=function(_0x45b336,_0x4cb4cd){var _0x1f9f45={};var _0x29a08d={};var _0x1eb505;var _0x340e2f;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x45b336[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x4cb4cd,null))[_0x08b0('0x12')](function(_0x49dc26){if(_0x49dc26){_0x1eb505=_0x49dc26;_0x29a08d[_0x08b0('0x48')]=_['keys'](db[_0x08b0('0x11e')][_0x08b0('0x4a')]);_0x29a08d[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x45b336['query']);_0x29a08d[_0x08b0('0x4c')]=_['intersection'](_0x29a08d[_0x08b0('0x48')],_0x29a08d[_0x08b0('0x39')]);_0x1f9f45[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x29a08d[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x45b336[_0x08b0('0x39')][_0x08b0('0x4e')]));_0x1f9f45[_0x08b0('0x3d')]=_0x1f9f45[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x1f9f45[_0x08b0('0x3d')]:_0x29a08d[_0x08b0('0x48')];_0x1f9f45[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x45b336[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x1f9f45[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x45b336['query'],_0x29a08d[_0x08b0('0x4c')]));if(_0x45b336[_0x08b0('0x39')][_0x08b0('0x29')]){_0x1f9f45[_0x08b0('0xc2')]=_['merge'](_0x1f9f45[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0x1f9f45[_0x08b0('0x3d')],function(_0x8a700a){var _0x1bc2fc={};_0x1bc2fc[_0x8a700a]={'$like':'%'+_0x45b336[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x1bc2fc;})});}_0x1f9f45=_[_0x08b0('0xc4')]({},_0x1f9f45,_0x45b336[_0x08b0('0xca')]);return _0x1eb505[_0x08b0('0x11d')](_0x1f9f45);}})[_0x08b0('0x12')](function(_0x361018){if(_0x361018){_0x340e2f=_0x361018[_0x08b0('0x42')];if(!_0x45b336[_0x08b0('0x39')]['hasOwnProperty'](_0x08b0('0xcc'))){_0x1f9f45[_0x08b0('0x1e')]=qs[_0x08b0('0x1e')](_0x45b336['query'][_0x08b0('0x1e')]);_0x1f9f45[_0x08b0('0x1d')]=qs['offset'](_0x45b336['query']['offset']);}return _0x1eb505[_0x08b0('0x11d')](_0x1f9f45);}})['then'](function(_0x330f7a){if(_0x330f7a){return _0x330f7a?{'count':_0x340e2f,'rows':_0x330f7a}:null;}})['then'](respondWithResult(_0x4cb4cd,null))[_0x08b0('0x19')](handleError(_0x4cb4cd,null));};exports[_0x08b0('0x11f')]=function(_0x576111,_0xbd7ba){var _0xaa9567={};var _0x2fc58c={};var _0x4728ac;return db[_0x08b0('0x33')]['findOne']({'where':{'id':_0x576111[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0xbd7ba,null))[_0x08b0('0x12')](function(_0x2386d5){if(_0x2386d5){_0x4728ac=_0x2386d5;_0x2fc58c[_0x08b0('0x48')]=_[_0x08b0('0x49')](db[_0x08b0('0x33')][_0x08b0('0x4a')]);_0x2fc58c[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x576111[_0x08b0('0x39')]);_0x2fc58c[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0x2fc58c[_0x08b0('0x48')],_0x2fc58c['query']);_0xaa9567['attributes']=_[_0x08b0('0x4d')](_0x2fc58c[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x576111[_0x08b0('0x39')][_0x08b0('0x4e')]));_0xaa9567[_0x08b0('0x3d')]=_0xaa9567[_0x08b0('0x3d')][_0x08b0('0x42')]?_0xaa9567['attributes']:_0x2fc58c[_0x08b0('0x48')];_0xaa9567[_0x08b0('0xc9')]=qs['sort'](_0x576111[_0x08b0('0x39')][_0x08b0('0xc1')]);_0xaa9567[_0x08b0('0xc2')]=qs['filters'](_[_0x08b0('0xc3')](_0x576111[_0x08b0('0x39')],_0x2fc58c[_0x08b0('0x4c')]));if(_0x576111['query'][_0x08b0('0x29')]){_0xaa9567[_0x08b0('0xc2')]=_['merge'](_0xaa9567[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0xaa9567[_0x08b0('0x3d')],function(_0x53ae82){var _0x1334d3={};_0x1334d3[_0x53ae82]={'$like':'%'+_0x576111[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x1334d3;})});}_0xaa9567[_0x08b0('0x48')]=db['User'];_0xaa9567['as']=_0x08b0('0x79');_0xaa9567=_[_0x08b0('0xc4')]({},_0xaa9567,_0x576111[_0x08b0('0xca')]);return _0x4728ac[_0x08b0('0x116')]({'include':[_0xaa9567]});}})['then'](function(_0x1fa05b){if(_0x1fa05b){var _0x44bbe2={},_0x875fc5=[];for(var _0x32d97f=0x0;_0x32d97f<_0x1fa05b[_0x08b0('0x42')];_0x32d97f+=0x1){for(var _0xf510c5=0x0,_0xcfb992;_0xf510c5<_0x1fa05b[_0x32d97f][_0x08b0('0x79')]['length'];_0xf510c5+=0x1){_0xcfb992=_0x1fa05b[_0x32d97f][_0x08b0('0x79')][_0xf510c5][_0x08b0('0x23')]({'plain':!![]});_0x44bbe2[_0xcfb992['id']]=_0xcfb992;}}_0x44bbe2=_[_0x08b0('0x120')](_0x44bbe2);for(var _0x4637df=qs[_0x08b0('0x1d')](_0x576111[_0x08b0('0x39')][_0x08b0('0x1d')]);_0x4637df<_0x44bbe2[_0x08b0('0x42')]&&_0x875fc5[_0x08b0('0x42')]=_0x1e426d['agents']){throw new Error(_0x96b0('0x54'));}})[_0x96b0('0x11')](function(){if(_0x2da520){return db[_0x96b0('0x2c')][_0x96b0('0x55')]({'where':{'membername':_0x2da520[_0x96b0('0x3b')]},'individualHooks':!![]});}})['then'](function(){if(_0x2da520){return _0x2da520[_0x96b0('0x56')]({'raw':!![]});}})['then'](function(_0x328fc8){if(_0x2da520){if(_0x328fc8){var _0x3f097f=[];_0x260a18=_0x328fc8;if(_0x260a18[_0x96b0('0x30')]){for(var _0x357d8b=0x0;_0x357d8b<_0x260a18['length'];_0x357d8b++){_0x3f097f['push'](db['UserVoiceQueueRt'][_0x96b0('0x57')]({'membername':_0x2da520[_0x96b0('0x3b')],'UserId':_0x2da520['id'],'queue_name':_0x260a18[_0x357d8b][_0x96b0('0x3b')],'VoiceQueueId':_0x260a18[_0x357d8b]['id'],'interface':_0x3e6578,'paused':_0x2da520[_0x96b0('0x58')]||![],'penalty':_0x260a18[_0x357d8b][_0x96b0('0x59')]||0x0}));}return BPromise[_0x96b0('0x5a')](_0x3f097f);}}}})['then'](function(){if(_0x2da520){return db[_0x96b0('0x2e')][_0x96b0('0x1f')]({'where':{'membername':_0x2da520[_0x96b0('0x3b')],'exitAt':null}});}})[_0x96b0('0x11')](function(_0x17308f){if(_0x2da520){if(_0x17308f&&_0x17308f[_0x96b0('0x30')]){var _0x1e0f80=[];_0x17308f[_0x96b0('0x33')](function(_0x32e7ac){_0x1e0f80['push'](_0x32e7ac[_0x96b0('0x2d')]({'exitAt':moment()[_0x96b0('0x34')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x96b0('0x5a')](_0x1e0f80);}}})['then'](function(_0x4efb07){if(_0x2da520){var _0x191046=[];var _0x491a99=[];var _0x51ab00=utils[_0x96b0('0x32')]();var _0x3ba7f7={'membername':_0x2da520['name'],'interface':_0x3e6578,'enterAt':moment()[_0x96b0('0x34')](_0x96b0('0x31')),'role':_0x2da520[_0x96b0('0x29')],'internal':_0x2da520['internal']};_0x51ab00[_0x96b0('0x33')](function(_0x4d7482){_0x191046[_0x96b0('0x48')](_[_0x96b0('0x5b')]({'channel':_0x4d7482,'type':_0x96b0('0x5c'),'data1':_0x96b0('0x5d'),'data2':_0x3e6578},_0x3ba7f7));if(_0x2da520['loginInPause']){_0x491a99[_0x96b0('0x48')](_[_0x96b0('0x5b')]({'channel':_0x4d7482,'type':_0x96b0('0x2f'),'data1':_0x96b0('0x5e')},_0x3ba7f7));}});return db[_0x96b0('0x2e')]['bulkCreate'](_0x191046['concat'](_0x491a99),{'individualHooks':!![]});}})[_0x96b0('0x11')](function(){if(_0x2da520){return _0x2da520[_0x96b0('0x2d')]({'online':!![],'lastLoginAt':moment()[_0x96b0('0x34')](_0x96b0('0x31')),'voicePause':_0x2da520[_0x96b0('0x58')]||![],'mailPause':_0x2da520[_0x96b0('0x58')]||![],'chatPause':_0x2da520[_0x96b0('0x58')]||![],'faxPause':_0x2da520[_0x96b0('0x58')]||![],'smsPause':_0x2da520[_0x96b0('0x58')]||![],'openchannelPause':_0x2da520['loginInPause']||![],'pauseType':_0x2da520[_0x96b0('0x58')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x3e6578});}})[_0x96b0('0x11')](function(_0x593768){_0x287d89(_0x593768);})[_0x96b0('0x1c')](function(_0x20edb8){_0x78a89c(_0x30a5a5[_0x96b0('0x18')](0x1f4,_0x20edb8[_0x96b0('0x1a')]));});});}; \ No newline at end of file +var _0xfcf0=['bulkCreate','UnpauseUser','findOne','channel','isValidChannel','voice','UserVoiceQueueRt','system','mail','fax','openchannel','whatsapp','%s%s','Pause','destroy','push','all','LoginUser','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','UserVoiceQueue.penalty','merge','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','request','then','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','map','model','include','GetUser','User','find','where','ShowUser','debug','PauseUser','name','role','internal','update','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','getChannels','forEach','interface','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid'];(function(_0x5e431b,_0x1489bf){var _0x1d4a3b=function(_0x23f6f7){while(--_0x23f6f7){_0x5e431b['push'](_0x5e431b['shift']());}};_0x1d4a3b(++_0x1489bf);}(_0xfcf0,0x1d7));var _0x0fcf=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xfcf0[_0x117f4c];return _0x2b24e9;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require(_0x0fcf('0x2'));var BPromise=require(_0x0fcf('0x3'));var rs=require(_0x0fcf('0x4'));var fs=require('fs');var Redis=require(_0x0fcf('0x5'));var db=require(_0x0fcf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x7'))(_0x0fcf('0x8'));var config=require('../../config/environment');var jayson=require(_0x0fcf('0x9'));var client=jayson['client'][_0x0fcf('0xa')]({'port':0x232a});config[_0x0fcf('0xb')]=_[_0x0fcf('0xc')](config[_0x0fcf('0xb')],{'host':_0x0fcf('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fcf('0xb')]));require('./user.socket')['register'](socket);function respondWithRpcPromise(_0x50ccf7,_0x17a7b0,_0x57d59f){return new BPromise(function(_0x3b7722,_0x128baa){return client[_0x0fcf('0xe')](_0x50ccf7,_0x57d59f)[_0x0fcf('0xf')](function(_0x77743b){logger['info'](_0x0fcf('0x10'),_0x17a7b0,'request\x20sent');logger['debug'](_0x0fcf('0x11'),_0x17a7b0,_0x0fcf('0x12'),JSON[_0x0fcf('0x13')](_0x77743b));if(_0x77743b[_0x0fcf('0x14')]){if(_0x77743b[_0x0fcf('0x14')][_0x0fcf('0x15')]===0x1f4){logger[_0x0fcf('0x14')](_0x0fcf('0x10'),_0x17a7b0,_0x77743b[_0x0fcf('0x14')][_0x0fcf('0x16')]);return _0x128baa(_0x77743b[_0x0fcf('0x14')][_0x0fcf('0x16')]);}logger[_0x0fcf('0x14')](_0x0fcf('0x10'),_0x17a7b0,_0x77743b[_0x0fcf('0x14')][_0x0fcf('0x16')]);return _0x3b7722(_0x77743b[_0x0fcf('0x14')][_0x0fcf('0x16')]);}else{logger['info']('User,\x20%s,\x20%s',_0x17a7b0,_0x0fcf('0x12'));_0x3b7722(_0x77743b[_0x0fcf('0x17')][_0x0fcf('0x16')]);}})[_0x0fcf('0x18')](function(_0xc95ace){logger[_0x0fcf('0x14')](_0x0fcf('0x10'),_0x17a7b0,_0xc95ace);_0x128baa(_0xc95ace);});});}exports['GetUser']=function(_0xdcd362){var _0x509ae7=this;return new Promise(function(_0x1344ce,_0x4315b5){return db['User'][_0x0fcf('0x19')]({'raw':_0xdcd362['options']?_0xdcd362[_0x0fcf('0x1a')][_0x0fcf('0x1b')]===undefined?!![]:![]:!![],'where':_0xdcd362[_0x0fcf('0x1a')]?_0xdcd362[_0x0fcf('0x1a')]['where']||null:null,'attributes':_0xdcd362[_0x0fcf('0x1a')]?_0xdcd362[_0x0fcf('0x1a')][_0x0fcf('0x1c')]||null:null,'limit':_0xdcd362[_0x0fcf('0x1a')]?_0xdcd362[_0x0fcf('0x1a')][_0x0fcf('0x1d')]||null:null,'include':_0xdcd362[_0x0fcf('0x1a')]?_0xdcd362['options']['include']?_[_0x0fcf('0x1e')](_0xdcd362['options']['include'],function(_0x1c57cb){return{'model':db[_0x1c57cb[_0x0fcf('0x1f')]],'as':_0x1c57cb['as'],'attributes':_0x1c57cb[_0x0fcf('0x1c')],'include':_0x1c57cb[_0x0fcf('0x20')]?_[_0x0fcf('0x1e')](_0x1c57cb[_0x0fcf('0x20')],function(_0x4569d0){return{'model':db[_0x4569d0[_0x0fcf('0x1f')]],'as':_0x4569d0['as'],'attributes':_0x4569d0[_0x0fcf('0x1c')],'include':_0x4569d0[_0x0fcf('0x20')]?_[_0x0fcf('0x1e')](_0x4569d0['include'],function(_0xc8e237){return{'model':db[_0xc8e237[_0x0fcf('0x1f')]],'as':_0xc8e237['as'],'attributes':_0xc8e237['attributes']};}):[]};}):[]};}):[]:[]})[_0x0fcf('0xf')](function(_0x31e0ae){logger['info'](_0x0fcf('0x21'),_0xdcd362);logger['debug'](_0x0fcf('0x21'),_0xdcd362,JSON[_0x0fcf('0x13')](_0x31e0ae));_0x1344ce(_0x31e0ae);})[_0x0fcf('0x18')](function(_0x54991f){logger[_0x0fcf('0x14')]('GetUser',_0x54991f[_0x0fcf('0x16')],_0xdcd362);_0x4315b5(_0x509ae7[_0x0fcf('0x14')](0x1f4,_0x54991f[_0x0fcf('0x16')]));});});};exports['ShowUser']=function(_0x5a6b9b){var _0x323573=this;return new Promise(function(_0x235bde,_0x5995c8){return db[_0x0fcf('0x22')][_0x0fcf('0x23')]({'raw':_0x5a6b9b['options']?_0x5a6b9b[_0x0fcf('0x1a')][_0x0fcf('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a6b9b[_0x0fcf('0x1a')]?_0x5a6b9b['options'][_0x0fcf('0x24')]||null:null,'attributes':_0x5a6b9b[_0x0fcf('0x1a')]?_0x5a6b9b['options'][_0x0fcf('0x1c')]||null:null,'include':_0x5a6b9b[_0x0fcf('0x1a')]?_0x5a6b9b['options']['include']?_[_0x0fcf('0x1e')](_0x5a6b9b['options'][_0x0fcf('0x20')],function(_0x338514){return{'model':db[_0x338514[_0x0fcf('0x1f')]],'as':_0x338514['as'],'attributes':_0x338514[_0x0fcf('0x1c')],'include':_0x338514[_0x0fcf('0x20')]?_[_0x0fcf('0x1e')](_0x338514[_0x0fcf('0x20')],function(_0x5c38da){return{'model':db[_0x5c38da[_0x0fcf('0x1f')]],'as':_0x5c38da['as'],'attributes':_0x5c38da[_0x0fcf('0x1c')],'include':_0x5c38da[_0x0fcf('0x20')]?_[_0x0fcf('0x1e')](_0x5c38da[_0x0fcf('0x20')],function(_0x1596ef){return{'model':db[_0x1596ef['model']],'as':_0x1596ef['as'],'attributes':_0x1596ef[_0x0fcf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0fcf('0xf')](function(_0x478f42){logger['info'](_0x0fcf('0x25'),_0x5a6b9b);logger[_0x0fcf('0x26')](_0x0fcf('0x25'),_0x5a6b9b,JSON[_0x0fcf('0x13')](_0x478f42));_0x235bde(_0x478f42);})[_0x0fcf('0x18')](function(_0x309133){logger['error'](_0x0fcf('0x25'),_0x309133['message'],_0x5a6b9b);_0x5995c8(_0x323573['error'](0x1f4,_0x309133[_0x0fcf('0x16')]));});});};exports[_0x0fcf('0x27')]=function(_0x19a96a){var _0x3ba072=this;return new Promise(function(_0x1f83a7,_0x4348f0){var _0x49285c;return db[_0x0fcf('0x22')][_0x0fcf('0x23')]({'where':_0x19a96a[_0x0fcf('0x1a')][_0x0fcf('0x24')]||{},'attributes':['id',_0x0fcf('0x28'),_0x0fcf('0x29'),_0x0fcf('0x2a'),'interface']})[_0x0fcf('0xf')](function(_0x2bb2c0){if(_0x2bb2c0){_0x49285c=_0x2bb2c0;return db['UserVoiceQueueRt'][_0x0fcf('0x2b')]({'paused':0x1},{'where':{'UserId':_0x49285c['id']},'individualHooks':!![]});}})['then'](function(){if(_0x49285c){return db[_0x0fcf('0x2c')][_0x0fcf('0x19')]({'where':{'membername':_0x49285c[_0x0fcf('0x28')],'type':_0x0fcf('0x2d'),'exitAt':null}});}})[_0x0fcf('0xf')](function(_0x12bb4e){if(_0x49285c){if(_0x12bb4e&&_0x12bb4e['length']){var _0x12302e=moment()[_0x0fcf('0x2e')](_0x0fcf('0x2f'));for(var _0x30a33d=0x0,_0x1dee90=_0x12bb4e[_0x0fcf('0x30')];_0x30a33d<_0x1dee90;_0x30a33d++){_0x12bb4e[_0x30a33d]['updateAttributes']({'exitAt':_0x12302e});}}}})[_0x0fcf('0xf')](function(){if(_0x49285c){var _0x58c6b0=[];var _0x14619c=utils[_0x0fcf('0x31')]();_0x14619c[_0x0fcf('0x32')](function(_0x170c1f){_0x58c6b0['push']({'channel':_0x170c1f,'membername':_0x49285c['name'],'interface':_['isNil'](_0x49285c[_0x0fcf('0x33')])?util['format'](_0x0fcf('0x34'),_0x49285c[_0x0fcf('0x28')]):_0x49285c['interface'],'type':_0x0fcf('0x2d'),'enterAt':moment()[_0x0fcf('0x2e')](_0x0fcf('0x2f')),'data1':_0x19a96a[_0x0fcf('0x35')][_0x0fcf('0x36')]||_0x0fcf('0x37'),'role':_0x49285c[_0x0fcf('0x29')],'internal':_0x49285c[_0x0fcf('0x2a')],'uniqueid':_0x19a96a[_0x0fcf('0x35')][_0x0fcf('0x38')]||null});});return db[_0x0fcf('0x2c')][_0x0fcf('0x39')](_0x58c6b0,{'individualHooks':!![]});}})[_0x0fcf('0xf')](function(){if(_0x49285c){return _0x49285c[_0x0fcf('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x19a96a['body'][_0x0fcf('0x36')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0fcf('0x2e')](_0x0fcf('0x2f'))});}})[_0x0fcf('0xf')](function(_0x2c9112){_0x1f83a7(_0x2c9112);})[_0x0fcf('0x18')](function(_0x57bf04){_0x4348f0(_0x3ba072['error'](0x1f4,_0x57bf04[_0x0fcf('0x16')]));});});};exports[_0x0fcf('0x3a')]=function(_0x3e9f77){var _0x265ba0=this;return new Promise(function(_0x5ac18c,_0x17f45f){var _0x3d2fc6;return db[_0x0fcf('0x22')][_0x0fcf('0x3b')]({'where':_0x3e9f77[_0x0fcf('0x1a')]['where']||{},'attributes':['id',_0x0fcf('0x28')]})['then'](function(_0x266c93){if(_0x266c93){_0x3d2fc6=_0x266c93;if(_0x3e9f77[_0x0fcf('0x35')][_0x0fcf('0x3c')]&&!utils[_0x0fcf('0x3d')](_0x3e9f77[_0x0fcf('0x35')]['channel'])){throw new Error('Unknown\x20channel');}switch(_0x3e9f77[_0x0fcf('0x35')][_0x0fcf('0x3c')]){case _0x0fcf('0x3e'):return db[_0x0fcf('0x3f')]['update']({'paused':0x0},{'where':{'UserId':_0x3d2fc6['id']}})['then'](function(){return db[_0x0fcf('0x2c')]['find']({'where':{'channel':_0x3e9f77[_0x0fcf('0x35')][_0x0fcf('0x3c')],'membername':_0x3d2fc6[_0x0fcf('0x28')],'type':_0x0fcf('0x2d'),'exitAt':null}});})[_0x0fcf('0xf')](function(_0x39c986){if(_0x39c986){return _0x39c986[_0x0fcf('0x2b')]({'exitAt':moment()['format'](_0x0fcf('0x2f')),'data2':_0x0fcf('0x40')},{'individualHooks':!![]});}return null;})[_0x0fcf('0xf')](function(){return _0x3d2fc6[_0x0fcf('0x2b')]({'voicePause':![]});});case _0x0fcf('0x41'):case'chat':case _0x0fcf('0x42'):case'sms':case _0x0fcf('0x43'):case _0x0fcf('0x44'):return db[_0x0fcf('0x2c')][_0x0fcf('0x23')]({'where':{'channel':_0x3e9f77['body']['channel'],'membername':_0x3d2fc6[_0x0fcf('0x28')],'type':_0x0fcf('0x2d'),'exitAt':null}})[_0x0fcf('0xf')](function(_0x1d17be){return _0x1d17be[_0x0fcf('0x2b')]({'exitAt':moment()[_0x0fcf('0x2e')](_0x0fcf('0x2f')),'data2':_0x0fcf('0x40')},{'individualHooks':!![]});})['then'](function(){var _0x2728b9={};_['set'](_0x2728b9,util['format'](_0x0fcf('0x45'),_0x3e9f77[_0x0fcf('0x35')][_0x0fcf('0x3c')],_0x0fcf('0x46')),![]);return _0x3d2fc6[_0x0fcf('0x2b')](_0x2728b9);});default:return db[_0x0fcf('0x3f')][_0x0fcf('0x2b')]({'paused':0x0},{'where':{'UserId':_0x3d2fc6['id']}})[_0x0fcf('0xf')](function(){return db[_0x0fcf('0x2c')][_0x0fcf('0x19')]({'where':{'membername':_0x3d2fc6[_0x0fcf('0x28')],'type':_0x0fcf('0x2d'),'exitAt':null}});})[_0x0fcf('0xf')](function(_0x5b9029){var _0xf4d1ab=[];_0x5b9029[_0x0fcf('0x32')](function(_0xbd0e29){_0xf4d1ab['push'](_0xbd0e29[_0x0fcf('0x2b')]({'exitAt':moment()[_0x0fcf('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0fcf('0x40')}));});return BPromise['all'](_0xf4d1ab);})[_0x0fcf('0xf')](function(){return _0x3d2fc6[_0x0fcf('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x0fcf('0xf')](function(_0x56e7e7){_0x5ac18c(_0x56e7e7);})[_0x0fcf('0x18')](function(_0x135b0d){_0x17f45f(_0x265ba0[_0x0fcf('0x14')](0x1f4,_0x135b0d['message']));});});};exports['LogoutUser']=function(_0xf2d2a9){var _0x5db749=this;return new Promise(function(_0x291eff,_0x365c33){var _0x5c4113;return db[_0x0fcf('0x22')][_0x0fcf('0x3b')]({'where':_0xf2d2a9['options'][_0x0fcf('0x24')]||{},'attributes':['id',_0x0fcf('0x28')]})['then'](function(_0x447bff){if(_0x447bff){_0x5c4113=_0x447bff;return db[_0x0fcf('0x3f')][_0x0fcf('0x47')]({'where':{'membername':_0x5c4113[_0x0fcf('0x28')]},'individualHooks':!![]});}})[_0x0fcf('0xf')](function(){if(_0x5c4113){return db['MemberReport'][_0x0fcf('0x19')]({'where':{'membername':_0x5c4113[_0x0fcf('0x28')],'exitAt':null}});}})['then'](function(_0x39df85){if(_0x5c4113){if(_0x39df85&&_0x39df85[_0x0fcf('0x30')]){var _0x5962b4=[];_0x39df85[_0x0fcf('0x32')](function(_0x33d62e){_0x5962b4[_0x0fcf('0x48')](_0x33d62e[_0x0fcf('0x2b')]({'exitAt':moment()['format'](_0x0fcf('0x2f'))}));});return BPromise[_0x0fcf('0x49')](_0x5962b4);}}})['then'](function(){if(_0x5c4113){return _0x5c4113[_0x0fcf('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x0fcf('0xf')](function(_0x1d2832){_0x291eff(_0x1d2832);})[_0x0fcf('0x18')](function(_0x4d08ab){_0x365c33(_0x5db749[_0x0fcf('0x14')](0x1f4,_0x4d08ab[_0x0fcf('0x16')]));});});};exports[_0x0fcf('0x4a')]=function(_0x496644){var _0x4faeef=this;return new Promise(function(_0x539385,_0x1a57b6){var _0x38a57a;var _0xbd96c1;var _0x2f7523;var _0x27ffbf;return db[_0x0fcf('0x22')][_0x0fcf('0x3b')]({'where':_0x496644[_0x0fcf('0x1a')][_0x0fcf('0x24')]||{},'attributes':['id',_0x0fcf('0x28'),_0x0fcf('0x29'),'mobile',_0x0fcf('0x4b'),'internal',_0x0fcf('0x4c'),_0x0fcf('0x33')]})[_0x0fcf('0xf')](function(_0x2992b2){if(_0x2992b2){_0x38a57a=_0x2992b2;_0x27ffbf=_0x496644[_0x0fcf('0x35')]['interface']?_0x496644['body']['interface']:util[_0x0fcf('0x2e')](_0x0fcf('0x34'),_0x38a57a['name']);return db['User'][_0x0fcf('0x4d')]({'where':{'role':_0x0fcf('0x4e'),'online':!![],'id':{'$ne':_0x38a57a['id']}}});}})['then'](function(_0x568f1f){if(_0x568f1f){_0x2f7523=_0x568f1f;return require(_0x0fcf('0x4f'))[_0x0fcf('0x50')]();}})[_0x0fcf('0xf')](function(_0x57f9e9){if(_0x57f9e9&&_0x57f9e9['agents']&&_0x2f7523>=_0x57f9e9[_0x0fcf('0x51')]){throw new Error(_0x0fcf('0x52'));}})[_0x0fcf('0xf')](function(){if(_0x38a57a){return db[_0x0fcf('0x3f')][_0x0fcf('0x47')]({'where':{'membername':_0x38a57a['name']},'individualHooks':!![]});}})[_0x0fcf('0xf')](function(){if(_0x38a57a){return _0x38a57a['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x24f5ab){if(_0x38a57a){if(_0x24f5ab){var _0x13e201=[];_0xbd96c1=_0x24f5ab;if(_0xbd96c1[_0x0fcf('0x30')]){for(var _0xe0d01d=0x0;_0xe0d01d<_0xbd96c1[_0x0fcf('0x30')];_0xe0d01d++){_0x13e201[_0x0fcf('0x48')](db[_0x0fcf('0x3f')]['upsert']({'membername':_0x38a57a['name'],'UserId':_0x38a57a['id'],'queue_name':_0xbd96c1[_0xe0d01d]['name'],'VoiceQueueId':_0xbd96c1[_0xe0d01d]['id'],'interface':_0x27ffbf,'paused':_0x38a57a[_0x0fcf('0x4c')]||![],'penalty':_0xbd96c1[_0xe0d01d][_0x0fcf('0x53')]||0x0}));}return BPromise[_0x0fcf('0x49')](_0x13e201);}}}})['then'](function(){if(_0x38a57a){return db[_0x0fcf('0x2c')]['findAll']({'where':{'membername':_0x38a57a[_0x0fcf('0x28')],'exitAt':null}});}})[_0x0fcf('0xf')](function(_0x4d39b3){if(_0x38a57a){if(_0x4d39b3&&_0x4d39b3[_0x0fcf('0x30')]){var _0x7fcd9f=[];_0x4d39b3[_0x0fcf('0x32')](function(_0x13d65d){_0x7fcd9f[_0x0fcf('0x48')](_0x13d65d[_0x0fcf('0x2b')]({'exitAt':moment()[_0x0fcf('0x2e')](_0x0fcf('0x2f'))}));});return BPromise[_0x0fcf('0x49')](_0x7fcd9f);}}})['then'](function(_0x55f141){if(_0x38a57a){var _0x23d313=[];var _0x592fc7=[];var _0x2e4c6a=utils[_0x0fcf('0x31')]();var _0xffaf1f={'membername':_0x38a57a[_0x0fcf('0x28')],'interface':_0x27ffbf,'enterAt':moment()[_0x0fcf('0x2e')](_0x0fcf('0x2f')),'role':_0x38a57a[_0x0fcf('0x29')],'internal':_0x38a57a[_0x0fcf('0x2a')]};_0x2e4c6a[_0x0fcf('0x32')](function(_0x4f9880){_0x23d313[_0x0fcf('0x48')](_[_0x0fcf('0x54')]({'channel':_0x4f9880,'type':'LOGIN','data1':_0x0fcf('0x55'),'data2':_0x27ffbf},_0xffaf1f));if(_0x38a57a[_0x0fcf('0x4c')]){_0x592fc7[_0x0fcf('0x48')](_[_0x0fcf('0x54')]({'channel':_0x4f9880,'type':_0x0fcf('0x2d'),'data1':'LOGININPAUSE'},_0xffaf1f));}});return db['MemberReport'][_0x0fcf('0x39')](_0x23d313[_0x0fcf('0x56')](_0x592fc7),{'individualHooks':!![]});}})[_0x0fcf('0xf')](function(){if(_0x38a57a){return _0x38a57a[_0x0fcf('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x0fcf('0x2e')](_0x0fcf('0x2f')),'voicePause':_0x38a57a[_0x0fcf('0x4c')]||![],'mailPause':_0x38a57a[_0x0fcf('0x4c')]||![],'chatPause':_0x38a57a[_0x0fcf('0x4c')]||![],'faxPause':_0x38a57a[_0x0fcf('0x4c')]||![],'smsPause':_0x38a57a['loginInPause']||![],'openchannelPause':_0x38a57a[_0x0fcf('0x4c')]||![],'pauseType':_0x38a57a['loginInPause']?_0x0fcf('0x57'):null,'lastPauseAt':moment()[_0x0fcf('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x27ffbf});}})[_0x0fcf('0xf')](function(_0x3cfca1){_0x539385(_0x3cfca1);})[_0x0fcf('0x18')](function(_0x5bcf0f){_0x1a57b6(_0x4faeef[_0x0fcf('0x14')](0x1f4,_0x5bcf0f[_0x0fcf('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 132221f..bcf83c0 100644 --- a/server/api/user/user.socket.js +++ b/server/api/user/user.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bcb=['remove','update','emit','length','user:','./user.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3bcb,0xfa));var _0xb3bc=function(_0x6317d6,_0x424384){_0x6317d6=_0x6317d6-0x0;var _0x5add4d=_0x3bcb[_0x6317d6];return _0x5add4d;};'use strict';var UserEvents=require(_0xb3bc('0x0'));var events=[_0xb3bc('0x1'),_0xb3bc('0x2'),_0xb3bc('0x3')];function createListener(_0x9b1061,_0x5df845){return function(_0x31f238){_0x5df845[_0xb3bc('0x4')](_0x9b1061,_0x31f238);};}function removeListener(_0x254967,_0x43fd89){return function(){UserEvents['removeListener'](_0x254967,_0x43fd89);};}exports['register']=function(_0x9b1884){for(var _0x5edead=0x0,_0x705fac=events[_0xb3bc('0x5')];_0x5edead<_0x705fac;_0x5edead++){var _0x3218df=events[_0x5edead];var _0x11d352=createListener(_0xb3bc('0x6')+_0x3218df,_0x9b1884);UserEvents['on'](_0x3218df,_0x11d352);}}; \ No newline at end of file +var _0x7ff4=['save','remove','update','emit','register','user:','./user.events'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x7ff4,0xca));var _0x47ff=function(_0x36a51c,_0x5a454e){_0x36a51c=_0x36a51c-0x0;var _0x4af928=_0x7ff4[_0x36a51c];return _0x4af928;};'use strict';var UserEvents=require(_0x47ff('0x0'));var events=[_0x47ff('0x1'),_0x47ff('0x2'),_0x47ff('0x3')];function createListener(_0xe5a35c,_0xb7f38c){return function(_0x187625){_0xb7f38c[_0x47ff('0x4')](_0xe5a35c,_0x187625);};}function removeListener(_0x52c5e2,_0x2e2408){return function(){UserEvents['removeListener'](_0x52c5e2,_0x2e2408);};}exports[_0x47ff('0x5')]=function(_0x459aa3){for(var _0x366577=0x0,_0x5aff73=events['length'];_0x366577<_0x5aff73;_0x366577++){var _0x86c264=events[_0x366577];var _0x1aeb31=createListener(_0x47ff('0x6')+_0x86c264,_0x459aa3);UserEvents['on'](_0x86c264,_0x1aeb31);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 00df6dc..92d6cd0 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1d11b8,_0x3b3ff9){var _0x19b04b=function(_0x48033f){while(--_0x48033f){_0x1d11b8['push'](_0x1d11b8['shift']());}};_0x19b04b(++_0x3b3ff9);}(_0xedd9,0xfc));var _0x9edd=function(_0x2da71b,_0xd87e6){_0x2da71b=_0x2da71b-0x0;var _0x212fa4=_0xedd9[_0x2da71b];return _0x212fa4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x18cabd,_0x4fc7de){var _0x9f99d7=function(_0xe3f0fd){while(--_0xe3f0fd){_0x18cabd['push'](_0x18cabd['shift']());}};_0x9f99d7(++_0x4fc7de);}(_0x70e0,0x17b));var _0x070e=function(_0x3ec6a1,_0x32a525){_0x3ec6a1=_0x3ec6a1-0x0;var _0x526e17=_0x70e0[_0x3ec6a1];return _0x526e17;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 357a3ae..fe4b0d8 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad94=['exports','INTEGER','sequelize'];(function(_0x542154,_0x171197){var _0x4a40df=function(_0x12b3bc){while(--_0x12b3bc){_0x542154['push'](_0x542154['shift']());}};_0x4a40df(++_0x171197);}(_0xad94,0x1dc));var _0x4ad9=function(_0x2a3124,_0x513b15){_0x2a3124=_0x2a3124-0x0;var _0x3323c8=_0xad94[_0x2a3124];return _0x3323c8;};'use strict';var Sequelize=require(_0x4ad9('0x0'));module[_0x4ad9('0x1')]={'penalty':{'type':Sequelize[_0x4ad9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7958=['INTEGER','sequelize','exports'];(function(_0x2a8093,_0x5bcb32){var _0xaa71c8=function(_0x4e729d){while(--_0x4e729d){_0x2a8093['push'](_0x2a8093['shift']());}};_0xaa71c8(++_0x5bcb32);}(_0x7958,0x88));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8795('0x0'));module[_0x8795('0x1')]={'penalty':{'type':Sequelize[_0x8795('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index eb47f6f..301de7c 100644 --- a/server/api/userChatQueue/userChatQueue.model.js +++ b/server/api/userChatQueue/userChatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bdd=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues'];(function(_0x360333,_0x1cb0da){var _0x300358=function(_0x3b579a){while(--_0x3b579a){_0x360333['push'](_0x360333['shift']());}};_0x300358(++_0x1cb0da);}(_0x6bdd,0xa5));var _0xd6bd=function(_0x28014d,_0x383e2f){_0x28014d=_0x28014d-0x0;var _0x2572cc=_0x6bdd[_0x28014d];return _0x2572cc;};'use strict';var _=require(_0xd6bd('0x0'));var util=require('util');var logger=require(_0xd6bd('0x1'))(_0xd6bd('0x2'));var moment=require('moment');var BPromise=require(_0xd6bd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6bd('0x4'));var rimraf=require(_0xd6bd('0x5'));var config=require(_0xd6bd('0x6'));var attributes=require(_0xd6bd('0x7'));module[_0xd6bd('0x8')]=function(_0x56e630,_0x341323){return _0x56e630['define'](_0xd6bd('0x9'),attributes,{'tableName':_0xd6bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01ee=['UserChatQueue','user_has_chat_queues','lodash','util','api','bluebird','path','rimraf','exports','define'];(function(_0xd0b18,_0x5c6767){var _0x3c40d3=function(_0x4ec325){while(--_0x4ec325){_0xd0b18['push'](_0xd0b18['shift']());}};_0x3c40d3(++_0x5c6767);}(_0x01ee,0x188));var _0xe01e=function(_0x1bad62,_0x9fea54){_0x1bad62=_0x1bad62-0x0;var _0x4520a5=_0x01ee[_0x1bad62];return _0x4520a5;};'use strict';var _=require(_0xe01e('0x0'));var util=require(_0xe01e('0x1'));var logger=require('../../config/logger')(_0xe01e('0x2'));var moment=require('moment');var BPromise=require(_0xe01e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe01e('0x4'));var rimraf=require(_0xe01e('0x5'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0xe01e('0x6')]=function(_0x5c83ab,_0x25b409){return _0x5c83ab[_0xe01e('0x7')](_0xe01e('0x8'),attributes,{'tableName':_0xe01e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 0ccd4b4..2d0e3f0 100644 --- a/server/api/userChatQueue/userChatQueue.rpc.js +++ b/server/api/userChatQueue/userChatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb9c=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3b1863,_0x163786){var _0x3cc94e=function(_0xa31176){while(--_0xa31176){_0x3b1863['push'](_0x3b1863['shift']());}};_0x3cc94e(++_0x163786);}(_0xdb9c,0x197));var _0xcdb9=function(_0x4a2261,_0x5f5ab1){_0x4a2261=_0x4a2261-0x0;var _0x3a6f3e=_0xdb9c[_0x4a2261];return _0x3a6f3e;};'use strict';var _=require(_0xcdb9('0x0'));var util=require('util');var moment=require(_0xcdb9('0x1'));var BPromise=require(_0xcdb9('0x2'));var rs=require(_0xcdb9('0x3'));var fs=require('fs');var Redis=require(_0xcdb9('0x4'));var db=require(_0xcdb9('0x5'))['db'];var utils=require(_0xcdb9('0x6'));var logger=require(_0xcdb9('0x7'))(_0xcdb9('0x8'));var config=require(_0xcdb9('0x9'));var jayson=require(_0xcdb9('0xa'));var client=jayson[_0xcdb9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc107,_0x40d966,_0x12f0cd){return new BPromise(function(_0x5d8001,_0x4802e4){return client[_0xcdb9('0xc')](_0x3cc107,_0x12f0cd)[_0xcdb9('0xd')](function(_0x1f5dfd){logger['info'](_0xcdb9('0xe'),_0x40d966,_0xcdb9('0xf'));logger[_0xcdb9('0x10')](_0xcdb9('0x11'),_0x40d966,_0xcdb9('0xf'),JSON[_0xcdb9('0x12')](_0x1f5dfd));if(_0x1f5dfd[_0xcdb9('0x13')]){if(_0x1f5dfd[_0xcdb9('0x13')][_0xcdb9('0x14')]===0x1f4){logger[_0xcdb9('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x40d966,_0x1f5dfd[_0xcdb9('0x13')][_0xcdb9('0x15')]);return _0x4802e4(_0x1f5dfd[_0xcdb9('0x13')][_0xcdb9('0x15')]);}logger[_0xcdb9('0x13')](_0xcdb9('0xe'),_0x40d966,_0x1f5dfd['error']['message']);return _0x5d8001(_0x1f5dfd[_0xcdb9('0x13')][_0xcdb9('0x15')]);}else{logger[_0xcdb9('0x16')](_0xcdb9('0xe'),_0x40d966,_0xcdb9('0xf'));_0x5d8001(_0x1f5dfd[_0xcdb9('0x17')][_0xcdb9('0x15')]);}})[_0xcdb9('0x18')](function(_0x4993ab){logger[_0xcdb9('0x13')](_0xcdb9('0xe'),_0x40d966,_0x4993ab);_0x4802e4(_0x4993ab);});});} \ No newline at end of file +var _0x6deb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x469b7d,_0x4760f8){var _0xc78a4b=function(_0xd48e6c){while(--_0xd48e6c){_0x469b7d['push'](_0x469b7d['shift']());}};_0xc78a4b(++_0x4760f8);}(_0x6deb,0x1cb));var _0xb6de=function(_0x2638bf,_0x3ebef6){_0x2638bf=_0x2638bf-0x0;var _0x33e951=_0x6deb[_0x2638bf];return _0x33e951;};'use strict';var _=require(_0xb6de('0x0'));var util=require(_0xb6de('0x1'));var moment=require(_0xb6de('0x2'));var BPromise=require(_0xb6de('0x3'));var rs=require(_0xb6de('0x4'));var fs=require('fs');var Redis=require(_0xb6de('0x5'));var db=require(_0xb6de('0x6'))['db'];var utils=require(_0xb6de('0x7'));var logger=require(_0xb6de('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x149018,_0x5b302d,_0x41e24){return new BPromise(function(_0x440487,_0x2b9927){return client[_0xb6de('0x9')](_0x149018,_0x41e24)[_0xb6de('0xa')](function(_0x5c1160){logger[_0xb6de('0xb')](_0xb6de('0xc'),_0x5b302d,_0xb6de('0xd'));logger[_0xb6de('0xe')](_0xb6de('0xf'),_0x5b302d,_0xb6de('0xd'),JSON[_0xb6de('0x10')](_0x5c1160));if(_0x5c1160[_0xb6de('0x11')]){if(_0x5c1160[_0xb6de('0x11')][_0xb6de('0x12')]===0x1f4){logger[_0xb6de('0x11')](_0xb6de('0xc'),_0x5b302d,_0x5c1160[_0xb6de('0x11')]['message']);return _0x2b9927(_0x5c1160[_0xb6de('0x11')][_0xb6de('0x13')]);}logger[_0xb6de('0x11')](_0xb6de('0xc'),_0x5b302d,_0x5c1160[_0xb6de('0x11')][_0xb6de('0x13')]);return _0x440487(_0x5c1160['error'][_0xb6de('0x13')]);}else{logger[_0xb6de('0xb')](_0xb6de('0xc'),_0x5b302d,_0xb6de('0xd'));_0x440487(_0x5c1160[_0xb6de('0x14')][_0xb6de('0x13')]);}})[_0xb6de('0x15')](function(_0x25ea68){logger[_0xb6de('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x5b302d,_0x25ea68);_0x2b9927(_0x25ea68);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 88d5cb1..8931ca9 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1ec1c5,_0x408315){var _0x582fcd=function(_0x3a9942){while(--_0x3a9942){_0x1ec1c5['push'](_0x1ec1c5['shift']());}};_0x582fcd(++_0x408315);}(_0x70e0,0x17b));var _0x070e=function(_0x2b3206,_0xc59ff2){_0x2b3206=_0x2b3206-0x0;var _0x5e5f3e=_0x70e0[_0x2b3206];return _0x5e5f3e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1a8fdb,_0x38d30b){var _0x4bf757=function(_0x4ed678){while(--_0x4ed678){_0x1a8fdb['push'](_0x1a8fdb['shift']());}};_0x4bf757(++_0x38d30b);}(_0xedd9,0xfc));var _0x9edd=function(_0x210b8c,_0xd76f59){_0x210b8c=_0x210b8c-0x0;var _0xf39efa=_0xedd9[_0x210b8c];return _0xf39efa;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ba4bf84..a22f4ce 100644 --- a/server/api/userFaxQueue/userFaxQueue.attributes.js +++ b/server/api/userFaxQueue/userFaxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4466=['exports','INTEGER'];(function(_0x1c0ed9,_0x1f91bc){var _0x58d283=function(_0x3c9b42){while(--_0x3c9b42){_0x1c0ed9['push'](_0x1c0ed9['shift']());}};_0x58d283(++_0x1f91bc);}(_0x4466,0xa8));var _0x6446=function(_0x534c33,_0x120ebc){_0x534c33=_0x534c33-0x0;var _0x22b732=_0x4466[_0x534c33];return _0x22b732;};'use strict';var Sequelize=require('sequelize');module[_0x6446('0x0')]={'penalty':{'type':Sequelize[_0x6446('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6446('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc92=['INTEGER','STRING','sequelize','exports'];(function(_0xe68430,_0x7d734a){var _0x12e029=function(_0x3991c0){while(--_0x3991c0){_0xe68430['push'](_0xe68430['shift']());}};_0x12e029(++_0x7d734a);}(_0xdc92,0x1ee));var _0x2dc9=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0xdc92[_0x47242d];return _0x30273a;};'use strict';var Sequelize=require(_0x2dc9('0x0'));module[_0x2dc9('0x1')]={'penalty':{'type':Sequelize[_0x2dc9('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x2dc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index b412f6a..ca09546 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74ef=['path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0xa6effa,_0x3bd873){var _0x36545f=function(_0x1a6f8a){while(--_0x1a6f8a){_0xa6effa['push'](_0xa6effa['shift']());}};_0x36545f(++_0x3bd873);}(_0x74ef,0x104));var _0xf74e=function(_0x4eb813,_0x1bdff4){_0x4eb813=_0x4eb813-0x0;var _0x1df390=_0x74ef[_0x4eb813];return _0x1df390;};'use strict';var _=require(_0xf74e('0x0'));var util=require(_0xf74e('0x1'));var logger=require('../../config/logger')(_0xf74e('0x2'));var moment=require(_0xf74e('0x3'));var BPromise=require(_0xf74e('0x4'));var rp=require(_0xf74e('0x5'));var fs=require('fs');var path=require(_0xf74e('0x6'));var rimraf=require(_0xf74e('0x7'));var config=require(_0xf74e('0x8'));var attributes=require(_0xf74e('0x9'));module[_0xf74e('0xa')]=function(_0x8c9507,_0x2bd350){return _0x8c9507[_0xf74e('0xb')](_0xf74e('0xc'),attributes,{'tableName':_0xf74e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe77d=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1c9771,_0x192fdd){var _0x3a9a12=function(_0x4e77d1){while(--_0x4e77d1){_0x1c9771['push'](_0x1c9771['shift']());}};_0x3a9a12(++_0x192fdd);}(_0xe77d,0x116));var _0xde77=function(_0x888a02,_0x5df389){_0x888a02=_0x888a02-0x0;var _0xedd786=_0xe77d[_0x888a02];return _0xedd786;};'use strict';var _=require(_0xde77('0x0'));var util=require(_0xde77('0x1'));var logger=require(_0xde77('0x2'))(_0xde77('0x3'));var moment=require(_0xde77('0x4'));var BPromise=require(_0xde77('0x5'));var rp=require(_0xde77('0x6'));var fs=require('fs');var path=require(_0xde77('0x7'));var rimraf=require(_0xde77('0x8'));var config=require(_0xde77('0x9'));var attributes=require('./userFaxQueue.attributes');module[_0xde77('0xa')]=function(_0x485521,_0x2d95cf){return _0x485521[_0xde77('0xb')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 94c07c9..de63b66 100644 --- a/server/api/userFaxQueue/userFaxQueue.rpc.js +++ b/server/api/userFaxQueue/userFaxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0f6=['http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1db5b5,_0x330f9a){var _0x33483c=function(_0x5cc31c){while(--_0x5cc31c){_0x1db5b5['push'](_0x1db5b5['shift']());}};_0x33483c(++_0x330f9a);}(_0xd0f6,0x153));var _0x6d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6d0f('0x0'));var moment=require(_0x6d0f('0x1'));var BPromise=require(_0x6d0f('0x2'));var rs=require(_0x6d0f('0x3'));var fs=require('fs');var Redis=require(_0x6d0f('0x4'));var db=require(_0x6d0f('0x5'))['db'];var utils=require(_0x6d0f('0x6'));var logger=require(_0x6d0f('0x7'))(_0x6d0f('0x8'));var config=require(_0x6d0f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6d0f('0xa')][_0x6d0f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ffe6d,_0x183f6f,_0x41f15b){return new BPromise(function(_0x3986b6,_0x16d29f){return client[_0x6d0f('0xc')](_0x1ffe6d,_0x41f15b)[_0x6d0f('0xd')](function(_0x1e57f2){logger['info'](_0x6d0f('0xe'),_0x183f6f,_0x6d0f('0xf'));logger[_0x6d0f('0x10')](_0x6d0f('0x11'),_0x183f6f,_0x6d0f('0xf'),JSON[_0x6d0f('0x12')](_0x1e57f2));if(_0x1e57f2[_0x6d0f('0x13')]){if(_0x1e57f2[_0x6d0f('0x13')][_0x6d0f('0x14')]===0x1f4){logger[_0x6d0f('0x13')](_0x6d0f('0xe'),_0x183f6f,_0x1e57f2[_0x6d0f('0x13')][_0x6d0f('0x15')]);return _0x16d29f(_0x1e57f2[_0x6d0f('0x13')][_0x6d0f('0x15')]);}logger[_0x6d0f('0x13')](_0x6d0f('0xe'),_0x183f6f,_0x1e57f2[_0x6d0f('0x13')]['message']);return _0x3986b6(_0x1e57f2['error'][_0x6d0f('0x15')]);}else{logger[_0x6d0f('0x16')](_0x6d0f('0xe'),_0x183f6f,_0x6d0f('0xf'));_0x3986b6(_0x1e57f2[_0x6d0f('0x17')][_0x6d0f('0x15')]);}})[_0x6d0f('0x18')](function(_0x2a4736){logger[_0x6d0f('0x13')](_0x6d0f('0xe'),_0x183f6f,_0x2a4736);_0x16d29f(_0x2a4736);});});} \ No newline at end of file +var _0x0813=['../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0813,0x195));var _0x3081=function(_0x52be08,_0x41e972){_0x52be08=_0x52be08-0x0;var _0x1b8f09=_0x0813[_0x52be08];return _0x1b8f09;};'use strict';var _=require(_0x3081('0x0'));var util=require(_0x3081('0x1'));var moment=require(_0x3081('0x2'));var BPromise=require(_0x3081('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3081('0x4'));var db=require(_0x3081('0x5'))['db'];var utils=require(_0x3081('0x6'));var logger=require(_0x3081('0x7'))(_0x3081('0x8'));var config=require(_0x3081('0x9'));var jayson=require(_0x3081('0xa'));var client=jayson[_0x3081('0xb')][_0x3081('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2898ec,_0x105242,_0x351f25){return new BPromise(function(_0x18e474,_0xaadf61){return client[_0x3081('0xd')](_0x2898ec,_0x351f25)[_0x3081('0xe')](function(_0x3a39ce){logger[_0x3081('0xf')](_0x3081('0x10'),_0x105242,_0x3081('0x11'));logger['debug'](_0x3081('0x12'),_0x105242,_0x3081('0x11'),JSON[_0x3081('0x13')](_0x3a39ce));if(_0x3a39ce[_0x3081('0x14')]){if(_0x3a39ce[_0x3081('0x14')][_0x3081('0x15')]===0x1f4){logger[_0x3081('0x14')](_0x3081('0x10'),_0x105242,_0x3a39ce[_0x3081('0x14')][_0x3081('0x16')]);return _0xaadf61(_0x3a39ce['error'][_0x3081('0x16')]);}logger[_0x3081('0x14')](_0x3081('0x10'),_0x105242,_0x3a39ce[_0x3081('0x14')]['message']);return _0x18e474(_0x3a39ce[_0x3081('0x14')][_0x3081('0x16')]);}else{logger[_0x3081('0xf')](_0x3081('0x10'),_0x105242,_0x3081('0x11'));_0x18e474(_0x3a39ce['result'][_0x3081('0x16')]);}})['catch'](function(_0x2aea25){logger[_0x3081('0x14')](_0x3081('0x10'),_0x105242,_0x2aea25);_0xaadf61(_0x2aea25);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 828684c..3022159 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x574a43,_0x6967bd){var _0x31cb92=function(_0x7b030d){while(--_0x7b030d){_0x574a43['push'](_0x574a43['shift']());}};_0x31cb92(++_0x6967bd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0xcb91[_0x4be8ba];return _0x1af822;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3a294e,_0x5770d2){var _0x40832f=function(_0x12c18d){while(--_0x12c18d){_0x3a294e['push'](_0x3a294e['shift']());}};_0x40832f(++_0x5770d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 1ec795a..9f3b9c0 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf354=['sequelize','exports'];(function(_0x7632fb,_0x2aa344){var _0xff3d05=function(_0x4a5d16){while(--_0x4a5d16){_0x7632fb['push'](_0x7632fb['shift']());}};_0xff3d05(++_0x2aa344);}(_0xf354,0x17c));var _0x4f35=function(_0x330824,_0x1214e3){_0x330824=_0x330824-0x0;var _0x3a1593=_0xf354[_0x330824];return _0x3a1593;};'use strict';var Sequelize=require(_0x4f35('0x0'));module[_0x4f35('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x32dd=['exports','sequelize'];(function(_0x3ad393,_0x348025){var _0x269fd4=function(_0x403c38){while(--_0x403c38){_0x3ad393['push'](_0x3ad393['shift']());}};_0x269fd4(++_0x348025);}(_0x32dd,0x99));var _0xd32d=function(_0x68c4e3,_0x5b18b0){_0x68c4e3=_0x68c4e3-0x0;var _0xaca048=_0x32dd[_0x68c4e3];return _0xaca048;};'use strict';var Sequelize=require(_0xd32d('0x0'));module[_0xd32d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 6e62836..59eb4ac 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf08b=['define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xf08b,0x7b));var _0xbf08=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf08b[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xbf08('0x0'));var util=require(_0xbf08('0x1'));var logger=require('../../config/logger')(_0xbf08('0x2'));var moment=require(_0xbf08('0x3'));var BPromise=require(_0xbf08('0x4'));var rp=require(_0xbf08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf08('0x6'));var config=require(_0xbf08('0x7'));var attributes=require('./userMailQueue.attributes');module[_0xbf08('0x8')]=function(_0x1b9087,_0x35d05f){return _0x1b9087[_0xbf08('0x9')](_0xbf08('0xa'),attributes,{'tableName':_0xbf08('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d08=['api','path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x5a6f93,_0x19c0d3){var _0x14bf43=function(_0x2bf049){while(--_0x2bf049){_0x5a6f93['push'](_0x5a6f93['shift']());}};_0x14bf43(++_0x19c0d3);}(_0x8d08,0xd9));var _0x88d0=function(_0x6622a2,_0x401a17){_0x6622a2=_0x6622a2-0x0;var _0x52252e=_0x8d08[_0x6622a2];return _0x52252e;};'use strict';var _=require(_0x88d0('0x0'));var util=require(_0x88d0('0x1'));var logger=require(_0x88d0('0x2'))(_0x88d0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x88d0('0x4'));var rimraf=require(_0x88d0('0x5'));var config=require('../../config/environment');var attributes=require(_0x88d0('0x6'));module[_0x88d0('0x7')]=function(_0x447cef,_0x48dba3){return _0x447cef[_0x88d0('0x8')](_0x88d0('0x9'),attributes,{'tableName':_0x88d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 63540b6..999d141 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x506690,_0x1798fd){var _0x4e7347=function(_0x59cc07){while(--_0x59cc07){_0x506690['push'](_0x506690['shift']());}};_0x4e7347(++_0x1798fd);}(_0xa41a,0x6b));var _0xaa41=function(_0x4fde83,_0x2d9011){_0x4fde83=_0x4fde83-0x0;var _0x3b33e3=_0xa41a[_0x4fde83];return _0x3b33e3;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x9a98d9,_0x2dd2c7){var _0x5da06b=function(_0x4913bd){while(--_0x4913bd){_0x9a98d9['push'](_0x9a98d9['shift']());}};_0x5da06b(++_0x2dd2c7);}(_0x6aa7,0x178));var _0x76aa=function(_0x5af9fb,_0x56da36){_0x5af9fb=_0x5af9fb-0x0;var _0x378cd7=_0x6aa7[_0x5af9fb];return _0x378cd7;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 3bef7fe..582b081 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x622f=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports'];(function(_0x2c86e6,_0x2fc68c){var _0x1ac7a1=function(_0x3094a7){while(--_0x3094a7){_0x2c86e6['push'](_0x2c86e6['shift']());}};_0x1ac7a1(++_0x2fc68c);}(_0x622f,0x172));var _0xf622=function(_0x193bb6,_0x5db9a8){_0x193bb6=_0x193bb6-0x0;var _0x1e3b96=_0x622f[_0x193bb6];return _0x1e3b96;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf622('0x0'));var timeout=require(_0xf622('0x1'));var express=require('express');var router=express[_0xf622('0x2')]();var fs_extra=require(_0xf622('0x3'));var auth=require(_0xf622('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf622('0x5'));var controller=require('./userNotification.controller');router[_0xf622('0x6')]('/',auth[_0xf622('0x7')](),controller[_0xf622('0x8')]);module[_0xf622('0x9')]=router; \ No newline at end of file +var _0xc0c1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports'];(function(_0x1b3335,_0x2b2f52){var _0x300d95=function(_0x2c2a38){while(--_0x2c2a38){_0x1b3335['push'](_0x1b3335['shift']());}};_0x300d95(++_0x2b2f52);}(_0xc0c1,0x15f));var _0x1c0c=function(_0x3009e0,_0x53d3b){_0x3009e0=_0x3009e0-0x0;var _0x106b8f=_0xc0c1[_0x3009e0];return _0x106b8f;};'use strict';var multer=require('multer');var util=require(_0x1c0c('0x0'));var path=require(_0x1c0c('0x1'));var timeout=require(_0x1c0c('0x2'));var express=require(_0x1c0c('0x3'));var router=express[_0x1c0c('0x4')]();var fs_extra=require(_0x1c0c('0x5'));var auth=require(_0x1c0c('0x6'));var interaction=require(_0x1c0c('0x7'));var config=require(_0x1c0c('0x8'));var controller=require(_0x1c0c('0x9'));router[_0x1c0c('0xa')]('/',auth['isAuthenticated'](),controller[_0x1c0c('0xb')]);module[_0x1c0c('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 181a71a..b2f4690 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae0d=['BOOLEAN','sequelize','exports','STRING','TEXT'];(function(_0x52b9ea,_0x448b3d){var _0x1dcb6c=function(_0x1ea595){while(--_0x1ea595){_0x52b9ea['push'](_0x52b9ea['shift']());}};_0x1dcb6c(++_0x448b3d);}(_0xae0d,0x6f));var _0xdae0=function(_0x1f5165,_0x4c8e0b){_0x1f5165=_0x1f5165-0x0;var _0x4ddee0=_0xae0d[_0x1f5165];return _0x4ddee0;};'use strict';var Sequelize=require(_0xdae0('0x0'));module[_0xdae0('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xdae0('0x2')]},'recipientsId':{'type':Sequelize[_0xdae0('0x3')]},'recipientsDescription':{'type':Sequelize[_0xdae0('0x2')]},'beep':{'type':Sequelize[_0xdae0('0x4')]}}; \ No newline at end of file +var _0xe564=['exports','TEXT','STRING','BOOLEAN'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xe564,0x1d8));var _0x4e56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe564[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x4e56('0x0')]={'body':{'type':Sequelize[_0x4e56('0x1')]},'senderName':{'type':Sequelize[_0x4e56('0x2')]},'recipientsId':{'type':Sequelize[_0x4e56('0x1')]},'recipientsDescription':{'type':Sequelize[_0x4e56('0x2')]},'beep':{'type':Sequelize[_0x4e56('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 890cbfd..c98114c 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad03=['mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','create','senderName','recipient','emit','userNotification:send','catch','findOne','html','render','forEach','startCase','union','ids','queue','Queue','push','all','flatten','map','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','text','body','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','TemplateId','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xad03,0x14f));var _0x3ad0=function(_0x4f0b6f,_0x3ddce5){_0x4f0b6f=_0x4f0b6f-0x0;var _0x3a44cd=_0xad03[_0x4f0b6f];return _0x3a44cd;};'use strict';var emlformat=require(_0x3ad0('0x0'));var rimraf=require(_0x3ad0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3ad0('0x2'));var moment=require(_0x3ad0('0x3'));var BPromise=require(_0x3ad0('0x4'));var Mustache=require(_0x3ad0('0x5'));var util=require('util');var path=require(_0x3ad0('0x6'));var sox=require(_0x3ad0('0x7'));var csv=require('to-csv');var ejs=require(_0x3ad0('0x8'));var fs=require('fs');var fs_extra=require(_0x3ad0('0x9'));var _=require('lodash');var squel=require(_0x3ad0('0xa'));var crypto=require(_0x3ad0('0xb'));var jsforce=require(_0x3ad0('0xc'));var deskjs=require(_0x3ad0('0xd'));var toCsv=require(_0x3ad0('0xe'));var querystring=require(_0x3ad0('0xf'));var Papa=require(_0x3ad0('0x10'));var Redis=require('ioredis');var authService=require(_0x3ad0('0x11'));var qs=require(_0x3ad0('0x12'));var as=require(_0x3ad0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ad0('0x14'))(_0x3ad0('0x15'));var utils=require(_0x3ad0('0x16'));var config=require(_0x3ad0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3ad0('0x18')]=_[_0x3ad0('0x19')](config['redis'],{'host':_0x3ad0('0x1a'),'port':0x18eb});var socket=require(_0x3ad0('0x1b'))(new Redis(config['redis']));require(_0x3ad0('0x1c'))['register'](socket);function respondWithStatusCode(_0x4a892c,_0x28dc0f){_0x28dc0f=_0x28dc0f||0xcc;return function(_0xaaf56e){if(_0xaaf56e){return _0x4a892c[_0x3ad0('0x1d')](_0x28dc0f);}return _0x4a892c['status'](_0x28dc0f)[_0x3ad0('0x1e')]();};}function respondWithResult(_0x5ab4b1,_0x529595){_0x529595=_0x529595||0xc8;return function(_0x21ee37){if(_0x21ee37){return _0x5ab4b1[_0x3ad0('0x1f')](_0x529595)[_0x3ad0('0x20')](_0x21ee37);}};}function respondWithFilteredResult(_0x2f7f17,_0xad1d35){return function(_0x3df93b){if(_0x3df93b){var _0x297b4d=typeof _0xad1d35[_0x3ad0('0x21')]===_0x3ad0('0x22')&&typeof _0xad1d35[_0x3ad0('0x23')]===_0x3ad0('0x22');var _0x11baf2=_0x3df93b[_0x3ad0('0x24')];var _0x384413=_0x297b4d?0x0:_0xad1d35[_0x3ad0('0x21')];var _0x523856=_0x297b4d?_0x3df93b['count']:_0xad1d35[_0x3ad0('0x21')]+_0xad1d35['limit'];var _0x5d9f5f;if(_0x523856>=_0x11baf2){_0x523856=_0x11baf2;_0x5d9f5f=0xc8;}else{_0x5d9f5f=0xce;}_0x2f7f17[_0x3ad0('0x1f')](_0x5d9f5f);return _0x2f7f17[_0x3ad0('0x25')](_0x3ad0('0x26'),_0x384413+'-'+_0x523856+'/'+_0x11baf2)[_0x3ad0('0x20')](_0x3df93b);}return null;};}function patchUpdates(_0x4bcffb){return function(_0x4fc4e5){try{jsonpatch['apply'](_0x4fc4e5,_0x4bcffb,!![]);}catch(_0x5efb53){return BPromise[_0x3ad0('0x27')](_0x5efb53);}return _0x4fc4e5[_0x3ad0('0x28')]();};}function saveUpdates(_0x4ad86c,_0x522be1){return function(_0x384b92){if(_0x384b92){return _0x384b92['update'](_0x4ad86c)[_0x3ad0('0x29')](function(_0x41ed13){return _0x41ed13;});}return null;};}function removeEntity(_0x1d259a,_0x1ea950){return function(_0x22508){if(_0x22508){return _0x22508[_0x3ad0('0x2a')]()['then'](function(){_0x1d259a['status'](0xcc)[_0x3ad0('0x1e')]();});}};}function handleEntityNotFound(_0x1e13de,_0x182d53){return function(_0x1c862e){if(!_0x1c862e){_0x1e13de[_0x3ad0('0x1d')](0x194);}return _0x1c862e;};}function handleError(_0x2c2130,_0x5b1f20){_0x5b1f20=_0x5b1f20||0x1f4;return function(_0x25ffbf){logger[_0x3ad0('0x2b')](_0x25ffbf[_0x3ad0('0x2c')]);if(_0x25ffbf[_0x3ad0('0x2d')]){delete _0x25ffbf[_0x3ad0('0x2d')];}_0x2c2130[_0x3ad0('0x1f')](_0x5b1f20)[_0x3ad0('0x2e')](_0x25ffbf);};}exports['sendUserNotification']=function(_0x260112,_0x4f9009,_0x1000cd){if(!_0x260112['body']['hasOwnProperty'](_0x3ad0('0x2f'))&&!_0x260112[_0x3ad0('0x30')]['hasOwnProperty']('TemplateId')){throw new db[(_0x3ad0('0x31'))][(_0x3ad0('0x32'))](_0x3ad0('0x33'));}else{if(_0x260112['body'][_0x3ad0('0x34')](_0x3ad0('0x35'))&&!_0x260112[_0x3ad0('0x30')][_0x3ad0('0x34')](_0x3ad0('0x36'))){throw new db['Sequelize'][(_0x3ad0('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x260112[_0x3ad0('0x30')][_0x3ad0('0x34')](_0x3ad0('0x37'))){throw new db[(_0x3ad0('0x31'))][(_0x3ad0('0x32'))](_0x3ad0('0x38'));}else{try{var _0x1ddb96=JSON[_0x3ad0('0x39')](_0x260112[_0x3ad0('0x30')][_0x3ad0('0x37')]);}catch(_0x953ba){logger[_0x3ad0('0x2b')](_0x953ba);throw new db[(_0x3ad0('0x31'))][(_0x3ad0('0x32'))](_0x3ad0('0x3a'));}var _0x3c3ac5=[_0x3ad0('0x3b'),_0x3ad0('0x3c'),_0x3ad0('0x3d'),'openchannelqueue',_0x3ad0('0x3e'),_0x3ad0('0x3f'),_0x3ad0('0x40'),_0x3ad0('0x41'),_0x3ad0('0x42')];if(_[_0x3ad0('0x43')](_0x1ddb96,function(_0x37ad21){return!_[_0x3ad0('0x44')](_0x3c3ac5,_0x37ad21[_0x3ad0('0x45')][_0x3ad0('0x46')]());})){throw new db[(_0x3ad0('0x31'))][(_0x3ad0('0x32'))](_0x3ad0('0x47'));}}}var _0x3b8510={};_0x3b8510['senderName']=_0x260112[_0x3ad0('0x30')][_0x3ad0('0x34')]('senderName')?_0x260112['body']['senderName']:_0x260112[_0x3ad0('0x42')][_0x3ad0('0x48')];_0x3b8510[_0x3ad0('0x49')]=_[_0x3ad0('0x4a')](_0x260112[_0x3ad0('0x30')][_0x3ad0('0x49')])?null:_0x260112[_0x3ad0('0x30')][_0x3ad0('0x49')];_0x3b8510['beep']=_0x260112[_0x3ad0('0x30')][_0x3ad0('0x4b')]||![];_0x3b8510[_0x3ad0('0x4c')]=_0x260112['user']['id'];return getContent(_0x260112['body'])[_0x3ad0('0x29')](function(_0x5aec76){_0x3b8510[_0x3ad0('0x30')]=_0x5aec76;return getRecipients(_0x1ddb96);})['then'](function(_0x55c3d5){_0x3b8510[_0x3ad0('0x4d')]=_[_0x3ad0('0x4e')](_0x55c3d5)[_0x3ad0('0x4f')](',');return db['sequelize']['transaction'](function(_0x2753da){return db['UserNotification'][_0x3ad0('0x50')](_0x3b8510,{'raw':!![],'transaction':_0x2753da})[_0x3ad0('0x29')](function(_0x2214d7){var _0x1ef3a8={'sender':_0x3b8510[_0x3ad0('0x51')],'description':_0x3b8510['recipientsDescription'],'content':_0x3b8510[_0x3ad0('0x30')],'beep':_0x3b8510['beep']};_0x55c3d5['forEach'](function(_0x23130d){_0x1ef3a8[_0x3ad0('0x52')]=_0x23130d;socket[_0x3ad0('0x53')](_0x3ad0('0x54'),_0x1ef3a8);});return _0x2214d7;});});})[_0x3ad0('0x29')](respondWithResult(_0x4f9009,0xc9))[_0x3ad0('0x55')](handleError(_0x4f9009,null));};function getContent(_0x156a73){return new BPromise(function(_0x28a122,_0x11c290){if(_0x156a73['text']){_0x28a122(_0x156a73[_0x3ad0('0x2f')]);return;}return db['Template'][_0x3ad0('0x56')]({'attributes':[_0x3ad0('0x57')],'where':{'id':_0x156a73[_0x3ad0('0x35')]},'raw':!![]})[_0x3ad0('0x29')](function(_0xb35d17){if(!_0xb35d17)throw new db[(_0x3ad0('0x31'))][(_0x3ad0('0x32'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x38035c=Mustache[_0x3ad0('0x58')](_0xb35d17[_0x3ad0('0x57')],_0x156a73[_0x3ad0('0x36')]);_0x28a122(_0x38035c);})['catch'](function(_0x2ff732){_0x11c290(_0x2ff732);});});}function getRecipients(_0x5760bf){return new BPromise(function(_0x26e549,_0x15eb2a){var _0x1ab31d=[];var _0x15b27b=[];_0x5760bf[_0x3ad0('0x59')](function(_0x3c1fa2){var _0x440737=_[_0x3ad0('0x5a')](_0x3c1fa2[_0x3ad0('0x45')][_0x3ad0('0x46')]());if(_0x440737==='User'){_0x1ab31d=_[_0x3ad0('0x5b')](_0x1ab31d,_0x3c1fa2[_0x3ad0('0x5c')]);}else{if(_[_0x3ad0('0x44')](_0x440737,_0x3ad0('0x5d')))_0x440737=_0x440737['replace'](_0x3ad0('0x5d'),_0x3ad0('0x5e'));_0x3c1fa2[_0x3ad0('0x5c')][_0x3ad0('0x59')](function(_0x7aba01){_0x15b27b[_0x3ad0('0x5f')](getAgents(_0x440737,_0x7aba01));});}});return BPromise[_0x3ad0('0x60')](_0x15b27b)[_0x3ad0('0x29')](function(_0x49935){_0x1ab31d=_['union'](_0x1ab31d,_[_0x3ad0('0x61')](_0x49935));_0x26e549(_0x1ab31d);})[_0x3ad0('0x55')](function(_0x2f30c2){_0x15eb2a(_0x2f30c2);});});}function getAgents(_0x42e25b,_0x22a35a){return new BPromise(function(_0x32a0af,_0x5ba708){return db[_0x42e25b][_0x3ad0('0x56')]({'where':{'id':_0x22a35a}})[_0x3ad0('0x29')](function(_0x344e5a){return _0x344e5a['getAgents']({'attributes':['id'],'raw':!![]})[_0x3ad0('0x29')](function(_0x2e39ce){var _0xf4224f=_[_0x3ad0('0x62')](_0x2e39ce,'id');_0x32a0af(_0xf4224f);});})[_0x3ad0('0x55')](function(_0xc536c5){_0x5ba708(_0xc536c5);});});} \ No newline at end of file +var _0xcb7c=['fullname','recipientsDescription','beep','SenderId','join','sequelize','recipient','emit','catch','Template','findOne','html','render','view','forEach','startCase','toLowerCase','union','ids','includes','queue','replace','Queue','push','all','map','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','model','senderName'];(function(_0x51801f,_0x4a5cd0){var _0x15d7d1=function(_0x5cb65f){while(--_0x5cb65f){_0x51801f['push'](_0x51801f['shift']());}};_0x15d7d1(++_0x4a5cd0);}(_0xcb7c,0x70));var _0xccb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb7c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xccb7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xccb7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccb7('0x2'));var moment=require('moment');var BPromise=require(_0xccb7('0x3'));var Mustache=require('mustache');var util=require(_0xccb7('0x4'));var path=require(_0xccb7('0x5'));var sox=require(_0xccb7('0x6'));var csv=require(_0xccb7('0x7'));var ejs=require(_0xccb7('0x8'));var fs=require('fs');var fs_extra=require(_0xccb7('0x9'));var _=require('lodash');var squel=require(_0xccb7('0xa'));var crypto=require('crypto');var jsforce=require(_0xccb7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xccb7('0x7'));var querystring=require(_0xccb7('0xc'));var Papa=require(_0xccb7('0xd'));var Redis=require(_0xccb7('0xe'));var authService=require(_0xccb7('0xf'));var qs=require(_0xccb7('0x10'));var as=require(_0xccb7('0x11'));var hardwareService=require(_0xccb7('0x12'));var logger=require(_0xccb7('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xccb7('0x14'))['db'];config[_0xccb7('0x15')]=_[_0xccb7('0x16')](config[_0xccb7('0x15')],{'host':_0xccb7('0x17'),'port':0x18eb});var socket=require(_0xccb7('0x18'))(new Redis(config[_0xccb7('0x15')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x1d5894,_0x11ddd1){_0x11ddd1=_0x11ddd1||0xcc;return function(_0x129d12){if(_0x129d12){return _0x1d5894[_0xccb7('0x19')](_0x11ddd1);}return _0x1d5894[_0xccb7('0x1a')](_0x11ddd1)[_0xccb7('0x1b')]();};}function respondWithResult(_0x11f796,_0x5066ba){_0x5066ba=_0x5066ba||0xc8;return function(_0x5ab3dc){if(_0x5ab3dc){return _0x11f796[_0xccb7('0x1a')](_0x5066ba)[_0xccb7('0x1c')](_0x5ab3dc);}};}function respondWithFilteredResult(_0x4497fc,_0x4f54b1){return function(_0x4baf49){if(_0x4baf49){var _0x29fb26=typeof _0x4f54b1[_0xccb7('0x1d')]===_0xccb7('0x1e')&&typeof _0x4f54b1[_0xccb7('0x1f')]===_0xccb7('0x1e');var _0x721824=_0x4baf49['count'];var _0x1a727e=_0x29fb26?0x0:_0x4f54b1[_0xccb7('0x1d')];var _0x224af8=_0x29fb26?_0x4baf49[_0xccb7('0x20')]:_0x4f54b1[_0xccb7('0x1d')]+_0x4f54b1[_0xccb7('0x1f')];var _0x4bf8ad;if(_0x224af8>=_0x721824){_0x224af8=_0x721824;_0x4bf8ad=0xc8;}else{_0x4bf8ad=0xce;}_0x4497fc[_0xccb7('0x1a')](_0x4bf8ad);return _0x4497fc[_0xccb7('0x21')](_0xccb7('0x22'),_0x1a727e+'-'+_0x224af8+'/'+_0x721824)[_0xccb7('0x1c')](_0x4baf49);}return null;};}function patchUpdates(_0x41f3c5){return function(_0x2b19f1){try{jsonpatch[_0xccb7('0x23')](_0x2b19f1,_0x41f3c5,!![]);}catch(_0xe5decb){return BPromise['reject'](_0xe5decb);}return _0x2b19f1[_0xccb7('0x24')]();};}function saveUpdates(_0x414f92,_0x418483){return function(_0x5804de){if(_0x5804de){return _0x5804de['update'](_0x414f92)['then'](function(_0x3e3025){return _0x3e3025;});}return null;};}function removeEntity(_0x23441e,_0x3b30b0){return function(_0x2fc481){if(_0x2fc481){return _0x2fc481['destroy']()[_0xccb7('0x25')](function(){_0x23441e['status'](0xcc)[_0xccb7('0x1b')]();});}};}function handleEntityNotFound(_0x45b3fb,_0xdc1bfc){return function(_0x19edcd){if(!_0x19edcd){_0x45b3fb[_0xccb7('0x19')](0x194);}return _0x19edcd;};}function handleError(_0x54cbb0,_0xb3a3e2){_0xb3a3e2=_0xb3a3e2||0x1f4;return function(_0x29a480){logger[_0xccb7('0x26')](_0x29a480['stack']);if(_0x29a480[_0xccb7('0x27')]){delete _0x29a480['name'];}_0x54cbb0[_0xccb7('0x1a')](_0xb3a3e2)[_0xccb7('0x28')](_0x29a480);};}exports['sendUserNotification']=function(_0x56863c,_0x504e66,_0x3905a6){if(!_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')](_0xccb7('0x2b'))&&!_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')](_0xccb7('0x2c'))){throw new db[(_0xccb7('0x2d'))][(_0xccb7('0x2e'))](_0xccb7('0x2f'));}else{if(_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')]('TemplateId')&&!_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')]('view')){throw new db['Sequelize']['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')](_0xccb7('0x30'))){throw new db[(_0xccb7('0x2d'))][(_0xccb7('0x2e'))](_0xccb7('0x31'));}else{try{var _0x382e76=JSON[_0xccb7('0x32')](_0x56863c[_0xccb7('0x29')][_0xccb7('0x30')]);}catch(_0x29e3b5){logger[_0xccb7('0x26')](_0x29e3b5);throw new db['Sequelize'][(_0xccb7('0x2e'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x2836ea=[_0xccb7('0x33'),'faxqueue',_0xccb7('0x34'),_0xccb7('0x35'),_0xccb7('0x36'),_0xccb7('0x37'),_0xccb7('0x38'),'team',_0xccb7('0x39')];if(_['some'](_0x382e76,function(_0xbfd5d9){return!_['includes'](_0x2836ea,_0xbfd5d9[_0xccb7('0x3a')]['toLowerCase']());})){throw new db[(_0xccb7('0x2d'))][(_0xccb7('0x2e'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x15ff34={};_0x15ff34['senderName']=_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')]('senderName')?_0x56863c[_0xccb7('0x29')][_0xccb7('0x3b')]:_0x56863c[_0xccb7('0x39')][_0xccb7('0x3c')];_0x15ff34[_0xccb7('0x3d')]=_['isEmpty'](_0x56863c[_0xccb7('0x29')][_0xccb7('0x3d')])?null:_0x56863c[_0xccb7('0x29')][_0xccb7('0x3d')];_0x15ff34[_0xccb7('0x3e')]=_0x56863c['body'][_0xccb7('0x3e')]||![];_0x15ff34[_0xccb7('0x3f')]=_0x56863c[_0xccb7('0x39')]['id'];return getContent(_0x56863c[_0xccb7('0x29')])[_0xccb7('0x25')](function(_0x917898){_0x15ff34[_0xccb7('0x29')]=_0x917898;return getRecipients(_0x382e76);})['then'](function(_0x13afaf){_0x15ff34['recipientsId']=_['sortBy'](_0x13afaf)[_0xccb7('0x40')](',');return db[_0xccb7('0x41')]['transaction'](function(_0x39cc53){return db['UserNotification']['create'](_0x15ff34,{'raw':!![],'transaction':_0x39cc53})[_0xccb7('0x25')](function(_0x104d8e){var _0x1e5839={'sender':_0x15ff34['senderName'],'description':_0x15ff34[_0xccb7('0x3d')],'content':_0x15ff34[_0xccb7('0x29')],'beep':_0x15ff34[_0xccb7('0x3e')]};_0x13afaf['forEach'](function(_0x2bd6a8){_0x1e5839[_0xccb7('0x42')]=_0x2bd6a8;socket[_0xccb7('0x43')]('userNotification:send',_0x1e5839);});return _0x104d8e;});});})[_0xccb7('0x25')](respondWithResult(_0x504e66,0xc9))[_0xccb7('0x44')](handleError(_0x504e66,null));};function getContent(_0x3ac5c7){return new BPromise(function(_0x112de1,_0x594a0d){if(_0x3ac5c7[_0xccb7('0x2b')]){_0x112de1(_0x3ac5c7[_0xccb7('0x2b')]);return;}return db[_0xccb7('0x45')][_0xccb7('0x46')]({'attributes':[_0xccb7('0x47')],'where':{'id':_0x3ac5c7['TemplateId']},'raw':!![]})[_0xccb7('0x25')](function(_0x147693){if(!_0x147693)throw new db[(_0xccb7('0x2d'))][(_0xccb7('0x2e'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1767a7=Mustache[_0xccb7('0x48')](_0x147693[_0xccb7('0x47')],_0x3ac5c7[_0xccb7('0x49')]);_0x112de1(_0x1767a7);})[_0xccb7('0x44')](function(_0xefcedf){_0x594a0d(_0xefcedf);});});}function getRecipients(_0x423923){return new BPromise(function(_0x2574c6,_0x5eb23d){var _0x2e755a=[];var _0x4385f5=[];_0x423923[_0xccb7('0x4a')](function(_0x17a7cc){var _0x51e035=_[_0xccb7('0x4b')](_0x17a7cc[_0xccb7('0x3a')][_0xccb7('0x4c')]());if(_0x51e035==='User'){_0x2e755a=_[_0xccb7('0x4d')](_0x2e755a,_0x17a7cc[_0xccb7('0x4e')]);}else{if(_[_0xccb7('0x4f')](_0x51e035,_0xccb7('0x50')))_0x51e035=_0x51e035[_0xccb7('0x51')](_0xccb7('0x50'),_0xccb7('0x52'));_0x17a7cc[_0xccb7('0x4e')]['forEach'](function(_0x50e797){_0x4385f5[_0xccb7('0x53')](getAgents(_0x51e035,_0x50e797));});}});return BPromise[_0xccb7('0x54')](_0x4385f5)[_0xccb7('0x25')](function(_0x11003b){_0x2e755a=_[_0xccb7('0x4d')](_0x2e755a,_['flatten'](_0x11003b));_0x2574c6(_0x2e755a);})['catch'](function(_0x14d690){_0x5eb23d(_0x14d690);});});}function getAgents(_0x20ce5b,_0x2a7e09){return new BPromise(function(_0x88228,_0x12647a){return db[_0x20ce5b][_0xccb7('0x46')]({'where':{'id':_0x2a7e09}})[_0xccb7('0x25')](function(_0x407821){return _0x407821['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x3d29ad){var _0x264fec=_[_0xccb7('0x55')](_0x3d29ad,'id');_0x88228(_0x264fec);});})[_0xccb7('0x44')](function(_0x4eddf6){_0x12647a(_0x4eddf6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 0c4add1..0c3d358 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0aa=['../../mysqldb','UserNotification','save','update','emit','hasOwnProperty','events'];(function(_0xcf4d0d,_0x441cb0){var _0x4561d7=function(_0x12de10){while(--_0x12de10){_0xcf4d0d['push'](_0xcf4d0d['shift']());}};_0x4561d7(++_0x441cb0);}(_0xe0aa,0xa7));var _0xae0a=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xe0aa[_0x581af1];return _0x54c22e;};'use strict';var EventEmitter=require(_0xae0a('0x0'));var UserNotification=require(_0xae0a('0x1'))['db'][_0xae0a('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xae0a('0x3'),'afterUpdate':_0xae0a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x57ddcf){return function(_0x202a2f,_0x4a8237,_0x2750cd){UserNotificationEvents['emit'](_0x57ddcf+':'+_0x202a2f['id'],_0x202a2f);UserNotificationEvents[_0xae0a('0x5')](_0x57ddcf,_0x202a2f);_0x2750cd(null);};}for(var e in events){if(events[_0xae0a('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xb672=['hasOwnProperty','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x3845bd,_0x4d32f0){var _0x1181df=function(_0x449cda){while(--_0x449cda){_0x3845bd['push'](_0x3845bd['shift']());}};_0x1181df(++_0x4d32f0);}(_0xb672,0xfa));var _0x2b67=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb672[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x2b67('0x0'));var UserNotification=require(_0x2b67('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2b67('0x2'),'afterUpdate':_0x2b67('0x3'),'afterDestroy':_0x2b67('0x4')};function emitEvent(_0x9025ed){return function(_0x2271ee,_0x9f1027,_0x1cc552){UserNotificationEvents[_0x2b67('0x5')](_0x9025ed+':'+_0x2271ee['id'],_0x2271ee);UserNotificationEvents['emit'](_0x9025ed,_0x2271ee);_0x1cc552(null);};}for(var e in events){if(events[_0x2b67('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x2b67('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 300f051..626e6f7 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cf2=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','UserNotification'];(function(_0x50b612,_0x955e4e){var _0x41f25d=function(_0x4fca5d){while(--_0x4fca5d){_0x50b612['push'](_0x50b612['shift']());}};_0x41f25d(++_0x955e4e);}(_0x0cf2,0x1a3));var _0x20cf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0cf2[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x20cf('0x0'));var util=require(_0x20cf('0x1'));var logger=require(_0x20cf('0x2'))(_0x20cf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x20cf('0x4'));var fs=require('fs');var path=require(_0x20cf('0x5'));var rimraf=require('rimraf');var config=require(_0x20cf('0x6'));var attributes=require('./userNotification.attributes');module[_0x20cf('0x7')]=function(_0x1b254d,_0x25e386){return _0x1b254d[_0x20cf('0x8')](_0x20cf('0x9'),attributes,{'tableName':_0x20cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x20cf('0xb'),'collate':_0x20cf('0xc')});}; \ No newline at end of file +var _0x7128=['lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./userNotification.attributes','define','utf8mb4'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x7128,0x1b9));var _0x8712=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x7128[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x8712('0x0'));var util=require('util');var logger=require(_0x8712('0x1'))('api');var moment=require(_0x8712('0x2'));var BPromise=require(_0x8712('0x3'));var rp=require(_0x8712('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8712('0x5'));var attributes=require(_0x8712('0x6'));module['exports']=function(_0xf8aed0,_0x4e571b){return _0xf8aed0[_0x8712('0x7')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8712('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 8e977a7..ec323fc 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d27=['socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x57736a,_0x48140a){var _0x1d4696=function(_0x45365b){while(--_0x45365b){_0x57736a['push'](_0x57736a['shift']());}};_0x1d4696(++_0x48140a);}(_0x1d27,0x107));var _0x71d2=function(_0x7069e5,_0x279f40){_0x7069e5=_0x7069e5-0x0;var _0x25233a=_0x1d27[_0x7069e5];return _0x25233a;};'use strict';var _=require(_0x71d2('0x0'));var util=require(_0x71d2('0x1'));var moment=require(_0x71d2('0x2'));var BPromise=require(_0x71d2('0x3'));var rs=require(_0x71d2('0x4'));var fs=require('fs');var Redis=require(_0x71d2('0x5'));var db=require(_0x71d2('0x6'))['db'];var utils=require(_0x71d2('0x7'));var logger=require(_0x71d2('0x8'))('rpc');var config=require(_0x71d2('0x9'));var jayson=require(_0x71d2('0xa'));var client=jayson[_0x71d2('0xb')][_0x71d2('0xc')]({'port':0x232a});config['redis']=_[_0x71d2('0xd')](config[_0x71d2('0xe')],{'host':_0x71d2('0xf'),'port':0x18eb});var socket=require(_0x71d2('0x10'))(new Redis(config[_0x71d2('0xe')]));require(_0x71d2('0x11'))[_0x71d2('0x12')](socket);function respondWithRpcPromise(_0xd4af7,_0x188d3a,_0x14f315){return new BPromise(function(_0x17c0fc,_0x3658be){return client[_0x71d2('0x13')](_0xd4af7,_0x14f315)[_0x71d2('0x14')](function(_0x21336e){logger[_0x71d2('0x15')](_0x71d2('0x16'),_0x188d3a,'request\x20sent');logger[_0x71d2('0x17')](_0x71d2('0x18'),_0x188d3a,'request\x20sent',JSON['stringify'](_0x21336e));if(_0x21336e[_0x71d2('0x19')]){if(_0x21336e['error'][_0x71d2('0x1a')]===0x1f4){logger[_0x71d2('0x19')](_0x71d2('0x16'),_0x188d3a,_0x21336e[_0x71d2('0x19')][_0x71d2('0x1b')]);return _0x3658be(_0x21336e[_0x71d2('0x19')][_0x71d2('0x1b')]);}logger['error'](_0x71d2('0x16'),_0x188d3a,_0x21336e['error'][_0x71d2('0x1b')]);return _0x17c0fc(_0x21336e[_0x71d2('0x19')][_0x71d2('0x1b')]);}else{logger[_0x71d2('0x15')](_0x71d2('0x16'),_0x188d3a,_0x71d2('0x1c'));_0x17c0fc(_0x21336e[_0x71d2('0x1d')][_0x71d2('0x1b')]);}})[_0x71d2('0x1e')](function(_0x1c1bb1){logger['error']('UserNotification,\x20%s,\x20%s',_0x188d3a,_0x1c1bb1);_0x3658be(_0x1c1bb1);});});} \ No newline at end of file +var _0x58ee=['code','message','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','then','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x58ee,0x101));var _0xe58e=function(_0x3fdc0e,_0x94b816){_0x3fdc0e=_0x3fdc0e-0x0;var _0x34247b=_0x58ee[_0x3fdc0e];return _0x34247b;};'use strict';var _=require(_0xe58e('0x0'));var util=require('util');var moment=require(_0xe58e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe58e('0x2'));var db=require(_0xe58e('0x3'))['db'];var utils=require(_0xe58e('0x4'));var logger=require(_0xe58e('0x5'))('rpc');var config=require(_0xe58e('0x6'));var jayson=require(_0xe58e('0x7'));var client=jayson[_0xe58e('0x8')][_0xe58e('0x9')]({'port':0x232a});config['redis']=_[_0xe58e('0xa')](config[_0xe58e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe58e('0xc'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x68f9b5,_0x25f6d5,_0x36a52b){return new BPromise(function(_0xf6f3e8,_0x4dd258){return client['request'](_0x68f9b5,_0x36a52b)[_0xe58e('0xd')](function(_0x1460af){logger['info'](_0xe58e('0xe'),_0x25f6d5,_0xe58e('0xf'));logger['debug'](_0xe58e('0x10'),_0x25f6d5,_0xe58e('0xf'),JSON[_0xe58e('0x11')](_0x1460af));if(_0x1460af[_0xe58e('0x12')]){if(_0x1460af[_0xe58e('0x12')][_0xe58e('0x13')]===0x1f4){logger[_0xe58e('0x12')](_0xe58e('0xe'),_0x25f6d5,_0x1460af[_0xe58e('0x12')][_0xe58e('0x14')]);return _0x4dd258(_0x1460af[_0xe58e('0x12')][_0xe58e('0x14')]);}logger[_0xe58e('0x12')](_0xe58e('0xe'),_0x25f6d5,_0x1460af[_0xe58e('0x12')]['message']);return _0xf6f3e8(_0x1460af[_0xe58e('0x12')]['message']);}else{logger[_0xe58e('0x15')](_0xe58e('0xe'),_0x25f6d5,_0xe58e('0xf'));_0xf6f3e8(_0x1460af['result'][_0xe58e('0x14')]);}})[_0xe58e('0x16')](function(_0x458574){logger[_0xe58e('0x12')](_0xe58e('0xe'),_0x25f6d5,_0x458574);_0x4dd258(_0x458574);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 7766792..63640c1 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1d2=['remove','update','emit','removeListener','register','save'];(function(_0x229216,_0x1cb266){var _0x1600f2=function(_0x51ac3d){while(--_0x51ac3d){_0x229216['push'](_0x229216['shift']());}};_0x1600f2(++_0x1cb266);}(_0xc1d2,0x8f));var _0x2c1d=function(_0x329199,_0x243b98){_0x329199=_0x329199-0x0;var _0x4da210=_0xc1d2[_0x329199];return _0x4da210;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x2c1d('0x0'),_0x2c1d('0x1'),_0x2c1d('0x2')];function createListener(_0x118449,_0x1fb370){return function(_0x3c8d16){_0x1fb370[_0x2c1d('0x3')](_0x118449,_0x3c8d16);};}function removeListener(_0x7e0d52,_0x1f3716){return function(){UserNotificationEvents[_0x2c1d('0x4')](_0x7e0d52,_0x1f3716);};}exports[_0x2c1d('0x5')]=function(_0x2820c5){for(var _0x41d2ad=0x0,_0x43f59e=events['length'];_0x41d2ad<_0x43f59e;_0x41d2ad++){var _0x16e81d=events[_0x41d2ad];var _0x36acab=createListener('userNotification:'+_0x16e81d,_0x2820c5);UserNotificationEvents['on'](_0x16e81d,_0x36acab);}}; \ No newline at end of file +var _0x92be=['userNotification:','save','update','removeListener'];(function(_0xf35163,_0x5754d8){var _0x46dda1=function(_0x2984ff){while(--_0x2984ff){_0xf35163['push'](_0xf35163['shift']());}};_0x46dda1(++_0x5754d8);}(_0x92be,0xd1));var _0xe92b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x92be[_0x57b54c];return _0x59cc19;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xe92b('0x0'),'remove',_0xe92b('0x1')];function createListener(_0x2dc2d6,_0x30363b){return function(_0x3fde44){_0x30363b['emit'](_0x2dc2d6,_0x3fde44);};}function removeListener(_0x5c6c57,_0x1ffe49){return function(){UserNotificationEvents[_0xe92b('0x2')](_0x5c6c57,_0x1ffe49);};}exports['register']=function(_0x42426b){for(var _0xdd6156=0x0,_0x2360a2=events['length'];_0xdd6156<_0x2360a2;_0xdd6156++){var _0x3add2c=events[_0xdd6156];var _0xf22fee=createListener(_0xe92b('0x3')+_0x3add2c,_0x42426b);UserNotificationEvents['on'](_0x3add2c,_0xf22fee);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 299cb97..67d2c12 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5837e7,_0x35de4f){var _0x537783=function(_0x4cce5d){while(--_0x4cce5d){_0x5837e7['push'](_0x5837e7['shift']());}};_0x537783(++_0x35de4f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x13259c,_0x558710){var _0x163bc9=function(_0x36dae9){while(--_0x36dae9){_0x13259c['push'](_0x13259c['shift']());}};_0x163bc9(++_0x558710);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0xcb91[_0x4226d6];return _0x19655b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 42c1e63..2c5f643 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ffb=['INTEGER','sequelize','exports'];(function(_0x598cf4,_0x5dca1d){var _0x393902=function(_0x50e2e8){while(--_0x50e2e8){_0x598cf4['push'](_0x598cf4['shift']());}};_0x393902(++_0x5dca1d);}(_0x3ffb,0x13f));var _0xb3ff=function(_0xd34f22,_0x53a8ce){_0xd34f22=_0xd34f22-0x0;var _0x12d83b=_0x3ffb[_0xd34f22];return _0x12d83b;};'use strict';var Sequelize=require(_0xb3ff('0x0'));module[_0xb3ff('0x1')]={'penalty':{'type':Sequelize[_0xb3ff('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f2b=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f2b,0x13c));var _0xb3f2=function(_0xd7c92e,_0x2cc009){_0xd7c92e=_0xd7c92e-0x0;var _0x220c75=_0x3f2b[_0xd7c92e];return _0x220c75;};'use strict';var Sequelize=require(_0xb3f2('0x0'));module[_0xb3f2('0x1')]={'penalty':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index d9b1441..c50b998 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4423=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x2d094d,_0x5f5c57){var _0x4015bd=function(_0x42ef33){while(--_0x42ef33){_0x2d094d['push'](_0x2d094d['shift']());}};_0x4015bd(++_0x5f5c57);}(_0x4423,0xb6));var _0x3442=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x4423[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x3442('0x0'));var util=require(_0x3442('0x1'));var logger=require(_0x3442('0x2'))(_0x3442('0x3'));var moment=require(_0x3442('0x4'));var BPromise=require(_0x3442('0x5'));var rp=require(_0x3442('0x6'));var fs=require('fs');var path=require(_0x3442('0x7'));var rimraf=require(_0x3442('0x8'));var config=require(_0x3442('0x9'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x5e37e7,_0x3a2307){return _0x5e37e7[_0x3442('0xa')](_0x3442('0xb'),attributes,{'tableName':_0x3442('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x275e=['api','moment','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x171b5c,_0xfd93df){var _0x30a347=function(_0x1ae91d){while(--_0x1ae91d){_0x171b5c['push'](_0x171b5c['shift']());}};_0x30a347(++_0xfd93df);}(_0x275e,0xa6));var _0xe275=function(_0x5de58a,_0x385b6e){_0x5de58a=_0x5de58a-0x0;var _0x32271c=_0x275e[_0x5de58a];return _0x32271c;};'use strict';var _=require(_0xe275('0x0'));var util=require(_0xe275('0x1'));var logger=require('../../config/logger')(_0xe275('0x2'));var moment=require(_0xe275('0x3'));var BPromise=require(_0xe275('0x4'));var rp=require(_0xe275('0x5'));var fs=require('fs');var path=require(_0xe275('0x6'));var rimraf=require('rimraf');var config=require(_0xe275('0x7'));var attributes=require(_0xe275('0x8'));module['exports']=function(_0x57d621,_0x239d11){return _0x57d621[_0xe275('0x9')](_0xe275('0xa'),attributes,{'tableName':_0xe275('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index eb15b97..490406e 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83f3=['stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1ca707,_0x4b2b61){var _0x20693c=function(_0x5c2a82){while(--_0x5c2a82){_0x1ca707['push'](_0x1ca707['shift']());}};_0x20693c(++_0x4b2b61);}(_0x83f3,0x16f));var _0x383f=function(_0x372a74,_0x581b0d){_0x372a74=_0x372a74-0x0;var _0x5ae14c=_0x83f3[_0x372a74];return _0x5ae14c;};'use strict';var _=require(_0x383f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x383f('0x1'));var rs=require(_0x383f('0x2'));var fs=require('fs');var Redis=require(_0x383f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x383f('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x383f('0x5'));var client=jayson['client'][_0x383f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3ab574,_0x112b32,_0x31c73c){return new BPromise(function(_0x18c428,_0x47d8a1){return client[_0x383f('0x7')](_0x3ab574,_0x31c73c)['then'](function(_0x15d0ab){logger[_0x383f('0x8')](_0x383f('0x9'),_0x112b32,_0x383f('0xa'));logger[_0x383f('0xb')](_0x383f('0xc'),_0x112b32,_0x383f('0xa'),JSON[_0x383f('0xd')](_0x15d0ab));if(_0x15d0ab[_0x383f('0xe')]){if(_0x15d0ab[_0x383f('0xe')][_0x383f('0xf')]===0x1f4){logger[_0x383f('0xe')](_0x383f('0x9'),_0x112b32,_0x15d0ab[_0x383f('0xe')][_0x383f('0x10')]);return _0x47d8a1(_0x15d0ab[_0x383f('0xe')]['message']);}logger[_0x383f('0xe')](_0x383f('0x9'),_0x112b32,_0x15d0ab[_0x383f('0xe')]['message']);return _0x18c428(_0x15d0ab[_0x383f('0xe')][_0x383f('0x10')]);}else{logger[_0x383f('0x8')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x112b32,'request\x20sent');_0x18c428(_0x15d0ab[_0x383f('0x11')]['message']);}})[_0x383f('0x12')](function(_0x4bbb0e){logger[_0x383f('0xe')](_0x383f('0x9'),_0x112b32,_0x4bbb0e);_0x47d8a1(_0x4bbb0e);});});} \ No newline at end of file +var _0x9b58=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x9b58,0x94));var _0x89b5=function(_0x75db0,_0x6b613b){_0x75db0=_0x75db0-0x0;var _0x1bafc3=_0x9b58[_0x75db0];return _0x1bafc3;};'use strict';var _=require('lodash');var util=require(_0x89b5('0x0'));var moment=require(_0x89b5('0x1'));var BPromise=require(_0x89b5('0x2'));var rs=require(_0x89b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x89b5('0x4'))['db'];var utils=require(_0x89b5('0x5'));var logger=require(_0x89b5('0x6'))(_0x89b5('0x7'));var config=require('../../config/environment');var jayson=require(_0x89b5('0x8'));var client=jayson[_0x89b5('0x9')][_0x89b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd22df1,_0x65ad5a,_0x371b52){return new BPromise(function(_0x266e5d,_0x4a6b0f){return client[_0x89b5('0xb')](_0xd22df1,_0x371b52)[_0x89b5('0xc')](function(_0x2fd575){logger['info'](_0x89b5('0xd'),_0x65ad5a,_0x89b5('0xe'));logger['debug'](_0x89b5('0xf'),_0x65ad5a,_0x89b5('0xe'),JSON['stringify'](_0x2fd575));if(_0x2fd575[_0x89b5('0x10')]){if(_0x2fd575[_0x89b5('0x10')][_0x89b5('0x11')]===0x1f4){logger['error'](_0x89b5('0xd'),_0x65ad5a,_0x2fd575['error'][_0x89b5('0x12')]);return _0x4a6b0f(_0x2fd575['error'][_0x89b5('0x12')]);}logger[_0x89b5('0x10')](_0x89b5('0xd'),_0x65ad5a,_0x2fd575[_0x89b5('0x10')]['message']);return _0x266e5d(_0x2fd575[_0x89b5('0x10')][_0x89b5('0x12')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x65ad5a,_0x89b5('0xe'));_0x266e5d(_0x2fd575[_0x89b5('0x13')][_0x89b5('0x12')]);}})[_0x89b5('0x14')](function(_0x53b0d4){logger[_0x89b5('0x10')](_0x89b5('0xd'),_0x65ad5a,_0x53b0d4);_0x4a6b0f(_0x53b0d4);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index a4ecdb6..59b4058 100644 --- a/server/api/userProfile/index.js +++ b/server/api/userProfile/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4bf=['/describe','describe','/:id','show','/:id/resources','getResources','post','create','/:id/clone','/:id/sections','addSections','put','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get'];(function(_0x2ad069,_0x920857){var _0x14a545=function(_0x271609){while(--_0x271609){_0x2ad069['push'](_0x2ad069['shift']());}};_0x14a545(++_0x920857);}(_0xa4bf,0xa7));var _0xfa4b=function(_0x44353d,_0x267761){_0x44353d=_0x44353d-0x0;var _0x93dd90=_0xa4bf[_0x44353d];return _0x93dd90;};'use strict';var multer=require(_0xfa4b('0x0'));var util=require(_0xfa4b('0x1'));var path=require(_0xfa4b('0x2'));var timeout=require(_0xfa4b('0x3'));var express=require(_0xfa4b('0x4'));var router=express[_0xfa4b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfa4b('0x6'));var interaction=require(_0xfa4b('0x7'));var config=require(_0xfa4b('0x8'));var controller=require(_0xfa4b('0x9'));router['get']('/',auth[_0xfa4b('0xa')](),controller[_0xfa4b('0xb')]);router[_0xfa4b('0xc')](_0xfa4b('0xd'),auth[_0xfa4b('0xa')](),controller[_0xfa4b('0xe')]);router['get'](_0xfa4b('0xf'),auth[_0xfa4b('0xa')](),controller[_0xfa4b('0x10')]);router['get']('/:id/sections',auth[_0xfa4b('0xa')](),controller['getSections']);router[_0xfa4b('0xc')](_0xfa4b('0x11'),auth[_0xfa4b('0xa')](),controller[_0xfa4b('0x12')]);router[_0xfa4b('0x13')]('/',auth['isAuthenticated'](),controller[_0xfa4b('0x14')]);router[_0xfa4b('0x13')](_0xfa4b('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0xfa4b('0x13')](_0xfa4b('0x16'),auth[_0xfa4b('0xa')](),controller[_0xfa4b('0x17')]);router[_0xfa4b('0x13')](_0xfa4b('0x11'),auth[_0xfa4b('0xa')](),controller['addResources']);router[_0xfa4b('0x18')](_0xfa4b('0xf'),auth['isAuthenticated'](),controller[_0xfa4b('0x19')]);router[_0xfa4b('0x1a')](_0xfa4b('0xf'),auth[_0xfa4b('0xa')](),controller[_0xfa4b('0x1b')]);router[_0xfa4b('0x1a')](_0xfa4b('0x16'),auth[_0xfa4b('0xa')](),controller[_0xfa4b('0x1c')]);router[_0xfa4b('0x1a')]('/:id/resources',auth[_0xfa4b('0xa')](),controller['removeResources']);module[_0xfa4b('0x1d')]=router; \ No newline at end of file +var _0xbc88=['/:id/clone','clone','addSections','addResources','put','delete','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','create'];(function(_0x3a10b2,_0x1eb3d4){var _0x249830=function(_0x54430b){while(--_0x54430b){_0x3a10b2['push'](_0x3a10b2['shift']());}};_0x249830(++_0x1eb3d4);}(_0xbc88,0x12a));var _0x8bc8=function(_0x2b7bc8,_0x16f993){_0x2b7bc8=_0x2b7bc8-0x0;var _0x3c8830=_0xbc88[_0x2b7bc8];return _0x3c8830;};'use strict';var multer=require(_0x8bc8('0x0'));var util=require(_0x8bc8('0x1'));var path=require('path');var timeout=require(_0x8bc8('0x2'));var express=require(_0x8bc8('0x3'));var router=express[_0x8bc8('0x4')]();var fs_extra=require(_0x8bc8('0x5'));var auth=require(_0x8bc8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8bc8('0x7'));var controller=require(_0x8bc8('0x8'));router[_0x8bc8('0x9')]('/',auth['isAuthenticated'](),controller[_0x8bc8('0xa')]);router[_0x8bc8('0x9')](_0x8bc8('0xb'),auth[_0x8bc8('0xc')](),controller[_0x8bc8('0xd')]);router['get'](_0x8bc8('0xe'),auth[_0x8bc8('0xc')](),controller['show']);router[_0x8bc8('0x9')](_0x8bc8('0xf'),auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x10')]);router['get'](_0x8bc8('0x11'),auth['isAuthenticated'](),controller[_0x8bc8('0x12')]);router[_0x8bc8('0x13')]('/',auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x14')]);router[_0x8bc8('0x13')](_0x8bc8('0x15'),auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x16')]);router[_0x8bc8('0x13')]('/:id/sections',auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x17')]);router['post'](_0x8bc8('0x11'),auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x18')]);router[_0x8bc8('0x19')](_0x8bc8('0xe'),auth[_0x8bc8('0xc')](),controller['update']);router[_0x8bc8('0x1a')](_0x8bc8('0xe'),auth[_0x8bc8('0xc')](),controller['destroy']);router[_0x8bc8('0x1a')](_0x8bc8('0xf'),auth[_0x8bc8('0xc')](),controller['removeSections']);router[_0x8bc8('0x1a')](_0x8bc8('0x11'),auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x1b')]);module[_0x8bc8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 2b589c6..8daca1d 100644 --- a/server/api/userProfile/userProfile.attributes.js +++ b/server/api/userProfile/userProfile.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2338=['name','setDataValue','crudPermissions','join','split','BOOLEAN','sequelize','STRING'];(function(_0x39935d,_0x1cc914){var _0x213971=function(_0x4a932c){while(--_0x4a932c){_0x39935d['push'](_0x39935d['shift']());}};_0x213971(++_0x1cc914);}(_0x2338,0xce));var _0x8233=function(_0x2dc59f,_0x1a0671){_0x2dc59f=_0x2dc59f-0x0;var _0x155501=_0x2338[_0x2dc59f];return _0x155501;};'use strict';var Sequelize=require(_0x8233('0x0'));module['exports']={'name':{'type':Sequelize[_0x8233('0x1')],'allowNull':![],'unique':_0x8233('0x2')},'crudPermissions':{'type':Sequelize[_0x8233('0x1')],'set':function(_0xddffe8){this[_0x8233('0x3')](_0x8233('0x4'),_0xddffe8?_0xddffe8[_0x8233('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x8233('0x4'))?this['getDataValue'](_0x8233('0x4'))[_0x8233('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8233('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8233('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8233('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8233('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8233('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1eb8=['getDataValue','crudPermissions','BOOLEAN','sequelize','STRING','join'];(function(_0x506f6e,_0xf6a40f){var _0x2ed0ca=function(_0x291ed9){while(--_0x291ed9){_0x506f6e['push'](_0x506f6e['shift']());}};_0x2ed0ca(++_0xf6a40f);}(_0x1eb8,0x1e9));var _0x81eb=function(_0x4dbd6b,_0x19ab95){_0x4dbd6b=_0x4dbd6b-0x0;var _0x2024a9=_0x1eb8[_0x4dbd6b];return _0x2024a9;};'use strict';var Sequelize=require(_0x81eb('0x0'));module['exports']={'name':{'type':Sequelize[_0x81eb('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x81eb('0x1')],'set':function(_0x18ad8e){this['setDataValue']('crudPermissions',_0x18ad8e?_0x18ad8e[_0x81eb('0x2')](''):[]);},'get':function(){return this[_0x81eb('0x3')](_0x81eb('0x4'))?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index fd4ecc2..2df4c15 100644 --- a/server/api/userProfile/userProfile.controller.js +++ b/server/api/userProfile/userProfile.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f35=['forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','hasOwnProperty','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','defaults','socket.io-emitter','redis','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','stack','name','index','map','type','key','model','query','intersection','attributes','fields','where','filters','pick','VIRTUAL','merge','options','UserProfile','include','findAll','catch','show','keys','rawAttributes','length','find','create','body','clone','params','includeAll','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','destroy','describe','sectionId','push','removeSections','ids','getSections','filter','enabled','includes','isEmpty','subsections','Dashboard'];(function(_0x40e5b3,_0x51c53b){var _0x3a013d=function(_0x160780){while(--_0x160780){_0x40e5b3['push'](_0x40e5b3['shift']());}};_0x3a013d(++_0x51c53b);}(_0x3f35,0x1ae));var _0x53f3=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x3f35[_0x1a7550];return _0x426e22;};'use strict';var emlformat=require(_0x53f3('0x0'));var rimraf=require(_0x53f3('0x1'));var zipdir=require(_0x53f3('0x2'));var jsonpatch=require(_0x53f3('0x3'));var rp=require(_0x53f3('0x4'));var moment=require(_0x53f3('0x5'));var BPromise=require(_0x53f3('0x6'));var Mustache=require('mustache');var util=require(_0x53f3('0x7'));var path=require('path');var sox=require(_0x53f3('0x8'));var csv=require('to-csv');var ejs=require(_0x53f3('0x9'));var fs=require('fs');var fs_extra=require(_0x53f3('0xa'));var _=require(_0x53f3('0xb'));var squel=require(_0x53f3('0xc'));var crypto=require('crypto');var jsforce=require(_0x53f3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x53f3('0xe'));var Redis=require(_0x53f3('0xf'));var authService=require(_0x53f3('0x10'));var qs=require(_0x53f3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x53f3('0x12'))(_0x53f3('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53f3('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x53f3('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x53f3('0x16'))(new Redis(config[_0x53f3('0x17')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0xfd9652,_0x49189d){_0x49189d=_0x49189d||0xcc;return function(_0x170927){if(_0x170927){return _0xfd9652[_0x53f3('0x18')](_0x49189d);}return _0xfd9652[_0x53f3('0x19')](_0x49189d)[_0x53f3('0x1a')]();};}function respondWithResult(_0x3f2dc3,_0x995186){_0x995186=_0x995186||0xc8;return function(_0xb2921a){if(_0xb2921a){return _0x3f2dc3['status'](_0x995186)[_0x53f3('0x1b')](_0xb2921a);}};}function respondWithFilteredResult(_0x1d2319,_0x1cb1bd){return function(_0x5ae118){if(_0x5ae118){var _0x5ea5e7=typeof _0x1cb1bd[_0x53f3('0x1c')]==='undefined'&&typeof _0x1cb1bd[_0x53f3('0x1d')]===_0x53f3('0x1e');var _0x58c850=_0x5ae118[_0x53f3('0x1f')];var _0x40b26c=_0x5ea5e7?0x0:_0x1cb1bd['offset'];var _0x3ac6e3=_0x5ea5e7?_0x5ae118[_0x53f3('0x1f')]:_0x1cb1bd[_0x53f3('0x1c')]+_0x1cb1bd[_0x53f3('0x1d')];var _0x36e191;if(_0x3ac6e3>=_0x58c850){_0x3ac6e3=_0x58c850;_0x36e191=0xc8;}else{_0x36e191=0xce;}_0x1d2319[_0x53f3('0x19')](_0x36e191);return _0x1d2319['set'](_0x53f3('0x20'),_0x40b26c+'-'+_0x3ac6e3+'/'+_0x58c850)[_0x53f3('0x1b')](_0x5ae118);}return null;};}function patchUpdates(_0x2ba5db){return function(_0xf8e87d){try{jsonpatch[_0x53f3('0x21')](_0xf8e87d,_0x2ba5db,!![]);}catch(_0x5055ce){return BPromise[_0x53f3('0x22')](_0x5055ce);}return _0xf8e87d[_0x53f3('0x23')]();};}function saveUpdates(_0x3bad5b,_0x39eeb9){return function(_0x16b631){if(_0x16b631){return _0x16b631[_0x53f3('0x24')](_0x3bad5b)['then'](function(_0x11bb9d){return _0x11bb9d;});}return null;};}function removeEntity(_0x5902b7,_0x513d2d){return function(_0x3b0512){if(_0x3b0512){return _0x3b0512['destroy']()[_0x53f3('0x25')](function(){_0x5902b7[_0x53f3('0x19')](0xcc)[_0x53f3('0x1a')]();});}};}function handleEntityNotFound(_0x547474,_0x4e68ca){return function(_0x1dcd1d){if(!_0x1dcd1d){_0x547474[_0x53f3('0x18')](0x194);}return _0x1dcd1d;};}function handleError(_0x477ef3,_0x2c7301){_0x2c7301=_0x2c7301||0x1f4;return function(_0x173bf8){logger['error'](_0x173bf8[_0x53f3('0x26')]);if(_0x173bf8[_0x53f3('0x27')]){delete _0x173bf8[_0x53f3('0x27')];}_0x477ef3[_0x53f3('0x19')](_0x2c7301)['send'](_0x173bf8);};}exports[_0x53f3('0x28')]=function(_0x3d405e,_0x5afd83){var _0x2ebf51={},_0x50ac51={},_0x48f365={'count':0x0,'rows':[]};var _0x1216c6=_[_0x53f3('0x29')](db['UserProfile']['rawAttributes'],function(_0x11cc80){return{'name':_0x11cc80['fieldName'],'type':_0x11cc80[_0x53f3('0x2a')][_0x53f3('0x2b')]};});_0x50ac51[_0x53f3('0x2c')]=_[_0x53f3('0x29')](_0x1216c6,_0x53f3('0x27'));_0x50ac51[_0x53f3('0x2d')]=_['keys'](_0x3d405e['query']);_0x50ac51['filters']=_[_0x53f3('0x2e')](_0x50ac51[_0x53f3('0x2c')],_0x50ac51[_0x53f3('0x2d')]);_0x2ebf51[_0x53f3('0x2f')]=_['intersection'](_0x50ac51[_0x53f3('0x2c')],qs['fields'](_0x3d405e[_0x53f3('0x2d')][_0x53f3('0x30')]));_0x2ebf51[_0x53f3('0x2f')]=_0x2ebf51[_0x53f3('0x2f')]['length']?_0x2ebf51[_0x53f3('0x2f')]:_0x50ac51['model'];if(!_0x3d405e[_0x53f3('0x2d')]['hasOwnProperty']('nolimit')){_0x2ebf51['limit']=qs[_0x53f3('0x1d')](_0x3d405e[_0x53f3('0x2d')]['limit']);_0x2ebf51['offset']=qs[_0x53f3('0x1c')](_0x3d405e['query'][_0x53f3('0x1c')]);}_0x2ebf51['order']=qs['sort'](_0x3d405e[_0x53f3('0x2d')]['sort']);_0x2ebf51[_0x53f3('0x31')]=qs[_0x53f3('0x32')](_[_0x53f3('0x33')](_0x3d405e['query'],_0x50ac51[_0x53f3('0x32')]),_0x1216c6);if(_0x3d405e[_0x53f3('0x2d')]['filter']){_0x2ebf51[_0x53f3('0x31')]=_['merge'](_0x2ebf51[_0x53f3('0x31')],{'$or':_[_0x53f3('0x29')](_0x1216c6,function(_0xe4e8b9){if(_0xe4e8b9[_0x53f3('0x2a')]!==_0x53f3('0x34')){var _0x59ad52={};_0x59ad52[_0xe4e8b9['name']]={'$like':'%'+_0x3d405e[_0x53f3('0x2d')]['filter']+'%'};return _0x59ad52;}})});}_0x2ebf51=_[_0x53f3('0x35')]({},_0x2ebf51,_0x3d405e[_0x53f3('0x36')]);var _0x5ea6a5={'where':_0x2ebf51[_0x53f3('0x31')]};return db[_0x53f3('0x37')][_0x53f3('0x1f')](_0x5ea6a5)[_0x53f3('0x25')](function(_0x13ac07){_0x48f365[_0x53f3('0x1f')]=_0x13ac07;if(_0x3d405e[_0x53f3('0x2d')]['includeAll']){_0x2ebf51[_0x53f3('0x38')]=[{'all':!![]}];}return db[_0x53f3('0x37')][_0x53f3('0x39')](_0x2ebf51);})[_0x53f3('0x25')](function(_0x1eab17){_0x48f365['rows']=_0x1eab17;return _0x48f365;})[_0x53f3('0x25')](respondWithFilteredResult(_0x5afd83,_0x2ebf51))[_0x53f3('0x3a')](handleError(_0x5afd83,null));};exports[_0x53f3('0x3b')]=function(_0x54047f,_0x48eafa){var _0x29f485={'raw':![],'where':{'id':_0x54047f['params']['id']}},_0x30f96f={};_0x30f96f['model']=_[_0x53f3('0x3c')](db['UserProfile'][_0x53f3('0x3d')]);_0x30f96f[_0x53f3('0x2d')]=_[_0x53f3('0x3c')](_0x54047f[_0x53f3('0x2d')]);_0x30f96f[_0x53f3('0x32')]=_[_0x53f3('0x2e')](_0x30f96f[_0x53f3('0x2c')],_0x30f96f[_0x53f3('0x2d')]);_0x29f485[_0x53f3('0x2f')]=_[_0x53f3('0x2e')](_0x30f96f['model'],qs[_0x53f3('0x30')](_0x54047f[_0x53f3('0x2d')][_0x53f3('0x30')]));_0x29f485[_0x53f3('0x2f')]=_0x29f485[_0x53f3('0x2f')][_0x53f3('0x3e')]?_0x29f485['attributes']:_0x30f96f['model'];if(_0x54047f['query']['includeAll']){_0x29f485[_0x53f3('0x38')]=[{'all':!![]}];}_0x29f485=_[_0x53f3('0x35')]({},_0x29f485,_0x54047f[_0x53f3('0x36')]);return db[_0x53f3('0x37')][_0x53f3('0x3f')](_0x29f485)[_0x53f3('0x25')](handleEntityNotFound(_0x48eafa,null))[_0x53f3('0x25')](respondWithResult(_0x48eafa,null))[_0x53f3('0x3a')](handleError(_0x48eafa,null));};exports[_0x53f3('0x40')]=function(_0x2a02bd,_0x3488f0){return db['UserProfile']['create'](_0x2a02bd[_0x53f3('0x41')],{})[_0x53f3('0x25')](respondWithResult(_0x3488f0,0xc9))[_0x53f3('0x3a')](handleError(_0x3488f0,null));};exports[_0x53f3('0x42')]=function(_0x7b4c08,_0x213f7f){var _0x347ea3={'where':{'id':_0x7b4c08[_0x53f3('0x43')]['id']}},_0xee9225={};_0xee9225[_0x53f3('0x2c')]=_[_0x53f3('0x3c')](db[_0x53f3('0x37')]['rawAttributes']);_0x347ea3[_0x53f3('0x2f')]=_[_0x53f3('0x2e')](_0xee9225[_0x53f3('0x2c')],qs['fields'](_0x7b4c08[_0x53f3('0x2d')][_0x53f3('0x30')]));_0x347ea3[_0x53f3('0x2f')]=_0x347ea3['attributes'][_0x53f3('0x3e')]?_0x347ea3[_0x53f3('0x2f')]:_0xee9225[_0x53f3('0x2c')];if(_0x7b4c08[_0x53f3('0x2d')][_0x53f3('0x44')]){_0x347ea3['include']=[{'all':!![]}];}_0x347ea3=_[_0x53f3('0x35')]({},_0x347ea3,_0x7b4c08['options']);return db[_0x53f3('0x37')][_0x53f3('0x3f')](_0x347ea3)[_0x53f3('0x25')](handleEntityNotFound(_0x213f7f,null))[_0x53f3('0x25')](function(_0x28427d){if(_0x28427d){var _0x4d0a30=_0x28427d[_0x53f3('0x45')]({'plain':!![]});_0x4d0a30=qs[_0x53f3('0x46')](_0x4d0a30,['id','createdAt',_0x53f3('0x47'),_0x53f3('0x48')]);_0x7b4c08['body']=_[_0x53f3('0x46')](_0x7b4c08[_0x53f3('0x41')],['id',_0x53f3('0x49'),_0x53f3('0x47')]);return db[_0x53f3('0x4a')][_0x53f3('0x4b')](function(_0x14023f){return db[_0x53f3('0x37')]['create'](_[_0x53f3('0x35')](_0x4d0a30,_0x7b4c08[_0x53f3('0x41')]),{'include':_0x7b4c08[_0x53f3('0x2d')][_0x53f3('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x14023f})[_0x53f3('0x25')](function(_0x187e56){var _0x38e855=_0x187e56[_0x53f3('0x45')]({'plain':!![]});return db[_0x53f3('0x4c')][_0x53f3('0x39')]({'where':{'userProfileId':_0x7b4c08[_0x53f3('0x43')]['id']},'raw':!![]})[_0x53f3('0x25')](function(_0x303204){if(_0x303204){return BPromise[_0x53f3('0x4d')](_0x303204,function(_0x17508a){return new BPromise(function(_0x8ee88f,_0x23c362){if(_0x17508a[_0x53f3('0x4e')]===null||_0x17508a['autoAssociation']===0x1)_0x8ee88f(null);return db[_0x53f3('0x4f')][_0x53f3('0x39')]({'where':{'sectionId':_0x17508a['id']},'raw':!![]})[_0x53f3('0x25')](function(_0x406dba){var _0x3f8568=_[_0x53f3('0x29')](_0x406dba,function(_0x4782bd){return qs['omit'](_0x4782bd,['id',_0x53f3('0x49'),_0x53f3('0x47'),'sectionId']);});_0x8ee88f(_0x3f8568);})[_0x53f3('0x3a')](function(_0x9cead8){_0x23c362(_0x9cead8);});})[_0x53f3('0x25')](function(_0x3316ef){var _0x3feb9=qs[_0x53f3('0x46')](_0x17508a,['id',_0x53f3('0x49'),'updatedAt']);_0x3feb9[_0x53f3('0x50')]=_0x38e855['id'];if(_0x3316ef)_0x3feb9['Resources']=_0x3316ef;return _0x3feb9;})[_0x53f3('0x25')](function(_0x3be8ef){return db[_0x53f3('0x4c')]['create'](_0x3be8ef,{'include':[{'model':db[_0x53f3('0x4f')],'as':_0x53f3('0x51')}],'raw':!![],'transaction':_0x14023f});});})['then'](function(){return _0x38e855;});}});});});}})[_0x53f3('0x25')](respondWithResult(_0x213f7f,0xc9))[_0x53f3('0x3a')](handleError(_0x213f7f,null));};exports[_0x53f3('0x24')]=function(_0x514ac2,_0x599dee){if(_0x514ac2[_0x53f3('0x41')]['id']){delete _0x514ac2[_0x53f3('0x41')]['id'];}return db[_0x53f3('0x37')][_0x53f3('0x3f')]({'where':{'id':_0x514ac2[_0x53f3('0x43')]['id']}})[_0x53f3('0x25')](handleEntityNotFound(_0x599dee,null))[_0x53f3('0x25')](saveUpdates(_0x514ac2['body'],null))['then'](respondWithResult(_0x599dee,null))[_0x53f3('0x3a')](handleError(_0x599dee,null));};exports[_0x53f3('0x52')]=function(_0x57c78c,_0x12729a){return db[_0x53f3('0x37')][_0x53f3('0x3f')]({'where':{'id':_0x57c78c['params']['id']}})['then'](handleEntityNotFound(_0x12729a,null))[_0x53f3('0x25')](removeEntity(_0x12729a,null))[_0x53f3('0x3a')](handleError(_0x12729a,null));};exports[_0x53f3('0x53')]=function(_0x2eb2d2,_0x1573f3){return db[_0x53f3('0x37')][_0x53f3('0x53')]()[_0x53f3('0x25')](respondWithResult(_0x1573f3,null))[_0x53f3('0x3a')](handleError(_0x1573f3,null));};exports['addSections']=function(_0x555b6f,_0x1c1947){var _0x5bffb1=_0x555b6f['body'];return db[_0x53f3('0x37')][_0x53f3('0x3f')]({'where':{'id':_0x555b6f[_0x53f3('0x43')]['id']}})[_0x53f3('0x25')](handleEntityNotFound(_0x1c1947,null))[_0x53f3('0x25')](function(_0xedd9f7){if(_0xedd9f7){return db[_0x53f3('0x4a')][_0x53f3('0x4b')](function(_0x48655e){return db[_0x53f3('0x4c')][_0x53f3('0x52')]({'where':{'userProfileId':_0x555b6f[_0x53f3('0x43')]['id'],'sectionId':_[_0x53f3('0x29')](_0x5bffb1,function(_0x6344b2){return _0x6344b2[_0x53f3('0x54')];})},'transaction':_0x48655e})[_0x53f3('0x25')](function(){var _0x438846=_[_0x53f3('0x29')](_0x5bffb1,function(_0x2fa939){_0x2fa939[_0x53f3('0x50')]=_0x555b6f[_0x53f3('0x43')]['id'];return _0x2fa939;});var _0x44ebac=[];return BPromise[_0x53f3('0x4d')](_0x438846,function(_0x44c5ed){return db[_0x53f3('0x4c')][_0x53f3('0x40')](_0x44c5ed,{'include':[{'model':db[_0x53f3('0x4f')],'as':_0x53f3('0x51')}],'raw':!![],'transaction':_0x48655e})[_0x53f3('0x25')](function(_0x4b4b56){_0x44ebac[_0x53f3('0x55')](_0x4b4b56[_0x53f3('0x45')]({'plain':!![]}));});})[_0x53f3('0x25')](function(){return _0x44ebac;});});});}})[_0x53f3('0x25')](function(_0x6ddf72){return _0x6ddf72;})[_0x53f3('0x25')](respondWithResult(_0x1c1947,null))['catch'](handleError(_0x1c1947,null));};exports[_0x53f3('0x56')]=function(_0x11b04c,_0x52c391){var _0xac004f;return db[_0x53f3('0x37')][_0x53f3('0x3f')]({'where':{'id':_0x11b04c[_0x53f3('0x43')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x52c391,null))[_0x53f3('0x25')](function(_0x5ddd2e){if(_0x5ddd2e){_0xac004f=_0x5ddd2e;return db[_0x53f3('0x4c')][_0x53f3('0x52')]({'where':{'userProfileId':_0x11b04c[_0x53f3('0x43')]['id'],'sectionId':_0x11b04c[_0x53f3('0x2d')][_0x53f3('0x57')]}});}})[_0x53f3('0x25')](function(){return _0xac004f;})['then'](respondWithStatusCode(_0x52c391,null))[_0x53f3('0x3a')](handleError(_0x52c391,null));};exports[_0x53f3('0x58')]=function(_0x34b0eb,_0x295fc7){var _0x198ab1=[];var _0x4bc470=[];return db[_0x53f3('0x4c')][_0x53f3('0x39')]({'where':{'userProfileId':_0x34b0eb['params']['id']},'raw':!![]})['then'](function(_0x5cfb84){_0x198ab1=_[_0x53f3('0x59')](_0x5cfb84,function(_0x4402fe){return _0x4402fe[_0x53f3('0x5a')]===0x1||_[_0x53f3('0x5b')]([0x3eb,0x709],_0x4402fe['sectionId']);});if(!_[_0x53f3('0x5c')](_0x198ab1)){return _[_0x53f3('0x29')](_0x198ab1,function(_0x2104b0){return _0x2104b0['sectionId'];});}else{return;}})[_0x53f3('0x25')](function(_0x358e55){if(_0x358e55)_0x4bc470=_0x358e55;if(_[_0x53f3('0x5b')](_0x4bc470,0x64)){var _0x158924=_[_0x53f3('0x3f')](_0x198ab1,{'sectionId':0x64});return hasDefaultDashboard(_0x158924)[_0x53f3('0x25')](function(_0xbc5b03){return _[_0x53f3('0x29')](_0x198ab1,function(_0x317967){if(_0x317967[_0x53f3('0x54')]===0x64){_0x317967[_0x53f3('0x5d')]=_0xbc5b03;}return _0x317967;});});}else{return;}})[_0x53f3('0x25')](function(_0x2e147f){if(_0x2e147f)_0x198ab1=_0x2e147f;if(_[_0x53f3('0x5b')](_0x4bc470,0x3eb)){var _0x3faa3a=_[_0x53f3('0x3f')](_0x198ab1,{'sectionId':0x3eb});return getCustomDashboards(_0x3faa3a)[_0x53f3('0x25')](function(_0x3e94eb){return _[_0x53f3('0x29')](_0x198ab1,function(_0x41e26e){if(_0x3faa3a[_0x53f3('0x5a')]){if(_0x41e26e[_0x53f3('0x54')]===0x3eb){_0x41e26e['subsections']=_0x3e94eb;}}else{if(_0x41e26e[_0x53f3('0x54')]===0x64){_0x41e26e[_0x53f3('0x5d')]=_0x3e94eb;}}return _0x41e26e;});});}else{return;}})[_0x53f3('0x25')](function(_0x42ee9c){if(_0x42ee9c)_0x198ab1=_0x42ee9c;if(_[_0x53f3('0x5b')](_0x4bc470,0x709)){var _0x1e5f8c=_[_0x53f3('0x3f')](_0x198ab1,{'sectionId':0x709});return getPlugins(_0x1e5f8c)[_0x53f3('0x25')](function(_0x2c92ab){if(_0x1e5f8c[_0x53f3('0x5a')]){return _['map'](_0x198ab1,function(_0xc4a125){if(_0xc4a125[_0x53f3('0x54')]===0x709){_0xc4a125[_0x53f3('0x5d')]=_0x2c92ab;}return _0xc4a125;});}else{var _0x52057b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2c92ab};var _0xe671c5=_[_0x53f3('0x29')](_0x198ab1);_0xe671c5[_0x53f3('0x55')](_0x52057b);return _0xe671c5;}});}else{return;}})[_0x53f3('0x25')](function(_0x2d32de){if(_0x2d32de)_0x198ab1=_0x2d32de;return _[_0x53f3('0x59')](_0x198ab1,[_0x53f3('0x5a'),0x1]);})[_0x53f3('0x25')](respondWithResult(_0x295fc7,null))[_0x53f3('0x3a')](handleError(_0x295fc7,null));};function hasDefaultDashboard(_0x35f1b0){var _0x55e4fd=[0x65];return new BPromise(function(_0x79561e,_0x2de5d3){try{if(_0x35f1b0[_0x53f3('0x4e')]){_0x79561e(_0x55e4fd);}else{return db[_0x53f3('0x4f')]['findOne']({'where':{'sectionId':_0x35f1b0['id']},'raw':!![]})[_0x53f3('0x25')](function(_0x18c39f){_0x18c39f?_0x79561e(_0x55e4fd):_0x79561e();});}}catch(_0x393711){_0x2de5d3(_0x393711);}});}function getCustomDashboards(_0x1770fc){var _0x11ced7=[];return new BPromise(function(_0x4b7517,_0x1e2a62){try{if(_0x1770fc[_0x53f3('0x4e')]){return db[_0x53f3('0x5e')][_0x53f3('0x39')]({'raw':!![]})[_0x53f3('0x25')](function(_0x2d87d3){_0x2d87d3['forEach'](function(_0xfb4031){_0x11ced7[_0x53f3('0x55')](_0xfb4031['id']+0x1869f);});_0x4b7517(_0x11ced7);});}else{return db[_0x53f3('0x4f')][_0x53f3('0x39')]({'where':{'sectionId':_0x1770fc['id']},'raw':!![]})[_0x53f3('0x25')](function(_0x5a68b0){_0x5a68b0[_0x53f3('0x5f')](function(_0x368503){_0x11ced7[_0x53f3('0x55')](_0x368503[_0x53f3('0x60')]+0x1869f);});_0x4b7517(_0x11ced7);});}}catch(_0x77de0b){_0x1e2a62(_0x77de0b);}});}function getPlugins(_0x52637d){var _0x2347ed=[];return new BPromise(function(_0x1db3c2,_0x2d9122){try{if(_0x52637d[_0x53f3('0x4e')]){return db[_0x53f3('0x61')]['findAll']({'raw':!![]})[_0x53f3('0x25')](function(_0x56cdae){_0x56cdae['forEach'](function(_0x4b2aaa){_0x2347ed[_0x53f3('0x55')](_0x4b2aaa['id']+0x15b38);});_0x1db3c2(_0x2347ed);});}else{return db[_0x53f3('0x4f')]['findAll']({'where':{'sectionId':_0x52637d['id']},'raw':!![]})[_0x53f3('0x25')](function(_0x305cd6){_0x305cd6[_0x53f3('0x5f')](function(_0x11a51d){_0x2347ed['push'](_0x11a51d[_0x53f3('0x60')]+0x15b38);});_0x1db3c2(_0x2347ed);});}}catch(_0x37c842){_0x2d9122(_0x37c842);}});}exports[_0x53f3('0x62')]=function(_0x1fdacd,_0x4bf159){return db['UserProfile'][_0x53f3('0x3f')]({'where':{'id':_0x1fdacd[_0x53f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x4bf159,null))[_0x53f3('0x25')](function(_0x875b44){if(_0x875b44){return db[_0x53f3('0x4a')][_0x53f3('0x4b')](function(_0xff878d){return db[_0x53f3('0x4c')][_0x53f3('0x39')]({'where':{'userProfileId':_0x1fdacd[_0x53f3('0x43')]['id']},'attributes':['id'],'raw':!![]})[_0x53f3('0x25')](function(_0x42c7c2){if(_0x42c7c2){return db[_0x53f3('0x4c')][_0x53f3('0x52')]({'where':{'userProfileId':_0x1fdacd[_0x53f3('0x43')]['id'],'id':_['map'](_0x42c7c2,function(_0x3de6c0){return _0x3de6c0['id'];})},'transaction':_0xff878d});}})['then'](function(_0x3bbe2e){var _0x1bf73b=_[_0x53f3('0x29')](_0x1fdacd[_0x53f3('0x41')],function(_0x472320){_0x472320[_0x53f3('0x50')]=_0x1fdacd[_0x53f3('0x43')]['id'];return _0x472320;});return db['UserProfileSection'][_0x53f3('0x63')](_0x1bf73b,{'raw':!![],'transaction':_0xff878d});})[_0x53f3('0x25')](function(_0x3fc3ba){var _0x4a21ac=_['filter'](_['map'](_0x3fc3ba,function(_0x341fb8){return _0x341fb8[_0x53f3('0x45')]({'plain':!![]});}),{'includeAll':![]});if(_0x4a21ac){return db[_0x53f3('0x4c')][_0x53f3('0x39')]({'where':{'userProfileId':_0x1fdacd[_0x53f3('0x43')]['id'],'sectionId':_[_0x53f3('0x29')](_0x4a21ac,function(_0xe77424){return _0xe77424[_0x53f3('0x54')];})},'attributes':['id',_0x53f3('0x54')],'raw':!![]})['then'](function(_0x218498){var _0x1a04af=_['map'](_0x1fdacd[_0x53f3('0x41')],function(_0x4c4e34){_0x4c4e34[_0x53f3('0x50')]=_0x1fdacd[_0x53f3('0x43')]['id'];return _0x4c4e34;});return db['UserProfileResource'][_0x53f3('0x63')](_0x1a04af,{'raw':!![],'transaction':_0xff878d});});}})[_0x53f3('0x3a')](handleError(_0x4bf159,null));});}})[_0x53f3('0x25')](function(_0x4adc87){var _0x105d1e=_['map'](_0x4adc87,function(_0x241809){return _0x241809[_0x53f3('0x45')]({'plain':!![]});});})[_0x53f3('0x25')](respondWithResult(_0x4bf159,null))['catch'](handleError(_0x4bf159,null));};exports[_0x53f3('0x64')]=function(_0xeeba0d,_0x1979e4,_0x3f48f6){return db[_0x53f3('0x37')][_0x53f3('0x3f')]({'where':{'id':_0xeeba0d[_0x53f3('0x43')]['id']}})[_0x53f3('0x25')](handleEntityNotFound(_0x1979e4,null))[_0x53f3('0x25')](function(_0x27bb53){if(_0x27bb53){return _0x27bb53['removeResources'](_0xeeba0d[_0x53f3('0x2d')][_0x53f3('0x57')]);}})[_0x53f3('0x25')](respondWithStatusCode(_0x1979e4,null))['catch'](handleError(_0x1979e4,null));};exports[_0x53f3('0x65')]=function(_0x680e04,_0x37bcbb){var _0x291bff={};if(!_0x680e04[_0x53f3('0x2d')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x680e04[_0x53f3('0x2d')][_0x53f3('0x66')](_0x53f3('0x67'))){_0x291bff[_0x53f3('0x1d')]=qs[_0x53f3('0x1d')](_0x680e04[_0x53f3('0x2d')][_0x53f3('0x1d')]);_0x291bff[_0x53f3('0x1c')]=qs['offset'](_0x680e04[_0x53f3('0x2d')][_0x53f3('0x1c')]);}return db['UserProfile']['find']({'where':{'id':_0x680e04[_0x53f3('0x43')]['id']}})['then'](function(_0x548f34){if(!_0x548f34)throw new Error(_0x53f3('0x68')+_0x680e04[_0x53f3('0x43')]['id']);return db[_0x53f3('0x37')][_0x53f3('0x65')](_0x680e04);})[_0x53f3('0x25')](respondWithFilteredResult(_0x37bcbb,_0x291bff))[_0x53f3('0x3a')](handleError(_0x37bcbb,null));}; \ No newline at end of file +var _0xc74c=['subsections','enabled','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','get','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfile','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','body','clone','find','updatedAt','crudPermissions','omit','createdAt','create','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','sequelize','transaction','push','ids','includes'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc74c,0x163));var _0xcc74=function(_0xa6284b,_0x329ef9){_0xa6284b=_0xa6284b-0x0;var _0x23980f=_0xc74c[_0xa6284b];return _0x23980f;};'use strict';var emlformat=require(_0xcc74('0x0'));var rimraf=require(_0xcc74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcc74('0x2'));var moment=require(_0xcc74('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc74('0x4'));var util=require(_0xcc74('0x5'));var path=require(_0xcc74('0x6'));var sox=require(_0xcc74('0x7'));var csv=require(_0xcc74('0x8'));var ejs=require(_0xcc74('0x9'));var fs=require('fs');var fs_extra=require(_0xcc74('0xa'));var _=require('lodash');var squel=require(_0xcc74('0xb'));var crypto=require(_0xcc74('0xc'));var jsforce=require(_0xcc74('0xd'));var deskjs=require(_0xcc74('0xe'));var toCsv=require(_0xcc74('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcc74('0xf'));var authService=require(_0xcc74('0x10'));var qs=require(_0xcc74('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc74('0x12'));var logger=require(_0xcc74('0x13'))(_0xcc74('0x14'));var utils=require('../../config/utils');var config=require(_0xcc74('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc74('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xcc74('0x17'),'port':0x18eb});var socket=require(_0xcc74('0x18'))(new Redis(config[_0xcc74('0x19')]));require(_0xcc74('0x1a'))[_0xcc74('0x1b')](socket);function respondWithStatusCode(_0x59eff4,_0xe4aaaa){_0xe4aaaa=_0xe4aaaa||0xcc;return function(_0x3b3ed8){if(_0x3b3ed8){return _0x59eff4[_0xcc74('0x1c')](_0xe4aaaa);}return _0x59eff4[_0xcc74('0x1d')](_0xe4aaaa)[_0xcc74('0x1e')]();};}function respondWithResult(_0x57f804,_0x3ffb75){_0x3ffb75=_0x3ffb75||0xc8;return function(_0xbcdba8){if(_0xbcdba8){return _0x57f804[_0xcc74('0x1d')](_0x3ffb75)[_0xcc74('0x1f')](_0xbcdba8);}};}function respondWithFilteredResult(_0x2f33ad,_0x2715bb){return function(_0x170583){if(_0x170583){var _0x45d9bd=typeof _0x2715bb[_0xcc74('0x20')]==='undefined'&&typeof _0x2715bb[_0xcc74('0x21')]===_0xcc74('0x22');var _0x1cd9ae=_0x170583[_0xcc74('0x23')];var _0x2f084f=_0x45d9bd?0x0:_0x2715bb[_0xcc74('0x20')];var _0x5b48a2=_0x45d9bd?_0x170583[_0xcc74('0x23')]:_0x2715bb[_0xcc74('0x20')]+_0x2715bb['limit'];var _0x17a3aa;if(_0x5b48a2>=_0x1cd9ae){_0x5b48a2=_0x1cd9ae;_0x17a3aa=0xc8;}else{_0x17a3aa=0xce;}_0x2f33ad[_0xcc74('0x1d')](_0x17a3aa);return _0x2f33ad[_0xcc74('0x24')]('Content-Range',_0x2f084f+'-'+_0x5b48a2+'/'+_0x1cd9ae)[_0xcc74('0x1f')](_0x170583);}return null;};}function patchUpdates(_0x22b39f){return function(_0x403b76){try{jsonpatch[_0xcc74('0x25')](_0x403b76,_0x22b39f,!![]);}catch(_0x554111){return BPromise[_0xcc74('0x26')](_0x554111);}return _0x403b76[_0xcc74('0x27')]();};}function saveUpdates(_0x462348,_0x4f9b6e){return function(_0xdd96b1){if(_0xdd96b1){return _0xdd96b1[_0xcc74('0x28')](_0x462348)[_0xcc74('0x29')](function(_0x5a9fa6){return _0x5a9fa6;});}return null;};}function removeEntity(_0x59ee69,_0x563b64){return function(_0x134ad4){if(_0x134ad4){return _0x134ad4[_0xcc74('0x2a')]()[_0xcc74('0x29')](function(){_0x59ee69[_0xcc74('0x1d')](0xcc)[_0xcc74('0x1e')]();});}};}function handleEntityNotFound(_0x39de38,_0x4b45d0){return function(_0x393e56){if(!_0x393e56){_0x39de38[_0xcc74('0x1c')](0x194);}return _0x393e56;};}function handleError(_0x1ca5d1,_0x26b077){_0x26b077=_0x26b077||0x1f4;return function(_0x47f50b){logger[_0xcc74('0x2b')](_0x47f50b[_0xcc74('0x2c')]);if(_0x47f50b[_0xcc74('0x2d')]){delete _0x47f50b[_0xcc74('0x2d')];}_0x1ca5d1[_0xcc74('0x1d')](_0x26b077)[_0xcc74('0x2e')](_0x47f50b);};}exports['index']=function(_0x390bc0,_0x5cb390){var _0x3faeab={},_0x380134={},_0x424718={'count':0x0,'rows':[]};var _0x43513b=_[_0xcc74('0x2f')](db[_0xcc74('0x30')]['rawAttributes'],function(_0x5bdf22){return{'name':_0x5bdf22[_0xcc74('0x31')],'type':_0x5bdf22[_0xcc74('0x32')][_0xcc74('0x33')]};});_0x380134['model']=_[_0xcc74('0x2f')](_0x43513b,_0xcc74('0x2d'));_0x380134['query']=_['keys'](_0x390bc0[_0xcc74('0x34')]);_0x380134[_0xcc74('0x35')]=_['intersection'](_0x380134[_0xcc74('0x36')],_0x380134[_0xcc74('0x34')]);_0x3faeab[_0xcc74('0x37')]=_[_0xcc74('0x38')](_0x380134[_0xcc74('0x36')],qs[_0xcc74('0x39')](_0x390bc0['query'][_0xcc74('0x39')]));_0x3faeab[_0xcc74('0x37')]=_0x3faeab[_0xcc74('0x37')][_0xcc74('0x3a')]?_0x3faeab[_0xcc74('0x37')]:_0x380134[_0xcc74('0x36')];if(!_0x390bc0[_0xcc74('0x34')]['hasOwnProperty'](_0xcc74('0x3b'))){_0x3faeab['limit']=qs[_0xcc74('0x21')](_0x390bc0[_0xcc74('0x34')][_0xcc74('0x21')]);_0x3faeab[_0xcc74('0x20')]=qs[_0xcc74('0x20')](_0x390bc0[_0xcc74('0x34')][_0xcc74('0x20')]);}_0x3faeab[_0xcc74('0x3c')]=qs[_0xcc74('0x3d')](_0x390bc0[_0xcc74('0x34')][_0xcc74('0x3d')]);_0x3faeab[_0xcc74('0x3e')]=qs['filters'](_[_0xcc74('0x3f')](_0x390bc0[_0xcc74('0x34')],_0x380134['filters']),_0x43513b);if(_0x390bc0[_0xcc74('0x34')][_0xcc74('0x40')]){_0x3faeab[_0xcc74('0x3e')]=_[_0xcc74('0x41')](_0x3faeab[_0xcc74('0x3e')],{'$or':_['map'](_0x43513b,function(_0x26c5dc){if(_0x26c5dc['type']!==_0xcc74('0x42')){var _0x24d4f1={};_0x24d4f1[_0x26c5dc[_0xcc74('0x2d')]]={'$like':'%'+_0x390bc0['query'][_0xcc74('0x40')]+'%'};return _0x24d4f1;}})});}_0x3faeab=_[_0xcc74('0x41')]({},_0x3faeab,_0x390bc0[_0xcc74('0x43')]);var _0x2c5cb1={'where':_0x3faeab[_0xcc74('0x3e')]};return db[_0xcc74('0x30')][_0xcc74('0x23')](_0x2c5cb1)[_0xcc74('0x29')](function(_0x3e6052){_0x424718['count']=_0x3e6052;if(_0x390bc0[_0xcc74('0x34')][_0xcc74('0x44')]){_0x3faeab[_0xcc74('0x45')]=[{'all':!![]}];}return db[_0xcc74('0x30')][_0xcc74('0x46')](_0x3faeab);})[_0xcc74('0x29')](function(_0x37deeb){_0x424718[_0xcc74('0x47')]=_0x37deeb;return _0x424718;})[_0xcc74('0x29')](respondWithFilteredResult(_0x5cb390,_0x3faeab))[_0xcc74('0x48')](handleError(_0x5cb390,null));};exports['show']=function(_0x342324,_0x32e6f7){var _0x2aed47={'raw':![],'where':{'id':_0x342324[_0xcc74('0x49')]['id']}},_0x1534fb={};_0x1534fb[_0xcc74('0x36')]=_['keys'](db[_0xcc74('0x30')][_0xcc74('0x4a')]);_0x1534fb[_0xcc74('0x34')]=_[_0xcc74('0x4b')](_0x342324['query']);_0x1534fb['filters']=_[_0xcc74('0x38')](_0x1534fb[_0xcc74('0x36')],_0x1534fb[_0xcc74('0x34')]);_0x2aed47[_0xcc74('0x37')]=_[_0xcc74('0x38')](_0x1534fb[_0xcc74('0x36')],qs['fields'](_0x342324[_0xcc74('0x34')][_0xcc74('0x39')]));_0x2aed47[_0xcc74('0x37')]=_0x2aed47[_0xcc74('0x37')][_0xcc74('0x3a')]?_0x2aed47['attributes']:_0x1534fb['model'];if(_0x342324[_0xcc74('0x34')][_0xcc74('0x44')]){_0x2aed47[_0xcc74('0x45')]=[{'all':!![]}];}_0x2aed47=_[_0xcc74('0x41')]({},_0x2aed47,_0x342324[_0xcc74('0x43')]);return db[_0xcc74('0x30')]['find'](_0x2aed47)['then'](handleEntityNotFound(_0x32e6f7,null))['then'](respondWithResult(_0x32e6f7,null))[_0xcc74('0x48')](handleError(_0x32e6f7,null));};exports['create']=function(_0x39e560,_0x32b67c){return db[_0xcc74('0x30')]['create'](_0x39e560[_0xcc74('0x4c')],{})[_0xcc74('0x29')](respondWithResult(_0x32b67c,0xc9))[_0xcc74('0x48')](handleError(_0x32b67c,null));};exports[_0xcc74('0x4d')]=function(_0x4060cc,_0x24e6cd){var _0x4bc4f8={'where':{'id':_0x4060cc['params']['id']}},_0x4b28fe={};_0x4b28fe[_0xcc74('0x36')]=_['keys'](db[_0xcc74('0x30')][_0xcc74('0x4a')]);_0x4bc4f8[_0xcc74('0x37')]=_[_0xcc74('0x38')](_0x4b28fe[_0xcc74('0x36')],qs[_0xcc74('0x39')](_0x4060cc[_0xcc74('0x34')][_0xcc74('0x39')]));_0x4bc4f8[_0xcc74('0x37')]=_0x4bc4f8[_0xcc74('0x37')][_0xcc74('0x3a')]?_0x4bc4f8[_0xcc74('0x37')]:_0x4b28fe[_0xcc74('0x36')];if(_0x4060cc[_0xcc74('0x34')][_0xcc74('0x44')]){_0x4bc4f8[_0xcc74('0x45')]=[{'all':!![]}];}_0x4bc4f8=_[_0xcc74('0x41')]({},_0x4bc4f8,_0x4060cc[_0xcc74('0x43')]);return db[_0xcc74('0x30')][_0xcc74('0x4e')](_0x4bc4f8)[_0xcc74('0x29')](handleEntityNotFound(_0x24e6cd,null))[_0xcc74('0x29')](function(_0x512349){if(_0x512349){var _0x1c4faf=_0x512349['get']({'plain':!![]});_0x1c4faf=qs['omit'](_0x1c4faf,['id','createdAt',_0xcc74('0x4f'),_0xcc74('0x50')]);_0x4060cc[_0xcc74('0x4c')]=_[_0xcc74('0x51')](_0x4060cc[_0xcc74('0x4c')],['id',_0xcc74('0x52'),'updatedAt']);return db['sequelize']['transaction'](function(_0x53b414){return db[_0xcc74('0x30')][_0xcc74('0x53')](_[_0xcc74('0x41')](_0x1c4faf,_0x4060cc[_0xcc74('0x4c')]),{'include':_0x4060cc['query'][_0xcc74('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x53b414})[_0xcc74('0x29')](function(_0x3dde0c){var _0x3e392e=_0x3dde0c['get']({'plain':!![]});return db['UserProfileSection'][_0xcc74('0x46')]({'where':{'userProfileId':_0x4060cc[_0xcc74('0x49')]['id']},'raw':!![]})[_0xcc74('0x29')](function(_0xb6c84b){if(_0xb6c84b){return BPromise[_0xcc74('0x54')](_0xb6c84b,function(_0x1f3601){return new BPromise(function(_0x9c2b86,_0xe7df26){if(_0x1f3601[_0xcc74('0x55')]===null||_0x1f3601[_0xcc74('0x55')]===0x1)_0x9c2b86(null);return db[_0xcc74('0x56')][_0xcc74('0x46')]({'where':{'sectionId':_0x1f3601['id']},'raw':!![]})[_0xcc74('0x29')](function(_0xf191c8){var _0x549543=_[_0xcc74('0x2f')](_0xf191c8,function(_0x538bb4){return qs[_0xcc74('0x51')](_0x538bb4,['id','createdAt','updatedAt',_0xcc74('0x57')]);});_0x9c2b86(_0x549543);})[_0xcc74('0x48')](function(_0x236d42){_0xe7df26(_0x236d42);});})['then'](function(_0x361ae2){var _0x3b192d=qs[_0xcc74('0x51')](_0x1f3601,['id',_0xcc74('0x52'),_0xcc74('0x4f')]);_0x3b192d[_0xcc74('0x58')]=_0x3e392e['id'];if(_0x361ae2)_0x3b192d[_0xcc74('0x59')]=_0x361ae2;return _0x3b192d;})[_0xcc74('0x29')](function(_0x5d8627){return db[_0xcc74('0x5a')][_0xcc74('0x53')](_0x5d8627,{'include':[{'model':db[_0xcc74('0x56')],'as':_0xcc74('0x59')}],'raw':!![],'transaction':_0x53b414});});})[_0xcc74('0x29')](function(){return _0x3e392e;});}});});});}})[_0xcc74('0x29')](respondWithResult(_0x24e6cd,0xc9))[_0xcc74('0x48')](handleError(_0x24e6cd,null));};exports['update']=function(_0x7ccf47,_0x1bf3b7){if(_0x7ccf47[_0xcc74('0x4c')]['id']){delete _0x7ccf47[_0xcc74('0x4c')]['id'];}return db['UserProfile'][_0xcc74('0x4e')]({'where':{'id':_0x7ccf47[_0xcc74('0x49')]['id']}})['then'](handleEntityNotFound(_0x1bf3b7,null))[_0xcc74('0x29')](saveUpdates(_0x7ccf47[_0xcc74('0x4c')],null))['then'](respondWithResult(_0x1bf3b7,null))[_0xcc74('0x48')](handleError(_0x1bf3b7,null));};exports['destroy']=function(_0x2c1ecd,_0x401598){return db[_0xcc74('0x30')]['find']({'where':{'id':_0x2c1ecd[_0xcc74('0x49')]['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x401598,null))[_0xcc74('0x29')](removeEntity(_0x401598,null))[_0xcc74('0x48')](handleError(_0x401598,null));};exports[_0xcc74('0x5b')]=function(_0x32b112,_0x4746ff){return db[_0xcc74('0x30')][_0xcc74('0x5b')]()[_0xcc74('0x29')](respondWithResult(_0x4746ff,null))[_0xcc74('0x48')](handleError(_0x4746ff,null));};exports['addSections']=function(_0x2b06d2,_0x2628ed){var _0x8758fd=_0x2b06d2[_0xcc74('0x4c')];return db[_0xcc74('0x30')][_0xcc74('0x4e')]({'where':{'id':_0x2b06d2[_0xcc74('0x49')]['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x2628ed,null))['then'](function(_0x3610b1){if(_0x3610b1){return db[_0xcc74('0x5c')][_0xcc74('0x5d')](function(_0xc0139b){return db[_0xcc74('0x5a')][_0xcc74('0x2a')]({'where':{'userProfileId':_0x2b06d2[_0xcc74('0x49')]['id'],'sectionId':_['map'](_0x8758fd,function(_0x1e705a){return _0x1e705a[_0xcc74('0x57')];})},'transaction':_0xc0139b})[_0xcc74('0x29')](function(){var _0xe1590c=_[_0xcc74('0x2f')](_0x8758fd,function(_0x10990c){_0x10990c['userProfileId']=_0x2b06d2[_0xcc74('0x49')]['id'];return _0x10990c;});var _0x56f450=[];return BPromise[_0xcc74('0x54')](_0xe1590c,function(_0x333288){return db[_0xcc74('0x5a')][_0xcc74('0x53')](_0x333288,{'include':[{'model':db[_0xcc74('0x56')],'as':_0xcc74('0x59')}],'raw':!![],'transaction':_0xc0139b})[_0xcc74('0x29')](function(_0xa57307){_0x56f450[_0xcc74('0x5e')](_0xa57307['get']({'plain':!![]}));});})[_0xcc74('0x29')](function(){return _0x56f450;});});});}})[_0xcc74('0x29')](function(_0x318c2f){return _0x318c2f;})['then'](respondWithResult(_0x2628ed,null))['catch'](handleError(_0x2628ed,null));};exports['removeSections']=function(_0x3b57b9,_0x53a391){var _0x22f16b;return db[_0xcc74('0x30')]['find']({'where':{'id':_0x3b57b9[_0xcc74('0x49')]['id']},'attributes':['id',_0xcc74('0x2d')]})['then'](handleEntityNotFound(_0x53a391,null))[_0xcc74('0x29')](function(_0x43e82e){if(_0x43e82e){_0x22f16b=_0x43e82e;return db['UserProfileSection'][_0xcc74('0x2a')]({'where':{'userProfileId':_0x3b57b9[_0xcc74('0x49')]['id'],'sectionId':_0x3b57b9['query'][_0xcc74('0x5f')]}});}})[_0xcc74('0x29')](function(){return _0x22f16b;})['then'](respondWithStatusCode(_0x53a391,null))[_0xcc74('0x48')](handleError(_0x53a391,null));};exports['getSections']=function(_0x3e671c,_0x255e8f){var _0x4ad33f=[];var _0x38d075=[];return db[_0xcc74('0x5a')]['findAll']({'where':{'userProfileId':_0x3e671c['params']['id']},'raw':!![]})['then'](function(_0x26d3e3){_0x4ad33f=_[_0xcc74('0x40')](_0x26d3e3,function(_0x33fa90){return _0x33fa90['enabled']===0x1||_['includes']([0x3eb,0x709],_0x33fa90[_0xcc74('0x57')]);});if(!_['isEmpty'](_0x4ad33f)){return _['map'](_0x4ad33f,function(_0x3941c9){return _0x3941c9[_0xcc74('0x57')];});}else{return;}})[_0xcc74('0x29')](function(_0x45fcce){if(_0x45fcce)_0x38d075=_0x45fcce;if(_[_0xcc74('0x60')](_0x38d075,0x64)){var _0xe8b4ee=_[_0xcc74('0x4e')](_0x4ad33f,{'sectionId':0x64});return hasDefaultDashboard(_0xe8b4ee)[_0xcc74('0x29')](function(_0x109c58){return _[_0xcc74('0x2f')](_0x4ad33f,function(_0x3cd811){if(_0x3cd811[_0xcc74('0x57')]===0x64){_0x3cd811[_0xcc74('0x61')]=_0x109c58;}return _0x3cd811;});});}else{return;}})['then'](function(_0x29ef96){if(_0x29ef96)_0x4ad33f=_0x29ef96;if(_[_0xcc74('0x60')](_0x38d075,0x3eb)){var _0x5771e0=_[_0xcc74('0x4e')](_0x4ad33f,{'sectionId':0x3eb});return getCustomDashboards(_0x5771e0)['then'](function(_0xc17194){return _[_0xcc74('0x2f')](_0x4ad33f,function(_0x1dbff9){if(_0x5771e0[_0xcc74('0x62')]){if(_0x1dbff9['sectionId']===0x3eb){_0x1dbff9[_0xcc74('0x61')]=_0xc17194;}}else{if(_0x1dbff9['sectionId']===0x64){_0x1dbff9[_0xcc74('0x61')]=_0xc17194;}}return _0x1dbff9;});});}else{return;}})[_0xcc74('0x29')](function(_0x332844){if(_0x332844)_0x4ad33f=_0x332844;if(_['includes'](_0x38d075,0x709)){var _0x4e8b3a=_[_0xcc74('0x4e')](_0x4ad33f,{'sectionId':0x709});return getPlugins(_0x4e8b3a)['then'](function(_0x7ff9ac){if(_0x4e8b3a['enabled']){return _['map'](_0x4ad33f,function(_0x2037a6){if(_0x2037a6[_0xcc74('0x57')]===0x709){_0x2037a6[_0xcc74('0x61')]=_0x7ff9ac;}return _0x2037a6;});}else{var _0x2a42bf={'sectionId':0x76c,'enabled':0x1,'subsections':_0x7ff9ac};var _0x239a60=_[_0xcc74('0x2f')](_0x4ad33f);_0x239a60[_0xcc74('0x5e')](_0x2a42bf);return _0x239a60;}});}else{return;}})[_0xcc74('0x29')](function(_0x3a1a2a){if(_0x3a1a2a)_0x4ad33f=_0x3a1a2a;return _[_0xcc74('0x40')](_0x4ad33f,[_0xcc74('0x62'),0x1]);})[_0xcc74('0x29')](respondWithResult(_0x255e8f,null))[_0xcc74('0x48')](handleError(_0x255e8f,null));};function hasDefaultDashboard(_0x56f327){var _0x59c1c1=[0x65];return new BPromise(function(_0x5670b5,_0x335102){try{if(_0x56f327['autoAssociation']){_0x5670b5(_0x59c1c1);}else{return db[_0xcc74('0x56')][_0xcc74('0x63')]({'where':{'sectionId':_0x56f327['id']},'raw':!![]})['then'](function(_0x253ccc){_0x253ccc?_0x5670b5(_0x59c1c1):_0x5670b5();});}}catch(_0x2ed24d){_0x335102(_0x2ed24d);}});}function getCustomDashboards(_0x3fb82d){var _0x7a3d88=[];return new BPromise(function(_0x506165,_0x3b24b1){try{if(_0x3fb82d['autoAssociation']){return db[_0xcc74('0x64')][_0xcc74('0x46')]({'raw':!![]})['then'](function(_0x5f51a8){_0x5f51a8[_0xcc74('0x65')](function(_0x20cab4){_0x7a3d88[_0xcc74('0x5e')](_0x20cab4['id']+0x1869f);});_0x506165(_0x7a3d88);});}else{return db[_0xcc74('0x56')]['findAll']({'where':{'sectionId':_0x3fb82d['id']},'raw':!![]})[_0xcc74('0x29')](function(_0x2c57f2){_0x2c57f2[_0xcc74('0x65')](function(_0x5306a2){_0x7a3d88[_0xcc74('0x5e')](_0x5306a2['resourceId']+0x1869f);});_0x506165(_0x7a3d88);});}}catch(_0x329699){_0x3b24b1(_0x329699);}});}function getPlugins(_0x43d82c){var _0x35404d=[];return new BPromise(function(_0x29f11a,_0x5b5f1a){try{if(_0x43d82c['autoAssociation']){return db[_0xcc74('0x66')][_0xcc74('0x46')]({'raw':!![]})[_0xcc74('0x29')](function(_0x5ea768){_0x5ea768['forEach'](function(_0x4ff3a9){_0x35404d[_0xcc74('0x5e')](_0x4ff3a9['id']+0x15b38);});_0x29f11a(_0x35404d);});}else{return db[_0xcc74('0x56')][_0xcc74('0x46')]({'where':{'sectionId':_0x43d82c['id']},'raw':!![]})[_0xcc74('0x29')](function(_0x5d02e5){_0x5d02e5['forEach'](function(_0x3a43b0){_0x35404d[_0xcc74('0x5e')](_0x3a43b0[_0xcc74('0x67')]+0x15b38);});_0x29f11a(_0x35404d);});}}catch(_0x4c56cb){_0x5b5f1a(_0x4c56cb);}});}exports[_0xcc74('0x68')]=function(_0x2e8266,_0x4d70b6){return db['UserProfile']['find']({'where':{'id':_0x2e8266['params']['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x4d70b6,null))[_0xcc74('0x29')](function(_0x401702){if(_0x401702){return db[_0xcc74('0x5c')][_0xcc74('0x5d')](function(_0x2590c6){return db[_0xcc74('0x5a')][_0xcc74('0x46')]({'where':{'userProfileId':_0x2e8266[_0xcc74('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xcc74('0x29')](function(_0x2c5172){if(_0x2c5172){return db[_0xcc74('0x5a')]['destroy']({'where':{'userProfileId':_0x2e8266['params']['id'],'id':_['map'](_0x2c5172,function(_0x2d0d21){return _0x2d0d21['id'];})},'transaction':_0x2590c6});}})[_0xcc74('0x29')](function(_0x4f60ff){var _0x2b9d5e=_[_0xcc74('0x2f')](_0x2e8266['body'],function(_0x4a04ad){_0x4a04ad['userProfileId']=_0x2e8266[_0xcc74('0x49')]['id'];return _0x4a04ad;});return db[_0xcc74('0x5a')][_0xcc74('0x69')](_0x2b9d5e,{'raw':!![],'transaction':_0x2590c6});})[_0xcc74('0x29')](function(_0x196834){var _0x537aa8=_[_0xcc74('0x40')](_[_0xcc74('0x2f')](_0x196834,function(_0x40ae30){return _0x40ae30[_0xcc74('0x6a')]({'plain':!![]});}),{'includeAll':![]});if(_0x537aa8){return db[_0xcc74('0x5a')][_0xcc74('0x46')]({'where':{'userProfileId':_0x2e8266['params']['id'],'sectionId':_[_0xcc74('0x2f')](_0x537aa8,function(_0x3e5dc6){return _0x3e5dc6[_0xcc74('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xcc74('0x29')](function(_0x4754d8){var _0x1f24b4=_['map'](_0x2e8266['body'],function(_0x5675e7){_0x5675e7[_0xcc74('0x58')]=_0x2e8266[_0xcc74('0x49')]['id'];return _0x5675e7;});return db[_0xcc74('0x56')]['bulkCreate'](_0x1f24b4,{'raw':!![],'transaction':_0x2590c6});});}})[_0xcc74('0x48')](handleError(_0x4d70b6,null));});}})[_0xcc74('0x29')](function(_0x50b461){var _0x17d069=_['map'](_0x50b461,function(_0x2d6a11){return _0x2d6a11[_0xcc74('0x6a')]({'plain':!![]});});})[_0xcc74('0x29')](respondWithResult(_0x4d70b6,null))[_0xcc74('0x48')](handleError(_0x4d70b6,null));};exports[_0xcc74('0x6b')]=function(_0x3d0f83,_0x1e437,_0x13b02e){return db[_0xcc74('0x30')][_0xcc74('0x4e')]({'where':{'id':_0x3d0f83['params']['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x1e437,null))[_0xcc74('0x29')](function(_0x337fec){if(_0x337fec){return _0x337fec[_0xcc74('0x6b')](_0x3d0f83[_0xcc74('0x34')]['ids']);}})[_0xcc74('0x29')](respondWithStatusCode(_0x1e437,null))[_0xcc74('0x48')](handleError(_0x1e437,null));};exports[_0xcc74('0x6c')]=function(_0xa3903f,_0x132cf3){var _0x5d97dd={};if(!_0xa3903f[_0xcc74('0x34')][_0xcc74('0x6d')])throw new Error(_0xcc74('0x6e'));if(!_0xa3903f[_0xcc74('0x34')][_0xcc74('0x6f')]('nolimit')){_0x5d97dd[_0xcc74('0x21')]=qs['limit'](_0xa3903f['query'][_0xcc74('0x21')]);_0x5d97dd[_0xcc74('0x20')]=qs['offset'](_0xa3903f[_0xcc74('0x34')]['offset']);}return db['UserProfile'][_0xcc74('0x4e')]({'where':{'id':_0xa3903f[_0xcc74('0x49')]['id']}})[_0xcc74('0x29')](function(_0x5171bd){if(!_0x5171bd)throw new Error(_0xcc74('0x70')+_0xa3903f[_0xcc74('0x49')]['id']);return db['UserProfile'][_0xcc74('0x6c')](_0xa3903f);})[_0xcc74('0x29')](respondWithFilteredResult(_0x132cf3,_0x5d97dd))[_0xcc74('0x48')](handleError(_0x132cf3,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 75e0591..4ce97c9 100644 --- a/server/api/userProfile/userProfile.events.js +++ b/server/api/userProfile/userProfile.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8506=['update','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x1c2af6,_0x3a6a59){var _0x1f443b=function(_0x4cf295){while(--_0x4cf295){_0x1c2af6['push'](_0x1c2af6['shift']());}};_0x1f443b(++_0x3a6a59);}(_0x8506,0xe8));var _0x6850=function(_0x250ab3,_0x1b89c){_0x250ab3=_0x250ab3-0x0;var _0x34834a=_0x8506[_0x250ab3];return _0x34834a;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x6850('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6850('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6850('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2e0f9d){return function(_0x204a8a,_0x321eff,_0x5e9ff2){UserProfileEvents[_0x6850('0x3')](_0x2e0f9d+':'+_0x204a8a['id'],_0x204a8a);UserProfileEvents[_0x6850('0x3')](_0x2e0f9d,_0x204a8a);_0x5e9ff2(null);};}for(var e in events){if(events[_0x6850('0x4')](e)){var event=events[e];UserProfile[_0x6850('0x5')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xba18=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xb6ca94,_0x732794){var _0x4a3e1a=function(_0x489de3){while(--_0x489de3){_0xb6ca94['push'](_0xb6ca94['shift']());}};_0x4a3e1a(++_0x732794);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x8ba1('0x0'));var UserProfile=require(_0x8ba1('0x1'))['db'][_0x8ba1('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8ba1('0x3')](0x0);var events={'afterCreate':_0x8ba1('0x4'),'afterUpdate':_0x8ba1('0x5'),'afterDestroy':_0x8ba1('0x6')};function emitEvent(_0x3b5254){return function(_0x59c54c,_0xe3bc16,_0x3136d7){UserProfileEvents[_0x8ba1('0x7')](_0x3b5254+':'+_0x59c54c['id'],_0x59c54c);UserProfileEvents[_0x8ba1('0x7')](_0x3b5254,_0x59c54c);_0x3136d7(null);};}for(var e in events){if(events[_0x8ba1('0x8')](e)){var event=events[e];UserProfile[_0x8ba1('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 9e82df9..0515884 100644 --- a/server/api/userProfile/userProfile.model.js +++ b/server/api/userProfile/userProfile.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5e5=['zendeskaccounts','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Tag','templates','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','where','query','OpenTabs','define','UserProfile','user_profiles','raw','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','union','ignore','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','AnalyticExtractedReport','foreignKey','forEach','merge','options','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','rows','ids','count','Tags','color','tag','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','squel','exports','models','filter','value','findAll','then','map','catch','field','model','associatedResources','name','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projects','JscriptyProject','CmContact','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','faxqueues','FaxQueue','inboundroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','musiconholds','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','telephones','Users','user'];(function(_0x1e2808,_0x439f3e){var _0x172d57=function(_0x40d10b){while(--_0x40d10b){_0x1e2808['push'](_0x1e2808['shift']());}};_0x172d57(++_0x439f3e);}(_0xd5e5,0x11a));var _0x5d5e=function(_0x493efb,_0x263ebe){_0x493efb=_0x493efb-0x0;var _0x2971ce=_0xd5e5[_0x493efb];return _0x2971ce;};'use strict';var _=require(_0x5d5e('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x5d5e('0x1'));var squel=require(_0x5d5e('0x2'));module[_0x5d5e('0x3')]=function(_0x10fc35){var _0x455d37=_0x10fc35[_0x5d5e('0x4')];function _0x1500dd(_0x2a6ac9,_0x3356d1){return new Promise(function(_0x267e75,_0x590574){if(!_0x3356d1)return _0x267e75(null);var _0xfc392d=_0x3356d1[_0x5d5e('0x5')]?{[_0x3356d1['filter']['field']]:_0x3356d1[_0x5d5e('0x5')][_0x5d5e('0x6')]}:undefined;return _0x455d37[_0x2a6ac9][_0x5d5e('0x7')]({'where':_0xfc392d,'raw':!![]})[_0x5d5e('0x8')](function(_0x18df52){_0x3356d1['associatedResources']=_[_0x5d5e('0x9')](_0x18df52,'id');_0x267e75(_0x3356d1);})[_0x5d5e('0xa')](function(_0x32d131){_0x590574(_0x32d131);});});}function _0x2afd79(_0x313506,_0x3945e8){return new Promise(function(_0x3c1e60,_0x477f35){var _0x290e65=_0x313506['filter']?{[_0x313506[_0x5d5e('0x5')][_0x5d5e('0xb')]]:_0x313506['filter'][_0x5d5e('0x6')]}:undefined;return _0x455d37[_0x313506[_0x5d5e('0xc')]][_0x5d5e('0x7')]({'where':_0x290e65,'raw':!![]})['then'](function(_0x221f3a){_0x3945e8[_0x5d5e('0xd')]=_[_0x5d5e('0x9')](_0x221f3a,function(_0xca2b6d){return _0xca2b6d[_0x5d5e('0xe')];});_0x3c1e60(_0x3945e8);})['catch'](function(_0x119118){_0x477f35(_0x119118);});});}function _0x17ac11(_0x61a049,_0x21cb27,_0x27ec87){if(!_0x21cb27)return Promise['resolve'](null);return new Promise(function(_0x2f60ee,_0xd94b02){return _0x455d37['UserProfileResource'][_0x5d5e('0x7')]({'where':{'sectionId':_0x21cb27['id']},'raw':!![]})[_0x5d5e('0x8')](function(_0x353c37){if(_0x61a049['field']&&_0x61a049[_0x5d5e('0xb')]!=='id'){_0x21cb27[_0x5d5e('0xd')]=_[_0x5d5e('0x9')](_0x353c37,function(_0x1430af){return _0x1430af[_0x61a049[_0x5d5e('0xb')]];});}else{if(_0x27ec87==='AnalyticExtractedReport'){_0x21cb27['associatedResources']=_[_0x5d5e('0x9')](_0x353c37,function(_0x226be6){return{'id':_0x226be6['resourceId'],'type':_0x226be6['type']};});}else{_0x21cb27[_0x5d5e('0xd')]=_[_0x5d5e('0x9')](_0x353c37,function(_0x502a3c){return _0x502a3c[_0x5d5e('0xf')];});}}_0x2f60ee(_0x21cb27);})['catch'](function(_0x5bf900){_0xd94b02(_0x5bf900);});});}function _0x5da738(_0x502051,_0x3b6887){var _0x498350={'parentSections':[]};switch(_0x502051[_0x5d5e('0x10')]()){case _0x5d5e('0x11'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x13');break;case _0x5d5e('0x14'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x15');break;case _0x5d5e('0x16'):_0x498350[_0x5d5e('0x12')]='SquareRecording';_0x498350[_0x5d5e('0x17')]=[{'name':_0x5d5e('0x18'),'field':_0x5d5e('0xe'),'foreignKey':'projectName'}];break;case _0x5d5e('0x19'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x1a');break;case'contacts':_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x1b');_0x498350[_0x5d5e('0x17')]=[{'name':'Lists','field':'id','foreignKey':_0x5d5e('0x1c')}];break;case _0x5d5e('0x1d'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x1e');break;case _0x5d5e('0x1f'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x20');break;case _0x5d5e('0x21'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x22');break;case _0x5d5e('0x23'):_0x498350[_0x5d5e('0x12')]='ChatQueue';break;case'chatwebsites':_0x498350[_0x5d5e('0x12')]='ChatWebsite';break;case _0x5d5e('0x24'):_0x498350['childModel']=_0x5d5e('0x25');break;case'faxaccounts':_0x498350[_0x5d5e('0x12')]='FaxAccount';break;case _0x5d5e('0x26'):case'internalroutes':case _0x5d5e('0x27'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x28');break;case'contexts':_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x29');break;case _0x5d5e('0x2a'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x2b');break;case _0x5d5e('0x2c'):_0x498350['childModel']='VoiceRecording';_0x498350[_0x5d5e('0x17')]=[{'name':_0x5d5e('0x2d'),'field':_0x5d5e('0xe'),'foreignKey':_0x5d5e('0x2e'),'model':_0x5d5e('0x2f'),'filter':{'field':_0x5d5e('0x30'),'value':[_0x5d5e('0x31')]}},{'name':_0x5d5e('0x32'),'field':_0x5d5e('0xe'),'foreignKey':'membername','model':_0x5d5e('0x2f'),'filter':{'field':_0x5d5e('0x30'),'value':[_0x5d5e('0x33')]}},{'name':_0x5d5e('0x34'),'field':'name','foreignKey':_0x5d5e('0x35'),'model':_0x5d5e('0x36'),'filter':{'field':_0x5d5e('0x37'),'value':[_0x5d5e('0x38')]}},{'name':_0x5d5e('0x39'),'field':'name','foreignKey':_0x5d5e('0x35'),'model':_0x5d5e('0x36'),'filter':{'field':'type','value':['outbound']}}];break;case _0x5d5e('0x3a'):_0x498350[_0x5d5e('0x12')]='VoiceMusicOnHold';break;case _0x5d5e('0x3b'):_0x498350[_0x5d5e('0x12')]='VoiceChanSpy';break;case _0x5d5e('0x3c'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x3d');break;case _0x5d5e('0x3e'):_0x498350['childModel']=_0x5d5e('0x3f');break;case _0x5d5e('0x40'):_0x498350[_0x5d5e('0x12')]='MailQueue';break;case _0x5d5e('0x41'):_0x498350['childModel']=_0x5d5e('0x42');break;case _0x5d5e('0x43'):_0x498350['childModel']=_0x5d5e('0x44');break;case'openchannelqueues':_0x498350[_0x5d5e('0x12')]='OpenchannelQueue';break;case _0x5d5e('0x45'):_0x498350[_0x5d5e('0x12')]='OpenchannelAccount';break;case _0x5d5e('0x46'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x47');break;case _0x5d5e('0x48'):_0x498350[_0x5d5e('0x12')]='SmsAccount';break;case _0x5d5e('0x49'):_0x498350['childModel']=_0x5d5e('0x4a');break;case _0x5d5e('0x4b'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x4c');break;case _0x5d5e('0x4d'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x4e');break;case'voicequeues':case _0x5d5e('0x4f'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x36');if(_0x3b6887){_0x498350[_0x5d5e('0x17')]=[{'name':'VoiceQueues'},{'name':_0x5d5e('0x39')}];}break;case _0x5d5e('0x50'):case'agents':case _0x5d5e('0x51'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x2f');if(_0x3b6887){_0x498350['parentSections']=[{'name':_0x5d5e('0x52'),'filter':{'field':_0x5d5e('0x30'),'value':['admin',_0x5d5e('0x53')]},'ignore':!![]},{'name':_0x5d5e('0x2d')},{'name':_0x5d5e('0x32')}];}break;case _0x5d5e('0x54'):_0x498350[_0x5d5e('0x12')]='ZendeskAccount';break;case'salesforceaccounts':_0x498350[_0x5d5e('0x12')]='SalesforceAccount';break;case'freshdeskaccounts':_0x498350[_0x5d5e('0x12')]='FreshdeskAccount';break;case _0x5d5e('0x55'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x56');break;case'deskaccounts':_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x57');break;case _0x5d5e('0x58'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x59');break;case _0x5d5e('0x5a'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x2f');break;case _0x5d5e('0x5b'):_0x498350[_0x5d5e('0x12')]='CannedAnswer';break;case _0x5d5e('0x5c'):_0x498350[_0x5d5e('0x12')]='Disposition';break;case'customdashboards':_0x498350['childModel']=_0x5d5e('0x5d');break;case _0x5d5e('0x5e'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x5f');break;case _0x5d5e('0x60'):_0x498350['childModel']=_0x5d5e('0x61');break;case _0x5d5e('0x62'):_0x498350['childModel']=_0x5d5e('0x63');break;case _0x5d5e('0x64'):_0x498350[_0x5d5e('0x12')]='Sound';break;case _0x5d5e('0x65'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x66');break;case _0x5d5e('0x67'):_0x498350['childModel']='Template';break;case _0x5d5e('0x68'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x69');break;case _0x5d5e('0x6a'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x6b');break;case _0x5d5e('0x6c'):_0x498350[_0x5d5e('0x12')]='Variable';break;case _0x5d5e('0x6d'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x6e');break;case _0x5d5e('0x6f'):_0x498350[_0x5d5e('0x12')]='AnalyticExtractedReport';_0x498350['parentSections']=[{'name':_0x5d5e('0x70'),'field':'id','foreignKey':_0x5d5e('0x71')}];break;case _0x5d5e('0x72'):_0x498350[_0x5d5e('0x12')]=_0x5d5e('0x73');break;}return _0x498350;}function _0x4305f7(_0x4e9468,_0x3de216){var _0x3cb644=_0x4e9468[_0x5d5e('0x74')](0x0)[_0x5d5e('0x75')]()+_0x4e9468['slice'](0x1);var _0x5a14cc={'type':_0x455d37[_0x5d5e('0x76')][_0x5d5e('0x77')][_0x5d5e('0x78')],'raw':!![]};return new Promise(function(_0x2692b1,_0x1a009e){var _0x55f60d=squel['select']()[_0x5d5e('0xb')](_0x5d5e('0x79')+_0x3cb644+_0x5d5e('0x7a'),'id')['field'](_0x5d5e('0x7b'))[_0x5d5e('0x7c')](_0x5d5e('0x7d')+_0x4e9468+'_interactions','ui')[_0x5d5e('0x7e')]('ui.UserId\x20=\x20?',_0x3de216['id']);return _0x455d37['sequelize'][_0x5d5e('0x7f')](_0x55f60d['toString'](),_0x5a14cc)[_0x5d5e('0x8')](function(_0x547f70){_0x3de216[_0x3cb644+_0x5d5e('0x80')]=_0x547f70;_0x2692b1(_0x547f70);})['catch'](function(_0x4e5dd0){_0x1a009e(_0x4e5dd0);});});}return _0x10fc35[_0x5d5e('0x81')](_0x5d5e('0x82'),attributes,{'tableName':_0x5d5e('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x54df29){var _0x3afb4c={'raw':_0x54df29[_0x5d5e('0x7f')][_0x5d5e('0x84')],'where':{}};var _0x531843={};var _0x34f6e5={'count':0x0,'rows':[]};var _0x47da01=_0x54df29['query']['section'];var _0x5725a8=_0x54df29['query']['mergeResources']||![];var _0x195172=_0x5da738(_0x47da01,_0x5725a8);if(!_0x195172[_0x5d5e('0x12')])throw new Error(_0x5d5e('0x85')+_0x47da01+'\x27');var _0x11849a=[{'name':_0x47da01}];if(!_[_0x5d5e('0x86')](_0x195172[_0x5d5e('0x17')]))_0x11849a=_0x195172[_0x5d5e('0x17')];var _0x416624=[];for(var _0x7e0050=0x0;_0x7e0050<_0x11849a[_0x5d5e('0x87')];_0x7e0050++){_0x416624[_0x5d5e('0x88')](_0x455d37[_0x5d5e('0x89')][_0x5d5e('0x8a')]({'where':{'userProfileId':_0x54df29[_0x5d5e('0x8b')]['id'],'name':_0x11849a[_0x7e0050]['name']},'raw':!![]}));}return Promise[_0x5d5e('0x8c')](_0x416624)[_0x5d5e('0x8')](function(_0x440aab){var _0x1063a4=_[_0x5d5e('0x5')](_0x440aab,function(_0x5081c3){return _0x5081c3?_0x5081c3:undefined;});var _0x2b18fe=_[_0x5d5e('0x5')](_0x11849a,['ignore',!![]]);var _0x428a78=_[_0x5d5e('0x86')](_0x1063a4)&&_[_0x5d5e('0x86')](_0x2b18fe)?null:_[_0x5d5e('0x8d')](_0x2b18fe,_0x1063a4);if(!_0x428a78)return null;var _0x223615=[];for(var _0x43bbdb=0x0;_0x43bbdb<_0x428a78[_0x5d5e('0x87')];_0x43bbdb++){var _0x2defeb=_['find'](_0x11849a,function(_0x2e4d7f){return _0x428a78[_0x43bbdb]?_0x2e4d7f[_0x5d5e('0xe')]===_0x428a78[_0x43bbdb]['name']:null;});if(_0x2defeb){if(_0x428a78[_0x43bbdb][_0x5d5e('0x8e')]){_0x223615['push'](_0x1500dd(_0x195172[_0x5d5e('0x12')],_0x428a78[_0x43bbdb]));}else{if(!_0x428a78[_0x43bbdb]['autoAssociation']){_0x223615['push'](_0x17ac11(_0x2defeb,_0x428a78[_0x43bbdb],_0x195172[_0x5d5e('0x12')]));}else{if(_0x2defeb[_0x5d5e('0xc')]){_0x223615[_0x5d5e('0x88')](_0x2afd79(_0x2defeb,_0x428a78[_0x43bbdb]));}}}}}return Promise[_0x5d5e('0x8c')](_0x223615);})[_0x5d5e('0x8')](function(_0x5c08bd){var _0x388b19=_0x5c08bd;var _0x552b97=null;if(_0x388b19){_0x552b97=_0x388b19[_0x5d5e('0x87')]===0x1?_0x388b19[0x0]:null;}if(!_0x552b97&&!_0x388b19)return _0x34f6e5;var _0x4a8384=_0x455d37[_0x195172[_0x5d5e('0x12')]]['rawAttributes'];_0x531843[_0x5d5e('0xc')]=_[_0x5d5e('0x8f')](_0x4a8384);_0x531843[_0x5d5e('0x7f')]=_[_0x5d5e('0x8f')](_0x54df29[_0x5d5e('0x7f')]);_0x531843[_0x5d5e('0x90')]=_[_0x5d5e('0x91')](_0x531843[_0x5d5e('0xc')],_0x531843['query']);_0x3afb4c[_0x5d5e('0x92')]=_['intersection'](_0x531843['model'],qs['fields'](_0x54df29['query'][_0x5d5e('0x93')]));_0x3afb4c[_0x5d5e('0x92')]=_0x3afb4c[_0x5d5e('0x92')][_0x5d5e('0x87')]?_0x3afb4c[_0x5d5e('0x92')]:_0x531843[_0x5d5e('0xc')];if(!_0x54df29['query'][_0x5d5e('0x94')](_0x5d5e('0x95'))){_0x3afb4c[_0x5d5e('0x96')]=qs[_0x5d5e('0x96')](_0x54df29[_0x5d5e('0x7f')]['limit']);_0x3afb4c[_0x5d5e('0x97')]=qs[_0x5d5e('0x97')](_0x54df29[_0x5d5e('0x7f')][_0x5d5e('0x97')]);}_0x3afb4c[_0x5d5e('0x98')]=qs[_0x5d5e('0x99')](_0x54df29[_0x5d5e('0x7f')][_0x5d5e('0x99')]);_0x3afb4c[_0x5d5e('0x7e')]=qs[_0x5d5e('0x90')](_[_0x5d5e('0x9a')](_0x54df29[_0x5d5e('0x7f')],_0x531843[_0x5d5e('0x90')]));if(_0x54df29[_0x5d5e('0x7f')][_0x5d5e('0x5')]){_0x3afb4c[_0x5d5e('0x7e')]=_['merge'](_0x3afb4c[_0x5d5e('0x7e')],{'$or':_[_0x5d5e('0x9')](_0x4a8384,function(_0x37b871){if(_0x37b871[_0x5d5e('0x37')][_0x5d5e('0x9b')]!=='VIRTUAL'){var _0x32f36c={};_0x32f36c[_0x37b871[_0x5d5e('0xb')]]={'$like':'%'+_0x54df29[_0x5d5e('0x7f')][_0x5d5e('0x5')]+'%'};return _0x32f36c;}})});}var _0x2f1ebe=[];var _0x3586ff=null;var _0x216021={};if(_0x552b97){_0x3586ff=_['find'](_0x11849a,[_0x5d5e('0xe'),_0x552b97[_0x5d5e('0xe')]]);if(_0x3586ff[_0x5d5e('0xb')]){_0x216021={};if(_0x195172['childModel']===_0x5d5e('0x9c')){_0x216021[_0x3586ff[_0x5d5e('0x9d')]]=_[_0x5d5e('0x9')](_0x552b97['associatedResources'],'id');}else{_0x216021[_0x3586ff['foreignKey']]=_0x552b97['associatedResources'];}_0x2f1ebe[_0x5d5e('0x88')](_0x216021);}else{_0x3afb4c[_0x5d5e('0x7e')]['id']=_0x552b97[_0x5d5e('0xd')];}}else{for(var _0x1bf95b=0x0;_0x1bf95b<_0x388b19[_0x5d5e('0x87')];_0x1bf95b++){_0x3586ff=_[_0x5d5e('0x8a')](_0x11849a,[_0x5d5e('0xe'),_0x388b19[_0x1bf95b][_0x5d5e('0xe')]]);if(_0x3586ff[_0x5d5e('0xb')]){_0x216021={};_0x216021[_0x3586ff[_0x5d5e('0x9d')]]=_0x388b19[_0x1bf95b]['associatedResources'];_0x2f1ebe['push'](_0x216021);}else{if(!_0x3afb4c[_0x5d5e('0x7e')]['id'])_0x3afb4c[_0x5d5e('0x7e')]['id']=[];_0x388b19[_0x1bf95b][_0x5d5e('0xd')][_0x5d5e('0x9e')](function(_0x1e84b7){_0x3afb4c['where']['id']['push'](_0x1e84b7);});}}}if(!_['isEmpty'](_0x2f1ebe)){_0x3afb4c['where']=_[_0x5d5e('0x9f')](_0x3afb4c['where'],{'$and':{'$or':_0x2f1ebe}});}_0x3afb4c=_[_0x5d5e('0x9f')]({},_0x3afb4c,_0x54df29[_0x5d5e('0xa0')]);if(_0x552b97&&!_0x552b97[_0x5d5e('0xa1')]&&_0x195172[_0x5d5e('0x12')]===_0x5d5e('0x9c')){if(_0x54df29[_0x5d5e('0x7f')][_0x5d5e('0xa2')]){_0x3afb4c[_0x5d5e('0xa3')]=[{'all':!![]}];}return _0x455d37[_0x195172[_0x5d5e('0x12')]][_0x5d5e('0x7')](_0x3afb4c)['then'](function(_0x1f05ed){var _0xba6fce=[];_0x1f05ed['forEach'](function(_0x48ec07){var _0x554ca3;switch(_0x48ec07[_0x5d5e('0xa4')]){case _0x5d5e('0xa5'):_0x554ca3=_[_0x5d5e('0x8a')](_0x552b97[_0x5d5e('0xd')],function(_0x35eeab){return _0x35eeab['id']===_0x48ec07[_0x5d5e('0x71')]&&_0x35eeab[_0x5d5e('0x37')]===_0x5d5e('0xa6');});break;case _0x5d5e('0xa7'):_0x554ca3=_['find'](_0x552b97[_0x5d5e('0xd')],function(_0x404b2c){return _0x404b2c['id']===_0x48ec07[_0x5d5e('0x71')]&&_0x404b2c[_0x5d5e('0x37')]===_0x5d5e('0xa8');});break;}if(_0x554ca3)_0xba6fce[_0x5d5e('0x88')](_0x48ec07);});_0x34f6e5['count']=_0xba6fce[_0x5d5e('0x87')];_0x34f6e5[_0x5d5e('0xa9')]=_0xba6fce;return _0x34f6e5;});}else{if(!_[_0x5d5e('0x86')](_0x54df29[_0x5d5e('0x7f')][_0x5d5e('0xaa')])){_0x3afb4c[_0x5d5e('0x7e')]['id']=_0x3afb4c[_0x5d5e('0x7e')]['id']?_['intersection'](_0x3afb4c[_0x5d5e('0x7e')]['id'],_0x54df29[_0x5d5e('0x7f')]['ids']):_0x54df29[_0x5d5e('0x7f')]['ids'];}return _0x455d37[_0x195172[_0x5d5e('0x12')]]['count']({'where':_0x3afb4c[_0x5d5e('0x7e')]})[_0x5d5e('0x8')](function(_0x340e93){_0x34f6e5[_0x5d5e('0xab')]=_0x340e93;if(_0x54df29[_0x5d5e('0x7f')][_0x5d5e('0xa2')]){if(_0x195172[_0x5d5e('0x12')]===_0x5d5e('0x1b')){_0x3afb4c[_0x5d5e('0xa3')]=[{'model':_0x455d37[_0x5d5e('0x66')],'as':_0x5d5e('0xac'),'attributes':['id',_0x5d5e('0xe'),_0x5d5e('0xad')],'required':_0x54df29[_0x5d5e('0x7f')]['tag']?!![]:![]},{'model':_0x455d37[_0x5d5e('0x66')],'as':'ThroughTags','attributes':['id',_0x5d5e('0xe'),_0x5d5e('0xad')],'through':_0x54df29['query'][_0x5d5e('0xae')]?{'attributes':[],'where':{'TagId':_0x54df29[_0x5d5e('0x7f')][_0x5d5e('0xae')]||undefined}}:{},'required':_0x54df29[_0x5d5e('0x7f')]['tag']?!![]:![]}];}else{_0x3afb4c[_0x5d5e('0xa3')]=[{'all':!![]}];}}return _0x455d37[_0x195172[_0x5d5e('0x12')]][_0x5d5e('0x7')](_0x3afb4c);})[_0x5d5e('0x8')](function(_0x196def){_0x34f6e5[_0x5d5e('0xa9')]=_0x196def;if(_0x47da01===_0x5d5e('0x2d')&&_0x54df29[_0x5d5e('0x7f')][_0x5d5e('0xaf')]===_0x5d5e('0xb0')){var _0x220f04=[];for(var _0x3c7425=0x0;_0x3c7425<_0x34f6e5['rows']['length'];_0x3c7425++){_0x220f04[_0x5d5e('0x88')](_0x4305f7(_0x5d5e('0xb1'),_0x34f6e5['rows'][_0x3c7425][_0x5d5e('0xb2')]));_0x220f04[_0x5d5e('0x88')](_0x4305f7(_0x5d5e('0xb3'),_0x34f6e5[_0x5d5e('0xa9')][_0x3c7425][_0x5d5e('0xb2')]));_0x220f04[_0x5d5e('0x88')](_0x4305f7('fax',_0x34f6e5['rows'][_0x3c7425][_0x5d5e('0xb2')]));_0x220f04[_0x5d5e('0x88')](_0x4305f7(_0x5d5e('0xb4'),_0x34f6e5['rows'][_0x3c7425][_0x5d5e('0xb2')]));_0x220f04[_0x5d5e('0x88')](_0x4305f7(_0x5d5e('0xb5'),_0x34f6e5[_0x5d5e('0xa9')][_0x3c7425][_0x5d5e('0xb2')]));_0x220f04['push'](_0x4305f7(_0x5d5e('0xb6'),_0x34f6e5[_0x5d5e('0xa9')][_0x3c7425][_0x5d5e('0xb2')]));}return Promise[_0x5d5e('0x8c')](_0x220f04)['then'](function(){return _0x34f6e5;});}return _0x34f6e5;});}});}}});}; \ No newline at end of file +var _0x2a07=['VoicePrefix','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','VoiceQueues','users','agents','telephones','admin','user','Agents','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','intervals','Pause','scheduler','Schedule','sounds','Sound','Template','triggers','Trigger','Variable','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.createdAt','from','user_has_','where','sequelize','query','OpenTabs','define','user_profiles','raw','Invalid\x20section\x20\x27','length','UserProfileSection','find','ignore','isEmpty','union','push','all','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','sort','pick','filters','merge','key','AnalyticExtractedReport','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','ids','count','Tag','color','ThroughTags','tag','rows','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','map','catch','model','associatedResources','name','resolve','UserProfileResource','type','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','User','role','agent','Telephones','membername','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','chanspies','VoiceChanSpy','voiceprefixes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a07,0x74));var _0x72a0=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x2a07[_0x43444b];return _0x392fe5;};'use strict';var _=require(_0x72a0('0x0'));var attributes=require(_0x72a0('0x1'));var qs=require(_0x72a0('0x2'));var squel=require(_0x72a0('0x3'));module[_0x72a0('0x4')]=function(_0x548164){var _0x335b7c=_0x548164[_0x72a0('0x5')];function _0x135982(_0x45b155,_0x431f65){return new Promise(function(_0xce74c,_0x3ccf6d){if(!_0x431f65)return _0xce74c(null);var _0x20dab9=_0x431f65[_0x72a0('0x6')]?{[_0x431f65[_0x72a0('0x6')][_0x72a0('0x7')]]:_0x431f65[_0x72a0('0x6')][_0x72a0('0x8')]}:undefined;return _0x335b7c[_0x45b155][_0x72a0('0x9')]({'where':_0x20dab9,'raw':!![]})[_0x72a0('0xa')](function(_0x2bc45b){_0x431f65['associatedResources']=_[_0x72a0('0xb')](_0x2bc45b,'id');_0xce74c(_0x431f65);})[_0x72a0('0xc')](function(_0x54abf6){_0x3ccf6d(_0x54abf6);});});}function _0x46fb8a(_0x194488,_0x1b85b1){return new Promise(function(_0x44d7cf,_0x975c27){var _0x516c08=_0x194488[_0x72a0('0x6')]?{[_0x194488[_0x72a0('0x6')][_0x72a0('0x7')]]:_0x194488[_0x72a0('0x6')][_0x72a0('0x8')]}:undefined;return _0x335b7c[_0x194488[_0x72a0('0xd')]][_0x72a0('0x9')]({'where':_0x516c08,'raw':!![]})['then'](function(_0x4930c5){_0x1b85b1[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x4930c5,function(_0x19eaf9){return _0x19eaf9[_0x72a0('0xf')];});_0x44d7cf(_0x1b85b1);})[_0x72a0('0xc')](function(_0x3f3d62){_0x975c27(_0x3f3d62);});});}function _0x4ab55e(_0x30248e,_0x2e7552,_0x16ac70){if(!_0x2e7552)return Promise[_0x72a0('0x10')](null);return new Promise(function(_0x2d1e95,_0x54495e){return _0x335b7c[_0x72a0('0x11')][_0x72a0('0x9')]({'where':{'sectionId':_0x2e7552['id']},'raw':!![]})[_0x72a0('0xa')](function(_0x5b63c8){if(_0x30248e[_0x72a0('0x7')]&&_0x30248e[_0x72a0('0x7')]!=='id'){_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0x5437df){return _0x5437df[_0x30248e[_0x72a0('0x7')]];});}else{if(_0x16ac70==='AnalyticExtractedReport'){_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0xde058c){return{'id':_0xde058c['resourceId'],'type':_0xde058c[_0x72a0('0x12')]};});}else{_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0x3d1965){return _0x3d1965['resourceId'];});}}_0x2d1e95(_0x2e7552);})[_0x72a0('0xc')](function(_0x390464){_0x54495e(_0x390464);});});}function _0x1ddd54(_0x23b918,_0x3022b0){var _0x174b1b={'parentSections':[]};switch(_0x23b918['toLowerCase']()){case'squareprojects':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x14');break;case _0x72a0('0x15'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x16');break;case _0x72a0('0x17'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x18');_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x1a'),'field':'name','foreignKey':_0x72a0('0x1b')}];break;case _0x72a0('0x1c'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x1d');break;case _0x72a0('0x1e'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x1f');_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x20'),'field':'id','foreignKey':_0x72a0('0x21')}];break;case'lists':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x22');break;case _0x72a0('0x23'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x24');break;case _0x72a0('0x25'):_0x174b1b[_0x72a0('0x13')]='CmCustomField';break;case _0x72a0('0x26'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x27');break;case _0x72a0('0x28'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x29');break;case _0x72a0('0x2a'):_0x174b1b[_0x72a0('0x13')]='FaxQueue';break;case _0x72a0('0x2b'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x2c');break;case'inboundroutes':case _0x72a0('0x2d'):case'outboundroutes':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x2e');break;case _0x72a0('0x2f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x30');break;case _0x72a0('0x31'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x32');break;case _0x72a0('0x33'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x34');_0x174b1b[_0x72a0('0x19')]=[{'name':'Agents','field':_0x72a0('0xf'),'foreignKey':'membername','model':_0x72a0('0x35'),'filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x37')]}},{'name':_0x72a0('0x38'),'field':_0x72a0('0xf'),'foreignKey':_0x72a0('0x39'),'model':_0x72a0('0x35'),'filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x3a')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x72a0('0x3b'),'model':_0x72a0('0x3c'),'filter':{'field':_0x72a0('0x12'),'value':[_0x72a0('0x3d')]}},{'name':_0x72a0('0x3e'),'field':'name','foreignKey':_0x72a0('0x3b'),'model':_0x72a0('0x3c'),'filter':{'field':'type','value':[_0x72a0('0x3f')]}}];break;case'musiconholds':_0x174b1b['childModel']='VoiceMusicOnHold';break;case _0x72a0('0x40'):_0x174b1b['childModel']=_0x72a0('0x41');break;case _0x72a0('0x42'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x43');break;case'ivrcampaigns':_0x174b1b['childModel']='Campaign';break;case'mailqueues':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x44');break;case'mailaccounts':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x45');break;case'mailsubstatuses':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x46');break;case _0x72a0('0x47'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x48');break;case _0x72a0('0x49'):_0x174b1b['childModel']=_0x72a0('0x4a');break;case'smsqueues':_0x174b1b[_0x72a0('0x13')]='SmsQueue';break;case _0x72a0('0x4b'):_0x174b1b[_0x72a0('0x13')]='SmsAccount';break;case _0x72a0('0x4c'):_0x174b1b['childModel']=_0x72a0('0x4d');break;case _0x72a0('0x4e'):_0x174b1b[_0x72a0('0x13')]='WhatsappAccount';break;case _0x72a0('0x4f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x50');break;case'voicequeues':case'queuecampaigns':_0x174b1b[_0x72a0('0x13')]='VoiceQueue';if(_0x3022b0){_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x51')},{'name':_0x72a0('0x3e')}];}break;case _0x72a0('0x52'):case _0x72a0('0x53'):case _0x72a0('0x54'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x35');if(_0x3022b0){_0x174b1b[_0x72a0('0x19')]=[{'name':'Users','filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x55'),_0x72a0('0x56')]},'ignore':!![]},{'name':_0x72a0('0x57')},{'name':_0x72a0('0x38')}];}break;case _0x72a0('0x58'):_0x174b1b[_0x72a0('0x13')]='ZendeskAccount';break;case'salesforceaccounts':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x59');break;case _0x72a0('0x5a'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x5b');break;case _0x72a0('0x5c'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x5d');break;case _0x72a0('0x5e'):_0x174b1b[_0x72a0('0x13')]='DeskAccount';break;case _0x72a0('0x5f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x60');break;case _0x72a0('0x61'):_0x174b1b[_0x72a0('0x13')]='User';break;case _0x72a0('0x62'):_0x174b1b['childModel']='CannedAnswer';break;case _0x72a0('0x63'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x64');break;case _0x72a0('0x65'):_0x174b1b[_0x72a0('0x13')]='Dashboard';break;case _0x72a0('0x66'):_0x174b1b[_0x72a0('0x13')]='Interval';break;case'pauses':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x67');break;case _0x72a0('0x68'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x69');break;case _0x72a0('0x6a'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x6b');break;case'tags':_0x174b1b[_0x72a0('0x13')]='Tag';break;case'templates':_0x174b1b['childModel']=_0x72a0('0x6c');break;case _0x72a0('0x6d'):_0x174b1b['childModel']=_0x72a0('0x6e');break;case'trunks':_0x174b1b[_0x72a0('0x13')]='Trunk';break;case'variables':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x6f');break;case'plugins':_0x174b1b[_0x72a0('0x13')]='Plugin';break;case _0x72a0('0x70'):_0x174b1b['childModel']='AnalyticExtractedReport';_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x71'),'field':'id','foreignKey':_0x72a0('0x72')}];break;case'metrics':_0x174b1b['childModel']=_0x72a0('0x73');break;}return _0x174b1b;}function _0x48f178(_0x44b171,_0x36d604){var _0x1cea02=_0x44b171[_0x72a0('0x74')](0x0)[_0x72a0('0x75')]()+_0x44b171[_0x72a0('0x76')](0x1);var _0x41f7f6={'type':_0x335b7c[_0x72a0('0x77')][_0x72a0('0x78')][_0x72a0('0x79')],'raw':!![]};return new Promise(function(_0x32a0bb,_0x43ec4b){var _0x4d0774=squel[_0x72a0('0x7a')]()['field']('ui.'+_0x1cea02+'InteractionId','id')['field'](_0x72a0('0x7b'))[_0x72a0('0x7c')](_0x72a0('0x7d')+_0x44b171+'_interactions','ui')[_0x72a0('0x7e')]('ui.UserId\x20=\x20?',_0x36d604['id']);return _0x335b7c[_0x72a0('0x7f')][_0x72a0('0x80')](_0x4d0774['toString'](),_0x41f7f6)[_0x72a0('0xa')](function(_0x24e211){_0x36d604[_0x1cea02+_0x72a0('0x81')]=_0x24e211;_0x32a0bb(_0x24e211);})[_0x72a0('0xc')](function(_0x5e47c4){_0x43ec4b(_0x5e47c4);});});}return _0x548164[_0x72a0('0x82')]('UserProfile',attributes,{'tableName':_0x72a0('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2cb292){var _0x1df6fc={'raw':_0x2cb292['query'][_0x72a0('0x84')],'where':{}};var _0x3eb3b5={};var _0x1b8a72={'count':0x0,'rows':[]};var _0x154c9d=_0x2cb292[_0x72a0('0x80')]['section'];var _0x5707e9=_0x2cb292[_0x72a0('0x80')]['mergeResources']||![];var _0x421c35=_0x1ddd54(_0x154c9d,_0x5707e9);if(!_0x421c35['childModel'])throw new Error(_0x72a0('0x85')+_0x154c9d+'\x27');var _0xd9ae1a=[{'name':_0x154c9d}];if(!_['isEmpty'](_0x421c35[_0x72a0('0x19')]))_0xd9ae1a=_0x421c35[_0x72a0('0x19')];var _0x83ebf6=[];for(var _0x55b301=0x0;_0x55b301<_0xd9ae1a[_0x72a0('0x86')];_0x55b301++){_0x83ebf6['push'](_0x335b7c[_0x72a0('0x87')][_0x72a0('0x88')]({'where':{'userProfileId':_0x2cb292['params']['id'],'name':_0xd9ae1a[_0x55b301][_0x72a0('0xf')]},'raw':!![]}));}return Promise['all'](_0x83ebf6)['then'](function(_0x5142de){var _0x28969a=_['filter'](_0x5142de,function(_0x115ba8){return _0x115ba8?_0x115ba8:undefined;});var _0x5520b8=_[_0x72a0('0x6')](_0xd9ae1a,[_0x72a0('0x89'),!![]]);var _0x143ebf=_['isEmpty'](_0x28969a)&&_[_0x72a0('0x8a')](_0x5520b8)?null:_[_0x72a0('0x8b')](_0x5520b8,_0x28969a);if(!_0x143ebf)return null;var _0x275e45=[];for(var _0x28551a=0x0;_0x28551a<_0x143ebf[_0x72a0('0x86')];_0x28551a++){var _0x58ef97=_[_0x72a0('0x88')](_0xd9ae1a,function(_0x2d431d){return _0x143ebf[_0x28551a]?_0x2d431d[_0x72a0('0xf')]===_0x143ebf[_0x28551a][_0x72a0('0xf')]:null;});if(_0x58ef97){if(_0x143ebf[_0x28551a]['ignore']){_0x275e45[_0x72a0('0x8c')](_0x135982(_0x421c35[_0x72a0('0x13')],_0x143ebf[_0x28551a]));}else{if(!_0x143ebf[_0x28551a]['autoAssociation']){_0x275e45[_0x72a0('0x8c')](_0x4ab55e(_0x58ef97,_0x143ebf[_0x28551a],_0x421c35['childModel']));}else{if(_0x58ef97[_0x72a0('0xd')]){_0x275e45[_0x72a0('0x8c')](_0x46fb8a(_0x58ef97,_0x143ebf[_0x28551a]));}}}}}return Promise[_0x72a0('0x8d')](_0x275e45);})[_0x72a0('0xa')](function(_0x14f61a){var _0x1e23e9=_0x14f61a;var _0x7450c7=null;if(_0x1e23e9){_0x7450c7=_0x1e23e9['length']===0x1?_0x1e23e9[0x0]:null;}if(!_0x7450c7&&!_0x1e23e9)return _0x1b8a72;var _0x5b0dfd=_0x335b7c[_0x421c35['childModel']][_0x72a0('0x8e')];_0x3eb3b5[_0x72a0('0xd')]=_[_0x72a0('0x8f')](_0x5b0dfd);_0x3eb3b5[_0x72a0('0x80')]=_[_0x72a0('0x8f')](_0x2cb292[_0x72a0('0x80')]);_0x3eb3b5['filters']=_[_0x72a0('0x90')](_0x3eb3b5[_0x72a0('0xd')],_0x3eb3b5[_0x72a0('0x80')]);_0x1df6fc[_0x72a0('0x91')]=_[_0x72a0('0x90')](_0x3eb3b5[_0x72a0('0xd')],qs[_0x72a0('0x92')](_0x2cb292['query'][_0x72a0('0x92')]));_0x1df6fc[_0x72a0('0x91')]=_0x1df6fc[_0x72a0('0x91')][_0x72a0('0x86')]?_0x1df6fc[_0x72a0('0x91')]:_0x3eb3b5[_0x72a0('0xd')];if(!_0x2cb292['query'][_0x72a0('0x93')]('nolimit')){_0x1df6fc[_0x72a0('0x94')]=qs[_0x72a0('0x94')](_0x2cb292[_0x72a0('0x80')][_0x72a0('0x94')]);_0x1df6fc[_0x72a0('0x95')]=qs['offset'](_0x2cb292[_0x72a0('0x80')][_0x72a0('0x95')]);}_0x1df6fc['order']=qs[_0x72a0('0x96')](_0x2cb292[_0x72a0('0x80')][_0x72a0('0x96')]);_0x1df6fc[_0x72a0('0x7e')]=qs['filters'](_[_0x72a0('0x97')](_0x2cb292[_0x72a0('0x80')],_0x3eb3b5[_0x72a0('0x98')]));if(_0x2cb292[_0x72a0('0x80')][_0x72a0('0x6')]){_0x1df6fc[_0x72a0('0x7e')]=_[_0x72a0('0x99')](_0x1df6fc[_0x72a0('0x7e')],{'$or':_[_0x72a0('0xb')](_0x5b0dfd,function(_0x3d02e6){if(_0x3d02e6[_0x72a0('0x12')][_0x72a0('0x9a')]!=='VIRTUAL'){var _0x18dc1b={};_0x18dc1b[_0x3d02e6[_0x72a0('0x7')]]={'$like':'%'+_0x2cb292[_0x72a0('0x80')][_0x72a0('0x6')]+'%'};return _0x18dc1b;}})});}var _0xada6ad=[];var _0x3a0bd6=null;var _0x20281b={};if(_0x7450c7){_0x3a0bd6=_[_0x72a0('0x88')](_0xd9ae1a,['name',_0x7450c7[_0x72a0('0xf')]]);if(_0x3a0bd6['field']){_0x20281b={};if(_0x421c35['childModel']===_0x72a0('0x9b')){_0x20281b[_0x3a0bd6['foreignKey']]=_['map'](_0x7450c7[_0x72a0('0xe')],'id');}else{_0x20281b[_0x3a0bd6['foreignKey']]=_0x7450c7[_0x72a0('0xe')];}_0xada6ad[_0x72a0('0x8c')](_0x20281b);}else{_0x1df6fc[_0x72a0('0x7e')]['id']=_0x7450c7['associatedResources'];}}else{for(var _0x344a69=0x0;_0x344a69<_0x1e23e9[_0x72a0('0x86')];_0x344a69++){_0x3a0bd6=_[_0x72a0('0x88')](_0xd9ae1a,[_0x72a0('0xf'),_0x1e23e9[_0x344a69][_0x72a0('0xf')]]);if(_0x3a0bd6['field']){_0x20281b={};_0x20281b[_0x3a0bd6[_0x72a0('0x9c')]]=_0x1e23e9[_0x344a69][_0x72a0('0xe')];_0xada6ad[_0x72a0('0x8c')](_0x20281b);}else{if(!_0x1df6fc['where']['id'])_0x1df6fc[_0x72a0('0x7e')]['id']=[];_0x1e23e9[_0x344a69][_0x72a0('0xe')][_0x72a0('0x9d')](function(_0x56104e){_0x1df6fc[_0x72a0('0x7e')]['id'][_0x72a0('0x8c')](_0x56104e);});}}}if(!_[_0x72a0('0x8a')](_0xada6ad)){_0x1df6fc[_0x72a0('0x7e')]=_[_0x72a0('0x99')](_0x1df6fc[_0x72a0('0x7e')],{'$and':{'$or':_0xada6ad}});}_0x1df6fc=_[_0x72a0('0x99')]({},_0x1df6fc,_0x2cb292[_0x72a0('0x9e')]);if(_0x7450c7&&!_0x7450c7[_0x72a0('0x9f')]&&_0x421c35['childModel']===_0x72a0('0x9b')){if(_0x2cb292[_0x72a0('0x80')][_0x72a0('0xa0')]){_0x1df6fc[_0x72a0('0xa1')]=[{'all':!![]}];}return _0x335b7c[_0x421c35[_0x72a0('0x13')]]['findAll'](_0x1df6fc)[_0x72a0('0xa')](function(_0x2c72fd){var _0x1c95fc=[];_0x2c72fd[_0x72a0('0x9d')](function(_0x5a995e){var _0x36d8b9;switch(_0x5a995e[_0x72a0('0xa2')]){case _0x72a0('0xa3'):_0x36d8b9=_['find'](_0x7450c7['associatedResources'],function(_0x3e23e4){return _0x3e23e4['id']===_0x5a995e[_0x72a0('0x72')]&&_0x3e23e4[_0x72a0('0x12')]===_0x72a0('0xa4');});break;case _0x72a0('0xa5'):_0x36d8b9=_['find'](_0x7450c7['associatedResources'],function(_0x5c4170){return _0x5c4170['id']===_0x5a995e[_0x72a0('0x72')]&&_0x5c4170['type']===_0x72a0('0xa6');});break;}if(_0x36d8b9)_0x1c95fc['push'](_0x5a995e);});_0x1b8a72['count']=_0x1c95fc['length'];_0x1b8a72['rows']=_0x1c95fc;return _0x1b8a72;});}else{if(!_[_0x72a0('0x8a')](_0x2cb292[_0x72a0('0x80')][_0x72a0('0xa7')])){_0x1df6fc[_0x72a0('0x7e')]['id']=_0x1df6fc['where']['id']?_[_0x72a0('0x90')](_0x1df6fc[_0x72a0('0x7e')]['id'],_0x2cb292['query'][_0x72a0('0xa7')]):_0x2cb292[_0x72a0('0x80')]['ids'];}return _0x335b7c[_0x421c35[_0x72a0('0x13')]][_0x72a0('0xa8')]({'where':_0x1df6fc[_0x72a0('0x7e')]})[_0x72a0('0xa')](function(_0x5e1638){_0x1b8a72['count']=_0x5e1638;if(_0x2cb292[_0x72a0('0x80')][_0x72a0('0xa0')]){if(_0x421c35[_0x72a0('0x13')]===_0x72a0('0x1f')){_0x1df6fc[_0x72a0('0xa1')]=[{'model':_0x335b7c[_0x72a0('0xa9')],'as':'Tags','attributes':['id','name',_0x72a0('0xaa')],'required':_0x2cb292[_0x72a0('0x80')]['tag']?!![]:![]},{'model':_0x335b7c[_0x72a0('0xa9')],'as':_0x72a0('0xab'),'attributes':['id',_0x72a0('0xf'),_0x72a0('0xaa')],'through':_0x2cb292[_0x72a0('0x80')][_0x72a0('0xac')]?{'attributes':[],'where':{'TagId':_0x2cb292[_0x72a0('0x80')]['tag']||undefined}}:{},'required':_0x2cb292[_0x72a0('0x80')][_0x72a0('0xac')]?!![]:![]}];}else{_0x1df6fc[_0x72a0('0xa1')]=[{'all':!![]}];}}return _0x335b7c[_0x421c35['childModel']][_0x72a0('0x9')](_0x1df6fc);})[_0x72a0('0xa')](function(_0x346e03){_0x1b8a72[_0x72a0('0xad')]=_0x346e03;if(_0x154c9d===_0x72a0('0x57')&&_0x2cb292['query'][_0x72a0('0xae')]===_0x72a0('0xaf')){var _0x1f6d7d=[];for(var _0x417ac4=0x0;_0x417ac4<_0x1b8a72[_0x72a0('0xad')][_0x72a0('0x86')];_0x417ac4++){_0x1f6d7d['push'](_0x48f178(_0x72a0('0xb0'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb2'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb3'),_0x1b8a72['rows'][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d['push'](_0x48f178(_0x72a0('0xb4'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb5'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4]['dataValues']));_0x1f6d7d['push'](_0x48f178(_0x72a0('0xb6'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));}return Promise[_0x72a0('0x8d')](_0x1f6d7d)[_0x72a0('0xa')](function(){return _0x1b8a72;});}return _0x1b8a72;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 478063c..4872c4d 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ab1=['defaults','localhost','socket.io-emitter','register','then','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x2726df,_0x542214){var _0x1896ab=function(_0x4c8e26){while(--_0x4c8e26){_0x2726df['push'](_0x2726df['shift']());}};_0x1896ab(++_0x542214);}(_0x1ab1,0x12c));var _0x11ab=function(_0x1fcb8a,_0x4a46d8){_0x1fcb8a=_0x1fcb8a-0x0;var _0x3f8811=_0x1ab1[_0x1fcb8a];return _0x3f8811;};'use strict';var _=require(_0x11ab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x11ab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x11ab('0x2'));var logger=require('../../config/logger')(_0x11ab('0x3'));var config=require(_0x11ab('0x4'));var jayson=require(_0x11ab('0x5'));var client=jayson[_0x11ab('0x6')]['http']({'port':0x232a});config[_0x11ab('0x7')]=_[_0x11ab('0x8')](config[_0x11ab('0x7')],{'host':_0x11ab('0x9'),'port':0x18eb});var socket=require(_0x11ab('0xa'))(new Redis(config[_0x11ab('0x7')]));require('./userProfile.socket')[_0x11ab('0xb')](socket);function respondWithRpcPromise(_0x56d31d,_0x3ce254,_0x2b8048){return new BPromise(function(_0xa61634,_0x7762ad){return client['request'](_0x56d31d,_0x2b8048)[_0x11ab('0xc')](function(_0x225793){logger[_0x11ab('0xd')](_0x11ab('0xe'),_0x3ce254,'request\x20sent');logger['debug'](_0x11ab('0xf'),_0x3ce254,_0x11ab('0x10'),JSON[_0x11ab('0x11')](_0x225793));if(_0x225793[_0x11ab('0x12')]){if(_0x225793[_0x11ab('0x12')]['code']===0x1f4){logger[_0x11ab('0x12')](_0x11ab('0xe'),_0x3ce254,_0x225793[_0x11ab('0x12')][_0x11ab('0x13')]);return _0x7762ad(_0x225793['error'][_0x11ab('0x13')]);}logger[_0x11ab('0x12')](_0x11ab('0xe'),_0x3ce254,_0x225793[_0x11ab('0x12')][_0x11ab('0x13')]);return _0xa61634(_0x225793[_0x11ab('0x12')][_0x11ab('0x13')]);}else{logger['info'](_0x11ab('0xe'),_0x3ce254,_0x11ab('0x10'));_0xa61634(_0x225793[_0x11ab('0x14')][_0x11ab('0x13')]);}})[_0x11ab('0x15')](function(_0x470933){logger[_0x11ab('0x12')]('UserProfile,\x20%s,\x20%s',_0x3ce254,_0x470933);_0x7762ad(_0x470933);});});} \ No newline at end of file +var _0x0954=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','request','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','moment','bluebird'];(function(_0x101d59,_0x331222){var _0x31dddd=function(_0x1598e8){while(--_0x1598e8){_0x101d59['push'](_0x101d59['shift']());}};_0x31dddd(++_0x331222);}(_0x0954,0x135));var _0x4095=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x0954[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0x4095('0x0'));var util=require('util');var moment=require(_0x4095('0x1'));var BPromise=require(_0x4095('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4095('0x3'));var db=require(_0x4095('0x4'))['db'];var utils=require(_0x4095('0x5'));var logger=require(_0x4095('0x6'))(_0x4095('0x7'));var config=require(_0x4095('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4095('0x9')]=_[_0x4095('0xa')](config[_0x4095('0x9')],{'host':_0x4095('0xb'),'port':0x18eb});var socket=require(_0x4095('0xc'))(new Redis(config[_0x4095('0x9')]));require('./userProfile.socket')[_0x4095('0xd')](socket);function respondWithRpcPromise(_0xe32904,_0x9e1747,_0x5d3e09){return new BPromise(function(_0x296b6d,_0x33daa4){return client[_0x4095('0xe')](_0xe32904,_0x5d3e09)['then'](function(_0x1963eb){logger['info'](_0x4095('0xf'),_0x9e1747,'request\x20sent');logger[_0x4095('0x10')](_0x4095('0x11'),_0x9e1747,_0x4095('0x12'),JSON['stringify'](_0x1963eb));if(_0x1963eb['error']){if(_0x1963eb[_0x4095('0x13')][_0x4095('0x14')]===0x1f4){logger[_0x4095('0x13')](_0x4095('0xf'),_0x9e1747,_0x1963eb['error']['message']);return _0x33daa4(_0x1963eb[_0x4095('0x13')][_0x4095('0x15')]);}logger[_0x4095('0x13')](_0x4095('0xf'),_0x9e1747,_0x1963eb[_0x4095('0x13')][_0x4095('0x15')]);return _0x296b6d(_0x1963eb['error']['message']);}else{logger[_0x4095('0x16')](_0x4095('0xf'),_0x9e1747,'request\x20sent');_0x296b6d(_0x1963eb[_0x4095('0x17')]['message']);}})['catch'](function(_0x272010){logger['error'](_0x4095('0xf'),_0x9e1747,_0x272010);_0x33daa4(_0x272010);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e257a8c..ead54ed 100644 --- a/server/api/userProfile/userProfile.socket.js +++ b/server/api/userProfile/userProfile.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb724=['removeListener','register','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x3488d6,_0x4f6bd1){var _0x5c3295=function(_0xf7586d){while(--_0xf7586d){_0x3488d6['push'](_0x3488d6['shift']());}};_0x5c3295(++_0x4f6bd1);}(_0xb724,0x1db));var _0x4b72=function(_0x36fa55,_0x518f6e){_0x36fa55=_0x36fa55-0x0;var _0xe39e8a=_0xb724[_0x36fa55];return _0xe39e8a;};'use strict';var UserProfileEvents=require(_0x4b72('0x0'));var events=[_0x4b72('0x1'),_0x4b72('0x2'),_0x4b72('0x3')];function createListener(_0x5627b8,_0x10ab31){return function(_0x3b6023){_0x10ab31[_0x4b72('0x4')](_0x5627b8,_0x3b6023);};}function removeListener(_0x18ae17,_0xf7507d){return function(){UserProfileEvents[_0x4b72('0x5')](_0x18ae17,_0xf7507d);};}exports[_0x4b72('0x6')]=function(_0x31f263){for(var _0x332030=0x0,_0x4a5b55=events['length'];_0x332030<_0x4a5b55;_0x332030++){var _0xbccc35=events[_0x332030];var _0x456d07=createListener(_0x4b72('0x7')+_0xbccc35,_0x31f263);UserProfileEvents['on'](_0xbccc35,_0x456d07);}}; \ No newline at end of file +var _0xd164=['./userProfile.events','save','emit','register','length'];(function(_0x5a32cd,_0xaa03c4){var _0x7056d7=function(_0x574d5c){while(--_0x574d5c){_0x5a32cd['push'](_0x5a32cd['shift']());}};_0x7056d7(++_0xaa03c4);}(_0xd164,0x17c));var _0x4d16=function(_0x2e4bac,_0x598a47){_0x2e4bac=_0x2e4bac-0x0;var _0x517552=_0xd164[_0x2e4bac];return _0x517552;};'use strict';var UserProfileEvents=require(_0x4d16('0x0'));var events=[_0x4d16('0x1'),'remove','update'];function createListener(_0x3692bd,_0x429ca2){return function(_0x4b935e){_0x429ca2[_0x4d16('0x2')](_0x3692bd,_0x4b935e);};}function removeListener(_0x4aa90d,_0x1ee2b6){return function(){UserProfileEvents['removeListener'](_0x4aa90d,_0x1ee2b6);};}exports[_0x4d16('0x3')]=function(_0x3b3940){for(var _0x3baa45=0x0,_0x1becab=events[_0x4d16('0x4')];_0x3baa45<_0x1becab;_0x3baa45++){var _0x21e705=events[_0x3baa45];var _0x53dc78=createListener('userProfile:'+_0x21e705,_0x3b3940);UserProfileEvents['on'](_0x21e705,_0x53dc78);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 0fe4c77..27570bb 100644 --- a/server/api/userProfileResource/index.js +++ b/server/api/userProfileResource/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1618=['/describe','describe','show','create','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index'];(function(_0x3c97ea,_0x42d40d){var _0x1453ab=function(_0x2d05f9){while(--_0x2d05f9){_0x3c97ea['push'](_0x3c97ea['shift']());}};_0x1453ab(++_0x42d40d);}(_0x1618,0x1ac));var _0x8161=function(_0x2453b5,_0x2c80bb){_0x2453b5=_0x2453b5-0x0;var _0x418c31=_0x1618[_0x2453b5];return _0x418c31;};'use strict';var multer=require(_0x8161('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8161('0x1'));var express=require(_0x8161('0x2'));var router=express[_0x8161('0x3')]();var fs_extra=require(_0x8161('0x4'));var auth=require(_0x8161('0x5'));var interaction=require(_0x8161('0x6'));var config=require(_0x8161('0x7'));var controller=require(_0x8161('0x8'));router[_0x8161('0x9')]('/',auth[_0x8161('0xa')](),controller[_0x8161('0xb')]);router[_0x8161('0x9')](_0x8161('0xc'),auth['isAuthenticated'](),controller[_0x8161('0xd')]);router[_0x8161('0x9')]('/:id',auth[_0x8161('0xa')](),controller[_0x8161('0xe')]);router['post']('/',auth[_0x8161('0xa')](),controller[_0x8161('0xf')]);router['put'](_0x8161('0x10'),auth[_0x8161('0xa')](),controller[_0x8161('0x11')]);router[_0x8161('0x12')](_0x8161('0x10'),auth[_0x8161('0xa')](),controller[_0x8161('0x13')]);module['exports']=router; \ No newline at end of file +var _0x928c=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','get','/describe','describe','/:id','isAuthenticated','post','create','put','delete'];(function(_0x569ec0,_0x531e33){var _0x3653e4=function(_0x5c9266){while(--_0x5c9266){_0x569ec0['push'](_0x569ec0['shift']());}};_0x3653e4(++_0x531e33);}(_0x928c,0x1a0));var _0xc928=function(_0x2640f6,_0x20b5e8){_0x2640f6=_0x2640f6-0x0;var _0x14bf56=_0x928c[_0x2640f6];return _0x14bf56;};'use strict';var multer=require(_0xc928('0x0'));var util=require(_0xc928('0x1'));var path=require('path');var timeout=require(_0xc928('0x2'));var express=require('express');var router=express[_0xc928('0x3')]();var fs_extra=require(_0xc928('0x4'));var auth=require(_0xc928('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc928('0x6'));router[_0xc928('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc928('0x7')](_0xc928('0x8'),auth['isAuthenticated'](),controller[_0xc928('0x9')]);router[_0xc928('0x7')](_0xc928('0xa'),auth[_0xc928('0xb')](),controller['show']);router[_0xc928('0xc')]('/',auth[_0xc928('0xb')](),controller[_0xc928('0xd')]);router[_0xc928('0xe')]('/:id',auth[_0xc928('0xb')](),controller['update']);router[_0xc928('0xf')](_0xc928('0xa'),auth[_0xc928('0xb')](),controller[_0xc928('0x10')]);module[_0xc928('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 72d1e2d..f4ec87a 100644 --- a/server/api/userProfileResource/userProfileResource.attributes.js +++ b/server/api/userProfileResource/userProfileResource.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8571=['exports','STRING','INTEGER','sequelize'];(function(_0x2cbb8f,_0x58f2d9){var _0x9f7644=function(_0x380abf){while(--_0x380abf){_0x2cbb8f['push'](_0x2cbb8f['shift']());}};_0x9f7644(++_0x58f2d9);}(_0x8571,0xf3));var _0x1857=function(_0x70693c,_0x3bceb9){_0x70693c=_0x70693c-0x0;var _0x2f83aa=_0x8571[_0x70693c];return _0x2f83aa;};'use strict';var Sequelize=require(_0x1857('0x0'));module[_0x1857('0x1')]={'name':{'type':Sequelize[_0x1857('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1857('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1857('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x80b3=['sequelize','STRING'];(function(_0x5c5b6e,_0x368b0c){var _0x4e87db=function(_0x54ce64){while(--_0x54ce64){_0x5c5b6e['push'](_0x5c5b6e['shift']());}};_0x4e87db(++_0x368b0c);}(_0x80b3,0xb8));var _0x380b=function(_0x4f0057,_0x7d37c4){_0x4f0057=_0x4f0057-0x0;var _0x57698f=_0x80b3[_0x4f0057];return _0x57698f;};'use strict';var Sequelize=require(_0x380b('0x0'));module['exports']={'name':{'type':Sequelize[_0x380b('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x380b('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a0a44d5..94cbdf6 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','UserProfileResource','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x4468b2,_0x4f0703){var _0x4fb044=function(_0x135dd5){while(--_0x135dd5){_0x4468b2['push'](_0x4468b2['shift']());}};_0x4fb044(++_0x4f0703);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['UserProfileResource']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['UserProfileResource']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file +var _0xe3da=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x51f959,_0x31f1b5){var _0x588f90=function(_0x40e1c7){while(--_0x40e1c7){_0x51f959['push'](_0x51f959['shift']());}};_0x588f90(++_0x31f1b5);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));};exports['describe']=function(_0x4f4694,_0x4c6dab){return db[_0xae3d('0x2f')][_0xae3d('0x50')]()['then'](respondWithResult(_0x4c6dab,null))[_0xae3d('0x48')](handleError(_0x4c6dab,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 21faea0..94fa25f 100644 --- a/server/api/userProfileResource/userProfileResource.model.js +++ b/server/api/userProfileResource/userProfileResource.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa371=['../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','api','request-promise'];(function(_0x16f5e4,_0x740eb9){var _0x5d9cd2=function(_0x19f06f){while(--_0x19f06f){_0x16f5e4['push'](_0x16f5e4['shift']());}};_0x5d9cd2(++_0x740eb9);}(_0xa371,0x1e8));var _0x1a37=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa371[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1a37('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1a37('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a37('0x2'));var attributes=require(_0x1a37('0x3'));module[_0x1a37('0x4')]=function(_0x43c51d,_0x5ca8b0){return _0x43c51d[_0x1a37('0x5')](_0x1a37('0x6'),attributes,{'tableName':_0x1a37('0x7'),'paranoid':![],'indexes':[{'name':_0x1a37('0x8'),'fields':['resourceId',_0x1a37('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x52ae=['../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','lodash','../../config/logger','moment','rimraf'];(function(_0x23cc8e,_0x51d805){var _0x2f47d2=function(_0x3e353a){while(--_0x3e353a){_0x23cc8e['push'](_0x23cc8e['shift']());}};_0x2f47d2(++_0x51d805);}(_0x52ae,0x6a));var _0xe52a=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0x52ae[_0xdaab62];return _0x13d767;};'use strict';var _=require(_0xe52a('0x0'));var util=require('util');var logger=require(_0xe52a('0x1'))('api');var moment=require(_0xe52a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe52a('0x3'));var config=require(_0xe52a('0x4'));var attributes=require(_0xe52a('0x5'));module[_0xe52a('0x6')]=function(_0x3471b8,_0x258ac2){return _0x3471b8[_0xe52a('0x7')](_0xe52a('0x8'),attributes,{'tableName':_0xe52a('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 6012eb5..21922da 100644 --- a/server/api/userProfileResource/userProfileResource.rpc.js +++ b/server/api/userProfileResource/userProfileResource.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba81=['../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x72b401,_0x3fdb0e){var _0x4bc759=function(_0x344641){while(--_0x344641){_0x72b401['push'](_0x72b401['shift']());}};_0x4bc759(++_0x3fdb0e);}(_0xba81,0xc7));var _0x1ba8=function(_0x5e5d39,_0x45c2e9){_0x5e5d39=_0x5e5d39-0x0;var _0x499861=_0xba81[_0x5e5d39];return _0x499861;};'use strict';var _=require(_0x1ba8('0x0'));var util=require(_0x1ba8('0x1'));var moment=require(_0x1ba8('0x2'));var BPromise=require(_0x1ba8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ba8('0x4'));var db=require(_0x1ba8('0x5'))['db'];var utils=require(_0x1ba8('0x6'));var logger=require(_0x1ba8('0x7'))('rpc');var config=require(_0x1ba8('0x8'));var jayson=require(_0x1ba8('0x9'));var client=jayson[_0x1ba8('0xa')][_0x1ba8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a64fd,_0x52b3f4,_0x1d61d1){return new BPromise(function(_0x59fdbf,_0x49e9c8){return client[_0x1ba8('0xc')](_0x1a64fd,_0x1d61d1)[_0x1ba8('0xd')](function(_0x3dc4d7){logger['info'](_0x1ba8('0xe'),_0x52b3f4,_0x1ba8('0xf'));logger[_0x1ba8('0x10')](_0x1ba8('0x11'),_0x52b3f4,_0x1ba8('0xf'),JSON[_0x1ba8('0x12')](_0x3dc4d7));if(_0x3dc4d7[_0x1ba8('0x13')]){if(_0x3dc4d7[_0x1ba8('0x13')][_0x1ba8('0x14')]===0x1f4){logger[_0x1ba8('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x52b3f4,_0x3dc4d7[_0x1ba8('0x13')][_0x1ba8('0x15')]);return _0x49e9c8(_0x3dc4d7[_0x1ba8('0x13')][_0x1ba8('0x15')]);}logger['error'](_0x1ba8('0xe'),_0x52b3f4,_0x3dc4d7[_0x1ba8('0x13')][_0x1ba8('0x15')]);return _0x59fdbf(_0x3dc4d7[_0x1ba8('0x13')]['message']);}else{logger['info'](_0x1ba8('0xe'),_0x52b3f4,'request\x20sent');_0x59fdbf(_0x3dc4d7['result']['message']);}})[_0x1ba8('0x16')](function(_0x1035a5){logger['error'](_0x1ba8('0xe'),_0x52b3f4,_0x1035a5);_0x49e9c8(_0x1035a5);});});} \ No newline at end of file +var _0xe25c=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment'];(function(_0x4793f9,_0x634b26){var _0x4fc321=function(_0x4e51ee){while(--_0x4e51ee){_0x4793f9['push'](_0x4793f9['shift']());}};_0x4fc321(++_0x634b26);}(_0xe25c,0x167));var _0xce25=function(_0x4778e2,_0x58c806){_0x4778e2=_0x4778e2-0x0;var _0x138ded=_0xe25c[_0x4778e2];return _0x138ded;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xce25('0x0'));var BPromise=require('bluebird');var rs=require(_0xce25('0x1'));var fs=require('fs');var Redis=require(_0xce25('0x2'));var db=require(_0xce25('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xce25('0x4'));var config=require(_0xce25('0x5'));var jayson=require(_0xce25('0x6'));var client=jayson[_0xce25('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a32e4,_0x4ea75e,_0x1785c9){return new BPromise(function(_0x103550,_0x1369f7){return client['request'](_0x4a32e4,_0x1785c9)['then'](function(_0x49440a){logger[_0xce25('0x8')](_0xce25('0x9'),_0x4ea75e,_0xce25('0xa'));logger[_0xce25('0xb')](_0xce25('0xc'),_0x4ea75e,_0xce25('0xa'),JSON['stringify'](_0x49440a));if(_0x49440a[_0xce25('0xd')]){if(_0x49440a['error'][_0xce25('0xe')]===0x1f4){logger[_0xce25('0xd')](_0xce25('0x9'),_0x4ea75e,_0x49440a[_0xce25('0xd')][_0xce25('0xf')]);return _0x1369f7(_0x49440a[_0xce25('0xd')][_0xce25('0xf')]);}logger[_0xce25('0xd')](_0xce25('0x9'),_0x4ea75e,_0x49440a[_0xce25('0xd')][_0xce25('0xf')]);return _0x103550(_0x49440a['error'][_0xce25('0xf')]);}else{logger[_0xce25('0x8')](_0xce25('0x9'),_0x4ea75e,_0xce25('0xa'));_0x103550(_0x49440a[_0xce25('0x10')][_0xce25('0xf')]);}})[_0xce25('0x11')](function(_0x401ef5){logger['error'](_0xce25('0x9'),_0x4ea75e,_0x401ef5);_0x1369f7(_0x401ef5);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 1bbc19e..fb4daef 100644 --- a/server/api/userProfileSection/index.js +++ b/server/api/userProfileSection/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd61=['../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4c8454,_0xb9a87c){var _0x419c1d=function(_0x28136e){while(--_0x28136e){_0x4c8454['push'](_0x4c8454['shift']());}};_0x419c1d(++_0xb9a87c);}(_0xdd61,0x19e));var _0x1dd6=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xdd61[_0x4d8ed9];return _0x1e2140;};'use strict';var multer=require(_0x1dd6('0x0'));var util=require(_0x1dd6('0x1'));var path=require(_0x1dd6('0x2'));var timeout=require(_0x1dd6('0x3'));var express=require(_0x1dd6('0x4'));var router=express[_0x1dd6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1dd6('0x6'));var interaction=require(_0x1dd6('0x7'));var config=require('../../config/environment');var controller=require(_0x1dd6('0x8'));router[_0x1dd6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1dd6('0x9')](_0x1dd6('0xa'),auth[_0x1dd6('0xb')](),controller['describe']);router[_0x1dd6('0x9')](_0x1dd6('0xc'),auth['isAuthenticated'](),controller[_0x1dd6('0xd')]);router[_0x1dd6('0xe')]('/',auth[_0x1dd6('0xb')](),controller[_0x1dd6('0xf')]);router[_0x1dd6('0x10')](_0x1dd6('0xc'),auth[_0x1dd6('0xb')](),controller['update']);router[_0x1dd6('0x11')](_0x1dd6('0xc'),auth[_0x1dd6('0xb')](),controller[_0x1dd6('0x12')]);module[_0x1dd6('0x13')]=router; \ No newline at end of file +var _0x1d08=['../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x27528f,_0x410b62){var _0x251a28=function(_0x1c7b68){while(--_0x1c7b68){_0x27528f['push'](_0x27528f['shift']());}};_0x251a28(++_0x410b62);}(_0x1d08,0x169));var _0x81d0=function(_0xe8362,_0x329927){_0xe8362=_0xe8362-0x0;var _0x3bd41d=_0x1d08[_0xe8362];return _0x3bd41d;};'use strict';var multer=require(_0x81d0('0x0'));var util=require(_0x81d0('0x1'));var path=require(_0x81d0('0x2'));var timeout=require(_0x81d0('0x3'));var express=require(_0x81d0('0x4'));var router=express[_0x81d0('0x5')]();var fs_extra=require(_0x81d0('0x6'));var auth=require(_0x81d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x81d0('0x8'));var controller=require(_0x81d0('0x9'));router[_0x81d0('0xa')]('/',auth[_0x81d0('0xb')](),controller[_0x81d0('0xc')]);router[_0x81d0('0xa')](_0x81d0('0xd'),auth[_0x81d0('0xb')](),controller[_0x81d0('0xe')]);router[_0x81d0('0xa')](_0x81d0('0xf'),auth[_0x81d0('0xb')](),controller['show']);router[_0x81d0('0x10')]('/',auth[_0x81d0('0xb')](),controller[_0x81d0('0x11')]);router[_0x81d0('0x12')](_0x81d0('0xf'),auth[_0x81d0('0xb')](),controller[_0x81d0('0x13')]);router[_0x81d0('0x14')](_0x81d0('0xf'),auth[_0x81d0('0xb')](),controller[_0x81d0('0x15')]);module[_0x81d0('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index d220e20..3978806 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa30a=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize[_0xaa30('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaa30('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaa30('0x2')],'set':function(_0x2a9b06){this[_0xaa30('0x5')](_0xaa30('0x6'),_0x2a9b06?_0x2a9b06['join'](''):[]);},'get':function(){return this[_0xaa30('0x7')]('crudPermissions')?this[_0xaa30('0x7')](_0xaa30('0x6'))[_0xaa30('0x8')](''):[];}}}; \ No newline at end of file +var _0xdd4f=['BOOLEAN','STRING','setDataValue','join','getDataValue','crudPermissions','sequelize','INTEGER'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x600524,_0x13a3cb){_0x600524=_0x600524-0x0;var _0xf1eaa0=_0xdd4f[_0x600524];return _0xf1eaa0;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xfdd4('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xfdd4('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xfdd4('0x3')],'set':function(_0x3175f6){this[_0xfdd4('0x4')]('crudPermissions',_0x3175f6?_0x3175f6[_0xfdd4('0x5')](''):[]);},'get':function(){return this[_0xfdd4('0x6')](_0xfdd4('0x7'))?this[_0xfdd4('0x6')](_0xfdd4('0x7'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e1502c8..104ad62 100644 --- a/server/api/userProfileSection/userProfileSection.controller.js +++ b/server/api/userProfileSection/userProfileSection.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd653=['VIRTUAL','merge','options','rows','show','params','includeAll','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','then','destroy','stack','name','send','UserProfileSection','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x221a81,_0x105b12){var _0x2c56b0=function(_0x27f4bc){while(--_0x27f4bc){_0x221a81['push'](_0x221a81['shift']());}};_0x2c56b0(++_0x105b12);}(_0xd653,0x189));var _0x3d65=function(_0x33596c,_0x2f8220){_0x33596c=_0x33596c-0x0;var _0x52e414=_0xd653[_0x33596c];return _0x52e414;};'use strict';var emlformat=require(_0x3d65('0x0'));var rimraf=require(_0x3d65('0x1'));var zipdir=require(_0x3d65('0x2'));var jsonpatch=require(_0x3d65('0x3'));var rp=require(_0x3d65('0x4'));var moment=require(_0x3d65('0x5'));var BPromise=require(_0x3d65('0x6'));var Mustache=require(_0x3d65('0x7'));var util=require(_0x3d65('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d65('0x9'));var fs=require('fs');var fs_extra=require(_0x3d65('0xa'));var _=require(_0x3d65('0xb'));var squel=require(_0x3d65('0xc'));var crypto=require('crypto');var jsforce=require(_0x3d65('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d65('0xe'));var Papa=require('papaparse');var Redis=require(_0x3d65('0xf'));var authService=require(_0x3d65('0x10'));var qs=require(_0x3d65('0x11'));var as=require(_0x3d65('0x12'));var hardwareService=require(_0x3d65('0x13'));var logger=require(_0x3d65('0x14'))(_0x3d65('0x15'));var utils=require(_0x3d65('0x16'));var config=require(_0x3d65('0x17'));var licenseUtil=require(_0x3d65('0x18'));var db=require(_0x3d65('0x19'))['db'];function respondWithStatusCode(_0x4a7f75,_0x3edcd0){_0x3edcd0=_0x3edcd0||0xcc;return function(_0x56e9a6){if(_0x56e9a6){return _0x4a7f75[_0x3d65('0x1a')](_0x3edcd0);}return _0x4a7f75[_0x3d65('0x1b')](_0x3edcd0)[_0x3d65('0x1c')]();};}function respondWithResult(_0x3d4816,_0xe793a6){_0xe793a6=_0xe793a6||0xc8;return function(_0x2151b2){if(_0x2151b2){return _0x3d4816[_0x3d65('0x1b')](_0xe793a6)['json'](_0x2151b2);}};}function respondWithFilteredResult(_0x278e09,_0x2f7fe4){return function(_0x297e62){if(_0x297e62){var _0x1a689d=typeof _0x2f7fe4[_0x3d65('0x1d')]===_0x3d65('0x1e')&&typeof _0x2f7fe4[_0x3d65('0x1f')]==='undefined';var _0x3fd264=_0x297e62[_0x3d65('0x20')];var _0x46157f=_0x1a689d?0x0:_0x2f7fe4[_0x3d65('0x1d')];var _0x187d80=_0x1a689d?_0x297e62[_0x3d65('0x20')]:_0x2f7fe4['offset']+_0x2f7fe4[_0x3d65('0x1f')];var _0x51602e;if(_0x187d80>=_0x3fd264){_0x187d80=_0x3fd264;_0x51602e=0xc8;}else{_0x51602e=0xce;}_0x278e09['status'](_0x51602e);return _0x278e09[_0x3d65('0x21')]('Content-Range',_0x46157f+'-'+_0x187d80+'/'+_0x3fd264)[_0x3d65('0x22')](_0x297e62);}return null;};}function patchUpdates(_0x447375){return function(_0x2ccf15){try{jsonpatch[_0x3d65('0x23')](_0x2ccf15,_0x447375,!![]);}catch(_0x4de78e){return BPromise[_0x3d65('0x24')](_0x4de78e);}return _0x2ccf15['save']();};}function saveUpdates(_0x388cf8,_0x3285f4){return function(_0x2c32f8){if(_0x2c32f8){return _0x2c32f8['update'](_0x388cf8)[_0x3d65('0x25')](function(_0xa0f0ac){return _0xa0f0ac;});}return null;};}function removeEntity(_0x59b357,_0x4e9036){return function(_0x302866){if(_0x302866){return _0x302866[_0x3d65('0x26')]()[_0x3d65('0x25')](function(){_0x59b357['status'](0xcc)[_0x3d65('0x1c')]();});}};}function handleEntityNotFound(_0x351ea8,_0x93c2eb){return function(_0x45c0d5){if(!_0x45c0d5){_0x351ea8[_0x3d65('0x1a')](0x194);}return _0x45c0d5;};}function handleError(_0x31d5e4,_0x1bda5f){_0x1bda5f=_0x1bda5f||0x1f4;return function(_0x5b8413){logger['error'](_0x5b8413[_0x3d65('0x27')]);if(_0x5b8413[_0x3d65('0x28')]){delete _0x5b8413['name'];}_0x31d5e4[_0x3d65('0x1b')](_0x1bda5f)[_0x3d65('0x29')](_0x5b8413);};}exports['index']=function(_0x46fba9,_0x816da2){var _0x22b21a={},_0x4cb2c2={},_0xfc93ee={'count':0x0,'rows':[]};var _0x552bf5=_['map'](db[_0x3d65('0x2a')][_0x3d65('0x2b')],function(_0x4263d1){return{'name':_0x4263d1[_0x3d65('0x2c')],'type':_0x4263d1[_0x3d65('0x2d')][_0x3d65('0x2e')]};});_0x4cb2c2['model']=_[_0x3d65('0x2f')](_0x552bf5,_0x3d65('0x28'));_0x4cb2c2['query']=_[_0x3d65('0x30')](_0x46fba9[_0x3d65('0x31')]);_0x4cb2c2[_0x3d65('0x32')]=_['intersection'](_0x4cb2c2[_0x3d65('0x33')],_0x4cb2c2[_0x3d65('0x31')]);_0x22b21a[_0x3d65('0x34')]=_[_0x3d65('0x35')](_0x4cb2c2[_0x3d65('0x33')],qs[_0x3d65('0x36')](_0x46fba9['query']['fields']));_0x22b21a[_0x3d65('0x34')]=_0x22b21a[_0x3d65('0x34')][_0x3d65('0x37')]?_0x22b21a['attributes']:_0x4cb2c2[_0x3d65('0x33')];if(!_0x46fba9[_0x3d65('0x31')][_0x3d65('0x38')](_0x3d65('0x39'))){_0x22b21a[_0x3d65('0x1f')]=qs[_0x3d65('0x1f')](_0x46fba9[_0x3d65('0x31')]['limit']);_0x22b21a['offset']=qs[_0x3d65('0x1d')](_0x46fba9[_0x3d65('0x31')]['offset']);}_0x22b21a[_0x3d65('0x3a')]=qs[_0x3d65('0x3b')](_0x46fba9[_0x3d65('0x31')][_0x3d65('0x3b')]);_0x22b21a[_0x3d65('0x3c')]=qs['filters'](_[_0x3d65('0x3d')](_0x46fba9[_0x3d65('0x31')],_0x4cb2c2[_0x3d65('0x32')]),_0x552bf5);if(_0x46fba9['query'][_0x3d65('0x3e')]){_0x22b21a['where']=_['merge'](_0x22b21a['where'],{'$or':_[_0x3d65('0x2f')](_0x552bf5,function(_0x2cf98f){if(_0x2cf98f[_0x3d65('0x2d')]!==_0x3d65('0x3f')){var _0x141e7c={};_0x141e7c[_0x2cf98f['name']]={'$like':'%'+_0x46fba9[_0x3d65('0x31')]['filter']+'%'};return _0x141e7c;}})});}_0x22b21a=_[_0x3d65('0x40')]({},_0x22b21a,_0x46fba9[_0x3d65('0x41')]);var _0x327ba1={'where':_0x22b21a[_0x3d65('0x3c')]};return db[_0x3d65('0x2a')][_0x3d65('0x20')](_0x327ba1)[_0x3d65('0x25')](function(_0x1d5443){_0xfc93ee[_0x3d65('0x20')]=_0x1d5443;if(_0x46fba9[_0x3d65('0x31')]['includeAll']){_0x22b21a['include']=[{'all':!![]}];}return db[_0x3d65('0x2a')]['findAll'](_0x22b21a);})['then'](function(_0x567830){_0xfc93ee[_0x3d65('0x42')]=_0x567830;return _0xfc93ee;})[_0x3d65('0x25')](respondWithFilteredResult(_0x816da2,_0x22b21a))['catch'](handleError(_0x816da2,null));};exports[_0x3d65('0x43')]=function(_0x1788ee,_0x52aab8){var _0x5d8a4f={'raw':![],'where':{'id':_0x1788ee[_0x3d65('0x44')]['id']}},_0x57957e={};_0x57957e[_0x3d65('0x33')]=_[_0x3d65('0x30')](db[_0x3d65('0x2a')][_0x3d65('0x2b')]);_0x57957e[_0x3d65('0x31')]=_[_0x3d65('0x30')](_0x1788ee[_0x3d65('0x31')]);_0x57957e['filters']=_['intersection'](_0x57957e[_0x3d65('0x33')],_0x57957e[_0x3d65('0x31')]);_0x5d8a4f[_0x3d65('0x34')]=_[_0x3d65('0x35')](_0x57957e[_0x3d65('0x33')],qs['fields'](_0x1788ee[_0x3d65('0x31')][_0x3d65('0x36')]));_0x5d8a4f[_0x3d65('0x34')]=_0x5d8a4f[_0x3d65('0x34')][_0x3d65('0x37')]?_0x5d8a4f['attributes']:_0x57957e['model'];if(_0x1788ee['query'][_0x3d65('0x45')]){_0x5d8a4f[_0x3d65('0x46')]=[{'all':!![]}];}_0x5d8a4f=_[_0x3d65('0x40')]({},_0x5d8a4f,_0x1788ee[_0x3d65('0x41')]);return db[_0x3d65('0x2a')][_0x3d65('0x47')](_0x5d8a4f)[_0x3d65('0x25')](handleEntityNotFound(_0x52aab8,null))[_0x3d65('0x25')](respondWithResult(_0x52aab8,null))[_0x3d65('0x48')](handleError(_0x52aab8,null));};exports['create']=function(_0x27a69f,_0x824d1f){return db[_0x3d65('0x2a')][_0x3d65('0x49')](_0x27a69f[_0x3d65('0x4a')],{})[_0x3d65('0x25')](respondWithResult(_0x824d1f,0xc9))[_0x3d65('0x48')](handleError(_0x824d1f,null));};exports['update']=function(_0x4a9cfd,_0x4fb6b5){if(_0x4a9cfd[_0x3d65('0x4a')]['id']){delete _0x4a9cfd[_0x3d65('0x4a')]['id'];}return db[_0x3d65('0x2a')][_0x3d65('0x47')]({'where':{'id':_0x4a9cfd[_0x3d65('0x44')]['id']}})['then'](handleEntityNotFound(_0x4fb6b5,null))[_0x3d65('0x25')](saveUpdates(_0x4a9cfd['body'],null))[_0x3d65('0x25')](respondWithResult(_0x4fb6b5,null))[_0x3d65('0x48')](handleError(_0x4fb6b5,null));};exports[_0x3d65('0x26')]=function(_0x282c2c,_0x4e9802){return db[_0x3d65('0x2a')][_0x3d65('0x47')]({'where':{'id':_0x282c2c[_0x3d65('0x44')]['id']}})[_0x3d65('0x25')](handleEntityNotFound(_0x4e9802,null))[_0x3d65('0x25')](removeEntity(_0x4e9802,null))[_0x3d65('0x48')](handleError(_0x4e9802,null));};exports[_0x3d65('0x4b')]=function(_0x2a673e,_0x2f3a7e){return db[_0x3d65('0x2a')][_0x3d65('0x4b')]()[_0x3d65('0x25')](respondWithResult(_0x2f3a7e,null))[_0x3d65('0x48')](handleError(_0x2f3a7e,null));}; \ No newline at end of file +var _0x883d=['rows','catch','show','params','includeAll','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','then','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll'];(function(_0x119819,_0x43a767){var _0x29d63b=function(_0x1ff9ce){while(--_0x1ff9ce){_0x119819['push'](_0x119819['shift']());}};_0x29d63b(++_0x43a767);}(_0x883d,0x16e));var _0xd883=function(_0xfa50a7,_0x4f0592){_0xfa50a7=_0xfa50a7-0x0;var _0x1232ce=_0x883d[_0xfa50a7];return _0x1232ce;};'use strict';var emlformat=require(_0xd883('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd883('0x1'));var jsonpatch=require(_0xd883('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd883('0x3'));var util=require(_0xd883('0x4'));var path=require(_0xd883('0x5'));var sox=require(_0xd883('0x6'));var csv=require('to-csv');var ejs=require(_0xd883('0x7'));var fs=require('fs');var fs_extra=require(_0xd883('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd883('0x9'));var jsforce=require(_0xd883('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd883('0xb'));var querystring=require('querystring');var Papa=require(_0xd883('0xc'));var Redis=require(_0xd883('0xd'));var authService=require(_0xd883('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd883('0xf'));var hardwareService=require(_0xd883('0x10'));var logger=require(_0xd883('0x11'))('api');var utils=require(_0xd883('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd883('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ed95d,_0x24d56b){_0x24d56b=_0x24d56b||0xcc;return function(_0x3a3598){if(_0x3a3598){return _0x3ed95d[_0xd883('0x14')](_0x24d56b);}return _0x3ed95d[_0xd883('0x15')](_0x24d56b)[_0xd883('0x16')]();};}function respondWithResult(_0x29b77b,_0x371535){_0x371535=_0x371535||0xc8;return function(_0x51b7a7){if(_0x51b7a7){return _0x29b77b[_0xd883('0x15')](_0x371535)['json'](_0x51b7a7);}};}function respondWithFilteredResult(_0x261fd2,_0x48e9d9){return function(_0x56b648){if(_0x56b648){var _0x4d14cb=typeof _0x48e9d9[_0xd883('0x17')]===_0xd883('0x18')&&typeof _0x48e9d9[_0xd883('0x19')]==='undefined';var _0x476393=_0x56b648[_0xd883('0x1a')];var _0x26697d=_0x4d14cb?0x0:_0x48e9d9['offset'];var _0x5ed10a=_0x4d14cb?_0x56b648[_0xd883('0x1a')]:_0x48e9d9[_0xd883('0x17')]+_0x48e9d9[_0xd883('0x19')];var _0x3c9ec7;if(_0x5ed10a>=_0x476393){_0x5ed10a=_0x476393;_0x3c9ec7=0xc8;}else{_0x3c9ec7=0xce;}_0x261fd2[_0xd883('0x15')](_0x3c9ec7);return _0x261fd2['set'](_0xd883('0x1b'),_0x26697d+'-'+_0x5ed10a+'/'+_0x476393)['json'](_0x56b648);}return null;};}function patchUpdates(_0x502869){return function(_0x49d514){try{jsonpatch[_0xd883('0x1c')](_0x49d514,_0x502869,!![]);}catch(_0x295705){return BPromise['reject'](_0x295705);}return _0x49d514[_0xd883('0x1d')]();};}function saveUpdates(_0x1a37d6,_0x81188f){return function(_0x1eb8cf){if(_0x1eb8cf){return _0x1eb8cf['update'](_0x1a37d6)[_0xd883('0x1e')](function(_0x332651){return _0x332651;});}return null;};}function removeEntity(_0xf4b7e9,_0x1fe785){return function(_0x419e4a){if(_0x419e4a){return _0x419e4a['destroy']()[_0xd883('0x1e')](function(){_0xf4b7e9[_0xd883('0x15')](0xcc)[_0xd883('0x16')]();});}};}function handleEntityNotFound(_0x45897a,_0x59ae4e){return function(_0x3ff360){if(!_0x3ff360){_0x45897a['sendStatus'](0x194);}return _0x3ff360;};}function handleError(_0x55d977,_0x4b2c8a){_0x4b2c8a=_0x4b2c8a||0x1f4;return function(_0x21da5e){logger[_0xd883('0x1f')](_0x21da5e[_0xd883('0x20')]);if(_0x21da5e['name']){delete _0x21da5e[_0xd883('0x21')];}_0x55d977[_0xd883('0x15')](_0x4b2c8a)[_0xd883('0x22')](_0x21da5e);};}exports['index']=function(_0x22be37,_0x28c201){var _0x5a35cf={},_0x1b5862={},_0x54c67f={'count':0x0,'rows':[]};var _0x214d51=_[_0xd883('0x23')](db[_0xd883('0x24')][_0xd883('0x25')],function(_0x37e877){return{'name':_0x37e877[_0xd883('0x26')],'type':_0x37e877[_0xd883('0x27')]['key']};});_0x1b5862[_0xd883('0x28')]=_['map'](_0x214d51,_0xd883('0x21'));_0x1b5862['query']=_[_0xd883('0x29')](_0x22be37[_0xd883('0x2a')]);_0x1b5862[_0xd883('0x2b')]=_[_0xd883('0x2c')](_0x1b5862[_0xd883('0x28')],_0x1b5862[_0xd883('0x2a')]);_0x5a35cf[_0xd883('0x2d')]=_['intersection'](_0x1b5862[_0xd883('0x28')],qs[_0xd883('0x2e')](_0x22be37[_0xd883('0x2a')]['fields']));_0x5a35cf[_0xd883('0x2d')]=_0x5a35cf[_0xd883('0x2d')][_0xd883('0x2f')]?_0x5a35cf[_0xd883('0x2d')]:_0x1b5862[_0xd883('0x28')];if(!_0x22be37[_0xd883('0x2a')][_0xd883('0x30')](_0xd883('0x31'))){_0x5a35cf[_0xd883('0x19')]=qs[_0xd883('0x19')](_0x22be37[_0xd883('0x2a')][_0xd883('0x19')]);_0x5a35cf[_0xd883('0x17')]=qs['offset'](_0x22be37['query'][_0xd883('0x17')]);}_0x5a35cf[_0xd883('0x32')]=qs[_0xd883('0x33')](_0x22be37[_0xd883('0x2a')][_0xd883('0x33')]);_0x5a35cf[_0xd883('0x34')]=qs[_0xd883('0x2b')](_[_0xd883('0x35')](_0x22be37[_0xd883('0x2a')],_0x1b5862['filters']),_0x214d51);if(_0x22be37[_0xd883('0x2a')]['filter']){_0x5a35cf['where']=_['merge'](_0x5a35cf[_0xd883('0x34')],{'$or':_['map'](_0x214d51,function(_0x429434){if(_0x429434[_0xd883('0x27')]!==_0xd883('0x36')){var _0x5da2f3={};_0x5da2f3[_0x429434[_0xd883('0x21')]]={'$like':'%'+_0x22be37['query'][_0xd883('0x37')]+'%'};return _0x5da2f3;}})});}_0x5a35cf=_[_0xd883('0x38')]({},_0x5a35cf,_0x22be37[_0xd883('0x39')]);var _0x3754fe={'where':_0x5a35cf[_0xd883('0x34')]};return db[_0xd883('0x24')][_0xd883('0x1a')](_0x3754fe)[_0xd883('0x1e')](function(_0x5cb1cf){_0x54c67f['count']=_0x5cb1cf;if(_0x22be37['query']['includeAll']){_0x5a35cf[_0xd883('0x3a')]=[{'all':!![]}];}return db['UserProfileSection'][_0xd883('0x3b')](_0x5a35cf);})[_0xd883('0x1e')](function(_0x1986ea){_0x54c67f[_0xd883('0x3c')]=_0x1986ea;return _0x54c67f;})['then'](respondWithFilteredResult(_0x28c201,_0x5a35cf))[_0xd883('0x3d')](handleError(_0x28c201,null));};exports[_0xd883('0x3e')]=function(_0xb72272,_0x2497b7){var _0x511ac4={'raw':![],'where':{'id':_0xb72272[_0xd883('0x3f')]['id']}},_0x51ad77={};_0x51ad77['model']=_[_0xd883('0x29')](db['UserProfileSection'][_0xd883('0x25')]);_0x51ad77[_0xd883('0x2a')]=_[_0xd883('0x29')](_0xb72272[_0xd883('0x2a')]);_0x51ad77[_0xd883('0x2b')]=_['intersection'](_0x51ad77[_0xd883('0x28')],_0x51ad77[_0xd883('0x2a')]);_0x511ac4[_0xd883('0x2d')]=_[_0xd883('0x2c')](_0x51ad77['model'],qs[_0xd883('0x2e')](_0xb72272['query'][_0xd883('0x2e')]));_0x511ac4['attributes']=_0x511ac4[_0xd883('0x2d')][_0xd883('0x2f')]?_0x511ac4[_0xd883('0x2d')]:_0x51ad77[_0xd883('0x28')];if(_0xb72272['query'][_0xd883('0x40')]){_0x511ac4[_0xd883('0x3a')]=[{'all':!![]}];}_0x511ac4=_['merge']({},_0x511ac4,_0xb72272[_0xd883('0x39')]);return db[_0xd883('0x24')][_0xd883('0x41')](_0x511ac4)['then'](handleEntityNotFound(_0x2497b7,null))[_0xd883('0x1e')](respondWithResult(_0x2497b7,null))[_0xd883('0x3d')](handleError(_0x2497b7,null));};exports[_0xd883('0x42')]=function(_0x538d21,_0x1db81f){return db[_0xd883('0x24')]['create'](_0x538d21[_0xd883('0x43')],{})['then'](respondWithResult(_0x1db81f,0xc9))['catch'](handleError(_0x1db81f,null));};exports[_0xd883('0x44')]=function(_0x302abd,_0x15db89){if(_0x302abd[_0xd883('0x43')]['id']){delete _0x302abd['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x302abd[_0xd883('0x3f')]['id']}})['then'](handleEntityNotFound(_0x15db89,null))[_0xd883('0x1e')](saveUpdates(_0x302abd['body'],null))[_0xd883('0x1e')](respondWithResult(_0x15db89,null))[_0xd883('0x3d')](handleError(_0x15db89,null));};exports[_0xd883('0x45')]=function(_0x1640db,_0x40b9f0){return db['UserProfileSection']['find']({'where':{'id':_0x1640db[_0xd883('0x3f')]['id']}})[_0xd883('0x1e')](handleEntityNotFound(_0x40b9f0,null))[_0xd883('0x1e')](removeEntity(_0x40b9f0,null))[_0xd883('0x3d')](handleError(_0x40b9f0,null));};exports[_0xd883('0x46')]=function(_0x795787,_0x54f70c){return db[_0xd883('0x24')][_0xd883('0x46')]()['then'](respondWithResult(_0x54f70c,null))[_0xd883('0x3d')](handleError(_0x54f70c,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index b3fa5e9..8fad277 100644 --- a/server/api/userProfileSection/userProfileSection.model.js +++ b/server/api/userProfileSection/userProfileSection.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde58=['exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','util','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x5c1f24,_0x28f72b){var _0x2f0a7d=function(_0x49671a){while(--_0x49671a){_0x5c1f24['push'](_0x5c1f24['shift']());}};_0x2f0a7d(++_0x28f72b);}(_0xde58,0x17a));var _0x8de5=function(_0x5e969f,_0x4193e4){_0x5e969f=_0x5e969f-0x0;var _0x3dd853=_0xde58[_0x5e969f];return _0x3dd853;};'use strict';var _=require('lodash');var util=require(_0x8de5('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8de5('0x1'));var rp=require(_0x8de5('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8de5('0x3'));var config=require(_0x8de5('0x4'));var attributes=require(_0x8de5('0x5'));module[_0x8de5('0x6')]=function(_0x22ecdd,_0x34ef9b){return _0x22ecdd[_0x8de5('0x7')](_0x8de5('0x8'),attributes,{'tableName':_0x8de5('0x9'),'paranoid':![],'indexes':[{'name':_0x8de5('0xa'),'fields':['sectionId',_0x8de5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xada7=['util','../../config/logger','moment','path','rimraf','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x56e423,_0x98016e){var _0x331ddb=function(_0x131190){while(--_0x131190){_0x56e423['push'](_0x56e423['shift']());}};_0x331ddb(++_0x98016e);}(_0xada7,0x113));var _0x7ada=function(_0x981022,_0x179a8a){_0x981022=_0x981022-0x0;var _0x656cd3=_0xada7[_0x981022];return _0x656cd3;};'use strict';var _=require(_0x7ada('0x0'));var util=require(_0x7ada('0x1'));var logger=require(_0x7ada('0x2'))('api');var moment=require(_0x7ada('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ada('0x4'));var rimraf=require(_0x7ada('0x5'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x7ada('0x6')]=function(_0x4437ec,_0x178be6){return _0x4437ec['define'](_0x7ada('0x7'),attributes,{'tableName':_0x7ada('0x8'),'paranoid':![],'indexes':[{'name':_0x7ada('0x9'),'fields':[_0x7ada('0xa'),_0x7ada('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 3e95f2b..53cde1e 100644 --- a/server/api/userProfileSection/userProfileSection.rpc.js +++ b/server/api/userProfileSection/userProfileSection.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4afa=['request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','UserProfileSection,\x20%s,\x20%s'];(function(_0x36d55b,_0x4c67b5){var _0x1991c9=function(_0x5d0663){while(--_0x5d0663){_0x36d55b['push'](_0x36d55b['shift']());}};_0x1991c9(++_0x4c67b5);}(_0x4afa,0x10c));var _0xa4af=function(_0x195043,_0x3b6b55){_0x195043=_0x195043-0x0;var _0x363f60=_0x4afa[_0x195043];return _0x363f60;};'use strict';var _=require('lodash');var util=require(_0xa4af('0x0'));var moment=require(_0xa4af('0x1'));var BPromise=require('bluebird');var rs=require(_0xa4af('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4af('0x3'))['db'];var utils=require(_0xa4af('0x4'));var logger=require(_0xa4af('0x5'))(_0xa4af('0x6'));var config=require('../../config/environment');var jayson=require(_0xa4af('0x7'));var client=jayson['client'][_0xa4af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe8a88a,_0x52290c,_0x4e597d){return new BPromise(function(_0x535dc3,_0x174fb3){return client[_0xa4af('0x9')](_0xe8a88a,_0x4e597d)['then'](function(_0x1ca80a){logger[_0xa4af('0xa')](_0xa4af('0xb'),_0x52290c,_0xa4af('0xc'));logger[_0xa4af('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x52290c,'request\x20sent',JSON[_0xa4af('0xe')](_0x1ca80a));if(_0x1ca80a['error']){if(_0x1ca80a[_0xa4af('0xf')][_0xa4af('0x10')]===0x1f4){logger['error'](_0xa4af('0xb'),_0x52290c,_0x1ca80a[_0xa4af('0xf')][_0xa4af('0x11')]);return _0x174fb3(_0x1ca80a[_0xa4af('0xf')]['message']);}logger[_0xa4af('0xf')](_0xa4af('0xb'),_0x52290c,_0x1ca80a[_0xa4af('0xf')][_0xa4af('0x11')]);return _0x535dc3(_0x1ca80a[_0xa4af('0xf')][_0xa4af('0x11')]);}else{logger[_0xa4af('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x52290c,'request\x20sent');_0x535dc3(_0x1ca80a[_0xa4af('0x12')][_0xa4af('0x11')]);}})[_0xa4af('0x13')](function(_0x3949fe){logger[_0xa4af('0xf')](_0xa4af('0xb'),_0x52290c,_0x3949fe);_0x174fb3(_0x3949fe);});});} \ No newline at end of file +var _0x9fe7=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0xb431f3,_0x34c34d){var _0x109106=function(_0x5a9d38){while(--_0x5a9d38){_0xb431f3['push'](_0xb431f3['shift']());}};_0x109106(++_0x34c34d);}(_0x9fe7,0x1df));var _0x79fe=function(_0x60afad,_0x2ce66a){_0x60afad=_0x60afad-0x0;var _0x377df9=_0x9fe7[_0x60afad];return _0x377df9;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var moment=require('moment');var BPromise=require(_0x79fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79fe('0x3'));var db=require(_0x79fe('0x4'))['db'];var utils=require(_0x79fe('0x5'));var logger=require('../../config/logger')(_0x79fe('0x6'));var config=require(_0x79fe('0x7'));var jayson=require(_0x79fe('0x8'));var client=jayson['client'][_0x79fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a5aef,_0x2ba246,_0x4c8314){return new BPromise(function(_0x24faa0,_0x264323){return client[_0x79fe('0xa')](_0x2a5aef,_0x4c8314)[_0x79fe('0xb')](function(_0xafc7cd){logger['info'](_0x79fe('0xc'),_0x2ba246,_0x79fe('0xd'));logger['debug'](_0x79fe('0xe'),_0x2ba246,_0x79fe('0xd'),JSON[_0x79fe('0xf')](_0xafc7cd));if(_0xafc7cd[_0x79fe('0x10')]){if(_0xafc7cd['error'][_0x79fe('0x11')]===0x1f4){logger[_0x79fe('0x10')](_0x79fe('0xc'),_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x264323(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}logger[_0x79fe('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x24faa0(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}else{logger[_0x79fe('0x13')](_0x79fe('0xc'),_0x2ba246,'request\x20sent');_0x24faa0(_0xafc7cd[_0x79fe('0x14')][_0x79fe('0x12')]);}})[_0x79fe('0x15')](function(_0x5f0af3){logger['error'](_0x79fe('0xc'),_0x2ba246,_0x5f0af3);_0x264323(_0x5f0af3);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 6d84659..84352f4 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x248dc8,_0x10c027){var _0x15aaee=function(_0xa53979){while(--_0xa53979){_0x248dc8['push'](_0x248dc8['shift']());}};_0x15aaee(++_0x10c027);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x39088f,_0x26f71b){var _0x435bfa=function(_0x4b0c61){while(--_0x4b0c61){_0x39088f['push'](_0x39088f['shift']());}};_0x435bfa(++_0x26f71b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xcb91[_0x5951e8];return _0x20a1f5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index df5ec91..f8b62bf 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79d6=['exports','INTEGER'];(function(_0x1a2d1d,_0x3eb28d){var _0x3b99bd=function(_0x1fe780){while(--_0x1fe780){_0x1a2d1d['push'](_0x1a2d1d['shift']());}};_0x3b99bd(++_0x3eb28d);}(_0x79d6,0x166));var _0x679d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x79d6[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0x679d('0x0')]={'penalty':{'type':Sequelize[_0x679d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbc44=['INTEGER','exports'];(function(_0x9eadf8,_0x5d2d9e){var _0x5ce5eb=function(_0xe965c7){while(--_0xe965c7){_0x9eadf8['push'](_0x9eadf8['shift']());}};_0x5ce5eb(++_0x5d2d9e);}(_0xbc44,0xff));var _0x4bc4=function(_0x2abc0c,_0x129d2e){_0x2abc0c=_0x2abc0c-0x0;var _0x4c3e8b=_0xbc44[_0x2abc0c];return _0x4c3e8b;};'use strict';var Sequelize=require('sequelize');module[_0x4bc4('0x0')]={'penalty':{'type':Sequelize[_0x4bc4('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index fb5fd63..24ece22 100644 --- a/server/api/userSmsQueue/userSmsQueue.model.js +++ b/server/api/userSmsQueue/userSmsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f4=['./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32f4,0x154));var _0x432f=function(_0x5bf308,_0x3c8f19){_0x5bf308=_0x5bf308-0x0;var _0x3c793f=_0x32f4[_0x5bf308];return _0x3c793f;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));module[_0x432f('0x9')]=function(_0x2f5f03,_0x5d8cc0){return _0x2f5f03['define'](_0x432f('0xa'),attributes,{'tableName':_0x432f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2675=['lodash','moment','bluebird','path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x5c3d11,_0x589686){var _0x31e455=function(_0x251512){while(--_0x251512){_0x5c3d11['push'](_0x5c3d11['shift']());}};_0x31e455(++_0x589686);}(_0x2675,0x75));var _0x5267=function(_0x40cd6b,_0x58926b){_0x40cd6b=_0x40cd6b-0x0;var _0x5cc670=_0x2675[_0x40cd6b];return _0x5cc670;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index fbbd477..313cf3e 100644 --- a/server/api/userSmsQueue/userSmsQueue.rpc.js +++ b/server/api/userSmsQueue/userSmsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80f3=['http','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UserSmsQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x80f3,0x6f));var _0x380f=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0x80f3[_0x1034ca];return _0x1a023a;};'use strict';var _=require(_0x380f('0x0'));var util=require(_0x380f('0x1'));var moment=require(_0x380f('0x2'));var BPromise=require(_0x380f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x380f('0x4'))['db'];var utils=require(_0x380f('0x5'));var logger=require('../../config/logger')(_0x380f('0x6'));var config=require('../../config/environment');var jayson=require(_0x380f('0x7'));var client=jayson[_0x380f('0x8')][_0x380f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d158a,_0x44e210,_0x360814){return new BPromise(function(_0x2b66ab,_0x5544b2){return client['request'](_0x3d158a,_0x360814)['then'](function(_0x4a1b7a){logger[_0x380f('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x44e210,'request\x20sent');logger[_0x380f('0xb')](_0x380f('0xc'),_0x44e210,_0x380f('0xd'),JSON['stringify'](_0x4a1b7a));if(_0x4a1b7a[_0x380f('0xe')]){if(_0x4a1b7a[_0x380f('0xe')][_0x380f('0xf')]===0x1f4){logger[_0x380f('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x44e210,_0x4a1b7a[_0x380f('0xe')][_0x380f('0x10')]);return _0x5544b2(_0x4a1b7a[_0x380f('0xe')][_0x380f('0x10')]);}logger['error'](_0x380f('0x11'),_0x44e210,_0x4a1b7a[_0x380f('0xe')][_0x380f('0x10')]);return _0x2b66ab(_0x4a1b7a[_0x380f('0xe')][_0x380f('0x10')]);}else{logger[_0x380f('0xa')](_0x380f('0x11'),_0x44e210,_0x380f('0xd'));_0x2b66ab(_0x4a1b7a[_0x380f('0x12')][_0x380f('0x10')]);}})[_0x380f('0x13')](function(_0x3f5b1a){logger[_0x380f('0xe')](_0x380f('0x11'),_0x44e210,_0x3f5b1a);_0x5544b2(_0x3f5b1a);});});} \ No newline at end of file +var _0xf834=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x1ef2e3,_0x380ec2){var _0x173e11=function(_0x574cb9){while(--_0x574cb9){_0x1ef2e3['push'](_0x1ef2e3['shift']());}};_0x173e11(++_0x380ec2);}(_0xf834,0xf0));var _0x4f83=function(_0x1fb597,_0x10e8b2){_0x1fb597=_0x1fb597-0x0;var _0x51d6b4=_0xf834[_0x1fb597];return _0x51d6b4;};'use strict';var _=require(_0x4f83('0x0'));var util=require(_0x4f83('0x1'));var moment=require(_0x4f83('0x2'));var BPromise=require(_0x4f83('0x3'));var rs=require(_0x4f83('0x4'));var fs=require('fs');var Redis=require(_0x4f83('0x5'));var db=require(_0x4f83('0x6'))['db'];var utils=require(_0x4f83('0x7'));var logger=require(_0x4f83('0x8'))('rpc');var config=require(_0x4f83('0x9'));var jayson=require(_0x4f83('0xa'));var client=jayson['client'][_0x4f83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17b53a,_0x580ac0,_0x2bd7e9){return new BPromise(function(_0x4e34e6,_0x255f32){return client['request'](_0x17b53a,_0x2bd7e9)['then'](function(_0x162cb0){logger[_0x4f83('0xc')](_0x4f83('0xd'),_0x580ac0,_0x4f83('0xe'));logger[_0x4f83('0xf')](_0x4f83('0x10'),_0x580ac0,_0x4f83('0xe'),JSON['stringify'](_0x162cb0));if(_0x162cb0[_0x4f83('0x11')]){if(_0x162cb0['error'][_0x4f83('0x12')]===0x1f4){logger[_0x4f83('0x11')](_0x4f83('0xd'),_0x580ac0,_0x162cb0[_0x4f83('0x11')][_0x4f83('0x13')]);return _0x255f32(_0x162cb0['error'][_0x4f83('0x13')]);}logger[_0x4f83('0x11')](_0x4f83('0xd'),_0x580ac0,_0x162cb0['error']['message']);return _0x4e34e6(_0x162cb0[_0x4f83('0x11')]['message']);}else{logger[_0x4f83('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x580ac0,_0x4f83('0xe'));_0x4e34e6(_0x162cb0[_0x4f83('0x14')][_0x4f83('0x13')]);}})[_0x4f83('0x15')](function(_0x15652d){logger[_0x4f83('0x11')](_0x4f83('0xd'),_0x580ac0,_0x15652d);_0x255f32(_0x15652d);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 20f15df..d9f9fe9 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf998=['INTEGER','sequelize','exports'];(function(_0x4d3317,_0x2d0512){var _0x226075=function(_0x298ab8){while(--_0x298ab8){_0x4d3317['push'](_0x4d3317['shift']());}};_0x226075(++_0x2d0512);}(_0xf998,0x8b));var _0x8f99=function(_0x3dfed5,_0x2d800a){_0x3dfed5=_0x3dfed5-0x0;var _0x1266f0=_0xf998[_0x3dfed5];return _0x1266f0;};'use strict';var Sequelize=require(_0x8f99('0x0'));module[_0x8f99('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x8f99('0x2')]}}; \ No newline at end of file +var _0xe337=['exports','INTEGER','sequelize'];(function(_0x4bfbc9,_0x30d326){var _0x1ab925=function(_0x27ada0){while(--_0x27ada0){_0x4bfbc9['push'](_0x4bfbc9['shift']());}};_0x1ab925(++_0x30d326);}(_0xe337,0x191));var _0x7e33=function(_0x2187b0,_0x10504c){_0x2187b0=_0x2187b0-0x0;var _0x341dc1=_0xe337[_0x2187b0];return _0x341dc1;};'use strict';var Sequelize=require(_0x7e33('0x0'));module[_0x7e33('0x1')]={'UserId':{'type':Sequelize[_0x7e33('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x7e33('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 875d682..296bf9f 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x322841,_0x47fb32){var _0x160e9f=function(_0x258cca){while(--_0x258cca){_0x322841['push'](_0x322841['shift']());}};_0x160e9f(++_0x47fb32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x519b38,_0x57511b){var _0x47a0f9=function(_0x375bae){while(--_0x375bae){_0x519b38['push'](_0x519b38['shift']());}};_0x47a0f9(++_0x57511b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 378d38a..d5f740d 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x28be47,_0x57cb57){var _0x184958=function(_0x21186d){while(--_0x21186d){_0x28be47['push'](_0x28be47['shift']());}};_0x184958(++_0x57cb57);}(_0x70e0,0x17b));var _0x070e=function(_0x41c402,_0x346478){_0x41c402=_0x41c402-0x0;var _0x18026a=_0x70e0[_0x41c402];return _0x18026a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2f8125,_0x260435){var _0x332dfb=function(_0x12a258){while(--_0x12a258){_0x2f8125['push'](_0x2f8125['shift']());}};_0x332dfb(++_0x260435);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f4972e4..8e7946d 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb769=['sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb769,0x19e));var _0x9b76=function(_0xda79e3,_0x351641){_0xda79e3=_0xda79e3-0x0;var _0x4ab308=_0xb769[_0xda79e3];return _0x4ab308;};'use strict';var Sequelize=require(_0x9b76('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9b76('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x482d=['INTEGER'];(function(_0x316aa0,_0x477bd2){var _0x7bcb5b=function(_0x1670c9){while(--_0x1670c9){_0x316aa0['push'](_0x316aa0['shift']());}};_0x7bcb5b(++_0x477bd2);}(_0x482d,0x16c));var _0xd482=function(_0x21593d,_0x3cd744){_0x21593d=_0x21593d-0x0;var _0x16e575=_0x482d[_0x21593d];return _0x16e575;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xd482('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 65b58fa..fc5da3e 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.model.js +++ b/server/api/userVoiceQueue/userVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ee5=['moment','request-promise','path','../../config/environment','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x1390ce,_0x22b70a){var _0x16e493=function(_0x589def){while(--_0x589def){_0x1390ce['push'](_0x1390ce['shift']());}};_0x16e493(++_0x22b70a);}(_0x5ee5,0x15c));var _0x55ee=function(_0x24c15a,_0x261c48){_0x24c15a=_0x24c15a-0x0;var _0x2a3137=_0x5ee5[_0x24c15a];return _0x2a3137;};'use strict';var _=require(_0x55ee('0x0'));var util=require(_0x55ee('0x1'));var logger=require(_0x55ee('0x2'))(_0x55ee('0x3'));var moment=require(_0x55ee('0x4'));var BPromise=require('bluebird');var rp=require(_0x55ee('0x5'));var fs=require('fs');var path=require(_0x55ee('0x6'));var rimraf=require('rimraf');var config=require(_0x55ee('0x7'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x2cd72b,_0x266e84){return _0x2cd72b[_0x55ee('0x8')](_0x55ee('0x9'),attributes,{'tableName':_0x55ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x813f=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x14275a,_0x48f0e){var _0x204c6d=function(_0x4d3a9d){while(--_0x4d3a9d){_0x14275a['push'](_0x14275a['shift']());}};_0x204c6d(++_0x48f0e);}(_0x813f,0xcf));var _0xf813=function(_0x169e7c,_0x525175){_0x169e7c=_0x169e7c-0x0;var _0x38dba0=_0x813f[_0x169e7c];return _0x38dba0;};'use strict';var _=require(_0xf813('0x0'));var util=require(_0xf813('0x1'));var logger=require(_0xf813('0x2'))(_0xf813('0x3'));var moment=require(_0xf813('0x4'));var BPromise=require(_0xf813('0x5'));var rp=require(_0xf813('0x6'));var fs=require('fs');var path=require(_0xf813('0x7'));var rimraf=require('rimraf');var config=require(_0xf813('0x8'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x244e5d,_0x357e87){return _0x244e5d[_0xf813('0x9')](_0xf813('0xa'),attributes,{'tableName':_0xf813('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 2a1a235..65c6de7 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.rpc.js +++ b/server/api/userVoiceQueue/userVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5394=['http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x315777,_0x4fe608){var _0x57c651=function(_0x417a9d){while(--_0x417a9d){_0x315777['push'](_0x315777['shift']());}};_0x57c651(++_0x4fe608);}(_0x5394,0x1d9));var _0x4539=function(_0x3f5395,_0x5189ef){_0x3f5395=_0x3f5395-0x0;var _0x1bb11e=_0x5394[_0x3f5395];return _0x1bb11e;};'use strict';var _=require('lodash');var util=require(_0x4539('0x0'));var moment=require(_0x4539('0x1'));var BPromise=require(_0x4539('0x2'));var rs=require(_0x4539('0x3'));var fs=require('fs');var Redis=require(_0x4539('0x4'));var db=require(_0x4539('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4539('0x6'))(_0x4539('0x7'));var config=require('../../config/environment');var jayson=require(_0x4539('0x8'));var client=jayson[_0x4539('0x9')][_0x4539('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2efdf7,_0x5a10c0,_0x5e8955){return new BPromise(function(_0xbff8e3,_0x49544e){return client[_0x4539('0xb')](_0x2efdf7,_0x5e8955)[_0x4539('0xc')](function(_0x9a9657){logger['info'](_0x4539('0xd'),_0x5a10c0,_0x4539('0xe'));logger[_0x4539('0xf')](_0x4539('0x10'),_0x5a10c0,_0x4539('0xe'),JSON[_0x4539('0x11')](_0x9a9657));if(_0x9a9657['error']){if(_0x9a9657[_0x4539('0x12')]['code']===0x1f4){logger[_0x4539('0x12')](_0x4539('0xd'),_0x5a10c0,_0x9a9657[_0x4539('0x12')][_0x4539('0x13')]);return _0x49544e(_0x9a9657['error']['message']);}logger[_0x4539('0x12')](_0x4539('0xd'),_0x5a10c0,_0x9a9657[_0x4539('0x12')]['message']);return _0xbff8e3(_0x9a9657[_0x4539('0x12')]['message']);}else{logger[_0x4539('0x14')](_0x4539('0xd'),_0x5a10c0,'request\x20sent');_0xbff8e3(_0x9a9657[_0x4539('0x15')][_0x4539('0x13')]);}})[_0x4539('0x16')](function(_0x22d4f4){logger[_0x4539('0x12')](_0x4539('0xd'),_0x5a10c0,_0x22d4f4);_0x49544e(_0x22d4f4);});});} \ No newline at end of file +var _0x4f69=['error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x4f69,0x1be));var _0x94f6=function(_0x30a457,_0x2aa6b5){_0x30a457=_0x30a457-0x0;var _0x2ae5cd=_0x4f69[_0x30a457];return _0x2ae5cd;};'use strict';var _=require(_0x94f6('0x0'));var util=require(_0x94f6('0x1'));var moment=require('moment');var BPromise=require(_0x94f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94f6('0x3'))['db'];var utils=require(_0x94f6('0x4'));var logger=require(_0x94f6('0x5'))(_0x94f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x94f6('0x7'));var client=jayson[_0x94f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d646a,_0x5c3de8,_0x5535fa){return new BPromise(function(_0x2ea3b6,_0x4bf63a){return client[_0x94f6('0x9')](_0x2d646a,_0x5535fa)['then'](function(_0x51543d){logger[_0x94f6('0xa')](_0x94f6('0xb'),_0x5c3de8,_0x94f6('0xc'));logger[_0x94f6('0xd')](_0x94f6('0xe'),_0x5c3de8,'request\x20sent',JSON[_0x94f6('0xf')](_0x51543d));if(_0x51543d[_0x94f6('0x10')]){if(_0x51543d[_0x94f6('0x10')][_0x94f6('0x11')]===0x1f4){logger[_0x94f6('0x10')](_0x94f6('0xb'),_0x5c3de8,_0x51543d[_0x94f6('0x10')][_0x94f6('0x12')]);return _0x4bf63a(_0x51543d[_0x94f6('0x10')][_0x94f6('0x12')]);}logger[_0x94f6('0x10')](_0x94f6('0xb'),_0x5c3de8,_0x51543d[_0x94f6('0x10')][_0x94f6('0x12')]);return _0x2ea3b6(_0x51543d[_0x94f6('0x10')][_0x94f6('0x12')]);}else{logger[_0x94f6('0xa')](_0x94f6('0xb'),_0x5c3de8,_0x94f6('0xc'));_0x2ea3b6(_0x51543d[_0x94f6('0x13')][_0x94f6('0x12')]);}})[_0x94f6('0x14')](function(_0x3735d3){logger[_0x94f6('0x10')](_0x94f6('0xb'),_0x5c3de8,_0x3735d3);_0x4bf63a(_0x3735d3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 43058ab..2768c18 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5e5c64,_0x19b9fb){var _0x1bf287=function(_0x19fb98){while(--_0x19fb98){_0x5e5c64['push'](_0x5e5c64['shift']());}};_0x1bf287(++_0x19b9fb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4b48d4,_0x286f25){var _0x2f9aa7=function(_0x5a5127){while(--_0x5a5127){_0x4b48d4['push'](_0x4b48d4['shift']());}};_0x2f9aa7(++_0x286f25);}(_0xe706,0xa3));var _0x6e70=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0xe706[_0x55969b];return _0x3d7fc1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 58c6a1c..f8a9faf 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xccaf=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x30283d,_0x4bafe5){var _0x1a12a6=function(_0x55cb86){while(--_0x55cb86){_0x30283d['push'](_0x30283d['shift']());}};_0x1a12a6(++_0x4bafe5);}(_0xccaf,0x139));var _0xfcca=function(_0x596c43,_0x28647a){_0x596c43=_0x596c43-0x0;var _0x4e1315=_0xccaf[_0x596c43];return _0x4e1315;};'use strict';var Sequelize=require(_0xfcca('0x0'));module[_0xfcca('0x1')]={'uniqueid':{'type':Sequelize[_0xfcca('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xfcca('0x3')},'membername':{'type':Sequelize[_0xfcca('0x4')],'allowNull':![],'comment':_0xfcca('0x3')},'UserId':{'type':Sequelize[_0xfcca('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xfcca('0x4')],'allowNull':![],'unique':_0xfcca('0x5'),'comment':_0xfcca('0x3')},'VoiceQueueId':{'type':Sequelize[_0xfcca('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xfcca('0x3')},'penalty':{'type':Sequelize[_0xfcca('0x2')](0xb),'defaultValue':0x0,'comment':_0xfcca('0x3')},'paused':{'type':Sequelize[_0xfcca('0x2')](0xb),'defaultValue':0x0,'comment':_0xfcca('0x3')}}; \ No newline at end of file +var _0x7816=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x7816,0x166));var _0x6781=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0x7816[_0x1af98d];return _0x3553ea;};'use strict';var Sequelize=require(_0x6781('0x0'));module[_0x6781('0x1')]={'uniqueid':{'type':Sequelize[_0x6781('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6781('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x6781('0x3')},'UserId':{'type':Sequelize[_0x6781('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6781('0x4')],'allowNull':![],'unique':_0x6781('0x5'),'comment':_0x6781('0x3')},'VoiceQueueId':{'type':Sequelize[_0x6781('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x6781('0x4')],'allowNull':![],'unique':_0x6781('0x5'),'comment':_0x6781('0x3')},'penalty':{'type':Sequelize[_0x6781('0x2')](0xb),'defaultValue':0x0,'comment':_0x6781('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x6781('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ef51626..f3aeaf1 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a52=['exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x16f61a,_0x459f91){var _0x4c2a1b=function(_0x25e724){while(--_0x25e724){_0x16f61a['push'](_0x16f61a['shift']());}};_0x4c2a1b(++_0x459f91);}(_0x1a52,0x11f));var _0x21a5=function(_0x5c15e7,_0xabd197){_0x5c15e7=_0x5c15e7-0x0;var _0x4a31d6=_0x1a52[_0x5c15e7];return _0x4a31d6;};'use strict';var EventEmitter=require(_0x21a5('0x0'));var UserVoiceQueueRt=require(_0x21a5('0x1'))['db'][_0x21a5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x21a5('0x3')](0x0);var events={'afterCreate':_0x21a5('0x4'),'afterUpdate':_0x21a5('0x5'),'afterDestroy':_0x21a5('0x6')};function emitEvent(_0x42c9d8){return function(_0x1e9c96,_0x24fa81,_0xcab114){UserVoiceQueueRtEvents['emit'](_0x42c9d8+':'+_0x1e9c96['id'],_0x1e9c96);UserVoiceQueueRtEvents[_0x21a5('0x7')](_0x42c9d8,_0x1e9c96);_0xcab114(null);};}for(var e in events){if(events[_0x21a5('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x21a5('0x9')](e,emitEvent(event));}}module[_0x21a5('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x49ff=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x5d99dd,_0x4bb40b){var _0x148a26=function(_0x25df5f){while(--_0x25df5f){_0x5d99dd['push'](_0x5d99dd['shift']());}};_0x148a26(++_0x4bb40b);}(_0x49ff,0x192));var _0xf49f=function(_0x1c8559,_0x22e992){_0x1c8559=_0x1c8559-0x0;var _0x2991af=_0x49ff[_0x1c8559];return _0x2991af;};'use strict';var EventEmitter=require(_0xf49f('0x0'));var UserVoiceQueueRt=require(_0xf49f('0x1'))['db'][_0xf49f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf49f('0x3')](0x0);var events={'afterCreate':_0xf49f('0x4'),'afterUpdate':_0xf49f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x757472){return function(_0x518d32,_0x105037,_0x5922db){UserVoiceQueueRtEvents[_0xf49f('0x6')](_0x757472+':'+_0x518d32['id'],_0x518d32);UserVoiceQueueRtEvents[_0xf49f('0x6')](_0x757472,_0x518d32);_0x5922db(null);};}for(var e in events){if(events[_0xf49f('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xf49f('0x8')](e,emitEvent(event));}}module[_0xf49f('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 3846d5f..1283d54 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3df1=['api','moment','bluebird','request-promise','path','../../config/environment','exports','lodash','util'];(function(_0x42a867,_0x56eac6){var _0x5abcdb=function(_0x43c688){while(--_0x43c688){_0x42a867['push'](_0x42a867['shift']());}};_0x5abcdb(++_0x56eac6);}(_0x3df1,0x73));var _0x13df=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3df1[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x13df('0x0'));var util=require(_0x13df('0x1'));var logger=require('../../config/logger')(_0x13df('0x2'));var moment=require(_0x13df('0x3'));var BPromise=require(_0x13df('0x4'));var rp=require(_0x13df('0x5'));var fs=require('fs');var path=require(_0x13df('0x6'));var rimraf=require('rimraf');var config=require(_0x13df('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x13df('0x8')]=function(_0x2a47f5,_0x55dfa0){return _0x2a47f5['define']('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc88a=['bluebird','request-promise','path','rimraf','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api'];(function(_0x2b635f,_0x583e0d){var _0x488d04=function(_0x178261){while(--_0x178261){_0x2b635f['push'](_0x2b635f['shift']());}};_0x488d04(++_0x583e0d);}(_0xc88a,0xd4));var _0xac88=function(_0x28664b,_0x1dcf95){_0x28664b=_0x28664b-0x0;var _0x5b1f0=_0xc88a[_0x28664b];return _0x5b1f0;};'use strict';var _=require(_0xac88('0x0'));var util=require(_0xac88('0x1'));var logger=require(_0xac88('0x2'))(_0xac88('0x3'));var moment=require('moment');var BPromise=require(_0xac88('0x4'));var rp=require(_0xac88('0x5'));var fs=require('fs');var path=require(_0xac88('0x6'));var rimraf=require(_0xac88('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0xac88('0x8')]=function(_0x53a20c,_0x1d284c){return _0x53a20c[_0xac88('0x9')](_0xac88('0xa'),attributes,{'tableName':_0xac88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index e17b94b..e1652ec 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ef1=['error','message','result','catch','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x9ef1,0x1ee));var _0x19ef=function(_0x4e1dc0,_0x22f956){_0x4e1dc0=_0x4e1dc0-0x0;var _0x45076e=_0x9ef1[_0x4e1dc0];return _0x45076e;};'use strict';var _=require(_0x19ef('0x0'));var util=require('util');var moment=require(_0x19ef('0x1'));var BPromise=require(_0x19ef('0x2'));var rs=require(_0x19ef('0x3'));var fs=require('fs');var Redis=require(_0x19ef('0x4'));var db=require(_0x19ef('0x5'))['db'];var utils=require(_0x19ef('0x6'));var logger=require(_0x19ef('0x7'))(_0x19ef('0x8'));var config=require('../../config/environment');var jayson=require(_0x19ef('0x9'));var client=jayson[_0x19ef('0xa')][_0x19ef('0xb')]({'port':0x232a});config[_0x19ef('0xc')]=_[_0x19ef('0xd')](config[_0x19ef('0xc')],{'host':_0x19ef('0xe'),'port':0x18eb});var socket=require(_0x19ef('0xf'))(new Redis(config[_0x19ef('0xc')]));require(_0x19ef('0x10'))['register'](socket);function respondWithRpcPromise(_0x1885b2,_0x20cf98,_0x45c373){return new BPromise(function(_0x423fd9,_0x118949){return client[_0x19ef('0x11')](_0x1885b2,_0x45c373)[_0x19ef('0x12')](function(_0x56034f){logger[_0x19ef('0x13')](_0x19ef('0x14'),_0x20cf98,_0x19ef('0x15'));logger[_0x19ef('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x20cf98,_0x19ef('0x15'),JSON[_0x19ef('0x17')](_0x56034f));if(_0x56034f['error']){if(_0x56034f[_0x19ef('0x18')]['code']===0x1f4){logger[_0x19ef('0x18')](_0x19ef('0x14'),_0x20cf98,_0x56034f[_0x19ef('0x18')][_0x19ef('0x19')]);return _0x118949(_0x56034f[_0x19ef('0x18')]['message']);}logger['error'](_0x19ef('0x14'),_0x20cf98,_0x56034f[_0x19ef('0x18')][_0x19ef('0x19')]);return _0x423fd9(_0x56034f[_0x19ef('0x18')]['message']);}else{logger[_0x19ef('0x13')](_0x19ef('0x14'),_0x20cf98,_0x19ef('0x15'));_0x423fd9(_0x56034f[_0x19ef('0x1a')][_0x19ef('0x19')]);}})[_0x19ef('0x1b')](function(_0x1766ce){logger[_0x19ef('0x18')](_0x19ef('0x14'),_0x20cf98,_0x1766ce);_0x118949(_0x1766ce);});});}exports['GetVoiceQueueRtPauses']=function(_0x5c264c){var _0xc68fc9=this;return new Promise(function(_0x396495,_0x39b75f){return db[_0x19ef('0x1c')][_0x19ef('0x1d')]({'raw':_0x5c264c['options']?_0x5c264c[_0x19ef('0x1e')][_0x19ef('0x1f')]===undefined?!![]:![]:!![],'where':_0x5c264c[_0x19ef('0x1e')]?_0x5c264c[_0x19ef('0x1e')]['where']||null:null,'attributes':[[db[_0x19ef('0x20')]['fn'](_0x19ef('0x21'),db[_0x19ef('0x20')]['fn']('IF',db[_0x19ef('0x20')][_0x19ef('0x22')](_0x19ef('0x23')))),_0x19ef('0x24')]]})[_0x19ef('0x12')](function(_0x99db46){logger['info']('GetVoiceQueueRtPauses',_0x5c264c);logger[_0x19ef('0x16')]('GetVoiceQueueRtPauses',_0x5c264c,JSON[_0x19ef('0x17')](_0x99db46));_0x396495(_0x99db46);})[_0x19ef('0x1b')](function(_0x28a5fa){logger['error']('GetVoiceQueueRtPauses',_0x28a5fa[_0x19ef('0x19')],_0x5c264c);_0x39b75f(_0xc68fc9['error'](0x1f4,_0x28a5fa[_0x19ef('0x19')]));});});}; \ No newline at end of file +var _0xaef6=['socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','`paused`\x20=\x201,\x201,\x20null','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3fe85c,_0x7f00c8){var _0x5eb1cc=function(_0x5312b7){while(--_0x5312b7){_0x3fe85c['push'](_0x3fe85c['shift']());}};_0x5eb1cc(++_0x7f00c8);}(_0xaef6,0x7e));var _0x6aef=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xaef6[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x6aef('0x0'));var util=require(_0x6aef('0x1'));var moment=require(_0x6aef('0x2'));var BPromise=require(_0x6aef('0x3'));var rs=require(_0x6aef('0x4'));var fs=require('fs');var Redis=require(_0x6aef('0x5'));var db=require(_0x6aef('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6aef('0x7'));var config=require(_0x6aef('0x8'));var jayson=require(_0x6aef('0x9'));var client=jayson[_0x6aef('0xa')][_0x6aef('0xb')]({'port':0x232a});config[_0x6aef('0xc')]=_[_0x6aef('0xd')](config[_0x6aef('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6aef('0xe'))(new Redis(config[_0x6aef('0xc')]));require(_0x6aef('0xf'))[_0x6aef('0x10')](socket);function respondWithRpcPromise(_0x518a20,_0xa767af,_0x45705b){return new BPromise(function(_0x1472a5,_0x3ed8e8){return client[_0x6aef('0x11')](_0x518a20,_0x45705b)[_0x6aef('0x12')](function(_0x3668ad){logger[_0x6aef('0x13')](_0x6aef('0x14'),_0xa767af,_0x6aef('0x15'));logger[_0x6aef('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0xa767af,_0x6aef('0x15'),JSON['stringify'](_0x3668ad));if(_0x3668ad[_0x6aef('0x17')]){if(_0x3668ad[_0x6aef('0x17')][_0x6aef('0x18')]===0x1f4){logger[_0x6aef('0x17')](_0x6aef('0x14'),_0xa767af,_0x3668ad[_0x6aef('0x17')][_0x6aef('0x19')]);return _0x3ed8e8(_0x3668ad[_0x6aef('0x17')]['message']);}logger[_0x6aef('0x17')](_0x6aef('0x14'),_0xa767af,_0x3668ad[_0x6aef('0x17')]['message']);return _0x1472a5(_0x3668ad[_0x6aef('0x17')][_0x6aef('0x19')]);}else{logger[_0x6aef('0x13')](_0x6aef('0x14'),_0xa767af,_0x6aef('0x15'));_0x1472a5(_0x3668ad['result'][_0x6aef('0x19')]);}})[_0x6aef('0x1a')](function(_0x23b45a){logger['error'](_0x6aef('0x14'),_0xa767af,_0x23b45a);_0x3ed8e8(_0x23b45a);});});}exports[_0x6aef('0x1b')]=function(_0xa71fcb){var _0x5206c8=this;return new Promise(function(_0x2b0a19,_0x1d48a3){return db['UserVoiceQueueRt'][_0x6aef('0x1c')]({'raw':_0xa71fcb['options']?_0xa71fcb[_0x6aef('0x1d')][_0x6aef('0x1e')]===undefined?!![]:![]:!![],'where':_0xa71fcb[_0x6aef('0x1d')]?_0xa71fcb[_0x6aef('0x1d')][_0x6aef('0x1f')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x6aef('0x20')]['fn']('IF',db[_0x6aef('0x20')]['literal'](_0x6aef('0x21')))),'outboundQueuePauses']]})[_0x6aef('0x12')](function(_0x40b36f){logger['info'](_0x6aef('0x1b'),_0xa71fcb);logger[_0x6aef('0x16')](_0x6aef('0x1b'),_0xa71fcb,JSON[_0x6aef('0x22')](_0x40b36f));_0x2b0a19(_0x40b36f);})[_0x6aef('0x1a')](function(_0x53d147){logger[_0x6aef('0x17')](_0x6aef('0x1b'),_0x53d147['message'],_0xa71fcb);_0x1d48a3(_0x5206c8[_0x6aef('0x17')](0x1f4,_0x53d147[_0x6aef('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 53a48f5..df4b35b 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x510e=['remove','update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x406e5c,_0x72dde6){var _0x4ef355=function(_0x21b893){while(--_0x21b893){_0x406e5c['push'](_0x406e5c['shift']());}};_0x4ef355(++_0x72dde6);}(_0x510e,0x1ed));var _0xe510=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0x510e[_0x54edc9];return _0x2ae7a9;};'use strict';var UserVoiceQueueRtEvents=require(_0xe510('0x0'));var events=[_0xe510('0x1'),_0xe510('0x2'),_0xe510('0x3')];function createListener(_0x2ed31a,_0x511b97){return function(_0x31d884){_0x511b97[_0xe510('0x4')](_0x2ed31a,_0x31d884);};}function removeListener(_0x3cd0a5,_0x4dd477){return function(){UserVoiceQueueRtEvents[_0xe510('0x5')](_0x3cd0a5,_0x4dd477);};}exports[_0xe510('0x6')]=function(_0x236d08){for(var _0x37870d=0x0,_0x26cffc=events[_0xe510('0x7')];_0x37870d<_0x26cffc;_0x37870d++){var _0x27ca15=events[_0x37870d];var _0x42b48c=createListener(_0xe510('0x8')+_0x27ca15,_0x236d08);UserVoiceQueueRtEvents['on'](_0x27ca15,_0x42b48c);}}; \ No newline at end of file +var _0x7046=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x7046,0x144));var _0x6704=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7046[_0x57b54c];return _0x59cc19;};'use strict';var UserVoiceQueueRtEvents=require(_0x6704('0x0'));var events=[_0x6704('0x1'),_0x6704('0x2'),_0x6704('0x3')];function createListener(_0x54a895,_0x1fd895){return function(_0x4399c6){_0x1fd895[_0x6704('0x4')](_0x54a895,_0x4399c6);};}function removeListener(_0x5258e7,_0x1e9b2a){return function(){UserVoiceQueueRtEvents[_0x6704('0x5')](_0x5258e7,_0x1e9b2a);};}exports[_0x6704('0x6')]=function(_0x626a14){for(var _0x2917be=0x0,_0x4badf8=events[_0x6704('0x7')];_0x2917be<_0x4badf8;_0x2917be++){var _0x49b8b6=events[_0x2917be];var _0x56b1ff=createListener(_0x6704('0x8')+_0x49b8b6,_0x626a14);UserVoiceQueueRtEvents['on'](_0x49b8b6,_0x56b1ff);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 947e260..171a1d8 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4c3c83,_0x38e6f8){var _0x24f55d=function(_0x11fce7){while(--_0x11fce7){_0x4c3c83['push'](_0x4c3c83['shift']());}};_0x24f55d(++_0x38e6f8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4692ed,_0x3e4769){var _0x481b53=function(_0x4954c1){while(--_0x4954c1){_0x4692ed['push'](_0x4692ed['shift']());}};_0x481b53(++_0x3e4769);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0xcb91[_0x872b02];return _0x1a6b24;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index db7d33b..d7e774c 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9232=['sequelize','exports','INTEGER'];(function(_0x503790,_0x525c78){var _0x388092=function(_0x2ab2b8){while(--_0x2ab2b8){_0x503790['push'](_0x503790['shift']());}};_0x388092(++_0x525c78);}(_0x9232,0xab));var _0x2923=function(_0x46127b,_0x534c15){_0x46127b=_0x46127b-0x0;var _0x2dffb4=_0x9232[_0x46127b];return _0x2dffb4;};'use strict';var Sequelize=require(_0x2923('0x0'));module[_0x2923('0x1')]={'penalty':{'type':Sequelize[_0x2923('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x677a=['exports','INTEGER'];(function(_0x242a98,_0x13988e){var _0x580999=function(_0x341927){while(--_0x341927){_0x242a98['push'](_0x242a98['shift']());}};_0x580999(++_0x13988e);}(_0x677a,0xee));var _0xa677=function(_0x388cf8,_0x5f0ba3){_0x388cf8=_0x388cf8-0x0;var _0xbe7acf=_0x677a[_0x388cf8];return _0xbe7acf;};'use strict';var Sequelize=require('sequelize');module[_0xa677('0x0')]={'penalty':{'type':Sequelize[_0xa677('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 100d6ac..c19df51 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.model.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4fc=['exports','define','util','api','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x3b1eb9,_0x235ce9){var _0x2968c5=function(_0x1afdab){while(--_0x1afdab){_0x3b1eb9['push'](_0x3b1eb9['shift']());}};_0x2968c5(++_0x235ce9);}(_0xb4fc,0xfe));var _0xcb4f=function(_0x835f74,_0x123452){_0x835f74=_0x835f74-0x0;var _0x46a4d6=_0xb4fc[_0x835f74];return _0x46a4d6;};'use strict';var _=require('lodash');var util=require(_0xcb4f('0x0'));var logger=require('../../config/logger')(_0xcb4f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcb4f('0x2'));var fs=require('fs');var path=require(_0xcb4f('0x3'));var rimraf=require(_0xcb4f('0x4'));var config=require(_0xcb4f('0x5'));var attributes=require(_0xcb4f('0x6'));module[_0xcb4f('0x7')]=function(_0x3cfe8f,_0x1f4a90){return _0x3cfe8f[_0xcb4f('0x8')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e8d=['user_has_whatsapp_queues','api','moment','bluebird','request-promise','path','exports','UserWhatsappQueue'];(function(_0x15000c,_0x19dba1){var _0x59c273=function(_0x2a3274){while(--_0x2a3274){_0x15000c['push'](_0x15000c['shift']());}};_0x59c273(++_0x19dba1);}(_0x8e8d,0xd1));var _0xd8e8=function(_0xcaeee7,_0xa6e639){_0xcaeee7=_0xcaeee7-0x0;var _0x3cb526=_0x8e8d[_0xcaeee7];return _0x3cb526;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd8e8('0x0'));var moment=require(_0xd8e8('0x1'));var BPromise=require(_0xd8e8('0x2'));var rp=require(_0xd8e8('0x3'));var fs=require('fs');var path=require(_0xd8e8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0xd8e8('0x5')]=function(_0x57b96d,_0x30a359){return _0x57b96d['define'](_0xd8e8('0x6'),attributes,{'tableName':_0xd8e8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 5485c36..2d298a8 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56ab=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5bec6f,_0x26e692){var _0x35b36d=function(_0xedfdcb){while(--_0xedfdcb){_0x5bec6f['push'](_0x5bec6f['shift']());}};_0x35b36d(++_0x26e692);}(_0x56ab,0x1c9));var _0xb56a=function(_0x15681a,_0x21e721){_0x15681a=_0x15681a-0x0;var _0x220ba2=_0x56ab[_0x15681a];return _0x220ba2;};'use strict';var _=require(_0xb56a('0x0'));var util=require('util');var moment=require(_0xb56a('0x1'));var BPromise=require(_0xb56a('0x2'));var rs=require(_0xb56a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb56a('0x4'))['db'];var utils=require(_0xb56a('0x5'));var logger=require(_0xb56a('0x6'))('rpc');var config=require(_0xb56a('0x7'));var jayson=require(_0xb56a('0x8'));var client=jayson[_0xb56a('0x9')][_0xb56a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x526d49,_0x45fd73,_0x17d7f1){return new BPromise(function(_0x490ccd,_0x1e8443){return client[_0xb56a('0xb')](_0x526d49,_0x17d7f1)[_0xb56a('0xc')](function(_0x2ec7e0){logger[_0xb56a('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x45fd73,_0xb56a('0xe'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x45fd73,'request\x20sent',JSON[_0xb56a('0xf')](_0x2ec7e0));if(_0x2ec7e0[_0xb56a('0x10')]){if(_0x2ec7e0['error'][_0xb56a('0x11')]===0x1f4){logger[_0xb56a('0x10')](_0xb56a('0x12'),_0x45fd73,_0x2ec7e0[_0xb56a('0x10')]['message']);return _0x1e8443(_0x2ec7e0['error'][_0xb56a('0x13')]);}logger[_0xb56a('0x10')](_0xb56a('0x12'),_0x45fd73,_0x2ec7e0[_0xb56a('0x10')][_0xb56a('0x13')]);return _0x490ccd(_0x2ec7e0[_0xb56a('0x10')][_0xb56a('0x13')]);}else{logger[_0xb56a('0xd')](_0xb56a('0x12'),_0x45fd73,_0xb56a('0xe'));_0x490ccd(_0x2ec7e0[_0xb56a('0x14')][_0xb56a('0x13')]);}})['catch'](function(_0x8d6e06){logger[_0xb56a('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x45fd73,_0x8d6e06);_0x1e8443(_0x8d6e06);});});} \ No newline at end of file +var _0xc10c=['http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xfac06,_0x2c5ee7){var _0x1e38ee=function(_0x5453d0){while(--_0x5453d0){_0xfac06['push'](_0xfac06['shift']());}};_0x1e38ee(++_0x2c5ee7);}(_0xc10c,0x1cf));var _0xcc10=function(_0x12de6d,_0x4ed177){_0x12de6d=_0x12de6d-0x0;var _0x567eb7=_0xc10c[_0x12de6d];return _0x567eb7;};'use strict';var _=require(_0xcc10('0x0'));var util=require(_0xcc10('0x1'));var moment=require(_0xcc10('0x2'));var BPromise=require(_0xcc10('0x3'));var rs=require(_0xcc10('0x4'));var fs=require('fs');var Redis=require(_0xcc10('0x5'));var db=require(_0xcc10('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc10('0x7'))(_0xcc10('0x8'));var config=require(_0xcc10('0x9'));var jayson=require(_0xcc10('0xa'));var client=jayson[_0xcc10('0xb')][_0xcc10('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29eb96,_0x20a374,_0x3c555c){return new BPromise(function(_0x441162,_0x397ae9){return client['request'](_0x29eb96,_0x3c555c)[_0xcc10('0xd')](function(_0x590e1f){logger[_0xcc10('0xe')](_0xcc10('0xf'),_0x20a374,_0xcc10('0x10'));logger[_0xcc10('0x11')](_0xcc10('0x12'),_0x20a374,_0xcc10('0x10'),JSON[_0xcc10('0x13')](_0x590e1f));if(_0x590e1f[_0xcc10('0x14')]){if(_0x590e1f[_0xcc10('0x14')][_0xcc10('0x15')]===0x1f4){logger[_0xcc10('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x20a374,_0x590e1f[_0xcc10('0x14')][_0xcc10('0x16')]);return _0x397ae9(_0x590e1f[_0xcc10('0x14')][_0xcc10('0x16')]);}logger[_0xcc10('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x20a374,_0x590e1f[_0xcc10('0x14')][_0xcc10('0x16')]);return _0x441162(_0x590e1f[_0xcc10('0x14')][_0xcc10('0x16')]);}else{logger[_0xcc10('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x20a374,_0xcc10('0x10'));_0x441162(_0x590e1f[_0xcc10('0x17')][_0xcc10('0x16')]);}})[_0xcc10('0x18')](function(_0x503c6d){logger[_0xcc10('0x14')](_0xcc10('0xf'),_0x20a374,_0x503c6d);_0x397ae9(_0x503c6d);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index a666b01..5e9ff55 100644 --- a/server/api/variable/index.js +++ b/server/api/variable/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b9b=['show','post','update','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id'];(function(_0x4398ca,_0x2a397f){var _0xe0be52=function(_0x7f5193){while(--_0x7f5193){_0x4398ca['push'](_0x4398ca['shift']());}};_0xe0be52(++_0x2a397f);}(_0x9b9b,0x114));var _0xb9b9=function(_0x1dd8f6,_0x3ea487){_0x1dd8f6=_0x1dd8f6-0x0;var _0xf083b7=_0x9b9b[_0x1dd8f6];return _0xf083b7;};'use strict';var multer=require('multer');var util=require(_0xb9b9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9b9('0x1'));var router=express[_0xb9b9('0x2')]();var fs_extra=require(_0xb9b9('0x3'));var auth=require(_0xb9b9('0x4'));var interaction=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var controller=require(_0xb9b9('0x7'));router[_0xb9b9('0x8')]('/',auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xa')]);router[_0xb9b9('0x8')](_0xb9b9('0xb'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xc')]);router[_0xb9b9('0xd')]('/',auth[_0xb9b9('0x9')](),controller['create']);router['put'](_0xb9b9('0xb'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xe')]);router['delete'](_0xb9b9('0xb'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xf')]);module['exports']=router; \ No newline at end of file +var _0x66fa=['create','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x405458,_0x101ac8){var _0x319511=function(_0x16c958){while(--_0x16c958){_0x405458['push'](_0x405458['shift']());}};_0x319511(++_0x101ac8);}(_0x66fa,0x168));var _0xa66f=function(_0x28240c,_0x3fd8c5){_0x28240c=_0x28240c-0x0;var _0x5c140b=_0x66fa[_0x28240c];return _0x5c140b;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require(_0xa66f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa66f('0x3')]();var fs_extra=require(_0xa66f('0x4'));var auth=require(_0xa66f('0x5'));var interaction=require(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var controller=require(_0xa66f('0x8'));router[_0xa66f('0x9')]('/',auth[_0xa66f('0xa')](),controller[_0xa66f('0xb')]);router[_0xa66f('0x9')](_0xa66f('0xc'),auth['isAuthenticated'](),controller[_0xa66f('0xd')]);router['post']('/',auth[_0xa66f('0xa')](),controller[_0xa66f('0xe')]);router['put'](_0xa66f('0xc'),auth[_0xa66f('0xa')](),controller[_0xa66f('0xf')]);router[_0xa66f('0x10')](_0xa66f('0xc'),auth[_0xa66f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index f4bfccb..f483c65 100644 --- a/server/api/variable/variable.attributes.js +++ b/server/api/variable/variable.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe784=['name','sequelize','exports','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe784,0x1b9));var _0x4e78=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe784[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x4e78('0x0'));module[_0x4e78('0x1')]={'name':{'type':Sequelize[_0x4e78('0x2')],'unique':_0x4e78('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4e78('0x2')]}}; \ No newline at end of file +var _0xa4b0=['name','sequelize','exports','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa4b0,0x15d));var _0x0a4b=function(_0x99dfa5,_0x313bc1){_0x99dfa5=_0x99dfa5-0x0;var _0xbaa181=_0xa4b0[_0x99dfa5];return _0xbaa181;};'use strict';var Sequelize=require(_0x0a4b('0x0'));module[_0x0a4b('0x1')]={'name':{'type':Sequelize[_0x0a4b('0x2')],'unique':_0x0a4b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2ec1e34..ed7c52f 100644 --- a/server/api/variable/variable.controller.js +++ b/server/api/variable/variable.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b45=['model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','get','Variables','UserProfileResource','sendStatus','stack','name','send','map','Variable','type','key'];(function(_0x3140c1,_0x1f54a9){var _0x4372bc=function(_0x17330a){while(--_0x17330a){_0x3140c1['push'](_0x3140c1['shift']());}};_0x4372bc(++_0x1f54a9);}(_0x6b45,0x164));var _0x56b4=function(_0x30c646,_0x1056ce){_0x30c646=_0x30c646-0x0;var _0x19b17a=_0x6b45[_0x30c646];return _0x19b17a;};'use strict';var emlformat=require(_0x56b4('0x0'));var rimraf=require(_0x56b4('0x1'));var zipdir=require(_0x56b4('0x2'));var jsonpatch=require(_0x56b4('0x3'));var rp=require(_0x56b4('0x4'));var moment=require(_0x56b4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x56b4('0x6'));var util=require('util');var path=require(_0x56b4('0x7'));var sox=require(_0x56b4('0x8'));var csv=require('to-csv');var ejs=require(_0x56b4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56b4('0xa'));var squel=require(_0x56b4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56b4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x56b4('0xd'));var Papa=require(_0x56b4('0xe'));var Redis=require(_0x56b4('0xf'));var authService=require(_0x56b4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x56b4('0x11'));var utils=require(_0x56b4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x56b4('0x13'));var db=require(_0x56b4('0x14'))['db'];function respondWithStatusCode(_0x6c876e,_0x3586f0){_0x3586f0=_0x3586f0||0xcc;return function(_0x595e5f){if(_0x595e5f){return _0x6c876e['sendStatus'](_0x3586f0);}return _0x6c876e[_0x56b4('0x15')](_0x3586f0)[_0x56b4('0x16')]();};}function respondWithResult(_0x527818,_0x121a0){_0x121a0=_0x121a0||0xc8;return function(_0x1db9e7){if(_0x1db9e7){return _0x527818[_0x56b4('0x15')](_0x121a0)['json'](_0x1db9e7);}};}function respondWithFilteredResult(_0x1fc67d,_0x878b95){return function(_0x529a26){if(_0x529a26){var _0x12894a=typeof _0x878b95[_0x56b4('0x17')]===_0x56b4('0x18')&&typeof _0x878b95[_0x56b4('0x19')]===_0x56b4('0x18');var _0x2fa908=_0x529a26['count'];var _0x48c7bb=_0x12894a?0x0:_0x878b95[_0x56b4('0x17')];var _0x1b6b4e=_0x12894a?_0x529a26[_0x56b4('0x1a')]:_0x878b95[_0x56b4('0x17')]+_0x878b95[_0x56b4('0x19')];var _0x20db9f;if(_0x1b6b4e>=_0x2fa908){_0x1b6b4e=_0x2fa908;_0x20db9f=0xc8;}else{_0x20db9f=0xce;}_0x1fc67d[_0x56b4('0x15')](_0x20db9f);return _0x1fc67d['set']('Content-Range',_0x48c7bb+'-'+_0x1b6b4e+'/'+_0x2fa908)[_0x56b4('0x1b')](_0x529a26);}return null;};}function patchUpdates(_0x49e21b){return function(_0xfaa82e){try{jsonpatch[_0x56b4('0x1c')](_0xfaa82e,_0x49e21b,!![]);}catch(_0x4ffb30){return BPromise[_0x56b4('0x1d')](_0x4ffb30);}return _0xfaa82e[_0x56b4('0x1e')]();};}function saveUpdates(_0x511848,_0x2d4a3a){return function(_0x159d02){if(_0x159d02){return _0x159d02[_0x56b4('0x1f')](_0x511848)[_0x56b4('0x20')](function(_0x33a80e){return _0x33a80e;});}return null;};}function removeEntity(_0x2c13a8,_0x12ef90){return function(_0x528f70){if(_0x528f70){return _0x528f70['destroy']()['then'](function(){var _0x347a57=_0x528f70[_0x56b4('0x21')]({'plain':!![]});var _0x33106a=_0x56b4('0x22');return db[_0x56b4('0x23')]['destroy']({'where':{'type':_0x33106a,'resourceId':_0x347a57['id']}})[_0x56b4('0x20')](function(){return _0x528f70;});})[_0x56b4('0x20')](function(){_0x2c13a8[_0x56b4('0x15')](0xcc)[_0x56b4('0x16')]();});}};}function handleEntityNotFound(_0x38ebbe,_0x1d6a11){return function(_0x1b1e86){if(!_0x1b1e86){_0x38ebbe[_0x56b4('0x24')](0x194);}return _0x1b1e86;};}function handleError(_0x3dd722,_0x557ee7){_0x557ee7=_0x557ee7||0x1f4;return function(_0x51fa02){logger['error'](_0x51fa02[_0x56b4('0x25')]);if(_0x51fa02[_0x56b4('0x26')]){delete _0x51fa02[_0x56b4('0x26')];}_0x3dd722['status'](_0x557ee7)[_0x56b4('0x27')](_0x51fa02);};}exports['index']=function(_0xca3f18,_0x586b23){var _0x5deacd={},_0x43a6e0={},_0x5e48c8={'count':0x0,'rows':[]};var _0x9ee6f6=_[_0x56b4('0x28')](db[_0x56b4('0x29')]['rawAttributes'],function(_0xb48c44){return{'name':_0xb48c44['fieldName'],'type':_0xb48c44[_0x56b4('0x2a')][_0x56b4('0x2b')]};});_0x43a6e0[_0x56b4('0x2c')]=_[_0x56b4('0x28')](_0x9ee6f6,'name');_0x43a6e0['query']=_[_0x56b4('0x2d')](_0xca3f18[_0x56b4('0x2e')]);_0x43a6e0['filters']=_[_0x56b4('0x2f')](_0x43a6e0[_0x56b4('0x2c')],_0x43a6e0[_0x56b4('0x2e')]);_0x5deacd[_0x56b4('0x30')]=_[_0x56b4('0x2f')](_0x43a6e0['model'],qs[_0x56b4('0x31')](_0xca3f18[_0x56b4('0x2e')][_0x56b4('0x31')]));_0x5deacd['attributes']=_0x5deacd['attributes'][_0x56b4('0x32')]?_0x5deacd[_0x56b4('0x30')]:_0x43a6e0[_0x56b4('0x2c')];if(!_0xca3f18[_0x56b4('0x2e')][_0x56b4('0x33')](_0x56b4('0x34'))){_0x5deacd[_0x56b4('0x19')]=qs[_0x56b4('0x19')](_0xca3f18[_0x56b4('0x2e')][_0x56b4('0x19')]);_0x5deacd[_0x56b4('0x17')]=qs[_0x56b4('0x17')](_0xca3f18[_0x56b4('0x2e')][_0x56b4('0x17')]);}_0x5deacd['order']=qs['sort'](_0xca3f18[_0x56b4('0x2e')][_0x56b4('0x35')]);_0x5deacd[_0x56b4('0x36')]=qs[_0x56b4('0x37')](_[_0x56b4('0x38')](_0xca3f18[_0x56b4('0x2e')],_0x43a6e0[_0x56b4('0x37')]),_0x9ee6f6);if(_0xca3f18[_0x56b4('0x2e')]['filter']){_0x5deacd['where']=_[_0x56b4('0x39')](_0x5deacd[_0x56b4('0x36')],{'$or':_[_0x56b4('0x28')](_0x9ee6f6,function(_0x1ec29a){if(_0x1ec29a['type']!==_0x56b4('0x3a')){var _0x4a9b57={};_0x4a9b57[_0x1ec29a[_0x56b4('0x26')]]={'$like':'%'+_0xca3f18[_0x56b4('0x2e')][_0x56b4('0x3b')]+'%'};return _0x4a9b57;}})});}_0x5deacd=_[_0x56b4('0x39')]({},_0x5deacd,_0xca3f18[_0x56b4('0x3c')]);var _0x3464ab={'where':_0x5deacd[_0x56b4('0x36')]};return db[_0x56b4('0x29')]['count'](_0x3464ab)[_0x56b4('0x20')](function(_0xf59946){_0x5e48c8[_0x56b4('0x1a')]=_0xf59946;if(_0xca3f18[_0x56b4('0x2e')][_0x56b4('0x3d')]){_0x5deacd[_0x56b4('0x3e')]=[{'all':!![]}];}return db[_0x56b4('0x29')]['findAll'](_0x5deacd);})['then'](function(_0x27a598){_0x5e48c8[_0x56b4('0x3f')]=_0x27a598;return _0x5e48c8;})[_0x56b4('0x20')](respondWithFilteredResult(_0x586b23,_0x5deacd))['catch'](handleError(_0x586b23,null));};exports[_0x56b4('0x40')]=function(_0x2b5422,_0x532404){var _0x44896d={'raw':!![],'where':{'id':_0x2b5422[_0x56b4('0x41')]['id']}},_0x3083b6={};_0x3083b6[_0x56b4('0x2c')]=_['keys'](db[_0x56b4('0x29')][_0x56b4('0x42')]);_0x3083b6[_0x56b4('0x2e')]=_[_0x56b4('0x2d')](_0x2b5422['query']);_0x3083b6['filters']=_[_0x56b4('0x2f')](_0x3083b6[_0x56b4('0x2c')],_0x3083b6[_0x56b4('0x2e')]);_0x44896d[_0x56b4('0x30')]=_[_0x56b4('0x2f')](_0x3083b6['model'],qs['fields'](_0x2b5422[_0x56b4('0x2e')]['fields']));_0x44896d[_0x56b4('0x30')]=_0x44896d['attributes'][_0x56b4('0x32')]?_0x44896d['attributes']:_0x3083b6[_0x56b4('0x2c')];if(_0x2b5422[_0x56b4('0x2e')][_0x56b4('0x3d')]){_0x44896d[_0x56b4('0x3e')]=[{'all':!![]}];}_0x44896d=_[_0x56b4('0x39')]({},_0x44896d,_0x2b5422[_0x56b4('0x3c')]);return db['Variable'][_0x56b4('0x43')](_0x44896d)['then'](handleEntityNotFound(_0x532404,null))[_0x56b4('0x20')](respondWithResult(_0x532404,null))['catch'](handleError(_0x532404,null));};exports['create']=function(_0x1d78da,_0x4dc409){return db['Variable'][_0x56b4('0x44')](_0x1d78da[_0x56b4('0x45')],{})[_0x56b4('0x20')](function(_0x43af69){var _0x3fefb9=_0x1d78da[_0x56b4('0x46')][_0x56b4('0x21')]({'plain':!![]});if(!_0x3fefb9)throw new Error(_0x56b4('0x47'));if(_0x3fefb9[_0x56b4('0x48')]===_0x56b4('0x46')){var _0x577e67=_0x43af69[_0x56b4('0x21')]({'plain':!![]});var _0x41314d=_0x56b4('0x22');return db[_0x56b4('0x49')][_0x56b4('0x43')]({'where':{'name':_0x41314d,'userProfileId':_0x3fefb9[_0x56b4('0x4a')]},'raw':!![]})[_0x56b4('0x20')](function(_0x53d144){if(_0x53d144&&_0x53d144[_0x56b4('0x4b')]===0x0){return db['UserProfileResource'][_0x56b4('0x44')]({'name':_0x577e67[_0x56b4('0x26')],'resourceId':_0x577e67['id'],'type':_0x53d144[_0x56b4('0x26')],'sectionId':_0x53d144['id']},{})[_0x56b4('0x20')](function(){return _0x43af69;});}else{return _0x43af69;}})[_0x56b4('0x4c')](function(_0x3d4b41){logger[_0x56b4('0x4d')](_0x56b4('0x4e'),_0x3d4b41);throw _0x3d4b41;});}return _0x43af69;})[_0x56b4('0x20')](respondWithResult(_0x4dc409,0xc9))['catch'](handleError(_0x4dc409,null));};exports[_0x56b4('0x1f')]=function(_0x392b60,_0x2ad9af){if(_0x392b60['body']['id']){delete _0x392b60[_0x56b4('0x45')]['id'];}return db['Variable'][_0x56b4('0x43')]({'where':{'id':_0x392b60[_0x56b4('0x41')]['id']}})[_0x56b4('0x20')](handleEntityNotFound(_0x2ad9af,null))['then'](saveUpdates(_0x392b60[_0x56b4('0x45')],null))['then'](respondWithResult(_0x2ad9af,null))[_0x56b4('0x4c')](handleError(_0x2ad9af,null));};exports[_0x56b4('0x4f')]=function(_0x3a97a2,_0x2e10a3){return db['Variable'][_0x56b4('0x43')]({'where':{'id':_0x3a97a2[_0x56b4('0x41')]['id']}})[_0x56b4('0x20')](handleEntityNotFound(_0x2e10a3,null))[_0x56b4('0x20')](removeEntity(_0x2e10a3,null))[_0x56b4('0x4c')](handleError(_0x2e10a3,null));}; \ No newline at end of file +var _0xdea6=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','merge','VIRTUAL','filter','findAll','catch','params','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','error','name','send','map','Variable','rawAttributes','fieldName','type','model'];(function(_0x54b56d,_0x43cee0){var _0x29e581=function(_0x2d0f0f){while(--_0x2d0f0f){_0x54b56d['push'](_0x54b56d['shift']());}};_0x29e581(++_0x43cee0);}(_0xdea6,0xbd));var _0x6dea=function(_0x4ce462,_0x321f80){_0x4ce462=_0x4ce462-0x0;var _0x252492=_0xdea6[_0x4ce462];return _0x252492;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6dea('0x0'));var zipdir=require(_0x6dea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6dea('0x2'));var moment=require(_0x6dea('0x3'));var BPromise=require(_0x6dea('0x4'));var Mustache=require(_0x6dea('0x5'));var util=require(_0x6dea('0x6'));var path=require('path');var sox=require(_0x6dea('0x7'));var csv=require(_0x6dea('0x8'));var ejs=require(_0x6dea('0x9'));var fs=require('fs');var fs_extra=require(_0x6dea('0xa'));var _=require(_0x6dea('0xb'));var squel=require(_0x6dea('0xc'));var crypto=require('crypto');var jsforce=require(_0x6dea('0xd'));var deskjs=require(_0x6dea('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6dea('0xf'));var Papa=require(_0x6dea('0x10'));var Redis=require(_0x6dea('0x11'));var authService=require(_0x6dea('0x12'));var qs=require(_0x6dea('0x13'));var as=require(_0x6dea('0x14'));var hardwareService=require(_0x6dea('0x15'));var logger=require(_0x6dea('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x6dea('0x17'));var licenseUtil=require(_0x6dea('0x18'));var db=require(_0x6dea('0x19'))['db'];function respondWithStatusCode(_0x1162c9,_0x3d0ced){_0x3d0ced=_0x3d0ced||0xcc;return function(_0x408f8d){if(_0x408f8d){return _0x1162c9['sendStatus'](_0x3d0ced);}return _0x1162c9[_0x6dea('0x1a')](_0x3d0ced)[_0x6dea('0x1b')]();};}function respondWithResult(_0x344852,_0x4a24e2){_0x4a24e2=_0x4a24e2||0xc8;return function(_0x11f2cd){if(_0x11f2cd){return _0x344852[_0x6dea('0x1a')](_0x4a24e2)[_0x6dea('0x1c')](_0x11f2cd);}};}function respondWithFilteredResult(_0x234ab2,_0x5547e4){return function(_0x29d914){if(_0x29d914){var _0x1a1f7d=typeof _0x5547e4[_0x6dea('0x1d')]===_0x6dea('0x1e')&&typeof _0x5547e4[_0x6dea('0x1f')]===_0x6dea('0x1e');var _0x1b3081=_0x29d914[_0x6dea('0x20')];var _0x1b4f3f=_0x1a1f7d?0x0:_0x5547e4['offset'];var _0x5b1071=_0x1a1f7d?_0x29d914['count']:_0x5547e4[_0x6dea('0x1d')]+_0x5547e4[_0x6dea('0x1f')];var _0x2be62b;if(_0x5b1071>=_0x1b3081){_0x5b1071=_0x1b3081;_0x2be62b=0xc8;}else{_0x2be62b=0xce;}_0x234ab2[_0x6dea('0x1a')](_0x2be62b);return _0x234ab2[_0x6dea('0x21')](_0x6dea('0x22'),_0x1b4f3f+'-'+_0x5b1071+'/'+_0x1b3081)[_0x6dea('0x1c')](_0x29d914);}return null;};}function patchUpdates(_0x339086){return function(_0x507b68){try{jsonpatch[_0x6dea('0x23')](_0x507b68,_0x339086,!![]);}catch(_0x522dba){return BPromise[_0x6dea('0x24')](_0x522dba);}return _0x507b68[_0x6dea('0x25')]();};}function saveUpdates(_0x146fd1,_0x54bfdd){return function(_0x93eec){if(_0x93eec){return _0x93eec[_0x6dea('0x26')](_0x146fd1)[_0x6dea('0x27')](function(_0x1ee017){return _0x1ee017;});}return null;};}function removeEntity(_0x123654,_0xecda3d){return function(_0x4efbb0){if(_0x4efbb0){return _0x4efbb0[_0x6dea('0x28')]()[_0x6dea('0x27')](function(){var _0x27fe58=_0x4efbb0[_0x6dea('0x29')]({'plain':!![]});var _0x329cae=_0x6dea('0x2a');return db[_0x6dea('0x2b')][_0x6dea('0x28')]({'where':{'type':_0x329cae,'resourceId':_0x27fe58['id']}})[_0x6dea('0x27')](function(){return _0x4efbb0;});})['then'](function(){_0x123654[_0x6dea('0x1a')](0xcc)[_0x6dea('0x1b')]();});}};}function handleEntityNotFound(_0x691c04,_0x4b7890){return function(_0xf891df){if(!_0xf891df){_0x691c04[_0x6dea('0x2c')](0x194);}return _0xf891df;};}function handleError(_0x3c83d2,_0x5bf447){_0x5bf447=_0x5bf447||0x1f4;return function(_0x37d002){logger[_0x6dea('0x2d')](_0x37d002['stack']);if(_0x37d002[_0x6dea('0x2e')]){delete _0x37d002[_0x6dea('0x2e')];}_0x3c83d2[_0x6dea('0x1a')](_0x5bf447)[_0x6dea('0x2f')](_0x37d002);};}exports['index']=function(_0x54a7d5,_0x4b1694){var _0x105c0a={},_0x52cd49={},_0x5db05e={'count':0x0,'rows':[]};var _0x56ea22=_[_0x6dea('0x30')](db[_0x6dea('0x31')][_0x6dea('0x32')],function(_0x416f6a){return{'name':_0x416f6a[_0x6dea('0x33')],'type':_0x416f6a[_0x6dea('0x34')]['key']};});_0x52cd49[_0x6dea('0x35')]=_[_0x6dea('0x30')](_0x56ea22,'name');_0x52cd49[_0x6dea('0x36')]=_[_0x6dea('0x37')](_0x54a7d5['query']);_0x52cd49[_0x6dea('0x38')]=_[_0x6dea('0x39')](_0x52cd49['model'],_0x52cd49[_0x6dea('0x36')]);_0x105c0a[_0x6dea('0x3a')]=_[_0x6dea('0x39')](_0x52cd49['model'],qs['fields'](_0x54a7d5[_0x6dea('0x36')][_0x6dea('0x3b')]));_0x105c0a['attributes']=_0x105c0a[_0x6dea('0x3a')][_0x6dea('0x3c')]?_0x105c0a[_0x6dea('0x3a')]:_0x52cd49[_0x6dea('0x35')];if(!_0x54a7d5[_0x6dea('0x36')][_0x6dea('0x3d')]('nolimit')){_0x105c0a['limit']=qs[_0x6dea('0x1f')](_0x54a7d5[_0x6dea('0x36')]['limit']);_0x105c0a[_0x6dea('0x1d')]=qs[_0x6dea('0x1d')](_0x54a7d5[_0x6dea('0x36')]['offset']);}_0x105c0a[_0x6dea('0x3e')]=qs['sort'](_0x54a7d5[_0x6dea('0x36')]['sort']);_0x105c0a['where']=qs[_0x6dea('0x38')](_['pick'](_0x54a7d5['query'],_0x52cd49[_0x6dea('0x38')]),_0x56ea22);if(_0x54a7d5['query']['filter']){_0x105c0a[_0x6dea('0x3f')]=_[_0x6dea('0x40')](_0x105c0a['where'],{'$or':_[_0x6dea('0x30')](_0x56ea22,function(_0x4e2f52){if(_0x4e2f52['type']!==_0x6dea('0x41')){var _0x5988f5={};_0x5988f5[_0x4e2f52[_0x6dea('0x2e')]]={'$like':'%'+_0x54a7d5[_0x6dea('0x36')][_0x6dea('0x42')]+'%'};return _0x5988f5;}})});}_0x105c0a=_[_0x6dea('0x40')]({},_0x105c0a,_0x54a7d5['options']);var _0x5c1f0e={'where':_0x105c0a[_0x6dea('0x3f')]};return db[_0x6dea('0x31')]['count'](_0x5c1f0e)[_0x6dea('0x27')](function(_0x47f0c0){_0x5db05e['count']=_0x47f0c0;if(_0x54a7d5[_0x6dea('0x36')]['includeAll']){_0x105c0a['include']=[{'all':!![]}];}return db[_0x6dea('0x31')][_0x6dea('0x43')](_0x105c0a);})[_0x6dea('0x27')](function(_0x102a82){_0x5db05e['rows']=_0x102a82;return _0x5db05e;})[_0x6dea('0x27')](respondWithFilteredResult(_0x4b1694,_0x105c0a))[_0x6dea('0x44')](handleError(_0x4b1694,null));};exports['show']=function(_0x83bea5,_0x4bebdc){var _0x1967ed={'raw':!![],'where':{'id':_0x83bea5[_0x6dea('0x45')]['id']}},_0x2839f4={};_0x2839f4[_0x6dea('0x35')]=_[_0x6dea('0x37')](db[_0x6dea('0x31')][_0x6dea('0x32')]);_0x2839f4['query']=_[_0x6dea('0x37')](_0x83bea5[_0x6dea('0x36')]);_0x2839f4['filters']=_[_0x6dea('0x39')](_0x2839f4[_0x6dea('0x35')],_0x2839f4['query']);_0x1967ed['attributes']=_[_0x6dea('0x39')](_0x2839f4[_0x6dea('0x35')],qs[_0x6dea('0x3b')](_0x83bea5[_0x6dea('0x36')][_0x6dea('0x3b')]));_0x1967ed[_0x6dea('0x3a')]=_0x1967ed[_0x6dea('0x3a')][_0x6dea('0x3c')]?_0x1967ed[_0x6dea('0x3a')]:_0x2839f4[_0x6dea('0x35')];if(_0x83bea5[_0x6dea('0x36')][_0x6dea('0x46')]){_0x1967ed[_0x6dea('0x47')]=[{'all':!![]}];}_0x1967ed=_[_0x6dea('0x40')]({},_0x1967ed,_0x83bea5[_0x6dea('0x48')]);return db['Variable'][_0x6dea('0x49')](_0x1967ed)[_0x6dea('0x27')](handleEntityNotFound(_0x4bebdc,null))[_0x6dea('0x27')](respondWithResult(_0x4bebdc,null))['catch'](handleError(_0x4bebdc,null));};exports[_0x6dea('0x4a')]=function(_0x1c8f14,_0x4b1a09){return db[_0x6dea('0x31')][_0x6dea('0x4a')](_0x1c8f14[_0x6dea('0x4b')],{})[_0x6dea('0x27')](function(_0x57bedf){var _0x26dc97=_0x1c8f14[_0x6dea('0x4c')][_0x6dea('0x29')]({'plain':!![]});if(!_0x26dc97)throw new Error(_0x6dea('0x4d'));if(_0x26dc97[_0x6dea('0x4e')]===_0x6dea('0x4c')){var _0x26fe79=_0x57bedf[_0x6dea('0x29')]({'plain':!![]});var _0x2c18e5=_0x6dea('0x2a');return db[_0x6dea('0x4f')][_0x6dea('0x49')]({'where':{'name':_0x2c18e5,'userProfileId':_0x26dc97[_0x6dea('0x50')]},'raw':!![]})[_0x6dea('0x27')](function(_0x2d4aad){if(_0x2d4aad&&_0x2d4aad['autoAssociation']===0x0){return db[_0x6dea('0x2b')]['create']({'name':_0x26fe79[_0x6dea('0x2e')],'resourceId':_0x26fe79['id'],'type':_0x2d4aad['name'],'sectionId':_0x2d4aad['id']},{})[_0x6dea('0x27')](function(){return _0x57bedf;});}else{return _0x57bedf;}})[_0x6dea('0x44')](function(_0x48a1d8){logger[_0x6dea('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48a1d8);throw _0x48a1d8;});}return _0x57bedf;})[_0x6dea('0x27')](respondWithResult(_0x4b1a09,0xc9))[_0x6dea('0x44')](handleError(_0x4b1a09,null));};exports[_0x6dea('0x26')]=function(_0x39bd6b,_0xfbb95){if(_0x39bd6b[_0x6dea('0x4b')]['id']){delete _0x39bd6b[_0x6dea('0x4b')]['id'];}return db['Variable'][_0x6dea('0x49')]({'where':{'id':_0x39bd6b['params']['id']}})[_0x6dea('0x27')](handleEntityNotFound(_0xfbb95,null))[_0x6dea('0x27')](saveUpdates(_0x39bd6b[_0x6dea('0x4b')],null))['then'](respondWithResult(_0xfbb95,null))[_0x6dea('0x44')](handleError(_0xfbb95,null));};exports[_0x6dea('0x28')]=function(_0x14750b,_0x12f5c9){return db['Variable']['find']({'where':{'id':_0x14750b[_0x6dea('0x45')]['id']}})[_0x6dea('0x27')](handleEntityNotFound(_0x12f5c9,null))[_0x6dea('0x27')](removeEntity(_0x12f5c9,null))[_0x6dea('0x44')](handleError(_0x12f5c9,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index de72a03..48361b3 100644 --- a/server/api/variable/variable.model.js +++ b/server/api/variable/variable.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01cf=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','define','tools_variables'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0x01cf,0x113));var _0xf01c=function(_0x15b491,_0x5973a8){_0x15b491=_0x15b491-0x0;var _0xad6763=_0x01cf[_0x15b491];return _0xad6763;};'use strict';var _=require(_0xf01c('0x0'));var util=require(_0xf01c('0x1'));var logger=require(_0xf01c('0x2'))('api');var moment=require(_0xf01c('0x3'));var BPromise=require(_0xf01c('0x4'));var rp=require(_0xf01c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf01c('0x6'));var config=require(_0xf01c('0x7'));var attributes=require(_0xf01c('0x8'));module['exports']=function(_0x470d9d,_0x2fd81f){return _0x470d9d[_0xf01c('0x9')]('Variable',attributes,{'tableName':_0xf01c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0785=['api','request-promise','rimraf','./variable.attributes','exports','Variable','tools_variables','util','../../config/logger'];(function(_0x1ad85a,_0x2c9743){var _0x28507e=function(_0x562d49){while(--_0x562d49){_0x1ad85a['push'](_0x1ad85a['shift']());}};_0x28507e(++_0x2c9743);}(_0x0785,0x8e));var _0x5078=function(_0x4f0523,_0x3603af){_0x4f0523=_0x4f0523-0x0;var _0x55e3ea=_0x0785[_0x4f0523];return _0x55e3ea;};'use strict';var _=require('lodash');var util=require(_0x5078('0x0'));var logger=require(_0x5078('0x1'))(_0x5078('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5078('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5078('0x4'));var config=require('../../config/environment');var attributes=require(_0x5078('0x5'));module[_0x5078('0x6')]=function(_0x42a0eb,_0x568563){return _0x42a0eb['define'](_0x5078('0x7'),attributes,{'tableName':_0x5078('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 675efc9..1993c72 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x1ce957,_0x2088e5){var _0xa2c30c=function(_0x25a401){while(--_0x25a401){_0x1ce957['push'](_0x1ce957['shift']());}};_0xa2c30c(++_0x2088e5);}(_0xe14b,0x93));var _0xbe14=function(_0x1436a0,_0x58a62e){_0x1436a0=_0x1436a0-0x0;var _0x3957ce=_0xe14b[_0x1436a0];return _0x3957ce;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x60d2b1,_0x2d3883){var _0x3d41ff=function(_0x5b8011){while(--_0x5b8011){_0x60d2b1['push'](_0x60d2b1['shift']());}};_0x3d41ff(++_0x2d3883);}(_0xf494,0x1c6));var _0x4f49=function(_0x1d75f7,_0x139d5e){_0x1d75f7=_0x1d75f7-0x0;var _0x307f9a=_0xf494[_0x1d75f7];return _0x307f9a;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 61f8fce..eb59c97 100644 --- a/server/api/version/index.js +++ b/server/api/version/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f32=['/reset','reset','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate'];(function(_0x11dfbb,_0x1f4c8a){var _0x22d016=function(_0x38285c){while(--_0x38285c){_0x11dfbb['push'](_0x11dfbb['shift']());}};_0x22d016(++_0x1f4c8a);}(_0x2f32,0xa7));var _0x22f3=function(_0x23042a,_0x337583){_0x23042a=_0x23042a-0x0;var _0x50fe0e=_0x2f32[_0x23042a];return _0x50fe0e;};'use strict';var express=require(_0x22f3('0x0'));var router=express[_0x22f3('0x1')]();var auth=require(_0x22f3('0x2'));var controller=require(_0x22f3('0x3'));router[_0x22f3('0x4')]('/',controller[_0x22f3('0x5')]);router[_0x22f3('0x4')](_0x22f3('0x6'),auth[_0x22f3('0x7')](),auth[_0x22f3('0x8')](),controller['fetch']);router[_0x22f3('0x4')](_0x22f3('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x22f3('0xa')]);router[_0x22f3('0x4')]('/pull',auth[_0x22f3('0x7')](),auth[_0x22f3('0x8')](),controller[_0x22f3('0xb')]);router['get'](_0x22f3('0xc'),auth[_0x22f3('0x7')](),controller[_0x22f3('0xd')]);router['get'](_0x22f3('0xe'),controller['migrations']);module[_0x22f3('0xf')]=router; \ No newline at end of file +var _0xb91f=['restart','/migrations','migrations','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','pull','/restart'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb91f,0x111));var _0xfb91=function(_0x24abca,_0x30c84c){_0x24abca=_0x24abca-0x0;var _0xd691d3=_0xb91f[_0x24abca];return _0xd691d3;};'use strict';var express=require('express');var router=express[_0xfb91('0x0')]();var auth=require(_0xfb91('0x1'));var controller=require('./version.controller');router[_0xfb91('0x2')]('/',controller[_0xfb91('0x3')]);router[_0xfb91('0x2')](_0xfb91('0x4'),auth[_0xfb91('0x5')](),auth['canUpdate'](),controller[_0xfb91('0x6')]);router[_0xfb91('0x2')](_0xfb91('0x7'),auth[_0xfb91('0x5')](),auth[_0xfb91('0x8')](),controller[_0xfb91('0x9')]);router[_0xfb91('0x2')]('/pull',auth[_0xfb91('0x5')](),auth[_0xfb91('0x8')](),controller[_0xfb91('0xa')]);router[_0xfb91('0x2')](_0xfb91('0xb'),auth['isAuthenticated'](),controller[_0xfb91('0xc')]);router[_0xfb91('0x2')](_0xfb91('0xd'),controller[_0xfb91('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index d9ee33f..416a985 100644 --- a/server/api/version/version.controller.js +++ b/server/api/version/version.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e08=['error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','motion2','catch','migrations','readdirSync','join','server','length','replace','.js','push','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','fetch','tags','latest','json','status','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset'];(function(_0x4d1818,_0xb120c){var _0x5bfc94=function(_0x51bce9){while(--_0x51bce9){_0x4d1818['push'](_0x4d1818['shift']());}};_0x5bfc94(++_0xb120c);}(_0x0e08,0xb9));var _0x80e0=function(_0x14bac4,_0x44b7f9){_0x14bac4=_0x14bac4-0x0;var _0x2eef29=_0x0e08[_0x14bac4];return _0x2eef29;};'use strict';var Umzug=require(_0x80e0('0x0'));var path=require(_0x80e0('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x80e0('0x2'))(module,_0x80e0('0x3'));var compareVersions=require(_0x80e0('0x4'));var exec=require(_0x80e0('0x5'))[_0x80e0('0x6')];var db=require(_0x80e0('0x7'))['db'];var config=require(_0x80e0('0x8'));var pm2=require(_0x80e0('0x9'));var logger=require(_0x80e0('0xa'))('update');var git=require(_0x80e0('0xb'))(config[_0x80e0('0xc')]);exports[_0x80e0('0xd')]=function(_0x56ee50,_0x58ac99){var _0x3c707e={'current':module[_0x80e0('0xe')]['version'],'phonebar':0x2};if(_0x56ee50[_0x80e0('0xf')]&&_0x56ee50[_0x80e0('0xf')]['latest']){return git[_0x80e0('0x10')]()[_0x80e0('0x11')](function(_0x1ad0a3,_0x118024){_0x3c707e[_0x80e0('0x12')]=(_0x1ad0a3?module[_0x80e0('0xe')][_0x80e0('0x3')]:_0x118024[_0x80e0('0x12')])||'2.0.0';return _0x58ac99['status'](0xc8)[_0x80e0('0x13')](_0x3c707e);});}else{return _0x58ac99[_0x80e0('0x14')](0xc8)[_0x80e0('0x13')](_0x3c707e);}};exports[_0x80e0('0x10')]=function(_0x2d7436,_0x938834){return git['fetch']([_0x80e0('0x15'),_0x80e0('0x16')],function(_0x214fb4){if(_0x214fb4){logger['error'](_0x214fb4);return _0x938834[_0x80e0('0x14')](0x1f4)[_0x80e0('0x13')](_0x214fb4);}logger[_0x80e0('0x17')](_0x80e0('0x18'));return _0x938834['status'](0xc8)[_0x80e0('0x13')]({'output':_0x80e0('0x19')});});};exports[_0x80e0('0x1a')]=function(_0x9681f8,_0x476f4c){return git[_0x80e0('0x1a')](['--hard','FETCH_HEAD'],function(_0x34ff6f){if(_0x34ff6f){logger[_0x80e0('0x1b')](_0x34ff6f);return _0x476f4c[_0x80e0('0x14')](0x1f4)[_0x80e0('0x13')](_0x34ff6f);}logger[_0x80e0('0x17')](_0x80e0('0x1c'));return _0x476f4c[_0x80e0('0x14')](0xc8)[_0x80e0('0x13')]({'output':_0x80e0('0x1d')});});};exports[_0x80e0('0x1e')]=function(_0x13cab7,_0x4f5ba1){exec(_0x80e0('0x1f'),function(_0x55d2b5,_0x22b4ae,_0x2de926){logger[_0x80e0('0x17')](_0x22b4ae);logger[_0x80e0('0x17')](_0x2de926);if(_0x55d2b5){logger[_0x80e0('0x1b')](_0x55d2b5);return _0x4f5ba1[_0x80e0('0x14')](0x1f4)[_0x80e0('0x13')](_0x55d2b5);}return _0x4f5ba1['status'](0xc8)['json']({'output':_0x22b4ae});});};exports['restart']=function(_0x4138f0,_0x32f96f){return pm2['restart'](_0x80e0('0x20'))['then'](function(_0x290e45){logger[_0x80e0('0x17')]('pm2\x20restart\x20motion\x20%s',_0x290e45);return _0x32f96f['status'](0xc8)[_0x80e0('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x80e0('0x21')](function(_0x3896a2){logger['error'](_0x3896a2);return _0x32f96f['status'](0x1f4)[_0x80e0('0x13')](_0x3896a2);});};exports[_0x80e0('0x22')]=function(_0xd8ce1a,_0x49cdb3){var _0xb71ff8=fs[_0x80e0('0x23')](path[_0x80e0('0x24')](config['root'],_0x80e0('0x25'),_0x80e0('0x22')));var _0x4f0788=[];for(var _0xc2518=0x0;_0xc2518<_0xb71ff8[_0x80e0('0x26')];_0xc2518++){var _0x5a73d2=_0xb71ff8[_0xc2518][_0x80e0('0x27')](_0x80e0('0x28'),'');if(compareVersions(module[_0x80e0('0xe')][_0x80e0('0x3')],_0x5a73d2)===-0x1){_0x4f0788[_0x80e0('0x29')](_0x5a73d2);}}if(_0x4f0788[_0x80e0('0x26')]){var _0x526454=_0x4f0788['sort'](compareVersions);var _0x242603=new Umzug({'storage':_0x80e0('0x2a'),'storageOptions':{'model':db[_0x80e0('0x2b')],'modelName':_0x80e0('0x2b'),'columnName':_0x80e0('0x3')},'migrations':{'params':[db[_0x80e0('0x2a')][_0x80e0('0x2c')](),db['sequelize'][_0x80e0('0x2d')],function(){throw new Error(_0x80e0('0x2e'));}],'path':path[_0x80e0('0x24')](config[_0x80e0('0xc')],_0x80e0('0x25'),_0x80e0('0x22')),'pattern':/\.js$/}});_0x242603['up']({'migrations':_[_0x80e0('0x2f')](_0x526454,function(_0x2ced3d){return _0x2ced3d+_0x80e0('0x28');})})[_0x80e0('0x30')](function(){return _0x49cdb3[_0x80e0('0x14')](0xc8)[_0x80e0('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x80e0('0x3')]+_0x80e0('0x31')+_[_0x80e0('0x32')](_0x526454),'migrations':_[_0x80e0('0x24')](_0x526454)});})[_0x80e0('0x21')](function(_0xe86bc1){if(_0xe86bc1 instanceof db[_0x80e0('0x2a')][_0x80e0('0x33')]){return _0x49cdb3[_0x80e0('0x14')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x49cdb3[_0x80e0('0x14')](0x1f4)[_0x80e0('0x13')](_0xe86bc1);}});}else{return _0x49cdb3[_0x80e0('0x14')](0xc8)[_0x80e0('0x13')]({'output':_0x80e0('0x34')});}}; \ No newline at end of file +var _0xa417=['motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','tags','version','status','json','fetch','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart'];(function(_0x1fa81d,_0x22a3fd){var _0x1a6768=function(_0x30bceb){while(--_0x30bceb){_0x1fa81d['push'](_0x1fa81d['shift']());}};_0x1a6768(++_0x22a3fd);}(_0xa417,0x15a));var _0x7a41=function(_0x3a6e90,_0x1bceff){_0x3a6e90=_0x3a6e90-0x0;var _0x4081c9=_0xa417[_0x3a6e90];return _0x4081c9;};'use strict';var Umzug=require(_0x7a41('0x0'));var path=require(_0x7a41('0x1'));var fs=require('fs');var _=require(_0x7a41('0x2'));var pkginfo=require(_0x7a41('0x3'))(module,'version');var compareVersions=require(_0x7a41('0x4'));var exec=require('child_process')[_0x7a41('0x5')];var db=require(_0x7a41('0x6'))['db'];var config=require(_0x7a41('0x7'));var pm2=require(_0x7a41('0x8'));var logger=require(_0x7a41('0x9'))(_0x7a41('0xa'));var git=require('simple-git')(config[_0x7a41('0xb')]);exports[_0x7a41('0xc')]=function(_0x584e9d,_0x3bff32){var _0x272801={'current':module[_0x7a41('0xd')]['version'],'phonebar':0x2};if(_0x584e9d['query']&&_0x584e9d[_0x7a41('0xe')][_0x7a41('0xf')]){return git['fetch']()[_0x7a41('0x10')](function(_0x29992d,_0x3ebb56){_0x272801[_0x7a41('0xf')]=(_0x29992d?module[_0x7a41('0xd')][_0x7a41('0x11')]:_0x3ebb56[_0x7a41('0xf')])||'2.0.0';return _0x3bff32['status'](0xc8)['json'](_0x272801);});}else{return _0x3bff32[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')](_0x272801);}};exports[_0x7a41('0x14')]=function(_0x338418,_0x2aa996){return git[_0x7a41('0x14')]([_0x7a41('0x15'),'master'],function(_0x21a3d2){if(_0x21a3d2){logger[_0x7a41('0x16')](_0x21a3d2);return _0x2aa996[_0x7a41('0x12')](0x1f4)['json'](_0x21a3d2);}logger[_0x7a41('0x17')](_0x7a41('0x18'));return _0x2aa996[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')]({'output':_0x7a41('0x19')});});};exports[_0x7a41('0x1a')]=function(_0x20314f,_0x1de15f){return git['reset'](['--hard',_0x7a41('0x1b')],function(_0x4e3de3){if(_0x4e3de3){logger[_0x7a41('0x16')](_0x4e3de3);return _0x1de15f[_0x7a41('0x12')](0x1f4)[_0x7a41('0x13')](_0x4e3de3);}logger[_0x7a41('0x17')](_0x7a41('0x1c'));return _0x1de15f[_0x7a41('0x12')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x7a41('0x1d')]=function(_0x442b42,_0x4dfc04){exec(_0x7a41('0x1e'),function(_0x4911aa,_0x4a474b,_0x475b7f){logger[_0x7a41('0x17')](_0x4a474b);logger[_0x7a41('0x17')](_0x475b7f);if(_0x4911aa){logger[_0x7a41('0x16')](_0x4911aa);return _0x4dfc04['status'](0x1f4)[_0x7a41('0x13')](_0x4911aa);}return _0x4dfc04[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')]({'output':_0x4a474b});});};exports[_0x7a41('0x1f')]=function(_0x3520c5,_0x16d05d){return pm2[_0x7a41('0x1f')](_0x7a41('0x20'))['then'](function(_0x21d4b9){logger[_0x7a41('0x17')]('pm2\x20restart\x20motion\x20%s',_0x21d4b9);return _0x16d05d[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')]({'output':_0x7a41('0x21')});})[_0x7a41('0x22')](function(_0x505aa2){logger[_0x7a41('0x16')](_0x505aa2);return _0x16d05d[_0x7a41('0x12')](0x1f4)[_0x7a41('0x13')](_0x505aa2);});};exports['migrations']=function(_0x5362b6,_0x165e49){var _0x19d87e=fs[_0x7a41('0x23')](path[_0x7a41('0x24')](config[_0x7a41('0xb')],_0x7a41('0x25'),'migrations'));var _0x4a7993=[];for(var _0x46ac76=0x0;_0x46ac76<_0x19d87e['length'];_0x46ac76++){var _0x50e9b5=_0x19d87e[_0x46ac76][_0x7a41('0x26')](_0x7a41('0x27'),'');if(compareVersions(module['exports'][_0x7a41('0x11')],_0x50e9b5)===-0x1){_0x4a7993[_0x7a41('0x28')](_0x50e9b5);}}if(_0x4a7993[_0x7a41('0x29')]){var _0x1ca327=_0x4a7993[_0x7a41('0x2a')](compareVersions);var _0x242020=new Umzug({'storage':_0x7a41('0x2b'),'storageOptions':{'model':db[_0x7a41('0x2c')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x7a41('0x2b')][_0x7a41('0x2d')](),db['sequelize'][_0x7a41('0x2e')],function(){throw new Error(_0x7a41('0x2f'));}],'path':path['join'](config[_0x7a41('0xb')],_0x7a41('0x25'),'migrations'),'pattern':/\.js$/}});_0x242020['up']({'migrations':_[_0x7a41('0x30')](_0x1ca327,function(_0x472c35){return _0x472c35+_0x7a41('0x27');})})[_0x7a41('0x31')](function(){return _0x165e49['status'](0xc8)['json']({'output':_0x7a41('0x32')+module[_0x7a41('0xd')]['version']+_0x7a41('0x33')+_[_0x7a41('0x34')](_0x1ca327),'migrations':_[_0x7a41('0x24')](_0x1ca327)});})[_0x7a41('0x22')](function(_0x2782fe){if(_0x2782fe instanceof db[_0x7a41('0x2b')]['UniqueConstraintError']){return _0x165e49[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')]({'output':_0x7a41('0x35')});}else{return _0x165e49[_0x7a41('0x12')](0x1f4)[_0x7a41('0x13')](_0x2782fe);}});}else{return _0x165e49[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 70ab19b..245b5ed 100644 --- a/server/api/voiceAgentReport/index.js +++ b/server/api/voiceAgentReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6bf=['../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x334603,_0x387f05){var _0x519403=function(_0x3efa3e){while(--_0x3efa3e){_0x334603['push'](_0x334603['shift']());}};_0x519403(++_0x387f05);}(_0xa6bf,0x1e9));var _0xfa6b=function(_0x1dc969,_0x3c1fbc){_0x1dc969=_0x1dc969-0x0;var _0x342ba0=_0xa6bf[_0x1dc969];return _0x342ba0;};'use strict';var multer=require(_0xfa6b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa6b('0x1'));var router=express[_0xfa6b('0x2')]();var fs_extra=require(_0xfa6b('0x3'));var auth=require(_0xfa6b('0x4'));var interaction=require(_0xfa6b('0x5'));var config=require(_0xfa6b('0x6'));var controller=require(_0xfa6b('0x7'));router[_0xfa6b('0x8')]('/',auth[_0xfa6b('0x9')](),controller[_0xfa6b('0xa')]);router[_0xfa6b('0x8')](_0xfa6b('0xb'),auth[_0xfa6b('0x9')](),controller[_0xfa6b('0xc')]);router[_0xfa6b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xfa6b('0xd')]);router[_0xfa6b('0xe')]('/',auth[_0xfa6b('0x9')](),controller['create']);router[_0xfa6b('0xf')](_0xfa6b('0x10'),auth[_0xfa6b('0x9')](),controller[_0xfa6b('0x11')]);router[_0xfa6b('0x12')]('/:id',auth[_0xfa6b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x62b0=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy'];(function(_0x45275b,_0x10cc21){var _0xd3c33a=function(_0x152ef7){while(--_0x152ef7){_0x45275b['push'](_0x45275b['shift']());}};_0xd3c33a(++_0x10cc21);}(_0x62b0,0xf1));var _0x062b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x62b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x062b('0x0'));var path=require('path');var timeout=require(_0x062b('0x1'));var express=require(_0x062b('0x2'));var router=express[_0x062b('0x3')]();var fs_extra=require(_0x062b('0x4'));var auth=require(_0x062b('0x5'));var interaction=require(_0x062b('0x6'));var config=require(_0x062b('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x062b('0x8')]('/',auth[_0x062b('0x9')](),controller[_0x062b('0xa')]);router[_0x062b('0x8')](_0x062b('0xb'),auth[_0x062b('0x9')](),controller[_0x062b('0xc')]);router[_0x062b('0x8')](_0x062b('0xd'),auth[_0x062b('0x9')](),controller['show']);router[_0x062b('0xe')]('/',auth[_0x062b('0x9')](),controller['create']);router[_0x062b('0xf')](_0x062b('0xd'),auth[_0x062b('0x9')](),controller[_0x062b('0x10')]);router[_0x062b('0x11')](_0x062b('0xd'),auth[_0x062b('0x9')](),controller[_0x062b('0x12')]);module[_0x062b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index d6fc673..9815feb 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87d9=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x14c03f,_0x101036){var _0x84f8ce=function(_0x2ca866){while(--_0x2ca866){_0x14c03f['push'](_0x14c03f['shift']());}};_0x84f8ce(++_0x101036);}(_0x87d9,0x143));var _0x987d=function(_0x366647,_0xd7065c){_0x366647=_0x366647-0x0;var _0x54aed1=_0x87d9[_0x366647];return _0x54aed1;};'use strict';var Sequelize=require(_0x987d('0x0'));module['exports']={'type':{'type':Sequelize[_0x987d('0x1')]},'uniqueid':{'type':Sequelize[_0x987d('0x1')]},'calleridnum':{'type':Sequelize[_0x987d('0x1')]},'calleridname':{'type':Sequelize[_0x987d('0x1')]},'queue':{'type':Sequelize[_0x987d('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x987d('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x987d('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x987d('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x987d('0x2')]},'holdtime':{'type':Sequelize[_0x987d('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x987d('0x3')]},'agentacw':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x987d('0x3')]},'reason':{'type':Sequelize[_0x987d('0x1')]},'lastevent':{'type':Sequelize[_0x987d('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x987d('0x3')]},'channelstatedesc':{'type':Sequelize[_0x987d('0x1')]},'connectedlinenum':{'type':Sequelize[_0x987d('0x1')]},'connectedlinename':{'type':Sequelize[_0x987d('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x987d('0x1')]},'context':{'type':Sequelize[_0x987d('0x1')]},'exten':{'type':Sequelize[_0x987d('0x1')]},'priority':{'type':Sequelize[_0x987d('0x1')]},'destchannel':{'type':Sequelize[_0x987d('0x1')]},'destchannelstate':{'type':Sequelize[_0x987d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x987d('0x1')]},'destcalleridnum':{'type':Sequelize[_0x987d('0x1')]},'destcalleridname':{'type':Sequelize[_0x987d('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x987d('0x1')]},'destaccountcode':{'type':Sequelize[_0x987d('0x1')]},'destcontext':{'type':Sequelize[_0x987d('0x1')]},'destexten':{'type':Sequelize[_0x987d('0x1')]},'destpriority':{'type':Sequelize[_0x987d('0x1')]},'destuniqueid':{'type':Sequelize[_0x987d('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x987d('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x987d('0x1')]},'transfer':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x987d('0x1')],'comment':_0x987d('0x5')},'transferexten':{'type':Sequelize[_0x987d('0x1')]},'transferuniqueid':{'type':Sequelize[_0x987d('0x1')]},'agententerreason':{'type':Sequelize[_0x987d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x349e=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x221eb2,_0x2d65bc){var _0x3760ee=function(_0x3a88ee){while(--_0x3a88ee){_0x221eb2['push'](_0x221eb2['shift']());}};_0x3760ee(++_0x2d65bc);}(_0x349e,0xcb));var _0xe349=function(_0x19380e,_0x206d1e){_0x19380e=_0x19380e-0x0;var _0x5a31f8=_0x349e[_0x19380e];return _0x5a31f8;};'use strict';var Sequelize=require(_0xe349('0x0'));module[_0xe349('0x1')]={'type':{'type':Sequelize[_0xe349('0x2')]},'uniqueid':{'type':Sequelize[_0xe349('0x2')]},'calleridnum':{'type':Sequelize[_0xe349('0x2')]},'calleridname':{'type':Sequelize[_0xe349('0x2')]},'queue':{'type':Sequelize[_0xe349('0x2')]},'interface':{'type':Sequelize[_0xe349('0x2')]},'membername':{'type':Sequelize[_0xe349('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xe349('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xe349('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xe349('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe349('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe349('0x5')]},'agentacw':{'type':Sequelize[_0xe349('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe349('0x5')]},'reason':{'type':Sequelize[_0xe349('0x2')]},'lastevent':{'type':Sequelize[_0xe349('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xe349('0x5')]},'channelstatedesc':{'type':Sequelize[_0xe349('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe349('0x2')]},'connectedlinename':{'type':Sequelize[_0xe349('0x2')]},'language':{'type':Sequelize[_0xe349('0x2')]},'accountcode':{'type':Sequelize[_0xe349('0x2')]},'context':{'type':Sequelize[_0xe349('0x2')]},'exten':{'type':Sequelize[_0xe349('0x2')]},'priority':{'type':Sequelize[_0xe349('0x2')]},'destchannel':{'type':Sequelize[_0xe349('0x2')]},'destchannelstate':{'type':Sequelize[_0xe349('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xe349('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe349('0x2')]},'destcalleridname':{'type':Sequelize[_0xe349('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe349('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe349('0x2')]},'destlanguage':{'type':Sequelize[_0xe349('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe349('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe349('0x2')]},'destuniqueid':{'type':Sequelize[_0xe349('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe349('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe349('0x2')],'comment':_0xe349('0x6')},'transferexten':{'type':Sequelize[_0xe349('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe349('0x2')]},'agententerreason':{'type':Sequelize[_0xe349('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 66262f8..9af6dcb 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index b6ccae0..7ec652e 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.model.js +++ b/server/api/voiceAgentReport/voiceAgentReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5b2=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','VoiceAgentReport','uniqueid'];(function(_0x47a505,_0x34928e){var _0x2891ba=function(_0x281b7a){while(--_0x281b7a){_0x47a505['push'](_0x47a505['shift']());}};_0x2891ba(++_0x34928e);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd5b2[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x2d5b('0x0'));var logger=require(_0x2d5b('0x1'))('api');var moment=require(_0x2d5b('0x2'));var BPromise=require(_0x2d5b('0x3'));var rp=require(_0x2d5b('0x4'));var fs=require('fs');var path=require(_0x2d5b('0x5'));var rimraf=require(_0x2d5b('0x6'));var config=require(_0x2d5b('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x58cff9,_0x2e1867){return _0x58cff9['define'](_0x2d5b('0x8'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x2d5b('0x9'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6334=['destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid'];(function(_0x3a05f6,_0x302a0b){var _0x33677f=function(_0x2321b5){while(--_0x2321b5){_0x3a05f6['push'](_0x3a05f6['shift']());}};_0x33677f(++_0x302a0b);}(_0x6334,0x119));var _0x4633=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0x6334[_0x1cc961];return _0x471d86;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var logger=require(_0x4633('0x2'))(_0x4633('0x3'));var moment=require(_0x4633('0x4'));var BPromise=require(_0x4633('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4633('0x6'));var rimraf=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var attributes=require(_0x4633('0x9'));module[_0x4633('0xa')]=function(_0x6493dc,_0x175e14){return _0x6493dc['define'](_0x4633('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x4633('0xc'),_0x4633('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 9a255db..1722f1a 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.rpc.js +++ b/server/api/voiceAgentReport/voiceAgentReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28cb=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceAgentReport','create','options','raw','debug','UpdateVoiceAgentReport','VoiceAgentReport','update','body','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x17a133,_0x8b3adf){var _0x4f5701=function(_0x27d6e9){while(--_0x27d6e9){_0x17a133['push'](_0x17a133['shift']());}};_0x4f5701(++_0x8b3adf);}(_0x28cb,0x112));var _0xb28c=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x28cb[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require(_0xb28c('0x0'));var moment=require(_0xb28c('0x1'));var BPromise=require(_0xb28c('0x2'));var rs=require(_0xb28c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb28c('0x4'))['db'];var utils=require(_0xb28c('0x5'));var logger=require(_0xb28c('0x6'))(_0xb28c('0x7'));var config=require(_0xb28c('0x8'));var jayson=require(_0xb28c('0x9'));var client=jayson['client'][_0xb28c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4094ef,_0x5d4b90,_0x19e31d){return new BPromise(function(_0x47fc44,_0x120497){return client[_0xb28c('0xb')](_0x4094ef,_0x19e31d)[_0xb28c('0xc')](function(_0x333d0b){logger['info'](_0xb28c('0xd'),_0x5d4b90,_0xb28c('0xe'));logger['debug'](_0xb28c('0xf'),_0x5d4b90,'request\x20sent',JSON[_0xb28c('0x10')](_0x333d0b));if(_0x333d0b[_0xb28c('0x11')]){if(_0x333d0b[_0xb28c('0x11')][_0xb28c('0x12')]===0x1f4){logger[_0xb28c('0x11')](_0xb28c('0xd'),_0x5d4b90,_0x333d0b[_0xb28c('0x11')][_0xb28c('0x13')]);return _0x120497(_0x333d0b['error'][_0xb28c('0x13')]);}logger[_0xb28c('0x11')](_0xb28c('0xd'),_0x5d4b90,_0x333d0b[_0xb28c('0x11')]['message']);return _0x47fc44(_0x333d0b['error'][_0xb28c('0x13')]);}else{logger[_0xb28c('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x5d4b90,_0xb28c('0xe'));_0x47fc44(_0x333d0b[_0xb28c('0x15')]['message']);}})[_0xb28c('0x16')](function(_0x5535d0){logger[_0xb28c('0x11')](_0xb28c('0xd'),_0x5d4b90,_0x5535d0);_0x120497(_0x5535d0);});});}exports[_0xb28c('0x17')]=function(_0x3e5484){var _0x46e377=this;return new Promise(function(_0x5dd91a,_0x191067){return db['VoiceAgentReport'][_0xb28c('0x18')](_0x3e5484['body'],{'raw':_0x3e5484[_0xb28c('0x19')]?_0x3e5484[_0xb28c('0x19')][_0xb28c('0x1a')]===undefined?!![]:![]:!![]})[_0xb28c('0xc')](function(_0x496e15){logger[_0xb28c('0x14')](_0xb28c('0x17'),_0x3e5484);logger[_0xb28c('0x1b')](_0xb28c('0x17'),_0x3e5484,JSON[_0xb28c('0x10')](_0x496e15));_0x5dd91a(_0x496e15);})[_0xb28c('0x16')](function(_0x30bfa4){logger['error']('CreateVoiceAgentReport',_0x30bfa4[_0xb28c('0x13')],_0x3e5484);_0x191067(_0x46e377[_0xb28c('0x11')](0x1f4,_0x30bfa4[_0xb28c('0x13')]));});});};exports[_0xb28c('0x1c')]=function(_0x11a4ce){var _0x54fd25=this;return new Promise(function(_0x5a456a,_0x5538b3){return db[_0xb28c('0x1d')][_0xb28c('0x1e')](_0x11a4ce[_0xb28c('0x1f')],{'raw':_0x11a4ce[_0xb28c('0x19')]?_0x11a4ce[_0xb28c('0x19')][_0xb28c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11a4ce[_0xb28c('0x19')]?_0x11a4ce['options'][_0xb28c('0x20')]||null:null,'attributes':_0x11a4ce[_0xb28c('0x19')]?_0x11a4ce[_0xb28c('0x19')][_0xb28c('0x21')]||null:null,'limit':_0x11a4ce[_0xb28c('0x19')]?_0x11a4ce[_0xb28c('0x19')][_0xb28c('0x22')]||null:null})[_0xb28c('0xc')](function(_0x105336){logger[_0xb28c('0x14')](_0xb28c('0x1c'),_0x11a4ce);logger[_0xb28c('0x1b')](_0xb28c('0x1c'),_0x11a4ce,JSON[_0xb28c('0x10')](_0x105336));_0x5a456a(_0x105336);})[_0xb28c('0x16')](function(_0x1b16eb){logger[_0xb28c('0x11')](_0xb28c('0x1c'),_0x1b16eb[_0xb28c('0x13')],_0x11a4ce);_0x5538b3(_0x54fd25[_0xb28c('0x11')](0x1f4,_0x1b16eb['message']));});});}; \ No newline at end of file +var _0x4473=['body','options','raw','info','CreateVoiceAgentReport','VoiceAgentReport','where','attributes','limit','UpdateVoiceAgentReport','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','result','message','catch'];(function(_0x4edea1,_0x336ac7){var _0x53cf5d=function(_0xbe51e5){while(--_0xbe51e5){_0x4edea1['push'](_0x4edea1['shift']());}};_0x53cf5d(++_0x336ac7);}(_0x4473,0x1ca));var _0x3447=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x4473[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3447('0x0'));var BPromise=require(_0x3447('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3447('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3447('0x3'))(_0x3447('0x4'));var config=require(_0x3447('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3447('0x6')][_0x3447('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53b6ea,_0x1465e9,_0x536819){return new BPromise(function(_0x31e2d8,_0x5052d9){return client[_0x3447('0x8')](_0x53b6ea,_0x536819)[_0x3447('0x9')](function(_0x224647){logger['info'](_0x3447('0xa'),_0x1465e9,_0x3447('0xb'));logger['debug'](_0x3447('0xc'),_0x1465e9,'request\x20sent',JSON[_0x3447('0xd')](_0x224647));if(_0x224647[_0x3447('0xe')]){if(_0x224647[_0x3447('0xe')]['code']===0x1f4){logger[_0x3447('0xe')](_0x3447('0xa'),_0x1465e9,_0x224647[_0x3447('0xe')]['message']);return _0x5052d9(_0x224647[_0x3447('0xe')]['message']);}logger[_0x3447('0xe')](_0x3447('0xa'),_0x1465e9,_0x224647[_0x3447('0xe')]['message']);return _0x31e2d8(_0x224647[_0x3447('0xe')]['message']);}else{logger['info'](_0x3447('0xa'),_0x1465e9,_0x3447('0xb'));_0x31e2d8(_0x224647[_0x3447('0xf')][_0x3447('0x10')]);}})[_0x3447('0x11')](function(_0x34ebb5){logger[_0x3447('0xe')](_0x3447('0xa'),_0x1465e9,_0x34ebb5);_0x5052d9(_0x34ebb5);});});}exports['CreateVoiceAgentReport']=function(_0x3ce744){var _0x21f2d7=this;return new Promise(function(_0x90da54,_0x145ed6){return db['VoiceAgentReport']['create'](_0x3ce744[_0x3447('0x12')],{'raw':_0x3ce744[_0x3447('0x13')]?_0x3ce744['options'][_0x3447('0x14')]===undefined?!![]:![]:!![]})[_0x3447('0x9')](function(_0x4131bf){logger[_0x3447('0x15')](_0x3447('0x16'),_0x3ce744);logger['debug'](_0x3447('0x16'),_0x3ce744,JSON[_0x3447('0xd')](_0x4131bf));_0x90da54(_0x4131bf);})[_0x3447('0x11')](function(_0x1bb8b7){logger['error']('CreateVoiceAgentReport',_0x1bb8b7[_0x3447('0x10')],_0x3ce744);_0x145ed6(_0x21f2d7[_0x3447('0xe')](0x1f4,_0x1bb8b7[_0x3447('0x10')]));});});};exports['UpdateVoiceAgentReport']=function(_0x24e617){var _0x26f0c6=this;return new Promise(function(_0x2d1a92,_0x2d3190){return db[_0x3447('0x17')]['update'](_0x24e617['body'],{'raw':_0x24e617[_0x3447('0x13')]?_0x24e617[_0x3447('0x13')][_0x3447('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24e617[_0x3447('0x13')]?_0x24e617[_0x3447('0x13')][_0x3447('0x18')]||null:null,'attributes':_0x24e617['options']?_0x24e617[_0x3447('0x13')][_0x3447('0x19')]||null:null,'limit':_0x24e617[_0x3447('0x13')]?_0x24e617[_0x3447('0x13')][_0x3447('0x1a')]||null:null})[_0x3447('0x9')](function(_0x29a9fd){logger[_0x3447('0x15')](_0x3447('0x1b'),_0x24e617);logger['debug'](_0x3447('0x1b'),_0x24e617,JSON['stringify'](_0x29a9fd));_0x2d1a92(_0x29a9fd);})[_0x3447('0x11')](function(_0x12ea0d){logger['error'](_0x3447('0x1b'),_0x12ea0d[_0x3447('0x10')],_0x24e617);_0x2d3190(_0x26f0c6[_0x3447('0xe')](0x1f4,_0x12ea0d[_0x3447('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 75e4a76..557d37a 100644 --- a/server/api/voiceCallReport/index.js +++ b/server/api/voiceCallReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x24ca,0x1bc));var _0xa24c=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x24ca[_0x329437];return _0x3789d9;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xb')]);router[_0xa24c('0x9')](_0xa24c('0xc'),auth[_0xa24c('0xa')](),controller['describe']);router[_0xa24c('0x9')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller['show']);router[_0xa24c('0xe')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x12')](_0xa24c('0xd'),auth['isAuthenticated'](),controller[_0xa24c('0x13')]);module[_0xa24c('0x14')]=router; \ No newline at end of file +var _0xaba6=['destroy','exports','multer','util','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update'];(function(_0xcbec1e,_0x5c0c9c){var _0x3ac98f=function(_0x1b5806){while(--_0x1b5806){_0xcbec1e['push'](_0xcbec1e['shift']());}};_0x3ac98f(++_0x5c0c9c);}(_0xaba6,0xe2));var _0x6aba=function(_0x482f76,_0x588ec9){_0x482f76=_0x482f76-0x0;var _0x229e38=_0xaba6[_0x482f76];return _0x229e38;};'use strict';var multer=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aba('0x2'));var auth=require(_0x6aba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6aba('0x4'));var controller=require(_0x6aba('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6aba('0x6')]('/describe',auth[_0x6aba('0x7')](),controller[_0x6aba('0x8')]);router['get'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller['show']);router[_0x6aba('0xa')]('/',auth[_0x6aba('0x7')](),controller[_0x6aba('0xb')]);router[_0x6aba('0xc')](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xd')]);router['delete'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xe')]);module[_0x6aba('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 11c369b..301728e 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21ad=['ENUM','inbound','outbound','dialer','TEXT','DATE','INTEGER','sequelize','STRING'];(function(_0xc8129b,_0x2b7c4){var _0x1c0e80=function(_0x469f93){while(--_0x469f93){_0xc8129b['push'](_0xc8129b['shift']());}};_0x1c0e80(++_0x2b7c4);}(_0x21ad,0x85));var _0xd21a=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x21ad[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0xd21a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd21a('0x1')]},'type':{'type':Sequelize[_0xd21a('0x2')](_0xd21a('0x3'),'internal',_0xd21a('0x4'),'inbound-fax','outbound-fax',_0xd21a('0x5'))},'tag':{'type':Sequelize[_0xd21a('0x1')]},'accountcode':{'type':Sequelize[_0xd21a('0x1')]},'source':{'type':Sequelize[_0xd21a('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xd21a('0x1')]},'callerid':{'type':Sequelize[_0xd21a('0x1')]},'channel':{'type':Sequelize[_0xd21a('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xd21a('0x1')]},'lastdata':{'type':Sequelize[_0xd21a('0x6')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xd21a('0x7')]},'answertime':{'type':Sequelize[_0xd21a('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xd21a('0x8')]},'billableseconds':{'type':Sequelize[_0xd21a('0x8')]},'mohtime':{'type':Sequelize[_0xd21a('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd21a('0x1')]},'amaflags':{'type':Sequelize[_0xd21a('0x1')]},'userfield':{'type':Sequelize[_0xd21a('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xd21a('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xd21a('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xd21a('0x1')]},'routeid':{'type':Sequelize[_0xd21a('0x8')]},'sipcallid':{'type':Sequelize[_0xd21a('0x1')]}}; \ No newline at end of file +var _0x142c=['exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x142c,0x8f));var _0xc142=function(_0x154c0e,_0x1390ca){_0x154c0e=_0x154c0e-0x0;var _0x2e57fe=_0x142c[_0x154c0e];return _0x2e57fe;};'use strict';var Sequelize=require(_0xc142('0x0'));module[_0xc142('0x1')]={'uniqueid':{'type':Sequelize[_0xc142('0x2')]},'type':{'type':Sequelize[_0xc142('0x3')](_0xc142('0x4'),_0xc142('0x5'),_0xc142('0x6'),_0xc142('0x7'),'outbound-fax',_0xc142('0x8'))},'tag':{'type':Sequelize[_0xc142('0x2')]},'accountcode':{'type':Sequelize[_0xc142('0x2')]},'source':{'type':Sequelize[_0xc142('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xc142('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc142('0x2')]},'destinationchannel':{'type':Sequelize[_0xc142('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc142('0x9')]},'starttime':{'type':Sequelize[_0xc142('0xa')]},'systemanswertime':{'type':Sequelize[_0xc142('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xc142('0xb')]},'billableseconds':{'type':Sequelize[_0xc142('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc142('0x2')]},'amaflags':{'type':Sequelize[_0xc142('0x2')]},'userfield':{'type':Sequelize[_0xc142('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xc142('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xc142('0x2')]},'note':{'type':Sequelize[_0xc142('0x2')]},'prefix':{'type':Sequelize[_0xc142('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xc142('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2e83f8f..b18e75a 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0xadb5,0xad));var _0x5adb=function(_0x3443ba,_0x49b414){_0x3443ba=_0x3443ba-0x0;var _0x4848c0=_0xadb5[_0x3443ba];return _0x4848c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x3e960a,_0x12b04b){_0x3e960a=_0x3e960a-0x0;var _0x259c98=_0x2032[_0x3e960a];return _0x259c98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 6527434..861daf7 100644 --- a/server/api/voiceCallReport/voiceCallReport.model.js +++ b/server/api/voiceCallReport/voiceCallReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb522=['bluebird','path','../../config/environment','exports','define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x392ab3,_0xee2828){var _0x1cb653=function(_0x1ce1df){while(--_0x1ce1df){_0x392ab3['push'](_0x392ab3['shift']());}};_0x1cb653(++_0xee2828);}(_0xb522,0x188));var _0x2b52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb522[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2b52('0x0'));var util=require(_0x2b52('0x1'));var logger=require(_0x2b52('0x2'))(_0x2b52('0x3'));var moment=require('moment');var BPromise=require(_0x2b52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b52('0x5'));var rimraf=require('rimraf');var config=require(_0x2b52('0x6'));var attributes=require('./voiceCallReport.attributes');module[_0x2b52('0x7')]=function(_0x29f858,_0x22704d){return _0x29f858[_0x2b52('0x8')](_0x2b52('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x2b52('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a5a=['../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x15eb8b,_0x4e1915){var _0x27c85f=function(_0x3c3160){while(--_0x3c3160){_0x15eb8b['push'](_0x15eb8b['shift']());}};_0x27c85f(++_0x4e1915);}(_0x4a5a,0x6e));var _0xa4a5=function(_0x43651b,_0x52119b){_0x43651b=_0x43651b-0x0;var _0x35d53c=_0x4a5a[_0x43651b];return _0x35d53c;};'use strict';var _=require(_0xa4a5('0x0'));var util=require('util');var logger=require(_0xa4a5('0x1'))(_0xa4a5('0x2'));var moment=require(_0xa4a5('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4a5('0x4'));var fs=require('fs');var path=require(_0xa4a5('0x5'));var rimraf=require(_0xa4a5('0x6'));var config=require(_0xa4a5('0x7'));var attributes=require(_0xa4a5('0x8'));module[_0xa4a5('0x9')]=function(_0x491af5,_0x4bc593){return _0x491af5[_0xa4a5('0xa')]('VoiceCallReport',attributes,{'tableName':_0xa4a5('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa4a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b39a62c..208d0fc 100644 --- a/server/api/voiceCallReport/voiceCallReport.rpc.js +++ b/server/api/voiceCallReport/voiceCallReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28ee=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','catch','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','GetVoiceCallReport','stringify','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','limit','lodash','bluebird'];(function(_0x29c629,_0x49c636){var _0x5684fc=function(_0x149595){while(--_0x149595){_0x29c629['push'](_0x29c629['shift']());}};_0x5684fc(++_0x49c636);}(_0x28ee,0x142));var _0xe28e=function(_0xf852,_0x4ddd76){_0xf852=_0xf852-0x0;var _0x5b2550=_0x28ee[_0xf852];return _0x5b2550;};'use strict';var _=require(_0xe28e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe28e('0x1'));var rs=require(_0xe28e('0x2'));var fs=require('fs');var Redis=require(_0xe28e('0x3'));var db=require(_0xe28e('0x4'))['db'];var utils=require(_0xe28e('0x5'));var logger=require('../../config/logger')(_0xe28e('0x6'));var config=require(_0xe28e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe28e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34d4bd,_0x6ac9d0,_0x4c891a){return new BPromise(function(_0x1d9b0b,_0x5c1eb7){return client[_0xe28e('0x9')](_0x34d4bd,_0x4c891a)[_0xe28e('0xa')](function(_0x28ba1a){logger['info'](_0xe28e('0xb'),_0x6ac9d0,'request\x20sent');logger[_0xe28e('0xc')](_0xe28e('0xd'),_0x6ac9d0,'request\x20sent',JSON['stringify'](_0x28ba1a));if(_0x28ba1a[_0xe28e('0xe')]){if(_0x28ba1a[_0xe28e('0xe')]['code']===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x6ac9d0,_0x28ba1a[_0xe28e('0xe')][_0xe28e('0xf')]);return _0x5c1eb7(_0x28ba1a[_0xe28e('0xe')]['message']);}logger[_0xe28e('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x6ac9d0,_0x28ba1a['error'][_0xe28e('0xf')]);return _0x1d9b0b(_0x28ba1a[_0xe28e('0xe')][_0xe28e('0xf')]);}else{logger[_0xe28e('0x10')](_0xe28e('0xb'),_0x6ac9d0,_0xe28e('0x11'));_0x1d9b0b(_0x28ba1a['result'][_0xe28e('0xf')]);}})[_0xe28e('0x12')](function(_0x26d874){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x6ac9d0,_0x26d874);_0x5c1eb7(_0x26d874);});});}exports['GetVoiceCallReport']=function(_0x567626){var _0x3eec95=this;return new Promise(function(_0x50a0e7,_0xa73071){return db[_0xe28e('0x13')][_0xe28e('0x14')]({'raw':_0x567626[_0xe28e('0x15')]?_0x567626[_0xe28e('0x15')][_0xe28e('0x16')]===undefined?!![]:![]:!![],'where':_0x567626[_0xe28e('0x15')]?_0x567626[_0xe28e('0x15')][_0xe28e('0x17')]||null:null,'attributes':_0x567626['options']?_0x567626[_0xe28e('0x15')][_0xe28e('0x18')]||null:null,'limit':_0x567626['options']?_0x567626[_0xe28e('0x15')]['limit']||null:null,'include':_0x567626[_0xe28e('0x15')]?_0x567626['options'][_0xe28e('0x19')]?_[_0xe28e('0x1a')](_0x567626[_0xe28e('0x15')][_0xe28e('0x19')],function(_0x2ff65a){return{'model':db[_0x2ff65a[_0xe28e('0x1b')]],'as':_0x2ff65a['as'],'attributes':_0x2ff65a['attributes'],'include':_0x2ff65a['include']?_[_0xe28e('0x1a')](_0x2ff65a['include'],function(_0x2c5d95){return{'model':db[_0x2c5d95[_0xe28e('0x1b')]],'as':_0x2c5d95['as'],'attributes':_0x2c5d95[_0xe28e('0x18')],'include':_0x2c5d95[_0xe28e('0x19')]?_[_0xe28e('0x1a')](_0x2c5d95[_0xe28e('0x19')],function(_0x4b84bd){return{'model':db[_0x4b84bd[_0xe28e('0x1b')]],'as':_0x4b84bd['as'],'attributes':_0x4b84bd[_0xe28e('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe28e('0xa')](function(_0x45332f){logger[_0xe28e('0x10')](_0xe28e('0x1c'),_0x567626);logger[_0xe28e('0xc')]('GetVoiceCallReport',_0x567626,JSON[_0xe28e('0x1d')](_0x45332f));_0x50a0e7(_0x45332f);})[_0xe28e('0x12')](function(_0x23e34b){logger[_0xe28e('0xe')]('GetVoiceCallReport',_0x23e34b[_0xe28e('0xf')],_0x567626);_0xa73071(_0x3eec95['error'](0x1f4,_0x23e34b[_0xe28e('0xf')]));});});};exports['CreateVoiceCallReport']=function(_0x4e936d){var _0x399f96=this;return new Promise(function(_0x30cd6f,_0x398b34){return db['VoiceCallReport'][_0xe28e('0x1e')](_0x4e936d['body'],{'raw':_0x4e936d[_0xe28e('0x15')]?_0x4e936d[_0xe28e('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xe28e('0xa')](function(_0x33c1fd){logger[_0xe28e('0x10')](_0xe28e('0x1f'),_0x4e936d);logger[_0xe28e('0xc')]('CreateVoiceCallReport',_0x4e936d,JSON[_0xe28e('0x1d')](_0x33c1fd));_0x30cd6f(_0x33c1fd);})[_0xe28e('0x12')](function(_0x273b23){logger[_0xe28e('0xe')](_0xe28e('0x1f'),_0x273b23[_0xe28e('0xf')],_0x4e936d);_0x398b34(_0x399f96[_0xe28e('0xe')](0x1f4,_0x273b23[_0xe28e('0xf')]));});});};exports[_0xe28e('0x20')]=function(_0x6a0cf9){var _0x7d293b=this;return new Promise(function(_0x352386,_0x123e73){return db[_0xe28e('0x13')][_0xe28e('0x21')](_0x6a0cf9[_0xe28e('0x22')],{'raw':_0x6a0cf9[_0xe28e('0x15')]?_0x6a0cf9['options'][_0xe28e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a0cf9[_0xe28e('0x15')]?_0x6a0cf9[_0xe28e('0x15')][_0xe28e('0x17')]||null:null,'attributes':_0x6a0cf9[_0xe28e('0x15')]?_0x6a0cf9[_0xe28e('0x15')][_0xe28e('0x18')]||null:null,'limit':_0x6a0cf9[_0xe28e('0x15')]?_0x6a0cf9[_0xe28e('0x15')][_0xe28e('0x23')]||null:null})[_0xe28e('0xa')](function(_0x3fd335){logger['info'](_0xe28e('0x20'),_0x6a0cf9);logger[_0xe28e('0xc')](_0xe28e('0x20'),_0x6a0cf9,JSON[_0xe28e('0x1d')](_0x3fd335));_0x352386(_0x3fd335);})['catch'](function(_0x56adeb){logger[_0xe28e('0xe')](_0xe28e('0x20'),_0x56adeb[_0xe28e('0xf')],_0x6a0cf9);_0x123e73(_0x7d293b[_0xe28e('0xe')](0x1f4,_0x56adeb[_0xe28e('0xf')]));});});}; \ No newline at end of file +var _0xf037=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','map','include','model','debug','catch','CreateVoiceCallReport','body','raw','UpdateVoiceCallReport','update','lodash','util','moment'];(function(_0x5d6e72,_0x5cf4a3){var _0x52d375=function(_0x1b3425){while(--_0x1b3425){_0x5d6e72['push'](_0x5d6e72['shift']());}};_0x52d375(++_0x5cf4a3);}(_0xf037,0x1e7));var _0x7f03=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xf037[_0x1e172a];return _0x96338b;};'use strict';var _=require(_0x7f03('0x0'));var util=require(_0x7f03('0x1'));var moment=require(_0x7f03('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f03('0x3'));var db=require(_0x7f03('0x4'))['db'];var utils=require(_0x7f03('0x5'));var logger=require('../../config/logger')(_0x7f03('0x6'));var config=require(_0x7f03('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7f03('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x660db7,_0x23d8ad,_0x1a740f){return new BPromise(function(_0x3af8d0,_0x18624e){return client['request'](_0x660db7,_0x1a740f)[_0x7f03('0x9')](function(_0x2fe4f7){logger[_0x7f03('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x23d8ad,_0x7f03('0xb'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x23d8ad,'request\x20sent',JSON[_0x7f03('0xc')](_0x2fe4f7));if(_0x2fe4f7[_0x7f03('0xd')]){if(_0x2fe4f7[_0x7f03('0xd')][_0x7f03('0xe')]===0x1f4){logger['error'](_0x7f03('0xf'),_0x23d8ad,_0x2fe4f7[_0x7f03('0xd')]['message']);return _0x18624e(_0x2fe4f7[_0x7f03('0xd')][_0x7f03('0x10')]);}logger[_0x7f03('0xd')](_0x7f03('0xf'),_0x23d8ad,_0x2fe4f7[_0x7f03('0xd')][_0x7f03('0x10')]);return _0x3af8d0(_0x2fe4f7[_0x7f03('0xd')][_0x7f03('0x10')]);}else{logger[_0x7f03('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x23d8ad,_0x7f03('0xb'));_0x3af8d0(_0x2fe4f7[_0x7f03('0x11')]['message']);}})['catch'](function(_0x4954b0){logger[_0x7f03('0xd')](_0x7f03('0xf'),_0x23d8ad,_0x4954b0);_0x18624e(_0x4954b0);});});}exports[_0x7f03('0x12')]=function(_0x1d2528){var _0x1dd1f1=this;return new Promise(function(_0x5e11d5,_0x4353d6){return db[_0x7f03('0x13')][_0x7f03('0x14')]({'raw':_0x1d2528['options']?_0x1d2528[_0x7f03('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1d2528[_0x7f03('0x15')]?_0x1d2528[_0x7f03('0x15')][_0x7f03('0x16')]||null:null,'attributes':_0x1d2528['options']?_0x1d2528[_0x7f03('0x15')][_0x7f03('0x17')]||null:null,'limit':_0x1d2528[_0x7f03('0x15')]?_0x1d2528[_0x7f03('0x15')][_0x7f03('0x18')]||null:null,'include':_0x1d2528['options']?_0x1d2528[_0x7f03('0x15')]['include']?_[_0x7f03('0x19')](_0x1d2528[_0x7f03('0x15')][_0x7f03('0x1a')],function(_0x1d79cc){return{'model':db[_0x1d79cc[_0x7f03('0x1b')]],'as':_0x1d79cc['as'],'attributes':_0x1d79cc[_0x7f03('0x17')],'include':_0x1d79cc[_0x7f03('0x1a')]?_[_0x7f03('0x19')](_0x1d79cc[_0x7f03('0x1a')],function(_0x27121e){return{'model':db[_0x27121e[_0x7f03('0x1b')]],'as':_0x27121e['as'],'attributes':_0x27121e['attributes'],'include':_0x27121e['include']?_[_0x7f03('0x19')](_0x27121e[_0x7f03('0x1a')],function(_0x301b99){return{'model':db[_0x301b99['model']],'as':_0x301b99['as'],'attributes':_0x301b99[_0x7f03('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x314c1f){logger['info'](_0x7f03('0x12'),_0x1d2528);logger[_0x7f03('0x1c')](_0x7f03('0x12'),_0x1d2528,JSON[_0x7f03('0xc')](_0x314c1f));_0x5e11d5(_0x314c1f);})[_0x7f03('0x1d')](function(_0x1fb0c1){logger[_0x7f03('0xd')]('GetVoiceCallReport',_0x1fb0c1[_0x7f03('0x10')],_0x1d2528);_0x4353d6(_0x1dd1f1['error'](0x1f4,_0x1fb0c1[_0x7f03('0x10')]));});});};exports[_0x7f03('0x1e')]=function(_0x51f3ab){var _0x5bde3f=this;return new Promise(function(_0xd8534e,_0x1ffd3a){return db['VoiceCallReport']['create'](_0x51f3ab[_0x7f03('0x1f')],{'raw':_0x51f3ab[_0x7f03('0x15')]?_0x51f3ab['options'][_0x7f03('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x27b196){logger[_0x7f03('0xa')](_0x7f03('0x1e'),_0x51f3ab);logger['debug'](_0x7f03('0x1e'),_0x51f3ab,JSON[_0x7f03('0xc')](_0x27b196));_0xd8534e(_0x27b196);})[_0x7f03('0x1d')](function(_0x39e20c){logger[_0x7f03('0xd')](_0x7f03('0x1e'),_0x39e20c[_0x7f03('0x10')],_0x51f3ab);_0x1ffd3a(_0x5bde3f[_0x7f03('0xd')](0x1f4,_0x39e20c[_0x7f03('0x10')]));});});};exports[_0x7f03('0x21')]=function(_0x39be41){var _0x278e5d=this;return new Promise(function(_0x2f37d1,_0x28f34f){return db['VoiceCallReport'][_0x7f03('0x22')](_0x39be41['body'],{'raw':_0x39be41[_0x7f03('0x15')]?_0x39be41[_0x7f03('0x15')][_0x7f03('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39be41[_0x7f03('0x15')]?_0x39be41[_0x7f03('0x15')][_0x7f03('0x16')]||null:null,'attributes':_0x39be41[_0x7f03('0x15')]?_0x39be41['options'][_0x7f03('0x17')]||null:null,'limit':_0x39be41[_0x7f03('0x15')]?_0x39be41[_0x7f03('0x15')]['limit']||null:null})['then'](function(_0x19ed2c){logger[_0x7f03('0xa')](_0x7f03('0x21'),_0x39be41);logger[_0x7f03('0x1c')](_0x7f03('0x21'),_0x39be41,JSON['stringify'](_0x19ed2c));_0x2f37d1(_0x19ed2c);})[_0x7f03('0x1d')](function(_0x2f186e){logger[_0x7f03('0xd')](_0x7f03('0x21'),_0x2f186e[_0x7f03('0x10')],_0x39be41);_0x28f34f(_0x278e5d[_0x7f03('0xd')](0x1f4,_0x2f186e[_0x7f03('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b947c42..057491f 100644 --- a/server/api/voiceChanSpy/index.js +++ b/server/api/voiceChanSpy/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x747b=['/:id','create','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index'];(function(_0x4cb0e3,_0x5e0445){var _0x46ea93=function(_0x4030d0){while(--_0x4030d0){_0x4cb0e3['push'](_0x4cb0e3['shift']());}};_0x46ea93(++_0x5e0445);}(_0x747b,0x12f));var _0xb747=function(_0x562677,_0x24729f){_0x562677=_0x562677-0x0;var _0x59975e=_0x747b[_0x562677];return _0x59975e;};'use strict';var multer=require(_0xb747('0x0'));var util=require(_0xb747('0x1'));var path=require(_0xb747('0x2'));var timeout=require(_0xb747('0x3'));var express=require(_0xb747('0x4'));var router=express['Router']();var fs_extra=require(_0xb747('0x5'));var auth=require(_0xb747('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb747('0x7'));var controller=require(_0xb747('0x8'));router[_0xb747('0x9')]('/',auth[_0xb747('0xa')](),controller[_0xb747('0xb')]);router[_0xb747('0x9')](_0xb747('0xc'),auth[_0xb747('0xa')](),controller['show']);router['post']('/',auth[_0xb747('0xa')](),controller[_0xb747('0xd')]);router['put'](_0xb747('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb747('0xe')](_0xb747('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7953=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x1d9a84,_0x157084){var _0x418754=function(_0xfc0e01){while(--_0xfc0e01){_0x1d9a84['push'](_0x1d9a84['shift']());}};_0x418754(++_0x157084);}(_0x7953,0x1cd));var _0x3795=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x7953[_0x49d19d];return _0x4ebef1;};'use strict';var multer=require(_0x3795('0x0'));var util=require(_0x3795('0x1'));var path=require('path');var timeout=require(_0x3795('0x2'));var express=require('express');var router=express[_0x3795('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3795('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3795('0x5'));router[_0x3795('0x6')]('/',auth[_0x3795('0x7')](),controller[_0x3795('0x8')]);router[_0x3795('0x6')](_0x3795('0x9'),auth['isAuthenticated'](),controller[_0x3795('0xa')]);router[_0x3795('0xb')]('/',auth['isAuthenticated'](),controller[_0x3795('0xc')]);router['put'](_0x3795('0x9'),auth[_0x3795('0x7')](),controller[_0x3795('0xd')]);router[_0x3795('0xe')](_0x3795('0x9'),auth['isAuthenticated'](),controller[_0x3795('0xf')]);module[_0x3795('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index f85da1b..ef087b2 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.attributes.js +++ b/server/api/voiceChanSpy/voiceChanSpy.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e92=['sequelize','exports','STRING','name','setDataValue','options','getDataValue','BOOLEAN'];(function(_0x3a6f93,_0xc83f4e){var _0x35004a=function(_0x45f5b8){while(--_0x45f5b8){_0x3a6f93['push'](_0x3a6f93['shift']());}};_0x35004a(++_0xc83f4e);}(_0x8e92,0xc0));var _0x28e9=function(_0x244a33,_0x25171b){_0x244a33=_0x244a33-0x0;var _0x1d599a=_0x8e92[_0x244a33];return _0x1d599a;};'use strict';var Sequelize=require(_0x28e9('0x0'));module[_0x28e9('0x1')]={'name':{'type':Sequelize[_0x28e9('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x28e9('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x28e9('0x2')],'set':function(_0x3ef499){this[_0x28e9('0x4')](_0x28e9('0x5'),_0x3ef499?_0x3ef499['join'](''):[]);},'get':function(){return this[_0x28e9('0x6')](_0x28e9('0x5'))?this[_0x28e9('0x6')](_0x28e9('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0x28e9('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x28e9('0x2')]},'record':{'type':Sequelize[_0x28e9('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x28e9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7f48=['options','BOOLEAN','STRING','name','setDataValue','join','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f48,0x144));var _0x87f4=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0x7f48[_0x96f74c];return _0x379222;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x87f4('0x0')],'unique':_0x87f4('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x87f4('0x0')],'set':function(_0x14bcfb){this[_0x87f4('0x2')]('options',_0x14bcfb?_0x14bcfb[_0x87f4('0x3')](''):[]);},'get':function(){return this[_0x87f4('0x4')](_0x87f4('0x5'))?this[_0x87f4('0x4')](_0x87f4('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0x87f4('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x87f4('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x87f4('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d583a40..ead51b3 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.controller.js +++ b/server/api/voiceChanSpy/voiceChanSpy.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb76=['nolimit','order','sort','where','filters','pick','filter','type','merge','includeAll','include','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','end','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','intersection','fields','length','attributes'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0xdb76,0x1be));var _0x6db7=function(_0x512135,_0x4ddf4b){_0x512135=_0x512135-0x0;var _0x3accb1=_0xdb76[_0x512135];return _0x3accb1;};'use strict';var emlformat=require(_0x6db7('0x0'));var rimraf=require(_0x6db7('0x1'));var zipdir=require(_0x6db7('0x2'));var jsonpatch=require(_0x6db7('0x3'));var rp=require(_0x6db7('0x4'));var moment=require('moment');var BPromise=require(_0x6db7('0x5'));var Mustache=require(_0x6db7('0x6'));var util=require(_0x6db7('0x7'));var path=require(_0x6db7('0x8'));var sox=require('sox');var csv=require(_0x6db7('0x9'));var ejs=require(_0x6db7('0xa'));var fs=require('fs');var fs_extra=require(_0x6db7('0xb'));var _=require(_0x6db7('0xc'));var squel=require(_0x6db7('0xd'));var crypto=require('crypto');var jsforce=require(_0x6db7('0xe'));var deskjs=require(_0x6db7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6db7('0x10'));var Papa=require(_0x6db7('0x11'));var Redis=require(_0x6db7('0x12'));var authService=require(_0x6db7('0x13'));var qs=require(_0x6db7('0x14'));var as=require(_0x6db7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6db7('0x16'));var utils=require(_0x6db7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6db7('0x18'));var db=require(_0x6db7('0x19'))['db'];function respondWithStatusCode(_0x421d28,_0x1658dd){_0x1658dd=_0x1658dd||0xcc;return function(_0x375f4a){if(_0x375f4a){return _0x421d28[_0x6db7('0x1a')](_0x1658dd);}return _0x421d28['status'](_0x1658dd)['end']();};}function respondWithResult(_0x426d31,_0x348ccf){_0x348ccf=_0x348ccf||0xc8;return function(_0x167384){if(_0x167384){return _0x426d31[_0x6db7('0x1b')](_0x348ccf)[_0x6db7('0x1c')](_0x167384);}};}function respondWithFilteredResult(_0x28dd67,_0x144684){return function(_0x43f66c){if(_0x43f66c){var _0x1432ac=typeof _0x144684[_0x6db7('0x1d')]===_0x6db7('0x1e')&&typeof _0x144684[_0x6db7('0x1f')]==='undefined';var _0x3c97b2=_0x43f66c[_0x6db7('0x20')];var _0x331e92=_0x1432ac?0x0:_0x144684[_0x6db7('0x1d')];var _0x37ffe3=_0x1432ac?_0x43f66c[_0x6db7('0x20')]:_0x144684[_0x6db7('0x1d')]+_0x144684[_0x6db7('0x1f')];var _0x3f8575;if(_0x37ffe3>=_0x3c97b2){_0x37ffe3=_0x3c97b2;_0x3f8575=0xc8;}else{_0x3f8575=0xce;}_0x28dd67[_0x6db7('0x1b')](_0x3f8575);return _0x28dd67[_0x6db7('0x21')](_0x6db7('0x22'),_0x331e92+'-'+_0x37ffe3+'/'+_0x3c97b2)['json'](_0x43f66c);}return null;};}function patchUpdates(_0x1cae66){return function(_0x206aa2){try{jsonpatch[_0x6db7('0x23')](_0x206aa2,_0x1cae66,!![]);}catch(_0x46a383){return BPromise[_0x6db7('0x24')](_0x46a383);}return _0x206aa2[_0x6db7('0x25')]();};}function saveUpdates(_0x4a78f7,_0x1b0f04){return function(_0x2795ab){if(_0x2795ab){return _0x2795ab['update'](_0x4a78f7)[_0x6db7('0x26')](function(_0x1ba956){return _0x1ba956;});}return null;};}function removeEntity(_0x7ca54f,_0x48e3af){return function(_0x24d818){if(_0x24d818){return _0x24d818[_0x6db7('0x27')]()['then'](function(){var _0x24d7bd=_0x24d818[_0x6db7('0x28')]({'plain':!![]});var _0x2d6fca='ChanSpies';return db['UserProfileResource'][_0x6db7('0x27')]({'where':{'type':_0x2d6fca,'resourceId':_0x24d7bd['id']}})[_0x6db7('0x26')](function(){return _0x24d818;});})[_0x6db7('0x26')](function(){_0x7ca54f['status'](0xcc)[_0x6db7('0x29')]();});}};}function handleEntityNotFound(_0x2cd80d,_0x4d569b){return function(_0x47c090){if(!_0x47c090){_0x2cd80d[_0x6db7('0x1a')](0x194);}return _0x47c090;};}function handleError(_0x359eac,_0x2e2912){_0x2e2912=_0x2e2912||0x1f4;return function(_0x3890f0){logger[_0x6db7('0x2a')](_0x3890f0[_0x6db7('0x2b')]);if(_0x3890f0['name']){delete _0x3890f0[_0x6db7('0x2c')];}_0x359eac[_0x6db7('0x1b')](_0x2e2912)['send'](_0x3890f0);};}exports[_0x6db7('0x2d')]=function(_0x4f068e,_0xbff04f){var _0x554f49={},_0x16fa40={},_0x372794={'count':0x0,'rows':[]};var _0x5da739=_[_0x6db7('0x2e')](db[_0x6db7('0x2f')][_0x6db7('0x30')],function(_0x1841ff){return{'name':_0x1841ff[_0x6db7('0x31')],'type':_0x1841ff['type'][_0x6db7('0x32')]};});_0x16fa40[_0x6db7('0x33')]=_[_0x6db7('0x2e')](_0x5da739,'name');_0x16fa40[_0x6db7('0x34')]=_[_0x6db7('0x35')](_0x4f068e[_0x6db7('0x34')]);_0x16fa40['filters']=_[_0x6db7('0x36')](_0x16fa40['model'],_0x16fa40[_0x6db7('0x34')]);_0x554f49['attributes']=_['intersection'](_0x16fa40[_0x6db7('0x33')],qs[_0x6db7('0x37')](_0x4f068e[_0x6db7('0x34')][_0x6db7('0x37')]));_0x554f49['attributes']=_0x554f49['attributes'][_0x6db7('0x38')]?_0x554f49[_0x6db7('0x39')]:_0x16fa40['model'];if(!_0x4f068e[_0x6db7('0x34')]['hasOwnProperty'](_0x6db7('0x3a'))){_0x554f49['limit']=qs[_0x6db7('0x1f')](_0x4f068e['query']['limit']);_0x554f49[_0x6db7('0x1d')]=qs[_0x6db7('0x1d')](_0x4f068e[_0x6db7('0x34')][_0x6db7('0x1d')]);}_0x554f49[_0x6db7('0x3b')]=qs['sort'](_0x4f068e[_0x6db7('0x34')][_0x6db7('0x3c')]);_0x554f49[_0x6db7('0x3d')]=qs[_0x6db7('0x3e')](_[_0x6db7('0x3f')](_0x4f068e[_0x6db7('0x34')],_0x16fa40['filters']),_0x5da739);if(_0x4f068e[_0x6db7('0x34')][_0x6db7('0x40')]){_0x554f49[_0x6db7('0x3d')]=_['merge'](_0x554f49[_0x6db7('0x3d')],{'$or':_['map'](_0x5da739,function(_0x1e677b){if(_0x1e677b[_0x6db7('0x41')]!=='VIRTUAL'){var _0x3915eb={};_0x3915eb[_0x1e677b['name']]={'$like':'%'+_0x4f068e[_0x6db7('0x34')]['filter']+'%'};return _0x3915eb;}})});}_0x554f49=_[_0x6db7('0x42')]({},_0x554f49,_0x4f068e['options']);var _0x27c98b={'where':_0x554f49['where']};return db[_0x6db7('0x2f')]['count'](_0x27c98b)[_0x6db7('0x26')](function(_0xf9fb55){_0x372794[_0x6db7('0x20')]=_0xf9fb55;if(_0x4f068e['query'][_0x6db7('0x43')]){_0x554f49[_0x6db7('0x44')]=[{'all':!![]}];}return db[_0x6db7('0x2f')]['findAll'](_0x554f49);})[_0x6db7('0x26')](function(_0x1c495b){_0x372794[_0x6db7('0x45')]=_0x1c495b;return _0x372794;})[_0x6db7('0x26')](respondWithFilteredResult(_0xbff04f,_0x554f49))[_0x6db7('0x46')](handleError(_0xbff04f,null));};exports[_0x6db7('0x47')]=function(_0x537835,_0xba867){var _0x32a746={'raw':![],'where':{'id':_0x537835['params']['id']}},_0x51c644={};_0x51c644[_0x6db7('0x33')]=_[_0x6db7('0x35')](db[_0x6db7('0x2f')]['rawAttributes']);_0x51c644[_0x6db7('0x34')]=_[_0x6db7('0x35')](_0x537835[_0x6db7('0x34')]);_0x51c644[_0x6db7('0x3e')]=_[_0x6db7('0x36')](_0x51c644['model'],_0x51c644[_0x6db7('0x34')]);_0x32a746[_0x6db7('0x39')]=_[_0x6db7('0x36')](_0x51c644['model'],qs['fields'](_0x537835[_0x6db7('0x34')]['fields']));_0x32a746[_0x6db7('0x39')]=_0x32a746[_0x6db7('0x39')]['length']?_0x32a746['attributes']:_0x51c644[_0x6db7('0x33')];if(_0x537835[_0x6db7('0x34')][_0x6db7('0x43')]){_0x32a746[_0x6db7('0x44')]=[{'all':!![]}];}_0x32a746=_[_0x6db7('0x42')]({},_0x32a746,_0x537835[_0x6db7('0x48')]);return db[_0x6db7('0x2f')][_0x6db7('0x49')](_0x32a746)['then'](handleEntityNotFound(_0xba867,null))[_0x6db7('0x26')](respondWithResult(_0xba867,null))[_0x6db7('0x46')](handleError(_0xba867,null));};exports[_0x6db7('0x4a')]=function(_0x4a8c78,_0x48b8a7){return db[_0x6db7('0x2f')][_0x6db7('0x4a')](_0x4a8c78[_0x6db7('0x4b')],{})[_0x6db7('0x26')](function(_0x1bc12c){var _0x3825a7=_0x4a8c78[_0x6db7('0x4c')]['get']({'plain':!![]});if(!_0x3825a7)throw new Error(_0x6db7('0x4d'));if(_0x3825a7[_0x6db7('0x4e')]===_0x6db7('0x4c')){var _0x3ca942=_0x1bc12c['get']({'plain':!![]});var _0x30258d=_0x6db7('0x4f');return db[_0x6db7('0x50')][_0x6db7('0x49')]({'where':{'name':_0x30258d,'userProfileId':_0x3825a7['userProfileId']},'raw':!![]})[_0x6db7('0x26')](function(_0xff3887){if(_0xff3887&&_0xff3887['autoAssociation']===0x0){return db['UserProfileResource'][_0x6db7('0x4a')]({'name':_0x3ca942['name'],'resourceId':_0x3ca942['id'],'type':_0xff3887[_0x6db7('0x2c')],'sectionId':_0xff3887['id']},{})['then'](function(){return _0x1bc12c;});}else{return _0x1bc12c;}})[_0x6db7('0x46')](function(_0x5ce9f3){logger['error'](_0x6db7('0x51'),_0x5ce9f3);throw _0x5ce9f3;});}return _0x1bc12c;})[_0x6db7('0x26')](respondWithResult(_0x48b8a7,0xc9))[_0x6db7('0x46')](handleError(_0x48b8a7,null));};exports[_0x6db7('0x52')]=function(_0x1f7a0f,_0x1b2c4f){if(_0x1f7a0f['body']['id']){delete _0x1f7a0f[_0x6db7('0x4b')]['id'];}return db[_0x6db7('0x2f')][_0x6db7('0x49')]({'where':{'id':_0x1f7a0f[_0x6db7('0x53')]['id']}})[_0x6db7('0x26')](handleEntityNotFound(_0x1b2c4f,null))['then'](saveUpdates(_0x1f7a0f[_0x6db7('0x4b')],null))[_0x6db7('0x26')](respondWithResult(_0x1b2c4f,null))[_0x6db7('0x46')](handleError(_0x1b2c4f,null));};exports[_0x6db7('0x27')]=function(_0x422030,_0x34dd9a){return db[_0x6db7('0x2f')][_0x6db7('0x49')]({'where':{'id':_0x422030[_0x6db7('0x53')]['id']}})[_0x6db7('0x26')](handleEntityNotFound(_0x34dd9a,null))['then'](removeEntity(_0x34dd9a,null))['catch'](handleError(_0x34dd9a,null));}; \ No newline at end of file +var _0x8ba2=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','update','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x411a9b,_0x5868ee){var _0x437505=function(_0x2bd719){while(--_0x2bd719){_0x411a9b['push'](_0x411a9b['shift']());}};_0x437505(++_0x5868ee);}(_0x8ba2,0x13f));var _0x28ba=function(_0x1b9ccc,_0x5d7607){_0x1b9ccc=_0x1b9ccc-0x0;var _0x42988f=_0x8ba2[_0x1b9ccc];return _0x42988f;};'use strict';var emlformat=require(_0x28ba('0x0'));var rimraf=require(_0x28ba('0x1'));var zipdir=require(_0x28ba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28ba('0x3'));var moment=require(_0x28ba('0x4'));var BPromise=require(_0x28ba('0x5'));var Mustache=require('mustache');var util=require(_0x28ba('0x6'));var path=require(_0x28ba('0x7'));var sox=require(_0x28ba('0x8'));var csv=require(_0x28ba('0x9'));var ejs=require(_0x28ba('0xa'));var fs=require('fs');var fs_extra=require(_0x28ba('0xb'));var _=require('lodash');var squel=require(_0x28ba('0xc'));var crypto=require(_0x28ba('0xd'));var jsforce=require(_0x28ba('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x28ba('0x9'));var querystring=require(_0x28ba('0xf'));var Papa=require(_0x28ba('0x10'));var Redis=require(_0x28ba('0x11'));var authService=require(_0x28ba('0x12'));var qs=require(_0x28ba('0x13'));var as=require(_0x28ba('0x14'));var hardwareService=require(_0x28ba('0x15'));var logger=require(_0x28ba('0x16'))(_0x28ba('0x17'));var utils=require('../../config/utils');var config=require(_0x28ba('0x18'));var licenseUtil=require(_0x28ba('0x19'));var db=require(_0x28ba('0x1a'))['db'];function respondWithStatusCode(_0x299f63,_0x1204af){_0x1204af=_0x1204af||0xcc;return function(_0x3a9644){if(_0x3a9644){return _0x299f63[_0x28ba('0x1b')](_0x1204af);}return _0x299f63['status'](_0x1204af)[_0x28ba('0x1c')]();};}function respondWithResult(_0x3cf923,_0x4ebcd6){_0x4ebcd6=_0x4ebcd6||0xc8;return function(_0x29cd51){if(_0x29cd51){return _0x3cf923[_0x28ba('0x1d')](_0x4ebcd6)[_0x28ba('0x1e')](_0x29cd51);}};}function respondWithFilteredResult(_0x1c5998,_0x563797){return function(_0x24b3f3){if(_0x24b3f3){var _0x38df4f=typeof _0x563797[_0x28ba('0x1f')]===_0x28ba('0x20')&&typeof _0x563797[_0x28ba('0x21')]==='undefined';var _0x571c92=_0x24b3f3[_0x28ba('0x22')];var _0x182824=_0x38df4f?0x0:_0x563797[_0x28ba('0x1f')];var _0x2cf1cf=_0x38df4f?_0x24b3f3[_0x28ba('0x22')]:_0x563797[_0x28ba('0x1f')]+_0x563797[_0x28ba('0x21')];var _0x31a45b;if(_0x2cf1cf>=_0x571c92){_0x2cf1cf=_0x571c92;_0x31a45b=0xc8;}else{_0x31a45b=0xce;}_0x1c5998[_0x28ba('0x1d')](_0x31a45b);return _0x1c5998['set']('Content-Range',_0x182824+'-'+_0x2cf1cf+'/'+_0x571c92)[_0x28ba('0x1e')](_0x24b3f3);}return null;};}function patchUpdates(_0x4352a4){return function(_0x5d3d33){try{jsonpatch['apply'](_0x5d3d33,_0x4352a4,!![]);}catch(_0xf9e0f4){return BPromise[_0x28ba('0x23')](_0xf9e0f4);}return _0x5d3d33[_0x28ba('0x24')]();};}function saveUpdates(_0x17b1f4,_0x425732){return function(_0x4ff05c){if(_0x4ff05c){return _0x4ff05c[_0x28ba('0x25')](_0x17b1f4)[_0x28ba('0x26')](function(_0x1684af){return _0x1684af;});}return null;};}function removeEntity(_0x3eec5d,_0x27a579){return function(_0x256892){if(_0x256892){return _0x256892['destroy']()[_0x28ba('0x26')](function(){var _0x46969a=_0x256892[_0x28ba('0x27')]({'plain':!![]});var _0x1d3fd1=_0x28ba('0x28');return db[_0x28ba('0x29')]['destroy']({'where':{'type':_0x1d3fd1,'resourceId':_0x46969a['id']}})[_0x28ba('0x26')](function(){return _0x256892;});})[_0x28ba('0x26')](function(){_0x3eec5d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36dc29,_0x3e1ce7){return function(_0x5b9237){if(!_0x5b9237){_0x36dc29['sendStatus'](0x194);}return _0x5b9237;};}function handleError(_0x4267b4,_0x3638c5){_0x3638c5=_0x3638c5||0x1f4;return function(_0x39cd83){logger[_0x28ba('0x2a')](_0x39cd83[_0x28ba('0x2b')]);if(_0x39cd83[_0x28ba('0x2c')]){delete _0x39cd83[_0x28ba('0x2c')];}_0x4267b4[_0x28ba('0x1d')](_0x3638c5)[_0x28ba('0x2d')](_0x39cd83);};}exports[_0x28ba('0x2e')]=function(_0x296b66,_0x32ab4b){var _0x27737d={},_0x2c712e={},_0x5f0202={'count':0x0,'rows':[]};var _0x13dfd4=_[_0x28ba('0x2f')](db[_0x28ba('0x30')]['rawAttributes'],function(_0x2c32f3){return{'name':_0x2c32f3[_0x28ba('0x31')],'type':_0x2c32f3[_0x28ba('0x32')]['key']};});_0x2c712e[_0x28ba('0x33')]=_[_0x28ba('0x2f')](_0x13dfd4,_0x28ba('0x2c'));_0x2c712e[_0x28ba('0x34')]=_[_0x28ba('0x35')](_0x296b66[_0x28ba('0x34')]);_0x2c712e[_0x28ba('0x36')]=_[_0x28ba('0x37')](_0x2c712e[_0x28ba('0x33')],_0x2c712e[_0x28ba('0x34')]);_0x27737d['attributes']=_[_0x28ba('0x37')](_0x2c712e[_0x28ba('0x33')],qs[_0x28ba('0x38')](_0x296b66['query'][_0x28ba('0x38')]));_0x27737d[_0x28ba('0x39')]=_0x27737d[_0x28ba('0x39')][_0x28ba('0x3a')]?_0x27737d[_0x28ba('0x39')]:_0x2c712e[_0x28ba('0x33')];if(!_0x296b66[_0x28ba('0x34')][_0x28ba('0x3b')](_0x28ba('0x3c'))){_0x27737d[_0x28ba('0x21')]=qs[_0x28ba('0x21')](_0x296b66[_0x28ba('0x34')]['limit']);_0x27737d['offset']=qs['offset'](_0x296b66[_0x28ba('0x34')][_0x28ba('0x1f')]);}_0x27737d['order']=qs[_0x28ba('0x3d')](_0x296b66[_0x28ba('0x34')]['sort']);_0x27737d['where']=qs[_0x28ba('0x36')](_[_0x28ba('0x3e')](_0x296b66['query'],_0x2c712e['filters']),_0x13dfd4);if(_0x296b66[_0x28ba('0x34')][_0x28ba('0x3f')]){_0x27737d[_0x28ba('0x40')]=_[_0x28ba('0x41')](_0x27737d[_0x28ba('0x40')],{'$or':_[_0x28ba('0x2f')](_0x13dfd4,function(_0x241a4a){if(_0x241a4a[_0x28ba('0x32')]!==_0x28ba('0x42')){var _0x5b0174={};_0x5b0174[_0x241a4a['name']]={'$like':'%'+_0x296b66['query'][_0x28ba('0x3f')]+'%'};return _0x5b0174;}})});}_0x27737d=_[_0x28ba('0x41')]({},_0x27737d,_0x296b66[_0x28ba('0x43')]);var _0x2f5ce4={'where':_0x27737d[_0x28ba('0x40')]};return db['VoiceChanSpy']['count'](_0x2f5ce4)['then'](function(_0x424f73){_0x5f0202[_0x28ba('0x22')]=_0x424f73;if(_0x296b66[_0x28ba('0x34')][_0x28ba('0x44')]){_0x27737d[_0x28ba('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x28ba('0x46')](_0x27737d);})[_0x28ba('0x26')](function(_0x364b7a){_0x5f0202[_0x28ba('0x47')]=_0x364b7a;return _0x5f0202;})[_0x28ba('0x26')](respondWithFilteredResult(_0x32ab4b,_0x27737d))[_0x28ba('0x48')](handleError(_0x32ab4b,null));};exports[_0x28ba('0x49')]=function(_0x1c12f4,_0x213497){var _0x4c550c={'raw':![],'where':{'id':_0x1c12f4[_0x28ba('0x4a')]['id']}},_0x53f882={};_0x53f882[_0x28ba('0x33')]=_[_0x28ba('0x35')](db[_0x28ba('0x30')][_0x28ba('0x4b')]);_0x53f882['query']=_['keys'](_0x1c12f4['query']);_0x53f882['filters']=_[_0x28ba('0x37')](_0x53f882[_0x28ba('0x33')],_0x53f882[_0x28ba('0x34')]);_0x4c550c[_0x28ba('0x39')]=_[_0x28ba('0x37')](_0x53f882[_0x28ba('0x33')],qs['fields'](_0x1c12f4[_0x28ba('0x34')][_0x28ba('0x38')]));_0x4c550c['attributes']=_0x4c550c['attributes'][_0x28ba('0x3a')]?_0x4c550c['attributes']:_0x53f882[_0x28ba('0x33')];if(_0x1c12f4[_0x28ba('0x34')]['includeAll']){_0x4c550c[_0x28ba('0x45')]=[{'all':!![]}];}_0x4c550c=_['merge']({},_0x4c550c,_0x1c12f4[_0x28ba('0x43')]);return db['VoiceChanSpy'][_0x28ba('0x4c')](_0x4c550c)[_0x28ba('0x26')](handleEntityNotFound(_0x213497,null))[_0x28ba('0x26')](respondWithResult(_0x213497,null))[_0x28ba('0x48')](handleError(_0x213497,null));};exports[_0x28ba('0x4d')]=function(_0x4047c1,_0x5ccfab){return db[_0x28ba('0x30')]['create'](_0x4047c1['body'],{})[_0x28ba('0x26')](function(_0xd327ac){var _0x21931b=_0x4047c1[_0x28ba('0x4e')]['get']({'plain':!![]});if(!_0x21931b)throw new Error(_0x28ba('0x4f'));if(_0x21931b['role']==='user'){var _0x38bf5b=_0xd327ac[_0x28ba('0x27')]({'plain':!![]});var _0xf0938f=_0x28ba('0x28');return db[_0x28ba('0x50')][_0x28ba('0x4c')]({'where':{'name':_0xf0938f,'userProfileId':_0x21931b[_0x28ba('0x51')]},'raw':!![]})[_0x28ba('0x26')](function(_0x5aac05){if(_0x5aac05&&_0x5aac05[_0x28ba('0x52')]===0x0){return db[_0x28ba('0x29')][_0x28ba('0x4d')]({'name':_0x38bf5b[_0x28ba('0x2c')],'resourceId':_0x38bf5b['id'],'type':_0x5aac05[_0x28ba('0x2c')],'sectionId':_0x5aac05['id']},{})['then'](function(){return _0xd327ac;});}else{return _0xd327ac;}})[_0x28ba('0x48')](function(_0x2ec307){logger[_0x28ba('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ec307);throw _0x2ec307;});}return _0xd327ac;})[_0x28ba('0x26')](respondWithResult(_0x5ccfab,0xc9))[_0x28ba('0x48')](handleError(_0x5ccfab,null));};exports[_0x28ba('0x25')]=function(_0x4f5a05,_0x23e1fc){if(_0x4f5a05['body']['id']){delete _0x4f5a05[_0x28ba('0x53')]['id'];}return db[_0x28ba('0x30')]['find']({'where':{'id':_0x4f5a05[_0x28ba('0x4a')]['id']}})[_0x28ba('0x26')](handleEntityNotFound(_0x23e1fc,null))[_0x28ba('0x26')](saveUpdates(_0x4f5a05[_0x28ba('0x53')],null))[_0x28ba('0x26')](respondWithResult(_0x23e1fc,null))[_0x28ba('0x48')](handleError(_0x23e1fc,null));};exports[_0x28ba('0x54')]=function(_0x2131b8,_0x24bdd6){return db[_0x28ba('0x30')][_0x28ba('0x4c')]({'where':{'id':_0x2131b8['params']['id']}})[_0x28ba('0x26')](handleEntityNotFound(_0x24bdd6,null))[_0x28ba('0x26')](removeEntity(_0x24bdd6,null))[_0x28ba('0x48')](handleError(_0x24bdd6,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f02c219..9fdab55 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.model.js +++ b/server/api/voiceChanSpy/voiceChanSpy.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x834e=['catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','prefix','push','merge','format','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','length','internal','User','findAll','agent','then','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate'];(function(_0x435056,_0x1f7040){var _0x47d97f=function(_0x12c749){while(--_0x12c749){_0x435056['push'](_0x435056['shift']());}};_0x47d97f(++_0x1f7040);}(_0x834e,0x19a));var _0xe834=function(_0x146b09,_0x345cd3){_0x146b09=_0x146b09-0x0;var _0x4e9e36=_0x834e[_0x146b09];return _0x4e9e36;};'use strict';var _=require(_0xe834('0x0'));var util=require(_0xe834('0x1'));var BPromise=require(_0xe834('0x2'));var attributes=require(_0xe834('0x3'));var getUserApplications=function(_0x34a300,_0x108720,_0x218c18){var _0xe22de0=0x1;var _0x8ae18f=[];var _0xe8e23c={'context':_0x108720['context']||_0xe834('0x4'),'exten':util['format']('%s%s',_0x34a300[_0xe834('0x5')],_0x218c18),'type':'system','isApp':![],'ChanSpyId':_0x34a300['id'],'UserId':_0x108720['id']};_0x8ae18f[_0xe834('0x6')](_[_0xe834('0x7')]({'app':'Set','appdata':util[_0xe834('0x8')]('CDR(type)=%s',_0xe834('0x9')),'priority':_0xe22de0++},_0xe8e23c));if(_0x34a300[_0xe834('0xa')]){_0x8ae18f[_0xe834('0x6')](_['merge']({'app':_0xe834('0xb'),'appdata':util[_0xe834('0x8')](_0xe834('0xc'),_0x34a300[_0xe834('0xd')]),'priority':_0xe22de0++},_0xe8e23c));}if(_0x34a300['auth']){_0x8ae18f[_0xe834('0x6')](_[_0xe834('0x7')]({'app':_0xe834('0xe'),'appdata':_0x34a300['password'],'priority':_0xe22de0++},_0xe8e23c));}_0x8ae18f[_0xe834('0x6')](_['merge']({'app':_0xe834('0xf'),'appdata':util[_0xe834('0x8')](_0xe834('0x10'),_0x108720[_0xe834('0x11')],_0x34a300[_0xe834('0x12')]?_0x34a300['options'][_0xe834('0x13')](''):''),'priority':_0xe22de0++},_0xe8e23c));if(_0x34a300[_0xe834('0xa')]){_0x8ae18f[_0xe834('0x6')](_[_0xe834('0x7')]({'app':'StopMixMonitor','priority':_0xe22de0++},_0xe8e23c));}return _0x8ae18f;};var getChanSpyApplications=function(_0x56ca96,_0x10dca2){var _0x8ebd83=[];for(var _0x46ab3b=0x0,_0x20d158=0x1;_0x46ab3b<_0x10dca2[_0xe834('0x14')];_0x46ab3b++,_0x20d158=0x1){_0x8ebd83=_0x8ebd83['concat'](getUserApplications(_0x56ca96,_0x10dca2[_0x46ab3b],_0x10dca2[_0x46ab3b][_0xe834('0x15')]));if(_0x10dca2[_0x46ab3b][_0xe834('0x15')]!=_0x10dca2[_0x46ab3b][_0xe834('0x11')]){_0x8ebd83=_0x8ebd83['concat'](getUserApplications(_0x56ca96,_0x10dca2[_0x46ab3b],_0x10dca2[_0x46ab3b][_0xe834('0x11')]));}}return _0x8ebd83;};var getChanSpyPromise=function(_0x1a6a87,_0x388b5d){return new BPromise(function(_0x234bd8,_0x5a15d5){return _0x1a6a87[_0xe834('0x16')][_0xe834('0x17')]({'attributes':['id','name',_0xe834('0x15')],'where':{'role':_0xe834('0x18'),'chanspy':!![]},'raw':!![]})[_0xe834('0x19')](function(_0x10a4d6){if(_0x10a4d6){return _0x234bd8(getChanSpyApplications(_0x388b5d,_0x10a4d6));}return _0x234bd8([]);})['catch'](function(_0xa0df9e){_0x5a15d5(_0xa0df9e);});});};module[_0xe834('0x1a')]=function(_0x590879,_0x4576b3){var _0x583bd6=_0x590879[_0xe834('0x1b')];return _0x590879[_0xe834('0x1c')](_0xe834('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ca00b,_0x225f88,_0x518b22){return getChanSpyPromise(_0x583bd6,_0x5ca00b)[_0xe834('0x19')](function(_0x32a868){if(_0x32a868&&_0x32a868[_0xe834('0x14')]){return _0x583bd6[_0xe834('0x1e')][_0xe834('0x1f')](_0x32a868);}})[_0xe834('0x19')](function(){_0x518b22();})[_0xe834('0x20')](function(_0x51b3ef){_0x518b22(_0x51b3ef);});},'afterUpdate':function(_0x3002d8,_0x3070f8,_0x2608fd){return _0x583bd6[_0xe834('0x1e')][_0xe834('0x21')]({'where':{'ChanSpyId':_0x3002d8['id']}})[_0xe834('0x19')](function(){return getChanSpyPromise(_0x583bd6,_0x3002d8);})[_0xe834('0x19')](function(_0x2a90b5){if(_0x2a90b5&&_0x2a90b5[_0xe834('0x14')]){return _0x583bd6[_0xe834('0x1e')][_0xe834('0x1f')](_0x2a90b5);}})['then'](function(){_0x2608fd();})['catch'](function(_0x111a0b){_0x2608fd(_0x111a0b);});},'afterDestroy':function(_0x2c8710,_0x30bce8,_0x26f6e2){return _0x583bd6[_0xe834('0x1e')][_0xe834('0x21')]({'where':{'ChanSpyId':_0x2c8710['id']}})[_0xe834('0x19')](function(){_0x26f6e2();})[_0xe834('0x20')](function(_0x362435){_0x26f6e2(_0x362435);});}}});}; \ No newline at end of file +var _0x5310=['push','merge','Set','format','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','name','options','join','record','concat','internal','User','findAll','then','exports','models','define','VoiceExtension','bulkCreate','catch','destroy','length','lodash','util','./voiceChanSpy.attributes','context','from-sip','prefix','system'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x5310,0x1c0));var _0x0531=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x5310[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0x0531('0x0'));var util=require(_0x0531('0x1'));var BPromise=require('bluebird');var attributes=require(_0x0531('0x2'));var getUserApplications=function(_0x195f35,_0x19778f,_0x54399f){var _0x5ef0de=0x1;var _0x1de254=[];var _0x32c990={'context':_0x19778f[_0x0531('0x3')]||_0x0531('0x4'),'exten':util['format']('%s%s',_0x195f35[_0x0531('0x5')],_0x54399f),'type':_0x0531('0x6'),'isApp':![],'ChanSpyId':_0x195f35['id'],'UserId':_0x19778f['id']};_0x1de254[_0x0531('0x7')](_[_0x0531('0x8')]({'app':_0x0531('0x9'),'appdata':util[_0x0531('0xa')](_0x0531('0xb'),_0x0531('0xc')),'priority':_0x5ef0de++},_0x32c990));if(_0x195f35['record']){_0x1de254['push'](_[_0x0531('0x8')]({'app':_0x0531('0xd'),'appdata':util[_0x0531('0xa')](_0x0531('0xe'),_0x195f35[_0x0531('0xf')]),'priority':_0x5ef0de++},_0x32c990));}if(_0x195f35['auth']){_0x1de254[_0x0531('0x7')](_[_0x0531('0x8')]({'app':'Authenticate','appdata':_0x195f35[_0x0531('0x10')],'priority':_0x5ef0de++},_0x32c990));}_0x1de254['push'](_[_0x0531('0x8')]({'app':_0x0531('0x11'),'appdata':util[_0x0531('0xa')]('SIP/%s,%s',_0x19778f[_0x0531('0x12')],_0x195f35[_0x0531('0x13')]?_0x195f35['options'][_0x0531('0x14')](''):''),'priority':_0x5ef0de++},_0x32c990));if(_0x195f35[_0x0531('0x15')]){_0x1de254[_0x0531('0x7')](_[_0x0531('0x8')]({'app':'StopMixMonitor','priority':_0x5ef0de++},_0x32c990));}return _0x1de254;};var getChanSpyApplications=function(_0x59e376,_0x1234fd){var _0x52890a=[];for(var _0x3a44ec=0x0,_0x312f87=0x1;_0x3a44ec<_0x1234fd['length'];_0x3a44ec++,_0x312f87=0x1){_0x52890a=_0x52890a[_0x0531('0x16')](getUserApplications(_0x59e376,_0x1234fd[_0x3a44ec],_0x1234fd[_0x3a44ec][_0x0531('0x17')]));if(_0x1234fd[_0x3a44ec]['internal']!=_0x1234fd[_0x3a44ec][_0x0531('0x12')]){_0x52890a=_0x52890a[_0x0531('0x16')](getUserApplications(_0x59e376,_0x1234fd[_0x3a44ec],_0x1234fd[_0x3a44ec][_0x0531('0x12')]));}}return _0x52890a;};var getChanSpyPromise=function(_0x3616fd,_0x2ee81b){return new BPromise(function(_0x8db5e8,_0x19e048){return _0x3616fd[_0x0531('0x18')][_0x0531('0x19')]({'attributes':['id',_0x0531('0x12'),_0x0531('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x0531('0x1a')](function(_0x5195fb){if(_0x5195fb){return _0x8db5e8(getChanSpyApplications(_0x2ee81b,_0x5195fb));}return _0x8db5e8([]);})['catch'](function(_0x11b3d6){_0x19e048(_0x11b3d6);});});};module[_0x0531('0x1b')]=function(_0x2cf6ef,_0x53132c){var _0x183d74=_0x2cf6ef[_0x0531('0x1c')];return _0x2cf6ef[_0x0531('0x1d')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x145182,_0x2ed2b1,_0x1bf99b){return getChanSpyPromise(_0x183d74,_0x145182)[_0x0531('0x1a')](function(_0x5c60a7){if(_0x5c60a7&&_0x5c60a7['length']){return _0x183d74[_0x0531('0x1e')][_0x0531('0x1f')](_0x5c60a7);}})[_0x0531('0x1a')](function(){_0x1bf99b();})[_0x0531('0x20')](function(_0x3ed634){_0x1bf99b(_0x3ed634);});},'afterUpdate':function(_0x7de0db,_0x407e8c,_0x54fa5a){return _0x183d74[_0x0531('0x1e')][_0x0531('0x21')]({'where':{'ChanSpyId':_0x7de0db['id']}})[_0x0531('0x1a')](function(){return getChanSpyPromise(_0x183d74,_0x7de0db);})['then'](function(_0x16e983){if(_0x16e983&&_0x16e983[_0x0531('0x22')]){return _0x183d74['VoiceExtension']['bulkCreate'](_0x16e983);}})['then'](function(){_0x54fa5a();})[_0x0531('0x20')](function(_0x47ebb2){_0x54fa5a(_0x47ebb2);});},'afterDestroy':function(_0x4f1d74,_0x485fbf,_0x50402){return _0x183d74[_0x0531('0x1e')]['destroy']({'where':{'ChanSpyId':_0x4f1d74['id']}})[_0x0531('0x1a')](function(){_0x50402();})[_0x0531('0x20')](function(_0x3a1a81){_0x50402(_0x3a1a81);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 7b96d4d..82887b3 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.rpc.js +++ b/server/api/voiceChanSpy/voiceChanSpy.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bb0=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','randomstring'];(function(_0x55d1ff,_0x39f0f9){var _0x50b4ce=function(_0xb5838b){while(--_0xb5838b){_0x55d1ff['push'](_0x55d1ff['shift']());}};_0x50b4ce(++_0x39f0f9);}(_0x2bb0,0xf3));var _0x02bb=function(_0x508ab1,_0x11e7b6){_0x508ab1=_0x508ab1-0x0;var _0x30b922=_0x2bb0[_0x508ab1];return _0x30b922;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var moment=require(_0x02bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x02bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x02bb('0x4'));var logger=require('../../config/logger')(_0x02bb('0x5'));var config=require(_0x02bb('0x6'));var jayson=require(_0x02bb('0x7'));var client=jayson[_0x02bb('0x8')][_0x02bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16bb7c,_0x440f9c,_0x47d7ae){return new BPromise(function(_0x6d064a,_0x15e425){return client[_0x02bb('0xa')](_0x16bb7c,_0x47d7ae)['then'](function(_0x3d28d5){logger['info'](_0x02bb('0xb'),_0x440f9c,_0x02bb('0xc'));logger['debug'](_0x02bb('0xd'),_0x440f9c,_0x02bb('0xc'),JSON[_0x02bb('0xe')](_0x3d28d5));if(_0x3d28d5['error']){if(_0x3d28d5[_0x02bb('0xf')]['code']===0x1f4){logger[_0x02bb('0xf')](_0x02bb('0xb'),_0x440f9c,_0x3d28d5[_0x02bb('0xf')]['message']);return _0x15e425(_0x3d28d5[_0x02bb('0xf')][_0x02bb('0x10')]);}logger[_0x02bb('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x440f9c,_0x3d28d5[_0x02bb('0xf')]['message']);return _0x6d064a(_0x3d28d5[_0x02bb('0xf')][_0x02bb('0x10')]);}else{logger[_0x02bb('0x11')](_0x02bb('0xb'),_0x440f9c,_0x02bb('0xc'));_0x6d064a(_0x3d28d5[_0x02bb('0x12')]['message']);}})['catch'](function(_0x4711fb){logger[_0x02bb('0xf')](_0x02bb('0xb'),_0x440f9c,_0x4711fb);_0x15e425(_0x4711fb);});});} \ No newline at end of file +var _0x80df=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x1e3f0a,_0x55b293){var _0x50064f=function(_0x582aa2){while(--_0x582aa2){_0x1e3f0a['push'](_0x1e3f0a['shift']());}};_0x50064f(++_0x55b293);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require(_0xf80d('0x6'));var logger=require(_0xf80d('0x7'))(_0xf80d('0x8'));var config=require(_0xf80d('0x9'));var jayson=require(_0xf80d('0xa'));var client=jayson[_0xf80d('0xb')][_0xf80d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x62e50f,_0x5068d4,_0x30e2b3){return new BPromise(function(_0x16b219,_0x2f56b3){return client[_0xf80d('0xd')](_0x62e50f,_0x30e2b3)[_0xf80d('0xe')](function(_0x186339){logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));logger[_0xf80d('0x12')](_0xf80d('0x13'),_0x5068d4,_0xf80d('0x11'),JSON[_0xf80d('0x14')](_0x186339));if(_0x186339[_0xf80d('0x15')]){if(_0x186339['error']['code']===0x1f4){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x2f56b3(_0x186339['error'][_0xf80d('0x16')]);}logger['error'](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x16b219(_0x186339[_0xf80d('0x15')][_0xf80d('0x16')]);}else{logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));_0x16b219(_0x186339[_0xf80d('0x17')][_0xf80d('0x16')]);}})[_0xf80d('0x18')](function(_0x3b8a82){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x3b8a82);_0x2f56b3(_0x3b8a82);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 6e0c7d6..284e8c5 100644 --- a/server/api/voiceContext/index.js +++ b/server/api/voiceContext/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa39f=['/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','show','post','create'];(function(_0x5bd733,_0x355206){var _0x1c88e7=function(_0xe95c85){while(--_0xe95c85){_0x5bd733['push'](_0x5bd733['shift']());}};_0x1c88e7(++_0x355206);}(_0xa39f,0x193));var _0xfa39=function(_0x50bca7,_0xb23979){_0x50bca7=_0x50bca7-0x0;var _0x40e5ee=_0xa39f[_0x50bca7];return _0x40e5ee;};'use strict';var multer=require(_0xfa39('0x0'));var util=require(_0xfa39('0x1'));var path=require(_0xfa39('0x2'));var timeout=require(_0xfa39('0x3'));var express=require(_0xfa39('0x4'));var router=express[_0xfa39('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfa39('0x6'));var interaction=require(_0xfa39('0x7'));var config=require('../../config/environment');var controller=require(_0xfa39('0x8'));router[_0xfa39('0x9')]('/',auth[_0xfa39('0xa')](),controller[_0xfa39('0xb')]);router[_0xfa39('0x9')]('/:id',auth[_0xfa39('0xa')](),controller[_0xfa39('0xc')]);router[_0xfa39('0xd')]('/',auth['isAuthenticated'](),controller[_0xfa39('0xe')]);router['put'](_0xfa39('0xf'),auth[_0xfa39('0xa')](),controller[_0xfa39('0x10')]);router[_0xfa39('0x11')]('/:id',auth[_0xfa39('0xa')](),controller[_0xfa39('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf6c4=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put'];(function(_0x589640,_0x536586){var _0x2bf019=function(_0x54bf75){while(--_0x54bf75){_0x589640['push'](_0x589640['shift']());}};_0x2bf019(++_0x536586);}(_0xf6c4,0x15b));var _0x4f6c=function(_0x37d69d,_0x5d3284){_0x37d69d=_0x37d69d-0x0;var _0x5d98c7=_0xf6c4[_0x37d69d];return _0x5d98c7;};'use strict';var multer=require(_0x4f6c('0x0'));var util=require(_0x4f6c('0x1'));var path=require(_0x4f6c('0x2'));var timeout=require(_0x4f6c('0x3'));var express=require(_0x4f6c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f6c('0x5'));var interaction=require(_0x4f6c('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x4f6c('0x7')]('/',auth[_0x4f6c('0x8')](),controller[_0x4f6c('0x9')]);router[_0x4f6c('0x7')]('/:id',auth[_0x4f6c('0x8')](),controller[_0x4f6c('0xa')]);router[_0x4f6c('0xb')]('/',auth[_0x4f6c('0x8')](),controller[_0x4f6c('0xc')]);router[_0x4f6c('0xd')](_0x4f6c('0xe'),auth[_0x4f6c('0x8')](),controller[_0x4f6c('0xf')]);router[_0x4f6c('0x10')](_0x4f6c('0xe'),auth['isAuthenticated'](),controller[_0x4f6c('0x11')]);module[_0x4f6c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 10a7cd3..58705c2 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x365e=['name','BOOLEAN'];(function(_0x56f269,_0x36680e){var _0x2f4a79=function(_0x2d2eb6){while(--_0x2d2eb6){_0x56f269['push'](_0x56f269['shift']());}};_0x2f4a79(++_0x36680e);}(_0x365e,0x148));var _0xe365=function(_0x1347fc,_0x2c2775){_0x1347fc=_0x1347fc-0x0;var _0x6999db=_0x365e[_0x1347fc];return _0x6999db;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe365('0x0')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe365('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5aa1=['STRING','name','sequelize'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x5aa1,0x92));var _0x15aa=function(_0x7128be,_0x209fe9){_0x7128be=_0x7128be-0x0;var _0x5c001a=_0x5aa1[_0x7128be];return _0x5c001a;};'use strict';var Sequelize=require(_0x15aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x15aa('0x1')],'unique':_0x15aa('0x2')},'description':{'type':Sequelize[_0x15aa('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index de868f9..0b2f9db 100644 --- a/server/api/voiceContext/voiceContext.controller.js +++ b/server/api/voiceContext/voiceContext.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae90=['join','root','server/files/templates/context.ejs','utf8','writeFileSync','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','readFileSync'];(function(_0x30c9b8,_0xccdc5c){var _0x20ce72=function(_0x28edab){while(--_0x28edab){_0x30c9b8['push'](_0x30c9b8['shift']());}};_0x20ce72(++_0xccdc5c);}(_0xae90,0x149));var _0x0ae9=function(_0x16089a,_0x21f54b){_0x16089a=_0x16089a-0x0;var _0xebb8b9=_0xae90[_0x16089a];return _0xebb8b9;};'use strict';var emlformat=require(_0x0ae9('0x0'));var rimraf=require(_0x0ae9('0x1'));var zipdir=require(_0x0ae9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae9('0x3'));var moment=require(_0x0ae9('0x4'));var BPromise=require(_0x0ae9('0x5'));var Mustache=require('mustache');var util=require(_0x0ae9('0x6'));var path=require(_0x0ae9('0x7'));var sox=require(_0x0ae9('0x8'));var csv=require(_0x0ae9('0x9'));var ejs=require(_0x0ae9('0xa'));var fs=require('fs');var fs_extra=require(_0x0ae9('0xb'));var _=require(_0x0ae9('0xc'));var squel=require('squel');var crypto=require(_0x0ae9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0ae9('0xe'));var toCsv=require(_0x0ae9('0x9'));var querystring=require(_0x0ae9('0xf'));var Papa=require('papaparse');var Redis=require(_0x0ae9('0x10'));var authService=require(_0x0ae9('0x11'));var qs=require(_0x0ae9('0x12'));var as=require(_0x0ae9('0x13'));var hardwareService=require(_0x0ae9('0x14'));var logger=require(_0x0ae9('0x15'))(_0x0ae9('0x16'));var utils=require(_0x0ae9('0x17'));var config=require(_0x0ae9('0x18'));var licenseUtil=require(_0x0ae9('0x19'));var db=require(_0x0ae9('0x1a'))['db'];var jayson=require(_0x0ae9('0x1b'));var client=jayson[_0x0ae9('0x1c')][_0x0ae9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x11e0af,_0x151270,_0x5981c9,_0xa5e40){return new BPromise(function(_0x40cc33,_0x46a520){var _0x3f296e=_0xa5e40||client;return _0x3f296e[_0x0ae9('0x1e')](_0x11e0af,_0x5981c9)[_0x0ae9('0x1f')](function(_0x492c5e){logger[_0x0ae9('0x20')](_0x0ae9('0x21'),_0x151270,_0x0ae9('0x22'));logger[_0x0ae9('0x23')](_0x0ae9('0x24'),_0x151270,'request\x20sent',JSON[_0x0ae9('0x25')](_0x492c5e));if(_0x492c5e['error']){if(_0x492c5e[_0x0ae9('0x26')][_0x0ae9('0x27')]===0x1f4){logger[_0x0ae9('0x26')](_0x0ae9('0x21'),_0x151270,_0x492c5e[_0x0ae9('0x26')]['message']);return _0x46a520(_0x492c5e['error'][_0x0ae9('0x28')]);}logger[_0x0ae9('0x26')](_0x0ae9('0x21'),_0x151270,_0x492c5e[_0x0ae9('0x26')][_0x0ae9('0x28')]);return _0x40cc33(_0x492c5e[_0x0ae9('0x26')]['message']);}else{logger[_0x0ae9('0x20')](_0x0ae9('0x21'),_0x151270,'request\x20sent');_0x40cc33(_0x492c5e['result'][_0x0ae9('0x28')]);}})['catch'](function(_0x468997){logger['error'](_0x0ae9('0x21'),_0x151270,_0x468997);_0x46a520(_0x468997);});});}function respondWithStatusCode(_0x12b2b0,_0x5310c0){_0x5310c0=_0x5310c0||0xcc;return function(_0x89d73e){if(_0x89d73e){return _0x12b2b0[_0x0ae9('0x29')](_0x5310c0);}return _0x12b2b0[_0x0ae9('0x2a')](_0x5310c0)[_0x0ae9('0x2b')]();};}function respondWithResult(_0x4d732f,_0x363424){_0x363424=_0x363424||0xc8;return function(_0x466670){if(_0x466670){return _0x4d732f[_0x0ae9('0x2a')](_0x363424)[_0x0ae9('0x2c')](_0x466670);}};}function respondWithFilteredResult(_0x314277,_0x9336f2){return function(_0x5b7430){if(_0x5b7430){var _0x1cf7dc=typeof _0x9336f2[_0x0ae9('0x2d')]===_0x0ae9('0x2e')&&typeof _0x9336f2['limit']===_0x0ae9('0x2e');var _0x232118=_0x5b7430[_0x0ae9('0x2f')];var _0x34e30d=_0x1cf7dc?0x0:_0x9336f2[_0x0ae9('0x2d')];var _0x5c444f=_0x1cf7dc?_0x5b7430[_0x0ae9('0x2f')]:_0x9336f2[_0x0ae9('0x2d')]+_0x9336f2[_0x0ae9('0x30')];var _0x1b4a7d;if(_0x5c444f>=_0x232118){_0x5c444f=_0x232118;_0x1b4a7d=0xc8;}else{_0x1b4a7d=0xce;}_0x314277[_0x0ae9('0x2a')](_0x1b4a7d);return _0x314277['set'](_0x0ae9('0x31'),_0x34e30d+'-'+_0x5c444f+'/'+_0x232118)[_0x0ae9('0x2c')](_0x5b7430);}return null;};}function patchUpdates(_0x204982){return function(_0x9bf719){try{jsonpatch[_0x0ae9('0x32')](_0x9bf719,_0x204982,!![]);}catch(_0x17204e){return BPromise[_0x0ae9('0x33')](_0x17204e);}return _0x9bf719[_0x0ae9('0x34')]();};}function saveUpdates(_0x19f4f9,_0x47afcd){return function(_0x191425){if(_0x191425){return _0x191425[_0x0ae9('0x35')](_0x19f4f9)[_0x0ae9('0x1f')](function(_0x1012ac){return _0x1012ac;});}return null;};}function removeEntity(_0x26bfa0,_0x461c37){return function(_0x211b93){if(_0x211b93){return _0x211b93[_0x0ae9('0x36')]()[_0x0ae9('0x1f')](function(){var _0x30b433=_0x211b93[_0x0ae9('0x37')]({'plain':!![]});var _0x28d054='Contexts';return db[_0x0ae9('0x38')]['destroy']({'where':{'type':_0x28d054,'resourceId':_0x30b433['id']}})['then'](function(){return _0x211b93;});})[_0x0ae9('0x1f')](function(){_0x26bfa0[_0x0ae9('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57d8d8,_0x556269){return function(_0x1ae12b){if(!_0x1ae12b){_0x57d8d8[_0x0ae9('0x29')](0x194);}return _0x1ae12b;};}function handleError(_0x3557e1,_0x1d996b){_0x1d996b=_0x1d996b||0x1f4;return function(_0x37c432){logger[_0x0ae9('0x26')](_0x37c432['stack']);if(_0x37c432[_0x0ae9('0x39')]){delete _0x37c432[_0x0ae9('0x39')];}_0x3557e1[_0x0ae9('0x2a')](_0x1d996b)[_0x0ae9('0x3a')](_0x37c432);};}exports[_0x0ae9('0x3b')]=function(_0x355523,_0x5ebabc){var _0x5eb165={},_0x565d67={},_0x1f4fe1={'count':0x0,'rows':[]};var _0x1217ca=_[_0x0ae9('0x3c')](db[_0x0ae9('0x3d')][_0x0ae9('0x3e')],function(_0x29b863){return{'name':_0x29b863[_0x0ae9('0x3f')],'type':_0x29b863[_0x0ae9('0x40')][_0x0ae9('0x41')]};});_0x565d67[_0x0ae9('0x42')]=_[_0x0ae9('0x3c')](_0x1217ca,_0x0ae9('0x39'));_0x565d67[_0x0ae9('0x43')]=_[_0x0ae9('0x44')](_0x355523['query']);_0x565d67[_0x0ae9('0x45')]=_[_0x0ae9('0x46')](_0x565d67[_0x0ae9('0x42')],_0x565d67[_0x0ae9('0x43')]);_0x5eb165[_0x0ae9('0x47')]=_[_0x0ae9('0x46')](_0x565d67[_0x0ae9('0x42')],qs[_0x0ae9('0x48')](_0x355523[_0x0ae9('0x43')][_0x0ae9('0x48')]));_0x5eb165[_0x0ae9('0x47')]=_0x5eb165['attributes'][_0x0ae9('0x49')]?_0x5eb165[_0x0ae9('0x47')]:_0x565d67[_0x0ae9('0x42')];if(!_0x355523[_0x0ae9('0x43')]['hasOwnProperty']('nolimit')){_0x5eb165[_0x0ae9('0x30')]=qs['limit'](_0x355523['query']['limit']);_0x5eb165[_0x0ae9('0x2d')]=qs[_0x0ae9('0x2d')](_0x355523[_0x0ae9('0x43')][_0x0ae9('0x2d')]);}_0x5eb165[_0x0ae9('0x4a')]=qs[_0x0ae9('0x4b')](_0x355523[_0x0ae9('0x43')][_0x0ae9('0x4b')]);_0x5eb165[_0x0ae9('0x4c')]=qs[_0x0ae9('0x45')](_['pick'](_0x355523[_0x0ae9('0x43')],_0x565d67[_0x0ae9('0x45')]),_0x1217ca);if(_0x355523['query'][_0x0ae9('0x4d')]){_0x5eb165[_0x0ae9('0x4c')]=_[_0x0ae9('0x4e')](_0x5eb165['where'],{'$or':_[_0x0ae9('0x3c')](_0x1217ca,function(_0x2e0ed6){if(_0x2e0ed6['type']!==_0x0ae9('0x4f')){var _0xfbbacb={};_0xfbbacb[_0x2e0ed6['name']]={'$like':'%'+_0x355523[_0x0ae9('0x43')]['filter']+'%'};return _0xfbbacb;}})});}_0x5eb165=_[_0x0ae9('0x4e')]({},_0x5eb165,_0x355523[_0x0ae9('0x50')]);var _0x268f14={'where':_0x5eb165[_0x0ae9('0x4c')]};return db[_0x0ae9('0x3d')]['count'](_0x268f14)[_0x0ae9('0x1f')](function(_0x1dfda4){_0x1f4fe1['count']=_0x1dfda4;if(_0x355523[_0x0ae9('0x43')][_0x0ae9('0x51')]){_0x5eb165[_0x0ae9('0x52')]=[{'all':!![]}];}return db[_0x0ae9('0x3d')][_0x0ae9('0x53')](_0x5eb165);})[_0x0ae9('0x1f')](function(_0x3f13a4){_0x1f4fe1[_0x0ae9('0x54')]=_0x3f13a4;return _0x1f4fe1;})[_0x0ae9('0x1f')](respondWithFilteredResult(_0x5ebabc,_0x5eb165))[_0x0ae9('0x55')](handleError(_0x5ebabc,null));};exports['show']=function(_0x294e11,_0x3edbca){var _0xa418bf={'raw':![],'where':{'id':_0x294e11[_0x0ae9('0x56')]['id']}},_0x2336ae={};_0x2336ae[_0x0ae9('0x42')]=_[_0x0ae9('0x44')](db['VoiceContext'][_0x0ae9('0x3e')]);_0x2336ae[_0x0ae9('0x43')]=_[_0x0ae9('0x44')](_0x294e11[_0x0ae9('0x43')]);_0x2336ae['filters']=_[_0x0ae9('0x46')](_0x2336ae['model'],_0x2336ae['query']);_0xa418bf[_0x0ae9('0x47')]=_[_0x0ae9('0x46')](_0x2336ae[_0x0ae9('0x42')],qs['fields'](_0x294e11['query'][_0x0ae9('0x48')]));_0xa418bf[_0x0ae9('0x47')]=_0xa418bf['attributes'][_0x0ae9('0x49')]?_0xa418bf[_0x0ae9('0x47')]:_0x2336ae[_0x0ae9('0x42')];if(_0x294e11[_0x0ae9('0x43')][_0x0ae9('0x51')]){_0xa418bf['include']=[{'all':!![]}];}_0xa418bf=_[_0x0ae9('0x4e')]({},_0xa418bf,_0x294e11[_0x0ae9('0x50')]);return db[_0x0ae9('0x3d')][_0x0ae9('0x57')](_0xa418bf)[_0x0ae9('0x1f')](handleEntityNotFound(_0x3edbca,null))['then'](respondWithResult(_0x3edbca,null))[_0x0ae9('0x55')](handleError(_0x3edbca,null));};exports[_0x0ae9('0x58')]=function(_0x2144e8,_0x2ef7c4,_0x3c0c2f){var _0x3ccbbc;return db[_0x0ae9('0x3d')]['create'](_0x2144e8[_0x0ae9('0x59')],{'raw':!![]})['then'](function(_0xb65198){_0x3ccbbc=_0xb65198;return db['VoiceContext'][_0x0ae9('0x53')]({'raw':!![]});})[_0x0ae9('0x1f')](function(_0x2e08dc){var _0x1cbabd=fs[_0x0ae9('0x5a')](path[_0x0ae9('0x5b')](config[_0x0ae9('0x5c')],_0x0ae9('0x5d')),_0x0ae9('0x5e'));var _0x499251=ejs['render'](_0x1cbabd,{'contexts':_0x2e08dc||[]});fs[_0x0ae9('0x5f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x499251);})['then'](function(){return respondWithRpcPromise('Reload',_0x0ae9('0x58'),{'module':_0x0ae9('0x60')});})['then'](function(){var _0x4f7190=_0x2144e8[_0x0ae9('0x61')][_0x0ae9('0x37')]({'plain':!![]});if(!_0x4f7190)throw new Error(_0x0ae9('0x62'));if(_0x4f7190[_0x0ae9('0x63')]==='user'){var _0x3efce8=_0x3ccbbc[_0x0ae9('0x37')]({'plain':!![]});return db[_0x0ae9('0x64')][_0x0ae9('0x57')]({'where':{'name':'Contexts','userProfileId':_0x4f7190['userProfileId']},'raw':!![]})['then'](function(_0x4a7a02){if(_0x4a7a02&&_0x4a7a02['autoAssociation']===0x0){return db[_0x0ae9('0x38')][_0x0ae9('0x58')]({'name':_0x3efce8[_0x0ae9('0x39')],'resourceId':_0x3efce8['id'],'type':_0x4a7a02[_0x0ae9('0x39')],'sectionId':_0x4a7a02['id']},{})[_0x0ae9('0x1f')](function(){return _0x3ccbbc;});}else{return _0x3ccbbc;}})['catch'](function(_0x4a36eb){logger['error'](_0x0ae9('0x65'),_0x4a36eb);throw _0x4a36eb;});}return _0x3ccbbc;})[_0x0ae9('0x1f')](respondWithResult(_0x2ef7c4,0xc9))['catch'](handleError(_0x2ef7c4,null));};exports[_0x0ae9('0x35')]=function(_0x330e0b,_0x90f73c,_0x348b88){var _0x35b719;return db[_0x0ae9('0x3d')][_0x0ae9('0x57')]({'where':{'id':_0x330e0b[_0x0ae9('0x56')]['id']}})[_0x0ae9('0x1f')](handleEntityNotFound(_0x90f73c,null))[_0x0ae9('0x1f')](saveUpdates(_0x330e0b[_0x0ae9('0x59')],null))[_0x0ae9('0x1f')](function(_0x354ec0){if(_0x354ec0){_0x35b719=_0x354ec0;return db[_0x0ae9('0x3d')]['findAll']({'raw':!![]});}})[_0x0ae9('0x1f')](function(_0x2a08e0){var _0x18532b=fs['readFileSync'](path[_0x0ae9('0x5b')](config[_0x0ae9('0x5c')],_0x0ae9('0x5d')),'utf8');var _0x204c21=ejs[_0x0ae9('0x66')](_0x18532b,{'contexts':_0x2a08e0||[]});fs[_0x0ae9('0x5f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x204c21);})[_0x0ae9('0x1f')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x0ae9('0x60')});})[_0x0ae9('0x1f')](function(){return _0x35b719;})[_0x0ae9('0x1f')](respondWithResult(_0x90f73c,null))[_0x0ae9('0x55')](handleError(_0x90f73c,null));};exports[_0x0ae9('0x36')]=function(_0x8caf52,_0x412e63,_0x3dc7f8){var _0x15e6d9;return db[_0x0ae9('0x3d')][_0x0ae9('0x57')]({'where':{'id':_0x8caf52[_0x0ae9('0x56')]['id']}})[_0x0ae9('0x1f')](handleEntityNotFound(_0x412e63,null))[_0x0ae9('0x1f')](removeEntity(_0x412e63,null))['then'](function(){return db['VoiceContext'][_0x0ae9('0x53')]({'raw':!![]});})[_0x0ae9('0x1f')](function(_0x45c45b){var _0x583747=fs[_0x0ae9('0x5a')](path['join'](config[_0x0ae9('0x5c')],_0x0ae9('0x5d')),'utf8');var _0x48f86e=ejs[_0x0ae9('0x66')](_0x583747,{'contexts':_0x45c45b});fs[_0x0ae9('0x5f')](_0x0ae9('0x67'),_0x48f86e);return respondWithRpcPromise(_0x0ae9('0x68'),_0x0ae9('0x36'),{'module':_0x0ae9('0x60')});})[_0x0ae9('0x55')](handleError(_0x412e63,null));}; \ No newline at end of file +var _0xbd50=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','get','Contexts','UserProfileResource','destroy','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','root','chan_sip.so','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0xbd50,0x183));var _0x0bd5=function(_0x211af9,_0x216a8c){_0x211af9=_0x211af9-0x0;var _0x242e38=_0xbd50[_0x211af9];return _0x242e38;};'use strict';var emlformat=require(_0x0bd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0bd5('0x1'));var jsonpatch=require(_0x0bd5('0x2'));var rp=require(_0x0bd5('0x3'));var moment=require(_0x0bd5('0x4'));var BPromise=require(_0x0bd5('0x5'));var Mustache=require(_0x0bd5('0x6'));var util=require(_0x0bd5('0x7'));var path=require(_0x0bd5('0x8'));var sox=require(_0x0bd5('0x9'));var csv=require(_0x0bd5('0xa'));var ejs=require(_0x0bd5('0xb'));var fs=require('fs');var fs_extra=require(_0x0bd5('0xc'));var _=require(_0x0bd5('0xd'));var squel=require(_0x0bd5('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0bd5('0xf'));var Papa=require(_0x0bd5('0x10'));var Redis=require(_0x0bd5('0x11'));var authService=require(_0x0bd5('0x12'));var qs=require(_0x0bd5('0x13'));var as=require(_0x0bd5('0x14'));var hardwareService=require(_0x0bd5('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x0bd5('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0bd5('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x18')][_0x0bd5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x768573,_0x16fc99,_0x229147,_0x4c3bbd){return new BPromise(function(_0x525b02,_0x29d3a1){var _0x221f49=_0x4c3bbd||client;return _0x221f49[_0x0bd5('0x1a')](_0x768573,_0x229147)[_0x0bd5('0x1b')](function(_0x1cb1aa){logger[_0x0bd5('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x16fc99,_0x0bd5('0x1d'));logger[_0x0bd5('0x1e')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x16fc99,'request\x20sent',JSON[_0x0bd5('0x1f')](_0x1cb1aa));if(_0x1cb1aa[_0x0bd5('0x20')]){if(_0x1cb1aa[_0x0bd5('0x20')][_0x0bd5('0x21')]===0x1f4){logger['error'](_0x0bd5('0x22'),_0x16fc99,_0x1cb1aa[_0x0bd5('0x20')][_0x0bd5('0x23')]);return _0x29d3a1(_0x1cb1aa[_0x0bd5('0x20')][_0x0bd5('0x23')]);}logger[_0x0bd5('0x20')](_0x0bd5('0x22'),_0x16fc99,_0x1cb1aa[_0x0bd5('0x20')][_0x0bd5('0x23')]);return _0x525b02(_0x1cb1aa[_0x0bd5('0x20')][_0x0bd5('0x23')]);}else{logger[_0x0bd5('0x1c')](_0x0bd5('0x22'),_0x16fc99,_0x0bd5('0x1d'));_0x525b02(_0x1cb1aa[_0x0bd5('0x24')][_0x0bd5('0x23')]);}})[_0x0bd5('0x25')](function(_0x488018){logger[_0x0bd5('0x20')](_0x0bd5('0x22'),_0x16fc99,_0x488018);_0x29d3a1(_0x488018);});});}function respondWithStatusCode(_0x208256,_0x4f60ce){_0x4f60ce=_0x4f60ce||0xcc;return function(_0x151667){if(_0x151667){return _0x208256[_0x0bd5('0x26')](_0x4f60ce);}return _0x208256[_0x0bd5('0x27')](_0x4f60ce)[_0x0bd5('0x28')]();};}function respondWithResult(_0x8d79b3,_0x4f80d7){_0x4f80d7=_0x4f80d7||0xc8;return function(_0x42e47e){if(_0x42e47e){return _0x8d79b3['status'](_0x4f80d7)[_0x0bd5('0x29')](_0x42e47e);}};}function respondWithFilteredResult(_0x366042,_0x45cfe0){return function(_0x482dd8){if(_0x482dd8){var _0xfe9aab=typeof _0x45cfe0[_0x0bd5('0x2a')]===_0x0bd5('0x2b')&&typeof _0x45cfe0[_0x0bd5('0x2c')]==='undefined';var _0x1ac0f5=_0x482dd8[_0x0bd5('0x2d')];var _0x31cf40=_0xfe9aab?0x0:_0x45cfe0[_0x0bd5('0x2a')];var _0x5412f4=_0xfe9aab?_0x482dd8['count']:_0x45cfe0[_0x0bd5('0x2a')]+_0x45cfe0['limit'];var _0x447039;if(_0x5412f4>=_0x1ac0f5){_0x5412f4=_0x1ac0f5;_0x447039=0xc8;}else{_0x447039=0xce;}_0x366042['status'](_0x447039);return _0x366042[_0x0bd5('0x2e')](_0x0bd5('0x2f'),_0x31cf40+'-'+_0x5412f4+'/'+_0x1ac0f5)[_0x0bd5('0x29')](_0x482dd8);}return null;};}function patchUpdates(_0x5b160f){return function(_0x1f40d0){try{jsonpatch[_0x0bd5('0x30')](_0x1f40d0,_0x5b160f,!![]);}catch(_0x3f675b){return BPromise[_0x0bd5('0x31')](_0x3f675b);}return _0x1f40d0['save']();};}function saveUpdates(_0x18b7ff,_0x1957b7){return function(_0x49a622){if(_0x49a622){return _0x49a622['update'](_0x18b7ff)[_0x0bd5('0x1b')](function(_0x55c5cb){return _0x55c5cb;});}return null;};}function removeEntity(_0x2e96a4,_0x24d7c1){return function(_0x6f52a3){if(_0x6f52a3){return _0x6f52a3['destroy']()[_0x0bd5('0x1b')](function(){var _0x40d216=_0x6f52a3[_0x0bd5('0x32')]({'plain':!![]});var _0x3b92f3=_0x0bd5('0x33');return db[_0x0bd5('0x34')][_0x0bd5('0x35')]({'where':{'type':_0x3b92f3,'resourceId':_0x40d216['id']}})[_0x0bd5('0x1b')](function(){return _0x6f52a3;});})[_0x0bd5('0x1b')](function(){_0x2e96a4['status'](0xcc)[_0x0bd5('0x28')]();});}};}function handleEntityNotFound(_0x3a52b3,_0x95f150){return function(_0x3df67b){if(!_0x3df67b){_0x3a52b3['sendStatus'](0x194);}return _0x3df67b;};}function handleError(_0x4ae694,_0x30dafe){_0x30dafe=_0x30dafe||0x1f4;return function(_0x45409d){logger[_0x0bd5('0x20')](_0x45409d[_0x0bd5('0x36')]);if(_0x45409d[_0x0bd5('0x37')]){delete _0x45409d[_0x0bd5('0x37')];}_0x4ae694[_0x0bd5('0x27')](_0x30dafe)['send'](_0x45409d);};}exports[_0x0bd5('0x38')]=function(_0x2a0080,_0x14e24b){var _0x5025f2={},_0x123944={},_0x13d029={'count':0x0,'rows':[]};var _0xebf771=_[_0x0bd5('0x39')](db[_0x0bd5('0x3a')][_0x0bd5('0x3b')],function(_0x494c9b){return{'name':_0x494c9b[_0x0bd5('0x3c')],'type':_0x494c9b[_0x0bd5('0x3d')][_0x0bd5('0x3e')]};});_0x123944[_0x0bd5('0x3f')]=_['map'](_0xebf771,_0x0bd5('0x37'));_0x123944[_0x0bd5('0x40')]=_['keys'](_0x2a0080['query']);_0x123944[_0x0bd5('0x41')]=_['intersection'](_0x123944['model'],_0x123944[_0x0bd5('0x40')]);_0x5025f2[_0x0bd5('0x42')]=_[_0x0bd5('0x43')](_0x123944['model'],qs['fields'](_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x44')]));_0x5025f2[_0x0bd5('0x42')]=_0x5025f2[_0x0bd5('0x42')][_0x0bd5('0x45')]?_0x5025f2['attributes']:_0x123944['model'];if(!_0x2a0080['query'][_0x0bd5('0x46')](_0x0bd5('0x47'))){_0x5025f2[_0x0bd5('0x2c')]=qs[_0x0bd5('0x2c')](_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x2c')]);_0x5025f2[_0x0bd5('0x2a')]=qs[_0x0bd5('0x2a')](_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x2a')]);}_0x5025f2['order']=qs[_0x0bd5('0x48')](_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x48')]);_0x5025f2[_0x0bd5('0x49')]=qs[_0x0bd5('0x41')](_[_0x0bd5('0x4a')](_0x2a0080[_0x0bd5('0x40')],_0x123944[_0x0bd5('0x41')]),_0xebf771);if(_0x2a0080['query'][_0x0bd5('0x4b')]){_0x5025f2[_0x0bd5('0x49')]=_[_0x0bd5('0x4c')](_0x5025f2[_0x0bd5('0x49')],{'$or':_['map'](_0xebf771,function(_0x2a5307){if(_0x2a5307[_0x0bd5('0x3d')]!==_0x0bd5('0x4d')){var _0x11549a={};_0x11549a[_0x2a5307[_0x0bd5('0x37')]]={'$like':'%'+_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x4b')]+'%'};return _0x11549a;}})});}_0x5025f2=_[_0x0bd5('0x4c')]({},_0x5025f2,_0x2a0080[_0x0bd5('0x4e')]);var _0x5702e3={'where':_0x5025f2[_0x0bd5('0x49')]};return db[_0x0bd5('0x3a')][_0x0bd5('0x2d')](_0x5702e3)[_0x0bd5('0x1b')](function(_0x50e8f0){_0x13d029[_0x0bd5('0x2d')]=_0x50e8f0;if(_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x4f')]){_0x5025f2['include']=[{'all':!![]}];}return db[_0x0bd5('0x3a')][_0x0bd5('0x50')](_0x5025f2);})[_0x0bd5('0x1b')](function(_0xfb9e96){_0x13d029[_0x0bd5('0x51')]=_0xfb9e96;return _0x13d029;})[_0x0bd5('0x1b')](respondWithFilteredResult(_0x14e24b,_0x5025f2))[_0x0bd5('0x25')](handleError(_0x14e24b,null));};exports[_0x0bd5('0x52')]=function(_0x500dc9,_0x2bc831){var _0x31b982={'raw':![],'where':{'id':_0x500dc9[_0x0bd5('0x53')]['id']}},_0x3be3c1={};_0x3be3c1[_0x0bd5('0x3f')]=_[_0x0bd5('0x54')](db['VoiceContext'][_0x0bd5('0x3b')]);_0x3be3c1['query']=_[_0x0bd5('0x54')](_0x500dc9[_0x0bd5('0x40')]);_0x3be3c1[_0x0bd5('0x41')]=_[_0x0bd5('0x43')](_0x3be3c1[_0x0bd5('0x3f')],_0x3be3c1[_0x0bd5('0x40')]);_0x31b982[_0x0bd5('0x42')]=_[_0x0bd5('0x43')](_0x3be3c1['model'],qs['fields'](_0x500dc9['query']['fields']));_0x31b982[_0x0bd5('0x42')]=_0x31b982['attributes'][_0x0bd5('0x45')]?_0x31b982['attributes']:_0x3be3c1[_0x0bd5('0x3f')];if(_0x500dc9[_0x0bd5('0x40')][_0x0bd5('0x4f')]){_0x31b982[_0x0bd5('0x55')]=[{'all':!![]}];}_0x31b982=_[_0x0bd5('0x4c')]({},_0x31b982,_0x500dc9[_0x0bd5('0x4e')]);return db[_0x0bd5('0x3a')][_0x0bd5('0x56')](_0x31b982)[_0x0bd5('0x1b')](handleEntityNotFound(_0x2bc831,null))[_0x0bd5('0x1b')](respondWithResult(_0x2bc831,null))['catch'](handleError(_0x2bc831,null));};exports[_0x0bd5('0x57')]=function(_0x2e3376,_0x242b66,_0x11d4d4){var _0x3bbd99;return db[_0x0bd5('0x3a')][_0x0bd5('0x57')](_0x2e3376[_0x0bd5('0x58')],{'raw':!![]})[_0x0bd5('0x1b')](function(_0x7626bf){_0x3bbd99=_0x7626bf;return db['VoiceContext'][_0x0bd5('0x50')]({'raw':!![]});})[_0x0bd5('0x1b')](function(_0x358db8){var _0x234dad=fs[_0x0bd5('0x59')](path[_0x0bd5('0x5a')](config['root'],_0x0bd5('0x5b')),_0x0bd5('0x5c'));var _0x2b7264=ejs[_0x0bd5('0x5d')](_0x234dad,{'contexts':_0x358db8||[]});fs[_0x0bd5('0x5e')](_0x0bd5('0x5f'),_0x2b7264);})[_0x0bd5('0x1b')](function(){return respondWithRpcPromise(_0x0bd5('0x60'),_0x0bd5('0x57'),{'module':'chan_sip.so'});})[_0x0bd5('0x1b')](function(){var _0x37a6ee=_0x2e3376[_0x0bd5('0x61')][_0x0bd5('0x32')]({'plain':!![]});if(!_0x37a6ee)throw new Error(_0x0bd5('0x62'));if(_0x37a6ee[_0x0bd5('0x63')]===_0x0bd5('0x61')){var _0x4fc9f5=_0x3bbd99[_0x0bd5('0x32')]({'plain':!![]});return db[_0x0bd5('0x64')][_0x0bd5('0x56')]({'where':{'name':_0x0bd5('0x33'),'userProfileId':_0x37a6ee[_0x0bd5('0x65')]},'raw':!![]})[_0x0bd5('0x1b')](function(_0x55f2c9){if(_0x55f2c9&&_0x55f2c9[_0x0bd5('0x66')]===0x0){return db[_0x0bd5('0x34')][_0x0bd5('0x57')]({'name':_0x4fc9f5[_0x0bd5('0x37')],'resourceId':_0x4fc9f5['id'],'type':_0x55f2c9['name'],'sectionId':_0x55f2c9['id']},{})[_0x0bd5('0x1b')](function(){return _0x3bbd99;});}else{return _0x3bbd99;}})[_0x0bd5('0x25')](function(_0x3b9999){logger[_0x0bd5('0x20')](_0x0bd5('0x67'),_0x3b9999);throw _0x3b9999;});}return _0x3bbd99;})[_0x0bd5('0x1b')](respondWithResult(_0x242b66,0xc9))[_0x0bd5('0x25')](handleError(_0x242b66,null));};exports[_0x0bd5('0x68')]=function(_0x20925d,_0x35ea3c,_0x3aac74){var _0x3d974a;return db['VoiceContext'][_0x0bd5('0x56')]({'where':{'id':_0x20925d[_0x0bd5('0x53')]['id']}})['then'](handleEntityNotFound(_0x35ea3c,null))[_0x0bd5('0x1b')](saveUpdates(_0x20925d[_0x0bd5('0x58')],null))['then'](function(_0x93f5fb){if(_0x93f5fb){_0x3d974a=_0x93f5fb;return db[_0x0bd5('0x3a')][_0x0bd5('0x50')]({'raw':!![]});}})['then'](function(_0x356865){var _0x518d1d=fs['readFileSync'](path[_0x0bd5('0x5a')](config[_0x0bd5('0x69')],_0x0bd5('0x5b')),_0x0bd5('0x5c'));var _0x641664=ejs[_0x0bd5('0x5d')](_0x518d1d,{'contexts':_0x356865||[]});fs[_0x0bd5('0x5e')](_0x0bd5('0x5f'),_0x641664);})[_0x0bd5('0x1b')](function(){return respondWithRpcPromise(_0x0bd5('0x60'),'update',{'module':_0x0bd5('0x6a')});})[_0x0bd5('0x1b')](function(){return _0x3d974a;})[_0x0bd5('0x1b')](respondWithResult(_0x35ea3c,null))['catch'](handleError(_0x35ea3c,null));};exports[_0x0bd5('0x35')]=function(_0xbb2195,_0x257bb4,_0x1b4574){var _0x497437;return db[_0x0bd5('0x3a')]['find']({'where':{'id':_0xbb2195[_0x0bd5('0x53')]['id']}})[_0x0bd5('0x1b')](handleEntityNotFound(_0x257bb4,null))[_0x0bd5('0x1b')](removeEntity(_0x257bb4,null))[_0x0bd5('0x1b')](function(){return db[_0x0bd5('0x3a')][_0x0bd5('0x50')]({'raw':!![]});})['then'](function(_0x49fb06){var _0x2bcff7=fs[_0x0bd5('0x59')](path[_0x0bd5('0x5a')](config[_0x0bd5('0x69')],_0x0bd5('0x5b')),_0x0bd5('0x5c'));var _0x5a9f05=ejs[_0x0bd5('0x5d')](_0x2bcff7,{'contexts':_0x49fb06});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x5a9f05);return respondWithRpcPromise(_0x0bd5('0x60'),_0x0bd5('0x35'),{'module':_0x0bd5('0x6a')});})['catch'](handleError(_0x257bb4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d2a66b0..bce55ce 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7381=['api','../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash'];(function(_0x1def25,_0x4bd865){var _0x5ace1b=function(_0x4fea47){while(--_0x4fea47){_0x1def25['push'](_0x1def25['shift']());}};_0x5ace1b(++_0x4bd865);}(_0x7381,0x133));var _0x1738=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x7381[_0x4521e3];return _0x46a272;};'use strict';var _=require(_0x1738('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1738('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1738('0x2'));var attributes=require(_0x1738('0x3'));module['exports']=function(_0x115296,_0x41e377){return _0x115296[_0x1738('0x4')](_0x1738('0x5'),attributes,{'tableName':_0x1738('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bc8=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','VoiceContext','voice_contexts','lodash','util'];(function(_0x214b49,_0x48e334){var _0x346343=function(_0x17c8fa){while(--_0x17c8fa){_0x214b49['push'](_0x214b49['shift']());}};_0x346343(++_0x48e334);}(_0x9bc8,0xa6));var _0x89bc=function(_0x3121a8,_0x193f16){_0x3121a8=_0x3121a8-0x0;var _0x207fa4=_0x9bc8[_0x3121a8];return _0x207fa4;};'use strict';var _=require(_0x89bc('0x0'));var util=require(_0x89bc('0x1'));var logger=require(_0x89bc('0x2'))(_0x89bc('0x3'));var moment=require(_0x89bc('0x4'));var BPromise=require(_0x89bc('0x5'));var rp=require(_0x89bc('0x6'));var fs=require('fs');var path=require(_0x89bc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0x89bc('0x8')]=function(_0x38047c,_0x49c366){return _0x38047c[_0x89bc('0x9')](_0x89bc('0xa'),attributes,{'tableName':_0x89bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 126b8eb..2c5c76e 100644 --- a/server/api/voiceContext/voiceContext.rpc.js +++ b/server/api/voiceContext/voiceContext.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5227=['VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x5227,0x1d1));var _0x7522=function(_0xca54f9,_0x1d837b){_0xca54f9=_0xca54f9-0x0;var _0x183c63=_0x5227[_0xca54f9];return _0x183c63;};'use strict';var _=require(_0x7522('0x0'));var util=require(_0x7522('0x1'));var moment=require(_0x7522('0x2'));var BPromise=require(_0x7522('0x3'));var rs=require(_0x7522('0x4'));var fs=require('fs');var Redis=require(_0x7522('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7522('0x6'));var logger=require(_0x7522('0x7'))(_0x7522('0x8'));var config=require(_0x7522('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7522('0xa')][_0x7522('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26767c,_0xcdd5cd,_0x110f4a){return new BPromise(function(_0x3ebd0a,_0x2f21b5){return client[_0x7522('0xc')](_0x26767c,_0x110f4a)[_0x7522('0xd')](function(_0x2c5e56){logger[_0x7522('0xe')](_0x7522('0xf'),_0xcdd5cd,_0x7522('0x10'));logger['debug'](_0x7522('0x11'),_0xcdd5cd,_0x7522('0x10'),JSON[_0x7522('0x12')](_0x2c5e56));if(_0x2c5e56[_0x7522('0x13')]){if(_0x2c5e56[_0x7522('0x13')][_0x7522('0x14')]===0x1f4){logger['error'](_0x7522('0xf'),_0xcdd5cd,_0x2c5e56[_0x7522('0x13')][_0x7522('0x15')]);return _0x2f21b5(_0x2c5e56[_0x7522('0x13')][_0x7522('0x15')]);}logger[_0x7522('0x13')](_0x7522('0xf'),_0xcdd5cd,_0x2c5e56[_0x7522('0x13')][_0x7522('0x15')]);return _0x3ebd0a(_0x2c5e56[_0x7522('0x13')]['message']);}else{logger['info'](_0x7522('0xf'),_0xcdd5cd,'request\x20sent');_0x3ebd0a(_0x2c5e56[_0x7522('0x16')][_0x7522('0x15')]);}})[_0x7522('0x17')](function(_0x1cd22b){logger[_0x7522('0x13')](_0x7522('0xf'),_0xcdd5cd,_0x1cd22b);_0x2f21b5(_0x1cd22b);});});} \ No newline at end of file +var _0xa3c3=['code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5087f3,_0x30fe8c){var _0x4b5f57=function(_0x566cde){while(--_0x566cde){_0x5087f3['push'](_0x5087f3['shift']());}};_0x4b5f57(++_0x30fe8c);}(_0xa3c3,0xcc));var _0x3a3c=function(_0x568a54,_0x1169c3){_0x568a54=_0x568a54-0x0;var _0x278433=_0xa3c3[_0x568a54];return _0x278433;};'use strict';var _=require(_0x3a3c('0x0'));var util=require('util');var moment=require(_0x3a3c('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a3c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a3c('0x3'))['db'];var utils=require(_0x3a3c('0x4'));var logger=require('../../config/logger')(_0x3a3c('0x5'));var config=require(_0x3a3c('0x6'));var jayson=require(_0x3a3c('0x7'));var client=jayson[_0x3a3c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5557ec,_0x40bb5f,_0x41a760){return new BPromise(function(_0x32f0f3,_0x320953){return client[_0x3a3c('0x9')](_0x5557ec,_0x41a760)['then'](function(_0x358367){logger[_0x3a3c('0xa')](_0x3a3c('0xb'),_0x40bb5f,_0x3a3c('0xc'));logger['debug'](_0x3a3c('0xd'),_0x40bb5f,_0x3a3c('0xc'),JSON[_0x3a3c('0xe')](_0x358367));if(_0x358367[_0x3a3c('0xf')]){if(_0x358367['error'][_0x3a3c('0x10')]===0x1f4){logger[_0x3a3c('0xf')](_0x3a3c('0xb'),_0x40bb5f,_0x358367[_0x3a3c('0xf')][_0x3a3c('0x11')]);return _0x320953(_0x358367[_0x3a3c('0xf')][_0x3a3c('0x11')]);}logger[_0x3a3c('0xf')](_0x3a3c('0xb'),_0x40bb5f,_0x358367[_0x3a3c('0xf')]['message']);return _0x32f0f3(_0x358367[_0x3a3c('0xf')][_0x3a3c('0x11')]);}else{logger['info'](_0x3a3c('0xb'),_0x40bb5f,_0x3a3c('0xc'));_0x32f0f3(_0x358367[_0x3a3c('0x12')][_0x3a3c('0x11')]);}})[_0x3a3c('0x13')](function(_0x33163e){logger[_0x3a3c('0xf')](_0x3a3c('0xb'),_0x40bb5f,_0x33163e);_0x320953(_0x33163e);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b4b830d..eaab3b9 100644 --- a/server/api/voiceDialReport/index.js +++ b/server/api/voiceDialReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2b6=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','put','update','delete','destroy','exports','multer','util'];(function(_0x44655c,_0x9ff70a){var _0x3ad2cd=function(_0x57fad1){while(--_0x57fad1){_0x44655c['push'](_0x44655c['shift']());}};_0x3ad2cd(++_0x9ff70a);}(_0xe2b6,0x1b6));var _0x6e2b=function(_0x4a3611,_0x470408){_0x4a3611=_0x4a3611-0x0;var _0x130be6=_0xe2b6[_0x4a3611];return _0x130be6;};'use strict';var multer=require(_0x6e2b('0x0'));var util=require(_0x6e2b('0x1'));var path=require(_0x6e2b('0x2'));var timeout=require(_0x6e2b('0x3'));var express=require('express');var router=express[_0x6e2b('0x4')]();var fs_extra=require(_0x6e2b('0x5'));var auth=require(_0x6e2b('0x6'));var interaction=require(_0x6e2b('0x7'));var config=require(_0x6e2b('0x8'));var controller=require('./voiceDialReport.controller');router[_0x6e2b('0x9')]('/',auth[_0x6e2b('0xa')](),controller[_0x6e2b('0xb')]);router[_0x6e2b('0x9')](_0x6e2b('0xc'),auth[_0x6e2b('0xa')](),controller['describe']);router['get'](_0x6e2b('0xd'),auth[_0x6e2b('0xa')](),controller['show']);router[_0x6e2b('0xe')]('/',auth[_0x6e2b('0xa')](),controller['create']);router[_0x6e2b('0xf')](_0x6e2b('0xd'),auth[_0x6e2b('0xa')](),controller[_0x6e2b('0x10')]);router[_0x6e2b('0x11')]('/:id',auth[_0x6e2b('0xa')](),controller[_0x6e2b('0x12')]);module[_0x6e2b('0x13')]=router; \ No newline at end of file +var _0x4754=['create','update','delete','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x4abb3c,_0x2a335b){var _0x5cd7e7=function(_0x14fcc7){while(--_0x14fcc7){_0x4abb3c['push'](_0x4abb3c['shift']());}};_0x5cd7e7(++_0x2a335b);}(_0x4754,0x1d4));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4475('0x0'));var timeout=require('connect-timeout');var express=require(_0x4475('0x1'));var router=express['Router']();var fs_extra=require(_0x4475('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x4475('0x3'));var config=require(_0x4475('0x4'));var controller=require(_0x4475('0x5'));router[_0x4475('0x6')]('/',auth[_0x4475('0x7')](),controller[_0x4475('0x8')]);router['get'](_0x4475('0x9'),auth[_0x4475('0x7')](),controller['describe']);router[_0x4475('0x6')](_0x4475('0xa'),auth[_0x4475('0x7')](),controller[_0x4475('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4475('0xc')]);router['put'](_0x4475('0xa'),auth['isAuthenticated'](),controller[_0x4475('0xd')]);router[_0x4475('0xe')](_0x4475('0xa'),auth[_0x4475('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7d976b4..49f4c1e 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x51249a,_0x5b755e){var _0x5073f5=function(_0x2f9265){while(--_0x2f9265){_0x51249a['push'](_0x51249a['shift']());}};_0x5073f5(++_0x5b755e);}(_0xedd9,0xfc));var _0x9edd=function(_0x229f8d,_0x48402c){_0x229f8d=_0x229f8d-0x0;var _0x3e193c=_0xedd9[_0x229f8d];return _0x3e193c;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file +var _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x54ef,0x112));var _0xf54e=function(_0x34d488,_0x53ed9c){_0x34d488=_0x34d488-0x0;var _0x2785dc=_0x54ef[_0x34d488];return _0x2785dc;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index f07cefb..62c3dd2 100644 --- a/server/api/voiceDialReport/voiceDialReport.controller.js +++ b/server/api/voiceDialReport/voiceDialReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d59=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filters','filter','merge','where','options','includeAll','include','findAll','rows','catch','params','length','find','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring'];(function(_0x1d8e00,_0x87e984){var _0x27e849=function(_0x28cd9f){while(--_0x28cd9f){_0x1d8e00['push'](_0x1d8e00['shift']());}};_0x27e849(++_0x87e984);}(_0x0d59,0x160));var _0x90d5=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x0d59[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90d5('0x0'));var zipdir=require(_0x90d5('0x1'));var jsonpatch=require(_0x90d5('0x2'));var rp=require(_0x90d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x90d5('0x4'));var path=require(_0x90d5('0x5'));var sox=require('sox');var csv=require(_0x90d5('0x6'));var ejs=require(_0x90d5('0x7'));var fs=require('fs');var fs_extra=require(_0x90d5('0x8'));var _=require(_0x90d5('0x9'));var squel=require('squel');var crypto=require(_0x90d5('0xa'));var jsforce=require(_0x90d5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x90d5('0x6'));var querystring=require(_0x90d5('0xc'));var Papa=require(_0x90d5('0xd'));var Redis=require('ioredis');var authService=require(_0x90d5('0xe'));var qs=require(_0x90d5('0xf'));var as=require(_0x90d5('0x10'));var hardwareService=require(_0x90d5('0x11'));var logger=require(_0x90d5('0x12'))(_0x90d5('0x13'));var utils=require(_0x90d5('0x14'));var config=require(_0x90d5('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cccaf,_0x398652){_0x398652=_0x398652||0xcc;return function(_0x5d5e95){if(_0x5d5e95){return _0x4cccaf[_0x90d5('0x16')](_0x398652);}return _0x4cccaf[_0x90d5('0x17')](_0x398652)[_0x90d5('0x18')]();};}function respondWithResult(_0x2108c7,_0xcf53c9){_0xcf53c9=_0xcf53c9||0xc8;return function(_0x483e6f){if(_0x483e6f){return _0x2108c7[_0x90d5('0x17')](_0xcf53c9)[_0x90d5('0x19')](_0x483e6f);}};}function respondWithFilteredResult(_0x385c1e,_0x194487){return function(_0x2acfef){if(_0x2acfef){var _0x1c8461=typeof _0x194487[_0x90d5('0x1a')]===_0x90d5('0x1b')&&typeof _0x194487[_0x90d5('0x1c')]===_0x90d5('0x1b');var _0x5ae989=_0x2acfef[_0x90d5('0x1d')];var _0x4802d5=_0x1c8461?0x0:_0x194487[_0x90d5('0x1a')];var _0x13b39f=_0x1c8461?_0x2acfef['count']:_0x194487[_0x90d5('0x1a')]+_0x194487[_0x90d5('0x1c')];var _0x507b36;if(_0x13b39f>=_0x5ae989){_0x13b39f=_0x5ae989;_0x507b36=0xc8;}else{_0x507b36=0xce;}_0x385c1e[_0x90d5('0x17')](_0x507b36);return _0x385c1e[_0x90d5('0x1e')](_0x90d5('0x1f'),_0x4802d5+'-'+_0x13b39f+'/'+_0x5ae989)[_0x90d5('0x19')](_0x2acfef);}return null;};}function patchUpdates(_0xc44afe){return function(_0x3f5533){try{jsonpatch[_0x90d5('0x20')](_0x3f5533,_0xc44afe,!![]);}catch(_0x326197){return BPromise[_0x90d5('0x21')](_0x326197);}return _0x3f5533[_0x90d5('0x22')]();};}function saveUpdates(_0x427126,_0x15f2dd){return function(_0x276210){if(_0x276210){return _0x276210['update'](_0x427126)[_0x90d5('0x23')](function(_0x54b330){return _0x54b330;});}return null;};}function removeEntity(_0x441ad1,_0x4f26f7){return function(_0xc55b74){if(_0xc55b74){return _0xc55b74['destroy']()[_0x90d5('0x23')](function(){_0x441ad1[_0x90d5('0x17')](0xcc)[_0x90d5('0x18')]();});}};}function handleEntityNotFound(_0x7953cb,_0x37f3a0){return function(_0x21d244){if(!_0x21d244){_0x7953cb['sendStatus'](0x194);}return _0x21d244;};}function handleError(_0x3ea87b,_0x4c32ee){_0x4c32ee=_0x4c32ee||0x1f4;return function(_0xd21bd9){logger[_0x90d5('0x24')](_0xd21bd9[_0x90d5('0x25')]);if(_0xd21bd9[_0x90d5('0x26')]){delete _0xd21bd9[_0x90d5('0x26')];}_0x3ea87b[_0x90d5('0x17')](_0x4c32ee)[_0x90d5('0x27')](_0xd21bd9);};}exports[_0x90d5('0x28')]=function(_0x2f77ed,_0xc1effa){var _0x1508bc={},_0x4e5934={},_0x22d4cc={'count':0x0,'rows':[]};var _0x35b418=_[_0x90d5('0x29')](db[_0x90d5('0x2a')][_0x90d5('0x2b')],function(_0x1b073a){return{'name':_0x1b073a[_0x90d5('0x2c')],'type':_0x1b073a[_0x90d5('0x2d')][_0x90d5('0x2e')]};});_0x4e5934[_0x90d5('0x2f')]=_['map'](_0x35b418,_0x90d5('0x26'));_0x4e5934[_0x90d5('0x30')]=_[_0x90d5('0x31')](_0x2f77ed[_0x90d5('0x30')]);_0x4e5934['filters']=_[_0x90d5('0x32')](_0x4e5934[_0x90d5('0x2f')],_0x4e5934[_0x90d5('0x30')]);_0x1508bc[_0x90d5('0x33')]=_[_0x90d5('0x32')](_0x4e5934[_0x90d5('0x2f')],qs[_0x90d5('0x34')](_0x2f77ed[_0x90d5('0x30')][_0x90d5('0x34')]));_0x1508bc['attributes']=_0x1508bc[_0x90d5('0x33')]['length']?_0x1508bc['attributes']:_0x4e5934[_0x90d5('0x2f')];if(!_0x2f77ed[_0x90d5('0x30')][_0x90d5('0x35')]('nolimit')){_0x1508bc[_0x90d5('0x1c')]=qs['limit'](_0x2f77ed[_0x90d5('0x30')][_0x90d5('0x1c')]);_0x1508bc[_0x90d5('0x1a')]=qs[_0x90d5('0x1a')](_0x2f77ed['query'][_0x90d5('0x1a')]);}_0x1508bc[_0x90d5('0x36')]=qs[_0x90d5('0x37')](_0x2f77ed['query'][_0x90d5('0x37')]);_0x1508bc['where']=qs['filters'](_[_0x90d5('0x38')](_0x2f77ed[_0x90d5('0x30')],_0x4e5934[_0x90d5('0x39')]),_0x35b418);if(_0x2f77ed[_0x90d5('0x30')][_0x90d5('0x3a')]){_0x1508bc['where']=_[_0x90d5('0x3b')](_0x1508bc[_0x90d5('0x3c')],{'$or':_[_0x90d5('0x29')](_0x35b418,function(_0xe20885){if(_0xe20885[_0x90d5('0x2d')]!=='VIRTUAL'){var _0x2462eb={};_0x2462eb[_0xe20885[_0x90d5('0x26')]]={'$like':'%'+_0x2f77ed[_0x90d5('0x30')][_0x90d5('0x3a')]+'%'};return _0x2462eb;}})});}_0x1508bc=_[_0x90d5('0x3b')]({},_0x1508bc,_0x2f77ed[_0x90d5('0x3d')]);var _0x2819ed={'where':_0x1508bc['where']};return db[_0x90d5('0x2a')][_0x90d5('0x1d')](_0x2819ed)[_0x90d5('0x23')](function(_0x4950e6){_0x22d4cc['count']=_0x4950e6;if(_0x2f77ed[_0x90d5('0x30')][_0x90d5('0x3e')]){_0x1508bc[_0x90d5('0x3f')]=[{'all':!![]}];}return db[_0x90d5('0x2a')][_0x90d5('0x40')](_0x1508bc);})[_0x90d5('0x23')](function(_0x11eb6e){_0x22d4cc[_0x90d5('0x41')]=_0x11eb6e;return _0x22d4cc;})[_0x90d5('0x23')](respondWithFilteredResult(_0xc1effa,_0x1508bc))[_0x90d5('0x42')](handleError(_0xc1effa,null));};exports['show']=function(_0xfb4311,_0x538307){var _0x43210d={'raw':!![],'where':{'id':_0xfb4311[_0x90d5('0x43')]['id']}},_0x29e625={};_0x29e625[_0x90d5('0x2f')]=_[_0x90d5('0x31')](db[_0x90d5('0x2a')][_0x90d5('0x2b')]);_0x29e625[_0x90d5('0x30')]=_[_0x90d5('0x31')](_0xfb4311[_0x90d5('0x30')]);_0x29e625[_0x90d5('0x39')]=_['intersection'](_0x29e625[_0x90d5('0x2f')],_0x29e625[_0x90d5('0x30')]);_0x43210d[_0x90d5('0x33')]=_['intersection'](_0x29e625['model'],qs[_0x90d5('0x34')](_0xfb4311[_0x90d5('0x30')][_0x90d5('0x34')]));_0x43210d[_0x90d5('0x33')]=_0x43210d[_0x90d5('0x33')][_0x90d5('0x44')]?_0x43210d[_0x90d5('0x33')]:_0x29e625[_0x90d5('0x2f')];if(_0xfb4311[_0x90d5('0x30')][_0x90d5('0x3e')]){_0x43210d[_0x90d5('0x3f')]=[{'all':!![]}];}_0x43210d=_['merge']({},_0x43210d,_0xfb4311[_0x90d5('0x3d')]);return db[_0x90d5('0x2a')][_0x90d5('0x45')](_0x43210d)[_0x90d5('0x23')](handleEntityNotFound(_0x538307,null))['then'](respondWithResult(_0x538307,null))[_0x90d5('0x42')](handleError(_0x538307,null));};exports['create']=function(_0x4c6798,_0xbb87b8){return db[_0x90d5('0x2a')]['create'](_0x4c6798[_0x90d5('0x46')],{})[_0x90d5('0x23')](respondWithResult(_0xbb87b8,0xc9))['catch'](handleError(_0xbb87b8,null));};exports['update']=function(_0x449147,_0x3a65ef){if(_0x449147[_0x90d5('0x46')]['id']){delete _0x449147['body']['id'];}return db[_0x90d5('0x2a')][_0x90d5('0x45')]({'where':{'id':_0x449147['params']['id']}})[_0x90d5('0x23')](handleEntityNotFound(_0x3a65ef,null))['then'](saveUpdates(_0x449147['body'],null))['then'](respondWithResult(_0x3a65ef,null))['catch'](handleError(_0x3a65ef,null));};exports[_0x90d5('0x47')]=function(_0x98a0c1,_0x165cf3){return db['VoiceDialReport']['find']({'where':{'id':_0x98a0c1[_0x90d5('0x43')]['id']}})[_0x90d5('0x23')](handleEntityNotFound(_0x165cf3,null))[_0x90d5('0x23')](removeEntity(_0x165cf3,null))['catch'](handleError(_0x165cf3,null));};exports[_0x90d5('0x48')]=function(_0xfbcb85,_0x3ba9a3){return db[_0x90d5('0x2a')][_0x90d5('0x48')]()['then'](respondWithResult(_0x3ba9a3,null))[_0x90d5('0x42')](handleError(_0x3ba9a3,null));}; \ No newline at end of file +var _0x5c0d=['attributes','fields','length','hasOwnProperty','nolimit','limit','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x5c0d,0x1d0));var _0xd5c0=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x5c0d[_0x13ce0c];return _0x4388fb;};'use strict';var emlformat=require(_0xd5c0('0x0'));var rimraf=require(_0xd5c0('0x1'));var zipdir=require(_0xd5c0('0x2'));var jsonpatch=require(_0xd5c0('0x3'));var rp=require(_0xd5c0('0x4'));var moment=require('moment');var BPromise=require(_0xd5c0('0x5'));var Mustache=require(_0xd5c0('0x6'));var util=require('util');var path=require(_0xd5c0('0x7'));var sox=require(_0xd5c0('0x8'));var csv=require(_0xd5c0('0x9'));var ejs=require(_0xd5c0('0xa'));var fs=require('fs');var fs_extra=require(_0xd5c0('0xb'));var _=require('lodash');var squel=require(_0xd5c0('0xc'));var crypto=require(_0xd5c0('0xd'));var jsforce=require(_0xd5c0('0xe'));var deskjs=require(_0xd5c0('0xf'));var toCsv=require(_0xd5c0('0x9'));var querystring=require(_0xd5c0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd5c0('0x11'));var qs=require(_0xd5c0('0x12'));var as=require(_0xd5c0('0x13'));var hardwareService=require(_0xd5c0('0x14'));var logger=require('../../config/logger')(_0xd5c0('0x15'));var utils=require(_0xd5c0('0x16'));var config=require(_0xd5c0('0x17'));var licenseUtil=require(_0xd5c0('0x18'));var db=require(_0xd5c0('0x19'))['db'];function respondWithStatusCode(_0x4d319d,_0x5be4e6){_0x5be4e6=_0x5be4e6||0xcc;return function(_0x3a20fc){if(_0x3a20fc){return _0x4d319d[_0xd5c0('0x1a')](_0x5be4e6);}return _0x4d319d[_0xd5c0('0x1b')](_0x5be4e6)[_0xd5c0('0x1c')]();};}function respondWithResult(_0xe19406,_0x4e3e71){_0x4e3e71=_0x4e3e71||0xc8;return function(_0x1d9324){if(_0x1d9324){return _0xe19406[_0xd5c0('0x1b')](_0x4e3e71)[_0xd5c0('0x1d')](_0x1d9324);}};}function respondWithFilteredResult(_0x4d5e66,_0x15cfbb){return function(_0x95da68){if(_0x95da68){var _0x586b79=typeof _0x15cfbb[_0xd5c0('0x1e')]===_0xd5c0('0x1f')&&typeof _0x15cfbb['limit']===_0xd5c0('0x1f');var _0x122c40=_0x95da68[_0xd5c0('0x20')];var _0x2be006=_0x586b79?0x0:_0x15cfbb[_0xd5c0('0x1e')];var _0x5209cc=_0x586b79?_0x95da68[_0xd5c0('0x20')]:_0x15cfbb[_0xd5c0('0x1e')]+_0x15cfbb['limit'];var _0xe3eecf;if(_0x5209cc>=_0x122c40){_0x5209cc=_0x122c40;_0xe3eecf=0xc8;}else{_0xe3eecf=0xce;}_0x4d5e66[_0xd5c0('0x1b')](_0xe3eecf);return _0x4d5e66[_0xd5c0('0x21')](_0xd5c0('0x22'),_0x2be006+'-'+_0x5209cc+'/'+_0x122c40)['json'](_0x95da68);}return null;};}function patchUpdates(_0x53c2de){return function(_0x3c7edd){try{jsonpatch[_0xd5c0('0x23')](_0x3c7edd,_0x53c2de,!![]);}catch(_0x1f6aef){return BPromise[_0xd5c0('0x24')](_0x1f6aef);}return _0x3c7edd['save']();};}function saveUpdates(_0x5b597d,_0x3ca96e){return function(_0x2d9755){if(_0x2d9755){return _0x2d9755['update'](_0x5b597d)[_0xd5c0('0x25')](function(_0x3cd7a4){return _0x3cd7a4;});}return null;};}function removeEntity(_0x486f33,_0x146e6d){return function(_0xa0c7d1){if(_0xa0c7d1){return _0xa0c7d1[_0xd5c0('0x26')]()['then'](function(){_0x486f33['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2035e5,_0x52992b){return function(_0x3535b7){if(!_0x3535b7){_0x2035e5[_0xd5c0('0x1a')](0x194);}return _0x3535b7;};}function handleError(_0x455f29,_0x375e38){_0x375e38=_0x375e38||0x1f4;return function(_0xe601cb){logger[_0xd5c0('0x27')](_0xe601cb['stack']);if(_0xe601cb[_0xd5c0('0x28')]){delete _0xe601cb[_0xd5c0('0x28')];}_0x455f29[_0xd5c0('0x1b')](_0x375e38)[_0xd5c0('0x29')](_0xe601cb);};}exports[_0xd5c0('0x2a')]=function(_0x5956ae,_0x2b9b96){var _0x4927a8={},_0x4eeec3={},_0xb9c427={'count':0x0,'rows':[]};var _0x470f01=_[_0xd5c0('0x2b')](db[_0xd5c0('0x2c')][_0xd5c0('0x2d')],function(_0x8458a9){return{'name':_0x8458a9[_0xd5c0('0x2e')],'type':_0x8458a9[_0xd5c0('0x2f')][_0xd5c0('0x30')]};});_0x4eeec3[_0xd5c0('0x31')]=_['map'](_0x470f01,_0xd5c0('0x28'));_0x4eeec3[_0xd5c0('0x32')]=_[_0xd5c0('0x33')](_0x5956ae[_0xd5c0('0x32')]);_0x4eeec3[_0xd5c0('0x34')]=_[_0xd5c0('0x35')](_0x4eeec3[_0xd5c0('0x31')],_0x4eeec3['query']);_0x4927a8[_0xd5c0('0x36')]=_[_0xd5c0('0x35')](_0x4eeec3[_0xd5c0('0x31')],qs['fields'](_0x5956ae[_0xd5c0('0x32')][_0xd5c0('0x37')]));_0x4927a8[_0xd5c0('0x36')]=_0x4927a8[_0xd5c0('0x36')][_0xd5c0('0x38')]?_0x4927a8[_0xd5c0('0x36')]:_0x4eeec3[_0xd5c0('0x31')];if(!_0x5956ae[_0xd5c0('0x32')][_0xd5c0('0x39')](_0xd5c0('0x3a'))){_0x4927a8[_0xd5c0('0x3b')]=qs[_0xd5c0('0x3b')](_0x5956ae[_0xd5c0('0x32')][_0xd5c0('0x3b')]);_0x4927a8[_0xd5c0('0x1e')]=qs[_0xd5c0('0x1e')](_0x5956ae[_0xd5c0('0x32')]['offset']);}_0x4927a8['order']=qs['sort'](_0x5956ae[_0xd5c0('0x32')]['sort']);_0x4927a8[_0xd5c0('0x3c')]=qs[_0xd5c0('0x34')](_['pick'](_0x5956ae[_0xd5c0('0x32')],_0x4eeec3[_0xd5c0('0x34')]),_0x470f01);if(_0x5956ae[_0xd5c0('0x32')][_0xd5c0('0x3d')]){_0x4927a8[_0xd5c0('0x3c')]=_['merge'](_0x4927a8[_0xd5c0('0x3c')],{'$or':_['map'](_0x470f01,function(_0x31896d){if(_0x31896d[_0xd5c0('0x2f')]!==_0xd5c0('0x3e')){var _0x4afd56={};_0x4afd56[_0x31896d[_0xd5c0('0x28')]]={'$like':'%'+_0x5956ae[_0xd5c0('0x32')]['filter']+'%'};return _0x4afd56;}})});}_0x4927a8=_[_0xd5c0('0x3f')]({},_0x4927a8,_0x5956ae[_0xd5c0('0x40')]);var _0x1d5234={'where':_0x4927a8['where']};return db[_0xd5c0('0x2c')][_0xd5c0('0x20')](_0x1d5234)[_0xd5c0('0x25')](function(_0x13ac09){_0xb9c427['count']=_0x13ac09;if(_0x5956ae[_0xd5c0('0x32')][_0xd5c0('0x41')]){_0x4927a8[_0xd5c0('0x42')]=[{'all':!![]}];}return db[_0xd5c0('0x2c')][_0xd5c0('0x43')](_0x4927a8);})[_0xd5c0('0x25')](function(_0x2a5fc9){_0xb9c427['rows']=_0x2a5fc9;return _0xb9c427;})[_0xd5c0('0x25')](respondWithFilteredResult(_0x2b9b96,_0x4927a8))[_0xd5c0('0x44')](handleError(_0x2b9b96,null));};exports[_0xd5c0('0x45')]=function(_0x271dea,_0xbee5e){var _0x234d1b={'raw':!![],'where':{'id':_0x271dea[_0xd5c0('0x46')]['id']}},_0x2d4fe6={};_0x2d4fe6['model']=_[_0xd5c0('0x33')](db[_0xd5c0('0x2c')][_0xd5c0('0x2d')]);_0x2d4fe6[_0xd5c0('0x32')]=_[_0xd5c0('0x33')](_0x271dea[_0xd5c0('0x32')]);_0x2d4fe6['filters']=_[_0xd5c0('0x35')](_0x2d4fe6['model'],_0x2d4fe6[_0xd5c0('0x32')]);_0x234d1b[_0xd5c0('0x36')]=_[_0xd5c0('0x35')](_0x2d4fe6[_0xd5c0('0x31')],qs[_0xd5c0('0x37')](_0x271dea[_0xd5c0('0x32')][_0xd5c0('0x37')]));_0x234d1b[_0xd5c0('0x36')]=_0x234d1b[_0xd5c0('0x36')]['length']?_0x234d1b[_0xd5c0('0x36')]:_0x2d4fe6[_0xd5c0('0x31')];if(_0x271dea['query']['includeAll']){_0x234d1b[_0xd5c0('0x42')]=[{'all':!![]}];}_0x234d1b=_[_0xd5c0('0x3f')]({},_0x234d1b,_0x271dea[_0xd5c0('0x40')]);return db[_0xd5c0('0x2c')][_0xd5c0('0x47')](_0x234d1b)[_0xd5c0('0x25')](handleEntityNotFound(_0xbee5e,null))[_0xd5c0('0x25')](respondWithResult(_0xbee5e,null))['catch'](handleError(_0xbee5e,null));};exports['create']=function(_0x5b5bd2,_0x4c5fb5){return db['VoiceDialReport']['create'](_0x5b5bd2[_0xd5c0('0x48')],{})['then'](respondWithResult(_0x4c5fb5,0xc9))[_0xd5c0('0x44')](handleError(_0x4c5fb5,null));};exports['update']=function(_0x19a72f,_0x366726){if(_0x19a72f['body']['id']){delete _0x19a72f[_0xd5c0('0x48')]['id'];}return db[_0xd5c0('0x2c')][_0xd5c0('0x47')]({'where':{'id':_0x19a72f[_0xd5c0('0x46')]['id']}})[_0xd5c0('0x25')](handleEntityNotFound(_0x366726,null))[_0xd5c0('0x25')](saveUpdates(_0x19a72f[_0xd5c0('0x48')],null))[_0xd5c0('0x25')](respondWithResult(_0x366726,null))[_0xd5c0('0x44')](handleError(_0x366726,null));};exports[_0xd5c0('0x26')]=function(_0x603e4,_0x4ca6cc){return db[_0xd5c0('0x2c')][_0xd5c0('0x47')]({'where':{'id':_0x603e4['params']['id']}})[_0xd5c0('0x25')](handleEntityNotFound(_0x4ca6cc,null))[_0xd5c0('0x25')](removeEntity(_0x4ca6cc,null))['catch'](handleError(_0x4ca6cc,null));};exports[_0xd5c0('0x49')]=function(_0x5d15f4,_0x1e2e6f){return db[_0xd5c0('0x2c')][_0xd5c0('0x49')]()[_0xd5c0('0x25')](respondWithResult(_0x1e2e6f,null))['catch'](handleError(_0x1e2e6f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 12b09cf..a85e285 100644 --- a/server/api/voiceDialReport/voiceDialReport.model.js +++ b/server/api/voiceDialReport/voiceDialReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc627=['./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xc627,0x14a));var _0x7c62=function(_0x1f673f,_0x8c2c64){_0x1f673f=_0x1f673f-0x0;var _0x1fe775=_0xc627[_0x1f673f];return _0x1fe775;};'use strict';var _=require('lodash');var util=require(_0x7c62('0x0'));var logger=require(_0x7c62('0x1'))(_0x7c62('0x2'));var moment=require('moment');var BPromise=require(_0x7c62('0x3'));var rp=require(_0x7c62('0x4'));var fs=require('fs');var path=require(_0x7c62('0x5'));var rimraf=require(_0x7c62('0x6'));var config=require(_0x7c62('0x7'));var attributes=require(_0x7c62('0x8'));module[_0x7c62('0x9')]=function(_0x448f4b,_0x25a5c8){return _0x448f4b[_0x7c62('0xa')](_0x7c62('0xb'),attributes,{'tableName':_0x7c62('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9a95=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial'];(function(_0x592fde,_0x2157a6){var _0x9cfdff=function(_0x4495c0){while(--_0x4495c0){_0x592fde['push'](_0x592fde['shift']());}};_0x9cfdff(++_0x2157a6);}(_0x9a95,0xb5));var _0x59a9=function(_0x505a02,_0x25a534){_0x505a02=_0x505a02-0x0;var _0x5d4323=_0x9a95[_0x505a02];return _0x5d4323;};'use strict';var _=require(_0x59a9('0x0'));var util=require(_0x59a9('0x1'));var logger=require(_0x59a9('0x2'))(_0x59a9('0x3'));var moment=require(_0x59a9('0x4'));var BPromise=require(_0x59a9('0x5'));var rp=require(_0x59a9('0x6'));var fs=require('fs');var path=require(_0x59a9('0x7'));var rimraf=require(_0x59a9('0x8'));var config=require(_0x59a9('0x9'));var attributes=require('./voiceDialReport.attributes');module[_0x59a9('0xa')]=function(_0x37bb4d,_0x50daf2){return _0x37bb4d[_0x59a9('0xb')](_0x59a9('0xc'),attributes,{'tableName':_0x59a9('0xd'),'paranoid':![],'indexes':[{'fields':[_0x59a9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 48fc888..96dc97c 100644 --- a/server/api/voiceDialReport/voiceDialReport.rpc.js +++ b/server/api/voiceDialReport/voiceDialReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8474=['rpc','jayson/promise','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','update','attributes','limit','then','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x485cca,_0x316194){var _0x1eeaa0=function(_0x17fa77){while(--_0x17fa77){_0x485cca['push'](_0x485cca['shift']());}};_0x1eeaa0(++_0x316194);}(_0x8474,0x1a4));var _0x4847=function(_0x406e1d,_0x58be6a){_0x406e1d=_0x406e1d-0x0;var _0x175567=_0x8474[_0x406e1d];return _0x175567;};'use strict';var _=require(_0x4847('0x0'));var util=require(_0x4847('0x1'));var moment=require(_0x4847('0x2'));var BPromise=require(_0x4847('0x3'));var rs=require(_0x4847('0x4'));var fs=require('fs');var Redis=require(_0x4847('0x5'));var db=require(_0x4847('0x6'))['db'];var utils=require(_0x4847('0x7'));var logger=require(_0x4847('0x8'))(_0x4847('0x9'));var config=require('../../config/environment');var jayson=require(_0x4847('0xa'));var client=jayson['client'][_0x4847('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ec40f,_0x42825a,_0xc4e213){return new BPromise(function(_0x3340e6,_0x50a79d){return client[_0x4847('0xc')](_0x2ec40f,_0xc4e213)['then'](function(_0x220457){logger[_0x4847('0xd')](_0x4847('0xe'),_0x42825a,_0x4847('0xf'));logger[_0x4847('0x10')](_0x4847('0x11'),_0x42825a,_0x4847('0xf'),JSON[_0x4847('0x12')](_0x220457));if(_0x220457[_0x4847('0x13')]){if(_0x220457[_0x4847('0x13')][_0x4847('0x14')]===0x1f4){logger[_0x4847('0x13')](_0x4847('0xe'),_0x42825a,_0x220457[_0x4847('0x13')][_0x4847('0x15')]);return _0x50a79d(_0x220457['error'][_0x4847('0x15')]);}logger[_0x4847('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x42825a,_0x220457[_0x4847('0x13')]['message']);return _0x3340e6(_0x220457['error'][_0x4847('0x15')]);}else{logger[_0x4847('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x42825a,_0x4847('0xf'));_0x3340e6(_0x220457['result'][_0x4847('0x15')]);}})[_0x4847('0x16')](function(_0x1ce747){logger[_0x4847('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x42825a,_0x1ce747);_0x50a79d(_0x1ce747);});});}exports[_0x4847('0x17')]=function(_0x137881){var _0x579676=this;return new Promise(function(_0x1d421b,_0x4fe60a){return db[_0x4847('0x18')]['create'](_0x137881[_0x4847('0x19')],{'raw':_0x137881['options']?_0x137881[_0x4847('0x1a')][_0x4847('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x441b23){logger[_0x4847('0xd')](_0x4847('0x17'),_0x137881);logger[_0x4847('0x10')]('CreateVoiceDialReport',_0x137881,JSON[_0x4847('0x12')](_0x441b23));_0x1d421b(_0x441b23);})[_0x4847('0x16')](function(_0x3d8b8c){logger[_0x4847('0x13')]('CreateVoiceDialReport',_0x3d8b8c[_0x4847('0x15')],_0x137881);_0x4fe60a(_0x579676['error'](0x1f4,_0x3d8b8c['message']));});});};exports['UpdateVoiceDialReport']=function(_0x34788c){var _0x4ab040=this;return new Promise(function(_0x5c4f6b,_0x10736a){return db[_0x4847('0x18')][_0x4847('0x1c')](_0x34788c[_0x4847('0x19')],{'raw':_0x34788c[_0x4847('0x1a')]?_0x34788c[_0x4847('0x1a')][_0x4847('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34788c[_0x4847('0x1a')]?_0x34788c[_0x4847('0x1a')]['where']||null:null,'attributes':_0x34788c['options']?_0x34788c[_0x4847('0x1a')][_0x4847('0x1d')]||null:null,'limit':_0x34788c[_0x4847('0x1a')]?_0x34788c['options'][_0x4847('0x1e')]||null:null})[_0x4847('0x1f')](function(_0x2274e0){logger['info'](_0x4847('0x20'),_0x34788c);logger[_0x4847('0x10')](_0x4847('0x20'),_0x34788c,JSON[_0x4847('0x12')](_0x2274e0));_0x5c4f6b(_0x2274e0);})[_0x4847('0x16')](function(_0x5b0e56){logger['error'](_0x4847('0x20'),_0x5b0e56[_0x4847('0x15')],_0x34788c);_0x10736a(_0x4ab040[_0x4847('0x13')](0x1f4,_0x5b0e56['message']));});});}; \ No newline at end of file +var _0xcedd=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','attributes','lodash','util','moment','bluebird','ioredis'];(function(_0x1ee239,_0x339077){var _0x390b48=function(_0x40e6ff){while(--_0x40e6ff){_0x1ee239['push'](_0x1ee239['shift']());}};_0x390b48(++_0x339077);}(_0xcedd,0x14f));var _0xdced=function(_0x18d9c9,_0x54e207){_0x18d9c9=_0x18d9c9-0x0;var _0x4eff47=_0xcedd[_0x18d9c9];return _0x4eff47;};'use strict';var _=require(_0xdced('0x0'));var util=require(_0xdced('0x1'));var moment=require(_0xdced('0x2'));var BPromise=require(_0xdced('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdced('0x4'));var db=require(_0xdced('0x5'))['db'];var utils=require(_0xdced('0x6'));var logger=require('../../config/logger')(_0xdced('0x7'));var config=require('../../config/environment');var jayson=require(_0xdced('0x8'));var client=jayson[_0xdced('0x9')][_0xdced('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4520f2,_0x291ccf,_0x2d0b6e){return new BPromise(function(_0x2122d0,_0x30a456){return client[_0xdced('0xb')](_0x4520f2,_0x2d0b6e)[_0xdced('0xc')](function(_0x489e3c){logger[_0xdced('0xd')](_0xdced('0xe'),_0x291ccf,'request\x20sent');logger[_0xdced('0xf')](_0xdced('0x10'),_0x291ccf,_0xdced('0x11'),JSON[_0xdced('0x12')](_0x489e3c));if(_0x489e3c[_0xdced('0x13')]){if(_0x489e3c[_0xdced('0x13')][_0xdced('0x14')]===0x1f4){logger[_0xdced('0x13')](_0xdced('0xe'),_0x291ccf,_0x489e3c[_0xdced('0x13')]['message']);return _0x30a456(_0x489e3c[_0xdced('0x13')][_0xdced('0x15')]);}logger['error'](_0xdced('0xe'),_0x291ccf,_0x489e3c[_0xdced('0x13')][_0xdced('0x15')]);return _0x2122d0(_0x489e3c['error'][_0xdced('0x15')]);}else{logger['info'](_0xdced('0xe'),_0x291ccf,_0xdced('0x11'));_0x2122d0(_0x489e3c[_0xdced('0x16')]['message']);}})[_0xdced('0x17')](function(_0x22b7a7){logger['error'](_0xdced('0xe'),_0x291ccf,_0x22b7a7);_0x30a456(_0x22b7a7);});});}exports['CreateVoiceDialReport']=function(_0x218fa2){var _0x49ce07=this;return new Promise(function(_0x2e26f2,_0x3ca9a6){return db[_0xdced('0x18')][_0xdced('0x19')](_0x218fa2[_0xdced('0x1a')],{'raw':_0x218fa2[_0xdced('0x1b')]?_0x218fa2[_0xdced('0x1b')][_0xdced('0x1c')]===undefined?!![]:![]:!![]})[_0xdced('0xc')](function(_0x274168){logger[_0xdced('0xd')](_0xdced('0x1d'),_0x218fa2);logger['debug'](_0xdced('0x1d'),_0x218fa2,JSON['stringify'](_0x274168));_0x2e26f2(_0x274168);})[_0xdced('0x17')](function(_0x3e6e30){logger[_0xdced('0x13')]('CreateVoiceDialReport',_0x3e6e30[_0xdced('0x15')],_0x218fa2);_0x3ca9a6(_0x49ce07['error'](0x1f4,_0x3e6e30[_0xdced('0x15')]));});});};exports[_0xdced('0x1e')]=function(_0x452aeb){var _0x4d5cf8=this;return new Promise(function(_0x38b369,_0x430eb6){return db['VoiceDialReport'][_0xdced('0x1f')](_0x452aeb[_0xdced('0x1a')],{'raw':_0x452aeb[_0xdced('0x1b')]?_0x452aeb['options'][_0xdced('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x452aeb[_0xdced('0x1b')]?_0x452aeb[_0xdced('0x1b')][_0xdced('0x20')]||null:null,'attributes':_0x452aeb[_0xdced('0x1b')]?_0x452aeb['options'][_0xdced('0x21')]||null:null,'limit':_0x452aeb[_0xdced('0x1b')]?_0x452aeb[_0xdced('0x1b')]['limit']||null:null})['then'](function(_0x3460b5){logger[_0xdced('0xd')](_0xdced('0x1e'),_0x452aeb);logger[_0xdced('0xf')](_0xdced('0x1e'),_0x452aeb,JSON[_0xdced('0x12')](_0x3460b5));_0x38b369(_0x3460b5);})[_0xdced('0x17')](function(_0x4a4206){logger[_0xdced('0x13')](_0xdced('0x1e'),_0x4a4206[_0xdced('0x15')],_0x452aeb);_0x430eb6(_0x4d5cf8['error'](0x1f4,_0x4a4206[_0xdced('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 4f5c033..dc6ae65 100644 --- a/server/api/voiceExtension/index.js +++ b/server/api/voiceExtension/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72ae=['../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x72ae,0x185));var _0xe72a=function(_0x5d3f1e,_0x7e3c77){_0x5d3f1e=_0x5d3f1e-0x0;var _0x4f81e1=_0x72ae[_0x5d3f1e];return _0x4f81e1;};'use strict';var multer=require(_0xe72a('0x0'));var util=require(_0xe72a('0x1'));var path=require(_0xe72a('0x2'));var timeout=require(_0xe72a('0x3'));var express=require(_0xe72a('0x4'));var router=express['Router']();var fs_extra=require(_0xe72a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe72a('0x6'));var config=require(_0xe72a('0x7'));var controller=require(_0xe72a('0x8'));router[_0xe72a('0x9')]('/',auth['isAuthenticated'](),controller[_0xe72a('0xa')]);router[_0xe72a('0x9')](_0xe72a('0xb'),auth[_0xe72a('0xc')](),controller[_0xe72a('0xd')]);router[_0xe72a('0xe')]('/',auth[_0xe72a('0xc')](),controller[_0xe72a('0xf')]);router[_0xe72a('0xe')]('/:id/applications',auth['isAuthenticated'](),controller[_0xe72a('0x10')]);router[_0xe72a('0x11')]('/:id',auth[_0xe72a('0xc')](),controller[_0xe72a('0x12')]);router[_0xe72a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xe72a('0x14')]);module[_0xe72a('0x15')]=router; \ No newline at end of file +var _0x6c51=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','/:id/applications','put','delete','destroy'];(function(_0x28ff6f,_0x286ecd){var _0x2f17e5=function(_0x1a5099){while(--_0x1a5099){_0x28ff6f['push'](_0x28ff6f['shift']());}};_0x2f17e5(++_0x286ecd);}(_0x6c51,0x10f));var _0x16c5=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6c51[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x16c5('0x0'));var path=require(_0x16c5('0x1'));var timeout=require('connect-timeout');var express=require(_0x16c5('0x2'));var router=express[_0x16c5('0x3')]();var fs_extra=require(_0x16c5('0x4'));var auth=require(_0x16c5('0x5'));var interaction=require(_0x16c5('0x6'));var config=require(_0x16c5('0x7'));var controller=require('./voiceExtension.controller');router[_0x16c5('0x8')]('/',auth[_0x16c5('0x9')](),controller['index']);router[_0x16c5('0x8')](_0x16c5('0xa'),auth[_0x16c5('0x9')](),controller[_0x16c5('0xb')]);router[_0x16c5('0xc')]('/',auth[_0x16c5('0x9')](),controller['create']);router[_0x16c5('0xc')](_0x16c5('0xd'),auth['isAuthenticated'](),controller['addApplications']);router[_0x16c5('0xe')](_0x16c5('0xa'),auth[_0x16c5('0x9')](),controller['update']);router[_0x16c5('0xf')](_0x16c5('0xa'),auth[_0x16c5('0x9')](),controller[_0x16c5('0x10')]);module[_0x16c5('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 87c0262..5e712df 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5b9=['NoOp','ENUM','outbound','internal','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex'];(function(_0x2f285a,_0x17a485){var _0x2de2ad=function(_0x3d627f){while(--_0x3d627f){_0x2f285a['push'](_0x2f285a['shift']());}};_0x2de2ad(++_0x17a485);}(_0xd5b9,0xfb));var _0x9d5b=function(_0x272f11,_0x3f3538){_0x272f11=_0x272f11-0x0;var _0x39c3d5=_0xd5b9[_0x272f11];return _0x39c3d5;};'use strict';var Sequelize=require(_0x9d5b('0x0'));module[_0x9d5b('0x1')]={'context':{'type':Sequelize[_0x9d5b('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x9d5b('0x2')],'allowNull':![],'unique':_0x9d5b('0x3')},'priority':{'type':Sequelize[_0x9d5b('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x9d5b('0x3')},'tag':{'type':Sequelize[_0x9d5b('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x9d5b('0x2')],'allowNull':![],'defaultValue':_0x9d5b('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x9d5b('0x5')]('inbound',_0x9d5b('0x6'),_0x9d5b('0x7'),'inbound-fax',_0x9d5b('0x8'),'system',_0x9d5b('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9d5b('0xa')},'IntervalId':{'type':Sequelize[_0x9d5b('0xb')]},'isApp':{'type':Sequelize[_0x9d5b('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x9d5b('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x9d5b('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x9d5b('0xb')]},'recordingFormat':{'type':Sequelize[_0x9d5b('0x2')],'defaultValue':_0x9d5b('0xd')},'answer':{'type':Sequelize[_0x9d5b('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x9d5b('0xe')],'get':function(_0x271d5f){return this[_0x9d5b('0xf')](_0x9d5b('0x10'));}},'alias':{'type':Sequelize[_0x9d5b('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x472f=['internal','inbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x35f6d0,_0x4f2153){var _0x332ed4=function(_0x3388b4){while(--_0x3388b4){_0x35f6d0['push'](_0x35f6d0['shift']());}};_0x332ed4(++_0x4f2153);}(_0x472f,0x119));var _0xf472=function(_0x1c777,_0x225ed0){_0x1c777=_0x1c777-0x0;var _0x4f895f=_0x472f[_0x1c777];return _0x4f895f;};'use strict';var Sequelize=require(_0xf472('0x0'));module[_0xf472('0x1')]={'context':{'type':Sequelize[_0xf472('0x2')],'allowNull':![],'unique':_0xf472('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf472('0x2')],'allowNull':![],'unique':_0xf472('0x3')},'priority':{'type':Sequelize[_0xf472('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xf472('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf472('0x2')],'allowNull':![],'defaultValue':_0xf472('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf472('0x5')](_0xf472('0x6'),_0xf472('0x7'),_0xf472('0x8'),_0xf472('0x9'),'outbound-fax','system',_0xf472('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf472('0x2')],'allowNull':![],'defaultValue':_0xf472('0xb')},'IntervalId':{'type':Sequelize[_0xf472('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xf472('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xf472('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf472('0xc')]},'recordingFormat':{'type':Sequelize[_0xf472('0x2')],'defaultValue':_0xf472('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xf472('0xf')],'get':function(_0x3c6431){return this[_0xf472('0x10')]('exten');}},'alias':{'type':Sequelize[_0xf472('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 12bfb66..d12f471 100644 --- a/server/api/voiceExtension/voiceExtension.controller.js +++ b/server/api/voiceExtension/voiceExtension.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc009=['startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','InternalRoutes','userProfileId','autoAssociation','update','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','get','InboundRoutes','inbound','outbound','internal','ignore','map','value','type','name','UserProfileResource','error','stack','send','index','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body'];(function(_0x3c2646,_0x414fda){var _0x3047a5=function(_0x5c4ac7){while(--_0x5c4ac7){_0x3c2646['push'](_0x3c2646['shift']());}};_0x3047a5(++_0x414fda);}(_0xc009,0x77));var _0x9c00=function(_0x177dee,_0x5f3a77){_0x177dee=_0x177dee-0x0;var _0x2b3a83=_0xc009[_0x177dee];return _0x2b3a83;};'use strict';var _=require(_0x9c00('0x0'));var Redis=require(_0x9c00('0x1'));var qs=require(_0x9c00('0x2'));var logger=require(_0x9c00('0x3'))(_0x9c00('0x4'));var config=require(_0x9c00('0x5'));var db=require(_0x9c00('0x6'))['db'];config['redis']=_[_0x9c00('0x7')](config[_0x9c00('0x8')],{'host':_0x9c00('0x9'),'port':0x18eb});var socket=require(_0x9c00('0xa'))(new Redis(config[_0x9c00('0x8')]));require(_0x9c00('0xb'))[_0x9c00('0xc')](socket);function respondWithStatusCode(_0x4c5e53,_0x31f88d){_0x31f88d=_0x31f88d||0xcc;return function(_0x18b165){if(_0x18b165){return _0x4c5e53[_0x9c00('0xd')](_0x31f88d);}return _0x4c5e53['status'](_0x31f88d)[_0x9c00('0xe')]();};}function respondWithResult(_0x473551,_0x253feb){_0x253feb=_0x253feb||0xc8;return function(_0x348da2){if(_0x348da2){return _0x473551[_0x9c00('0xf')](_0x253feb)[_0x9c00('0x10')](_0x348da2);}};}function respondWithFilteredResult(_0x237b1a,_0x22af3f){return function(_0x267a84){if(_0x267a84){var _0x11c2a6=typeof _0x22af3f[_0x9c00('0x11')]==='undefined'&&typeof _0x22af3f['limit']===_0x9c00('0x12');var _0x578f3f=_0x267a84['count'];var _0x1331ab=_0x11c2a6?0x0:_0x22af3f[_0x9c00('0x11')];var _0xcd532f=_0x11c2a6?_0x267a84[_0x9c00('0x13')]:_0x22af3f[_0x9c00('0x11')]+_0x22af3f[_0x9c00('0x14')];var _0x49a4c6;if(_0xcd532f>=_0x578f3f){_0xcd532f=_0x578f3f;_0x49a4c6=0xc8;}else{_0x49a4c6=0xce;}_0x237b1a['status'](_0x49a4c6);return _0x237b1a[_0x9c00('0x15')](_0x9c00('0x16'),_0x1331ab+'-'+_0xcd532f+'/'+_0x578f3f)[_0x9c00('0x10')](_0x267a84);}return null;};}function removeEntity(_0x321863){return function(_0x2e6ec2){if(_0x2e6ec2){return _0x2e6ec2[_0x9c00('0x17')]()[_0x9c00('0x18')](function(){var _0x56edb1=_0x2e6ec2[_0x9c00('0x19')]({'plain':!![]});var _0x881d4b=[{'name':_0x9c00('0x1a'),'value':_0x9c00('0x1b'),'ignore':![]},{'name':'OutboundRoutes','value':_0x9c00('0x1c'),'ignore':![]},{'name':'InternalRoutes','value':_0x9c00('0x1d'),'ignore':![]}];var _0x43f265=_(_0x881d4b)['filter'](_0x9c00('0x1e'))[_0x9c00('0x1f')]('value')[_0x9c00('0x20')]();if(_['includes'](_0x43f265,_0x56edb1[_0x9c00('0x21')])){return;}var _0xfbd3b3=_['find'](_0x881d4b,[_0x9c00('0x20'),_0x56edb1['type']])[_0x9c00('0x22')];return db[_0x9c00('0x23')][_0x9c00('0x17')]({'where':{'type':_0xfbd3b3,'resourceId':_0x56edb1['id']}})['then'](function(){return _0x2e6ec2;});})['then'](function(){_0x321863[_0x9c00('0xf')](0xcc)[_0x9c00('0xe')]();});}};}function handleEntityNotFound(_0x2e4c39){return function(_0x3fb73c){if(!_0x3fb73c){_0x2e4c39[_0x9c00('0xd')](0x194);}return _0x3fb73c;};}function handleError(_0x3c423a,_0x43843e){_0x43843e=_0x43843e||0x1f4;return function(_0x4bd820){logger[_0x9c00('0x24')](_0x4bd820[_0x9c00('0x25')]);if(_0x4bd820[_0x9c00('0x22')]){delete _0x4bd820[_0x9c00('0x22')];}_0x3c423a['status'](_0x43843e)[_0x9c00('0x26')](_0x4bd820);};}exports[_0x9c00('0x27')]=function(_0x15e4fe,_0x5af95c){var _0x5a05e5={},_0x3fc4bb={},_0x5b89c2={'count':0x0,'rows':[]};var _0x68325=_[_0x9c00('0x1f')](db['VoiceExtension']['rawAttributes'],function(_0x29ad30){return{'name':_0x29ad30[_0x9c00('0x28')],'type':_0x29ad30[_0x9c00('0x21')][_0x9c00('0x29')]};});_0x3fc4bb[_0x9c00('0x2a')]=_[_0x9c00('0x1f')](_0x68325,_0x9c00('0x22'));_0x3fc4bb[_0x9c00('0x2b')]=_[_0x9c00('0x2c')](_0x15e4fe[_0x9c00('0x2b')]);_0x3fc4bb[_0x9c00('0x2d')]=_['intersection'](_0x3fc4bb[_0x9c00('0x2a')],_0x3fc4bb['query']);_0x5a05e5['attributes']=_[_0x9c00('0x2e')](_0x3fc4bb[_0x9c00('0x2a')],qs[_0x9c00('0x2f')](_0x15e4fe[_0x9c00('0x2b')][_0x9c00('0x2f')]));_0x5a05e5[_0x9c00('0x30')]=_0x5a05e5[_0x9c00('0x30')]['length']?_0x5a05e5['attributes']:_0x3fc4bb[_0x9c00('0x2a')];if(!_0x15e4fe[_0x9c00('0x2b')][_0x9c00('0x31')](_0x9c00('0x32'))){_0x5a05e5['limit']=qs['limit'](_0x15e4fe[_0x9c00('0x2b')][_0x9c00('0x14')]);_0x5a05e5[_0x9c00('0x11')]=qs[_0x9c00('0x11')](_0x15e4fe[_0x9c00('0x2b')][_0x9c00('0x11')]);}_0x5a05e5[_0x9c00('0x33')]=qs[_0x9c00('0x34')](_0x15e4fe[_0x9c00('0x2b')][_0x9c00('0x34')]);_0x5a05e5[_0x9c00('0x35')]=qs[_0x9c00('0x2d')](_['pick'](_0x15e4fe['query'],_0x3fc4bb[_0x9c00('0x2d')]),_0x68325);if(_0x15e4fe[_0x9c00('0x2b')][_0x9c00('0x36')]){_0x5a05e5[_0x9c00('0x35')]=_[_0x9c00('0x37')](_0x5a05e5[_0x9c00('0x35')],{'$or':_[_0x9c00('0x1f')](_0x68325,function(_0x4f3ae1){if(_0x4f3ae1['type']!==_0x9c00('0x38')){var _0x4718be={};_0x4718be[_0x4f3ae1[_0x9c00('0x22')]]={'$like':'%'+_0x15e4fe['query'][_0x9c00('0x36')]+'%'};return _0x4718be;}})});}_0x5a05e5=_[_0x9c00('0x37')]({},_0x5a05e5,_0x15e4fe[_0x9c00('0x39')]);var _0x9487c={'where':_0x5a05e5[_0x9c00('0x35')]};return db[_0x9c00('0x3a')][_0x9c00('0x13')](_0x9487c)['then'](function(_0x21b9eb){_0x5b89c2['count']=_0x21b9eb;if(_0x15e4fe[_0x9c00('0x2b')][_0x9c00('0x3b')]){_0x5a05e5[_0x9c00('0x3c')]=[{'all':!![]}];}return db[_0x9c00('0x3a')][_0x9c00('0x3d')](_0x5a05e5);})['then'](function(_0x24239e){_0x5b89c2[_0x9c00('0x3e')]=_0x24239e;return _0x5b89c2;})[_0x9c00('0x18')](respondWithFilteredResult(_0x5af95c,_0x5a05e5))[_0x9c00('0x3f')](handleError(_0x5af95c,null));};exports[_0x9c00('0x40')]=function(_0x4b8871,_0x46ab5d){var _0x14eb74={'raw':![],'where':{'id':_0x4b8871[_0x9c00('0x41')]['id']}},_0x4e37fd={};_0x4e37fd[_0x9c00('0x2a')]=_[_0x9c00('0x2c')](db[_0x9c00('0x3a')][_0x9c00('0x42')]);_0x4e37fd[_0x9c00('0x2b')]=_[_0x9c00('0x2c')](_0x4b8871['query']);_0x4e37fd[_0x9c00('0x2d')]=_[_0x9c00('0x2e')](_0x4e37fd[_0x9c00('0x2a')],_0x4e37fd[_0x9c00('0x2b')]);_0x14eb74[_0x9c00('0x30')]=_[_0x9c00('0x2e')](_0x4e37fd[_0x9c00('0x2a')],qs[_0x9c00('0x2f')](_0x4b8871[_0x9c00('0x2b')]['fields']));_0x14eb74[_0x9c00('0x30')]=_0x14eb74['attributes'][_0x9c00('0x43')]?_0x14eb74[_0x9c00('0x30')]:_0x4e37fd['model'];if(_0x4b8871[_0x9c00('0x2b')][_0x9c00('0x3b')]){_0x14eb74['include']=[{'all':!![]}];}_0x14eb74=_[_0x9c00('0x37')]({},_0x14eb74,_0x4b8871[_0x9c00('0x39')]);return db[_0x9c00('0x3a')][_0x9c00('0x44')](_0x14eb74)[_0x9c00('0x18')](handleEntityNotFound(_0x46ab5d,null))[_0x9c00('0x18')](respondWithResult(_0x46ab5d,null))['catch'](handleError(_0x46ab5d,null));};exports[_0x9c00('0x17')]=function(_0x3010a5,_0x20315b){return db[_0x9c00('0x3a')]['find']({'where':{'id':_0x3010a5[_0x9c00('0x41')]['id']}})['then'](handleEntityNotFound(_0x20315b,null))[_0x9c00('0x18')](removeEntity(_0x20315b,null))[_0x9c00('0x3f')](handleError(_0x20315b,null));};exports[_0x9c00('0x45')]=function(_0x3ac04f,_0x4d0152){if(_0x3ac04f[_0x9c00('0x46')][_0x9c00('0x21')]==='outbound'&&!_[_0x9c00('0x47')](_0x3ac04f[_0x9c00('0x46')][_0x9c00('0x48')],'_')){_0x3ac04f[_0x9c00('0x46')][_0x9c00('0x48')]='_'[_0x9c00('0x49')](_0x3ac04f[_0x9c00('0x46')][_0x9c00('0x48')]);}return db[_0x9c00('0x3a')][_0x9c00('0x45')](_0x3ac04f[_0x9c00('0x46')],{'raw':![]})[_0x9c00('0x18')](function(_0x3e6c25){var _0x152a44=_0x3ac04f['user'][_0x9c00('0x19')]({'plain':!![]});if(!_0x152a44)throw new Error(_0x9c00('0x4a'));if(_0x152a44[_0x9c00('0x4b')]==='user'){var _0x479d52=_0x3e6c25[_0x9c00('0x19')]({'plain':!![]});var _0x1b3d09=[{'name':_0x9c00('0x1a'),'value':_0x9c00('0x1b')},{'name':_0x9c00('0x4c'),'value':_0x9c00('0x1c')},{'name':_0x9c00('0x4d'),'value':'internal'}];var _0x53f1ad=_[_0x9c00('0x44')](_0x1b3d09,['value',_0x479d52[_0x9c00('0x21')]])[_0x9c00('0x22')];return db['UserProfileSection'][_0x9c00('0x44')]({'where':{'name':_0x53f1ad,'userProfileId':_0x152a44[_0x9c00('0x4e')]},'raw':!![]})['then'](function(_0x8b23b3){if(_0x8b23b3&&_0x8b23b3[_0x9c00('0x4f')]===0x0){return db[_0x9c00('0x23')][_0x9c00('0x45')]({'name':_0x479d52[_0x9c00('0x22')],'resourceId':_0x479d52['id'],'type':_0x8b23b3['name'],'sectionId':_0x8b23b3['id']},{})[_0x9c00('0x18')](function(){return _0x3e6c25;});}else{return _0x3e6c25;}})[_0x9c00('0x3f')](function(_0x1acfaa){logger[_0x9c00('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1acfaa);throw _0x1acfaa;});}return _0x3e6c25;})[_0x9c00('0x18')](respondWithResult(_0x4d0152,0xc9))[_0x9c00('0x3f')](handleError(_0x4d0152,null));};exports[_0x9c00('0x50')]=function(_0x26bdfc,_0x1ba897){if(_0x26bdfc[_0x9c00('0x46')]['id']){delete _0x26bdfc['body']['id'];}return db['VoiceExtension'][_0x9c00('0x44')]({'where':{'id':_0x26bdfc[_0x9c00('0x41')]['id']}})[_0x9c00('0x18')](handleEntityNotFound(_0x1ba897,null))[_0x9c00('0x18')](function(_0x37750f){if(_0x37750f){return db[_0x9c00('0x3a')]['update'](_['pick'](_0x26bdfc[_0x9c00('0x46')],['exten',_0x9c00('0x51'),_0x9c00('0x52'),'recordingFormat',_0x9c00('0x53'),_0x9c00('0x54'),_0x9c00('0x55')]),{'where':{'context':_0x37750f['context'],'exten':_0x37750f[_0x9c00('0x48')]},'individualHooks':!![]})[_0x9c00('0x18')](function(_0x1c3d16){return _0x1c3d16;});}return null;})[_0x9c00('0x18')](respondWithStatusCode(_0x1ba897,null))[_0x9c00('0x3f')](handleError(_0x1ba897,null));};exports[_0x9c00('0x56')]=function(_0x49aa05,_0x3e4440){var _0x42e272=_0x49aa05[_0x9c00('0x41')]['id'];var _0x35b820=_0x49aa05[_0x9c00('0x46')];var _0x4db881=0xc8;var _0x5ee9fe=null;return db[_0x9c00('0x57')][_0x9c00('0x58')]({'isolationLevel':db[_0x9c00('0x57')][_0x9c00('0x59')][_0x9c00('0x5a')][_0x9c00('0x5b')]},function(_0x2e9a9e){return db[_0x9c00('0x3a')][_0x9c00('0x5c')]({'where':{'id':_0x42e272},'transaction':_0x2e9a9e})[_0x9c00('0x18')](function(_0x235c2d){if(_0x235c2d){return db[_0x9c00('0x3a')][_0x9c00('0x17')]({'where':{'VoiceExtensionId':_0x42e272},'transaction':_0x2e9a9e})[_0x9c00('0x18')](function(){var _0x59c183=_[_0x9c00('0x1f')](_0x35b820,function(_0x4bf56c){_0x4bf56c[_0x9c00('0x5d')]=_0x42e272;_0x4bf56c['isApp']=!![];return _0x4bf56c;});return _0x235c2d['createRouting'](_0x59c183);})[_0x9c00('0x18')](function(_0xf6ed87){return db[_0x9c00('0x3a')]['bulkCreate'](_0xf6ed87,{'transaction':_0x2e9a9e});});}else{_0x4db881=0x194;_0x5ee9fe=[];}});})[_0x9c00('0x18')](function(){if(_0x4db881!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x42e272},'order':_0x9c00('0x5e')})['then'](function(_0x25c6b7){_0x5ee9fe=_0x25c6b7;});}})[_0x9c00('0x3f')](function(_0x1262aa){_0x4db881=0x1f4;logger[_0x9c00('0x24')](_0x1262aa[_0x9c00('0x25')]);if(_0x1262aa[_0x9c00('0x22')]){delete _0x1262aa[_0x9c00('0x22')];}_0x5ee9fe=_0x1262aa;})['finally'](function(){if(_0x5ee9fe===null){_0x3e4440[_0x9c00('0xd')](_0x4db881);}else{if(_0x4db881===0x1f4){_0x3e4440[_0x9c00('0xf')](_0x4db881)[_0x9c00('0x26')](_0x5ee9fe);}else{_0x3e4440['status'](_0x4db881)[_0x9c00('0x10')](_0x5ee9fe);}}});}; \ No newline at end of file +var _0x8401=['findAll','show','params','rawAttributes','include','catch','find','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','UserProfileSection','userProfileId','update','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','get','InboundRoutes','inbound','outbound','internal','filter','ignore','map','value','includes','type','name','UserProfileResource','error','stack','send','VoiceExtension','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll'];(function(_0x29c07d,_0x16dd11){var _0x23a4b8=function(_0x28fa0f){while(--_0x28fa0f){_0x29c07d['push'](_0x29c07d['shift']());}};_0x23a4b8(++_0x16dd11);}(_0x8401,0x1f3));var _0x1840=function(_0x44c145,_0x11abd8){_0x44c145=_0x44c145-0x0;var _0x4b9cb9=_0x8401[_0x44c145];return _0x4b9cb9;};'use strict';var _=require(_0x1840('0x0'));var Redis=require(_0x1840('0x1'));var qs=require(_0x1840('0x2'));var logger=require(_0x1840('0x3'))(_0x1840('0x4'));var config=require(_0x1840('0x5'));var db=require(_0x1840('0x6'))['db'];config[_0x1840('0x7')]=_[_0x1840('0x8')](config['redis'],{'host':_0x1840('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1840('0x7')]));require(_0x1840('0xa'))['register'](socket);function respondWithStatusCode(_0x4e46bc,_0x321e4e){_0x321e4e=_0x321e4e||0xcc;return function(_0x350afc){if(_0x350afc){return _0x4e46bc[_0x1840('0xb')](_0x321e4e);}return _0x4e46bc['status'](_0x321e4e)[_0x1840('0xc')]();};}function respondWithResult(_0x4430b4,_0x3b5700){_0x3b5700=_0x3b5700||0xc8;return function(_0x4db665){if(_0x4db665){return _0x4430b4[_0x1840('0xd')](_0x3b5700)[_0x1840('0xe')](_0x4db665);}};}function respondWithFilteredResult(_0x1ef55e,_0x3cdbd6){return function(_0x4dc80d){if(_0x4dc80d){var _0x8be416=typeof _0x3cdbd6[_0x1840('0xf')]===_0x1840('0x10')&&typeof _0x3cdbd6['limit']==='undefined';var _0xbad3c1=_0x4dc80d[_0x1840('0x11')];var _0x4cc266=_0x8be416?0x0:_0x3cdbd6[_0x1840('0xf')];var _0x515749=_0x8be416?_0x4dc80d[_0x1840('0x11')]:_0x3cdbd6['offset']+_0x3cdbd6[_0x1840('0x12')];var _0x3a4121;if(_0x515749>=_0xbad3c1){_0x515749=_0xbad3c1;_0x3a4121=0xc8;}else{_0x3a4121=0xce;}_0x1ef55e[_0x1840('0xd')](_0x3a4121);return _0x1ef55e[_0x1840('0x13')](_0x1840('0x14'),_0x4cc266+'-'+_0x515749+'/'+_0xbad3c1)[_0x1840('0xe')](_0x4dc80d);}return null;};}function removeEntity(_0x1d6b49){return function(_0x8b8694){if(_0x8b8694){return _0x8b8694[_0x1840('0x15')]()[_0x1840('0x16')](function(){var _0x534680=_0x8b8694[_0x1840('0x17')]({'plain':!![]});var _0x40b9d1=[{'name':_0x1840('0x18'),'value':_0x1840('0x19'),'ignore':![]},{'name':'OutboundRoutes','value':_0x1840('0x1a'),'ignore':![]},{'name':'InternalRoutes','value':_0x1840('0x1b'),'ignore':![]}];var _0x8ad518=_(_0x40b9d1)[_0x1840('0x1c')](_0x1840('0x1d'))[_0x1840('0x1e')](_0x1840('0x1f'))[_0x1840('0x1f')]();if(_[_0x1840('0x20')](_0x8ad518,_0x534680['type'])){return;}var _0x5d486c=_['find'](_0x40b9d1,['value',_0x534680[_0x1840('0x21')]])[_0x1840('0x22')];return db[_0x1840('0x23')][_0x1840('0x15')]({'where':{'type':_0x5d486c,'resourceId':_0x534680['id']}})['then'](function(){return _0x8b8694;});})[_0x1840('0x16')](function(){_0x1d6b49[_0x1840('0xd')](0xcc)[_0x1840('0xc')]();});}};}function handleEntityNotFound(_0x5c53ee){return function(_0x1d2bb5){if(!_0x1d2bb5){_0x5c53ee[_0x1840('0xb')](0x194);}return _0x1d2bb5;};}function handleError(_0xe4b7ea,_0x5bf003){_0x5bf003=_0x5bf003||0x1f4;return function(_0xa4d0c4){logger[_0x1840('0x24')](_0xa4d0c4[_0x1840('0x25')]);if(_0xa4d0c4[_0x1840('0x22')]){delete _0xa4d0c4[_0x1840('0x22')];}_0xe4b7ea[_0x1840('0xd')](_0x5bf003)[_0x1840('0x26')](_0xa4d0c4);};}exports['index']=function(_0x248e38,_0x43b616){var _0x4f35d9={},_0x3c1bff={},_0x3a0874={'count':0x0,'rows':[]};var _0x439e34=_[_0x1840('0x1e')](db[_0x1840('0x27')]['rawAttributes'],function(_0x573971){return{'name':_0x573971['fieldName'],'type':_0x573971['type'][_0x1840('0x28')]};});_0x3c1bff[_0x1840('0x29')]=_[_0x1840('0x1e')](_0x439e34,'name');_0x3c1bff[_0x1840('0x2a')]=_[_0x1840('0x2b')](_0x248e38['query']);_0x3c1bff[_0x1840('0x2c')]=_[_0x1840('0x2d')](_0x3c1bff[_0x1840('0x29')],_0x3c1bff[_0x1840('0x2a')]);_0x4f35d9[_0x1840('0x2e')]=_[_0x1840('0x2d')](_0x3c1bff[_0x1840('0x29')],qs['fields'](_0x248e38['query'][_0x1840('0x2f')]));_0x4f35d9[_0x1840('0x2e')]=_0x4f35d9[_0x1840('0x2e')][_0x1840('0x30')]?_0x4f35d9[_0x1840('0x2e')]:_0x3c1bff[_0x1840('0x29')];if(!_0x248e38[_0x1840('0x2a')][_0x1840('0x31')](_0x1840('0x32'))){_0x4f35d9[_0x1840('0x12')]=qs[_0x1840('0x12')](_0x248e38[_0x1840('0x2a')][_0x1840('0x12')]);_0x4f35d9[_0x1840('0xf')]=qs[_0x1840('0xf')](_0x248e38[_0x1840('0x2a')][_0x1840('0xf')]);}_0x4f35d9[_0x1840('0x33')]=qs[_0x1840('0x34')](_0x248e38[_0x1840('0x2a')][_0x1840('0x34')]);_0x4f35d9[_0x1840('0x35')]=qs[_0x1840('0x2c')](_[_0x1840('0x36')](_0x248e38[_0x1840('0x2a')],_0x3c1bff[_0x1840('0x2c')]),_0x439e34);if(_0x248e38[_0x1840('0x2a')][_0x1840('0x1c')]){_0x4f35d9[_0x1840('0x35')]=_[_0x1840('0x37')](_0x4f35d9[_0x1840('0x35')],{'$or':_['map'](_0x439e34,function(_0x2c81fb){if(_0x2c81fb['type']!==_0x1840('0x38')){var _0x422c3d={};_0x422c3d[_0x2c81fb[_0x1840('0x22')]]={'$like':'%'+_0x248e38['query'][_0x1840('0x1c')]+'%'};return _0x422c3d;}})});}_0x4f35d9=_[_0x1840('0x37')]({},_0x4f35d9,_0x248e38[_0x1840('0x39')]);var _0x4e9318={'where':_0x4f35d9[_0x1840('0x35')]};return db['VoiceExtension'][_0x1840('0x11')](_0x4e9318)[_0x1840('0x16')](function(_0x39adce){_0x3a0874['count']=_0x39adce;if(_0x248e38['query'][_0x1840('0x3a')]){_0x4f35d9['include']=[{'all':!![]}];}return db[_0x1840('0x27')][_0x1840('0x3b')](_0x4f35d9);})[_0x1840('0x16')](function(_0x95303a){_0x3a0874['rows']=_0x95303a;return _0x3a0874;})['then'](respondWithFilteredResult(_0x43b616,_0x4f35d9))['catch'](handleError(_0x43b616,null));};exports[_0x1840('0x3c')]=function(_0x279891,_0x161dbe){var _0x6bfe27={'raw':![],'where':{'id':_0x279891[_0x1840('0x3d')]['id']}},_0x5742bc={};_0x5742bc[_0x1840('0x29')]=_[_0x1840('0x2b')](db[_0x1840('0x27')][_0x1840('0x3e')]);_0x5742bc['query']=_['keys'](_0x279891[_0x1840('0x2a')]);_0x5742bc[_0x1840('0x2c')]=_['intersection'](_0x5742bc[_0x1840('0x29')],_0x5742bc[_0x1840('0x2a')]);_0x6bfe27[_0x1840('0x2e')]=_['intersection'](_0x5742bc[_0x1840('0x29')],qs['fields'](_0x279891[_0x1840('0x2a')][_0x1840('0x2f')]));_0x6bfe27[_0x1840('0x2e')]=_0x6bfe27[_0x1840('0x2e')][_0x1840('0x30')]?_0x6bfe27[_0x1840('0x2e')]:_0x5742bc[_0x1840('0x29')];if(_0x279891['query'][_0x1840('0x3a')]){_0x6bfe27[_0x1840('0x3f')]=[{'all':!![]}];}_0x6bfe27=_['merge']({},_0x6bfe27,_0x279891[_0x1840('0x39')]);return db[_0x1840('0x27')]['find'](_0x6bfe27)['then'](handleEntityNotFound(_0x161dbe,null))[_0x1840('0x16')](respondWithResult(_0x161dbe,null))[_0x1840('0x40')](handleError(_0x161dbe,null));};exports[_0x1840('0x15')]=function(_0xe3e50c,_0x4ba390){return db[_0x1840('0x27')][_0x1840('0x41')]({'where':{'id':_0xe3e50c['params']['id']}})[_0x1840('0x16')](handleEntityNotFound(_0x4ba390,null))[_0x1840('0x16')](removeEntity(_0x4ba390,null))[_0x1840('0x40')](handleError(_0x4ba390,null));};exports[_0x1840('0x42')]=function(_0x1c667d,_0x5aefdb){if(_0x1c667d[_0x1840('0x43')][_0x1840('0x21')]===_0x1840('0x1a')&&!_['startsWith'](_0x1c667d['body'][_0x1840('0x44')],'_')){_0x1c667d[_0x1840('0x43')][_0x1840('0x44')]='_'[_0x1840('0x45')](_0x1c667d[_0x1840('0x43')][_0x1840('0x44')]);}return db['VoiceExtension'][_0x1840('0x42')](_0x1c667d['body'],{'raw':![]})['then'](function(_0x20aac3){var _0x220a3a=_0x1c667d[_0x1840('0x46')][_0x1840('0x17')]({'plain':!![]});if(!_0x220a3a)throw new Error(_0x1840('0x47'));if(_0x220a3a[_0x1840('0x48')]===_0x1840('0x46')){var _0x40d7ae=_0x20aac3['get']({'plain':!![]});var _0x7807a0=[{'name':_0x1840('0x18'),'value':_0x1840('0x19')},{'name':_0x1840('0x49'),'value':_0x1840('0x1a')},{'name':'InternalRoutes','value':'internal'}];var _0x226c06=_[_0x1840('0x41')](_0x7807a0,['value',_0x40d7ae[_0x1840('0x21')]])[_0x1840('0x22')];return db[_0x1840('0x4a')][_0x1840('0x41')]({'where':{'name':_0x226c06,'userProfileId':_0x220a3a[_0x1840('0x4b')]},'raw':!![]})[_0x1840('0x16')](function(_0x1ca180){if(_0x1ca180&&_0x1ca180['autoAssociation']===0x0){return db['UserProfileResource'][_0x1840('0x42')]({'name':_0x40d7ae[_0x1840('0x22')],'resourceId':_0x40d7ae['id'],'type':_0x1ca180[_0x1840('0x22')],'sectionId':_0x1ca180['id']},{})[_0x1840('0x16')](function(){return _0x20aac3;});}else{return _0x20aac3;}})[_0x1840('0x40')](function(_0x22b020){logger[_0x1840('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22b020);throw _0x22b020;});}return _0x20aac3;})[_0x1840('0x16')](respondWithResult(_0x5aefdb,0xc9))[_0x1840('0x40')](handleError(_0x5aefdb,null));};exports['update']=function(_0x5ca605,_0x101533){if(_0x5ca605[_0x1840('0x43')]['id']){delete _0x5ca605[_0x1840('0x43')]['id'];}return db['VoiceExtension'][_0x1840('0x41')]({'where':{'id':_0x5ca605[_0x1840('0x3d')]['id']}})[_0x1840('0x16')](handleEntityNotFound(_0x101533,null))['then'](function(_0x29ae65){if(_0x29ae65){return db[_0x1840('0x27')][_0x1840('0x4c')](_[_0x1840('0x36')](_0x5ca605['body'],['exten',_0x1840('0x4d'),_0x1840('0x4e'),'recordingFormat',_0x1840('0x4f'),_0x1840('0x50'),_0x1840('0x51')]),{'where':{'context':_0x29ae65[_0x1840('0x4d')],'exten':_0x29ae65[_0x1840('0x44')]},'individualHooks':!![]})['then'](function(_0x384146){return _0x384146;});}return null;})[_0x1840('0x16')](respondWithStatusCode(_0x101533,null))[_0x1840('0x40')](handleError(_0x101533,null));};exports[_0x1840('0x52')]=function(_0x2fce0c,_0x1e1313){var _0x361b3f=_0x2fce0c['params']['id'];var _0x4b91e4=_0x2fce0c[_0x1840('0x43')];var _0x4553e8=0xc8;var _0x4a5a99=null;return db[_0x1840('0x53')][_0x1840('0x54')]({'isolationLevel':db[_0x1840('0x53')][_0x1840('0x55')][_0x1840('0x56')][_0x1840('0x57')]},function(_0x4682fa){return db[_0x1840('0x27')][_0x1840('0x58')]({'where':{'id':_0x361b3f},'transaction':_0x4682fa})[_0x1840('0x16')](function(_0x3f2251){if(_0x3f2251){return db[_0x1840('0x27')][_0x1840('0x15')]({'where':{'VoiceExtensionId':_0x361b3f},'transaction':_0x4682fa})['then'](function(){var _0x4292ec=_['map'](_0x4b91e4,function(_0x413514){_0x413514[_0x1840('0x59')]=_0x361b3f;_0x413514[_0x1840('0x5a')]=!![];return _0x413514;});return _0x3f2251[_0x1840('0x5b')](_0x4292ec);})[_0x1840('0x16')](function(_0x3e068f){return db['VoiceExtension']['bulkCreate'](_0x3e068f,{'transaction':_0x4682fa});});}else{_0x4553e8=0x194;_0x4a5a99=[];}});})[_0x1840('0x16')](function(){if(_0x4553e8!==0x194){return db[_0x1840('0x27')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x361b3f},'order':'cast(priority\x20as\x20unsigned)'})[_0x1840('0x16')](function(_0x4c8d28){_0x4a5a99=_0x4c8d28;});}})[_0x1840('0x40')](function(_0x52b8dc){_0x4553e8=0x1f4;logger['error'](_0x52b8dc['stack']);if(_0x52b8dc[_0x1840('0x22')]){delete _0x52b8dc['name'];}_0x4a5a99=_0x52b8dc;})[_0x1840('0x5c')](function(){if(_0x4a5a99===null){_0x1e1313[_0x1840('0xb')](_0x4553e8);}else{if(_0x4553e8===0x1f4){_0x1e1313['status'](_0x4553e8)[_0x1840('0x26')](_0x4a5a99);}else{_0x1e1313['status'](_0x4553e8)[_0x1840('0xe')](_0x4a5a99);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a8e539f..95c1897 100644 --- a/server/api/voiceExtension/voiceExtension.events.js +++ b/server/api/voiceExtension/voiceExtension.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa465=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','update','remove'];(function(_0x4c390b,_0x528e79){var _0x848f50=function(_0x244bd4){while(--_0x244bd4){_0x4c390b['push'](_0x4c390b['shift']());}};_0x848f50(++_0x528e79);}(_0xa465,0xd4));var _0x5a46=function(_0x14ec9d,_0x45d283){_0x14ec9d=_0x14ec9d-0x0;var _0x3636df=_0xa465[_0x14ec9d];return _0x3636df;};'use strict';var EventEmitter=require(_0x5a46('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5a46('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5a46('0x2'),'afterDestroy':_0x5a46('0x3')};function emitEvent(_0x530b59){return function(_0x58df03,_0x39ce2e,_0x38a70a){VoiceExtensionEvents[_0x5a46('0x4')](_0x530b59+':'+_0x58df03['id'],_0x58df03);VoiceExtensionEvents['emit'](_0x530b59,_0x58df03);_0x38a70a(null);};}for(var e in events){if(events[_0x5a46('0x5')](e)){var event=events[e];VoiceExtension[_0x5a46('0x6')](e,emitEvent(event));}}module[_0x5a46('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x94d5=['save','remove','emit','hasOwnProperty','hook','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x94d5,0xcd));var _0x594d=function(_0x58ef97,_0x10b810){_0x58ef97=_0x58ef97-0x0;var _0x2ed8df=_0x94d5[_0x58ef97];return _0x2ed8df;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x594d('0x0'))['db'][_0x594d('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x594d('0x2')](0x0);var events={'afterCreate':_0x594d('0x3'),'afterUpdate':'update','afterDestroy':_0x594d('0x4')};function emitEvent(_0x460223){return function(_0x5ca69c,_0x25ef46,_0x3d3931){VoiceExtensionEvents[_0x594d('0x5')](_0x460223+':'+_0x5ca69c['id'],_0x5ca69c);VoiceExtensionEvents[_0x594d('0x5')](_0x460223,_0x5ca69c);_0x3d3931(null);};}for(var e in events){if(events[_0x594d('0x6')](e)){var event=events[e];VoiceExtension[_0x594d('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 49e4af3..273c3cb 100644 --- a/server/api/voiceExtension/voiceExtension.model.js +++ b/server/api/voiceExtension/voiceExtension.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e92=['exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','wav','options','url','split','length','name','trunk','param','prefix','phone','${EXTEN}','join','none','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','exports','models','type','Set','CDR(type)=','context'];(function(_0x1ca0d5,_0x533a21){var _0x22ef3d=function(_0xd6e418){while(--_0xd6e418){_0x1ca0d5['push'](_0x1ca0d5['shift']());}};_0x22ef3d(++_0x533a21);}(_0x1e92,0x1df));var _0x21e9=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x1e92[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x21e9('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x21e9('0x1')]=function(_0x5c2056){var _0x5a922f=_0x5c2056[_0x21e9('0x2')];function _0x42fd50(_0x3ec18a){var _0x2c75f5=0x2;var _0x44d894=[{'type':_0x3ec18a[_0x21e9('0x3')],'app':_0x21e9('0x4'),'appdata':_0x21e9('0x5')+_0x3ec18a[_0x21e9('0x3')],'context':_0x3ec18a[_0x21e9('0x6')],'exten':_0x3ec18a[_0x21e9('0x7')],'priority':_0x2c75f5++,'VoiceExtensionId':_0x3ec18a['id']},{'type':_0x3ec18a[_0x21e9('0x3')],'app':_0x3ec18a['alias']?_0x21e9('0x4'):_0x21e9('0x8'),'appdata':_0x3ec18a[_0x21e9('0x9')]?_0x21e9('0xa')+_0x3ec18a['alias']:_0x21e9('0xb'),'context':_0x3ec18a['context'],'exten':_0x3ec18a[_0x21e9('0x7')],'priority':_0x2c75f5++,'VoiceExtensionId':_0x3ec18a['id']}];if(_0x3ec18a[_0x21e9('0x3')]===_0x21e9('0xc')){_0x44d894[_0x21e9('0xd')]({'type':_0x21e9('0xc'),'app':_0x21e9('0x4'),'appdata':'CDR(routeid)='+_0x3ec18a['id'],'context':_0x3ec18a[_0x21e9('0x6')],'exten':_0x3ec18a['exten'],'priority':_0x2c75f5++,'VoiceExtensionId':_0x3ec18a['id']});}_0x44d894[_0x21e9('0xd')]({'type':_0x3ec18a[_0x21e9('0x3')],'app':_0x21e9('0x4'),'appdata':_0x21e9('0xe'),'context':_0x3ec18a[_0x21e9('0x6')],'exten':_0x3ec18a[_0x21e9('0x7')],'priority':_0x2c75f5++,'VoiceExtensionId':_0x3ec18a['id']},{'type':_0x3ec18a[_0x21e9('0x3')],'app':'Set','appdata':_0x21e9('0xf'),'context':_0x3ec18a[_0x21e9('0x6')],'exten':_0x3ec18a[_0x21e9('0x7')],'priority':_0x2c75f5++,'VoiceExtensionId':_0x3ec18a['id']},{'type':_0x3ec18a[_0x21e9('0x3')],'app':_0x21e9('0x4'),'appdata':_0x21e9('0x10'),'context':_0x3ec18a['context'],'exten':_0x3ec18a[_0x21e9('0x7')],'priority':_0x2c75f5++,'VoiceExtensionId':_0x3ec18a['id']});return _0x44d894;}function _0x3f7101(_0x4d87f5){var _0x23ec03=0x2;var _0x5863af=[{'type':_0x21e9('0x11'),'app':_0x21e9('0x4'),'appdata':_0x21e9('0x12'),'context':_0x4d87f5[_0x21e9('0x6')],'exten':_0x4d87f5['exten'],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']},{'type':_0x21e9('0x11'),'app':_0x4d87f5[_0x21e9('0x9')]?_0x21e9('0x4'):_0x21e9('0x8'),'appdata':_0x4d87f5[_0x21e9('0x9')]?_0x21e9('0xa')+_0x4d87f5[_0x21e9('0x9')]:_0x21e9('0xb'),'context':_0x4d87f5[_0x21e9('0x6')],'exten':_0x4d87f5[_0x21e9('0x7')],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']},{'type':_0x21e9('0x11'),'app':_0x21e9('0x4'),'appdata':_0x21e9('0x13')+(_0x4d87f5[_0x21e9('0x14')]?_0x21e9('0x15')+_0x4d87f5[_0x21e9('0x14')]+'}':'${EXTEN}'),'context':_0x4d87f5['context'],'exten':_0x4d87f5['exten'],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']},{'type':'outbound','app':_0x21e9('0x4'),'appdata':'CDR(routeid)='+_0x4d87f5['id'],'context':_0x4d87f5['context'],'exten':_0x4d87f5[_0x21e9('0x7')],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']},{'type':_0x21e9('0x11'),'app':_0x21e9('0x16'),'appdata':_0x21e9('0x17')+(_0x23ec03+0x2)+_0x21e9('0x18')+(_0x23ec03+0x1)+')','context':_0x4d87f5[_0x21e9('0x6')],'exten':_0x4d87f5[_0x21e9('0x7')],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']},{'type':'outbound','app':'Set','appdata':_0x4d87f5['cutdigits']?_0x21e9('0x19')+_0x4d87f5['cutdigits']+'}':_0x21e9('0x1a'),'context':_0x4d87f5['context'],'exten':_0x4d87f5[_0x21e9('0x7')],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']},{'type':_0x21e9('0x11'),'app':_0x21e9('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4d87f5[_0x21e9('0x6')],'exten':_0x4d87f5['exten'],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']},{'type':_0x21e9('0x11'),'app':_0x21e9('0x4'),'appdata':_0x21e9('0xf'),'context':_0x4d87f5['context'],'exten':_0x4d87f5[_0x21e9('0x7')],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']},{'type':_0x21e9('0x11'),'app':_0x21e9('0x4'),'appdata':_0x21e9('0x10'),'context':_0x4d87f5['context'],'exten':_0x4d87f5[_0x21e9('0x7')],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']},{'type':_0x21e9('0x11'),'app':_0x21e9('0x4'),'appdata':'outboundrouteid='+_0x4d87f5['id'],'context':_0x4d87f5[_0x21e9('0x6')],'exten':_0x4d87f5[_0x21e9('0x7')],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']}];if(_0x4d87f5[_0x21e9('0x1b')]('recordingFormat')&&_0x4d87f5[_0x21e9('0x1c')]!=='none'){_0x5863af['push']({'type':_0x21e9('0x11'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4d87f5[_0x21e9('0x6')],'exten':_0x4d87f5[_0x21e9('0x7')],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']},{'type':_0x21e9('0x11'),'app':_0x21e9('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4d87f5[_0x21e9('0x1c')]||_0x21e9('0x1d'),'context':_0x4d87f5[_0x21e9('0x6')],'exten':_0x4d87f5[_0x21e9('0x7')],'priority':_0x23ec03++,'VoiceExtensionId':_0x4d87f5['id']});}return _0x5863af;}function _0x5b060c(_0x2a9aad,_0x4705b6){var _0x154e4c=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0x21e9('0x1e'),'param':0x2},{'name':_0x21e9('0x1f'),'param':0x3}];var _0x5d5fb8={};var _0x5c5658=_0x4705b6[_0x21e9('0x20')](',');var _0x506bb5=[];for(var _0x31edc0=0x0;_0x31edc0<_0x154e4c[_0x21e9('0x21')];_0x31edc0++){switch(_0x154e4c[_0x31edc0][_0x21e9('0x22')]){case _0x21e9('0x23'):_0x5d5fb8[_0x21e9('0x23')]=_0x5c5658[_0x154e4c[_0x31edc0][_0x21e9('0x24')]]['split']('/')[0x1];_0x5d5fb8['phone']=_0x5c5658[_0x154e4c[_0x31edc0]['param']][_0x21e9('0x20')]('/')[0x2];_0x5d5fb8[_0x21e9('0x25')]=_0x5d5fb8['phone']?_0x5d5fb8['phone'][_0x21e9('0x20')]('$')[0x0]:undefined;_0x5d5fb8[_0x21e9('0x26')]=_0x2a9aad[_0x21e9('0x14')]?(_0x5d5fb8['prefix']||'')+_0x21e9('0x15')+_0x2a9aad[_0x21e9('0x14')]+'}':(_0x5d5fb8[_0x21e9('0x25')]||'')+_0x21e9('0x27');_0x506bb5[_0x154e4c[_0x31edc0][_0x21e9('0x24')]]=['SIP',_0x5d5fb8['trunk'],_0x5d5fb8[_0x21e9('0x26')]][_0x21e9('0x28')]('/');break;case _0x21e9('0x1e'):_0x5d5fb8['options']=_0x5c5658[_0x154e4c[_0x31edc0][_0x21e9('0x24')]];if(_0x2a9aad['recordingFormat']!==_0x21e9('0x29')){if(_0x5d5fb8[_0x21e9('0x1e')]['indexOf'](_0x21e9('0x2a'))<0x0){_0x5d5fb8[_0x21e9('0x1e')]+=_0x21e9('0x2a');}}else{_0x5d5fb8[_0x21e9('0x1e')]=_0x5d5fb8[_0x21e9('0x1e')][_0x21e9('0x2b')](_0x21e9('0x2a'),'');}_0x506bb5[_0x154e4c[_0x31edc0][_0x21e9('0x24')]]=_0x5d5fb8['options'];break;default:_0x506bb5[_0x154e4c[_0x31edc0][_0x21e9('0x24')]]=_0x5c5658[_0x154e4c[_0x31edc0]['param']];}}return _0x506bb5['join'](',');}function _0x50871f(_0x3a1876,_0x3a379f,_0x168926){return new Promise(function(_0x401e39,_0x14cfa7){var _0x1c36eb=[];if(_[_0x21e9('0x2c')](_0x3a379f))return _0x401e39(_0x1c36eb);_0x5a922f['Interval'][_0x21e9('0x2d')]({'attributes':['id',_0x21e9('0x2e'),_0x21e9('0x2f')],'raw':!![]})[_0x21e9('0x30')](function(_0x373836){for(var _0x55140d=0x0,_0x44b239=0x0;_0x55140d<_0x3a379f[_0x21e9('0x21')];_0x55140d++,_0x44b239=0x0){var _0x14f2c3=_0x3a379f[_0x55140d];var _0x5aa467=[];var _0x3b55d4=[];delete _0x14f2c3['id'];if(_0x14f2c3[_0x21e9('0x2e')]!==_0x21e9('0x31')){_0x14f2c3['intervals']=[_0x14f2c3['interval']];}else{_0x14f2c3[_0x21e9('0x32')]=_0x14f2c3['IntervalId']?_[_0x21e9('0x33')](_['filter'](_0x373836,{'IntervalId':_0x14f2c3[_0x21e9('0x2f')]}),_0x21e9('0x2e')):[];}_0x14f2c3[_0x21e9('0x6')]=_0x3a1876[_0x21e9('0x6')];_0x14f2c3[_0x21e9('0x7')]=_0x3a1876[_0x21e9('0x7')];if(_0x14f2c3[_0x21e9('0x3')])_0x14f2c3[_0x21e9('0x3')]=_0x14f2c3['type'][_0x21e9('0x34')]();if(_0x3a1876[_0x21e9('0x3')]===_0x21e9('0x11')){if(_0x14f2c3[_0x21e9('0x1b')](_0x21e9('0x35'))&&_0x14f2c3['tag']&&_0x14f2c3['tag']!=='--'){_0x5aa467[_0x21e9('0xd')]({'type':_0x14f2c3[_0x21e9('0x3')][_0x21e9('0x34')](),'app':'Set','appdata':'CDR(tag)='+_0x14f2c3[_0x21e9('0x35')],'context':_0x3a1876['context'],'exten':_0x3a1876[_0x21e9('0x7')],'priority':_0x14f2c3['intervals'][_0x21e9('0x21')]+_0x168926+_0x44b239++,'VoiceExtensionId':_0x3a1876['id']});}_0x5aa467[_0x21e9('0xd')]({'type':_0x14f2c3[_0x21e9('0x3')][_0x21e9('0x34')](),'app':'ExecIf','appdata':_0x21e9('0x36')+(_0x14f2c3['callerID']?_0x21e9('0x37')+_0x14f2c3[_0x21e9('0x38')]+')':_0x21e9('0x39')),'context':_0x3a1876['context'],'exten':_0x3a1876[_0x21e9('0x7')],'priority':_0x14f2c3[_0x21e9('0x32')][_0x21e9('0x21')]+_0x168926+_0x44b239++,'VoiceExtensionId':_0x3a1876['id']});}else{if(_0x14f2c3[_0x21e9('0x1b')](_0x21e9('0x3a'))){if([_0x21e9('0x3b'),'playback'][_0x21e9('0x3c')](_0x14f2c3[_0x21e9('0x3d')]['toLowerCase']())&&_0x14f2c3[_0x21e9('0x3e')]!==_0x21e9('0x3f')){if(_0x14f2c3['answer']){_0x5aa467[_0x21e9('0xd')]({'type':_0x14f2c3[_0x21e9('0x3')][_0x21e9('0x34')](),'app':_0x21e9('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3a1876[_0x21e9('0x6')],'exten':_0x3a1876[_0x21e9('0x7')],'priority':_0x14f2c3[_0x21e9('0x32')][_0x21e9('0x21')]+_0x168926+_0x44b239++,'VoiceExtensionId':_0x3a1876['id']});_0x5aa467['push']({'type':_0x14f2c3['type'][_0x21e9('0x34')](),'app':'Set','appdata':_0x21e9('0x40'),'context':_0x3a1876['context'],'exten':_0x3a1876[_0x21e9('0x7')],'priority':_0x14f2c3['intervals'][_0x21e9('0x21')]+_0x168926+_0x44b239++,'VoiceExtensionId':_0x3a1876['id']});}else{_0x5aa467['push']({'type':_0x14f2c3['type'][_0x21e9('0x34')](),'app':_0x21e9('0x16'),'appdata':_0x21e9('0x41'),'context':_0x3a1876[_0x21e9('0x6')],'exten':_0x3a1876['exten'],'priority':_0x14f2c3[_0x21e9('0x32')][_0x21e9('0x21')]+_0x168926+_0x44b239++,'VoiceExtensionId':_0x3a1876['id']});_0x5aa467[_0x21e9('0xd')]({'type':_0x14f2c3['type'][_0x21e9('0x34')](),'app':'Set','appdata':_0x21e9('0x42'),'context':_0x3a1876[_0x21e9('0x6')],'exten':_0x3a1876['exten'],'priority':_0x14f2c3['intervals'][_0x21e9('0x21')]+_0x168926+_0x44b239++,'VoiceExtensionId':_0x3a1876['id']});}}}}for(var _0xb702cd=0x0;_0xb702cd<_0x14f2c3[_0x21e9('0x32')][_0x21e9('0x21')];_0xb702cd++){var _0x3a6dbc=_0x168926+_0x14f2c3[_0x21e9('0x32')][_0x21e9('0x21')];var _0x286e9e=_0xb702cd===_0x14f2c3[_0x21e9('0x32')][_0x21e9('0x21')]-0x1?_0x168926+_0x5aa467['length']+_0x3b55d4[_0x21e9('0x21')]+0x2:_0x168926+_0xb702cd+0x1;_0x5aa467[_0x21e9('0x43')](_0xb702cd,0x0,{'type':_0x3a1876[_0x21e9('0x3')],'app':_0x21e9('0x44'),'appdata':_0x14f2c3[_0x21e9('0x32')][_0xb702cd]+'?'+_0x3a1876[_0x21e9('0x6')]+_0x21e9('0x45')+_0x3a6dbc+':'+_0x3a1876[_0x21e9('0x6')]+',${EXTEN},'+_0x286e9e,'exten':_0x3a1876[_0x21e9('0x7')],'context':_0x3a1876['context'],'priority':_0x168926+_0xb702cd,'VoiceExtensionId':_0x3a1876['id']});}if(_0x14f2c3['appType']===_0x21e9('0x46'))_0x14f2c3['appdata']=_0x5b060c(_0x3a1876,_0x14f2c3[_0x21e9('0x47')]);_0x14f2c3[_0x21e9('0x48')]=_0x5aa467[_0x21e9('0x21')]?_[_0x21e9('0x49')](_0x5aa467)[_0x21e9('0x48')]+0x1:_0x168926;_0x1c36eb=_[_0x21e9('0x4a')](_0x1c36eb,_0x5aa467,[_0x14f2c3],_0x3b55d4);_0x168926=_['last'](_0x1c36eb)[_0x21e9('0x48')]+0x1;}return _0x401e39(_0x1c36eb);})[_0x21e9('0x4b')](function(_0x214111){_0x14cfa7(_0x214111);});});}return _0x5c2056[_0x21e9('0x4c')](_0x21e9('0x4d'),attributes,{'tableName':_0x21e9('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xc0d8cb){var _0x30d0f3=this[_0x21e9('0x4f')]({'plain':!![]});var _0xb4acfc=_0x30d0f3['type']===_0x21e9('0x11')?_0x3f7101(_0x30d0f3):_0x42fd50(_0x30d0f3);return _0x50871f(_0x30d0f3,_0xc0d8cb,_['last'](_0xb4acfc)[_0x21e9('0x48')]+0x1)['then'](function(_0x4ee071){var _0x565a8b=_[_0x21e9('0x4a')](_0xb4acfc,_0x4ee071);_0x565a8b[_0x21e9('0xd')]({'type':_0x30d0f3[_0x21e9('0x3')],'app':_0x21e9('0x50'),'exten':_0x30d0f3['exten'],'context':_0x30d0f3['context'],'priority':_[_0x21e9('0x49')](_0x565a8b)[_0x21e9('0x48')]+0x1,'VoiceExtensionId':_0x30d0f3['id']});return _0x565a8b;});}}});}; \ No newline at end of file +var _0xacd0=['Interval','interval','IntervalId','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','appdata','last','priority','VoiceExtension','voice_extensions','get','then','concat','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','MONITOR_OPTIONS=ab','outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xacd0,0xc9));var _0x0acd=function(_0x18efb0,_0x402155){_0x18efb0=_0x18efb0-0x0;var _0x463641=_0xacd0[_0x18efb0];return _0x463641;};'use strict';var _=require(_0x0acd('0x0'));var attributes=require(_0x0acd('0x1'));module[_0x0acd('0x2')]=function(_0x4bd438){var _0x42fa2d=_0x4bd438['models'];function _0x1e95fd(_0x569f93){var _0x147d6d=0x2;var _0x586d60=[{'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':_0x0acd('0x5')+_0x569f93[_0x0acd('0x3')],'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']},{'type':_0x569f93['type'],'app':_0x569f93['alias']?_0x0acd('0x4'):'NoOp','appdata':_0x569f93[_0x0acd('0x8')]?_0x0acd('0x9')+_0x569f93['alias']:_0x0acd('0xa'),'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']}];if(_0x569f93[_0x0acd('0x3')]===_0x0acd('0xb')){_0x586d60[_0x0acd('0xc')]({'type':'inbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0xd')+_0x569f93['id'],'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']});}_0x586d60['push']({'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']},{'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x569f93['context'],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']},{'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':_0x0acd('0xe'),'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']});return _0x586d60;}function _0x9ae857(_0x419059){var _0x48329a=0x2;var _0x4b137a=[{'type':_0x0acd('0xf'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x419059[_0x0acd('0x8')]?'Set':_0x0acd('0x10'),'appdata':_0x419059[_0x0acd('0x8')]?'CDR(routeAlias)='+_0x419059['alias']:_0x0acd('0xa'),'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x11')+(_0x419059[_0x0acd('0x12')]?_0x0acd('0x13')+_0x419059[_0x0acd('0x12')]+'}':'${EXTEN}'),'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0xd')+_0x419059['id'],'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x14'),'appdata':_0x0acd('0x15')+(_0x48329a+0x2)+_0x0acd('0x16')+(_0x48329a+0x1)+')','context':_0x419059[_0x0acd('0x6')],'exten':_0x419059['exten'],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x419059[_0x0acd('0x12')]?'CDR(prefix)=${EXTEN:0:'+_0x419059['cutdigits']+'}':_0x0acd('0x17'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':'outbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0x18'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x19'),'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0xe'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':'outbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0x1a')+_0x419059['id'],'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']}];if(_0x419059[_0x0acd('0x1b')](_0x0acd('0x1c'))&&_0x419059[_0x0acd('0x1c')]!==_0x0acd('0x1d')){_0x4b137a[_0x0acd('0xc')]({'type':'outbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0x1e'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x1f')+_0x419059[_0x0acd('0x1c')]||_0x0acd('0x20'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']});}return _0x4b137a;}function _0x1c335c(_0x4dd81a,_0x3a52af){var _0x458bf5=[{'name':_0x0acd('0x21'),'param':0x0},{'name':_0x0acd('0x22'),'param':0x1},{'name':_0x0acd('0x23'),'param':0x2},{'name':_0x0acd('0x24'),'param':0x3}];var _0x1cec0e={};var _0x5ab344=_0x3a52af[_0x0acd('0x25')](',');var _0x546e90=[];for(var _0x8eaa8d=0x0;_0x8eaa8d<_0x458bf5['length'];_0x8eaa8d++){switch(_0x458bf5[_0x8eaa8d][_0x0acd('0x26')]){case _0x0acd('0x21'):_0x1cec0e[_0x0acd('0x21')]=_0x5ab344[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]['split']('/')[0x1];_0x1cec0e[_0x0acd('0x28')]=_0x5ab344[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]['split']('/')[0x2];_0x1cec0e[_0x0acd('0x29')]=_0x1cec0e[_0x0acd('0x28')]?_0x1cec0e[_0x0acd('0x28')]['split']('$')[0x0]:undefined;_0x1cec0e[_0x0acd('0x28')]=_0x4dd81a['cutdigits']?(_0x1cec0e['prefix']||'')+_0x0acd('0x13')+_0x4dd81a[_0x0acd('0x12')]+'}':(_0x1cec0e[_0x0acd('0x29')]||'')+'${EXTEN}';_0x546e90[_0x458bf5[_0x8eaa8d]['param']]=[_0x0acd('0x2a'),_0x1cec0e['trunk'],_0x1cec0e[_0x0acd('0x28')]][_0x0acd('0x2b')]('/');break;case _0x0acd('0x23'):_0x1cec0e[_0x0acd('0x23')]=_0x5ab344[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]];if(_0x4dd81a[_0x0acd('0x1c')]!==_0x0acd('0x1d')){if(_0x1cec0e['options'][_0x0acd('0x2c')](_0x0acd('0x2d'))<0x0){_0x1cec0e[_0x0acd('0x23')]+=_0x0acd('0x2d');}}else{_0x1cec0e[_0x0acd('0x23')]=_0x1cec0e['options'][_0x0acd('0x2e')](_0x0acd('0x2d'),'');}_0x546e90[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]=_0x1cec0e['options'];break;default:_0x546e90[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]=_0x5ab344[_0x458bf5[_0x8eaa8d]['param']];}}return _0x546e90[_0x0acd('0x2b')](',');}function _0x4c9d9f(_0x44673e,_0x5a86f6,_0x3949f2){return new Promise(function(_0x470eba,_0x3f015c){var _0x4922ca=[];if(_[_0x0acd('0x2f')](_0x5a86f6))return _0x470eba(_0x4922ca);_0x42fa2d[_0x0acd('0x30')]['findAll']({'attributes':['id',_0x0acd('0x31'),_0x0acd('0x32')],'raw':!![]})['then'](function(_0x2de8ff){for(var _0x4ff471=0x0,_0x5421b5=0x0;_0x4ff471<_0x5a86f6[_0x0acd('0x33')];_0x4ff471++,_0x5421b5=0x0){var _0x2b611e=_0x5a86f6[_0x4ff471];var _0xd81b95=[];var _0x2ca39e=[];delete _0x2b611e['id'];if(_0x2b611e['interval']!==_0x0acd('0x34')){_0x2b611e[_0x0acd('0x35')]=[_0x2b611e[_0x0acd('0x31')]];}else{_0x2b611e[_0x0acd('0x35')]=_0x2b611e[_0x0acd('0x32')]?_[_0x0acd('0x36')](_[_0x0acd('0x37')](_0x2de8ff,{'IntervalId':_0x2b611e['IntervalId']}),_0x0acd('0x31')):[];}_0x2b611e[_0x0acd('0x6')]=_0x44673e[_0x0acd('0x6')];_0x2b611e[_0x0acd('0x7')]=_0x44673e[_0x0acd('0x7')];if(_0x2b611e['type'])_0x2b611e[_0x0acd('0x3')]=_0x2b611e['type'][_0x0acd('0x38')]();if(_0x44673e[_0x0acd('0x3')]===_0x0acd('0xf')){if(_0x2b611e[_0x0acd('0x1b')]('tag')&&_0x2b611e[_0x0acd('0x39')]&&_0x2b611e['tag']!=='--'){_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')][_0x0acd('0x38')](),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x3a')+_0x2b611e[_0x0acd('0x39')],'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')][_0x0acd('0x38')](),'app':'ExecIf','appdata':_0x0acd('0x3b')+(_0x2b611e[_0x0acd('0x3c')]?'Set(CALLERID(all)='+_0x2b611e[_0x0acd('0x3c')]+')':_0x0acd('0x3d')),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}else{if(_0x2b611e[_0x0acd('0x1b')](_0x0acd('0x3e'))){if(['queue','playback'][_0x0acd('0x3f')](_0x2b611e[_0x0acd('0x40')][_0x0acd('0x38')]())&&_0x2b611e['appType']!==_0x0acd('0x41')){if(_0x2b611e[_0x0acd('0x3e')]){_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e['type']['toLowerCase'](),'app':_0x0acd('0x14'),'appdata':_0x0acd('0x42'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e['intervals'][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')][_0x0acd('0x38')](),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x43'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e['exten'],'priority':_0x2b611e[_0x0acd('0x35')]['length']+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}else{_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')]['toLowerCase'](),'app':_0x0acd('0x14'),'appdata':_0x0acd('0x44'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e[_0x0acd('0x35')]['length']+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});_0xd81b95['push']({'type':_0x2b611e[_0x0acd('0x3')]['toLowerCase'](),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x45'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e['exten'],'priority':_0x2b611e['intervals'][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}}}}for(var _0x9345c0=0x0;_0x9345c0<_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')];_0x9345c0++){var _0x1b175c=_0x3949f2+_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')];var _0x1983c8=_0x9345c0===_0x2b611e['intervals'][_0x0acd('0x33')]-0x1?_0x3949f2+_0xd81b95[_0x0acd('0x33')]+_0x2ca39e[_0x0acd('0x33')]+0x2:_0x3949f2+_0x9345c0+0x1;_0xd81b95[_0x0acd('0x46')](_0x9345c0,0x0,{'type':_0x44673e[_0x0acd('0x3')],'app':_0x0acd('0x47'),'appdata':_0x2b611e[_0x0acd('0x35')][_0x9345c0]+'?'+_0x44673e[_0x0acd('0x6')]+_0x0acd('0x48')+_0x1b175c+':'+_0x44673e[_0x0acd('0x6')]+_0x0acd('0x48')+_0x1983c8,'exten':_0x44673e['exten'],'context':_0x44673e[_0x0acd('0x6')],'priority':_0x3949f2+_0x9345c0,'VoiceExtensionId':_0x44673e['id']});}if(_0x2b611e[_0x0acd('0x49')]==='outboundDial')_0x2b611e[_0x0acd('0x4a')]=_0x1c335c(_0x44673e,_0x2b611e[_0x0acd('0x4a')]);_0x2b611e['priority']=_0xd81b95[_0x0acd('0x33')]?_[_0x0acd('0x4b')](_0xd81b95)[_0x0acd('0x4c')]+0x1:_0x3949f2;_0x4922ca=_['concat'](_0x4922ca,_0xd81b95,[_0x2b611e],_0x2ca39e);_0x3949f2=_[_0x0acd('0x4b')](_0x4922ca)['priority']+0x1;}return _0x470eba(_0x4922ca);})['catch'](function(_0x2a8589){_0x3f015c(_0x2a8589);});});}return _0x4bd438['define'](_0x0acd('0x4d'),attributes,{'tableName':_0x0acd('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x44307b){var _0x5af26a=this[_0x0acd('0x4f')]({'plain':!![]});var _0x25382a=_0x5af26a[_0x0acd('0x3')]===_0x0acd('0xf')?_0x9ae857(_0x5af26a):_0x1e95fd(_0x5af26a);return _0x4c9d9f(_0x5af26a,_0x44307b,_[_0x0acd('0x4b')](_0x25382a)[_0x0acd('0x4c')]+0x1)[_0x0acd('0x50')](function(_0x253f2e){var _0xbcfe11=_[_0x0acd('0x51')](_0x25382a,_0x253f2e);_0xbcfe11[_0x0acd('0xc')]({'type':_0x5af26a[_0x0acd('0x3')],'app':_0x0acd('0x52'),'exten':_0x5af26a[_0x0acd('0x7')],'context':_0x5af26a[_0x0acd('0x6')],'priority':_[_0x0acd('0x4b')](_0xbcfe11)[_0x0acd('0x4c')]+0x1,'VoiceExtensionId':_0x5af26a['id']});return _0xbcfe11;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c89db33..3488e4a 100644 --- a/server/api/voiceExtension/voiceExtension.rpc.js +++ b/server/api/voiceExtension/voiceExtension.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0048=['VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','limit','include','model','attributes','map','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x49793e,_0x52a952){var _0x514fa0=function(_0x2d4590){while(--_0x2d4590){_0x49793e['push'](_0x49793e['shift']());}};_0x514fa0(++_0x52a952);}(_0x0048,0x129));var _0x8004=function(_0x1bf8b1,_0x1b11cd){_0x1bf8b1=_0x1bf8b1-0x0;var _0x37fb94=_0x0048[_0x1bf8b1];return _0x37fb94;};'use strict';var _=require('lodash');var util=require(_0x8004('0x0'));var moment=require(_0x8004('0x1'));var BPromise=require('bluebird');var rs=require(_0x8004('0x2'));var fs=require('fs');var Redis=require(_0x8004('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8004('0x4'));var logger=require(_0x8004('0x5'))(_0x8004('0x6'));var config=require(_0x8004('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8004('0x8')]({'port':0x232a});config[_0x8004('0x9')]=_[_0x8004('0xa')](config['redis'],{'host':_0x8004('0xb'),'port':0x18eb});var socket=require(_0x8004('0xc'))(new Redis(config[_0x8004('0x9')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x552f51,_0x37981f,_0x4ae5a4){return new BPromise(function(_0x59ea76,_0x12e67b){return client[_0x8004('0xd')](_0x552f51,_0x4ae5a4)['then'](function(_0x480040){logger[_0x8004('0xe')](_0x8004('0xf'),_0x37981f,_0x8004('0x10'));logger[_0x8004('0x11')](_0x8004('0x12'),_0x37981f,_0x8004('0x10'),JSON[_0x8004('0x13')](_0x480040));if(_0x480040['error']){if(_0x480040[_0x8004('0x14')][_0x8004('0x15')]===0x1f4){logger[_0x8004('0x14')](_0x8004('0xf'),_0x37981f,_0x480040[_0x8004('0x14')][_0x8004('0x16')]);return _0x12e67b(_0x480040[_0x8004('0x14')][_0x8004('0x16')]);}logger[_0x8004('0x14')](_0x8004('0xf'),_0x37981f,_0x480040[_0x8004('0x14')][_0x8004('0x16')]);return _0x59ea76(_0x480040[_0x8004('0x14')][_0x8004('0x16')]);}else{logger[_0x8004('0xe')](_0x8004('0xf'),_0x37981f,_0x8004('0x10'));_0x59ea76(_0x480040[_0x8004('0x17')][_0x8004('0x16')]);}})['catch'](function(_0x1022ac){logger[_0x8004('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x37981f,_0x1022ac);_0x12e67b(_0x1022ac);});});}exports[_0x8004('0x18')]=function(_0x44222d){var _0x1cef74=this;return new Promise(function(_0x61a0c,_0x24cbc6){return db[_0x8004('0x19')][_0x8004('0x1a')]({'raw':_0x44222d[_0x8004('0x1b')]?_0x44222d[_0x8004('0x1b')][_0x8004('0x1c')]===undefined?!![]:![]:!![],'where':_0x44222d['options']?_0x44222d['options']['where']||null:null,'attributes':_0x44222d[_0x8004('0x1b')]?_0x44222d[_0x8004('0x1b')]['attributes']||null:null,'limit':_0x44222d[_0x8004('0x1b')]?_0x44222d[_0x8004('0x1b')][_0x8004('0x1d')]||null:null,'include':_0x44222d[_0x8004('0x1b')]?_0x44222d[_0x8004('0x1b')][_0x8004('0x1e')]?_['map'](_0x44222d[_0x8004('0x1b')][_0x8004('0x1e')],function(_0x599dfd){return{'model':db[_0x599dfd[_0x8004('0x1f')]],'as':_0x599dfd['as'],'attributes':_0x599dfd[_0x8004('0x20')],'include':_0x599dfd[_0x8004('0x1e')]?_[_0x8004('0x21')](_0x599dfd['include'],function(_0x5271d3){return{'model':db[_0x5271d3[_0x8004('0x1f')]],'as':_0x5271d3['as'],'attributes':_0x5271d3[_0x8004('0x20')],'include':_0x5271d3['include']?_[_0x8004('0x21')](_0x5271d3[_0x8004('0x1e')],function(_0x3be2f9){return{'model':db[_0x3be2f9[_0x8004('0x1f')]],'as':_0x3be2f9['as'],'attributes':_0x3be2f9[_0x8004('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27902e){logger['info'](_0x8004('0x18'),_0x44222d);logger['debug']('GetVoiceExtension',_0x44222d,JSON['stringify'](_0x27902e));_0x61a0c(_0x27902e);})[_0x8004('0x22')](function(_0x3dff63){logger['error'](_0x8004('0x18'),_0x3dff63[_0x8004('0x16')],_0x44222d);_0x24cbc6(_0x1cef74[_0x8004('0x14')](0x1f4,_0x3dff63[_0x8004('0x16')]));});});}; \ No newline at end of file +var _0xe0ae=['where','attributes','include','map','model','GetVoiceExtension','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','findAll','options','raw'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0xe0ae,0xa1));var _0xee0a=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe0ae[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee0a('0x0'));var BPromise=require(_0xee0a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee0a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xee0a('0x3'));var logger=require(_0xee0a('0x4'))('rpc');var config=require(_0xee0a('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee0a('0x6')]({'port':0x232a});config[_0xee0a('0x7')]=_[_0xee0a('0x8')](config[_0xee0a('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xee0a('0x9'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xee0a('0xa')](socket);function respondWithRpcPromise(_0x3d0b3f,_0xbd4483,_0x57d190){return new BPromise(function(_0x3bc0cf,_0x1a953e){return client['request'](_0x3d0b3f,_0x57d190)[_0xee0a('0xb')](function(_0x4b3e49){logger[_0xee0a('0xc')](_0xee0a('0xd'),_0xbd4483,'request\x20sent');logger[_0xee0a('0xe')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xbd4483,_0xee0a('0xf'),JSON[_0xee0a('0x10')](_0x4b3e49));if(_0x4b3e49['error']){if(_0x4b3e49['error'][_0xee0a('0x11')]===0x1f4){logger[_0xee0a('0x12')](_0xee0a('0xd'),_0xbd4483,_0x4b3e49[_0xee0a('0x12')][_0xee0a('0x13')]);return _0x1a953e(_0x4b3e49['error'][_0xee0a('0x13')]);}logger[_0xee0a('0x12')]('VoiceExtension,\x20%s,\x20%s',_0xbd4483,_0x4b3e49[_0xee0a('0x12')][_0xee0a('0x13')]);return _0x3bc0cf(_0x4b3e49[_0xee0a('0x12')][_0xee0a('0x13')]);}else{logger['info'](_0xee0a('0xd'),_0xbd4483,_0xee0a('0xf'));_0x3bc0cf(_0x4b3e49[_0xee0a('0x14')]['message']);}})[_0xee0a('0x15')](function(_0x1ffdb5){logger[_0xee0a('0x12')](_0xee0a('0xd'),_0xbd4483,_0x1ffdb5);_0x1a953e(_0x1ffdb5);});});}exports['GetVoiceExtension']=function(_0xe9d5d4){var _0x10c224=this;return new Promise(function(_0x452d97,_0x201d32){return db['VoiceExtension'][_0xee0a('0x16')]({'raw':_0xe9d5d4[_0xee0a('0x17')]?_0xe9d5d4[_0xee0a('0x17')][_0xee0a('0x18')]===undefined?!![]:![]:!![],'where':_0xe9d5d4[_0xee0a('0x17')]?_0xe9d5d4[_0xee0a('0x17')][_0xee0a('0x19')]||null:null,'attributes':_0xe9d5d4['options']?_0xe9d5d4[_0xee0a('0x17')][_0xee0a('0x1a')]||null:null,'limit':_0xe9d5d4[_0xee0a('0x17')]?_0xe9d5d4[_0xee0a('0x17')]['limit']||null:null,'include':_0xe9d5d4[_0xee0a('0x17')]?_0xe9d5d4[_0xee0a('0x17')][_0xee0a('0x1b')]?_[_0xee0a('0x1c')](_0xe9d5d4['options']['include'],function(_0x578ecf){return{'model':db[_0x578ecf[_0xee0a('0x1d')]],'as':_0x578ecf['as'],'attributes':_0x578ecf['attributes'],'include':_0x578ecf['include']?_[_0xee0a('0x1c')](_0x578ecf[_0xee0a('0x1b')],function(_0xe5365f){return{'model':db[_0xe5365f['model']],'as':_0xe5365f['as'],'attributes':_0xe5365f[_0xee0a('0x1a')],'include':_0xe5365f[_0xee0a('0x1b')]?_[_0xee0a('0x1c')](_0xe5365f[_0xee0a('0x1b')],function(_0x2e7f18){return{'model':db[_0x2e7f18[_0xee0a('0x1d')]],'as':_0x2e7f18['as'],'attributes':_0x2e7f18[_0xee0a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xee0a('0xb')](function(_0x65e054){logger[_0xee0a('0xc')]('GetVoiceExtension',_0xe9d5d4);logger[_0xee0a('0xe')](_0xee0a('0x1e'),_0xe9d5d4,JSON[_0xee0a('0x10')](_0x65e054));_0x452d97(_0x65e054);})[_0xee0a('0x15')](function(_0x45feeb){logger[_0xee0a('0x12')]('GetVoiceExtension',_0x45feeb[_0xee0a('0x13')],_0xe9d5d4);_0x201d32(_0x10c224[_0xee0a('0x12')](0x1f4,_0x45feeb[_0xee0a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 648630c..79849e5 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['length','voiceExtension:','remove','update','emit','removeListener','register'];(function(_0x3baffa,_0x18bca9){var _0x1bb67a=function(_0x56f710){while(--_0x56f710){_0x3baffa['push'](_0x3baffa['shift']());}};_0x1bb67a(++_0x18bca9);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4fabbe,_0xc514f3){_0x4fabbe=_0x4fabbe-0x0;var _0x5510dd=_0x7fbe[_0x4fabbe];return _0x5510dd;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0xe7fb('0x0'),_0xe7fb('0x1')];function createListener(_0x294c21,_0x1703d5){return function(_0x517d3a){_0x1703d5[_0xe7fb('0x2')](_0x294c21,_0x517d3a);};}function removeListener(_0x11d2c4,_0x4524ff){return function(){VoiceExtensionEvents[_0xe7fb('0x3')](_0x11d2c4,_0x4524ff);};}exports[_0xe7fb('0x4')]=function(_0x290172){for(var _0x12d1b0=0x0,_0x24cd67=events[_0xe7fb('0x5')];_0x12d1b0<_0x24cd67;_0x12d1b0++){var _0x5ad75b=events[_0x12d1b0];var _0x213ebc=createListener(_0xe7fb('0x6')+_0x5ad75b,_0x290172);VoiceExtensionEvents['on'](_0x5ad75b,_0x213ebc);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x1a488d,_0x38264b){var _0x5515d5=function(_0x3d50be){while(--_0x3d50be){_0x1a488d['push'](_0x1a488d['shift']());}};_0x5515d5(++_0x38264b);}(_0x53ec,0x192));var _0xc53e=function(_0x415260,_0x135fcb){_0x415260=_0x415260-0x0;var _0x490f21=_0x53ec[_0x415260];return _0x490f21;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 022403e..caa4be5 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdbd=['get','getMessages','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated','index','show'];(function(_0x4cf9e8,_0x18f46f){var _0x22219b=function(_0x5510e3){while(--_0x5510e3){_0x4cf9e8['push'](_0x4cf9e8['shift']());}};_0x22219b(++_0x18f46f);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0xfdbd[_0x5ef905];return _0x367808;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id/messages',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')]('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x10')]);router[_0xdfdb('0x11')](_0xdfdb('0x12'),auth['isAuthenticated'](),controller[_0xdfdb('0x13')]);router[_0xdfdb('0x14')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x15')]);module[_0xdfdb('0x16')]=router; \ No newline at end of file +var _0xf072=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy'];(function(_0x381ea4,_0x104e0d){var _0x471c9f=function(_0x3468e9){while(--_0x3468e9){_0x381ea4['push'](_0x381ea4['shift']());}};_0x471c9f(++_0x104e0d);}(_0xf072,0x1cf));var _0x2f07=function(_0x21ccce,_0x8cf90d){_0x21ccce=_0x21ccce-0x0;var _0x1d2351=_0xf072[_0x21ccce];return _0x1d2351;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var fs_extra=require(_0x2f07('0x4'));var auth=require(_0x2f07('0x5'));var interaction=require(_0x2f07('0x6'));var config=require('../../config/environment');var controller=require(_0x2f07('0x7'));router[_0x2f07('0x8')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xa')]);router[_0x2f07('0x8')](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xc')]);router[_0x2f07('0x8')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xe')]);router[_0x2f07('0xf')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0x10')]);router['put'](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x11')]);router[_0x2f07('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2f07('0x13')]);module[_0x2f07('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9b77921..b7972b9 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cca=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize'];(function(_0x2df724,_0x411382){var _0x1b2504=function(_0x1d3cd1){while(--_0x1d3cd1){_0x2df724['push'](_0x2df724['shift']());}};_0x1b2504(++_0x411382);}(_0x2cca,0xa9));var _0xa2cc=function(_0x4da204,_0x125977){_0x4da204=_0x4da204-0x0;var _0x4151c8=_0x2cca[_0x4da204];return _0x4151c8;};'use strict';var Sequelize=require(_0xa2cc('0x0'));module[_0xa2cc('0x1')]={'customer_id':{'type':Sequelize[_0xa2cc('0x2')]},'context':{'type':Sequelize[_0xa2cc('0x2')],'defaultValue':_0xa2cc('0x3'),'unique':_0xa2cc('0x4')},'mailbox':{'type':Sequelize[_0xa2cc('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xa2cc('0x2')]},'fullname':{'type':Sequelize[_0xa2cc('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x1d5b3c){this[_0xa2cc('0x5')]('email',typeof _0x1d5b3c===_0xa2cc('0x6')&&_0x1d5b3c['trim']()?_0x1d5b3c['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xa2cc('0x2')],'defaultValue':_0xa2cc('0x7')},'attach':{'type':Sequelize[_0xa2cc('0x8')](_0xa2cc('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xa2cc('0x8')](_0xa2cc('0x9'),'no'),'defaultValue':_0xa2cc('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xa2cc('0x2')]},'callback':{'type':Sequelize[_0xa2cc('0x2')]},'review':{'type':Sequelize[_0xa2cc('0x8')](_0xa2cc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xa2cc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xa2cc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xa2cc('0x8')](_0xa2cc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xa2cc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xa2cc('0x8')](_0xa2cc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xa2cc('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xa2cc('0x8')](_0xa2cc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xa2cc('0x8')](_0xa2cc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa2cc('0x8')](_0xa2cc('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xa2cc('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xa2cc('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xa2cc('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xa2cc('0xc')],'get':function(){return this['getDataValue'](_0xa2cc('0xd'))+_0xa2cc('0xe')+this[_0xa2cc('0xf')](_0xa2cc('0x10'));}}}; \ No newline at end of file +var _0x00d0=['yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','email','trim','central'];(function(_0x1be9f2,_0x174438){var _0x215fd6=function(_0x166cfb){while(--_0x166cfb){_0x1be9f2['push'](_0x1be9f2['shift']());}};_0x215fd6(++_0x174438);}(_0x00d0,0x169));var _0x000d=function(_0x2aa1d8,_0x23e357){_0x2aa1d8=_0x2aa1d8-0x0;var _0x201e5c=_0x00d0[_0x2aa1d8];return _0x201e5c;};'use strict';var Sequelize=require('sequelize');module[_0x000d('0x0')]={'customer_id':{'type':Sequelize[_0x000d('0x1')]},'context':{'type':Sequelize[_0x000d('0x1')],'defaultValue':_0x000d('0x2'),'unique':_0x000d('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x000d('0x3')},'password':{'type':Sequelize[_0x000d('0x1')]},'fullname':{'type':Sequelize[_0x000d('0x1')]},'email':{'type':Sequelize[_0x000d('0x1')],'validate':{'isEmail':!![]},'set':function(_0x322b94){this['setDataValue'](_0x000d('0x4'),typeof _0x322b94==='string'&&_0x322b94['trim']()?_0x322b94[_0x000d('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x000d('0x6')},'attach':{'type':Sequelize['ENUM'](_0x000d('0x7'),'no'),'defaultValue':_0x000d('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x000d('0x1')]},'callback':{'type':Sequelize[_0x000d('0x1')]},'review':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x000d('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x000d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x000d('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x000d('0x7'),'no'),'defaultValue':_0x000d('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':_0x000d('0x7'),'allowNull':![]},'stamp':{'type':_0x000d('0xa')},'emailsubject':{'type':Sequelize[_0x000d('0x1')]},'emailbody':{'type':Sequelize[_0x000d('0x1')]},'maxsecs':{'type':Sequelize[_0x000d('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x000d('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x000d('0xc')],'get':function(){return this[_0x000d('0xd')]('fullname')+_0x000d('0xe')+this[_0x000d('0xd')](_0x000d('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 0645959..97609be 100644 --- a/server/api/voiceMail/voiceMail.controller.js +++ b/server/api/voiceMail/voiceMail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7af2=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','getMessages','findOne','VoiceMailMessage','rawAttributes','mailbox','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create'];(function(_0x42a63d,_0x28f25e){var _0x278731=function(_0x108d83){while(--_0x108d83){_0x42a63d['push'](_0x42a63d['shift']());}};_0x278731(++_0x28f25e);}(_0x7af2,0x119));var _0x27af=function(_0x285d34,_0x42dd2d){_0x285d34=_0x285d34-0x0;var _0x59e21d=_0x7af2[_0x285d34];return _0x59e21d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];function respondWithStatusCode(_0x49a883,_0x406340){_0x406340=_0x406340||0xcc;return function(_0x203501){if(_0x203501){return _0x49a883[_0x27af('0x17')](_0x406340);}return _0x49a883[_0x27af('0x18')](_0x406340)[_0x27af('0x19')]();};}function respondWithResult(_0x1edb50,_0x234825){_0x234825=_0x234825||0xc8;return function(_0x3da435){if(_0x3da435){return _0x1edb50[_0x27af('0x18')](_0x234825)[_0x27af('0x1a')](_0x3da435);}};}function respondWithFilteredResult(_0x30f675,_0x9c2d4b){return function(_0x2d7800){if(_0x2d7800){var _0x3102c4=typeof _0x9c2d4b[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x9c2d4b[_0x27af('0x1d')]===_0x27af('0x1c');var _0x58583a=_0x2d7800[_0x27af('0x1e')];var _0x31d702=_0x3102c4?0x0:_0x9c2d4b['offset'];var _0x4e6e2f=_0x3102c4?_0x2d7800[_0x27af('0x1e')]:_0x9c2d4b[_0x27af('0x1b')]+_0x9c2d4b[_0x27af('0x1d')];var _0x31573a;if(_0x4e6e2f>=_0x58583a){_0x4e6e2f=_0x58583a;_0x31573a=0xc8;}else{_0x31573a=0xce;}_0x30f675[_0x27af('0x18')](_0x31573a);return _0x30f675['set'](_0x27af('0x1f'),_0x31d702+'-'+_0x4e6e2f+'/'+_0x58583a)[_0x27af('0x1a')](_0x2d7800);}return null;};}function patchUpdates(_0xcb4b90){return function(_0x5e7c19){try{jsonpatch[_0x27af('0x20')](_0x5e7c19,_0xcb4b90,!![]);}catch(_0x2eec5f){return BPromise[_0x27af('0x21')](_0x2eec5f);}return _0x5e7c19['save']();};}function saveUpdates(_0x2dce2b,_0x2460f4){return function(_0x30720b){if(_0x30720b){return _0x30720b[_0x27af('0x22')](_0x2dce2b)[_0x27af('0x23')](function(_0x396156){return _0x396156;});}return null;};}function removeEntity(_0x43dd9e,_0x35b36d){return function(_0x2e1bb0){if(_0x2e1bb0){return _0x2e1bb0['destroy']()['then'](function(){var _0x4b8fe6=_0x2e1bb0[_0x27af('0x24')]({'plain':!![]});var _0x4feaf1=_0x27af('0x25');return db[_0x27af('0x26')]['destroy']({'where':{'type':_0x4feaf1,'resourceId':_0x4b8fe6['id']}})[_0x27af('0x23')](function(){return _0x2e1bb0;});})[_0x27af('0x23')](function(){_0x43dd9e[_0x27af('0x18')](0xcc)[_0x27af('0x19')]();});}};}function handleEntityNotFound(_0x39b8ee,_0x3ca40e){return function(_0x775d4e){if(!_0x775d4e){_0x39b8ee['sendStatus'](0x194);}return _0x775d4e;};}function handleError(_0x14d5fc,_0x250d5b){_0x250d5b=_0x250d5b||0x1f4;return function(_0xadd38e){logger[_0x27af('0x27')](_0xadd38e[_0x27af('0x28')]);if(_0xadd38e[_0x27af('0x29')]){delete _0xadd38e[_0x27af('0x29')];}_0x14d5fc[_0x27af('0x18')](_0x250d5b)[_0x27af('0x2a')](_0xadd38e);};}exports[_0x27af('0x2b')]=function(_0x205e41,_0x4f4955){var _0x15e867={},_0x14b2e7={},_0x3800a1={'count':0x0,'rows':[]};var _0x575887=_[_0x27af('0x2c')](db[_0x27af('0x2d')]['rawAttributes'],function(_0x51bc97){return{'name':_0x51bc97[_0x27af('0x2e')],'type':_0x51bc97[_0x27af('0x2f')]['key']};});_0x14b2e7[_0x27af('0x30')]=_[_0x27af('0x2c')](_0x575887,_0x27af('0x29'));_0x14b2e7[_0x27af('0x31')]=_[_0x27af('0x32')](_0x205e41[_0x27af('0x31')]);_0x14b2e7[_0x27af('0x33')]=_[_0x27af('0x34')](_0x14b2e7[_0x27af('0x30')],_0x14b2e7[_0x27af('0x31')]);_0x15e867[_0x27af('0x35')]=_['intersection'](_0x14b2e7['model'],qs[_0x27af('0x36')](_0x205e41[_0x27af('0x31')]['fields']));_0x15e867[_0x27af('0x35')]=_0x15e867[_0x27af('0x35')]['length']?_0x15e867[_0x27af('0x35')]:_0x14b2e7[_0x27af('0x30')];if(!_0x205e41[_0x27af('0x31')][_0x27af('0x37')](_0x27af('0x38'))){_0x15e867['limit']=qs[_0x27af('0x1d')](_0x205e41[_0x27af('0x31')]['limit']);_0x15e867['offset']=qs[_0x27af('0x1b')](_0x205e41[_0x27af('0x31')][_0x27af('0x1b')]);}_0x15e867[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x205e41[_0x27af('0x31')]['sort']);_0x15e867[_0x27af('0x3b')]=qs['filters'](_[_0x27af('0x3c')](_0x205e41[_0x27af('0x31')],_0x14b2e7[_0x27af('0x33')]),_0x575887);if(_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]){_0x15e867['where']=_[_0x27af('0x3e')](_0x15e867[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x575887,function(_0x3faebd){if(_0x3faebd[_0x27af('0x2f')]!==_0x27af('0x3f')){var _0x415d9f={};_0x415d9f[_0x3faebd[_0x27af('0x29')]]={'$like':'%'+_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x415d9f;}})});}_0x15e867=_[_0x27af('0x3e')]({},_0x15e867,_0x205e41[_0x27af('0x40')]);var _0x24ee9b={'where':_0x15e867[_0x27af('0x3b')]};return db['VoiceMail'][_0x27af('0x1e')](_0x24ee9b)[_0x27af('0x23')](function(_0x44534b){_0x3800a1[_0x27af('0x1e')]=_0x44534b;if(_0x205e41['query'][_0x27af('0x41')]){_0x15e867['include']=[{'all':!![]}];}return db['VoiceMail'][_0x27af('0x42')](_0x15e867);})[_0x27af('0x23')](function(_0x279f99){_0x3800a1[_0x27af('0x43')]=_0x279f99;return _0x3800a1;})[_0x27af('0x23')](respondWithFilteredResult(_0x4f4955,_0x15e867))[_0x27af('0x44')](handleError(_0x4f4955,null));};exports[_0x27af('0x45')]=function(_0x26eb28,_0x2269e8){var _0x100fcb={'raw':!![],'where':{'id':_0x26eb28[_0x27af('0x46')]['id']}},_0x1e3c35={};_0x1e3c35['model']=_[_0x27af('0x32')](db[_0x27af('0x2d')]['rawAttributes']);_0x1e3c35['query']=_[_0x27af('0x32')](_0x26eb28[_0x27af('0x31')]);_0x1e3c35[_0x27af('0x33')]=_[_0x27af('0x34')](_0x1e3c35[_0x27af('0x30')],_0x1e3c35['query']);_0x100fcb[_0x27af('0x35')]=_['intersection'](_0x1e3c35[_0x27af('0x30')],qs[_0x27af('0x36')](_0x26eb28[_0x27af('0x31')][_0x27af('0x36')]));_0x100fcb[_0x27af('0x35')]=_0x100fcb[_0x27af('0x35')][_0x27af('0x47')]?_0x100fcb['attributes']:_0x1e3c35['model'];if(_0x26eb28[_0x27af('0x31')]['includeAll']){_0x100fcb[_0x27af('0x48')]=[{'all':!![]}];}_0x100fcb=_[_0x27af('0x3e')]({},_0x100fcb,_0x26eb28[_0x27af('0x40')]);return db[_0x27af('0x2d')][_0x27af('0x49')](_0x100fcb)[_0x27af('0x23')](handleEntityNotFound(_0x2269e8,null))[_0x27af('0x23')](respondWithResult(_0x2269e8,null))['catch'](handleError(_0x2269e8,null));};exports[_0x27af('0x4a')]=function(_0xc7e2a8,_0x20e180){return db[_0x27af('0x2d')][_0x27af('0x4a')](_0xc7e2a8['body'],{})[_0x27af('0x23')](function(_0x25f960){var _0x28ba64=_0xc7e2a8['user']['get']({'plain':!![]});if(!_0x28ba64)throw new Error(_0x27af('0x4b'));if(_0x28ba64[_0x27af('0x4c')]===_0x27af('0x4d')){var _0x5be44f=_0x25f960['get']({'plain':!![]});var _0x2fad23='Voicemails';return db[_0x27af('0x4e')][_0x27af('0x49')]({'where':{'name':_0x2fad23,'userProfileId':_0x28ba64[_0x27af('0x4f')]},'raw':!![]})[_0x27af('0x23')](function(_0x38aa14){if(_0x38aa14&&_0x38aa14[_0x27af('0x50')]===0x0){return db[_0x27af('0x26')][_0x27af('0x4a')]({'name':_0x5be44f[_0x27af('0x29')],'resourceId':_0x5be44f['id'],'type':_0x38aa14[_0x27af('0x29')],'sectionId':_0x38aa14['id']},{})[_0x27af('0x23')](function(){return _0x25f960;});}else{return _0x25f960;}})['catch'](function(_0x76ed78){logger[_0x27af('0x27')](_0x27af('0x51'),_0x76ed78);throw _0x76ed78;});}return _0x25f960;})[_0x27af('0x23')](respondWithResult(_0x20e180,0xc9))[_0x27af('0x44')](handleError(_0x20e180,null));};exports[_0x27af('0x22')]=function(_0x20c155,_0x31eaa9){if(_0x20c155['body']['id']){delete _0x20c155[_0x27af('0x52')]['id'];}return db['VoiceMail'][_0x27af('0x49')]({'where':{'id':_0x20c155[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x31eaa9,null))['then'](saveUpdates(_0x20c155[_0x27af('0x52')],null))['then'](respondWithResult(_0x31eaa9,null))[_0x27af('0x44')](handleError(_0x31eaa9,null));};exports[_0x27af('0x53')]=function(_0x4769ff,_0x5bf8b0){return db[_0x27af('0x2d')]['find']({'where':{'id':_0x4769ff[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bf8b0,null))[_0x27af('0x23')](removeEntity(_0x5bf8b0,null))[_0x27af('0x44')](handleError(_0x5bf8b0,null));};exports[_0x27af('0x54')]=function(_0x571064,_0x4bc851,_0x5eab7d){return db[_0x27af('0x2d')][_0x27af('0x55')]({'where':{'id':_0x571064[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bc851,null))[_0x27af('0x23')](function(_0x306c56){var _0x6761d4;var _0x34c855={},_0x299f63={};_0x299f63[_0x27af('0x30')]=_['keys'](db[_0x27af('0x56')][_0x27af('0x57')]);_0x299f63[_0x27af('0x31')]=_[_0x27af('0x32')](_0x571064['query']);_0x299f63[_0x27af('0x33')]=_['intersection'](_0x299f63[_0x27af('0x30')],_0x299f63[_0x27af('0x31')]);_0x34c855['attributes']=_[_0x27af('0x34')](_0x299f63[_0x27af('0x30')],qs['fields'](_0x571064['query'][_0x27af('0x36')]));_0x34c855[_0x27af('0x35')]=_0x34c855[_0x27af('0x35')]['length']?_0x34c855[_0x27af('0x35')]:_0x299f63[_0x27af('0x30')];if(!_0x571064['query'][_0x27af('0x37')](_0x27af('0x38'))){_0x34c855['limit']=qs['limit'](_0x571064[_0x27af('0x31')][_0x27af('0x1d')]);_0x34c855['offset']=qs['offset'](_0x571064[_0x27af('0x31')][_0x27af('0x1b')]);}_0x34c855[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x571064[_0x27af('0x31')][_0x27af('0x3a')]);_0x34c855[_0x27af('0x3b')]=qs['filters'](_['pick'](_0x571064[_0x27af('0x31')],_0x299f63[_0x27af('0x33')]));if(_0x571064[_0x27af('0x31')][_0x27af('0x3d')]){_0x34c855[_0x27af('0x3b')]=_[_0x27af('0x3e')](_0x34c855[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x34c855[_0x27af('0x35')],function(_0x13c9ff){var _0x444f21={};_0x444f21[_0x13c9ff]={'$like':'%'+_0x571064[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x444f21;})});}_0x34c855[_0x27af('0x3b')]=_[_0x27af('0x3e')](_0x34c855[_0x27af('0x3b')],{'mailboxuser':_0x306c56[_0x27af('0x58')]});_0x34c855=_['merge']({},_0x34c855,_0x571064[_0x27af('0x40')]);return db[_0x27af('0x56')]['findAndCountAll'](_0x34c855)[_0x27af('0x23')](respondWithFilteredResult(_0x4bc851,_0x34c855));})[_0x27af('0x44')](handleError(_0x4bc851,null));}; \ No newline at end of file +var _0x34b7=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','VoiceMailMessage','nolimit','mailbox','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys'];(function(_0x55734b,_0xa48bbd){var _0x39fef4=function(_0x1e440f){while(--_0x1e440f){_0x55734b['push'](_0x55734b['shift']());}};_0x39fef4(++_0xa48bbd);}(_0x34b7,0x196));var _0x734b=function(_0x390143,_0x2b54ac){_0x390143=_0x390143-0x0;var _0x11361b=_0x34b7[_0x390143];return _0x11361b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){var _0x104fff=_0x46d432[_0x734b('0x26')]({'plain':!![]});var _0x3abbe6=_0x734b('0x27');return db[_0x734b('0x28')][_0x734b('0x25')]({'where':{'type':_0x3abbe6,'resourceId':_0x104fff['id']}})['then'](function(){return _0x46d432;});})['then'](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x29')]();});}};}function handleEntityNotFound(_0x47a0a9,_0x32ea00){return function(_0x2dd51a){if(!_0x2dd51a){_0x47a0a9[_0x734b('0x18')](0x194);}return _0x2dd51a;};}function handleError(_0x41b501,_0x43edea){_0x43edea=_0x43edea||0x1f4;return function(_0x1b8295){logger[_0x734b('0x2a')](_0x1b8295['stack']);if(_0x1b8295[_0x734b('0x2b')]){delete _0x1b8295[_0x734b('0x2b')];}_0x41b501[_0x734b('0x19')](_0x43edea)[_0x734b('0x2c')](_0x1b8295);};}exports[_0x734b('0x2d')]=function(_0x427c36,_0x1fed72){var _0x21ed3c={},_0x371ead={},_0x3065b0={'count':0x0,'rows':[]};var _0x5dcabf=_[_0x734b('0x2e')](db[_0x734b('0x2f')]['rawAttributes'],function(_0xbbe037){return{'name':_0xbbe037[_0x734b('0x30')],'type':_0xbbe037[_0x734b('0x31')][_0x734b('0x32')]};});_0x371ead[_0x734b('0x33')]=_[_0x734b('0x2e')](_0x5dcabf,_0x734b('0x2b'));_0x371ead[_0x734b('0x34')]=_[_0x734b('0x35')](_0x427c36[_0x734b('0x34')]);_0x371ead[_0x734b('0x36')]=_[_0x734b('0x37')](_0x371ead[_0x734b('0x33')],_0x371ead[_0x734b('0x34')]);_0x21ed3c[_0x734b('0x38')]=_['intersection'](_0x371ead[_0x734b('0x33')],qs['fields'](_0x427c36[_0x734b('0x34')][_0x734b('0x39')]));_0x21ed3c[_0x734b('0x38')]=_0x21ed3c[_0x734b('0x38')][_0x734b('0x3a')]?_0x21ed3c[_0x734b('0x38')]:_0x371ead['model'];if(!_0x427c36['query'][_0x734b('0x3b')]('nolimit')){_0x21ed3c[_0x734b('0x1e')]=qs['limit'](_0x427c36[_0x734b('0x34')]['limit']);_0x21ed3c[_0x734b('0x1b')]=qs['offset'](_0x427c36[_0x734b('0x34')][_0x734b('0x1b')]);}_0x21ed3c[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x427c36[_0x734b('0x34')][_0x734b('0x3d')]);_0x21ed3c[_0x734b('0x3e')]=qs['filters'](_[_0x734b('0x3f')](_0x427c36[_0x734b('0x34')],_0x371ead['filters']),_0x5dcabf);if(_0x427c36[_0x734b('0x34')][_0x734b('0x40')]){_0x21ed3c[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x21ed3c['where'],{'$or':_[_0x734b('0x2e')](_0x5dcabf,function(_0x352d28){if(_0x352d28['type']!==_0x734b('0x42')){var _0x1e1689={};_0x1e1689[_0x352d28['name']]={'$like':'%'+_0x427c36[_0x734b('0x34')][_0x734b('0x40')]+'%'};return _0x1e1689;}})});}_0x21ed3c=_[_0x734b('0x41')]({},_0x21ed3c,_0x427c36[_0x734b('0x43')]);var _0x56eb35={'where':_0x21ed3c['where']};return db[_0x734b('0x2f')]['count'](_0x56eb35)['then'](function(_0x121a00){_0x3065b0['count']=_0x121a00;if(_0x427c36[_0x734b('0x34')]['includeAll']){_0x21ed3c[_0x734b('0x44')]=[{'all':!![]}];}return db[_0x734b('0x2f')][_0x734b('0x45')](_0x21ed3c);})['then'](function(_0x5cf3a0){_0x3065b0[_0x734b('0x46')]=_0x5cf3a0;return _0x3065b0;})['then'](respondWithFilteredResult(_0x1fed72,_0x21ed3c))['catch'](handleError(_0x1fed72,null));};exports[_0x734b('0x47')]=function(_0x159db9,_0x58f78a){var _0x2e789e={'raw':!![],'where':{'id':_0x159db9[_0x734b('0x48')]['id']}},_0x513f07={};_0x513f07[_0x734b('0x33')]=_[_0x734b('0x35')](db['VoiceMail'][_0x734b('0x49')]);_0x513f07[_0x734b('0x34')]=_[_0x734b('0x35')](_0x159db9[_0x734b('0x34')]);_0x513f07['filters']=_['intersection'](_0x513f07['model'],_0x513f07[_0x734b('0x34')]);_0x2e789e['attributes']=_['intersection'](_0x513f07[_0x734b('0x33')],qs['fields'](_0x159db9[_0x734b('0x34')][_0x734b('0x39')]));_0x2e789e[_0x734b('0x38')]=_0x2e789e[_0x734b('0x38')]['length']?_0x2e789e[_0x734b('0x38')]:_0x513f07['model'];if(_0x159db9[_0x734b('0x34')][_0x734b('0x4a')]){_0x2e789e[_0x734b('0x44')]=[{'all':!![]}];}_0x2e789e=_['merge']({},_0x2e789e,_0x159db9[_0x734b('0x43')]);return db['VoiceMail'][_0x734b('0x4b')](_0x2e789e)[_0x734b('0x24')](handleEntityNotFound(_0x58f78a,null))['then'](respondWithResult(_0x58f78a,null))[_0x734b('0x4c')](handleError(_0x58f78a,null));};exports[_0x734b('0x4d')]=function(_0x145ced,_0x38125a){return db[_0x734b('0x2f')]['create'](_0x145ced[_0x734b('0x4e')],{})['then'](function(_0x171575){var _0x5de7b7=_0x145ced[_0x734b('0x4f')][_0x734b('0x26')]({'plain':!![]});if(!_0x5de7b7)throw new Error(_0x734b('0x50'));if(_0x5de7b7[_0x734b('0x51')]===_0x734b('0x4f')){var _0x4b70f2=_0x171575['get']({'plain':!![]});var _0x484156=_0x734b('0x27');return db[_0x734b('0x52')]['find']({'where':{'name':_0x484156,'userProfileId':_0x5de7b7[_0x734b('0x53')]},'raw':!![]})[_0x734b('0x24')](function(_0x588ceb){if(_0x588ceb&&_0x588ceb[_0x734b('0x54')]===0x0){return db[_0x734b('0x28')][_0x734b('0x4d')]({'name':_0x4b70f2['name'],'resourceId':_0x4b70f2['id'],'type':_0x588ceb[_0x734b('0x2b')],'sectionId':_0x588ceb['id']},{})[_0x734b('0x24')](function(){return _0x171575;});}else{return _0x171575;}})[_0x734b('0x4c')](function(_0xe605be){logger['error'](_0x734b('0x55'),_0xe605be);throw _0xe605be;});}return _0x171575;})[_0x734b('0x24')](respondWithResult(_0x38125a,0xc9))[_0x734b('0x4c')](handleError(_0x38125a,null));};exports[_0x734b('0x56')]=function(_0x4b65bf,_0x27f0ff){if(_0x4b65bf['body']['id']){delete _0x4b65bf[_0x734b('0x4e')]['id'];}return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x4b65bf[_0x734b('0x48')]['id']}})['then'](handleEntityNotFound(_0x27f0ff,null))[_0x734b('0x24')](saveUpdates(_0x4b65bf[_0x734b('0x4e')],null))['then'](respondWithResult(_0x27f0ff,null))['catch'](handleError(_0x27f0ff,null));};exports[_0x734b('0x25')]=function(_0x577735,_0x16b461){return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x577735['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x16b461,null))['then'](removeEntity(_0x16b461,null))[_0x734b('0x4c')](handleError(_0x16b461,null));};exports[_0x734b('0x57')]=function(_0x3c3359,_0x10660d,_0x49a43b){return db[_0x734b('0x2f')]['findOne']({'where':{'id':_0x3c3359[_0x734b('0x48')]['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x10660d,null))[_0x734b('0x24')](function(_0x59b7d8){var _0x18e187;var _0x55c699={},_0x2c81a1={};_0x2c81a1[_0x734b('0x33')]=_[_0x734b('0x35')](db[_0x734b('0x58')]['rawAttributes']);_0x2c81a1[_0x734b('0x34')]=_['keys'](_0x3c3359[_0x734b('0x34')]);_0x2c81a1[_0x734b('0x36')]=_[_0x734b('0x37')](_0x2c81a1['model'],_0x2c81a1[_0x734b('0x34')]);_0x55c699[_0x734b('0x38')]=_[_0x734b('0x37')](_0x2c81a1[_0x734b('0x33')],qs[_0x734b('0x39')](_0x3c3359[_0x734b('0x34')][_0x734b('0x39')]));_0x55c699['attributes']=_0x55c699[_0x734b('0x38')][_0x734b('0x3a')]?_0x55c699[_0x734b('0x38')]:_0x2c81a1['model'];if(!_0x3c3359['query'][_0x734b('0x3b')](_0x734b('0x59'))){_0x55c699[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3c3359['query']['limit']);_0x55c699['offset']=qs[_0x734b('0x1b')](_0x3c3359[_0x734b('0x34')][_0x734b('0x1b')]);}_0x55c699[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x3c3359[_0x734b('0x34')][_0x734b('0x3d')]);_0x55c699[_0x734b('0x3e')]=qs[_0x734b('0x36')](_[_0x734b('0x3f')](_0x3c3359[_0x734b('0x34')],_0x2c81a1[_0x734b('0x36')]));if(_0x3c3359[_0x734b('0x34')][_0x734b('0x40')]){_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'$or':_[_0x734b('0x2e')](_0x55c699[_0x734b('0x38')],function(_0x39d4e7){var _0x379a33={};_0x379a33[_0x39d4e7]={'$like':'%'+_0x3c3359['query'][_0x734b('0x40')]+'%'};return _0x379a33;})});}_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'mailboxuser':_0x59b7d8[_0x734b('0x5a')]});_0x55c699=_['merge']({},_0x55c699,_0x3c3359[_0x734b('0x43')]);return db[_0x734b('0x58')][_0x734b('0x5b')](_0x55c699)[_0x734b('0x24')](respondWithFilteredResult(_0x10660d,_0x55c699));})[_0x734b('0x4c')](handleError(_0x10660d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 80901c0..a5a070d 100644 --- a/server/api/voiceMail/voiceMail.model.js +++ b/server/api/voiceMail/voiceMail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e87=['define','VoiceMail','voice_voicemail','mailbox_context','mailbox','util','../../config/logger','api','moment','bluebird','../../config/environment','./voiceMail.attributes'];(function(_0x116215,_0x1e73dd){var _0x581eb1=function(_0x2ed8dd){while(--_0x2ed8dd){_0x116215['push'](_0x116215['shift']());}};_0x581eb1(++_0x1e73dd);}(_0x0e87,0xb9));var _0x70e8=function(_0x147009,_0x59abc9){_0x147009=_0x147009-0x0;var _0x320dc2=_0x0e87[_0x147009];return _0x320dc2;};'use strict';var _=require('lodash');var util=require(_0x70e8('0x0'));var logger=require(_0x70e8('0x1'))(_0x70e8('0x2'));var moment=require(_0x70e8('0x3'));var BPromise=require(_0x70e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x70e8('0x5'));var attributes=require(_0x70e8('0x6'));module['exports']=function(_0x12a178,_0xbe62a){return _0x12a178[_0x70e8('0x7')](_0x70e8('0x8'),attributes,{'tableName':_0x70e8('0x9'),'paranoid':![],'indexes':[{'name':_0x70e8('0xa'),'fields':[_0x70e8('0xb'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xae14=['path','rimraf','../../config/environment','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c0fe2,_0x1838ed){var _0x4ff915=function(_0x280785){while(--_0x280785){_0x1c0fe2['push'](_0x1c0fe2['shift']());}};_0x4ff915(++_0x1838ed);}(_0xae14,0x78));var _0x4ae1=function(_0x160710,_0x250e9b){_0x160710=_0x160710-0x0;var _0x309b4b=_0xae14[_0x160710];return _0x309b4b;};'use strict';var _=require('lodash');var util=require(_0x4ae1('0x0'));var logger=require(_0x4ae1('0x1'))(_0x4ae1('0x2'));var moment=require(_0x4ae1('0x3'));var BPromise=require(_0x4ae1('0x4'));var rp=require(_0x4ae1('0x5'));var fs=require('fs');var path=require(_0x4ae1('0x6'));var rimraf=require(_0x4ae1('0x7'));var config=require(_0x4ae1('0x8'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x326be5,_0x2f4bef){return _0x326be5['define'](_0x4ae1('0x9'),attributes,{'tableName':_0x4ae1('0xa'),'paranoid':![],'indexes':[{'name':_0x4ae1('0xb'),'fields':[_0x4ae1('0xc'),_0x4ae1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 02ce2c4..3e413b7 100644 --- a/server/api/voiceMail/voiceMail.rpc.js +++ b/server/api/voiceMail/voiceMail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc011=['message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','code','error','VoiceMail,\x20%s,\x20%s'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xc011,0xb4));var _0x1c01=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xc011[_0x313c96];return _0x522f53;};'use strict';var _=require(_0x1c01('0x0'));var util=require(_0x1c01('0x1'));var moment=require(_0x1c01('0x2'));var BPromise=require('bluebird');var rs=require(_0x1c01('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c01('0x4'))['db'];var utils=require(_0x1c01('0x5'));var logger=require(_0x1c01('0x6'))(_0x1c01('0x7'));var config=require(_0x1c01('0x8'));var jayson=require(_0x1c01('0x9'));var client=jayson['client'][_0x1c01('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12f199,_0x17c44c,_0x34dbac){return new BPromise(function(_0x6c1943,_0x467316){return client[_0x1c01('0xb')](_0x12f199,_0x34dbac)[_0x1c01('0xc')](function(_0x9b1dd1){logger['info']('VoiceMail,\x20%s,\x20%s',_0x17c44c,_0x1c01('0xd'));logger[_0x1c01('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x17c44c,'request\x20sent',JSON['stringify'](_0x9b1dd1));if(_0x9b1dd1['error']){if(_0x9b1dd1['error'][_0x1c01('0xf')]===0x1f4){logger[_0x1c01('0x10')](_0x1c01('0x11'),_0x17c44c,_0x9b1dd1[_0x1c01('0x10')][_0x1c01('0x12')]);return _0x467316(_0x9b1dd1['error']['message']);}logger['error'](_0x1c01('0x11'),_0x17c44c,_0x9b1dd1[_0x1c01('0x10')]['message']);return _0x6c1943(_0x9b1dd1['error']['message']);}else{logger[_0x1c01('0x13')](_0x1c01('0x11'),_0x17c44c,'request\x20sent');_0x6c1943(_0x9b1dd1[_0x1c01('0x14')][_0x1c01('0x12')]);}})[_0x1c01('0x15')](function(_0xe02776){logger[_0x1c01('0x10')](_0x1c01('0x11'),_0x17c44c,_0xe02776);_0x467316(_0xe02776);});});} \ No newline at end of file +var _0xf68c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x300e76,_0x5be27d){var _0x1384d5=function(_0x4d14c6){while(--_0x4d14c6){_0x300e76['push'](_0x300e76['shift']());}};_0x1384d5(++_0x5be27d);}(_0xf68c,0xc6));var _0xcf68=function(_0xfb42cc,_0x48caa1){_0xfb42cc=_0xfb42cc-0x0;var _0x9179ca=_0xf68c[_0xfb42cc];return _0x9179ca;};'use strict';var _=require(_0xcf68('0x0'));var util=require(_0xcf68('0x1'));var moment=require(_0xcf68('0x2'));var BPromise=require(_0xcf68('0x3'));var rs=require(_0xcf68('0x4'));var fs=require('fs');var Redis=require(_0xcf68('0x5'));var db=require(_0xcf68('0x6'))['db'];var utils=require(_0xcf68('0x7'));var logger=require(_0xcf68('0x8'))(_0xcf68('0x9'));var config=require(_0xcf68('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcf68('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f976d,_0x2c7d26,_0x1e0adc){return new BPromise(function(_0x11cba3,_0x56c140){return client['request'](_0x2f976d,_0x1e0adc)['then'](function(_0x571a50){logger[_0xcf68('0xc')](_0xcf68('0xd'),_0x2c7d26,_0xcf68('0xe'));logger[_0xcf68('0xf')](_0xcf68('0x10'),_0x2c7d26,_0xcf68('0xe'),JSON['stringify'](_0x571a50));if(_0x571a50[_0xcf68('0x11')]){if(_0x571a50[_0xcf68('0x11')][_0xcf68('0x12')]===0x1f4){logger[_0xcf68('0x11')](_0xcf68('0xd'),_0x2c7d26,_0x571a50['error'][_0xcf68('0x13')]);return _0x56c140(_0x571a50['error']['message']);}logger['error'](_0xcf68('0xd'),_0x2c7d26,_0x571a50[_0xcf68('0x11')][_0xcf68('0x13')]);return _0x11cba3(_0x571a50['error'][_0xcf68('0x13')]);}else{logger[_0xcf68('0xc')]('VoiceMail,\x20%s,\x20%s',_0x2c7d26,_0xcf68('0xe'));_0x11cba3(_0x571a50[_0xcf68('0x14')][_0xcf68('0x13')]);}})[_0xcf68('0x15')](function(_0x762e2b){logger['error'](_0xcf68('0xd'),_0x2c7d26,_0x762e2b);_0x56c140(_0x762e2b);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 9d422b6..de1fa41 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e5a=['index','get','/:id','/:id/download','download','put','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','isAuthenticated'];(function(_0x3253f3,_0x1c57d8){var _0x598c26=function(_0x4c1251){while(--_0x4c1251){_0x3253f3['push'](_0x3253f3['shift']());}};_0x598c26(++_0x1c57d8);}(_0x5e5a,0x116));var _0xa5e5=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x5e5a[_0x565c49];return _0x20ca34;};'use strict';var multer=require('multer');var util=require(_0xa5e5('0x0'));var path=require(_0xa5e5('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5e5('0x2'));var router=express[_0xa5e5('0x3')]();var fs_extra=require(_0xa5e5('0x4'));var auth=require(_0xa5e5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0xa5e5('0x6')](),controller[_0xa5e5('0x7')]);router[_0xa5e5('0x8')](_0xa5e5('0x9'),auth[_0xa5e5('0x6')](),controller['show']);router['get'](_0xa5e5('0xa'),auth[_0xa5e5('0x6')](),controller[_0xa5e5('0xb')]);router['post']('/',auth[_0xa5e5('0x6')](),controller['create']);router[_0xa5e5('0xc')](_0xa5e5('0x9'),auth[_0xa5e5('0x6')](),controller['update']);router[_0xa5e5('0xd')](_0xa5e5('0x9'),auth[_0xa5e5('0x6')](),controller['destroy']);module[_0xa5e5('0xe')]=router; \ No newline at end of file +var _0x1fd2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','show','/:id/download','isAuthenticated','download','post','create','put','/:id','delete','util'];(function(_0x9a5f6f,_0x5036be){var _0x3bdaee=function(_0x427107){while(--_0x427107){_0x9a5f6f['push'](_0x9a5f6f['shift']());}};_0x3bdaee(++_0x5036be);}(_0x1fd2,0x1af));var _0x21fd=function(_0x3780f2,_0xa99c19){_0x3780f2=_0x3780f2-0x0;var _0xa1deb8=_0x1fd2[_0x3780f2];return _0xa1deb8;};'use strict';var multer=require('multer');var util=require(_0x21fd('0x0'));var path=require(_0x21fd('0x1'));var timeout=require(_0x21fd('0x2'));var express=require(_0x21fd('0x3'));var router=express[_0x21fd('0x4')]();var fs_extra=require(_0x21fd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x21fd('0x6'));var config=require(_0x21fd('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x21fd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x21fd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x21fd('0x9')]);router[_0x21fd('0x8')](_0x21fd('0xa'),auth[_0x21fd('0xb')](),controller[_0x21fd('0xc')]);router[_0x21fd('0xd')]('/',auth[_0x21fd('0xb')](),controller[_0x21fd('0xe')]);router[_0x21fd('0xf')](_0x21fd('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x21fd('0x11')](_0x21fd('0x10'),auth[_0x21fd('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 34a234d..30ed195 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.attributes.js +++ b/server/api/voiceMailMessage/voiceMailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a98=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3a98,0x1b4));var _0x83a9=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x3a98[_0xaa6a4];return _0xdc31a4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5bfe64){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x83a9('0x0')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x83a9('0x1')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x83a9('0x1')],'defaultValue':''},'callerid':{'type':Sequelize[_0x83a9('0x1')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x83a9('0x1')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x83a9('0x1')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x83a9('0x1')],'defaultValue':''},'recording':{'type':Sequelize[_0x83a9('0x2')](_0x83a9('0x3')),'defaultValue':null},'flag':{'type':Sequelize[_0x83a9('0x1')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x83a9('0x1')],'defaultValue':''},'stamp':{'type':_0x83a9('0x4'),'defaultValue':Sequelize[_0x83a9('0x5')](_0x83a9('0x6'))}}; \ No newline at end of file +var _0xbdd4=['VIRTUAL','getDataValue','STRING','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports'];(function(_0xb230e4,_0x1ee46b){var _0x279a55=function(_0x55f19a){while(--_0x55f19a){_0xb230e4['push'](_0xb230e4['shift']());}};_0x279a55(++_0x1ee46b);}(_0xbdd4,0x125));var _0x4bdd=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xbdd4[_0x1eda20];return _0x31b953;};'use strict';var Sequelize=require('sequelize');module[_0x4bdd('0x0')]={'name':{'type':Sequelize[_0x4bdd('0x1')],'get':function(_0x1168ad){return this[_0x4bdd('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x4bdd('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x4bdd('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x4bdd('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4bdd('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x4bdd('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x4bdd('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x4bdd('0x5'),'defaultValue':Sequelize['literal'](_0x4bdd('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 6a8c1cf..89be8c4 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.controller.js +++ b/server/api/voiceMailMessage/voiceMailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xddc6=['undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','show','length','includeAll','options','create','body','find','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset'];(function(_0x5e35e1,_0x7d86d6){var _0x320fe8=function(_0x509d95){while(--_0x509d95){_0x5e35e1['push'](_0x5e35e1['shift']());}};_0x320fe8(++_0x7d86d6);}(_0xddc6,0x13d));var _0x6ddc=function(_0x39ac93,_0x36229f){_0x39ac93=_0x39ac93-0x0;var _0x14dfd7=_0xddc6[_0x39ac93];return _0x14dfd7;};'use strict';var emlformat=require(_0x6ddc('0x0'));var rimraf=require(_0x6ddc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ddc('0x2'));var rp=require(_0x6ddc('0x3'));var moment=require(_0x6ddc('0x4'));var BPromise=require(_0x6ddc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6ddc('0x6'));var sox=require('sox');var csv=require(_0x6ddc('0x7'));var ejs=require(_0x6ddc('0x8'));var fs=require('fs');var fs_extra=require(_0x6ddc('0x9'));var _=require(_0x6ddc('0xa'));var squel=require(_0x6ddc('0xb'));var crypto=require(_0x6ddc('0xc'));var jsforce=require(_0x6ddc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6ddc('0x7'));var querystring=require(_0x6ddc('0xe'));var Papa=require(_0x6ddc('0xf'));var Redis=require(_0x6ddc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6ddc('0x11'));var hardwareService=require(_0x6ddc('0x12'));var logger=require(_0x6ddc('0x13'))(_0x6ddc('0x14'));var utils=require(_0x6ddc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6ddc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x459418,_0x26367c){_0x26367c=_0x26367c||0xcc;return function(_0x22f3df){if(_0x22f3df){return _0x459418[_0x6ddc('0x17')](_0x26367c);}return _0x459418[_0x6ddc('0x18')](_0x26367c)[_0x6ddc('0x19')]();};}function respondWithResult(_0x55c0c5,_0x1645ed){_0x1645ed=_0x1645ed||0xc8;return function(_0x489bbf){if(_0x489bbf){return _0x55c0c5['status'](_0x1645ed)['json'](_0x489bbf);}};}function respondWithFilteredResult(_0x585818,_0x461785){return function(_0x40f7f2){if(_0x40f7f2){var _0x45a135=typeof _0x461785[_0x6ddc('0x1a')]===_0x6ddc('0x1b')&&typeof _0x461785[_0x6ddc('0x1c')]===_0x6ddc('0x1b');var _0x26aa9d=_0x40f7f2['count'];var _0x22e7a0=_0x45a135?0x0:_0x461785[_0x6ddc('0x1a')];var _0x41adf1=_0x45a135?_0x40f7f2['count']:_0x461785[_0x6ddc('0x1a')]+_0x461785[_0x6ddc('0x1c')];var _0x2a9bb5;if(_0x41adf1>=_0x26aa9d){_0x41adf1=_0x26aa9d;_0x2a9bb5=0xc8;}else{_0x2a9bb5=0xce;}_0x585818['status'](_0x2a9bb5);return _0x585818[_0x6ddc('0x1d')](_0x6ddc('0x1e'),_0x22e7a0+'-'+_0x41adf1+'/'+_0x26aa9d)[_0x6ddc('0x1f')](_0x40f7f2);}return null;};}function patchUpdates(_0x48fca9){return function(_0x451b18){try{jsonpatch[_0x6ddc('0x20')](_0x451b18,_0x48fca9,!![]);}catch(_0x3f3218){return BPromise[_0x6ddc('0x21')](_0x3f3218);}return _0x451b18[_0x6ddc('0x22')]();};}function saveUpdates(_0x28af81,_0x34748f){return function(_0x5a6a7f){if(_0x5a6a7f){return _0x5a6a7f[_0x6ddc('0x23')](_0x28af81)['then'](function(_0x10197f){return _0x10197f;});}return null;};}function removeEntity(_0x38a8af,_0x498349){return function(_0x3dca03){if(_0x3dca03){return _0x3dca03[_0x6ddc('0x24')]()[_0x6ddc('0x25')](function(){_0x38a8af[_0x6ddc('0x18')](0xcc)[_0x6ddc('0x19')]();});}};}function handleEntityNotFound(_0x1489cd,_0x17a646){return function(_0x59c3dc){if(!_0x59c3dc){_0x1489cd[_0x6ddc('0x17')](0x194);}return _0x59c3dc;};}function handleError(_0x338818,_0x182399){_0x182399=_0x182399||0x1f4;return function(_0x41fcfe){logger['error'](_0x41fcfe[_0x6ddc('0x26')]);if(_0x41fcfe['name']){delete _0x41fcfe['name'];}_0x338818[_0x6ddc('0x18')](_0x182399)[_0x6ddc('0x27')](_0x41fcfe);};}exports[_0x6ddc('0x28')]=function(_0x322805,_0x18075e){var _0x4068ea={},_0x4de2cf={},_0x3afd2c={'count':0x0,'rows':[]};var _0x69b6a5=_[_0x6ddc('0x29')](db[_0x6ddc('0x2a')][_0x6ddc('0x2b')],function(_0x7ee152){return{'name':_0x7ee152[_0x6ddc('0x2c')],'type':_0x7ee152[_0x6ddc('0x2d')][_0x6ddc('0x2e')]};});_0x4de2cf[_0x6ddc('0x2f')]=_['differenceBy'](_['map'](_0x69b6a5,_0x6ddc('0x30')),[_0x6ddc('0x30')]);_0x4de2cf[_0x6ddc('0x31')]=_[_0x6ddc('0x32')](_0x322805[_0x6ddc('0x31')]);_0x4de2cf[_0x6ddc('0x33')]=_[_0x6ddc('0x34')](_0x4de2cf[_0x6ddc('0x2f')],_0x4de2cf[_0x6ddc('0x31')]);_0x4068ea[_0x6ddc('0x35')]=_[_0x6ddc('0x34')](_0x4de2cf[_0x6ddc('0x2f')],qs[_0x6ddc('0x36')](_0x322805[_0x6ddc('0x31')][_0x6ddc('0x36')]));_0x4068ea[_0x6ddc('0x35')]=_0x4068ea['attributes']['length']?_0x4068ea[_0x6ddc('0x35')]:_0x4de2cf[_0x6ddc('0x2f')];if(!_0x322805[_0x6ddc('0x31')][_0x6ddc('0x37')]('nolimit')){_0x4068ea['limit']=qs['limit'](_0x322805[_0x6ddc('0x31')][_0x6ddc('0x1c')]);_0x4068ea['offset']=qs[_0x6ddc('0x1a')](_0x322805['query']['offset']);}_0x4068ea[_0x6ddc('0x38')]=qs[_0x6ddc('0x39')](_0x322805['query'][_0x6ddc('0x39')]);_0x4068ea[_0x6ddc('0x3a')]=qs['filters'](_[_0x6ddc('0x3b')](_0x322805[_0x6ddc('0x31')],_0x4de2cf[_0x6ddc('0x33')]),_0x69b6a5);if(_0x322805[_0x6ddc('0x31')][_0x6ddc('0x3c')]){_0x4068ea[_0x6ddc('0x3a')]=_[_0x6ddc('0x3d')](_0x4068ea[_0x6ddc('0x3a')],{'$or':_['map'](_0x69b6a5,function(_0x2c615b){if(_0x2c615b[_0x6ddc('0x2d')]!==_0x6ddc('0x3e')){var _0x4ee10a={};_0x4ee10a[_0x2c615b['name']]={'$like':'%'+_0x322805['query'][_0x6ddc('0x3c')]+'%'};return _0x4ee10a;}})});}_0x4068ea=_['merge']({},_0x4068ea,_0x322805['options']);var _0x12e9c3={'where':_0x4068ea[_0x6ddc('0x3a')]};return db[_0x6ddc('0x2a')][_0x6ddc('0x3f')](_0x12e9c3)[_0x6ddc('0x25')](function(_0x36f544){_0x3afd2c['count']=_0x36f544;if(_0x322805['query']['includeAll']){_0x4068ea[_0x6ddc('0x40')]=[{'all':!![]}];}return db[_0x6ddc('0x2a')][_0x6ddc('0x41')](_0x4068ea);})[_0x6ddc('0x25')](function(_0x3054dc){_0x3afd2c[_0x6ddc('0x42')]=_0x3054dc;return _0x3afd2c;})[_0x6ddc('0x25')](respondWithFilteredResult(_0x18075e,_0x4068ea))[_0x6ddc('0x43')](handleError(_0x18075e,null));};exports[_0x6ddc('0x44')]=function(_0xf56add,_0x3f36bc){var _0x152acf={'raw':!![],'where':{'id':_0xf56add['params']['id']}},_0x489050={};_0x489050[_0x6ddc('0x2f')]=_[_0x6ddc('0x32')](db[_0x6ddc('0x2a')]['rawAttributes']);_0x489050['query']=_[_0x6ddc('0x32')](_0xf56add[_0x6ddc('0x31')]);_0x489050[_0x6ddc('0x33')]=_[_0x6ddc('0x34')](_0x489050[_0x6ddc('0x2f')],_0x489050[_0x6ddc('0x31')]);_0x152acf[_0x6ddc('0x35')]=_['intersection'](_0x489050[_0x6ddc('0x2f')],qs[_0x6ddc('0x36')](_0xf56add[_0x6ddc('0x31')][_0x6ddc('0x36')]));_0x152acf[_0x6ddc('0x35')]=_0x152acf['attributes'][_0x6ddc('0x45')]?_0x152acf[_0x6ddc('0x35')]:_0x489050[_0x6ddc('0x2f')];if(_0xf56add[_0x6ddc('0x31')][_0x6ddc('0x46')]){_0x152acf[_0x6ddc('0x40')]=[{'all':!![]}];}_0x152acf=_[_0x6ddc('0x3d')]({},_0x152acf,_0xf56add[_0x6ddc('0x47')]);return db['VoiceMailMessage']['find'](_0x152acf)[_0x6ddc('0x25')](handleEntityNotFound(_0x3f36bc,null))['then'](respondWithResult(_0x3f36bc,null))['catch'](handleError(_0x3f36bc,null));};exports[_0x6ddc('0x48')]=function(_0x4a3e2e,_0x1a09e0){return db[_0x6ddc('0x2a')]['create'](_0x4a3e2e['body'],{})['then'](respondWithResult(_0x1a09e0,0xc9))[_0x6ddc('0x43')](handleError(_0x1a09e0,null));};exports['update']=function(_0x296bb1,_0x28f2f5){if(_0x296bb1[_0x6ddc('0x49')]['id']){delete _0x296bb1[_0x6ddc('0x49')]['id'];}return db[_0x6ddc('0x2a')][_0x6ddc('0x4a')]({'where':{'id':_0x296bb1[_0x6ddc('0x4b')]['id']}})[_0x6ddc('0x25')](handleEntityNotFound(_0x28f2f5,null))[_0x6ddc('0x25')](saveUpdates(_0x296bb1[_0x6ddc('0x49')],null))[_0x6ddc('0x25')](respondWithResult(_0x28f2f5,null))[_0x6ddc('0x43')](handleError(_0x28f2f5,null));};exports[_0x6ddc('0x24')]=function(_0x21409b,_0x179b25){return db['VoiceMailMessage'][_0x6ddc('0x4a')]({'where':{'id':_0x21409b['params']['id']}})[_0x6ddc('0x25')](handleEntityNotFound(_0x179b25,null))[_0x6ddc('0x25')](removeEntity(_0x179b25,null))['catch'](handleError(_0x179b25,null));};exports[_0x6ddc('0x4c')]=function(_0x4e7006,_0x547482,_0x21038b){return db[_0x6ddc('0x2a')][_0x6ddc('0x4a')]({'where':{'id':_0x4e7006[_0x6ddc('0x4b')]['id']},'attributes':['id',_0x6ddc('0x4d'),_0x6ddc('0x4e')]})[_0x6ddc('0x25')](handleEntityNotFound(_0x547482,null))['then'](function(_0x3c552c){if(_0x3c552c){if(!_0x3c552c[_0x6ddc('0x4d')]){throw new db[(_0x6ddc('0x4f'))]['ValidationError'](_0x6ddc('0x50'));}var _0xa57831={'Content-Type':_0x6ddc('0x51'),'Content-Disposition':_0x6ddc('0x52')};if(_0x3c552c[_0x6ddc('0x4e')]){_0xa57831[_0x6ddc('0x53')]=_0x6ddc('0x54')+_0x3c552c[_0x6ddc('0x4e')]+_0x6ddc('0x55');}_0x547482[_0x6ddc('0x1d')](_0xa57831);return _0x547482[_0x6ddc('0x27')](new Buffer(_0x3c552c['recording']));}})['catch'](handleError(_0x547482,null));}; \ No newline at end of file +var _0x3b6b=['limit','set','apply','reject','save','update','destroy','then','stack','name','send','map','VoiceMailMessage','fieldName','type','key','differenceBy','query','filters','intersection','model','attributes','fields','nolimit','order','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','keys','rawAttributes','length','includeAll','find','body','params','download','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x3b6b,0xcf));var _0xb3b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b6b[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb3b6('0x0'));var rimraf=require(_0xb3b6('0x1'));var zipdir=require(_0xb3b6('0x2'));var jsonpatch=require(_0xb3b6('0x3'));var rp=require(_0xb3b6('0x4'));var moment=require('moment');var BPromise=require(_0xb3b6('0x5'));var Mustache=require('mustache');var util=require(_0xb3b6('0x6'));var path=require(_0xb3b6('0x7'));var sox=require(_0xb3b6('0x8'));var csv=require(_0xb3b6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3b6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb3b6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb3b6('0xc'));var toCsv=require(_0xb3b6('0x9'));var querystring=require(_0xb3b6('0xd'));var Papa=require('papaparse');var Redis=require(_0xb3b6('0xe'));var authService=require(_0xb3b6('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3b6('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xb3b6('0x11'));var config=require(_0xb3b6('0x12'));var licenseUtil=require(_0xb3b6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a374a,_0x35512a){_0x35512a=_0x35512a||0xcc;return function(_0x2fcd55){if(_0x2fcd55){return _0x2a374a[_0xb3b6('0x14')](_0x35512a);}return _0x2a374a[_0xb3b6('0x15')](_0x35512a)[_0xb3b6('0x16')]();};}function respondWithResult(_0x103d35,_0xac9a8f){_0xac9a8f=_0xac9a8f||0xc8;return function(_0x32e070){if(_0x32e070){return _0x103d35['status'](_0xac9a8f)[_0xb3b6('0x17')](_0x32e070);}};}function respondWithFilteredResult(_0x4494bd,_0x4e6af5){return function(_0x256c7c){if(_0x256c7c){var _0x4e272e=typeof _0x4e6af5[_0xb3b6('0x18')]===_0xb3b6('0x19')&&typeof _0x4e6af5['limit']===_0xb3b6('0x19');var _0x3ae19e=_0x256c7c[_0xb3b6('0x1a')];var _0x2c7630=_0x4e272e?0x0:_0x4e6af5['offset'];var _0x1e260b=_0x4e272e?_0x256c7c[_0xb3b6('0x1a')]:_0x4e6af5['offset']+_0x4e6af5[_0xb3b6('0x1b')];var _0x4a1d77;if(_0x1e260b>=_0x3ae19e){_0x1e260b=_0x3ae19e;_0x4a1d77=0xc8;}else{_0x4a1d77=0xce;}_0x4494bd[_0xb3b6('0x15')](_0x4a1d77);return _0x4494bd[_0xb3b6('0x1c')]('Content-Range',_0x2c7630+'-'+_0x1e260b+'/'+_0x3ae19e)['json'](_0x256c7c);}return null;};}function patchUpdates(_0x4c89d3){return function(_0x1a84ce){try{jsonpatch[_0xb3b6('0x1d')](_0x1a84ce,_0x4c89d3,!![]);}catch(_0x3ee4e3){return BPromise[_0xb3b6('0x1e')](_0x3ee4e3);}return _0x1a84ce[_0xb3b6('0x1f')]();};}function saveUpdates(_0x23de8b,_0x512ef8){return function(_0x6f24a2){if(_0x6f24a2){return _0x6f24a2[_0xb3b6('0x20')](_0x23de8b)['then'](function(_0x2575e4){return _0x2575e4;});}return null;};}function removeEntity(_0xe16cf7,_0x54bd2f){return function(_0x3a1be1){if(_0x3a1be1){return _0x3a1be1[_0xb3b6('0x21')]()[_0xb3b6('0x22')](function(){_0xe16cf7['status'](0xcc)[_0xb3b6('0x16')]();});}};}function handleEntityNotFound(_0x1a9c2b,_0x2747f8){return function(_0x222fbd){if(!_0x222fbd){_0x1a9c2b[_0xb3b6('0x14')](0x194);}return _0x222fbd;};}function handleError(_0x3a0115,_0xeef7d7){_0xeef7d7=_0xeef7d7||0x1f4;return function(_0x872168){logger['error'](_0x872168[_0xb3b6('0x23')]);if(_0x872168[_0xb3b6('0x24')]){delete _0x872168[_0xb3b6('0x24')];}_0x3a0115[_0xb3b6('0x15')](_0xeef7d7)[_0xb3b6('0x25')](_0x872168);};}exports['index']=function(_0x1ab88f,_0x3efa9e){var _0x30199e={},_0x177d3f={},_0x52ad07={'count':0x0,'rows':[]};var _0x2f4b08=_[_0xb3b6('0x26')](db[_0xb3b6('0x27')]['rawAttributes'],function(_0x171106){return{'name':_0x171106[_0xb3b6('0x28')],'type':_0x171106[_0xb3b6('0x29')][_0xb3b6('0x2a')]};});_0x177d3f['model']=_[_0xb3b6('0x2b')](_['map'](_0x2f4b08,_0xb3b6('0x24')),[_0xb3b6('0x24')]);_0x177d3f[_0xb3b6('0x2c')]=_['keys'](_0x1ab88f[_0xb3b6('0x2c')]);_0x177d3f[_0xb3b6('0x2d')]=_[_0xb3b6('0x2e')](_0x177d3f[_0xb3b6('0x2f')],_0x177d3f[_0xb3b6('0x2c')]);_0x30199e[_0xb3b6('0x30')]=_[_0xb3b6('0x2e')](_0x177d3f[_0xb3b6('0x2f')],qs[_0xb3b6('0x31')](_0x1ab88f[_0xb3b6('0x2c')][_0xb3b6('0x31')]));_0x30199e['attributes']=_0x30199e[_0xb3b6('0x30')]['length']?_0x30199e[_0xb3b6('0x30')]:_0x177d3f['model'];if(!_0x1ab88f['query']['hasOwnProperty'](_0xb3b6('0x32'))){_0x30199e[_0xb3b6('0x1b')]=qs[_0xb3b6('0x1b')](_0x1ab88f[_0xb3b6('0x2c')]['limit']);_0x30199e[_0xb3b6('0x18')]=qs[_0xb3b6('0x18')](_0x1ab88f[_0xb3b6('0x2c')][_0xb3b6('0x18')]);}_0x30199e[_0xb3b6('0x33')]=qs['sort'](_0x1ab88f[_0xb3b6('0x2c')]['sort']);_0x30199e['where']=qs[_0xb3b6('0x2d')](_[_0xb3b6('0x34')](_0x1ab88f[_0xb3b6('0x2c')],_0x177d3f['filters']),_0x2f4b08);if(_0x1ab88f[_0xb3b6('0x2c')][_0xb3b6('0x35')]){_0x30199e[_0xb3b6('0x36')]=_['merge'](_0x30199e[_0xb3b6('0x36')],{'$or':_[_0xb3b6('0x26')](_0x2f4b08,function(_0x585d71){if(_0x585d71[_0xb3b6('0x29')]!==_0xb3b6('0x37')){var _0x2e1891={};_0x2e1891[_0x585d71[_0xb3b6('0x24')]]={'$like':'%'+_0x1ab88f[_0xb3b6('0x2c')][_0xb3b6('0x35')]+'%'};return _0x2e1891;}})});}_0x30199e=_[_0xb3b6('0x38')]({},_0x30199e,_0x1ab88f[_0xb3b6('0x39')]);var _0x4b5595={'where':_0x30199e['where']};return db[_0xb3b6('0x27')]['count'](_0x4b5595)[_0xb3b6('0x22')](function(_0x347eb0){_0x52ad07[_0xb3b6('0x1a')]=_0x347eb0;if(_0x1ab88f['query']['includeAll']){_0x30199e[_0xb3b6('0x3a')]=[{'all':!![]}];}return db[_0xb3b6('0x27')][_0xb3b6('0x3b')](_0x30199e);})[_0xb3b6('0x22')](function(_0x1ef801){_0x52ad07[_0xb3b6('0x3c')]=_0x1ef801;return _0x52ad07;})[_0xb3b6('0x22')](respondWithFilteredResult(_0x3efa9e,_0x30199e))[_0xb3b6('0x3d')](handleError(_0x3efa9e,null));};exports[_0xb3b6('0x3e')]=function(_0x3b7c29,_0x210144){var _0x51391b={'raw':!![],'where':{'id':_0x3b7c29['params']['id']}},_0x28b57e={};_0x28b57e[_0xb3b6('0x2f')]=_[_0xb3b6('0x3f')](db[_0xb3b6('0x27')][_0xb3b6('0x40')]);_0x28b57e[_0xb3b6('0x2c')]=_[_0xb3b6('0x3f')](_0x3b7c29[_0xb3b6('0x2c')]);_0x28b57e[_0xb3b6('0x2d')]=_[_0xb3b6('0x2e')](_0x28b57e['model'],_0x28b57e['query']);_0x51391b['attributes']=_[_0xb3b6('0x2e')](_0x28b57e[_0xb3b6('0x2f')],qs[_0xb3b6('0x31')](_0x3b7c29[_0xb3b6('0x2c')][_0xb3b6('0x31')]));_0x51391b[_0xb3b6('0x30')]=_0x51391b['attributes'][_0xb3b6('0x41')]?_0x51391b[_0xb3b6('0x30')]:_0x28b57e[_0xb3b6('0x2f')];if(_0x3b7c29[_0xb3b6('0x2c')][_0xb3b6('0x42')]){_0x51391b[_0xb3b6('0x3a')]=[{'all':!![]}];}_0x51391b=_['merge']({},_0x51391b,_0x3b7c29['options']);return db[_0xb3b6('0x27')][_0xb3b6('0x43')](_0x51391b)['then'](handleEntityNotFound(_0x210144,null))[_0xb3b6('0x22')](respondWithResult(_0x210144,null))[_0xb3b6('0x3d')](handleError(_0x210144,null));};exports['create']=function(_0x363024,_0x576987){return db[_0xb3b6('0x27')]['create'](_0x363024[_0xb3b6('0x44')],{})['then'](respondWithResult(_0x576987,0xc9))['catch'](handleError(_0x576987,null));};exports[_0xb3b6('0x20')]=function(_0x14ab4f,_0x1ecb78){if(_0x14ab4f[_0xb3b6('0x44')]['id']){delete _0x14ab4f[_0xb3b6('0x44')]['id'];}return db[_0xb3b6('0x27')][_0xb3b6('0x43')]({'where':{'id':_0x14ab4f[_0xb3b6('0x45')]['id']}})[_0xb3b6('0x22')](handleEntityNotFound(_0x1ecb78,null))[_0xb3b6('0x22')](saveUpdates(_0x14ab4f[_0xb3b6('0x44')],null))[_0xb3b6('0x22')](respondWithResult(_0x1ecb78,null))['catch'](handleError(_0x1ecb78,null));};exports[_0xb3b6('0x21')]=function(_0x86d71,_0x2b42c9){return db[_0xb3b6('0x27')][_0xb3b6('0x43')]({'where':{'id':_0x86d71[_0xb3b6('0x45')]['id']}})[_0xb3b6('0x22')](handleEntityNotFound(_0x2b42c9,null))['then'](removeEntity(_0x2b42c9,null))[_0xb3b6('0x3d')](handleError(_0x2b42c9,null));};exports[_0xb3b6('0x46')]=function(_0x4a92fb,_0x3d7dbc,_0x3e741b){return db[_0xb3b6('0x27')][_0xb3b6('0x43')]({'where':{'id':_0x4a92fb[_0xb3b6('0x45')]['id']},'attributes':['id','recording','msg_id']})[_0xb3b6('0x22')](handleEntityNotFound(_0x3d7dbc,null))[_0xb3b6('0x22')](function(_0xfd6d49){if(_0xfd6d49){if(!_0xfd6d49['recording']){throw new db['Sequelize'][(_0xb3b6('0x47'))](_0xb3b6('0x48'));}var _0x7db319={'Content-Type':_0xb3b6('0x49'),'Content-Disposition':'attachment'};if(_0xfd6d49[_0xb3b6('0x4a')]){_0x7db319[_0xb3b6('0x4b')]=_0xb3b6('0x4c')+_0xfd6d49[_0xb3b6('0x4a')]+_0xb3b6('0x4d');}_0x3d7dbc['set'](_0x7db319);return _0x3d7dbc[_0xb3b6('0x25')](new Buffer(_0xfd6d49['recording']));}})[_0xb3b6('0x3d')](handleError(_0x3d7dbc,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f731fa5..de1769c 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.model.js +++ b/server/api/voiceMailMessage/voiceMailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81c3=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x35ba9f,_0x14ea0d){var _0x5b8a5b=function(_0x4e516d){while(--_0x4e516d){_0x35ba9f['push'](_0x35ba9f['shift']());}};_0x5b8a5b(++_0x14ea0d);}(_0x81c3,0xbc));var _0x381c=function(_0x47d2e0,_0x220163){_0x47d2e0=_0x47d2e0-0x0;var _0x531de1=_0x81c3[_0x47d2e0];return _0x531de1;};'use strict';var _=require(_0x381c('0x0'));var util=require('util');var logger=require(_0x381c('0x1'))(_0x381c('0x2'));var moment=require(_0x381c('0x3'));var BPromise=require(_0x381c('0x4'));var rp=require(_0x381c('0x5'));var fs=require('fs');var path=require(_0x381c('0x6'));var rimraf=require(_0x381c('0x7'));var config=require(_0x381c('0x8'));var attributes=require(_0x381c('0x9'));module[_0x381c('0xa')]=function(_0x3021b3,_0xb9e35f){return _0x3021b3[_0x381c('0xb')](_0x381c('0xc'),attributes,{'tableName':_0x381c('0xd'),'paranoid':![],'indexes':[{'name':_0x381c('0xe'),'fields':[_0x381c('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc0c6=['rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0c6,0x1db));var _0x6c0c=function(_0x2154e7,_0x195446){_0x2154e7=_0x2154e7-0x0;var _0x462859=_0xc0c6[_0x2154e7];return _0x462859;};'use strict';var _=require(_0x6c0c('0x0'));var util=require(_0x6c0c('0x1'));var logger=require('../../config/logger')(_0x6c0c('0x2'));var moment=require(_0x6c0c('0x3'));var BPromise=require(_0x6c0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c0c('0x5'));var rimraf=require(_0x6c0c('0x6'));var config=require(_0x6c0c('0x7'));var attributes=require(_0x6c0c('0x8'));module['exports']=function(_0x51797f,_0x1b8c78){return _0x51797f[_0x6c0c('0x9')](_0x6c0c('0xa'),attributes,{'tableName':_0x6c0c('0xb'),'paranoid':![],'indexes':[{'name':_0x6c0c('0xc'),'fields':[_0x6c0c('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 851489c..82290a2 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfcc=['message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x21cf6e,_0x172b39){var _0x2c3d7f=function(_0x159d43){while(--_0x159d43){_0x21cf6e['push'](_0x21cf6e['shift']());}};_0x2c3d7f(++_0x172b39);}(_0xdfcc,0xbe));var _0xcdfc=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xdfcc[_0x1c510a];return _0x23cedd;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var moment=require(_0xcdfc('0x2'));var BPromise=require(_0xcdfc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdfc('0x4'));var db=require(_0xcdfc('0x5'))['db'];var utils=require(_0xcdfc('0x6'));var logger=require(_0xcdfc('0x7'))(_0xcdfc('0x8'));var config=require(_0xcdfc('0x9'));var jayson=require(_0xcdfc('0xa'));var client=jayson[_0xcdfc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42a935,_0x59f275,_0x55c531){return new BPromise(function(_0x239a79,_0x1aed0d){return client[_0xcdfc('0xc')](_0x42a935,_0x55c531)[_0xcdfc('0xd')](function(_0x6587d4){logger[_0xcdfc('0xe')](_0xcdfc('0xf'),_0x59f275,_0xcdfc('0x10'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x59f275,'request\x20sent',JSON[_0xcdfc('0x11')](_0x6587d4));if(_0x6587d4['error']){if(_0x6587d4[_0xcdfc('0x12')][_0xcdfc('0x13')]===0x1f4){logger[_0xcdfc('0x12')](_0xcdfc('0xf'),_0x59f275,_0x6587d4[_0xcdfc('0x12')][_0xcdfc('0x14')]);return _0x1aed0d(_0x6587d4[_0xcdfc('0x12')][_0xcdfc('0x14')]);}logger[_0xcdfc('0x12')](_0xcdfc('0xf'),_0x59f275,_0x6587d4[_0xcdfc('0x12')][_0xcdfc('0x14')]);return _0x239a79(_0x6587d4[_0xcdfc('0x12')][_0xcdfc('0x14')]);}else{logger[_0xcdfc('0xe')](_0xcdfc('0xf'),_0x59f275,_0xcdfc('0x10'));_0x239a79(_0x6587d4['result'][_0xcdfc('0x14')]);}})['catch'](function(_0x564355){logger[_0xcdfc('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x59f275,_0x564355);_0x1aed0d(_0x564355);});});} \ No newline at end of file +var _0x48ac=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x3d17ff,_0x20fde6){var _0xad17a7=function(_0x57c97c){while(--_0x57c97c){_0x3d17ff['push'](_0x3d17ff['shift']());}};_0xad17a7(++_0x20fde6);}(_0x48ac,0x151));var _0xc48a=function(_0x44720a,_0x59fe9a){_0x44720a=_0x44720a-0x0;var _0xfffc20=_0x48ac[_0x44720a];return _0xfffc20;};'use strict';var _=require(_0xc48a('0x0'));var util=require(_0xc48a('0x1'));var moment=require(_0xc48a('0x2'));var BPromise=require('bluebird');var rs=require(_0xc48a('0x3'));var fs=require('fs');var Redis=require(_0xc48a('0x4'));var db=require(_0xc48a('0x5'))['db'];var utils=require(_0xc48a('0x6'));var logger=require('../../config/logger')(_0xc48a('0x7'));var config=require(_0xc48a('0x8'));var jayson=require(_0xc48a('0x9'));var client=jayson['client'][_0xc48a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8aaebd,_0x5d1743,_0x1b3cd5){return new BPromise(function(_0x13c8c7,_0x1713ab){return client['request'](_0x8aaebd,_0x1b3cd5)[_0xc48a('0xb')](function(_0x2adc73){logger['info'](_0xc48a('0xc'),_0x5d1743,_0xc48a('0xd'));logger['debug'](_0xc48a('0xe'),_0x5d1743,_0xc48a('0xd'),JSON[_0xc48a('0xf')](_0x2adc73));if(_0x2adc73['error']){if(_0x2adc73[_0xc48a('0x10')][_0xc48a('0x11')]===0x1f4){logger[_0xc48a('0x10')](_0xc48a('0xc'),_0x5d1743,_0x2adc73[_0xc48a('0x10')][_0xc48a('0x12')]);return _0x1713ab(_0x2adc73['error'][_0xc48a('0x12')]);}logger[_0xc48a('0x10')](_0xc48a('0xc'),_0x5d1743,_0x2adc73[_0xc48a('0x10')][_0xc48a('0x12')]);return _0x13c8c7(_0x2adc73[_0xc48a('0x10')][_0xc48a('0x12')]);}else{logger['info'](_0xc48a('0xc'),_0x5d1743,_0xc48a('0xd'));_0x13c8c7(_0x2adc73[_0xc48a('0x13')][_0xc48a('0x12')]);}})['catch'](function(_0x1fe786){logger['error'](_0xc48a('0xc'),_0x5d1743,_0x1fe786);_0x1713ab(_0x1fe786);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f9bb521..30689ed 100644 --- a/server/api/voiceMusicOnHold/index.js +++ b/server/api/voiceMusicOnHold/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba3f=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','/:id/sounds','update','delete','/:id/sounds/:id2','removeSound','exports','multer'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xba3f,0x16f));var _0xfba3=function(_0x537a03,_0x2f43f6){_0x537a03=_0x537a03-0x0;var _0x52a258=_0xba3f[_0x537a03];return _0x52a258;};'use strict';var multer=require(_0xfba3('0x0'));var util=require(_0xfba3('0x1'));var path=require(_0xfba3('0x2'));var timeout=require(_0xfba3('0x3'));var express=require('express');var router=express[_0xfba3('0x4')]();var fs_extra=require(_0xfba3('0x5'));var auth=require(_0xfba3('0x6'));var interaction=require(_0xfba3('0x7'));var config=require(_0xfba3('0x8'));var controller=require(_0xfba3('0x9'));router[_0xfba3('0xa')]('/',auth[_0xfba3('0xb')](),controller[_0xfba3('0xc')]);router[_0xfba3('0xa')](_0xfba3('0xd'),auth[_0xfba3('0xb')](),controller[_0xfba3('0xe')]);router['get']('/:id/sounds',auth[_0xfba3('0xb')](),controller[_0xfba3('0xf')]);router[_0xfba3('0x10')]('/',auth[_0xfba3('0xb')](),controller['create']);router['post'](_0xfba3('0x11'),auth[_0xfba3('0xb')](),controller['addSound']);router['put'](_0xfba3('0xd'),auth[_0xfba3('0xb')](),controller[_0xfba3('0x12')]);router[_0xfba3('0x13')](_0xfba3('0xd'),auth[_0xfba3('0xb')](),controller['destroy']);router[_0xfba3('0x13')](_0xfba3('0x14'),auth['isAuthenticated'](),controller[_0xfba3('0x15')]);module[_0xfba3('0x16')]=router; \ No newline at end of file +var _0x5b2f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create','put','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1e7a8e,_0x324715){var _0x36a028=function(_0x2455fe){while(--_0x2455fe){_0x1e7a8e['push'](_0x1e7a8e['shift']());}};_0x36a028(++_0x324715);}(_0x5b2f,0x1a9));var _0xf5b2=function(_0x2755fb,_0x5970f1){_0x2755fb=_0x2755fb-0x0;var _0x293f12=_0x5b2f[_0x2755fb];return _0x293f12;};'use strict';var multer=require(_0xf5b2('0x0'));var util=require(_0xf5b2('0x1'));var path=require(_0xf5b2('0x2'));var timeout=require(_0xf5b2('0x3'));var express=require(_0xf5b2('0x4'));var router=express[_0xf5b2('0x5')]();var fs_extra=require(_0xf5b2('0x6'));var auth=require(_0xf5b2('0x7'));var interaction=require(_0xf5b2('0x8'));var config=require(_0xf5b2('0x9'));var controller=require('./voiceMusicOnHold.controller');router[_0xf5b2('0xa')]('/',auth[_0xf5b2('0xb')](),controller['index']);router[_0xf5b2('0xa')](_0xf5b2('0xc'),auth[_0xf5b2('0xb')](),controller[_0xf5b2('0xd')]);router[_0xf5b2('0xa')](_0xf5b2('0xe'),auth[_0xf5b2('0xb')](),controller[_0xf5b2('0xf')]);router[_0xf5b2('0x10')]('/',auth[_0xf5b2('0xb')](),controller[_0xf5b2('0x11')]);router[_0xf5b2('0x10')](_0xf5b2('0xe'),auth['isAuthenticated'](),controller['addSound']);router[_0xf5b2('0x12')](_0xf5b2('0xc'),auth[_0xf5b2('0xb')](),controller['update']);router['delete'](_0xf5b2('0xc'),auth[_0xf5b2('0xb')](),controller[_0xf5b2('0x13')]);router[_0xf5b2('0x14')](_0xf5b2('0x15'),auth[_0xf5b2('0xb')](),controller[_0xf5b2('0x16')]);module[_0xf5b2('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index dae9560..ac7a323 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a2c=['sequelize','exports','STRING','name','custom','files','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x26d0fa,_0x183841){var _0x2b3b43=function(_0x5a0874){while(--_0x5a0874){_0x26d0fa['push'](_0x26d0fa['shift']());}};_0x2b3b43(++_0x183841);}(_0x6a2c,0x12c));var _0xc6a2=function(_0x243bad,_0x332b5f){_0x243bad=_0x243bad-0x0;var _0x3c2838=_0x6a2c[_0x243bad];return _0x3c2838;};'use strict';var Sequelize=require(_0xc6a2('0x0'));module[_0xc6a2('0x1')]={'name':{'type':Sequelize[_0xc6a2('0x2')],'allowNull':![],'unique':_0xc6a2('0x3')},'mode':{'type':Sequelize['ENUM'](_0xc6a2('0x4'),_0xc6a2('0x5'),_0xc6a2('0x6'),_0xc6a2('0x7'),_0xc6a2('0x8'),_0xc6a2('0x9')),'allowNull':!![],'defaultValue':_0xc6a2('0x5')},'directory':{'type':Sequelize[_0xc6a2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xc6a2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xc6a2('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xc6a2('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbf07=['exports','ENUM','custom','mp3nb','quietmp3nb','quietmp3','mp3','files','STRING','alpha','BOOLEAN','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbf07,0xef));var _0x7bf0=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0xbf07[_0x3d2e4b];return _0x509e78;};'use strict';var Sequelize=require(_0x7bf0('0x0'));module[_0x7bf0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x7bf0('0x2')](_0x7bf0('0x3'),'files',_0x7bf0('0x4'),_0x7bf0('0x5'),_0x7bf0('0x6'),_0x7bf0('0x7')),'allowNull':!![],'defaultValue':_0x7bf0('0x8')},'directory':{'type':Sequelize[_0x7bf0('0x9')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x7bf0('0x9')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7bf0('0x9')],'allowNull':!![],'defaultValue':_0x7bf0('0xa')},'format':{'type':Sequelize[_0x7bf0('0x9')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x7bf0('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 7d520a0..c88a559 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89ab=['type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','find','update','body','create','sequelize','transaction','directory','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','params','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','save_name','createdAt','server/files/sounds/converted','format','%s.%s','extname','converted_format','symlinkSync','removeSound','findOne','id2','getSounds','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','get','destroy','error','stack','name','index','VoiceMusicOnHold','rawAttributes','fieldName'];(function(_0x2d015c,_0x31bb7e){var _0x403093=function(_0x2dc795){while(--_0x2dc795){_0x2d015c['push'](_0x2d015c['shift']());}};_0x403093(++_0x31bb7e);}(_0x89ab,0x19f));var _0xb89a=function(_0x5d669c,_0x3eb4a4){_0x5d669c=_0x5d669c-0x0;var _0x49a19b=_0x89ab[_0x5d669c];return _0x49a19b;};'use strict';var emlformat=require(_0xb89a('0x0'));var rimraf=require(_0xb89a('0x1'));var zipdir=require(_0xb89a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb89a('0x3'));var moment=require(_0xb89a('0x4'));var BPromise=require(_0xb89a('0x5'));var Mustache=require(_0xb89a('0x6'));var util=require(_0xb89a('0x7'));var path=require(_0xb89a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb89a('0x9'));var fs=require('fs');var fs_extra=require(_0xb89a('0xa'));var _=require(_0xb89a('0xb'));var squel=require('squel');var crypto=require(_0xb89a('0xc'));var jsforce=require(_0xb89a('0xd'));var deskjs=require(_0xb89a('0xe'));var toCsv=require(_0xb89a('0xf'));var querystring=require(_0xb89a('0x10'));var Papa=require(_0xb89a('0x11'));var Redis=require(_0xb89a('0x12'));var authService=require(_0xb89a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb89a('0x14'));var hardwareService=require(_0xb89a('0x15'));var logger=require(_0xb89a('0x16'))(_0xb89a('0x17'));var utils=require(_0xb89a('0x18'));var config=require(_0xb89a('0x19'));var licenseUtil=require(_0xb89a('0x1a'));var db=require(_0xb89a('0x1b'))['db'];function respondWithStatusCode(_0x1bd0d2,_0x330c63){_0x330c63=_0x330c63||0xcc;return function(_0x420342){if(_0x420342){return _0x1bd0d2[_0xb89a('0x1c')](_0x330c63);}return _0x1bd0d2[_0xb89a('0x1d')](_0x330c63)[_0xb89a('0x1e')]();};}function respondWithResult(_0x592c1a,_0x1ff7f8){_0x1ff7f8=_0x1ff7f8||0xc8;return function(_0x475dd4){if(_0x475dd4){return _0x592c1a['status'](_0x1ff7f8)[_0xb89a('0x1f')](_0x475dd4);}};}function respondWithFilteredResult(_0x44ffed,_0x9505f9){return function(_0x5941f3){if(_0x5941f3){var _0x1ea0ef=typeof _0x9505f9[_0xb89a('0x20')]===_0xb89a('0x21')&&typeof _0x9505f9['limit']==='undefined';var _0x5c9d41=_0x5941f3[_0xb89a('0x22')];var _0x11fb4a=_0x1ea0ef?0x0:_0x9505f9['offset'];var _0x1da0d0=_0x1ea0ef?_0x5941f3[_0xb89a('0x22')]:_0x9505f9['offset']+_0x9505f9[_0xb89a('0x23')];var _0x236994;if(_0x1da0d0>=_0x5c9d41){_0x1da0d0=_0x5c9d41;_0x236994=0xc8;}else{_0x236994=0xce;}_0x44ffed[_0xb89a('0x1d')](_0x236994);return _0x44ffed[_0xb89a('0x24')]('Content-Range',_0x11fb4a+'-'+_0x1da0d0+'/'+_0x5c9d41)[_0xb89a('0x1f')](_0x5941f3);}return null;};}function patchUpdates(_0x23cdf6){return function(_0x4671b8){try{jsonpatch[_0xb89a('0x25')](_0x4671b8,_0x23cdf6,!![]);}catch(_0x2913c9){return BPromise['reject'](_0x2913c9);}return _0x4671b8[_0xb89a('0x26')]();};}function saveUpdates(_0x2a8b78,_0x1a8765){return function(_0x5dede3){if(_0x5dede3){return _0x5dede3['update'](_0x2a8b78)[_0xb89a('0x27')](function(_0x40db42){return _0x40db42;});}return null;};}function removeEntity(_0x4cacb4,_0x325c99){return function(_0x2d6fe4){if(_0x2d6fe4){return _0x2d6fe4['destroy']()[_0xb89a('0x27')](function(){var _0x5661e8=_0x2d6fe4[_0xb89a('0x28')]({'plain':!![]});var _0xbafd5b='MusicOnHolds';return db['UserProfileResource'][_0xb89a('0x29')]({'where':{'type':_0xbafd5b,'resourceId':_0x5661e8['id']}})[_0xb89a('0x27')](function(){return _0x2d6fe4;});})[_0xb89a('0x27')](function(){_0x4cacb4['status'](0xcc)[_0xb89a('0x1e')]();});}};}function handleEntityNotFound(_0x195eba,_0x166978){return function(_0x3dd760){if(!_0x3dd760){_0x195eba[_0xb89a('0x1c')](0x194);}return _0x3dd760;};}function handleError(_0x237169,_0xed2e7d){_0xed2e7d=_0xed2e7d||0x1f4;return function(_0x3dead1){logger[_0xb89a('0x2a')](_0x3dead1[_0xb89a('0x2b')]);if(_0x3dead1['name']){delete _0x3dead1[_0xb89a('0x2c')];}_0x237169[_0xb89a('0x1d')](_0xed2e7d)['send'](_0x3dead1);};}exports[_0xb89a('0x2d')]=function(_0x5a3898,_0x17c882){var _0x4cf390={},_0x228ff6={},_0x18eca3={'count':0x0,'rows':[]};var _0x3e9c3c=_['map'](db[_0xb89a('0x2e')][_0xb89a('0x2f')],function(_0x49314e){return{'name':_0x49314e[_0xb89a('0x30')],'type':_0x49314e[_0xb89a('0x31')][_0xb89a('0x32')]};});_0x228ff6['model']=_[_0xb89a('0x33')](_0x3e9c3c,'name');_0x228ff6[_0xb89a('0x34')]=_[_0xb89a('0x35')](_0x5a3898[_0xb89a('0x34')]);_0x228ff6[_0xb89a('0x36')]=_[_0xb89a('0x37')](_0x228ff6[_0xb89a('0x38')],_0x228ff6[_0xb89a('0x34')]);_0x4cf390['attributes']=_[_0xb89a('0x37')](_0x228ff6[_0xb89a('0x38')],qs[_0xb89a('0x39')](_0x5a3898[_0xb89a('0x34')][_0xb89a('0x39')]));_0x4cf390[_0xb89a('0x3a')]=_0x4cf390['attributes'][_0xb89a('0x3b')]?_0x4cf390[_0xb89a('0x3a')]:_0x228ff6[_0xb89a('0x38')];if(!_0x5a3898[_0xb89a('0x34')][_0xb89a('0x3c')](_0xb89a('0x3d'))){_0x4cf390['limit']=qs['limit'](_0x5a3898[_0xb89a('0x34')][_0xb89a('0x23')]);_0x4cf390[_0xb89a('0x20')]=qs[_0xb89a('0x20')](_0x5a3898[_0xb89a('0x34')][_0xb89a('0x20')]);}_0x4cf390[_0xb89a('0x3e')]=qs[_0xb89a('0x3f')](_0x5a3898['query'][_0xb89a('0x3f')]);delete _0x5a3898[_0xb89a('0x34')][_0xb89a('0x3f')];_0x4cf390[_0xb89a('0x40')]=qs['filters'](_['pick'](_0x5a3898[_0xb89a('0x34')],_0x228ff6[_0xb89a('0x36')]),_0x3e9c3c);if(_0x5a3898[_0xb89a('0x34')][_0xb89a('0x41')]){_0x4cf390[_0xb89a('0x40')]=_[_0xb89a('0x42')](_0x4cf390[_0xb89a('0x40')],{'$or':_[_0xb89a('0x33')](_0x3e9c3c,function(_0x32d34f){if(_0x32d34f[_0xb89a('0x31')]!=='VIRTUAL'){var _0x4a1624={};_0x4a1624[_0x32d34f[_0xb89a('0x2c')]]={'$like':'%'+_0x5a3898['query'][_0xb89a('0x41')]+'%'};return _0x4a1624;}})});}_0x4cf390=_['merge']({},_0x4cf390,_0x5a3898[_0xb89a('0x43')]);var _0x375092={'where':_0x4cf390['where']};return db[_0xb89a('0x2e')][_0xb89a('0x22')](_0x375092)[_0xb89a('0x27')](function(_0x21bc8f){_0x18eca3['count']=_0x21bc8f;if(_0x5a3898[_0xb89a('0x34')][_0xb89a('0x44')]){_0x4cf390[_0xb89a('0x45')]=[{'all':!![]}];}return db[_0xb89a('0x2e')]['findAll'](_0x4cf390);})[_0xb89a('0x27')](function(_0x4b4932){_0x18eca3[_0xb89a('0x46')]=_0x4b4932;return _0x18eca3;})['then'](respondWithFilteredResult(_0x17c882,_0x4cf390))[_0xb89a('0x47')](handleError(_0x17c882,null));};exports[_0xb89a('0x48')]=function(_0x1dfb11,_0x4bcea8){var _0x1a0265={'raw':![],'where':{'id':_0x1dfb11['params']['id']}},_0x3a17d0={};_0x3a17d0[_0xb89a('0x38')]=_['keys'](db['VoiceMusicOnHold'][_0xb89a('0x2f')]);_0x3a17d0[_0xb89a('0x34')]=_[_0xb89a('0x35')](_0x1dfb11[_0xb89a('0x34')]);_0x3a17d0[_0xb89a('0x36')]=_['intersection'](_0x3a17d0[_0xb89a('0x38')],_0x3a17d0[_0xb89a('0x34')]);_0x1a0265[_0xb89a('0x3a')]=_[_0xb89a('0x37')](_0x3a17d0[_0xb89a('0x38')],qs[_0xb89a('0x39')](_0x1dfb11[_0xb89a('0x34')]['fields']));_0x1a0265[_0xb89a('0x3a')]=_0x1a0265[_0xb89a('0x3a')][_0xb89a('0x3b')]?_0x1a0265[_0xb89a('0x3a')]:_0x3a17d0[_0xb89a('0x38')];if(_0x1dfb11[_0xb89a('0x34')][_0xb89a('0x44')]){_0x1a0265[_0xb89a('0x45')]=[{'all':!![]}];}_0x1a0265=_['merge']({},_0x1a0265,_0x1dfb11[_0xb89a('0x43')]);return db['VoiceMusicOnHold'][_0xb89a('0x49')](_0x1a0265)[_0xb89a('0x27')](handleEntityNotFound(_0x4bcea8,null))['then'](respondWithResult(_0x4bcea8,null))['catch'](handleError(_0x4bcea8,null));};exports[_0xb89a('0x4a')]=function(_0x326d8c,_0x3d955c){if(_0x326d8c[_0xb89a('0x4b')]['id']){delete _0x326d8c[_0xb89a('0x4b')]['id'];}return db[_0xb89a('0x2e')][_0xb89a('0x49')]({'where':{'id':_0x326d8c['params']['id']}})[_0xb89a('0x27')](handleEntityNotFound(_0x3d955c,null))[_0xb89a('0x27')](saveUpdates(_0x326d8c[_0xb89a('0x4b')],null))[_0xb89a('0x27')](respondWithResult(_0x3d955c,null))['catch'](handleError(_0x3d955c,null));};exports[_0xb89a('0x4c')]=function(_0x4142eb,_0x50223c,_0x2119b1){return db[_0xb89a('0x4d')][_0xb89a('0x4e')](function(_0x15c5b9){if(_0x4142eb['body']['mode']==='files'){_0x4142eb['body'][_0xb89a('0x4f')]=path['join'](config[_0xb89a('0x50')],_0xb89a('0x51'),_0x4142eb[_0xb89a('0x4b')][_0xb89a('0x2c')]);}return db[_0xb89a('0x2e')][_0xb89a('0x4c')](_0x4142eb[_0xb89a('0x4b')],{'transaction':_0x15c5b9})['then'](function(_0x259e61){if(_0x4142eb['body']['mode']==='files'){fs[_0xb89a('0x52')](_0x259e61[_0xb89a('0x4f')],parseInt(_0xb89a('0x53'),0x8));}var _0x32bb0f=_0x4142eb[_0xb89a('0x54')][_0xb89a('0x28')]({'plain':!![]});if(!_0x32bb0f)throw new Error(_0xb89a('0x55'));if(_0x32bb0f[_0xb89a('0x56')]===_0xb89a('0x54')){var _0x2c00eb=_0x259e61[_0xb89a('0x28')]({'plain':!![]});return db[_0xb89a('0x57')][_0xb89a('0x49')]({'where':{'name':_0xb89a('0x58'),'userProfileId':_0x32bb0f[_0xb89a('0x59')]},'raw':!![]})[_0xb89a('0x27')](function(_0x3004f0){if(_0x3004f0&&_0x3004f0[_0xb89a('0x5a')]===0x0){return db[_0xb89a('0x5b')][_0xb89a('0x4c')]({'name':_0x2c00eb[_0xb89a('0x2c')],'resourceId':_0x2c00eb['id'],'type':_0x3004f0[_0xb89a('0x2c')],'sectionId':_0x3004f0['id']},{})[_0xb89a('0x27')](function(){return _0x259e61;});}else{return _0x259e61;}})['catch'](function(_0x6bea3a){logger[_0xb89a('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6bea3a);});}return _0x259e61;});})[_0xb89a('0x27')](respondWithResult(_0x50223c,0xc9))[_0xb89a('0x47')](handleError(_0x50223c,null));};exports[_0xb89a('0x29')]=function(_0x3a17b0,_0x4d0d6c,_0xfe38c5){var _0x1c08fb;return db[_0xb89a('0x2e')]['find']({'where':{'id':_0x3a17b0[_0xb89a('0x5c')]['id']}})[_0xb89a('0x27')](function(_0x2d4835){if(_0x2d4835){return db[_0xb89a('0x4d')][_0xb89a('0x4e')](function(_0x579b45){return _0x2d4835[_0xb89a('0x29')]({'transaction':_0x579b45,'raw':!![]})[_0xb89a('0x27')](function(_0x47e1c1){if(_0x47e1c1[_0xb89a('0x4f')]){fs[_0xb89a('0x5d')](_0x47e1c1[_0xb89a('0x4f')])[_0xb89a('0x5e')](function(_0x2eaf21){fs[_0xb89a('0x5f')](path[_0xb89a('0x60')](_0x47e1c1['directory'],_0x2eaf21));});fs[_0xb89a('0x61')](_0x47e1c1['directory']);}return _0x47e1c1;});})[_0xb89a('0x47')](function(_0x1f05c4){throw new db[(_0xb89a('0x62'))][(_0xb89a('0x63'))](_0x1f05c4[_0xb89a('0x64')]);});}})['then'](handleEntityNotFound(_0x4d0d6c,null))['then'](removeEntity(_0x4d0d6c,null))[_0xb89a('0x47')](handleError(_0x4d0d6c,null));};exports[_0xb89a('0x65')]=function(_0x7d9e17,_0x2d758b,_0x27c60c){return db['sequelize']['transaction'](function(_0x44ed41){var _0x234e2c;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x7d9e17[_0xb89a('0x5c')]['id']}})[_0xb89a('0x27')](function(_0x34beef){if(_0x34beef){_0x234e2c=_0x34beef;return _0x34beef[_0xb89a('0x65')](_0x7d9e17[_0xb89a('0x4b')]['id'],{'transaction':_0x44ed41});}})[_0xb89a('0x27')](function(_0x395077){if(_0x395077){return db[_0xb89a('0x66')]['findOne']({'where':{'id':_0x7d9e17[_0xb89a('0x4b')]['id']},'attributes':['id','name',_0xb89a('0x67'),'converted_format',_0xb89a('0x68')],'raw':!![]});}})['then'](function(_0x4486d1){if(_0x4486d1){var _0x48ac4a=path['join'](config[_0xb89a('0x50')],_0xb89a('0x69'),util[_0xb89a('0x6a')](_0xb89a('0x6b'),path['basename'](_0x4486d1['save_name'],path[_0xb89a('0x6c')](_0x4486d1['save_name'])),_0x4486d1[_0xb89a('0x6d')]));var _0x5626be=path[_0xb89a('0x60')](config[_0xb89a('0x50')],_0xb89a('0x51'),_0x234e2c['name'],util[_0xb89a('0x6a')](_0xb89a('0x6b'),_0x4486d1['name'],_0x4486d1[_0xb89a('0x6d')]));fs[_0xb89a('0x6e')](_0x48ac4a,_0x5626be);return _0x4486d1;}})[_0xb89a('0x47')](function(_0x12c78e){throw new db['Sequelize'][(_0xb89a('0x63'))](_0x12c78e['message']);});})[_0xb89a('0x27')](handleEntityNotFound(_0x2d758b,null))[_0xb89a('0x27')](respondWithResult(_0x2d758b,0xc9))[_0xb89a('0x47')](handleError(_0x2d758b,null));};exports[_0xb89a('0x6f')]=function(_0x57d81d,_0x182d15,_0x52646d){return db[_0xb89a('0x4d')][_0xb89a('0x4e')](function(_0x54cac5){var _0x494536;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x57d81d[_0xb89a('0x5c')]['id']}})[_0xb89a('0x27')](handleEntityNotFound(_0x182d15,null))['then'](function(_0x4aff38){if(_0x4aff38){_0x494536=_0x4aff38;return _0x4aff38[_0xb89a('0x6f')](_0x57d81d[_0xb89a('0x5c')]['id2']);}})['then'](function(_0x3a650d){if(_0x3a650d){return db[_0xb89a('0x66')][_0xb89a('0x70')]({'where':{'id':_0x57d81d['params'][_0xb89a('0x71')]},'attributes':['id',_0xb89a('0x2c'),'save_name',_0xb89a('0x6d'),'createdAt'],'raw':!![]});}})[_0xb89a('0x27')](function(_0x15a2ea){if(_0x15a2ea){fs[_0xb89a('0x5f')](path['join'](_0x494536['directory'],util[_0xb89a('0x6a')](_0xb89a('0x6b'),_0x15a2ea[_0xb89a('0x2c')],_0x15a2ea[_0xb89a('0x6d')])));return _0x15a2ea;}})['catch'](function(_0x2722ab){throw new db[(_0xb89a('0x62'))]['ValidationError'](_0x2722ab['message']);});})[_0xb89a('0x27')](handleEntityNotFound(_0x182d15,null))[_0xb89a('0x27')](respondWithStatusCode(_0x182d15,0xcc))['catch'](handleError(_0x182d15,null));};exports[_0xb89a('0x72')]=function(_0x958641,_0x7fd29a,_0x11cb25){var _0x364469={};var _0x150e6b={};var _0x3221e9;var _0x219d43;return db['VoiceMusicOnHold'][_0xb89a('0x70')]({'where':{'id':_0x958641[_0xb89a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x7fd29a,null))['then'](function(_0x2b886c){if(_0x2b886c){_0x3221e9=_0x2b886c;_0x150e6b[_0xb89a('0x38')]=_[_0xb89a('0x35')](db[_0xb89a('0x66')][_0xb89a('0x2f')]);_0x150e6b[_0xb89a('0x34')]=_[_0xb89a('0x35')](_0x958641['query']);_0x150e6b[_0xb89a('0x36')]=_[_0xb89a('0x37')](_0x150e6b[_0xb89a('0x38')],_0x150e6b[_0xb89a('0x34')]);_0x364469[_0xb89a('0x3a')]=_[_0xb89a('0x37')](_0x150e6b['model'],qs[_0xb89a('0x39')](_0x958641['query'][_0xb89a('0x39')]));_0x364469[_0xb89a('0x3a')]=_0x364469[_0xb89a('0x3a')]['length']?_0x364469['attributes']:_0x150e6b['model'];_0x364469[_0xb89a('0x3e')]=qs[_0xb89a('0x3f')](_0x958641['query'][_0xb89a('0x3f')]);_0x364469[_0xb89a('0x40')]=qs[_0xb89a('0x36')](_[_0xb89a('0x73')](_0x958641[_0xb89a('0x34')],_0x150e6b['filters']));if(_0x958641[_0xb89a('0x34')][_0xb89a('0x41')]){_0x364469[_0xb89a('0x40')]=_[_0xb89a('0x42')](_0x364469[_0xb89a('0x40')],{'$or':_[_0xb89a('0x33')](_0x364469[_0xb89a('0x3a')],function(_0x2cd4d2){var _0x55b4d2={};_0x55b4d2[_0x2cd4d2]={'$like':'%'+_0x958641[_0xb89a('0x34')][_0xb89a('0x41')]+'%'};return _0x55b4d2;})});}_0x364469=_['merge']({},_0x364469,_0x958641[_0xb89a('0x43')]);return _0x3221e9['getSounds'](_0x364469);}})['then'](function(_0xe6a8f9){if(_0xe6a8f9){_0x219d43=_0xe6a8f9['length'];if(!_0x958641[_0xb89a('0x34')][_0xb89a('0x3c')](_0xb89a('0x3d'))){_0x364469[_0xb89a('0x23')]=qs[_0xb89a('0x23')](_0x958641['query']['limit']);_0x364469[_0xb89a('0x20')]=qs[_0xb89a('0x20')](_0x958641[_0xb89a('0x34')][_0xb89a('0x20')]);}return _0x3221e9['getSounds'](_0x364469);}})[_0xb89a('0x27')](function(_0x5a381b){if(_0x5a381b){return _0x5a381b?{'count':_0x219d43,'rows':_0x5a381b}:null;}})[_0xb89a('0x27')](respondWithResult(_0x7fd29a,null))[_0xb89a('0x47')](handleError(_0x7fd29a,null));}; \ No newline at end of file +var _0xc2b7=['save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','body','files','directory','join','root','server/files/moh','create','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','sequelize','readdirSync','forEach','rmdirSync','Sequelize','addSound','transaction','converted_format','createdAt','server/files/sounds/converted','%s.%s','save_name','format','symlinkSync','ValidationError','message','removeSound','id2','Sound','findOne','unlinkSync','getSounds','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc2b7,0xc8));var _0x7c2b=function(_0x4fadb8,_0x11b539){_0x4fadb8=_0x4fadb8-0x0;var _0x3c9e20=_0xc2b7[_0x4fadb8];return _0x3c9e20;};'use strict';var emlformat=require(_0x7c2b('0x0'));var rimraf=require(_0x7c2b('0x1'));var zipdir=require(_0x7c2b('0x2'));var jsonpatch=require(_0x7c2b('0x3'));var rp=require(_0x7c2b('0x4'));var moment=require(_0x7c2b('0x5'));var BPromise=require(_0x7c2b('0x6'));var Mustache=require(_0x7c2b('0x7'));var util=require(_0x7c2b('0x8'));var path=require('path');var sox=require(_0x7c2b('0x9'));var csv=require(_0x7c2b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c2b('0xb'));var _=require(_0x7c2b('0xc'));var squel=require(_0x7c2b('0xd'));var crypto=require(_0x7c2b('0xe'));var jsforce=require(_0x7c2b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7c2b('0xa'));var querystring=require(_0x7c2b('0x10'));var Papa=require(_0x7c2b('0x11'));var Redis=require('ioredis');var authService=require(_0x7c2b('0x12'));var qs=require(_0x7c2b('0x13'));var as=require(_0x7c2b('0x14'));var hardwareService=require(_0x7c2b('0x15'));var logger=require(_0x7c2b('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7c2b('0x17'));var licenseUtil=require(_0x7c2b('0x18'));var db=require(_0x7c2b('0x19'))['db'];function respondWithStatusCode(_0x57c7da,_0x3dae47){_0x3dae47=_0x3dae47||0xcc;return function(_0x27336f){if(_0x27336f){return _0x57c7da[_0x7c2b('0x1a')](_0x3dae47);}return _0x57c7da[_0x7c2b('0x1b')](_0x3dae47)[_0x7c2b('0x1c')]();};}function respondWithResult(_0x1c1d83,_0xeb3616){_0xeb3616=_0xeb3616||0xc8;return function(_0x510882){if(_0x510882){return _0x1c1d83['status'](_0xeb3616)[_0x7c2b('0x1d')](_0x510882);}};}function respondWithFilteredResult(_0x3d7028,_0x9e1685){return function(_0x209a51){if(_0x209a51){var _0x33cd99=typeof _0x9e1685['offset']==='undefined'&&typeof _0x9e1685[_0x7c2b('0x1e')]===_0x7c2b('0x1f');var _0x5eee43=_0x209a51[_0x7c2b('0x20')];var _0x2b60ae=_0x33cd99?0x0:_0x9e1685[_0x7c2b('0x21')];var _0x4473ee=_0x33cd99?_0x209a51[_0x7c2b('0x20')]:_0x9e1685[_0x7c2b('0x21')]+_0x9e1685[_0x7c2b('0x1e')];var _0x383780;if(_0x4473ee>=_0x5eee43){_0x4473ee=_0x5eee43;_0x383780=0xc8;}else{_0x383780=0xce;}_0x3d7028[_0x7c2b('0x1b')](_0x383780);return _0x3d7028[_0x7c2b('0x22')](_0x7c2b('0x23'),_0x2b60ae+'-'+_0x4473ee+'/'+_0x5eee43)[_0x7c2b('0x1d')](_0x209a51);}return null;};}function patchUpdates(_0x5282c1){return function(_0x2731e0){try{jsonpatch[_0x7c2b('0x24')](_0x2731e0,_0x5282c1,!![]);}catch(_0x5e3aab){return BPromise[_0x7c2b('0x25')](_0x5e3aab);}return _0x2731e0[_0x7c2b('0x26')]();};}function saveUpdates(_0x556626,_0x24b8c1){return function(_0x4c3c37){if(_0x4c3c37){return _0x4c3c37[_0x7c2b('0x27')](_0x556626)[_0x7c2b('0x28')](function(_0x4f93f1){return _0x4f93f1;});}return null;};}function removeEntity(_0x483a64,_0x429d04){return function(_0x169f27){if(_0x169f27){return _0x169f27[_0x7c2b('0x29')]()[_0x7c2b('0x28')](function(){var _0x3513e7=_0x169f27[_0x7c2b('0x2a')]({'plain':!![]});var _0x556e80=_0x7c2b('0x2b');return db['UserProfileResource'][_0x7c2b('0x29')]({'where':{'type':_0x556e80,'resourceId':_0x3513e7['id']}})['then'](function(){return _0x169f27;});})[_0x7c2b('0x28')](function(){_0x483a64[_0x7c2b('0x1b')](0xcc)[_0x7c2b('0x1c')]();});}};}function handleEntityNotFound(_0x161ea9,_0x4ba13c){return function(_0x49c221){if(!_0x49c221){_0x161ea9[_0x7c2b('0x1a')](0x194);}return _0x49c221;};}function handleError(_0x380bf9,_0x1f61e3){_0x1f61e3=_0x1f61e3||0x1f4;return function(_0x507ee5){logger[_0x7c2b('0x2c')](_0x507ee5[_0x7c2b('0x2d')]);if(_0x507ee5['name']){delete _0x507ee5[_0x7c2b('0x2e')];}_0x380bf9['status'](_0x1f61e3)[_0x7c2b('0x2f')](_0x507ee5);};}exports[_0x7c2b('0x30')]=function(_0x413e58,_0x2bace8){var _0xacc36d={},_0x460cea={},_0x886928={'count':0x0,'rows':[]};var _0x175228=_['map'](db[_0x7c2b('0x31')][_0x7c2b('0x32')],function(_0x3108b1){return{'name':_0x3108b1[_0x7c2b('0x33')],'type':_0x3108b1[_0x7c2b('0x34')][_0x7c2b('0x35')]};});_0x460cea[_0x7c2b('0x36')]=_[_0x7c2b('0x37')](_0x175228,_0x7c2b('0x2e'));_0x460cea['query']=_['keys'](_0x413e58[_0x7c2b('0x38')]);_0x460cea[_0x7c2b('0x39')]=_['intersection'](_0x460cea[_0x7c2b('0x36')],_0x460cea[_0x7c2b('0x38')]);_0xacc36d['attributes']=_[_0x7c2b('0x3a')](_0x460cea['model'],qs[_0x7c2b('0x3b')](_0x413e58[_0x7c2b('0x38')][_0x7c2b('0x3b')]));_0xacc36d['attributes']=_0xacc36d['attributes'][_0x7c2b('0x3c')]?_0xacc36d[_0x7c2b('0x3d')]:_0x460cea['model'];if(!_0x413e58[_0x7c2b('0x38')][_0x7c2b('0x3e')]('nolimit')){_0xacc36d[_0x7c2b('0x1e')]=qs['limit'](_0x413e58[_0x7c2b('0x38')][_0x7c2b('0x1e')]);_0xacc36d['offset']=qs[_0x7c2b('0x21')](_0x413e58['query'][_0x7c2b('0x21')]);}_0xacc36d[_0x7c2b('0x3f')]=qs[_0x7c2b('0x40')](_0x413e58['query'][_0x7c2b('0x40')]);delete _0x413e58[_0x7c2b('0x38')][_0x7c2b('0x40')];_0xacc36d[_0x7c2b('0x41')]=qs['filters'](_[_0x7c2b('0x42')](_0x413e58['query'],_0x460cea[_0x7c2b('0x39')]),_0x175228);if(_0x413e58[_0x7c2b('0x38')][_0x7c2b('0x43')]){_0xacc36d[_0x7c2b('0x41')]=_[_0x7c2b('0x44')](_0xacc36d['where'],{'$or':_[_0x7c2b('0x37')](_0x175228,function(_0x86e885){if(_0x86e885[_0x7c2b('0x34')]!==_0x7c2b('0x45')){var _0x262627={};_0x262627[_0x86e885[_0x7c2b('0x2e')]]={'$like':'%'+_0x413e58[_0x7c2b('0x38')][_0x7c2b('0x43')]+'%'};return _0x262627;}})});}_0xacc36d=_[_0x7c2b('0x44')]({},_0xacc36d,_0x413e58[_0x7c2b('0x46')]);var _0x5209c7={'where':_0xacc36d[_0x7c2b('0x41')]};return db[_0x7c2b('0x31')][_0x7c2b('0x20')](_0x5209c7)[_0x7c2b('0x28')](function(_0x329368){_0x886928[_0x7c2b('0x20')]=_0x329368;if(_0x413e58['query'][_0x7c2b('0x47')]){_0xacc36d[_0x7c2b('0x48')]=[{'all':!![]}];}return db[_0x7c2b('0x31')][_0x7c2b('0x49')](_0xacc36d);})[_0x7c2b('0x28')](function(_0x4a8e55){_0x886928[_0x7c2b('0x4a')]=_0x4a8e55;return _0x886928;})['then'](respondWithFilteredResult(_0x2bace8,_0xacc36d))[_0x7c2b('0x4b')](handleError(_0x2bace8,null));};exports[_0x7c2b('0x4c')]=function(_0x3abd7b,_0x2bcafd){var _0x2ffd2e={'raw':![],'where':{'id':_0x3abd7b[_0x7c2b('0x4d')]['id']}},_0x206a4a={};_0x206a4a[_0x7c2b('0x36')]=_[_0x7c2b('0x4e')](db['VoiceMusicOnHold'][_0x7c2b('0x32')]);_0x206a4a['query']=_['keys'](_0x3abd7b[_0x7c2b('0x38')]);_0x206a4a[_0x7c2b('0x39')]=_['intersection'](_0x206a4a[_0x7c2b('0x36')],_0x206a4a[_0x7c2b('0x38')]);_0x2ffd2e[_0x7c2b('0x3d')]=_[_0x7c2b('0x3a')](_0x206a4a[_0x7c2b('0x36')],qs[_0x7c2b('0x3b')](_0x3abd7b[_0x7c2b('0x38')][_0x7c2b('0x3b')]));_0x2ffd2e[_0x7c2b('0x3d')]=_0x2ffd2e['attributes'][_0x7c2b('0x3c')]?_0x2ffd2e['attributes']:_0x206a4a['model'];if(_0x3abd7b['query'][_0x7c2b('0x47')]){_0x2ffd2e[_0x7c2b('0x48')]=[{'all':!![]}];}_0x2ffd2e=_[_0x7c2b('0x44')]({},_0x2ffd2e,_0x3abd7b[_0x7c2b('0x46')]);return db['VoiceMusicOnHold']['find'](_0x2ffd2e)[_0x7c2b('0x28')](handleEntityNotFound(_0x2bcafd,null))[_0x7c2b('0x28')](respondWithResult(_0x2bcafd,null))[_0x7c2b('0x4b')](handleError(_0x2bcafd,null));};exports[_0x7c2b('0x27')]=function(_0x36541d,_0xbf8d6c){if(_0x36541d[_0x7c2b('0x4f')]['id']){delete _0x36541d[_0x7c2b('0x4f')]['id'];}return db[_0x7c2b('0x31')]['find']({'where':{'id':_0x36541d[_0x7c2b('0x4d')]['id']}})['then'](handleEntityNotFound(_0xbf8d6c,null))[_0x7c2b('0x28')](saveUpdates(_0x36541d['body'],null))[_0x7c2b('0x28')](respondWithResult(_0xbf8d6c,null))[_0x7c2b('0x4b')](handleError(_0xbf8d6c,null));};exports['create']=function(_0x209191,_0x39df29,_0x48b0c1){return db['sequelize']['transaction'](function(_0x5f0979){if(_0x209191[_0x7c2b('0x4f')]['mode']===_0x7c2b('0x50')){_0x209191[_0x7c2b('0x4f')][_0x7c2b('0x51')]=path[_0x7c2b('0x52')](config[_0x7c2b('0x53')],_0x7c2b('0x54'),_0x209191[_0x7c2b('0x4f')]['name']);}return db[_0x7c2b('0x31')][_0x7c2b('0x55')](_0x209191[_0x7c2b('0x4f')],{'transaction':_0x5f0979})['then'](function(_0x17001b){if(_0x209191[_0x7c2b('0x4f')][_0x7c2b('0x56')]==='files'){fs[_0x7c2b('0x57')](_0x17001b[_0x7c2b('0x51')],parseInt(_0x7c2b('0x58'),0x8));}var _0x61fcac=_0x209191[_0x7c2b('0x59')][_0x7c2b('0x2a')]({'plain':!![]});if(!_0x61fcac)throw new Error(_0x7c2b('0x5a'));if(_0x61fcac[_0x7c2b('0x5b')]===_0x7c2b('0x59')){var _0x62e10e=_0x17001b['get']({'plain':!![]});return db[_0x7c2b('0x5c')][_0x7c2b('0x5d')]({'where':{'name':_0x7c2b('0x2b'),'userProfileId':_0x61fcac[_0x7c2b('0x5e')]},'raw':!![]})[_0x7c2b('0x28')](function(_0x2346f6){if(_0x2346f6&&_0x2346f6[_0x7c2b('0x5f')]===0x0){return db['UserProfileResource'][_0x7c2b('0x55')]({'name':_0x62e10e['name'],'resourceId':_0x62e10e['id'],'type':_0x2346f6['name'],'sectionId':_0x2346f6['id']},{})[_0x7c2b('0x28')](function(){return _0x17001b;});}else{return _0x17001b;}})[_0x7c2b('0x4b')](function(_0x4361dd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4361dd);});}return _0x17001b;});})[_0x7c2b('0x28')](respondWithResult(_0x39df29,0xc9))[_0x7c2b('0x4b')](handleError(_0x39df29,null));};exports[_0x7c2b('0x29')]=function(_0x500250,_0x1af828,_0x3b5f2c){var _0x1ee9bf;return db[_0x7c2b('0x31')]['find']({'where':{'id':_0x500250[_0x7c2b('0x4d')]['id']}})['then'](function(_0x5b712b){if(_0x5b712b){return db[_0x7c2b('0x60')]['transaction'](function(_0x496bd8){return _0x5b712b['destroy']({'transaction':_0x496bd8,'raw':!![]})[_0x7c2b('0x28')](function(_0x9b1a69){if(_0x9b1a69['directory']){fs[_0x7c2b('0x61')](_0x9b1a69['directory'])[_0x7c2b('0x62')](function(_0x17250a){fs['unlinkSync'](path[_0x7c2b('0x52')](_0x9b1a69['directory'],_0x17250a));});fs[_0x7c2b('0x63')](_0x9b1a69[_0x7c2b('0x51')]);}return _0x9b1a69;});})[_0x7c2b('0x4b')](function(_0x1a350e){throw new db[(_0x7c2b('0x64'))]['ValidationError'](_0x1a350e['message']);});}})[_0x7c2b('0x28')](handleEntityNotFound(_0x1af828,null))[_0x7c2b('0x28')](removeEntity(_0x1af828,null))[_0x7c2b('0x4b')](handleError(_0x1af828,null));};exports[_0x7c2b('0x65')]=function(_0x3b8507,_0x15d8b9,_0x26875a){return db[_0x7c2b('0x60')][_0x7c2b('0x66')](function(_0x36239d){var _0x25a6a3;return db[_0x7c2b('0x31')]['find']({'where':{'id':_0x3b8507['params']['id']}})['then'](function(_0x3dd6dd){if(_0x3dd6dd){_0x25a6a3=_0x3dd6dd;return _0x3dd6dd[_0x7c2b('0x65')](_0x3b8507[_0x7c2b('0x4f')]['id'],{'transaction':_0x36239d});}})[_0x7c2b('0x28')](function(_0x179faf){if(_0x179faf){return db['Sound']['findOne']({'where':{'id':_0x3b8507['body']['id']},'attributes':['id',_0x7c2b('0x2e'),'save_name',_0x7c2b('0x67'),_0x7c2b('0x68')],'raw':!![]});}})['then'](function(_0x3e391a){if(_0x3e391a){var _0x3b2ba5=path[_0x7c2b('0x52')](config[_0x7c2b('0x53')],_0x7c2b('0x69'),util['format'](_0x7c2b('0x6a'),path['basename'](_0x3e391a[_0x7c2b('0x6b')],path['extname'](_0x3e391a[_0x7c2b('0x6b')])),_0x3e391a[_0x7c2b('0x67')]));var _0x34127f=path[_0x7c2b('0x52')](config['root'],_0x7c2b('0x54'),_0x25a6a3[_0x7c2b('0x2e')],util[_0x7c2b('0x6c')]('%s.%s',_0x3e391a[_0x7c2b('0x2e')],_0x3e391a[_0x7c2b('0x67')]));fs[_0x7c2b('0x6d')](_0x3b2ba5,_0x34127f);return _0x3e391a;}})[_0x7c2b('0x4b')](function(_0x53339f){throw new db['Sequelize'][(_0x7c2b('0x6e'))](_0x53339f[_0x7c2b('0x6f')]);});})[_0x7c2b('0x28')](handleEntityNotFound(_0x15d8b9,null))[_0x7c2b('0x28')](respondWithResult(_0x15d8b9,0xc9))[_0x7c2b('0x4b')](handleError(_0x15d8b9,null));};exports[_0x7c2b('0x70')]=function(_0x40ff16,_0x3eb390,_0x17cf17){return db[_0x7c2b('0x60')][_0x7c2b('0x66')](function(_0x553bc5){var _0xacd35c;return db[_0x7c2b('0x31')]['findOne']({'where':{'id':_0x40ff16[_0x7c2b('0x4d')]['id']}})[_0x7c2b('0x28')](handleEntityNotFound(_0x3eb390,null))[_0x7c2b('0x28')](function(_0x57369a){if(_0x57369a){_0xacd35c=_0x57369a;return _0x57369a[_0x7c2b('0x70')](_0x40ff16[_0x7c2b('0x4d')][_0x7c2b('0x71')]);}})[_0x7c2b('0x28')](function(_0x1d1409){if(_0x1d1409){return db[_0x7c2b('0x72')][_0x7c2b('0x73')]({'where':{'id':_0x40ff16['params'][_0x7c2b('0x71')]},'attributes':['id',_0x7c2b('0x2e'),_0x7c2b('0x6b'),_0x7c2b('0x67'),_0x7c2b('0x68')],'raw':!![]});}})[_0x7c2b('0x28')](function(_0x170028){if(_0x170028){fs[_0x7c2b('0x74')](path[_0x7c2b('0x52')](_0xacd35c[_0x7c2b('0x51')],util['format'](_0x7c2b('0x6a'),_0x170028[_0x7c2b('0x2e')],_0x170028[_0x7c2b('0x67')])));return _0x170028;}})['catch'](function(_0x152777){throw new db[(_0x7c2b('0x64'))][(_0x7c2b('0x6e'))](_0x152777[_0x7c2b('0x6f')]);});})[_0x7c2b('0x28')](handleEntityNotFound(_0x3eb390,null))[_0x7c2b('0x28')](respondWithStatusCode(_0x3eb390,0xcc))[_0x7c2b('0x4b')](handleError(_0x3eb390,null));};exports[_0x7c2b('0x75')]=function(_0x14f11e,_0x5afd47,_0x59faf2){var _0x4f3882={};var _0x232d5e={};var _0x5c01fc;var _0x105cd9;return db['VoiceMusicOnHold'][_0x7c2b('0x73')]({'where':{'id':_0x14f11e[_0x7c2b('0x4d')]['id']}})[_0x7c2b('0x28')](handleEntityNotFound(_0x5afd47,null))[_0x7c2b('0x28')](function(_0x133571){if(_0x133571){_0x5c01fc=_0x133571;_0x232d5e['model']=_[_0x7c2b('0x4e')](db[_0x7c2b('0x72')][_0x7c2b('0x32')]);_0x232d5e[_0x7c2b('0x38')]=_[_0x7c2b('0x4e')](_0x14f11e[_0x7c2b('0x38')]);_0x232d5e[_0x7c2b('0x39')]=_[_0x7c2b('0x3a')](_0x232d5e[_0x7c2b('0x36')],_0x232d5e[_0x7c2b('0x38')]);_0x4f3882['attributes']=_['intersection'](_0x232d5e[_0x7c2b('0x36')],qs[_0x7c2b('0x3b')](_0x14f11e[_0x7c2b('0x38')][_0x7c2b('0x3b')]));_0x4f3882[_0x7c2b('0x3d')]=_0x4f3882['attributes']['length']?_0x4f3882[_0x7c2b('0x3d')]:_0x232d5e[_0x7c2b('0x36')];_0x4f3882['order']=qs['sort'](_0x14f11e[_0x7c2b('0x38')][_0x7c2b('0x40')]);_0x4f3882['where']=qs[_0x7c2b('0x39')](_[_0x7c2b('0x42')](_0x14f11e[_0x7c2b('0x38')],_0x232d5e[_0x7c2b('0x39')]));if(_0x14f11e[_0x7c2b('0x38')][_0x7c2b('0x43')]){_0x4f3882[_0x7c2b('0x41')]=_['merge'](_0x4f3882[_0x7c2b('0x41')],{'$or':_[_0x7c2b('0x37')](_0x4f3882[_0x7c2b('0x3d')],function(_0x346670){var _0x1cae1f={};_0x1cae1f[_0x346670]={'$like':'%'+_0x14f11e[_0x7c2b('0x38')][_0x7c2b('0x43')]+'%'};return _0x1cae1f;})});}_0x4f3882=_[_0x7c2b('0x44')]({},_0x4f3882,_0x14f11e[_0x7c2b('0x46')]);return _0x5c01fc['getSounds'](_0x4f3882);}})['then'](function(_0xe4c78e){if(_0xe4c78e){_0x105cd9=_0xe4c78e['length'];if(!_0x14f11e[_0x7c2b('0x38')][_0x7c2b('0x3e')](_0x7c2b('0x76'))){_0x4f3882[_0x7c2b('0x1e')]=qs['limit'](_0x14f11e['query'][_0x7c2b('0x1e')]);_0x4f3882[_0x7c2b('0x21')]=qs['offset'](_0x14f11e['query'][_0x7c2b('0x21')]);}return _0x5c01fc[_0x7c2b('0x75')](_0x4f3882);}})[_0x7c2b('0x28')](function(_0x402b95){if(_0x402b95){return _0x402b95?{'count':_0x105cd9,'rows':_0x402b95}:null;}})[_0x7c2b('0x28')](respondWithResult(_0x5afd47,null))[_0x7c2b('0x4b')](handleError(_0x5afd47,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2afe0df..3b8c9bb 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c84=['VoiceMusicOnHold','voice_musiconhold','lodash','api','moment','bluebird','request-promise','rimraf','./voiceMusicOnHold.attributes','exports','define'];(function(_0x4ecaca,_0x74fe49){var _0xf596c0=function(_0x351b46){while(--_0x351b46){_0x4ecaca['push'](_0x4ecaca['shift']());}};_0xf596c0(++_0x74fe49);}(_0x6c84,0x1f1));var _0x46c8=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6c84[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x46c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x46c8('0x1'));var moment=require(_0x46c8('0x2'));var BPromise=require(_0x46c8('0x3'));var rp=require(_0x46c8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46c8('0x5'));var config=require('../../config/environment');var attributes=require(_0x46c8('0x6'));module[_0x46c8('0x7')]=function(_0x439ff6,_0x29e8d2){return _0x439ff6[_0x46c8('0x8')](_0x46c8('0x9'),attributes,{'tableName':_0x46c8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69b6=['../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x368ffd,_0x147cbe){var _0x3b4aa1=function(_0x1a2d1d){while(--_0x1a2d1d){_0x368ffd['push'](_0x368ffd['shift']());}};_0x3b4aa1(++_0x147cbe);}(_0x69b6,0x139));var _0x669b=function(_0x104d23,_0x39fb6c){_0x104d23=_0x104d23-0x0;var _0x1988c5=_0x69b6[_0x104d23];return _0x1988c5;};'use strict';var _=require(_0x669b('0x0'));var util=require(_0x669b('0x1'));var logger=require(_0x669b('0x2'))(_0x669b('0x3'));var moment=require(_0x669b('0x4'));var BPromise=require(_0x669b('0x5'));var rp=require(_0x669b('0x6'));var fs=require('fs');var path=require(_0x669b('0x7'));var rimraf=require(_0x669b('0x8'));var config=require(_0x669b('0x9'));var attributes=require(_0x669b('0xa'));module['exports']=function(_0x3a72d9,_0x3174eb){return _0x3a72d9[_0x669b('0xb')](_0x669b('0xc'),attributes,{'tableName':_0x669b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 43ac71c..d76f2f2 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x929b8,_0x506624){var _0x5203c5=function(_0xc3094b){while(--_0xc3094b){_0x929b8['push'](_0x929b8['shift']());}};_0x5203c5(++_0x506624);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3ea2d4,_0x441498){var _0x8a7bf4=function(_0xbcc99e){while(--_0xbcc99e){_0x3ea2d4['push'](_0x3ea2d4['shift']());}};_0x8a7bf4(++_0x441498);}(_0x34e8,0x12c));var _0x834e=function(_0x1b7e8a,_0x232851){_0x1b7e8a=_0x1b7e8a-0x0;var _0x4033fe=_0x34e8[_0x1b7e8a];return _0x4033fe;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 90f1408..c5bd096 100644 --- a/server/api/voicePrefix/index.js +++ b/server/api/voicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2a3=['util','express','Router','fs-extra','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/users','/:id/teams','create','addAgents','post','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer'];(function(_0x2315fe,_0x6ac75d){var _0xc3e572=function(_0x1c4852){while(--_0x1c4852){_0x2315fe['push'](_0x2315fe['shift']());}};_0xc3e572(++_0x6ac75d);}(_0xe2a3,0x67));var _0x3e2a=function(_0x171dbc,_0x1e46fe){_0x171dbc=_0x171dbc-0x0;var _0x455fc6=_0xe2a3[_0x171dbc];return _0x455fc6;};'use strict';var multer=require(_0x3e2a('0x0'));var util=require(_0x3e2a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3e2a('0x2'));var router=express[_0x3e2a('0x3')]();var fs_extra=require(_0x3e2a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3e2a('0x5'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3e2a('0x6')]);router['get'](_0x3e2a('0x7'),auth[_0x3e2a('0x8')](),controller[_0x3e2a('0x9')]);router[_0x3e2a('0xa')](_0x3e2a('0xb'),auth['isAuthenticated'](),controller[_0x3e2a('0xc')]);router[_0x3e2a('0xa')](_0x3e2a('0xd'),auth[_0x3e2a('0x8')](),controller['getAgents']);router[_0x3e2a('0xa')](_0x3e2a('0xe'),auth['isAuthenticated'](),controller['getTeams']);router['post']('/',auth[_0x3e2a('0x8')](),controller[_0x3e2a('0xf')]);router['post'](_0x3e2a('0xd'),auth['isAuthenticated'](),controller[_0x3e2a('0x10')]);router[_0x3e2a('0x11')]('/:id/teams',auth[_0x3e2a('0x8')](),controller[_0x3e2a('0x12')]);router[_0x3e2a('0x13')]('/:id',auth[_0x3e2a('0x8')](),controller[_0x3e2a('0x14')]);router[_0x3e2a('0x15')](_0x3e2a('0xb'),auth[_0x3e2a('0x8')](),controller[_0x3e2a('0x16')]);router[_0x3e2a('0x15')](_0x3e2a('0xd'),auth['isAuthenticated'](),controller[_0x3e2a('0x17')]);router['delete'](_0x3e2a('0xe'),auth[_0x3e2a('0x8')](),controller[_0x3e2a('0x18')]);module[_0x3e2a('0x19')]=router; \ No newline at end of file +var _0xee24=['update','delete','destroy','removeAgents','removeTeams','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','show','getAgents','/:id/teams','post','create','addAgents','put'];(function(_0x1814fa,_0x5b2c26){var _0x18e64c=function(_0x190ecd){while(--_0x190ecd){_0x1814fa['push'](_0x1814fa['shift']());}};_0x18e64c(++_0x5b2c26);}(_0xee24,0x1a6));var _0x4ee2=function(_0x188db2,_0x48d1fa){_0x188db2=_0x188db2-0x0;var _0x37e450=_0xee24[_0x188db2];return _0x37e450;};'use strict';var multer=require('multer');var util=require(_0x4ee2('0x0'));var path=require(_0x4ee2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ee2('0x2'));var router=express[_0x4ee2('0x3')]();var fs_extra=require(_0x4ee2('0x4'));var auth=require(_0x4ee2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ee2('0x6'));var controller=require(_0x4ee2('0x7'));router[_0x4ee2('0x8')]('/',auth[_0x4ee2('0x9')](),controller['index']);router[_0x4ee2('0x8')](_0x4ee2('0xa'),auth[_0x4ee2('0x9')](),controller[_0x4ee2('0xb')]);router[_0x4ee2('0x8')](_0x4ee2('0xc'),auth[_0x4ee2('0x9')](),controller[_0x4ee2('0xd')]);router['get']('/:id/users',auth[_0x4ee2('0x9')](),controller[_0x4ee2('0xe')]);router[_0x4ee2('0x8')](_0x4ee2('0xf'),auth[_0x4ee2('0x9')](),controller['getTeams']);router[_0x4ee2('0x10')]('/',auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x11')]);router[_0x4ee2('0x10')]('/:id/users',auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x12')]);router[_0x4ee2('0x10')](_0x4ee2('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x4ee2('0x13')](_0x4ee2('0xc'),auth['isAuthenticated'](),controller[_0x4ee2('0x14')]);router[_0x4ee2('0x15')](_0x4ee2('0xc'),auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x16')]);router[_0x4ee2('0x15')]('/:id/users',auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x17')]);router[_0x4ee2('0x15')]('/:id/teams',auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x18')]);module[_0x4ee2('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f7e3c91..966afd0 100644 --- a/server/api/voicePrefix/voicePrefix.attributes.js +++ b/server/api/voicePrefix/voicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c52=['VIRTUAL','system-','INTEGER','sequelize','STRING','name'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1c52,0x117));var _0x21c5=function(_0x150fff,_0x215a3c){_0x150fff=_0x150fff-0x0;var _0x33a581=_0x1c52[_0x150fff];return _0x33a581;};'use strict';var Sequelize=require(_0x21c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x21c5('0x1')],'allowNull':![],'unique':_0x21c5('0x2')},'prefix':{'type':Sequelize[_0x21c5('0x3')],'get':function(_0x2e7fe3){return _0x21c5('0x4')+this['getDataValue'](_0x21c5('0x2'))+'-';}},'description':{'type':Sequelize[_0x21c5('0x1')]},'callerIdAll':{'type':Sequelize[_0x21c5('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x21c5('0x5')]}}; \ No newline at end of file +var _0x3a18=['sequelize','exports','name','VIRTUAL','getDataValue','STRING','INTEGER'];(function(_0x36fde7,_0x59f562){var _0x4b04ee=function(_0x1da06f){while(--_0x1da06f){_0x36fde7['push'](_0x36fde7['shift']());}};_0x4b04ee(++_0x59f562);}(_0x3a18,0x142));var _0x83a1=function(_0x4a6159,_0x24aefc){_0x4a6159=_0x4a6159-0x0;var _0x11a6a0=_0x3a18[_0x4a6159];return _0x11a6a0;};'use strict';var Sequelize=require(_0x83a1('0x0'));module[_0x83a1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x83a1('0x2')},'prefix':{'type':Sequelize[_0x83a1('0x3')],'get':function(_0x27e47f){return'system-'+this[_0x83a1('0x4')](_0x83a1('0x2'))+'-';}},'description':{'type':Sequelize[_0x83a1('0x5')]},'callerIdAll':{'type':Sequelize[_0x83a1('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x83a1('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c02ad51..ccc4945 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x351d=['isEmpty','forEach','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voicePrefix.socket','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','VoicePrefixes','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','VoicePrefix','findAll','catch','show','params','length','merge','options','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','user','get','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','CDR(prefix)=','push','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','Team','getTeams','addTeams','online','voicePause','interface','flatMap','sequelize','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','removeTeams','Agents','select','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','QueryTypes','TeamId','all','union','compact','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x351d,0x90));var _0xd351=function(_0x3ed379,_0x26cd24){_0x3ed379=_0x3ed379-0x0;var _0x4246c8=_0x351d[_0x3ed379];return _0x4246c8;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd351('0x13')]=_[_0xd351('0x14')](config[_0xd351('0x13')],{'host':_0xd351('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd351('0x13')]));require(_0xd351('0x16'))['register'](socket);function respondWithStatusCode(_0xc5a145,_0xb106ef){_0xb106ef=_0xb106ef||0xcc;return function(_0x3c2299){if(_0x3c2299){return _0xc5a145[_0xd351('0x17')](_0xb106ef);}return _0xc5a145[_0xd351('0x18')](_0xb106ef)['end']();};}function respondWithResult(_0x9f790f,_0x49d8bb){_0x49d8bb=_0x49d8bb||0xc8;return function(_0x5bdc03){if(_0x5bdc03){return _0x9f790f[_0xd351('0x18')](_0x49d8bb)['json'](_0x5bdc03);}};}function respondWithFilteredResult(_0x21e591,_0x1de35f){return function(_0x4e0164){if(_0x4e0164){var _0x4c6693=typeof _0x1de35f[_0xd351('0x19')]===_0xd351('0x1a')&&typeof _0x1de35f[_0xd351('0x1b')]===_0xd351('0x1a');var _0x51f265=_0x4e0164[_0xd351('0x1c')];var _0x4abbed=_0x4c6693?0x0:_0x1de35f['offset'];var _0x37d3ac=_0x4c6693?_0x4e0164['count']:_0x1de35f[_0xd351('0x19')]+_0x1de35f[_0xd351('0x1b')];var _0x3634c9;if(_0x37d3ac>=_0x51f265){_0x37d3ac=_0x51f265;_0x3634c9=0xc8;}else{_0x3634c9=0xce;}_0x21e591[_0xd351('0x18')](_0x3634c9);return _0x21e591[_0xd351('0x1d')]('Content-Range',_0x4abbed+'-'+_0x37d3ac+'/'+_0x51f265)[_0xd351('0x1e')](_0x4e0164);}return null;};}function patchUpdates(_0xbbc58){return function(_0x241265){try{jsonpatch['apply'](_0x241265,_0xbbc58,!![]);}catch(_0x1ce7f7){return BPromise[_0xd351('0x1f')](_0x1ce7f7);}return _0x241265[_0xd351('0x20')]();};}function saveUpdates(_0x59fb6d,_0x1ce279){return function(_0x34a5cb){if(_0x34a5cb){return _0x34a5cb[_0xd351('0x21')](_0x59fb6d)[_0xd351('0x22')](function(_0x489c9a){return _0x489c9a;});}return null;};}function removeEntity(_0x40f7f3,_0x483c92){return function(_0x358bff){if(_0x358bff){return _0x358bff[_0xd351('0x23')]()['then'](function(){var _0x2648d0=_0x358bff['get']({'plain':!![]});var _0x50d67e=_0xd351('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x50d67e,'resourceId':_0x2648d0['id']}})[_0xd351('0x22')](function(){return _0x358bff;});})['then'](function(){_0x40f7f3[_0xd351('0x18')](0xcc)[_0xd351('0x25')]();});}};}function handleEntityNotFound(_0x407b50,_0x4d3f48){return function(_0x71ce9c){if(!_0x71ce9c){_0x407b50['sendStatus'](0x194);}return _0x71ce9c;};}function handleError(_0x1c826b,_0x50039b){_0x50039b=_0x50039b||0x1f4;return function(_0x5f07b1){logger[_0xd351('0x26')](_0x5f07b1[_0xd351('0x27')]);if(_0x5f07b1[_0xd351('0x28')]){delete _0x5f07b1[_0xd351('0x28')];}_0x1c826b['status'](_0x50039b)[_0xd351('0x29')](_0x5f07b1);};}exports[_0xd351('0x2a')]=function(_0x38023c,_0x41da60){var _0x140591={},_0x205c79={},_0x103a7b={'count':0x0,'rows':[]};var _0x898949=_[_0xd351('0x2b')](db['VoicePrefix'][_0xd351('0x2c')],function(_0x453270){return{'name':_0x453270[_0xd351('0x2d')],'type':_0x453270[_0xd351('0x2e')]['key']};});_0x205c79[_0xd351('0x2f')]=_[_0xd351('0x2b')](_0x898949,_0xd351('0x28'));_0x205c79[_0xd351('0x30')]=_[_0xd351('0x31')](_0x38023c[_0xd351('0x30')]);_0x205c79[_0xd351('0x32')]=_[_0xd351('0x33')](_0x205c79[_0xd351('0x2f')],_0x205c79['query']);_0x140591['attributes']=_[_0xd351('0x33')](_0x205c79[_0xd351('0x2f')],qs[_0xd351('0x34')](_0x38023c[_0xd351('0x30')][_0xd351('0x34')]));_0x140591[_0xd351('0x35')]=_0x140591['attributes']['length']?_0x140591[_0xd351('0x35')]:_0x205c79['model'];if(!_0x38023c[_0xd351('0x30')][_0xd351('0x36')](_0xd351('0x37'))){_0x140591[_0xd351('0x1b')]=qs[_0xd351('0x1b')](_0x38023c[_0xd351('0x30')][_0xd351('0x1b')]);_0x140591[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x38023c[_0xd351('0x30')][_0xd351('0x19')]);}_0x140591['order']=qs[_0xd351('0x38')](_0x38023c['query'][_0xd351('0x38')]);_0x140591[_0xd351('0x39')]=qs[_0xd351('0x32')](_[_0xd351('0x3a')](_0x38023c[_0xd351('0x30')],_0x205c79[_0xd351('0x32')]),_0x898949);if(_0x38023c['query'][_0xd351('0x3b')]){_0x140591[_0xd351('0x39')]=_['merge'](_0x140591[_0xd351('0x39')],{'$or':_[_0xd351('0x2b')](_0x898949,function(_0x382f5b){if(_0x382f5b[_0xd351('0x2e')]!==_0xd351('0x3c')){var _0x5cc105={};_0x5cc105[_0x382f5b['name']]={'$like':'%'+_0x38023c[_0xd351('0x30')][_0xd351('0x3b')]+'%'};return _0x5cc105;}})});}_0x140591=_['merge']({},_0x140591,_0x38023c['options']);var _0x16677f={'where':_0x140591[_0xd351('0x39')]};return db['VoicePrefix']['count'](_0x16677f)[_0xd351('0x22')](function(_0x18f9d1){_0x103a7b[_0xd351('0x1c')]=_0x18f9d1;if(_0x38023c[_0xd351('0x30')][_0xd351('0x3d')]){_0x140591[_0xd351('0x3e')]=[{'all':!![]}];}return db[_0xd351('0x3f')][_0xd351('0x40')](_0x140591);})[_0xd351('0x22')](function(_0x553360){_0x103a7b['rows']=_0x553360;return _0x103a7b;})[_0xd351('0x22')](respondWithFilteredResult(_0x41da60,_0x140591))[_0xd351('0x41')](handleError(_0x41da60,null));};exports[_0xd351('0x42')]=function(_0x35f38f,_0x2bdd8f){var _0x4332e7={'raw':![],'where':{'id':_0x35f38f[_0xd351('0x43')]['id']}},_0xeaf4dc={};_0xeaf4dc[_0xd351('0x2f')]=_[_0xd351('0x31')](db[_0xd351('0x3f')][_0xd351('0x2c')]);_0xeaf4dc[_0xd351('0x30')]=_[_0xd351('0x31')](_0x35f38f[_0xd351('0x30')]);_0xeaf4dc[_0xd351('0x32')]=_['intersection'](_0xeaf4dc[_0xd351('0x2f')],_0xeaf4dc[_0xd351('0x30')]);_0x4332e7[_0xd351('0x35')]=_['intersection'](_0xeaf4dc[_0xd351('0x2f')],qs[_0xd351('0x34')](_0x35f38f[_0xd351('0x30')][_0xd351('0x34')]));_0x4332e7[_0xd351('0x35')]=_0x4332e7['attributes'][_0xd351('0x44')]?_0x4332e7['attributes']:_0xeaf4dc[_0xd351('0x2f')];if(_0x35f38f[_0xd351('0x30')]['includeAll']){_0x4332e7['include']=[{'all':!![]}];}_0x4332e7=_[_0xd351('0x45')]({},_0x4332e7,_0x35f38f[_0xd351('0x46')]);return db[_0xd351('0x3f')]['find'](_0x4332e7)[_0xd351('0x22')](handleEntityNotFound(_0x2bdd8f,null))[_0xd351('0x22')](respondWithResult(_0x2bdd8f,null))['catch'](handleError(_0x2bdd8f,null));};exports[_0xd351('0x23')]=function(_0x53a2e8,_0x1eb5f3){return db[_0xd351('0x3f')]['find']({'where':{'id':_0x53a2e8['params']['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x1eb5f3,null))['then'](removeEntity(_0x1eb5f3,null))[_0xd351('0x41')](handleError(_0x1eb5f3,null));};exports[_0xd351('0x47')]=function(_0x9f1cd0,_0x4a27e3){return db[_0xd351('0x3f')]['describe']()['then'](respondWithResult(_0x4a27e3,null))['catch'](handleError(_0x4a27e3,null));};exports[_0xd351('0x48')]=function(_0x292af3,_0x334029){var _0x5a2e9b;return db['sequelize'][_0xd351('0x49')](function(_0x42f248){return db['VoicePrefix'][_0xd351('0x48')](_0x292af3[_0xd351('0x4a')],{'transaction':_0x42f248})['then'](function(_0x24ee0f){_0x5a2e9b=_0x24ee0f['get']({'plain':!![]});return db[_0xd351('0x4b')]['find']({'where':{'id':_0x5a2e9b[_0xd351('0x4c')]},'raw':!![]})[_0xd351('0x22')](function(_0x169ab1){return createVoicePrefixExtensions(_0x5a2e9b,_0x169ab1,_0x42f248);});});})[_0xd351('0x22')](function(){var _0xb5f3ee=_0x292af3[_0xd351('0x4d')][_0xd351('0x4e')]({'plain':!![]});if(!_0xb5f3ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb5f3ee['role']===_0xd351('0x4d')){var _0x624224=_0x5a2e9b;return db['UserProfileSection'][_0xd351('0x4f')]({'where':{'name':_0xd351('0x24'),'userProfileId':_0xb5f3ee[_0xd351('0x50')]},'raw':!![]})['then'](function(_0x169122){if(_0x169122&&_0x169122['autoAssociation']===0x0){return db['UserProfileResource'][_0xd351('0x48')]({'name':_0x624224[_0xd351('0x28')],'resourceId':_0x624224['id'],'type':_0x169122['name'],'sectionId':_0x169122['id']},{})[_0xd351('0x22')](function(){return _0x5a2e9b;});}else{return _0x5a2e9b;}})[_0xd351('0x41')](function(_0x2d9747){logger[_0xd351('0x26')](_0xd351('0x51'),_0x2d9747);throw _0x2d9747;});}return _0x5a2e9b;})[_0xd351('0x22')](respondWithResult(_0x334029,null))['catch'](handleError(_0x334029,null));};function Extension(_0x1e1173,_0x2a7390,_0x36fb5b,_0x8461b){this[_0xd351('0x52')]=_0xd351('0x53');this[_0xd351('0x54')]=_0x1e1173;this['app']=_0x36fb5b;this[_0xd351('0x2e')]='system';this[_0xd351('0x55')]=_0xd351('0x56');this[_0xd351('0x57')]=_0x2a7390;this[_0xd351('0x58')]=_0x8461b;}function createVoicePrefixExtensions(_0x70cdb,_0x4eaf18,_0x413931){return new BPromise(function(_0x4c8038,_0x4685fa){var _0x45bcc7=new Extension(formatPrefixName(_0x70cdb[_0xd351('0x59')]),0x1,_0xd351('0x5a'),_0xd351('0x5b'));_0x45bcc7['VoicePrefixId']=_0x70cdb['id'];return db['VoiceExtension'][_0xd351('0x48')](_0x45bcc7,{'transaction':_0x413931})[_0xd351('0x22')](function(_0x4b9367){var _0x2d2655=_0x4b9367[_0xd351('0x4e')]({'plain':!![]});var _0x2718e9=_['map'](addVoicePrefixExtensions(_0x70cdb,_0x4eaf18),function(_0x2b47ab){_0x2b47ab[_0xd351('0x4c')]=_0x2d2655['id'];_0x2b47ab[_0xd351('0x5c')]=_0x70cdb['id'];return _0x2b47ab;});return db[_0xd351('0x4b')]['bulkCreate'](_0x2718e9,{'transaction':_0x413931})['then'](function(_0x40c78b){if(!_0x40c78b){return _0x4685fa(_0xd351('0x5d'));}else{return _0x4c8038(_0x40c78b);}})[_0xd351('0x41')](function(_0xa000b4){return _0x4685fa(_0xa000b4);});});;});};function addVoicePrefixExtensions(_0x36b38f,_0x3b0993){var _0x2c83fe=[];var _0x5e2e06=formatPrefixName(_0x36b38f[_0xd351('0x59')]);_0x2c83fe['push'](new Extension(_0x5e2e06,0x2,'Set',_0xd351('0x5e')+_0x36b38f[_0xd351('0x28')]));if(_0x36b38f['callerIdAll']){_0x2c83fe[_0xd351('0x5f')](new Extension(_0x5e2e06,0x3,'Set','PREFIX-CALLERIDALL='+_0x36b38f['callerIdAll']));}else{_0x2c83fe[_0xd351('0x5f')](new Extension(_0x5e2e06,0x3,_0xd351('0x5a'),_0xd351('0x60')));}_0x2c83fe['push'](new Extension(_0x5e2e06,0x4,_0xd351('0x61'),_0x3b0993[_0xd351('0x52')]+','+_0xd351('0x62')+(0x8+_0x36b38f[_0xd351('0x28')][_0xd351('0x44')])+'}'+','+0x1));return _0x2c83fe;}function formatPrefixName(_0x475534){var _0x15fcab='_';for(var _0x6bf19c=0x0;_0x6bf19c<_0x475534[_0xd351('0x44')];_0x6bf19c++){if(_0x475534[_0xd351('0x63')](_0x6bf19c)=='-'){_0x15fcab+=_0x475534[_0xd351('0x63')](_0x6bf19c);}else{_0x15fcab+='['+_0x475534['charAt'](_0x6bf19c)+']';}}_0x15fcab+='.';return _0x15fcab;}exports[_0xd351('0x21')]=function(_0x2d59a5,_0x431e91,_0xcc7a10){var _0xf24a29=_0x2d59a5[_0xd351('0x4a')];_0xf24a29['prefix']=_0xd351('0x64')+_0xf24a29[_0xd351('0x28')]+'-';return db['sequelize']['transaction'](function(_0x436e1d){return db[_0xd351('0x3f')][_0xd351('0x21')](_0xf24a29,{'where':{'id':_0xf24a29['id']},'transaction':_0x436e1d})[_0xd351('0x22')](function(){return db[_0xd351('0x4b')][_0xd351('0x23')]({'where':{'VoicePrefixId':_0xf24a29['id']},'transaction':_0x436e1d})[_0xd351('0x22')](function(){return db[_0xd351('0x4b')][_0xd351('0x4f')]({'where':{'id':_0xf24a29['VoiceExtensionId']},'raw':!![]})[_0xd351('0x22')](function(_0x129623){return createVoicePrefixExtensions(_0xf24a29,_0x129623,_0x436e1d);});});});})['then'](function(){return db[_0xd351('0x3f')]['findById'](_0xf24a29['id']);})[_0xd351('0x22')](respondWithResult(_0x431e91,null))['catch'](handleError(_0x431e91,null));};exports[_0xd351('0x65')]=function(_0x406d8a,_0xbd31ca,_0x451445){return db[_0xd351('0x3f')][_0xd351('0x4f')]({'where':{'id':_0x406d8a[_0xd351('0x43')]['id']}})['then'](handleEntityNotFound(_0xbd31ca,null))[_0xd351('0x22')](function(_0x2558b4){if(_0x2558b4){return _0x2558b4[_0xd351('0x65')](_0x406d8a[_0xd351('0x4a')][_0xd351('0x66')],_['omit'](_0x406d8a[_0xd351('0x4a')],[_0xd351('0x66'),'id'])||{})[_0xd351('0x67')](function(_0x54b38c){for(var _0x38a3ec=0x0;_0x38a3ec<_0x406d8a[_0xd351('0x4a')][_0xd351('0x66')][_0xd351('0x44')];_0x38a3ec+=0x1){socket[_0xd351('0x68')](_0xd351('0x69'),{'UserId':Number(_0x406d8a[_0xd351('0x4a')][_0xd351('0x66')][_0x38a3ec]),'VoicePrefixId':Number(_0x406d8a[_0xd351('0x43')]['id'])});}return _0x54b38c;});}})['then'](respondWithResult(_0xbd31ca,null))[_0xd351('0x41')](handleError(_0xbd31ca,null));};exports[_0xd351('0x6a')]=function(_0x5036e6,_0x44df63,_0x4c1468){return db['VoicePrefix']['find']({'where':{'id':_0x5036e6[_0xd351('0x43')]['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x44df63,null))[_0xd351('0x22')](function(_0x5b2bf9){if(_0x5b2bf9){return _0x5b2bf9[_0xd351('0x6a')](_0x5036e6['query'][_0xd351('0x66')])['then'](function(){if(_[_0xd351('0x6b')](_0x5036e6[_0xd351('0x30')][_0xd351('0x66')])){for(var _0x16dd16=0x0;_0x16dd16<_0x5036e6[_0xd351('0x30')][_0xd351('0x66')][_0xd351('0x44')];_0x16dd16+=0x1){socket[_0xd351('0x68')](_0xd351('0x6c'),{'UserId':Number(_0x5036e6[_0xd351('0x30')][_0xd351('0x66')][_0x16dd16]),'VoicePrefixId':Number(_0x5036e6[_0xd351('0x43')]['id'])});}}else{socket['emit'](_0xd351('0x6c'),{'UserId':Number(_0x5036e6[_0xd351('0x30')][_0xd351('0x66')]),'VoicePrefixId':Number(_0x5036e6[_0xd351('0x43')]['id'])});}});}})[_0xd351('0x22')](respondWithStatusCode(_0x44df63,null))['catch'](handleError(_0x44df63,null));};exports[_0xd351('0x6d')]=function(_0x1e6c85,_0x2adab4,_0x2a1ea4){var _0x4a4b25={};var _0x1fda25={};var _0x36bbee;var _0x48b5ee;return db[_0xd351('0x3f')][_0xd351('0x6e')]({'where':{'id':_0x1e6c85[_0xd351('0x43')]['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x2adab4,null))['then'](function(_0x523895){if(_0x523895){_0x36bbee=_0x523895;_0x1fda25[_0xd351('0x2f')]=_[_0xd351('0x31')](db[_0xd351('0x6f')][_0xd351('0x2c')]);_0x1fda25['query']=_[_0xd351('0x31')](_0x1e6c85[_0xd351('0x30')]);_0x1fda25[_0xd351('0x32')]=_[_0xd351('0x33')](_0x1fda25[_0xd351('0x2f')],_0x1fda25['query']);_0x4a4b25[_0xd351('0x35')]=_[_0xd351('0x33')](_0x1fda25['model'],qs[_0xd351('0x34')](_0x1e6c85[_0xd351('0x30')]['fields']));_0x4a4b25[_0xd351('0x35')]=_0x4a4b25['attributes'][_0xd351('0x44')]?_0x4a4b25['attributes']:_0x1fda25[_0xd351('0x2f')];_0x4a4b25[_0xd351('0x70')]=qs[_0xd351('0x38')](_0x1e6c85[_0xd351('0x30')][_0xd351('0x38')]);_0x4a4b25[_0xd351('0x39')]=qs[_0xd351('0x32')](_[_0xd351('0x3a')](_0x1e6c85[_0xd351('0x30')],_0x1fda25['filters']));if(_0x1e6c85[_0xd351('0x30')][_0xd351('0x3b')]){_0x4a4b25[_0xd351('0x39')]=_[_0xd351('0x45')](_0x4a4b25[_0xd351('0x39')],{'$or':_[_0xd351('0x2b')](_0x4a4b25[_0xd351('0x35')],function(_0x54041b){var _0x56458b={};_0x56458b[_0x54041b]={'$like':'%'+_0x1e6c85[_0xd351('0x30')]['filter']+'%'};return _0x56458b;})});}_0x4a4b25=_[_0xd351('0x45')]({},_0x4a4b25,_0x1e6c85[_0xd351('0x46')]);return _0x36bbee[_0xd351('0x6d')](_0x4a4b25);}})[_0xd351('0x22')](function(_0x2d5e2b){if(_0x2d5e2b){_0x48b5ee=_0x2d5e2b['length'];if(!_0x1e6c85[_0xd351('0x30')][_0xd351('0x36')](_0xd351('0x37'))){_0x4a4b25[_0xd351('0x1b')]=qs[_0xd351('0x1b')](_0x1e6c85[_0xd351('0x30')][_0xd351('0x1b')]);_0x4a4b25[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x1e6c85[_0xd351('0x30')][_0xd351('0x19')]);}return _0x36bbee[_0xd351('0x6d')](_0x4a4b25);}})[_0xd351('0x22')](function(_0x4ddd65){if(_0x4ddd65){return _0x4ddd65?{'count':_0x48b5ee,'rows':_0x4ddd65}:null;}})['then'](respondWithResult(_0x2adab4,null))[_0xd351('0x41')](handleError(_0x2adab4,null));};exports['getTeams']=function(_0x5c202f,_0x426964,_0x4557ed){var _0x3f6826={};var _0x1a5e8e={};var _0x54fc9c;var _0x2443bd;return db['VoicePrefix']['findOne']({'where':{'id':_0x5c202f[_0xd351('0x43')]['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x426964,null))[_0xd351('0x22')](function(_0x15690b){if(_0x15690b){_0x54fc9c=_0x15690b;_0x1a5e8e[_0xd351('0x2f')]=_[_0xd351('0x31')](db[_0xd351('0x71')]['rawAttributes']);_0x1a5e8e[_0xd351('0x30')]=_[_0xd351('0x31')](_0x5c202f[_0xd351('0x30')]);_0x1a5e8e[_0xd351('0x32')]=_[_0xd351('0x33')](_0x1a5e8e[_0xd351('0x2f')],_0x1a5e8e['query']);_0x3f6826['attributes']=_[_0xd351('0x33')](_0x1a5e8e['model'],qs[_0xd351('0x34')](_0x5c202f[_0xd351('0x30')]['fields']));_0x3f6826[_0xd351('0x35')]=_0x3f6826[_0xd351('0x35')][_0xd351('0x44')]?_0x3f6826[_0xd351('0x35')]:_0x1a5e8e[_0xd351('0x2f')];_0x3f6826['order']=qs[_0xd351('0x38')](_0x5c202f['query'][_0xd351('0x38')]);_0x3f6826[_0xd351('0x39')]=qs['filters'](_[_0xd351('0x3a')](_0x5c202f[_0xd351('0x30')],_0x1a5e8e[_0xd351('0x32')]));if(_0x5c202f[_0xd351('0x30')]['filter']){_0x3f6826['where']=_['merge'](_0x3f6826[_0xd351('0x39')],{'$or':_[_0xd351('0x2b')](_0x3f6826[_0xd351('0x35')],function(_0x40740e){var _0x3606b1={};_0x3606b1[_0x40740e]={'$like':'%'+_0x5c202f[_0xd351('0x30')][_0xd351('0x3b')]+'%'};return _0x3606b1;})});}_0x3f6826=_['merge']({},_0x3f6826,_0x5c202f[_0xd351('0x46')]);return _0x54fc9c['getTeams'](_0x3f6826);}})[_0xd351('0x22')](function(_0x55d564){if(_0x55d564){_0x2443bd=_0x55d564['length'];if(!_0x5c202f[_0xd351('0x30')]['hasOwnProperty'](_0xd351('0x37'))){_0x3f6826[_0xd351('0x1b')]=qs[_0xd351('0x1b')](_0x5c202f[_0xd351('0x30')][_0xd351('0x1b')]);_0x3f6826[_0xd351('0x19')]=qs['offset'](_0x5c202f['query'][_0xd351('0x19')]);}return _0x54fc9c[_0xd351('0x72')](_0x3f6826);}})['then'](function(_0x3d3cfa){if(_0x3d3cfa){return _0x3d3cfa?{'count':_0x2443bd,'rows':_0x3d3cfa}:null;}})['then'](respondWithResult(_0x426964,null))[_0xd351('0x41')](handleError(_0x426964,null));};exports[_0xd351('0x73')]=function(_0x6fd03b,_0x19d16a,_0x127bf9){var _0x4ab9b9=_0x6fd03b[_0xd351('0x4a')]['ids'];var _0x581e66;return db[_0xd351('0x71')][_0xd351('0x40')]({'where':{'id':_0x4ab9b9},'attributes':['id'],'include':[{'model':db[_0xd351('0x6f')],'as':'Agents','attributes':['id','name',_0xd351('0x74'),_0xd351('0x75'),_0xd351('0x76')],'raw':!![]}]})[_0xd351('0x22')](function(_0x1ddacf){if(_0x1ddacf){_0x581e66=_0x1ddacf;var _0x4cadbe=_[_0xd351('0x77')](_0x1ddacf,function(_0x269bf6){var _0x3da123=_0x269bf6[_0xd351('0x4e')]({'plain':!![]});return _0x3da123['Agents'];});return db[_0xd351('0x3f')][_0xd351('0x4f')]({'where':{'id':_0x6fd03b['params']['id']}})[_0xd351('0x22')](function(_0x46745f){return db[_0xd351('0x78')][_0xd351('0x49')](function(_0x37d882){return _0x46745f['addTeams'](_0x4ab9b9,{'transaction':_0x37d882})[_0xd351('0x22')](function(){return BPromise[_0xd351('0x79')](_0x581e66,function(_0x5ceda1){return db[_0xd351('0x7a')]['upsert']({'TeamId':_0x5ceda1['id'],'VoicePrefixId':_0x6fd03b[_0xd351('0x43')]['id']},{'transaction':_0x37d882});});})[_0xd351('0x22')](function(){return BPromise['each'](_0x4cadbe,function(_0x1f0812){return db[_0xd351('0x7b')][_0xd351('0x7c')]({'where':{'UserId':_0x1f0812['id'],'VoicePrefixId':_0x6fd03b[_0xd351('0x43')]['id']},'transaction':_0x37d882});});})[_0xd351('0x22')](function(){_0x4cadbe['forEach'](function(_0x23b2fe){socket['emit'](_0xd351('0x69'),{'UserId':_0x23b2fe['id'],'VoicePrefixId':_0x46745f['id']});});});});});}})[_0xd351('0x22')](respondWithStatusCode(_0x19d16a,null))[_0xd351('0x41')](handleError(_0x19d16a,null));};exports[_0xd351('0x7d')]=function(_0x160102,_0x24ac40,_0x3b2690){return db[_0xd351('0x71')][_0xd351('0x40')]({'where':{'id':_0x160102['query'][_0xd351('0x66')]},'attributes':['id'],'include':[{'model':db[_0xd351('0x6f')],'as':_0xd351('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xd351('0x22')](handleEntityNotFound(_0x24ac40,null))['then'](function(_0x280220){var _0x4f8f00=_[_0xd351('0x2b')](_0x280220,'id');var _0x107886=[];var _0x3a3633=[];var _0x403312=squel[_0xd351('0x7f')]();_0x403312['field'](_0xd351('0x80'))[_0xd351('0x81')]('team_has_voice_prefixes','tq')['join'](_0xd351('0x82'),'ut',_0xd351('0x83'))[_0xd351('0x39')](_0xd351('0x84'),_0x160102[_0xd351('0x43')]['id']);for(var _0x1373c0=0x0;_0x1373c0<_0x280220[_0xd351('0x44')];_0x1373c0+=0x1){let _0x78b55c=_0x280220[_0x1373c0];for(var _0x2de03c=0x0;_0x2de03c<_0x78b55c[_0xd351('0x7e')][_0xd351('0x44')];_0x2de03c+=0x1){let _0x6f4c1e=_0x78b55c[_0xd351('0x7e')][_0x2de03c];var _0x56b88b=_0x403312['clone']();_0x56b88b[_0xd351('0x39')]('ut.UserId\x20=\x20?',_0x6f4c1e['id']);_0x3a3633[_0xd351('0x5f')](db[_0xd351('0x78')][_0xd351('0x30')](_0x56b88b[_0xd351('0x85')](),{'type':db[_0xd351('0x78')][_0xd351('0x86')]['SELECT']})[_0xd351('0x22')](function(_0x2725c4){if(_0x2725c4['length']===0x1){return _0x6f4c1e['id'];}else{var _0x31c1dc=_['every'](_['map'](_0x2725c4,_0xd351('0x87')),function(_0x2f188b){return _['includes'](_0x4f8f00,_0x2f188b);});if(_0x31c1dc){return _0x6f4c1e['id'];}}}));}}return BPromise[_0xd351('0x88')](_0x3a3633)[_0xd351('0x22')](function(_0x5126a1){_0x107886=_(_0x107886)[_0xd351('0x89')](_0x5126a1)[_0xd351('0x8a')]()[_0xd351('0x8b')]();return db[_0xd351('0x3f')][_0xd351('0x4f')]({'where':{'id':_0x160102['params']['id']}})[_0xd351('0x22')](function(_0x1db9db){return db[_0xd351('0x78')][_0xd351('0x49')](function(_0x2ef116){return _0x1db9db[_0xd351('0x7d')](_0x160102[_0xd351('0x30')][_0xd351('0x66')],{'transaction':_0x2ef116})[_0xd351('0x22')](function(){if(!_[_0xd351('0x8c')](_0x107886)){return _0x1db9db[_0xd351('0x6a')](_0x107886,{'transaction':_0x2ef116});}})[_0xd351('0x22')](function(){_0x107886[_0xd351('0x8d')](function(_0x585e94){socket[_0xd351('0x68')](_0xd351('0x6c'),{'UserId':_0x585e94,'VoicePrefixId':_0x1db9db['id']});});});});});});})[_0xd351('0x22')](respondWithStatusCode(_0x24ac40,null))[_0xd351('0x41')](handleError(_0x24ac40,null));}; \ No newline at end of file +var _0xd943=['isArray','userVoicePrefix:remove','getAgents','User','getTeams','Team','addTeams','Agents','online','flatMap','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','name','index','map','VoicePrefix','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rawAttributes','merge','options','find','catch','params','describe','create','transaction','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','emit'];(function(_0x3078c9,_0x3667fb){var _0x2e1fe1=function(_0x5cbe85){while(--_0x5cbe85){_0x3078c9['push'](_0x3078c9['shift']());}};_0x2e1fe1(++_0x3667fb);}(_0xd943,0x15d));var _0x3d94=function(_0x3d69d4,_0x15847b){_0x3d69d4=_0x3d69d4-0x0;var _0x379d30=_0xd943[_0x3d69d4];return _0x379d30;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];config[_0x3d94('0x16')]=_['defaults'](config[_0x3d94('0x16')],{'host':_0x3d94('0x17'),'port':0x18eb});var socket=require(_0x3d94('0x18'))(new Redis(config['redis']));require(_0x3d94('0x19'))[_0x3d94('0x1a')](socket);function respondWithStatusCode(_0x7d6969,_0x5d9366){_0x5d9366=_0x5d9366||0xcc;return function(_0x14ea5f){if(_0x14ea5f){return _0x7d6969[_0x3d94('0x1b')](_0x5d9366);}return _0x7d6969[_0x3d94('0x1c')](_0x5d9366)[_0x3d94('0x1d')]();};}function respondWithResult(_0xaf939a,_0xd8efaa){_0xd8efaa=_0xd8efaa||0xc8;return function(_0x31c6e8){if(_0x31c6e8){return _0xaf939a[_0x3d94('0x1c')](_0xd8efaa)['json'](_0x31c6e8);}};}function respondWithFilteredResult(_0x22676a,_0x1a9315){return function(_0x2acee3){if(_0x2acee3){var _0x1c35a8=typeof _0x1a9315[_0x3d94('0x1e')]===_0x3d94('0x1f')&&typeof _0x1a9315[_0x3d94('0x20')]==='undefined';var _0x9bca24=_0x2acee3['count'];var _0x28bead=_0x1c35a8?0x0:_0x1a9315[_0x3d94('0x1e')];var _0x16a6d0=_0x1c35a8?_0x2acee3[_0x3d94('0x21')]:_0x1a9315[_0x3d94('0x1e')]+_0x1a9315['limit'];var _0x578002;if(_0x16a6d0>=_0x9bca24){_0x16a6d0=_0x9bca24;_0x578002=0xc8;}else{_0x578002=0xce;}_0x22676a[_0x3d94('0x1c')](_0x578002);return _0x22676a[_0x3d94('0x22')](_0x3d94('0x23'),_0x28bead+'-'+_0x16a6d0+'/'+_0x9bca24)['json'](_0x2acee3);}return null;};}function patchUpdates(_0x30af25){return function(_0x2e8c91){try{jsonpatch[_0x3d94('0x24')](_0x2e8c91,_0x30af25,!![]);}catch(_0x384f76){return BPromise[_0x3d94('0x25')](_0x384f76);}return _0x2e8c91[_0x3d94('0x26')]();};}function saveUpdates(_0x295493,_0x27f978){return function(_0xee7b8d){if(_0xee7b8d){return _0xee7b8d[_0x3d94('0x27')](_0x295493)[_0x3d94('0x28')](function(_0x192839){return _0x192839;});}return null;};}function removeEntity(_0x292976,_0x3496c3){return function(_0x2945d2){if(_0x2945d2){return _0x2945d2['destroy']()[_0x3d94('0x28')](function(){var _0x558fd2=_0x2945d2[_0x3d94('0x29')]({'plain':!![]});var _0x1d0a7a=_0x3d94('0x2a');return db[_0x3d94('0x2b')][_0x3d94('0x2c')]({'where':{'type':_0x1d0a7a,'resourceId':_0x558fd2['id']}})[_0x3d94('0x28')](function(){return _0x2945d2;});})[_0x3d94('0x28')](function(){_0x292976['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x362642,_0x4813e1){return function(_0x4dd410){if(!_0x4dd410){_0x362642[_0x3d94('0x1b')](0x194);}return _0x4dd410;};}function handleError(_0x58c0d0,_0x19bfd4){_0x19bfd4=_0x19bfd4||0x1f4;return function(_0xef9644){logger[_0x3d94('0x2d')](_0xef9644['stack']);if(_0xef9644[_0x3d94('0x2e')]){delete _0xef9644['name'];}_0x58c0d0[_0x3d94('0x1c')](_0x19bfd4)['send'](_0xef9644);};}exports[_0x3d94('0x2f')]=function(_0x215ad7,_0x29b1ff){var _0x246f88={},_0x50560c={},_0x18f854={'count':0x0,'rows':[]};var _0x51f634=_[_0x3d94('0x30')](db[_0x3d94('0x31')]['rawAttributes'],function(_0x5288da){return{'name':_0x5288da[_0x3d94('0x32')],'type':_0x5288da[_0x3d94('0x33')][_0x3d94('0x34')]};});_0x50560c['model']=_[_0x3d94('0x30')](_0x51f634,_0x3d94('0x2e'));_0x50560c['query']=_[_0x3d94('0x35')](_0x215ad7[_0x3d94('0x36')]);_0x50560c[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0x50560c[_0x3d94('0x39')],_0x50560c['query']);_0x246f88[_0x3d94('0x3a')]=_[_0x3d94('0x38')](_0x50560c[_0x3d94('0x39')],qs[_0x3d94('0x3b')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x3b')]));_0x246f88['attributes']=_0x246f88['attributes'][_0x3d94('0x3c')]?_0x246f88[_0x3d94('0x3a')]:_0x50560c[_0x3d94('0x39')];if(!_0x215ad7[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0x246f88[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x20')]);_0x246f88['offset']=qs[_0x3d94('0x1e')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x1e')]);}_0x246f88[_0x3d94('0x3f')]=qs['sort'](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x40')]);_0x246f88[_0x3d94('0x41')]=qs[_0x3d94('0x37')](_[_0x3d94('0x42')](_0x215ad7['query'],_0x50560c[_0x3d94('0x37')]),_0x51f634);if(_0x215ad7[_0x3d94('0x36')][_0x3d94('0x43')]){_0x246f88['where']=_['merge'](_0x246f88['where'],{'$or':_['map'](_0x51f634,function(_0x3b3550){if(_0x3b3550[_0x3d94('0x33')]!==_0x3d94('0x44')){var _0x146ccb={};_0x146ccb[_0x3b3550[_0x3d94('0x2e')]]={'$like':'%'+_0x215ad7[_0x3d94('0x36')][_0x3d94('0x43')]+'%'};return _0x146ccb;}})});}_0x246f88=_['merge']({},_0x246f88,_0x215ad7['options']);var _0x118fda={'where':_0x246f88[_0x3d94('0x41')]};return db['VoicePrefix'][_0x3d94('0x21')](_0x118fda)['then'](function(_0x1361fb){_0x18f854[_0x3d94('0x21')]=_0x1361fb;if(_0x215ad7[_0x3d94('0x36')][_0x3d94('0x45')]){_0x246f88[_0x3d94('0x46')]=[{'all':!![]}];}return db['VoicePrefix'][_0x3d94('0x47')](_0x246f88);})[_0x3d94('0x28')](function(_0x18a70c){_0x18f854['rows']=_0x18a70c;return _0x18f854;})[_0x3d94('0x28')](respondWithFilteredResult(_0x29b1ff,_0x246f88))['catch'](handleError(_0x29b1ff,null));};exports['show']=function(_0x3f4b32,_0x402132){var _0x6190cc={'raw':![],'where':{'id':_0x3f4b32['params']['id']}},_0xfeae3a={};_0xfeae3a[_0x3d94('0x39')]=_['keys'](db[_0x3d94('0x31')][_0x3d94('0x48')]);_0xfeae3a[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x3f4b32[_0x3d94('0x36')]);_0xfeae3a[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0xfeae3a['model'],_0xfeae3a[_0x3d94('0x36')]);_0x6190cc[_0x3d94('0x3a')]=_['intersection'](_0xfeae3a['model'],qs[_0x3d94('0x3b')](_0x3f4b32[_0x3d94('0x36')]['fields']));_0x6190cc[_0x3d94('0x3a')]=_0x6190cc[_0x3d94('0x3a')][_0x3d94('0x3c')]?_0x6190cc[_0x3d94('0x3a')]:_0xfeae3a[_0x3d94('0x39')];if(_0x3f4b32[_0x3d94('0x36')][_0x3d94('0x45')]){_0x6190cc[_0x3d94('0x46')]=[{'all':!![]}];}_0x6190cc=_[_0x3d94('0x49')]({},_0x6190cc,_0x3f4b32[_0x3d94('0x4a')]);return db[_0x3d94('0x31')][_0x3d94('0x4b')](_0x6190cc)[_0x3d94('0x28')](handleEntityNotFound(_0x402132,null))[_0x3d94('0x28')](respondWithResult(_0x402132,null))[_0x3d94('0x4c')](handleError(_0x402132,null));};exports['destroy']=function(_0x44df82,_0x22e2b8){return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x44df82[_0x3d94('0x4d')]['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x22e2b8,null))[_0x3d94('0x28')](removeEntity(_0x22e2b8,null))[_0x3d94('0x4c')](handleError(_0x22e2b8,null));};exports[_0x3d94('0x4e')]=function(_0x5465a5,_0x88ec05){return db['VoicePrefix'][_0x3d94('0x4e')]()[_0x3d94('0x28')](respondWithResult(_0x88ec05,null))['catch'](handleError(_0x88ec05,null));};exports[_0x3d94('0x4f')]=function(_0x49f544,_0x567751){var _0x335247;return db['sequelize'][_0x3d94('0x50')](function(_0x132e0b){return db['VoicePrefix'][_0x3d94('0x4f')](_0x49f544['body'],{'transaction':_0x132e0b})['then'](function(_0x1a91d9){_0x335247=_0x1a91d9[_0x3d94('0x29')]({'plain':!![]});return db[_0x3d94('0x51')][_0x3d94('0x4b')]({'where':{'id':_0x335247[_0x3d94('0x52')]},'raw':!![]})[_0x3d94('0x28')](function(_0x137052){return createVoicePrefixExtensions(_0x335247,_0x137052,_0x132e0b);});});})[_0x3d94('0x28')](function(){var _0xae892=_0x49f544['user'][_0x3d94('0x29')]({'plain':!![]});if(!_0xae892)throw new Error(_0x3d94('0x53'));if(_0xae892[_0x3d94('0x54')]===_0x3d94('0x55')){var _0xe7d1dc=_0x335247;return db[_0x3d94('0x56')][_0x3d94('0x4b')]({'where':{'name':_0x3d94('0x2a'),'userProfileId':_0xae892[_0x3d94('0x57')]},'raw':!![]})[_0x3d94('0x28')](function(_0x1fd806){if(_0x1fd806&&_0x1fd806['autoAssociation']===0x0){return db[_0x3d94('0x2b')]['create']({'name':_0xe7d1dc[_0x3d94('0x2e')],'resourceId':_0xe7d1dc['id'],'type':_0x1fd806[_0x3d94('0x2e')],'sectionId':_0x1fd806['id']},{})[_0x3d94('0x28')](function(){return _0x335247;});}else{return _0x335247;}})[_0x3d94('0x4c')](function(_0x3a837b){logger[_0x3d94('0x2d')](_0x3d94('0x58'),_0x3a837b);throw _0x3a837b;});}return _0x335247;})[_0x3d94('0x28')](respondWithResult(_0x567751,null))[_0x3d94('0x4c')](handleError(_0x567751,null));};function Extension(_0x5da38c,_0x519ada,_0x46bff3,_0x4bd97c){this[_0x3d94('0x59')]=_0x3d94('0x5a');this['exten']=_0x5da38c;this[_0x3d94('0x5b')]=_0x46bff3;this[_0x3d94('0x33')]=_0x3d94('0x5c');this[_0x3d94('0x5d')]=_0x3d94('0x5e');this[_0x3d94('0x5f')]=_0x519ada;this[_0x3d94('0x60')]=_0x4bd97c;}function createVoicePrefixExtensions(_0x4b023e,_0x22dbf9,_0x351ea6){return new BPromise(function(_0x368581,_0x4b23b5){var _0x2d8b49=new Extension(formatPrefixName(_0x4b023e[_0x3d94('0x61')]),0x1,_0x3d94('0x62'),_0x3d94('0x63'));_0x2d8b49['VoicePrefixId']=_0x4b023e['id'];return db['VoiceExtension'][_0x3d94('0x4f')](_0x2d8b49,{'transaction':_0x351ea6})[_0x3d94('0x28')](function(_0x4190ef){var _0x3eaecc=_0x4190ef['get']({'plain':!![]});var _0x1c12da=_[_0x3d94('0x30')](addVoicePrefixExtensions(_0x4b023e,_0x22dbf9),function(_0x49bfb0){_0x49bfb0[_0x3d94('0x52')]=_0x3eaecc['id'];_0x49bfb0[_0x3d94('0x64')]=_0x4b023e['id'];return _0x49bfb0;});return db[_0x3d94('0x51')]['bulkCreate'](_0x1c12da,{'transaction':_0x351ea6})[_0x3d94('0x28')](function(_0x227372){if(!_0x227372){return _0x4b23b5(_0x3d94('0x65'));}else{return _0x368581(_0x227372);}})['catch'](function(_0x11eeaa){return _0x4b23b5(_0x11eeaa);});});;});};function addVoicePrefixExtensions(_0x68c033,_0x5c7aac){var _0x4d291e=[];var _0x4e1932=formatPrefixName(_0x68c033[_0x3d94('0x61')]);_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x2,_0x3d94('0x67'),_0x3d94('0x68')+_0x68c033[_0x3d94('0x2e')]));if(_0x68c033['callerIdAll']){_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x3,_0x3d94('0x67'),_0x3d94('0x69')+_0x68c033[_0x3d94('0x6a')]));}else{_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x3,_0x3d94('0x62'),'No\x20callerid\x20available'));}_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x4,'goto',_0x5c7aac[_0x3d94('0x59')]+','+_0x3d94('0x6b')+(0x8+_0x68c033[_0x3d94('0x2e')][_0x3d94('0x3c')])+'}'+','+0x1));return _0x4d291e;}function formatPrefixName(_0x128fdc){var _0x350ad3='_';for(var _0x48b108=0x0;_0x48b108<_0x128fdc['length'];_0x48b108++){if(_0x128fdc[_0x3d94('0x6c')](_0x48b108)=='-'){_0x350ad3+=_0x128fdc['charAt'](_0x48b108);}else{_0x350ad3+='['+_0x128fdc['charAt'](_0x48b108)+']';}}_0x350ad3+='.';return _0x350ad3;}exports['update']=function(_0x3c7dc4,_0x262a6a,_0x222963){var _0x396146=_0x3c7dc4[_0x3d94('0x6d')];_0x396146[_0x3d94('0x61')]=_0x3d94('0x6e')+_0x396146[_0x3d94('0x2e')]+'-';return db['sequelize'][_0x3d94('0x50')](function(_0x5e55a4){return db[_0x3d94('0x31')][_0x3d94('0x27')](_0x396146,{'where':{'id':_0x396146['id']},'transaction':_0x5e55a4})[_0x3d94('0x28')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x396146['id']},'transaction':_0x5e55a4})['then'](function(){return db[_0x3d94('0x51')][_0x3d94('0x4b')]({'where':{'id':_0x396146[_0x3d94('0x52')]},'raw':!![]})[_0x3d94('0x28')](function(_0x2382df){return createVoicePrefixExtensions(_0x396146,_0x2382df,_0x5e55a4);});});});})['then'](function(){return db['VoicePrefix'][_0x3d94('0x6f')](_0x396146['id']);})[_0x3d94('0x28')](respondWithResult(_0x262a6a,null))[_0x3d94('0x4c')](handleError(_0x262a6a,null));};exports['addAgents']=function(_0x46a9af,_0x53d471,_0x255d56){return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x46a9af[_0x3d94('0x4d')]['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x53d471,null))[_0x3d94('0x28')](function(_0x234bce){if(_0x234bce){return _0x234bce[_0x3d94('0x70')](_0x46a9af[_0x3d94('0x6d')][_0x3d94('0x71')],_[_0x3d94('0x72')](_0x46a9af[_0x3d94('0x6d')],[_0x3d94('0x71'),'id'])||{})['spread'](function(_0x2a6df3){for(var _0x2819e2=0x0;_0x2819e2<_0x46a9af[_0x3d94('0x6d')][_0x3d94('0x71')]['length'];_0x2819e2+=0x1){socket[_0x3d94('0x73')]('userVoicePrefix:save',{'UserId':Number(_0x46a9af['body'][_0x3d94('0x71')][_0x2819e2]),'VoicePrefixId':Number(_0x46a9af['params']['id'])});}return _0x2a6df3;});}})[_0x3d94('0x28')](respondWithResult(_0x53d471,null))[_0x3d94('0x4c')](handleError(_0x53d471,null));};exports['removeAgents']=function(_0x4558ff,_0x4acb44,_0x3b612f){return db[_0x3d94('0x31')]['find']({'where':{'id':_0x4558ff['params']['id']}})['then'](handleEntityNotFound(_0x4acb44,null))[_0x3d94('0x28')](function(_0x5b2dd6){if(_0x5b2dd6){return _0x5b2dd6['removeAgents'](_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')])[_0x3d94('0x28')](function(){if(_[_0x3d94('0x74')](_0x4558ff['query'][_0x3d94('0x71')])){for(var _0x3fc0e7=0x0;_0x3fc0e7<_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')][_0x3d94('0x3c')];_0x3fc0e7+=0x1){socket[_0x3d94('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')][_0x3fc0e7]),'VoicePrefixId':Number(_0x4558ff[_0x3d94('0x4d')]['id'])});}}else{socket[_0x3d94('0x73')](_0x3d94('0x75'),{'UserId':Number(_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')]),'VoicePrefixId':Number(_0x4558ff[_0x3d94('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x4acb44,null))['catch'](handleError(_0x4acb44,null));};exports[_0x3d94('0x76')]=function(_0x23b1a6,_0x970b44,_0x561e65){var _0x43a00e={};var _0xa193a1={};var _0x43192c;var _0xdb96c0;return db[_0x3d94('0x31')]['findOne']({'where':{'id':_0x23b1a6['params']['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x970b44,null))[_0x3d94('0x28')](function(_0x274a82){if(_0x274a82){_0x43192c=_0x274a82;_0xa193a1[_0x3d94('0x39')]=_[_0x3d94('0x35')](db[_0x3d94('0x77')][_0x3d94('0x48')]);_0xa193a1[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x23b1a6[_0x3d94('0x36')]);_0xa193a1[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0xa193a1[_0x3d94('0x39')],_0xa193a1['query']);_0x43a00e[_0x3d94('0x3a')]=_[_0x3d94('0x38')](_0xa193a1['model'],qs['fields'](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x3b')]));_0x43a00e[_0x3d94('0x3a')]=_0x43a00e[_0x3d94('0x3a')]['length']?_0x43a00e['attributes']:_0xa193a1[_0x3d94('0x39')];_0x43a00e[_0x3d94('0x3f')]=qs[_0x3d94('0x40')](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x40')]);_0x43a00e['where']=qs[_0x3d94('0x37')](_['pick'](_0x23b1a6[_0x3d94('0x36')],_0xa193a1[_0x3d94('0x37')]));if(_0x23b1a6[_0x3d94('0x36')]['filter']){_0x43a00e[_0x3d94('0x41')]=_[_0x3d94('0x49')](_0x43a00e['where'],{'$or':_[_0x3d94('0x30')](_0x43a00e['attributes'],function(_0x3c62ec){var _0x401772={};_0x401772[_0x3c62ec]={'$like':'%'+_0x23b1a6[_0x3d94('0x36')]['filter']+'%'};return _0x401772;})});}_0x43a00e=_[_0x3d94('0x49')]({},_0x43a00e,_0x23b1a6[_0x3d94('0x4a')]);return _0x43192c[_0x3d94('0x76')](_0x43a00e);}})['then'](function(_0x3e091a){if(_0x3e091a){_0xdb96c0=_0x3e091a[_0x3d94('0x3c')];if(!_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0x43a00e[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x23b1a6[_0x3d94('0x36')]['limit']);_0x43a00e[_0x3d94('0x1e')]=qs[_0x3d94('0x1e')](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x1e')]);}return _0x43192c[_0x3d94('0x76')](_0x43a00e);}})[_0x3d94('0x28')](function(_0x5716fd){if(_0x5716fd){return _0x5716fd?{'count':_0xdb96c0,'rows':_0x5716fd}:null;}})[_0x3d94('0x28')](respondWithResult(_0x970b44,null))[_0x3d94('0x4c')](handleError(_0x970b44,null));};exports[_0x3d94('0x78')]=function(_0x59b62b,_0x3fc2f2,_0x4c6c49){var _0xe85875={};var _0x3ed74f={};var _0x490d77;var _0x73b09c;return db[_0x3d94('0x31')]['findOne']({'where':{'id':_0x59b62b['params']['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x3fc2f2,null))[_0x3d94('0x28')](function(_0x48a22f){if(_0x48a22f){_0x490d77=_0x48a22f;_0x3ed74f['model']=_['keys'](db[_0x3d94('0x79')][_0x3d94('0x48')]);_0x3ed74f[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x59b62b[_0x3d94('0x36')]);_0x3ed74f['filters']=_[_0x3d94('0x38')](_0x3ed74f[_0x3d94('0x39')],_0x3ed74f[_0x3d94('0x36')]);_0xe85875['attributes']=_[_0x3d94('0x38')](_0x3ed74f['model'],qs[_0x3d94('0x3b')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x3b')]));_0xe85875[_0x3d94('0x3a')]=_0xe85875[_0x3d94('0x3a')]['length']?_0xe85875['attributes']:_0x3ed74f[_0x3d94('0x39')];_0xe85875[_0x3d94('0x3f')]=qs['sort'](_0x59b62b[_0x3d94('0x36')]['sort']);_0xe85875[_0x3d94('0x41')]=qs[_0x3d94('0x37')](_[_0x3d94('0x42')](_0x59b62b['query'],_0x3ed74f[_0x3d94('0x37')]));if(_0x59b62b['query'][_0x3d94('0x43')]){_0xe85875[_0x3d94('0x41')]=_[_0x3d94('0x49')](_0xe85875[_0x3d94('0x41')],{'$or':_['map'](_0xe85875['attributes'],function(_0x11ff83){var _0x26e454={};_0x26e454[_0x11ff83]={'$like':'%'+_0x59b62b[_0x3d94('0x36')][_0x3d94('0x43')]+'%'};return _0x26e454;})});}_0xe85875=_['merge']({},_0xe85875,_0x59b62b[_0x3d94('0x4a')]);return _0x490d77['getTeams'](_0xe85875);}})['then'](function(_0x543b1a){if(_0x543b1a){_0x73b09c=_0x543b1a[_0x3d94('0x3c')];if(!_0x59b62b[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0xe85875[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x20')]);_0xe85875[_0x3d94('0x1e')]=qs[_0x3d94('0x1e')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x1e')]);}return _0x490d77[_0x3d94('0x78')](_0xe85875);}})[_0x3d94('0x28')](function(_0x140ad1){if(_0x140ad1){return _0x140ad1?{'count':_0x73b09c,'rows':_0x140ad1}:null;}})['then'](respondWithResult(_0x3fc2f2,null))['catch'](handleError(_0x3fc2f2,null));};exports[_0x3d94('0x7a')]=function(_0x3ff668,_0x1837c9,_0x41251d){var _0x876bcc=_0x3ff668[_0x3d94('0x6d')][_0x3d94('0x71')];var _0x47ab6a;return db[_0x3d94('0x79')][_0x3d94('0x47')]({'where':{'id':_0x876bcc},'attributes':['id'],'include':[{'model':db[_0x3d94('0x77')],'as':_0x3d94('0x7b'),'attributes':['id',_0x3d94('0x2e'),_0x3d94('0x7c'),'voicePause','interface'],'raw':!![]}]})[_0x3d94('0x28')](function(_0x50e8ba){if(_0x50e8ba){_0x47ab6a=_0x50e8ba;var _0x248fbe=_[_0x3d94('0x7d')](_0x50e8ba,function(_0x350751){var _0x16853d=_0x350751[_0x3d94('0x29')]({'plain':!![]});return _0x16853d[_0x3d94('0x7b')];});return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x3ff668['params']['id']}})[_0x3d94('0x28')](function(_0x2c8a2f){return db[_0x3d94('0x7e')][_0x3d94('0x50')](function(_0x22e7ff){return _0x2c8a2f[_0x3d94('0x7a')](_0x876bcc,{'transaction':_0x22e7ff})[_0x3d94('0x28')](function(){return BPromise[_0x3d94('0x7f')](_0x47ab6a,function(_0x1c7315){return db[_0x3d94('0x80')][_0x3d94('0x81')]({'TeamId':_0x1c7315['id'],'VoicePrefixId':_0x3ff668[_0x3d94('0x4d')]['id']},{'transaction':_0x22e7ff});});})[_0x3d94('0x28')](function(){return BPromise[_0x3d94('0x7f')](_0x248fbe,function(_0x2d02db){return db[_0x3d94('0x82')][_0x3d94('0x83')]({'where':{'UserId':_0x2d02db['id'],'VoicePrefixId':_0x3ff668[_0x3d94('0x4d')]['id']},'transaction':_0x22e7ff});});})[_0x3d94('0x28')](function(){_0x248fbe[_0x3d94('0x84')](function(_0xb55889){socket['emit'](_0x3d94('0x85'),{'UserId':_0xb55889['id'],'VoicePrefixId':_0x2c8a2f['id']});});});});});}})[_0x3d94('0x28')](respondWithStatusCode(_0x1837c9,null))[_0x3d94('0x4c')](handleError(_0x1837c9,null));};exports[_0x3d94('0x86')]=function(_0x434b19,_0x185592,_0x594800){return db[_0x3d94('0x79')][_0x3d94('0x47')]({'where':{'id':_0x434b19[_0x3d94('0x36')][_0x3d94('0x71')]},'attributes':['id'],'include':[{'model':db[_0x3d94('0x77')],'as':_0x3d94('0x7b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x185592,null))[_0x3d94('0x28')](function(_0x4ff1a0){var _0x577fd0=_['map'](_0x4ff1a0,'id');var _0x4a1faa=[];var _0x3e1139=[];var _0x77b79d=squel[_0x3d94('0x87')]();_0x77b79d[_0x3d94('0x88')](_0x3d94('0x89'))['from'](_0x3d94('0x8a'),'tq')[_0x3d94('0x8b')](_0x3d94('0x8c'),'ut',_0x3d94('0x8d'))[_0x3d94('0x41')](_0x3d94('0x8e'),_0x434b19['params']['id']);for(var _0x167d4c=0x0;_0x167d4c<_0x4ff1a0['length'];_0x167d4c+=0x1){let _0x219757=_0x4ff1a0[_0x167d4c];for(var _0xb970e1=0x0;_0xb970e1<_0x219757[_0x3d94('0x7b')][_0x3d94('0x3c')];_0xb970e1+=0x1){let _0x5df8b4=_0x219757[_0x3d94('0x7b')][_0xb970e1];var _0x2e409b=_0x77b79d[_0x3d94('0x8f')]();_0x2e409b[_0x3d94('0x41')]('ut.UserId\x20=\x20?',_0x5df8b4['id']);_0x3e1139['push'](db[_0x3d94('0x7e')][_0x3d94('0x36')](_0x2e409b[_0x3d94('0x90')](),{'type':db['sequelize'][_0x3d94('0x91')]['SELECT']})['then'](function(_0x560fdf){if(_0x560fdf[_0x3d94('0x3c')]===0x1){return _0x5df8b4['id'];}else{var _0x4ae177=_[_0x3d94('0x92')](_[_0x3d94('0x30')](_0x560fdf,_0x3d94('0x93')),function(_0x5ed8e8){return _[_0x3d94('0x94')](_0x577fd0,_0x5ed8e8);});if(_0x4ae177){return _0x5df8b4['id'];}}}));}}return BPromise[_0x3d94('0x95')](_0x3e1139)['then'](function(_0x551002){_0x4a1faa=_(_0x4a1faa)[_0x3d94('0x96')](_0x551002)[_0x3d94('0x97')]()[_0x3d94('0x98')]();return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x434b19[_0x3d94('0x4d')]['id']}})['then'](function(_0x54651a){return db['sequelize']['transaction'](function(_0x3c736a){return _0x54651a[_0x3d94('0x86')](_0x434b19[_0x3d94('0x36')][_0x3d94('0x71')],{'transaction':_0x3c736a})[_0x3d94('0x28')](function(){if(!_[_0x3d94('0x99')](_0x4a1faa)){return _0x54651a[_0x3d94('0x9a')](_0x4a1faa,{'transaction':_0x3c736a});}})[_0x3d94('0x28')](function(){_0x4a1faa[_0x3d94('0x84')](function(_0x414b82){socket[_0x3d94('0x73')]('userVoicePrefix:remove',{'UserId':_0x414b82,'VoicePrefixId':_0x54651a['id']});});});});});});})[_0x3d94('0x28')](respondWithStatusCode(_0x185592,null))['catch'](handleError(_0x185592,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6aa259d..0c8f91d 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfdd=['remove','emit','hasOwnProperty','exports','events','VoicePrefix','setMaxListeners','update'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xdfdd,0x11c));var _0xddfd=function(_0x5906bd,_0x37591b){_0x5906bd=_0x5906bd-0x0;var _0x2cd392=_0xdfdd[_0x5906bd];return _0x2cd392;};'use strict';var EventEmitter=require(_0xddfd('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xddfd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xddfd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xddfd('0x3'),'afterDestroy':_0xddfd('0x4')};function emitEvent(_0x20924a){return function(_0x68de92,_0x5b9a13,_0x25e553){VoicePrefixEvents[_0xddfd('0x5')](_0x20924a+':'+_0x68de92['id'],_0x68de92);VoicePrefixEvents[_0xddfd('0x5')](_0x20924a,_0x68de92);_0x25e553(null);};}for(var e in events){if(events[_0xddfd('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xddfd('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x21ef=['update','remove','emit','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x174e96,_0x2ef390){var _0x40117c=function(_0x339162){while(--_0x339162){_0x174e96['push'](_0x174e96['shift']());}};_0x40117c(++_0x2ef390);}(_0x21ef,0x1e5));var _0xf21e=function(_0x39f509,_0x3a3e3d){_0x39f509=_0x39f509-0x0;var _0x52b7b4=_0x21ef[_0x39f509];return _0x52b7b4;};'use strict';var EventEmitter=require(_0xf21e('0x0'));var VoicePrefix=require(_0xf21e('0x1'))['db'][_0xf21e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xf21e('0x3')](0x0);var events={'afterCreate':_0xf21e('0x4'),'afterUpdate':_0xf21e('0x5'),'afterDestroy':_0xf21e('0x6')};function emitEvent(_0x1d81cc){return function(_0x5d8ae1,_0xda1648,_0x434f36){VoicePrefixEvents[_0xf21e('0x7')](_0x1d81cc+':'+_0x5d8ae1['id'],_0x5d8ae1);VoicePrefixEvents['emit'](_0x1d81cc,_0x5d8ae1);_0x434f36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xf21e('0x8')](e,emitEvent(event));}}module[_0xf21e('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 9a43ac6..4688a15 100644 --- a/server/api/voicePrefix/voicePrefix.model.js +++ b/server/api/voicePrefix/voicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe55e=['exports','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0x9faff7,_0x59a564){var _0x4f8043=function(_0x5f060d){while(--_0x5f060d){_0x9faff7['push'](_0x9faff7['shift']());}};_0x4f8043(++_0x59a564);}(_0xe55e,0x1d7));var _0xee55=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe55e[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0xee55('0x0'));var logger=require('../../config/logger')(_0xee55('0x1'));var moment=require(_0xee55('0x2'));var BPromise=require(_0xee55('0x3'));var rp=require(_0xee55('0x4'));var fs=require('fs');var path=require(_0xee55('0x5'));var rimraf=require(_0xee55('0x6'));var config=require(_0xee55('0x7'));var attributes=require(_0xee55('0x8'));module[_0xee55('0x9')]=function(_0x4d7d42,_0x303939){return _0x4d7d42['define']('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0447=['voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x5859d3,_0x26b667){var _0x1698f0=function(_0x15bce2){while(--_0x15bce2){_0x5859d3['push'](_0x5859d3['shift']());}};_0x1698f0(++_0x26b667);}(_0x0447,0x6f));var _0x7044=function(_0xa042a2,_0x59f0b9){_0xa042a2=_0xa042a2-0x0;var _0x398132=_0x0447[_0xa042a2];return _0x398132;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var logger=require(_0x7044('0x2'))(_0x7044('0x3'));var moment=require(_0x7044('0x4'));var BPromise=require('bluebird');var rp=require(_0x7044('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7044('0x6'));var attributes=require(_0x7044('0x7'));module[_0x7044('0x8')]=function(_0x36dcec,_0x473f9d){return _0x36dcec[_0x7044('0x9')]('VoicePrefix',attributes,{'tableName':_0x7044('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index c13752e..e06e9f6 100644 --- a/server/api/voicePrefix/voicePrefix.rpc.js +++ b/server/api/voicePrefix/voicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24bb=['result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x1daf58,_0x5254fc){var _0x237a3c=function(_0x44aed8){while(--_0x44aed8){_0x1daf58['push'](_0x1daf58['shift']());}};_0x237a3c(++_0x5254fc);}(_0x24bb,0x19f));var _0xb24b=function(_0x5ed7e2,_0x49b88a){_0x5ed7e2=_0x5ed7e2-0x0;var _0x22cf44=_0x24bb[_0x5ed7e2];return _0x22cf44;};'use strict';var _=require(_0xb24b('0x0'));var util=require('util');var moment=require(_0xb24b('0x1'));var BPromise=require('bluebird');var rs=require(_0xb24b('0x2'));var fs=require('fs');var Redis=require(_0xb24b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb24b('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb24b('0x5'));var jayson=require(_0xb24b('0x6'));var client=jayson[_0xb24b('0x7')]['http']({'port':0x232a});config['redis']=_[_0xb24b('0x8')](config[_0xb24b('0x9')],{'host':_0xb24b('0xa'),'port':0x18eb});var socket=require(_0xb24b('0xb'))(new Redis(config[_0xb24b('0x9')]));require(_0xb24b('0xc'))[_0xb24b('0xd')](socket);function respondWithRpcPromise(_0x339286,_0x50acfe,_0x3bb468){return new BPromise(function(_0x450c9c,_0x3d68d3){return client[_0xb24b('0xe')](_0x339286,_0x3bb468)['then'](function(_0x48b94b){logger[_0xb24b('0xf')](_0xb24b('0x10'),_0x50acfe,'request\x20sent');logger[_0xb24b('0x11')](_0xb24b('0x12'),_0x50acfe,_0xb24b('0x13'),JSON['stringify'](_0x48b94b));if(_0x48b94b[_0xb24b('0x14')]){if(_0x48b94b[_0xb24b('0x14')]['code']===0x1f4){logger[_0xb24b('0x14')](_0xb24b('0x10'),_0x50acfe,_0x48b94b[_0xb24b('0x14')][_0xb24b('0x15')]);return _0x3d68d3(_0x48b94b[_0xb24b('0x14')]['message']);}logger[_0xb24b('0x14')](_0xb24b('0x10'),_0x50acfe,_0x48b94b[_0xb24b('0x14')][_0xb24b('0x15')]);return _0x450c9c(_0x48b94b[_0xb24b('0x14')][_0xb24b('0x15')]);}else{logger[_0xb24b('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x50acfe,_0xb24b('0x13'));_0x450c9c(_0x48b94b[_0xb24b('0x16')][_0xb24b('0x15')]);}})['catch'](function(_0x70294){logger[_0xb24b('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x50acfe,_0x70294);_0x3d68d3(_0x70294);});});} \ No newline at end of file +var _0x282a=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x282a,0xa2));var _0xa282=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x282a[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var util=require(_0xa282('0x0'));var moment=require(_0xa282('0x1'));var BPromise=require(_0xa282('0x2'));var rs=require(_0xa282('0x3'));var fs=require('fs');var Redis=require(_0xa282('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa282('0x5'));var logger=require(_0xa282('0x6'))('rpc');var config=require(_0xa282('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa282('0x8')]['http']({'port':0x232a});config[_0xa282('0x9')]=_[_0xa282('0xa')](config[_0xa282('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa282('0xb'))(new Redis(config['redis']));require(_0xa282('0xc'))[_0xa282('0xd')](socket);function respondWithRpcPromise(_0x375b36,_0x8bb6a0,_0x10876a){return new BPromise(function(_0x117ec7,_0x9a296c){return client[_0xa282('0xe')](_0x375b36,_0x10876a)[_0xa282('0xf')](function(_0x1509a0){logger[_0xa282('0x10')](_0xa282('0x11'),_0x8bb6a0,_0xa282('0x12'));logger[_0xa282('0x13')](_0xa282('0x14'),_0x8bb6a0,_0xa282('0x12'),JSON[_0xa282('0x15')](_0x1509a0));if(_0x1509a0[_0xa282('0x16')]){if(_0x1509a0['error'][_0xa282('0x17')]===0x1f4){logger[_0xa282('0x16')](_0xa282('0x11'),_0x8bb6a0,_0x1509a0[_0xa282('0x16')][_0xa282('0x18')]);return _0x9a296c(_0x1509a0['error']['message']);}logger[_0xa282('0x16')](_0xa282('0x11'),_0x8bb6a0,_0x1509a0[_0xa282('0x16')][_0xa282('0x18')]);return _0x117ec7(_0x1509a0[_0xa282('0x16')]['message']);}else{logger['info'](_0xa282('0x11'),_0x8bb6a0,_0xa282('0x12'));_0x117ec7(_0x1509a0[_0xa282('0x19')][_0xa282('0x18')]);}})[_0xa282('0x1a')](function(_0x36f3a0){logger[_0xa282('0x16')](_0xa282('0x11'),_0x8bb6a0,_0x36f3a0);_0x9a296c(_0x36f3a0);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index e46b1d8..1e29a1d 100644 --- a/server/api/voicePrefix/voicePrefix.socket.js +++ b/server/api/voicePrefix/voicePrefix.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84e1=['emit','removeListener','register','length','./voicePrefix.events','save','remove','update'];(function(_0x3bc8b8,_0x3e8590){var _0x2f9a17=function(_0x301e4f){while(--_0x301e4f){_0x3bc8b8['push'](_0x3bc8b8['shift']());}};_0x2f9a17(++_0x3e8590);}(_0x84e1,0x1dc));var _0x184e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x84e1[_0x11005e];return _0x29338f;};'use strict';var VoicePrefixEvents=require(_0x184e('0x0'));var events=[_0x184e('0x1'),_0x184e('0x2'),_0x184e('0x3')];function createListener(_0x324aaa,_0x4df769){return function(_0x5c6973){_0x4df769[_0x184e('0x4')](_0x324aaa,_0x5c6973);};}function removeListener(_0x5fe43b,_0x26826d){return function(){VoicePrefixEvents[_0x184e('0x5')](_0x5fe43b,_0x26826d);};}exports[_0x184e('0x6')]=function(_0x86a78e){for(var _0x396183=0x0,_0x4ad2c3=events[_0x184e('0x7')];_0x396183<_0x4ad2c3;_0x396183++){var _0xa32654=events[_0x396183];var _0x1e79b2=createListener('voicePrefix:'+_0xa32654,_0x86a78e);VoicePrefixEvents['on'](_0xa32654,_0x1e79b2);}}; \ No newline at end of file +var _0xbee3=['register','length','voicePrefix:','save','emit'];(function(_0x5cdc23,_0x1d6581){var _0x277267=function(_0x42d65e){while(--_0x42d65e){_0x5cdc23['push'](_0x5cdc23['shift']());}};_0x277267(++_0x1d6581);}(_0xbee3,0xd5));var _0x3bee=function(_0x232c7a,_0x3fa4fa){_0x232c7a=_0x232c7a-0x0;var _0x37d42d=_0xbee3[_0x232c7a];return _0x37d42d;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x3bee('0x0'),'remove','update'];function createListener(_0x45a1bf,_0x27f822){return function(_0x4945a7){_0x27f822[_0x3bee('0x1')](_0x45a1bf,_0x4945a7);};}function removeListener(_0x1956c1,_0x1cf379){return function(){VoicePrefixEvents['removeListener'](_0x1956c1,_0x1cf379);};}exports[_0x3bee('0x2')]=function(_0x3baf77){for(var _0x4c5ef5=0x0,_0x2fdeec=events[_0x3bee('0x3')];_0x4c5ef5<_0x2fdeec;_0x4c5ef5++){var _0x1b510d=events[_0x4c5ef5];var _0x339223=createListener(_0x3bee('0x4')+_0x1b510d,_0x3baf77);VoicePrefixEvents['on'](_0x1b510d,_0x339223);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d0a9b99..3c4121b 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x452630,_0x1c0fc4){var _0x31ebec=function(_0x18cb48){while(--_0x18cb48){_0x452630['push'](_0x452630['shift']());}};_0x31ebec(++_0x1c0fc4);}(_0xb10b,0x12a));var _0xbb10=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xb10b[_0xf79bae];return _0x5d2cb7;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x3382e1,_0x1b69ee){var _0x166bd5=function(_0x548a6d){while(--_0x548a6d){_0x3382e1['push'](_0x3382e1['shift']());}};_0x166bd5(++_0x1b69ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 14a9db6..8875c8b 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14ec=['ENUM','inbound','outbound','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x5304d9,_0x46d26f){var _0xcbb27e=function(_0x7124f5){while(--_0x7124f5){_0x5304d9['push'](_0x5304d9['shift']());}};_0xcbb27e(++_0x46d26f);}(_0x14ec,0x18d));var _0xc14e=function(_0x556e42,_0x3f0ae8){_0x556e42=_0x556e42-0x0;var _0x5a75cd=_0x14ec[_0x556e42];return _0x5a75cd;};'use strict';var Sequelize=require(_0xc14e('0x0'));module[_0xc14e('0x1')]={'name':{'type':Sequelize[_0xc14e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc14e('0x3')](_0xc14e('0x4'),_0xc14e('0x5')),'allowNull':![],'defaultValue':_0xc14e('0x4')},'musiconhold':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc14e('0x3')]('rr','ringall',_0xc14e('0x6'),_0xc14e('0x7'),_0xc14e('0x8'),_0xc14e('0x9'),_0xc14e('0xa'),_0xc14e('0xb'),_0xc14e('0xc')),'allowNull':![],'defaultValue':_0xc14e('0xd'),'set':function(_0x18e92d){this[_0xc14e('0xe')](_0xc14e('0xf'),_0x18e92d?_0x18e92d:_0xc14e('0x9'));},'get':function(){var _0x3e104a=this[_0xc14e('0x10')]('type');var _0x2de756=this[_0xc14e('0x10')](_0xc14e('0x11'));var _0x7c4768=this['getDataValue'](_0xc14e('0xf'));if(_0x3e104a===_0xc14e('0x4')){return _0x7c4768;}if(_0x2de756===_0xc14e('0x12')&&_0x7c4768===_0xc14e('0x9')||_0x2de756===_0xc14e('0x12')&&_0x7c4768===_0xc14e('0x13')){return _0x7c4768;}if(_0x2de756===_0xc14e('0x14')||_0x2de756===_0xc14e('0x15')||_0x2de756===_0xc14e('0x16')){return _0x7c4768;}return null;}},'servicelevel':{'type':Sequelize[_0xc14e('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc14e('0x2')]},'weight':{'type':Sequelize[_0xc14e('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc14e('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc14e('0x3')](_0xc14e('0x18'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0xc14e('0x18'),'no',_0xc14e('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc14e('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xc14e('0x3')](_0xc14e('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc14e('0x3')](_0xc14e('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc14e('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc14e('0x3')](_0xc14e('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc14e('0x3')](_0xc14e('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xc14e('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc14e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc14e('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc14e('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc14e('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc14e('0x3')](_0xc14e('0x18'),'no'),'defaultValue':_0xc14e('0x18')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xc14e('0x18'),'no',_0xc14e('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xc14e('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xc14e('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc14e('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc14e('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xc14e('0x1b')],'set':function(_0x4c00bd){this[_0xc14e('0xe')](_0xc14e('0x1c'),_0x4c00bd?_0x4c00bd[_0xc14e('0x1d')](','):[]);},'get':function(){return this['getDataValue'](_0xc14e('0x1c'))?this[_0xc14e('0x10')](_0xc14e('0x1c'))[_0xc14e('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xc14e('0x18'),'set':function(_0x1126ff){this[_0xc14e('0xe')](_0xc14e('0x1f'),_0x1126ff?_0x1126ff['join'](','):undefined);},'get':function(){return this['getDataValue'](_0xc14e('0x1f'))?this[_0xc14e('0x10')](_0xc14e('0x1f'))[_0xc14e('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':'no','set':function(_0x489ed6){this[_0xc14e('0xe')](_0xc14e('0x20'),_0x489ed6?_0x489ed6['join'](','):undefined);},'get':function(){return this[_0xc14e('0x10')]('leavewhenempty')?this[_0xc14e('0x10')](_0xc14e('0x20'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xc14e('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc14e('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc14e('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc14e('0x3')](_0xc14e('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc14e('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xc14e('0x21')],'defaultValue':0x0,'set':function(_0x5e6a15){this[_0xc14e('0xe')](_0xc14e('0x22'),_0x5e6a15);if(_0x5e6a15){if(this[_0xc14e('0x10')]('wrapuptime')<0x2){this[_0xc14e('0xe')](_0xc14e('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc14e('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc14e('0x24')},'dialMethod':{'type':Sequelize[_0xc14e('0x3')](_0xc14e('0x25'),_0xc14e('0x14'),'power','predictive',_0xc14e('0x12')),'defaultValue':'progressive','comment':_0xc14e('0x26')},'dialLimitChannel':{'type':Sequelize[_0xc14e('0x17')](0x4)[_0xc14e('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc14e('0x28')},'dialLimitQueue':{'type':Sequelize[_0xc14e('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xc14e('0x29')](0x2)[_0xc14e('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc14e('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xc14e('0x3')]('agentBusyFactor',_0xc14e('0x2b')),'defaultValue':'dropRate','comment':_0xc14e('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc14e('0x29')](0x2)[_0xc14e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc14e('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xc14e('0x17')](0x3)[_0xc14e('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc14e('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc14e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc14e('0x17')](0x3)[_0xc14e('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':_0xc14e('0x2f'),'comment':_0xc14e('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc14e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc14e('0x31')},'dialQueueProject':{'type':Sequelize[_0xc14e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xc14e('0x17')](0x3)[_0xc14e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc14e('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc14e('0x17')](0x5)[_0xc14e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc14e('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc14e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xc14e('0x17')](0x5)[_0xc14e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc14e('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc14e('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xc14e('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc14e('0x17')](0x5)[_0xc14e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc14e('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc14e('0x17')](0x3)[_0xc14e('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xc14e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc14e('0x3')](_0xc14e('0x37'),_0xc14e('0x38'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xc14e('0x21')],'defaultValue':0x0,'comment':_0xc14e('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xc14e('0x17')](0x9)[_0xc14e('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc14e('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xc14e('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc14e('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc14e('0x17')](0x9)[_0xc14e('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc14e('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xc14e('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc14e('0x17')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc14e('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc14e('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc14e('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc14e('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc14e('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc14e('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc14e('0x17')](0x9)[_0xc14e('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc14e('0x40')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc14e('0x41')},'dialRecallInQueue':{'type':Sequelize[_0xc14e('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':_0xc14e('0x42')},'dialQueueProject2':{'type':Sequelize[_0xc14e('0x2')],'comment':_0xc14e('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc14e('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc14e('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc14e('0x17')](0x3)[_0xc14e('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc14e('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xc14e('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc14e('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc14e('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc14e('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc14e('0x17')](0x5)[_0xc14e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xc14e('0x17')](0x3)[_0xc14e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc14e('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0xc14e('0x17')](0x5)[_0xc14e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc14e('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc14e('0x17')](0x3)[_0xc14e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc14e('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc14e('0x17')](0x5)[_0xc14e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc14e('0x17')](0x3)[_0xc14e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc14e('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc14e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc14e('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc14e('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc14e('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc14e('0x17')],'allowNull':!![],'comment':_0xc14e('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0xc14e('0x21')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2f506f){if(!_0x2f506f)this['setDataValue'](_0xc14e('0x4e'),null);this['setDataValue'](_0xc14e('0x4f'),_0x2f506f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xc14e('0x17')](0x3)[_0xc14e('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xc14e('0x21')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xc14e('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0xf502=['agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','random','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','booked','progressive','power','INTEGER','yes','once','periodic_announce','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT'];(function(_0x10911a,_0x5b58df){var _0x61dc2c=function(_0x5647e8){while(--_0x5647e8){_0x10911a['push'](_0x10911a['shift']());}};_0x61dc2c(++_0x5b58df);}(_0xf502,0x10e));var _0x2f50=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0xf502[_0x16de68];return _0x1c277e;};'use strict';var Sequelize=require(_0x2f50('0x0'));module[_0x2f50('0x1')]={'name':{'type':Sequelize[_0x2f50('0x2')],'allowNull':![],'unique':_0x2f50('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x5'),_0x2f50('0x6')),'allowNull':![],'defaultValue':_0x2f50('0x5')},'musiconhold':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':_0x2f50('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x2f50('0x8'),_0x2f50('0x9'),'fewestcalls',_0x2f50('0xa'),'rrmemory','linear','wrandom',_0x2f50('0xb')),'allowNull':![],'defaultValue':_0x2f50('0x8'),'set':function(_0x185e1e){this[_0x2f50('0xc')](_0x2f50('0xd'),_0x185e1e?_0x185e1e:_0x2f50('0xe'));},'get':function(){var _0x281cc9=this[_0x2f50('0xf')](_0x2f50('0x10'));var _0x1faf0c=this[_0x2f50('0xf')]('dialMethod');var _0xe48560=this[_0x2f50('0xf')](_0x2f50('0xd'));if(_0x281cc9===_0x2f50('0x5')){return _0xe48560;}if(_0x1faf0c==='booked'&&_0xe48560===_0x2f50('0xe')||_0x1faf0c===_0x2f50('0x11')&&_0xe48560==='roundrobin'){return _0xe48560;}if(_0x1faf0c===_0x2f50('0x12')||_0x1faf0c==='predictive'||_0x1faf0c===_0x2f50('0x13')){return _0xe48560;}return null;}},'servicelevel':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2f50('0x2')]},'weight':{'type':Sequelize[_0x2f50('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':_0x2f50('0x15')},'autopause':{'type':Sequelize['ENUM'](_0x2f50('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x2f50('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2f50('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2f50('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x2f50('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2f50('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2f50('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':_0x2f50('0x15')},'announce_holdtime':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no',_0x2f50('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2f50('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x2f50('0x2')]},'queue_quantity2':{'type':Sequelize[_0x2f50('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x2f50('0x2')]},'queue_less_than':{'type':Sequelize[_0x2f50('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x496ff3){this[_0x2f50('0xc')](_0x2f50('0x17'),_0x496ff3?_0x496ff3['join'](','):[]);},'get':function(){return this[_0x2f50('0xf')](_0x2f50('0x17'))?this['getDataValue'](_0x2f50('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':_0x2f50('0x15'),'set':function(_0x586138){this[_0x2f50('0xc')](_0x2f50('0x18'),_0x586138?_0x586138['join'](','):undefined);},'get':function(){return this[_0x2f50('0xf')](_0x2f50('0x18'))?this['getDataValue'](_0x2f50('0x18'))[_0x2f50('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':'no','set':function(_0xb1c14d){this[_0x2f50('0xc')](_0x2f50('0x1a'),_0xb1c14d?_0xb1c14d['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x2f50('0x1a'))?this[_0x2f50('0xf')](_0x2f50('0x1a'))[_0x2f50('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x2f50('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2f50('0x2')]},'description':{'type':Sequelize[_0x2f50('0x2')]},'acw':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':0x0,'set':function(_0x19edd0){this[_0x2f50('0xc')](_0x2f50('0x1c'),_0x19edd0);if(_0x19edd0){if(this[_0x2f50('0xf')](_0x2f50('0x1d'))<0x2){this[_0x2f50('0xc')](_0x2f50('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':0x0,'comment':_0x2f50('0x1e')},'dialMethod':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x1f'),'progressive','power',_0x2f50('0x20'),_0x2f50('0x11')),'defaultValue':'progressive','comment':_0x2f50('0x21')},'dialLimitChannel':{'type':Sequelize[_0x2f50('0x14')](0x4)[_0x2f50('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2f50('0x23')},'dialLimitQueue':{'type':Sequelize[_0x2f50('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2f50('0x24')},'dialPowerLevel':{'type':Sequelize[_0x2f50('0x25')](0x2)[_0x2f50('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x26'),_0x2f50('0x27')),'defaultValue':'dropRate','comment':_0x2f50('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2f50('0x25')](0x2)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2f50('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2f50('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2f50('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':'tTxX','comment':_0x2f50('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x2d')},'dialQueueProject':{'type':Sequelize[_0x2f50('0x2')],'comment':_0x2f50('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2f50('0x14')](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2f50('0x14')](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'comment':_0x2f50('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2f50('0x14')](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':_0x2f50('0x35')},'dialPrefix':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2f50('0x4')]('always',_0x2f50('0x36'),_0x2f50('0x37')),'defaultValue':_0x2f50('0x38')},'dialAMDActive':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2f50('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2f50('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x2f50('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2f50('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2f50('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2f50('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2f50('0x14')](0x9)[_0x2f50('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x2f50('0x14')](0x9)[_0x2f50('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2f50('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2f50('0x14')](0x9)[_0x2f50('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2f50('0x14')](0x9)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2f50('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2f50('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2f50('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2f50('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2f50('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x2f50('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2f50('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2f50('0x4')]('DESC',_0x2f50('0x41')),'defaultValue':_0x2f50('0x42')},'dialQueueProject2':{'type':Sequelize[_0x2f50('0x2')],'comment':_0x2f50('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2f50('0x43')},'dialCutDigit':{'type':Sequelize[_0x2f50('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x46')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2f50('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2f50('0x14')](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2f50('0x14')],'allowNull':!![],'comment':_0x2f50('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x24191d){if(!_0x24191d)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x24191d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x2f50('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 24d6ba5..199330c 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2052=['length','hasOwnProperty','limit','sort','where','filters','merge','options','includeAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','nolimit','order','pick','CmHopper','findAll','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','TeamVoiceQueue','upsert','each','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','emit','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','ListId\x20=\x20?','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','register','status','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','get','VoiceQueues','inbound','outbound','filter','map','value','includes','type','find','UserProfileResource','end','sendStatus','error','stack','name','send','index','VoiceQueue','rawAttributes','fieldName','key','keys','intersection','model','attributes','fields','query'];(function(_0x30309f,_0x5bc9ec){var _0x495735=function(_0x4d1fb1){while(--_0x4d1fb1){_0x30309f['push'](_0x30309f['shift']());}};_0x495735(++_0x5bc9ec);}(_0x2052,0x77));var _0x2205=function(_0x37b04b,_0x157af1){_0x37b04b=_0x37b04b-0x0;var _0x9a1cc3=_0x2052[_0x37b04b];return _0x9a1cc3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2205('0x0'));var zipdir=require(_0x2205('0x1'));var jsonpatch=require(_0x2205('0x2'));var rp=require(_0x2205('0x3'));var moment=require(_0x2205('0x4'));var BPromise=require(_0x2205('0x5'));var Mustache=require(_0x2205('0x6'));var util=require(_0x2205('0x7'));var path=require(_0x2205('0x8'));var sox=require(_0x2205('0x9'));var csv=require('to-csv');var ejs=require(_0x2205('0xa'));var fs=require('fs');var fs_extra=require(_0x2205('0xb'));var _=require(_0x2205('0xc'));var squel=require('squel');var crypto=require(_0x2205('0xd'));var jsforce=require(_0x2205('0xe'));var deskjs=require(_0x2205('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2205('0x10'));var Papa=require(_0x2205('0x11'));var Redis=require(_0x2205('0x12'));var authService=require(_0x2205('0x13'));var qs=require(_0x2205('0x14'));var as=require(_0x2205('0x15'));var hardwareService=require(_0x2205('0x16'));var logger=require(_0x2205('0x17'))(_0x2205('0x18'));var utils=require(_0x2205('0x19'));var config=require(_0x2205('0x1a'));var licenseUtil=require(_0x2205('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2205('0x1c')](config[_0x2205('0x1d')],{'host':_0x2205('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0x2205('0x1f')](socket);function respondWithStatusCode(_0x4e235d,_0xb5a2eb){_0xb5a2eb=_0xb5a2eb||0xcc;return function(_0x5c6232){if(_0x5c6232){return _0x4e235d['sendStatus'](_0xb5a2eb);}return _0x4e235d[_0x2205('0x20')](_0xb5a2eb)['end']();};}function respondWithResult(_0x52fc97,_0xbf5b22){_0xbf5b22=_0xbf5b22||0xc8;return function(_0x8aad15){if(_0x8aad15){return _0x52fc97[_0x2205('0x20')](_0xbf5b22)['json'](_0x8aad15);}};}function respondWithFilteredResult(_0x4e343e,_0x5d67f1){return function(_0x3f853e){if(_0x3f853e){var _0x26750e=typeof _0x5d67f1['offset']===_0x2205('0x21')&&typeof _0x5d67f1['limit']===_0x2205('0x21');var _0x3a8df1=_0x3f853e[_0x2205('0x22')];var _0xa80b27=_0x26750e?0x0:_0x5d67f1[_0x2205('0x23')];var _0x10c422=_0x26750e?_0x3f853e[_0x2205('0x22')]:_0x5d67f1['offset']+_0x5d67f1['limit'];var _0x4e6e94;if(_0x10c422>=_0x3a8df1){_0x10c422=_0x3a8df1;_0x4e6e94=0xc8;}else{_0x4e6e94=0xce;}_0x4e343e['status'](_0x4e6e94);return _0x4e343e[_0x2205('0x24')](_0x2205('0x25'),_0xa80b27+'-'+_0x10c422+'/'+_0x3a8df1)[_0x2205('0x26')](_0x3f853e);}return null;};}function patchUpdates(_0x130099){return function(_0x14b099){try{jsonpatch['apply'](_0x14b099,_0x130099,!![]);}catch(_0x1cf84c){return BPromise[_0x2205('0x27')](_0x1cf84c);}return _0x14b099[_0x2205('0x28')]();};}function saveUpdates(_0x28edf7,_0x52905a){return function(_0x3e06e6){if(_0x3e06e6){return _0x3e06e6[_0x2205('0x29')](_0x28edf7)[_0x2205('0x2a')](function(_0x4acfc7){return _0x4acfc7;});}return null;};}function removeEntity(_0x40ea5a,_0x55ca61){return function(_0x33d772){if(_0x33d772){return _0x33d772[_0x2205('0x2b')]()[_0x2205('0x2a')](function(){var _0x24d55d=_0x33d772[_0x2205('0x2c')]({'plain':!![]});var _0x96e4e5=[{'name':_0x2205('0x2d'),'value':_0x2205('0x2e'),'ignore':![]},{'name':'QueueCampaigns','value':_0x2205('0x2f'),'ignore':![]}];var _0x10cd26=_(_0x96e4e5)[_0x2205('0x30')]('ignore')[_0x2205('0x31')]('value')[_0x2205('0x32')]();if(_[_0x2205('0x33')](_0x10cd26,_0x24d55d[_0x2205('0x34')])){return;}var _0x23c563=_[_0x2205('0x35')](_0x96e4e5,['value',_0x24d55d[_0x2205('0x34')]])['name'];return db[_0x2205('0x36')][_0x2205('0x2b')]({'where':{'type':_0x23c563,'resourceId':_0x24d55d['id']}})[_0x2205('0x2a')](function(){return _0x33d772;});})['then'](function(){_0x40ea5a[_0x2205('0x20')](0xcc)[_0x2205('0x37')]();});}};}function handleEntityNotFound(_0x3cf960,_0x4cb190){return function(_0x3d9a0f){if(!_0x3d9a0f){_0x3cf960[_0x2205('0x38')](0x194);}return _0x3d9a0f;};}function handleError(_0x4cd8ec,_0x24fba7){_0x24fba7=_0x24fba7||0x1f4;return function(_0x136848){logger[_0x2205('0x39')](_0x136848[_0x2205('0x3a')]);if(_0x136848[_0x2205('0x3b')]){delete _0x136848[_0x2205('0x3b')];}_0x4cd8ec[_0x2205('0x20')](_0x24fba7)[_0x2205('0x3c')](_0x136848);};}exports[_0x2205('0x3d')]=function(_0x5cfb73,_0x55ab08){var _0x4159c8={},_0x448efd={},_0x1b1a12={'count':0x0,'rows':[]};var _0x47fd8d=_[_0x2205('0x31')](db[_0x2205('0x3e')][_0x2205('0x3f')],function(_0x33c1a1){return{'name':_0x33c1a1[_0x2205('0x40')],'type':_0x33c1a1[_0x2205('0x34')][_0x2205('0x41')]};});_0x448efd['model']=_[_0x2205('0x31')](_0x47fd8d,_0x2205('0x3b'));_0x448efd['query']=_[_0x2205('0x42')](_0x5cfb73['query']);_0x448efd['filters']=_[_0x2205('0x43')](_0x448efd[_0x2205('0x44')],_0x448efd['query']);_0x4159c8[_0x2205('0x45')]=_[_0x2205('0x43')](_0x448efd[_0x2205('0x44')],qs[_0x2205('0x46')](_0x5cfb73[_0x2205('0x47')][_0x2205('0x46')]));_0x4159c8['attributes']=_0x4159c8[_0x2205('0x45')][_0x2205('0x48')]?_0x4159c8[_0x2205('0x45')]:_0x448efd['model'];if(!_0x5cfb73[_0x2205('0x47')][_0x2205('0x49')]('nolimit')){_0x4159c8[_0x2205('0x4a')]=qs['limit'](_0x5cfb73[_0x2205('0x47')][_0x2205('0x4a')]);_0x4159c8[_0x2205('0x23')]=qs[_0x2205('0x23')](_0x5cfb73['query'][_0x2205('0x23')]);}_0x4159c8['order']=qs[_0x2205('0x4b')](_0x5cfb73[_0x2205('0x47')][_0x2205('0x4b')]);_0x4159c8[_0x2205('0x4c')]=qs[_0x2205('0x4d')](_['pick'](_0x5cfb73[_0x2205('0x47')],_0x448efd[_0x2205('0x4d')]),_0x47fd8d);if(_0x5cfb73[_0x2205('0x47')][_0x2205('0x30')]){_0x4159c8[_0x2205('0x4c')]=_[_0x2205('0x4e')](_0x4159c8['where'],{'$or':_[_0x2205('0x31')](_0x47fd8d,function(_0x459ad3){if(_0x459ad3[_0x2205('0x34')]!=='VIRTUAL'){var _0x11b49e={};_0x11b49e[_0x459ad3[_0x2205('0x3b')]]={'$like':'%'+_0x5cfb73[_0x2205('0x47')][_0x2205('0x30')]+'%'};return _0x11b49e;}})});}_0x4159c8=_[_0x2205('0x4e')]({},_0x4159c8,_0x5cfb73[_0x2205('0x4f')]);var _0x453211={'where':_0x4159c8['where']};return db[_0x2205('0x3e')]['count'](_0x453211)[_0x2205('0x2a')](function(_0x5ae8b6){_0x1b1a12[_0x2205('0x22')]=_0x5ae8b6;if(_0x5cfb73[_0x2205('0x47')][_0x2205('0x50')]){_0x4159c8['include']=[{'all':!![]}];}return db[_0x2205('0x3e')]['findAll'](_0x4159c8);})[_0x2205('0x2a')](function(_0x1ba192){_0x1b1a12[_0x2205('0x51')]=_0x1ba192;return _0x1b1a12;})['then'](respondWithFilteredResult(_0x55ab08,_0x4159c8))[_0x2205('0x52')](handleError(_0x55ab08,null));};exports[_0x2205('0x53')]=function(_0x54a4cf,_0x401398){var _0x42a7ef={'raw':![],'where':{'id':_0x54a4cf[_0x2205('0x54')]['id']}},_0x1b83b2={};_0x1b83b2[_0x2205('0x44')]=_[_0x2205('0x42')](db[_0x2205('0x3e')][_0x2205('0x3f')]);_0x1b83b2[_0x2205('0x47')]=_[_0x2205('0x42')](_0x54a4cf[_0x2205('0x47')]);_0x1b83b2[_0x2205('0x4d')]=_[_0x2205('0x43')](_0x1b83b2[_0x2205('0x44')],_0x1b83b2[_0x2205('0x47')]);_0x42a7ef[_0x2205('0x45')]=_['intersection'](_0x1b83b2[_0x2205('0x44')],qs[_0x2205('0x46')](_0x54a4cf[_0x2205('0x47')][_0x2205('0x46')]));_0x42a7ef[_0x2205('0x45')]=_0x42a7ef['attributes']['length']?_0x42a7ef[_0x2205('0x45')]:_0x1b83b2[_0x2205('0x44')];if(_0x54a4cf['query'][_0x2205('0x50')]){_0x42a7ef[_0x2205('0x55')]=[{'all':!![]}];}_0x42a7ef=_[_0x2205('0x4e')]({},_0x42a7ef,_0x54a4cf[_0x2205('0x4f')]);return db['VoiceQueue'][_0x2205('0x35')](_0x42a7ef)[_0x2205('0x2a')](handleEntityNotFound(_0x401398,null))['then'](respondWithResult(_0x401398,null))[_0x2205('0x52')](handleError(_0x401398,null));};exports[_0x2205('0x56')]=function(_0x2594f9,_0x5c6d3d){return db[_0x2205('0x3e')][_0x2205('0x56')](_0x2594f9[_0x2205('0x57')],{})['then'](function(_0x529b14){var _0x3c501e=_0x2594f9[_0x2205('0x58')][_0x2205('0x2c')]({'plain':!![]});if(!_0x3c501e)throw new Error(_0x2205('0x59'));if(_0x3c501e[_0x2205('0x5a')]===_0x2205('0x58')){var _0x4c1625=_0x529b14[_0x2205('0x2c')]({'plain':!![]});var _0x4dc67a=[{'name':_0x2205('0x2d'),'value':_0x2205('0x2e')},{'name':_0x2205('0x5b'),'value':_0x2205('0x2f')}];var _0x578017=_[_0x2205('0x35')](_0x4dc67a,[_0x2205('0x32'),_0x4c1625[_0x2205('0x34')]])[_0x2205('0x3b')];return db[_0x2205('0x5c')][_0x2205('0x35')]({'where':{'name':_0x578017,'userProfileId':_0x3c501e[_0x2205('0x5d')]},'raw':!![]})['then'](function(_0x5290d3){if(_0x5290d3&&_0x5290d3[_0x2205('0x5e')]===0x0){return db[_0x2205('0x36')][_0x2205('0x56')]({'name':_0x4c1625[_0x2205('0x3b')],'resourceId':_0x4c1625['id'],'type':_0x5290d3[_0x2205('0x3b')],'sectionId':_0x5290d3['id']},{})['then'](function(){return _0x529b14;});}else{return _0x529b14;}})[_0x2205('0x52')](function(_0x331b5e){logger[_0x2205('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x331b5e);throw _0x331b5e;});}return _0x529b14;})[_0x2205('0x2a')](respondWithResult(_0x5c6d3d,0xc9))['catch'](handleError(_0x5c6d3d,null));};exports[_0x2205('0x5f')]=function(_0x247f48,_0x198599){var _0x26f168={'where':{'id':_0x247f48[_0x2205('0x54')]['id']}},_0x18a491={};_0x18a491[_0x2205('0x44')]=_[_0x2205('0x42')](db[_0x2205('0x3e')][_0x2205('0x3f')]);_0x26f168[_0x2205('0x45')]=_[_0x2205('0x43')](_0x18a491[_0x2205('0x44')],qs[_0x2205('0x46')](_0x247f48[_0x2205('0x47')]['fields']));_0x26f168['attributes']=_0x26f168['attributes'][_0x2205('0x48')]?_0x26f168[_0x2205('0x45')]:_0x18a491[_0x2205('0x44')];if(_0x247f48[_0x2205('0x47')][_0x2205('0x50')]){_0x26f168[_0x2205('0x55')]=[{'all':!![]}];}_0x26f168=_['merge']({},_0x26f168,_0x247f48[_0x2205('0x4f')]);return db[_0x2205('0x3e')][_0x2205('0x35')](_0x26f168)[_0x2205('0x2a')](handleEntityNotFound(_0x198599,null))[_0x2205('0x2a')](function(_0x4ffe1a){if(_0x4ffe1a){var _0x1ecdfe=_0x4ffe1a[_0x2205('0x2c')]({'plain':!![]});_0x1ecdfe=qs[_0x2205('0x60')](_0x1ecdfe,['id',_0x2205('0x61'),_0x2205('0x62')]);_0x247f48[_0x2205('0x57')]=_[_0x2205('0x60')](_0x247f48['body'],['id',_0x2205('0x61'),_0x2205('0x62')]);return db['VoiceQueue'][_0x2205('0x56')](_[_0x2205('0x4e')](_0x1ecdfe,_0x247f48['body']),{'include':_0x247f48[_0x2205('0x47')][_0x2205('0x50')]?[{'all':!![]}]:undefined})['then'](function(_0x4350b3){var _0x5e3825=_0x247f48[_0x2205('0x58')][_0x2205('0x2c')]({'plain':!![]});if(!_0x5e3825)throw new Error(_0x2205('0x59'));if(_0x5e3825[_0x2205('0x5a')]===_0x2205('0x58')){var _0x8b44e2=_0x4350b3['get']({'plain':!![]});var _0x424228=[{'name':'VoiceQueues','value':_0x2205('0x2e')},{'name':_0x2205('0x5b'),'value':_0x2205('0x2f')}];var _0x13a691=_[_0x2205('0x35')](_0x424228,['value',_0x8b44e2[_0x2205('0x34')]])[_0x2205('0x3b')];return db[_0x2205('0x5c')][_0x2205('0x35')]({'where':{'name':_0x13a691,'userProfileId':_0x5e3825['userProfileId']},'raw':!![]})[_0x2205('0x2a')](function(_0x49aed2){if(_0x49aed2&&_0x49aed2[_0x2205('0x5e')]===0x0){return db[_0x2205('0x36')][_0x2205('0x56')]({'name':_0x8b44e2[_0x2205('0x3b')],'resourceId':_0x8b44e2['id'],'type':_0x49aed2[_0x2205('0x3b')],'sectionId':_0x49aed2['id']},{})[_0x2205('0x2a')](function(){return _0x4350b3;});}else{return _0x4350b3;}})[_0x2205('0x52')](function(_0x34045e){logger[_0x2205('0x39')](_0x2205('0x63'),_0x34045e);throw _0x34045e;});}return _0x4350b3;});}})[_0x2205('0x2a')](respondWithResult(_0x198599,0xc9))['catch'](handleError(_0x198599,null));};exports[_0x2205('0x29')]=function(_0x43cf05,_0xbaeb9){if(_0x43cf05[_0x2205('0x57')]['id']){delete _0x43cf05['body']['id'];}return db[_0x2205('0x3e')][_0x2205('0x35')]({'where':{'id':_0x43cf05[_0x2205('0x54')]['id']}})['then'](handleEntityNotFound(_0xbaeb9,null))['then'](saveUpdates(_0x43cf05['body'],null))[_0x2205('0x2a')](respondWithResult(_0xbaeb9,null))['catch'](handleError(_0xbaeb9,null));};exports['destroy']=function(_0x4aa957,_0x15804f){return db[_0x2205('0x3e')][_0x2205('0x35')]({'where':{'id':_0x4aa957[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x15804f,null))['then'](removeEntity(_0x15804f,null))['catch'](handleError(_0x15804f,null));};exports[_0x2205('0x64')]=function(_0x104f63,_0x444797,_0x4eaa0c){var _0x46bd7b={'raw':![],'where':{}};var _0x42f490={};var _0xb625cb={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2205('0x65')]({'where':{'id':_0x104f63['params']['id']}})['then'](handleEntityNotFound(_0x444797,null))[_0x2205('0x2a')](function(_0x568805){if(_0x568805){_0x42f490['model']=_[_0x2205('0x42')](db['CmHopper']['rawAttributes']);_0x42f490[_0x2205('0x47')]=_[_0x2205('0x42')](_0x104f63[_0x2205('0x47')]);_0x42f490[_0x2205('0x4d')]=_['intersection'](_0x42f490[_0x2205('0x44')],_0x42f490[_0x2205('0x47')]);_0x46bd7b['attributes']=_[_0x2205('0x43')](_0x42f490[_0x2205('0x44')],qs[_0x2205('0x46')](_0x104f63[_0x2205('0x47')]['fields']));_0x46bd7b[_0x2205('0x45')]=_0x46bd7b[_0x2205('0x45')][_0x2205('0x48')]?_0x46bd7b[_0x2205('0x45')]:_0x42f490[_0x2205('0x44')];if(!_0x104f63[_0x2205('0x47')]['hasOwnProperty'](_0x2205('0x66'))){_0x46bd7b['limit']=qs['limit'](_0x104f63['query'][_0x2205('0x4a')]);_0x46bd7b[_0x2205('0x23')]=qs[_0x2205('0x23')](_0x104f63['query'][_0x2205('0x23')]);}_0x46bd7b[_0x2205('0x67')]=qs[_0x2205('0x4b')](_0x104f63[_0x2205('0x47')]['sort']);_0x46bd7b[_0x2205('0x4c')]=qs[_0x2205('0x4d')](_[_0x2205('0x68')](_0x104f63['query'],_0x42f490[_0x2205('0x4d')]));_0x46bd7b[_0x2205('0x4c')]['VoiceQueueId']=_0x568805['id'];if(_0x104f63[_0x2205('0x47')][_0x2205('0x30')]){_0x46bd7b[_0x2205('0x4c')]=_[_0x2205('0x4e')](_0x46bd7b[_0x2205('0x4c')],{'$or':_['map'](_0x46bd7b[_0x2205('0x45')],function(_0x5d2160){var _0x1eccd9={};_0x1eccd9[_0x5d2160]={'$like':'%'+_0x104f63[_0x2205('0x47')]['filter']+'%'};return _0x1eccd9;})});}_0x46bd7b=_[_0x2205('0x4e')]({},_0x46bd7b,_0x104f63[_0x2205('0x4f')]);return db[_0x2205('0x69')][_0x2205('0x22')]({'where':_0x46bd7b[_0x2205('0x4c')]})[_0x2205('0x2a')](function(_0x5132c0){_0xb625cb[_0x2205('0x22')]=_0x5132c0;if(_0x104f63[_0x2205('0x47')][_0x2205('0x50')]){_0x46bd7b[_0x2205('0x55')]=[{'all':!![]}];}return db[_0x2205('0x69')][_0x2205('0x6a')](_0x46bd7b);})[_0x2205('0x2a')](function(_0x21828d){_0xb625cb['rows']=_0x21828d;return _0xb625cb;});}})[_0x2205('0x2a')](respondWithFilteredResult(_0x444797,_0x46bd7b))['catch'](handleError(_0x444797,null));};exports['getHopperHistories']=function(_0xb1113d,_0x3d36e0,_0x2d7e6b){var _0x5e9a26={'raw':!![],'where':{}};var _0x432786={};var _0x30ce0c={'count':0x0,'rows':[]};return db[_0x2205('0x3e')]['findOne']({'where':{'id':_0xb1113d[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x3d36e0,null))['then'](function(_0x9b3d35){if(_0x9b3d35){_0x432786[_0x2205('0x44')]=_[_0x2205('0x42')](db[_0x2205('0x6b')]['rawAttributes']);_0x432786['query']=_[_0x2205('0x42')](_0xb1113d[_0x2205('0x47')]);_0x432786[_0x2205('0x4d')]=_[_0x2205('0x43')](_0x432786[_0x2205('0x44')],_0x432786['query']);_0x5e9a26[_0x2205('0x45')]=_[_0x2205('0x43')](_0x432786['model'],qs['fields'](_0xb1113d[_0x2205('0x47')][_0x2205('0x46')]));_0x5e9a26[_0x2205('0x45')]=_0x5e9a26[_0x2205('0x45')]['length']?_0x5e9a26[_0x2205('0x45')]:_0x432786[_0x2205('0x44')];if(!_0xb1113d[_0x2205('0x47')]['hasOwnProperty'](_0x2205('0x66'))){_0x5e9a26[_0x2205('0x4a')]=qs['limit'](_0xb1113d[_0x2205('0x47')][_0x2205('0x4a')]);_0x5e9a26['offset']=qs[_0x2205('0x23')](_0xb1113d[_0x2205('0x47')][_0x2205('0x23')]);}_0x5e9a26['order']=qs[_0x2205('0x4b')](_0xb1113d[_0x2205('0x47')][_0x2205('0x4b')]);_0x5e9a26[_0x2205('0x4c')]=qs[_0x2205('0x4d')](_['pick'](_0xb1113d['query'],_0x432786[_0x2205('0x4d')]));_0x5e9a26[_0x2205('0x4c')][_0x2205('0x6c')]=_0x9b3d35['id'];if(_0xb1113d[_0x2205('0x47')][_0x2205('0x30')]){_0x5e9a26[_0x2205('0x4c')]=_[_0x2205('0x4e')](_0x5e9a26['where'],{'$or':_[_0x2205('0x31')](_0x5e9a26[_0x2205('0x45')],function(_0x8cfed5){var _0x363892={};_0x363892[_0x8cfed5]={'$like':'%'+_0xb1113d[_0x2205('0x47')][_0x2205('0x30')]+'%'};return _0x363892;})});}_0x5e9a26=_[_0x2205('0x4e')]({},_0x5e9a26,_0xb1113d[_0x2205('0x4f')]);return db[_0x2205('0x6b')][_0x2205('0x22')]({'where':_0x5e9a26[_0x2205('0x4c')]})['then'](function(_0x339a9f){_0x30ce0c[_0x2205('0x22')]=_0x339a9f;if(_0xb1113d[_0x2205('0x47')]['includeAll']){_0x5e9a26[_0x2205('0x55')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x2205('0x6a')](_0x5e9a26);})[_0x2205('0x2a')](function(_0x15ab46){_0x30ce0c[_0x2205('0x51')]=_0x15ab46;return _0x30ce0c;});}})[_0x2205('0x2a')](respondWithFilteredResult(_0x3d36e0,_0x5e9a26))[_0x2205('0x52')](handleError(_0x3d36e0,null));};exports[_0x2205('0x6d')]=function(_0x4a0600,_0x42c0a0,_0x182b15){var _0x28a9c0={'raw':!![],'where':{}};var _0x14d223={};var _0x7b3f84={'count':0x0,'rows':[]};return db[_0x2205('0x3e')][_0x2205('0x65')]({'where':{'id':_0x4a0600[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x42c0a0,null))[_0x2205('0x2a')](function(_0x3c9d69){if(_0x3c9d69){_0x14d223[_0x2205('0x44')]=_['keys'](db[_0x2205('0x6e')][_0x2205('0x3f')]);_0x14d223['query']=_[_0x2205('0x42')](_0x4a0600['query']);_0x14d223[_0x2205('0x4d')]=_[_0x2205('0x43')](_0x14d223[_0x2205('0x44')],_0x14d223['query']);_0x28a9c0[_0x2205('0x45')]=_[_0x2205('0x43')](_0x14d223[_0x2205('0x44')],qs[_0x2205('0x46')](_0x4a0600[_0x2205('0x47')]['fields']));_0x28a9c0[_0x2205('0x45')]=_0x28a9c0[_0x2205('0x45')][_0x2205('0x48')]?_0x28a9c0[_0x2205('0x45')]:_0x14d223[_0x2205('0x44')];if(!_0x4a0600['query'][_0x2205('0x49')](_0x2205('0x66'))){_0x28a9c0['limit']=qs[_0x2205('0x4a')](_0x4a0600[_0x2205('0x47')][_0x2205('0x4a')]);_0x28a9c0[_0x2205('0x23')]=qs['offset'](_0x4a0600[_0x2205('0x47')][_0x2205('0x23')]);}_0x28a9c0[_0x2205('0x67')]=qs[_0x2205('0x4b')](_0x4a0600[_0x2205('0x47')][_0x2205('0x4b')]);_0x28a9c0['where']=qs[_0x2205('0x4d')](_[_0x2205('0x68')](_0x4a0600[_0x2205('0x47')],_0x14d223[_0x2205('0x4d')]));_0x28a9c0[_0x2205('0x4c')][_0x2205('0x6c')]=_0x3c9d69['id'];if(_0x4a0600['query'][_0x2205('0x30')]){_0x28a9c0[_0x2205('0x4c')]=_[_0x2205('0x4e')](_0x28a9c0[_0x2205('0x4c')],{'$or':_['map'](_0x28a9c0[_0x2205('0x45')],function(_0x444e7e){var _0x53249a={};_0x53249a[_0x444e7e]={'$like':'%'+_0x4a0600[_0x2205('0x47')][_0x2205('0x30')]+'%'};return _0x53249a;})});}_0x28a9c0=_[_0x2205('0x4e')]({},_0x28a9c0,_0x4a0600[_0x2205('0x4f')]);return db[_0x2205('0x6e')][_0x2205('0x22')]({'where':_0x28a9c0[_0x2205('0x4c')]})[_0x2205('0x2a')](function(_0x2d9855){_0x7b3f84[_0x2205('0x22')]=_0x2d9855;if(_0x4a0600[_0x2205('0x47')][_0x2205('0x50')]){_0x28a9c0['include']=[{'all':!![]}];}return db[_0x2205('0x6e')][_0x2205('0x6a')](_0x28a9c0);})['then'](function(_0x3abd60){_0x7b3f84['rows']=_0x3abd60;return _0x7b3f84;});}})[_0x2205('0x2a')](respondWithFilteredResult(_0x42c0a0,_0x28a9c0))[_0x2205('0x52')](handleError(_0x42c0a0,null));};exports[_0x2205('0x6f')]=function(_0x496cc3,_0x1b1023,_0x2a267c){var _0x33cc1d={'raw':!![],'where':{}};var _0x5b933e={};var _0x4c15d9={'count':0x0,'rows':[]};return db[_0x2205('0x3e')][_0x2205('0x65')]({'where':{'id':_0x496cc3[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x1b1023,null))[_0x2205('0x2a')](function(_0x8c5a51){if(_0x8c5a51){_0x5b933e[_0x2205('0x44')]=_[_0x2205('0x42')](db[_0x2205('0x70')]['rawAttributes']);_0x5b933e[_0x2205('0x47')]=_[_0x2205('0x42')](_0x496cc3[_0x2205('0x47')]);_0x5b933e[_0x2205('0x4d')]=_[_0x2205('0x43')](_0x5b933e[_0x2205('0x44')],_0x5b933e[_0x2205('0x47')]);_0x33cc1d['attributes']=_[_0x2205('0x43')](_0x5b933e['model'],qs[_0x2205('0x46')](_0x496cc3[_0x2205('0x47')][_0x2205('0x46')]));_0x33cc1d[_0x2205('0x45')]=_0x33cc1d[_0x2205('0x45')][_0x2205('0x48')]?_0x33cc1d[_0x2205('0x45')]:_0x5b933e[_0x2205('0x44')];if(!_0x496cc3[_0x2205('0x47')][_0x2205('0x49')](_0x2205('0x66'))){_0x33cc1d[_0x2205('0x4a')]=qs[_0x2205('0x4a')](_0x496cc3[_0x2205('0x47')][_0x2205('0x4a')]);_0x33cc1d['offset']=qs[_0x2205('0x23')](_0x496cc3[_0x2205('0x47')][_0x2205('0x23')]);}_0x33cc1d[_0x2205('0x67')]=qs[_0x2205('0x4b')](_0x496cc3[_0x2205('0x47')]['sort']);_0x33cc1d[_0x2205('0x4c')]=qs[_0x2205('0x4d')](_['pick'](_0x496cc3['query'],_0x5b933e[_0x2205('0x4d')]));_0x33cc1d[_0x2205('0x4c')][_0x2205('0x6c')]=_0x8c5a51['id'];if(_0x496cc3[_0x2205('0x47')][_0x2205('0x30')]){_0x33cc1d['where']=_[_0x2205('0x4e')](_0x33cc1d[_0x2205('0x4c')],{'$or':_[_0x2205('0x31')](_0x33cc1d[_0x2205('0x45')],function(_0xa45c1c){var _0xb949af={};_0xb949af[_0xa45c1c]={'$like':'%'+_0x496cc3['query'][_0x2205('0x30')]+'%'};return _0xb949af;})});}_0x33cc1d=_['merge']({},_0x33cc1d,_0x496cc3['options']);return db[_0x2205('0x70')][_0x2205('0x22')]({'where':_0x33cc1d[_0x2205('0x4c')]})[_0x2205('0x2a')](function(_0x215527){_0x4c15d9[_0x2205('0x22')]=_0x215527;if(_0x496cc3[_0x2205('0x47')]['includeAll']){_0x33cc1d[_0x2205('0x55')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x33cc1d);})[_0x2205('0x2a')](function(_0x31a6b1){_0x4c15d9[_0x2205('0x51')]=_0x31a6b1;return _0x4c15d9;});}})[_0x2205('0x2a')](respondWithFilteredResult(_0x1b1023,_0x33cc1d))[_0x2205('0x52')](handleError(_0x1b1023,null));};exports['getTeams']=function(_0x55456e,_0x584583,_0x1e4db1){var _0x2e7baf={};var _0x4d0e09={};var _0x2b8406;var _0x8de7fa;return db['VoiceQueue'][_0x2205('0x65')]({'where':{'id':_0x55456e['params']['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x584583,null))[_0x2205('0x2a')](function(_0x1048c1){if(_0x1048c1){_0x2b8406=_0x1048c1;_0x4d0e09[_0x2205('0x44')]=_[_0x2205('0x42')](db[_0x2205('0x71')][_0x2205('0x3f')]);_0x4d0e09[_0x2205('0x47')]=_[_0x2205('0x42')](_0x55456e[_0x2205('0x47')]);_0x4d0e09[_0x2205('0x4d')]=_[_0x2205('0x43')](_0x4d0e09[_0x2205('0x44')],_0x4d0e09[_0x2205('0x47')]);_0x2e7baf[_0x2205('0x45')]=_[_0x2205('0x43')](_0x4d0e09[_0x2205('0x44')],qs[_0x2205('0x46')](_0x55456e['query'][_0x2205('0x46')]));_0x2e7baf[_0x2205('0x45')]=_0x2e7baf[_0x2205('0x45')]['length']?_0x2e7baf[_0x2205('0x45')]:_0x4d0e09['model'];_0x2e7baf[_0x2205('0x67')]=qs[_0x2205('0x4b')](_0x55456e['query'][_0x2205('0x4b')]);_0x2e7baf[_0x2205('0x4c')]=qs[_0x2205('0x4d')](_[_0x2205('0x68')](_0x55456e[_0x2205('0x47')],_0x4d0e09[_0x2205('0x4d')]));if(_0x55456e['query']['filter']){_0x2e7baf[_0x2205('0x4c')]=_[_0x2205('0x4e')](_0x2e7baf[_0x2205('0x4c')],{'$or':_['map'](_0x2e7baf[_0x2205('0x45')],function(_0x3ac85e){var _0x57055b={};_0x57055b[_0x3ac85e]={'$like':'%'+_0x55456e[_0x2205('0x47')]['filter']+'%'};return _0x57055b;})});}_0x2e7baf=_['merge']({},_0x2e7baf,_0x55456e['options']);return _0x2b8406[_0x2205('0x72')](_0x2e7baf);}})[_0x2205('0x2a')](function(_0x1c241f){if(_0x1c241f){_0x8de7fa=_0x1c241f[_0x2205('0x48')];if(!_0x55456e[_0x2205('0x47')][_0x2205('0x49')]('nolimit')){_0x2e7baf['limit']=qs[_0x2205('0x4a')](_0x55456e[_0x2205('0x47')][_0x2205('0x4a')]);_0x2e7baf['offset']=qs[_0x2205('0x23')](_0x55456e[_0x2205('0x47')][_0x2205('0x23')]);}return _0x2b8406[_0x2205('0x72')](_0x2e7baf);}})[_0x2205('0x2a')](function(_0x28033e){if(_0x28033e){return _0x28033e?{'count':_0x8de7fa,'rows':_0x28033e}:null;}})[_0x2205('0x2a')](respondWithResult(_0x584583,null))[_0x2205('0x52')](handleError(_0x584583,null));};exports['addTeams']=function(_0x43a4f9,_0x4a7030,_0x231488){var _0x68fb8=_0x43a4f9[_0x2205('0x57')][_0x2205('0x73')];var _0x82c0a0=_['map'](_0x68fb8,'id');return db['Team'][_0x2205('0x6a')]({'where':{'id':_0x82c0a0},'attributes':['id'],'include':[{'model':db[_0x2205('0x74')],'as':_0x2205('0x75'),'attributes':['id','name','online',_0x2205('0x76'),_0x2205('0x77')],'raw':!![]}]})[_0x2205('0x2a')](function(_0x4489fb){if(_0x4489fb){var _0x42718a=_[_0x2205('0x78')](_0x4489fb,function(_0x33d31a){var _0x137508=_0x33d31a[_0x2205('0x2c')]({'plain':!![]});_0x137508[_0x2205('0x75')][_0x2205('0x79')](function(_0x30f6f6){_0x30f6f6[_0x2205('0x7a')]=_[_0x2205('0x35')](_0x68fb8,{'id':_0x137508['id']})[_0x2205('0x7a')];});return _0x137508['Agents'];});return db[_0x2205('0x3e')][_0x2205('0x35')]({'where':{'id':_0x43a4f9[_0x2205('0x54')]['id']}})['then'](function(_0x321be6){return db[_0x2205('0x7b')][_0x2205('0x7c')](function(_0x9956d8){return _0x321be6[_0x2205('0x7d')](_0x82c0a0,{'transaction':_0x9956d8})[_0x2205('0x2a')](function(){return BPromise['each'](_0x68fb8,function(_0x3df2ca){return db[_0x2205('0x7e')][_0x2205('0x7f')]({'TeamId':_0x3df2ca['id'],'VoiceQueueId':_0x43a4f9[_0x2205('0x54')]['id'],'penalty':_0x3df2ca[_0x2205('0x7a')]},{'transaction':_0x9956d8});});})[_0x2205('0x2a')](function(){return BPromise[_0x2205('0x80')](_0x42718a,function(_0x4b5da4){return db[_0x2205('0x81')]['findOrCreate']({'where':{'UserId':_0x4b5da4['id'],'VoiceQueueId':_0x43a4f9['params']['id']},'defaults':{'penalty':_0x4b5da4[_0x2205('0x7a')]},'transaction':_0x9956d8});});})['then'](function(){return BPromise[_0x2205('0x80')](_[_0x2205('0x30')](_0x42718a,{'online':!![]}),function(_0xa7980e){return db[_0x2205('0x82')][_0x2205('0x7f')]({'membername':_0xa7980e[_0x2205('0x3b')],'UserId':_0xa7980e['id'],'queue_name':_0x321be6[_0x2205('0x3b')],'VoiceQueueId':_0x321be6['id'],'interface':_[_0x2205('0x83')](_0xa7980e[_0x2205('0x77')])?util[_0x2205('0x84')](_0x2205('0x85'),_0xa7980e[_0x2205('0x3b')]):_0xa7980e['interface'],'paused':_0xa7980e['voicePause']||![],'penalty':_0xa7980e[_0x2205('0x7a')]},{'transaction':_0x9956d8});});})[_0x2205('0x2a')](function(){_0x42718a['forEach'](function(_0x8b8647){socket[_0x2205('0x86')]('userVoiceQueue:save',{'UserId':_0x8b8647['id'],'VoiceQueueId':_0x321be6['id']});});});});});}})[_0x2205('0x2a')](respondWithStatusCode(_0x4a7030,null))['catch'](handleError(_0x4a7030,null));};exports[_0x2205('0x87')]=function(_0x53d8cf,_0x2cf28d,_0x163a30){return db[_0x2205('0x71')]['findAll']({'where':{'id':_0x53d8cf[_0x2205('0x47')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2205('0x74')],'as':_0x2205('0x75'),'attributes':['id'],'raw':!![]}]})[_0x2205('0x2a')](handleEntityNotFound(_0x2cf28d,null))[_0x2205('0x2a')](function(_0x2f19ed){var _0x3a6efb=_['map'](_0x2f19ed,'id');var _0x3b6f23=[];var _0x13cc92=[];var _0x5785a1=squel[_0x2205('0x88')]();_0x5785a1[_0x2205('0x89')](_0x2205('0x8a'))[_0x2205('0x8b')](_0x2205('0x8c'),'tq')[_0x2205('0x8d')](_0x2205('0x8e'),'ut',_0x2205('0x8f'))[_0x2205('0x4c')](_0x2205('0x90'),_0x53d8cf['params']['id']);for(var _0x54fdd1=0x0;_0x54fdd1<_0x2f19ed[_0x2205('0x48')];_0x54fdd1+=0x1){let _0x5cca12=_0x2f19ed[_0x54fdd1];for(var _0x4d51ad=0x0;_0x4d51ad<_0x5cca12[_0x2205('0x75')][_0x2205('0x48')];_0x4d51ad+=0x1){let _0x58b0f3=_0x5cca12[_0x2205('0x75')][_0x4d51ad];var _0x48a37e=_0x5785a1[_0x2205('0x5f')]();_0x48a37e[_0x2205('0x4c')](_0x2205('0x91'),_0x58b0f3['id']);_0x13cc92[_0x2205('0x92')](db['sequelize'][_0x2205('0x47')](_0x48a37e[_0x2205('0x93')](),{'type':db[_0x2205('0x7b')][_0x2205('0x94')]['SELECT']})[_0x2205('0x2a')](function(_0x2f1ffe){if(_0x2f1ffe[_0x2205('0x48')]===0x1){return _0x58b0f3['id'];}else{var _0x1cb76d=_[_0x2205('0x95')](_['map'](_0x2f1ffe,_0x2205('0x96')),function(_0x3e6a6d){return _[_0x2205('0x33')](_0x3a6efb,_0x3e6a6d);});if(_0x1cb76d){return _0x58b0f3['id'];}}}));}}return BPromise[_0x2205('0x97')](_0x13cc92)[_0x2205('0x2a')](function(_0x436d59){_0x3b6f23=_(_0x3b6f23)[_0x2205('0x98')](_0x436d59)['compact']()[_0x2205('0x32')]();return db[_0x2205('0x3e')]['find']({'where':{'id':_0x53d8cf[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](function(_0x2b6ef3){return db[_0x2205('0x7b')][_0x2205('0x7c')](function(_0x4badc5){return _0x2b6ef3[_0x2205('0x87')](_0x53d8cf[_0x2205('0x47')][_0x2205('0x99')],{'transaction':_0x4badc5})[_0x2205('0x2a')](function(){if(!_[_0x2205('0x9a')](_0x3b6f23)){return _0x2b6ef3[_0x2205('0x9b')](_0x3b6f23,{'transaction':_0x4badc5})[_0x2205('0x2a')](function(){return db[_0x2205('0x82')][_0x2205('0x2b')]({'where':{'VoiceQueueId':_0x53d8cf[_0x2205('0x54')]['id'],'UserId':_0x3b6f23},'transaction':_0x4badc5});});}})[_0x2205('0x2a')](function(){_0x3b6f23[_0x2205('0x79')](function(_0x69b048){socket[_0x2205('0x86')](_0x2205('0x9c'),{'UserId':_0x69b048,'VoiceQueueId':_0x2b6ef3['id']});});});});});});})[_0x2205('0x2a')](respondWithStatusCode(_0x2cf28d,null))['catch'](handleError(_0x2cf28d,null));};exports[_0x2205('0x9d')]=function(_0x14a854,_0x575be5,_0x2b1a22){var _0x224a11,_0x7baa61;return db[_0x2205('0x3e')][_0x2205('0x35')]({'where':{'id':_0x14a854[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x575be5,null))['then'](function(_0x267526){if(_0x267526){_0x7baa61=_0x267526;return _0x267526['addAgents'](_0x14a854[_0x2205('0x57')][_0x2205('0x99')],_[_0x2205('0x60')](_0x14a854[_0x2205('0x57')],[_0x2205('0x99'),'id'])||{})[_0x2205('0x9e')](function(_0x1fbbe5){for(var _0x9c2adf=0x0;_0x9c2adf<_0x14a854[_0x2205('0x57')][_0x2205('0x99')][_0x2205('0x48')];_0x9c2adf+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x14a854[_0x2205('0x57')][_0x2205('0x99')][_0x9c2adf]),'VoiceQueueId':Number(_0x14a854['params']['id'])});}return _0x1fbbe5;});}})[_0x2205('0x2a')](function(_0x341005){_0x224a11=_0x341005||[];if(_0x7baa61){return db[_0x2205('0x74')][_0x2205('0x6a')]({'where':{'id':_0x14a854[_0x2205('0x57')][_0x2205('0x99')]},'attributes':['id','name',_0x2205('0x9f'),_0x2205('0x76'),'interface'],'raw':!![]});}})['then'](function(_0x52cd4c){if(!_['isEmpty'](_0x52cd4c)){var _0x1b0363=[];for(var _0x3dd79b=0x0;_0x3dd79b<_0x52cd4c[_0x2205('0x48')];_0x3dd79b++){if(_0x52cd4c[_0x3dd79b][_0x2205('0x9f')]){_0x1b0363[_0x2205('0x92')](db[_0x2205('0x82')][_0x2205('0x7f')]({'membername':_0x52cd4c[_0x3dd79b][_0x2205('0x3b')],'UserId':_0x52cd4c[_0x3dd79b]['id'],'queue_name':_0x7baa61[_0x2205('0x3b')],'VoiceQueueId':_0x7baa61['id'],'interface':_['isNil'](_0x52cd4c[_0x3dd79b]['interface'])?util[_0x2205('0x84')](_0x2205('0x85'),_0x52cd4c[_0x3dd79b][_0x2205('0x3b')]):_0x52cd4c[_0x3dd79b][_0x2205('0x77')],'paused':_0x52cd4c[_0x3dd79b][_0x2205('0x76')]||![],'penalty':_0x14a854[_0x2205('0x57')][_0x2205('0x7a')]||0x0}));}}return BPromise[_0x2205('0x97')](_0x1b0363);}})[_0x2205('0x2a')](function(){return _0x224a11;})[_0x2205('0x2a')](respondWithResult(_0x575be5,null))[_0x2205('0x52')](handleError(_0x575be5,null));};exports[_0x2205('0x9b')]=function(_0xfca49f,_0x2e3f3e,_0x13ee38){return db['VoiceQueue'][_0x2205('0x35')]({'where':{'id':_0xfca49f[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x2e3f3e,null))[_0x2205('0x2a')](function(_0x1bc4a9){if(_0x1bc4a9){return _0x1bc4a9[_0x2205('0x9b')](_0xfca49f[_0x2205('0x47')]['ids'])[_0x2205('0x2a')](function(){if(_[_0x2205('0xa0')](_0xfca49f[_0x2205('0x47')][_0x2205('0x99')])){for(var _0x1e029b=0x0;_0x1e029b<_0xfca49f[_0x2205('0x47')][_0x2205('0x99')][_0x2205('0x48')];_0x1e029b+=0x1){socket[_0x2205('0x86')](_0x2205('0x9c'),{'UserId':Number(_0xfca49f[_0x2205('0x47')][_0x2205('0x99')][_0x1e029b]),'VoiceQueueId':Number(_0xfca49f[_0x2205('0x54')]['id'])});}}else{socket[_0x2205('0x86')](_0x2205('0x9c'),{'UserId':Number(_0xfca49f[_0x2205('0x47')][_0x2205('0x99')]),'VoiceQueueId':Number(_0xfca49f[_0x2205('0x54')]['id'])});}});}})[_0x2205('0x2a')](function(_0x8aa06f){return db[_0x2205('0x82')]['destroy']({'where':{'VoiceQueueId':_0xfca49f[_0x2205('0x54')]['id'],'UserId':_0xfca49f[_0x2205('0x47')][_0x2205('0x99')]}})[_0x2205('0x2a')](function(){return _0x8aa06f;});})[_0x2205('0x2a')](respondWithStatusCode(_0x2e3f3e,null))[_0x2205('0x52')](handleError(_0x2e3f3e,null));};exports[_0x2205('0xa1')]=function(_0x30e7dd,_0x18974e,_0x2c35f1){var _0x37c238={};var _0xe7de8={};var _0x542c11;var _0x3b97ed;return db['VoiceQueue'][_0x2205('0x65')]({'where':{'id':_0x30e7dd['params']['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x18974e,null))['then'](function(_0x855591){if(_0x855591){_0x542c11=_0x855591;_0xe7de8['model']=_['keys'](db['User'][_0x2205('0x3f')]);_0xe7de8['query']=_[_0x2205('0x42')](_0x30e7dd[_0x2205('0x47')]);_0xe7de8[_0x2205('0x4d')]=_[_0x2205('0x43')](_0xe7de8[_0x2205('0x44')],_0xe7de8['query']);_0x37c238[_0x2205('0x45')]=_[_0x2205('0x43')](_0xe7de8['model'],qs[_0x2205('0x46')](_0x30e7dd['query']['fields']));_0x37c238['attributes']=_0x37c238[_0x2205('0x45')]['length']?_0x37c238[_0x2205('0x45')]:_0xe7de8[_0x2205('0x44')];_0x37c238[_0x2205('0x67')]=qs[_0x2205('0x4b')](_0x30e7dd['query'][_0x2205('0x4b')]);_0x37c238[_0x2205('0x4c')]=qs['filters'](_[_0x2205('0x68')](_0x30e7dd[_0x2205('0x47')],_0xe7de8['filters']));if(_0x30e7dd[_0x2205('0x47')]['filter']){_0x37c238[_0x2205('0x4c')]=_['merge'](_0x37c238[_0x2205('0x4c')],{'$or':_['map'](_0x37c238[_0x2205('0x45')],function(_0x69c9bc){var _0x10592a={};_0x10592a[_0x69c9bc]={'$like':'%'+_0x30e7dd[_0x2205('0x47')]['filter']+'%'};return _0x10592a;})});}_0x37c238=_[_0x2205('0x4e')]({},_0x37c238,_0x30e7dd[_0x2205('0x4f')]);return _0x542c11[_0x2205('0xa1')](_0x37c238);}})[_0x2205('0x2a')](function(_0x238a6c){if(_0x238a6c){_0x3b97ed=_0x238a6c[_0x2205('0x48')];if(!_0x30e7dd[_0x2205('0x47')]['hasOwnProperty']('nolimit')){_0x37c238[_0x2205('0x4a')]=qs[_0x2205('0x4a')](_0x30e7dd[_0x2205('0x47')][_0x2205('0x4a')]);_0x37c238[_0x2205('0x23')]=qs[_0x2205('0x23')](_0x30e7dd['query'][_0x2205('0x23')]);}return _0x542c11[_0x2205('0xa1')](_0x37c238);}})[_0x2205('0x2a')](function(_0xe86bcb){if(_0xe86bcb){return _0xe86bcb?{'count':_0x3b97ed,'rows':_0xe86bcb}:null;}})[_0x2205('0x2a')](respondWithResult(_0x18974e,null))[_0x2205('0x52')](handleError(_0x18974e,null));};exports['getMembers']=function(_0x21a4b5,_0x289f42,_0x66cf90){var _0x4d873a={};var _0x48dc0e={};var _0x1bf29c;var _0xd031dd;return db[_0x2205('0x3e')][_0x2205('0x65')]({'where':{'id':_0x21a4b5[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x289f42,null))['then'](function(_0x4122a4){if(_0x4122a4){_0x1bf29c=_0x4122a4;_0x48dc0e[_0x2205('0x44')]=_[_0x2205('0x42')](db[_0x2205('0x82')]['rawAttributes']);_0x48dc0e['query']=_[_0x2205('0x42')](_0x21a4b5[_0x2205('0x47')]);_0x48dc0e[_0x2205('0x4d')]=_[_0x2205('0x43')](_0x48dc0e[_0x2205('0x44')],_0x48dc0e[_0x2205('0x47')]);_0x4d873a[_0x2205('0x45')]=_['intersection'](_0x48dc0e[_0x2205('0x44')],qs['fields'](_0x21a4b5[_0x2205('0x47')]['fields']));_0x4d873a['attributes']=_0x4d873a[_0x2205('0x45')][_0x2205('0x48')]?_0x4d873a['attributes']:_0x48dc0e[_0x2205('0x44')];_0x4d873a[_0x2205('0x67')]=qs[_0x2205('0x4b')](_0x21a4b5[_0x2205('0x47')][_0x2205('0x4b')]);_0x4d873a[_0x2205('0x4c')]=qs[_0x2205('0x4d')](_['pick'](_0x21a4b5[_0x2205('0x47')],_0x48dc0e[_0x2205('0x4d')]));if(_0x21a4b5[_0x2205('0x47')]['filter']){_0x4d873a[_0x2205('0x4c')]=_[_0x2205('0x4e')](_0x4d873a[_0x2205('0x4c')],{'$or':_['map'](_0x4d873a[_0x2205('0x45')],function(_0x48d625){var _0x2241ad={};_0x2241ad[_0x48d625]={'$like':'%'+_0x21a4b5[_0x2205('0x47')][_0x2205('0x30')]+'%'};return _0x2241ad;})});}_0x4d873a=_['merge']({},_0x4d873a,_0x21a4b5[_0x2205('0x4f')]);return _0x1bf29c[_0x2205('0xa2')](_0x4d873a);}})['then'](function(_0x31e917){if(_0x31e917){_0xd031dd=_0x31e917[_0x2205('0x48')];if(!_0x21a4b5[_0x2205('0x47')]['hasOwnProperty']('nolimit')){_0x4d873a[_0x2205('0x4a')]=qs[_0x2205('0x4a')](_0x21a4b5['query']['limit']);_0x4d873a[_0x2205('0x23')]=qs[_0x2205('0x23')](_0x21a4b5[_0x2205('0x47')]['offset']);}return _0x1bf29c['getMembers'](_0x4d873a);}})['then'](function(_0xe91cc){return _0xe91cc?{'count':_0xd031dd,'rows':_0xe91cc}:null;})['then'](respondWithResult(_0x289f42,null))['catch'](handleError(_0x289f42,null));};exports['getLists']=function(_0x32a291,_0x38d396,_0xce0a3f){var _0x88c917={};var _0x375cb2={};var _0xcbd650;var _0x40fe03;return db[_0x2205('0x3e')]['findOne']({'where':{'id':_0x32a291[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x38d396,null))[_0x2205('0x2a')](function(_0x1cf522){if(_0x1cf522){_0xcbd650=_0x1cf522;_0x375cb2[_0x2205('0x44')]=_[_0x2205('0x42')](db['CmList'][_0x2205('0x3f')]);_0x375cb2[_0x2205('0x47')]=_[_0x2205('0x42')](_0x32a291['query']);_0x375cb2[_0x2205('0x4d')]=_[_0x2205('0x43')](_0x375cb2['model'],_0x375cb2[_0x2205('0x47')]);_0x88c917[_0x2205('0x45')]=_[_0x2205('0x43')](_0x375cb2['model'],qs['fields'](_0x32a291[_0x2205('0x47')][_0x2205('0x46')]));_0x88c917['attributes']=_0x88c917[_0x2205('0x45')][_0x2205('0x48')]?_0x88c917[_0x2205('0x45')]:_0x375cb2['model'];_0x88c917[_0x2205('0x67')]=qs[_0x2205('0x4b')](_0x32a291[_0x2205('0x47')][_0x2205('0x4b')]);_0x88c917[_0x2205('0x4c')]=qs[_0x2205('0x4d')](_[_0x2205('0x68')](_0x32a291['query'],_0x375cb2[_0x2205('0x4d')]));if(_0x32a291[_0x2205('0x47')][_0x2205('0x30')]){_0x88c917[_0x2205('0x4c')]=_[_0x2205('0x4e')](_0x88c917[_0x2205('0x4c')],{'$or':_[_0x2205('0x31')](_0x88c917['attributes'],function(_0x3a51bb){var _0x5293dd={};_0x5293dd[_0x3a51bb]={'$like':'%'+_0x32a291[_0x2205('0x47')][_0x2205('0x30')]+'%'};return _0x5293dd;})});}_0x88c917=_[_0x2205('0x4e')]({},_0x88c917,_0x32a291['options']);return _0xcbd650[_0x2205('0xa3')](_0x88c917);}})[_0x2205('0x2a')](function(_0x323b3b){if(_0x323b3b){_0x40fe03=_0x323b3b['length'];if(!_0x32a291[_0x2205('0x47')][_0x2205('0x49')](_0x2205('0x66'))){_0x88c917['limit']=qs[_0x2205('0x4a')](_0x32a291[_0x2205('0x47')]['limit']);_0x88c917[_0x2205('0x23')]=qs['offset'](_0x32a291[_0x2205('0x47')][_0x2205('0x23')]);}return _0xcbd650[_0x2205('0xa3')](_0x88c917);}})[_0x2205('0x2a')](function(_0x369070){if(_0x369070){return _0x369070?{'count':_0x40fe03,'rows':_0x369070}:null;}})[_0x2205('0x2a')](respondWithResult(_0x38d396,null))[_0x2205('0x52')](handleError(_0x38d396,null));};exports[_0x2205('0xa4')]=function(_0xa9d0eb,_0x1b1f64,_0x397913){var _0x390db4,_0x373f4f;return db[_0x2205('0x3e')][_0x2205('0x35')]({'where':{'id':_0xa9d0eb['params']['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x1b1f64,null))['then'](function(_0x2b7e50){if(_0x2b7e50){_0x373f4f=_0x2b7e50;return _0x2b7e50[_0x2205('0xa4')](_0xa9d0eb[_0x2205('0x57')][_0x2205('0x99')],_[_0x2205('0x60')](_0xa9d0eb[_0x2205('0x57')],[_0x2205('0x99'),'id'])||{});}return null;})[_0x2205('0x9e')](function(_0x4f7f9f){var _0x4dfdfd;_0x390db4=_0x4f7f9f||[];var _0x1c38b1=[];if(_0x4f7f9f){for(var _0x20119a=0x0;_0x20119a<_0x4f7f9f['length'];_0x20119a+=0x1){var _0x3dce5e=_0x4f7f9f[_0x20119a][_0x2205('0x2c')]({'plain':!![]});_0x373f4f[_0x2205('0xa5')]=_0xa9d0eb[_0x2205('0x57')][_0x2205('0xa5')]?_0xa9d0eb[_0x2205('0x57')]['dialCheckDuplicateType']:_0x373f4f[_0x2205('0xa5')];switch(_0x373f4f[_0x2205('0xa5')]){case _0x2205('0xa6'):_0x4dfdfd=squel['insert']()[_0x2205('0xa7')]('cm_hopper')[_0x2205('0xa8')]([_0x2205('0xa9'),_0x2205('0xaa'),_0x2205('0xab'),_0x2205('0xac'),_0x2205('0x6c'),_0x2205('0x61'),_0x2205('0x62')],squel['select']()['field'](_0x2205('0xa9'),_0x2205('0xa9'))['field'](_0x2205('0xad'),_0x2205('0xaa'))[_0x2205('0x89')]('id',_0x2205('0xab'))[_0x2205('0x89')](_0x3dce5e[_0x2205('0xae')]['toString'](),'ListId')[_0x2205('0x89')](_0xa9d0eb[_0x2205('0x54')]['id'][_0x2205('0x93')](),_0x2205('0x6c'))[_0x2205('0x89')](_0x2205('0xad'),'createdAt')[_0x2205('0x89')](_0x2205('0xad'),_0x2205('0x62'))['from'](_0x2205('0xaf'))['where'](_0x2205('0xb0'))[_0x2205('0x4c')]('ListId\x20=\x20?',_0x3dce5e[_0x2205('0xae')]['toString']())[_0x2205('0x4c')](_0x2205('0xb1'))['where'](_0x2205('0xb2'),squel[_0x2205('0x88')]()[_0x2205('0x89')](_0x2205('0xb3'))['from'](_0x2205('0xb4'))['where']('VoiceQueueId\x20=\x20?',_0xa9d0eb[_0x2205('0x54')]['id'][_0x2205('0x93')]()))['where'](_0x2205('0xb2'),squel[_0x2205('0x88')]()['field'](_0x2205('0xb5'))[_0x2205('0x8b')](_0x2205('0xb6'))[_0x2205('0x4c')](_0x2205('0x90'),_0xa9d0eb[_0x2205('0x54')]['id'][_0x2205('0x93')]())))['toString']();break;case _0x2205('0xb7'):_0x4dfdfd=squel[_0x2205('0xb8')]()[_0x2205('0xa7')](_0x2205('0xb6'))[_0x2205('0xa8')](['phone',_0x2205('0xaa'),_0x2205('0xab'),_0x2205('0xac'),'VoiceQueueId',_0x2205('0x61'),_0x2205('0x62')],squel[_0x2205('0x88')]()[_0x2205('0x89')](_0x2205('0xa9'),_0x2205('0xa9'))[_0x2205('0x89')](_0x2205('0xad'),'scheduledAt')[_0x2205('0x89')]('id',_0x2205('0xab'))[_0x2205('0x89')](_0x3dce5e['CmListId'][_0x2205('0x93')](),_0x2205('0xac'))[_0x2205('0x89')](_0xa9d0eb[_0x2205('0x54')]['id']['toString'](),_0x2205('0x6c'))[_0x2205('0x89')](_0x2205('0xad'),'createdAt')[_0x2205('0x89')](_0x2205('0xad'),_0x2205('0x62'))[_0x2205('0x8b')](_0x2205('0xaf'))[_0x2205('0x4c')](_0x2205('0xb0'))[_0x2205('0x4c')](_0x2205('0xb9'),_0x3dce5e[_0x2205('0xae')][_0x2205('0x93')]())[_0x2205('0x4c')]('phone\x20IS\x20NOT\x20NULL')[_0x2205('0x4c')](_0x2205('0xb2'),squel['select']()['field'](_0x2205('0xb5'))['from'](_0x2205('0xb6'))[_0x2205('0x4c')](_0x2205('0x90'),_0xa9d0eb[_0x2205('0x54')]['id']['toString']())))[_0x2205('0x93')]();break;default:_0x4dfdfd=squel[_0x2205('0xb8')]()[_0x2205('0xa7')](_0x2205('0xb6'))[_0x2205('0xa8')]([_0x2205('0xa9'),'scheduledAt',_0x2205('0xab'),_0x2205('0xac'),_0x2205('0x6c'),_0x2205('0x61'),_0x2205('0x62')],squel[_0x2205('0x88')]()[_0x2205('0x89')]('phone',_0x2205('0xa9'))['field'](_0x2205('0xad'),_0x2205('0xaa'))['field']('id',_0x2205('0xab'))[_0x2205('0x89')](_0x3dce5e[_0x2205('0xae')]['toString'](),_0x2205('0xac'))[_0x2205('0x89')](_0xa9d0eb[_0x2205('0x54')]['id'][_0x2205('0x93')](),'VoiceQueueId')['field'](_0x2205('0xad'),_0x2205('0x61'))[_0x2205('0x89')](_0x2205('0xad'),_0x2205('0x62'))['from']('cm_contacts')['where'](_0x2205('0xb0'))[_0x2205('0x4c')](_0x2205('0xb9'),_0x3dce5e[_0x2205('0xae')][_0x2205('0x93')]())[_0x2205('0x4c')](_0x2205('0xb1')))[_0x2205('0x93')]();}_0x1c38b1[_0x2205('0x92')](db[_0x2205('0x7b')][_0x2205('0x47')](_0x4dfdfd));}return BPromise[_0x2205('0x97')](_0x1c38b1);}})[_0x2205('0x2a')](function(){return _0x390db4;})[_0x2205('0x2a')](respondWithResult(_0x1b1f64,null))[_0x2205('0x52')](handleError(_0x1b1f64,null));};exports[_0x2205('0xba')]=function(_0x15949d,_0x4ad917,_0x3693c1){return db[_0x2205('0x3e')][_0x2205('0x35')]({'where':{'id':_0x15949d[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x4ad917,null))[_0x2205('0x2a')](function(_0x1628d){if(_0x1628d){return _0x1628d['removeLists'](_0x15949d[_0x2205('0x47')]['ids']);}})['then'](function(_0x253783){if(_0x253783){return db[_0x2205('0x69')]['destroy']({'where':{'ListId':_0x15949d['query'][_0x2205('0x99')],'VoiceQueueId':_0x15949d[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](function(){return _0x253783;});}})['then'](respondWithStatusCode(_0x4ad917,null))[_0x2205('0x52')](handleError(_0x4ad917,null));};exports[_0x2205('0xbb')]=function(_0x551d43,_0x4ba18b,_0x5ea76f){var _0x1692a4={};var _0x41545b={};var _0x201f44;var _0x4a19c5;return db[_0x2205('0x3e')]['findOne']({'where':{'id':_0x551d43[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x4ba18b,null))['then'](function(_0x296be7){if(_0x296be7){_0x201f44=_0x296be7;_0x41545b[_0x2205('0x44')]=_[_0x2205('0x42')](db[_0x2205('0xbc')][_0x2205('0x3f')]);_0x41545b[_0x2205('0x47')]=_[_0x2205('0x42')](_0x551d43['query']);_0x41545b['filters']=_[_0x2205('0x43')](_0x41545b['model'],_0x41545b[_0x2205('0x47')]);_0x1692a4[_0x2205('0x45')]=_[_0x2205('0x43')](_0x41545b[_0x2205('0x44')],qs[_0x2205('0x46')](_0x551d43[_0x2205('0x47')]['fields']));_0x1692a4[_0x2205('0x45')]=_0x1692a4['attributes'][_0x2205('0x48')]?_0x1692a4[_0x2205('0x45')]:_0x41545b[_0x2205('0x44')];_0x1692a4[_0x2205('0x67')]=qs['sort'](_0x551d43['query'][_0x2205('0x4b')]);_0x1692a4[_0x2205('0x4c')]=qs[_0x2205('0x4d')](_[_0x2205('0x68')](_0x551d43[_0x2205('0x47')],_0x41545b[_0x2205('0x4d')]));if(_0x551d43[_0x2205('0x47')][_0x2205('0x30')]){_0x1692a4[_0x2205('0x4c')]=_['merge'](_0x1692a4[_0x2205('0x4c')],{'$or':_[_0x2205('0x31')](_0x1692a4['attributes'],function(_0x16f6e8){var _0x65c094={};_0x65c094[_0x16f6e8]={'$like':'%'+_0x551d43[_0x2205('0x47')][_0x2205('0x30')]+'%'};return _0x65c094;})});}_0x1692a4=_[_0x2205('0x4e')]({},_0x1692a4,_0x551d43[_0x2205('0x4f')]);return _0x201f44[_0x2205('0xbb')](_0x1692a4);}})[_0x2205('0x2a')](function(_0x23f1c9){if(_0x23f1c9){_0x4a19c5=_0x23f1c9[_0x2205('0x48')];if(!_0x551d43[_0x2205('0x47')]['hasOwnProperty']('nolimit')){_0x1692a4[_0x2205('0x4a')]=qs['limit'](_0x551d43[_0x2205('0x47')][_0x2205('0x4a')]);_0x1692a4[_0x2205('0x23')]=qs[_0x2205('0x23')](_0x551d43[_0x2205('0x47')][_0x2205('0x23')]);}return _0x201f44['getBlackLists'](_0x1692a4);}})[_0x2205('0x2a')](function(_0x1e4376){if(_0x1e4376){return _0x1e4376?{'count':_0x4a19c5,'rows':_0x1e4376}:null;}})[_0x2205('0x2a')](respondWithResult(_0x4ba18b,null))[_0x2205('0x52')](handleError(_0x4ba18b,null));};exports['addBlackLists']=function(_0x3e448d,_0x115c3e,_0xd7c67e){var _0x1d854d,_0x5979f2;return db[_0x2205('0x3e')]['find']({'where':{'id':_0x3e448d['params']['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x115c3e,null))[_0x2205('0x2a')](function(_0x40dbb1){if(_0x40dbb1){_0x5979f2=_0x40dbb1;return _0x40dbb1[_0x2205('0xbd')](_0x3e448d[_0x2205('0x57')][_0x2205('0x99')],_[_0x2205('0x60')](_0x3e448d[_0x2205('0x57')],['ids','id'])||{});}return null;})[_0x2205('0x9e')](function(_0x2a4874){var _0x171d21;_0x1d854d=_0x2a4874||[];var _0x2dec21=[];if(_0x2a4874){for(var _0x28b886=0x0;_0x28b886<_0x2a4874[_0x2205('0x48')];_0x28b886+=0x1){var _0x4a0610=_0x2a4874[_0x28b886][_0x2205('0x2c')]({'plain':!![]});_0x171d21=squel['insert']()[_0x2205('0xa7')]('cm_hopper_black')['fromQuery']([_0x2205('0xa9'),_0x2205('0xab'),'ListId',_0x2205('0x6c'),'createdAt',_0x2205('0x62')],squel[_0x2205('0x88')]()['field'](_0x2205('0xa9'),'phone')['field']('id','ContactId')[_0x2205('0x89')](_0x4a0610[_0x2205('0xae')][_0x2205('0x93')](),'ListId')[_0x2205('0x89')](_0x3e448d['params']['id'][_0x2205('0x93')](),_0x2205('0x6c'))[_0x2205('0x89')]('NOW()',_0x2205('0x61'))[_0x2205('0x89')](_0x2205('0xad'),_0x2205('0x62'))[_0x2205('0x8b')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x4a0610[_0x2205('0xae')][_0x2205('0x93')]())[_0x2205('0x4c')](_0x2205('0xb1')))[_0x2205('0x93')]();_0x2dec21[_0x2205('0x92')](db['sequelize'][_0x2205('0x47')](_0x171d21));}return BPromise[_0x2205('0x97')](_0x2dec21);}})[_0x2205('0x2a')](function(){return _0x1d854d;})['then'](respondWithResult(_0x115c3e,null))[_0x2205('0x52')](handleError(_0x115c3e,null));};exports['removeBlackLists']=function(_0x2cc6c6,_0x56dc1b,_0x234854){return db[_0x2205('0x3e')][_0x2205('0x35')]({'where':{'id':_0x2cc6c6[_0x2205('0x54')]['id']}})[_0x2205('0x2a')](handleEntityNotFound(_0x56dc1b,null))[_0x2205('0x2a')](function(_0x18c1b4){if(_0x18c1b4){return _0x18c1b4[_0x2205('0xbe')](_0x2cc6c6['query']['ids']);}})[_0x2205('0x2a')](function(_0x30af59){if(_0x30af59){return db[_0x2205('0x70')][_0x2205('0x2b')]({'where':{'ListId':_0x2cc6c6[_0x2205('0x47')]['ids'],'VoiceQueueId':_0x2cc6c6[_0x2205('0x54')]['id']}})['then'](function(){return _0x30af59;});}})['then'](respondWithStatusCode(_0x56dc1b,null))['catch'](handleError(_0x56dc1b,null));}; \ No newline at end of file +var _0xdfde=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','user','get','role','QueueCampaigns','outbound','userProfileId','autoAssociation','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','format','SIP/%s','voicePause','emit','removeTeams','User','select','field','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','ids','spread','userVoiceQueue:save','isNil','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','cm_hopper','into','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','save','update','then','inbound','filter','map','type','value','UserProfileResource','destroy','end','error','stack','name','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','intersection'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0xdfde,0x78));var _0xedfd=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0xdfde[_0x3a3758];return _0x1a9234;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedfd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedfd('0x1'));var rp=require(_0xedfd('0x2'));var moment=require('moment');var BPromise=require(_0xedfd('0x3'));var Mustache=require(_0xedfd('0x4'));var util=require(_0xedfd('0x5'));var path=require(_0xedfd('0x6'));var sox=require(_0xedfd('0x7'));var csv=require(_0xedfd('0x8'));var ejs=require(_0xedfd('0x9'));var fs=require('fs');var fs_extra=require(_0xedfd('0xa'));var _=require(_0xedfd('0xb'));var squel=require(_0xedfd('0xc'));var crypto=require(_0xedfd('0xd'));var jsforce=require(_0xedfd('0xe'));var deskjs=require(_0xedfd('0xf'));var toCsv=require(_0xedfd('0x8'));var querystring=require(_0xedfd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xedfd('0x11'));var qs=require(_0xedfd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedfd('0x13'));var logger=require(_0xedfd('0x14'))(_0xedfd('0x15'));var utils=require(_0xedfd('0x16'));var config=require(_0xedfd('0x17'));var licenseUtil=require(_0xedfd('0x18'));var db=require(_0xedfd('0x19'))['db'];config[_0xedfd('0x1a')]=_[_0xedfd('0x1b')](config[_0xedfd('0x1a')],{'host':_0xedfd('0x1c'),'port':0x18eb});var socket=require(_0xedfd('0x1d'))(new Redis(config[_0xedfd('0x1a')]));require(_0xedfd('0x1e'))[_0xedfd('0x1f')](socket);function respondWithStatusCode(_0xba524c,_0x36e50f){_0x36e50f=_0x36e50f||0xcc;return function(_0x597f1e){if(_0x597f1e){return _0xba524c[_0xedfd('0x20')](_0x36e50f);}return _0xba524c[_0xedfd('0x21')](_0x36e50f)['end']();};}function respondWithResult(_0x2412b9,_0xd087ea){_0xd087ea=_0xd087ea||0xc8;return function(_0x12cd48){if(_0x12cd48){return _0x2412b9[_0xedfd('0x21')](_0xd087ea)[_0xedfd('0x22')](_0x12cd48);}};}function respondWithFilteredResult(_0x512988,_0x2835b7){return function(_0x31015d){if(_0x31015d){var _0x385caf=typeof _0x2835b7[_0xedfd('0x23')]==='undefined'&&typeof _0x2835b7[_0xedfd('0x24')]===_0xedfd('0x25');var _0x1de493=_0x31015d[_0xedfd('0x26')];var _0x1b9694=_0x385caf?0x0:_0x2835b7[_0xedfd('0x23')];var _0xc3015e=_0x385caf?_0x31015d[_0xedfd('0x26')]:_0x2835b7[_0xedfd('0x23')]+_0x2835b7[_0xedfd('0x24')];var _0x280a6c;if(_0xc3015e>=_0x1de493){_0xc3015e=_0x1de493;_0x280a6c=0xc8;}else{_0x280a6c=0xce;}_0x512988[_0xedfd('0x21')](_0x280a6c);return _0x512988[_0xedfd('0x27')]('Content-Range',_0x1b9694+'-'+_0xc3015e+'/'+_0x1de493)[_0xedfd('0x22')](_0x31015d);}return null;};}function patchUpdates(_0x670f06){return function(_0x9d7c4c){try{jsonpatch['apply'](_0x9d7c4c,_0x670f06,!![]);}catch(_0x3f679){return BPromise['reject'](_0x3f679);}return _0x9d7c4c[_0xedfd('0x28')]();};}function saveUpdates(_0x4c33ad,_0x385da6){return function(_0x216b19){if(_0x216b19){return _0x216b19[_0xedfd('0x29')](_0x4c33ad)[_0xedfd('0x2a')](function(_0xb2a258){return _0xb2a258;});}return null;};}function removeEntity(_0x1e9633,_0x34ad78){return function(_0xaad313){if(_0xaad313){return _0xaad313['destroy']()[_0xedfd('0x2a')](function(){var _0x1c1a74=_0xaad313['get']({'plain':!![]});var _0xdd9b45=[{'name':'VoiceQueues','value':_0xedfd('0x2b'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x2ae3a5=_(_0xdd9b45)[_0xedfd('0x2c')]('ignore')[_0xedfd('0x2d')]('value')['value']();if(_['includes'](_0x2ae3a5,_0x1c1a74[_0xedfd('0x2e')])){return;}var _0x1b3acb=_['find'](_0xdd9b45,[_0xedfd('0x2f'),_0x1c1a74['type']])['name'];return db[_0xedfd('0x30')][_0xedfd('0x31')]({'where':{'type':_0x1b3acb,'resourceId':_0x1c1a74['id']}})[_0xedfd('0x2a')](function(){return _0xaad313;});})[_0xedfd('0x2a')](function(){_0x1e9633['status'](0xcc)[_0xedfd('0x32')]();});}};}function handleEntityNotFound(_0x2cad55,_0x1a781b){return function(_0x13f458){if(!_0x13f458){_0x2cad55[_0xedfd('0x20')](0x194);}return _0x13f458;};}function handleError(_0x3a3da9,_0x18644e){_0x18644e=_0x18644e||0x1f4;return function(_0x21d3d1){logger[_0xedfd('0x33')](_0x21d3d1[_0xedfd('0x34')]);if(_0x21d3d1['name']){delete _0x21d3d1[_0xedfd('0x35')];}_0x3a3da9[_0xedfd('0x21')](_0x18644e)['send'](_0x21d3d1);};}exports['index']=function(_0x2e2db1,_0x90478e){var _0x283124={},_0x1bc6f0={},_0x4f06ba={'count':0x0,'rows':[]};var _0x426f53=_[_0xedfd('0x2d')](db[_0xedfd('0x36')][_0xedfd('0x37')],function(_0x837f40){return{'name':_0x837f40[_0xedfd('0x38')],'type':_0x837f40[_0xedfd('0x2e')][_0xedfd('0x39')]};});_0x1bc6f0['model']=_[_0xedfd('0x2d')](_0x426f53,_0xedfd('0x35'));_0x1bc6f0[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x2e2db1[_0xedfd('0x3a')]);_0x1bc6f0[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x1bc6f0[_0xedfd('0x3e')],_0x1bc6f0[_0xedfd('0x3a')]);_0x283124[_0xedfd('0x3f')]=_[_0xedfd('0x3d')](_0x1bc6f0[_0xedfd('0x3e')],qs['fields'](_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x283124[_0xedfd('0x3f')]=_0x283124['attributes'][_0xedfd('0x41')]?_0x283124[_0xedfd('0x3f')]:_0x1bc6f0[_0xedfd('0x3e')];if(!_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x42')](_0xedfd('0x43'))){_0x283124[_0xedfd('0x24')]=qs[_0xedfd('0x24')](_0x2e2db1['query']['limit']);_0x283124[_0xedfd('0x23')]=qs['offset'](_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x23')]);}_0x283124[_0xedfd('0x44')]=qs['sort'](_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x283124[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x2e2db1[_0xedfd('0x3a')],_0x1bc6f0[_0xedfd('0x3c')]),_0x426f53);if(_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x283124[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x283124[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x426f53,function(_0x58c89b){if(_0x58c89b[_0xedfd('0x2e')]!==_0xedfd('0x49')){var _0x1a7265={};_0x1a7265[_0x58c89b[_0xedfd('0x35')]]={'$like':'%'+_0x2e2db1[_0xedfd('0x3a')]['filter']+'%'};return _0x1a7265;}})});}_0x283124=_[_0xedfd('0x48')]({},_0x283124,_0x2e2db1[_0xedfd('0x4a')]);var _0x5e6c0f={'where':_0x283124['where']};return db['VoiceQueue'][_0xedfd('0x26')](_0x5e6c0f)[_0xedfd('0x2a')](function(_0x59c6a1){_0x4f06ba[_0xedfd('0x26')]=_0x59c6a1;if(_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x4b')]){_0x283124[_0xedfd('0x4c')]=[{'all':!![]}];}return db[_0xedfd('0x36')]['findAll'](_0x283124);})[_0xedfd('0x2a')](function(_0x2faf75){_0x4f06ba[_0xedfd('0x4d')]=_0x2faf75;return _0x4f06ba;})['then'](respondWithFilteredResult(_0x90478e,_0x283124))[_0xedfd('0x4e')](handleError(_0x90478e,null));};exports['show']=function(_0x41e3fd,_0xec8745){var _0x452fed={'raw':![],'where':{'id':_0x41e3fd[_0xedfd('0x4f')]['id']}},_0xc9c3ba={};_0xc9c3ba[_0xedfd('0x3e')]=_['keys'](db[_0xedfd('0x36')][_0xedfd('0x37')]);_0xc9c3ba['query']=_[_0xedfd('0x3b')](_0x41e3fd[_0xedfd('0x3a')]);_0xc9c3ba['filters']=_[_0xedfd('0x3d')](_0xc9c3ba['model'],_0xc9c3ba[_0xedfd('0x3a')]);_0x452fed['attributes']=_[_0xedfd('0x3d')](_0xc9c3ba[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x41e3fd[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x452fed[_0xedfd('0x3f')]=_0x452fed[_0xedfd('0x3f')]['length']?_0x452fed['attributes']:_0xc9c3ba[_0xedfd('0x3e')];if(_0x41e3fd['query'][_0xedfd('0x4b')]){_0x452fed[_0xedfd('0x4c')]=[{'all':!![]}];}_0x452fed=_[_0xedfd('0x48')]({},_0x452fed,_0x41e3fd[_0xedfd('0x4a')]);return db[_0xedfd('0x36')][_0xedfd('0x50')](_0x452fed)[_0xedfd('0x2a')](handleEntityNotFound(_0xec8745,null))[_0xedfd('0x2a')](respondWithResult(_0xec8745,null))[_0xedfd('0x4e')](handleError(_0xec8745,null));};exports[_0xedfd('0x51')]=function(_0x48fcdb,_0x3222cc){return db[_0xedfd('0x36')][_0xedfd('0x51')](_0x48fcdb[_0xedfd('0x52')],{})['then'](function(_0x5bf940){var _0x36853c=_0x48fcdb[_0xedfd('0x53')][_0xedfd('0x54')]({'plain':!![]});if(!_0x36853c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36853c[_0xedfd('0x55')]===_0xedfd('0x53')){var _0x133889=_0x5bf940[_0xedfd('0x54')]({'plain':!![]});var _0x2d8011=[{'name':'VoiceQueues','value':_0xedfd('0x2b')},{'name':_0xedfd('0x56'),'value':_0xedfd('0x57')}];var _0x3c980d=_[_0xedfd('0x50')](_0x2d8011,[_0xedfd('0x2f'),_0x133889[_0xedfd('0x2e')]])[_0xedfd('0x35')];return db['UserProfileSection'][_0xedfd('0x50')]({'where':{'name':_0x3c980d,'userProfileId':_0x36853c[_0xedfd('0x58')]},'raw':!![]})['then'](function(_0x3cafb0){if(_0x3cafb0&&_0x3cafb0[_0xedfd('0x59')]===0x0){return db[_0xedfd('0x30')][_0xedfd('0x51')]({'name':_0x133889[_0xedfd('0x35')],'resourceId':_0x133889['id'],'type':_0x3cafb0[_0xedfd('0x35')],'sectionId':_0x3cafb0['id']},{})[_0xedfd('0x2a')](function(){return _0x5bf940;});}else{return _0x5bf940;}})[_0xedfd('0x4e')](function(_0x2632d4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2632d4);throw _0x2632d4;});}return _0x5bf940;})['then'](respondWithResult(_0x3222cc,0xc9))[_0xedfd('0x4e')](handleError(_0x3222cc,null));};exports['clone']=function(_0x38a630,_0x514e40){var _0x2cc0f1={'where':{'id':_0x38a630[_0xedfd('0x4f')]['id']}},_0x96ba2e={};_0x96ba2e[_0xedfd('0x3e')]=_['keys'](db[_0xedfd('0x36')]['rawAttributes']);_0x2cc0f1[_0xedfd('0x3f')]=_[_0xedfd('0x3d')](_0x96ba2e['model'],qs['fields'](_0x38a630[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x2cc0f1[_0xedfd('0x3f')]=_0x2cc0f1[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x2cc0f1['attributes']:_0x96ba2e[_0xedfd('0x3e')];if(_0x38a630[_0xedfd('0x3a')][_0xedfd('0x4b')]){_0x2cc0f1[_0xedfd('0x4c')]=[{'all':!![]}];}_0x2cc0f1=_[_0xedfd('0x48')]({},_0x2cc0f1,_0x38a630[_0xedfd('0x4a')]);return db[_0xedfd('0x36')]['find'](_0x2cc0f1)['then'](handleEntityNotFound(_0x514e40,null))[_0xedfd('0x2a')](function(_0x7fbe4c){if(_0x7fbe4c){var _0x47fb61=_0x7fbe4c[_0xedfd('0x54')]({'plain':!![]});_0x47fb61=qs['omit'](_0x47fb61,['id',_0xedfd('0x5a'),_0xedfd('0x5b')]);_0x38a630[_0xedfd('0x52')]=_[_0xedfd('0x5c')](_0x38a630[_0xedfd('0x52')],['id','createdAt','updatedAt']);return db['VoiceQueue'][_0xedfd('0x51')](_['merge'](_0x47fb61,_0x38a630[_0xedfd('0x52')]),{'include':_0x38a630[_0xedfd('0x3a')][_0xedfd('0x4b')]?[{'all':!![]}]:undefined})[_0xedfd('0x2a')](function(_0x37c706){var _0x45b24f=_0x38a630['user'][_0xedfd('0x54')]({'plain':!![]});if(!_0x45b24f)throw new Error(_0xedfd('0x5d'));if(_0x45b24f[_0xedfd('0x55')]==='user'){var _0x1d277e=_0x37c706[_0xedfd('0x54')]({'plain':!![]});var _0x7d34b8=[{'name':_0xedfd('0x5e'),'value':'inbound'},{'name':_0xedfd('0x56'),'value':_0xedfd('0x57')}];var _0x11b8aa=_[_0xedfd('0x50')](_0x7d34b8,[_0xedfd('0x2f'),_0x1d277e[_0xedfd('0x2e')]])['name'];return db[_0xedfd('0x5f')][_0xedfd('0x50')]({'where':{'name':_0x11b8aa,'userProfileId':_0x45b24f['userProfileId']},'raw':!![]})[_0xedfd('0x2a')](function(_0x1eaf0a){if(_0x1eaf0a&&_0x1eaf0a[_0xedfd('0x59')]===0x0){return db[_0xedfd('0x30')]['create']({'name':_0x1d277e['name'],'resourceId':_0x1d277e['id'],'type':_0x1eaf0a[_0xedfd('0x35')],'sectionId':_0x1eaf0a['id']},{})[_0xedfd('0x2a')](function(){return _0x37c706;});}else{return _0x37c706;}})['catch'](function(_0x28d50b){logger[_0xedfd('0x33')](_0xedfd('0x60'),_0x28d50b);throw _0x28d50b;});}return _0x37c706;});}})['then'](respondWithResult(_0x514e40,0xc9))[_0xedfd('0x4e')](handleError(_0x514e40,null));};exports['update']=function(_0x1306fa,_0x46a2f7){if(_0x1306fa[_0xedfd('0x52')]['id']){delete _0x1306fa[_0xedfd('0x52')]['id'];}return db['VoiceQueue'][_0xedfd('0x50')]({'where':{'id':_0x1306fa['params']['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x46a2f7,null))[_0xedfd('0x2a')](saveUpdates(_0x1306fa['body'],null))[_0xedfd('0x2a')](respondWithResult(_0x46a2f7,null))[_0xedfd('0x4e')](handleError(_0x46a2f7,null));};exports[_0xedfd('0x31')]=function(_0x2c2f9b,_0x30e5b2){return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x2c2f9b[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x30e5b2,null))[_0xedfd('0x2a')](removeEntity(_0x30e5b2,null))[_0xedfd('0x4e')](handleError(_0x30e5b2,null));};exports[_0xedfd('0x61')]=function(_0x500bd4,_0x438f5e,_0x35e71f){var _0x29e20a={'raw':![],'where':{}};var _0x198fd0={};var _0x775b6c={'count':0x0,'rows':[]};return db[_0xedfd('0x36')]['findOne']({'where':{'id':_0x500bd4[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x438f5e,null))[_0xedfd('0x2a')](function(_0x2fce4b){if(_0x2fce4b){_0x198fd0[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db[_0xedfd('0x62')][_0xedfd('0x37')]);_0x198fd0['query']=_[_0xedfd('0x3b')](_0x500bd4['query']);_0x198fd0[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x198fd0[_0xedfd('0x3e')],_0x198fd0[_0xedfd('0x3a')]);_0x29e20a[_0xedfd('0x3f')]=_['intersection'](_0x198fd0[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x500bd4[_0xedfd('0x3a')]['fields']));_0x29e20a[_0xedfd('0x3f')]=_0x29e20a['attributes'][_0xedfd('0x41')]?_0x29e20a[_0xedfd('0x3f')]:_0x198fd0[_0xedfd('0x3e')];if(!_0x500bd4[_0xedfd('0x3a')]['hasOwnProperty'](_0xedfd('0x43'))){_0x29e20a['limit']=qs[_0xedfd('0x24')](_0x500bd4[_0xedfd('0x3a')]['limit']);_0x29e20a['offset']=qs['offset'](_0x500bd4['query'][_0xedfd('0x23')]);}_0x29e20a['order']=qs[_0xedfd('0x45')](_0x500bd4[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x29e20a['where']=qs[_0xedfd('0x3c')](_['pick'](_0x500bd4[_0xedfd('0x3a')],_0x198fd0[_0xedfd('0x3c')]));_0x29e20a[_0xedfd('0x46')][_0xedfd('0x63')]=_0x2fce4b['id'];if(_0x500bd4[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x29e20a[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x29e20a['where'],{'$or':_[_0xedfd('0x2d')](_0x29e20a['attributes'],function(_0x12132b){var _0x79e7c8={};_0x79e7c8[_0x12132b]={'$like':'%'+_0x500bd4[_0xedfd('0x3a')]['filter']+'%'};return _0x79e7c8;})});}_0x29e20a=_['merge']({},_0x29e20a,_0x500bd4['options']);return db[_0xedfd('0x62')][_0xedfd('0x26')]({'where':_0x29e20a[_0xedfd('0x46')]})['then'](function(_0x5a9ac2){_0x775b6c['count']=_0x5a9ac2;if(_0x500bd4[_0xedfd('0x3a')][_0xedfd('0x4b')]){_0x29e20a[_0xedfd('0x4c')]=[{'all':!![]}];}return db['CmHopper'][_0xedfd('0x64')](_0x29e20a);})[_0xedfd('0x2a')](function(_0x451113){_0x775b6c['rows']=_0x451113;return _0x775b6c;});}})[_0xedfd('0x2a')](respondWithFilteredResult(_0x438f5e,_0x29e20a))[_0xedfd('0x4e')](handleError(_0x438f5e,null));};exports[_0xedfd('0x65')]=function(_0x3dad06,_0x1e1838,_0x5966b7){var _0x1bdcd9={'raw':!![],'where':{}};var _0x466dae={};var _0x4afc54={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xedfd('0x66')]({'where':{'id':_0x3dad06[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x1e1838,null))['then'](function(_0x8796b5){if(_0x8796b5){_0x466dae[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db['CmHopperHistory'][_0xedfd('0x37')]);_0x466dae[_0xedfd('0x3a')]=_['keys'](_0x3dad06['query']);_0x466dae[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x466dae[_0xedfd('0x3e')],_0x466dae['query']);_0x1bdcd9[_0xedfd('0x3f')]=_['intersection'](_0x466dae[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x3dad06[_0xedfd('0x3a')]['fields']));_0x1bdcd9['attributes']=_0x1bdcd9['attributes']['length']?_0x1bdcd9[_0xedfd('0x3f')]:_0x466dae[_0xedfd('0x3e')];if(!_0x3dad06[_0xedfd('0x3a')][_0xedfd('0x42')](_0xedfd('0x43'))){_0x1bdcd9[_0xedfd('0x24')]=qs[_0xedfd('0x24')](_0x3dad06['query'][_0xedfd('0x24')]);_0x1bdcd9[_0xedfd('0x23')]=qs[_0xedfd('0x23')](_0x3dad06[_0xedfd('0x3a')][_0xedfd('0x23')]);}_0x1bdcd9[_0xedfd('0x44')]=qs[_0xedfd('0x45')](_0x3dad06['query'][_0xedfd('0x45')]);_0x1bdcd9[_0xedfd('0x46')]=qs['filters'](_[_0xedfd('0x47')](_0x3dad06['query'],_0x466dae[_0xedfd('0x3c')]));_0x1bdcd9[_0xedfd('0x46')][_0xedfd('0x63')]=_0x8796b5['id'];if(_0x3dad06['query'][_0xedfd('0x2c')]){_0x1bdcd9['where']=_[_0xedfd('0x48')](_0x1bdcd9[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x1bdcd9[_0xedfd('0x3f')],function(_0x4a8693){var _0x58f478={};_0x58f478[_0x4a8693]={'$like':'%'+_0x3dad06[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x58f478;})});}_0x1bdcd9=_['merge']({},_0x1bdcd9,_0x3dad06[_0xedfd('0x4a')]);return db[_0xedfd('0x67')][_0xedfd('0x26')]({'where':_0x1bdcd9['where']})[_0xedfd('0x2a')](function(_0x1362ad){_0x4afc54[_0xedfd('0x26')]=_0x1362ad;if(_0x3dad06[_0xedfd('0x3a')][_0xedfd('0x4b')]){_0x1bdcd9[_0xedfd('0x4c')]=[{'all':!![]}];}return db[_0xedfd('0x67')][_0xedfd('0x64')](_0x1bdcd9);})[_0xedfd('0x2a')](function(_0x3c62f4){_0x4afc54['rows']=_0x3c62f4;return _0x4afc54;});}})[_0xedfd('0x2a')](respondWithFilteredResult(_0x1e1838,_0x1bdcd9))['catch'](handleError(_0x1e1838,null));};exports['getHopperFinals']=function(_0x2986db,_0x279871,_0x58ab48){var _0x4b8fcb={'raw':!![],'where':{}};var _0x1a2505={};var _0x1f0ef5={'count':0x0,'rows':[]};return db[_0xedfd('0x36')][_0xedfd('0x66')]({'where':{'id':_0x2986db[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x279871,null))[_0xedfd('0x2a')](function(_0x4b8910){if(_0x4b8910){_0x1a2505[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db[_0xedfd('0x68')]['rawAttributes']);_0x1a2505[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x2986db[_0xedfd('0x3a')]);_0x1a2505[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x1a2505[_0xedfd('0x3e')],_0x1a2505['query']);_0x4b8fcb['attributes']=_[_0xedfd('0x3d')](_0x1a2505[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x2986db[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x4b8fcb['attributes']=_0x4b8fcb['attributes']['length']?_0x4b8fcb[_0xedfd('0x3f')]:_0x1a2505[_0xedfd('0x3e')];if(!_0x2986db[_0xedfd('0x3a')][_0xedfd('0x42')](_0xedfd('0x43'))){_0x4b8fcb[_0xedfd('0x24')]=qs[_0xedfd('0x24')](_0x2986db[_0xedfd('0x3a')][_0xedfd('0x24')]);_0x4b8fcb[_0xedfd('0x23')]=qs[_0xedfd('0x23')](_0x2986db['query']['offset']);}_0x4b8fcb['order']=qs[_0xedfd('0x45')](_0x2986db[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x4b8fcb[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x2986db[_0xedfd('0x3a')],_0x1a2505[_0xedfd('0x3c')]));_0x4b8fcb[_0xedfd('0x46')][_0xedfd('0x63')]=_0x4b8910['id'];if(_0x2986db[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x4b8fcb['where']=_['merge'](_0x4b8fcb[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x4b8fcb[_0xedfd('0x3f')],function(_0x2df58c){var _0x36a316={};_0x36a316[_0x2df58c]={'$like':'%'+_0x2986db[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x36a316;})});}_0x4b8fcb=_[_0xedfd('0x48')]({},_0x4b8fcb,_0x2986db[_0xedfd('0x4a')]);return db[_0xedfd('0x68')][_0xedfd('0x26')]({'where':_0x4b8fcb[_0xedfd('0x46')]})['then'](function(_0x1e7f40){_0x1f0ef5[_0xedfd('0x26')]=_0x1e7f40;if(_0x2986db[_0xedfd('0x3a')][_0xedfd('0x4b')]){_0x4b8fcb[_0xedfd('0x4c')]=[{'all':!![]}];}return db[_0xedfd('0x68')][_0xedfd('0x64')](_0x4b8fcb);})[_0xedfd('0x2a')](function(_0x762588){_0x1f0ef5[_0xedfd('0x4d')]=_0x762588;return _0x1f0ef5;});}})[_0xedfd('0x2a')](respondWithFilteredResult(_0x279871,_0x4b8fcb))[_0xedfd('0x4e')](handleError(_0x279871,null));};exports[_0xedfd('0x69')]=function(_0x129111,_0x450c30,_0x140ef5){var _0x17e6cf={'raw':!![],'where':{}};var _0x28619c={};var _0x55a3f4={'count':0x0,'rows':[]};return db[_0xedfd('0x36')]['findOne']({'where':{'id':_0x129111['params']['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x450c30,null))[_0xedfd('0x2a')](function(_0x1e1647){if(_0x1e1647){_0x28619c['model']=_['keys'](db[_0xedfd('0x6a')][_0xedfd('0x37')]);_0x28619c[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x129111['query']);_0x28619c['filters']=_[_0xedfd('0x3d')](_0x28619c[_0xedfd('0x3e')],_0x28619c[_0xedfd('0x3a')]);_0x17e6cf['attributes']=_['intersection'](_0x28619c['model'],qs[_0xedfd('0x40')](_0x129111[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x17e6cf[_0xedfd('0x3f')]=_0x17e6cf[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x17e6cf[_0xedfd('0x3f')]:_0x28619c[_0xedfd('0x3e')];if(!_0x129111[_0xedfd('0x3a')][_0xedfd('0x42')](_0xedfd('0x43'))){_0x17e6cf['limit']=qs[_0xedfd('0x24')](_0x129111[_0xedfd('0x3a')]['limit']);_0x17e6cf['offset']=qs[_0xedfd('0x23')](_0x129111[_0xedfd('0x3a')][_0xedfd('0x23')]);}_0x17e6cf[_0xedfd('0x44')]=qs[_0xedfd('0x45')](_0x129111[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x17e6cf[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x129111[_0xedfd('0x3a')],_0x28619c['filters']));_0x17e6cf[_0xedfd('0x46')][_0xedfd('0x63')]=_0x1e1647['id'];if(_0x129111[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x17e6cf[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x17e6cf[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x17e6cf[_0xedfd('0x3f')],function(_0x2178fc){var _0x1ef940={};_0x1ef940[_0x2178fc]={'$like':'%'+_0x129111[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x1ef940;})});}_0x17e6cf=_['merge']({},_0x17e6cf,_0x129111[_0xedfd('0x4a')]);return db[_0xedfd('0x6a')]['count']({'where':_0x17e6cf[_0xedfd('0x46')]})[_0xedfd('0x2a')](function(_0x32afbf){_0x55a3f4[_0xedfd('0x26')]=_0x32afbf;if(_0x129111[_0xedfd('0x3a')]['includeAll']){_0x17e6cf[_0xedfd('0x4c')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xedfd('0x64')](_0x17e6cf);})[_0xedfd('0x2a')](function(_0x18bb56){_0x55a3f4[_0xedfd('0x4d')]=_0x18bb56;return _0x55a3f4;});}})[_0xedfd('0x2a')](respondWithFilteredResult(_0x450c30,_0x17e6cf))[_0xedfd('0x4e')](handleError(_0x450c30,null));};exports[_0xedfd('0x6b')]=function(_0x48832a,_0x1f9425,_0x3a0d55){var _0x20fe78={};var _0x393b25={};var _0x2f2e23;var _0x45acc8;return db['VoiceQueue'][_0xedfd('0x66')]({'where':{'id':_0x48832a[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x1f9425,null))[_0xedfd('0x2a')](function(_0x3d44e5){if(_0x3d44e5){_0x2f2e23=_0x3d44e5;_0x393b25['model']=_['keys'](db['Team'][_0xedfd('0x37')]);_0x393b25[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x48832a[_0xedfd('0x3a')]);_0x393b25[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x393b25[_0xedfd('0x3e')],_0x393b25[_0xedfd('0x3a')]);_0x20fe78[_0xedfd('0x3f')]=_['intersection'](_0x393b25[_0xedfd('0x3e')],qs['fields'](_0x48832a[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x20fe78[_0xedfd('0x3f')]=_0x20fe78[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x20fe78[_0xedfd('0x3f')]:_0x393b25['model'];_0x20fe78['order']=qs[_0xedfd('0x45')](_0x48832a[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x20fe78['where']=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x48832a[_0xedfd('0x3a')],_0x393b25[_0xedfd('0x3c')]));if(_0x48832a[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x20fe78[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x20fe78['where'],{'$or':_[_0xedfd('0x2d')](_0x20fe78[_0xedfd('0x3f')],function(_0x1cf9a2){var _0x433c1d={};_0x433c1d[_0x1cf9a2]={'$like':'%'+_0x48832a[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x433c1d;})});}_0x20fe78=_['merge']({},_0x20fe78,_0x48832a[_0xedfd('0x4a')]);return _0x2f2e23[_0xedfd('0x6b')](_0x20fe78);}})['then'](function(_0x10026b){if(_0x10026b){_0x45acc8=_0x10026b[_0xedfd('0x41')];if(!_0x48832a['query'][_0xedfd('0x42')](_0xedfd('0x43'))){_0x20fe78[_0xedfd('0x24')]=qs[_0xedfd('0x24')](_0x48832a[_0xedfd('0x3a')][_0xedfd('0x24')]);_0x20fe78[_0xedfd('0x23')]=qs[_0xedfd('0x23')](_0x48832a['query'][_0xedfd('0x23')]);}return _0x2f2e23[_0xedfd('0x6b')](_0x20fe78);}})[_0xedfd('0x2a')](function(_0x577f88){if(_0x577f88){return _0x577f88?{'count':_0x45acc8,'rows':_0x577f88}:null;}})[_0xedfd('0x2a')](respondWithResult(_0x1f9425,null))[_0xedfd('0x4e')](handleError(_0x1f9425,null));};exports[_0xedfd('0x6c')]=function(_0x4e5274,_0x551b91,_0x57b657){var _0x9163e3=_0x4e5274[_0xedfd('0x52')]['teams'];var _0x2daf76=_['map'](_0x9163e3,'id');return db[_0xedfd('0x6d')]['findAll']({'where':{'id':_0x2daf76},'attributes':['id'],'include':[{'model':db['User'],'as':_0xedfd('0x6e'),'attributes':['id',_0xedfd('0x35'),_0xedfd('0x6f'),'voicePause',_0xedfd('0x70')],'raw':!![]}]})[_0xedfd('0x2a')](function(_0x57d498){if(_0x57d498){var _0x3139f7=_[_0xedfd('0x71')](_0x57d498,function(_0x2ff1bc){var _0x3af753=_0x2ff1bc[_0xedfd('0x54')]({'plain':!![]});_0x3af753[_0xedfd('0x6e')][_0xedfd('0x72')](function(_0x4e6c31){_0x4e6c31[_0xedfd('0x73')]=_[_0xedfd('0x50')](_0x9163e3,{'id':_0x3af753['id']})['penalty'];});return _0x3af753[_0xedfd('0x6e')];});return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x4e5274[_0xedfd('0x4f')]['id']}})['then'](function(_0x30c6cd){return db[_0xedfd('0x74')][_0xedfd('0x75')](function(_0x9dc086){return _0x30c6cd[_0xedfd('0x6c')](_0x2daf76,{'transaction':_0x9dc086})['then'](function(){return BPromise[_0xedfd('0x76')](_0x9163e3,function(_0x57a8c8){return db[_0xedfd('0x77')][_0xedfd('0x78')]({'TeamId':_0x57a8c8['id'],'VoiceQueueId':_0x4e5274[_0xedfd('0x4f')]['id'],'penalty':_0x57a8c8['penalty']},{'transaction':_0x9dc086});});})['then'](function(){return BPromise[_0xedfd('0x76')](_0x3139f7,function(_0x5bde5e){return db['UserVoiceQueue'][_0xedfd('0x79')]({'where':{'UserId':_0x5bde5e['id'],'VoiceQueueId':_0x4e5274[_0xedfd('0x4f')]['id']},'defaults':{'penalty':_0x5bde5e['penalty']},'transaction':_0x9dc086});});})[_0xedfd('0x2a')](function(){return BPromise[_0xedfd('0x76')](_[_0xedfd('0x2c')](_0x3139f7,{'online':!![]}),function(_0x4664d8){return db[_0xedfd('0x7a')]['upsert']({'membername':_0x4664d8[_0xedfd('0x35')],'UserId':_0x4664d8['id'],'queue_name':_0x30c6cd['name'],'VoiceQueueId':_0x30c6cd['id'],'interface':_['isNil'](_0x4664d8[_0xedfd('0x70')])?util[_0xedfd('0x7b')](_0xedfd('0x7c'),_0x4664d8['name']):_0x4664d8[_0xedfd('0x70')],'paused':_0x4664d8[_0xedfd('0x7d')]||![],'penalty':_0x4664d8[_0xedfd('0x73')]},{'transaction':_0x9dc086});});})[_0xedfd('0x2a')](function(){_0x3139f7[_0xedfd('0x72')](function(_0x10a3e6){socket[_0xedfd('0x7e')]('userVoiceQueue:save',{'UserId':_0x10a3e6['id'],'VoiceQueueId':_0x30c6cd['id']});});});});});}})['then'](respondWithStatusCode(_0x551b91,null))[_0xedfd('0x4e')](handleError(_0x551b91,null));};exports[_0xedfd('0x7f')]=function(_0x3002fc,_0xc9507e,_0x411431){return db[_0xedfd('0x6d')][_0xedfd('0x64')]({'where':{'id':_0x3002fc[_0xedfd('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xedfd('0x80')],'as':_0xedfd('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xc9507e,null))[_0xedfd('0x2a')](function(_0x43f081){var _0x42903f=_[_0xedfd('0x2d')](_0x43f081,'id');var _0x4ce72c=[];var _0x256829=[];var _0x4b1ee0=squel[_0xedfd('0x81')]();_0x4b1ee0[_0xedfd('0x82')]('tq.TeamId')['from'](_0xedfd('0x83'),'tq')['join']('user_has_teams','ut',_0xedfd('0x84'))[_0xedfd('0x46')](_0xedfd('0x85'),_0x3002fc[_0xedfd('0x4f')]['id']);for(var _0x546ff0=0x0;_0x546ff0<_0x43f081[_0xedfd('0x41')];_0x546ff0+=0x1){let _0x186780=_0x43f081[_0x546ff0];for(var _0x49615e=0x0;_0x49615e<_0x186780[_0xedfd('0x6e')][_0xedfd('0x41')];_0x49615e+=0x1){let _0x207c33=_0x186780[_0xedfd('0x6e')][_0x49615e];var _0x3efc4c=_0x4b1ee0[_0xedfd('0x86')]();_0x3efc4c[_0xedfd('0x46')](_0xedfd('0x87'),_0x207c33['id']);_0x256829[_0xedfd('0x88')](db['sequelize'][_0xedfd('0x3a')](_0x3efc4c[_0xedfd('0x89')](),{'type':db[_0xedfd('0x74')]['QueryTypes']['SELECT']})[_0xedfd('0x2a')](function(_0x3e806a){if(_0x3e806a[_0xedfd('0x41')]===0x1){return _0x207c33['id'];}else{var _0x5b193b=_[_0xedfd('0x8a')](_[_0xedfd('0x2d')](_0x3e806a,_0xedfd('0x8b')),function(_0x5b0e57){return _['includes'](_0x42903f,_0x5b0e57);});if(_0x5b193b){return _0x207c33['id'];}}}));}}return BPromise[_0xedfd('0x8c')](_0x256829)[_0xedfd('0x2a')](function(_0x46ca19){_0x4ce72c=_(_0x4ce72c)[_0xedfd('0x8d')](_0x46ca19)[_0xedfd('0x8e')]()[_0xedfd('0x2f')]();return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x3002fc['params']['id']}})[_0xedfd('0x2a')](function(_0x4a143c){return db['sequelize'][_0xedfd('0x75')](function(_0x3f1377){return _0x4a143c[_0xedfd('0x7f')](_0x3002fc[_0xedfd('0x3a')]['ids'],{'transaction':_0x3f1377})[_0xedfd('0x2a')](function(){if(!_[_0xedfd('0x8f')](_0x4ce72c)){return _0x4a143c[_0xedfd('0x90')](_0x4ce72c,{'transaction':_0x3f1377})[_0xedfd('0x2a')](function(){return db[_0xedfd('0x7a')][_0xedfd('0x31')]({'where':{'VoiceQueueId':_0x3002fc[_0xedfd('0x4f')]['id'],'UserId':_0x4ce72c},'transaction':_0x3f1377});});}})[_0xedfd('0x2a')](function(){_0x4ce72c['forEach'](function(_0x39e776){socket[_0xedfd('0x7e')](_0xedfd('0x91'),{'UserId':_0x39e776,'VoiceQueueId':_0x4a143c['id']});});});});});});})['then'](respondWithStatusCode(_0xc9507e,null))['catch'](handleError(_0xc9507e,null));};exports[_0xedfd('0x92')]=function(_0x23d95d,_0x1c3ea1,_0x4eeb94){var _0x15e067,_0x4950f8;return db['VoiceQueue'][_0xedfd('0x50')]({'where':{'id':_0x23d95d[_0xedfd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1c3ea1,null))[_0xedfd('0x2a')](function(_0x28dc0a){if(_0x28dc0a){_0x4950f8=_0x28dc0a;return _0x28dc0a[_0xedfd('0x92')](_0x23d95d[_0xedfd('0x52')][_0xedfd('0x93')],_[_0xedfd('0x5c')](_0x23d95d[_0xedfd('0x52')],[_0xedfd('0x93'),'id'])||{})[_0xedfd('0x94')](function(_0x35cbbf){for(var _0x513eb3=0x0;_0x513eb3<_0x23d95d[_0xedfd('0x52')][_0xedfd('0x93')][_0xedfd('0x41')];_0x513eb3+=0x1){socket[_0xedfd('0x7e')](_0xedfd('0x95'),{'UserId':Number(_0x23d95d[_0xedfd('0x52')][_0xedfd('0x93')][_0x513eb3]),'VoiceQueueId':Number(_0x23d95d[_0xedfd('0x4f')]['id'])});}return _0x35cbbf;});}})['then'](function(_0x253da8){_0x15e067=_0x253da8||[];if(_0x4950f8){return db[_0xedfd('0x80')][_0xedfd('0x64')]({'where':{'id':_0x23d95d[_0xedfd('0x52')]['ids']},'attributes':['id',_0xedfd('0x35'),_0xedfd('0x6f'),'voicePause','interface'],'raw':!![]});}})[_0xedfd('0x2a')](function(_0x2b060b){if(!_[_0xedfd('0x8f')](_0x2b060b)){var _0x16b9e6=[];for(var _0x4f728e=0x0;_0x4f728e<_0x2b060b['length'];_0x4f728e++){if(_0x2b060b[_0x4f728e]['online']){_0x16b9e6[_0xedfd('0x88')](db[_0xedfd('0x7a')]['upsert']({'membername':_0x2b060b[_0x4f728e][_0xedfd('0x35')],'UserId':_0x2b060b[_0x4f728e]['id'],'queue_name':_0x4950f8[_0xedfd('0x35')],'VoiceQueueId':_0x4950f8['id'],'interface':_[_0xedfd('0x96')](_0x2b060b[_0x4f728e][_0xedfd('0x70')])?util[_0xedfd('0x7b')](_0xedfd('0x7c'),_0x2b060b[_0x4f728e][_0xedfd('0x35')]):_0x2b060b[_0x4f728e][_0xedfd('0x70')],'paused':_0x2b060b[_0x4f728e][_0xedfd('0x7d')]||![],'penalty':_0x23d95d[_0xedfd('0x52')]['penalty']||0x0}));}}return BPromise[_0xedfd('0x8c')](_0x16b9e6);}})['then'](function(){return _0x15e067;})[_0xedfd('0x2a')](respondWithResult(_0x1c3ea1,null))[_0xedfd('0x4e')](handleError(_0x1c3ea1,null));};exports[_0xedfd('0x90')]=function(_0x2a45a5,_0x569e4c,_0x1e0e41){return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x2a45a5[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x569e4c,null))[_0xedfd('0x2a')](function(_0x27de16){if(_0x27de16){return _0x27de16[_0xedfd('0x90')](_0x2a45a5[_0xedfd('0x3a')][_0xedfd('0x93')])[_0xedfd('0x2a')](function(){if(_[_0xedfd('0x97')](_0x2a45a5[_0xedfd('0x3a')][_0xedfd('0x93')])){for(var _0x428ec8=0x0;_0x428ec8<_0x2a45a5['query']['ids'][_0xedfd('0x41')];_0x428ec8+=0x1){socket[_0xedfd('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x2a45a5[_0xedfd('0x3a')][_0xedfd('0x93')][_0x428ec8]),'VoiceQueueId':Number(_0x2a45a5['params']['id'])});}}else{socket['emit'](_0xedfd('0x91'),{'UserId':Number(_0x2a45a5[_0xedfd('0x3a')][_0xedfd('0x93')]),'VoiceQueueId':Number(_0x2a45a5[_0xedfd('0x4f')]['id'])});}});}})[_0xedfd('0x2a')](function(_0x53eac3){return db['UserVoiceQueueRt'][_0xedfd('0x31')]({'where':{'VoiceQueueId':_0x2a45a5[_0xedfd('0x4f')]['id'],'UserId':_0x2a45a5[_0xedfd('0x3a')]['ids']}})[_0xedfd('0x2a')](function(){return _0x53eac3;});})[_0xedfd('0x2a')](respondWithStatusCode(_0x569e4c,null))['catch'](handleError(_0x569e4c,null));};exports[_0xedfd('0x98')]=function(_0x265d5c,_0x3d82be,_0x1207dc){var _0x14e168={};var _0x5b89f1={};var _0x3e1743;var _0x37c0fb;return db[_0xedfd('0x36')][_0xedfd('0x66')]({'where':{'id':_0x265d5c[_0xedfd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3d82be,null))['then'](function(_0x3807b5){if(_0x3807b5){_0x3e1743=_0x3807b5;_0x5b89f1[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db[_0xedfd('0x80')][_0xedfd('0x37')]);_0x5b89f1[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x265d5c['query']);_0x5b89f1[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x5b89f1['model'],_0x5b89f1[_0xedfd('0x3a')]);_0x14e168[_0xedfd('0x3f')]=_[_0xedfd('0x3d')](_0x5b89f1['model'],qs[_0xedfd('0x40')](_0x265d5c[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x14e168[_0xedfd('0x3f')]=_0x14e168['attributes'][_0xedfd('0x41')]?_0x14e168['attributes']:_0x5b89f1[_0xedfd('0x3e')];_0x14e168['order']=qs[_0xedfd('0x45')](_0x265d5c[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x14e168[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x265d5c['query'],_0x5b89f1[_0xedfd('0x3c')]));if(_0x265d5c['query'][_0xedfd('0x2c')]){_0x14e168[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x14e168['where'],{'$or':_[_0xedfd('0x2d')](_0x14e168['attributes'],function(_0x9b5ac7){var _0x480a04={};_0x480a04[_0x9b5ac7]={'$like':'%'+_0x265d5c[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x480a04;})});}_0x14e168=_[_0xedfd('0x48')]({},_0x14e168,_0x265d5c[_0xedfd('0x4a')]);return _0x3e1743[_0xedfd('0x98')](_0x14e168);}})[_0xedfd('0x2a')](function(_0x289ae6){if(_0x289ae6){_0x37c0fb=_0x289ae6[_0xedfd('0x41')];if(!_0x265d5c['query'][_0xedfd('0x42')](_0xedfd('0x43'))){_0x14e168[_0xedfd('0x24')]=qs[_0xedfd('0x24')](_0x265d5c[_0xedfd('0x3a')]['limit']);_0x14e168[_0xedfd('0x23')]=qs['offset'](_0x265d5c[_0xedfd('0x3a')][_0xedfd('0x23')]);}return _0x3e1743[_0xedfd('0x98')](_0x14e168);}})[_0xedfd('0x2a')](function(_0x3a714e){if(_0x3a714e){return _0x3a714e?{'count':_0x37c0fb,'rows':_0x3a714e}:null;}})[_0xedfd('0x2a')](respondWithResult(_0x3d82be,null))[_0xedfd('0x4e')](handleError(_0x3d82be,null));};exports[_0xedfd('0x99')]=function(_0x4a23d5,_0x1d96e0,_0x17c187){var _0x1c11f9={};var _0x48d3b1={};var _0x208a5a;var _0x3b47bb;return db[_0xedfd('0x36')]['findOne']({'where':{'id':_0x4a23d5[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x1d96e0,null))[_0xedfd('0x2a')](function(_0x511df0){if(_0x511df0){_0x208a5a=_0x511df0;_0x48d3b1[_0xedfd('0x3e')]=_['keys'](db[_0xedfd('0x7a')][_0xedfd('0x37')]);_0x48d3b1[_0xedfd('0x3a')]=_['keys'](_0x4a23d5[_0xedfd('0x3a')]);_0x48d3b1['filters']=_[_0xedfd('0x3d')](_0x48d3b1[_0xedfd('0x3e')],_0x48d3b1[_0xedfd('0x3a')]);_0x1c11f9[_0xedfd('0x3f')]=_['intersection'](_0x48d3b1[_0xedfd('0x3e')],qs['fields'](_0x4a23d5['query'][_0xedfd('0x40')]));_0x1c11f9[_0xedfd('0x3f')]=_0x1c11f9[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x1c11f9[_0xedfd('0x3f')]:_0x48d3b1[_0xedfd('0x3e')];_0x1c11f9[_0xedfd('0x44')]=qs[_0xedfd('0x45')](_0x4a23d5[_0xedfd('0x3a')]['sort']);_0x1c11f9[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x4a23d5[_0xedfd('0x3a')],_0x48d3b1[_0xedfd('0x3c')]));if(_0x4a23d5[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x1c11f9[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x1c11f9[_0xedfd('0x46')],{'$or':_['map'](_0x1c11f9[_0xedfd('0x3f')],function(_0x3c58d3){var _0x324ba3={};_0x324ba3[_0x3c58d3]={'$like':'%'+_0x4a23d5[_0xedfd('0x3a')]['filter']+'%'};return _0x324ba3;})});}_0x1c11f9=_[_0xedfd('0x48')]({},_0x1c11f9,_0x4a23d5['options']);return _0x208a5a['getMembers'](_0x1c11f9);}})[_0xedfd('0x2a')](function(_0x44714f){if(_0x44714f){_0x3b47bb=_0x44714f['length'];if(!_0x4a23d5['query'][_0xedfd('0x42')](_0xedfd('0x43'))){_0x1c11f9['limit']=qs[_0xedfd('0x24')](_0x4a23d5[_0xedfd('0x3a')]['limit']);_0x1c11f9[_0xedfd('0x23')]=qs[_0xedfd('0x23')](_0x4a23d5[_0xedfd('0x3a')][_0xedfd('0x23')]);}return _0x208a5a[_0xedfd('0x99')](_0x1c11f9);}})[_0xedfd('0x2a')](function(_0x5c4b47){return _0x5c4b47?{'count':_0x3b47bb,'rows':_0x5c4b47}:null;})['then'](respondWithResult(_0x1d96e0,null))[_0xedfd('0x4e')](handleError(_0x1d96e0,null));};exports[_0xedfd('0x9a')]=function(_0x22d8c1,_0x1a0cad,_0x4b19ad){var _0x186053={};var _0x120ed8={};var _0x7ddaba;var _0x19247c;return db[_0xedfd('0x36')]['findOne']({'where':{'id':_0x22d8c1[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x1a0cad,null))[_0xedfd('0x2a')](function(_0x3061d6){if(_0x3061d6){_0x7ddaba=_0x3061d6;_0x120ed8[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db[_0xedfd('0x9b')][_0xedfd('0x37')]);_0x120ed8['query']=_[_0xedfd('0x3b')](_0x22d8c1['query']);_0x120ed8[_0xedfd('0x3c')]=_['intersection'](_0x120ed8[_0xedfd('0x3e')],_0x120ed8[_0xedfd('0x3a')]);_0x186053['attributes']=_[_0xedfd('0x3d')](_0x120ed8[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x22d8c1[_0xedfd('0x3a')]['fields']));_0x186053[_0xedfd('0x3f')]=_0x186053[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x186053[_0xedfd('0x3f')]:_0x120ed8[_0xedfd('0x3e')];_0x186053['order']=qs[_0xedfd('0x45')](_0x22d8c1[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x186053[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x22d8c1[_0xedfd('0x3a')],_0x120ed8[_0xedfd('0x3c')]));if(_0x22d8c1[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x186053[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x186053[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x186053[_0xedfd('0x3f')],function(_0x706056){var _0x48c1fc={};_0x48c1fc[_0x706056]={'$like':'%'+_0x22d8c1[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x48c1fc;})});}_0x186053=_[_0xedfd('0x48')]({},_0x186053,_0x22d8c1[_0xedfd('0x4a')]);return _0x7ddaba[_0xedfd('0x9a')](_0x186053);}})[_0xedfd('0x2a')](function(_0x1fa198){if(_0x1fa198){_0x19247c=_0x1fa198[_0xedfd('0x41')];if(!_0x22d8c1[_0xedfd('0x3a')]['hasOwnProperty'](_0xedfd('0x43'))){_0x186053['limit']=qs['limit'](_0x22d8c1[_0xedfd('0x3a')][_0xedfd('0x24')]);_0x186053['offset']=qs[_0xedfd('0x23')](_0x22d8c1['query'][_0xedfd('0x23')]);}return _0x7ddaba[_0xedfd('0x9a')](_0x186053);}})[_0xedfd('0x2a')](function(_0x731944){if(_0x731944){return _0x731944?{'count':_0x19247c,'rows':_0x731944}:null;}})[_0xedfd('0x2a')](respondWithResult(_0x1a0cad,null))[_0xedfd('0x4e')](handleError(_0x1a0cad,null));};exports['addLists']=function(_0x5cc755,_0x1161f1,_0xc16bb3){var _0xe3813b,_0x43341a;return db[_0xedfd('0x36')]['find']({'where':{'id':_0x5cc755[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x1161f1,null))[_0xedfd('0x2a')](function(_0x6b1f5f){if(_0x6b1f5f){_0x43341a=_0x6b1f5f;return _0x6b1f5f[_0xedfd('0x9c')](_0x5cc755[_0xedfd('0x52')]['ids'],_[_0xedfd('0x5c')](_0x5cc755[_0xedfd('0x52')],[_0xedfd('0x93'),'id'])||{});}return null;})[_0xedfd('0x94')](function(_0xb819ed){var _0x392ff2;_0xe3813b=_0xb819ed||[];var _0x2ab9ab=[];if(_0xb819ed){for(var _0x37bbe4=0x0;_0x37bbe4<_0xb819ed[_0xedfd('0x41')];_0x37bbe4+=0x1){var _0x38d620=_0xb819ed[_0x37bbe4][_0xedfd('0x54')]({'plain':!![]});_0x43341a[_0xedfd('0x9d')]=_0x5cc755[_0xedfd('0x52')][_0xedfd('0x9d')]?_0x5cc755[_0xedfd('0x52')]['dialCheckDuplicateType']:_0x43341a['dialCheckDuplicateType'];switch(_0x43341a[_0xedfd('0x9d')]){case _0xedfd('0x9e'):_0x392ff2=squel[_0xedfd('0x9f')]()['into']('cm_hopper')[_0xedfd('0xa0')]([_0xedfd('0xa1'),_0xedfd('0xa2'),'ContactId',_0xedfd('0xa3'),_0xedfd('0x63'),_0xedfd('0x5a'),_0xedfd('0x5b')],squel[_0xedfd('0x81')]()['field'](_0xedfd('0xa1'),_0xedfd('0xa1'))['field'](_0xedfd('0xa4'),_0xedfd('0xa2'))['field']('id',_0xedfd('0xa5'))['field'](_0x38d620['CmListId']['toString'](),_0xedfd('0xa3'))[_0xedfd('0x82')](_0x5cc755[_0xedfd('0x4f')]['id'][_0xedfd('0x89')](),_0xedfd('0x63'))[_0xedfd('0x82')](_0xedfd('0xa4'),_0xedfd('0x5a'))['field'](_0xedfd('0xa4'),_0xedfd('0x5b'))[_0xedfd('0xa6')](_0xedfd('0xa7'))['where'](_0xedfd('0xa8'))[_0xedfd('0x46')](_0xedfd('0xa9'),_0x38d620[_0xedfd('0xaa')]['toString']())[_0xedfd('0x46')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xedfd('0xab'),squel['select']()[_0xedfd('0x82')]('COALESCE(calleridnum,\x27\x27)')[_0xedfd('0xa6')](_0xedfd('0xac'))[_0xedfd('0x46')](_0xedfd('0x85'),_0x5cc755['params']['id']['toString']()))[_0xedfd('0x46')](_0xedfd('0xab'),squel[_0xedfd('0x81')]()[_0xedfd('0x82')]('COALESCE(phone,\x27\x27)')[_0xedfd('0xa6')](_0xedfd('0xad'))[_0xedfd('0x46')](_0xedfd('0x85'),_0x5cc755['params']['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x392ff2=squel[_0xedfd('0x9f')]()[_0xedfd('0xae')](_0xedfd('0xad'))[_0xedfd('0xa0')](['phone','scheduledAt','ContactId',_0xedfd('0xa3'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xedfd('0x81')]()[_0xedfd('0x82')](_0xedfd('0xa1'),_0xedfd('0xa1'))['field'](_0xedfd('0xa4'),_0xedfd('0xa2'))[_0xedfd('0x82')]('id',_0xedfd('0xa5'))[_0xedfd('0x82')](_0x38d620['CmListId']['toString'](),'ListId')[_0xedfd('0x82')](_0x5cc755[_0xedfd('0x4f')]['id'][_0xedfd('0x89')](),'VoiceQueueId')['field']('NOW()','createdAt')[_0xedfd('0x82')](_0xedfd('0xa4'),_0xedfd('0x5b'))[_0xedfd('0xa6')](_0xedfd('0xa7'))[_0xedfd('0x46')](_0xedfd('0xa8'))['where'](_0xedfd('0xa9'),_0x38d620[_0xedfd('0xaa')]['toString']())[_0xedfd('0x46')](_0xedfd('0xaf'))[_0xedfd('0x46')](_0xedfd('0xab'),squel[_0xedfd('0x81')]()[_0xedfd('0x82')](_0xedfd('0xb0'))['from']('cm_hopper')[_0xedfd('0x46')](_0xedfd('0x85'),_0x5cc755[_0xedfd('0x4f')]['id'][_0xedfd('0x89')]())))[_0xedfd('0x89')]();break;default:_0x392ff2=squel[_0xedfd('0x9f')]()[_0xedfd('0xae')](_0xedfd('0xad'))[_0xedfd('0xa0')]([_0xedfd('0xa1'),'scheduledAt',_0xedfd('0xa5'),_0xedfd('0xa3'),'VoiceQueueId',_0xedfd('0x5a'),_0xedfd('0x5b')],squel['select']()[_0xedfd('0x82')](_0xedfd('0xa1'),'phone')[_0xedfd('0x82')](_0xedfd('0xa4'),_0xedfd('0xa2'))[_0xedfd('0x82')]('id',_0xedfd('0xa5'))[_0xedfd('0x82')](_0x38d620[_0xedfd('0xaa')][_0xedfd('0x89')](),_0xedfd('0xa3'))['field'](_0x5cc755['params']['id'][_0xedfd('0x89')](),_0xedfd('0x63'))[_0xedfd('0x82')]('NOW()','createdAt')['field'](_0xedfd('0xa4'),_0xedfd('0x5b'))['from']('cm_contacts')[_0xedfd('0x46')]('deletedAt\x20IS\x20NULL')[_0xedfd('0x46')](_0xedfd('0xa9'),_0x38d620['CmListId'][_0xedfd('0x89')]())[_0xedfd('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0xedfd('0x89')]();}_0x2ab9ab['push'](db[_0xedfd('0x74')][_0xedfd('0x3a')](_0x392ff2));}return BPromise['all'](_0x2ab9ab);}})[_0xedfd('0x2a')](function(){return _0xe3813b;})['then'](respondWithResult(_0x1161f1,null))[_0xedfd('0x4e')](handleError(_0x1161f1,null));};exports[_0xedfd('0xb1')]=function(_0x155495,_0x37e596,_0x1566aa){return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x155495[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x37e596,null))[_0xedfd('0x2a')](function(_0x12992){if(_0x12992){return _0x12992['removeLists'](_0x155495[_0xedfd('0x3a')][_0xedfd('0x93')]);}})[_0xedfd('0x2a')](function(_0x9bf15d){if(_0x9bf15d){return db[_0xedfd('0x62')][_0xedfd('0x31')]({'where':{'ListId':_0x155495[_0xedfd('0x3a')]['ids'],'VoiceQueueId':_0x155495[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](function(){return _0x9bf15d;});}})[_0xedfd('0x2a')](respondWithStatusCode(_0x37e596,null))[_0xedfd('0x4e')](handleError(_0x37e596,null));};exports[_0xedfd('0xb2')]=function(_0x3f7ce8,_0x2b830e,_0x54c02f){var _0x1d2a75={};var _0xc9ae35={};var _0x1536fc;var _0xf87fd6;return db[_0xedfd('0x36')][_0xedfd('0x66')]({'where':{'id':_0x3f7ce8['params']['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x2b830e,null))['then'](function(_0x48dd7c){if(_0x48dd7c){_0x1536fc=_0x48dd7c;_0xc9ae35[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db['CmList'][_0xedfd('0x37')]);_0xc9ae35[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x3f7ce8[_0xedfd('0x3a')]);_0xc9ae35[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0xc9ae35[_0xedfd('0x3e')],_0xc9ae35[_0xedfd('0x3a')]);_0x1d2a75['attributes']=_['intersection'](_0xc9ae35[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x3f7ce8[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x1d2a75[_0xedfd('0x3f')]=_0x1d2a75[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x1d2a75[_0xedfd('0x3f')]:_0xc9ae35['model'];_0x1d2a75[_0xedfd('0x44')]=qs[_0xedfd('0x45')](_0x3f7ce8['query']['sort']);_0x1d2a75['where']=qs[_0xedfd('0x3c')](_['pick'](_0x3f7ce8[_0xedfd('0x3a')],_0xc9ae35[_0xedfd('0x3c')]));if(_0x3f7ce8[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x1d2a75[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x1d2a75[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x1d2a75[_0xedfd('0x3f')],function(_0x7d18be){var _0x307d99={};_0x307d99[_0x7d18be]={'$like':'%'+_0x3f7ce8[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x307d99;})});}_0x1d2a75=_[_0xedfd('0x48')]({},_0x1d2a75,_0x3f7ce8['options']);return _0x1536fc[_0xedfd('0xb2')](_0x1d2a75);}})[_0xedfd('0x2a')](function(_0x264f99){if(_0x264f99){_0xf87fd6=_0x264f99['length'];if(!_0x3f7ce8['query']['hasOwnProperty'](_0xedfd('0x43'))){_0x1d2a75[_0xedfd('0x24')]=qs['limit'](_0x3f7ce8[_0xedfd('0x3a')]['limit']);_0x1d2a75[_0xedfd('0x23')]=qs[_0xedfd('0x23')](_0x3f7ce8[_0xedfd('0x3a')][_0xedfd('0x23')]);}return _0x1536fc[_0xedfd('0xb2')](_0x1d2a75);}})[_0xedfd('0x2a')](function(_0x292151){if(_0x292151){return _0x292151?{'count':_0xf87fd6,'rows':_0x292151}:null;}})[_0xedfd('0x2a')](respondWithResult(_0x2b830e,null))[_0xedfd('0x4e')](handleError(_0x2b830e,null));};exports[_0xedfd('0xb3')]=function(_0x2b1eae,_0x235848,_0x348ad9){var _0x337459,_0x327862;return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x2b1eae['params']['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x235848,null))['then'](function(_0x1ac990){if(_0x1ac990){_0x327862=_0x1ac990;return _0x1ac990['addBlackLists'](_0x2b1eae[_0xedfd('0x52')][_0xedfd('0x93')],_[_0xedfd('0x5c')](_0x2b1eae[_0xedfd('0x52')],[_0xedfd('0x93'),'id'])||{});}return null;})['spread'](function(_0x4f4d4c){var _0x390e73;_0x337459=_0x4f4d4c||[];var _0x126ab9=[];if(_0x4f4d4c){for(var _0x2c6a58=0x0;_0x2c6a58<_0x4f4d4c['length'];_0x2c6a58+=0x1){var _0x23a47c=_0x4f4d4c[_0x2c6a58][_0xedfd('0x54')]({'plain':!![]});_0x390e73=squel[_0xedfd('0x9f')]()[_0xedfd('0xae')](_0xedfd('0xb4'))[_0xedfd('0xa0')]([_0xedfd('0xa1'),_0xedfd('0xa5'),_0xedfd('0xa3'),_0xedfd('0x63'),'createdAt',_0xedfd('0x5b')],squel['select']()['field']('phone',_0xedfd('0xa1'))[_0xedfd('0x82')]('id',_0xedfd('0xa5'))[_0xedfd('0x82')](_0x23a47c[_0xedfd('0xaa')][_0xedfd('0x89')](),_0xedfd('0xa3'))[_0xedfd('0x82')](_0x2b1eae[_0xedfd('0x4f')]['id'][_0xedfd('0x89')](),'VoiceQueueId')[_0xedfd('0x82')](_0xedfd('0xa4'),'createdAt')[_0xedfd('0x82')](_0xedfd('0xa4'),_0xedfd('0x5b'))[_0xedfd('0xa6')](_0xedfd('0xa7'))[_0xedfd('0x46')](_0xedfd('0xa8'))[_0xedfd('0x46')](_0xedfd('0xa9'),_0x23a47c[_0xedfd('0xaa')][_0xedfd('0x89')]())[_0xedfd('0x46')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x126ab9[_0xedfd('0x88')](db[_0xedfd('0x74')][_0xedfd('0x3a')](_0x390e73));}return BPromise[_0xedfd('0x8c')](_0x126ab9);}})['then'](function(){return _0x337459;})['then'](respondWithResult(_0x235848,null))[_0xedfd('0x4e')](handleError(_0x235848,null));};exports[_0xedfd('0xb5')]=function(_0x3988cd,_0x37c819,_0x43335e){return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x3988cd[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x37c819,null))[_0xedfd('0x2a')](function(_0x17c774){if(_0x17c774){return _0x17c774['removeBlackLists'](_0x3988cd[_0xedfd('0x3a')][_0xedfd('0x93')]);}})['then'](function(_0x1a3b1a){if(_0x1a3b1a){return db[_0xedfd('0x6a')][_0xedfd('0x31')]({'where':{'ListId':_0x3988cd[_0xedfd('0x3a')][_0xedfd('0x93')],'VoiceQueueId':_0x3988cd['params']['id']}})['then'](function(){return _0x1a3b1a;});}})[_0xedfd('0x2a')](respondWithStatusCode(_0x37c819,null))[_0xedfd('0x4e')](handleError(_0x37c819,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8016bf9..71cf28f 100644 --- a/server/api/voiceQueue/voiceQueue.events.js +++ b/server/api/voiceQueue/voiceQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b72=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0x3b72,0x186));var _0x23b7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3b72[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0x23b7('0x0'));var VoiceQueue=require(_0x23b7('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x23b7('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x10bb87){return function(_0x43c8ac,_0x2a9f41,_0x514f35){VoiceQueueEvents['emit'](_0x10bb87+':'+_0x43c8ac['id'],_0x43c8ac);VoiceQueueEvents[_0x23b7('0x3')](_0x10bb87,_0x43c8ac);_0x514f35(null);};}for(var e in events){if(events[_0x23b7('0x4')](e)){var event=events[e];VoiceQueue[_0x23b7('0x5')](e,emitEvent(event));}}module[_0x23b7('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x8c0f=['update','emit','exports','events','../../mysqldb','save'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x8c0f,0x7b));var _0xf8c0=function(_0x13d388,_0x1743c0){_0x13d388=_0x13d388-0x0;var _0x5ec11c=_0x8c0f[_0x13d388];return _0x5ec11c;};'use strict';var EventEmitter=require(_0xf8c0('0x0'));var VoiceQueue=require(_0xf8c0('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8c0('0x2'),'afterUpdate':_0xf8c0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x192581){return function(_0x1a1b83,_0x5f78dd,_0x449170){VoiceQueueEvents[_0xf8c0('0x4')](_0x192581+':'+_0x1a1b83['id'],_0x1a1b83);VoiceQueueEvents[_0xf8c0('0x4')](_0x192581,_0x1a1b83);_0x449170(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xf8c0('0x5')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 0c4168c..9a8a417 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1a495f,_0x340156){var _0x54e061=function(_0x180c7d){while(--_0x180c7d){_0x1a495f['push'](_0x1a495f['shift']());}};_0x54e061(++_0x340156);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x3fbe46,_0x12a0d1){var _0x27c406=function(_0x4a1020){while(--_0x4a1020){_0x3fbe46['push'](_0x3fbe46['shift']());}};_0x27c406(++_0x12a0d1);}(_0x008c,0x188));var _0xc008=function(_0x1ed791,_0x3c86aa){_0x1ed791=_0x1ed791-0x0;var _0xea6482=_0x008c[_0x1ed791];return _0xea6482;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 559aa17..efaa1b2 100644 --- a/server/api/voiceQueue/voiceQueue.rpc.js +++ b/server/api/voiceQueue/voiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe793=['redis','localhost','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowVoiceQueue','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3b5587,_0x22a6f4){var _0x3fbb62=function(_0x41f5ce){while(--_0x41f5ce){_0x3b5587['push'](_0x3b5587['shift']());}};_0x3fbb62(++_0x22a6f4);}(_0xe793,0x71));var _0x3e79=function(_0x53e6a2,_0x2b4210){_0x53e6a2=_0x53e6a2-0x0;var _0x461f28=_0xe793[_0x53e6a2];return _0x461f28;};'use strict';var _=require(_0x3e79('0x0'));var util=require(_0x3e79('0x1'));var moment=require(_0x3e79('0x2'));var BPromise=require(_0x3e79('0x3'));var rs=require(_0x3e79('0x4'));var fs=require('fs');var Redis=require(_0x3e79('0x5'));var db=require(_0x3e79('0x6'))['db'];var utils=require(_0x3e79('0x7'));var logger=require('../../config/logger')(_0x3e79('0x8'));var config=require(_0x3e79('0x9'));var jayson=require(_0x3e79('0xa'));var client=jayson[_0x3e79('0xb')][_0x3e79('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3e79('0xd')],{'host':_0x3e79('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3e79('0xf'))[_0x3e79('0x10')](socket);function respondWithRpcPromise(_0x1c6eac,_0x39b27f,_0x4cbab4){return new BPromise(function(_0x3d3798,_0x221726){return client[_0x3e79('0x11')](_0x1c6eac,_0x4cbab4)[_0x3e79('0x12')](function(_0x405b05){logger[_0x3e79('0x13')](_0x3e79('0x14'),_0x39b27f,_0x3e79('0x15'));logger['debug'](_0x3e79('0x16'),_0x39b27f,_0x3e79('0x15'),JSON[_0x3e79('0x17')](_0x405b05));if(_0x405b05[_0x3e79('0x18')]){if(_0x405b05['error']['code']===0x1f4){logger['error'](_0x3e79('0x14'),_0x39b27f,_0x405b05['error'][_0x3e79('0x19')]);return _0x221726(_0x405b05['error']['message']);}logger[_0x3e79('0x18')](_0x3e79('0x14'),_0x39b27f,_0x405b05['error'][_0x3e79('0x19')]);return _0x3d3798(_0x405b05['error']['message']);}else{logger[_0x3e79('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x39b27f,'request\x20sent');_0x3d3798(_0x405b05[_0x3e79('0x1a')][_0x3e79('0x19')]);}})[_0x3e79('0x1b')](function(_0x4f97dc){logger[_0x3e79('0x18')](_0x3e79('0x14'),_0x39b27f,_0x4f97dc);_0x221726(_0x4f97dc);});});}exports[_0x3e79('0x1c')]=function(_0x3c622c){var _0x4a167e=this;return new Promise(function(_0x50603d,_0x242d77){return db[_0x3e79('0x1d')][_0x3e79('0x1e')]({'raw':_0x3c622c[_0x3e79('0x1f')]?_0x3c622c[_0x3e79('0x1f')][_0x3e79('0x20')]===undefined?!![]:![]:!![],'where':_0x3c622c[_0x3e79('0x1f')]?_0x3c622c[_0x3e79('0x1f')][_0x3e79('0x21')]||null:null,'attributes':_0x3c622c[_0x3e79('0x1f')]?_0x3c622c[_0x3e79('0x1f')][_0x3e79('0x22')]||null:null,'limit':_0x3c622c[_0x3e79('0x1f')]?_0x3c622c['options'][_0x3e79('0x23')]||null:null,'include':_0x3c622c[_0x3e79('0x1f')]?_0x3c622c[_0x3e79('0x1f')][_0x3e79('0x24')]?_['map'](_0x3c622c[_0x3e79('0x1f')]['include'],function(_0x55afbf){return{'model':db[_0x55afbf[_0x3e79('0x25')]],'as':_0x55afbf['as'],'attributes':_0x55afbf['attributes'],'include':_0x55afbf[_0x3e79('0x24')]?_[_0x3e79('0x26')](_0x55afbf[_0x3e79('0x24')],function(_0x16b39c){return{'model':db[_0x16b39c[_0x3e79('0x25')]],'as':_0x16b39c['as'],'attributes':_0x16b39c[_0x3e79('0x22')],'include':_0x16b39c[_0x3e79('0x24')]?_[_0x3e79('0x26')](_0x16b39c[_0x3e79('0x24')],function(_0x1ce989){return{'model':db[_0x1ce989[_0x3e79('0x25')]],'as':_0x1ce989['as'],'attributes':_0x1ce989['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11f9da){logger[_0x3e79('0x13')](_0x3e79('0x1c'),_0x3c622c);logger['debug'](_0x3e79('0x1c'),_0x3c622c,JSON[_0x3e79('0x17')](_0x11f9da));_0x50603d(_0x11f9da);})[_0x3e79('0x1b')](function(_0x79b4a6){logger[_0x3e79('0x18')](_0x3e79('0x1c'),_0x79b4a6[_0x3e79('0x19')],_0x3c622c);_0x242d77(_0x4a167e['error'](0x1f4,_0x79b4a6[_0x3e79('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x2c7690){var _0x37f53d=this;return new Promise(function(_0x5da916,_0x343127){return db['VoiceQueue'][_0x3e79('0x27')]({'raw':_0x2c7690['options']?_0x2c7690['options'][_0x3e79('0x20')]===undefined?!![]:![]:!![],'where':_0x2c7690[_0x3e79('0x1f')]?_0x2c7690[_0x3e79('0x1f')][_0x3e79('0x21')]||null:null,'attributes':_0x2c7690[_0x3e79('0x1f')]?_0x2c7690[_0x3e79('0x1f')][_0x3e79('0x22')]||null:null,'include':_0x2c7690[_0x3e79('0x1f')]?_0x2c7690[_0x3e79('0x1f')]['include']?_[_0x3e79('0x26')](_0x2c7690[_0x3e79('0x1f')][_0x3e79('0x24')],function(_0x32d5cf){return{'model':db[_0x32d5cf['model']],'as':_0x32d5cf['as'],'attributes':_0x32d5cf[_0x3e79('0x22')],'include':_0x32d5cf['include']?_[_0x3e79('0x26')](_0x32d5cf[_0x3e79('0x24')],function(_0x5c44a7){return{'model':db[_0x5c44a7['model']],'as':_0x5c44a7['as'],'attributes':_0x5c44a7[_0x3e79('0x22')],'include':_0x5c44a7['include']?_['map'](_0x5c44a7[_0x3e79('0x24')],function(_0x51eb55){return{'model':db[_0x51eb55[_0x3e79('0x25')]],'as':_0x51eb55['as'],'attributes':_0x51eb55[_0x3e79('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3e79('0x12')](function(_0x5d81e0){logger[_0x3e79('0x13')](_0x3e79('0x28'),_0x2c7690);logger[_0x3e79('0x29')](_0x3e79('0x28'),_0x2c7690,JSON[_0x3e79('0x17')](_0x5d81e0));_0x5da916(_0x5d81e0);})[_0x3e79('0x1b')](function(_0x5c81b2){logger[_0x3e79('0x18')](_0x3e79('0x28'),_0x5c81b2['message'],_0x2c7690);_0x343127(_0x37f53d[_0x3e79('0x18')](0x1f4,_0x5c81b2['message']));});});}; \ No newline at end of file +var _0x0942=['register','request','then','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceQueue,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x43352f,_0x440b48){var _0x9a21b0=function(_0x3b5bee){while(--_0x3b5bee){_0x43352f['push'](_0x43352f['shift']());}};_0x9a21b0(++_0x440b48);}(_0x0942,0x173));var _0x2094=function(_0x2b4eb0,_0x145855){_0x2b4eb0=_0x2b4eb0-0x0;var _0x3e9e10=_0x0942[_0x2b4eb0];return _0x3e9e10;};'use strict';var _=require(_0x2094('0x0'));var util=require(_0x2094('0x1'));var moment=require(_0x2094('0x2'));var BPromise=require(_0x2094('0x3'));var rs=require(_0x2094('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2094('0x5'))['db'];var utils=require(_0x2094('0x6'));var logger=require('../../config/logger')(_0x2094('0x7'));var config=require(_0x2094('0x8'));var jayson=require(_0x2094('0x9'));var client=jayson[_0x2094('0xa')][_0x2094('0xb')]({'port':0x232a});config[_0x2094('0xc')]=_[_0x2094('0xd')](config[_0x2094('0xc')],{'host':_0x2094('0xe'),'port':0x18eb});var socket=require(_0x2094('0xf'))(new Redis(config[_0x2094('0xc')]));require('./voiceQueue.socket')[_0x2094('0x10')](socket);function respondWithRpcPromise(_0x2c54b8,_0x10cbb0,_0xbd753d){return new BPromise(function(_0x358747,_0x4e2869){return client[_0x2094('0x11')](_0x2c54b8,_0xbd753d)[_0x2094('0x12')](function(_0x17396f){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x10cbb0,'request\x20sent');logger[_0x2094('0x13')](_0x2094('0x14'),_0x10cbb0,_0x2094('0x15'),JSON['stringify'](_0x17396f));if(_0x17396f[_0x2094('0x16')]){if(_0x17396f[_0x2094('0x16')][_0x2094('0x17')]===0x1f4){logger[_0x2094('0x16')](_0x2094('0x18'),_0x10cbb0,_0x17396f['error'][_0x2094('0x19')]);return _0x4e2869(_0x17396f['error'][_0x2094('0x19')]);}logger[_0x2094('0x16')](_0x2094('0x18'),_0x10cbb0,_0x17396f[_0x2094('0x16')][_0x2094('0x19')]);return _0x358747(_0x17396f[_0x2094('0x16')][_0x2094('0x19')]);}else{logger[_0x2094('0x1a')](_0x2094('0x18'),_0x10cbb0,'request\x20sent');_0x358747(_0x17396f[_0x2094('0x1b')]['message']);}})[_0x2094('0x1c')](function(_0x17ff8c){logger[_0x2094('0x16')](_0x2094('0x18'),_0x10cbb0,_0x17ff8c);_0x4e2869(_0x17ff8c);});});}exports[_0x2094('0x1d')]=function(_0xa67059){var _0x8b6b88=this;return new Promise(function(_0x530207,_0x209358){return db[_0x2094('0x1e')][_0x2094('0x1f')]({'raw':_0xa67059['options']?_0xa67059[_0x2094('0x20')][_0x2094('0x21')]===undefined?!![]:![]:!![],'where':_0xa67059[_0x2094('0x20')]?_0xa67059['options'][_0x2094('0x22')]||null:null,'attributes':_0xa67059[_0x2094('0x20')]?_0xa67059[_0x2094('0x20')][_0x2094('0x23')]||null:null,'limit':_0xa67059[_0x2094('0x20')]?_0xa67059[_0x2094('0x20')][_0x2094('0x24')]||null:null,'include':_0xa67059[_0x2094('0x20')]?_0xa67059[_0x2094('0x20')][_0x2094('0x25')]?_['map'](_0xa67059[_0x2094('0x20')][_0x2094('0x25')],function(_0x5b9363){return{'model':db[_0x5b9363['model']],'as':_0x5b9363['as'],'attributes':_0x5b9363[_0x2094('0x23')],'include':_0x5b9363[_0x2094('0x25')]?_[_0x2094('0x26')](_0x5b9363['include'],function(_0x55009d){return{'model':db[_0x55009d[_0x2094('0x27')]],'as':_0x55009d['as'],'attributes':_0x55009d[_0x2094('0x23')],'include':_0x55009d[_0x2094('0x25')]?_['map'](_0x55009d[_0x2094('0x25')],function(_0xec48ce){return{'model':db[_0xec48ce[_0x2094('0x27')]],'as':_0xec48ce['as'],'attributes':_0xec48ce[_0x2094('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2094('0x12')](function(_0x32f31e){logger['info'](_0x2094('0x1d'),_0xa67059);logger[_0x2094('0x13')](_0x2094('0x1d'),_0xa67059,JSON[_0x2094('0x28')](_0x32f31e));_0x530207(_0x32f31e);})[_0x2094('0x1c')](function(_0x5af66d){logger[_0x2094('0x16')](_0x2094('0x1d'),_0x5af66d[_0x2094('0x19')],_0xa67059);_0x209358(_0x8b6b88[_0x2094('0x16')](0x1f4,_0x5af66d[_0x2094('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x1f7079){var _0x54c000=this;return new Promise(function(_0x3c2116,_0x238f0b){return db[_0x2094('0x1e')][_0x2094('0x29')]({'raw':_0x1f7079[_0x2094('0x20')]?_0x1f7079['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f7079[_0x2094('0x20')]?_0x1f7079[_0x2094('0x20')]['where']||null:null,'attributes':_0x1f7079[_0x2094('0x20')]?_0x1f7079[_0x2094('0x20')][_0x2094('0x23')]||null:null,'include':_0x1f7079[_0x2094('0x20')]?_0x1f7079[_0x2094('0x20')][_0x2094('0x25')]?_[_0x2094('0x26')](_0x1f7079[_0x2094('0x20')][_0x2094('0x25')],function(_0x5430b9){return{'model':db[_0x5430b9[_0x2094('0x27')]],'as':_0x5430b9['as'],'attributes':_0x5430b9[_0x2094('0x23')],'include':_0x5430b9[_0x2094('0x25')]?_[_0x2094('0x26')](_0x5430b9[_0x2094('0x25')],function(_0x4e7284){return{'model':db[_0x4e7284[_0x2094('0x27')]],'as':_0x4e7284['as'],'attributes':_0x4e7284[_0x2094('0x23')],'include':_0x4e7284[_0x2094('0x25')]?_['map'](_0x4e7284['include'],function(_0x3b0413){return{'model':db[_0x3b0413[_0x2094('0x27')]],'as':_0x3b0413['as'],'attributes':_0x3b0413['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd33cb){logger[_0x2094('0x1a')](_0x2094('0x2a'),_0x1f7079);logger['debug'](_0x2094('0x2a'),_0x1f7079,JSON['stringify'](_0xd33cb));_0x3c2116(_0xd33cb);})[_0x2094('0x1c')](function(_0x3725fa){logger['error'](_0x2094('0x2a'),_0x3725fa[_0x2094('0x19')],_0x1f7079);_0x238f0b(_0x54c000['error'](0x1f4,_0x3725fa['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index b97b4e8..257f610 100644 --- a/server/api/voiceQueue/voiceQueue.socket.js +++ b/server/api/voiceQueue/voiceQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x241b=['register','length','voiceQueue:','save','remove','removeListener'];(function(_0x85dde3,_0x327b7d){var _0x346fb8=function(_0x561b15){while(--_0x561b15){_0x85dde3['push'](_0x85dde3['shift']());}};_0x346fb8(++_0x327b7d);}(_0x241b,0xd5));var _0xb241=function(_0x29ef89,_0x16f82a){_0x29ef89=_0x29ef89-0x0;var _0x4c5ad4=_0x241b[_0x29ef89];return _0x4c5ad4;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xb241('0x0'),_0xb241('0x1'),'update'];function createListener(_0x13596d,_0xec1620){return function(_0x18d538){_0xec1620['emit'](_0x13596d,_0x18d538);};}function removeListener(_0x1273d4,_0x52a90a){return function(){VoiceQueueEvents[_0xb241('0x2')](_0x1273d4,_0x52a90a);};}exports[_0xb241('0x3')]=function(_0x5ebf12){for(var _0x56fb21=0x0,_0x78c37f=events[_0xb241('0x4')];_0x56fb21<_0x78c37f;_0x56fb21++){var _0x5ca6c8=events[_0x56fb21];var _0x3b338c=createListener(_0xb241('0x5')+_0x5ca6c8,_0x5ebf12);VoiceQueueEvents['on'](_0x5ca6c8,_0x3b338c);}}; \ No newline at end of file +var _0xedff=['emit','register','voiceQueue:','save','remove'];(function(_0x268d04,_0x1d6c99){var _0x193919=function(_0x226091){while(--_0x226091){_0x268d04['push'](_0x268d04['shift']());}};_0x193919(++_0x1d6c99);}(_0xedff,0x94));var _0xfedf=function(_0x25e426,_0x2f3a59){_0x25e426=_0x25e426-0x0;var _0x5b8625=_0xedff[_0x25e426];return _0x5b8625;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xfedf('0x0'),_0xfedf('0x1'),'update'];function createListener(_0x443a9a,_0x3a47c9){return function(_0x2c7d34){_0x3a47c9[_0xfedf('0x2')](_0x443a9a,_0x2c7d34);};}function removeListener(_0x41042d,_0x56b097){return function(){VoiceQueueEvents['removeListener'](_0x41042d,_0x56b097);};}exports[_0xfedf('0x3')]=function(_0x3b779b){for(var _0x3b4eee=0x0,_0x5ce282=events['length'];_0x3b4eee<_0x5ce282;_0x3b4eee++){var _0x1ba804=events[_0x3b4eee];var _0xcd7eb9=createListener(_0xfedf('0x4')+_0x1ba804,_0x3b779b);VoiceQueueEvents['on'](_0x1ba804,_0xcd7eb9);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 5d6d9ed..1b6ac15 100644 --- a/server/api/voiceQueueReport/index.js +++ b/server/api/voiceQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9368=['update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','/:id','show','post','create'];(function(_0x577fac,_0x33960b){var _0x49a744=function(_0x67fe0b){while(--_0x67fe0b){_0x577fac['push'](_0x577fac['shift']());}};_0x49a744(++_0x33960b);}(_0x9368,0xdf));var _0x8936=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x9368[_0x4d8666];return _0x37175b;};'use strict';var multer=require(_0x8936('0x0'));var util=require('util');var path=require(_0x8936('0x1'));var timeout=require(_0x8936('0x2'));var express=require(_0x8936('0x3'));var router=express[_0x8936('0x4')]();var fs_extra=require(_0x8936('0x5'));var auth=require(_0x8936('0x6'));var interaction=require(_0x8936('0x7'));var config=require(_0x8936('0x8'));var controller=require(_0x8936('0x9'));router[_0x8936('0xa')]('/',auth[_0x8936('0xb')](),controller['index']);router[_0x8936('0xa')](_0x8936('0xc'),auth[_0x8936('0xb')](),controller[_0x8936('0xd')]);router[_0x8936('0xa')](_0x8936('0xe'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x8936('0xa')](_0x8936('0xf'),auth[_0x8936('0xb')](),controller[_0x8936('0x10')]);router[_0x8936('0x11')]('/',auth[_0x8936('0xb')](),controller[_0x8936('0x12')]);router['put'](_0x8936('0xf'),auth[_0x8936('0xb')](),controller[_0x8936('0x13')]);router['delete'](_0x8936('0xf'),auth[_0x8936('0xb')](),controller[_0x8936('0x14')]);module[_0x8936('0x15')]=router; \ No newline at end of file +var _0x939a=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update'];(function(_0x38e191,_0x8d5355){var _0x4af767=function(_0x29faac){while(--_0x29faac){_0x38e191['push'](_0x38e191['shift']());}};_0x4af767(++_0x8d5355);}(_0x939a,0x12d));var _0xa939=function(_0x4e7b44,_0x5db395){_0x4e7b44=_0x4e7b44-0x0;var _0x153a5e=_0x939a[_0x4e7b44];return _0x153a5e;};'use strict';var multer=require(_0xa939('0x0'));var util=require(_0xa939('0x1'));var path=require(_0xa939('0x2'));var timeout=require(_0xa939('0x3'));var express=require(_0xa939('0x4'));var router=express[_0xa939('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa939('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa939('0x7'));var controller=require(_0xa939('0x8'));router[_0xa939('0x9')]('/',auth[_0xa939('0xa')](),controller['index']);router['get'](_0xa939('0xb'),auth[_0xa939('0xa')](),controller[_0xa939('0xc')]);router[_0xa939('0x9')](_0xa939('0xd'),auth[_0xa939('0xa')](),controller[_0xa939('0xe')]);router[_0xa939('0x9')]('/:id',auth[_0xa939('0xa')](),controller[_0xa939('0xf')]);router[_0xa939('0x10')]('/',auth[_0xa939('0xa')](),controller[_0xa939('0x11')]);router[_0xa939('0x12')](_0xa939('0x13'),auth[_0xa939('0xa')](),controller[_0xa939('0x14')]);router[_0xa939('0x15')]('/:id',auth[_0xa939('0xa')](),controller['destroy']);module[_0xa939('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 641431e..82124eb 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.attributes.js +++ b/server/api/voiceQueueReport/voiceQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60d6=['sequelize','moment','STRING','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','DATE','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x1087a7,_0x31857f){var _0x515f3d=function(_0x3d98f6){while(--_0x3d98f6){_0x1087a7['push'](_0x1087a7['shift']());}};_0x515f3d(++_0x31857f);}(_0x60d6,0x160));var _0x660d=function(_0x4b07a4,_0x14fb16){_0x4b07a4=_0x4b07a4-0x0;var _0x4f07e8=_0x60d6[_0x4b07a4];return _0x4f07e8;};'use strict';var Sequelize=require(_0x660d('0x0'));var moment=require(_0x660d('0x1'));module['exports']={'type':{'type':Sequelize[_0x660d('0x2')]},'uniqueid':{'type':Sequelize[_0x660d('0x2')]},'calleridnum':{'type':Sequelize[_0x660d('0x2')]},'calleridname':{'type':Sequelize[_0x660d('0x2')]},'queue':{'type':Sequelize[_0x660d('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x2da547){var _0x266695=moment(_0x2da547);var _0x5cbfd0=moment(this[_0x660d('0x3')](_0x660d('0x4')))[_0x660d('0x5')](_0x660d('0x6'));var _0x41fb3c=_0x266695[_0x660d('0x7')](_0x5cbfd0,'seconds');this[_0x660d('0x8')](_0x660d('0x9'),_0x2da547);this[_0x660d('0x8')](_0x660d('0xa'),_0x41fb3c||null);}},'position':{'type':Sequelize[_0x660d('0xb')]},'count':{'type':Sequelize[_0x660d('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x660d('0xc')]},'queuecallercomplete':{'type':Sequelize[_0x660d('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x660d('0xc')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x660d('0xe')},'originalposition':{'type':Sequelize[_0x660d('0xb')]},'channel':{'type':Sequelize[_0x660d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x660d('0x2')]},'connectedlinename':{'type':Sequelize[_0x660d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x660d('0x2')]},'exten':{'type':Sequelize[_0x660d('0x2')]},'priority':{'type':Sequelize[_0x660d('0x2')]},'holdtime':{'type':Sequelize[_0x660d('0xb')]},'mohtime':{'type':Sequelize[_0x660d('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x660d('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x660d('0x2')]},'transfer':{'type':Sequelize[_0x660d('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x660d('0x2')],'comment':_0x660d('0xf')},'transferexten':{'type':Sequelize[_0x660d('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x660d('0x2')]},'secondDisposition':{'type':Sequelize[_0x660d('0x2')]},'thirdDisposition':{'type':Sequelize[_0x660d('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x660d('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5bb9=['sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x175c5e,_0x2581fe){var _0x3e1158=function(_0x1919a0){while(--_0x1919a0){_0x175c5e['push'](_0x175c5e['shift']());}};_0x3e1158(++_0x2581fe);}(_0x5bb9,0xb4));var _0x95bb=function(_0x8f3051,_0x12c59f){_0x8f3051=_0x8f3051-0x0;var _0x518a60=_0x5bb9[_0x8f3051];return _0x518a60;};'use strict';var Sequelize=require(_0x95bb('0x0'));var moment=require(_0x95bb('0x1'));module[_0x95bb('0x2')]={'type':{'type':Sequelize[_0x95bb('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x95bb('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x95bb('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x95bb('0x4')],'set':function(_0x33447f){var _0x5414d9=moment(_0x33447f);var _0x509ae8=moment(this['getDataValue'](_0x95bb('0x5')))[_0x95bb('0x6')](_0x95bb('0x7'));var _0x477559=_0x5414d9[_0x95bb('0x8')](_0x509ae8,'seconds');this['setDataValue'](_0x95bb('0x9'),_0x33447f);this[_0x95bb('0xa')]('holdtime',_0x477559||null);}},'position':{'type':Sequelize[_0x95bb('0xb')]},'count':{'type':Sequelize[_0x95bb('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x95bb('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x95bb('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x95bb('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x95bb('0x4')]},'queuecallerexit':{'type':Sequelize[_0x95bb('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x95bb('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x95bb('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x95bb('0x3')]},'connectedlinename':{'type':Sequelize[_0x95bb('0x3')]},'accountcode':{'type':Sequelize[_0x95bb('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x95bb('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x95bb('0xb')]},'mohtime':{'type':Sequelize[_0x95bb('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x95bb('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x95bb('0x3')]},'transfer':{'type':Sequelize[_0x95bb('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x95bb('0x3')],'comment':_0x95bb('0xe')},'transferexten':{'type':Sequelize[_0x95bb('0x3')]},'transferuniqueid':{'type':Sequelize[_0x95bb('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x95bb('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x95bb('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 451fe08..6c81074 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2704=['sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','error','stack','name','index','map','VoiceQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','order','eml-format','rimraf','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register'];(function(_0x4ca89a,_0x33ffb8){var _0xfeb04d=function(_0x513820){while(--_0x513820){_0x4ca89a['push'](_0x4ca89a['shift']());}};_0xfeb04d(++_0x33ffb8);}(_0x2704,0x1b8));var _0x4270=function(_0x3d3b05,_0x334c57){_0x3d3b05=_0x3d3b05-0x0;var _0x2c6ca3=_0x2704[_0x3d3b05];return _0x2c6ca3;};'use strict';var emlformat=require(_0x4270('0x0'));var rimraf=require(_0x4270('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4270('0x2'));var BPromise=require(_0x4270('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4270('0x4'));var sox=require(_0x4270('0x5'));var csv=require(_0x4270('0x6'));var ejs=require(_0x4270('0x7'));var fs=require('fs');var fs_extra=require(_0x4270('0x8'));var _=require(_0x4270('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4270('0xa'));var toCsv=require(_0x4270('0x6'));var querystring=require(_0x4270('0xb'));var Papa=require(_0x4270('0xc'));var Redis=require(_0x4270('0xd'));var authService=require(_0x4270('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4270('0xf'));var hardwareService=require(_0x4270('0x10'));var logger=require(_0x4270('0x11'))(_0x4270('0x12'));var utils=require(_0x4270('0x13'));var config=require(_0x4270('0x14'));var licenseUtil=require(_0x4270('0x15'));var db=require(_0x4270('0x16'))['db'];config[_0x4270('0x17')]=_[_0x4270('0x18')](config[_0x4270('0x17')],{'host':_0x4270('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4270('0x17')]));require(_0x4270('0x1a'))[_0x4270('0x1b')](socket);function respondWithStatusCode(_0xcf422e,_0x39ea71){_0x39ea71=_0x39ea71||0xcc;return function(_0x2f1f2e){if(_0x2f1f2e){return _0xcf422e[_0x4270('0x1c')](_0x39ea71);}return _0xcf422e[_0x4270('0x1d')](_0x39ea71)[_0x4270('0x1e')]();};}function respondWithResult(_0x4cf6f8,_0x692236){_0x692236=_0x692236||0xc8;return function(_0x629df7){if(_0x629df7){return _0x4cf6f8[_0x4270('0x1d')](_0x692236)[_0x4270('0x1f')](_0x629df7);}};}function respondWithFilteredResult(_0x11a868,_0xe2d585){return function(_0x39162e){if(_0x39162e){var _0x30d065=typeof _0xe2d585[_0x4270('0x20')]==='undefined'&&typeof _0xe2d585[_0x4270('0x21')]==='undefined';var _0x4ba5b2=_0x39162e['count'];var _0x2226f6=_0x30d065?0x0:_0xe2d585['offset'];var _0x341e02=_0x30d065?_0x39162e[_0x4270('0x22')]:_0xe2d585['offset']+_0xe2d585[_0x4270('0x21')];var _0x59b110;if(_0x341e02>=_0x4ba5b2){_0x341e02=_0x4ba5b2;_0x59b110=0xc8;}else{_0x59b110=0xce;}_0x11a868['status'](_0x59b110);return _0x11a868[_0x4270('0x23')](_0x4270('0x24'),_0x2226f6+'-'+_0x341e02+'/'+_0x4ba5b2)[_0x4270('0x1f')](_0x39162e);}return null;};}function patchUpdates(_0x45ffb8){return function(_0x3a1eec){try{jsonpatch[_0x4270('0x25')](_0x3a1eec,_0x45ffb8,!![]);}catch(_0x4ac6fe){return BPromise['reject'](_0x4ac6fe);}return _0x3a1eec['save']();};}function saveUpdates(_0x43cb22,_0x8382e9){return function(_0x27f60f){if(_0x27f60f){return _0x27f60f[_0x4270('0x26')](_0x43cb22)[_0x4270('0x27')](function(_0x438127){return _0x438127;});}return null;};}function removeEntity(_0x443ab8,_0x518575){return function(_0x327c00){if(_0x327c00){return _0x327c00['destroy']()[_0x4270('0x27')](function(){_0x443ab8[_0x4270('0x1d')](0xcc)[_0x4270('0x1e')]();});}};}function handleEntityNotFound(_0x372a6e,_0x3457cd){return function(_0x33f3a9){if(!_0x33f3a9){_0x372a6e[_0x4270('0x1c')](0x194);}return _0x33f3a9;};}function handleError(_0x487fdd,_0x232c56){_0x232c56=_0x232c56||0x1f4;return function(_0x425c7d){logger[_0x4270('0x28')](_0x425c7d[_0x4270('0x29')]);if(_0x425c7d[_0x4270('0x2a')]){delete _0x425c7d[_0x4270('0x2a')];}_0x487fdd[_0x4270('0x1d')](_0x232c56)['send'](_0x425c7d);};}exports[_0x4270('0x2b')]=function(_0x3cdb43,_0x52f458){var _0x2d463b={},_0x4a9a73={},_0x4168d1={'count':0x0,'rows':[]};var _0x4dcaed=_[_0x4270('0x2c')](db[_0x4270('0x2d')][_0x4270('0x2e')],function(_0x1f45ec){return{'name':_0x1f45ec['fieldName'],'type':_0x1f45ec[_0x4270('0x2f')][_0x4270('0x30')]};});_0x4a9a73[_0x4270('0x31')]=_[_0x4270('0x2c')](_0x4dcaed,_0x4270('0x2a'));_0x4a9a73[_0x4270('0x32')]=_[_0x4270('0x33')](_0x3cdb43[_0x4270('0x32')]);_0x4a9a73[_0x4270('0x34')]=_[_0x4270('0x35')](_0x4a9a73[_0x4270('0x31')],_0x4a9a73[_0x4270('0x32')]);_0x2d463b[_0x4270('0x36')]=_[_0x4270('0x35')](_0x4a9a73[_0x4270('0x31')],qs[_0x4270('0x37')](_0x3cdb43[_0x4270('0x32')][_0x4270('0x37')]));_0x2d463b[_0x4270('0x36')]=_0x2d463b['attributes'][_0x4270('0x38')]?_0x2d463b[_0x4270('0x36')]:_0x4a9a73['model'];if(!_0x3cdb43[_0x4270('0x32')]['hasOwnProperty']('nolimit')){_0x2d463b[_0x4270('0x21')]=qs[_0x4270('0x21')](_0x3cdb43[_0x4270('0x32')][_0x4270('0x21')]);_0x2d463b[_0x4270('0x20')]=qs[_0x4270('0x20')](_0x3cdb43[_0x4270('0x32')]['offset']);}_0x2d463b['order']=qs[_0x4270('0x39')](_0x3cdb43['query'][_0x4270('0x39')]);_0x2d463b[_0x4270('0x3a')]=qs[_0x4270('0x34')](_['pick'](_0x3cdb43[_0x4270('0x32')],_0x4a9a73[_0x4270('0x34')]),_0x4dcaed);if(_0x3cdb43[_0x4270('0x32')][_0x4270('0x3b')]){_0x2d463b['where']=_[_0x4270('0x3c')](_0x2d463b['where'],{'$or':_[_0x4270('0x2c')](_0x4dcaed,function(_0x3dd6ab){if(_0x3dd6ab[_0x4270('0x2f')]!==_0x4270('0x3d')){var _0x151f27={};_0x151f27[_0x3dd6ab[_0x4270('0x2a')]]={'$like':'%'+_0x3cdb43[_0x4270('0x32')][_0x4270('0x3b')]+'%'};return _0x151f27;}})});}_0x2d463b=_[_0x4270('0x3c')]({},_0x2d463b,_0x3cdb43[_0x4270('0x3e')]);var _0x3473cf={'where':_0x2d463b[_0x4270('0x3a')]};return db[_0x4270('0x2d')][_0x4270('0x22')](_0x3473cf)['then'](function(_0x584c30){_0x4168d1[_0x4270('0x22')]=_0x584c30;if(_0x3cdb43['query']['includeAll']){_0x2d463b[_0x4270('0x3f')]=[{'all':!![]}];}return db[_0x4270('0x2d')][_0x4270('0x40')](_0x2d463b);})[_0x4270('0x27')](function(_0x3d08ed){_0x4168d1[_0x4270('0x41')]=_0x3d08ed;return _0x4168d1;})[_0x4270('0x27')](respondWithFilteredResult(_0x52f458,_0x2d463b))[_0x4270('0x42')](handleError(_0x52f458,null));};exports[_0x4270('0x43')]=function(_0x1c2a80,_0x1521dd){var _0xc68315={'raw':![],'where':{'id':_0x1c2a80['params']['id']}},_0x3f3121={};_0x3f3121[_0x4270('0x31')]=_[_0x4270('0x33')](db[_0x4270('0x2d')][_0x4270('0x2e')]);_0x3f3121[_0x4270('0x32')]=_[_0x4270('0x33')](_0x1c2a80[_0x4270('0x32')]);_0x3f3121[_0x4270('0x34')]=_[_0x4270('0x35')](_0x3f3121[_0x4270('0x31')],_0x3f3121['query']);_0xc68315[_0x4270('0x36')]=_[_0x4270('0x35')](_0x3f3121[_0x4270('0x31')],qs[_0x4270('0x37')](_0x1c2a80[_0x4270('0x32')]['fields']));_0xc68315[_0x4270('0x36')]=_0xc68315[_0x4270('0x36')]['length']?_0xc68315[_0x4270('0x36')]:_0x3f3121['model'];if(_0x1c2a80['query'][_0x4270('0x44')]){_0xc68315[_0x4270('0x3f')]=[{'all':!![]}];}_0xc68315=_[_0x4270('0x3c')]({},_0xc68315,_0x1c2a80[_0x4270('0x3e')]);return db['VoiceQueueReport'][_0x4270('0x45')](_0xc68315)[_0x4270('0x27')](handleEntityNotFound(_0x1521dd,null))[_0x4270('0x27')](respondWithResult(_0x1521dd,null))['catch'](handleError(_0x1521dd,null));};exports[_0x4270('0x46')]=function(_0x5d1ed2,_0x550acf){return db[_0x4270('0x2d')][_0x4270('0x46')](_0x5d1ed2[_0x4270('0x47')],{})[_0x4270('0x27')](respondWithResult(_0x550acf,0xc9))[_0x4270('0x42')](handleError(_0x550acf,null));};exports[_0x4270('0x26')]=function(_0x10c762,_0x385800){if(_0x10c762['body']['id']){delete _0x10c762[_0x4270('0x47')]['id'];}return db[_0x4270('0x2d')][_0x4270('0x45')]({'where':{'id':_0x10c762[_0x4270('0x48')]['id']}})[_0x4270('0x27')](handleEntityNotFound(_0x385800,null))[_0x4270('0x27')](saveUpdates(_0x10c762[_0x4270('0x47')],null))['then'](respondWithResult(_0x385800,null))[_0x4270('0x42')](handleError(_0x385800,null));};exports['destroy']=function(_0x332de9,_0x45ffe2){return db[_0x4270('0x2d')][_0x4270('0x45')]({'where':{'id':_0x332de9['params']['id']}})[_0x4270('0x27')](handleEntityNotFound(_0x45ffe2,null))[_0x4270('0x27')](removeEntity(_0x45ffe2,null))['catch'](handleError(_0x45ffe2,null));};exports[_0x4270('0x49')]=function(_0x468894,_0x13a2e2){return db[_0x4270('0x2d')][_0x4270('0x49')]()['then'](respondWithResult(_0x13a2e2,null))[_0x4270('0x42')](handleError(_0x13a2e2,null));};exports[_0x4270('0x4a')]=function(_0x4a0e08,_0x17ef52){var _0x701c0a={},_0x2a800d={},_0x166c7d={'count':0x0,'rows':[]};_0x2a800d[_0x4270('0x31')]=_[_0x4270('0x33')](db[_0x4270('0x2d')][_0x4270('0x2e')]);_0x2a800d[_0x4270('0x32')]=_[_0x4270('0x33')](_0x4a0e08[_0x4270('0x32')]);_0x2a800d[_0x4270('0x34')]=_[_0x4270('0x35')](_0x2a800d[_0x4270('0x31')],_0x2a800d['query']);_0x701c0a[_0x4270('0x36')]=_[_0x4270('0x35')](_0x2a800d['model'],qs['fields'](_0x4a0e08[_0x4270('0x32')][_0x4270('0x37')]));_0x701c0a[_0x4270('0x36')]=_0x701c0a[_0x4270('0x36')][_0x4270('0x38')]?_0x701c0a[_0x4270('0x36')]:_0x2a800d[_0x4270('0x31')];if(!_0x4a0e08[_0x4270('0x32')][_0x4270('0x4b')](_0x4270('0x4c'))){_0x701c0a[_0x4270('0x21')]=qs['limit'](_0x4a0e08[_0x4270('0x32')][_0x4270('0x21')]);_0x701c0a[_0x4270('0x20')]=qs['offset'](_0x4a0e08[_0x4270('0x32')][_0x4270('0x20')]);}_0x701c0a[_0x4270('0x4d')]=qs['sort'](_0x4a0e08['query'][_0x4270('0x39')]);_0x701c0a[_0x4270('0x3a')]=qs['filters'](_['pick'](_0x4a0e08['query'],_0x2a800d['filters']));if(_0x4a0e08[_0x4270('0x32')]['filter']){_0x701c0a['where']=_[_0x4270('0x3c')](_0x701c0a['where'],{'$or':_[_0x4270('0x2c')](_0x701c0a['attributes'],function(_0x523432){var _0x4e9543={};_0x4e9543[_0x523432]={'$like':'%'+_0x4a0e08['query'][_0x4270('0x3b')]+'%'};return _0x4e9543;})});}_0x701c0a=_[_0x4270('0x3c')]({},_0x701c0a,_0x4a0e08[_0x4270('0x3e')]);var _0x42ab84={'where':_0x701c0a[_0x4270('0x3a')]};return db['VoiceQueueReport']['count'](_0x42ab84)[_0x4270('0x27')](function(_0x489db5){_0x166c7d['count']=_0x489db5;if(_0x4a0e08[_0x4270('0x32')][_0x4270('0x44')]){_0x701c0a[_0x4270('0x3f')]=[{'all':!![]}];}return db[_0x4270('0x2d')][_0x4270('0x40')](_0x701c0a);})[_0x4270('0x27')](function(_0x43b9c1){_0x166c7d['rows']=_0x43b9c1;return _0x166c7d;})['then'](respondWithFilteredResult(_0x17ef52,_0x701c0a,_0x4270('0x4a')))['catch'](handleError(_0x17ef52,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xd627=['VIRTUAL','filter','options','includeAll','include','catch','show','params','keys','intersection','create','body','find','describe','getVoiceQueuesReport','order','pick','findAll','rows','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','update','then','destroy','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge'];(function(_0x488882,_0x50c541){var _0x1b3b0c=function(_0x3c287c){while(--_0x3c287c){_0x488882['push'](_0x488882['shift']());}};_0x1b3b0c(++_0x50c541);}(_0xd627,0x106));var _0x7d62=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xd627[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d62('0x0'));var zipdir=require(_0x7d62('0x1'));var jsonpatch=require(_0x7d62('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d62('0x3'));var Mustache=require(_0x7d62('0x4'));var util=require(_0x7d62('0x5'));var path=require('path');var sox=require(_0x7d62('0x6'));var csv=require(_0x7d62('0x7'));var ejs=require(_0x7d62('0x8'));var fs=require('fs');var fs_extra=require(_0x7d62('0x9'));var _=require(_0x7d62('0xa'));var squel=require(_0x7d62('0xb'));var crypto=require(_0x7d62('0xc'));var jsforce=require(_0x7d62('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7d62('0x7'));var querystring=require(_0x7d62('0xe'));var Papa=require(_0x7d62('0xf'));var Redis=require('ioredis');var authService=require(_0x7d62('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d62('0x11'));var logger=require(_0x7d62('0x12'))(_0x7d62('0x13'));var utils=require('../../config/utils');var config=require(_0x7d62('0x14'));var licenseUtil=require(_0x7d62('0x15'));var db=require(_0x7d62('0x16'))['db'];config[_0x7d62('0x17')]=_[_0x7d62('0x18')](config[_0x7d62('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d62('0x19'))(new Redis(config[_0x7d62('0x17')]));require(_0x7d62('0x1a'))[_0x7d62('0x1b')](socket);function respondWithStatusCode(_0x4abeac,_0x21ea11){_0x21ea11=_0x21ea11||0xcc;return function(_0x3b263c){if(_0x3b263c){return _0x4abeac[_0x7d62('0x1c')](_0x21ea11);}return _0x4abeac[_0x7d62('0x1d')](_0x21ea11)[_0x7d62('0x1e')]();};}function respondWithResult(_0x591917,_0x583f25){_0x583f25=_0x583f25||0xc8;return function(_0x40f010){if(_0x40f010){return _0x591917[_0x7d62('0x1d')](_0x583f25)['json'](_0x40f010);}};}function respondWithFilteredResult(_0x8da045,_0x454648){return function(_0x282047){if(_0x282047){var _0xa38b0e=typeof _0x454648[_0x7d62('0x1f')]===_0x7d62('0x20')&&typeof _0x454648[_0x7d62('0x21')]==='undefined';var _0x5ec141=_0x282047[_0x7d62('0x22')];var _0x40b161=_0xa38b0e?0x0:_0x454648[_0x7d62('0x1f')];var _0x276852=_0xa38b0e?_0x282047[_0x7d62('0x22')]:_0x454648['offset']+_0x454648['limit'];var _0x308964;if(_0x276852>=_0x5ec141){_0x276852=_0x5ec141;_0x308964=0xc8;}else{_0x308964=0xce;}_0x8da045['status'](_0x308964);return _0x8da045['set'](_0x7d62('0x23'),_0x40b161+'-'+_0x276852+'/'+_0x5ec141)[_0x7d62('0x24')](_0x282047);}return null;};}function patchUpdates(_0x3df175){return function(_0x57c3a0){try{jsonpatch['apply'](_0x57c3a0,_0x3df175,!![]);}catch(_0x1d9468){return BPromise[_0x7d62('0x25')](_0x1d9468);}return _0x57c3a0['save']();};}function saveUpdates(_0x2242a6,_0x3147ef){return function(_0x56981f){if(_0x56981f){return _0x56981f[_0x7d62('0x26')](_0x2242a6)[_0x7d62('0x27')](function(_0x2760dd){return _0x2760dd;});}return null;};}function removeEntity(_0x597bec,_0x5e90a3){return function(_0x4129e2){if(_0x4129e2){return _0x4129e2[_0x7d62('0x28')]()['then'](function(){_0x597bec[_0x7d62('0x1d')](0xcc)[_0x7d62('0x1e')]();});}};}function handleEntityNotFound(_0x214b20,_0x5bf94b){return function(_0xee793a){if(!_0xee793a){_0x214b20['sendStatus'](0x194);}return _0xee793a;};}function handleError(_0x1f72a1,_0x45c934){_0x45c934=_0x45c934||0x1f4;return function(_0x5ca80c){logger['error'](_0x5ca80c[_0x7d62('0x29')]);if(_0x5ca80c['name']){delete _0x5ca80c[_0x7d62('0x2a')];}_0x1f72a1['status'](_0x45c934)[_0x7d62('0x2b')](_0x5ca80c);};}exports[_0x7d62('0x2c')]=function(_0x7b0f76,_0x1f478d){var _0x133e32={},_0x137f4b={},_0x2fc60a={'count':0x0,'rows':[]};var _0x41e5e0=_[_0x7d62('0x2d')](db[_0x7d62('0x2e')][_0x7d62('0x2f')],function(_0x4d25b7){return{'name':_0x4d25b7[_0x7d62('0x30')],'type':_0x4d25b7[_0x7d62('0x31')][_0x7d62('0x32')]};});_0x137f4b[_0x7d62('0x33')]=_[_0x7d62('0x2d')](_0x41e5e0,_0x7d62('0x2a'));_0x137f4b[_0x7d62('0x34')]=_['keys'](_0x7b0f76[_0x7d62('0x34')]);_0x137f4b[_0x7d62('0x35')]=_['intersection'](_0x137f4b[_0x7d62('0x33')],_0x137f4b[_0x7d62('0x34')]);_0x133e32[_0x7d62('0x36')]=_['intersection'](_0x137f4b['model'],qs['fields'](_0x7b0f76[_0x7d62('0x34')][_0x7d62('0x37')]));_0x133e32[_0x7d62('0x36')]=_0x133e32['attributes'][_0x7d62('0x38')]?_0x133e32['attributes']:_0x137f4b['model'];if(!_0x7b0f76[_0x7d62('0x34')][_0x7d62('0x39')](_0x7d62('0x3a'))){_0x133e32[_0x7d62('0x21')]=qs[_0x7d62('0x21')](_0x7b0f76['query'][_0x7d62('0x21')]);_0x133e32[_0x7d62('0x1f')]=qs[_0x7d62('0x1f')](_0x7b0f76['query']['offset']);}_0x133e32['order']=qs[_0x7d62('0x3b')](_0x7b0f76[_0x7d62('0x34')][_0x7d62('0x3b')]);_0x133e32['where']=qs[_0x7d62('0x35')](_['pick'](_0x7b0f76[_0x7d62('0x34')],_0x137f4b[_0x7d62('0x35')]),_0x41e5e0);if(_0x7b0f76[_0x7d62('0x34')]['filter']){_0x133e32[_0x7d62('0x3c')]=_[_0x7d62('0x3d')](_0x133e32[_0x7d62('0x3c')],{'$or':_[_0x7d62('0x2d')](_0x41e5e0,function(_0x424b04){if(_0x424b04['type']!==_0x7d62('0x3e')){var _0xa753b={};_0xa753b[_0x424b04['name']]={'$like':'%'+_0x7b0f76['query'][_0x7d62('0x3f')]+'%'};return _0xa753b;}})});}_0x133e32=_[_0x7d62('0x3d')]({},_0x133e32,_0x7b0f76[_0x7d62('0x40')]);var _0x513e4c={'where':_0x133e32[_0x7d62('0x3c')]};return db['VoiceQueueReport']['count'](_0x513e4c)[_0x7d62('0x27')](function(_0x355bb8){_0x2fc60a[_0x7d62('0x22')]=_0x355bb8;if(_0x7b0f76[_0x7d62('0x34')][_0x7d62('0x41')]){_0x133e32[_0x7d62('0x42')]=[{'all':!![]}];}return db[_0x7d62('0x2e')]['findAll'](_0x133e32);})[_0x7d62('0x27')](function(_0x58aa0c){_0x2fc60a['rows']=_0x58aa0c;return _0x2fc60a;})['then'](respondWithFilteredResult(_0x1f478d,_0x133e32))[_0x7d62('0x43')](handleError(_0x1f478d,null));};exports[_0x7d62('0x44')]=function(_0x9a50dc,_0x4dd062){var _0xc6b2a7={'raw':![],'where':{'id':_0x9a50dc[_0x7d62('0x45')]['id']}},_0x211fe6={};_0x211fe6[_0x7d62('0x33')]=_[_0x7d62('0x46')](db['VoiceQueueReport']['rawAttributes']);_0x211fe6[_0x7d62('0x34')]=_[_0x7d62('0x46')](_0x9a50dc['query']);_0x211fe6[_0x7d62('0x35')]=_[_0x7d62('0x47')](_0x211fe6[_0x7d62('0x33')],_0x211fe6[_0x7d62('0x34')]);_0xc6b2a7[_0x7d62('0x36')]=_[_0x7d62('0x47')](_0x211fe6[_0x7d62('0x33')],qs[_0x7d62('0x37')](_0x9a50dc[_0x7d62('0x34')]['fields']));_0xc6b2a7[_0x7d62('0x36')]=_0xc6b2a7[_0x7d62('0x36')][_0x7d62('0x38')]?_0xc6b2a7['attributes']:_0x211fe6[_0x7d62('0x33')];if(_0x9a50dc[_0x7d62('0x34')][_0x7d62('0x41')]){_0xc6b2a7[_0x7d62('0x42')]=[{'all':!![]}];}_0xc6b2a7=_[_0x7d62('0x3d')]({},_0xc6b2a7,_0x9a50dc['options']);return db[_0x7d62('0x2e')]['find'](_0xc6b2a7)['then'](handleEntityNotFound(_0x4dd062,null))[_0x7d62('0x27')](respondWithResult(_0x4dd062,null))['catch'](handleError(_0x4dd062,null));};exports[_0x7d62('0x48')]=function(_0x25ebcd,_0xa28e5a){return db[_0x7d62('0x2e')]['create'](_0x25ebcd[_0x7d62('0x49')],{})[_0x7d62('0x27')](respondWithResult(_0xa28e5a,0xc9))[_0x7d62('0x43')](handleError(_0xa28e5a,null));};exports[_0x7d62('0x26')]=function(_0x57987e,_0x387c52){if(_0x57987e[_0x7d62('0x49')]['id']){delete _0x57987e['body']['id'];}return db[_0x7d62('0x2e')]['find']({'where':{'id':_0x57987e[_0x7d62('0x45')]['id']}})[_0x7d62('0x27')](handleEntityNotFound(_0x387c52,null))[_0x7d62('0x27')](saveUpdates(_0x57987e[_0x7d62('0x49')],null))[_0x7d62('0x27')](respondWithResult(_0x387c52,null))['catch'](handleError(_0x387c52,null));};exports['destroy']=function(_0x16219f,_0x76700e){return db[_0x7d62('0x2e')][_0x7d62('0x4a')]({'where':{'id':_0x16219f[_0x7d62('0x45')]['id']}})[_0x7d62('0x27')](handleEntityNotFound(_0x76700e,null))[_0x7d62('0x27')](removeEntity(_0x76700e,null))['catch'](handleError(_0x76700e,null));};exports['describe']=function(_0x55e9d7,_0x48fbd3){return db['VoiceQueueReport'][_0x7d62('0x4b')]()[_0x7d62('0x27')](respondWithResult(_0x48fbd3,null))[_0x7d62('0x43')](handleError(_0x48fbd3,null));};exports[_0x7d62('0x4c')]=function(_0xf3f987,_0x5f9cec){var _0x45cb3e={},_0x699b07={},_0xdfa2ff={'count':0x0,'rows':[]};_0x699b07[_0x7d62('0x33')]=_[_0x7d62('0x46')](db['VoiceQueueReport'][_0x7d62('0x2f')]);_0x699b07[_0x7d62('0x34')]=_[_0x7d62('0x46')](_0xf3f987[_0x7d62('0x34')]);_0x699b07[_0x7d62('0x35')]=_['intersection'](_0x699b07[_0x7d62('0x33')],_0x699b07[_0x7d62('0x34')]);_0x45cb3e[_0x7d62('0x36')]=_[_0x7d62('0x47')](_0x699b07[_0x7d62('0x33')],qs[_0x7d62('0x37')](_0xf3f987['query'][_0x7d62('0x37')]));_0x45cb3e[_0x7d62('0x36')]=_0x45cb3e[_0x7d62('0x36')]['length']?_0x45cb3e[_0x7d62('0x36')]:_0x699b07['model'];if(!_0xf3f987[_0x7d62('0x34')]['hasOwnProperty'](_0x7d62('0x3a'))){_0x45cb3e[_0x7d62('0x21')]=qs[_0x7d62('0x21')](_0xf3f987[_0x7d62('0x34')][_0x7d62('0x21')]);_0x45cb3e[_0x7d62('0x1f')]=qs[_0x7d62('0x1f')](_0xf3f987[_0x7d62('0x34')][_0x7d62('0x1f')]);}_0x45cb3e[_0x7d62('0x4d')]=qs[_0x7d62('0x3b')](_0xf3f987[_0x7d62('0x34')][_0x7d62('0x3b')]);_0x45cb3e[_0x7d62('0x3c')]=qs['filters'](_[_0x7d62('0x4e')](_0xf3f987['query'],_0x699b07[_0x7d62('0x35')]));if(_0xf3f987[_0x7d62('0x34')]['filter']){_0x45cb3e[_0x7d62('0x3c')]=_[_0x7d62('0x3d')](_0x45cb3e[_0x7d62('0x3c')],{'$or':_[_0x7d62('0x2d')](_0x45cb3e[_0x7d62('0x36')],function(_0x49607e){var _0x19a18a={};_0x19a18a[_0x49607e]={'$like':'%'+_0xf3f987[_0x7d62('0x34')]['filter']+'%'};return _0x19a18a;})});}_0x45cb3e=_[_0x7d62('0x3d')]({},_0x45cb3e,_0xf3f987[_0x7d62('0x40')]);var _0x500f8e={'where':_0x45cb3e['where']};return db['VoiceQueueReport'][_0x7d62('0x22')](_0x500f8e)[_0x7d62('0x27')](function(_0x41fb3e){_0xdfa2ff[_0x7d62('0x22')]=_0x41fb3e;if(_0xf3f987[_0x7d62('0x34')][_0x7d62('0x41')]){_0x45cb3e[_0x7d62('0x42')]=[{'all':!![]}];}return db[_0x7d62('0x2e')][_0x7d62('0x4f')](_0x45cb3e);})[_0x7d62('0x27')](function(_0xd10d67){_0xdfa2ff[_0x7d62('0x50')]=_0xd10d67;return _0xdfa2ff;})['then'](respondWithFilteredResult(_0x5f9cec,_0x45cb3e,_0x7d62('0x4c')))[_0x7d62('0x43')](handleError(_0x5f9cec,null,_0x7d62('0x4c')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 758cebd..96b4535 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.events.js +++ b/server/api/voiceQueueReport/voiceQueueReport.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb471=['update','remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','save'];(function(_0x3784ac,_0x506ec6){var _0x331a51=function(_0x3c6d7a){while(--_0x3c6d7a){_0x3784ac['push'](_0x3784ac['shift']());}};_0x331a51(++_0x506ec6);}(_0xb471,0x191));var _0x1b47=function(_0x497fe1,_0x2d264){_0x497fe1=_0x497fe1-0x0;var _0x34b084=_0xb471[_0x497fe1];return _0x34b084;};'use strict';var EventEmitter=require(_0x1b47('0x0'));var VoiceQueueReport=require(_0x1b47('0x1'))['db'][_0x1b47('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1b47('0x3'),'afterUpdate':_0x1b47('0x4'),'afterDestroy':_0x1b47('0x5')};function emitEvent(_0x18e9fd){return function(_0x46d6d6,_0x2bf5a2,_0x54a013){VoiceQueueReportEvents['emit'](_0x18e9fd+':'+_0x46d6d6['id'],_0x46d6d6);VoiceQueueReportEvents[_0x1b47('0x6')](_0x18e9fd,_0x46d6d6);_0x54a013(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x1b47('0x7')](e,emitEvent(event));}}module[_0x1b47('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x6c12=['hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x110e45,_0x33b34f){var _0x2f2dc7=function(_0x16dae0){while(--_0x16dae0){_0x110e45['push'](_0x110e45['shift']());}};_0x2f2dc7(++_0x33b34f);}(_0x6c12,0x17c));var _0x26c1=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0x6c12[_0x11deef];return _0xe9ba85;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x26c1('0x0'))['db'][_0x26c1('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x26c1('0x2')](0x0);var events={'afterCreate':_0x26c1('0x3'),'afterUpdate':_0x26c1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x61dc0d){return function(_0x567355,_0x998033,_0x2472ce){VoiceQueueReportEvents['emit'](_0x61dc0d+':'+_0x567355['id'],_0x567355);VoiceQueueReportEvents[_0x26c1('0x5')](_0x61dc0d,_0x567355);_0x2472ce(null);};}for(var e in events){if(events[_0x26c1('0x6')](e)){var event=events[e];VoiceQueueReport[_0x26c1('0x7')](e,emitEvent(event));}}module[_0x26c1('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 5095b4d..2107abf 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce07=['path','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','request-promise'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0xce07,0x11c));var _0x7ce0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xce07[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x7ce0('0x0'));var logger=require('../../config/logger')(_0x7ce0('0x1'));var moment=require(_0x7ce0('0x2'));var BPromise=require('bluebird');var rp=require(_0x7ce0('0x3'));var fs=require('fs');var path=require(_0x7ce0('0x4'));var rimraf=require('rimraf');var config=require(_0x7ce0('0x5'));var attributes=require(_0x7ce0('0x6'));module[_0x7ce0('0x7')]=function(_0x344c54,_0x336465){return _0x344c54['define'](_0x7ce0('0x8'),attributes,{'tableName':_0x7ce0('0x9'),'paranoid':![],'indexes':[{'fields':[_0x7ce0('0xa')]},{'fields':[_0x7ce0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ab2=['./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','../../config/logger','moment','bluebird','rimraf'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0ab2,0x92));var _0x20ab=function(_0x246e50,_0x33c7c4){_0x246e50=_0x246e50-0x0;var _0x915b44=_0x0ab2[_0x246e50];return _0x915b44;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x20ab('0x0'))('api');var moment=require(_0x20ab('0x1'));var BPromise=require(_0x20ab('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x20ab('0x3'));var config=require('../../config/environment');var attributes=require(_0x20ab('0x4'));module['exports']=function(_0x44fdb2,_0x259548){return _0x44fdb2[_0x20ab('0x5')](_0x20ab('0x6'),attributes,{'tableName':_0x20ab('0x7'),'paranoid':![],'indexes':[{'fields':[_0x20ab('0x8')]},{'fields':[_0x20ab('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index bb3f97b..bc957c5 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.rpc.js +++ b/server/api/voiceQueueReport/voiceQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e17=['GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','include','map','attributes','model','catch','CreateVoiceQueueReport','body','update','UpdateVoiceQueueReport','stringify','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','result'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x1e17,0x122));var _0x71e1=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x1e17[_0x12f688];return _0x59c3de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x71e1('0x0'));var BPromise=require(_0x71e1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71e1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x71e1('0x3'));var logger=require(_0x71e1('0x4'))('rpc');var config=require(_0x71e1('0x5'));var jayson=require(_0x71e1('0x6'));var client=jayson[_0x71e1('0x7')][_0x71e1('0x8')]({'port':0x232a});config[_0x71e1('0x9')]=_[_0x71e1('0xa')](config[_0x71e1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x71e1('0xb'))(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x2e7411,_0x6f8558,_0x3980a3){return new BPromise(function(_0x17f2a3,_0x6392c6){return client[_0x71e1('0xc')](_0x2e7411,_0x3980a3)[_0x71e1('0xd')](function(_0x4627d5){logger['info'](_0x71e1('0xe'),_0x6f8558,_0x71e1('0xf'));logger[_0x71e1('0x10')](_0x71e1('0x11'),_0x6f8558,_0x71e1('0xf'),JSON['stringify'](_0x4627d5));if(_0x4627d5[_0x71e1('0x12')]){if(_0x4627d5[_0x71e1('0x12')]['code']===0x1f4){logger[_0x71e1('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x6f8558,_0x4627d5[_0x71e1('0x12')][_0x71e1('0x13')]);return _0x6392c6(_0x4627d5[_0x71e1('0x12')][_0x71e1('0x13')]);}logger[_0x71e1('0x12')](_0x71e1('0xe'),_0x6f8558,_0x4627d5[_0x71e1('0x12')][_0x71e1('0x13')]);return _0x17f2a3(_0x4627d5[_0x71e1('0x12')]['message']);}else{logger[_0x71e1('0x14')](_0x71e1('0xe'),_0x6f8558,'request\x20sent');_0x17f2a3(_0x4627d5[_0x71e1('0x15')][_0x71e1('0x13')]);}})['catch'](function(_0x491b01){logger[_0x71e1('0x12')](_0x71e1('0xe'),_0x6f8558,_0x491b01);_0x6392c6(_0x491b01);});});}exports[_0x71e1('0x16')]=function(_0x5cedf8){var _0x5c43d6=this;return new Promise(function(_0x14740d,_0x1e564e){return db[_0x71e1('0x17')][_0x71e1('0x18')]({'raw':_0x5cedf8['options']?_0x5cedf8[_0x71e1('0x19')][_0x71e1('0x1a')]===undefined?!![]:![]:!![],'where':_0x5cedf8['options']?_0x5cedf8[_0x71e1('0x19')][_0x71e1('0x1b')]||null:null,'attributes':_0x5cedf8[_0x71e1('0x19')]?_0x5cedf8[_0x71e1('0x19')]['attributes']||null:null,'limit':_0x5cedf8[_0x71e1('0x19')]?_0x5cedf8[_0x71e1('0x19')][_0x71e1('0x1c')]||null:null,'include':_0x5cedf8[_0x71e1('0x19')]?_0x5cedf8[_0x71e1('0x19')][_0x71e1('0x1d')]?_[_0x71e1('0x1e')](_0x5cedf8['options'][_0x71e1('0x1d')],function(_0xcea34a){return{'model':db[_0xcea34a['model']],'as':_0xcea34a['as'],'attributes':_0xcea34a[_0x71e1('0x1f')],'include':_0xcea34a[_0x71e1('0x1d')]?_[_0x71e1('0x1e')](_0xcea34a[_0x71e1('0x1d')],function(_0x330232){return{'model':db[_0x330232['model']],'as':_0x330232['as'],'attributes':_0x330232[_0x71e1('0x1f')],'include':_0x330232[_0x71e1('0x1d')]?_[_0x71e1('0x1e')](_0x330232['include'],function(_0x15ab86){return{'model':db[_0x15ab86[_0x71e1('0x20')]],'as':_0x15ab86['as'],'attributes':_0x15ab86[_0x71e1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x71e1('0xd')](function(_0x229f36){logger[_0x71e1('0x14')](_0x71e1('0x16'),_0x5cedf8);logger[_0x71e1('0x10')](_0x71e1('0x16'),_0x5cedf8,JSON['stringify'](_0x229f36));_0x14740d(_0x229f36);})[_0x71e1('0x21')](function(_0x3bec93){logger[_0x71e1('0x12')](_0x71e1('0x16'),_0x3bec93[_0x71e1('0x13')],_0x5cedf8);_0x1e564e(_0x5c43d6[_0x71e1('0x12')](0x1f4,_0x3bec93[_0x71e1('0x13')]));});});};exports[_0x71e1('0x22')]=function(_0x122e63){var _0x4b8935=this;return new Promise(function(_0x59d8a0,_0x74d6e1){return db[_0x71e1('0x17')]['create'](_0x122e63[_0x71e1('0x23')],{'raw':_0x122e63[_0x71e1('0x19')]?_0x122e63['options'][_0x71e1('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a0e39){logger[_0x71e1('0x14')](_0x71e1('0x22'),_0x122e63);logger[_0x71e1('0x10')](_0x71e1('0x22'),_0x122e63,JSON['stringify'](_0x4a0e39));_0x59d8a0(_0x4a0e39);})[_0x71e1('0x21')](function(_0x3b4fde){logger['error'](_0x71e1('0x22'),_0x3b4fde[_0x71e1('0x13')],_0x122e63);_0x74d6e1(_0x4b8935[_0x71e1('0x12')](0x1f4,_0x3b4fde[_0x71e1('0x13')]));});});};exports['UpdateVoiceQueueReport']=function(_0x584a17){var _0x285c6e=this;return new Promise(function(_0x4f9d6f,_0x49330e){return db['VoiceQueueReport'][_0x71e1('0x24')](_0x584a17[_0x71e1('0x23')],{'raw':_0x584a17['options']?_0x584a17[_0x71e1('0x19')][_0x71e1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x584a17['options']?_0x584a17[_0x71e1('0x19')][_0x71e1('0x1b')]||null:null,'attributes':_0x584a17[_0x71e1('0x19')]?_0x584a17[_0x71e1('0x19')][_0x71e1('0x1f')]||null:null,'limit':_0x584a17[_0x71e1('0x19')]?_0x584a17[_0x71e1('0x19')][_0x71e1('0x1c')]||null:null})['then'](function(_0x3a2a8d){logger[_0x71e1('0x14')](_0x71e1('0x25'),_0x584a17);logger[_0x71e1('0x10')]('UpdateVoiceQueueReport',_0x584a17,JSON[_0x71e1('0x26')](_0x3a2a8d));_0x4f9d6f(_0x3a2a8d);})[_0x71e1('0x21')](function(_0x228244){logger[_0x71e1('0x12')]('UpdateVoiceQueueReport',_0x228244['message'],_0x584a17);_0x49330e(_0x285c6e['error'](0x1f4,_0x228244[_0x71e1('0x13')]));});});}; \ No newline at end of file +var _0xcee5=['body','catch','update','UpdateVoiceQueueReport','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create'];(function(_0x1973a3,_0x53bee8){var _0x229ecf=function(_0x4aa302){while(--_0x4aa302){_0x1973a3['push'](_0x1973a3['shift']());}};_0x229ecf(++_0x53bee8);}(_0xcee5,0x199));var _0x5cee=function(_0x402b61,_0x358e7d){_0x402b61=_0x402b61-0x0;var _0x3c91c9=_0xcee5[_0x402b61];return _0x3c91c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5cee('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5cee('0x1'));var db=require(_0x5cee('0x2'))['db'];var utils=require(_0x5cee('0x3'));var logger=require(_0x5cee('0x4'))(_0x5cee('0x5'));var config=require(_0x5cee('0x6'));var jayson=require(_0x5cee('0x7'));var client=jayson[_0x5cee('0x8')][_0x5cee('0x9')]({'port':0x232a});config[_0x5cee('0xa')]=_[_0x5cee('0xb')](config[_0x5cee('0xa')],{'host':_0x5cee('0xc'),'port':0x18eb});var socket=require(_0x5cee('0xd'))(new Redis(config[_0x5cee('0xa')]));require(_0x5cee('0xe'))[_0x5cee('0xf')](socket);function respondWithRpcPromise(_0x2da805,_0x498d08,_0x2c7892){return new BPromise(function(_0x3faf1d,_0xe672fc){return client[_0x5cee('0x10')](_0x2da805,_0x2c7892)[_0x5cee('0x11')](function(_0x1c3654){logger[_0x5cee('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x498d08,_0x5cee('0x13'));logger[_0x5cee('0x14')](_0x5cee('0x15'),_0x498d08,_0x5cee('0x13'),JSON[_0x5cee('0x16')](_0x1c3654));if(_0x1c3654[_0x5cee('0x17')]){if(_0x1c3654[_0x5cee('0x17')][_0x5cee('0x18')]===0x1f4){logger[_0x5cee('0x17')](_0x5cee('0x19'),_0x498d08,_0x1c3654[_0x5cee('0x17')][_0x5cee('0x1a')]);return _0xe672fc(_0x1c3654[_0x5cee('0x17')][_0x5cee('0x1a')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x498d08,_0x1c3654[_0x5cee('0x17')]['message']);return _0x3faf1d(_0x1c3654[_0x5cee('0x17')][_0x5cee('0x1a')]);}else{logger['info'](_0x5cee('0x19'),_0x498d08,'request\x20sent');_0x3faf1d(_0x1c3654[_0x5cee('0x1b')][_0x5cee('0x1a')]);}})['catch'](function(_0x232f19){logger['error'](_0x5cee('0x19'),_0x498d08,_0x232f19);_0xe672fc(_0x232f19);});});}exports['GetVoiceQueueReport']=function(_0x389c68){var _0xbfc5cb=this;return new Promise(function(_0x201c41,_0x2245d0){return db[_0x5cee('0x1c')][_0x5cee('0x1d')]({'raw':_0x389c68[_0x5cee('0x1e')]?_0x389c68['options'][_0x5cee('0x1f')]===undefined?!![]:![]:!![],'where':_0x389c68[_0x5cee('0x1e')]?_0x389c68[_0x5cee('0x1e')][_0x5cee('0x20')]||null:null,'attributes':_0x389c68[_0x5cee('0x1e')]?_0x389c68[_0x5cee('0x1e')][_0x5cee('0x21')]||null:null,'limit':_0x389c68['options']?_0x389c68[_0x5cee('0x1e')][_0x5cee('0x22')]||null:null,'include':_0x389c68[_0x5cee('0x1e')]?_0x389c68[_0x5cee('0x1e')][_0x5cee('0x23')]?_[_0x5cee('0x24')](_0x389c68['options'][_0x5cee('0x23')],function(_0x36ec6a){return{'model':db[_0x36ec6a['model']],'as':_0x36ec6a['as'],'attributes':_0x36ec6a['attributes'],'include':_0x36ec6a[_0x5cee('0x23')]?_[_0x5cee('0x24')](_0x36ec6a[_0x5cee('0x23')],function(_0x302a04){return{'model':db[_0x302a04[_0x5cee('0x25')]],'as':_0x302a04['as'],'attributes':_0x302a04['attributes'],'include':_0x302a04['include']?_[_0x5cee('0x24')](_0x302a04[_0x5cee('0x23')],function(_0x2b5b74){return{'model':db[_0x2b5b74[_0x5cee('0x25')]],'as':_0x2b5b74['as'],'attributes':_0x2b5b74[_0x5cee('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5cee('0x11')](function(_0x513a9b){logger[_0x5cee('0x12')](_0x5cee('0x26'),_0x389c68);logger[_0x5cee('0x14')]('GetVoiceQueueReport',_0x389c68,JSON['stringify'](_0x513a9b));_0x201c41(_0x513a9b);})['catch'](function(_0x37de79){logger['error'](_0x5cee('0x26'),_0x37de79[_0x5cee('0x1a')],_0x389c68);_0x2245d0(_0xbfc5cb[_0x5cee('0x17')](0x1f4,_0x37de79[_0x5cee('0x1a')]));});});};exports[_0x5cee('0x27')]=function(_0x4253aa){var _0x14c8a6=this;return new Promise(function(_0x94e20f,_0x19ea7c){return db[_0x5cee('0x1c')][_0x5cee('0x28')](_0x4253aa[_0x5cee('0x29')],{'raw':_0x4253aa[_0x5cee('0x1e')]?_0x4253aa['options'][_0x5cee('0x1f')]===undefined?!![]:![]:!![]})[_0x5cee('0x11')](function(_0x1015fb){logger[_0x5cee('0x12')](_0x5cee('0x27'),_0x4253aa);logger['debug'](_0x5cee('0x27'),_0x4253aa,JSON[_0x5cee('0x16')](_0x1015fb));_0x94e20f(_0x1015fb);})[_0x5cee('0x2a')](function(_0x3a3c19){logger[_0x5cee('0x17')](_0x5cee('0x27'),_0x3a3c19[_0x5cee('0x1a')],_0x4253aa);_0x19ea7c(_0x14c8a6['error'](0x1f4,_0x3a3c19[_0x5cee('0x1a')]));});});};exports['UpdateVoiceQueueReport']=function(_0x13935a){var _0xf0605d=this;return new Promise(function(_0xfeae8e,_0x40a64f){return db[_0x5cee('0x1c')][_0x5cee('0x2b')](_0x13935a[_0x5cee('0x29')],{'raw':_0x13935a['options']?_0x13935a[_0x5cee('0x1e')][_0x5cee('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13935a[_0x5cee('0x1e')]?_0x13935a[_0x5cee('0x1e')]['where']||null:null,'attributes':_0x13935a[_0x5cee('0x1e')]?_0x13935a[_0x5cee('0x1e')][_0x5cee('0x21')]||null:null,'limit':_0x13935a[_0x5cee('0x1e')]?_0x13935a[_0x5cee('0x1e')][_0x5cee('0x22')]||null:null})['then'](function(_0x2c7e62){logger[_0x5cee('0x12')](_0x5cee('0x2c'),_0x13935a);logger[_0x5cee('0x14')](_0x5cee('0x2c'),_0x13935a,JSON[_0x5cee('0x16')](_0x2c7e62));_0xfeae8e(_0x2c7e62);})['catch'](function(_0x59ae8f){logger[_0x5cee('0x17')](_0x5cee('0x2c'),_0x59ae8f[_0x5cee('0x1a')],_0x13935a);_0x40a64f(_0xf0605d[_0x5cee('0x17')](0x1f4,_0x59ae8f[_0x5cee('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 0a87ced..b95bda1 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.socket.js +++ b/server/api/voiceQueueReport/voiceQueueReport.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbeff=['removeListener','register','save','remove','update'];(function(_0x53229b,_0x556e37){var _0x224943=function(_0x2a7951){while(--_0x2a7951){_0x53229b['push'](_0x53229b['shift']());}};_0x224943(++_0x556e37);}(_0xbeff,0x8e));var _0xfbef=function(_0x320eda,_0x152bfe){_0x320eda=_0x320eda-0x0;var _0x79d96e=_0xbeff[_0x320eda];return _0x79d96e;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xfbef('0x0'),_0xfbef('0x1'),_0xfbef('0x2')];function createListener(_0x304d07,_0x114ed7){return function(_0x4fb975){_0x114ed7['emit'](_0x304d07,_0x4fb975);};}function removeListener(_0x474798,_0x387be8){return function(){VoiceQueueReportEvents[_0xfbef('0x3')](_0x474798,_0x387be8);};}exports[_0xfbef('0x4')]=function(_0x5496a6){for(var _0x295f40=0x0,_0x2ed5bc=events['length'];_0x295f40<_0x2ed5bc;_0x295f40++){var _0x257f3a=events[_0x295f40];var _0x43e95e=createListener('voiceQueueReport:'+_0x257f3a,_0x5496a6);VoiceQueueReportEvents['on'](_0x257f3a,_0x43e95e);}}; \ No newline at end of file +var _0xfef2=['emit','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x42df51,_0x115daf){var _0x3fe434=function(_0x41dc0d){while(--_0x41dc0d){_0x42df51['push'](_0x42df51['shift']());}};_0x3fe434(++_0x115daf);}(_0xfef2,0x1e0));var _0x2fef=function(_0xc1a4cf,_0x17141b){_0xc1a4cf=_0xc1a4cf-0x0;var _0x2930d1=_0xfef2[_0xc1a4cf];return _0x2930d1;};'use strict';var VoiceQueueReportEvents=require(_0x2fef('0x0'));var events=[_0x2fef('0x1'),_0x2fef('0x2'),'update'];function createListener(_0x16c6fc,_0x30ff3d){return function(_0x36264c){_0x30ff3d[_0x2fef('0x3')](_0x16c6fc,_0x36264c);};}function removeListener(_0x5ac51f,_0x2fb0c2){return function(){VoiceQueueReportEvents['removeListener'](_0x5ac51f,_0x2fb0c2);};}exports[_0x2fef('0x4')]=function(_0x35c574){for(var _0x152f6d=0x0,_0x1b7c88=events[_0x2fef('0x5')];_0x152f6d<_0x1b7c88;_0x152f6d++){var _0x1e80f8=events[_0x152f6d];var _0x1b2d7e=createListener(_0x2fef('0x6')+_0x1e80f8,_0x35c574);VoiceQueueReportEvents['on'](_0x1e80f8,_0x1b2d7e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index cbbf5f3..7c6b61d 100644 --- a/server/api/voiceQueuesLog/index.js +++ b/server/api/voiceQueuesLog/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['../../components/interaction/service','../../config/environment','index','/:id','show','create','put','update','delete','isAuthenticated','destroy','exports','multer','util','express','../../components/auth/service'];(function(_0x3cc90b,_0x1b69d9){var _0x34051b=function(_0x1f01f7){while(--_0x1f01f7){_0x3cc90b['push'](_0x3cc90b['shift']());}};_0x34051b(++_0x1b69d9);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0x4b84[_0x4f0c2b];return _0x526436;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x44b8('0x9')]);router[_0x44b8('0xa')](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0xb')]);router[_0x44b8('0xc')](_0x44b8('0x7'),auth[_0x44b8('0xd')](),controller[_0x44b8('0xe')]);module[_0x44b8('0xf')]=router; \ No newline at end of file +var _0x6e8b=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2b34ab,_0x4b2a3c){var _0x57adc9=function(_0x2b4f9d){while(--_0x2b4f9d){_0x2b34ab['push'](_0x2b34ab['shift']());}};_0x57adc9(++_0x4b2a3c);}(_0x6e8b,0x6a));var _0xb6e8=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x6e8b[_0x4c73ac];return _0x9839ee;};'use strict';var multer=require(_0xb6e8('0x0'));var util=require(_0xb6e8('0x1'));var path=require(_0xb6e8('0x2'));var timeout=require(_0xb6e8('0x3'));var express=require(_0xb6e8('0x4'));var router=express[_0xb6e8('0x5')]();var fs_extra=require(_0xb6e8('0x6'));var auth=require(_0xb6e8('0x7'));var interaction=require(_0xb6e8('0x8'));var config=require(_0xb6e8('0x9'));var controller=require(_0xb6e8('0xa'));router[_0xb6e8('0xb')]('/',auth[_0xb6e8('0xc')](),controller[_0xb6e8('0xd')]);router['get'](_0xb6e8('0xe'),auth[_0xb6e8('0xc')](),controller[_0xb6e8('0xf')]);router[_0xb6e8('0x10')]('/',auth[_0xb6e8('0xc')](),controller[_0xb6e8('0x11')]);router[_0xb6e8('0x12')](_0xb6e8('0xe'),auth['isAuthenticated'](),controller[_0xb6e8('0x13')]);router[_0xb6e8('0x14')]('/:id',auth[_0xb6e8('0xc')](),controller[_0xb6e8('0x15')]);module[_0xb6e8('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index c5e77f2..b10f7d6 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07e5=['format','sequelize','moment','exports','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x07e5,0x133));var _0x507e=function(_0x54f0f4,_0x10886a){_0x54f0f4=_0x54f0f4-0x0;var _0x325061=_0x07e5[_0x54f0f4];return _0x325061;};'use strict';var Sequelize=require(_0x507e('0x0'));var moment=require(_0x507e('0x1'));module[_0x507e('0x2')]={'time':{'type':Sequelize[_0x507e('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x507e('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x507e('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x507e('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x507e('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x507e('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x507e('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x507e('0x4')],'allowNull':![],'defaultValue':moment()[_0x507e('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x3d74=['sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5a2803,_0x450308){var _0x14a7f5=function(_0x4bbc06){while(--_0x4bbc06){_0x5a2803['push'](_0x5a2803['shift']());}};_0x14a7f5(++_0x450308);}(_0x3d74,0x6c));var _0x43d7=function(_0x27ea86,_0x5a17b3){_0x27ea86=_0x27ea86-0x0;var _0x4a12fb=_0x3d74[_0x27ea86];return _0x4a12fb;};'use strict';var Sequelize=require(_0x43d7('0x0'));var moment=require(_0x43d7('0x1'));module[_0x43d7('0x2')]={'time':{'type':Sequelize[_0x43d7('0x3')]},'callid':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x43d7('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0x43d7('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 5831322..c905c61 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3582=['../../mysqldb','status','end','json','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','include','findAll','rows','show','keys','includeAll','options','catch','body','find','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x3a0ccb,_0x4904ef){var _0x34bd52=function(_0x542af6){while(--_0x542af6){_0x3a0ccb['push'](_0x3a0ccb['shift']());}};_0x34bd52(++_0x4904ef);}(_0x3582,0x7e));var _0x2358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3582[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2358('0x0'));var rimraf=require(_0x2358('0x1'));var zipdir=require(_0x2358('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2358('0x3'));var moment=require('moment');var BPromise=require(_0x2358('0x4'));var Mustache=require(_0x2358('0x5'));var util=require(_0x2358('0x6'));var path=require(_0x2358('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2358('0x8'));var fs=require('fs');var fs_extra=require(_0x2358('0x9'));var _=require(_0x2358('0xa'));var squel=require(_0x2358('0xb'));var crypto=require('crypto');var jsforce=require(_0x2358('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2358('0xd'));var querystring=require(_0x2358('0xe'));var Papa=require(_0x2358('0xf'));var Redis=require(_0x2358('0x10'));var authService=require(_0x2358('0x11'));var qs=require(_0x2358('0x12'));var as=require(_0x2358('0x13'));var hardwareService=require(_0x2358('0x14'));var logger=require(_0x2358('0x15'))(_0x2358('0x16'));var utils=require('../../config/utils');var config=require(_0x2358('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2358('0x18'))['db'];function respondWithStatusCode(_0x39358c,_0x2b0612){_0x2b0612=_0x2b0612||0xcc;return function(_0x8a4a21){if(_0x8a4a21){return _0x39358c['sendStatus'](_0x2b0612);}return _0x39358c[_0x2358('0x19')](_0x2b0612)[_0x2358('0x1a')]();};}function respondWithResult(_0x5c95f6,_0x406342){_0x406342=_0x406342||0xc8;return function(_0x3d3461){if(_0x3d3461){return _0x5c95f6[_0x2358('0x19')](_0x406342)[_0x2358('0x1b')](_0x3d3461);}};}function respondWithFilteredResult(_0x46b09a,_0x64ea73){return function(_0x41ea8d){if(_0x41ea8d){var _0x1ba707=typeof _0x64ea73[_0x2358('0x1c')]==='undefined'&&typeof _0x64ea73['limit']==='undefined';var _0x2cb2ed=_0x41ea8d['count'];var _0x9074f4=_0x1ba707?0x0:_0x64ea73[_0x2358('0x1c')];var _0x42f922=_0x1ba707?_0x41ea8d[_0x2358('0x1d')]:_0x64ea73[_0x2358('0x1c')]+_0x64ea73[_0x2358('0x1e')];var _0x3e24a4;if(_0x42f922>=_0x2cb2ed){_0x42f922=_0x2cb2ed;_0x3e24a4=0xc8;}else{_0x3e24a4=0xce;}_0x46b09a['status'](_0x3e24a4);return _0x46b09a['set'](_0x2358('0x1f'),_0x9074f4+'-'+_0x42f922+'/'+_0x2cb2ed)[_0x2358('0x1b')](_0x41ea8d);}return null;};}function patchUpdates(_0x19ef3f){return function(_0x31e620){try{jsonpatch[_0x2358('0x20')](_0x31e620,_0x19ef3f,!![]);}catch(_0xfbb647){return BPromise[_0x2358('0x21')](_0xfbb647);}return _0x31e620[_0x2358('0x22')]();};}function saveUpdates(_0x44a5ac,_0x1e76f5){return function(_0x3b0c93){if(_0x3b0c93){return _0x3b0c93[_0x2358('0x23')](_0x44a5ac)[_0x2358('0x24')](function(_0x1d9812){return _0x1d9812;});}return null;};}function removeEntity(_0x165fd0,_0x51d0e4){return function(_0x52c739){if(_0x52c739){return _0x52c739[_0x2358('0x25')]()[_0x2358('0x24')](function(){_0x165fd0[_0x2358('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1626fd,_0x3e7f9b){return function(_0x40f39f){if(!_0x40f39f){_0x1626fd[_0x2358('0x26')](0x194);}return _0x40f39f;};}function handleError(_0x5c43b4,_0x5817e6){_0x5817e6=_0x5817e6||0x1f4;return function(_0x5240d4){logger[_0x2358('0x27')](_0x5240d4['stack']);if(_0x5240d4[_0x2358('0x28')]){delete _0x5240d4[_0x2358('0x28')];}_0x5c43b4['status'](_0x5817e6)[_0x2358('0x29')](_0x5240d4);};}exports[_0x2358('0x2a')]=function(_0x420868,_0x34b0e0){var _0x1b0b7a={},_0x2dd1c2={},_0x3335eb={'count':0x0,'rows':[]};var _0x3fa166=_['map'](db[_0x2358('0x2b')][_0x2358('0x2c')],function(_0x289728){return{'name':_0x289728[_0x2358('0x2d')],'type':_0x289728[_0x2358('0x2e')]['key']};});_0x2dd1c2[_0x2358('0x2f')]=_['map'](_0x3fa166,'name');_0x2dd1c2['query']=_['keys'](_0x420868[_0x2358('0x30')]);_0x2dd1c2[_0x2358('0x31')]=_[_0x2358('0x32')](_0x2dd1c2['model'],_0x2dd1c2['query']);_0x1b0b7a[_0x2358('0x33')]=_[_0x2358('0x32')](_0x2dd1c2[_0x2358('0x2f')],qs[_0x2358('0x34')](_0x420868['query'][_0x2358('0x34')]));_0x1b0b7a['attributes']=_0x1b0b7a['attributes'][_0x2358('0x35')]?_0x1b0b7a[_0x2358('0x33')]:_0x2dd1c2[_0x2358('0x2f')];if(!_0x420868[_0x2358('0x30')][_0x2358('0x36')](_0x2358('0x37'))){_0x1b0b7a['limit']=qs[_0x2358('0x1e')](_0x420868[_0x2358('0x30')][_0x2358('0x1e')]);_0x1b0b7a[_0x2358('0x1c')]=qs[_0x2358('0x1c')](_0x420868[_0x2358('0x30')][_0x2358('0x1c')]);}_0x1b0b7a[_0x2358('0x38')]=qs['sort'](_0x420868[_0x2358('0x30')][_0x2358('0x39')]);_0x1b0b7a['where']=qs[_0x2358('0x31')](_[_0x2358('0x3a')](_0x420868[_0x2358('0x30')],_0x2dd1c2['filters']),_0x3fa166);if(_0x420868['query'][_0x2358('0x3b')]){_0x1b0b7a[_0x2358('0x3c')]=_[_0x2358('0x3d')](_0x1b0b7a[_0x2358('0x3c')],{'$or':_[_0x2358('0x3e')](_0x3fa166,function(_0x28ef57){if(_0x28ef57[_0x2358('0x2e')]!==_0x2358('0x3f')){var _0x57aad9={};_0x57aad9[_0x28ef57[_0x2358('0x28')]]={'$like':'%'+_0x420868['query']['filter']+'%'};return _0x57aad9;}})});}_0x1b0b7a=_[_0x2358('0x3d')]({},_0x1b0b7a,_0x420868['options']);var _0x8a5a6c={'where':_0x1b0b7a[_0x2358('0x3c')]};return db[_0x2358('0x2b')]['count'](_0x8a5a6c)[_0x2358('0x24')](function(_0x48a0a8){_0x3335eb[_0x2358('0x1d')]=_0x48a0a8;if(_0x420868[_0x2358('0x30')]['includeAll']){_0x1b0b7a[_0x2358('0x40')]=[{'all':!![]}];}return db[_0x2358('0x2b')][_0x2358('0x41')](_0x1b0b7a);})['then'](function(_0x39a7de){_0x3335eb[_0x2358('0x42')]=_0x39a7de;return _0x3335eb;})[_0x2358('0x24')](respondWithFilteredResult(_0x34b0e0,_0x1b0b7a))['catch'](handleError(_0x34b0e0,null));};exports[_0x2358('0x43')]=function(_0x354105,_0x4e0fa6){var _0x3ae09e={'raw':!![],'where':{'id':_0x354105['params']['id']}},_0x22601d={};_0x22601d[_0x2358('0x2f')]=_[_0x2358('0x44')](db[_0x2358('0x2b')][_0x2358('0x2c')]);_0x22601d[_0x2358('0x30')]=_['keys'](_0x354105['query']);_0x22601d[_0x2358('0x31')]=_['intersection'](_0x22601d[_0x2358('0x2f')],_0x22601d['query']);_0x3ae09e[_0x2358('0x33')]=_['intersection'](_0x22601d[_0x2358('0x2f')],qs[_0x2358('0x34')](_0x354105[_0x2358('0x30')][_0x2358('0x34')]));_0x3ae09e[_0x2358('0x33')]=_0x3ae09e[_0x2358('0x33')][_0x2358('0x35')]?_0x3ae09e['attributes']:_0x22601d[_0x2358('0x2f')];if(_0x354105[_0x2358('0x30')][_0x2358('0x45')]){_0x3ae09e[_0x2358('0x40')]=[{'all':!![]}];}_0x3ae09e=_['merge']({},_0x3ae09e,_0x354105[_0x2358('0x46')]);return db['VoiceQueuesLog']['find'](_0x3ae09e)[_0x2358('0x24')](handleEntityNotFound(_0x4e0fa6,null))[_0x2358('0x24')](respondWithResult(_0x4e0fa6,null))[_0x2358('0x47')](handleError(_0x4e0fa6,null));};exports['create']=function(_0x300a21,_0x39c6be){return db[_0x2358('0x2b')]['create'](_0x300a21[_0x2358('0x48')],{})[_0x2358('0x24')](respondWithResult(_0x39c6be,0xc9))[_0x2358('0x47')](handleError(_0x39c6be,null));};exports[_0x2358('0x23')]=function(_0x150e48,_0x12f158){if(_0x150e48['body']['id']){delete _0x150e48['body']['id'];}return db[_0x2358('0x2b')][_0x2358('0x49')]({'where':{'id':_0x150e48[_0x2358('0x4a')]['id']}})[_0x2358('0x24')](handleEntityNotFound(_0x12f158,null))[_0x2358('0x24')](saveUpdates(_0x150e48[_0x2358('0x48')],null))[_0x2358('0x24')](respondWithResult(_0x12f158,null))['catch'](handleError(_0x12f158,null));};exports['destroy']=function(_0x529942,_0x38cc3f){return db['VoiceQueuesLog']['find']({'where':{'id':_0x529942[_0x2358('0x4a')]['id']}})[_0x2358('0x24')](handleEntityNotFound(_0x38cc3f,null))['then'](removeEntity(_0x38cc3f,null))[_0x2358('0x47')](handleError(_0x38cc3f,null));}; \ No newline at end of file +var _0x7996=['api','../../config/utils','../../config/environment','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','VoiceQueuesLog','rows','catch','show','params','find','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x48598e,_0x34a606){var _0x11066f=function(_0xf35e97){while(--_0xf35e97){_0x48598e['push'](_0x48598e['shift']());}};_0x11066f(++_0x34a606);}(_0x7996,0xc4));var _0x6799=function(_0x1f909a,_0x15d56f){_0x1f909a=_0x1f909a-0x0;var _0x543f16=_0x7996[_0x1f909a];return _0x543f16;};'use strict';var emlformat=require(_0x6799('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6799('0x1'));var jsonpatch=require(_0x6799('0x2'));var rp=require(_0x6799('0x3'));var moment=require(_0x6799('0x4'));var BPromise=require(_0x6799('0x5'));var Mustache=require(_0x6799('0x6'));var util=require(_0x6799('0x7'));var path=require(_0x6799('0x8'));var sox=require(_0x6799('0x9'));var csv=require(_0x6799('0xa'));var ejs=require(_0x6799('0xb'));var fs=require('fs');var fs_extra=require(_0x6799('0xc'));var _=require(_0x6799('0xd'));var squel=require(_0x6799('0xe'));var crypto=require(_0x6799('0xf'));var jsforce=require(_0x6799('0x10'));var deskjs=require(_0x6799('0x11'));var toCsv=require(_0x6799('0xa'));var querystring=require(_0x6799('0x12'));var Papa=require(_0x6799('0x13'));var Redis=require(_0x6799('0x14'));var authService=require(_0x6799('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x6799('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6799('0x17'));var utils=require(_0x6799('0x18'));var config=require(_0x6799('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa5bf9c,_0x6ef23c){_0x6ef23c=_0x6ef23c||0xcc;return function(_0x4022fd){if(_0x4022fd){return _0xa5bf9c['sendStatus'](_0x6ef23c);}return _0xa5bf9c[_0x6799('0x1a')](_0x6ef23c)[_0x6799('0x1b')]();};}function respondWithResult(_0x55d1a0,_0x3c2832){_0x3c2832=_0x3c2832||0xc8;return function(_0x330284){if(_0x330284){return _0x55d1a0[_0x6799('0x1a')](_0x3c2832)['json'](_0x330284);}};}function respondWithFilteredResult(_0x204c46,_0x9ae1d5){return function(_0x503377){if(_0x503377){var _0x557cb0=typeof _0x9ae1d5[_0x6799('0x1c')]==='undefined'&&typeof _0x9ae1d5[_0x6799('0x1d')]===_0x6799('0x1e');var _0x3420ca=_0x503377[_0x6799('0x1f')];var _0x449358=_0x557cb0?0x0:_0x9ae1d5[_0x6799('0x1c')];var _0x237a69=_0x557cb0?_0x503377['count']:_0x9ae1d5['offset']+_0x9ae1d5[_0x6799('0x1d')];var _0x34950a;if(_0x237a69>=_0x3420ca){_0x237a69=_0x3420ca;_0x34950a=0xc8;}else{_0x34950a=0xce;}_0x204c46[_0x6799('0x1a')](_0x34950a);return _0x204c46[_0x6799('0x20')](_0x6799('0x21'),_0x449358+'-'+_0x237a69+'/'+_0x3420ca)[_0x6799('0x22')](_0x503377);}return null;};}function patchUpdates(_0xa89795){return function(_0x40e43b){try{jsonpatch['apply'](_0x40e43b,_0xa89795,!![]);}catch(_0x11e20b){return BPromise[_0x6799('0x23')](_0x11e20b);}return _0x40e43b[_0x6799('0x24')]();};}function saveUpdates(_0x2092bb,_0xb8647){return function(_0x3b56e4){if(_0x3b56e4){return _0x3b56e4[_0x6799('0x25')](_0x2092bb)[_0x6799('0x26')](function(_0x12d20){return _0x12d20;});}return null;};}function removeEntity(_0x5e3231,_0x2505c7){return function(_0x3aa712){if(_0x3aa712){return _0x3aa712[_0x6799('0x27')]()[_0x6799('0x26')](function(){_0x5e3231['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x455af4,_0x418444){return function(_0x4913a6){if(!_0x4913a6){_0x455af4[_0x6799('0x28')](0x194);}return _0x4913a6;};}function handleError(_0x50f2bf,_0x495aa5){_0x495aa5=_0x495aa5||0x1f4;return function(_0x4a644a){logger['error'](_0x4a644a[_0x6799('0x29')]);if(_0x4a644a['name']){delete _0x4a644a[_0x6799('0x2a')];}_0x50f2bf['status'](_0x495aa5)[_0x6799('0x2b')](_0x4a644a);};}exports[_0x6799('0x2c')]=function(_0x26f80c,_0xe2faea){var _0x4d1ebc={},_0x35f0b3={},_0x251cab={'count':0x0,'rows':[]};var _0x6334d6=_['map'](db['VoiceQueuesLog'][_0x6799('0x2d')],function(_0x3ea1ed){return{'name':_0x3ea1ed['fieldName'],'type':_0x3ea1ed['type']['key']};});_0x35f0b3['model']=_['map'](_0x6334d6,_0x6799('0x2a'));_0x35f0b3[_0x6799('0x2e')]=_[_0x6799('0x2f')](_0x26f80c[_0x6799('0x2e')]);_0x35f0b3[_0x6799('0x30')]=_['intersection'](_0x35f0b3['model'],_0x35f0b3[_0x6799('0x2e')]);_0x4d1ebc[_0x6799('0x31')]=_[_0x6799('0x32')](_0x35f0b3[_0x6799('0x33')],qs[_0x6799('0x34')](_0x26f80c['query'][_0x6799('0x34')]));_0x4d1ebc[_0x6799('0x31')]=_0x4d1ebc[_0x6799('0x31')][_0x6799('0x35')]?_0x4d1ebc['attributes']:_0x35f0b3[_0x6799('0x33')];if(!_0x26f80c[_0x6799('0x2e')][_0x6799('0x36')](_0x6799('0x37'))){_0x4d1ebc[_0x6799('0x1d')]=qs[_0x6799('0x1d')](_0x26f80c[_0x6799('0x2e')][_0x6799('0x1d')]);_0x4d1ebc[_0x6799('0x1c')]=qs[_0x6799('0x1c')](_0x26f80c[_0x6799('0x2e')][_0x6799('0x1c')]);}_0x4d1ebc[_0x6799('0x38')]=qs[_0x6799('0x39')](_0x26f80c[_0x6799('0x2e')][_0x6799('0x39')]);_0x4d1ebc[_0x6799('0x3a')]=qs[_0x6799('0x30')](_['pick'](_0x26f80c[_0x6799('0x2e')],_0x35f0b3[_0x6799('0x30')]),_0x6334d6);if(_0x26f80c[_0x6799('0x2e')][_0x6799('0x3b')]){_0x4d1ebc[_0x6799('0x3a')]=_['merge'](_0x4d1ebc[_0x6799('0x3a')],{'$or':_['map'](_0x6334d6,function(_0x1d93ab){if(_0x1d93ab[_0x6799('0x3c')]!==_0x6799('0x3d')){var _0xa96c8d={};_0xa96c8d[_0x1d93ab[_0x6799('0x2a')]]={'$like':'%'+_0x26f80c[_0x6799('0x2e')]['filter']+'%'};return _0xa96c8d;}})});}_0x4d1ebc=_[_0x6799('0x3e')]({},_0x4d1ebc,_0x26f80c[_0x6799('0x3f')]);var _0x51a483={'where':_0x4d1ebc[_0x6799('0x3a')]};return db['VoiceQueuesLog'][_0x6799('0x1f')](_0x51a483)['then'](function(_0x2d4928){_0x251cab['count']=_0x2d4928;if(_0x26f80c[_0x6799('0x2e')][_0x6799('0x40')]){_0x4d1ebc[_0x6799('0x41')]=[{'all':!![]}];}return db[_0x6799('0x42')]['findAll'](_0x4d1ebc);})['then'](function(_0x4d4ad8){_0x251cab[_0x6799('0x43')]=_0x4d4ad8;return _0x251cab;})[_0x6799('0x26')](respondWithFilteredResult(_0xe2faea,_0x4d1ebc))[_0x6799('0x44')](handleError(_0xe2faea,null));};exports[_0x6799('0x45')]=function(_0x4ee7eb,_0x2782ee){var _0x46a414={'raw':!![],'where':{'id':_0x4ee7eb[_0x6799('0x46')]['id']}},_0xccee03={};_0xccee03[_0x6799('0x33')]=_[_0x6799('0x2f')](db['VoiceQueuesLog'][_0x6799('0x2d')]);_0xccee03[_0x6799('0x2e')]=_[_0x6799('0x2f')](_0x4ee7eb[_0x6799('0x2e')]);_0xccee03[_0x6799('0x30')]=_[_0x6799('0x32')](_0xccee03[_0x6799('0x33')],_0xccee03[_0x6799('0x2e')]);_0x46a414[_0x6799('0x31')]=_['intersection'](_0xccee03[_0x6799('0x33')],qs[_0x6799('0x34')](_0x4ee7eb['query']['fields']));_0x46a414[_0x6799('0x31')]=_0x46a414[_0x6799('0x31')][_0x6799('0x35')]?_0x46a414[_0x6799('0x31')]:_0xccee03[_0x6799('0x33')];if(_0x4ee7eb[_0x6799('0x2e')][_0x6799('0x40')]){_0x46a414[_0x6799('0x41')]=[{'all':!![]}];}_0x46a414=_['merge']({},_0x46a414,_0x4ee7eb['options']);return db[_0x6799('0x42')][_0x6799('0x47')](_0x46a414)['then'](handleEntityNotFound(_0x2782ee,null))[_0x6799('0x26')](respondWithResult(_0x2782ee,null))[_0x6799('0x44')](handleError(_0x2782ee,null));};exports['create']=function(_0x2f0cda,_0x385818){return db['VoiceQueuesLog']['create'](_0x2f0cda[_0x6799('0x48')],{})[_0x6799('0x26')](respondWithResult(_0x385818,0xc9))[_0x6799('0x44')](handleError(_0x385818,null));};exports[_0x6799('0x25')]=function(_0x18fb2c,_0x38e226){if(_0x18fb2c[_0x6799('0x48')]['id']){delete _0x18fb2c['body']['id'];}return db['VoiceQueuesLog'][_0x6799('0x47')]({'where':{'id':_0x18fb2c[_0x6799('0x46')]['id']}})['then'](handleEntityNotFound(_0x38e226,null))[_0x6799('0x26')](saveUpdates(_0x18fb2c[_0x6799('0x48')],null))[_0x6799('0x26')](respondWithResult(_0x38e226,null))[_0x6799('0x44')](handleError(_0x38e226,null));};exports['destroy']=function(_0x1c0873,_0x50a0a3){return db[_0x6799('0x42')][_0x6799('0x47')]({'where':{'id':_0x1c0873[_0x6799('0x46')]['id']}})[_0x6799('0x26')](handleEntityNotFound(_0x50a0a3,null))['then'](removeEntity(_0x50a0a3,null))[_0x6799('0x44')](handleError(_0x50a0a3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 1beb2da..761ce48 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.model.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x272e=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','lodash'];(function(_0x40b25f,_0x3271c8){var _0x5d7a49=function(_0x1ef7a2){while(--_0x1ef7a2){_0x40b25f['push'](_0x40b25f['shift']());}};_0x5d7a49(++_0x3271c8);}(_0x272e,0xb5));var _0xe272=function(_0x1633d6,_0x8fffd6){_0x1633d6=_0x1633d6-0x0;var _0x31e057=_0x272e[_0x1633d6];return _0x31e057;};'use strict';var _=require(_0xe272('0x0'));var util=require(_0xe272('0x1'));var logger=require('../../config/logger')(_0xe272('0x2'));var moment=require(_0xe272('0x3'));var BPromise=require(_0xe272('0x4'));var rp=require(_0xe272('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe272('0x6'));var config=require(_0xe272('0x7'));var attributes=require(_0xe272('0x8'));module[_0xe272('0x9')]=function(_0x2d2960,_0x18dced){return _0x2d2960[_0xe272('0xa')](_0xe272('0xb'),attributes,{'tableName':_0xe272('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xe272('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xeb93=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util'];(function(_0x127cc1,_0x28f94e){var _0xe7ef98=function(_0xd21847){while(--_0xd21847){_0x127cc1['push'](_0x127cc1['shift']());}};_0xe7ef98(++_0x28f94e);}(_0xeb93,0x195));var _0x3eb9=function(_0x2bb787,_0x41bf02){_0x2bb787=_0x2bb787-0x0;var _0x425b33=_0xeb93[_0x2bb787];return _0x425b33;};'use strict';var _=require('lodash');var util=require(_0x3eb9('0x0'));var logger=require(_0x3eb9('0x1'))('api');var moment=require(_0x3eb9('0x2'));var BPromise=require(_0x3eb9('0x3'));var rp=require(_0x3eb9('0x4'));var fs=require('fs');var path=require(_0x3eb9('0x5'));var rimraf=require(_0x3eb9('0x6'));var config=require(_0x3eb9('0x7'));var attributes=require(_0x3eb9('0x8'));module['exports']=function(_0x4cb913,_0x223c44){return _0x4cb913[_0x3eb9('0x9')](_0x3eb9('0xa'),attributes,{'tableName':_0x3eb9('0xb'),'paranoid':![],'indexes':[{'name':_0x3eb9('0xc'),'fields':['event',_0x3eb9('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 60a789a..d385e76 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f7c=['result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x200e19,_0x2ef4c5){var _0x3f1a75=function(_0x3fb64f){while(--_0x3fb64f){_0x200e19['push'](_0x200e19['shift']());}};_0x3f1a75(++_0x2ef4c5);}(_0x8f7c,0x133));var _0xc8f7=function(_0x1334ab,_0x563000){_0x1334ab=_0x1334ab-0x0;var _0x557cd9=_0x8f7c[_0x1334ab];return _0x557cd9;};'use strict';var _=require(_0xc8f7('0x0'));var util=require(_0xc8f7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc8f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8f7('0x3'))['db'];var utils=require(_0xc8f7('0x4'));var logger=require(_0xc8f7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc8f7('0x6'));var client=jayson['client'][_0xc8f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36a108,_0x4692fd,_0x17520c){return new BPromise(function(_0x193e5b,_0x1e1bcf){return client[_0xc8f7('0x8')](_0x36a108,_0x17520c)['then'](function(_0x1494f9){logger[_0xc8f7('0x9')](_0xc8f7('0xa'),_0x4692fd,_0xc8f7('0xb'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x4692fd,_0xc8f7('0xb'),JSON[_0xc8f7('0xc')](_0x1494f9));if(_0x1494f9[_0xc8f7('0xd')]){if(_0x1494f9[_0xc8f7('0xd')][_0xc8f7('0xe')]===0x1f4){logger[_0xc8f7('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4692fd,_0x1494f9['error']['message']);return _0x1e1bcf(_0x1494f9[_0xc8f7('0xd')][_0xc8f7('0xf')]);}logger[_0xc8f7('0xd')](_0xc8f7('0xa'),_0x4692fd,_0x1494f9[_0xc8f7('0xd')][_0xc8f7('0xf')]);return _0x193e5b(_0x1494f9[_0xc8f7('0xd')][_0xc8f7('0xf')]);}else{logger[_0xc8f7('0x9')](_0xc8f7('0xa'),_0x4692fd,_0xc8f7('0xb'));_0x193e5b(_0x1494f9[_0xc8f7('0x10')][_0xc8f7('0xf')]);}})['catch'](function(_0x4e3897){logger['error'](_0xc8f7('0xa'),_0x4692fd,_0x4e3897);_0x1e1bcf(_0x4e3897);});});} \ No newline at end of file +var _0xc540=['info','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceQueuesLog,\x20%s,\x20%s','message','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x241288,_0x3d6f94){var _0x4287d6=function(_0x2d972f){while(--_0x2d972f){_0x241288['push'](_0x241288['shift']());}};_0x4287d6(++_0x3d6f94);}(_0xc540,0x184));var _0x0c54=function(_0x514151,_0x46381b){_0x514151=_0x514151-0x0;var _0x3f69b2=_0xc540[_0x514151];return _0x3f69b2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0c54('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c54('0x1'));var db=require(_0x0c54('0x2'))['db'];var utils=require(_0x0c54('0x3'));var logger=require(_0x0c54('0x4'))(_0x0c54('0x5'));var config=require('../../config/environment');var jayson=require(_0x0c54('0x6'));var client=jayson[_0x0c54('0x7')][_0x0c54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd1bfc5,_0x2eee8f,_0x90e1b0){return new BPromise(function(_0x4067ac,_0x32664a){return client[_0x0c54('0x9')](_0xd1bfc5,_0x90e1b0)[_0x0c54('0xa')](function(_0x10a76a){logger[_0x0c54('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2eee8f,_0x0c54('0xc'));logger['debug'](_0x0c54('0xd'),_0x2eee8f,_0x0c54('0xc'),JSON[_0x0c54('0xe')](_0x10a76a));if(_0x10a76a['error']){if(_0x10a76a['error'][_0x0c54('0xf')]===0x1f4){logger[_0x0c54('0x10')](_0x0c54('0x11'),_0x2eee8f,_0x10a76a[_0x0c54('0x10')][_0x0c54('0x12')]);return _0x32664a(_0x10a76a[_0x0c54('0x10')]['message']);}logger['error'](_0x0c54('0x11'),_0x2eee8f,_0x10a76a[_0x0c54('0x10')]['message']);return _0x4067ac(_0x10a76a['error'][_0x0c54('0x12')]);}else{logger[_0x0c54('0xb')](_0x0c54('0x11'),_0x2eee8f,_0x0c54('0xc'));_0x4067ac(_0x10a76a['result'][_0x0c54('0x12')]);}})['catch'](function(_0x10425a){logger[_0x0c54('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2eee8f,_0x10425a);_0x32664a(_0x10425a);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index efe0ed2..52dee73 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaad3=['/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2cdeef,_0x13fe05){var _0x1e83f2=function(_0x6d0249){while(--_0x6d0249){_0x2cdeef['push'](_0x2cdeef['shift']());}};_0x1e83f2(++_0x13fe05);}(_0xaad3,0x1be));var _0x3aad=function(_0xa3a55f,_0x3e01dc){_0xa3a55f=_0xa3a55f-0x0;var _0x38e8b7=_0xaad3[_0xa3a55f];return _0x38e8b7;};'use strict';var multer=require(_0x3aad('0x0'));var util=require(_0x3aad('0x1'));var path=require('path');var timeout=require(_0x3aad('0x2'));var express=require(_0x3aad('0x3'));var router=express[_0x3aad('0x4')]();var fs_extra=require(_0x3aad('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3aad('0x6'));var config=require('../../config/environment');var controller=require(_0x3aad('0x7'));router[_0x3aad('0x8')]('/',auth[_0x3aad('0x9')](),controller[_0x3aad('0xa')]);router['get'](_0x3aad('0xb'),auth[_0x3aad('0x9')](),controller[_0x3aad('0xc')]);router[_0x3aad('0x8')](_0x3aad('0xd'),auth[_0x3aad('0x9')](),controller[_0x3aad('0xe')]);router[_0x3aad('0x8')](_0x3aad('0xf'),auth[_0x3aad('0x9')](),controller[_0x3aad('0x10')]);router['get'](_0x3aad('0x11'),controller[_0x3aad('0x12')]);router[_0x3aad('0x8')](_0x3aad('0x13'),auth[_0x3aad('0x9')](),controller[_0x3aad('0x14')]);router[_0x3aad('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3aad('0x15')](_0x3aad('0x13'),auth[_0x3aad('0x9')](),controller[_0x3aad('0x16')]);router[_0x3aad('0x17')](_0x3aad('0xd'),auth[_0x3aad('0x9')](),controller[_0x3aad('0x18')]);router[_0x3aad('0x19')](_0x3aad('0xd'),auth[_0x3aad('0x9')](),controller['destroy']);module[_0x3aad('0x1a')]=router; \ No newline at end of file +var _0x2eaa=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','/:id','update','delete','exports','multer','path','connect-timeout','fs-extra','get','isAuthenticated','index','/describe','describe','show','/:id/download','download'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2eaa,0x192));var _0xa2ea=function(_0x1e48f0,_0x206c44){_0x1e48f0=_0x1e48f0-0x0;var _0x3cc81e=_0x2eaa[_0x1e48f0];return _0x3cc81e;};'use strict';var multer=require(_0xa2ea('0x0'));var util=require('util');var path=require(_0xa2ea('0x1'));var timeout=require(_0xa2ea('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa2ea('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0xa2ea('0x4')]('/',auth[_0xa2ea('0x5')](),controller[_0xa2ea('0x6')]);router['get'](_0xa2ea('0x7'),auth[_0xa2ea('0x5')](),controller[_0xa2ea('0x8')]);router[_0xa2ea('0x4')]('/:id',auth[_0xa2ea('0x5')](),controller[_0xa2ea('0x9')]);router[_0xa2ea('0x4')](_0xa2ea('0xa'),auth[_0xa2ea('0x5')](),controller[_0xa2ea('0xb')]);router['get'](_0xa2ea('0xc'),controller[_0xa2ea('0xd')]);router[_0xa2ea('0x4')](_0xa2ea('0xe'),auth[_0xa2ea('0x5')](),controller[_0xa2ea('0xf')]);router[_0xa2ea('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa2ea('0x10')]('/:id/transcribe',auth[_0xa2ea('0x5')](),controller[_0xa2ea('0x11')]);router[_0xa2ea('0x12')](_0xa2ea('0x13'),auth[_0xa2ea('0x5')](),controller[_0xa2ea('0x14')]);router[_0xa2ea('0x15')]('/:id',auth[_0xa2ea('0x5')](),controller['destroy']);module[_0xa2ea('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e89cc04..a36ab1d 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 045d911..1d90ee6 100644 --- a/server/api/voiceRecording/voiceRecording.controller.js +++ b/server/api/voiceRecording/voiceRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa858=['Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','update','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','push','$and','decryptFile','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion'];(function(_0x4a475c,_0x4b10b8){var _0x184939=function(_0x48bc82){while(--_0x48bc82){_0x4a475c['push'](_0x4a475c['shift']());}};_0x184939(++_0x4b10b8);}(_0xa858,0xb2));var _0x8a85=function(_0x32de8f,_0x59023a){_0x32de8f=_0x32de8f-0x0;var _0x4ed928=_0xa858[_0x32de8f];return _0x4ed928;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8a85('0x0'));var rp=require(_0x8a85('0x1'));var moment=require(_0x8a85('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8a85('0x3'));var util=require(_0x8a85('0x4'));var path=require(_0x8a85('0x5'));var sox=require(_0x8a85('0x6'));var csv=require(_0x8a85('0x7'));var ejs=require(_0x8a85('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a85('0x9'));var squel=require(_0x8a85('0xa'));var crypto=require('crypto');var jsforce=require(_0x8a85('0xb'));var deskjs=require(_0x8a85('0xc'));var toCsv=require(_0x8a85('0x7'));var querystring=require(_0x8a85('0xd'));var Papa=require(_0x8a85('0xe'));var AWS=require(_0x8a85('0xf'));var uuidv4=require('uuid/v4');var Redis=require(_0x8a85('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8a85('0x11'));var as=require(_0x8a85('0x12'));var hardwareService=require(_0x8a85('0x13'));var logger=require(_0x8a85('0x14'))(_0x8a85('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8a85('0x16'));var db=require(_0x8a85('0x17'))['db'];function respondWithStatusCode(_0x4a6f3d,_0x5b8be2){_0x5b8be2=_0x5b8be2||0xcc;return function(_0x56c8cb){if(_0x56c8cb){return _0x4a6f3d[_0x8a85('0x18')](_0x5b8be2);}return _0x4a6f3d[_0x8a85('0x19')](_0x5b8be2)['end']();};}function respondWithResult(_0x50912a,_0x5b7cd9){_0x5b7cd9=_0x5b7cd9||0xc8;return function(_0x544a78){if(_0x544a78){return _0x50912a[_0x8a85('0x19')](_0x5b7cd9)[_0x8a85('0x1a')](_0x544a78);}};}function respondWithFilteredResult(_0x40bba4,_0x46d874){return function(_0x42ff27){if(_0x42ff27){var _0x4e1270=typeof _0x46d874['offset']===_0x8a85('0x1b')&&typeof _0x46d874[_0x8a85('0x1c')]==='undefined';var _0x4c1cb5=_0x42ff27[_0x8a85('0x1d')];var _0x1b1fd9=_0x4e1270?0x0:_0x46d874['offset'];var _0x2fb87b=_0x4e1270?_0x42ff27[_0x8a85('0x1d')]:_0x46d874[_0x8a85('0x1e')]+_0x46d874[_0x8a85('0x1c')];var _0x1ddcee;if(_0x2fb87b>=_0x4c1cb5){_0x2fb87b=_0x4c1cb5;_0x1ddcee=0xc8;}else{_0x1ddcee=0xce;}_0x40bba4['status'](_0x1ddcee);return _0x40bba4[_0x8a85('0x1f')](_0x8a85('0x20'),_0x1b1fd9+'-'+_0x2fb87b+'/'+_0x4c1cb5)[_0x8a85('0x1a')](_0x42ff27);}return null;};}function patchUpdates(_0x2b7a0a){return function(_0x39dd36){try{jsonpatch[_0x8a85('0x21')](_0x39dd36,_0x2b7a0a,!![]);}catch(_0x1b0d0a){return BPromise[_0x8a85('0x22')](_0x1b0d0a);}return _0x39dd36[_0x8a85('0x23')]();};}function saveUpdates(_0x2d31b3,_0x95e4f5){return function(_0x42c258){if(_0x42c258){return _0x42c258['update'](_0x2d31b3)[_0x8a85('0x24')](function(_0xcf790){return _0xcf790;});}return null;};}function removeEntity(_0x1f9413,_0x389cd4){return function(_0x436003){if(_0x436003){return _0x436003[_0x8a85('0x25')]()[_0x8a85('0x24')](function(){_0x1f9413[_0x8a85('0x19')](0xcc)[_0x8a85('0x26')]();});}};}function handleEntityNotFound(_0xf7ee0c,_0x3efe14){return function(_0x17f115){if(!_0x17f115){_0xf7ee0c['sendStatus'](0x194);}return _0x17f115;};}function handleError(_0x2bc01e,_0x536f4f){_0x536f4f=_0x536f4f||0x1f4;return function(_0x511dc2){logger[_0x8a85('0x27')](_0x511dc2[_0x8a85('0x28')]);if(_0x511dc2[_0x8a85('0x29')]){delete _0x511dc2[_0x8a85('0x29')];}_0x2bc01e['status'](_0x536f4f)[_0x8a85('0x2a')](_0x511dc2);};}exports[_0x8a85('0x2b')]=function(_0x27978f,_0x3a22f6){var _0x30c93e={},_0x5bb008={},_0x1d5c84={'count':0x0,'rows':[]};var _0x43c925=_[_0x8a85('0x2c')](db[_0x8a85('0x2d')]['rawAttributes'],function(_0x30144a){return{'name':_0x30144a[_0x8a85('0x2e')],'type':_0x30144a[_0x8a85('0x2f')][_0x8a85('0x30')]};});_0x5bb008[_0x8a85('0x31')]=_[_0x8a85('0x32')](_[_0x8a85('0x2c')](_0x43c925,_0x8a85('0x29')),[_0x8a85('0x33')]);_0x5bb008[_0x8a85('0x34')]=_[_0x8a85('0x35')](_0x27978f[_0x8a85('0x34')]);_0x5bb008[_0x8a85('0x36')]=_[_0x8a85('0x37')](_0x5bb008['model'],_0x5bb008[_0x8a85('0x34')]);_0x30c93e['attributes']=_[_0x8a85('0x37')](_0x5bb008[_0x8a85('0x31')],qs[_0x8a85('0x38')](_0x27978f[_0x8a85('0x34')]['fields']));_0x30c93e[_0x8a85('0x39')]=_0x30c93e[_0x8a85('0x39')][_0x8a85('0x3a')]?_0x30c93e['attributes']:_0x5bb008[_0x8a85('0x31')];if(!_0x27978f['query']['hasOwnProperty'](_0x8a85('0x3b'))){_0x30c93e[_0x8a85('0x1c')]=qs[_0x8a85('0x1c')](_0x27978f[_0x8a85('0x34')][_0x8a85('0x1c')]);_0x30c93e[_0x8a85('0x1e')]=qs[_0x8a85('0x1e')](_0x27978f[_0x8a85('0x34')][_0x8a85('0x1e')]);}_0x30c93e[_0x8a85('0x3c')]=qs['sort'](_0x27978f[_0x8a85('0x34')]['sort']);_0x30c93e[_0x8a85('0x3d')]=qs[_0x8a85('0x36')](_[_0x8a85('0x3e')](_0x27978f[_0x8a85('0x34')],_0x5bb008[_0x8a85('0x36')]),_0x43c925);if(_0x27978f[_0x8a85('0x34')][_0x8a85('0x3f')]){_0x30c93e[_0x8a85('0x3d')]=_[_0x8a85('0x40')](_0x30c93e['where'],{'$or':_['map'](_0x43c925,function(_0x3fb323){if(_0x3fb323[_0x8a85('0x2f')]!=='VIRTUAL'){var _0x413a4a={};_0x413a4a[_0x3fb323[_0x8a85('0x29')]]={'$like':'%'+_0x27978f[_0x8a85('0x34')]['filter']+'%'};return _0x413a4a;}})});}_0x30c93e=_[_0x8a85('0x40')]({},_0x30c93e,_0x27978f[_0x8a85('0x41')]);var _0x34daab={'where':_0x30c93e[_0x8a85('0x3d')]};return db['VoiceRecording'][_0x8a85('0x1d')](_0x34daab)[_0x8a85('0x24')](function(_0xde3f5e){_0x1d5c84[_0x8a85('0x1d')]=_0xde3f5e;if(_0x27978f[_0x8a85('0x34')][_0x8a85('0x42')]){_0x30c93e[_0x8a85('0x43')]=[{'all':!![]}];}return db[_0x8a85('0x2d')][_0x8a85('0x44')](_0x30c93e);})[_0x8a85('0x24')](function(_0x32ea97){_0x1d5c84[_0x8a85('0x45')]=_0x32ea97;return _0x1d5c84;})[_0x8a85('0x24')](respondWithFilteredResult(_0x3a22f6,_0x30c93e))['catch'](handleError(_0x3a22f6,null));};exports[_0x8a85('0x46')]=function(_0x5d08cd,_0xdee010){var _0x17efc2={'raw':![],'where':{'id':_0x5d08cd[_0x8a85('0x47')]['id']}},_0xd2ef49={};_0xd2ef49[_0x8a85('0x31')]=_[_0x8a85('0x35')](db[_0x8a85('0x2d')][_0x8a85('0x48')]);_0xd2ef49[_0x8a85('0x34')]=_[_0x8a85('0x35')](_0x5d08cd['query']);_0xd2ef49[_0x8a85('0x36')]=_[_0x8a85('0x37')](_0xd2ef49[_0x8a85('0x31')],_0xd2ef49['query']);_0x17efc2['attributes']=_[_0x8a85('0x37')](_0xd2ef49['model'],qs['fields'](_0x5d08cd[_0x8a85('0x34')]['fields']));_0x17efc2[_0x8a85('0x39')]=_0x17efc2[_0x8a85('0x39')]['length']?_0x17efc2[_0x8a85('0x39')]:_0xd2ef49[_0x8a85('0x31')];if(_0x5d08cd[_0x8a85('0x34')][_0x8a85('0x42')]){_0x17efc2[_0x8a85('0x43')]=[{'all':!![]}];}_0x17efc2=_[_0x8a85('0x40')]({},_0x17efc2,_0x5d08cd[_0x8a85('0x41')]);return db[_0x8a85('0x2d')]['find'](_0x17efc2)[_0x8a85('0x24')](handleEntityNotFound(_0xdee010,null))[_0x8a85('0x24')](respondWithResult(_0xdee010,null))[_0x8a85('0x49')](handleError(_0xdee010,null));};exports[_0x8a85('0x4a')]=function(_0x248af2,_0x3727d4){return db[_0x8a85('0x2d')][_0x8a85('0x4a')](_0x248af2['body'],{})[_0x8a85('0x24')](respondWithResult(_0x3727d4,0xc9))[_0x8a85('0x49')](handleError(_0x3727d4,null));};exports[_0x8a85('0x4b')]=function(_0x3264e6,_0x1243c7){if(_0x3264e6[_0x8a85('0x4c')]['id']){delete _0x3264e6[_0x8a85('0x4c')]['id'];}return db['VoiceRecording'][_0x8a85('0x4d')]({'where':{'id':_0x3264e6['params']['id']}})[_0x8a85('0x24')](handleEntityNotFound(_0x1243c7,null))[_0x8a85('0x24')](saveUpdates(_0x3264e6['body'],null))[_0x8a85('0x24')](respondWithResult(_0x1243c7,null))[_0x8a85('0x49')](handleError(_0x1243c7,null));};exports['describe']=function(_0x27e6f3,_0x876ac8){return db[_0x8a85('0x2d')][_0x8a85('0x4e')]()[_0x8a85('0x24')](respondWithResult(_0x876ac8,null))['catch'](handleError(_0x876ac8,null));};exports[_0x8a85('0x4f')]=function(_0x2ba4be,_0x1bad6f,_0x224e88){var _0x438e0b=require(_0x8a85('0x50'));var _0x56f49c=![];var _0x1260af={};if(_0x2ba4be[_0x8a85('0x34')][_0x8a85('0x2f')]&&_0x2ba4be['query'][_0x8a85('0x2f')]===_0x8a85('0x51')){_0x1260af[_0x8a85('0x51')]=_0x2ba4be[_0x8a85('0x47')]['id'];}else{_0x1260af['id']=_0x2ba4be[_0x8a85('0x47')]['id'];}return db['VoiceRecording'][_0x8a85('0x4d')]({'where':_0x1260af,'attributes':['id',_0x8a85('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x1bad6f,null))[_0x8a85('0x24')](function(_0x549296){if(_0x549296){var _0x15692c=_0x549296[_0x8a85('0x52')];var _0xbd67d1=util[_0x8a85('0x33')](_0x8a85('0x53'),_0x15692c);if(fs[_0x8a85('0x54')](_0xbd67d1)){_0x56f49c=!![];return _0x438e0b['decryptFile'](_0xbd67d1,_0x15692c,config[_0x8a85('0x55')]['recording'])[_0x8a85('0x24')](function(){return _0x549296;});}return _0x549296;}})[_0x8a85('0x24')](function(_0x2520aa){if(_0x2520aa){var _0x2735ef=_0x2520aa[_0x8a85('0x52')];if(!fs[_0x8a85('0x54')](_0x2735ef)){throw new db[(_0x8a85('0x56'))][(_0x8a85('0x57'))](_0x8a85('0x58'));}if(_0x2520aa['filename']){return _0x1bad6f[_0x8a85('0x4f')](_0x2735ef,_0x2520aa[_0x8a85('0x59')]+path[_0x8a85('0x5a')](_0x2735ef),function(){if(_0x56f49c){fs[_0x8a85('0x5b')](_0x2735ef);}});}else{return _0x1bad6f['download'](_0x2735ef,function(_0x561cb4){if(_0x56f49c){fs[_0x8a85('0x5b')](_0x2735ef);}});}}})['catch'](function(_0x56c882){if(_0x56c882[_0x8a85('0x5c')]===_0x8a85('0x58')){_0x1bad6f[_0x8a85('0x19')](0x194)[_0x8a85('0x2a')](_0x8a85('0x5d'));}else{return handleError(_0x1bad6f,null);}});};exports['downloads']=function(_0x46ba70,_0x1bc70a,_0x51db96){var _0x1f0528=require(_0x8a85('0x50'));var _0x302d80=![];var _0x3aed56={'$and':[db[_0x8a85('0x5e')][_0x8a85('0x3d')](db[_0x8a85('0x5e')]['fn'](_0x8a85('0x5f'),db[_0x8a85('0x5e')][_0x8a85('0x60')](_0x8a85('0x51'))),_0x46ba70[_0x8a85('0x34')][_0x8a85('0x61')])]};if(_0x46ba70[_0x8a85('0x34')][_0x8a85('0x2f')]&&_0x46ba70[_0x8a85('0x34')]['type']===_0x8a85('0x51')){_0x3aed56['$and'][_0x8a85('0x62')]({'uniqueid':_0x46ba70[_0x8a85('0x47')]['id']});}else{_0x3aed56[_0x8a85('0x63')][_0x8a85('0x62')]({'id':_0x46ba70[_0x8a85('0x47')]['id']});}return db[_0x8a85('0x2d')][_0x8a85('0x4d')]({'where':_0x3aed56,'attributes':['id',_0x8a85('0x52')],'raw':!![]})[_0x8a85('0x24')](handleEntityNotFound(_0x1bc70a,null))[_0x8a85('0x24')](function(_0x1c5429){if(_0x1c5429){var _0x5cd7a4=util[_0x8a85('0x33')](_0x8a85('0x53'),_0x1c5429[_0x8a85('0x52')]);if(fs[_0x8a85('0x54')](_0x5cd7a4)){_0x302d80=!![];return _0x1f0528[_0x8a85('0x64')](_0x5cd7a4,_0x1c5429[_0x8a85('0x52')],config['secrets'][_0x8a85('0x65')])['then'](function(){return _0x1c5429;});}return _0x1c5429;}})[_0x8a85('0x24')](function(_0x224f3e){if(_0x224f3e){if(!fs['existsSync'](_0x224f3e[_0x8a85('0x52')])){throw new db['Sequelize']['ValidationError'](_0x8a85('0x58'));}if(_0x224f3e[_0x8a85('0x59')]){return _0x1bc70a[_0x8a85('0x4f')](_0x224f3e[_0x8a85('0x52')],_0x224f3e['filename']+path[_0x8a85('0x5a')](_0x224f3e[_0x8a85('0x52')]),function(){if(_0x302d80){fs[_0x8a85('0x5b')](_0x224f3e['value']);}});}else{return _0x1bc70a['download'](_0x224f3e[_0x8a85('0x52')],function(_0x1b8bbf){if(_0x302d80){fs[_0x8a85('0x5b')](_0x224f3e[_0x8a85('0x52')]);}});}}})['catch'](handleError(_0x1bc70a,null));};exports[_0x8a85('0x25')]=function(_0x3b1f0f,_0x4ca243){return db[_0x8a85('0x2d')][_0x8a85('0x4d')]({'where':{'id':_0x3b1f0f[_0x8a85('0x47')]['id']}})['then'](function(_0x5f596d){if(_[_0x8a85('0x66')](_0x5f596d)){throw new ReferenceError(_0x8a85('0x67'));}return _0x5f596d;})[_0x8a85('0x24')](function(_0x535c21){var _0x514e7d=_0x535c21[_0x8a85('0x52')];logger[_0x8a85('0x68')](_0x8a85('0x69'),_0x514e7d);if(!_[_0x8a85('0x66')](_0x535c21['value'])&&fs['existsSync'](_0x514e7d)){logger['info']('File:\x20\x22'+_0x514e7d+_0x8a85('0x6a'));fs['unlinkSync'](_0x514e7d);}_0x514e7d=_0x514e7d+_0x8a85('0x6b');if(!_[_0x8a85('0x66')](_0x535c21['value'])&&fs[_0x8a85('0x54')](_0x514e7d)){logger[_0x8a85('0x68')](_0x8a85('0x6c')+_0x514e7d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8a85('0x6d')](_0x514e7d);}return _0x535c21;})[_0x8a85('0x24')](function(_0x327950){if(!_0x327950)throw new InternalError();return _0x327950[_0x8a85('0x25')]();})['then'](function(){_0x4ca243[_0x8a85('0x19')](0xcc)[_0x8a85('0x26')]();})[_0x8a85('0x49')](handleError(_0x4ca243,null));};function getBucketslist(_0x47a267,_0x592fc7,_0x1a2413){return new Promise(function(_0x347d73,_0x49b317){var _0xcd92dc=new AWS['S3']({'accessKeyId':_0x592fc7,'secretAccessKey':_0x47a267,'region':_0x1a2413});_0xcd92dc[_0x8a85('0x6e')]({},function(_0x3fef80,_0x5970f6){if(_0x3fef80){return _0x49b317(_0x3fef80);}else{return _0x347d73(_0x5970f6);}});});}function createBucket(_0x996f77,_0x30a054,_0x3df8b3,_0x56c87a){return new Promise(function(_0x318b9e,_0x352ad5){var _0x13d0ee=new AWS['S3']({'accessKeyId':_0x30a054,'secretAccessKey':_0x996f77,'region':_0x3df8b3});_0x13d0ee[_0x8a85('0x6f')]({'Bucket':_0x56c87a},function(_0x3f1d48,_0x370b76){if(_0x3f1d48){return _0x352ad5(_0x3f1d48);}else{return _0x318b9e(_0x370b76);}});});}function uploadFile(_0x122245,_0x3c2938,_0x47f178,_0xcfb390,_0x30510b,_0x376cb0){return new Promise(function(_0x5e783a,_0x22facf){var _0x199d77=new AWS['S3']({'accessKeyId':_0x3c2938,'secretAccessKey':_0x122245,'region':_0x47f178});_0x199d77[_0x8a85('0x70')]({'Bucket':_0xcfb390,'Key':_0x30510b,'Body':_0x376cb0},function(_0x475e03,_0x216bcd){if(_0x475e03){return _0x22facf(_0x475e03);}else{return _0x5e783a(_0x216bcd);}});});}function startTranscribe(_0x12f670,_0x177ff6,_0x530bf4,_0x58e050,_0x457e2c,_0x58343b){return new Promise(function(_0x5e9e1a,_0x1dc11a){var _0x20d661=new AWS[(_0x8a85('0x71'))]({'accessKeyId':_0x177ff6,'secretAccessKey':_0x12f670,'region':_0x530bf4});_0x20d661[_0x8a85('0x72')]({'TranscriptionJobName':_0x58e050,'LanguageCode':_0x457e2c,'Media':{'MediaFileUri':_0x58343b}},function(_0x5a56fa,_0xfdf5cd){if(_0x5a56fa){return _0x1dc11a(_0x5a56fa);}else{return _0x5e9e1a(_0xfdf5cd);}});});}function transcribe(_0x3c434e,_0x5dadca,_0x21bc0f,_0x7e5ca5,_0x11fd17,_0x44bd74,_0x3ce6af){return new Promise(function(_0x9875f0,_0x538ee3){var _0x3d5c1d={};logger[_0x8a85('0x68')](util[_0x8a85('0x33')](_0x8a85('0x73'),_0x3c434e,_0x11fd17));return uploadFile(_0x5dadca,_0x21bc0f,_0x7e5ca5,_0x11fd17,path[_0x8a85('0x74')](_0x44bd74),fs[_0x8a85('0x75')](_0x44bd74))[_0x8a85('0x24')](function(_0x256a58){logger[_0x8a85('0x68')](util[_0x8a85('0x33')](_0x8a85('0x76'),_0x3c434e,_0x11fd17,_0x256a58[_0x8a85('0x77')]));_0x3d5c1d[_0x8a85('0x78')]=_0x256a58[_0x8a85('0x79')];_0x3d5c1d[_0x8a85('0x7a')]=_0x256a58[_0x8a85('0x77')];logger[_0x8a85('0x68')](util[_0x8a85('0x33')](_0x8a85('0x7b'),_0x3c434e));return startTranscribe(_0x5dadca,_0x21bc0f,_0x7e5ca5,uuidv4(),_0x3ce6af,_0x256a58['Location']);})[_0x8a85('0x24')](function(_0x4add6b){logger[_0x8a85('0x68')](util[_0x8a85('0x33')](_0x8a85('0x7c'),_0x3c434e,_0x4add6b[_0x8a85('0x7d')][_0x8a85('0x7e')]));_0x3d5c1d['transcribeName']=_0x4add6b['TranscriptionJob'][_0x8a85('0x7e')];_0x3d5c1d['transcribeStatus']=_0x4add6b[_0x8a85('0x7d')][_0x8a85('0x7f')];return _0x9875f0(_0x3d5c1d);})[_0x8a85('0x49')](function(_0x5ab711){return _0x538ee3(_0x5ab711);});});}exports['runTranscribe']=function(_0x353255,_0x53f072,_0x217935){var _0x3c2526;var _0x5e1c16;var _0x4a621f;var _0x5a8186=require(_0x8a85('0x50'));return db[_0x8a85('0x2d')][_0x8a85('0x80')]({'where':{'id':_0x353255['params']['id']}})[_0x8a85('0x24')](function(_0x152511){if(_0x152511){var _0x37fd1f=util[_0x8a85('0x33')](_0x8a85('0x53'),_0x152511[_0x8a85('0x52')]);if(fs[_0x8a85('0x54')](_0x37fd1f)){cypher=!![];return _0x5a8186[_0x8a85('0x64')](_0x37fd1f,_0x152511[_0x8a85('0x52')],config[_0x8a85('0x55')][_0x8a85('0x65')])[_0x8a85('0x24')](function(){return _0x152511;});}return _0x152511;}})['then'](function(_0x5bda87){if(!_0x5bda87){throw new db[(_0x8a85('0x56'))][(_0x8a85('0x57'))]('Voice\x20Recording\x20not\x20found');}_0x5e1c16=_0x5bda87;return db[_0x8a85('0x81')][_0x8a85('0x80')]({'where':{'id':0x1}});})[_0x8a85('0x24')](handleEntityNotFound(_0x53f072,null))[_0x8a85('0x24')](function(_0x54b420){if(_0x54b420){_0x3c2526=_0x54b420;if(!_0x3c2526[_0x8a85('0x82')]||!_0x3c2526[_0x8a85('0x83')]||!_0x3c2526[_0x8a85('0x84')]||!_0x3c2526[_0x8a85('0x85')]||!_0x3c2526[_0x8a85('0x78')]){throw new db[(_0x8a85('0x56'))][(_0x8a85('0x57'))]('Transcribe\x20not\x20configured');}if(_0x353255['body'][_0x8a85('0x86')]&&(!_0x3c2526[_0x8a85('0x87')]||!_0x3c2526[_0x8a85('0x88')]||!_0x3c2526[_0x8a85('0x89')]||!_0x3c2526['language']||!_0x3c2526[_0x8a85('0x78')])){throw new db[(_0x8a85('0x56'))][(_0x8a85('0x57'))](_0x8a85('0x8a'));}return db[_0x8a85('0x8b')]['findOne']({'where':{'id':_0x3c2526[_0x8a85('0x83')]}});}})[_0x8a85('0x24')](function(_0x4b243e){if(!_0x4b243e){throw new db['Sequelize']['ValidationError'](_0x8a85('0x8c'));}if(!_0x4b243e[_0x8a85('0x8d')]||!_0x4b243e[_0x8a85('0x8e')]){throw new db[(_0x8a85('0x56'))][(_0x8a85('0x57'))](_0x8a85('0x8f'));}_0x4a621f=_0x4b243e;return getBucketslist(_0x4a621f['data1'],_0x4a621f[_0x8a85('0x8e')],_0x3c2526[_0x8a85('0x84')]);})[_0x8a85('0x24')](function(_0x43248a){if(_0x43248a&&_0x43248a[_0x8a85('0x90')]){var _0x3aabb4=_[_0x8a85('0x4d')](_0x43248a[_0x8a85('0x90')],function(_0x40c535){return _0x40c535[_0x8a85('0x91')]===_0x3c2526['bucket'];});if(!_0x3aabb4){logger[_0x8a85('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x353255[_0x8a85('0x47')]['id'],_0x3c2526[_0x8a85('0x78')]));return createBucket(_0x4a621f['data1'],_0x4a621f[_0x8a85('0x8e')],_0x3c2526['transcribeRegion'],_0x3c2526[_0x8a85('0x78')]);}logger['info'](util[_0x8a85('0x33')](_0x8a85('0x92'),_0x353255[_0x8a85('0x47')]['id'],_0x3c2526[_0x8a85('0x78')]));return;}})[_0x8a85('0x24')](function(_0x5dcff5){if(_0x5e1c16[_0x8a85('0x93')]===_0x8a85('0x94')){return transcribe(_0x353255['params']['id'],_0x4a621f[_0x8a85('0x8d')],_0x4a621f[_0x8a85('0x8e')],_0x3c2526[_0x8a85('0x84')],_0x3c2526[_0x8a85('0x78')],_0x5e1c16['value'],_0x3c2526['language']);}else{logger[_0x8a85('0x68')](util[_0x8a85('0x33')](_0x8a85('0x95'),_0x353255[_0x8a85('0x47')]['id']));return{'transcribeStatus':_0x8a85('0x96')};}})[_0x8a85('0x24')](function(_0x4e84e4){if(_0x4e84e4){_0x4e84e4['tempSentiment']=_0x353255[_0x8a85('0x4c')][_0x8a85('0x86')];return _0x5e1c16[_0x8a85('0x97')](_0x4e84e4);}})[_0x8a85('0x24')](respondWithResult(_0x53f072,null))[_0x8a85('0x49')](handleError(_0x53f072,null));};function writeFile(_0x2a681c,_0x10a4f7){return new Promise(function(_0x4b0a82,_0x40e8d9){fs[_0x8a85('0x98')](_0x10a4f7,_0x2a681c,function(_0x4473ad,_0x539a78){if(_0x4473ad){return _0x40e8d9(_0x4473ad);}else{return _0x4b0a82(_0x539a78);}});});}exports['downloadTranscribe']=function(_0x583a6c,_0x4c607d,_0xcc375b){return db[_0x8a85('0x2d')][_0x8a85('0x80')]({'where':{'id':_0x583a6c[_0x8a85('0x47')]['id']}})[_0x8a85('0x24')](handleEntityNotFound(_0x4c607d))['then'](function(_0x3fa0ec){if(_0x3fa0ec&&_0x3fa0ec[_0x8a85('0x99')]){var _0x31e2e5=_0x3fa0ec[_0x8a85('0x99')];var _0x4f7b54=config[_0x8a85('0x9a')]+_0x8a85('0x9b')+_0x3fa0ec['id']+_0x8a85('0x9c');if(fs[_0x8a85('0x54')](_0x4f7b54)){return _0x4f7b54;}return writeFile(_0x31e2e5,_0x4f7b54)[_0x8a85('0x24')](function(){return _0x4f7b54;});}else{throw new db['Sequelize'][(_0x8a85('0x57'))](_0x8a85('0x9d'));}})[_0x8a85('0x24')](function(_0x2f3603){return _0x4c607d['download'](_0x2f3603);})['catch'](handleError(_0x4c607d));}; \ No newline at end of file +var _0xac8e=['root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','index','map','VoiceRecording','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','unlink','VoiceRecording\x20not\x20found','sequelize','MD5','col','$and','push','extname','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','listBuckets','createBucket','upload','startTranscriptionJob','readFileSync','Location','bucket','Bucket','location','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','runSentiment','sentimentRegion','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText'];(function(_0x2ff28d,_0x5d4d8a){var _0x5efbd9=function(_0x1118fc){while(--_0x1118fc){_0x2ff28d['push'](_0x2ff28d['shift']());}};_0x5efbd9(++_0x5d4d8a);}(_0xac8e,0x12a));var _0xeac8=function(_0x40ad4d,_0x35a2d4){_0x40ad4d=_0x40ad4d-0x0;var _0x425a49=_0xac8e[_0x40ad4d];return _0x425a49;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeac8('0x0'));var jsonpatch=require(_0xeac8('0x1'));var rp=require(_0xeac8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeac8('0x3'));var util=require(_0xeac8('0x4'));var path=require(_0xeac8('0x5'));var sox=require(_0xeac8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeac8('0x7'));var _=require('lodash');var squel=require(_0xeac8('0x8'));var crypto=require(_0xeac8('0x9'));var jsforce=require(_0xeac8('0xa'));var deskjs=require(_0xeac8('0xb'));var toCsv=require('to-csv');var querystring=require(_0xeac8('0xc'));var Papa=require(_0xeac8('0xd'));var AWS=require(_0xeac8('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0xeac8('0xf'));var authService=require(_0xeac8('0x10'));var qs=require(_0xeac8('0x11'));var as=require(_0xeac8('0x12'));var hardwareService=require(_0xeac8('0x13'));var logger=require(_0xeac8('0x14'))(_0xeac8('0x15'));var utils=require(_0xeac8('0x16'));var config=require(_0xeac8('0x17'));var licenseUtil=require(_0xeac8('0x18'));var db=require(_0xeac8('0x19'))['db'];function respondWithStatusCode(_0x65543b,_0x122f53){_0x122f53=_0x122f53||0xcc;return function(_0x1b2ae8){if(_0x1b2ae8){return _0x65543b['sendStatus'](_0x122f53);}return _0x65543b[_0xeac8('0x1a')](_0x122f53)[_0xeac8('0x1b')]();};}function respondWithResult(_0x86ae8e,_0x11bab8){_0x11bab8=_0x11bab8||0xc8;return function(_0x25d013){if(_0x25d013){return _0x86ae8e[_0xeac8('0x1a')](_0x11bab8)[_0xeac8('0x1c')](_0x25d013);}};}function respondWithFilteredResult(_0x404dc0,_0x45b5f1){return function(_0x3620fe){if(_0x3620fe){var _0x5c3831=typeof _0x45b5f1[_0xeac8('0x1d')]==='undefined'&&typeof _0x45b5f1['limit']===_0xeac8('0x1e');var _0x5b9db9=_0x3620fe['count'];var _0x24a889=_0x5c3831?0x0:_0x45b5f1['offset'];var _0x110053=_0x5c3831?_0x3620fe[_0xeac8('0x1f')]:_0x45b5f1['offset']+_0x45b5f1[_0xeac8('0x20')];var _0x2463f7;if(_0x110053>=_0x5b9db9){_0x110053=_0x5b9db9;_0x2463f7=0xc8;}else{_0x2463f7=0xce;}_0x404dc0[_0xeac8('0x1a')](_0x2463f7);return _0x404dc0[_0xeac8('0x21')](_0xeac8('0x22'),_0x24a889+'-'+_0x110053+'/'+_0x5b9db9)[_0xeac8('0x1c')](_0x3620fe);}return null;};}function patchUpdates(_0xb0e5b9){return function(_0xde9e18){try{jsonpatch['apply'](_0xde9e18,_0xb0e5b9,!![]);}catch(_0x4700a9){return BPromise[_0xeac8('0x23')](_0x4700a9);}return _0xde9e18[_0xeac8('0x24')]();};}function saveUpdates(_0x58f60f,_0x403a9e){return function(_0x5b73f0){if(_0x5b73f0){return _0x5b73f0[_0xeac8('0x25')](_0x58f60f)['then'](function(_0x5f3bda){return _0x5f3bda;});}return null;};}function removeEntity(_0x1f5c49,_0x44318c){return function(_0x57188a){if(_0x57188a){return _0x57188a['destroy']()[_0xeac8('0x26')](function(){_0x1f5c49[_0xeac8('0x1a')](0xcc)[_0xeac8('0x1b')]();});}};}function handleEntityNotFound(_0x3c188d,_0xb9cd7e){return function(_0x2fc733){if(!_0x2fc733){_0x3c188d[_0xeac8('0x27')](0x194);}return _0x2fc733;};}function handleError(_0x48360a,_0x4acc79){_0x4acc79=_0x4acc79||0x1f4;return function(_0x516591){logger[_0xeac8('0x28')](_0x516591[_0xeac8('0x29')]);if(_0x516591['name']){delete _0x516591[_0xeac8('0x2a')];}_0x48360a[_0xeac8('0x1a')](_0x4acc79)['send'](_0x516591);};}exports[_0xeac8('0x2b')]=function(_0x2383d5,_0x250449){var _0x428fda={},_0x2c971b={},_0x2251a8={'count':0x0,'rows':[]};var _0x33cc03=_[_0xeac8('0x2c')](db[_0xeac8('0x2d')]['rawAttributes'],function(_0x340c3a){return{'name':_0x340c3a[_0xeac8('0x2e')],'type':_0x340c3a[_0xeac8('0x2f')][_0xeac8('0x30')]};});_0x2c971b[_0xeac8('0x31')]=_['differenceBy'](_[_0xeac8('0x2c')](_0x33cc03,_0xeac8('0x2a')),[_0xeac8('0x32')]);_0x2c971b[_0xeac8('0x33')]=_[_0xeac8('0x34')](_0x2383d5[_0xeac8('0x33')]);_0x2c971b['filters']=_[_0xeac8('0x35')](_0x2c971b['model'],_0x2c971b['query']);_0x428fda['attributes']=_[_0xeac8('0x35')](_0x2c971b[_0xeac8('0x31')],qs[_0xeac8('0x36')](_0x2383d5[_0xeac8('0x33')][_0xeac8('0x36')]));_0x428fda[_0xeac8('0x37')]=_0x428fda[_0xeac8('0x37')][_0xeac8('0x38')]?_0x428fda[_0xeac8('0x37')]:_0x2c971b['model'];if(!_0x2383d5[_0xeac8('0x33')]['hasOwnProperty']('nolimit')){_0x428fda['limit']=qs[_0xeac8('0x20')](_0x2383d5[_0xeac8('0x33')][_0xeac8('0x20')]);_0x428fda['offset']=qs[_0xeac8('0x1d')](_0x2383d5[_0xeac8('0x33')]['offset']);}_0x428fda[_0xeac8('0x39')]=qs[_0xeac8('0x3a')](_0x2383d5[_0xeac8('0x33')][_0xeac8('0x3a')]);_0x428fda[_0xeac8('0x3b')]=qs['filters'](_[_0xeac8('0x3c')](_0x2383d5[_0xeac8('0x33')],_0x2c971b[_0xeac8('0x3d')]),_0x33cc03);if(_0x2383d5['query'][_0xeac8('0x3e')]){_0x428fda[_0xeac8('0x3b')]=_[_0xeac8('0x3f')](_0x428fda[_0xeac8('0x3b')],{'$or':_[_0xeac8('0x2c')](_0x33cc03,function(_0x571884){if(_0x571884[_0xeac8('0x2f')]!==_0xeac8('0x40')){var _0x1c567f={};_0x1c567f[_0x571884[_0xeac8('0x2a')]]={'$like':'%'+_0x2383d5['query'][_0xeac8('0x3e')]+'%'};return _0x1c567f;}})});}_0x428fda=_[_0xeac8('0x3f')]({},_0x428fda,_0x2383d5['options']);var _0x373039={'where':_0x428fda[_0xeac8('0x3b')]};return db[_0xeac8('0x2d')][_0xeac8('0x1f')](_0x373039)[_0xeac8('0x26')](function(_0x36face){_0x2251a8['count']=_0x36face;if(_0x2383d5[_0xeac8('0x33')][_0xeac8('0x41')]){_0x428fda[_0xeac8('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0xeac8('0x43')](_0x428fda);})['then'](function(_0x5b0ebe){_0x2251a8[_0xeac8('0x44')]=_0x5b0ebe;return _0x2251a8;})[_0xeac8('0x26')](respondWithFilteredResult(_0x250449,_0x428fda))[_0xeac8('0x45')](handleError(_0x250449,null));};exports['show']=function(_0x42d7bb,_0x32ef1f){var _0x5a628d={'raw':![],'where':{'id':_0x42d7bb[_0xeac8('0x46')]['id']}},_0x937de6={};_0x937de6[_0xeac8('0x31')]=_['keys'](db[_0xeac8('0x2d')][_0xeac8('0x47')]);_0x937de6['query']=_[_0xeac8('0x34')](_0x42d7bb[_0xeac8('0x33')]);_0x937de6['filters']=_[_0xeac8('0x35')](_0x937de6['model'],_0x937de6[_0xeac8('0x33')]);_0x5a628d['attributes']=_['intersection'](_0x937de6[_0xeac8('0x31')],qs[_0xeac8('0x36')](_0x42d7bb[_0xeac8('0x33')][_0xeac8('0x36')]));_0x5a628d[_0xeac8('0x37')]=_0x5a628d[_0xeac8('0x37')]['length']?_0x5a628d['attributes']:_0x937de6[_0xeac8('0x31')];if(_0x42d7bb['query'][_0xeac8('0x41')]){_0x5a628d['include']=[{'all':!![]}];}_0x5a628d=_[_0xeac8('0x3f')]({},_0x5a628d,_0x42d7bb[_0xeac8('0x48')]);return db['VoiceRecording'][_0xeac8('0x49')](_0x5a628d)[_0xeac8('0x26')](handleEntityNotFound(_0x32ef1f,null))['then'](respondWithResult(_0x32ef1f,null))[_0xeac8('0x45')](handleError(_0x32ef1f,null));};exports[_0xeac8('0x4a')]=function(_0x2f5fd6,_0x28eabe){return db['VoiceRecording'][_0xeac8('0x4a')](_0x2f5fd6[_0xeac8('0x4b')],{})['then'](respondWithResult(_0x28eabe,0xc9))[_0xeac8('0x45')](handleError(_0x28eabe,null));};exports['update']=function(_0x5740f1,_0x4a43fa){if(_0x5740f1[_0xeac8('0x4b')]['id']){delete _0x5740f1['body']['id'];}return db[_0xeac8('0x2d')]['find']({'where':{'id':_0x5740f1[_0xeac8('0x46')]['id']}})[_0xeac8('0x26')](handleEntityNotFound(_0x4a43fa,null))[_0xeac8('0x26')](saveUpdates(_0x5740f1[_0xeac8('0x4b')],null))[_0xeac8('0x26')](respondWithResult(_0x4a43fa,null))[_0xeac8('0x45')](handleError(_0x4a43fa,null));};exports[_0xeac8('0x4c')]=function(_0x4917f5,_0x1ffc92){return db['VoiceRecording']['describe']()[_0xeac8('0x26')](respondWithResult(_0x1ffc92,null))[_0xeac8('0x45')](handleError(_0x1ffc92,null));};exports[_0xeac8('0x4d')]=function(_0x2c460b,_0x18e6b2,_0xf5b928){var _0x3bc574=require(_0xeac8('0x4e'));var _0x2235c4=![];var _0x3e48f8={};if(_0x2c460b[_0xeac8('0x33')][_0xeac8('0x2f')]&&_0x2c460b[_0xeac8('0x33')][_0xeac8('0x2f')]===_0xeac8('0x4f')){_0x3e48f8[_0xeac8('0x4f')]=_0x2c460b[_0xeac8('0x46')]['id'];}else{_0x3e48f8['id']=_0x2c460b[_0xeac8('0x46')]['id'];}return db[_0xeac8('0x2d')][_0xeac8('0x49')]({'where':_0x3e48f8,'attributes':['id','value'],'raw':!![]})[_0xeac8('0x26')](handleEntityNotFound(_0x18e6b2,null))[_0xeac8('0x26')](function(_0x2c016f){if(_0x2c016f){var _0x122b44=_0x2c016f[_0xeac8('0x50')];var _0x535c8e=util[_0xeac8('0x32')](_0xeac8('0x51'),_0x122b44);if(fs[_0xeac8('0x52')](_0x535c8e)){_0x2235c4=!![];return _0x3bc574[_0xeac8('0x53')](_0x535c8e,_0x122b44,config[_0xeac8('0x54')][_0xeac8('0x55')])['then'](function(){return _0x2c016f;});}return _0x2c016f;}})[_0xeac8('0x26')](function(_0x369da0){if(_0x369da0){var _0x226944=_0x369da0[_0xeac8('0x50')];if(!fs['existsSync'](_0x226944)){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x369da0[_0xeac8('0x58')]){return _0x18e6b2[_0xeac8('0x4d')](_0x226944,_0x369da0[_0xeac8('0x58')]+path['extname'](_0x226944),function(){if(_0x2235c4){fs[_0xeac8('0x59')](_0x226944);}});}else{return _0x18e6b2['download'](_0x226944,function(_0x43358b){if(_0x2235c4){fs[_0xeac8('0x59')](_0x226944);}});}}})[_0xeac8('0x45')](function(_0x5698c8){if(_0x5698c8['message']===_0xeac8('0x5a')){_0x18e6b2[_0xeac8('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x18e6b2,null);}});};exports['downloads']=function(_0x36f769,_0x12bfbf,_0x5ad0cd){var _0x1fe87a=require(_0xeac8('0x4e'));var _0x22e67c=![];var _0x43a316={'$and':[db[_0xeac8('0x5b')][_0xeac8('0x3b')](db[_0xeac8('0x5b')]['fn'](_0xeac8('0x5c'),db[_0xeac8('0x5b')][_0xeac8('0x5d')](_0xeac8('0x4f'))),_0x36f769[_0xeac8('0x33')]['token'])]};if(_0x36f769[_0xeac8('0x33')]['type']&&_0x36f769[_0xeac8('0x33')][_0xeac8('0x2f')]==='uniqueid'){_0x43a316[_0xeac8('0x5e')][_0xeac8('0x5f')]({'uniqueid':_0x36f769['params']['id']});}else{_0x43a316[_0xeac8('0x5e')][_0xeac8('0x5f')]({'id':_0x36f769[_0xeac8('0x46')]['id']});}return db['VoiceRecording'][_0xeac8('0x49')]({'where':_0x43a316,'attributes':['id',_0xeac8('0x50')],'raw':!![]})[_0xeac8('0x26')](handleEntityNotFound(_0x12bfbf,null))['then'](function(_0x17c73a){if(_0x17c73a){var _0x522991=util['format'](_0xeac8('0x51'),_0x17c73a['value']);if(fs[_0xeac8('0x52')](_0x522991)){_0x22e67c=!![];return _0x1fe87a[_0xeac8('0x53')](_0x522991,_0x17c73a[_0xeac8('0x50')],config['secrets']['recording'])['then'](function(){return _0x17c73a;});}return _0x17c73a;}})[_0xeac8('0x26')](function(_0x6e8c64){if(_0x6e8c64){if(!fs[_0xeac8('0x52')](_0x6e8c64[_0xeac8('0x50')])){throw new db['Sequelize'][(_0xeac8('0x57'))](_0xeac8('0x5a'));}if(_0x6e8c64[_0xeac8('0x58')]){return _0x12bfbf[_0xeac8('0x4d')](_0x6e8c64[_0xeac8('0x50')],_0x6e8c64[_0xeac8('0x58')]+path[_0xeac8('0x60')](_0x6e8c64[_0xeac8('0x50')]),function(){if(_0x22e67c){fs[_0xeac8('0x59')](_0x6e8c64[_0xeac8('0x50')]);}});}else{return _0x12bfbf[_0xeac8('0x4d')](_0x6e8c64[_0xeac8('0x50')],function(_0x281fd9){if(_0x22e67c){fs[_0xeac8('0x59')](_0x6e8c64[_0xeac8('0x50')]);}});}}})[_0xeac8('0x45')](handleError(_0x12bfbf,null));};exports[_0xeac8('0x61')]=function(_0x1a4194,_0x5c671e){return db[_0xeac8('0x2d')][_0xeac8('0x49')]({'where':{'id':_0x1a4194[_0xeac8('0x46')]['id']}})[_0xeac8('0x26')](function(_0x401f28){if(_['isNil'](_0x401f28)){throw new ReferenceError(_0xeac8('0x62'));}return _0x401f28;})[_0xeac8('0x26')](function(_0x238111){var _0x1990df=_0x238111[_0xeac8('0x50')];logger['info'](_0xeac8('0x63'),_0x1990df);if(!_[_0xeac8('0x64')](_0x238111[_0xeac8('0x50')])&&fs[_0xeac8('0x52')](_0x1990df)){logger['info'](_0xeac8('0x65')+_0x1990df+_0xeac8('0x66'));fs[_0xeac8('0x67')](_0x1990df);}_0x1990df=_0x1990df+_0xeac8('0x68');if(!_[_0xeac8('0x64')](_0x238111['value'])&&fs[_0xeac8('0x52')](_0x1990df)){logger[_0xeac8('0x69')](_0xeac8('0x65')+_0x1990df+_0xeac8('0x66'));fs[_0xeac8('0x67')](_0x1990df);}return _0x238111;})[_0xeac8('0x26')](function(_0x5ac605){if(!_0x5ac605)throw new InternalError();return _0x5ac605[_0xeac8('0x61')]();})[_0xeac8('0x26')](function(){_0x5c671e['status'](0xcc)[_0xeac8('0x1b')]();})[_0xeac8('0x45')](handleError(_0x5c671e,null));};function getBucketslist(_0x3ecfb8,_0x38391e,_0x2b65ef){return new Promise(function(_0x4d5389,_0x2e4413){var _0xe4c420=new AWS['S3']({'accessKeyId':_0x38391e,'secretAccessKey':_0x3ecfb8,'region':_0x2b65ef});_0xe4c420[_0xeac8('0x6a')]({},function(_0x55cca3,_0xf12a19){if(_0x55cca3){return _0x2e4413(_0x55cca3);}else{return _0x4d5389(_0xf12a19);}});});}function createBucket(_0x1c8da8,_0x18f295,_0x5b5a01,_0x377e5b){return new Promise(function(_0x7310d7,_0x1b8207){var _0x2fe5e3=new AWS['S3']({'accessKeyId':_0x18f295,'secretAccessKey':_0x1c8da8,'region':_0x5b5a01});_0x2fe5e3[_0xeac8('0x6b')]({'Bucket':_0x377e5b},function(_0xa6a27c,_0x1a607a){if(_0xa6a27c){return _0x1b8207(_0xa6a27c);}else{return _0x7310d7(_0x1a607a);}});});}function uploadFile(_0x2082f1,_0x414d99,_0x1b60f6,_0x5496a7,_0x1e1559,_0x41a5b0){return new Promise(function(_0x2e3bd7,_0x3b4a8b){var _0x30e6c2=new AWS['S3']({'accessKeyId':_0x414d99,'secretAccessKey':_0x2082f1,'region':_0x1b60f6});_0x30e6c2[_0xeac8('0x6c')]({'Bucket':_0x5496a7,'Key':_0x1e1559,'Body':_0x41a5b0},function(_0x350fad,_0x382a08){if(_0x350fad){return _0x3b4a8b(_0x350fad);}else{return _0x2e3bd7(_0x382a08);}});});}function startTranscribe(_0x45cd3a,_0x5f12d0,_0x16713e,_0x303ab0,_0x52360c,_0x4adbff){return new Promise(function(_0x57f18b,_0x475836){var _0x3bd13b=new AWS['TranscribeService']({'accessKeyId':_0x5f12d0,'secretAccessKey':_0x45cd3a,'region':_0x16713e});_0x3bd13b[_0xeac8('0x6d')]({'TranscriptionJobName':_0x303ab0,'LanguageCode':_0x52360c,'Media':{'MediaFileUri':_0x4adbff}},function(_0x498ce3,_0x33dd94){if(_0x498ce3){return _0x475836(_0x498ce3);}else{return _0x57f18b(_0x33dd94);}});});}function transcribe(_0x4c9fcc,_0x539e3d,_0x32fdba,_0x133b6b,_0x3dab36,_0x28b412,_0x17d83d){return new Promise(function(_0x30aead,_0x1feaf3){var _0x34704f={};logger['info'](util[_0xeac8('0x32')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4c9fcc,_0x3dab36));return uploadFile(_0x539e3d,_0x32fdba,_0x133b6b,_0x3dab36,path['basename'](_0x28b412),fs[_0xeac8('0x6e')](_0x28b412))[_0xeac8('0x26')](function(_0x481104){logger[_0xeac8('0x69')](util[_0xeac8('0x32')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x4c9fcc,_0x3dab36,_0x481104[_0xeac8('0x6f')]));_0x34704f[_0xeac8('0x70')]=_0x481104[_0xeac8('0x71')];_0x34704f[_0xeac8('0x72')]=_0x481104[_0xeac8('0x6f')];logger[_0xeac8('0x69')](util[_0xeac8('0x32')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x4c9fcc));return startTranscribe(_0x539e3d,_0x32fdba,_0x133b6b,uuidv4(),_0x17d83d,_0x481104['Location']);})[_0xeac8('0x26')](function(_0x3247a6){logger['info'](util[_0xeac8('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4c9fcc,_0x3247a6[_0xeac8('0x73')][_0xeac8('0x74')]));_0x34704f['transcribeName']=_0x3247a6['TranscriptionJob'][_0xeac8('0x74')];_0x34704f[_0xeac8('0x75')]=_0x3247a6['TranscriptionJob'][_0xeac8('0x76')];return _0x30aead(_0x34704f);})[_0xeac8('0x45')](function(_0x9bdb70){return _0x1feaf3(_0x9bdb70);});});}exports['runTranscribe']=function(_0x149c61,_0x4f98be,_0x5c2a51){var _0x211edb;var _0x13ad24;var _0xb63972;var _0x3c07c0=require('../../components/encryptor');return db['VoiceRecording'][_0xeac8('0x77')]({'where':{'id':_0x149c61[_0xeac8('0x46')]['id']}})['then'](function(_0x1c3521){if(_0x1c3521){var _0x362d64=util[_0xeac8('0x32')]('%s.cypher',_0x1c3521[_0xeac8('0x50')]);if(fs[_0xeac8('0x52')](_0x362d64)){cypher=!![];return _0x3c07c0[_0xeac8('0x53')](_0x362d64,_0x1c3521['value'],config[_0xeac8('0x54')][_0xeac8('0x55')])[_0xeac8('0x26')](function(){return _0x1c3521;});}return _0x1c3521;}})[_0xeac8('0x26')](function(_0x1b7a77){if(!_0x1b7a77){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))](_0xeac8('0x78'));}_0x13ad24=_0x1b7a77;return db[_0xeac8('0x79')][_0xeac8('0x77')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4f98be,null))['then'](function(_0x25b7da){if(_0x25b7da){_0x211edb=_0x25b7da;if(!_0x211edb[_0xeac8('0x7a')]||!_0x211edb[_0xeac8('0x7b')]||!_0x211edb[_0xeac8('0x7c')]||!_0x211edb['language']||!_0x211edb['bucket']){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))]('Transcribe\x20not\x20configured');}if(_0x149c61['body'][_0xeac8('0x7d')]&&(!_0x211edb['sentiment']||!_0x211edb['sentimentAccountId']||!_0x211edb[_0xeac8('0x7e')]||!_0x211edb[_0xeac8('0x7f')]||!_0x211edb[_0xeac8('0x70')])){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xeac8('0x80')][_0xeac8('0x77')]({'where':{'id':_0x211edb[_0xeac8('0x7b')]}});}})[_0xeac8('0x26')](function(_0x3bb7e2){if(!_0x3bb7e2){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))](_0xeac8('0x81'));}if(!_0x3bb7e2[_0xeac8('0x82')]||!_0x3bb7e2[_0xeac8('0x83')]){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))](_0xeac8('0x84'));}_0xb63972=_0x3bb7e2;return getBucketslist(_0xb63972['data1'],_0xb63972[_0xeac8('0x83')],_0x211edb[_0xeac8('0x7c')]);})[_0xeac8('0x26')](function(_0x50c12d){if(_0x50c12d&&_0x50c12d[_0xeac8('0x85')]){var _0x41132e=_[_0xeac8('0x49')](_0x50c12d[_0xeac8('0x85')],function(_0xf57458){return _0xf57458[_0xeac8('0x86')]===_0x211edb['bucket'];});if(!_0x41132e){logger[_0xeac8('0x69')](util['format'](_0xeac8('0x87'),_0x149c61[_0xeac8('0x46')]['id'],_0x211edb[_0xeac8('0x70')]));return createBucket(_0xb63972[_0xeac8('0x82')],_0xb63972['data2'],_0x211edb[_0xeac8('0x7c')],_0x211edb[_0xeac8('0x70')]);}logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x149c61[_0xeac8('0x46')]['id'],_0x211edb[_0xeac8('0x70')]));return;}})[_0xeac8('0x26')](function(_0x8a8020){if(_0x13ad24[_0xeac8('0x75')]===_0xeac8('0x88')){return transcribe(_0x149c61[_0xeac8('0x46')]['id'],_0xb63972[_0xeac8('0x82')],_0xb63972[_0xeac8('0x83')],_0x211edb[_0xeac8('0x7c')],_0x211edb[_0xeac8('0x70')],_0x13ad24[_0xeac8('0x50')],_0x211edb[_0xeac8('0x7f')]);}else{logger['info'](util['format'](_0xeac8('0x89'),_0x149c61['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xeac8('0x26')](function(_0xb6e498){if(_0xb6e498){_0xb6e498[_0xeac8('0x8a')]=_0x149c61[_0xeac8('0x4b')][_0xeac8('0x7d')];return _0x13ad24[_0xeac8('0x8b')](_0xb6e498);}})[_0xeac8('0x26')](respondWithResult(_0x4f98be,null))[_0xeac8('0x45')](handleError(_0x4f98be,null));};function writeFile(_0x48c998,_0x370445){return new Promise(function(_0x5cfddb,_0x27a4f4){fs[_0xeac8('0x8c')](_0x370445,_0x48c998,function(_0x19e2b7,_0xaaf33e){if(_0x19e2b7){return _0x27a4f4(_0x19e2b7);}else{return _0x5cfddb(_0xaaf33e);}});});}exports[_0xeac8('0x8d')]=function(_0x2b693e,_0x4f6a56,_0x1c31dc){return db[_0xeac8('0x2d')][_0xeac8('0x77')]({'where':{'id':_0x2b693e['params']['id']}})[_0xeac8('0x26')](handleEntityNotFound(_0x4f6a56))['then'](function(_0x45aab0){if(_0x45aab0&&_0x45aab0[_0xeac8('0x8e')]){var _0x27e119=_0x45aab0[_0xeac8('0x8e')];var _0x3fc12c=config[_0xeac8('0x8f')]+_0xeac8('0x90')+_0x45aab0['id']+_0xeac8('0x91');if(fs['existsSync'](_0x3fc12c)){return _0x3fc12c;}return writeFile(_0x27e119,_0x3fc12c)[_0xeac8('0x26')](function(){return _0x3fc12c;});}else{throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))](_0xeac8('0x92'));}})[_0xeac8('0x26')](function(_0x1fd99f){return _0x4f6a56[_0xeac8('0x4d')](_0x1fd99f);})[_0xeac8('0x45')](handleError(_0x4f6a56));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index a14ae26..ee69150 100644 --- a/server/api/voiceRecording/voiceRecording.model.js +++ b/server/api/voiceRecording/voiceRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6200=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x6200,0x192));var _0x0620=function(_0x48be76,_0x135a12){_0x48be76=_0x48be76-0x0;var _0x3d0732=_0x6200[_0x48be76];return _0x3d0732;};'use strict';var _=require(_0x0620('0x0'));var util=require(_0x0620('0x1'));var logger=require('../../config/logger')(_0x0620('0x2'));var moment=require('moment');var BPromise=require(_0x0620('0x3'));var rp=require(_0x0620('0x4'));var fs=require('fs');var path=require(_0x0620('0x5'));var rimraf=require(_0x0620('0x6'));var config=require(_0x0620('0x7'));var attributes=require('./voiceRecording.attributes');module[_0x0620('0x8')]=function(_0x321ba9,_0x4f86a9){return _0x321ba9[_0x0620('0x9')](_0x0620('0xa'),attributes,{'tableName':_0x0620('0xb'),'paranoid':![],'indexes':[{'name':_0x0620('0xc'),'fields':[_0x0620('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd21d=['define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x4cbb31,_0xc6e39e){var _0x5ef9d0=function(_0x2e3bef){while(--_0x2e3bef){_0x4cbb31['push'](_0x4cbb31['shift']());}};_0x5ef9d0(++_0xc6e39e);}(_0xd21d,0x14e));var _0xdd21=function(_0x473a79,_0x5e608b){_0x473a79=_0x473a79-0x0;var _0x5a91b3=_0xd21d[_0x473a79];return _0x5a91b3;};'use strict';var _=require('lodash');var util=require(_0xdd21('0x0'));var logger=require(_0xdd21('0x1'))(_0xdd21('0x2'));var moment=require(_0xdd21('0x3'));var BPromise=require(_0xdd21('0x4'));var rp=require(_0xdd21('0x5'));var fs=require('fs');var path=require(_0xdd21('0x6'));var rimraf=require(_0xdd21('0x7'));var config=require(_0xdd21('0x8'));var attributes=require(_0xdd21('0x9'));module[_0xdd21('0xa')]=function(_0x1791e6,_0x55c2fc){return _0x1791e6[_0xdd21('0xb')](_0xdd21('0xc'),attributes,{'tableName':_0xdd21('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdd21('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c14e0d2..ca00b92 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','UpdateVoiceRecording','update','body','options','raw','where','limit','../../components/encryptor','Setting','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording'];(function(_0x5c79a3,_0x21e507){var _0x3236f1=function(_0x2ef64d){while(--_0x2ef64d){_0x5c79a3['push'](_0x5c79a3['shift']());}};_0x3236f1(++_0x21e507);}(_0x2542,0x169));var _0x2254=function(_0xcfe710,_0xad10f0){_0xcfe710=_0xcfe710-0x0;var _0x4108ca=_0x2542[_0xcfe710];return _0x4108ca;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});}exports[_0x2254('0x16')]=function(_0x1ae11e){var _0x34f90e=this;return new Promise(function(_0x497724,_0x51b395){return db['VoiceRecording'][_0x2254('0x17')](_0x1ae11e[_0x2254('0x18')],{'raw':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e[_0x2254('0x19')][_0x2254('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e['options'][_0x2254('0x1b')]||null:null,'attributes':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e[_0x2254('0x19')]['attributes']||null:null,'limit':_0x1ae11e['options']?_0x1ae11e['options'][_0x2254('0x1c')]||null:null})[_0x2254('0xc')](function(_0xf88b56){logger['info']('UpdateVoiceRecording',_0x1ae11e);logger['debug']('UpdateVoiceRecording',_0x1ae11e,JSON['stringify'](_0xf88b56));_0x497724(_0xf88b56);})['catch'](function(_0x1aa71f){logger[_0x2254('0x14')](_0x2254('0x16'),_0x1aa71f[_0x2254('0x15')],_0x1ae11e);_0x51b395(_0x34f90e[_0x2254('0x14')](0x1f4,_0x1aa71f[_0x2254('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x4a8274){var _0x1ada42=this;return new Promise(function(_0x4f6877,_0x35608a){var _0x141dc5=require(_0x2254('0x1d'));var _0x3aa0bd;return db[_0x2254('0x1e')]['findOne']({'attributes':['id',_0x2254('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x2254('0xc')](function(_0x21285d){_0x3aa0bd=_0x21285d;return db[_0x2254('0x20')][_0x2254('0x21')](_0x4a8274[_0x2254('0x18')]);})[_0x2254('0xc')](function(_0x22e791){if(_0x3aa0bd[_0x2254('0x1f')]&&fs[_0x2254('0x22')](_0x22e791[_0x2254('0x23')])){var _0xad7774=util[_0x2254('0x24')](_0x2254('0x25'),_0x22e791[_0x2254('0x23')]);return _0x141dc5[_0x2254('0x26')](_0x22e791[_0x2254('0x23')],_0xad7774,config[_0x2254('0x27')][_0x2254('0x28')])['then'](function(){fs[_0x2254('0x29')](_0x22e791[_0x2254('0x23')]);logger[_0x2254('0xd')](_0x2254('0x2a'));return _0x22e791;});}return _0x22e791;})[_0x2254('0xc')](function(_0x1d275b){logger[_0x2254('0xd')](_0x2254('0x2b'),_0x4a8274);logger[_0x2254('0xf')]('CreateVoiceRecording',_0x4a8274,JSON[_0x2254('0x12')](_0x1d275b));_0x4f6877(_0x1d275b);})[_0x2254('0x2c')](function(_0x503540){logger[_0x2254('0x14')](_0x2254('0x2b'),_0x503540[_0x2254('0x15')],_0x4a8274);_0x35608a(_0x1ada42[_0x2254('0x14')](0x1f4,_0x503540['message']));});});}; \ No newline at end of file +var _0x6a55=['callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateVoiceRecording','update','body','options','where','limit','findOne'];(function(_0xcfc932,_0x4c9861){var _0x6839da=function(_0x3d9afe){while(--_0x3d9afe){_0xcfc932['push'](_0xcfc932['shift']());}};_0x6839da(++_0x4c9861);}(_0x6a55,0xdb));var _0x56a5=function(_0x57fc2a,_0x14bbe5){_0x57fc2a=_0x57fc2a-0x0;var _0xa839b=_0x6a55[_0x57fc2a];return _0xa839b;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x56a5('0x2'));var logger=require('../../config/logger')(_0x56a5('0x3'));var config=require('../../config/environment');var jayson=require(_0x56a5('0x4'));var client=jayson[_0x56a5('0x5')][_0x56a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x293ea1,_0x444c65,_0x2272d9){return new BPromise(function(_0x2b8f57,_0x387dcb){return client['request'](_0x293ea1,_0x2272d9)[_0x56a5('0x7')](function(_0xf15490){logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,_0x56a5('0xa'));logger[_0x56a5('0xb')](_0x56a5('0xc'),_0x444c65,_0x56a5('0xa'),JSON[_0x56a5('0xd')](_0xf15490));if(_0xf15490['error']){if(_0xf15490['error'][_0x56a5('0xe')]===0x1f4){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x387dcb(_0xf15490[_0x56a5('0xf')]['message']);}logger['error'](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x2b8f57(_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);}else{logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,'request\x20sent');_0x2b8f57(_0xf15490[_0x56a5('0x11')]['message']);}})[_0x56a5('0x12')](function(_0x51d031){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0x51d031);_0x387dcb(_0x51d031);});});}exports[_0x56a5('0x13')]=function(_0x28fe74){var _0x1ba472=this;return new Promise(function(_0x143f3d,_0x1dddec){return db['VoiceRecording'][_0x56a5('0x14')](_0x28fe74[_0x56a5('0x15')],{'raw':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x17')]||null:null,'attributes':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['attributes']||null:null,'limit':_0x28fe74['options']?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x18')]||null:null})['then'](function(_0x1556eb){logger[_0x56a5('0x8')](_0x56a5('0x13'),_0x28fe74);logger[_0x56a5('0xb')](_0x56a5('0x13'),_0x28fe74,JSON[_0x56a5('0xd')](_0x1556eb));_0x143f3d(_0x1556eb);})[_0x56a5('0x12')](function(_0x8431df){logger[_0x56a5('0xf')](_0x56a5('0x13'),_0x8431df[_0x56a5('0x10')],_0x28fe74);_0x1dddec(_0x1ba472[_0x56a5('0xf')](0x1f4,_0x8431df[_0x56a5('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x5c76a7){var _0x2d8e68=this;return new Promise(function(_0x42cd45,_0x2706f9){var _0x43a815=require('../../components/encryptor');var _0x18e863;return db['Setting'][_0x56a5('0x19')]({'attributes':['id',_0x56a5('0x1a')],'where':{'id':0x1},'raw':!![]})[_0x56a5('0x7')](function(_0x284ee5){_0x18e863=_0x284ee5;return db['VoiceRecording'][_0x56a5('0x1b')](_0x5c76a7[_0x56a5('0x15')]);})[_0x56a5('0x7')](function(_0x51ef6f){if(_0x18e863[_0x56a5('0x1a')]&&fs[_0x56a5('0x1c')](_0x51ef6f[_0x56a5('0x1d')])){var _0x214649=util[_0x56a5('0x1e')]('%s.cypher',_0x51ef6f[_0x56a5('0x1d')]);return _0x43a815[_0x56a5('0x1f')](_0x51ef6f[_0x56a5('0x1d')],_0x214649,config[_0x56a5('0x20')][_0x56a5('0x21')])['then'](function(){fs['unlink'](_0x51ef6f[_0x56a5('0x1d')]);logger[_0x56a5('0x8')](_0x56a5('0x22'));return _0x51ef6f;});}return _0x51ef6f;})['then'](function(_0x1de021){logger[_0x56a5('0x8')]('CreateVoiceRecording',_0x5c76a7);logger['debug']('CreateVoiceRecording',_0x5c76a7,JSON['stringify'](_0x1de021));_0x42cd45(_0x1de021);})[_0x56a5('0x12')](function(_0x29c8f1){logger[_0x56a5('0xf')]('CreateVoiceRecording',_0x29c8f1[_0x56a5('0x10')],_0x5c76a7);_0x2706f9(_0x2d8e68['error'](0x1f4,_0x29c8f1[_0x56a5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 0442351..b087639 100644 --- a/server/api/voiceTransferReport/index.js +++ b/server/api/voiceTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfadd=['show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4b3583,_0x50a42b){var _0x4caee9=function(_0x1e763d){while(--_0x1e763d){_0x4b3583['push'](_0x4b3583['shift']());}};_0x4caee9(++_0x50a42b);}(_0xfadd,0x167));var _0xdfad=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfadd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xdfad('0x0'));var path=require(_0xdfad('0x1'));var timeout=require(_0xdfad('0x2'));var express=require(_0xdfad('0x3'));var router=express[_0xdfad('0x4')]();var fs_extra=require(_0xdfad('0x5'));var auth=require(_0xdfad('0x6'));var interaction=require(_0xdfad('0x7'));var config=require(_0xdfad('0x8'));var controller=require('./voiceTransferReport.controller');router[_0xdfad('0x9')]('/',auth[_0xdfad('0xa')](),controller[_0xdfad('0xb')]);router[_0xdfad('0x9')](_0xdfad('0xc'),auth[_0xdfad('0xa')](),controller[_0xdfad('0xd')]);router[_0xdfad('0x9')](_0xdfad('0xe'),auth['isAuthenticated'](),controller[_0xdfad('0xf')]);router[_0xdfad('0x10')]('/',auth[_0xdfad('0xa')](),controller[_0xdfad('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdfad('0x12')]);router[_0xdfad('0x13')](_0xdfad('0xe'),auth['isAuthenticated'](),controller[_0xdfad('0x14')]);module[_0xdfad('0x15')]=router; \ No newline at end of file +var _0x361b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0xaee3c3,_0x4d1e48){var _0x2cf888=function(_0x80d163){while(--_0x80d163){_0xaee3c3['push'](_0xaee3c3['shift']());}};_0x2cf888(++_0x4d1e48);}(_0x361b,0x15d));var _0xb361=function(_0xbb782b,_0x677675){_0xbb782b=_0xbb782b-0x0;var _0x4778d7=_0x361b[_0xbb782b];return _0x4778d7;};'use strict';var multer=require(_0xb361('0x0'));var util=require(_0xb361('0x1'));var path=require('path');var timeout=require(_0xb361('0x2'));var express=require(_0xb361('0x3'));var router=express[_0xb361('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb361('0x5'));var interaction=require(_0xb361('0x6'));var config=require(_0xb361('0x7'));var controller=require(_0xb361('0x8'));router[_0xb361('0x9')]('/',auth[_0xb361('0xa')](),controller[_0xb361('0xb')]);router[_0xb361('0x9')](_0xb361('0xc'),auth[_0xb361('0xa')](),controller['describe']);router[_0xb361('0x9')](_0xb361('0xd'),auth[_0xb361('0xa')](),controller[_0xb361('0xe')]);router[_0xb361('0xf')]('/',auth[_0xb361('0xa')](),controller[_0xb361('0x10')]);router[_0xb361('0x11')]('/:id',auth[_0xb361('0xa')](),controller[_0xb361('0x12')]);router[_0xb361('0x13')](_0xb361('0xd'),auth[_0xb361('0xa')](),controller[_0xb361('0x14')]);module[_0xb361('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 377c41e..91afefe 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.attributes.js +++ b/server/api/voiceTransferReport/voiceTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c55=['ENUM','blind','attended','STRING','Yes','sequelize','moment','exports'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x7c55,0xfd));var _0x57c5=function(_0x5a8cb6,_0x5abd8f){_0x5a8cb6=_0x5a8cb6-0x0;var _0x53acf3=_0x7c55[_0x5a8cb6];return _0x53acf3;};'use strict';var Sequelize=require(_0x57c5('0x0'));var moment=require(_0x57c5('0x1'));module[_0x57c5('0x2')]={'type':{'type':Sequelize[_0x57c5('0x3')](_0x57c5('0x4'),_0x57c5('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x57c5('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x57c5('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x57c5('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x57c5('0x6')]},'transferercontext':{'type':Sequelize[_0x57c5('0x6')]},'transfererexten':{'type':Sequelize[_0x57c5('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x57c5('0x6')]},'transfereechannel':{'type':Sequelize[_0x57c5('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x57c5('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x57c5('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x57c5('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x57c5('0x6')]},'transfereecontext':{'type':Sequelize[_0x57c5('0x6')]},'transfereeexten':{'type':Sequelize[_0x57c5('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x57c5('0x6')]},'isexternal':{'type':Sequelize[_0x57c5('0x3')](_0x57c5('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x57c5('0x6')]}}; \ No newline at end of file +var _0x761a=['ENUM','moment','blind','attended','STRING'];(function(_0x5aa6bb,_0x2177d5){var _0x2bf5e0=function(_0x5e1f2d){while(--_0x5e1f2d){_0x5aa6bb['push'](_0x5aa6bb['shift']());}};_0x2bf5e0(++_0x2177d5);}(_0x761a,0xe2));var _0xa761=function(_0x2f2960,_0x3f334d){_0x2f2960=_0x2f2960-0x0;var _0x47951c=_0x761a[_0x2f2960];return _0x47951c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa761('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa761('0x1'),_0xa761('0x2'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xa761('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xa761('0x3')]},'transferercalleridname':{'type':Sequelize[_0xa761('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xa761('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xa761('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xa761('0x3')]},'transfereechannel':{'type':Sequelize[_0xa761('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xa761('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xa761('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xa761('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa761('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xa761('0x3')]},'transfereecontext':{'type':Sequelize[_0xa761('0x3')]},'transfereeexten':{'type':Sequelize[_0xa761('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xa761('0x4')]('Yes','No')},'context':{'type':Sequelize[_0xa761('0x3')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1ddbf61..17d98cb 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.controller.js +++ b/server/api/voiceTransferReport/voiceTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98d3=['jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','VIRTUAL','options','where','includeAll','include','findAll','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x98d3,0x89));var _0x398d=function(_0x4a8b9b,_0x21e4e1){_0x4a8b9b=_0x4a8b9b-0x0;var _0x1e50ca=_0x98d3[_0x4a8b9b];return _0x1e50ca;};'use strict';var emlformat=require(_0x398d('0x0'));var rimraf=require(_0x398d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x398d('0x2'));var moment=require(_0x398d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x398d('0x4'));var util=require(_0x398d('0x5'));var path=require('path');var sox=require(_0x398d('0x6'));var csv=require(_0x398d('0x7'));var ejs=require(_0x398d('0x8'));var fs=require('fs');var fs_extra=require(_0x398d('0x9'));var _=require(_0x398d('0xa'));var squel=require(_0x398d('0xb'));var crypto=require(_0x398d('0xc'));var jsforce=require(_0x398d('0xd'));var deskjs=require(_0x398d('0xe'));var toCsv=require(_0x398d('0x7'));var querystring=require(_0x398d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x398d('0x10'));var qs=require(_0x398d('0x11'));var as=require(_0x398d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x398d('0x13'))(_0x398d('0x14'));var utils=require('../../config/utils');var config=require(_0x398d('0x15'));var licenseUtil=require(_0x398d('0x16'));var db=require(_0x398d('0x17'))['db'];function respondWithStatusCode(_0x122f81,_0x3a8239){_0x3a8239=_0x3a8239||0xcc;return function(_0x4e20a0){if(_0x4e20a0){return _0x122f81[_0x398d('0x18')](_0x3a8239);}return _0x122f81[_0x398d('0x19')](_0x3a8239)[_0x398d('0x1a')]();};}function respondWithResult(_0xab19aa,_0xc16a17){_0xc16a17=_0xc16a17||0xc8;return function(_0x4e13f5){if(_0x4e13f5){return _0xab19aa[_0x398d('0x19')](_0xc16a17)[_0x398d('0x1b')](_0x4e13f5);}};}function respondWithFilteredResult(_0x2c38cf,_0x1817b4){return function(_0x25438c){if(_0x25438c){var _0x39627f=typeof _0x1817b4[_0x398d('0x1c')]===_0x398d('0x1d')&&typeof _0x1817b4['limit']===_0x398d('0x1d');var _0x3675e0=_0x25438c['count'];var _0x188eb5=_0x39627f?0x0:_0x1817b4[_0x398d('0x1c')];var _0x451dc2=_0x39627f?_0x25438c[_0x398d('0x1e')]:_0x1817b4[_0x398d('0x1c')]+_0x1817b4['limit'];var _0x560139;if(_0x451dc2>=_0x3675e0){_0x451dc2=_0x3675e0;_0x560139=0xc8;}else{_0x560139=0xce;}_0x2c38cf[_0x398d('0x19')](_0x560139);return _0x2c38cf[_0x398d('0x1f')](_0x398d('0x20'),_0x188eb5+'-'+_0x451dc2+'/'+_0x3675e0)[_0x398d('0x1b')](_0x25438c);}return null;};}function patchUpdates(_0x1c2d1c){return function(_0x4f515a){try{jsonpatch[_0x398d('0x21')](_0x4f515a,_0x1c2d1c,!![]);}catch(_0x129a0b){return BPromise['reject'](_0x129a0b);}return _0x4f515a['save']();};}function saveUpdates(_0x1c1b62,_0x4069d1){return function(_0x3c1658){if(_0x3c1658){return _0x3c1658[_0x398d('0x22')](_0x1c1b62)[_0x398d('0x23')](function(_0x333c08){return _0x333c08;});}return null;};}function removeEntity(_0x5057c4,_0x17baa0){return function(_0x237236){if(_0x237236){return _0x237236[_0x398d('0x24')]()[_0x398d('0x23')](function(){_0x5057c4[_0x398d('0x19')](0xcc)[_0x398d('0x1a')]();});}};}function handleEntityNotFound(_0xad8273,_0x4f5464){return function(_0x5cac44){if(!_0x5cac44){_0xad8273[_0x398d('0x18')](0x194);}return _0x5cac44;};}function handleError(_0x1013fd,_0x59c39c){_0x59c39c=_0x59c39c||0x1f4;return function(_0xf09c82){logger[_0x398d('0x25')](_0xf09c82[_0x398d('0x26')]);if(_0xf09c82[_0x398d('0x27')]){delete _0xf09c82[_0x398d('0x27')];}_0x1013fd[_0x398d('0x19')](_0x59c39c)[_0x398d('0x28')](_0xf09c82);};}exports['index']=function(_0x5dc422,_0x391101){var _0x2b88f1={},_0x55defd={},_0x4c555b={'count':0x0,'rows':[]};var _0x2dff58=_[_0x398d('0x29')](db[_0x398d('0x2a')][_0x398d('0x2b')],function(_0x86d4e0){return{'name':_0x86d4e0[_0x398d('0x2c')],'type':_0x86d4e0[_0x398d('0x2d')]['key']};});_0x55defd[_0x398d('0x2e')]=_[_0x398d('0x29')](_0x2dff58,_0x398d('0x27'));_0x55defd[_0x398d('0x2f')]=_[_0x398d('0x30')](_0x5dc422[_0x398d('0x2f')]);_0x55defd[_0x398d('0x31')]=_[_0x398d('0x32')](_0x55defd[_0x398d('0x2e')],_0x55defd[_0x398d('0x2f')]);_0x2b88f1[_0x398d('0x33')]=_[_0x398d('0x32')](_0x55defd[_0x398d('0x2e')],qs[_0x398d('0x34')](_0x5dc422[_0x398d('0x2f')][_0x398d('0x34')]));_0x2b88f1[_0x398d('0x33')]=_0x2b88f1[_0x398d('0x33')][_0x398d('0x35')]?_0x2b88f1['attributes']:_0x55defd[_0x398d('0x2e')];if(!_0x5dc422[_0x398d('0x2f')][_0x398d('0x36')](_0x398d('0x37'))){_0x2b88f1['limit']=qs['limit'](_0x5dc422[_0x398d('0x2f')][_0x398d('0x38')]);_0x2b88f1[_0x398d('0x1c')]=qs['offset'](_0x5dc422[_0x398d('0x2f')][_0x398d('0x1c')]);}_0x2b88f1[_0x398d('0x39')]=qs[_0x398d('0x3a')](_0x5dc422[_0x398d('0x2f')]['sort']);_0x2b88f1['where']=qs[_0x398d('0x31')](_[_0x398d('0x3b')](_0x5dc422[_0x398d('0x2f')],_0x55defd['filters']),_0x2dff58);if(_0x5dc422[_0x398d('0x2f')][_0x398d('0x3c')]){_0x2b88f1['where']=_['merge'](_0x2b88f1['where'],{'$or':_[_0x398d('0x29')](_0x2dff58,function(_0x1f8604){if(_0x1f8604[_0x398d('0x2d')]!==_0x398d('0x3d')){var _0x1ef3aa={};_0x1ef3aa[_0x1f8604['name']]={'$like':'%'+_0x5dc422[_0x398d('0x2f')][_0x398d('0x3c')]+'%'};return _0x1ef3aa;}})});}_0x2b88f1=_['merge']({},_0x2b88f1,_0x5dc422[_0x398d('0x3e')]);var _0x23fb09={'where':_0x2b88f1[_0x398d('0x3f')]};return db[_0x398d('0x2a')]['count'](_0x23fb09)['then'](function(_0x3a168d){_0x4c555b[_0x398d('0x1e')]=_0x3a168d;if(_0x5dc422[_0x398d('0x2f')][_0x398d('0x40')]){_0x2b88f1[_0x398d('0x41')]=[{'all':!![]}];}return db[_0x398d('0x2a')][_0x398d('0x42')](_0x2b88f1);})['then'](function(_0x2e81ab){_0x4c555b['rows']=_0x2e81ab;return _0x4c555b;})[_0x398d('0x23')](respondWithFilteredResult(_0x391101,_0x2b88f1))[_0x398d('0x43')](handleError(_0x391101,null));};exports[_0x398d('0x44')]=function(_0x2e43e4,_0x52738e){var _0x4f650f={'raw':!![],'where':{'id':_0x2e43e4[_0x398d('0x45')]['id']}},_0x238627={};_0x238627[_0x398d('0x2e')]=_[_0x398d('0x30')](db['VoiceTransferReport'][_0x398d('0x2b')]);_0x238627[_0x398d('0x2f')]=_['keys'](_0x2e43e4['query']);_0x238627[_0x398d('0x31')]=_['intersection'](_0x238627['model'],_0x238627[_0x398d('0x2f')]);_0x4f650f[_0x398d('0x33')]=_[_0x398d('0x32')](_0x238627['model'],qs[_0x398d('0x34')](_0x2e43e4[_0x398d('0x2f')]['fields']));_0x4f650f[_0x398d('0x33')]=_0x4f650f[_0x398d('0x33')]['length']?_0x4f650f['attributes']:_0x238627[_0x398d('0x2e')];if(_0x2e43e4[_0x398d('0x2f')]['includeAll']){_0x4f650f[_0x398d('0x41')]=[{'all':!![]}];}_0x4f650f=_[_0x398d('0x46')]({},_0x4f650f,_0x2e43e4[_0x398d('0x3e')]);return db['VoiceTransferReport'][_0x398d('0x47')](_0x4f650f)[_0x398d('0x23')](handleEntityNotFound(_0x52738e,null))['then'](respondWithResult(_0x52738e,null))[_0x398d('0x43')](handleError(_0x52738e,null));};exports[_0x398d('0x48')]=function(_0x2515d7,_0x594517){return db[_0x398d('0x2a')]['create'](_0x2515d7[_0x398d('0x49')],{})[_0x398d('0x23')](respondWithResult(_0x594517,0xc9))['catch'](handleError(_0x594517,null));};exports[_0x398d('0x22')]=function(_0x5e4959,_0x2b97d3){if(_0x5e4959[_0x398d('0x49')]['id']){delete _0x5e4959[_0x398d('0x49')]['id'];}return db['VoiceTransferReport'][_0x398d('0x47')]({'where':{'id':_0x5e4959['params']['id']}})['then'](handleEntityNotFound(_0x2b97d3,null))[_0x398d('0x23')](saveUpdates(_0x5e4959[_0x398d('0x49')],null))[_0x398d('0x23')](respondWithResult(_0x2b97d3,null))[_0x398d('0x43')](handleError(_0x2b97d3,null));};exports[_0x398d('0x24')]=function(_0xdeb7ea,_0x4a90b7){return db[_0x398d('0x2a')]['find']({'where':{'id':_0xdeb7ea[_0x398d('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a90b7,null))[_0x398d('0x23')](removeEntity(_0x4a90b7,null))['catch'](handleError(_0x4a90b7,null));};exports[_0x398d('0x4a')]=function(_0x22a0f1,_0x180372){return db[_0x398d('0x2a')][_0x398d('0x4a')]()[_0x398d('0x23')](respondWithResult(_0x180372,null))['catch'](handleError(_0x180372,null));}; \ No newline at end of file +var _0x829e=['options','VoiceTransferReport','includeAll','rows','catch','show','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x829e,0x123));var _0xe829=function(_0x5a0601,_0x562ea7){_0x5a0601=_0x5a0601-0x0;var _0x61b297=_0x829e[_0x5a0601];return _0x61b297;};'use strict';var emlformat=require(_0xe829('0x0'));var rimraf=require(_0xe829('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe829('0x2'));var rp=require(_0xe829('0x3'));var moment=require(_0xe829('0x4'));var BPromise=require(_0xe829('0x5'));var Mustache=require(_0xe829('0x6'));var util=require('util');var path=require(_0xe829('0x7'));var sox=require('sox');var csv=require(_0xe829('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe829('0x9'));var _=require(_0xe829('0xa'));var squel=require(_0xe829('0xb'));var crypto=require(_0xe829('0xc'));var jsforce=require(_0xe829('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe829('0x8'));var querystring=require(_0xe829('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe829('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe829('0x10'));var utils=require(_0xe829('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xe829('0x12'));var db=require(_0xe829('0x13'))['db'];function respondWithStatusCode(_0x226ef2,_0x445985){_0x445985=_0x445985||0xcc;return function(_0x298847){if(_0x298847){return _0x226ef2[_0xe829('0x14')](_0x445985);}return _0x226ef2[_0xe829('0x15')](_0x445985)['end']();};}function respondWithResult(_0x13ed8e,_0x58269c){_0x58269c=_0x58269c||0xc8;return function(_0x440ab4){if(_0x440ab4){return _0x13ed8e['status'](_0x58269c)[_0xe829('0x16')](_0x440ab4);}};}function respondWithFilteredResult(_0x246eba,_0x9c919a){return function(_0x3597be){if(_0x3597be){var _0x35a74c=typeof _0x9c919a[_0xe829('0x17')]==='undefined'&&typeof _0x9c919a[_0xe829('0x18')]==='undefined';var _0x590a7a=_0x3597be['count'];var _0x4703a0=_0x35a74c?0x0:_0x9c919a[_0xe829('0x17')];var _0x20d76a=_0x35a74c?_0x3597be[_0xe829('0x19')]:_0x9c919a[_0xe829('0x17')]+_0x9c919a[_0xe829('0x18')];var _0x30742d;if(_0x20d76a>=_0x590a7a){_0x20d76a=_0x590a7a;_0x30742d=0xc8;}else{_0x30742d=0xce;}_0x246eba[_0xe829('0x15')](_0x30742d);return _0x246eba[_0xe829('0x1a')](_0xe829('0x1b'),_0x4703a0+'-'+_0x20d76a+'/'+_0x590a7a)['json'](_0x3597be);}return null;};}function patchUpdates(_0x1dd0bb){return function(_0x4bd9e3){try{jsonpatch[_0xe829('0x1c')](_0x4bd9e3,_0x1dd0bb,!![]);}catch(_0x4d1d78){return BPromise[_0xe829('0x1d')](_0x4d1d78);}return _0x4bd9e3[_0xe829('0x1e')]();};}function saveUpdates(_0xfe59da,_0x86263d){return function(_0x47ae1b){if(_0x47ae1b){return _0x47ae1b[_0xe829('0x1f')](_0xfe59da)[_0xe829('0x20')](function(_0x5e025d){return _0x5e025d;});}return null;};}function removeEntity(_0x1cd80a,_0x4f1319){return function(_0x4d3dba){if(_0x4d3dba){return _0x4d3dba[_0xe829('0x21')]()[_0xe829('0x20')](function(){_0x1cd80a[_0xe829('0x15')](0xcc)[_0xe829('0x22')]();});}};}function handleEntityNotFound(_0x1fb450,_0x3a8d48){return function(_0x1a7a00){if(!_0x1a7a00){_0x1fb450[_0xe829('0x14')](0x194);}return _0x1a7a00;};}function handleError(_0x89b16a,_0x2ebfbe){_0x2ebfbe=_0x2ebfbe||0x1f4;return function(_0x53a0cf){logger['error'](_0x53a0cf['stack']);if(_0x53a0cf[_0xe829('0x23')]){delete _0x53a0cf[_0xe829('0x23')];}_0x89b16a[_0xe829('0x15')](_0x2ebfbe)[_0xe829('0x24')](_0x53a0cf);};}exports[_0xe829('0x25')]=function(_0x5091ff,_0x5995b4){var _0x32dd50={},_0x22e7d2={},_0x19b248={'count':0x0,'rows':[]};var _0x280800=_[_0xe829('0x26')](db['VoiceTransferReport'][_0xe829('0x27')],function(_0x1c715a){return{'name':_0x1c715a[_0xe829('0x28')],'type':_0x1c715a[_0xe829('0x29')][_0xe829('0x2a')]};});_0x22e7d2[_0xe829('0x2b')]=_['map'](_0x280800,_0xe829('0x23'));_0x22e7d2[_0xe829('0x2c')]=_[_0xe829('0x2d')](_0x5091ff[_0xe829('0x2c')]);_0x22e7d2[_0xe829('0x2e')]=_[_0xe829('0x2f')](_0x22e7d2[_0xe829('0x2b')],_0x22e7d2[_0xe829('0x2c')]);_0x32dd50[_0xe829('0x30')]=_['intersection'](_0x22e7d2[_0xe829('0x2b')],qs[_0xe829('0x31')](_0x5091ff[_0xe829('0x2c')][_0xe829('0x31')]));_0x32dd50[_0xe829('0x30')]=_0x32dd50['attributes'][_0xe829('0x32')]?_0x32dd50[_0xe829('0x30')]:_0x22e7d2[_0xe829('0x2b')];if(!_0x5091ff['query'][_0xe829('0x33')](_0xe829('0x34'))){_0x32dd50[_0xe829('0x18')]=qs[_0xe829('0x18')](_0x5091ff[_0xe829('0x2c')]['limit']);_0x32dd50['offset']=qs[_0xe829('0x17')](_0x5091ff[_0xe829('0x2c')][_0xe829('0x17')]);}_0x32dd50[_0xe829('0x35')]=qs[_0xe829('0x36')](_0x5091ff[_0xe829('0x2c')][_0xe829('0x36')]);_0x32dd50[_0xe829('0x37')]=qs[_0xe829('0x2e')](_[_0xe829('0x38')](_0x5091ff[_0xe829('0x2c')],_0x22e7d2[_0xe829('0x2e')]),_0x280800);if(_0x5091ff['query']['filter']){_0x32dd50[_0xe829('0x37')]=_['merge'](_0x32dd50[_0xe829('0x37')],{'$or':_['map'](_0x280800,function(_0x535f00){if(_0x535f00[_0xe829('0x29')]!==_0xe829('0x39')){var _0x384b7a={};_0x384b7a[_0x535f00[_0xe829('0x23')]]={'$like':'%'+_0x5091ff[_0xe829('0x2c')][_0xe829('0x3a')]+'%'};return _0x384b7a;}})});}_0x32dd50=_['merge']({},_0x32dd50,_0x5091ff[_0xe829('0x3b')]);var _0x6dd86d={'where':_0x32dd50[_0xe829('0x37')]};return db[_0xe829('0x3c')][_0xe829('0x19')](_0x6dd86d)[_0xe829('0x20')](function(_0x25701d){_0x19b248[_0xe829('0x19')]=_0x25701d;if(_0x5091ff['query'][_0xe829('0x3d')]){_0x32dd50['include']=[{'all':!![]}];}return db[_0xe829('0x3c')]['findAll'](_0x32dd50);})['then'](function(_0x248215){_0x19b248[_0xe829('0x3e')]=_0x248215;return _0x19b248;})[_0xe829('0x20')](respondWithFilteredResult(_0x5995b4,_0x32dd50))[_0xe829('0x3f')](handleError(_0x5995b4,null));};exports[_0xe829('0x40')]=function(_0x110d2a,_0x1d9ae7){var _0xa2ed8c={'raw':!![],'where':{'id':_0x110d2a['params']['id']}},_0x33408d={};_0x33408d[_0xe829('0x2b')]=_['keys'](db['VoiceTransferReport'][_0xe829('0x27')]);_0x33408d['query']=_[_0xe829('0x2d')](_0x110d2a[_0xe829('0x2c')]);_0x33408d[_0xe829('0x2e')]=_[_0xe829('0x2f')](_0x33408d['model'],_0x33408d[_0xe829('0x2c')]);_0xa2ed8c['attributes']=_[_0xe829('0x2f')](_0x33408d[_0xe829('0x2b')],qs[_0xe829('0x31')](_0x110d2a[_0xe829('0x2c')][_0xe829('0x31')]));_0xa2ed8c[_0xe829('0x30')]=_0xa2ed8c[_0xe829('0x30')][_0xe829('0x32')]?_0xa2ed8c[_0xe829('0x30')]:_0x33408d[_0xe829('0x2b')];if(_0x110d2a[_0xe829('0x2c')][_0xe829('0x3d')]){_0xa2ed8c['include']=[{'all':!![]}];}_0xa2ed8c=_['merge']({},_0xa2ed8c,_0x110d2a['options']);return db[_0xe829('0x3c')]['find'](_0xa2ed8c)[_0xe829('0x20')](handleEntityNotFound(_0x1d9ae7,null))['then'](respondWithResult(_0x1d9ae7,null))[_0xe829('0x3f')](handleError(_0x1d9ae7,null));};exports[_0xe829('0x41')]=function(_0x2a6fe6,_0x351624){return db[_0xe829('0x3c')]['create'](_0x2a6fe6['body'],{})['then'](respondWithResult(_0x351624,0xc9))[_0xe829('0x3f')](handleError(_0x351624,null));};exports[_0xe829('0x1f')]=function(_0x5f2cb1,_0x1a3883){if(_0x5f2cb1[_0xe829('0x42')]['id']){delete _0x5f2cb1[_0xe829('0x42')]['id'];}return db[_0xe829('0x3c')][_0xe829('0x43')]({'where':{'id':_0x5f2cb1[_0xe829('0x44')]['id']}})[_0xe829('0x20')](handleEntityNotFound(_0x1a3883,null))[_0xe829('0x20')](saveUpdates(_0x5f2cb1['body'],null))[_0xe829('0x20')](respondWithResult(_0x1a3883,null))[_0xe829('0x3f')](handleError(_0x1a3883,null));};exports[_0xe829('0x21')]=function(_0xe53455,_0x5e846c){return db[_0xe829('0x3c')][_0xe829('0x43')]({'where':{'id':_0xe53455[_0xe829('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e846c,null))[_0xe829('0x20')](removeEntity(_0x5e846c,null))['catch'](handleError(_0x5e846c,null));};exports['describe']=function(_0x1ca4d7,_0x1707de){return db[_0xe829('0x3c')][_0xe829('0x45')]()[_0xe829('0x20')](respondWithResult(_0x1707de,null))[_0xe829('0x3f')](handleError(_0x1707de,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 9305bf5..776e88d 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.model.js +++ b/server/api/voiceTransferReport/voiceTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x094a=['VoiceTransferReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define'];(function(_0x104179,_0x49c88b){var _0x511994=function(_0xbf9f3e){while(--_0xbf9f3e){_0x104179['push'](_0x104179['shift']());}};_0x511994(++_0x49c88b);}(_0x094a,0x16d));var _0xa094=function(_0x77640e,_0x12a7db){_0x77640e=_0x77640e-0x0;var _0x4d14a1=_0x094a[_0x77640e];return _0x4d14a1;};'use strict';var _=require(_0xa094('0x0'));var util=require(_0xa094('0x1'));var logger=require(_0xa094('0x2'))(_0xa094('0x3'));var moment=require(_0xa094('0x4'));var BPromise=require(_0xa094('0x5'));var rp=require(_0xa094('0x6'));var fs=require('fs');var path=require(_0xa094('0x7'));var rimraf=require(_0xa094('0x8'));var config=require(_0xa094('0x9'));var attributes=require(_0xa094('0xa'));module['exports']=function(_0xa30a49,_0x37d0da){return _0xa30a49[_0xa094('0xb')](_0xa094('0xc'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcb9=['util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','report_call_transfer','lodash'];(function(_0x575657,_0x21734e){var _0x14c77b=function(_0x455521){while(--_0x455521){_0x575657['push'](_0x575657['shift']());}};_0x14c77b(++_0x21734e);}(_0xfcb9,0x15f));var _0x9fcb=function(_0x584b8c,_0x3a2cf7){_0x584b8c=_0x584b8c-0x0;var _0x474a89=_0xfcb9[_0x584b8c];return _0x474a89;};'use strict';var _=require(_0x9fcb('0x0'));var util=require(_0x9fcb('0x1'));var logger=require('../../config/logger')(_0x9fcb('0x2'));var moment=require(_0x9fcb('0x3'));var BPromise=require(_0x9fcb('0x4'));var rp=require(_0x9fcb('0x5'));var fs=require('fs');var path=require(_0x9fcb('0x6'));var rimraf=require('rimraf');var config=require(_0x9fcb('0x7'));var attributes=require(_0x9fcb('0x8'));module[_0x9fcb('0x9')]=function(_0x33d01b,_0x48f2de){return _0x33d01b['define']('VoiceTransferReport',attributes,{'tableName':_0x9fcb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index b35fb16..c26319b 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.rpc.js +++ b/server/api/voiceTransferReport/voiceTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8d7=['info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0xe48137,_0x126694){var _0xd9f437=function(_0x254ab3){while(--_0x254ab3){_0xe48137['push'](_0xe48137['shift']());}};_0xd9f437(++_0x126694);}(_0xb8d7,0xf9));var _0x7b8d=function(_0x465d8c,_0x101ece){_0x465d8c=_0x465d8c-0x0;var _0x28f93e=_0xb8d7[_0x465d8c];return _0x28f93e;};'use strict';var _=require(_0x7b8d('0x0'));var util=require(_0x7b8d('0x1'));var moment=require(_0x7b8d('0x2'));var BPromise=require(_0x7b8d('0x3'));var rs=require(_0x7b8d('0x4'));var fs=require('fs');var Redis=require(_0x7b8d('0x5'));var db=require(_0x7b8d('0x6'))['db'];var utils=require(_0x7b8d('0x7'));var logger=require(_0x7b8d('0x8'))(_0x7b8d('0x9'));var config=require(_0x7b8d('0xa'));var jayson=require(_0x7b8d('0xb'));var client=jayson[_0x7b8d('0xc')][_0x7b8d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3bb2b0,_0x27f30b,_0x447036){return new BPromise(function(_0x128d7e,_0x1084f2){return client['request'](_0x3bb2b0,_0x447036)[_0x7b8d('0xe')](function(_0x1f7bf6){logger['info'](_0x7b8d('0xf'),_0x27f30b,_0x7b8d('0x10'));logger[_0x7b8d('0x11')](_0x7b8d('0x12'),_0x27f30b,_0x7b8d('0x10'),JSON['stringify'](_0x1f7bf6));if(_0x1f7bf6[_0x7b8d('0x13')]){if(_0x1f7bf6[_0x7b8d('0x13')]['code']===0x1f4){logger['error'](_0x7b8d('0xf'),_0x27f30b,_0x1f7bf6[_0x7b8d('0x13')][_0x7b8d('0x14')]);return _0x1084f2(_0x1f7bf6[_0x7b8d('0x13')][_0x7b8d('0x14')]);}logger['error'](_0x7b8d('0xf'),_0x27f30b,_0x1f7bf6[_0x7b8d('0x13')][_0x7b8d('0x14')]);return _0x128d7e(_0x1f7bf6[_0x7b8d('0x13')][_0x7b8d('0x14')]);}else{logger[_0x7b8d('0x15')](_0x7b8d('0xf'),_0x27f30b,'request\x20sent');_0x128d7e(_0x1f7bf6[_0x7b8d('0x16')]['message']);}})[_0x7b8d('0x17')](function(_0x1a15c8){logger[_0x7b8d('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x27f30b,_0x1a15c8);_0x1084f2(_0x1a15c8);});});}exports[_0x7b8d('0x18')]=function(_0x2d18c1){var _0x340167=this;return new Promise(function(_0x3eec4a,_0x5523cd){return db[_0x7b8d('0x19')][_0x7b8d('0x1a')](_0x2d18c1[_0x7b8d('0x1b')],{'raw':_0x2d18c1[_0x7b8d('0x1c')]?_0x2d18c1[_0x7b8d('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x7b8d('0xe')](function(_0x39407f){logger[_0x7b8d('0x15')]('CreateVoiceTransferReport',_0x2d18c1);logger[_0x7b8d('0x11')](_0x7b8d('0x18'),_0x2d18c1,JSON[_0x7b8d('0x1d')](_0x39407f));_0x3eec4a(_0x39407f);})['catch'](function(_0x283777){logger[_0x7b8d('0x13')](_0x7b8d('0x18'),_0x283777[_0x7b8d('0x14')],_0x2d18c1);_0x5523cd(_0x340167[_0x7b8d('0x13')](0x1f4,_0x283777[_0x7b8d('0x14')]));});});}; \ No newline at end of file +var _0x6464=['stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','CreateVoiceTransferReport','create','raw','then','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x1d6527,_0x2f2bf8){var _0x1cdb65=function(_0x3a980b){while(--_0x3a980b){_0x1d6527['push'](_0x1d6527['shift']());}};_0x1cdb65(++_0x2f2bf8);}(_0x6464,0x14f));var _0x4646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6464[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4646('0x0'));var util=require(_0x4646('0x1'));var moment=require('moment');var BPromise=require(_0x4646('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4646('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4646('0x4'));var logger=require(_0x4646('0x5'))(_0x4646('0x6'));var config=require(_0x4646('0x7'));var jayson=require(_0x4646('0x8'));var client=jayson[_0x4646('0x9')][_0x4646('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x251f0d,_0x4f0303,_0x208ce6){return new BPromise(function(_0x4999e0,_0x31360c){return client[_0x4646('0xb')](_0x251f0d,_0x208ce6)['then'](function(_0x26d617){logger[_0x4646('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f0303,_0x4646('0xd'));logger[_0x4646('0xe')](_0x4646('0xf'),_0x4f0303,_0x4646('0xd'),JSON[_0x4646('0x10')](_0x26d617));if(_0x26d617[_0x4646('0x11')]){if(_0x26d617[_0x4646('0x11')][_0x4646('0x12')]===0x1f4){logger[_0x4646('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f0303,_0x26d617[_0x4646('0x11')][_0x4646('0x13')]);return _0x31360c(_0x26d617[_0x4646('0x11')]['message']);}logger[_0x4646('0x11')](_0x4646('0x14'),_0x4f0303,_0x26d617['error'][_0x4646('0x13')]);return _0x4999e0(_0x26d617[_0x4646('0x11')][_0x4646('0x13')]);}else{logger[_0x4646('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f0303,_0x4646('0xd'));_0x4999e0(_0x26d617[_0x4646('0x15')][_0x4646('0x13')]);}})[_0x4646('0x16')](function(_0x4d9f02){logger[_0x4646('0x11')](_0x4646('0x14'),_0x4f0303,_0x4d9f02);_0x31360c(_0x4d9f02);});});}exports[_0x4646('0x17')]=function(_0x4c777c){var _0x3dcff1=this;return new Promise(function(_0x57ff7d,_0x4ec1ef){return db['VoiceTransferReport'][_0x4646('0x18')](_0x4c777c['body'],{'raw':_0x4c777c['options']?_0x4c777c['options'][_0x4646('0x19')]===undefined?!![]:![]:!![]})[_0x4646('0x1a')](function(_0x1b10eb){logger[_0x4646('0xc')](_0x4646('0x17'),_0x4c777c);logger[_0x4646('0xe')]('CreateVoiceTransferReport',_0x4c777c,JSON['stringify'](_0x1b10eb));_0x57ff7d(_0x1b10eb);})['catch'](function(_0x445476){logger[_0x4646('0x11')](_0x4646('0x17'),_0x445476[_0x4646('0x13')],_0x4c777c);_0x4ec1ef(_0x3dcff1['error'](0x1f4,_0x445476[_0x4646('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 16e4ad5..457d111 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x59d546,_0x107f05){var _0x41fbdb=function(_0x413e68){while(--_0x413e68){_0x59d546['push'](_0x59d546['shift']());}};_0x41fbdb(++_0x107f05);}(_0xdace,0xc5));var _0xedac=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xdace[_0x291f8b];return _0x275171;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file +var _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xcb91[_0x11a220];return _0x20d8fe;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index aaa4efe..5471434 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac55=['stack','name','status','send','NotFound','request','then','error','message','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','json','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','format','webbar:unhold','unhold\x20executed!','calls','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:'];(function(_0x38805c,_0x44e5a2){var _0x54599c=function(_0x4983f3){while(--_0x4983f3){_0x38805c['push'](_0x38805c['shift']());}};_0x54599c(++_0x44e5a2);}(_0xac55,0x1c8));var _0x5ac5=function(_0x45a36a,_0x23f347){_0x45a36a=_0x45a36a-0x0;var _0x948b8=_0xac55[_0x45a36a];return _0x948b8;};'use strict';var path=require(_0x5ac5('0x0'));var fs=require('fs');var _=require(_0x5ac5('0x1'));var db=require(_0x5ac5('0x2'))['db'];var config=require(_0x5ac5('0x3'));var util=require('util');var BPromise=require(_0x5ac5('0x4'));var jayson=require(_0x5ac5('0x5'));var amiClient=jayson[_0x5ac5('0x6')][_0x5ac5('0x7')]({'port':0x232a});var logger=require(_0x5ac5('0x8'))(_0x5ac5('0x9'));var Redis=require(_0x5ac5('0xa'));config['redis']=_['defaults'](config[_0x5ac5('0xb')],{'host':_0x5ac5('0xc'),'port':0x18eb});var io=require(_0x5ac5('0xd'))(new Redis(config[_0x5ac5('0xb')]));var Schema=require(_0x5ac5('0xe'));var originateValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x5ac5('0x11')},'callbackUrl':{'type':_0x5ac5('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':[!![],_0x5ac5('0x12')]},'transferNumber':{'type':_0x5ac5('0x11'),'required':[!![],_0x5ac5('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]}});function emit(_0x30244d,_0x1282be,_0x34a95e){logger[_0x5ac5('0x14')](_0x30244d,_0x1282be,JSON[_0x5ac5('0x15')](_0x34a95e));io['to'](_0x30244d)['emit'](_0x1282be,_0x34a95e);}function handleError(_0x4e186a){return function(_0x5364a6){console[_0x5ac5('0x16')](_0x5ac5('0x17'),_0x5364a6,_0x5364a6 instanceof RangeError);logger['error'](_0x5364a6[_0x5ac5('0x18')]);if(_0x5364a6 instanceof RangeError){if(_0x5364a6['name']){delete _0x5364a6[_0x5ac5('0x19')];}_0x4e186a['status'](0x194)['send'](_0x5364a6);}else{if(_0x5364a6[_0x5ac5('0x19')]){delete _0x5364a6['name'];}_0x4e186a[_0x5ac5('0x1a')](0x1f4)[_0x5ac5('0x1b')](_0x5364a6);}};}function checkError(){return function(_0x5c21d8){if(!_0x5c21d8){throw new RangeError(_0x5ac5('0x1c'));}return _0x5c21d8;};}function respondWithRpcPromise(_0x4ac526,_0x29a44c){return new BPromise(function(_0x40bdbc,_0x47993e){var _0x47a898=amiClient;return _0x47a898[_0x5ac5('0x1d')](_0x4ac526,_0x29a44c)[_0x5ac5('0x1e')](function(_0x400308){if(_0x400308[_0x5ac5('0x1f')]){if(_0x400308[_0x5ac5('0x1f')]['code']===0x1f4){return _0x47993e(_0x400308[_0x5ac5('0x1f')][_0x5ac5('0x20')]);}return _0x40bdbc(_0x400308[_0x5ac5('0x1f')][_0x5ac5('0x20')]);}else{_0x40bdbc(_0x400308['result']);}})[_0x5ac5('0x21')](function(_0x4eda97){_0x47993e(_0x4eda97);});});}function getAgent(_0x17c507){return db[_0x5ac5('0x22')][_0x5ac5('0x23')]({'where':{'id':_0x17c507,'role':_0x5ac5('0x24')}})[_0x5ac5('0x1e')](checkError());}function getAgentCheckSession(_0x3b3ec0,_0x5ce67c){return new BPromise(function(_0x31f9cc,_0x4a5f4d){var _0x24e8c7=respondWithRpcPromise(_0x5ac5('0x25'));var _0x35535f=getAgent(_0x3b3ec0);Promise['all']([_0x24e8c7,_0x35535f])[_0x5ac5('0x1e')](function(_0x229941){var _0x21df31=_0x229941[0x0];var _0x21307c=_0x229941[0x1];var _0x4eafa1=_[_0x5ac5('0x26')](_0x21df31['rows'],function(_0x3414ba){return _0x3414ba[_0x5ac5('0x27')]==_0x21307c['id']&&_0x3414ba[_0x5ac5('0x28')]==_0x5ce67c;});if(_0x4eafa1[_0x5ac5('0x29')]==0x1){_0x31f9cc(_0x21307c);}else{_0x4a5f4d(new RangeError(_0x5ac5('0x2a')+_0x5ce67c+'\x20not\x20found!'));}});});}exports[_0x5ac5('0x2b')]=function(_0x21116,_0x36285d){logger['info'](_0x5ac5('0x2c'),_0x21116['body']);var _0x472782=originateValidation[_0x5ac5('0xe')](_0x21116[_0x5ac5('0x2d')]);if(_0x472782[_0x5ac5('0x29')]>0x0){return _0x36285d[_0x5ac5('0x1a')](0x190)['json'](_0x472782);}var _0x39a895=_0x21116['body'][_0x5ac5('0x2e')];var _0x5ae4af=_0x21116[_0x5ac5('0x2d')][_0x5ac5('0x2f')];var _0x47a5d8=_0x21116[_0x5ac5('0x2d')][_0x5ac5('0x30')];var _0x585e4b=_0x21116['body'][_0x5ac5('0x31')];return getAgent(_0x39a895)[_0x5ac5('0x1e')](function(_0x243204){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x243204[_0x5ac5('0x19')]);emit(util['format']('user:%s',_0x243204['name']),_0x5ac5('0x33'),{'callNumber':_0x5ae4af,'callerId':_0x47a5d8,'callbackUrl':_0x585e4b});return _0x36285d[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x34')});})[_0x5ac5('0x21')](handleError(_0x36285d));};exports[_0x5ac5('0x35')]=function(_0x38667d,_0x46290f){logger[_0x5ac5('0x14')](_0x5ac5('0x36'),_0x38667d[_0x5ac5('0x2d')]);var _0x2d726e=hangupValidation['validate'](_0x38667d[_0x5ac5('0x2d')]);if(_0x2d726e['length']>0x0){return _0x46290f[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x2d726e);}var _0x1ca0f0=_0x38667d[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x1ec79a=_0x38667d[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0x1ca0f0)[_0x5ac5('0x1e')](function(_0x5105fc){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x5105fc['name']);emit(util['format'](_0x5ac5('0x38'),_0x5105fc['name']),_0x5ac5('0x39'),{'sessionId':_0x1ec79a});return _0x46290f[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x5ac5('0x21')](handleError(_0x46290f));};exports[_0x5ac5('0x3a')]=function(_0x32cc92,_0x1475b0){logger[_0x5ac5('0x14')](_0x5ac5('0x3b'),_0x32cc92[_0x5ac5('0x2d')]);var _0x5a86a0=answerValidation[_0x5ac5('0xe')](_0x32cc92[_0x5ac5('0x2d')]);if(_0x5a86a0[_0x5ac5('0x29')]>0x0){return _0x1475b0[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x5a86a0);}var _0x3abf39=_0x32cc92['body'][_0x5ac5('0x2e')];var _0x24657d=_0x32cc92[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0x3abf39)['then'](function(_0x228179){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x228179['name']);emit(util['format'](_0x5ac5('0x38'),_0x228179[_0x5ac5('0x19')]),_0x5ac5('0x3c'),{'sessionId':_0x24657d});return _0x1475b0[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x3d')});})['catch'](handleError(_0x1475b0));};exports[_0x5ac5('0x3e')]=function(_0x3dfeba,_0x4d90cf){logger[_0x5ac5('0x14')]('hold\x20fired:',_0x3dfeba[_0x5ac5('0x2d')]);var _0x3f26e0=holdValidation[_0x5ac5('0xe')](_0x3dfeba['body']);if(_0x3f26e0['length']>0x0){return _0x4d90cf[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x3f26e0);}var _0xd6ae55=_0x3dfeba[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x3534ce=_0x3dfeba[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0xd6ae55)[_0x5ac5('0x1e')](function(_0x536765){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x536765[_0x5ac5('0x19')]);emit(util['format']('user:%s',_0x536765[_0x5ac5('0x19')]),_0x5ac5('0x3f'),{'sessionId':_0x3534ce});return _0x4d90cf[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x40')});})[_0x5ac5('0x21')](handleError(_0x4d90cf));};exports[_0x5ac5('0x41')]=function(_0x2a3396,_0x326f60){logger[_0x5ac5('0x14')](_0x5ac5('0x42'),_0x2a3396['body']);var _0x5ac4e3=unholdValidation['validate'](_0x2a3396[_0x5ac5('0x2d')]);if(_0x5ac4e3[_0x5ac5('0x29')]>0x0){return _0x326f60[_0x5ac5('0x1a')](0x190)['json'](_0x5ac4e3);}var _0x1973f6=_0x2a3396[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x286304=_0x2a3396[_0x5ac5('0x2d')]['sessionId'];return getAgent(_0x1973f6)['then'](function(_0x516ffd){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x516ffd[_0x5ac5('0x19')]);emit(util[_0x5ac5('0x43')](_0x5ac5('0x38'),_0x516ffd[_0x5ac5('0x19')]),_0x5ac5('0x44'),{'sessionId':_0x286304});return _0x326f60[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'error':![],'message':_0x5ac5('0x45')});})[_0x5ac5('0x21')](handleError(_0x326f60));};exports[_0x5ac5('0x46')]=function(_0x447603,_0x252030){logger[_0x5ac5('0x14')]('calls\x20fired:',_0x252030[_0x5ac5('0x2d')]);var _0x360fb8=callsValidation['validate'](_0x447603[_0x5ac5('0x2d')]);if(_0x360fb8[_0x5ac5('0x29')]>0x0){return _0x252030[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x360fb8);}var _0x316af1=_0x447603[_0x5ac5('0x2d')]['userId'];var _0x2b5329=respondWithRpcPromise(_0x5ac5('0x25'));var _0x424bed=getAgent(_0x316af1);return Promise['all']([_0x2b5329,_0x424bed])[_0x5ac5('0x1e')](function(_0x44e349){var _0x4dd8be=_0x44e349[0x0];var _0x1a6428=_0x44e349[0x1];var _0x3227dc=_['filter'](_0x4dd8be['rows'],function(_0x4d1346){return _0x4d1346[_0x5ac5('0x27')]==_0x1a6428['id'];});return _0x252030[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'count':_0x3227dc[_0x5ac5('0x29')],'rows':_0x3227dc});})[_0x5ac5('0x21')](handleError(_0x252030));};exports[_0x5ac5('0x47')]=function(_0x4ee231,_0x75ca64){logger[_0x5ac5('0x14')](_0x5ac5('0x48'),_0x4ee231[_0x5ac5('0x2d')]);var _0x1f9b9b=conferenceValidation['validate'](_0x4ee231['body']);if(_0x1f9b9b['length']>0x0){return _0x75ca64[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x1f9b9b);}var _0x334a1c=_0x4ee231[_0x5ac5('0x2d')]['userId'];return getAgent(_0x334a1c)[_0x5ac5('0x1e')](function(_0x38b128){logger[_0x5ac5('0x14')]('entityFound:',_0x38b128['name']);emit(util['format'](_0x5ac5('0x38'),_0x38b128[_0x5ac5('0x19')]),_0x5ac5('0x49'));return _0x75ca64[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'error':![],'message':_0x5ac5('0x4a')});})['catch'](handleError(_0x75ca64));};exports[_0x5ac5('0x4b')]=function(_0x5532d6,_0x492179){logger[_0x5ac5('0x14')](_0x5ac5('0x4c'),_0x5532d6[_0x5ac5('0x2d')]);var _0x324ec9=transferValidation[_0x5ac5('0xe')](_0x5532d6[_0x5ac5('0x2d')]);if(_0x324ec9[_0x5ac5('0x29')]>0x0){return _0x492179[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x324ec9);}var _0x130c67=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x299b02=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x28')];var _0x46315b=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x4d')];return getAgent(_0x130c67)[_0x5ac5('0x1e')](function(_0xc95ae5){logger[_0x5ac5('0x14')]('entityFound:',_0xc95ae5[_0x5ac5('0x19')]);emit(util['format'](_0x5ac5('0x38'),_0xc95ae5['name']),_0x5ac5('0x4e'),{'sessionId':_0x299b02,'transferNumber':_0x46315b});return _0x492179['status'](0xc8)['json']({'error':![],'message':_0x5ac5('0x4f')});})['catch'](handleError(_0x492179));}; \ No newline at end of file +var _0xad8a=['answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','user:%s','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','all','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','name','status','send','request','then','code','message','result','catch','User','agent','VoiceChannels','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup\x20executed!','answer'];(function(_0x366ca5,_0x46b5c1){var _0x24fc5a=function(_0x400138){while(--_0x400138){_0x366ca5['push'](_0x366ca5['shift']());}};_0x24fc5a(++_0x46b5c1);}(_0xad8a,0xb0));var _0xaad8=function(_0x46355b,_0x4144f4){_0x46355b=_0x46355b-0x0;var _0x35fb58=_0xad8a[_0x46355b];return _0x35fb58;};'use strict';var path=require(_0xaad8('0x0'));var fs=require('fs');var _=require(_0xaad8('0x1'));var db=require(_0xaad8('0x2'))['db'];var config=require(_0xaad8('0x3'));var util=require(_0xaad8('0x4'));var BPromise=require('bluebird');var jayson=require(_0xaad8('0x5'));var amiClient=jayson[_0xaad8('0x6')][_0xaad8('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xaad8('0x8'));var Redis=require(_0xaad8('0x9'));config[_0xaad8('0xa')]=_[_0xaad8('0xb')](config[_0xaad8('0xa')],{'host':_0xaad8('0xc'),'port':0x18eb});var io=require(_0xaad8('0xd'))(new Redis(config[_0xaad8('0xa')]));var Schema=require(_0xaad8('0xe'));var originateValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xaad8('0x10')]},'callerId':{'type':_0xaad8('0x11')},'callbackUrl':{'type':_0xaad8('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':[!![],_0xaad8('0x13')]},'transferNumber':{'type':_0xaad8('0x11'),'required':[!![],_0xaad8('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xaad8('0x12')]}});function emit(_0xb63cb3,_0x511344,_0x1749d5){logger[_0xaad8('0x15')](_0xb63cb3,_0x511344,JSON[_0xaad8('0x16')](_0x1749d5));io['to'](_0xb63cb3)[_0xaad8('0x17')](_0x511344,_0x1749d5);}function handleError(_0x19ae08){return function(_0x3895e2){console['log'](_0xaad8('0x18'),_0x3895e2,_0x3895e2 instanceof RangeError);logger[_0xaad8('0x19')](_0x3895e2['stack']);if(_0x3895e2 instanceof RangeError){if(_0x3895e2[_0xaad8('0x1a')]){delete _0x3895e2['name'];}_0x19ae08[_0xaad8('0x1b')](0x194)[_0xaad8('0x1c')](_0x3895e2);}else{if(_0x3895e2[_0xaad8('0x1a')]){delete _0x3895e2[_0xaad8('0x1a')];}_0x19ae08['status'](0x1f4)[_0xaad8('0x1c')](_0x3895e2);}};}function checkError(){return function(_0x2c8fd8){if(!_0x2c8fd8){throw new RangeError('NotFound');}return _0x2c8fd8;};}function respondWithRpcPromise(_0x8bc75,_0x61542a){return new BPromise(function(_0x262e57,_0x5b4b61){var _0x5ba0fb=amiClient;return _0x5ba0fb[_0xaad8('0x1d')](_0x8bc75,_0x61542a)[_0xaad8('0x1e')](function(_0x3930f0){if(_0x3930f0[_0xaad8('0x19')]){if(_0x3930f0[_0xaad8('0x19')][_0xaad8('0x1f')]===0x1f4){return _0x5b4b61(_0x3930f0[_0xaad8('0x19')][_0xaad8('0x20')]);}return _0x262e57(_0x3930f0[_0xaad8('0x19')][_0xaad8('0x20')]);}else{_0x262e57(_0x3930f0[_0xaad8('0x21')]);}})[_0xaad8('0x22')](function(_0x4193cb){_0x5b4b61(_0x4193cb);});});}function getAgent(_0x37c3f6){return db[_0xaad8('0x23')]['findOne']({'where':{'id':_0x37c3f6,'role':_0xaad8('0x24')}})[_0xaad8('0x1e')](checkError());}function getAgentCheckSession(_0x3f066f,_0x47b7a2){return new BPromise(function(_0x237c67,_0x37ca5c){var _0x36b180=respondWithRpcPromise(_0xaad8('0x25'));var _0x24c01d=getAgent(_0x3f066f);Promise['all']([_0x36b180,_0x24c01d])[_0xaad8('0x1e')](function(_0x43c489){var _0x1e253f=_0x43c489[0x0];var _0x31ad19=_0x43c489[0x1];var _0x151c26=_['filter'](_0x1e253f[_0xaad8('0x26')],function(_0x4030ea){return _0x4030ea[_0xaad8('0x27')]==_0x31ad19['id']&&_0x4030ea[_0xaad8('0x28')]==_0x47b7a2;});if(_0x151c26['length']==0x1){_0x237c67(_0x31ad19);}else{_0x37ca5c(new RangeError(_0xaad8('0x29')+_0x47b7a2+_0xaad8('0x2a')));}});});}exports[_0xaad8('0x2b')]=function(_0x1eaf8e,_0x254ee5){logger['info'](_0xaad8('0x2c'),_0x1eaf8e[_0xaad8('0x2d')]);var _0x4845a4=originateValidation['validate'](_0x1eaf8e[_0xaad8('0x2d')]);if(_0x4845a4[_0xaad8('0x2e')]>0x0){return _0x254ee5[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x4845a4);}var _0x501ce8=_0x1eaf8e[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x4b6c1a=_0x1eaf8e['body'][_0xaad8('0x31')];var _0x3689cb=_0x1eaf8e['body'][_0xaad8('0x32')];var _0x4fb0ae=_0x1eaf8e['body'][_0xaad8('0x33')];return getAgent(_0x501ce8)[_0xaad8('0x1e')](function(_0x54ab34){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x54ab34[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')]('user:%s',_0x54ab34[_0xaad8('0x1a')]),_0xaad8('0x36'),{'callNumber':_0x4b6c1a,'callerId':_0x3689cb,'callbackUrl':_0x4fb0ae});return _0x254ee5[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x37')});})[_0xaad8('0x22')](handleError(_0x254ee5));};exports['hangup']=function(_0x2aea32,_0x3d0244){logger[_0xaad8('0x15')]('hangup\x20fired:',_0x2aea32[_0xaad8('0x2d')]);var _0x39374b=hangupValidation[_0xaad8('0xe')](_0x2aea32[_0xaad8('0x2d')]);if(_0x39374b[_0xaad8('0x2e')]>0x0){return _0x3d0244[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x39374b);}var _0x4d3a4f=_0x2aea32[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x3e9af2=_0x2aea32[_0xaad8('0x2d')][_0xaad8('0x28')];return getAgent(_0x4d3a4f)[_0xaad8('0x1e')](function(_0x4e4081){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x4e4081[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')]('user:%s',_0x4e4081['name']),'webbar:hangup',{'sessionId':_0x3e9af2});return _0x3d0244[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x38')});})['catch'](handleError(_0x3d0244));};exports[_0xaad8('0x39')]=function(_0x355fc2,_0x4af930){logger[_0xaad8('0x15')](_0xaad8('0x3a'),_0x355fc2[_0xaad8('0x2d')]);var _0x292d4e=answerValidation[_0xaad8('0xe')](_0x355fc2[_0xaad8('0x2d')]);if(_0x292d4e[_0xaad8('0x2e')]>0x0){return _0x4af930[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x292d4e);}var _0xbd5191=_0x355fc2[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x4b5b76=_0x355fc2['body']['sessionId'];return getAgent(_0xbd5191)[_0xaad8('0x1e')](function(_0x5b0ad2){logger[_0xaad8('0x15')]('entityFound:',_0x5b0ad2['name']);emit(util[_0xaad8('0x35')]('user:%s',_0x5b0ad2[_0xaad8('0x1a')]),_0xaad8('0x3b'),{'sessionId':_0x4b5b76});return _0x4af930[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x3c')});})[_0xaad8('0x22')](handleError(_0x4af930));};exports[_0xaad8('0x3d')]=function(_0x1f920b,_0x233fd2){logger[_0xaad8('0x15')](_0xaad8('0x3e'),_0x1f920b[_0xaad8('0x2d')]);var _0x14a837=holdValidation[_0xaad8('0xe')](_0x1f920b[_0xaad8('0x2d')]);if(_0x14a837['length']>0x0){return _0x233fd2['status'](0x190)[_0xaad8('0x2f')](_0x14a837);}var _0x42cfa4=_0x1f920b[_0xaad8('0x2d')]['userId'];var _0x5e2117=_0x1f920b[_0xaad8('0x2d')]['sessionId'];return getAgent(_0x42cfa4)[_0xaad8('0x1e')](function(_0x1560ef){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x1560ef[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')](_0xaad8('0x3f'),_0x1560ef[_0xaad8('0x1a')]),_0xaad8('0x40'),{'sessionId':_0x5e2117});return _0x233fd2['status'](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x41')});})['catch'](handleError(_0x233fd2));};exports[_0xaad8('0x42')]=function(_0x5e5ef1,_0x2a2542){logger[_0xaad8('0x15')](_0xaad8('0x43'),_0x5e5ef1[_0xaad8('0x2d')]);var _0x4068ec=unholdValidation[_0xaad8('0xe')](_0x5e5ef1[_0xaad8('0x2d')]);if(_0x4068ec[_0xaad8('0x2e')]>0x0){return _0x2a2542[_0xaad8('0x1b')](0x190)['json'](_0x4068ec);}var _0x2461f7=_0x5e5ef1[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x13f11d=_0x5e5ef1[_0xaad8('0x2d')][_0xaad8('0x28')];return getAgent(_0x2461f7)['then'](function(_0x1e5127){logger[_0xaad8('0x15')]('entityFound:',_0x1e5127['name']);emit(util[_0xaad8('0x35')](_0xaad8('0x3f'),_0x1e5127[_0xaad8('0x1a')]),_0xaad8('0x44'),{'sessionId':_0x13f11d});return _0x2a2542[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':'unhold\x20executed!'});})[_0xaad8('0x22')](handleError(_0x2a2542));};exports[_0xaad8('0x45')]=function(_0x3e6f4a,_0x1db8c2){logger[_0xaad8('0x15')]('calls\x20fired:',_0x1db8c2['body']);var _0x48edf6=callsValidation[_0xaad8('0xe')](_0x3e6f4a[_0xaad8('0x2d')]);if(_0x48edf6['length']>0x0){return _0x1db8c2[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x48edf6);}var _0x78a183=_0x3e6f4a['body'][_0xaad8('0x30')];var _0x49865e=respondWithRpcPromise(_0xaad8('0x25'));var _0x437266=getAgent(_0x78a183);return Promise[_0xaad8('0x46')]([_0x49865e,_0x437266])[_0xaad8('0x1e')](function(_0x5bd83e){var _0x9bb038=_0x5bd83e[0x0];var _0x1fe921=_0x5bd83e[0x1];var _0x5cf106=_['filter'](_0x9bb038[_0xaad8('0x26')],function(_0x4e64f5){return _0x4e64f5[_0xaad8('0x27')]==_0x1fe921['id'];});return _0x1db8c2[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'count':_0x5cf106[_0xaad8('0x2e')],'rows':_0x5cf106});})[_0xaad8('0x22')](handleError(_0x1db8c2));};exports[_0xaad8('0x47')]=function(_0x1d55fa,_0x2aaa54){logger[_0xaad8('0x15')]('conference\x20fired:',_0x1d55fa[_0xaad8('0x2d')]);var _0x34044d=conferenceValidation[_0xaad8('0xe')](_0x1d55fa[_0xaad8('0x2d')]);if(_0x34044d[_0xaad8('0x2e')]>0x0){return _0x2aaa54[_0xaad8('0x1b')](0x190)['json'](_0x34044d);}var _0x2abbe7=_0x1d55fa[_0xaad8('0x2d')][_0xaad8('0x30')];return getAgent(_0x2abbe7)['then'](function(_0x585380){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x585380[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')]('user:%s',_0x585380[_0xaad8('0x1a')]),_0xaad8('0x48'));return _0x2aaa54[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x49')});})['catch'](handleError(_0x2aaa54));};exports['transfer']=function(_0x2bcb8d,_0xb71d6f){logger[_0xaad8('0x15')](_0xaad8('0x4a'),_0x2bcb8d[_0xaad8('0x2d')]);var _0x739b8=transferValidation['validate'](_0x2bcb8d[_0xaad8('0x2d')]);if(_0x739b8[_0xaad8('0x2e')]>0x0){return _0xb71d6f[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x739b8);}var _0x30514f=_0x2bcb8d['body']['userId'];var _0x586a15=_0x2bcb8d[_0xaad8('0x2d')][_0xaad8('0x28')];var _0x500df3=_0x2bcb8d[_0xaad8('0x2d')][_0xaad8('0x4b')];return getAgent(_0x30514f)[_0xaad8('0x1e')](function(_0xe96206){logger[_0xaad8('0x15')]('entityFound:',_0xe96206[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')](_0xaad8('0x3f'),_0xe96206['name']),_0xaad8('0x4c'),{'sessionId':_0x586a15,'transferNumber':_0x500df3});return _0xb71d6f['status'](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x4d')});})['catch'](handleError(_0xb71d6f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 62094a1..71a44ab 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacf4=['./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id/dispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a8a87,_0x1579d5){var _0x3a110f=function(_0x1f9824){while(--_0x1f9824){_0x3a8a87['push'](_0x3a8a87['shift']());}};_0x3a110f(++_0x1579d5);}(_0xacf4,0xe7));var _0x4acf=function(_0x2b8722,_0x50d540){_0x2b8722=_0x2b8722-0x0;var _0x20c180=_0xacf4[_0x2b8722];return _0x20c180;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id',auth[_0x4acf('0xb')](),controller['show']);router[_0x4acf('0x8')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['getDispositions']);router[_0x4acf('0x8')](_0x4acf('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4acf('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0xf')]);router[_0x4acf('0x8')](_0x4acf('0x10'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x11')]);router[_0x4acf('0x12')]('/',auth[_0x4acf('0xb')](),controller[_0x4acf('0x13')]);router[_0x4acf('0x12')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['addDisposition']);router[_0x4acf('0x12')]('/:id/canned_answers',auth[_0x4acf('0xb')](),controller[_0x4acf('0x14')]);router[_0x4acf('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0x15')]);router[_0x4acf('0x12')](_0x4acf('0x10'),auth['isAuthenticated'](),controller[_0x4acf('0x16')]);router[_0x4acf('0x12')](_0x4acf('0x17'),controller[_0x4acf('0x18')]);router[_0x4acf('0x12')](_0x4acf('0x19'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x1a')]);router[_0x4acf('0x1b')](_0x4acf('0x1c'),auth[_0x4acf('0xb')](),controller['update']);router[_0x4acf('0x1d')](_0x4acf('0x1c'),auth['isAuthenticated'](),controller[_0x4acf('0x1e')]);router[_0x4acf('0x1d')]('/:id/dispositions',auth[_0x4acf('0xb')](),controller[_0x4acf('0x1f')]);router[_0x4acf('0x1d')](_0x4acf('0xe'),auth['isAuthenticated'](),controller[_0x4acf('0x20')]);router[_0x4acf('0x1d')]('/:id/users',auth[_0x4acf('0xb')](),controller[_0x4acf('0x21')]);module['exports']=router; \ No newline at end of file +var _0x1623=['destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappAccount.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','/:id/dispositions','addAgents','/:id/notify','notify','update'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x1623,0xab));var _0x3162=function(_0xe20fb,_0x35cbd1){_0xe20fb=_0xe20fb-0x0;var _0x4a51c5=_0x1623[_0xe20fb];return _0x4a51c5;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3162('0xe')]);router[_0x3162('0xb')](_0x3162('0xf'),auth[_0x3162('0x7')](),controller[_0x3162('0x10')]);router[_0x3162('0xb')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x12')]);router['get'](_0x3162('0x13'),auth['isAuthenticated'](),controller[_0x3162('0x14')]);router[_0x3162('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3162('0x15')](_0x3162('0x16'),auth[_0x3162('0x7')](),controller['addDisposition']);router[_0x3162('0x15')](_0x3162('0xf'),auth[_0x3162('0x7')](),controller['addAnswer']);router[_0x3162('0x15')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x17')]);router[_0x3162('0x15')](_0x3162('0x13'),auth[_0x3162('0x7')](),controller['addApplications']);router[_0x3162('0x15')](_0x3162('0x18'),controller[_0x3162('0x19')]);router[_0x3162('0x15')]('/:id/send',auth[_0x3162('0x7')](),controller['send']);router['put'](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0x1a')]);router['delete']('/:id',auth[_0x3162('0x7')](),controller[_0x3162('0x1b')]);router[_0x3162('0x1c')](_0x3162('0x16'),auth[_0x3162('0x7')](),controller[_0x3162('0x1d')]);router[_0x3162('0x1c')](_0x3162('0xf'),auth['isAuthenticated'](),controller[_0x3162('0x1e')]);router[_0x3162('0x1c')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x1f')]);module[_0x3162('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 6c8c805..0f6c17e 100644 --- a/server/api/whatsappAccount/whatsappAccount.attributes.js +++ b/server/api/whatsappAccount/whatsappAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5a8=['TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','randomstring','name','STRING','ENUM','twilio','sinch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc5a8,0x192));var _0x8c5a=function(_0x381b29,_0x1f7840){_0x381b29=_0x381b29-0x0;var _0x1a5e32=_0xc5a8[_0x381b29];return _0x1a5e32;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8c5a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8c5a('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x8c5a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x8c5a('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x8c5a('0x2')]},'type':{'type':Sequelize[_0x8c5a('0x3')](_0x8c5a('0x4'),_0x8c5a('0x5'))},'accountSid':{'type':Sequelize[_0x8c5a('0x2')]},'baseUrl':{'type':Sequelize[_0x8c5a('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8c5a('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8c5a('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8c5a('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8c5a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8c5a('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8c5a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8c5a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8c5a('0x8')],'comment':_0x8c5a('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x8c5a('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x27250f){if(!_0x27250f){this[_0x8c5a('0xa')](_0x8c5a('0xb'),null);}this[_0x8c5a('0xa')]('mandatoryDisposition',_0x27250f);}},'description':{'type':Sequelize[_0x8c5a('0x2')]}}; \ No newline at end of file +var _0xfbcb=['twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','generate','ENUM'];(function(_0x5b0a86,_0x3217bc){var _0xa8e795=function(_0x851c63){while(--_0x851c63){_0x5b0a86['push'](_0x5b0a86['shift']());}};_0xa8e795(++_0x3217bc);}(_0xfbcb,0xdc));var _0xbfbc=function(_0x5d8921,_0xf1a411){_0x5d8921=_0x5d8921-0x0;var _0x2c5dde=_0xfbcb[_0x5d8921];return _0x2c5dde;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xbfbc('0x0')]={'name':{'type':Sequelize[_0xbfbc('0x1')],'unique':_0xbfbc('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xbfbc('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xbfbc('0x1')],'defaultValue':function(){return rs[_0xbfbc('0x3')]();}},'phone':{'type':Sequelize[_0xbfbc('0x1')]},'type':{'type':Sequelize[_0xbfbc('0x4')](_0xbfbc('0x5'),_0xbfbc('0x6'))},'accountSid':{'type':Sequelize[_0xbfbc('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xbfbc('0x1')]},'notificationTemplate':{'type':Sequelize[_0xbfbc('0x7')],'defaultValue':function(){return _0xbfbc('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xbfbc('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbfbc('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbfbc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbfbc('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbfbc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xbfbc('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5075d0){if(!_0x5075d0){this[_0xbfbc('0xc')](_0xbfbc('0xd'),null);}this[_0xbfbc('0xc')](_0xbfbc('0xe'),_0x5075d0);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index aa27710..2a9cdc9 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96f9=['where','merge','type','options','includeAll','include','rows','show','params','keys','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','Disposition','getDispositions','findOne','pick','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','replace','whatsapp:','Body','messageId','from','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','ContactId','AttachmentId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','WhatsappAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter'];(function(_0x3b514c,_0x222cb9){var _0x4bc10f=function(_0x5cc13d){while(--_0x5cc13d){_0x3b514c['push'](_0x3b514c['shift']());}};_0x4bc10f(++_0x222cb9);}(_0x96f9,0x13f));var _0x996f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x96f9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x996f('0x0'));var rimraf=require(_0x996f('0x1'));var zipdir=require(_0x996f('0x2'));var jsonpatch=require(_0x996f('0x3'));var rp=require(_0x996f('0x4'));var moment=require(_0x996f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x996f('0x6'));var util=require(_0x996f('0x7'));var path=require(_0x996f('0x8'));var sox=require(_0x996f('0x9'));var csv=require(_0x996f('0xa'));var ejs=require(_0x996f('0xb'));var fs=require('fs');var fs_extra=require(_0x996f('0xc'));var _=require(_0x996f('0xd'));var squel=require('squel');var crypto=require(_0x996f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x996f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x996f('0x10'));var Papa=require(_0x996f('0x11'));var Redis=require(_0x996f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x996f('0x13'));var logger=require(_0x996f('0x14'))(_0x996f('0x15'));var utils=require(_0x996f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x996f('0x17'))['db'];config[_0x996f('0x18')]=_['defaults'](config[_0x996f('0x18')],{'host':_0x996f('0x19'),'port':0x18eb});var socket=require(_0x996f('0x1a'))(new Redis(config[_0x996f('0x18')]));require(_0x996f('0x1b'))[_0x996f('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x996f('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x4340e4,_0x4af5a3,_0x524f95,_0x40b39a){return new BPromise(function(_0x3afa55,_0x282fa5){var _0x2f8257=_0x40b39a||client;return _0x2f8257[_0x996f('0x1e')](_0x4340e4,_0x524f95)['then'](function(_0x5c378c){logger[_0x996f('0x1f')](_0x996f('0x20'),_0x4af5a3,_0x996f('0x21'));logger[_0x996f('0x22')](_0x996f('0x23'),_0x4af5a3,_0x996f('0x21'),JSON[_0x996f('0x24')](_0x5c378c));if(_0x5c378c[_0x996f('0x25')]){if(_0x5c378c[_0x996f('0x25')][_0x996f('0x26')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4af5a3,_0x5c378c[_0x996f('0x25')][_0x996f('0x27')]);return _0x282fa5(_0x5c378c[_0x996f('0x25')][_0x996f('0x27')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4af5a3,_0x5c378c['error'][_0x996f('0x27')]);return _0x3afa55(_0x5c378c[_0x996f('0x25')][_0x996f('0x27')]);}else{logger[_0x996f('0x1f')](_0x996f('0x20'),_0x4af5a3,_0x996f('0x21'));_0x3afa55(_0x5c378c[_0x996f('0x28')][_0x996f('0x27')]);}})[_0x996f('0x29')](function(_0x2925d8){logger[_0x996f('0x25')](_0x996f('0x20'),_0x4af5a3,_0x2925d8);_0x282fa5(_0x2925d8);});});}function respondWithStatusCode(_0x526986,_0x3d27b6){_0x3d27b6=_0x3d27b6||0xcc;return function(_0x2f847c){if(_0x2f847c){return _0x526986[_0x996f('0x2a')](_0x3d27b6);}return _0x526986[_0x996f('0x2b')](_0x3d27b6)[_0x996f('0x2c')]();};}function respondWithResult(_0x455aac,_0x4ebb78){_0x4ebb78=_0x4ebb78||0xc8;return function(_0x10d2bf){if(_0x10d2bf){return _0x455aac[_0x996f('0x2b')](_0x4ebb78)[_0x996f('0x2d')](_0x10d2bf);}};}function respondWithFilteredResult(_0x272bb6,_0x11f30d){return function(_0x1899a9){if(_0x1899a9){var _0x1faf8c=typeof _0x11f30d[_0x996f('0x2e')]==='undefined'&&typeof _0x11f30d[_0x996f('0x2f')]==='undefined';var _0x46455d=_0x1899a9['count'];var _0x8f3d47=_0x1faf8c?0x0:_0x11f30d['offset'];var _0x393073=_0x1faf8c?_0x1899a9[_0x996f('0x30')]:_0x11f30d[_0x996f('0x2e')]+_0x11f30d[_0x996f('0x2f')];var _0x5c863d;if(_0x393073>=_0x46455d){_0x393073=_0x46455d;_0x5c863d=0xc8;}else{_0x5c863d=0xce;}_0x272bb6[_0x996f('0x2b')](_0x5c863d);return _0x272bb6[_0x996f('0x31')](_0x996f('0x32'),_0x8f3d47+'-'+_0x393073+'/'+_0x46455d)[_0x996f('0x2d')](_0x1899a9);}return null;};}function patchUpdates(_0x53f7cc){return function(_0x23df1e){try{jsonpatch[_0x996f('0x33')](_0x23df1e,_0x53f7cc,!![]);}catch(_0x4f91d1){return BPromise[_0x996f('0x34')](_0x4f91d1);}return _0x23df1e[_0x996f('0x35')]();};}function saveUpdates(_0x256e1b,_0x34474c){return function(_0xefd7b4){if(_0xefd7b4){return _0xefd7b4[_0x996f('0x36')](_0x256e1b)['then'](function(_0x3be094){return _0x3be094;});}return null;};}function removeEntity(_0xf717bd,_0x44e51c){return function(_0x16f8d3){if(_0x16f8d3){return _0x16f8d3[_0x996f('0x37')]()[_0x996f('0x38')](function(){var _0x4f490f=_0x16f8d3['get']({'plain':!![]});var _0x30eebd=_0x996f('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x30eebd,'resourceId':_0x4f490f['id']}})[_0x996f('0x38')](function(){return _0x16f8d3;});})[_0x996f('0x38')](function(){_0xf717bd[_0x996f('0x2b')](0xcc)[_0x996f('0x2c')]();});}};}function handleEntityNotFound(_0x51db1b,_0x38af94){return function(_0x1a796e){if(!_0x1a796e){_0x51db1b[_0x996f('0x2a')](0x194);}return _0x1a796e;};}function handleError(_0x5b2b77,_0xadbdd7){_0xadbdd7=_0xadbdd7||0x1f4;return function(_0x40ba6a){logger[_0x996f('0x25')](_0x40ba6a[_0x996f('0x3a')]);if(_0x40ba6a[_0x996f('0x3b')]){delete _0x40ba6a[_0x996f('0x3b')];}_0x5b2b77['status'](_0xadbdd7)[_0x996f('0x3c')](_0x40ba6a);};}exports[_0x996f('0x3d')]=function(_0x4a4780,_0xc8844d){var _0x293a87={'include':[{'model':db[_0x996f('0x3e')],'as':_0x996f('0x3f')}]},_0x66c0d7={},_0x27d0c9={'count':0x0,'rows':[]};var _0x4ee61f=_[_0x996f('0x40')](db[_0x996f('0x41')][_0x996f('0x42')],function(_0x51e2f5){return{'name':_0x51e2f5[_0x996f('0x43')],'type':_0x51e2f5['type']['key']};});_0x66c0d7[_0x996f('0x44')]=_['map'](_0x4ee61f,'name');_0x66c0d7[_0x996f('0x45')]=_['keys'](_0x4a4780[_0x996f('0x45')]);_0x66c0d7['filters']=_[_0x996f('0x46')](_0x66c0d7['model'],_0x66c0d7['query']);_0x293a87[_0x996f('0x47')]=_[_0x996f('0x46')](_0x66c0d7[_0x996f('0x44')],qs[_0x996f('0x48')](_0x4a4780[_0x996f('0x45')][_0x996f('0x48')]));_0x293a87['attributes']=_0x293a87[_0x996f('0x47')]['length']?_0x293a87[_0x996f('0x47')]:_0x66c0d7[_0x996f('0x44')];if(!_0x4a4780[_0x996f('0x45')][_0x996f('0x49')](_0x996f('0x4a'))){_0x293a87[_0x996f('0x2f')]=qs['limit'](_0x4a4780[_0x996f('0x45')][_0x996f('0x2f')]);_0x293a87[_0x996f('0x2e')]=qs['offset'](_0x4a4780[_0x996f('0x45')][_0x996f('0x2e')]);}_0x293a87[_0x996f('0x4b')]=qs[_0x996f('0x4c')](_0x4a4780['query'][_0x996f('0x4c')]);_0x293a87['where']=qs[_0x996f('0x4d')](_['pick'](_0x4a4780[_0x996f('0x45')],_0x66c0d7[_0x996f('0x4d')]),_0x4ee61f);if(_0x4a4780[_0x996f('0x45')][_0x996f('0x4e')]){_0x293a87[_0x996f('0x4f')]=_[_0x996f('0x50')](_0x293a87['where'],{'$or':_[_0x996f('0x40')](_0x4ee61f,function(_0x1ccb2b){if(_0x1ccb2b[_0x996f('0x51')]!=='VIRTUAL'){var _0x4f891a={};_0x4f891a[_0x1ccb2b[_0x996f('0x3b')]]={'$like':'%'+_0x4a4780[_0x996f('0x45')][_0x996f('0x4e')]+'%'};return _0x4f891a;}})});}_0x293a87=_[_0x996f('0x50')]({},_0x293a87,_0x4a4780[_0x996f('0x52')]);var _0x13ceb2={'where':_0x293a87[_0x996f('0x4f')]};return db[_0x996f('0x41')][_0x996f('0x30')](_0x13ceb2)[_0x996f('0x38')](function(_0x575276){_0x27d0c9[_0x996f('0x30')]=_0x575276;if(_0x4a4780['query'][_0x996f('0x53')]){_0x293a87[_0x996f('0x54')]=[{'all':!![]}];}return db[_0x996f('0x41')]['findAll'](_0x293a87);})[_0x996f('0x38')](function(_0x360ba1){_0x27d0c9[_0x996f('0x55')]=_0x360ba1;return _0x27d0c9;})[_0x996f('0x38')](respondWithFilteredResult(_0xc8844d,_0x293a87))[_0x996f('0x29')](handleError(_0xc8844d,null));};exports[_0x996f('0x56')]=function(_0x576860,_0x5cff9f){var _0x37032c={'raw':![],'where':{'id':_0x576860[_0x996f('0x57')]['id']},'include':[{'model':db[_0x996f('0x3e')],'as':_0x996f('0x3f')}]},_0xfb69d7={};_0xfb69d7[_0x996f('0x44')]=_[_0x996f('0x58')](db['WhatsappAccount']['rawAttributes']);_0xfb69d7['query']=_[_0x996f('0x58')](_0x576860[_0x996f('0x45')]);_0xfb69d7['filters']=_[_0x996f('0x46')](_0xfb69d7[_0x996f('0x44')],_0xfb69d7[_0x996f('0x45')]);_0x37032c[_0x996f('0x47')]=_[_0x996f('0x46')](_0xfb69d7['model'],qs['fields'](_0x576860['query'][_0x996f('0x48')]));_0x37032c[_0x996f('0x47')]=_0x37032c[_0x996f('0x47')][_0x996f('0x59')]?_0x37032c[_0x996f('0x47')]:_0xfb69d7[_0x996f('0x44')];if(_0x576860[_0x996f('0x45')][_0x996f('0x53')]){_0x37032c[_0x996f('0x54')]=[{'all':!![]}];}_0x37032c=_[_0x996f('0x50')]({},_0x37032c,_0x576860['options']);return db['WhatsappAccount'][_0x996f('0x5a')](_0x37032c)[_0x996f('0x38')](handleEntityNotFound(_0x5cff9f,null))[_0x996f('0x38')](respondWithResult(_0x5cff9f,null))['catch'](handleError(_0x5cff9f,null));};exports[_0x996f('0x5b')]=function(_0x4b4d4b,_0x2c2db9){return db['WhatsappAccount'][_0x996f('0x5b')](_0x4b4d4b[_0x996f('0x5c')],{})[_0x996f('0x38')](function(_0x5486b5){var _0x48ca1d=_0x4b4d4b[_0x996f('0x5d')][_0x996f('0x5e')]({'plain':!![]});if(!_0x48ca1d)throw new Error(_0x996f('0x5f'));if(_0x48ca1d[_0x996f('0x60')]===_0x996f('0x5d')){var _0x520464=_0x5486b5[_0x996f('0x5e')]({'plain':!![]});var _0x41199f='WhatsappAccounts';return db[_0x996f('0x61')][_0x996f('0x5a')]({'where':{'name':_0x41199f,'userProfileId':_0x48ca1d[_0x996f('0x62')]},'raw':!![]})[_0x996f('0x38')](function(_0x2a8503){if(_0x2a8503&&_0x2a8503['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x520464[_0x996f('0x3b')],'resourceId':_0x520464['id'],'type':_0x2a8503[_0x996f('0x3b')],'sectionId':_0x2a8503['id']},{})['then'](function(){return _0x5486b5;});}else{return _0x5486b5;}})[_0x996f('0x29')](function(_0x3a86cd){logger[_0x996f('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a86cd);throw _0x3a86cd;});}return _0x5486b5;})[_0x996f('0x38')](respondWithResult(_0x2c2db9,0xc9))[_0x996f('0x29')](handleError(_0x2c2db9,null));};exports['update']=function(_0x38c24c,_0x273529){if(_0x38c24c[_0x996f('0x5c')]['id']){delete _0x38c24c[_0x996f('0x5c')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x38c24c['params']['id']},'include':[{'model':db[_0x996f('0x3e')],'as':_0x996f('0x3f')}]})[_0x996f('0x38')](handleEntityNotFound(_0x273529,null))[_0x996f('0x38')](saveUpdates(_0x38c24c['body'],null))['then'](respondWithResult(_0x273529,null))[_0x996f('0x29')](handleError(_0x273529,null));};exports[_0x996f('0x37')]=function(_0x38f280,_0x2a1f0d){return db[_0x996f('0x41')][_0x996f('0x5a')]({'where':{'id':_0x38f280['params']['id']}})[_0x996f('0x38')](handleEntityNotFound(_0x2a1f0d,null))['then'](removeEntity(_0x2a1f0d,null))[_0x996f('0x29')](handleError(_0x2a1f0d,null));};exports[_0x996f('0x63')]=function(_0x14b338,_0x18efe6){return db[_0x996f('0x41')][_0x996f('0x63')]()[_0x996f('0x38')](respondWithResult(_0x18efe6,null))['catch'](handleError(_0x18efe6,null));};exports['addDisposition']=function(_0x14c854,_0x333f97,_0x3f8cdb){if(_0x14c854[_0x996f('0x5c')]['id']){delete _0x14c854[_0x996f('0x5c')]['id'];}return db[_0x996f('0x41')][_0x996f('0x5a')]({'where':{'id':_0x14c854[_0x996f('0x57')]['id']}})[_0x996f('0x38')](handleEntityNotFound(_0x333f97,null))[_0x996f('0x38')](function(_0x125934){if(_0x125934){_0x14c854[_0x996f('0x5c')]['WhatsappAccountId']=_0x125934['id'];return db[_0x996f('0x64')]['create'](_0x14c854[_0x996f('0x5c')]);}})[_0x996f('0x38')](respondWithResult(_0x333f97,null))['catch'](handleError(_0x333f97,null));};exports[_0x996f('0x65')]=function(_0xde8de6,_0x241338,_0x3be9cd){var _0x1a94eb={'raw':![],'where':{}};var _0x18941d={};var _0x2a99c7={'count':0x0,'rows':[]};return db[_0x996f('0x41')][_0x996f('0x66')]({'where':{'id':_0xde8de6['params']['id']}})['then'](handleEntityNotFound(_0x241338,null))['then'](function(_0x34579){if(_0x34579){_0x18941d[_0x996f('0x44')]=_[_0x996f('0x58')](db[_0x996f('0x64')]['rawAttributes']);_0x18941d[_0x996f('0x45')]=_[_0x996f('0x58')](_0xde8de6['query']);_0x18941d[_0x996f('0x4d')]=_[_0x996f('0x46')](_0x18941d[_0x996f('0x44')],_0x18941d[_0x996f('0x45')]);_0x1a94eb['attributes']=_[_0x996f('0x46')](_0x18941d[_0x996f('0x44')],qs[_0x996f('0x48')](_0xde8de6['query']['fields']));_0x1a94eb[_0x996f('0x47')]=_0x1a94eb[_0x996f('0x47')]['length']?_0x1a94eb[_0x996f('0x47')]:_0x18941d[_0x996f('0x44')];if(!_0xde8de6[_0x996f('0x45')]['hasOwnProperty'](_0x996f('0x4a'))){_0x1a94eb['limit']=qs[_0x996f('0x2f')](_0xde8de6[_0x996f('0x45')][_0x996f('0x2f')]);_0x1a94eb[_0x996f('0x2e')]=qs[_0x996f('0x2e')](_0xde8de6[_0x996f('0x45')][_0x996f('0x2e')]);}_0x1a94eb[_0x996f('0x4b')]=qs['sort'](_0xde8de6['query'][_0x996f('0x4c')]);_0x1a94eb[_0x996f('0x4f')]=qs[_0x996f('0x4d')](_[_0x996f('0x67')](_0xde8de6[_0x996f('0x45')],_0x18941d[_0x996f('0x4d')]));_0x1a94eb[_0x996f('0x4f')][_0x996f('0x68')]=_0x34579['id'];if(_0xde8de6['query'][_0x996f('0x4e')]){_0x1a94eb[_0x996f('0x4f')]=_[_0x996f('0x50')](_0x1a94eb[_0x996f('0x4f')],{'$or':_['map'](_0x1a94eb['attributes'],function(_0x467d10){var _0x475637={};_0x475637[_0x467d10]={'$like':'%'+_0xde8de6[_0x996f('0x45')][_0x996f('0x4e')]+'%'};return _0x475637;})});}_0x1a94eb=_[_0x996f('0x50')]({},_0x1a94eb,_0xde8de6[_0x996f('0x52')]);return db['Disposition'][_0x996f('0x30')]({'where':_0x1a94eb['where']})[_0x996f('0x38')](function(_0x6fff){_0x2a99c7[_0x996f('0x30')]=_0x6fff;if(_0xde8de6[_0x996f('0x45')][_0x996f('0x53')]){_0x1a94eb['include']=[{'all':!![]}];}return db[_0x996f('0x64')]['findAll'](_0x1a94eb);})['then'](function(_0x2bcf35){_0x2a99c7['rows']=_0x2bcf35;return _0x2a99c7;});}})[_0x996f('0x38')](respondWithFilteredResult(_0x241338,_0x1a94eb))[_0x996f('0x29')](handleError(_0x241338,null));};exports[_0x996f('0x69')]=function(_0x29b1ec,_0x4fac2c,_0x2a0b12){return db[_0x996f('0x41')][_0x996f('0x5a')]({'where':{'id':_0x29b1ec['params']['id']}})[_0x996f('0x38')](handleEntityNotFound(_0x4fac2c,null))[_0x996f('0x38')](function(_0x1c52e7){if(_0x1c52e7){return _0x1c52e7['removeDispositions'](_0x29b1ec[_0x996f('0x45')][_0x996f('0x6a')]);}})[_0x996f('0x38')](respondWithStatusCode(_0x4fac2c,null))[_0x996f('0x29')](handleError(_0x4fac2c,null));};exports[_0x996f('0x6b')]=function(_0x129107,_0x5ac081,_0x58b81d){if(_0x129107[_0x996f('0x5c')]['id']){delete _0x129107['body']['id'];}return db[_0x996f('0x41')]['find']({'where':{'id':_0x129107[_0x996f('0x57')]['id']}})['then'](handleEntityNotFound(_0x5ac081,null))[_0x996f('0x38')](function(_0x2e6633){if(_0x2e6633){_0x129107[_0x996f('0x5c')][_0x996f('0x68')]=_0x2e6633['id'];return db[_0x996f('0x6c')]['create'](_0x129107[_0x996f('0x5c')]);}})[_0x996f('0x38')](respondWithResult(_0x5ac081,null))[_0x996f('0x29')](handleError(_0x5ac081,null));};exports[_0x996f('0x6d')]=function(_0x2cc83b,_0x4679d0,_0x2583ad){var _0xe38f0b={'raw':![],'where':{}};var _0x532a3b={};var _0x403003={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x996f('0x66')]({'where':{'id':_0x2cc83b['params']['id']}})[_0x996f('0x38')](handleEntityNotFound(_0x4679d0,null))[_0x996f('0x38')](function(_0x3a4dc2){if(_0x3a4dc2){_0x532a3b[_0x996f('0x44')]=_[_0x996f('0x58')](db['CannedAnswer']['rawAttributes']);_0x532a3b[_0x996f('0x45')]=_[_0x996f('0x58')](_0x2cc83b['query']);_0x532a3b[_0x996f('0x4d')]=_['intersection'](_0x532a3b[_0x996f('0x44')],_0x532a3b[_0x996f('0x45')]);_0xe38f0b[_0x996f('0x47')]=_[_0x996f('0x46')](_0x532a3b[_0x996f('0x44')],qs['fields'](_0x2cc83b[_0x996f('0x45')]['fields']));_0xe38f0b[_0x996f('0x47')]=_0xe38f0b[_0x996f('0x47')]['length']?_0xe38f0b[_0x996f('0x47')]:_0x532a3b['model'];if(!_0x2cc83b[_0x996f('0x45')][_0x996f('0x49')](_0x996f('0x4a'))){_0xe38f0b['limit']=qs[_0x996f('0x2f')](_0x2cc83b[_0x996f('0x45')][_0x996f('0x2f')]);_0xe38f0b[_0x996f('0x2e')]=qs[_0x996f('0x2e')](_0x2cc83b[_0x996f('0x45')][_0x996f('0x2e')]);}_0xe38f0b[_0x996f('0x4b')]=qs['sort'](_0x2cc83b[_0x996f('0x45')]['sort']);_0xe38f0b['where']=qs[_0x996f('0x4d')](_[_0x996f('0x67')](_0x2cc83b[_0x996f('0x45')],_0x532a3b['filters']));_0xe38f0b[_0x996f('0x4f')][_0x996f('0x68')]=_0x3a4dc2['id'];if(_0x2cc83b[_0x996f('0x45')][_0x996f('0x4e')]){_0xe38f0b[_0x996f('0x4f')]=_[_0x996f('0x50')](_0xe38f0b[_0x996f('0x4f')],{'$or':_[_0x996f('0x40')](_0xe38f0b[_0x996f('0x47')],function(_0x4c1951){var _0x3b6c31={};_0x3b6c31[_0x4c1951]={'$like':'%'+_0x2cc83b[_0x996f('0x45')][_0x996f('0x4e')]+'%'};return _0x3b6c31;})});}_0xe38f0b=_['merge']({},_0xe38f0b,_0x2cc83b[_0x996f('0x52')]);return db[_0x996f('0x6c')][_0x996f('0x30')]({'where':_0xe38f0b[_0x996f('0x4f')]})['then'](function(_0x585263){_0x403003[_0x996f('0x30')]=_0x585263;if(_0x2cc83b['query'][_0x996f('0x53')]){_0xe38f0b[_0x996f('0x54')]=[{'all':!![]}];}return db[_0x996f('0x6c')][_0x996f('0x6e')](_0xe38f0b);})[_0x996f('0x38')](function(_0x38dad9){_0x403003['rows']=_0x38dad9;return _0x403003;});}})[_0x996f('0x38')](respondWithFilteredResult(_0x4679d0,_0xe38f0b))[_0x996f('0x29')](handleError(_0x4679d0,null));};exports['removeAnswers']=function(_0x47a962,_0x4708a6,_0x36e51b){return db['WhatsappAccount'][_0x996f('0x5a')]({'where':{'id':_0x47a962[_0x996f('0x57')]['id']}})[_0x996f('0x38')](handleEntityNotFound(_0x4708a6,null))[_0x996f('0x38')](function(_0x2d20d7){if(_0x2d20d7){return _0x2d20d7[_0x996f('0x6f')](_0x47a962['query'][_0x996f('0x6a')]);}})[_0x996f('0x38')](respondWithStatusCode(_0x4708a6,null))[_0x996f('0x29')](handleError(_0x4708a6,null));};exports[_0x996f('0x70')]=function(_0x1f3e82,_0x5216f7,_0x5265bb){return db['WhatsappAccount'][_0x996f('0x5a')]({'where':{'id':_0x1f3e82['params']['id']}})['then'](handleEntityNotFound(_0x5216f7,null))[_0x996f('0x38')](function(_0x35db58){if(_0x35db58){return _0x35db58[_0x996f('0x70')](_0x1f3e82[_0x996f('0x5c')][_0x996f('0x6a')],_[_0x996f('0x71')](_0x1f3e82[_0x996f('0x5c')],[_0x996f('0x6a'),'id'])||{})[_0x996f('0x72')](function(_0x1510ea){for(var _0x38456c=0x0;_0x38456c<_0x1f3e82[_0x996f('0x5c')][_0x996f('0x6a')][_0x996f('0x59')];_0x38456c+=0x1){socket[_0x996f('0x73')](_0x996f('0x74'),{'UserId':Number(_0x1f3e82['body'][_0x996f('0x6a')][_0x38456c]),'WhatsappAccountId':Number(_0x1f3e82['params']['id'])});}return _0x1510ea;});}})[_0x996f('0x38')](respondWithResult(_0x5216f7,null))['catch'](handleError(_0x5216f7,null));};exports[_0x996f('0x75')]=function(_0x6dc308,_0x2d9ee0,_0x502f0c){return db[_0x996f('0x41')][_0x996f('0x5a')]({'where':{'id':_0x6dc308[_0x996f('0x57')]['id']}})[_0x996f('0x38')](handleEntityNotFound(_0x2d9ee0,null))['then'](function(_0x422f9){if(_0x422f9){return _0x422f9[_0x996f('0x75')](_0x6dc308['query'][_0x996f('0x6a')])[_0x996f('0x38')](function(){if(_[_0x996f('0x76')](_0x6dc308[_0x996f('0x45')][_0x996f('0x6a')])){for(var _0x18d348=0x0;_0x18d348<_0x6dc308[_0x996f('0x45')][_0x996f('0x6a')][_0x996f('0x59')];_0x18d348+=0x1){socket[_0x996f('0x73')](_0x996f('0x77'),{'UserId':Number(_0x6dc308['query']['ids'][_0x18d348]),'WhatsappAccountId':Number(_0x6dc308[_0x996f('0x57')]['id'])});}}else{socket[_0x996f('0x73')](_0x996f('0x77'),{'UserId':Number(_0x6dc308['query'][_0x996f('0x6a')]),'WhatsappAccountId':Number(_0x6dc308[_0x996f('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x2d9ee0,null))['catch'](handleError(_0x2d9ee0,null));};exports['getAgents']=function(_0x515339,_0x32b139,_0x3cc605){var _0xc34e20={};var _0x2af0ed={};var _0xbe63b8;var _0x3dfcef;return db[_0x996f('0x41')][_0x996f('0x66')]({'where':{'id':_0x515339[_0x996f('0x57')]['id']}})['then'](handleEntityNotFound(_0x32b139,null))['then'](function(_0x554bce){if(_0x554bce){_0xbe63b8=_0x554bce;_0x2af0ed['model']=_[_0x996f('0x58')](db[_0x996f('0x78')][_0x996f('0x42')]);_0x2af0ed[_0x996f('0x45')]=_[_0x996f('0x58')](_0x515339[_0x996f('0x45')]);_0x2af0ed['filters']=_[_0x996f('0x46')](_0x2af0ed[_0x996f('0x44')],_0x2af0ed[_0x996f('0x45')]);_0xc34e20[_0x996f('0x47')]=_[_0x996f('0x46')](_0x2af0ed[_0x996f('0x44')],qs[_0x996f('0x48')](_0x515339[_0x996f('0x45')][_0x996f('0x48')]));_0xc34e20[_0x996f('0x47')]=_0xc34e20[_0x996f('0x47')][_0x996f('0x59')]?_0xc34e20[_0x996f('0x47')]:_0x2af0ed[_0x996f('0x44')];_0xc34e20[_0x996f('0x4b')]=qs[_0x996f('0x4c')](_0x515339[_0x996f('0x45')][_0x996f('0x4c')]);_0xc34e20[_0x996f('0x4f')]=qs['filters'](_[_0x996f('0x67')](_0x515339[_0x996f('0x45')],_0x2af0ed[_0x996f('0x4d')]));if(_0x515339[_0x996f('0x45')]['filter']){_0xc34e20['where']=_[_0x996f('0x50')](_0xc34e20[_0x996f('0x4f')],{'$or':_[_0x996f('0x40')](_0xc34e20[_0x996f('0x47')],function(_0xe92446){var _0x1e464e={};_0x1e464e[_0xe92446]={'$like':'%'+_0x515339[_0x996f('0x45')]['filter']+'%'};return _0x1e464e;})});}_0xc34e20=_[_0x996f('0x50')]({},_0xc34e20,_0x515339[_0x996f('0x52')]);return _0xbe63b8[_0x996f('0x79')](_0xc34e20);}})[_0x996f('0x38')](function(_0x1a78a9){if(_0x1a78a9){_0x3dfcef=_0x1a78a9[_0x996f('0x59')];if(!_0x515339[_0x996f('0x45')]['hasOwnProperty'](_0x996f('0x4a'))){_0xc34e20[_0x996f('0x2f')]=qs[_0x996f('0x2f')](_0x515339[_0x996f('0x45')][_0x996f('0x2f')]);_0xc34e20['offset']=qs[_0x996f('0x2e')](_0x515339[_0x996f('0x45')][_0x996f('0x2e')]);}return _0xbe63b8[_0x996f('0x79')](_0xc34e20);}})[_0x996f('0x38')](function(_0x2415c0){if(_0x2415c0){return _0x2415c0?{'count':_0x3dfcef,'rows':_0x2415c0}:null;}})[_0x996f('0x38')](respondWithResult(_0x32b139,null))[_0x996f('0x29')](handleError(_0x32b139,null));};exports[_0x996f('0x7a')]=function(_0x475992,_0x1c7472){var _0x232c0e=_0x475992['params']['id'];var _0x11d11a=_0x475992[_0x996f('0x5c')];var _0x21fe42=0xc8;var _0x21cd93=null;return db[_0x996f('0x7b')]['transaction']({'isolationLevel':db[_0x996f('0x7b')][_0x996f('0x7c')][_0x996f('0x7d')][_0x996f('0x7e')]},function(_0x5efa1a){return db[_0x996f('0x41')][_0x996f('0x66')]({'where':{'id':_0x232c0e},'transaction':_0x5efa1a})[_0x996f('0x38')](function(_0x23db07){if(_0x23db07){return db[_0x996f('0x7f')][_0x996f('0x37')]({'where':{'WhatsappAccountId':_0x232c0e},'transaction':_0x5efa1a})[_0x996f('0x38')](function(){var _0x48c823=_['map'](_0x11d11a,function(_0xaad18a){_0xaad18a[_0x996f('0x68')]=_0x232c0e;return _0xaad18a;});return db[_0x996f('0x7f')][_0x996f('0x80')](_0x48c823,{'transaction':_0x5efa1a});});}else{_0x21fe42=0x194;_0x21cd93=[];}});})['then'](function(){if(_0x21fe42!==0x194){return db[_0x996f('0x7f')][_0x996f('0x81')]({'where':{'WhatsappAccountId':_0x232c0e},'order':_0x996f('0x82')})[_0x996f('0x38')](function(_0x2cf9f3){_0x21cd93=_0x2cf9f3;});}})[_0x996f('0x29')](function(_0x127bc1){_0x21fe42=0x1f4;logger[_0x996f('0x25')](_0x127bc1['stack']);if(_0x127bc1[_0x996f('0x3b')]){delete _0x127bc1[_0x996f('0x3b')];}_0x21cd93=_0x127bc1;})[_0x996f('0x83')](function(){if(_0x21cd93===null){_0x1c7472['sendStatus'](_0x21fe42);}else{if(_0x21fe42===0x1f4){_0x1c7472[_0x996f('0x2b')](_0x21fe42)[_0x996f('0x3c')](_0x21cd93);}else{_0x1c7472[_0x996f('0x2b')](_0x21fe42)[_0x996f('0x2d')](_0x21cd93);}}});};exports[_0x996f('0x84')]=function(_0x359f32,_0x4e8043,_0x4b45c1){var _0x35d33f={};var _0x2a0e95={};var _0x1dbbaf;var _0x146c59;return db[_0x996f('0x41')][_0x996f('0x66')]({'where':{'id':_0x359f32[_0x996f('0x57')]['id']}})[_0x996f('0x38')](handleEntityNotFound(_0x4e8043,null))[_0x996f('0x38')](function(_0x75e7b2){if(_0x75e7b2){_0x1dbbaf=_0x75e7b2;_0x2a0e95[_0x996f('0x44')]=_['keys'](db[_0x996f('0x7f')][_0x996f('0x42')]);_0x2a0e95[_0x996f('0x45')]=_[_0x996f('0x58')](_0x359f32[_0x996f('0x45')]);_0x2a0e95[_0x996f('0x4d')]=_['intersection'](_0x2a0e95[_0x996f('0x44')],_0x2a0e95['query']);_0x35d33f[_0x996f('0x47')]=_[_0x996f('0x46')](_0x2a0e95[_0x996f('0x44')],qs[_0x996f('0x48')](_0x359f32['query'][_0x996f('0x48')]));_0x35d33f[_0x996f('0x47')]=_0x35d33f['attributes'][_0x996f('0x59')]?_0x35d33f[_0x996f('0x47')]:_0x2a0e95[_0x996f('0x44')];_0x35d33f[_0x996f('0x4b')]=qs[_0x996f('0x4c')](_0x359f32[_0x996f('0x45')][_0x996f('0x4c')]);_0x35d33f[_0x996f('0x4f')]=qs[_0x996f('0x4d')](_[_0x996f('0x67')](_0x359f32[_0x996f('0x45')],_0x2a0e95[_0x996f('0x4d')]));if(_0x359f32[_0x996f('0x45')]['filter']){_0x35d33f[_0x996f('0x4f')]=_[_0x996f('0x50')](_0x35d33f[_0x996f('0x4f')],{'$or':_[_0x996f('0x40')](_0x35d33f[_0x996f('0x47')],function(_0x4dd66c){var _0x338972={};_0x338972[_0x4dd66c]={'$like':'%'+_0x359f32[_0x996f('0x45')][_0x996f('0x4e')]+'%'};return _0x338972;})});}_0x35d33f=_[_0x996f('0x50')]({},_0x35d33f,_0x359f32['options']);return _0x1dbbaf[_0x996f('0x84')](_0x35d33f);}})[_0x996f('0x38')](function(_0x4d9c26){if(_0x4d9c26){_0x146c59=_0x4d9c26[_0x996f('0x59')];if(!_0x359f32[_0x996f('0x45')]['hasOwnProperty']('nolimit')){_0x35d33f[_0x996f('0x2f')]=qs[_0x996f('0x2f')](_0x359f32['query'][_0x996f('0x2f')]);_0x35d33f[_0x996f('0x2e')]=qs[_0x996f('0x2e')](_0x359f32[_0x996f('0x45')]['offset']);}return _0x1dbbaf['getApplications'](_0x35d33f);}})[_0x996f('0x38')](function(_0x277f4a){if(_0x277f4a){return _0x277f4a?{'count':_0x146c59,'rows':_0x277f4a}:null;}})[_0x996f('0x38')](respondWithResult(_0x4e8043,null))[_0x996f('0x29')](handleError(_0x4e8043,null));};exports[_0x996f('0x85')]=function(_0x58a767,_0x25be85,_0x16c65d){var _0x365a7b={'channel':_0x996f('0x86')};var _0x326599=[];var _0x3a30f9=[];var _0x5ec495={};return db['WhatsappAccount']['find']({'where':{'id':_0x58a767[_0x996f('0x57')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x996f('0x38')](handleEntityNotFound(_0x25be85,null))[_0x996f('0x38')](function(_0x1d3f41){_0x365a7b[_0x996f('0x87')]=_0x1d3f41;if(_0x365a7b['account']&&_0x365a7b[_0x996f('0x87')][_0x996f('0x51')]===_0x996f('0x88')&&_0x58a767['body'][_0x996f('0x89')]){if(_0x58a767['body']['statuses'][_0x996f('0x59')]===0x0)return;if(_0x58a767[_0x996f('0x5c')][_0x996f('0x89')][0x0][_0x996f('0x8a')]!==_0x996f('0x8b'))return;return db[_0x996f('0x8c')][_0x996f('0x36')]({'read':!![],'readAt':_0x58a767[_0x996f('0x5c')][_0x996f('0x89')][0x0][_0x996f('0x8d')]},{'where':{'messageId':_0x58a767[_0x996f('0x5c')][_0x996f('0x89')][0x0][_0x996f('0x8e')]},'individualHooks':!![]})['then'](function(_0x5a204e){return _0x25be85[_0x996f('0x2b')](0xc8)[_0x996f('0x2d')](_0x5a204e);});}_0x365a7b[_0x996f('0x8f')]=_[_0x996f('0x90')](_0x1d3f41[_0x996f('0x91')],[_0x996f('0x82')],[_0x996f('0x92')]);if(_0x365a7b[_0x996f('0x87')][_0x996f('0x91')]){delete _0x365a7b['account'][_0x996f('0x91')];}return db[_0x996f('0x93')]['describe']()[_0x996f('0x38')](function(_0x2dcadc){if(!_0x2dcadc){throw new db[(_0x996f('0x94'))][(_0x996f('0x95'))](_0x996f('0x96'));}_0x326599=_[_0x996f('0x97')](_[_0x996f('0x58')](_0x2dcadc),[_0x996f('0x98'),_0x996f('0x99')]);_0x3a30f9=_[_0x996f('0x97')](_[_0x996f('0x58')](_0x2dcadc),[_0x996f('0x98'),_0x996f('0x99'),_0x996f('0x9a'),'ListId']);_0x365a7b['body']={'mapKey':_0x996f('0x9b')};if(_0x365a7b['account']&&_0x365a7b['account'][_0x996f('0x51')]===_0x996f('0x9c')){_0x365a7b[_0x996f('0x5c')]['from']=_0x58a767[_0x996f('0x5c')]['From'][_0x996f('0x9d')](_0x996f('0x9e'),'');_0x365a7b[_0x996f('0x5c')][_0x996f('0x5c')]=_0x58a767[_0x996f('0x5c')][_0x996f('0x9f')];_0x365a7b[_0x996f('0x5c')][_0x996f('0xa0')]=_0x58a767[_0x996f('0x5c')]['MessageSid'];}if(_0x365a7b[_0x996f('0x87')]&&_0x365a7b[_0x996f('0x87')][_0x996f('0x51')]==='sinch'){_0x365a7b[_0x996f('0x5c')][_0x996f('0xa1')]=_0x58a767['body'][_0x996f('0xa2')][0x0]['from'];_0x365a7b['body'][_0x996f('0x5c')]=_0x58a767[_0x996f('0x5c')][_0x996f('0xa2')][0x0][_0x996f('0x27')][_0x996f('0x5c')];_0x365a7b[_0x996f('0x5c')]['messageId']=_0x58a767['body'][_0x996f('0xa2')][0x0][_0x996f('0x8e')];}if(_0x365a7b['body']['id']){delete _0x365a7b[_0x996f('0x5c')]['id'];}if(_[_0x996f('0xa3')](_0x365a7b[_0x996f('0x5c')][_0x996f('0xa1')])){throw new db[(_0x996f('0x94'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x996f('0xa3')](_0x365a7b['body'][_0x996f('0x5c')])||_0x365a7b[_0x996f('0x5c')]['body']===''){throw new db[(_0x996f('0x94'))][(_0x996f('0x95'))](_0x996f('0xa4'));}if(_['isNil'](_0x365a7b[_0x996f('0x5c')]['mapKey'])){throw new db[(_0x996f('0x94'))][(_0x996f('0x95'))](_0x996f('0xa5')+_0x3a30f9);}if(!_[_0x996f('0xa6')](_0x3a30f9,_0x365a7b['body'][_0x996f('0xa7')])){throw new db[(_0x996f('0x94'))][(_0x996f('0x95'))](_0x996f('0xa8')+_0x3a30f9);}_0x5ec495[_0x365a7b['body'][_0x996f('0xa7')]]=_0x365a7b['body'][_0x996f('0xa1')];return db[_0x996f('0xa9')][_0x996f('0x5a')]({'where':{'id':_0x365a7b[_0x996f('0x87')][_0x996f('0xaa')]},'include':[{'model':db[_0x996f('0x93')],'as':_0x996f('0xab'),'where':_0x5ec495,'limit':0x1,'order':[[_0x996f('0x99'),_0x996f('0xac')]]}]});})['then'](handleEntityNotFound(_0x25be85,null))[_0x996f('0x38')](function(_0x2b98c5){if(_0x2b98c5){_0x365a7b[_0x996f('0xad')]=_[_0x996f('0x71')](_0x2b98c5,[_0x996f('0xab')]);if(_0x2b98c5['Contacts']['length']){return _0x2b98c5[_0x996f('0xab')][0x0];}var _0x163299=_[_0x996f('0xae')](_0x365a7b[_0x996f('0x5c')],{'firstName':_0x365a7b['body'][_0x996f('0xa1')],'ListId':_0x2b98c5['id']});_0x163299[_0x365a7b[_0x996f('0x5c')]['mapKey']]=_0x365a7b[_0x996f('0x5c')]['from'];return db[_0x996f('0x93')]['create'](_0x163299,{'fields':_0x326599,'raw':!![]});}})[_0x996f('0x38')](handleEntityNotFound(_0x25be85,null))[_0x996f('0x38')](function(_0x406e9c){if(_0x406e9c){_0x365a7b[_0x996f('0xaf')]=_0x406e9c;var _0x3fe132={'ContactId':_0x406e9c['id'],'phone':_0x365a7b[_0x996f('0x5c')][_0x996f('0xa1')],'WhatsappAccountId':_0x58a767[_0x996f('0x57')]['id']};var _0x4512fa={'ContactId':_0x406e9c['id'],'WhatsappAccountId':_0x58a767[_0x996f('0x57')]['id'],'closed':![]};return db[_0x996f('0xb0')][_0x996f('0x5a')]({'where':_0x4512fa})[_0x996f('0x38')](function(_0x298596){if(_0x298596){return[_0x298596,![]];}return db[_0x996f('0xb0')][_0x996f('0x5b')](_0x3fe132)[_0x996f('0x38')](function(_0x431466){return[_0x431466,!![]];});});}})[_0x996f('0x72')](function(_0x43cc35,_0x2fc4d6){_0x365a7b['interaction']=_0x43cc35['get']({'plain':!![]});_0x365a7b[_0x996f('0xb1')][_0x996f('0xb2')]=![];if(_0x2fc4d6){if(_0x365a7b['account'][_0x996f('0xb3')]){_0x365a7b[_0x996f('0x8f')]['push']({'id':0x0,'priority':_0x365a7b[_0x996f('0x8f')][_0x996f('0x59')]+0x1,'app':_0x996f('0xb4'),'appdata':_0x996f('0xb5'),'interval':'*,*,*,*'});}_0x365a7b['interaction'][_0x996f('0xb2')]=!![];}return db[_0x996f('0x8c')][_0x996f('0x5b')]({'phone':_0x365a7b['body'][_0x996f('0xa1')],'messageId':_0x365a7b[_0x996f('0x5c')][_0x996f('0xa0')],'body':_0x365a7b[_0x996f('0x5c')][_0x996f('0x5c')],'WhatsappAccountId':_0x58a767[_0x996f('0x57')]['id'],'WhatsappInteractionId':_0x43cc35['id'],'direction':'in','ContactId':_0x43cc35[_0x996f('0xb6')],'AttachmentId':_0x365a7b[_0x996f('0x5c')][_0x996f('0xb7')]});})['then'](function(_0xbd6f5c){_0x365a7b[_0x996f('0x27')]=_0xbd6f5c;if(_0x365a7b[_0x996f('0xb1')]['UserId']){return db[_0x996f('0x78')][_0x996f('0x5a')]({'attributes':['id',_0x996f('0x3b')],'where':{'id':_0x365a7b[_0x996f('0xb1')]['UserId']}})['then'](function(_0x174945){if(_0x174945){_0x365a7b['applications'][_0x996f('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x174945[_0x996f('0x3b')]+','+(_0x365a7b['account'][_0x996f('0xb9')]||0xa),'interval':_0x996f('0xba')});}return respondWithRpcPromise(_0x996f('0xbb'),_0x996f('0xbc'),_0x365a7b);});}return respondWithRpcPromise(_0x996f('0xbb'),'startRouting',_0x365a7b);})[_0x996f('0x38')](function(_0x7885e9){if(_0x7885e9){var _0x2dcf41=0xc8;var _0x373609=_0x996f('0xbd');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x373609,_0x2dcf41,'entity\x20found');logger[_0x996f('0x22')](_0x996f('0xbe'),_0x373609,_0x2dcf41,_0x996f('0xbf'),JSON[_0x996f('0x24')](_0x7885e9));if(_0x365a7b[_0x996f('0x87')][_0x996f('0x51')]===_0x996f('0x9c')){return _0x25be85[_0x996f('0x2b')](_0x2dcf41)[_0x996f('0x31')](_0x996f('0xc0'),'text/xml')[_0x996f('0x3c')](_0x996f('0xc1'));}else{return _0x25be85[_0x996f('0x2b')](_0x2dcf41)[_0x996f('0x2d')](_0x7885e9);}}});})[_0x996f('0x29')](handleError(_0x25be85,null));};exports['send']=function(_0x238494,_0x18b1cc,_0x57a07a){var _0x5a2f89,_0x9bb4cd,_0x168e01;if(_[_0x996f('0xa3')](_0x238494[_0x996f('0x5c')]['body'])||_0x238494['body'][_0x996f('0x5c')]===''){throw new db[(_0x996f('0x94'))]['ValidationError'](_0x996f('0xa4'));}if(_[_0x996f('0xa3')](_0x238494[_0x996f('0x5c')]['to'])){throw new db[(_0x996f('0x94'))][(_0x996f('0x95'))](_0x996f('0xc2'));}_0x5a2f89=_0x238494[_0x996f('0x5c')]['to'];return db[_0x996f('0x41')][_0x996f('0x5a')]({'where':{'id':_0x238494[_0x996f('0x57')]['id']},'include':[{'model':db[_0x996f('0xa9')],'as':_0x996f('0xc3'),'include':[{'model':db['CmContact'],'as':_0x996f('0xab'),'where':{'mobile':_0x5a2f89},'limit':0x1,'order':[[_0x996f('0x99'),_0x996f('0xac')]]}]}]})[_0x996f('0x38')](handleEntityNotFound(_0x18b1cc,null))[_0x996f('0x38')](function(_0x19e121){if(_0x19e121&&_0x19e121[_0x996f('0xc3')]){_0x9bb4cd=_0x19e121[_0x996f('0x5e')]({'plain':!![]});if(_0x9bb4cd['List']&&_0x9bb4cd['List'][_0x996f('0xab')]['length']){return _0x9bb4cd['List'][_0x996f('0xab')][0x0];}return db[_0x996f('0x93')]['create'](_[_0x996f('0xae')](_0x238494[_0x996f('0x5c')],{'firstName':_0x5a2f89,'mobile':_0x5a2f89,'phone':_0x5a2f89,'ListId':_0x9bb4cd[_0x996f('0xaa')]}));}})[_0x996f('0x38')](handleEntityNotFound(_0x18b1cc,null))['then'](function(_0x3a15bb){if(_0x3a15bb){_0x168e01=_0x3a15bb;return db[_0x996f('0xb0')][_0x996f('0x5a')]({'where':{'ContactId':_0x168e01['id'],'closed':![],'WhatsappAccountId':_0x9bb4cd['id']}})[_0x996f('0x38')](function(_0x392f32){if(_0x392f32){return[_0x392f32,![]];}return db['WhatsappInteraction'][_0x996f('0x5b')]({'UserId':_0x238494[_0x996f('0x5d')]['id'],'ContactId':_0x168e01['id'],'WhatsappAccountId':_0x9bb4cd['id'],'phone':_0x5a2f89,'firstMsgDirection':_0x996f('0xc4'),'Messages':[_[_0x996f('0x50')](_0x238494[_0x996f('0x5c')],{'read':![],'body':_0x238494[_0x996f('0x5c')][_0x996f('0x5c')],'phone':_0x5a2f89,'WhatsappAccountId':_0x9bb4cd['id'],'UserId':_0x238494[_0x996f('0x5d')]['id'],'ContactId':_0x168e01['id']})]},{'include':[{'model':db[_0x996f('0x8c')],'as':_0x996f('0xc5')}]})[_0x996f('0x38')](function(_0x14f760){return[_0x14f760,!![]];});});}})[_0x996f('0x72')](function(_0x40dc0d,_0x345a33){if(_0x345a33){return _0x40dc0d;}return db[_0x996f('0x8c')][_0x996f('0x5b')](_[_0x996f('0x50')](_0x238494['body'],{'read':![],'body':_0x238494[_0x996f('0x5c')]['body'],'phone':_0x5a2f89,'WhatsappAccountId':_0x9bb4cd['id'],'WhatsappInteractionId':_0x40dc0d['id'],'UserId':_0x238494[_0x996f('0x5d')]['id'],'ContactId':_0x168e01['id']}))[_0x996f('0x38')](function(_0x54e1a4){_0x40dc0d[_0x996f('0xc6')][_0x996f('0xc5')]=[];_0x40dc0d['dataValues'][_0x996f('0xc5')]['push'](_0x54e1a4['dataValues']);return _0x40dc0d;});})[_0x996f('0x38')](respondWithResult(_0x18b1cc,null))[_0x996f('0x29')](handleError(_0x18b1cc,null));}; \ No newline at end of file +var _0x8539=['include','rows','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','includeAll','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','entity\x20found','debug','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','ListId','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','get','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','WhatsappAccount'];(function(_0x495ac3,_0x37567a){var _0x24dbdf=function(_0xe3f18f){while(--_0xe3f18f){_0x495ac3['push'](_0x495ac3['shift']());}};_0x24dbdf(++_0x37567a);}(_0x8539,0x12f));var _0x9853=function(_0x161e88,_0x49ce5e){_0x161e88=_0x161e88-0x0;var _0x40ee62=_0x8539[_0x161e88];return _0x40ee62;};'use strict';var emlformat=require(_0x9853('0x0'));var rimraf=require(_0x9853('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9853('0x2'));var rp=require(_0x9853('0x3'));var moment=require(_0x9853('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9853('0x5'));var util=require(_0x9853('0x6'));var path=require(_0x9853('0x7'));var sox=require('sox');var csv=require(_0x9853('0x8'));var ejs=require(_0x9853('0x9'));var fs=require('fs');var fs_extra=require(_0x9853('0xa'));var _=require(_0x9853('0xb'));var squel=require(_0x9853('0xc'));var crypto=require(_0x9853('0xd'));var jsforce=require(_0x9853('0xe'));var deskjs=require(_0x9853('0xf'));var toCsv=require(_0x9853('0x8'));var querystring=require(_0x9853('0x10'));var Papa=require(_0x9853('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9853('0x12'));var as=require(_0x9853('0x13'));var hardwareService=require(_0x9853('0x14'));var logger=require(_0x9853('0x15'))('api');var utils=require(_0x9853('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9853('0x17'))['db'];config[_0x9853('0x18')]=_[_0x9853('0x19')](config[_0x9853('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9853('0x1a'))(new Redis(config[_0x9853('0x18')]));require(_0x9853('0x1b'))[_0x9853('0x1c')](socket);var jayson=require(_0x9853('0x1d'));var client=jayson['client'][_0x9853('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0xbff8d9,_0x222d5e,_0x1cf223,_0x3f2aa8){return new BPromise(function(_0x491ca6,_0x51eb34){var _0x50628e=_0x3f2aa8||client;return _0x50628e['request'](_0xbff8d9,_0x1cf223)[_0x9853('0x1f')](function(_0x4ae572){logger[_0x9853('0x20')](_0x9853('0x21'),_0x222d5e,_0x9853('0x22'));logger['debug'](_0x9853('0x23'),_0x222d5e,_0x9853('0x22'),JSON[_0x9853('0x24')](_0x4ae572));if(_0x4ae572[_0x9853('0x25')]){if(_0x4ae572[_0x9853('0x25')][_0x9853('0x26')]===0x1f4){logger[_0x9853('0x25')](_0x9853('0x21'),_0x222d5e,_0x4ae572[_0x9853('0x25')][_0x9853('0x27')]);return _0x51eb34(_0x4ae572['error'][_0x9853('0x27')]);}logger[_0x9853('0x25')](_0x9853('0x21'),_0x222d5e,_0x4ae572[_0x9853('0x25')]['message']);return _0x491ca6(_0x4ae572[_0x9853('0x25')]['message']);}else{logger[_0x9853('0x20')](_0x9853('0x21'),_0x222d5e,'request\x20sent');_0x491ca6(_0x4ae572[_0x9853('0x28')][_0x9853('0x27')]);}})[_0x9853('0x29')](function(_0x1d8ffb){logger[_0x9853('0x25')](_0x9853('0x21'),_0x222d5e,_0x1d8ffb);_0x51eb34(_0x1d8ffb);});});}function respondWithStatusCode(_0x16a8f2,_0xa1cb8d){_0xa1cb8d=_0xa1cb8d||0xcc;return function(_0xfb95e2){if(_0xfb95e2){return _0x16a8f2[_0x9853('0x2a')](_0xa1cb8d);}return _0x16a8f2['status'](_0xa1cb8d)[_0x9853('0x2b')]();};}function respondWithResult(_0xdf4d51,_0x2aa4ad){_0x2aa4ad=_0x2aa4ad||0xc8;return function(_0x20da44){if(_0x20da44){return _0xdf4d51[_0x9853('0x2c')](_0x2aa4ad)[_0x9853('0x2d')](_0x20da44);}};}function respondWithFilteredResult(_0x144428,_0x1f4f1b){return function(_0x52761f){if(_0x52761f){var _0x281d87=typeof _0x1f4f1b[_0x9853('0x2e')]===_0x9853('0x2f')&&typeof _0x1f4f1b[_0x9853('0x30')]===_0x9853('0x2f');var _0x203f6c=_0x52761f[_0x9853('0x31')];var _0x42849b=_0x281d87?0x0:_0x1f4f1b[_0x9853('0x2e')];var _0x23639c=_0x281d87?_0x52761f['count']:_0x1f4f1b[_0x9853('0x2e')]+_0x1f4f1b[_0x9853('0x30')];var _0x29b88c;if(_0x23639c>=_0x203f6c){_0x23639c=_0x203f6c;_0x29b88c=0xc8;}else{_0x29b88c=0xce;}_0x144428[_0x9853('0x2c')](_0x29b88c);return _0x144428[_0x9853('0x32')]('Content-Range',_0x42849b+'-'+_0x23639c+'/'+_0x203f6c)[_0x9853('0x2d')](_0x52761f);}return null;};}function patchUpdates(_0x47804e){return function(_0x38933a){try{jsonpatch[_0x9853('0x33')](_0x38933a,_0x47804e,!![]);}catch(_0x39cf79){return BPromise[_0x9853('0x34')](_0x39cf79);}return _0x38933a['save']();};}function saveUpdates(_0x2108d8,_0x25f76a){return function(_0x1c2e1b){if(_0x1c2e1b){return _0x1c2e1b[_0x9853('0x35')](_0x2108d8)['then'](function(_0xd2d1f0){return _0xd2d1f0;});}return null;};}function removeEntity(_0x3229a9,_0x23cb78){return function(_0x106faa){if(_0x106faa){return _0x106faa['destroy']()['then'](function(){var _0x25c02d=_0x106faa[_0x9853('0x36')]({'plain':!![]});var _0x882276=_0x9853('0x37');return db[_0x9853('0x38')]['destroy']({'where':{'type':_0x882276,'resourceId':_0x25c02d['id']}})[_0x9853('0x1f')](function(){return _0x106faa;});})[_0x9853('0x1f')](function(){_0x3229a9[_0x9853('0x2c')](0xcc)[_0x9853('0x2b')]();});}};}function handleEntityNotFound(_0x2ac76b,_0xfdb007){return function(_0x414ed3){if(!_0x414ed3){_0x2ac76b['sendStatus'](0x194);}return _0x414ed3;};}function handleError(_0x4500d3,_0x3a73b0){_0x3a73b0=_0x3a73b0||0x1f4;return function(_0x3b9e51){logger['error'](_0x3b9e51['stack']);if(_0x3b9e51[_0x9853('0x39')]){delete _0x3b9e51['name'];}_0x4500d3[_0x9853('0x2c')](_0x3a73b0)[_0x9853('0x3a')](_0x3b9e51);};}exports[_0x9853('0x3b')]=function(_0x28b809,_0x46fd0f){var _0x4be045={'include':[{'model':db[_0x9853('0x3c')],'as':_0x9853('0x3d')}]},_0x468deb={},_0x13342a={'count':0x0,'rows':[]};var _0x202889=_[_0x9853('0x3e')](db['WhatsappAccount'][_0x9853('0x3f')],function(_0x285fb2){return{'name':_0x285fb2[_0x9853('0x40')],'type':_0x285fb2[_0x9853('0x41')][_0x9853('0x42')]};});_0x468deb['model']=_['map'](_0x202889,_0x9853('0x39'));_0x468deb[_0x9853('0x43')]=_[_0x9853('0x44')](_0x28b809[_0x9853('0x43')]);_0x468deb[_0x9853('0x45')]=_[_0x9853('0x46')](_0x468deb[_0x9853('0x47')],_0x468deb[_0x9853('0x43')]);_0x4be045[_0x9853('0x48')]=_['intersection'](_0x468deb[_0x9853('0x47')],qs[_0x9853('0x49')](_0x28b809[_0x9853('0x43')][_0x9853('0x49')]));_0x4be045[_0x9853('0x48')]=_0x4be045[_0x9853('0x48')][_0x9853('0x4a')]?_0x4be045[_0x9853('0x48')]:_0x468deb[_0x9853('0x47')];if(!_0x28b809[_0x9853('0x43')][_0x9853('0x4b')](_0x9853('0x4c'))){_0x4be045[_0x9853('0x30')]=qs[_0x9853('0x30')](_0x28b809['query']['limit']);_0x4be045['offset']=qs[_0x9853('0x2e')](_0x28b809[_0x9853('0x43')][_0x9853('0x2e')]);}_0x4be045[_0x9853('0x4d')]=qs[_0x9853('0x4e')](_0x28b809[_0x9853('0x43')][_0x9853('0x4e')]);_0x4be045[_0x9853('0x4f')]=qs['filters'](_[_0x9853('0x50')](_0x28b809[_0x9853('0x43')],_0x468deb[_0x9853('0x45')]),_0x202889);if(_0x28b809[_0x9853('0x43')][_0x9853('0x51')]){_0x4be045['where']=_[_0x9853('0x52')](_0x4be045[_0x9853('0x4f')],{'$or':_[_0x9853('0x3e')](_0x202889,function(_0x2db102){if(_0x2db102[_0x9853('0x41')]!==_0x9853('0x53')){var _0x313aa2={};_0x313aa2[_0x2db102['name']]={'$like':'%'+_0x28b809['query'][_0x9853('0x51')]+'%'};return _0x313aa2;}})});}_0x4be045=_['merge']({},_0x4be045,_0x28b809['options']);var _0xe14d21={'where':_0x4be045[_0x9853('0x4f')]};return db[_0x9853('0x54')][_0x9853('0x31')](_0xe14d21)[_0x9853('0x1f')](function(_0x389cd3){_0x13342a[_0x9853('0x31')]=_0x389cd3;if(_0x28b809['query']['includeAll']){_0x4be045[_0x9853('0x55')]=[{'all':!![]}];}return db[_0x9853('0x54')]['findAll'](_0x4be045);})[_0x9853('0x1f')](function(_0x4f3a96){_0x13342a[_0x9853('0x56')]=_0x4f3a96;return _0x13342a;})[_0x9853('0x1f')](respondWithFilteredResult(_0x46fd0f,_0x4be045))['catch'](handleError(_0x46fd0f,null));};exports[_0x9853('0x57')]=function(_0x56b31d,_0x4e263c){var _0xf6059e={'raw':![],'where':{'id':_0x56b31d[_0x9853('0x58')]['id']},'include':[{'model':db[_0x9853('0x3c')],'as':_0x9853('0x3d')}]},_0x2a86a4={};_0x2a86a4[_0x9853('0x47')]=_[_0x9853('0x44')](db[_0x9853('0x54')][_0x9853('0x3f')]);_0x2a86a4[_0x9853('0x43')]=_['keys'](_0x56b31d[_0x9853('0x43')]);_0x2a86a4[_0x9853('0x45')]=_[_0x9853('0x46')](_0x2a86a4[_0x9853('0x47')],_0x2a86a4[_0x9853('0x43')]);_0xf6059e[_0x9853('0x48')]=_[_0x9853('0x46')](_0x2a86a4[_0x9853('0x47')],qs[_0x9853('0x49')](_0x56b31d[_0x9853('0x43')][_0x9853('0x49')]));_0xf6059e[_0x9853('0x48')]=_0xf6059e[_0x9853('0x48')][_0x9853('0x4a')]?_0xf6059e[_0x9853('0x48')]:_0x2a86a4[_0x9853('0x47')];if(_0x56b31d[_0x9853('0x43')]['includeAll']){_0xf6059e[_0x9853('0x55')]=[{'all':!![]}];}_0xf6059e=_[_0x9853('0x52')]({},_0xf6059e,_0x56b31d[_0x9853('0x59')]);return db[_0x9853('0x54')]['find'](_0xf6059e)[_0x9853('0x1f')](handleEntityNotFound(_0x4e263c,null))[_0x9853('0x1f')](respondWithResult(_0x4e263c,null))[_0x9853('0x29')](handleError(_0x4e263c,null));};exports['create']=function(_0x165ca4,_0x40114c){return db[_0x9853('0x54')][_0x9853('0x5a')](_0x165ca4[_0x9853('0x5b')],{})[_0x9853('0x1f')](function(_0x42eb7b){var _0x305514=_0x165ca4['user'][_0x9853('0x36')]({'plain':!![]});if(!_0x305514)throw new Error(_0x9853('0x5c'));if(_0x305514[_0x9853('0x5d')]===_0x9853('0x5e')){var _0x4e3143=_0x42eb7b[_0x9853('0x36')]({'plain':!![]});var _0x2f416d=_0x9853('0x37');return db['UserProfileSection'][_0x9853('0x5f')]({'where':{'name':_0x2f416d,'userProfileId':_0x305514[_0x9853('0x60')]},'raw':!![]})[_0x9853('0x1f')](function(_0x49e82f){if(_0x49e82f&&_0x49e82f[_0x9853('0x61')]===0x0){return db['UserProfileResource'][_0x9853('0x5a')]({'name':_0x4e3143[_0x9853('0x39')],'resourceId':_0x4e3143['id'],'type':_0x49e82f['name'],'sectionId':_0x49e82f['id']},{})[_0x9853('0x1f')](function(){return _0x42eb7b;});}else{return _0x42eb7b;}})[_0x9853('0x29')](function(_0x5c08a2){logger['error'](_0x9853('0x62'),_0x5c08a2);throw _0x5c08a2;});}return _0x42eb7b;})['then'](respondWithResult(_0x40114c,0xc9))[_0x9853('0x29')](handleError(_0x40114c,null));};exports[_0x9853('0x35')]=function(_0x5dba1e,_0x3dd7da){if(_0x5dba1e['body']['id']){delete _0x5dba1e[_0x9853('0x5b')]['id'];}return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x5dba1e[_0x9853('0x58')]['id']},'include':[{'model':db[_0x9853('0x3c')],'as':_0x9853('0x3d')}]})[_0x9853('0x1f')](handleEntityNotFound(_0x3dd7da,null))['then'](saveUpdates(_0x5dba1e['body'],null))[_0x9853('0x1f')](respondWithResult(_0x3dd7da,null))[_0x9853('0x29')](handleError(_0x3dd7da,null));};exports[_0x9853('0x63')]=function(_0x4529ab,_0xc6747b){return db[_0x9853('0x54')]['find']({'where':{'id':_0x4529ab['params']['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0xc6747b,null))[_0x9853('0x1f')](removeEntity(_0xc6747b,null))[_0x9853('0x29')](handleError(_0xc6747b,null));};exports['describe']=function(_0x18685a,_0x352be3){return db[_0x9853('0x54')][_0x9853('0x64')]()['then'](respondWithResult(_0x352be3,null))['catch'](handleError(_0x352be3,null));};exports[_0x9853('0x65')]=function(_0x369d6e,_0x73a950,_0x333e98){if(_0x369d6e[_0x9853('0x5b')]['id']){delete _0x369d6e[_0x9853('0x5b')]['id'];}return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x369d6e[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x73a950,null))['then'](function(_0x15259e){if(_0x15259e){_0x369d6e[_0x9853('0x5b')][_0x9853('0x66')]=_0x15259e['id'];return db[_0x9853('0x67')][_0x9853('0x5a')](_0x369d6e[_0x9853('0x5b')]);}})[_0x9853('0x1f')](respondWithResult(_0x73a950,null))[_0x9853('0x29')](handleError(_0x73a950,null));};exports[_0x9853('0x68')]=function(_0xa6af8e,_0x1518f3,_0x1f4da0){var _0x2b1cf7={'raw':![],'where':{}};var _0x57665d={};var _0x4b366f={'count':0x0,'rows':[]};return db[_0x9853('0x54')][_0x9853('0x69')]({'where':{'id':_0xa6af8e[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x1518f3,null))[_0x9853('0x1f')](function(_0x18c954){if(_0x18c954){_0x57665d[_0x9853('0x47')]=_[_0x9853('0x44')](db[_0x9853('0x67')][_0x9853('0x3f')]);_0x57665d[_0x9853('0x43')]=_['keys'](_0xa6af8e[_0x9853('0x43')]);_0x57665d[_0x9853('0x45')]=_[_0x9853('0x46')](_0x57665d[_0x9853('0x47')],_0x57665d[_0x9853('0x43')]);_0x2b1cf7[_0x9853('0x48')]=_[_0x9853('0x46')](_0x57665d[_0x9853('0x47')],qs[_0x9853('0x49')](_0xa6af8e[_0x9853('0x43')][_0x9853('0x49')]));_0x2b1cf7[_0x9853('0x48')]=_0x2b1cf7['attributes'][_0x9853('0x4a')]?_0x2b1cf7[_0x9853('0x48')]:_0x57665d[_0x9853('0x47')];if(!_0xa6af8e[_0x9853('0x43')][_0x9853('0x4b')]('nolimit')){_0x2b1cf7[_0x9853('0x30')]=qs[_0x9853('0x30')](_0xa6af8e[_0x9853('0x43')][_0x9853('0x30')]);_0x2b1cf7[_0x9853('0x2e')]=qs[_0x9853('0x2e')](_0xa6af8e[_0x9853('0x43')][_0x9853('0x2e')]);}_0x2b1cf7['order']=qs[_0x9853('0x4e')](_0xa6af8e[_0x9853('0x43')]['sort']);_0x2b1cf7['where']=qs['filters'](_[_0x9853('0x50')](_0xa6af8e[_0x9853('0x43')],_0x57665d['filters']));_0x2b1cf7['where'][_0x9853('0x66')]=_0x18c954['id'];if(_0xa6af8e[_0x9853('0x43')][_0x9853('0x51')]){_0x2b1cf7[_0x9853('0x4f')]=_['merge'](_0x2b1cf7['where'],{'$or':_['map'](_0x2b1cf7[_0x9853('0x48')],function(_0x564489){var _0x3cd509={};_0x3cd509[_0x564489]={'$like':'%'+_0xa6af8e[_0x9853('0x43')]['filter']+'%'};return _0x3cd509;})});}_0x2b1cf7=_[_0x9853('0x52')]({},_0x2b1cf7,_0xa6af8e[_0x9853('0x59')]);return db[_0x9853('0x67')][_0x9853('0x31')]({'where':_0x2b1cf7[_0x9853('0x4f')]})['then'](function(_0x45e91d){_0x4b366f[_0x9853('0x31')]=_0x45e91d;if(_0xa6af8e[_0x9853('0x43')][_0x9853('0x6a')]){_0x2b1cf7[_0x9853('0x55')]=[{'all':!![]}];}return db[_0x9853('0x67')][_0x9853('0x6b')](_0x2b1cf7);})[_0x9853('0x1f')](function(_0x51de96){_0x4b366f[_0x9853('0x56')]=_0x51de96;return _0x4b366f;});}})[_0x9853('0x1f')](respondWithFilteredResult(_0x1518f3,_0x2b1cf7))[_0x9853('0x29')](handleError(_0x1518f3,null));};exports[_0x9853('0x6c')]=function(_0x3c89b4,_0x2e56c1,_0x523b6b){return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x3c89b4[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x2e56c1,null))['then'](function(_0x2a8845){if(_0x2a8845){return _0x2a8845[_0x9853('0x6c')](_0x3c89b4[_0x9853('0x43')][_0x9853('0x6d')]);}})[_0x9853('0x1f')](respondWithStatusCode(_0x2e56c1,null))[_0x9853('0x29')](handleError(_0x2e56c1,null));};exports['addAnswer']=function(_0xf26409,_0x23245d,_0x294dea){if(_0xf26409['body']['id']){delete _0xf26409['body']['id'];}return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0xf26409[_0x9853('0x58')]['id']}})['then'](handleEntityNotFound(_0x23245d,null))[_0x9853('0x1f')](function(_0x45cdbe){if(_0x45cdbe){_0xf26409[_0x9853('0x5b')][_0x9853('0x66')]=_0x45cdbe['id'];return db[_0x9853('0x6e')][_0x9853('0x5a')](_0xf26409['body']);}})[_0x9853('0x1f')](respondWithResult(_0x23245d,null))[_0x9853('0x29')](handleError(_0x23245d,null));};exports[_0x9853('0x6f')]=function(_0x39f7e6,_0xe5b631,_0x353b4e){var _0x3b51a2={'raw':![],'where':{}};var _0x4f0467={};var _0x182d97={'count':0x0,'rows':[]};return db[_0x9853('0x54')][_0x9853('0x69')]({'where':{'id':_0x39f7e6['params']['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0xe5b631,null))[_0x9853('0x1f')](function(_0x5404cd){if(_0x5404cd){_0x4f0467[_0x9853('0x47')]=_['keys'](db[_0x9853('0x6e')]['rawAttributes']);_0x4f0467[_0x9853('0x43')]=_[_0x9853('0x44')](_0x39f7e6[_0x9853('0x43')]);_0x4f0467[_0x9853('0x45')]=_[_0x9853('0x46')](_0x4f0467[_0x9853('0x47')],_0x4f0467[_0x9853('0x43')]);_0x3b51a2[_0x9853('0x48')]=_[_0x9853('0x46')](_0x4f0467[_0x9853('0x47')],qs['fields'](_0x39f7e6[_0x9853('0x43')][_0x9853('0x49')]));_0x3b51a2[_0x9853('0x48')]=_0x3b51a2[_0x9853('0x48')]['length']?_0x3b51a2[_0x9853('0x48')]:_0x4f0467[_0x9853('0x47')];if(!_0x39f7e6[_0x9853('0x43')][_0x9853('0x4b')]('nolimit')){_0x3b51a2[_0x9853('0x30')]=qs['limit'](_0x39f7e6[_0x9853('0x43')]['limit']);_0x3b51a2[_0x9853('0x2e')]=qs[_0x9853('0x2e')](_0x39f7e6[_0x9853('0x43')][_0x9853('0x2e')]);}_0x3b51a2[_0x9853('0x4d')]=qs[_0x9853('0x4e')](_0x39f7e6['query']['sort']);_0x3b51a2[_0x9853('0x4f')]=qs[_0x9853('0x45')](_[_0x9853('0x50')](_0x39f7e6['query'],_0x4f0467[_0x9853('0x45')]));_0x3b51a2['where'][_0x9853('0x66')]=_0x5404cd['id'];if(_0x39f7e6[_0x9853('0x43')][_0x9853('0x51')]){_0x3b51a2[_0x9853('0x4f')]=_[_0x9853('0x52')](_0x3b51a2['where'],{'$or':_[_0x9853('0x3e')](_0x3b51a2[_0x9853('0x48')],function(_0x14c3f2){var _0x298c1a={};_0x298c1a[_0x14c3f2]={'$like':'%'+_0x39f7e6[_0x9853('0x43')][_0x9853('0x51')]+'%'};return _0x298c1a;})});}_0x3b51a2=_[_0x9853('0x52')]({},_0x3b51a2,_0x39f7e6['options']);return db[_0x9853('0x6e')][_0x9853('0x31')]({'where':_0x3b51a2[_0x9853('0x4f')]})[_0x9853('0x1f')](function(_0x3f8dd1){_0x182d97[_0x9853('0x31')]=_0x3f8dd1;if(_0x39f7e6['query'][_0x9853('0x6a')]){_0x3b51a2[_0x9853('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9853('0x6b')](_0x3b51a2);})[_0x9853('0x1f')](function(_0x242752){_0x182d97['rows']=_0x242752;return _0x182d97;});}})[_0x9853('0x1f')](respondWithFilteredResult(_0xe5b631,_0x3b51a2))[_0x9853('0x29')](handleError(_0xe5b631,null));};exports[_0x9853('0x70')]=function(_0x529ecd,_0x39bdf1,_0x5cda67){return db['WhatsappAccount']['find']({'where':{'id':_0x529ecd[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x39bdf1,null))[_0x9853('0x1f')](function(_0x3063f6){if(_0x3063f6){return _0x3063f6[_0x9853('0x70')](_0x529ecd[_0x9853('0x43')][_0x9853('0x6d')]);}})[_0x9853('0x1f')](respondWithStatusCode(_0x39bdf1,null))[_0x9853('0x29')](handleError(_0x39bdf1,null));};exports[_0x9853('0x71')]=function(_0x4e5534,_0x4d9b5d,_0x264807){return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x4e5534[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x4d9b5d,null))[_0x9853('0x1f')](function(_0x459c05){if(_0x459c05){return _0x459c05[_0x9853('0x71')](_0x4e5534['body'][_0x9853('0x6d')],_['omit'](_0x4e5534[_0x9853('0x5b')],[_0x9853('0x6d'),'id'])||{})[_0x9853('0x72')](function(_0xb412c1){for(var _0x585a49=0x0;_0x585a49<_0x4e5534[_0x9853('0x5b')][_0x9853('0x6d')]['length'];_0x585a49+=0x1){socket[_0x9853('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x4e5534[_0x9853('0x5b')][_0x9853('0x6d')][_0x585a49]),'WhatsappAccountId':Number(_0x4e5534[_0x9853('0x58')]['id'])});}return _0xb412c1;});}})[_0x9853('0x1f')](respondWithResult(_0x4d9b5d,null))[_0x9853('0x29')](handleError(_0x4d9b5d,null));};exports[_0x9853('0x74')]=function(_0x759ffa,_0x48cf9a,_0x471d12){return db[_0x9853('0x54')]['find']({'where':{'id':_0x759ffa[_0x9853('0x58')]['id']}})['then'](handleEntityNotFound(_0x48cf9a,null))[_0x9853('0x1f')](function(_0x50d9fb){if(_0x50d9fb){return _0x50d9fb[_0x9853('0x74')](_0x759ffa[_0x9853('0x43')][_0x9853('0x6d')])['then'](function(){if(_[_0x9853('0x75')](_0x759ffa[_0x9853('0x43')][_0x9853('0x6d')])){for(var _0xfe919c=0x0;_0xfe919c<_0x759ffa[_0x9853('0x43')]['ids']['length'];_0xfe919c+=0x1){socket[_0x9853('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x759ffa[_0x9853('0x43')]['ids'][_0xfe919c]),'WhatsappAccountId':Number(_0x759ffa['params']['id'])});}}else{socket[_0x9853('0x73')](_0x9853('0x76'),{'UserId':Number(_0x759ffa[_0x9853('0x43')][_0x9853('0x6d')]),'WhatsappAccountId':Number(_0x759ffa[_0x9853('0x58')]['id'])});}});}})[_0x9853('0x1f')](respondWithStatusCode(_0x48cf9a,null))[_0x9853('0x29')](handleError(_0x48cf9a,null));};exports[_0x9853('0x77')]=function(_0x5f4de8,_0x3dff84,_0x59a3c5){var _0x214a47={};var _0x50a1bc={};var _0xf80f27;var _0x39f940;return db['WhatsappAccount'][_0x9853('0x69')]({'where':{'id':_0x5f4de8[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x3dff84,null))[_0x9853('0x1f')](function(_0xdf4827){if(_0xdf4827){_0xf80f27=_0xdf4827;_0x50a1bc[_0x9853('0x47')]=_[_0x9853('0x44')](db[_0x9853('0x78')][_0x9853('0x3f')]);_0x50a1bc[_0x9853('0x43')]=_['keys'](_0x5f4de8[_0x9853('0x43')]);_0x50a1bc[_0x9853('0x45')]=_[_0x9853('0x46')](_0x50a1bc[_0x9853('0x47')],_0x50a1bc[_0x9853('0x43')]);_0x214a47[_0x9853('0x48')]=_[_0x9853('0x46')](_0x50a1bc['model'],qs[_0x9853('0x49')](_0x5f4de8[_0x9853('0x43')][_0x9853('0x49')]));_0x214a47[_0x9853('0x48')]=_0x214a47[_0x9853('0x48')][_0x9853('0x4a')]?_0x214a47['attributes']:_0x50a1bc[_0x9853('0x47')];_0x214a47[_0x9853('0x4d')]=qs[_0x9853('0x4e')](_0x5f4de8[_0x9853('0x43')][_0x9853('0x4e')]);_0x214a47[_0x9853('0x4f')]=qs[_0x9853('0x45')](_[_0x9853('0x50')](_0x5f4de8['query'],_0x50a1bc[_0x9853('0x45')]));if(_0x5f4de8[_0x9853('0x43')]['filter']){_0x214a47[_0x9853('0x4f')]=_['merge'](_0x214a47['where'],{'$or':_[_0x9853('0x3e')](_0x214a47['attributes'],function(_0x1057aa){var _0xcf7739={};_0xcf7739[_0x1057aa]={'$like':'%'+_0x5f4de8[_0x9853('0x43')][_0x9853('0x51')]+'%'};return _0xcf7739;})});}_0x214a47=_['merge']({},_0x214a47,_0x5f4de8['options']);return _0xf80f27[_0x9853('0x77')](_0x214a47);}})[_0x9853('0x1f')](function(_0xba6074){if(_0xba6074){_0x39f940=_0xba6074[_0x9853('0x4a')];if(!_0x5f4de8[_0x9853('0x43')][_0x9853('0x4b')](_0x9853('0x4c'))){_0x214a47[_0x9853('0x30')]=qs[_0x9853('0x30')](_0x5f4de8[_0x9853('0x43')][_0x9853('0x30')]);_0x214a47[_0x9853('0x2e')]=qs[_0x9853('0x2e')](_0x5f4de8[_0x9853('0x43')][_0x9853('0x2e')]);}return _0xf80f27[_0x9853('0x77')](_0x214a47);}})[_0x9853('0x1f')](function(_0x22442d){if(_0x22442d){return _0x22442d?{'count':_0x39f940,'rows':_0x22442d}:null;}})['then'](respondWithResult(_0x3dff84,null))[_0x9853('0x29')](handleError(_0x3dff84,null));};exports['addApplications']=function(_0x3a05c2,_0x7858d){var _0x510aa8=_0x3a05c2[_0x9853('0x58')]['id'];var _0x42445a=_0x3a05c2['body'];var _0x4fbaac=0xc8;var _0x26e744=null;return db[_0x9853('0x79')][_0x9853('0x7a')]({'isolationLevel':db[_0x9853('0x79')]['Transaction'][_0x9853('0x7b')]['READ_COMMITTED']},function(_0x5c8a21){return db[_0x9853('0x54')][_0x9853('0x69')]({'where':{'id':_0x510aa8},'transaction':_0x5c8a21})['then'](function(_0x3ea779){if(_0x3ea779){return db[_0x9853('0x7c')][_0x9853('0x63')]({'where':{'WhatsappAccountId':_0x510aa8},'transaction':_0x5c8a21})['then'](function(){var _0x47b7b5=_[_0x9853('0x3e')](_0x42445a,function(_0x276b06){_0x276b06['WhatsappAccountId']=_0x510aa8;return _0x276b06;});return db['WhatsappApplication']['bulkCreate'](_0x47b7b5,{'transaction':_0x5c8a21});});}else{_0x4fbaac=0x194;_0x26e744=[];}});})[_0x9853('0x1f')](function(){if(_0x4fbaac!==0x194){return db[_0x9853('0x7c')][_0x9853('0x7d')]({'where':{'WhatsappAccountId':_0x510aa8},'order':_0x9853('0x7e')})[_0x9853('0x1f')](function(_0x35e773){_0x26e744=_0x35e773;});}})['catch'](function(_0x3313d8){_0x4fbaac=0x1f4;logger[_0x9853('0x25')](_0x3313d8['stack']);if(_0x3313d8[_0x9853('0x39')]){delete _0x3313d8['name'];}_0x26e744=_0x3313d8;})[_0x9853('0x7f')](function(){if(_0x26e744===null){_0x7858d['sendStatus'](_0x4fbaac);}else{if(_0x4fbaac===0x1f4){_0x7858d[_0x9853('0x2c')](_0x4fbaac)[_0x9853('0x3a')](_0x26e744);}else{_0x7858d[_0x9853('0x2c')](_0x4fbaac)[_0x9853('0x2d')](_0x26e744);}}});};exports[_0x9853('0x80')]=function(_0x2d2d61,_0x2e182f,_0x32e0d1){var _0x331eba={};var _0xb080e3={};var _0x1e022a;var _0xcd4015;return db[_0x9853('0x54')][_0x9853('0x69')]({'where':{'id':_0x2d2d61[_0x9853('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e182f,null))[_0x9853('0x1f')](function(_0x2e803b){if(_0x2e803b){_0x1e022a=_0x2e803b;_0xb080e3[_0x9853('0x47')]=_[_0x9853('0x44')](db['WhatsappApplication'][_0x9853('0x3f')]);_0xb080e3[_0x9853('0x43')]=_['keys'](_0x2d2d61['query']);_0xb080e3[_0x9853('0x45')]=_[_0x9853('0x46')](_0xb080e3['model'],_0xb080e3[_0x9853('0x43')]);_0x331eba[_0x9853('0x48')]=_[_0x9853('0x46')](_0xb080e3[_0x9853('0x47')],qs['fields'](_0x2d2d61['query']['fields']));_0x331eba[_0x9853('0x48')]=_0x331eba[_0x9853('0x48')][_0x9853('0x4a')]?_0x331eba[_0x9853('0x48')]:_0xb080e3[_0x9853('0x47')];_0x331eba[_0x9853('0x4d')]=qs[_0x9853('0x4e')](_0x2d2d61['query']['sort']);_0x331eba[_0x9853('0x4f')]=qs[_0x9853('0x45')](_['pick'](_0x2d2d61[_0x9853('0x43')],_0xb080e3[_0x9853('0x45')]));if(_0x2d2d61[_0x9853('0x43')]['filter']){_0x331eba['where']=_[_0x9853('0x52')](_0x331eba[_0x9853('0x4f')],{'$or':_['map'](_0x331eba[_0x9853('0x48')],function(_0x24b51f){var _0x1c2bc5={};_0x1c2bc5[_0x24b51f]={'$like':'%'+_0x2d2d61[_0x9853('0x43')]['filter']+'%'};return _0x1c2bc5;})});}_0x331eba=_['merge']({},_0x331eba,_0x2d2d61[_0x9853('0x59')]);return _0x1e022a[_0x9853('0x80')](_0x331eba);}})['then'](function(_0x3b7762){if(_0x3b7762){_0xcd4015=_0x3b7762[_0x9853('0x4a')];if(!_0x2d2d61[_0x9853('0x43')][_0x9853('0x4b')](_0x9853('0x4c'))){_0x331eba[_0x9853('0x30')]=qs[_0x9853('0x30')](_0x2d2d61['query'][_0x9853('0x30')]);_0x331eba[_0x9853('0x2e')]=qs['offset'](_0x2d2d61[_0x9853('0x43')]['offset']);}return _0x1e022a['getApplications'](_0x331eba);}})[_0x9853('0x1f')](function(_0xd12c77){if(_0xd12c77){return _0xd12c77?{'count':_0xcd4015,'rows':_0xd12c77}:null;}})['then'](respondWithResult(_0x2e182f,null))['catch'](handleError(_0x2e182f,null));};exports[_0x9853('0x81')]=function(_0x342cea,_0xe4c74c,_0x1bf516){var _0x594c7d={'channel':_0x9853('0x82')};var _0x2ac201=[];var _0x33d032=[];var _0x41251f={};return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x342cea[_0x9853('0x58')]['id']},'include':[{'model':db[_0x9853('0x7c')],'as':_0x9853('0x83')}]})['then'](handleEntityNotFound(_0xe4c74c,null))[_0x9853('0x1f')](function(_0x2fef80){_0x594c7d['account']=_0x2fef80;if(_0x594c7d['account']&&_0x594c7d[_0x9853('0x84')][_0x9853('0x41')]===_0x9853('0x85')&&_0x342cea[_0x9853('0x5b')][_0x9853('0x86')]){if(_0x342cea[_0x9853('0x5b')][_0x9853('0x86')]['length']===0x0)return;if(_0x342cea['body'][_0x9853('0x86')][0x0]['state']!==_0x9853('0x87'))return;return db['WhatsappMessage'][_0x9853('0x35')]({'read':!![],'readAt':_0x342cea[_0x9853('0x5b')]['statuses'][0x0][_0x9853('0x88')]},{'where':{'messageId':_0x342cea[_0x9853('0x5b')][_0x9853('0x86')][0x0][_0x9853('0x89')]},'individualHooks':!![]})[_0x9853('0x1f')](function(_0x3be22f){return _0xe4c74c[_0x9853('0x2c')](0xc8)['json'](_0x3be22f);});}_0x594c7d[_0x9853('0x8a')]=_[_0x9853('0x8b')](_0x2fef80['Applications'],[_0x9853('0x7e')],[_0x9853('0x8c')]);if(_0x594c7d[_0x9853('0x84')][_0x9853('0x83')]){delete _0x594c7d[_0x9853('0x84')][_0x9853('0x83')];}return db[_0x9853('0x8d')][_0x9853('0x64')]()[_0x9853('0x1f')](function(_0x147785){if(!_0x147785){throw new db[(_0x9853('0x8e'))][(_0x9853('0x8f'))](_0x9853('0x90'));}_0x2ac201=_[_0x9853('0x91')](_[_0x9853('0x44')](_0x147785),[_0x9853('0x92'),_0x9853('0x93')]);_0x33d032=_['difference'](_[_0x9853('0x44')](_0x147785),[_0x9853('0x92'),_0x9853('0x93'),_0x9853('0x94'),'ListId']);_0x594c7d[_0x9853('0x5b')]={'mapKey':_0x9853('0x95')};if(_0x594c7d[_0x9853('0x84')]&&_0x594c7d[_0x9853('0x84')][_0x9853('0x41')]===_0x9853('0x96')){_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')]=_0x342cea['body'][_0x9853('0x98')][_0x9853('0x99')](_0x9853('0x9a'),'');_0x594c7d['body'][_0x9853('0x5b')]=_0x342cea[_0x9853('0x5b')]['Body'];_0x594c7d['body'][_0x9853('0x9b')]=_0x342cea[_0x9853('0x5b')][_0x9853('0x9c')];}if(_0x594c7d[_0x9853('0x84')]&&_0x594c7d[_0x9853('0x84')][_0x9853('0x41')]===_0x9853('0x85')){_0x594c7d['body']['from']=_0x342cea[_0x9853('0x5b')][_0x9853('0x9d')][0x0]['from'];_0x594c7d[_0x9853('0x5b')]['body']=_0x342cea[_0x9853('0x5b')][_0x9853('0x9d')][0x0]['message']['body'];_0x594c7d[_0x9853('0x5b')]['messageId']=_0x342cea[_0x9853('0x5b')][_0x9853('0x9d')][0x0][_0x9853('0x89')];}if(_0x594c7d['body']['id']){delete _0x594c7d[_0x9853('0x5b')]['id'];}if(_[_0x9853('0x9e')](_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')])){throw new db[(_0x9853('0x8e'))]['ValidationError'](_0x9853('0x9f'));}if(_[_0x9853('0x9e')](_0x594c7d[_0x9853('0x5b')]['body'])||_0x594c7d[_0x9853('0x5b')]['body']===''){throw new db['Sequelize'][(_0x9853('0x8f'))](_0x9853('0xa0'));}if(_[_0x9853('0x9e')](_0x594c7d['body']['mapKey'])){throw new db[(_0x9853('0x8e'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33d032);}if(!_['includes'](_0x33d032,_0x594c7d['body'][_0x9853('0xa1')])){throw new db['Sequelize'][(_0x9853('0x8f'))](_0x9853('0xa2')+_0x33d032);}_0x41251f[_0x594c7d['body']['mapKey']]=_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')];return db['CmList'][_0x9853('0x5f')]({'where':{'id':_0x594c7d['account']['ListId']},'include':[{'model':db[_0x9853('0x8d')],'as':_0x9853('0xa3'),'where':_0x41251f,'limit':0x1,'order':[[_0x9853('0x93'),_0x9853('0xa4')]]}]});})[_0x9853('0x1f')](handleEntityNotFound(_0xe4c74c,null))[_0x9853('0x1f')](function(_0x365104){if(_0x365104){_0x594c7d[_0x9853('0xa5')]=_['omit'](_0x365104,[_0x9853('0xa3')]);if(_0x365104[_0x9853('0xa3')]['length']){return _0x365104[_0x9853('0xa3')][0x0];}var _0x34a0f6=_[_0x9853('0x19')](_0x594c7d[_0x9853('0x5b')],{'firstName':_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')],'ListId':_0x365104['id']});_0x34a0f6[_0x594c7d['body'][_0x9853('0xa1')]]=_0x594c7d[_0x9853('0x5b')]['from'];return db['CmContact'][_0x9853('0x5a')](_0x34a0f6,{'fields':_0x2ac201,'raw':!![]});}})['then'](handleEntityNotFound(_0xe4c74c,null))[_0x9853('0x1f')](function(_0x16ccec){if(_0x16ccec){_0x594c7d['contact']=_0x16ccec;var _0xa2033e={'ContactId':_0x16ccec['id'],'phone':_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')],'WhatsappAccountId':_0x342cea[_0x9853('0x58')]['id']};var _0x5929e6={'ContactId':_0x16ccec['id'],'WhatsappAccountId':_0x342cea[_0x9853('0x58')]['id'],'closed':![]};return db[_0x9853('0xa6')][_0x9853('0x5f')]({'where':_0x5929e6})[_0x9853('0x1f')](function(_0xfd1720){if(_0xfd1720){return[_0xfd1720,![]];}return db[_0x9853('0xa6')][_0x9853('0x5a')](_0xa2033e)[_0x9853('0x1f')](function(_0x501df8){return[_0x501df8,!![]];});});}})['spread'](function(_0x3758d6,_0x4a592f){_0x594c7d[_0x9853('0xa7')]=_0x3758d6[_0x9853('0x36')]({'plain':!![]});_0x594c7d[_0x9853('0xa7')][_0x9853('0xa8')]=![];if(_0x4a592f){if(_0x594c7d[_0x9853('0x84')][_0x9853('0xa9')]){_0x594c7d[_0x9853('0x8a')][_0x9853('0xaa')]({'id':0x0,'priority':_0x594c7d[_0x9853('0x8a')][_0x9853('0x4a')]+0x1,'app':_0x9853('0xab'),'appdata':_0x9853('0xac'),'interval':'*,*,*,*'});}_0x594c7d['interaction']['created']=!![];}return db[_0x9853('0xad')][_0x9853('0x5a')]({'phone':_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')],'messageId':_0x594c7d[_0x9853('0x5b')][_0x9853('0x9b')],'body':_0x594c7d[_0x9853('0x5b')][_0x9853('0x5b')],'WhatsappAccountId':_0x342cea[_0x9853('0x58')]['id'],'WhatsappInteractionId':_0x3758d6['id'],'direction':'in','ContactId':_0x3758d6[_0x9853('0xae')],'AttachmentId':_0x594c7d[_0x9853('0x5b')][_0x9853('0xaf')]});})[_0x9853('0x1f')](function(_0x38e461){_0x594c7d['message']=_0x38e461;if(_0x594c7d['interaction'][_0x9853('0xb0')]){return db['User'][_0x9853('0x5f')]({'attributes':['id',_0x9853('0x39')],'where':{'id':_0x594c7d[_0x9853('0xa7')][_0x9853('0xb0')]}})[_0x9853('0x1f')](function(_0x384dc4){if(_0x384dc4){_0x594c7d[_0x9853('0x8a')][_0x9853('0xb1')]({'id':0x0,'priority':0x0,'app':_0x9853('0xb2'),'appdata':_0x384dc4[_0x9853('0x39')]+','+(_0x594c7d['account'][_0x9853('0xb3')]||0xa),'interval':_0x9853('0xb4')});}return respondWithRpcPromise('Start','startRouting',_0x594c7d);});}return respondWithRpcPromise(_0x9853('0xb5'),_0x9853('0xb6'),_0x594c7d);})[_0x9853('0x1f')](function(_0x37a908){if(_0x37a908){var _0x5e8833=0xc8;var _0x48d3c0='receiveMessage';logger[_0x9853('0x20')](_0x9853('0x23'),_0x48d3c0,_0x5e8833,_0x9853('0xb7'));logger[_0x9853('0xb8')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x48d3c0,_0x5e8833,_0x9853('0xb7'),JSON[_0x9853('0x24')](_0x37a908));if(_0x594c7d[_0x9853('0x84')]['type']===_0x9853('0x96')){return _0xe4c74c[_0x9853('0x2c')](_0x5e8833)[_0x9853('0x32')](_0x9853('0xb9'),_0x9853('0xba'))[_0x9853('0x3a')](_0x9853('0xbb'));}else{return _0xe4c74c[_0x9853('0x2c')](_0x5e8833)['json'](_0x37a908);}}});})['catch'](handleError(_0xe4c74c,null));};exports[_0x9853('0x3a')]=function(_0x24150f,_0x4223bd,_0x59f15c){var _0x4740fd,_0x22490,_0x13d1ba;if(_[_0x9853('0x9e')](_0x24150f[_0x9853('0x5b')][_0x9853('0x5b')])||_0x24150f[_0x9853('0x5b')][_0x9853('0x5b')]===''){throw new db['Sequelize'][(_0x9853('0x8f'))](_0x9853('0xa0'));}if(_[_0x9853('0x9e')](_0x24150f['body']['to'])){throw new db['Sequelize'][(_0x9853('0x8f'))](_0x9853('0xbc'));}_0x4740fd=_0x24150f[_0x9853('0x5b')]['to'];return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x24150f[_0x9853('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9853('0x8d')],'as':'Contacts','where':{'mobile':_0x4740fd},'limit':0x1,'order':[[_0x9853('0x93'),_0x9853('0xa4')]]}]}]})[_0x9853('0x1f')](handleEntityNotFound(_0x4223bd,null))[_0x9853('0x1f')](function(_0x134d05){if(_0x134d05&&_0x134d05[_0x9853('0xbd')]){_0x22490=_0x134d05[_0x9853('0x36')]({'plain':!![]});if(_0x22490[_0x9853('0xbd')]&&_0x22490[_0x9853('0xbd')][_0x9853('0xa3')][_0x9853('0x4a')]){return _0x22490[_0x9853('0xbd')][_0x9853('0xa3')][0x0];}return db[_0x9853('0x8d')][_0x9853('0x5a')](_['defaults'](_0x24150f[_0x9853('0x5b')],{'firstName':_0x4740fd,'mobile':_0x4740fd,'phone':_0x4740fd,'ListId':_0x22490[_0x9853('0xbe')]}));}})[_0x9853('0x1f')](handleEntityNotFound(_0x4223bd,null))['then'](function(_0x1a1d4f){if(_0x1a1d4f){_0x13d1ba=_0x1a1d4f;return db[_0x9853('0xa6')][_0x9853('0x5f')]({'where':{'ContactId':_0x13d1ba['id'],'closed':![],'WhatsappAccountId':_0x22490['id']}})[_0x9853('0x1f')](function(_0x4d2ea4){if(_0x4d2ea4){return[_0x4d2ea4,![]];}return db['WhatsappInteraction'][_0x9853('0x5a')]({'UserId':_0x24150f[_0x9853('0x5e')]['id'],'ContactId':_0x13d1ba['id'],'WhatsappAccountId':_0x22490['id'],'phone':_0x4740fd,'firstMsgDirection':_0x9853('0xbf'),'Messages':[_[_0x9853('0x52')](_0x24150f[_0x9853('0x5b')],{'read':![],'body':_0x24150f[_0x9853('0x5b')][_0x9853('0x5b')],'phone':_0x4740fd,'WhatsappAccountId':_0x22490['id'],'UserId':_0x24150f[_0x9853('0x5e')]['id'],'ContactId':_0x13d1ba['id']})]},{'include':[{'model':db[_0x9853('0xad')],'as':_0x9853('0xc0')}]})[_0x9853('0x1f')](function(_0x5095ee){return[_0x5095ee,!![]];});});}})['spread'](function(_0x2c0edd,_0x15214b){if(_0x15214b){return _0x2c0edd;}return db[_0x9853('0xad')][_0x9853('0x5a')](_[_0x9853('0x52')](_0x24150f['body'],{'read':![],'body':_0x24150f[_0x9853('0x5b')]['body'],'phone':_0x4740fd,'WhatsappAccountId':_0x22490['id'],'WhatsappInteractionId':_0x2c0edd['id'],'UserId':_0x24150f['user']['id'],'ContactId':_0x13d1ba['id']}))[_0x9853('0x1f')](function(_0x360942){_0x2c0edd[_0x9853('0xc1')][_0x9853('0xc0')]=[];_0x2c0edd[_0x9853('0xc1')][_0x9853('0xc0')][_0x9853('0xaa')](_0x360942[_0x9853('0xc1')]);return _0x2c0edd;});})['then'](respondWithResult(_0x4223bd,null))['catch'](handleError(_0x4223bd,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 36e2a9d..7a48ff6 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb550=['hook','exports','events','../../mysqldb','WhatsappAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xb550,0x84));var _0x0b55=function(_0x343d83,_0x15ee30){_0x343d83=_0x343d83-0x0;var _0x168313=_0xb550[_0x343d83];return _0x168313;};'use strict';var EventEmitter=require(_0x0b55('0x0'));var WhatsappAccount=require(_0x0b55('0x1'))['db'][_0x0b55('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0b55('0x3'),'afterUpdate':_0x0b55('0x4'),'afterDestroy':_0x0b55('0x5')};function emitEvent(_0x2f417e){return function(_0x46f4dd,_0x7b626f,_0x1c6461){WhatsappAccountEvents[_0x0b55('0x6')](_0x2f417e+':'+_0x46f4dd['id'],_0x46f4dd);WhatsappAccountEvents[_0x0b55('0x6')](_0x2f417e,_0x46f4dd);_0x1c6461(null);};}for(var e in events){if(events[_0x0b55('0x7')](e)){var event=events[e];WhatsappAccount[_0x0b55('0x8')](e,emitEvent(event));}}module[_0x0b55('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xe435=['events','../../mysqldb','WhatsappAccount','save','update','remove','emit','hook'];(function(_0x4c7e5c,_0x3d8711){var _0x4cae7d=function(_0x30cb65){while(--_0x30cb65){_0x4c7e5c['push'](_0x4c7e5c['shift']());}};_0x4cae7d(++_0x3d8711);}(_0xe435,0x70));var _0x5e43=function(_0x2ad237,_0x51ef20){_0x2ad237=_0x2ad237-0x0;var _0x35ca94=_0xe435[_0x2ad237];return _0x35ca94;};'use strict';var EventEmitter=require(_0x5e43('0x0'));var WhatsappAccount=require(_0x5e43('0x1'))['db'][_0x5e43('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e43('0x3'),'afterUpdate':_0x5e43('0x4'),'afterDestroy':_0x5e43('0x5')};function emitEvent(_0x5714dd){return function(_0x214ca5,_0x3399bc,_0x3a8071){WhatsappAccountEvents[_0x5e43('0x6')](_0x5714dd+':'+_0x214ca5['id'],_0x214ca5);WhatsappAccountEvents['emit'](_0x5714dd,_0x214ca5);_0x3a8071(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x5e43('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 81b2a82..eeb2502 100644 --- a/server/api/whatsappAccount/whatsappAccount.model.js +++ b/server/api/whatsappAccount/whatsappAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd157=['./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2fe5b9,_0x127e48){var _0x6f874=function(_0x23f8e7){while(--_0x23f8e7){_0x2fe5b9['push'](_0x2fe5b9['shift']());}};_0x6f874(++_0x127e48);}(_0xd157,0x1f4));var _0x7d15=function(_0xa67d07,_0x4b45d0){_0xa67d07=_0xa67d07-0x0;var _0x4b7d86=_0xd157[_0xa67d07];return _0x4b7d86;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7d15('0x0'));var moment=require(_0x7d15('0x1'));var BPromise=require(_0x7d15('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d15('0x3'));var rimraf=require(_0x7d15('0x4'));var config=require(_0x7d15('0x5'));var attributes=require(_0x7d15('0x6'));module[_0x7d15('0x7')]=function(_0x3411c0,_0x2a455e){return _0x3411c0[_0x7d15('0x8')](_0x7d15('0x9'),attributes,{'tableName':_0x7d15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3af6=['WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x221e9a,_0x52034a){var _0xf204d6=function(_0xd99672){while(--_0xd99672){_0x221e9a['push'](_0x221e9a['shift']());}};_0xf204d6(++_0x52034a);}(_0x3af6,0x116));var _0x63af=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3af6[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x63af('0x0'));var logger=require(_0x63af('0x1'))(_0x63af('0x2'));var moment=require(_0x63af('0x3'));var BPromise=require('bluebird');var rp=require(_0x63af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63af('0x5'));var config=require(_0x63af('0x6'));var attributes=require(_0x63af('0x7'));module[_0x63af('0x8')]=function(_0x491c36,_0x582f91){return _0x491c36[_0x63af('0x9')](_0x63af('0xa'),attributes,{'tableName':_0x63af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 07f3d00..a90c48d 100644 --- a/server/api/whatsappAccount/whatsappAccount.rpc.js +++ b/server/api/whatsappAccount/whatsappAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6c6=['then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb6c6,0xeb));var _0x6b6c=function(_0x2ab235,_0xd9dc55){_0x2ab235=_0x2ab235-0x0;var _0x51d4e8=_0xb6c6[_0x2ab235];return _0x51d4e8;};'use strict';var _=require(_0x6b6c('0x0'));var util=require(_0x6b6c('0x1'));var moment=require(_0x6b6c('0x2'));var BPromise=require(_0x6b6c('0x3'));var rs=require(_0x6b6c('0x4'));var fs=require('fs');var Redis=require(_0x6b6c('0x5'));var db=require(_0x6b6c('0x6'))['db'];var utils=require(_0x6b6c('0x7'));var logger=require(_0x6b6c('0x8'))('rpc');var config=require(_0x6b6c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6b6c('0xa')][_0x6b6c('0xb')]({'port':0x232a});config[_0x6b6c('0xc')]=_[_0x6b6c('0xd')](config[_0x6b6c('0xc')],{'host':_0x6b6c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6b6c('0xf'))[_0x6b6c('0x10')](socket);function respondWithRpcPromise(_0x5a7e18,_0x26aa4d,_0x27ed41){return new BPromise(function(_0x5e6120,_0xd57329){return client[_0x6b6c('0x11')](_0x5a7e18,_0x27ed41)['then'](function(_0x485bb3){logger[_0x6b6c('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x26aa4d,_0x6b6c('0x13'));logger[_0x6b6c('0x14')](_0x6b6c('0x15'),_0x26aa4d,_0x6b6c('0x13'),JSON[_0x6b6c('0x16')](_0x485bb3));if(_0x485bb3[_0x6b6c('0x17')]){if(_0x485bb3[_0x6b6c('0x17')][_0x6b6c('0x18')]===0x1f4){logger[_0x6b6c('0x17')](_0x6b6c('0x19'),_0x26aa4d,_0x485bb3[_0x6b6c('0x17')][_0x6b6c('0x1a')]);return _0xd57329(_0x485bb3[_0x6b6c('0x17')]['message']);}logger[_0x6b6c('0x17')](_0x6b6c('0x19'),_0x26aa4d,_0x485bb3[_0x6b6c('0x17')]['message']);return _0x5e6120(_0x485bb3[_0x6b6c('0x17')][_0x6b6c('0x1a')]);}else{logger[_0x6b6c('0x12')](_0x6b6c('0x19'),_0x26aa4d,_0x6b6c('0x13'));_0x5e6120(_0x485bb3[_0x6b6c('0x1b')]['message']);}})[_0x6b6c('0x1c')](function(_0x356390){logger['error'](_0x6b6c('0x19'),_0x26aa4d,_0x356390);_0xd57329(_0x356390);});});}exports[_0x6b6c('0x1d')]=function(_0x20b9c7){var _0x5ddc3c=this;return new Promise(function(_0x56e02d,_0x247bb5){return db[_0x6b6c('0x1e')]['find']({'raw':_0x20b9c7[_0x6b6c('0x1f')]?_0x20b9c7[_0x6b6c('0x1f')][_0x6b6c('0x20')]===undefined?!![]:![]:!![],'where':_0x20b9c7['options']?_0x20b9c7[_0x6b6c('0x1f')][_0x6b6c('0x21')]||null:null,'attributes':_0x20b9c7[_0x6b6c('0x1f')]?_0x20b9c7[_0x6b6c('0x1f')][_0x6b6c('0x22')]||null:null,'include':_0x20b9c7['options']?_0x20b9c7[_0x6b6c('0x1f')][_0x6b6c('0x23')]?_[_0x6b6c('0x24')](_0x20b9c7['options'][_0x6b6c('0x23')],function(_0x30cca4){return{'model':db[_0x30cca4[_0x6b6c('0x25')]],'as':_0x30cca4['as'],'attributes':_0x30cca4[_0x6b6c('0x22')],'include':_0x30cca4[_0x6b6c('0x23')]?_[_0x6b6c('0x24')](_0x30cca4[_0x6b6c('0x23')],function(_0x3f4516){return{'model':db[_0x3f4516['model']],'as':_0x3f4516['as'],'attributes':_0x3f4516[_0x6b6c('0x22')],'include':_0x3f4516[_0x6b6c('0x23')]?_['map'](_0x3f4516[_0x6b6c('0x23')],function(_0x592c42){return{'model':db[_0x592c42[_0x6b6c('0x25')]],'as':_0x592c42['as'],'attributes':_0x592c42[_0x6b6c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6b6c('0x26')](function(_0x53d2f4){logger[_0x6b6c('0x12')](_0x6b6c('0x1d'),_0x20b9c7);logger['debug'](_0x6b6c('0x1d'),_0x20b9c7,JSON['stringify'](_0x53d2f4));_0x56e02d(_0x53d2f4);})[_0x6b6c('0x1c')](function(_0x5bf774){logger[_0x6b6c('0x17')](_0x6b6c('0x1d'),_0x5bf774[_0x6b6c('0x1a')],_0x20b9c7);_0x247bb5(_0x5ddc3c[_0x6b6c('0x17')](0x1f4,_0x5bf774[_0x6b6c('0x1a')]));});});}; \ No newline at end of file +var _0xbde8=['localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis'];(function(_0x531233,_0x25067c){var _0x343e88=function(_0x1079d5){while(--_0x1079d5){_0x531233['push'](_0x531233['shift']());}};_0x343e88(++_0x25067c);}(_0xbde8,0xd9));var _0x8bde=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0xbde8[_0x525b28];return _0x180178;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bde('0x0'));var db=require(_0x8bde('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8bde('0x2'));var jayson=require(_0x8bde('0x3'));var client=jayson[_0x8bde('0x4')][_0x8bde('0x5')]({'port':0x232a});config[_0x8bde('0x6')]=_['defaults'](config['redis'],{'host':_0x8bde('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8bde('0x8'))[_0x8bde('0x9')](socket);function respondWithRpcPromise(_0x5134c1,_0x201568,_0x5070ed){return new BPromise(function(_0x2f083e,_0x45996b){return client[_0x8bde('0xa')](_0x5134c1,_0x5070ed)[_0x8bde('0xb')](function(_0x23b9ab){logger[_0x8bde('0xc')](_0x8bde('0xd'),_0x201568,_0x8bde('0xe'));logger[_0x8bde('0xf')](_0x8bde('0x10'),_0x201568,_0x8bde('0xe'),JSON[_0x8bde('0x11')](_0x23b9ab));if(_0x23b9ab['error']){if(_0x23b9ab[_0x8bde('0x12')][_0x8bde('0x13')]===0x1f4){logger[_0x8bde('0x12')](_0x8bde('0xd'),_0x201568,_0x23b9ab['error']['message']);return _0x45996b(_0x23b9ab[_0x8bde('0x12')][_0x8bde('0x14')]);}logger[_0x8bde('0x12')](_0x8bde('0xd'),_0x201568,_0x23b9ab[_0x8bde('0x12')][_0x8bde('0x14')]);return _0x2f083e(_0x23b9ab[_0x8bde('0x12')][_0x8bde('0x14')]);}else{logger[_0x8bde('0xc')](_0x8bde('0xd'),_0x201568,_0x8bde('0xe'));_0x2f083e(_0x23b9ab[_0x8bde('0x15')][_0x8bde('0x14')]);}})[_0x8bde('0x16')](function(_0xef975){logger[_0x8bde('0x12')](_0x8bde('0xd'),_0x201568,_0xef975);_0x45996b(_0xef975);});});}exports[_0x8bde('0x17')]=function(_0x382fd9){var _0x2dc1f1=this;return new Promise(function(_0x52a1ad,_0x2139b8){return db['WhatsappAccount'][_0x8bde('0x18')]({'raw':_0x382fd9[_0x8bde('0x19')]?_0x382fd9[_0x8bde('0x19')][_0x8bde('0x1a')]===undefined?!![]:![]:!![],'where':_0x382fd9['options']?_0x382fd9['options'][_0x8bde('0x1b')]||null:null,'attributes':_0x382fd9[_0x8bde('0x19')]?_0x382fd9[_0x8bde('0x19')][_0x8bde('0x1c')]||null:null,'include':_0x382fd9['options']?_0x382fd9[_0x8bde('0x19')][_0x8bde('0x1d')]?_[_0x8bde('0x1e')](_0x382fd9[_0x8bde('0x19')][_0x8bde('0x1d')],function(_0x53cb5d){return{'model':db[_0x53cb5d[_0x8bde('0x1f')]],'as':_0x53cb5d['as'],'attributes':_0x53cb5d['attributes'],'include':_0x53cb5d[_0x8bde('0x1d')]?_[_0x8bde('0x1e')](_0x53cb5d['include'],function(_0x1b8df8){return{'model':db[_0x1b8df8['model']],'as':_0x1b8df8['as'],'attributes':_0x1b8df8[_0x8bde('0x1c')],'include':_0x1b8df8[_0x8bde('0x1d')]?_[_0x8bde('0x1e')](_0x1b8df8[_0x8bde('0x1d')],function(_0x28a7b1){return{'model':db[_0x28a7b1[_0x8bde('0x1f')]],'as':_0x28a7b1['as'],'attributes':_0x28a7b1[_0x8bde('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8bde('0xb')](function(_0x33b03c){logger[_0x8bde('0xc')]('ShowWhatsappAccount',_0x382fd9);logger['debug'](_0x8bde('0x17'),_0x382fd9,JSON[_0x8bde('0x11')](_0x33b03c));_0x52a1ad(_0x33b03c);})['catch'](function(_0x21698d){logger[_0x8bde('0x12')](_0x8bde('0x17'),_0x21698d[_0x8bde('0x14')],_0x382fd9);_0x2139b8(_0x2dc1f1[_0x8bde('0x12')](0x1f4,_0x21698d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index e6d9ad0..350180a 100644 --- a/server/api/whatsappAccount/whatsappAccount.socket.js +++ b/server/api/whatsappAccount/whatsappAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb559=['save','remove','update','emit','removeListener'];(function(_0x3c6c4d,_0x3b3c92){var _0x3bea7c=function(_0x298c23){while(--_0x298c23){_0x3c6c4d['push'](_0x3c6c4d['shift']());}};_0x3bea7c(++_0x3b3c92);}(_0xb559,0x195));var _0x9b55=function(_0x13a6d8,_0x6189c){_0x13a6d8=_0x13a6d8-0x0;var _0x176743=_0xb559[_0x13a6d8];return _0x176743;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x9b55('0x0'),_0x9b55('0x1'),_0x9b55('0x2')];function createListener(_0x2a5e31,_0xb3639c){return function(_0x262a9a){_0xb3639c[_0x9b55('0x3')](_0x2a5e31,_0x262a9a);};}function removeListener(_0x40b9b5,_0x4e1904){return function(){WhatsappAccountEvents[_0x9b55('0x4')](_0x40b9b5,_0x4e1904);};}exports['register']=function(_0x117158){for(var _0x310f6a=0x0,_0xf3c89d=events['length'];_0x310f6a<_0xf3c89d;_0x310f6a++){var _0x56eb4d=events[_0x310f6a];var _0x4b9033=createListener('whatsappAccount:'+_0x56eb4d,_0x117158);WhatsappAccountEvents['on'](_0x56eb4d,_0x4b9033);}}; \ No newline at end of file +var _0x3a0a=['emit','removeListener','register','length','save','remove','update'];(function(_0x1ba252,_0x34411f){var _0x459466=function(_0x55f893){while(--_0x55f893){_0x1ba252['push'](_0x1ba252['shift']());}};_0x459466(++_0x34411f);}(_0x3a0a,0x154));var _0xa3a0=function(_0x248302,_0x22b1a7){_0x248302=_0x248302-0x0;var _0x5ea301=_0x3a0a[_0x248302];return _0x5ea301;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xa3a0('0x0'),_0xa3a0('0x1'),_0xa3a0('0x2')];function createListener(_0xe24f0,_0x21a9d4){return function(_0x21e61b){_0x21a9d4[_0xa3a0('0x3')](_0xe24f0,_0x21e61b);};}function removeListener(_0xcbdd5c,_0x3dd712){return function(){WhatsappAccountEvents[_0xa3a0('0x4')](_0xcbdd5c,_0x3dd712);};}exports[_0xa3a0('0x5')]=function(_0x2d56c4){for(var _0x40b3b3=0x0,_0x204208=events[_0xa3a0('0x6')];_0x40b3b3<_0x204208;_0x40b3b3++){var _0x27c176=events[_0x40b3b3];var _0x218170=createListener('whatsappAccount:'+_0x27c176,_0x2d56c4);WhatsappAccountEvents['on'](_0x27c176,_0x218170);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index cbccad2..a846173 100644 --- a/server/api/whatsappApplication/index.js +++ b/server/api/whatsappApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf919=['delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','create','/:id','update'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xf919,0x151));var _0x9f91=function(_0x19a11f,_0x6d8be7){_0x19a11f=_0x19a11f-0x0;var _0x51485f=_0xf919[_0x19a11f];return _0x51485f;};'use strict';var multer=require(_0x9f91('0x0'));var util=require(_0x9f91('0x1'));var path=require(_0x9f91('0x2'));var timeout=require(_0x9f91('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f91('0x4'));var auth=require(_0x9f91('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9f91('0x6'));var controller=require(_0x9f91('0x7'));router[_0x9f91('0x8')]('/',auth[_0x9f91('0x9')](),controller[_0x9f91('0xa')]);router['get']('/:id',auth[_0x9f91('0x9')](),controller[_0x9f91('0xb')]);router['post']('/',auth[_0x9f91('0x9')](),controller[_0x9f91('0xc')]);router['put'](_0x9f91('0xd'),auth[_0x9f91('0x9')](),controller[_0x9f91('0xe')]);router[_0x9f91('0xf')](_0x9f91('0xd'),auth[_0x9f91('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4e7d=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x497d8c,_0x2904c9){var _0xeafed7=function(_0x3b51e8){while(--_0x3b51e8){_0x497d8c['push'](_0x497d8c['shift']());}};_0xeafed7(++_0x2904c9);}(_0x4e7d,0x187));var _0xd4e7=function(_0x2a9407,_0x5d18e9){_0x2a9407=_0x2a9407-0x0;var _0x51f349=_0x4e7d[_0x2a9407];return _0x51f349;};'use strict';var multer=require(_0xd4e7('0x0'));var util=require(_0xd4e7('0x1'));var path=require(_0xd4e7('0x2'));var timeout=require(_0xd4e7('0x3'));var express=require(_0xd4e7('0x4'));var router=express[_0xd4e7('0x5')]();var fs_extra=require(_0xd4e7('0x6'));var auth=require(_0xd4e7('0x7'));var interaction=require(_0xd4e7('0x8'));var config=require(_0xd4e7('0x9'));var controller=require(_0xd4e7('0xa'));router[_0xd4e7('0xb')]('/',auth[_0xd4e7('0xc')](),controller[_0xd4e7('0xd')]);router[_0xd4e7('0xb')](_0xd4e7('0xe'),auth[_0xd4e7('0xc')](),controller[_0xd4e7('0xf')]);router['post']('/',auth[_0xd4e7('0xc')](),controller[_0xd4e7('0x10')]);router['put'](_0xd4e7('0xe'),auth[_0xd4e7('0xc')](),controller[_0xd4e7('0x11')]);router[_0xd4e7('0x12')](_0xd4e7('0xe'),auth[_0xd4e7('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index eb31700..2433440 100644 --- a/server/api/whatsappApplication/whatsappApplication.attributes.js +++ b/server/api/whatsappApplication/whatsappApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6406=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3d0247,_0x2e5a09){var _0x5d2f3a=function(_0x441e19){while(--_0x441e19){_0x3d0247['push'](_0x3d0247['shift']());}};_0x5d2f3a(++_0x2e5a09);}(_0x6406,0x1e9));var _0x6640=function(_0x417aa6,_0x401f42){_0x417aa6=_0x417aa6-0x0;var _0x46e3bc=_0x6406[_0x417aa6];return _0x46e3bc;};'use strict';var Sequelize=require(_0x6640('0x0'));module[_0x6640('0x1')]={'priority':{'type':Sequelize[_0x6640('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6640('0x3')]()},'description':{'type':Sequelize[_0x6640('0x4')]},'interval':{'type':Sequelize[_0x6640('0x4')],'defaultValue':_0x6640('0x5')}}; \ No newline at end of file +var _0x0ca4=['sequelize','INTEGER','STRING','*,*,*,*'];(function(_0x96eef2,_0x4bf5a1){var _0x316ecd=function(_0x5ff233){while(--_0x5ff233){_0x96eef2['push'](_0x96eef2['shift']());}};_0x316ecd(++_0x4bf5a1);}(_0x0ca4,0xe8));var _0x40ca=function(_0x33899b,_0x4eed99){_0x33899b=_0x33899b-0x0;var _0x344612=_0x0ca4[_0x33899b];return _0x344612;};'use strict';var Sequelize=require(_0x40ca('0x0'));module['exports']={'priority':{'type':Sequelize[_0x40ca('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x40ca('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x40ca('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x40ca('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 50a83d2..794820b 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf960=['sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','stack','name','send','map','WhatsappApplication','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','zip-dir','request-promise','moment','mustache'];(function(_0x102b9f,_0x661060){var _0x42c57d=function(_0x5500c2){while(--_0x5500c2){_0x102b9f['push'](_0x102b9f['shift']());}};_0x42c57d(++_0x661060);}(_0xf960,0x193));var _0x0f96=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xf960[_0x19159a];return _0xa677f4;};'use strict';var emlformat=require(_0x0f96('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f96('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f96('0x2'));var moment=require(_0x0f96('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0f96('0x4'));var util=require('util');var path=require('path');var sox=require(_0x0f96('0x5'));var csv=require(_0x0f96('0x6'));var ejs=require(_0x0f96('0x7'));var fs=require('fs');var fs_extra=require(_0x0f96('0x8'));var _=require(_0x0f96('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0f96('0xa'));var deskjs=require(_0x0f96('0xb'));var toCsv=require(_0x0f96('0x6'));var querystring=require(_0x0f96('0xc'));var Papa=require(_0x0f96('0xd'));var Redis=require(_0x0f96('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0f96('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f96('0x10'));var logger=require('../../config/logger')(_0x0f96('0x11'));var utils=require(_0x0f96('0x12'));var config=require(_0x0f96('0x13'));var licenseUtil=require(_0x0f96('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe8aee6,_0x23182a){_0x23182a=_0x23182a||0xcc;return function(_0x1c0283){if(_0x1c0283){return _0xe8aee6[_0x0f96('0x15')](_0x23182a);}return _0xe8aee6['status'](_0x23182a)[_0x0f96('0x16')]();};}function respondWithResult(_0x103185,_0x36d1ca){_0x36d1ca=_0x36d1ca||0xc8;return function(_0x386943){if(_0x386943){return _0x103185[_0x0f96('0x17')](_0x36d1ca)[_0x0f96('0x18')](_0x386943);}};}function respondWithFilteredResult(_0x5080c3,_0x232d94){return function(_0x47ba05){if(_0x47ba05){var _0x4f55cf=typeof _0x232d94[_0x0f96('0x19')]===_0x0f96('0x1a')&&typeof _0x232d94[_0x0f96('0x1b')]===_0x0f96('0x1a');var _0x3f1273=_0x47ba05[_0x0f96('0x1c')];var _0x2dc06c=_0x4f55cf?0x0:_0x232d94[_0x0f96('0x19')];var _0x36ded7=_0x4f55cf?_0x47ba05[_0x0f96('0x1c')]:_0x232d94[_0x0f96('0x19')]+_0x232d94[_0x0f96('0x1b')];var _0x173f3c;if(_0x36ded7>=_0x3f1273){_0x36ded7=_0x3f1273;_0x173f3c=0xc8;}else{_0x173f3c=0xce;}_0x5080c3[_0x0f96('0x17')](_0x173f3c);return _0x5080c3['set'](_0x0f96('0x1d'),_0x2dc06c+'-'+_0x36ded7+'/'+_0x3f1273)[_0x0f96('0x18')](_0x47ba05);}return null;};}function patchUpdates(_0x125b50){return function(_0xea96e0){try{jsonpatch['apply'](_0xea96e0,_0x125b50,!![]);}catch(_0x210a93){return BPromise[_0x0f96('0x1e')](_0x210a93);}return _0xea96e0[_0x0f96('0x1f')]();};}function saveUpdates(_0x47993c,_0x25494f){return function(_0x201226){if(_0x201226){return _0x201226['update'](_0x47993c)[_0x0f96('0x20')](function(_0x142de1){return _0x142de1;});}return null;};}function removeEntity(_0x366146,_0x21bd49){return function(_0x4b3d9f){if(_0x4b3d9f){return _0x4b3d9f[_0x0f96('0x21')]()[_0x0f96('0x20')](function(){_0x366146[_0x0f96('0x17')](0xcc)[_0x0f96('0x16')]();});}};}function handleEntityNotFound(_0x262353,_0x34676c){return function(_0x3cfca7){if(!_0x3cfca7){_0x262353['sendStatus'](0x194);}return _0x3cfca7;};}function handleError(_0x248b45,_0x3a7c7b){_0x3a7c7b=_0x3a7c7b||0x1f4;return function(_0x31e9e6){logger['error'](_0x31e9e6[_0x0f96('0x22')]);if(_0x31e9e6[_0x0f96('0x23')]){delete _0x31e9e6[_0x0f96('0x23')];}_0x248b45[_0x0f96('0x17')](_0x3a7c7b)[_0x0f96('0x24')](_0x31e9e6);};}exports['index']=function(_0x2961e1,_0x254683){var _0x3489bc={},_0x219757={},_0xcb71bd={'count':0x0,'rows':[]};var _0x1f9f2c=_[_0x0f96('0x25')](db[_0x0f96('0x26')][_0x0f96('0x27')],function(_0x163f5f){return{'name':_0x163f5f['fieldName'],'type':_0x163f5f[_0x0f96('0x28')][_0x0f96('0x29')]};});_0x219757['model']=_[_0x0f96('0x25')](_0x1f9f2c,_0x0f96('0x23'));_0x219757['query']=_[_0x0f96('0x2a')](_0x2961e1[_0x0f96('0x2b')]);_0x219757[_0x0f96('0x2c')]=_[_0x0f96('0x2d')](_0x219757[_0x0f96('0x2e')],_0x219757[_0x0f96('0x2b')]);_0x3489bc[_0x0f96('0x2f')]=_['intersection'](_0x219757['model'],qs[_0x0f96('0x30')](_0x2961e1['query']['fields']));_0x3489bc['attributes']=_0x3489bc[_0x0f96('0x2f')][_0x0f96('0x31')]?_0x3489bc[_0x0f96('0x2f')]:_0x219757['model'];if(!_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x32')](_0x0f96('0x33'))){_0x3489bc[_0x0f96('0x1b')]=qs[_0x0f96('0x1b')](_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x1b')]);_0x3489bc[_0x0f96('0x19')]=qs['offset'](_0x2961e1[_0x0f96('0x2b')]['offset']);}_0x3489bc[_0x0f96('0x34')]=qs[_0x0f96('0x35')](_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x35')]);_0x3489bc[_0x0f96('0x36')]=qs[_0x0f96('0x2c')](_[_0x0f96('0x37')](_0x2961e1['query'],_0x219757['filters']),_0x1f9f2c);if(_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x38')]){_0x3489bc[_0x0f96('0x36')]=_[_0x0f96('0x39')](_0x3489bc['where'],{'$or':_[_0x0f96('0x25')](_0x1f9f2c,function(_0x2c14af){if(_0x2c14af[_0x0f96('0x28')]!==_0x0f96('0x3a')){var _0x1a880e={};_0x1a880e[_0x2c14af[_0x0f96('0x23')]]={'$like':'%'+_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x38')]+'%'};return _0x1a880e;}})});}_0x3489bc=_[_0x0f96('0x39')]({},_0x3489bc,_0x2961e1['options']);var _0xa58381={'where':_0x3489bc[_0x0f96('0x36')]};return db['WhatsappApplication'][_0x0f96('0x1c')](_0xa58381)[_0x0f96('0x20')](function(_0x35eb62){_0xcb71bd['count']=_0x35eb62;if(_0x2961e1[_0x0f96('0x2b')][_0x0f96('0x3b')]){_0x3489bc['include']=[{'all':!![]}];}return db[_0x0f96('0x26')][_0x0f96('0x3c')](_0x3489bc);})['then'](function(_0x24a4d9){_0xcb71bd['rows']=_0x24a4d9;return _0xcb71bd;})['then'](respondWithFilteredResult(_0x254683,_0x3489bc))[_0x0f96('0x3d')](handleError(_0x254683,null));};exports[_0x0f96('0x3e')]=function(_0x29de3d,_0x231be2){var _0x261452={'raw':!![],'where':{'id':_0x29de3d[_0x0f96('0x3f')]['id']}},_0x1e6b76={};_0x1e6b76[_0x0f96('0x2e')]=_['keys'](db['WhatsappApplication'][_0x0f96('0x27')]);_0x1e6b76['query']=_[_0x0f96('0x2a')](_0x29de3d[_0x0f96('0x2b')]);_0x1e6b76[_0x0f96('0x2c')]=_[_0x0f96('0x2d')](_0x1e6b76[_0x0f96('0x2e')],_0x1e6b76[_0x0f96('0x2b')]);_0x261452[_0x0f96('0x2f')]=_['intersection'](_0x1e6b76[_0x0f96('0x2e')],qs[_0x0f96('0x30')](_0x29de3d[_0x0f96('0x2b')][_0x0f96('0x30')]));_0x261452[_0x0f96('0x2f')]=_0x261452[_0x0f96('0x2f')][_0x0f96('0x31')]?_0x261452[_0x0f96('0x2f')]:_0x1e6b76[_0x0f96('0x2e')];if(_0x29de3d[_0x0f96('0x2b')][_0x0f96('0x3b')]){_0x261452[_0x0f96('0x40')]=[{'all':!![]}];}_0x261452=_['merge']({},_0x261452,_0x29de3d['options']);return db[_0x0f96('0x26')][_0x0f96('0x41')](_0x261452)[_0x0f96('0x20')](handleEntityNotFound(_0x231be2,null))['then'](respondWithResult(_0x231be2,null))[_0x0f96('0x3d')](handleError(_0x231be2,null));};exports[_0x0f96('0x42')]=function(_0x26ae06,_0x2d363b){return db[_0x0f96('0x26')]['create'](_0x26ae06[_0x0f96('0x43')],{})[_0x0f96('0x20')](respondWithResult(_0x2d363b,0xc9))['catch'](handleError(_0x2d363b,null));};exports['update']=function(_0x26a29a,_0x3fce0c){if(_0x26a29a[_0x0f96('0x43')]['id']){delete _0x26a29a[_0x0f96('0x43')]['id'];}return db[_0x0f96('0x26')]['find']({'where':{'id':_0x26a29a[_0x0f96('0x3f')]['id']}})[_0x0f96('0x20')](handleEntityNotFound(_0x3fce0c,null))[_0x0f96('0x20')](saveUpdates(_0x26a29a[_0x0f96('0x43')],null))[_0x0f96('0x20')](respondWithResult(_0x3fce0c,null))[_0x0f96('0x3d')](handleError(_0x3fce0c,null));};exports[_0x0f96('0x21')]=function(_0xc61a62,_0x52321e){return db[_0x0f96('0x26')]['find']({'where':{'id':_0xc61a62[_0x0f96('0x3f')]['id']}})[_0x0f96('0x20')](handleEntityNotFound(_0x52321e,null))[_0x0f96('0x20')](removeEntity(_0x52321e,null))[_0x0f96('0x3d')](handleError(_0x52321e,null));}; \ No newline at end of file +var _0xe35d=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','length','includeAll','find','catch','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3e5a76,_0x1e2316){var _0x2b9bc6=function(_0x1218e3){while(--_0x1218e3){_0x3e5a76['push'](_0x3e5a76['shift']());}};_0x2b9bc6(++_0x1e2316);}(_0xe35d,0xd5));var _0xde35=function(_0x2c6074,_0x29a401){_0x2c6074=_0x2c6074-0x0;var _0x8cdb5f=_0xe35d[_0x2c6074];return _0x8cdb5f;};'use strict';var emlformat=require(_0xde35('0x0'));var rimraf=require(_0xde35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xde35('0x2'));var moment=require(_0xde35('0x3'));var BPromise=require(_0xde35('0x4'));var Mustache=require(_0xde35('0x5'));var util=require(_0xde35('0x6'));var path=require(_0xde35('0x7'));var sox=require(_0xde35('0x8'));var csv=require(_0xde35('0x9'));var ejs=require(_0xde35('0xa'));var fs=require('fs');var fs_extra=require(_0xde35('0xb'));var _=require('lodash');var squel=require(_0xde35('0xc'));var crypto=require(_0xde35('0xd'));var jsforce=require(_0xde35('0xe'));var deskjs=require(_0xde35('0xf'));var toCsv=require(_0xde35('0x9'));var querystring=require('querystring');var Papa=require(_0xde35('0x10'));var Redis=require(_0xde35('0x11'));var authService=require(_0xde35('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde35('0x13'));var hardwareService=require(_0xde35('0x14'));var logger=require('../../config/logger')(_0xde35('0x15'));var utils=require('../../config/utils');var config=require(_0xde35('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xde35('0x17'))['db'];function respondWithStatusCode(_0x50b021,_0x51370b){_0x51370b=_0x51370b||0xcc;return function(_0x530552){if(_0x530552){return _0x50b021['sendStatus'](_0x51370b);}return _0x50b021['status'](_0x51370b)[_0xde35('0x18')]();};}function respondWithResult(_0x292a13,_0x4f58b1){_0x4f58b1=_0x4f58b1||0xc8;return function(_0x560d70){if(_0x560d70){return _0x292a13[_0xde35('0x19')](_0x4f58b1)[_0xde35('0x1a')](_0x560d70);}};}function respondWithFilteredResult(_0x1f318f,_0x2771fd){return function(_0x121717){if(_0x121717){var _0x5d8c6e=typeof _0x2771fd[_0xde35('0x1b')]===_0xde35('0x1c')&&typeof _0x2771fd[_0xde35('0x1d')]===_0xde35('0x1c');var _0x1f7d7f=_0x121717[_0xde35('0x1e')];var _0x19ec9e=_0x5d8c6e?0x0:_0x2771fd['offset'];var _0x3c912a=_0x5d8c6e?_0x121717['count']:_0x2771fd['offset']+_0x2771fd['limit'];var _0x408829;if(_0x3c912a>=_0x1f7d7f){_0x3c912a=_0x1f7d7f;_0x408829=0xc8;}else{_0x408829=0xce;}_0x1f318f['status'](_0x408829);return _0x1f318f[_0xde35('0x1f')](_0xde35('0x20'),_0x19ec9e+'-'+_0x3c912a+'/'+_0x1f7d7f)[_0xde35('0x1a')](_0x121717);}return null;};}function patchUpdates(_0x3d66d6){return function(_0x104a3b){try{jsonpatch[_0xde35('0x21')](_0x104a3b,_0x3d66d6,!![]);}catch(_0x441657){return BPromise[_0xde35('0x22')](_0x441657);}return _0x104a3b[_0xde35('0x23')]();};}function saveUpdates(_0x5cd6b2,_0x48c253){return function(_0x560c11){if(_0x560c11){return _0x560c11['update'](_0x5cd6b2)[_0xde35('0x24')](function(_0x394129){return _0x394129;});}return null;};}function removeEntity(_0x519035,_0x13ff99){return function(_0x126248){if(_0x126248){return _0x126248[_0xde35('0x25')]()['then'](function(){_0x519035[_0xde35('0x19')](0xcc)[_0xde35('0x18')]();});}};}function handleEntityNotFound(_0x740ab8,_0x3af90d){return function(_0x256277){if(!_0x256277){_0x740ab8[_0xde35('0x26')](0x194);}return _0x256277;};}function handleError(_0x2e4e79,_0x4a29a2){_0x4a29a2=_0x4a29a2||0x1f4;return function(_0x31a61d){logger['error'](_0x31a61d[_0xde35('0x27')]);if(_0x31a61d[_0xde35('0x28')]){delete _0x31a61d[_0xde35('0x28')];}_0x2e4e79[_0xde35('0x19')](_0x4a29a2)['send'](_0x31a61d);};}exports[_0xde35('0x29')]=function(_0x2fcc94,_0x10533a){var _0x17da4e={},_0x459d29={},_0x45ca01={'count':0x0,'rows':[]};var _0x2b50e4=_['map'](db[_0xde35('0x2a')][_0xde35('0x2b')],function(_0x459a50){return{'name':_0x459a50[_0xde35('0x2c')],'type':_0x459a50[_0xde35('0x2d')][_0xde35('0x2e')]};});_0x459d29[_0xde35('0x2f')]=_[_0xde35('0x30')](_0x2b50e4,'name');_0x459d29[_0xde35('0x31')]=_[_0xde35('0x32')](_0x2fcc94[_0xde35('0x31')]);_0x459d29[_0xde35('0x33')]=_['intersection'](_0x459d29['model'],_0x459d29[_0xde35('0x31')]);_0x17da4e[_0xde35('0x34')]=_[_0xde35('0x35')](_0x459d29['model'],qs[_0xde35('0x36')](_0x2fcc94[_0xde35('0x31')][_0xde35('0x36')]));_0x17da4e[_0xde35('0x34')]=_0x17da4e[_0xde35('0x34')]['length']?_0x17da4e[_0xde35('0x34')]:_0x459d29[_0xde35('0x2f')];if(!_0x2fcc94['query'][_0xde35('0x37')](_0xde35('0x38'))){_0x17da4e[_0xde35('0x1d')]=qs[_0xde35('0x1d')](_0x2fcc94[_0xde35('0x31')][_0xde35('0x1d')]);_0x17da4e['offset']=qs['offset'](_0x2fcc94[_0xde35('0x31')][_0xde35('0x1b')]);}_0x17da4e[_0xde35('0x39')]=qs['sort'](_0x2fcc94[_0xde35('0x31')][_0xde35('0x3a')]);_0x17da4e['where']=qs[_0xde35('0x33')](_[_0xde35('0x3b')](_0x2fcc94[_0xde35('0x31')],_0x459d29['filters']),_0x2b50e4);if(_0x2fcc94[_0xde35('0x31')][_0xde35('0x3c')]){_0x17da4e[_0xde35('0x3d')]=_[_0xde35('0x3e')](_0x17da4e[_0xde35('0x3d')],{'$or':_[_0xde35('0x30')](_0x2b50e4,function(_0x2a683a){if(_0x2a683a['type']!==_0xde35('0x3f')){var _0x472a23={};_0x472a23[_0x2a683a[_0xde35('0x28')]]={'$like':'%'+_0x2fcc94[_0xde35('0x31')]['filter']+'%'};return _0x472a23;}})});}_0x17da4e=_[_0xde35('0x3e')]({},_0x17da4e,_0x2fcc94[_0xde35('0x40')]);var _0x1e5051={'where':_0x17da4e[_0xde35('0x3d')]};return db['WhatsappApplication'][_0xde35('0x1e')](_0x1e5051)[_0xde35('0x24')](function(_0x45a82a){_0x45ca01[_0xde35('0x1e')]=_0x45a82a;if(_0x2fcc94[_0xde35('0x31')]['includeAll']){_0x17da4e[_0xde35('0x41')]=[{'all':!![]}];}return db[_0xde35('0x2a')][_0xde35('0x42')](_0x17da4e);})[_0xde35('0x24')](function(_0x32e61d){_0x45ca01['rows']=_0x32e61d;return _0x45ca01;})['then'](respondWithFilteredResult(_0x10533a,_0x17da4e))['catch'](handleError(_0x10533a,null));};exports[_0xde35('0x43')]=function(_0x4792d0,_0x13c077){var _0x298eaf={'raw':!![],'where':{'id':_0x4792d0[_0xde35('0x44')]['id']}},_0x4adfbf={};_0x4adfbf[_0xde35('0x2f')]=_[_0xde35('0x32')](db['WhatsappApplication'][_0xde35('0x2b')]);_0x4adfbf[_0xde35('0x31')]=_[_0xde35('0x32')](_0x4792d0[_0xde35('0x31')]);_0x4adfbf[_0xde35('0x33')]=_[_0xde35('0x35')](_0x4adfbf[_0xde35('0x2f')],_0x4adfbf[_0xde35('0x31')]);_0x298eaf[_0xde35('0x34')]=_[_0xde35('0x35')](_0x4adfbf[_0xde35('0x2f')],qs[_0xde35('0x36')](_0x4792d0['query'][_0xde35('0x36')]));_0x298eaf[_0xde35('0x34')]=_0x298eaf[_0xde35('0x34')][_0xde35('0x45')]?_0x298eaf[_0xde35('0x34')]:_0x4adfbf[_0xde35('0x2f')];if(_0x4792d0['query'][_0xde35('0x46')]){_0x298eaf['include']=[{'all':!![]}];}_0x298eaf=_['merge']({},_0x298eaf,_0x4792d0['options']);return db[_0xde35('0x2a')][_0xde35('0x47')](_0x298eaf)[_0xde35('0x24')](handleEntityNotFound(_0x13c077,null))[_0xde35('0x24')](respondWithResult(_0x13c077,null))[_0xde35('0x48')](handleError(_0x13c077,null));};exports[_0xde35('0x49')]=function(_0x1fd567,_0x4ade5d){return db[_0xde35('0x2a')][_0xde35('0x49')](_0x1fd567['body'],{})[_0xde35('0x24')](respondWithResult(_0x4ade5d,0xc9))[_0xde35('0x48')](handleError(_0x4ade5d,null));};exports['update']=function(_0x243f76,_0x5d178b){if(_0x243f76[_0xde35('0x4a')]['id']){delete _0x243f76[_0xde35('0x4a')]['id'];}return db[_0xde35('0x2a')][_0xde35('0x47')]({'where':{'id':_0x243f76['params']['id']}})[_0xde35('0x24')](handleEntityNotFound(_0x5d178b,null))[_0xde35('0x24')](saveUpdates(_0x243f76['body'],null))[_0xde35('0x24')](respondWithResult(_0x5d178b,null))[_0xde35('0x48')](handleError(_0x5d178b,null));};exports[_0xde35('0x25')]=function(_0x17340b,_0x453f0b){return db['WhatsappApplication']['find']({'where':{'id':_0x17340b[_0xde35('0x44')]['id']}})[_0xde35('0x24')](handleEntityNotFound(_0x453f0b,null))[_0xde35('0x24')](removeEntity(_0x453f0b,null))['catch'](handleError(_0x453f0b,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index df1f672..f28d1c9 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a3a=['./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x1b4092,_0xef2a78){var _0xe29a66=function(_0x31c815){while(--_0x31c815){_0x1b4092['push'](_0x1b4092['shift']());}};_0xe29a66(++_0xef2a78);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x4d96c6,_0x247664){_0x4d96c6=_0x4d96c6-0x0;var _0x1c13dd=_0x2a3a[_0x4d96c6];return _0x1c13dd;};'use strict';var _=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var logger=require(_0xa2a3('0x2'))(_0xa2a3('0x3'));var moment=require(_0xa2a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a3('0x5'));var rimraf=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var attributes=require(_0xa2a3('0x8'));module[_0xa2a3('0x9')]=function(_0xf652d7,_0x186655){return _0xf652d7['define'](_0xa2a3('0xa'),attributes,{'tableName':_0xa2a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa2a3('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0ba7=['define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x226332,_0x58d9d5){var _0x5b3d8d=function(_0x1fbac8){while(--_0x1fbac8){_0x226332['push'](_0x226332['shift']());}};_0x5b3d8d(++_0x58d9d5);}(_0x0ba7,0x16d));var _0x70ba=function(_0x47c6c7,_0x178c10){_0x47c6c7=_0x47c6c7-0x0;var _0x5a4270=_0x0ba7[_0x47c6c7];return _0x5a4270;};'use strict';var _=require(_0x70ba('0x0'));var util=require('util');var logger=require(_0x70ba('0x1'))(_0x70ba('0x2'));var moment=require(_0x70ba('0x3'));var BPromise=require(_0x70ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70ba('0x5'));var rimraf=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var attributes=require(_0x70ba('0x8'));module[_0x70ba('0x9')]=function(_0x3f9877,_0x17a00c){return _0x3f9877[_0x70ba('0xa')](_0x70ba('0xb'),attributes,{'tableName':_0x70ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x70ba('0xd'),'collate':_0x70ba('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 70baa32..64b9ebe 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x41097e,_0x5a6a64){var _0x4b3d9f=function(_0x31442a){while(--_0x31442a){_0x41097e['push'](_0x41097e['shift']());}};_0x4b3d9f(++_0x5a6a64);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x22fb=['WhatsappApplication,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x727544,_0x3f9525){var _0x2af4b9=function(_0x51cbfe){while(--_0x51cbfe){_0x727544['push'](_0x727544['shift']());}};_0x2af4b9(++_0x3f9525);}(_0x22fb,0x192));var _0xb22f=function(_0x149506,_0x29bd2b){_0x149506=_0x149506-0x0;var _0x14fba6=_0x22fb[_0x149506];return _0x14fba6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 95a3f58..4c6c486 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa630=['/:id/messages','getMessages','/:id/download','download','post','create','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x1e3e89,_0x410285){var _0x19fa02=function(_0xe565f8){while(--_0xe565f8){_0x1e3e89['push'](_0x1e3e89['shift']());}};_0x19fa02(++_0x410285);}(_0xa630,0xbe));var _0x0a63=function(_0x556ad3,_0x26310e){_0x556ad3=_0x556ad3-0x0;var _0x53c4ad=_0xa630[_0x556ad3];return _0x53c4ad;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0x7')](_0x0a63('0xd'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0x7')](_0x0a63('0xf'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')]('/',auth['isAuthenticated'](),controller[_0x0a63('0x12')]);router[_0x0a63('0x11')](_0x0a63('0xd'),auth[_0x0a63('0x8')](),controller['addMessage']);router[_0x0a63('0x11')]('/:id/tags',auth[_0x0a63('0x8')](),interaction[_0x0a63('0x13')](_0x0a63('0x14'),_0x0a63('0x15')),controller[_0x0a63('0x16')]);router[_0x0a63('0x17')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),interaction['tracked'](_0x0a63('0x14'),'whatsappinteraction:update'),controller[_0x0a63('0x18')]);router[_0x0a63('0x19')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),interaction[_0x0a63('0x13')](_0x0a63('0x14'),_0x0a63('0x1a')),controller[_0x0a63('0x1b')]);router[_0x0a63('0x19')](_0x0a63('0x1c'),auth[_0x0a63('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x2bd8=['delete','whatsappinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','put','tracked','whatsappinteraction:update','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2bd8,0x130));var _0x82bd=function(_0x1a9c5b,_0x455812){_0x1a9c5b=_0x1a9c5b-0x0;var _0x17c75b=_0x2bd8[_0x1a9c5b];return _0x17c75b;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')]('/',auth[_0x82bd('0xa')](),controller['index']);router[_0x82bd('0x9')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller[_0x82bd('0xc')]);router['get'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x82bd('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0x82bd('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x82bd('0xf')]);router[_0x82bd('0x10')]('/',auth['isAuthenticated'](),controller[_0x82bd('0x11')]);router['post'](_0x82bd('0xe'),auth['isAuthenticated'](),controller[_0x82bd('0x12')]);router[_0x82bd('0x10')](_0x82bd('0x13'),auth[_0x82bd('0xa')](),interaction['tracked'](_0x82bd('0x14'),_0x82bd('0x15')),controller['addTags']);router[_0x82bd('0x16')]('/:id',auth[_0x82bd('0xa')](),interaction[_0x82bd('0x17')](_0x82bd('0x14'),_0x82bd('0x18')),controller[_0x82bd('0x19')]);router[_0x82bd('0x1a')](_0x82bd('0xd'),auth[_0x82bd('0xa')](),interaction[_0x82bd('0x17')](_0x82bd('0x14'),_0x82bd('0x1b')),controller[_0x82bd('0x1c')]);router[_0x82bd('0x1a')](_0x82bd('0x13'),auth['isAuthenticated'](),controller['removeTags']);module[_0x82bd('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index bda17dd..d58669f 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e9d=['out','sequelize','moment','BOOLEAN','DATE','STRING','ENUM'];(function(_0x4de544,_0x479500){var _0x57b5e5=function(_0x470218){while(--_0x470218){_0x4de544['push'](_0x4de544['shift']());}};_0x57b5e5(++_0x479500);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x36b78b,_0x4ea731){_0x36b78b=_0x36b78b-0x0;var _0xa5a214=_0x3e9d[_0x36b78b];return _0xa5a214;};'use strict';var Sequelize=require(_0xd3e9('0x0'));var moment=require(_0xd3e9('0x1'));module['exports']={'closed':{'type':Sequelize[_0xd3e9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd3e9('0x3')]},'disposition':{'type':Sequelize[_0xd3e9('0x4')]},'secondDisposition':{'type':Sequelize[_0xd3e9('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xd3e9('0x4')]},'read1stAt':{'type':Sequelize[_0xd3e9('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd3e9('0x5')]('in',_0xd3e9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd3e9('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd3e9('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x33ac=['moment','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x6218ce,_0x2c07a0){var _0x1fe609=function(_0x4224e4){while(--_0x4224e4){_0x6218ce['push'](_0x6218ce['shift']());}};_0x1fe609(++_0x2c07a0);}(_0x33ac,0x1f2));var _0xc33a=function(_0x2ee106,_0x27df18){_0x2ee106=_0x2ee106-0x0;var _0x4d9c60=_0x33ac[_0x2ee106];return _0x4d9c60;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc33a('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc33a('0x1')]},'disposition':{'type':Sequelize[_0xc33a('0x2')]},'secondDisposition':{'type':Sequelize[_0xc33a('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc33a('0x2')]},'note':{'type':Sequelize[_0xc33a('0x2')]},'phone':{'type':Sequelize[_0xc33a('0x2')]},'read1stAt':{'type':Sequelize[_0xc33a('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xc33a('0x3')]('in',_0xc33a('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc33a('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc33a('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index e817708..4477e1a 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc893=['order','sort','where','select','field','color','from','tools_tags','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','keys','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','unreadMessages','contactName','resolve','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','toString','sequelize','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','all','rows','show','params','intersection','includeAll','include','options','create','update','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','nolimit','pick','WhatsappInteractionId','split','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','secret','Account','Owner','get','Whatsapp','N.A.','closedAt','existsSync','createReadStream','pipe','createWriteStream','basename','direction','System','renderFile','views','transcript-','.pdf','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','Users','fullname','TagIds','Tags','forEach','push','catch','waiting','answered','unmanaged','total','closed','UserId','talking','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0xc893,0x194));var _0x3c89=function(_0x43592f,_0x31e3a0){_0x43592f=_0x43592f-0x0;var _0x5d97cb=_0xc893[_0x43592f];return _0x5d97cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c89('0x0'));var zipdir=require(_0x3c89('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3c89('0x2'));var BPromise=require(_0x3c89('0x3'));var Mustache=require(_0x3c89('0x4'));var util=require(_0x3c89('0x5'));var path=require(_0x3c89('0x6'));var sox=require(_0x3c89('0x7'));var csv=require(_0x3c89('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c89('0x9'));var _=require(_0x3c89('0xa'));var squel=require(_0x3c89('0xb'));var crypto=require(_0x3c89('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3c89('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3c89('0xe'));var Redis=require('ioredis');var authService=require(_0x3c89('0xf'));var qs=require(_0x3c89('0x10'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x3c89('0x11'));var hardwareService=require(_0x3c89('0x12'));var logger=require(_0x3c89('0x13'))(_0x3c89('0x14'));var utils=require(_0x3c89('0x15'));var config=require(_0x3c89('0x16'));var licenseUtil=require(_0x3c89('0x17'));var db=require(_0x3c89('0x18'))['db'];config[_0x3c89('0x19')]=_[_0x3c89('0x1a')](config[_0x3c89('0x19')],{'host':_0x3c89('0x1b'),'port':0x18eb});var socket=require(_0x3c89('0x1c'))(new Redis(config[_0x3c89('0x19')]));require('./whatsappInteraction.socket')[_0x3c89('0x1d')](socket);function respondWithStatusCode(_0x29600e,_0x1e8df0){_0x1e8df0=_0x1e8df0||0xcc;return function(_0x15587a){if(_0x15587a){return _0x29600e[_0x3c89('0x1e')](_0x1e8df0);}return _0x29600e[_0x3c89('0x1f')](_0x1e8df0)[_0x3c89('0x20')]();};}function respondWithResult(_0x2a5019,_0x4647fd){_0x4647fd=_0x4647fd||0xc8;return function(_0x478744){if(_0x478744){return _0x2a5019[_0x3c89('0x1f')](_0x4647fd)['json'](_0x478744);}};}function respondWithFilteredResult(_0x4dd1b1,_0x2dcd6d){return function(_0x322ece){if(_0x322ece){var _0x5832e7=typeof _0x2dcd6d['offset']===_0x3c89('0x21')&&typeof _0x2dcd6d[_0x3c89('0x22')]===_0x3c89('0x21');var _0x5c38ac=_0x322ece['count'];var _0x9a689e=_0x5832e7?0x0:_0x2dcd6d[_0x3c89('0x23')];var _0x218509=_0x5832e7?_0x322ece[_0x3c89('0x24')]:_0x2dcd6d[_0x3c89('0x23')]+_0x2dcd6d[_0x3c89('0x22')];var _0x24150a;if(_0x218509>=_0x5c38ac){_0x218509=_0x5c38ac;_0x24150a=0xc8;}else{_0x24150a=0xce;}_0x4dd1b1[_0x3c89('0x1f')](_0x24150a);return _0x4dd1b1[_0x3c89('0x25')](_0x3c89('0x26'),_0x9a689e+'-'+_0x218509+'/'+_0x5c38ac)[_0x3c89('0x27')](_0x322ece);}return null;};}function patchUpdates(_0x444f8){return function(_0x443559){try{jsonpatch[_0x3c89('0x28')](_0x443559,_0x444f8,!![]);}catch(_0xb85056){return BPromise[_0x3c89('0x29')](_0xb85056);}return _0x443559[_0x3c89('0x2a')]();};}function saveUpdates(_0x227eb,_0x11d915){return function(_0x462552){if(_0x462552){return _0x462552['update'](_0x227eb)[_0x3c89('0x2b')](function(_0x4db1ab){return _0x4db1ab;});}return null;};}function removeEntity(_0x4ea71a,_0x501dda){return function(_0x3b5796){if(_0x3b5796){return _0x3b5796[_0x3c89('0x2c')]()[_0x3c89('0x2b')](function(){_0x4ea71a['status'](0xcc)[_0x3c89('0x20')]();});}};}function handleEntityNotFound(_0xc317d6,_0x5877cc){return function(_0x557260){if(!_0x557260){_0xc317d6[_0x3c89('0x1e')](0x194);}return _0x557260;};}function handleError(_0x3f4946,_0x269227){_0x269227=_0x269227||0x1f4;return function(_0x4a38fc){logger['error'](_0x4a38fc[_0x3c89('0x2d')]);if(_0x4a38fc[_0x3c89('0x2e')]){delete _0x4a38fc['name'];}_0x3f4946[_0x3c89('0x1f')](_0x269227)[_0x3c89('0x2f')](_0x4a38fc);};}function getInteractionUsers(_0x144a6a,_0x1c0ba1){return new BPromise(function(_0x6c850e,_0x1fdbf4){try{if(_0x1c0ba1[_0x144a6a['id']]){_0x144a6a[_0x3c89('0x30')]=_['map'](_0x1c0ba1[_0x144a6a['id']],function(_0x42e1de){return{'id':_0x42e1de['id'],'fullname':_0x42e1de[_0x3c89('0x31')]};});}}catch(_0x3fcb76){_0x1fdbf4(_0x3fcb76);}_0x6c850e(_0x144a6a);});}function getInteractionTags(_0xf28390,_0x49b50a){return new BPromise(function(_0x408383,_0x4d2c6c){try{if(_0xf28390[_0x3c89('0x32')]){_0xf28390[_0x3c89('0x33')]=[];_0xf28390[_0x3c89('0x32')]['split'](',')[_0x3c89('0x34')](function(_0x547de5){_0xf28390[_0x3c89('0x33')][_0x3c89('0x35')](_0x49b50a[_0x547de5]);});}delete _0xf28390['TagIds'];}catch(_0x2a0189){_0x4d2c6c(_0x2a0189);}_0x408383(_0xf28390);});}function updateWhatsappInteraction(_0x3e1a02,_0x3fb7cc,_0x282101){return new BPromise(function(_0x151072,_0x37af1c){return getInteractionUsers(_0x3e1a02,_0x282101)['then'](function(_0x29b1e6){return getInteractionTags(_0x29b1e6,_0x3fb7cc);})[_0x3c89('0x2b')](function(_0x248594){return getStateInteraction(_0x248594);})[_0x3c89('0x2b')](function(_0xb9626f){_0x151072(_0xb9626f);})[_0x3c89('0x36')](function(_0x4bc12a){_0x37af1c(_0x4bc12a);});});}function getStateInteraction(_0x7608fc){return new BPromise(function(_0xb0526f){_0x7608fc[_0x3c89('0x37')]=0x0;_0x7608fc['talking']=0x0;_0x7608fc[_0x3c89('0x38')]=0x0;_0x7608fc[_0x3c89('0x39')]=0x0;_0x7608fc[_0x3c89('0x3a')]=0x0;if(!_0x7608fc[_0x3c89('0x3b')]&&!_0x7608fc[_0x3c89('0x3c')]){_0x7608fc[_0x3c89('0x37')]+=0x1;}if(!_0x7608fc[_0x3c89('0x3b')]&&_0x7608fc[_0x3c89('0x3c')]){_0x7608fc['talking']+=0x1;if(_0x7608fc['waiting']){_0x7608fc[_0x3c89('0x37')]-=0x1;}}if(_0x7608fc[_0x3c89('0x3b')]&&_0x7608fc[_0x3c89('0x3c')]){_0x7608fc['answered']+=0x1;if(_0x7608fc[_0x3c89('0x3d')]){_0x7608fc['talking']-=0x1;}}if(_0x7608fc[_0x3c89('0x3b')]&&!_0x7608fc[_0x3c89('0x3c')]){_0x7608fc[_0x3c89('0x39')]+=0x1;if(_0x7608fc[_0x3c89('0x37')]){_0x7608fc['waiting']-=0x1;}}_0x7608fc[_0x3c89('0x3a')]+=0x1;_0xb0526f(_0x7608fc);});}exports[_0x3c89('0x3e')]=function(_0x50b74f,_0x47bdf8){var _0x4f8880={},_0x5c90af={},_0x593d23={'count':0x0,'rows':[]};var _0x417b95=_[_0x3c89('0x3f')](db[_0x3c89('0x40')][_0x3c89('0x41')],function(_0x28f63e){return{'name':_0x28f63e[_0x3c89('0x42')],'type':_0x28f63e[_0x3c89('0x43')][_0x3c89('0x44')]};});_0x5c90af[_0x3c89('0x45')]=_['map'](_0x417b95,_0x3c89('0x2e'));_0x5c90af[_0x3c89('0x46')]=_['keys'](_0x50b74f[_0x3c89('0x46')]);_0x5c90af[_0x3c89('0x47')]=_['intersection'](_0x5c90af[_0x3c89('0x45')],_0x5c90af['query']);_0x4f8880[_0x3c89('0x48')]=_['intersection'](_0x5c90af[_0x3c89('0x45')],qs[_0x3c89('0x49')](_0x50b74f[_0x3c89('0x46')][_0x3c89('0x49')]));_0x4f8880['attributes']=_0x4f8880[_0x3c89('0x48')][_0x3c89('0x4a')]?_0x4f8880[_0x3c89('0x48')]:_0x5c90af['model'];if(!_0x50b74f['query'][_0x3c89('0x4b')]('nolimit')){_0x4f8880['limit']=qs[_0x3c89('0x22')](_0x50b74f['query'][_0x3c89('0x22')]);_0x4f8880[_0x3c89('0x23')]=qs[_0x3c89('0x23')](_0x50b74f[_0x3c89('0x46')]['offset']);}_0x4f8880[_0x3c89('0x4c')]=qs['sort'](_0x50b74f[_0x3c89('0x46')][_0x3c89('0x4d')]);_0x4f8880[_0x3c89('0x4e')]=qs[_0x3c89('0x47')](_['pick'](_0x50b74f[_0x3c89('0x46')],_0x5c90af[_0x3c89('0x47')]),_0x417b95);var _0x3f2558=[];var _0xf12c87=squel[_0x3c89('0x4f')]()[_0x3c89('0x50')]('id')['field'](_0x3c89('0x2e'))['field'](_0x3c89('0x51'))[_0x3c89('0x52')](_0x3c89('0x53'));var _0x49e197=squel['select']()[_0x3c89('0x50')]('u.id')[_0x3c89('0x50')](_0x3c89('0x54'))['field']('ui.WhatsappInteractionId')[_0x3c89('0x52')](_0x3c89('0x55'),'ui')[_0x3c89('0x56')](_0x3c89('0x57'),'u',_0x3c89('0x58'));var _0x22fc5e=squel['select']()['from'](_0x3c89('0x59'),'i')[_0x3c89('0x56')](_0x3c89('0x5a'),'c',_0x3c89('0x5b'))[_0x3c89('0x56')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x3c89('0x5c'),'a',_0x3c89('0x5d'))[_0x3c89('0x56')]('whatsapp_messages','me',_0x3c89('0x5e'))['left_join']('whatsapp_interaction_has_tags','it',_0x3c89('0x5f'))['left_join'](_0x3c89('0x53'),'t',_0x3c89('0x60'));var _0xf2c1a3=squel[_0x3c89('0x61')]();var _0x5d1af6=[];var _0x1c2caa=squel['expr']();var _0x471b22;if(_0x50b74f[_0x3c89('0x46')][_0x3c89('0x62')]){_0x471b22=as[_0x3c89('0x63')](_0x50b74f['query'][_0x3c89('0x62')]);var _0x5f591a=_0x471b22['sqlOperator'];for(var _0x57443d=0x0;_0x57443d<_0x471b22[_0x3c89('0x64')][_0x3c89('0x4a')];_0x57443d++){var _0x133ce7=_0x471b22[_0x3c89('0x64')][_0x57443d];var _0x558fe3='i';var _0x620570=_[_0x3c89('0x65')](_0x417b95,[_0x3c89('0x2e'),_0x133ce7[_0x3c89('0x50')]]);if(!_0x620570){switch(_0x133ce7[_0x3c89('0x50')]){case'unreadMessages':if(_0x133ce7[_0x3c89('0x66')]==0x1){_0x22fc5e[_0x3c89('0x67')]('`'+_0x133ce7[_0x3c89('0x50')]+_0x3c89('0x68'));}else{_0x22fc5e[_0x3c89('0x67')]('`'+_0x133ce7[_0x3c89('0x50')]+_0x3c89('0x69'));}break;case _0x3c89('0x6a'):if(_0x133ce7[_0x3c89('0x6b')]==='$substring'){if(_0x133ce7['value']['split']('\x20')['length']>0x1){_0xf2c1a3[_0x5f591a](_0x3c89('0x6c'),qs[_0x3c89('0x6d')](_0x133ce7[_0x3c89('0x66')]),null);}else{var _0x3dfb8f='%'+_0x133ce7[_0x3c89('0x66')]+'%';_0xf2c1a3[_0x5f591a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3dfb8f,_0x3dfb8f,_0x3dfb8f);}}else{_0x620570=_[_0x3c89('0x65')](_0x417b95,['name',_0x3c89('0x6e')]);_0x133ce7[_0x3c89('0x50')]=_0x3c89('0x6e');_0x372433=as['buildExpression'](_0x558fe3,_0x620570[_0x3c89('0x43')],_0x133ce7);_0xf2c1a3[_0x5f591a](_0x372433[_0x3c89('0x6f')],_0x372433[_0x3c89('0x66')][_0x3c89('0x70')],_0x372433['value'][_0x3c89('0x20')]);}break;case _0x3c89('0x71'):var _0x4d5917=_0x133ce7[_0x3c89('0x66')]['split'](',')[_0x3c89('0x3f')](function(_0x3dbad2){return Number(_0x3dbad2);});_0x4d5917[_0x3c89('0x34')](function(_0x103239){_0x1c2caa['or'](_0x3c89('0x72'),'%,'+_0x103239+',%');});_0x5d1af6=_['union'](_0x5d1af6,_0x4d5917);break;case _0x3c89('0x73'):if(_0x133ce7[_0x3c89('0x6b')]===_0x3c89('0x74')){_0xf2c1a3[_0x5f591a](_0x3c89('0x75'),'%'+_0x133ce7[_0x3c89('0x66')]+'%',null);}else{_0x620570=_[_0x3c89('0x65')](_0x417b95,['name',_0x3c89('0x3c')]);_0x133ce7[_0x3c89('0x50')]=_0x3c89('0x3c');_0x372433=as[_0x3c89('0x76')](_0x558fe3,_0x620570[_0x3c89('0x43')],_0x133ce7);_0xf2c1a3[_0x5f591a](_0x372433[_0x3c89('0x6f')],_0x372433[_0x3c89('0x66')][_0x3c89('0x70')],_0x372433[_0x3c89('0x66')][_0x3c89('0x20')]);}break;case _0x3c89('0x77'):_0x372433=as[_0x3c89('0x76')]('me',null,_0x133ce7);_0xf2c1a3[_0x5f591a](_0x372433[_0x3c89('0x6f')],_0x372433[_0x3c89('0x66')][_0x3c89('0x70')],_0x372433[_0x3c89('0x66')][_0x3c89('0x20')]);break;}}else{var _0x372433=as[_0x3c89('0x76')](_0x558fe3,_0x620570['type'],_0x133ce7);_0xf2c1a3[_0x5f591a](_0x372433[_0x3c89('0x6f')],_0x372433[_0x3c89('0x66')][_0x3c89('0x70')],_0x372433['value']['end']);}}}else{var _0xdb4ab3=_(_0x50b74f['query'])[_0x3c89('0x78')]()[_0x3c89('0x3f')](function(_0x220d94){return _[_0x3c89('0x79')](_0x417b95,['name',_0x220d94])?_0x220d94:undefined;})[_0x3c89('0x7a')]()[_0x3c89('0x66')]();if(!_[_0x3c89('0x7b')](_0xdb4ab3)){_0xdb4ab3[_0x3c89('0x34')](function(_0x299775){if(_0x299775===_0x3c89('0x7c')){_0x22fc5e[_0x3c89('0x4e')](_0x3c89('0x7d'),[]['concat'](_0x50b74f[_0x3c89('0x46')][_0x299775]));}else if(_0x299775===_0x3c89('0x7e')){var _0x32de73=JSON[_0x3c89('0x7f')](_0x50b74f[_0x3c89('0x46')][_0x299775])[_0x3c89('0x80')];var _0x503c5d=JSON[_0x3c89('0x7f')](_0x50b74f[_0x3c89('0x46')][_0x299775])[_0x3c89('0x81')];_0x22fc5e[_0x3c89('0x4e')](_0x3c89('0x82'),_0x32de73,_0x503c5d);}else{if(_0x50b74f['query'][_0x299775]===_0x3c89('0x83')){_0x22fc5e[_0x3c89('0x4e')]('i.'+_0x299775+'\x20IS\x20NULL');}else{_0x22fc5e['where']('i.'+_0x299775+_0x3c89('0x84'),_0x50b74f['query'][_0x299775]);}}});}if(_0x50b74f[_0x3c89('0x46')][_0x3c89('0x85')]){if(_0x50b74f[_0x3c89('0x46')][_0x3c89('0x85')]==0x1){_0x22fc5e['having'](_0x3c89('0x86'));}else{_0x22fc5e[_0x3c89('0x67')](_0x3c89('0x87'));}}if(_0x50b74f[_0x3c89('0x46')]['tag']){_0x5d1af6=_['isArray'](_0x50b74f[_0x3c89('0x46')][_0x3c89('0x88')])?_0x50b74f[_0x3c89('0x46')][_0x3c89('0x88')]:new Array(_0x50b74f[_0x3c89('0x46')][_0x3c89('0x88')]);_0x5d1af6[_0x3c89('0x34')](function(_0x3955b0){_0x1c2caa['or'](_0x3c89('0x72'),'%,'+_0x3955b0+',%');});}if(_0x50b74f[_0x3c89('0x46')]['filter']){var _0x6f539f=_0x50b74f[_0x3c89('0x46')][_0x3c89('0x89')][_0x3c89('0x8a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x6f539f)){_0xf2c1a3['or'](_0x3c89('0x8b'),_0x6f539f+'%')['or'](_0x3c89('0x8c'),_0x6f539f+'%');}else{_0xf2c1a3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x6f539f))['or'](_0x3c89('0x8d'),_0x6f539f+'%');}}}_0x22fc5e[_0x3c89('0x4e')](_0xf2c1a3);_0x22fc5e[_0x3c89('0x8e')](_0x3c89('0x8f'));var _0x320a92={'type':db[_0x3c89('0x90')][_0x3c89('0x91')]['SELECT'],'raw':!![]};var _0x314f8c=_0x22fc5e[_0x3c89('0x92')]();_0x314f8c[_0x3c89('0x50')]('i.id');_0x314f8c[_0x3c89('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3c89('0x93'));if(_0x4f8880[_0x3c89('0x4c')]){_0x4f8880[_0x3c89('0x4c')][_0x3c89('0x34')](function(_0x35760d){var _0x260868=_0x35760d[0x0]===_0x3c89('0x94')?_0x35760d[0x0]:'i.'+_0x35760d[0x0];_0x22fc5e[_0x3c89('0x4c')](_0x260868,_0x35760d[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3c89('0x7b')](_0x5d1af6)){_0x22fc5e[_0x3c89('0x67')](_0x1c2caa);_0x314f8c[_0x3c89('0x4e')]('t.id\x20IN\x20?',_0x5d1af6);}BPromise[_0x3c89('0x95')]()[_0x3c89('0x2b')](function(){if(!_0x471b22){if(_0x50b74f[_0x3c89('0x46')]['WhatsappAccountId'])return;_0x314f8c[_0x3c89('0x4e')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x22fc5e['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x50b74f[_0x3c89('0x96')][_0x3c89('0x97')]!==_0x3c89('0x98'))return;return _0x50b74f['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x3c89('0x2b')](function(_0x2ece39){if(_['isEmpty'](_0x2ece39)){_0x314f8c['where'](_0x3c89('0x99'));_0x22fc5e['where'](_0x3c89('0x99'));}else{_0x314f8c[_0x3c89('0x4e')]('i.WhatsappAccountId\x20IN\x20?',_[_0x3c89('0x3f')](_0x2ece39,'id'));_0x22fc5e[_0x3c89('0x4e')](_0x3c89('0x7d'),_[_0x3c89('0x3f')](_0x2ece39,'id'));}});})[_0x3c89('0x2b')](function(){if(_0x50b74f['user']['role']===_0x3c89('0x98')&&!_0x471b22&&!_0x50b74f['query'][_0x3c89('0x7c')])return[];return db['sequelize']['query'](_0x314f8c[_0x3c89('0x9a')](),_0x320a92);})[_0x3c89('0x2b')](function(_0x29ec84){_0x593d23['count']=_0x29ec84['length'];if(_0x593d23['count']===0x0)return[];return db[_0x3c89('0x9b')][_0x3c89('0x46')](_0xf12c87['toString'](),_0x320a92)[_0x3c89('0x2b')](function(_0x112331){_0x3f2558=_['keyBy'](_0x112331,'id');_0x320a92=_[_0x3c89('0x9c')](_0x320a92,{'model':db[_0x3c89('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50b74f[_0x3c89('0x46')][_0x3c89('0x49')]){_0x4f8880[_0x3c89('0x48')][_0x3c89('0x34')](function(_0x379183){_0x22fc5e[_0x3c89('0x50')]('i.'+_0x379183);});}else{_0x22fc5e['field'](_0x3c89('0x9d'),_0x3c89('0x93'));_0x22fc5e['field'](_0x3c89('0x9e'),_0x3c89('0x9f'));_0x22fc5e[_0x3c89('0x50')]('a.mandatoryDisposition',_0x3c89('0xa0'));_0x22fc5e[_0x3c89('0x50')](_0x3c89('0xa1'),_0x3c89('0x94'));_0x22fc5e[_0x3c89('0x50')](_0x3c89('0xa2'));_0x22fc5e[_0x3c89('0x50')](_0x3c89('0xa3'),'Contact.firstName');_0x22fc5e[_0x3c89('0x50')]('c.lastName',_0x3c89('0xa4'));_0x22fc5e['field'](_0x3c89('0xa5'),_0x3c89('0xa6'));_0x22fc5e[_0x3c89('0x50')](_0x3c89('0xa7'),_0x3c89('0xa8'));_0x22fc5e['field'](_0x3c89('0xa9'),_0x3c89('0xaa'));_0x22fc5e[_0x3c89('0x50')](_0x3c89('0xab'),_0x3c89('0xac'));_0x22fc5e[_0x3c89('0x50')](_0x3c89('0xad'),_0x3c89('0xae'));_0x22fc5e['field'](_0x3c89('0xaf'),_0x3c89('0xb0'));_0x22fc5e[_0x3c89('0x50')](_0x3c89('0xb1'),_0x3c89('0x32'));}if(_0x4f8880['limit'])_0x22fc5e[_0x3c89('0x22')](_0x4f8880[_0x3c89('0x22')]);if(_0x4f8880[_0x3c89('0x23')])_0x22fc5e['offset'](_0x4f8880['offset']);return db['sequelize'][_0x3c89('0x46')](_0x22fc5e[_0x3c89('0x9a')](),_0x320a92);})[_0x3c89('0x2b')](function(_0x25dd90){if(_0x25dd90[_0x3c89('0x4a')]>0x0)_0x49e197[_0x3c89('0x4e')](_0x3c89('0xb2'),_[_0x3c89('0x3f')](_0x25dd90,'id'));return db[_0x3c89('0x9b')][_0x3c89('0x46')](_0x49e197[_0x3c89('0x9a')](),_0x320a92)[_0x3c89('0x2b')](function(_0x570246){var _0x4c0839=_['groupBy'](_0x570246,'WhatsappInteractionId');var _0x31a65f=[];_0x25dd90['forEach'](function(_0x3a22fe){_0x31a65f[_0x3c89('0x35')](updateWhatsappInteraction(_0x3a22fe,_0x3f2558,_0x4c0839));});return BPromise[_0x3c89('0xb3')](_0x31a65f);});});})[_0x3c89('0x2b')](function(_0x250d16){_0x593d23[_0x3c89('0xb4')]=_0x250d16;return _0x593d23;})[_0x3c89('0x2b')](respondWithFilteredResult(_0x47bdf8,_0x4f8880))[_0x3c89('0x36')](handleError(_0x47bdf8,null));};exports[_0x3c89('0xb5')]=function(_0x1e3db6,_0x362b2f){var _0x567733={'raw':![],'where':{'id':_0x1e3db6[_0x3c89('0xb6')]['id']}},_0x3f49e7={};_0x3f49e7['model']=_['keys'](db[_0x3c89('0x40')][_0x3c89('0x41')]);_0x3f49e7[_0x3c89('0x46')]=_[_0x3c89('0x78')](_0x1e3db6[_0x3c89('0x46')]);_0x3f49e7[_0x3c89('0x47')]=_[_0x3c89('0xb7')](_0x3f49e7[_0x3c89('0x45')],_0x3f49e7[_0x3c89('0x46')]);_0x567733[_0x3c89('0x48')]=_[_0x3c89('0xb7')](_0x3f49e7[_0x3c89('0x45')],qs[_0x3c89('0x49')](_0x1e3db6[_0x3c89('0x46')][_0x3c89('0x49')]));_0x567733[_0x3c89('0x48')]=_0x567733[_0x3c89('0x48')][_0x3c89('0x4a')]?_0x567733[_0x3c89('0x48')]:_0x3f49e7[_0x3c89('0x45')];if(_0x1e3db6[_0x3c89('0x46')][_0x3c89('0xb8')]){_0x567733[_0x3c89('0xb9')]=[{'all':!![]}];}_0x567733=_[_0x3c89('0x9c')]({},_0x567733,_0x1e3db6[_0x3c89('0xba')]);return db['WhatsappInteraction'][_0x3c89('0x65')](_0x567733)['then'](handleEntityNotFound(_0x362b2f,null))[_0x3c89('0x2b')](respondWithResult(_0x362b2f,null))[_0x3c89('0x36')](handleError(_0x362b2f,null));};exports[_0x3c89('0xbb')]=function(_0x509d90,_0x485c52){return db[_0x3c89('0x40')][_0x3c89('0xbb')](_0x509d90[_0x3c89('0x77')],{})[_0x3c89('0x2b')](respondWithResult(_0x485c52,0xc9))['catch'](handleError(_0x485c52,null));};exports[_0x3c89('0xbc')]=function(_0x321bce,_0x53f6e7){if(_0x321bce[_0x3c89('0x77')]['id']){delete _0x321bce[_0x3c89('0x77')]['id'];}return db[_0x3c89('0x40')][_0x3c89('0x65')]({'where':{'id':_0x321bce[_0x3c89('0xb6')]['id']}})[_0x3c89('0x2b')](handleEntityNotFound(_0x53f6e7,null))[_0x3c89('0x2b')](saveUpdates(_0x321bce[_0x3c89('0x77')],null))[_0x3c89('0x2b')](respondWithResult(_0x53f6e7,null))[_0x3c89('0x36')](handleError(_0x53f6e7,null));};exports[_0x3c89('0x2c')]=function(_0x45b212,_0x4a3853){return db[_0x3c89('0x40')][_0x3c89('0x65')]({'where':{'id':_0x45b212[_0x3c89('0xb6')]['id']}})[_0x3c89('0x2b')](handleEntityNotFound(_0x4a3853,null))[_0x3c89('0x2b')](removeEntity(_0x4a3853,null))[_0x3c89('0x36')](handleError(_0x4a3853,null));};exports[_0x3c89('0xbd')]=function(_0x12ce0d,_0x131766){return db[_0x3c89('0x40')][_0x3c89('0xbd')]()[_0x3c89('0x2b')](respondWithResult(_0x131766,null))[_0x3c89('0x36')](handleError(_0x131766,null));};exports['addMessage']=function(_0x2254d9,_0x4c5f50,_0x1e759f){return db[_0x3c89('0xbe')][_0x3c89('0x65')]({'where':{'id':_0x2254d9[_0x3c89('0xb6')]['id']}})[_0x3c89('0x2b')](handleEntityNotFound(_0x4c5f50,null))[_0x3c89('0x2b')](function(_0x4e17a8){if(_0x4e17a8){return _0x4e17a8[_0x3c89('0xbf')](_0x2254d9[_0x3c89('0x77')][_0x3c89('0xc0')],_[_0x3c89('0xc1')](_0x2254d9['body'],[_0x3c89('0xc0'),'id'])||{});}})['then'](respondWithResult(_0x4c5f50,null))[_0x3c89('0x36')](handleError(_0x4c5f50,null));};exports[_0x3c89('0xc2')]=function(_0x63208d,_0x41ed7b,_0x25f794){var _0x4bf877={'raw':![],'where':{}};var _0x3dcc1a={};var _0x4f6220={'count':0x0,'rows':[]};return db[_0x3c89('0x40')][_0x3c89('0xc3')]({'where':{'id':_0x63208d[_0x3c89('0xb6')]['id']}})[_0x3c89('0x2b')](handleEntityNotFound(_0x41ed7b,null))[_0x3c89('0x2b')](function(_0x5684e1){if(_0x5684e1){_0x3dcc1a['model']=_['keys'](db[_0x3c89('0xbe')][_0x3c89('0x41')]);_0x3dcc1a['query']=_[_0x3c89('0x78')](_0x63208d[_0x3c89('0x46')]);_0x3dcc1a['filters']=_['intersection'](_0x3dcc1a[_0x3c89('0x45')],_0x3dcc1a[_0x3c89('0x46')]);_0x4bf877[_0x3c89('0x48')]=_[_0x3c89('0xb7')](_0x3dcc1a[_0x3c89('0x45')],qs['fields'](_0x63208d[_0x3c89('0x46')]['fields']));_0x4bf877['attributes']=_0x4bf877[_0x3c89('0x48')][_0x3c89('0x4a')]?_0x4bf877['attributes']:_0x3dcc1a['model'];if(!_0x63208d[_0x3c89('0x46')][_0x3c89('0x4b')](_0x3c89('0xc4'))){_0x4bf877[_0x3c89('0x22')]=qs[_0x3c89('0x22')](_0x63208d[_0x3c89('0x46')][_0x3c89('0x22')]);_0x4bf877[_0x3c89('0x23')]=qs[_0x3c89('0x23')](_0x63208d['query'][_0x3c89('0x23')]);}_0x4bf877['order']=qs[_0x3c89('0x4d')](_0x63208d['query'][_0x3c89('0x4d')]);_0x4bf877[_0x3c89('0x4e')]=qs['filters'](_[_0x3c89('0xc5')](_0x63208d['query'],_0x3dcc1a[_0x3c89('0x47')]));_0x4bf877['where'][_0x3c89('0xc6')]=_0x5684e1['id'];if(_0x63208d[_0x3c89('0x46')][_0x3c89('0x89')]){_0x4bf877[_0x3c89('0x4e')]=_[_0x3c89('0x9c')](_0x4bf877[_0x3c89('0x4e')],{'$or':_[_0x3c89('0x3f')](_0x4bf877[_0x3c89('0x48')],function(_0x2ac381){var _0x36d56a={};_0x36d56a[_0x2ac381]={'$like':'%'+_0x63208d['query']['filter']+'%'};return _0x36d56a;})});}if(_0x63208d['query'][_0x3c89('0x80')]){var _0x3a1948=_0x63208d[_0x3c89('0x46')][_0x3c89('0x80')][_0x3c89('0xc7')](',');var _0x53dd7d={};_0x53dd7d[_0x3a1948[0x0]]={'$gte':moment(_0x3a1948[0x1])['format'](_0x3c89('0xc8'))};_0x4bf877[_0x3c89('0x4e')]=_[_0x3c89('0x9c')](_0x4bf877['where'],_0x53dd7d);}_0x4bf877=_['merge']({},_0x4bf877,_0x63208d[_0x3c89('0xba')]);return db[_0x3c89('0xbe')][_0x3c89('0x24')]({'where':_0x4bf877[_0x3c89('0x4e')]})[_0x3c89('0x2b')](function(_0x113a38){_0x4f6220[_0x3c89('0x24')]=_0x113a38;if(_0x63208d[_0x3c89('0x46')][_0x3c89('0xb8')]){_0x4bf877[_0x3c89('0xb9')]=[{'all':!![]}];}return db[_0x3c89('0xbe')][_0x3c89('0xc9')](_0x4bf877);})[_0x3c89('0x2b')](function(_0x45d345){_0x4f6220[_0x3c89('0xb4')]=_0x45d345;return _0x4f6220;});}})[_0x3c89('0x2b')](respondWithFilteredResult(_0x41ed7b,_0x4bf877))[_0x3c89('0x36')](handleError(_0x41ed7b,null));};exports[_0x3c89('0xca')]=function(_0xcf813f,_0x5cf1ff,_0x36e1c6){return db[_0x3c89('0x40')][_0x3c89('0x65')]({'where':{'id':_0xcf813f[_0x3c89('0xb6')]['id']}})[_0x3c89('0x2b')](handleEntityNotFound(_0x5cf1ff,null))[_0x3c89('0x2b')](function(_0x27af08){if(_0x27af08){return _0x27af08['setTags'](_0xcf813f[_0x3c89('0x77')][_0x3c89('0xc0')],_[_0x3c89('0xc1')](_0xcf813f['body'],[_0x3c89('0xc0'),'id'])||{})[_0x3c89('0xcb')](function(){return db['Tag']['findAll']({'attributes':['id',_0x3c89('0x2e'),_0x3c89('0x51')],'where':{'id':_0xcf813f['body']['ids']}});})[_0x3c89('0x2b')](function(_0x2b4adb){socket[_0x3c89('0xcc')]('whatsappInteractionTags:save',{'id':Number(_0xcf813f[_0x3c89('0xb6')]['id']),'tags':_0x2b4adb||[]});return{'id':Number(_0xcf813f['params']['id']),'tags':_0x2b4adb||[]};});}})[_0x3c89('0x2b')](respondWithResult(_0x5cf1ff,null))[_0x3c89('0x36')](handleError(_0x5cf1ff,null));};exports[_0x3c89('0xcd')]=function(_0x39b129,_0x21e705,_0x2c533b){return db[_0x3c89('0x40')]['find']({'where':{'id':_0x39b129['params']['id']}})[_0x3c89('0x2b')](handleEntityNotFound(_0x21e705,null))[_0x3c89('0x2b')](function(_0x30a320){if(_0x30a320){return _0x30a320[_0x3c89('0xcd')](_0x39b129[_0x3c89('0x46')][_0x3c89('0xc0')]);}})[_0x3c89('0x2b')](respondWithStatusCode(_0x21e705,null))[_0x3c89('0x36')](handleError(_0x21e705,null));};exports[_0x3c89('0xce')]=function(_0x56af32,_0x46b769){var _0x3a6769=moment()[_0x3c89('0xcf')]()[_0x3c89('0x9a')]();var _0x14286b=path[_0x3c89('0xd0')](config[_0x3c89('0xd1')],_0x3c89('0xd2'),_0x3c89('0xd3'),_0x3c89('0xd4'));var _0x461b64=path[_0x3c89('0xd0')](config['root'],_0x3c89('0xd2'),_0x3c89('0xd3'),_0x3c89('0xd5'));var _0x2c538d=path[_0x3c89('0xd0')](_0x14286b,_0x3a6769);var _0x42462f=util[_0x3c89('0xd6')](_0x3c89('0xd7'),_0x56af32['params']['id'],_0x3a6769);var _0x170519=path[_0x3c89('0xd0')](_0x14286b,_0x42462f);var _0x5e539b=[];_0x5e539b['push']({'model':db[_0x3c89('0x73')],'as':_0x3c89('0x73'),'attributes':['id',_0x3c89('0x31')],'raw':!![]});_0x5e539b[_0x3c89('0x35')]({'model':db[_0x3c89('0xd8')],'as':_0x3c89('0x6a'),'attributes':['id',_0x3c89('0xd9'),_0x3c89('0xda')],'raw':!![]});if(_0x56af32[_0x3c89('0x46')][_0x3c89('0xd5')]){_0x5e539b['push']({'model':db[_0x3c89('0xdb')],'as':_0x3c89('0xdb'),'raw':!![]});}var _0x28d355=[{'model':db[_0x3c89('0xbe')],'as':_0x3c89('0xdc'),'attributes':['id',_0x3c89('0x77'),_0x3c89('0x7e'),'direction',_0x3c89('0xdd'),'read'],'include':_0x5e539b}];_0x28d355['push']({'model':db['WhatsappAccount'],'as':_0x3c89('0xde'),'attributes':['id',_0x3c89('0x2e')]});_0x28d355[_0x3c89('0x35')]({'model':db['User'],'as':_0x3c89('0xdf'),'attributes':['id','fullname']});return db[_0x3c89('0x40')]['find']({'where':{'id':_0x56af32['params']['id']},'include':_0x28d355})[_0x3c89('0x2b')](handleEntityNotFound(_0x46b769,null))['then'](function(_0x101a0a){if(_0x101a0a){var _0x557204=_0x101a0a[_0x3c89('0xe0')]({'plain':!![]});fs['mkdirSync'](_0x2c538d);var _0x224047={'channel':_0x3c89('0xe1'),'account':_0x557204[_0x3c89('0xde')][_0x3c89('0x2e')],'agent':_0x557204[_0x3c89('0xdf')]?_0x557204[_0x3c89('0xdf')][_0x3c89('0x31')]:_0x3c89('0xe2'),'createdAt':moment(_0x557204['createdAt'])[_0x3c89('0xd6')](_0x3c89('0xc8'))['toString'](),'closedAt':_0x557204[_0x3c89('0x3b')]?moment(_0x557204[_0x3c89('0xe3')])[_0x3c89('0xd6')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x557204['disposition'],'messages':_(_0x557204[_0x3c89('0xdc')])[_0x3c89('0x89')]({'secret':![]})[_0x3c89('0x3f')](function(_0x215bcb){if(_0x215bcb[_0x3c89('0xdb')]){var _0x291963=path[_0x3c89('0xd0')](_0x461b64,_0x215bcb['Attachment']['basename']);if(fs[_0x3c89('0xe4')](_0x291963)){fs[_0x3c89('0xe5')](_0x291963)[_0x3c89('0xe6')](fs[_0x3c89('0xe7')](path['join'](_0x2c538d,_0x215bcb[_0x3c89('0xdb')][_0x3c89('0xe8')])));}}return{'date':moment(_0x215bcb['createdAt'])[_0x3c89('0xd6')](_0x3c89('0xc8'))[_0x3c89('0x9a')](),'sender':_0x215bcb[_0x3c89('0xe9')]==='out'?_0x215bcb[_0x3c89('0x73')]?_0x215bcb[_0x3c89('0x73')]['fullname']:_0x3c89('0xea'):_0x215bcb[_0x3c89('0x6a')][_0x3c89('0xd9')]+(_0x215bcb['Contact'][_0x3c89('0xda')]?'\x20'+_0x215bcb[_0x3c89('0x6a')][_0x3c89('0xda')]:''),'body':_0x215bcb[_0x3c89('0xdb')]?_0x215bcb[_0x3c89('0xdb')][_0x3c89('0xe8')]:_0x215bcb[_0x3c89('0x77')],'direction':_0x215bcb[_0x3c89('0xe9')]==='out'?'A':'C','secret':_0x215bcb[_0x3c89('0xdd')],'read':_0x215bcb[_0x3c89('0x85')],'attachment':_0x215bcb[_0x3c89('0xdb')]};})[_0x3c89('0x66')]()};return ejs[_0x3c89('0xeb')](path[_0x3c89('0xd0')](config[_0x3c89('0xd1')],_0x3c89('0xd2'),_0x3c89('0xec'),'downloadInteraction.ejs'),{'interaction':_0x224047})[_0x3c89('0x2b')](function(_0x2a3d2d){var _0x4e3cb5=path[_0x3c89('0xd0')](_0x2c538d,_0x3c89('0xed')+_0x557204['id']+'-'+_0x3a6769+_0x3c89('0xee'));var _0x2ab7ce={'path':_0x4e3cb5,'channel':_0x3c89('0xe1'),'interactionId':_0x557204['id']};return pdf['createPdfFromHTML'](_0x2a3d2d,_0x2ab7ce);})[_0x3c89('0x2b')](function(){return new BPromise(function(_0x2e079,_0x88aafd){zipdir(_0x2c538d,{'saveTo':_0x170519},function(_0x393ae9,_0x1c90a6){if(_0x393ae9)return _0x88aafd(_0x393ae9);return _0x2e079(_0x1c90a6);});})['then'](function(){return new BPromise(function(_0x34414a,_0x57836b){rimraf(_0x2c538d,function(_0xf5d39){if(_0xf5d39)_0x57836b(_0xf5d39);return _0x34414a();});});})[_0x3c89('0x2b')](function(){return _0x46b769[_0x3c89('0xce')](_0x170519,_0x42462f,function(_0x4f03cc){if(_0x4f03cc){console['log']('err',_0x4f03cc);}else{fs[_0x3c89('0xef')](_0x170519);}});});});}else{return _0x46b769[_0x3c89('0x1e')](0xc8);}})['catch'](handleError(_0x46b769,null));}; \ No newline at end of file +var _0x6edc=['toString','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','push','rows','params','WhatsappInteraction','rawAttributes','includeAll','include','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','spread','findAll','emit','removeTags','download','unix','root','server','files','join','attachments','CmContact','Contact','firstName','Attachment','Messages','direction','secret','WhatsappAccount','Account','get','Whatsapp','Owner','N.A.','format','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','lastName','renderFile','views','transcript-','.pdf','createPdfFromHTML','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','catch','waiting','talking','answered','unmanaged','total','closed','UserId','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','field','color','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','whatsapp_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20=\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','compact','isEmpty','WhatsappAccountId','where','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','sequelize'];(function(_0x278903,_0x23c447){var _0x4bfc71=function(_0x5be785){while(--_0x5be785){_0x278903['push'](_0x278903['shift']());}};_0x4bfc71(++_0x23c447);}(_0x6edc,0x138));var _0xc6ed=function(_0xec1d0c,_0x14aef7){_0xec1d0c=_0xec1d0c-0x0;var _0x552358=_0x6edc[_0xec1d0c];return _0x552358;};'use strict';var emlformat=require(_0xc6ed('0x0'));var rimraf=require(_0xc6ed('0x1'));var zipdir=require(_0xc6ed('0x2'));var jsonpatch=require(_0xc6ed('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc6ed('0x4'));var Mustache=require(_0xc6ed('0x5'));var util=require(_0xc6ed('0x6'));var path=require(_0xc6ed('0x7'));var sox=require('sox');var csv=require(_0xc6ed('0x8'));var ejs=require(_0xc6ed('0x9'));var fs=require('fs');var fs_extra=require(_0xc6ed('0xa'));var _=require('lodash');var squel=require(_0xc6ed('0xb'));var crypto=require('crypto');var jsforce=require(_0xc6ed('0xc'));var deskjs=require(_0xc6ed('0xd'));var toCsv=require(_0xc6ed('0x8'));var querystring=require(_0xc6ed('0xe'));var Papa=require('papaparse');var Redis=require(_0xc6ed('0xf'));var authService=require(_0xc6ed('0x10'));var qs=require(_0xc6ed('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xc6ed('0x12'));var logger=require(_0xc6ed('0x13'))(_0xc6ed('0x14'));var utils=require(_0xc6ed('0x15'));var config=require(_0xc6ed('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6ed('0x17'))['db'];config['redis']=_[_0xc6ed('0x18')](config['redis'],{'host':_0xc6ed('0x19'),'port':0x18eb});var socket=require(_0xc6ed('0x1a'))(new Redis(config[_0xc6ed('0x1b')]));require('./whatsappInteraction.socket')[_0xc6ed('0x1c')](socket);function respondWithStatusCode(_0x282ea6,_0xb14647){_0xb14647=_0xb14647||0xcc;return function(_0x5da6a5){if(_0x5da6a5){return _0x282ea6[_0xc6ed('0x1d')](_0xb14647);}return _0x282ea6['status'](_0xb14647)[_0xc6ed('0x1e')]();};}function respondWithResult(_0x35e1d8,_0x16ee41){_0x16ee41=_0x16ee41||0xc8;return function(_0x5346fe){if(_0x5346fe){return _0x35e1d8[_0xc6ed('0x1f')](_0x16ee41)[_0xc6ed('0x20')](_0x5346fe);}};}function respondWithFilteredResult(_0x297fc2,_0x1fd66b){return function(_0x503d90){if(_0x503d90){var _0x5d4c5a=typeof _0x1fd66b[_0xc6ed('0x21')]===_0xc6ed('0x22')&&typeof _0x1fd66b[_0xc6ed('0x23')]===_0xc6ed('0x22');var _0x41c5e8=_0x503d90[_0xc6ed('0x24')];var _0x28a334=_0x5d4c5a?0x0:_0x1fd66b[_0xc6ed('0x21')];var _0xad393b=_0x5d4c5a?_0x503d90[_0xc6ed('0x24')]:_0x1fd66b[_0xc6ed('0x21')]+_0x1fd66b[_0xc6ed('0x23')];var _0x2664a9;if(_0xad393b>=_0x41c5e8){_0xad393b=_0x41c5e8;_0x2664a9=0xc8;}else{_0x2664a9=0xce;}_0x297fc2[_0xc6ed('0x1f')](_0x2664a9);return _0x297fc2['set']('Content-Range',_0x28a334+'-'+_0xad393b+'/'+_0x41c5e8)[_0xc6ed('0x20')](_0x503d90);}return null;};}function patchUpdates(_0x5c5620){return function(_0x565705){try{jsonpatch[_0xc6ed('0x25')](_0x565705,_0x5c5620,!![]);}catch(_0x487461){return BPromise[_0xc6ed('0x26')](_0x487461);}return _0x565705[_0xc6ed('0x27')]();};}function saveUpdates(_0x4682c5,_0x5b0d06){return function(_0x4b63bc){if(_0x4b63bc){return _0x4b63bc['update'](_0x4682c5)[_0xc6ed('0x28')](function(_0x100f7f){return _0x100f7f;});}return null;};}function removeEntity(_0x34f312,_0x33a3c2){return function(_0x1c78bf){if(_0x1c78bf){return _0x1c78bf[_0xc6ed('0x29')]()[_0xc6ed('0x28')](function(){_0x34f312[_0xc6ed('0x1f')](0xcc)[_0xc6ed('0x1e')]();});}};}function handleEntityNotFound(_0x3c97e0,_0xa7e8e3){return function(_0x1abee){if(!_0x1abee){_0x3c97e0['sendStatus'](0x194);}return _0x1abee;};}function handleError(_0x499163,_0x2eec31){_0x2eec31=_0x2eec31||0x1f4;return function(_0x14be47){logger[_0xc6ed('0x2a')](_0x14be47[_0xc6ed('0x2b')]);if(_0x14be47['name']){delete _0x14be47[_0xc6ed('0x2c')];}_0x499163[_0xc6ed('0x1f')](_0x2eec31)[_0xc6ed('0x2d')](_0x14be47);};}function getInteractionUsers(_0x19e628,_0x187cce){return new BPromise(function(_0x4bf19f,_0x35ee5d){try{if(_0x187cce[_0x19e628['id']]){_0x19e628[_0xc6ed('0x2e')]=_[_0xc6ed('0x2f')](_0x187cce[_0x19e628['id']],function(_0x93237d){return{'id':_0x93237d['id'],'fullname':_0x93237d[_0xc6ed('0x30')]};});}}catch(_0xa91fc){_0x35ee5d(_0xa91fc);}_0x4bf19f(_0x19e628);});}function getInteractionTags(_0x3ce947,_0x9ef3f8){return new BPromise(function(_0x6c0ad0,_0x13b110){try{if(_0x3ce947[_0xc6ed('0x31')]){_0x3ce947['Tags']=[];_0x3ce947[_0xc6ed('0x31')][_0xc6ed('0x32')](',')[_0xc6ed('0x33')](function(_0x1028c6){_0x3ce947[_0xc6ed('0x34')]['push'](_0x9ef3f8[_0x1028c6]);});}delete _0x3ce947[_0xc6ed('0x31')];}catch(_0x4f519e){_0x13b110(_0x4f519e);}_0x6c0ad0(_0x3ce947);});}function updateWhatsappInteraction(_0x2d26ea,_0x634747,_0x50b082){return new BPromise(function(_0x5f45d2,_0x1ff7ef){return getInteractionUsers(_0x2d26ea,_0x50b082)[_0xc6ed('0x28')](function(_0x5556b8){return getInteractionTags(_0x5556b8,_0x634747);})[_0xc6ed('0x28')](function(_0x4071f9){return getStateInteraction(_0x4071f9);})['then'](function(_0x52f286){_0x5f45d2(_0x52f286);})[_0xc6ed('0x35')](function(_0xddb409){_0x1ff7ef(_0xddb409);});});}function getStateInteraction(_0x4bdcde){return new BPromise(function(_0x2a8cfb){_0x4bdcde[_0xc6ed('0x36')]=0x0;_0x4bdcde[_0xc6ed('0x37')]=0x0;_0x4bdcde[_0xc6ed('0x38')]=0x0;_0x4bdcde[_0xc6ed('0x39')]=0x0;_0x4bdcde[_0xc6ed('0x3a')]=0x0;if(!_0x4bdcde[_0xc6ed('0x3b')]&&!_0x4bdcde[_0xc6ed('0x3c')]){_0x4bdcde['waiting']+=0x1;}if(!_0x4bdcde[_0xc6ed('0x3b')]&&_0x4bdcde['UserId']){_0x4bdcde[_0xc6ed('0x37')]+=0x1;if(_0x4bdcde[_0xc6ed('0x36')]){_0x4bdcde['waiting']-=0x1;}}if(_0x4bdcde[_0xc6ed('0x3b')]&&_0x4bdcde[_0xc6ed('0x3c')]){_0x4bdcde[_0xc6ed('0x38')]+=0x1;if(_0x4bdcde[_0xc6ed('0x37')]){_0x4bdcde[_0xc6ed('0x37')]-=0x1;}}if(_0x4bdcde[_0xc6ed('0x3b')]&&!_0x4bdcde['UserId']){_0x4bdcde[_0xc6ed('0x39')]+=0x1;if(_0x4bdcde['waiting']){_0x4bdcde[_0xc6ed('0x36')]-=0x1;}}_0x4bdcde[_0xc6ed('0x3a')]+=0x1;_0x2a8cfb(_0x4bdcde);});}exports['index']=function(_0x5916b3,_0x395b9f){var _0x834950={},_0xf1dc6b={},_0x464477={'count':0x0,'rows':[]};var _0x3ef554=_[_0xc6ed('0x2f')](db['WhatsappInteraction']['rawAttributes'],function(_0x471582){return{'name':_0x471582[_0xc6ed('0x3d')],'type':_0x471582[_0xc6ed('0x3e')][_0xc6ed('0x3f')]};});_0xf1dc6b[_0xc6ed('0x40')]=_[_0xc6ed('0x2f')](_0x3ef554,_0xc6ed('0x2c'));_0xf1dc6b[_0xc6ed('0x41')]=_[_0xc6ed('0x42')](_0x5916b3[_0xc6ed('0x41')]);_0xf1dc6b['filters']=_[_0xc6ed('0x43')](_0xf1dc6b[_0xc6ed('0x40')],_0xf1dc6b['query']);_0x834950[_0xc6ed('0x44')]=_['intersection'](_0xf1dc6b[_0xc6ed('0x40')],qs[_0xc6ed('0x45')](_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x45')]));_0x834950['attributes']=_0x834950[_0xc6ed('0x44')][_0xc6ed('0x46')]?_0x834950['attributes']:_0xf1dc6b[_0xc6ed('0x40')];if(!_0x5916b3[_0xc6ed('0x41')]['hasOwnProperty'](_0xc6ed('0x47'))){_0x834950[_0xc6ed('0x23')]=qs[_0xc6ed('0x23')](_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x23')]);_0x834950[_0xc6ed('0x21')]=qs[_0xc6ed('0x21')](_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x21')]);}_0x834950['order']=qs[_0xc6ed('0x48')](_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x48')]);_0x834950['where']=qs[_0xc6ed('0x49')](_[_0xc6ed('0x4a')](_0x5916b3[_0xc6ed('0x41')],_0xf1dc6b[_0xc6ed('0x49')]),_0x3ef554);var _0xd6cb25=[];var _0x448577=squel['select']()[_0xc6ed('0x4b')]('id')[_0xc6ed('0x4b')]('name')['field'](_0xc6ed('0x4c'))['from'](_0xc6ed('0x4d'));var _0x1fbd41=squel[_0xc6ed('0x4e')]()[_0xc6ed('0x4b')](_0xc6ed('0x4f'))[_0xc6ed('0x4b')](_0xc6ed('0x50'))[_0xc6ed('0x4b')](_0xc6ed('0x51'))[_0xc6ed('0x52')](_0xc6ed('0x53'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0xbf6e85=squel['select']()['from'](_0xc6ed('0x54'),'i')[_0xc6ed('0x55')](_0xc6ed('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc6ed('0x55')](_0xc6ed('0x57'),'o',_0xc6ed('0x58'))[_0xc6ed('0x55')](_0xc6ed('0x59'),'a',_0xc6ed('0x5a'))[_0xc6ed('0x55')]('whatsapp_messages','me',_0xc6ed('0x5b'))[_0xc6ed('0x55')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xc6ed('0x55')]('tools_tags','t',_0xc6ed('0x5c'));var _0x1fa5e1=squel[_0xc6ed('0x5d')]();var _0x2c6849=[];var _0x4710ac=squel[_0xc6ed('0x5d')]();var _0x4edb81;if(_0x5916b3[_0xc6ed('0x41')]['search']){_0x4edb81=as[_0xc6ed('0x5e')](_0x5916b3['query'][_0xc6ed('0x5f')]);var _0xe79e7a=_0x4edb81[_0xc6ed('0x60')];for(var _0x961d43=0x0;_0x961d43<_0x4edb81[_0xc6ed('0x61')][_0xc6ed('0x46')];_0x961d43++){var _0x5414ff=_0x4edb81[_0xc6ed('0x61')][_0x961d43];var _0x47bf76='i';var _0x351b05=_[_0xc6ed('0x62')](_0x3ef554,[_0xc6ed('0x2c'),_0x5414ff[_0xc6ed('0x4b')]]);if(!_0x351b05){switch(_0x5414ff[_0xc6ed('0x4b')]){case'unreadMessages':if(_0x5414ff[_0xc6ed('0x63')]==0x1){_0xbf6e85[_0xc6ed('0x64')]('`'+_0x5414ff[_0xc6ed('0x4b')]+_0xc6ed('0x65'));}else{_0xbf6e85[_0xc6ed('0x64')]('`'+_0x5414ff[_0xc6ed('0x4b')]+'`\x20>\x200');}break;case'Contact':if(_0x5414ff[_0xc6ed('0x66')]===_0xc6ed('0x67')){if(_0x5414ff['value']['split']('\x20')[_0xc6ed('0x46')]>0x1){_0x1fa5e1[_0xe79e7a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc6ed('0x68')](_0x5414ff[_0xc6ed('0x63')]),null);}else{var _0x1a7445='%'+_0x5414ff[_0xc6ed('0x63')]+'%';_0x1fa5e1[_0xe79e7a](_0xc6ed('0x69'),_0x1a7445,_0x1a7445,_0x1a7445);}}else{_0x351b05=_[_0xc6ed('0x62')](_0x3ef554,[_0xc6ed('0x2c'),_0xc6ed('0x6a')]);_0x5414ff['field']=_0xc6ed('0x6a');_0x5adb65=as[_0xc6ed('0x6b')](_0x47bf76,_0x351b05[_0xc6ed('0x3e')],_0x5414ff);_0x1fa5e1[_0xe79e7a](_0x5adb65[_0xc6ed('0x6c')],_0x5adb65[_0xc6ed('0x63')]['start'],_0x5adb65['value'][_0xc6ed('0x1e')]);}break;case _0xc6ed('0x6d'):var _0x25c421=_0x5414ff[_0xc6ed('0x63')][_0xc6ed('0x32')](',')[_0xc6ed('0x2f')](function(_0x1b05e8){return Number(_0x1b05e8);});_0x25c421[_0xc6ed('0x33')](function(_0x33e19d){_0x4710ac['or'](_0xc6ed('0x6e'),'%,'+_0x33e19d+',%');});_0x2c6849=_[_0xc6ed('0x6f')](_0x2c6849,_0x25c421);break;case _0xc6ed('0x70'):if(_0x5414ff[_0xc6ed('0x66')]===_0xc6ed('0x67')){_0x1fa5e1[_0xe79e7a](_0xc6ed('0x71'),'%'+_0x5414ff[_0xc6ed('0x63')]+'%',null);}else{_0x351b05=_[_0xc6ed('0x62')](_0x3ef554,[_0xc6ed('0x2c'),_0xc6ed('0x3c')]);_0x5414ff[_0xc6ed('0x4b')]='UserId';_0x5adb65=as['buildExpression'](_0x47bf76,_0x351b05[_0xc6ed('0x3e')],_0x5414ff);_0x1fa5e1[_0xe79e7a](_0x5adb65[_0xc6ed('0x6c')],_0x5adb65[_0xc6ed('0x63')][_0xc6ed('0x72')],_0x5adb65['value'][_0xc6ed('0x1e')]);}break;case _0xc6ed('0x73'):_0x5adb65=as[_0xc6ed('0x6b')]('me',null,_0x5414ff);_0x1fa5e1[_0xe79e7a](_0x5adb65[_0xc6ed('0x6c')],_0x5adb65[_0xc6ed('0x63')][_0xc6ed('0x72')],_0x5adb65[_0xc6ed('0x63')][_0xc6ed('0x1e')]);break;}}else{var _0x5adb65=as[_0xc6ed('0x6b')](_0x47bf76,_0x351b05['type'],_0x5414ff);_0x1fa5e1[_0xe79e7a](_0x5adb65[_0xc6ed('0x6c')],_0x5adb65[_0xc6ed('0x63')]['start'],_0x5adb65['value']['end']);}}}else{var _0x5f2608=_(_0x5916b3[_0xc6ed('0x41')])[_0xc6ed('0x42')]()['map'](function(_0x58e562){return _[_0xc6ed('0x74')](_0x3ef554,[_0xc6ed('0x2c'),_0x58e562])?_0x58e562:undefined;})[_0xc6ed('0x75')]()[_0xc6ed('0x63')]();if(!_[_0xc6ed('0x76')](_0x5f2608)){_0x5f2608[_0xc6ed('0x33')](function(_0x33859c){if(_0x33859c===_0xc6ed('0x77')){_0xbf6e85[_0xc6ed('0x78')]('i.WhatsappAccountId\x20IN\x20?',[][_0xc6ed('0x79')](_0x5916b3[_0xc6ed('0x41')][_0x33859c]));}else if(_0x33859c===_0xc6ed('0x7a')){var _0x416969=JSON[_0xc6ed('0x7b')](_0x5916b3[_0xc6ed('0x41')][_0x33859c])[_0xc6ed('0x7c')];var _0x3b3572=JSON[_0xc6ed('0x7b')](_0x5916b3[_0xc6ed('0x41')][_0x33859c])['$lte'];_0xbf6e85[_0xc6ed('0x78')](_0xc6ed('0x7d'),_0x416969,_0x3b3572);}else{if(_0x5916b3[_0xc6ed('0x41')][_0x33859c]==='null'){_0xbf6e85[_0xc6ed('0x78')]('i.'+_0x33859c+'\x20IS\x20NULL');}else{_0xbf6e85[_0xc6ed('0x78')]('i.'+_0x33859c+'\x20=\x20?',_0x5916b3[_0xc6ed('0x41')][_0x33859c]);}}});}if(_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x7e')]){if(_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x7e')]==0x1){_0xbf6e85['having'](_0xc6ed('0x7f'));}else{_0xbf6e85['having']('`unreadMessages`\x20>\x200');}}if(_0x5916b3['query'][_0xc6ed('0x80')]){_0x2c6849=_[_0xc6ed('0x81')](_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x80')])?_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x80')]:new Array(_0x5916b3[_0xc6ed('0x41')]['tag']);_0x2c6849['forEach'](function(_0x126fe3){_0x4710ac['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x126fe3+',%');});}if(_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x82')]){var _0x19813f=_0x5916b3['query'][_0xc6ed('0x82')][_0xc6ed('0x83')]('\x5c','\x5c\x5c')[_0xc6ed('0x83')](/'/g,'\x27\x27');if(qs[_0xc6ed('0x84')](_0x19813f)){_0x1fa5e1['or'](_0xc6ed('0x85'),_0x19813f+'%')['or'](_0xc6ed('0x86'),_0x19813f+'%');}else{_0x1fa5e1['or'](_0xc6ed('0x87'),qs[_0xc6ed('0x68')](_0x19813f))['or'](_0xc6ed('0x88'),_0x19813f+'%');}}}_0xbf6e85[_0xc6ed('0x78')](_0x1fa5e1);_0xbf6e85['group']('i.id');var _0x266b57={'type':db[_0xc6ed('0x89')][_0xc6ed('0x8a')]['SELECT'],'raw':!![]};var _0x33733e=_0xbf6e85[_0xc6ed('0x8b')]();_0x33733e[_0xc6ed('0x4b')](_0xc6ed('0x8c'));_0x33733e[_0xc6ed('0x4b')](_0xc6ed('0x8d'),'unreadMessages');if(_0x834950[_0xc6ed('0x8e')]){_0x834950['order']['forEach'](function(_0x3c430b){var _0x2b29bf=_0x3c430b[0x0]===_0xc6ed('0x8f')?_0x3c430b[0x0]:'i.'+_0x3c430b[0x0];_0xbf6e85[_0xc6ed('0x8e')](_0x2b29bf,_0x3c430b[0x1]===_0xc6ed('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x2c6849)){_0xbf6e85[_0xc6ed('0x64')](_0x4710ac);_0x33733e[_0xc6ed('0x78')](_0xc6ed('0x91'),_0x2c6849);}BPromise['resolve']()[_0xc6ed('0x28')](function(){if(!_0x4edb81){if(_0x5916b3[_0xc6ed('0x41')]['WhatsappAccountId'])return;_0x33733e[_0xc6ed('0x78')](_0xc6ed('0x92'));_0xbf6e85[_0xc6ed('0x78')](_0xc6ed('0x92'));return;}if(_0x5916b3[_0xc6ed('0x93')][_0xc6ed('0x94')]!=='agent')return;return _0x5916b3[_0xc6ed('0x93')][_0xc6ed('0x95')]({'attributes':['id'],'raw':!![]})[_0xc6ed('0x28')](function(_0x58f775){if(_['isEmpty'](_0x58f775)){_0x33733e[_0xc6ed('0x78')]('i.WhatsappAccountId\x20IS\x20NULL');_0xbf6e85[_0xc6ed('0x78')](_0xc6ed('0x96'));}else{_0x33733e['where'](_0xc6ed('0x97'),_[_0xc6ed('0x2f')](_0x58f775,'id'));_0xbf6e85['where'](_0xc6ed('0x97'),_[_0xc6ed('0x2f')](_0x58f775,'id'));}});})['then'](function(){if(_0x5916b3['user'][_0xc6ed('0x94')]===_0xc6ed('0x98')&&!_0x4edb81&&!_0x5916b3['query']['WhatsappAccountId'])return[];return db[_0xc6ed('0x99')][_0xc6ed('0x41')](_0x33733e[_0xc6ed('0x9a')](),_0x266b57);})['then'](function(_0x466dc3){_0x464477[_0xc6ed('0x24')]=_0x466dc3[_0xc6ed('0x46')];if(_0x464477['count']===0x0)return[];return db['sequelize']['query'](_0x448577[_0xc6ed('0x9a')](),_0x266b57)['then'](function(_0x103e65){_0xd6cb25=_[_0xc6ed('0x9b')](_0x103e65,'id');_0x266b57=_[_0xc6ed('0x9c')](_0x266b57,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5916b3[_0xc6ed('0x41')]['fields']){_0x834950[_0xc6ed('0x44')][_0xc6ed('0x33')](function(_0x4950db){_0xbf6e85[_0xc6ed('0x4b')]('i.'+_0x4950db);});}else{_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0x8d'),'unreadMessages');_0xbf6e85[_0xc6ed('0x4b')]('a.key','Account.key');_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0x9d'),_0xc6ed('0x9e'));_0xbf6e85['field'](_0xc6ed('0x9f'),_0xc6ed('0x8f'));_0xbf6e85['field'](_0xc6ed('0xa0'));_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0xa1'),_0xc6ed('0xa2'));_0xbf6e85['field'](_0xc6ed('0xa3'),'Contact.lastName');_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0xa4'),_0xc6ed('0xa5'));_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0xa6'),_0xc6ed('0xa7'));_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0xa8'),_0xc6ed('0xa9'));_0xbf6e85[_0xc6ed('0x4b')]('c.fax',_0xc6ed('0xaa'));_0xbf6e85[_0xc6ed('0x4b')]('o.fullname','Owner.fullname');_0xbf6e85[_0xc6ed('0x4b')]('o.internal',_0xc6ed('0xab'));_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0xac'),_0xc6ed('0x31'));}if(_0x834950['limit'])_0xbf6e85[_0xc6ed('0x23')](_0x834950['limit']);if(_0x834950[_0xc6ed('0x21')])_0xbf6e85[_0xc6ed('0x21')](_0x834950['offset']);return db[_0xc6ed('0x99')][_0xc6ed('0x41')](_0xbf6e85[_0xc6ed('0x9a')](),_0x266b57);})[_0xc6ed('0x28')](function(_0x3ed828){if(_0x3ed828[_0xc6ed('0x46')]>0x0)_0x1fbd41[_0xc6ed('0x78')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xc6ed('0x2f')](_0x3ed828,'id'));return db[_0xc6ed('0x99')][_0xc6ed('0x41')](_0x1fbd41[_0xc6ed('0x9a')](),_0x266b57)[_0xc6ed('0x28')](function(_0xa2b613){var _0x481258=_[_0xc6ed('0xad')](_0xa2b613,_0xc6ed('0xae'));var _0x27dd37=[];_0x3ed828[_0xc6ed('0x33')](function(_0x4bb4a7){_0x27dd37[_0xc6ed('0xaf')](updateWhatsappInteraction(_0x4bb4a7,_0xd6cb25,_0x481258));});return BPromise['all'](_0x27dd37);});});})[_0xc6ed('0x28')](function(_0x69cd9b){_0x464477[_0xc6ed('0xb0')]=_0x69cd9b;return _0x464477;})[_0xc6ed('0x28')](respondWithFilteredResult(_0x395b9f,_0x834950))[_0xc6ed('0x35')](handleError(_0x395b9f,null));};exports['show']=function(_0x4a2a27,_0x3e0c93){var _0x560eb9={'raw':![],'where':{'id':_0x4a2a27[_0xc6ed('0xb1')]['id']}},_0x581472={};_0x581472[_0xc6ed('0x40')]=_['keys'](db[_0xc6ed('0xb2')][_0xc6ed('0xb3')]);_0x581472[_0xc6ed('0x41')]=_[_0xc6ed('0x42')](_0x4a2a27['query']);_0x581472[_0xc6ed('0x49')]=_[_0xc6ed('0x43')](_0x581472[_0xc6ed('0x40')],_0x581472[_0xc6ed('0x41')]);_0x560eb9[_0xc6ed('0x44')]=_[_0xc6ed('0x43')](_0x581472[_0xc6ed('0x40')],qs[_0xc6ed('0x45')](_0x4a2a27['query']['fields']));_0x560eb9[_0xc6ed('0x44')]=_0x560eb9[_0xc6ed('0x44')][_0xc6ed('0x46')]?_0x560eb9['attributes']:_0x581472[_0xc6ed('0x40')];if(_0x4a2a27['query'][_0xc6ed('0xb4')]){_0x560eb9[_0xc6ed('0xb5')]=[{'all':!![]}];}_0x560eb9=_[_0xc6ed('0x9c')]({},_0x560eb9,_0x4a2a27['options']);return db[_0xc6ed('0xb2')][_0xc6ed('0x62')](_0x560eb9)[_0xc6ed('0x28')](handleEntityNotFound(_0x3e0c93,null))[_0xc6ed('0x28')](respondWithResult(_0x3e0c93,null))[_0xc6ed('0x35')](handleError(_0x3e0c93,null));};exports[_0xc6ed('0xb6')]=function(_0x4310d9,_0x32cea0){return db[_0xc6ed('0xb2')][_0xc6ed('0xb6')](_0x4310d9[_0xc6ed('0x73')],{})[_0xc6ed('0x28')](respondWithResult(_0x32cea0,0xc9))[_0xc6ed('0x35')](handleError(_0x32cea0,null));};exports['update']=function(_0x4c30f7,_0x41c889){if(_0x4c30f7['body']['id']){delete _0x4c30f7['body']['id'];}return db[_0xc6ed('0xb2')][_0xc6ed('0x62')]({'where':{'id':_0x4c30f7[_0xc6ed('0xb1')]['id']}})[_0xc6ed('0x28')](handleEntityNotFound(_0x41c889,null))[_0xc6ed('0x28')](saveUpdates(_0x4c30f7[_0xc6ed('0x73')],null))['then'](respondWithResult(_0x41c889,null))[_0xc6ed('0x35')](handleError(_0x41c889,null));};exports['destroy']=function(_0x321346,_0x2e8260){return db[_0xc6ed('0xb2')]['find']({'where':{'id':_0x321346[_0xc6ed('0xb1')]['id']}})[_0xc6ed('0x28')](handleEntityNotFound(_0x2e8260,null))['then'](removeEntity(_0x2e8260,null))['catch'](handleError(_0x2e8260,null));};exports[_0xc6ed('0xb7')]=function(_0x375acc,_0x5e81e6){return db[_0xc6ed('0xb2')][_0xc6ed('0xb7')]()['then'](respondWithResult(_0x5e81e6,null))['catch'](handleError(_0x5e81e6,null));};exports[_0xc6ed('0xb8')]=function(_0x242505,_0x599118,_0x4e1927){return db[_0xc6ed('0xb9')]['find']({'where':{'id':_0x242505[_0xc6ed('0xb1')]['id']}})['then'](handleEntityNotFound(_0x599118,null))['then'](function(_0x57801e){if(_0x57801e){return _0x57801e['addMessage'](_0x242505[_0xc6ed('0x73')][_0xc6ed('0xba')],_[_0xc6ed('0xbb')](_0x242505[_0xc6ed('0x73')],['ids','id'])||{});}})[_0xc6ed('0x28')](respondWithResult(_0x599118,null))[_0xc6ed('0x35')](handleError(_0x599118,null));};exports[_0xc6ed('0xbc')]=function(_0x561162,_0x5591f7,_0x38dfb1){var _0x4eeafc={'raw':![],'where':{}};var _0x5ca6ad={};var _0x566c8c={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x561162[_0xc6ed('0xb1')]['id']}})[_0xc6ed('0x28')](handleEntityNotFound(_0x5591f7,null))[_0xc6ed('0x28')](function(_0x1a4a52){if(_0x1a4a52){_0x5ca6ad[_0xc6ed('0x40')]=_[_0xc6ed('0x42')](db[_0xc6ed('0xb9')]['rawAttributes']);_0x5ca6ad[_0xc6ed('0x41')]=_['keys'](_0x561162[_0xc6ed('0x41')]);_0x5ca6ad[_0xc6ed('0x49')]=_[_0xc6ed('0x43')](_0x5ca6ad[_0xc6ed('0x40')],_0x5ca6ad[_0xc6ed('0x41')]);_0x4eeafc[_0xc6ed('0x44')]=_[_0xc6ed('0x43')](_0x5ca6ad[_0xc6ed('0x40')],qs[_0xc6ed('0x45')](_0x561162[_0xc6ed('0x41')]['fields']));_0x4eeafc[_0xc6ed('0x44')]=_0x4eeafc[_0xc6ed('0x44')][_0xc6ed('0x46')]?_0x4eeafc[_0xc6ed('0x44')]:_0x5ca6ad[_0xc6ed('0x40')];if(!_0x561162[_0xc6ed('0x41')][_0xc6ed('0xbd')](_0xc6ed('0x47'))){_0x4eeafc[_0xc6ed('0x23')]=qs['limit'](_0x561162[_0xc6ed('0x41')][_0xc6ed('0x23')]);_0x4eeafc[_0xc6ed('0x21')]=qs[_0xc6ed('0x21')](_0x561162[_0xc6ed('0x41')][_0xc6ed('0x21')]);}_0x4eeafc[_0xc6ed('0x8e')]=qs[_0xc6ed('0x48')](_0x561162[_0xc6ed('0x41')][_0xc6ed('0x48')]);_0x4eeafc[_0xc6ed('0x78')]=qs[_0xc6ed('0x49')](_[_0xc6ed('0x4a')](_0x561162[_0xc6ed('0x41')],_0x5ca6ad[_0xc6ed('0x49')]));_0x4eeafc[_0xc6ed('0x78')][_0xc6ed('0xae')]=_0x1a4a52['id'];if(_0x561162[_0xc6ed('0x41')]['filter']){_0x4eeafc[_0xc6ed('0x78')]=_[_0xc6ed('0x9c')](_0x4eeafc[_0xc6ed('0x78')],{'$or':_[_0xc6ed('0x2f')](_0x4eeafc[_0xc6ed('0x44')],function(_0x486b7e){var _0x517e85={};_0x517e85[_0x486b7e]={'$like':'%'+_0x561162[_0xc6ed('0x41')][_0xc6ed('0x82')]+'%'};return _0x517e85;})});}if(_0x561162[_0xc6ed('0x41')][_0xc6ed('0x7c')]){var _0x59f5eb=_0x561162[_0xc6ed('0x41')][_0xc6ed('0x7c')]['split'](',');var _0x268010={};_0x268010[_0x59f5eb[0x0]]={'$gte':moment(_0x59f5eb[0x1])['format'](_0xc6ed('0xbe'))};_0x4eeafc[_0xc6ed('0x78')]=_[_0xc6ed('0x9c')](_0x4eeafc[_0xc6ed('0x78')],_0x268010);}_0x4eeafc=_[_0xc6ed('0x9c')]({},_0x4eeafc,_0x561162[_0xc6ed('0xbf')]);return db['WhatsappMessage'][_0xc6ed('0x24')]({'where':_0x4eeafc[_0xc6ed('0x78')]})[_0xc6ed('0x28')](function(_0x2535b6){_0x566c8c['count']=_0x2535b6;if(_0x561162[_0xc6ed('0x41')][_0xc6ed('0xb4')]){_0x4eeafc[_0xc6ed('0xb5')]=[{'all':!![]}];}return db[_0xc6ed('0xb9')]['findAll'](_0x4eeafc);})[_0xc6ed('0x28')](function(_0x112b1a){_0x566c8c['rows']=_0x112b1a;return _0x566c8c;});}})['then'](respondWithFilteredResult(_0x5591f7,_0x4eeafc))['catch'](handleError(_0x5591f7,null));};exports[_0xc6ed('0xc0')]=function(_0x4443a2,_0x5ce659,_0x171c9){return db['WhatsappInteraction'][_0xc6ed('0x62')]({'where':{'id':_0x4443a2[_0xc6ed('0xb1')]['id']}})[_0xc6ed('0x28')](handleEntityNotFound(_0x5ce659,null))[_0xc6ed('0x28')](function(_0x1ee1a4){if(_0x1ee1a4){return _0x1ee1a4[_0xc6ed('0xc1')](_0x4443a2[_0xc6ed('0x73')][_0xc6ed('0xba')],_[_0xc6ed('0xbb')](_0x4443a2['body'],[_0xc6ed('0xba'),'id'])||{})[_0xc6ed('0xc2')](function(){return db[_0xc6ed('0x6d')][_0xc6ed('0xc3')]({'attributes':['id',_0xc6ed('0x2c'),_0xc6ed('0x4c')],'where':{'id':_0x4443a2[_0xc6ed('0x73')][_0xc6ed('0xba')]}});})[_0xc6ed('0x28')](function(_0x1b277f){socket[_0xc6ed('0xc4')]('whatsappInteractionTags:save',{'id':Number(_0x4443a2[_0xc6ed('0xb1')]['id']),'tags':_0x1b277f||[]});return{'id':Number(_0x4443a2[_0xc6ed('0xb1')]['id']),'tags':_0x1b277f||[]};});}})['then'](respondWithResult(_0x5ce659,null))[_0xc6ed('0x35')](handleError(_0x5ce659,null));};exports[_0xc6ed('0xc5')]=function(_0x2d82a2,_0x179b07,_0x574c05){return db[_0xc6ed('0xb2')]['find']({'where':{'id':_0x2d82a2[_0xc6ed('0xb1')]['id']}})[_0xc6ed('0x28')](handleEntityNotFound(_0x179b07,null))['then'](function(_0x493276){if(_0x493276){return _0x493276['removeTags'](_0x2d82a2[_0xc6ed('0x41')][_0xc6ed('0xba')]);}})[_0xc6ed('0x28')](respondWithStatusCode(_0x179b07,null))['catch'](handleError(_0x179b07,null));};exports[_0xc6ed('0xc6')]=function(_0x42b13f,_0x3aa0b5){var _0x3f0d73=moment()[_0xc6ed('0xc7')]()['toString']();var _0x11aa46=path['join'](config[_0xc6ed('0xc8')],_0xc6ed('0xc9'),_0xc6ed('0xca'),'tmp');var _0x36f59b=path[_0xc6ed('0xcb')](config[_0xc6ed('0xc8')],_0xc6ed('0xc9'),'files',_0xc6ed('0xcc'));var _0x2883f3=path[_0xc6ed('0xcb')](_0x11aa46,_0x3f0d73);var _0x57c7d1=util['format']('transcript-%d-%s.zip',_0x42b13f[_0xc6ed('0xb1')]['id'],_0x3f0d73);var _0x1d1a5f=path['join'](_0x11aa46,_0x57c7d1);var _0x54f3fe=[];_0x54f3fe[_0xc6ed('0xaf')]({'model':db[_0xc6ed('0x70')],'as':'User','attributes':['id',_0xc6ed('0x30')],'raw':!![]});_0x54f3fe[_0xc6ed('0xaf')]({'model':db[_0xc6ed('0xcd')],'as':_0xc6ed('0xce'),'attributes':['id',_0xc6ed('0xcf'),'lastName'],'raw':!![]});if(_0x42b13f[_0xc6ed('0x41')]['attachments']){_0x54f3fe['push']({'model':db[_0xc6ed('0xd0')],'as':'Attachment','raw':!![]});}var _0x2ada9d=[{'model':db[_0xc6ed('0xb9')],'as':_0xc6ed('0xd1'),'attributes':['id',_0xc6ed('0x73'),_0xc6ed('0x7a'),_0xc6ed('0xd2'),_0xc6ed('0xd3'),_0xc6ed('0x7e')],'include':_0x54f3fe}];_0x2ada9d[_0xc6ed('0xaf')]({'model':db[_0xc6ed('0xd4')],'as':_0xc6ed('0xd5'),'attributes':['id',_0xc6ed('0x2c')]});_0x2ada9d[_0xc6ed('0xaf')]({'model':db[_0xc6ed('0x70')],'as':'Owner','attributes':['id',_0xc6ed('0x30')]});return db[_0xc6ed('0xb2')][_0xc6ed('0x62')]({'where':{'id':_0x42b13f[_0xc6ed('0xb1')]['id']},'include':_0x2ada9d})[_0xc6ed('0x28')](handleEntityNotFound(_0x3aa0b5,null))[_0xc6ed('0x28')](function(_0x2e6562){if(_0x2e6562){var _0x44aad4=_0x2e6562[_0xc6ed('0xd6')]({'plain':!![]});fs['mkdirSync'](_0x2883f3);var _0x5d2d3a={'channel':_0xc6ed('0xd7'),'account':_0x44aad4['Account'][_0xc6ed('0x2c')],'agent':_0x44aad4[_0xc6ed('0xd8')]?_0x44aad4[_0xc6ed('0xd8')][_0xc6ed('0x30')]:_0xc6ed('0xd9'),'createdAt':moment(_0x44aad4['createdAt'])[_0xc6ed('0xda')](_0xc6ed('0xbe'))[_0xc6ed('0x9a')](),'closedAt':_0x44aad4[_0xc6ed('0x3b')]?moment(_0x44aad4[_0xc6ed('0xdb')])[_0xc6ed('0xda')](_0xc6ed('0xbe'))[_0xc6ed('0x9a')]():'','disposition':_0x44aad4[_0xc6ed('0xdc')],'messages':_(_0x44aad4[_0xc6ed('0xd1')])[_0xc6ed('0x82')]({'secret':![]})['map'](function(_0x536ccb){if(_0x536ccb[_0xc6ed('0xd0')]){var _0x502cbe=path[_0xc6ed('0xcb')](_0x36f59b,_0x536ccb[_0xc6ed('0xd0')][_0xc6ed('0xdd')]);if(fs[_0xc6ed('0xde')](_0x502cbe)){fs[_0xc6ed('0xdf')](_0x502cbe)['pipe'](fs[_0xc6ed('0xe0')](path[_0xc6ed('0xcb')](_0x2883f3,_0x536ccb[_0xc6ed('0xd0')][_0xc6ed('0xdd')])));}}return{'date':moment(_0x536ccb['createdAt'])['format'](_0xc6ed('0xbe'))['toString'](),'sender':_0x536ccb[_0xc6ed('0xd2')]===_0xc6ed('0xe1')?_0x536ccb[_0xc6ed('0x70')]?_0x536ccb[_0xc6ed('0x70')][_0xc6ed('0x30')]:'System':_0x536ccb[_0xc6ed('0xce')][_0xc6ed('0xcf')]+(_0x536ccb[_0xc6ed('0xce')]['lastName']?'\x20'+_0x536ccb['Contact'][_0xc6ed('0xe2')]:''),'body':_0x536ccb[_0xc6ed('0xd0')]?_0x536ccb[_0xc6ed('0xd0')][_0xc6ed('0xdd')]:_0x536ccb['body'],'direction':_0x536ccb[_0xc6ed('0xd2')]===_0xc6ed('0xe1')?'A':'C','secret':_0x536ccb['secret'],'read':_0x536ccb[_0xc6ed('0x7e')],'attachment':_0x536ccb['Attachment']};})[_0xc6ed('0x63')]()};return ejs[_0xc6ed('0xe3')](path[_0xc6ed('0xcb')](config['root'],_0xc6ed('0xc9'),_0xc6ed('0xe4'),'downloadInteraction.ejs'),{'interaction':_0x5d2d3a})[_0xc6ed('0x28')](function(_0x5912d6){var _0x56c9d2=path['join'](_0x2883f3,_0xc6ed('0xe5')+_0x44aad4['id']+'-'+_0x3f0d73+_0xc6ed('0xe6'));var _0x213c9d={'path':_0x56c9d2,'channel':'Whatsapp','interactionId':_0x44aad4['id']};return pdf[_0xc6ed('0xe7')](_0x5912d6,_0x213c9d);})[_0xc6ed('0x28')](function(){return new BPromise(function(_0x1651d7,_0x4e7820){zipdir(_0x2883f3,{'saveTo':_0x1d1a5f},function(_0x57a578,_0x10aa08){if(_0x57a578)return _0x4e7820(_0x57a578);return _0x1651d7(_0x10aa08);});})[_0xc6ed('0x28')](function(){return new BPromise(function(_0x3f9962,_0x2560ef){rimraf(_0x2883f3,function(_0x4e8061){if(_0x4e8061)_0x2560ef(_0x4e8061);return _0x3f9962();});});})[_0xc6ed('0x28')](function(){return _0x3aa0b5[_0xc6ed('0xc6')](_0x1d1a5f,_0x57c7d1,function(_0x27289e){if(_0x27289e){console['log']('err',_0x27289e);}else{fs[_0xc6ed('0xe8')](_0x1d1a5f);}});});});}else{return _0x3aa0b5[_0xc6ed('0x1d')](0xc8);}})[_0xc6ed('0x35')](handleError(_0x3aa0b5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 171d527..8346676 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.events.js +++ b/server/api/whatsappInteraction/whatsappInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3495=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','Users','findAll','then','setDataValue','unreadMessages','length','emit'];(function(_0x196929,_0x5f33b5){var _0x230fda=function(_0x29db43){while(--_0x29db43){_0x196929['push'](_0x196929['shift']());}};_0x230fda(++_0x5f33b5);}(_0x3495,0x1de));var _0x5349=function(_0x5ec054,_0x11956b){_0x5ec054=_0x5ec054-0x0;var _0x51ab39=_0x3495[_0x5ec054];return _0x51ab39;};'use strict';var EventEmitter=require(_0x5349('0x0'));var WhatsappInteraction=require(_0x5349('0x1'))['db'][_0x5349('0x2')];var WhatsappMessage=require(_0x5349('0x1'))['db'][_0x5349('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5349('0x4')](0x0);var events={'afterCreate':_0x5349('0x5'),'afterUpdate':_0x5349('0x6'),'afterDestroy':_0x5349('0x7')};function emitEvent(_0x5912ac){return function(_0x4034ba,_0x8283b5,_0x5ce2cd){_0x4034ba[_0x5349('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x6fb5dc){_0x4034ba['setDataValue'](_0x5349('0x9'),_0x6fb5dc['map'](function(_0x1751b2){return{'id':_0x1751b2['id']};}));return WhatsappMessage[_0x5349('0xa')]({'where':{'WhatsappInteractionId':_0x4034ba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5349('0xb')](function(_0x23a1c7){_0x4034ba[_0x5349('0xc')](_0x5349('0xd'),_0x23a1c7[_0x5349('0xe')]);WhatsappInteractionEvents['emit'](_0x5912ac+':'+_0x4034ba['id'],_0x4034ba);WhatsappInteractionEvents[_0x5349('0xf')](_0x5912ac,_0x4034ba);_0x5ce2cd(null);})['catch'](_0x5ce2cd(null));};}for(var e in events){if(events[_0x5349('0x10')](e)){var event=events[e];WhatsappInteraction[_0x5349('0x11')](e,emitEvent(event));}}module[_0x5349('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xfc73=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc73,0x8d));var _0x3fc7=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xfc73[_0x4a53d];return _0x27410e;};'use strict';var EventEmitter=require(_0x3fc7('0x0'));var WhatsappInteraction=require(_0x3fc7('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x3fc7('0x1'))['db'][_0x3fc7('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3fc7('0x3')](0x0);var events={'afterCreate':_0x3fc7('0x4'),'afterUpdate':_0x3fc7('0x5'),'afterDestroy':_0x3fc7('0x6')};function emitEvent(_0x429287){return function(_0x8e713,_0x4427df,_0x1039e0){_0x8e713[_0x3fc7('0x7')]({'attributes':['id'],'raw':!![]})[_0x3fc7('0x8')](function(_0x5e41d3){_0x8e713[_0x3fc7('0x9')](_0x3fc7('0xa'),_0x5e41d3[_0x3fc7('0xb')](function(_0x3e2653){return{'id':_0x3e2653['id']};}));return WhatsappMessage[_0x3fc7('0xc')]({'where':{'WhatsappInteractionId':_0x8e713['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5a0444){_0x8e713[_0x3fc7('0x9')](_0x3fc7('0xd'),_0x5a0444[_0x3fc7('0xe')]);WhatsappInteractionEvents[_0x3fc7('0xf')](_0x429287+':'+_0x8e713['id'],_0x8e713);WhatsappInteractionEvents[_0x3fc7('0xf')](_0x429287,_0x8e713);_0x1039e0(null);})[_0x3fc7('0x10')](_0x1039e0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x3fc7('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index be4d9dd..2c8d40c 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c79=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','./whatsappInteraction.attributes','exports','define'];(function(_0x2bf55e,_0x360e9c){var _0x379ca5=function(_0xeda99d){while(--_0xeda99d){_0x2bf55e['push'](_0x2bf55e['shift']());}};_0x379ca5(++_0x360e9c);}(_0x2c79,0x66));var _0x92c7=function(_0x1dc59d,_0x43edca){_0x1dc59d=_0x1dc59d-0x0;var _0x46e84a=_0x2c79[_0x1dc59d];return _0x46e84a;};'use strict';var _=require(_0x92c7('0x0'));var util=require(_0x92c7('0x1'));var logger=require(_0x92c7('0x2'))(_0x92c7('0x3'));var moment=require(_0x92c7('0x4'));var BPromise=require('bluebird');var rp=require(_0x92c7('0x5'));var fs=require('fs');var path=require(_0x92c7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x92c7('0x7'));module[_0x92c7('0x8')]=function(_0x2812a4,_0x1c4e0e){return _0x2812a4[_0x92c7('0x9')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3371e8,_0x103a4d,_0x1cd384){if(_0x3371e8['changed'](_0x92c7('0xa'))){_0x3371e8[_0x92c7('0xb')]=moment()[_0x92c7('0xc')](_0x92c7('0xd'));}_0x1cd384(null,_0x3371e8);}}});}; \ No newline at end of file +var _0x09cd=['moment','bluebird','path','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x3cccfb,_0x4eac2d){var _0x16110f=function(_0x40b297){while(--_0x40b297){_0x3cccfb['push'](_0x3cccfb['shift']());}};_0x16110f(++_0x4eac2d);}(_0x09cd,0xcd));var _0xd09c=function(_0x177be9,_0x441b63){_0x177be9=_0x177be9-0x0;var _0x2d415d=_0x09cd[_0x177be9];return _0x2d415d;};'use strict';var _=require(_0xd09c('0x0'));var util=require('util');var logger=require(_0xd09c('0x1'))(_0xd09c('0x2'));var moment=require(_0xd09c('0x3'));var BPromise=require(_0xd09c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd09c('0x5'));var rimraf=require('rimraf');var config=require(_0xd09c('0x6'));var attributes=require(_0xd09c('0x7'));module[_0xd09c('0x8')]=function(_0x503b53,_0x5b011d){return _0x503b53[_0xd09c('0x9')]('WhatsappInteraction',attributes,{'tableName':_0xd09c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a19b4,_0xbfbd94,_0x1baa65){if(_0x5a19b4['changed']('closed')){_0x5a19b4['closedAt']=moment()[_0xd09c('0xb')](_0xd09c('0xc'));}_0x1baa65(null,_0x5a19b4);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 9199fc5..e6f8c49 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.rpc.js +++ b/server/api/whatsappInteraction/whatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3c2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','AddTagsToWhatsappInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment'];(function(_0x1ad6f8,_0x9160db){var _0xc83409=function(_0x4ef878){while(--_0x4ef878){_0x1ad6f8['push'](_0x1ad6f8['shift']());}};_0xc83409(++_0x9160db);}(_0xd3c2,0x180));var _0x2d3c=function(_0x31ebae,_0x97d23d){_0x31ebae=_0x31ebae-0x0;var _0x224286=_0xd3c2[_0x31ebae];return _0x224286;};'use strict';var _=require(_0x2d3c('0x0'));var util=require(_0x2d3c('0x1'));var moment=require(_0x2d3c('0x2'));var BPromise=require(_0x2d3c('0x3'));var rs=require(_0x2d3c('0x4'));var fs=require('fs');var Redis=require(_0x2d3c('0x5'));var db=require(_0x2d3c('0x6'))['db'];var utils=require(_0x2d3c('0x7'));var logger=require(_0x2d3c('0x8'))(_0x2d3c('0x9'));var config=require(_0x2d3c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2d3c('0xb')][_0x2d3c('0xc')]({'port':0x232a});config[_0x2d3c('0xd')]=_[_0x2d3c('0xe')](config[_0x2d3c('0xd')],{'host':_0x2d3c('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d3c('0xd')]));require(_0x2d3c('0x10'))[_0x2d3c('0x11')](socket);function respondWithRpcPromise(_0x1abb76,_0x2aef1d,_0x52a0ce){return new BPromise(function(_0x3db42b,_0x3000f6){return client[_0x2d3c('0x12')](_0x1abb76,_0x52a0ce)[_0x2d3c('0x13')](function(_0xcca2c1){logger[_0x2d3c('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x2aef1d,_0x2d3c('0x15'));logger[_0x2d3c('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x2aef1d,_0x2d3c('0x15'),JSON[_0x2d3c('0x17')](_0xcca2c1));if(_0xcca2c1[_0x2d3c('0x18')]){if(_0xcca2c1[_0x2d3c('0x18')][_0x2d3c('0x19')]===0x1f4){logger[_0x2d3c('0x18')](_0x2d3c('0x1a'),_0x2aef1d,_0xcca2c1['error'][_0x2d3c('0x1b')]);return _0x3000f6(_0xcca2c1[_0x2d3c('0x18')][_0x2d3c('0x1b')]);}logger[_0x2d3c('0x18')](_0x2d3c('0x1a'),_0x2aef1d,_0xcca2c1['error'][_0x2d3c('0x1b')]);return _0x3db42b(_0xcca2c1[_0x2d3c('0x18')][_0x2d3c('0x1b')]);}else{logger['info'](_0x2d3c('0x1a'),_0x2aef1d,_0x2d3c('0x15'));_0x3db42b(_0xcca2c1[_0x2d3c('0x1c')]['message']);}})[_0x2d3c('0x1d')](function(_0x8679b8){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x2aef1d,_0x8679b8);_0x3000f6(_0x8679b8);});});}exports[_0x2d3c('0x1e')]=function(_0x1089e9){var _0x5139e2=this;return new Promise(function(_0x500147,_0x251f77){return db[_0x2d3c('0x1f')][_0x2d3c('0x20')](_0x1089e9[_0x2d3c('0x21')],{'raw':_0x1089e9['options']?_0x1089e9[_0x2d3c('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1089e9['options']?_0x1089e9[_0x2d3c('0x22')][_0x2d3c('0x23')]||null:null,'attributes':_0x1089e9[_0x2d3c('0x22')]?_0x1089e9[_0x2d3c('0x22')][_0x2d3c('0x24')]||null:null,'limit':_0x1089e9[_0x2d3c('0x22')]?_0x1089e9[_0x2d3c('0x22')]['limit']||null:null})[_0x2d3c('0x13')](function(_0x598158){logger[_0x2d3c('0x14')](_0x2d3c('0x1e'),_0x1089e9);logger[_0x2d3c('0x16')](_0x2d3c('0x1e'),_0x1089e9,JSON[_0x2d3c('0x17')](_0x598158));_0x500147(_0x598158);})[_0x2d3c('0x1d')](function(_0x44c0b8){logger['error'](_0x2d3c('0x1e'),_0x44c0b8['message'],_0x1089e9);_0x251f77(_0x5139e2[_0x2d3c('0x18')](0x1f4,_0x44c0b8[_0x2d3c('0x1b')]));});});};exports[_0x2d3c('0x25')]=function(_0xe4bcac){return new Promise(function(_0x30742d,_0x1040c8){return db[_0x2d3c('0x1f')][_0x2d3c('0x26')]({'where':_0xe4bcac['options']?_0xe4bcac['options']['where']||null:null})[_0x2d3c('0x13')](function(_0x3ae910){if(_0x3ae910){return _0x3ae910[_0x2d3c('0x27')](_0xe4bcac[_0x2d3c('0x21')][_0x2d3c('0x28')],_[_0x2d3c('0x29')](_0xe4bcac[_0x2d3c('0x21')],[_0x2d3c('0x28'),'id'])||{});}})['spread'](function(_0xd0ae7f){logger['info'](_0x2d3c('0x2a'),_0xe4bcac);logger[_0x2d3c('0x16')](_0x2d3c('0x2a'),_0xe4bcac,JSON['stringify'](_0xd0ae7f));_0x30742d(_0xd0ae7f);})['catch'](function(_0x27e9f6){logger[_0x2d3c('0x18')](_0x2d3c('0x2a'),_0x27e9f6[_0x2d3c('0x1b')],_0xe4bcac);_0x1040c8(_this[_0x2d3c('0x18')](0x1f4,_0x27e9f6['message']));});});}; \ No newline at end of file +var _0x07e3=['AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x07e3,0x189));var _0x307e=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0x07e3[_0x4d180c];return _0x49b57e;};'use strict';var _=require(_0x307e('0x0'));var util=require(_0x307e('0x1'));var moment=require(_0x307e('0x2'));var BPromise=require('bluebird');var rs=require(_0x307e('0x3'));var fs=require('fs');var Redis=require(_0x307e('0x4'));var db=require(_0x307e('0x5'))['db'];var utils=require(_0x307e('0x6'));var logger=require('../../config/logger')(_0x307e('0x7'));var config=require(_0x307e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x307e('0x9')][_0x307e('0xa')]({'port':0x232a});config[_0x307e('0xb')]=_[_0x307e('0xc')](config[_0x307e('0xb')],{'host':_0x307e('0xd'),'port':0x18eb});var socket=require(_0x307e('0xe'))(new Redis(config[_0x307e('0xb')]));require(_0x307e('0xf'))[_0x307e('0x10')](socket);function respondWithRpcPromise(_0x2ef929,_0x105135,_0x23934c){return new BPromise(function(_0x2e1ee8,_0xd6507b){return client[_0x307e('0x11')](_0x2ef929,_0x23934c)[_0x307e('0x12')](function(_0x2bdd88){logger[_0x307e('0x13')](_0x307e('0x14'),_0x105135,_0x307e('0x15'));logger[_0x307e('0x16')](_0x307e('0x17'),_0x105135,'request\x20sent',JSON[_0x307e('0x18')](_0x2bdd88));if(_0x2bdd88['error']){if(_0x2bdd88[_0x307e('0x19')]['code']===0x1f4){logger['error'](_0x307e('0x14'),_0x105135,_0x2bdd88[_0x307e('0x19')]['message']);return _0xd6507b(_0x2bdd88[_0x307e('0x19')][_0x307e('0x1a')]);}logger[_0x307e('0x19')](_0x307e('0x14'),_0x105135,_0x2bdd88[_0x307e('0x19')][_0x307e('0x1a')]);return _0x2e1ee8(_0x2bdd88[_0x307e('0x19')]['message']);}else{logger[_0x307e('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x105135,_0x307e('0x15'));_0x2e1ee8(_0x2bdd88[_0x307e('0x1b')][_0x307e('0x1a')]);}})[_0x307e('0x1c')](function(_0x5db476){logger[_0x307e('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x105135,_0x5db476);_0xd6507b(_0x5db476);});});}exports[_0x307e('0x1d')]=function(_0x3b4b42){var _0x537fa3=this;return new Promise(function(_0x552df5,_0x487532){return db[_0x307e('0x1e')][_0x307e('0x1f')](_0x3b4b42[_0x307e('0x20')],{'raw':_0x3b4b42[_0x307e('0x21')]?_0x3b4b42[_0x307e('0x21')][_0x307e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b4b42[_0x307e('0x21')]?_0x3b4b42['options'][_0x307e('0x23')]||null:null,'attributes':_0x3b4b42[_0x307e('0x21')]?_0x3b4b42[_0x307e('0x21')][_0x307e('0x24')]||null:null,'limit':_0x3b4b42['options']?_0x3b4b42[_0x307e('0x21')]['limit']||null:null})['then'](function(_0x2f34f1){logger['info'](_0x307e('0x1d'),_0x3b4b42);logger[_0x307e('0x16')](_0x307e('0x1d'),_0x3b4b42,JSON['stringify'](_0x2f34f1));_0x552df5(_0x2f34f1);})[_0x307e('0x1c')](function(_0x547bce){logger[_0x307e('0x19')](_0x307e('0x1d'),_0x547bce[_0x307e('0x1a')],_0x3b4b42);_0x487532(_0x537fa3[_0x307e('0x19')](0x1f4,_0x547bce[_0x307e('0x1a')]));});});};exports[_0x307e('0x25')]=function(_0x586100){return new Promise(function(_0xf5af41,_0x4e5edf){return db['WhatsappInteraction'][_0x307e('0x26')]({'where':_0x586100[_0x307e('0x21')]?_0x586100['options'][_0x307e('0x23')]||null:null})[_0x307e('0x12')](function(_0x237f69){if(_0x237f69){return _0x237f69[_0x307e('0x27')](_0x586100[_0x307e('0x20')]['ids'],_['omit'](_0x586100[_0x307e('0x20')],[_0x307e('0x28'),'id'])||{});}})[_0x307e('0x29')](function(_0x4fa258){logger[_0x307e('0x13')]('AddTags',_0x586100);logger[_0x307e('0x16')](_0x307e('0x2a'),_0x586100,JSON[_0x307e('0x18')](_0x4fa258));_0xf5af41(_0x4fa258);})[_0x307e('0x1c')](function(_0x4be2e2){logger[_0x307e('0x19')]('AddTags',_0x4be2e2[_0x307e('0x1a')],_0x586100);_0x4e5edf(_this[_0x307e('0x19')](0x1f4,_0x4be2e2['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 6076bbb..958ba1d 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.socket.js +++ b/server/api/whatsappInteraction/whatsappInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96e4=['save','remove','removeListener','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x30e6f1,_0x1a21e0){var _0x37a27e=function(_0x27490f){while(--_0x27490f){_0x30e6f1['push'](_0x30e6f1['shift']());}};_0x37a27e(++_0x1a21e0);}(_0x96e4,0xcb));var _0x496e=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0x96e4[_0x254abd];return _0x31bf1b;};'use strict';var WhatsappInteractionEvents=require(_0x496e('0x0'));var events=[_0x496e('0x1'),_0x496e('0x2'),'update'];function createListener(_0x255b0c,_0x2b4081){return function(_0x199058){_0x2b4081['emit'](_0x255b0c,_0x199058);};}function removeListener(_0x336c1e,_0x312abe){return function(){WhatsappInteractionEvents[_0x496e('0x3')](_0x336c1e,_0x312abe);};}exports[_0x496e('0x4')]=function(_0x40782f){for(var _0x3741d0=0x0,_0x3f2d8d=events['length'];_0x3741d0<_0x3f2d8d;_0x3741d0++){var _0x45d332=events[_0x3741d0];var _0x401cc8=createListener(_0x496e('0x5')+_0x45d332,_0x40782f);WhatsappInteractionEvents['on'](_0x45d332,_0x401cc8);}}; \ No newline at end of file +var _0xf5ae=['save','emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0xf5ae,0x179));var _0xef5a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf5ae[_0x59ee6f];return _0x4c0979;};'use strict';var WhatsappInteractionEvents=require(_0xef5a('0x0'));var events=[_0xef5a('0x1'),'remove','update'];function createListener(_0x1ea19a,_0x326a77){return function(_0x3b56cb){_0x326a77[_0xef5a('0x2')](_0x1ea19a,_0x3b56cb);};}function removeListener(_0x3b7e90,_0x5112c8){return function(){WhatsappInteractionEvents[_0xef5a('0x3')](_0x3b7e90,_0x5112c8);};}exports[_0xef5a('0x4')]=function(_0x8c420){for(var _0x5472fc=0x0,_0x6ea091=events['length'];_0x5472fc<_0x6ea091;_0x5472fc++){var _0x67b20b=events[_0x5472fc];var _0x56dda2=createListener(_0xef5a('0x5')+_0x67b20b,_0x8c420);WhatsappInteractionEvents['on'](_0x67b20b,_0x56dda2);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 2c748f0..46377e0 100644 --- a/server/api/whatsappMessage/index.js +++ b/server/api/whatsappMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x348d=['show','post','tracked','create','/:id/status','status','/:id/accept','put','/:id/reject','reject','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x4d2c3f,_0x1d0fc6){var _0x4782a6=function(_0x5517af){while(--_0x5517af){_0x4d2c3f['push'](_0x4d2c3f['shift']());}};_0x4782a6(++_0x1d0fc6);}(_0x348d,0x110));var _0xd348=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x348d[_0x11ce46];return _0x368a1e;};'use strict';var multer=require(_0xd348('0x0'));var util=require(_0xd348('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd348('0x2'));var router=express[_0xd348('0x3')]();var fs_extra=require(_0xd348('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd348('0x5'));var config=require(_0xd348('0x6'));var controller=require(_0xd348('0x7'));router['get']('/',auth[_0xd348('0x8')](),controller[_0xd348('0x9')]);router[_0xd348('0xa')](_0xd348('0xb'),auth[_0xd348('0x8')](),controller[_0xd348('0xc')]);router[_0xd348('0xa')](_0xd348('0xd'),auth[_0xd348('0x8')](),controller[_0xd348('0xe')]);router[_0xd348('0xf')]('/',auth[_0xd348('0x8')](),interaction[_0xd348('0x10')]('whatsapp','whatsappmessage:create'),controller[_0xd348('0x11')]);router[_0xd348('0xf')](_0xd348('0x12'),controller[_0xd348('0x13')]);router['put'](_0xd348('0xd'),auth[_0xd348('0x8')](),controller['update']);router['put'](_0xd348('0x14'),auth[_0xd348('0x8')](),controller['accept']);router[_0xd348('0x15')](_0xd348('0x16'),auth['isAuthenticated'](),controller[_0xd348('0x17')]);router[_0xd348('0x18')](_0xd348('0xd'),auth[_0xd348('0x8')](),controller[_0xd348('0x19')]);module['exports']=router; \ No newline at end of file +var _0x35d0=['./whatsappMessage.controller','isAuthenticated','index','get','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x35d0,0x1c6));var _0x035d=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x35d0[_0xabfec4];return _0x7bafa2;};'use strict';var multer=require(_0x035d('0x0'));var util=require(_0x035d('0x1'));var path=require(_0x035d('0x2'));var timeout=require(_0x035d('0x3'));var express=require(_0x035d('0x4'));var router=express[_0x035d('0x5')]();var fs_extra=require(_0x035d('0x6'));var auth=require(_0x035d('0x7'));var interaction=require(_0x035d('0x8'));var config=require(_0x035d('0x9'));var controller=require(_0x035d('0xa'));router['get']('/',auth[_0x035d('0xb')](),controller[_0x035d('0xc')]);router[_0x035d('0xd')]('/describe',auth[_0x035d('0xb')](),controller[_0x035d('0xe')]);router[_0x035d('0xd')](_0x035d('0xf'),auth[_0x035d('0xb')](),controller[_0x035d('0x10')]);router['post']('/',auth[_0x035d('0xb')](),interaction[_0x035d('0x11')](_0x035d('0x12'),_0x035d('0x13')),controller[_0x035d('0x14')]);router['post'](_0x035d('0x15'),controller['status']);router['put'](_0x035d('0xf'),auth[_0x035d('0xb')](),controller['update']);router[_0x035d('0x16')](_0x035d('0x17'),auth['isAuthenticated'](),controller['accept']);router[_0x035d('0x16')](_0x035d('0x18'),auth[_0x035d('0xb')](),controller[_0x035d('0x19')]);router[_0x035d('0x1a')]('/:id',auth[_0x035d('0xb')](),controller[_0x035d('0x1b')]);module[_0x035d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f54ee5a..697d01b 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacd0=['TEXT','BOOLEAN','out','STRING','DATE','sequelize','exports'];(function(_0x5f1d32,_0x47d03f){var _0x49145a=function(_0x5744b1){while(--_0x5744b1){_0x5f1d32['push'](_0x5f1d32['shift']());}};_0x49145a(++_0x47d03f);}(_0xacd0,0xc9));var _0x0acd=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0xacd0[_0x5cca9f];return _0x55edda;};'use strict';var Sequelize=require(_0x0acd('0x0'));module[_0x0acd('0x1')]={'body':{'type':Sequelize[_0x0acd('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0acd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0acd('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x0acd('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0acd('0x6')]},'secret':{'type':Sequelize[_0x0acd('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0acd('0x5')]},'providerResponse':{'type':Sequelize[_0x0acd('0x2')]}}; \ No newline at end of file +var _0x3e2a=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x565d0a,_0x4927cc){var _0x24c211=function(_0x18ae2b){while(--_0x18ae2b){_0x565d0a['push'](_0x565d0a['shift']());}};_0x24c211(++_0x4927cc);}(_0x3e2a,0xa0));var _0xa3e2=function(_0x2bc37e,_0x15afa3){_0x2bc37e=_0x2bc37e-0x0;var _0x32795b=_0x3e2a[_0x2bc37e];return _0x32795b;};'use strict';var Sequelize=require('sequelize');module[_0xa3e2('0x0')]={'body':{'type':Sequelize[_0xa3e2('0x1')](_0xa3e2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa3e2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa3e2('0x4')]('in',_0xa3e2('0x5')),'defaultValue':_0xa3e2('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa3e2('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa3e2('0x7')]},'secret':{'type':Sequelize[_0xa3e2('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa3e2('0x6')]},'providerResponse':{'type':Sequelize[_0xa3e2('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ca70926..ade59bd 100644 --- a/server/api/whatsappMessage/whatsappMessage.controller.js +++ b/server/api/whatsappMessage/whatsappMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5ba=['include','findAll','rows','show','params','keys','options','catch','create','body','update','find','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','WhatsappInteraction','WhatsappInteractionId','isNil','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','reject','WhatsappAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','sendStatus','end','status','undefined','limit','offset','set','Content-Range','apply','save','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll'];(function(_0x356e17,_0xaf1238){var _0x5cac4f=function(_0x603d61){while(--_0x603d61){_0x356e17['push'](_0x356e17['shift']());}};_0x5cac4f(++_0xaf1238);}(_0xc5ba,0xc7));var _0xac5b=function(_0x55cb9f,_0x64654d){_0x55cb9f=_0x55cb9f-0x0;var _0x272a75=_0xc5ba[_0x55cb9f];return _0x272a75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac5b('0x0'));var zipdir=require(_0xac5b('0x1'));var jsonpatch=require(_0xac5b('0x2'));var rp=require(_0xac5b('0x3'));var moment=require(_0xac5b('0x4'));var BPromise=require(_0xac5b('0x5'));var Mustache=require('mustache');var util=require(_0xac5b('0x6'));var path=require(_0xac5b('0x7'));var sox=require(_0xac5b('0x8'));var csv=require(_0xac5b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac5b('0xa'));var _=require(_0xac5b('0xb'));var squel=require(_0xac5b('0xc'));var crypto=require(_0xac5b('0xd'));var jsforce=require(_0xac5b('0xe'));var deskjs=require(_0xac5b('0xf'));var toCsv=require(_0xac5b('0x9'));var querystring=require(_0xac5b('0x10'));var Papa=require(_0xac5b('0x11'));var Redis=require('ioredis');var authService=require(_0xac5b('0x12'));var qs=require(_0xac5b('0x13'));var as=require(_0xac5b('0x14'));var hardwareService=require(_0xac5b('0x15'));var logger=require('../../config/logger')(_0xac5b('0x16'));var utils=require(_0xac5b('0x17'));var config=require(_0xac5b('0x18'));var licenseUtil=require(_0xac5b('0x19'));var db=require(_0xac5b('0x1a'))['db'];config[_0xac5b('0x1b')]=_['defaults'](config[_0xac5b('0x1b')],{'host':_0xac5b('0x1c'),'port':0x18eb});var socket=require(_0xac5b('0x1d'))(new Redis(config[_0xac5b('0x1b')]));require(_0xac5b('0x1e'))[_0xac5b('0x1f')](socket);var jayson=require(_0xac5b('0x20'));var client=jayson[_0xac5b('0x21')][_0xac5b('0x22')]({'port':0x232c});var client9002=jayson[_0xac5b('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44228e,_0x11c9aa,_0x43dbd7,_0xed76f7){return new BPromise(function(_0x47065f,_0x1b0955){var _0x7bc226=_0xed76f7||client;return _0x7bc226['request'](_0x44228e,_0x43dbd7)[_0xac5b('0x23')](function(_0x42e4b8){logger[_0xac5b('0x24')](_0xac5b('0x25'),_0x11c9aa,_0xac5b('0x26'));logger[_0xac5b('0x27')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x11c9aa,_0xac5b('0x26'),JSON['stringify'](_0x42e4b8));if(_0x42e4b8[_0xac5b('0x28')]){if(_0x42e4b8['error']['code']===0x1f4){logger[_0xac5b('0x28')](_0xac5b('0x25'),_0x11c9aa,_0x42e4b8[_0xac5b('0x28')][_0xac5b('0x29')]);return _0x1b0955(_0x42e4b8[_0xac5b('0x28')][_0xac5b('0x29')]);}logger[_0xac5b('0x28')](_0xac5b('0x25'),_0x11c9aa,_0x42e4b8[_0xac5b('0x28')][_0xac5b('0x29')]);return _0x47065f(_0x42e4b8[_0xac5b('0x28')]['message']);}else{logger[_0xac5b('0x24')](_0xac5b('0x25'),_0x11c9aa,_0xac5b('0x26'));_0x47065f(_0x42e4b8[_0xac5b('0x2a')]['message']);}})['catch'](function(_0x1afcbe){logger[_0xac5b('0x28')](_0xac5b('0x25'),_0x11c9aa,_0x1afcbe);_0x1b0955(_0x1afcbe);});});}function respondWithStatusCode(_0x5eab1e,_0x30921d){_0x30921d=_0x30921d||0xcc;return function(_0x34f4ac){if(_0x34f4ac){return _0x5eab1e[_0xac5b('0x2b')](_0x30921d);}return _0x5eab1e['status'](_0x30921d)[_0xac5b('0x2c')]();};}function respondWithResult(_0x12994f,_0x3564e0){_0x3564e0=_0x3564e0||0xc8;return function(_0xfebea){if(_0xfebea){return _0x12994f[_0xac5b('0x2d')](_0x3564e0)['json'](_0xfebea);}};}function respondWithFilteredResult(_0x5c181f,_0x543906){return function(_0x370ad1){if(_0x370ad1){var _0x298af8=typeof _0x543906['offset']===_0xac5b('0x2e')&&typeof _0x543906[_0xac5b('0x2f')]===_0xac5b('0x2e');var _0x5359a7=_0x370ad1['count'];var _0x395dde=_0x298af8?0x0:_0x543906['offset'];var _0x116c4c=_0x298af8?_0x370ad1['count']:_0x543906[_0xac5b('0x30')]+_0x543906['limit'];var _0x50903c;if(_0x116c4c>=_0x5359a7){_0x116c4c=_0x5359a7;_0x50903c=0xc8;}else{_0x50903c=0xce;}_0x5c181f['status'](_0x50903c);return _0x5c181f[_0xac5b('0x31')](_0xac5b('0x32'),_0x395dde+'-'+_0x116c4c+'/'+_0x5359a7)['json'](_0x370ad1);}return null;};}function patchUpdates(_0x24f39a){return function(_0x3557ea){try{jsonpatch[_0xac5b('0x33')](_0x3557ea,_0x24f39a,!![]);}catch(_0x41a044){return BPromise['reject'](_0x41a044);}return _0x3557ea[_0xac5b('0x34')]();};}function saveUpdates(_0x1f3453,_0x13464f){return function(_0x369355){if(_0x369355){return _0x369355['update'](_0x1f3453)['then'](function(_0x27bf7f){return _0x27bf7f;});}return null;};}function removeEntity(_0x578bb7,_0x451239){return function(_0x3a84ce){if(_0x3a84ce){return _0x3a84ce[_0xac5b('0x35')]()['then'](function(){_0x578bb7[_0xac5b('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d185,_0x3a8f5a){return function(_0x105993){if(!_0x105993){_0x50d185[_0xac5b('0x2b')](0x194);}return _0x105993;};}function handleError(_0x720ca7,_0x412f08){_0x412f08=_0x412f08||0x1f4;return function(_0x51dad6){logger[_0xac5b('0x28')](_0x51dad6[_0xac5b('0x36')]);if(_0x51dad6[_0xac5b('0x37')]){delete _0x51dad6[_0xac5b('0x37')];}_0x720ca7['status'](_0x412f08)[_0xac5b('0x38')](_0x51dad6);};}exports[_0xac5b('0x39')]=function(_0x374959,_0x318a2d){var _0xaa8312={},_0x458340={},_0x39c842={'count':0x0,'rows':[]};var _0x2d48d7=_[_0xac5b('0x3a')](db[_0xac5b('0x3b')][_0xac5b('0x3c')],function(_0x4b6ed8){return{'name':_0x4b6ed8[_0xac5b('0x3d')],'type':_0x4b6ed8['type']['key']};});_0x458340['model']=_[_0xac5b('0x3a')](_0x2d48d7,_0xac5b('0x37'));_0x458340[_0xac5b('0x3e')]=_['keys'](_0x374959[_0xac5b('0x3e')]);_0x458340[_0xac5b('0x3f')]=_['intersection'](_0x458340[_0xac5b('0x40')],_0x458340[_0xac5b('0x3e')]);_0xaa8312[_0xac5b('0x41')]=_[_0xac5b('0x42')](_0x458340[_0xac5b('0x40')],qs[_0xac5b('0x43')](_0x374959['query'][_0xac5b('0x43')]));_0xaa8312[_0xac5b('0x41')]=_0xaa8312[_0xac5b('0x41')][_0xac5b('0x44')]?_0xaa8312[_0xac5b('0x41')]:_0x458340[_0xac5b('0x40')];if(!_0x374959[_0xac5b('0x3e')][_0xac5b('0x45')](_0xac5b('0x46'))){_0xaa8312[_0xac5b('0x2f')]=qs[_0xac5b('0x2f')](_0x374959['query']['limit']);_0xaa8312['offset']=qs[_0xac5b('0x30')](_0x374959['query']['offset']);}_0xaa8312[_0xac5b('0x47')]=qs['sort'](_0x374959[_0xac5b('0x3e')][_0xac5b('0x48')]);_0xaa8312[_0xac5b('0x49')]=qs['filters'](_[_0xac5b('0x4a')](_0x374959['query'],_0x458340[_0xac5b('0x3f')]),_0x2d48d7);if(_0x374959[_0xac5b('0x3e')][_0xac5b('0x4b')]){_0xaa8312[_0xac5b('0x49')]=_[_0xac5b('0x4c')](_0xaa8312[_0xac5b('0x49')],{'$or':_[_0xac5b('0x3a')](_0x2d48d7,function(_0x32f5d3){if(_0x32f5d3[_0xac5b('0x4d')]!==_0xac5b('0x4e')){var _0x190bf9={};_0x190bf9[_0x32f5d3['name']]={'$like':'%'+_0x374959[_0xac5b('0x3e')]['filter']+'%'};return _0x190bf9;}})});}_0xaa8312=_['merge']({},_0xaa8312,_0x374959['options']);var _0x50a55c={'where':_0xaa8312[_0xac5b('0x49')]};return db[_0xac5b('0x3b')][_0xac5b('0x4f')](_0x50a55c)['then'](function(_0x1693b5){_0x39c842[_0xac5b('0x4f')]=_0x1693b5;if(_0x374959[_0xac5b('0x3e')][_0xac5b('0x50')]){_0xaa8312[_0xac5b('0x51')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xac5b('0x52')](_0xaa8312);})['then'](function(_0x1ac1b8){_0x39c842[_0xac5b('0x53')]=_0x1ac1b8;return _0x39c842;})['then'](respondWithFilteredResult(_0x318a2d,_0xaa8312))['catch'](handleError(_0x318a2d,null));};exports[_0xac5b('0x54')]=function(_0x44728a,_0x3a705e){var _0x15f753={'raw':!![],'where':{'id':_0x44728a[_0xac5b('0x55')]['id']}},_0x10b140={};_0x10b140['model']=_[_0xac5b('0x56')](db['WhatsappMessage'][_0xac5b('0x3c')]);_0x10b140[_0xac5b('0x3e')]=_[_0xac5b('0x56')](_0x44728a[_0xac5b('0x3e')]);_0x10b140[_0xac5b('0x3f')]=_[_0xac5b('0x42')](_0x10b140[_0xac5b('0x40')],_0x10b140[_0xac5b('0x3e')]);_0x15f753['attributes']=_['intersection'](_0x10b140[_0xac5b('0x40')],qs[_0xac5b('0x43')](_0x44728a['query'][_0xac5b('0x43')]));_0x15f753[_0xac5b('0x41')]=_0x15f753[_0xac5b('0x41')][_0xac5b('0x44')]?_0x15f753[_0xac5b('0x41')]:_0x10b140['model'];if(_0x44728a['query'][_0xac5b('0x50')]){_0x15f753['include']=[{'all':!![]}];}_0x15f753=_[_0xac5b('0x4c')]({},_0x15f753,_0x44728a[_0xac5b('0x57')]);return db[_0xac5b('0x3b')]['find'](_0x15f753)['then'](handleEntityNotFound(_0x3a705e,null))[_0xac5b('0x23')](respondWithResult(_0x3a705e,null))[_0xac5b('0x58')](handleError(_0x3a705e,null));};exports[_0xac5b('0x59')]=function(_0x3bd93c,_0x23f783){return db[_0xac5b('0x3b')][_0xac5b('0x59')](_0x3bd93c[_0xac5b('0x5a')],{})[_0xac5b('0x23')](respondWithResult(_0x23f783,0xc9))[_0xac5b('0x58')](handleError(_0x23f783,null));};exports[_0xac5b('0x5b')]=function(_0x1d5e78,_0x5dcc62){if(_0x1d5e78[_0xac5b('0x5a')]['id']){delete _0x1d5e78['body']['id'];}return db['WhatsappMessage'][_0xac5b('0x5c')]({'where':{'id':_0x1d5e78['params']['id']}})[_0xac5b('0x23')](handleEntityNotFound(_0x5dcc62,null))[_0xac5b('0x23')](saveUpdates(_0x1d5e78[_0xac5b('0x5a')],null))['then'](respondWithResult(_0x5dcc62,null))[_0xac5b('0x58')](handleError(_0x5dcc62,null));};exports['destroy']=function(_0x5b886f,_0x533d6b){return db[_0xac5b('0x3b')][_0xac5b('0x5c')]({'where':{'id':_0x5b886f[_0xac5b('0x55')]['id']}})[_0xac5b('0x23')](handleEntityNotFound(_0x533d6b,null))[_0xac5b('0x23')](removeEntity(_0x533d6b,null))[_0xac5b('0x58')](handleError(_0x533d6b,null));};exports['describe']=function(_0x5e99c7,_0x2df6a2){return db[_0xac5b('0x3b')]['describe']()[_0xac5b('0x23')](respondWithResult(_0x2df6a2,null))['catch'](handleError(_0x2df6a2,null));};var interaction_log=require(_0xac5b('0x5d'))(_0xac5b('0x5e'));exports[_0xac5b('0x5f')]=function(_0xc3bfe8,_0x3ded1e,_0x481229){var _0x1ec0fa={'agent':{},'channel':_0xac5b('0x60')};if(_0xc3bfe8[_0xac5b('0x5a')]['id']){delete _0xc3bfe8['body']['id'];}_0xc3bfe8[_0xac5b('0x5a')][_0xac5b('0x61')]=!![];_0xc3bfe8['body'][_0xac5b('0x62')]=moment()[_0xac5b('0x63')](_0xac5b('0x64'));_0xc3bfe8[_0xac5b('0x5a')]['UserId']=_0xc3bfe8[_0xac5b('0x5a')][_0xac5b('0x65')]||_0xc3bfe8[_0xac5b('0x66')]['id'];_0x1ec0fa['agent']['id']=_0xc3bfe8['body']['UserId'];return db['WhatsappMessage'][_0xac5b('0x5c')]({'where':{'id':_0xc3bfe8['params']['id'],'UserId':null}})[_0xac5b('0x23')](handleEntityNotFound(_0x3ded1e,null))[_0xac5b('0x23')](saveUpdates(_0xc3bfe8[_0xac5b('0x5a')],null))[_0xac5b('0x23')](function(_0x317b94){if(_0x317b94){_0x1ec0fa['message']=_0x317b94['get']({'plain':!![]});return db[_0xac5b('0x67')][_0xac5b('0x5c')]({'where':{'id':_0x317b94[_0xac5b('0x68')]}});}return null;})[_0xac5b('0x23')](handleEntityNotFound(_0x3ded1e,null))[_0xac5b('0x23')](function(_0x192acb){if(_0x192acb){return _0x192acb[_0xac5b('0x5b')]({'UserId':_0xc3bfe8[_0xac5b('0x5a')][_0xac5b('0x65')],'read1stAt':_[_0xac5b('0x69')](_0x192acb['read1stAt'])?moment()[_0xac5b('0x63')](_0xac5b('0x64')):undefined});}return null;})[_0xac5b('0x23')](function(_0x1fbfe3){if(_0x1fbfe3){_0x1ec0fa['interaction']=_0x1fbfe3['get']({'plain':!![]});interaction_log[_0xac5b('0x24')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xc3bfe8[_0xac5b('0x66')]['id'],_0xc3bfe8[_0xac5b('0x66')][_0xac5b('0x37')],_0xc3bfe8[_0xac5b('0x66')][_0xac5b('0x6a')],_0x1ec0fa['interaction']['id'],_0xc3bfe8[_0xac5b('0x5a')]?JSON[_0xac5b('0x6b')](_0xc3bfe8[_0xac5b('0x5a')]):_0xac5b('0x6c'));return respondWithRpcPromise(_0xac5b('0x6d'),_0xac5b('0x6e'),_0x1ec0fa);}return null;})['then'](function(_0x33713d){var _0x17ea4d=_0xac5b('0x6f')+_0x33713d[_0xac5b('0x29')][_0xac5b('0x70')];return db[_0xac5b('0x71')]['query'](_0x17ea4d,{'type':db[_0xac5b('0x72')][_0xac5b('0x73')]['SELECT'],'raw':!![]})[_0xac5b('0x23')](function(_0x21593e){return _0x21593e;});})[_0xac5b('0x23')](function(_0x1b5f34){if(_0x1b5f34){_0x1ec0fa[_0xac5b('0x29')]['contact']=_0x1b5f34[0x0];if(!_0xc3bfe8[_0xac5b('0x5a')][_0xac5b('0x65')])return;return db[_0xac5b('0x74')][_0xac5b('0x5c')]({'where':{'id':_0xc3bfe8[_0xac5b('0x5a')][_0xac5b('0x65')],'role':_0xac5b('0x75')},'attributes':['id',_0xac5b('0x37'),_0xac5b('0x76'),_0xac5b('0x77'),_0xac5b('0x78')],'raw':!![]});}return null;})[_0xac5b('0x23')](function(_0x33bee1){if(!_0x33bee1)return null;_0x1ec0fa[_0xac5b('0x29')]['agent']=_0x33bee1;return _0x1ec0fa;})[_0xac5b('0x23')](function(_0x3d2a21){if(_0x3d2a21){if(_0xc3bfe8[_0xac5b('0x5a')][_0xac5b('0x79')]){_0x1ec0fa[_0xac5b('0x29')][_0xac5b('0x7a')]=util[_0xac5b('0x63')](_0xac5b('0x7b'),_0xc3bfe8[_0xac5b('0x66')][_0xac5b('0x37')]);_0x1ec0fa[_0xac5b('0x29')][_0xac5b('0x7c')]=_0x1ec0fa[_0xac5b('0x7c')];_0x1ec0fa[_0xac5b('0x29')][_0xac5b('0x7d')]=_0x1ec0fa[_0xac5b('0x7c')];_0x1ec0fa[_0xac5b('0x29')][_0xac5b('0x7e')]=_0xac5b('0x5f');return respondWithRpcPromise(_0xac5b('0x7f'),_0xac5b('0x7f'),{'event':_0xac5b('0x80'),'message':_0x1ec0fa[_0xac5b('0x29')]},client9002)['then'](function(){return _0x1ec0fa;});}return _0x1ec0fa;}return null;})['then'](respondWithResult(_0x3ded1e,null))['catch'](handleError(_0x3ded1e,null));};var interaction_log=require('../../config/logger')(_0xac5b('0x5e'));exports['reject']=function(_0x980f09,_0x78efa1,_0x9d6cb3){var _0x5e1e52={'agent':{},'channel':_0xac5b('0x60')};if(_0x980f09[_0xac5b('0x5a')]['id']){delete _0x980f09[_0xac5b('0x5a')]['id'];}_0x980f09['body'][_0xac5b('0x65')]=_0x980f09[_0xac5b('0x5a')][_0xac5b('0x65')]||_0x980f09[_0xac5b('0x66')]['id'];_0x5e1e52[_0xac5b('0x75')]['id']=_0x980f09[_0xac5b('0x5a')][_0xac5b('0x65')];return db[_0xac5b('0x3b')]['find']({'where':{'id':_0x980f09[_0xac5b('0x55')]['id'],'UserId':null}})[_0xac5b('0x23')](handleEntityNotFound(_0x78efa1,null))[_0xac5b('0x23')](function(_0x2bfc4d){if(_0x2bfc4d){_0x5e1e52[_0xac5b('0x29')]=_0x2bfc4d[_0xac5b('0x81')]({'plain':!![]});return db[_0xac5b('0x67')]['find']({'where':{'id':_0x2bfc4d[_0xac5b('0x68')]}});}return null;})[_0xac5b('0x23')](handleEntityNotFound(_0x78efa1,null))[_0xac5b('0x23')](function(_0x1b5112){if(_0x1b5112){_0x5e1e52['interaction']=_0x1b5112[_0xac5b('0x81')]({'plain':!![]});interaction_log[_0xac5b('0x24')](_0xac5b('0x82'),_0x980f09[_0xac5b('0x66')]['id'],_0x980f09[_0xac5b('0x66')][_0xac5b('0x37')],_0x980f09[_0xac5b('0x66')][_0xac5b('0x6a')],_0x5e1e52['interaction']['id'],_0x980f09['body']?JSON[_0xac5b('0x6b')](_0x980f09['body']):_0xac5b('0x6c'));return respondWithRpcPromise('RejectMessage',_0xac5b('0x83'),_0x5e1e52);}return null;})[_0xac5b('0x23')](function(_0x4f4ede){var _0x5f4f29=_0xac5b('0x6f')+_0x4f4ede['message'][_0xac5b('0x70')];return db[_0xac5b('0x71')]['query'](_0x5f4f29,{'type':db['Sequelize'][_0xac5b('0x73')]['SELECT'],'raw':!![]})['then'](function(_0x22815e){return _0x22815e;});})[_0xac5b('0x23')](function(_0x195310){if(_0x195310){_0x5e1e52[_0xac5b('0x29')]['contact']=_0x195310[0x0];if(!_0x980f09[_0xac5b('0x5a')][_0xac5b('0x65')])return;return db['User'][_0xac5b('0x5c')]({'where':{'id':_0x980f09[_0xac5b('0x5a')][_0xac5b('0x65')],'role':_0xac5b('0x75')},'attributes':['id','name','fullname',_0xac5b('0x77'),_0xac5b('0x78')],'raw':!![]});}return null;})['then'](function(_0x527fbb){if(!_0x527fbb)return null;_0x5e1e52[_0xac5b('0x29')][_0xac5b('0x75')]=_0x527fbb;return _0x5e1e52;})['then'](function(_0x3b4069){if(_0x3b4069){_0x3b4069[_0xac5b('0x29')][_0xac5b('0x7a')]=util[_0xac5b('0x63')](_0xac5b('0x7b'),_0x980f09[_0xac5b('0x66')]['name']);_0x3b4069[_0xac5b('0x29')][_0xac5b('0x7c')]=_0x5e1e52[_0xac5b('0x7c')];_0x3b4069[_0xac5b('0x29')][_0xac5b('0x7d')]=_0x5e1e52[_0xac5b('0x7c')];_0x3b4069[_0xac5b('0x29')][_0xac5b('0x7e')]=_0xac5b('0x84');respondWithRpcPromise(_0xac5b('0x7f'),_0xac5b('0x7f'),{'event':'rejectmessage','message':_0x3b4069[_0xac5b('0x29')]},client9002);return _0x5e1e52;}return null;})['then'](respondWithResult(_0x78efa1,null))[_0xac5b('0x58')](handleError(_0x78efa1,null));};exports[_0xac5b('0x2d')]=function(_0x589dbb,_0x48ab91,_0x5e4020){if(_0x589dbb[_0xac5b('0x5a')]['id']){delete _0x589dbb[_0xac5b('0x5a')]['id'];}var _0x2f18ee;return db[_0xac5b('0x3b')][_0xac5b('0x5c')]({'where':{'id':_0x589dbb[_0xac5b('0x55')]['id']}})[_0xac5b('0x23')](handleEntityNotFound(_0x48ab91,null))[_0xac5b('0x23')](function(_0xba0399){if(_0xba0399){_0x2f18ee=_0xba0399;return db['WhatsappAccount']['find']({'where':{'id':_0xba0399[_0xac5b('0x85')]}});}})[_0xac5b('0x23')](handleEntityNotFound(_0x48ab91,null))[_0xac5b('0x23')](function(_0x451fae){if(_0x451fae){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0xac5b('0x86'),_0x451fae[_0xac5b('0x4d')],util['inspect'](_0x589dbb[_0xac5b('0x5a')],{'showHidden':![],'depth':null}));switch(_0x451fae[_0xac5b('0x4d')]){case _0xac5b('0x87'):if(_0x589dbb['body'][_0xac5b('0x88')]&&_0x589dbb[_0xac5b('0x5a')][_0xac5b('0x88')]===_0x2f18ee[_0xac5b('0x89')]&&_0x589dbb[_0xac5b('0x5a')][_0xac5b('0x8a')]&&_0x589dbb[_0xac5b('0x5a')][_0xac5b('0x8a')]===_0xac5b('0x61')){return _0x2f18ee['update']({'read':!![]});}else{logger[_0xac5b('0x28')](_0xac5b('0x8b'),'status','twilio',util['inspect'](_0x589dbb[_0xac5b('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2f18ee;}})[_0xac5b('0x23')](respondWithResult(_0x48ab91,null))[_0xac5b('0x58')](handleError(_0x48ab91,null));}; \ No newline at end of file +var _0xfbab=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','Content-Range','apply','reject','save','destroy','sendStatus','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','include','rows','create','body','update','find','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','agent','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','ContactId','Sequelize','SELECT','fullname','internal','event','rejectmessage','WhatsappAccount','WhatsappAccountId','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse'];(function(_0x13b735,_0x321543){var _0x2387f3=function(_0x66bc48){while(--_0x66bc48){_0x13b735['push'](_0x13b735['shift']());}};_0x2387f3(++_0x321543);}(_0xfbab,0x101));var _0xbfba=function(_0x17672f,_0x428ccb){_0x17672f=_0x17672f-0x0;var _0x20b4a6=_0xfbab[_0x17672f];return _0x20b4a6;};'use strict';var emlformat=require(_0xbfba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbfba('0x1'));var jsonpatch=require(_0xbfba('0x2'));var rp=require(_0xbfba('0x3'));var moment=require(_0xbfba('0x4'));var BPromise=require(_0xbfba('0x5'));var Mustache=require(_0xbfba('0x6'));var util=require(_0xbfba('0x7'));var path=require('path');var sox=require(_0xbfba('0x8'));var csv=require(_0xbfba('0x9'));var ejs=require(_0xbfba('0xa'));var fs=require('fs');var fs_extra=require(_0xbfba('0xb'));var _=require('lodash');var squel=require(_0xbfba('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbfba('0xd'));var toCsv=require(_0xbfba('0x9'));var querystring=require('querystring');var Papa=require(_0xbfba('0xe'));var Redis=require(_0xbfba('0xf'));var authService=require(_0xbfba('0x10'));var qs=require(_0xbfba('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfba('0x12'));var logger=require(_0xbfba('0x13'))(_0xbfba('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbfba('0x15'));var db=require('../../mysqldb')['db'];config[_0xbfba('0x16')]=_[_0xbfba('0x17')](config[_0xbfba('0x16')],{'host':_0xbfba('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfba('0x16')]));require(_0xbfba('0x19'))[_0xbfba('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbfba('0x1b')][_0xbfba('0x1c')]({'port':0x232c});var client9002=jayson[_0xbfba('0x1b')][_0xbfba('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x52ac0c,_0x2ff195,_0xc7e367,_0x5edffd){return new BPromise(function(_0x3c95b9,_0x22b40a){var _0x316e88=_0x5edffd||client;return _0x316e88[_0xbfba('0x1d')](_0x52ac0c,_0xc7e367)[_0xbfba('0x1e')](function(_0x275e04){logger[_0xbfba('0x1f')](_0xbfba('0x20'),_0x2ff195,'request\x20sent');logger[_0xbfba('0x21')](_0xbfba('0x22'),_0x2ff195,_0xbfba('0x23'),JSON[_0xbfba('0x24')](_0x275e04));if(_0x275e04[_0xbfba('0x25')]){if(_0x275e04[_0xbfba('0x25')][_0xbfba('0x26')]===0x1f4){logger[_0xbfba('0x25')](_0xbfba('0x20'),_0x2ff195,_0x275e04[_0xbfba('0x25')][_0xbfba('0x27')]);return _0x22b40a(_0x275e04['error'][_0xbfba('0x27')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2ff195,_0x275e04[_0xbfba('0x25')][_0xbfba('0x27')]);return _0x3c95b9(_0x275e04[_0xbfba('0x25')][_0xbfba('0x27')]);}else{logger[_0xbfba('0x1f')](_0xbfba('0x20'),_0x2ff195,'request\x20sent');_0x3c95b9(_0x275e04[_0xbfba('0x28')][_0xbfba('0x27')]);}})[_0xbfba('0x29')](function(_0x110ec5){logger[_0xbfba('0x25')](_0xbfba('0x20'),_0x2ff195,_0x110ec5);_0x22b40a(_0x110ec5);});});}function respondWithStatusCode(_0x6a673b,_0xd58a64){_0xd58a64=_0xd58a64||0xcc;return function(_0x24950f){if(_0x24950f){return _0x6a673b['sendStatus'](_0xd58a64);}return _0x6a673b[_0xbfba('0x2a')](_0xd58a64)[_0xbfba('0x2b')]();};}function respondWithResult(_0x377b1d,_0x4245b0){_0x4245b0=_0x4245b0||0xc8;return function(_0x3d8274){if(_0x3d8274){return _0x377b1d['status'](_0x4245b0)[_0xbfba('0x2c')](_0x3d8274);}};}function respondWithFilteredResult(_0x461e6e,_0x4f08c9){return function(_0x2176c4){if(_0x2176c4){var _0x2568ce=typeof _0x4f08c9[_0xbfba('0x2d')]==='undefined'&&typeof _0x4f08c9[_0xbfba('0x2e')]==='undefined';var _0x184321=_0x2176c4[_0xbfba('0x2f')];var _0x23148a=_0x2568ce?0x0:_0x4f08c9['offset'];var _0x171c42=_0x2568ce?_0x2176c4[_0xbfba('0x2f')]:_0x4f08c9[_0xbfba('0x2d')]+_0x4f08c9[_0xbfba('0x2e')];var _0x1340c8;if(_0x171c42>=_0x184321){_0x171c42=_0x184321;_0x1340c8=0xc8;}else{_0x1340c8=0xce;}_0x461e6e[_0xbfba('0x2a')](_0x1340c8);return _0x461e6e['set'](_0xbfba('0x30'),_0x23148a+'-'+_0x171c42+'/'+_0x184321)['json'](_0x2176c4);}return null;};}function patchUpdates(_0x3b12c3){return function(_0x30bfe9){try{jsonpatch[_0xbfba('0x31')](_0x30bfe9,_0x3b12c3,!![]);}catch(_0x23fd97){return BPromise[_0xbfba('0x32')](_0x23fd97);}return _0x30bfe9[_0xbfba('0x33')]();};}function saveUpdates(_0x1b98b6,_0x343e8e){return function(_0x33098e){if(_0x33098e){return _0x33098e['update'](_0x1b98b6)['then'](function(_0xe32981){return _0xe32981;});}return null;};}function removeEntity(_0x4a5fe7,_0x37ef3d){return function(_0x65b453){if(_0x65b453){return _0x65b453[_0xbfba('0x34')]()[_0xbfba('0x1e')](function(){_0x4a5fe7[_0xbfba('0x2a')](0xcc)[_0xbfba('0x2b')]();});}};}function handleEntityNotFound(_0x228230,_0x1fb627){return function(_0x21ba4d){if(!_0x21ba4d){_0x228230[_0xbfba('0x35')](0x194);}return _0x21ba4d;};}function handleError(_0x308245,_0x3177e8){_0x3177e8=_0x3177e8||0x1f4;return function(_0x13e902){logger[_0xbfba('0x25')](_0x13e902['stack']);if(_0x13e902[_0xbfba('0x36')]){delete _0x13e902[_0xbfba('0x36')];}_0x308245[_0xbfba('0x2a')](_0x3177e8)[_0xbfba('0x37')](_0x13e902);};}exports[_0xbfba('0x38')]=function(_0x5cd8a3,_0x1d4e83){var _0x363934={},_0x39172c={},_0x52c89a={'count':0x0,'rows':[]};var _0x176a6d=_[_0xbfba('0x39')](db[_0xbfba('0x3a')][_0xbfba('0x3b')],function(_0x4f8e2c){return{'name':_0x4f8e2c[_0xbfba('0x3c')],'type':_0x4f8e2c['type'][_0xbfba('0x3d')]};});_0x39172c[_0xbfba('0x3e')]=_[_0xbfba('0x39')](_0x176a6d,_0xbfba('0x36'));_0x39172c[_0xbfba('0x3f')]=_[_0xbfba('0x40')](_0x5cd8a3[_0xbfba('0x3f')]);_0x39172c[_0xbfba('0x41')]=_['intersection'](_0x39172c[_0xbfba('0x3e')],_0x39172c[_0xbfba('0x3f')]);_0x363934[_0xbfba('0x42')]=_[_0xbfba('0x43')](_0x39172c[_0xbfba('0x3e')],qs[_0xbfba('0x44')](_0x5cd8a3[_0xbfba('0x3f')][_0xbfba('0x44')]));_0x363934['attributes']=_0x363934[_0xbfba('0x42')][_0xbfba('0x45')]?_0x363934[_0xbfba('0x42')]:_0x39172c[_0xbfba('0x3e')];if(!_0x5cd8a3['query'][_0xbfba('0x46')]('nolimit')){_0x363934['limit']=qs[_0xbfba('0x2e')](_0x5cd8a3[_0xbfba('0x3f')]['limit']);_0x363934[_0xbfba('0x2d')]=qs[_0xbfba('0x2d')](_0x5cd8a3[_0xbfba('0x3f')]['offset']);}_0x363934[_0xbfba('0x47')]=qs[_0xbfba('0x48')](_0x5cd8a3['query'][_0xbfba('0x48')]);_0x363934[_0xbfba('0x49')]=qs[_0xbfba('0x41')](_[_0xbfba('0x4a')](_0x5cd8a3['query'],_0x39172c['filters']),_0x176a6d);if(_0x5cd8a3['query']['filter']){_0x363934['where']=_[_0xbfba('0x4b')](_0x363934[_0xbfba('0x49')],{'$or':_[_0xbfba('0x39')](_0x176a6d,function(_0x4144a3){if(_0x4144a3[_0xbfba('0x4c')]!=='VIRTUAL'){var _0x2a4049={};_0x2a4049[_0x4144a3[_0xbfba('0x36')]]={'$like':'%'+_0x5cd8a3['query'][_0xbfba('0x4d')]+'%'};return _0x2a4049;}})});}_0x363934=_[_0xbfba('0x4b')]({},_0x363934,_0x5cd8a3[_0xbfba('0x4e')]);var _0x1a2610={'where':_0x363934[_0xbfba('0x49')]};return db['WhatsappMessage']['count'](_0x1a2610)[_0xbfba('0x1e')](function(_0x33cf45){_0x52c89a[_0xbfba('0x2f')]=_0x33cf45;if(_0x5cd8a3['query']['includeAll']){_0x363934[_0xbfba('0x4f')]=[{'all':!![]}];}return db[_0xbfba('0x3a')]['findAll'](_0x363934);})['then'](function(_0x5d09cc){_0x52c89a[_0xbfba('0x50')]=_0x5d09cc;return _0x52c89a;})[_0xbfba('0x1e')](respondWithFilteredResult(_0x1d4e83,_0x363934))[_0xbfba('0x29')](handleError(_0x1d4e83,null));};exports['show']=function(_0x408fd1,_0x33616a){var _0x5386a2={'raw':!![],'where':{'id':_0x408fd1['params']['id']}},_0x51fac4={};_0x51fac4[_0xbfba('0x3e')]=_[_0xbfba('0x40')](db[_0xbfba('0x3a')][_0xbfba('0x3b')]);_0x51fac4[_0xbfba('0x3f')]=_['keys'](_0x408fd1[_0xbfba('0x3f')]);_0x51fac4['filters']=_[_0xbfba('0x43')](_0x51fac4[_0xbfba('0x3e')],_0x51fac4[_0xbfba('0x3f')]);_0x5386a2[_0xbfba('0x42')]=_[_0xbfba('0x43')](_0x51fac4[_0xbfba('0x3e')],qs['fields'](_0x408fd1['query'][_0xbfba('0x44')]));_0x5386a2[_0xbfba('0x42')]=_0x5386a2[_0xbfba('0x42')][_0xbfba('0x45')]?_0x5386a2[_0xbfba('0x42')]:_0x51fac4[_0xbfba('0x3e')];if(_0x408fd1['query']['includeAll']){_0x5386a2[_0xbfba('0x4f')]=[{'all':!![]}];}_0x5386a2=_['merge']({},_0x5386a2,_0x408fd1[_0xbfba('0x4e')]);return db['WhatsappMessage']['find'](_0x5386a2)[_0xbfba('0x1e')](handleEntityNotFound(_0x33616a,null))[_0xbfba('0x1e')](respondWithResult(_0x33616a,null))[_0xbfba('0x29')](handleError(_0x33616a,null));};exports[_0xbfba('0x51')]=function(_0x5d2622,_0x3d4485){return db['WhatsappMessage'][_0xbfba('0x51')](_0x5d2622[_0xbfba('0x52')],{})[_0xbfba('0x1e')](respondWithResult(_0x3d4485,0xc9))[_0xbfba('0x29')](handleError(_0x3d4485,null));};exports[_0xbfba('0x53')]=function(_0x13da94,_0x532ae4){if(_0x13da94[_0xbfba('0x52')]['id']){delete _0x13da94[_0xbfba('0x52')]['id'];}return db[_0xbfba('0x3a')][_0xbfba('0x54')]({'where':{'id':_0x13da94[_0xbfba('0x55')]['id']}})[_0xbfba('0x1e')](handleEntityNotFound(_0x532ae4,null))[_0xbfba('0x1e')](saveUpdates(_0x13da94['body'],null))[_0xbfba('0x1e')](respondWithResult(_0x532ae4,null))[_0xbfba('0x29')](handleError(_0x532ae4,null));};exports[_0xbfba('0x34')]=function(_0x52d253,_0x52b5df){return db['WhatsappMessage'][_0xbfba('0x54')]({'where':{'id':_0x52d253[_0xbfba('0x55')]['id']}})['then'](handleEntityNotFound(_0x52b5df,null))['then'](removeEntity(_0x52b5df,null))[_0xbfba('0x29')](handleError(_0x52b5df,null));};exports[_0xbfba('0x56')]=function(_0x48645d,_0x2f0173){return db['WhatsappMessage'][_0xbfba('0x56')]()[_0xbfba('0x1e')](respondWithResult(_0x2f0173,null))[_0xbfba('0x29')](handleError(_0x2f0173,null));};var interaction_log=require(_0xbfba('0x13'))(_0xbfba('0x57'));exports[_0xbfba('0x58')]=function(_0x9145ef,_0x16719f,_0x5542b5){var _0x31bef={'agent':{},'channel':_0xbfba('0x59')};if(_0x9145ef[_0xbfba('0x52')]['id']){delete _0x9145ef['body']['id'];}_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5a')]=!![];_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5b')]=moment()['format'](_0xbfba('0x5c'));_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5d')]=_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5d')]||_0x9145ef[_0xbfba('0x5e')]['id'];_0x31bef['agent']['id']=_0x9145ef[_0xbfba('0x52')]['UserId'];return db[_0xbfba('0x3a')][_0xbfba('0x54')]({'where':{'id':_0x9145ef[_0xbfba('0x55')]['id'],'UserId':null}})[_0xbfba('0x1e')](handleEntityNotFound(_0x16719f,null))[_0xbfba('0x1e')](saveUpdates(_0x9145ef[_0xbfba('0x52')],null))[_0xbfba('0x1e')](function(_0x5e0b51){if(_0x5e0b51){_0x31bef[_0xbfba('0x27')]=_0x5e0b51[_0xbfba('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0xbfba('0x54')]({'where':{'id':_0x5e0b51[_0xbfba('0x60')]}});}return null;})[_0xbfba('0x1e')](handleEntityNotFound(_0x16719f,null))['then'](function(_0x1d74c1){if(_0x1d74c1){return _0x1d74c1[_0xbfba('0x53')]({'UserId':_0x9145ef[_0xbfba('0x52')]['UserId'],'read1stAt':_[_0xbfba('0x61')](_0x1d74c1[_0xbfba('0x62')])?moment()[_0xbfba('0x63')](_0xbfba('0x5c')):undefined});}return null;})[_0xbfba('0x1e')](function(_0x5504ca){if(_0x5504ca){_0x31bef['interaction']=_0x5504ca[_0xbfba('0x5f')]({'plain':!![]});interaction_log[_0xbfba('0x1f')](_0xbfba('0x64'),_0x9145ef[_0xbfba('0x5e')]['id'],_0x9145ef[_0xbfba('0x5e')][_0xbfba('0x36')],_0x9145ef['user']['role'],_0x31bef[_0xbfba('0x65')]['id'],_0x9145ef['body']?JSON[_0xbfba('0x24')](_0x9145ef['body']):_0xbfba('0x66'));return respondWithRpcPromise(_0xbfba('0x67'),_0xbfba('0x68'),_0x31bef);}return null;})[_0xbfba('0x1e')](function(_0x1f6e88){var _0x3f74f9=_0xbfba('0x69')+_0x1f6e88[_0xbfba('0x27')]['ContactId'];return db[_0xbfba('0x6a')]['query'](_0x3f74f9,{'type':db['Sequelize'][_0xbfba('0x6b')]['SELECT'],'raw':!![]})['then'](function(_0x455177){return _0x455177;});})[_0xbfba('0x1e')](function(_0x5bca2c){if(_0x5bca2c){_0x31bef['message'][_0xbfba('0x6c')]=_0x5bca2c[0x0];if(!_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5d')])return;return db[_0xbfba('0x6d')][_0xbfba('0x54')]({'where':{'id':_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5d')],'role':_0xbfba('0x6e')},'attributes':['id',_0xbfba('0x36'),'fullname',_0xbfba('0x6f'),'internal'],'raw':!![]});}return null;})[_0xbfba('0x1e')](function(_0x44c792){if(!_0x44c792)return null;_0x31bef[_0xbfba('0x27')][_0xbfba('0x6e')]=_0x44c792;return _0x31bef;})[_0xbfba('0x1e')](function(_0x897e37){if(_0x897e37){if(_0x9145ef[_0xbfba('0x52')][_0xbfba('0x70')]){_0x31bef[_0xbfba('0x27')][_0xbfba('0x71')]=util[_0xbfba('0x63')](_0xbfba('0x72'),_0x9145ef['user'][_0xbfba('0x36')]);_0x31bef['message'][_0xbfba('0x73')]=_0x31bef[_0xbfba('0x73')];_0x31bef[_0xbfba('0x27')][_0xbfba('0x74')]=_0x31bef[_0xbfba('0x73')];_0x31bef[_0xbfba('0x27')]['event']='accept';return respondWithRpcPromise(_0xbfba('0x75'),_0xbfba('0x75'),{'event':_0xbfba('0x76'),'message':_0x31bef[_0xbfba('0x27')]},client9002)[_0xbfba('0x1e')](function(){return _0x31bef;});}return _0x31bef;}return null;})[_0xbfba('0x1e')](respondWithResult(_0x16719f,null))['catch'](handleError(_0x16719f,null));};var interaction_log=require('../../config/logger')(_0xbfba('0x57'));exports[_0xbfba('0x32')]=function(_0x4dcced,_0x222f40,_0x2128af){var _0x2d3c0a={'agent':{},'channel':_0xbfba('0x59')};if(_0x4dcced[_0xbfba('0x52')]['id']){delete _0x4dcced[_0xbfba('0x52')]['id'];}_0x4dcced[_0xbfba('0x52')][_0xbfba('0x5d')]=_0x4dcced[_0xbfba('0x52')][_0xbfba('0x5d')]||_0x4dcced[_0xbfba('0x5e')]['id'];_0x2d3c0a[_0xbfba('0x6e')]['id']=_0x4dcced[_0xbfba('0x52')][_0xbfba('0x5d')];return db['WhatsappMessage'][_0xbfba('0x54')]({'where':{'id':_0x4dcced['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x222f40,null))['then'](function(_0xad75ab){if(_0xad75ab){_0x2d3c0a[_0xbfba('0x27')]=_0xad75ab[_0xbfba('0x5f')]({'plain':!![]});return db[_0xbfba('0x77')][_0xbfba('0x54')]({'where':{'id':_0xad75ab['WhatsappInteractionId']}});}return null;})[_0xbfba('0x1e')](handleEntityNotFound(_0x222f40,null))[_0xbfba('0x1e')](function(_0x4bf97d){if(_0x4bf97d){_0x2d3c0a['interaction']=_0x4bf97d['get']({'plain':!![]});interaction_log[_0xbfba('0x1f')](_0xbfba('0x78'),_0x4dcced[_0xbfba('0x5e')]['id'],_0x4dcced[_0xbfba('0x5e')][_0xbfba('0x36')],_0x4dcced[_0xbfba('0x5e')][_0xbfba('0x79')],_0x2d3c0a[_0xbfba('0x65')]['id'],_0x4dcced['body']?JSON[_0xbfba('0x24')](_0x4dcced[_0xbfba('0x52')]):_0xbfba('0x66'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x2d3c0a);}return null;})['then'](function(_0x340070){var _0x2d29eb=_0xbfba('0x69')+_0x340070[_0xbfba('0x27')][_0xbfba('0x7a')];return db[_0xbfba('0x6a')][_0xbfba('0x3f')](_0x2d29eb,{'type':db[_0xbfba('0x7b')]['QueryTypes'][_0xbfba('0x7c')],'raw':!![]})[_0xbfba('0x1e')](function(_0x19e1ee){return _0x19e1ee;});})[_0xbfba('0x1e')](function(_0x472593){if(_0x472593){_0x2d3c0a['message'][_0xbfba('0x6c')]=_0x472593[0x0];if(!_0x4dcced[_0xbfba('0x52')][_0xbfba('0x5d')])return;return db[_0xbfba('0x6d')][_0xbfba('0x54')]({'where':{'id':_0x4dcced[_0xbfba('0x52')][_0xbfba('0x5d')],'role':_0xbfba('0x6e')},'attributes':['id',_0xbfba('0x36'),_0xbfba('0x7d'),'email',_0xbfba('0x7e')],'raw':!![]});}return null;})[_0xbfba('0x1e')](function(_0x32240b){if(!_0x32240b)return null;_0x2d3c0a['message'][_0xbfba('0x6e')]=_0x32240b;return _0x2d3c0a;})[_0xbfba('0x1e')](function(_0x2c97e3){if(_0x2c97e3){_0x2c97e3[_0xbfba('0x27')]['interface']=util[_0xbfba('0x63')](_0xbfba('0x72'),_0x4dcced['user'][_0xbfba('0x36')]);_0x2c97e3[_0xbfba('0x27')][_0xbfba('0x73')]=_0x2d3c0a[_0xbfba('0x73')];_0x2c97e3['message'][_0xbfba('0x74')]=_0x2d3c0a[_0xbfba('0x73')];_0x2c97e3[_0xbfba('0x27')][_0xbfba('0x7f')]='reject';respondWithRpcPromise(_0xbfba('0x75'),_0xbfba('0x75'),{'event':_0xbfba('0x80'),'message':_0x2c97e3[_0xbfba('0x27')]},client9002);return _0x2d3c0a;}return null;})['then'](respondWithResult(_0x222f40,null))[_0xbfba('0x29')](handleError(_0x222f40,null));};exports[_0xbfba('0x2a')]=function(_0x224f8d,_0x89358b,_0x55264b){if(_0x224f8d[_0xbfba('0x52')]['id']){delete _0x224f8d['body']['id'];}var _0x167868;return db['WhatsappMessage'][_0xbfba('0x54')]({'where':{'id':_0x224f8d[_0xbfba('0x55')]['id']}})['then'](handleEntityNotFound(_0x89358b,null))[_0xbfba('0x1e')](function(_0x5c6622){if(_0x5c6622){_0x167868=_0x5c6622;return db[_0xbfba('0x81')][_0xbfba('0x54')]({'where':{'id':_0x5c6622[_0xbfba('0x82')]}});}})['then'](handleEntityNotFound(_0x89358b,null))[_0xbfba('0x1e')](function(_0x3ee7bf){if(_0x3ee7bf){logger[_0xbfba('0x21')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xbfba('0x2a'),'received\x20delivery\x20report\x20from',_0x3ee7bf['type'],util[_0xbfba('0x83')](_0x224f8d['body'],{'showHidden':![],'depth':null}));switch(_0x3ee7bf['type']){case _0xbfba('0x84'):if(_0x224f8d[_0xbfba('0x52')][_0xbfba('0x85')]&&_0x224f8d[_0xbfba('0x52')][_0xbfba('0x85')]===_0x167868[_0xbfba('0x86')]&&_0x224f8d[_0xbfba('0x52')]['MessageStatus']&&_0x224f8d[_0xbfba('0x52')][_0xbfba('0x87')]==='read'){return _0x167868[_0xbfba('0x53')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xbfba('0x2a'),_0xbfba('0x84'),util[_0xbfba('0x83')](_0x224f8d[_0xbfba('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x167868;}})[_0xbfba('0x1e')](respondWithResult(_0x89358b,null))[_0xbfba('0x29')](handleError(_0x89358b,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 2896600..7b9d6db 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55f1=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage','setMaxListeners','save','update'];(function(_0x55fd98,_0x534ec9){var _0x4437ac=function(_0x535730){while(--_0x535730){_0x55fd98['push'](_0x55fd98['shift']());}};_0x4437ac(++_0x534ec9);}(_0x55f1,0x9b));var _0x155f=function(_0x40d235,_0x167cdd){_0x40d235=_0x40d235-0x0;var _0x47924e=_0x55f1[_0x40d235];return _0x47924e;};'use strict';var EventEmitter=require(_0x155f('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x155f('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x155f('0x2')](0x0);var events={'afterCreate':_0x155f('0x3'),'afterUpdate':_0x155f('0x4'),'afterDestroy':_0x155f('0x5')};function emitEvent(_0x13e2af){return function(_0x2089cc,_0x5c3d6c,_0x5cd807){WhatsappMessageEvents[_0x155f('0x6')](_0x13e2af+':'+_0x2089cc['id'],_0x2089cc);WhatsappMessageEvents['emit'](_0x13e2af,_0x2089cc);_0x5cd807(null);};}for(var e in events){if(events[_0x155f('0x7')](e)){var event=events[e];WhatsappMessage[_0x155f('0x8')](e,emitEvent(event));}}module[_0x155f('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x55ea=['WhatsappMessage','save','update','remove','exports','events','../../mysqldb'];(function(_0x4bbafa,_0x332ab1){var _0x515407=function(_0x37fd05){while(--_0x37fd05){_0x4bbafa['push'](_0x4bbafa['shift']());}};_0x515407(++_0x332ab1);}(_0x55ea,0xc9));var _0xa55e=function(_0x45b236,_0xb66449){_0x45b236=_0x45b236-0x0;var _0x27fe4f=_0x55ea[_0x45b236];return _0x27fe4f;};'use strict';var EventEmitter=require(_0xa55e('0x0'));var WhatsappMessage=require(_0xa55e('0x1'))['db'][_0xa55e('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa55e('0x3'),'afterUpdate':_0xa55e('0x4'),'afterDestroy':_0xa55e('0x5')};function emitEvent(_0x1325cc){return function(_0x95af3d,_0x54f178,_0x2d1040){WhatsappMessageEvents['emit'](_0x1325cc+':'+_0x95af3d['id'],_0x95af3d);WhatsappMessageEvents['emit'](_0x1325cc,_0x95af3d);_0x2d1040(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xa55e('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 3a44862..04d4dab 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf412=['util','bluebird','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash'];(function(_0x38d798,_0x14cf5b){var _0x54d24c=function(_0x30f24c){while(--_0x30f24c){_0x38d798['push'](_0x38d798['shift']());}};_0x54d24c(++_0x14cf5b);}(_0xf412,0x121));var _0x2f41=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0xf412[_0x3a13cf];return _0x4817c;};'use strict';var _=require(_0x2f41('0x0'));var util=require(_0x2f41('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2f41('0x2'));var rp=require('request-promise');var fetch=require(_0x2f41('0x3'));var fs=require('fs');var path=require(_0x2f41('0x4'));var rimraf=require(_0x2f41('0x5'));var config=require(_0x2f41('0x6'));var attributes=require(_0x2f41('0x7'));module['exports']=function(_0x16b8b1,_0x56d57a){return _0x16b8b1[_0x2f41('0x8')](_0x2f41('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x2f41('0xa'),'fields':[_0x2f41('0xa')]},{'name':_0x2f41('0xb'),'fields':[_0x2f41('0xc')],'type':_0x2f41('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10fcd2,_0x3171b0,_0x24eaee){var _0x2bcab8=_0x16b8b1[_0x2f41('0xe')];var _0x139fbb=_0x10fcd2['get']({'plain':!![]});if(_0x139fbb[_0x2f41('0xf')][_0x2f41('0x10')]()==='in'||_0x139fbb[_0x2f41('0xf')][_0x2f41('0x10')]()===_0x2f41('0x11')&&!_0x139fbb[_0x2f41('0x12')]&&!_['isNil'](_0x139fbb[_0x2f41('0x13')])){_0x2bcab8[_0x2f41('0x14')][_0x2f41('0x15')]({'where':{'id':_0x139fbb[_0x2f41('0x16')]}})[_0x2f41('0x17')](function(_0x573c77){if(_0x573c77){_0x573c77[_0x2f41('0x18')]({'lastMsgAt':_0x139fbb[_0x2f41('0x19')],'lastMsgDirection':_0x139fbb[_0x2f41('0xf')][_0x2f41('0x10')]()});}})['catch'](function(_0x35e94d){console[_0x2f41('0x1a')](_0x35e94d);});}if(_0x139fbb[_0x2f41('0xf')]===_0x2f41('0x11')&&!_0x139fbb['secret']){var _0x40d4b4;_0x2bcab8['WhatsappAccount'][_0x2f41('0x1b')]({'where':{'id':_0x139fbb[_0x2f41('0x1c')]},'raw':!![]})[_0x2f41('0x17')](function(_0x6d4713){_0x40d4b4=_0x6d4713;if(_0x40d4b4&&_0x40d4b4[_0x2f41('0x1d')]){switch(_0x40d4b4[_0x2f41('0x1d')]){case _0x2f41('0x1e'):var _0x5c1035=require(_0x2f41('0x1e'));if(_0x40d4b4[_0x2f41('0x1f')]&&_0x40d4b4[_0x2f41('0x20')]&&_0x40d4b4[_0x2f41('0x21')]){var _0x4c4eb7=new _0x5c1035(_0x40d4b4['accountSid'],_0x40d4b4[_0x2f41('0x20')]);_0x4c4eb7[_0x2f41('0x22')][_0x2f41('0x23')]({'body':_0x139fbb[_0x2f41('0xc')],'to':_0x2f41('0x24')+_0x139fbb[_0x2f41('0x21')],'from':'whatsapp:'+_0x40d4b4[_0x2f41('0x21')],'statusCallback':_0x40d4b4['remote']+_0x2f41('0x25')+_0x139fbb['id']+_0x2f41('0x26')+_0x40d4b4[_0x2f41('0x27')]})['then'](function(_0x5f3dba){if(_0x5f3dba['sid']){return _0x10fcd2[_0x2f41('0x18')]({'messageId':_0x5f3dba[_0x2f41('0x28')]});}})[_0x2f41('0x29')](function(_0x4a0807){logger['error'](_0x2f41('0x2a'),_0x2f41('0x2b'),'twilio',util[_0x2f41('0x2c')](_0x4a0807,{'showHidden':![],'depth':null}));});}else{logger[_0x2f41('0x1a')](_0x2f41('0x2a'),'afterCreate',_0x2f41('0x1e'),_0x2f41('0x2d'));}break;case _0x2f41('0x2e'):var _0x436a9b=_0x40d4b4[_0x2f41('0x1f')];var _0x44a837=_0x40d4b4[_0x2f41('0x20')];var _0x5e79d8=_0x40d4b4[_0x2f41('0x2f')]+_0x2f41('0x30')+_0x436a9b+'/messages/';var _0x1f0e44={'to':[_0x139fbb[_0x2f41('0x21')]],'message':{'type':'text','text':_0x139fbb['body']}};var _0x22d157={'method':_0x2f41('0x31'),'uri':_0x5e79d8,'headers':{'Authorization':_0x2f41('0x32')+_0x44a837,'Content-Type':_0x2f41('0x33')},'body':_0x1f0e44,'json':!![]};rp(_0x22d157)[_0x2f41('0x17')](function(_0x13b4b7){if(_0x13b4b7[_0x2f41('0x34')][0x0][_0x2f41('0x35')]){return _0x10fcd2['update']({'messageId':_0x13b4b7[_0x2f41('0x34')][0x0][_0x2f41('0x35')]});}})[_0x2f41('0x29')](function(_0x355022){logger[_0x2f41('0x36')](_0x2f41('0x37'),_0x355022);});break;}}})[_0x2f41('0x38')](function(){_0x24eaee();});}else{_0x24eaee();}}},'charset':'utf8mb4','collate':_0x2f41('0x39')});}; \ No newline at end of file +var _0x10da=['node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','direction','toLowerCase','out','secret','UserId','WhatsappInteractionId','then','update','catch','error','WhatsappAccount','find','type','accountSid','phone','authToken','messages','create','whatsapp:','remote','/status?token=','token','sid','afterCreate','twilio','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','Bearer\x20','statuses','message_id','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise'];(function(_0x22b9db,_0x586cf8){var _0x82efab=function(_0xc03543){while(--_0xc03543){_0x22b9db['push'](_0x22b9db['shift']());}};_0x82efab(++_0x586cf8);}(_0x10da,0x145));var _0xa10d=function(_0xcd5d0a,_0x41a4b2){_0xcd5d0a=_0xcd5d0a-0x0;var _0xc28575=_0x10da[_0xcd5d0a];return _0xc28575;};'use strict';var _=require(_0xa10d('0x0'));var util=require(_0xa10d('0x1'));var logger=require('../../config/logger')(_0xa10d('0x2'));var moment=require('moment');var BPromise=require(_0xa10d('0x3'));var rp=require(_0xa10d('0x4'));var fetch=require(_0xa10d('0x5'));var fs=require('fs');var path=require(_0xa10d('0x6'));var rimraf=require(_0xa10d('0x7'));var config=require(_0xa10d('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0xa10d('0x9')]=function(_0x5f5138,_0x259392){return _0x5f5138[_0xa10d('0xa')](_0xa10d('0xb'),attributes,{'tableName':_0xa10d('0xc'),'paranoid':![],'indexes':[{'name':_0xa10d('0xd'),'fields':[_0xa10d('0xd')]},{'name':_0xa10d('0xe'),'fields':[_0xa10d('0xf')],'type':_0xa10d('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x209616,_0x3d34e6,_0x48ac08){var _0xeb92ec=_0x5f5138['models'];var _0x4340c5=_0x209616['get']({'plain':!![]});if(_0x4340c5[_0xa10d('0x11')]['toLowerCase']()==='in'||_0x4340c5['direction'][_0xa10d('0x12')]()===_0xa10d('0x13')&&!_0x4340c5[_0xa10d('0x14')]&&!_['isNil'](_0x4340c5[_0xa10d('0x15')])){_0xeb92ec['WhatsappInteraction']['findOne']({'where':{'id':_0x4340c5[_0xa10d('0x16')]}})[_0xa10d('0x17')](function(_0x16b180){if(_0x16b180){_0x16b180[_0xa10d('0x18')]({'lastMsgAt':_0x4340c5['createdAt'],'lastMsgDirection':_0x4340c5[_0xa10d('0x11')][_0xa10d('0x12')]()});}})[_0xa10d('0x19')](function(_0x2e894f){console[_0xa10d('0x1a')](_0x2e894f);});}if(_0x4340c5['direction']===_0xa10d('0x13')&&!_0x4340c5[_0xa10d('0x14')]){var _0x5f2958;_0xeb92ec[_0xa10d('0x1b')][_0xa10d('0x1c')]({'where':{'id':_0x4340c5['WhatsappAccountId']},'raw':!![]})[_0xa10d('0x17')](function(_0x456121){_0x5f2958=_0x456121;if(_0x5f2958&&_0x5f2958[_0xa10d('0x1d')]){switch(_0x5f2958[_0xa10d('0x1d')]){case'twilio':var _0x154024=require('twilio');if(_0x5f2958[_0xa10d('0x1e')]&&_0x5f2958['authToken']&&_0x5f2958[_0xa10d('0x1f')]){var _0x534934=new _0x154024(_0x5f2958[_0xa10d('0x1e')],_0x5f2958[_0xa10d('0x20')]);_0x534934[_0xa10d('0x21')][_0xa10d('0x22')]({'body':_0x4340c5[_0xa10d('0xf')],'to':_0xa10d('0x23')+_0x4340c5[_0xa10d('0x1f')],'from':'whatsapp:'+_0x5f2958[_0xa10d('0x1f')],'statusCallback':_0x5f2958[_0xa10d('0x24')]+'/api/whatsapp/messages/'+_0x4340c5['id']+_0xa10d('0x25')+_0x5f2958[_0xa10d('0x26')]})[_0xa10d('0x17')](function(_0x38a729){if(_0x38a729[_0xa10d('0x27')]){return _0x209616[_0xa10d('0x18')]({'messageId':_0x38a729[_0xa10d('0x27')]});}})[_0xa10d('0x19')](function(_0x48ac3e){logger[_0xa10d('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xa10d('0x28'),_0xa10d('0x29'),util['inspect'](_0x48ac3e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa10d('0x2a'),_0xa10d('0x28'),_0xa10d('0x29'),_0xa10d('0x2b'));}break;case _0xa10d('0x2c'):var _0x5c4432=_0x5f2958[_0xa10d('0x1e')];var _0x301011=_0x5f2958[_0xa10d('0x20')];var _0x4f723d=_0x5f2958[_0xa10d('0x2d')]+'/whatsapp/v1/'+_0x5c4432+_0xa10d('0x2e');var _0x4338e0={'to':[_0x4340c5[_0xa10d('0x1f')]],'message':{'type':_0xa10d('0x2f'),'text':_0x4340c5[_0xa10d('0xf')]}};var _0x1690ad={'method':_0xa10d('0x30'),'uri':_0x4f723d,'headers':{'Authorization':_0xa10d('0x31')+_0x301011,'Content-Type':'application/json'},'body':_0x4338e0,'json':!![]};rp(_0x1690ad)[_0xa10d('0x17')](function(_0x331dab){if(_0x331dab[_0xa10d('0x32')][0x0][_0xa10d('0x33')]){return _0x209616['update']({'messageId':_0x331dab['statuses'][0x0][_0xa10d('0x33')]});}})[_0xa10d('0x19')](function(_0x3134d9){logger['err']('WhatsappMessage,\x20%s',_0x3134d9);});break;}}})[_0xa10d('0x34')](function(){_0x48ac08();});}else{_0x48ac08();}}},'charset':_0xa10d('0x35'),'collate':_0xa10d('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 78a05da..4ae5642 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3302=['WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','info','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','then'];(function(_0x2dffa5,_0xdd5613){var _0x4a2537=function(_0x30f4c6){while(--_0x30f4c6){_0x2dffa5['push'](_0x2dffa5['shift']());}};_0x4a2537(++_0xdd5613);}(_0x3302,0x19b));var _0x2330=function(_0x131cd5,_0x7479ac){_0x131cd5=_0x131cd5-0x0;var _0x2407ca=_0x3302[_0x131cd5];return _0x2407ca;};'use strict';var _=require(_0x2330('0x0'));var util=require(_0x2330('0x1'));var moment=require(_0x2330('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2330('0x3'));var db=require(_0x2330('0x4'))['db'];var utils=require(_0x2330('0x5'));var logger=require(_0x2330('0x6'))(_0x2330('0x7'));var config=require(_0x2330('0x8'));var jayson=require(_0x2330('0x9'));var client=jayson[_0x2330('0xa')][_0x2330('0xb')]({'port':0x232a});config[_0x2330('0xc')]=_[_0x2330('0xd')](config[_0x2330('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x2330('0xe'))(new Redis(config[_0x2330('0xc')]));require(_0x2330('0xf'))[_0x2330('0x10')](socket);function respondWithRpcPromise(_0x31386b,_0x1ba813,_0xe30447){return new BPromise(function(_0x5cd530,_0x812f7b){return client['request'](_0x31386b,_0xe30447)[_0x2330('0x11')](function(_0x6b1d8b){logger['info'](_0x2330('0x12'),_0x1ba813,'request\x20sent');logger[_0x2330('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1ba813,_0x2330('0x14'),JSON[_0x2330('0x15')](_0x6b1d8b));if(_0x6b1d8b[_0x2330('0x16')]){if(_0x6b1d8b[_0x2330('0x16')]['code']===0x1f4){logger[_0x2330('0x16')](_0x2330('0x12'),_0x1ba813,_0x6b1d8b[_0x2330('0x16')][_0x2330('0x17')]);return _0x812f7b(_0x6b1d8b[_0x2330('0x16')][_0x2330('0x17')]);}logger['error'](_0x2330('0x12'),_0x1ba813,_0x6b1d8b[_0x2330('0x16')]['message']);return _0x5cd530(_0x6b1d8b[_0x2330('0x16')][_0x2330('0x17')]);}else{logger['info'](_0x2330('0x12'),_0x1ba813,_0x2330('0x14'));_0x5cd530(_0x6b1d8b[_0x2330('0x18')][_0x2330('0x17')]);}})[_0x2330('0x19')](function(_0x445b4b){logger[_0x2330('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x1ba813,_0x445b4b);_0x812f7b(_0x445b4b);});});}exports[_0x2330('0x1a')]=function(_0xcaa275){var _0x58b0ef=this;return new Promise(function(_0x41158c,_0x4232cc){return db[_0x2330('0x1b')][_0x2330('0x1c')](_0xcaa275[_0x2330('0x1d')],{'raw':_0xcaa275[_0x2330('0x1e')]?_0xcaa275['options'][_0x2330('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0xc2a49b){logger[_0x2330('0x20')](_0x2330('0x1a'),_0xcaa275);logger['debug'](_0x2330('0x1a'),_0xcaa275,JSON['stringify'](_0xc2a49b));_0x41158c(_0xc2a49b);})[_0x2330('0x19')](function(_0x3238c2){logger['error'](_0x2330('0x1a'),_0x3238c2['message'],_0xcaa275);_0x4232cc(_0x58b0ef['error'](0x1f4,_0x3238c2['message']));});});}; \ No newline at end of file +var _0x7ecb=['result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7ecb,0xee));var _0xb7ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ecb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb7ec('0x0'));var util=require(_0xb7ec('0x1'));var moment=require(_0xb7ec('0x2'));var BPromise=require(_0xb7ec('0x3'));var rs=require(_0xb7ec('0x4'));var fs=require('fs');var Redis=require(_0xb7ec('0x5'));var db=require(_0xb7ec('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7ec('0x7'))('rpc');var config=require(_0xb7ec('0x8'));var jayson=require(_0xb7ec('0x9'));var client=jayson[_0xb7ec('0xa')][_0xb7ec('0xb')]({'port':0x232a});config[_0xb7ec('0xc')]=_['defaults'](config['redis'],{'host':_0xb7ec('0xd'),'port':0x18eb});var socket=require(_0xb7ec('0xe'))(new Redis(config['redis']));require(_0xb7ec('0xf'))['register'](socket);function respondWithRpcPromise(_0x591b5e,_0x3c5329,_0x3e2f71){return new BPromise(function(_0x497202,_0x58355f){return client[_0xb7ec('0x10')](_0x591b5e,_0x3e2f71)[_0xb7ec('0x11')](function(_0x4e95d8){logger[_0xb7ec('0x12')](_0xb7ec('0x13'),_0x3c5329,_0xb7ec('0x14'));logger['debug'](_0xb7ec('0x15'),_0x3c5329,_0xb7ec('0x14'),JSON[_0xb7ec('0x16')](_0x4e95d8));if(_0x4e95d8[_0xb7ec('0x17')]){if(_0x4e95d8[_0xb7ec('0x17')][_0xb7ec('0x18')]===0x1f4){logger[_0xb7ec('0x17')](_0xb7ec('0x13'),_0x3c5329,_0x4e95d8[_0xb7ec('0x17')][_0xb7ec('0x19')]);return _0x58355f(_0x4e95d8['error']['message']);}logger[_0xb7ec('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x3c5329,_0x4e95d8[_0xb7ec('0x17')][_0xb7ec('0x19')]);return _0x497202(_0x4e95d8[_0xb7ec('0x17')][_0xb7ec('0x19')]);}else{logger[_0xb7ec('0x12')](_0xb7ec('0x13'),_0x3c5329,_0xb7ec('0x14'));_0x497202(_0x4e95d8[_0xb7ec('0x1a')][_0xb7ec('0x19')]);}})[_0xb7ec('0x1b')](function(_0x40e7d9){logger[_0xb7ec('0x17')](_0xb7ec('0x13'),_0x3c5329,_0x40e7d9);_0x58355f(_0x40e7d9);});});}exports[_0xb7ec('0x1c')]=function(_0x5d4cb9){var _0x167720=this;return new Promise(function(_0x1992e0,_0x59dcdc){return db[_0xb7ec('0x1d')]['create'](_0x5d4cb9[_0xb7ec('0x1e')],{'raw':_0x5d4cb9[_0xb7ec('0x1f')]?_0x5d4cb9[_0xb7ec('0x1f')][_0xb7ec('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0xaade){logger[_0xb7ec('0x12')](_0xb7ec('0x1c'),_0x5d4cb9);logger['debug'](_0xb7ec('0x1c'),_0x5d4cb9,JSON[_0xb7ec('0x16')](_0xaade));_0x1992e0(_0xaade);})[_0xb7ec('0x1b')](function(_0x401bfb){logger[_0xb7ec('0x17')]('CreateWhatsappMessage',_0x401bfb[_0xb7ec('0x19')],_0x5d4cb9);_0x59dcdc(_0x167720[_0xb7ec('0x17')](0x1f4,_0x401bfb[_0xb7ec('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 14a0b28..fa11eb6 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0dba=['length','whatsappMessage:','./whatsappMessage.events','remove','update','emit','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0dba,0x1ba));var _0xa0db=function(_0x27852a,_0x4e4364){_0x27852a=_0x27852a-0x0;var _0x36b901=_0x0dba[_0x27852a];return _0x36b901;};'use strict';var WhatsappMessageEvents=require(_0xa0db('0x0'));var events=['save',_0xa0db('0x1'),_0xa0db('0x2')];function createListener(_0x5cb9ea,_0x4d3809){return function(_0x4345c4){_0x4d3809[_0xa0db('0x3')](_0x5cb9ea,_0x4345c4);};}function removeListener(_0x334eed,_0xe54c98){return function(){WhatsappMessageEvents[_0xa0db('0x4')](_0x334eed,_0xe54c98);};}exports[_0xa0db('0x5')]=function(_0x5092be){for(var _0x4b6209=0x0,_0x54594d=events[_0xa0db('0x6')];_0x4b6209<_0x54594d;_0x4b6209++){var _0x3b8c98=events[_0x4b6209];var _0x10c431=createListener(_0xa0db('0x7')+_0x3b8c98,_0x5092be);WhatsappMessageEvents['on'](_0x3b8c98,_0x10c431);}}; \ No newline at end of file +var _0x7b4d=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','update'];(function(_0x224749,_0x336d1e){var _0xf23c0a=function(_0x1aa7d3){while(--_0x1aa7d3){_0x224749['push'](_0x224749['shift']());}};_0xf23c0a(++_0x336d1e);}(_0x7b4d,0x165));var _0xd7b4=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x7b4d[_0x1dd82f];return _0x353ca4;};'use strict';var WhatsappMessageEvents=require(_0xd7b4('0x0'));var events=[_0xd7b4('0x1'),'remove',_0xd7b4('0x2')];function createListener(_0x421eda,_0x3fa5df){return function(_0x12d1e7){_0x3fa5df[_0xd7b4('0x3')](_0x421eda,_0x12d1e7);};}function removeListener(_0x4cb9df,_0x4d5623){return function(){WhatsappMessageEvents[_0xd7b4('0x4')](_0x4cb9df,_0x4d5623);};}exports[_0xd7b4('0x5')]=function(_0xa1e4ce){for(var _0x2e2123=0x0,_0x2e2c33=events[_0xd7b4('0x6')];_0x2e2123<_0x2e2c33;_0x2e2123++){var _0x443d72=events[_0x2e2123];var _0x57e96b=createListener(_0xd7b4('0x7')+_0x443d72,_0xa1e4ce);WhatsappMessageEvents['on'](_0x443d72,_0x57e96b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 2bbe776..a5aff4e 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d97=['delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update'];(function(_0x51f632,_0x5a14d5){var _0x24cf36=function(_0x3f2799){while(--_0x3f2799){_0x51f632['push'](_0x51f632['shift']());}};_0x24cf36(++_0x5a14d5);}(_0x2d97,0xb4));var _0x72d9=function(_0x31f9c6,_0x54065a){_0x31f9c6=_0x31f9c6-0x0;var _0x3d4a40=_0x2d97[_0x31f9c6];return _0x3d4a40;};'use strict';var multer=require(_0x72d9('0x0'));var util=require('util');var path=require(_0x72d9('0x1'));var timeout=require(_0x72d9('0x2'));var express=require('express');var router=express[_0x72d9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x72d9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x72d9('0x5'));var controller=require(_0x72d9('0x6'));router[_0x72d9('0x7')]('/',auth[_0x72d9('0x8')](),controller['index']);router[_0x72d9('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x72d9('0x9')]);router['get'](_0x72d9('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x72d9('0x7')]('/:id/members',auth[_0x72d9('0x8')](),controller[_0x72d9('0xb')]);router[_0x72d9('0x7')](_0x72d9('0xc'),auth[_0x72d9('0x8')](),controller[_0x72d9('0xd')]);router[_0x72d9('0x7')](_0x72d9('0xe'),auth[_0x72d9('0x8')](),controller[_0x72d9('0xf')]);router[_0x72d9('0x10')]('/',auth[_0x72d9('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0x72d9('0x8')](),controller['addTeams']);router[_0x72d9('0x10')]('/:id/users',auth[_0x72d9('0x8')](),controller[_0x72d9('0x11')]);router[_0x72d9('0x12')](_0x72d9('0xa'),auth[_0x72d9('0x8')](),controller[_0x72d9('0x13')]);router[_0x72d9('0x14')](_0x72d9('0xa'),auth[_0x72d9('0x8')](),controller[_0x72d9('0x15')]);router['delete'](_0x72d9('0xc'),auth[_0x72d9('0x8')](),controller[_0x72d9('0x16')]);router[_0x72d9('0x14')](_0x72d9('0xe'),auth['isAuthenticated'](),controller[_0x72d9('0x17')]);module[_0x72d9('0x18')]=router; \ No newline at end of file +var _0x1488=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers'];(function(_0x2dc937,_0x211004){var _0x53bd4f=function(_0x469dce){while(--_0x469dce){_0x2dc937['push'](_0x2dc937['shift']());}};_0x53bd4f(++_0x211004);}(_0x1488,0x1c6));var _0x8148=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0x1488[_0x650e11];return _0x1a9b47;};'use strict';var multer=require('multer');var util=require(_0x8148('0x0'));var path=require(_0x8148('0x1'));var timeout=require(_0x8148('0x2'));var express=require('express');var router=express[_0x8148('0x3')]();var fs_extra=require(_0x8148('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8148('0x5'));router[_0x8148('0x6')]('/',auth[_0x8148('0x7')](),controller[_0x8148('0x8')]);router['get']('/describe',auth[_0x8148('0x7')](),controller[_0x8148('0x9')]);router[_0x8148('0x6')](_0x8148('0xa'),auth[_0x8148('0x7')](),controller[_0x8148('0xb')]);router[_0x8148('0x6')](_0x8148('0xc'),auth[_0x8148('0x7')](),controller[_0x8148('0xd')]);router[_0x8148('0x6')](_0x8148('0xe'),auth[_0x8148('0x7')](),controller[_0x8148('0xf')]);router['get'](_0x8148('0x10'),auth[_0x8148('0x7')](),controller[_0x8148('0x11')]);router[_0x8148('0x12')]('/',auth['isAuthenticated'](),controller[_0x8148('0x13')]);router[_0x8148('0x12')](_0x8148('0xe'),auth[_0x8148('0x7')](),controller[_0x8148('0x14')]);router[_0x8148('0x12')](_0x8148('0x10'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x8148('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x8148('0x15')]('/:id',auth[_0x8148('0x7')](),controller[_0x8148('0x16')]);router[_0x8148('0x15')](_0x8148('0xe'),auth[_0x8148('0x7')](),controller[_0x8148('0x17')]);router['delete'](_0x8148('0x10'),auth['isAuthenticated'](),controller[_0x8148('0x18')]);module[_0x8148('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 52e57d9..11bd4eb 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf69b=['beepall','STRING','exports','name','ENUM','rrmemory'];(function(_0x41f2f5,_0x14f33c){var _0x3d49f1=function(_0x300207){while(--_0x300207){_0x41f2f5['push'](_0x41f2f5['shift']());}};_0x3d49f1(++_0x14f33c);}(_0xf69b,0xc8));var _0xbf69=function(_0x465692,_0x5c53ba){_0x465692=_0x465692-0x0;var _0x4d5743=_0xf69b[_0x465692];return _0x4d5743;};'use strict';var Sequelize=require('sequelize');module[_0xbf69('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xbf69('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbf69('0x2')](_0xbf69('0x3'),_0xbf69('0x4'),'roundrobin')},'description':{'type':Sequelize[_0xbf69('0x5')]}}; \ No newline at end of file +var _0x292e=['sequelize','exports','STRING','name','rrmemory','beepall','roundrobin'];(function(_0x4941bc,_0x199598){var _0xf3862d=function(_0x7bdbd5){while(--_0x7bdbd5){_0x4941bc['push'](_0x4941bc['shift']());}};_0xf3862d(++_0x199598);}(_0x292e,0xcb));var _0xe292=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x292e[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0xe292('0x0'));module[_0xe292('0x1')]={'name':{'type':Sequelize[_0xe292('0x2')],'unique':_0xe292('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe292('0x4'),_0xe292('0x5'),_0xe292('0x6'))},'description':{'type':Sequelize[_0xe292('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 5deb342..9dac5b6 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8939=['sendStatus','name','send','fieldName','type','key','filters','intersection','model','fields','query','length','attributes','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','WhatsappQueue','includeAll','rows','catch','show','params','keys','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','describe','findOne','UserWhatsappQueue','rawAttributes','hasOwnProperty','WhatsappQueueId','findAll','User','findAndCountAll','map','UserId','agent','whatsappPause','updatedAt','createdAt','format','getTeams','Team','addTeams','ids','Agents','online','interface','sequelize','transaction','each','forEach','userWhatsappQueue:save','removeTeams','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','emit','isArray','userWhatsappQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','WhatsappQueues','UserProfileResource','destroy','end'];(function(_0xba9e42,_0x3277c4){var _0x197715=function(_0x4b02d1){while(--_0x4b02d1){_0xba9e42['push'](_0xba9e42['shift']());}};_0x197715(++_0x3277c4);}(_0x8939,0xeb));var _0x9893=function(_0x4a5766,_0x1970e5){_0x4a5766=_0x4a5766-0x0;var _0x255247=_0x8939[_0x4a5766];return _0x255247;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9893('0x0'));var zipdir=require(_0x9893('0x1'));var jsonpatch=require(_0x9893('0x2'));var rp=require('request-promise');var moment=require(_0x9893('0x3'));var BPromise=require(_0x9893('0x4'));var Mustache=require(_0x9893('0x5'));var util=require(_0x9893('0x6'));var path=require('path');var sox=require(_0x9893('0x7'));var csv=require('to-csv');var ejs=require(_0x9893('0x8'));var fs=require('fs');var fs_extra=require(_0x9893('0x9'));var _=require(_0x9893('0xa'));var squel=require(_0x9893('0xb'));var crypto=require('crypto');var jsforce=require(_0x9893('0xc'));var deskjs=require(_0x9893('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9893('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9893('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9893('0x10'));var logger=require(_0x9893('0x11'))(_0x9893('0x12'));var utils=require(_0x9893('0x13'));var config=require(_0x9893('0x14'));var licenseUtil=require(_0x9893('0x15'));var db=require('../../mysqldb')['db'];config[_0x9893('0x16')]=_[_0x9893('0x17')](config['redis'],{'host':_0x9893('0x18'),'port':0x18eb});var socket=require(_0x9893('0x19'))(new Redis(config[_0x9893('0x16')]));require(_0x9893('0x1a'))[_0x9893('0x1b')](socket);function respondWithStatusCode(_0x459560,_0x27f32f){_0x27f32f=_0x27f32f||0xcc;return function(_0x18a89b){if(_0x18a89b){return _0x459560['sendStatus'](_0x27f32f);}return _0x459560[_0x9893('0x1c')](_0x27f32f)['end']();};}function respondWithResult(_0x311dcd,_0x3c7249){_0x3c7249=_0x3c7249||0xc8;return function(_0x482f7f){if(_0x482f7f){return _0x311dcd[_0x9893('0x1c')](_0x3c7249)[_0x9893('0x1d')](_0x482f7f);}};}function respondWithFilteredResult(_0x2e25a6,_0xed749b){return function(_0x574ecd){if(_0x574ecd){var _0x480c27=typeof _0xed749b[_0x9893('0x1e')]===_0x9893('0x1f')&&typeof _0xed749b[_0x9893('0x20')]==='undefined';var _0x57bb26=_0x574ecd[_0x9893('0x21')];var _0x38c691=_0x480c27?0x0:_0xed749b['offset'];var _0x505497=_0x480c27?_0x574ecd[_0x9893('0x21')]:_0xed749b['offset']+_0xed749b[_0x9893('0x20')];var _0x28813c;if(_0x505497>=_0x57bb26){_0x505497=_0x57bb26;_0x28813c=0xc8;}else{_0x28813c=0xce;}_0x2e25a6[_0x9893('0x1c')](_0x28813c);return _0x2e25a6[_0x9893('0x22')](_0x9893('0x23'),_0x38c691+'-'+_0x505497+'/'+_0x57bb26)[_0x9893('0x1d')](_0x574ecd);}return null;};}function patchUpdates(_0x3605e3){return function(_0x14166a){try{jsonpatch['apply'](_0x14166a,_0x3605e3,!![]);}catch(_0x14779f){return BPromise[_0x9893('0x24')](_0x14779f);}return _0x14166a[_0x9893('0x25')]();};}function saveUpdates(_0x22875c,_0xe9a1f7){return function(_0x3f8109){if(_0x3f8109){return _0x3f8109[_0x9893('0x26')](_0x22875c)[_0x9893('0x27')](function(_0x93139f){return _0x93139f;});}return null;};}function removeEntity(_0x325ccb,_0x42a6d4){return function(_0x4365b2){if(_0x4365b2){return _0x4365b2['destroy']()[_0x9893('0x27')](function(){var _0x38fac1=_0x4365b2[_0x9893('0x28')]({'plain':!![]});var _0x237ff2=_0x9893('0x29');return db[_0x9893('0x2a')][_0x9893('0x2b')]({'where':{'type':_0x237ff2,'resourceId':_0x38fac1['id']}})[_0x9893('0x27')](function(){return _0x4365b2;});})['then'](function(){_0x325ccb[_0x9893('0x1c')](0xcc)[_0x9893('0x2c')]();});}};}function handleEntityNotFound(_0x1f7784,_0x334bee){return function(_0x4f1383){if(!_0x4f1383){_0x1f7784[_0x9893('0x2d')](0x194);}return _0x4f1383;};}function handleError(_0x189b7a,_0x210dc1){_0x210dc1=_0x210dc1||0x1f4;return function(_0x5177bb){logger['error'](_0x5177bb['stack']);if(_0x5177bb[_0x9893('0x2e')]){delete _0x5177bb[_0x9893('0x2e')];}_0x189b7a[_0x9893('0x1c')](_0x210dc1)[_0x9893('0x2f')](_0x5177bb);};}exports['index']=function(_0x3487e8,_0x2757f9){var _0x24e4ad={},_0x159e28={},_0x4dd6ee={'count':0x0,'rows':[]};var _0x56f123=_['map'](db['WhatsappQueue']['rawAttributes'],function(_0x10f32d){return{'name':_0x10f32d[_0x9893('0x30')],'type':_0x10f32d[_0x9893('0x31')][_0x9893('0x32')]};});_0x159e28['model']=_['map'](_0x56f123,_0x9893('0x2e'));_0x159e28['query']=_['keys'](_0x3487e8['query']);_0x159e28[_0x9893('0x33')]=_[_0x9893('0x34')](_0x159e28['model'],_0x159e28['query']);_0x24e4ad['attributes']=_[_0x9893('0x34')](_0x159e28[_0x9893('0x35')],qs[_0x9893('0x36')](_0x3487e8[_0x9893('0x37')]['fields']));_0x24e4ad['attributes']=_0x24e4ad['attributes'][_0x9893('0x38')]?_0x24e4ad[_0x9893('0x39')]:_0x159e28['model'];if(!_0x3487e8[_0x9893('0x37')]['hasOwnProperty'](_0x9893('0x3a'))){_0x24e4ad['limit']=qs[_0x9893('0x20')](_0x3487e8[_0x9893('0x37')]['limit']);_0x24e4ad[_0x9893('0x1e')]=qs['offset'](_0x3487e8[_0x9893('0x37')][_0x9893('0x1e')]);}_0x24e4ad[_0x9893('0x3b')]=qs[_0x9893('0x3c')](_0x3487e8['query'][_0x9893('0x3c')]);_0x24e4ad['where']=qs[_0x9893('0x33')](_[_0x9893('0x3d')](_0x3487e8[_0x9893('0x37')],_0x159e28[_0x9893('0x33')]),_0x56f123);if(_0x3487e8[_0x9893('0x37')][_0x9893('0x3e')]){_0x24e4ad[_0x9893('0x3f')]=_['merge'](_0x24e4ad['where'],{'$or':_['map'](_0x56f123,function(_0x521328){if(_0x521328[_0x9893('0x31')]!==_0x9893('0x40')){var _0x5aa9b1={};_0x5aa9b1[_0x521328[_0x9893('0x2e')]]={'$like':'%'+_0x3487e8[_0x9893('0x37')][_0x9893('0x3e')]+'%'};return _0x5aa9b1;}})});}_0x24e4ad=_[_0x9893('0x41')]({},_0x24e4ad,_0x3487e8[_0x9893('0x42')]);var _0x478a73={'where':_0x24e4ad[_0x9893('0x3f')]};return db[_0x9893('0x43')][_0x9893('0x21')](_0x478a73)[_0x9893('0x27')](function(_0x14dd52){_0x4dd6ee[_0x9893('0x21')]=_0x14dd52;if(_0x3487e8['query'][_0x9893('0x44')]){_0x24e4ad['include']=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x24e4ad);})['then'](function(_0x4abedd){_0x4dd6ee[_0x9893('0x45')]=_0x4abedd;return _0x4dd6ee;})['then'](respondWithFilteredResult(_0x2757f9,_0x24e4ad))[_0x9893('0x46')](handleError(_0x2757f9,null));};exports[_0x9893('0x47')]=function(_0x6849b0,_0x307d06){var _0x554999={'raw':!![],'where':{'id':_0x6849b0[_0x9893('0x48')]['id']}},_0x572382={};_0x572382['model']=_[_0x9893('0x49')](db[_0x9893('0x43')]['rawAttributes']);_0x572382['query']=_[_0x9893('0x49')](_0x6849b0[_0x9893('0x37')]);_0x572382[_0x9893('0x33')]=_[_0x9893('0x34')](_0x572382[_0x9893('0x35')],_0x572382[_0x9893('0x37')]);_0x554999[_0x9893('0x39')]=_[_0x9893('0x34')](_0x572382['model'],qs[_0x9893('0x36')](_0x6849b0['query']['fields']));_0x554999['attributes']=_0x554999[_0x9893('0x39')][_0x9893('0x38')]?_0x554999['attributes']:_0x572382[_0x9893('0x35')];if(_0x6849b0[_0x9893('0x37')][_0x9893('0x44')]){_0x554999[_0x9893('0x4a')]=[{'all':!![]}];}_0x554999=_['merge']({},_0x554999,_0x6849b0[_0x9893('0x42')]);return db[_0x9893('0x43')][_0x9893('0x4b')](_0x554999)[_0x9893('0x27')](handleEntityNotFound(_0x307d06,null))['then'](respondWithResult(_0x307d06,null))[_0x9893('0x46')](handleError(_0x307d06,null));};exports[_0x9893('0x4c')]=function(_0x5119dc,_0x25c000){return db[_0x9893('0x43')]['create'](_0x5119dc[_0x9893('0x4d')],{})[_0x9893('0x27')](function(_0x3c4829){var _0x185173=_0x5119dc[_0x9893('0x4e')][_0x9893('0x28')]({'plain':!![]});if(!_0x185173)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x185173[_0x9893('0x4f')]==='user'){var _0x5463f0=_0x3c4829[_0x9893('0x28')]({'plain':!![]});var _0x2abfa0=_0x9893('0x29');return db[_0x9893('0x50')][_0x9893('0x4b')]({'where':{'name':_0x2abfa0,'userProfileId':_0x185173[_0x9893('0x51')]},'raw':!![]})['then'](function(_0x332a91){if(_0x332a91&&_0x332a91[_0x9893('0x52')]===0x0){return db[_0x9893('0x2a')][_0x9893('0x4c')]({'name':_0x5463f0[_0x9893('0x2e')],'resourceId':_0x5463f0['id'],'type':_0x332a91[_0x9893('0x2e')],'sectionId':_0x332a91['id']},{})['then'](function(){return _0x3c4829;});}else{return _0x3c4829;}})[_0x9893('0x46')](function(_0x51e0b1){logger[_0x9893('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51e0b1);throw _0x51e0b1;});}return _0x3c4829;})[_0x9893('0x27')](respondWithResult(_0x25c000,0xc9))[_0x9893('0x46')](handleError(_0x25c000,null));};exports[_0x9893('0x26')]=function(_0x441b5f,_0x33e1ee){if(_0x441b5f[_0x9893('0x4d')]['id']){delete _0x441b5f[_0x9893('0x4d')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x441b5f['params']['id']}})['then'](handleEntityNotFound(_0x33e1ee,null))[_0x9893('0x27')](saveUpdates(_0x441b5f[_0x9893('0x4d')],null))['then'](respondWithResult(_0x33e1ee,null))[_0x9893('0x46')](handleError(_0x33e1ee,null));};exports[_0x9893('0x2b')]=function(_0x15f333,_0x108851){return db[_0x9893('0x43')][_0x9893('0x4b')]({'where':{'id':_0x15f333[_0x9893('0x48')]['id']}})[_0x9893('0x27')](handleEntityNotFound(_0x108851,null))[_0x9893('0x27')](removeEntity(_0x108851,null))['catch'](handleError(_0x108851,null));};exports[_0x9893('0x54')]=function(_0x1e24ff,_0x2c997b){return db[_0x9893('0x43')][_0x9893('0x54')]()[_0x9893('0x27')](respondWithResult(_0x2c997b,null))['catch'](handleError(_0x2c997b,null));};exports['getMembers']=function(_0x4a05b2,_0x1d7d0f,_0x44006e){var _0x27f100={'raw':!![],'where':{}},_0x4c168e={},_0x35e0e5;return db[_0x9893('0x43')][_0x9893('0x55')]({'where':{'id':_0x4a05b2[_0x9893('0x48')]['id']}})[_0x9893('0x27')](handleEntityNotFound(_0x1d7d0f,null))[_0x9893('0x27')](function(_0x1c5310){if(_0x1c5310){_0x35e0e5=_0x1c5310[_0x9893('0x28')]({'plain':!![]});_0x4c168e[_0x9893('0x35')]=_[_0x9893('0x49')](db[_0x9893('0x56')][_0x9893('0x57')]);_0x4c168e[_0x9893('0x37')]=_[_0x9893('0x49')](_0x4a05b2[_0x9893('0x37')]);_0x4c168e[_0x9893('0x33')]=_[_0x9893('0x34')](_0x4c168e[_0x9893('0x35')],_0x4c168e['query']);_0x27f100[_0x9893('0x39')]=_['intersection'](_0x4c168e[_0x9893('0x35')],qs[_0x9893('0x36')](_0x4a05b2[_0x9893('0x37')][_0x9893('0x36')]));_0x27f100['attributes']=_0x27f100[_0x9893('0x39')][_0x9893('0x38')]?_0x27f100['attributes']:_0x4c168e[_0x9893('0x35')];if(!_0x4a05b2['query'][_0x9893('0x58')](_0x9893('0x3a'))){_0x27f100['limit']=qs[_0x9893('0x20')](_0x4a05b2[_0x9893('0x37')][_0x9893('0x20')]);_0x27f100['offset']=qs[_0x9893('0x1e')](_0x4a05b2[_0x9893('0x37')][_0x9893('0x1e')]);}_0x27f100[_0x9893('0x3b')]=qs['sort'](_0x4a05b2[_0x9893('0x37')][_0x9893('0x3c')]);_0x27f100[_0x9893('0x3f')]=qs[_0x9893('0x33')](_[_0x9893('0x3d')](_0x4a05b2['query'],_0x4c168e[_0x9893('0x33')]));_0x27f100[_0x9893('0x3f')][_0x9893('0x59')]=_0x1c5310['id'];if(_0x4a05b2[_0x9893('0x37')][_0x9893('0x3e')]){_0x27f100['where']=_[_0x9893('0x41')](_0x27f100['where'],{'$or':_['map'](_0x27f100[_0x9893('0x39')],function(_0x133d73){var _0x48068e={};_0x48068e[_0x133d73]={'$like':'%'+_0x4a05b2[_0x9893('0x37')][_0x9893('0x3e')]+'%'};return _0x48068e;})});}_0x27f100=_[_0x9893('0x41')]({},_0x27f100,_0x4a05b2[_0x9893('0x42')]);return db[_0x9893('0x56')][_0x9893('0x5a')](_0x27f100);}})[_0x9893('0x27')](function(_0x625bd0){if(_0x625bd0){return db[_0x9893('0x5b')][_0x9893('0x5c')]({'where':{'id':_[_0x9893('0x5d')](_0x625bd0,_0x9893('0x5e')),'role':_0x9893('0x5f')},'attributes':['id',_0x9893('0x2e'),_0x9893('0x60'),_0x9893('0x61'),_0x9893('0x62')]});}})['then'](function(_0x2679c6){if(_0x2679c6){return{'count':_0x2679c6[_0x9893('0x21')],'rows':_[_0x9893('0x5d')](_0x2679c6[_0x9893('0x45')],function(_0x5a57b1){return{'membername':_0x5a57b1[_0x9893('0x2e')],'UserId':_0x5a57b1['id'],'queue_name':_0x35e0e5[_0x9893('0x2e')],'WhatsappQueueId':_0x35e0e5['id'],'interface':util[_0x9893('0x63')]('%s/%s','SIP',_0x5a57b1[_0x9893('0x2e')]),'penalty':0x0,'paused':_0x5a57b1[_0x9893('0x60')],'createdAt':_0x5a57b1[_0x9893('0x62')],'updatedAt':_0x5a57b1[_0x9893('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1d7d0f,_0x27f100))[_0x9893('0x46')](handleError(_0x1d7d0f,null));};exports[_0x9893('0x64')]=function(_0x275262,_0x283ec7,_0xe972f1){var _0x2d2542={};var _0x42d2e2={};var _0x524fb6;var _0x33138b;return db['WhatsappQueue'][_0x9893('0x55')]({'where':{'id':_0x275262[_0x9893('0x48')]['id']}})[_0x9893('0x27')](handleEntityNotFound(_0x283ec7,null))[_0x9893('0x27')](function(_0xa501c8){if(_0xa501c8){_0x524fb6=_0xa501c8;_0x42d2e2[_0x9893('0x35')]=_[_0x9893('0x49')](db[_0x9893('0x65')][_0x9893('0x57')]);_0x42d2e2['query']=_[_0x9893('0x49')](_0x275262[_0x9893('0x37')]);_0x42d2e2['filters']=_[_0x9893('0x34')](_0x42d2e2['model'],_0x42d2e2[_0x9893('0x37')]);_0x2d2542[_0x9893('0x39')]=_[_0x9893('0x34')](_0x42d2e2[_0x9893('0x35')],qs[_0x9893('0x36')](_0x275262['query'][_0x9893('0x36')]));_0x2d2542['attributes']=_0x2d2542['attributes']['length']?_0x2d2542[_0x9893('0x39')]:_0x42d2e2[_0x9893('0x35')];_0x2d2542['order']=qs[_0x9893('0x3c')](_0x275262[_0x9893('0x37')][_0x9893('0x3c')]);_0x2d2542[_0x9893('0x3f')]=qs[_0x9893('0x33')](_[_0x9893('0x3d')](_0x275262[_0x9893('0x37')],_0x42d2e2[_0x9893('0x33')]));if(_0x275262[_0x9893('0x37')][_0x9893('0x3e')]){_0x2d2542['where']=_[_0x9893('0x41')](_0x2d2542['where'],{'$or':_['map'](_0x2d2542['attributes'],function(_0x1a3003){var _0x137970={};_0x137970[_0x1a3003]={'$like':'%'+_0x275262[_0x9893('0x37')][_0x9893('0x3e')]+'%'};return _0x137970;})});}_0x2d2542=_['merge']({},_0x2d2542,_0x275262[_0x9893('0x42')]);return _0x524fb6[_0x9893('0x64')](_0x2d2542);}})['then'](function(_0x2212b7){if(_0x2212b7){_0x33138b=_0x2212b7[_0x9893('0x38')];if(!_0x275262['query'][_0x9893('0x58')](_0x9893('0x3a'))){_0x2d2542[_0x9893('0x20')]=qs[_0x9893('0x20')](_0x275262['query'][_0x9893('0x20')]);_0x2d2542[_0x9893('0x1e')]=qs[_0x9893('0x1e')](_0x275262['query'][_0x9893('0x1e')]);}return _0x524fb6[_0x9893('0x64')](_0x2d2542);}})['then'](function(_0x41500c){if(_0x41500c){return _0x41500c?{'count':_0x33138b,'rows':_0x41500c}:null;}})['then'](respondWithResult(_0x283ec7,null))[_0x9893('0x46')](handleError(_0x283ec7,null));};exports[_0x9893('0x66')]=function(_0x5d8f8a,_0x1f14e9,_0x5e73b8){var _0x906ba5=_0x5d8f8a['body'][_0x9893('0x67')];return db['Team'][_0x9893('0x5a')]({'where':{'id':_0x906ba5},'attributes':['id'],'include':[{'model':db[_0x9893('0x5b')],'as':_0x9893('0x68'),'attributes':['id',_0x9893('0x2e'),_0x9893('0x69'),'voicePause',_0x9893('0x6a')],'raw':!![]}]})[_0x9893('0x27')](function(_0x36d767){if(_0x36d767){var _0x33a4c8=_['flatMap'](_0x36d767,function(_0x270afa){var _0x32aa97=_0x270afa[_0x9893('0x28')]({'plain':!![]});return _0x32aa97[_0x9893('0x68')];});return db['WhatsappQueue'][_0x9893('0x4b')]({'where':{'id':_0x5d8f8a[_0x9893('0x48')]['id']}})[_0x9893('0x27')](function(_0x5ef793){return db[_0x9893('0x6b')][_0x9893('0x6c')](function(_0x3fc5a7){return _0x5ef793['addTeams'](_0x906ba5,{'transaction':_0x3fc5a7})[_0x9893('0x27')](function(){return BPromise[_0x9893('0x6d')](_0x33a4c8,function(_0x9da394){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x9da394['id'],'WhatsappQueueId':_0x5d8f8a[_0x9893('0x48')]['id']},'transaction':_0x3fc5a7});});})['then'](function(){_0x33a4c8[_0x9893('0x6e')](function(_0x4f3ede){socket['emit'](_0x9893('0x6f'),{'UserId':_0x4f3ede['id'],'WhatsappQueueId':_0x5ef793['id']});});});});});}})['then'](respondWithStatusCode(_0x1f14e9,null))[_0x9893('0x46')](handleError(_0x1f14e9,null));};exports[_0x9893('0x70')]=function(_0x5a3feb,_0x1ccbe7,_0xaa1229){return db[_0x9893('0x65')][_0x9893('0x5a')]({'where':{'id':_0x5a3feb[_0x9893('0x37')][_0x9893('0x67')]},'attributes':['id'],'include':[{'model':db[_0x9893('0x5b')],'as':_0x9893('0x68'),'attributes':['id'],'raw':!![]}]})[_0x9893('0x27')](handleEntityNotFound(_0x1ccbe7,null))[_0x9893('0x27')](function(_0x2bad68){var _0x33ff78=_[_0x9893('0x5d')](_0x2bad68,'id');var _0x1e5ba6=[];var _0x565235=[];var _0x148faa=squel['select']();_0x148faa['field']('tq.TeamId')[_0x9893('0x71')](_0x9893('0x72'),'tq')[_0x9893('0x73')](_0x9893('0x74'),'ut',_0x9893('0x75'))[_0x9893('0x3f')](_0x9893('0x76'),_0x5a3feb[_0x9893('0x48')]['id']);for(var _0x1c951f=0x0;_0x1c951f<_0x2bad68[_0x9893('0x38')];_0x1c951f+=0x1){let _0xed34f6=_0x2bad68[_0x1c951f];for(var _0x3b284c=0x0;_0x3b284c<_0xed34f6[_0x9893('0x68')][_0x9893('0x38')];_0x3b284c+=0x1){let _0x4a689d=_0xed34f6[_0x9893('0x68')][_0x3b284c];var _0x1be1bb=_0x148faa[_0x9893('0x77')]();_0x1be1bb['where'](_0x9893('0x78'),_0x4a689d['id']);_0x565235[_0x9893('0x79')](db[_0x9893('0x6b')][_0x9893('0x37')](_0x1be1bb[_0x9893('0x7a')](),{'type':db[_0x9893('0x6b')][_0x9893('0x7b')][_0x9893('0x7c')]})[_0x9893('0x27')](function(_0x2cc7e7){if(_0x2cc7e7['length']===0x1){return _0x4a689d['id'];}else{var _0x92d111=_[_0x9893('0x7d')](_[_0x9893('0x5d')](_0x2cc7e7,_0x9893('0x7e')),function(_0x5ee1e1){return _['includes'](_0x33ff78,_0x5ee1e1);});if(_0x92d111){return _0x4a689d['id'];}}}));}}return BPromise[_0x9893('0x7f')](_0x565235)[_0x9893('0x27')](function(_0x5ab1ce){_0x1e5ba6=_(_0x1e5ba6)[_0x9893('0x80')](_0x5ab1ce)[_0x9893('0x81')]()[_0x9893('0x82')]();return db[_0x9893('0x43')][_0x9893('0x4b')]({'where':{'id':_0x5a3feb[_0x9893('0x48')]['id']}})[_0x9893('0x27')](function(_0x1601f2){return db['sequelize'][_0x9893('0x6c')](function(_0xd9dd2){return _0x1601f2[_0x9893('0x70')](_0x5a3feb[_0x9893('0x37')][_0x9893('0x67')],{'transaction':_0xd9dd2})[_0x9893('0x27')](function(){if(!_[_0x9893('0x83')](_0x1e5ba6)){return _0x1601f2[_0x9893('0x84')](_0x1e5ba6,{'transaction':_0xd9dd2});}})['then'](function(){_0x1e5ba6[_0x9893('0x6e')](function(_0x17f606){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x17f606,'WhatsappQueueId':_0x1601f2['id']});});});});});});})[_0x9893('0x27')](respondWithStatusCode(_0x1ccbe7,null))['catch'](handleError(_0x1ccbe7,null));};exports[_0x9893('0x85')]=function(_0x3d8440,_0x2d6188,_0x3d4d97){return db[_0x9893('0x43')][_0x9893('0x4b')]({'where':{'id':_0x3d8440['params']['id']}})['then'](handleEntityNotFound(_0x2d6188,null))[_0x9893('0x27')](function(_0x4014dc){if(_0x4014dc){return _0x4014dc[_0x9893('0x85')](_0x3d8440[_0x9893('0x4d')][_0x9893('0x67')],_[_0x9893('0x86')](_0x3d8440[_0x9893('0x4d')],['ids','id'])||{})[_0x9893('0x87')](function(_0x49170d){for(var _0x27d602=0x0;_0x27d602<_0x3d8440[_0x9893('0x4d')][_0x9893('0x67')][_0x9893('0x38')];_0x27d602+=0x1){socket[_0x9893('0x88')](_0x9893('0x6f'),{'UserId':Number(_0x3d8440[_0x9893('0x4d')][_0x9893('0x67')][_0x27d602]),'WhatsappQueueId':Number(_0x3d8440['params']['id'])});}return _0x49170d;});}})[_0x9893('0x27')](respondWithResult(_0x2d6188,null))[_0x9893('0x46')](handleError(_0x2d6188,null));};exports[_0x9893('0x84')]=function(_0x46ee0e,_0x3c39c7,_0x5cceb2){return db[_0x9893('0x43')][_0x9893('0x4b')]({'where':{'id':_0x46ee0e['params']['id']}})[_0x9893('0x27')](handleEntityNotFound(_0x3c39c7,null))[_0x9893('0x27')](function(_0x559110){if(_0x559110){return _0x559110[_0x9893('0x84')](_0x46ee0e[_0x9893('0x37')][_0x9893('0x67')])['then'](function(){if(_[_0x9893('0x89')](_0x46ee0e[_0x9893('0x37')][_0x9893('0x67')])){for(var _0x1b043f=0x0;_0x1b043f<_0x46ee0e[_0x9893('0x37')][_0x9893('0x67')][_0x9893('0x38')];_0x1b043f+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x46ee0e['query'][_0x9893('0x67')][_0x1b043f]),'WhatsappQueueId':Number(_0x46ee0e[_0x9893('0x48')]['id'])});}}else{socket[_0x9893('0x88')](_0x9893('0x8a'),{'UserId':Number(_0x46ee0e['query'][_0x9893('0x67')]),'WhatsappQueueId':Number(_0x46ee0e['params']['id'])});}});}})[_0x9893('0x27')](respondWithStatusCode(_0x3c39c7,null))[_0x9893('0x46')](handleError(_0x3c39c7,null));};exports['getAgents']=function(_0x33b688,_0x1aaf75,_0x2ffee7){var _0x3d6636={};var _0x1a05c5={};var _0x483591;var _0x51d68d;return db[_0x9893('0x43')][_0x9893('0x55')]({'where':{'id':_0x33b688[_0x9893('0x48')]['id']}})['then'](handleEntityNotFound(_0x1aaf75,null))[_0x9893('0x27')](function(_0x2cd74c){if(_0x2cd74c){_0x483591=_0x2cd74c;_0x1a05c5['model']=_[_0x9893('0x49')](db[_0x9893('0x5b')]['rawAttributes']);_0x1a05c5[_0x9893('0x37')]=_[_0x9893('0x49')](_0x33b688['query']);_0x1a05c5[_0x9893('0x33')]=_['intersection'](_0x1a05c5[_0x9893('0x35')],_0x1a05c5[_0x9893('0x37')]);_0x3d6636['attributes']=_[_0x9893('0x34')](_0x1a05c5[_0x9893('0x35')],qs[_0x9893('0x36')](_0x33b688[_0x9893('0x37')]['fields']));_0x3d6636[_0x9893('0x39')]=_0x3d6636[_0x9893('0x39')][_0x9893('0x38')]?_0x3d6636[_0x9893('0x39')]:_0x1a05c5[_0x9893('0x35')];_0x3d6636['order']=qs['sort'](_0x33b688[_0x9893('0x37')]['sort']);_0x3d6636[_0x9893('0x3f')]=qs[_0x9893('0x33')](_[_0x9893('0x3d')](_0x33b688[_0x9893('0x37')],_0x1a05c5['filters']));if(_0x33b688[_0x9893('0x37')][_0x9893('0x3e')]){_0x3d6636[_0x9893('0x3f')]=_[_0x9893('0x41')](_0x3d6636[_0x9893('0x3f')],{'$or':_[_0x9893('0x5d')](_0x3d6636['attributes'],function(_0x8318f5){var _0x45077a={};_0x45077a[_0x8318f5]={'$like':'%'+_0x33b688[_0x9893('0x37')][_0x9893('0x3e')]+'%'};return _0x45077a;})});}_0x3d6636=_[_0x9893('0x41')]({},_0x3d6636,_0x33b688['options']);return _0x483591['getAgents'](_0x3d6636);}})[_0x9893('0x27')](function(_0xcd485){if(_0xcd485){_0x51d68d=_0xcd485[_0x9893('0x38')];if(!_0x33b688['query']['hasOwnProperty']('nolimit')){_0x3d6636[_0x9893('0x20')]=qs[_0x9893('0x20')](_0x33b688['query'][_0x9893('0x20')]);_0x3d6636[_0x9893('0x1e')]=qs['offset'](_0x33b688[_0x9893('0x37')][_0x9893('0x1e')]);}return _0x483591[_0x9893('0x8b')](_0x3d6636);}})[_0x9893('0x27')](function(_0xfb5ed5){if(_0xfb5ed5){return _0xfb5ed5?{'count':_0x51d68d,'rows':_0xfb5ed5}:null;}})[_0x9893('0x27')](respondWithResult(_0x1aaf75,null))[_0x9893('0x46')](handleError(_0x1aaf75,null));}; \ No newline at end of file +var _0xf877=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','WhatsappQueues','destroy','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','show','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','params','WhatsappQueueId','UserWhatsappQueue','findAll','User','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','userWhatsappQueue:remove','getAgents','hasOwnProperty','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x57cf37,_0x149b89){var _0x2df46f=function(_0x70283c){while(--_0x70283c){_0x57cf37['push'](_0x57cf37['shift']());}};_0x2df46f(++_0x149b89);}(_0xf877,0x110));var _0x7f87=function(_0x255428,_0x2eaf1f){_0x255428=_0x255428-0x0;var _0x24abea=_0xf877[_0x255428];return _0x24abea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f87('0x0'));var zipdir=require(_0x7f87('0x1'));var jsonpatch=require(_0x7f87('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7f87('0x3'));var Mustache=require(_0x7f87('0x4'));var util=require('util');var path=require(_0x7f87('0x5'));var sox=require(_0x7f87('0x6'));var csv=require(_0x7f87('0x7'));var ejs=require(_0x7f87('0x8'));var fs=require('fs');var fs_extra=require(_0x7f87('0x9'));var _=require(_0x7f87('0xa'));var squel=require(_0x7f87('0xb'));var crypto=require('crypto');var jsforce=require(_0x7f87('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7f87('0x7'));var querystring=require('querystring');var Papa=require(_0x7f87('0xd'));var Redis=require(_0x7f87('0xe'));var authService=require(_0x7f87('0xf'));var qs=require(_0x7f87('0x10'));var as=require(_0x7f87('0x11'));var hardwareService=require(_0x7f87('0x12'));var logger=require(_0x7f87('0x13'))(_0x7f87('0x14'));var utils=require('../../config/utils');var config=require(_0x7f87('0x15'));var licenseUtil=require(_0x7f87('0x16'));var db=require(_0x7f87('0x17'))['db'];config[_0x7f87('0x18')]=_[_0x7f87('0x19')](config[_0x7f87('0x18')],{'host':_0x7f87('0x1a'),'port':0x18eb});var socket=require(_0x7f87('0x1b'))(new Redis(config[_0x7f87('0x18')]));require('./whatsappQueue.socket')[_0x7f87('0x1c')](socket);function respondWithStatusCode(_0x2610df,_0x54ed29){_0x54ed29=_0x54ed29||0xcc;return function(_0x6fb1c8){if(_0x6fb1c8){return _0x2610df[_0x7f87('0x1d')](_0x54ed29);}return _0x2610df['status'](_0x54ed29)[_0x7f87('0x1e')]();};}function respondWithResult(_0x5b5319,_0x17e571){_0x17e571=_0x17e571||0xc8;return function(_0x3ee5b8){if(_0x3ee5b8){return _0x5b5319[_0x7f87('0x1f')](_0x17e571)['json'](_0x3ee5b8);}};}function respondWithFilteredResult(_0x55fb31,_0x243a79){return function(_0x6a7574){if(_0x6a7574){var _0x247521=typeof _0x243a79[_0x7f87('0x20')]===_0x7f87('0x21')&&typeof _0x243a79[_0x7f87('0x22')]===_0x7f87('0x21');var _0x850325=_0x6a7574[_0x7f87('0x23')];var _0x34b86b=_0x247521?0x0:_0x243a79['offset'];var _0x5960a8=_0x247521?_0x6a7574['count']:_0x243a79[_0x7f87('0x20')]+_0x243a79[_0x7f87('0x22')];var _0x24884c;if(_0x5960a8>=_0x850325){_0x5960a8=_0x850325;_0x24884c=0xc8;}else{_0x24884c=0xce;}_0x55fb31[_0x7f87('0x1f')](_0x24884c);return _0x55fb31[_0x7f87('0x24')](_0x7f87('0x25'),_0x34b86b+'-'+_0x5960a8+'/'+_0x850325)['json'](_0x6a7574);}return null;};}function patchUpdates(_0x4d84a6){return function(_0x318fc0){try{jsonpatch[_0x7f87('0x26')](_0x318fc0,_0x4d84a6,!![]);}catch(_0x2e7454){return BPromise[_0x7f87('0x27')](_0x2e7454);}return _0x318fc0['save']();};}function saveUpdates(_0x26d66,_0x37d8ca){return function(_0x155d9d){if(_0x155d9d){return _0x155d9d[_0x7f87('0x28')](_0x26d66)[_0x7f87('0x29')](function(_0xc3ef8f){return _0xc3ef8f;});}return null;};}function removeEntity(_0x467362,_0x3524c6){return function(_0x274fa9){if(_0x274fa9){return _0x274fa9['destroy']()[_0x7f87('0x29')](function(){var _0x34df95=_0x274fa9[_0x7f87('0x2a')]({'plain':!![]});var _0x4ac0e2=_0x7f87('0x2b');return db['UserProfileResource'][_0x7f87('0x2c')]({'where':{'type':_0x4ac0e2,'resourceId':_0x34df95['id']}})[_0x7f87('0x29')](function(){return _0x274fa9;});})['then'](function(){_0x467362[_0x7f87('0x1f')](0xcc)[_0x7f87('0x1e')]();});}};}function handleEntityNotFound(_0x35b456,_0x11a85e){return function(_0x4ea9bc){if(!_0x4ea9bc){_0x35b456[_0x7f87('0x1d')](0x194);}return _0x4ea9bc;};}function handleError(_0x230d9e,_0xa2730d){_0xa2730d=_0xa2730d||0x1f4;return function(_0x463437){logger[_0x7f87('0x2d')](_0x463437[_0x7f87('0x2e')]);if(_0x463437[_0x7f87('0x2f')]){delete _0x463437[_0x7f87('0x2f')];}_0x230d9e[_0x7f87('0x1f')](_0xa2730d)[_0x7f87('0x30')](_0x463437);};}exports[_0x7f87('0x31')]=function(_0x210686,_0x574141){var _0x2fe84f={},_0xbe8ce9={},_0x581b63={'count':0x0,'rows':[]};var _0x59c153=_[_0x7f87('0x32')](db[_0x7f87('0x33')][_0x7f87('0x34')],function(_0x17a283){return{'name':_0x17a283[_0x7f87('0x35')],'type':_0x17a283[_0x7f87('0x36')]['key']};});_0xbe8ce9[_0x7f87('0x37')]=_[_0x7f87('0x32')](_0x59c153,_0x7f87('0x2f'));_0xbe8ce9[_0x7f87('0x38')]=_['keys'](_0x210686[_0x7f87('0x38')]);_0xbe8ce9['filters']=_[_0x7f87('0x39')](_0xbe8ce9['model'],_0xbe8ce9[_0x7f87('0x38')]);_0x2fe84f[_0x7f87('0x3a')]=_['intersection'](_0xbe8ce9[_0x7f87('0x37')],qs[_0x7f87('0x3b')](_0x210686[_0x7f87('0x38')][_0x7f87('0x3b')]));_0x2fe84f[_0x7f87('0x3a')]=_0x2fe84f[_0x7f87('0x3a')][_0x7f87('0x3c')]?_0x2fe84f['attributes']:_0xbe8ce9['model'];if(!_0x210686[_0x7f87('0x38')]['hasOwnProperty'](_0x7f87('0x3d'))){_0x2fe84f[_0x7f87('0x22')]=qs[_0x7f87('0x22')](_0x210686[_0x7f87('0x38')][_0x7f87('0x22')]);_0x2fe84f['offset']=qs[_0x7f87('0x20')](_0x210686[_0x7f87('0x38')][_0x7f87('0x20')]);}_0x2fe84f[_0x7f87('0x3e')]=qs[_0x7f87('0x3f')](_0x210686[_0x7f87('0x38')]['sort']);_0x2fe84f[_0x7f87('0x40')]=qs[_0x7f87('0x41')](_[_0x7f87('0x42')](_0x210686[_0x7f87('0x38')],_0xbe8ce9[_0x7f87('0x41')]),_0x59c153);if(_0x210686['query']['filter']){_0x2fe84f[_0x7f87('0x40')]=_['merge'](_0x2fe84f['where'],{'$or':_[_0x7f87('0x32')](_0x59c153,function(_0x15bc4){if(_0x15bc4[_0x7f87('0x36')]!==_0x7f87('0x43')){var _0x49ec0e={};_0x49ec0e[_0x15bc4[_0x7f87('0x2f')]]={'$like':'%'+_0x210686['query'][_0x7f87('0x44')]+'%'};return _0x49ec0e;}})});}_0x2fe84f=_[_0x7f87('0x45')]({},_0x2fe84f,_0x210686[_0x7f87('0x46')]);var _0x1b4676={'where':_0x2fe84f[_0x7f87('0x40')]};return db['WhatsappQueue'][_0x7f87('0x23')](_0x1b4676)[_0x7f87('0x29')](function(_0x3c8d73){_0x581b63[_0x7f87('0x23')]=_0x3c8d73;if(_0x210686['query'][_0x7f87('0x47')]){_0x2fe84f[_0x7f87('0x48')]=[{'all':!![]}];}return db[_0x7f87('0x33')]['findAll'](_0x2fe84f);})[_0x7f87('0x29')](function(_0x569963){_0x581b63[_0x7f87('0x49')]=_0x569963;return _0x581b63;})[_0x7f87('0x29')](respondWithFilteredResult(_0x574141,_0x2fe84f))['catch'](handleError(_0x574141,null));};exports[_0x7f87('0x4a')]=function(_0x1619ec,_0x367934){var _0x2b276f={'raw':!![],'where':{'id':_0x1619ec['params']['id']}},_0x24d2ec={};_0x24d2ec[_0x7f87('0x37')]=_[_0x7f87('0x4b')](db[_0x7f87('0x33')]['rawAttributes']);_0x24d2ec['query']=_['keys'](_0x1619ec['query']);_0x24d2ec[_0x7f87('0x41')]=_[_0x7f87('0x39')](_0x24d2ec['model'],_0x24d2ec[_0x7f87('0x38')]);_0x2b276f['attributes']=_[_0x7f87('0x39')](_0x24d2ec['model'],qs[_0x7f87('0x3b')](_0x1619ec[_0x7f87('0x38')]['fields']));_0x2b276f['attributes']=_0x2b276f[_0x7f87('0x3a')][_0x7f87('0x3c')]?_0x2b276f[_0x7f87('0x3a')]:_0x24d2ec['model'];if(_0x1619ec[_0x7f87('0x38')][_0x7f87('0x47')]){_0x2b276f[_0x7f87('0x48')]=[{'all':!![]}];}_0x2b276f=_[_0x7f87('0x45')]({},_0x2b276f,_0x1619ec[_0x7f87('0x46')]);return db[_0x7f87('0x33')]['find'](_0x2b276f)[_0x7f87('0x29')](handleEntityNotFound(_0x367934,null))[_0x7f87('0x29')](respondWithResult(_0x367934,null))[_0x7f87('0x4c')](handleError(_0x367934,null));};exports['create']=function(_0x316dc7,_0x515788){return db[_0x7f87('0x33')][_0x7f87('0x4d')](_0x316dc7[_0x7f87('0x4e')],{})[_0x7f87('0x29')](function(_0x335ed0){var _0x34b37b=_0x316dc7[_0x7f87('0x4f')][_0x7f87('0x2a')]({'plain':!![]});if(!_0x34b37b)throw new Error(_0x7f87('0x50'));if(_0x34b37b[_0x7f87('0x51')]===_0x7f87('0x4f')){var _0x3e5b33=_0x335ed0[_0x7f87('0x2a')]({'plain':!![]});var _0x216dd9='WhatsappQueues';return db[_0x7f87('0x52')]['find']({'where':{'name':_0x216dd9,'userProfileId':_0x34b37b[_0x7f87('0x53')]},'raw':!![]})['then'](function(_0x3cc443){if(_0x3cc443&&_0x3cc443[_0x7f87('0x54')]===0x0){return db[_0x7f87('0x55')][_0x7f87('0x4d')]({'name':_0x3e5b33[_0x7f87('0x2f')],'resourceId':_0x3e5b33['id'],'type':_0x3cc443[_0x7f87('0x2f')],'sectionId':_0x3cc443['id']},{})[_0x7f87('0x29')](function(){return _0x335ed0;});}else{return _0x335ed0;}})[_0x7f87('0x4c')](function(_0x40d72c){logger['error'](_0x7f87('0x56'),_0x40d72c);throw _0x40d72c;});}return _0x335ed0;})[_0x7f87('0x29')](respondWithResult(_0x515788,0xc9))[_0x7f87('0x4c')](handleError(_0x515788,null));};exports[_0x7f87('0x28')]=function(_0x5134ff,_0x5b9f44){if(_0x5134ff[_0x7f87('0x4e')]['id']){delete _0x5134ff['body']['id'];}return db[_0x7f87('0x33')][_0x7f87('0x57')]({'where':{'id':_0x5134ff['params']['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0x5b9f44,null))[_0x7f87('0x29')](saveUpdates(_0x5134ff['body'],null))['then'](respondWithResult(_0x5b9f44,null))[_0x7f87('0x4c')](handleError(_0x5b9f44,null));};exports['destroy']=function(_0x13ce0e,_0xbdde13){return db[_0x7f87('0x33')][_0x7f87('0x57')]({'where':{'id':_0x13ce0e['params']['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0xbdde13,null))[_0x7f87('0x29')](removeEntity(_0xbdde13,null))[_0x7f87('0x4c')](handleError(_0xbdde13,null));};exports[_0x7f87('0x58')]=function(_0x8dfea7,_0x4b7928){return db[_0x7f87('0x33')][_0x7f87('0x58')]()[_0x7f87('0x29')](respondWithResult(_0x4b7928,null))['catch'](handleError(_0x4b7928,null));};exports[_0x7f87('0x59')]=function(_0x533dcc,_0x35678c,_0x4178a7){var _0x5351de={'raw':!![],'where':{}},_0x519328={},_0x5875b7;return db['WhatsappQueue'][_0x7f87('0x5a')]({'where':{'id':_0x533dcc[_0x7f87('0x5b')]['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0x35678c,null))[_0x7f87('0x29')](function(_0x4f6d34){if(_0x4f6d34){_0x5875b7=_0x4f6d34[_0x7f87('0x2a')]({'plain':!![]});_0x519328[_0x7f87('0x37')]=_['keys'](db['UserWhatsappQueue'][_0x7f87('0x34')]);_0x519328[_0x7f87('0x38')]=_[_0x7f87('0x4b')](_0x533dcc['query']);_0x519328['filters']=_[_0x7f87('0x39')](_0x519328[_0x7f87('0x37')],_0x519328[_0x7f87('0x38')]);_0x5351de['attributes']=_[_0x7f87('0x39')](_0x519328[_0x7f87('0x37')],qs[_0x7f87('0x3b')](_0x533dcc[_0x7f87('0x38')]['fields']));_0x5351de['attributes']=_0x5351de[_0x7f87('0x3a')][_0x7f87('0x3c')]?_0x5351de['attributes']:_0x519328[_0x7f87('0x37')];if(!_0x533dcc[_0x7f87('0x38')]['hasOwnProperty'](_0x7f87('0x3d'))){_0x5351de[_0x7f87('0x22')]=qs['limit'](_0x533dcc[_0x7f87('0x38')][_0x7f87('0x22')]);_0x5351de[_0x7f87('0x20')]=qs[_0x7f87('0x20')](_0x533dcc[_0x7f87('0x38')][_0x7f87('0x20')]);}_0x5351de[_0x7f87('0x3e')]=qs[_0x7f87('0x3f')](_0x533dcc[_0x7f87('0x38')]['sort']);_0x5351de[_0x7f87('0x40')]=qs[_0x7f87('0x41')](_[_0x7f87('0x42')](_0x533dcc[_0x7f87('0x38')],_0x519328[_0x7f87('0x41')]));_0x5351de[_0x7f87('0x40')][_0x7f87('0x5c')]=_0x4f6d34['id'];if(_0x533dcc[_0x7f87('0x38')][_0x7f87('0x44')]){_0x5351de[_0x7f87('0x40')]=_['merge'](_0x5351de[_0x7f87('0x40')],{'$or':_[_0x7f87('0x32')](_0x5351de[_0x7f87('0x3a')],function(_0x503d81){var _0x30d4d4={};_0x30d4d4[_0x503d81]={'$like':'%'+_0x533dcc['query']['filter']+'%'};return _0x30d4d4;})});}_0x5351de=_[_0x7f87('0x45')]({},_0x5351de,_0x533dcc[_0x7f87('0x46')]);return db[_0x7f87('0x5d')][_0x7f87('0x5e')](_0x5351de);}})[_0x7f87('0x29')](function(_0x10e92e){if(_0x10e92e){return db[_0x7f87('0x5f')]['findAndCountAll']({'where':{'id':_[_0x7f87('0x32')](_0x10e92e,_0x7f87('0x60')),'role':_0x7f87('0x61')},'attributes':['id',_0x7f87('0x2f'),_0x7f87('0x62'),'updatedAt',_0x7f87('0x63')]});}})['then'](function(_0x188dc7){if(_0x188dc7){return{'count':_0x188dc7[_0x7f87('0x23')],'rows':_[_0x7f87('0x32')](_0x188dc7['rows'],function(_0x1ba389){return{'membername':_0x1ba389[_0x7f87('0x2f')],'UserId':_0x1ba389['id'],'queue_name':_0x5875b7['name'],'WhatsappQueueId':_0x5875b7['id'],'interface':util[_0x7f87('0x64')](_0x7f87('0x65'),_0x7f87('0x66'),_0x1ba389[_0x7f87('0x2f')]),'penalty':0x0,'paused':_0x1ba389['whatsappPause'],'createdAt':_0x1ba389[_0x7f87('0x63')],'updatedAt':_0x1ba389['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7f87('0x29')](respondWithFilteredResult(_0x35678c,_0x5351de))[_0x7f87('0x4c')](handleError(_0x35678c,null));};exports[_0x7f87('0x67')]=function(_0x5b4f55,_0x5cf765,_0x3ad04c){var _0x4a3864={};var _0x5699c7={};var _0x56f880;var _0x303953;return db[_0x7f87('0x33')][_0x7f87('0x5a')]({'where':{'id':_0x5b4f55[_0x7f87('0x5b')]['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0x5cf765,null))[_0x7f87('0x29')](function(_0x19ca76){if(_0x19ca76){_0x56f880=_0x19ca76;_0x5699c7[_0x7f87('0x37')]=_[_0x7f87('0x4b')](db['Team'][_0x7f87('0x34')]);_0x5699c7[_0x7f87('0x38')]=_[_0x7f87('0x4b')](_0x5b4f55[_0x7f87('0x38')]);_0x5699c7[_0x7f87('0x41')]=_[_0x7f87('0x39')](_0x5699c7[_0x7f87('0x37')],_0x5699c7['query']);_0x4a3864[_0x7f87('0x3a')]=_[_0x7f87('0x39')](_0x5699c7['model'],qs['fields'](_0x5b4f55[_0x7f87('0x38')][_0x7f87('0x3b')]));_0x4a3864[_0x7f87('0x3a')]=_0x4a3864['attributes'][_0x7f87('0x3c')]?_0x4a3864[_0x7f87('0x3a')]:_0x5699c7['model'];_0x4a3864['order']=qs[_0x7f87('0x3f')](_0x5b4f55['query']['sort']);_0x4a3864['where']=qs[_0x7f87('0x41')](_[_0x7f87('0x42')](_0x5b4f55[_0x7f87('0x38')],_0x5699c7[_0x7f87('0x41')]));if(_0x5b4f55[_0x7f87('0x38')][_0x7f87('0x44')]){_0x4a3864[_0x7f87('0x40')]=_['merge'](_0x4a3864[_0x7f87('0x40')],{'$or':_[_0x7f87('0x32')](_0x4a3864['attributes'],function(_0x523266){var _0x7e15ff={};_0x7e15ff[_0x523266]={'$like':'%'+_0x5b4f55[_0x7f87('0x38')]['filter']+'%'};return _0x7e15ff;})});}_0x4a3864=_[_0x7f87('0x45')]({},_0x4a3864,_0x5b4f55[_0x7f87('0x46')]);return _0x56f880[_0x7f87('0x67')](_0x4a3864);}})[_0x7f87('0x29')](function(_0x36f931){if(_0x36f931){_0x303953=_0x36f931[_0x7f87('0x3c')];if(!_0x5b4f55['query']['hasOwnProperty']('nolimit')){_0x4a3864[_0x7f87('0x22')]=qs['limit'](_0x5b4f55[_0x7f87('0x38')][_0x7f87('0x22')]);_0x4a3864[_0x7f87('0x20')]=qs[_0x7f87('0x20')](_0x5b4f55[_0x7f87('0x38')]['offset']);}return _0x56f880[_0x7f87('0x67')](_0x4a3864);}})[_0x7f87('0x29')](function(_0x1d9ba5){if(_0x1d9ba5){return _0x1d9ba5?{'count':_0x303953,'rows':_0x1d9ba5}:null;}})['then'](respondWithResult(_0x5cf765,null))['catch'](handleError(_0x5cf765,null));};exports[_0x7f87('0x68')]=function(_0x272914,_0x20217a,_0x20b160){var _0x3e68d=_0x272914['body'][_0x7f87('0x69')];return db[_0x7f87('0x6a')][_0x7f87('0x5e')]({'where':{'id':_0x3e68d},'attributes':['id'],'include':[{'model':db[_0x7f87('0x5f')],'as':_0x7f87('0x6b'),'attributes':['id',_0x7f87('0x2f'),_0x7f87('0x6c'),_0x7f87('0x6d'),_0x7f87('0x6e')],'raw':!![]}]})[_0x7f87('0x29')](function(_0x3fbdfd){if(_0x3fbdfd){var _0x2eeb9a=_[_0x7f87('0x6f')](_0x3fbdfd,function(_0xf7e549){var _0x4e436a=_0xf7e549['get']({'plain':!![]});return _0x4e436a[_0x7f87('0x6b')];});return db['WhatsappQueue'][_0x7f87('0x57')]({'where':{'id':_0x272914[_0x7f87('0x5b')]['id']}})[_0x7f87('0x29')](function(_0xee5f78){return db['sequelize']['transaction'](function(_0x5a6fa1){return _0xee5f78['addTeams'](_0x3e68d,{'transaction':_0x5a6fa1})[_0x7f87('0x29')](function(){return BPromise['each'](_0x2eeb9a,function(_0x23f802){return db[_0x7f87('0x5d')]['findOrCreate']({'where':{'UserId':_0x23f802['id'],'WhatsappQueueId':_0x272914['params']['id']},'transaction':_0x5a6fa1});});})['then'](function(){_0x2eeb9a[_0x7f87('0x70')](function(_0x562e7a){socket[_0x7f87('0x71')](_0x7f87('0x72'),{'UserId':_0x562e7a['id'],'WhatsappQueueId':_0xee5f78['id']});});});});});}})[_0x7f87('0x29')](respondWithStatusCode(_0x20217a,null))[_0x7f87('0x4c')](handleError(_0x20217a,null));};exports[_0x7f87('0x73')]=function(_0x13edcb,_0x3ac438,_0x1f94ce){return db['Team'][_0x7f87('0x5e')]({'where':{'id':_0x13edcb[_0x7f87('0x38')][_0x7f87('0x69')]},'attributes':['id'],'include':[{'model':db[_0x7f87('0x5f')],'as':_0x7f87('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3ac438,null))[_0x7f87('0x29')](function(_0x3dd810){var _0x20193c=_[_0x7f87('0x32')](_0x3dd810,'id');var _0xc35d59=[];var _0x1df3ce=[];var _0x2aa91a=squel[_0x7f87('0x74')]();_0x2aa91a[_0x7f87('0x75')](_0x7f87('0x76'))[_0x7f87('0x77')](_0x7f87('0x78'),'tq')[_0x7f87('0x79')](_0x7f87('0x7a'),'ut',_0x7f87('0x7b'))[_0x7f87('0x40')](_0x7f87('0x7c'),_0x13edcb[_0x7f87('0x5b')]['id']);for(var _0xfa6eb=0x0;_0xfa6eb<_0x3dd810['length'];_0xfa6eb+=0x1){let _0x1563a9=_0x3dd810[_0xfa6eb];for(var _0x3960ad=0x0;_0x3960ad<_0x1563a9[_0x7f87('0x6b')][_0x7f87('0x3c')];_0x3960ad+=0x1){let _0xc63741=_0x1563a9['Agents'][_0x3960ad];var _0x3d007b=_0x2aa91a['clone']();_0x3d007b[_0x7f87('0x40')](_0x7f87('0x7d'),_0xc63741['id']);_0x1df3ce[_0x7f87('0x7e')](db['sequelize'][_0x7f87('0x38')](_0x3d007b[_0x7f87('0x7f')](),{'type':db['sequelize'][_0x7f87('0x80')]['SELECT']})[_0x7f87('0x29')](function(_0x58ff64){if(_0x58ff64['length']===0x1){return _0xc63741['id'];}else{var _0x44a4cf=_[_0x7f87('0x81')](_[_0x7f87('0x32')](_0x58ff64,_0x7f87('0x82')),function(_0x32bb10){return _[_0x7f87('0x83')](_0x20193c,_0x32bb10);});if(_0x44a4cf){return _0xc63741['id'];}}}));}}return BPromise[_0x7f87('0x84')](_0x1df3ce)[_0x7f87('0x29')](function(_0xc28612){_0xc35d59=_(_0xc35d59)[_0x7f87('0x85')](_0xc28612)[_0x7f87('0x86')]()['value']();return db[_0x7f87('0x33')]['find']({'where':{'id':_0x13edcb[_0x7f87('0x5b')]['id']}})[_0x7f87('0x29')](function(_0x4cf8af){return db[_0x7f87('0x87')][_0x7f87('0x88')](function(_0x2f8d95){return _0x4cf8af[_0x7f87('0x73')](_0x13edcb[_0x7f87('0x38')]['ids'],{'transaction':_0x2f8d95})[_0x7f87('0x29')](function(){if(!_[_0x7f87('0x89')](_0xc35d59)){return _0x4cf8af[_0x7f87('0x8a')](_0xc35d59,{'transaction':_0x2f8d95});}})[_0x7f87('0x29')](function(){_0xc35d59[_0x7f87('0x70')](function(_0x5ddc1e){socket[_0x7f87('0x71')]('userWhatsappQueue:remove',{'UserId':_0x5ddc1e,'WhatsappQueueId':_0x4cf8af['id']});});});});});});})[_0x7f87('0x29')](respondWithStatusCode(_0x3ac438,null))[_0x7f87('0x4c')](handleError(_0x3ac438,null));};exports[_0x7f87('0x8b')]=function(_0x4d2188,_0x5778f0,_0x5efb0b){return db[_0x7f87('0x33')][_0x7f87('0x57')]({'where':{'id':_0x4d2188['params']['id']}})['then'](handleEntityNotFound(_0x5778f0,null))[_0x7f87('0x29')](function(_0x3a7b7c){if(_0x3a7b7c){return _0x3a7b7c[_0x7f87('0x8b')](_0x4d2188['body'][_0x7f87('0x69')],_[_0x7f87('0x8c')](_0x4d2188['body'],['ids','id'])||{})[_0x7f87('0x8d')](function(_0x468360){for(var _0x5f1fdf=0x0;_0x5f1fdf<_0x4d2188[_0x7f87('0x4e')][_0x7f87('0x69')][_0x7f87('0x3c')];_0x5f1fdf+=0x1){socket[_0x7f87('0x71')]('userWhatsappQueue:save',{'UserId':Number(_0x4d2188[_0x7f87('0x4e')]['ids'][_0x5f1fdf]),'WhatsappQueueId':Number(_0x4d2188[_0x7f87('0x5b')]['id'])});}return _0x468360;});}})[_0x7f87('0x29')](respondWithResult(_0x5778f0,null))[_0x7f87('0x4c')](handleError(_0x5778f0,null));};exports['removeAgents']=function(_0x12faff,_0x237f8a,_0x53f658){return db[_0x7f87('0x33')][_0x7f87('0x57')]({'where':{'id':_0x12faff['params']['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0x237f8a,null))[_0x7f87('0x29')](function(_0x4b807c){if(_0x4b807c){return _0x4b807c[_0x7f87('0x8a')](_0x12faff[_0x7f87('0x38')]['ids'])[_0x7f87('0x29')](function(){if(_['isArray'](_0x12faff[_0x7f87('0x38')][_0x7f87('0x69')])){for(var _0x1c5e08=0x0;_0x1c5e08<_0x12faff['query'][_0x7f87('0x69')][_0x7f87('0x3c')];_0x1c5e08+=0x1){socket['emit'](_0x7f87('0x8e'),{'UserId':Number(_0x12faff[_0x7f87('0x38')]['ids'][_0x1c5e08]),'WhatsappQueueId':Number(_0x12faff[_0x7f87('0x5b')]['id'])});}}else{socket[_0x7f87('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x12faff[_0x7f87('0x38')][_0x7f87('0x69')]),'WhatsappQueueId':Number(_0x12faff[_0x7f87('0x5b')]['id'])});}});}})[_0x7f87('0x29')](respondWithStatusCode(_0x237f8a,null))['catch'](handleError(_0x237f8a,null));};exports[_0x7f87('0x8f')]=function(_0x514222,_0x470540,_0x4bba4a){var _0x5c14f0={};var _0x5dc53d={};var _0x1cacc8;var _0x387f81;return db[_0x7f87('0x33')][_0x7f87('0x5a')]({'where':{'id':_0x514222[_0x7f87('0x5b')]['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0x470540,null))[_0x7f87('0x29')](function(_0x1536dc){if(_0x1536dc){_0x1cacc8=_0x1536dc;_0x5dc53d['model']=_['keys'](db[_0x7f87('0x5f')][_0x7f87('0x34')]);_0x5dc53d[_0x7f87('0x38')]=_[_0x7f87('0x4b')](_0x514222['query']);_0x5dc53d[_0x7f87('0x41')]=_[_0x7f87('0x39')](_0x5dc53d[_0x7f87('0x37')],_0x5dc53d[_0x7f87('0x38')]);_0x5c14f0[_0x7f87('0x3a')]=_[_0x7f87('0x39')](_0x5dc53d[_0x7f87('0x37')],qs[_0x7f87('0x3b')](_0x514222['query'][_0x7f87('0x3b')]));_0x5c14f0['attributes']=_0x5c14f0[_0x7f87('0x3a')][_0x7f87('0x3c')]?_0x5c14f0[_0x7f87('0x3a')]:_0x5dc53d[_0x7f87('0x37')];_0x5c14f0[_0x7f87('0x3e')]=qs[_0x7f87('0x3f')](_0x514222['query'][_0x7f87('0x3f')]);_0x5c14f0[_0x7f87('0x40')]=qs[_0x7f87('0x41')](_['pick'](_0x514222[_0x7f87('0x38')],_0x5dc53d['filters']));if(_0x514222[_0x7f87('0x38')][_0x7f87('0x44')]){_0x5c14f0[_0x7f87('0x40')]=_[_0x7f87('0x45')](_0x5c14f0[_0x7f87('0x40')],{'$or':_[_0x7f87('0x32')](_0x5c14f0['attributes'],function(_0x45babe){var _0x447f72={};_0x447f72[_0x45babe]={'$like':'%'+_0x514222['query'][_0x7f87('0x44')]+'%'};return _0x447f72;})});}_0x5c14f0=_[_0x7f87('0x45')]({},_0x5c14f0,_0x514222['options']);return _0x1cacc8[_0x7f87('0x8f')](_0x5c14f0);}})[_0x7f87('0x29')](function(_0x4bf498){if(_0x4bf498){_0x387f81=_0x4bf498[_0x7f87('0x3c')];if(!_0x514222['query'][_0x7f87('0x90')](_0x7f87('0x3d'))){_0x5c14f0[_0x7f87('0x22')]=qs['limit'](_0x514222[_0x7f87('0x38')][_0x7f87('0x22')]);_0x5c14f0[_0x7f87('0x20')]=qs['offset'](_0x514222['query'][_0x7f87('0x20')]);}return _0x1cacc8[_0x7f87('0x8f')](_0x5c14f0);}})['then'](function(_0x1e3bb2){if(_0x1e3bb2){return _0x1e3bb2?{'count':_0x387f81,'rows':_0x1e3bb2}:null;}})[_0x7f87('0x29')](respondWithResult(_0x470540,null))['catch'](handleError(_0x470540,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index d97fa6e..c97a06f 100644 --- a/server/api/whatsappQueue/whatsappQueue.events.js +++ b/server/api/whatsappQueue/whatsappQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4bd=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4bd,0x86));var _0xde4b=function(_0x397f0d,_0x591b02){_0x397f0d=_0x397f0d-0x0;var _0x176050=_0xe4bd[_0x397f0d];return _0x176050;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xde4b('0x0'))['db'][_0xde4b('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xde4b('0x2'),'afterDestroy':_0xde4b('0x3')};function emitEvent(_0x3634cf){return function(_0x5d5e1d,_0x273915,_0x38ff53){WhatsappQueueEvents[_0xde4b('0x4')](_0x3634cf+':'+_0x5d5e1d['id'],_0x5d5e1d);WhatsappQueueEvents[_0xde4b('0x4')](_0x3634cf,_0x5d5e1d);_0x38ff53(null);};}for(var e in events){if(events[_0xde4b('0x5')](e)){var event=events[e];WhatsappQueue[_0xde4b('0x6')](e,emitEvent(event));}}module[_0xde4b('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x2669=['update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x2669,0x76));var _0x9266=function(_0x438459,_0x5a601f){_0x438459=_0x438459-0x0;var _0x15be84=_0x2669[_0x438459];return _0x15be84;};'use strict';var EventEmitter=require(_0x9266('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x9266('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9266('0x2'),'afterDestroy':_0x9266('0x3')};function emitEvent(_0x24e30b){return function(_0x3dc3d0,_0x4ca9ac,_0x236973){WhatsappQueueEvents[_0x9266('0x4')](_0x24e30b+':'+_0x3dc3d0['id'],_0x3dc3d0);WhatsappQueueEvents['emit'](_0x24e30b,_0x3dc3d0);_0x236973(null);};}for(var e in events){if(events[_0x9266('0x5')](e)){var event=events[e];WhatsappQueue[_0x9266('0x6')](e,emitEvent(event));}}module[_0x9266('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ac75f42..e963b43 100644 --- a/server/api/whatsappQueue/whatsappQueue.model.js +++ b/server/api/whatsappQueue/whatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x487b=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x208907,_0x1a4224){var _0x34e981=function(_0x308567){while(--_0x308567){_0x208907['push'](_0x208907['shift']());}};_0x34e981(++_0x1a4224);}(_0x487b,0x12b));var _0xb487=function(_0x41fcf1,_0xc3f450){_0x41fcf1=_0x41fcf1-0x0;var _0x2f14f8=_0x487b[_0x41fcf1];return _0x2f14f8;};'use strict';var _=require(_0xb487('0x0'));var util=require(_0xb487('0x1'));var logger=require(_0xb487('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb487('0x3'));var rp=require(_0xb487('0x4'));var fs=require('fs');var path=require(_0xb487('0x5'));var rimraf=require('rimraf');var config=require(_0xb487('0x6'));var attributes=require(_0xb487('0x7'));module[_0xb487('0x8')]=function(_0x4b647c,_0x52b178){return _0x4b647c[_0xb487('0x9')](_0xb487('0xa'),attributes,{'tableName':_0xb487('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7aa=['util','moment','path','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xd7aa,0xa1));var _0xad7a=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0xd7aa[_0x43a1b8];return _0x324ecc;};'use strict';var _=require(_0xad7a('0x0'));var util=require(_0xad7a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xad7a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xad7a('0x3'));var rimraf=require('rimraf');var config=require(_0xad7a('0x4'));var attributes=require('./whatsappQueue.attributes');module[_0xad7a('0x5')]=function(_0x1a74df,_0x1fa489){return _0x1a74df[_0xad7a('0x6')](_0xad7a('0x7'),attributes,{'tableName':_0xad7a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index a12fb01..4936de8 100644 --- a/server/api/whatsappQueue/whatsappQueue.rpc.js +++ b/server/api/whatsappQueue/whatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fd1=['code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','include','map','model','raw','debug','ShowWhatsappQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x29ee72,_0x2f3192){var _0xdde355=function(_0x391524){while(--_0x391524){_0x29ee72['push'](_0x29ee72['shift']());}};_0xdde355(++_0x2f3192);}(_0x9fd1,0x197));var _0x19fd=function(_0x1739ba,_0x56fe44){_0x1739ba=_0x1739ba-0x0;var _0x3af780=_0x9fd1[_0x1739ba];return _0x3af780;};'use strict';var _=require(_0x19fd('0x0'));var util=require(_0x19fd('0x1'));var moment=require(_0x19fd('0x2'));var BPromise=require(_0x19fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19fd('0x4'));var db=require(_0x19fd('0x5'))['db'];var utils=require(_0x19fd('0x6'));var logger=require(_0x19fd('0x7'))(_0x19fd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x19fd('0x9')][_0x19fd('0xa')]({'port':0x232a});config[_0x19fd('0xb')]=_[_0x19fd('0xc')](config[_0x19fd('0xb')],{'host':_0x19fd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x19fd('0xb')]));require(_0x19fd('0xe'))[_0x19fd('0xf')](socket);function respondWithRpcPromise(_0xb2ed4c,_0x1d4c89,_0x348b16){return new BPromise(function(_0xa1a7d2,_0x3deac7){return client[_0x19fd('0x10')](_0xb2ed4c,_0x348b16)[_0x19fd('0x11')](function(_0x32a674){logger['info'](_0x19fd('0x12'),_0x1d4c89,_0x19fd('0x13'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1d4c89,_0x19fd('0x13'),JSON[_0x19fd('0x14')](_0x32a674));if(_0x32a674['error']){if(_0x32a674[_0x19fd('0x15')][_0x19fd('0x16')]===0x1f4){logger[_0x19fd('0x15')](_0x19fd('0x12'),_0x1d4c89,_0x32a674[_0x19fd('0x15')]['message']);return _0x3deac7(_0x32a674[_0x19fd('0x15')][_0x19fd('0x17')]);}logger[_0x19fd('0x15')](_0x19fd('0x12'),_0x1d4c89,_0x32a674['error']['message']);return _0xa1a7d2(_0x32a674[_0x19fd('0x15')][_0x19fd('0x17')]);}else{logger[_0x19fd('0x18')](_0x19fd('0x12'),_0x1d4c89,_0x19fd('0x13'));_0xa1a7d2(_0x32a674[_0x19fd('0x19')][_0x19fd('0x17')]);}})[_0x19fd('0x1a')](function(_0x1dbc97){logger[_0x19fd('0x15')](_0x19fd('0x12'),_0x1d4c89,_0x1dbc97);_0x3deac7(_0x1dbc97);});});}exports[_0x19fd('0x1b')]=function(_0x13b2d2){var _0x2a56cc=this;return new Promise(function(_0x5859f5,_0x3ccd66){return db[_0x19fd('0x1c')][_0x19fd('0x1d')]({'raw':_0x13b2d2[_0x19fd('0x1e')]?_0x13b2d2[_0x19fd('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x13b2d2[_0x19fd('0x1e')]?_0x13b2d2[_0x19fd('0x1e')][_0x19fd('0x1f')]||null:null,'attributes':_0x13b2d2['options']?_0x13b2d2[_0x19fd('0x1e')][_0x19fd('0x20')]||null:null,'limit':_0x13b2d2['options']?_0x13b2d2[_0x19fd('0x1e')]['limit']||null:null,'include':_0x13b2d2[_0x19fd('0x1e')]?_0x13b2d2[_0x19fd('0x1e')][_0x19fd('0x21')]?_[_0x19fd('0x22')](_0x13b2d2[_0x19fd('0x1e')][_0x19fd('0x21')],function(_0x5d865d){return{'model':db[_0x5d865d[_0x19fd('0x23')]],'as':_0x5d865d['as'],'attributes':_0x5d865d['attributes'],'include':_0x5d865d['include']?_[_0x19fd('0x22')](_0x5d865d[_0x19fd('0x21')],function(_0x394aa6){return{'model':db[_0x394aa6['model']],'as':_0x394aa6['as'],'attributes':_0x394aa6['attributes'],'include':_0x394aa6[_0x19fd('0x21')]?_[_0x19fd('0x22')](_0x394aa6[_0x19fd('0x21')],function(_0x37b0a7){return{'model':db[_0x37b0a7[_0x19fd('0x23')]],'as':_0x37b0a7['as'],'attributes':_0x37b0a7[_0x19fd('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x453667){logger[_0x19fd('0x18')](_0x19fd('0x1b'),_0x13b2d2);logger['debug'](_0x19fd('0x1b'),_0x13b2d2,JSON['stringify'](_0x453667));_0x5859f5(_0x453667);})[_0x19fd('0x1a')](function(_0xb6a613){logger[_0x19fd('0x15')]('GetWhatsappQueue',_0xb6a613[_0x19fd('0x17')],_0x13b2d2);_0x3ccd66(_0x2a56cc[_0x19fd('0x15')](0x1f4,_0xb6a613['message']));});});};exports['ShowWhatsappQueue']=function(_0x258e1a){var _0x5031ca=this;return new Promise(function(_0x14a3ca,_0x450586){return db[_0x19fd('0x1c')]['find']({'raw':_0x258e1a[_0x19fd('0x1e')]?_0x258e1a[_0x19fd('0x1e')][_0x19fd('0x24')]===undefined?!![]:![]:!![],'where':_0x258e1a[_0x19fd('0x1e')]?_0x258e1a[_0x19fd('0x1e')][_0x19fd('0x1f')]||null:null,'attributes':_0x258e1a['options']?_0x258e1a[_0x19fd('0x1e')][_0x19fd('0x20')]||null:null,'include':_0x258e1a[_0x19fd('0x1e')]?_0x258e1a[_0x19fd('0x1e')][_0x19fd('0x21')]?_[_0x19fd('0x22')](_0x258e1a['options']['include'],function(_0x5b5f93){return{'model':db[_0x5b5f93[_0x19fd('0x23')]],'as':_0x5b5f93['as'],'attributes':_0x5b5f93[_0x19fd('0x20')],'include':_0x5b5f93[_0x19fd('0x21')]?_['map'](_0x5b5f93[_0x19fd('0x21')],function(_0x1e2c42){return{'model':db[_0x1e2c42[_0x19fd('0x23')]],'as':_0x1e2c42['as'],'attributes':_0x1e2c42[_0x19fd('0x20')],'include':_0x1e2c42[_0x19fd('0x21')]?_[_0x19fd('0x22')](_0x1e2c42[_0x19fd('0x21')],function(_0x1edbaf){return{'model':db[_0x1edbaf['model']],'as':_0x1edbaf['as'],'attributes':_0x1edbaf['attributes']};}):[]};}):[]};}):[]:[]})[_0x19fd('0x11')](function(_0xafb319){logger[_0x19fd('0x18')]('ShowWhatsappQueue',_0x258e1a);logger[_0x19fd('0x25')](_0x19fd('0x26'),_0x258e1a,JSON['stringify'](_0xafb319));_0x14a3ca(_0xafb319);})['catch'](function(_0xd9d8b5){logger[_0x19fd('0x15')](_0x19fd('0x26'),_0xd9d8b5[_0x19fd('0x17')],_0x258e1a);_0x450586(_0x5031ca[_0x19fd('0x15')](0x1f4,_0xd9d8b5[_0x19fd('0x17')]));});});}; \ No newline at end of file +var _0x2ffe=['socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','include','map','model','attributes','stringify','find','raw','ShowWhatsappQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x2ffe,0x149));var _0xe2ff=function(_0x1cdd85,_0x572e2e){_0x1cdd85=_0x1cdd85-0x0;var _0xd0096f=_0x2ffe[_0x1cdd85];return _0xd0096f;};'use strict';var _=require(_0xe2ff('0x0'));var util=require(_0xe2ff('0x1'));var moment=require('moment');var BPromise=require(_0xe2ff('0x2'));var rs=require(_0xe2ff('0x3'));var fs=require('fs');var Redis=require(_0xe2ff('0x4'));var db=require(_0xe2ff('0x5'))['db'];var utils=require(_0xe2ff('0x6'));var logger=require(_0xe2ff('0x7'))(_0xe2ff('0x8'));var config=require('../../config/environment');var jayson=require(_0xe2ff('0x9'));var client=jayson[_0xe2ff('0xa')][_0xe2ff('0xb')]({'port':0x232a});config[_0xe2ff('0xc')]=_[_0xe2ff('0xd')](config[_0xe2ff('0xc')],{'host':_0xe2ff('0xe'),'port':0x18eb});var socket=require(_0xe2ff('0xf'))(new Redis(config[_0xe2ff('0xc')]));require(_0xe2ff('0x10'))[_0xe2ff('0x11')](socket);function respondWithRpcPromise(_0x140cfc,_0xca7bdd,_0x115053){return new BPromise(function(_0x216f55,_0x10650a){return client['request'](_0x140cfc,_0x115053)[_0xe2ff('0x12')](function(_0x460066){logger[_0xe2ff('0x13')](_0xe2ff('0x14'),_0xca7bdd,'request\x20sent');logger[_0xe2ff('0x15')](_0xe2ff('0x16'),_0xca7bdd,_0xe2ff('0x17'),JSON['stringify'](_0x460066));if(_0x460066[_0xe2ff('0x18')]){if(_0x460066[_0xe2ff('0x18')][_0xe2ff('0x19')]===0x1f4){logger[_0xe2ff('0x18')](_0xe2ff('0x14'),_0xca7bdd,_0x460066['error']['message']);return _0x10650a(_0x460066[_0xe2ff('0x18')]['message']);}logger[_0xe2ff('0x18')](_0xe2ff('0x14'),_0xca7bdd,_0x460066[_0xe2ff('0x18')]['message']);return _0x216f55(_0x460066[_0xe2ff('0x18')][_0xe2ff('0x1a')]);}else{logger['info'](_0xe2ff('0x14'),_0xca7bdd,_0xe2ff('0x17'));_0x216f55(_0x460066[_0xe2ff('0x1b')]['message']);}})[_0xe2ff('0x1c')](function(_0x15a7a3){logger[_0xe2ff('0x18')](_0xe2ff('0x14'),_0xca7bdd,_0x15a7a3);_0x10650a(_0x15a7a3);});});}exports[_0xe2ff('0x1d')]=function(_0x313cdd){var _0x57cb99=this;return new Promise(function(_0x175442,_0xb78a65){return db[_0xe2ff('0x1e')][_0xe2ff('0x1f')]({'raw':_0x313cdd[_0xe2ff('0x20')]?_0x313cdd['options']['raw']===undefined?!![]:![]:!![],'where':_0x313cdd[_0xe2ff('0x20')]?_0x313cdd[_0xe2ff('0x20')][_0xe2ff('0x21')]||null:null,'attributes':_0x313cdd[_0xe2ff('0x20')]?_0x313cdd['options']['attributes']||null:null,'limit':_0x313cdd[_0xe2ff('0x20')]?_0x313cdd[_0xe2ff('0x20')][_0xe2ff('0x22')]||null:null,'include':_0x313cdd[_0xe2ff('0x20')]?_0x313cdd[_0xe2ff('0x20')][_0xe2ff('0x23')]?_[_0xe2ff('0x24')](_0x313cdd[_0xe2ff('0x20')][_0xe2ff('0x23')],function(_0x5e3669){return{'model':db[_0x5e3669[_0xe2ff('0x25')]],'as':_0x5e3669['as'],'attributes':_0x5e3669['attributes'],'include':_0x5e3669[_0xe2ff('0x23')]?_[_0xe2ff('0x24')](_0x5e3669['include'],function(_0x5548c8){return{'model':db[_0x5548c8[_0xe2ff('0x25')]],'as':_0x5548c8['as'],'attributes':_0x5548c8[_0xe2ff('0x26')],'include':_0x5548c8[_0xe2ff('0x23')]?_[_0xe2ff('0x24')](_0x5548c8[_0xe2ff('0x23')],function(_0x2eba66){return{'model':db[_0x2eba66[_0xe2ff('0x25')]],'as':_0x2eba66['as'],'attributes':_0x2eba66[_0xe2ff('0x26')]};}):[]};}):[]};}):[]:[]})[_0xe2ff('0x12')](function(_0x2db3f6){logger[_0xe2ff('0x13')](_0xe2ff('0x1d'),_0x313cdd);logger[_0xe2ff('0x15')](_0xe2ff('0x1d'),_0x313cdd,JSON[_0xe2ff('0x27')](_0x2db3f6));_0x175442(_0x2db3f6);})[_0xe2ff('0x1c')](function(_0x6b4229){logger['error']('GetWhatsappQueue',_0x6b4229[_0xe2ff('0x1a')],_0x313cdd);_0xb78a65(_0x57cb99[_0xe2ff('0x18')](0x1f4,_0x6b4229[_0xe2ff('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x1c8fb1){var _0x2a1c6e=this;return new Promise(function(_0x26dc8a,_0x20f518){return db[_0xe2ff('0x1e')][_0xe2ff('0x28')]({'raw':_0x1c8fb1[_0xe2ff('0x20')]?_0x1c8fb1['options'][_0xe2ff('0x29')]===undefined?!![]:![]:!![],'where':_0x1c8fb1[_0xe2ff('0x20')]?_0x1c8fb1[_0xe2ff('0x20')][_0xe2ff('0x21')]||null:null,'attributes':_0x1c8fb1[_0xe2ff('0x20')]?_0x1c8fb1[_0xe2ff('0x20')][_0xe2ff('0x26')]||null:null,'include':_0x1c8fb1[_0xe2ff('0x20')]?_0x1c8fb1[_0xe2ff('0x20')][_0xe2ff('0x23')]?_[_0xe2ff('0x24')](_0x1c8fb1['options']['include'],function(_0x263d4e){return{'model':db[_0x263d4e[_0xe2ff('0x25')]],'as':_0x263d4e['as'],'attributes':_0x263d4e[_0xe2ff('0x26')],'include':_0x263d4e[_0xe2ff('0x23')]?_[_0xe2ff('0x24')](_0x263d4e['include'],function(_0x1aedc3){return{'model':db[_0x1aedc3[_0xe2ff('0x25')]],'as':_0x1aedc3['as'],'attributes':_0x1aedc3['attributes'],'include':_0x1aedc3['include']?_[_0xe2ff('0x24')](_0x1aedc3[_0xe2ff('0x23')],function(_0x177f33){return{'model':db[_0x177f33[_0xe2ff('0x25')]],'as':_0x177f33['as'],'attributes':_0x177f33['attributes']};}):[]};}):[]};}):[]:[]})[_0xe2ff('0x12')](function(_0x300b58){logger[_0xe2ff('0x13')]('ShowWhatsappQueue',_0x1c8fb1);logger[_0xe2ff('0x15')](_0xe2ff('0x2a'),_0x1c8fb1,JSON[_0xe2ff('0x27')](_0x300b58));_0x26dc8a(_0x300b58);})[_0xe2ff('0x1c')](function(_0x548378){logger[_0xe2ff('0x18')](_0xe2ff('0x2a'),_0x548378[_0xe2ff('0x1a')],_0x1c8fb1);_0x20f518(_0x2a1c6e[_0xe2ff('0x18')](0x1f4,_0x548378[_0xe2ff('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index f1a0b8b..3e4e8f5 100644 --- a/server/api/whatsappQueue/whatsappQueue.socket.js +++ b/server/api/whatsappQueue/whatsappQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d17=['register','length','whatsappQueue:','save','remove','emit','removeListener'];(function(_0x55b09d,_0x1dfec3){var _0x4990ee=function(_0xa2976f){while(--_0xa2976f){_0x55b09d['push'](_0x55b09d['shift']());}};_0x4990ee(++_0x1dfec3);}(_0x0d17,0x1d1));var _0x70d1=function(_0x8dffd1,_0x5ae332){_0x8dffd1=_0x8dffd1-0x0;var _0x3cf7df=_0x0d17[_0x8dffd1];return _0x3cf7df;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x70d1('0x0'),_0x70d1('0x1'),'update'];function createListener(_0x3d53ec,_0x155fd3){return function(_0x517289){_0x155fd3[_0x70d1('0x2')](_0x3d53ec,_0x517289);};}function removeListener(_0x28c2c3,_0x4c1dbe){return function(){WhatsappQueueEvents[_0x70d1('0x3')](_0x28c2c3,_0x4c1dbe);};}exports[_0x70d1('0x4')]=function(_0x62034){for(var _0x3140be=0x0,_0x4966a4=events[_0x70d1('0x5')];_0x3140be<_0x4966a4;_0x3140be++){var _0x5b431=events[_0x3140be];var _0x5e0e35=createListener(_0x70d1('0x6')+_0x5b431,_0x62034);WhatsappQueueEvents['on'](_0x5b431,_0x5e0e35);}}; \ No newline at end of file +var _0x1df0=['remove','update','emit','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x11354c,_0x52ea66){var _0x399ccd=function(_0x4e3f4e){while(--_0x4e3f4e){_0x11354c['push'](_0x11354c['shift']());}};_0x399ccd(++_0x52ea66);}(_0x1df0,0x13e));var _0x01df=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x1df0[_0x31e29a];return _0x32d892;};'use strict';var WhatsappQueueEvents=require(_0x01df('0x0'));var events=[_0x01df('0x1'),_0x01df('0x2'),_0x01df('0x3')];function createListener(_0xdbdaf6,_0x1c8d70){return function(_0x3db799){_0x1c8d70[_0x01df('0x4')](_0xdbdaf6,_0x3db799);};}function removeListener(_0x14501d,_0x1416c6){return function(){WhatsappQueueEvents['removeListener'](_0x14501d,_0x1416c6);};}exports[_0x01df('0x5')]=function(_0x243a6f){for(var _0x58dcb2=0x0,_0xba54c3=events[_0x01df('0x6')];_0x58dcb2<_0xba54c3;_0x58dcb2++){var _0x3c2004=events[_0x58dcb2];var _0x6130d9=createListener(_0x01df('0x7')+_0x3c2004,_0x243a6f);WhatsappQueueEvents['on'](_0x3c2004,_0x6130d9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 061e004..9185618 100644 --- a/server/api/whatsappQueueReport/index.js +++ b/server/api/whatsappQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e0d=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0x1e0d,0x1bd));var _0xd1e0=function(_0x52d1fb,_0xa7ad2d){_0x52d1fb=_0x52d1fb-0x0;var _0x33e93e=_0x1e0d[_0x52d1fb];return _0x33e93e;};'use strict';var multer=require(_0xd1e0('0x0'));var util=require(_0xd1e0('0x1'));var path=require(_0xd1e0('0x2'));var timeout=require(_0xd1e0('0x3'));var express=require(_0xd1e0('0x4'));var router=express[_0xd1e0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd1e0('0x6'));var interaction=require(_0xd1e0('0x7'));var config=require(_0xd1e0('0x8'));var controller=require(_0xd1e0('0x9'));router[_0xd1e0('0xa')]('/',auth[_0xd1e0('0xb')](),controller[_0xd1e0('0xc')]);router[_0xd1e0('0xa')](_0xd1e0('0xd'),auth[_0xd1e0('0xb')](),controller[_0xd1e0('0xe')]);router['get'](_0xd1e0('0xf'),auth['isAuthenticated'](),controller[_0xd1e0('0x10')]);router[_0xd1e0('0x11')]('/',auth['isAuthenticated'](),controller[_0xd1e0('0x12')]);router[_0xd1e0('0x13')](_0xd1e0('0xf'),auth[_0xd1e0('0xb')](),controller[_0xd1e0('0x14')]);router[_0xd1e0('0x15')](_0xd1e0('0xf'),auth[_0xd1e0('0xb')](),controller['destroy']);module[_0xd1e0('0x16')]=router; \ No newline at end of file +var _0x9a89=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x2fa7fc,_0x298fb7){var _0x3447e9=function(_0x4660cb){while(--_0x4660cb){_0x2fa7fc['push'](_0x2fa7fc['shift']());}};_0x3447e9(++_0x298fb7);}(_0x9a89,0x82));var _0x99a8=function(_0x3dfc00,_0xa71d8d){_0x3dfc00=_0x3dfc00-0x0;var _0x49c612=_0x9a89[_0x3dfc00];return _0x49c612;};'use strict';var multer=require(_0x99a8('0x0'));var util=require(_0x99a8('0x1'));var path=require(_0x99a8('0x2'));var timeout=require(_0x99a8('0x3'));var express=require('express');var router=express[_0x99a8('0x4')]();var fs_extra=require(_0x99a8('0x5'));var auth=require(_0x99a8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99a8('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x99a8('0x8')]('/',auth[_0x99a8('0x9')](),controller[_0x99a8('0xa')]);router[_0x99a8('0x8')](_0x99a8('0xb'),auth[_0x99a8('0x9')](),controller[_0x99a8('0xc')]);router[_0x99a8('0x8')](_0x99a8('0xd'),auth[_0x99a8('0x9')](),controller[_0x99a8('0xe')]);router['post']('/',auth[_0x99a8('0x9')](),controller[_0x99a8('0xf')]);router[_0x99a8('0x10')](_0x99a8('0xd'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x11')]);router[_0x99a8('0x12')](_0x99a8('0xd'),auth['isAuthenticated'](),controller[_0x99a8('0x13')]);module[_0x99a8('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 6421b25..8dd68a9 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x1fa2df,_0x2a539e){var _0x1cc0b7=function(_0x534e78){while(--_0x534e78){_0x1fa2df['push'](_0x1fa2df['shift']());}};_0x1cc0b7(++_0x2a539e);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x348d5b,_0x49f298){var _0x270758=function(_0x5ecb76){while(--_0x5ecb76){_0x348d5b['push'](_0x348d5b['shift']());}};_0x270758(++_0x49f298);}(_0x7a54,0x106));var _0x47a5=function(_0x5afe96,_0x41ed68){_0x5afe96=_0x5afe96-0x0;var _0x221b54=_0x7a54[_0x5afe96];return _0x221b54;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index d4d43d6..699eda3 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4f4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','findAll','rows','then','catch','show','params','keys','includeAll','include','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x4c41f6,_0x3615a0){_0x4c41f6=_0x4c41f6-0x0;var _0x3a9f28=_0xd4f4[_0x4c41f6];return _0x3a9f28;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x1cf365,_0x28443b){return function(_0x5cf9e7){if(!_0x5cf9e7){_0x1cf365['sendStatus'](0x194);}return _0x5cf9e7;};}function handleError(_0x141245,_0xd51604){_0xd51604=_0xd51604||0x1f4;return function(_0xa2492c){logger[_0x4d4f('0x2b')](_0xa2492c['stack']);if(_0xa2492c[_0x4d4f('0x2c')]){delete _0xa2492c[_0x4d4f('0x2c')];}_0x141245[_0x4d4f('0x1f')](_0xd51604)[_0x4d4f('0x2d')](_0xa2492c);};}exports['index']=function(_0x338ba2,_0x51cb3d){var _0x1688bb={},_0x333a40={},_0x550040={'count':0x0,'rows':[]};var _0x2768f1=_[_0x4d4f('0x2e')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')],function(_0x19a502){return{'name':_0x19a502[_0x4d4f('0x31')],'type':_0x19a502['type'][_0x4d4f('0x32')]};});_0x333a40[_0x4d4f('0x33')]=_[_0x4d4f('0x2e')](_0x2768f1,_0x4d4f('0x2c'));_0x333a40[_0x4d4f('0x34')]=_['keys'](_0x338ba2[_0x4d4f('0x34')]);_0x333a40['filters']=_[_0x4d4f('0x35')](_0x333a40['model'],_0x333a40['query']);_0x1688bb['attributes']=_[_0x4d4f('0x35')](_0x333a40['model'],qs[_0x4d4f('0x36')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x36')]));_0x1688bb['attributes']=_0x1688bb[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x1688bb[_0x4d4f('0x37')]:_0x333a40['model'];if(!_0x338ba2[_0x4d4f('0x34')]['hasOwnProperty'](_0x4d4f('0x39'))){_0x1688bb[_0x4d4f('0x23')]=qs[_0x4d4f('0x23')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x23')]);_0x1688bb[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x338ba2[_0x4d4f('0x34')]['offset']);}_0x1688bb['order']=qs[_0x4d4f('0x3a')](_0x338ba2['query']['sort']);_0x1688bb[_0x4d4f('0x3b')]=qs[_0x4d4f('0x3c')](_[_0x4d4f('0x3d')](_0x338ba2[_0x4d4f('0x34')],_0x333a40[_0x4d4f('0x3c')]),_0x2768f1);if(_0x338ba2['query'][_0x4d4f('0x3e')]){_0x1688bb[_0x4d4f('0x3b')]=_['merge'](_0x1688bb[_0x4d4f('0x3b')],{'$or':_[_0x4d4f('0x2e')](_0x2768f1,function(_0x336625){if(_0x336625[_0x4d4f('0x3f')]!==_0x4d4f('0x40')){var _0x19ebfe={};_0x19ebfe[_0x336625[_0x4d4f('0x2c')]]={'$like':'%'+_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x3e')]+'%'};return _0x19ebfe;}})});}_0x1688bb=_['merge']({},_0x1688bb,_0x338ba2['options']);var _0x1cb919={'where':_0x1688bb[_0x4d4f('0x3b')]};return db[_0x4d4f('0x2f')][_0x4d4f('0x24')](_0x1cb919)['then'](function(_0x5764cb){_0x550040[_0x4d4f('0x24')]=_0x5764cb;if(_0x338ba2[_0x4d4f('0x34')]['includeAll']){_0x1688bb['include']=[{'all':!![]}];}return db[_0x4d4f('0x2f')][_0x4d4f('0x41')](_0x1688bb);})['then'](function(_0x949a6d){_0x550040[_0x4d4f('0x42')]=_0x949a6d;return _0x550040;})[_0x4d4f('0x43')](respondWithFilteredResult(_0x51cb3d,_0x1688bb))[_0x4d4f('0x44')](handleError(_0x51cb3d,null));};exports[_0x4d4f('0x45')]=function(_0x587e6e,_0x2b274e){var _0x4c7c24={'raw':!![],'where':{'id':_0x587e6e[_0x4d4f('0x46')]['id']}},_0x45a0c1={};_0x45a0c1['model']=_[_0x4d4f('0x47')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')]);_0x45a0c1['query']=_[_0x4d4f('0x47')](_0x587e6e['query']);_0x45a0c1[_0x4d4f('0x3c')]=_['intersection'](_0x45a0c1[_0x4d4f('0x33')],_0x45a0c1[_0x4d4f('0x34')]);_0x4c7c24[_0x4d4f('0x37')]=_[_0x4d4f('0x35')](_0x45a0c1[_0x4d4f('0x33')],qs['fields'](_0x587e6e['query'][_0x4d4f('0x36')]));_0x4c7c24[_0x4d4f('0x37')]=_0x4c7c24[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x4c7c24['attributes']:_0x45a0c1['model'];if(_0x587e6e['query'][_0x4d4f('0x48')]){_0x4c7c24[_0x4d4f('0x49')]=[{'all':!![]}];}_0x4c7c24=_[_0x4d4f('0x4a')]({},_0x4c7c24,_0x587e6e[_0x4d4f('0x4b')]);return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')](_0x4c7c24)[_0x4d4f('0x43')](handleEntityNotFound(_0x2b274e,null))[_0x4d4f('0x43')](respondWithResult(_0x2b274e,null))[_0x4d4f('0x44')](handleError(_0x2b274e,null));};exports[_0x4d4f('0x4d')]=function(_0x37745d,_0x1c290b){return db['WhatsappQueueReport'][_0x4d4f('0x4d')](_0x37745d[_0x4d4f('0x4e')],{})['then'](respondWithResult(_0x1c290b,0xc9))[_0x4d4f('0x44')](handleError(_0x1c290b,null));};exports['update']=function(_0x15cf38,_0x401466){if(_0x15cf38['body']['id']){delete _0x15cf38[_0x4d4f('0x4e')]['id'];}return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')]({'where':{'id':_0x15cf38[_0x4d4f('0x46')]['id']}})[_0x4d4f('0x43')](handleEntityNotFound(_0x401466,null))[_0x4d4f('0x43')](saveUpdates(_0x15cf38[_0x4d4f('0x4e')],null))[_0x4d4f('0x43')](respondWithResult(_0x401466,null))[_0x4d4f('0x44')](handleError(_0x401466,null));};exports[_0x4d4f('0x2a')]=function(_0xa6cef,_0x3a21a6){return db['WhatsappQueueReport'][_0x4d4f('0x4c')]({'where':{'id':_0xa6cef['params']['id']}})['then'](handleEntityNotFound(_0x3a21a6,null))['then'](removeEntity(_0x3a21a6,null))[_0x4d4f('0x44')](handleError(_0x3a21a6,null));};exports[_0x4d4f('0x4f')]=function(_0x487212,_0x5f3252){return db[_0x4d4f('0x2f')][_0x4d4f('0x4f')]()['then'](respondWithResult(_0x5f3252,null))[_0x4d4f('0x44')](handleError(_0x5f3252,null));}; \ No newline at end of file +var _0xd4f4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','findAll','rows','then','catch','show','params','keys','includeAll','include','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x32a4bd,_0x1590c5){_0x32a4bd=_0x32a4bd-0x0;var _0x2d5d33=_0xd4f4[_0x32a4bd];return _0x2d5d33;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x1cf365,_0x28443b){return function(_0x5cf9e7){if(!_0x5cf9e7){_0x1cf365['sendStatus'](0x194);}return _0x5cf9e7;};}function handleError(_0x141245,_0xd51604){_0xd51604=_0xd51604||0x1f4;return function(_0xa2492c){logger[_0x4d4f('0x2b')](_0xa2492c['stack']);if(_0xa2492c[_0x4d4f('0x2c')]){delete _0xa2492c[_0x4d4f('0x2c')];}_0x141245[_0x4d4f('0x1f')](_0xd51604)[_0x4d4f('0x2d')](_0xa2492c);};}exports['index']=function(_0x338ba2,_0x51cb3d){var _0x1688bb={},_0x333a40={},_0x550040={'count':0x0,'rows':[]};var _0x2768f1=_[_0x4d4f('0x2e')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')],function(_0x19a502){return{'name':_0x19a502[_0x4d4f('0x31')],'type':_0x19a502['type'][_0x4d4f('0x32')]};});_0x333a40[_0x4d4f('0x33')]=_[_0x4d4f('0x2e')](_0x2768f1,_0x4d4f('0x2c'));_0x333a40[_0x4d4f('0x34')]=_['keys'](_0x338ba2[_0x4d4f('0x34')]);_0x333a40['filters']=_[_0x4d4f('0x35')](_0x333a40['model'],_0x333a40['query']);_0x1688bb['attributes']=_[_0x4d4f('0x35')](_0x333a40['model'],qs[_0x4d4f('0x36')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x36')]));_0x1688bb['attributes']=_0x1688bb[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x1688bb[_0x4d4f('0x37')]:_0x333a40['model'];if(!_0x338ba2[_0x4d4f('0x34')]['hasOwnProperty'](_0x4d4f('0x39'))){_0x1688bb[_0x4d4f('0x23')]=qs[_0x4d4f('0x23')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x23')]);_0x1688bb[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x338ba2[_0x4d4f('0x34')]['offset']);}_0x1688bb['order']=qs[_0x4d4f('0x3a')](_0x338ba2['query']['sort']);_0x1688bb[_0x4d4f('0x3b')]=qs[_0x4d4f('0x3c')](_[_0x4d4f('0x3d')](_0x338ba2[_0x4d4f('0x34')],_0x333a40[_0x4d4f('0x3c')]),_0x2768f1);if(_0x338ba2['query'][_0x4d4f('0x3e')]){_0x1688bb[_0x4d4f('0x3b')]=_['merge'](_0x1688bb[_0x4d4f('0x3b')],{'$or':_[_0x4d4f('0x2e')](_0x2768f1,function(_0x336625){if(_0x336625[_0x4d4f('0x3f')]!==_0x4d4f('0x40')){var _0x19ebfe={};_0x19ebfe[_0x336625[_0x4d4f('0x2c')]]={'$like':'%'+_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x3e')]+'%'};return _0x19ebfe;}})});}_0x1688bb=_['merge']({},_0x1688bb,_0x338ba2['options']);var _0x1cb919={'where':_0x1688bb[_0x4d4f('0x3b')]};return db[_0x4d4f('0x2f')][_0x4d4f('0x24')](_0x1cb919)['then'](function(_0x5764cb){_0x550040[_0x4d4f('0x24')]=_0x5764cb;if(_0x338ba2[_0x4d4f('0x34')]['includeAll']){_0x1688bb['include']=[{'all':!![]}];}return db[_0x4d4f('0x2f')][_0x4d4f('0x41')](_0x1688bb);})['then'](function(_0x949a6d){_0x550040[_0x4d4f('0x42')]=_0x949a6d;return _0x550040;})[_0x4d4f('0x43')](respondWithFilteredResult(_0x51cb3d,_0x1688bb))[_0x4d4f('0x44')](handleError(_0x51cb3d,null));};exports[_0x4d4f('0x45')]=function(_0x587e6e,_0x2b274e){var _0x4c7c24={'raw':!![],'where':{'id':_0x587e6e[_0x4d4f('0x46')]['id']}},_0x45a0c1={};_0x45a0c1['model']=_[_0x4d4f('0x47')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')]);_0x45a0c1['query']=_[_0x4d4f('0x47')](_0x587e6e['query']);_0x45a0c1[_0x4d4f('0x3c')]=_['intersection'](_0x45a0c1[_0x4d4f('0x33')],_0x45a0c1[_0x4d4f('0x34')]);_0x4c7c24[_0x4d4f('0x37')]=_[_0x4d4f('0x35')](_0x45a0c1[_0x4d4f('0x33')],qs['fields'](_0x587e6e['query'][_0x4d4f('0x36')]));_0x4c7c24[_0x4d4f('0x37')]=_0x4c7c24[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x4c7c24['attributes']:_0x45a0c1['model'];if(_0x587e6e['query'][_0x4d4f('0x48')]){_0x4c7c24[_0x4d4f('0x49')]=[{'all':!![]}];}_0x4c7c24=_[_0x4d4f('0x4a')]({},_0x4c7c24,_0x587e6e[_0x4d4f('0x4b')]);return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')](_0x4c7c24)[_0x4d4f('0x43')](handleEntityNotFound(_0x2b274e,null))[_0x4d4f('0x43')](respondWithResult(_0x2b274e,null))[_0x4d4f('0x44')](handleError(_0x2b274e,null));};exports[_0x4d4f('0x4d')]=function(_0x37745d,_0x1c290b){return db['WhatsappQueueReport'][_0x4d4f('0x4d')](_0x37745d[_0x4d4f('0x4e')],{})['then'](respondWithResult(_0x1c290b,0xc9))[_0x4d4f('0x44')](handleError(_0x1c290b,null));};exports['update']=function(_0x15cf38,_0x401466){if(_0x15cf38['body']['id']){delete _0x15cf38[_0x4d4f('0x4e')]['id'];}return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')]({'where':{'id':_0x15cf38[_0x4d4f('0x46')]['id']}})[_0x4d4f('0x43')](handleEntityNotFound(_0x401466,null))[_0x4d4f('0x43')](saveUpdates(_0x15cf38[_0x4d4f('0x4e')],null))[_0x4d4f('0x43')](respondWithResult(_0x401466,null))[_0x4d4f('0x44')](handleError(_0x401466,null));};exports[_0x4d4f('0x2a')]=function(_0xa6cef,_0x3a21a6){return db['WhatsappQueueReport'][_0x4d4f('0x4c')]({'where':{'id':_0xa6cef['params']['id']}})['then'](handleEntityNotFound(_0x3a21a6,null))['then'](removeEntity(_0x3a21a6,null))[_0x4d4f('0x44')](handleError(_0x3a21a6,null));};exports[_0x4d4f('0x4f')]=function(_0x487212,_0x5f3252){return db[_0x4d4f('0x2f')][_0x4d4f('0x4f')]()['then'](respondWithResult(_0x5f3252,null))[_0x4d4f('0x44')](handleError(_0x5f3252,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 9b1229f..a9936ee 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.model.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f68=['../../config/logger','api','path','rimraf','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x18fe54,_0xff789){var _0xccb1ee=function(_0x513cf3){while(--_0x513cf3){_0x18fe54['push'](_0x18fe54['shift']());}};_0xccb1ee(++_0xff789);}(_0x4f68,0xf2));var _0x84f6=function(_0x4ff45b,_0xeae120){_0x4ff45b=_0x4ff45b-0x0;var _0x54edc6=_0x4f68[_0x4ff45b];return _0x54edc6;};'use strict';var _=require(_0x84f6('0x0'));var util=require('util');var logger=require(_0x84f6('0x1'))(_0x84f6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x84f6('0x3'));var rimraf=require(_0x84f6('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x84f6('0x5')]=function(_0x1b2775,_0xeac99){return _0x1b2775['define'](_0x84f6('0x6'),attributes,{'tableName':_0x84f6('0x7'),'paranoid':![],'indexes':[{'name':_0x84f6('0x8'),'fields':[_0x84f6('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf94e=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf94e,0x1ea));var _0xef94=function(_0x3b1648,_0xb5d1cb){_0x3b1648=_0x3b1648-0x0;var _0x45f56e=_0xf94e[_0x3b1648];return _0x45f56e;};'use strict';var _=require(_0xef94('0x0'));var util=require(_0xef94('0x1'));var logger=require(_0xef94('0x2'))(_0xef94('0x3'));var moment=require('moment');var BPromise=require(_0xef94('0x4'));var rp=require(_0xef94('0x5'));var fs=require('fs');var path=require(_0xef94('0x6'));var rimraf=require('rimraf');var config=require(_0xef94('0x7'));var attributes=require(_0xef94('0x8'));module[_0xef94('0x9')]=function(_0x204c7b,_0x3c1baf){return _0x204c7b[_0xef94('0xa')](_0xef94('0xb'),attributes,{'tableName':_0xef94('0xc'),'paranoid':![],'indexes':[{'name':_0xef94('0xd'),'fields':[_0xef94('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 865f09e..b5fd6bc 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3be2=['CreateWhatsappQueueReport','WhatsappQueueReport','create','raw','UpdateWhatsappQueueReport','update','options','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x62e16a,_0x37acaa){var _0x5c228f=function(_0x1ec113){while(--_0x1ec113){_0x62e16a['push'](_0x62e16a['shift']());}};_0x5c228f(++_0x37acaa);}(_0x3be2,0x153));var _0x23be=function(_0xdedc40,_0x482af8){_0xdedc40=_0xdedc40-0x0;var _0x4bdf92=_0x3be2[_0xdedc40];return _0x4bdf92;};'use strict';var _=require(_0x23be('0x0'));var util=require('util');var moment=require(_0x23be('0x1'));var BPromise=require(_0x23be('0x2'));var rs=require(_0x23be('0x3'));var fs=require('fs');var Redis=require(_0x23be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x23be('0x5'));var logger=require('../../config/logger')(_0x23be('0x6'));var config=require(_0x23be('0x7'));var jayson=require(_0x23be('0x8'));var client=jayson[_0x23be('0x9')][_0x23be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4590b6,_0x632421,_0x57ad14){return new BPromise(function(_0x27b76b,_0x1228cc){return client[_0x23be('0xb')](_0x4590b6,_0x57ad14)[_0x23be('0xc')](function(_0x25172c){logger[_0x23be('0xd')](_0x23be('0xe'),_0x632421,_0x23be('0xf'));logger[_0x23be('0x10')](_0x23be('0x11'),_0x632421,'request\x20sent',JSON[_0x23be('0x12')](_0x25172c));if(_0x25172c[_0x23be('0x13')]){if(_0x25172c[_0x23be('0x13')][_0x23be('0x14')]===0x1f4){logger[_0x23be('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x632421,_0x25172c[_0x23be('0x13')][_0x23be('0x15')]);return _0x1228cc(_0x25172c[_0x23be('0x13')][_0x23be('0x15')]);}logger[_0x23be('0x13')](_0x23be('0xe'),_0x632421,_0x25172c[_0x23be('0x13')][_0x23be('0x15')]);return _0x27b76b(_0x25172c[_0x23be('0x13')][_0x23be('0x15')]);}else{logger['info'](_0x23be('0xe'),_0x632421,'request\x20sent');_0x27b76b(_0x25172c[_0x23be('0x16')][_0x23be('0x15')]);}})[_0x23be('0x17')](function(_0x169a12){logger[_0x23be('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x632421,_0x169a12);_0x1228cc(_0x169a12);});});}exports[_0x23be('0x18')]=function(_0x399bad){var _0x27681a=this;return new Promise(function(_0x5e0746,_0x535b0e){return db[_0x23be('0x19')][_0x23be('0x1a')](_0x399bad['body'],{'raw':_0x399bad['options']?_0x399bad['options'][_0x23be('0x1b')]===undefined?!![]:![]:!![]})[_0x23be('0xc')](function(_0x3950a5){logger[_0x23be('0xd')](_0x23be('0x18'),_0x399bad);logger[_0x23be('0x10')](_0x23be('0x18'),_0x399bad,JSON[_0x23be('0x12')](_0x3950a5));_0x5e0746(_0x3950a5);})[_0x23be('0x17')](function(_0x541198){logger[_0x23be('0x13')](_0x23be('0x18'),_0x541198[_0x23be('0x15')],_0x399bad);_0x535b0e(_0x27681a[_0x23be('0x13')](0x1f4,_0x541198[_0x23be('0x15')]));});});};exports[_0x23be('0x1c')]=function(_0x31f1b2){var _0x107fcb=this;return new Promise(function(_0x2b750a,_0x111bc3){return db['WhatsappQueueReport'][_0x23be('0x1d')](_0x31f1b2['body'],{'raw':_0x31f1b2[_0x23be('0x1e')]?_0x31f1b2[_0x23be('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31f1b2[_0x23be('0x1e')]?_0x31f1b2['options'][_0x23be('0x1f')]||null:null,'attributes':_0x31f1b2[_0x23be('0x1e')]?_0x31f1b2[_0x23be('0x1e')][_0x23be('0x20')]||null:null,'limit':_0x31f1b2[_0x23be('0x1e')]?_0x31f1b2[_0x23be('0x1e')]['limit']||null:null})[_0x23be('0xc')](function(_0x311a5b){logger['info'](_0x23be('0x1c'),_0x31f1b2);logger[_0x23be('0x10')](_0x23be('0x1c'),_0x31f1b2,JSON[_0x23be('0x12')](_0x311a5b));_0x2b750a(_0x311a5b);})[_0x23be('0x17')](function(_0x4b58ca){logger[_0x23be('0x13')]('UpdateWhatsappQueueReport',_0x4b58ca[_0x23be('0x15')],_0x31f1b2);_0x111bc3(_0x107fcb['error'](0x1f4,_0x4b58ca[_0x23be('0x15')]));});});}; \ No newline at end of file +var _0x9b53=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9b53,0x1d4));var _0x39b5=function(_0x527027,_0xe097a3){_0x527027=_0x527027-0x0;var _0x45a143=_0x9b53[_0x527027];return _0x45a143;};'use strict';var _=require(_0x39b5('0x0'));var util=require(_0x39b5('0x1'));var moment=require(_0x39b5('0x2'));var BPromise=require(_0x39b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39b5('0x4'));var db=require(_0x39b5('0x5'))['db'];var utils=require(_0x39b5('0x6'));var logger=require(_0x39b5('0x7'))('rpc');var config=require(_0x39b5('0x8'));var jayson=require(_0x39b5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1755e4,_0x25de86,_0x29b38b){return new BPromise(function(_0x5ad67c,_0x1e14d2){return client[_0x39b5('0xa')](_0x1755e4,_0x29b38b)[_0x39b5('0xb')](function(_0x2747d6){logger[_0x39b5('0xc')](_0x39b5('0xd'),_0x25de86,_0x39b5('0xe'));logger[_0x39b5('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x25de86,_0x39b5('0xe'),JSON[_0x39b5('0x10')](_0x2747d6));if(_0x2747d6[_0x39b5('0x11')]){if(_0x2747d6['error'][_0x39b5('0x12')]===0x1f4){logger[_0x39b5('0x11')](_0x39b5('0xd'),_0x25de86,_0x2747d6[_0x39b5('0x11')]['message']);return _0x1e14d2(_0x2747d6[_0x39b5('0x11')][_0x39b5('0x13')]);}logger[_0x39b5('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x25de86,_0x2747d6[_0x39b5('0x11')][_0x39b5('0x13')]);return _0x5ad67c(_0x2747d6[_0x39b5('0x11')][_0x39b5('0x13')]);}else{logger['info'](_0x39b5('0xd'),_0x25de86,_0x39b5('0xe'));_0x5ad67c(_0x2747d6[_0x39b5('0x14')][_0x39b5('0x13')]);}})[_0x39b5('0x15')](function(_0x78194b){logger[_0x39b5('0x11')](_0x39b5('0xd'),_0x25de86,_0x78194b);_0x1e14d2(_0x78194b);});});}exports['CreateWhatsappQueueReport']=function(_0x9e36d){var _0x37efc1=this;return new Promise(function(_0x479ad1,_0x5b6af0){return db[_0x39b5('0x16')]['create'](_0x9e36d[_0x39b5('0x17')],{'raw':_0x9e36d['options']?_0x9e36d[_0x39b5('0x18')][_0x39b5('0x19')]===undefined?!![]:![]:!![]})[_0x39b5('0xb')](function(_0x3b2ffe){logger[_0x39b5('0xc')](_0x39b5('0x1a'),_0x9e36d);logger[_0x39b5('0xf')](_0x39b5('0x1a'),_0x9e36d,JSON['stringify'](_0x3b2ffe));_0x479ad1(_0x3b2ffe);})['catch'](function(_0x42f825){logger[_0x39b5('0x11')](_0x39b5('0x1a'),_0x42f825[_0x39b5('0x13')],_0x9e36d);_0x5b6af0(_0x37efc1[_0x39b5('0x11')](0x1f4,_0x42f825['message']));});});};exports[_0x39b5('0x1b')]=function(_0x2eebd1){var _0x6fa957=this;return new Promise(function(_0x31433f,_0x1f7eb5){return db[_0x39b5('0x16')][_0x39b5('0x1c')](_0x2eebd1[_0x39b5('0x17')],{'raw':_0x2eebd1['options']?_0x2eebd1[_0x39b5('0x18')][_0x39b5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eebd1[_0x39b5('0x18')]?_0x2eebd1[_0x39b5('0x18')][_0x39b5('0x1d')]||null:null,'attributes':_0x2eebd1[_0x39b5('0x18')]?_0x2eebd1[_0x39b5('0x18')][_0x39b5('0x1e')]||null:null,'limit':_0x2eebd1['options']?_0x2eebd1['options'][_0x39b5('0x1f')]||null:null})[_0x39b5('0xb')](function(_0x1b47f9){logger[_0x39b5('0xc')]('UpdateWhatsappQueueReport',_0x2eebd1);logger[_0x39b5('0xf')](_0x39b5('0x1b'),_0x2eebd1,JSON['stringify'](_0x1b47f9));_0x31433f(_0x1b47f9);})[_0x39b5('0x15')](function(_0x578f50){logger['error'](_0x39b5('0x1b'),_0x578f50[_0x39b5('0x13')],_0x2eebd1);_0x1f7eb5(_0x6fa957[_0x39b5('0x11')](0x1f4,_0x578f50[_0x39b5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 612eaed..27fa4bd 100644 --- a/server/api/whatsappTransferReport/index.js +++ b/server/api/whatsappTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa039=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','util'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0xa039,0xc5));var _0x9a03=function(_0x5b7f3d,_0xedd73b){_0x5b7f3d=_0x5b7f3d-0x0;var _0x105a7f=_0xa039[_0x5b7f3d];return _0x105a7f;};'use strict';var multer=require('multer');var util=require(_0x9a03('0x0'));var path=require(_0x9a03('0x1'));var timeout=require(_0x9a03('0x2'));var express=require(_0x9a03('0x3'));var router=express[_0x9a03('0x4')]();var fs_extra=require(_0x9a03('0x5'));var auth=require(_0x9a03('0x6'));var interaction=require(_0x9a03('0x7'));var config=require(_0x9a03('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x9a03('0x9')]('/',auth[_0x9a03('0xa')](),controller[_0x9a03('0xb')]);router[_0x9a03('0x9')](_0x9a03('0xc'),auth[_0x9a03('0xa')](),controller[_0x9a03('0xd')]);router['get'](_0x9a03('0xe'),auth[_0x9a03('0xa')](),controller[_0x9a03('0xf')]);router[_0x9a03('0x10')]('/',auth[_0x9a03('0xa')](),controller[_0x9a03('0x11')]);router['put'](_0x9a03('0xe'),auth[_0x9a03('0xa')](),controller[_0x9a03('0x12')]);router[_0x9a03('0x13')](_0x9a03('0xe'),auth[_0x9a03('0xa')](),controller[_0x9a03('0x14')]);module[_0x9a03('0x15')]=router; \ No newline at end of file +var _0x58ec=['../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5e5f0b,_0x42d61d){var _0x4de9ea=function(_0x566acd){while(--_0x566acd){_0x5e5f0b['push'](_0x5e5f0b['shift']());}};_0x4de9ea(++_0x42d61d);}(_0x58ec,0xbf));var _0xc58e=function(_0x444e11,_0x5957ff){_0x444e11=_0x444e11-0x0;var _0x13fee5=_0x58ec[_0x444e11];return _0x13fee5;};'use strict';var multer=require(_0xc58e('0x0'));var util=require(_0xc58e('0x1'));var path=require(_0xc58e('0x2'));var timeout=require(_0xc58e('0x3'));var express=require(_0xc58e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc58e('0x5'));var interaction=require(_0xc58e('0x6'));var config=require(_0xc58e('0x7'));var controller=require(_0xc58e('0x8'));router[_0xc58e('0x9')]('/',auth[_0xc58e('0xa')](),controller[_0xc58e('0xb')]);router[_0xc58e('0x9')](_0xc58e('0xc'),auth['isAuthenticated'](),controller[_0xc58e('0xd')]);router[_0xc58e('0x9')](_0xc58e('0xe'),auth[_0xc58e('0xa')](),controller[_0xc58e('0xf')]);router[_0xc58e('0x10')]('/',auth['isAuthenticated'](),controller[_0xc58e('0x11')]);router[_0xc58e('0x12')](_0xc58e('0xe'),auth[_0xc58e('0xa')](),controller[_0xc58e('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc58e('0x14')]);module[_0xc58e('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5bf7cd8..5cd8977 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c91=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x1e8bea,_0x47bde9){var _0x29f756=function(_0x37bb53){while(--_0x37bb53){_0x1e8bea['push'](_0x1e8bea['shift']());}};_0x29f756(++_0x47bde9);}(_0x2c91,0x158));var _0x12c9=function(_0x3cf7fe,_0x2f9a20){_0x3cf7fe=_0x3cf7fe-0x0;var _0x730088=_0x2c91[_0x3cf7fe];return _0x730088;};'use strict';var Sequelize=require(_0x12c9('0x0'));module[_0x12c9('0x1')]={'uniqueid':{'type':Sequelize[_0x12c9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x12c9('0x3')](_0x12c9('0x4'),_0x12c9('0x5'),_0x12c9('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x12c9('0x7')]}}; \ No newline at end of file +var _0x3f9b=['agent','STRING','account'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x1bdcc8,_0x519d7c){_0x1bdcc8=_0x1bdcc8-0x0;var _0x1141bf=_0x3f9b[_0x1bdcc8];return _0x1141bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb3f9('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb3f9('0x1'),_0xb3f9('0x2'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index bb0bd27..17e6806 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e9=['find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0x446961,_0x309715){var _0xa57075=function(_0x3fc2d4){while(--_0x3fc2d4){_0x446961['push'](_0x446961['shift']());}};_0xa57075(++_0x309715);}(_0x70e9,0x1d2));var _0x970e=function(_0x4aa925,_0x562b72){_0x4aa925=_0x4aa925-0x0;var _0x2c6420=_0x70e9[_0x4aa925];return _0x2c6420;};'use strict';var emlformat=require(_0x970e('0x0'));var rimraf=require(_0x970e('0x1'));var zipdir=require(_0x970e('0x2'));var jsonpatch=require(_0x970e('0x3'));var rp=require(_0x970e('0x4'));var moment=require(_0x970e('0x5'));var BPromise=require(_0x970e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x970e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x970e('0x8'));var fs=require('fs');var fs_extra=require(_0x970e('0x9'));var _=require('lodash');var squel=require(_0x970e('0xa'));var crypto=require(_0x970e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x970e('0xc'));var querystring=require(_0x970e('0xd'));var Papa=require(_0x970e('0xe'));var Redis=require(_0x970e('0xf'));var authService=require(_0x970e('0x10'));var qs=require(_0x970e('0x11'));var as=require(_0x970e('0x12'));var hardwareService=require(_0x970e('0x13'));var logger=require('../../config/logger')(_0x970e('0x14'));var utils=require(_0x970e('0x15'));var config=require(_0x970e('0x16'));var licenseUtil=require(_0x970e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x195751,_0x35fc33){_0x35fc33=_0x35fc33||0xcc;return function(_0x201508){if(_0x201508){return _0x195751['sendStatus'](_0x35fc33);}return _0x195751[_0x970e('0x18')](_0x35fc33)[_0x970e('0x19')]();};}function respondWithResult(_0x3bfd6e,_0xc0988d){_0xc0988d=_0xc0988d||0xc8;return function(_0x4a03a0){if(_0x4a03a0){return _0x3bfd6e[_0x970e('0x18')](_0xc0988d)[_0x970e('0x1a')](_0x4a03a0);}};}function respondWithFilteredResult(_0x1cd2fa,_0x49cefb){return function(_0x27fddb){if(_0x27fddb){var _0x1ecf4e=typeof _0x49cefb[_0x970e('0x1b')]===_0x970e('0x1c')&&typeof _0x49cefb[_0x970e('0x1d')]===_0x970e('0x1c');var _0x507510=_0x27fddb['count'];var _0x46e75c=_0x1ecf4e?0x0:_0x49cefb[_0x970e('0x1b')];var _0x595eb2=_0x1ecf4e?_0x27fddb['count']:_0x49cefb[_0x970e('0x1b')]+_0x49cefb['limit'];var _0xad9ba4;if(_0x595eb2>=_0x507510){_0x595eb2=_0x507510;_0xad9ba4=0xc8;}else{_0xad9ba4=0xce;}_0x1cd2fa['status'](_0xad9ba4);return _0x1cd2fa[_0x970e('0x1e')]('Content-Range',_0x46e75c+'-'+_0x595eb2+'/'+_0x507510)[_0x970e('0x1a')](_0x27fddb);}return null;};}function patchUpdates(_0x264466){return function(_0x5c04f1){try{jsonpatch[_0x970e('0x1f')](_0x5c04f1,_0x264466,!![]);}catch(_0x135354){return BPromise[_0x970e('0x20')](_0x135354);}return _0x5c04f1['save']();};}function saveUpdates(_0x5c3342,_0x439de9){return function(_0x3f0c7d){if(_0x3f0c7d){return _0x3f0c7d[_0x970e('0x21')](_0x5c3342)[_0x970e('0x22')](function(_0x5dc352){return _0x5dc352;});}return null;};}function removeEntity(_0x1225fb,_0x290b92){return function(_0x5191ae){if(_0x5191ae){return _0x5191ae[_0x970e('0x23')]()['then'](function(){_0x1225fb[_0x970e('0x18')](0xcc)[_0x970e('0x19')]();});}};}function handleEntityNotFound(_0x471ce8,_0x32df6d){return function(_0x3d2941){if(!_0x3d2941){_0x471ce8[_0x970e('0x24')](0x194);}return _0x3d2941;};}function handleError(_0x47a59e,_0x3d6e7f){_0x3d6e7f=_0x3d6e7f||0x1f4;return function(_0x3a31fc){logger[_0x970e('0x25')](_0x3a31fc[_0x970e('0x26')]);if(_0x3a31fc[_0x970e('0x27')]){delete _0x3a31fc[_0x970e('0x27')];}_0x47a59e[_0x970e('0x18')](_0x3d6e7f)['send'](_0x3a31fc);};}exports[_0x970e('0x28')]=function(_0x36da85,_0x5a05c5){var _0x1f8b46={},_0x2ab78f={},_0x448200={'count':0x0,'rows':[]};var _0x373222=_[_0x970e('0x29')](db[_0x970e('0x2a')][_0x970e('0x2b')],function(_0xeb46bf){return{'name':_0xeb46bf[_0x970e('0x2c')],'type':_0xeb46bf[_0x970e('0x2d')][_0x970e('0x2e')]};});_0x2ab78f[_0x970e('0x2f')]=_[_0x970e('0x29')](_0x373222,_0x970e('0x27'));_0x2ab78f[_0x970e('0x30')]=_[_0x970e('0x31')](_0x36da85[_0x970e('0x30')]);_0x2ab78f['filters']=_[_0x970e('0x32')](_0x2ab78f[_0x970e('0x2f')],_0x2ab78f[_0x970e('0x30')]);_0x1f8b46[_0x970e('0x33')]=_['intersection'](_0x2ab78f[_0x970e('0x2f')],qs['fields'](_0x36da85['query'][_0x970e('0x34')]));_0x1f8b46[_0x970e('0x33')]=_0x1f8b46['attributes']['length']?_0x1f8b46['attributes']:_0x2ab78f[_0x970e('0x2f')];if(!_0x36da85[_0x970e('0x30')][_0x970e('0x35')](_0x970e('0x36'))){_0x1f8b46[_0x970e('0x1d')]=qs[_0x970e('0x1d')](_0x36da85[_0x970e('0x30')]['limit']);_0x1f8b46[_0x970e('0x1b')]=qs[_0x970e('0x1b')](_0x36da85[_0x970e('0x30')][_0x970e('0x1b')]);}_0x1f8b46[_0x970e('0x37')]=qs[_0x970e('0x38')](_0x36da85[_0x970e('0x30')][_0x970e('0x38')]);_0x1f8b46['where']=qs[_0x970e('0x39')](_[_0x970e('0x3a')](_0x36da85[_0x970e('0x30')],_0x2ab78f['filters']),_0x373222);if(_0x36da85[_0x970e('0x30')][_0x970e('0x3b')]){_0x1f8b46[_0x970e('0x3c')]=_[_0x970e('0x3d')](_0x1f8b46[_0x970e('0x3c')],{'$or':_['map'](_0x373222,function(_0x1b20ed){if(_0x1b20ed[_0x970e('0x2d')]!==_0x970e('0x3e')){var _0x296266={};_0x296266[_0x1b20ed['name']]={'$like':'%'+_0x36da85[_0x970e('0x30')]['filter']+'%'};return _0x296266;}})});}_0x1f8b46=_['merge']({},_0x1f8b46,_0x36da85[_0x970e('0x3f')]);var _0x5f38a5={'where':_0x1f8b46['where']};return db[_0x970e('0x2a')][_0x970e('0x40')](_0x5f38a5)[_0x970e('0x22')](function(_0x146c04){_0x448200['count']=_0x146c04;if(_0x36da85[_0x970e('0x30')][_0x970e('0x41')]){_0x1f8b46[_0x970e('0x42')]=[{'all':!![]}];}return db[_0x970e('0x2a')][_0x970e('0x43')](_0x1f8b46);})['then'](function(_0x222e1b){_0x448200[_0x970e('0x44')]=_0x222e1b;return _0x448200;})[_0x970e('0x22')](respondWithFilteredResult(_0x5a05c5,_0x1f8b46))[_0x970e('0x45')](handleError(_0x5a05c5,null));};exports[_0x970e('0x46')]=function(_0x6d14ba,_0x5ee189){var _0x11ee46={'raw':!![],'where':{'id':_0x6d14ba[_0x970e('0x47')]['id']}},_0x5a5f8a={};_0x5a5f8a['model']=_[_0x970e('0x31')](db['WhatsappTransferReport']['rawAttributes']);_0x5a5f8a[_0x970e('0x30')]=_['keys'](_0x6d14ba[_0x970e('0x30')]);_0x5a5f8a[_0x970e('0x39')]=_[_0x970e('0x32')](_0x5a5f8a[_0x970e('0x2f')],_0x5a5f8a[_0x970e('0x30')]);_0x11ee46[_0x970e('0x33')]=_[_0x970e('0x32')](_0x5a5f8a[_0x970e('0x2f')],qs[_0x970e('0x34')](_0x6d14ba[_0x970e('0x30')][_0x970e('0x34')]));_0x11ee46['attributes']=_0x11ee46[_0x970e('0x33')][_0x970e('0x48')]?_0x11ee46[_0x970e('0x33')]:_0x5a5f8a['model'];if(_0x6d14ba['query'][_0x970e('0x41')]){_0x11ee46[_0x970e('0x42')]=[{'all':!![]}];}_0x11ee46=_['merge']({},_0x11ee46,_0x6d14ba[_0x970e('0x3f')]);return db[_0x970e('0x2a')][_0x970e('0x49')](_0x11ee46)[_0x970e('0x22')](handleEntityNotFound(_0x5ee189,null))[_0x970e('0x22')](respondWithResult(_0x5ee189,null))[_0x970e('0x45')](handleError(_0x5ee189,null));};exports[_0x970e('0x4a')]=function(_0x499089,_0x314ed6){return db['WhatsappTransferReport'][_0x970e('0x4a')](_0x499089[_0x970e('0x4b')],{})[_0x970e('0x22')](respondWithResult(_0x314ed6,0xc9))[_0x970e('0x45')](handleError(_0x314ed6,null));};exports[_0x970e('0x21')]=function(_0x3bba76,_0x32078c){if(_0x3bba76[_0x970e('0x4b')]['id']){delete _0x3bba76[_0x970e('0x4b')]['id'];}return db[_0x970e('0x2a')][_0x970e('0x49')]({'where':{'id':_0x3bba76[_0x970e('0x47')]['id']}})[_0x970e('0x22')](handleEntityNotFound(_0x32078c,null))[_0x970e('0x22')](saveUpdates(_0x3bba76[_0x970e('0x4b')],null))[_0x970e('0x22')](respondWithResult(_0x32078c,null))['catch'](handleError(_0x32078c,null));};exports[_0x970e('0x23')]=function(_0x16d78b,_0x5f1f6a){return db[_0x970e('0x2a')][_0x970e('0x49')]({'where':{'id':_0x16d78b[_0x970e('0x47')]['id']}})[_0x970e('0x22')](handleEntityNotFound(_0x5f1f6a,null))[_0x970e('0x22')](removeEntity(_0x5f1f6a,null))[_0x970e('0x45')](handleError(_0x5f1f6a,null));};exports[_0x970e('0x4c')]=function(_0x246aa6,_0x52a53f){return db[_0x970e('0x2a')][_0x970e('0x4c')]()[_0x970e('0x22')](respondWithResult(_0x52a53f,null))[_0x970e('0x45')](handleError(_0x52a53f,null));}; \ No newline at end of file +var _0xdd8c=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','WhatsappTransferReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xdd8c,0xcb));var _0xcdd8=function(_0x323071,_0x123b2d){_0x323071=_0x323071-0x0;var _0x8894a9=_0xdd8c[_0x323071];return _0x8894a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdd8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcdd8('0x1'));var rp=require(_0xcdd8('0x2'));var moment=require(_0xcdd8('0x3'));var BPromise=require(_0xcdd8('0x4'));var Mustache=require('mustache');var util=require(_0xcdd8('0x5'));var path=require('path');var sox=require(_0xcdd8('0x6'));var csv=require(_0xcdd8('0x7'));var ejs=require(_0xcdd8('0x8'));var fs=require('fs');var fs_extra=require(_0xcdd8('0x9'));var _=require('lodash');var squel=require(_0xcdd8('0xa'));var crypto=require(_0xcdd8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcdd8('0xc'));var toCsv=require(_0xcdd8('0x7'));var querystring=require(_0xcdd8('0xd'));var Papa=require(_0xcdd8('0xe'));var Redis=require(_0xcdd8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcdd8('0x10'));var as=require(_0xcdd8('0x11'));var hardwareService=require(_0xcdd8('0x12'));var logger=require(_0xcdd8('0x13'))(_0xcdd8('0x14'));var utils=require(_0xcdd8('0x15'));var config=require(_0xcdd8('0x16'));var licenseUtil=require(_0xcdd8('0x17'));var db=require(_0xcdd8('0x18'))['db'];function respondWithStatusCode(_0x286a2e,_0xc386ae){_0xc386ae=_0xc386ae||0xcc;return function(_0x550900){if(_0x550900){return _0x286a2e['sendStatus'](_0xc386ae);}return _0x286a2e[_0xcdd8('0x19')](_0xc386ae)[_0xcdd8('0x1a')]();};}function respondWithResult(_0x12804c,_0x30e128){_0x30e128=_0x30e128||0xc8;return function(_0x5aabfa){if(_0x5aabfa){return _0x12804c[_0xcdd8('0x19')](_0x30e128)[_0xcdd8('0x1b')](_0x5aabfa);}};}function respondWithFilteredResult(_0x5e6205,_0x3fc8c8){return function(_0x1951c4){if(_0x1951c4){var _0x10aee5=typeof _0x3fc8c8[_0xcdd8('0x1c')]===_0xcdd8('0x1d')&&typeof _0x3fc8c8['limit']==='undefined';var _0x28053e=_0x1951c4[_0xcdd8('0x1e')];var _0x1a59e6=_0x10aee5?0x0:_0x3fc8c8[_0xcdd8('0x1c')];var _0x35992d=_0x10aee5?_0x1951c4['count']:_0x3fc8c8[_0xcdd8('0x1c')]+_0x3fc8c8[_0xcdd8('0x1f')];var _0x4bba22;if(_0x35992d>=_0x28053e){_0x35992d=_0x28053e;_0x4bba22=0xc8;}else{_0x4bba22=0xce;}_0x5e6205['status'](_0x4bba22);return _0x5e6205[_0xcdd8('0x20')](_0xcdd8('0x21'),_0x1a59e6+'-'+_0x35992d+'/'+_0x28053e)[_0xcdd8('0x1b')](_0x1951c4);}return null;};}function patchUpdates(_0x49ef63){return function(_0x36bfb0){try{jsonpatch[_0xcdd8('0x22')](_0x36bfb0,_0x49ef63,!![]);}catch(_0xa7efcd){return BPromise[_0xcdd8('0x23')](_0xa7efcd);}return _0x36bfb0[_0xcdd8('0x24')]();};}function saveUpdates(_0x429abe,_0x201d20){return function(_0x2a11df){if(_0x2a11df){return _0x2a11df[_0xcdd8('0x25')](_0x429abe)[_0xcdd8('0x26')](function(_0x54b3ce){return _0x54b3ce;});}return null;};}function removeEntity(_0x4e580e,_0x3dcf54){return function(_0x46afae){if(_0x46afae){return _0x46afae[_0xcdd8('0x27')]()[_0xcdd8('0x26')](function(){_0x4e580e[_0xcdd8('0x19')](0xcc)[_0xcdd8('0x1a')]();});}};}function handleEntityNotFound(_0x1bf0b4,_0x3f92c9){return function(_0x5107a0){if(!_0x5107a0){_0x1bf0b4['sendStatus'](0x194);}return _0x5107a0;};}function handleError(_0x5e27f0,_0x2668a6){_0x2668a6=_0x2668a6||0x1f4;return function(_0x258861){logger['error'](_0x258861['stack']);if(_0x258861[_0xcdd8('0x28')]){delete _0x258861['name'];}_0x5e27f0[_0xcdd8('0x19')](_0x2668a6)[_0xcdd8('0x29')](_0x258861);};}exports['index']=function(_0x3e2ab8,_0x33cd46){var _0x44ebb5={},_0x4788d6={},_0x521042={'count':0x0,'rows':[]};var _0x1052c7=_['map'](db[_0xcdd8('0x2a')][_0xcdd8('0x2b')],function(_0x639788){return{'name':_0x639788[_0xcdd8('0x2c')],'type':_0x639788[_0xcdd8('0x2d')][_0xcdd8('0x2e')]};});_0x4788d6['model']=_[_0xcdd8('0x2f')](_0x1052c7,_0xcdd8('0x28'));_0x4788d6[_0xcdd8('0x30')]=_['keys'](_0x3e2ab8[_0xcdd8('0x30')]);_0x4788d6[_0xcdd8('0x31')]=_[_0xcdd8('0x32')](_0x4788d6['model'],_0x4788d6[_0xcdd8('0x30')]);_0x44ebb5[_0xcdd8('0x33')]=_[_0xcdd8('0x32')](_0x4788d6[_0xcdd8('0x34')],qs[_0xcdd8('0x35')](_0x3e2ab8[_0xcdd8('0x30')][_0xcdd8('0x35')]));_0x44ebb5[_0xcdd8('0x33')]=_0x44ebb5[_0xcdd8('0x33')][_0xcdd8('0x36')]?_0x44ebb5[_0xcdd8('0x33')]:_0x4788d6[_0xcdd8('0x34')];if(!_0x3e2ab8['query']['hasOwnProperty'](_0xcdd8('0x37'))){_0x44ebb5[_0xcdd8('0x1f')]=qs[_0xcdd8('0x1f')](_0x3e2ab8[_0xcdd8('0x30')][_0xcdd8('0x1f')]);_0x44ebb5[_0xcdd8('0x1c')]=qs[_0xcdd8('0x1c')](_0x3e2ab8['query']['offset']);}_0x44ebb5[_0xcdd8('0x38')]=qs['sort'](_0x3e2ab8[_0xcdd8('0x30')][_0xcdd8('0x39')]);_0x44ebb5[_0xcdd8('0x3a')]=qs[_0xcdd8('0x31')](_[_0xcdd8('0x3b')](_0x3e2ab8[_0xcdd8('0x30')],_0x4788d6['filters']),_0x1052c7);if(_0x3e2ab8['query']['filter']){_0x44ebb5['where']=_['merge'](_0x44ebb5['where'],{'$or':_['map'](_0x1052c7,function(_0x5307fd){if(_0x5307fd[_0xcdd8('0x2d')]!==_0xcdd8('0x3c')){var _0x2982b2={};_0x2982b2[_0x5307fd[_0xcdd8('0x28')]]={'$like':'%'+_0x3e2ab8[_0xcdd8('0x30')][_0xcdd8('0x3d')]+'%'};return _0x2982b2;}})});}_0x44ebb5=_[_0xcdd8('0x3e')]({},_0x44ebb5,_0x3e2ab8['options']);var _0x147b36={'where':_0x44ebb5['where']};return db['WhatsappTransferReport'][_0xcdd8('0x1e')](_0x147b36)[_0xcdd8('0x26')](function(_0x47cd1d){_0x521042['count']=_0x47cd1d;if(_0x3e2ab8[_0xcdd8('0x30')][_0xcdd8('0x3f')]){_0x44ebb5[_0xcdd8('0x40')]=[{'all':!![]}];}return db[_0xcdd8('0x2a')][_0xcdd8('0x41')](_0x44ebb5);})[_0xcdd8('0x26')](function(_0x3ca2b5){_0x521042['rows']=_0x3ca2b5;return _0x521042;})[_0xcdd8('0x26')](respondWithFilteredResult(_0x33cd46,_0x44ebb5))[_0xcdd8('0x42')](handleError(_0x33cd46,null));};exports[_0xcdd8('0x43')]=function(_0x2a385f,_0x4116ae){var _0x2d4faa={'raw':!![],'where':{'id':_0x2a385f[_0xcdd8('0x44')]['id']}},_0x5198cc={};_0x5198cc[_0xcdd8('0x34')]=_['keys'](db[_0xcdd8('0x2a')][_0xcdd8('0x2b')]);_0x5198cc[_0xcdd8('0x30')]=_[_0xcdd8('0x45')](_0x2a385f[_0xcdd8('0x30')]);_0x5198cc[_0xcdd8('0x31')]=_[_0xcdd8('0x32')](_0x5198cc[_0xcdd8('0x34')],_0x5198cc['query']);_0x2d4faa['attributes']=_['intersection'](_0x5198cc[_0xcdd8('0x34')],qs['fields'](_0x2a385f['query']['fields']));_0x2d4faa[_0xcdd8('0x33')]=_0x2d4faa[_0xcdd8('0x33')]['length']?_0x2d4faa[_0xcdd8('0x33')]:_0x5198cc[_0xcdd8('0x34')];if(_0x2a385f['query'][_0xcdd8('0x3f')]){_0x2d4faa[_0xcdd8('0x40')]=[{'all':!![]}];}_0x2d4faa=_[_0xcdd8('0x3e')]({},_0x2d4faa,_0x2a385f[_0xcdd8('0x46')]);return db['WhatsappTransferReport'][_0xcdd8('0x47')](_0x2d4faa)[_0xcdd8('0x26')](handleEntityNotFound(_0x4116ae,null))[_0xcdd8('0x26')](respondWithResult(_0x4116ae,null))['catch'](handleError(_0x4116ae,null));};exports[_0xcdd8('0x48')]=function(_0x3fb0f0,_0x4cbda8){return db[_0xcdd8('0x2a')][_0xcdd8('0x48')](_0x3fb0f0[_0xcdd8('0x49')],{})[_0xcdd8('0x26')](respondWithResult(_0x4cbda8,0xc9))['catch'](handleError(_0x4cbda8,null));};exports[_0xcdd8('0x25')]=function(_0x248841,_0x143d2f){if(_0x248841[_0xcdd8('0x49')]['id']){delete _0x248841[_0xcdd8('0x49')]['id'];}return db[_0xcdd8('0x2a')][_0xcdd8('0x47')]({'where':{'id':_0x248841[_0xcdd8('0x44')]['id']}})[_0xcdd8('0x26')](handleEntityNotFound(_0x143d2f,null))[_0xcdd8('0x26')](saveUpdates(_0x248841[_0xcdd8('0x49')],null))[_0xcdd8('0x26')](respondWithResult(_0x143d2f,null))[_0xcdd8('0x42')](handleError(_0x143d2f,null));};exports[_0xcdd8('0x27')]=function(_0x39df5d,_0x3c1f6d){return db['WhatsappTransferReport'][_0xcdd8('0x47')]({'where':{'id':_0x39df5d['params']['id']}})['then'](handleEntityNotFound(_0x3c1f6d,null))[_0xcdd8('0x26')](removeEntity(_0x3c1f6d,null))['catch'](handleError(_0x3c1f6d,null));};exports['describe']=function(_0x1ed5f9,_0x12eb81){return db[_0xcdd8('0x2a')][_0xcdd8('0x4a')]()[_0xcdd8('0x26')](respondWithResult(_0x12eb81,null))[_0xcdd8('0x42')](handleError(_0x12eb81,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 591061c..52029e9 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.model.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x448e=['path','rimraf','exports','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x492445,_0x1454f9){var _0x34ca20=function(_0x33e606){while(--_0x33e606){_0x492445['push'](_0x492445['shift']());}};_0x34ca20(++_0x1454f9);}(_0x448e,0x9f));var _0xe448=function(_0x2cdfa7,_0x34eeb6){_0x2cdfa7=_0x2cdfa7-0x0;var _0x23a81a=_0x448e[_0x2cdfa7];return _0x23a81a;};'use strict';var _=require(_0xe448('0x0'));var util=require(_0xe448('0x1'));var logger=require(_0xe448('0x2'))('api');var moment=require(_0xe448('0x3'));var BPromise=require(_0xe448('0x4'));var rp=require(_0xe448('0x5'));var fs=require('fs');var path=require(_0xe448('0x6'));var rimraf=require(_0xe448('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0xe448('0x8')]=function(_0x5595dc,_0x478de6){return _0x5595dc['define'](_0xe448('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xe448('0xa'),'fields':[_0xe448('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4909=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2ea6a4,_0x35d33d){var _0x47094b=function(_0x1d9ddb){while(--_0x1d9ddb){_0x2ea6a4['push'](_0x2ea6a4['shift']());}};_0x47094b(++_0x35d33d);}(_0x4909,0x18b));var _0x9490=function(_0x303862,_0x20b5ab){_0x303862=_0x303862-0x0;var _0xe6f228=_0x4909[_0x303862];return _0xe6f228;};'use strict';var _=require(_0x9490('0x0'));var util=require(_0x9490('0x1'));var logger=require(_0x9490('0x2'))(_0x9490('0x3'));var moment=require('moment');var BPromise=require(_0x9490('0x4'));var rp=require(_0x9490('0x5'));var fs=require('fs');var path=require(_0x9490('0x6'));var rimraf=require(_0x9490('0x7'));var config=require('../../config/environment');var attributes=require(_0x9490('0x8'));module[_0x9490('0x9')]=function(_0x3f5cda,_0x37d23f){return _0x3f5cda[_0x9490('0xa')](_0x9490('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x9490('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 1ab6882..e82adb3 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad40=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util'];(function(_0x1f6eca,_0x4d721d){var _0x10f5c9=function(_0x1ea187){while(--_0x1ea187){_0x1f6eca['push'](_0x1f6eca['shift']());}};_0x10f5c9(++_0x4d721d);}(_0xad40,0xfa));var _0x0ad4=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xad40[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0ad4('0x0'));var util=require(_0x0ad4('0x1'));var moment=require(_0x0ad4('0x2'));var BPromise=require(_0x0ad4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ad4('0x4'));var db=require(_0x0ad4('0x5'))['db'];var utils=require(_0x0ad4('0x6'));var logger=require(_0x0ad4('0x7'))(_0x0ad4('0x8'));var config=require(_0x0ad4('0x9'));var jayson=require(_0x0ad4('0xa'));var client=jayson['client'][_0x0ad4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ad5fc,_0x1fa7ac,_0x3e738d){return new BPromise(function(_0x44b342,_0x29f1ee){return client[_0x0ad4('0xc')](_0x1ad5fc,_0x3e738d)['then'](function(_0x918eb4){logger[_0x0ad4('0xd')](_0x0ad4('0xe'),_0x1fa7ac,_0x0ad4('0xf'));logger[_0x0ad4('0x10')](_0x0ad4('0x11'),_0x1fa7ac,_0x0ad4('0xf'),JSON['stringify'](_0x918eb4));if(_0x918eb4[_0x0ad4('0x12')]){if(_0x918eb4[_0x0ad4('0x12')][_0x0ad4('0x13')]===0x1f4){logger[_0x0ad4('0x12')](_0x0ad4('0xe'),_0x1fa7ac,_0x918eb4[_0x0ad4('0x12')][_0x0ad4('0x14')]);return _0x29f1ee(_0x918eb4[_0x0ad4('0x12')][_0x0ad4('0x14')]);}logger[_0x0ad4('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1fa7ac,_0x918eb4[_0x0ad4('0x12')]['message']);return _0x44b342(_0x918eb4[_0x0ad4('0x12')]['message']);}else{logger[_0x0ad4('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1fa7ac,_0x0ad4('0xf'));_0x44b342(_0x918eb4['result'][_0x0ad4('0x14')]);}})['catch'](function(_0x244474){logger[_0x0ad4('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1fa7ac,_0x244474);_0x29f1ee(_0x244474);});});} \ No newline at end of file +var _0xf545=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info'];(function(_0x19413a,_0x373beb){var _0x13e4cf=function(_0x131fc2){while(--_0x131fc2){_0x19413a['push'](_0x19413a['shift']());}};_0x13e4cf(++_0x373beb);}(_0xf545,0x179));var _0x5f54=function(_0x48b724,_0x5a8e26){_0x48b724=_0x48b724-0x0;var _0x4d38b3=_0xf545[_0x48b724];return _0x4d38b3;};'use strict';var _=require(_0x5f54('0x0'));var util=require(_0x5f54('0x1'));var moment=require(_0x5f54('0x2'));var BPromise=require(_0x5f54('0x3'));var rs=require(_0x5f54('0x4'));var fs=require('fs');var Redis=require(_0x5f54('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f54('0x6'));var logger=require(_0x5f54('0x7'))(_0x5f54('0x8'));var config=require(_0x5f54('0x9'));var jayson=require(_0x5f54('0xa'));var client=jayson['client'][_0x5f54('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc52cc8,_0x991302,_0x144003){return new BPromise(function(_0x59cea9,_0xa1e9ea){return client[_0x5f54('0xc')](_0xc52cc8,_0x144003)[_0x5f54('0xd')](function(_0xbcc5f8){logger['info'](_0x5f54('0xe'),_0x991302,_0x5f54('0xf'));logger[_0x5f54('0x10')](_0x5f54('0x11'),_0x991302,'request\x20sent',JSON[_0x5f54('0x12')](_0xbcc5f8));if(_0xbcc5f8['error']){if(_0xbcc5f8['error'][_0x5f54('0x13')]===0x1f4){logger[_0x5f54('0x14')](_0x5f54('0xe'),_0x991302,_0xbcc5f8[_0x5f54('0x14')]['message']);return _0xa1e9ea(_0xbcc5f8[_0x5f54('0x14')][_0x5f54('0x15')]);}logger[_0x5f54('0x14')](_0x5f54('0xe'),_0x991302,_0xbcc5f8['error']['message']);return _0x59cea9(_0xbcc5f8[_0x5f54('0x14')][_0x5f54('0x15')]);}else{logger[_0x5f54('0x16')](_0x5f54('0xe'),_0x991302,'request\x20sent');_0x59cea9(_0xbcc5f8[_0x5f54('0x17')][_0x5f54('0x15')]);}})[_0x5f54('0x18')](function(_0x55b376){logger[_0x5f54('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x991302,_0x55b376);_0xa1e9ea(_0x55b376);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index a46e929..51cd008 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c94=['App\x20Ready!','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None'];(function(_0xdf5d2b,_0x306808){var _0xd3f6cb=function(_0x5307e2){while(--_0x5307e2){_0xdf5d2b['push'](_0xdf5d2b['shift']());}};_0xd3f6cb(++_0x306808);}(_0x3c94,0xcd));var _0x43c9=function(_0x4b43c0,_0x3a8091){_0x4b43c0=_0x4b43c0-0x0;var _0x574c13=_0x3c94[_0x4b43c0];return _0x574c13;};'use strict';var _=require(_0x43c9('0x0'));var db=require(_0x43c9('0x1'))['db'];var seedDb=require(_0x43c9('0x2'));var checkLicense=require(_0x43c9('0x3'));var rpc=require(_0x43c9('0x4'));var config=require(_0x43c9('0x5'));var logger=require(_0x43c9('0x6'))(_0x43c9('0x7'));var pm2=require(_0x43c9('0x8'));var pm2Config=require(_0x43c9('0x9'));var schedule=require(_0x43c9('0xa'));var chat=require(_0x43c9('0xb'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x43c9('0xc'));var provider=require(_0x43c9('0xd'));function main(){return db[_0x43c9('0xe')][_0x43c9('0xf')]()[_0x43c9('0x10')](function(){if(config[_0x43c9('0x11')]){return seedDb[_0x43c9('0x12')]();}})[_0x43c9('0x10')](function(){return checkLicense[_0x43c9('0x12')]();})['then'](function(){return rpc[_0x43c9('0x13')]();})[_0x43c9('0x10')](function(_0x34bb65){logger[_0x43c9('0x14')](_0x34bb65);return chat[_0x43c9('0x15')]();})[_0x43c9('0x10')](function(){return whatsapp[_0x43c9('0x15')]();})[_0x43c9('0x10')](function(){return schedule[_0x43c9('0x15')]();})[_0x43c9('0x10')](function(){return transcribe[_0x43c9('0x15')]();})[_0x43c9('0x10')](function(){return provider[_0x43c9('0x15')]();})[_0x43c9('0x10')](function(_0xa98d2f){logger[_0x43c9('0x14')](_0xa98d2f);return pm2[_0x43c9('0x15')](pm2Config);})['then'](function(_0x37932f){var _0x1c7fd9=_0x37932f[_0x43c9('0x16')](function(_0xe02707){return typeof _0xe02707[_0x43c9('0x17')]==='number'&&_0xe02707['exitCode']>=0x0;});if(_0x1c7fd9[_0x43c9('0x18')]>0x0){throw new Error(_0x1c7fd9[_0x43c9('0x18')]+_0x43c9('0x19')+_[_0x43c9('0x1a')](_0x1c7fd9,function(_0x501856){return'\x22'+_0x501856[_0x43c9('0x1b')][_0x43c9('0x1c')]+'\x22';}));}logger[_0x43c9('0x14')](_0x43c9('0x1d'),_[_0x43c9('0x1a')](_[_0x43c9('0x16')](_0x37932f,{'status':_0x43c9('0x1e')}),_0x43c9('0x1c'))[_0x43c9('0x1f')]());logger[_0x43c9('0x14')](_0x43c9('0x20'),_['map'](_[_0x43c9('0x16')](_0x37932f,function(_0x772b71){return _0x772b71[_0x43c9('0x21')]!=='online';}),_0x43c9('0x1c'))[_0x43c9('0x1f')]()||_0x43c9('0x22'));console['log'](_0x43c9('0x23'));})[_0x43c9('0x24')](function(_0x460f53){console['log']('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x460f53);logger[_0x43c9('0x25')](_0x43c9('0x26'),_0x460f53);process[_0x43c9('0x27')](0x1);});}main(); \ No newline at end of file +var _0x7b83=['./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','online','Offline\x20apps:','status','join','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat'];(function(_0x3e6980,_0x190736){var _0x5697dc=function(_0xb86ad8){while(--_0xb86ad8){_0x3e6980['push'](_0x3e6980['shift']());}};_0x5697dc(++_0x190736);}(_0x7b83,0xa1));var _0x37b8=function(_0x4215b8,_0x398c6c){_0x4215b8=_0x4215b8-0x0;var _0x45f9c3=_0x7b83[_0x4215b8];return _0x45f9c3;};'use strict';var _=require(_0x37b8('0x0'));var db=require(_0x37b8('0x1'))['db'];var seedDb=require(_0x37b8('0x2'));var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require(_0x37b8('0x3'));var logger=require(_0x37b8('0x4'))(_0x37b8('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x37b8('0x6'));var schedule=require(_0x37b8('0x7'));var chat=require(_0x37b8('0x8'));var whatsapp=require(_0x37b8('0x9'));var transcribe=require(_0x37b8('0xa'));var provider=require(_0x37b8('0xb'));function main(){return db['sequelize'][_0x37b8('0xc')]()[_0x37b8('0xd')](function(){if(config['seedDB']){return seedDb[_0x37b8('0xe')]();}})['then'](function(){return checkLicense['default']();})['then'](function(){return rpc['listen']();})[_0x37b8('0xd')](function(_0xa1526a){logger[_0x37b8('0xf')](_0xa1526a);return chat[_0x37b8('0x10')]();})[_0x37b8('0xd')](function(){return whatsapp['start']();})[_0x37b8('0xd')](function(){return schedule['start']();})[_0x37b8('0xd')](function(){return transcribe['start']();})[_0x37b8('0xd')](function(){return provider[_0x37b8('0x10')]();})[_0x37b8('0xd')](function(_0xf737ae){logger[_0x37b8('0xf')](_0xf737ae);return pm2['start'](pm2Config);})['then'](function(_0x316229){var _0x35fe29=_0x316229[_0x37b8('0x11')](function(_0x4ab58e){return typeof _0x4ab58e['exitCode']===_0x37b8('0x12')&&_0x4ab58e[_0x37b8('0x13')]>=0x0;});if(_0x35fe29[_0x37b8('0x14')]>0x0){throw new Error(_0x35fe29[_0x37b8('0x14')]+_0x37b8('0x15')+_[_0x37b8('0x16')](_0x35fe29,function(_0x286cf3){return'\x22'+_0x286cf3['pm2_env'][_0x37b8('0x17')]+'\x22';}));}logger['info']('Online\x20apps:',_[_0x37b8('0x16')](_[_0x37b8('0x11')](_0x316229,{'status':_0x37b8('0x18')}),_0x37b8('0x17'))['join']());logger[_0x37b8('0xf')](_0x37b8('0x19'),_[_0x37b8('0x16')](_[_0x37b8('0x11')](_0x316229,function(_0x497623){return _0x497623[_0x37b8('0x1a')]!==_0x37b8('0x18');}),_0x37b8('0x17'))[_0x37b8('0x1b')]()||'None');console[_0x37b8('0x1c')](_0x37b8('0x1d'));})[_0x37b8('0x1e')](function(_0x1cf84a){console[_0x37b8('0x1c')](_0x37b8('0x1f'),_0x1cf84a);logger[_0x37b8('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1cf84a);process[_0x37b8('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5dd571b..45c21e1 100644 --- a/server/components/auth/service.js +++ b/server/components/auth/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['util','moment','session','role','fullname','name','internal','userpic','voicePause','chatPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','then','disposition','unmanaged','json','Forbidden.','headers','authorization','startsWith','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','join','promisify','secret','secrets','payload','options','randomBytes','toString','floor','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','basic-auth','crypto','bluebird'];(function(_0x2a07fe,_0x1af7a0){var _0x1eee5f=function(_0x24158d){while(--_0x24158d){_0x2a07fe['push'](_0x2a07fe['shift']());}};_0x1eee5f(++_0x1af7a0);}(_0x3e74,0x175));var _0x43e7=function(_0x28e492,_0x2c8c2f){_0x28e492=_0x28e492-0x0;var _0x3b2017=_0x3e74[_0x28e492];return _0x3b2017;};'use strict';var db=require(_0x43e7('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x43e7('0x1'));var licenseUtil=require(_0x43e7('0x2'));var encryptor=require(_0x43e7('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x43e7('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x43e7('0x5'));var crypto=require(_0x43e7('0x6'));var BPromise=require(_0x43e7('0x7'));var util=require(_0x43e7('0x8'));var moment=require(_0x43e7('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x43e7('0xa')]});var userAttributes=['id',_0x43e7('0xb'),_0x43e7('0xc'),_0x43e7('0xd'),_0x43e7('0xe'),'email',_0x43e7('0xf'),'permissions','md5secret',_0x43e7('0x10'),_0x43e7('0x11'),'mailPause',_0x43e7('0x12'),'smsPause',_0x43e7('0x13'),_0x43e7('0x14'),'showWebBar',_0x43e7('0x15'),_0x43e7('0x16'),_0x43e7('0x17'),_0x43e7('0x18'),'passwordResetAt','alias',_0x43e7('0x19'),_0x43e7('0x1a'),_0x43e7('0x1b'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x43e7('0x1c'),_0x43e7('0x1d'),_0x43e7('0x1e'),_0x43e7('0x1f'),'phoneBarRemoteControlPort','hotdesk',_0x43e7('0x20'),_0x43e7('0x21'),_0x43e7('0x22'),'settingsEnabled','wssPort',_0x43e7('0x23'),_0x43e7('0x24'),_0x43e7('0x25'),_0x43e7('0x26'),_0x43e7('0x27'),_0x43e7('0x28'),_0x43e7('0x29'),_0x43e7('0x2a'),_0x43e7('0x2b'),_0x43e7('0x2c'),_0x43e7('0x2d'),_0x43e7('0x2e'),'openchannelAutoanswerDelay',_0x43e7('0x2f'),_0x43e7('0x30'),'whatsappAutoanswer',_0x43e7('0x31')];exports[_0x43e7('0x32')]=function(){return this[_0x43e7('0x33')](!![])[_0x43e7('0x34')](function(_0x4077fb,_0x2f4cb4,_0x54a9e7){if(_0x4077fb[_0x43e7('0x35')]){_0x54a9e7();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x4077fb[_0x43e7('0x36')]['id']},'attributes':['id',_0x43e7('0x37'),'disposition'],'raw':!![]})[_0x43e7('0x38')](function(_0x4ca5cf){if(_0x4ca5cf&&_0x4ca5cf[_0x43e7('0x37')]){return _0x2f4cb4['status'](_0x4ca5cf[_0x43e7('0x39')]===_0x43e7('0x3a')?0x195:0x193)[_0x43e7('0x3b')]({'message':_0x4ca5cf[_0x43e7('0x39')]==='unmanaged'?'Unmanaged.':_0x43e7('0x3c')});}else{_0x54a9e7();}})['catch'](function(_0x2dd5f){_0x54a9e7(_0x2dd5f);});}});};exports[_0x43e7('0x33')]=function isAuthenticated(_0x3565cf){return compose()[_0x43e7('0x34')](function(_0x5087d7,_0x33a1a5,_0x4690a6){var _0x45b675;if(_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')]){if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')],_0x43e7('0x40'))){var _0x35dbcd=basicAuth(_0x5087d7);db[_0x43e7('0x41')][_0x43e7('0x42')]({'where':{'name':_0x35dbcd[_0x43e7('0xd')]}})[_0x43e7('0x38')](function(_0x4bdb17){if(!_0x4bdb17||!_0x4bdb17[_0x43e7('0x43')](_0x35dbcd[_0x43e7('0x44')])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x46')});}_0x5087d7['user']={'id':_0x4bdb17['id']};_0x4690a6();})[_0x43e7('0x47')](function(_0x49b83d){_0x4690a6(_0x49b83d);});}else if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')]['authorization'],'Bearer')){validateJwt(_0x5087d7,_0x33a1a5,_0x4690a6);}else{if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5['status'](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x48')});}}}else if(_0x5087d7[_0x43e7('0x49')][_0x43e7('0x4a')]){try{var _0x108313={'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5087d7['query']['apikey'],_0x108313)['then'](function(_0x4e8e86){return db['User']['find']({'where':{'id':_0x4e8e86[_0x43e7('0x4c')]}})['then'](function(_0x2b4bfd){_0x45b675=_0x2b4bfd;return db[_0x43e7('0x4d')][_0x43e7('0x4e')]({'where':{'id':0x1},'attributes':[_0x43e7('0x4f'),_0x43e7('0x50')],'raw':!![]});})[_0x43e7('0x38')](function(_0x101d45){if(!_0x45b675||!_['isEqual'](_0x45b675['apiKeyNonce'],_0x4e8e86['nonce'])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x51')});}if(_0x45b675[_0x43e7('0x52')]){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}if(_0x45b675[_0x43e7('0x54')]){if(_0x101d45['blockDuration']>0x0){if(moment(_0x45b675[_0x43e7('0x55')])[_0x43e7('0x56')](_0x101d45['blockDuration'],_0x43e7('0x57'))>moment()){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}else{return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}_0x5087d7[_0x43e7('0x35')]={'id':_0x45b675['id']};_0x4690a6();});})['catch'](function(){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});});}catch(_0x44b6ae){_0x4690a6(_0x44b6ae);}}else if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':'Unknown\x20authorization\x20format'});}})[_0x43e7('0x34')](function(_0x4227c4,_0x575439,_0x3628e0){if(_0x4227c4['user']){db[_0x43e7('0x41')]['find']({'where':{'id':_0x4227c4[_0x43e7('0x35')]['id']},'attributes':userAttributes})[_0x43e7('0x38')](function(_0x3a5807){if(!_0x3a5807){return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x4227c4[_0x43e7('0x35')]=_0x3a5807;_0x3628e0();})[_0x43e7('0x47')](function(_0xe979b5){_0x3628e0(_0xe979b5);});}else if(_0x3565cf){_0x3628e0();}else{return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x43e7('0x34')](function(_0x57f5d0,_0x2ab022,_0x4b3a59){return licenseUtil['getLicense']()[_0x43e7('0x38')](function(_0x5ee1c5){if(_0x5ee1c5[_0x43e7('0x58')]){_0x4b3a59();}else{return _0x2ab022[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x59')});}})['catch'](function(_0x91f1e4){_0x4b3a59(_0x91f1e4);});});};exports[_0x43e7('0x5a')]=function isWebrtcLicence(){return compose()[_0x43e7('0x34')](function(_0x1fd277,_0x296dc8,_0x1efe59){return licenseUtil['getLicense']()['then'](function(_0x3bc9de){if(_0x3bc9de[_0x43e7('0x5b')]){_0x1efe59();}else{return _0x296dc8[_0x43e7('0x45')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x292ded){_0x1efe59(_0x292ded);});});};exports[_0x43e7('0x5c')]=function(_0x52b098,_0x351ca2,_0x47686e){_0x52b098[_0x43e7('0x5c')]=!![];return _0x47686e();};exports['signToken']=function signToken(_0x593155){return signJwt(_0x593155);};exports['setTokenCookie']=function(_0x4de644,_0x214e7e){if(!_0x4de644[_0x43e7('0x35')]){return _0x214e7e['status'](0x194)[_0x43e7('0x3b')]({'message':_0x43e7('0x5d')});}var _0x426bcb={'payload':{'id':_0x4de644[_0x43e7('0x35')]['id'],'role':_0x4de644['user'][_0x43e7('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x426bcb)['then'](function(_0x4bebd4){_0x214e7e[_0x43e7('0x5e')](_0x43e7('0x5f'),_0x4bebd4);_0x214e7e[_0x43e7('0x60')](_0x43e7('0x61'));})[_0x43e7('0x47')](function(_0x2351cf){return _0x214e7e[_0x43e7('0x45')](0x1f4)[_0x43e7('0x62')](_0x2351cf);});};exports[_0x43e7('0x63')]=function(_0x2b5515){if(_['isNil'](_0x2b5515[_0x43e7('0x64')])||_[_0x43e7('0x65')](_0x2b5515['apiKeyIat'])){return null;}else{return createJwt(_0x2b5515);}};exports[_0x43e7('0x66')]=function(_0x4e6f6d){_0x4e6f6d[_0x43e7('0x64')]=generateNonce();_0x4e6f6d[_0x43e7('0x67')]=generateIssuedAt();return createJwt(_0x4e6f6d);};exports[_0x43e7('0x68')]=function(_0x1f561f,_0xfe13fa){var _0x5e5556=_0x1f561f['query'][_0x43e7('0x4a')];if(_0x5e5556){var _0x2ab7ee={'nonce':_0xfe13fa[_0x43e7('0x64')],'iat':_0xfe13fa[_0x43e7('0x67')],'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf[_0x43e7('0x4b')]()};return verifyJwt(_0x5e5556,_0x2ab7ee)[_0x43e7('0x38')](function(){return generateApiKey(_0xfe13fa);});}else{throw{'message':_0x43e7('0x69')};}};exports[_0x43e7('0x6a')]=function(_0x24e758){var _0x312306=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x312306['test'](_0x24e758))throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x43e7('0x6d')]=function(_0x220bf2,_0x2d0052,_0x558d54){var _0x5d63c6=encryptor[_0x43e7('0x6e')](_0x2d0052)[_0x43e7('0x6f')](',');for(var _0x4ebdde=0x0;_0x4ebdde<_0x558d54;_0x4ebdde++){if(!_0x5d63c6[_0x4ebdde])break;if(_0x220bf2[_0x43e7('0x70')]()===_0x5d63c6[_0x4ebdde]['toLowerCase']()){var _0x49a6ce=util[_0x43e7('0x71')](_0x43e7('0x72'),_0x558d54);if(_0x558d54===0x1){_0x49a6ce=_0x43e7('0x73');}throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))](_0x49a6ce);}}return;};exports['updatePasswordsHistory']=function(_0xc3976,_0xdb9fbe){var _0x4d89bd=_0xdb9fbe?encryptor[_0x43e7('0x6e')](_0xdb9fbe)[_0x43e7('0x6f')](','):[];if(_0x4d89bd[_0x43e7('0x74')]===0x5){_0x4d89bd['splice'](-0x1,0x1);}_0x4d89bd['unshift'](_0xc3976);return encryptor['encryptString'](_0x4d89bd[_0x43e7('0x75')](','));};function signJwt(_0x4058ce){var _0x323cf7=BPromise[_0x43e7('0x76')](jwt['sign'],{'context':jwt});var _0x5a50fc=_0x4058ce[_0x43e7('0x77')]||config[_0x43e7('0x78')][_0x43e7('0xa')];return new BPromise(function(_0x5dd349,_0x5ea0db){_0x323cf7(_0x4058ce[_0x43e7('0x79')],_0x5a50fc,_0x4058ce[_0x43e7('0x7a')])[_0x43e7('0x38')](function(_0x2a194d){_0x5dd349(_0x2a194d);})[_0x43e7('0x47')](function(_0xd41e79){_0x5ea0db(_0xd41e79);});});}function verifyJwt(_0x4665db,_0x46748f,_0x406155){var _0x381208=BPromise[_0x43e7('0x76')](jwt['verify'],{'context':jwt});var _0x5f3824=_0x406155||config[_0x43e7('0x78')]['session'];return new BPromise(function(_0x501616,_0x50edb2){_0x381208(_0x4665db,_0x5f3824,_0x46748f)[_0x43e7('0x38')](function(_0xe666b0){_0x501616(_0xe666b0);})['catch'](function(_0xfe5a8d){_0x50edb2(_0xfe5a8d);});});}function generateNonce(){return crypto[_0x43e7('0x7b')](0x10)[_0x43e7('0x7c')]('hex');}function generateIssuedAt(){return Math[_0x43e7('0x7d')](Date[_0x43e7('0x7e')]()/0x3e8)[_0x43e7('0x7c')]();}function createJwt(_0xc9723){var _0x2f43d7={'payload':{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723[_0x43e7('0x64')]},'options':{'algorithm':'HS512','subject':_0xc9723['id'][_0x43e7('0x7c')](),'issuer':hardwareConf[_0x43e7('0x4b')](),'audience':hardwareConf[_0x43e7('0x4b')]()}};return signJwt(_0x2f43d7)['then'](function(_0x56b06d){return{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723['apiKeyNonce'],'token':_0x56b06d};});} \ No newline at end of file +var _0x9bde=['whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','User','find','authenticate','pass','json','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','isNil','generateApiKey','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x41c49e,_0x4e9e2c){_0x41c49e=_0x41c49e-0x0;var _0x648a67=_0x9bde[_0x41c49e];return _0x648a67;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xe9bd('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xe9bd('0x1'));var encryptor=require('../encryptor');var _=require(_0xe9bd('0x2'));var jwt=require(_0xe9bd('0x3'));var expressJwt=require(_0xe9bd('0x4'));var compose=require(_0xe9bd('0x5'));var basicAuth=require(_0xe9bd('0x6'));var crypto=require(_0xe9bd('0x7'));var BPromise=require(_0xe9bd('0x8'));var util=require('util');var moment=require(_0xe9bd('0x9'));var validateJwt=expressJwt({'secret':config[_0xe9bd('0xa')][_0xe9bd('0xb')]});var userAttributes=['id',_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe'),_0xe9bd('0xf'),_0xe9bd('0x10'),_0xe9bd('0x11'),_0xe9bd('0x12'),'md5secret','voicePause',_0xe9bd('0x13'),_0xe9bd('0x14'),_0xe9bd('0x15'),'smsPause',_0xe9bd('0x16'),_0xe9bd('0x17'),_0xe9bd('0x18'),_0xe9bd('0x19'),'lastPauseAt',_0xe9bd('0x1a'),'allowmessenger',_0xe9bd('0x1b'),_0xe9bd('0x1c'),_0xe9bd('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0xe9bd('0x1e'),_0xe9bd('0x1f'),_0xe9bd('0x20'),_0xe9bd('0x21'),_0xe9bd('0x22'),_0xe9bd('0x23'),_0xe9bd('0x24'),'hotdesk',_0xe9bd('0x25'),_0xe9bd('0x26'),_0xe9bd('0x27'),'settingsEnabled',_0xe9bd('0x28'),_0xe9bd('0x29'),_0xe9bd('0x2a'),_0xe9bd('0x2b'),'ignorePauseForPreviewCalls',_0xe9bd('0x2c'),'chatAutoanswer',_0xe9bd('0x2d'),'emailAutoanswer',_0xe9bd('0x2e'),_0xe9bd('0x2f'),_0xe9bd('0x30'),_0xe9bd('0x31'),_0xe9bd('0x32'),_0xe9bd('0x33'),_0xe9bd('0x34'),'whatsappAutoanswer',_0xe9bd('0x35')];exports[_0xe9bd('0x36')]=function(){return this['isAuthenticated'](!![])[_0xe9bd('0x37')](function(_0x505c23,_0x238ab1,_0x1b9cc9){if(_0x505c23[_0xe9bd('0x38')]){_0x1b9cc9();}else{return db[_0xe9bd('0x39')]['findOne']({'where':{'id':_0x505c23[_0xe9bd('0x3a')]['id']},'attributes':['id',_0xe9bd('0x3b'),_0xe9bd('0x3c')],'raw':!![]})[_0xe9bd('0x3d')](function(_0x2641be){if(_0x2641be&&_0x2641be[_0xe9bd('0x3b')]){return _0x238ab1[_0xe9bd('0x3e')](_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?0x195:0x193)['json']({'message':_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?'Unmanaged.':_0xe9bd('0x40')});}else{_0x1b9cc9();}})[_0xe9bd('0x41')](function(_0x119672){_0x1b9cc9(_0x119672);});}});};exports[_0xe9bd('0x42')]=function isAuthenticated(_0x141b95){return compose()[_0xe9bd('0x37')](function(_0x519f48,_0x5b7f1d,_0x1de54c){var _0x56e409;if(_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')]){if(_[_0xe9bd('0x45')](_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')],'Basic')){var _0x4b7bc2=basicAuth(_0x519f48);db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'name':_0x4b7bc2[_0xe9bd('0xe')]}})[_0xe9bd('0x3d')](function(_0xe2436){if(!_0xe2436||!_0xe2436[_0xe9bd('0x48')](_0x4b7bc2[_0xe9bd('0x49')])){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':'Wrong\x20credentials.'});}_0x519f48[_0xe9bd('0x38')]={'id':_0xe2436['id']};_0x1de54c();})[_0xe9bd('0x41')](function(_0x390a43){_0x1de54c(_0x390a43);});}else if(_['startsWith'](_0x519f48['headers'][_0xe9bd('0x44')],_0xe9bd('0x4b'))){validateJwt(_0x519f48,_0x5b7f1d,_0x1de54c);}else{if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}}}else if(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')]){try{var _0x1c6173={'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};verifyJwt(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')],_0x1c6173)[_0xe9bd('0x3d')](function(_0x199477){return db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'id':_0x199477[_0xe9bd('0x50')]}})[_0xe9bd('0x3d')](function(_0x4c689d){_0x56e409=_0x4c689d;return db[_0xe9bd('0x51')][_0xe9bd('0x52')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe9bd('0x53')],'raw':!![]});})[_0xe9bd('0x3d')](function(_0x4c7d47){if(!_0x56e409||!_['isEqual'](_0x56e409[_0xe9bd('0x54')],_0x199477[_0xe9bd('0x55')])){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x56')});}if(_0x56e409[_0xe9bd('0x57')]){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x56e409[_0xe9bd('0x58')]){if(_0x4c7d47[_0xe9bd('0x53')]>0x0){if(moment(_0x56e409[_0xe9bd('0x59')])[_0xe9bd('0x5a')](_0x4c7d47['blockDuration'],_0xe9bd('0x5b'))>moment()){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}_0x519f48[_0xe9bd('0x38')]={'id':_0x56e409['id']};_0x1de54c();});})[_0xe9bd('0x41')](function(){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xcf9a0c){_0x1de54c(_0xcf9a0c);}}else if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d['status'](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}})[_0xe9bd('0x37')](function(_0x480797,_0x1ba613,_0x2923cf){if(_0x480797[_0xe9bd('0x38')]){db['User'][_0xe9bd('0x47')]({'where':{'id':_0x480797[_0xe9bd('0x38')]['id']},'attributes':userAttributes})[_0xe9bd('0x3d')](function(_0x388132){if(!_0x388132){return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5d')});}_0x480797[_0xe9bd('0x38')]=_0x388132;_0x2923cf();})[_0xe9bd('0x41')](function(_0x300e07){_0x2923cf(_0x300e07);});}else if(_0x141b95){_0x2923cf();}else{return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5e')});}});};exports[_0xe9bd('0x5f')]=function canUpdate(){return compose()[_0xe9bd('0x37')](function(_0x5b70d3,_0x5a86fd,_0x283e67){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x58828b){if(_0x58828b['update']){_0x283e67();}else{return _0x5a86fd[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0x39fb61){_0x283e67(_0x39fb61);});});};exports[_0xe9bd('0x62')]=function isWebrtcLicence(){return compose()[_0xe9bd('0x37')](function(_0x512899,_0x1e45fc,_0x4cc146){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x33ba69){if(_0x33ba69[_0xe9bd('0x63')]){_0x4cc146();}else{return _0x1e45fc[_0xe9bd('0x3e')](0x193)['json']({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0xe14fa4){_0x4cc146(_0xe14fa4);});});};exports['isMiddleware']=function(_0xff4e14,_0x476f23,_0x34f787){_0xff4e14['isMiddleware']=!![];return _0x34f787();};exports[_0xe9bd('0x64')]=function signToken(_0x27e7b0){return signJwt(_0x27e7b0);};exports[_0xe9bd('0x65')]=function(_0x10ec29,_0x1ee09c){if(!_0x10ec29['user']){return _0x1ee09c[_0xe9bd('0x3e')](0x194)['json']({'message':_0xe9bd('0x66')});}var _0x239be9={'payload':{'id':_0x10ec29[_0xe9bd('0x38')]['id'],'role':_0x10ec29[_0xe9bd('0x38')][_0xe9bd('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x239be9)['then'](function(_0x15d1d0){_0x1ee09c['cookie'](_0xe9bd('0x67'),_0x15d1d0);_0x1ee09c[_0xe9bd('0x68')]('/dashboards/general');})['catch'](function(_0x1ce539){return _0x1ee09c['status'](0x1f4)[_0xe9bd('0x69')](_0x1ce539);});};exports['retrieveApiKey']=function(_0x26b25a){if(_[_0xe9bd('0x6a')](_0x26b25a['apiKeyNonce'])||_[_0xe9bd('0x6a')](_0x26b25a['apiKeyIat'])){return null;}else{return createJwt(_0x26b25a);}};exports[_0xe9bd('0x6b')]=function(_0x2d9a94){_0x2d9a94[_0xe9bd('0x54')]=generateNonce();_0x2d9a94['apiKeyIat']=generateIssuedAt();return createJwt(_0x2d9a94);};exports[_0xe9bd('0x6c')]=function(_0x1d703f,_0x45b69e){var _0x232a36=_0x1d703f['query']['apikey'];if(_0x232a36){var _0x441f89={'nonce':_0x45b69e['apiKeyNonce'],'iat':_0x45b69e[_0xe9bd('0x6d')],'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};return verifyJwt(_0x232a36,_0x441f89)[_0xe9bd('0x3d')](function(){return generateApiKey(_0x45b69e);});}else{throw{'message':_0xe9bd('0x6e')};}};exports[_0xe9bd('0x6f')]=function(_0x373057){var _0x3381ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3381ee[_0xe9bd('0x70')](_0x373057))throw new db[(_0xe9bd('0x71'))][(_0xe9bd('0x72'))](_0xe9bd('0x73'));return;};exports['validatePasswordHistory']=function(_0x596a7d,_0x566dd8,_0x10e685){var _0x5a516e=encryptor[_0xe9bd('0x74')](_0x566dd8)[_0xe9bd('0x75')](',');for(var _0x90db01=0x0;_0x90db01<_0x10e685;_0x90db01++){if(!_0x5a516e[_0x90db01])break;if(_0x596a7d[_0xe9bd('0x76')]()===_0x5a516e[_0x90db01][_0xe9bd('0x76')]()){var _0xaf6ffd=util[_0xe9bd('0x77')](_0xe9bd('0x78'),_0x10e685);if(_0x10e685===0x1){_0xaf6ffd=_0xe9bd('0x79');}throw new db['Sequelize'][(_0xe9bd('0x72'))](_0xaf6ffd);}}return;};exports[_0xe9bd('0x7a')]=function(_0x3d3e74,_0x3f848d){var _0x4d58c1=_0x3f848d?encryptor[_0xe9bd('0x74')](_0x3f848d)[_0xe9bd('0x75')](','):[];if(_0x4d58c1[_0xe9bd('0x7b')]===0x5){_0x4d58c1['splice'](-0x1,0x1);}_0x4d58c1[_0xe9bd('0x7c')](_0x3d3e74);return encryptor[_0xe9bd('0x7d')](_0x4d58c1[_0xe9bd('0x7e')](','));};function signJwt(_0xfe82f7){var _0x4ee26a=BPromise['promisify'](jwt[_0xe9bd('0x7f')],{'context':jwt});var _0x188891=_0xfe82f7[_0xe9bd('0x80')]||config[_0xe9bd('0xa')]['session'];return new BPromise(function(_0x49add9,_0x305efa){_0x4ee26a(_0xfe82f7[_0xe9bd('0x81')],_0x188891,_0xfe82f7[_0xe9bd('0x82')])[_0xe9bd('0x3d')](function(_0x1fd2b5){_0x49add9(_0x1fd2b5);})[_0xe9bd('0x41')](function(_0x4870f8){_0x305efa(_0x4870f8);});});}function verifyJwt(_0x179c8d,_0x5681ab,_0x27e07c){var _0x28dd03=BPromise[_0xe9bd('0x83')](jwt[_0xe9bd('0x84')],{'context':jwt});var _0x5bc1f8=_0x27e07c||config[_0xe9bd('0xa')][_0xe9bd('0xb')];return new BPromise(function(_0x3b0190,_0x4f35c4){_0x28dd03(_0x179c8d,_0x5bc1f8,_0x5681ab)[_0xe9bd('0x3d')](function(_0x1a9d0c){_0x3b0190(_0x1a9d0c);})[_0xe9bd('0x41')](function(_0x3e3e05){_0x4f35c4(_0x3e3e05);});});}function generateNonce(){return crypto[_0xe9bd('0x85')](0x10)[_0xe9bd('0x86')](_0xe9bd('0x87'));}function generateIssuedAt(){return Math[_0xe9bd('0x88')](Date[_0xe9bd('0x89')]()/0x3e8)[_0xe9bd('0x86')]();}function createJwt(_0x14c599){var _0x37d07a={'payload':{'iat':_0x14c599['apiKeyIat'],'nonce':_0x14c599[_0xe9bd('0x54')]},'options':{'algorithm':_0xe9bd('0x8a'),'subject':_0x14c599['id']['toString'](),'issuer':hardwareConf[_0xe9bd('0x4f')](),'audience':hardwareConf[_0xe9bd('0x4f')]()}};return signJwt(_0x37d07a)['then'](function(_0x561165){return{'iat':_0x14c599[_0xe9bd('0x6d')],'nonce':_0x14c599[_0xe9bd('0x54')],'token':_0x561165};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 321fabf..76c8eba 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x928e=['crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','update','binary','end','final','close','unlink','decryptFile','createDecipher','write','encryptString','secret','utf8','base64','decryptString'];(function(_0x565b9f,_0x3fce61){var _0x57cae4=function(_0x3a7aac){while(--_0x3a7aac){_0x565b9f['push'](_0x565b9f['shift']());}};_0x57cae4(++_0x3fce61);}(_0x928e,0x15e));var _0xe928=function(_0x853dd3,_0x296ef5){_0x853dd3=_0x853dd3-0x0;var _0x469559=_0x928e[_0x853dd3];return _0x469559;};'use strict';var crypto=require(_0xe928('0x0'));var fs=require('fs');var BPromise=require(_0xe928('0x1'));var _=require(_0xe928('0x2'));var config=require(_0xe928('0x3'));var logger=require(_0xe928('0x4'))(_0xe928('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe928('0x6')]['session'],'algorithm':_0xe928('0x7')};const fileOptions={'algorithm':_0xe928('0x8')};if(config['encrypt']&&config[_0xe928('0x9')][_0xe928('0xa')]){var isSupported=isAlgorithmSupported(config[_0xe928('0x9')]['algorithm']);if(isSupported){fileOptions[_0xe928('0xa')]=config[_0xe928('0x9')][_0xe928('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe928('0xb')](',\x20');logger[_0xe928('0xc')](config[_0xe928('0x9')][_0xe928('0xa')],_0xe928('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x1ea182){return AES_SUPPORTED_RX[_0xe928('0xe')](_0x1ea182);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x4b1fc1){return getSupportedCiphers()[_0xe928('0xf')](_0x4b1fc1)>-0x1;}function combineOptions(_0x21899a){var _0x4f1735={};for(var _0xefb6c0 in fileOptions){if(fileOptions[_0xe928('0x10')](_0xefb6c0)){_0x4f1735[_0xefb6c0]=fileOptions[_0xefb6c0];}}if(_0x21899a){for(var _0x5c1230 in _0x21899a){if(_0x21899a[_0xe928('0x10')](_0x5c1230)){_0x4f1735[_0x5c1230]=_0x21899a[_0x5c1230];}}}return _0x4f1735;}exports['encryptFile']=function(_0x5cb05d,_0x5cbecf,_0x361612,_0x1e6046){return new BPromise(function(_0x1cfabd,_0x65dc59){_0x1e6046=combineOptions(_0x1e6046);var _0x36089f=new Buffer(_0x361612);var _0x4d6b09=fs[_0xe928('0x11')](_0x5cb05d);var _0x37cd42=fs[_0xe928('0x12')](_0x5cbecf);var _0x4b89e7=crypto[_0xe928('0x13')](_0x1e6046[_0xe928('0xa')],_0x36089f);_0x4d6b09['on'](_0xe928('0x14'),function(_0x582123){var _0x4da197=new Buffer(_0x4b89e7[_0xe928('0x15')](_0x582123),_0xe928('0x16'));_0x37cd42['write'](_0x4da197);});_0x4d6b09['on'](_0xe928('0x17'),function(){try{var _0x26da88=new Buffer(_0x4b89e7[_0xe928('0x18')]('binary'),'binary');_0x37cd42['write'](_0x26da88);_0x37cd42['end']();_0x37cd42['on'](_0xe928('0x19'),function(){return _0x1cfabd(_0x5cbecf);});}catch(_0x1288b5){fs[_0xe928('0x1a')](_0x5cbecf);return _0x65dc59(_0x1288b5);}});});};exports[_0xe928('0x1b')]=function(_0x28899d,_0x12974a,_0x2e7c3b,_0x328728){return new BPromise(function(_0x4d6883,_0x3a88df){_0x328728=combineOptions(_0x328728);var _0xd47aaa=new Buffer(_0x2e7c3b);var _0x3df5f0=fs[_0xe928('0x11')](_0x28899d);var _0x831db4=fs[_0xe928('0x12')](_0x12974a);var _0x12927c=crypto[_0xe928('0x1c')](_0x328728['algorithm'],_0xd47aaa);_0x3df5f0['on'](_0xe928('0x14'),function(_0x44ecaf){var _0x169209=new Buffer(_0x12927c[_0xe928('0x15')](_0x44ecaf),_0xe928('0x16'));_0x831db4[_0xe928('0x1d')](_0x169209);});_0x3df5f0['on'](_0xe928('0x17'),function(){try{var _0x3d6127=new Buffer(_0x12927c[_0xe928('0x18')](_0xe928('0x16')),'binary');_0x831db4[_0xe928('0x1d')](_0x3d6127);_0x831db4[_0xe928('0x17')]();_0x831db4['on']('close',function(){return _0x4d6883(_0x12974a);});}catch(_0x184e39){fs[_0xe928('0x1a')](_0x12974a);return _0x3a88df(_0x184e39);}});});};exports[_0xe928('0x1e')]=function(_0x456eb6,_0x14885f,_0x25d43c){var _0x4e5356=_0x25d43c||stringOptions[_0xe928('0xa')];var _0x598d9a=_0x14885f||stringOptions[_0xe928('0x1f')];var _0x3e96b3=crypto['createCipher'](_0x4e5356,_0x598d9a);var _0x4bc300=_0x3e96b3['update'](_0x456eb6,_0xe928('0x20'),_0xe928('0x21'));_0x4bc300+=_0x3e96b3[_0xe928('0x18')](_0xe928('0x21'));return _0x4bc300;};exports[_0xe928('0x22')]=function(_0x5ed389,_0x514ea6,_0x488239){var _0x5ff6d5=_0x488239||stringOptions[_0xe928('0xa')];var _0x433747=_0x514ea6||stringOptions[_0xe928('0x1f')];var _0x42d23e=crypto['createDecipher'](_0x5ff6d5,_0x433747);var _0x5cce77=_0x42d23e['update'](_0x5ed389,_0xe928('0x21'),_0xe928('0x20'));_0x5cce77+=_0x42d23e[_0xe928('0x18')](_0xe928('0x20'));return _0x5cce77;}; \ No newline at end of file +var _0x064a=['hasOwnProperty','encryptFile','createWriteStream','createCipher','data','binary','write','final','end','close','unlink','decryptFile','createReadStream','createDecipher','update','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter'];(function(_0x4ebcea,_0x4cf4c6){var _0x5de849=function(_0x237d66){while(--_0x237d66){_0x4ebcea['push'](_0x4ebcea['shift']());}};_0x5de849(++_0x4cf4c6);}(_0x064a,0x188));var _0xa064=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x064a[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0xa064('0x0'));var fs=require('fs');var BPromise=require(_0xa064('0x1'));var _=require(_0xa064('0x2'));var config=require(_0xa064('0x3'));var logger=require('../../config/logger')(_0xa064('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xa064('0x5')]['session'],'algorithm':_0xa064('0x6')};const fileOptions={'algorithm':_0xa064('0x7')};if(config['encrypt']&&config[_0xa064('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xa064('0x8')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0xa064('0x8')][_0xa064('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa064('0xa')](',\x20');logger[_0xa064('0xb')](config[_0xa064('0x8')]['algorithm'],_0xa064('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x31958d){return AES_SUPPORTED_RX[_0xa064('0xd')](_0x31958d);}function getSupportedCiphers(){return crypto[_0xa064('0xe')]()[_0xa064('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x2019ef){return getSupportedCiphers()['indexOf'](_0x2019ef)>-0x1;}function combineOptions(_0x632017){var _0x4ca8ea={};for(var _0x4c2270 in fileOptions){if(fileOptions[_0xa064('0x10')](_0x4c2270)){_0x4ca8ea[_0x4c2270]=fileOptions[_0x4c2270];}}if(_0x632017){for(var _0x2f9c12 in _0x632017){if(_0x632017[_0xa064('0x10')](_0x2f9c12)){_0x4ca8ea[_0x2f9c12]=_0x632017[_0x2f9c12];}}}return _0x4ca8ea;}exports[_0xa064('0x11')]=function(_0x30feda,_0x50f578,_0x3869ee,_0x313871){return new BPromise(function(_0x57f4bb,_0x535f33){_0x313871=combineOptions(_0x313871);var _0x35b13e=new Buffer(_0x3869ee);var _0x8db565=fs['createReadStream'](_0x30feda);var _0x23bfd7=fs[_0xa064('0x12')](_0x50f578);var _0x205adb=crypto[_0xa064('0x13')](_0x313871['algorithm'],_0x35b13e);_0x8db565['on'](_0xa064('0x14'),function(_0x4457f5){var _0x2778bd=new Buffer(_0x205adb['update'](_0x4457f5),_0xa064('0x15'));_0x23bfd7[_0xa064('0x16')](_0x2778bd);});_0x8db565['on']('end',function(){try{var _0x4e002c=new Buffer(_0x205adb[_0xa064('0x17')](_0xa064('0x15')),'binary');_0x23bfd7['write'](_0x4e002c);_0x23bfd7[_0xa064('0x18')]();_0x23bfd7['on'](_0xa064('0x19'),function(){return _0x57f4bb(_0x50f578);});}catch(_0x6c8c70){fs[_0xa064('0x1a')](_0x50f578);return _0x535f33(_0x6c8c70);}});});};exports[_0xa064('0x1b')]=function(_0x399751,_0xf6323f,_0x1c5e44,_0x15007e){return new BPromise(function(_0x3e04f9,_0x548770){_0x15007e=combineOptions(_0x15007e);var _0x5b177c=new Buffer(_0x1c5e44);var _0xfdd5d0=fs[_0xa064('0x1c')](_0x399751);var _0x502101=fs[_0xa064('0x12')](_0xf6323f);var _0xd95ade=crypto[_0xa064('0x1d')](_0x15007e[_0xa064('0x9')],_0x5b177c);_0xfdd5d0['on'](_0xa064('0x14'),function(_0xf66964){var _0x12bbe5=new Buffer(_0xd95ade[_0xa064('0x1e')](_0xf66964),_0xa064('0x15'));_0x502101[_0xa064('0x16')](_0x12bbe5);});_0xfdd5d0['on'](_0xa064('0x18'),function(){try{var _0x22fced=new Buffer(_0xd95ade[_0xa064('0x17')](_0xa064('0x15')),_0xa064('0x15'));_0x502101[_0xa064('0x16')](_0x22fced);_0x502101[_0xa064('0x18')]();_0x502101['on'](_0xa064('0x19'),function(){return _0x3e04f9(_0xf6323f);});}catch(_0x3fba6b){fs['unlink'](_0xf6323f);return _0x548770(_0x3fba6b);}});});};exports['encryptString']=function(_0x3e0548,_0x10bb4a,_0x493290){var _0x4e538e=_0x493290||stringOptions[_0xa064('0x9')];var _0x318f6f=_0x10bb4a||stringOptions['secret'];var _0xd87bd7=crypto[_0xa064('0x13')](_0x4e538e,_0x318f6f);var _0x1aacc8=_0xd87bd7[_0xa064('0x1e')](_0x3e0548,_0xa064('0x1f'),'base64');_0x1aacc8+=_0xd87bd7['final'](_0xa064('0x20'));return _0x1aacc8;};exports[_0xa064('0x21')]=function(_0x4a1642,_0x38f5df,_0x57a1ec){var _0x203397=_0x57a1ec||stringOptions[_0xa064('0x9')];var _0x58f16=_0x38f5df||stringOptions['secret'];var _0x37373c=crypto[_0xa064('0x1d')](_0x203397,_0x58f16);var _0x9d785c=_0x37373c[_0xa064('0x1e')](_0x4a1642,_0xa064('0x20'),_0xa064('0x1f'));_0x9d785c+=_0x37373c['final'](_0xa064('0x1f'));return _0x9d785c;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 073a87e..6636d75 100644 --- a/server/components/export/csv.js +++ b/server/components/export/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc882=['dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','isInteger','query','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x15daa3,_0x5f4ca1){var _0x19db42=function(_0x55847c){while(--_0x55847c){_0x15daa3['push'](_0x15daa3['shift']());}};_0x19db42(++_0x5f4ca1);}(_0xc882,0xa5));var _0x2c88=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc882[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var path=require(_0x2c88('0x0'));var _=require(_0x2c88('0x1'));var csv=require(_0x2c88('0x2'));var fs=require('fs');var BPromise=require(_0x2c88('0x3'));var zipdir=require(_0x2c88('0x4'));var rimraf=require('rimraf');var db=require(_0x2c88('0x5'))['db'];var dbH=require(_0x2c88('0x5'))[_0x2c88('0x6')];var logger=require(_0x2c88('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2c88('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x2c88('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x34cf77,_0x4a37b9){var _0x1d485f={'status':_0x34cf77};var _0x24eb5b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4a37b9){_0x1d485f['savename']=_0x4a37b9;}return db[_0x2c88('0x9')]['update'](_0x1d485f,_0x24eb5b);}function main(){var _0x21e891=0x1388;var _0x3dcc06;logger[_0x2c88('0xa')](util[_0x2c88('0xb')](_0x2c88('0xc'),EXTRACTED_REPORT_ID,_0x2c88('0xd')));return db[_0x2c88('0xe')][_0x2c88('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2c88('0x10'),_0x2c88('0x11')]})[_0x2c88('0x12')](function(_0x524404){if(_0x524404){_0x3dcc06=_0x524404;_0x21e891=_0x3dcc06[_0x2c88('0x11')]||0x1388;}})[_0x2c88('0x12')](function(){return dbH[_0x2c88('0x13')]['query'](util[_0x2c88('0xb')](_0x2c88('0x14'),QUERY),{'type':dbH[_0x2c88('0x13')][_0x2c88('0x15')][_0x2c88('0x16')]});})[_0x2c88('0x12')](function(_0x5d6f17){if(!_0x5d6f17[0x0]['num']){return analyticExtractedReport(_0x2c88('0x17'));}var _0x4f1738=[];var _0x2f8bb2=0x0;if(_0x3dcc06[_0x2c88('0x10')]){if(_0x5d6f17&&_0x5d6f17[_0x2c88('0x18')]){var _0x39ac2e=_[_0x2c88('0x19')](_0x5d6f17[0x0][_0x2c88('0x1a')]/_0x21e891);var _0x194d31=Number[_0x2c88('0x1b')](_0x5d6f17[0x0][_0x2c88('0x1a')]/_0x21e891)?_0x5d6f17[0x0][_0x2c88('0x1a')]%_0x21e891:0x0;_0x39ac2e['forEach'](function(_0x3be0b7){if(_0x3be0b7>0x0){_0x2f8bb2+=_0x21e891;}_0x4f1738['push'](dbH['sequelize'][_0x2c88('0x1c')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x21e891,_0x2f8bb2),{'type':dbH['sequelize'][_0x2c88('0x15')]['SELECT']}));});if(_0x194d31>0x0){_0x2f8bb2+=_0x21e891;_0x4f1738[_0x2c88('0x1d')](dbH[_0x2c88('0x13')][_0x2c88('0x1c')](util[_0x2c88('0xb')](_0x2c88('0x1e'),QUERY,_0x194d31,_0x2f8bb2),{'type':dbH['sequelize'][_0x2c88('0x15')][_0x2c88('0x16')]}));}}}else{_0x4f1738[_0x2c88('0x1d')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x2c88('0x13')][_0x2c88('0x15')][_0x2c88('0x16')]}));}var _0x34645e=path[_0x2c88('0x1f')](PATH);var _0xdc052e=path[_0x2c88('0x20')](PATH,'.csv');var _0x58fa72=_0x3dcc06['split']&&_0x4f1738['length']>0x1;var _0x538a3e=[];if(!fs[_0x2c88('0x21')](path[_0x2c88('0x22')](_0x34645e,_0xdc052e))&&_0x58fa72){fs[_0x2c88('0x23')](path[_0x2c88('0x22')](_0x34645e,_0xdc052e));}return BPromise[_0x2c88('0x24')](_0x4f1738,function(_0x58fec9){_0x538a3e[_0x2c88('0x1d')](_0x58fec9);})[_0x2c88('0x12')](function(){for(var _0x24933a=0x0;_0x24933a<_0x538a3e[_0x2c88('0x18')];_0x24933a+=0x1){var _0x3d6bb0;var _0x5281f4=_0x538a3e[_0x24933a];if(_0x58fa72){_0x3d6bb0=path[_0x2c88('0x22')](_0x34645e,_0xdc052e,util[_0x2c88('0xb')](_0x2c88('0x25'),_0xdc052e,_0x24933a,_0x2c88('0x26')));}else{_0x3d6bb0=path[_0x2c88('0x22')](_0x34645e,util['format'](_0x2c88('0x27'),_0xdc052e,_0x2c88('0x26')));}fs[_0x2c88('0x28')](_0x3d6bb0,csv(_0x5281f4));}})[_0x2c88('0x12')](function(){if(_0x58fa72){return new Promise(function(_0x448494){zipdir(path[_0x2c88('0x22')](_0x34645e,_0xdc052e),{'saveTo':path[_0x2c88('0x22')](_0x34645e,util[_0x2c88('0xb')](_0x2c88('0x27'),_0xdc052e,_0x2c88('0x29')))},function(_0xdb199,_0x5c9514){rimraf(path[_0x2c88('0x22')](_0x34645e,_0xdc052e),function(){});_0x448494(_0x2c88('0x2a'));});});}})[_0x2c88('0x12')](function(){logger[_0x2c88('0xa')](util['format'](_0x2c88('0x2b'),EXTRACTED_REPORT_ID,_0x2c88('0xd')));return analyticExtractedReport('Completed',_0x58fa72?util['format']('%s.%s',_0xdc052e,_0x58fa72?_0x2c88('0x29'):_0x2c88('0x26')):null);});})['catch'](function(_0x1fa87f){logger[_0x2c88('0xa')](util['format'](_0x2c88('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util[_0x2c88('0x2d')](_0x1fa87f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2c88('0x2e'));})[_0x2c88('0x2f')](function(){process[_0x2c88('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4119=['../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','format','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','split','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','to-csv','rimraf','../../mysqldb'];(function(_0x27b54d,_0x5a6a4a){var _0x25f177=function(_0xd7210){while(--_0xd7210){_0x27b54d['push'](_0x27b54d['shift']());}};_0x25f177(++_0x5a6a4a);}(_0x4119,0x1a2));var _0x9411=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4119[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x9411('0x0'));var path=require(_0x9411('0x1'));var _=require('lodash');var csv=require(_0x9411('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x9411('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x9411('0x4'))['dbH'];var logger=require(_0x9411('0x5'))(_0x9411('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x9411('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9411('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b9743,_0x894842){var _0x2ec31f={'status':_0x2b9743};var _0x3c7bf3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x894842){_0x2ec31f[_0x9411('0x8')]=_0x894842;}return db['AnalyticExtractedReport'][_0x9411('0x9')](_0x2ec31f,_0x3c7bf3);}function main(){var _0x13f5b5=0x1388;var _0x480ecf;logger[_0x9411('0xa')](util['format'](_0x9411('0xb'),EXTRACTED_REPORT_ID,_0x9411('0xc')));return db[_0x9411('0xd')][_0x9411('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x9411('0xf')]})['then'](function(_0xf092a7){if(_0xf092a7){_0x480ecf=_0xf092a7;_0x13f5b5=_0x480ecf[_0x9411('0xf')]||0x1388;}})[_0x9411('0x10')](function(){return dbH[_0x9411('0x11')][_0x9411('0x12')](util[_0x9411('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9411('0x11')][_0x9411('0x14')][_0x9411('0x15')]});})[_0x9411('0x10')](function(_0x5e6d34){if(!_0x5e6d34[0x0][_0x9411('0x16')]){return analyticExtractedReport(_0x9411('0x17'));}var _0x1acc24=[];var _0x45361f=0x0;if(_0x480ecf['split']){if(_0x5e6d34&&_0x5e6d34[_0x9411('0x18')]){var _0x5ced90=_[_0x9411('0x19')](_0x5e6d34[0x0]['num']/_0x13f5b5);var _0x49925b=Number['isInteger'](_0x5e6d34[0x0][_0x9411('0x16')]/_0x13f5b5)?_0x5e6d34[0x0]['num']%_0x13f5b5:0x0;_0x5ced90[_0x9411('0x1a')](function(_0x4da784){if(_0x4da784>0x0){_0x45361f+=_0x13f5b5;}_0x1acc24[_0x9411('0x1b')](dbH[_0x9411('0x11')][_0x9411('0x12')](util[_0x9411('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x13f5b5,_0x45361f),{'type':dbH[_0x9411('0x11')][_0x9411('0x14')][_0x9411('0x15')]}));});if(_0x49925b>0x0){_0x45361f+=_0x13f5b5;_0x1acc24[_0x9411('0x1b')](dbH[_0x9411('0x11')][_0x9411('0x12')](util[_0x9411('0x13')](_0x9411('0x1c'),QUERY,_0x49925b,_0x45361f),{'type':dbH[_0x9411('0x11')]['QueryTypes']['SELECT']}));}}}else{_0x1acc24['push'](dbH[_0x9411('0x11')]['query'](QUERY,{'type':dbH[_0x9411('0x11')]['QueryTypes'][_0x9411('0x15')]}));}var _0x5d2305=path[_0x9411('0x1d')](PATH);var _0x97d51e=path[_0x9411('0x1e')](PATH,'.csv');var _0x31d703=_0x480ecf[_0x9411('0x1f')]&&_0x1acc24[_0x9411('0x18')]>0x1;var _0x5760f9=[];if(!fs[_0x9411('0x20')](path[_0x9411('0x21')](_0x5d2305,_0x97d51e))&&_0x31d703){fs[_0x9411('0x22')](path['join'](_0x5d2305,_0x97d51e));}return BPromise['each'](_0x1acc24,function(_0x288413){_0x5760f9['push'](_0x288413);})['then'](function(){for(var _0x529093=0x0;_0x529093<_0x5760f9[_0x9411('0x18')];_0x529093+=0x1){var _0x5f5b24;var _0x37227c=_0x5760f9[_0x529093];if(_0x31d703){_0x5f5b24=path[_0x9411('0x21')](_0x5d2305,_0x97d51e,util['format'](_0x9411('0x23'),_0x97d51e,_0x529093,_0x9411('0x24')));}else{_0x5f5b24=path['join'](_0x5d2305,util[_0x9411('0x13')](_0x9411('0x25'),_0x97d51e,'csv'));}fs[_0x9411('0x26')](_0x5f5b24,csv(_0x37227c));}})['then'](function(){if(_0x31d703){return new Promise(function(_0x399f2d){zipdir(path[_0x9411('0x21')](_0x5d2305,_0x97d51e),{'saveTo':path[_0x9411('0x21')](_0x5d2305,util[_0x9411('0x13')]('%s.%s',_0x97d51e,'zip'))},function(_0x12f0d8,_0x5bcf53){rimraf(path[_0x9411('0x21')](_0x5d2305,_0x97d51e),function(){});_0x399f2d(_0x9411('0x27'));});});}})['then'](function(){logger[_0x9411('0xa')](util['format'](_0x9411('0x28'),EXTRACTED_REPORT_ID,_0x9411('0xc')));return analyticExtractedReport(_0x9411('0x29'),_0x31d703?util['format'](_0x9411('0x25'),_0x97d51e,_0x31d703?_0x9411('0x2a'):'csv'):null);});})['catch'](function(_0x25e810){logger['info'](util[_0x9411('0x13')](_0x9411('0x2b'),EXTRACTED_REPORT_ID,_0x9411('0xc')),util['inspect'](_0x25e810,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9411('0x2c'));})[_0x9411('0x2d')](function(){process[_0x9411('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index c349b93..9eda343 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe5b=['/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','path','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','pick','map','toString','value','fill','length','auto','body','concat','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','push','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','num','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0xbe5b,0xbe));var _0xbbe5=function(_0x2a8876,_0x445411){_0x2a8876=_0x2a8876-0x0;var _0x56a925=_0xbe5b[_0x2a8876];return _0x56a925;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0xbbe5('0x0'));var moment=require('moment');var htmlToPdfmake=require(_0xbbe5('0x1'));var PdfPrinter=require(_0xbbe5('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xbbe5('0x3'));var JSDOM=require(_0xbbe5('0x4'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0xbbe5('0x5'));var db=require(_0xbbe5('0x6'))['db'];var dbH=require(_0xbbe5('0x6'))[_0xbbe5('0x7')];var logger=require('../../config/logger')(_0xbbe5('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xbbe5('0x9')][0x2]);var QUERY=process[_0xbbe5('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbbe5('0x9')][0x5];var FORMAT=_0xbbe5('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4418b9,_0x5ba1fe){var _0x53211b={'status':_0x4418b9};var _0x407777={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ba1fe){_0x53211b[_0xbbe5('0xb')]=_0x5ba1fe;}return db[_0xbbe5('0xc')][_0xbbe5('0xd')](_0x53211b,_0x407777);}function getHeaders(_0x9d3f22){return _['map'](_0x9d3f22,function(_0x2f8c2d){return{'text':_0x2f8c2d,'style':_0xbbe5('0xe')};});}function getRows(_0x26791f,_0x4f9b97){return _['map'](_0x4f9b97,function(_0xda86ea){return _(_0xda86ea)[_0xbbe5('0xf')](_0x26791f)[_0xbbe5('0x10')](function(_0x50d5f4){return _0x50d5f4?_[_0xbbe5('0x11')](_0x50d5f4):'';})[_0xbbe5('0x12')]();});}function createTable(_0x1ab09a,_0x27a711){var _0x57cae8={'widths':_[_0xbbe5('0x13')](Array(_0x1ab09a[_0xbbe5('0x14')]),0x91),'heights':function(_0x5a642f){return _0x5a642f===0x0?_0xbbe5('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x20c09a=getHeaders(_0x1ab09a);_0x57cae8[_0xbbe5('0x16')]['push'](_0x20c09a);var _0x5cba39=getRows(_0x1ab09a,_0x27a711);_0x57cae8[_0xbbe5('0x16')]=_0x57cae8['body'][_0xbbe5('0x17')](_0x5cba39);return _0x57cae8;}function createTables(_0x16d8e5){var _0x13b5b2=[];var _0x3e7f91=_[_0xbbe5('0x18')](Object['keys'](_0x16d8e5[0x0]),0x5);_0x3e7f91[_0xbbe5('0x19')](function(_0x43fc1c){_0x13b5b2['push'](createTable(_0x43fc1c,_0x16d8e5));});return _0x13b5b2;}function getPDFDocDefinition(_0x35e141){var _0x47f670=util['format'](_0xbbe5('0x1a'),NAME,EXTRACTED_REPORT[_0xbbe5('0x1b')],moment(EXTRACTED_REPORT[_0xbbe5('0x1c')])[_0xbbe5('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xbbe5('0x1e')])[_0xbbe5('0x1d')](FORMAT));var _0x4fe62f=[];for(var _0x19e7ec=0x0;_0x19e7ec<_0x35e141['length'];_0x19e7ec++){var _0x2f08bd=[];if(_0x19e7ec===0x0){_0x2f08bd[_0xbbe5('0x1f')]({'text':_0x47f670,'style':_0xbbe5('0x20')});}var _0x5dbadd={'table':_0x35e141[_0x19e7ec]};if(_0x19e7ec>0x0){_0x5dbadd[_0xbbe5('0x21')]=_0xbbe5('0x22');_0x5dbadd[_0xbbe5('0x23')]=[0x0,0x46,0x0,0x0];}_0x2f08bd['push'](_0x5dbadd);_0x4fe62f['push'](_0x2f08bd);}return{'pageSize':'A4','pageOrientation':_0xbbe5('0x24'),'content':_0x4fe62f,'footer':function(_0x3ba013,_0x6376fc){return{'text':_0x3ba013['toString']()+_0xbbe5('0x25')+_0x6376fc,'style':_0xbbe5('0x26')};},'defaultStyle':{'font':_0xbbe5('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x48a20f){var _0x28cac1=0x1388;var _0x361a28;if(!_0x48a20f[0x0][_0xbbe5('0x28')]){return analyticExtractedReport('Empty');}return db[_0xbbe5('0x29')][_0xbbe5('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbbe5('0x2b'),_0xbbe5('0x2c')]})[_0xbbe5('0x2d')](function(_0xb4ece){if(_0xb4ece){_0x361a28=_0xb4ece;_0x28cac1=_0x361a28[_0xbbe5('0x2c')]||0x3e8;}})[_0xbbe5('0x2d')](function(){var _0x286d19=[];var _0x30444c=0x0;if(_0x361a28[_0xbbe5('0x2b')]){if(_0x48a20f&&_0x48a20f[_0xbbe5('0x14')]){var _0x36bfb=_[_0xbbe5('0x2e')](_0x48a20f[0x0][_0xbbe5('0x28')]/_0x28cac1);var _0x134ff7=Number[_0xbbe5('0x2f')](_0x48a20f[0x0]['num']/_0x28cac1)?_0x48a20f[0x0]['num']%_0x28cac1:0x0;_0x36bfb[_0xbbe5('0x19')](function(_0x145129){if(_0x145129>0x0){_0x30444c+=_0x28cac1;}_0x286d19[_0xbbe5('0x1f')](dbH[_0xbbe5('0x30')][_0xbbe5('0x31')](util[_0xbbe5('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x28cac1,_0x30444c),{'type':dbH['sequelize']['QueryTypes'][_0xbbe5('0x32')]}));});if(_0x134ff7>0x0){_0x30444c+=_0x28cac1;_0x286d19[_0xbbe5('0x1f')](dbH['sequelize'][_0xbbe5('0x31')](util[_0xbbe5('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x134ff7,_0x30444c),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x286d19['push'](dbH[_0xbbe5('0x30')]['query'](QUERY,{'type':dbH[_0xbbe5('0x30')][_0xbbe5('0x33')]['SELECT']}));}var _0xd495cb=path[_0xbbe5('0x34')](PATH);var _0xda8ec8=path[_0xbbe5('0x35')](PATH,_0xbbe5('0x36'));var _0x5e474d=_0x361a28[_0xbbe5('0x2b')]&&_0x286d19['length']>0x1;var _0x5de6ac=[];if(!fs[_0xbbe5('0x37')](path[_0xbbe5('0x38')](_0xd495cb,_0xda8ec8))&&_0x5e474d){fs[_0xbbe5('0x39')](path[_0xbbe5('0x38')](_0xd495cb,_0xda8ec8));}return BPromise['each'](_0x286d19,function(_0x45a914){_0x5de6ac[_0xbbe5('0x1f')](_0x45a914);})[_0xbbe5('0x2d')](function(){var _0x420c68=[];for(var _0x3875a4=0x0;_0x3875a4<_0x5de6ac[_0xbbe5('0x14')];_0x3875a4+=0x1){var _0xda9b46=_0x5de6ac[_0x3875a4];var _0x412049=createTables(_[_0xbbe5('0x3a')](_0xda9b46));var _0x13ba62;var _0x6fa99=getPDFDocDefinition(_0x412049);var _0x2951f0=getPDFPrinter();var _0x18636a=_0x2951f0[_0xbbe5('0x3b')](_0x6fa99);if(_0x5e474d){_0x13ba62=path[_0xbbe5('0x38')](_0xd495cb,_0xda8ec8,util['format'](_0xbbe5('0x3c'),_0xda8ec8,_0x3875a4,_0xbbe5('0x3d')));}else{_0x13ba62=path[_0xbbe5('0x38')](_0xd495cb,util[_0xbbe5('0x1d')](_0xbbe5('0x3e'),_0xda8ec8,_0xbbe5('0x3d')));}_0x420c68[_0xbbe5('0x1f')](writePDFDocument(_0x18636a,_0x13ba62));}return Promise[_0xbbe5('0x3f')](_0x420c68);})[_0xbbe5('0x2d')](function(){if(_0x5e474d){return new Promise(function(_0x3ebe24){zipdir(path[_0xbbe5('0x38')](_0xd495cb,_0xda8ec8),{'saveTo':path[_0xbbe5('0x38')](_0xd495cb,util['format'](_0xbbe5('0x3e'),_0xda8ec8,_0xbbe5('0x40')))},function(){rimraf(path[_0xbbe5('0x38')](_0xd495cb,_0xda8ec8),function(){});_0x3ebe24(_0xbbe5('0x41'));});});}})[_0xbbe5('0x2d')](function(){if(!_0x5e474d)return;rimraf(path[_0xbbe5('0x38')](_0xd495cb,_0xda8ec8),function(){});})[_0xbbe5('0x2d')](function(){logger[_0xbbe5('0x42')](util[_0xbbe5('0x1d')](_0xbbe5('0x43'),EXTRACTED_REPORT_ID,_0xbbe5('0x44')));return analyticExtractedReport(_0xbbe5('0x45'),_0x5e474d?util['format'](_0xbbe5('0x3e'),_0xda8ec8,_0x5e474d?_0xbbe5('0x40'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xbbe5('0x42')](util[_0xbbe5('0x1d')](_0xbbe5('0x46'),EXTRACTED_REPORT_ID,_0xbbe5('0x44')));return db[_0xbbe5('0xc')][_0xbbe5('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbbe5('0x2d')](function(_0x2cd6bc){EXTRACTED_REPORT=_0x2cd6bc;return dbH[_0xbbe5('0x30')][_0xbbe5('0x31')](util[_0xbbe5('0x1d')](_0xbbe5('0x48'),QUERY),{'type':dbH['sequelize'][_0xbbe5('0x33')]['SELECT']});})[_0xbbe5('0x2d')](extractReport)[_0xbbe5('0x49')](function(_0x472c18){logger[_0xbbe5('0x42')](util[_0xbbe5('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbbe5('0x44')),util[_0xbbe5('0x4a')](_0x472c18,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbbe5('0x4b'));})['finally'](function(){process[_0xbbe5('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3c972c=new PdfPrinter({'Arial':{'normal':__dirname+_0xbbe5('0x4d'),'bold':__dirname+_0xbbe5('0x4e'),'italics':__dirname+_0xbbe5('0x4f'),'bolditalics':__dirname+_0xbbe5('0x50')}});return _0x3c972c;}function getPDFDocDefinitionFromHTML(_0x13127e,_0x4d1d69){var _0x3c6a03=util[_0xbbe5('0x1d')]('%s\x20#%d',_0x4d1d69[_0xbbe5('0x51')],_0x4d1d69[_0xbbe5('0x52')]);var _0x4743b6=moment()['format'](_0xbbe5('0x53'))[_0xbbe5('0x11')]();var _0x23639f=htmlToPdfmake(_0x13127e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x23639f],'defaultStyle':{'font':_0xbbe5('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xbbe5('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xbbe5('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xbbe5('0x54')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x5c8d0e,_0x1b84ac){return[{'text':util[_0xbbe5('0x1d')](_0xbbe5('0x55'),_0x3c6a03,_0x5c8d0e,_0x1b84ac,_0x4743b6),'style':'footer'}];}};}function writePDFDocument(_0x2695ea,_0x37d1da){return new Promise(function(_0x54f56d,_0x262641){var _0x378c2b=_0x2695ea[_0xbbe5('0x56')](fs[_0xbbe5('0x57')](_0x37d1da));_0x378c2b['on'](_0xbbe5('0x58'),function(){_0x54f56d(_0xbbe5('0x58'));});_0x378c2b['on']('error',function(_0x32e1c2){_0x262641(_0x32e1c2);});_0x2695ea[_0xbbe5('0x59')]();});}exports['createPdfFromHTML']=function(_0x1de8b1,_0x21cf4a){var _0x2424b9=getPDFPrinter();var _0x2c6f3d=getPDFDocDefinitionFromHTML(_0x1de8b1,_0x21cf4a);var _0x488541=_0x2424b9['createPdfKitDocument'](_0x2c6f3d);return writePDFDocument(_0x488541,_0x21cf4a[_0xbbe5('0x0')])[_0xbbe5('0x49')](function(_0xf7cdb){throw _0xf7cdb;});}; \ No newline at end of file +var _0x166a=['%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','then','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','jsdom','JSDOM','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','value','length','auto','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header','pageBreak','before','landscape','\x20/\x20','Arial','black','right','Setting','split','splitSizePdf','range','num','isInteger','sequelize','query'];(function(_0xd9bfc0,_0x323b5e){var _0x3c26ca=function(_0x41668e){while(--_0x41668e){_0xd9bfc0['push'](_0xd9bfc0['shift']());}};_0x3c26ca(++_0x323b5e);}(_0x166a,0x136));var _0xa166=function(_0x312dd5,_0xa36281){_0x312dd5=_0x312dd5-0x0;var _0x1a3ff0=_0x166a[_0x312dd5];return _0x1a3ff0;};'use strict';var _=require(_0xa166('0x0'));var fs=require('fs');var util=require(_0xa166('0x1'));var path=require(_0xa166('0x2'));var moment=require(_0xa166('0x3'));var htmlToPdfmake=require(_0xa166('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0xa166('0x5'))[_0xa166('0x6')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0xa166('0x7'))[_0xa166('0x8')];var logger=require(_0xa166('0x9'))(_0xa166('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xa166('0xb')][0x2]);var QUERY=process[_0xa166('0xb')][0x3];var PATH=process[_0xa166('0xb')][0x4];var NAME=process[_0xa166('0xb')][0x5];var FORMAT=_0xa166('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x11357b,_0x4eaf72){var _0x24a414={'status':_0x11357b};var _0xaf2e43={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4eaf72){_0x24a414['savename']=_0x4eaf72;}return db[_0xa166('0xd')][_0xa166('0xe')](_0x24a414,_0xaf2e43);}function getHeaders(_0x1b64f8){return _[_0xa166('0xf')](_0x1b64f8,function(_0x1c21ee){return{'text':_0x1c21ee,'style':_0xa166('0x10')};});}function getRows(_0x533395,_0x145c3b){return _[_0xa166('0xf')](_0x145c3b,function(_0x8221e0){return _(_0x8221e0)[_0xa166('0x11')](_0x533395)['map'](function(_0x398bc6){return _0x398bc6?_['toString'](_0x398bc6):'';})[_0xa166('0x12')]();});}function createTable(_0x2edb02,_0x1eee21){var _0x5527e2={'widths':_['fill'](Array(_0x2edb02[_0xa166('0x13')]),0x91),'heights':function(_0x31d86a){return _0x31d86a===0x0?_0xa166('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x103312=getHeaders(_0x2edb02);_0x5527e2[_0xa166('0x15')]['push'](_0x103312);var _0x2ae4f9=getRows(_0x2edb02,_0x1eee21);_0x5527e2['body']=_0x5527e2['body'][_0xa166('0x16')](_0x2ae4f9);return _0x5527e2;}function createTables(_0x271116){var _0x2b9bff=[];var _0x4c3240=_[_0xa166('0x17')](Object[_0xa166('0x18')](_0x271116[0x0]),0x5);_0x4c3240[_0xa166('0x19')](function(_0x1d390e){_0x2b9bff[_0xa166('0x1a')](createTable(_0x1d390e,_0x271116));});return _0x2b9bff;}function getPDFDocDefinition(_0x1fb38e){var _0x3569a0=util[_0xa166('0x1b')](_0xa166('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xa166('0x1d')])[_0xa166('0x1b')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x127b69=[];for(var _0x23d7ad=0x0;_0x23d7ad<_0x1fb38e[_0xa166('0x13')];_0x23d7ad++){var _0x43f168=[];if(_0x23d7ad===0x0){_0x43f168['push']({'text':_0x3569a0,'style':_0xa166('0x1e')});}var _0x2ac7f7={'table':_0x1fb38e[_0x23d7ad]};if(_0x23d7ad>0x0){_0x2ac7f7[_0xa166('0x1f')]=_0xa166('0x20');_0x2ac7f7['margin']=[0x0,0x46,0x0,0x0];}_0x43f168[_0xa166('0x1a')](_0x2ac7f7);_0x127b69['push'](_0x43f168);}return{'pageSize':'A4','pageOrientation':_0xa166('0x21'),'content':_0x127b69,'footer':function(_0x8d7dd2,_0x1d7acd){return{'text':_0x8d7dd2['toString']()+_0xa166('0x22')+_0x1d7acd,'style':'footer'};},'defaultStyle':{'font':_0xa166('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa166('0x24')},'footer':{'alignment':_0xa166('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1909ff){var _0x5b4abe=0x1388;var _0x26fdc8;if(!_0x1909ff[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0xa166('0x26')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa166('0x27'),'splitSizePdf']})['then'](function(_0x355a88){if(_0x355a88){_0x26fdc8=_0x355a88;_0x5b4abe=_0x26fdc8[_0xa166('0x28')]||0x3e8;}})['then'](function(){var _0x1a29f7=[];var _0x19c5d7=0x0;if(_0x26fdc8[_0xa166('0x27')]){if(_0x1909ff&&_0x1909ff[_0xa166('0x13')]){var _0x579845=_[_0xa166('0x29')](_0x1909ff[0x0][_0xa166('0x2a')]/_0x5b4abe);var _0x2d28eb=Number[_0xa166('0x2b')](_0x1909ff[0x0][_0xa166('0x2a')]/_0x5b4abe)?_0x1909ff[0x0][_0xa166('0x2a')]%_0x5b4abe:0x0;_0x579845[_0xa166('0x19')](function(_0x2717a8){if(_0x2717a8>0x0){_0x19c5d7+=_0x5b4abe;}_0x1a29f7[_0xa166('0x1a')](dbH['sequelize']['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5b4abe,_0x19c5d7),{'type':dbH[_0xa166('0x2c')]['QueryTypes']['SELECT']}));});if(_0x2d28eb>0x0){_0x19c5d7+=_0x5b4abe;_0x1a29f7[_0xa166('0x1a')](dbH[_0xa166('0x2c')][_0xa166('0x2d')](util[_0xa166('0x1b')](_0xa166('0x2e'),QUERY,_0x2d28eb,_0x19c5d7),{'type':dbH[_0xa166('0x2c')][_0xa166('0x2f')][_0xa166('0x30')]}));}}}else{_0x1a29f7[_0xa166('0x1a')](dbH[_0xa166('0x2c')][_0xa166('0x2d')](QUERY,{'type':dbH[_0xa166('0x2c')][_0xa166('0x2f')][_0xa166('0x30')]}));}var _0x27e55a=path[_0xa166('0x31')](PATH);var _0x3701a1=path[_0xa166('0x32')](PATH,_0xa166('0x33'));var _0x1b8fe6=_0x26fdc8[_0xa166('0x27')]&&_0x1a29f7[_0xa166('0x13')]>0x1;var _0x6ee5a=[];if(!fs['existsSync'](path[_0xa166('0x34')](_0x27e55a,_0x3701a1))&&_0x1b8fe6){fs[_0xa166('0x35')](path['join'](_0x27e55a,_0x3701a1));}return BPromise[_0xa166('0x36')](_0x1a29f7,function(_0x4a3558){_0x6ee5a['push'](_0x4a3558);})['then'](function(){var _0x9fb842=[];for(var _0x1265df=0x0;_0x1265df<_0x6ee5a[_0xa166('0x13')];_0x1265df+=0x1){var _0x2c4e91=_0x6ee5a[_0x1265df];var _0x1b196b=createTables(_[_0xa166('0x37')](_0x2c4e91));var _0x5e0939;var _0x483099=getPDFDocDefinition(_0x1b196b);var _0x5e81a3=getPDFPrinter();var _0x5de508=_0x5e81a3[_0xa166('0x38')](_0x483099);if(_0x1b8fe6){_0x5e0939=path['join'](_0x27e55a,_0x3701a1,util[_0xa166('0x1b')]('%s%d.%s',_0x3701a1,_0x1265df,_0xa166('0x39')));}else{_0x5e0939=path[_0xa166('0x34')](_0x27e55a,util[_0xa166('0x1b')](_0xa166('0x3a'),_0x3701a1,_0xa166('0x39')));}_0x9fb842[_0xa166('0x1a')](writePDFDocument(_0x5de508,_0x5e0939));}return Promise[_0xa166('0x3b')](_0x9fb842);})[_0xa166('0x3c')](function(){if(_0x1b8fe6){return new Promise(function(_0x26794b){zipdir(path[_0xa166('0x34')](_0x27e55a,_0x3701a1),{'saveTo':path[_0xa166('0x34')](_0x27e55a,util[_0xa166('0x1b')]('%s.%s',_0x3701a1,_0xa166('0x3d')))},function(){rimraf(path['join'](_0x27e55a,_0x3701a1),function(){});_0x26794b(_0xa166('0x3e'));});});}})[_0xa166('0x3c')](function(){if(!_0x1b8fe6)return;rimraf(path['join'](_0x27e55a,_0x3701a1),function(){});})['then'](function(){logger[_0xa166('0x3f')](util[_0xa166('0x1b')](_0xa166('0x40'),EXTRACTED_REPORT_ID,_0xa166('0x41')));return analyticExtractedReport('Completed',_0x1b8fe6?util[_0xa166('0x1b')](_0xa166('0x3a'),_0x3701a1,_0x1b8fe6?_0xa166('0x3d'):_0xa166('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa166('0x3f')](util[_0xa166('0x1b')](_0xa166('0x42'),EXTRACTED_REPORT_ID,_0xa166('0x41')));return db[_0xa166('0xd')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa166('0x3c')](function(_0x4ff91c){EXTRACTED_REPORT=_0x4ff91c;return dbH[_0xa166('0x2c')][_0xa166('0x2d')](util[_0xa166('0x1b')](_0xa166('0x43'),QUERY),{'type':dbH[_0xa166('0x2c')]['QueryTypes'][_0xa166('0x30')]});})[_0xa166('0x3c')](extractReport)[_0xa166('0x44')](function(_0x153e98){logger[_0xa166('0x3f')](util['format'](_0xa166('0x45'),EXTRACTED_REPORT_ID,_0xa166('0x41')),util[_0xa166('0x46')](_0x153e98,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa166('0x47'));})[_0xa166('0x48')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1add7=new PdfPrinter({'Arial':{'normal':__dirname+_0xa166('0x49'),'bold':__dirname+_0xa166('0x4a'),'italics':__dirname+_0xa166('0x4b'),'bolditalics':__dirname+_0xa166('0x4c')}});return _0x1add7;}function getPDFDocDefinitionFromHTML(_0xc29971,_0xa8fd7e){var _0x1682d8=util['format']('%s\x20#%d',_0xa8fd7e[_0xa166('0x4d')],_0xa8fd7e[_0xa166('0x4e')]);var _0x574f3c=moment()[_0xa166('0x1b')](_0xa166('0x4f'))['toString']();var _0x2c7d7a=htmlToPdfmake(_0xc29971,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2c7d7a],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa166('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa166('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xa166('0x51'),'style':_0xa166('0x1e')}];},'footer':function(_0x2747ef,_0x509f7e){return[{'text':util[_0xa166('0x1b')](_0xa166('0x52'),_0x1682d8,_0x2747ef,_0x509f7e,_0x574f3c),'style':_0xa166('0x53')}];}};}function writePDFDocument(_0x4d61a4,_0x19c05b){return new Promise(function(_0x13826e,_0x462ec8){var _0x3b84c9=_0x4d61a4[_0xa166('0x54')](fs['createWriteStream'](_0x19c05b));_0x3b84c9['on'](_0xa166('0x55'),function(){_0x13826e(_0xa166('0x55'));});_0x3b84c9['on'](_0xa166('0x56'),function(_0x498969){_0x462ec8(_0x498969);});_0x4d61a4[_0xa166('0x57')]();});}exports[_0xa166('0x58')]=function(_0x11c398,_0x51c613){var _0x837bf7=getPDFPrinter();var _0x1811fd=getPDFDocDefinitionFromHTML(_0x11c398,_0x51c613);var _0x78d7ae=_0x837bf7[_0xa166('0x38')](_0x1811fd);return writePDFDocument(_0x78d7ae,_0x51c613[_0xa166('0x2')])['catch'](function(_0xe0e3ee){throw _0xe0e3ee;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b717ddd..5a7bf5d 100644 --- a/server/components/export/xlsx.js +++ b/server/components/export/xlsx.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21f8=['%s\x20limit\x20%d\x20OFFSET\x20%d','push','length','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','range'];(function(_0x5df887,_0x2fdfa2){var _0x369cfd=function(_0x154568){while(--_0x154568){_0x5df887['push'](_0x5df887['shift']());}};_0x369cfd(++_0x2fdfa2);}(_0x21f8,0x71));var _0x821f=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0x21f8[_0x1177d5];return _0xc3ddc2;};'use strict';var util=require(_0x821f('0x0'));var path=require(_0x821f('0x1'));var _=require(_0x821f('0x2'));var fs=require('fs');var json2xls=require(_0x821f('0x3'));var BPromise=require(_0x821f('0x4'));var zipdir=require(_0x821f('0x5'));var rimraf=require(_0x821f('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x821f('0x7'))(_0x821f('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x821f('0x9')][0x2]);var QUERY=process[_0x821f('0x9')][0x3];var PATH=process[_0x821f('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3a42fe,_0x1b9945){var _0xfcb0a={'status':_0x3a42fe};var _0x4e260d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b9945){_0xfcb0a['savename']=_0x1b9945;}return db[_0x821f('0xa')][_0x821f('0xb')](_0xfcb0a,_0x4e260d);}function main(){var _0x81e2f4=0x1388;var _0x53ce42;logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0xe'),EXTRACTED_REPORT_ID,_0x821f('0xf')));return db[_0x821f('0x10')][_0x821f('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x821f('0x12'),_0x821f('0x13')]})[_0x821f('0x14')](function(_0x2aeb4e){if(_0x2aeb4e){_0x53ce42=_0x2aeb4e;_0x81e2f4=_0x53ce42['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x821f('0x15')][_0x821f('0x16')](util[_0x821f('0xd')](_0x821f('0x17'),QUERY),{'type':dbH[_0x821f('0x15')][_0x821f('0x18')][_0x821f('0x19')]});})[_0x821f('0x14')](function(_0x1aeda5){if(!_0x1aeda5[0x0][_0x821f('0x1a')]){return analyticExtractedReport('Empty');}var _0x3419ab=[];var _0x594165=0x0;if(_0x53ce42[_0x821f('0x12')]){if(_0x1aeda5&&_0x1aeda5['length']){var _0x46acae=_[_0x821f('0x1b')](_0x1aeda5[0x0][_0x821f('0x1a')]/_0x81e2f4);var _0x27c41c=Number['isInteger'](_0x1aeda5[0x0][_0x821f('0x1a')]/_0x81e2f4)?_0x1aeda5[0x0][_0x821f('0x1a')]%_0x81e2f4:0x0;_0x46acae['forEach'](function(_0x193b41){if(_0x193b41>0x0){_0x594165+=_0x81e2f4;}_0x3419ab['push'](dbH[_0x821f('0x15')]['query'](util[_0x821f('0xd')](_0x821f('0x1c'),QUERY,_0x81e2f4,_0x594165),{'type':dbH['sequelize']['QueryTypes'][_0x821f('0x19')]}));});if(_0x27c41c>0x0){_0x594165+=_0x81e2f4;_0x3419ab[_0x821f('0x1d')](dbH[_0x821f('0x15')]['query'](util[_0x821f('0xd')](_0x821f('0x1c'),QUERY,_0x27c41c,_0x594165),{'type':dbH[_0x821f('0x15')]['QueryTypes'][_0x821f('0x19')]}));}}}else{_0x3419ab[_0x821f('0x1d')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x821f('0x19')]}));}var _0x4af347=path['dirname'](PATH);var _0x21c1d9=path['basename'](PATH,'.xlsx');var _0x3d7994=_0x53ce42[_0x821f('0x12')]&&_0x3419ab[_0x821f('0x1e')]>0x1;var _0x368a74=[];if(!fs['existsSync'](path[_0x821f('0x1f')](_0x4af347,_0x21c1d9))&&_0x3d7994){fs[_0x821f('0x20')](path[_0x821f('0x1f')](_0x4af347,_0x21c1d9));}return BPromise[_0x821f('0x21')](_0x3419ab,function(_0x47f0b6){_0x368a74[_0x821f('0x1d')](_0x47f0b6);})[_0x821f('0x14')](function(){for(var _0x130649=0x0;_0x130649<_0x368a74[_0x821f('0x1e')];_0x130649+=0x1){var _0x53d87e;var _0xceb073=_0x368a74[_0x130649];if(_0x3d7994){_0x53d87e=path['join'](_0x4af347,_0x21c1d9,util['format'](_0x821f('0x22'),_0x21c1d9,_0x130649,_0x821f('0x23')));}else{_0x53d87e=path[_0x821f('0x1f')](_0x4af347,util[_0x821f('0xd')](_0x821f('0x24'),_0x21c1d9,'xlsx'));}fs[_0x821f('0x25')](_0x53d87e,json2xls(_0xceb073),_0x821f('0x26'));}})[_0x821f('0x14')](function(){if(_0x3d7994){return new Promise(function(_0x12a47a){zipdir(path['join'](_0x4af347,_0x21c1d9),{'saveTo':path[_0x821f('0x1f')](_0x4af347,util[_0x821f('0xd')](_0x821f('0x24'),_0x21c1d9,_0x821f('0x27')))},function(_0x1d2660,_0x10c5ac){rimraf(path['join'](_0x4af347,_0x21c1d9),function(){});_0x12a47a(_0x821f('0x28'));});});}})['then'](function(){logger[_0x821f('0xc')](util[_0x821f('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x821f('0x29'),_0x3d7994?util[_0x821f('0xd')](_0x821f('0x24'),_0x21c1d9,_0x3d7994?_0x821f('0x27'):_0x821f('0x23')):null);});})['catch'](function(_0x4d6612){logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0x2a'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x821f('0x2b')](_0x4d6612,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x821f('0x2c'));})[_0x821f('0x2d')](function(){process[_0x821f('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2f77=['split','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','length','existsSync','join','mkdirSync','%s%d.%s','%s.%s','xlsx','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty'];(function(_0x15f695,_0x2eca0e){var _0x955fd9=function(_0x4c2f7b){while(--_0x4c2f7b){_0x15f695['push'](_0x15f695['shift']());}};_0x955fd9(++_0x2eca0e);}(_0x2f77,0x1d2));var _0x72f7=function(_0x340214,_0x117887){_0x340214=_0x340214-0x0;var _0x5269ea=_0x2f77[_0x340214];return _0x5269ea;};'use strict';var util=require(_0x72f7('0x0'));var path=require(_0x72f7('0x1'));var _=require(_0x72f7('0x2'));var fs=require('fs');var json2xls=require(_0x72f7('0x3'));var BPromise=require(_0x72f7('0x4'));var zipdir=require(_0x72f7('0x5'));var rimraf=require('rimraf');var db=require(_0x72f7('0x6'))['db'];var dbH=require(_0x72f7('0x6'))[_0x72f7('0x7')];var logger=require(_0x72f7('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x72f7('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x134993,_0x55f681){var _0x37495f={'status':_0x134993};var _0x5aa1ec={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x55f681){_0x37495f[_0x72f7('0xa')]=_0x55f681;}return db['AnalyticExtractedReport'][_0x72f7('0xb')](_0x37495f,_0x5aa1ec);}function main(){var _0xcf7303=0x1388;var _0x5cbcb8;logger[_0x72f7('0xc')](util['format'](_0x72f7('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x72f7('0xe')][_0x72f7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x72f7('0x10')]})['then'](function(_0x4f1d56){if(_0x4f1d56){_0x5cbcb8=_0x4f1d56;_0xcf7303=_0x5cbcb8[_0x72f7('0x10')]||0x1388;}})[_0x72f7('0x11')](function(){return dbH[_0x72f7('0x12')][_0x72f7('0x13')](util[_0x72f7('0x14')](_0x72f7('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x72f7('0x16')]});})[_0x72f7('0x11')](function(_0x5c1a87){if(!_0x5c1a87[0x0]['num']){return analyticExtractedReport(_0x72f7('0x17'));}var _0x1ac3b8=[];var _0x431ab6=0x0;if(_0x5cbcb8[_0x72f7('0x18')]){if(_0x5c1a87&&_0x5c1a87['length']){var _0x111187=_[_0x72f7('0x19')](_0x5c1a87[0x0][_0x72f7('0x1a')]/_0xcf7303);var _0x10fce6=Number['isInteger'](_0x5c1a87[0x0][_0x72f7('0x1a')]/_0xcf7303)?_0x5c1a87[0x0]['num']%_0xcf7303:0x0;_0x111187[_0x72f7('0x1b')](function(_0x32b420){if(_0x32b420>0x0){_0x431ab6+=_0xcf7303;}_0x1ac3b8[_0x72f7('0x1c')](dbH['sequelize'][_0x72f7('0x13')](util[_0x72f7('0x14')](_0x72f7('0x1d'),QUERY,_0xcf7303,_0x431ab6),{'type':dbH[_0x72f7('0x12')][_0x72f7('0x1e')]['SELECT']}));});if(_0x10fce6>0x0){_0x431ab6+=_0xcf7303;_0x1ac3b8[_0x72f7('0x1c')](dbH[_0x72f7('0x12')][_0x72f7('0x13')](util[_0x72f7('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x10fce6,_0x431ab6),{'type':dbH[_0x72f7('0x12')][_0x72f7('0x1e')][_0x72f7('0x16')]}));}}}else{_0x1ac3b8[_0x72f7('0x1c')](dbH[_0x72f7('0x12')][_0x72f7('0x13')](QUERY,{'type':dbH[_0x72f7('0x12')][_0x72f7('0x1e')][_0x72f7('0x16')]}));}var _0x93217b=path['dirname'](PATH);var _0x1a6691=path[_0x72f7('0x1f')](PATH,'.xlsx');var _0x433e79=_0x5cbcb8[_0x72f7('0x18')]&&_0x1ac3b8[_0x72f7('0x20')]>0x1;var _0x22fe03=[];if(!fs[_0x72f7('0x21')](path[_0x72f7('0x22')](_0x93217b,_0x1a6691))&&_0x433e79){fs[_0x72f7('0x23')](path[_0x72f7('0x22')](_0x93217b,_0x1a6691));}return BPromise['each'](_0x1ac3b8,function(_0xe9ce9a){_0x22fe03[_0x72f7('0x1c')](_0xe9ce9a);})[_0x72f7('0x11')](function(){for(var _0x5583f8=0x0;_0x5583f8<_0x22fe03['length'];_0x5583f8+=0x1){var _0x4066ed;var _0x2d703e=_0x22fe03[_0x5583f8];if(_0x433e79){_0x4066ed=path[_0x72f7('0x22')](_0x93217b,_0x1a6691,util[_0x72f7('0x14')](_0x72f7('0x24'),_0x1a6691,_0x5583f8,'xlsx'));}else{_0x4066ed=path[_0x72f7('0x22')](_0x93217b,util[_0x72f7('0x14')](_0x72f7('0x25'),_0x1a6691,_0x72f7('0x26')));}fs['writeFileSync'](_0x4066ed,json2xls(_0x2d703e),'binary');}})[_0x72f7('0x11')](function(){if(_0x433e79){return new Promise(function(_0x45d0da){zipdir(path[_0x72f7('0x22')](_0x93217b,_0x1a6691),{'saveTo':path[_0x72f7('0x22')](_0x93217b,util[_0x72f7('0x14')](_0x72f7('0x25'),_0x1a6691,'zip'))},function(_0x141191,_0x5d5b70){rimraf(path[_0x72f7('0x22')](_0x93217b,_0x1a6691),function(){});_0x45d0da(_0x72f7('0x27'));});});}})[_0x72f7('0x11')](function(){logger[_0x72f7('0xc')](util[_0x72f7('0x14')](_0x72f7('0x28'),EXTRACTED_REPORT_ID,_0x72f7('0x29')));return analyticExtractedReport(_0x72f7('0x2a'),_0x433e79?util['format'](_0x72f7('0x25'),_0x1a6691,_0x433e79?_0x72f7('0x2b'):_0x72f7('0x26')):null);});})[_0x72f7('0x2c')](function(_0x2daea7){logger[_0x72f7('0xc')](util[_0x72f7('0x14')](_0x72f7('0x2d'),EXTRACTED_REPORT_ID,_0x72f7('0x29')),util[_0x72f7('0x2e')](_0x2daea7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x72f7('0x2f'));})['finally'](function(){process[_0x72f7('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index dd33c79..3e575c2 100644 --- a/server/components/extensions/rewrite.js +++ b/server/components/extensions/rewrite.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7145=['wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','then','intervals','VoiceExtension','IntervalId','map','CAST(priority\x20AS\x20UNSIGNED)','queue','hasOwnProperty','extensions','find','push','type','format','CDR(type)=%s','context','exten','VoiceExtensionId','Set','priority','outbound','extension','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT='];(function(_0xba4220,_0x5217a7){var _0x4cdb9d=function(_0x32cae1){while(--_0x32cae1){_0xba4220['push'](_0xba4220['shift']());}};_0x4cdb9d(++_0x5217a7);}(_0x7145,0x1f2));var _0x5714=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7145[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5714('0x0'));var util=require(_0x5714('0x1'));function rewrite(_0x4f31b4,_0x414fdd){var _0x7b30ee=this;return _0x4f31b4[_0x5714('0x2')]['Interval'][_0x5714('0x3')]({'raw':!![]})[_0x5714('0x4')](function(_0x5e6a5a){_0x7b30ee[_0x5714('0x5')]=_0x5e6a5a;return _0x4f31b4['models'][_0x5714('0x6')][_0x5714('0x3')]({'where':{'IntervalId':_0x414fdd[_0x5714('0x7')]},'raw':!![]});})[_0x5714('0x4')](function(_0xc308a3){return _0x4f31b4[_0x5714('0x2')][_0x5714('0x6')][_0x5714('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x5714('0x8')](_0xc308a3,'exten'))}},'order':[{'raw':_0x5714('0x9')}],'raw':!![]});})[_0x5714('0x4')](function(_0x96d33d){var _0x15fd5e=_['filter'](_0x96d33d,{'priority':'1'});var _0x4f77d1=_['filter'](_0x96d33d,{'isApp':0x1});var _0x2777f3=_['groupBy'](_0x4f77d1,'exten');var _0x53b835=[_0x5714('0xa'),'playback'];var _0xf4b0be=[];var _0x53aee5=[];for(var _0xbf87cd in _0x2777f3){if(_0x2777f3[_0x5714('0xb')](_0xbf87cd)){_0x7b30ee['priority']=0x2;_0x7b30ee[_0x5714('0xc')]=[];_0x7b30ee['extension']=_[_0x5714('0xd')](_0x15fd5e,{'exten':_0x2777f3[_0xbf87cd][0x0]['exten']});_0x7b30ee[_0x5714('0xc')][_0x5714('0xe')]({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':'Set','appdata':util[_0x5714('0x10')](_0x5714('0x11'),_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')]),'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x13')],'priority':_0x7b30ee['priority']++,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x14')]});if(_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')]==='inbound'){_0x7b30ee[_0x5714('0xc')]['push']({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':_0x5714('0x15'),'appdata':'CDR(routeid)='+_0x2777f3[_0xbf87cd][0x0][_0x5714('0x14')],'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x13')],'priority':_0x7b30ee[_0x5714('0x16')]++,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x14')]});}else if(_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')]===_0x5714('0x17')){if(_0x7b30ee[_0x5714('0x18')]){_0x7b30ee['extensions']['push']({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':_0x5714('0x15'),'appdata':_0x5714('0x19')+(_0x7b30ee[_0x5714('0x18')][_0x5714('0x1a')]?'${EXTEN:'+_0x7b30ee[_0x5714('0x18')][_0x5714('0x1a')]+'}':_0x5714('0x1b')),'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0]['exten'],'priority':_0x7b30ee['priority']++,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x14')]});}_0x7b30ee[_0x5714('0xc')]['push']({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':_0x5714('0x15'),'appdata':_0x5714('0x1c')+_0x2777f3[_0xbf87cd][0x0][_0x5714('0x14')],'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0]['exten'],'priority':_0x7b30ee[_0x5714('0x16')]++,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0]['VoiceExtensionId']});var _0x2b9b6f=_0x7b30ee[_0x5714('0x16')]++;_0x7b30ee[_0x5714('0xc')][_0x5714('0xe')]({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':_0x5714('0x1d'),'appdata':_0x5714('0x1e')+(_0x2b9b6f+0x2)+_0x5714('0x1f')+(_0x2b9b6f+0x1)+')','context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x13')],'priority':_0x2b9b6f,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0]['VoiceExtensionId']});if(_0x7b30ee[_0x5714('0x18')]){_0x7b30ee[_0x5714('0xc')][_0x5714('0xe')]({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':_0x5714('0x15'),'appdata':_0x7b30ee[_0x5714('0x18')][_0x5714('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x7b30ee['extension']['cutdigits']+'}':_0x5714('0x20'),'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x13')],'priority':_0x7b30ee[_0x5714('0x16')]++,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x14')]});}_0x7b30ee[_0x5714('0xc')][_0x5714('0xe')]({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':_0x5714('0x15'),'appdata':_0x5714('0x21')+_0x2777f3[_0xbf87cd][0x0][_0x5714('0x14')],'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0]['exten'],'priority':_0x7b30ee[_0x5714('0x16')]++,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x14')]});if(_0x7b30ee[_0x5714('0x18')]&&_0x7b30ee[_0x5714('0x18')]['hasOwnProperty'](_0x5714('0x22'))&&_0x7b30ee[_0x5714('0x18')][_0x5714('0x22')]!==_0x5714('0x23')){_0x7b30ee['extensions'][_0x5714('0xe')]({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':_0x5714('0x15'),'appdata':_0x5714('0x24'),'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x13')],'priority':_0x7b30ee[_0x5714('0x16')]++,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x14')]});_0x7b30ee[_0x5714('0xc')][_0x5714('0xe')]({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':'Set','appdata':_0x5714('0x25')+_0x7b30ee[_0x5714('0x18')][_0x5714('0x22')]||_0x5714('0x26'),'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0]['exten'],'priority':_0x7b30ee[_0x5714('0x16')]++,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x14')]});}}_0x7b30ee[_0x5714('0xc')][_0x5714('0xe')]({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':_0x5714('0x15'),'appdata':_0x5714('0x27'),'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x13')],'priority':_0x7b30ee[_0x5714('0x16')]++,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0]['VoiceExtensionId']});_0x7b30ee[_0x5714('0xc')][_0x5714('0xe')]({'type':_0x2777f3[_0xbf87cd][0x0]['type'],'app':'Set','appdata':_0x5714('0x28'),'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x13')],'priority':_0x7b30ee[_0x5714('0x16')]++,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0]['VoiceExtensionId']});_0x7b30ee['extensions'][_0x5714('0xe')]({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':_0x5714('0x15'),'appdata':_0x5714('0x29'),'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'exten':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x13')],'priority':_0x7b30ee[_0x5714('0x16')]++,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0]['VoiceExtensionId']});for(var _0x4a5f6d=0x0,_0x2524c2=0x0;_0x4a5f6d<_0x2777f3[_0xbf87cd][_0x5714('0x2a')];_0x4a5f6d+=0x1,_0x2524c2=0x0){var _0x1f6143=_0x2777f3[_0xbf87cd][_0x4a5f6d];if(_0x1f6143[_0x5714('0xf')]){_0x1f6143['type']=_0x1f6143[_0x5714('0xf')][_0x5714('0x2b')]();}var _0x341024=[];var _0x1723a8=[];delete _0x1f6143['id'];delete _0x1f6143[_0x5714('0x2c')];delete _0x1f6143[_0x5714('0x2d')];var _0x98c41d=_0x1f6143['interval']!==_0x5714('0x2e')?[_0x1f6143[_0x5714('0x2f')]]:_0x1f6143[_0x5714('0x7')]?_['map'](_['filter'](_0x7b30ee[_0x5714('0x5')],{'IntervalId':_0x1f6143[_0x5714('0x7')]}),_0x5714('0x2f')):[];if(_0x1f6143[_0x5714('0xb')](_0x5714('0x30'))){if(_0x1f6143[_0x5714('0x30')]&&_0x1f6143[_0x5714('0x30')]!=='--'){_0x341024[_0x5714('0xe')]({'type':_0x1f6143[_0x5714('0xf')],'app':_0x5714('0x15'),'appdata':'CDR(tag)='+_0x1f6143[_0x5714('0x30')],'context':_0x1f6143[_0x5714('0x12')],'exten':_0x1f6143[_0x5714('0x13')],'priority':_0x98c41d[_0x5714('0x2a')]+_0x7b30ee[_0x5714('0x16')]+_0x2524c2++,'VoiceExtensionId':_0x1f6143[_0x5714('0x14')]});}}if(_0x1f6143[_0x5714('0xf')]===_0x5714('0x17')&&_0x1f6143[_0x5714('0xb')](_0x5714('0x31'))){if(_0x1f6143['callerID']){_0x341024[_0x5714('0xe')]({'type':_0x1f6143[_0x5714('0xf')],'app':'ExecIf','appdata':_0x5714('0x32')+_0x1f6143[_0x5714('0x31')]+')','context':_0x1f6143[_0x5714('0x12')],'exten':_0x1f6143['exten'],'priority':_0x98c41d[_0x5714('0x2a')]+_0x7b30ee[_0x5714('0x16')]+_0x2524c2++,'VoiceExtensionId':_0x1f6143[_0x5714('0x14')]});}else{_0x341024[_0x5714('0xe')]({'type':_0x1f6143[_0x5714('0xf')],'app':_0x5714('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x1f6143['context'],'exten':_0x1f6143['exten'],'priority':_0x98c41d['length']+_0x7b30ee[_0x5714('0x16')]+_0x2524c2++,'VoiceExtensionId':_0x1f6143['VoiceExtensionId']});}}if(_0x1f6143[_0x5714('0xb')](_0x5714('0x33'))){if(_0x53b835[_0x5714('0x34')](_0x1f6143['app'][_0x5714('0x2b')]())>=0x0&&_0x1f6143[_0x5714('0x35')]!=='custom'){if(_0x1f6143[_0x5714('0x33')]){_0x341024[_0x5714('0xe')]({'type':_0x1f6143[_0x5714('0xf')],'app':_0x5714('0x1d'),'appdata':_0x5714('0x36'),'context':_0x1f6143['context'],'exten':_0x1f6143[_0x5714('0x13')],'priority':_0x98c41d[_0x5714('0x2a')]+_0x7b30ee[_0x5714('0x16')]+_0x2524c2++,'VoiceExtensionId':_0x1f6143['VoiceExtensionId']});_0x341024[_0x5714('0xe')]({'type':_0x1f6143['type'],'app':_0x5714('0x15'),'appdata':_0x5714('0x37'),'context':_0x1f6143[_0x5714('0x12')],'exten':_0x1f6143[_0x5714('0x13')],'priority':_0x98c41d[_0x5714('0x2a')]+_0x7b30ee['priority']+_0x2524c2++,'VoiceExtensionId':_0x1f6143['VoiceExtensionId']});}else{_0x341024['push']({'type':_0x1f6143['type'],'app':_0x5714('0x1d'),'appdata':_0x5714('0x38'),'context':_0x1f6143['context'],'exten':_0x1f6143[_0x5714('0x13')],'priority':_0x98c41d['length']+_0x7b30ee['priority']+_0x2524c2++,'VoiceExtensionId':_0x1f6143[_0x5714('0x14')]});_0x341024[_0x5714('0xe')]({'type':_0x1f6143[_0x5714('0xf')],'app':_0x5714('0x15'),'appdata':_0x5714('0x39'),'context':_0x1f6143[_0x5714('0x12')],'exten':_0x1f6143[_0x5714('0x13')],'priority':_0x98c41d[_0x5714('0x2a')]+_0x7b30ee[_0x5714('0x16')]+_0x2524c2++,'VoiceExtensionId':_0x1f6143['VoiceExtensionId']});}}}for(var _0x419d3f=0x0;_0x419d3f<_0x98c41d['length'];_0x419d3f+=0x1){var _0x486cb8=_0x7b30ee[_0x5714('0x16')]+_0x98c41d['length'];var _0x137ae0=_0x419d3f===_0x98c41d[_0x5714('0x2a')]-0x1?_0x7b30ee[_0x5714('0x16')]+_0x341024['length']+_0x1723a8[_0x5714('0x2a')]+0x2:_0x7b30ee[_0x5714('0x16')]+_0x419d3f+0x1;_0x341024['splice'](_0x419d3f,0x0,{'type':_0x1f6143[_0x5714('0xf')],'app':'GotoIfTime','appdata':_0x98c41d[_0x419d3f]+'?'+_0x1f6143[_0x5714('0x12')]+_0x5714('0x3a')+_0x486cb8+':'+_0x1f6143['context']+_0x5714('0x3a')+_0x137ae0,'exten':_0x1f6143[_0x5714('0x13')],'context':_0x1f6143[_0x5714('0x12')],'priority':_0x7b30ee[_0x5714('0x16')]+_0x419d3f,'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x14')]});}_0x1f6143[_0x5714('0x16')]=_0x341024['length']?_['last'](_0x341024)['priority']+0x1:_0x7b30ee['priority'];_0x7b30ee[_0x5714('0x16')]=(_0x1723a8['length']?_[_0x5714('0x3b')](_0x1723a8)[_0x5714('0x16')]:_0x1f6143['priority'])+0x1;_0x7b30ee[_0x5714('0xc')]=_[_0x5714('0x3c')](_0x7b30ee[_0x5714('0xc')],_0x341024,[_0x1f6143],_0x1723a8);}_0x7b30ee[_0x5714('0xc')][_0x5714('0xe')]({'type':_0x2777f3[_0xbf87cd][0x0][_0x5714('0xf')],'app':_0x5714('0x3d'),'exten':_0x2777f3[_0xbf87cd][0x0]['exten'],'context':_0x2777f3[_0xbf87cd][0x0][_0x5714('0x12')],'priority':_0x7b30ee['priority'],'VoiceExtensionId':_0x2777f3[_0xbf87cd][0x0]['VoiceExtensionId']});_0xf4b0be['push'](_0x2777f3[_0xbf87cd][0x0]['VoiceExtensionId']);_0x53aee5=_[_0x5714('0x3c')](_0x53aee5,_0x7b30ee['extensions']);}}return _0x4f31b4['transaction'](function(_0x1b534e){return _0x4f31b4[_0x5714('0x2')][_0x5714('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0xf4b0be}},'transaction':_0x1b534e})['then'](function(_0x42c71f){return _0x4f31b4['models'][_0x5714('0x6')][_0x5714('0x3e')](_[_0x5714('0x3f')](_0x53aee5,_0x5714('0x16')),{'transaction':_0x1b534e});});});})[_0x5714('0x40')](function(_0x15097b){console[_0x5714('0x41')](_0x15097b);});}exports[_0x5714('0x42')]=rewrite; \ No newline at end of file +var _0xaa86=['CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','catch','error','rewrite','lodash','util','models','Interval','then','intervals','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','CDR(type)=%s','context','CDR(routeid)=','VoiceExtensionId','outbound'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaa86,0x1d6));var _0x6aa8=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xaa86[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x6aa8('0x0'));var util=require(_0x6aa8('0x1'));function rewrite(_0x310a7f,_0xa26f68){var _0x221f16=this;return _0x310a7f[_0x6aa8('0x2')][_0x6aa8('0x3')]['findAll']({'raw':!![]})[_0x6aa8('0x4')](function(_0x1aeaa1){_0x221f16[_0x6aa8('0x5')]=_0x1aeaa1;return _0x310a7f[_0x6aa8('0x2')][_0x6aa8('0x6')]['findAll']({'where':{'IntervalId':_0xa26f68[_0x6aa8('0x7')]},'raw':!![]});})[_0x6aa8('0x4')](function(_0x5667b2){return _0x310a7f[_0x6aa8('0x2')][_0x6aa8('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x6aa8('0x8')](_0x5667b2,_0x6aa8('0x9')))}},'order':[{'raw':_0x6aa8('0xa')}],'raw':!![]});})['then'](function(_0x160c94){var _0x4c07b6=_[_0x6aa8('0xb')](_0x160c94,{'priority':'1'});var _0x967aea=_[_0x6aa8('0xb')](_0x160c94,{'isApp':0x1});var _0x1179b3=_[_0x6aa8('0xc')](_0x967aea,'exten');var _0x15f9ca=['queue',_0x6aa8('0xd')];var _0x55f8ff=[];var _0x117401=[];for(var _0xca1f1d in _0x1179b3){if(_0x1179b3[_0x6aa8('0xe')](_0xca1f1d)){_0x221f16[_0x6aa8('0xf')]=0x2;_0x221f16[_0x6aa8('0x10')]=[];_0x221f16[_0x6aa8('0x11')]=_[_0x6aa8('0x12')](_0x4c07b6,{'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')]});_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':util['format'](_0x6aa8('0x16'),_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')]),'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0]['exten'],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0]['VoiceExtensionId']});if(_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')]==='inbound'){_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x18')+_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')],'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0]['exten'],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});}else if(_0x1179b3[_0xca1f1d][0x0]['type']===_0x6aa8('0x1a')){if(_0x221f16[_0x6aa8('0x11')]){_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x1b')+(_0x221f16[_0x6aa8('0x11')][_0x6aa8('0x1c')]?_0x6aa8('0x1d')+_0x221f16[_0x6aa8('0x11')]['cutdigits']+'}':_0x6aa8('0x1e')),'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0]['exten'],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});}_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0]['type'],'app':_0x6aa8('0x15'),'appdata':'CDR(routeid)='+_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')],'context':_0x1179b3[_0xca1f1d][0x0]['context'],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});var _0x39b267=_0x221f16[_0x6aa8('0xf')]++;_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':'ExecIf','appdata':_0x6aa8('0x1f')+(_0x39b267+0x2)+_0x6aa8('0x20')+(_0x39b267+0x1)+')','context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x39b267,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});if(_0x221f16[_0x6aa8('0x11')]){_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x221f16['extension'][_0x6aa8('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x221f16[_0x6aa8('0x11')][_0x6aa8('0x1c')]+'}':_0x6aa8('0x21'),'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16['priority']++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});}_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x22')+_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')],'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});if(_0x221f16[_0x6aa8('0x11')]&&_0x221f16[_0x6aa8('0x11')][_0x6aa8('0xe')](_0x6aa8('0x23'))&&_0x221f16[_0x6aa8('0x11')][_0x6aa8('0x23')]!=='none'){_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0]['type'],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x24'),'context':_0x1179b3[_0xca1f1d][0x0]['context'],'exten':_0x1179b3[_0xca1f1d][0x0]['exten'],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x25')+_0x221f16[_0x6aa8('0x11')]['recordingFormat']||_0x6aa8('0x26'),'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});}}_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0]['type'],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x27'),'context':_0x1179b3[_0xca1f1d][0x0]['context'],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':'Set','appdata':_0x6aa8('0x28'),'context':_0x1179b3[_0xca1f1d][0x0]['context'],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0]['VoiceExtensionId']});_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':'Set','appdata':_0x6aa8('0x29'),'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});for(var _0x5f0440=0x0,_0x24d01a=0x0;_0x5f0440<_0x1179b3[_0xca1f1d][_0x6aa8('0x2a')];_0x5f0440+=0x1,_0x24d01a=0x0){var _0xec8527=_0x1179b3[_0xca1f1d][_0x5f0440];if(_0xec8527[_0x6aa8('0x14')]){_0xec8527[_0x6aa8('0x14')]=_0xec8527['type'][_0x6aa8('0x2b')]();}var _0x326641=[];var _0x320961=[];delete _0xec8527['id'];delete _0xec8527[_0x6aa8('0x2c')];delete _0xec8527[_0x6aa8('0x2d')];var _0x3ed9df=_0xec8527[_0x6aa8('0x2e')]!==_0x6aa8('0x2f')?[_0xec8527[_0x6aa8('0x2e')]]:_0xec8527['IntervalId']?_['map'](_[_0x6aa8('0xb')](_0x221f16[_0x6aa8('0x5')],{'IntervalId':_0xec8527[_0x6aa8('0x7')]}),'interval'):[];if(_0xec8527['hasOwnProperty'](_0x6aa8('0x30'))){if(_0xec8527[_0x6aa8('0x30')]&&_0xec8527[_0x6aa8('0x30')]!=='--'){_0x326641['push']({'type':_0xec8527[_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x31')+_0xec8527[_0x6aa8('0x30')],'context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527[_0x6aa8('0x9')],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16[_0x6aa8('0xf')]+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});}}if(_0xec8527[_0x6aa8('0x14')]===_0x6aa8('0x1a')&&_0xec8527[_0x6aa8('0xe')]('callerID')){if(_0xec8527['callerID']){_0x326641['push']({'type':_0xec8527[_0x6aa8('0x14')],'app':_0x6aa8('0x32'),'appdata':_0x6aa8('0x33')+_0xec8527[_0x6aa8('0x34')]+')','context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527[_0x6aa8('0x9')],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16['priority']+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});}else{_0x326641['push']({'type':_0xec8527[_0x6aa8('0x14')],'app':_0x6aa8('0x32'),'appdata':_0x6aa8('0x35'),'context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527['exten'],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16[_0x6aa8('0xf')]+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});}}if(_0xec8527['hasOwnProperty'](_0x6aa8('0x36'))){if(_0x15f9ca[_0x6aa8('0x37')](_0xec8527[_0x6aa8('0x38')][_0x6aa8('0x2b')]())>=0x0&&_0xec8527[_0x6aa8('0x39')]!==_0x6aa8('0x3a')){if(_0xec8527[_0x6aa8('0x36')]){_0x326641[_0x6aa8('0x13')]({'type':_0xec8527['type'],'app':_0x6aa8('0x32'),'appdata':_0x6aa8('0x3b'),'context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527[_0x6aa8('0x9')],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16['priority']+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});_0x326641[_0x6aa8('0x13')]({'type':_0xec8527['type'],'app':_0x6aa8('0x15'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527[_0x6aa8('0x9')],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16[_0x6aa8('0xf')]+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});}else{_0x326641[_0x6aa8('0x13')]({'type':_0xec8527['type'],'app':'ExecIf','appdata':_0x6aa8('0x3c'),'context':_0xec8527['context'],'exten':_0xec8527['exten'],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16[_0x6aa8('0xf')]+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});_0x326641[_0x6aa8('0x13')]({'type':_0xec8527[_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527[_0x6aa8('0x9')],'priority':_0x3ed9df['length']+_0x221f16['priority']+_0x24d01a++,'VoiceExtensionId':_0xec8527['VoiceExtensionId']});}}}for(var _0x28ef3a=0x0;_0x28ef3a<_0x3ed9df['length'];_0x28ef3a+=0x1){var _0x4c4a6e=_0x221f16[_0x6aa8('0xf')]+_0x3ed9df[_0x6aa8('0x2a')];var _0x160638=_0x28ef3a===_0x3ed9df[_0x6aa8('0x2a')]-0x1?_0x221f16[_0x6aa8('0xf')]+_0x326641[_0x6aa8('0x2a')]+_0x320961[_0x6aa8('0x2a')]+0x2:_0x221f16[_0x6aa8('0xf')]+_0x28ef3a+0x1;_0x326641['splice'](_0x28ef3a,0x0,{'type':_0xec8527[_0x6aa8('0x14')],'app':_0x6aa8('0x3d'),'appdata':_0x3ed9df[_0x28ef3a]+'?'+_0xec8527['context']+_0x6aa8('0x3e')+_0x4c4a6e+':'+_0xec8527[_0x6aa8('0x17')]+_0x6aa8('0x3e')+_0x160638,'exten':_0xec8527[_0x6aa8('0x9')],'context':_0xec8527['context'],'priority':_0x221f16['priority']+_0x28ef3a,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});}_0xec8527[_0x6aa8('0xf')]=_0x326641[_0x6aa8('0x2a')]?_['last'](_0x326641)[_0x6aa8('0xf')]+0x1:_0x221f16[_0x6aa8('0xf')];_0x221f16[_0x6aa8('0xf')]=(_0x320961['length']?_[_0x6aa8('0x3f')](_0x320961)[_0x6aa8('0xf')]:_0xec8527['priority'])+0x1;_0x221f16[_0x6aa8('0x10')]=_[_0x6aa8('0x40')](_0x221f16['extensions'],_0x326641,[_0xec8527],_0x320961);}_0x221f16[_0x6aa8('0x10')]['push']({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x41'),'exten':_0x1179b3[_0xca1f1d][0x0]['exten'],'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'priority':_0x221f16[_0x6aa8('0xf')],'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});_0x55f8ff[_0x6aa8('0x13')](_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]);_0x117401=_['concat'](_0x117401,_0x221f16[_0x6aa8('0x10')]);}}return _0x310a7f[_0x6aa8('0x42')](function(_0x189713){return _0x310a7f[_0x6aa8('0x2')][_0x6aa8('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x55f8ff}},'transaction':_0x189713})[_0x6aa8('0x4')](function(_0xc7bd15){return _0x310a7f['models']['VoiceExtension'][_0x6aa8('0x43')](_['sortBy'](_0x117401,_0x6aa8('0xf')),{'transaction':_0x189713});});});})[_0x6aa8('0x44')](function(_0x3f9d39){console[_0x6aa8('0x45')](_0x3f9d39);});}exports[_0x6aa8('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index b466f58..60a3481 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a93=['../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','phone','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','find','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','ListId','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','\x20=\x20?','into','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','cm_contacts','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','query','VoiceQueueId','sequelize','all','BlackLists','get','Campaign','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resolve','emit','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','duplicate','pause','CSV\x20parse\x20error','util','squel','papaparse','../../../mysqldb','../../../config/environment'];(function(_0x1870c0,_0x5904ee){var _0x290f9e=function(_0x511ebf){while(--_0x511ebf){_0x1870c0['push'](_0x1870c0['shift']());}};_0x290f9e(++_0x5904ee);}(_0x4a93,0xd1));var _0x34a9=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x4a93[_0x5c2e3e];return _0x53f64a;};'use strict';var BPromise=require('bluebird');var util=require(_0x34a9('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0x34a9('0x1'));var Papa=require(_0x34a9('0x2'));var Redis=require('ioredis');var db=require(_0x34a9('0x3'))['db'];var config=require(_0x34a9('0x4'));var logger=require(_0x34a9('0x5'))(_0x34a9('0x6'));config[_0x34a9('0x7')]=_[_0x34a9('0x8')](config[_0x34a9('0x7')],{'host':_0x34a9('0x9'),'port':0x18eb});var socket=require(_0x34a9('0xa'))(new Redis(config[_0x34a9('0x7')]));require(_0x34a9('0xb'))[_0x34a9('0xc')](socket);try{if(!process[_0x34a9('0xd')][0x2]||process[_0x34a9('0xd')][0x2]===_0x34a9('0xe')||process['argv'][0x2]===_0x34a9('0xf')){throw new Error(_0x34a9('0x10'));}var FILEPATH=process[_0x34a9('0xd')][0x2];if(!process['argv'][0x3]||process[_0x34a9('0xd')][0x3]===_0x34a9('0xe')||process[_0x34a9('0xd')][0x3]===_0x34a9('0xf')||!process[_0x34a9('0xd')][0x4]||process[_0x34a9('0xd')][0x4]==='undefined'||process['argv'][0x4]===_0x34a9('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x34a9('0x11')](process[_0x34a9('0xd')][0x3][_0x34a9('0x12')](','),process['argv'][0x4][_0x34a9('0x12')](','));if(!process[_0x34a9('0xd')][0x5]||process['argv'][0x5]===_0x34a9('0xe')||process[_0x34a9('0xd')][0x5]===_0x34a9('0xf')){throw new Error(_0x34a9('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x34a9('0xe')&&process[_0x34a9('0xd')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x34a9('0xd')][0x7]&&process['argv'][0x7]!==_0x34a9('0xe')&&process[_0x34a9('0xd')][0x7]!==_0x34a9('0xf')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0x34a9('0xe')||process[_0x34a9('0xd')][0x8]===_0x34a9('0xf')){throw new Error(_0x34a9('0x14'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0xbad78c){logger[_0x34a9('0x15')](_0xbad78c);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x10ada7,_0x2826a9,_0x3819f3,_0xa0c82){var _0x1b801f={'message':_0x2826a9};_0x1b801f[_0x10ada7]=!![];if(_0x3819f3){_0x1b801f[_0x34a9('0x16')]=_0x3819f3;}if(_0xa0c82){_0x1b801f['index']=_0xa0c82;}return _0x1b801f;}function isEmail(_0x9af5a2){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x9af5a2);}function checkRow(_0x1abf8d,_0x15c1d7,_0x341cf5){return new BPromise(function(_0x378d2d,_0x14bd0e){if(_[_0x34a9('0x17')](_0x1abf8d)){return _0x14bd0e(handleCheckRowError('error',_0x34a9('0x18'),null,_0x341cf5));}if(_0x1abf8d['errors']&&_0x1abf8d[_0x34a9('0x19')][_0x34a9('0x1a')]){var _0x23f0b4=_[_0x34a9('0x1b')](_0x1abf8d[_0x34a9('0x19')],'message')[_0x34a9('0x1c')](';');return _0x14bd0e(handleCheckRowError('error',_0x23f0b4,null,_0x341cf5));}var _0x4f0aca={};for(var _0x5e8465 in FIELDS){if(FIELDS[_0x34a9('0x1d')](_0x5e8465)&&FIELDS[_0x5e8465]){_0x4f0aca[_0x5e8465]=_0x1abf8d[_0x34a9('0x1e')][0x0][FIELDS[_0x5e8465]]||_0x1abf8d[_0x34a9('0x1e')][0x0]['\ufeff'+FIELDS[_0x5e8465]];}}if(!_0x4f0aca[_0x34a9('0x1f')]){return _0x14bd0e(handleCheckRowError(_0x34a9('0x15'),'firstName\x20not\x20specified!',null,_0x341cf5));}if(!_0x4f0aca[_0x34a9('0x20')]){return _0x14bd0e(handleCheckRowError(_0x34a9('0x15'),'phone\x20not\x20specified!',null,_0x341cf5));}if(_0x4f0aca['birthDate']){var _0x178772=moment(_0x4f0aca['birthDate'],_0x34a9('0x21'));if(!_0x178772[_0x34a9('0x22')]()){return _0x14bd0e(handleCheckRowError(_0x34a9('0x15'),_0x34a9('0x23'),null,_0x341cf5));}}if(_0x4f0aca[_0x34a9('0x24')]){if(!isEmail(_0x4f0aca[_0x34a9('0x24')])){return _0x14bd0e(handleCheckRowError(_0x34a9('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x341cf5));}}_0x4f0aca['ListId']=LISTID;_0x4f0aca['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x15c1d7){var _0x4e677f={};for(var _0x329594=0x0,_0x5f0722=DUPLICATES[_0x34a9('0x1a')];_0x329594<_0x5f0722;_0x329594+=0x1){_0x4e677f[DUPLICATES[_0x329594]]=_0x4f0aca[DUPLICATES[_0x329594]];}var _0x37d058=_[_0x34a9('0x25')](_0x15c1d7,_0x4e677f);if(_0x37d058){return _0x14bd0e(handleCheckRowError('duplicate',_0x34a9('0x26'),_0x37d058,_0x341cf5));}}return db[_0x34a9('0x27')][_0x34a9('0x28')](_0x4f0aca,{'raw':!![],'hooks':![],'fields':_[_0x34a9('0x29')](_0x4f0aca)})[_0x34a9('0x2a')](function(_0x2cb995){if(DUPLICATES&&DUPLICATES[_0x34a9('0x1a')]&&_0x15c1d7){_0x15c1d7[_0x34a9('0x2b')](_[_0x34a9('0x2c')](_0x4f0aca,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2cb995['id'];return _0x378d2d();})[_0x34a9('0x2d')](function(_0x274a7f){return _0x14bd0e(handleCheckRowError(_0x34a9('0x15'),_0x34a9('0x2e')+(_0x274a7f[_0x34a9('0x2f')]||JSON[_0x34a9('0x30')](_0x274a7f)),null,_0x341cf5));});});}function checkHopper(){function _0x23f98f(){return function(_0x57eb5c){logger[_0x34a9('0x15')]('cmContact',_0x34a9('0x31'),util[_0x34a9('0x32')](_0x57eb5c,{'showHidden':![],'depth':null}));};}var _0x1a95e1=function(_0xe11fdf,_0x434610){var _0x2f7958=squel[_0x34a9('0x33')]()['into'](_0x34a9('0x34'))[_0x34a9('0x35')]([_0x34a9('0x20'),_0x34a9('0x36'),_0x34a9('0x37'),'ListId',_0x434610,_0x34a9('0x38'),_0x34a9('0x39')],squel[_0x34a9('0x3a')]()['field'](_0x34a9('0x20'),_0x34a9('0x20'))[_0x34a9('0x3b')](_0x34a9('0x3c'),_0x34a9('0x36'))[_0x34a9('0x3b')]('id',_0x34a9('0x37'))[_0x34a9('0x3b')](LISTID[_0x34a9('0x3d')](),_0x34a9('0x3e'))['field'](_0xe11fdf['id'][_0x34a9('0x3d')](),_0x434610)[_0x34a9('0x3b')]('NOW()','createdAt')['field'](_0x34a9('0x3c'),_0x34a9('0x39'))[_0x34a9('0x3f')]('cm_contacts')[_0x34a9('0x40')](_0x34a9('0x41'))[_0x34a9('0x40')](_0x34a9('0x42'),LISTID[_0x34a9('0x3d')]())[_0x34a9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x34a9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x34a9('0x3b')](_0x34a9('0x20'))['from']('cm_hopper')[_0x34a9('0x40')](_0x434610+_0x34a9('0x43'),_0xe11fdf['id'][_0x34a9('0x3d')]())))['toString']();return _0x2f7958;};var _0x13e407=function(_0x512b06,_0x5e96a3){var _0xc4fe1b=squel[_0x34a9('0x33')]()[_0x34a9('0x44')](_0x34a9('0x34'))['fromQuery'](['phone',_0x34a9('0x36'),'ContactId',_0x34a9('0x3e'),_0x5e96a3,_0x34a9('0x38'),_0x34a9('0x39')],squel['select']()[_0x34a9('0x3b')](_0x34a9('0x20'),_0x34a9('0x20'))[_0x34a9('0x3b')]('NOW()',_0x34a9('0x36'))['field']('id',_0x34a9('0x37'))[_0x34a9('0x3b')](LISTID[_0x34a9('0x3d')](),_0x34a9('0x3e'))['field'](_0x512b06['id'][_0x34a9('0x3d')](),_0x5e96a3)[_0x34a9('0x3b')](_0x34a9('0x3c'),_0x34a9('0x38'))['field'](_0x34a9('0x3c'),_0x34a9('0x39'))['from']('cm_contacts')[_0x34a9('0x40')](_0x34a9('0x41'))['where'](_0x34a9('0x42'),LISTID[_0x34a9('0x3d')]())[_0x34a9('0x40')]('id\x20IN\x20?',squel[_0x34a9('0x45')](hopperContacts))[_0x34a9('0x40')](_0x34a9('0x46'))[_0x34a9('0x40')](_0x34a9('0x47'),squel[_0x34a9('0x3a')]()[_0x34a9('0x3b')](_0x34a9('0x48'))[_0x34a9('0x3f')](_0x34a9('0x49'))[_0x34a9('0x40')](_0x5e96a3+_0x34a9('0x43'),_0x512b06['id'][_0x34a9('0x3d')]()))[_0x34a9('0x40')](_0x34a9('0x47'),squel[_0x34a9('0x3a')]()[_0x34a9('0x3b')](_0x34a9('0x20'))[_0x34a9('0x3f')](_0x34a9('0x34'))[_0x34a9('0x40')](_0x5e96a3+_0x34a9('0x43'),_0x512b06['id'][_0x34a9('0x3d')]())))['toString']();return _0xc4fe1b;};function _0xaf661c(_0x121f54,_0x14b48c){var _0x3e2d6f=squel[_0x34a9('0x33')]()[_0x34a9('0x44')](_0x34a9('0x34'))['fromQuery']([_0x34a9('0x20'),'scheduledAt',_0x34a9('0x37'),_0x34a9('0x3e'),_0x14b48c,_0x34a9('0x38'),_0x34a9('0x39')],squel['select']()[_0x34a9('0x3b')]('phone',_0x34a9('0x20'))['field'](_0x34a9('0x3c'),_0x34a9('0x36'))[_0x34a9('0x3b')]('id',_0x34a9('0x37'))[_0x34a9('0x3b')](LISTID[_0x34a9('0x3d')](),_0x34a9('0x3e'))['field'](_0x121f54['id'][_0x34a9('0x3d')](),_0x14b48c)[_0x34a9('0x3b')](_0x34a9('0x3c'),_0x34a9('0x38'))[_0x34a9('0x3b')](_0x34a9('0x3c'),_0x34a9('0x39'))[_0x34a9('0x3f')](_0x34a9('0x4a'))['where'](_0x34a9('0x41'))['where'](_0x34a9('0x42'),LISTID[_0x34a9('0x3d')]())[_0x34a9('0x40')](_0x34a9('0x4b'),squel[_0x34a9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x3e2d6f;}function _0x323ab4(_0x4c6406,_0x3136d3){var _0x3d64d0=squel[_0x34a9('0x33')]()[_0x34a9('0x44')](_0x34a9('0x4c'))[_0x34a9('0x35')]([_0x34a9('0x20'),_0x34a9('0x37'),'ListId',_0x3136d3,'createdAt',_0x34a9('0x39')],squel[_0x34a9('0x3a')]()[_0x34a9('0x3b')](_0x34a9('0x20'),'phone')[_0x34a9('0x3b')]('id',_0x34a9('0x37'))[_0x34a9('0x3b')](LISTID[_0x34a9('0x3d')](),_0x34a9('0x3e'))['field'](_0x4c6406['id'][_0x34a9('0x3d')](),_0x3136d3)['field']('NOW()',_0x34a9('0x38'))['field'](_0x34a9('0x3c'),'updatedAt')['from'](_0x34a9('0x4a'))[_0x34a9('0x40')](_0x34a9('0x41'))[_0x34a9('0x40')](_0x34a9('0x42'),LISTID['toString']())['where'](_0x34a9('0x4b'),squel[_0x34a9('0x45')](hopperContacts))[_0x34a9('0x40')](_0x34a9('0x46')))[_0x34a9('0x3d')]();return _0x3d64d0;}return db[_0x34a9('0x4d')][_0x34a9('0x4e')]({'where':{'type':_0x34a9('0x4f')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x34a9('0x50')],'as':_0x34a9('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x52c3a9){var _0x5d7d7c=[];if(_0x52c3a9){var _0x4d92a7;for(var _0x29f927=0x0,_0x37a715;_0x29f927<_0x52c3a9['length'];_0x29f927+=0x1){_0x37a715=_0x52c3a9[_0x29f927]['get']({'plain':!![]});switch(_0x37a715[_0x34a9('0x52')]){case _0x34a9('0x53'):_0x5d7d7c[_0x34a9('0x2b')](db['sequelize'][_0x34a9('0x54')](_0x13e407(_0x37a715,_0x34a9('0x55')))[_0x34a9('0x2a')](function(){})[_0x34a9('0x2d')](_0x23f98f()));break;case'onlyIfOpen':_0x5d7d7c[_0x34a9('0x2b')](db['sequelize'][_0x34a9('0x54')](_0x1a95e1(_0x37a715,_0x34a9('0x55')))[_0x34a9('0x2a')](function(){})[_0x34a9('0x2d')](_0x23f98f()));break;default:_0x5d7d7c[_0x34a9('0x2b')](db[_0x34a9('0x56')][_0x34a9('0x54')](_0xaf661c(_0x37a715,_0x34a9('0x55')))['then'](function(){})['catch'](_0x23f98f()));}}}return _0x5d7d7c;})[_0x34a9('0x57')]()['then'](function(){return db[_0x34a9('0x4d')][_0x34a9('0x4e')]({'where':{'type':_0x34a9('0x4f')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x34a9('0x58'),'where':{'id':LISTID}}]})[_0x34a9('0x2a')](function(_0x43fe5b){var _0x3cf3a2=[];if(_0x43fe5b){var _0x501462;for(var _0x4dc50f=0x0,_0x3690bb;_0x4dc50f<_0x43fe5b[_0x34a9('0x1a')];_0x4dc50f+=0x1){_0x3690bb=_0x43fe5b[_0x4dc50f][_0x34a9('0x59')]({'plain':!![]});_0x3cf3a2['push'](db[_0x34a9('0x56')]['query'](_0x323ab4(_0x3690bb,_0x34a9('0x55')))[_0x34a9('0x2a')](function(){})[_0x34a9('0x2d')](_0x23f98f()));}}return _0x3cf3a2;})[_0x34a9('0x57')]();})[_0x34a9('0x2a')](function(){return db[_0x34a9('0x5a')]['findAll']({'attributes':['id',_0x34a9('0x52')],'include':[{'model':db['CmList'],'as':_0x34a9('0x51'),'where':{'id':LISTID}}]})[_0x34a9('0x2a')](function(_0x14dddd){var _0xb05e27=[];if(_0x14dddd){for(var _0x4f4473=0x0,_0x5a013c;_0x4f4473<_0x14dddd[_0x34a9('0x1a')];_0x4f4473+=0x1){_0x5a013c=_0x14dddd[_0x4f4473][_0x34a9('0x59')]({'plain':!![]});switch(_0x5a013c[_0x34a9('0x52')]){case _0x34a9('0x53'):_0xb05e27['push'](db[_0x34a9('0x56')][_0x34a9('0x54')](_0x13e407(_0x5a013c,'CampaignId'))[_0x34a9('0x2a')](function(){})[_0x34a9('0x2d')](_0x23f98f()));break;case'onlyIfOpen':_0xb05e27[_0x34a9('0x2b')](db[_0x34a9('0x56')][_0x34a9('0x54')](_0x1a95e1(_0x5a013c,_0x34a9('0x5b')))[_0x34a9('0x2a')](function(){})[_0x34a9('0x2d')](_0x23f98f()));break;default:_0xb05e27[_0x34a9('0x2b')](db[_0x34a9('0x56')]['query'](_0xaf661c(_0x5a013c,_0x34a9('0x5b')))[_0x34a9('0x2a')](function(){})[_0x34a9('0x2d')](_0x23f98f()));}}}return _0xb05e27;})[_0x34a9('0x57')]();})[_0x34a9('0x2a')](function(){return db[_0x34a9('0x5a')][_0x34a9('0x4e')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x34a9('0x2a')](function(_0x5b19e1){var _0x1856c9=[];if(_0x5b19e1){for(var _0x5a5b73=0x0,_0x3b891a;_0x5a5b73<_0x5b19e1[_0x34a9('0x1a')];_0x5a5b73+=0x1){_0x3b891a=_0x5b19e1[_0x5a5b73][_0x34a9('0x59')]({'plain':!![]});_0x1856c9[_0x34a9('0x2b')](db['sequelize'][_0x34a9('0x54')](_0x323ab4(_0x3b891a,'CampaignId'))[_0x34a9('0x2a')](function(){})[_0x34a9('0x2d')](_0x23f98f()));}}return _0x1856c9;})[_0x34a9('0x57')]();})[_0x34a9('0x2d')](function(_0xc3fe0c){logger['error']('cmContact,\x20%s,\x20%s',_0x34a9('0x5c'),_0xc3fe0c[_0x34a9('0x2f')]);});}var processPromises=function(_0x214219){return BPromise[_0x34a9('0x57')](promises)[_0x34a9('0x2a')](function(_0x1d9d2a){})[_0x34a9('0x2d')](function(_0x3625f2){logger[_0x34a9('0x15')](_0x34a9('0x5d'),JSON[_0x34a9('0x30')](_0x3625f2));})[_0x34a9('0x5e')](function(){socket['emit'](_0x34a9('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x214219){return _0x214219['resume']();}});};var endCsv=function(){return BPromise[_0x34a9('0x60')]()[_0x34a9('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x34a9('0x2a')](function(){socket[_0x34a9('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x34a9('0x62')](FILEPATH);}catch(_0x43ba60){logger[_0x34a9('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x34a9('0x30')](_0x43ba60));}finally{process[_0x34a9('0x63')](0x0);}});};process['on'](_0x34a9('0x64'),function(){logger[_0x34a9('0x65')](_0x34a9('0x66'));endCsv();});function main(){return BPromise[_0x34a9('0x60')]()[_0x34a9('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x34a9('0x12')](',');return db['CmContact'][_0x34a9('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x580489){var _0x4ae007=fs[_0x34a9('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x4ae007,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4706ff,_0xa4fe3){total+=0x1;var _0x139b7c=total;promises['push'](checkRow(_0x4706ff,_0x580489,_0x139b7c)[_0x34a9('0x2a')](function(){success+=0x1;})[_0x34a9('0x2d')](function(_0x5b1b2c){if(_0x5b1b2c[_0x34a9('0x15')]){errors+=0x1;delete _0x5b1b2c['error'];}else if(_0x5b1b2c[_0x34a9('0x68')]){duplicates+=0x1;delete _0x5b1b2c['duplicate'];}rows[_0x34a9('0x2b')](_0x5b1b2c);}));if(total%0xc8===0x0){_0xa4fe3[_0x34a9('0x69')]();return processPromises(_0xa4fe3);}},'complete':function(){return processPromises()[_0x34a9('0x2a')](function(){logger[_0x34a9('0x65')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x27eaaf,_0x18f413){logger[_0x34a9('0x65')](_0x34a9('0x6a'),JSON[_0x34a9('0x30')](_0x27eaaf));endCsv();}});})[_0x34a9('0x2d')](function(_0x2f134c){logger[_0x34a9('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x34a9('0x30')](_0x2f134c));});}main(); \ No newline at end of file +var _0x3723=['ContactId','createdAt','updatedAt','select','field','scheduledAt','toString','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','insert','into','fromQuery','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','then','get','always','sequelize','VoiceQueueId','query','all','BlackLists','CampaignId','onlyIfOpen','CmList','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','emit','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','cm_hopper'];(function(_0x28e2cd,_0x153b42){var _0x11fd46=function(_0x50df13){while(--_0x50df13){_0x28e2cd['push'](_0x28e2cd['shift']());}};_0x11fd46(++_0x153b42);}(_0x3723,0xa6));var _0x3372=function(_0x548a81,_0x37b227){_0x548a81=_0x548a81-0x0;var _0x34f8e9=_0x3723[_0x548a81];return _0x34f8e9;};'use strict';var BPromise=require(_0x3372('0x0'));var util=require(_0x3372('0x1'));var _=require(_0x3372('0x2'));var fs=require('fs');var squel=require(_0x3372('0x3'));var Papa=require(_0x3372('0x4'));var Redis=require(_0x3372('0x5'));var db=require(_0x3372('0x6'))['db'];var config=require(_0x3372('0x7'));var logger=require(_0x3372('0x8'))(_0x3372('0x9'));config[_0x3372('0xa')]=_[_0x3372('0xb')](config[_0x3372('0xa')],{'host':_0x3372('0xc'),'port':0x18eb});var socket=require(_0x3372('0xd'))(new Redis(config[_0x3372('0xa')]));require(_0x3372('0xe'))[_0x3372('0xf')](socket);try{if(!process[_0x3372('0x10')][0x2]||process[_0x3372('0x10')][0x2]===_0x3372('0x11')||process[_0x3372('0x10')][0x2]===_0x3372('0x12')){throw new Error(_0x3372('0x13'));}var FILEPATH=process[_0x3372('0x10')][0x2];if(!process['argv'][0x3]||process[_0x3372('0x10')][0x3]===_0x3372('0x11')||process[_0x3372('0x10')][0x3]===_0x3372('0x12')||!process['argv'][0x4]||process[_0x3372('0x10')][0x4]===_0x3372('0x11')||process[_0x3372('0x10')][0x4]===_0x3372('0x12')){throw new Error(_0x3372('0x14'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0x3372('0x15')](','),process[_0x3372('0x10')][0x4][_0x3372('0x15')](','));if(!process[_0x3372('0x10')][0x5]||process[_0x3372('0x10')][0x5]===_0x3372('0x11')||process[_0x3372('0x10')][0x5]===_0x3372('0x12')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x3372('0x10')][0x5];var COMPANYID=process[_0x3372('0x10')][0x6]&&process[_0x3372('0x10')][0x6]!==_0x3372('0x11')&&process[_0x3372('0x10')][0x6]!==_0x3372('0x12')?process[_0x3372('0x10')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x3372('0x10')][0x7]!==_0x3372('0x11')&&process[_0x3372('0x10')][0x7]!==_0x3372('0x12')?process['argv'][0x7]:null;if(!process[_0x3372('0x10')][0x8]||process[_0x3372('0x10')][0x8]===_0x3372('0x11')||process[_0x3372('0x10')][0x8]===_0x3372('0x12')){throw new Error(_0x3372('0x16'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x1678fb){logger[_0x3372('0x17')](_0x1678fb);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x5a1f8c,_0x1bfe93,_0x4eff19,_0x57a82a){var _0x265a8e={'message':_0x1bfe93};_0x265a8e[_0x5a1f8c]=!![];if(_0x4eff19){_0x265a8e[_0x3372('0x18')]=_0x4eff19;}if(_0x57a82a){_0x265a8e[_0x3372('0x19')]=_0x57a82a;}return _0x265a8e;}function isEmail(_0x75642e){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x3372('0x1a')](_0x75642e);}function checkRow(_0x43daf6,_0xac4f44,_0x482f12){return new BPromise(function(_0x3a457d,_0x5d4856){if(_['isNil'](_0x43daf6)){return _0x5d4856(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x482f12));}if(_0x43daf6[_0x3372('0x1b')]&&_0x43daf6[_0x3372('0x1b')][_0x3372('0x1c')]){var _0x1c6170=_[_0x3372('0x1d')](_0x43daf6[_0x3372('0x1b')],_0x3372('0x1e'))[_0x3372('0x1f')](';');return _0x5d4856(handleCheckRowError(_0x3372('0x17'),_0x1c6170,null,_0x482f12));}var _0x28c6b5={};for(var _0x97970b in FIELDS){if(FIELDS[_0x3372('0x20')](_0x97970b)&&FIELDS[_0x97970b]){_0x28c6b5[_0x97970b]=_0x43daf6[_0x3372('0x21')][0x0][FIELDS[_0x97970b]]||_0x43daf6['data'][0x0]['\ufeff'+FIELDS[_0x97970b]];}}if(!_0x28c6b5[_0x3372('0x22')]){return _0x5d4856(handleCheckRowError('error',_0x3372('0x23'),null,_0x482f12));}if(!_0x28c6b5[_0x3372('0x24')]){return _0x5d4856(handleCheckRowError(_0x3372('0x17'),_0x3372('0x25'),null,_0x482f12));}if(_0x28c6b5[_0x3372('0x26')]){var _0x18e6f7=moment(_0x28c6b5['birthDate'],_0x3372('0x27'));if(!_0x18e6f7[_0x3372('0x28')]()){return _0x5d4856(handleCheckRowError(_0x3372('0x17'),_0x3372('0x29'),null,_0x482f12));}}if(_0x28c6b5[_0x3372('0x2a')]){if(!isEmail(_0x28c6b5[_0x3372('0x2a')])){return _0x5d4856(handleCheckRowError(_0x3372('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0x482f12));}}_0x28c6b5[_0x3372('0x2b')]=LISTID;_0x28c6b5[_0x3372('0x2c')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0xac4f44){var _0x324f97={};for(var _0x3cb011=0x0,_0x2007dc=DUPLICATES['length'];_0x3cb011<_0x2007dc;_0x3cb011+=0x1){_0x324f97[DUPLICATES[_0x3cb011]]=_0x28c6b5[DUPLICATES[_0x3cb011]];}var _0x2d453e=_[_0x3372('0x2d')](_0xac4f44,_0x324f97);if(_0x2d453e){return _0x5d4856(handleCheckRowError(_0x3372('0x2e'),_0x3372('0x2f'),_0x2d453e,_0x482f12));}}return db[_0x3372('0x30')][_0x3372('0x31')](_0x28c6b5,{'raw':!![],'hooks':![],'fields':_['keys'](_0x28c6b5)})['then'](function(_0x51cec9){if(DUPLICATES&&DUPLICATES['length']&&_0xac4f44){_0xac4f44[_0x3372('0x32')](_[_0x3372('0x33')](_0x28c6b5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x51cec9['id'];return _0x3a457d();})[_0x3372('0x34')](function(_0x55ad5c){return _0x5d4856(handleCheckRowError(_0x3372('0x17'),_0x3372('0x35')+(_0x55ad5c[_0x3372('0x1e')]||JSON['stringify'](_0x55ad5c)),null,_0x482f12));});});}function checkHopper(){function _0x4bd2f5(){return function(_0x5c2e6e){logger[_0x3372('0x17')](_0x3372('0x36'),_0x3372('0x37'),util[_0x3372('0x38')](_0x5c2e6e,{'showHidden':![],'depth':null}));};}var _0x54e05c=function(_0x5f11da,_0x20ae47){var _0x5e5bc3=squel['insert']()['into'](_0x3372('0x39'))['fromQuery']([_0x3372('0x24'),'scheduledAt',_0x3372('0x3a'),_0x3372('0x2b'),_0x20ae47,_0x3372('0x3b'),_0x3372('0x3c')],squel[_0x3372('0x3d')]()[_0x3372('0x3e')](_0x3372('0x24'),_0x3372('0x24'))[_0x3372('0x3e')]('NOW()',_0x3372('0x3f'))['field']('id',_0x3372('0x3a'))[_0x3372('0x3e')](LISTID['toString'](),_0x3372('0x2b'))[_0x3372('0x3e')](_0x5f11da['id'][_0x3372('0x40')](),_0x20ae47)[_0x3372('0x3e')](_0x3372('0x41'),'createdAt')[_0x3372('0x3e')](_0x3372('0x41'),'updatedAt')['from'](_0x3372('0x42'))[_0x3372('0x43')](_0x3372('0x44'))[_0x3372('0x43')](_0x3372('0x45'),LISTID['toString']())['where'](_0x3372('0x46'))[_0x3372('0x43')](_0x3372('0x47'),squel[_0x3372('0x3d')]()[_0x3372('0x3e')](_0x3372('0x24'))[_0x3372('0x48')](_0x3372('0x39'))[_0x3372('0x43')](_0x20ae47+_0x3372('0x49'),_0x5f11da['id']['toString']())))[_0x3372('0x40')]();return _0x5e5bc3;};var _0x23fd98=function(_0x1b1d8f,_0x35d7ef){var _0x3524f0=squel[_0x3372('0x4a')]()[_0x3372('0x4b')](_0x3372('0x39'))[_0x3372('0x4c')]([_0x3372('0x24'),_0x3372('0x3f'),_0x3372('0x3a'),_0x3372('0x2b'),_0x35d7ef,_0x3372('0x3b'),_0x3372('0x3c')],squel['select']()[_0x3372('0x3e')](_0x3372('0x24'),'phone')['field'](_0x3372('0x41'),_0x3372('0x3f'))[_0x3372('0x3e')]('id',_0x3372('0x3a'))['field'](LISTID['toString'](),_0x3372('0x2b'))[_0x3372('0x3e')](_0x1b1d8f['id'][_0x3372('0x40')](),_0x35d7ef)[_0x3372('0x3e')](_0x3372('0x41'),'createdAt')[_0x3372('0x3e')](_0x3372('0x41'),_0x3372('0x3c'))[_0x3372('0x48')](_0x3372('0x42'))['where'](_0x3372('0x44'))[_0x3372('0x43')](_0x3372('0x45'),LISTID[_0x3372('0x40')]())[_0x3372('0x43')](_0x3372('0x4d'),squel[_0x3372('0x4e')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0x3372('0x43')](_0x3372('0x47'),squel['select']()[_0x3372('0x3e')]('calleridnum')['from']('cm_hopper_final')[_0x3372('0x43')](_0x35d7ef+'\x20=\x20?',_0x1b1d8f['id'][_0x3372('0x40')]()))[_0x3372('0x43')](_0x3372('0x47'),squel['select']()[_0x3372('0x3e')]('phone')[_0x3372('0x48')](_0x3372('0x39'))[_0x3372('0x43')](_0x35d7ef+_0x3372('0x49'),_0x1b1d8f['id'][_0x3372('0x40')]())))[_0x3372('0x40')]();return _0x3524f0;};function _0x4663e4(_0x1a6959,_0x44a402){var _0x11b75b=squel[_0x3372('0x4a')]()['into'](_0x3372('0x39'))[_0x3372('0x4c')]([_0x3372('0x24'),_0x3372('0x3f'),_0x3372('0x3a'),_0x3372('0x2b'),_0x44a402,_0x3372('0x3b'),'updatedAt'],squel['select']()[_0x3372('0x3e')]('phone',_0x3372('0x24'))[_0x3372('0x3e')]('NOW()',_0x3372('0x3f'))['field']('id',_0x3372('0x3a'))[_0x3372('0x3e')](LISTID[_0x3372('0x40')](),_0x3372('0x2b'))['field'](_0x1a6959['id'][_0x3372('0x40')](),_0x44a402)['field'](_0x3372('0x41'),_0x3372('0x3b'))[_0x3372('0x3e')](_0x3372('0x41'),_0x3372('0x3c'))[_0x3372('0x48')](_0x3372('0x42'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x3372('0x45'),LISTID[_0x3372('0x40')]())[_0x3372('0x43')](_0x3372('0x4d'),squel[_0x3372('0x4e')](hopperContacts))[_0x3372('0x43')](_0x3372('0x46')))[_0x3372('0x40')]();return _0x11b75b;}function _0xa41a63(_0x1a9ba7,_0x30f127){var _0x4f0e8c=squel[_0x3372('0x4a')]()[_0x3372('0x4b')](_0x3372('0x4f'))[_0x3372('0x4c')]([_0x3372('0x24'),'ContactId',_0x3372('0x2b'),_0x30f127,_0x3372('0x3b'),_0x3372('0x3c')],squel[_0x3372('0x3d')]()[_0x3372('0x3e')](_0x3372('0x24'),_0x3372('0x24'))[_0x3372('0x3e')]('id',_0x3372('0x3a'))[_0x3372('0x3e')](LISTID[_0x3372('0x40')](),'ListId')['field'](_0x1a9ba7['id']['toString'](),_0x30f127)['field']('NOW()',_0x3372('0x3b'))[_0x3372('0x3e')]('NOW()',_0x3372('0x3c'))['from']('cm_contacts')['where'](_0x3372('0x44'))[_0x3372('0x43')](_0x3372('0x45'),LISTID[_0x3372('0x40')]())[_0x3372('0x43')](_0x3372('0x4d'),squel['str'](hopperContacts))[_0x3372('0x43')](_0x3372('0x46')))[_0x3372('0x40')]();return _0x4f0e8c;}return db[_0x3372('0x50')][_0x3372('0x51')]({'where':{'type':_0x3372('0x52')},'attributes':['id',_0x3372('0x53')],'include':[{'model':db['CmList'],'as':_0x3372('0x54'),'where':{'id':LISTID}}]})[_0x3372('0x55')](function(_0x62b9ad){var _0xd16a50=[];if(_0x62b9ad){var _0x350bf7;for(var _0x5387a2=0x0,_0x5b4517;_0x5387a2<_0x62b9ad[_0x3372('0x1c')];_0x5387a2+=0x1){_0x5b4517=_0x62b9ad[_0x5387a2][_0x3372('0x56')]({'plain':!![]});switch(_0x5b4517[_0x3372('0x53')]){case _0x3372('0x57'):_0xd16a50[_0x3372('0x32')](db[_0x3372('0x58')]['query'](_0x23fd98(_0x5b4517,_0x3372('0x59')))[_0x3372('0x55')](function(){})['catch'](_0x4bd2f5()));break;case'onlyIfOpen':_0xd16a50['push'](db[_0x3372('0x58')][_0x3372('0x5a')](_0x54e05c(_0x5b4517,_0x3372('0x59')))['then'](function(){})[_0x3372('0x34')](_0x4bd2f5()));break;default:_0xd16a50[_0x3372('0x32')](db[_0x3372('0x58')]['query'](_0x4663e4(_0x5b4517,_0x3372('0x59')))[_0x3372('0x55')](function(){})[_0x3372('0x34')](_0x4bd2f5()));}}}return _0xd16a50;})[_0x3372('0x5b')]()['then'](function(){return db[_0x3372('0x50')][_0x3372('0x51')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x3372('0x5c'),'where':{'id':LISTID}}]})[_0x3372('0x55')](function(_0x13d7e9){var _0x355629=[];if(_0x13d7e9){var _0x331736;for(var _0x39f2a5=0x0,_0x265379;_0x39f2a5<_0x13d7e9[_0x3372('0x1c')];_0x39f2a5+=0x1){_0x265379=_0x13d7e9[_0x39f2a5][_0x3372('0x56')]({'plain':!![]});_0x355629[_0x3372('0x32')](db['sequelize'][_0x3372('0x5a')](_0xa41a63(_0x265379,_0x3372('0x59')))[_0x3372('0x55')](function(){})['catch'](_0x4bd2f5()));}}return _0x355629;})[_0x3372('0x5b')]();})[_0x3372('0x55')](function(){return db['Campaign'][_0x3372('0x51')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x3372('0x54'),'where':{'id':LISTID}}]})[_0x3372('0x55')](function(_0x430f7e){var _0x4ef6f7=[];if(_0x430f7e){for(var _0x3c326c=0x0,_0x1918f8;_0x3c326c<_0x430f7e[_0x3372('0x1c')];_0x3c326c+=0x1){_0x1918f8=_0x430f7e[_0x3c326c][_0x3372('0x56')]({'plain':!![]});switch(_0x1918f8[_0x3372('0x53')]){case'always':_0x4ef6f7[_0x3372('0x32')](db[_0x3372('0x58')]['query'](_0x23fd98(_0x1918f8,_0x3372('0x5d')))['then'](function(){})['catch'](_0x4bd2f5()));break;case _0x3372('0x5e'):_0x4ef6f7['push'](db[_0x3372('0x58')][_0x3372('0x5a')](_0x54e05c(_0x1918f8,_0x3372('0x5d')))['then'](function(){})[_0x3372('0x34')](_0x4bd2f5()));break;default:_0x4ef6f7[_0x3372('0x32')](db[_0x3372('0x58')][_0x3372('0x5a')](_0x4663e4(_0x1918f8,'CampaignId'))['then'](function(){})[_0x3372('0x34')](_0x4bd2f5()));}}}return _0x4ef6f7;})[_0x3372('0x5b')]();})[_0x3372('0x55')](function(){return db['Campaign'][_0x3372('0x51')]({'attributes':['id'],'include':[{'model':db[_0x3372('0x5f')],'as':_0x3372('0x5c'),'where':{'id':LISTID}}]})[_0x3372('0x55')](function(_0x4493f3){var _0x156b2f=[];if(_0x4493f3){for(var _0x1817e4=0x0,_0x5c96f3;_0x1817e4<_0x4493f3[_0x3372('0x1c')];_0x1817e4+=0x1){_0x5c96f3=_0x4493f3[_0x1817e4][_0x3372('0x56')]({'plain':!![]});_0x156b2f[_0x3372('0x32')](db['sequelize'][_0x3372('0x5a')](_0xa41a63(_0x5c96f3,_0x3372('0x5d')))['then'](function(){})[_0x3372('0x34')](_0x4bd2f5()));}}return _0x156b2f;})[_0x3372('0x5b')]();})[_0x3372('0x34')](function(_0x2e6024){logger[_0x3372('0x17')](_0x3372('0x60'),'generalCheckHopper',_0x2e6024[_0x3372('0x1e')]);});}var processPromises=function(_0xa34d32){return BPromise[_0x3372('0x5b')](promises)['then'](function(_0x5003aa){})[_0x3372('0x34')](function(_0x4599d3){logger[_0x3372('0x17')](_0x3372('0x61'),JSON[_0x3372('0x62')](_0x4599d3));})[_0x3372('0x63')](function(){socket['emit'](_0x3372('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xa34d32){return _0xa34d32['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x3372('0x55')](function(){socket[_0x3372('0x65')](_0x3372('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x283801){logger[_0x3372('0x17')](_0x3372('0x66'),JSON[_0x3372('0x62')](_0x283801));}finally{process['exit'](0x0);}});};process['on'](_0x3372('0x67'),function(){logger[_0x3372('0x68')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x3372('0x69')]()[_0x3372('0x55')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3372('0x30')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3372('0x55')](function(_0x472d00){var _0x484c37=fs[_0x3372('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3372('0x6b')](_0x484c37,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1c03a9,_0x311db8){total+=0x1;var _0x2296d9=total;promises['push'](checkRow(_0x1c03a9,_0x472d00,_0x2296d9)['then'](function(){success+=0x1;})[_0x3372('0x34')](function(_0x510def){if(_0x510def['error']){errors+=0x1;delete _0x510def[_0x3372('0x17')];}else if(_0x510def[_0x3372('0x2e')]){duplicates+=0x1;delete _0x510def[_0x3372('0x2e')];}rows[_0x3372('0x32')](_0x510def);}));if(total%0xc8===0x0){_0x311db8[_0x3372('0x6c')]();return processPromises(_0x311db8);}},'complete':function(){return processPromises()[_0x3372('0x55')](function(){logger[_0x3372('0x68')](_0x3372('0x6d'));endCsv();});},'error':function(_0x119069,_0x420fe7){logger[_0x3372('0x68')](_0x3372('0x6e'),JSON['stringify'](_0x119069));endCsv();}});})[_0x3372('0x34')](function(_0x44f253){logger['error'](_0x3372('0x6f'),JSON[_0x3372('0x62')](_0x44f253));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 04ffc7c..13ef3eb 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7d8=['phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','cm_contacts.ListId','insert','cm_hopper_black','select','\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','cm_contacts.UserId','UserId','\x22always\x22','concat','keys','CompanyId','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','Received\x20SIGINT','error','message','code','info','sequelize','query','spread','push','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','offset','main','start','binding','root','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','createReadStream','data','rows','errors','hasOwnProperty','replace','isNaN','isNumber','agent\x20not\x20exists','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','SystemRow','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','each','format','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','field'];(function(_0x4e0a1e,_0x2a8f65){var _0x245c2e=function(_0x4cbd8a){while(--_0x4cbd8a){_0x4e0a1e['push'](_0x4e0a1e['shift']());}};_0x245c2e(++_0x2a8f65);}(_0xf7d8,0x1b5));var _0x8f7d=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0xf7d8[_0x3ec1da];return _0x472358;};'use strict';var fs=require('fs');var path=require(_0x8f7d('0x0'));var _=require(_0x8f7d('0x1'));var Papa=require(_0x8f7d('0x2'));var util=require(_0x8f7d('0x3'));var BPromise=require(_0x8f7d('0x4'));var moment=require(_0x8f7d('0x5'));var squel=require('squel');var Redis=require(_0x8f7d('0x6'));var db=require(_0x8f7d('0x7'))['db'];var config=require(_0x8f7d('0x8'));var shared=require(_0x8f7d('0x9'));var logger=require(_0x8f7d('0xa'))('import');config[_0x8f7d('0xb')]=_[_0x8f7d('0xc')](config['redis'],{'host':_0x8f7d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x8f7d('0xe'));function isEmail(_0x3f1840){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x3f1840);}function selectNotIn(_0x3211ae,_0x2c1d2d,_0x361a52,_0x46e77d,_0x358e2e){return squel['select']()[_0x8f7d('0xf')](_0x8f7d('0x10'))[_0x8f7d('0x11')](_0x46e77d)[_0x8f7d('0x12')](_0x2c1d2d,null,_0x2c1d2d+_0x8f7d('0x13')+_0x46e77d+'.'+_0x361a52)['where'](_0x46e77d+'.'+_0x361a52+_0x8f7d('0x14')+_0x3211ae+'.'+_0x361a52)[_0x8f7d('0x15')](_0x2c1d2d+_0x8f7d('0x16')+_0x358e2e[_0x8f7d('0x12')]()+')');}function insertCmHopper(_0x156bc0,_0x4d6d73,_0x164604,_0x388577,_0x195ca4){var _0x3105a4=[_0x8f7d('0x17'),_0x8f7d('0x18'),_0x8f7d('0x19'),'cm_contacts.ListId',_0x4d6d73+'.'+_0x388577,_0x8f7d('0x1a'),_0x8f7d('0x1b'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x195ca4+'\x22'];return squel['insert']()[_0x8f7d('0x1c')](_0x8f7d('0x1d'))[_0x8f7d('0x1e')]([_0x8f7d('0x10'),_0x8f7d('0x1f'),_0x8f7d('0x20'),_0x8f7d('0x21'),_0x388577,_0x8f7d('0x22'),_0x8f7d('0x23'),_0x8f7d('0x24'),'UserId',_0x8f7d('0x25')],squel['select']()[_0x8f7d('0x26')](_0x3105a4)['from'](_0x4d6d73)[_0x8f7d('0x12')](_0x8f7d('0x27'),null,_0x8f7d('0x28')+_0x4d6d73+_0x8f7d('0x29'))[_0x8f7d('0x12')](_0x164604,null,_0x164604+'.id\x20=\x20'+_0x4d6d73+'.'+_0x388577)[_0x8f7d('0x15')](_0x4d6d73+_0x8f7d('0x2a'),_0x156bc0)[_0x8f7d('0x15')](_0x8f7d('0x2b'),NOW)['where'](_0x8f7d('0x2c'),selectNotIn(_0x4d6d73,_0x164604,_0x388577,_0x8f7d('0x1d'),['\x22always\x22',_0x8f7d('0x2d')]))[_0x8f7d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4d6d73,_0x164604,_0x388577,_0x8f7d('0x1d'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0xc02882,_0x3a4c52,_0x27a65b,_0x415ba4){var _0x3ae64b=[_0x8f7d('0x17'),_0x8f7d('0x19'),_0x8f7d('0x2e'),_0x3a4c52+'.'+_0x415ba4,_0x8f7d('0x1a'),_0x8f7d('0x1b')];return squel[_0x8f7d('0x2f')]()[_0x8f7d('0x1c')](_0x8f7d('0x30'))[_0x8f7d('0x1e')]([_0x8f7d('0x10'),_0x8f7d('0x20'),'ListId',_0x415ba4,'createdAt',_0x8f7d('0x23')],squel[_0x8f7d('0x31')]()[_0x8f7d('0x26')](_0x3ae64b)[_0x8f7d('0x11')](_0x3a4c52)[_0x8f7d('0x12')](_0x8f7d('0x27'),null,_0x8f7d('0x28')+_0x3a4c52+_0x8f7d('0x29'))[_0x8f7d('0x12')](_0x27a65b,null,_0x27a65b+_0x8f7d('0x13')+_0x3a4c52+'.'+_0x415ba4)[_0x8f7d('0x15')](_0x3a4c52+_0x8f7d('0x2a'),_0xc02882)[_0x8f7d('0x15')](_0x8f7d('0x2b'),NOW)[_0x8f7d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x8f7d('0x31')]()[_0x8f7d('0xf')](_0x8f7d('0x10'))['from']('cm_hopper_black')[_0x8f7d('0x15')]('ListId\x20=\x20?',_0xc02882)[_0x8f7d('0x15')](_0x415ba4+_0x8f7d('0x32'),_0x3a4c52+'.'+_0x415ba4)))[_0x8f7d('0x33')]();}function insertTzCmHopper(_0x23cc4c,_0x2edcad,_0x285e39,_0x4e05b8,_0x3339b6,_0x325b1a){var _0x563325=[_0x8f7d('0x17'),_0x8f7d('0x34')+_0x325b1a+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id',_0x8f7d('0x2e'),_0x2edcad+'.'+_0x4e05b8,_0x8f7d('0x1a'),_0x8f7d('0x1b'),_0x8f7d('0x35'),_0x8f7d('0x36'),'\x22'+_0x3339b6+'\x22'];var _0x376ba7=squel[_0x8f7d('0x2f')]()['into'](_0x8f7d('0x1d'))[_0x8f7d('0x1e')]([_0x8f7d('0x10'),'scheduledat',_0x8f7d('0x20'),_0x8f7d('0x21'),_0x4e05b8,_0x8f7d('0x22'),'updatedAt',_0x8f7d('0x24'),_0x8f7d('0x37'),_0x8f7d('0x25')],squel[_0x8f7d('0x31')]()[_0x8f7d('0x26')](_0x563325)[_0x8f7d('0x11')](_0x2edcad)['join'](_0x8f7d('0x27'),null,'cm_contacts.ListId\x20=\x20'+_0x2edcad+_0x8f7d('0x29'))[_0x8f7d('0x12')](_0x285e39,null,_0x285e39+_0x8f7d('0x13')+_0x2edcad+'.'+_0x4e05b8)[_0x8f7d('0x12')](_0x325b1a,null,_0x325b1a+_0x8f7d('0x13')+_0x2edcad+'.'+_0x4e05b8)['where'](_0x2edcad+_0x8f7d('0x2a'),_0x23cc4c)[_0x8f7d('0x15')](_0x8f7d('0x2b'),NOW)[_0x8f7d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2edcad,_0x285e39,_0x4e05b8,_0x8f7d('0x1d'),[_0x8f7d('0x38'),'\x22onlyIfOpen\x22']))[_0x8f7d('0x15')](_0x8f7d('0x2c'),selectNotIn(_0x2edcad,_0x285e39,_0x4e05b8,_0x8f7d('0x1d'),[_0x8f7d('0x38')])))[_0x8f7d('0x33')]();return _0x376ba7;}function insertTzCmHopperBlack(_0x30c71a,_0x189cc8,_0x291bfa,_0x16d055){var _0x2b79c3=[_0x8f7d('0x17'),_0x8f7d('0x19'),_0x8f7d('0x2e'),_0x189cc8+'.'+_0x16d055,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x8f7d('0x2f')]()[_0x8f7d('0x1c')](_0x8f7d('0x30'))['fromQuery'](['phone',_0x8f7d('0x20'),_0x8f7d('0x21'),_0x16d055,_0x8f7d('0x22'),_0x8f7d('0x23')],squel[_0x8f7d('0x31')]()['fields'](_0x2b79c3)[_0x8f7d('0x11')](_0x189cc8)[_0x8f7d('0x12')](_0x8f7d('0x27'),null,'cm_contacts.ListId\x20=\x20'+_0x189cc8+_0x8f7d('0x29'))[_0x8f7d('0x12')](_0x291bfa,null,_0x291bfa+_0x8f7d('0x13')+_0x189cc8+'.'+_0x16d055)[_0x8f7d('0x15')](_0x189cc8+_0x8f7d('0x2a'),_0x30c71a)[_0x8f7d('0x15')](_0x8f7d('0x2b'),NOW)['where'](_0x8f7d('0x2c'),squel[_0x8f7d('0x31')]()['field'](_0x8f7d('0x10'))[_0x8f7d('0x11')]('cm_hopper_black')[_0x8f7d('0x15')]('ListId\x20=\x20?',_0x30c71a)[_0x8f7d('0x15')](_0x16d055+_0x8f7d('0x32'),_0x189cc8+'.'+_0x16d055)))[_0x8f7d('0x33')]();}function insertCmContact(_0x14f77b,_0x198cfb,_0x5d1a08,_0x5eeccb){var _0x50bcf2=_[_0x8f7d('0x39')](_[_0x8f7d('0x3a')](_0x5eeccb),[_0x8f7d('0x21'),_0x8f7d('0x3b'),_0x8f7d('0x22'),_0x8f7d('0x23')]);return squel[_0x8f7d('0x2f')]()['into'](_0x8f7d('0x27'))[_0x8f7d('0x1e')](_0x50bcf2,squel[_0x8f7d('0x31')]()['fields'](_0x50bcf2)['from'](_0x198cfb)[_0x8f7d('0x15')]('('+_0x5d1a08[_0x8f7d('0x12')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x8f7d('0x26')](_0x5d1a08)[_0x8f7d('0x11')]('cm_contacts')[_0x8f7d('0x15')](_0x8f7d('0x3c'),_0x14f77b)[_0x8f7d('0x15')](_0x8f7d('0x3d')))[_0x8f7d('0x15')]('id\x20IN\x20?',squel[_0x8f7d('0x31')]()['field'](_0x8f7d('0x3e'),_0x8f7d('0x3f'))['from'](_0x198cfb)['group'](_0x5d1a08[_0x8f7d('0x12')](','))))[_0x8f7d('0x33')]();}function handleStop(){logger['info'](_0x8f7d('0x40'));stopped=!![];}function handleUncaughtException(_0x4bd276){logger[_0x8f7d('0x41')](_0x4bd276[_0x8f7d('0x42')]);process['exit'](0x1);}function handleError(_0x381697,_0x2ca475){stats['errors']['push']({'name':_0x2ca475[_0x8f7d('0x43')],'message':_0x2ca475[_0x8f7d('0x42')],'row':_0x381697});}function handleQuery(_0x598d24){logger[_0x8f7d('0x44')](_0x598d24);return db[_0x8f7d('0x45')][_0x8f7d('0x46')](_0x598d24)[_0x8f7d('0x47')](function(_0x1a1252){results[_0x8f7d('0x48')](_0x1a1252);})[_0x8f7d('0x49')](function(_0x4348ab){logger[_0x8f7d('0x41')](_0x4348ab[_0x8f7d('0x42')]);});}function updateTzCampaigns(_0x2b75fa){return new Promise(function(_0x261b7e,_0x472d17){var _0x235f55=squel['select']()['fields']([_0x8f7d('0x4a'),_0x8f7d('0x4b')])[_0x8f7d('0x11')](_0x8f7d('0x4c'))[_0x8f7d('0x12')](_0x8f7d('0x4d'),null,_0x8f7d('0x4e'))[_0x8f7d('0x15')](_0x8f7d('0x4f')+_0x2b75fa);db[_0x8f7d('0x45')][_0x8f7d('0x46')](_0x235f55[_0x8f7d('0x33')]())[_0x8f7d('0x47')](function(_0x1dc13b){var _0x21fc34=[];for(var _0x10aee5=0x0;_0x10aee5<_0x1dc13b[_0x8f7d('0x50')];_0x10aee5++){_0x21fc34['push'](getTimezoneData(_0x1dc13b[_0x10aee5],tmp_campaigns));}BPromise[_0x8f7d('0x51')](_0x21fc34)[_0x8f7d('0x52')](function(){_0x261b7e({'val':0x1});});})[_0x8f7d('0x49')](function(_0xd08a3){logger[_0x8f7d('0x41')](_0xd08a3['message']);_0x261b7e({'val':0x0});});});}function updateTzVoiceQueues(_0x270ba8){return new Promise(function(_0x54d6cc,_0x435103){var _0x701d87=squel[_0x8f7d('0x31')]()[_0x8f7d('0x26')]([_0x8f7d('0x53'),_0x8f7d('0x54')])[_0x8f7d('0x11')]('voice_queues')[_0x8f7d('0x12')](_0x8f7d('0x55'),null,_0x8f7d('0x56'))[_0x8f7d('0x15')](_0x8f7d('0x57')+_0x270ba8);db[_0x8f7d('0x45')][_0x8f7d('0x46')](_0x701d87[_0x8f7d('0x33')]())[_0x8f7d('0x47')](function(_0x3a207b){var _0x5e3d39=[];for(var _0x3e5e8f=0x0;_0x3e5e8f<_0x3a207b[_0x8f7d('0x50')];_0x3e5e8f++){_0x5e3d39[_0x8f7d('0x48')](getTimezoneData(_0x3a207b[_0x3e5e8f],tmp_voice_queues));}BPromise[_0x8f7d('0x51')](_0x5e3d39)[_0x8f7d('0x52')](function(){_0x54d6cc({'val':0x1});});})['catch'](function(_0x5f56ad){logger[_0x8f7d('0x41')](_0x5f56ad['message']);_0x54d6cc({'val':0x0});});});}function getTimezoneData(_0x580894,_0x361bba){return new Promise(function(_0x2419fe,_0x8e9f5e){var _0x2c498a=shared[_0x8f7d('0x58')];var _0x25b456=_0x2c498a[_0x580894[_0x8f7d('0x59')]];if(_[_0x8f7d('0x5a')](_0x25b456)){_0x2419fe({'ret':0x1});}else{var _0x4617ac=_0x25b456['utcOffset'];var _0x1a84fe=squel[_0x8f7d('0x2f')]()[_0x8f7d('0x1c')](_0x361bba)['set']('id',_0x580894['id'])['set'](_0x8f7d('0x5b'),_0x4617ac)['set']('dialTimezone',_0x580894[_0x8f7d('0x59')])['toString']();return db[_0x8f7d('0x45')]['query'](_0x1a84fe)[_0x8f7d('0x47')](function(_0x5abe95){_0x2419fe({'ret':0x1});})[_0x8f7d('0x49')](function(_0x3b24d2){logger[_0x8f7d('0x41')](_0x3b24d2[_0x8f7d('0x42')]);_0x8e9f5e({'ret':0x1});});}});}function handleTZQuery(_0x2458c1){logger['info'](_0x2458c1);return db[_0x8f7d('0x45')]['query'](_0x2458c1)[_0x8f7d('0x47')](function(_0x3facca){})['catch'](function(_0x3191b0){logger[_0x8f7d('0x41')](_0x3191b0[_0x8f7d('0x42')]);});}function main(_0x4bb71e,_0x1a6ef4,_0x1ff202,_0x1a2a49){logger[_0x8f7d('0x44')](_0x8f7d('0x5c'),_0x4bb71e,JSON['stringify'](_0x1a6ef4));process['send'](_0x8f7d('0x5d'));var _0x32c8ed=_0x1a6ef4[_0x8f7d('0x5e')];var _0x7d851d=_0x1a6ef4['socket_timestamp'];var _0x2985fd=path[_0x8f7d('0x12')](config[_0x8f7d('0x5f')],_0x8f7d('0x60'),_0x7d851d+_0x8f7d('0x61'));hasTZ=_[_0x8f7d('0x3a')](_0x32c8ed)[_0x8f7d('0x62')](_0x8f7d('0x59'));var _0x4020cf=_[_0x8f7d('0x3a')](_0x32c8ed)[_0x8f7d('0x12')]();logger[_0x8f7d('0x44')](_0x8f7d('0x63'),_0x4020cf);if(hasTZ)_0x4020cf+=_0x8f7d('0x64');fs[_0x8f7d('0x65')](_0x2985fd,_0x4020cf+'\x0a');Papa['parse'](fs[_0x8f7d('0x66')](_0x4bb71e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x56c791,_0x58a545){try{for(var _0x1d6ada=0x0,_0x422413=[];_0x1d6ada<_0x56c791[_0x8f7d('0x67')][_0x8f7d('0x50')];_0x1d6ada++){stats[_0x8f7d('0x68')]+=0x1;if(_0x56c791[_0x8f7d('0x69')][_0x1d6ada]){handleError(_0x56c791[_0x8f7d('0x67')][_0x1d6ada],_0x56c791[_0x8f7d('0x69')][_0x1d6ada]);}else{var _0xe299cd=[];for(var _0x43efd0 in _0x32c8ed){if(_0x32c8ed[_0x8f7d('0x6a')](_0x43efd0)){if(_0x56c791['data'][_0x1d6ada][_0x32c8ed[_0x43efd0]]){var _0x3a8c6e=_['trim'](_0x56c791[_0x8f7d('0x67')][_0x1d6ada][_0x32c8ed[_0x43efd0]][_0x8f7d('0x6b')](/"/g,'\x27'));switch(_0x43efd0){case'scheduledat':var _0x5eb82e=moment(_0x3a8c6e,_0x8f7d('0xe'),!![]);if(_0x5eb82e['isValid']()){_0x422413[_0x8f7d('0x48')]('\x22'+_0x3a8c6e+'\x22');}else{_0xe299cd[_0x8f7d('0x48')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0xd48efb=parseInt(_0x3a8c6e);_0x3a8c6e=_[_0x8f7d('0x6c')](_0xd48efb)||_0xd48efb<0x0||_0xd48efb>0x4?_0x1a2a49?0x3:0x2:_0xd48efb;_0x422413[_0x8f7d('0x48')]('\x22'+_0x3a8c6e+'\x22');break;case _0x8f7d('0x37'):var _0x4631bd=parseInt(_0x3a8c6e);if(_[_0x8f7d('0x6d')](_0x4631bd)&&_[_0x8f7d('0x62')](_0x1ff202,_0x4631bd)){_0x422413[_0x8f7d('0x48')]('\x22'+_0x4631bd+'\x22');}else{_0xe299cd[_0x8f7d('0x48')](_0x8f7d('0x6e'));}break;case'email':if(isEmail(_0x3a8c6e)){_0x422413['push']('\x22'+_0x3a8c6e+'\x22');}else{_0xe299cd[_0x8f7d('0x48')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x4aedbb=moment(_0x3a8c6e,_0x8f7d('0x6f'),!![]);if(_0x4aedbb['isValid']()){_0x422413[_0x8f7d('0x48')]('\x22'+_0x3a8c6e+'\x22');}else{_0xe299cd[_0x8f7d('0x48')](_0x8f7d('0x70'));}break;case _0x8f7d('0x59'):var _0x11d6e2=shared[_0x8f7d('0x58')];var _0x18df26=_0x11d6e2[_0x3a8c6e];if(!_[_0x8f7d('0x5a')](_0x18df26)){var _0x1aa461=_0x18df26[_0x8f7d('0x71')];_0x422413['push']('\x22'+_0x3a8c6e+'\x22');_0x422413[_0x8f7d('0x48')]('\x22'+_0x1aa461+'\x22');}break;default:_0x422413[_0x8f7d('0x48')]('\x22'+_0x3a8c6e+'\x22');}}else{switch(_0x43efd0){case _0x8f7d('0x72'):case _0x8f7d('0x10'):_0xe299cd[_0x8f7d('0x48')](_0x43efd0+'\x20not\x20specified');break;default:_0x422413[_0x8f7d('0x48')]('\x22\x22');}}}}if(_0xe299cd['length']){handleError(_0x56c791[_0x8f7d('0x67')][_0x1d6ada],{'code':_0x8f7d('0x73'),'message':_0xe299cd[_0x8f7d('0x12')]()});}else{fs['appendFileSync'](_0x2985fd,_0x422413[_0x8f7d('0x12')]()+'\x0a');}_0x422413=[];}if(!(stats[_0x8f7d('0x68')]%0xc8)){socket['emit'](_0x8f7d('0x74')+_0x7d851d,stats);stats['errors']=[];}}if(stopped){logger[_0x8f7d('0x44')]('Abort\x20parser');_0x58a545[_0x8f7d('0x75')]();}}catch(_0xb91b7){handleError(_0x56c791['data'][_0x1d6ada],{'code':_0x8f7d('0x76'),'message':_0xb91b7[_0x8f7d('0x42')]});logger[_0x8f7d('0x41')](_0x8f7d('0x77'),_0xb91b7[_0x8f7d('0x42')]);}},'complete':function(){try{var _0xb1475e=[];var _0x4f4f72=[];var _0x37e618=_0x8f7d('0x27');if(_0x1a6ef4[_0x8f7d('0x78')]&&_0x1a6ef4[_0x8f7d('0x78')][_0x8f7d('0x50')]){_0x37e618=_0x8f7d('0x79')+_0x7d851d;_0xb1475e[_0x8f7d('0x48')](_0x8f7d('0x7a')+_0x37e618+_0x8f7d('0x7b'));}tmp_campaigns=_0x8f7d('0x7c')+_0x7d851d;tmp_voice_queues=_0x8f7d('0x7d')+_0x7d851d;_0x4f4f72[_0x8f7d('0x48')](_0x8f7d('0x7a')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x4f4f72[_0x8f7d('0x48')](_0x8f7d('0x7a')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x8f7d('0x7e')](_0x4f4f72,handleTZQuery)[_0x8f7d('0x52')](function(_0x3d984e){updateTzCampaigns(_0x1a6ef4[_0x8f7d('0x21')])[_0x8f7d('0x52')](function(_0x5b1dc5){updateTzVoiceQueues(_0x1a6ef4['ListId'])[_0x8f7d('0x52')](function(_0x143c99){var _0x11f994=util[_0x8f7d('0x7f')](_0x8f7d('0x80'),_0x2985fd,_0x37e618,_0x4020cf,_0x1a6ef4[_0x8f7d('0x21')],_0x1a6ef4[_0x8f7d('0x3b')]||null,NOW,NOW);if(_['isNil'](_0x32c8ed[_0x8f7d('0x1f')])){_0x11f994+=_0x8f7d('0x81');}_0xb1475e[_0x8f7d('0x48')](_0x11f994);if(_0x1a6ef4[_0x8f7d('0x78')]&&_0x1a6ef4[_0x8f7d('0x78')][_0x8f7d('0x50')]){_0xb1475e['push'](insertCmContact(_0x1a6ef4[_0x8f7d('0x21')],_0x37e618,_0x1a6ef4[_0x8f7d('0x78')],_0x32c8ed));_0xb1475e[_0x8f7d('0x48')](_0x8f7d('0x82')+_0x37e618+';');}if(hasTZ){_0xb1475e[_0x8f7d('0x48')](insertTzCmHopper(_0x1a6ef4[_0x8f7d('0x21')],_0x8f7d('0x55'),_0x8f7d('0x83'),_0x8f7d('0x84'),_0x1a2a49,tmp_voice_queues));_0xb1475e[_0x8f7d('0x48')](insertTzCmHopperBlack(_0x1a6ef4[_0x8f7d('0x21')],_0x8f7d('0x85'),_0x8f7d('0x83'),_0x8f7d('0x84')));_0xb1475e[_0x8f7d('0x48')](insertTzCmHopper(_0x1a6ef4['ListId'],'campaigns_has_cm_lists',_0x8f7d('0x4c'),'CampaignId',_0x1a2a49,tmp_campaigns));_0xb1475e[_0x8f7d('0x48')](insertTzCmHopperBlack(_0x1a6ef4['ListId'],_0x8f7d('0x86'),_0x8f7d('0x4c'),'CampaignId'));}else{_0xb1475e[_0x8f7d('0x48')](insertCmHopper(_0x1a6ef4['ListId'],_0x8f7d('0x55'),_0x8f7d('0x83'),_0x8f7d('0x84'),_0x1a2a49));_0xb1475e[_0x8f7d('0x48')](insertCmHopperBlack(_0x1a6ef4[_0x8f7d('0x21')],_0x8f7d('0x85'),_0x8f7d('0x83'),_0x8f7d('0x84')));_0xb1475e[_0x8f7d('0x48')](insertCmHopper(_0x1a6ef4[_0x8f7d('0x21')],_0x8f7d('0x4d'),_0x8f7d('0x4c'),_0x8f7d('0x87'),_0x1a2a49));_0xb1475e['push'](insertCmHopperBlack(_0x1a6ef4[_0x8f7d('0x21')],_0x8f7d('0x86'),'campaigns',_0x8f7d('0x87')));}_0xb1475e[_0x8f7d('0x48')]('DROP\x20TABLE\x20'+tmp_campaigns+';');_0xb1475e[_0x8f7d('0x48')](_0x8f7d('0x82')+tmp_voice_queues+';');BPromise[_0x8f7d('0x7e')](_0xb1475e,handleQuery)['then'](function(_0x58a5e1){stats['finish']=!![];stats[_0x8f7d('0x88')]=_0x1a6ef4[_0x8f7d('0x78')]&&_0x1a6ef4[_0x8f7d('0x78')][_0x8f7d('0x50')]?results[0x2][_0x8f7d('0x88')]:results[0x0]['affectedRows'];socket['emit'](_0x8f7d('0x74')+_0x7d851d,stats);fs[_0x8f7d('0x89')](_0x4bb71e);fs[_0x8f7d('0x89')](_0x2985fd);process[_0x8f7d('0x8a')](0x0);})[_0x8f7d('0x49')](function(_0x2786e0){logger['error'](_0x2786e0['message']);process['exit'](0x1);});});});});}catch(_0x3a9b3c){logger[_0x8f7d('0x41')](_0x8f7d('0x8b'),_0x3a9b3c['message']);process[_0x8f7d('0x8a')](0x1);}},'error':function(_0x5c973f,_0x5d68f2,_0x39a131,_0x215bd2){throw new Error(_0x215bd2);}});}function validate(){if(process[_0x8f7d('0x8c')]&&process[_0x8f7d('0x8c')]['length']<0x4){throw new Error(_0x8f7d('0x8d'));}var _0x1d76c8=path[_0x8f7d('0x12')](config[_0x8f7d('0x5f')],_0x8f7d('0x60'),process[_0x8f7d('0x8c')][0x2]);if(!fs['existsSync'](_0x1d76c8)){throw new Error(_0x8f7d('0x8e'));}var _0x44c3da={};try{_0x44c3da=JSON[_0x8f7d('0x8f')](process[_0x8f7d('0x8c')][0x3]);if(!_0x44c3da[_0x8f7d('0x5e')]){throw new Error(_0x8f7d('0x90'));}if(!_0x44c3da[_0x8f7d('0x5e')][_0x8f7d('0x10')]){throw new Error(_0x8f7d('0x91'));}if(!_0x44c3da['binding'][_0x8f7d('0x72')]){throw new Error('firstName\x20is\x20mandatory');}var _0xfbea1b=0x0;if(_0x44c3da['binding']['UserId']){_0xfbea1b=0x1;}if(!_0x44c3da['ListId']){throw new Error(_0x8f7d('0x92'));}}catch(_0x4663a0){throw new Error('body\x20id\x20mandatory');}var _0x8ecf6=[];try{_0x8ecf6=_[_0x8f7d('0x93')](JSON[_0x8f7d('0x8f')](process[_0x8f7d('0x8c')][0x4]),'id');}catch(_0x48d5e1){logger[_0x8f7d('0x44')](_0x8f7d('0x94'));}main(_0x1d76c8,_0x44c3da,_0x8ecf6,_0xfbea1b);}validate();process['on'](_0x8f7d('0x95'),handleStop);process['on'](_0x8f7d('0x96'),handleUncaughtException); \ No newline at end of file +var _0x8bc5=['voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','finish','affectedRows','unlink','complete','arguments\x20\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','phone','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.updatedAt','cm_hopper_black','fromQuery','cm_contacts.createdAt\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','cm_contacts','field','ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','push','query','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','length','then','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','all','timezones','isNil','set','offset','dialTimezone','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','parse','createReadStream','data','rows','errors','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','\x20not\x20specified','SystemRow','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_'];(function(_0x459d7d,_0x55db19){var _0x26abf1=function(_0x39e5d5){while(--_0x39e5d5){_0x459d7d['push'](_0x459d7d['shift']());}};_0x26abf1(++_0x55db19);}(_0x8bc5,0x152));var _0x58bc=function(_0x22fe93,_0x1c0fd6){_0x22fe93=_0x22fe93-0x0;var _0x272f1e=_0x8bc5[_0x22fe93];return _0x272f1e;};'use strict';var fs=require('fs');var path=require(_0x58bc('0x0'));var _=require(_0x58bc('0x1'));var Papa=require(_0x58bc('0x2'));var util=require('util');var BPromise=require(_0x58bc('0x3'));var moment=require('moment');var squel=require(_0x58bc('0x4'));var Redis=require(_0x58bc('0x5'));var db=require(_0x58bc('0x6'))['db'];var config=require(_0x58bc('0x7'));var shared=require(_0x58bc('0x8'));var logger=require(_0x58bc('0x9'))('import');config['redis']=_['defaults'](config[_0x58bc('0xa')],{'host':_0x58bc('0xb'),'port':0x18eb});var socket=require(_0x58bc('0xc'))(new Redis(config[_0x58bc('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x58bc('0xd')](_0x58bc('0xe'));function isEmail(_0x164496){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x58bc('0xf')](_0x164496);}function selectNotIn(_0x142be8,_0xcfcac2,_0x3171fa,_0x2254aa,_0x4b7f11){return squel['select']()['field']('phone')[_0x58bc('0x10')](_0x2254aa)['join'](_0xcfcac2,null,_0xcfcac2+_0x58bc('0x11')+_0x2254aa+'.'+_0x3171fa)[_0x58bc('0x12')](_0x2254aa+'.'+_0x3171fa+_0x58bc('0x13')+_0x142be8+'.'+_0x3171fa)[_0x58bc('0x12')](_0xcfcac2+_0x58bc('0x14')+_0x4b7f11[_0x58bc('0x15')]()+')');}function insertCmHopper(_0x5565f0,_0x6b5eda,_0x1d7488,_0x3e03cf,_0x2e3bb9){var _0x4e8179=[_0x58bc('0x16'),_0x58bc('0x17'),_0x58bc('0x18'),_0x58bc('0x19'),_0x6b5eda+'.'+_0x3e03cf,_0x58bc('0x1a'),'cm_contacts.updatedAt',_0x58bc('0x1b'),_0x58bc('0x1c'),'\x22'+_0x2e3bb9+'\x22'];return squel[_0x58bc('0x1d')]()[_0x58bc('0x1e')](_0x58bc('0x1f'))['fromQuery']([_0x58bc('0x20'),'scheduledat',_0x58bc('0x21'),_0x58bc('0x22'),_0x3e03cf,_0x58bc('0x23'),_0x58bc('0x24'),_0x58bc('0x25'),_0x58bc('0x26'),_0x58bc('0x27')],squel[_0x58bc('0x28')]()[_0x58bc('0x29')](_0x4e8179)[_0x58bc('0x10')](_0x6b5eda)[_0x58bc('0x15')]('cm_contacts',null,_0x58bc('0x2a')+_0x6b5eda+_0x58bc('0x2b'))[_0x58bc('0x15')](_0x1d7488,null,_0x1d7488+'.id\x20=\x20'+_0x6b5eda+'.'+_0x3e03cf)[_0x58bc('0x12')](_0x6b5eda+_0x58bc('0x2c'),_0x5565f0)[_0x58bc('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x58bc('0x12')](_0x58bc('0x2d'),selectNotIn(_0x6b5eda,_0x1d7488,_0x3e03cf,_0x58bc('0x1f'),['\x22always\x22',_0x58bc('0x2e')]))[_0x58bc('0x12')](_0x58bc('0x2d'),selectNotIn(_0x6b5eda,_0x1d7488,_0x3e03cf,_0x58bc('0x1f'),[_0x58bc('0x2f')])))[_0x58bc('0x30')]();}function insertCmHopperBlack(_0x19b655,_0x128b90,_0x3d97e6,_0x5aaaef){var _0x536bdf=['cm_contacts.phone',_0x58bc('0x18'),_0x58bc('0x19'),_0x128b90+'.'+_0x5aaaef,'cm_contacts.createdAt',_0x58bc('0x31')];return squel[_0x58bc('0x1d')]()[_0x58bc('0x1e')](_0x58bc('0x32'))[_0x58bc('0x33')](['phone',_0x58bc('0x21'),_0x58bc('0x22'),_0x5aaaef,_0x58bc('0x23'),_0x58bc('0x24')],squel['select']()['fields'](_0x536bdf)[_0x58bc('0x10')](_0x128b90)[_0x58bc('0x15')]('cm_contacts',null,_0x58bc('0x2a')+_0x128b90+'.CmListId')[_0x58bc('0x15')](_0x3d97e6,null,_0x3d97e6+_0x58bc('0x11')+_0x128b90+'.'+_0x5aaaef)['where'](_0x128b90+'.CmListId\x20=\x20?',_0x19b655)[_0x58bc('0x12')](_0x58bc('0x34'),NOW)['where'](_0x58bc('0x2d'),squel[_0x58bc('0x28')]()['field'](_0x58bc('0x20'))['from'](_0x58bc('0x32'))[_0x58bc('0x12')]('ListId\x20=\x20?',_0x19b655)[_0x58bc('0x12')](_0x5aaaef+_0x58bc('0x35'),_0x128b90+'.'+_0x5aaaef)))['toString']();}function insertTzCmHopper(_0x26ba31,_0x499d30,_0x2d0ff7,_0x38f2b8,_0xb09507,_0x47278e){var _0x5ea30e=[_0x58bc('0x16'),_0x58bc('0x36')+_0x47278e+_0x58bc('0x37'),_0x58bc('0x18'),_0x58bc('0x19'),_0x499d30+'.'+_0x38f2b8,_0x58bc('0x1a'),_0x58bc('0x31'),_0x58bc('0x1b'),_0x58bc('0x1c'),'\x22'+_0xb09507+'\x22'];var _0x10eee8=squel['insert']()['into'](_0x58bc('0x1f'))[_0x58bc('0x33')]([_0x58bc('0x20'),_0x58bc('0x38'),_0x58bc('0x21'),_0x58bc('0x22'),_0x38f2b8,'createdAt','updatedAt',_0x58bc('0x25'),_0x58bc('0x26'),_0x58bc('0x27')],squel[_0x58bc('0x28')]()[_0x58bc('0x29')](_0x5ea30e)[_0x58bc('0x10')](_0x499d30)[_0x58bc('0x15')](_0x58bc('0x39'),null,_0x58bc('0x2a')+_0x499d30+_0x58bc('0x2b'))[_0x58bc('0x15')](_0x2d0ff7,null,_0x2d0ff7+_0x58bc('0x11')+_0x499d30+'.'+_0x38f2b8)['join'](_0x47278e,null,_0x47278e+_0x58bc('0x11')+_0x499d30+'.'+_0x38f2b8)[_0x58bc('0x12')](_0x499d30+'.CmListId\x20=\x20?',_0x26ba31)[_0x58bc('0x12')](_0x58bc('0x34'),NOW)[_0x58bc('0x12')](_0x58bc('0x2d'),selectNotIn(_0x499d30,_0x2d0ff7,_0x38f2b8,'cm_hopper',[_0x58bc('0x2f'),_0x58bc('0x2e')]))[_0x58bc('0x12')](_0x58bc('0x2d'),selectNotIn(_0x499d30,_0x2d0ff7,_0x38f2b8,_0x58bc('0x1f'),[_0x58bc('0x2f')])))[_0x58bc('0x30')]();return _0x10eee8;}function insertTzCmHopperBlack(_0xa65250,_0x55e7d8,_0x5b3dd7,_0xa523b1){var _0x13956d=[_0x58bc('0x16'),_0x58bc('0x18'),'cm_contacts.ListId',_0x55e7d8+'.'+_0xa523b1,_0x58bc('0x1a'),'cm_contacts.updatedAt'];return squel[_0x58bc('0x1d')]()['into'](_0x58bc('0x32'))[_0x58bc('0x33')]([_0x58bc('0x20'),_0x58bc('0x21'),_0x58bc('0x22'),_0xa523b1,'createdAt',_0x58bc('0x24')],squel[_0x58bc('0x28')]()['fields'](_0x13956d)['from'](_0x55e7d8)[_0x58bc('0x15')](_0x58bc('0x39'),null,_0x58bc('0x2a')+_0x55e7d8+'.CmListId')['join'](_0x5b3dd7,null,_0x5b3dd7+_0x58bc('0x11')+_0x55e7d8+'.'+_0xa523b1)[_0x58bc('0x12')](_0x55e7d8+_0x58bc('0x2c'),_0xa65250)[_0x58bc('0x12')](_0x58bc('0x34'),NOW)[_0x58bc('0x12')](_0x58bc('0x2d'),squel[_0x58bc('0x28')]()[_0x58bc('0x3a')](_0x58bc('0x20'))['from']('cm_hopper_black')['where'](_0x58bc('0x3b'),_0xa65250)[_0x58bc('0x12')](_0xa523b1+'\x20=\x20?',_0x55e7d8+'.'+_0xa523b1)))[_0x58bc('0x30')]();}function insertCmContact(_0x1062cb,_0x367484,_0x241e2f,_0x27b0af){var _0x1a03c4=_[_0x58bc('0x3c')](_[_0x58bc('0x3d')](_0x27b0af),['ListId','CompanyId',_0x58bc('0x23'),_0x58bc('0x24')]);return squel[_0x58bc('0x1d')]()['into'](_0x58bc('0x39'))[_0x58bc('0x33')](_0x1a03c4,squel['select']()[_0x58bc('0x29')](_0x1a03c4)['from'](_0x367484)['where']('('+_0x241e2f[_0x58bc('0x15')](',')+_0x58bc('0x3e'),squel[_0x58bc('0x28')]()[_0x58bc('0x29')](_0x241e2f)[_0x58bc('0x10')](_0x58bc('0x39'))[_0x58bc('0x12')](_0x58bc('0x3b'),_0x1062cb)[_0x58bc('0x12')]('deletedAt\x20IS\x20NULL'))[_0x58bc('0x12')](_0x58bc('0x3f'),squel[_0x58bc('0x28')]()['field'](_0x58bc('0x40'),_0x58bc('0x41'))[_0x58bc('0x10')](_0x367484)[_0x58bc('0x42')](_0x241e2f[_0x58bc('0x15')](','))))[_0x58bc('0x30')]();}function handleStop(){logger[_0x58bc('0x43')](_0x58bc('0x44'));stopped=!![];}function handleUncaughtException(_0x29026b){logger['error'](_0x29026b[_0x58bc('0x45')]);process[_0x58bc('0x46')](0x1);}function handleError(_0xf403fd,_0x48f023){stats['errors'][_0x58bc('0x47')]({'name':_0x48f023['code'],'message':_0x48f023['message'],'row':_0xf403fd});}function handleQuery(_0x5950c6){logger[_0x58bc('0x43')](_0x5950c6);return db['sequelize'][_0x58bc('0x48')](_0x5950c6)[_0x58bc('0x49')](function(_0x91bfcf){results[_0x58bc('0x47')](_0x91bfcf);})[_0x58bc('0x4a')](function(_0x8dd92b){logger[_0x58bc('0x4b')](_0x8dd92b['message']);});}function updateTzCampaigns(_0x5718bb){return new Promise(function(_0x10b2d5,_0x5207fd){var _0x515394=squel[_0x58bc('0x28')]()[_0x58bc('0x29')]([_0x58bc('0x4c'),_0x58bc('0x4d')])[_0x58bc('0x10')]('campaigns')[_0x58bc('0x15')]('campaigns_has_cm_lists',null,_0x58bc('0x4e'))['where']('campaigns_has_cm_lists.CmListId='+_0x5718bb);db[_0x58bc('0x4f')]['query'](_0x515394[_0x58bc('0x30')]())['spread'](function(_0x2b7877){var _0x2295a8=[];for(var _0x3bcbe6=0x0;_0x3bcbe6<_0x2b7877[_0x58bc('0x50')];_0x3bcbe6++){_0x2295a8[_0x58bc('0x47')](getTimezoneData(_0x2b7877[_0x3bcbe6],tmp_campaigns));}BPromise['all'](_0x2295a8)[_0x58bc('0x51')](function(){_0x10b2d5({'val':0x1});});})[_0x58bc('0x4a')](function(_0x1a138d){logger['error'](_0x1a138d[_0x58bc('0x45')]);_0x10b2d5({'val':0x0});});});}function updateTzVoiceQueues(_0x5bc0e3){return new Promise(function(_0x1e9719,_0x5320ff){var _0x3bf44d=squel['select']()['fields']([_0x58bc('0x52'),_0x58bc('0x53')])['from'](_0x58bc('0x54'))['join'](_0x58bc('0x55'),null,_0x58bc('0x56'))[_0x58bc('0x12')](_0x58bc('0x57')+_0x5bc0e3);db['sequelize'][_0x58bc('0x48')](_0x3bf44d[_0x58bc('0x30')]())[_0x58bc('0x49')](function(_0x3e0082){var _0x435b2b=[];for(var _0x290fba=0x0;_0x290fba<_0x3e0082[_0x58bc('0x50')];_0x290fba++){_0x435b2b[_0x58bc('0x47')](getTimezoneData(_0x3e0082[_0x290fba],tmp_voice_queues));}BPromise[_0x58bc('0x58')](_0x435b2b)['then'](function(){_0x1e9719({'val':0x1});});})[_0x58bc('0x4a')](function(_0x822469){logger[_0x58bc('0x4b')](_0x822469[_0x58bc('0x45')]);_0x1e9719({'val':0x0});});});}function getTimezoneData(_0x5190af,_0xcc1ae1){return new Promise(function(_0x248954,_0x36e6d9){var _0x51ca78=shared[_0x58bc('0x59')];var _0x782270=_0x51ca78[_0x5190af['dialTimezone']];if(_[_0x58bc('0x5a')](_0x782270)){_0x248954({'ret':0x1});}else{var _0x4bbfa5=_0x782270['utcOffset'];var _0x20685a=squel[_0x58bc('0x1d')]()[_0x58bc('0x1e')](_0xcc1ae1)[_0x58bc('0x5b')]('id',_0x5190af['id'])[_0x58bc('0x5b')](_0x58bc('0x5c'),_0x4bbfa5)[_0x58bc('0x5b')](_0x58bc('0x5d'),_0x5190af[_0x58bc('0x5d')])[_0x58bc('0x30')]();return db['sequelize']['query'](_0x20685a)[_0x58bc('0x49')](function(_0x21c3bf){_0x248954({'ret':0x1});})[_0x58bc('0x4a')](function(_0x320234){logger[_0x58bc('0x4b')](_0x320234[_0x58bc('0x45')]);_0x36e6d9({'ret':0x1});});}});}function handleTZQuery(_0x1987f2){logger[_0x58bc('0x43')](_0x1987f2);return db[_0x58bc('0x4f')][_0x58bc('0x48')](_0x1987f2)[_0x58bc('0x49')](function(_0x491205){})[_0x58bc('0x4a')](function(_0x9a5b8d){logger[_0x58bc('0x4b')](_0x9a5b8d[_0x58bc('0x45')]);});}function main(_0x36a845,_0x46c9e7,_0x33cd15,_0x547e3e){logger['info'](_0x58bc('0x5e'),_0x36a845,JSON['stringify'](_0x46c9e7));process[_0x58bc('0x5f')](_0x58bc('0x60'));var _0x36bfb6=_0x46c9e7[_0x58bc('0x61')];var _0x1eae7e=_0x46c9e7[_0x58bc('0x62')];var _0x27df27=path[_0x58bc('0x15')](config[_0x58bc('0x63')],_0x58bc('0x64'),_0x1eae7e+_0x58bc('0x65'));hasTZ=_[_0x58bc('0x3d')](_0x36bfb6)['includes'](_0x58bc('0x5d'));var _0x2c72f5=_[_0x58bc('0x3d')](_0x36bfb6)[_0x58bc('0x15')]();logger[_0x58bc('0x43')](_0x58bc('0x66'),_0x2c72f5);if(hasTZ)_0x2c72f5+=',utcOffset';fs['writeFileSync'](_0x27df27,_0x2c72f5+'\x0a');Papa[_0x58bc('0x67')](fs[_0x58bc('0x68')](_0x36a845),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71a7,_0x16f640){try{for(var _0x2c857=0x0,_0x5b878d=[];_0x2c857<_0x1e71a7[_0x58bc('0x69')]['length'];_0x2c857++){stats[_0x58bc('0x6a')]+=0x1;if(_0x1e71a7[_0x58bc('0x6b')][_0x2c857]){handleError(_0x1e71a7['data'][_0x2c857],_0x1e71a7['errors'][_0x2c857]);}else{var _0x4b06aa=[];for(var _0x1753d0 in _0x36bfb6){if(_0x36bfb6['hasOwnProperty'](_0x1753d0)){if(_0x1e71a7[_0x58bc('0x69')][_0x2c857][_0x36bfb6[_0x1753d0]]){var _0x590565=_[_0x58bc('0x6c')](_0x1e71a7[_0x58bc('0x69')][_0x2c857][_0x36bfb6[_0x1753d0]][_0x58bc('0x6d')](/"/g,'\x27'));switch(_0x1753d0){case _0x58bc('0x38'):var _0xff527e=moment(_0x590565,_0x58bc('0xe'),!![]);if(_0xff527e[_0x58bc('0x6e')]()){_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');}else{_0x4b06aa[_0x58bc('0x47')](_0x58bc('0x6f'));}break;case'priority':var _0x468c92=parseInt(_0x590565);_0x590565=_['isNaN'](_0x468c92)||_0x468c92<0x0||_0x468c92>0x4?_0x547e3e?0x3:0x2:_0x468c92;_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');break;case'UserId':var _0x44101c=parseInt(_0x590565);if(_[_0x58bc('0x70')](_0x44101c)&&_[_0x58bc('0x71')](_0x33cd15,_0x44101c)){_0x5b878d[_0x58bc('0x47')]('\x22'+_0x44101c+'\x22');}else{_0x4b06aa[_0x58bc('0x47')](_0x58bc('0x72'));}break;case _0x58bc('0x73'):if(isEmail(_0x590565)){_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');}else{_0x4b06aa[_0x58bc('0x47')](_0x58bc('0x74'));}break;case _0x58bc('0x75'):var _0xe2d156=moment(_0x590565,'YYYY-MM-DD',!![]);if(_0xe2d156[_0x58bc('0x6e')]()){_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');}else{_0x4b06aa['push'](_0x58bc('0x76'));}break;case _0x58bc('0x5d'):var _0x1ca587=shared[_0x58bc('0x59')];var _0x172175=_0x1ca587[_0x590565];if(!_[_0x58bc('0x5a')](_0x172175)){var _0x1185c8=_0x172175[_0x58bc('0x77')];_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');_0x5b878d[_0x58bc('0x47')]('\x22'+_0x1185c8+'\x22');}break;default:_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');}}else{switch(_0x1753d0){case'firstName':case'phone':_0x4b06aa[_0x58bc('0x47')](_0x1753d0+_0x58bc('0x78'));break;default:_0x5b878d[_0x58bc('0x47')]('\x22\x22');}}}}if(_0x4b06aa[_0x58bc('0x50')]){handleError(_0x1e71a7[_0x58bc('0x69')][_0x2c857],{'code':_0x58bc('0x79'),'message':_0x4b06aa['join']()});}else{fs['appendFileSync'](_0x27df27,_0x5b878d[_0x58bc('0x15')]()+'\x0a');}_0x5b878d=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x58bc('0x7a')+_0x1eae7e,stats);stats['errors']=[];}}if(stopped){logger[_0x58bc('0x43')](_0x58bc('0x7b'));_0x16f640[_0x58bc('0x7c')]();}}catch(_0xa53321){handleError(_0x1e71a7[_0x58bc('0x69')][_0x2c857],{'code':'SystemError','message':_0xa53321[_0x58bc('0x45')]});logger[_0x58bc('0x4b')](_0x58bc('0x7d'),_0xa53321[_0x58bc('0x45')]);}},'complete':function(){try{var _0x37ab13=[];var _0x461ea5=[];var _0x974e71=_0x58bc('0x39');if(_0x46c9e7[_0x58bc('0x7e')]&&_0x46c9e7[_0x58bc('0x7e')]['length']){_0x974e71=_0x58bc('0x7f')+_0x1eae7e;_0x37ab13[_0x58bc('0x47')](_0x58bc('0x80')+_0x974e71+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x58bc('0x81')+_0x1eae7e;tmp_voice_queues=_0x58bc('0x82')+_0x1eae7e;_0x461ea5[_0x58bc('0x47')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x58bc('0x83'));_0x461ea5[_0x58bc('0x47')](_0x58bc('0x80')+tmp_voice_queues+_0x58bc('0x83'));BPromise[_0x58bc('0x84')](_0x461ea5,handleTZQuery)[_0x58bc('0x51')](function(_0x13fe98){updateTzCampaigns(_0x46c9e7[_0x58bc('0x22')])[_0x58bc('0x51')](function(_0x10dab){updateTzVoiceQueues(_0x46c9e7[_0x58bc('0x22')])[_0x58bc('0x51')](function(_0x4d0543){var _0x5c8bf2=util['format'](_0x58bc('0x85'),_0x27df27,_0x974e71,_0x2c72f5,_0x46c9e7[_0x58bc('0x22')],_0x46c9e7[_0x58bc('0x86')]||null,NOW,NOW);if(_['isNil'](_0x36bfb6[_0x58bc('0x38')])){_0x5c8bf2+=',\x20scheduledAt\x20=\x20NOW()';}_0x37ab13[_0x58bc('0x47')](_0x5c8bf2);if(_0x46c9e7[_0x58bc('0x7e')]&&_0x46c9e7[_0x58bc('0x7e')][_0x58bc('0x50')]){_0x37ab13[_0x58bc('0x47')](insertCmContact(_0x46c9e7[_0x58bc('0x22')],_0x974e71,_0x46c9e7[_0x58bc('0x7e')],_0x36bfb6));_0x37ab13[_0x58bc('0x47')](_0x58bc('0x87')+_0x974e71+';');}if(hasTZ){_0x37ab13[_0x58bc('0x47')](insertTzCmHopper(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x55'),_0x58bc('0x54'),_0x58bc('0x88'),_0x547e3e,tmp_voice_queues));_0x37ab13[_0x58bc('0x47')](insertTzCmHopperBlack(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x89'),_0x58bc('0x54'),_0x58bc('0x88')));_0x37ab13[_0x58bc('0x47')](insertTzCmHopper(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x8a'),'campaigns',_0x58bc('0x8b'),_0x547e3e,tmp_campaigns));_0x37ab13[_0x58bc('0x47')](insertTzCmHopperBlack(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x8c'),_0x58bc('0x8d'),_0x58bc('0x8b')));}else{_0x37ab13[_0x58bc('0x47')](insertCmHopper(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x55'),_0x58bc('0x54'),_0x58bc('0x88'),_0x547e3e));_0x37ab13[_0x58bc('0x47')](insertCmHopperBlack(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x89'),_0x58bc('0x54'),_0x58bc('0x88')));_0x37ab13[_0x58bc('0x47')](insertCmHopper(_0x46c9e7[_0x58bc('0x22')],'campaigns_has_cm_lists',_0x58bc('0x8d'),'CampaignId',_0x547e3e));_0x37ab13['push'](insertCmHopperBlack(_0x46c9e7['ListId'],'campaigns_has_cm_blacklists',_0x58bc('0x8d'),_0x58bc('0x8b')));}_0x37ab13[_0x58bc('0x47')]('DROP\x20TABLE\x20'+tmp_campaigns+';');_0x37ab13['push'](_0x58bc('0x87')+tmp_voice_queues+';');BPromise['each'](_0x37ab13,handleQuery)[_0x58bc('0x51')](function(_0x3db045){stats[_0x58bc('0x8e')]=!![];stats[_0x58bc('0x8f')]=_0x46c9e7['duplicates']&&_0x46c9e7[_0x58bc('0x7e')][_0x58bc('0x50')]?results[0x2][_0x58bc('0x8f')]:results[0x0][_0x58bc('0x8f')];socket['emit']('contact:import:'+_0x1eae7e,stats);fs[_0x58bc('0x90')](_0x36a845);fs[_0x58bc('0x90')](_0x27df27);process[_0x58bc('0x46')](0x0);})[_0x58bc('0x4a')](function(_0x3daf77){logger[_0x58bc('0x4b')](_0x3daf77['message']);process[_0x58bc('0x46')](0x1);});});});});}catch(_0x36a4a7){logger[_0x58bc('0x4b')](_0x58bc('0x91'),_0x36a4a7[_0x58bc('0x45')]);process[_0x58bc('0x46')](0x1);}},'error':function(_0xcf5a,_0x13a4d3,_0x28cb62,_0xe5c7a4){throw new Error(_0xe5c7a4);}});}function validate(){if(process['argv']&&process['argv'][_0x58bc('0x50')]<0x4){throw new Error(_0x58bc('0x92'));}var _0x27e0ec=path[_0x58bc('0x15')](config['root'],_0x58bc('0x64'),process[_0x58bc('0x93')][0x2]);if(!fs[_0x58bc('0x94')](_0x27e0ec)){throw new Error(_0x58bc('0x95'));}var _0x28f10f={};try{_0x28f10f=JSON[_0x58bc('0x67')](process[_0x58bc('0x93')][0x3]);if(!_0x28f10f[_0x58bc('0x61')]){throw new Error(_0x58bc('0x96'));}if(!_0x28f10f[_0x58bc('0x61')][_0x58bc('0x20')]){throw new Error(_0x58bc('0x97'));}if(!_0x28f10f[_0x58bc('0x61')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x3dc7b6=0x0;if(_0x28f10f['binding'][_0x58bc('0x26')]){_0x3dc7b6=0x1;}if(!_0x28f10f[_0x58bc('0x22')]){throw new Error(_0x58bc('0x98'));}}catch(_0x7219f3){throw new Error('body\x20id\x20mandatory');}var _0x129cf0=[];try{_0x129cf0=_[_0x58bc('0x99')](JSON[_0x58bc('0x67')](process[_0x58bc('0x93')][0x4]),'id');}catch(_0x1a96ce){logger[_0x58bc('0x43')](_0x58bc('0x9a'));}main(_0x27e0ec,_0x28f10f,_0x129cf0,_0x3dc7b6);}validate();process['on']('SIGINT',handleStop);process['on'](_0x58bc('0x9b'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 717b915..e4bac18 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x512e=['Member\x20Name','membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','Queue','queue','UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','agentcalledAt','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound','Called\x20Number'];(function(_0x383f60,_0x5e5726){var _0xc34fcb=function(_0x2fee2c){while(--_0x2fee2c){_0x383f60['push'](_0x383f60['shift']());}};_0xc34fcb(++_0x5e5726);}(_0x512e,0x145));var _0xe512=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x512e[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0xe512('0x0')]=function(_0x2a8229,_0x207018){var _0x37bf6f=[{'type':_0xe512('0x1'),'content':_0xe512('0x2'),'variableName':null}];switch(_0x2a8229[_0xe512('0x3')]()){case'voice':switch(_0x207018['toLowerCase']()){case _0xe512('0x4'):_0x37bf6f[_0xe512('0x5')]({'type':_0xe512('0x6'),'content':'','variableName':'queue'});_0x37bf6f[_0xe512('0x5')]({'type':_0xe512('0x6'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x37bf6f[_0xe512('0x5')]({'type':_0xe512('0x1'),'content':_0xe512('0x7'),'variableName':null});_0x37bf6f['push']({'type':_0xe512('0x6'),'content':'','variableName':_0xe512('0x8')});break;}}return _0x37bf6f;};exports[_0xe512('0x9')]=function(_0xa97262,_0x58048a){var _0x476249=[];switch(_0xa97262[_0xe512('0x3')]()){case _0xe512('0xa'):switch(_0x58048a[_0xe512('0x3')]()){case _0xe512('0x4'):_0x476249=[{'type':_0xe512('0x1'),'content':_0xe512('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0xd'),'keyType':_0xe512('0x6'),'variableName':'calleridnum'},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0xe'),'keyType':_0xe512('0x6'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':_0xe512('0xf'),'keyType':_0xe512('0x6'),'variableName':'destexten'},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0x10'),'keyType':'variable','variableName':_0xe512('0x11')},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0x12'),'keyType':_0xe512('0x6'),'variableName':_0xe512('0x13')},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0x14'),'keyType':_0xe512('0x6'),'variableName':'agentcalledAt'},{'type':'string','content':_0xe512('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0x16'),'keyType':_0xe512('0x6'),'variableName':_0xe512('0x17')},{'type':'keyValue','content':'','key':_0xe512('0x18'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0xe512('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0xe512('0x6'),'variableName':_0xe512('0x19')},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0x1a'),'keyType':'variable','variableName':_0xe512('0x1b')},{'type':_0xe512('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0xe512('0x6'),'variableName':_0xe512('0x1c')},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0x1d'),'keyType':_0xe512('0x6'),'variableName':_0xe512('0x1e')},{'type':'keyValue','content':'','key':_0xe512('0x1f'),'keyType':_0xe512('0x6'),'variableName':_0xe512('0x20')}];break;case _0xe512('0x21'):_0x476249=[{'type':_0xe512('0x1'),'content':_0xe512('0xb'),'variableName':null},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0x22'),'keyType':'variable','keyContent':'','variableName':_0xe512('0x8')},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0x23'),'keyType':'variable','keyContent':'','variableName':_0xe512('0x24')},{'type':'keyValue','content':'','key':_0xe512('0x12'),'keyType':_0xe512('0x6'),'keyContent':'','variableName':_0xe512('0x13')},{'type':_0xe512('0xc'),'content':'','key':'Date','keyType':_0xe512('0x6'),'keyContent':'','variableName':_0xe512('0x25')},{'type':'string','content':_0xe512('0x26')},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0x27'),'keyType':_0xe512('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0x28'),'keyType':_0xe512('0x6'),'keyContent':'','variableName':_0xe512('0x29')},{'type':_0xe512('0xc'),'content':'','key':_0xe512('0x2a'),'keyType':_0xe512('0x6'),'keyContent':'','variableName':_0xe512('0x2b')},{'type':_0xe512('0xc'),'content':'','key':'Billable\x20Time','keyType':'variable','keyContent':'','variableName':_0xe512('0x2c')}];break;}}return _0x476249;}; \ No newline at end of file +var _0x4552=['destexten','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','inbound','push','variable','queue','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','Call\x20To'];(function(_0x3fc287,_0x5c3f36){var _0x33af9f=function(_0x27cfc6){while(--_0x27cfc6){_0x3fc287['push'](_0x3fc287['shift']());}};_0x33af9f(++_0x5c3f36);}(_0x4552,0x14e));var _0x2455=function(_0x4345e5,_0x2b91e2){_0x4345e5=_0x4345e5-0x0;var _0x1887c7=_0x4552[_0x4345e5];return _0x1887c7;};'use strict';exports[_0x2455('0x0')]=function(_0x4da9f2,_0x1ada6e){var _0x11f951=[{'type':_0x2455('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x4da9f2[_0x2455('0x2')]()){case'voice':switch(_0x1ada6e['toLowerCase']()){case _0x2455('0x3'):_0x11f951[_0x2455('0x4')]({'type':_0x2455('0x5'),'content':'','variableName':_0x2455('0x6')});_0x11f951['push']({'type':_0x2455('0x5'),'content':'','variableName':'calleridnum'});break;case _0x2455('0x7'):_0x11f951[_0x2455('0x4')]({'type':_0x2455('0x1'),'content':_0x2455('0x8'),'variableName':null});_0x11f951[_0x2455('0x4')]({'type':'variable','content':'','variableName':_0x2455('0x9')});break;}}return _0x11f951;};exports[_0x2455('0xa')]=function(_0x174553,_0x560b72){var _0x438e74=[];switch(_0x174553[_0x2455('0x2')]()){case _0x2455('0xb'):switch(_0x560b72[_0x2455('0x2')]()){case _0x2455('0x3'):_0x438e74=[{'type':_0x2455('0x1'),'content':_0x2455('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0xe'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0xf')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x10'),'keyType':'variable','variableName':'calleridname'},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x11'),'keyType':'variable','variableName':_0x2455('0x12')},{'type':_0x2455('0xd'),'content':'','key':'Queue','keyType':_0x2455('0x5'),'variableName':_0x2455('0x6')},{'type':_0x2455('0xd'),'content':'','key':'UniqueId','keyType':_0x2455('0x5'),'variableName':_0x2455('0x13')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x14'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0x15')},{'type':_0x2455('0x1'),'content':_0x2455('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x17'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0x18')},{'type':'keyValue','content':'','key':_0x2455('0x19'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0x9')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x2455('0x5'),'variableName':_0x2455('0x15')},{'type':'keyValue','content':'','key':_0x2455('0x1a'),'keyType':_0x2455('0x5'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0x2455('0x1b'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0x1c')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x1d'),'keyType':_0x2455('0x5'),'variableName':'holdtime'},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x1e'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0x1f')}];break;case'outbound':_0x438e74=[{'type':_0x2455('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':_0x2455('0x20'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x9')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x21'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x22')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x23'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x14'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x24')},{'type':_0x2455('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x25'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':'answertime'},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x26'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x27')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x28'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x29')},{'type':'keyValue','content':'','key':_0x2455('0x2a'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x2b')}];break;}}return _0x438e74;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 34e030a..25611f4 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba1c=['html','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','update','info','catch','error','tracked','user','query','clone','omit'];(function(_0x478da5,_0x205a0b){var _0x1c9b0c=function(_0x2bc821){while(--_0x2bc821){_0x478da5['push'](_0x478da5['shift']());}};_0x1c9b0c(++_0x205a0b);}(_0xba1c,0x1c5));var _0xcba1=function(_0x53f7e7,_0x106954){_0x53f7e7=_0x53f7e7-0x0;var _0x5562e8=_0xba1c[_0x53f7e7];return _0x5562e8;};'use strict';var _=require(_0xcba1('0x0'));var db=require(_0xcba1('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xcba1('0x2')),'mail':require(_0xcba1('0x3'))(_0xcba1('0x4')),'fax':require(_0xcba1('0x3'))('fax-interactions'),'sms':require(_0xcba1('0x3'))('sms-interactions'),'chat':require('../../config/logger')(_0xcba1('0x5')),'whatsapp':require(_0xcba1('0x3'))(_0xcba1('0x6'))};function getInteractionId(_0x259863,_0x3bdb0b,_0x2670b9){if(_0x259863&&_0x259863[_['upperFirst'](_0x2670b9)+_0xcba1('0x7')]){return _0x259863[_[_0xcba1('0x8')](_0x2670b9)+_0xcba1('0x7')];}else if(_0x259863&&_0x259863['id']){return _0x259863['id'];}else if(_0x3bdb0b&&_0x3bdb0b['id']){return _0x3bdb0b['id'];}else{return _0xcba1('0x9');}}function log(_0x1af0cf,_0xae9e9f,_0xb3ef77,_0xd636f3,_0x4351d6,_0x186ac1){loggers[_0x4351d6['toLowerCase']()][_0x1af0cf](_0xcba1('0xa'),_0x186ac1[_0xcba1('0xb')](),_0xae9e9f?_0xae9e9f['id']:null,_0xae9e9f?_0xae9e9f[_0xcba1('0xc')]:null,_0xae9e9f?_0xae9e9f[_0xcba1('0xd')]:null,getInteractionId(_0xb3ef77,_0xd636f3,_0x4351d6),_0xb3ef77?JSON[_0xcba1('0xe')](_0xb3ef77):_0xcba1('0xf'));}function updateUser(_0x34f008,_0x30e3ad,_0x3d290f,_0x21eb96,_0x494e58){db[_[_0xcba1('0x8')](_0x21eb96)+'Interaction'][_0xcba1('0x10')]({'where':{'id':getInteractionId(_0x30e3ad,_0x3d290f,_0x21eb96)}})[_0xcba1('0x11')](function(_0x4439c1){if(_0x4439c1){return _0x4439c1[_0xcba1('0x12')]({'UserId':_0x34f008?_0x34f008['id']:null});}})[_0xcba1('0x11')](function(_0x56302d){if(_0x56302d){log(_0xcba1('0x13'),_0x34f008,_0x30e3ad,_0x3d290f,_0x21eb96,_0x494e58);}})[_0xcba1('0x14')](function(){log(_0xcba1('0x15'),_0x34f008,_0x30e3ad,_0x3d290f,_0x21eb96,_0x494e58);});}exports[_0xcba1('0x16')]=function(_0x4a58e9,_0x2cd57a){return function(_0x3671f9,_0x56e0f6,_0x5803b1){var _0x388da4=_0x3671f9[_0xcba1('0x17')];var _0x547c31={};var _0x241632=_0x3671f9[_0xcba1('0x18')];if(_0x547c31){_0x547c31=_[_0xcba1('0x19')](_0x3671f9['body']);_0x547c31=_[_0xcba1('0x1a')](_0x547c31,['body',_0xcba1('0x1b'),'phone',_0xcba1('0x1c'),_0xcba1('0x1d')]);}updateUser(_0x388da4,_0x547c31,_0x241632,_0x4a58e9,_0x2cd57a);_0x5803b1(null);};}; \ No newline at end of file +var _0x2285=['findOne','update','info','error','tracked','user','query','clone','body','omit','html','phone','fax','mobile','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null'];(function(_0x873304,_0x34db47){var _0x2ff861=function(_0x3c1d1b){while(--_0x3c1d1b){_0x873304['push'](_0x873304['shift']());}};_0x2ff861(++_0x34db47);}(_0x2285,0x82));var _0x5228=function(_0x46ed1e,_0x1a4610){_0x46ed1e=_0x46ed1e-0x0;var _0x1ed287=_0x2285[_0x46ed1e];return _0x1ed287;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x5228('0x0'))(_0x5228('0x1')),'mail':require(_0x5228('0x0'))(_0x5228('0x2')),'fax':require('../../config/logger')(_0x5228('0x3')),'sms':require('../../config/logger')(_0x5228('0x4')),'chat':require(_0x5228('0x0'))('chat-interactions'),'whatsapp':require(_0x5228('0x0'))(_0x5228('0x5'))};function getInteractionId(_0x5b58cd,_0x51296b,_0x81054c){if(_0x5b58cd&&_0x5b58cd[_['upperFirst'](_0x81054c)+_0x5228('0x6')]){return _0x5b58cd[_[_0x5228('0x7')](_0x81054c)+'InteractionId'];}else if(_0x5b58cd&&_0x5b58cd['id']){return _0x5b58cd['id'];}else if(_0x51296b&&_0x51296b['id']){return _0x51296b['id'];}else{return _0x5228('0x8');}}function log(_0x557d65,_0x304de5,_0x3868bb,_0x5c89f8,_0x459c47,_0x92706e){loggers[_0x459c47[_0x5228('0x9')]()][_0x557d65](_0x5228('0xa'),_0x92706e[_0x5228('0xb')](),_0x304de5?_0x304de5['id']:null,_0x304de5?_0x304de5[_0x5228('0xc')]:null,_0x304de5?_0x304de5[_0x5228('0xd')]:null,getInteractionId(_0x3868bb,_0x5c89f8,_0x459c47),_0x3868bb?JSON['stringify'](_0x3868bb):_0x5228('0xe'));}function updateUser(_0x1c540a,_0xaf4e56,_0x886598,_0x4fda42,_0x58b75a){db[_['upperFirst'](_0x4fda42)+'Interaction'][_0x5228('0xf')]({'where':{'id':getInteractionId(_0xaf4e56,_0x886598,_0x4fda42)}})['then'](function(_0x2f14c0){if(_0x2f14c0){return _0x2f14c0[_0x5228('0x10')]({'UserId':_0x1c540a?_0x1c540a['id']:null});}})['then'](function(_0xa57563){if(_0xa57563){log(_0x5228('0x11'),_0x1c540a,_0xaf4e56,_0x886598,_0x4fda42,_0x58b75a);}})['catch'](function(){log(_0x5228('0x12'),_0x1c540a,_0xaf4e56,_0x886598,_0x4fda42,_0x58b75a);});}exports[_0x5228('0x13')]=function(_0x464739,_0x647c86){return function(_0x3f3a64,_0x193329,_0x41c43d){var _0x1c27c5=_0x3f3a64[_0x5228('0x14')];var _0xdb354e={};var _0x6afe60=_0x3f3a64[_0x5228('0x15')];if(_0xdb354e){_0xdb354e=_[_0x5228('0x16')](_0x3f3a64[_0x5228('0x17')]);_0xdb354e=_[_0x5228('0x18')](_0xdb354e,[_0x5228('0x17'),_0x5228('0x19'),_0x5228('0x1a'),_0x5228('0x1b'),_0x5228('0x1c')]);}updateUser(_0x1c27c5,_0xdb354e,_0x6afe60,_0x464739,_0x647c86);_0x41c43d(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 892a421..6a61c6a 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86a8=['createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','License','then','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','util','../../config/environment','license','split'];(function(_0x4efc87,_0x17a7d1){var _0x191fc4=function(_0x19dda1){while(--_0x19dda1){_0x4efc87['push'](_0x4efc87['shift']());}};_0x191fc4(++_0x17a7d1);}(_0x86a8,0x1e0));var _0x886a=function(_0x3613a9,_0x3b863b){_0x3613a9=_0x3613a9-0x0;var _0x43c7f4=_0x86a8[_0x3613a9];return _0x43c7f4;};'use strict';var crypto=require('crypto');var util=require(_0x886a('0x0'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x886a('0x1'));function getValueFromLicense(_0xe69501,_0x8efcaa){if(_0xe69501&&_0x8efcaa){if(_0x8efcaa['data1']&&_0x8efcaa[_0x886a('0x2')]){var _0x464475=_0x8efcaa['data1'];var _0x152b2e=_0x8efcaa['license'];var _0x405a71=_0x464475['split']('-')[0x4];var _0x376d72=_0x464475[_0x886a('0x3')]('-')[0x0];var _0x185342=crypto[_0x886a('0x4')](_0x886a('0x5'),util[_0x886a('0x6')](_0x886a('0x7'),_0x405a71,_0x464475,_0x376d72));var _0x55301d=_0x185342[_0x886a('0x8')](_0x152b2e,_0x886a('0x9'),_0x886a('0xa'));_0x55301d+=_0x185342[_0x886a('0xb')]('utf8');var _0x30a3fa=JSON['parse'](_0x55301d);return _0x30a3fa[_0x886a('0xc')](_0xe69501)?_0x30a3fa[_0xe69501]:null;}}return null;}function isLimit(_0x5659a9,_0x4176db,_0x458d96,_0x138cd6){var _0x2f0f4c=_0x4176db;return compose()[_0x886a('0xd')](function(_0x164213,_0x445deb,_0x26be5c){return db[_0x886a('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x886a('0xf')](function(_0x15241e){var _0x21c1b8=getValueFromLicense(_0x5659a9,_0x15241e);return _0x21c1b8?_0x21c1b8:_0x2f0f4c;})['then'](function(_0x16a1ab){_0x2f0f4c=_0x16a1ab;return _0x458d96['count'](_0x138cd6);})[_0x886a('0xf')](function(_0x7e6c76){if(_0x7e6c76>=_0x2f0f4c){return _0x445deb['status'](0x193)['json']({'message':util[_0x886a('0x6')](_0x886a('0x10'),_0x5659a9)});}_0x26be5c();})[_0x886a('0x11')](function(_0x4d8b49){_0x26be5c(_0x4d8b49);});});}function isUserLimit(){return isLimit(_0x886a('0x12'),0x1,db[_0x886a('0x13')],{'where':{'$or':[{'role':'admin'},{'role':_0x886a('0x14')}]}});}exports[_0x886a('0x15')]=isUserLimit; \ No newline at end of file +var _0x8d84=['update','utf8','final','parse','hasOwnProperty','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s'];(function(_0x5ce24f,_0x15260a){var _0x330eac=function(_0x16457f){while(--_0x16457f){_0x5ce24f['push'](_0x5ce24f['shift']());}};_0x330eac(++_0x15260a);}(_0x8d84,0x114));var _0x48d8=function(_0x2fb2dc,_0x3471da){_0x2fb2dc=_0x2fb2dc-0x0;var _0xdc9483=_0x8d84[_0x2fb2dc];return _0xdc9483;};'use strict';var crypto=require(_0x48d8('0x0'));var util=require(_0x48d8('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x48d8('0x2'));function getValueFromLicense(_0x273f5f,_0x5822df){if(_0x273f5f&&_0x5822df){if(_0x5822df['data1']&&_0x5822df[_0x48d8('0x3')]){var _0x801d1=_0x5822df[_0x48d8('0x4')];var _0x522e1c=_0x5822df['license'];var _0x57bfe1=_0x801d1[_0x48d8('0x5')]('-')[0x4];var _0x4d161f=_0x801d1[_0x48d8('0x5')]('-')[0x0];var _0x149bdf=crypto[_0x48d8('0x6')](_0x48d8('0x7'),util[_0x48d8('0x8')](_0x48d8('0x9'),_0x57bfe1,_0x801d1,_0x4d161f));var _0x4a286b=_0x149bdf[_0x48d8('0xa')](_0x522e1c,'base64',_0x48d8('0xb'));_0x4a286b+=_0x149bdf[_0x48d8('0xc')](_0x48d8('0xb'));var _0x44d302=JSON[_0x48d8('0xd')](_0x4a286b);return _0x44d302[_0x48d8('0xe')](_0x273f5f)?_0x44d302[_0x273f5f]:null;}}return null;}function isLimit(_0x15021e,_0x46188c,_0x4020fb,_0x49b02c){var _0x1a14b2=_0x46188c;return compose()['use'](function(_0x319dd3,_0x5c938b,_0x3e621d){return db['License'][_0x48d8('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x48d8('0x10')](function(_0x4c16ce){var _0x2046c9=getValueFromLicense(_0x15021e,_0x4c16ce);return _0x2046c9?_0x2046c9:_0x1a14b2;})[_0x48d8('0x10')](function(_0x24d776){_0x1a14b2=_0x24d776;return _0x4020fb[_0x48d8('0x11')](_0x49b02c);})[_0x48d8('0x10')](function(_0x29b8f9){if(_0x29b8f9>=_0x1a14b2){return _0x5c938b[_0x48d8('0x12')](0x193)[_0x48d8('0x13')]({'message':util[_0x48d8('0x8')](_0x48d8('0x14'),_0x15021e)});}_0x3e621d();})['catch'](function(_0x4040f9){_0x3e621d(_0x4040f9);});});}function isUserLimit(){return isLimit(_0x48d8('0x15'),0x1,db[_0x48d8('0x16')],{'where':{'$or':[{'role':_0x48d8('0x17')},{'role':_0x48d8('0x18')}]}});}exports[_0x48d8('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 253fd07..e46916e 100644 --- a/server/components/parsers/advancedSearch.js +++ b/server/components/parsers/advancedSearch.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef55=['$startsWith','minutes','seconds','format','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','split','forEach','shift','filter','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','$gt','$lte','add','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start'];(function(_0x122314,_0x49f526){var _0x5406cd=function(_0x40436f){while(--_0x40436f){_0x122314['push'](_0x122314['shift']());}};_0x5406cd(++_0x49f526);}(_0xef55,0xa0));var _0x5ef5=function(_0xf4770b,_0xe68669){_0xf4770b=_0xf4770b-0x0;var _0x4a672b=_0xef55[_0xf4770b];return _0x4a672b;};'use strict';var _=require(_0x5ef5('0x0'));var moment=require(_0x5ef5('0x1'));exports['parseSearch']=function(_0x64c703){var _0x22a07a={'conditions':[]};_0x22a07a[_0x5ef5('0x2')]=_[_0x5ef5('0x3')](_0x64c703,_0x5ef5('0x4'))?'or':_0x5ef5('0x5');var _0x4077a1=_0x64c703[_0x5ef5('0x6')]('[$and]','')['replace'](_0x5ef5('0x4'),'')[_0x5ef5('0x7')]('||');for(var _0x158e93=0x0;_0x158e93<_0x4077a1['length'];_0x158e93++){var _0x4a4b29=_0x4077a1[_0x158e93][_0x5ef5('0x7')](':=');var _0x324dc9=_0x4a4b29[0x0];var _0x37c88b=_0x4a4b29['slice'](0x1);_0x37c88b[_0x5ef5('0x8')](function(_0x33e306){var _0x4a4113=_0x33e306['split']('[')[_0x5ef5('0x9')]();var _0x28e2f5=_0x33e306['match'](/\[(.*?)\]/g);_0x28e2f5[_0x5ef5('0x8')](function(_0x1832b7){var _0x456525=_0x1832b7[_0x5ef5('0x7')]('[')[_0x5ef5('0xa')](function(_0x45d829){return _0x45d829[_0x5ef5('0xb')](']')>-0x1;})[_0x5ef5('0xc')](function(_0x3174ef){return _0x3174ef['split'](']')[0x0];})[0x0];_0x22a07a[_0x5ef5('0xd')][_0x5ef5('0xe')]({'field':_0x324dc9,'operator':_0x4a4113,'value':_0x456525});});});}return _0x22a07a;};exports[_0x5ef5('0xf')]=function(_0x17d406,_0x35e83d,_0x482cc1){var _0x5d33b6={};if(_0x35e83d==='DATE'){if(_0x482cc1[_0x5ef5('0x10')]===_0x5ef5('0x11')){_0x482cc1['operator']=_0x5ef5('0x12');_0x482cc1[_0x5ef5('0x13')]+=','+_0x482cc1['value'];}else if(_['includes']([_0x5ef5('0x14'),_0x5ef5('0x15')],_0x482cc1[_0x5ef5('0x10')])){_0x482cc1[_0x5ef5('0x13')]=moment(_0x482cc1[_0x5ef5('0x13')])[_0x5ef5('0x16')](0x1,'days')['format'](_0x5ef5('0x17'));}}if(_0x482cc1[_0x5ef5('0x18')]){_0x35e83d=_0x482cc1[_0x5ef5('0x18')];_0x5d33b6[_0x5ef5('0x19')]=_0x5ef5('0x1a')+_0x17d406+'.'+_0x482cc1[_0x5ef5('0x1b')]+_0x5ef5('0x1c')+_0x482cc1[_0x5ef5('0x18')]+')\x20'+parseOperator(_0x482cc1[_0x5ef5('0x10')]);}else{_0x5d33b6[_0x5ef5('0x19')]=_0x17d406+'.'+_0x482cc1[_0x5ef5('0x1b')]+'\x20'+parseOperator(_0x482cc1[_0x5ef5('0x10')]);}if(_[_0x5ef5('0x1d')]([_0x5ef5('0x1e'),_0x5ef5('0x1f')],_0x482cc1[_0x5ef5('0x10')]))_0x5d33b6['text']='('+_0x5d33b6[_0x5ef5('0x19')]+_0x5ef5('0x20')+_0x17d406+'.'+_0x482cc1[_0x5ef5('0x1b')]+'\x20IS\x20NULL)';_0x5d33b6[_0x5ef5('0x13')]=parseValue(_0x35e83d,_0x482cc1[_0x5ef5('0x10')],_0x482cc1[_0x5ef5('0x13')]);return _0x5d33b6;};function parseOperator(_0x341479){var _0x43492c;switch(_0x341479){case _0x5ef5('0x21'):_0x43492c=_0x5ef5('0x22');break;case'$notIn':_0x43492c=_0x5ef5('0x23');break;case _0x5ef5('0x11'):_0x43492c=_0x5ef5('0x24');break;case _0x5ef5('0x1e'):_0x43492c='<>\x20?';break;case _0x5ef5('0x25'):case'$startsWith':case _0x5ef5('0x26'):_0x43492c=_0x5ef5('0x27');break;case _0x5ef5('0x28'):_0x43492c=_0x5ef5('0x29');break;case _0x5ef5('0x14'):_0x43492c=_0x5ef5('0x2a');break;case _0x5ef5('0x15'):_0x43492c=_0x5ef5('0x2b');break;case _0x5ef5('0x2c'):_0x43492c=_0x5ef5('0x2d');break;case _0x5ef5('0x12'):_0x43492c=_0x5ef5('0x2e');break;}return _0x43492c;}function parseValue(_0x17cf07,_0x3f362b,_0x108cff){var _0x1cf2b7={'start':undefined,'end':undefined};switch(_0x3f362b){case'$in':case'$notIn':_0x1cf2b7[_0x5ef5('0x2f')]=_0x108cff[_0x5ef5('0x7')](',');break;case _0x5ef5('0x25'):_0x1cf2b7['start']='%'+_0x108cff+'%';break;case _0x5ef5('0x30'):_0x1cf2b7[_0x5ef5('0x2f')]=_0x108cff+'%';break;case _0x5ef5('0x26'):_0x1cf2b7[_0x5ef5('0x2f')]='%'+_0x108cff;break;case _0x5ef5('0x12'):var _0x476b4a=_0x108cff['split'](',');var _0x108cff=_0x476b4a['shift']();var _0x342470=_0x476b4a['pop']();if(_0x17cf07==='DATE'){_0x108cff=moment(_0x108cff)['utcOffset'](0x0,!![])['format']();_0x342470=moment(_0x342470)['utcOffset'](0x0,!![])[_0x5ef5('0x16')](0x17,'hours')[_0x5ef5('0x16')](0x3b,_0x5ef5('0x31'))['add'](0x3b,_0x5ef5('0x32'))[_0x5ef5('0x33')]();}_0x1cf2b7={'start':_0x108cff,'end':_0x342470};break;default:_0x1cf2b7[_0x5ef5('0x2f')]=_0x108cff;break;}return _0x1cf2b7;} \ No newline at end of file +var _0x458b=['add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$lte','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','minutes','seconds','lodash','moment','[$or]','replace','[$and]','split','length','slice','forEach','shift','match','filter','map','push','buildExpression','operator','$eq','$between','value','includes','$gt'];(function(_0x43a0bb,_0x11c9a4){var _0x125462=function(_0x56cd77){while(--_0x56cd77){_0x43a0bb['push'](_0x43a0bb['shift']());}};_0x125462(++_0x11c9a4);}(_0x458b,0x1c8));var _0xb458=function(_0x389abb,_0x241f9f){_0x389abb=_0x389abb-0x0;var _0x36d5b0=_0x458b[_0x389abb];return _0x36d5b0;};'use strict';var _=require(_0xb458('0x0'));var moment=require(_0xb458('0x1'));exports['parseSearch']=function(_0x11d95d){var _0x268fc1={'conditions':[]};_0x268fc1['sqlOperator']=_['startsWith'](_0x11d95d,_0xb458('0x2'))?'or':'and';var _0x4e5ed5=_0x11d95d[_0xb458('0x3')](_0xb458('0x4'),'')[_0xb458('0x3')](_0xb458('0x2'),'')[_0xb458('0x5')]('||');for(var _0x2680b0=0x0;_0x2680b0<_0x4e5ed5[_0xb458('0x6')];_0x2680b0++){var _0x14fa97=_0x4e5ed5[_0x2680b0][_0xb458('0x5')](':=');var _0x115a21=_0x14fa97[0x0];var _0x48bed6=_0x14fa97[_0xb458('0x7')](0x1);_0x48bed6[_0xb458('0x8')](function(_0x125699){var _0x2b7367=_0x125699[_0xb458('0x5')]('[')[_0xb458('0x9')]();var _0x3eff94=_0x125699[_0xb458('0xa')](/\[(.*?)\]/g);_0x3eff94[_0xb458('0x8')](function(_0x253886){var _0x3b8725=_0x253886[_0xb458('0x5')]('[')[_0xb458('0xb')](function(_0x1e184f){return _0x1e184f['indexOf'](']')>-0x1;})[_0xb458('0xc')](function(_0x82808f){return _0x82808f[_0xb458('0x5')](']')[0x0];})[0x0];_0x268fc1['conditions'][_0xb458('0xd')]({'field':_0x115a21,'operator':_0x2b7367,'value':_0x3b8725});});});}return _0x268fc1;};exports[_0xb458('0xe')]=function(_0x14fd8c,_0x2fbbf6,_0x3cdb47){var _0x2c1c3d={};if(_0x2fbbf6==='DATE'){if(_0x3cdb47[_0xb458('0xf')]===_0xb458('0x10')){_0x3cdb47[_0xb458('0xf')]=_0xb458('0x11');_0x3cdb47['value']+=','+_0x3cdb47[_0xb458('0x12')];}else if(_[_0xb458('0x13')]([_0xb458('0x14'),'$lte'],_0x3cdb47[_0xb458('0xf')])){_0x3cdb47[_0xb458('0x12')]=moment(_0x3cdb47[_0xb458('0x12')])[_0xb458('0x15')](0x1,'days')[_0xb458('0x16')](_0xb458('0x17'));}}if(_0x3cdb47[_0xb458('0x18')]){_0x2fbbf6=_0x3cdb47[_0xb458('0x18')];_0x2c1c3d[_0xb458('0x19')]=_0xb458('0x1a')+_0x14fd8c+'.'+_0x3cdb47[_0xb458('0x1b')]+_0xb458('0x1c')+_0x3cdb47['castTo']+')\x20'+parseOperator(_0x3cdb47[_0xb458('0xf')]);}else{_0x2c1c3d[_0xb458('0x19')]=_0x14fd8c+'.'+_0x3cdb47['field']+'\x20'+parseOperator(_0x3cdb47[_0xb458('0xf')]);}if(_[_0xb458('0x13')](['$ne',_0xb458('0x1d')],_0x3cdb47['operator']))_0x2c1c3d[_0xb458('0x19')]='('+_0x2c1c3d['text']+_0xb458('0x1e')+_0x14fd8c+'.'+_0x3cdb47[_0xb458('0x1b')]+_0xb458('0x1f');_0x2c1c3d[_0xb458('0x12')]=parseValue(_0x2fbbf6,_0x3cdb47['operator'],_0x3cdb47[_0xb458('0x12')]);return _0x2c1c3d;};function parseOperator(_0x2a5e8a){var _0xf5fa18;switch(_0x2a5e8a){case _0xb458('0x20'):_0xf5fa18=_0xb458('0x21');break;case _0xb458('0x1d'):_0xf5fa18=_0xb458('0x22');break;case _0xb458('0x10'):_0xf5fa18=_0xb458('0x23');break;case _0xb458('0x24'):_0xf5fa18='<>\x20?';break;case'$substring':case _0xb458('0x25'):case _0xb458('0x26'):_0xf5fa18='LIKE\x20?';break;case _0xb458('0x27'):_0xf5fa18=_0xb458('0x28');break;case _0xb458('0x14'):_0xf5fa18=_0xb458('0x29');break;case _0xb458('0x2a'):_0xf5fa18='<=\x20?';break;case _0xb458('0x2b'):_0xf5fa18=_0xb458('0x2c');break;case _0xb458('0x11'):_0xf5fa18=_0xb458('0x2d');break;}return _0xf5fa18;}function parseValue(_0x3fb1ae,_0x2d722f,_0x4bea82){var _0x5dae72={'start':undefined,'end':undefined};switch(_0x2d722f){case _0xb458('0x20'):case'$notIn':_0x5dae72[_0xb458('0x2e')]=_0x4bea82[_0xb458('0x5')](',');break;case _0xb458('0x2f'):_0x5dae72[_0xb458('0x2e')]='%'+_0x4bea82+'%';break;case _0xb458('0x25'):_0x5dae72[_0xb458('0x2e')]=_0x4bea82+'%';break;case _0xb458('0x26'):_0x5dae72['start']='%'+_0x4bea82;break;case _0xb458('0x11'):var _0x14e90e=_0x4bea82[_0xb458('0x5')](',');var _0x4bea82=_0x14e90e[_0xb458('0x9')]();var _0x5b95ac=_0x14e90e[_0xb458('0x30')]();if(_0x3fb1ae==='DATE'){_0x4bea82=moment(_0x4bea82)[_0xb458('0x31')](0x0,!![])[_0xb458('0x16')]();_0x5b95ac=moment(_0x5b95ac)[_0xb458('0x31')](0x0,!![])[_0xb458('0x15')](0x17,_0xb458('0x32'))[_0xb458('0x15')](0x3b,_0xb458('0x33'))['add'](0x3b,_0xb458('0x34'))[_0xb458('0x16')]();}_0x5dae72={'start':_0x4bea82,'end':_0x5b95ac};break;default:_0x5dae72[_0xb458('0x2e')]=_0x4bea82;break;}return _0x5dae72;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d9e2670..d8430c0 100644 --- a/server/components/parsers/qs.js +++ b/server/components/parsers/qs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b20=['sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','ASC','omit','length','isObject','isString','unset','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','join','getOptions','$id','query','model','name','attributes','intersection','fields','nolimit','limit','order','pick','object','filter','columns','value','where','VIRTUAL','lower','merge','options','sequelize','moment','parse','keys','includes','split','filters','isEmpty','forOwn','type','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','isArray','offset'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x1b20,0x66));var _0x01b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1b20[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var sequelize=require(_0x01b2('0x0'));var moment=require(_0x01b2('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4a27f9){var _0x54eccf=['ne'];try{var _0x27a406=JSON[_0x01b2('0x2')](_0x4a27f9);var _0x2d6e99=Object[_0x01b2('0x3')](_0x27a406)[0x0];return _0x54eccf[_0x01b2('0x4')](_0x2d6e99);}catch(_0x365550){return![];}}function getOperatorValue(_0x419c17){var _0x28de4a=JSON[_0x01b2('0x2')](_0x419c17);var _0xa64ad1=Object[_0x01b2('0x3')](_0x28de4a)[0x0];var _0x323470=_0x28de4a[_0xa64ad1];return{['$'+_0xa64ad1]:_0x323470};}exports['fields']=function(_0x132a08){var _0x591ec0=null;if(_0x132a08){_0x591ec0=_0x132a08[_0x01b2('0x5')](',');}return _0x591ec0;};exports[_0x01b2('0x6')]=function(_0x3bad99,_0x3338f6){var _0x9c411f={};if(!_[_0x01b2('0x7')](_0x3bad99)){_[_0x01b2('0x8')](_0x3bad99,function(_0x22319b,_0x55804c){try{if(_0x3338f6){var _0x3c0044=_['find'](_0x3338f6,{'name':_0x55804c})||{};if(hasSequelizeOperator(_0x22319b)){_0x9c411f[_0x55804c]=getOperatorValue(_0x22319b);}else if(_0x3c0044[_0x01b2('0x9')]==='DATE'&&_[_0x01b2('0xa')](_0x22319b)){var _0x8ac569=JSON[_0x01b2('0x2')](_0x22319b);var _0x5ed1e2={'$gte':moment(moment(_0x8ac569['$gte'])[_0x01b2('0xb')](_0x01b2('0xc')))[_0x01b2('0xd')]()[_0x01b2('0xb')](),'$lte':moment(moment(_0x8ac569[_0x01b2('0xe')])['format'](_0x01b2('0xc')))[_0x01b2('0xd')]()[_0x01b2('0xf')](0x1,'s')[_0x01b2('0xb')]()};_0x9c411f[_0x55804c]=_0x5ed1e2;}else if(_0x3c0044['name']==='uniqueid'){_0x9c411f[_0x55804c]=_0x22319b;}else{_0x9c411f[_0x55804c]=_[_0x01b2('0x10')](_0x22319b)?_0x22319b:JSON[_0x01b2('0x2')](_0x22319b);}}else{_0x9c411f[_0x55804c]=_['isArray'](_0x22319b)?_0x22319b:JSON[_0x01b2('0x2')](_0x22319b);}}catch(_0x444236){_0x9c411f[_0x55804c]=_0x22319b[_0x01b2('0x5')](',');}});}return _0x9c411f;};exports['limit']=function(_0x25c55f){_0x25c55f=parseInt(_0x25c55f,0xa);if(!_0x25c55f||_0x25c55f<0x0){_0x25c55f=LIMIT_VALUE;}return _0x25c55f;};exports[_0x01b2('0x11')]=function(_0x38c4c8){_0x38c4c8=parseInt(_0x38c4c8,0xa);if(!_0x38c4c8||_0x38c4c8<0x0){_0x38c4c8=0x0;}return _0x38c4c8;};exports[_0x01b2('0x12')]=function(_0x1391f5){var _0x56ea3c,_0xfbd5db=null;if(_0x1391f5){_0x56ea3c=_0x1391f5['split'](',');_0xfbd5db=_[_0x01b2('0x13')](_0x56ea3c,function(_0x4c0008){if(_0x4c0008[_0x01b2('0x14')]('-')===0x0){return[_0x4c0008===_0x01b2('0x15')?sequelize[_0x01b2('0x16')](sequelize['col'](_0x01b2('0x15')),_0x01b2('0x17')):_0x4c0008[_0x01b2('0x18')](0x1),_0x01b2('0x19')];}else{return[_0x4c0008===_0x01b2('0x15')?sequelize['cast'](sequelize[_0x01b2('0x1a')]('priority'),'unsigned'):_0x4c0008,_0x01b2('0x1b')];}});}return _0xfbd5db;};exports[_0x01b2('0x1c')]=function(_0x3fcb69,_0x1d2e56){if(_[_0x01b2('0x7')](_0x3fcb69)){return _0x3fcb69;}if(_[_0x01b2('0x10')](_0x3fcb69)){for(var _0x4920f7=0x0;_0x4920f7<_0x3fcb69[_0x01b2('0x1d')];_0x4920f7+=0x1){_0x3fcb69[_0x4920f7]=this[_0x01b2('0x1c')](_0x3fcb69[_0x4920f7],_0x1d2e56);}return _0x3fcb69;}if(!_[_0x01b2('0x1e')](_0x3fcb69)){return _0x3fcb69;}if(_[_0x01b2('0x1f')](_0x1d2e56)){_0x1d2e56=[_0x1d2e56];}if(!_['isArray'](_0x1d2e56)){return _0x3fcb69;}for(var _0x45290e=0x0;_0x45290e<_0x1d2e56['length'];_0x45290e+=0x1){_[_0x01b2('0x20')](_0x3fcb69,_0x1d2e56[_0x45290e]);}for(var _0x1e6ac2 in _0x3fcb69){if(_0x3fcb69['hasOwnProperty'](_0x1e6ac2)){_0x3fcb69[_0x1e6ac2]=this[_0x01b2('0x1c')](_0x3fcb69[_0x1e6ac2],_0x1d2e56);}}return _0x3fcb69;};exports['isNumeric']=function(_0x487c49){return _0x487c49[_0x01b2('0x21')](RegExp(_0x01b2('0x22')))?!![]:![];};exports['isEmail']=function(_0x24ed7d){return _0x24ed7d[_0x01b2('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0x01b2('0x23')]=function(_0x2cf50f){var _0x3009a6=[];_0x2cf50f[_0x01b2('0x5')](/[ ,]+/)[_0x01b2('0x24')](function(_0x3169f5){_0x3169f5=_0x3169f5[_0x01b2('0x25')](/([^:]")"+/g,'$1');_0x3169f5='+'+_0x3169f5+'*';var _0x11d8e5=/[ `!@#$%^&*()_\-?~]/;if(_0x3169f5[_0x01b2('0x21')](_0x11d8e5))_0x3169f5='\x22'+_0x3169f5+'\x22';_0x3009a6['push'](_0x3169f5);});return _0x3009a6[_0x01b2('0x26')]('\x20');};exports[_0x01b2('0x27')]=function(_0x1c4ab5,_0x3081ed,_0x306666){var _0x11dd4e={},_0x582dd1={};if(_0x3081ed['query'][_0x01b2('0x28')]){_0x3081ed['query']['id']=_0x3081ed['query'][_0x01b2('0x28')];delete _0x3081ed[_0x01b2('0x29')][_0x01b2('0x28')];}_0x11dd4e[_0x01b2('0x2a')]=_['map'](_0x1c4ab5,_0x01b2('0x2b'));_0x11dd4e['query']=_[_0x01b2('0x3')](_0x3081ed['query']);_0x11dd4e['filters']=_['intersection'](_0x11dd4e[_0x01b2('0x2a')],_0x11dd4e[_0x01b2('0x29')]);_0x582dd1[_0x01b2('0x2c')]=_[_0x01b2('0x2d')](_0x11dd4e['model'],this[_0x01b2('0x2e')](_0x3081ed[_0x01b2('0x29')]['fields']));_0x582dd1[_0x01b2('0x2c')]=_0x582dd1[_0x01b2('0x2c')][_0x01b2('0x1d')]?_0x582dd1[_0x01b2('0x2c')]:_0x11dd4e[_0x01b2('0x2a')];if(!_0x3081ed[_0x01b2('0x29')]['hasOwnProperty'](_0x01b2('0x2f'))){_0x582dd1[_0x01b2('0x30')]=this['limit'](_0x3081ed['query'][_0x01b2('0x30')]);_0x582dd1[_0x01b2('0x11')]=this[_0x01b2('0x11')](_0x3081ed[_0x01b2('0x29')][_0x01b2('0x11')]);}_0x582dd1[_0x01b2('0x31')]=this['sort'](_0x3081ed['query'][_0x01b2('0x12')]);_0x582dd1['where']=this[_0x01b2('0x6')](_[_0x01b2('0x32')](_0x3081ed[_0x01b2('0x29')],_0x11dd4e[_0x01b2('0x6')]),_0x1c4ab5);if(_0x3081ed[_0x01b2('0x29')]['filter']){var _0x279ce0=_0x1c4ab5;var _0x183585=_0x3081ed[_0x01b2('0x29')]['filter'];if(typeof _0x183585===_0x01b2('0x33')){_0x279ce0=_[_0x01b2('0x34')](_0x1c4ab5,function(_0x28a0f4){return _['includes'](_0x183585[_0x01b2('0x35')],_0x28a0f4['name']);});_0x183585=_0x183585[_0x01b2('0x36')];}_0x582dd1[_0x01b2('0x37')]=_['merge'](_0x582dd1[_0x01b2('0x37')],{'$or':_[_0x01b2('0x13')](_0x279ce0,function(_0x4da4aa){if(_0x4da4aa[_0x01b2('0x9')]!==_0x01b2('0x38')){if(_0x306666){return sequelize[_0x01b2('0x37')](sequelize['fn'](_0x01b2('0x39'),sequelize[_0x01b2('0x1a')](_0x4da4aa['name'])),{'$like':sequelize['fn'](_0x01b2('0x39'),'%'+_0x3081ed[_0x01b2('0x29')][_0x01b2('0x34')]+'%')});}else{var _0x5d1b39={};_0x5d1b39[_0x4da4aa[_0x01b2('0x2b')]]={'$like':'%'+_0x3081ed[_0x01b2('0x29')][_0x01b2('0x34')]+'%'};return _0x5d1b39;}}})});}_0x582dd1=_[_0x01b2('0x3a')]({},_0x582dd1,_0x3081ed[_0x01b2('0x3b')]);return _0x582dd1;}; \ No newline at end of file +var _0x81bd=['lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','isPlainObject','format','utc','$lte','YYYY-MM-DD','subtract','uniqueid','isArray','limit','offset','sort','indexOf','priority','cast','unsigned','DESC','col','ASC','omit','length','isObject','isString','unset','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','join','getOptions','query','$id','map','name','intersection','model','attributes','nolimit','where','pick','filter','object','columns','value','merge','VIRTUAL'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x81bd,0x7c));var _0xd81b=function(_0x1bb80c,_0x26d406){_0x1bb80c=_0x1bb80c-0x0;var _0x368f16=_0x81bd[_0x1bb80c];return _0x368f16;};'use strict';var _=require(_0xd81b('0x0'));var sequelize=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2337b1){var _0x2d27cb=['ne'];try{var _0x2ec03a=JSON[_0xd81b('0x3')](_0x2337b1);var _0x54e096=Object[_0xd81b('0x4')](_0x2ec03a)[0x0];return _0x2d27cb[_0xd81b('0x5')](_0x54e096);}catch(_0x1b6cfe){return![];}}function getOperatorValue(_0x4d8e7e){var _0x42a0aa=JSON[_0xd81b('0x3')](_0x4d8e7e);var _0x1f3f2c=Object['keys'](_0x42a0aa)[0x0];var _0x5e14e8=_0x42a0aa[_0x1f3f2c];return{['$'+_0x1f3f2c]:_0x5e14e8};}exports[_0xd81b('0x6')]=function(_0x5468d5){var _0x223515=null;if(_0x5468d5){_0x223515=_0x5468d5[_0xd81b('0x7')](',');}return _0x223515;};exports[_0xd81b('0x8')]=function(_0x86dab6,_0x17fba4){var _0x1ff60f={};if(!_[_0xd81b('0x9')](_0x86dab6)){_[_0xd81b('0xa')](_0x86dab6,function(_0x2090e1,_0x23c789){try{if(_0x17fba4){var _0x215b92=_[_0xd81b('0xb')](_0x17fba4,{'name':_0x23c789})||{};if(hasSequelizeOperator(_0x2090e1)){_0x1ff60f[_0x23c789]=getOperatorValue(_0x2090e1);}else if(_0x215b92[_0xd81b('0xc')]==='DATE'&&_[_0xd81b('0xd')](_0x2090e1)){var _0x57f71d=JSON[_0xd81b('0x3')](_0x2090e1);var _0xe75568={'$gte':moment(moment(_0x57f71d['$gte'])[_0xd81b('0xe')]('YYYY-MM-DD'))[_0xd81b('0xf')]()[_0xd81b('0xe')](),'$lte':moment(moment(_0x57f71d[_0xd81b('0x10')])[_0xd81b('0xe')](_0xd81b('0x11')))['utc']()[_0xd81b('0x12')](0x1,'s')[_0xd81b('0xe')]()};_0x1ff60f[_0x23c789]=_0xe75568;}else if(_0x215b92['name']===_0xd81b('0x13')){_0x1ff60f[_0x23c789]=_0x2090e1;}else{_0x1ff60f[_0x23c789]=_[_0xd81b('0x14')](_0x2090e1)?_0x2090e1:JSON[_0xd81b('0x3')](_0x2090e1);}}else{_0x1ff60f[_0x23c789]=_[_0xd81b('0x14')](_0x2090e1)?_0x2090e1:JSON[_0xd81b('0x3')](_0x2090e1);}}catch(_0xc49b8d){_0x1ff60f[_0x23c789]=_0x2090e1[_0xd81b('0x7')](',');}});}return _0x1ff60f;};exports[_0xd81b('0x15')]=function(_0x1c34c5){_0x1c34c5=parseInt(_0x1c34c5,0xa);if(!_0x1c34c5||_0x1c34c5<0x0){_0x1c34c5=LIMIT_VALUE;}return _0x1c34c5;};exports[_0xd81b('0x16')]=function(_0x1ff3c6){_0x1ff3c6=parseInt(_0x1ff3c6,0xa);if(!_0x1ff3c6||_0x1ff3c6<0x0){_0x1ff3c6=0x0;}return _0x1ff3c6;};exports[_0xd81b('0x17')]=function(_0xfa27e0){var _0x3518f0,_0x156894=null;if(_0xfa27e0){_0x3518f0=_0xfa27e0[_0xd81b('0x7')](',');_0x156894=_['map'](_0x3518f0,function(_0x4d566e){if(_0x4d566e[_0xd81b('0x18')]('-')===0x0){return[_0x4d566e===_0xd81b('0x19')?sequelize[_0xd81b('0x1a')](sequelize['col'](_0xd81b('0x19')),_0xd81b('0x1b')):_0x4d566e['substr'](0x1),_0xd81b('0x1c')];}else{return[_0x4d566e===_0xd81b('0x19')?sequelize[_0xd81b('0x1a')](sequelize[_0xd81b('0x1d')](_0xd81b('0x19')),_0xd81b('0x1b')):_0x4d566e,_0xd81b('0x1e')];}});}return _0x156894;};exports[_0xd81b('0x1f')]=function(_0x341aec,_0x212c4e){if(_[_0xd81b('0x9')](_0x341aec)){return _0x341aec;}if(_[_0xd81b('0x14')](_0x341aec)){for(var _0x596389=0x0;_0x596389<_0x341aec[_0xd81b('0x20')];_0x596389+=0x1){_0x341aec[_0x596389]=this[_0xd81b('0x1f')](_0x341aec[_0x596389],_0x212c4e);}return _0x341aec;}if(!_[_0xd81b('0x21')](_0x341aec)){return _0x341aec;}if(_[_0xd81b('0x22')](_0x212c4e)){_0x212c4e=[_0x212c4e];}if(!_[_0xd81b('0x14')](_0x212c4e)){return _0x341aec;}for(var _0x2d0d02=0x0;_0x2d0d02<_0x212c4e[_0xd81b('0x20')];_0x2d0d02+=0x1){_[_0xd81b('0x23')](_0x341aec,_0x212c4e[_0x2d0d02]);}for(var _0x10a561 in _0x341aec){if(_0x341aec['hasOwnProperty'](_0x10a561)){_0x341aec[_0x10a561]=this[_0xd81b('0x1f')](_0x341aec[_0x10a561],_0x212c4e);}}return _0x341aec;};exports['isNumeric']=function(_0x5c8aee){return _0x5c8aee[_0xd81b('0x24')](RegExp(_0xd81b('0x25')))?!![]:![];};exports['isEmail']=function(_0x481454){return _0x481454[_0xd81b('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xd81b('0x26')]=function(_0x1b1434){var _0x289f54=[];_0x1b1434[_0xd81b('0x7')](/[ ,]+/)[_0xd81b('0x27')](function(_0x5527ed){_0x5527ed=_0x5527ed[_0xd81b('0x28')](/([^:]")"+/g,'$1');_0x5527ed='+'+_0x5527ed+'*';var _0x26f629=/[ `!@#$%^&*()_\-?~]/;if(_0x5527ed['match'](_0x26f629))_0x5527ed='\x22'+_0x5527ed+'\x22';_0x289f54['push'](_0x5527ed);});return _0x289f54[_0xd81b('0x29')]('\x20');};exports[_0xd81b('0x2a')]=function(_0x50472a,_0x50ce25,_0x5317b2){var _0x322991={},_0x3ead68={};if(_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x2c')]){_0x50ce25[_0xd81b('0x2b')]['id']=_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x2c')];delete _0x50ce25['query'][_0xd81b('0x2c')];}_0x322991['model']=_[_0xd81b('0x2d')](_0x50472a,_0xd81b('0x2e'));_0x322991[_0xd81b('0x2b')]=_[_0xd81b('0x4')](_0x50ce25[_0xd81b('0x2b')]);_0x322991[_0xd81b('0x8')]=_[_0xd81b('0x2f')](_0x322991[_0xd81b('0x30')],_0x322991[_0xd81b('0x2b')]);_0x3ead68[_0xd81b('0x31')]=_[_0xd81b('0x2f')](_0x322991[_0xd81b('0x30')],this[_0xd81b('0x6')](_0x50ce25['query']['fields']));_0x3ead68[_0xd81b('0x31')]=_0x3ead68[_0xd81b('0x31')][_0xd81b('0x20')]?_0x3ead68['attributes']:_0x322991[_0xd81b('0x30')];if(!_0x50ce25[_0xd81b('0x2b')]['hasOwnProperty'](_0xd81b('0x32'))){_0x3ead68[_0xd81b('0x15')]=this['limit'](_0x50ce25[_0xd81b('0x2b')]['limit']);_0x3ead68[_0xd81b('0x16')]=this[_0xd81b('0x16')](_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x16')]);}_0x3ead68['order']=this[_0xd81b('0x17')](_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x17')]);_0x3ead68[_0xd81b('0x33')]=this[_0xd81b('0x8')](_[_0xd81b('0x34')](_0x50ce25[_0xd81b('0x2b')],_0x322991['filters']),_0x50472a);if(_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x35')]){var _0x5185fe=_0x50472a;var _0x5065a0=_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x35')];if(typeof _0x5065a0===_0xd81b('0x36')){_0x5185fe=_[_0xd81b('0x35')](_0x50472a,function(_0x29bddd){return _['includes'](_0x5065a0[_0xd81b('0x37')],_0x29bddd[_0xd81b('0x2e')]);});_0x5065a0=_0x5065a0[_0xd81b('0x38')];}_0x3ead68[_0xd81b('0x33')]=_[_0xd81b('0x39')](_0x3ead68[_0xd81b('0x33')],{'$or':_[_0xd81b('0x2d')](_0x5185fe,function(_0x486f0d){if(_0x486f0d[_0xd81b('0xc')]!==_0xd81b('0x3a')){if(_0x5317b2){return sequelize[_0xd81b('0x33')](sequelize['fn']('lower',sequelize[_0xd81b('0x1d')](_0x486f0d[_0xd81b('0x2e')])),{'$like':sequelize['fn'](_0xd81b('0x3b'),'%'+_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x35')]+'%')});}else{var _0x194d2a={};_0x194d2a[_0x486f0d[_0xd81b('0x2e')]]={'$like':'%'+_0x50ce25[_0xd81b('0x2b')]['filter']+'%'};return _0x194d2a;}}})});}_0x3ead68=_['merge']({},_0x3ead68,_0x50ce25[_0xd81b('0x3c')]);return _0x3ead68;}; \ No newline at end of file diff --git a/server/config/environment/development.js b/server/config/environment/development.js index d5e896a..0e0283b 100644 --- a/server/config/environment/development.js +++ b/server/config/environment/development.js @@ -11,9 +11,9 @@ module.exports = { sequelize: { database: 'motion2', username: 'xcall', - password: 'xC@LL1234', + password: 'Zh3r)S~{2sNfLS@59mq>K>LLGZA{w*./', options: { - host: '127.0.0.1', + host: '192.168.1.102', port: 3306, dialect: 'mysql', dialectOptions: { @@ -30,9 +30,9 @@ module.exports = { sequelizeHistory: { database: 'motion2', username: 'xcall', - password: 'xC@LL1234', + password: 'Zh3r)S~{2sNfLS@59mq>K>LLGZA{w*./', options: { - host: '127.0.0.1', + host: '192.168.1.102', port: 3306, dialect: 'mysql', dialectOptions: { @@ -47,9 +47,9 @@ module.exports = { } }, asterisk: { - ip: '127.0.0.1', + ip: '192.168.1.102', port: '5038', - username: 'xcall', + username: 'xcalldev', password: 'xcall1234' }, redis: { @@ -86,5 +86,6 @@ module.exports = { baseDN: process.env.AD_BASEDN || '', url: process.env.AD_URL, domain: process.env.AD_DOMAIN - } + }, + licenseToken: 'bb4dd06b-6faf-5595-0a6c-27cbc9946862' }; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 508eff6..159f555 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x519ea7,_0x26a415){var _0x2b5043=function(_0x180324){while(--_0x180324){_0x519ea7['push'](_0x519ea7['shift']());}};_0x2b5043(++_0x26a415);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 8c607d1..bbfc977 100644 --- a/server/config/license/hardware.js +++ b/server/config/license/hardware.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa979=['crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','concat','mac','address','cpus','map','model','join','createHash','md5','update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xa979,0x175));var _0x9a97=function(_0x2bf4de,_0x49bb74){_0x2bf4de=_0x2bf4de-0x0;var _0x291701=_0xa979[_0x2bf4de];return _0x291701;};'use strict';var _=require(_0x9a97('0x0'));var os=require('os');var crypto=require(_0x9a97('0x1'));var machine=require(_0x9a97('0x2'));var exec=require('child_process')[_0x9a97('0x3')];var config=require(_0x9a97('0x4'));function getInterfaces(){var _0x253189=[];var _0x20659c=os[_0x9a97('0x5')]();var _0x3586df=_[_0x9a97('0x6')](_[_0x9a97('0x7')](_0x20659c));for(var _0x3a5a58=0x0;_0x3a5a58<_0x3586df[_0x9a97('0x8')];_0x3a5a58++){var _0x271fb2=_0x20659c[_0x3586df[_0x3a5a58]][_0x9a97('0x9')](function(_0xf19eed){return _0xf19eed['family']===_0x9a97('0xa')&&_0xf19eed[_0x9a97('0xb')]===![];});_0x253189=_0x253189[_0x9a97('0xc')](_0x271fb2);}return _0x253189;}function getFirstInterface(){var _0x40cf9d=_['head'](getInterfaces());return{'macAddress':_0x40cf9d&&_0x40cf9d[_0x9a97('0xd')]?_0x40cf9d[_0x9a97('0xd')]:'00:00:00:00:00:00','ipAddress':_0x40cf9d&&_0x40cf9d['address']?_0x40cf9d[_0x9a97('0xe')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xf8d75d=_[_0x9a97('0x6')](os[_0x9a97('0xf')]()[_0x9a97('0x10')](function(_0x4de302){return _0x4de302[_0x9a97('0x11')];}))[_0x9a97('0x12')](':');return crypto[_0x9a97('0x13')](_0x9a97('0x14'))[_0x9a97('0x15')](_0xf8d75d)[_0x9a97('0x16')](_0x9a97('0x17'));}exports['getUuid']=function(){var _0x32c197=os[_0x9a97('0x18')]();var _0x4b19bf=/[0-9a-f-]{36}/;if(config[_0x9a97('0x19')]&&_0x4b19bf[_0x9a97('0x1a')](config[_0x9a97('0x19')])){return config[_0x9a97('0x19')];}else if(_0x32c197===_0x9a97('0x1b')){return exec(_0x9a97('0x1c'),{'encoding':_0x9a97('0x1d')})[_0x9a97('0x1e')]('\x0d\x0a','');}else{var _0x25ee8d=getFirstInterface();var _0x4b795b=getCPUhash();var _0x18de24=_0x4b795b+'|'+os['hostname']()+'|'+_0x25ee8d[_0x9a97('0x1f')]+'|'+_0x25ee8d[_0x9a97('0x20')];var _0x122575=crypto['createHash'](_0x9a97('0x14'))[_0x9a97('0x15')](_0x18de24)[_0x9a97('0x16')](_0x9a97('0x17'));return _0x122575[_0x9a97('0x21')](0x0,0x8)+'-'+_0x122575[_0x9a97('0x21')](0x8,0xc)+'-'+_0x122575['substring'](0xc,0x10)+'-'+_0x122575[_0x9a97('0x21')](0x10,0x14)+'-'+_0x122575['substring'](0x14);}}; \ No newline at end of file +var _0xf3f8=['substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','internal','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','update','digest','hex','platform','licenseToken','win32','utf8','replace','macAddress'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0xf3f8,0x169));var _0x8f3f=function(_0xe17656,_0x310796){_0xe17656=_0xe17656-0x0;var _0x1b6340=_0xf3f8[_0xe17656];return _0x1b6340;};'use strict';var _=require(_0x8f3f('0x0'));var os=require('os');var crypto=require(_0x8f3f('0x1'));var machine=require(_0x8f3f('0x2'));var exec=require(_0x8f3f('0x3'))[_0x8f3f('0x4')];var config=require(_0x8f3f('0x5'));function getInterfaces(){var _0xf0a229=[];var _0x4222e8=os[_0x8f3f('0x6')]();var _0x4453f3=_[_0x8f3f('0x7')](_[_0x8f3f('0x8')](_0x4222e8));for(var _0x5957e2=0x0;_0x5957e2<_0x4453f3['length'];_0x5957e2++){var _0x406bb6=_0x4222e8[_0x4453f3[_0x5957e2]]['filter'](function(_0x147bc3){return _0x147bc3['family']==='IPv4'&&_0x147bc3[_0x8f3f('0x9')]===![];});_0xf0a229=_0xf0a229['concat'](_0x406bb6);}return _0xf0a229;}function getFirstInterface(){var _0x2b3bae=_['head'](getInterfaces());return{'macAddress':_0x2b3bae&&_0x2b3bae['mac']?_0x2b3bae[_0x8f3f('0xa')]:_0x8f3f('0xb'),'ipAddress':_0x2b3bae&&_0x2b3bae[_0x8f3f('0xc')]?_0x2b3bae['address']:_0x8f3f('0xd')};}exports[_0x8f3f('0xe')]=getFirstInterface;function getCPUhash(){var _0x3942e2=_[_0x8f3f('0x7')](os[_0x8f3f('0xf')]()['map'](function(_0x5e955b){return _0x5e955b[_0x8f3f('0x10')];}))[_0x8f3f('0x11')](':');return crypto[_0x8f3f('0x12')](_0x8f3f('0x13'))[_0x8f3f('0x14')](_0x3942e2)[_0x8f3f('0x15')](_0x8f3f('0x16'));}exports['getUuid']=function(){var _0x48b9f4=os[_0x8f3f('0x17')]();var _0x4fc522=/[0-9a-f-]{36}/;if(config[_0x8f3f('0x18')]&&_0x4fc522['test'](config['licenseToken'])){return config[_0x8f3f('0x18')];}else if(_0x48b9f4===_0x8f3f('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x8f3f('0x1a')})[_0x8f3f('0x1b')]('\x0d\x0a','');}else{var _0x12d8e8=getFirstInterface();var _0x53a1ad=getCPUhash();var _0x44cc2c=_0x53a1ad+'|'+os['hostname']()+'|'+_0x12d8e8[_0x8f3f('0x1c')]+'|'+_0x12d8e8['ipAddress'];var _0x521a81=crypto[_0x8f3f('0x12')](_0x8f3f('0x13'))[_0x8f3f('0x14')](_0x44cc2c)[_0x8f3f('0x15')](_0x8f3f('0x16'));return _0x521a81[_0x8f3f('0x1d')](0x0,0x8)+'-'+_0x521a81[_0x8f3f('0x1d')](0x8,0xc)+'-'+_0x521a81[_0x8f3f('0x1d')](0xc,0x10)+'-'+_0x521a81['substring'](0x10,0x14)+'-'+_0x521a81[_0x8f3f('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index f123b35..ee77373 100644 --- a/server/config/license/index.js +++ b/server/config/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba67=['info','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','format','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','default','util','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','%s/api/servers/%s/check?version=%s','exports','GET','catch','get','data2','data1','then','active','license','Disabled'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0xba67,0x15d));var _0x7ba6=function(_0x5e0f72,_0x39bc91){_0x5e0f72=_0x5e0f72-0x0;var _0x3539be=_0xba67[_0x5e0f72];return _0x3539be;};'use strict';var util=require(_0x7ba6('0x0'));var moment=require(_0x7ba6('0x1'));var rp=require(_0x7ba6('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x7ba6('0x3'))(module,_0x7ba6('0x4'));var db=require(_0x7ba6('0x5'))['db'];var encryptor=require(_0x7ba6('0x6'));var hardware=require(_0x7ba6('0x7'));var logger=require(_0x7ba6('0x8'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x35c7f7){return new BPromise(function(_0x3e4ecc,_0x55c899){var _0x2419be=util['format'](_0x7ba6('0x9'),HOST,_0x35c7f7,module['exports'][_0x7ba6('0x4')]);if(oldToken){_0x2419be=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x35c7f7,module[_0x7ba6('0xa')][_0x7ba6('0x4')],oldToken);}var _0x304f69={'uri':_0x2419be,'method':_0x7ba6('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x304f69)['then'](function(_0x2c98bd){_0x3e4ecc(_0x2c98bd);})[_0x7ba6('0xc')](function(_0x515e25){_0x55c899(_0x515e25);});});}function manageLicense(_0x139420,_0x3b51dd){var _0x1cb83f=_0x3b51dd[_0x7ba6('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x1cb83f['data1']!==_0x139420&&!_0x1cb83f[_0x7ba6('0xe')]){oldToken=_0x1cb83f[_0x7ba6('0xf')];}httpRequest(_0x139420)[_0x7ba6('0x10')](function(_0x34dac5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x34dac5[_0x7ba6('0x11')]){isOldTokenSent=![];if(!_0x1cb83f[_0x7ba6('0x12')]&&_0x1cb83f[_0x7ba6('0x12')]!=_0x34dac5[_0x7ba6('0x12')]||_0x1cb83f[_0x7ba6('0x12')]&&_0x1cb83f[_0x7ba6('0xe')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x1cb83f['license']&&!_0x1cb83f[_0x7ba6('0xe')]&&_0x1cb83f[_0x7ba6('0x12')]!=_0x34dac5[_0x7ba6('0x12')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x1cb83f[_0x7ba6('0x12')]&&!_0x1cb83f['data2']&&_0x1cb83f['license']==_0x34dac5[_0x7ba6('0x12')]){return _0x3b51dd;}return _0x3b51dd['update']({'data1':_0x139420,'data2':null,'license':_0x34dac5[_0x7ba6('0x12')]});}else{if(_0x34dac5[_0x7ba6('0x12')]||_0x1cb83f[_0x7ba6('0x12')]){if(!_0x1cb83f[_0x7ba6('0xe')]){if(_0x1cb83f['data1']==_0x139420){GRAY_PERIOD_REASON=_0x7ba6('0x13');logger[_0x7ba6('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x7ba6('0x15');logger[_0x7ba6('0x14')](_0x7ba6('0x16'),_0x1cb83f['data1'],_0x139420);}logger[_0x7ba6('0x14')](_0x7ba6('0x17'),GRAY_PERIOD_REASON[_0x7ba6('0x18')](),moment()[_0x7ba6('0x19')](_0x7ba6('0x1a')));return _0x3b51dd[_0x7ba6('0x1b')]({'data2':encryptor[_0x7ba6('0x1c')](moment()[_0x7ba6('0x19')](_0x7ba6('0x1a')))});}else{if(moment()[_0x7ba6('0x1d')](encryptor[_0x7ba6('0x1e')](_0x1cb83f[_0x7ba6('0xe')]),_0x7ba6('0x1f'))>DAYS){logger['info'](_0x7ba6('0x20'),moment()[_0x7ba6('0x19')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x3b51dd[_0x7ba6('0x1b')]({'data1':_0x139420,'data2':null,'license':null});}}}else{if(_0x1cb83f[_0x7ba6('0xf')]!=_0x139420){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1cb83f['data1'],_0x139420);return _0x3b51dd['update']({'data1':_0x139420,'data2':null,'license':null});}}}return _0x3b51dd;})[_0x7ba6('0x10')](function(_0x304df5){_0x3b51dd=_0x304df5;})[_0x7ba6('0xc')](function(_0x108e73){logger[_0x7ba6('0x21')](_0x108e73[_0x7ba6('0x22')]);})[_0x7ba6('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x7ba6('0x24')](),_0x3b51dd);},TIME);});}function defaultLicense(){var _0x2172fc=hardware['getUuid']();if(_0x2172fc){return db[_0x7ba6('0x25')][_0x7ba6('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x2172fc}})[_0x7ba6('0x27')](function(_0x59ce3f,_0x61c18a){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x2172fc);manageLicense(_0x2172fc,_0x59ce3f);})['catch'](function(_0x207eee){logger['error'](_0x207eee[_0x7ba6('0x22')]);});}}exports[_0x7ba6('0x28')]=defaultLicense; \ No newline at end of file +var _0xef4b=['format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','encryptString','YYYY-MM-DD\x20HH:mm','diff','days','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com'];(function(_0x7b4399,_0x3927df){var _0x4136b6=function(_0x21a50d){while(--_0x21a50d){_0x7b4399['push'](_0x7b4399['shift']());}};_0x4136b6(++_0x3927df);}(_0xef4b,0xb5));var _0xbef4=function(_0x38e730,_0x2e63b6){_0x38e730=_0x38e730-0x0;var _0x29b82e=_0xef4b[_0x38e730];return _0x29b82e;};'use strict';var util=require(_0xbef4('0x0'));var moment=require(_0xbef4('0x1'));var rp=require('request-promise');var BPromise=require(_0xbef4('0x2'));var pkginfo=require(_0xbef4('0x3'))(module,'version');var db=require(_0xbef4('0x4'))['db'];var encryptor=require(_0xbef4('0x5'));var hardware=require(_0xbef4('0x6'));var logger=require('../logger')(_0xbef4('0x7'));var HOST=_0xbef4('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x336d80){return new BPromise(function(_0x4c9f59,_0x1ccf48){var _0x1166e6=util[_0xbef4('0x9')](_0xbef4('0xa'),HOST,_0x336d80,module[_0xbef4('0xb')]['version']);if(oldToken){_0x1166e6=util[_0xbef4('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x336d80,module[_0xbef4('0xb')]['version'],oldToken);}var _0x5282a2={'uri':_0x1166e6,'method':_0xbef4('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x5282a2)[_0xbef4('0xd')](function(_0x1c30eb){_0x4c9f59(_0x1c30eb);})[_0xbef4('0xe')](function(_0xa39ba1){_0x1ccf48(_0xa39ba1);});});}function manageLicense(_0x5e391a,_0x34ea2f){var _0x3311f8=_0x34ea2f[_0xbef4('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x3311f8[_0xbef4('0x10')]!==_0x5e391a&&!_0x3311f8[_0xbef4('0x11')]){oldToken=_0x3311f8[_0xbef4('0x10')];}httpRequest(_0x5e391a)[_0xbef4('0xd')](function(_0x32c865){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x32c865[_0xbef4('0x12')]){isOldTokenSent=![];if(!_0x3311f8['license']&&_0x3311f8[_0xbef4('0x7')]!=_0x32c865['license']||_0x3311f8[_0xbef4('0x7')]&&_0x3311f8[_0xbef4('0x11')]){logger['info'](_0xbef4('0x13'));}if(_0x3311f8[_0xbef4('0x7')]&&!_0x3311f8[_0xbef4('0x11')]&&_0x3311f8[_0xbef4('0x7')]!=_0x32c865[_0xbef4('0x7')]){logger[_0xbef4('0x14')](_0xbef4('0x15'));}if(_0x3311f8[_0xbef4('0x7')]&&!_0x3311f8[_0xbef4('0x11')]&&_0x3311f8[_0xbef4('0x7')]==_0x32c865[_0xbef4('0x7')]){return _0x34ea2f;}return _0x34ea2f[_0xbef4('0x16')]({'data1':_0x5e391a,'data2':null,'license':_0x32c865[_0xbef4('0x7')]});}else{if(_0x32c865[_0xbef4('0x7')]||_0x3311f8['license']){if(!_0x3311f8[_0xbef4('0x11')]){if(_0x3311f8['data1']==_0x5e391a){GRAY_PERIOD_REASON=_0xbef4('0x17');logger['info'](_0xbef4('0x18'));}else{GRAY_PERIOD_REASON=_0xbef4('0x19');logger[_0xbef4('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3311f8[_0xbef4('0x10')],_0x5e391a);}logger[_0xbef4('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x34ea2f[_0xbef4('0x16')]({'data2':encryptor[_0xbef4('0x1a')](moment()['format'](_0xbef4('0x1b')))});}else{if(moment()[_0xbef4('0x1c')](encryptor['decryptString'](_0x3311f8[_0xbef4('0x11')]),_0xbef4('0x1d'))>DAYS){logger[_0xbef4('0x14')]('DEMO\x20START\x20AT\x20%s',moment()[_0xbef4('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x34ea2f[_0xbef4('0x16')]({'data1':_0x5e391a,'data2':null,'license':null});}}}else{if(_0x3311f8[_0xbef4('0x10')]!=_0x5e391a){logger[_0xbef4('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3311f8[_0xbef4('0x10')],_0x5e391a);return _0x34ea2f[_0xbef4('0x16')]({'data1':_0x5e391a,'data2':null,'license':null});}}}return _0x34ea2f;})['then'](function(_0x572858){_0x34ea2f=_0x572858;})[_0xbef4('0xe')](function(_0x4fe61a){logger[_0xbef4('0x1e')](_0x4fe61a[_0xbef4('0x1f')]);})[_0xbef4('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0xbef4('0x21')](),_0x34ea2f);},TIME);});}function defaultLicense(){var _0x3147b5=hardware[_0xbef4('0x21')]();if(_0x3147b5){return db[_0xbef4('0x22')][_0xbef4('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x3147b5}})[_0xbef4('0x24')](function(_0x1b7c36,_0x4ccb2c){logger[_0xbef4('0x14')](_0xbef4('0x25'),_0x3147b5);manageLicense(_0x3147b5,_0x1b7c36);})[_0xbef4('0xe')](function(_0x575020){logger[_0xbef4('0x1e')](_0x575020['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index f947f85..edab48e 100644 --- a/server/config/license/util.js +++ b/server/config/license/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6cd=['defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','user','telephone','users','telephones','forEach','admin','count','License\x20limit\x20reached\x20for\x20telephones','util','moment','bluebird','Demo\x20license','getUuid','License'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6cd,0x17d));var _0xdc6c=function(_0x2e3adb,_0x24b88a){_0x2e3adb=_0x2e3adb-0x0;var _0x51ac2a=_0xc6cd[_0x2e3adb];return _0x51ac2a;};'use strict';var util=require(_0xdc6c('0x0'));var _=require('lodash');var moment=require(_0xdc6c('0x1'));var BPromise=require(_0xdc6c('0x2'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xdc6c('0x3'),'machineUuid':hardware[_0xdc6c('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xdc6c('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x59394a){return new BPromise(function(_0x301394,_0x222846){return db[_0xdc6c('0x5')]['find'](_[_0xdc6c('0x6')](_0x59394a,{'raw':!![],'where':{'id':0x1}}))[_0xdc6c('0x7')](function(_0x50da34){return checkLicense(_0x50da34,null);})['then'](function(_0x59ce29){_0x301394(_0x59ce29);return;})[_0xdc6c('0x8')](function(_0x1a5fb0){_0x222846(_0x1a5fb0);});});}function checkLicense(_0x3e7277,_0x4f1aae){if(!_0x3e7277){demoLicense[_0xdc6c('0x9')]=_0x3e7277['data1'];return demoLicense;}try{var _0x2c6d59=_0x4f1aae||_0x3e7277[_0xdc6c('0xa')];if(_[_0xdc6c('0xb')](_0x2c6d59)){throw new Error(_0xdc6c('0xc'));}var _0x7227b2=_0x3e7277[_0xdc6c('0xd')];var _0x37c472=_0x3e7277[_0xdc6c('0xe')];var _0x196957=_0x7227b2[_0xdc6c('0xf')]('-')[0x4];var _0x552895=_0x7227b2[_0xdc6c('0xf')]('-')[0x0];var _0x58ce75=encryptor[_0xdc6c('0x10')](_0x2c6d59,util[_0xdc6c('0x11')](_0xdc6c('0x12'),_0x196957,_0x7227b2,_0x552895));var _0x2fdcfa=JSON['parse'](_0x58ce75);_0x2fdcfa[_0xdc6c('0x13')]=![];_0x2fdcfa[_0xdc6c('0x9')]=_0x7227b2;_0x2fdcfa[_0xdc6c('0x14')]=hardware[_0xdc6c('0x4')]();if(_0x37c472){var _0x5c1f10=encryptor[_0xdc6c('0x10')](_0x37c472);_0x2fdcfa[_0xdc6c('0x15')]=_0x5c1f10;_0x2fdcfa[_0xdc6c('0x16')]=moment(_0x5c1f10)[_0xdc6c('0x17')](0x7,_0xdc6c('0x18'))[_0xdc6c('0x11')]();_0x2fdcfa[_0xdc6c('0x19')]=_0x2fdcfa[_0xdc6c('0x9')]!=_0x2fdcfa[_0xdc6c('0x14')]?_0xdc6c('0x1a'):_0xdc6c('0x1b');}return _0x2fdcfa;}catch(_0x503733){breakingLicense[_0xdc6c('0x9')]=_0x3e7277[_0xdc6c('0xd')];breakingLicense['message']=_0x503733[_0xdc6c('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3c90df,_0x103db8){getLicense()[_0xdc6c('0x7')](function(_0x29528f){return db[_0xdc6c('0x1d')][_0xdc6c('0x1e')]({'attributes':[_0xdc6c('0x1f'),[db[_0xdc6c('0x20')]['fn'](_0xdc6c('0x21'),db['sequelize'][_0xdc6c('0x22')](_0xdc6c('0x1f'))),'count']],'group':'role','where':{'role':{'$or':['admin',_0xdc6c('0x23'),_0xdc6c('0x24')]}},'raw':!![]})[_0xdc6c('0x7')](function(_0x371d00){var _0x44aa13={'user':_0x29528f[_0xdc6c('0x25')]||0x0,'telephone':_0x29528f[_0xdc6c('0x26')]||0x0};_0x371d00[_0xdc6c('0x27')](function(_0x4b669f){var _0x1ec06c=_0x4b669f['role']===_0xdc6c('0x28')?_0xdc6c('0x23'):_0x4b669f['role'];_0x44aa13[_0x1ec06c]-=_0x4b669f[_0xdc6c('0x29')];if(_0x44aa13[_0x1ec06c]<0x0)_0x44aa13[_0x1ec06c]=0x0;});_0x3c90df(_0x44aa13);return;});})[_0xdc6c('0x8')](function(_0x16ac98){_0x103db8(_0x16ac98);});});}function checkUserLimits(_0x258e62){return new BPromise(function(_0x5d53c8,_0x186c16){getLimits()['then'](function(_0x2c5e54){var _0x1289d7=_['pick'](_['countBy'](_0x258e62,'role'),['admin','user',_0xdc6c('0x24')]);var _0x1110de=(_0x1289d7[_0xdc6c('0x28')]||0x0)+(_0x1289d7[_0xdc6c('0x23')]||0x0);var _0x3ee8b4=_0x1289d7[_0xdc6c('0x24')]||0x0;if(_0x1110de>_0x2c5e54[_0xdc6c('0x23')])return _0x186c16('License\x20limit\x20reached\x20for\x20users');if(_0x3ee8b4>_0x2c5e54[_0xdc6c('0x24')])return _0x186c16(_0xdc6c('0x2a'));return _0x5d53c8();})['catch'](function(_0x5276d3){_0x186c16(_0x5276d3);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x273b=['add','days','changed','message','User','role','sequelize','COUNT','col','count','telephone','users','telephones','forEach','admin','user','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','getUuid','License','defaults','then','catch','uuid','data1','license','split','decryptString','format','parse','demo','machineUuid','gray','deadline'];(function(_0x360bd3,_0x386767){var _0x22b47c=function(_0x531a11){while(--_0x531a11){_0x360bd3['push'](_0x360bd3['shift']());}};_0x22b47c(++_0x386767);}(_0x273b,0x148));var _0xb273=function(_0x1d0c7b,_0x14619){_0x1d0c7b=_0x1d0c7b-0x0;var _0x4ea487=_0x273b[_0x1d0c7b];return _0x4ea487;};'use strict';var util=require(_0xb273('0x0'));var _=require('lodash');var moment=require(_0xb273('0x1'));var BPromise=require(_0xb273('0x2'));var hardware=require(_0xb273('0x3'));var encryptor=require(_0xb273('0x4'));var db=require(_0xb273('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb273('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb273('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xb273('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x37caf5){return new BPromise(function(_0x554b85,_0x391873){return db[_0xb273('0x9')]['find'](_[_0xb273('0xa')](_0x37caf5,{'raw':!![],'where':{'id':0x1}}))[_0xb273('0xb')](function(_0x3eb18f){return checkLicense(_0x3eb18f,null);})[_0xb273('0xb')](function(_0x50f86b){_0x554b85(_0x50f86b);return;})[_0xb273('0xc')](function(_0x5704d0){_0x391873(_0x5704d0);});});}function checkLicense(_0x143661,_0x2d63b5){if(!_0x143661){demoLicense[_0xb273('0xd')]=_0x143661[_0xb273('0xe')];return demoLicense;}try{var _0x337981=_0x2d63b5||_0x143661[_0xb273('0xf')];if(_['isEmpty'](_0x337981)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x559e9c=_0x143661[_0xb273('0xe')];var _0x33cf7c=_0x143661['data2'];var _0x52c498=_0x559e9c[_0xb273('0x10')]('-')[0x4];var _0x55b369=_0x559e9c[_0xb273('0x10')]('-')[0x0];var _0x830932=encryptor[_0xb273('0x11')](_0x337981,util[_0xb273('0x12')]('%s:%s:%s',_0x52c498,_0x559e9c,_0x55b369));var _0x3ef593=JSON[_0xb273('0x13')](_0x830932);_0x3ef593[_0xb273('0x14')]=![];_0x3ef593[_0xb273('0xd')]=_0x559e9c;_0x3ef593[_0xb273('0x15')]=hardware[_0xb273('0x8')]();if(_0x33cf7c){var _0x164a0b=encryptor[_0xb273('0x11')](_0x33cf7c);_0x3ef593[_0xb273('0x16')]=_0x164a0b;_0x3ef593[_0xb273('0x17')]=moment(_0x164a0b)[_0xb273('0x18')](0x7,_0xb273('0x19'))['format']();_0x3ef593['grayReason']=_0x3ef593[_0xb273('0xd')]!=_0x3ef593[_0xb273('0x15')]?_0xb273('0x1a'):'disabled';}return _0x3ef593;}catch(_0x251d30){breakingLicense[_0xb273('0xd')]=_0x143661[_0xb273('0xe')];breakingLicense[_0xb273('0x1b')]=_0x251d30['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x12bfc4,_0x1cb7ea){getLicense()[_0xb273('0xb')](function(_0x414a0d){return db[_0xb273('0x1c')]['findAll']({'attributes':[_0xb273('0x1d'),[db[_0xb273('0x1e')]['fn'](_0xb273('0x1f'),db[_0xb273('0x1e')][_0xb273('0x20')](_0xb273('0x1d'))),_0xb273('0x21')]],'group':_0xb273('0x1d'),'where':{'role':{'$or':['admin','user',_0xb273('0x22')]}},'raw':!![]})[_0xb273('0xb')](function(_0x4acedd){var _0xe82dea={'user':_0x414a0d[_0xb273('0x23')]||0x0,'telephone':_0x414a0d[_0xb273('0x24')]||0x0};_0x4acedd[_0xb273('0x25')](function(_0x3f2dfd){var _0x44732c=_0x3f2dfd[_0xb273('0x1d')]===_0xb273('0x26')?_0xb273('0x27'):_0x3f2dfd[_0xb273('0x1d')];_0xe82dea[_0x44732c]-=_0x3f2dfd[_0xb273('0x21')];if(_0xe82dea[_0x44732c]<0x0)_0xe82dea[_0x44732c]=0x0;});_0x12bfc4(_0xe82dea);return;});})['catch'](function(_0x4420a4){_0x1cb7ea(_0x4420a4);});});}function checkUserLimits(_0x320890){return new BPromise(function(_0x3fcebe,_0x40d3e9){getLimits()[_0xb273('0xb')](function(_0x1c4473){var _0x3b6b5e=_[_0xb273('0x28')](_[_0xb273('0x29')](_0x320890,'role'),[_0xb273('0x26'),_0xb273('0x27'),_0xb273('0x22')]);var _0xd713f4=(_0x3b6b5e[_0xb273('0x26')]||0x0)+(_0x3b6b5e[_0xb273('0x27')]||0x0);var _0x40a13a=_0x3b6b5e[_0xb273('0x22')]||0x0;if(_0xd713f4>_0x1c4473[_0xb273('0x27')])return _0x40d3e9('License\x20limit\x20reached\x20for\x20users');if(_0x40a13a>_0x1c4473['telephone'])return _0x40d3e9(_0xb273('0x2a'));return _0x3fcebe();})['catch'](function(_0x1cc395){_0x40d3e9(_0x1cc395);});});}module[_0xb273('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 714e820..d84ad08 100644 --- a/server/config/local.env.js +++ b/server/config/local.env.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a95=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x5ade59,_0x16ac74){var _0x2d9d52=function(_0x283e3b){while(--_0x283e3b){_0x5ade59['push'](_0x5ade59['shift']());}};_0x2d9d52(++_0x16ac74);}(_0x6a95,0x1db));var _0x56a9=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x6a95[_0x54d4a8];return _0x3b321b;};'use strict';module[_0x56a9('0x0')]={'DOMAIN':_0x56a9('0x1'),'SESSION_SECRET':_0x56a9('0x2'),'GOOGLE_ID':_0x56a9('0x3'),'GOOGLE_SECRET':_0x56a9('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x5204=['http://localhost:9000','app-id','secret','exports'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5204,0xdf));var _0x4520=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x5204[_0x4d7a61];return _0x186f73;};'use strict';module[_0x4520('0x0')]={'DOMAIN':_0x4520('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4520('0x2'),'GOOGLE_SECRET':_0x4520('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2f42bfd..5d75556 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf793=['exports','../utils/loggers','fileLogger'];(function(_0x4dfb15,_0x418e96){var _0x14a271=function(_0x2e96a6){while(--_0x2e96a6){_0x4dfb15['push'](_0x4dfb15['shift']());}};_0x14a271(++_0x418e96);}(_0xf793,0xf7));var _0x3f79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf793[_0x2641f9];return _0x585741;};'use strict';var fileLogger=require(_0x3f79('0x0'))[_0x3f79('0x1')];module[_0x3f79('0x2')]=fileLogger; \ No newline at end of file +var _0xe97e=['exports','fileLogger'];(function(_0x2a96de,_0x7ac856){var _0x22b36e=function(_0x1ebe00){while(--_0x1ebe00){_0x2a96de['push'](_0x2a96de['shift']());}};_0x22b36e(++_0x7ac856);}(_0xe97e,0xf9));var _0xee97=function(_0x3e1d49,_0x21bc59){_0x3e1d49=_0x3e1d49-0x0;var _0x2b2b24=_0xe97e[_0x3e1d49];return _0x2b2b24;};'use strict';var fileLogger=require('../utils/loggers')[_0xee97('0x0')];module[_0xee97('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2f4c5f1..71d69d0 100644 --- a/server/config/pm2/config.js +++ b/server/config/pm2/config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb67=['express','join','ami','../../services/ami/index.js','agi','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path'];(function(_0x3f4e8d,_0x52d1e3){var _0x352abb=function(_0x55b621){while(--_0x55b621){_0x3f4e8d['push'](_0x3f4e8d['shift']());}};_0x352abb(++_0x52d1e3);}(_0xeb67,0x11d));var _0x7eb6=function(_0x4d477c,_0x5d4d1a){_0x4d477c=_0x4d477c-0x0;var _0x4abd1e=_0xeb67[_0x4d477c];return _0x4abd1e;};'use strict';var path=require(_0x7eb6('0x0'));var os=require('os');var config={'apps':[{'name':_0x7eb6('0x1'),'script':path[_0x7eb6('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x7eb6('0x3'),'script':path[_0x7eb6('0x2')](__dirname,_0x7eb6('0x4'))},{'name':_0x7eb6('0x5'),'script':path[_0x7eb6('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path['join'](__dirname,_0x7eb6('0x6'))},{'name':'routing','script':path[_0x7eb6('0x2')](__dirname,_0x7eb6('0x7'))},{'name':_0x7eb6('0x8'),'script':path['join'](__dirname,_0x7eb6('0x9'))}]};module[_0x7eb6('0xa')]=config; \ No newline at end of file +var _0x522c=['xdr','../../services/xdr/index.js','path','express','ami','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x522c,0xf2));var _0xc522=function(_0x14d322,_0x34b9d1){_0x14d322=_0x14d322-0x0;var _0x34adf4=_0x522c[_0x14d322];return _0x34adf4;};'use strict';var path=require(_0xc522('0x0'));var os=require('os');var config={'apps':[{'name':_0xc522('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0xc522('0x2'),'script':path[_0xc522('0x3')](__dirname,_0xc522('0x4'))},{'name':_0xc522('0x5'),'script':path[_0xc522('0x3')](__dirname,_0xc522('0x6'))},{'name':_0xc522('0x7'),'script':path[_0xc522('0x3')](__dirname,_0xc522('0x8'))},{'name':'routing','script':path['join'](__dirname,_0xc522('0x9'))},{'name':_0xc522('0xa'),'script':path[_0xc522('0x3')](__dirname,_0xc522('0xb'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index da5d52c..26c0284 100644 --- a/server/config/pm2/index.js +++ b/server/config/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa554=['restart','list','describe','delete','dump','bluebird','./config','connect','connected','start','then','stop','disconnect'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xa554,0x1bf));var _0x4a55=function(_0x156723,_0x238fce){_0x156723=_0x156723-0x0;var _0x64a245=_0xa554[_0x156723];return _0x64a245;};'use strict';var pm2=require('pm2');var BPromise=require(_0x4a55('0x0'));var config=require(_0x4a55('0x1'));function connect(){return new BPromise(function(_0x4a2d84,_0x354f87){return pm2[_0x4a55('0x2')](function(_0x53093e){if(_0x53093e){return _0x354f87(_0x53093e);}return _0x4a2d84(_0x4a55('0x3'));});});};exports[_0x4a55('0x4')]=function(_0x2cddcd){return connect()[_0x4a55('0x5')](function(){return new BPromise(function(_0x4cc245,_0x5aeebe){return pm2['start'](_0x2cddcd,function(_0x30b7e0,_0x203433){if(_0x30b7e0){return _0x5aeebe(_0x30b7e0);}pm2['disconnect']();return _0x4cc245(_0x203433);});});});};exports[_0x4a55('0x6')]=function(_0x4ba97a){return connect()[_0x4a55('0x5')](function(){return new BPromise(function(_0x133438,_0x20136b){return pm2[_0x4a55('0x6')](_0x4ba97a,function(_0x41b6a6,_0x5003c2){if(_0x41b6a6){return _0x20136b(_0x41b6a6);}pm2[_0x4a55('0x7')]();return _0x133438(_0x5003c2);});});});};exports[_0x4a55('0x8')]=function(_0x303f75){return connect()[_0x4a55('0x5')](function(){return new BPromise(function(_0x302ebe,_0x244073){return pm2['restart'](_0x303f75,function(_0x5301a8,_0x5abdc5){if(_0x5301a8){return _0x244073(_0x5301a8);}pm2['disconnect']();return _0x302ebe(_0x5abdc5);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x2c6ea8,_0x5e0b1c){return pm2[_0x4a55('0x9')](function(_0x93e7d2,_0x111e84){if(_0x93e7d2){return _0x5e0b1c(_0x93e7d2);}pm2[_0x4a55('0x7')]();return _0x2c6ea8(_0x111e84);});});});};exports[_0x4a55('0xa')]=function(_0x1b0a54){return connect()['then'](function(){return new BPromise(function(_0x1788f2,_0xe15b7a){return pm2[_0x4a55('0xa')](_0x1b0a54,function(_0x800f93,_0x362734){if(_0x800f93){return _0xe15b7a(_0x800f93);}pm2[_0x4a55('0x7')]();return _0x1788f2(_0x362734);});});});};exports['delete']=function(_0x2794c9){return connect()['then'](function(){return new BPromise(function(_0x123df6,_0x42b150){return pm2[_0x4a55('0xb')](_0x2794c9,function(_0x2b9790,_0x4fe9b1){if(_0x2b9790){return _0x42b150(_0x2b9790);}pm2[_0x4a55('0x7')]();return _0x123df6(_0x4fe9b1);});});});};exports[_0x4a55('0xc')]=function(){return connect()[_0x4a55('0x5')](function(){return new BPromise(function(_0x1e91b2,_0x3638a5){return pm2['dump'](function(_0x4b0440){if(_0x4b0440){return _0x3638a5(_0x4b0440);}return _0x1e91b2('saved');});});});}; \ No newline at end of file +var _0x8ed0=['describe','dump','bluebird','./config','connect','start','then','disconnect','stop','restart','list'];(function(_0x40e3eb,_0x64d28d){var _0x58251c=function(_0x4ba29c){while(--_0x4ba29c){_0x40e3eb['push'](_0x40e3eb['shift']());}};_0x58251c(++_0x64d28d);}(_0x8ed0,0x70));var _0x08ed=function(_0x1b3d9c,_0x2668fb){_0x1b3d9c=_0x1b3d9c-0x0;var _0x23169c=_0x8ed0[_0x1b3d9c];return _0x23169c;};'use strict';var pm2=require('pm2');var BPromise=require(_0x08ed('0x0'));var config=require(_0x08ed('0x1'));function connect(){return new BPromise(function(_0x84df90,_0x1a4210){return pm2[_0x08ed('0x2')](function(_0x4351d6){if(_0x4351d6){return _0x1a4210(_0x4351d6);}return _0x84df90('connected');});});};exports[_0x08ed('0x3')]=function(_0x4c67c2){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0xc68095,_0x1058d2){return pm2[_0x08ed('0x3')](_0x4c67c2,function(_0x5246b7,_0x5e83c5){if(_0x5246b7){return _0x1058d2(_0x5246b7);}pm2[_0x08ed('0x5')]();return _0xc68095(_0x5e83c5);});});});};exports[_0x08ed('0x6')]=function(_0x2872de){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0x113a79,_0x252e52){return pm2[_0x08ed('0x6')](_0x2872de,function(_0x549a1e,_0x6c0837){if(_0x549a1e){return _0x252e52(_0x549a1e);}pm2[_0x08ed('0x5')]();return _0x113a79(_0x6c0837);});});});};exports['restart']=function(_0x247eee){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0xe976ae,_0x71aa45){return pm2[_0x08ed('0x7')](_0x247eee,function(_0x53931b,_0x29e806){if(_0x53931b){return _0x71aa45(_0x53931b);}pm2['disconnect']();return _0xe976ae(_0x29e806);});});});};exports[_0x08ed('0x8')]=function(){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0x31b196,_0x20a342){return pm2[_0x08ed('0x8')](function(_0x28120f,_0x506408){if(_0x28120f){return _0x20a342(_0x28120f);}pm2[_0x08ed('0x5')]();return _0x31b196(_0x506408);});});});};exports['describe']=function(_0x5c19af){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0x52ddd9,_0x1d1f25){return pm2[_0x08ed('0x9')](_0x5c19af,function(_0x4aea3d,_0x106a5b){if(_0x4aea3d){return _0x1d1f25(_0x4aea3d);}pm2[_0x08ed('0x5')]();return _0x52ddd9(_0x106a5b);});});});};exports['delete']=function(_0x58c8f8){return connect()['then'](function(){return new BPromise(function(_0x59e962,_0x47eb7f){return pm2['delete'](_0x58c8f8,function(_0x589baa,_0x5765a5){if(_0x589baa){return _0x47eb7f(_0x589baa);}pm2[_0x08ed('0x5')]();return _0x59e962(_0x5765a5);});});});};exports[_0x08ed('0xa')]=function(){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0xe0f60e,_0x36c1b1){return pm2[_0x08ed('0xa')](function(_0x4e0e65){if(_0x4e0e65){return _0x36c1b1(_0x4e0e65);}return _0xe0f60e('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index eac9c9d..e0bbbc0 100644 --- a/server/config/schedule/chat.js +++ b/server/config/schedule/chat.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb173=['system','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','inspect','start','lodash','moment','ioredis','../../config/environment','../logger','redis','localhost','Setting','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','length','map','info','join','update'];(function(_0x56321f,_0x1c41eb){var _0x5aa129=function(_0x5cab95){while(--_0x5cab95){_0x56321f['push'](_0x56321f['shift']());}};_0x5aa129(++_0x1c41eb);}(_0xb173,0xd7));var _0x3b17=function(_0x580f53,_0x58ede9){_0x580f53=_0x580f53-0x0;var _0x10b4c5=_0xb173[_0x580f53];return _0x10b4c5;};'use strict';var _=require(_0x3b17('0x0'));var moment=require(_0x3b17('0x1'));var Redis=require(_0x3b17('0x2'));var util=require('util');var config=require(_0x3b17('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x3b17('0x4'))('schedule');config['redis']=_['defaults'](config[_0x3b17('0x5')],{'host':_0x3b17('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3b17('0x5')]));function closeInteractions(){var _0x180f8c=0x0;var _0xd5eb3f=[];return db[_0x3b17('0x7')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x3b17('0x8')](function(_0x113828){_0x180f8c=_0x113828[_0x3b17('0x9')];if(_0x180f8c){return db[_0x3b17('0xa')][_0x3b17('0xb')]({'raw':!![],'attributes':['id',_0x3b17('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x113828[_0x3b17('0x9')],_0x3b17('0xd'))}}});}else{return[];}})[_0x3b17('0x8')](function(_0x17522b){if(_0x17522b&&_0x17522b[_0x3b17('0xe')]){_0xd5eb3f=_[_0x3b17('0xf')](_0x17522b||[],'id');logger[_0x3b17('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0xd5eb3f[_0x3b17('0x11')]());return db['ChatInteraction'][_0x3b17('0x12')]({'closeReason':_0x3b17('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x3b17('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xd5eb3f}});}})[_0x3b17('0x8')](function(){if(_0xd5eb3f&&_0xd5eb3f[_0x3b17('0xe')]){logger[_0x3b17('0x10')](_0x3b17('0x15'),_0xd5eb3f['join']());for(var _0xf06925=0x0;_0xf06925<_0xd5eb3f[_0x3b17('0xe')];_0xf06925++){io[_0x3b17('0x16')]('chatInteraction:update',{'id':_0xd5eb3f[_0xf06925],'closed':!![]});}}})[_0x3b17('0x17')](function(_0x3a69e1){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x3a69e1?util[_0x3b17('0x18')](_0x3a69e1,{'showHidden':![],'depth':null}):'');});}exports[_0x3b17('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x651b=['start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','chatTimeout','then','ChatInteraction','lastMsgAt','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x651b,0x88));var _0xb651=function(_0x55dbcc,_0x471200){_0x55dbcc=_0x55dbcc-0x0;var _0x4bf589=_0x651b[_0x55dbcc];return _0x4bf589;};'use strict';var _=require(_0xb651('0x0'));var moment=require(_0xb651('0x1'));var Redis=require(_0xb651('0x2'));var util=require(_0xb651('0x3'));var config=require(_0xb651('0x4'));var db=require(_0xb651('0x5'))['db'];var logger=require('../logger')('schedule');config[_0xb651('0x6')]=_['defaults'](config['redis'],{'host':_0xb651('0x7'),'port':0x18eb});var io=require(_0xb651('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x5ae436=0x0;var _0x14705b=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0xb651('0x9')],'where':{'id':0x1}})[_0xb651('0xa')](function(_0x7fce75){_0x5ae436=_0x7fce75[_0xb651('0x9')];if(_0x5ae436){return db[_0xb651('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xb651('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x7fce75[_0xb651('0x9')],_0xb651('0xd'))}}});}else{return[];}})['then'](function(_0x5ee8ef){if(_0x5ee8ef&&_0x5ee8ef[_0xb651('0xe')]){_0x14705b=_['map'](_0x5ee8ef||[],'id');logger[_0xb651('0xf')](_0xb651('0x10'),_0x14705b[_0xb651('0x11')]());return db[_0xb651('0xb')][_0xb651('0x12')]({'closeReason':_0xb651('0x13'),'disposition':_0xb651('0x14'),'closed':!![],'closedAt':moment()['format'](_0xb651('0x15'))},{'where':{'id':_0x14705b}});}})[_0xb651('0xa')](function(){if(_0x14705b&&_0x14705b[_0xb651('0xe')]){logger[_0xb651('0xf')](_0xb651('0x16'),_0x14705b[_0xb651('0x11')]());for(var _0x4d423d=0x0;_0x4d423d<_0x14705b['length'];_0x4d423d++){io['emit'](_0xb651('0x17'),{'id':_0x14705b[_0x4d423d],'closed':!![]});}}})[_0xb651('0x18')](function(_0x377108){logger[_0xb651('0x19')]('[CHAT]\x20Error\x20closing\x20interactions',_0x377108?util['inspect'](_0x377108,{'showHidden':![],'depth':null}):'');});}exports[_0xb651('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 0d0208a..1d142fd 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d72=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x16f125,_0x359f0e){var _0x4f5dde=function(_0x1f2103){while(--_0x1f2103){_0x16f125['push'](_0x16f125['shift']());}};_0x4f5dde(++_0x359f0e);}(_0x3d72,0xa0));var _0x23d7=function(_0x387610,_0x4b12a7){_0x387610=_0x387610-0x0;var _0xf53023=_0x3d72[_0x387610];return _0xf53023;};'use strict';function start(){var _0x3ab9bf=require(_0x23d7('0x0'));return _0x3ab9bf[_0x23d7('0x1')]();}module[_0x23d7('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xb769=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb769,0x93));var _0x9b76=function(_0x24bc66,_0x44a9fe){_0x24bc66=_0x24bc66-0x0;var _0x5e0da0=_0xb769[_0x24bc66];return _0x5e0da0;};'use strict';function start(){var _0x3c1c92=require(_0x9b76('0x0'));return _0x3c1c92[_0x9b76('0x1')]();}module[_0x9b76('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 008913b..94272b7 100644 --- a/server/config/schedule/index.js +++ b/server/config/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x633a=['data','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','length','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','start','add\x20cron','exists','stop','stop\x20cron','startAt','endAt','run','util','lodash','moment','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','%s.%s','basename','savename','extname','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','catch'];(function(_0x5a66e1,_0x1d8a91){var _0x14b113=function(_0x1d2541){while(--_0x1d2541){_0x5a66e1['push'](_0x5a66e1['shift']());}};_0x14b113(++_0x1d8a91);}(_0x633a,0xca));var _0xa633=function(_0x76ba46,_0x52d59a){_0x76ba46=_0x76ba46-0x0;var _0x36c1b8=_0x633a[_0x76ba46];return _0x36c1b8;};'use strict';var fs=require('fs');var util=require(_0xa633('0x0'));var path=require('path');var _=require(_0xa633('0x1'));var moment=require(_0xa633('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xa633('0x3'));var logger=require(_0xa633('0x4'))('schedule');var db=require(_0xa633('0x5'))['db'];var analyticCustomReportController=require(_0xa633('0x6'));var analyticDefaultReportController=require(_0xa633('0x7'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x114606,_0x47abe5){return function(){logger[_0xa633('0x8')](_0xa633('0x9'),_0x114606[_0xa633('0xa')]);var _0x40f118=!![];var _0x5c9dba=_0x114606[_0xa633('0xb')][_0xa633('0xc')]();var _0x1c3bef={'account':_0x5c9dba,'message':{'from':util['format'](_0xa633('0xd'),_0x114606[_0xa633('0xb')][_0xa633('0xe')],_0x114606['MailAccount'][_0xa633('0xa')]||_0x114606[_0xa633('0xb')][_0xa633('0xf')]['user']),'to':_0x114606['email'],'cc':_0x114606['cc'],'bcc':_0x114606[_0xa633('0x10')],'subject':util[_0xa633('0x11')](_0xa633('0x12'),_0x47abe5[_0xa633('0xe')],_0x114606[_0xa633('0x13')],_0x114606['subtractUnit'])}};var _0x1cdcf8=path[_0xa633('0x14')](__dirname,_0xa633('0x15'));var _0x336c96=_0x47abe5['savename'];var _0x41f049=util[_0xa633('0x11')](_0xa633('0x16'),path[_0xa633('0x17')](_0x47abe5[_0xa633('0x18')],path[_0xa633('0x19')](_0x47abe5['savename'])),'zip');var _0x527844=path[_0xa633('0x14')](_0x1cdcf8,_0x336c96);var _0x28c498=path[_0xa633('0x14')](_0x1cdcf8,_0x41f049);if(fs[_0xa633('0x1a')](_0x527844)){_0x47abe5[_0xa633('0x1b')]=_0xa633('0x1c');_0x1c3bef[_0xa633('0x1d')]['attachments']=[{'filename':_0x336c96,'path':_0x527844}];_0x1c3bef[_0xa633('0x1d')][_0xa633('0x1e')]=util[_0xa633('0x11')](_0xa633('0x1f'),JSON[_0xa633('0x20')](_0x47abe5,null,0x2));}else if(fs['existsSync'](_0x28c498)){_0x47abe5[_0xa633('0x1b')]=_0xa633('0x1c');_0x1c3bef[_0xa633('0x1d')]['attachments']=[{'filename':_0x41f049,'path':_0x28c498}];}else{_0x1c3bef[_0xa633('0x1d')][_0xa633('0x1e')]=_0xa633('0x21');if(!_0x114606[_0xa633('0x22')]){_0x40f118=![];logger[_0xa633('0x8')](_0xa633('0x23'));}}if(_0x40f118){return client[_0xa633('0x24')](_0xa633('0x25'),_0x1c3bef)['then'](function(_0x207b94){if(_0x207b94[_0xa633('0x26')]){return logger[_0xa633('0x26')](_0xa633('0x27'),JSON[_0xa633('0x20')](_0x207b94));}return logger[_0xa633('0x8')]('email\x20sent');})[_0xa633('0x28')](function(_0x59abce){return logger[_0xa633('0x26')](_0xa633('0x27'),JSON[_0xa633('0x20')](_0x59abce));});}};}function handleError(){return function(_0x40911f){return logger[_0xa633('0x26')](JSON[_0xa633('0x20')](_0x40911f));};}function handleResult(_0x4e401d){return function(_0x50bc35){logger[_0xa633('0x8')](_0xa633('0x29'),JSON[_0xa633('0x20')](_0x50bc35));if(_0x4e401d[_0xa633('0xb')]&&_0x4e401d[_0xa633('0xb')][_0xa633('0xf')]&&!_[_0xa633('0x2a')](_0x4e401d['email'])){setTimeout(handleSendEmail(_0x4e401d,_0x50bc35),0x3c*0x3e8);}};}function handleJob(_0x5af766){return function(){try{if(_[_0xa633('0x2a')](_0x5af766['subtractNumber'])){return logger[_0xa633('0x8')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xa633('0x2a')](_0x5af766[_0xa633('0x2b')])){return logger['info'](_0xa633('0x2c'));}var _0x37dfb9={'startDate':moment()[_0xa633('0x2d')](_0x5af766['subtractNumber'],_0x5af766[_0xa633('0x2b')])[_0xa633('0x11')](_0xa633('0x2e')),'endDate':moment()[_0xa633('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xa633('0x2f'),'output':_0x5af766['output'],'name':_0x5af766[_0xa633('0xe')]};if(!_['isNil'](_0x5af766[_0xa633('0x30')])){logger[_0xa633('0x8')](_0xa633('0x31'),_0x5af766[_0xa633('0x30')]);return analyticDefaultReportController[_0xa633('0x32')]({'id':_0x5af766[_0xa633('0x30')]},_0x37dfb9)[_0xa633('0x33')](handleResult(_0x5af766))['catch'](handleError());}if(!_[_0xa633('0x2a')](_0x5af766['CustomReportId'])){logger[_0xa633('0x8')](_0xa633('0x34'),_0x5af766[_0xa633('0x35')]);return analyticCustomReportController['runReport']({'id':_0x5af766[_0xa633('0x35')]},_0x37dfb9)['then'](handleResult(_0x5af766))[_0xa633('0x28')](handleError());}}catch(_0x32e79a){logger[_0xa633('0x26')](JSON['stringify'](_0x32e79a));}return logger[_0xa633('0x8')](_0xa633('0x36'));};}function getJobs(_0x38b850){var _0x3287d4={};if(_0x38b850){_0x3287d4['id']=_0x38b850;}return db[_0xa633('0x37')]['findAll']({'where':_0x3287d4,'include':[{'model':db[_0xa633('0xb')],'attributes':['id',_0xa633('0xe'),_0xa633('0xa')],'include':[{'model':db[_0xa633('0x38')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xa633('0x39')}]}]}]})[_0xa633('0x33')](function(_0x5d0f9e){var _0x3bd924=_[_0xa633('0x3a')](manager[_0xa633('0x3b')]);var _0x3b9d20=_[_0xa633('0x3c')](_0x5d0f9e,function(_0x3058d7){return _0x3058d7['id'][_0xa633('0x3d')]();});var _0x1b07e8=_[_0xa633('0x3e')](_0x5d0f9e,function(_0x207bea){return _0x207bea['id'][_0xa633('0x3d')]();});var _0x12ec8c=_0x38b850?_0x3b9d20:_['difference'](_0x3b9d20,_0x3bd924);var _0x4fa376=_['intersection'](_0x3b9d20,_0x3bd924);var _0x4bf2f5=_['difference'](_0x3bd924,_0x3b9d20);var _0x54a5d3;var _0x4f48c0;for(_0x54a5d3=0x0;_0x54a5d3<_0x4bf2f5[_0xa633('0x3f')]&&!_0x38b850;_0x54a5d3+=0x1){_0x4f48c0=_0x4bf2f5[_0x54a5d3][_0xa633('0x3d')]();if(manager['exists'](_0x4f48c0)){manager['stop'](_0x4f48c0);manager[_0xa633('0x40')](_0x4f48c0);logger[_0xa633('0x8')](_0xa633('0x41'),_0x4f48c0);}}logger[_0xa633('0x8')](_0xa633('0x42'),JSON[_0xa633('0x20')](_0x12ec8c));for(_0x54a5d3=0x0;_0x54a5d3<_0x12ec8c['length'];_0x54a5d3+=0x1){_0x4f48c0=_0x12ec8c[_0x54a5d3]['toString']();logger['info'](_0xa633('0x43'),_0x4f48c0);if(_0x38b850){logger[_0xa633('0x8')](_0xa633('0x44'),_0x38b850);logger[_0xa633('0x8')](JSON[_0xa633('0x20')](_0x1b07e8[_0x4f48c0]));BPromise[_0xa633('0x45')]()['then'](handleJob(_0x1b07e8[_0x4f48c0]));logger[_0xa633('0x8')]('run\x20job',_0x1b07e8[_0x4f48c0][_0xa633('0xe')],_0x1b07e8[_0x4f48c0][_0xa633('0x46')]);}else if(_0x1b07e8[_0x4f48c0]['cron']&&_0x1b07e8[_0x4f48c0][_0xa633('0x47')]&&moment()[_0xa633('0x48')](_0x1b07e8[_0x4f48c0]['startAt'],_0x1b07e8[_0x4f48c0]['endAt'])){manager['add'](_0x4f48c0,_0x1b07e8[_0x4f48c0][_0xa633('0x46')],handleJob(_0x1b07e8[_0x4f48c0]));manager[_0xa633('0x49')](_0x4f48c0);logger[_0xa633('0x8')](_0xa633('0x4a'),_0x1b07e8[_0x4f48c0]['name'],_0x1b07e8[_0x4f48c0][_0xa633('0x46')]);}else if(manager[_0xa633('0x4b')](_0x4f48c0)){manager[_0xa633('0x4c')](_0x4f48c0);manager[_0xa633('0x40')](_0x4f48c0);logger[_0xa633('0x8')](_0xa633('0x4d'),_0x1b07e8[_0x4f48c0][_0xa633('0xe')],_0x1b07e8[_0x4f48c0]['cron']);}}for(_0x54a5d3=0x0,_0x4f48c0;_0x54a5d3<_0x4fa376['length']&&!_0x38b850;_0x54a5d3+=0x1){_0x4f48c0=_0x4fa376[_0x54a5d3][_0xa633('0x3d')]();if(manager['exists'](_0x4f48c0)){if(_0x1b07e8[_0x4f48c0]['cron']&&_0x1b07e8[_0x4f48c0][_0xa633('0x47')]&&moment()['isBetween'](_0x1b07e8[_0x4f48c0][_0xa633('0x4e')],_0x1b07e8[_0x4f48c0][_0xa633('0x4f')])){manager['update'](_0x4f48c0,_0x1b07e8[_0x4f48c0]['cron'],handleJob(_0x1b07e8[_0x4f48c0]));logger[_0xa633('0x8')]('update\x20cron',_0x1b07e8[_0x4f48c0]['name'],_0x1b07e8[_0x4f48c0][_0xa633('0x46')]);}else{manager['stop'](_0x4f48c0);manager[_0xa633('0x40')](_0x4f48c0);logger[_0xa633('0x8')]('stop\x20cron',_0x1b07e8[_0x4f48c0][_0xa633('0xe')],_0x1b07e8[_0x4f48c0][_0xa633('0x46')]);}}}})[_0xa633('0x28')](function(_0x5b3c89){logger[_0xa633('0x26')](JSON[_0xa633('0x20')](_0x5b3c89));});}exports[_0xa633('0x50')]=function(_0x3bdb96){return getJobs(_0x3bdb96);};exports[_0xa633('0x49')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6ce2=['run\x20job','cron','isBetween','startAt','endAt','add','add\x20cron','exists','stop\x20cron','active','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','findAll','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection','length','stop','deleteJob','toRun','index','my\x20id','resolve'];(function(_0xf78364,_0x30d64c){var _0x17e382=function(_0x7fb37e){while(--_0x7fb37e){_0xf78364['push'](_0xf78364['shift']());}};_0x17e382(++_0x30d64c);}(_0x6ce2,0x117));var _0x26ce=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x6ce2[_0x4baae2];return _0x1a2285;};'use strict';var fs=require('fs');var util=require(_0x26ce('0x0'));var path=require(_0x26ce('0x1'));var _=require(_0x26ce('0x2'));var moment=require(_0x26ce('0x3'));var CronJobManager=require(_0x26ce('0x4'));var jayson=require(_0x26ce('0x5'));var BPromise=require(_0x26ce('0x6'));var logger=require('../logger')('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x26ce('0x7'));var analyticDefaultReportController=require(_0x26ce('0x8'));var client=jayson[_0x26ce('0x9')][_0x26ce('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x37796a,_0xaef09a){return function(){logger[_0x26ce('0xb')](_0x26ce('0xc'),_0x37796a['email']);var _0x313bbc=!![];var _0x4a0cb8=_0x37796a['MailAccount'][_0x26ce('0xd')]();var _0x155736={'account':_0x4a0cb8,'message':{'from':util[_0x26ce('0xe')](_0x26ce('0xf'),_0x37796a[_0x26ce('0x10')][_0x26ce('0x11')],_0x37796a[_0x26ce('0x10')]['email']||_0x37796a['MailAccount'][_0x26ce('0x12')][_0x26ce('0x13')]),'to':_0x37796a[_0x26ce('0x14')],'cc':_0x37796a['cc'],'bcc':_0x37796a[_0x26ce('0x15')],'subject':util['format'](_0x26ce('0x16'),_0xaef09a['name'],_0x37796a[_0x26ce('0x17')],_0x37796a[_0x26ce('0x18')])}};var _0x253c1c=path[_0x26ce('0x19')](__dirname,_0x26ce('0x1a'));var _0x2d6de6=_0xaef09a[_0x26ce('0x1b')];var _0x24387a=util[_0x26ce('0xe')](_0x26ce('0x1c'),path['basename'](_0xaef09a[_0x26ce('0x1b')],path[_0x26ce('0x1d')](_0xaef09a[_0x26ce('0x1b')])),_0x26ce('0x1e'));var _0x151f8e=path[_0x26ce('0x19')](_0x253c1c,_0x2d6de6);var _0x228a42=path[_0x26ce('0x19')](_0x253c1c,_0x24387a);if(fs[_0x26ce('0x1f')](_0x151f8e)){_0xaef09a['status']=_0x26ce('0x20');_0x155736[_0x26ce('0x21')][_0x26ce('0x22')]=[{'filename':_0x2d6de6,'path':_0x151f8e}];_0x155736[_0x26ce('0x21')][_0x26ce('0x23')]=util[_0x26ce('0xe')](_0x26ce('0x24'),JSON[_0x26ce('0x25')](_0xaef09a,null,0x2));}else if(fs['existsSync'](_0x228a42)){_0xaef09a[_0x26ce('0x26')]=_0x26ce('0x20');_0x155736[_0x26ce('0x21')]['attachments']=[{'filename':_0x24387a,'path':_0x228a42}];}else{_0x155736[_0x26ce('0x21')][_0x26ce('0x23')]=_0x26ce('0x27');if(!_0x37796a[_0x26ce('0x28')]){_0x313bbc=![];logger[_0x26ce('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x313bbc){return client[_0x26ce('0x29')](_0x26ce('0x2a'),_0x155736)[_0x26ce('0x2b')](function(_0x5f5706){if(_0x5f5706[_0x26ce('0x2c')]){return logger[_0x26ce('0x2c')](_0x26ce('0x2d'),JSON['stringify'](_0x5f5706));}return logger[_0x26ce('0xb')](_0x26ce('0x2e'));})[_0x26ce('0x2f')](function(_0xd3d3d){return logger[_0x26ce('0x2c')](_0x26ce('0x2d'),JSON['stringify'](_0xd3d3d));});}};}function handleError(){return function(_0x5a09ce){return logger['error'](JSON['stringify'](_0x5a09ce));};}function handleResult(_0x1067e0){return function(_0x58c7e9){logger[_0x26ce('0xb')](_0x26ce('0x30'),JSON[_0x26ce('0x25')](_0x58c7e9));if(_0x1067e0[_0x26ce('0x10')]&&_0x1067e0[_0x26ce('0x10')][_0x26ce('0x12')]&&!_['isNil'](_0x1067e0[_0x26ce('0x14')])){setTimeout(handleSendEmail(_0x1067e0,_0x58c7e9),0x3c*0x3e8);}};}function handleJob(_0x5de40b){return function(){try{if(_[_0x26ce('0x31')](_0x5de40b[_0x26ce('0x17')])){return logger[_0x26ce('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x26ce('0x31')](_0x5de40b['subtractUnit'])){return logger[_0x26ce('0xb')](_0x26ce('0x32'));}var _0x4406b0={'startDate':moment()[_0x26ce('0x33')](_0x5de40b[_0x26ce('0x17')],_0x5de40b[_0x26ce('0x18')])[_0x26ce('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x26ce('0xe')](_0x26ce('0x34')),'type':_0x26ce('0x35'),'output':_0x5de40b[_0x26ce('0x36')],'name':_0x5de40b['name']};if(!_['isNil'](_0x5de40b[_0x26ce('0x37')])){logger[_0x26ce('0xb')](_0x26ce('0x38'),_0x5de40b[_0x26ce('0x37')]);return analyticDefaultReportController[_0x26ce('0x39')]({'id':_0x5de40b[_0x26ce('0x37')]},_0x4406b0)[_0x26ce('0x2b')](handleResult(_0x5de40b))['catch'](handleError());}if(!_[_0x26ce('0x31')](_0x5de40b['CustomReportId'])){logger[_0x26ce('0xb')](_0x26ce('0x3a'),_0x5de40b['CustomReportId']);return analyticCustomReportController[_0x26ce('0x39')]({'id':_0x5de40b[_0x26ce('0x3b')]},_0x4406b0)['then'](handleResult(_0x5de40b))[_0x26ce('0x2f')](handleError());}}catch(_0x58a589){logger['error'](JSON[_0x26ce('0x25')](_0x58a589));}return logger[_0x26ce('0xb')](_0x26ce('0x3c'));};}function getJobs(_0x1f0db6){var _0x560429={};if(_0x1f0db6){_0x560429['id']=_0x1f0db6;}return db['Schedule'][_0x26ce('0x3d')]({'where':_0x560429,'include':[{'model':db[_0x26ce('0x10')],'attributes':['id','name',_0x26ce('0x14')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x26ce('0x3e')}]}]}]})[_0x26ce('0x2b')](function(_0x3cb314){var _0x5785a3=_[_0x26ce('0x3f')](manager[_0x26ce('0x40')]);var _0x1dfd7f=_[_0x26ce('0x41')](_0x3cb314,function(_0x49505f){return _0x49505f['id']['toString']();});var _0x150e3f=_[_0x26ce('0x42')](_0x3cb314,function(_0x34abec){return _0x34abec['id'][_0x26ce('0x43')]();});var _0x2bb642=_0x1f0db6?_0x1dfd7f:_[_0x26ce('0x44')](_0x1dfd7f,_0x5785a3);var _0x565b5c=_[_0x26ce('0x45')](_0x1dfd7f,_0x5785a3);var _0x72cf4e=_[_0x26ce('0x44')](_0x5785a3,_0x1dfd7f);var _0x5703ce;var _0x3646a3;for(_0x5703ce=0x0;_0x5703ce<_0x72cf4e[_0x26ce('0x46')]&&!_0x1f0db6;_0x5703ce+=0x1){_0x3646a3=_0x72cf4e[_0x5703ce][_0x26ce('0x43')]();if(manager['exists'](_0x3646a3)){manager[_0x26ce('0x47')](_0x3646a3);manager[_0x26ce('0x48')](_0x3646a3);logger[_0x26ce('0xb')]('delete\x20cron',_0x3646a3);}}logger['info'](_0x26ce('0x49'),JSON[_0x26ce('0x25')](_0x2bb642));for(_0x5703ce=0x0;_0x5703ce<_0x2bb642[_0x26ce('0x46')];_0x5703ce+=0x1){_0x3646a3=_0x2bb642[_0x5703ce]['toString']();logger['info'](_0x26ce('0x4a'),_0x3646a3);if(_0x1f0db6){logger[_0x26ce('0xb')](_0x26ce('0x4b'),_0x1f0db6);logger['info'](JSON[_0x26ce('0x25')](_0x150e3f[_0x3646a3]));BPromise[_0x26ce('0x4c')]()[_0x26ce('0x2b')](handleJob(_0x150e3f[_0x3646a3]));logger[_0x26ce('0xb')](_0x26ce('0x4d'),_0x150e3f[_0x3646a3][_0x26ce('0x11')],_0x150e3f[_0x3646a3][_0x26ce('0x4e')]);}else if(_0x150e3f[_0x3646a3]['cron']&&_0x150e3f[_0x3646a3]['active']&&moment()[_0x26ce('0x4f')](_0x150e3f[_0x3646a3][_0x26ce('0x50')],_0x150e3f[_0x3646a3][_0x26ce('0x51')])){manager[_0x26ce('0x52')](_0x3646a3,_0x150e3f[_0x3646a3][_0x26ce('0x4e')],handleJob(_0x150e3f[_0x3646a3]));manager['start'](_0x3646a3);logger[_0x26ce('0xb')](_0x26ce('0x53'),_0x150e3f[_0x3646a3]['name'],_0x150e3f[_0x3646a3][_0x26ce('0x4e')]);}else if(manager[_0x26ce('0x54')](_0x3646a3)){manager[_0x26ce('0x47')](_0x3646a3);manager[_0x26ce('0x48')](_0x3646a3);logger[_0x26ce('0xb')](_0x26ce('0x55'),_0x150e3f[_0x3646a3][_0x26ce('0x11')],_0x150e3f[_0x3646a3]['cron']);}}for(_0x5703ce=0x0,_0x3646a3;_0x5703ce<_0x565b5c[_0x26ce('0x46')]&&!_0x1f0db6;_0x5703ce+=0x1){_0x3646a3=_0x565b5c[_0x5703ce]['toString']();if(manager[_0x26ce('0x54')](_0x3646a3)){if(_0x150e3f[_0x3646a3][_0x26ce('0x4e')]&&_0x150e3f[_0x3646a3][_0x26ce('0x56')]&&moment()[_0x26ce('0x4f')](_0x150e3f[_0x3646a3][_0x26ce('0x50')],_0x150e3f[_0x3646a3][_0x26ce('0x51')])){manager['update'](_0x3646a3,_0x150e3f[_0x3646a3][_0x26ce('0x4e')],handleJob(_0x150e3f[_0x3646a3]));logger[_0x26ce('0xb')](_0x26ce('0x57'),_0x150e3f[_0x3646a3]['name'],_0x150e3f[_0x3646a3][_0x26ce('0x4e')]);}else{manager['stop'](_0x3646a3);manager['deleteJob'](_0x3646a3);logger[_0x26ce('0xb')]('stop\x20cron',_0x150e3f[_0x3646a3][_0x26ce('0x11')],_0x150e3f[_0x3646a3][_0x26ce('0x4e')]);}}}})[_0x26ce('0x2f')](function(_0x46f741){logger[_0x26ce('0x2c')](JSON[_0x26ce('0x25')](_0x46f741));});}exports[_0x26ce('0x58')]=function(_0xfb947f){return getJobs(_0xfb947f);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 2b0b4d1..e17916d 100644 --- a/server/config/schedule/transcribe.js +++ b/server/config/schedule/transcribe.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20requested','CloudProvider','language','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','all','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','sentimentRegion','bucket','ValidationError'];(function(_0x16bb04,_0x5d7870){var _0x508f0d=function(_0x4f0dbe){while(--_0x4f0dbe){_0x16bb04['push'](_0x16bb04['shift']());}};_0x508f0d(++_0x5d7870);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0x5eb8[_0x4429e0];return _0x51a5b3;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x85eb('0x0'));var util=require(_0x85eb('0x1'));var BPromise=require(_0x85eb('0x2'));var db=require(_0x85eb('0x3'))['db'];var logger=require(_0x85eb('0x4'))(_0x85eb('0x5'));function getTranscriptionJob(_0x13b1df,_0x44e313,_0x3c5798,_0x1fde1a){return new Promise(function(_0x2bf83c,_0x1ba1d8){var _0x4a8814=new AWS[(_0x85eb('0x6'))]({'accessKeyId':_0x44e313,'secretAccessKey':_0x13b1df,'region':_0x3c5798});_0x4a8814[_0x85eb('0x7')]({'TranscriptionJobName':_0x1fde1a},function(_0x448345,_0x5cd4ec){if(_0x448345){return _0x1ba1d8(_0x448345);}else{return _0x2bf83c(_0x5cd4ec);}});});}function sentiment(_0x2da3b0,_0x50ea77,_0x1f0036,_0x40d6b6,_0x673228){return new Promise(function(_0x29030b,_0x1dacf2){var _0x73e6d0=new AWS[(_0x85eb('0x8'))]({'accessKeyId':_0x50ea77,'secretAccessKey':_0x2da3b0,'region':_0x1f0036});_0x73e6d0['detectSentiment']({'Text':_0x40d6b6,'LanguageCode':_0x673228[_0x85eb('0x9')](0x0,0x2)},function(_0x478710,_0x5c52a4){if(_0x478710){return _0x1dacf2(_0x478710);}else{return _0x29030b(_0x5c52a4);}});});}function checkTranscribeJob(_0x2af376,_0x784583,_0x2f42ba){var _0x259f72;return new BPromise(function(_0x4db167,_0x548628){logger[_0x85eb('0xa')](util['format'](_0x85eb('0xb'),_0x2af376['id'],_0x2af376[_0x85eb('0xc')]));return getTranscriptionJob(_0x2f42ba[_0x85eb('0xd')],_0x2f42ba[_0x85eb('0xe')],_0x784583[_0x85eb('0xf')],_0x2af376['transcribeName'])[_0x85eb('0x10')](function(_0x59237b){logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x12'),_0x2af376['id'],_0x2af376[_0x85eb('0xc')],_0x59237b['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x2af376['fileText']){switch(_0x59237b[_0x85eb('0x13')][_0x85eb('0x14')]){case _0x85eb('0x15'):var _0x2e986c={'transcribeStatus':_0x59237b[_0x85eb('0x13')][_0x85eb('0x14')],'fileUri':_0x59237b['TranscriptionJob'][_0x85eb('0x16')][_0x85eb('0x17')]};logger[_0x85eb('0xa')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x2af376['id']));return rp({'uri':_0x59237b['TranscriptionJob']['Transcript'][_0x85eb('0x17')],'json':!![]})[_0x85eb('0x10')](function(_0x329fc5){logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x18'),_0x2af376['id']));if(_0x329fc5&&_0x329fc5['results']&&_0x329fc5['results']['transcripts']&&_0x329fc5[_0x85eb('0x19')][_0x85eb('0x1a')][_0x85eb('0x1b')]){_0x2e986c[_0x85eb('0x1c')]='';for(var _0x312b3e=0x0;_0x312b3e<_0x329fc5[_0x85eb('0x19')]['transcripts'][_0x85eb('0x1b')];_0x312b3e++){_0x2e986c[_0x85eb('0x1c')]+=_0x329fc5[_0x85eb('0x19')][_0x85eb('0x1a')][_0x312b3e][_0x85eb('0x1d')]+'';}}return _0x2af376['update'](_0x2e986c);})[_0x85eb('0x10')](function(){logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x1e'),_0x2af376['id']));if(!_0x2af376[_0x85eb('0x1f')]){throw new db[(_0x85eb('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x784583[_0x85eb('0x21')]||!_0x784583['sentimentAccountId']||!_0x784583[_0x85eb('0x22')]||!_0x784583['language']||!_0x784583[_0x85eb('0x23')]){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x25'));}if(!_0x2e986c[_0x85eb('0x1c')]){throw new Error(_0x85eb('0x26'));}if(_0x784583[_0x85eb('0x27')]===_0x2f42ba['id']){return _0x2f42ba;}else{return db['CloudProvider'][_0x85eb('0x28')]({'where':{'id':_settings[_0x85eb('0x27')]}});}})['then'](function(_0x197898){if(!_0x197898){throw new db['Sequelize']['ValidationError'](_0x85eb('0x29'));}if(!_0x197898[_0x85eb('0xd')]||!_0x197898[_0x85eb('0xe')]){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x2a'));}_0x259f72=_0x197898;logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x2b'),_0x2af376['id']));return sentiment(_0x259f72[_0x85eb('0xd')],_0x259f72['data2'],_0x784583[_0x85eb('0x22')],_0x2e986c[_0x85eb('0x1c')],_0x784583['language']);})['then'](function(_0x340745){logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x2c'),_0x2af376['id']));return _0x2af376[_0x85eb('0x2d')]({'sentiment':_0x340745[_0x85eb('0x2e')],'sPositive':_0x340745[_0x85eb('0x2f')][_0x85eb('0x30')],'sNegative':_0x340745[_0x85eb('0x2f')][_0x85eb('0x31')],'sMixed':_0x340745[_0x85eb('0x2f')][_0x85eb('0x32')],'sNeutral':_0x340745[_0x85eb('0x2f')][_0x85eb('0x33')]});})['then'](function(){logger[_0x85eb('0xa')](util[_0x85eb('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2af376['id']));_0x4db167();});case'FAILED':return _0x2af376[_0x85eb('0x2d')]({'transcribeStatus':_0x85eb('0x34'),'failureReason':_0x59237b['TranscriptionJob'][_0x85eb('0x35')]})['then'](function(){logger[_0x85eb('0xa')](util['format'](_0x85eb('0x1e'),_0x2af376['id']));_0x4db167();});default:logger['info'](util[_0x85eb('0x11')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2af376['id']));break;}}else{return BPromise[_0x85eb('0x36')]()[_0x85eb('0x10')](function(){if(!_0x2af376['tempSentiment']){throw new db[(_0x85eb('0x20'))]['ValidationError'](_0x85eb('0x37'));}if(!_0x784583[_0x85eb('0x21')]||!_0x784583['sentimentAccountId']||!_0x784583[_0x85eb('0x22')]||!_0x784583['language']||!_0x784583['bucket']){throw new db[(_0x85eb('0x20'))]['ValidationError'](_0x85eb('0x25'));}if(!_0x2af376[_0x85eb('0x1c')]){throw new Error('Transcript\x20not\x20available');}if(_0x784583['sentimentAccountId']===_0x2f42ba['id']){return _0x2f42ba;}else{return db[_0x85eb('0x38')][_0x85eb('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2864e2){if(!_0x2864e2){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x29'));}if(!_0x2864e2[_0x85eb('0xd')]||!_0x2864e2['data2']){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x2a'));}_0x259f72=_0x2864e2;logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x2b'),_0x2af376['id']));return sentiment(_0x259f72[_0x85eb('0xd')],_0x259f72[_0x85eb('0xe')],_0x784583[_0x85eb('0x22')],_0x2af376['fileText'],_0x784583[_0x85eb('0x39')]);})[_0x85eb('0x10')](function(_0x5d90cc){logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x2c'),_0x2af376['id']));return _0x2af376[_0x85eb('0x2d')]({'sentiment':_0x5d90cc[_0x85eb('0x2e')],'sPositive':_0x5d90cc[_0x85eb('0x2f')]['Positive'],'sNegative':_0x5d90cc[_0x85eb('0x2f')][_0x85eb('0x31')],'sMixed':_0x5d90cc[_0x85eb('0x2f')][_0x85eb('0x32')],'sNeutral':_0x5d90cc[_0x85eb('0x2f')][_0x85eb('0x33')],'transcribeStatus':_0x85eb('0x15')});})[_0x85eb('0x10')](function(){logger['info'](util[_0x85eb('0x11')](_0x85eb('0x1e'),_0x2af376['id']));_0x4db167();});}})[_0x85eb('0x3a')](function(_0x3d5322){if(_0x3d5322){if(!_0x3d5322[_0x85eb('0x3b')]||_0x3d5322[_0x85eb('0x3b')]!==_0x85eb('0x3c')){logger[_0x85eb('0x3d')](util[_0x85eb('0x11')](_0x85eb('0x3e'),_0x2af376['id']),util[_0x85eb('0x3f')](_0x3d5322,{'showHidden':![],'depth':null}));}}_0x4db167();});});}function checkTranscribe(){var _0x11c682;var _0x528f2b;var _0x11da79;return db[_0x85eb('0x40')][_0x85eb('0x41')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x85eb('0x10')](function(_0x30f921){if(!_0x30f921||!_0x30f921[_0x85eb('0x1b')]){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))]('No\x20transcribe\x20job\x20to\x20check');}_0x11c682=_0x30f921;return db[_0x85eb('0x42')][_0x85eb('0x28')]({'where':{'id':0x1}});})[_0x85eb('0x10')](function(_0x50e264){if(!_0x50e264){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x43'));}_0x528f2b=_0x50e264;if(!_0x528f2b['transcribe']||!_0x528f2b['transcribeAccountId']||!_0x528f2b[_0x85eb('0xf')]||!_0x528f2b['language']||!_0x528f2b['bucket']){throw new db[(_0x85eb('0x20'))]['ValidationError'](_0x85eb('0x44'));}return db[_0x85eb('0x38')]['findOne']({'where':{'id':_0x528f2b['transcribeAccountId']}});})[_0x85eb('0x10')](function(_0x249511){if(!_0x249511){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x29'));}if(!_0x249511['data1']||!_0x249511[_0x85eb('0xe')]){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x2a'));}_0x11da79=_0x249511;var _0x1614dd=[];_0x11c682['forEach'](function(_0x140919){_0x1614dd['push'](checkTranscribeJob(_0x140919,_0x528f2b,_0x11da79));});return BPromise[_0x85eb('0x45')](_0x1614dd);})[_0x85eb('0x3a')](function(_0x4ee529){if(_0x4ee529){if(!_0x4ee529[_0x85eb('0x3b')]||_0x4ee529[_0x85eb('0x3b')]!==_0x85eb('0x3c')){logger[_0x85eb('0x3d')](util[_0x85eb('0x3f')](_0x4ee529,{'showHidden':![],'depth':null}));}}});}exports[_0x85eb('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x63ad=['data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','format','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','tempSentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','ValidationError','sentiment','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','name','error','start','aws-sdk','request-promise','transcribe','TranscribeService','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x63ad,0x7d));var _0xd63a=function(_0x1a9fe9,_0xcfafde){_0x1a9fe9=_0x1a9fe9-0x0;var _0x20356c=_0x63ad[_0x1a9fe9];return _0x20356c;};var _=require('lodash');var AWS=require(_0xd63a('0x0'));var rp=require(_0xd63a('0x1'));var util=require('util');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xd63a('0x2'));function getTranscriptionJob(_0x2c11bc,_0x4a9034,_0x22f15a,_0x1c4437){return new Promise(function(_0x32e509,_0xcfe533){var _0x3b0ad8=new AWS[(_0xd63a('0x3'))]({'accessKeyId':_0x4a9034,'secretAccessKey':_0x2c11bc,'region':_0x22f15a});_0x3b0ad8['getTranscriptionJob']({'TranscriptionJobName':_0x1c4437},function(_0x1505e0,_0x4e01e3){if(_0x1505e0){return _0xcfe533(_0x1505e0);}else{return _0x32e509(_0x4e01e3);}});});}function sentiment(_0xb861fd,_0x4c671f,_0x432556,_0x2a3cae,_0x32e0d1){return new Promise(function(_0x565aa3,_0x4baa08){var _0x51612b=new AWS[(_0xd63a('0x4'))]({'accessKeyId':_0x4c671f,'secretAccessKey':_0xb861fd,'region':_0x432556});_0x51612b['detectSentiment']({'Text':_0x2a3cae,'LanguageCode':_0x32e0d1[_0xd63a('0x5')](0x0,0x2)},function(_0x135e54,_0x492c0a){if(_0x135e54){return _0x4baa08(_0x135e54);}else{return _0x565aa3(_0x492c0a);}});});}function checkTranscribeJob(_0x2a1e86,_0x24bc2b,_0x2d58fe){var _0x4741f5;return new BPromise(function(_0x2fd204,_0xb1021e){logger[_0xd63a('0x6')](util['format'](_0xd63a('0x7'),_0x2a1e86['id'],_0x2a1e86[_0xd63a('0x8')]));return getTranscriptionJob(_0x2d58fe[_0xd63a('0x9')],_0x2d58fe[_0xd63a('0xa')],_0x24bc2b[_0xd63a('0xb')],_0x2a1e86[_0xd63a('0x8')])[_0xd63a('0xc')](function(_0x59423d){logger[_0xd63a('0x6')](util['format'](_0xd63a('0xd'),_0x2a1e86['id'],_0x2a1e86[_0xd63a('0x8')],_0x59423d[_0xd63a('0xe')][_0xd63a('0xf')]));if(!_0x2a1e86[_0xd63a('0x10')]){switch(_0x59423d[_0xd63a('0xe')][_0xd63a('0xf')]){case _0xd63a('0x11'):var _0x4a02e8={'transcribeStatus':_0x59423d[_0xd63a('0xe')]['TranscriptionJobStatus'],'fileUri':_0x59423d[_0xd63a('0xe')][_0xd63a('0x12')]['TranscriptFileUri']};logger['info'](util[_0xd63a('0x13')](_0xd63a('0x14'),_0x2a1e86['id']));return rp({'uri':_0x59423d[_0xd63a('0xe')][_0xd63a('0x12')]['TranscriptFileUri'],'json':!![]})[_0xd63a('0xc')](function(_0x36dd33){logger[_0xd63a('0x6')](util[_0xd63a('0x13')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x2a1e86['id']));if(_0x36dd33&&_0x36dd33[_0xd63a('0x15')]&&_0x36dd33['results'][_0xd63a('0x16')]&&_0x36dd33[_0xd63a('0x15')]['transcripts'][_0xd63a('0x17')]){_0x4a02e8[_0xd63a('0x10')]='';for(var _0x1924c6=0x0;_0x1924c6<_0x36dd33['results']['transcripts'][_0xd63a('0x17')];_0x1924c6++){_0x4a02e8['fileText']+=_0x36dd33['results'][_0xd63a('0x16')][_0x1924c6][_0xd63a('0x18')]+'';}}return _0x2a1e86[_0xd63a('0x19')](_0x4a02e8);})[_0xd63a('0xc')](function(){logger[_0xd63a('0x6')](util[_0xd63a('0x13')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2a1e86['id']));if(!_0x2a1e86[_0xd63a('0x1a')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x24bc2b['sentiment']||!_0x24bc2b[_0xd63a('0x1b')]||!_0x24bc2b[_0xd63a('0x1c')]||!_0x24bc2b[_0xd63a('0x1d')]||!_0x24bc2b[_0xd63a('0x1e')]){throw new db[(_0xd63a('0x1f'))]['ValidationError'](_0xd63a('0x20'));}if(!_0x4a02e8[_0xd63a('0x10')]){throw new Error(_0xd63a('0x21'));}if(_0x24bc2b[_0xd63a('0x1b')]===_0x2d58fe['id']){return _0x2d58fe;}else{return db[_0xd63a('0x22')][_0xd63a('0x23')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2f3c62){if(!_0x2f3c62){throw new db[(_0xd63a('0x1f'))]['ValidationError'](_0xd63a('0x24'));}if(!_0x2f3c62['data1']||!_0x2f3c62['data2']){throw new db['Sequelize']['ValidationError'](_0xd63a('0x25'));}_0x4741f5=_0x2f3c62;logger['info'](util[_0xd63a('0x13')](_0xd63a('0x26'),_0x2a1e86['id']));return sentiment(_0x4741f5['data1'],_0x4741f5[_0xd63a('0xa')],_0x24bc2b[_0xd63a('0x1c')],_0x4a02e8['fileText'],_0x24bc2b[_0xd63a('0x1d')]);})[_0xd63a('0xc')](function(_0x4e9865){logger[_0xd63a('0x6')](util[_0xd63a('0x13')](_0xd63a('0x27'),_0x2a1e86['id']));return _0x2a1e86['update']({'sentiment':_0x4e9865[_0xd63a('0x28')],'sPositive':_0x4e9865[_0xd63a('0x29')][_0xd63a('0x2a')],'sNegative':_0x4e9865[_0xd63a('0x29')][_0xd63a('0x2b')],'sMixed':_0x4e9865[_0xd63a('0x29')][_0xd63a('0x2c')],'sNeutral':_0x4e9865[_0xd63a('0x29')][_0xd63a('0x2d')]});})['then'](function(){logger[_0xd63a('0x6')](util[_0xd63a('0x13')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2a1e86['id']));_0x2fd204();});case _0xd63a('0x2e'):return _0x2a1e86[_0xd63a('0x19')]({'transcribeStatus':_0xd63a('0x2e'),'failureReason':_0x59423d[_0xd63a('0xe')][_0xd63a('0x2f')]})[_0xd63a('0xc')](function(){logger[_0xd63a('0x6')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2a1e86['id']));_0x2fd204();});default:logger[_0xd63a('0x6')](util[_0xd63a('0x13')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2a1e86['id']));break;}}else{return BPromise[_0xd63a('0x30')]()[_0xd63a('0xc')](function(){if(!_0x2a1e86['tempSentiment']){throw new db[(_0xd63a('0x1f'))][(_0xd63a('0x31'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x24bc2b[_0xd63a('0x32')]||!_0x24bc2b[_0xd63a('0x1b')]||!_0x24bc2b[_0xd63a('0x1c')]||!_0x24bc2b[_0xd63a('0x1d')]||!_0x24bc2b[_0xd63a('0x1e')]){throw new db[(_0xd63a('0x1f'))][(_0xd63a('0x31'))](_0xd63a('0x20'));}if(!_0x2a1e86[_0xd63a('0x10')]){throw new Error(_0xd63a('0x21'));}if(_0x24bc2b[_0xd63a('0x1b')]===_0x2d58fe['id']){return _0x2d58fe;}else{return db[_0xd63a('0x22')][_0xd63a('0x23')]({'where':{'id':_settings[_0xd63a('0x1b')]}});}})[_0xd63a('0xc')](function(_0x5b6e13){if(!_0x5b6e13){throw new db[(_0xd63a('0x1f'))][(_0xd63a('0x31'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5b6e13[_0xd63a('0x9')]||!_0x5b6e13[_0xd63a('0xa')]){throw new db[(_0xd63a('0x1f'))][(_0xd63a('0x31'))](_0xd63a('0x25'));}_0x4741f5=_0x5b6e13;logger[_0xd63a('0x6')](util[_0xd63a('0x13')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2a1e86['id']));return sentiment(_0x4741f5['data1'],_0x4741f5['data2'],_0x24bc2b['sentimentRegion'],_0x2a1e86[_0xd63a('0x10')],_0x24bc2b[_0xd63a('0x1d')]);})[_0xd63a('0xc')](function(_0x48afef){logger[_0xd63a('0x6')](util[_0xd63a('0x13')](_0xd63a('0x27'),_0x2a1e86['id']));return _0x2a1e86[_0xd63a('0x19')]({'sentiment':_0x48afef[_0xd63a('0x28')],'sPositive':_0x48afef[_0xd63a('0x29')]['Positive'],'sNegative':_0x48afef[_0xd63a('0x29')][_0xd63a('0x2b')],'sMixed':_0x48afef[_0xd63a('0x29')][_0xd63a('0x2c')],'sNeutral':_0x48afef['SentimentScore'][_0xd63a('0x2d')],'transcribeStatus':_0xd63a('0x11')});})[_0xd63a('0xc')](function(){logger[_0xd63a('0x6')](util[_0xd63a('0x13')](_0xd63a('0x33'),_0x2a1e86['id']));_0x2fd204();});}})['catch'](function(_0x3bc278){if(_0x3bc278){if(!_0x3bc278['name']||_0x3bc278['name']!==_0xd63a('0x34')){logger['error'](util[_0xd63a('0x13')](_0xd63a('0x35'),_0x2a1e86['id']),util[_0xd63a('0x36')](_0x3bc278,{'showHidden':![],'depth':null}));}}_0x2fd204();});});}function checkTranscribe(){var _0x5cff6b;var _0xbe579b;var _0x78d162;return db['VoiceRecording'][_0xd63a('0x37')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x1f6427){if(!_0x1f6427||!_0x1f6427[_0xd63a('0x17')]){throw new db[(_0xd63a('0x1f'))]['ValidationError'](_0xd63a('0x38'));}_0x5cff6b=_0x1f6427;return db[_0xd63a('0x39')][_0xd63a('0x23')]({'where':{'id':0x1}});})[_0xd63a('0xc')](function(_0x11fa4d){if(!_0x11fa4d){throw new db[(_0xd63a('0x1f'))][(_0xd63a('0x31'))]('Settings\x20not\x20available');}_0xbe579b=_0x11fa4d;if(!_0xbe579b[_0xd63a('0x2')]||!_0xbe579b[_0xd63a('0x3a')]||!_0xbe579b[_0xd63a('0xb')]||!_0xbe579b['language']||!_0xbe579b[_0xd63a('0x1e')]){throw new db['Sequelize'][(_0xd63a('0x31'))](_0xd63a('0x3b'));}return db[_0xd63a('0x22')][_0xd63a('0x23')]({'where':{'id':_0xbe579b[_0xd63a('0x3a')]}});})['then'](function(_0x1266bf){if(!_0x1266bf){throw new db['Sequelize']['ValidationError'](_0xd63a('0x24'));}if(!_0x1266bf[_0xd63a('0x9')]||!_0x1266bf[_0xd63a('0xa')]){throw new db[(_0xd63a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x78d162=_0x1266bf;var _0x13f777=[];_0x5cff6b[_0xd63a('0x3c')](function(_0x8d48c5){_0x13f777[_0xd63a('0x3d')](checkTranscribeJob(_0x8d48c5,_0xbe579b,_0x78d162));});return BPromise[_0xd63a('0x3e')](_0x13f777);})[_0xd63a('0x3f')](function(_0x1c2372){if(_0x1c2372){if(!_0x1c2372[_0xd63a('0x40')]||_0x1c2372['name']!==_0xd63a('0x34')){logger[_0xd63a('0x41')](util[_0xd63a('0x36')](_0x1c2372,{'showHidden':![],'depth':null}));}}});}exports[_0xd63a('0x42')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 07b3305..22d297d 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf148=['../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util'];(function(_0x576847,_0x4797f5){var _0x2a147b=function(_0x53fb73){while(--_0x53fb73){_0x576847['push'](_0x576847['shift']());}};_0x2a147b(++_0x4797f5);}(_0xf148,0x184));var _0x8f14=function(_0x35cb12,_0x852ae8){_0x35cb12=_0x35cb12-0x0;var _0x1ef579=_0xf148[_0x35cb12];return _0x1ef579;};'use strict';var _=require(_0x8f14('0x0'));var moment=require(_0x8f14('0x1'));var Redis=require(_0x8f14('0x2'));var util=require(_0x8f14('0x3'));var config=require(_0x8f14('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x8f14('0x5'))(_0x8f14('0x6'));config[_0x8f14('0x7')]=_[_0x8f14('0x8')](config[_0x8f14('0x7')],{'host':_0x8f14('0x9'),'port':0x18eb});var io=require(_0x8f14('0xa'))(new Redis(config[_0x8f14('0x7')]));function closeInteractions(){var _0x5f18ab=[];return db[_0x8f14('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x8f14('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})['then'](function(_0x141f91){if(_0x141f91&&_0x141f91['length']){_0x5f18ab=_[_0x8f14('0xd')](_0x141f91||[],'id');logger[_0x8f14('0xe')](_0x8f14('0xf'),_0x5f18ab[_0x8f14('0x10')]());return db[_0x8f14('0xb')][_0x8f14('0x11')]({'closeReason':_0x8f14('0x12'),'disposition':_0x8f14('0x13'),'closed':!![],'closedAt':moment()[_0x8f14('0x14')](_0x8f14('0x15'))},{'where':{'id':_0x5f18ab}});}})['then'](function(){if(_0x5f18ab&&_0x5f18ab[_0x8f14('0x16')]){logger[_0x8f14('0xe')](_0x8f14('0x17'),_0x5f18ab['join']());for(var _0x2a2dee=0x0;_0x2a2dee<_0x5f18ab['length'];_0x2a2dee++){io[_0x8f14('0x18')](_0x8f14('0x19'),{'id':_0x5f18ab[_0x2a2dee],'closed':!![]});}}})[_0x8f14('0x1a')](function(_0x4f8963){logger['error'](_0x8f14('0x1b'),_0x4f8963?util['inspect'](_0x4f8963,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xff7c=['lodash','moment','util','../../config/environment','../../mysqldb','../logger','defaults','socket.io-emitter','redis','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','timeout','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0xff7c,0x1d4));var _0xcff7=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0xff7c[_0x566bdf];return _0x331215;};'use strict';var _=require(_0xcff7('0x0'));var moment=require(_0xcff7('0x1'));var Redis=require('ioredis');var util=require(_0xcff7('0x2'));var config=require(_0xcff7('0x3'));var db=require(_0xcff7('0x4'))['db'];var logger=require(_0xcff7('0x5'))('schedule');config['redis']=_[_0xcff7('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xcff7('0x7'))(new Redis(config[_0xcff7('0x8')]));function closeInteractions(){var _0xdd3a13=[];return db[_0xcff7('0x9')][_0xcff7('0xa')]({'raw':!![],'attributes':['id',_0xcff7('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xcff7('0xc')](0x18,'hours')}}})[_0xcff7('0xd')](function(_0x768ae){if(_0x768ae&&_0x768ae[_0xcff7('0xe')]){_0xdd3a13=_[_0xcff7('0xf')](_0x768ae||[],'id');logger[_0xcff7('0x10')](_0xcff7('0x11'),_0xdd3a13[_0xcff7('0x12')]());return db[_0xcff7('0x9')]['update']({'closeReason':'system','disposition':_0xcff7('0x13'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xdd3a13}});}})[_0xcff7('0xd')](function(){if(_0xdd3a13&&_0xdd3a13[_0xcff7('0xe')]){logger[_0xcff7('0x10')](_0xcff7('0x14'),_0xdd3a13['join']());for(var _0x3aa258=0x0;_0x3aa258<_0xdd3a13['length'];_0x3aa258++){io[_0xcff7('0x15')](_0xcff7('0x16'),{'id':_0xdd3a13[_0x3aa258],'closed':!![]});}}})[_0xcff7('0x17')](function(_0x57dee2){logger[_0xcff7('0x18')](_0xcff7('0x19'),_0x57dee2?util['inspect'](_0x57dee2,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index b04e370..0878538 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9e2=['log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate'];(function(_0x5a4cac,_0x1e7252){var _0x3e7cb0=function(_0x57e002){while(--_0x57e002){_0x5a4cac['push'](_0x5a4cac['shift']());}};_0x3e7cb0(++_0x1e7252);}(_0xf9e2,0x1b8));var _0x2f9e=function(_0xc1bdbb,_0x3a17b3){_0xc1bdbb=_0xc1bdbb-0x0;var _0x40d538=_0xf9e2[_0xc1bdbb];return _0x40d538;};'use strict';var util=require(_0x2f9e('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2f9e('0x1')]({'id':i,'firstName':_0x2f9e('0x2')+i,'lastName':_0x2f9e('0x3')+i,'phone':0xf879fb460+i,'email':_0x2f9e('0x4')+i+_0x2f9e('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2f9e('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2f9e('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2f9e('0x1')]({'id':i,'firstName':_0x2f9e('0x2')+i,'lastName':_0x2f9e('0x3')+i,'phone':0xf879fb460+i,'email':_0x2f9e('0x4')+i+_0x2f9e('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2f9e('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x2f9e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x2f9e('0x6')]()});}db[_0x2f9e('0x7')]['destroy']({'where':{}})[_0x2f9e('0x8')](function(){return db[_0x2f9e('0x7')][_0x2f9e('0x9')](contacts);})['then'](function(){console[_0x2f9e('0xa')](_0x2f9e('0xb'),_0x2f9e('0xc'));return db[_0x2f9e('0xd')][_0x2f9e('0xe')]({'where':{}});})['then'](function(){return db[_0x2f9e('0xd')]['bulkCreate'](hopper);})['then'](function(){console['log']('finished\x20populating',_0x2f9e('0xf'));return db[_0x2f9e('0x7')][_0x2f9e('0x9')](contacts2);})[_0x2f9e('0x8')](function(){console['log']('finished\x20populating','contacts2');return db[_0x2f9e('0xd')][_0x2f9e('0x9')](hopper2);})[_0x2f9e('0x8')](function(){console[_0x2f9e('0xa')](_0x2f9e('0xb'),_0x2f9e('0x10'));})[_0x2f9e('0x11')](function(_0x26955f){console[_0x2f9e('0xa')](_0x26955f);}); \ No newline at end of file +var _0xc4c2=['bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then'];(function(_0x45db5a,_0x1d4bd4){var _0x326d9c=function(_0x3a7ba6){while(--_0x3a7ba6){_0x45db5a['push'](_0x45db5a['shift']());}};_0x326d9c(++_0x1d4bd4);}(_0xc4c2,0xaa));var _0x2c4c=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xc4c2[_0xc67528];return _0x38e26d;};'use strict';var util=require('util');var db=require(_0x2c4c('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2c4c('0x1')]({'id':i,'firstName':_0x2c4c('0x2')+i,'lastName':_0x2c4c('0x3')+i,'phone':0xf879fb460+i,'email':_0x2c4c('0x4')+i+_0x2c4c('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2c4c('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x2c4c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2c4c('0x6')](),'updatedAt':Date[_0x2c4c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2c4c('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2c4c('0x4')+i+_0x2c4c('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2c4c('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x2c4c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2c4c('0x6')](),'updatedAt':Date[_0x2c4c('0x6')]()});}db[_0x2c4c('0x7')][_0x2c4c('0x8')]({'where':{}})[_0x2c4c('0x9')](function(){return db[_0x2c4c('0x7')][_0x2c4c('0xa')](contacts);})[_0x2c4c('0x9')](function(){console[_0x2c4c('0xb')](_0x2c4c('0xc'),_0x2c4c('0xd'));return db['CmHopper']['destroy']({'where':{}});})[_0x2c4c('0x9')](function(){return db[_0x2c4c('0xe')][_0x2c4c('0xa')](hopper);})[_0x2c4c('0x9')](function(){console[_0x2c4c('0xb')](_0x2c4c('0xc'),_0x2c4c('0xf'));return db[_0x2c4c('0x7')][_0x2c4c('0xa')](contacts2);})['then'](function(){console[_0x2c4c('0xb')](_0x2c4c('0xc'),_0x2c4c('0x10'));return db['CmHopper']['bulkCreate'](hopper2);})[_0x2c4c('0x9')](function(){console['log'](_0x2c4c('0xc'),'hopper2');})[_0x2c4c('0x11')](function(_0x109f3f){console[_0x2c4c('0xb')](_0x109f3f);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a944598..0de757e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffbf=['%s%s','agent','format','%s%s@xcally.com','password','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','../mysqldb','push'];(function(_0x365251,_0x30efc7){var _0x4c9e29=function(_0x61cc4f){while(--_0x61cc4f){_0x365251['push'](_0x365251['shift']());}};_0x4c9e29(++_0x30efc7);}(_0xffbf,0xa0));var _0xfffb=function(_0x52895f,_0x43d32e){_0x52895f=_0x52895f-0x0;var _0x185123=_0xffbf[_0x52895f];return _0x185123;};'use strict';var util=require('util');var db=require(_0xfffb('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xfffb('0x1')]({'name':util['format'](_0xfffb('0x2'),_0xfffb('0x3'),i),'fullname':util['format'](_0xfffb('0x2'),'agent',i),'email':util[_0xfffb('0x4')](_0xfffb('0x5'),_0xfffb('0x3'),i),'role':_0xfffb('0x3'),'password':_0xfffb('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xfffb('0x7'),'ws',_0xfffb('0x8')],'disallow':['all'],'allow':[_0xfffb('0x9')],'defaultuser':util[_0xfffb('0x4')](_0xfffb('0x2'),'agent',i),'encryption':_0xfffb('0xa'),'avpf':'yes','force_avp':'yes','icesupport':_0xfffb('0xa'),'dtlsenable':_0xfffb('0xa'),'dtlsverify':'no','dtlscertfile':_0xfffb('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xfffb('0xc'),'callerid':util[_0xfffb('0x4')](_0xfffb('0xd'),util[_0xfffb('0x4')]('%s%s',_0xfffb('0x3'),i),0xfa0+i)});}db[_0xfffb('0xe')][_0xfffb('0xf')](users)[_0xfffb('0x10')](function(){console['log'](_0xfffb('0x11'));})['catch'](function(_0x394739){console['log'](_0x394739);}); \ No newline at end of file +var _0x1f4e=['format','%s%s','%s%s@xcally.com','agent','friend','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1f4e,0x1ca));var _0xe1f4=function(_0x493cea,_0x144c6a){_0x493cea=_0x493cea-0x0;var _0x1c32ba=_0x1f4e[_0x493cea];return _0x1c32ba;};'use strict';var util=require(_0xe1f4('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xe1f4('0x1')]('%s%s','agent',i),'fullname':util[_0xe1f4('0x1')](_0xe1f4('0x2'),'agent',i),'email':util[_0xe1f4('0x1')](_0xe1f4('0x3'),'agent',i),'role':_0xe1f4('0x4'),'password':'password','internal':0xfa0+i,'type':_0xe1f4('0x5'),'transport':['udp','ws','wss'],'disallow':[_0xe1f4('0x6')],'allow':['ulaw'],'defaultuser':util[_0xe1f4('0x1')](_0xe1f4('0x2'),_0xe1f4('0x4'),i),'encryption':'yes','avpf':_0xe1f4('0x7'),'force_avp':_0xe1f4('0x7'),'icesupport':_0xe1f4('0x7'),'dtlsenable':_0xe1f4('0x7'),'dtlsverify':'no','dtlscertfile':_0xe1f4('0x8'),'dtlsprivatekey':_0xe1f4('0x9'),'dtlssetup':_0xe1f4('0xa'),'callerid':util[_0xe1f4('0x1')](_0xe1f4('0xb'),util[_0xe1f4('0x1')]('%s%s','agent',i),0xfa0+i)});}db['User'][_0xe1f4('0xc')](users)[_0xe1f4('0xd')](function(){console[_0xe1f4('0xe')](_0xe1f4('0xf'));})[_0xe1f4('0x10')](function(_0x3276a4){console[_0xe1f4('0xe')](_0x3276a4);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3ca2df3..79f3a22 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3f3=['removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','remoteAddress','request','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','findOne','then','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','where','Campaign','type','length','format','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','ChatQueues','ChatQueue','FaxQueues','Trunks','getVoiceQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','whatsapp','map','leave'];(function(_0x517ad3,_0x3015d5){var _0x3c69d6=function(_0xef0f04){while(--_0xef0f04){_0x517ad3['push'](_0x517ad3['shift']());}};_0x3c69d6(++_0x3015d5);}(_0xc3f3,0xd2));var _0x3c3f=function(_0x502716,_0x5bed83){_0x502716=_0x502716-0x0;var _0x249857=_0xc3f3[_0x502716];return _0x249857;};'use strict';var _=require('lodash');var util=require(_0x3c3f('0x0'));var BPromise=require(_0x3c3f('0x1'));var db=require(_0x3c3f('0x2'))['db'];var config=require(_0x3c3f('0x3'));var queryQueues={'attributes':['id',_0x3c3f('0x4')],'include':[{'as':_0x3c3f('0x5'),'model':db[_0x3c3f('0x6')],'attributes':['id',_0x3c3f('0x4'),_0x3c3f('0x7')],'raw':!![],'where':{'role':_0x3c3f('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3c3f('0x4')],'where':{'role':_0x3c3f('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x3c3f('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x3c3f('0x4')],'where':{'role':_0x3c3f('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x3c3f('0x4'),'type'],'where':{'type':_0x3c3f('0xa')}};function getAssociatedResources(_0x3cd21c,_0x4c8866,_0x3e6bbb){return db[_0x3c3f('0xb')][_0x3c3f('0xc')]({'where':{'name':_0x3cd21c,'userProfileId':_0x4c8866},'raw':!![]})[_0x3c3f('0xd')](function(_0x140b26){if(_0x140b26){if(_0x140b26['autoAssociation']){switch(_0x3cd21c){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case _0x3c3f('0xe'):case'MailQueues':case _0x3c3f('0xf'):case _0x3c3f('0x10'):return db[_0x3e6bbb]['findAll'](queryQueues);case'Telephones':return db[_0x3e6bbb][_0x3c3f('0x11')](queryTelephones);case'Trunks':return db[_0x3e6bbb][_0x3c3f('0x11')](queryTrunks);case _0x3c3f('0x12'):return db[_0x3e6bbb][_0x3c3f('0x11')](queryCampaigns);}}else{return db['UserProfileResource'][_0x3c3f('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x140b26['id']},'raw':!![]})[_0x3c3f('0xd')](function(_0x10ea8b){if(_0x10ea8b){var _0x4e5994={'where':{'id':_['map'](_0x10ea8b,'resourceId')},'raw':!![]};switch(_0x3e6bbb){case _0x3c3f('0x6'):_0x4e5994[_0x3c3f('0x13')][_0x3c3f('0x7')]=_0x3c3f('0x9');break;case _0x3c3f('0x14'):_0x4e5994[_0x3c3f('0x13')][_0x3c3f('0x15')]='ivr';break;}return db[_0x3e6bbb][_0x3c3f('0x11')](_0x4e5994);}else{return[];}});}}else{return[];}})[_0x3c3f('0xd')](function(_0x470140){return _0x470140;});}function joinOrLeaveQueues(_0x50bd47,_0x31471b,_0xa0d45c,_0x22b6c7){_0x50bd47[_0x31471b](util['format']('%s:queue:%s',_0xa0d45c,_0x22b6c7[_0x3c3f('0x4')]));if(_0x22b6c7['Agents']){for(var _0x15626a=0x0;_0x15626a<_0x22b6c7['Agents'][_0x3c3f('0x16')];_0x15626a+=0x1){_0x50bd47[_0x31471b](util[_0x3c3f('0x17')]('user:%s',_0x22b6c7[_0x3c3f('0x5')][_0x15626a][_0x3c3f('0x4')]));}}}function joinOrLeave(_0x33b7d1,_0x41ec87,_0x22dbad){var _0x32bdcf;if(_0x33b7d1[_0x3c3f('0x18')][_0x3c3f('0x19')]['id']){db['User'][_0x3c3f('0x1a')]({'attributes':['id',_0x3c3f('0x4'),_0x3c3f('0x7'),_0x3c3f('0x1b')],'where':{'id':_0x33b7d1[_0x3c3f('0x18')][_0x3c3f('0x19')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x3c3f('0x1c'),'attributes':['id'],'raw':!![]},{'model':db[_0x3c3f('0x1d')],'as':_0x3c3f('0x1e'),'attributes':['id'],'raw':!![]},{'model':db[_0x3c3f('0x1f')],'as':_0x3c3f('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x3c3f('0x21')],'as':_0x3c3f('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x3c3f('0x23')],'as':_0x3c3f('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x3c3f('0x25')],'as':_0x3c3f('0x26'),'attributes':['id'],'raw':!![]}]})[_0x3c3f('0xd')](function(_0x26f0d6){if(_0x26f0d6){_0x32bdcf=_0x26f0d6;_0x33b7d1[_0x41ec87](util[_0x3c3f('0x17')](_0x3c3f('0x27'),_0x26f0d6['name']));var _0x4188a8=[];switch(_0x26f0d6[_0x3c3f('0x7')]){case _0x3c3f('0x28'):_0x33b7d1[_0x41ec87](_0x3c3f('0x29'));_0x33b7d1[_0x41ec87](_0x3c3f('0x2a'));if(queryQueues[_0x3c3f('0x2b')](_0x3c3f('0x2c'))){delete queryQueues[_0x3c3f('0x2c')];}_0x4188a8['push'](db['VoiceQueue'][_0x3c3f('0x11')](queryQueues));_0x4188a8[_0x3c3f('0x2d')](db['ChatQueue'][_0x3c3f('0x11')](queryQueues));_0x4188a8['push'](db[_0x3c3f('0x2e')][_0x3c3f('0x11')](queryQueues));_0x4188a8['push'](db[_0x3c3f('0x2f')][_0x3c3f('0x11')](queryQueues));_0x4188a8[_0x3c3f('0x2d')](db[_0x3c3f('0x30')]['findAll'](queryQueues));_0x4188a8[_0x3c3f('0x2d')](db[_0x3c3f('0x31')][_0x3c3f('0x11')](queryQueues));_0x4188a8[_0x3c3f('0x2d')](db[_0x3c3f('0x32')]['findAll'](queryQueues));_0x4188a8[_0x3c3f('0x2d')](db[_0x3c3f('0x6')][_0x3c3f('0x11')](queryTelephones));_0x4188a8['push'](db[_0x3c3f('0x33')]['findAll'](queryTrunks));_0x4188a8[_0x3c3f('0x2d')](db[_0x3c3f('0x14')][_0x3c3f('0x11')](queryCampaigns));_0x4188a8[_0x3c3f('0x2d')](db[_0x3c3f('0x6')][_0x3c3f('0x11')](queryAgents));break;case _0x3c3f('0x34'):_0x33b7d1[_0x41ec87](_0x3c3f('0x29'));_0x33b7d1[_0x41ec87](_0x3c3f('0x2a'));_0x4188a8['push'](getAssociatedResources('VoiceQueues',_0x26f0d6[_0x3c3f('0x1b')],_0x3c3f('0x35')));_0x4188a8[_0x3c3f('0x2d')](getAssociatedResources(_0x3c3f('0x36'),_0x26f0d6['userProfileId'],_0x3c3f('0x37')));_0x4188a8['push'](getAssociatedResources(_0x3c3f('0x38'),_0x26f0d6[_0x3c3f('0x1b')],_0x3c3f('0x2e')));_0x4188a8[_0x3c3f('0x2d')](getAssociatedResources(_0x3c3f('0xe'),_0x26f0d6['userProfileId'],'SmsQueue'));_0x4188a8[_0x3c3f('0x2d')](getAssociatedResources('MailQueues',_0x26f0d6[_0x3c3f('0x1b')],_0x3c3f('0x30')));_0x4188a8['push'](getAssociatedResources(_0x3c3f('0xf'),_0x26f0d6[_0x3c3f('0x1b')],_0x3c3f('0x31')));_0x4188a8['push'](getAssociatedResources(_0x3c3f('0x10'),_0x26f0d6['userProfileId'],_0x3c3f('0x32')));_0x4188a8['push'](getAssociatedResources('Telephones',_0x26f0d6[_0x3c3f('0x1b')],_0x3c3f('0x6')));_0x4188a8[_0x3c3f('0x2d')](getAssociatedResources(_0x3c3f('0x39'),_0x26f0d6[_0x3c3f('0x1b')],'Trunk'));_0x4188a8[_0x3c3f('0x2d')](getAssociatedResources(_0x3c3f('0x12'),_0x26f0d6[_0x3c3f('0x1b')],'Campaign'));_0x4188a8['push'](db[_0x3c3f('0x6')][_0x3c3f('0x11')](queryAgents));break;case _0x3c3f('0x8'):_0x33b7d1[_0x41ec87]('voice:inbound');_0x33b7d1[_0x41ec87](_0x3c3f('0x2a'));_0x4188a8[_0x3c3f('0x2d')](_0x26f0d6[_0x3c3f('0x3a')]({'attributes':['id','name']}));_0x4188a8[_0x3c3f('0x2d')](_0x26f0d6['getChatQueues']({'attributes':['id',_0x3c3f('0x4')]}));_0x4188a8[_0x3c3f('0x2d')](_0x26f0d6['getFaxQueues']({'attributes':['id',_0x3c3f('0x4')]}));_0x4188a8[_0x3c3f('0x2d')](_0x26f0d6[_0x3c3f('0x3b')]({'attributes':['id',_0x3c3f('0x4')]}));_0x4188a8[_0x3c3f('0x2d')](_0x26f0d6[_0x3c3f('0x3c')]({'attributes':['id',_0x3c3f('0x4')]}));_0x4188a8[_0x3c3f('0x2d')](_0x26f0d6[_0x3c3f('0x3d')]({'attributes':['id',_0x3c3f('0x4')]}));_0x4188a8['push'](_0x26f0d6[_0x3c3f('0x3e')]({'attributes':['id',_0x3c3f('0x4')]}));break;}return BPromise[_0x3c3f('0x3f')](_0x4188a8);}})[_0x3c3f('0xd')](function(_0x2c0e43){if(_0x2c0e43&&_0x2c0e43[_0x3c3f('0x16')]){for(var _0x387254=0x0;_0x387254<_0x2c0e43[_0x3c3f('0x16')];_0x387254+=0x1){for(var _0x124769=0x0;_0x124769<_0x2c0e43[_0x387254][_0x3c3f('0x16')];_0x124769+=0x1){switch(_0x387254){case 0x0:joinOrLeaveQueues(_0x33b7d1,_0x41ec87,_0x3c3f('0x40'),_0x2c0e43[_0x387254][_0x124769]);break;case 0x1:joinOrLeaveQueues(_0x33b7d1,_0x41ec87,_0x3c3f('0x41'),_0x2c0e43[_0x387254][_0x124769]);break;case 0x2:joinOrLeaveQueues(_0x33b7d1,_0x41ec87,_0x3c3f('0x42'),_0x2c0e43[_0x387254][_0x124769]);break;case 0x3:joinOrLeaveQueues(_0x33b7d1,_0x41ec87,_0x3c3f('0x43'),_0x2c0e43[_0x387254][_0x124769]);break;case 0x4:joinOrLeaveQueues(_0x33b7d1,_0x41ec87,_0x3c3f('0x44'),_0x2c0e43[_0x387254][_0x124769]);break;case 0x5:joinOrLeaveQueues(_0x33b7d1,_0x41ec87,'openchannel',_0x2c0e43[_0x387254][_0x124769]);break;case 0x6:joinOrLeaveQueues(_0x33b7d1,_0x41ec87,_0x3c3f('0x45'),_0x2c0e43[_0x387254][_0x124769]);break;case 0x7:if(_0x32bdcf[_0x3c3f('0x7')]!==_0x3c3f('0x8'))_0x33b7d1[_0x41ec87](util[_0x3c3f('0x17')]('telephone:%s',_0x2c0e43[_0x387254][_0x124769][_0x3c3f('0x4')]));break;case 0x8:if(_0x32bdcf['role']!==_0x3c3f('0x8'))_0x33b7d1[_0x41ec87](util['format']('trunk:%s',_0x2c0e43[_0x387254][_0x124769][_0x3c3f('0x4')]));break;case 0x9:if(_0x32bdcf[_0x3c3f('0x7')]!==_0x3c3f('0x8'))_0x33b7d1[_0x41ec87](util[_0x3c3f('0x17')]('campaign:%s:%s',_0x2c0e43[_0x387254][_0x124769][_0x3c3f('0x15')],_0x2c0e43[_0x387254][_0x124769][_0x3c3f('0x4')]));break;case 0xa:_0x33b7d1[_0x41ec87](util[_0x3c3f('0x17')]('user:%s',_0x2c0e43[_0x387254][_0x124769][_0x3c3f('0x4')]));break;}}}}})[_0x3c3f('0xd')](function(){if(_0x41ec87==='leave'){var _0x161bd6=_[_0x3c3f('0x46')](_0x32bdcf['ChatInteractions'],'id');return _0x32bdcf['removeChatInteractions'](_0x161bd6)[_0x3c3f('0xd')](function(){for(var _0x2155b8=0x0;_0x2155b8<_0x161bd6[_0x3c3f('0x16')];_0x2155b8+=0x1){_0x22dbad['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x161bd6[_0x2155b8]),'UserId':Number(_0x32bdcf['id'])});}});}})[_0x3c3f('0xd')](function(){if(_0x41ec87===_0x3c3f('0x47')){var _0x43fd25=_[_0x3c3f('0x46')](_0x32bdcf['MailInteractions'],'id');return _0x32bdcf['removeMailInteractions'](_0x43fd25)[_0x3c3f('0xd')](function(){for(var _0x530403=0x0;_0x530403<_0x43fd25['length'];_0x530403+=0x1){_0x22dbad['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x43fd25[_0x530403]),'UserId':Number(_0x32bdcf['id'])});}});}})[_0x3c3f('0xd')](function(){if(_0x41ec87==='leave'){var _0x2674ec=_[_0x3c3f('0x46')](_0x32bdcf[_0x3c3f('0x20')],'id');return _0x32bdcf[_0x3c3f('0x48')](_0x2674ec)[_0x3c3f('0xd')](function(){for(var _0x523f09=0x0;_0x523f09<_0x2674ec[_0x3c3f('0x16')];_0x523f09+=0x1){_0x22dbad[_0x3c3f('0x49')](_0x3c3f('0x4a'),{'FaxInteractionId':Number(_0x2674ec[_0x523f09]),'UserId':Number(_0x32bdcf['id'])});}});}})['then'](function(){if(_0x41ec87===_0x3c3f('0x47')){var _0x4919a6=_[_0x3c3f('0x46')](_0x32bdcf[_0x3c3f('0x22')],'id');return _0x32bdcf[_0x3c3f('0x4b')](_0x4919a6)[_0x3c3f('0xd')](function(){for(var _0x31c002=0x0;_0x31c002<_0x4919a6[_0x3c3f('0x16')];_0x31c002+=0x1){_0x22dbad[_0x3c3f('0x49')](_0x3c3f('0x4c'),{'SmsInteractionId':Number(_0x4919a6[_0x31c002]),'UserId':Number(_0x32bdcf['id'])});}});}})[_0x3c3f('0xd')](function(){if(_0x41ec87===_0x3c3f('0x47')){var _0x3c9f6b=_[_0x3c3f('0x46')](_0x32bdcf['OpenchannelInteractions'],'id');return _0x32bdcf['removeOpenchannelInteractions'](_0x3c9f6b)['then'](function(){for(var _0x11adf7=0x0;_0x11adf7<_0x3c9f6b[_0x3c3f('0x16')];_0x11adf7+=0x1){_0x22dbad[_0x3c3f('0x49')](_0x3c3f('0x4d'),{'OpenchannelInteractionId':Number(_0x3c9f6b[_0x11adf7]),'UserId':Number(_0x32bdcf['id'])});}});}})[_0x3c3f('0xd')](function(){if(_0x41ec87===_0x3c3f('0x47')){var _0x5a74c5=_['map'](_0x32bdcf[_0x3c3f('0x26')],'id');return _0x32bdcf[_0x3c3f('0x4e')](_0x5a74c5)[_0x3c3f('0xd')](function(){for(var _0x571a7e=0x0;_0x571a7e<_0x5a74c5[_0x3c3f('0x16')];_0x571a7e+=0x1){_0x22dbad[_0x3c3f('0x49')](_0x3c3f('0x4f'),{'WhatsappInteractionId':Number(_0x5a74c5[_0x571a7e]),'UserId':Number(_0x32bdcf['id'])});}});}})[_0x3c3f('0x50')](function(_0x146cbe){_0x33b7d1[_0x3c3f('0x51')](_0x146cbe);});}}function onDisconnect(_0x58cac5,_0x562da7){joinOrLeave(_0x58cac5,'leave',_0x562da7);}function onConnect(_0x3f5a7a){joinOrLeave(_0x3f5a7a,_0x3c3f('0x52'));}exports[_0x3c3f('0x53')]=function(_0x5628c7){_0x5628c7['on'](_0x3c3f('0x54'),function(_0x2ec4c8){_0x2ec4c8[_0x3c3f('0x55')](0x0);_0x2ec4c8[_0x3c3f('0x56')]=_0x2ec4c8['request'][_0x3c3f('0x54')][_0x3c3f('0x57')]+':'+_0x2ec4c8[_0x3c3f('0x58')]['connection']['remotePort'];_0x2ec4c8['connectedAt']=new Date();_0x2ec4c8[_0x3c3f('0x51')]=function(_0x15c297){console[_0x3c3f('0x51')](_0x3c3f('0x59')+_0x2ec4c8[_0x3c3f('0x5a')][_0x3c3f('0x4')]+'['+_0x2ec4c8[_0x3c3f('0x56')]+']',_0x15c297);};_0x2ec4c8['on'](_0x3c3f('0x5b'),function(){onDisconnect(_0x2ec4c8,_0x5628c7);_0x2ec4c8[_0x3c3f('0x51')](_0x3c3f('0x5c'));});onConnect(_0x2ec4c8);_0x2ec4c8[_0x3c3f('0x51')](_0x3c3f('0x5d'));});}; \ No newline at end of file +var _0xdcde=['type','format','%s:queue:%s','Agents','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:outbound','Trunks','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','removeMailInteractions','map','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','catch','log','join','address','connection','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','../mysqldb','./environment','name','role','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','User','where','telephone','Campaign'];(function(_0x48e515,_0x598084){var _0x1b4d16=function(_0x3d37e9){while(--_0x3d37e9){_0x48e515['push'](_0x48e515['shift']());}};_0x1b4d16(++_0x598084);}(_0xdcde,0x1d0));var _0xedcd=function(_0x134796,_0x5aeb0d){_0x134796=_0x134796-0x0;var _0x388846=_0xdcde[_0x134796];return _0x388846;};'use strict';var _=require(_0xedcd('0x0'));var util=require(_0xedcd('0x1'));var BPromise=require('bluebird');var db=require(_0xedcd('0x2'))['db'];var config=require(_0xedcd('0x3'));var queryQueues={'attributes':['id',_0xedcd('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id','name',_0xedcd('0x5')],'raw':!![],'where':{'role':_0xedcd('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xedcd('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xedcd('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xedcd('0x4')],'where':{'role':_0xedcd('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xedcd('0x4'),'type'],'where':{'type':_0xedcd('0x7')}};function getAssociatedResources(_0x2ce75a,_0x35e647,_0x263453){return db[_0xedcd('0x8')][_0xedcd('0x9')]({'where':{'name':_0x2ce75a,'userProfileId':_0x35e647},'raw':!![]})[_0xedcd('0xa')](function(_0x20128d){if(_0x20128d){if(_0x20128d[_0xedcd('0xb')]){switch(_0x2ce75a){case _0xedcd('0xc'):case _0xedcd('0xd'):case _0xedcd('0xe'):case _0xedcd('0xf'):case _0xedcd('0x10'):case _0xedcd('0x11'):case _0xedcd('0x12'):return db[_0x263453]['findAll'](queryQueues);case _0xedcd('0x13'):return db[_0x263453][_0xedcd('0x14')](queryTelephones);case'Trunks':return db[_0x263453][_0xedcd('0x14')](queryTrunks);case _0xedcd('0x15'):return db[_0x263453]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0xedcd('0x14')]({'attributes':['resourceId'],'where':{'sectionId':_0x20128d['id']},'raw':!![]})['then'](function(_0x4091b3){if(_0x4091b3){var _0x39a87a={'where':{'id':_['map'](_0x4091b3,'resourceId')},'raw':!![]};switch(_0x263453){case _0xedcd('0x16'):_0x39a87a[_0xedcd('0x17')]['role']=_0xedcd('0x18');break;case _0xedcd('0x19'):_0x39a87a[_0xedcd('0x17')][_0xedcd('0x1a')]='ivr';break;}return db[_0x263453]['findAll'](_0x39a87a);}else{return[];}});}}else{return[];}})[_0xedcd('0xa')](function(_0x23d850){return _0x23d850;});}function joinOrLeaveQueues(_0x4151ac,_0x32d07f,_0x5b33d8,_0x398654){_0x4151ac[_0x32d07f](util[_0xedcd('0x1b')](_0xedcd('0x1c'),_0x5b33d8,_0x398654['name']));if(_0x398654[_0xedcd('0x1d')]){for(var _0x506c11=0x0;_0x506c11<_0x398654[_0xedcd('0x1d')][_0xedcd('0x1e')];_0x506c11+=0x1){_0x4151ac[_0x32d07f](util[_0xedcd('0x1b')](_0xedcd('0x1f'),_0x398654[_0xedcd('0x1d')][_0x506c11]['name']));}}}function joinOrLeave(_0x4e7360,_0x41e13d,_0xed7aed){var _0x1b51d9;if(_0x4e7360['handshake'][_0xedcd('0x20')]['id']){db['User'][_0xedcd('0x21')]({'attributes':['id',_0xedcd('0x4'),_0xedcd('0x5'),_0xedcd('0x22')],'where':{'id':_0x4e7360[_0xedcd('0x23')]['query']['id']},'include':[{'model':db[_0xedcd('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xedcd('0x25')],'as':_0xedcd('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xedcd('0x27')],'as':_0xedcd('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xedcd('0x29')],'as':_0xedcd('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xedcd('0x2b')],'as':_0xedcd('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0xedcd('0x2d')],'as':_0xedcd('0x2e'),'attributes':['id'],'raw':!![]}]})[_0xedcd('0xa')](function(_0x561b14){if(_0x561b14){_0x1b51d9=_0x561b14;_0x4e7360[_0x41e13d](util[_0xedcd('0x1b')](_0xedcd('0x1f'),_0x561b14[_0xedcd('0x4')]));var _0x517ec0=[];switch(_0x561b14[_0xedcd('0x5')]){case _0xedcd('0x2f'):_0x4e7360[_0x41e13d](_0xedcd('0x30'));_0x4e7360[_0x41e13d]('voice:outbound');if(queryQueues[_0xedcd('0x31')]('include')){delete queryQueues[_0xedcd('0x32')];}_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x34')][_0xedcd('0x14')](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x35')]['findAll'](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x36')][_0xedcd('0x14')](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x37')]['findAll'](queryQueues));_0x517ec0['push'](db[_0xedcd('0x38')][_0xedcd('0x14')](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x39')][_0xedcd('0x14')](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x3a')]['findAll'](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x16')]['findAll'](queryTelephones));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x3b')][_0xedcd('0x14')](queryTrunks));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x19')][_0xedcd('0x14')](queryCampaigns));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x16')]['findAll'](queryAgents));break;case'user':_0x4e7360[_0x41e13d](_0xedcd('0x30'));_0x4e7360[_0x41e13d](_0xedcd('0x3c'));_0x517ec0[_0xedcd('0x33')](getAssociatedResources('VoiceQueues',_0x561b14[_0xedcd('0x22')],'VoiceQueue'));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0xd'),_0x561b14[_0xedcd('0x22')],'ChatQueue'));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0xe'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x36')));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0xf'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x37')));_0x517ec0['push'](getAssociatedResources(_0xedcd('0x10'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x38')));_0x517ec0['push'](getAssociatedResources('OpenchannelQueues',_0x561b14[_0xedcd('0x22')],'OpenchannelQueue'));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0x12'),_0x561b14['userProfileId'],'WhatsappQueue'));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0x13'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x16')));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0x3d'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x3b')));_0x517ec0['push'](getAssociatedResources(_0xedcd('0x15'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x19')));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x16')]['findAll'](queryAgents));break;case _0xedcd('0x6'):_0x4e7360[_0x41e13d]('voice:inbound');_0x4e7360[_0x41e13d]('voice:outbound');_0x517ec0[_0xedcd('0x33')](_0x561b14['getVoiceQueues']({'attributes':['id','name']}));_0x517ec0['push'](_0x561b14[_0xedcd('0x3e')]({'attributes':['id','name']}));_0x517ec0['push'](_0x561b14[_0xedcd('0x3f')]({'attributes':['id',_0xedcd('0x4')]}));_0x517ec0[_0xedcd('0x33')](_0x561b14['getSmsQueues']({'attributes':['id',_0xedcd('0x4')]}));_0x517ec0[_0xedcd('0x33')](_0x561b14[_0xedcd('0x40')]({'attributes':['id',_0xedcd('0x4')]}));_0x517ec0['push'](_0x561b14[_0xedcd('0x41')]({'attributes':['id',_0xedcd('0x4')]}));_0x517ec0['push'](_0x561b14[_0xedcd('0x42')]({'attributes':['id',_0xedcd('0x4')]}));break;}return BPromise[_0xedcd('0x43')](_0x517ec0);}})[_0xedcd('0xa')](function(_0x3e754a){if(_0x3e754a&&_0x3e754a[_0xedcd('0x1e')]){for(var _0x19893f=0x0;_0x19893f<_0x3e754a[_0xedcd('0x1e')];_0x19893f+=0x1){for(var _0x5a113a=0x0;_0x5a113a<_0x3e754a[_0x19893f][_0xedcd('0x1e')];_0x5a113a+=0x1){switch(_0x19893f){case 0x0:joinOrLeaveQueues(_0x4e7360,_0x41e13d,'voice',_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x1:joinOrLeaveQueues(_0x4e7360,_0x41e13d,'chat',_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x2:joinOrLeaveQueues(_0x4e7360,_0x41e13d,'fax',_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x3:joinOrLeaveQueues(_0x4e7360,_0x41e13d,_0xedcd('0x44'),_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x4:joinOrLeaveQueues(_0x4e7360,_0x41e13d,_0xedcd('0x45'),_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x5:joinOrLeaveQueues(_0x4e7360,_0x41e13d,_0xedcd('0x46'),_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x6:joinOrLeaveQueues(_0x4e7360,_0x41e13d,_0xedcd('0x47'),_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x7:if(_0x1b51d9[_0xedcd('0x5')]!==_0xedcd('0x6'))_0x4e7360[_0x41e13d](util['format'](_0xedcd('0x48'),_0x3e754a[_0x19893f][_0x5a113a][_0xedcd('0x4')]));break;case 0x8:if(_0x1b51d9[_0xedcd('0x5')]!==_0xedcd('0x6'))_0x4e7360[_0x41e13d](util[_0xedcd('0x1b')](_0xedcd('0x49'),_0x3e754a[_0x19893f][_0x5a113a][_0xedcd('0x4')]));break;case 0x9:if(_0x1b51d9[_0xedcd('0x5')]!==_0xedcd('0x6'))_0x4e7360[_0x41e13d](util['format'](_0xedcd('0x4a'),_0x3e754a[_0x19893f][_0x5a113a][_0xedcd('0x1a')],_0x3e754a[_0x19893f][_0x5a113a][_0xedcd('0x4')]));break;case 0xa:_0x4e7360[_0x41e13d](util[_0xedcd('0x1b')](_0xedcd('0x1f'),_0x3e754a[_0x19893f][_0x5a113a]['name']));break;}}}}})[_0xedcd('0xa')](function(){if(_0x41e13d===_0xedcd('0x4b')){var _0x271c82=_['map'](_0x1b51d9[_0xedcd('0x4c')],'id');return _0x1b51d9[_0xedcd('0x4d')](_0x271c82)['then'](function(){for(var _0x1c5c95=0x0;_0x1c5c95<_0x271c82['length'];_0x1c5c95+=0x1){_0xed7aed[_0xedcd('0x4e')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x271c82[_0x1c5c95]),'UserId':Number(_0x1b51d9['id'])});}});}})['then'](function(){if(_0x41e13d===_0xedcd('0x4b')){var _0x4a5b7f=_['map'](_0x1b51d9[_0xedcd('0x26')],'id');return _0x1b51d9[_0xedcd('0x4f')](_0x4a5b7f)[_0xedcd('0xa')](function(){for(var _0x12dafb=0x0;_0x12dafb<_0x4a5b7f[_0xedcd('0x1e')];_0x12dafb+=0x1){_0xed7aed[_0xedcd('0x4e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4a5b7f[_0x12dafb]),'UserId':Number(_0x1b51d9['id'])});}});}})[_0xedcd('0xa')](function(){if(_0x41e13d===_0xedcd('0x4b')){var _0x55daec=_[_0xedcd('0x50')](_0x1b51d9[_0xedcd('0x28')],'id');return _0x1b51d9['removeFaxInteractions'](_0x55daec)[_0xedcd('0xa')](function(){for(var _0x52c861=0x0;_0x52c861<_0x55daec[_0xedcd('0x1e')];_0x52c861+=0x1){_0xed7aed[_0xedcd('0x4e')](_0xedcd('0x51'),{'FaxInteractionId':Number(_0x55daec[_0x52c861]),'UserId':Number(_0x1b51d9['id'])});}});}})[_0xedcd('0xa')](function(){if(_0x41e13d===_0xedcd('0x4b')){var _0x55fb79=_[_0xedcd('0x50')](_0x1b51d9['SmsInteractions'],'id');return _0x1b51d9[_0xedcd('0x52')](_0x55fb79)[_0xedcd('0xa')](function(){for(var _0x5ca493=0x0;_0x5ca493<_0x55fb79[_0xedcd('0x1e')];_0x5ca493+=0x1){_0xed7aed[_0xedcd('0x4e')](_0xedcd('0x53'),{'SmsInteractionId':Number(_0x55fb79[_0x5ca493]),'UserId':Number(_0x1b51d9['id'])});}});}})[_0xedcd('0xa')](function(){if(_0x41e13d===_0xedcd('0x4b')){var _0x1d6f0f=_[_0xedcd('0x50')](_0x1b51d9['OpenchannelInteractions'],'id');return _0x1b51d9[_0xedcd('0x54')](_0x1d6f0f)[_0xedcd('0xa')](function(){for(var _0x2d5be3=0x0;_0x2d5be3<_0x1d6f0f[_0xedcd('0x1e')];_0x2d5be3+=0x1){_0xed7aed['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x1d6f0f[_0x2d5be3]),'UserId':Number(_0x1b51d9['id'])});}});}})['then'](function(){if(_0x41e13d==='leave'){var _0x15fd72=_[_0xedcd('0x50')](_0x1b51d9[_0xedcd('0x2e')],'id');return _0x1b51d9[_0xedcd('0x55')](_0x15fd72)[_0xedcd('0xa')](function(){for(var _0x218c89=0x0;_0x218c89<_0x15fd72[_0xedcd('0x1e')];_0x218c89+=0x1){_0xed7aed[_0xedcd('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x15fd72[_0x218c89]),'UserId':Number(_0x1b51d9['id'])});}});}})[_0xedcd('0x56')](function(_0x1fa189){_0x4e7360[_0xedcd('0x57')](_0x1fa189);});}}function onDisconnect(_0x2d1b2f,_0x299fba){joinOrLeave(_0x2d1b2f,'leave',_0x299fba);}function onConnect(_0x4ebb41){joinOrLeave(_0x4ebb41,_0xedcd('0x58'));}exports['default']=function(_0x4d0305){_0x4d0305['on']('connection',function(_0x5de550){_0x5de550['setMaxListeners'](0x0);_0x5de550[_0xedcd('0x59')]=_0x5de550['request'][_0xedcd('0x5a')][_0xedcd('0x5b')]+':'+_0x5de550[_0xedcd('0x5c')]['connection'][_0xedcd('0x5d')];_0x5de550[_0xedcd('0x5e')]=new Date();_0x5de550[_0xedcd('0x57')]=function(_0x1aeff7){console['log'](_0xedcd('0x5f')+_0x5de550[_0xedcd('0x60')][_0xedcd('0x4')]+'['+_0x5de550[_0xedcd('0x59')]+']',_0x1aeff7);};_0x5de550['on'](_0xedcd('0x61'),function(){onDisconnect(_0x5de550,_0x4d0305);_0x5de550[_0xedcd('0x57')]('DISCONNECTED');});onConnect(_0x5de550);_0x5de550[_0xedcd('0x57')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 088380a..15d7de7 100644 --- a/server/config/triggers/index.js +++ b/server/config/triggers/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5501=['MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','UserId','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','ContactId','contact','undefined','interface','AfterCreate','changed','closed','substatus','SELECT','AfterUpdate','find','fullname','model','hook','condition','../../mysqldb','jayson/promise','../logger','client','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction'];(function(_0x43678d,_0x2d867b){var _0x2d0b33=function(_0x226813){while(--_0x226813){_0x43678d['push'](_0x43678d['shift']());}};_0x2d0b33(++_0x2d867b);}(_0x5501,0x77));var _0x1550=function(_0x521b2a,_0x5784a4){_0x521b2a=_0x521b2a-0x0;var _0x12e744=_0x5501[_0x521b2a];return _0x12e744;};'use strict';var util=require('util');var db=require(_0x1550('0x0'))['db'];var jayson=require(_0x1550('0x1'));var logger=require(_0x1550('0x2'))('triggers');var client=jayson[_0x1550('0x3')][_0x1550('0x4')]({'port':0x232a});var triggers=[{'channel':_0x1550('0x5'),'model':'ChatInteraction','event':_0x1550('0x6'),'condition':_0x1550('0x7'),'callback':afterCreate},{'channel':_0x1550('0x5'),'model':_0x1550('0x8'),'event':_0x1550('0x9'),'condition':_0x1550('0xa'),'callback':afterUpdate},{'channel':_0x1550('0x5'),'model':_0x1550('0xb'),'event':_0x1550('0x6'),'condition':_0x1550('0xc'),'callback':afterCreateMessage},{'channel':_0x1550('0x5'),'model':'ChatOfflineMessage','event':_0x1550('0x6'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x1550('0xd'),'event':_0x1550('0x6'),'condition':_0x1550('0x7'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x1550('0x9'),'condition':_0x1550('0xa'),'callback':afterUpdate},{'channel':'Sms','model':_0x1550('0xe'),'event':_0x1550('0x6'),'condition':_0x1550('0xc'),'callback':afterCreateMessage},{'channel':_0x1550('0xf'),'model':_0x1550('0x10'),'event':_0x1550('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1550('0xf'),'model':'WhatsappInteraction','event':_0x1550('0x9'),'condition':_0x1550('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x1550('0x11'),'event':'afterCreate','condition':_0x1550('0xc'),'callback':afterCreateMessage},{'channel':_0x1550('0x12'),'model':_0x1550('0x13'),'event':'afterCreate','condition':_0x1550('0x7'),'callback':afterCreate},{'channel':'Fax','model':_0x1550('0x13'),'event':_0x1550('0x9'),'condition':_0x1550('0xa'),'callback':afterUpdate},{'channel':'Fax','model':_0x1550('0x14'),'event':_0x1550('0x6'),'condition':_0x1550('0xc'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0x1550('0x6'),'condition':_0x1550('0x7'),'callback':afterCreate},{'channel':_0x1550('0x15'),'model':_0x1550('0x16'),'event':_0x1550('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0x1550('0x17'),'event':_0x1550('0x6'),'condition':_0x1550('0xc'),'callback':afterCreateMessage},{'channel':_0x1550('0x18'),'model':'OpenchannelInteraction','event':_0x1550('0x6'),'condition':_0x1550('0x7'),'callback':afterCreate},{'channel':_0x1550('0x18'),'model':_0x1550('0x19'),'event':_0x1550('0x9'),'condition':_0x1550('0xa'),'callback':afterUpdate},{'channel':_0x1550('0x18'),'model':_0x1550('0x1a'),'event':_0x1550('0x6'),'condition':_0x1550('0xc'),'callback':afterCreateMessage}];function request(_0x33ed5f){return client[_0x1550('0x1b')](_0x1550('0x1c'),_0x33ed5f)[_0x1550('0x1d')](function(_0x184b57){logger[_0x1550('0x1e')](_0x1550('0x1f'),_0x1550('0x1c'),_0x184b57);if(_0x184b57['error']){if(_0x184b57[_0x1550('0x20')][_0x1550('0x21')]===0x1f4){logger[_0x1550('0x20')](_0x1550('0x1f'),_0x1550('0x1c'),_0x184b57['error']);}}})[_0x1550('0x22')](function(_0x596c5a){logger[_0x1550('0x20')](_0x1550('0x1f'),'EventManager',_0x596c5a);});}function afterCreateMessage(_0xbdff62){return function(_0x589f92){_0x589f92=_0x589f92[_0x1550('0x23')]({'plain':!![]});_0x589f92[_0x1550('0x24')]=_0xbdff62;_0x589f92[_0x1550('0x25')]=_0xbdff62;_0x589f92[_0x1550('0x26')]=_0x589f92[_0x1550('0x27')];Promise[_0x1550('0x28')]()[_0x1550('0x1d')](function(){if(typeof _0x589f92['ContactId']==='undefined')return null;var _0x22c1ac=_0x1550('0x29')+_0x589f92['ContactId'];return db[_0x1550('0x2a')][_0x1550('0x2b')](_0x22c1ac,{'type':db[_0x1550('0x2c')][_0x1550('0x2d')]['SELECT'],'raw':!![]});})['then'](function(_0x5bec8f){if(_0x5bec8f){_0x589f92['contact']=_0x5bec8f[0x0];}if(typeof _0x589f92['UserId']==='undefined')return;return getAgent(_0x589f92[_0x1550('0x2e')]);})[_0x1550('0x1d')](function(_0xd8487d){if(_0xd8487d){_0x589f92['interface']=util[_0x1550('0x2f')](_0x1550('0x30'),_0xd8487d[_0x1550('0x31')]);_0x589f92[_0x1550('0x32')]=_0xd8487d;_0x589f92[_0x1550('0x24')]=_0xbdff62;return request({'event':_0x1550('0x33'),'message':_0x589f92});}else{return request({'event':_0x1550('0x34'),'message':_0x589f92});}})[_0x1550('0x22')](function(_0x26339f){logger[_0x1550('0x20')](_0x1550('0x1f'),_0x1550('0x35'),_0x26339f);});};}function afterCreateOfflineMessage(_0x10956d){return function(_0x4cdd70){_0x4cdd70=_0x4cdd70[_0x1550('0x23')]({'plain':!![]});_0x4cdd70[_0x1550('0x24')]=_0x10956d;_0x4cdd70[_0x1550('0x25')]=_0x10956d;_0x4cdd70[_0x1550('0x26')]=_0x1550('0x36');return request({'event':_0x4cdd70[_0x1550('0x26')],'message':_0x4cdd70});};}function afterCreate(_0x266a9f,_0xa79be9){return function(_0x4bbb3c){_0x4bbb3c=_0x4bbb3c[_0x1550('0x23')]({'plain':!![]});_0x4bbb3c['channel']=_0x266a9f;_0x4bbb3c[_0x1550('0x25')]=_0x266a9f;_0x4bbb3c['event']=_0x1550('0x37');Promise[_0x1550('0x28')]()[_0x1550('0x1d')](function(){var _0x3f904e=_0x1550('0x29')+_0x4bbb3c[_0x1550('0x38')];return db['sequelize'][_0x1550('0x2b')](_0x3f904e,{'type':db[_0x1550('0x2c')][_0x1550('0x2d')]['SELECT'],'raw':!![]});})['then'](function(_0x31ba1a){if(_0x31ba1a){_0x4bbb3c[_0x1550('0x39')]=_0x31ba1a[0x0];}if(typeof _0x4bbb3c['UserId']===_0x1550('0x3a'))return;return getAgent(_0x4bbb3c[_0x1550('0x2e')]);})[_0x1550('0x1d')](function(_0x3f804c){if(_0x3f804c){_0x4bbb3c[_0x1550('0x3b')]=util[_0x1550('0x2f')]('SIP/%s',_0x3f804c[_0x1550('0x31')]);_0x4bbb3c['agent']=_0x3f804c;}return request({'event':_0xa79be9,'message':_0x4bbb3c});})[_0x1550('0x22')](function(_0xa11e94){logger[_0x1550('0x20')]('Trigger,\x20%s',_0x1550('0x3c'),_0xa11e94);});};}function afterUpdate(_0x5aec3c){return function(_0x390d58){var _0x5f0308=_0x390d58[_0x1550('0x3d')](_0x1550('0x3e'))&&_0x390d58[_0x1550('0x3e')];var _0x3222a3=_0x390d58[_0x1550('0x3d')](_0x1550('0x3f'));if(_0x5f0308||_0x3222a3){var _0x18287f=_0x5f0308?_0x1550('0xa'):_0x1550('0x3f');var _0x22c90c=_0x390d58['get']({'plain':!![]});_0x22c90c[_0x1550('0x24')]=_0x5aec3c;_0x22c90c[_0x1550('0x25')]=_0x5aec3c;_0x22c90c[_0x1550('0x26')]=_0x5f0308?_0x1550('0x3e'):'substatus';var _0x406251=_0x1550('0x29')+_0x22c90c[_0x1550('0x38')];return db[_0x1550('0x2a')][_0x1550('0x2b')](_0x406251,{'type':db[_0x1550('0x2c')][_0x1550('0x2d')][_0x1550('0x40')],'raw':!![]})['then'](function(_0xae8d02){if(_0xae8d02){_0x22c90c[_0x1550('0x39')]=_0xae8d02[0x0];}if(typeof _0x22c90c[_0x1550('0x2e')]===_0x1550('0x3a'))return;return getAgent(_0x22c90c['UserId']);})[_0x1550('0x1d')](function(_0x24a071){if(_0x24a071){_0x22c90c['interface']=util[_0x1550('0x2f')](_0x1550('0x30'),_0x24a071['name']);_0x22c90c[_0x1550('0x32')]=_0x24a071;}return request({'event':_0x18287f,'message':_0x22c90c});})[_0x1550('0x22')](function(_0xa14c06){logger['error'](_0x1550('0x1f'),_0x1550('0x41'),_0xa14c06);});}};}function getAgent(_0x21cb20){return db['User'][_0x1550('0x42')]({'where':{'id':_0x21cb20},'attributes':['id',_0x1550('0x31'),_0x1550('0x43'),'email','internal'],'raw':!![]})['then'](function(_0x996d53){return _0x996d53;});}exports['default']=function(){for(var _0x13ec9e=0x0;_0x13ec9e=_0x24e7b7[_0xdb8a('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x27ed45(_0x1812ca);})[_0xdb8a('0x14')](function(_0x5b96e8){_0x1e7fd6(_0x5b96e8);});});}; \ No newline at end of file +var _0x5852=['../mysqldb','./license/util','voice','mail','chat','fax','sms','openchannel','isValidChannel','toLowerCase','includes','blockedAt','updateAttributes','getLicense','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird'];(function(_0x259f93,_0x491e42){var _0x2e4777=function(_0x321c02){while(--_0x321c02){_0x259f93['push'](_0x259f93['shift']());}};_0x2e4777(++_0x491e42);}(_0x5852,0x82));var _0x2585=function(_0x35825e,_0x657421){_0x35825e=_0x35825e-0x0;var _0x4f4d90=_0x5852[_0x35825e];return _0x4f4d90;};'use strict';var _=require(_0x2585('0x0'));var BPromise=require(_0x2585('0x1'));var db=require(_0x2585('0x2'))['db'];var util=require(_0x2585('0x3'));var channels=[_0x2585('0x4'),_0x2585('0x5'),_0x2585('0x6'),_0x2585('0x7'),_0x2585('0x8'),'whatsapp',_0x2585('0x9')];exports['getChannels']=function(){return channels;};exports[_0x2585('0xa')]=function(_0x4a3b8b){_0x4a3b8b=_0x4a3b8b[_0x2585('0xb')]();return _[_0x2585('0xc')](channels,_0x4a3b8b);};exports['clearBlockUser']=function(_0x3a6d2b,_0x3377f7,_0x4e0459,_0x5e83dd){var _0x5d7661={'loginAttempts':_0x3377f7,'blocked':_0x4e0459};if(!_['isUndefined'](_0x5e83dd)){_0x5d7661[_0x2585('0xd')]=_0x5e83dd;}return _0x3a6d2b[_0x2585('0xe')](_0x5d7661);};exports[_0x2585('0xf')]=function(_0x401575){return new BPromise(function(_0x2ee717,_0x131931){var _0x1d8311=0x0;if(_0x401575['role']!==_0x2585('0x10')){_0x2ee717(_0x401575);}db[_0x2585('0x11')][_0x2585('0x12')]({'where':{'role':_0x2585('0x10'),'online':!![],'id':{'$ne':_0x401575['id']}}})[_0x2585('0x13')](function(_0x1cbcf6){_0x1d8311=_0x1cbcf6;return util['getLicense']();})[_0x2585('0x13')](function(_0x1b4cc4){if(_0x1b4cc4&&_0x1b4cc4[_0x2585('0x14')]&&_0x1d8311>=_0x1b4cc4['agents']){throw Error(_0x2585('0x15'));}_0x2ee717(_0x401575);})['catch'](function(_0xdc21e5){_0x131931(_0xdc21e5);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index cd5183f..6104ae9 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9071=['404','status','render','json','send','exports'];(function(_0x57b170,_0x42b81f){var _0x2d7e29=function(_0x5b2984){while(--_0x5b2984){_0x57b170['push'](_0x57b170['shift']());}};_0x2d7e29(++_0x42b81f);}(_0x9071,0x6b));var _0x1907=function(_0x2602dd,_0x2e0a5d){_0x2602dd=_0x2602dd-0x0;var _0x453e5a=_0x9071[_0x2602dd];return _0x453e5a;};'use strict';module[_0x1907('0x0')][0x194]=function pageNotFound(_0x486f24,_0x16dff5){var _0x376b40=_0x1907('0x1');var _0x6d1baa=0x194;var _0x18a10f={'status':_0x6d1baa};_0x16dff5['status'](_0x18a10f[_0x1907('0x2')]);_0x16dff5[_0x1907('0x3')](_0x376b40,{},function(_0x53d27b,_0x58caeb){if(_0x53d27b){return _0x16dff5[_0x1907('0x2')](_0x18a10f['status'])[_0x1907('0x4')](_0x18a10f);}_0x16dff5[_0x1907('0x5')](_0x58caeb);});}; \ No newline at end of file +var _0x4dfc=['render','json','404','status'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x4dfc,0xda));var _0xc4df=function(_0x306646,_0xdc2e1b){_0x306646=_0x306646-0x0;var _0x40bd8d=_0x4dfc[_0x306646];return _0x40bd8d;};'use strict';module['exports'][0x194]=function pageNotFound(_0x5036f6,_0x4edcd3){var _0x4114c8=_0xc4df('0x0');var _0x3571ba=0x194;var _0x18ec70={'status':_0x3571ba};_0x4edcd3[_0xc4df('0x1')](_0x18ec70[_0xc4df('0x1')]);_0x4edcd3[_0xc4df('0x2')](_0x4114c8,{},function(_0x4a36ef,_0x5b227a){if(_0x4a36ef){return _0x4edcd3['status'](_0x18ec70[_0xc4df('0x1')])[_0xc4df('0x3')](_0x18ec70);}_0x4edcd3['send'](_0x5b227a);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 97139f8..dea4d38 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea29=['../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','Recordings','hasMany','VoiceQueuesRt','HopperFinals','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','UserNotification','UserNotifications','SenderId','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','ChatInteraction','ChatInteractions','user_has_chat_interactions','user_has_sms_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueue','ChatQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','HopperHistories','CmHopperBlack','belongsTo','TrunkId','TrunkBackup','Interval','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','uniqueid','Contact','MailAccountId','CloudProviderId','restrict','Disposition','Answers','Messages','Interactions','List','ListId','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','ContactId','Dashboard','Items','Dispositions','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','IntervalId','TagId','SmsInteractionId','ThroughTags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelMessage','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatMessage','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatInternalMessage','ChatGroupId','CompanyId','Hoppers','JscriptySessions','CmCompany','Company','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','moh_has_sounds','cm_contact_has_tags','sms_interaction_has_tags','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','AnalyticMetric','DescriptionId','Subject','SubjectId','Description','Field','FieldId','Variable','Configurations','AccountId','Subjects','Descriptions','VariableId','ZohoConfiguration','ZohoAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','VtigerField','FreshsalesField','ToId','SessionId','ProjectId','team_has_chat_queues','FaxQueues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','FromAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToQueue','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','Smtp','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','mysql','database','username','password','sequelizeHistory','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xea29,0x1a9));var _0x9ea2=function(_0x1c1577,_0x1d4d6d){_0x1c1577=_0x1c1577-0x0;var _0x566d1f=_0xea29[_0x1c1577];return _0x566d1f;};'use strict';var config=require(_0x9ea2('0x0'));var Sequelize=require(_0x9ea2('0x1'));var _=require(_0x9ea2('0x2'));var jstz=require(_0x9ea2('0x3'));var timezone=jstz[_0x9ea2('0x4')]();config['sequelize']=_[_0x9ea2('0x5')](config[_0x9ea2('0x1')],{'database':_0x9ea2('0x6'),'username':'xcall','password':_0x9ea2('0x7'),'options':{'host':_0x9ea2('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x9ea2('0x9')},'logging':![],'timezone':timezone[_0x9ea2('0xa')](),'define':{'charset':_0x9ea2('0xb'),'collate':_0x9ea2('0xc')}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x9ea2('0x6'),'username':'xcall','password':_0x9ea2('0x7'),'options':{'host':_0x9ea2('0x8'),'port':0xcea,'dialect':_0x9ea2('0xd'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x9ea2('0xa')](),'define':{'charset':_0x9ea2('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9ea2('0x1')][_0x9ea2('0xe')],config[_0x9ea2('0x1')][_0x9ea2('0xf')],config[_0x9ea2('0x1')][_0x9ea2('0x10')],config[_0x9ea2('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9ea2('0x11')][_0x9ea2('0xe')],config['sequelizeHistory'][_0x9ea2('0xf')],config[_0x9ea2('0x11')]['password'],config[_0x9ea2('0x11')][_0x9ea2('0x12')])};db[_0x9ea2('0x13')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x15'));db['VoiceChanSpy']=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x16'));db[_0x9ea2('0x17')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x18'));db[_0x9ea2('0x19')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x1a'));db[_0x9ea2('0x1b')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x1c'));db[_0x9ea2('0x1d')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x1e'));db[_0x9ea2('0x1f')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x20'));db[_0x9ea2('0x21')]=db[_0x9ea2('0x1')]['import']('../api/screenRecording/screenRecording.model');db[_0x9ea2('0x22')]=db['sequelize']['import'](_0x9ea2('0x23'));db[_0x9ea2('0x24')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x25'));db[_0x9ea2('0x26')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x27'));db[_0x9ea2('0x28')]=db[_0x9ea2('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x9ea2('0x29')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x2a'));db[_0x9ea2('0x2b')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x2c'));db[_0x9ea2('0x2d')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x2e'));db[_0x9ea2('0x2f')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x30'));db['VoiceTransferReport']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x31'));db[_0x9ea2('0x32')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x33'));db[_0x9ea2('0x34')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x35'));db[_0x9ea2('0x36')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x37'));db[_0x9ea2('0x38')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x39'));db['UserFaxQueue']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x3a'));db[_0x9ea2('0x3b')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x3c'));db[_0x9ea2('0x3d')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x3e'));db[_0x9ea2('0x3f')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x40'));db[_0x9ea2('0x41')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x42'));db[_0x9ea2('0x43')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0x9ea2('0x44')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x45'));db[_0x9ea2('0x46')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x47'));db['MailSubstatus']=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x48'));db[_0x9ea2('0x49')]=db['sequelize'][_0x9ea2('0x14')]('../api/mailInteraction/mailInteraction.model');db[_0x9ea2('0x4a')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x4b'));db[_0x9ea2('0x4c')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x4d'));db[_0x9ea2('0x4e')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x4f'));db['Dashboard']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x50'));db[_0x9ea2('0x51')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x52'));db[_0x9ea2('0x53')]=db['sequelize']['import']('../api/faxAccount/faxAccount.model');db[_0x9ea2('0x54')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/faxApplication/faxApplication.model');db[_0x9ea2('0x55')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x56'));db[_0x9ea2('0x57')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/faxMessage/faxMessage.model');db[_0x9ea2('0x58')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x59'));db[_0x9ea2('0x5a')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x5b'));db['SmsAccount']=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/smsAccount/smsAccount.model');db[_0x9ea2('0x5c')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/smsApplication/smsApplication.model');db[_0x9ea2('0x5d')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x5e'));db[_0x9ea2('0x5f')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x60'));db[_0x9ea2('0x61')]=db['sequelize']['import'](_0x9ea2('0x62'));db[_0x9ea2('0x63')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x64'));db[_0x9ea2('0x65')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x66'));db[_0x9ea2('0x67')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x68'));db['OpenchannelMessage']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x69'));db[_0x9ea2('0x6a')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0x9ea2('0x6b')]=db['sequelize']['import'](_0x9ea2('0x6c'));db[_0x9ea2('0x6d')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x9ea2('0x6e')]=db['sequelize']['import'](_0x9ea2('0x6f'));db['ChatInteraction']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x70'));db['ChatMessage']=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x71'));db['ChatOfflineMessage']=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x72'));db['ChatQueue']=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/chatQueue/chatQueue.model');db[_0x9ea2('0x73')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x74'));db['ChatProactiveAction']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x75'));db['CmCompany']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x76'));db[_0x9ea2('0x77')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/cmContact/cmContact.model');db[_0x9ea2('0x78')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x79'));db['CmHopperBlack']=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x7a'));db[_0x9ea2('0x7b')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x7c'));db[_0x9ea2('0x7d')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x7e'));db[_0x9ea2('0x7f')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x80'));db[_0x9ea2('0x81')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x82'));db[_0x9ea2('0x83')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/action/action.model');db[_0x9ea2('0x84')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x85'));db[_0x9ea2('0x86')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x87'));db['Disposition']=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x88'));db[_0x9ea2('0x89')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x8a'));db['Interval']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x8b'));db[_0x9ea2('0x8c')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x8d'));db[_0x9ea2('0x8e')]=db['sequelize'][_0x9ea2('0x14')]('../api/cdr/cdr.model');db[_0x9ea2('0x8f')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x90'));db['Schedule']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x91'));db[_0x9ea2('0x92')]=db['sequelize']['import'](_0x9ea2('0x93'));db[_0x9ea2('0x94')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x95'));db[_0x9ea2('0x96')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/template/template.model');db['Trigger']=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x97'));db['Variable']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x98'));db[_0x9ea2('0x99')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/integration/integration.model');db['IntegrationReport']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x9a'));db['AnalyticCustomReport']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x9b'));db[_0x9ea2('0x9c')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x9d'));db[_0x9ea2('0x9e')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x9f'));db['AnalyticMetric']=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0xa0'));db[_0x9ea2('0xa1')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xa2'));db[_0x9ea2('0xa3')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xa4'));db[_0x9ea2('0xa5')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xa6'));db[_0x9ea2('0xa7')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xa8'));db[_0x9ea2('0xa9')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xaa'));db[_0x9ea2('0xab')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0xac'));db[_0x9ea2('0xad')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xae'));db[_0x9ea2('0xaf')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xb0'));db[_0x9ea2('0xb1')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xb2'));db[_0x9ea2('0xb3')]=db['sequelize']['import'](_0x9ea2('0xb4'));db[_0x9ea2('0xb5')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xb6'));db['ZohoAccount']=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0xb7'));db['ZohoConfiguration']=db[_0x9ea2('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x9ea2('0xb8')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0xb9'));db[_0x9ea2('0xba')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xbb'));db[_0x9ea2('0xbc')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xbd'));db[_0x9ea2('0xbe')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xbf'));db[_0x9ea2('0xc0')]=db[_0x9ea2('0x1')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db['sequelize'][_0x9ea2('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x9ea2('0xc1')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xc2'));db[_0x9ea2('0xc3')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xc4'));db['VtigerField']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xc5'));db[_0x9ea2('0xc6')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x9ea2('0xc7')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0xc8'));db[_0x9ea2('0xc9')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xca'));db[_0x9ea2('0xcb')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0xcc'));db[_0x9ea2('0xcd')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xce'));db[_0x9ea2('0xcf')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xd0'));db[_0x9ea2('0xd1')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0xd2'));db[_0x9ea2('0xd3')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0xd4'));db['FreshsalesField']=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0xd5'));db[_0x9ea2('0x99')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xd6'));db['Network']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xd7'));db[_0x9ea2('0xd8')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xd9'));db['ChatInternalMessage']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xda'));db[_0x9ea2('0xdb')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0xdc'));db[_0x9ea2('0xdd')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xde'));db[_0x9ea2('0xdf')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xe0'));db[_0x9ea2('0xe1')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0xe2'));db[_0x9ea2('0xe3')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xe4'));db[_0x9ea2('0xe5')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xe6'));db[_0x9ea2('0xe7')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xe8'));db['Setting']=db[_0x9ea2('0x1')]['import'](_0x9ea2('0xe9'));db['SquareOdbc']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xea'));db['SquareProject']=db[_0x9ea2('0x1')]['import'](_0x9ea2('0xeb'));db[_0x9ea2('0xec')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0xed'));db['SquareMessage']=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0xee'));db['Team']=db['sequelize']['import']('../api/team/team.model');db[_0x9ea2('0xef')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xf0'));db[_0x9ea2('0xf1')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0xf2'));db[_0x9ea2('0xf3')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xf4'));db[_0x9ea2('0xf5')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/attachment/attachment.model');db[_0x9ea2('0xf6')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/plugin/plugin.model');db[_0x9ea2('0xf7')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0x9ea2('0xf8')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xf9'));db[_0x9ea2('0xfa')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0x9ea2('0xfb')]=db['sequelize']['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0xfc'));db[_0x9ea2('0xfd')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0xfe'));db[_0x9ea2('0xff')]=db[_0x9ea2('0x1')]['import'](_0x9ea2('0x100'));db[_0x9ea2('0x101')]=db['sequelize']['import'](_0x9ea2('0x102'));db[_0x9ea2('0x103')]=db['sequelize'][_0x9ea2('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x9ea2('0x104')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x105'));db['UserNotification']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x106'));db[_0x9ea2('0x107')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0x9ea2('0x108')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/whatsappApplication/whatsappApplication.model');db[_0x9ea2('0x109')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x10a'));db[_0x9ea2('0x10b')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0x9ea2('0x10c')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x10d'));db['WhatsappTransferReport']=db['sequelize']['import'](_0x9ea2('0x10e'));db['WhatsappQueue']=db['sequelize']['import'](_0x9ea2('0x10f'));db[_0x9ea2('0x110')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x111'));db['TeamVoiceQueue']=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x112'));db[_0x9ea2('0x113')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x114'));db[_0x9ea2('0x115')]=db[_0x9ea2('0x1')][_0x9ea2('0x14')](_0x9ea2('0x116'));db[_0x9ea2('0x117')]=db['sequelize'][_0x9ea2('0x14')](_0x9ea2('0x118'));db[_0x9ea2('0x13')][_0x9ea2('0x119')](db['VoiceMail'],{'as':_0x9ea2('0x22'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x13')][_0x9ea2('0x119')](db[_0x9ea2('0x117')],{'as':_0x9ea2('0x11c'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x13')]['hasMany'](db[_0x9ea2('0x1f')],{'as':_0x9ea2('0x11d'),'foreignKey':'UserId'});db[_0x9ea2('0x13')][_0x9ea2('0x11e')](db[_0x9ea2('0x32')],{'as':_0x9ea2('0x11f'),'foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x13')][_0x9ea2('0x11e')](db[_0x9ea2('0x19')],{'as':'Extensions','onDelete':_0x9ea2('0x11a'),'hooks':!![]});db[_0x9ea2('0x13')][_0x9ea2('0x11e')](db[_0x9ea2('0x7b')],{'as':_0x9ea2('0x120'),'foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x13')]['hasMany'](db[_0x9ea2('0x7d')],{'as':'HopperHistory','foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x13')][_0x9ea2('0x11e')](db[_0x9ea2('0x7f')],{'as':_0x9ea2('0x7f'),'foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x13')][_0x9ea2('0x11e')](db[_0x9ea2('0x67')],{'as':_0x9ea2('0x121'),'foreignKey':_0x9ea2('0x11b')});db['User'][_0x9ea2('0x11e')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0x9ea2('0x13')][_0x9ea2('0x11e')](db['SmsInteraction'],{'as':_0x9ea2('0x122'),'foreignKey':_0x9ea2('0x11b')});db['User'][_0x9ea2('0x11e')](db['FaxInteraction'],{'as':_0x9ea2('0x123'),'foreignKey':'UserId'});db[_0x9ea2('0x13')][_0x9ea2('0x11e')](db[_0x9ea2('0x49')],{'as':_0x9ea2('0x124'),'foreignKey':_0x9ea2('0x11b')});db['User'][_0x9ea2('0x11e')](db[_0x9ea2('0x109')],{'as':'WhatsappInteractions','foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x13')][_0x9ea2('0x11e')](db[_0x9ea2('0x125')],{'as':_0x9ea2('0x126'),'foreignKey':_0x9ea2('0x127')});db[_0x9ea2('0x13')]['belongsTo'](db['UserProfile'],{'as':_0x9ea2('0x101'),'foreignKey':_0x9ea2('0x128')});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0x73')],{'as':_0x9ea2('0x12a'),'through':_0x9ea2('0x12b')});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0x77')],{'as':_0x9ea2('0x12c'),'through':_0x9ea2('0x12d')});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0xfd')],{'as':_0x9ea2('0x12e'),'through':_0x9ea2('0x12f')});db['User']['belongsToMany'](db[_0x9ea2('0x130')],{'through':_0x9ea2('0x131')});db[_0x9ea2('0x13')]['belongsToMany'](db[_0x9ea2('0x49')],{'as':_0x9ea2('0x124'),'through':_0x9ea2('0x132')});db['User']['belongsToMany'](db[_0x9ea2('0x133')],{'as':_0x9ea2('0x134'),'through':_0x9ea2('0x135')});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db['FaxInteraction'],{'as':_0x9ea2('0x123'),'through':'user_has_fax_interactions'});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0x5d')],{'as':_0x9ea2('0x122'),'through':_0x9ea2('0x136')});db['User']['belongsToMany'](db[_0x9ea2('0x67')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db['User'][_0x9ea2('0x129')](db[_0x9ea2('0x109')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x9ea2('0x13')]['belongsToMany'](db['VoiceQueue'],{'as':_0x9ea2('0x137'),'through':'UserVoiceQueue','required':![]});db[_0x9ea2('0x13')]['belongsToMany'](db[_0x9ea2('0xff')],{'as':_0x9ea2('0x138'),'through':_0x9ea2('0x115'),'required':![]});db['User'][_0x9ea2('0x129')](db['MailQueue'],{'as':_0x9ea2('0x139'),'through':_0x9ea2('0x38'),'required':![]});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0x13a')],{'as':_0x9ea2('0x13b'),'through':_0x9ea2('0x36'),'required':![],'hooks':!![]});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0x58')],{'as':'FaxQueues','through':_0x9ea2('0x13c'),'required':![]});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0x61')],{'as':_0x9ea2('0x13d'),'through':'UserSmsQueue','required':![]});db['User'][_0x9ea2('0x129')](db[_0x9ea2('0x6a')],{'as':_0x9ea2('0x13e'),'through':'UserOpenchannelQueue','required':![]});db['User']['belongsToMany'](db[_0x9ea2('0x13f')],{'as':_0x9ea2('0x140'),'through':'UserWhatsappQueue','required':![]});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0x6b')],{'as':_0x9ea2('0x141'),'through':_0x9ea2('0x142')});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0x53')],{'as':'FaxAccounts','through':_0x9ea2('0x143')});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0x44')],{'as':_0x9ea2('0x144'),'through':_0x9ea2('0x145')});db[_0x9ea2('0x13')]['belongsToMany'](db[_0x9ea2('0x63')],{'as':_0x9ea2('0x146'),'through':_0x9ea2('0x147')});db['User'][_0x9ea2('0x129')](db[_0x9ea2('0x148')],{'as':_0x9ea2('0x149'),'through':_0x9ea2('0x14a')});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0x107')],{'as':_0x9ea2('0x14b'),'through':_0x9ea2('0x14c')});db[_0x9ea2('0x13')][_0x9ea2('0x129')](db[_0x9ea2('0x14d')],{'as':_0x9ea2('0x14e'),'through':_0x9ea2('0x14f')});db[_0x9ea2('0x150')][_0x9ea2('0x11e')](db[_0x9ea2('0x19')],{'as':_0x9ea2('0x151'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x152')});db[_0x9ea2('0x17')]['hasMany'](db[_0x9ea2('0x19')],{'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x19')]['hasMany'](db[_0x9ea2('0x19')],{'as':_0x9ea2('0x153'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x1b')][_0x9ea2('0x129')](db[_0x9ea2('0x92')],{'as':_0x9ea2('0x154'),'through':'moh_has_sounds'});db[_0x9ea2('0x1d')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x9ea2('0x155'),'foreignKey':_0x9ea2('0x156')});db[_0x9ea2('0x1d')]['hasMany'](db[_0x9ea2('0x78')],{'as':'Hoppers','foreignKey':_0x9ea2('0x156')});db[_0x9ea2('0x1d')][_0x9ea2('0x11e')](db[_0x9ea2('0x7b')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x9ea2('0x1d')][_0x9ea2('0x11e')](db[_0x9ea2('0x7d')],{'as':_0x9ea2('0x157'),'foreignKey':_0x9ea2('0x156')});db[_0x9ea2('0x1d')][_0x9ea2('0x11e')](db[_0x9ea2('0x7f')],{'as':_0x9ea2('0x7f'),'foreignKey':_0x9ea2('0x156')});db[_0x9ea2('0x1d')][_0x9ea2('0x11e')](db[_0x9ea2('0x158')],{'as':'HopperBlacks','foreignKey':_0x9ea2('0x156')});db[_0x9ea2('0x1d')][_0x9ea2('0x11e')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x9ea2('0x156')});db[_0x9ea2('0x1d')][_0x9ea2('0x159')](db[_0x9ea2('0x2f')],{'as':'Trunk','foreignKey':_0x9ea2('0x15a')});db[_0x9ea2('0x1d')]['belongsTo'](db['Trunk'],{'as':_0x9ea2('0x15b'),'foreignKey':'TrunkBackupId'});db[_0x9ea2('0x1d')][_0x9ea2('0x159')](db[_0x9ea2('0x15c')],{'as':_0x9ea2('0x15c'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0x9ea2('0x159')](db[_0x9ea2('0x8c')],{'as':_0x9ea2('0x15d'),'foreignKey':_0x9ea2('0x15e')});db[_0x9ea2('0x1d')][_0x9ea2('0x129')](db[_0x9ea2('0xfd')],{'as':_0x9ea2('0x12e'),'through':_0x9ea2('0x15f')});db[_0x9ea2('0x1d')][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x160'),'through':'UserVoiceQueue'});db[_0x9ea2('0x1d')]['belongsToMany'](db[_0x9ea2('0x130')],{'as':_0x9ea2('0x161'),'through':_0x9ea2('0x162')});db[_0x9ea2('0x1d')]['belongsToMany'](db[_0x9ea2('0xfd')],{'as':_0x9ea2('0x163'),'through':_0x9ea2('0x164')});db[_0x9ea2('0x1f')][_0x9ea2('0x159')](db['User'],{'as':_0x9ea2('0x13'),'foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x21')][_0x9ea2('0x159')](db['User'],{'as':_0x9ea2('0x13'),'foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x22')]['hasMany'](db[_0x9ea2('0x24')],{'as':'Messages','onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x165'),'sourceKey':_0x9ea2('0x166')});db[_0x9ea2('0x24')][_0x9ea2('0x159')](db['VoiceMail'],{'foreignKey':_0x9ea2('0x165'),'targetKey':'mailbox'});db[_0x9ea2('0x26')][_0x9ea2('0x11e')](db[_0x9ea2('0x2b')],{'as':'QueueCalls','foreignKey':_0x9ea2('0x167'),'constraints':![]});db[_0x9ea2('0x26')]['hasMany'](db[_0x9ea2('0x29')],{'as':'AgentReports','foreignKey':_0x9ea2('0x167'),'constraints':![]});db[_0x9ea2('0x26')]['belongsTo'](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x13'),'foreignKey':'UserId'});db[_0x9ea2('0x26')][_0x9ea2('0x159')](db[_0x9ea2('0x77')],{'as':_0x9ea2('0x168'),'foreignKey':'ContactId'});db[_0x9ea2('0x41')]['belongsTo'](db[_0x9ea2('0x44')],{'as':'MailAccount','foreignKey':_0x9ea2('0x169')});db[_0x9ea2('0x41')]['belongsTo'](db['CloudProvider'],{'as':_0x9ea2('0x110'),'foreignKey':_0x9ea2('0x16a'),'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x43')][_0x9ea2('0x159')](db[_0x9ea2('0x44')],{'as':_0x9ea2('0x44'),'foreignKey':_0x9ea2('0x169')});db[_0x9ea2('0x43')][_0x9ea2('0x159')](db[_0x9ea2('0x110')],{'as':_0x9ea2('0x110'),'foreignKey':'CloudProviderId','onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x44')][_0x9ea2('0x119')](db['MailServerIn'],{'as':'Imap','onDelete':_0x9ea2('0x11a')});db['MailAccount'][_0x9ea2('0x119')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x44')][_0x9ea2('0x11e')](db[_0x9ea2('0x16c')],{'as':'Dispositions','foreignKey':_0x9ea2('0x169'),'onDelete':_0x9ea2('0x11a')});db['MailAccount'][_0x9ea2('0x11e')](db['CannedAnswer'],{'as':_0x9ea2('0x16d'),'foreignKey':_0x9ea2('0x169')});db[_0x9ea2('0x44')][_0x9ea2('0x11e')](db[_0x9ea2('0x4a')],{'as':_0x9ea2('0x16e'),'foreignKey':_0x9ea2('0x169')});db[_0x9ea2('0x44')][_0x9ea2('0x11e')](db[_0x9ea2('0x49')],{'as':_0x9ea2('0x16f')});db[_0x9ea2('0x44')][_0x9ea2('0x11e')](db[_0x9ea2('0x4c')],{'as':_0x9ea2('0x153')});db[_0x9ea2('0x44')][_0x9ea2('0x159')](db['CmList'],{'as':_0x9ea2('0x170'),'foreignKey':_0x9ea2('0x171')});db[_0x9ea2('0x44')]['belongsTo'](db[_0x9ea2('0x96')],{'as':_0x9ea2('0x96'),'foreignKey':'TemplateId'});db[_0x9ea2('0x44')]['belongsTo'](db[_0x9ea2('0x8c')],{'as':_0x9ea2('0x15d'),'foreignKey':_0x9ea2('0x15e')});db[_0x9ea2('0x44')][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':'Agents','through':_0x9ea2('0x145')});db[_0x9ea2('0x46')][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x160'),'through':_0x9ea2('0x38')});db[_0x9ea2('0x46')]['belongsToMany'](db[_0x9ea2('0x130')],{'through':'team_has_mail_queues','as':_0x9ea2('0x161')});db[_0x9ea2('0x49')][_0x9ea2('0x11e')](db['MailMessage'],{'as':_0x9ea2('0x16e'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x172')});db[_0x9ea2('0x49')][_0x9ea2('0x159')](db[_0x9ea2('0x44')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x169')});db['MailInteraction']['belongsTo'](db[_0x9ea2('0x77')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9ea2('0x49')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x174'),'foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x49')][_0x9ea2('0x129')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x9ea2('0x175')});db[_0x9ea2('0x49')][_0x9ea2('0x129')](db[_0x9ea2('0x94')],{'through':_0x9ea2('0x176'),'as':'ThroughTags'});db[_0x9ea2('0x49')]['belongsToMany'](db['User'],{'as':_0x9ea2('0x177'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db['MailMessage'][_0x9ea2('0x11e')](db[_0x9ea2('0xf5')],{'as':_0x9ea2('0x178'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x4a')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'as':'User'});db[_0x9ea2('0x4a')]['belongsTo'](db[_0x9ea2('0x77')],{'onDelete':_0x9ea2('0x11a'),'as':'Contact'});db['MailMessage'][_0x9ea2('0x159')](db[_0x9ea2('0x49')],{'as':_0x9ea2('0x179'),'foreignKey':_0x9ea2('0x172')});db[_0x9ea2('0x4a')][_0x9ea2('0x159')](db[_0x9ea2('0x44')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x169')});db[_0x9ea2('0x4a')][_0x9ea2('0x159')](db['ChatWebsite'],{'as':_0x9ea2('0x6b'),'foreignKey':_0x9ea2('0x17a')});db[_0x9ea2('0x4a')][_0x9ea2('0x159')](db[_0x9ea2('0x17b')],{'as':'ChatOfflineMessage','foreignKey':_0x9ea2('0x17c')});db['MailApplication'][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x4c')]['belongsTo'](db['MailQueue'],{'onDelete':'restrict'});db['MailApplication'][_0x9ea2('0x159')](db[_0x9ea2('0x44')],{'onDelete':'restrict'});db[_0x9ea2('0x4c')][_0x9ea2('0x159')](db[_0x9ea2('0x15c')],{'onDelete':_0x9ea2('0x16b'),'foreignKey':'IntervalId'});db[_0x9ea2('0x4c')]['belongsTo'](db[_0x9ea2('0x94')],{'onDelete':_0x9ea2('0x16b'),'foreignKey':'TagId'});db[_0x9ea2('0x4e')][_0x9ea2('0x159')](db[_0x9ea2('0x44')],{});db[_0x9ea2('0x4e')][_0x9ea2('0x159')](db[_0x9ea2('0xfd')],{'as':_0x9ea2('0x170'),'foreignKey':'ListId'});db[_0x9ea2('0x4e')][_0x9ea2('0x159')](db[_0x9ea2('0x77')],{'as':'Contact','foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x4e')][_0x9ea2('0x159')](db[_0x9ea2('0x49')],{});db[_0x9ea2('0x4e')][_0x9ea2('0x159')](db[_0x9ea2('0x4a')],{});db[_0x9ea2('0x4e')][_0x9ea2('0x159')](db['User'],{});db[_0x9ea2('0x4e')][_0x9ea2('0x159')](db['MailQueue'],{});db[_0x9ea2('0x17e')]['hasMany'](db[_0x9ea2('0x51')],{'as':_0x9ea2('0x17f'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x53')]['hasMany'](db[_0x9ea2('0x16c')],{'as':_0x9ea2('0x180'),'foreignKey':_0x9ea2('0x181'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x53')][_0x9ea2('0x11e')](db[_0x9ea2('0x86')],{'as':'Answers','foreignKey':_0x9ea2('0x181')});db[_0x9ea2('0x53')][_0x9ea2('0x11e')](db[_0x9ea2('0x55')],{'as':_0x9ea2('0x16f')});db[_0x9ea2('0x53')]['hasMany'](db[_0x9ea2('0x54')],{'as':_0x9ea2('0x153')});db[_0x9ea2('0x53')]['hasMany'](db[_0x9ea2('0x19')],{'as':_0x9ea2('0x182'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x53')][_0x9ea2('0x11e')](db['FaxMessage'],{'as':_0x9ea2('0x16e')});db[_0x9ea2('0x53')]['belongsTo'](db[_0x9ea2('0x2f')],{'as':_0x9ea2('0x2f')});db[_0x9ea2('0x53')][_0x9ea2('0x159')](db['CmList'],{'as':_0x9ea2('0x170'),'foreignKey':'ListId'});db[_0x9ea2('0x53')]['belongsTo'](db[_0x9ea2('0x8c')],{'as':_0x9ea2('0x15d'),'foreignKey':_0x9ea2('0x15e')});db[_0x9ea2('0x53')][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':'Agents','through':_0x9ea2('0x143')});db[_0x9ea2('0x54')]['belongsTo'](db[_0x9ea2('0x13')],{'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x54')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x9ea2('0x16b')});db['FaxApplication'][_0x9ea2('0x159')](db[_0x9ea2('0x53')],{'onDelete':_0x9ea2('0x16b')});db['FaxApplication']['belongsTo'](db[_0x9ea2('0x94')],{'onDelete':_0x9ea2('0x16b'),'foreignKey':'TagId'});db[_0x9ea2('0x55')][_0x9ea2('0x11e')](db[_0x9ea2('0x57')],{'as':'Messages','onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x183')});db[_0x9ea2('0x55')][_0x9ea2('0x159')](db[_0x9ea2('0x53')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x181')});db[_0x9ea2('0x55')]['belongsTo'](db[_0x9ea2('0x77')],{'as':_0x9ea2('0x168'),'foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x55')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x174'),'foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x55')]['belongsToMany'](db[_0x9ea2('0x94')],{'through':_0x9ea2('0x184'),'as':_0x9ea2('0x175')});db['FaxInteraction']['belongsToMany'](db[_0x9ea2('0x94')],{'through':_0x9ea2('0x184'),'as':'ThroughTags'});db['FaxInteraction'][_0x9ea2('0x129')](db['User'],{'as':_0x9ea2('0x177'),'through':'user_has_fax_interactions','foreignKey':_0x9ea2('0x183')});db[_0x9ea2('0x57')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'onDelete':_0x9ea2('0x11a'),'as':_0x9ea2('0x13')});db[_0x9ea2('0x57')][_0x9ea2('0x159')](db[_0x9ea2('0x55')],{'as':_0x9ea2('0x179'),'foreignKey':_0x9ea2('0x183')});db['FaxMessage']['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x9ea2('0x168')});db[_0x9ea2('0x57')][_0x9ea2('0x159')](db[_0x9ea2('0xf5')],{'as':_0x9ea2('0xf5'),'foreignKey':_0x9ea2('0x185')});db['FaxMessage'][_0x9ea2('0x159')](db[_0x9ea2('0x53')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x181')});db['FaxQueue'][_0x9ea2('0x129')](db['User'],{'as':_0x9ea2('0x160'),'through':_0x9ea2('0x13c')});db['FaxQueue'][_0x9ea2('0x129')](db[_0x9ea2('0x130')],{'through':_0x9ea2('0x186'),'as':'Teams'});db['FaxQueueReport'][_0x9ea2('0x159')](db['FaxAccount'],{});db[_0x9ea2('0x5a')][_0x9ea2('0x159')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x9ea2('0x5a')][_0x9ea2('0x159')](db[_0x9ea2('0x77')],{'as':_0x9ea2('0x168'),'foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x5a')]['belongsTo'](db['FaxInteraction'],{});db[_0x9ea2('0x5a')]['belongsTo'](db['FaxMessage'],{});db[_0x9ea2('0x5a')][_0x9ea2('0x159')](db['User'],{});db[_0x9ea2('0x5a')][_0x9ea2('0x159')](db[_0x9ea2('0x58')],{});db[_0x9ea2('0x148')]['hasMany'](db['Disposition'],{'as':_0x9ea2('0x180'),'foreignKey':'SmsAccountId','onDelete':_0x9ea2('0x11a')});db['SmsAccount'][_0x9ea2('0x11e')](db[_0x9ea2('0x86')],{'as':_0x9ea2('0x16d'),'foreignKey':_0x9ea2('0x187')});db['SmsAccount'][_0x9ea2('0x11e')](db['SmsMessage'],{'as':_0x9ea2('0x16e'),'foreignKey':_0x9ea2('0x187')});db['SmsAccount']['hasMany'](db[_0x9ea2('0x5d')],{'as':'Interactions'});db[_0x9ea2('0x148')][_0x9ea2('0x11e')](db[_0x9ea2('0x5c')],{'as':_0x9ea2('0x153')});db[_0x9ea2('0x148')][_0x9ea2('0x159')](db['CmList'],{'as':_0x9ea2('0x170'),'foreignKey':'ListId'});db[_0x9ea2('0x148')][_0x9ea2('0x159')](db['Pause'],{'as':_0x9ea2('0x15d'),'foreignKey':_0x9ea2('0x15e')});db['SmsAccount'][_0x9ea2('0x129')](db['User'],{'as':_0x9ea2('0x160'),'through':_0x9ea2('0x14a')});db[_0x9ea2('0x5c')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'onDelete':'restrict'});db[_0x9ea2('0x5c')][_0x9ea2('0x159')](db['SmsQueue'],{'onDelete':_0x9ea2('0x16b')});db['SmsApplication'][_0x9ea2('0x159')](db[_0x9ea2('0x148')],{'onDelete':'restrict'});db['SmsApplication'][_0x9ea2('0x159')](db['Interval'],{'onDelete':_0x9ea2('0x16b'),'foreignKey':_0x9ea2('0x188')});db[_0x9ea2('0x5c')][_0x9ea2('0x159')](db[_0x9ea2('0x94')],{'onDelete':_0x9ea2('0x16b'),'foreignKey':_0x9ea2('0x189')});db[_0x9ea2('0x5d')]['hasMany'](db[_0x9ea2('0x5f')],{'as':_0x9ea2('0x16e'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x18a')});db[_0x9ea2('0x5d')][_0x9ea2('0x159')](db[_0x9ea2('0x148')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x187')});db[_0x9ea2('0x5d')]['belongsTo'](db[_0x9ea2('0x77')],{'as':'Contact','foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x5d')][_0x9ea2('0x159')](db['User'],{'as':_0x9ea2('0x174'),'foreignKey':'UserId'});db['SmsInteraction'][_0x9ea2('0x129')](db[_0x9ea2('0x94')],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0x9ea2('0x5d')]['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x9ea2('0x18b')});db[_0x9ea2('0x5d')][_0x9ea2('0x129')](db['User'],{'as':_0x9ea2('0x177'),'through':'user_has_sms_interactions','foreignKey':_0x9ea2('0x18a')});db[_0x9ea2('0x5f')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x13')});db[_0x9ea2('0x5f')][_0x9ea2('0x159')](db[_0x9ea2('0x77')],{'onDelete':_0x9ea2('0x11a'),'as':_0x9ea2('0x168')});db[_0x9ea2('0x5f')][_0x9ea2('0x159')](db[_0x9ea2('0x5d')],{'onDelete':_0x9ea2('0x11a'),'as':_0x9ea2('0x179'),'foreignKey':_0x9ea2('0x18a')});db[_0x9ea2('0x5f')][_0x9ea2('0x159')](db[_0x9ea2('0x148')],{'as':'Account','foreignKey':_0x9ea2('0x187')});db[_0x9ea2('0x61')][_0x9ea2('0x129')](db['User'],{'as':_0x9ea2('0x160'),'through':'UserSmsQueue','foreignKey':_0x9ea2('0x18c')});db[_0x9ea2('0x61')][_0x9ea2('0x129')](db[_0x9ea2('0x130')],{'through':_0x9ea2('0x18d'),'as':_0x9ea2('0x161')});db[_0x9ea2('0x63')]['hasMany'](db[_0x9ea2('0x16c')],{'as':'Dispositions','foreignKey':_0x9ea2('0x18e'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x63')][_0x9ea2('0x11e')](db[_0x9ea2('0x86')],{'as':_0x9ea2('0x16d'),'foreignKey':_0x9ea2('0x18e')});db['OpenchannelAccount'][_0x9ea2('0x11e')](db[_0x9ea2('0x67')],{'as':'Interactions','foreignKey':_0x9ea2('0x18e')});db[_0x9ea2('0x63')][_0x9ea2('0x11e')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x9ea2('0x18e')});db['OpenchannelAccount']['hasMany'](db['OpenchannelApplication'],{'as':_0x9ea2('0x153'),'foreignKey':_0x9ea2('0x18e')});db[_0x9ea2('0x63')][_0x9ea2('0x159')](db[_0x9ea2('0xfd')],{'as':_0x9ea2('0x170'),'foreignKey':_0x9ea2('0x171')});db[_0x9ea2('0x63')][_0x9ea2('0x159')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9ea2('0x15e')});db[_0x9ea2('0x63')][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x160'),'through':_0x9ea2('0x147')});db[_0x9ea2('0x65')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x65')][_0x9ea2('0x159')](db[_0x9ea2('0x6a')],{'onDelete':_0x9ea2('0x16b'),'foreignKey':_0x9ea2('0x18f')});db[_0x9ea2('0x65')]['belongsTo'](db[_0x9ea2('0x63')],{'onDelete':_0x9ea2('0x16b'),'foreignKey':_0x9ea2('0x18e')});db['OpenchannelApplication']['belongsTo'](db[_0x9ea2('0x15c')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x9ea2('0x65')][_0x9ea2('0x159')](db[_0x9ea2('0x94')],{'onDelete':_0x9ea2('0x16b'),'foreignKey':_0x9ea2('0x189')});db['OpenchannelInteraction']['hasMany'](db[_0x9ea2('0x190')],{'as':_0x9ea2('0x16e'),'onDelete':_0x9ea2('0x11a'),'foreignKey':'OpenchannelInteractionId'});db[_0x9ea2('0x67')][_0x9ea2('0x159')](db[_0x9ea2('0x63')],{'as':_0x9ea2('0x173'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x67')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x174'),'foreignKey':'UserId'});db[_0x9ea2('0x67')][_0x9ea2('0x129')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x9ea2('0x175')});db['OpenchannelInteraction'][_0x9ea2('0x129')](db[_0x9ea2('0x94')],{'through':_0x9ea2('0x191'),'as':_0x9ea2('0x18b')});db['OpenchannelInteraction'][_0x9ea2('0x129')](db['User'],{'as':_0x9ea2('0x177'),'through':'user_has_openchannel_interactions','foreignKey':_0x9ea2('0x192')});db[_0x9ea2('0x190')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'onDelete':'cascade','as':_0x9ea2('0x13')});db[_0x9ea2('0x190')][_0x9ea2('0x159')](db[_0x9ea2('0x77')],{'onDelete':_0x9ea2('0x11a'),'as':_0x9ea2('0x168')});db['OpenchannelMessage'][_0x9ea2('0x159')](db[_0x9ea2('0x67')],{'onDelete':_0x9ea2('0x11a'),'as':_0x9ea2('0x179'),'foreignKey':_0x9ea2('0x192')});db['OpenchannelMessage'][_0x9ea2('0x159')](db[_0x9ea2('0xf5')],{'as':'Attachment','foreignKey':_0x9ea2('0x185')});db[_0x9ea2('0x190')]['belongsTo'](db[_0x9ea2('0x63')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x18e')});db['OpenchannelQueue'][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':'Agents','through':_0x9ea2('0x3d'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db[_0x9ea2('0x130')],{'through':_0x9ea2('0x193'),'as':'Teams'});db[_0x9ea2('0x6b')][_0x9ea2('0x11e')](db[_0x9ea2('0x16c')],{'as':_0x9ea2('0x180'),'foreignKey':_0x9ea2('0x17a'),'onDelete':'cascade'});db[_0x9ea2('0x6b')]['hasMany'](db['CannedAnswer'],{'as':_0x9ea2('0x16d'),'foreignKey':'ChatWebsiteId'});db[_0x9ea2('0x6b')][_0x9ea2('0x11e')](db[_0x9ea2('0x194')],{'as':_0x9ea2('0x195')});db['ChatWebsite'][_0x9ea2('0x11e')](db[_0x9ea2('0x133')],{'as':_0x9ea2('0x16f')});db[_0x9ea2('0x6b')][_0x9ea2('0x11e')](db[_0x9ea2('0x6e')],{'as':_0x9ea2('0x153')});db[_0x9ea2('0x6b')][_0x9ea2('0x11e')](db[_0x9ea2('0x196')],{'as':_0x9ea2('0x16e')});db['ChatWebsite'][_0x9ea2('0x159')](db[_0x9ea2('0xfd')],{'as':_0x9ea2('0x170'),'foreignKey':_0x9ea2('0x171')});db[_0x9ea2('0x6b')][_0x9ea2('0x159')](db[_0x9ea2('0x15c')],{'as':_0x9ea2('0x15c'),'foreignKey':_0x9ea2('0x188')});db['ChatWebsite'][_0x9ea2('0x159')](db[_0x9ea2('0x44')],{'as':_0x9ea2('0x44'),'foreignKey':_0x9ea2('0x169')});db[_0x9ea2('0x6b')][_0x9ea2('0x159')](db[_0x9ea2('0x8c')],{'as':_0x9ea2('0x15d'),'foreignKey':_0x9ea2('0x15e')});db['ChatWebsite'][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x160'),'through':_0x9ea2('0x142')});db[_0x9ea2('0x6d')][_0x9ea2('0x159')](db[_0x9ea2('0x63')],{});db[_0x9ea2('0x6d')][_0x9ea2('0x159')](db[_0x9ea2('0xfd')],{'as':_0x9ea2('0x170'),'foreignKey':_0x9ea2('0x171')});db[_0x9ea2('0x6d')][_0x9ea2('0x159')](db[_0x9ea2('0x77')],{'as':_0x9ea2('0x168'),'foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x6d')][_0x9ea2('0x159')](db['OpenchannelInteraction'],{});db[_0x9ea2('0x6d')][_0x9ea2('0x159')](db['OpenchannelMessage'],{});db[_0x9ea2('0x6d')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{});db[_0x9ea2('0x6d')][_0x9ea2('0x159')](db[_0x9ea2('0x6a')],{});db[_0x9ea2('0x6e')]['belongsTo'](db['User'],{'as':'Agent','foreignKey':_0x9ea2('0x11b'),'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x6e')][_0x9ea2('0x159')](db[_0x9ea2('0x13a')],{'as':_0x9ea2('0x197'),'foreignKey':_0x9ea2('0x198'),'onDelete':'restrict'});db[_0x9ea2('0x6e')][_0x9ea2('0x159')](db[_0x9ea2('0x6b')],{'as':_0x9ea2('0x199'),'foreignKey':_0x9ea2('0x17a'),'onDelete':'restrict'});db[_0x9ea2('0x6e')][_0x9ea2('0x159')](db[_0x9ea2('0x94')],{'onDelete':_0x9ea2('0x16b'),'foreignKey':_0x9ea2('0x189')});db[_0x9ea2('0x133')][_0x9ea2('0x11e')](db[_0x9ea2('0x196')],{'as':'Messages','onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x19a')});db[_0x9ea2('0x133')]['belongsTo'](db[_0x9ea2('0x6b')],{'as':_0x9ea2('0x173'),'foreignKey':'ChatWebsiteId'});db[_0x9ea2('0x133')][_0x9ea2('0x159')](db['CmContact'],{'as':_0x9ea2('0x168'),'foreignKey':_0x9ea2('0x17d')});db['ChatInteraction'][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x174'),'foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x133')][_0x9ea2('0x129')](db['Tag'],{'through':_0x9ea2('0x19b'),'as':_0x9ea2('0x175')});db['ChatInteraction']['belongsToMany'](db[_0x9ea2('0x94')],{'through':'chat_interaction_has_tags','as':_0x9ea2('0x18b')});db[_0x9ea2('0x133')][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x177'),'through':_0x9ea2('0x135'),'foreignKey':'ChatInteractionId'});db[_0x9ea2('0x196')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'onDelete':_0x9ea2('0x11a'),'as':'User'});db['ChatMessage'][_0x9ea2('0x159')](db[_0x9ea2('0x77')],{'onDelete':_0x9ea2('0x11a'),'as':_0x9ea2('0x168'),'foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x196')][_0x9ea2('0x159')](db[_0x9ea2('0x133')],{'onDelete':_0x9ea2('0x11a'),'as':_0x9ea2('0x179'),'foreignKey':_0x9ea2('0x19a')});db[_0x9ea2('0x196')][_0x9ea2('0x159')](db[_0x9ea2('0xf5')],{'as':_0x9ea2('0xf5'),'foreignKey':_0x9ea2('0x185')});db[_0x9ea2('0x196')][_0x9ea2('0x159')](db[_0x9ea2('0x6b')],{'as':_0x9ea2('0x173'),'foreignKey':'ChatWebsiteId'});db[_0x9ea2('0x17b')][_0x9ea2('0x11e')](db[_0x9ea2('0xf5')],{'as':'Attachments','foreignKey':_0x9ea2('0x17c'),'onDelete':_0x9ea2('0x11a'),'hooks':!![]});db[_0x9ea2('0x17b')][_0x9ea2('0x159')](db['CmContact'],{'onDelete':_0x9ea2('0x11a'),'as':_0x9ea2('0x168'),'foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x17b')][_0x9ea2('0x159')](db[_0x9ea2('0x6b')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x17a')});db[_0x9ea2('0x13a')]['belongsToMany'](db[_0x9ea2('0x13')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x9ea2('0x13a')][_0x9ea2('0x129')](db[_0x9ea2('0x130')],{'through':'team_has_chat_queues','as':_0x9ea2('0x161')});db[_0x9ea2('0x73')]['hasMany'](db[_0x9ea2('0x19c')],{'as':_0x9ea2('0x16e'),'foreignKey':_0x9ea2('0x19d'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x73')][_0x9ea2('0x129')](db['User'],{'as':_0x9ea2('0x155'),'through':_0x9ea2('0x12b')});db['ChatProactiveAction'][_0x9ea2('0x159')](db['ChatWebsite'],{'as':'Website','foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x9ea2('0x11e')](db[_0x9ea2('0x77')],{'as':_0x9ea2('0x12c'),'foreignKey':_0x9ea2('0x19e')});db[_0x9ea2('0x77')][_0x9ea2('0x11e')](db[_0x9ea2('0x78')],{'as':_0x9ea2('0x19f'),'foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x77')][_0x9ea2('0x11e')](db['CmHopperFinal'],{'as':_0x9ea2('0x120'),'foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x77')][_0x9ea2('0x11e')](db[_0x9ea2('0x7d')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x9ea2('0x77')]['hasMany'](db[_0x9ea2('0x7f')],{'as':_0x9ea2('0x7f'),'foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x77')][_0x9ea2('0x11e')](db[_0x9ea2('0xdf')],{'as':_0x9ea2('0x1a0'),'foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0x77')][_0x9ea2('0x11e')](db['OpenchannelInteraction'],{'as':_0x9ea2('0x121'),'foreignKey':'ContactId','onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x77')]['hasMany'](db[_0x9ea2('0x133')],{'as':_0x9ea2('0x134'),'foreignKey':_0x9ea2('0x17d'),'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x77')][_0x9ea2('0x11e')](db[_0x9ea2('0x5d')],{'as':_0x9ea2('0x122'),'foreignKey':_0x9ea2('0x17d'),'onDelete':'restrict'});db['CmContact'][_0x9ea2('0x11e')](db['FaxInteraction'],{'as':_0x9ea2('0x123'),'foreignKey':_0x9ea2('0x17d'),'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x77')][_0x9ea2('0x11e')](db['MailInteraction'],{'as':_0x9ea2('0x124'),'foreignKey':_0x9ea2('0x17d'),'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x77')][_0x9ea2('0x159')](db[_0x9ea2('0x1a1')],{'as':_0x9ea2('0x1a2'),'foreignKey':_0x9ea2('0x19e')});db['CmContact'][_0x9ea2('0x159')](db['CmList'],{'as':_0x9ea2('0x170'),'foreignKey':_0x9ea2('0x171'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x77')][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x177'),'through':_0x9ea2('0x12d')});db[_0x9ea2('0x77')]['belongsToMany'](db[_0x9ea2('0x94')],{'as':_0x9ea2('0x175'),'through':'cm_contact_has_tags'});db[_0x9ea2('0x77')]['belongsToMany'](db['Tag'],{'through':'cm_contact_has_tags','as':_0x9ea2('0x18b')});db[_0x9ea2('0x78')]['belongsTo'](db[_0x9ea2('0x77')],{'as':_0x9ea2('0x168'),'foreignKey':'ContactId','onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x78')][_0x9ea2('0x159')](db[_0x9ea2('0xfd')],{'as':'List','foreignKey':_0x9ea2('0x171'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x78')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x1a3'),'foreignKey':_0x9ea2('0x11b')});db[_0x9ea2('0x78')][_0x9ea2('0x159')](db[_0x9ea2('0x1d')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x9ea2('0x78')][_0x9ea2('0x159')](db[_0x9ea2('0xf1')],{'as':_0x9ea2('0xf1'),'foreignKey':_0x9ea2('0x1a4'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x78')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x174'),'foreignKey':_0x9ea2('0x1a5')});db['CmHopperBlack'][_0x9ea2('0x159')](db['CmContact'],{'as':'Contact','foreignKey':_0x9ea2('0x17d'),'onDelete':'cascade'});db[_0x9ea2('0x158')][_0x9ea2('0x159')](db[_0x9ea2('0xfd')],{'as':_0x9ea2('0x170'),'foreignKey':_0x9ea2('0x171'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x158')][_0x9ea2('0x159')](db[_0x9ea2('0x1d')],{'as':_0x9ea2('0x197'),'foreignKey':_0x9ea2('0x156'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x158')][_0x9ea2('0x159')](db[_0x9ea2('0xf1')],{'as':_0x9ea2('0xf1'),'foreignKey':_0x9ea2('0x1a4'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x84')][_0x9ea2('0x11e')](db[_0x9ea2('0x89')],{'as':{'plural':_0x9ea2('0x1a6'),'singular':_0x9ea2('0x1a7')},'foreignKey':_0x9ea2('0x1a8'),'onDelete':_0x9ea2('0x11a'),'hooks':!![]});db['Automation'][_0x9ea2('0x11e')](db[_0x9ea2('0x89')],{'as':{'plural':_0x9ea2('0x1a9'),'singular':_0x9ea2('0x1aa')},'foreignKey':_0x9ea2('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0x9ea2('0x84')][_0x9ea2('0x11e')](db[_0x9ea2('0x83')],{'as':_0x9ea2('0x1ac'),'foreignKey':_0x9ea2('0x1ad'),'onDelete':'cascade','hooks':!![]});db[_0x9ea2('0x16c')][_0x9ea2('0x11e')](db[_0x9ea2('0x16c')],{'as':_0x9ea2('0x180'),'foreignKey':'ParentId','onDelete':_0x9ea2('0x11a')});db['Interval']['hasMany'](db[_0x9ea2('0x15c')],{'as':_0x9ea2('0x1ae'),'foreignKey':_0x9ea2('0x188'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x9ea2('0x15c')]['hasMany'](db[_0x9ea2('0x19')],{'as':_0x9ea2('0x1af'),'foreignKey':_0x9ea2('0x188'),'onDelete':_0x9ea2('0x16b')});db['Interval'][_0x9ea2('0x11e')](db[_0x9ea2('0x4c')],{'as':_0x9ea2('0x1b0'),'foreignKey':_0x9ea2('0x188')});db[_0x9ea2('0x15c')][_0x9ea2('0x11e')](db[_0x9ea2('0x6e')],{'as':'ChatApplications','foreignKey':_0x9ea2('0x188')});db['Interval'][_0x9ea2('0x11e')](db[_0x9ea2('0x54')],{'as':_0x9ea2('0x1b1'),'foreignKey':_0x9ea2('0x188')});db[_0x9ea2('0x15c')]['hasMany'](db[_0x9ea2('0x5c')],{'as':_0x9ea2('0x1b2'),'foreignKey':_0x9ea2('0x188')});db[_0x9ea2('0x1b3')][_0x9ea2('0x159')](db[_0x9ea2('0x44')],{});db[_0x9ea2('0x1b3')][_0x9ea2('0x159')](db[_0x9ea2('0x9c')],{'foreignKey':_0x9ea2('0x1b4')});db[_0x9ea2('0x1b3')][_0x9ea2('0x159')](db[_0x9ea2('0x1b5')],{'foreignKey':_0x9ea2('0x1b6')});db[_0x9ea2('0x92')][_0x9ea2('0x129')](db[_0x9ea2('0x1b')],{'as':_0x9ea2('0x1b7'),'through':_0x9ea2('0x1b8'),'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x94')][_0x9ea2('0x129')](db[_0x9ea2('0x77')],{'through':_0x9ea2('0x1b9')});db[_0x9ea2('0x94')][_0x9ea2('0x129')](db[_0x9ea2('0x133')],{'through':'chat_interaction_has_tags'});db[_0x9ea2('0x94')][_0x9ea2('0x129')](db[_0x9ea2('0x49')],{'through':_0x9ea2('0x176')});db[_0x9ea2('0x94')][_0x9ea2('0x129')](db[_0x9ea2('0x5d')],{'through':_0x9ea2('0x1ba')});db[_0x9ea2('0x94')]['belongsToMany'](db[_0x9ea2('0x55')],{'through':_0x9ea2('0x184')});db['Tag'][_0x9ea2('0x129')](db[_0x9ea2('0x67')],{'through':_0x9ea2('0x191')});db[_0x9ea2('0x94')][_0x9ea2('0x129')](db[_0x9ea2('0x109')],{'through':_0x9ea2('0x1bb')});db[_0x9ea2('0x1bc')][_0x9ea2('0x11e')](db['Condition'],{'as':{'plural':_0x9ea2('0x1bd'),'singular':_0x9ea2('0x1be')},'foreignKey':_0x9ea2('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x9ea2('0x1bc')][_0x9ea2('0x11e')](db[_0x9ea2('0x89')],{'as':{'plural':_0x9ea2('0x1c0'),'singular':'AnyCondition'},'foreignKey':_0x9ea2('0x1c1'),'onDelete':_0x9ea2('0x11a'),'hooks':!![]});db[_0x9ea2('0x1bc')][_0x9ea2('0x11e')](db[_0x9ea2('0x83')],{'as':_0x9ea2('0x1ac'),'foreignKey':_0x9ea2('0x1c2'),'onDelete':_0x9ea2('0x11a'),'hooks':!![]});db[_0x9ea2('0x1b5')][_0x9ea2('0x11e')](db[_0x9ea2('0xa1')],{'as':_0x9ea2('0x1c3'),'onDelete':'cascade','foreignKey':_0x9ea2('0x1b6'),'hooks':!![]});db[_0x9ea2('0x9c')][_0x9ea2('0x11e')](db['AnalyticFieldReport'],{'as':_0x9ea2('0x1c3'),'onDelete':_0x9ea2('0x11a'),'foreignKey':'DefaultReportId'});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':_0x9ea2('0x1c3'),'onDelete':'cascade','foreignKey':_0x9ea2('0x1c4')});db[_0x9ea2('0xa1')][_0x9ea2('0x159')](db[_0x9ea2('0x1c5')],{'foreignKey':'MetricId'});db[_0x9ea2('0xa5')][_0x9ea2('0x11e')](db[_0x9ea2('0xa7')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x9ea2('0xa7')]['hasMany'](db[_0x9ea2('0xa9')],{'as':'Subjects','onDelete':_0x9ea2('0x11a'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x9ea2('0x11e')](db[_0x9ea2('0xa9')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x9ea2('0x1c6')});db['SalesforceConfiguration']['hasMany'](db[_0x9ea2('0xa9')],{'as':'Fields','onDelete':_0x9ea2('0x11a'),'foreignKey':'FieldId'});db[_0x9ea2('0xa7')][_0x9ea2('0x159')](db[_0x9ea2('0xa5')],{'as':_0x9ea2('0x173'),'foreignKey':'AccountId'});db[_0x9ea2('0xa9')]['hasMany'](db[_0x9ea2('0xa9')],{'as':_0x9ea2('0x1c7'),'foreignKey':_0x9ea2('0x1c8')});db[_0x9ea2('0xa9')][_0x9ea2('0x11e')](db[_0x9ea2('0xa9')],{'as':_0x9ea2('0x1c9'),'foreignKey':_0x9ea2('0x1c6')});db[_0x9ea2('0xa9')][_0x9ea2('0x11e')](db['SalesforceField'],{'as':_0x9ea2('0x1ca'),'foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0xa9')][_0x9ea2('0x159')](db[_0x9ea2('0x1cc')],{'as':_0x9ea2('0x1cc'),'foreignKey':'VariableId'});db[_0x9ea2('0xab')][_0x9ea2('0x11e')](db[_0x9ea2('0xad')],{'as':_0x9ea2('0x1cd'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1ce')});db['SugarcrmConfiguration'][_0x9ea2('0x11e')](db['SugarcrmField'],{'as':_0x9ea2('0x1cf'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1c8')});db[_0x9ea2('0xad')][_0x9ea2('0x11e')](db['SugarcrmField'],{'as':_0x9ea2('0x1d0'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1c6')});db['SugarcrmConfiguration'][_0x9ea2('0x11e')](db[_0x9ea2('0xaf')],{'as':'Fields','onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0xad')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0xaf')][_0x9ea2('0x11e')](db[_0x9ea2('0xaf')],{'as':_0x9ea2('0x1c7'),'foreignKey':_0x9ea2('0x1c8')});db[_0x9ea2('0xaf')]['hasMany'](db[_0x9ea2('0xaf')],{'as':_0x9ea2('0x1c9'),'foreignKey':_0x9ea2('0x1c6')});db[_0x9ea2('0xaf')][_0x9ea2('0x11e')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0x9ea2('0xaf')][_0x9ea2('0x159')](db[_0x9ea2('0x1cc')],{'as':_0x9ea2('0x1cc'),'foreignKey':_0x9ea2('0x1d1')});db[_0x9ea2('0xb1')][_0x9ea2('0x11e')](db[_0x9ea2('0xb3')],{'as':'Configurations','onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1ce')});db['DeskConfiguration'][_0x9ea2('0x11e')](db[_0x9ea2('0xb5')],{'as':_0x9ea2('0x1cf'),'onDelete':'cascade','foreignKey':_0x9ea2('0x1c8')});db[_0x9ea2('0xb3')]['hasMany'](db['DeskField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x9ea2('0xb3')]['hasMany'](db[_0x9ea2('0xb5')],{'as':_0x9ea2('0x1c3'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0xb3')][_0x9ea2('0x159')](db[_0x9ea2('0xb1')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x1ce')});db['DeskConfiguration'][_0x9ea2('0x129')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x9ea2('0xb5')][_0x9ea2('0x11e')](db[_0x9ea2('0xb5')],{'as':_0x9ea2('0x1c7'),'foreignKey':_0x9ea2('0x1c8')});db['DeskField']['hasMany'](db[_0x9ea2('0xb5')],{'as':_0x9ea2('0x1c9'),'foreignKey':_0x9ea2('0x1c6')});db['DeskField'][_0x9ea2('0x11e')](db[_0x9ea2('0xb5')],{'as':_0x9ea2('0x1ca'),'foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0xb5')]['belongsTo'](db['Variable'],{'as':_0x9ea2('0x1cc'),'foreignKey':_0x9ea2('0x1d1')});db['ZohoAccount'][_0x9ea2('0x11e')](db[_0x9ea2('0x1d2')],{'as':_0x9ea2('0x1cd'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0x1d2')]['hasMany'](db['ZohoField'],{'as':_0x9ea2('0x1cf'),'onDelete':'cascade','foreignKey':_0x9ea2('0x1c8')});db['ZohoConfiguration'][_0x9ea2('0x11e')](db[_0x9ea2('0xb8')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x9ea2('0x1c6')});db[_0x9ea2('0x1d2')][_0x9ea2('0x11e')](db[_0x9ea2('0xb8')],{'as':_0x9ea2('0x1c3'),'onDelete':'cascade','foreignKey':'FieldId'});db['ZohoConfiguration'][_0x9ea2('0x159')](db[_0x9ea2('0x1d3')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0xb8')][_0x9ea2('0x11e')](db[_0x9ea2('0xb8')],{'as':'Subject','foreignKey':_0x9ea2('0x1c8')});db[_0x9ea2('0xb8')][_0x9ea2('0x11e')](db['ZohoField'],{'as':_0x9ea2('0x1c9'),'foreignKey':_0x9ea2('0x1c6')});db[_0x9ea2('0xb8')][_0x9ea2('0x11e')](db[_0x9ea2('0xb8')],{'as':_0x9ea2('0x1ca'),'foreignKey':_0x9ea2('0x1cb')});db['ZohoField'][_0x9ea2('0x159')](db[_0x9ea2('0x1cc')],{'as':_0x9ea2('0x1cc'),'foreignKey':_0x9ea2('0x1d1')});db[_0x9ea2('0xba')]['hasMany'](db[_0x9ea2('0xbc')],{'as':_0x9ea2('0x1cd'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0xbc')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d4')],{'as':_0x9ea2('0x1cf'),'foreignKey':_0x9ea2('0x1c8')});db[_0x9ea2('0xbc')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d4')],{'as':_0x9ea2('0x1d0'),'foreignKey':_0x9ea2('0x1c6')});db[_0x9ea2('0xbc')]['hasMany'](db[_0x9ea2('0x1d4')],{'as':_0x9ea2('0x1c3'),'foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0xbc')][_0x9ea2('0x159')](db[_0x9ea2('0xba')],{'as':'Account','foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0xbc')]['belongsToMany'](db[_0x9ea2('0x94')],{'through':_0x9ea2('0x1d5')});db[_0x9ea2('0x1d4')]['hasMany'](db[_0x9ea2('0x1d4')],{'as':_0x9ea2('0x1c7'),'foreignKey':_0x9ea2('0x1c8')});db[_0x9ea2('0x1d4')]['hasMany'](db[_0x9ea2('0x1d4')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x9ea2('0x1d4')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d4')],{'as':'Field','foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0x1d4')][_0x9ea2('0x159')](db[_0x9ea2('0x1cc')],{'as':_0x9ea2('0x1cc'),'foreignKey':'VariableId'});db[_0x9ea2('0xbe')]['hasMany'](db[_0x9ea2('0xc0')],{'as':_0x9ea2('0x1cd'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0xc0')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d6')],{'as':_0x9ea2('0x1cf'),'onDelete':'cascade','foreignKey':_0x9ea2('0x1c8')});db[_0x9ea2('0xc0')][_0x9ea2('0x11e')](db['FreshdeskField'],{'as':_0x9ea2('0x1d0'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1c6')});db[_0x9ea2('0xc0')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d6')],{'as':_0x9ea2('0x1c3'),'onDelete':'cascade','foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0xc0')][_0x9ea2('0x159')](db[_0x9ea2('0xbe')],{'as':'Account','foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0xc0')][_0x9ea2('0x129')](db[_0x9ea2('0x94')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x9ea2('0x1d6')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d6')],{'as':_0x9ea2('0x1c7'),'foreignKey':'SubjectId'});db[_0x9ea2('0x1d6')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d6')],{'as':_0x9ea2('0x1c9'),'foreignKey':'DescriptionId'});db[_0x9ea2('0x1d6')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d6')],{'as':_0x9ea2('0x1ca'),'foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0x1d6')][_0x9ea2('0x159')](db[_0x9ea2('0x1cc')],{'as':_0x9ea2('0x1cc'),'foreignKey':_0x9ea2('0x1d1')});db['VtigerAccount']['hasMany'](db[_0x9ea2('0xc3')],{'as':_0x9ea2('0x1cd'),'onDelete':_0x9ea2('0x11a'),'foreignKey':'AccountId'});db[_0x9ea2('0xc3')][_0x9ea2('0x11e')](db['VtigerField'],{'as':_0x9ea2('0x1cf'),'foreignKey':_0x9ea2('0x1c8')});db['VtigerConfiguration']['hasMany'](db[_0x9ea2('0x1d7')],{'as':_0x9ea2('0x1d0'),'foreignKey':_0x9ea2('0x1c6')});db[_0x9ea2('0xc3')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d7')],{'as':_0x9ea2('0x1c3'),'foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0xc3')][_0x9ea2('0x159')](db[_0x9ea2('0xc1')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0x1d7')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d7')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9ea2('0x1d7')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d7')],{'as':_0x9ea2('0x1c9'),'foreignKey':'DescriptionId'});db[_0x9ea2('0x1d7')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d7')],{'as':_0x9ea2('0x1ca'),'foreignKey':'FieldId'});db['VtigerField'][_0x9ea2('0x159')](db['Variable'],{'as':'Variable','foreignKey':_0x9ea2('0x1d1')});db[_0x9ea2('0xc6')][_0x9ea2('0x11e')](db[_0x9ea2('0xc7')],{'as':_0x9ea2('0x1cd'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0xc7')][_0x9ea2('0x11e')](db[_0x9ea2('0xc9')],{'as':_0x9ea2('0x1cf'),'foreignKey':'SubjectId'});db[_0x9ea2('0xc7')][_0x9ea2('0x11e')](db[_0x9ea2('0xc9')],{'as':_0x9ea2('0x1d0'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration']['hasMany'](db[_0x9ea2('0xc9')],{'as':'Fields','foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0xc7')][_0x9ea2('0x159')](db['ServicenowAccount'],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0xc9')][_0x9ea2('0x11e')](db[_0x9ea2('0xc9')],{'as':_0x9ea2('0x1c7'),'foreignKey':_0x9ea2('0x1c8')});db[_0x9ea2('0xc9')]['hasMany'](db['ServicenowField'],{'as':_0x9ea2('0x1c9'),'foreignKey':_0x9ea2('0x1c6')});db[_0x9ea2('0xc9')][_0x9ea2('0x11e')](db[_0x9ea2('0xc9')],{'as':'Field','foreignKey':'FieldId'});db[_0x9ea2('0xc9')]['belongsTo'](db[_0x9ea2('0x1cc')],{'as':_0x9ea2('0x1cc'),'foreignKey':_0x9ea2('0x1d1')});db[_0x9ea2('0xcb')]['hasMany'](db[_0x9ea2('0xcd')],{'as':_0x9ea2('0x1cd'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0xcb')][_0x9ea2('0x159')](db['CloudProvider'],{'as':_0x9ea2('0x110'),'foreignKey':_0x9ea2('0x16a')});db['Dynamics365Configuration'][_0x9ea2('0x11e')](db[_0x9ea2('0xcf')],{'as':_0x9ea2('0x1cf'),'onDelete':'cascade','foreignKey':_0x9ea2('0x1c8')});db[_0x9ea2('0xcd')]['hasMany'](db[_0x9ea2('0xcf')],{'as':_0x9ea2('0x1d0'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1c6')});db[_0x9ea2('0xcd')][_0x9ea2('0x11e')](db[_0x9ea2('0xcf')],{'as':_0x9ea2('0x1c3'),'onDelete':'cascade','foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0xcd')][_0x9ea2('0x159')](db[_0x9ea2('0xcb')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x1ce')});db[_0x9ea2('0xcf')][_0x9ea2('0x11e')](db[_0x9ea2('0xcf')],{'as':_0x9ea2('0x1c7'),'foreignKey':_0x9ea2('0x1c8')});db[_0x9ea2('0xcf')][_0x9ea2('0x11e')](db['Dynamics365Field'],{'as':_0x9ea2('0x1c9'),'foreignKey':_0x9ea2('0x1c6')});db[_0x9ea2('0xcf')][_0x9ea2('0x11e')](db[_0x9ea2('0xcf')],{'as':_0x9ea2('0x1ca'),'foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0xcf')][_0x9ea2('0x159')](db[_0x9ea2('0x1cc')],{'as':_0x9ea2('0x1cc'),'foreignKey':_0x9ea2('0x1d1')});db[_0x9ea2('0xd1')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x9ea2('0x1cd'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1ce')});db['FreshsalesConfiguration'][_0x9ea2('0x11e')](db['FreshsalesField'],{'as':_0x9ea2('0x1cf'),'foreignKey':'SubjectId'});db[_0x9ea2('0xd3')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d8')],{'as':_0x9ea2('0x1d0'),'foreignKey':'DescriptionId'});db[_0x9ea2('0xd3')]['hasMany'](db['FreshsalesField'],{'as':_0x9ea2('0x1c3'),'foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0xd3')]['belongsTo'](db[_0x9ea2('0xd1')],{'as':_0x9ea2('0x173'),'foreignKey':'AccountId'});db[_0x9ea2('0x1d8')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d8')],{'as':_0x9ea2('0x1c7'),'foreignKey':'SubjectId'});db[_0x9ea2('0x1d8')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d8')],{'as':_0x9ea2('0x1c9'),'foreignKey':_0x9ea2('0x1c6')});db[_0x9ea2('0x1d8')][_0x9ea2('0x11e')](db[_0x9ea2('0x1d8')],{'as':_0x9ea2('0x1ca'),'foreignKey':_0x9ea2('0x1cb')});db[_0x9ea2('0x1d8')]['belongsTo'](db[_0x9ea2('0x1cc')],{'as':'Variable','foreignKey':_0x9ea2('0x1d1')});db[_0x9ea2('0xd8')][_0x9ea2('0x159')](db[_0x9ea2('0x6b')],{});db[_0x9ea2('0xd8')][_0x9ea2('0x159')](db['CmList'],{'as':_0x9ea2('0x170'),'foreignKey':_0x9ea2('0x171')});db['ChatQueueReport'][_0x9ea2('0x159')](db['CmContact'],{'as':_0x9ea2('0x168'),'foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0xd8')]['belongsTo'](db[_0x9ea2('0x133')],{});db[_0x9ea2('0xd8')][_0x9ea2('0x159')](db['ChatMessage'],{});db[_0x9ea2('0xd8')]['belongsTo'](db[_0x9ea2('0x13')],{});db['ChatQueueReport'][_0x9ea2('0x159')](db[_0x9ea2('0x13a')],{});db[_0x9ea2('0x19c')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'onDelete':_0x9ea2('0x11a'),'foreignKey':'FromId'});db[_0x9ea2('0x19c')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1d9')});db[_0x9ea2('0xdf')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x9ea2('0x1da'),'onDelete':_0x9ea2('0x11a')});db['JscriptySessionReport'][_0x9ea2('0x11e')](db[_0x9ea2('0xdb')],{'foreignKey':_0x9ea2('0x1da'),'onDelete':_0x9ea2('0x11a')});db['SmsQueueReport'][_0x9ea2('0x159')](db[_0x9ea2('0x148')],{});db[_0x9ea2('0xe1')][_0x9ea2('0x159')](db[_0x9ea2('0xfd')],{'as':_0x9ea2('0x170'),'foreignKey':_0x9ea2('0x171')});db[_0x9ea2('0xe1')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x9ea2('0x17d')});db[_0x9ea2('0xe1')][_0x9ea2('0x159')](db[_0x9ea2('0x5d')],{});db[_0x9ea2('0xe1')]['belongsTo'](db[_0x9ea2('0x5f')],{});db['SmsQueueReport'][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{});db[_0x9ea2('0xe1')]['belongsTo'](db['SmsQueue'],{});db[_0x9ea2('0xe7')][_0x9ea2('0x11e')](db['JscriptySessionReport'],{'foreignKey':_0x9ea2('0x1db')});db[_0x9ea2('0xe7')][_0x9ea2('0x11e')](db['JscriptyQuestionReport'],{'foreignKey':_0x9ea2('0x1db')});db['JscriptyProject'][_0x9ea2('0x11e')](db[_0x9ea2('0xdb')],{'foreignKey':_0x9ea2('0x1db')});db[_0x9ea2('0x14d')]['belongsToMany'](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x177'),'through':_0x9ea2('0x14f')});db[_0x9ea2('0x130')][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':'Agents','through':_0x9ea2('0x131')});db['Team'][_0x9ea2('0x129')](db['VoiceQueue'],{'through':_0x9ea2('0x162'),'as':_0x9ea2('0x137')});db[_0x9ea2('0x130')][_0x9ea2('0x129')](db[_0x9ea2('0x46')],{'through':'team_has_mail_queues','as':_0x9ea2('0x139')});db[_0x9ea2('0x130')][_0x9ea2('0x129')](db[_0x9ea2('0x13a')],{'through':_0x9ea2('0x1dc'),'as':_0x9ea2('0x13b')});db[_0x9ea2('0x130')]['belongsToMany'](db[_0x9ea2('0x58')],{'through':'team_has_fax_queues','as':_0x9ea2('0x1dd')});db[_0x9ea2('0x130')][_0x9ea2('0x129')](db[_0x9ea2('0x61')],{'through':_0x9ea2('0x18d'),'as':_0x9ea2('0x13d')});db[_0x9ea2('0x130')][_0x9ea2('0x129')](db[_0x9ea2('0x6a')],{'through':'team_has_openchannel_queues','as':_0x9ea2('0x13e')});db[_0x9ea2('0x130')][_0x9ea2('0x129')](db[_0x9ea2('0x13f')],{'through':_0x9ea2('0x1de'),'as':'WhatsappQueues'});db['Team'][_0x9ea2('0x129')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0x9ea2('0xf1')][_0x9ea2('0x11e')](db[_0x9ea2('0x78')],{'as':_0x9ea2('0x19f'),'foreignKey':_0x9ea2('0x1a4')});db[_0x9ea2('0xf1')][_0x9ea2('0x11e')](db['CmHopperFinal'],{'as':_0x9ea2('0x120'),'foreignKey':_0x9ea2('0x1a4')});db[_0x9ea2('0xf1')][_0x9ea2('0x11e')](db[_0x9ea2('0x7d')],{'as':_0x9ea2('0x157'),'foreignKey':'CampaignId'});db[_0x9ea2('0xf1')][_0x9ea2('0x11e')](db[_0x9ea2('0x158')],{'as':'HopperBlacks','foreignKey':_0x9ea2('0x1a4')});db[_0x9ea2('0xf1')][_0x9ea2('0x159')](db[_0x9ea2('0x2f')],{'as':_0x9ea2('0x2f'),'foreignKey':_0x9ea2('0x15a')});db[_0x9ea2('0xf1')][_0x9ea2('0x159')](db[_0x9ea2('0x2f')],{'as':_0x9ea2('0x15b'),'foreignKey':_0x9ea2('0x1df')});db[_0x9ea2('0xf1')][_0x9ea2('0x159')](db['Interval'],{'as':_0x9ea2('0x15c'),'foreignKey':_0x9ea2('0x188')});db[_0x9ea2('0xf1')][_0x9ea2('0x159')](db['SquareProject'],{'as':_0x9ea2('0x14d'),'foreignKey':_0x9ea2('0x1e0')});db[_0x9ea2('0xf1')][_0x9ea2('0x129')](db['CmList'],{'as':_0x9ea2('0x12e'),'through':_0x9ea2('0x1e1')});db[_0x9ea2('0xf1')]['belongsToMany'](db[_0x9ea2('0xfd')],{'as':'BlackLists','through':_0x9ea2('0x1e2')});db[_0x9ea2('0xf5')][_0x9ea2('0x159')](db['ChatOfflineMessage'],{'as':_0x9ea2('0x17b'),'foreignKey':_0x9ea2('0x17c')});db[_0x9ea2('0xf7')][_0x9ea2('0x159')](db[_0x9ea2('0x4a')],{});db[_0x9ea2('0xf7')][_0x9ea2('0x159')](db[_0x9ea2('0x49')],{});db[_0x9ea2('0xf7')]['belongsTo'](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db['MailTransferReport'][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'foreignKey':_0x9ea2('0x1e3'),'as':_0x9ea2('0x1e4')});db[_0x9ea2('0xf7')]['belongsTo'](db[_0x9ea2('0x13')],{'foreignKey':_0x9ea2('0x1e5'),'as':_0x9ea2('0x1e6')});db[_0x9ea2('0xf7')][_0x9ea2('0x159')](db[_0x9ea2('0x46')],{'foreignKey':_0x9ea2('0x1e7'),'as':'ToQueue'});db[_0x9ea2('0xf7')]['belongsTo'](db[_0x9ea2('0x44')],{'foreignKey':'ToMailAccountId','as':_0x9ea2('0x1e8')});db['ChatTransferReport'][_0x9ea2('0x159')](db[_0x9ea2('0x196')],{});db[_0x9ea2('0xf8')]['belongsTo'](db[_0x9ea2('0x133')],{});db[_0x9ea2('0xf8')][_0x9ea2('0x159')](db['ChatWebsite'],{'foreignKey':_0x9ea2('0x1e9'),'as':_0x9ea2('0x1ea')});db[_0x9ea2('0xf8')]['belongsTo'](db[_0x9ea2('0x13')],{'foreignKey':_0x9ea2('0x1e3'),'as':'FromAgent'});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x9ea2('0x1e5'),'as':_0x9ea2('0x1e6')});db[_0x9ea2('0xf8')][_0x9ea2('0x159')](db[_0x9ea2('0x13a')],{'foreignKey':_0x9ea2('0x1eb'),'as':'ToQueue'});db['ChatTransferReport'][_0x9ea2('0x159')](db[_0x9ea2('0x6b')],{'foreignKey':_0x9ea2('0x1ec'),'as':'ToAccount'});db['FaxTransferReport'][_0x9ea2('0x159')](db[_0x9ea2('0x57')],{});db[_0x9ea2('0xfa')][_0x9ea2('0x159')](db[_0x9ea2('0x55')],{});db['FaxTransferReport'][_0x9ea2('0x159')](db['FaxAccount'],{'foreignKey':_0x9ea2('0x1ed'),'as':_0x9ea2('0x1ea')});db[_0x9ea2('0xfa')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x9ea2('0xfa')]['belongsTo'](db[_0x9ea2('0x13')],{'foreignKey':_0x9ea2('0x1e5'),'as':_0x9ea2('0x1e6')});db['FaxTransferReport'][_0x9ea2('0x159')](db[_0x9ea2('0x58')],{'foreignKey':'ToFaxQueueId','as':_0x9ea2('0x1ee')});db['FaxTransferReport'][_0x9ea2('0x159')](db[_0x9ea2('0x53')],{'foreignKey':_0x9ea2('0x1ef'),'as':_0x9ea2('0x1e8')});db[_0x9ea2('0xfb')][_0x9ea2('0x159')](db[_0x9ea2('0x190')],{});db[_0x9ea2('0xfb')]['belongsTo'](db[_0x9ea2('0x67')],{});db[_0x9ea2('0xfb')]['belongsTo'](db[_0x9ea2('0x63')],{'foreignKey':_0x9ea2('0x1f0'),'as':_0x9ea2('0x1ea')});db[_0x9ea2('0xfb')][_0x9ea2('0x159')](db['User'],{'foreignKey':_0x9ea2('0x1e3'),'as':_0x9ea2('0x1e4')});db[_0x9ea2('0xfb')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'foreignKey':_0x9ea2('0x1e5'),'as':_0x9ea2('0x1e6')});db['OpenchannelTransferReport'][_0x9ea2('0x159')](db[_0x9ea2('0x6a')],{'foreignKey':_0x9ea2('0x1f1'),'as':'ToQueue'});db[_0x9ea2('0xfb')][_0x9ea2('0x159')](db[_0x9ea2('0x63')],{'foreignKey':_0x9ea2('0x1f2'),'as':_0x9ea2('0x1e8')});db[_0x9ea2('0x1f3')][_0x9ea2('0x159')](db['SmsMessage'],{});db[_0x9ea2('0x1f3')][_0x9ea2('0x159')](db[_0x9ea2('0x5d')],{});db['SmsTransferReport'][_0x9ea2('0x159')](db[_0x9ea2('0x148')],{'foreignKey':_0x9ea2('0x1f4'),'as':_0x9ea2('0x1ea')});db[_0x9ea2('0x1f3')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db['SmsTransferReport']['belongsTo'](db[_0x9ea2('0x13')],{'foreignKey':_0x9ea2('0x1e5'),'as':_0x9ea2('0x1e6')});db['SmsTransferReport'][_0x9ea2('0x159')](db[_0x9ea2('0x61')],{'foreignKey':_0x9ea2('0x1f5'),'as':_0x9ea2('0x1ee')});db[_0x9ea2('0x1f3')][_0x9ea2('0x159')](db[_0x9ea2('0x148')],{'foreignKey':_0x9ea2('0x1f6'),'as':_0x9ea2('0x1e8')});db[_0x9ea2('0xfd')][_0x9ea2('0x11e')](db['Disposition'],{'as':_0x9ea2('0x180'),'foreignKey':'ListId','onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0xfd')][_0x9ea2('0x11e')](db[_0x9ea2('0x81')],{'as':_0x9ea2('0x1f7'),'foreignKey':'ListId'});db[_0x9ea2('0xfd')][_0x9ea2('0x11e')](db['CmContact'],{'as':_0x9ea2('0x12c'),'onDelete':'cascade','foreignKey':_0x9ea2('0x171')});db[_0x9ea2('0xfd')][_0x9ea2('0x11e')](db[_0x9ea2('0x7b')],{'as':_0x9ea2('0x120'),'foreignKey':_0x9ea2('0x171')});db[_0x9ea2('0xfd')][_0x9ea2('0x11e')](db['CmHopperHistory'],{'as':_0x9ea2('0x1f8'),'foreignKey':_0x9ea2('0x171')});db[_0x9ea2('0xfd')][_0x9ea2('0x11e')](db['ReportAgentPreview'],{'as':_0x9ea2('0x7f'),'foreignKey':_0x9ea2('0x171')});db['CmList'][_0x9ea2('0x129')](db[_0x9ea2('0x1d')],{'as':_0x9ea2('0x1f9'),'through':_0x9ea2('0x15f')});db['CmList'][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x160'),'through':'cm_user_has_lists'});db[_0x9ea2('0xff')][_0x9ea2('0x11e')](db[_0x9ea2('0x19')],{'as':_0x9ea2('0x1af'),'onDelete':'cascade'});db[_0x9ea2('0xff')][_0x9ea2('0x129')](db['User'],{'as':'Agents','through':_0x9ea2('0x115')});db[_0x9ea2('0xff')][_0x9ea2('0x129')](db[_0x9ea2('0x130')],{'through':_0x9ea2('0x113'),'as':_0x9ea2('0x161')});db[_0x9ea2('0x101')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0x9ea2('0x128')});db['UserProfile'][_0x9ea2('0x11e')](db[_0x9ea2('0x103')],{'as':_0x9ea2('0x1fa'),'foreignKey':'userProfileId','onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x103')][_0x9ea2('0x11e')](db[_0x9ea2('0x104')],{'as':_0x9ea2('0x1fb'),'foreignKey':_0x9ea2('0x1fc'),'onDelete':_0x9ea2('0x11a')});db[_0x9ea2('0x107')][_0x9ea2('0x11e')](db[_0x9ea2('0x16c')],{'as':_0x9ea2('0x180'),'foreignKey':_0x9ea2('0x1fd'),'onDelete':_0x9ea2('0x11a')});db['WhatsappAccount']['hasMany'](db[_0x9ea2('0x86')],{'as':_0x9ea2('0x16d'),'foreignKey':_0x9ea2('0x1fd')});db[_0x9ea2('0x107')]['hasMany'](db[_0x9ea2('0x10b')],{'as':_0x9ea2('0x16e'),'foreignKey':_0x9ea2('0x1fd')});db[_0x9ea2('0x107')][_0x9ea2('0x11e')](db[_0x9ea2('0x109')],{'as':'Interactions'});db['WhatsappAccount'][_0x9ea2('0x11e')](db[_0x9ea2('0x108')],{'as':_0x9ea2('0x153')});db[_0x9ea2('0x107')][_0x9ea2('0x159')](db[_0x9ea2('0xfd')],{'as':_0x9ea2('0x170'),'foreignKey':_0x9ea2('0x171')});db[_0x9ea2('0x107')][_0x9ea2('0x159')](db[_0x9ea2('0x8c')],{'as':_0x9ea2('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x9ea2('0x108')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x108')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x108')]['belongsTo'](db[_0x9ea2('0x107')],{'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x108')][_0x9ea2('0x159')](db[_0x9ea2('0x15c')],{'onDelete':_0x9ea2('0x16b'),'foreignKey':_0x9ea2('0x188')});db['WhatsappApplication'][_0x9ea2('0x159')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x9ea2('0x189')});db[_0x9ea2('0x109')][_0x9ea2('0x11e')](db[_0x9ea2('0x10b')],{'as':_0x9ea2('0x16e'),'onDelete':_0x9ea2('0x11a'),'foreignKey':_0x9ea2('0x1fe')});db['WhatsappInteraction'][_0x9ea2('0x159')](db[_0x9ea2('0x107')],{'as':'Account','foreignKey':_0x9ea2('0x1fd')});db['WhatsappInteraction'][_0x9ea2('0x159')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappInteraction']['belongsTo'](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x174'),'foreignKey':_0x9ea2('0x11b')});db['WhatsappInteraction'][_0x9ea2('0x129')](db[_0x9ea2('0x94')],{'through':'whatsapp_interaction_has_tags','as':_0x9ea2('0x175')});db[_0x9ea2('0x109')]['belongsToMany'](db[_0x9ea2('0x94')],{'through':'whatsapp_interaction_has_tags','as':_0x9ea2('0x18b')});db[_0x9ea2('0x109')][_0x9ea2('0x129')](db['User'],{'as':_0x9ea2('0x177'),'through':_0x9ea2('0x1ff'),'foreignKey':'WhatsappInteractionId'});db[_0x9ea2('0x10b')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x13')});db[_0x9ea2('0x10b')][_0x9ea2('0x159')](db[_0x9ea2('0x77')],{'onDelete':'cascade','as':'Contact'});db[_0x9ea2('0x10b')][_0x9ea2('0x159')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x9ea2('0x179'),'foreignKey':_0x9ea2('0x1fe')});db[_0x9ea2('0x10b')][_0x9ea2('0x159')](db[_0x9ea2('0x107')],{'as':_0x9ea2('0x173'),'foreignKey':_0x9ea2('0x1fd')});db[_0x9ea2('0x10c')][_0x9ea2('0x159')](db[_0x9ea2('0x107')],{});db[_0x9ea2('0x10c')]['belongsTo'](db[_0x9ea2('0xfd')],{'as':_0x9ea2('0x170'),'foreignKey':_0x9ea2('0x171')});db['WhatsappQueueReport']['belongsTo'](db['CmContact'],{'as':_0x9ea2('0x168'),'foreignKey':'ContactId'});db['WhatsappQueueReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x9ea2('0x10c')]['belongsTo'](db['WhatsappQueue'],{});db[_0x9ea2('0x10c')][_0x9ea2('0x159')](db[_0x9ea2('0x10b')],{});db[_0x9ea2('0x10c')]['belongsTo'](db[_0x9ea2('0x13')],{});db[_0x9ea2('0x200')][_0x9ea2('0x159')](db[_0x9ea2('0x10b')],{});db[_0x9ea2('0x200')]['belongsTo'](db[_0x9ea2('0x109')],{});db['WhatsappTransferReport'][_0x9ea2('0x159')](db[_0x9ea2('0x107')],{'foreignKey':_0x9ea2('0x201'),'as':_0x9ea2('0x1ea')});db[_0x9ea2('0x200')]['belongsTo'](db[_0x9ea2('0x107')],{'foreignKey':_0x9ea2('0x202'),'as':'ToAccount'});db[_0x9ea2('0x200')][_0x9ea2('0x159')](db[_0x9ea2('0x13f')],{'foreignKey':_0x9ea2('0x203'),'as':_0x9ea2('0x1ee')});db[_0x9ea2('0x200')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'foreignKey':_0x9ea2('0x1e3'),'as':'FromAgent'});db[_0x9ea2('0x200')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'foreignKey':_0x9ea2('0x1e5'),'as':_0x9ea2('0x1e6')});db[_0x9ea2('0x13f')][_0x9ea2('0x129')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x160'),'through':'UserWhatsappQueue','foreignKey':_0x9ea2('0x204')});db[_0x9ea2('0x13f')][_0x9ea2('0x129')](db['Team'],{'through':_0x9ea2('0x1de'),'as':'Teams'});db[_0x9ea2('0x117')][_0x9ea2('0x159')](db[_0x9ea2('0x13')],{'as':_0x9ea2('0x205'),'foreignKey':_0x9ea2('0x11b'),'onDelete':_0x9ea2('0x11a'),'hooks':!![]});db[_0x9ea2('0x110')][_0x9ea2('0x119')](db[_0x9ea2('0xcb')],{'as':'Dynamics365Account','onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x110')][_0x9ea2('0x119')](db['MailServerIn'],{'as':_0x9ea2('0x206'),'onDelete':_0x9ea2('0x16b')});db[_0x9ea2('0x110')][_0x9ea2('0x119')](db['MailServerOut'],{'as':_0x9ea2('0x207'),'onDelete':_0x9ea2('0x16b')});module[_0x9ea2('0x208')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa561=['../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','UserId','userSetting','hasMany','Recordings','Extensions','cascade','CmHopperHistory','HopperHistory','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','UserOpenchannelQueue','user_has_chat_websites','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','UserVoiceQueueRt','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','TrunkId','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailServerIn','restrict','CloudProviderId','Imap','Smtp','Disposition','Dispositions','MailAccountId','Answers','Interactions','List','ListId','TemplateId','team_has_mail_queues','Teams','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','TagId','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','UserChatQueue','team_has_chat_queues','ChatGroupId','Members','CompanyId','JscriptySessions','OpenchannelInteractions','Company','cm_contact_has_tags','CampaignId','OwnerId','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','DescriptionId','FieldId','SalesforceField','SubjectId','Description','VariableId','Descriptions','Subject','Field','int_desk_configuration_has_tags','ZendeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowField','Dynamics365Configuration','ToId','SessionId','SmsQueueReport','ProjectId','team_has_sms_queues','OpenchannelQueues','team_has_whatsapp_queues','WhatsappQueues','VoicePrefixes','TrunkBackup','BlackLists','campaigns_has_cm_blacklists','ChatOfflineMessageId','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','FromFaxAccountId','ToFaxQueueId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','TeamVoicePrefix','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','xcall','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','utf8mb4','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount'];(function(_0x3e7b8d,_0x59060d){var _0x145c46=function(_0x3bac73){while(--_0x3bac73){_0x3e7b8d['push'](_0x3e7b8d['shift']());}};_0x145c46(++_0x59060d);}(_0xa561,0x1ae));var _0x1a56=function(_0x2f84af,_0x2d16a7){_0x2f84af=_0x2f84af-0x0;var _0x3a355c=_0xa561[_0x2f84af];return _0x3a355c;};'use strict';var config=require(_0x1a56('0x0'));var Sequelize=require(_0x1a56('0x1'));var _=require(_0x1a56('0x2'));var jstz=require(_0x1a56('0x3'));var timezone=jstz['determine']();config[_0x1a56('0x1')]=_[_0x1a56('0x4')](config['sequelize'],{'database':'motion2','username':_0x1a56('0x5'),'password':'xC@LL1234','options':{'host':_0x1a56('0x6'),'port':0xcea,'dialect':_0x1a56('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x1a56('0x8')](),'define':{'charset':_0x1a56('0x9'),'collate':_0x1a56('0xa')}}});config[_0x1a56('0xb')]=_[_0x1a56('0x4')](config[_0x1a56('0xb')],{'database':'motion2','username':_0x1a56('0x5'),'password':_0x1a56('0xc'),'options':{'host':_0x1a56('0x6'),'port':0xcea,'dialect':_0x1a56('0x7'),'dialectOptions':{'charset':_0x1a56('0xd')},'logging':![],'timezone':timezone[_0x1a56('0x8')](),'define':{'charset':_0x1a56('0x9'),'collate':_0x1a56('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1a56('0x1')][_0x1a56('0xe')],config[_0x1a56('0x1')][_0x1a56('0xf')],config[_0x1a56('0x1')][_0x1a56('0x10')],config[_0x1a56('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1a56('0xb')][_0x1a56('0xe')],config[_0x1a56('0xb')]['username'],config['sequelizeHistory'][_0x1a56('0x10')],config['sequelizeHistory'][_0x1a56('0x11')])};db[_0x1a56('0x12')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x14'));db['VoiceChanSpy']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x15'));db[_0x1a56('0x16')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x17'));db[_0x1a56('0x18')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x19'));db['VoiceMusicOnHold']=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x1a'));db[_0x1a56('0x1b')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x1c'));db[_0x1a56('0x1d')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x1e'));db[_0x1a56('0x1f')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x20'));db[_0x1a56('0x21')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x22'));db[_0x1a56('0x23')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x24'));db[_0x1a56('0x25')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x1a56('0x1')]['import'](_0x1a56('0x26'));db[_0x1a56('0x27')]=db['sequelize']['import'](_0x1a56('0x28'));db[_0x1a56('0x29')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x1a56('0x2a')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/memberReport/memberReport.model');db[_0x1a56('0x2b')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x2c'));db['VoiceTransferReport']=db[_0x1a56('0x1')]['import'](_0x1a56('0x2d'));db['UserVoiceQueueRt']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x2e'));db[_0x1a56('0x2f')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x30'));db['UserChatQueue']=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0x1a56('0x31')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x32'));db['UserFaxQueue']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x33'));db[_0x1a56('0x34')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x35'));db['UserOpenchannelQueue']=db['sequelize'][_0x1a56('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x1a56('0x36')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x37'));db['MailServerIn']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x38'));db[_0x1a56('0x39')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x3a'));db[_0x1a56('0x3b')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x3c'));db[_0x1a56('0x3d')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/mailQueue/mailQueue.model');db[_0x1a56('0x3e')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x1a56('0x3f')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x40'));db[_0x1a56('0x41')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x42'));db[_0x1a56('0x43')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x44'));db[_0x1a56('0x45')]=db[_0x1a56('0x1')]['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x1a56('0x46')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x47'));db[_0x1a56('0x48')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x49'));db[_0x1a56('0x4a')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x4b'));db[_0x1a56('0x4c')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x4d'));db[_0x1a56('0x4e')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x4f'));db[_0x1a56('0x50')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x51'));db[_0x1a56('0x52')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x53'));db[_0x1a56('0x54')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x55'));db['SmsAccount']=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x56'));db[_0x1a56('0x57')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x58'));db[_0x1a56('0x59')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x5a'));db[_0x1a56('0x5b')]=db['sequelize']['import'](_0x1a56('0x5c'));db[_0x1a56('0x5d')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x5e'));db[_0x1a56('0x5f')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x60'));db[_0x1a56('0x61')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x62'));db[_0x1a56('0x63')]=db['sequelize']['import'](_0x1a56('0x64'));db[_0x1a56('0x65')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x1a56('0x66')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x67'));db[_0x1a56('0x68')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x69'));db[_0x1a56('0x6a')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x6b'));db[_0x1a56('0x6c')]=db['sequelize'][_0x1a56('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x1a56('0x6d')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x6e'));db[_0x1a56('0x6f')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x1a56('0x70')]=db[_0x1a56('0x1')]['import']('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x71'));db[_0x1a56('0x72')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x1a56('0x73')]=db[_0x1a56('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0x1a56('0x74')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x75'));db[_0x1a56('0x76')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x77'));db[_0x1a56('0x78')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x79'));db[_0x1a56('0x7a')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x7b'));db['CmHopperHistory']=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x7c'));db[_0x1a56('0x7d')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x7e'));db[_0x1a56('0x7f')]=db['sequelize'][_0x1a56('0x13')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0x1a56('0x1')]['import']('../api/action/action.model');db[_0x1a56('0x80')]=db[_0x1a56('0x1')]['import']('../api/automation/automation.model');db[_0x1a56('0x81')]=db['sequelize']['import'](_0x1a56('0x82'));db['Disposition']=db['sequelize']['import'](_0x1a56('0x83'));db[_0x1a56('0x84')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x85'));db['Interval']=db[_0x1a56('0x1')]['import'](_0x1a56('0x86'));db[_0x1a56('0x87')]=db[_0x1a56('0x1')]['import']('../api/pause/pause.model');db[_0x1a56('0x88')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x89'));db[_0x1a56('0x8a')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x8b'));db[_0x1a56('0x8c')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x8d'));db[_0x1a56('0x8e')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x8f'));db[_0x1a56('0x90')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/tag/tag.model');db[_0x1a56('0x91')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x92'));db[_0x1a56('0x93')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x94'));db[_0x1a56('0x95')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x96'));db['Integration']=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/integration/integration.model');db[_0x1a56('0x97')]=db['sequelize'][_0x1a56('0x13')]('../api/integrationReport/integrationReport.model');db[_0x1a56('0x98')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x99'));db[_0x1a56('0x9a')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x9b'));db[_0x1a56('0x9c')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x9d'));db[_0x1a56('0x9e')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x9f'));db[_0x1a56('0xa0')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xa1'));db[_0x1a56('0xa2')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xa3'));db[_0x1a56('0xa4')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xa5'));db['SalesforceField']=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0x1a56('0xa6')]=db['sequelize']['import'](_0x1a56('0xa7'));db[_0x1a56('0xa8')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xa9'));db[_0x1a56('0xaa')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xab'));db[_0x1a56('0xac')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x1a56('0xad')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xae'));db[_0x1a56('0xaf')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xb0'));db[_0x1a56('0xb1')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x1a56('0xb2')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xb3'));db[_0x1a56('0xb4')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xb5'));db[_0x1a56('0xb6')]=db['sequelize']['import'](_0x1a56('0xb7'));db['ZendeskConfiguration']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xb8'));db[_0x1a56('0xb9')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xba'));db[_0x1a56('0xbb')]=db[_0x1a56('0x1')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x1a56('0xbc')]=db['sequelize'][_0x1a56('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x1a56('0xbd')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xbe'));db[_0x1a56('0xbf')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xc0'));db['VtigerConfiguration']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xc1'));db[_0x1a56('0xc2')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0x1a56('0xc3')]=db['sequelize']['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x1a56('0xc4')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xc5'));db['ServicenowField']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xc6'));db[_0x1a56('0xc7')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xc8'));db['Dynamics365Configuration']=db['sequelize'][_0x1a56('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x1a56('0xc9')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xca'));db[_0x1a56('0xcb')]=db['sequelize']['import'](_0x1a56('0xcc'));db[_0x1a56('0xcd')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xce'));db[_0x1a56('0xcf')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xd0'));db[_0x1a56('0xd1')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xd2'));db[_0x1a56('0xd3')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xd4'));db[_0x1a56('0xd5')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xd6'));db[_0x1a56('0xd7')]=db['sequelize']['import'](_0x1a56('0xd8'));db[_0x1a56('0xd9')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xda'));db[_0x1a56('0xdb')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xdc'));db[_0x1a56('0xdd')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xde'));db['SmsQueueReport']=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xdf'));db[_0x1a56('0xe0')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xe1'));db[_0x1a56('0xe2')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xe3'));db[_0x1a56('0xe4')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/jscriptyProject/jscriptyProject.model');db[_0x1a56('0xe5')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/setting/setting.model');db[_0x1a56('0xe6')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xe7'));db[_0x1a56('0xe8')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/squareProject/squareProject.model');db[_0x1a56('0xe9')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xea'));db[_0x1a56('0xeb')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xec'));db[_0x1a56('0xed')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xee'));db['License']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xef'));db[_0x1a56('0xf0')]=db[_0x1a56('0x1')]['import']('../api/campaign/campaign.model');db[_0x1a56('0xf1')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xf2'));db[_0x1a56('0xf3')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xf4'));db[_0x1a56('0xf5')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xf6'));db[_0x1a56('0xf7')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xf8'));db[_0x1a56('0xf9')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xfa'));db[_0x1a56('0xfb')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xfc'));db[_0x1a56('0xfd')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xfe'));db[_0x1a56('0xff')]=db['sequelize'][_0x1a56('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x1a56('0x100')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/cmList/cmList.model');db[_0x1a56('0x101')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x102'));db[_0x1a56('0x103')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/userProfile/userProfile.model');db[_0x1a56('0x104')]=db[_0x1a56('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x1a56('0x105')]=db['sequelize'][_0x1a56('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0x1a56('0x106')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x107'));db[_0x1a56('0x108')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x109'));db[_0x1a56('0x10a')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x10b'));db[_0x1a56('0x10c')]=db['sequelize'][_0x1a56('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x10d'));db[_0x1a56('0x10e')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x10f'));db[_0x1a56('0x110')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x111'));db[_0x1a56('0x112')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0x1a56('0x113')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x114'));db['TeamVoiceQueue']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x115'));db['TeamVoicePrefix']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x116'));db[_0x1a56('0x117')]=db['sequelize']['import'](_0x1a56('0x118'));db[_0x1a56('0x119')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x11a'));db[_0x1a56('0x12')][_0x1a56('0x11b')](db[_0x1a56('0x21')],{'as':_0x1a56('0x21'),'onDelete':'cascade','foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x12')][_0x1a56('0x11b')](db[_0x1a56('0x119')],{'as':_0x1a56('0x11d'),'onDelete':'cascade','foreignKey':'UserId'});db['User'][_0x1a56('0x11e')](db[_0x1a56('0x1d')],{'as':_0x1a56('0x11f'),'foreignKey':_0x1a56('0x11c')});db['User']['hasMany'](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x1a56('0x12')][_0x1a56('0x11e')](db['VoiceExtension'],{'as':_0x1a56('0x120'),'onDelete':_0x1a56('0x121'),'hooks':!![]});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x7a')],{'as':'HopperFinals','foreignKey':'UserId'});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x122')],{'as':_0x1a56('0x123'),'foreignKey':'UserId'});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x61')],{'as':'OpenchannelInteractions','foreignKey':_0x1a56('0x11c')});db['User'][_0x1a56('0x11e')](db[_0x1a56('0x6c')],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x57')],{'as':'SmsInteractions','foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x4e')],{'as':_0x1a56('0x124'),'foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x3f')],{'as':'MailInteractions','foreignKey':_0x1a56('0x11c')});db['User'][_0x1a56('0x11e')](db['WhatsappInteraction'],{'as':_0x1a56('0x125'),'foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x106')],{'as':_0x1a56('0x126'),'foreignKey':_0x1a56('0x127')});db['User'][_0x1a56('0x128')](db[_0x1a56('0x103')],{'as':_0x1a56('0x103'),'foreignKey':_0x1a56('0x129')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db['ChatGroup'],{'as':'Groups','through':_0x1a56('0x12b')});db['User'][_0x1a56('0x12a')](db['CmContact'],{'as':_0x1a56('0x12c'),'through':_0x1a56('0x12d')});db['User'][_0x1a56('0x12a')](db['CmList'],{'as':_0x1a56('0x12e'),'through':_0x1a56('0x12f')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'through':_0x1a56('0x130')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x3f')],{'as':_0x1a56('0x131'),'through':_0x1a56('0x132')});db['User'][_0x1a56('0x12a')](db[_0x1a56('0x6c')],{'as':_0x1a56('0x133'),'through':_0x1a56('0x134')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db['FaxInteraction'],{'as':_0x1a56('0x124'),'through':_0x1a56('0x135')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x57')],{'as':_0x1a56('0x136'),'through':_0x1a56('0x137')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x61')],{'as':'OpenchannelInteractions','through':_0x1a56('0x138')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x10c')],{'as':_0x1a56('0x125'),'through':_0x1a56('0x139')});db[_0x1a56('0x12')]['belongsToMany'](db[_0x1a56('0x1b')],{'as':_0x1a56('0x13a'),'through':_0x1a56('0x2f'),'required':![]});db['User']['belongsToMany'](db[_0x1a56('0x101')],{'as':'VoicePrefixes','through':_0x1a56('0x117'),'required':![]});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x3d')],{'as':_0x1a56('0x13b'),'through':'UserMailQueue','required':![]});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x70')],{'as':_0x1a56('0x13c'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x1a56('0x12a')](db[_0x1a56('0x52')],{'as':_0x1a56('0x13d'),'through':_0x1a56('0x13e'),'required':![]});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x5b')],{'as':_0x1a56('0x13f'),'through':'UserSmsQueue','required':![]});db['User']['belongsToMany'](db[_0x1a56('0x65')],{'as':'OpenchannelQueues','through':_0x1a56('0x140'),'required':![]});db['User'][_0x1a56('0x12a')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0x1a56('0x36'),'required':![]});db[_0x1a56('0x12')]['belongsToMany'](db[_0x1a56('0x100')],{'through':'cm_user_has_lists'});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x66')],{'as':'ChatWebsites','through':_0x1a56('0x141')});db['User'][_0x1a56('0x12a')](db['FaxAccount'],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db['User'][_0x1a56('0x12a')](db[_0x1a56('0x3b')],{'as':_0x1a56('0x142'),'through':_0x1a56('0x143')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db['OpenchannelAccount'],{'as':_0x1a56('0x144'),'through':_0x1a56('0x145')});db[_0x1a56('0x12')]['belongsToMany'](db[_0x1a56('0x146')],{'as':_0x1a56('0x147'),'through':_0x1a56('0x148')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x108')],{'as':_0x1a56('0x149'),'through':_0x1a56('0x14a')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db['SquareProject'],{'as':_0x1a56('0x14b'),'through':_0x1a56('0x14c')});db[_0x1a56('0x14d')][_0x1a56('0x11e')](db[_0x1a56('0x18')],{'as':_0x1a56('0x14e'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x14f')});db['VoiceContext']['hasMany'](db[_0x1a56('0x18')],{'onDelete':_0x1a56('0x121')});db['VoiceExtension'][_0x1a56('0x11e')](db['VoiceExtension'],{'as':_0x1a56('0x150'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x151')]['belongsToMany'](db['Sound'],{'as':_0x1a56('0x152'),'through':_0x1a56('0x153')});db[_0x1a56('0x1b')][_0x1a56('0x11e')](db[_0x1a56('0x154')],{'as':'Members','foreignKey':_0x1a56('0x155')});db[_0x1a56('0x1b')][_0x1a56('0x11e')](db[_0x1a56('0x76')],{'as':_0x1a56('0x156'),'foreignKey':'VoiceQueueId'});db[_0x1a56('0x1b')][_0x1a56('0x11e')](db[_0x1a56('0x7a')],{'as':_0x1a56('0x157'),'foreignKey':'VoiceQueueId'});db[_0x1a56('0x1b')]['hasMany'](db[_0x1a56('0x122')],{'as':_0x1a56('0x158'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x1a56('0x11e')](db[_0x1a56('0x7d')],{'as':_0x1a56('0x7d'),'foreignKey':_0x1a56('0x155')});db[_0x1a56('0x1b')][_0x1a56('0x11e')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x1a56('0x155')});db[_0x1a56('0x1b')][_0x1a56('0x11e')](db[_0x1a56('0xdd')],{'as':'JscriptySessions','foreignKey':_0x1a56('0x155')});db['VoiceQueue'][_0x1a56('0x128')](db[_0x1a56('0x2b')],{'as':'Trunk','foreignKey':_0x1a56('0x159')});db[_0x1a56('0x1b')]['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x1a56('0x15a')});db[_0x1a56('0x1b')][_0x1a56('0x128')](db[_0x1a56('0x15b')],{'as':_0x1a56('0x15b'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x1b')][_0x1a56('0x128')](db['Pause'],{'as':_0x1a56('0x15d'),'foreignKey':_0x1a56('0x15e')});db[_0x1a56('0x1b')][_0x1a56('0x12a')](db[_0x1a56('0x100')],{'as':_0x1a56('0x12e'),'through':_0x1a56('0x15f')});db[_0x1a56('0x1b')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x2f')});db[_0x1a56('0x1b')][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0x1a56('0x1b')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':_0x1a56('0x161')});db[_0x1a56('0x1d')][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x12'),'foreignKey':_0x1a56('0x11c')});db['ScreenRecording']['belongsTo'](db['User'],{'as':_0x1a56('0x12'),'foreignKey':_0x1a56('0x11c')});db['VoiceMail'][_0x1a56('0x11e')](db[_0x1a56('0x23')],{'as':_0x1a56('0x162'),'onDelete':'cascade','foreignKey':_0x1a56('0x163'),'sourceKey':_0x1a56('0x164')});db['VoiceMailMessage'][_0x1a56('0x128')](db[_0x1a56('0x21')],{'foreignKey':_0x1a56('0x163'),'targetKey':'mailbox'});db['VoiceCallReport'][_0x1a56('0x11e')](db['VoiceQueueReport'],{'as':_0x1a56('0x165'),'foreignKey':_0x1a56('0x166'),'constraints':![]});db['VoiceCallReport'][_0x1a56('0x11e')](db[_0x1a56('0x27')],{'as':_0x1a56('0x167'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':'User','foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x25')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x16a')][_0x1a56('0x128')](db[_0x1a56('0x3b')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x1a56('0x16a')][_0x1a56('0x128')](db[_0x1a56('0x113')],{'as':_0x1a56('0x113'),'foreignKey':'CloudProviderId','onDelete':_0x1a56('0x16b')});db['MailServerOut'][_0x1a56('0x128')](db['MailAccount'],{'as':_0x1a56('0x3b'),'foreignKey':'MailAccountId'});db[_0x1a56('0x39')][_0x1a56('0x128')](db[_0x1a56('0x113')],{'as':_0x1a56('0x113'),'foreignKey':_0x1a56('0x16c'),'onDelete':'restrict'});db[_0x1a56('0x3b')][_0x1a56('0x11b')](db['MailServerIn'],{'as':_0x1a56('0x16d'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x3b')]['hasOne'](db[_0x1a56('0x39')],{'as':_0x1a56('0x16e'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x3b')]['hasMany'](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x171'),'onDelete':_0x1a56('0x121')});db['MailAccount']['hasMany'](db[_0x1a56('0x81')],{'as':_0x1a56('0x172'),'foreignKey':_0x1a56('0x171')});db['MailAccount'][_0x1a56('0x11e')](db[_0x1a56('0x41')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x1a56('0x3b')]['hasMany'](db[_0x1a56('0x3f')],{'as':_0x1a56('0x173')});db[_0x1a56('0x3b')]['hasMany'](db['MailApplication'],{'as':_0x1a56('0x150')});db['MailAccount'][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x3b')][_0x1a56('0x128')](db[_0x1a56('0x91')],{'as':_0x1a56('0x91'),'foreignKey':_0x1a56('0x176')});db[_0x1a56('0x3b')][_0x1a56('0x128')](db[_0x1a56('0x87')],{'as':_0x1a56('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0x1a56('0x12')],{'as':'Agents','through':_0x1a56('0x31')});db[_0x1a56('0x3d')][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'through':_0x1a56('0x177'),'as':_0x1a56('0x178')});db[_0x1a56('0x3f')]['hasMany'](db[_0x1a56('0x41')],{'as':_0x1a56('0x162'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x1a56('0x3f')][_0x1a56('0x128')](db[_0x1a56('0x3b')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x171')});db[_0x1a56('0x3f')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x3f')]['belongsTo'](db[_0x1a56('0x12')],{'as':_0x1a56('0x17a'),'foreignKey':'UserId'});db[_0x1a56('0x3f')]['belongsToMany'](db['Tag'],{'through':_0x1a56('0x17b'),'as':_0x1a56('0x17c')});db[_0x1a56('0x3f')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x17b'),'as':_0x1a56('0x17d')});db[_0x1a56('0x3f')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':'Users','through':_0x1a56('0x132'),'foreignKey':'MailInteractionId'});db['MailMessage']['hasMany'](db[_0x1a56('0xf3')],{'as':_0x1a56('0x17e'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x41')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':'User'});db['MailMessage'][_0x1a56('0x128')](db['CmContact'],{'onDelete':_0x1a56('0x121'),'as':'Contact'});db[_0x1a56('0x41')]['belongsTo'](db[_0x1a56('0x3f')],{'as':_0x1a56('0x17f'),'foreignKey':'MailInteractionId'});db[_0x1a56('0x41')]['belongsTo'](db['MailAccount'],{'as':_0x1a56('0x179'),'foreignKey':'MailAccountId'});db['MailMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x1a56('0x66'),'foreignKey':_0x1a56('0x180')});db[_0x1a56('0x41')][_0x1a56('0x128')](db[_0x1a56('0x6f')],{'as':_0x1a56('0x6f'),'foreignKey':'ChatOfflineMessageId'});db[_0x1a56('0x43')]['belongsTo'](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x43')][_0x1a56('0x128')](db[_0x1a56('0x3d')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x43')][_0x1a56('0x128')](db[_0x1a56('0x3b')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x43')]['belongsTo'](db['Interval'],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x15c')});db['MailApplication'][_0x1a56('0x128')](db['Tag'],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x181')});db[_0x1a56('0x45')][_0x1a56('0x128')](db[_0x1a56('0x3b')],{});db['MailQueueReport'][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':'ListId'});db[_0x1a56('0x45')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':'ContactId'});db[_0x1a56('0x45')]['belongsTo'](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db[_0x1a56('0x41')],{});db[_0x1a56('0x45')]['belongsTo'](db[_0x1a56('0x12')],{});db[_0x1a56('0x45')][_0x1a56('0x128')](db[_0x1a56('0x3d')],{});db[_0x1a56('0x46')][_0x1a56('0x11e')](db[_0x1a56('0x48')],{'as':'Items','onDelete':_0x1a56('0x121')});db[_0x1a56('0x4a')][_0x1a56('0x11e')](db['Disposition'],{'as':_0x1a56('0x170'),'foreignKey':'FaxAccountId','onDelete':_0x1a56('0x121')});db[_0x1a56('0x4a')][_0x1a56('0x11e')](db[_0x1a56('0x81')],{'as':_0x1a56('0x172'),'foreignKey':_0x1a56('0x182')});db[_0x1a56('0x4a')]['hasMany'](db[_0x1a56('0x4e')],{'as':_0x1a56('0x173')});db[_0x1a56('0x4a')][_0x1a56('0x11e')](db['FaxApplication'],{'as':_0x1a56('0x150')});db['FaxAccount'][_0x1a56('0x11e')](db[_0x1a56('0x18')],{'as':_0x1a56('0x183'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x4a')][_0x1a56('0x11e')](db[_0x1a56('0x50')],{'as':'Messages'});db[_0x1a56('0x4a')][_0x1a56('0x128')](db[_0x1a56('0x2b')],{'as':_0x1a56('0x2b')});db['FaxAccount']['belongsTo'](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x4a')]['belongsTo'](db[_0x1a56('0x87')],{'as':_0x1a56('0x15d'),'foreignKey':_0x1a56('0x15e')});db['FaxAccount'][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x184')});db['FaxApplication']['belongsTo'](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x4c')][_0x1a56('0x128')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x1a56('0x4c')][_0x1a56('0x128')](db[_0x1a56('0x4a')],{'onDelete':'restrict'});db[_0x1a56('0x4c')][_0x1a56('0x128')](db[_0x1a56('0x90')],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x181')});db[_0x1a56('0x4e')]['hasMany'](db[_0x1a56('0x50')],{'as':_0x1a56('0x162'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x185')});db[_0x1a56('0x4e')][_0x1a56('0x128')](db[_0x1a56('0x4a')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x182')});db[_0x1a56('0x4e')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x17a'),'foreignKey':'UserId'});db[_0x1a56('0x4e')]['belongsToMany'](db[_0x1a56('0x90')],{'through':'fax_interaction_has_tags','as':_0x1a56('0x17c')});db[_0x1a56('0x4e')][_0x1a56('0x12a')](db['Tag'],{'through':_0x1a56('0x186'),'as':'ThroughTags'});db[_0x1a56('0x4e')][_0x1a56('0x12a')](db['User'],{'as':_0x1a56('0x187'),'through':_0x1a56('0x135'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x12')});db['FaxMessage'][_0x1a56('0x128')](db[_0x1a56('0x4e')],{'as':_0x1a56('0x17f'),'foreignKey':_0x1a56('0x185')});db[_0x1a56('0x50')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'onDelete':'cascade','as':_0x1a56('0x168')});db[_0x1a56('0x50')][_0x1a56('0x128')](db[_0x1a56('0xf3')],{'as':_0x1a56('0xf3'),'foreignKey':_0x1a56('0x188')});db[_0x1a56('0x50')][_0x1a56('0x128')](db['FaxAccount'],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x182')});db[_0x1a56('0x52')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x13e')});db['FaxQueue'][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'through':_0x1a56('0x189'),'as':_0x1a56('0x178')});db[_0x1a56('0x54')][_0x1a56('0x128')](db[_0x1a56('0x4a')],{});db[_0x1a56('0x54')][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x54')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':'ContactId'});db[_0x1a56('0x54')][_0x1a56('0x128')](db[_0x1a56('0x4e')],{});db[_0x1a56('0x54')][_0x1a56('0x128')](db[_0x1a56('0x50')],{});db[_0x1a56('0x54')][_0x1a56('0x128')](db[_0x1a56('0x12')],{});db[_0x1a56('0x54')]['belongsTo'](db['FaxQueue'],{});db[_0x1a56('0x146')][_0x1a56('0x11e')](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x18a'),'onDelete':'cascade'});db[_0x1a56('0x146')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x1a56('0x18a')});db[_0x1a56('0x146')]['hasMany'](db[_0x1a56('0x59')],{'as':_0x1a56('0x162'),'foreignKey':_0x1a56('0x18a')});db[_0x1a56('0x146')][_0x1a56('0x11e')](db['SmsInteraction'],{'as':_0x1a56('0x173')});db[_0x1a56('0x146')]['hasMany'](db['SmsApplication'],{'as':_0x1a56('0x150')});db[_0x1a56('0x146')][_0x1a56('0x128')](db['CmList'],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x146')][_0x1a56('0x128')](db[_0x1a56('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x1a56('0x15e')});db[_0x1a56('0x146')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':'Agents','through':_0x1a56('0x148')});db[_0x1a56('0x18b')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':'restrict'});db['SmsApplication'][_0x1a56('0x128')](db[_0x1a56('0x5b')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x18b')]['belongsTo'](db[_0x1a56('0x146')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x18b')]['belongsTo'](db[_0x1a56('0x15b')],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x18b')][_0x1a56('0x128')](db[_0x1a56('0x90')],{'onDelete':'restrict','foreignKey':_0x1a56('0x181')});db[_0x1a56('0x57')][_0x1a56('0x11e')](db[_0x1a56('0x59')],{'as':_0x1a56('0x162'),'onDelete':'cascade','foreignKey':_0x1a56('0x18c')});db[_0x1a56('0x57')][_0x1a56('0x128')](db['SmsAccount'],{'as':'Account','foreignKey':_0x1a56('0x18a')});db['SmsInteraction'][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x57')][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x17a'),'foreignKey':_0x1a56('0x11c')});db['SmsInteraction'][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x18d'),'as':'Tags'});db[_0x1a56('0x57')]['belongsToMany'](db[_0x1a56('0x90')],{'through':_0x1a56('0x18d'),'as':_0x1a56('0x17d')});db[_0x1a56('0x57')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x187'),'through':_0x1a56('0x137'),'foreignKey':_0x1a56('0x18c')});db[_0x1a56('0x59')][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x12')});db[_0x1a56('0x59')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x168')});db['SmsMessage'][_0x1a56('0x128')](db[_0x1a56('0x57')],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x17f'),'foreignKey':_0x1a56('0x18c')});db[_0x1a56('0x59')]['belongsTo'](db[_0x1a56('0x146')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x18a')});db[_0x1a56('0x5b')][_0x1a56('0x12a')](db['User'],{'as':_0x1a56('0x160'),'through':_0x1a56('0x34'),'foreignKey':'SmsQueueId'});db[_0x1a56('0x5b')][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'through':'team_has_sms_queues','as':'Teams'});db['OpenchannelAccount'][_0x1a56('0x11e')](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x18e'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x5d')][_0x1a56('0x11e')](db[_0x1a56('0x81')],{'as':_0x1a56('0x172'),'foreignKey':_0x1a56('0x18e')});db[_0x1a56('0x5d')][_0x1a56('0x11e')](db[_0x1a56('0x61')],{'as':_0x1a56('0x173'),'foreignKey':_0x1a56('0x18e')});db[_0x1a56('0x5d')][_0x1a56('0x11e')](db['OpenchannelMessage'],{'as':_0x1a56('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0x1a56('0x5d')][_0x1a56('0x11e')](db[_0x1a56('0x5f')],{'as':_0x1a56('0x150'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['belongsTo'](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db['OpenchannelAccount'][_0x1a56('0x128')](db['Pause'],{'as':_0x1a56('0x15d'),'foreignKey':_0x1a56('0x15e')});db['OpenchannelAccount'][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':'Agents','through':_0x1a56('0x145')});db[_0x1a56('0x5f')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x5f')][_0x1a56('0x128')](db[_0x1a56('0x65')],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x18f')});db[_0x1a56('0x5f')]['belongsTo'](db[_0x1a56('0x5d')],{'onDelete':'restrict','foreignKey':_0x1a56('0x18e')});db['OpenchannelApplication'][_0x1a56('0x128')](db['Interval'],{'onDelete':_0x1a56('0x16b'),'foreignKey':'IntervalId'});db[_0x1a56('0x5f')][_0x1a56('0x128')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x1a56('0x181')});db[_0x1a56('0x61')][_0x1a56('0x11e')](db[_0x1a56('0x63')],{'as':_0x1a56('0x162'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x190')});db[_0x1a56('0x61')][_0x1a56('0x128')](db[_0x1a56('0x5d')],{'as':_0x1a56('0x179'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':'Contact','foreignKey':_0x1a56('0x169')});db[_0x1a56('0x61')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':_0x1a56('0x17a'),'foreignKey':_0x1a56('0x11c')});db['OpenchannelInteraction'][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x191'),'as':_0x1a56('0x17c')});db[_0x1a56('0x61')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x191'),'as':_0x1a56('0x17d')});db[_0x1a56('0x61')]['belongsToMany'](db[_0x1a56('0x12')],{'as':_0x1a56('0x187'),'through':_0x1a56('0x138'),'foreignKey':_0x1a56('0x190')});db[_0x1a56('0x63')]['belongsTo'](db['User'],{'onDelete':'cascade','as':'User'});db['OpenchannelMessage']['belongsTo'](db[_0x1a56('0x74')],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x168')});db['OpenchannelMessage'][_0x1a56('0x128')](db[_0x1a56('0x61')],{'onDelete':'cascade','as':_0x1a56('0x17f'),'foreignKey':_0x1a56('0x190')});db[_0x1a56('0x63')][_0x1a56('0x128')](db[_0x1a56('0xf3')],{'as':'Attachment','foreignKey':_0x1a56('0x188')});db['OpenchannelMessage'][_0x1a56('0x128')](db[_0x1a56('0x5d')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x18e')});db[_0x1a56('0x65')]['belongsToMany'](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x140'),'foreignKey':_0x1a56('0x18f')});db[_0x1a56('0x65')]['belongsToMany'](db[_0x1a56('0xed')],{'through':_0x1a56('0x192'),'as':'Teams'});db[_0x1a56('0x66')][_0x1a56('0x11e')](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x180'),'onDelete':_0x1a56('0x121')});db['ChatWebsite'][_0x1a56('0x11e')](db[_0x1a56('0x81')],{'as':_0x1a56('0x172'),'foreignKey':_0x1a56('0x180')});db['ChatWebsite']['hasMany'](db[_0x1a56('0x72')],{'as':'ProactiveActions'});db[_0x1a56('0x66')][_0x1a56('0x11e')](db[_0x1a56('0x6c')],{'as':_0x1a56('0x173')});db['ChatWebsite'][_0x1a56('0x11e')](db[_0x1a56('0x6a')],{'as':_0x1a56('0x150')});db[_0x1a56('0x66')][_0x1a56('0x11e')](db[_0x1a56('0x6d')],{'as':'Messages'});db['ChatWebsite'][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x66')][_0x1a56('0x128')](db[_0x1a56('0x15b')],{'as':_0x1a56('0x15b'),'foreignKey':'IntervalId'});db[_0x1a56('0x66')]['belongsTo'](db[_0x1a56('0x3b')],{'as':_0x1a56('0x3b'),'foreignKey':'MailAccountId'});db[_0x1a56('0x66')]['belongsTo'](db[_0x1a56('0x87')],{'as':_0x1a56('0x15d'),'foreignKey':_0x1a56('0x15e')});db[_0x1a56('0x66')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x141')});db['OpenchannelQueueReport']['belongsTo'](db[_0x1a56('0x5d')],{});db[_0x1a56('0x68')][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x68')][_0x1a56('0x128')](db['CmContact'],{'as':_0x1a56('0x168'),'foreignKey':'ContactId'});db[_0x1a56('0x68')][_0x1a56('0x128')](db[_0x1a56('0x61')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x1a56('0x63')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x1a56('0x12')],{});db[_0x1a56('0x68')][_0x1a56('0x128')](db[_0x1a56('0x65')],{});db['ChatApplication'][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':_0x1a56('0x193'),'foreignKey':_0x1a56('0x11c'),'onDelete':_0x1a56('0x16b')});db['ChatApplication'][_0x1a56('0x128')](db[_0x1a56('0x70')],{'as':_0x1a56('0x194'),'foreignKey':_0x1a56('0x195'),'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x6a')][_0x1a56('0x128')](db[_0x1a56('0x66')],{'as':_0x1a56('0x196'),'foreignKey':_0x1a56('0x180'),'onDelete':_0x1a56('0x16b')});db['ChatApplication'][_0x1a56('0x128')](db[_0x1a56('0x90')],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x181')});db['ChatInteraction'][_0x1a56('0x11e')](db[_0x1a56('0x6d')],{'as':_0x1a56('0x162'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x197')});db[_0x1a56('0x6c')][_0x1a56('0x128')](db[_0x1a56('0x66')],{'as':_0x1a56('0x179'),'foreignKey':'ChatWebsiteId'});db[_0x1a56('0x6c')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x6c')]['belongsTo'](db[_0x1a56('0x12')],{'as':_0x1a56('0x17a'),'foreignKey':'UserId'});db['ChatInteraction'][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x198'),'as':_0x1a56('0x17c')});db['ChatInteraction']['belongsToMany'](db[_0x1a56('0x90')],{'through':_0x1a56('0x198'),'as':_0x1a56('0x17d')});db[_0x1a56('0x6c')]['belongsToMany'](db['User'],{'as':_0x1a56('0x187'),'through':_0x1a56('0x134'),'foreignKey':_0x1a56('0x197')});db[_0x1a56('0x6d')]['belongsTo'](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x12')});db[_0x1a56('0x6d')][_0x1a56('0x128')](db['CmContact'],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x6d')][_0x1a56('0x128')](db[_0x1a56('0x6c')],{'onDelete':_0x1a56('0x121'),'as':'Interaction','foreignKey':_0x1a56('0x197')});db['ChatMessage']['belongsTo'](db[_0x1a56('0xf3')],{'as':_0x1a56('0xf3'),'foreignKey':'AttachmentId'});db[_0x1a56('0x6d')][_0x1a56('0x128')](db[_0x1a56('0x66')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x180')});db['ChatOfflineMessage'][_0x1a56('0x11e')](db[_0x1a56('0xf3')],{'as':_0x1a56('0x17e'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x1a56('0x121'),'hooks':!![]});db[_0x1a56('0x6f')][_0x1a56('0x128')](db['CmContact'],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x6f')]['belongsTo'](db[_0x1a56('0x66')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x180')});db[_0x1a56('0x70')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':'Agents','through':_0x1a56('0x199'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0x1a56('0xed')],{'through':_0x1a56('0x19a'),'as':_0x1a56('0x178')});db['ChatGroup'][_0x1a56('0x11e')](db[_0x1a56('0xd7')],{'as':'Messages','foreignKey':_0x1a56('0x19b'),'onDelete':_0x1a56('0x121')});db['ChatGroup']['belongsToMany'](db[_0x1a56('0x12')],{'as':_0x1a56('0x19c'),'through':'chat_group_has_users'});db[_0x1a56('0x72')][_0x1a56('0x128')](db[_0x1a56('0x66')],{'as':_0x1a56('0x196'),'foreignKey':'ChatWebsiteId'});db[_0x1a56('0x73')]['hasMany'](db[_0x1a56('0x74')],{'as':_0x1a56('0x12c'),'foreignKey':_0x1a56('0x19d')});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x76')],{'as':_0x1a56('0x156'),'foreignKey':'ContactId'});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x7a')],{'as':_0x1a56('0x157'),'foreignKey':'ContactId'});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x122')],{'as':'HopperHistories','foreignKey':_0x1a56('0x169')});db['CmContact']['hasMany'](db[_0x1a56('0x7d')],{'as':_0x1a56('0x7d'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x1a56('0xdd')],{'as':_0x1a56('0x19e'),'foreignKey':'ContactId'});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x61')],{'as':_0x1a56('0x19f'),'foreignKey':_0x1a56('0x169'),'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x6c')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0x1a56('0x16b')});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x57')],{'as':_0x1a56('0x136'),'foreignKey':_0x1a56('0x169'),'onDelete':_0x1a56('0x16b')});db['CmContact'][_0x1a56('0x11e')](db[_0x1a56('0x4e')],{'as':_0x1a56('0x124'),'foreignKey':_0x1a56('0x169'),'onDelete':'restrict'});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x3f')],{'as':_0x1a56('0x131'),'foreignKey':_0x1a56('0x169'),'onDelete':_0x1a56('0x16b')});db['CmContact']['belongsTo'](db['CmCompany'],{'as':_0x1a56('0x1a0'),'foreignKey':_0x1a56('0x19d')});db[_0x1a56('0x74')][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':'ListId','onDelete':_0x1a56('0x121')});db['CmContact'][_0x1a56('0x12a')](db['User'],{'as':_0x1a56('0x187'),'through':_0x1a56('0x12d')});db[_0x1a56('0x74')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'as':'Tags','through':_0x1a56('0x1a1')});db[_0x1a56('0x74')]['belongsToMany'](db[_0x1a56('0x90')],{'through':_0x1a56('0x1a1'),'as':_0x1a56('0x17d')});db[_0x1a56('0x76')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0x1a56('0x76')][_0x1a56('0x128')](db['CmList'],{'as':'List','foreignKey':_0x1a56('0x175'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x76')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':'Agent','foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x76')][_0x1a56('0x128')](db[_0x1a56('0x1b')],{'as':_0x1a56('0x194'),'foreignKey':_0x1a56('0x155'),'onDelete':'cascade'});db[_0x1a56('0x76')][_0x1a56('0x128')](db[_0x1a56('0xf0')],{'as':_0x1a56('0xf0'),'foreignKey':_0x1a56('0x1a2'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x76')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':'Owner','foreignKey':_0x1a56('0x1a3')});db[_0x1a56('0x78')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169'),'onDelete':'cascade'});db[_0x1a56('0x78')][_0x1a56('0x128')](db['CmList'],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x78')]['belongsTo'](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x1a56('0x155'),'onDelete':_0x1a56('0x121')});db['CmHopperBlack'][_0x1a56('0x128')](db['Campaign'],{'as':_0x1a56('0xf0'),'foreignKey':_0x1a56('0x1a2'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x80')][_0x1a56('0x11e')](db[_0x1a56('0x84')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x1a56('0x1a4'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x1a56('0x11e')](db[_0x1a56('0x84')],{'as':{'plural':_0x1a56('0x1a5'),'singular':_0x1a56('0x1a6')},'foreignKey':_0x1a56('0x1a7'),'onDelete':_0x1a56('0x121'),'hooks':!![]});db['Automation'][_0x1a56('0x11e')](db[_0x1a56('0x1a8')],{'as':_0x1a56('0x1a9'),'foreignKey':_0x1a56('0x1aa'),'onDelete':_0x1a56('0x121'),'hooks':!![]});db['Disposition'][_0x1a56('0x11e')](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x1ab'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x15b')][_0x1a56('0x11e')](db[_0x1a56('0x15b')],{'as':_0x1a56('0x1ac'),'foreignKey':_0x1a56('0x15c'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x1a56('0x15b')]['hasMany'](db['VoiceExtension'],{'as':_0x1a56('0x120'),'foreignKey':_0x1a56('0x15c'),'onDelete':'restrict'});db['Interval'][_0x1a56('0x11e')](db['MailApplication'],{'as':_0x1a56('0x1ad'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x15b')][_0x1a56('0x11e')](db[_0x1a56('0x6a')],{'as':_0x1a56('0x1ae'),'foreignKey':'IntervalId'});db[_0x1a56('0x15b')]['hasMany'](db[_0x1a56('0x4c')],{'as':_0x1a56('0x1af'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x15b')][_0x1a56('0x11e')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x8c')][_0x1a56('0x128')](db['MailAccount'],{});db[_0x1a56('0x8c')][_0x1a56('0x128')](db[_0x1a56('0x9a')],{'foreignKey':_0x1a56('0x1b0')});db[_0x1a56('0x8c')]['belongsTo'](db[_0x1a56('0x98')],{'foreignKey':_0x1a56('0x1b1')});db[_0x1a56('0x8e')][_0x1a56('0x12a')](db['VoiceMusicOnHold'],{'as':_0x1a56('0x1b2'),'through':_0x1a56('0x153'),'onDelete':'restrict'});db[_0x1a56('0x90')][_0x1a56('0x12a')](db[_0x1a56('0x74')],{'through':_0x1a56('0x1a1')});db[_0x1a56('0x90')][_0x1a56('0x12a')](db[_0x1a56('0x6c')],{'through':_0x1a56('0x198')});db[_0x1a56('0x90')][_0x1a56('0x12a')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x1a56('0x90')]['belongsToMany'](db[_0x1a56('0x57')],{'through':_0x1a56('0x18d')});db[_0x1a56('0x90')]['belongsToMany'](db[_0x1a56('0x4e')],{'through':_0x1a56('0x186')});db[_0x1a56('0x90')][_0x1a56('0x12a')](db[_0x1a56('0x61')],{'through':_0x1a56('0x191')});db[_0x1a56('0x90')][_0x1a56('0x12a')](db[_0x1a56('0x10c')],{'through':_0x1a56('0x1b3')});db['Trigger']['hasMany'](db[_0x1a56('0x84')],{'as':{'plural':'AllConditions','singular':_0x1a56('0x1b4')},'foreignKey':_0x1a56('0x1b5'),'onDelete':_0x1a56('0x121'),'hooks':!![]});db['Trigger'][_0x1a56('0x11e')](db[_0x1a56('0x84')],{'as':{'plural':_0x1a56('0x1b6'),'singular':_0x1a56('0x1b7')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x1a56('0x93')][_0x1a56('0x11e')](db[_0x1a56('0x1a8')],{'as':_0x1a56('0x1a9'),'foreignKey':'TriggerId','onDelete':_0x1a56('0x121'),'hooks':!![]});db[_0x1a56('0x98')][_0x1a56('0x11e')](db[_0x1a56('0x9e')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x1a56('0x1b1'),'hooks':!![]});db[_0x1a56('0x9a')]['hasMany'](db[_0x1a56('0x9e')],{'as':_0x1a56('0x1b8'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1b0')});db['AnalyticMetric'][_0x1a56('0x11e')](db['AnalyticFieldReport'],{'as':_0x1a56('0x1b8'),'onDelete':_0x1a56('0x121'),'foreignKey':'MetricId'});db[_0x1a56('0x9e')]['belongsTo'](db[_0x1a56('0x1b9')],{'foreignKey':_0x1a56('0x1ba')});db[_0x1a56('0xa2')][_0x1a56('0x11e')](db[_0x1a56('0xa4')],{'as':_0x1a56('0x1bb'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xa4')][_0x1a56('0x11e')](db['SalesforceField'],{'as':_0x1a56('0x1bd'),'onDelete':_0x1a56('0x121'),'foreignKey':'SubjectId'});db[_0x1a56('0xa4')][_0x1a56('0x11e')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1be')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x1a56('0x1b8'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xa4')][_0x1a56('0x128')](db['SalesforceAccount'],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0x1c0')][_0x1a56('0x11e')](db[_0x1a56('0x1c0')],{'as':'Subject','foreignKey':_0x1a56('0x1c1')});db['SalesforceField'][_0x1a56('0x11e')](db[_0x1a56('0x1c0')],{'as':_0x1a56('0x1c2'),'foreignKey':'DescriptionId'});db[_0x1a56('0x1c0')]['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0x1c0')][_0x1a56('0x128')](db['Variable'],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xa6')]['hasMany'](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db['SugarcrmConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xaa')],{'as':_0x1a56('0x1bd'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xa8')][_0x1a56('0x11e')](db[_0x1a56('0xaa')],{'as':_0x1a56('0x1c4'),'onDelete':'cascade','foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xa8')][_0x1a56('0x11e')](db[_0x1a56('0xaa')],{'as':'Fields','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xa8')][_0x1a56('0x128')](db[_0x1a56('0xa6')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xaa')][_0x1a56('0x11e')](db['SugarcrmField'],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xaa')][_0x1a56('0x11e')](db[_0x1a56('0xaa')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x1a56('0x11e')](db[_0x1a56('0xaa')],{'as':_0x1a56('0x1c6'),'foreignKey':'FieldId'});db['SugarcrmField']['belongsTo'](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xac')][_0x1a56('0x11e')](db[_0x1a56('0xad')],{'as':_0x1a56('0x1bb'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':_0x1a56('0x1bd'),'onDelete':_0x1a56('0x121'),'foreignKey':'SubjectId'});db[_0x1a56('0xad')]['hasMany'](db[_0x1a56('0xaf')],{'as':_0x1a56('0x1c4'),'onDelete':_0x1a56('0x121'),'foreignKey':'DescriptionId'});db[_0x1a56('0xad')][_0x1a56('0x11e')](db[_0x1a56('0xaf')],{'as':_0x1a56('0x1b8'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xad')][_0x1a56('0x128')](db[_0x1a56('0xac')],{'as':_0x1a56('0x179'),'foreignKey':'AccountId'});db[_0x1a56('0xad')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x1c7')});db[_0x1a56('0xaf')][_0x1a56('0x11e')](db[_0x1a56('0xaf')],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xaf')]['hasMany'](db[_0x1a56('0xaf')],{'as':_0x1a56('0x1c2'),'foreignKey':_0x1a56('0x1be')});db['DeskField'][_0x1a56('0x11e')](db[_0x1a56('0xaf')],{'as':_0x1a56('0x1c6'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xaf')][_0x1a56('0x128')](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xb1')][_0x1a56('0x11e')](db['ZohoConfiguration'],{'as':_0x1a56('0x1bb'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db['ZohoConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xb4')],{'as':_0x1a56('0x1bd'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xb2')][_0x1a56('0x11e')](db[_0x1a56('0xb4')],{'as':'Descriptions','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xb2')][_0x1a56('0x11e')](db[_0x1a56('0xb4')],{'as':_0x1a56('0x1b8'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xb2')][_0x1a56('0x128')](db[_0x1a56('0xb1')],{'as':'Account','foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xb4')][_0x1a56('0x11e')](db['ZohoField'],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xb4')]['hasMany'](db['ZohoField'],{'as':'Description','foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xb4')]['hasMany'](db[_0x1a56('0xb4')],{'as':_0x1a56('0x1c6'),'foreignKey':'FieldId'});db[_0x1a56('0xb4')][_0x1a56('0x128')](db[_0x1a56('0x95')],{'as':'Variable','foreignKey':_0x1a56('0x1c3')});db['ZendeskAccount'][_0x1a56('0x11e')](db[_0x1a56('0x1c8')],{'as':_0x1a56('0x1bb'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bc')});db['ZendeskConfiguration']['hasMany'](db[_0x1a56('0xb9')],{'as':_0x1a56('0x1bd'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0x1c8')][_0x1a56('0x11e')](db[_0x1a56('0xb9')],{'as':'Descriptions','foreignKey':_0x1a56('0x1be')});db['ZendeskConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xb9')],{'as':'Fields','foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0x1c8')]['belongsTo'](db['ZendeskAccount'],{'as':_0x1a56('0x179'),'foreignKey':'AccountId'});db[_0x1a56('0x1c8')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x1a56('0x11e')](db[_0x1a56('0xb9')],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xb9')][_0x1a56('0x11e')](db[_0x1a56('0xb9')],{'as':_0x1a56('0x1c2'),'foreignKey':'DescriptionId'});db[_0x1a56('0xb9')][_0x1a56('0x11e')](db[_0x1a56('0xb9')],{'as':_0x1a56('0x1c6'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xb9')][_0x1a56('0x128')](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xbb')][_0x1a56('0x11e')](db['FreshdeskConfiguration'],{'as':_0x1a56('0x1bb'),'onDelete':_0x1a56('0x121'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xbd')],{'as':'Subjects','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1c1')});db['FreshdeskConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xbd')],{'as':_0x1a56('0x1c4'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x1a56('0xbc')][_0x1a56('0x11e')](db[_0x1a56('0xbd')],{'as':_0x1a56('0x1b8'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xbc')][_0x1a56('0x128')](db['FreshdeskAccount'],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db['FreshdeskConfiguration'][_0x1a56('0x12a')](db['Tag'],{'through':_0x1a56('0x1c9')});db['FreshdeskField'][_0x1a56('0x11e')](db[_0x1a56('0xbd')],{'as':_0x1a56('0x1c5'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x1a56('0x11e')](db['FreshdeskField'],{'as':'Description','foreignKey':_0x1a56('0x1be')});db['FreshdeskField'][_0x1a56('0x11e')](db[_0x1a56('0xbd')],{'as':'Field','foreignKey':'FieldId'});db['FreshdeskField']['belongsTo'](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':'VariableId'});db['VtigerAccount'][_0x1a56('0x11e')](db[_0x1a56('0x1ca')],{'as':_0x1a56('0x1bb'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bc')});db['VtigerConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xc2')],{'as':_0x1a56('0x1bd'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0x1ca')]['hasMany'](db[_0x1a56('0xc2')],{'as':_0x1a56('0x1c4'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xc2')],{'as':_0x1a56('0x1b8'),'foreignKey':_0x1a56('0x1bf')});db['VtigerConfiguration']['belongsTo'](db[_0x1a56('0xbf')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xc2')][_0x1a56('0x11e')](db[_0x1a56('0xc2')],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xc2')][_0x1a56('0x11e')](db[_0x1a56('0xc2')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x1a56('0xc2')][_0x1a56('0x11e')](db[_0x1a56('0xc2')],{'as':_0x1a56('0x1c6'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xc2')]['belongsTo'](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':'VariableId'});db[_0x1a56('0xc3')][_0x1a56('0x11e')](db[_0x1a56('0xc4')],{'as':'Configurations','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xc4')][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':_0x1a56('0x1c4'),'foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xc4')][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':_0x1a56('0x1b8'),'foreignKey':'FieldId'});db[_0x1a56('0xc4')][_0x1a56('0x128')](db[_0x1a56('0xc3')],{'as':'Account','foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0x1cb')][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':_0x1a56('0x1c5'),'foreignKey':'SubjectId'});db[_0x1a56('0x1cb')][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':_0x1a56('0x1c2'),'foreignKey':_0x1a56('0x1be')});db['ServicenowField'][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':_0x1a56('0x1c6'),'foreignKey':_0x1a56('0x1bf')});db['ServicenowField']['belongsTo'](db[_0x1a56('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0x1a56('0xc7')][_0x1a56('0x11e')](db[_0x1a56('0x1cc')],{'as':_0x1a56('0x1bb'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xc7')][_0x1a56('0x128')](db[_0x1a56('0x113')],{'as':'CloudProvider','foreignKey':_0x1a56('0x16c')});db[_0x1a56('0x1cc')][_0x1a56('0x11e')](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1bd'),'onDelete':'cascade','foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0x1cc')][_0x1a56('0x11e')](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1c4'),'onDelete':_0x1a56('0x121'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1b8'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0x1cc')]['belongsTo'](db[_0x1a56('0xc7')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xc9')][_0x1a56('0x11e')](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1c5'),'foreignKey':'SubjectId'});db[_0x1a56('0xc9')][_0x1a56('0x11e')](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1c2'),'foreignKey':_0x1a56('0x1be')});db['Dynamics365Field'][_0x1a56('0x11e')](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1c6'),'foreignKey':_0x1a56('0x1bf')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xcb')][_0x1a56('0x11e')](db['FreshsalesConfiguration'],{'as':_0x1a56('0x1bb'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xcd')][_0x1a56('0x11e')](db[_0x1a56('0xcf')],{'as':_0x1a56('0x1bd'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xcd')]['hasMany'](db[_0x1a56('0xcf')],{'as':_0x1a56('0x1c4'),'foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xcd')]['hasMany'](db[_0x1a56('0xcf')],{'as':_0x1a56('0x1b8'),'foreignKey':_0x1a56('0x1bf')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db['FreshsalesField'][_0x1a56('0x11e')](db[_0x1a56('0xcf')],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xcf')][_0x1a56('0x11e')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xcf')][_0x1a56('0x11e')](db[_0x1a56('0xcf')],{'as':'Field','foreignKey':'FieldId'});db[_0x1a56('0xcf')][_0x1a56('0x128')](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xd5')][_0x1a56('0x128')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':'List','foreignKey':'ListId'});db[_0x1a56('0xd5')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':'ContactId'});db[_0x1a56('0xd5')]['belongsTo'](db[_0x1a56('0x6c')],{});db[_0x1a56('0xd5')]['belongsTo'](db['ChatMessage'],{});db[_0x1a56('0xd5')][_0x1a56('0x128')](db[_0x1a56('0x12')],{});db[_0x1a56('0xd5')][_0x1a56('0x128')](db[_0x1a56('0x70')],{});db[_0x1a56('0xd7')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x1a56('0xd7')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':'cascade','foreignKey':_0x1a56('0x1cd')});db[_0x1a56('0xdd')][_0x1a56('0x11e')](db['JscriptyQuestionReport'],{'foreignKey':_0x1a56('0x1ce'),'onDelete':_0x1a56('0x121')});db['JscriptySessionReport'][_0x1a56('0x11e')](db[_0x1a56('0xd9')],{'foreignKey':'SessionId','onDelete':_0x1a56('0x121')});db['SmsQueueReport'][_0x1a56('0x128')](db['SmsAccount'],{});db[_0x1a56('0x1cf')][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':'List','foreignKey':_0x1a56('0x175')});db[_0x1a56('0x1cf')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x1cf')][_0x1a56('0x128')](db[_0x1a56('0x57')],{});db['SmsQueueReport'][_0x1a56('0x128')](db[_0x1a56('0x59')],{});db[_0x1a56('0x1cf')]['belongsTo'](db[_0x1a56('0x12')],{});db[_0x1a56('0x1cf')][_0x1a56('0x128')](db[_0x1a56('0x5b')],{});db['JscriptyProject'][_0x1a56('0x11e')](db[_0x1a56('0xdd')],{'foreignKey':'ProjectId'});db[_0x1a56('0xe4')][_0x1a56('0x11e')](db[_0x1a56('0xdb')],{'foreignKey':'ProjectId'});db[_0x1a56('0xe4')][_0x1a56('0x11e')](db['JscriptyAnswerReport'],{'foreignKey':_0x1a56('0x1d0')});db[_0x1a56('0xe8')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':'Users','through':_0x1a56('0x14c')});db[_0x1a56('0xed')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':'user_has_teams'});db[_0x1a56('0xed')][_0x1a56('0x12a')](db[_0x1a56('0x1b')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0x1a56('0xed')][_0x1a56('0x12a')](db['MailQueue'],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x1a56('0xed')][_0x1a56('0x12a')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x1a56('0x13c')});db[_0x1a56('0xed')]['belongsToMany'](db['FaxQueue'],{'through':_0x1a56('0x189'),'as':_0x1a56('0x13d')});db[_0x1a56('0xed')][_0x1a56('0x12a')](db[_0x1a56('0x5b')],{'through':_0x1a56('0x1d1'),'as':'SmsQueues'});db['Team'][_0x1a56('0x12a')](db[_0x1a56('0x65')],{'through':_0x1a56('0x192'),'as':_0x1a56('0x1d2')});db[_0x1a56('0xed')]['belongsToMany'](db[_0x1a56('0x112')],{'through':_0x1a56('0x1d3'),'as':_0x1a56('0x1d4')});db[_0x1a56('0xed')]['belongsToMany'](db[_0x1a56('0x101')],{'through':'TeamVoicePrefix','as':_0x1a56('0x1d5')});db[_0x1a56('0xf0')][_0x1a56('0x11e')](db[_0x1a56('0x76')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x1a56('0xf0')][_0x1a56('0x11e')](db[_0x1a56('0x7a')],{'as':_0x1a56('0x157'),'foreignKey':_0x1a56('0x1a2')});db[_0x1a56('0xf0')][_0x1a56('0x11e')](db[_0x1a56('0x122')],{'as':_0x1a56('0x158'),'foreignKey':_0x1a56('0x1a2')});db[_0x1a56('0xf0')][_0x1a56('0x11e')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x1a56('0x1a2')});db[_0x1a56('0xf0')][_0x1a56('0x128')](db[_0x1a56('0x2b')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x1a56('0xf0')]['belongsTo'](db[_0x1a56('0x2b')],{'as':_0x1a56('0x1d6'),'foreignKey':'TrunkBackupId'});db[_0x1a56('0xf0')]['belongsTo'](db['Interval'],{'as':_0x1a56('0x15b'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0xf0')][_0x1a56('0x128')](db['SquareProject'],{'as':_0x1a56('0xe8'),'foreignKey':'SquareProjectId'});db[_0x1a56('0xf0')][_0x1a56('0x12a')](db[_0x1a56('0x100')],{'as':_0x1a56('0x12e'),'through':'campaigns_has_cm_lists'});db[_0x1a56('0xf0')][_0x1a56('0x12a')](db[_0x1a56('0x100')],{'as':_0x1a56('0x1d7'),'through':_0x1a56('0x1d8')});db['Attachment'][_0x1a56('0x128')](db[_0x1a56('0x6f')],{'as':_0x1a56('0x6f'),'foreignKey':_0x1a56('0x1d9')});db[_0x1a56('0xf7')][_0x1a56('0x128')](db['MailMessage'],{});db[_0x1a56('0xf7')]['belongsTo'](db[_0x1a56('0x3f')],{});db[_0x1a56('0xf7')][_0x1a56('0x128')](db['MailAccount'],{'foreignKey':_0x1a56('0x1da'),'as':_0x1a56('0x1db')});db['MailTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':'FromUserId','as':_0x1a56('0x1dc')});db[_0x1a56('0xf7')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1dd'),'as':_0x1a56('0x1de')});db[_0x1a56('0xf7')][_0x1a56('0x128')](db[_0x1a56('0x3d')],{'foreignKey':_0x1a56('0x1df'),'as':_0x1a56('0x1e0')});db[_0x1a56('0xf7')]['belongsTo'](db[_0x1a56('0x3b')],{'foreignKey':_0x1a56('0x1e1'),'as':_0x1a56('0x1e2')});db[_0x1a56('0xf9')][_0x1a56('0x128')](db[_0x1a56('0x6d')],{});db[_0x1a56('0xf9')]['belongsTo'](db['ChatInteraction'],{});db[_0x1a56('0xf9')][_0x1a56('0x128')](db[_0x1a56('0x66')],{'foreignKey':_0x1a56('0x1e3'),'as':_0x1a56('0x1db')});db[_0x1a56('0xf9')]['belongsTo'](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1e4'),'as':_0x1a56('0x1dc')});db[_0x1a56('0xf9')]['belongsTo'](db['User'],{'foreignKey':_0x1a56('0x1dd'),'as':_0x1a56('0x1de')});db[_0x1a56('0xf9')][_0x1a56('0x128')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x1a56('0x1e0')});db['ChatTransferReport']['belongsTo'](db[_0x1a56('0x66')],{'foreignKey':'ToChatWebsiteId','as':_0x1a56('0x1e2')});db[_0x1a56('0xfb')][_0x1a56('0x128')](db[_0x1a56('0x50')],{});db[_0x1a56('0xfb')][_0x1a56('0x128')](db['FaxInteraction'],{});db[_0x1a56('0xfb')][_0x1a56('0x128')](db['FaxAccount'],{'foreignKey':_0x1a56('0x1e5'),'as':'FromAccount'});db[_0x1a56('0xfb')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1e4'),'as':_0x1a56('0x1dc')});db[_0x1a56('0xfb')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1dd'),'as':_0x1a56('0x1de')});db['FaxTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x52')],{'foreignKey':_0x1a56('0x1e6'),'as':_0x1a56('0x1e0')});db['FaxTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x4a')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x63')],{});db[_0x1a56('0xfd')][_0x1a56('0x128')](db['OpenchannelInteraction'],{});db[_0x1a56('0xfd')][_0x1a56('0x128')](db[_0x1a56('0x5d')],{'foreignKey':'FromOpenchannelAccountId','as':_0x1a56('0x1db')});db[_0x1a56('0xfd')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1e4'),'as':_0x1a56('0x1dc')});db[_0x1a56('0xfd')][_0x1a56('0x128')](db['User'],{'foreignKey':_0x1a56('0x1dd'),'as':'ToAgent'});db['OpenchannelTransferReport']['belongsTo'](db[_0x1a56('0x65')],{'foreignKey':_0x1a56('0x1e7'),'as':_0x1a56('0x1e0')});db[_0x1a56('0xfd')][_0x1a56('0x128')](db[_0x1a56('0x5d')],{'foreignKey':_0x1a56('0x1e8'),'as':_0x1a56('0x1e2')});db[_0x1a56('0xff')][_0x1a56('0x128')](db[_0x1a56('0x59')],{});db['SmsTransferReport'][_0x1a56('0x128')](db['SmsInteraction'],{});db['SmsTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x146')],{'foreignKey':_0x1a56('0x1e9'),'as':_0x1a56('0x1db')});db[_0x1a56('0xff')]['belongsTo'](db[_0x1a56('0x12')],{'foreignKey':'FromUserId','as':_0x1a56('0x1dc')});db[_0x1a56('0xff')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1dd'),'as':_0x1a56('0x1de')});db[_0x1a56('0xff')]['belongsTo'](db[_0x1a56('0x5b')],{'foreignKey':_0x1a56('0x1ea'),'as':_0x1a56('0x1e0')});db[_0x1a56('0xff')][_0x1a56('0x128')](db[_0x1a56('0x146')],{'foreignKey':'ToSmsAccountId','as':_0x1a56('0x1e2')});db[_0x1a56('0x100')][_0x1a56('0x11e')](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':'ListId','onDelete':_0x1a56('0x121')});db[_0x1a56('0x100')]['hasMany'](db[_0x1a56('0x7f')],{'as':_0x1a56('0x1eb'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x100')][_0x1a56('0x11e')](db[_0x1a56('0x74')],{'as':_0x1a56('0x12c'),'onDelete':'cascade','foreignKey':_0x1a56('0x175')});db[_0x1a56('0x100')][_0x1a56('0x11e')](db[_0x1a56('0x7a')],{'as':_0x1a56('0x157'),'foreignKey':_0x1a56('0x175')});db['CmList']['hasMany'](db[_0x1a56('0x122')],{'as':_0x1a56('0x123'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x100')][_0x1a56('0x11e')](db[_0x1a56('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0x1a56('0x175')});db[_0x1a56('0x100')][_0x1a56('0x12a')](db[_0x1a56('0x1b')],{'as':'Queues','through':_0x1a56('0x15f')});db['CmList']['belongsToMany'](db[_0x1a56('0x12')],{'as':'Agents','through':'cm_user_has_lists'});db[_0x1a56('0x101')][_0x1a56('0x11e')](db[_0x1a56('0x18')],{'as':_0x1a56('0x120'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x101')][_0x1a56('0x12a')](db['User'],{'as':_0x1a56('0x160'),'through':_0x1a56('0x117')});db[_0x1a56('0x101')]['belongsToMany'](db['Team'],{'through':_0x1a56('0x1ec'),'as':_0x1a56('0x178')});db[_0x1a56('0x103')]['hasMany'](db[_0x1a56('0x12')],{'as':_0x1a56('0x187'),'foreignKey':_0x1a56('0x129')});db[_0x1a56('0x103')][_0x1a56('0x11e')](db[_0x1a56('0x104')],{'as':_0x1a56('0x1ed'),'foreignKey':_0x1a56('0x129'),'onDelete':_0x1a56('0x121')});db['UserProfileSection']['hasMany'](db[_0x1a56('0x105')],{'as':_0x1a56('0x1ee'),'foreignKey':_0x1a56('0x1ef'),'onDelete':_0x1a56('0x121')});db['WhatsappAccount'][_0x1a56('0x11e')](db['Disposition'],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x1f0'),'onDelete':'cascade'});db[_0x1a56('0x108')][_0x1a56('0x11e')](db['CannedAnswer'],{'as':_0x1a56('0x172'),'foreignKey':_0x1a56('0x1f0')});db[_0x1a56('0x108')][_0x1a56('0x11e')](db[_0x1a56('0x1f1')],{'as':'Messages','foreignKey':_0x1a56('0x1f0')});db['WhatsappAccount']['hasMany'](db['WhatsappInteraction'],{'as':_0x1a56('0x173')});db['WhatsappAccount'][_0x1a56('0x11e')](db['WhatsappApplication'],{'as':_0x1a56('0x150')});db['WhatsappAccount'][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x108')]['belongsTo'](db[_0x1a56('0x87')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x1a56('0x108')]['belongsToMany'](db[_0x1a56('0x12')],{'as':'Agents','through':_0x1a56('0x14a')});db[_0x1a56('0x10a')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x16b')});db['WhatsappApplication']['belongsTo'](db[_0x1a56('0x112')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x10a')][_0x1a56('0x128')](db[_0x1a56('0x108')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x10a')][_0x1a56('0x128')](db['Interval'],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x10a')][_0x1a56('0x128')](db['Tag'],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x181')});db[_0x1a56('0x10c')]['hasMany'](db[_0x1a56('0x1f1')],{'as':_0x1a56('0x162'),'onDelete':'cascade','foreignKey':_0x1a56('0x1f2')});db[_0x1a56('0x10c')][_0x1a56('0x128')](db[_0x1a56('0x108')],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db['WhatsappInteraction'][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x17a'),'foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x10c')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':'whatsapp_interaction_has_tags','as':_0x1a56('0x17c')});db[_0x1a56('0x10c')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0x1a56('0x10c')]['belongsToMany'](db[_0x1a56('0x12')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0x1a56('0x1f2')});db['WhatsappMessage'][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x12')});db[_0x1a56('0x1f1')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'onDelete':'cascade','as':_0x1a56('0x168')});db[_0x1a56('0x1f1')][_0x1a56('0x128')](db['WhatsappInteraction'],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x17f'),'foreignKey':'WhatsappInteractionId'});db[_0x1a56('0x1f1')][_0x1a56('0x128')](db[_0x1a56('0x108')],{'as':'Account','foreignKey':_0x1a56('0x1f0')});db['WhatsappQueueReport']['belongsTo'](db[_0x1a56('0x108')],{});db[_0x1a56('0x10e')][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x10e')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x10e')][_0x1a56('0x128')](db['WhatsappInteraction'],{});db[_0x1a56('0x10e')][_0x1a56('0x128')](db['WhatsappQueue'],{});db[_0x1a56('0x10e')]['belongsTo'](db[_0x1a56('0x1f1')],{});db[_0x1a56('0x10e')][_0x1a56('0x128')](db[_0x1a56('0x12')],{});db[_0x1a56('0x110')]['belongsTo'](db[_0x1a56('0x1f1')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x1a56('0x10c')],{});db[_0x1a56('0x110')]['belongsTo'](db[_0x1a56('0x108')],{'foreignKey':_0x1a56('0x1f3'),'as':_0x1a56('0x1db')});db[_0x1a56('0x110')]['belongsTo'](db[_0x1a56('0x108')],{'foreignKey':_0x1a56('0x1f4'),'as':_0x1a56('0x1e2')});db[_0x1a56('0x110')][_0x1a56('0x128')](db[_0x1a56('0x112')],{'foreignKey':_0x1a56('0x1f5'),'as':_0x1a56('0x1e0')});db[_0x1a56('0x110')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1e4'),'as':'FromAgent'});db['WhatsappTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1dd'),'as':_0x1a56('0x1de')});db[_0x1a56('0x112')]['belongsToMany'](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x36'),'foreignKey':_0x1a56('0x1f6')});db[_0x1a56('0x112')][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'through':_0x1a56('0x1d3'),'as':_0x1a56('0x178')});db[_0x1a56('0x119')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':_0x1a56('0x1f7'),'foreignKey':_0x1a56('0x11c'),'onDelete':'cascade','hooks':!![]});db[_0x1a56('0x113')][_0x1a56('0x11b')](db[_0x1a56('0xc7')],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0x1a56('0x113')][_0x1a56('0x11b')](db[_0x1a56('0x16a')],{'as':_0x1a56('0x16d'),'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x113')][_0x1a56('0x11b')](db['MailServerOut'],{'as':'Smtp','onDelete':'restrict'});module[_0x1a56('0x1f8')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 83bae8f..134ed1e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['./api/intZohoConfiguration','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','root','/www','static','/demo','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','./api/user','/api/voice/chanspy','./api/voiceChanSpy','use','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations'];(function(_0x51df47,_0x253c97){var _0x5f291d=function(_0xce9dae){while(--_0xce9dae){_0x51df47['push'](_0x51df47['shift']());}};_0x5f291d(++_0x253c97);}(_0x6aa7,0x178));var _0x76aa=function(_0x4d6914,_0x2b9953){_0x4d6914=_0x4d6914-0x0;var _0x5b2019=_0x6aa7[_0x4d6914];return _0x5b2019;};'use strict';var path=require(_0x76aa('0x0'));var express=require('express');var errors=require(_0x76aa('0x1'));var config=require(_0x76aa('0x2'));var setupLoggers=require(_0x76aa('0x3'))[_0x76aa('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0x76aa('0x5')]=function(_0xef15ef){return setupLoggers(_0xef15ef)[_0x76aa('0x6')](function(){_0xef15ef['use']('/api/users',require(_0x76aa('0x7')));_0xef15ef['use'](_0x76aa('0x8'),require(_0x76aa('0x9')));_0xef15ef[_0x76aa('0xa')]('/api/voice/contexts',require(_0x76aa('0xb')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xc'),require('./api/voiceExtension'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xd'),require(_0x76aa('0xe')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf'),require(_0x76aa('0x10')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x11'),require(_0x76aa('0x12')));_0xef15ef[_0x76aa('0xa')]('/api/screen/recordings',require(_0x76aa('0x13')));_0xef15ef['use'](_0x76aa('0x14'),require(_0x76aa('0x15')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x16'),require(_0x76aa('0x17')));_0xef15ef['use']('/api/voice/calls/reports',require(_0x76aa('0x18')));_0xef15ef['use'](_0x76aa('0x19'),require(_0x76aa('0x1a')));_0xef15ef['use'](_0x76aa('0x1b'),require('./api/voiceAgentReport'));_0xef15ef[_0x76aa('0xa')]('/api/voice/queues/reports',require(_0x76aa('0x1c')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x1d'),require(_0x76aa('0x1e')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x1f'),require('./api/trunk'));_0xef15ef['use'](_0x76aa('0x20'),require(_0x76aa('0x21')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x22'),require(_0x76aa('0x23')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x24'),require(_0x76aa('0x25')));_0xef15ef[_0x76aa('0xa')]('/api/mail/queues',require(_0x76aa('0x26')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x27'),require('./api/mailSubstatus'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x28'),require(_0x76aa('0x29')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x2a'),require(_0x76aa('0x2b')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x2c'),require(_0x76aa('0x2d')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x2e'),require(_0x76aa('0x2f')));_0xef15ef[_0x76aa('0xa')]('/api/dashboards',require(_0x76aa('0x30')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x31'),require(_0x76aa('0x32')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x33'),require(_0x76aa('0x34')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x35'),require(_0x76aa('0x36')));_0xef15ef['use'](_0x76aa('0x37'),require('./api/faxInteraction'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x38'),require(_0x76aa('0x39')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x3a'),require(_0x76aa('0x3b')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x3c'),require(_0x76aa('0x3d')));_0xef15ef[_0x76aa('0xa')]('/api/sms/accounts',require(_0x76aa('0x3e')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x3f'),require(_0x76aa('0x40')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x41'),require(_0x76aa('0x42')));_0xef15ef['use'](_0x76aa('0x43'),require(_0x76aa('0x44')));_0xef15ef['use'](_0x76aa('0x45'),require('./api/smsQueue'));_0xef15ef[_0x76aa('0xa')]('/api/openchannel/accounts',require(_0x76aa('0x46')));_0xef15ef['use']('/api/openchannel/applications',require(_0x76aa('0x47')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x48'),require(_0x76aa('0x49')));_0xef15ef['use']('/api/openchannel/messages',require(_0x76aa('0x4a')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x4b'),require(_0x76aa('0x4c')));_0xef15ef[_0x76aa('0xa')]('/api/chat/websites',require(_0x76aa('0x4d')));_0xef15ef['use']('/api/openchannel/reports/queue',require(_0x76aa('0x4e')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x4f'),require(_0x76aa('0x50')));_0xef15ef['use'](_0x76aa('0x51'),require(_0x76aa('0x52')));_0xef15ef[_0x76aa('0xa')]('/api/chat/messages',require(_0x76aa('0x53')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x54'),require(_0x76aa('0x55')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x56'),require(_0x76aa('0x57')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x58'),require('./api/chatGroup'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x59'),require(_0x76aa('0x5a')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x5b'),require(_0x76aa('0x5c')));_0xef15ef['use']('/api/cm/contacts',require(_0x76aa('0x5d')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x5e'),require(_0x76aa('0x5f')));_0xef15ef['use'](_0x76aa('0x60'),require(_0x76aa('0x61')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x62'),require(_0x76aa('0x63')));_0xef15ef['use'](_0x76aa('0x64'),require('./api/cmHopperHistory'));_0xef15ef[_0x76aa('0xa')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0xef15ef['use'](_0x76aa('0x65'),require('./api/action'));_0xef15ef['use']('/api/automations',require(_0x76aa('0x66')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x67'),require(_0x76aa('0x68')));_0xef15ef[_0x76aa('0xa')]('/api/dispositions',require(_0x76aa('0x69')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x6a'),require(_0x76aa('0x6b')));_0xef15ef[_0x76aa('0xa')]('/api/intervals',require(_0x76aa('0x6c')));_0xef15ef[_0x76aa('0xa')]('/api/pauses',require(_0x76aa('0x6d')));_0xef15ef['use'](_0x76aa('0x6e'),require(_0x76aa('0x6f')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x70'),require(_0x76aa('0x71')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x72'),require(_0x76aa('0x73')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x74'),require('./api/sound'));_0xef15ef[_0x76aa('0xa')]('/api/tags',require(_0x76aa('0x75')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x76'),require(_0x76aa('0x77')));_0xef15ef['use']('/api/triggers',require(_0x76aa('0x78')));_0xef15ef['use'](_0x76aa('0x79'),require(_0x76aa('0x7a')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x7b'),require(_0x76aa('0x7c')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/reports',require('./api/integrationReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x7d'),require(_0x76aa('0x7e')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x7f'),require(_0x76aa('0x80')));_0xef15ef['use'](_0x76aa('0x81'),require(_0x76aa('0x82')));_0xef15ef[_0x76aa('0xa')]('/api/analytics/metrics',require(_0x76aa('0x83')));_0xef15ef['use'](_0x76aa('0x84'),require('./api/analyticFieldReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x85'),require(_0x76aa('0x86')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x87'),require(_0x76aa('0x88')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/salesforce/configurations',require(_0x76aa('0x89')));_0xef15ef['use'](_0x76aa('0x8a'),require(_0x76aa('0x8b')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x8c'),require(_0x76aa('0x8d')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x8e'),require('./api/intSugarcrmConfiguration'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x8f'),require(_0x76aa('0x90')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/desk/accounts',require(_0x76aa('0x91')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x92'),require(_0x76aa('0x93')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x94'),require('./api/intDeskField'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x95'),require(_0x76aa('0x96')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x97'),require(_0x76aa('0x98')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x99'),require('./api/intZendeskAccount'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x9a'),require('./api/intZendeskConfiguration'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x9b'),require(_0x76aa('0x9c')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x9d'),require(_0x76aa('0x9e')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x9f'),require(_0x76aa('0xa0')));_0xef15ef['use'](_0x76aa('0xa1'),require('./api/intFreshdeskField'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xa2'),require(_0x76aa('0xa3')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xa4'),require(_0x76aa('0xa5')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xa6'),require(_0x76aa('0xa7')));_0xef15ef['use'](_0x76aa('0xa8'),require(_0x76aa('0xa9')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xaa'),require(_0x76aa('0xab')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xac'),require(_0x76aa('0xad')));_0xef15ef['use'](_0x76aa('0xae'),require('./api/intDynamics365Account'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xaf'),require(_0x76aa('0xb0')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xb1'),require(_0x76aa('0xb2')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/freshsales/accounts',require(_0x76aa('0xb3')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xb4'),require('./api/intFreshsalesField'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xb5'),require(_0x76aa('0xb6')));_0xef15ef['use'](_0x76aa('0xb7'),require('./api/chatQueueReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xb8'),require(_0x76aa('0xb9')));_0xef15ef[_0x76aa('0xa')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0xef15ef[_0x76aa('0xa')]('/api/jscripty/questions/reports',require(_0x76aa('0xba')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xbb'),require(_0x76aa('0xbc')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xbd'),require(_0x76aa('0xbe')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xbf'),require('./api/squareReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xc0'),require(_0x76aa('0xc1')));_0xef15ef[_0x76aa('0xa')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0xef15ef['use'](_0x76aa('0xc2'),require('./api/setting'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xc3'),require(_0x76aa('0xc4')));_0xef15ef[_0x76aa('0xa')]('/api/square/projects',require(_0x76aa('0xc5')));_0xef15ef['use'](_0x76aa('0xc6'),require(_0x76aa('0xc7')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xc8'),require(_0x76aa('0xc9')));_0xef15ef['use'](_0x76aa('0xca'),require(_0x76aa('0xcb')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xcc'),require(_0x76aa('0xcd')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xce'),require(_0x76aa('0xcf')));_0xef15ef['use'](_0x76aa('0xd0'),require(_0x76aa('0xd1')));_0xef15ef['use'](_0x76aa('0xd2'),require(_0x76aa('0xd3')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xd4'),require(_0x76aa('0xd5')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xd6'),require('./api/mailTransferReport'));_0xef15ef[_0x76aa('0xa')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xd7'),require('./api/faxTransferReport'));_0xef15ef['use'](_0x76aa('0xd8'),require(_0x76aa('0xd9')));_0xef15ef[_0x76aa('0xa')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xda'),require(_0x76aa('0xdb')));_0xef15ef['use'](_0x76aa('0xdc'),require('./api/voicePrefix'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xdd'),require(_0x76aa('0xde')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xdf'),require('./api/userProfileSection'));_0xef15ef['use'](_0x76aa('0xe0'),require(_0x76aa('0xe1')));_0xef15ef[_0x76aa('0xa')]('/api/userNotifications',require(_0x76aa('0xe2')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xe3'),require(_0x76aa('0xe4')));_0xef15ef[_0x76aa('0xa')]('/api/whatsapp/applications',require(_0x76aa('0xe5')));_0xef15ef['use'](_0x76aa('0xe6'),require(_0x76aa('0xe7')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xe8'),require(_0x76aa('0xe9')));_0xef15ef[_0x76aa('0xa')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0xef15ef['use']('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xea'),require('./api/whatsappQueue'));_0xef15ef['use']('/api/cloudProviders',require(_0x76aa('0xeb')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xec'),require('./api/realtime'));_0xef15ef['use'](_0x76aa('0xed'),require(_0x76aa('0xee')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xef'),require(_0x76aa('0xf0')));_0xef15ef['use']('/api/auth/google',require(_0x76aa('0xf1')));_0xef15ef['use']('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf2'),require('./api/jira'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf3'),require('./api/rpc'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf4'),require(_0x76aa('0xf5')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf6'),require(_0x76aa('0xf7')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf8'),require(_0x76aa('0xf9')));_0xef15ef['use'](_0x76aa('0xfa'),require(_0x76aa('0xfb')));_0xef15ef['use'](_0x76aa('0xfc'),clientSideLogs);_0xef15ef[_0x76aa('0xa')](_0x76aa('0xfd'),express['static'](path[_0x76aa('0xfe')](config[_0x76aa('0xff')],'/apidoc')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x100'),express[_0x76aa('0x101')](path['join'](config[_0x76aa('0xff')],_0x76aa('0x100'))));_0xef15ef['use']('/demo',express['static'](path[_0x76aa('0xfe')](config[_0x76aa('0xff')],_0x76aa('0x102'))));_0xef15ef[_0x76aa('0xa')]('/snippet',express['static'](path['join'](config[_0x76aa('0xff')],'snippet',_0x76aa('0x103'))));_0xef15ef[_0x76aa('0xa')]('/plugins',express[_0x76aa('0x101')](path[_0x76aa('0xfe')](config['root'],_0x76aa('0x104'))));_0xef15ef[_0x76aa('0x105')](_0x76aa('0x106'))[_0x76aa('0x107')](errors[0x194]);_0xef15ef[_0x76aa('0x105')]('/*')[_0x76aa('0x107')](function(_0x4aee18,_0x37d4f6){_0x37d4f6['sendFile'](path['resolve'](_0xef15ef['get']('appPath')+'/index.html'));});return _0xef15ef;});}; \ No newline at end of file +var _0xed1f=['./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceQueue','/api/screen/recordings','/api/voice/mails/messages','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts'];(function(_0x4c1176,_0xf999e9){var _0x2aca97=function(_0xb3cb82){while(--_0xb3cb82){_0x4c1176['push'](_0x4c1176['shift']());}};_0x2aca97(++_0xf999e9);}(_0xed1f,0x6a));var _0xfed1=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xed1f[_0x25e7cb];return _0x375d92;};'use strict';var path=require(_0xfed1('0x0'));var express=require(_0xfed1('0x1'));var errors=require(_0xfed1('0x2'));var config=require(_0xfed1('0x3'));var setupLoggers=require(_0xfed1('0x4'))[_0xfed1('0x5')];var clientSideLogs=require(_0xfed1('0x6'));exports[_0xfed1('0x7')]=function(_0x2209b3){return setupLoggers(_0x2209b3)[_0xfed1('0x8')](function(){_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa'),require(_0xfed1('0xb')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xc'),require(_0xfed1('0xd')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe'),require('./api/voiceContext'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xf'),require('./api/voiceExtension'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x10'),require('./api/voiceMusicOnHold'));_0x2209b3[_0xfed1('0x9')]('/api/voice/queues',require(_0xfed1('0x11')));_0x2209b3[_0xfed1('0x9')]('/api/voice/recordings',require('./api/voiceRecording'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x12'),require('./api/screenRecording'));_0x2209b3[_0xfed1('0x9')]('/api/voice/mails',require('./api/voiceMail'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x13'),require('./api/voiceMailMessage'));_0x2209b3[_0xfed1('0x9')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x14'),require(_0xfed1('0x15')));_0x2209b3[_0xfed1('0x9')]('/api/voice/agents/reports',require(_0xfed1('0x16')));_0x2209b3['use'](_0xfed1('0x17'),require(_0xfed1('0x18')));_0x2209b3['use'](_0xfed1('0x19'),require(_0xfed1('0x1a')));_0x2209b3['use']('/api/trunks',require('./api/trunk'));_0x2209b3[_0xfed1('0x9')]('/api/voice/transfers/reports',require(_0xfed1('0x1b')));_0x2209b3[_0xfed1('0x9')]('/api/mail/out_servers',require(_0xfed1('0x1c')));_0x2209b3[_0xfed1('0x9')]('/api/mail/accounts',require(_0xfed1('0x1d')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x1e'),require(_0xfed1('0x1f')));_0x2209b3['use'](_0xfed1('0x20'),require('./api/mailSubstatus'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x21'),require(_0xfed1('0x22')));_0x2209b3['use'](_0xfed1('0x23'),require('./api/mailMessage'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x24'),require(_0xfed1('0x25')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x26'),require(_0xfed1('0x27')));_0x2209b3['use'](_0xfed1('0x28'),require(_0xfed1('0x29')));_0x2209b3['use'](_0xfed1('0x2a'),require(_0xfed1('0x2b')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x2c'),require(_0xfed1('0x2d')));_0x2209b3[_0xfed1('0x9')]('/api/fax/applications',require(_0xfed1('0x2e')));_0x2209b3['use'](_0xfed1('0x2f'),require('./api/faxInteraction'));_0x2209b3['use'](_0xfed1('0x30'),require(_0xfed1('0x31')));_0x2209b3[_0xfed1('0x9')]('/api/fax/queues',require(_0xfed1('0x32')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x33'),require(_0xfed1('0x34')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x35'),require('./api/smsAccount'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x36'),require('./api/smsApplication'));_0x2209b3['use'](_0xfed1('0x37'),require(_0xfed1('0x38')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x39'),require(_0xfed1('0x3a')));_0x2209b3['use'](_0xfed1('0x3b'),require(_0xfed1('0x3c')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x3d'),require(_0xfed1('0x3e')));_0x2209b3['use'](_0xfed1('0x3f'),require('./api/openchannelApplication'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x40'),require(_0xfed1('0x41')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x42'),require(_0xfed1('0x43')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x44'),require('./api/openchannelQueue'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x45'),require(_0xfed1('0x46')));_0x2209b3[_0xfed1('0x9')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x47'),require(_0xfed1('0x48')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x49'),require(_0xfed1('0x4a')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x4b'),require('./api/chatMessage'));_0x2209b3['use'](_0xfed1('0x4c'),require(_0xfed1('0x4d')));_0x2209b3['use'](_0xfed1('0x4e'),require(_0xfed1('0x4f')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x50'),require(_0xfed1('0x51')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x52'),require(_0xfed1('0x53')));_0x2209b3[_0xfed1('0x9')]('/api/cm/companies',require('./api/cmCompany'));_0x2209b3['use'](_0xfed1('0x54'),require(_0xfed1('0x55')));_0x2209b3[_0xfed1('0x9')]('/api/cm/hopper',require(_0xfed1('0x56')));_0x2209b3['use'](_0xfed1('0x57'),require(_0xfed1('0x58')));_0x2209b3[_0xfed1('0x9')]('/api/cm/hopper_final',require(_0xfed1('0x59')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x5a'),require('./api/cmHopperHistory'));_0x2209b3[_0xfed1('0x9')]('/api/cm/custom_fields',require(_0xfed1('0x5b')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x5c'),require(_0xfed1('0x5d')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x5e'),require(_0xfed1('0x5f')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x60'),require('./api/cannedAnswer'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x61'),require(_0xfed1('0x62')));_0x2209b3['use']('/api/conditions',require(_0xfed1('0x63')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x64'),require(_0xfed1('0x65')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x66'),require(_0xfed1('0x67')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x68'),require(_0xfed1('0x69')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x6a'),require('./api/voiceQueuesLog'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x6b'),require(_0xfed1('0x6c')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x6d'),require(_0xfed1('0x6e')));_0x2209b3['use'](_0xfed1('0x6f'),require(_0xfed1('0x70')));_0x2209b3[_0xfed1('0x9')]('/api/templates',require(_0xfed1('0x71')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x72'),require(_0xfed1('0x73')));_0x2209b3['use'](_0xfed1('0x74'),require(_0xfed1('0x75')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x76'),require(_0xfed1('0x77')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x78'),require(_0xfed1('0x79')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x7a'),require(_0xfed1('0x7b')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x7c'),require(_0xfed1('0x7d')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x7e'),require(_0xfed1('0x7f')));_0x2209b3[_0xfed1('0x9')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x80'),require(_0xfed1('0x81')));_0x2209b3[_0xfed1('0x9')]('/api/analytics/tree_reports',require(_0xfed1('0x82')));_0x2209b3[_0xfed1('0x9')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x2209b3['use'](_0xfed1('0x83'),require(_0xfed1('0x84')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x85'),require(_0xfed1('0x86')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x87'),require(_0xfed1('0x88')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x89'),require('./api/intSugarcrmConfiguration'));_0x2209b3['use'](_0xfed1('0x8a'),require(_0xfed1('0x8b')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x8c'),require(_0xfed1('0x8d')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x8e'),require(_0xfed1('0x8f')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x90'),require(_0xfed1('0x91')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x92'),require(_0xfed1('0x93')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x94'),require(_0xfed1('0x95')));_0x2209b3['use']('/api/integrations/zoho/fields',require(_0xfed1('0x96')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x97'),require(_0xfed1('0x98')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x99'),require(_0xfed1('0x9a')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x9b'),require(_0xfed1('0x9c')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x9d'),require(_0xfed1('0x9e')));_0x2209b3[_0xfed1('0x9')]('/api/integrations/freshdesk/configurations',require(_0xfed1('0x9f')));_0x2209b3['use']('/api/integrations/freshdesk/fields',require(_0xfed1('0xa0')));_0x2209b3['use'](_0xfed1('0xa1'),require('./api/intVtigerAccount'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa2'),require('./api/intVtigerConfiguration'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa3'),require('./api/intVtigerField'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa4'),require(_0xfed1('0xa5')));_0x2209b3[_0xfed1('0x9')]('/api/integrations/servicenow/configurations',require(_0xfed1('0xa6')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa7'),require(_0xfed1('0xa8')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa9'),require(_0xfed1('0xaa')));_0x2209b3[_0xfed1('0x9')]('/api/integrations/dynamics365/configurations',require(_0xfed1('0xab')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xac'),require(_0xfed1('0xad')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xae'),require('./api/intFreshsalesAccount'));_0x2209b3['use']('/api/integrations/freshsales/configurations',require(_0xfed1('0xaf')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xb0'),require(_0xfed1('0xb1')));_0x2209b3['use'](_0xfed1('0xb2'),require('./api/network'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xb3'),require(_0xfed1('0xb4')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xb5'),require('./api/chatInternalMessage'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xb6'),require(_0xfed1('0xb7')));_0x2209b3['use'](_0xfed1('0xb8'),require(_0xfed1('0xb9')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xba'),require('./api/jscriptySessionReport'));_0x2209b3[_0xfed1('0x9')]('/api/sms/reports/queue',require(_0xfed1('0xbb')));_0x2209b3[_0xfed1('0x9')]('/api/square/reports',require('./api/squareReport'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xbc'),require(_0xfed1('0xbd')));_0x2209b3[_0xfed1('0x9')]('/api/jscripty/projects',require(_0xfed1('0xbe')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xbf'),require(_0xfed1('0xc0')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xc1'),require('./api/squareOdbc'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xc2'),require('./api/squareProject'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xc3'),require(_0xfed1('0xc4')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xc5'),require(_0xfed1('0xc6')));_0x2209b3['use']('/api/teams',require(_0xfed1('0xc7')));_0x2209b3['use'](_0xfed1('0xc8'),require(_0xfed1('0xc9')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xca'),require(_0xfed1('0xcb')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xcc'),require(_0xfed1('0xcd')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xce'),require('./api/attachment'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xcf'),require('./api/plugin'));_0x2209b3['use'](_0xfed1('0xd0'),require('./api/mailTransferReport'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xd1'),require(_0xfed1('0xd2')));_0x2209b3['use'](_0xfed1('0xd3'),require(_0xfed1('0xd4')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xd5'),require(_0xfed1('0xd6')));_0x2209b3['use'](_0xfed1('0xd7'),require(_0xfed1('0xd8')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xd9'),require(_0xfed1('0xda')));_0x2209b3['use'](_0xfed1('0xdb'),require(_0xfed1('0xdc')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xdd'),require(_0xfed1('0xde')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xdf'),require(_0xfed1('0xe0')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe1'),require('./api/userProfileResource'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe2'),require(_0xfed1('0xe3')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe4'),require('./api/whatsappAccount'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe5'),require(_0xfed1('0xe6')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe7'),require(_0xfed1('0xe8')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe9'),require(_0xfed1('0xea')));_0x2209b3['use']('/api/whatsapp/reports/queue',require(_0xfed1('0xeb')));_0x2209b3['use'](_0xfed1('0xec'),require(_0xfed1('0xed')));_0x2209b3[_0xfed1('0x9')]('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x2209b3[_0xfed1('0x9')]('/api/cloudProviders',require(_0xfed1('0xee')));_0x2209b3['use'](_0xfed1('0xef'),require(_0xfed1('0xf0')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xf1'),require(_0xfed1('0xf2')));_0x2209b3['use'](_0xfed1('0xf3'),require(_0xfed1('0xf4')));_0x2209b3['use'](_0xfed1('0xf5'),require(_0xfed1('0xf6')));_0x2209b3['use'](_0xfed1('0xf7'),require(_0xfed1('0xf8')));_0x2209b3[_0xfed1('0x9')]('/api/jira',require(_0xfed1('0xf9')));_0x2209b3[_0xfed1('0x9')]('/api/rpc',require(_0xfed1('0xfa')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xfb'),require('./api/version'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xfc'),require('./api/system'));_0x2209b3['use'](_0xfed1('0xfd'),require(_0xfed1('0xfe')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xff'),require(_0xfed1('0x100')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x101'),clientSideLogs);_0x2209b3[_0xfed1('0x9')](_0xfed1('0x102'),express[_0xfed1('0x103')](path[_0xfed1('0x104')](config[_0xfed1('0x105')],'/apidoc')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x106'),express['static'](path[_0xfed1('0x104')](config[_0xfed1('0x105')],'/www')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x107'),express[_0xfed1('0x103')](path[_0xfed1('0x104')](config['root'],_0xfed1('0x107'))));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x108'),express[_0xfed1('0x103')](path[_0xfed1('0x104')](config[_0xfed1('0x105')],_0xfed1('0x109'),_0xfed1('0x10a'))));_0x2209b3['use'](_0xfed1('0x10b'),express[_0xfed1('0x103')](path[_0xfed1('0x104')](config['root'],_0xfed1('0x10c'))));_0x2209b3[_0xfed1('0x10d')](_0xfed1('0x10e'))['get'](errors[0x194]);_0x2209b3['route']('/*')[_0xfed1('0x10f')](function(_0x45a0fc,_0x37723b){_0x37723b[_0xfed1('0x110')](path[_0xfed1('0x111')](_0x2209b3[_0xfed1('0x10f')](_0xfed1('0x112'))+_0xfed1('0x113')));});return _0x2209b3;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index fe2134c..f1bc9e4 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3cbc=['lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise'];(function(_0x33784d,_0x5e1591){var _0x494463=function(_0x2f391a){while(--_0x2f391a){_0x33784d['push'](_0x33784d['shift']());}};_0x494463(++_0x5e1591);}(_0x3cbc,0xc2));var _0xc3cb=function(_0x3da090,_0x52630c){_0x3da090=_0x3da090-0x0;var _0xf04cef=_0x3cbc[_0x3da090];return _0xf04cef;};'use strict';var jayson=require(_0xc3cb('0x0'));var _=require(_0xc3cb('0x1'));var config=require(_0xc3cb('0x2'));exports[_0xc3cb('0x3')]=function(){return new Promise(function(_0x4fe6e7,_0x5d44ee){var _0x482825={};_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x5')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x6')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/voiceQueue/voiceQueue.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x7')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x8')));_0x482825=_['merge'](_0x482825,require(_0xc3cb('0x9')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0xa')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0xb')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0xc')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0xd')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/mailServerIn/mailServerIn.rpc'));_0x482825=_['merge'](_0x482825,require(_0xc3cb('0xe')));_0x482825=_['merge'](_0x482825,require(_0xc3cb('0xf')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x10')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x11')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x12')));_0x482825=_['merge'](_0x482825,require(_0xc3cb('0x13')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/faxAccount/faxAccount.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/faxApplication/faxApplication.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x14')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x15')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x16')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x17')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x18')));_0x482825=_['merge'](_0x482825,require(_0xc3cb('0x19')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x1a')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x1b')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x1c')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x1d')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x482825=_['merge'](_0x482825,require(_0xc3cb('0x1e')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/chatInteraction/chatInteraction.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/chatMessage/chatMessage.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/chatQueue/chatQueue.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x1f')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x20')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x21')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x22')));_0x482825=_['merge'](_0x482825,require(_0xc3cb('0x23')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x24')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x25')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x26')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x27')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x28')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x29')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x2a')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x2b')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x2c')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x2d')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x482825=_['merge'](_0x482825,require(_0xc3cb('0x2e')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x2f')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x482825=_['merge'](_0x482825,require(_0xc3cb('0x30')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x31')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x32')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x33')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x34')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/setting/setting.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/squareOdbc/squareOdbc.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x35')));_0x482825=_['merge'](_0x482825,require('../api/squareRecording/squareRecording.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x36')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x37')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/attachment/attachment.rpc'));_0x482825=_['merge'](_0x482825,require('../api/plugin/plugin.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require(_0xc3cb('0x38')));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x482825=_[_0xc3cb('0x4')](_0x482825,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x482825=_['merge'](_0x482825,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x482825=_['merge'](_0x482825,require(_0xc3cb('0x39')));var _0x99f7d2=jayson['server'](_0x482825)[_0xc3cb('0x3a')]();var _0x5e27ab=config[_0xc3cb('0x3b')]['port']||config[_0xc3cb('0x3c')]+0x1;var _0xeb522a=config['rpc']['ip']||'localhost';_0x99f7d2['on'](_0xc3cb('0x3d'),function(_0x3aac13){return _0x5d44ee(_0x3aac13);});_0x99f7d2[_0xc3cb('0x3')](_0x5e27ab,_0xeb522a,function(){console['log'](_0xc3cb('0x3e'),_0xeb522a,_0x5e27ab);require('../config/triggers')[_0xc3cb('0x3f')]();return _0x4fe6e7(_0xc3cb('0x40')+_0xeb522a+':'+_0x5e27ab);});});}; \ No newline at end of file +var _0xb631=['../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc'];(function(_0xf1a005,_0x361fee){var _0x5313f6=function(_0x3753f8){while(--_0x3753f8){_0xf1a005['push'](_0xf1a005['shift']());}};_0x5313f6(++_0x361fee);}(_0xb631,0xcc));var _0x1b63=function(_0x3cfed3,_0x4c88c1){_0x3cfed3=_0x3cfed3-0x0;var _0x13ef6b=_0xb631[_0x3cfed3];return _0x13ef6b;};'use strict';var jayson=require(_0x1b63('0x0'));var _=require(_0x1b63('0x1'));var config=require(_0x1b63('0x2'));exports[_0x1b63('0x3')]=function(){return new Promise(function(_0xd1df5c,_0x1e7c63){var _0x1440c4={};_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x5')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/voiceExtension/voiceExtension.rpc'));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x6')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x7')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x8')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x9')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0xa')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0xb')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0xc')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0xd')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0xe')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0xf')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x10')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x11')));_0x1440c4=_['merge'](_0x1440c4,require('../api/mailInteraction/mailInteraction.rpc'));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x12')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x13')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x14')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x15')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/faxApplication/faxApplication.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x16')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/faxMessage/faxMessage.rpc'));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x17')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x18')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x19')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x1a')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x1b')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x1c')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x1d')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x1e')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x1f')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x20')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x21')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x22')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x23')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x24')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x25')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x26')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x27')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x28')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x29')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x2a')));_0x1440c4=_['merge'](_0x1440c4,require('../api/interval/interval.rpc'));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x2b')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x2c')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/template/template.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x2d')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x2e')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x2f')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x30')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x31')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x32')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x33')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x34')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x35')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x36')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x37')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x38')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x39')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x3a')));_0x1440c4=_['merge'](_0x1440c4,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x3b')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/squareOdbc/squareOdbc.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x3c')));_0x1440c4=_['merge'](_0x1440c4,require('../api/squareRecording/squareRecording.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/squareMessage/squareMessage.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/campaign/campaign.rpc'));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x3d')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x3e')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x3f')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x40')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x41')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x42')));var _0x556585=jayson[_0x1b63('0x43')](_0x1440c4)[_0x1b63('0x44')]();var _0x387e52=config[_0x1b63('0x45')][_0x1b63('0x46')]||config['port']+0x1;var _0x352024=config[_0x1b63('0x45')]['ip']||'localhost';_0x556585['on'](_0x1b63('0x47'),function(_0x1da6b7){return _0x1e7c63(_0x1da6b7);});_0x556585[_0x1b63('0x3')](_0x387e52,_0x352024,function(){console[_0x1b63('0x48')](_0x1b63('0x49'),_0x352024,_0x387e52);require(_0x1b63('0x4a'))[_0x1b63('0x4b')]();return _0xd1df5c('RPC\x20listening\x20on\x20'+_0x352024+':'+_0x387e52);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index ebf106b..bf7059f 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d8d=['extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','./reply','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sync','answer','ANSWER','sendRequest','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x7d8d,0x134));var _0xd7d8=function(_0x42aa3b,_0x5c8e43){_0x42aa3b=_0x42aa3b-0x0;var _0x1e0bf=_0x7d8d[_0x42aa3b];return _0x1e0bf;};'use strict';var util=require(_0xd7d8('0x0'));var _=require(_0xd7d8('0x1'));var EventEmitter=require(_0xd7d8('0x2'))['EventEmitter'];var AGIReply=require(_0xd7d8('0x3'));var AGIError=require('./error');function AGIChannel(_0xe1963a){var _0x12de2f=this,_0xb37a2b=new AGIReply(),_0x443200=![],_0x4a2da3={};EventEmitter[_0xd7d8('0x4')](_0x12de2f);_0xe1963a[_0xd7d8('0x5')](_0xd7d8('0x6'));_0xe1963a[_0xd7d8('0x7')](0x8*0x3c*0x3c*0x3e8);_0xb37a2b[_0xd7d8('0x5')](_0xd7d8('0x6'));_0xb37a2b['on'](_0xd7d8('0x8'),function(_0x3cf43f){for(var _0x465552 in _0x3cf43f){_0x12de2f[_0x465552]=_0x3cf43f[_0x465552];}_0x12de2f[_0xd7d8('0x9')]('ready');});_0xb37a2b['on'](_0xd7d8('0xa'),function(_0x5b6429){if(_0x5b6429[_0xd7d8('0xb')]()==_0xd7d8('0xc')){_0x12de2f[_0xd7d8('0x9')](_0xd7d8('0xc'));return;}if(_0x5b6429[_0xd7d8('0xd')](0x0,0xb)==_0xd7d8('0xe')){_0x443200=!![];}if(_0x443200){_0x4a2da3['rx']+=_0x5b6429+'\x0a';if(_0x5b6429['search']('520\x20End\x20of\x20proper')!=-0x1){_0x443200=![];}}else{_0x4a2da3['rx']=_0x5b6429;}if(_0x443200){return;}if(typeof _0x4a2da3['cb']==_0xd7d8('0xf')){var _0x387b07=_0x4a2da3['rx'][_0xd7d8('0xd')](0x0,0x3),_0x2daa02=null,_0x35e404=null;_0x387b07=parseInt(_0x387b07);if(isNaN(_0x387b07)){_0x4a2da3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xd7d8('0x10')});return;}if(_0x387b07!=0xc8){_0x4a2da3['cb'](null,{'code':_0x387b07,'result':-0x1,'extra':'KO'});return;}_0x2daa02=_0x4a2da3['rx']['substring'](0x4)[_0xd7d8('0x11')](_0xd7d8('0x12'),'');if(_0x2daa02[_0xd7d8('0x13')]('\x20')!=-0x1){_0x2daa02=_0x2daa02[_0xd7d8('0x14')](0x0,_0x2daa02[_0xd7d8('0x13')]('\x20'));}if(_[_0xd7d8('0x15')](_0x2daa02,'-1')){_0x2daa02=parseInt(_0x2daa02);}_0x35e404=_0x4a2da3['rx'][_0xd7d8('0x16')]('\x20');if(_0x35e404[_0xd7d8('0x17')]==0x3){_0x35e404=_0x35e404[0x2][_0xd7d8('0xd')](0x1,_0x35e404[0x2][_0xd7d8('0x17')]-0x1);}else if(_0x35e404[_0xd7d8('0x17')]>0x3){var _0x1ebee7=/\((.+)\)/;var _0x2f8edf=_0x4a2da3['rx'][_0xd7d8('0x18')](_0x1ebee7);if(_0x2f8edf){_0x35e404=_0x2f8edf[0x1];}else{_0x35e404=null;}}else{_0x35e404=null;}_0x4a2da3['cb'](null,{'code':_0x387b07,'result':_0x2daa02,'extra':_0x35e404});}});_0xe1963a['on'](_0xd7d8('0x19'),function(_0x48b68c){_0x12de2f[_0xd7d8('0x9')](_0xd7d8('0x19'),new AGIError('E_AGI_SOCKET_ERROR',_0x48b68c[_0xd7d8('0x1a')]));});_0xe1963a['on'](_0xd7d8('0x1b'),function(){_0x12de2f[_0xd7d8('0x9')](_0xd7d8('0x1b'),new AGIError(_0xd7d8('0x1c')));});_0xe1963a['on'](_0xd7d8('0x1d'),function(){_0x12de2f[_0xd7d8('0x9')](_0xd7d8('0x1d'),new AGIError(_0xd7d8('0x1e')));_0xe1963a[_0xd7d8('0x1f')]();});_0xe1963a[_0xd7d8('0x20')](_0xb37a2b);this[_0xd7d8('0x21')]=function(_0x135e3e,_0x2e77ae){var _0x135e3e=_0x135e3e||'',_0x2e77ae=typeof _0x2e77ae==_0xd7d8('0xf')?_0x2e77ae:new Function();_0x4a2da3={'tx':_0x135e3e,'rx':'','cb':_0x2e77ae};_0xe1963a['write'](_0x135e3e+'\x0a');},this[_0xd7d8('0x1b')]=function(){_0xe1963a[_0xd7d8('0x1f')]();};}util[_0xd7d8('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xd7d8('0x23')]['sendRequest']=function(_0x10b1e1){return this[_0xd7d8('0x21')][_0xd7d8('0x24')](this,_0x10b1e1);};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x25')]=function(){return this['sendRequest'](_0xd7d8('0x26'));};AGIChannel[_0xd7d8('0x23')]['getData']=function(_0x26df46,_0x46b927,_0x8ce1d0){_0x26df46=_0x26df46===undefined?'beep':_0x26df46;_0x46b927=_0x46b927===undefined?'5':_0x46b927;_0x8ce1d0=_0x8ce1d0===undefined?'1':_0x8ce1d0;return this[_0xd7d8('0x27')](util[_0xd7d8('0x28')](_0xd7d8('0x29'),_0x26df46,_0x46b927*0x3e8,_0x8ce1d0));};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x2a')]=function(_0x54248c){_0x54248c=_0x54248c||_0xd7d8('0x2b');return this[_0xd7d8('0x27')](util[_0xd7d8('0x28')]('VERBOSE\x20\x22%s\x22',_0x54248c));};AGIChannel['prototype'][_0xd7d8('0x2c')]=function(_0x49c3c4,_0x5638f5){if(_[_0xd7d8('0x2d')](_0x5638f5)){return this[_0xd7d8('0x27')](util['format'](_0xd7d8('0x2e'),_0x49c3c4,_0x5638f5[_0xd7d8('0x2f')](',')));}return this[_0xd7d8('0x27')](util[_0xd7d8('0x28')](_0xd7d8('0x2e'),_0x49c3c4,_0x5638f5));};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x30')]=function(_0x322120){return this[_0xd7d8('0x27')](util[_0xd7d8('0x28')]('SET\x20CONTEXT\x20%s',_0x322120));};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x31')]=function(_0x36a4a0){return this['sendRequest'](util['format'](_0xd7d8('0x32'),_0x36a4a0));};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x33')]=function(_0x2c559d){return this['sendRequest'](util['format']('SET\x20PRIORITY\x20%s',_0x2c559d));};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0xc')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x34')]=function(_0x474779,_0x49d3fd){var _0x4eb6e3=_[_0xd7d8('0x35')](_0x49d3fd)||_[_0xd7d8('0x36')](_0x49d3fd)?_0x49d3fd[_0xd7d8('0x37')]():_0x49d3fd;return this[_0xd7d8('0x27')](util[_0xd7d8('0x28')](_0xd7d8('0x38'),_0x474779,_0x4eb6e3?_0x4eb6e3[_0xd7d8('0x37')]()[_0xd7d8('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x28585d,_0x37fd8e){return this[_0xd7d8('0x27')](util[_0xd7d8('0x28')](_0xd7d8('0x39'),_0x28585d,_0x37fd8e));};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x3a')]=function(_0x3bae7e,_0x5a46d7){return this[_0xd7d8('0x27')](util[_0xd7d8('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x3bae7e,_0x5a46d7));};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x3b')]=function(_0x297f6a,_0xd68aec){return this[_0xd7d8('0x27')](util[_0xd7d8('0x28')](_0xd7d8('0x3c'),_0x297f6a,_0xd68aec));};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x3d')]=function(_0x289ec4,_0x485cf8,_0x2fb1ca){_0x485cf8=_0x485cf8||this[_0xd7d8('0x3e')];_0x2fb1ca=_0x2fb1ca||0x1;this['setContext'](_0x289ec4);this[_0xd7d8('0x31')](_0x485cf8);this['setPriority'](_0x2fb1ca);return this[_0xd7d8('0x2a')](util[_0xd7d8('0x28')](_0xd7d8('0x3f'),_0x289ec4,_0x485cf8,_0x2fb1ca));};AGIChannel['prototype']['getVariable']=function(_0x30b908){return this[_0xd7d8('0x27')](util[_0xd7d8('0x28')](_0xd7d8('0x40'),_0x30b908));};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x41')]=function(_0x13443c,_0x4d259f,_0x1b8a68,_0x3056ed,_0x41ed62,_0x56c90c){_0x4d259f=_0x4d259f||'wav';_0x1b8a68=_0x1b8a68||'';_0x3056ed=_0x3056ed===undefined?-0x1:_0x3056ed==='-1'?-0x1:_0x3056ed*0x3e8;_0x41ed62=_0x41ed62===undefined?'':'s='+_0x41ed62;_0x56c90c=_0x56c90c?'BEEP':'';return this[_0xd7d8('0x27')](util['format'](_0xd7d8('0x42'),_0x13443c,_0x4d259f,_0x1b8a68,_0x3056ed,_0x56c90c,_0x41ed62));};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x43')]=function(_0x4baed8,_0x3a6011){_0x3a6011=_0x3a6011||'';return this[_0xd7d8('0x27')](util[_0xd7d8('0x28')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4baed8,_0x3a6011));};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x44')]=function(_0x2a5c9f){return this[_0xd7d8('0x2c')](_0xd7d8('0x45'),_0x2a5c9f);};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x46')]=function(_0x3cc88a){return this[_0xd7d8('0x2c')](_0xd7d8('0x47'),_0x3cc88a);};AGIChannel[_0xd7d8('0x23')][_0xd7d8('0x19')]=function(_0x7b2b75,_0x42323d){this[_0xd7d8('0x2a')](util[_0xd7d8('0x28')](_0xd7d8('0x48'),_0x7b2b75['id'],_0x7b2b75[_0xd7d8('0x49')],_0x42323d));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xb657=['recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setTimeout','setEncoding','emit','line','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','no\x20code','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','function','write','inherits','prototype','sendRequest','sync','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0xb657,0x150));var _0x7b65=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb657[_0x8c43de];return _0xa6591b;};'use strict';var util=require(_0x7b65('0x0'));var _=require(_0x7b65('0x1'));var EventEmitter=require(_0x7b65('0x2'))[_0x7b65('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x7b65('0x4'));function AGIChannel(_0x11b3d4){var _0x1489f0=this,_0x1ba76f=new AGIReply(),_0x1f5805=![],_0x3616d1={};EventEmitter[_0x7b65('0x5')](_0x1489f0);_0x11b3d4['setEncoding'](_0x7b65('0x6'));_0x11b3d4[_0x7b65('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1ba76f[_0x7b65('0x8')](_0x7b65('0x6'));_0x1ba76f['on']('headers',function(_0x1e3457){for(var _0x26eb78 in _0x1e3457){_0x1489f0[_0x26eb78]=_0x1e3457[_0x26eb78];}_0x1489f0[_0x7b65('0x9')]('ready');});_0x1ba76f['on'](_0x7b65('0xa'),function(_0x414202){if(_0x414202[_0x7b65('0xb')]()==_0x7b65('0xc')){_0x1489f0[_0x7b65('0x9')]('hangup');return;}if(_0x414202[_0x7b65('0xd')](0x0,0xb)=='520-Invalid'){_0x1f5805=!![];}if(_0x1f5805){_0x3616d1['rx']+=_0x414202+'\x0a';if(_0x414202['search'](_0x7b65('0xe'))!=-0x1){_0x1f5805=![];}}else{_0x3616d1['rx']=_0x414202;}if(_0x1f5805){return;}if(typeof _0x3616d1['cb']=='function'){var _0x454263=_0x3616d1['rx'][_0x7b65('0xd')](0x0,0x3),_0x356103=null,_0x3c86a4=null;_0x454263=parseInt(_0x454263);if(isNaN(_0x454263)){_0x3616d1['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7b65('0xf')});return;}if(_0x454263!=0xc8){_0x3616d1['cb'](null,{'code':_0x454263,'result':-0x1,'extra':'KO'});return;}_0x356103=_0x3616d1['rx']['substring'](0x4)['replace']('result=','');if(_0x356103[_0x7b65('0x10')]('\x20')!=-0x1){_0x356103=_0x356103['substr'](0x0,_0x356103['indexOf']('\x20'));}if(_[_0x7b65('0x11')](_0x356103,'-1')){_0x356103=parseInt(_0x356103);}_0x3c86a4=_0x3616d1['rx'][_0x7b65('0x12')]('\x20');if(_0x3c86a4[_0x7b65('0x13')]==0x3){_0x3c86a4=_0x3c86a4[0x2][_0x7b65('0xd')](0x1,_0x3c86a4[0x2][_0x7b65('0x13')]-0x1);}else if(_0x3c86a4[_0x7b65('0x13')]>0x3){var _0x39d1a3=/\((.+)\)/;var _0x9a878e=_0x3616d1['rx'][_0x7b65('0x14')](_0x39d1a3);if(_0x9a878e){_0x3c86a4=_0x9a878e[0x1];}else{_0x3c86a4=null;}}else{_0x3c86a4=null;}_0x3616d1['cb'](null,{'code':_0x454263,'result':_0x356103,'extra':_0x3c86a4});}});_0x11b3d4['on'](_0x7b65('0x15'),function(_0x3e7a97){_0x1489f0[_0x7b65('0x9')]('error',new AGIError(_0x7b65('0x16'),_0x3e7a97[_0x7b65('0x17')]));});_0x11b3d4['on'](_0x7b65('0x18'),function(){_0x1489f0[_0x7b65('0x9')]('close',new AGIError(_0x7b65('0x19')));});_0x11b3d4['on'](_0x7b65('0x1a'),function(){_0x1489f0[_0x7b65('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x11b3d4[_0x7b65('0x1b')]();});_0x11b3d4[_0x7b65('0x1c')](_0x1ba76f);this[_0x7b65('0x1d')]=function(_0x4353cb,_0x28add0){var _0x4353cb=_0x4353cb||'',_0x28add0=typeof _0x28add0==_0x7b65('0x1e')?_0x28add0:new Function();_0x3616d1={'tx':_0x4353cb,'rx':'','cb':_0x28add0};_0x11b3d4[_0x7b65('0x1f')](_0x4353cb+'\x0a');},this[_0x7b65('0x18')]=function(){_0x11b3d4[_0x7b65('0x1b')]();};}util[_0x7b65('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x7b65('0x21')][_0x7b65('0x22')]=function(_0x1789db){return this[_0x7b65('0x1d')][_0x7b65('0x23')](this,_0x1789db);};AGIChannel[_0x7b65('0x21')]['answer']=function(){return this[_0x7b65('0x22')](_0x7b65('0x24'));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x25')]=function(_0x48b6eb,_0x5a6cf6,_0x184e76){_0x48b6eb=_0x48b6eb===undefined?_0x7b65('0x26'):_0x48b6eb;_0x5a6cf6=_0x5a6cf6===undefined?'5':_0x5a6cf6;_0x184e76=_0x184e76===undefined?'1':_0x184e76;return this[_0x7b65('0x22')](util[_0x7b65('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x48b6eb,_0x5a6cf6*0x3e8,_0x184e76));};AGIChannel['prototype'][_0x7b65('0x28')]=function(_0x4a6408){_0x4a6408=_0x4a6408||_0x7b65('0x29');return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x2a'),_0x4a6408));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x2b')]=function(_0x3ebfce,_0x216c88){if(_[_0x7b65('0x2c')](_0x216c88)){return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x2d'),_0x3ebfce,_0x216c88[_0x7b65('0x2e')](',')));}return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x2d'),_0x3ebfce,_0x216c88));};AGIChannel[_0x7b65('0x21')]['setContext']=function(_0x49e3eb){return this[_0x7b65('0x22')](util['format']('SET\x20CONTEXT\x20%s',_0x49e3eb));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x2f')]=function(_0x3be95){return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x30'),_0x3be95));};AGIChannel['prototype'][_0x7b65('0x31')]=function(_0x339bf9){return this[_0x7b65('0x22')](util['format'](_0x7b65('0x32'),_0x339bf9));};AGIChannel[_0x7b65('0x21')][_0x7b65('0xc')]=function(){return this[_0x7b65('0x22')](_0x7b65('0x33'));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x34')]=function(_0x23e9b7,_0x467f29){var _0x136e27=_[_0x7b65('0x35')](_0x467f29)||_[_0x7b65('0x36')](_0x467f29)?_0x467f29[_0x7b65('0x37')]():_0x467f29;return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x38'),_0x23e9b7,_0x136e27?_0x136e27[_0x7b65('0x37')]()[_0x7b65('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3a')]=function(_0x39c97d,_0x27267d){return this['sendRequest'](util['format'](_0x7b65('0x3b'),_0x39c97d,_0x27267d));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3c')]=function(_0x35afc0,_0x167062){return this[_0x7b65('0x22')](util['format'](_0x7b65('0x3d'),_0x35afc0,_0x167062));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3e')]=function(_0xf87fde,_0xe31bc6){return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x3f'),_0xf87fde,_0xe31bc6));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x40')]=function(_0xabc38b,_0x47f719,_0x4e0e9b){_0x47f719=_0x47f719||this['extension'];_0x4e0e9b=_0x4e0e9b||0x1;this[_0x7b65('0x41')](_0xabc38b);this[_0x7b65('0x2f')](_0x47f719);this['setPriority'](_0x4e0e9b);return this[_0x7b65('0x28')](util[_0x7b65('0x27')](_0x7b65('0x42'),_0xabc38b,_0x47f719,_0x4e0e9b));};AGIChannel['prototype'][_0x7b65('0x43')]=function(_0x39e729){return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x44'),_0x39e729));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x45')]=function(_0x2afd32,_0x54b55a,_0x564a56,_0x20b175,_0x19aa39,_0x482d2c){_0x54b55a=_0x54b55a||_0x7b65('0x46');_0x564a56=_0x564a56||'';_0x20b175=_0x20b175===undefined?-0x1:_0x20b175==='-1'?-0x1:_0x20b175*0x3e8;_0x19aa39=_0x19aa39===undefined?'':'s='+_0x19aa39;_0x482d2c=_0x482d2c?_0x7b65('0x47'):'';return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x48'),_0x2afd32,_0x54b55a,_0x564a56,_0x20b175,_0x482d2c,_0x19aa39));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x49')]=function(_0x5a25b8,_0x15d3a1){_0x15d3a1=_0x15d3a1||'';return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x4a'),_0x5a25b8,_0x15d3a1));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x4b')]=function(_0x27684a){return this[_0x7b65('0x2b')](_0x7b65('0x4c'),_0x27684a);};AGIChannel['prototype'][_0x7b65('0x4d')]=function(_0x13211f){return this[_0x7b65('0x2b')](_0x7b65('0x4e'),_0x13211f);};AGIChannel['prototype'][_0x7b65('0x15')]=function(_0x13adcd,_0x23bf51){this['noop'](util[_0x7b65('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x13adcd['id'],_0x13adcd[_0x7b65('0x4f')],_0x23bf51));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7b65('0x50')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index a31405f..f4e0938 100644 --- a/server/services/agi/error.js +++ b/server/services/agi/error.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff61=['Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.'];(function(_0x53d3d3,_0x3045f0){var _0xd5e4e1=function(_0x4c1133){while(--_0x4c1133){_0x53d3d3['push'](_0x53d3d3['shift']());}};_0xd5e4e1(++_0x3045f0);}(_0xff61,0x157));var _0x1ff6=function(_0x5e87eb,_0x423bbd){_0x5e87eb=_0x5e87eb-0x0;var _0x7c6efa=_0xff61[_0x5e87eb];return _0x7c6efa;};'use strict';var util=require(_0x1ff6('0x0'));var error={'E_AGI_UNDEFINED':_0x1ff6('0x1'),'E_AGI_ARGUMENT_PORT':_0x1ff6('0x2'),'E_AGI_SERVER_ERROR':_0x1ff6('0x3'),'E_AGI_SERVER_CLOSE':_0x1ff6('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x1ff6('0x5'),'E_AGI_SOCKET_ERROR':_0x1ff6('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x1ff6('0x7'),'E_AGI_COMMAND_EMPTY':_0x1ff6('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1ff6('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x541061){var _0x541061=_0x541061||null,_0x385a16=_0x385a16||[],_0x47c611=0x1,_0x3f4ec0='';if(!error[_0x541061]){_0x541061=_0x1ff6('0xa');}_0x385a16[_0x1ff6('0xb')](error[_0x541061]);while(arguments[_0x47c611]){_0x385a16[_0x1ff6('0xb')](arguments[_0x47c611]);_0x47c611++;}_0x3f4ec0=util['format'][_0x1ff6('0xc')](util,_0x385a16);this[_0x1ff6('0xd')]=_0x3f4ec0;this[_0x1ff6('0xe')]=_0x541061;}module[_0x1ff6('0xf')]=AGIError; \ No newline at end of file +var _0x6876=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','name','exports','util','Server\x20closed.'];(function(_0x33da63,_0x328b76){var _0x5814ff=function(_0x7c6228){while(--_0x7c6228){_0x33da63['push'](_0x33da63['shift']());}};_0x5814ff(++_0x328b76);}(_0x6876,0xe8));var _0x6687=function(_0x5a2291,_0x3ddda7){_0x5a2291=_0x5a2291-0x0;var _0x10e3f5=_0x6876[_0x5a2291];return _0x10e3f5;};'use strict';var util=require(_0x6687('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x6687('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x6687('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x6687('0x3'),'E_AGI_SOCKET_ERROR':_0x6687('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x6687('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6687('0x6'),'E_AGI_IVR_ENTRY':_0x6687('0x7')};function AGIError(_0x4f5ff3){var _0x4f5ff3=_0x4f5ff3||null,_0x4a97f8=_0x4a97f8||[],_0x2833d7=0x1,_0x4c5ed2='';if(!error[_0x4f5ff3]){_0x4f5ff3=_0x6687('0x8');}_0x4a97f8['push'](error[_0x4f5ff3]);while(arguments[_0x2833d7]){_0x4a97f8[_0x6687('0x9')](arguments[_0x2833d7]);_0x2833d7++;}_0x4c5ed2=util['format'][_0x6687('0xa')](util,_0x4a97f8);this['message']=_0x4c5ed2;this[_0x6687('0xb')]=_0x4f5ff3;}module[_0x6687('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ed0ad03..18d619a 100644 --- a/server/services/agi/graph/index.js +++ b/server/services/agi/graph/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x538f=['target','default','invalid','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','agi','menu','getdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch'];(function(_0x39bc1f,_0x39a375){var _0x2ffc16=function(_0x2b0726){while(--_0x2b0726){_0x39bc1f['push'](_0x39bc1f['shift']());}};_0x2ffc16(++_0x39a375);}(_0x538f,0x1c8));var _0xf538=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x538f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf538('0x0'));var logger=require('../../../config/logger')(_0xf538('0x1'));var verticesWithRetry=[_0xf538('0x2'),_0xf538('0x3'),'getsecretdigits'];var Graph=function(){this[_0xf538('0x4')]={};this[_0xf538('0x5')]={};this[_0xf538('0x6')]=0x0;};Graph[_0xf538('0x7')][_0xf538('0x8')]=function(_0x36c49e){this[_0xf538('0x4')][_0x36c49e['id']]=_0x36c49e;this[_0xf538('0x5')][_0x36c49e['id']]=[];};Graph[_0xf538('0x7')][_0xf538('0x9')]=function(_0x28ba2c,_0x259901,_0x503281){this[_0xf538('0x5')][_0x28ba2c][_0xf538('0xa')]({'target':_0x259901,'condition':_0x503281});this[_0xf538('0x6')]+=0x1;};Graph[_0xf538('0x7')][_0xf538('0xb')]=function(){return _[_0xf538('0xb')](this[_0xf538('0x4')]);};Graph[_0xf538('0x7')][_0xf538('0xc')]=function(){return this[_0xf538('0x6')];};Graph[_0xf538('0x7')][_0xf538('0xd')]=function(_0x5e3037){return this[_0xf538('0x4')][_0x5e3037];};Graph[_0xf538('0x7')][_0xf538('0xe')]=function(_0x29bb86,_0x26eb51){if(!this[_0xf538('0x4')][_0x29bb86]){return logger[_0xf538('0xf')](_0xf538('0x10'));}var _0x5dbf22=_0x26eb51(this[_0xf538('0x4')][_0x29bb86]);if(!_0x5dbf22){return logger['info'](_0xf538('0x11'));}if(this['edges'][_0x29bb86][_0xf538('0x12')]===0x0){return logger[_0xf538('0xf')](_0xf538('0x13'));}for(var _0x501cd7=0x0,_0x50c7df=[],_0x2aaaef=![];_0x501cd7\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','toJson','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','target','addEdge','source','value','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','evtHangup','response','result','toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','isUndefined','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','lodash','util','../../config/environment','agi','../../config/license/util','./mailRpc','./graph','./vertices'];(function(_0x161a09,_0x21b219){var _0x386c83=function(_0x5667b0){while(--_0x5667b0){_0x161a09['push'](_0x161a09['shift']());}};_0x386c83(++_0x21b219);}(_0x6c3b,0xf0));var _0xb6c3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6c3b[_0x14add3];return _0x4a174f;};'use strict';var parser=require(_0xb6c3('0x0'));var _=require(_0xb6c3('0x1'));var syncho=require('syncho');var util=require(_0xb6c3('0x2'));var moment=require('moment');var config=require(_0xb6c3('0x3'));var logger=require('../../config/logger')(_0xb6c3('0x4'));var utilLicense=require(_0xb6c3('0x5'));var rpc=require('./rpc');var mailRpc=require(_0xb6c3('0x6'));var Graph=require(_0xb6c3('0x7'));var Vertices=require(_0xb6c3('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xb6c3('0x4')]=_['defaults'](config[_0xb6c3('0x4')],{'ip':_0xb6c3('0x9'),'port':0x11dd});function connectionHandler(_0x8c13a){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x8c13a);agiHandler(_0x8c13a);}catch(_0x506728){logger['error'](_0x506728[_0xb6c3('0xa')]);}});});}function listeningHandler(){console['log'](_0xb6c3('0xb'),config[_0xb6c3('0x4')][_0xb6c3('0xc')]);logger[_0xb6c3('0xd')](util[_0xb6c3('0xe')](_0xb6c3('0xf'),config[_0xb6c3('0x4')]['ip'],config['agi'][_0xb6c3('0xc')]));}function errorHandler(_0x2b94fb){if(_0x2b94fb&&_0x2b94fb['name']&&_0x2b94fb[_0xb6c3('0x10')]){logger[_0xb6c3('0x11')](util[_0xb6c3('0xe')]('[%s]\x20%s',_0x2b94fb['name'],_0x2b94fb['message']));}else{logger[_0xb6c3('0x11')](util['format'](_0xb6c3('0x12'),_0x2b94fb[_0xb6c3('0xa')]));}}function closeHandler(){logger['info'](util[_0xb6c3('0xe')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb6c3('0x13')],this[_0xb6c3('0x14')],this['callerid'],this[_0xb6c3('0x15')],this[_0xb6c3('0x16')]));try{createSquareReport(this);}catch(_0x229692){logger[_0xb6c3('0x11')](_0x229692['stack']);}}function timeoutHandler(){logger[_0xb6c3('0xd')](util[_0xb6c3('0xe')](_0xb6c3('0x17'),this[_0xb6c3('0x13')],this[_0xb6c3('0x14')],this['callerid'],this[_0xb6c3('0x15')],this[_0xb6c3('0x16')]));}function hangupHandler(){logger[_0xb6c3('0xd')](util[_0xb6c3('0xe')](_0xb6c3('0x18'),this['arg_1'],this['calleridname'],this[_0xb6c3('0x19')],this[_0xb6c3('0x15')],this[_0xb6c3('0x16')]));this['evtHangup']=!![];}function getRoot(_0x507d3b){return parser[_0xb6c3('0x1a')](_0x507d3b,{'object':!![]})['mxGraphModel'][_0xb6c3('0x1b')];}function addVertex(_0x431dda,_0x45f35d,_0x3925e3){_0x45f35d[_0xb6c3('0x1c')]=_0x3925e3;if(_0x45f35d[_0xb6c3('0x1d')](_0xb6c3('0x1e'))){_0x45f35d[_0xb6c3('0x1f')]=parseInt(_0x45f35d['retry'],0xa);}_0x431dda[_0xb6c3('0x20')](_[_0xb6c3('0x21')](_0x45f35d,'mxCell'));}function initGraph(_0x18fe4e,_0x4ca555){var _0x53092a=new Graph();for(var _0x31d52d in _0x18fe4e){if(_0x18fe4e[_0xb6c3('0x1d')](_0x31d52d)){if(_[_0xb6c3('0x22')](_0x18fe4e[_0x31d52d])){for(var _0x4020e5=0x0;_0x4020e5<_0x18fe4e[_0x31d52d][_0xb6c3('0x23')];_0x4020e5+=0x1){addVertex(_0x53092a,_0x18fe4e[_0x31d52d][_0x4020e5],_0x31d52d);}}else{addVertex(_0x53092a,_0x18fe4e[_0x31d52d],_0x31d52d);}}}for(var _0x3cf1bf=0x0;_0x3cf1bf<_0x4ca555['length'];_0x3cf1bf+=0x1){if(_0x4ca555[_0x3cf1bf]['source']&&_0x4ca555[_0x3cf1bf][_0xb6c3('0x24')]){_0x53092a[_0xb6c3('0x25')](_0x4ca555[_0x3cf1bf][_0xb6c3('0x26')],_0x4ca555[_0x3cf1bf][_0xb6c3('0x24')],_0x4ca555[_0x3cf1bf][_0xb6c3('0x27')]);}}return _0x53092a;}function getSquareProject(_0x273347,_0x1e42e2){rpc[_0xb6c3('0x28')](_0x273347)[_0xb6c3('0x29')](function(_0x157c85){_0x1e42e2(null,_0x157c85);})['catch'](function(_0x250844){_0x1e42e2(null,_0x250844);});}function createSquareReport(_0x36d813,_0x3afaec){rpc[_0xb6c3('0x2a')](_0x36d813)['then'](function(_0xe458a9){if(_0x3afaec){_0x3afaec(null,_0xe458a9);}})[_0xb6c3('0x2b')](function(_0x394d53){if(_0x3afaec){_0x3afaec(null,_0x394d53);}});}function setChannelVariables(_0x55b3c7){for(var _0x3532c5 in _0x55b3c7){if(_0x55b3c7[_0xb6c3('0x1d')](_0x3532c5)){if(_0x3532c5[_0xb6c3('0x2c')](_0xb6c3('0x2d'))===0x0){_0x55b3c7[_0x3532c5[_0xb6c3('0x2e')](0x4)]=_0x55b3c7[_0x3532c5];delete _0x55b3c7[_0x3532c5];}}}}function getLogFromObject(_0x4f9b95){return util['inspect'](_0x4f9b95,{'showHidden':![],'depth':null});}function agiHandler(_0x2edb2d){var _0x2c8fe1,_0x5082f4,_0x3f4011,_0xe5480e,_0xa2daac;logger[_0xb6c3('0x2f')](_0xb6c3('0x30'),JSON['stringify'](_0x2edb2d,null,0x2));logger[_0xb6c3('0xd')](util[_0xb6c3('0xe')](_0xb6c3('0x31'),_0x2edb2d[_0xb6c3('0x13')],_0x2edb2d[_0xb6c3('0x14')],_0x2edb2d[_0xb6c3('0x19')],_0x2edb2d[_0xb6c3('0x15')],_0x2edb2d[_0xb6c3('0x16')]));_0x2edb2d['on'](_0xb6c3('0x11'),errorHandler);_0x2edb2d['on'](_0xb6c3('0x32'),closeHandler);_0x2edb2d['on']('timeout',timeoutHandler);_0x2edb2d['evtHangup']=![];_0x2edb2d['on']('hangup',hangupHandler);var _0x59c6f9=getSquareProject['sync'](null,_0x2edb2d[_0xb6c3('0x13')]);if(_0x59c6f9){if(_0x59c6f9['production']){_0x2c8fe1=getRoot(_0x59c6f9[_0xb6c3('0x33')]);if(_0x2c8fe1&&_0x2c8fe1[_0xb6c3('0x34')]){logger[_0xb6c3('0x2f')](_0xb6c3('0x1b'),JSON[_0xb6c3('0x35')](_0x2c8fe1,null,0x2));_0x2edb2d[_0xb6c3('0x36')]=moment()[_0xb6c3('0xe')](_0xb6c3('0x37'));_0x5082f4=initGraph(_[_0xb6c3('0x21')](_0x2c8fe1,_0xb6c3('0x38')),_0x2c8fe1[_0xb6c3('0x38')]);_0x3f4011=new Vertices(_0x2edb2d,rpc,mailRpc);logger[_0xb6c3('0xd')](util['format'](_0xb6c3('0x39'),_0x2edb2d['arg_1'],_0x2edb2d[_0xb6c3('0x14')],_0x2edb2d['callerid'],_0x2edb2d[_0xb6c3('0x15')],_0x2edb2d[_0xb6c3('0x16')]));_0x5082f4['traverseBFS'](_0x2c8fe1['start']['id'],function(_0x584259){try{_0x584259=_0x3f4011[_0xb6c3('0x3a')](_0x584259);logger[_0xb6c3('0x2f')](_0xb6c3('0x3b'),JSON[_0xb6c3('0x35')](_0x584259,null,0x2));if(_0x584259[_0xb6c3('0x1c')]===_0xb6c3('0x3c')){logger[_0xb6c3('0xd')](_0xb6c3('0x3d'));_0x2edb2d[_0xb6c3('0x3e')]=_0x584259[_0xb6c3('0x3e')]||_0x2edb2d[_0xb6c3('0x3e')];_0x2edb2d[_0xb6c3('0x3f')]=_0x584259[_0xb6c3('0x3f')];_0x2edb2d[_0xb6c3('0x40')]=_0x584259[_0xb6c3('0x40')]?_0x584259[_0xb6c3('0x40')]-0x1:0x1;return null;}else if(_0x584259&&_0x3f4011[_0x584259[_0xb6c3('0x1c')]]){_0xa2daac=_0x3f4011[_0x584259[_0xb6c3('0x1c')]](_0x584259);logger[_0xb6c3('0xd')]('response',JSON['stringify'](_0xa2daac,null,0x2));if(_0xa2daac&&_0xa2daac[_0xb6c3('0x41')]===AGI_CODE_SUCCESS&&_0xa2daac['result']!==AGI_RESULT_ERROR&&!_0x2edb2d[_0xb6c3('0x42')]){logger[_0xb6c3('0x2f')](_0xb6c3('0x43'),getLogFromObject(_0xa2daac));return _['isUndefined'](_0xa2daac[_0xb6c3('0x44')])?null:_0xa2daac[_0xb6c3('0x44')][_0xb6c3('0x45')]();}else{logger[_0xb6c3('0x11')](_0xb6c3('0x43'),getLogFromObject(_0xa2daac));return null;}}else{logger[_0xb6c3('0x11')]('agicommand\x20not\x20found');return null;}}catch(_0x4c818a){logger['error'](_0x4c818a[_0xb6c3('0xa')]);return null;}});if(_0x2c8fe1['finally']){logger[_0xb6c3('0xd')](util[_0xb6c3('0xe')](_0xb6c3('0x46'),_0x2edb2d[_0xb6c3('0x13')],_0x2edb2d[_0xb6c3('0x14')],_0x2edb2d[_0xb6c3('0x19')],_0x2edb2d[_0xb6c3('0x15')],_0x2edb2d['uniqueid']));_0x5082f4['traverseBFS'](_0x2c8fe1[_0xb6c3('0x47')]['id'],function(_0x1e47f6){try{_0x1e47f6=_0x3f4011[_0xb6c3('0x3a')](_0x1e47f6);logger[_0xb6c3('0x2f')](_0xb6c3('0x3b'),JSON['stringify'](_0x1e47f6,null,0x2));if(_0x1e47f6&&_0x3f4011[_0x1e47f6[_0xb6c3('0x1c')]]){_0xa2daac=_0x3f4011[_0x1e47f6['agicommand']](_0x1e47f6);if(_0xa2daac){logger['debug'](_0xb6c3('0x43'),getLogFromObject(_0xa2daac));return _[_0xb6c3('0x48')](_0xa2daac['result'])?null:_0xa2daac['result'][_0xb6c3('0x45')]();}else{logger['error'](_0xb6c3('0x43'),getLogFromObject(_0xa2daac));return null;}}else{logger[_0xb6c3('0x11')](_0xb6c3('0x49'));return null;}}catch(_0x3962dc){logger[_0xb6c3('0x11')](_0x3962dc[_0xb6c3('0xa')]);return null;}});}logger['info'](util[_0xb6c3('0xe')](_0xb6c3('0x4a'),_0x2edb2d[_0xb6c3('0x13')],_0x2edb2d[_0xb6c3('0x14')],_0x2edb2d[_0xb6c3('0x19')],_0x2edb2d[_0xb6c3('0x15')],_0x2edb2d['uniqueid']));logger['info'](util[_0xb6c3('0xe')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x2edb2d[_0xb6c3('0x3e')],_0x2edb2d['extension'],parseInt(_0x2edb2d[_0xb6c3('0x40')],0xa)+0x1));_0x2edb2d[_0xb6c3('0x4b')](_0x2edb2d[_0xb6c3('0x3e')],_0x2edb2d[_0xb6c3('0x3f')],parseInt(_0x2edb2d['priority'],0xa)+0x1);_0x2edb2d[_0xb6c3('0x32')]();}}else{logger[_0xb6c3('0x11')](util[_0xb6c3('0xe')]('Project\x20%s\x20not\x20published',_0x2edb2d[_0xb6c3('0x13')]));_0x2edb2d[_0xb6c3('0x4b')](_0x2edb2d['context'],_0x2edb2d[_0xb6c3('0x3f')],parseInt(_0x2edb2d['priority'],0xa)+0x1);_0x2edb2d[_0xb6c3('0x32')]();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20found',_0x2edb2d[_0xb6c3('0x13')]));_0x2edb2d['continueAt'](_0x2edb2d['context'],_0x2edb2d[_0xb6c3('0x3f')],parseInt(_0x2edb2d[_0xb6c3('0x40')],0xa)+0x1);_0x2edb2d[_0xb6c3('0x32')]();}}function main(){var _0x430b28;return utilLicense[_0xb6c3('0x4c')]()[_0xb6c3('0x29')](function(_0x4ba49f){if(_0x4ba49f){if(_0x4ba49f['voice']){if(_0x4ba49f[_0xb6c3('0x4d')]&&_0x4ba49f[_0xb6c3('0x4d')]>0x0){logger[_0xb6c3('0xd')](util[_0xb6c3('0xe')](_0xb6c3('0x4e'),_0x4ba49f[_0xb6c3('0x4d')]));_0x430b28=_0x4ba49f[_0xb6c3('0x4d')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xb6c3('0xd')](_0xb6c3('0x4f'));_0x430b28=-0x1;}}})[_0xb6c3('0x2b')](function(_0x1f4860){logger[_0xb6c3('0x11')]('[LICENSE]',_0x1f4860[_0xb6c3('0xa')]);})[_0xb6c3('0x47')](function(){var _0x11ce4b=require(_0xb6c3('0x50'))(config[_0xb6c3('0x4')][_0xb6c3('0xc')],config[_0xb6c3('0x4')]['ip'],_0x430b28);_0x11ce4b['on'](_0xb6c3('0x11'),errorHandler);_0x11ce4b['on'](_0xb6c3('0x51'),listeningHandler);_0x11ce4b['on'](_0xb6c3('0x52'),connectionHandler);_0x11ce4b['on'](_0xb6c3('0x32'),closeHandler);});}main(); \ No newline at end of file +var _0x7f11=['finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','context','extension','continueAt','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','nextTick','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','name','message','error','[%s]\x20%s','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','retry','maxRetry','addVertex','omit','hasOwnProperty','isArray','length','source','target','addEdge','getSquareProject','then','catch','indexOf','agi_','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','production','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','priority','code','result','isUndefined','toString','response','agicommand\x20not\x20found'];(function(_0x40498c,_0x51aea5){var _0x1fe202=function(_0x88e5ab){while(--_0x88e5ab){_0x40498c['push'](_0x40498c['shift']());}};_0x1fe202(++_0x51aea5);}(_0x7f11,0x1c9));var _0x17f1=function(_0xd9b578,_0x200000){_0xd9b578=_0xd9b578-0x0;var _0x1e7e2f=_0x7f11[_0xd9b578];return _0x1e7e2f;};'use strict';var parser=require(_0x17f1('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require('util');var moment=require(_0x17f1('0x1'));var config=require(_0x17f1('0x2'));var logger=require('../../config/logger')(_0x17f1('0x3'));var utilLicense=require(_0x17f1('0x4'));var rpc=require('./rpc');var mailRpc=require(_0x17f1('0x5'));var Graph=require(_0x17f1('0x6'));var Vertices=require(_0x17f1('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x17f1('0x3')]=_[_0x17f1('0x8')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x3c8ed0){process[_0x17f1('0x9')](function(){syncho(function(){try{setChannelVariables(_0x3c8ed0);agiHandler(_0x3c8ed0);}catch(_0x5b40ff){logger['error'](_0x5b40ff['stack']);}});});}function listeningHandler(){console[_0x17f1('0xa')](_0x17f1('0xb'),config[_0x17f1('0x3')][_0x17f1('0xc')]);logger['info'](util[_0x17f1('0xd')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x17f1('0x3')]['ip'],config[_0x17f1('0x3')][_0x17f1('0xc')]));}function errorHandler(_0x37e5f8){if(_0x37e5f8&&_0x37e5f8[_0x17f1('0xe')]&&_0x37e5f8[_0x17f1('0xf')]){logger[_0x17f1('0x10')](util[_0x17f1('0xd')](_0x17f1('0x11'),_0x37e5f8['name'],_0x37e5f8[_0x17f1('0xf')]));}else{logger[_0x17f1('0x10')](util[_0x17f1('0xd')](_0x17f1('0x12'),_0x37e5f8[_0x17f1('0x13')]));}}function closeHandler(){logger[_0x17f1('0x14')](util[_0x17f1('0xd')](_0x17f1('0x15'),this[_0x17f1('0x16')],this[_0x17f1('0x17')],this[_0x17f1('0x18')],this[_0x17f1('0x19')],this[_0x17f1('0x1a')]));try{createSquareReport(this);}catch(_0x400a82){logger[_0x17f1('0x10')](_0x400a82[_0x17f1('0x13')]);}}function timeoutHandler(){logger['info'](util[_0x17f1('0xd')](_0x17f1('0x1b'),this[_0x17f1('0x16')],this['calleridname'],this[_0x17f1('0x18')],this[_0x17f1('0x19')],this[_0x17f1('0x1a')]));}function hangupHandler(){logger['info'](util[_0x17f1('0xd')](_0x17f1('0x1c'),this[_0x17f1('0x16')],this['calleridname'],this[_0x17f1('0x18')],this[_0x17f1('0x19')],this[_0x17f1('0x1a')]));this[_0x17f1('0x1d')]=!![];}function getRoot(_0x1831ae){return parser[_0x17f1('0x1e')](_0x1831ae,{'object':!![]})[_0x17f1('0x1f')][_0x17f1('0x20')];}function addVertex(_0x1f62dd,_0x2f1cf5,_0x1b67a6){_0x2f1cf5[_0x17f1('0x21')]=_0x1b67a6;if(_0x2f1cf5['hasOwnProperty'](_0x17f1('0x22'))){_0x2f1cf5[_0x17f1('0x23')]=parseInt(_0x2f1cf5['retry'],0xa);}_0x1f62dd[_0x17f1('0x24')](_[_0x17f1('0x25')](_0x2f1cf5,'mxCell'));}function initGraph(_0x2e897c,_0x3391ea){var _0x18e77d=new Graph();for(var _0x341b67 in _0x2e897c){if(_0x2e897c[_0x17f1('0x26')](_0x341b67)){if(_[_0x17f1('0x27')](_0x2e897c[_0x341b67])){for(var _0x1d2a26=0x0;_0x1d2a26<_0x2e897c[_0x341b67][_0x17f1('0x28')];_0x1d2a26+=0x1){addVertex(_0x18e77d,_0x2e897c[_0x341b67][_0x1d2a26],_0x341b67);}}else{addVertex(_0x18e77d,_0x2e897c[_0x341b67],_0x341b67);}}}for(var _0x54792d=0x0;_0x54792d<_0x3391ea[_0x17f1('0x28')];_0x54792d+=0x1){if(_0x3391ea[_0x54792d][_0x17f1('0x29')]&&_0x3391ea[_0x54792d][_0x17f1('0x2a')]){_0x18e77d[_0x17f1('0x2b')](_0x3391ea[_0x54792d][_0x17f1('0x29')],_0x3391ea[_0x54792d][_0x17f1('0x2a')],_0x3391ea[_0x54792d]['value']);}}return _0x18e77d;}function getSquareProject(_0x3eaa55,_0x75a273){rpc[_0x17f1('0x2c')](_0x3eaa55)[_0x17f1('0x2d')](function(_0x435ea7){_0x75a273(null,_0x435ea7);})[_0x17f1('0x2e')](function(_0x11f32a){_0x75a273(null,_0x11f32a);});}function createSquareReport(_0x211abd,_0x1f47fe){rpc['createSquareReport'](_0x211abd)['then'](function(_0x38850b){if(_0x1f47fe){_0x1f47fe(null,_0x38850b);}})[_0x17f1('0x2e')](function(_0x58c05f){if(_0x1f47fe){_0x1f47fe(null,_0x58c05f);}});}function setChannelVariables(_0x2a9db3){for(var _0x3cb786 in _0x2a9db3){if(_0x2a9db3[_0x17f1('0x26')](_0x3cb786)){if(_0x3cb786[_0x17f1('0x2f')](_0x17f1('0x30'))===0x0){_0x2a9db3[_0x3cb786['substring'](0x4)]=_0x2a9db3[_0x3cb786];delete _0x2a9db3[_0x3cb786];}}}}function getLogFromObject(_0x338d11){return util[_0x17f1('0x31')](_0x338d11,{'showHidden':![],'depth':null});}function agiHandler(_0x1a3b0a){var _0x3bfc5a,_0x285765,_0x32a6d3,_0x3641d2,_0x590e1b;logger[_0x17f1('0x32')](_0x17f1('0x33'),JSON[_0x17f1('0x34')](_0x1a3b0a,null,0x2));logger[_0x17f1('0x14')](util[_0x17f1('0xd')](_0x17f1('0x35'),_0x1a3b0a[_0x17f1('0x16')],_0x1a3b0a[_0x17f1('0x17')],_0x1a3b0a[_0x17f1('0x18')],_0x1a3b0a[_0x17f1('0x19')],_0x1a3b0a[_0x17f1('0x1a')]));_0x1a3b0a['on']('error',errorHandler);_0x1a3b0a['on'](_0x17f1('0x36'),closeHandler);_0x1a3b0a['on']('timeout',timeoutHandler);_0x1a3b0a['evtHangup']=![];_0x1a3b0a['on'](_0x17f1('0x37'),hangupHandler);var _0x12b75a=getSquareProject['sync'](null,_0x1a3b0a[_0x17f1('0x16')]);if(_0x12b75a){if(_0x12b75a[_0x17f1('0x38')]){_0x3bfc5a=getRoot(_0x12b75a[_0x17f1('0x38')]);if(_0x3bfc5a&&_0x3bfc5a['start']){logger[_0x17f1('0x32')](_0x17f1('0x20'),JSON[_0x17f1('0x34')](_0x3bfc5a,null,0x2));_0x1a3b0a['joinAt']=moment()[_0x17f1('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x285765=initGraph(_[_0x17f1('0x25')](_0x3bfc5a,_0x17f1('0x39')),_0x3bfc5a['mxCell']);_0x32a6d3=new Vertices(_0x1a3b0a,rpc,mailRpc);logger[_0x17f1('0x14')](util['format'](_0x17f1('0x3a'),_0x1a3b0a[_0x17f1('0x16')],_0x1a3b0a[_0x17f1('0x17')],_0x1a3b0a['callerid'],_0x1a3b0a['dnid'],_0x1a3b0a['uniqueid']));_0x285765[_0x17f1('0x3b')](_0x3bfc5a[_0x17f1('0x3c')]['id'],function(_0x111c3f){try{_0x111c3f=_0x32a6d3['clear'](_0x111c3f);logger[_0x17f1('0x32')](_0x17f1('0x3d'),JSON['stringify'](_0x111c3f,null,0x2));if(_0x111c3f[_0x17f1('0x21')]===_0x17f1('0x3e')){logger[_0x17f1('0x14')](_0x17f1('0x3f'));_0x1a3b0a['context']=_0x111c3f['context']||_0x1a3b0a['context'];_0x1a3b0a['extension']=_0x111c3f['extension'];_0x1a3b0a[_0x17f1('0x40')]=_0x111c3f[_0x17f1('0x40')]?_0x111c3f[_0x17f1('0x40')]-0x1:0x1;return null;}else if(_0x111c3f&&_0x32a6d3[_0x111c3f['agicommand']]){_0x590e1b=_0x32a6d3[_0x111c3f[_0x17f1('0x21')]](_0x111c3f);logger[_0x17f1('0x14')]('response',JSON[_0x17f1('0x34')](_0x590e1b,null,0x2));if(_0x590e1b&&_0x590e1b[_0x17f1('0x41')]===AGI_CODE_SUCCESS&&_0x590e1b[_0x17f1('0x42')]!==AGI_RESULT_ERROR&&!_0x1a3b0a[_0x17f1('0x1d')]){logger[_0x17f1('0x32')]('response',getLogFromObject(_0x590e1b));return _[_0x17f1('0x43')](_0x590e1b[_0x17f1('0x42')])?null:_0x590e1b[_0x17f1('0x42')][_0x17f1('0x44')]();}else{logger[_0x17f1('0x10')](_0x17f1('0x45'),getLogFromObject(_0x590e1b));return null;}}else{logger[_0x17f1('0x10')](_0x17f1('0x46'));return null;}}catch(_0x56310f){logger[_0x17f1('0x10')](_0x56310f['stack']);return null;}});if(_0x3bfc5a[_0x17f1('0x47')]){logger[_0x17f1('0x14')](util[_0x17f1('0xd')](_0x17f1('0x48'),_0x1a3b0a[_0x17f1('0x16')],_0x1a3b0a[_0x17f1('0x17')],_0x1a3b0a[_0x17f1('0x18')],_0x1a3b0a[_0x17f1('0x19')],_0x1a3b0a[_0x17f1('0x1a')]));_0x285765['traverseBFS'](_0x3bfc5a['finally']['id'],function(_0xa806fa){try{_0xa806fa=_0x32a6d3[_0x17f1('0x49')](_0xa806fa);logger[_0x17f1('0x32')](_0x17f1('0x3d'),JSON[_0x17f1('0x34')](_0xa806fa,null,0x2));if(_0xa806fa&&_0x32a6d3[_0xa806fa[_0x17f1('0x21')]]){_0x590e1b=_0x32a6d3[_0xa806fa[_0x17f1('0x21')]](_0xa806fa);if(_0x590e1b){logger[_0x17f1('0x32')]('response',getLogFromObject(_0x590e1b));return _[_0x17f1('0x43')](_0x590e1b[_0x17f1('0x42')])?null:_0x590e1b[_0x17f1('0x42')][_0x17f1('0x44')]();}else{logger[_0x17f1('0x10')]('response',getLogFromObject(_0x590e1b));return null;}}else{logger[_0x17f1('0x10')](_0x17f1('0x46'));return null;}}catch(_0x24eb41){logger[_0x17f1('0x10')](_0x24eb41[_0x17f1('0x13')]);return null;}});}logger['info'](util[_0x17f1('0xd')](_0x17f1('0x4a'),_0x1a3b0a[_0x17f1('0x16')],_0x1a3b0a['calleridname'],_0x1a3b0a[_0x17f1('0x18')],_0x1a3b0a[_0x17f1('0x19')],_0x1a3b0a[_0x17f1('0x1a')]));logger['info'](util[_0x17f1('0xd')](_0x17f1('0x4b'),_0x1a3b0a[_0x17f1('0x4c')],_0x1a3b0a[_0x17f1('0x4d')],parseInt(_0x1a3b0a[_0x17f1('0x40')],0xa)+0x1));_0x1a3b0a[_0x17f1('0x4e')](_0x1a3b0a[_0x17f1('0x4c')],_0x1a3b0a[_0x17f1('0x4d')],parseInt(_0x1a3b0a[_0x17f1('0x40')],0xa)+0x1);_0x1a3b0a[_0x17f1('0x36')]();}}else{logger[_0x17f1('0x10')](util['format']('Project\x20%s\x20not\x20published',_0x1a3b0a[_0x17f1('0x16')]));_0x1a3b0a['continueAt'](_0x1a3b0a[_0x17f1('0x4c')],_0x1a3b0a[_0x17f1('0x4d')],parseInt(_0x1a3b0a['priority'],0xa)+0x1);_0x1a3b0a[_0x17f1('0x36')]();}}else{logger[_0x17f1('0x10')](util[_0x17f1('0xd')](_0x17f1('0x4f'),_0x1a3b0a['arg_1']));_0x1a3b0a[_0x17f1('0x4e')](_0x1a3b0a[_0x17f1('0x4c')],_0x1a3b0a[_0x17f1('0x4d')],parseInt(_0x1a3b0a[_0x17f1('0x40')],0xa)+0x1);_0x1a3b0a[_0x17f1('0x36')]();}}function main(){var _0xc89d95;return utilLicense['getLicense']()[_0x17f1('0x2d')](function(_0x445de9){if(_0x445de9){if(_0x445de9[_0x17f1('0x50')]){if(_0x445de9['callysquare']&&_0x445de9[_0x17f1('0x51')]>0x0){logger[_0x17f1('0x14')](util[_0x17f1('0xd')](_0x17f1('0x52'),_0x445de9['callysquare']));_0xc89d95=_0x445de9['callysquare'];}else{logger[_0x17f1('0x14')](_0x17f1('0x53'));}}else{logger[_0x17f1('0x14')](_0x17f1('0x54'));_0xc89d95=-0x1;}}})[_0x17f1('0x2e')](function(_0x355f9a){logger[_0x17f1('0x10')](_0x17f1('0x55'),_0x355f9a[_0x17f1('0x13')]);})[_0x17f1('0x47')](function(){var _0x36c632=require(_0x17f1('0x56'))(config[_0x17f1('0x3')]['port'],config['agi']['ip'],_0xc89d95);_0x36c632['on'](_0x17f1('0x10'),errorHandler);_0x36c632['on']('listening',listeningHandler);_0x36c632['on'](_0x17f1('0x57'),connectionHandler);_0x36c632['on'](_0x17f1('0x36'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index b28d2f1..045d653 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6084=['catch','bluebird','jayson/promise','client','http','error','result'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x6084,0xda));var _0x4608=function(_0x292be6,_0x2c9e14){_0x292be6=_0x292be6-0x0;var _0x4af879=_0x6084[_0x292be6];return _0x4af879;};'use strict';var BPromise=require(_0x4608('0x0'));var jayson=require(_0x4608('0x1'));var client=jayson[_0x4608('0x2')][_0x4608('0x3')]({'port':0x232b});function request(_0x35101e,_0x1d00c1){return new BPromise(function(_0x25fe08,_0x2d2cdc){return client['request'](_0x35101e,_0x1d00c1)['then'](function(_0x422549){if(_0x422549[_0x4608('0x4')]){return _0x2d2cdc(_0x422549[_0x4608('0x4')]['message']);}else{return _0x25fe08(_0x422549[_0x4608('0x5')]);}})[_0x4608('0x6')](function(_0x2e1709){return _0x2d2cdc(_0x2e1709);});});}exports['sendMailMessage']=function(_0x1a227f,_0x3108b9){return request('SendMail',{'account':_0x1a227f,'message':_0x3108b9});}; \ No newline at end of file +var _0xd795=['then','error','message','result','catch','sendMailMessage','SendMail','jayson/promise','client','http','request'];(function(_0x5291e4,_0x22677d){var _0x589405=function(_0x1db485){while(--_0x1db485){_0x5291e4['push'](_0x5291e4['shift']());}};_0x589405(++_0x22677d);}(_0xd795,0x151));var _0x5d79=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xd795[_0x279d37];return _0x530173;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x5d79('0x0'));var client=jayson[_0x5d79('0x1')][_0x5d79('0x2')]({'port':0x232b});function request(_0x242826,_0x46d1e9){return new BPromise(function(_0x118ffb,_0x111ba7){return client[_0x5d79('0x3')](_0x242826,_0x46d1e9)[_0x5d79('0x4')](function(_0x56ed3f){if(_0x56ed3f[_0x5d79('0x5')]){return _0x111ba7(_0x56ed3f['error'][_0x5d79('0x6')]);}else{return _0x118ffb(_0x56ed3f[_0x5d79('0x7')]);}})[_0x5d79('0x8')](function(_0x4048b1){return _0x111ba7(_0x4048b1);});});}exports[_0x5d79('0x9')]=function(_0x5d4976,_0x170beb){return request(_0x5d79('0xa'),{'account':_0x5d4976,'message':_0x170beb});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index c54d97e..54e99ea 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3066=['line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','trim','emit','headers'];(function(_0x49a60f,_0x518c48){var _0x38c29c=function(_0x42b9cb){while(--_0x42b9cb){_0x49a60f['push'](_0x49a60f['shift']());}};_0x38c29c(++_0x518c48);}(_0x3066,0x156));var _0x6306=function(_0xa303af,_0x36a9ab){_0xa303af=_0xa303af-0x0;var _0x1853d2=_0x3066[_0xa303af];return _0x1853d2;};'use strict';var util=require(_0x6306('0x0'));var Transform=require(_0x6306('0x1'))[_0x6306('0x2')];function AGIReply(_0x29217b){Transform[_0x6306('0x3')](this,_0x29217b);this[_0x6306('0x4')]='';this[_0x6306('0x5')]=![];}util[_0x6306('0x6')](AGIReply,Transform);AGIReply[_0x6306('0x7')][_0x6306('0x8')]=function(_0x432e2d,_0x1d6c06,_0x455380){var _0x30863d='\x0a',_0x395702=['\x0a\x0a',_0x6306('0x9')],_0xf664c5=-0x1,_0x1c7f3e=-0x1,_0x5ea79d='',_0x1e07a2=0x0,_0x3def24='',_0x15b576='';this[_0x6306('0x4')]+=_0x432e2d[_0x6306('0xa')]();_0x3def24=this[_0x6306('0x4')];if(!this['_inBody']){_0x1e07a2=0x0;while(_0x395702[_0x1e07a2]){while((_0x1c7f3e=_0x3def24[_0x6306('0xb')](_0x395702[_0x1e07a2]))!=-0x1){_0x5ea79d=_0x395702[_0x1e07a2];_0x15b576=_0x3def24[_0x6306('0xc')](0x0,_0x1c7f3e);_0x3def24=_0x3def24['substring'](_0x1c7f3e+_0x5ea79d[_0x6306('0xd')]);var _0x6b8a2a=_0x15b576[_0x6306('0xe')](_0x30863d),_0x1621e5=0x0,_0x9ac0fb={},_0x166546='',_0x18344d='',_0x31bbef=-0x1;while(_0x6b8a2a[_0x1621e5]){_0x31bbef=_0x6b8a2a[_0x1621e5][_0x6306('0xb')](':');if(_0x31bbef!=-0x1){_0x166546=_0x6b8a2a[_0x1621e5]['slice'](0x0,_0x31bbef)[_0x6306('0xf')]();_0x18344d=_0x6b8a2a[_0x1621e5]['slice'](_0x31bbef+0x1)[_0x6306('0xf')]();if(_0x166546[_0x6306('0xd')]>0x0){_0x9ac0fb[_0x166546]=_0x18344d;}}else{}_0x1621e5++;}this[_0x6306('0x10')](_0x6306('0x11'),_0x9ac0fb);this[_0x6306('0x5')]=!![];}_0x1e07a2++;}this[_0x6306('0x4')]=_0x3def24;}else{while((_0xf664c5=_0x3def24['indexOf'](_0x30863d))!=-0x1){_0x15b576=_0x3def24[_0x6306('0xc')](0x0,_0xf664c5);this[_0x6306('0x10')](_0x6306('0x12'),_0x15b576);_0x3def24=_0x3def24[_0x6306('0xc')](_0xf664c5+_0x30863d['length']);}this[_0x6306('0x4')]=_0x3def24;}_0x455380();};module[_0x6306('0x13')]=AGIReply; \ No newline at end of file +var _0x7e12=['inherits','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','slice','trim','length','emit','headers','util','stream','call','_inBody'];(function(_0x4d45dd,_0x21fc83){var _0x4313d0=function(_0x5b4020){while(--_0x5b4020){_0x4d45dd['push'](_0x4d45dd['shift']());}};_0x4313d0(++_0x21fc83);}(_0x7e12,0x17c));var _0x27e1=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x7e12[_0x2555d0];return _0x3bb486;};'use strict';var util=require(_0x27e1('0x0'));var Transform=require(_0x27e1('0x1'))['Transform'];function AGIReply(_0x22264){Transform[_0x27e1('0x2')](this,_0x22264);this['_localBuffer']='';this[_0x27e1('0x3')]=![];}util[_0x27e1('0x4')](AGIReply,Transform);AGIReply['prototype'][_0x27e1('0x5')]=function(_0x58caeb,_0x5da441,_0x30e084){var _0x41b95a='\x0a',_0x2bd783=['\x0a\x0a',_0x27e1('0x6')],_0x4768ba=-0x1,_0x38d22c=-0x1,_0x23e772='',_0x382056=0x0,_0x112725='',_0x3afdd4='';this[_0x27e1('0x7')]+=_0x58caeb[_0x27e1('0x8')]();_0x112725=this[_0x27e1('0x7')];if(!this[_0x27e1('0x3')]){_0x382056=0x0;while(_0x2bd783[_0x382056]){while((_0x38d22c=_0x112725[_0x27e1('0x9')](_0x2bd783[_0x382056]))!=-0x1){_0x23e772=_0x2bd783[_0x382056];_0x3afdd4=_0x112725[_0x27e1('0xa')](0x0,_0x38d22c);_0x112725=_0x112725[_0x27e1('0xa')](_0x38d22c+_0x23e772['length']);var _0x50834c=_0x3afdd4['split'](_0x41b95a),_0x65bccd=0x0,_0x3af836={},_0x2efdd9='',_0xb4fa0c='',_0x37ee0e=-0x1;while(_0x50834c[_0x65bccd]){_0x37ee0e=_0x50834c[_0x65bccd][_0x27e1('0x9')](':');if(_0x37ee0e!=-0x1){_0x2efdd9=_0x50834c[_0x65bccd][_0x27e1('0xb')](0x0,_0x37ee0e)[_0x27e1('0xc')]();_0xb4fa0c=_0x50834c[_0x65bccd][_0x27e1('0xb')](_0x37ee0e+0x1)['trim']();if(_0x2efdd9[_0x27e1('0xd')]>0x0){_0x3af836[_0x2efdd9]=_0xb4fa0c;}}else{}_0x65bccd++;}this[_0x27e1('0xe')](_0x27e1('0xf'),_0x3af836);this['_inBody']=!![];}_0x382056++;}this[_0x27e1('0x7')]=_0x112725;}else{while((_0x4768ba=_0x112725['indexOf'](_0x41b95a))!=-0x1){_0x3afdd4=_0x112725[_0x27e1('0xa')](0x0,_0x4768ba);this[_0x27e1('0xe')]('line',_0x3afdd4);_0x112725=_0x112725['substring'](_0x4768ba+_0x41b95a[_0x27e1('0xd')]);}this['_localBuffer']=_0x112725;}_0x30e084();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 13f3f7f..652dcb4 100644 --- a/server/services/agi/rpc/index.js +++ b/server/services/agi/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee64=['ShowPause','agentLogin','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','jayson/promise','client','http','then','error','message','getSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','ShowTrunk','getSoundById','getIntervalById','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById'];(function(_0x3f5e74,_0x148df3){var _0xfdbd47=function(_0x1c717d){while(--_0x1c717d){_0x3f5e74['push'](_0x3f5e74['shift']());}};_0xfdbd47(++_0x148df3);}(_0xee64,0x15c));var _0x4ee6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xee64[_0x4b369d];return _0x571a98;};'use strict';var BPromise=require(_0x4ee6('0x0'));var moment=require(_0x4ee6('0x1'));var _=require(_0x4ee6('0x2'));var util=require('util');var jayson=require(_0x4ee6('0x3'));var client=jayson[_0x4ee6('0x4')][_0x4ee6('0x5')]({'port':0x2329});function request(_0x136a11,_0x392b07){return new BPromise(function(_0x376a33,_0x4c7581){return client['request'](_0x136a11,_0x392b07)[_0x4ee6('0x6')](function(_0x17713d){if(_0x17713d[_0x4ee6('0x7')]){return _0x4c7581(_0x17713d['error'][_0x4ee6('0x8')]);}else{return _0x376a33(_0x17713d['result']);}})['catch'](function(_0x4e560e){return _0x4c7581(_0x4e560e);});});}exports[_0x4ee6('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x4ee6('0xa')]}});};exports[_0x4ee6('0xb')]=function(_0x213cbe){return request(_0x4ee6('0xc'),{'options':{'raw':![],'where':{'name':_0x213cbe},'attributes':['production']}});};exports[_0x4ee6('0xd')]=function(_0x5aedc5){return request(_0x4ee6('0xe'),{'options':{'raw':![],'where':{'id':_0x5aedc5},'include':[{'model':_0x4ee6('0xf'),'as':_0x4ee6('0x10'),'include':[{'model':_0x4ee6('0x11'),'as':_0x4ee6('0x11')}]}],'attributes':['id',_0x4ee6('0x12'),_0x4ee6('0x13')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x27c0c0){return request('ShowSquareProject',{'options':{'where':{'id':_0x27c0c0},'attributes':[_0x4ee6('0x12')]}});};exports[_0x4ee6('0x14')]=function(_0x46d120){return request(_0x4ee6('0x15'),{'options':{'where':{'id':_0x46d120},'attributes':[_0x4ee6('0x12')]}});};exports[_0x4ee6('0x16')]=function(_0x3b97d5){return request('ShowVariable',{'options':{'where':{'id':_0x3b97d5},'attributes':[_0x4ee6('0x12')]}});};exports['getSquareOdbcById']=function(_0x47074f){return request(_0x4ee6('0x17'),{'options':{'where':{'id':_0x47074f},'attributes':[_0x4ee6('0x18')]}});};exports[_0x4ee6('0x19')]=function(_0x3f6bb7){return request(_0x4ee6('0x1a'),{'options':{'where':{'id':_0x3f6bb7},'attributes':[_0x4ee6('0x12')]}});};exports[_0x4ee6('0x1b')]=function(_0x4be165){return request('GetContactByPhone',{'options':{'where':{'phone':_0x4be165[_0x4ee6('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0xe70585){return request(_0x4ee6('0x1d'),{'options':{'where':{'id':_0xe70585},'attributes':['name']}});};exports[_0x4ee6('0x1e')]=function(_0x4a0a43){return request('ShowSound',{'options':{'where':{'id':_0x4a0a43},'attributes':['save_name']}});};exports[_0x4ee6('0x1f')]=function(_0x3ad6c4){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3ad6c4},'include':[{'model':_0x4ee6('0x20'),'as':'Intervals'}]}});};exports[_0x4ee6('0x21')]=function(_0x319cad){return request(_0x4ee6('0x22'),{'options':{'where':{'id':_0x319cad},'attributes':['id',_0x4ee6('0x12')]}});};exports[_0x4ee6('0x23')]=function(_0x19b92f){return request(_0x4ee6('0x24'),{'body':_0x19b92f});};exports[_0x4ee6('0x25')]=function(_0x28a28f){return request(_0x4ee6('0x26'),{'body':_0x28a28f});};exports[_0x4ee6('0x27')]=function(_0x51fcbd){return request(_0x4ee6('0x28'),{'body':_[_0x4ee6('0x29')](_0x51fcbd,{'project_name':_0x51fcbd[_0x4ee6('0x2a')],'prev_project_name':_0x51fcbd['arg_2']||'','is_subproject':_0x51fcbd['arg_2']?!![]:![],'leaveAt':moment()[_0x4ee6('0x2b')](_0x4ee6('0x2c'))})});};exports['createSquareRecording']=function(_0x53bf47){return request('CreateSquareRecording',{'body':_0x53bf47});};exports[_0x4ee6('0x2d')]=function(_0x4f2f60){return request(_0x4ee6('0x2e'),{'body':_0x4f2f60});};exports[_0x4ee6('0x2f')]=function(_0x3bbdbd){return request(_0x4ee6('0x30'),{'options':{'raw':![],'where':{'phone':_0x3bbdbd[_0x4ee6('0x1c')],'ListId':_0x3bbdbd[_0x4ee6('0x31')]}}})[_0x4ee6('0x6')](function(_0x59cf9e){if(_0x59cf9e){return _0x59cf9e;}return request('CreateCmContact',{'body':_0x3bbdbd});});};exports[_0x4ee6('0x32')]=function(_0x317811){return request(_0x4ee6('0x33'),{'options':{'where':{'id':_0x317811},'attributes':['name']}});};exports[_0x4ee6('0x34')]=function(_0x7fefdf,_0x33efac){return request('LoginUser',{'body':{'interface':_0x33efac},'options':{'where':_0x7fefdf}});};exports['agentPause']=function(_0x4e4e93,_0x420005,_0x1875f3){return request('PauseUser',{'body':{'type':_0x420005,'uniqueid':_0x1875f3},'options':{'where':_0x4e4e93}});};exports[_0x4ee6('0x35')]=function(_0x201178){return request(_0x4ee6('0x36'),{'body':{},'options':{'where':_0x201178}});};exports[_0x4ee6('0x37')]=function(_0x201424){return request(_0x4ee6('0x38'),{'body':{},'options':{'where':_0x201424}});}; \ No newline at end of file +var _0xad9c=['getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','name','production','getSquareProject','ShowMailAccount','Smtp','CloudProvider','getVoiceQueueById'];(function(_0x3d9361,_0x272ecc){var _0x5841a3=function(_0x3b0eb2){while(--_0x3b0eb2){_0x3d9361['push'](_0x3d9361['shift']());}};_0x5841a3(++_0x272ecc);}(_0xad9c,0x11c));var _0xcad9=function(_0x55d5c6,_0x27a2a8){_0x55d5c6=_0x55d5c6-0x0;var _0x486837=_0xad9c[_0x55d5c6];return _0x486837;};'use strict';var BPromise=require(_0xcad9('0x0'));var moment=require(_0xcad9('0x1'));var _=require(_0xcad9('0x2'));var util=require(_0xcad9('0x3'));var jayson=require(_0xcad9('0x4'));var client=jayson[_0xcad9('0x5')][_0xcad9('0x6')]({'port':0x2329});function request(_0x2e1072,_0x58fa99){return new BPromise(function(_0x135a2e,_0x25e677){return client[_0xcad9('0x7')](_0x2e1072,_0x58fa99)[_0xcad9('0x8')](function(_0x568dc9){if(_0x568dc9['error']){return _0x25e677(_0x568dc9[_0xcad9('0x9')][_0xcad9('0xa')]);}else{return _0x135a2e(_0x568dc9[_0xcad9('0xb')]);}})[_0xcad9('0xc')](function(_0x3b767c){return _0x25e677(_0x3b767c);});});}exports[_0xcad9('0xd')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xcad9('0xe'),_0xcad9('0xf')]}});};exports[_0xcad9('0x10')]=function(_0x495293){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x495293},'attributes':['production']}});};exports['getMailAccountById']=function(_0x173bd9){return request(_0xcad9('0x11'),{'options':{'raw':![],'where':{'id':_0x173bd9},'include':[{'model':'MailServerOut','as':_0xcad9('0x12'),'include':[{'model':_0xcad9('0x13'),'as':_0xcad9('0x13')}]}],'attributes':['id',_0xcad9('0xe'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x4da5e5){return request('ShowSquareProject',{'options':{'where':{'id':_0x4da5e5},'attributes':[_0xcad9('0xe')]}});};exports[_0xcad9('0x14')]=function(_0x28595e){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x28595e},'attributes':[_0xcad9('0xe')]}});};exports[_0xcad9('0x15')]=function(_0x487044){return request(_0xcad9('0x16'),{'options':{'where':{'id':_0x487044},'attributes':['name']}});};exports[_0xcad9('0x17')]=function(_0x30dfde){return request(_0xcad9('0x18'),{'options':{'where':{'id':_0x30dfde},'attributes':[_0xcad9('0x19')]}});};exports[_0xcad9('0x1a')]=function(_0x3b01f5){return request(_0xcad9('0x1b'),{'options':{'where':{'id':_0x3b01f5},'attributes':[_0xcad9('0xe')]}});};exports[_0xcad9('0x1c')]=function(_0x2d0d52){return request(_0xcad9('0x1d'),{'options':{'where':{'phone':_0x2d0d52['phone']},'attributes':['id']}});};exports[_0xcad9('0x1e')]=function(_0x4bb9f7){return request(_0xcad9('0x1f'),{'options':{'where':{'id':_0x4bb9f7},'attributes':['name']}});};exports['getSoundById']=function(_0x59932b){return request(_0xcad9('0x20'),{'options':{'where':{'id':_0x59932b},'attributes':[_0xcad9('0x21')]}});};exports['getIntervalById']=function(_0x45a641){return request(_0xcad9('0x22'),{'options':{'raw':![],'where':{'id':_0x45a641},'include':[{'model':_0xcad9('0x23'),'as':_0xcad9('0x24')}]}});};exports[_0xcad9('0x25')]=function(_0x155bd0){return request(_0xcad9('0x26'),{'options':{'where':{'id':_0x155bd0},'attributes':['id',_0xcad9('0xe')]}});};exports[_0xcad9('0x27')]=function(_0xdd2422){return request(_0xcad9('0x28'),{'body':_0xdd2422});};exports[_0xcad9('0x29')]=function(_0x253142){return request(_0xcad9('0x2a'),{'body':_0x253142});};exports[_0xcad9('0x2b')]=function(_0x4d6879){return request(_0xcad9('0x2c'),{'body':_['merge'](_0x4d6879,{'project_name':_0x4d6879[_0xcad9('0x2d')],'prev_project_name':_0x4d6879[_0xcad9('0x2e')]||'','is_subproject':_0x4d6879[_0xcad9('0x2e')]?!![]:![],'leaveAt':moment()[_0xcad9('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xcad9('0x30')]=function(_0xbdcf68){return request(_0xcad9('0x31'),{'body':_0xbdcf68});};exports[_0xcad9('0x32')]=function(_0x3504b5){return request(_0xcad9('0x33'),{'body':_0x3504b5});};exports['createCmContact']=function(_0x557664){return request(_0xcad9('0x34'),{'options':{'raw':![],'where':{'phone':_0x557664[_0xcad9('0x35')],'ListId':_0x557664[_0xcad9('0x36')]}}})[_0xcad9('0x8')](function(_0x120442){if(_0x120442){return _0x120442;}return request('CreateCmContact',{'body':_0x557664});});};exports[_0xcad9('0x37')]=function(_0xeade5f){return request('ShowPause',{'options':{'where':{'id':_0xeade5f},'attributes':[_0xcad9('0xe')]}});};exports[_0xcad9('0x38')]=function(_0x4849a8,_0x27c153){return request(_0xcad9('0x39'),{'body':{'interface':_0x27c153},'options':{'where':_0x4849a8}});};exports[_0xcad9('0x3a')]=function(_0x2bfa51,_0x4760e8,_0x40f11e){return request('PauseUser',{'body':{'type':_0x4760e8,'uniqueid':_0x40f11e},'options':{'where':_0x2bfa51}});};exports[_0xcad9('0x3b')]=function(_0x1b8c65){return request(_0xcad9('0x3c'),{'body':{},'options':{'where':_0x1b8c65}});};exports['agentLogout']=function(_0x37bfe3){return request('LogoutUser',{'body':{},'options':{'where':_0x37bfe3}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index 5e03158..e36f4f7 100644 --- a/server/services/agi/scripts/aws/index.js +++ b/server/services/agi/scripts/aws/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef17=['exports','./polly','./lex'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xef17,0x136));var _0x7ef1=function(_0x251741,_0x39ed62){_0x251741=_0x251741-0x0;var _0x44e644=_0xef17[_0x251741];return _0x44e644;};var polly=require(_0x7ef1('0x0'));var lex=require(_0x7ef1('0x1'));module[_0x7ef1('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4fb4=['./lex','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fb4,0x190));var _0x44fb=function(_0x2195ac,_0x1670c8){_0x2195ac=_0x2195ac-0x0;var _0x8bfa1d=_0x4fb4[_0x2195ac];return _0x8bfa1d;};var polly=require('./polly');var lex=require(_0x44fb('0x0'));module[_0x44fb('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 615b846..5c98453 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['exports','./lib/api'];(function(_0x403c57,_0x280a51){var _0x35fa69=function(_0x13a356){while(--_0x13a356){_0x403c57['push'](_0x403c57['shift']());}};_0x35fa69(++_0x280a51);}(_0x70e0,0x17b));var _0x070e=function(_0x5c8e2a,_0xff418c){_0x5c8e2a=_0x5c8e2a-0x0;var _0x3c2eae=_0x70e0[_0x5c8e2a];return _0x3c2eae;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ No newline at end of file +var _0xa571=['exports','./lib/api'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0xa571,0x107));var _0x1a57=function(_0x7633c,_0x1e45bf){_0x7633c=_0x7633c-0x0;var _0x1b77e2=_0xa571[_0x7633c];return _0x1b77e2;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index f371806..a766296 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x2a7ef9,_0x5f5c52){var _0x12e757=function(_0x1d01b3){while(--_0x1d01b3){_0x2a7ef9['push'](_0x2a7ef9['shift']());}};_0x12e757(++_0x5f5c52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x193cbf,_0x4f4a7e){var _0x5e4b2e=function(_0x1e6db3){while(--_0x1e6db3){_0x193cbf['push'](_0x193cbf['shift']());}};_0x5e4b2e(++_0x4f4a7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 3a2856c..f9eb101 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cbc=['./lib/api','exports'];(function(_0x4fcfbe,_0x107dc6){var _0x50b203=function(_0x3a9083){while(--_0x3a9083){_0x4fcfbe['push'](_0x4fcfbe['shift']());}};_0x50b203(++_0x107dc6);}(_0x1cbc,0x128));var _0xc1cb=function(_0x4441cf,_0x4509a6){_0x4441cf=_0x4441cf-0x0;var _0x3b8877=_0x1cbc[_0x4441cf];return _0x3b8877;};'use strict';var polly=require(_0xc1cb('0x0'));module[_0xc1cb('0x1')]=function(_0x516acd,_0x27242e,_0x11901b,_0x45cb4f,_0x410f94,_0x5e5e5a,_0x1e51c5){return polly(_0x516acd,_0x27242e,_0x11901b,_0x45cb4f,_0x410f94,_0x5e5e5a,_0x1e51c5);}; \ No newline at end of file +var _0xb5c9=['./lib/api'];(function(_0x22a33a,_0x4a7487){var _0x2d0a92=function(_0x4c27e2){while(--_0x4c27e2){_0x22a33a['push'](_0x22a33a['shift']());}};_0x2d0a92(++_0x4a7487);}(_0xb5c9,0x1ca));var _0x9b5c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb5c9[_0xbca1b1];return _0x4e1686;};'use strict';var polly=require(_0x9b5c('0x0'));module['exports']=function(_0x2bea80,_0x50b9b0,_0x80013f,_0x295eaa,_0x38a22c,_0x543b2a,_0x3cdcd4){return polly(_0x2bea80,_0x50b9b0,_0x80013f,_0x295eaa,_0x38a22c,_0x543b2a,_0x3cdcd4);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index 5084724..2bfc2af 100644 --- a/server/services/agi/scripts/aws/polly/lib/api.js +++ b/server/services/agi/scripts/aws/polly/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8021=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3'];(function(_0x46404f,_0x938479){var _0x1a0166=function(_0x5d58de){while(--_0x5d58de){_0x46404f['push'](_0x46404f['shift']());}};_0x1a0166(++_0x938479);}(_0x8021,0x1e0));var _0x1802=function(_0x11008e,_0x3c9be6){_0x11008e=_0x11008e-0x0;var _0x4ae70d=_0x8021[_0x11008e];return _0x4ae70d;};'use strict';var fs=require('fs');var path=require(_0x1802('0x0'));var BPromise=require(_0x1802('0x1'));var rs=require(_0x1802('0x2'));var AWS=require(_0x1802('0x3'));function pollyResult(_0x3795e3,_0x3a6df4,_0x1c1df1){return new BPromise(function(_0x33f5ad,_0xb9053e){_0x3795e3[_0x1802('0x4')](_0x3a6df4,function(_0x5d092e,_0x50c83c){if(_0x5d092e){_0xb9053e(_0x5d092e);}else if(_0x50c83c){if(_0x50c83c[_0x1802('0x5')]instanceof Buffer){fs[_0x1802('0x6')](_0x1c1df1,_0x50c83c['AudioStream'],function(_0x129f28){if(_0x129f28){_0xb9053e(_0x129f28);}else{_0x33f5ad();}});}else{_0xb9053e(new Error(_0x1802('0x7')));}}else{_0xb9053e(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x1802('0x8')]=function(_0xb66d0b,_0x5575b6,_0x54c4de,_0x8d3499,_0x56c395,_0x54b62e,_0x5b4077){var _0x42ee28=new AWS[(_0x1802('0x9'))]({'accessKeyId':_0xb66d0b,'secretAccessKey':_0x5575b6,'region':_0x54c4de});var _0x3c9422={'Text':_0x56c395,'TextType':_0x54b62e||_0x1802('0xa'),'OutputFormat':_0x1802('0xb'),'VoiceId':_0x8d3499};return pollyResult(_0x42ee28,_0x3c9422,_0x5b4077);}; \ No newline at end of file +var _0x57ac=['AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird','synthesizeSpeech'];(function(_0x4445c6,_0x48ddaa){var _0x136da6=function(_0x3bcc3f){while(--_0x3bcc3f){_0x4445c6['push'](_0x4445c6['shift']());}};_0x136da6(++_0x48ddaa);}(_0x57ac,0x141));var _0xc57a=function(_0x531722,_0x161aa9){_0x531722=_0x531722-0x0;var _0x3f1769=_0x57ac[_0x531722];return _0x3f1769;};'use strict';var fs=require('fs');var path=require(_0xc57a('0x0'));var BPromise=require(_0xc57a('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x27202a,_0x2ebf61,_0x1d2a38){return new BPromise(function(_0x47b7b9,_0x402c8d){_0x27202a[_0xc57a('0x2')](_0x2ebf61,function(_0x2a823d,_0x30f689){if(_0x2a823d){_0x402c8d(_0x2a823d);}else if(_0x30f689){if(_0x30f689[_0xc57a('0x3')]instanceof Buffer){fs[_0xc57a('0x4')](_0x1d2a38,_0x30f689[_0xc57a('0x3')],function(_0x344976){if(_0x344976){_0x402c8d(_0x344976);}else{_0x47b7b9();}});}else{_0x402c8d(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x402c8d(new Error(_0xc57a('0x5')));}});});}module[_0xc57a('0x6')]=function(_0x1a60d4,_0x3e7a4a,_0x10a1df,_0x53213b,_0x2ca1dd,_0x278149,_0x170dfb){var _0x1ec0ec=new AWS[(_0xc57a('0x7'))]({'accessKeyId':_0x1a60d4,'secretAccessKey':_0x3e7a4a,'region':_0x10a1df});var _0x18267d={'Text':_0x2ca1dd,'TextType':_0x278149||'text','OutputFormat':_0xc57a('0x8'),'VoiceId':_0x53213b};return pollyResult(_0x1ec0ec,_0x18267d,_0x170dfb);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index faf0ce5..7139009 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e59=['./lib/api'];(function(_0x5ed024,_0x4d28e0){var _0x485070=function(_0x30b098){while(--_0x30b098){_0x5ed024['push'](_0x5ed024['shift']());}};_0x485070(++_0x4d28e0);}(_0x2e59,0xb5));var _0x92e5=function(_0x1757f2,_0x1b09fa){_0x1757f2=_0x1757f2-0x0;var _0x5e7212=_0x2e59[_0x1757f2];return _0x5e7212;};'use strict';var asr=require(_0x92e5('0x0'));module['exports']=function(_0x4596e8,_0x348b82,_0x35b21d,_0x21c004){return asr(_0x4596e8,_0x348b82,_0x35b21d);}; \ No newline at end of file +var _0x339e=['exports'];(function(_0x579f2a,_0x46c6ac){var _0x260aac=function(_0x2fc829){while(--_0x2fc829){_0x579f2a['push'](_0x579f2a['shift']());}};_0x260aac(++_0x46c6ac);}(_0x339e,0xc0));var _0xe339=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0x339e[_0x2feb53];return _0x5700ee;};'use strict';var asr=require('./lib/api');module[_0xe339('0x0')]=function(_0x5422d6,_0x3c0270,_0x3ce3fa,_0x1698bd){return asr(_0x5422d6,_0x3c0270,_0x3ce3fa);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 2de33ad..3ec0a0c 100644 --- a/server/services/agi/scripts/google/asr/lib/api.js +++ b/server/services/agi/scripts/google/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb332=['readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','lang\x20should\x20be\x20a\x20string'];(function(_0x266f7d,_0x1b4e7f){var _0x44c322=function(_0x1d6158){while(--_0x1d6158){_0x266f7d['push'](_0x266f7d['shift']());}};_0x44c322(++_0x1b4e7f);}(_0xb332,0xd9));var _0x2b33=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0xb332[_0x3042c5];return _0x7cd140;};'use strict';var url=require(_0x2b33('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x2b33('0x1');module[_0x2b33('0x2')]=function(_0x5ee720,_0xf8c6a7,_0x548a70){return new BPromise(function(_0x1fe6b1,_0x4c6634){var _0x34b111;if(typeof _0x5ee720!=='string'||_0x5ee720[_0x2b33('0x3')]===0x0){return _0x4c6634(_0x2b33('0x4'));}if(typeof _0xf8c6a7!==_0x2b33('0x5')||_0xf8c6a7[_0x2b33('0x3')]===0x0){return _0x4c6634('key\x20should\x20be\x20a\x20string');}if(typeof _0x548a70!=='undefined'&&(typeof _0x548a70!==_0x2b33('0x5')||_0x548a70['length']===0x0)){return _0x4c6634(_0x2b33('0x6'));}try{_0x34b111=fs[_0x2b33('0x7')](_0x5ee720)[_0x2b33('0x8')](_0x2b33('0x9'));}catch(_0x5834bb){return _0x4c6634(_0x5834bb);}return _0x1fe6b1({'method':_0x2b33('0xa'),'uri':host+_0x2b33('0xb')+_0xf8c6a7,'body':{'config':{'encoding':_0x2b33('0xc'),'sampleRateHertz':_0x2b33('0xd'),'languageCode':_0x548a70},'audio':{'content':_0x34b111}},'json':!![]});});}; \ No newline at end of file +var _0xe28e=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','length'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe28e,0x1ba));var _0xee28=function(_0x55fda3,_0x5f10f5){_0x55fda3=_0x55fda3-0x0;var _0x8d0d7a=_0xe28e[_0x55fda3];return _0x8d0d7a;};'use strict';var url=require(_0xee28('0x0'));var BPromise=require(_0xee28('0x1'));var fs=require('fs');var host=_0xee28('0x2');module[_0xee28('0x3')]=function(_0x415017,_0x117a12,_0x3e541a){return new BPromise(function(_0x9f2216,_0xdc22c0){var _0x40fdf8;if(typeof _0x415017!==_0xee28('0x4')||_0x415017[_0xee28('0x5')]===0x0){return _0xdc22c0(_0xee28('0x6'));}if(typeof _0x117a12!=='string'||_0x117a12[_0xee28('0x5')]===0x0){return _0xdc22c0(_0xee28('0x7'));}if(typeof _0x3e541a!==_0xee28('0x8')&&(typeof _0x3e541a!==_0xee28('0x4')||_0x3e541a[_0xee28('0x5')]===0x0)){return _0xdc22c0(_0xee28('0x9'));}try{_0x40fdf8=fs[_0xee28('0xa')](_0x415017)['toString']('base64');}catch(_0x561fe4){return _0xdc22c0(_0x561fe4);}return _0x9f2216({'method':_0xee28('0xb'),'uri':host+_0xee28('0xc')+_0x117a12,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xee28('0xd'),'languageCode':_0x3e541a},'audio':{'content':_0x40fdf8}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 85752a0..5b2d913 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x235a=['./asr'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x235a,0xb4));var _0xa235=function(_0x292538,_0x220366){_0x292538=_0x292538-0x0;var _0x4ccb3c=_0x235a[_0x292538];return _0x4ccb3c;};var asr=require(_0xa235('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x440f=['exports'];(function(_0x2fd627,_0x4fdbcf){var _0x3c469a=function(_0x239d7d){while(--_0x239d7d){_0x2fd627['push'](_0x2fd627['shift']());}};_0x3c469a(++_0x4fdbcf);}(_0x440f,0xaf));var _0xf440=function(_0x4cd0da,_0x19d59d){_0x4cd0da=_0x4cd0da-0x0;var _0x3ff50d=_0x440f[_0x4cd0da];return _0x3ff50d;};var asr=require('./asr');module[_0xf440('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 5bf3c52..1d7392d 100644 --- a/server/services/agi/scripts/index.js +++ b/server/services/agi/scripts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96f9=['[%s]\x20%s:%s','name','message','result','source','action','actionIncomplete','fulfillment','code','metadata','endConversation','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','sox','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','pipe','end','host','data','transcode','wav','error\x20convert','start','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','POST','tmp','generate','.mp3','from','audioContent','writeFile','resolve','googleCloudTTS\x20path','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.wav','goggleTTS\x20path','googleASR','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription'];(function(_0x36fa72,_0x2db1de){var _0x30073d=function(_0x576907){while(--_0x576907){_0x36fa72['push'](_0x36fa72['shift']());}};_0x30073d(++_0x2db1de);}(_0x96f9,0x147));var _0x996f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x96f9[_0x4565bf];return _0x5610ba;};'use strict';var apiai=require(_0x996f('0x0'));var BPromise=require(_0x996f('0x1'));var dialogflow=require(_0x996f('0x2'));var fs=require('fs');var http=require(_0x996f('0x3'));var https=require(_0x996f('0x4'));var md5=require(_0x996f('0x5'));var path=require('path');var querystring=require(_0x996f('0x6'));var rp=require(_0x996f('0x7'));var rs=require('randomstring');var sox=require(_0x996f('0x8'));var tts=require('google-tts-api');var urlParse=require(_0x996f('0x9'))[_0x996f('0xa')];var util=require(_0x996f('0xb'));var aws=require('./aws');var google=require(_0x996f('0xc'));var sestek=require(_0x996f('0xd'));var tilde=require(_0x996f('0xe'));var logger=require(_0x996f('0xf'))(_0x996f('0x10'));var ISPEECH_API=_0x996f('0x11');function downloadFile(_0x8574d4,_0x270f1b){return new BPromise(function(_0x3d61bd,_0x39aa4f){var _0x28f152=urlParse(_0x8574d4);var _0x2cb6ed=_0x28f152[_0x996f('0x12')]===_0x996f('0x13')?https:http;var _0x5ae4f7={'host':_0x28f152['host'],'path':_0x28f152[_0x996f('0x14')],'headers':{'user-agent':_0x996f('0x15')}};_0x2cb6ed[_0x996f('0x16')](_0x5ae4f7,function(_0x49588a){if(_0x49588a[_0x996f('0x17')]!==0xc8){logger[_0x996f('0x18')](_0x996f('0x19')+_0x8574d4+_0x996f('0x1a')+_0x49588a[_0x996f('0x17')]+'\x20('+_0x49588a[_0x996f('0x1b')]+')');_0x39aa4f(new Error('request\x20to\x20'+_0x8574d4+'\x20failed,\x20status\x20code\x20=\x20'+_0x49588a[_0x996f('0x17')]+'\x20('+_0x49588a[_0x996f('0x1b')]+')'));return;}var _0x4657b3=fs['createWriteStream'](_0x270f1b);_0x4657b3['on'](_0x996f('0x1c'),function(){logger[_0x996f('0x1d')](_0x996f('0x1e'));_0x4657b3[_0x996f('0x1f')](_0x3d61bd);});_0x4657b3['on']('error',function(_0xc58ab4){fs[_0x996f('0x20')](_0x270f1b);logger[_0x996f('0x18')]('download\x20error',_0xc58ab4);_0x39aa4f(_0xc58ab4);});_0x49588a[_0x996f('0x21')](_0x4657b3);})['on'](_0x996f('0x18'),function(_0xbead3f){logger[_0x996f('0x18')](_0xbead3f);_0x39aa4f(_0xbead3f);})[_0x996f('0x22')]();});}function uploadFile(_0x487723){return new BPromise(function(_0x5a66d0,_0x5cc819){var _0x21ef56=urlParse(_0x487723);var _0x240eca=_0x21ef56['protocol']===_0x996f('0x13')?https:http;var _0x48dba5={'host':_0x21ef56[_0x996f('0x23')],'path':_0x21ef56['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x240eca[_0x996f('0x16')](_0x48dba5,function(_0x445e5a){if(_0x445e5a[_0x996f('0x17')]!==0xc8){_0x5cc819(new Error(_0x996f('0x19')+_0x487723+'\x20failed,\x20status\x20code\x20=\x20'+_0x445e5a['statusCode']+'\x20('+_0x445e5a[_0x996f('0x1b')]+')'));return;}var _0x52da66='';_0x445e5a['on'](_0x996f('0x24'),function(_0x40baaf){_0x52da66+=_0x40baaf;});_0x445e5a['on'](_0x996f('0x22'),function(){_0x5a66d0(_0x52da66);});})['on']('error',function(_0x487657){_0x5cc819(_0x487657);})[_0x996f('0x22')]();});}function convertFile(_0x489630,_0x3ce34c){return new BPromise(function(_0x23b138,_0x141ff5){var _0x44b6be=sox[_0x996f('0x25')](_0x489630,_0x3ce34c,{'sampleRate':0x1f40,'format':_0x996f('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x44b6be['on'](_0x996f('0x18'),function(_0x18e155){logger['error'](_0x996f('0x27'),_0x18e155);_0x141ff5(_0x18e155);});_0x44b6be['on'](_0x996f('0x22'),function(){logger[_0x996f('0x1d')]('finish\x20to\x20convert');_0x23b138();});_0x44b6be[_0x996f('0x28')]();});}function base64Decode(_0x47004e,_0x27d8a2){var _0x2d1fc8=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');fs[_0x996f('0x29')](_0x2d1fc8,_0x47004e,_0x996f('0x2a'));return convertFile(_0x2d1fc8,_0x27d8a2)[_0x996f('0x2b')](function(){try{fs[_0x996f('0x20')](_0x2d1fc8);fs[_0x996f('0x2c')](_0x27d8a2,_0x996f('0x2d'));}catch(_0x35cc31){logger['error'](_0x35cc31);}return _0x27d8a2[_0x996f('0x2e')]('.')[0x0];});}function base64Encode(_0x427120){var _0x10e55f=fs[_0x996f('0x2f')](_0x427120);return new Buffer(_0x10e55f)[_0x996f('0x30')](_0x996f('0x2a'));}exports[_0x996f('0x31')]=function(_0x4ad0d5,_0x58997c,_0x360509,_0x37afd7,_0x3f4565,_0x44dbab){var _0x4341a5,_0x2cfc24;var _0x55365d=_0x996f('0x32');var _0x61986b=_0x996f('0x33')+_0x4ad0d5;var _0x2424b5={};if(_0x58997c===_0x996f('0x34')){_0x2424b5[_0x996f('0x35')]={'ssml':_0x360509};}else{_0x2424b5[_0x996f('0x35')]={'text':_0x360509};};_0x2424b5[_0x996f('0x36')]={'languageCode':_0x37afd7,'ssmlGender':_0x3f4565};_0x2424b5['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x48503a={'url':_0x55365d+'text:synthesize'+_0x61986b,'method':_0x996f('0x37'),'json':!![],'body':_0x2424b5};return rp(_0x48503a)[_0x996f('0x2b')](function(_0x5506fb){return new BPromise(function(_0x422831,_0x58f8ec){_0x4341a5=path['resolve'](__dirname,_0x996f('0x38'),rs[_0x996f('0x39')](0x4)+_0x996f('0x3a'));var _0x1656a2=Buffer[_0x996f('0x3b')](_0x5506fb[_0x996f('0x3c')],_0x996f('0x2a'));return fs[_0x996f('0x3d')](_0x4341a5,_0x1656a2,function(_0x50387d){_0x58f8ec(_0x50387d);},function(_0x4242a2){fs['chmodSync'](_0x4341a5,_0x996f('0x2d'));_0x422831(_0x4242a2);});});})['then'](function(_0x2dc12c){_0x2cfc24=path[_0x996f('0x3e')](__dirname,_0x996f('0x38'),rs['generate'](0x4)+'.wav');return convertFile(_0x4341a5,_0x2cfc24);})['then'](function(){try{fs[_0x996f('0x20')](_0x4341a5);fs['chmodSync'](_0x2cfc24,_0x996f('0x2d'));}catch(_0x22eefb){logger[_0x996f('0x18')](_0x22eefb);}logger[_0x996f('0x1d')](_0x996f('0x3f'),_0x2cfc24[_0x996f('0x2e')]('.')[0x0]);return _0x2cfc24[_0x996f('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0xf18a70,_0x2c59ca){var _0x5bab8c='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x29d1bd,_0x302c70;var _0x15d322;var _0x9905ed={'encoding':_0x996f('0x40'),'method':'POST','timeout':0x2710,'url':_0x5bab8c,'headers':{'Content-Type':_0x996f('0x41')},'body':_0x996f('0x42')+encodeURIComponent(JSON[_0x996f('0x43')]([[[_0x996f('0x44'),JSON[_0x996f('0x43')]([_0xf18a70,_0x2c59ca||'en',![],_0x996f('0x45')]),null,_0x996f('0x46')]]]))};return rp(_0x9905ed)[_0x996f('0x2b')](function(_0x2e16a2){try{_0x15d322=eval(_0x2e16a2[_0x996f('0x47')](0x5))[0x0][0x2];}catch(_0x39ae94){throw new Error(_0x996f('0x48')+_0x2e16a2[_0x996f('0x24')]);}if(!_0x15d322){if(_0xf18a70[_0x996f('0x49')]>0xc8){throw new Error(_0x996f('0x4a'));}else{throw new Error(_0x996f('0x4b')+_0x2c59ca+_0x996f('0x4c'));}}try{_0x15d322=eval(_0x15d322)[0x0];}catch(_0x182373){throw new Error(_0x996f('0x48')+res[_0x996f('0x24')]);}const _0x5a3128=_0x15d322;_0x29d1bd=path[_0x996f('0x3e')](__dirname,_0x996f('0x38'),rs[_0x996f('0x39')](0x4)+_0x996f('0x3a'));fs[_0x996f('0x29')](_0x29d1bd,_0x15d322,{'encoding':_0x996f('0x2a')});_0x302c70=path[_0x996f('0x3e')](__dirname,_0x996f('0x38'),rs[_0x996f('0x39')](0x4)+_0x996f('0x4d'));return convertFile(_0x29d1bd,_0x302c70);})['then'](function(){try{fs['unlink'](_0x29d1bd);fs[_0x996f('0x2c')](_0x302c70,_0x996f('0x2d'));}catch(_0x56e0b3){logger[_0x996f('0x18')](_0x56e0b3);}logger['info'](_0x996f('0x4e'),_0x302c70[_0x996f('0x2e')]('.')[0x0]);return _0x302c70[_0x996f('0x2e')]('.')[0x0];});};exports[_0x996f('0x4f')]=function(_0x154025,_0x2c46eb,_0x36cf69){return google['asr'](_0x154025,_0x2c46eb,_0x36cf69)[_0x996f('0x2b')](function(_0xee1ec0){logger['info'](_0xee1ec0['uri']);return rp(_0xee1ec0);})[_0x996f('0x2b')](function(_0x31e4d6){var _0x32e9f2='';var _0x64f24d=0x0;try{fs['unlink'](_0x154025);}catch(_0x29bde4){logger[_0x996f('0x18')](_0x29bde4);}if(_0x31e4d6&&_0x31e4d6[_0x996f('0x50')]){_0x32e9f2=_0x31e4d6[_0x996f('0x50')][_0x996f('0x51')](function(_0x3b39d8){return _0x3b39d8&&_0x3b39d8[_0x996f('0x52')][0x0]&&_0x3b39d8[_0x996f('0x52')][0x0][_0x996f('0x53')]?_0x3b39d8['alternatives'][0x0][_0x996f('0x53')]:'';})[_0x996f('0x54')]('\x0a');_0x64f24d=_0x31e4d6['results'][_0x996f('0x51')](function(_0x3b54aa){return _0x3b54aa&&_0x3b54aa['alternatives'][0x0]&&_0x3b54aa['alternatives'][0x0][_0x996f('0x55')]?_0x3b54aa['alternatives'][0x0][_0x996f('0x55')]:0x0;})[_0x996f('0x54')]('\x0a');}logger[_0x996f('0x1d')](_0x996f('0x56'),_0x32e9f2);logger['info']('googleASR\x20confidence',_0x64f24d);return{'transcript':_0x32e9f2,'confidence':_0x64f24d};})['catch'](function(_0x5817e8){logger[_0x996f('0x18')](_0x996f('0x57'),_0x5817e8['statusCode'],_0x5817e8[_0x996f('0x58')],_0x5817e8[_0x996f('0x59')]);});};exports['googleDialogflow']=function(_0xb57296,_0x5401b1,_0x5d99d8,_0x31065a){var _0x46573c=apiai(_0x5401b1,{'language':_0x31065a||'en'});return _0x46573c['textRequest'](_0x5d99d8,{'sessionId':md5(_0xb57296)})[_0x996f('0x2b')](function(_0x31b4fb){logger[_0x996f('0x1d')](JSON[_0x996f('0x43')](_0x31b4fb));return{'source':_0x31b4fb[_0x996f('0x5a')][_0x996f('0x5b')],'resolvedQuery':_0x31b4fb[_0x996f('0x5a')]['resolvedQuery'],'action':_0x31b4fb['result'][_0x996f('0x5c')],'actionIncomplete':_0x31b4fb[_0x996f('0x5a')][_0x996f('0x5d')],'speech':_0x31b4fb[_0x996f('0x5a')][_0x996f('0x5e')]['speech'],'score':_0x31b4fb[_0x996f('0x5a')]['score'],'statusCode':_0x31b4fb['status'][_0x996f('0x5f')],'endConversation':_0x31b4fb[_0x996f('0x5a')][_0x996f('0x60')][_0x996f('0x61')]||![],'isFallbackIntent':_0x31b4fb[_0x996f('0x5a')][_0x996f('0x60')]['isFallbackIntent']};});};exports[_0x996f('0x62')]=function(_0x2166c7,_0x1fd629,_0x3c31a2,_0x55f9ff,_0x3f55f6,_0x341cc1){var _0x3392bc=_0x55f9ff[_0x996f('0x63')](/\\n/g,'\x0a');var _0x2ad1ba={'credentials':{'private_key':_0x3392bc,'client_email':_0x3c31a2}};var _0x39b08b=new dialogflow['SessionsClient'](_0x2ad1ba);var _0x1c8b0d=_0x39b08b[_0x996f('0x64')](_0x1fd629,md5(_0x2166c7));var _0x8dbe33={'session':_0x1c8b0d,'queryInput':{'text':{'text':_0x3f55f6,'languageCode':_0x341cc1}}};return _0x39b08b[_0x996f('0x65')](_0x8dbe33)[_0x996f('0x2b')](function(_0x359c4b){if(_0x359c4b&&_0x359c4b['length']){logger['info'](_0x996f('0x66'),JSON[_0x996f('0x43')](_0x359c4b));var _0x1ece1e=_0x359c4b[0x0];if(_0x1ece1e){var _0x37d6dd={'action':_0x1ece1e['queryResult']['action'],'allRequiredParamsPresent':_0x1ece1e[_0x996f('0x67')][_0x996f('0x68')],'endConversation':_0x1ece1e[_0x996f('0x67')]['diagnosticInfo']&&_0x1ece1e[_0x996f('0x67')]['diagnosticInfo']['fields']?_0x1ece1e[_0x996f('0x67')][_0x996f('0x69')][_0x996f('0x6a')][_0x996f('0x6b')][_0x996f('0x6c')]:![],'fulfillmentText':_0x1ece1e[_0x996f('0x67')][_0x996f('0x6d')],'intentName':_0x1ece1e['queryResult'][_0x996f('0x6e')][_0x996f('0x58')],'intentDisplayName':_0x1ece1e[_0x996f('0x67')][_0x996f('0x6e')][_0x996f('0x6f')],'isFallbackIntent':_0x1ece1e[_0x996f('0x67')]['intent'][_0x996f('0x70')],'languageCode':_0x1ece1e[_0x996f('0x67')][_0x996f('0x71')],'queryText':_0x1ece1e['queryResult'][_0x996f('0x72')],'responseId':_0x1ece1e[_0x996f('0x73')],'score':_0x1ece1e['queryResult'][_0x996f('0x74')],'speech':_0x1ece1e['queryResult'][_0x996f('0x6d')],'providerResponse':JSON[_0x996f('0x43')](_0x359c4b)};return _0x37d6dd;}}});};exports[_0x996f('0x75')]=function(_0xa3ff3f,_0x219280,_0x1837b3,_0x45083c){return tilde['asr'](_0xa3ff3f,_0x219280,_0x1837b3,_0x45083c)[_0x996f('0x2b')](function(_0x5f0d01){try{fs[_0x996f('0x20')](_0xa3ff3f);}catch(_0x284488){logger[_0x996f('0x18')](_0x284488);}logger['info'](_0x996f('0x76'),_0x5f0d01[_0x996f('0x53')]);logger[_0x996f('0x1d')](_0x996f('0x77'),_0x5f0d01['confidence']);return _0x5f0d01;});};exports[_0x996f('0x78')]=function(_0x2a013e,_0x1800f9,_0x487b8b,_0x1bfd91,_0x2795d1,_0x322f37){var _0x39d60a=path['resolve'](__dirname,_0x996f('0x38'),rs[_0x996f('0x39')](0x4)+_0x996f('0x3a'));var _0xe4afd4;return aws[_0x996f('0x79')](_0x2a013e,_0x1800f9,_0x487b8b,_0x1bfd91,_0x2795d1,_0x322f37,_0x39d60a)[_0x996f('0x2b')](function(){_0xe4afd4=path[_0x996f('0x3e')](__dirname,_0x996f('0x38'),rs[_0x996f('0x39')](0x4)+'.wav');return convertFile(_0x39d60a,_0xe4afd4);})[_0x996f('0x2b')](function(){try{fs[_0x996f('0x20')](_0x39d60a);fs[_0x996f('0x2c')](_0xe4afd4,'777');}catch(_0x20524b){logger['error'](_0x20524b);}return _0xe4afd4[_0x996f('0x2e')]('.')[0x0];});};exports[_0x996f('0x7a')]=function(_0x377d4d,_0x1f3614,_0x3a6e99,_0x353567,_0x4ba9c0,_0x3b4891){return aws[_0x996f('0x7b')](_0x377d4d,_0x1f3614,_0x3a6e99,_0x353567,_0x4ba9c0,_0x3b4891)['then'](function(_0x491a3c){logger[_0x996f('0x1d')](JSON[_0x996f('0x43')](_0x491a3c));return _0x491a3c;});};exports[_0x996f('0x7c')]=function(_0x1a92f5,_0x15a12b,_0x4346d3,_0x71cd6a){var _0x16c685=util[_0x996f('0x7d')](_0x996f('0x7e'),ISPEECH_API,_0x1a92f5,encodeURIComponent(_0x15a12b),_0x4346d3,_0x71cd6a);var _0x2aa0f4=path[_0x996f('0x3e')](__dirname,'tmp',rs[_0x996f('0x39')](0x4)+'.mp3');var _0x23d9ed;return downloadFile(_0x16c685,_0x2aa0f4)[_0x996f('0x2b')](function(){_0x23d9ed=path[_0x996f('0x3e')](__dirname,'tmp',rs[_0x996f('0x39')](0x4)+_0x996f('0x4d'));return convertFile(_0x2aa0f4,_0x23d9ed);})['then'](function(){try{fs['unlink'](_0x2aa0f4);fs[_0x996f('0x2c')](_0x23d9ed,_0x996f('0x2d'));}catch(_0x437c67){logger['error'](_0x437c67);}return _0x23d9ed[_0x996f('0x2e')]('.')[0x0];});};exports[_0x996f('0x7f')]=function(_0x525e62,_0x33d124,_0x2457b0,_0x32a86e){var _0x4b6457=util[_0x996f('0x7d')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x33d124,_0x2457b0,base64Encode(_0x525e62),_0x32a86e?util[_0x996f('0x7d')](_0x996f('0x80'),encodeURIComponent(_0x32a86e)):_0x996f('0x81'));return uploadFile(_0x4b6457)[_0x996f('0x2b')](function(_0x5396f8){return querystring[_0x996f('0xa')](_0x5396f8);});};exports[_0x996f('0x82')]=function(_0x5d2c90,_0x54e803){return sestek[_0x996f('0x83')](_0x5d2c90,_0x54e803)['then'](function(_0x23d60c){logger[_0x996f('0x1d')](JSON[_0x996f('0x43')](_0x23d60c));var _0x235c45={'speech':_0x23d60c['text'],'action':_0x23d60c['channelData']?_0x23d60c[_0x996f('0x84')][_0x996f('0x85')]:undefined,'actiondata':_0x23d60c[_0x996f('0x84')]?_0x23d60c['channelData'][_0x996f('0x86')]:undefined};if(_0x23d60c[_0x996f('0x84')]&&_0x23d60c['channelData'][_0x996f('0x87')]){return base64Decode(_0x23d60c[_0x996f('0x84')][_0x996f('0x87')]['Data'],path[_0x996f('0x3e')](__dirname,_0x996f('0x38'),rs[_0x996f('0x39')](0x4)+'.wav'))['then'](function(_0x277a81){_0x235c45[_0x996f('0x88')]=_0x277a81;return _0x235c45;});}return _0x235c45;});};exports[_0x996f('0x89')]=function(){return __dirname;}; \ No newline at end of file +var _0x8718=['channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','http','md5','path','querystring','request-promise','randomstring','google-tts-api','url','parse','util','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','host','statusMessage','data','transcode','error\x20convert','info','finish\x20to\x20convert','start','generate','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','tmp','.mp3','from','audioContent','writeFile','777','resolve','.wav','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','transcript','alternatives','join','googleASR\x20confidence','[%s]\x20%s:%s','message','textRequest','result','source','resolvedQuery','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','intent','isFallback','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','confidence','awsPolly','polly','awsLex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x8718,0x118));var _0x8871=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x8718[_0x1fa759];return _0x2da9f4;};'use strict';var apiai=require(_0x8871('0x0'));var BPromise=require(_0x8871('0x1'));var dialogflow=require(_0x8871('0x2'));var fs=require('fs');var http=require(_0x8871('0x3'));var https=require('https');var md5=require(_0x8871('0x4'));var path=require(_0x8871('0x5'));var querystring=require(_0x8871('0x6'));var rp=require(_0x8871('0x7'));var rs=require(_0x8871('0x8'));var sox=require('sox');var tts=require(_0x8871('0x9'));var urlParse=require(_0x8871('0xa'))[_0x8871('0xb')];var util=require(_0x8871('0xc'));var aws=require('./aws');var google=require('./google');var sestek=require(_0x8871('0xd'));var tilde=require(_0x8871('0xe'));var logger=require(_0x8871('0xf'))('agi');var ISPEECH_API=_0x8871('0x10');function downloadFile(_0x5b57fb,_0x2e751a){return new BPromise(function(_0x3be563,_0x49796e){var _0x1d51e2=urlParse(_0x5b57fb);var _0x3c652d=_0x1d51e2[_0x8871('0x11')]===_0x8871('0x12')?https:http;var _0x46d5ac={'host':_0x1d51e2['host'],'path':_0x1d51e2['path'],'headers':{'user-agent':_0x8871('0x13')}};_0x3c652d[_0x8871('0x14')](_0x46d5ac,function(_0x5a0199){if(_0x5a0199[_0x8871('0x15')]!==0xc8){logger[_0x8871('0x16')](_0x8871('0x17')+_0x5b57fb+'\x20failed,\x20status\x20code\x20=\x20'+_0x5a0199[_0x8871('0x15')]+'\x20('+_0x5a0199['statusMessage']+')');_0x49796e(new Error(_0x8871('0x17')+_0x5b57fb+_0x8871('0x18')+_0x5a0199[_0x8871('0x15')]+'\x20('+_0x5a0199['statusMessage']+')'));return;}var _0x38fae7=fs[_0x8871('0x19')](_0x2e751a);_0x38fae7['on'](_0x8871('0x1a'),function(){logger['info'](_0x8871('0x1b'));_0x38fae7[_0x8871('0x1c')](_0x3be563);});_0x38fae7['on']('error',function(_0x39eed8){fs[_0x8871('0x1d')](_0x2e751a);logger[_0x8871('0x16')](_0x8871('0x1e'),_0x39eed8);_0x49796e(_0x39eed8);});_0x5a0199[_0x8871('0x1f')](_0x38fae7);})['on']('error',function(_0x578f5b){logger[_0x8871('0x16')](_0x578f5b);_0x49796e(_0x578f5b);})[_0x8871('0x20')]();});}function uploadFile(_0x410fde){return new BPromise(function(_0x52ff79,_0x525abf){var _0x5675b4=urlParse(_0x410fde);var _0x2d2501=_0x5675b4['protocol']===_0x8871('0x12')?https:http;var _0x14a268={'host':_0x5675b4[_0x8871('0x21')],'path':_0x5675b4[_0x8871('0x5')],'headers':{'user-agent':_0x8871('0x13')}};_0x2d2501['get'](_0x14a268,function(_0x1b8115){if(_0x1b8115['statusCode']!==0xc8){_0x525abf(new Error(_0x8871('0x17')+_0x410fde+'\x20failed,\x20status\x20code\x20=\x20'+_0x1b8115[_0x8871('0x15')]+'\x20('+_0x1b8115[_0x8871('0x22')]+')'));return;}var _0xcdfcec='';_0x1b8115['on'](_0x8871('0x23'),function(_0x5b92b7){_0xcdfcec+=_0x5b92b7;});_0x1b8115['on']('end',function(){_0x52ff79(_0xcdfcec);});})['on'](_0x8871('0x16'),function(_0x314250){_0x525abf(_0x314250);})[_0x8871('0x20')]();});}function convertFile(_0x113827,_0x17387f){return new BPromise(function(_0x1eab1b,_0x5a39ab){var _0x392dee=sox[_0x8871('0x24')](_0x113827,_0x17387f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x392dee['on'](_0x8871('0x16'),function(_0x550742){logger[_0x8871('0x16')](_0x8871('0x25'),_0x550742);_0x5a39ab(_0x550742);});_0x392dee['on'](_0x8871('0x20'),function(){logger[_0x8871('0x26')](_0x8871('0x27'));_0x1eab1b();});_0x392dee[_0x8871('0x28')]();});}function base64Decode(_0x499b8e,_0x592e57){var _0x2b3651=path['resolve'](__dirname,'tmp',rs[_0x8871('0x29')](0x4)+'.wav');fs[_0x8871('0x2a')](_0x2b3651,_0x499b8e,_0x8871('0x2b'));return convertFile(_0x2b3651,_0x592e57)[_0x8871('0x2c')](function(){try{fs['unlink'](_0x2b3651);fs[_0x8871('0x2d')](_0x592e57,'777');}catch(_0x3ba807){logger[_0x8871('0x16')](_0x3ba807);}return _0x592e57[_0x8871('0x2e')]('.')[0x0];});}function base64Encode(_0x2a462b){var _0x45af7c=fs[_0x8871('0x2f')](_0x2a462b);return new Buffer(_0x45af7c)[_0x8871('0x30')](_0x8871('0x2b'));}exports[_0x8871('0x31')]=function(_0x475854,_0x2bdce5,_0x345fc6,_0x51c7fe,_0x23ea7d,_0x5d69b5){var _0x2ec833,_0x479539;var _0x10c268=_0x8871('0x32');var _0x2182b1=_0x8871('0x33')+_0x475854;var _0x5666e4={};if(_0x2bdce5===_0x8871('0x34')){_0x5666e4[_0x8871('0x35')]={'ssml':_0x345fc6};}else{_0x5666e4[_0x8871('0x35')]={'text':_0x345fc6};};_0x5666e4[_0x8871('0x36')]={'languageCode':_0x51c7fe,'ssmlGender':_0x23ea7d};_0x5666e4[_0x8871('0x37')]={'audioEncoding':_0x8871('0x38'),'sampleRateHertz':0x1f40};var _0x28ce3a={'url':_0x10c268+'text:synthesize'+_0x2182b1,'method':_0x8871('0x39'),'json':!![],'body':_0x5666e4};return rp(_0x28ce3a)[_0x8871('0x2c')](function(_0x289582){return new BPromise(function(_0x1d5041,_0x24db55){_0x2ec833=path['resolve'](__dirname,_0x8871('0x3a'),rs[_0x8871('0x29')](0x4)+_0x8871('0x3b'));var _0x9de691=Buffer[_0x8871('0x3c')](_0x289582[_0x8871('0x3d')],_0x8871('0x2b'));return fs[_0x8871('0x3e')](_0x2ec833,_0x9de691,function(_0x513250){_0x24db55(_0x513250);},function(_0x14f35e){fs[_0x8871('0x2d')](_0x2ec833,_0x8871('0x3f'));_0x1d5041(_0x14f35e);});});})['then'](function(_0x1310a6){_0x479539=path[_0x8871('0x40')](__dirname,_0x8871('0x3a'),rs['generate'](0x4)+_0x8871('0x41'));return convertFile(_0x2ec833,_0x479539);})[_0x8871('0x2c')](function(){try{fs[_0x8871('0x1d')](_0x2ec833);fs[_0x8871('0x2d')](_0x479539,_0x8871('0x3f'));}catch(_0x3fedda){logger[_0x8871('0x16')](_0x3fedda);}logger[_0x8871('0x26')](_0x8871('0x42'),_0x479539[_0x8871('0x2e')]('.')[0x0]);return _0x479539[_0x8871('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0x35281b,_0x720e0b){var _0x593fa7=_0x8871('0x43');var _0x356d65,_0x4eb0fe;var _0x1b14d3;var _0x3a276b={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x593fa7,'headers':{'Content-Type':_0x8871('0x44')},'body':_0x8871('0x45')+encodeURIComponent(JSON[_0x8871('0x46')]([[[_0x8871('0x47'),JSON['stringify']([_0x35281b,_0x720e0b||'en',![],_0x8871('0x48')]),null,_0x8871('0x49')]]]))};return rp(_0x3a276b)[_0x8871('0x2c')](function(_0x1f283c){try{_0x1b14d3=eval(_0x1f283c['slice'](0x5))[0x0][0x2];}catch(_0x470261){throw new Error(_0x8871('0x4a')+_0x1f283c[_0x8871('0x23')]);}if(!_0x1b14d3){if(_0x35281b[_0x8871('0x4b')]>0xc8){throw new Error(_0x8871('0x4c'));}else{throw new Error(_0x8871('0x4d')+_0x720e0b+_0x8871('0x4e'));}}try{_0x1b14d3=eval(_0x1b14d3)[0x0];}catch(_0x50b6bc){throw new Error(_0x8871('0x4a')+res['data']);}const _0x1b0b86=_0x1b14d3;_0x356d65=path['resolve'](__dirname,'tmp',rs[_0x8871('0x29')](0x4)+_0x8871('0x3b'));fs[_0x8871('0x2a')](_0x356d65,_0x1b14d3,{'encoding':'base64'});_0x4eb0fe=path['resolve'](__dirname,_0x8871('0x3a'),rs[_0x8871('0x29')](0x4)+_0x8871('0x41'));return convertFile(_0x356d65,_0x4eb0fe);})[_0x8871('0x2c')](function(){try{fs['unlink'](_0x356d65);fs[_0x8871('0x2d')](_0x4eb0fe,_0x8871('0x3f'));}catch(_0x2f4393){logger['error'](_0x2f4393);}logger[_0x8871('0x26')](_0x8871('0x4f'),_0x4eb0fe['split']('.')[0x0]);return _0x4eb0fe[_0x8871('0x2e')]('.')[0x0];});};exports[_0x8871('0x50')]=function(_0x57fac8,_0x9301a7,_0x3bb2ba){return google[_0x8871('0x51')](_0x57fac8,_0x9301a7,_0x3bb2ba)[_0x8871('0x2c')](function(_0x4d8e08){logger[_0x8871('0x26')](_0x4d8e08[_0x8871('0x52')]);return rp(_0x4d8e08);})[_0x8871('0x2c')](function(_0x4274ec){var _0x21d8fd='';var _0x307b5c=0x0;try{fs[_0x8871('0x1d')](_0x57fac8);}catch(_0x1b7a0b){logger[_0x8871('0x16')](_0x1b7a0b);}if(_0x4274ec&&_0x4274ec['results']){_0x21d8fd=_0x4274ec[_0x8871('0x53')][_0x8871('0x54')](function(_0x6db02a){return _0x6db02a&&_0x6db02a['alternatives'][0x0]&&_0x6db02a['alternatives'][0x0][_0x8871('0x55')]?_0x6db02a[_0x8871('0x56')][0x0][_0x8871('0x55')]:'';})[_0x8871('0x57')]('\x0a');_0x307b5c=_0x4274ec[_0x8871('0x53')][_0x8871('0x54')](function(_0x4e8592){return _0x4e8592&&_0x4e8592[_0x8871('0x56')][0x0]&&_0x4e8592[_0x8871('0x56')][0x0]['confidence']?_0x4e8592[_0x8871('0x56')][0x0]['confidence']:0x0;})[_0x8871('0x57')]('\x0a');}logger[_0x8871('0x26')]('googleASR\x20transcription',_0x21d8fd);logger[_0x8871('0x26')](_0x8871('0x58'),_0x307b5c);return{'transcript':_0x21d8fd,'confidence':_0x307b5c};})['catch'](function(_0x5c4d29){logger['error'](_0x8871('0x59'),_0x5c4d29[_0x8871('0x15')],_0x5c4d29['name'],_0x5c4d29[_0x8871('0x5a')]);});};exports['googleDialogflow']=function(_0x179930,_0x8f350f,_0xf69d71,_0x56ae0d){var _0x21991c=apiai(_0x8f350f,{'language':_0x56ae0d||'en'});return _0x21991c[_0x8871('0x5b')](_0xf69d71,{'sessionId':md5(_0x179930)})['then'](function(_0x290e9f){logger[_0x8871('0x26')](JSON[_0x8871('0x46')](_0x290e9f));return{'source':_0x290e9f[_0x8871('0x5c')][_0x8871('0x5d')],'resolvedQuery':_0x290e9f[_0x8871('0x5c')][_0x8871('0x5e')],'action':_0x290e9f['result']['action'],'actionIncomplete':_0x290e9f['result']['actionIncomplete'],'speech':_0x290e9f[_0x8871('0x5c')][_0x8871('0x5f')][_0x8871('0x60')],'score':_0x290e9f[_0x8871('0x5c')][_0x8871('0x61')],'statusCode':_0x290e9f[_0x8871('0x62')][_0x8871('0x63')],'endConversation':_0x290e9f[_0x8871('0x5c')][_0x8871('0x64')][_0x8871('0x65')]||![],'isFallbackIntent':_0x290e9f[_0x8871('0x5c')]['metadata'][_0x8871('0x66')]};});};exports[_0x8871('0x67')]=function(_0x514553,_0x3a06ba,_0x95d53b,_0x300aef,_0x17052a,_0x583cf0){var _0x43f47=_0x300aef['replace'](/\\n/g,'\x0a');var _0x4b69e8={'credentials':{'private_key':_0x43f47,'client_email':_0x95d53b}};var _0x4cdd56=new dialogflow[(_0x8871('0x68'))](_0x4b69e8);var _0x3e6812=_0x4cdd56[_0x8871('0x69')](_0x3a06ba,md5(_0x514553));var _0x2ee965={'session':_0x3e6812,'queryInput':{'text':{'text':_0x17052a,'languageCode':_0x583cf0}}};return _0x4cdd56['detectIntent'](_0x2ee965)[_0x8871('0x2c')](function(_0x3d72c5){if(_0x3d72c5&&_0x3d72c5[_0x8871('0x4b')]){logger['info'](_0x8871('0x6a'),JSON['stringify'](_0x3d72c5));var _0xcd1057=_0x3d72c5[0x0];if(_0xcd1057){var _0x3a974e={'action':_0xcd1057[_0x8871('0x6b')][_0x8871('0x6c')],'allRequiredParamsPresent':_0xcd1057[_0x8871('0x6b')][_0x8871('0x6d')],'endConversation':_0xcd1057[_0x8871('0x6b')][_0x8871('0x6e')]&&_0xcd1057[_0x8871('0x6b')]['diagnosticInfo'][_0x8871('0x6f')]?_0xcd1057[_0x8871('0x6b')][_0x8871('0x6e')][_0x8871('0x6f')]['end_conversation'][_0x8871('0x70')]:![],'fulfillmentText':_0xcd1057[_0x8871('0x6b')]['fulfillmentText'],'intentName':_0xcd1057[_0x8871('0x6b')][_0x8871('0x71')]['name'],'intentDisplayName':_0xcd1057['queryResult'][_0x8871('0x71')]['displayName'],'isFallbackIntent':_0xcd1057[_0x8871('0x6b')][_0x8871('0x71')][_0x8871('0x72')],'languageCode':_0xcd1057[_0x8871('0x6b')]['languageCode'],'queryText':_0xcd1057[_0x8871('0x6b')]['queryText'],'responseId':_0xcd1057['responseId'],'score':_0xcd1057[_0x8871('0x6b')][_0x8871('0x73')],'speech':_0xcd1057['queryResult'][_0x8871('0x74')],'providerResponse':JSON[_0x8871('0x46')](_0x3d72c5)};return _0x3a974e;}}});};exports[_0x8871('0x75')]=function(_0x3e4638,_0x4adc97,_0x58371c,_0x45c0f2){return tilde[_0x8871('0x51')](_0x3e4638,_0x4adc97,_0x58371c,_0x45c0f2)['then'](function(_0x552973){try{fs[_0x8871('0x1d')](_0x3e4638);}catch(_0x5099d4){logger[_0x8871('0x16')](_0x5099d4);}logger['info'](_0x8871('0x76'),_0x552973[_0x8871('0x55')]);logger['info']('Tilde\x20ASR\x20confidence',_0x552973[_0x8871('0x77')]);return _0x552973;});};exports[_0x8871('0x78')]=function(_0x22d26b,_0x53faa7,_0x509243,_0x19fd47,_0x226245,_0x3d1148){var _0xceab1d=path[_0x8871('0x40')](__dirname,'tmp',rs['generate'](0x4)+_0x8871('0x3b'));var _0x4623bf;return aws[_0x8871('0x79')](_0x22d26b,_0x53faa7,_0x509243,_0x19fd47,_0x226245,_0x3d1148,_0xceab1d)[_0x8871('0x2c')](function(){_0x4623bf=path[_0x8871('0x40')](__dirname,_0x8871('0x3a'),rs['generate'](0x4)+_0x8871('0x41'));return convertFile(_0xceab1d,_0x4623bf);})[_0x8871('0x2c')](function(){try{fs[_0x8871('0x1d')](_0xceab1d);fs[_0x8871('0x2d')](_0x4623bf,_0x8871('0x3f'));}catch(_0x496551){logger[_0x8871('0x16')](_0x496551);}return _0x4623bf[_0x8871('0x2e')]('.')[0x0];});};exports[_0x8871('0x7a')]=function(_0x2120fd,_0x55d705,_0x3f3ace,_0x3dcd61,_0x33e31c,_0x2384c2){return aws['lex'](_0x2120fd,_0x55d705,_0x3f3ace,_0x3dcd61,_0x33e31c,_0x2384c2)[_0x8871('0x2c')](function(_0x586906){logger[_0x8871('0x26')](JSON['stringify'](_0x586906));return _0x586906;});};exports['ispeechTTS']=function(_0x369378,_0x495d46,_0x1ae612,_0x58ffdf){var _0x402378=util['format'](_0x8871('0x7b'),ISPEECH_API,_0x369378,encodeURIComponent(_0x495d46),_0x1ae612,_0x58ffdf);var _0x44643d=path[_0x8871('0x40')](__dirname,'tmp',rs[_0x8871('0x29')](0x4)+'.mp3');var _0x2a863a;return downloadFile(_0x402378,_0x44643d)['then'](function(){_0x2a863a=path[_0x8871('0x40')](__dirname,'tmp',rs[_0x8871('0x29')](0x4)+_0x8871('0x41'));return convertFile(_0x44643d,_0x2a863a);})['then'](function(){try{fs[_0x8871('0x1d')](_0x44643d);fs[_0x8871('0x2d')](_0x2a863a,_0x8871('0x3f'));}catch(_0x29adfa){logger['error'](_0x29adfa);}return _0x2a863a[_0x8871('0x2e')]('.')[0x0];});};exports[_0x8871('0x7c')]=function(_0x3aa22d,_0x4dbcf1,_0x384b69,_0x5812bc){var _0x550a08=util[_0x8871('0x7d')](_0x8871('0x7e'),ISPEECH_API,_0x4dbcf1,_0x384b69,base64Encode(_0x3aa22d),_0x5812bc?util['format'](_0x8871('0x7f'),encodeURIComponent(_0x5812bc)):_0x8871('0x80'));return uploadFile(_0x550a08)[_0x8871('0x2c')](function(_0xb808a4){return querystring['parse'](_0xb808a4);});};exports['sestekNDA']=function(_0x3fbf9d,_0x5c65e0){return sestek[_0x8871('0x81')](_0x3fbf9d,_0x5c65e0)['then'](function(_0x22384c){logger[_0x8871('0x26')](JSON[_0x8871('0x46')](_0x22384c));var _0x28380d={'speech':_0x22384c[_0x8871('0x82')],'action':_0x22384c[_0x8871('0x83')]?_0x22384c[_0x8871('0x83')][_0x8871('0x84')]:undefined,'actiondata':_0x22384c[_0x8871('0x83')]?_0x22384c[_0x8871('0x83')][_0x8871('0x85')]:undefined};if(_0x22384c['channelData']&&_0x22384c['channelData'][_0x8871('0x86')]){return base64Decode(_0x22384c[_0x8871('0x83')][_0x8871('0x86')][_0x8871('0x87')],path[_0x8871('0x40')](__dirname,_0x8871('0x3a'),rs['generate'](0x4)+_0x8871('0x41')))['then'](function(_0x491946){_0x28380d['audiofile']=_0x491946;return _0x28380d;});}return _0x28380d;});};exports[_0x8871('0x88')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index cb66093..787b2a2 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5633=['./nda'];(function(_0x440698,_0x1b3445){var _0x3d88d6=function(_0x3ca2c8){while(--_0x3ca2c8){_0x440698['push'](_0x440698['shift']());}};_0x3d88d6(++_0x1b3445);}(_0x5633,0x106));var _0x3563=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x5633[_0x2f3848];return _0x102668;};var nda=require(_0x3563('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x94c3=['exports','./nda'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x94c3,0xad));var _0x394c=function(_0xf81792,_0x3b5a65){_0xf81792=_0xf81792-0x0;var _0x34aaad=_0x94c3[_0xf81792];return _0x34aaad;};var nda=require(_0x394c('0x0'));module[_0x394c('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index a417d79..c88dc4b 100644 --- a/server/services/agi/scripts/sestek/nda/index.js +++ b/server/services/agi/scripts/sestek/nda/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae7b=['stringify','request-promise','url','../../../../../config/logger','POST','/token','password','username','then','resolve','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','dnid','extension','Bearer\x20','project','body','ndagenerate_audio','channelData','audio/wav','CustomAction','custom_action','custom_action_data','info'];(function(_0x4840a3,_0x5e3a2c){var _0x4e6008=function(_0x3e10f6){while(--_0x3e10f6){_0x4840a3['push'](_0x4840a3['shift']());}};_0x4e6008(++_0x5e3a2c);}(_0xae7b,0xbe));var _0xbae7=function(_0x355ca3,_0xd3e1e7){_0x355ca3=_0x355ca3-0x0;var _0x55edba=_0xae7b[_0x355ca3];return _0x55edba;};'use strict';var rp=require(_0xbae7('0x0'));var url=require(_0xbae7('0x1'));var logger=require(_0xbae7('0x2'))('agi');module['exports']=function(_0x324890,_0x2da494){var _0x1847f0={'method':_0xbae7('0x3'),'uri':url['resolve'](_0x2da494['ndauth_url'],_0xbae7('0x4')),'form':{'grant_type':_0xbae7('0x5'),'username':_0x2da494[_0xbae7('0x6')],'password':_0x2da494['password']},'json':!![]};return rp(_0x1847f0)[_0xbae7('0x7')](function(_0x539635){var _0x228a90={'method':_0xbae7('0x3'),'uri':url[_0xbae7('0x8')](_0x2da494['ndassistant_url'],_0xbae7('0x9')),'body':{'type':_0x2da494['ndaactivity_type']||_0xbae7('0xa'),'channelId':_0xbae7('0xb'),'conversation':{'id':_0x324890[_0xbae7('0xc')]},'from':{'id':_0x324890[_0xbae7('0xd')],'name':_0x324890['calleridname']},'recipient':{'id':_0x324890[_0xbae7('0xe')],'name':_0x324890[_0xbae7('0xf')]},'text':_0x2da494['text'],'channelData':{}},'headers':{'Authorization':_0xbae7('0x10')+_0x539635['access_token']},'json':!![]};if(_0x2da494[_0xbae7('0x11')]){_0x228a90[_0xbae7('0x12')]['channelData']['ProjectName']=_0x2da494[_0xbae7('0x11')];}if(_0x2da494[_0xbae7('0x13')]=='1'){_0x228a90[_0xbae7('0x12')][_0xbae7('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xbae7('0x15')};}if(_0x2da494['custom_action']){_0x228a90['body'][_0xbae7('0x14')][_0xbae7('0x16')]=_0x2da494[_0xbae7('0x17')];if(_0x2da494[_0xbae7('0x18')]){_0x228a90[_0xbae7('0x12')][_0xbae7('0x14')]['CustomActionData']=_0x2da494[_0xbae7('0x18')];}}logger[_0xbae7('0x19')](JSON[_0xbae7('0x1a')](_0x228a90));return rp(_0x228a90);});}; \ No newline at end of file +var _0xc94f=['channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','POST','resolve','ndauth_url','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','calleridname','dnid','extension','text','project','body'];(function(_0x441563,_0x1d4a28){var _0x2369ec=function(_0x1f97ba){while(--_0x1f97ba){_0x441563['push'](_0x441563['shift']());}};_0x2369ec(++_0x1d4a28);}(_0xc94f,0xcd));var _0xfc94=function(_0x28afbe,_0x4d655b){_0x28afbe=_0x28afbe-0x0;var _0x16a494=_0xc94f[_0x28afbe];return _0x16a494;};'use strict';var rp=require(_0xfc94('0x0'));var url=require('url');var logger=require(_0xfc94('0x1'))(_0xfc94('0x2'));module['exports']=function(_0x203041,_0x4b0493){var _0xfc710d={'method':_0xfc94('0x3'),'uri':url[_0xfc94('0x4')](_0x4b0493[_0xfc94('0x5')],'/token'),'form':{'grant_type':'password','username':_0x4b0493['username'],'password':_0x4b0493[_0xfc94('0x6')]},'json':!![]};return rp(_0xfc710d)[_0xfc94('0x7')](function(_0x4dc395){var _0xe044e8={'method':'POST','uri':url[_0xfc94('0x4')](_0x4b0493[_0xfc94('0x8')],_0xfc94('0x9')),'body':{'type':_0x4b0493[_0xfc94('0xa')]||'message','channelId':'Nda','conversation':{'id':_0x203041[_0xfc94('0xb')]},'from':{'id':_0x203041[_0xfc94('0xc')],'name':_0x203041[_0xfc94('0xd')]},'recipient':{'id':_0x203041[_0xfc94('0xe')],'name':_0x203041[_0xfc94('0xf')]},'text':_0x4b0493[_0xfc94('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x4dc395['access_token']},'json':!![]};if(_0x4b0493[_0xfc94('0x11')]){_0xe044e8[_0xfc94('0x12')][_0xfc94('0x13')][_0xfc94('0x14')]=_0x4b0493['project'];}if(_0x4b0493[_0xfc94('0x15')]=='1'){_0xe044e8[_0xfc94('0x12')][_0xfc94('0x13')][_0xfc94('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xfc94('0x17')};}if(_0x4b0493['custom_action']){_0xe044e8[_0xfc94('0x12')]['channelData'][_0xfc94('0x18')]=_0x4b0493['custom_action'];if(_0x4b0493[_0xfc94('0x19')]){_0xe044e8[_0xfc94('0x12')][_0xfc94('0x13')]['CustomActionData']=_0x4b0493[_0xfc94('0x19')];}}logger[_0xfc94('0x1a')](JSON[_0xfc94('0x1b')](_0xe044e8));return rp(_0xe044e8);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 4d310cd..2533f0a 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2ec=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2ec,0x1f1));var _0xcc2e=function(_0x5b98bd,_0x4a2baa){_0x5b98bd=_0x5b98bd-0x0;var _0x1eb395=_0xc2ec[_0x5b98bd];return _0x1eb395;};'use strict';var asr=require('./lib/api');module[_0xcc2e('0x0')]=function(_0x44e2c1,_0x3329fd,_0x272df1,_0x480a50){return asr(_0x44e2c1,_0x3329fd,_0x272df1,_0x480a50);}; \ No newline at end of file +var _0x0b42=['./lib/api'];(function(_0x1ef2ba,_0x7ae746){var _0x2c08cf=function(_0x1a286e){while(--_0x1a286e){_0x1ef2ba['push'](_0x1ef2ba['shift']());}};_0x2c08cf(++_0x7ae746);}(_0x0b42,0x10f));var _0x20b4=function(_0x19b092,_0x496ca5){_0x19b092=_0x19b092-0x0;var _0xf5fa43=_0x0b42[_0x19b092];return _0xf5fa43;};'use strict';var asr=require(_0x20b4('0x0'));module['exports']=function(_0xfbb313,_0x53c5ea,_0x48963c,_0x57eaf1){return asr(_0xfbb313,_0x53c5ea,_0x48963c,_0x57eaf1);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index b908cba..3d0b1d9 100644 --- a/server/services/agi/scripts/tilde/asr/lib/api.js +++ b/server/services/agi/scripts/tilde/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaed7=['message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open'];(function(_0x29e7fa,_0x231b9c){var _0x93b500=function(_0x23d559){while(--_0x23d559){_0x29e7fa['push'](_0x29e7fa['shift']());}};_0x93b500(++_0x231b9c);}(_0xaed7,0x1d5));var _0x7aed=function(_0x442a9d,_0x30e3eb){_0x442a9d=_0x442a9d-0x0;var _0x8f5e3a=_0xaed7[_0x442a9d];return _0x8f5e3a;};'use strict';var BPromise=require('bluebird');var _=require(_0x7aed('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7aed('0x1'));var crypto=require(_0x7aed('0x2'));var logger=require(_0x7aed('0x3'))(_0x7aed('0x4'));module[_0x7aed('0x5')]=function(_0x118997,_0x29b750,_0x296152,_0xfe4424){return new BPromise(function(_0x527470,_0x1d51e5){logger[_0x7aed('0x6')]('Tilde\x20URI',_0xfe4424||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4fcb2b=new WebSocket(_0xfe4424||_0x7aed('0x7'),{'perMessageDeflate':![]});var _0xcd85c4='';var _0x561b1a='0';var _0x4f7896='1';var _0x3bcfd6=_0x7aed('0x8');function _0x315feb(_0x1e6338){var _0x233cb3=crypto['createHash'](_0x7aed('0x9'));_0x233cb3[_0x7aed('0xa')](_0x1e6338);return _0x233cb3[_0x7aed('0xb')](_0x7aed('0xc'));}function _0x34a4e0(){try{logger['info'](_0x7aed('0xd'));var _0x52a8d3=moment()['unix']();var _0x4a9263=_0x315feb(_0x52a8d3+_0x29b750+_0x296152);_0x4fcb2b[_0x7aed('0xe')](JSON[_0x7aed('0xf')]({'appID':_0x29b750,'timestamp':_0x52a8d3,'appKey':_0x4a9263}));var _0xe5558e=fs[_0x7aed('0x10')](_0x118997);_0xe5558e['on'](_0x7aed('0x11'),function(_0x4f4b40){_0x4fcb2b['send'](_0x4f4b40);});_0xe5558e['on'](_0x7aed('0x12'),function(){_0x4fcb2b[_0x7aed('0xe')](_0x7aed('0x13'));});}catch(_0x5533c6){logger[_0x7aed('0x14')](_0x7aed('0x15'),JSON[_0x7aed('0xf')](_0x5533c6));_0x4fcb2b[_0x7aed('0x16')]();}}function _0x1509fe(_0x97eaae){try{if(_0x97eaae){var _0x342600=JSON['parse'](_0x97eaae);switch(_0x342600[_0x7aed('0x17')]){case 0x0:if(_0x342600['result']){if(_0x342600[_0x7aed('0x18')][_0x7aed('0x19')]){logger['info'](_0x7aed('0x1a'),JSON[_0x7aed('0xf')](_0x342600['result']['hypotheses']));_0xcd85c4=_0x342600[_0x7aed('0x18')][_0x7aed('0x1b')][0x0][_0x7aed('0x1c')];_0x561b1a=_0x342600[_0x7aed('0x18')][_0x7aed('0x1b')][0x0]['likelihood'];_0x4f7896='0';_0x3bcfd6=_0x7aed('0x1d');_0x4fcb2b[_0x7aed('0x16')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x4f7896='1';_0x3bcfd6=_0x7aed('0x8');break;case 0x2:logger['info'](_0x7aed('0x1e'));_0x4f7896='2';_0x3bcfd6=_0x7aed('0x1e');break;case 0x9:logger[_0x7aed('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x4f7896='9';_0x3bcfd6=_0x7aed('0x1f');break;case 0xa:logger[_0x7aed('0x6')](_0x7aed('0x20'));_0x4f7896='10';_0x3bcfd6='Authentication\x20failed.';break;case 0xb:logger[_0x7aed('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x4f7896='11';_0x3bcfd6=_0x7aed('0x21');}}}catch(_0x53e95a){logger['error'](_0x7aed('0x22'),JSON[_0x7aed('0xf')](_0x53e95a));_0x4fcb2b[_0x7aed('0x16')]();}}function _0x3e731a(){logger[_0x7aed('0x6')](_0x7aed('0x23'));_0x527470({'transcript':_0xcd85c4,'confidence':_0x561b1a,'status':_0x4f7896,'status_message':_0x3bcfd6});}function _0x1b05f6(_0x30f178){logger[_0x7aed('0x14')](_0x7aed('0x24'));if(!_['isNil'](_0x30f178)){logger[_0x7aed('0x14')](_['isObject'](_0x30f178)?JSON[_0x7aed('0xf')](_0x30f178):_0x30f178);}}_0x4fcb2b['on'](_0x7aed('0x25'),_0x34a4e0);_0x4fcb2b['on'](_0x7aed('0x26'),_0x1509fe);_0x4fcb2b['on'](_0x7aed('0x12'),_0x3e731a);_0x4fcb2b['on'](_0x7aed('0x14'),_0x1b05f6);});}; \ No newline at end of file +var _0x5a3e=['close','error','stringify','terminate','parse','status','result','final','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','createReadStream','send'];(function(_0x12549d,_0x153ef9){var _0x4a11e6=function(_0x3ef18b){while(--_0x3ef18b){_0x12549d['push'](_0x12549d['shift']());}};_0x4a11e6(++_0x153ef9);}(_0x5a3e,0x1a6));var _0xe5a3=function(_0x3ea06e,_0x43e53c){_0x3ea06e=_0x3ea06e-0x0;var _0x44bc81=_0x5a3e[_0x3ea06e];return _0x44bc81;};'use strict';var BPromise=require(_0xe5a3('0x0'));var _=require(_0xe5a3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe5a3('0x2'));var crypto=require(_0xe5a3('0x3'));var logger=require('../../../../../../config/logger')(_0xe5a3('0x4'));module[_0xe5a3('0x5')]=function(_0x45edf3,_0x41ecaf,_0x183205,_0x21abb7){return new BPromise(function(_0x5ce9a0,_0x2e1f17){logger[_0xe5a3('0x6')](_0xe5a3('0x7'),_0x21abb7||_0xe5a3('0x8'));var _0x458b60=new WebSocket(_0x21abb7||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x5bd7b9='';var _0x5cf442='0';var _0x5297d2='1';var _0x1a2479=_0xe5a3('0x9');function _0x29def7(_0x17c00b){var _0x3f2567=crypto[_0xe5a3('0xa')](_0xe5a3('0xb'));_0x3f2567[_0xe5a3('0xc')](_0x17c00b);return _0x3f2567[_0xe5a3('0xd')](_0xe5a3('0xe'));}function _0x1b62cc(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0xb0b10a=moment()[_0xe5a3('0xf')]();var _0x9b1e6b=_0x29def7(_0xb0b10a+_0x41ecaf+_0x183205);_0x458b60['send'](JSON['stringify']({'appID':_0x41ecaf,'timestamp':_0xb0b10a,'appKey':_0x9b1e6b}));var _0x37567e=fs[_0xe5a3('0x10')](_0x45edf3);_0x37567e['on']('data',function(_0x48f788){_0x458b60[_0xe5a3('0x11')](_0x48f788);});_0x37567e['on'](_0xe5a3('0x12'),function(){_0x458b60[_0xe5a3('0x11')]('EOS');});}catch(_0x2aa8e4){logger[_0xe5a3('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0xe5a3('0x14')](_0x2aa8e4));_0x458b60[_0xe5a3('0x15')]();}}function _0x50df65(_0x4b9fae){try{if(_0x4b9fae){var _0x3d2b99=JSON[_0xe5a3('0x16')](_0x4b9fae);switch(_0x3d2b99[_0xe5a3('0x17')]){case 0x0:if(_0x3d2b99[_0xe5a3('0x18')]){if(_0x3d2b99[_0xe5a3('0x18')][_0xe5a3('0x19')]){logger[_0xe5a3('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0xe5a3('0x14')](_0x3d2b99[_0xe5a3('0x18')]['hypotheses']));_0x5bd7b9=_0x3d2b99['result']['hypotheses'][0x0][_0xe5a3('0x1a')];_0x5cf442=_0x3d2b99['result']['hypotheses'][0x0][_0xe5a3('0x1b')];_0x5297d2='0';_0x1a2479=_0xe5a3('0x1c');_0x458b60[_0xe5a3('0x15')]();}}break;case 0x1:logger[_0xe5a3('0x6')](_0xe5a3('0x9'));_0x5297d2='1';_0x1a2479=_0xe5a3('0x9');break;case 0x2:logger[_0xe5a3('0x6')](_0xe5a3('0x1d'));_0x5297d2='2';_0x1a2479=_0xe5a3('0x1d');break;case 0x9:logger[_0xe5a3('0x6')](_0xe5a3('0x1e'));_0x5297d2='9';_0x1a2479='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xe5a3('0x6')](_0xe5a3('0x1f'));_0x5297d2='10';_0x1a2479='Authentication\x20failed.';break;case 0xb:logger[_0xe5a3('0x6')](_0xe5a3('0x20'));_0x5297d2='11';_0x1a2479='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4a6434){logger['error'](_0xe5a3('0x21'),JSON[_0xe5a3('0x14')](_0x4a6434));_0x458b60['terminate']();}}function _0x361f84(){logger[_0xe5a3('0x6')](_0xe5a3('0x22'));_0x5ce9a0({'transcript':_0x5bd7b9,'confidence':_0x5cf442,'status':_0x5297d2,'status_message':_0x1a2479});}function _0x1df174(_0x41249a){logger[_0xe5a3('0x13')](_0xe5a3('0x23'));if(!_[_0xe5a3('0x24')](_0x41249a)){logger[_0xe5a3('0x13')](_[_0xe5a3('0x25')](_0x41249a)?JSON[_0xe5a3('0x14')](_0x41249a):_0x41249a);}}_0x458b60['on'](_0xe5a3('0x26'),_0x1b62cc);_0x458b60['on'](_0xe5a3('0x27'),_0x50df65);_0x458b60['on'](_0xe5a3('0x12'),_0x361f84);_0x458b60['on'](_0xe5a3('0x13'),_0x1df174);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 86fcf4b..191b9d5 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe366=['exports','./asr'];(function(_0x5c390a,_0x2dd582){var _0x16f2e1=function(_0x5e16d7){while(--_0x5e16d7){_0x5c390a['push'](_0x5c390a['shift']());}};_0x16f2e1(++_0x2dd582);}(_0xe366,0x1b9));var _0x6e36=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xe366[_0x433a86];return _0x23000c;};var asr=require(_0x6e36('0x0'));module[_0x6e36('0x1')]={'asr':asr}; \ No newline at end of file +var _0x29a2=['exports'];(function(_0x2d4a19,_0x13979a){var _0x3c67de=function(_0x55a428){while(--_0x55a428){_0x2d4a19['push'](_0x2d4a19['shift']());}};_0x3c67de(++_0x13979a);}(_0x29a2,0x162));var _0x229a=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x29a2[_0x513aa5];return _0x1a1a7c;};var asr=require('./asr');module[_0x229a('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 641a994..ed6fbc0 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1efb=['./channel','127.0.0.1','call','emit','error','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','EventEmitter','./error'];(function(_0xaa30e5,_0x4b0317){var _0x3ed11f=function(_0x294144){while(--_0x294144){_0xaa30e5['push'](_0xaa30e5['shift']());}};_0x3ed11f(++_0x4b0317);}(_0x1efb,0xf8));var _0xb1ef=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1efb[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0xb1ef('0x0'));var net=require(_0xb1ef('0x1'));var EventEmitter=require('events')[_0xb1ef('0x2')];var AGIError=require(_0xb1ef('0x3'));var AGIChannel=require(_0xb1ef('0x4'));var AGIServer=function(_0xff8ad1,_0x17b90a,_0x552721){var _0xf728e5=this,_0xff8ad1=_0xff8ad1||0x11dd,_0x17b90a=_0x17b90a||_0xb1ef('0x5'),_0x1c29ed=null,_0x543732=0x0;EventEmitter[_0xb1ef('0x6')](_0xf728e5);function _0x3f26b4(){if(!_0xff8ad1){_0xf728e5[_0xb1ef('0x7')](_0xb1ef('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x1c29ed=net['createServer']();_0x1c29ed[_0xb1ef('0x9')](_0xff8ad1,_0x17b90a);_0x1c29ed['on'](_0xb1ef('0xa'),function(){_0xf728e5[_0xb1ef('0x7')](_0xb1ef('0xa'));});_0x1c29ed['on'](_0xb1ef('0xb'),function(_0x1de556){_0x1c29ed[_0xb1ef('0xc')](function(_0x10e65e,_0x36cbe3){if(_0x10e65e){_0xf728e5[_0xb1ef('0x7')]('error',new AGIError(_0xb1ef('0xd'),_0x10e65e));}else if(_0x552721&&_0x552721<0x0){_0xf728e5['emit'](_0xb1ef('0x8'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x1de556[_0xb1ef('0xe')]();}else if(_0x552721&&_0x552721>0x0&&_0x552721<_0x36cbe3){_0x543732+=0x1;_0xf728e5['emit'](_0xb1ef('0x8'),new AGIError(_0xb1ef('0xf'),_0x543732));_0x1de556[_0xb1ef('0xe')]();}else{var _0x355bb7=new AGIChannel(_0x1de556);_0x355bb7['on'](_0xb1ef('0x10'),function(){_0xf728e5['emit']('connection',_0x355bb7);});}});});_0x1c29ed['on'](_0xb1ef('0x8'),function(_0x1d7a9b){_0xf728e5[_0xb1ef('0x7')](_0xb1ef('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x1d7a9b['code']));});_0x1c29ed['on'](_0xb1ef('0x11'),function(){_0xf728e5[_0xb1ef('0x7')](_0xb1ef('0x11'),new AGIError(_0xb1ef('0x12')));});}process['nextTick'](function(){_0x3f26b4();});};util[_0xb1ef('0x13')](AGIServer,EventEmitter);module[_0xb1ef('0x14')]=function(_0x48ff97,_0x59ea77,_0x294c1b){return new AGIServer(_0x48ff97,_0x59ea77,_0x294c1b);}; \ No newline at end of file +var _0x7ac8=['./error','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','EventEmitter'];(function(_0x34e439,_0x1b04ed){var _0x5ef36f=function(_0x318b7d){while(--_0x318b7d){_0x34e439['push'](_0x34e439['shift']());}};_0x5ef36f(++_0x1b04ed);}(_0x7ac8,0x162));var _0x87ac=function(_0x20e375,_0xdc0dde){_0x20e375=_0x20e375-0x0;var _0x55ac5d=_0x7ac8[_0x20e375];return _0x55ac5d;};'use strict';var util=require(_0x87ac('0x0'));var net=require(_0x87ac('0x1'));var EventEmitter=require('events')[_0x87ac('0x2')];var AGIError=require(_0x87ac('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x582ab7,_0x2a8f83,_0x387d70){var _0x1f563d=this,_0x582ab7=_0x582ab7||0x11dd,_0x2a8f83=_0x2a8f83||'127.0.0.1',_0x47de67=null,_0x4abc82=0x0;EventEmitter[_0x87ac('0x4')](_0x1f563d);function _0x117b9e(){if(!_0x582ab7){_0x1f563d[_0x87ac('0x5')](_0x87ac('0x6'),new AGIError(_0x87ac('0x7')));return![];}_0x47de67=net['createServer']();_0x47de67[_0x87ac('0x8')](_0x582ab7,_0x2a8f83);_0x47de67['on']('listening',function(){_0x1f563d[_0x87ac('0x5')](_0x87ac('0x9'));});_0x47de67['on']('connection',function(_0x16f130){_0x47de67[_0x87ac('0xa')](function(_0x687fa4,_0x40b89a){if(_0x687fa4){_0x1f563d['emit'](_0x87ac('0x6'),new AGIError(_0x87ac('0xb'),_0x687fa4));}else if(_0x387d70&&_0x387d70<0x0){_0x1f563d[_0x87ac('0x5')]('error',new AGIError(_0x87ac('0xc')));_0x16f130['destroy']();}else if(_0x387d70&&_0x387d70>0x0&&_0x387d70<_0x40b89a){_0x4abc82+=0x1;_0x1f563d[_0x87ac('0x5')](_0x87ac('0x6'),new AGIError(_0x87ac('0xd'),_0x4abc82));_0x16f130[_0x87ac('0xe')]();}else{var _0x5eefea=new AGIChannel(_0x16f130);_0x5eefea['on'](_0x87ac('0xf'),function(){_0x1f563d['emit']('connection',_0x5eefea);});}});});_0x47de67['on'](_0x87ac('0x6'),function(_0x4352e3){_0x1f563d[_0x87ac('0x5')](_0x87ac('0x6'),new AGIError(_0x87ac('0xb'),_0x4352e3[_0x87ac('0x10')]));});_0x47de67['on'](_0x87ac('0x11'),function(){_0x1f563d[_0x87ac('0x5')](_0x87ac('0x11'),new AGIError(_0x87ac('0x12')));});}process[_0x87ac('0x13')](function(){_0x117b9e();});};util[_0x87ac('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x8dea3f,_0x3d72e6,_0x3cef33){return new AGIServer(_0x8dea3f,_0x3d72e6,_0x3cef33);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 1ebb178..8f37344 100644 --- a/server/services/agi/vertices.js +++ b/server/services/agi/vertices.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x570f=['An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','uri','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','dialogflow','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','private_key','dialogflowV2_language','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','getIntervals','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','success','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','shelljs','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','getdigits','channel','rpc','mailRpc','prototype','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','MP3','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','render','stringify'];(function(_0x766909,_0x510154){var _0x16bc3f=function(_0x5259c5){while(--_0x5259c5){_0x766909['push'](_0x766909['shift']());}};_0x16bc3f(++_0x510154);}(_0x570f,0x152));var _0xf570=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x570f[_0x2459fd];return _0x364cd2;};'use strict';var fs=require('fs');var util=require(_0xf570('0x0'));var _=require(_0xf570('0x1'));var sh=require(_0xf570('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0xf570('0x3'));var Mustache=require(_0xf570('0x4'));var rp=require(_0xf570('0x5'));var logger=require(_0xf570('0x6'))(_0xf570('0x7'));var config=require(_0xf570('0x8'));var shared=require(_0xf570('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xf570('0xa');var recursiveMapAttributes=['rawHeaders',_0xf570('0xb')];var verticesWithRetry=['menu',_0xf570('0xc'),'getsecretdigits'];var AGIVertices=function(_0x350a32,_0x49b42f,_0x19bee1){this[_0xf570('0xd')]=_0x350a32;this[_0xf570('0xe')]=_0x49b42f;this[_0xf570('0xf')]=_0x19bee1;};AGIVertices[_0xf570('0x10')]['getVariable']=function(_0x46e6dd,_0xe4d52d){this[_0xf570('0xe')]['getVariableById'](_0x46e6dd)[_0xf570('0x11')](function(_0x3c689c){_0xe4d52d(null,_0x3c689c?_0x3c689c[_0xf570('0x12')]:![]);})['catch'](function(_0x32e0b0){_0xe4d52d(_0x32e0b0);});};AGIVertices[_0xf570('0x10')][_0xf570('0x13')]=function(_0x5242d6,_0x4c6917){this[_0xf570('0xe')][_0xf570('0x14')](_0x5242d6)[_0xf570('0x11')](function(_0x38d03e){_0x4c6917(null,_0x38d03e?_0x38d03e[_0xf570('0x12')]:![]);})[_0xf570('0x15')](function(_0x2531f9){_0x4c6917(_0x2531f9);});};AGIVertices[_0xf570('0x10')][_0xf570('0x16')]=function(_0x43e760,_0x46a3aa){this['rpc'][_0xf570('0x17')](_0x43e760)[_0xf570('0x11')](function(_0x23aa99){_0x46a3aa(null,_0x23aa99?_0x23aa99[_0xf570('0x12')]:![]);})[_0xf570('0x15')](function(_0x5cde47){_0x46a3aa(_0x5cde47);});};AGIVertices[_0xf570('0x10')][_0xf570('0x18')]=function(_0x29c3f4,_0x4e2649){this[_0xf570('0xe')][_0xf570('0x19')](_0x29c3f4)[_0xf570('0x11')](function(_0x1a3e91){_0x4e2649(null,_0x1a3e91?_0x1a3e91['dsn']:![]);})[_0xf570('0x15')](function(_0xd2058e){_0x4e2649(_0xd2058e);});};AGIVertices[_0xf570('0x10')][_0xf570('0x1a')]=function(_0x2488bd,_0x570703){this[_0xf570('0xe')][_0xf570('0x1b')](_0x2488bd)[_0xf570('0x11')](function(_0x1151d1){_0x570703(null,_0x1151d1?_0x1151d1['name']:![]);})[_0xf570('0x15')](function(_0x40c4f1){_0x570703(_0x40c4f1);});};AGIVertices[_0xf570('0x10')][_0xf570('0x1c')]=function(_0x45cb29,_0x210425){this['rpc'][_0xf570('0x1d')](_0x45cb29)[_0xf570('0x11')](function(_0x2a8701){_0x210425(null,_0x2a8701?_0x2a8701[_0xf570('0x12')]:![]);})[_0xf570('0x15')](function(_0x268be7){_0x210425(_0x268be7);});};AGIVertices[_0xf570('0x10')][_0xf570('0x1e')]=function(_0xdf8fae,_0x33a603){var _0x2278b8=this;this[_0xf570('0xe')]['getSoundById'](_0xdf8fae)['then'](function(_0x2eece8){_0x33a603(null,_0x2eece8?_0x2278b8[_0xf570('0x1f')](_0x2eece8[_0xf570('0x20')]):![]);})[_0xf570('0x15')](function(_0x170eca){_0x33a603(_0x170eca);});};AGIVertices[_0xf570('0x10')][_0xf570('0x21')]=function(_0x204f06,_0x951c82){this['rpc'][_0xf570('0x22')](_0x204f06)['then'](function(_0x474faa){_0x951c82(null,_0x474faa?_0x474faa:![]);})[_0xf570('0x15')](function(_0x23ada6){_0x951c82(_0x23ada6);});};AGIVertices['prototype'][_0xf570('0x23')]=function(_0x3c1a25,_0x59c756,_0x422767){this['mailRpc'][_0xf570('0x23')](_0x3c1a25,_0x59c756)[_0xf570('0x11')](function(){_0x422767(null);})[_0xf570('0x15')](function(_0x2f21f6){_0x422767(_0x2f21f6);});};AGIVertices['prototype']['getIntervals']=function(_0x17ddf9,_0x3b1a68){this[_0xf570('0xe')][_0xf570('0x24')](_0x17ddf9)[_0xf570('0x11')](function(_0x5edb32){if(_0x5edb32){if(_0x5edb32[_0xf570('0x25')]){_0x3b1a68(null,[_0x5edb32['interval']]);}else{_0x3b1a68(null,_['map'](_0x5edb32['Intervals'],_0xf570('0x26')));}}else{_0x3b1a68(null,![]);}})['catch'](function(_0x196ac7){_0x3b1a68(_0x196ac7);});};AGIVertices[_0xf570('0x10')]['getSoundPath']=function(_0x4a9df0){return util[_0xf570('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x4a9df0);};AGIVertices['prototype'][_0xf570('0x28')]=function(_0x4ee429,_0x533291,_0x58b3d2){odbc[_0xf570('0x29')](_0x4ee429,function(_0x4120e9){if(_0x4120e9){logger[_0xf570('0x2a')](_0xf570('0x2b'),_0x4120e9);_0x58b3d2(_0x4120e9);}else{logger[_0xf570('0x2c')](_0xf570('0x2d'));odbc[_0xf570('0x2e')](_0x533291,function(_0x1af395,_0x27e956){if(_0x1af395){logger[_0xf570('0x2c')](_0xf570('0x2f'),_0x533291);_0x58b3d2(_0x1af395);}else{logger[_0xf570('0x2c')]('Query\x20executed\x20correctly\x20%s',_0x533291);odbc[_0xf570('0x30')](function(_0x404d8f){if(_0x404d8f){logger[_0xf570('0x2a')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x404d8f);}_0x58b3d2(null,_0x27e956);});}});}});};AGIVertices[_0xf570('0x10')][_0xf570('0x31')]=function(_0x22b201,_0x1b2f1d){this[_0xf570('0xe')][_0xf570('0x32')](_0x22b201)[_0xf570('0x11')](function(_0x3ae19e){_0x1b2f1d(null,_0x3ae19e?_0x3ae19e:![]);})[_0xf570('0x15')](function(_0x1164f3){_0x1b2f1d(_0x1164f3);});};AGIVertices[_0xf570('0x10')][_0xf570('0x33')]=function(_0x3f2cfd,_0x4bab28){this[_0xf570('0xe')][_0xf570('0x33')](_0x3f2cfd)['then'](function(_0x851844){_0x4bab28(null,_0x851844);})[_0xf570('0x15')](function(_0x436689){_0x4bab28(_0x436689);});};AGIVertices[_0xf570('0x10')][_0xf570('0x34')]=function(_0xabf891,_0x4a337,_0x5cbfb3){this[_0xf570('0xe')][_0xf570('0x34')]({'uniqueid':this[_0xf570('0xd')][_0xf570('0x35')],'node':_0xabf891[_0xf570('0x36')],'application':_0xabf891[_0xf570('0x37')],'data':_0x4a337||null,'project_name':this['channel']['arg_1'],'callerid':this[_0xf570('0xd')][_0xf570('0x38')]})[_0xf570('0x11')](function(_0x81e6ca){if(_0x5cbfb3){_0x5cbfb3(null,_0x81e6ca);}})['catch'](function(_0x1d199f){if(_0x5cbfb3){_0x5cbfb3(_0x1d199f);}});};AGIVertices[_0xf570('0x10')][_0xf570('0x39')]=function(_0x4cf025,_0x3a74c9,_0x548eb0,_0x863f87){this[_0xf570('0xe')][_0xf570('0x39')]({'uniqueid':this[_0xf570('0xd')][_0xf570('0x35')],'callerid':this[_0xf570('0xd')][_0xf570('0x38')],'calleridname':this[_0xf570('0xd')]['calleridname'],'context':this['channel'][_0xf570('0x3a')],'extension':this['channel'][_0xf570('0x3b')],'priority':this[_0xf570('0xd')][_0xf570('0x3c')],'accountcode':this[_0xf570('0xd')][_0xf570('0x3d')],'dnid':this[_0xf570('0xd')][_0xf570('0x3e')],'projectName':this[_0xf570('0xd')][_0xf570('0x3f')],'saveName':_0x3a74c9,'filename':_0x4cf025['file']||_0x3a74c9,'savePath':_0x548eb0})[_0xf570('0x11')](function(_0x5b9858){_0x863f87(null,_0x5b9858);})[_0xf570('0x15')](function(_0x53d9fb){_0x863f87(_0x53d9fb);});};AGIVertices[_0xf570('0x10')]['createSquareMessage']=function(_0x4d2d28,_0x144da0,_0x598848,_0x406949,_0x4b2295){this['rpc'][_0xf570('0x40')]({'uniqueid':this[_0xf570('0xd')][_0xf570('0x35')],'body':_0x4d2d28,'direction':_0x144da0,'providerName':_0x598848,'providerResponse':_0x406949})[_0xf570('0x11')](function(_0x2d1f3e){if(_0x4b2295){_0x4b2295(null,_0x2d1f3e);}})['catch'](function(_0x3c2aef){if(_0x4b2295){_0x4b2295(_0x3c2aef);}});};AGIVertices[_0xf570('0x10')]['createCmContact']=function(_0x2050a1,_0x4d442d){this[_0xf570('0xe')][_0xf570('0x41')]({'firstName':_[_0xf570('0x42')](_0x2050a1[_0xf570('0x12')])||_[_0xf570('0x43')](_0x2050a1['name'])?'callback_'+Math[_0xf570('0x44')]():_0x2050a1[_0xf570('0x12')],'lastName':_[_0xf570('0x42')](_0x2050a1[_0xf570('0x45')])||_['isNil'](_0x2050a1[_0xf570('0x45')])?null:_0x2050a1['lastName'],'phone':_0x2050a1[_0xf570('0x46')],'ListId':_0x2050a1[_0xf570('0x47')],'scheduledat':_0x2050a1[_0xf570('0x48')],'callbackUniqueid':this[_0xf570('0xd')]['uniqueid'],'tags':_0xf570('0x49'),'description':'Callback\x20scheduled\x20at\x20'+_0x2050a1['scheduledAt'][_0xf570('0x4a')](),'priority':_0x2050a1['callback_priority']})['then'](function(_0xb93df3){_0x4d442d(null,_0xb93df3);})[_0xf570('0x15')](function(_0x4db669){_0x4d442d(_0x4db669);});};AGIVertices[_0xf570('0x10')][_0xf570('0x4b')]=function(_0x537319,_0x31aa0f){this['rpc'][_0xf570('0x4c')](_0x537319)[_0xf570('0x11')](function(_0x1f4752){_0x31aa0f(null,_0x1f4752?_0x1f4752[_0xf570('0x12')]:![]);})[_0xf570('0x15')](function(_0x512b0b){_0x31aa0f(_0x512b0b);});};AGIVertices[_0xf570('0x10')][_0xf570('0x4d')]=function(_0x535b31,_0xef9b59,_0x4e595e){var _0x4333d0={'role':_0xf570('0x4e')};_0x4333d0[_0x535b31]=this['channel'][_0xf570('0x38')];this['rpc'][_0xf570('0x4d')](_0x4333d0,_0xef9b59,this[_0xf570('0xd')][_0xf570('0x35')])[_0xf570('0x11')](function(_0x7eb8b1){_0x4e595e(null,_[_0xf570('0x43')](_0x7eb8b1)?![]:!![]);})['catch'](function(_0x5a49c8){logger['error'](_0x5a49c8);_0x4e595e(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0xe9ac6e,_0x4158ac){var _0x46da28={'role':'agent'};_0x46da28[_0xe9ac6e]=this[_0xf570('0xd')][_0xf570('0x38')];this[_0xf570('0xe')][_0xf570('0x4f')](_0x46da28)['then'](function(_0x3d7f3d){_0x4158ac(null,_[_0xf570('0x43')](_0x3d7f3d)?![]:!![]);})[_0xf570('0x15')](function(_0x5380a4){logger['error'](_0x5380a4);_0x4158ac(null,![]);});};AGIVertices[_0xf570('0x10')][_0xf570('0x50')]=function(_0x4d46cc,_0x11c1d4){var _0x4efc54={'role':'agent'};_0x4efc54[_0x4d46cc]=this['channel']['callerid'];this[_0xf570('0xe')]['agentLogout'](_0x4efc54)[_0xf570('0x11')](function(_0x418893){_0x11c1d4(null,_[_0xf570('0x43')](_0x418893)?![]:!![]);})['catch'](function(_0x36d8e0){logger[_0xf570('0x2a')](_0x36d8e0);_0x11c1d4(null,![]);});};AGIVertices['prototype'][_0xf570('0x51')]=function(_0x12becd,_0x22c8d9){var _0x57df8b={'role':_0xf570('0x4e')};_0x57df8b[_0x12becd]=this[_0xf570('0xd')][_0xf570('0x38')];var _0x275151=_0x12becd!=_0xf570('0x52')?util[_0xf570('0x27')](_0xf570('0x53'),_0xf570('0x54'),this['channel'][_0xf570('0x38')]):undefined;this[_0xf570('0xe')][_0xf570('0x51')](_0x57df8b,_0x275151)[_0xf570('0x11')](function(_0x5135d4){_0x22c8d9(null,_[_0xf570('0x43')](_0x5135d4)?![]:!![]);})[_0xf570('0x15')](function(_0x57683b){logger[_0xf570('0x2a')](_0x57683b);_0x22c8d9(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x5b0abd,_0x172c88){sh[_0xf570('0x55')](_[_0xf570('0x56')](_0x5b0abd),function(_0x17cf44,_0x12df8a){var _0x2106bc=_0x12df8a[_0xf570('0x57')](/(\r\n|\n|\r)/gm,'');_0x172c88(null,_0x2106bc);});};AGIVertices['prototype'][_0xf570('0x58')]=function(_0x5c1372,_0x1adb8a){scripts[_0xf570('0x58')](_0x5c1372[_0xf570('0x59')],_0x5c1372['google_cloud_tts_text_type']||'text',_0x5c1372[_0xf570('0x5a')],_0x5c1372[_0xf570('0x5b')]||_0xf570('0x5c'),_0x5c1372[_0xf570('0x5d')]||_0xf570('0x5e'),_0x5c1372['audioEncoding']||_0xf570('0x5f'))[_0xf570('0x11')](function(_0x2800af){_0x1adb8a(null,_0x2800af);})[_0xf570('0x15')](function(_0x193cb9){_0x1adb8a(_0x193cb9);});};AGIVertices['prototype']['googleTTS']=function(_0x43be69,_0x35b470){scripts['googleTTS'](_0x43be69[_0xf570('0x5a')],_0x43be69[_0xf570('0x60')]||'en',0x1)[_0xf570('0x11')](function(_0x569d79){_0x35b470(null,_0x569d79);})[_0xf570('0x15')](function(_0xa73978){_0x35b470(_0xa73978);});};AGIVertices['prototype'][_0xf570('0x61')]=function(_0x317dd3,_0xfa55e){var _0x4b3118={'uri':_0x317dd3[_0xf570('0x62')],'method':_0x317dd3[_0xf570('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x317dd3[_0xf570('0x64')])===_0xf570('0x65')&&parseInt(_0x317dd3[_0xf570('0x64')])>=0x1?parseInt(_0x317dd3['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xf570('0x66')]([_0xf570('0x67'),_0xf570('0x68')],_0x4b3118[_0xf570('0x63')][_0xf570('0x69')]())){try{_0x4b3118[_0xf570('0x6a')]=_0x317dd3[_0xf570('0xb')]?JSON[_0xf570('0x6b')](_0x317dd3[_0xf570('0xb')]):{};}catch(_0x58cbcf){logger[_0xf570('0x2a')](_0xf570('0x6c'),_0x58cbcf);}}try{_0x4b3118[_0xf570('0x6d')]=_0x317dd3[_0xf570('0x6e')]?JSON[_0xf570('0x6b')](_0x317dd3['rawHeaders']):{};}catch(_0x5bbe77){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5bbe77);}if(_0x317dd3[_0xf570('0x6f')]){try{var _0x127303=require(_0x317dd3[_0xf570('0x6f')])[_0xf570('0x70')](this,_0x4b3118);_0x4b3118['uri']=Mustache[_0xf570('0x71')](_0x317dd3['url'],_0x127303,{},['$$','$$']);if(_0x4b3118[_0xf570('0x6d')]){_0x4b3118[_0xf570('0x6d')]=JSON[_0xf570('0x6b')](Mustache[_0xf570('0x71')](JSON[_0xf570('0x72')](_0x4b3118[_0xf570('0x6d')]),_0x127303,{},['$$','$$']));}if(_0x4b3118['body']){_0x4b3118[_0xf570('0x6a')]=JSON[_0xf570('0x6b')](Mustache[_0xf570('0x71')](JSON[_0xf570('0x72')](_0x4b3118[_0xf570('0x6a')]),_0x127303,{},['$$','$$']));}}catch(_0x8591d7){logger[_0xf570('0x2a')](_0xf570('0x73'),_0x8591d7);}}rp(_0x4b3118)['then'](function(_0x1bf5b9){var _0xa1f33a={'statusCode':_0x1bf5b9['statusCode']||0xc8,'statusMessage':_0x1bf5b9['statusMessage']||'OK','headers':_0x1bf5b9['headers']||{},'body':_0x1bf5b9[_0xf570('0x6a')]||{}};_0xfa55e(null,_0xa1f33a);})[_0xf570('0x15')](function(_0x30c54d){var _0x2b24da={'statusCode':_0x30c54d['statusCode']||0x1f4,'statusMessage':_0x30c54d[_0xf570('0x74')]||_0xf570('0x75'),'headers':_0x30c54d[_0xf570('0x76')][_0xf570('0x6d')]||{},'body':_0x30c54d['options'][_0xf570('0x6a')]||{}};_0xfa55e(null,_0x2b24da);});};AGIVertices[_0xf570('0x10')][_0xf570('0x77')]=function(_0x3d76b2,_0xc1e6f){scripts[_0xf570('0x77')](this['channel'][_0xf570('0x35')],_0x3d76b2[_0xf570('0x78')],_0x3d76b2[_0xf570('0x5a')],_0x3d76b2['dialogflow_language']||'en')['then'](function(_0x3fd265){_0xc1e6f(null,_0x3fd265);})[_0xf570('0x15')](function(_0x143a92){_0xc1e6f(_0x143a92);});};AGIVertices[_0xf570('0x10')][_0xf570('0x79')]=function(_0x3c69b6,_0x247123){scripts[_0xf570('0x79')](this[_0xf570('0xd')][_0xf570('0x35')],_0x3c69b6[_0xf570('0x7a')],_0x3c69b6['client_email'],_0x3c69b6['private_key'],_0x3c69b6[_0xf570('0x5a')],_0x3c69b6['dialogflowV2_language']||'en')[_0xf570('0x11')](function(_0xe414e7){_0x247123(null,_0xe414e7);})[_0xf570('0x15')](function(_0x2d96db){_0x247123(_0x2d96db);});};AGIVertices[_0xf570('0x10')][_0xf570('0x7b')]=function(_0x5f4af3,_0x3053b2){scripts[_0xf570('0x7b')](this['channel'],_0x5f4af3)[_0xf570('0x11')](function(_0x2ef7c4){_0x3053b2(null,_0x2ef7c4);})[_0xf570('0x15')](function(_0x422194){_0x3053b2(_0x422194);});};AGIVertices[_0xf570('0x10')][_0xf570('0x7c')]=function(_0x2c55e8,_0x5b4f62){scripts[_0xf570('0x7c')](_0x2c55e8[_0xf570('0x78')],_0x2c55e8['text'],_0x2c55e8[_0xf570('0x7d')]||_0xf570('0x5c'),_0x2c55e8[_0xf570('0x7e')])[_0xf570('0x11')](function(_0x48f2d6){_0x5b4f62(null,_0x48f2d6);})[_0xf570('0x15')](function(_0x4f9587){_0x5b4f62(_0x4f9587);});};AGIVertices[_0xf570('0x10')][_0xf570('0x7f')]=function(_0x530347,_0x3f0fc9,_0x5bf82a){scripts[_0xf570('0x7f')](_0x3f0fc9,_0x530347['key'],_0x530347[_0xf570('0x80')]||'en-US',this[_0xf570('0x81')](_0x530347[_0xf570('0x82')])?_0x530347['model']:undefined)[_0xf570('0x11')](function(_0x354b04){_0x5bf82a(null,_0x354b04);})[_0xf570('0x15')](function(_0x2c57bb){_0x5bf82a(_0x2c57bb);});};AGIVertices[_0xf570('0x10')][_0xf570('0x83')]=function(_0x39d9cc,_0x53811c){scripts['awsPolly'](_0x39d9cc['aws_access_key_id'],_0x39d9cc[_0xf570('0x84')],_0x39d9cc['aws_polly_region'],_0x39d9cc['aws_polly_voice']||'Amy',_0x39d9cc['text'],_0x39d9cc[_0xf570('0x85')]||_0xf570('0x5a'))['then'](function(_0x1e0e6a){_0x53811c(null,_0x1e0e6a);})[_0xf570('0x15')](function(_0x441c22){_0x53811c(_0x441c22);});};AGIVertices['prototype']['awsLex']=function(_0x4b8a51,_0x1a74cc){scripts[_0xf570('0x86')](this[_0xf570('0xd')]['uniqueid'],_0x4b8a51[_0xf570('0x87')],_0x4b8a51[_0xf570('0x84')],_0x4b8a51[_0xf570('0x88')],_0x4b8a51['text'],_0x4b8a51[_0xf570('0x89')])[_0xf570('0x11')](function(_0xfdb7be){_0x1a74cc(null,_0xfdb7be);})[_0xf570('0x15')](function(_0x5db039){_0x1a74cc(_0x5db039);});};AGIVertices[_0xf570('0x10')][_0xf570('0x8a')]=function(_0xce1615,_0x1826e8,_0x4211c3){scripts[_0xf570('0x8a')](_0x1826e8,_0xce1615['key'],_0xce1615['google_asr_language']||_0xf570('0x5c'))[_0xf570('0x11')](function(_0x4c43e2){_0x4211c3(null,_0x4c43e2);})[_0xf570('0x15')](function(_0x508371){_0x4211c3(_0x508371);});};AGIVertices[_0xf570('0x10')][_0xf570('0x8b')]=function(_0x4cf38d,_0x584afc,_0x2a3c93){scripts[_0xf570('0x8b')](_0x584afc,_0x4cf38d[_0xf570('0x8c')],_0x4cf38d[_0xf570('0x8d')],_0x4cf38d[_0xf570('0x8e')])[_0xf570('0x11')](function(_0x33f5bc){_0x2a3c93(null,_0x33f5bc);})[_0xf570('0x15')](function(_0x27d204){_0x2a3c93(_0x27d204);});};AGIVertices['prototype'][_0xf570('0x8f')]=function(_0x19cfe0){var _0x2c4bc8=_[_0xf570('0x66')](verticesWithRetry,_0x19cfe0[_0xf570('0x37')])?_0x19cfe0:_['clone'](_0x19cfe0);for(var _0x2d16dd in _0x2c4bc8){if(_0x2c4bc8[_0xf570('0x90')](_0x2d16dd)){if(_0x2c4bc8[_0x2d16dd]&&_[_0xf570('0x91')](_0x2c4bc8[_0x2d16dd])){if(_[_0xf570('0x66')](recursiveMapAttributes,_0x2d16dd)){_0x2c4bc8[_0x2d16dd]=this[_0xf570('0x92')](_0x2c4bc8[_0x2d16dd]);}else{_0x2c4bc8[_0x2d16dd]=this[_0xf570('0x93')](_0x2c4bc8[_0x2d16dd]);}}}}return _0x2c4bc8;};AGIVertices[_0xf570('0x10')][_0xf570('0x94')]=function(_0x10c3bc){for(var _0x43422a in _0x10c3bc){if(_0x10c3bc['hasOwnProperty'](_0x43422a)){if(_['isPlainObject'](_0x10c3bc[_0x43422a])){this[_0xf570('0x94')](_0x10c3bc[_0x43422a]);}else if(_[_0xf570('0x95')](_0x10c3bc[_0x43422a])){for(var _0x25057c=0x0;_0x25057c<_0x10c3bc[_0x43422a][_0xf570('0x96')];_0x25057c++){this[_0xf570('0x94')](_0x10c3bc[_0x43422a][_0x25057c]);}}else if(_[_0xf570('0x91')](_0x10c3bc[_0x43422a])){_0x10c3bc[_0x43422a]=this['replaceAllVariables'](_0x10c3bc[_0x43422a]);}}}};AGIVertices['prototype'][_0xf570('0x97')]=function(_0x1eb18f,_0xe57970){for(var _0x6c1269 in _0x1eb18f){if(_0x1eb18f['hasOwnProperty'](_0x6c1269)){if(_[_0xf570('0x98')](_0x1eb18f[_0x6c1269])){if(!_[_0xf570('0x42')](_0x1eb18f[_0x6c1269])){this[_0xf570('0x97')](_0x1eb18f[_0x6c1269],util[_0xf570('0x27')]('%s.%s',_0xe57970,_0x6c1269));}}else if(_[_0xf570('0x95')](_0x1eb18f[_0x6c1269])){for(var _0xf4e6ca=0x0;_0xf4e6ca<_0x1eb18f[_0x6c1269]['length'];_0xf4e6ca++){this[_0xf570('0x97')](_0x1eb18f[_0x6c1269][_0xf4e6ca],util['format'](_0xf570('0x99'),_0xe57970,_0x6c1269+'['+_0xf4e6ca+']'));}}else{if(!_[_0xf570('0x43')](_0x1eb18f[_0x6c1269])){this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')]('%s.%s',_0xe57970,_0x6c1269),_0x1eb18f[_0x6c1269]);}}}}};AGIVertices[_0xf570('0x10')][_0xf570('0x92')]=function(_0x320a7e){try{var _0x20af63=JSON[_0xf570('0x6b')](_0x320a7e);this['recursiveNodeIndex'](_0x20af63);return JSON['stringify'](_0x20af63);}catch(_0x1f44db){return this[_0xf570('0x93')](_0x320a7e);}};AGIVertices[_0xf570('0x10')]['replaceAllVariables']=function(_0x9fdfef){var _0x365310=_0x9fdfef[_0xf570('0x9b')]('{');for(var _0x40d916=0x1;_0x40d916<_0x365310['length'];_0x40d916+=0x1){var _0x2f5d66=_0x365310[_0x40d916][_0xf570('0x9b')]('}');if(_0x2f5d66['length']>0x1){_0x9fdfef=_0x9fdfef[_0xf570('0x9c')]('{'+_0x2f5d66[0x0]+'}',this[_0xf570('0xd')][_0xf570('0x9d')](_0x2f5d66[0x0])[_0xf570('0x9e')]||_0x2f5d66[0x0]);}}if(_0x365310[_0xf570('0x96')]===0x1){return _0x9fdfef['toString']();}return this[_0xf570('0x93')](_0x9fdfef);};AGIVertices[_0xf570('0x10')][_0xf570('0x9f')]=function(_0x7612f2,_0x1e4847){var _0x5b7144=this[_0xf570('0xd')][_0xf570('0x9d')](_0x7612f2);if(_0x5b7144[_0xf570('0xa0')]===-0x1){return _0x5b7144;}logger['info'](util[_0xf570('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1e4847,_0x5b7144[_0xf570('0x9e')]));return this['channel']['setVariable'](_0x1e4847,_0x5b7144['extra']);};AGIVertices[_0xf570('0x10')][_0xf570('0x81')]=function(_0x2b7dae){return _0x2b7dae&&_0x2b7dae!=='0'&&_0x2b7dae!=='-1'&&_0x2b7dae!=='';};AGIVertices['prototype'][_0xf570('0xa1')]=function(_0x7c7006){this[_0xf570('0x34')][_0xf570('0x70')](this,_0x7c7006,'-');_0x7c7006[_0xf570('0xa2')]=_0x7c7006['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xf570('0x10')]['mrcpsynth']=function(_0x511591){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xa3'),_0x511591[_0xf570('0x36')]));if(!this['isConfigured'](_0x511591[_0xf570('0x5a')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}var _0x2b061b='\x22'+_0x511591['text']+'\x22';if(this[_0xf570('0x81')](_0x511591['options'])){_0x2b061b+=','+_0x511591[_0xf570('0x76')];}var _0xcb9572=this[_0xf570('0xd')][_0xf570('0x55')](_0xf570('0xa6'),_0x2b061b);if(_0xcb9572['result']===-0x1){return _0xcb9572;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xa7'),_0x2b061b));};AGIVertices[_0xf570('0x10')][_0xf570('0xa8')]=function(_0x5d0fec){logger['info'](util[_0xf570('0x27')](_0xf570('0xa9'),_0x5d0fec[_0xf570('0x36')]));if(!this['isConfigured'](_0x5d0fec['grammar'])){return this[_0xf570('0xd')]['noop'](_0xf570('0xaa'));}var _0x81222f=_0x5d0fec['grammar'];if(this[_0xf570('0x81')](_0x5d0fec[_0xf570('0x76')])){_0x81222f+=','+_0x5d0fec['options'];}var _0x1d6da8=this['channel'][_0xf570('0x55')](_0xf570('0xab'),_0x81222f);if(_0x1d6da8[_0xf570('0xa0')]===-0x1){return _0x1d6da8;}var _0x57a156=this[_0xf570('0x9f')](_0xf570('0xac'),_0xf570('0xad'));if(_0x57a156[_0xf570('0xa0')]===-0x1){return _0x57a156;}var _0x308f02=this[_0xf570('0x9f')](_0xf570('0xae'),_0xf570('0xaf'));if(_0x308f02[_0xf570('0xa0')]===-0x1){return _0x308f02;}var _0x17919a=this['getAndSetVariable'](_0xf570('0xb0'),'MRCP_RECOG_INSTANCE');if(_0x17919a[_0xf570('0xa0')]===-0x1){return _0x17919a;}return this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0xb1'),_0x81222f));};AGIVertices[_0xf570('0x10')]['agi']=function(_0x3201ce){logger[_0xf570('0x2c')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3201ce[_0xf570('0x36')]));return this[_0xf570('0xd')][_0xf570('0x7')]([_0x3201ce[_0xf570('0xb2')],_0x3201ce[_0xf570('0xb3')]]);};AGIVertices[_0xf570('0x10')][_0xf570('0xb4')]=function(_0x24228d){logger['info'](util[_0xf570('0x27')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x24228d[_0xf570('0x36')]));if(this[_0xf570('0x81')](_0x24228d['timeout'])){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xb5'),_0x24228d[_0xf570('0x64')]));var _0x18afc=this['channel'][_0xf570('0xb6')](_0x24228d['timeout']);if(_0x18afc[_0xf570('0xa0')]===-0x1){return _0x18afc;}}return this[_0xf570('0xd')][_0xf570('0xb4')]();};AGIVertices['prototype'][_0xf570('0x49')]=function(_0x16a90c){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xb7'),_0x16a90c['label']));if(!this[_0xf570('0x81')](_0x16a90c['list_id'])){return this[_0xf570('0xd')]['error'](_0x16a90c,_0xf570('0xb8'));}_0x16a90c[_0xf570('0x48')]=moment();if(this[_0xf570('0x81')](_0x16a90c['delay'])){_0x16a90c['scheduledAt']=moment()[_0xf570('0xb9')](_0x16a90c['delay'],_0xf570('0xba'));}if(!this[_0xf570('0x81')](_0x16a90c['callback_priority'])){_0x16a90c[_0xf570('0xbb')]=0x2;}this['createCmContact'][_0xf570('0x70')](this,_0x16a90c);return this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0xbc'),_0x16a90c[_0xf570('0x46')],_0x16a90c['list_id'],_0x16a90c['scheduledAt']));};AGIVertices['prototype'][_0xf570('0xbd')]=function(_0x12e086){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xbe'),_0x12e086[_0xf570('0x36')]));var _0x39b09a=this[_0xf570('0xd')]['exec'](_0x12e086[_0xf570('0xbf')],_0x12e086[_0xf570('0x76')]);if(_0x39b09a['result']===-0x1){return _0x39b09a;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xc0'),_0x12e086[_0xf570('0xbf')],_0x12e086[_0xf570('0x76')]));};AGIVertices[_0xf570('0x10')][_0xf570('0xc1')]=function(_0x3b254c){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xc2'),_0x3b254c['label']));if(!this[_0xf570('0x81')](_0x3b254c[_0xf570('0x5a')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}var _0x31e24a='\x22'+_0x3b254c['text']+'\x22';if(this[_0xf570('0x81')](_0x3b254c[_0xf570('0x76')])){_0x31e24a+=','+_0x3b254c[_0xf570('0x76')];}var _0x42d6aa=this[_0xf570('0xd')][_0xf570('0x55')](_0xf570('0xa6'),_0x31e24a);if(_0x42d6aa['result']===-0x1){return _0x42d6aa;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xa7'),_0x31e24a));};AGIVertices[_0xf570('0x10')][_0xf570('0xc3')]=function(_0x40cddb){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xc4'),_0x40cddb[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x40cddb[_0xf570('0x5a')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}var _0xcd50f6='\x22'+_0x40cddb[_0xf570('0x5a')]+'\x22';if(this[_0xf570('0x81')](_0x40cddb[_0xf570('0x76')])){_0xcd50f6+=','+_0x40cddb[_0xf570('0x76')];}var _0x35fb09=this[_0xf570('0xd')]['exec'](_0xf570('0xa6'),_0xcd50f6);if(_0x35fb09[_0xf570('0xa0')]===-0x1){return _0x35fb09;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0xcd50f6));};AGIVertices[_0xf570('0x10')][_0xf570('0xc5')]=function(_0x5e7326){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xc6'),_0x5e7326[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x5e7326[_0xf570('0xc7')])){return this[_0xf570('0xd')]['noop']('no\x20grammar\x20configured');}var _0x596e5e=_0x5e7326[_0xf570('0xc7')];if(this['isConfigured'](_0x5e7326[_0xf570('0x76')])){_0x596e5e+=','+_0x5e7326[_0xf570('0x76')];}var _0x5e4a27=this[_0xf570('0xd')]['exec'](_0xf570('0xab'),_0x596e5e);if(_0x5e4a27[_0xf570('0xa0')]===-0x1){return _0x5e4a27;}var _0xbf4363=this[_0xf570('0x9f')]('RECOG_CONFIDENCE()',_0xf570('0xc8'));if(_0xbf4363[_0xf570('0xa0')]===-0x1){return _0xbf4363;}var _0x4737ab=this['getAndSetVariable'](_0xf570('0xae'),_0xf570('0xc9'));if(_0x4737ab['result']===-0x1){return _0x4737ab;}var _0x568cd0=this[_0xf570('0x9f')](_0xf570('0xb0'),_0xf570('0xca'));if(_0x568cd0[_0xf570('0xa0')]===-0x1){return _0x568cd0;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xb1'),_0x596e5e));};AGIVertices[_0xf570('0x10')][_0xf570('0xcb')]=function(_0x421401){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xcc'),_0x421401['label']));if(!this[_0xf570('0x81')](_0x421401[_0xf570('0xc7')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xaa'));}var _0x30a964=_0x421401[_0xf570('0xc7')];if(this[_0xf570('0x81')](_0x421401[_0xf570('0x76')])){_0x30a964+=','+_0x421401[_0xf570('0x76')];}var _0x480777=this[_0xf570('0xd')][_0xf570('0x55')]('MRCPRecog',_0x30a964);if(_0x480777['result']===-0x1){return _0x480777;}var _0x15da0b=this[_0xf570('0x9f')](_0xf570('0xac'),_0xf570('0xcd'));if(_0x15da0b[_0xf570('0xa0')]===-0x1){return _0x15da0b;}var _0x2a2d47=this[_0xf570('0x9f')]('RECOG_INPUT()',_0xf570('0xce'));if(_0x2a2d47[_0xf570('0xa0')]===-0x1){return _0x2a2d47;}var _0x42045a=this[_0xf570('0x9f')](_0xf570('0xb0'),_0xf570('0xcf'));if(_0x42045a[_0xf570('0xa0')]===-0x1){return _0x42045a;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xb1'),_0x30a964));};AGIVertices[_0xf570('0x10')][_0xf570('0xd0')]=function(_0x28dfb9){logger[_0xf570('0x2c')](util['format'](_0xf570('0xd1'),_0x28dfb9[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x28dfb9[_0xf570('0xd2')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x28dfb9,'no\x20database\x20selected');}var _0x455e08=this[_0xf570('0x18')][_0xf570('0x70')](this,_0x28dfb9[_0xf570('0xd2')]);if(!_0x455e08){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x28dfb9,_0xf570('0xd3'));}if(!this[_0xf570('0x81')](_0x28dfb9[_0xf570('0x2e')])){return this['channel'][_0xf570('0x2a')](_0x28dfb9,_0xf570('0xd4'));}var _0xc70a04=_0x28dfb9[_0xf570('0x2e')][_0xf570('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xd5'),_0xc70a04));var _0x54aac0=this[_0xf570('0x28')][_0xf570('0x70')](this,_0x455e08,_0xc70a04);this[_0xf570('0x34')][_0xf570('0x70')](this,_0x28dfb9,_0xc70a04);if(!this[_0xf570('0x81')](_0x28dfb9[_0xf570('0xd6')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xd7'));}var _0x34b059=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x28dfb9[_0xf570('0xd6')]);if(!_0x34b059){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x28dfb9,_0xf570('0xd8'));}var _0xfecfd2=this;_0x54aac0['forEach'](function(_0x2823a6,_0x4ac239){Object[_0xf570('0xd9')](_0x2823a6)[_0xf570('0xda')](function(_0x4fdd50){_0xfecfd2[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')]('%s[%s][%s]',_0x34b059,_0x4ac239,_0x4fdd50),_0x2823a6[_0x4fdd50]);});});this['channel'][_0xf570('0x9a')](util['format'](_0xf570('0xdb'),_0x34b059),_0x54aac0[_0xf570('0x96')]);return this[_0xf570('0xd')]['noop'](util[_0xf570('0x27')](_0xf570('0xdc'),_0x34b059));};AGIVertices['prototype'][_0xf570('0xdd')]=function(_0x3b8e24){logger[_0xf570('0xde')](util[_0xf570('0x27')](_0xf570('0xdf'),_0x3b8e24[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x3b8e24[_0xf570('0xe0')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x3b8e24,_0xf570('0xe1'));}var _0x17de57=this[_0xf570('0x1a')]['sync'](this,_0x3b8e24[_0xf570('0xe0')]);if(!_0x17de57){return this['channel'][_0xf570('0x2a')](_0x3b8e24,_0xf570('0xe2'));}var _0x103487=this['channel'][_0xf570('0x55')](_0xf570('0xe3'),[util[_0xf570('0x27')]('SIP/%s',_0x17de57),_0x3b8e24[_0xf570('0x64')],_0x3b8e24[_0xf570('0xe4')],_0x3b8e24['url']]);if(_0x103487[_0xf570('0xa0')]===-0x1){return _0x103487;}return this['channel'][_0xf570('0xa4')](util['format'](_0xf570('0xe5'),'DIAL'));};AGIVertices[_0xf570('0x10')]['dialogflow']=function(_0x58f9a0){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xe6'),_0x58f9a0['label']));if(!this[_0xf570('0x81')](_0x58f9a0[_0xf570('0x78')])){return this[_0xf570('0xd')]['noop'](_0xf570('0xe7'));}if(!this[_0xf570('0x81')](_0x58f9a0[_0xf570('0x5a')])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20text\x20configured');}this[_0xf570('0xd')][_0xf570('0xe8')]=!![];this[_0xf570('0x34')](_0x58f9a0);this['createSquareMessage'](_0x58f9a0[_0xf570('0x5a')],'in','','');this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0xe9'),_0x58f9a0[_0xf570('0x5a')]));var _0x5923a0=this[_0xf570('0x77')][_0xf570('0x70')](this,_0x58f9a0);if(_0x5923a0){for(var _0x4cc196 in _0x5923a0){if(_0x5923a0['hasOwnProperty'](_0x4cc196)){this[_0xf570('0xd')][_0xf570('0x9a')](util['format']('DIALOGFLOW_%s',_0x4cc196['toUpperCase']()),_0x5923a0[_0x4cc196]);}}this[_0xf570('0x40')](_0x5923a0[_0xf570('0xea')],_0xf570('0xeb'),_0xf570('0xec'),'');return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')]('Dialogflow\x20Result\x20%s',_0x5923a0['speech']));}return this['channel'][_0xf570('0x2a')](_0x58f9a0,_0xf570('0xed'));};AGIVertices['prototype'][_0xf570('0xee')]=function(_0x5bfa1a){logger[_0xf570('0x2c')](util[_0xf570('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x5bfa1a[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x5bfa1a[_0xf570('0x7a')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xef'));}if(!this[_0xf570('0x81')](_0x5bfa1a[_0xf570('0xf0')])){return this['channel']['noop'](_0xf570('0xf1'));}if(!this[_0xf570('0x81')](_0x5bfa1a[_0xf570('0xf2')])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20private_key\x20configured');}if(!this[_0xf570('0x81')](_0x5bfa1a[_0xf570('0xf3')])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20anguage\x20configured');}if(!this[_0xf570('0x81')](_0x5bfa1a[_0xf570('0x5a')])){return this[_0xf570('0xd')]['noop'](_0xf570('0xa5'));}this[_0xf570('0xd')][_0xf570('0xe8')]=!![];this[_0xf570('0x34')](_0x5bfa1a);this[_0xf570('0x40')](_0x5bfa1a[_0xf570('0x5a')],'in','','');this[_0xf570('0xd')][_0xf570('0xa4')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x5bfa1a[_0xf570('0x5a')]));var _0x3b82f0=this[_0xf570('0x79')]['sync'](this,_0x5bfa1a);if(_0x3b82f0){for(var _0x5cd73d in _0x3b82f0){if(_0x3b82f0[_0xf570('0x90')](_0x5cd73d)){if(_0x5cd73d!==_0xf570('0xf4')){this['channel'][_0xf570('0x9a')](util['format']('DIALOGFLOW_%s',_0x5cd73d[_0xf570('0x69')]()),_0x3b82f0[_0x5cd73d]);}}}this[_0xf570('0x40')](_0x3b82f0[_0xf570('0xea')],_0xf570('0xeb'),_0xf570('0xee'),_0x3b82f0[_0xf570('0xf4')]);return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xf5'),_0x3b82f0['speech']));}return this[_0xf570('0xd')][_0xf570('0x2a')](_0x5bfa1a,_0xf570('0xf6'));};AGIVertices[_0xf570('0x10')][_0xf570('0xf7')]=function(_0x3a963d){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xf8'),_0x3a963d[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x3a963d['ndauth_url'])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x3a963d[_0xf570('0xf9')])){return this['channel'][_0xf570('0xa4')](_0xf570('0xfa'));}if(!this[_0xf570('0x81')](_0x3a963d[_0xf570('0xfb')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xfc'));}if(!this[_0xf570('0x81')](_0x3a963d[_0xf570('0xfd')])){return this['channel'][_0xf570('0xa4')](_0xf570('0xa5'));}this[_0xf570('0xd')][_0xf570('0xe8')]=!![];this[_0xf570('0x34')](_0x3a963d);this[_0xf570('0x40')](_0x3a963d[_0xf570('0x5a')],'in','','');this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0xfe'),_0x3a963d['text']));var _0x40afac=this[_0xf570('0x7b')][_0xf570('0x70')](this,_0x3a963d);if(_0x40afac){for(var _0x5d0f4c in _0x40afac){if(_0x40afac[_0xf570('0x90')](_0x5d0f4c)){this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')]('SESTEK_NDA_%s',_0x5d0f4c[_0xf570('0x69')]()),_0x40afac[_0x5d0f4c]);}}this[_0xf570('0x40')](_0x40afac['speech'],'out',_0xf570('0xf7'),'');if(_0x40afac[_0xf570('0xff')]){this[_0xf570('0xd')]['noop'](util['format'](_0xf570('0x100'),_0x40afac['audiofile']));var _0x5c5154=this['channel'][_0xf570('0x101')](_0x40afac[_0xf570('0xff')]);try{fs['unlink'](_0x40afac['audiofile']+_0xf570('0x102'));}catch(_0x39f8e7){logger[_0xf570('0x2a')](_0x39f8e7);}return _0x5c5154;}else{return this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0x103'),_0x40afac[_0xf570('0xea')]));}}return this[_0xf570('0xd')]['error'](_0x3a963d,_0xf570('0x104'));};AGIVertices[_0xf570('0x10')][_0xf570('0x105')]=function(_0x3e3670){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x106'),_0x3e3670['label']));return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x105'));};AGIVertices[_0xf570('0x10')][_0xf570('0x107')]=function(_0x263922){logger[_0xf570('0x2c')](util['format'](_0xf570('0x108'),_0x263922[_0xf570('0x36')]));var _0x463d59='';if(_0x263922['trunk_id']){if(!this[_0xf570('0x81')](_0x263922[_0xf570('0x109')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x263922,_0xf570('0x10a'));}else{var _0xc63c1c=parseInt(_0x263922['trunk_id'],0xa);if(isNaN(_0xc63c1c)){_0x463d59=_0x263922[_0xf570('0x109')];}else{_0x463d59=this['getTrunk'][_0xf570('0x70')](this,_0x263922[_0xf570('0x109')]);if(!_0x463d59){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x263922,_0xf570('0x10b'));}}}}else if(_0x263922[_0xf570('0x10c')]){_0x463d59=_0x263922['trunk_name'];}else{return this[_0xf570('0xd')][_0xf570('0x2a')](_0x263922,_0xf570('0x10a'));}var _0x44c2ac=this['channel'][_0xf570('0x55')](_0xf570('0xe3'),[util[_0xf570('0x27')](_0xf570('0x10d'),_0x463d59,_0x263922[_0xf570('0x46')]),_0x263922[_0xf570('0x64')],_0x263922['opts'],_0x263922['url']]);if(_0x44c2ac['result']===-0x1){return _0x44c2ac;}return this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xe5'),_0xf570('0xe3')));};AGIVertices['prototype']['finally']=function(_0x415676){logger[_0xf570('0x2c')](util['format'](_0xf570('0x10e'),_0x415676[_0xf570('0x36')]));return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x10f'));};AGIVertices[_0xf570('0x10')][_0xf570('0xc')]=function(_0x49333d){logger[_0xf570('0x2c')](util[_0xf570('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x49333d[_0xf570('0x36')]));if(_0x49333d['retry']===0x0){return this[_0xf570('0xa1')](_0x49333d);}_0x49333d[_0xf570('0xa2')]-=0x1;if(!this[_0xf570('0x81')](_0x49333d[_0xf570('0x110')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x49333d,_0xf570('0x111'));}var _0x103558=this[_0xf570('0x1e')][_0xf570('0x70')](this,_0x49333d[_0xf570('0x110')]);if(!_0x103558){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x49333d,_0xf570('0x112'));}if(!this[_0xf570('0x81')](_0x49333d[_0xf570('0xd6')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0xf570('0xd7'));}var _0x3d1bca=this[_0xf570('0xd')][_0xf570('0x113')](_0x103558,_0x49333d[_0xf570('0x114')],_0x49333d['maxdigit']);var _0x427cd0=_0x3d1bca[_0xf570('0xa0')]?_0x3d1bca[_0xf570('0xa0')][_0xf570('0x4a')]():'';logger[_0xf570('0x2c')](_0xf570('0x115'),JSON[_0xf570('0x72')](_0x3d1bca));if(_0x3d1bca[_0xf570('0xa0')]===-0x1){this[_0xf570('0x34')][_0xf570('0x70')](this,_0x49333d,_0x427cd0);return _0x3d1bca;}else if(_0x3d1bca[_0xf570('0x9e')]===_0xf570('0x64')){_0x3d1bca[_0xf570('0xa0')]=_0x427cd0['length']>=parseInt(_0x49333d[_0xf570('0x116')])?'x':'i';}else{_0x3d1bca[_0xf570('0xa0')]=_0x427cd0[_0xf570('0x96')]>=parseInt(_0x49333d['mindigit'])&&_0x427cd0[_0xf570('0x96')]<=parseInt(_0x49333d[_0xf570('0x117')])?'x':'i';}var _0x40e359=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x49333d['variable_id']);if(!_0x40e359){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x49333d,_0xf570('0xd8'));}this['channel'][_0xf570('0x9a')](_0x40e359,_0x427cd0);if(this[_0xf570('0x81')](_0x49333d['hiddendigitsnum'])){var _0x44988e=parseInt(_0x49333d[_0xf570('0x118')],0xa);var _0x3c0c51=rs[_0xf570('0x119')]({'charset':'*','length':_0x44988e});var _0x318f45=_0x427cd0[_0xf570('0x96')];if(_0x318f45>0x0){if(_0x318f45>_0x44988e){this['createSquareDetailsReport'][_0xf570('0x70')](this,_0x49333d,_0x49333d['hiddendigitspos']===_0xf570('0x11a')?_0x3c0c51+_0x427cd0[_0xf570('0x11b')](_0x44988e):_0x427cd0['substr'](0x0,_0x318f45-_0x44988e)+_0x3c0c51);}else{this[_0xf570('0x34')][_0xf570('0x70')](this,_0x49333d,rs[_0xf570('0x119')]({'charset':'*','length':_0x318f45}));}}else{this['createSquareDetailsReport'][_0xf570('0x70')](this,_0x49333d,'');}}else{this[_0xf570('0x34')][_0xf570('0x70')](this,_0x49333d,_0x427cd0);}return _0x3d1bca;};AGIVertices['prototype']['getsecretdigits']=function(_0x2b6928){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x11c'),_0x2b6928['label']));return this[_0xf570('0xc')](_0x2b6928);};AGIVertices['prototype'][_0xf570('0x11d')]=function(_0x502ae6){logger['info'](util[_0xf570('0x27')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x502ae6[_0xf570('0x36')]));this[_0xf570('0x34')][_0xf570('0x70')](this,_0x502ae6,_0x502ae6[_0xf570('0x11e')]);return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x11f'),_0x502ae6[_0xf570('0x11e')]));};AGIVertices['prototype'][_0xf570('0x120')]=function(_0x95dcaf){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x121'),_0x95dcaf[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x95dcaf[_0xf570('0x87')])||!this[_0xf570('0x81')](_0x95dcaf[_0xf570('0x84')])){return this[_0xf570('0xd')]['noop'](_0xf570('0x122'));}if(!this[_0xf570('0x81')](_0x95dcaf[_0xf570('0x5a')])){return this[_0xf570('0xd')]['noop']('no\x20text\x20configured');}this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x123'),_0x95dcaf[_0xf570('0x5a')]));var _0xed2a35=this['awsPolly'][_0xf570('0x70')](this,_0x95dcaf);if(_0xed2a35){this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x124'),_0xed2a35));var _0x48012d=this[_0xf570('0xd')][_0xf570('0x101')](_0xed2a35);try{fs[_0xf570('0x125')](_0xed2a35+_0xf570('0x102'));}catch(_0x2e18d7){logger[_0xf570('0x2a')](_0x2e18d7);}return _0x48012d;}return this[_0xf570('0xd')]['error'](_0x95dcaf,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xf570('0x10')][_0xf570('0x126')]=function(_0x3ed942){logger[_0xf570('0x2c')](util['format'](_0xf570('0x127'),_0x3ed942[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x3ed942[_0xf570('0x87')])||!this[_0xf570('0x81')](_0x3ed942[_0xf570('0x84')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x122'));}if(!this[_0xf570('0x81')](_0x3ed942[_0xf570('0x89')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x128'));}if(!this[_0xf570('0x81')](_0x3ed942['text'])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}this['channel'][_0xf570('0xe8')]=!![];this[_0xf570('0x34')](_0x3ed942);this[_0xf570('0x40')](_0x3ed942[_0xf570('0x5a')],'in','','');this[_0xf570('0xd')]['noop'](util['format'](_0xf570('0x129'),_0x3ed942[_0xf570('0x5a')]));var _0x28498a=this[_0xf570('0x86')][_0xf570('0x70')](this,_0x3ed942);if(_0x28498a){for(var _0x41f333 in _0x28498a){if(_0x28498a[_0xf570('0x90')](_0x41f333)&&_[_0xf570('0x91')](_0x28498a[_0x41f333])){this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')](_0xf570('0x12a'),_0x41f333['toUpperCase']()),_0x28498a[_0x41f333]);}}if(_['isNil'](_0x28498a[_0xf570('0x74')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x12b'));}else{this['createSquareMessage'](_0x28498a[_0xf570('0x74')],'out',_0xf570('0x12c'),'');return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x12d'),_0x28498a[_0xf570('0x74')]));}}return this[_0xf570('0xd')][_0xf570('0x2a')](_0x3ed942,_0xf570('0x12e'));};AGIVertices[_0xf570('0x10')][_0xf570('0x12f')]=function(_0x2659aa){logger[_0xf570('0x2c')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2659aa[_0xf570('0x36')],_0x2659aa[_0xf570('0x64')]));if(!this[_0xf570('0x81')](_0x2659aa['key'])){return this['channel']['noop'](_0xf570('0xe7'));}var _0x5798e0=_0xf570('0x130');var _0x3bdad4=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xf570('0x119')](0x4));var _0xd88a09=util[_0xf570('0x27')](_0xf570('0x99'),_0x3bdad4,_0x5798e0);var _0x1d077a=!![];if(_0x2659aa['beep']===_0xf570('0x131')){_0x1d077a=![];}var _0x396bce=this['channel'][_0xf570('0x132')](_0x3bdad4,_0x5798e0,_0x2659aa[_0xf570('0x133')],_0x2659aa[_0xf570('0x64')],undefined,_0x1d077a);if(_0x396bce[_0xf570('0xa0')]!==-0x1){this[_0xf570('0xd')]['noop'](util[_0xf570('0x27')](_0xf570('0x134'),_0xd88a09));var _0x3a106b=this[_0xf570('0x8a')]['sync'](this,_0x2659aa,_0xd88a09);if(_0x3a106b){for(var _0x37ed00 in _0x3a106b){if(_0x3a106b[_0xf570('0x90')](_0x37ed00)){this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')]('GOOGLE_ASR_%s',_0x37ed00[_0xf570('0x69')]()),_0x3a106b[_0x37ed00]);}}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x135'),JSON[_0xf570('0x72')](_0x3a106b)));}}return _0x396bce;};AGIVertices[_0xf570('0x10')][_0xf570('0x136')]=function(_0x46fe1d){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x137'),_0x46fe1d[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x46fe1d['appid'])){return this['channel'][_0xf570('0xa4')](_0xf570('0x138'));}if(!this[_0xf570('0x81')](_0x46fe1d[_0xf570('0x8d')])){return this['channel'][_0xf570('0xa4')](_0xf570('0x139'));}var _0x25f740='wav';var _0x16c63d=util[_0xf570('0x27')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x2b7042=util['format'](_0xf570('0x99'),_0x16c63d,_0x25f740);var _0x1cdf4f=!![];if(_0x46fe1d[_0xf570('0x13a')]===_0xf570('0x131')){_0x1cdf4f=![];}var _0x5973fe=this['channel'][_0xf570('0x132')](_0x16c63d,_0x25f740,_0x46fe1d[_0xf570('0x133')],_0x46fe1d[_0xf570('0x64')],undefined,_0x1cdf4f);if(_0x5973fe[_0xf570('0xa0')]!==-0x1){this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0x13b'),_0x2b7042));var _0x98b7bd=this[_0xf570('0x8b')]['sync'](this,_0x46fe1d,_0x2b7042);if(_0x98b7bd){for(var _0x20a79b in _0x98b7bd){if(_0x98b7bd[_0xf570('0x90')](_0x20a79b)){this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')](_0xf570('0x13c'),_0x20a79b[_0xf570('0x69')]()),_0x98b7bd[_0x20a79b]);}}return this['channel'][_0xf570('0xa4')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xf570('0x72')](_0x98b7bd)));}}return _0x5973fe;};AGIVertices['prototype'][_0xf570('0x13d')]=function(_0x24af2d){logger['info'](util['format'](_0xf570('0x13e'),_0x24af2d[_0xf570('0x36')]));return this[_0xf570('0xd')][_0xf570('0x13f')](_0x24af2d['context'],_0x24af2d[_0xf570('0x3b')],_0x24af2d['priority']);};AGIVertices[_0xf570('0x10')][_0xf570('0x140')]=function(_0x21afa7){logger['info'](util[_0xf570('0x27')](_0xf570('0x141'),_0x21afa7[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x21afa7[_0xf570('0x142')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x21afa7,_0xf570('0x143'));}try{var _0x365a3e=eval(_0x21afa7[_0xf570('0x142')])?'true':_0xf570('0x144');this[_0xf570('0xd')]['noop'](util[_0xf570('0x27')](_0xf570('0x145'),_0x21afa7[_0xf570('0x142')],_0x365a3e));return{'code':0xc8,'result':_0x365a3e};}catch(_0xdad3b9){return{'code':0xc8,'result':_0xf570('0x144')};}};AGIVertices[_0xf570('0x10')][_0xf570('0x146')]=function(_0xf9ab02){logger[_0xf570('0x2c')](util[_0xf570('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0xf9ab02[_0xf570('0x36')]));if(!this['isConfigured'](_0xf9ab02[_0xf570('0x147')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0xf9ab02,'no\x20interval\x20configured');}var _0x51e09f=this[_0xf570('0x148')][_0xf570('0x70')](this,_0xf9ab02[_0xf570('0x147')]);if(!_0x51e09f){return this[_0xf570('0xd')][_0xf570('0x2a')](_0xf9ab02,'no\x20intervals\x20found');}for(var _0x25ba15=0x0;_0x25ba15<_0x51e09f[_0xf570('0x96')];_0x25ba15+=0x1){var _0x57c80e=this['channel'][_0xf570('0x9d')](util[_0xf570('0x27')]('IFTIME(%s?true:false)',_0x51e09f[_0x25ba15]));if(_0x57c80e[_0xf570('0xa0')]===-0x1){return _0x57c80e;}logger[_0xf570('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x51e09f[_0x25ba15],_0x57c80e[_0xf570('0x9e')]));if(_0x57c80e[_0xf570('0x9e')]==='true'){logger[_0xf570('0x2c')](util[_0xf570('0x27')]('IFTIME\x20%s\x20%s',_0x51e09f[_0x25ba15],_0xf570('0x149')));this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x14a'),_0x51e09f[_0x25ba15],'true'));return{'code':0xc8,'result':_0xf570('0x149')};}else{logger[_0xf570('0x2c')](util[_0xf570('0x27')]('IFTIME\x20%s\x20%s',_0x51e09f[_0x25ba15],_0xf570('0x144')));this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x14a'),_0x51e09f[_0x25ba15],_0xf570('0x144')));}}return{'code':0xc8,'result':_0xf570('0x144')};};AGIVertices[_0xf570('0x10')][_0xf570('0x14b')]=function(_0xb48bfc){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x14c'),_0xb48bfc['label']));return this[_0xf570('0xd')][_0xf570('0x14b')]();};AGIVertices[_0xf570('0x10')][_0xf570('0x14d')]=function(_0x42dda3){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x14e'),_0x42dda3[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x42dda3[_0xf570('0x78')])){return this[_0xf570('0xd')]['noop'](_0xf570('0xe7'));}var _0x2e0f3d='wav';var _0xc82015=util['format'](_0xf570('0x14f'),FILES_PATH,rs['generate'](0x4));var _0xe6a21f=util[_0xf570('0x27')](_0xf570('0x99'),_0xc82015,_0x2e0f3d);var _0x2684e5=!![];if(_0x42dda3[_0xf570('0x13a')]===_0xf570('0x131')){_0x2684e5=![];}var _0x140efb=this['channel']['recordFile'](_0xc82015,_0x2e0f3d,_0x42dda3[_0xf570('0x133')],_0x42dda3['timeout'],undefined,_0x2684e5);if(_0x140efb['result']!==-0x1){this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')]('ispeech\x20%s\x20file\x20created',_0xe6a21f));var _0x12653e=this[_0xf570('0x7f')][_0xf570('0x70')](this,_0x42dda3,_0xe6a21f);if(_0x12653e){for(var _0x3ee6a8 in _0x12653e){if(_0x12653e[_0xf570('0x90')](_0x3ee6a8)){this[_0xf570('0xd')]['setVariable'](util[_0xf570('0x27')](_0xf570('0x150'),_0x3ee6a8[_0xf570('0x69')]()),_0x12653e[_0x3ee6a8]);}}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x151'),JSON[_0xf570('0x72')](_0x12653e)));}}return _0x140efb;};AGIVertices[_0xf570('0x10')][_0xf570('0x152')]=function(_0x5e41fe){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x153'),_0x5e41fe[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x5e41fe[_0xf570('0x78')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xe7'));}if(!this[_0xf570('0x81')](_0x5e41fe['text'])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0x154'),_0x5e41fe[_0xf570('0x5a')]));var _0x4189ff=this['ispeechTTS'][_0xf570('0x70')](this,_0x5e41fe);if(_0x4189ff){this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')]('ispeech\x20%s\x20file\x20created',_0x4189ff));var _0x420107=this['channel'][_0xf570('0x101')](_0x4189ff,_0x5e41fe[_0xf570('0x133')]);try{fs[_0xf570('0x125')](_0x4189ff+_0xf570('0x102'));}catch(_0x2a62b2){logger[_0xf570('0x2a')](_0x2a62b2);}return _0x420107;}return this[_0xf570('0xd')]['error'](_0x5e41fe,_0xf570('0x155'));};AGIVertices[_0xf570('0x10')][_0xf570('0x156')]=function(_0x216a81){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x157'),_0x216a81[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x216a81[_0xf570('0x158')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x216a81,_0xf570('0x159'));}logger['info'](util[_0xf570('0x27')](_0xf570('0x15a'),this[_0xf570('0xd')][_0xf570('0x38')],_0x216a81['findBy']));var _0x24eef8=this[_0xf570('0x51')][_0xf570('0x70')](this,_0x216a81['findBy']);if(_0x24eef8){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xf570('0xd')][_0xf570('0x38')],_0x216a81[_0xf570('0x158')]));this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x15b'),this['channel']['callerid'],_0x216a81[_0xf570('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xf570('0x2c')](util['format'](_0xf570('0x15c'),this[_0xf570('0xd')][_0xf570('0x38')],_0x216a81['findBy']));this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x15c'),this[_0xf570('0xd')][_0xf570('0x38')],_0x216a81[_0xf570('0x158')]));return{'code':0xc8,'result':_0xf570('0x15d')};}};AGIVertices['prototype'][_0xf570('0x15e')]=function(_0x4ece4f){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x15f'),_0x4ece4f[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x4ece4f[_0xf570('0x158')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x4ece4f,_0xf570('0x159'));}logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x15a'),this[_0xf570('0xd')][_0xf570('0x38')],_0x4ece4f['findBy']));var _0x33f61f=this[_0xf570('0x50')][_0xf570('0x70')](this,_0x4ece4f[_0xf570('0x158')]);if(_0x33f61f){logger['info'](util[_0xf570('0x27')](_0xf570('0x15b'),this['channel']['callerid'],_0x4ece4f[_0xf570('0x158')]));this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x15b'),this[_0xf570('0xd')][_0xf570('0x38')],_0x4ece4f[_0xf570('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xf570('0x2c')](util['format'](_0xf570('0x15c'),this['channel'][_0xf570('0x38')],_0x4ece4f[_0xf570('0x158')]));this['channel'][_0xf570('0xa4')](util['format'](_0xf570('0x15c'),this['channel'][_0xf570('0x38')],_0x4ece4f[_0xf570('0x158')]));return{'code':0xc8,'result':_0xf570('0x15d')};}};AGIVertices[_0xf570('0x10')][_0xf570('0x160')]=function(_0x2badd1){logger['info'](util['format'](_0xf570('0x161'),_0x2badd1[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x2badd1['operation'])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x2badd1,_0xf570('0x162'));}this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')]('math\x20%s',_0x2badd1[_0xf570('0x163')]));var _0xc561d3=eval(_0x2badd1[_0xf570('0x163')]);if(!this['isConfigured'](_0x2badd1['variable_id'])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xe495c=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x2badd1[_0xf570('0xd6')]);if(!_0xe495c){return this['channel']['error'](_0x2badd1,_0xf570('0xd8'));}if(_[_0xf570('0x95')](_0xc561d3)){var _0x2f048c=this;_0xc561d3['forEach'](function(_0x49e4e5,_0x2ebe05){_0x2f048c[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')](_0xf570('0x164'),_0xe495c,_0x2ebe05),_0x49e4e5);});return this[_0xf570('0xd')]['noop'](util['format'](_0xf570('0x165'),_0xe495c));}else{return this[_0xf570('0xd')][_0xf570('0x9a')](_0xe495c,_0xc561d3);}};AGIVertices[_0xf570('0x10')]['menu']=function(_0x521f6c){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x166'),_0x521f6c[_0xf570('0x36')]));if(_0x521f6c[_0xf570('0xa2')]===0x0){return this[_0xf570('0xa1')](_0x521f6c);}_0x521f6c[_0xf570('0xa2')]-=0x1;if(!this['isConfigured'](_0x521f6c[_0xf570('0x110')])){return this[_0xf570('0xd')]['error'](_0x521f6c,_0xf570('0x111'));}var _0x50880b=this[_0xf570('0x1e')][_0xf570('0x70')](this,_0x521f6c[_0xf570('0x110')]);if(!_0x50880b){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x521f6c,_0xf570('0x112'));}var _0x38ed76=this[_0xf570('0xd')][_0xf570('0x113')](_0x50880b,_0x521f6c[_0xf570('0x114')],_0x521f6c['digit']);var _0x55cd8a=_0x38ed76[_0xf570('0xa0')];if(_0x38ed76['result']===-0x1){this[_0xf570('0x34')][_0xf570('0x70')](this,_0x521f6c,'-1');return _0x38ed76;}else if(_0x38ed76[_0xf570('0x9e')]===_0xf570('0x64')){_0x38ed76[_0xf570('0xa0')]=_0x38ed76['result'][_0xf570('0x96')]>0x0?_0x38ed76['result']:'t';}else if(_[_0xf570('0x42')](_0x38ed76[_0xf570('0xa0')])){_0x38ed76[_0xf570('0xa0')]='#';_0x55cd8a='#';}if(!this['isConfigured'](_0x521f6c[_0xf570('0xd6')])){this['channel'][_0xf570('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x199bc9=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x521f6c[_0xf570('0xd6')]);if(!_0x199bc9){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x521f6c,_0xf570('0xd8'));}this['channel'][_0xf570('0x9a')](_0x199bc9,_0x55cd8a);}this[_0xf570('0x34')][_0xf570('0x70')](this,_0x521f6c,_0x55cd8a);return _0x38ed76;};AGIVertices['prototype'][_0xf570('0xa4')]=function(_0x394ce3){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x167'),_0x394ce3[_0xf570('0x36')]));return this['channel']['noop'](_0x394ce3[_0xf570('0x168')]||_0x394ce3[_0xf570('0x36')]);};AGIVertices[_0xf570('0x10')]['pause']=function(_0x35637c){logger[_0xf570('0x2c')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x35637c[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x35637c[_0xf570('0x158')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x35637c,_0xf570('0x159'));}logger[_0xf570('0x2c')](util[_0xf570('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf570('0xd')][_0xf570('0x38')],_0x35637c[_0xf570('0x158')]));var _0x22ccb1=this[_0xf570('0x4b')]['sync'](this,_0x35637c['pause_id']);var _0x370e73=this['agentPause'][_0xf570('0x70')](this,_0x35637c[_0xf570('0x158')],_0x22ccb1);if(_0x370e73){logger[_0xf570('0x2c')](util[_0xf570('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf570('0xd')][_0xf570('0x38')],_0x35637c['findBy']));this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x35637c[_0xf570('0x158')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xf570('0x27')](_0xf570('0x15c'),this[_0xf570('0xd')][_0xf570('0x38')],_0x35637c[_0xf570('0x158')]));this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x15b'),this[_0xf570('0xd')][_0xf570('0x38')],_0x35637c['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xf570('0x169')]=function(_0x295921){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x16a'),_0x295921[_0xf570('0x36')]));if(!this['isConfigured'](_0x295921[_0xf570('0x110')])){return this['channel']['error'](_0x295921,'no\x20file\x20audio\x20selected');}var _0x557f19=this[_0xf570('0x1e')][_0xf570('0x70')](this,_0x295921[_0xf570('0x110')]);if(!_0x557f19){return this[_0xf570('0xd')]['error'](_0x295921,'no\x20file\x20audio\x20found');}var _0x580203=this['channel'][_0xf570('0x55')](_0xf570('0x16b'),[_0x557f19,_0x295921[_0xf570('0xe4')]]);if(_0x580203[_0xf570('0xa0')]===-0x1){return _0x580203;}return this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0xc0'),_0xf570('0x16b'),_0x557f19));};AGIVertices[_0xf570('0x10')][_0xf570('0x16c')]=function(_0x11c482){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x16d'),_0x11c482[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x11c482[_0xf570('0x16e')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x11c482,_0xf570('0x16f'));}var _0x4c2190='';var _0x6494c2=parseInt(_0x11c482[_0xf570('0x16e')],0xa);if(isNaN(_0x6494c2)){_0x4c2190=_0x11c482[_0xf570('0x16e')];}else{_0x4c2190=this[_0xf570('0x13')][_0xf570('0x70')](this,_0x11c482[_0xf570('0x16e')]);if(!_0x4c2190){return this['channel'][_0xf570('0x2a')](_0x11c482,'no\x20queue\x20found');}}var _0x29d9d9='';if(this[_0xf570('0x81')](_0x11c482[_0xf570('0x110')])){var _0x3f7404=this['getSound'][_0xf570('0x70')](this,_0x11c482[_0xf570('0x110')]);if(_0x3f7404){_0x29d9d9=_0x3f7404;}}this['createSquareDetailsReport'][_0xf570('0x70')](this,_0x11c482,_0x4c2190);if(_0x11c482[_0xf570('0xe4')][_0xf570('0x170')]('x')<0x0){_0x11c482[_0xf570('0xe4')]+='x';}if(_0x11c482[_0xf570('0xe4')][_0xf570('0x170')]('X')<0x0){_0x11c482[_0xf570('0xe4')]+='X';}this[_0xf570('0xd')]['setVariable']('XMCS-QUEUE',_0x4c2190?_0x4c2190[_0xf570('0x171')]():'');var _0x56327f=this[_0xf570('0xd')][_0xf570('0x55')]('QUEUE',[_0x4c2190,_0x11c482['opts'],_0x11c482['url'],_0x29d9d9,_0x11c482[_0xf570('0x64')],_0x11c482[_0xf570('0x7')],_0x11c482[_0xf570('0x172')],_0x11c482[_0xf570('0x173')],'',_0x11c482[_0xf570('0x174')]]);if(_0x56327f['result']===-0x1){return _0x56327f;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xc0'),'QUEUE',_0x4c2190));};AGIVertices['prototype'][_0xf570('0x175')]=function(_0x1ef107){logger[_0xf570('0x2c')](util['format'](_0xf570('0x176'),_0x1ef107['label']));var _0x390dcf=_0x1ef107[_0xf570('0x177')]||_0xf570('0x130');var _0x135beb=util['format']('%s_%s',this['channel'][_0xf570('0x35')],rs['generate'](0x5));var _0x273a56=util[_0xf570('0x27')](_0xf570('0x178'),FILES_PATH,_0x135beb,_0x390dcf);var _0x22f01b=util[_0xf570('0x27')](_0xf570('0x14f'),FILES_PATH,_0x135beb);this[_0xf570('0x39')][_0xf570('0x70')](this,_0x1ef107,_0x135beb,_0x273a56);this[_0xf570('0xd')][_0xf570('0x9a')]('RECORDING_SAVENAME',_0x135beb);logger[_0xf570('0x2c')](_0xf570('0x179'),_0x22f01b,_0x390dcf,_0x1ef107[_0xf570('0x17a')],_0x1ef107['timeout']);return this['channel'][_0xf570('0x132')](_0x22f01b,_0x390dcf,_0x1ef107['escape_digits'],_0x1ef107[_0xf570('0x64')],undefined,!![]);};AGIVertices['prototype'][_0xf570('0x17b')]=function(_0x3b08b){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x17c'),_0x3b08b['label']));if(!this['isConfigured'](_0x3b08b['url'])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20url\x20configured');}var _0xaefaa3=this[_0xf570('0x61')][_0xf570('0x70')](this,_0x3b08b);logger[_0xf570('0x2c')](util[_0xf570('0x27')]('Response:',util[_0xf570('0x17d')](_0xaefaa3,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3b08b[_0xf570('0xd6')])){return this['channel'][_0xf570('0xa4')](_0xf570('0x17e'));}var _0xf63099=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x3b08b[_0xf570('0xd6')]);if(!_0xf63099){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x3b08b,_0xf570('0xd8'));}this['channel'][_0xf570('0x9a')](util[_0xf570('0x27')](_0xf570('0x17f'),_0xf63099),_0xaefaa3['statusCode']?_0xaefaa3[_0xf570('0x180')]:_0xf570('0x181'));this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')](_0xf570('0x182'),_0xf63099),_0xaefaa3[_0xf570('0x183')]?_0xaefaa3[_0xf570('0x183')]:'OK');if(_0xaefaa3[_0xf570('0x6a')]){try{this['saveRestApiResult'](_0xaefaa3[_0xf570('0x6a')],_0xf63099);}catch(_0x280851){logger['error'](util[_0xf570('0x27')](_0xf570('0x184'),_0xf63099));}}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xdc'),_0xf63099));};AGIVertices[_0xf570('0x10')][_0xf570('0x185')]=function(_0x5b418f){logger['info'](util['format'](_0xf570('0x186'),_0x5b418f['label']));return this[_0xf570('0xd')][_0xf570('0x187')](_0x5b418f[_0xf570('0x188')][_0xf570('0x57')](/\s+/g,''),_0x5b418f[_0xf570('0x17a')]);};AGIVertices['prototype'][_0xf570('0x189')]=function(_0x24a0c0){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x24a0c0[_0xf570('0x36')]));return this['channel']['sayNumber'](_0x24a0c0[_0xf570('0x65')][_0xf570('0x57')](/\s+/g,''),_0x24a0c0[_0xf570('0x17a')]);};AGIVertices[_0xf570('0x10')][_0xf570('0x18a')]=function(_0xd3052f){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x18b'),_0xd3052f['label']));return this[_0xf570('0xd')]['sayPhonetic'](_0xd3052f[_0xf570('0x5a')],_0xd3052f[_0xf570('0x17a')]);};AGIVertices['prototype'][_0xf570('0x18c')]=function(_0x4f886c){logger[_0xf570('0x2c')](util['format'](_0xf570('0x18d'),_0x4f886c['label']));if(!this[_0xf570('0x81')](_0x4f886c[_0xf570('0x18e')])){return this['channel']['noop'](_0xf570('0x18f'));}var _0x5ab007=this[_0xf570('0x21')][_0xf570('0x70')](this,_0x4f886c[_0xf570('0x18e')]);if(!_0x5ab007||!_0x5ab007[_0xf570('0x190')]){return this['channel'][_0xf570('0x2a')](_0x4f886c,_0xf570('0x191'));}var _0x221628={'from':util[_0xf570('0x27')](_0xf570('0x192'),_0x5ab007['name'],_0x5ab007['email']||_0x5ab007[_0xf570('0x190')][_0xf570('0x193')]),'to':_0x4f886c['to']||'','cc':_0x4f886c['cc']||'','bcc':_0x4f886c[_0xf570('0x194')]||'','subject':_0x4f886c['subject'],'html':_0x4f886c['text'],'text':_0x4f886c[_0xf570('0x5a')]};if(this[_0xf570('0x81')](_0x4f886c[_0xf570('0x195')])){}logger['debug']('sendMail\x20message',JSON[_0xf570('0x72')](_0x221628));this[_0xf570('0x34')][_0xf570('0x70')](this,_0x4f886c,_0x4f886c[_0xf570('0x18e')]);this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0x196'),_0x5ab007['name']));this[_0xf570('0x23')][_0xf570('0x70')](this,_0x5ab007[_0xf570('0x197')],_0x221628);return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x198'));};AGIVertices[_0xf570('0x10')][_0xf570('0x199')]=function(_0x5f3c48){logger[_0xf570('0x2c')](util['format'](_0xf570('0x19a'),_0x5f3c48['label']));return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x19b'));};AGIVertices[_0xf570('0x10')][_0xf570('0x19c')]=function(_0xc247a9){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x19d'),_0xc247a9[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0xc247a9[_0xf570('0x19e')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x19f'));}var _0x31d27f=this[_0xf570('0x31')]['sync'](this,_0xc247a9[_0xf570('0x19e')]);if(!_0x31d27f){return this['channel'][_0xf570('0x2a')](_0xc247a9,_0xf570('0x1a0'));}var _0x2bddd2={'body':_0xc247a9[_0xf570('0x1a1')],'phone':_0xc247a9['to']||'','SmsAccountId':_0x31d27f['id']};logger[_0xf570('0xde')](_0xf570('0x1a2'),JSON['stringify'](_0x2bddd2));this[_0xf570('0x34')]['sync'](this,_0xc247a9,_0xc247a9['sms_account_id']);this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x1a3'),_0x31d27f['name']));this[_0xf570('0x33')]['sync'](this,_0x2bddd2);return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x1a4'));};AGIVertices[_0xf570('0x10')]['set']=function(_0x7e9514){logger[_0xf570('0x2c')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x7e9514[_0xf570('0x36')]));if(!this['isConfigured'](_0x7e9514[_0xf570('0xd6')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x7e9514,_0xf570('0x1a5'));}var _0x1d6540=this[_0xf570('0x9d')]['sync'](this,_0x7e9514[_0xf570('0xd6')]);if(!_0x1d6540){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x7e9514,_0xf570('0xd8'));}return this[_0xf570('0xd')][_0xf570('0x9a')](_0x1d6540,_0x7e9514[_0xf570('0x1a6')]);};AGIVertices[_0xf570('0x10')][_0xf570('0x1a7')]=function(_0x3712c7){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1a8'),_0x3712c7[_0xf570('0x36')]));this['channel'][_0xf570('0xa4')]('START\x20CALLY\x20SQUARE');if(_0x3712c7[_0xf570('0xb4')]===_0xf570('0x1a9')){this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x1aa'));return this['channel']['answer']();}return this[_0xf570('0xd')]['noop'](_0xf570('0x1ab'));};AGIVertices[_0xf570('0x10')]['subproject']=function(_0x1969f0){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1ac'),_0x1969f0['label']));if(!this[_0xf570('0x81')](_0x1969f0[_0xf570('0x1ad')])){return this[_0xf570('0xd')]['error'](_0x1969f0,'no\x20subproject\x20selected');}var _0x5a42d7=this[_0xf570('0x16')]['sync'](this,_0x1969f0['project_id']);if(!this['isConfigured'](_0x5a42d7)){return this['channel'][_0xf570('0x2a')](_0x1969f0,util[_0xf570('0x27')](_0xf570('0x1ae'),_0x1969f0[_0xf570('0x1ad')]));}if(_0x5a42d7===this[_0xf570('0xd')][_0xf570('0x3f')]){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x1969f0,_0xf570('0x1af'));}this[_0xf570('0x34')][_0xf570('0x70')](this,_0x1969f0,_0x5a42d7);var _0x3869e7=this[_0xf570('0xd')]['exec'](_0xf570('0x1b0'),util[_0xf570('0x27')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0xf570('0x1b1')]||'127.0.0.1',_0x5a42d7,this[_0xf570('0xd')][_0xf570('0x3f')]));if(_0x3869e7[_0xf570('0xa0')]===-0x1){return _0x3869e7;}return this['channel']['noop'](util[_0xf570('0x27')](_0xf570('0xc0'),'AGI',_0x5a42d7));};AGIVertices[_0xf570('0x10')][_0xf570('0x1b2')]=function(_0xa3d504){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1b3'),_0xa3d504[_0xf570('0x36')]));var _0x14441a=this['shellCommand'][_0xf570('0x70')](this,_0xa3d504[_0xf570('0xb2')]);this[_0xf570('0x34')][_0xf570('0x70')](this,_0xa3d504,_0xa3d504[_0xf570('0xb2')]);if(this[_0xf570('0x81')](_0xa3d504[_0xf570('0xd6')])){var _0x39fc82=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0xa3d504[_0xf570('0xd6')]);if(_0x39fc82){this['channel']['setVariable'](_0x39fc82,_0x14441a);return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x1b4'),_0xa3d504[_0xf570('0xb2')],_0x39fc82));}}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xa3d504[_0xf570('0xb2')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x320d4d){logger['info'](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x320d4d[_0xf570('0x36')]));_0x320d4d['text']=_0x320d4d[_0xf570('0x5a')][_0xf570('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf570('0x81')](_0x320d4d['apiKey'])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20apiKey\x20configured');}if(!this[_0xf570('0x81')](_0x320d4d[_0xf570('0x5a')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x1b5'),_0x320d4d[_0xf570('0x5a')]));var _0x50dcad=this[_0xf570('0x58')][_0xf570('0x70')](this,_0x320d4d);if(_0x50dcad){this['channel']['noop'](util[_0xf570('0x27')](_0xf570('0x1b6'),_0x50dcad));var _0x45692a=this[_0xf570('0xd')][_0xf570('0x101')](_0x50dcad);try{fs[_0xf570('0x125')](_0x50dcad+_0xf570('0x102'));}catch(_0x1b1210){logger[_0xf570('0x2a')](_0x1b1210);}return _0x45692a;}return this['channel'][_0xf570('0x2a')](_0x320d4d,_0xf570('0x1b7'));};AGIVertices[_0xf570('0x10')]['tts']=function(_0x2e7bf8){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1b8'),_0x2e7bf8[_0xf570('0x36')]));_0x2e7bf8['text']=_0x2e7bf8[_0xf570('0x5a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf570('0x81')](_0x2e7bf8[_0xf570('0x5a')])){return this['channel'][_0xf570('0xa4')]('no\x20text\x20configured');}this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x1b9'),_0x2e7bf8['text']));var _0x397866=this['googleTTS'][_0xf570('0x70')](this,_0x2e7bf8);if(_0x397866){this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x1ba'),_0x397866));var _0xc45351=this[_0xf570('0xd')][_0xf570('0x101')](_0x397866);try{fs['unlink'](_0x397866+'.wav');}catch(_0x5727f5){logger['error'](_0x5727f5);}return _0xc45351;}return this['channel']['error'](_0x2e7bf8,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xf570('0x1bb')]=function(_0x5b9c86){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1bc'),_0x5b9c86[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x5b9c86[_0xf570('0x158')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x5b9c86,_0xf570('0x159'));}logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x15a'),this[_0xf570('0xd')][_0xf570('0x38')],_0x5b9c86[_0xf570('0x158')]));var _0x39b7a1=this[_0xf570('0x4f')][_0xf570('0x70')](this,_0x5b9c86[_0xf570('0x158')]);if(_0x39b7a1){logger['info'](util[_0xf570('0x27')](_0xf570('0x15b'),this[_0xf570('0xd')][_0xf570('0x38')],_0x5b9c86[_0xf570('0x158')]));this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x15b'),this[_0xf570('0xd')]['callerid'],_0x5b9c86[_0xf570('0x158')]));return{'code':0xc8,'result':_0xf570('0x1bd')};}else{logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x15c'),this['channel'][_0xf570('0x38')],_0x5b9c86[_0xf570('0x158')]));this[_0xf570('0xd')]['noop'](util[_0xf570('0x27')](_0xf570('0x15c'),this['channel'][_0xf570('0x38')],_0x5b9c86[_0xf570('0x158')]));return{'code':0xc8,'result':_0xf570('0x15d')};}};AGIVertices['prototype'][_0xf570('0x1be')]=function(_0x1f85f2){logger['info'](util[_0xf570('0x27')](_0xf570('0x1bf'),_0x1f85f2[_0xf570('0x36')]));var _0x5a2a23=this[_0xf570('0xd')][_0xf570('0x55')](_0xf570('0x1c0'),[_0x1f85f2[_0xf570('0x1c1')],_0x1f85f2[_0xf570('0x76')]]);if(_0x5a2a23[_0xf570('0xa0')]===-0x1){return _0x5a2a23;}return this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xc0'),_0xf570('0x1c0'),_0x1f85f2[_0xf570('0x1c1')]));};AGIVertices['prototype'][_0xf570('0x1c2')]=function(_0x395feb){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1c3'),_0x395feb[_0xf570('0x36')]));if(!this['isConfigured'](_0x395feb[_0xf570('0xd6')])){return this[_0xf570('0xd')]['error'](_0x395feb,_0xf570('0x1a5'));}var _0x18fd12=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x395feb[_0xf570('0xd6')]);if(!_0x18fd12){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x395feb,_0xf570('0xd8'));}var _0x23f8f2=this['channel'][_0xf570('0x9d')](_0x18fd12);return{'code':0xc8,'result':_0x23f8f2[_0xf570('0x9e')]?_0x23f8f2[_0xf570('0x9e')]:'-'};};String['prototype'][_0xf570('0x9c')]=function(_0xb2063c,_0x58679d){return this[_0xf570('0x9b')](_0xb2063c)[_0xf570('0x1c4')](_0x58679d);};module['exports']=AGIVertices; \ No newline at end of file +var _0x180d=['sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','forEach','%s[%s][%s]','variable\x20%s\x20set','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','test','mindigit','maxdigit','hiddendigitsnum','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','NOBEEP','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20found','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','user','bcc','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','getSoundPath','format','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','agentPause','agent','error','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','method','timeout','number','includes','POST','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','key','ispeech_asr_language','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','toString','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','noop','isConfigured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','exec','MRCPRecog','RECOG_CONFIDENCE()','getAndSetVariable','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x180d,0xf9));var _0xd180=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x180d[_0x21a9d9];return _0x46adce;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xd180('0x0'));var sh=require(_0xd180('0x1'));var odbc=require(_0xd180('0x2'))();var rs=require(_0xd180('0x3'));var moment=require(_0xd180('0x4'));var Mustache=require('mustache');var rp=require(_0xd180('0x5'));var logger=require(_0xd180('0x6'))(_0xd180('0x7'));var config=require(_0xd180('0x8'));var shared=require(_0xd180('0x9'));var scripts=require(_0xd180('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xd180('0xb')];var verticesWithRetry=[_0xd180('0xc'),_0xd180('0xd'),_0xd180('0xe')];var AGIVertices=function(_0xd8fa8b,_0x42f372,_0x19f7b0){this[_0xd180('0xf')]=_0xd8fa8b;this[_0xd180('0x10')]=_0x42f372;this[_0xd180('0x11')]=_0x19f7b0;};AGIVertices[_0xd180('0x12')][_0xd180('0x13')]=function(_0x2f2dd4,_0x3fdebf){this['rpc'][_0xd180('0x14')](_0x2f2dd4)[_0xd180('0x15')](function(_0x1384c9){_0x3fdebf(null,_0x1384c9?_0x1384c9[_0xd180('0x16')]:![]);})[_0xd180('0x17')](function(_0x51f9fe){_0x3fdebf(_0x51f9fe);});};AGIVertices['prototype'][_0xd180('0x18')]=function(_0x2af39b,_0x18fb15){this[_0xd180('0x10')][_0xd180('0x19')](_0x2af39b)[_0xd180('0x15')](function(_0x4f80a4){_0x18fb15(null,_0x4f80a4?_0x4f80a4['name']:![]);})[_0xd180('0x17')](function(_0x50c4e6){_0x18fb15(_0x50c4e6);});};AGIVertices['prototype'][_0xd180('0x1a')]=function(_0x488435,_0x462a38){this[_0xd180('0x10')][_0xd180('0x1b')](_0x488435)[_0xd180('0x15')](function(_0x543e14){_0x462a38(null,_0x543e14?_0x543e14[_0xd180('0x16')]:![]);})['catch'](function(_0x3ed54d){_0x462a38(_0x3ed54d);});};AGIVertices[_0xd180('0x12')][_0xd180('0x1c')]=function(_0x2401fe,_0x1db22a){this[_0xd180('0x10')][_0xd180('0x1d')](_0x2401fe)['then'](function(_0x2a172d){_0x1db22a(null,_0x2a172d?_0x2a172d['dsn']:![]);})[_0xd180('0x17')](function(_0x3e6f03){_0x1db22a(_0x3e6f03);});};AGIVertices[_0xd180('0x12')][_0xd180('0x1e')]=function(_0x38c4f0,_0x25594f){this[_0xd180('0x10')][_0xd180('0x1f')](_0x38c4f0)[_0xd180('0x15')](function(_0x183110){_0x25594f(null,_0x183110?_0x183110[_0xd180('0x16')]:![]);})['catch'](function(_0x1ddd4e){_0x25594f(_0x1ddd4e);});};AGIVertices[_0xd180('0x12')]['getTrunk']=function(_0x7118d2,_0x3787dc){this[_0xd180('0x10')]['getTrunkById'](_0x7118d2)[_0xd180('0x15')](function(_0x24bae4){_0x3787dc(null,_0x24bae4?_0x24bae4[_0xd180('0x16')]:![]);})['catch'](function(_0x33f684){_0x3787dc(_0x33f684);});};AGIVertices[_0xd180('0x12')]['getSound']=function(_0x34c095,_0x38d44e){var _0xa20dd=this;this[_0xd180('0x10')][_0xd180('0x20')](_0x34c095)[_0xd180('0x15')](function(_0x23bb24){_0x38d44e(null,_0x23bb24?_0xa20dd['getSoundPath'](_0x23bb24[_0xd180('0x21')]):![]);})[_0xd180('0x17')](function(_0x159be6){_0x38d44e(_0x159be6);});};AGIVertices[_0xd180('0x12')][_0xd180('0x22')]=function(_0x9c93e2,_0x1d4f8f){this['rpc'][_0xd180('0x23')](_0x9c93e2)[_0xd180('0x15')](function(_0x4b412f){_0x1d4f8f(null,_0x4b412f?_0x4b412f:![]);})['catch'](function(_0x214924){_0x1d4f8f(_0x214924);});};AGIVertices[_0xd180('0x12')]['sendMailMessage']=function(_0x7be087,_0x2a7424,_0x45a5a4){this[_0xd180('0x11')][_0xd180('0x24')](_0x7be087,_0x2a7424)[_0xd180('0x15')](function(){_0x45a5a4(null);})[_0xd180('0x17')](function(_0x53a657){_0x45a5a4(_0x53a657);});};AGIVertices['prototype'][_0xd180('0x25')]=function(_0xaf4d30,_0x655d06){this[_0xd180('0x10')][_0xd180('0x26')](_0xaf4d30)[_0xd180('0x15')](function(_0x4bec06){if(_0x4bec06){if(_0x4bec06['IntervalId']){_0x655d06(null,[_0x4bec06[_0xd180('0x27')]]);}else{_0x655d06(null,_[_0xd180('0x28')](_0x4bec06['Intervals'],_0xd180('0x27')));}}else{_0x655d06(null,![]);}})[_0xd180('0x17')](function(_0x4053b8){_0x655d06(_0x4053b8);});};AGIVertices[_0xd180('0x12')][_0xd180('0x29')]=function(_0x44850d){return util[_0xd180('0x2a')]('%s/sounds/converted/%s',FILES_PATH,_0x44850d);};AGIVertices[_0xd180('0x12')]['getQueryOdbc']=function(_0x5858a6,_0x17e51a,_0x3375ff){odbc['open'](_0x5858a6,function(_0x1a8925){if(_0x1a8925){logger['error'](_0xd180('0x2b'),_0x1a8925);_0x3375ff(_0x1a8925);}else{logger['info'](_0xd180('0x2c'));odbc[_0xd180('0x2d')](_0x17e51a,function(_0x55509b,_0x57d116){if(_0x55509b){logger[_0xd180('0x2e')]('Error\x20executing\x20query\x20%s',_0x17e51a);_0x3375ff(_0x55509b);}else{logger[_0xd180('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x17e51a);odbc[_0xd180('0x2f')](function(_0x457bed){if(_0x457bed){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x457bed);}_0x3375ff(null,_0x57d116);});}});}});};AGIVertices['prototype'][_0xd180('0x30')]=function(_0x56d24e,_0x25570f){this[_0xd180('0x10')][_0xd180('0x31')](_0x56d24e)[_0xd180('0x15')](function(_0x158452){_0x25570f(null,_0x158452?_0x158452:![]);})[_0xd180('0x17')](function(_0x197946){_0x25570f(_0x197946);});};AGIVertices[_0xd180('0x12')][_0xd180('0x32')]=function(_0x58b657,_0x244758){this['rpc'][_0xd180('0x32')](_0x58b657)['then'](function(_0x2118f8){_0x244758(null,_0x2118f8);})['catch'](function(_0x15e82a){_0x244758(_0x15e82a);});};AGIVertices[_0xd180('0x12')][_0xd180('0x33')]=function(_0x501e2d,_0xacdf07,_0x518f94){this[_0xd180('0x10')][_0xd180('0x33')]({'uniqueid':this['channel'][_0xd180('0x34')],'node':_0x501e2d[_0xd180('0x35')],'application':_0x501e2d[_0xd180('0x36')],'data':_0xacdf07||null,'project_name':this[_0xd180('0xf')][_0xd180('0x37')],'callerid':this['channel'][_0xd180('0x38')]})[_0xd180('0x15')](function(_0x200bd6){if(_0x518f94){_0x518f94(null,_0x200bd6);}})[_0xd180('0x17')](function(_0x547b2b){if(_0x518f94){_0x518f94(_0x547b2b);}});};AGIVertices[_0xd180('0x12')][_0xd180('0x39')]=function(_0x328a35,_0x22b59f,_0x51da49,_0x4c7916){this['rpc'][_0xd180('0x39')]({'uniqueid':this[_0xd180('0xf')]['uniqueid'],'callerid':this[_0xd180('0xf')][_0xd180('0x38')],'calleridname':this[_0xd180('0xf')][_0xd180('0x3a')],'context':this['channel'][_0xd180('0x3b')],'extension':this[_0xd180('0xf')][_0xd180('0x3c')],'priority':this[_0xd180('0xf')]['priority'],'accountcode':this['channel'][_0xd180('0x3d')],'dnid':this[_0xd180('0xf')][_0xd180('0x3e')],'projectName':this[_0xd180('0xf')]['arg_1'],'saveName':_0x22b59f,'filename':_0x328a35[_0xd180('0x3f')]||_0x22b59f,'savePath':_0x51da49})['then'](function(_0x37973b){_0x4c7916(null,_0x37973b);})[_0xd180('0x17')](function(_0x2a4948){_0x4c7916(_0x2a4948);});};AGIVertices[_0xd180('0x12')][_0xd180('0x40')]=function(_0x1fa95c,_0x5c0c01,_0x56a646,_0x3b82d2,_0x48460d){this[_0xd180('0x10')][_0xd180('0x40')]({'uniqueid':this['channel'][_0xd180('0x34')],'body':_0x1fa95c,'direction':_0x5c0c01,'providerName':_0x56a646,'providerResponse':_0x3b82d2})['then'](function(_0x1d906f){if(_0x48460d){_0x48460d(null,_0x1d906f);}})[_0xd180('0x17')](function(_0x572205){if(_0x48460d){_0x48460d(_0x572205);}});};AGIVertices[_0xd180('0x12')]['createCmContact']=function(_0x4bb7b1,_0x1ee9aa){this[_0xd180('0x10')]['createCmContact']({'firstName':_[_0xd180('0x41')](_0x4bb7b1[_0xd180('0x16')])||_[_0xd180('0x42')](_0x4bb7b1[_0xd180('0x16')])?_0xd180('0x43')+Math[_0xd180('0x44')]():_0x4bb7b1['name'],'lastName':_[_0xd180('0x41')](_0x4bb7b1[_0xd180('0x45')])||_[_0xd180('0x42')](_0x4bb7b1[_0xd180('0x45')])?null:_0x4bb7b1['lastName'],'phone':_0x4bb7b1[_0xd180('0x46')],'ListId':_0x4bb7b1[_0xd180('0x47')],'scheduledat':_0x4bb7b1['scheduledAt'],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0xd180('0x48'),'description':_0xd180('0x49')+_0x4bb7b1[_0xd180('0x4a')]['toString'](),'priority':_0x4bb7b1[_0xd180('0x4b')]})[_0xd180('0x15')](function(_0x440356){_0x1ee9aa(null,_0x440356);})[_0xd180('0x17')](function(_0x59a757){_0x1ee9aa(_0x59a757);});};AGIVertices[_0xd180('0x12')]['getPause']=function(_0x27f243,_0x2f0a30){this[_0xd180('0x10')]['getPauseById'](_0x27f243)[_0xd180('0x15')](function(_0xa38223){_0x2f0a30(null,_0xa38223?_0xa38223[_0xd180('0x16')]:![]);})[_0xd180('0x17')](function(_0x1ae574){_0x2f0a30(_0x1ae574);});};AGIVertices[_0xd180('0x12')][_0xd180('0x4c')]=function(_0xa26588,_0x16e64e,_0x1acb16){var _0x4681d9={'role':_0xd180('0x4d')};_0x4681d9[_0xa26588]=this['channel'][_0xd180('0x38')];this['rpc'][_0xd180('0x4c')](_0x4681d9,_0x16e64e,this[_0xd180('0xf')][_0xd180('0x34')])[_0xd180('0x15')](function(_0x10df19){_0x1acb16(null,_[_0xd180('0x42')](_0x10df19)?![]:!![]);})['catch'](function(_0x345dfe){logger[_0xd180('0x4e')](_0x345dfe);_0x1acb16(null,![]);});};AGIVertices[_0xd180('0x12')][_0xd180('0x4f')]=function(_0x3b8fd2,_0x3def67){var _0x15c299={'role':_0xd180('0x4d')};_0x15c299[_0x3b8fd2]=this['channel']['callerid'];this[_0xd180('0x10')][_0xd180('0x4f')](_0x15c299)['then'](function(_0x469827){_0x3def67(null,_[_0xd180('0x42')](_0x469827)?![]:!![]);})[_0xd180('0x17')](function(_0xd14d6e){logger[_0xd180('0x4e')](_0xd14d6e);_0x3def67(null,![]);});};AGIVertices[_0xd180('0x12')][_0xd180('0x50')]=function(_0x5b767f,_0xb9b684){var _0x2add43={'role':'agent'};_0x2add43[_0x5b767f]=this[_0xd180('0xf')][_0xd180('0x38')];this[_0xd180('0x10')][_0xd180('0x50')](_0x2add43)[_0xd180('0x15')](function(_0x9ae61){_0xb9b684(null,_[_0xd180('0x42')](_0x9ae61)?![]:!![]);})[_0xd180('0x17')](function(_0x2ca65f){logger[_0xd180('0x4e')](_0x2ca65f);_0xb9b684(null,![]);});};AGIVertices[_0xd180('0x12')][_0xd180('0x51')]=function(_0x350ec4,_0x52131e){var _0x41141c={'role':_0xd180('0x4d')};_0x41141c[_0x350ec4]=this[_0xd180('0xf')][_0xd180('0x38')];var _0x57411c=_0x350ec4!='internal'?util[_0xd180('0x2a')](_0xd180('0x52'),_0xd180('0x53'),this[_0xd180('0xf')][_0xd180('0x38')]):undefined;this[_0xd180('0x10')][_0xd180('0x51')](_0x41141c,_0x57411c)[_0xd180('0x15')](function(_0x31aa39){_0x52131e(null,_[_0xd180('0x42')](_0x31aa39)?![]:!![]);})[_0xd180('0x17')](function(_0x51bc70){logger[_0xd180('0x4e')](_0x51bc70);_0x52131e(null,![]);});};AGIVertices[_0xd180('0x12')][_0xd180('0x54')]=function(_0x4f3a55,_0x5d4944){sh['exec'](_[_0xd180('0x55')](_0x4f3a55),function(_0x2f0d20,_0x38632a){var _0xc60cb4=_0x38632a[_0xd180('0x56')](/(\r\n|\n|\r)/gm,'');_0x5d4944(null,_0xc60cb4);});};AGIVertices[_0xd180('0x12')]['googleCloudTTS']=function(_0x5c8f1d,_0x31aa07){scripts[_0xd180('0x57')](_0x5c8f1d[_0xd180('0x58')],_0x5c8f1d[_0xd180('0x59')]||_0xd180('0x5a'),_0x5c8f1d[_0xd180('0x5a')],_0x5c8f1d[_0xd180('0x5b')]||'en-US',_0x5c8f1d[_0xd180('0x5c')]||_0xd180('0x5d'),_0x5c8f1d[_0xd180('0x5e')]||'MP3')['then'](function(_0x4ff406){_0x31aa07(null,_0x4ff406);})['catch'](function(_0x1270f9){_0x31aa07(_0x1270f9);});};AGIVertices[_0xd180('0x12')][_0xd180('0x5f')]=function(_0x108161,_0x56c075){scripts[_0xd180('0x5f')](_0x108161['text'],_0x108161['google_tts_language']||'en',0x1)[_0xd180('0x15')](function(_0x43729d){_0x56c075(null,_0x43729d);})[_0xd180('0x17')](function(_0x1c1011){_0x56c075(_0x1c1011);});};AGIVertices['prototype'][_0xd180('0x60')]=function(_0x30588a,_0x2ee7cf){var _0x32c813={'uri':_0x30588a[_0xd180('0x61')],'method':_0x30588a[_0xd180('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x30588a[_0xd180('0x63')])===_0xd180('0x64')&&parseInt(_0x30588a[_0xd180('0x63')])>=0x1?parseInt(_0x30588a[_0xd180('0x63')])*0x3e8:0x5*0x3e8};if(_[_0xd180('0x65')]([_0xd180('0x66'),'PUT'],_0x32c813[_0xd180('0x62')]['toUpperCase']())){try{_0x32c813[_0xd180('0x67')]=_0x30588a['rawBody']?JSON[_0xd180('0x68')](_0x30588a[_0xd180('0xb')]):{};}catch(_0x37f1a2){logger['error'](_0xd180('0x69'),_0x37f1a2);}}try{_0x32c813[_0xd180('0x6a')]=_0x30588a[_0xd180('0x6b')]?JSON[_0xd180('0x68')](_0x30588a[_0xd180('0x6b')]):{};}catch(_0x34409a){logger['error'](_0xd180('0x6c'),_0x34409a);}if(_0x30588a['computedVariables']){try{var _0x33f58d=require(_0x30588a[_0xd180('0x6d')])[_0xd180('0x6e')](this,_0x32c813);_0x32c813[_0xd180('0x6f')]=Mustache['render'](_0x30588a['url'],_0x33f58d,{},['$$','$$']);if(_0x32c813[_0xd180('0x6a')]){_0x32c813['headers']=JSON[_0xd180('0x68')](Mustache['render'](JSON['stringify'](_0x32c813['headers']),_0x33f58d,{},['$$','$$']));}if(_0x32c813[_0xd180('0x67')]){_0x32c813['body']=JSON[_0xd180('0x68')](Mustache[_0xd180('0x70')](JSON[_0xd180('0x71')](_0x32c813[_0xd180('0x67')]),_0x33f58d,{},['$$','$$']));}}catch(_0x279df1){logger[_0xd180('0x4e')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x279df1);}}rp(_0x32c813)['then'](function(_0x371fee){var _0x20bfff={'statusCode':_0x371fee[_0xd180('0x72')]||0xc8,'statusMessage':_0x371fee[_0xd180('0x73')]||'OK','headers':_0x371fee[_0xd180('0x6a')]||{},'body':_0x371fee[_0xd180('0x67')]||{}};_0x2ee7cf(null,_0x20bfff);})[_0xd180('0x17')](function(_0x1f30d6){var _0x1043c0={'statusCode':_0x1f30d6[_0xd180('0x72')]||0x1f4,'statusMessage':_0x1f30d6[_0xd180('0x74')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1f30d6['options'][_0xd180('0x6a')]||{},'body':_0x1f30d6[_0xd180('0x75')]['body']||{}};_0x2ee7cf(null,_0x1043c0);});};AGIVertices[_0xd180('0x12')][_0xd180('0x76')]=function(_0x132847,_0x5bfd5e){scripts[_0xd180('0x76')](this[_0xd180('0xf')]['uniqueid'],_0x132847['key'],_0x132847[_0xd180('0x5a')],_0x132847[_0xd180('0x77')]||'en')[_0xd180('0x15')](function(_0x165d2c){_0x5bfd5e(null,_0x165d2c);})['catch'](function(_0x289c34){_0x5bfd5e(_0x289c34);});};AGIVertices['prototype'][_0xd180('0x78')]=function(_0x50e499,_0x93f7f0){scripts[_0xd180('0x78')](this[_0xd180('0xf')]['uniqueid'],_0x50e499[_0xd180('0x79')],_0x50e499[_0xd180('0x7a')],_0x50e499[_0xd180('0x7b')],_0x50e499['text'],_0x50e499[_0xd180('0x7c')]||'en')[_0xd180('0x15')](function(_0x104bf2){_0x93f7f0(null,_0x104bf2);})[_0xd180('0x17')](function(_0x1cd947){_0x93f7f0(_0x1cd947);});};AGIVertices[_0xd180('0x12')][_0xd180('0x7d')]=function(_0x299045,_0x22172a){scripts[_0xd180('0x7d')](this[_0xd180('0xf')],_0x299045)[_0xd180('0x15')](function(_0x23e329){_0x22172a(null,_0x23e329);})[_0xd180('0x17')](function(_0xed34f7){_0x22172a(_0xed34f7);});};AGIVertices[_0xd180('0x12')][_0xd180('0x7e')]=function(_0x2cf157,_0x195273){scripts['ispeechTTS'](_0x2cf157['key'],_0x2cf157[_0xd180('0x5a')],_0x2cf157['ispeech_tts_language']||_0xd180('0x7f'),_0x2cf157[_0xd180('0x80')])['then'](function(_0x46689f){_0x195273(null,_0x46689f);})['catch'](function(_0x2d41e5){_0x195273(_0x2d41e5);});};AGIVertices[_0xd180('0x12')][_0xd180('0x81')]=function(_0x21562a,_0x458321,_0x147edd){scripts[_0xd180('0x81')](_0x458321,_0x21562a[_0xd180('0x82')],_0x21562a[_0xd180('0x83')]||'en-US',this['isConfigured'](_0x21562a[_0xd180('0x84')])?_0x21562a[_0xd180('0x84')]:undefined)['then'](function(_0x57cfc6){_0x147edd(null,_0x57cfc6);})[_0xd180('0x17')](function(_0x1cd704){_0x147edd(_0x1cd704);});};AGIVertices[_0xd180('0x12')]['awsPolly']=function(_0x55b5ed,_0x1f3f44){scripts['awsPolly'](_0x55b5ed[_0xd180('0x85')],_0x55b5ed[_0xd180('0x86')],_0x55b5ed[_0xd180('0x87')],_0x55b5ed[_0xd180('0x88')]||'Amy',_0x55b5ed[_0xd180('0x5a')],_0x55b5ed[_0xd180('0x89')]||_0xd180('0x5a'))[_0xd180('0x15')](function(_0x3b79eb){_0x1f3f44(null,_0x3b79eb);})[_0xd180('0x17')](function(_0x3c6de2){_0x1f3f44(_0x3c6de2);});};AGIVertices['prototype'][_0xd180('0x8a')]=function(_0x995a23,_0x4ff159){scripts[_0xd180('0x8a')](this[_0xd180('0xf')][_0xd180('0x34')],_0x995a23[_0xd180('0x85')],_0x995a23[_0xd180('0x86')],_0x995a23[_0xd180('0x8b')],_0x995a23[_0xd180('0x5a')],_0x995a23[_0xd180('0x8c')])['then'](function(_0xa5458){_0x4ff159(null,_0xa5458);})['catch'](function(_0x7471ca){_0x4ff159(_0x7471ca);});};AGIVertices[_0xd180('0x12')]['googleASR']=function(_0x17544c,_0x242d0b,_0x1e38ee){scripts[_0xd180('0x8d')](_0x242d0b,_0x17544c[_0xd180('0x82')],_0x17544c[_0xd180('0x8e')]||'en-US')[_0xd180('0x15')](function(_0x29ee3b){_0x1e38ee(null,_0x29ee3b);})['catch'](function(_0x514706){_0x1e38ee(_0x514706);});};AGIVertices[_0xd180('0x12')][_0xd180('0x8f')]=function(_0x34ed39,_0x303292,_0x413307){scripts[_0xd180('0x8f')](_0x303292,_0x34ed39[_0xd180('0x90')],_0x34ed39['appsecret'],_0x34ed39[_0xd180('0x6f')])[_0xd180('0x15')](function(_0x97bcb){_0x413307(null,_0x97bcb);})[_0xd180('0x17')](function(_0xbf0d26){_0x413307(_0xbf0d26);});};AGIVertices[_0xd180('0x12')][_0xd180('0x91')]=function(_0x5e9980){var _0x581125=_[_0xd180('0x65')](verticesWithRetry,_0x5e9980[_0xd180('0x36')])?_0x5e9980:_[_0xd180('0x92')](_0x5e9980);for(var _0x22e42e in _0x581125){if(_0x581125[_0xd180('0x93')](_0x22e42e)){if(_0x581125[_0x22e42e]&&_[_0xd180('0x94')](_0x581125[_0x22e42e])){if(_[_0xd180('0x65')](recursiveMapAttributes,_0x22e42e)){_0x581125[_0x22e42e]=this[_0xd180('0x95')](_0x581125[_0x22e42e]);}else{_0x581125[_0x22e42e]=this[_0xd180('0x96')](_0x581125[_0x22e42e]);}}}}return _0x581125;};AGIVertices[_0xd180('0x12')][_0xd180('0x97')]=function(_0x14a5c6){for(var _0x1ad48f in _0x14a5c6){if(_0x14a5c6[_0xd180('0x93')](_0x1ad48f)){if(_[_0xd180('0x98')](_0x14a5c6[_0x1ad48f])){this[_0xd180('0x97')](_0x14a5c6[_0x1ad48f]);}else if(_[_0xd180('0x99')](_0x14a5c6[_0x1ad48f])){for(var _0x44a055=0x0;_0x44a055<_0x14a5c6[_0x1ad48f][_0xd180('0x9a')];_0x44a055++){this[_0xd180('0x97')](_0x14a5c6[_0x1ad48f][_0x44a055]);}}else if(_[_0xd180('0x94')](_0x14a5c6[_0x1ad48f])){_0x14a5c6[_0x1ad48f]=this[_0xd180('0x96')](_0x14a5c6[_0x1ad48f]);}}}};AGIVertices[_0xd180('0x12')][_0xd180('0x9b')]=function(_0x256a68,_0x512bed){for(var _0x38692d in _0x256a68){if(_0x256a68[_0xd180('0x93')](_0x38692d)){if(_[_0xd180('0x98')](_0x256a68[_0x38692d])){if(!_['isEmpty'](_0x256a68[_0x38692d])){this[_0xd180('0x9b')](_0x256a68[_0x38692d],util['format'](_0xd180('0x9c'),_0x512bed,_0x38692d));}}else if(_[_0xd180('0x99')](_0x256a68[_0x38692d])){for(var _0x53aa66=0x0;_0x53aa66<_0x256a68[_0x38692d]['length'];_0x53aa66++){this[_0xd180('0x9b')](_0x256a68[_0x38692d][_0x53aa66],util[_0xd180('0x2a')]('%s.%s',_0x512bed,_0x38692d+'['+_0x53aa66+']'));}}else{if(!_[_0xd180('0x42')](_0x256a68[_0x38692d])){this['channel'][_0xd180('0x9d')](util['format'](_0xd180('0x9c'),_0x512bed,_0x38692d),_0x256a68[_0x38692d]);}}}}};AGIVertices[_0xd180('0x12')][_0xd180('0x95')]=function(_0x59a33e){try{var _0x6ca5a1=JSON[_0xd180('0x68')](_0x59a33e);this['recursiveNodeIndex'](_0x6ca5a1);return JSON[_0xd180('0x71')](_0x6ca5a1);}catch(_0x597736){return this[_0xd180('0x96')](_0x59a33e);}};AGIVertices[_0xd180('0x12')][_0xd180('0x96')]=function(_0x421a70){var _0x4080bd=_0x421a70[_0xd180('0x9e')]('{');for(var _0xb02088=0x1;_0xb02088<_0x4080bd[_0xd180('0x9a')];_0xb02088+=0x1){var _0x928ff9=_0x4080bd[_0xb02088]['split']('}');if(_0x928ff9[_0xd180('0x9a')]>0x1){_0x421a70=_0x421a70[_0xd180('0x9f')]('{'+_0x928ff9[0x0]+'}',this[_0xd180('0xf')]['getVariable'](_0x928ff9[0x0])['extra']||_0x928ff9[0x0]);}}if(_0x4080bd[_0xd180('0x9a')]===0x1){return _0x421a70[_0xd180('0xa0')]();}return this['replaceAllVariables'](_0x421a70);};AGIVertices[_0xd180('0x12')]['getAndSetVariable']=function(_0x8b7179,_0x14b678){var _0x75b99e=this[_0xd180('0xf')]['getVariable'](_0x8b7179);if(_0x75b99e['result']===-0x1){return _0x75b99e;}logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xa1'),_0x14b678,_0x75b99e[_0xd180('0xa2')]));return this[_0xd180('0xf')]['setVariable'](_0x14b678,_0x75b99e[_0xd180('0xa2')]);};AGIVertices[_0xd180('0x12')]['isConfigured']=function(_0x1b54af){return _0x1b54af&&_0x1b54af!=='0'&&_0x1b54af!=='-1'&&_0x1b54af!=='';};AGIVertices['prototype'][_0xd180('0xa3')]=function(_0x30c42f){this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x30c42f,'-');_0x30c42f[_0xd180('0xa4')]=_0x30c42f['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd180('0x12')][_0xd180('0xa5')]=function(_0x12806d){logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x12806d[_0xd180('0x35')]));if(!this['isConfigured'](_0x12806d[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20text\x20configured');}var _0xd19890='\x22'+_0x12806d[_0xd180('0x5a')]+'\x22';if(this[_0xd180('0xa7')](_0x12806d[_0xd180('0x75')])){_0xd19890+=','+_0x12806d[_0xd180('0x75')];}var _0x5250ba=this['channel']['exec'](_0xd180('0xa8'),_0xd19890);if(_0x5250ba[_0xd180('0xa9')]===-0x1){return _0x5250ba;}return this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xaa'),_0xd19890));};AGIVertices[_0xd180('0x12')][_0xd180('0xab')]=function(_0x533df4){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xac'),_0x533df4[_0xd180('0x35')]));if(!this['isConfigured'](_0x533df4[_0xd180('0xad')])){return this[_0xd180('0xf')]['noop'](_0xd180('0xae'));}var _0x414b7a=_0x533df4[_0xd180('0xad')];if(this[_0xd180('0xa7')](_0x533df4[_0xd180('0x75')])){_0x414b7a+=','+_0x533df4[_0xd180('0x75')];}var _0x27feed=this['channel'][_0xd180('0xaf')](_0xd180('0xb0'),_0x414b7a);if(_0x27feed[_0xd180('0xa9')]===-0x1){return _0x27feed;}var _0xfc14e5=this['getAndSetVariable'](_0xd180('0xb1'),'MRCP_RECOG_CONFIDENCE');if(_0xfc14e5[_0xd180('0xa9')]===-0x1){return _0xfc14e5;}var _0x3a3be6=this[_0xd180('0xb2')](_0xd180('0xb3'),'MRCP_RECOG_TRANSCRIPT');if(_0x3a3be6['result']===-0x1){return _0x3a3be6;}var _0xba017f=this[_0xd180('0xb2')](_0xd180('0xb4'),'MRCP_RECOG_INSTANCE');if(_0xba017f[_0xd180('0xa9')]===-0x1){return _0xba017f;}return this[_0xd180('0xf')]['noop'](util['format'](_0xd180('0xb5'),_0x414b7a));};AGIVertices[_0xd180('0x12')][_0xd180('0x7')]=function(_0x4c49c3){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xb6'),_0x4c49c3['label']));return this[_0xd180('0xf')][_0xd180('0x7')]([_0x4c49c3[_0xd180('0xb7')],_0x4c49c3['args']]);};AGIVertices[_0xd180('0x12')][_0xd180('0xb8')]=function(_0x55c5cd){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xb9'),_0x55c5cd['label']));if(this[_0xd180('0xa7')](_0x55c5cd['timeout'])){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xba'),_0x55c5cd[_0xd180('0x63')]));var _0x476bf1=this[_0xd180('0xf')][_0xd180('0xbb')](_0x55c5cd[_0xd180('0x63')]);if(_0x476bf1[_0xd180('0xa9')]===-0x1){return _0x476bf1;}}return this['channel'][_0xd180('0xb8')]();};AGIVertices[_0xd180('0x12')][_0xd180('0x48')]=function(_0x129591){logger[_0xd180('0x2e')](util['format'](_0xd180('0xbc'),_0x129591[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x129591['list_id'])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x129591,_0xd180('0xbd'));}_0x129591['scheduledAt']=moment();if(this[_0xd180('0xa7')](_0x129591[_0xd180('0xbe')])){_0x129591['scheduledAt']=moment()[_0xd180('0xbf')](_0x129591[_0xd180('0xbe')],_0xd180('0xc0'));}if(!this[_0xd180('0xa7')](_0x129591[_0xd180('0x4b')])){_0x129591[_0xd180('0x4b')]=0x2;}this['createCmContact'][_0xd180('0x6e')](this,_0x129591);return this[_0xd180('0xf')]['noop'](util['format'](_0xd180('0xc1'),_0x129591[_0xd180('0x46')],_0x129591[_0xd180('0x47')],_0x129591[_0xd180('0x4a')]));};AGIVertices[_0xd180('0x12')]['custom_app']=function(_0x1f9707){logger['info'](util[_0xd180('0x2a')](_0xd180('0xc2'),_0x1f9707['label']));var _0x563ed8=this[_0xd180('0xf')]['exec'](_0x1f9707[_0xd180('0xc3')],_0x1f9707[_0xd180('0x75')]);if(_0x563ed8[_0xd180('0xa9')]===-0x1){return _0x563ed8;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('Executed\x20command\x20%s\x20%s',_0x1f9707[_0xd180('0xc3')],_0x1f9707[_0xd180('0x75')]));};AGIVertices['prototype'][_0xd180('0xc4')]=function(_0x3cdaf9){logger[_0xd180('0x2e')](util['format'](_0xd180('0xc5'),_0x3cdaf9[_0xd180('0x35')]));if(!this['isConfigured'](_0x3cdaf9[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xc6'));}var _0x2a66ea='\x22'+_0x3cdaf9[_0xd180('0x5a')]+'\x22';if(this[_0xd180('0xa7')](_0x3cdaf9[_0xd180('0x75')])){_0x2a66ea+=','+_0x3cdaf9['options'];}var _0x39d986=this['channel'][_0xd180('0xaf')](_0xd180('0xa8'),_0x2a66ea);if(_0x39d986[_0xd180('0xa9')]===-0x1){return _0x39d986;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xaa'),_0x2a66ea));};AGIVertices[_0xd180('0x12')]['sestektts']=function(_0x235000){logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x235000['label']));if(!this[_0xd180('0xa7')](_0x235000[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xc6'));}var _0x5aa243='\x22'+_0x235000[_0xd180('0x5a')]+'\x22';if(this[_0xd180('0xa7')](_0x235000['options'])){_0x5aa243+=','+_0x235000[_0xd180('0x75')];}var _0x571208=this[_0xd180('0xf')]['exec'](_0xd180('0xa8'),_0x5aa243);if(_0x571208[_0xd180('0xa9')]===-0x1){return _0x571208;}return this[_0xd180('0xf')]['noop'](util[_0xd180('0x2a')](_0xd180('0xaa'),_0x5aa243));};AGIVertices['prototype'][_0xd180('0xc7')]=function(_0x29239f){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xc8'),_0x29239f['label']));if(!this[_0xd180('0xa7')](_0x29239f[_0xd180('0xad')])){return this[_0xd180('0xf')]['noop']('no\x20grammar\x20configured');}var _0x21df88=_0x29239f[_0xd180('0xad')];if(this[_0xd180('0xa7')](_0x29239f['options'])){_0x21df88+=','+_0x29239f['options'];}var _0x41b945=this[_0xd180('0xf')][_0xd180('0xaf')](_0xd180('0xb0'),_0x21df88);if(_0x41b945[_0xd180('0xa9')]===-0x1){return _0x41b945;}var _0x493aa3=this[_0xd180('0xb2')]('RECOG_CONFIDENCE()',_0xd180('0xc9'));if(_0x493aa3['result']===-0x1){return _0x493aa3;}var _0x3072d6=this['getAndSetVariable'](_0xd180('0xb3'),_0xd180('0xca'));if(_0x3072d6[_0xd180('0xa9')]===-0x1){return _0x3072d6;}var _0x202fbd=this[_0xd180('0xb2')](_0xd180('0xb4'),'LUMENVOX_ASR_INSTANCE');if(_0x202fbd[_0xd180('0xa9')]===-0x1){return _0x202fbd;}return this[_0xd180('0xf')][_0xd180('0xa6')](util['format'](_0xd180('0xb5'),_0x21df88));};AGIVertices[_0xd180('0x12')][_0xd180('0xcb')]=function(_0xc8d0bf){logger['info'](util[_0xd180('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0xc8d0bf[_0xd180('0x35')]));if(!this['isConfigured'](_0xc8d0bf[_0xd180('0xad')])){return this[_0xd180('0xf')]['noop'](_0xd180('0xae'));}var _0x4679bc=_0xc8d0bf[_0xd180('0xad')];if(this[_0xd180('0xa7')](_0xc8d0bf[_0xd180('0x75')])){_0x4679bc+=','+_0xc8d0bf[_0xd180('0x75')];}var _0x2360f7=this[_0xd180('0xf')][_0xd180('0xaf')](_0xd180('0xb0'),_0x4679bc);if(_0x2360f7[_0xd180('0xa9')]===-0x1){return _0x2360f7;}var _0x31ccdb=this[_0xd180('0xb2')]('RECOG_CONFIDENCE()',_0xd180('0xcc'));if(_0x31ccdb[_0xd180('0xa9')]===-0x1){return _0x31ccdb;}var _0x2c3634=this[_0xd180('0xb2')](_0xd180('0xb3'),'SESTEK_ASR_TRANSCRIPT');if(_0x2c3634[_0xd180('0xa9')]===-0x1){return _0x2c3634;}var _0x4ab5f6=this[_0xd180('0xb2')](_0xd180('0xb4'),_0xd180('0xcd'));if(_0x4ab5f6[_0xd180('0xa9')]===-0x1){return _0x4ab5f6;}return this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xb5'),_0x4679bc));};AGIVertices['prototype'][_0xd180('0xce')]=function(_0x5d46cc){logger['info'](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5d46cc[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x5d46cc[_0xd180('0xcf')])){return this[_0xd180('0xf')]['error'](_0x5d46cc,_0xd180('0xd0'));}var _0x14eaa1=this[_0xd180('0x1c')][_0xd180('0x6e')](this,_0x5d46cc['odbc_id']);if(!_0x14eaa1){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x5d46cc,_0xd180('0xd1'));}if(!this[_0xd180('0xa7')](_0x5d46cc['query'])){return this[_0xd180('0xf')]['error'](_0x5d46cc,_0xd180('0xd2'));}var _0x261423=_0x5d46cc[_0xd180('0x2d')][_0xd180('0x56')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')]('query:\x20%s',_0x261423));var _0x217185=this['getQueryOdbc']['sync'](this,_0x14eaa1,_0x261423);this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x5d46cc,_0x261423);if(!this[_0xd180('0xa7')](_0x5d46cc[_0xd180('0xd3')])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4959e0=this[_0xd180('0x13')][_0xd180('0x6e')](this,_0x5d46cc['variable_id']);if(!_0x4959e0){return this['channel'][_0xd180('0x4e')](_0x5d46cc,'no\x20variable\x20found');}var _0x4edd51=this;_0x217185['forEach'](function(_0x2e6a94,_0x2e2601){Object['keys'](_0x2e6a94)[_0xd180('0xd4')](function(_0x5b38d8){_0x4edd51['channel']['setVariable'](util[_0xd180('0x2a')](_0xd180('0xd5'),_0x4959e0,_0x2e2601,_0x5b38d8),_0x2e6a94[_0x5b38d8]);});});this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')]('%s_ROWS_COUNT',_0x4959e0),_0x217185[_0xd180('0x9a')]);return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xd6'),_0x4959e0));};AGIVertices[_0xd180('0x12')]['dial']=function(_0x529d6e){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x529d6e['label']));if(!this['isConfigured'](_0x529d6e[_0xd180('0xd7')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x529d6e,_0xd180('0xd8'));}var _0x426fb5=this[_0xd180('0x1e')]['sync'](this,_0x529d6e['sip_id']);if(!_0x426fb5){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x529d6e,_0xd180('0xd9'));}var _0xbd6c8f=this[_0xd180('0xf')]['exec'](_0xd180('0xda'),[util[_0xd180('0x2a')]('SIP/%s',_0x426fb5),_0x529d6e['timeout'],_0x529d6e['opts'],_0x529d6e[_0xd180('0x61')]]);if(_0xbd6c8f[_0xd180('0xa9')]===-0x1){return _0xbd6c8f;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('Executed\x20command\x20%s',_0xd180('0xda')));};AGIVertices[_0xd180('0x12')][_0xd180('0xdb')]=function(_0x2df58e){logger['info'](util[_0xd180('0x2a')](_0xd180('0xdc'),_0x2df58e[_0xd180('0x35')]));if(!this['isConfigured'](_0x2df58e[_0xd180('0x82')])){return this['channel'][_0xd180('0xa6')](_0xd180('0xdd'));}if(!this[_0xd180('0xa7')](_0x2df58e[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xc6'));}this['channel'][_0xd180('0xde')]=!![];this['createSquareDetailsReport'](_0x2df58e);this[_0xd180('0x40')](_0x2df58e[_0xd180('0x5a')],'in','','');this[_0xd180('0xf')]['noop'](util[_0xd180('0x2a')](_0xd180('0xdf'),_0x2df58e[_0xd180('0x5a')]));var _0x1c4d0f=this['googleDialogflow'][_0xd180('0x6e')](this,_0x2df58e);if(_0x1c4d0f){for(var _0x59ce47 in _0x1c4d0f){if(_0x1c4d0f[_0xd180('0x93')](_0x59ce47)){this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0xe0'),_0x59ce47[_0xd180('0xe1')]()),_0x1c4d0f[_0x59ce47]);}}this[_0xd180('0x40')](_0x1c4d0f[_0xd180('0xe2')],_0xd180('0xe3'),_0xd180('0xdb'),'');return this[_0xd180('0xf')]['noop'](util[_0xd180('0x2a')](_0xd180('0xe4'),_0x1c4d0f[_0xd180('0xe2')]));}return this[_0xd180('0xf')]['error'](_0x2df58e,_0xd180('0xe5'));};AGIVertices['prototype']['dialogflowV2']=function(_0x46246b){logger[_0xd180('0x2e')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x46246b[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x46246b[_0xd180('0x79')])){return this['channel'][_0xd180('0xa6')](_0xd180('0xe6'));}if(!this[_0xd180('0xa7')](_0x46246b[_0xd180('0x7a')])){return this[_0xd180('0xf')]['noop']('no\x20client_email\x20configured');}if(!this[_0xd180('0xa7')](_0x46246b[_0xd180('0x7b')])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20private_key\x20configured');}if(!this[_0xd180('0xa7')](_0x46246b[_0xd180('0x7c')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xe7'));}if(!this[_0xd180('0xa7')](_0x46246b[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xc6'));}this['channel'][_0xd180('0xde')]=!![];this[_0xd180('0x33')](_0x46246b);this[_0xd180('0x40')](_0x46246b['text'],'in','','');this[_0xd180('0xf')][_0xd180('0xa6')](util['format'](_0xd180('0xe8'),_0x46246b[_0xd180('0x5a')]));var _0x12976a=this[_0xd180('0x78')][_0xd180('0x6e')](this,_0x46246b);if(_0x12976a){for(var _0x49c169 in _0x12976a){if(_0x12976a[_0xd180('0x93')](_0x49c169)){if(_0x49c169!==_0xd180('0xe9')){this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0xe0'),_0x49c169[_0xd180('0xe1')]()),_0x12976a[_0x49c169]);}}}this['createSquareMessage'](_0x12976a[_0xd180('0xe2')],_0xd180('0xe3'),'dialogflowV2',_0x12976a[_0xd180('0xe9')]);return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xea'),_0x12976a[_0xd180('0xe2')]));}return this[_0xd180('0xf')][_0xd180('0x4e')](_0x46246b,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xd180('0x12')][_0xd180('0xeb')]=function(_0x345c6b){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xec'),_0x345c6b[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x345c6b[_0xd180('0xed')])){return this['channel'][_0xd180('0xa6')](_0xd180('0xee'));}if(!this[_0xd180('0xa7')](_0x345c6b['username'])){return this[_0xd180('0xf')]['noop'](_0xd180('0xef'));}if(!this[_0xd180('0xa7')](_0x345c6b[_0xd180('0xf0')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xf1'));}if(!this['isConfigured'](_0x345c6b['ndassistant_url'])){return this[_0xd180('0xf')]['noop']('no\x20text\x20configured');}this[_0xd180('0xf')][_0xd180('0xde')]=!![];this[_0xd180('0x33')](_0x345c6b);this[_0xd180('0x40')](_0x345c6b['text'],'in','','');this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xf2'),_0x345c6b[_0xd180('0x5a')]));var _0x5983f4=this[_0xd180('0x7d')]['sync'](this,_0x345c6b);if(_0x5983f4){for(var _0xa25b5d in _0x5983f4){if(_0x5983f4[_0xd180('0x93')](_0xa25b5d)){this['channel'][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0xf3'),_0xa25b5d['toUpperCase']()),_0x5983f4[_0xa25b5d]);}}this[_0xd180('0x40')](_0x5983f4[_0xd180('0xe2')],_0xd180('0xe3'),_0xd180('0xeb'),'');if(_0x5983f4[_0xd180('0xf4')]){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xf5'),_0x5983f4[_0xd180('0xf4')]));var _0x44eff0=this[_0xd180('0xf')][_0xd180('0xf6')](_0x5983f4[_0xd180('0xf4')]);try{fs['unlink'](_0x5983f4[_0xd180('0xf4')]+_0xd180('0xf7'));}catch(_0x192792){logger[_0xd180('0x4e')](_0x192792);}return _0x44eff0;}else{return this['channel']['noop'](util['format'](_0xd180('0xf8'),_0x5983f4[_0xd180('0xe2')]));}}return this['channel']['error'](_0x345c6b,_0xd180('0xf9'));};AGIVertices['prototype'][_0xd180('0xfa')]=function(_0x16d492){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xfb'),_0x16d492[_0xd180('0x35')]));return this[_0xd180('0xf')][_0xd180('0xa6')]('end');};AGIVertices[_0xd180('0x12')][_0xd180('0xfc')]=function(_0x4fe5eb){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xfd'),_0x4fe5eb[_0xd180('0x35')]));var _0x58c82d='';if(_0x4fe5eb[_0xd180('0xfe')]){if(!this[_0xd180('0xa7')](_0x4fe5eb[_0xd180('0xfe')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x4fe5eb,_0xd180('0xff'));}else{var _0xcb941e=parseInt(_0x4fe5eb[_0xd180('0xfe')],0xa);if(isNaN(_0xcb941e)){_0x58c82d=_0x4fe5eb[_0xd180('0xfe')];}else{_0x58c82d=this['getTrunk'][_0xd180('0x6e')](this,_0x4fe5eb[_0xd180('0xfe')]);if(!_0x58c82d){return this['channel'][_0xd180('0x4e')](_0x4fe5eb,_0xd180('0x100'));}}}}else if(_0x4fe5eb[_0xd180('0x101')]){_0x58c82d=_0x4fe5eb[_0xd180('0x101')];}else{return this[_0xd180('0xf')]['error'](_0x4fe5eb,_0xd180('0xff'));}var _0x541eb0=this[_0xd180('0xf')][_0xd180('0xaf')](_0xd180('0xda'),[util[_0xd180('0x2a')](_0xd180('0x102'),_0x58c82d,_0x4fe5eb[_0xd180('0x46')]),_0x4fe5eb[_0xd180('0x63')],_0x4fe5eb[_0xd180('0x103')],_0x4fe5eb[_0xd180('0x61')]]);if(_0x541eb0[_0xd180('0xa9')]===-0x1){return _0x541eb0;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('Executed\x20command\x20%s',_0xd180('0xda')));};AGIVertices[_0xd180('0x12')][_0xd180('0x104')]=function(_0x3b68ce){logger[_0xd180('0x2e')](util['format'](_0xd180('0x105'),_0x3b68ce[_0xd180('0x35')]));return this['channel'][_0xd180('0xa6')](_0xd180('0x104'));};AGIVertices[_0xd180('0x12')][_0xd180('0xd')]=function(_0xd5b788){logger[_0xd180('0x2e')](util['format'](_0xd180('0x106'),_0xd5b788['label']));if(_0xd5b788['retry']===0x0){return this[_0xd180('0xa3')](_0xd5b788);}_0xd5b788[_0xd180('0xa4')]-=0x1;if(!this[_0xd180('0xa7')](_0xd5b788['file_id'])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0xd5b788,_0xd180('0x107'));}var _0x1f4c2d=this[_0xd180('0x108')][_0xd180('0x6e')](this,_0xd5b788[_0xd180('0x109')]);if(!_0x1f4c2d){return this['channel']['error'](_0xd5b788,_0xd180('0x10a'));}if(!this[_0xd180('0xa7')](_0xd5b788['variable_id'])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0xd180('0x10b'));}var _0x3212ff=this['channel'][_0xd180('0x10c')](_0x1f4c2d,_0xd5b788[_0xd180('0x10d')],_0xd5b788['maxdigit']);var _0x1e4324=_0x3212ff['result']?_0x3212ff[_0xd180('0xa9')][_0xd180('0xa0')]():'';logger[_0xd180('0x2e')](_0xd180('0x10e'),JSON[_0xd180('0x71')](_0x3212ff));if(_0x3212ff[_0xd180('0xa9')]===-0x1){this[_0xd180('0x33')][_0xd180('0x6e')](this,_0xd5b788,_0x1e4324);return _0x3212ff;}else if(_0x3212ff['extra']===_0xd180('0x63')){_0x3212ff[_0xd180('0xa9')]=_0x1e4324[_0xd180('0x9a')]>=parseInt(_0xd5b788[_0xd180('0x10f')])?'x':'i';}else{_0x3212ff[_0xd180('0xa9')]=_0x1e4324[_0xd180('0x9a')]>=parseInt(_0xd5b788[_0xd180('0x10f')])&&_0x1e4324[_0xd180('0x9a')]<=parseInt(_0xd5b788[_0xd180('0x110')])?'x':'i';}var _0x1d887a=this[_0xd180('0x13')][_0xd180('0x6e')](this,_0xd5b788[_0xd180('0xd3')]);if(!_0x1d887a){return this[_0xd180('0xf')]['error'](_0xd5b788,'no\x20variable\x20found');}this[_0xd180('0xf')][_0xd180('0x9d')](_0x1d887a,_0x1e4324);if(this[_0xd180('0xa7')](_0xd5b788[_0xd180('0x111')])){var _0x23847a=parseInt(_0xd5b788['hiddendigitsnum'],0xa);var _0x3d8bef=rs['generate']({'charset':'*','length':_0x23847a});var _0x14f3ed=_0x1e4324[_0xd180('0x9a')];if(_0x14f3ed>0x0){if(_0x14f3ed>_0x23847a){this[_0xd180('0x33')][_0xd180('0x6e')](this,_0xd5b788,_0xd5b788['hiddendigitspos']==='first'?_0x3d8bef+_0x1e4324[_0xd180('0x112')](_0x23847a):_0x1e4324[_0xd180('0x112')](0x0,_0x14f3ed-_0x23847a)+_0x3d8bef);}else{this['createSquareDetailsReport'][_0xd180('0x6e')](this,_0xd5b788,rs[_0xd180('0x113')]({'charset':'*','length':_0x14f3ed}));}}else{this[_0xd180('0x33')]['sync'](this,_0xd5b788,'');}}else{this[_0xd180('0x33')][_0xd180('0x6e')](this,_0xd5b788,_0x1e4324);}return _0x3212ff;};AGIVertices[_0xd180('0x12')]['getsecretdigits']=function(_0x473a6b){logger['info'](util[_0xd180('0x2a')](_0xd180('0x114'),_0x473a6b[_0xd180('0x35')]));return this[_0xd180('0xd')](_0x473a6b);};AGIVertices[_0xd180('0x12')][_0xd180('0x115')]=function(_0x348ea0){logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x348ea0['label']));this['createSquareDetailsReport'][_0xd180('0x6e')](this,_0x348ea0,_0x348ea0[_0xd180('0x116')]);return this[_0xd180('0xf')][_0xd180('0xa6')](util['format'](_0xd180('0x117'),_0x348ea0[_0xd180('0x116')]));};AGIVertices['prototype'][_0xd180('0x118')]=function(_0x17f5b0){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x119'),_0x17f5b0[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x17f5b0[_0xd180('0x85')])||!this[_0xd180('0xa7')](_0x17f5b0[_0xd180('0x86')])){return this['channel'][_0xd180('0xa6')](_0xd180('0x11a'));}if(!this[_0xd180('0xa7')](_0x17f5b0['text'])){return this['channel'][_0xd180('0xa6')](_0xd180('0xc6'));}this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x11b'),_0x17f5b0[_0xd180('0x5a')]));var _0x400b73=this[_0xd180('0x11c')]['sync'](this,_0x17f5b0);if(_0x400b73){this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x11d'),_0x400b73));var _0x31aa19=this[_0xd180('0xf')]['streamFile'](_0x400b73);try{fs[_0xd180('0x11e')](_0x400b73+_0xd180('0xf7'));}catch(_0x4955c6){logger[_0xd180('0x4e')](_0x4955c6);}return _0x31aa19;}return this['channel'][_0xd180('0x4e')](_0x17f5b0,_0xd180('0x11f'));};AGIVertices[_0xd180('0x12')][_0xd180('0x120')]=function(_0x4c32f9){logger['info'](util[_0xd180('0x2a')](_0xd180('0x121'),_0x4c32f9['label']));if(!this[_0xd180('0xa7')](_0x4c32f9[_0xd180('0x85')])||!this['isConfigured'](_0x4c32f9['aws_secret_access_key'])){return this['channel']['noop'](_0xd180('0x11a'));}if(!this[_0xd180('0xa7')](_0x4c32f9[_0xd180('0x8c')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x122'));}if(!this[_0xd180('0xa7')](_0x4c32f9['text'])){return this['channel'][_0xd180('0xa6')](_0xd180('0xc6'));}this[_0xd180('0xf')][_0xd180('0xde')]=!![];this[_0xd180('0x33')](_0x4c32f9);this['createSquareMessage'](_0x4c32f9[_0xd180('0x5a')],'in','','');this[_0xd180('0xf')][_0xd180('0xa6')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x4c32f9[_0xd180('0x5a')]));var _0x4395af=this[_0xd180('0x8a')][_0xd180('0x6e')](this,_0x4c32f9);if(_0x4395af){for(var _0x3ffadb in _0x4395af){if(_0x4395af[_0xd180('0x93')](_0x3ffadb)&&_[_0xd180('0x94')](_0x4395af[_0x3ffadb])){this['channel']['setVariable'](util[_0xd180('0x2a')]('AWS_LEX_%s',_0x3ffadb[_0xd180('0xe1')]()),_0x4395af[_0x3ffadb]);}}if(_[_0xd180('0x42')](_0x4395af[_0xd180('0x74')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x123'));}else{this[_0xd180('0x40')](_0x4395af[_0xd180('0x74')],_0xd180('0xe3'),_0xd180('0x124'),'');return this[_0xd180('0xf')]['noop'](util['format'](_0xd180('0x125'),_0x4395af['message']));}}return this[_0xd180('0xf')][_0xd180('0x4e')](_0x4c32f9,_0xd180('0x126'));};AGIVertices['prototype'][_0xd180('0x127')]=function(_0x25f0fc){logger['info'](util[_0xd180('0x2a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x25f0fc[_0xd180('0x35')],_0x25f0fc[_0xd180('0x63')]));if(!this[_0xd180('0xa7')](_0x25f0fc['key'])){return this['channel'][_0xd180('0xa6')](_0xd180('0xdd'));}var _0x8411d5=_0xd180('0x128');var _0x571d89=util['format'](_0xd180('0x129'),FILES_PATH,rs[_0xd180('0x113')](0x4));var _0xe62729=util['format']('%s.%s',_0x571d89,_0x8411d5);var _0x599765=!![];if(_0x25f0fc[_0xd180('0x12a')]==='NOBEEP'){_0x599765=![];}var _0xb0a06a=this[_0xd180('0xf')]['recordFile'](_0x571d89,_0x8411d5,_0x25f0fc[_0xd180('0x12b')],_0x25f0fc['timeout'],undefined,_0x599765);if(_0xb0a06a[_0xd180('0xa9')]!==-0x1){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x12c'),_0xe62729));var _0x130c49=this[_0xd180('0x8d')]['sync'](this,_0x25f0fc,_0xe62729);if(_0x130c49){for(var _0x4d60c6 in _0x130c49){if(_0x130c49[_0xd180('0x93')](_0x4d60c6)){this[_0xd180('0xf')]['setVariable'](util[_0xd180('0x2a')](_0xd180('0x12d'),_0x4d60c6[_0xd180('0xe1')]()),_0x130c49[_0x4d60c6]);}}return this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x12e'),JSON[_0xd180('0x71')](_0x130c49)));}}return _0xb0a06a;};AGIVertices['prototype'][_0xd180('0x12f')]=function(_0x4e5f79){logger['info'](util['format'](_0xd180('0x130'),_0x4e5f79['label']));if(!this[_0xd180('0xa7')](_0x4e5f79[_0xd180('0x90')])){return this['channel'][_0xd180('0xa6')](_0xd180('0x131'));}if(!this[_0xd180('0xa7')](_0x4e5f79[_0xd180('0x132')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x133'));}var _0x1fa624=_0xd180('0x128');var _0xf5f18e=util[_0xd180('0x2a')](_0xd180('0x129'),FILES_PATH,rs[_0xd180('0x113')](0x4));var _0x447e8d=util[_0xd180('0x2a')](_0xd180('0x9c'),_0xf5f18e,_0x1fa624);var _0x318d76=!![];if(_0x4e5f79['beep']===_0xd180('0x134')){_0x318d76=![];}var _0x25b0c7=this['channel'][_0xd180('0x135')](_0xf5f18e,_0x1fa624,_0x4e5f79[_0xd180('0x12b')],_0x4e5f79['timeout'],undefined,_0x318d76);if(_0x25b0c7[_0xd180('0xa9')]!==-0x1){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('tilde\x20%s\x20file\x20created',_0x447e8d));var _0x344f75=this[_0xd180('0x8f')][_0xd180('0x6e')](this,_0x4e5f79,_0x447e8d);if(_0x344f75){for(var _0x31f204 in _0x344f75){if(_0x344f75[_0xd180('0x93')](_0x31f204)){this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0x136'),_0x31f204['toUpperCase']()),_0x344f75[_0x31f204]);}}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x137'),JSON['stringify'](_0x344f75)));}}return _0x25b0c7;};AGIVertices[_0xd180('0x12')][_0xd180('0x138')]=function(_0x3f7c78){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x139'),_0x3f7c78[_0xd180('0x35')]));return this[_0xd180('0xf')][_0xd180('0x13a')](_0x3f7c78[_0xd180('0x3b')],_0x3f7c78[_0xd180('0x3c')],_0x3f7c78[_0xd180('0x13b')]);};AGIVertices[_0xd180('0x12')]['gotoif']=function(_0x495a97){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x13c'),_0x495a97['label']));if(!this['isConfigured'](_0x495a97[_0xd180('0x13d')])){return this['channel'][_0xd180('0x4e')](_0x495a97,_0xd180('0x13e'));}try{var _0x5bce1f=eval(_0x495a97[_0xd180('0x13d')])?_0xd180('0x13f'):_0xd180('0x140');this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x495a97[_0xd180('0x13d')],_0x5bce1f));return{'code':0xc8,'result':_0x5bce1f};}catch(_0x205e9f){return{'code':0xc8,'result':_0xd180('0x140')};}};AGIVertices[_0xd180('0x12')][_0xd180('0x141')]=function(_0x53a6f5){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x142'),_0x53a6f5[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x53a6f5[_0xd180('0x143')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x53a6f5,'no\x20interval\x20configured');}var _0x301c66=this['getIntervals'][_0xd180('0x6e')](this,_0x53a6f5['interval_id']);if(!_0x301c66){return this['channel'][_0xd180('0x4e')](_0x53a6f5,_0xd180('0x144'));}for(var _0x2ee832=0x0;_0x2ee832<_0x301c66['length'];_0x2ee832+=0x1){var _0x4c83f1=this['channel']['getVariable'](util[_0xd180('0x2a')](_0xd180('0x145'),_0x301c66[_0x2ee832]));if(_0x4c83f1[_0xd180('0xa9')]===-0x1){return _0x4c83f1;}logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('IFTIME\x20%s\x20%s',_0x301c66[_0x2ee832],_0x4c83f1['extra']));if(_0x4c83f1[_0xd180('0xa2')]===_0xd180('0x13f')){logger['info'](util[_0xd180('0x2a')](_0xd180('0x146'),_0x301c66[_0x2ee832],_0xd180('0x13f')));this['channel']['noop'](util[_0xd180('0x2a')]('IFTIME\x20%s\x20%s',_0x301c66[_0x2ee832],_0xd180('0x13f')));return{'code':0xc8,'result':_0xd180('0x13f')};}else{logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x146'),_0x301c66[_0x2ee832],_0xd180('0x140')));this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')]('IFTIME\x20%s\x20%s',_0x301c66[_0x2ee832],_0xd180('0x140')));}}return{'code':0xc8,'result':_0xd180('0x140')};};AGIVertices['prototype'][_0xd180('0x147')]=function(_0x56f68f){logger['info'](util[_0xd180('0x2a')](_0xd180('0x148'),_0x56f68f['label']));return this[_0xd180('0xf')][_0xd180('0x147')]();};AGIVertices['prototype'][_0xd180('0x149')]=function(_0x9bdb93){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x14a'),_0x9bdb93['label']));if(!this[_0xd180('0xa7')](_0x9bdb93[_0xd180('0x82')])){return this['channel'][_0xd180('0xa6')](_0xd180('0xdd'));}var _0x177e18=_0xd180('0x128');var _0x532a4b=util[_0xd180('0x2a')](_0xd180('0x129'),FILES_PATH,rs[_0xd180('0x113')](0x4));var _0xb8f0db=util[_0xd180('0x2a')]('%s.%s',_0x532a4b,_0x177e18);var _0x2a8a0e=!![];if(_0x9bdb93[_0xd180('0x12a')]===_0xd180('0x134')){_0x2a8a0e=![];}var _0x54e8b1=this['channel'][_0xd180('0x135')](_0x532a4b,_0x177e18,_0x9bdb93[_0xd180('0x12b')],_0x9bdb93[_0xd180('0x63')],undefined,_0x2a8a0e);if(_0x54e8b1[_0xd180('0xa9')]!==-0x1){this[_0xd180('0xf')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0xb8f0db));var _0x16fa13=this['ispeechASR'][_0xd180('0x6e')](this,_0x9bdb93,_0xb8f0db);if(_0x16fa13){for(var _0xd0cc03 in _0x16fa13){if(_0x16fa13[_0xd180('0x93')](_0xd0cc03)){this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0x14b'),_0xd0cc03[_0xd180('0xe1')]()),_0x16fa13[_0xd0cc03]);}}return this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')]('IspeechASR\x20Result\x20%s',JSON[_0xd180('0x71')](_0x16fa13)));}}return _0x54e8b1;};AGIVertices[_0xd180('0x12')][_0xd180('0x14c')]=function(_0x3aee70){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x14d'),_0x3aee70['label']));if(!this[_0xd180('0xa7')](_0x3aee70['key'])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xdd'));}if(!this[_0xd180('0xa7')](_0x3aee70['text'])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20text\x20configured');}this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x14e'),_0x3aee70[_0xd180('0x5a')]));var _0x71d36c=this['ispeechTTS'][_0xd180('0x6e')](this,_0x3aee70);if(_0x71d36c){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x14f'),_0x71d36c));var _0x220bfe=this[_0xd180('0xf')][_0xd180('0xf6')](_0x71d36c,_0x3aee70[_0xd180('0x12b')]);try{fs[_0xd180('0x11e')](_0x71d36c+_0xd180('0xf7'));}catch(_0x368392){logger[_0xd180('0x4e')](_0x368392);}return _0x220bfe;}return this[_0xd180('0xf')]['error'](_0x3aee70,_0xd180('0x150'));};AGIVertices[_0xd180('0x12')]['login']=function(_0x59c480){logger[_0xd180('0x2e')](util['format'](_0xd180('0x151'),_0x59c480['label']));if(!this['isConfigured'](_0x59c480['findBy'])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x59c480,_0xd180('0x152'));}logger[_0xd180('0x2e')](util['format'](_0xd180('0x153'),this['channel'][_0xd180('0x38')],_0x59c480[_0xd180('0x154')]));var _0x408860=this['agentLogin']['sync'](this,_0x59c480[_0xd180('0x154')]);if(_0x408860){logger['info'](util[_0xd180('0x2a')](_0xd180('0x155'),this[_0xd180('0xf')][_0xd180('0x38')],_0x59c480[_0xd180('0x154')]));this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x155'),this[_0xd180('0xf')]['callerid'],_0x59c480['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x156'),this[_0xd180('0xf')][_0xd180('0x38')],_0x59c480[_0xd180('0x154')]));this[_0xd180('0xf')][_0xd180('0xa6')](util['format'](_0xd180('0x156'),this[_0xd180('0xf')][_0xd180('0x38')],_0x59c480[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x157')};}};AGIVertices[_0xd180('0x12')][_0xd180('0x158')]=function(_0x20131c){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x159'),_0x20131c['label']));if(!this[_0xd180('0xa7')](_0x20131c[_0xd180('0x154')])){return this['channel'][_0xd180('0x4e')](_0x20131c,'no\x20find\x20by\x20configured');}logger['info'](util[_0xd180('0x2a')](_0xd180('0x153'),this[_0xd180('0xf')][_0xd180('0x38')],_0x20131c[_0xd180('0x154')]));var _0x37cb28=this['agentLogout'][_0xd180('0x6e')](this,_0x20131c[_0xd180('0x154')]);if(_0x37cb28){logger[_0xd180('0x2e')](util['format'](_0xd180('0x155'),this['channel'][_0xd180('0x38')],_0x20131c[_0xd180('0x154')]));this[_0xd180('0xf')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xd180('0xf')][_0xd180('0x38')],_0x20131c[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x15a')};}else{logger[_0xd180('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd180('0xf')][_0xd180('0x38')],_0x20131c[_0xd180('0x154')]));this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x156'),this[_0xd180('0xf')][_0xd180('0x38')],_0x20131c['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd180('0x12')][_0xd180('0x15b')]=function(_0x306fac){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x15c'),_0x306fac['label']));if(!this[_0xd180('0xa7')](_0x306fac[_0xd180('0x15d')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x306fac,_0xd180('0x15e'));}this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x15f'),_0x306fac['operation']));var _0x3b2e7f=eval(_0x306fac[_0xd180('0x15d')]);if(!this[_0xd180('0xa7')](_0x306fac[_0xd180('0xd3')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x10b'));}var _0xaed2ee=this[_0xd180('0x13')][_0xd180('0x6e')](this,_0x306fac[_0xd180('0xd3')]);if(!_0xaed2ee){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x306fac,_0xd180('0x160'));}if(_[_0xd180('0x99')](_0x3b2e7f)){var _0x5941ca=this;_0x3b2e7f['forEach'](function(_0x3f26b4,_0x55b1ad){_0x5941ca['channel'][_0xd180('0x9d')](util['format'](_0xd180('0x161'),_0xaed2ee,_0x55b1ad),_0x3f26b4);});return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x162'),_0xaed2ee));}else{return this[_0xd180('0xf')][_0xd180('0x9d')](_0xaed2ee,_0x3b2e7f);}};AGIVertices[_0xd180('0x12')]['menu']=function(_0x472a60){logger['info'](util[_0xd180('0x2a')](_0xd180('0x163'),_0x472a60[_0xd180('0x35')]));if(_0x472a60['retry']===0x0){return this['maxRetry'](_0x472a60);}_0x472a60[_0xd180('0xa4')]-=0x1;if(!this[_0xd180('0xa7')](_0x472a60[_0xd180('0x109')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x472a60,_0xd180('0x107'));}var _0x1a2df4=this['getSound']['sync'](this,_0x472a60[_0xd180('0x109')]);if(!_0x1a2df4){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x472a60,_0xd180('0x10a'));}var _0x481543=this[_0xd180('0xf')]['getData'](_0x1a2df4,_0x472a60[_0xd180('0x10d')],_0x472a60[_0xd180('0x164')]);var _0x5724bf=_0x481543['result'];if(_0x481543[_0xd180('0xa9')]===-0x1){this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x472a60,'-1');return _0x481543;}else if(_0x481543['extra']===_0xd180('0x63')){_0x481543[_0xd180('0xa9')]=_0x481543['result']['length']>0x0?_0x481543[_0xd180('0xa9')]:'t';}else if(_[_0xd180('0x41')](_0x481543[_0xd180('0xa9')])){_0x481543['result']='#';_0x5724bf='#';}if(!this[_0xd180('0xa7')](_0x472a60['variable_id'])){this['channel'][_0xd180('0xa6')](_0xd180('0x10b'));}else{var _0xe6bb0e=this['getVariable']['sync'](this,_0x472a60[_0xd180('0xd3')]);if(!_0xe6bb0e){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x472a60,_0xd180('0x160'));}this[_0xd180('0xf')][_0xd180('0x9d')](_0xe6bb0e,_0x5724bf);}this[_0xd180('0x33')]['sync'](this,_0x472a60,_0x5724bf);return _0x481543;};AGIVertices[_0xd180('0x12')][_0xd180('0xa6')]=function(_0x1625be){logger['info'](util[_0xd180('0x2a')](_0xd180('0x165'),_0x1625be[_0xd180('0x35')]));return this['channel'][_0xd180('0xa6')](_0x1625be[_0xd180('0x166')]||_0x1625be[_0xd180('0x35')]);};AGIVertices[_0xd180('0x12')][_0xd180('0x167')]=function(_0xa44a57){logger[_0xd180('0x2e')](util['format'](_0xd180('0x168'),_0xa44a57['label']));if(!this[_0xd180('0xa7')](_0xa44a57[_0xd180('0x154')])){return this[_0xd180('0xf')]['error'](_0xa44a57,_0xd180('0x152'));}logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd180('0xf')][_0xd180('0x38')],_0xa44a57['findBy']));var _0x5d5418=this[_0xd180('0x169')][_0xd180('0x6e')](this,_0xa44a57[_0xd180('0x16a')]);var _0x254bcf=this[_0xd180('0x4c')]['sync'](this,_0xa44a57['findBy'],_0x5d5418);if(_0x254bcf){logger['info'](util[_0xd180('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd180('0xf')]['callerid'],_0xa44a57[_0xd180('0x154')]));this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0xa44a57[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x15a')};}else{logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x156'),this[_0xd180('0xf')][_0xd180('0x38')],_0xa44a57['findBy']));this[_0xd180('0xf')]['noop'](util[_0xd180('0x2a')](_0xd180('0x155'),this[_0xd180('0xf')][_0xd180('0x38')],_0xa44a57[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x157')};}};AGIVertices[_0xd180('0x12')][_0xd180('0x16b')]=function(_0x809229){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x16c'),_0x809229[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x809229[_0xd180('0x109')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x809229,_0xd180('0x107'));}var _0x315b94=this[_0xd180('0x108')][_0xd180('0x6e')](this,_0x809229['file_id']);if(!_0x315b94){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x809229,_0xd180('0x10a'));}var _0x55887f=this['channel']['exec'](_0xd180('0x16d'),[_0x315b94,_0x809229[_0xd180('0x103')]]);if(_0x55887f['result']===-0x1){return _0x55887f;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x16e'),_0xd180('0x16d'),_0x315b94));};AGIVertices[_0xd180('0x12')]['queue']=function(_0x40c8ed){logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x40c8ed[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x40c8ed[_0xd180('0x16f')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x40c8ed,_0xd180('0x170'));}var _0x5ea932='';var _0x1c0923=parseInt(_0x40c8ed[_0xd180('0x16f')],0xa);if(isNaN(_0x1c0923)){_0x5ea932=_0x40c8ed[_0xd180('0x16f')];}else{_0x5ea932=this[_0xd180('0x18')][_0xd180('0x6e')](this,_0x40c8ed[_0xd180('0x16f')]);if(!_0x5ea932){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x40c8ed,_0xd180('0x171'));}}var _0x51645e='';if(this[_0xd180('0xa7')](_0x40c8ed['file_id'])){var _0x139737=this[_0xd180('0x108')][_0xd180('0x6e')](this,_0x40c8ed[_0xd180('0x109')]);if(_0x139737){_0x51645e=_0x139737;}}this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x40c8ed,_0x5ea932);if(_0x40c8ed['opts'][_0xd180('0x172')]('x')<0x0){_0x40c8ed['opts']+='x';}if(_0x40c8ed[_0xd180('0x103')][_0xd180('0x172')]('X')<0x0){_0x40c8ed['opts']+='X';}this[_0xd180('0xf')][_0xd180('0x9d')](_0xd180('0x173'),_0x5ea932?_0x5ea932[_0xd180('0x174')]():'');var _0x4eb833=this[_0xd180('0xf')][_0xd180('0xaf')](_0xd180('0x175'),[_0x5ea932,_0x40c8ed[_0xd180('0x103')],_0x40c8ed[_0xd180('0x61')],_0x51645e,_0x40c8ed[_0xd180('0x63')],_0x40c8ed['agi'],_0x40c8ed['macro'],_0x40c8ed[_0xd180('0x176')],'',_0x40c8ed[_0xd180('0x177')]]);if(_0x4eb833[_0xd180('0xa9')]===-0x1){return _0x4eb833;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('Executed\x20command\x20%s\x20%s',_0xd180('0x175'),_0x5ea932));};AGIVertices['prototype']['record']=function(_0x35d84a){logger['info'](util[_0xd180('0x2a')](_0xd180('0x178'),_0x35d84a['label']));var _0x90b9aa=_0x35d84a[_0xd180('0x179')]||'wav';var _0x40a677=util['format'](_0xd180('0x17a'),this[_0xd180('0xf')]['uniqueid'],rs[_0xd180('0x113')](0x5));var _0x540534=util[_0xd180('0x2a')](_0xd180('0x17b'),FILES_PATH,_0x40a677,_0x90b9aa);var _0x17519d=util[_0xd180('0x2a')](_0xd180('0x129'),FILES_PATH,_0x40a677);this[_0xd180('0x39')][_0xd180('0x6e')](this,_0x35d84a,_0x40a677,_0x540534);this[_0xd180('0xf')][_0xd180('0x9d')](_0xd180('0x17c'),_0x40a677);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x17519d,_0x90b9aa,_0x35d84a[_0xd180('0x17d')],_0x35d84a[_0xd180('0x63')]);return this[_0xd180('0xf')]['recordFile'](_0x17519d,_0x90b9aa,_0x35d84a[_0xd180('0x17d')],_0x35d84a[_0xd180('0x63')],undefined,!![]);};AGIVertices[_0xd180('0x12')][_0xd180('0x17e')]=function(_0x4a338b){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x17f'),_0x4a338b[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x4a338b[_0xd180('0x61')])){return this['channel'][_0xd180('0xa6')](_0xd180('0x180'));}var _0x5a3706=this[_0xd180('0x60')][_0xd180('0x6e')](this,_0x4a338b);logger['info'](util['format'](_0xd180('0x181'),util['inspect'](_0x5a3706,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4a338b[_0xd180('0xd3')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x182'));}var _0x42ba81=this[_0xd180('0x13')]['sync'](this,_0x4a338b[_0xd180('0xd3')]);if(!_0x42ba81){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x4a338b,_0xd180('0x160'));}this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0x183'),_0x42ba81),_0x5a3706[_0xd180('0x72')]?_0x5a3706[_0xd180('0x72')]:_0xd180('0x184'));this[_0xd180('0xf')]['setVariable'](util['format'](_0xd180('0x185'),_0x42ba81),_0x5a3706[_0xd180('0x73')]?_0x5a3706[_0xd180('0x73')]:'OK');if(_0x5a3706[_0xd180('0x67')]){try{this['saveRestApiResult'](_0x5a3706[_0xd180('0x67')],_0x42ba81);}catch(_0x37348f){logger['error'](util[_0xd180('0x2a')](_0xd180('0x186'),_0x42ba81));}}return this[_0xd180('0xf')]['noop'](util[_0xd180('0x2a')](_0xd180('0xd6'),_0x42ba81));};AGIVertices['prototype']['saydigits']=function(_0x23fd08){logger['info'](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x23fd08[_0xd180('0x35')]));return this[_0xd180('0xf')][_0xd180('0x187')](_0x23fd08[_0xd180('0x188')]['replace'](/\s+/g,''),_0x23fd08[_0xd180('0x17d')]);};AGIVertices[_0xd180('0x12')]['saynumber']=function(_0x59b4da){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x189'),_0x59b4da[_0xd180('0x35')]));return this[_0xd180('0xf')][_0xd180('0x18a')](_0x59b4da[_0xd180('0x64')][_0xd180('0x56')](/\s+/g,''),_0x59b4da[_0xd180('0x17d')]);};AGIVertices[_0xd180('0x12')][_0xd180('0x18b')]=function(_0xda8ea5){logger['info'](util[_0xd180('0x2a')](_0xd180('0x18c'),_0xda8ea5['label']));return this[_0xd180('0xf')][_0xd180('0x18d')](_0xda8ea5[_0xd180('0x5a')],_0xda8ea5[_0xd180('0x17d')]);};AGIVertices[_0xd180('0x12')]['sendMail']=function(_0x2028eb){logger['info'](util[_0xd180('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2028eb['label']));if(!this['isConfigured'](_0x2028eb[_0xd180('0x18e')])){return this[_0xd180('0xf')]['noop'](_0xd180('0x18f'));}var _0x3a24e1=this[_0xd180('0x22')]['sync'](this,_0x2028eb[_0xd180('0x18e')]);if(!_0x3a24e1||!_0x3a24e1[_0xd180('0x190')]){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x2028eb,_0xd180('0x191'));}var _0x2f5960={'from':util[_0xd180('0x2a')]('\x22%s\x22\x20<%s>',_0x3a24e1[_0xd180('0x16')],_0x3a24e1['email']||_0x3a24e1['Smtp'][_0xd180('0x192')]),'to':_0x2028eb['to']||'','cc':_0x2028eb['cc']||'','bcc':_0x2028eb[_0xd180('0x193')]||'','subject':_0x2028eb['subject'],'html':_0x2028eb[_0xd180('0x5a')],'text':_0x2028eb[_0xd180('0x5a')]};if(this['isConfigured'](_0x2028eb['template_id'])){}logger[_0xd180('0x194')]('sendMail\x20message',JSON[_0xd180('0x71')](_0x2f5960));this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x2028eb,_0x2028eb[_0xd180('0x18e')]);this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x195'),_0x3a24e1[_0xd180('0x16')]));this[_0xd180('0x24')][_0xd180('0x6e')](this,_0x3a24e1[_0xd180('0x196')],_0x2f5960);return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x197'));};AGIVertices['prototype'][_0xd180('0x198')]=function(_0x196f1b){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x199'),_0x196f1b[_0xd180('0x35')]));return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x19a'));};AGIVertices[_0xd180('0x12')][_0xd180('0x19b')]=function(_0x1adfc1){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x19c'),_0x1adfc1[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x1adfc1['sms_account_id'])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20sms\x20account\x20configured');}var _0x379f94=this[_0xd180('0x30')][_0xd180('0x6e')](this,_0x1adfc1[_0xd180('0x19d')]);if(!_0x379f94){return this[_0xd180('0xf')]['error'](_0x1adfc1,'no\x20sms\x20account\x20found');}var _0x2a2c2d={'body':_0x1adfc1['sms_text'],'phone':_0x1adfc1['to']||'','SmsAccountId':_0x379f94['id']};logger[_0xd180('0x194')](_0xd180('0x19e'),JSON[_0xd180('0x71')](_0x2a2c2d));this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x1adfc1,_0x1adfc1[_0xd180('0x19d')]);this[_0xd180('0xf')]['noop'](util['format'](_0xd180('0x19f'),_0x379f94[_0xd180('0x16')]));this['createSmsMessage']['sync'](this,_0x2a2c2d);return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x1a0'));};AGIVertices[_0xd180('0x12')][_0xd180('0x1a1')]=function(_0x2408d8){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x1a2'),_0x2408d8[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x2408d8['variable_id'])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x2408d8,_0xd180('0x1a3'));}var _0x293864=this[_0xd180('0x13')][_0xd180('0x6e')](this,_0x2408d8['variable_id']);if(!_0x293864){return this['channel'][_0xd180('0x4e')](_0x2408d8,_0xd180('0x160'));}return this['channel'][_0xd180('0x9d')](_0x293864,_0x2408d8[_0xd180('0x1a4')]);};AGIVertices[_0xd180('0x12')][_0xd180('0x1a5')]=function(_0x29b6c0){logger['info'](util[_0xd180('0x2a')](_0xd180('0x1a6'),_0x29b6c0[_0xd180('0x35')]));this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x1a7'));if(_0x29b6c0['answer']===_0xd180('0x1a8')){this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x1a9'));return this[_0xd180('0xf')][_0xd180('0xb8')]();}return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x1aa'));};AGIVertices[_0xd180('0x12')][_0xd180('0x1ab')]=function(_0x1c143f){logger['info'](util[_0xd180('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x1c143f['label']));if(!this[_0xd180('0xa7')](_0x1c143f[_0xd180('0x1ac')])){return this[_0xd180('0xf')]['error'](_0x1c143f,'no\x20subproject\x20selected');}var _0x206b6b=this[_0xd180('0x1a')][_0xd180('0x6e')](this,_0x1c143f['project_id']);if(!this['isConfigured'](_0x206b6b)){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x1c143f,util[_0xd180('0x2a')](_0xd180('0x1ad'),_0x1c143f[_0xd180('0x1ac')]));}if(_0x206b6b===this['channel']['arg_1']){return this['channel']['error'](_0x1c143f,_0xd180('0x1ae'));}this['createSquareDetailsReport'][_0xd180('0x6e')](this,_0x1c143f,_0x206b6b);var _0x258640=this[_0xd180('0xf')][_0xd180('0xaf')](_0xd180('0x1af'),util[_0xd180('0x2a')](_0xd180('0x1b0'),config[_0xd180('0x7')]['host']||_0xd180('0x1b1'),_0x206b6b,this[_0xd180('0xf')][_0xd180('0x37')]));if(_0x258640[_0xd180('0xa9')]===-0x1){return _0x258640;}return this[_0xd180('0xf')][_0xd180('0xa6')](util['format']('Executed\x20command\x20%s\x20%s',_0xd180('0x1af'),_0x206b6b));};AGIVertices[_0xd180('0x12')][_0xd180('0x1b2')]=function(_0x2b2829){logger['info'](util['format'](_0xd180('0x1b3'),_0x2b2829[_0xd180('0x35')]));var _0x5046c6=this[_0xd180('0x54')]['sync'](this,_0x2b2829['command']);this['createSquareDetailsReport']['sync'](this,_0x2b2829,_0x2b2829['command']);if(this[_0xd180('0xa7')](_0x2b2829[_0xd180('0xd3')])){var _0x50cf01=this[_0xd180('0x13')][_0xd180('0x6e')](this,_0x2b2829['variable_id']);if(_0x50cf01){this['channel']['setVariable'](_0x50cf01,_0x5046c6);return this['channel'][_0xd180('0xa6')](util['format'](_0xd180('0x1b4'),_0x2b2829['command'],_0x50cf01));}}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2b2829[_0xd180('0xb7')]));};AGIVertices[_0xd180('0x12')]['google_cloud_tts']=function(_0x57393a){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x1b5'),_0x57393a['label']));_0x57393a[_0xd180('0x5a')]=_0x57393a[_0xd180('0x5a')][_0xd180('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd180('0xa7')](_0x57393a[_0xd180('0x58')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x1b6'));}if(!this[_0xd180('0xa7')](_0x57393a[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xc6'));}this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x1b7'),_0x57393a[_0xd180('0x5a')]));var _0x305044=this[_0xd180('0x57')]['sync'](this,_0x57393a);if(_0x305044){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x305044));var _0x4a1805=this[_0xd180('0xf')]['streamFile'](_0x305044);try{fs[_0xd180('0x11e')](_0x305044+_0xd180('0xf7'));}catch(_0x273181){logger['error'](_0x273181);}return _0x4a1805;}return this[_0xd180('0xf')][_0xd180('0x4e')](_0x57393a,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd180('0x12')][_0xd180('0x1b8')]=function(_0x24aa7c){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x1b9'),_0x24aa7c[_0xd180('0x35')]));_0x24aa7c[_0xd180('0x5a')]=_0x24aa7c[_0xd180('0x5a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd180('0xa7')](_0x24aa7c[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20text\x20configured');}this[_0xd180('0xf')][_0xd180('0xa6')](util['format'](_0xd180('0x1ba'),_0x24aa7c[_0xd180('0x5a')]));var _0x51df09=this[_0xd180('0x5f')][_0xd180('0x6e')](this,_0x24aa7c);if(_0x51df09){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x1bb'),_0x51df09));var _0x16de35=this['channel']['streamFile'](_0x51df09);try{fs[_0xd180('0x11e')](_0x51df09+_0xd180('0xf7'));}catch(_0x1d47f7){logger['error'](_0x1d47f7);}return _0x16de35;}return this[_0xd180('0xf')][_0xd180('0x4e')](_0x24aa7c,_0xd180('0x1bc'));};AGIVertices[_0xd180('0x12')][_0xd180('0x1bd')]=function(_0x4dd8b0){logger['info'](util[_0xd180('0x2a')](_0xd180('0x1be'),_0x4dd8b0['label']));if(!this[_0xd180('0xa7')](_0x4dd8b0[_0xd180('0x154')])){return this['channel'][_0xd180('0x4e')](_0x4dd8b0,'no\x20find\x20by\x20configured');}logger[_0xd180('0x2e')](util['format'](_0xd180('0x153'),this['channel'][_0xd180('0x38')],_0x4dd8b0[_0xd180('0x154')]));var _0x443ede=this['agentUnpause'][_0xd180('0x6e')](this,_0x4dd8b0[_0xd180('0x154')]);if(_0x443ede){logger['info'](util['format'](_0xd180('0x155'),this['channel'][_0xd180('0x38')],_0x4dd8b0['findBy']));this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x155'),this[_0xd180('0xf')][_0xd180('0x38')],_0x4dd8b0[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x15a')};}else{logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x156'),this['channel'][_0xd180('0x38')],_0x4dd8b0[_0xd180('0x154')]));this['channel']['noop'](util['format'](_0xd180('0x156'),this[_0xd180('0xf')]['callerid'],_0x4dd8b0[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x157')};}};AGIVertices[_0xd180('0x12')][_0xd180('0x1bf')]=function(_0x14f9cb){logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x14f9cb[_0xd180('0x35')]));var _0x185219=this[_0xd180('0xf')][_0xd180('0xaf')]('VOICEMAIL',[_0x14f9cb[_0xd180('0x1c0')],_0x14f9cb['options']]);if(_0x185219[_0xd180('0xa9')]===-0x1){return _0x185219;}return this['channel']['noop'](util[_0xd180('0x2a')](_0xd180('0x16e'),_0xd180('0x1c1'),_0x14f9cb['mailbox']));};AGIVertices[_0xd180('0x12')]['vswitch']=function(_0x3d5ea1){logger[_0xd180('0x2e')](util['format'](_0xd180('0x1c2'),_0x3d5ea1['label']));if(!this['isConfigured'](_0x3d5ea1['variable_id'])){return this[_0xd180('0xf')]['error'](_0x3d5ea1,_0xd180('0x1a3'));}var _0x39c060=this[_0xd180('0x13')]['sync'](this,_0x3d5ea1[_0xd180('0xd3')]);if(!_0x39c060){return this['channel'][_0xd180('0x4e')](_0x3d5ea1,_0xd180('0x160'));}var _0x233552=this['channel']['getVariable'](_0x39c060);return{'code':0xc8,'result':_0x233552[_0xd180('0xa2')]?_0x233552[_0xd180('0xa2')]:'-'};};String[_0xd180('0x12')]['replaceAll']=function(_0x3aae01,_0x36de41){return this['split'](_0x3aae01)['join'](_0x36de41);};module[_0xd180('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 32294c1..622480b 100644 --- a/server/services/ami/acw/index.js +++ b/server/services/ami/acw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0184=['syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','moment','../ami','../../../config/logger','acw','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDispositionPause','Action','QueuePause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','uniqueid','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s'];(function(_0x407cda,_0x1b4d98){var _0x5b6c92=function(_0x43db12){while(--_0x43db12){_0x407cda['push'](_0x407cda['shift']());}};_0x5b6c92(++_0x1b4d98);}(_0x0184,0xb8));var _0x4018=function(_0x30a6d6,_0x603c35){_0x30a6d6=_0x30a6d6-0x0;var _0x361ea1=_0x0184[_0x30a6d6];return _0x361ea1;};'use strict';var util=require(_0x4018('0x0'));var _=require(_0x4018('0x1'));var moment=require(_0x4018('0x2'));var ami=require(_0x4018('0x3'));var logger=require(_0x4018('0x4'))(_0x4018('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x45ffb1){this[_0x4018('0x6')]=_0x45ffb1['voiceQueues'];this[_0x4018('0x7')]=_0x45ffb1[_0x4018('0x7')];this[_0x4018('0x8')]=_0x45ffb1[_0x4018('0x8')];this[_0x4018('0x9')]={};ami['on']('agentconnect',this[_0x4018('0xa')][_0x4018('0xb')](this));ami['on']('hanguprequest',this[_0x4018('0xc')][_0x4018('0xb')](this));ami['on']('hangup',this['syncHangup'][_0x4018('0xb')](this));ami['on'](_0x4018('0xd'),this[_0x4018('0xe')][_0x4018('0xb')](this));ami['on'](_0x4018('0xf'),this['syncAttendedTransfer'][_0x4018('0xb')](this));ami['on'](_0x4018('0x10'),this[_0x4018('0x11')][_0x4018('0xb')](this));ami['on'](_0x4018('0x12'),this[_0x4018('0x13')][_0x4018('0xb')](this));}function getDiff(_0x47d505){var _0x2af71e=moment()['milliseconds'](0x0);var _0x1785d5=moment(_0x47d505)['milliseconds'](0x0);return _0x2af71e[_0x4018('0x14')](_0x1785d5,_0x4018('0x15'));}Acw[_0x4018('0x16')][_0x4018('0x17')]=function(_0x5d7cbb){try{var _0x3c4de4=this;var _0x317715=this[_0x4018('0x9')][_0x5d7cbb][_0x4018('0x18')];var _0x373759=this[_0x4018('0x9')][_0x5d7cbb]['queue'];var _0x5ce9e3=this[_0x4018('0x6')][_0x373759];var _0x130038=![];var _0x224cbc=_0x4018('0x19');if(_0x5ce9e3['mandatoryDisposition']){if(_0x5ce9e3[_0x4018('0x1a')]['name']){_0x130038=!![];_0x224cbc=_0x5ce9e3[_0x4018('0x1a')]['name'];}}ami[_0x4018('0x1b')]({'action':_0x4018('0x1c'),'interface':_0x317715,'paused':!![],'reason':_0x224cbc})[_0x4018('0x1d')](function(_0x2d8d5a){if(_0x3c4de4[_0x4018('0x7')][_0x317715]){return RpcUser[_0x4018('0x1e')](_0x3c4de4[_0x4018('0x7')][_0x317715]['id'])['then'](function(_0x48bb21){if(_0x48bb21&&!_0x48bb21['voicePause']){logger[_0x4018('0x1f')](_0x4018('0x20'),_0x5d7cbb,_0x317715,_0x373759);var _0x469158=_0x3c4de4['channels'][_0x5d7cbb][_0x4018('0x21')]&&_0x3c4de4['channels'][_0x5d7cbb][_0x4018('0x22')]?_0x3c4de4[_0x4018('0x9')][_0x5d7cbb]['destlinkedid']:_0x5d7cbb;return RpcUser[_0x4018('0x23')](_0x3c4de4['agents'][_0x317715],_0x224cbc,_0x469158)[_0x4018('0x1d')](function(_0xf211e8){if(!_0x130038){_0x3c4de4[_0x4018('0x8')][_0x317715]={};logger[_0x4018('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5d7cbb,_0x3c4de4[_0x4018('0x6')][_0x373759][_0x4018('0x24')],_0x317715,_0x373759);_0x3c4de4[_0x4018('0x8')][_0x317715][_0x4018('0x25')]=setTimeout(_0x3c4de4['stopAcw'][_0x4018('0xb')](_0x3c4de4,_0x317715),_0x3c4de4['voiceQueues'][_0x373759][_0x4018('0x24')]*0x3e8);_0x3c4de4[_0x4018('0x8')][_0x317715][_0x4018('0x26')]=moment()[_0x4018('0x27')](_0x4018('0x28'));_0x3c4de4[_0x4018('0x8')][_0x317715]['uniqueid']=_0x5d7cbb;_0x3c4de4[_0x4018('0x8')][_0x317715][_0x4018('0x29')]=_0x373759;_0x3c4de4[_0x4018('0x8')][_0x317715][_0x4018('0x2a')]=function(){var _0x3372d0=getDiff(_0x3c4de4['timers'][_0x317715][_0x4018('0x26')]);clearTimeout(_0x3c4de4[_0x4018('0x8')][_0x317715][_0x4018('0x25')]);_0x3c4de4[_0x4018('0x8')][_0x317715][_0x4018('0x25')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x3372d0},_0x3c4de4[_0x4018('0x8')][_0x317715][_0x4018('0x2b')],_0x317715)['then'](function(_0x377d39){logger[_0x4018('0x1f')](_0x4018('0x2c'),_0x5d7cbb,_0x3372d0,_0x377d39);})['catch'](function(_0x161229){logger[_0x4018('0x2d')](_0x4018('0x2e'),_0x5d7cbb,_0x161229);});delete _0x3c4de4[_0x4018('0x8')][_0x317715];};}});}else{logger[_0x4018('0x1f')](_0x4018('0x2f'),_0x5d7cbb,_0x317715,_0x373759);}});}})[_0x4018('0x30')](function(_0x3afe60){logger['error'](_0x4018('0x31'),_0x5d7cbb,_0x3c4de4[_0x4018('0x6')][_0x373759][_0x4018('0x24')],_0x317715,_0x373759);})[_0x4018('0x32')](function(){delete _0x3c4de4['channels'][_0x5d7cbb];});}catch(_0xd950b0){logger[_0x4018('0x2d')]('[ACW][START]\x20%s',_0xd950b0[_0x4018('0x33')]);}};Acw[_0x4018('0x16')][_0x4018('0x34')]=function(_0x22e455){try{var _0x5244f6=this;if(_0x5244f6[_0x4018('0x8')][_0x22e455]){_0x5244f6[_0x4018('0x8')][_0x22e455]['timer']=![];var _0x5ce85f=_0x5244f6['timers'][_0x22e455]['uniqueid'];var _0x4aab70=_0x5244f6[_0x4018('0x8')][_0x22e455][_0x4018('0x29')];var _0x5f5610=_0x5244f6[_0x4018('0x6')][_0x4aab70][_0x4018('0x24')];logger[_0x4018('0x1f')](_0x4018('0x35'),_0x5ce85f,_0x22e455);RpcUser[_0x4018('0x36')](this[_0x4018('0x7')][_0x22e455]);RpcVoiceAgentReport[_0x4018('0x37')]({'acwtime':_0x5f5610,'agentacw':!![]},_0x5ce85f,_0x22e455)[_0x4018('0x1d')](function(_0x2d03ad){logger[_0x4018('0x1f')](_0x4018('0x2c'),_0x5ce85f,_0x5f5610,_0x2d03ad);})[_0x4018('0x30')](function(_0x1a34cc){logger[_0x4018('0x2d')]('[%s][UPDATE][ERRORS:%s]',_0x5ce85f,_0x1a34cc);});}else{logger[_0x4018('0x2d')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x22e455);if(_0x5244f6[_0x4018('0x8')]){logger[_0x4018('0x1f')](_0x4018('0x38'),JSON[_0x4018('0x39')](_0x5244f6['timers']));}}}catch(_0x1ea1b9){logger['error'](_0x4018('0x3a'),_0x1ea1b9['message']);}};Acw[_0x4018('0x16')][_0x4018('0xa')]=function(_0x4ddf12){try{if(this[_0x4018('0x6')][_0x4ddf12['queue']]&&(this[_0x4018('0x6')][_0x4ddf12['queue']][_0x4018('0x5')]||this[_0x4018('0x6')][_0x4ddf12['queue']]['mandatoryDisposition'])){if(this[_0x4018('0x7')][_0x4ddf12[_0x4018('0x18')]]){this[_0x4018('0x9')][_0x4ddf12['uniqueid']]={'queue':_0x4ddf12[_0x4018('0x29')],'interface':_0x4ddf12['interface'],'destlinkedid':_0x4ddf12['destlinkedid']};}}}catch(_0xf38f89){logger[_0x4018('0x2d')](_0x4018('0x3b'),_0xf38f89[_0x4018('0x33')]);}};Acw[_0x4018('0x16')][_0x4018('0x13')]=function(_0x1ddddf){try{if(this[_0x4018('0x6')][_0x1ddddf[_0x4018('0x29')]]&&(this[_0x4018('0x6')][_0x1ddddf[_0x4018('0x29')]]['acw']||this[_0x4018('0x6')][_0x1ddddf[_0x4018('0x29')]]['mandatoryDisposition'])){if(this[_0x4018('0x7')][_0x1ddddf[_0x4018('0x18')]]){this[_0x4018('0x9')][_0x1ddddf['uniqueid']]={'queue':_0x1ddddf['queue'],'interface':_0x1ddddf[_0x4018('0x18')]};}}}catch(_0x36286e){logger['error'](_0x4018('0x3c'),_0x36286e[_0x4018('0x33')]);}};Acw[_0x4018('0x16')]['syncHangupRequest']=function(_0x2ca8dc){try{if(this[_0x4018('0x9')][_0x2ca8dc[_0x4018('0x2b')]]&&_[_0x4018('0x3d')](this[_0x4018('0x9')][_0x2ca8dc[_0x4018('0x2b')]]['attended'])){logger[_0x4018('0x1f')]('[%s][HANGUP:UNIQUEID]',_0x2ca8dc['uniqueid']);this[_0x4018('0x17')](_0x2ca8dc[_0x4018('0x2b')]);}else if(this[_0x4018('0x9')][_0x2ca8dc['linkedid']]&&_['isUndefined'](this[_0x4018('0x9')][_0x2ca8dc[_0x4018('0x3e')]][_0x4018('0x21')])){logger[_0x4018('0x1f')](_0x4018('0x3f'),_0x2ca8dc[_0x4018('0x3e')]);this[_0x4018('0x17')](_0x2ca8dc['linkedid']);}}catch(_0x9d9b97){logger[_0x4018('0x2d')](_0x4018('0x40'),_0x9d9b97[_0x4018('0x33')]);}};Acw['prototype'][_0x4018('0x41')]=function(_0x575816){try{if(this['channels'][_0x575816['uniqueid']]&&this[_0x4018('0x9')][_0x575816[_0x4018('0x2b')]]['attended']){logger[_0x4018('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x575816[_0x4018('0x2b')]);this[_0x4018('0x17')](_0x575816[_0x4018('0x2b')]);}else if(this[_0x4018('0x9')][_0x575816['linkedid']]&&this[_0x4018('0x9')][_0x575816[_0x4018('0x3e')]]['attended']){logger[_0x4018('0x1f')](_0x4018('0x42'),_0x575816[_0x4018('0x3e')]);this['startAcw'](_0x575816['linkedid']);}}catch(_0x2e3bdf){logger['error'](_0x4018('0x43'),_0x2e3bdf[_0x4018('0x33')]);}};Acw[_0x4018('0x16')][_0x4018('0x44')]=function(_0x2f83e9){try{if(!_['isNil'](this[_0x4018('0x9')][_0x2f83e9[_0x4018('0x45')]])){this[_0x4018('0x17')](_0x2f83e9[_0x4018('0x45')]);if(this[_0x4018('0x9')][_0x2f83e9[_0x4018('0x46')]]){this[_0x4018('0x9')][_0x2f83e9['secondtransfereruniqueid']]['attended']=!![];this[_0x4018('0x9')][_0x2f83e9[_0x4018('0x47')]]=this['channels'][_0x2f83e9[_0x4018('0x46')]];delete this['channels'][_0x2f83e9[_0x4018('0x46')]];}}else if(!_['isNil'](this[_0x4018('0x9')][_0x2f83e9[_0x4018('0x47')]])){this['startAcw'](_0x2f83e9[_0x4018('0x47')]);if(this[_0x4018('0x9')][_0x2f83e9[_0x4018('0x48')]]){this[_0x4018('0x9')][_0x2f83e9['origtransfereruniqueid']][_0x4018('0x21')]=!![];this['channels'][_0x2f83e9[_0x4018('0x45')]]=this[_0x4018('0x9')][_0x2f83e9[_0x4018('0x48')]];delete this[_0x4018('0x9')][_0x2f83e9[_0x4018('0x48')]];}}}catch(_0x58574a){logger[_0x4018('0x2d')](_0x4018('0x49'),_0x58574a[_0x4018('0x33')]);}};Acw['prototype'][_0x4018('0x11')]=function(_0x433f90){try{if(this[_0x4018('0x9')][_0x433f90[_0x4018('0x4a')]]){logger['info'](_0x4018('0x4b'),JSON[_0x4018('0x39')](_0x433f90[_0x4018('0x4a')]));this[_0x4018('0x17')](_0x433f90[_0x4018('0x4a')]);}else if(this[_0x4018('0x9')][_0x433f90[_0x4018('0x4c')]]){logger[_0x4018('0x1f')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x4018('0x39')](_0x433f90[_0x4018('0x4c')]));this[_0x4018('0x17')](_0x433f90[_0x4018('0x4c')]);}}catch(_0x55c685){logger[_0x4018('0x2d')](_0x4018('0x4d'),_0x55c685[_0x4018('0x33')]);}};Acw[_0x4018('0x16')][_0x4018('0xe')]=function(_0x22f017){try{if(this[_0x4018('0x6')][_0x22f017[_0x4018('0x29')]]&&this[_0x4018('0x6')][_0x22f017[_0x4018('0x29')]][_0x4018('0x4e')]===_0x4018('0x4f')){if(this['agents'][_0x22f017[_0x4018('0x18')]]){logger[_0x4018('0x1f')](_0x4018('0x50'),_0x22f017[_0x4018('0x2b')],_0x22f017[_0x4018('0x18')],_0x22f017['queue']);return RpcUser['savePause'](this[_0x4018('0x7')][_0x22f017[_0x4018('0x18')]],_0x4018('0x51'),_0x22f017[_0x4018('0x2b')]);}}}catch(_0x5ca3fc){logger[_0x4018('0x2d')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x5ca3fc[_0x4018('0x33')]);}};module[_0x4018('0x52')]=Acw; \ No newline at end of file +var _0x152f=['[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangup','agentringnoanswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','uniqueid','updateAcw','update','catch','finally','error','[ACW][START]\x20%s','message','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','interface','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]'];(function(_0x3811da,_0x19326d){var _0x53c4c6=function(_0x11e5b2){while(--_0x11e5b2){_0x3811da['push'](_0x3811da['shift']());}};_0x53c4c6(++_0x19326d);}(_0x152f,0x101));var _0xf152=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x152f[_0x54d4fe];return _0x1ab5bb;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf152('0x0'));var ami=require(_0xf152('0x1'));var logger=require('../../../config/logger')(_0xf152('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xf152('0x3'));function Acw(_0x76de10){this[_0xf152('0x4')]=_0x76de10['voiceQueues'];this[_0xf152('0x5')]=_0x76de10['agents'];this[_0xf152('0x6')]=_0x76de10['timers'];this[_0xf152('0x7')]={};ami['on'](_0xf152('0x8'),this[_0xf152('0x9')][_0xf152('0xa')](this));ami['on'](_0xf152('0xb'),this['syncHangupRequest'][_0xf152('0xa')](this));ami['on']('hangup',this[_0xf152('0xc')][_0xf152('0xa')](this));ami['on'](_0xf152('0xd'),this['syncAgentRingNoAnswer'][_0xf152('0xa')](this));ami['on']('attendedtransfer',this[_0xf152('0xe')]['bind'](this));ami['on'](_0xf152('0xf'),this[_0xf152('0x10')][_0xf152('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0xf152('0x11')][_0xf152('0xa')](this));}function getDiff(_0x162f84){var _0x402ffd=moment()[_0xf152('0x12')](0x0);var _0x453fa3=moment(_0x162f84)[_0xf152('0x12')](0x0);return _0x402ffd[_0xf152('0x13')](_0x453fa3,_0xf152('0x14'));}Acw[_0xf152('0x15')][_0xf152('0x16')]=function(_0x16a036){try{var _0x263e70=this;var _0x1710a1=this[_0xf152('0x7')][_0x16a036]['interface'];var _0x352a29=this['channels'][_0x16a036][_0xf152('0x17')];var _0xe1aa95=this[_0xf152('0x4')][_0x352a29];var _0x5cb3f0=![];var _0x36d491=_0xf152('0x18');if(_0xe1aa95['mandatoryDisposition']){if(_0xe1aa95[_0xf152('0x19')]['name']){_0x5cb3f0=!![];_0x36d491=_0xe1aa95[_0xf152('0x19')][_0xf152('0x1a')];}}ami[_0xf152('0x1b')]({'action':_0xf152('0x1c'),'interface':_0x1710a1,'paused':!![],'reason':_0x36d491})[_0xf152('0x1d')](function(_0x4bd5a9){if(_0x263e70[_0xf152('0x5')][_0x1710a1]){return RpcUser[_0xf152('0x1e')](_0x263e70[_0xf152('0x5')][_0x1710a1]['id'])[_0xf152('0x1d')](function(_0x376032){if(_0x376032&&!_0x376032['voicePause']){logger[_0xf152('0x1f')](_0xf152('0x20'),_0x16a036,_0x1710a1,_0x352a29);var _0xc62028=_0x263e70[_0xf152('0x7')][_0x16a036][_0xf152('0x21')]&&_0x263e70[_0xf152('0x7')][_0x16a036][_0xf152('0x22')]?_0x263e70['channels'][_0x16a036][_0xf152('0x22')]:_0x16a036;return RpcUser[_0xf152('0x23')](_0x263e70[_0xf152('0x5')][_0x1710a1],_0x36d491,_0xc62028)['then'](function(_0x32603a){if(!_0x5cb3f0){_0x263e70[_0xf152('0x6')][_0x1710a1]={};logger[_0xf152('0x1f')](_0xf152('0x24'),_0x16a036,_0x263e70[_0xf152('0x4')][_0x352a29][_0xf152('0x25')],_0x1710a1,_0x352a29);_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x26')]=setTimeout(_0x263e70[_0xf152('0x27')]['bind'](_0x263e70,_0x1710a1),_0x263e70[_0xf152('0x4')][_0x352a29]['acwTimeout']*0x3e8);_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x28')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x29')]=_0x16a036;_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x17')]=_0x352a29;_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x2a')]=function(){var _0x1e1d27=getDiff(_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x28')]);clearTimeout(_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x26')]);_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x26')]=![];RpcVoiceAgentReport[_0xf152('0x2b')]({'acwtime':_0x1e1d27},_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x29')],_0x1710a1)[_0xf152('0x1d')](function(_0x23d076){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x16a036,_0x1e1d27,_0x23d076);})['catch'](function(_0x574bc7){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x16a036,_0x574bc7);});delete _0x263e70[_0xf152('0x6')][_0x1710a1];};}});}else{logger[_0xf152('0x1f')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x16a036,_0x1710a1,_0x352a29);}});}})[_0xf152('0x2c')](function(_0x4730c5){logger['error'](_0xf152('0x24'),_0x16a036,_0x263e70[_0xf152('0x4')][_0x352a29][_0xf152('0x25')],_0x1710a1,_0x352a29);})[_0xf152('0x2d')](function(){delete _0x263e70[_0xf152('0x7')][_0x16a036];});}catch(_0x19360e){logger[_0xf152('0x2e')](_0xf152('0x2f'),_0x19360e[_0xf152('0x30')]);}};Acw[_0xf152('0x15')][_0xf152('0x27')]=function(_0x3f9c92){try{var _0x10f910=this;if(_0x10f910[_0xf152('0x6')][_0x3f9c92]){_0x10f910['timers'][_0x3f9c92][_0xf152('0x26')]=![];var _0x28bbd6=_0x10f910[_0xf152('0x6')][_0x3f9c92]['uniqueid'];var _0x3f17de=_0x10f910[_0xf152('0x6')][_0x3f9c92][_0xf152('0x17')];var _0x52f366=_0x10f910[_0xf152('0x4')][_0x3f17de][_0xf152('0x25')];logger[_0xf152('0x1f')]('[%s][TIMER][STOP][AGENT:%s]',_0x28bbd6,_0x3f9c92);RpcUser[_0xf152('0x31')](this[_0xf152('0x5')][_0x3f9c92]);RpcVoiceAgentReport[_0xf152('0x2b')]({'acwtime':_0x52f366,'agentacw':!![]},_0x28bbd6,_0x3f9c92)['then'](function(_0x3f27ff){logger[_0xf152('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x28bbd6,_0x52f366,_0x3f27ff);})[_0xf152('0x2c')](function(_0x148619){logger[_0xf152('0x2e')](_0xf152('0x32'),_0x28bbd6,_0x148619);});}else{logger[_0xf152('0x2e')](_0xf152('0x33'),_0x3f9c92);if(_0x10f910[_0xf152('0x6')]){logger['info'](_0xf152('0x34'),JSON[_0xf152('0x35')](_0x10f910['timers']));}}}catch(_0x1df502){logger[_0xf152('0x2e')](_0xf152('0x36'),_0x1df502[_0xf152('0x30')]);}};Acw['prototype'][_0xf152('0x9')]=function(_0x30e86f){try{if(this[_0xf152('0x4')][_0x30e86f[_0xf152('0x17')]]&&(this[_0xf152('0x4')][_0x30e86f[_0xf152('0x17')]][_0xf152('0x2')]||this[_0xf152('0x4')][_0x30e86f[_0xf152('0x17')]][_0xf152('0x37')])){if(this[_0xf152('0x5')][_0x30e86f[_0xf152('0x38')]]){this['channels'][_0x30e86f[_0xf152('0x29')]]={'queue':_0x30e86f[_0xf152('0x17')],'interface':_0x30e86f['interface'],'destlinkedid':_0x30e86f['destlinkedid']};}}}catch(_0x46d407){logger[_0xf152('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x46d407[_0xf152('0x30')]);}};Acw[_0xf152('0x15')][_0xf152('0x11')]=function(_0x15818d){try{if(this[_0xf152('0x4')][_0x15818d[_0xf152('0x17')]]&&(this[_0xf152('0x4')][_0x15818d['queue']][_0xf152('0x2')]||this[_0xf152('0x4')][_0x15818d['queue']]['mandatoryDisposition'])){if(this[_0xf152('0x5')][_0x15818d[_0xf152('0x38')]]){this[_0xf152('0x7')][_0x15818d['uniqueid']]={'queue':_0x15818d[_0xf152('0x17')],'interface':_0x15818d[_0xf152('0x38')]};}}}catch(_0x22ebce){logger[_0xf152('0x2e')]('[ACW][syncAgentConnectPreview]\x20%s',_0x22ebce['message']);}};Acw['prototype'][_0xf152('0x39')]=function(_0x36971a){try{if(this['channels'][_0x36971a[_0xf152('0x29')]]&&_[_0xf152('0x3a')](this[_0xf152('0x7')][_0x36971a[_0xf152('0x29')]]['attended'])){logger[_0xf152('0x1f')](_0xf152('0x3b'),_0x36971a[_0xf152('0x29')]);this[_0xf152('0x16')](_0x36971a[_0xf152('0x29')]);}else if(this[_0xf152('0x7')][_0x36971a[_0xf152('0x3c')]]&&_['isUndefined'](this[_0xf152('0x7')][_0x36971a[_0xf152('0x3c')]][_0xf152('0x21')])){logger[_0xf152('0x1f')]('[%s][HANGUP:LINKEDID]',_0x36971a[_0xf152('0x3c')]);this[_0xf152('0x16')](_0x36971a[_0xf152('0x3c')]);}}catch(_0x55d498){logger[_0xf152('0x2e')](_0xf152('0x3d'),_0x55d498['message']);}};Acw[_0xf152('0x15')]['syncHangup']=function(_0x260983){try{if(this[_0xf152('0x7')][_0x260983[_0xf152('0x29')]]&&this['channels'][_0x260983[_0xf152('0x29')]][_0xf152('0x21')]){logger[_0xf152('0x1f')](_0xf152('0x3e'),_0x260983['uniqueid']);this['startAcw'](_0x260983[_0xf152('0x29')]);}else if(this[_0xf152('0x7')][_0x260983[_0xf152('0x3c')]]&&this['channels'][_0x260983[_0xf152('0x3c')]]['attended']){logger[_0xf152('0x1f')](_0xf152('0x3f'),_0x260983[_0xf152('0x3c')]);this[_0xf152('0x16')](_0x260983['linkedid']);}}catch(_0x1e548a){logger[_0xf152('0x2e')](_0xf152('0x40'),_0x1e548a[_0xf152('0x30')]);}};Acw[_0xf152('0x15')][_0xf152('0xe')]=function(_0x268417){try{if(!_[_0xf152('0x41')](this[_0xf152('0x7')][_0x268417[_0xf152('0x42')]])){this[_0xf152('0x16')](_0x268417[_0xf152('0x42')]);if(this[_0xf152('0x7')][_0x268417['secondtransfereruniqueid']]){this[_0xf152('0x7')][_0x268417[_0xf152('0x43')]]['attended']=!![];this[_0xf152('0x7')][_0x268417[_0xf152('0x44')]]=this[_0xf152('0x7')][_0x268417[_0xf152('0x43')]];delete this[_0xf152('0x7')][_0x268417[_0xf152('0x43')]];}}else if(!_['isNil'](this[_0xf152('0x7')][_0x268417[_0xf152('0x44')]])){this[_0xf152('0x16')](_0x268417[_0xf152('0x44')]);if(this[_0xf152('0x7')][_0x268417['origtransfereruniqueid']]){this[_0xf152('0x7')][_0x268417[_0xf152('0x45')]][_0xf152('0x21')]=!![];this[_0xf152('0x7')][_0x268417[_0xf152('0x42')]]=this[_0xf152('0x7')][_0x268417[_0xf152('0x45')]];delete this[_0xf152('0x7')][_0x268417[_0xf152('0x45')]];}}}catch(_0x363526){logger['error'](_0xf152('0x46'),_0x363526[_0xf152('0x30')]);}};Acw['prototype'][_0xf152('0x10')]=function(_0x1da22e){try{if(this[_0xf152('0x7')][_0x1da22e[_0xf152('0x47')]]){logger[_0xf152('0x1f')](_0xf152('0x48'),JSON[_0xf152('0x35')](_0x1da22e[_0xf152('0x47')]));this[_0xf152('0x16')](_0x1da22e['transfereruniqueid']);}else if(this[_0xf152('0x7')][_0x1da22e[_0xf152('0x49')]]){logger[_0xf152('0x1f')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x1da22e[_0xf152('0x49')]));this[_0xf152('0x16')](_0x1da22e['transfererlinkedid']);}}catch(_0x15d41c){logger[_0xf152('0x2e')](_0xf152('0x4a'),_0x15d41c['message']);}};Acw[_0xf152('0x15')][_0xf152('0x4b')]=function(_0x5e751e){try{if(this[_0xf152('0x4')][_0x5e751e[_0xf152('0x17')]]&&this[_0xf152('0x4')][_0x5e751e[_0xf152('0x17')]][_0xf152('0x4c')]===_0xf152('0x4d')){if(this[_0xf152('0x5')][_0x5e751e['interface']]){logger[_0xf152('0x1f')](_0xf152('0x4e'),_0x5e751e[_0xf152('0x29')],_0x5e751e[_0xf152('0x38')],_0x5e751e[_0xf152('0x17')]);return RpcUser[_0xf152('0x23')](this[_0xf152('0x5')][_0x5e751e[_0xf152('0x38')]],'Auto-Pause',_0x5e751e[_0xf152('0x29')]);}}}catch(_0x140be6){logger[_0xf152('0x2e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x140be6[_0xf152('0x30')]);}};module[_0xf152('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 27b0cbb..44762d2 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x5640b7,_0x2c7955){var _0x409040=function(_0xca6bbc){while(--_0xca6bbc){_0x5640b7['push'](_0x5640b7['shift']());}};_0x409040(++_0x2c7955);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xb7e7[_0x9aada2];return _0x196dff;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file +var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x2b176c,_0x44bc61){var _0x22517e=function(_0xb7d2bb){while(--_0xb7d2bb){_0x2b176c['push'](_0x2b176c['shift']());}};_0x22517e(++_0x44bc61);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb7e7[_0x38a7ac];return _0x53061a;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 4d891f7..b1e447a 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xe706,0xa3));var _0x6e70=function(_0x4da572,_0x326408){_0x4da572=_0x4da572-0x0;var _0x378393=_0xe706[_0x4da572];return _0x378393;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0xcb91[_0x21205e];return _0x136ebb;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 92eb324..939aafd 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b3d=['ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','getCaller','voiceQueue','dialCutDigit','substring','prototype','getQueue','exports','moment','isNil','string','uniqueid','name','phone','Contact','number','queue','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper'];(function(_0x5caabb,_0x2b0cc1){var _0x2929d8=function(_0x389698){while(--_0x389698){_0x5caabb['push'](_0x5caabb['shift']());}};_0x2929d8(++_0x2b0cc1);}(_0x0b3d,0x1a9));var _0xd0b3=function(_0x3888ae,_0x5c8de7){_0x3888ae=_0x3888ae-0x0;var _0x2e8ad7=_0x0b3d[_0x3888ae];return _0x2e8ad7;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xd0b3('0x0'));function checkNameSurname(_0x233ad9,_0x1cd96c,_0x193b1b){var _0x27a915='';if(!_[_0xd0b3('0x1')](_0x1cd96c)&&_0xd0b3('0x2')===typeof _0x1cd96c){_0x27a915+=_0x1cd96c;}if(!_[_0xd0b3('0x1')](_0x193b1b)&&'string'===typeof _0x193b1b){_0x27a915+='\x20'+_0x193b1b;}if(_0x27a915!==''){return _0x27a915;}return _0x233ad9;}function Action(_0x55db2c,_0x17a056,_0x32286d){this['voiceQueue']=_0x55db2c;this[_0xd0b3('0x3')]=_0x32286d||undefined;this[_0xd0b3('0x4')]=checkNameSurname(_0x17a056['Contact'][_0xd0b3('0x5')],_0x17a056['Contact']['firstName'],_0x17a056[_0xd0b3('0x6')]['lastName']);this[_0xd0b3('0x7')]=_0x17a056[_0xd0b3('0x6')]['phone'];this[_0xd0b3('0x8')]=_0x55db2c['name'];this['active']=_0x17a056['active']||![];this[_0xd0b3('0x9')]=_0x55db2c[_0xd0b3('0x9')];this[_0xd0b3('0xa')]=_0x55db2c[_0xd0b3('0xa')]||0x3;this[_0xd0b3('0xb')]=_0x17a056[_0xd0b3('0xb')];this[_0xd0b3('0xc')]=_0x17a056[_0xd0b3('0xc')];this[_0xd0b3('0xd')]=_0x17a056[_0xd0b3('0xd')];this[_0xd0b3('0xe')]=_0x17a056[_0xd0b3('0xe')];this[_0xd0b3('0xf')]=_0x17a056[_0xd0b3('0xf')];this[_0xd0b3('0x10')]=_0x17a056[_0xd0b3('0x10')];this[_0xd0b3('0x11')]=_0x17a056[_0xd0b3('0x11')];this[_0xd0b3('0x12')]=_0x17a056[_0xd0b3('0x12')];this[_0xd0b3('0x13')]=_0x17a056[_0xd0b3('0x13')];this[_0xd0b3('0x14')]=_0x17a056[_0xd0b3('0x14')];this[_0xd0b3('0x15')]=_0x17a056[_0xd0b3('0x15')];this[_0xd0b3('0x16')]=_0x17a056[_0xd0b3('0x16')];this[_0xd0b3('0x17')]=_0x17a056[_0xd0b3('0x17')];this[_0xd0b3('0x18')]=_0x17a056[_0xd0b3('0x18')];this[_0xd0b3('0x19')]=_0x17a056['id'];this[_0xd0b3('0x1a')]=_0x17a056[_0xd0b3('0x6')][_0xd0b3('0x1b')]||'';this[_0xd0b3('0x1c')]=moment()['format'](_0xd0b3('0x1d'));this[_0xd0b3('0x1e')]=_0x17a056['callback'];this['callbackuniqueid']=_0x17a056[_0xd0b3('0x1f')];this['callbackat']=_0x17a056[_0xd0b3('0x20')];this[_0xd0b3('0x21')]=_0x17a056[_0xd0b3('0x21')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0xd0b3('0x22')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['name'],this[_0xd0b3('0x23')][_0xd0b3('0x24')]>0x0?this['number'][_0xd0b3('0x25')](this[_0xd0b3('0x23')][_0xd0b3('0x24')]):this[_0xd0b3('0x7')]);};Action[_0xd0b3('0x26')][_0xd0b3('0x27')]=function(){return this[_0xd0b3('0x8')];};module[_0xd0b3('0x28')]=Action; \ No newline at end of file +var _0x702a=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x702a,0x9d));var _0xa702=function(_0x306c9a,_0x1c6480){_0x306c9a=_0x306c9a-0x0;var _0x54b80c=_0x702a[_0x306c9a];return _0x54b80c;};'use strict';var util=require(_0xa702('0x0'));var _=require('lodash');var moment=require(_0xa702('0x1'));function checkNameSurname(_0x100322,_0x323bd7,_0x5a8712){var _0x40b813='';if(!_[_0xa702('0x2')](_0x323bd7)&&_0xa702('0x3')===typeof _0x323bd7){_0x40b813+=_0x323bd7;}if(!_['isNil'](_0x5a8712)&&_0xa702('0x3')===typeof _0x5a8712){_0x40b813+='\x20'+_0x5a8712;}if(_0x40b813!==''){return _0x40b813;}return _0x100322;}function Action(_0x28fc8e,_0x345f5b,_0x4f6a20){this[_0xa702('0x4')]=_0x28fc8e;this[_0xa702('0x5')]=_0x4f6a20||undefined;this[_0xa702('0x6')]=checkNameSurname(_0x345f5b[_0xa702('0x7')]['phone'],_0x345f5b[_0xa702('0x7')][_0xa702('0x8')],_0x345f5b[_0xa702('0x7')][_0xa702('0x9')]);this[_0xa702('0xa')]=_0x345f5b[_0xa702('0x7')][_0xa702('0xb')];this[_0xa702('0xc')]=_0x28fc8e[_0xa702('0x6')];this[_0xa702('0xd')]=_0x345f5b['active']||![];this[_0xa702('0xe')]=_0x28fc8e[_0xa702('0xe')];this[_0xa702('0xf')]=_0x28fc8e[_0xa702('0xf')]||0x3;this[_0xa702('0x10')]=_0x345f5b[_0xa702('0x10')];this[_0xa702('0x11')]=_0x345f5b[_0xa702('0x11')];this[_0xa702('0x12')]=_0x345f5b[_0xa702('0x12')];this['countnoanswerretry']=_0x345f5b[_0xa702('0x13')];this[_0xa702('0x14')]=_0x345f5b[_0xa702('0x14')];this['countdropretry']=_0x345f5b[_0xa702('0x15')];this[_0xa702('0x16')]=_0x345f5b[_0xa702('0x16')];this[_0xa702('0x17')]=_0x345f5b['countmachineretry'];this[_0xa702('0x18')]=_0x345f5b[_0xa702('0x18')];this[_0xa702('0x19')]=_0x345f5b['ContactId'];this[_0xa702('0x1a')]=_0x345f5b['ListId'];this[_0xa702('0x1b')]=_0x345f5b[_0xa702('0x1b')];this[_0xa702('0x1c')]=_0x345f5b[_0xa702('0x1c')];this[_0xa702('0x1d')]=_0x345f5b['CampaignId'];this['idHopper']=_0x345f5b['id'];this[_0xa702('0x1e')]=_0x345f5b['Contact'][_0xa702('0x8')]||'';this[_0xa702('0x1f')]=moment()[_0xa702('0x20')](_0xa702('0x21'));this[_0xa702('0x22')]=_0x345f5b['callback'];this[_0xa702('0x23')]=_0x345f5b[_0xa702('0x23')];this[_0xa702('0x24')]=_0x345f5b[_0xa702('0x24')];this[_0xa702('0x25')]=_0x345f5b['recallme'];this[_0xa702('0x26')]='';this[_0xa702('0x27')]='';}Action['prototype'][_0xa702('0x28')]=function(){return util[_0xa702('0x20')](_0xa702('0x29'),this[_0xa702('0x6')],this['voiceQueue'][_0xa702('0x2a')]>0x0?this['number'][_0xa702('0x2b')](this[_0xa702('0x4')][_0xa702('0x2a')]):this[_0xa702('0xa')]);};Action[_0xa702('0x2c')][_0xa702('0x2d')]=function(){return this[_0xa702('0xc')];};module[_0xa702('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 9f436c8..ba883f7 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8634=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x8634,0x18a));var _0x4863=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0x8634[_0x3bf925];return _0x2128a1;};'use strict';var util=require(_0x4863('0x0'));var _=require(_0x4863('0x1'));var moment=require(_0x4863('0x2'));function getSeconds(_0x4e3fd6,_0x1560a4){var _0x40ed76=moment(_0x4e3fd6)[_0x4863('0x3')](0x0);var _0x41ceac=moment(_0x1560a4)[_0x4863('0x3')](0x0);return _0x40ed76[_0x4863('0x4')](_0x41ceac,_0x4863('0x5'));}function AgentComplete(_0x38ff5b,_0x35198b){this[_0x4863('0x6')]=0x4;this[_0x4863('0x7')]=_0x4863('0x8');this[_0x4863('0x9')]=_0x38ff5b[_0x4863('0x9')];this[_0x4863('0xa')]=_0x38ff5b[_0x4863('0xa')];this[_0x4863('0xb')]=_0x38ff5b[_0x4863('0xa')]===_0x4863('0xc')?_0x4863('0xd'):_0x38ff5b[_0x4863('0xa')];this[_0x4863('0xe')]=_0x38ff5b['countbusyretry'];this[_0x4863('0xf')]=_0x38ff5b[_0x4863('0xf')];this[_0x4863('0x10')]=_0x38ff5b['countnoanswerretry'];this[_0x4863('0x11')]=_0x38ff5b[_0x4863('0xe')]+_0x38ff5b[_0x4863('0xf')]+_0x38ff5b['countnoanswerretry']+_0x38ff5b['countnosuchnumberretry']+_0x38ff5b['countdropretry']+_0x38ff5b[_0x4863('0x12')]+_0x38ff5b[_0x4863('0x13')]+_0x38ff5b[_0x4863('0x14')];this['countnosuchnumberretry']=_0x38ff5b['countnosuchnumberretry'];this[_0x4863('0x15')]=_0x38ff5b[_0x4863('0x15')];this[_0x4863('0x12')]=_0x38ff5b[_0x4863('0x12')];this[_0x4863('0x13')]=_0x38ff5b['countmachineretry'];this['countagentrejectretry']=_0x38ff5b[_0x4863('0x14')];this[_0x4863('0x16')]=_0x35198b[_0x4863('0x16')];this[_0x4863('0x17')]=_0x38ff5b['name'];this[_0x4863('0x18')]=_0x38ff5b[_0x4863('0x19')];this[_0x4863('0x1a')]=_0x38ff5b[_0x4863('0x1a')];this[_0x4863('0x1b')]=_0x38ff5b[_0x4863('0x1b')];this[_0x4863('0x1c')]=_0x38ff5b[_0x4863('0x1c')];this[_0x4863('0x1d')]=moment()[_0x4863('0x1e')](_0x4863('0x1f'));this[_0x4863('0x20')]=getSeconds(_0x38ff5b[_0x4863('0x1b')],_0x38ff5b['starttime']);this[_0x4863('0x21')]=getSeconds(_0x38ff5b[_0x4863('0x1c')],_0x38ff5b[_0x4863('0x1b')]);this['talktime']=getSeconds(this['endtime'],_0x38ff5b[_0x4863('0x1c')]);this[_0x4863('0xd')]=_0x35198b[_0x4863('0xd')];this[_0x4863('0x22')]=_0x35198b[_0x4863('0x22')];this[_0x4863('0x23')]=_0x35198b[_0x4863('0x23')];this[_0x4863('0x24')]=_0x38ff5b[_0x4863('0x24')];this[_0x4863('0x25')]=_0x38ff5b[_0x4863('0x25')];this[_0x4863('0x26')]=_0x38ff5b[_0x4863('0x26')];this[_0x4863('0x27')]=_0x38ff5b[_0x4863('0x27')];this['ContactId']=_0x38ff5b[_0x4863('0x28')];this[_0x4863('0x29')]=_0x38ff5b[_0x4863('0x29')];this[_0x4863('0x2a')]=_0x38ff5b[_0x4863('0x2a')];this[_0x4863('0x2b')]=_0x38ff5b[_0x4863('0x2b')];this[_0x4863('0x2c')]=_0x38ff5b[_0x4863('0x2c')];this['originatecalleridnum']=_0x38ff5b[_0x4863('0x2d')]||'';this[_0x4863('0x2e')]=_0x38ff5b['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x27c8=['answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime'];(function(_0x3c5433,_0x515ff7){var _0x425f26=function(_0x5bafca){while(--_0x5bafca){_0x3c5433['push'](_0x3c5433['shift']());}};_0x425f26(++_0x515ff7);}(_0x27c8,0x6a));var _0x827c=function(_0x4a8cb1,_0x588041){_0x4a8cb1=_0x4a8cb1-0x0;var _0x7a04ed=_0x27c8[_0x4a8cb1];return _0x7a04ed;};'use strict';var util=require('util');var _=require(_0x827c('0x0'));var moment=require(_0x827c('0x1'));function getSeconds(_0x52699a,_0x47db79){var _0x3e1510=moment(_0x52699a)[_0x827c('0x2')](0x0);var _0x1a586a=moment(_0x47db79)[_0x827c('0x2')](0x0);return _0x3e1510[_0x827c('0x3')](_0x1a586a,_0x827c('0x4'));}function AgentComplete(_0x48ca05,_0x56b4eb){this[_0x827c('0x5')]=0x4;this[_0x827c('0x6')]=_0x827c('0x7');this[_0x827c('0x8')]=_0x48ca05[_0x827c('0x8')];this[_0x827c('0x9')]=_0x48ca05['type'];this['campaigntype']=_0x48ca05[_0x827c('0x9')]===_0x827c('0xa')?'queue':_0x48ca05['type'];this[_0x827c('0xb')]=_0x48ca05[_0x827c('0xb')];this['countcongestionretry']=_0x48ca05[_0x827c('0xc')];this[_0x827c('0xd')]=_0x48ca05[_0x827c('0xd')];this[_0x827c('0xe')]=_0x48ca05['countbusyretry']+_0x48ca05[_0x827c('0xc')]+_0x48ca05[_0x827c('0xd')]+_0x48ca05['countnosuchnumberretry']+_0x48ca05[_0x827c('0xf')]+_0x48ca05[_0x827c('0x10')]+_0x48ca05[_0x827c('0x11')]+_0x48ca05[_0x827c('0x12')];this[_0x827c('0x13')]=_0x48ca05['countnosuchnumberretry'];this['countdropretry']=_0x48ca05['countdropretry'];this[_0x827c('0x10')]=_0x48ca05[_0x827c('0x10')];this[_0x827c('0x11')]=_0x48ca05[_0x827c('0x11')];this['countagentrejectretry']=_0x48ca05[_0x827c('0x12')];this[_0x827c('0x14')]=_0x56b4eb[_0x827c('0x14')];this[_0x827c('0x15')]=_0x48ca05[_0x827c('0x16')];this['calleridnum']=_0x48ca05[_0x827c('0x17')];this['starttime']=_0x48ca05[_0x827c('0x18')];this[_0x827c('0x19')]=_0x48ca05['responsetime'];this[_0x827c('0x1a')]=_0x48ca05[_0x827c('0x1a')];this['endtime']=moment()['format'](_0x827c('0x1b'));this[_0x827c('0x1c')]=getSeconds(_0x48ca05[_0x827c('0x19')],_0x48ca05[_0x827c('0x18')]);this['holdtime']=getSeconds(_0x48ca05['answertime'],_0x48ca05['responsetime']);this['talktime']=getSeconds(this[_0x827c('0x1d')],_0x48ca05['answertime']);this[_0x827c('0x1e')]=_0x56b4eb[_0x827c('0x1e')];this[_0x827c('0x1f')]=_0x56b4eb[_0x827c('0x1f')];this['reason']=_0x56b4eb[_0x827c('0x20')];this[_0x827c('0x21')]=_0x48ca05[_0x827c('0x21')];this[_0x827c('0x22')]=_0x48ca05['callbackuniqueid'];this[_0x827c('0x23')]=_0x48ca05[_0x827c('0x23')];this[_0x827c('0x24')]=_0x48ca05[_0x827c('0x24')];this[_0x827c('0x25')]=_0x48ca05[_0x827c('0x25')];this[_0x827c('0x26')]=_0x48ca05[_0x827c('0x26')];this[_0x827c('0x27')]=_0x48ca05['UserId'];this['VoiceQueueId']=_0x48ca05[_0x827c('0x28')];this['CampaignId']=_0x48ca05['CampaignId'];this[_0x827c('0x29')]=_0x48ca05[_0x827c('0x29')]||'';this['originatecalleridname']=_0x48ca05[_0x827c('0x2a')]||'';}module[_0x827c('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index da05e64..eb9c455 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3baf=['countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','campaigntype','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x2b4e5f,_0x10f661){var _0x5f2602=function(_0x18cf6d){while(--_0x18cf6d){_0x2b4e5f['push'](_0x2b4e5f['shift']());}};_0x5f2602(++_0x10f661);}(_0x3baf,0xf7));var _0xf3ba=function(_0x1aa4fd,_0x265057){_0x1aa4fd=_0x1aa4fd-0x0;var _0x289290=_0x3baf[_0x1aa4fd];return _0x289290;};'use strict';var util=require(_0xf3ba('0x0'));var _=require(_0xf3ba('0x1'));var moment=require(_0xf3ba('0x2'));function getSeconds(_0x3979b3,_0x29bbc2){var _0x22f9c0=moment(_0x3979b3)[_0xf3ba('0x3')](0x0);var _0x306bdd=moment(_0x29bbc2)[_0xf3ba('0x3')](0x0);return _0x22f9c0[_0xf3ba('0x4')](_0x306bdd,_0xf3ba('0x5'));}function Final(_0x1c7a62){this[_0xf3ba('0x6')]=_0x1c7a62[_0xf3ba('0x6')];this[_0xf3ba('0x7')]=_0x1c7a62['scheduledat'];this['type']=_0x1c7a62['type'];this[_0xf3ba('0x8')]=_0x1c7a62['type']===_0xf3ba('0x9')?_0xf3ba('0xa'):_0x1c7a62[_0xf3ba('0xb')];this[_0xf3ba('0xc')]=_0x1c7a62[_0xf3ba('0xc')];this[_0xf3ba('0xd')]=_0x1c7a62[_0xf3ba('0xd')];this[_0xf3ba('0xe')]=_0x1c7a62[_0xf3ba('0xe')];this[_0xf3ba('0xf')]=_0x1c7a62[_0xf3ba('0xc')]+_0x1c7a62[_0xf3ba('0xd')]+_0x1c7a62[_0xf3ba('0xe')]+_0x1c7a62[_0xf3ba('0x10')]+_0x1c7a62[_0xf3ba('0x11')]+_0x1c7a62[_0xf3ba('0x12')]+_0x1c7a62[_0xf3ba('0x13')]+_0x1c7a62[_0xf3ba('0x14')];this['countnosuchnumberretry']=_0x1c7a62[_0xf3ba('0x10')];this['countdropretry']=_0x1c7a62[_0xf3ba('0x11')];this[_0xf3ba('0x12')]=_0x1c7a62[_0xf3ba('0x12')];this[_0xf3ba('0x13')]=_0x1c7a62[_0xf3ba('0x13')];this['countagentrejectretry']=_0x1c7a62[_0xf3ba('0x14')];this[_0xf3ba('0xa')]=_0x1c7a62[_0xf3ba('0xa')];this['calleridname']=_0x1c7a62[_0xf3ba('0x15')];this[_0xf3ba('0x16')]=_0x1c7a62[_0xf3ba('0x16')];this[_0xf3ba('0x17')]=_0x1c7a62['starttime'];this[_0xf3ba('0x18')]=_0x1c7a62[_0xf3ba('0x18')];this['endtime']=_0x1c7a62['responsetime'];this[_0xf3ba('0x19')]=_0x1c7a62[_0xf3ba('0x19')]||0x0;this[_0xf3ba('0x1a')]=_0x1c7a62['holdtime']||0x0;this[_0xf3ba('0x1b')]=_0x1c7a62[_0xf3ba('0x1b')]||0x0;this[_0xf3ba('0x1c')]=_0x1c7a62[_0xf3ba('0x1c')];this[_0xf3ba('0x1d')]=_0x1c7a62[_0xf3ba('0x1d')];this[_0xf3ba('0x1e')]=_0x1c7a62['callbackat'];this['recallme']=_0x1c7a62['recallme'];this[_0xf3ba('0x1f')]=_0x1c7a62[_0xf3ba('0x1f')];this[_0xf3ba('0x20')]=_0x1c7a62[_0xf3ba('0x20')];this[_0xf3ba('0x21')]=_0x1c7a62['UserId'];this['VoiceQueueId']=_0x1c7a62[_0xf3ba('0x22')];this[_0xf3ba('0x23')]=_0x1c7a62['CampaignId'];this[_0xf3ba('0x24')]=_0x1c7a62[_0xf3ba('0x24')]||'';this['originatecalleridname']=_0x1c7a62['originatecalleridname']||'';}module[_0xf3ba('0x25')]=Final; \ No newline at end of file +var _0x9b67=['countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x42c797,_0x16382b){var _0x320035=function(_0x39f50b){while(--_0x39f50b){_0x42c797['push'](_0x42c797['shift']());}};_0x320035(++_0x16382b);}(_0x9b67,0xf6));var _0x79b6=function(_0x480a40,_0x104dcf){_0x480a40=_0x480a40-0x0;var _0x3f68f7=_0x9b67[_0x480a40];return _0x3f68f7;};'use strict';var util=require(_0x79b6('0x0'));var _=require(_0x79b6('0x1'));var moment=require(_0x79b6('0x2'));function getSeconds(_0x1f4b0b,_0x29728d){var _0x5523a1=moment(_0x1f4b0b)[_0x79b6('0x3')](0x0);var _0x1aeb24=moment(_0x29728d)['milliseconds'](0x0);return _0x5523a1['diff'](_0x1aeb24,_0x79b6('0x4'));}function Final(_0x174768){this[_0x79b6('0x5')]=_0x174768[_0x79b6('0x5')];this[_0x79b6('0x6')]=_0x174768[_0x79b6('0x6')];this[_0x79b6('0x7')]=_0x174768['type'];this[_0x79b6('0x8')]=_0x174768[_0x79b6('0x7')]===_0x79b6('0x9')?_0x79b6('0xa'):_0x174768[_0x79b6('0x7')];this['countbusyretry']=_0x174768[_0x79b6('0xb')];this[_0x79b6('0xc')]=_0x174768[_0x79b6('0xc')];this[_0x79b6('0xd')]=_0x174768['countnoanswerretry'];this['countglobal']=_0x174768[_0x79b6('0xb')]+_0x174768[_0x79b6('0xc')]+_0x174768[_0x79b6('0xd')]+_0x174768['countnosuchnumberretry']+_0x174768[_0x79b6('0xe')]+_0x174768[_0x79b6('0xf')]+_0x174768[_0x79b6('0x10')]+_0x174768[_0x79b6('0x11')];this[_0x79b6('0x12')]=_0x174768[_0x79b6('0x12')];this[_0x79b6('0xe')]=_0x174768[_0x79b6('0xe')];this[_0x79b6('0xf')]=_0x174768[_0x79b6('0xf')];this[_0x79b6('0x10')]=_0x174768[_0x79b6('0x10')];this[_0x79b6('0x11')]=_0x174768['countagentrejectretry'];this[_0x79b6('0xa')]=_0x174768[_0x79b6('0xa')];this[_0x79b6('0x13')]=_0x174768[_0x79b6('0x13')];this[_0x79b6('0x14')]=_0x174768[_0x79b6('0x14')];this[_0x79b6('0x15')]=_0x174768[_0x79b6('0x15')];this[_0x79b6('0x16')]=_0x174768[_0x79b6('0x16')];this[_0x79b6('0x17')]=_0x174768[_0x79b6('0x16')];this[_0x79b6('0x18')]=_0x174768['ringtime']||0x0;this[_0x79b6('0x19')]=_0x174768['holdtime']||0x0;this[_0x79b6('0x1a')]=_0x174768['talktime']||0x0;this[_0x79b6('0x1b')]=_0x174768[_0x79b6('0x1b')];this[_0x79b6('0x1c')]=_0x174768['callbackuniqueid'];this[_0x79b6('0x1d')]=_0x174768[_0x79b6('0x1d')];this['recallme']=_0x174768['recallme'];this[_0x79b6('0x1e')]=_0x174768[_0x79b6('0x1e')];this[_0x79b6('0x1f')]=_0x174768[_0x79b6('0x1f')];this[_0x79b6('0x20')]=_0x174768['UserId'];this[_0x79b6('0x21')]=_0x174768[_0x79b6('0x21')];this[_0x79b6('0x22')]=_0x174768[_0x79b6('0x22')];this['originatecalleridnum']=_0x174768['originatecalleridnum']||'';this[_0x79b6('0x23')]=_0x174768[_0x79b6('0x23')]||'';}module[_0x79b6('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index eb561e3..6f7046e 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc90d=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','diff','seconds','state','scheduledat'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc90d,0x1b1));var _0xdc90=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xc90d[_0x1bb58c];return _0x277586;};'use strict';var util=require(_0xdc90('0x0'));var _=require(_0xdc90('0x1'));var moment=require('moment');function getSeconds(_0x4a1f65,_0x1d8ce8){var _0x365b82=moment(_0x4a1f65)[_0xdc90('0x2')](0x0);var _0x5d5265=moment(_0x1d8ce8)[_0xdc90('0x2')](0x0);return _0x365b82[_0xdc90('0x3')](_0x5d5265,_0xdc90('0x4'));}function Hangup(_0x41bed7,_0x53d56b){this[_0xdc90('0x5')]=0x4;this['statedesc']='Answer';this[_0xdc90('0x6')]=_0x41bed7[_0xdc90('0x6')];this[_0xdc90('0x7')]=_0x41bed7[_0xdc90('0x7')];this[_0xdc90('0x8')]=_0x41bed7[_0xdc90('0x7')]===_0xdc90('0x9')?_0xdc90('0xa'):_0x41bed7['type'];this[_0xdc90('0xb')]=_0x41bed7[_0xdc90('0xb')];this[_0xdc90('0xc')]=_0x41bed7[_0xdc90('0xc')];this[_0xdc90('0xd')]=_0x41bed7['countnoanswerretry'];this['countglobal']=_0x41bed7['countbusyretry']+_0x41bed7[_0xdc90('0xc')]+_0x41bed7[_0xdc90('0xd')]+_0x41bed7[_0xdc90('0xe')]+_0x41bed7[_0xdc90('0xf')]+_0x41bed7['countabandonedretry']+_0x41bed7[_0xdc90('0x10')]+_0x41bed7['countagentrejectretry'];this[_0xdc90('0xe')]=_0x41bed7[_0xdc90('0xe')];this[_0xdc90('0xf')]=_0x41bed7['countdropretry'];this[_0xdc90('0x11')]=_0x41bed7['countabandonedretry'];this[_0xdc90('0x10')]=_0x41bed7[_0xdc90('0x10')];this[_0xdc90('0x12')]=_0x41bed7[_0xdc90('0x12')];this['uniqueid']=_0x53d56b[_0xdc90('0x13')];this[_0xdc90('0x14')]=_0x41bed7[_0xdc90('0x15')];this[_0xdc90('0x16')]=_0x41bed7[_0xdc90('0x17')];this[_0xdc90('0x18')]=_0x41bed7[_0xdc90('0x18')];this[_0xdc90('0x19')]=_0x41bed7[_0xdc90('0x19')];this[_0xdc90('0x1a')]=moment()[_0xdc90('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xdc90('0x1c')]=getSeconds(_0x41bed7[_0xdc90('0x19')],_0x41bed7[_0xdc90('0x18')]);this[_0xdc90('0x1d')]=0x0;this[_0xdc90('0x1e')]=getSeconds(this[_0xdc90('0x1a')],_0x41bed7[_0xdc90('0x19')]);this[_0xdc90('0xa')]=_0x41bed7[_0xdc90('0xa')];this['membername']=_0xdc90('0x1f');this[_0xdc90('0x20')]=_0x53d56b[_0xdc90('0x21')];this['callback']=_0x41bed7[_0xdc90('0x22')];this['callbackuniqueid']=_0x41bed7[_0xdc90('0x23')];this['callbackat']=_0x41bed7[_0xdc90('0x24')];this[_0xdc90('0x25')]=_0x41bed7[_0xdc90('0x25')];this[_0xdc90('0x26')]=_0x41bed7['ContactId'];this[_0xdc90('0x27')]=_0x41bed7[_0xdc90('0x27')];this[_0xdc90('0x28')]=_0x41bed7['UserId'];this[_0xdc90('0x29')]=_0x41bed7[_0xdc90('0x29')];this[_0xdc90('0x2a')]=_0x41bed7[_0xdc90('0x2a')];}module[_0xdc90('0x2b')]=Hangup; \ No newline at end of file +var _0x5973=['milliseconds','diff','seconds','state','statedesc','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment'];(function(_0xc0043d,_0x583c02){var _0x4ed29a=function(_0x312ab2){while(--_0x312ab2){_0xc0043d['push'](_0xc0043d['shift']());}};_0x4ed29a(++_0x583c02);}(_0x5973,0x145));var _0x3597=function(_0x24741a,_0x36a3f9){_0x24741a=_0x24741a-0x0;var _0x4d57ac=_0x5973[_0x24741a];return _0x4d57ac;};'use strict';var util=require(_0x3597('0x0'));var _=require(_0x3597('0x1'));var moment=require(_0x3597('0x2'));function getSeconds(_0x4b1f15,_0x3bcf3c){var _0x379d9a=moment(_0x4b1f15)[_0x3597('0x3')](0x0);var _0x17d041=moment(_0x3bcf3c)[_0x3597('0x3')](0x0);return _0x379d9a[_0x3597('0x4')](_0x17d041,_0x3597('0x5'));}function Hangup(_0x5964d7,_0x4d6bff){this[_0x3597('0x6')]=0x4;this[_0x3597('0x7')]='Answer';this['scheduledat']=_0x5964d7['scheduledat'];this[_0x3597('0x8')]=_0x5964d7['type'];this[_0x3597('0x9')]=_0x5964d7['type']==='outbound'?'queue':_0x5964d7['type'];this[_0x3597('0xa')]=_0x5964d7[_0x3597('0xa')];this['countcongestionretry']=_0x5964d7[_0x3597('0xb')];this[_0x3597('0xc')]=_0x5964d7[_0x3597('0xc')];this['countglobal']=_0x5964d7[_0x3597('0xa')]+_0x5964d7[_0x3597('0xb')]+_0x5964d7[_0x3597('0xc')]+_0x5964d7[_0x3597('0xd')]+_0x5964d7[_0x3597('0xe')]+_0x5964d7['countabandonedretry']+_0x5964d7[_0x3597('0xf')]+_0x5964d7[_0x3597('0x10')];this[_0x3597('0xd')]=_0x5964d7[_0x3597('0xd')];this[_0x3597('0xe')]=_0x5964d7[_0x3597('0xe')];this['countabandonedretry']=_0x5964d7[_0x3597('0x11')];this['countmachineretry']=_0x5964d7['countmachineretry'];this[_0x3597('0x10')]=_0x5964d7[_0x3597('0x10')];this[_0x3597('0x12')]=_0x4d6bff[_0x3597('0x12')];this['calleridname']=_0x5964d7['name'];this[_0x3597('0x13')]=_0x5964d7[_0x3597('0x14')];this['starttime']=_0x5964d7[_0x3597('0x15')];this['responsetime']=_0x5964d7[_0x3597('0x16')];this[_0x3597('0x17')]=moment()['format'](_0x3597('0x18'));this[_0x3597('0x19')]=getSeconds(_0x5964d7[_0x3597('0x16')],_0x5964d7[_0x3597('0x15')]);this[_0x3597('0x1a')]=0x0;this[_0x3597('0x1b')]=getSeconds(this[_0x3597('0x17')],_0x5964d7[_0x3597('0x16')]);this[_0x3597('0x1c')]=_0x5964d7[_0x3597('0x1c')];this[_0x3597('0x1d')]='IVR';this[_0x3597('0x1e')]=_0x4d6bff['cause-txt'];this[_0x3597('0x1f')]=_0x5964d7[_0x3597('0x1f')];this[_0x3597('0x20')]=_0x5964d7[_0x3597('0x20')];this[_0x3597('0x21')]=_0x5964d7[_0x3597('0x21')];this['recallme']=_0x5964d7[_0x3597('0x22')];this['ContactId']=_0x5964d7[_0x3597('0x23')];this[_0x3597('0x24')]=_0x5964d7[_0x3597('0x24')];this['UserId']=_0x5964d7[_0x3597('0x25')];this[_0x3597('0x26')]=_0x5964d7[_0x3597('0x26')];this['CampaignId']=_0x5964d7[_0x3597('0x27')];}module[_0x3597('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 3485b0c..76bba66 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76bf=['exports','lodash','moment','milliseconds','diff','seconds','uniqueid','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x5b545a,_0x47d93a){var _0x426aae=function(_0x1d6d9b){while(--_0x1d6d9b){_0x5b545a['push'](_0x5b545a['shift']());}};_0x426aae(++_0x47d93a);}(_0x76bf,0x169));var _0xf76b=function(_0x1acea6,_0x3378f7){_0x1acea6=_0x1acea6-0x0;var _0x2f74bb=_0x76bf[_0x1acea6];return _0x2f74bb;};'use strict';var util=require('util');var _=require(_0xf76b('0x0'));var moment=require(_0xf76b('0x1'));function getSeconds(_0x31be63,_0x12fcbd){var _0x41eae3=moment(_0x31be63)['milliseconds'](0x0);var _0x4d1e5f=moment(_0x12fcbd)[_0xf76b('0x2')](0x0);return _0x41eae3[_0xf76b('0x3')](_0x4d1e5f,_0xf76b('0x4'));}function History(_0x390d34){this[_0xf76b('0x5')]=_0x390d34[_0xf76b('0x5')];this['scheduledat']=_0x390d34['scheduledat']||undefined;this[_0xf76b('0x6')]=_0x390d34[_0xf76b('0x6')];this[_0xf76b('0x7')]=_0x390d34[_0xf76b('0x6')]==='outbound'?_0xf76b('0x8'):_0x390d34[_0xf76b('0x6')];this[_0xf76b('0x9')]=_0x390d34[_0xf76b('0x9')];this['countcongestionretry']=_0x390d34[_0xf76b('0xa')];this[_0xf76b('0xb')]=_0x390d34[_0xf76b('0xb')];this[_0xf76b('0xc')]=_0x390d34[_0xf76b('0x9')]+_0x390d34[_0xf76b('0xa')]+_0x390d34[_0xf76b('0xb')]+_0x390d34[_0xf76b('0xd')]+_0x390d34['countdropretry']+_0x390d34[_0xf76b('0xe')]+_0x390d34[_0xf76b('0xf')]+_0x390d34[_0xf76b('0x10')];this[_0xf76b('0xd')]=_0x390d34['countnosuchnumberretry'];this['countdropretry']=_0x390d34[_0xf76b('0x11')];this['countabandonedretry']=_0x390d34[_0xf76b('0xe')];this[_0xf76b('0xf')]=_0x390d34[_0xf76b('0xf')];this[_0xf76b('0x10')]=_0x390d34[_0xf76b('0x10')];this[_0xf76b('0x8')]=_0x390d34[_0xf76b('0x8')];this[_0xf76b('0x12')]=_0x390d34['name'];this['calleridnum']=_0x390d34['number'];this[_0xf76b('0x13')]=_0x390d34[_0xf76b('0x13')];this['responsetime']=_0x390d34[_0xf76b('0x14')];this[_0xf76b('0x15')]=_0x390d34[_0xf76b('0x14')];this[_0xf76b('0x16')]=getSeconds(_0x390d34[_0xf76b('0x14')],_0x390d34[_0xf76b('0x13')]);this[_0xf76b('0x17')]=0x0;this[_0xf76b('0x18')]=0x0;this[_0xf76b('0x19')]=_0x390d34['callback'];this[_0xf76b('0x1a')]=_0x390d34['callbackuniqueid'];this[_0xf76b('0x1b')]=_0x390d34[_0xf76b('0x1b')];this[_0xf76b('0x1c')]=_0x390d34['recallme'];this[_0xf76b('0x1d')]=_0x390d34[_0xf76b('0x1d')];this['ListId']=_0x390d34['ListId'];this['UserId']=_0x390d34[_0xf76b('0x1e')];this[_0xf76b('0x1f')]=_0x390d34[_0xf76b('0x1f')];this[_0xf76b('0x20')]=_0x390d34[_0xf76b('0x20')];this[_0xf76b('0x21')]=_0x390d34['originatecalleridnum']||'';this[_0xf76b('0x22')]=_0x390d34[_0xf76b('0x22')]||'';}module[_0xf76b('0x23')]=History; \ No newline at end of file +var _0xfe08=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xfe08,0xeb));var _0x8fe0=function(_0x4b13ee,_0x587562){_0x4b13ee=_0x4b13ee-0x0;var _0x190d07=_0xfe08[_0x4b13ee];return _0x190d07;};'use strict';var util=require('util');var _=require(_0x8fe0('0x0'));var moment=require('moment');function getSeconds(_0x6c7708,_0x17bc06){var _0x263db1=moment(_0x6c7708)[_0x8fe0('0x1')](0x0);var _0x20034e=moment(_0x17bc06)['milliseconds'](0x0);return _0x263db1['diff'](_0x20034e,_0x8fe0('0x2'));}function History(_0x1d4bd7){this[_0x8fe0('0x3')]=_0x1d4bd7[_0x8fe0('0x3')];this[_0x8fe0('0x4')]=_0x1d4bd7[_0x8fe0('0x4')]||undefined;this['type']=_0x1d4bd7[_0x8fe0('0x5')];this[_0x8fe0('0x6')]=_0x1d4bd7[_0x8fe0('0x5')]==='outbound'?_0x8fe0('0x7'):_0x1d4bd7[_0x8fe0('0x5')];this['countbusyretry']=_0x1d4bd7['countbusyretry'];this['countcongestionretry']=_0x1d4bd7[_0x8fe0('0x8')];this[_0x8fe0('0x9')]=_0x1d4bd7[_0x8fe0('0x9')];this[_0x8fe0('0xa')]=_0x1d4bd7[_0x8fe0('0xb')]+_0x1d4bd7[_0x8fe0('0x8')]+_0x1d4bd7[_0x8fe0('0x9')]+_0x1d4bd7['countnosuchnumberretry']+_0x1d4bd7[_0x8fe0('0xc')]+_0x1d4bd7[_0x8fe0('0xd')]+_0x1d4bd7[_0x8fe0('0xe')]+_0x1d4bd7[_0x8fe0('0xf')];this[_0x8fe0('0x10')]=_0x1d4bd7[_0x8fe0('0x10')];this['countdropretry']=_0x1d4bd7[_0x8fe0('0xc')];this['countabandonedretry']=_0x1d4bd7['countabandonedretry'];this[_0x8fe0('0xe')]=_0x1d4bd7[_0x8fe0('0xe')];this[_0x8fe0('0xf')]=_0x1d4bd7[_0x8fe0('0xf')];this[_0x8fe0('0x7')]=_0x1d4bd7['queue'];this[_0x8fe0('0x11')]=_0x1d4bd7[_0x8fe0('0x12')];this[_0x8fe0('0x13')]=_0x1d4bd7[_0x8fe0('0x14')];this[_0x8fe0('0x15')]=_0x1d4bd7['starttime'];this[_0x8fe0('0x16')]=_0x1d4bd7[_0x8fe0('0x16')];this['endtime']=_0x1d4bd7[_0x8fe0('0x16')];this[_0x8fe0('0x17')]=getSeconds(_0x1d4bd7[_0x8fe0('0x16')],_0x1d4bd7[_0x8fe0('0x15')]);this['holdtime']=0x0;this[_0x8fe0('0x18')]=0x0;this[_0x8fe0('0x19')]=_0x1d4bd7[_0x8fe0('0x19')];this[_0x8fe0('0x1a')]=_0x1d4bd7[_0x8fe0('0x1a')];this[_0x8fe0('0x1b')]=_0x1d4bd7[_0x8fe0('0x1b')];this[_0x8fe0('0x1c')]=_0x1d4bd7[_0x8fe0('0x1c')];this['ContactId']=_0x1d4bd7[_0x8fe0('0x1d')];this['ListId']=_0x1d4bd7[_0x8fe0('0x1e')];this[_0x8fe0('0x1f')]=_0x1d4bd7[_0x8fe0('0x1f')];this['VoiceQueueId']=_0x1d4bd7[_0x8fe0('0x20')];this[_0x8fe0('0x21')]=_0x1d4bd7[_0x8fe0('0x21')];this[_0x8fe0('0x22')]=_0x1d4bd7[_0x8fe0('0x22')]||'';this[_0x8fe0('0x23')]=_0x1d4bd7[_0x8fe0('0x23')]||'';}module[_0x8fe0('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index b6131a0..1b85941 100644 --- a/server/services/ami/dialer/index.js +++ b/server/services/ami/dialer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3676=['XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','Contact','createdAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','checkRetriveMax','countnoanswerretry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','checkContactBlack','recallme','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','dialLimitQueue','reachable','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','Contact.phone','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','--------\x20Drop\x20Rate\x20--------','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','enqueue','tail','finally','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','stringify','milliseconds','diff','emit','outbound','strategy','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','voice:queue:%s','voice_queue:save','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','seconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','prototype','clearZombieChannels','uniqueId','[uniqueid]','actions','[actions]','undefined','isNil','status','channel','catch','No\x20such\x20channel','ivr','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','resolve','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','unmonitored','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','voiceQueues','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','ContactId','CampaignId','[rescheduleContact][Machine]','reason19\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','[syncHangupIvr]','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','locked','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','paused','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','Action','command','iftime\x20%s,%s','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialTimezone','syncCampaigns','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0x3676,0x95));var _0x6367=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0x3676[_0x17a32f];return _0x15a293;};'use strict';var util=require(_0x6367('0x0'));var _=require(_0x6367('0x1'));var BPromise=require(_0x6367('0x2'));var uuid=require(_0x6367('0x3'));var moment=require(_0x6367('0x4'));var rr=require('rr');var md5=require(_0x6367('0x5'));var Redis=require(_0x6367('0x6'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x6367('0x7'))(_0x6367('0x8'));var loggerBooked=require('../../../config/logger')(_0x6367('0x9'));var loggerPredictive=require(_0x6367('0x7'))(_0x6367('0xa'));var loggerPredictiveCalls=require(_0x6367('0x7'))(_0x6367('0xb'));var loggerSyncQueueSummary=require(_0x6367('0x7'))(_0x6367('0xc'));var ami=require(_0x6367('0xd'));config[_0x6367('0xe')]=_[_0x6367('0xf')](config[_0x6367('0xe')],{'host':_0x6367('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6367('0xe')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x6367('0x11'));var cmHopperBlack=require(_0x6367('0x12'));var voiceQueueRt=require(_0x6367('0x13'));var RpcSetting=require(_0x6367('0x14'));var Action=require(_0x6367('0x15'));var History=require(_0x6367('0x16'));var Final=require(_0x6367('0x17'));var AgentComplete=require(_0x6367('0x18'));var QueueCallerAbandon=require(_0x6367('0x19'));var Hangup=require(_0x6367('0x1a'));var ipAgi=process[_0x6367('0x1b')]['XCALLY_IP_AGI']||_0x6367('0x1c');var strategy={'rrmemory':_0x6367('0x1d'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x6367('0x1e')]=function(_0x18bd9a){this['tail']=this[_0x6367('0x1f')]?this[_0x6367('0x1f')][_0x6367('0x20')](_0x18bd9a):_0x18bd9a();};function Dialer(_0x322ea7,_0x1f9d65){this[_0x6367('0x21')]=new Sequence();this[_0x6367('0x22')]=_0x1f9d65;this['voiceQueues']=_0x322ea7['voiceQueues'];this[_0x6367('0x23')]=_0x322ea7[_0x6367('0x23')];this[_0x6367('0x24')]=_0x322ea7[_0x6367('0x24')];this[_0x6367('0x25')]=_0x322ea7[_0x6367('0x25')];this[_0x6367('0x26')]=config[_0x6367('0x26')]||0x2;this[_0x6367('0x27')]={};this['actions']={};this[_0x6367('0x28')]={};this['uniqueId']={};this['optionPredictive']={};this[_0x6367('0x29')]={};this['startProgressive']={};this[_0x6367('0x2a')]={};this[_0x6367('0x2b')]={};this[_0x6367('0x2c')]={};ami['on'](_0x6367('0x2d'),this[_0x6367('0x2e')][_0x6367('0x2f')](this));ami['on'](_0x6367('0x30'),this['syncQueueCallerAbandon'][_0x6367('0x2f')](this));ami['on']('originateresponse',this[_0x6367('0x31')]['bind'](this));ami['on']('agentcomplete',this[_0x6367('0x32')]['bind'](this));ami['on'](_0x6367('0x33'),this[_0x6367('0xc')]['bind'](this));ami['on']('hangup',this[_0x6367('0x34')][_0x6367('0x2f')](this));ami['on'](_0x6367('0x35'),this[_0x6367('0x36')]['bind'](this));ami['on']('varset',this[_0x6367('0x37')][_0x6367('0x2f')](this));ami['on'](_0x6367('0x38'),this[_0x6367('0x39')][_0x6367('0x2f')](this));ami['on'](_0x6367('0x3a'),this[_0x6367('0x3b')][_0x6367('0x2f')](this));this[_0x6367('0x3c')]();this[_0x6367('0x3d')]();RpcSetting[_0x6367('0x3e')]()[_0x6367('0x3f')](function(_0x581c4a){previewRecallmeReminderInterval=_0x581c4a[_0x6367('0x40')];});}function isNotNull(_0x5d51ce){return _0x5d51ce!==null&&!_[_0x6367('0x41')](_0x5d51ce);}function checkIsLoggedIn(_0x465970,_0x3d7e45){return function(){if(_0x3d7e45<=0x0){_0x465970[_0x6367('0x42')]='AGENTS_NOT_LOGGED';throw _0x465970[_0x6367('0x43')]+_0x6367('0x44');}};}function isActive(_0x2876a4){return _0x2876a4;}function checkIsActive(_0x127e13,_0x4bec9a){return function(){if(!isActive(_0x4bec9a)){_0x127e13['message']=_0x6367('0x45');throw _0x127e13[_0x6367('0x43')]+_0x6367('0x46');}};}function checkInterval(_0x42b684){return function(){if(!isNotNull(_0x42b684[_0x6367('0x47')])){_0x42b684[_0x6367('0x42')]=_0x6367('0x48');throw _0x42b684[_0x6367('0x43')]+_0x6367('0x49');}if(!isNotNull(_0x42b684[_0x6367('0x47')][_0x6367('0x4a')])){_0x42b684['message']=_0x6367('0x48');throw _0x42b684[_0x6367('0x43')]+_0x6367('0x49');}if(!isNotNull(_[_0x6367('0x4b')](_0x42b684[_0x6367('0x47')]['Intervals']))){_0x42b684[_0x6367('0x42')]=_0x6367('0x48');throw _0x42b684[_0x6367('0x43')]+_0x6367('0x49');}};}function msgResponse(_0x568303,_0x18054d,_0x2a65b4){return{'action':_0x568303,'response':_0x18054d,'message':_0x2a65b4,'stack':_0x2a65b4};}function myreject(_0x1e4085){return function(_0x4d5833){return _0x1e4085(msgResponse('[ifTime][Action]',_0x6367('0x4c'),JSON[_0x6367('0x4d')](_0x4d5833)));};}function getSeconds(_0x12e18e,_0x2f79ce){var _0x96e2b8=moment(_0x12e18e)[_0x6367('0x4e')](0x0);var _0x233baf=moment(_0x2f79ce)[_0x6367('0x4e')](0x0);return _0x96e2b8[_0x6367('0x4f')](_0x233baf,'seconds');}function emit(_0x93d4bf,_0x1b6d5c,_0x19ec98){io['to'](_0x93d4bf)[_0x6367('0x50')](_0x1b6d5c,_0x19ec98);}function emitVoiceQueueSummary(_0x7e7222){if(_0x7e7222['type']===_0x6367('0x51')){var _0x169ff3={'id':_0x7e7222['id'],'name':_0x7e7222['name'],'strategy':_0x7e7222[_0x6367('0x52')],'answered':_0x7e7222['answered'],'available':_0x7e7222[_0x6367('0x53')],'loggedIn':_0x7e7222['loggedIn'],'pTalking':_0x7e7222[_0x6367('0x54')],'sumBillable':_0x7e7222[_0x6367('0x55')],'sumDuration':_0x7e7222[_0x6367('0x56')],'sumHoldTime':_0x7e7222[_0x6367('0x57')]||0x0,'talking':_0x7e7222[_0x6367('0x58')],'total':_0x7e7222[_0x6367('0x59')],'type':_0x7e7222[_0x6367('0x5a')],'unmanaged':_0x7e7222['unmanaged'],'abandoned':_0x7e7222[_0x6367('0x5b')],'waiting':_0x7e7222[_0x6367('0x5c')],'loggedInDb':_0x7e7222[_0x6367('0x5d')],'dialActive':_0x7e7222[_0x6367('0x5e')],'dialMethod':_0x7e7222[_0x6367('0x5f')],'dialOriginateCallerIdName':_0x7e7222[_0x6367('0x60')],'dialOriginateCallerIdNumber':_0x7e7222[_0x6367('0x61')],'dialOriginateTimeout':_0x7e7222[_0x6367('0x62')],'dialPrefix':_0x7e7222['dialPrefix'],'outboundAnswerAgiCallsDay':_0x7e7222['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x7e7222[_0x6367('0x63')],'outboundBlacklistCallsDay':_0x7e7222[_0x6367('0x64')],'outboundBusyCallsDay':_0x7e7222[_0x6367('0x65')],'outboundCongestionCallsDay':_0x7e7222[_0x6367('0x66')],'outboundDropCallsDayACS':_0x7e7222[_0x6367('0x67')],'outboundDropCallsDayCallersExit':_0x7e7222[_0x6367('0x68')],'outboundDropCallsDayTimeout':_0x7e7222[_0x6367('0x69')],'outboundNoAnswerCallsDay':_0x7e7222[_0x6367('0x6a')],'outboundNoSuchCallsDay':_0x7e7222[_0x6367('0x6b')],'outboundOriginateFailureCallsDay':_0x7e7222[_0x6367('0x6c')],'outboundReCallsDay':_0x7e7222[_0x6367('0x6d')],'outboundRejectCallsDay':_0x7e7222[_0x6367('0x6e')],'outboundUnknownCallsDay':_0x7e7222[_0x6367('0x6f')],'predictiveIntervalAnsweredCalls':_0x7e7222[_0x6367('0x70')],'predictiveIntervalAvgHoldtime':_0x7e7222[_0x6367('0x71')],'predictiveIntervalAvgTalktime':_0x7e7222['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x7e7222['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x7e7222[_0x6367('0x72')],'predictiveIntervalErlangCalls':_0x7e7222[_0x6367('0x73')],'predictiveIntervalErlangCallsDroppedCalls':_0x7e7222['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x7e7222[_0x6367('0x74')],'predictiveIntervalMultiplicativeFactor':_0x7e7222[_0x6367('0x75')],'predictiveIntervalPauses':_0x7e7222[_0x6367('0x76')],'predictiveIntervalAvailable':_0x7e7222[_0x6367('0x77')],'predictiveIntervalTotalCalls':_0x7e7222[_0x6367('0x78')],'message':_0x7e7222[_0x6367('0x42')],'originated':_0x7e7222[_0x6367('0x79')],'erlangCalls':_0x7e7222[_0x6367('0x7a')],'erlangCallToSecond':_0x7e7222[_0x6367('0x7b')],'erlangAbandonmentRate':_0x7e7222[_0x6367('0x7c')],'erlangBusyFactor':_0x7e7222[_0x6367('0x7d')],'startPredictive':_0x7e7222['startPredictive'],'startProgressive':_0x7e7222[_0x6367('0x7e')]};if(_0x7e7222[_0x6367('0x7f')]){_0x169ff3[_0x6367('0x7f')]={'id':_0x7e7222['Trunk']['id'],'name':_0x7e7222['Trunk'][_0x6367('0x43')],'active':_0x7e7222[_0x6367('0x7f')][_0x6367('0x80')],'callerid':_0x7e7222[_0x6367('0x7f')]['callerid']};}if(_0x7e7222[_0x6367('0x47')]){_0x169ff3['Interval']={'id':_0x7e7222[_0x6367('0x47')]['id'],'name':_0x7e7222[_0x6367('0x47')][_0x6367('0x43')]};}var _0xdc6603=md5(JSON[_0x6367('0x4d')](_0x169ff3));if(_0x7e7222['md5']!==_0xdc6603){_0x7e7222['md5']=_0xdc6603;emit(util['format'](_0x6367('0x81'),_0x169ff3['name']),_0x6367('0x82'),_0x169ff3);}}}function emitCampaignSummary(_0x3c7aa2){if(_0x3c7aa2[_0x6367('0x5a')]==='ivr'){emit(util[_0x6367('0x83')](_0x6367('0x84'),_0x3c7aa2['name']),_0x6367('0x85'),_0x3c7aa2);}}function checkGetDataPredictive(_0x2c52f9){if(isNotNull(_0x2c52f9)&&!_['isEmpty'](_0x2c52f9)){loggerPredictive[_0x6367('0x86')](_0x6367('0x87'));loggerPredictive['info'](_0x6367('0x88'),_0x2c52f9[_0x6367('0x78')]);loggerPredictive[_0x6367('0x86')](_0x6367('0x89'),_0x2c52f9[_0x6367('0x70')]);loggerPredictive[_0x6367('0x86')](_0x6367('0x8a'),_0x2c52f9[_0x6367('0x72')]);loggerPredictive[_0x6367('0x86')](_0x6367('0x8b'),_0x2c52f9[_0x6367('0x8c')]);loggerPredictive[_0x6367('0x86')](_0x6367('0x8d'),_0x2c52f9[_0x6367('0x71')]);loggerPredictive[_0x6367('0x86')](_0x6367('0x8e'),_0x2c52f9['predictiveIntervalAvgTalktime']);loggerPredictive[_0x6367('0x86')](_0x6367('0x8f'));if(_0x2c52f9[_0x6367('0x78')]>0x0){if(!_['isUndefined'](_0x2c52f9[_0x6367('0x90')])&&_0x2c52f9['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x6367('0x86')](_0x6367('0x91'));if(!_[_0x6367('0x41')](_0x2c52f9[_0x6367('0x71')])&&_0x2c52f9[_0x6367('0x71')]>0x0){return!![];}loggerPredictive[_0x6367('0x86')](_0x6367('0x92'));}else{loggerPredictive[_0x6367('0x86')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x6367('0x86')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x449012){return function(_0x36e65e){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36e65e[_0x6367('0x7a')]);loggerPredictive[_0x6367('0x86')](_0x6367('0x93'),_0x36e65e[_0x6367('0x7b')]);loggerPredictive['info'](_0x6367('0x94'),_0x36e65e[_0x6367('0x7c')]);loggerPredictive[_0x6367('0x86')](_0x6367('0x95'),_0x36e65e[_0x6367('0x7d')]);loggerPredictive[_0x6367('0x86')](_0x6367('0x94'),_0x36e65e[_0x6367('0x7c')]);loggerPredictive['info'](_0x6367('0x8f'));_[_0x6367('0x96')](_0x449012,_0x36e65e);};}function getDiff(_0x48d288){var _0x8cfb3b=moment()[_0x6367('0x4e')](0x0);var _0x589739=moment(_0x48d288)['milliseconds'](0x0);return _0x8cfb3b[_0x6367('0x4f')](_0x589739,_0x6367('0x97'));}function ifInterval(_0x58d4ba,_0x3249f9){if(_[_0x6367('0x41')](_0x3249f9)){return![];}return getDiff(_0x3249f9)<_0x58d4ba*0x3c;}function freeVariablesPredictive(_0x5f4a57){if(isNotNull(_0x5f4a57)){if(!_[_0x6367('0x41')](_0x5f4a57[_0x6367('0x7e')])){_0x5f4a57[_0x6367('0x7e')]=undefined;loggerPredictive['info'](_0x5f4a57[_0x6367('0x43')],_0x6367('0x98'));}if(!_['isUndefined'](_0x5f4a57[_0x6367('0x29')])){_0x5f4a57[_0x6367('0x29')]=undefined;loggerPredictive[_0x6367('0x86')](_0x5f4a57[_0x6367('0x43')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x6367('0x41')](_0x5f4a57[_0x6367('0x99')])){clearInterval(_0x5f4a57[_0x6367('0x99')]);_0x5f4a57['handlePredictive']=undefined;loggerPredictive['info'](_0x5f4a57[_0x6367('0x43')],_0x6367('0x9a'));}}}function erlangb(_0x4fe485,_0x2469ef){if(_0x2469ef===0x0){return 0x0;}var _0x114aca=0x1;for(var _0xd0d661=0x1;_0xd0d661<=_0x2469ef;_0xd0d661+=0x1){_0x114aca=0x1+_0x114aca*_0xd0d661/_0x4fe485;}return 0x1/_0x114aca;}function isVoiceQueueOutbound(_0x5eb61c){return _0x5eb61c==='outbound';}function isNotPreview(_0x223009){return _0x223009!==_0x6367('0x22');}function isCampaignIvr(_0x13e549){return _0x13e549==='ivr';}function getCallerId(_0x581f0f,_0x3abc32,_0x545730){if(!_[_0x6367('0x41')](_0x545730)&&typeof _0x545730===_0x6367('0x9b')&&!_[_0x6367('0x4b')](_0x545730)){if(!_[_0x6367('0x41')](_0x3abc32)&&typeof _0x3abc32===_0x6367('0x9b')&&!_[_0x6367('0x4b')](_0x3abc32)){return util[_0x6367('0x83')](_0x6367('0x9c'),_0x3abc32,_0x545730);}return util[_0x6367('0x83')](_0x6367('0x9c'),_0x545730,_0x545730);}if(!_[_0x6367('0x41')](_0x581f0f)&&typeof _0x581f0f===_0x6367('0x9b')&&!_['isEmpty'](_0x581f0f)){return _0x581f0f;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x3b72b2,_0x4811ac){return function(_0x55e80c){freeVariablesPredictive(_0x4811ac);emitVoiceQueueSummary(_0x4811ac);emitCampaignSummary(_0x4811ac);loggerSyncQueueSummary[_0x6367('0x9d')](_0x3b72b2,util[_0x6367('0x9e')](_0x55e80c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x27553a,_0x439b7a){return function(_0x15bf08){loggerPredictive['error'](_0x439b7a[_0x6367('0x43')],_0x27553a);loggerPredictive[_0x6367('0x9d')](_0x15bf08[_0x6367('0x9f')]);freeVariablesPredictive(_0x439b7a);};}function loggerCatch(_0x2a64bd){return function(_0x25c80e){logger['error'](_0x2a64bd,util[_0x6367('0x9e')](_0x25c80e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x235398){return _0x235398&&!_[_0x6367('0x41')](_0x235398)&&_0x235398['length']>0x0;}function decremetOriginate(_0x5d2b28){if(!_['isUndefined'](_0x5d2b28)&&_0x5d2b28!==null){if(typeof _0x5d2b28['originated']!=='undefined'){if(_0x5d2b28[_0x6367('0x79')]>0x0){_0x5d2b28[_0x6367('0x79')]-=0x1;}else{logger[_0x6367('0x9d')](_0x6367('0xa0'));}}}else{logger[_0x6367('0x9d')](_0x6367('0xa1'));}}function checkContactLowerLimitOriginate(_0x80f02c,_0x1bbae3,_0x27db6a){if(_0x1bbae3>_0x27db6a){for(var _0x5ab874=0x0;_0x5ab874<_0x1bbae3-_0x27db6a;_0x5ab874+=0x1){decremetOriginate(_0x80f02c);}}}function loggerGetContactDialer(_0x34e937,_0x22a638,_0x4ddcef){return function(_0x1d38f9){checkContactLowerLimitOriginate(_0x22a638,_0x4ddcef,0x0);logger[_0x6367('0x9d')](_0x34e937,util[_0x6367('0x9e')](_0x1d38f9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5ae72f){return function(_0x5e4596){if(isNotNull(_0x5e4596)&&isNotNull(_0x5e4596[0x0])){if(_0x5e4596[0x0]['contactsRescheduled']>0x0){_0x5ae72f['message']=_0x6367('0xa2');logger[_0x6367('0x86')]('[getContactDialer2][ReScheduled]'+_0x5ae72f[_0x6367('0x43')],_0x5e4596[0x0][_0x6367('0xa3')],'contacts');}else{_0x5ae72f[_0x6367('0x42')]=_0x6367('0xa4');logger['info'](_0x6367('0xa5')+_0x5ae72f[_0x6367('0x43')]);}}};}function notSendMessagesQueue(_0x1de90b){if(_0x1de90b[_0x6367('0xa6')]){freeVariablesPredictive(_0x1de90b);if(_0x1de90b[_0x6367('0x79')]===0x0&&_0x1de90b[_0x6367('0x58')]===0x0&&_0x1de90b[_0x6367('0x5c')]===0x0&&(_0x1de90b['pTalking']||0x0)===0x0){_0x1de90b[_0x6367('0xa6')]=![];_0x1de90b[_0x6367('0x53')]=0x0;_0x1de90b[_0x6367('0x42')]=_0x6367('0x45');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1de90b[_0x6367('0x43')],_0x6367('0xa7'));}else{_0x1de90b[_0x6367('0x42')]=_0x6367('0xa8');loggerSyncQueueSummary[_0x6367('0x9d')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1de90b[_0x6367('0x43')],_0x6367('0xa9'));}emitVoiceQueueSummary(_0x1de90b);}}function notSendMessagesCampaign(_0x73f768){if(_0x73f768['sendMessageOneNotActive']){if(_0x73f768[_0x6367('0x79')]===0x0){_0x73f768['sendMessageOneNotActive']=![];_0x73f768['message']='NOT_ACTIVE';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x73f768['name'],_0x6367('0xa7'));}else{_0x73f768[_0x6367('0x42')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x6367('0xaa'),_0x73f768[_0x6367('0x43')],_0x6367('0xa9'));}emitCampaignSummary(_0x73f768);}}function createObjHistory(_0x2b0fe6,_0x3595e1,_0x30a3f7,_0x38ac84,_0x30466c){_0x2b0fe6[_0x6367('0x42')]=_0x30a3f7;var _0x2e8da0=new Action(_0x2b0fe6,_0x3595e1);var _0x255cb2=new History(_0x2e8da0);_0x255cb2[_0x6367('0xab')]=_0x38ac84;_0x255cb2[_0x6367('0xac')]=_0x30466c;_0x255cb2[_0x6367('0xad')]=_0x2e8da0[_0x6367('0xae')];return _0x255cb2;}Dialer[_0x6367('0xaf')][_0x6367('0x3d')]=function(){var _0x5cfa54=this;setInterval(function(){_0x5cfa54[_0x6367('0xb0')](_0x5cfa54[_0x6367('0xb1')],_0x6367('0xb2'));_0x5cfa54[_0x6367('0xb0')](_0x5cfa54[_0x6367('0xb3')],_0x6367('0xb4'));},0x32c8);};Dialer[_0x6367('0xaf')][_0x6367('0xb0')]=function(_0x11d324,_0x3fbc0c){var _0x53bfe1=this;for(var _0x2197cd in _0x11d324){if(typeof _0x11d324[_0x2197cd]!==_0x6367('0xb5')){this[_0x6367('0x21')][_0x6367('0x1e')](function(){if(!_[_0x6367('0xb6')](_0x11d324[_0x2197cd])){return ami['Action']({'action':_0x6367('0xb7'),'channel':_0x11d324[_0x2197cd][_0x6367('0xb8')]})[_0x6367('0xb9')](function(_0x58885e){if(_0x58885e['message']===_0x6367('0xba')){setTimeout(function(){if(_0x11d324[_0x2197cd]&&_0x11d324[_0x2197cd][_0x6367('0x5a')]!==_0x6367('0xbb')){_0x53bfe1[_0x6367('0xbc')](_0x53bfe1['voiceQueues'][_0x11d324[_0x2197cd][_0x6367('0xbd')]]);logger[_0x6367('0x9d')](_0x6367('0xbe'),_0x3fbc0c,_0x2197cd,_0x11d324[_0x2197cd][_0x6367('0xbd')]);delete _0x11d324[_0x2197cd];}if(_0x11d324[_0x2197cd]&&_0x11d324[_0x2197cd]['type']===_0x6367('0xbb')){_0x53bfe1[_0x6367('0xbc')](_0x53bfe1[_0x6367('0x23')][_0x11d324[_0x2197cd][_0x6367('0xbd')]]);logger[_0x6367('0x9d')](_0x6367('0xbf'),_0x3fbc0c,_0x2197cd,_0x11d324[_0x2197cd][_0x6367('0xbd')]);delete _0x11d324[_0x2197cd];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x2fb512){return BPromise['resolve']()[_0x6367('0x3f')](cmHopper[_0x6367('0xc0')](_0x2fb512))[_0x6367('0xb9')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x6367('0xaf')][_0x6367('0xc1')]=function(_0x3115d4){return BPromise['resolve']()[_0x6367('0x3f')](cmHopperBlack[_0x6367('0xc1')](_0x3115d4))[_0x6367('0xb9')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x6367('0xaf')][_0x6367('0xc2')]=function(_0x53db0c){return BPromise['resolve']()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x53db0c))[_0x6367('0xb9')](loggerCatch(_0x6367('0xc3')));};Dialer[_0x6367('0xaf')]['averageHandleTime']=function(_0x307956){return BPromise[_0x6367('0xc4')]()[_0x6367('0x3f')](cmHopperHistory[_0x6367('0xc5')](_0x307956))[_0x6367('0xb9')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x6367('0xaf')][_0x6367('0xc6')]=function(_0x433b72){return BPromise[_0x6367('0xc4')]()['then'](cmHopper['rescheduleContact'](_0x433b72))[_0x6367('0xb9')](loggerCatch(_0x6367('0xc7')));};Dialer['prototype'][_0x6367('0xc8')]=function(_0x395580,_0x33ba49,_0xbb3eb1){return BPromise['resolve']()['then'](cmHopper[_0x6367('0xc8')](_0x395580,_0x33ba49,_0xbb3eb1))[_0x6367('0xb9')](loggerCatch(_0x6367('0xc9')));};Dialer[_0x6367('0xaf')][_0x6367('0xca')]=function(_0x35543b,_0xe4c3d3,_0x52f60a,_0x324703,_0x351c23){return BPromise[_0x6367('0xc4')]()[_0x6367('0x3f')](cmHopper['getContactDialer'](_0x35543b,_0xe4c3d3,_0x52f60a,_0x324703))[_0x6367('0xb9')](function(_0x552593){_0x351c23[_0x6367('0xcb')]-=_0x52f60a;_0x351c23[_0x6367('0xcb')]=_0x351c23['temp']>0x0?_0x351c23[_0x6367('0xcb')]:0x0;loggerCatch(_0x6367('0xcc'))(_0x552593);});};Dialer['prototype'][_0x6367('0xcd')]=function(_0x26a00f,_0x567ee3,_0x36cc43,_0x595bf3){return BPromise['resolve']()[_0x6367('0x3f')](cmHopper[_0x6367('0xcd')](_0x26a00f,_0x567ee3,_0x36cc43))['catch'](function(_0x410f7c){_0x595bf3[_0x6367('0xcb')]-=_0x567ee3;_0x595bf3['temp']=_0x595bf3[_0x6367('0xcb')]>0x0?_0x595bf3[_0x6367('0xcb')]:0x0;loggerCatch(_0x6367('0xce'))(_0x410f7c);});};Dialer[_0x6367('0xaf')][_0x6367('0xcf')]=function(_0xcc8c3d){return BPromise[_0x6367('0xc4')]()[_0x6367('0x3f')](voiceQueueRt[_0x6367('0xcf')](_0xcc8c3d))[_0x6367('0xb9')](loggerCatch(_0x6367('0xd0')));};Dialer[_0x6367('0xaf')][_0x6367('0xd1')]=function(_0x90b36a){return BPromise[_0x6367('0xc4')]()[_0x6367('0x3f')](cmHopper[_0x6367('0xd1')](_0x90b36a))[_0x6367('0xb9')](loggerCatch(_0x6367('0xd2')));};Dialer[_0x6367('0xaf')][_0x6367('0xd3')]=function(_0x11e729){return BPromise[_0x6367('0xc4')]()['then'](cmHopperHistory[_0x6367('0xd3')](_0x11e729))[_0x6367('0xb9')](loggerCatch(_0x6367('0xd4')));};Dialer[_0x6367('0xaf')]['updateOriginated']=function(_0x6e0dee){if(!_['isUndefined'](_0x6e0dee)&&_0x6e0dee!==null){if(typeof _0x6e0dee[_0x6367('0x79')]!==_0x6367('0xb5')){if(_0x6e0dee['originated']>0x0){_0x6e0dee[_0x6367('0x79')]-=0x1;}else{logger[_0x6367('0x9d')](_0x6367('0xd5'));}}}else{logger[_0x6367('0x9d')](_0x6367('0xd6'));}};Dialer['prototype'][_0x6367('0xd7')]=function(_0x7eb2e6,_0x46ca0a){var _0xc3d6e2=this;return function(_0x42a23b){_0xc3d6e2[_0x6367('0xbc')](_0x46ca0a);logger[_0x6367('0x9d')](_0x7eb2e6,util[_0x6367('0x9e')](_0x42a23b,{'showHidden':![],'depth':null}));};};Dialer[_0x6367('0xaf')][_0x6367('0xd8')]=function(_0x105c88,_0x5cca9b,_0xe06534){var _0x3b4c2f={'state':0x19,'statedesc':_0x6367('0xd9')};this[_0x6367('0xbc')](_0x5cca9b);this['saveInDb'](_[_0x6367('0x96')](_0x3b4c2f,_[_0x6367('0xda')](_0xe06534,['ContactId',_0x6367('0xdb'),_0x6367('0xdc'),_0x6367('0xdd'),'CampaignId'])),_0x6367('0xde'),_0x6367('0xdf'));logger['error'](_0x105c88);};Dialer['prototype'][_0x6367('0xe0')]=function(_0x4cba91){return _0x4cba91==='Success';};Dialer[_0x6367('0xaf')][_0x6367('0xe1')]=function(_0xd032b8){return!_[_0x6367('0x41')](_0xd032b8)&&_0xd032b8&&!_[_0x6367('0x41')](_0xd032b8[_0x6367('0x43')])&&!_['isUndefined'](_0xd032b8[_0x6367('0x80')])&&_0xd032b8[_0x6367('0x80')]&&(this['trunks'][util[_0x6367('0x83')](_0x6367('0xe2'),_0xd032b8[_0x6367('0x43')])][_0x6367('0xb7')]==='reachable'||this[_0x6367('0x25')][util[_0x6367('0x83')](_0x6367('0xe2'),_0xd032b8[_0x6367('0x43')])][_0x6367('0xb7')]===_0x6367('0xe3'));};Dialer['prototype'][_0x6367('0xe4')]=function(_0x420303,_0x5b20b3,_0x4edcb4){this['createHistory'](_0x420303)[_0x6367('0xb9')](loggerCatch(_0x5b20b3));this[_0x6367('0xd1')](_0x420303)[_0x6367('0xb9')](loggerCatch(_0x4edcb4));};Dialer[_0x6367('0xaf')][_0x6367('0x37')]=function(_0x968bf3){var _0x53c47a=this[_0x6367('0xb1')][_0x968bf3[_0x6367('0xe5')]];var _0x59ac08;if(!_['isNil'](_0x968bf3)&&!_[_0x6367('0xb6')](_0x968bf3[_0x6367('0xe6')])&&!_[_0x6367('0xb6')](_0x968bf3[_0x6367('0xe6')][_0x6367('0xe7')])&&_0x968bf3[_0x6367('0xe8')]===_0x6367('0xe9')&&_0x53c47a){if(_0x53c47a[_0x6367('0x5a')]!==_0x6367('0xbb')&&this[_0x6367('0xea')][_0x53c47a[_0x6367('0xbd')]][_0x6367('0xeb')]&&_0x968bf3[_0x6367('0xec')]===_0x6367('0xed')){delete this[_0x6367('0xb1')][_0x968bf3['uniqueid']];this[_0x6367('0xbc')](this[_0x6367('0xea')][_0x53c47a[_0x6367('0xbd')]]);this[_0x6367('0xea')][_0x53c47a[_0x6367('0xbd')]][_0x6367('0x63')]+=0x1;this['voiceQueues'][_0x53c47a[_0x6367('0xbd')]][_0x6367('0xee')]+=0x1;_0x59ac08=new Hangup(_0x53c47a,_0x968bf3);_0x59ac08[_0x6367('0xab')]=0x12;_0x59ac08[_0x6367('0xac')]=_0x6367('0xef');_0x59ac08[_0x6367('0xf0')]=_0x6367('0xf1');ami[_0x6367('0x50')](_0x6367('0xf2'),ut[_0x6367('0xf3')](_0x59ac08,_0x6367('0xf4')));this['saveInDb'](_0x59ac08,_0x6367('0xf5'),_0x6367('0xf6'));}if(_0x53c47a['type']!==_0x6367('0xbb')&&this[_0x6367('0xea')][_0x53c47a['queue']][_0x6367('0xeb')]&&_0x968bf3[_0x6367('0xec')]===_0x6367('0xf7')){var _0xd5dcc=this;return new BPromise(function(_0x37bdce,_0x16ff6d){delete _0xd5dcc[_0x6367('0xb1')][_0x968bf3[_0x6367('0xe5')]];_0xd5dcc[_0x6367('0xbc')](_0xd5dcc['voiceQueues'][_0x53c47a['queue']]);_0xd5dcc['voiceQueues'][_0x53c47a[_0x6367('0xbd')]][_0x6367('0x63')]+=0x1;_0xd5dcc[_0x6367('0xea')][_0x53c47a[_0x6367('0xbd')]][_0x6367('0xee')]+=0x1;var _0x34a121=_0xd5dcc['voiceQueues'][_0x53c47a[_0x6367('0xbd')]];var _0x117fcb=new Hangup(_0x53c47a,_0x968bf3);_0x117fcb['state']=0x13;_0x117fcb['statedesc']=_0x6367('0xf8');_0x117fcb[_0x6367('0xf0')]=_0x6367('0xf1');_0x117fcb[_0x6367('0xf9')]+=0x1;_0x117fcb[_0x6367('0xfa')]+=0x1;_0x117fcb[_0x6367('0xf4')]=!![];ami['emit'](_0x6367('0xf2'),ut[_0x6367('0xf3')](_0x117fcb,'amd'));_0xd5dcc[_0x6367('0xd3')](_0x117fcb)[_0x6367('0xb9')](loggerCatch(_0x6367('0xfb')));if(_0x117fcb[_0x6367('0xfc')]+_0x117fcb[_0x6367('0xfd')]+_0x117fcb['countnoanswerretry']+_0x117fcb[_0x6367('0xfe')]+_0x117fcb[_0x6367('0xff')]+_0x117fcb['countabandonedretry']+_0x117fcb[_0x6367('0xf9')]+_0x117fcb[_0x6367('0x100')]>=_0x34a121[_0x6367('0x101')]){_0xd5dcc[_0x6367('0x102')](_0x117fcb,_0x37bdce,_0x16ff6d,'reason19\x20machine....');}else{if(_0x117fcb[_0x6367('0xf9')]>=_0x34a121[_0x6367('0x103')]){_0xd5dcc[_0x6367('0x104')](_0x117fcb,_0x37bdce,_0x16ff6d,_0x6367('0x105'));}else{_0xd5dcc[_0x6367('0xc6')]({'active':![],'countmachineretry':_0x117fcb[_0x6367('0xf9')],'scheduledat':moment()[_0x6367('0x106')](_0x34a121['dialMachineRetryFrequency'],_0x6367('0x107'))[_0x6367('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x117fcb[_0x6367('0x108')],'ListId':_0x117fcb[_0x6367('0xdb')],'VoiceQueueId':_0x117fcb['VoiceQueueId']||undefined,'CampaignId':_0x117fcb[_0x6367('0x109')]||undefined})['catch'](loggerCatch(_0x6367('0x10a')));_0x37bdce({'reschedule':0x1});}}});}if(_0x53c47a['type']===_0x6367('0xbb')&&this[_0x6367('0x23')][_0x53c47a[_0x6367('0xbd')]][_0x6367('0xeb')]&&_0x968bf3[_0x6367('0xec')]===_0x6367('0xed')){delete this[_0x6367('0xb1')][_0x968bf3['uniqueid']];this[_0x6367('0xbc')](this[_0x6367('0x23')][_0x53c47a['queue']]);_0x59ac08=new Hangup(_0x53c47a,_0x968bf3);_0x59ac08['state']=0x12;_0x59ac08[_0x6367('0xac')]=_0x6367('0xef');_0x59ac08[_0x6367('0xf0')]=_0x6367('0xf1');ami[_0x6367('0x50')](_0x6367('0xf2'),ut['buildObj'](_0x59ac08,_0x6367('0xf4')));this['saveInDb'](_0x59ac08,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x53c47a[_0x6367('0x5a')]===_0x6367('0xbb')&&this[_0x6367('0x23')][_0x53c47a[_0x6367('0xbd')]][_0x6367('0xeb')]&&_0x968bf3[_0x6367('0xec')]==='MACHINE'){var _0xd5dcc=this;return new BPromise(function(_0x9e372c,_0x454861){delete _0xd5dcc[_0x6367('0xb1')][_0x968bf3[_0x6367('0xe5')]];_0xd5dcc['updateOriginated'](_0xd5dcc['campaigns'][_0x53c47a[_0x6367('0xbd')]]);_0xd5dcc[_0x6367('0x23')][_0x53c47a[_0x6367('0xbd')]][_0x6367('0x63')]+=0x1;_0xd5dcc[_0x6367('0x23')][_0x53c47a[_0x6367('0xbd')]][_0x6367('0xee')]+=0x1;var _0x45cbac=_0xd5dcc['campaigns'][_0x53c47a[_0x6367('0xbd')]];var _0x5d3b7f=new Hangup(_0x53c47a,_0x968bf3);_0x5d3b7f[_0x6367('0xab')]=0x13;_0x5d3b7f[_0x6367('0xac')]=_0x6367('0xf8');_0x5d3b7f[_0x6367('0xf0')]=_0x6367('0xf1');_0x5d3b7f['countmachineretry']+=0x1;_0x5d3b7f[_0x6367('0xfa')]+=0x1;_0x5d3b7f[_0x6367('0xf4')]=!![];ami[_0x6367('0x50')](_0x6367('0xf2'),ut[_0x6367('0xf3')](_0x5d3b7f,'amd'));_0xd5dcc[_0x6367('0xd3')](_0x5d3b7f)[_0x6367('0xb9')](loggerCatch(_0x6367('0xfb')));if(_0x5d3b7f[_0x6367('0xfc')]+_0x5d3b7f[_0x6367('0xfd')]+_0x5d3b7f['countnoanswerretry']+_0x5d3b7f[_0x6367('0xfe')]+_0x5d3b7f['countdropretry']+_0x5d3b7f['countabandonedretry']+_0x5d3b7f[_0x6367('0xf9')]+_0x5d3b7f[_0x6367('0x100')]>=_0x45cbac['dialGlobalMaxRetry']){_0xd5dcc[_0x6367('0x102')](_0x5d3b7f,_0x9e372c,_0x454861,_0x6367('0x10b'));}else{if(_0x5d3b7f[_0x6367('0xf9')]>=_0x45cbac[_0x6367('0x103')]){_0xd5dcc[_0x6367('0x104')](_0x5d3b7f,_0x9e372c,_0x454861,_0x6367('0x105'));}else{_0xd5dcc[_0x6367('0xc6')]({'active':![],'countmachineretry':_0x5d3b7f[_0x6367('0xf9')],'scheduledat':moment()[_0x6367('0x106')](_0x45cbac[_0x6367('0x10c')],_0x6367('0x107'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5d3b7f['ContactId'],'ListId':_0x5d3b7f['ListId'],'VoiceQueueId':_0x5d3b7f['VoiceQueueId']||undefined,'CampaignId':_0x5d3b7f[_0x6367('0x109')]||undefined})[_0x6367('0xb9')](loggerCatch(_0x6367('0x10a')));_0x9e372c({'reschedule':0x1});}}});}}};Dialer[_0x6367('0xaf')][_0x6367('0x34')]=function(_0x504221){var _0x565c03=this['uniqueId'][_0x504221[_0x6367('0xe5')]];var _0x56828a=this;var _0x176e47;if(_0x565c03&&_0x565c03[_0x6367('0x5a')]===_0x6367('0xbb')){delete this['uniqueId'][_0x504221[_0x6367('0xe5')]];this['updateOriginated'](this[_0x6367('0x23')][_0x565c03[_0x6367('0xbd')]]);this['campaigns'][_0x565c03[_0x6367('0xbd')]][_0x6367('0x10d')]+=0x1;_0x176e47=new Hangup(_0x565c03,_0x504221);this['createHistory'](_0x176e47)[_0x6367('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6367('0xd1')](_0x176e47)[_0x6367('0xb9')](loggerCatch('[syncHangupIvr]'));}if(_0x565c03&&_0x565c03[_0x6367('0x5a')]!==_0x6367('0xbb')&&isNotNull(this[_0x6367('0xea')][_0x565c03[_0x6367('0xbd')]][_0x6367('0x10e')])){delete this[_0x6367('0xb1')][_0x504221[_0x6367('0xe5')]];this[_0x6367('0xbc')](this[_0x6367('0xea')][_0x565c03['queue']]);this[_0x6367('0xea')][_0x565c03['queue']][_0x6367('0x63')]+=0x1;this[_0x6367('0xea')][_0x565c03[_0x6367('0xbd')]][_0x6367('0xee')]+=0x1;_0x176e47=new Hangup(_0x565c03,_0x504221);_0x176e47[_0x6367('0xab')]=0x10;_0x176e47['statedesc']=_0x6367('0x10f');_0x176e47['membername']=_0x6367('0x110');this['createHistory'](_0x176e47)[_0x6367('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6367('0xd1')](_0x176e47)[_0x6367('0xb9')](loggerCatch('[syncHangupIvr]'));}if(_0x565c03&&_0x565c03[_0x6367('0x5a')]!==_0x6367('0xbb')&&!isNotNull(this[_0x6367('0xea')][_0x565c03['queue']]['dialQueueProject'])){delete this[_0x6367('0xb1')][_0x504221[_0x6367('0xe5')]];this[_0x6367('0xbc')](this[_0x6367('0xea')][_0x565c03['queue']]);this[_0x6367('0xea')][_0x565c03[_0x6367('0xbd')]][_0x6367('0x6f')]+=0x1;_0x176e47=new Hangup(_0x565c03,_0x504221);_0x176e47['state']=0xc;_0x176e47[_0x6367('0xac')]=_0x504221[_0x6367('0x111')];_0x176e47[_0x6367('0xf0')]=_0x6367('0x112');this[_0x6367('0xd3')](_0x176e47)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6367('0xd1')](_0x176e47)['catch'](loggerCatch(_0x6367('0x113')));}};Dialer['prototype'][_0x6367('0x32')]=function(_0x244ac4){var _0x22ee64=this[_0x6367('0xb1')][_0x244ac4[_0x6367('0xe5')]];var _0x30b70b=this;if(this['voiceQueues'][_0x244ac4[_0x6367('0xbd')]]){if(_0x22ee64&&_0x22ee64[_0x6367('0x5a')]!==_0x6367('0xbb')){delete this[_0x6367('0xb1')][_0x244ac4['uniqueid']];this[_0x6367('0xea')][_0x244ac4[_0x6367('0xbd')]][_0x6367('0x63')]+=0x1;var _0xdafcdf=new AgentComplete(_0x22ee64,_0x244ac4);if(_0x244ac4['reason']===_0x6367('0x114')){_0xdafcdf[_0x6367('0x115')]=this[_0x6367('0xea')][_0x244ac4[_0x6367('0xbd')]][_0x6367('0x116')]&&this['voiceQueues'][_0x244ac4[_0x6367('0xbd')]][_0x6367('0x117')]?moment()[_0x6367('0x83')](_0x6367('0x118')):undefined;}this[_0x6367('0xd3')](_0xdafcdf)[_0x6367('0xb9')](loggerCatch(_0x6367('0x119')));this[_0x6367('0xd1')](_0xdafcdf)['catch'](loggerCatch(_0x6367('0x11a')));}}};Dialer[_0x6367('0xaf')][_0x6367('0x2e')]=function(_0x25ff8e){if(this[_0x6367('0xea')][_0x25ff8e[_0x6367('0xbd')]]){if(this[_0x6367('0xb1')][_0x25ff8e[_0x6367('0xe5')]]&&this[_0x6367('0xb1')][_0x25ff8e[_0x6367('0xe5')]]['type']!==_0x6367('0xbb')){this[_0x6367('0xbc')](this[_0x6367('0xea')][_0x25ff8e['queue']]);this[_0x6367('0xb1')][_0x25ff8e[_0x6367('0xe5')]][_0x6367('0x11b')]=moment()[_0x6367('0x83')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x6367('0xaf')][_0x6367('0x11c')]=function(_0x1f35ba){this['createHistory'](_0x1f35ba)[_0x6367('0xb9')](loggerCatch(_0x6367('0x119')));this[_0x6367('0xd1')](_0x1f35ba)[_0x6367('0xb9')](loggerCatch(_0x6367('0x11d')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x42158d){var _0x47801e=this[_0x6367('0xb1')][_0x42158d[_0x6367('0xe5')]];var _0x3931e3=this;if(this[_0x6367('0xea')][_0x42158d[_0x6367('0xbd')]]){if(_0x47801e&&_0x47801e[_0x6367('0x5a')]!==_0x6367('0xbb')){delete this[_0x6367('0xb1')][_0x42158d[_0x6367('0xe5')]];this['updateOriginated'](this[_0x6367('0xea')][_0x42158d[_0x6367('0xbd')]]);_0x47801e['droptime']=moment()[_0x6367('0x83')](_0x6367('0x118'));var _0x2528d3=new QueueCallerAbandon(_0x47801e,_0x42158d);if(getSeconds(_0x47801e[_0x6367('0x11e')],_0x47801e[_0x6367('0x11f')])>=_0x47801e['dialQueueTimeout']){this[_0x6367('0xea')][_0x42158d[_0x6367('0xbd')]][_0x6367('0x72')]+=0x1;this[_0x6367('0xea')][_0x42158d[_0x6367('0xbd')]][_0x6367('0x69')]+=0x1;this[_0x6367('0xea')][_0x42158d['queue']][_0x6367('0x120')]+=0x1;_0x2528d3[_0x6367('0xab')]=0xa;_0x2528d3[_0x6367('0xac')]=_0x6367('0x121');_0x2528d3['dropreason']=_0x6367('0x122');_0x2528d3['agiafterat']=this['voiceQueues'][_0x42158d['queue']]['dialQueueProject2']?moment()['format'](_0x6367('0x118')):undefined;_0x2528d3[_0x6367('0xff')]+=0x1;_0x2528d3[_0x6367('0xfa')]+=0x1;if(_0x2528d3['countdropretry']>=this[_0x6367('0xea')][_0x42158d['queue']][_0x6367('0x123')]){this[_0x6367('0x11c')](_0x2528d3);}else{this[_0x6367('0xc6')]({'active':![],'countdropretry':_0x2528d3[_0x6367('0xff')],'scheduledat':moment()[_0x6367('0x106')](this[_0x6367('0xea')][_0x42158d['queue']]['dialDropRetryFrequency'],_0x6367('0x107'))[_0x6367('0x83')](_0x6367('0x118')),'ContactId':_0x47801e[_0x6367('0x108')],'ListId':_0x47801e['ListId'],'VoiceQueueId':_0x47801e['VoiceQueueId']||undefined,'CampaignId':_0x47801e[_0x6367('0x109')]||undefined})[_0x6367('0xb9')](loggerCatch(_0x6367('0x124')));var _0x1234e6=new History(_0x2528d3);_0x1234e6['state']=0xa;_0x1234e6[_0x6367('0xac')]=_0x6367('0x121');_0x1234e6[_0x6367('0xae')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1234e6[_0x6367('0xad')]=_0x1234e6['starttime'];_0x1234e6[_0x6367('0x125')]=_0x2528d3[_0x6367('0x125')];_0x1234e6[_0x6367('0x126')]=_0x2528d3['calleridnum'];this[_0x6367('0xd3')](_0x1234e6)[_0x6367('0xb9')](loggerCatch(_0x6367('0x127')));}}else{this[_0x6367('0xea')][_0x42158d['queue']][_0x6367('0x8c')]+=0x1;this[_0x6367('0xea')][_0x42158d[_0x6367('0xbd')]][_0x6367('0x68')]+=0x1;_0x2528d3[_0x6367('0xab')]=0xb;_0x2528d3[_0x6367('0xac')]=_0x6367('0x128');_0x2528d3[_0x6367('0x129')]=_0x6367('0x12a');_0x2528d3['countabandonedretry']+=0x1;_0x2528d3['countglobal']+=0x1;if(_0x2528d3[_0x6367('0x12b')]>=this[_0x6367('0xea')][_0x42158d[_0x6367('0xbd')]][_0x6367('0x12c')]){this[_0x6367('0x11c')](_0x2528d3);}else{this[_0x6367('0xc6')]({'active':![],'countabandonedretry':_0x2528d3['countabandonedretry'],'scheduledat':moment()[_0x6367('0x106')](this[_0x6367('0xea')][_0x42158d[_0x6367('0xbd')]][_0x6367('0x12d')],_0x6367('0x107'))[_0x6367('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x47801e[_0x6367('0x108')],'ListId':_0x47801e[_0x6367('0xdb')],'VoiceQueueId':_0x47801e['VoiceQueueId']||undefined,'CampaignId':_0x47801e['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x1234e6=new History(_0x2528d3);_0x1234e6[_0x6367('0xab')]=0xb;_0x1234e6[_0x6367('0xac')]='Abandoned';_0x1234e6['starttime']=moment()[_0x6367('0x83')](_0x6367('0x118'));_0x1234e6[_0x6367('0xad')]=_0x1234e6[_0x6367('0xae')];_0x1234e6['calleridname']=_0x2528d3[_0x6367('0x125')];_0x1234e6[_0x6367('0x126')]=_0x2528d3[_0x6367('0x126')];this['createHistory'](_0x1234e6)[_0x6367('0xb9')](loggerCatch(_0x6367('0x12e')));}}}}};Dialer['prototype']['syncNewExten']=function(_0x3bc99f){if(this['actions'][_0x3bc99f[_0x6367('0xe5')]]){this[_0x6367('0xb3')][_0x3bc99f[_0x6367('0xe5')]][_0x6367('0xb8')]=_0x3bc99f[_0x6367('0xb8')];}if(this['uniqueId'][_0x3bc99f[_0x6367('0xe5')]]){this[_0x6367('0xb1')][_0x3bc99f[_0x6367('0xe5')]][_0x6367('0xb8')]=_0x3bc99f['channel'];}};Dialer['prototype'][_0x6367('0x39')]=function(_0x4715a9){if(strategy[this['voiceQueues'][this['actions'][_0x4715a9[_0x6367('0x12f')]][_0x6367('0xbd')]][_0x6367('0x52')]]==='roundrobin'){if(this['actions'][_0x4715a9[_0x6367('0x12f')]]&&_['isNil'](this[_0x6367('0xb3')][_0x4715a9[_0x6367('0x12f')]][_0x6367('0x130')])&&_0x4715a9[_0x6367('0xb7')]==='1'&&_0x4715a9['paused']==='0'){if(this[_0x6367('0x24')][_0x4715a9[_0x6367('0x131')]]){if(!this[_0x6367('0x24')][_0x4715a9['stateinterface']]['locked']){this['agents'][_0x4715a9['stateinterface']][_0x6367('0x130')]=!![];this[_0x6367('0xb3')][_0x4715a9[_0x6367('0x12f')]][_0x6367('0x130')]=!![];this['actions'][_0x4715a9[_0x6367('0x12f')]][_0x6367('0x131')]=_0x4715a9['stateinterface'];}}}}else if((strategy[this[_0x6367('0xea')][this[_0x6367('0xb3')][_0x4715a9[_0x6367('0x12f')]]['queue']][_0x6367('0x52')]]||'rrmemory')===_0x6367('0x1d')){if(this['actions'][_0x4715a9[_0x6367('0x12f')]]){if(this[_0x6367('0x24')][_0x4715a9[_0x6367('0x131')]]){this[_0x6367('0xb3')][_0x4715a9[_0x6367('0x12f')]]['stateinterface']=_0x4715a9[_0x6367('0x131')];if(_[_0x6367('0xb6')](this[_0x6367('0x2b')][this['actions'][_0x4715a9[_0x6367('0x12f')]][_0x6367('0xbd')]])){this[_0x6367('0x2b')][this[_0x6367('0xb3')][_0x4715a9[_0x6367('0x12f')]]['queue']]=[];}this['queueBooked'][this[_0x6367('0xb3')][_0x4715a9[_0x6367('0x12f')]][_0x6367('0xbd')]][_0x6367('0x132')](_[_0x6367('0x96')](_[_0x6367('0xda')](this[_0x6367('0xb3')][_0x4715a9[_0x6367('0x12f')]],[_0x6367('0x133'),_0x6367('0x131')]),{'status':_0x4715a9[_0x6367('0xb7')],'paused':_0x4715a9['paused']}));}}}};function unlockQueueStatus(_0x2f4ccb,_0x585dab){setTimeout(function(){if(_[_0x6367('0x41')](_0x2f4ccb[_0x6367('0x134')])){loggerBooked['error'](_0x6367('0x135'),_0x585dab);}_0x2f4ccb[_0x6367('0x134')]=!![];loggerBooked[_0x6367('0x86')](_0x6367('0x136'),_0x585dab,JSON[_0x6367('0x4d')](_[_0x6367('0xda')](_0x2f4ccb,[_0x6367('0x43'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x6367('0xaf')][_0x6367('0x3b')]=function(_0x28bc0a){var _0x3375bc=this;var _0xd5d713=_0x3375bc['voiceQueues'][_0x3375bc[_0x6367('0xb3')][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0xbd')]];if(strategy[this[_0x6367('0xea')][this[_0x6367('0xb3')][_0x28bc0a['actionid']][_0x6367('0xbd')]][_0x6367('0x52')]]==='roundrobin'){if(this[_0x6367('0xb3')][_0x28bc0a[_0x6367('0x12f')]]&&this[_0x6367('0xb3')][_0x28bc0a['actionid']]['stateinterface']){this[_0x6367('0x22')]['run'](this['actions'][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0x133')],this['actions'][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0x131')])[_0x6367('0xb9')](function(_0x46a130){logger['error'](_0x6367('0x137'),util[_0x6367('0x9e')](_0x46a130,{'showHidden':![],'depth':null}));})[_0x6367('0x20')](function(){_0x3375bc[_0x6367('0xbc')](_0x3375bc[_0x6367('0xea')][_0x3375bc[_0x6367('0xb3')][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0xbd')]]);_0x3375bc[_0x6367('0x24')][_0x3375bc['actions'][_0x28bc0a['actionid']][_0x6367('0x131')]]['locked']=![];delete _0x3375bc[_0x6367('0xb3')][_0x28bc0a['actionid']];unlockQueueStatus(_0xd5d713);});}else{this[_0x6367('0xbc')](this[_0x6367('0xea')][this['actions'][_0x28bc0a[_0x6367('0x12f')]]['queue']]);this[_0x6367('0xc6')]({'active':![],'ContactId':this['actions'][_0x28bc0a[_0x6367('0x12f')]]['ContactId'],'ListId':this[_0x6367('0xb3')][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0xdb')],'VoiceQueueId':this['actions'][_0x28bc0a['actionid']][_0x6367('0xdd')]||undefined,'CampaignId':this[_0x6367('0xb3')][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0x109')]||undefined})[_0x6367('0xb9')](loggerCatch(_0x6367('0x138')));delete this[_0x6367('0xb3')][_0x28bc0a['actionid']];unlockQueueStatus(_0xd5d713);}}else if((strategy[this[_0x6367('0xea')][this[_0x6367('0xb3')][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0xbd')]][_0x6367('0x52')]]||_0x6367('0x1d'))===_0x6367('0x1d')){var _0x18511b;if(this['actions'][_0x28bc0a[_0x6367('0x12f')]]&&!_[_0x6367('0x4b')](this[_0x6367('0x2b')][this['actions'][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0xbd')]])){if(this[_0x6367('0x2c')][_0x3375bc[_0x6367('0xb3')][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0xbd')]]){this[_0x6367('0x2c')][_0x3375bc[_0x6367('0xb3')][_0x28bc0a['actionid']][_0x6367('0xbd')]]=this['queueBookedRR'][this[_0x6367('0xb3')][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0xbd')]]?this[_0x6367('0x2c')][this[_0x6367('0xb3')][_0x28bc0a['actionid']][_0x6367('0xbd')]]:this['queueBooked'][this[_0x6367('0xb3')][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0xbd')]]?this[_0x6367('0x2b')][this[_0x6367('0xb3')][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0xbd')]][_0x6367('0x139')]||0x0:0x0;}this[_0x6367('0x2b')][this['actions'][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0xbd')]][_0x6367('0x139')]=this[_0x6367('0x2c')][this[_0x6367('0xb3')][_0x28bc0a[_0x6367('0x12f')]][_0x6367('0xbd')]];for(var _0x4114f9=0x0;_0x4114f9=0x0;})['catch'](myreject(_0x29f213)));}}else{_0x2e4406[_0x6367('0x132')](ami[_0x6367('0x150')]({'action':_0x6367('0x151'),'command':util[_0x6367('0x83')](_0x6367('0x152'),_0x384b92,!_[_0x6367('0x41')](config[_0x6367('0x14e')][_0x4fc4e1])?_0x4fc4e1:'')})['then'](function(_0x2182c0){return _0x2182c0['content'][_0x6367('0x154')](_0x6367('0x155'))>=0x0;})[_0x6367('0xb9')](myreject(_0x29f213)));}BPromise['all'](_0x2e4406)[_0x6367('0x3f')](function(_0x2829e1){var _0x47ecc2=_[_0x6367('0x156')](_0x2829e1);if(_0x47ecc2){return _0x340776(_0x47ecc2);}else{_0x29c0f5[_0x6367('0x42')]=_0x56f719?_0x6367('0x157'):'INTERVAL_IS_OVERTIME';return _0x29f213(msgResponse(_0x6367('0x158'),_0x6367('0x14b'),_0x6367('0x159')+_0x56f719+'\x20'+_0x258ab9+_0x6367('0x15a')+util[_0x6367('0x9e')](_0x384b92,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x4fc4e1));}})[_0x6367('0xb9')](function(_0x4c2d6a){return _0x29f213(msgResponse(_0x6367('0x149'),'Failure',JSON[_0x6367('0x4d')](_0x4c2d6a)));});});};Dialer[_0x6367('0xaf')][_0x6367('0x15b')]=function(_0x260eec){var _0xed0523=this;return function(){switch(_0x260eec[_0x6367('0x5f')]){case _0x6367('0x15c'):freeVariablesPredictive(_0x260eec);_0xed0523[_0x6367('0x15d')](_0x260eec,0x1);break;case _0x6367('0x15e'):freeVariablesPredictive(_0x260eec);_0xed0523['handlePower'](_0x260eec,_0x260eec['dialPowerLevel']);break;case _0x6367('0xa'):_0xed0523['predictive'](_0x260eec);break;case _0x6367('0x9'):freeVariablesPredictive(_0x260eec);_0xed0523[_0x6367('0x15d')](_0x260eec,0x1);break;default:freeVariablesPredictive(_0x260eec);logger[_0x6367('0x9d')](_0x6367('0x15f'),_0x260eec[_0x6367('0x43')],_0x6367('0x160'));}};};Dialer[_0x6367('0xaf')]['checkPreviewRecallReminder']=function(_0x3d9fe5){return BPromise[_0x6367('0xc4')]()[_0x6367('0x3f')](cmHopper[_0x6367('0x161')](_0x3d9fe5['id'],previewRecallmeReminderInterval))['then'](function(_0x130638){for(var _0x18e73f=0x0;_0x18e73f<_0x130638['length'];_0x18e73f++){var _0xa416f7=_0x130638[_0x18e73f][_0x6367('0x162')][_0x6367('0x43')];if(_0xa416f7)io['to'](util['format'](_0x6367('0x163'),_0xa416f7))[_0x6367('0x50')](_0x6367('0x164'),{'hopper':_0x130638[_0x18e73f]});}})[_0x6367('0xb9')](function(_0x376399){});};Dialer[_0x6367('0xaf')][_0x6367('0x165')]=function(_0x2c5845){var _0x2bb697=this;return function(){_0x2bb697[_0x6367('0x166')](_0x2c5845);};};Dialer[_0x6367('0xaf')][_0x6367('0xc')]=function(_0x24bd45){var _0xf6e12b=this;if(isNotPreview(_0x24bd45['dialMethod'])){if(isVoiceQueueOutbound(_0x24bd45[_0x6367('0x5a')])&&isActive(_0x24bd45[_0x6367('0x5e')])){_0x24bd45[_0x6367('0xa6')]=!![];BPromise['resolve']()[_0x6367('0x3f')](checkIsLoggedIn(_0x24bd45,_0x24bd45['loggedIn']))[_0x6367('0x3f')](checkIsActive(_0x24bd45,_0x24bd45[_0x6367('0x5e')]))[_0x6367('0x3f')](checkInterval(_0x24bd45))[_0x6367('0x3f')](_0xf6e12b[_0x6367('0x145')](_0x24bd45))[_0x6367('0x3f')](_0xf6e12b[_0x6367('0x148')](_0x24bd45['dialGlobalInterval'],_0x24bd45[_0x6367('0x167')],_0x24bd45[_0x6367('0x43')],_0x24bd45))[_0x6367('0x3f')](_0xf6e12b['checkIfTimeIntervals'](_0x24bd45[_0x6367('0x47')],_0x24bd45[_0x6367('0x167')],_0x24bd45['name'],_0x24bd45))[_0x6367('0x3f')](_0xf6e12b[_0x6367('0x15b')](_0x24bd45))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x24bd45));}else{notSendMessagesQueue(_0x24bd45);}}else{freeVariablesPredictive(_0x24bd45);if(_0x24bd45['dialPreviewRecallmeReminder']){_0xf6e12b['checkPreviewRecallReminder'](_0x24bd45);}}};Dialer[_0x6367('0xaf')][_0x6367('0x168')]=function(){var _0xd2ec49=this;var _0x1d435c;for(var _0x1aef8a in this['campaigns']){if(typeof this[_0x6367('0x23')][_0x1aef8a]!==_0x6367('0xb5')){_0x1d435c=this[_0x6367('0x23')][_0x1aef8a];if(isCampaignIvr(_0x1d435c['type'])&&isActive(_0x1d435c[_0x6367('0x80')])){_0x1d435c[_0x6367('0xa6')]=!![];BPromise[_0x6367('0xc4')]()[_0x6367('0x3f')](checkIsActive(_0x1d435c,_0x1d435c[_0x6367('0x80')]))[_0x6367('0x3f')](checkInterval(_0x1d435c))[_0x6367('0x3f')](_0xd2ec49[_0x6367('0x145')](_0x1d435c))[_0x6367('0x3f')](_0xd2ec49[_0x6367('0x148')](_0x1d435c[_0x6367('0x169')],_0x1d435c[_0x6367('0x167')],_0x1d435c[_0x6367('0x43')],_0x1d435c))[_0x6367('0x3f')](_0xd2ec49['checkIfTimeIntervals'](_0x1d435c[_0x6367('0x47')],_0x1d435c[_0x6367('0x167')],_0x1d435c['name'],_0x1d435c))[_0x6367('0x3f')](_0xd2ec49[_0x6367('0x165')](_0x1d435c))[_0x6367('0xb9')](loggerCatchQueueSummary(_0x6367('0x16a'),_0x1d435c));}else{notSendMessagesCampaign(_0x1d435c);}}}};function getCallerIdRandom(_0x12edda,_0x3e2ef5){var _0x18a4b3;var _0x1831de;var _0x2aac85;if(_0x3e2ef5<=0x0){_0x3e2ef5=0x1;}_0x18a4b3=new RegExp(_0x6367('0x16b')+_0x3e2ef5+'}$');_0x1831de=Math[_0x6367('0x16c')](0xa,_0x3e2ef5-0x1);_0x2aac85=Math[_0x6367('0x16c')](0xa,_0x3e2ef5)-0x1;return util['format']('%s',_[_0x6367('0x16d')](_0x12edda,_0x18a4b3,_[_0x6367('0x16e')](_0x1831de,_0x2aac85)));}function extractCalleridName(_0x3df2b7){var _0x3a1366=_0x3df2b7[_0x6367('0x16f')](/"(.*?)"/);return _0x3a1366?_0x3a1366[0x1]:_0x3df2b7;}function extractCalleridNumber(_0x2abafc){var _0x4ca2be=_0x2abafc[_0x6367('0x16f')](/<(.*?)>/);return _0x4ca2be?_0x4ca2be[0x1]:_0x2abafc;}Dialer[_0x6367('0xaf')][_0x6367('0x170')]=function(_0x5a5084,_0x3f65e6){var _0x3ef325=this;var _0x5527d7=uuid['v4']();this[_0x6367('0xb3')][_0x5527d7]=new Action(_0x5a5084,_0x3f65e6,_0x5527d7);return new BPromise(function(_0x320e29,_0x36b62b){if(_['isUndefined'](_0x5a5084)&&typeof _0x5a5084!=='object'){return _0x36b62b(msgResponse(_0x6367('0x171'),_0x6367('0x14b'),_0x6367('0x172')));}if(_['isUndefined'](_0x3f65e6['Contact'][_0x6367('0x173')])||_0x3f65e6['Contact'][_0x6367('0x173')]===null){return _0x36b62b(msgResponse(_0x6367('0x171'),_0x6367('0x14b'),_0x6367('0x174')));}var _0x532412={'XMD-CALLERID':_0x3ef325['actions'][_0x5527d7][_0x6367('0x175')](),'XMD-AGI':_0x5a5084['dialQueueProject']?util[_0x6367('0x83')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5a5084[_0x6367('0x10e')]):'NONE','XMD-AGIAFTER':_0x5a5084[_0x6367('0x116')]?util[_0x6367('0x83')](_0x6367('0x176'),ipAgi,_0x5a5084[_0x6367('0x116')]):_0x6367('0x177'),'XMD-QUEUE':_0x5a5084[_0x6367('0x5a')]===_0x6367('0x51')?util['format'](_0x6367('0x178'),_0x5a5084[_0x6367('0x43')],_0x5a5084[_0x6367('0x179')]||'',_0x5a5084[_0x6367('0x117')]?'c':'',_0x5a5084[_0x6367('0x17a')]||0x3):_0x6367('0x177'),'XMD-CONTACTID':_0x3f65e6[_0x6367('0x108')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3ef325[_0x6367('0xb3')][_0x5527d7][_0x6367('0x175')](),'XMD-AMD':_0x5a5084[_0x6367('0xeb')]?_0x6367('0x17b'):_0x6367('0x177'),'XMD-DESTINATION':_0x6367('0xe9')};if(_0x5a5084[_0x6367('0xeb')]){_0x532412[_0x6367('0x17c')]=_0x5a5084[_0x6367('0x17d')]||0x9c4;_0x532412[_0x6367('0x17e')]=_0x5a5084[_0x6367('0x17f')]||0x5dc;_0x532412[_0x6367('0x180')]=_0x5a5084[_0x6367('0x181')]||0x320;_0x532412['XMD-AMDTOTALANALYSISTIME']=_0x5a5084[_0x6367('0x182')]||0x1388;_0x532412[_0x6367('0x183')]=_0x5a5084['dialAMDMinWordLength']||0x64;_0x532412[_0x6367('0x184')]=_0x5a5084['dialAMDBetweenWordsSilence']||0x32;_0x532412['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5a5084[_0x6367('0x185')]||0x3;_0x532412['XMD-AMDSILENCETHRESHOLD']=_0x5a5084[_0x6367('0x186')]||0x100;_0x532412[_0x6367('0x187')]=_0x5a5084[_0x6367('0x188')]||0x1388;}if(_0x5a5084[_0x6367('0x5a')]==='outbound'){_0x532412['XMD-VOICEQUEUEID']=_0x3f65e6[_0x6367('0xdd')];}else{_0x532412['XMD-CAMPAIGNID']=_0x3f65e6['CampaignId'];}for(var _0x14e0bf in _0x3f65e6['Contact']){if(typeof _0x3f65e6['Contact'][_0x14e0bf]!==_0x6367('0xb5')){if(isNotNull(_0x3f65e6[_0x6367('0x189')][_0x14e0bf])&&_0x14e0bf!=='id'&&_0x14e0bf!=='tags'&&_0x14e0bf!==_0x6367('0x18a')&&_0x14e0bf!=='updatedAt'){_0x532412[util['format'](_0x6367('0x18b'),_0x6367('0x18c'),_[_0x6367('0x18d')](_0x14e0bf))]=_0x3f65e6[_0x6367('0x189')][_0x14e0bf];}}}var _0x7e642e=_0x3ef325[_0x6367('0xe1')](_0x5a5084[_0x6367('0x7f')])?getCallerId(_0x5a5084[_0x6367('0x7f')][_0x6367('0x18e')],_0x5a5084['dialOriginateCallerIdName'],_0x5a5084[_0x6367('0x18f')]>0x0?getCallerIdRandom(_0x5a5084['dialOriginateCallerIdNumber'],_0x5a5084['dialRandomLastDigitCallerIdNumber']):_0x5a5084['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x5a5084[_0x6367('0x146')])?_0x5a5084[_0x6367('0x7f')]['callerid']:_0x5a5084[_0x6367('0x146')][_0x6367('0x18e')],_0x5a5084[_0x6367('0x60')],_0x5a5084['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5a5084[_0x6367('0x61')],_0x5a5084[_0x6367('0x18f')]):_0x5a5084[_0x6367('0x61')]);if(_0x7e642e){_0x532412[_0x6367('0x190')]=_0x3ef325[_0x6367('0xb3')][_0x5527d7][_0x6367('0x191')]=extractCalleridName(_0x7e642e);_0x532412['XMD-ORIGINATECALLERIDNUM']=_0x3ef325['actions'][_0x5527d7]['originatecalleridnum']=extractCalleridNumber(_0x7e642e);}return ami[_0x6367('0x150')]({'actionid':_0x5527d7,'action':_0x6367('0x171'),'channel':_0x3ef325['isTrunkReachable'](_0x5a5084[_0x6367('0x7f')])?util['format'](_0x6367('0x192'),_0x5a5084[_0x6367('0x7f')][_0x6367('0x43')],isNotNull(_0x5a5084['dialPrefix'])?_0x5a5084[_0x6367('0x193')][_0x6367('0x194')]()||'':'',_0x5a5084[_0x6367('0x195')]>0x0?_0x3f65e6[_0x6367('0x189')][_0x6367('0x173')][_0x6367('0x196')](_0x5a5084[_0x6367('0x195')]):_0x3f65e6[_0x6367('0x189')][_0x6367('0x173')]):util[_0x6367('0x83')](_0x6367('0x192'),_[_0x6367('0xb6')](_0x5a5084[_0x6367('0x146')])?_0x5a5084[_0x6367('0x7f')]['name']:_0x5a5084['TrunkBackup'][_0x6367('0x43')],isNotNull(_0x5a5084['dialPrefix'])?_0x5a5084[_0x6367('0x193')]['trim']()||'':'',_0x5a5084[_0x6367('0x195')]>0x0?_0x3f65e6[_0x6367('0x189')]['phone'][_0x6367('0x196')](_0x5a5084['dialCutDigit']):_0x3f65e6[_0x6367('0x189')][_0x6367('0x173')]),'callerid':_0x7e642e,'Exten':_0x6367('0xe9'),'Context':'from-sip','Priority':'1','variable':_0x532412,'timeout':(_0x5a5084[_0x6367('0x62')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5527d7})[_0x6367('0x3f')](function(_0x502a72){return _0x320e29(_0x502a72);})[_0x6367('0xb9')](function(_0x467b05){_0x5a5084[_0x6367('0x6c')]+=0x1;var _0x2879fe=new History(_0x3ef325['actions'][_0x5527d7]);logger[_0x6367('0x9d')](util[_0x6367('0x83')](_0x6367('0x197'),JSON['stringify'](_0x467b05)));_0x2879fe[_0x6367('0xab')]=0xe;_0x2879fe[_0x6367('0xac')]='OriginateError';_0x2879fe[_0x6367('0xae')]=moment()[_0x6367('0x83')](_0x6367('0x118'));_0x2879fe[_0x6367('0xad')]=_0x2879fe['starttime'];_0x3ef325['createHistory'](_0x2879fe)[_0x6367('0xb9')](loggerCatch(_0x6367('0x198')));_0x3ef325[_0x6367('0xd1')](_0x2879fe)['catch'](loggerCatch(_0x6367('0x198')))[_0x6367('0x20')](function(){delete _0x3ef325[_0x6367('0xb3')][_0x5527d7];return _0x36b62b(msgResponse(_0x6367('0x171'),_0x6367('0x4c'),_0x6367('0x199')));});});});};Dialer[_0x6367('0xaf')][_0x6367('0x31')]=function(_0x8f467e){var _0x534ca1=this[_0x6367('0xb3')][_0x8f467e[_0x6367('0x12f')]];if(_0x534ca1){delete this['actions'][_0x8f467e[_0x6367('0x12f')]];_0x534ca1[_0x6367('0x11f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x58812a=_0x534ca1[_0x6367('0x5a')]===_0x6367('0xbb')?this['campaigns'][_0x534ca1[_0x6367('0xbd')]]:this[_0x6367('0xea')][_0x534ca1[_0x6367('0x19a')]()];if(!this[_0x6367('0xe0')](_0x8f467e[_0x6367('0x19b')])){this[_0x6367('0xbc')](_0x58812a);return this[_0x6367('0x19c')](_0x534ca1,_0x58812a,_0x8f467e)[_0x6367('0xb9')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x6367('0xb1')][_0x8f467e[_0x6367('0xe5')]]=_0x534ca1;}};Dialer[_0x6367('0xaf')][_0x6367('0x19d')]=function(_0x1bb9c4,_0x5477ac,_0x24d937){var _0x3a03fa=new History(_0x5477ac);if(_0x3a03fa[_0x6367('0xfc')]+_0x3a03fa[_0x6367('0xfd')]+_0x3a03fa[_0x6367('0x19e')]+_0x3a03fa[_0x6367('0xfe')]+_0x3a03fa['countdropretry']+_0x3a03fa[_0x6367('0x12b')]+_0x3a03fa[_0x6367('0xf9')]+_0x3a03fa[_0x6367('0x100')]>=_0x24d937[_0x6367('0x101')]-0x1){return!![];}switch(_0x1bb9c4){case 0x3:if(_0x3a03fa['countnoanswerretry']>=_0x24d937['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x3a03fa[_0x6367('0x19e')]+=0x1,'scheduledat':moment()['add'](_0x24d937['dialNoAnswerRetryFrequency'],_0x6367('0x107'))[_0x6367('0x83')](_0x6367('0x118')),'ContactId':_0x3a03fa['ContactId'],'ListId':_0x3a03fa[_0x6367('0xdb')],'VoiceQueueId':_0x3a03fa[_0x6367('0xdd')]||undefined,'CampaignId':_0x3a03fa['CampaignId']||undefined})[_0x6367('0xb9')](loggerCatch(_0x6367('0x19f')));break;case 0x5:if(_0x3a03fa[_0x6367('0xfc')]>=_0x24d937[_0x6367('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x3a03fa[_0x6367('0xfc')]+=0x1,'scheduledat':moment()[_0x6367('0x106')](_0x24d937['dialBusyRetryFrequency'],_0x6367('0x107'))[_0x6367('0x83')](_0x6367('0x118')),'ContactId':_0x3a03fa[_0x6367('0x108')],'ListId':_0x3a03fa[_0x6367('0xdb')],'VoiceQueueId':_0x3a03fa['VoiceQueueId']||undefined,'CampaignId':_0x3a03fa[_0x6367('0x109')]||undefined})['catch'](loggerCatch(_0x6367('0x1a1')));break;case 0x8:if(_0x3a03fa[_0x6367('0xfd')]>=_0x24d937[_0x6367('0x1a2')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x3a03fa[_0x6367('0xfd')]+=0x1,'scheduledat':moment()[_0x6367('0x106')](_0x24d937[_0x6367('0x1a3')],_0x6367('0x107'))[_0x6367('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3a03fa[_0x6367('0x108')],'ListId':_0x3a03fa[_0x6367('0xdb')],'VoiceQueueId':_0x3a03fa[_0x6367('0xdd')]||undefined,'CampaignId':_0x3a03fa[_0x6367('0x109')]||undefined})[_0x6367('0xb9')](loggerCatch(_0x6367('0x1a4')));break;case 0x0:if(_0x3a03fa[_0x6367('0xfe')]>=_0x24d937[_0x6367('0x1a5')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x3a03fa[_0x6367('0xfe')]+=0x1,'scheduledat':moment()[_0x6367('0x106')](_0x24d937[_0x6367('0x1a6')],'minutes')[_0x6367('0x83')](_0x6367('0x118')),'ContactId':_0x3a03fa[_0x6367('0x108')],'ListId':_0x3a03fa[_0x6367('0xdb')],'VoiceQueueId':_0x3a03fa[_0x6367('0xdd')]||undefined,'CampaignId':_0x3a03fa['CampaignId']||undefined})['catch'](loggerCatch(_0x6367('0x1a7')));}break;case 0xa:if(_0x3a03fa[_0x6367('0xff')]>=_0x24d937[_0x6367('0x123')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x3a03fa[_0x6367('0xff')]+=0x1,'scheduledat':moment()['add'](_0x24d937[_0x6367('0x1a8')],_0x6367('0x107'))['format'](_0x6367('0x118')),'ContactId':_0x3a03fa[_0x6367('0x108')],'ListId':_0x3a03fa[_0x6367('0xdb')],'VoiceQueueId':_0x3a03fa['VoiceQueueId']||undefined,'CampaignId':_0x3a03fa[_0x6367('0x109')]||undefined})[_0x6367('0xb9')](loggerCatch(_0x6367('0x124')));break;case 0xb:if(_0x3a03fa[_0x6367('0x12b')]>=_0x24d937[_0x6367('0x12c')]-0x1){return!![];}this[_0x6367('0xc6')]({'active':![],'countabandonedretry':_0x3a03fa[_0x6367('0x12b')]+=0x1,'scheduledat':moment()['add'](_0x24d937[_0x6367('0x12d')],'minutes')[_0x6367('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3a03fa[_0x6367('0x108')],'ListId':_0x3a03fa['ListId'],'VoiceQueueId':_0x3a03fa[_0x6367('0xdd')]||undefined,'CampaignId':_0x3a03fa[_0x6367('0x109')]||undefined})['catch'](loggerCatch(_0x6367('0x1a9')));break;case 0x13:if(_0x3a03fa['countmachineretry']>=_0x24d937[_0x6367('0x103')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x3a03fa['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x24d937[_0x6367('0x10c')],_0x6367('0x107'))[_0x6367('0x83')](_0x6367('0x118')),'ContactId':_0x3a03fa[_0x6367('0x108')],'ListId':_0x3a03fa[_0x6367('0xdb')],'VoiceQueueId':_0x3a03fa['VoiceQueueId']||undefined,'CampaignId':_0x3a03fa[_0x6367('0x109')]||undefined})[_0x6367('0xb9')](loggerCatch(_0x6367('0x10a')));break;case 0x14:if(_0x3a03fa[_0x6367('0x100')]>=_0x24d937[_0x6367('0x1aa')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x3a03fa[_0x6367('0x100')]+=0x1,'scheduledat':moment()[_0x6367('0x106')](_0x24d937[_0x6367('0x1ab')],_0x6367('0x107'))[_0x6367('0x83')](_0x6367('0x118')),'ContactId':_0x3a03fa[_0x6367('0x108')],'ListId':_0x3a03fa[_0x6367('0xdb')],'VoiceQueueId':_0x3a03fa[_0x6367('0xdd')]||undefined,'CampaignId':_0x3a03fa[_0x6367('0x109')]||undefined})['catch'](loggerCatch(_0x6367('0x1ac')));break;default:return!![];}};Dialer[_0x6367('0xaf')][_0x6367('0x19c')]=function(_0x566cbf,_0x32d02a,_0x363e25){var _0x46e776=this;var _0x8d8bb0=new History(_0x566cbf);return new BPromise(function(_0x4bd5d6,_0x2bb1ad){if(_[_0x6367('0x41')](_0x32d02a)&&typeof _0x32d02a!==_0x6367('0x1ad')){return _0x2bb1ad(msgResponse(_0x6367('0x1ae'),'Failure',_0x6367('0x1af')));}if(_[_0x6367('0x41')](_0x363e25)&&typeof _0x363e25!==_0x6367('0x1ad')){return _0x2bb1ad(msgResponse('[callProgressDetecting]',_0x6367('0x14b'),_0x6367('0x1b0')));}switch(_0x363e25[_0x6367('0x1b1')]){case'0':_0x32d02a[_0x6367('0x6b')]+=0x1;_0x8d8bb0['state']=0x0;_0x8d8bb0['statedesc']=_0x6367('0x1b2');_0x8d8bb0[_0x6367('0xfe')]+=0x1;_0x8d8bb0[_0x6367('0xfa')]+=0x1;ami[_0x6367('0x50')](_0x6367('0x1b3'),ut[_0x6367('0xf3')](_0x566cbf,_0x6367('0x1b4')));_0x46e776['createHistory'](_0x8d8bb0)[_0x6367('0xb9')](loggerCatch(_0x6367('0xfb')));if(_0x46e776[_0x6367('0x19d')](0x0,_0x566cbf,_0x32d02a)){if(_0x8d8bb0[_0x6367('0xfe')]>=_0x32d02a[_0x6367('0x1a5')]){_0x46e776[_0x6367('0x104')](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x6367('0x1b5'));}else{_0x46e776[_0x6367('0x102')](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x6367('0x1b5'));}}break;case'3':_0x32d02a[_0x6367('0x6a')]+=0x1;_0x8d8bb0[_0x6367('0xab')]=0x3;_0x8d8bb0[_0x6367('0xac')]=_0x6367('0x1b6');_0x8d8bb0[_0x6367('0x19e')]+=0x1;_0x8d8bb0[_0x6367('0xfa')]+=0x1;ami[_0x6367('0x50')](_0x6367('0x1b7'),ut[_0x6367('0xf3')](_0x566cbf,_0x6367('0x1b8')));_0x46e776[_0x6367('0xd3')](_0x8d8bb0)['catch'](loggerCatch(_0x6367('0x1b9')));if(_0x46e776['checkRetriveMax'](0x3,_0x566cbf,_0x32d02a)){if(_0x8d8bb0[_0x6367('0x19e')]>=_0x32d02a[_0x6367('0x1ba')]){_0x46e776['createStateFinal'](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x6367('0x1bb'));}else{_0x46e776[_0x6367('0x102')](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x6367('0x1bb'));}}break;case'5':_0x32d02a[_0x6367('0x65')]+=0x1;_0x8d8bb0['state']=0x5;_0x8d8bb0['statedesc']=_0x6367('0x1bc');_0x8d8bb0[_0x6367('0xfc')]+=0x1;_0x8d8bb0['countglobal']+=0x1;ami[_0x6367('0x50')](_0x6367('0x1bd'),ut[_0x6367('0xf3')](_0x566cbf,_0x6367('0x1be')));_0x46e776['createHistory'](_0x8d8bb0)[_0x6367('0xb9')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x46e776[_0x6367('0x19d')](0x5,_0x566cbf,_0x32d02a)){if(_0x8d8bb0['countbusyretry']>=_0x32d02a[_0x6367('0x1a0')]){_0x46e776[_0x6367('0x104')](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x6367('0x1bf'));}else{_0x46e776['stateGlobal'](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x6367('0x1bf'));}}break;case'8':_0x32d02a[_0x6367('0x66')]+=0x1;_0x8d8bb0[_0x6367('0xab')]=0x8;_0x8d8bb0['statedesc']=_0x6367('0x1c0');_0x8d8bb0[_0x6367('0xfd')]+=0x1;_0x8d8bb0['countglobal']+=0x1;ami[_0x6367('0x50')](_0x6367('0x1c1'),ut[_0x6367('0xf3')](_0x566cbf,_0x6367('0x1c2')));_0x46e776[_0x6367('0xd3')](_0x8d8bb0)[_0x6367('0xb9')](loggerCatch(_0x6367('0x1c3')));if(_0x46e776[_0x6367('0x19d')](0x8,_0x566cbf,_0x32d02a)){if(_0x8d8bb0['countcongestionretry']>=_0x32d02a[_0x6367('0x1a2')]){_0x46e776[_0x6367('0x104')](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x6367('0x1c4'));}else{_0x46e776[_0x6367('0x102')](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x6367('0x1c4'));}}break;case'11':_0x32d02a[_0x6367('0x1c5')]+=0x1;_0x8d8bb0[_0x6367('0xab')]=0xb;_0x8d8bb0[_0x6367('0xac')]='Abandoned';_0x8d8bb0[_0x6367('0x12b')]+=0x1;_0x8d8bb0[_0x6367('0xfa')]+=0x1;_0x46e776[_0x6367('0xd3')](_0x8d8bb0)[_0x6367('0xb9')](loggerCatch(_0x6367('0x12e')));if(_0x46e776[_0x6367('0x19d')](0xb,_0x566cbf,_0x32d02a)){if(_0x8d8bb0[_0x6367('0x12b')]>=_0x32d02a['dialAbandonedMaxRetry']){_0x46e776['createStateFinal'](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,'reason\x2011\x20abandoned');}else{_0x46e776['stateGlobal'](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,'reason\x2011\x20abandoned');}}break;case'20':_0x32d02a[_0x6367('0x6e')]+=0x1;_0x8d8bb0[_0x6367('0xab')]=0x14;_0x8d8bb0[_0x6367('0xac')]='AgentReject';_0x8d8bb0[_0x6367('0x100')]+=0x1;_0x8d8bb0['countglobal']+=0x1;ami[_0x6367('0x50')](_0x6367('0x1c6'),ut['buildObj'](_0x566cbf,'agentreject'));_0x46e776[_0x6367('0xd3')](_0x8d8bb0)[_0x6367('0xb9')](loggerCatch(_0x6367('0x1c7')));if(_0x46e776[_0x6367('0x19d')](0x14,_0x566cbf,_0x32d02a)){if(_0x8d8bb0['countagentrejectretry']>=_0x32d02a[_0x6367('0x1aa')]){_0x46e776[_0x6367('0x104')](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x6367('0x1c8'));}else{_0x46e776[_0x6367('0x102')](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x6367('0x1c8'));}}break;default:_0x32d02a['outboundUnknownCallsDay']+=0x1;_0x8d8bb0[_0x6367('0xab')]=0xc;_0x8d8bb0[_0x6367('0xac')]=_0x363e25[_0x6367('0x1b1')];_0x46e776[_0x6367('0xd3')](_0x8d8bb0)['catch'](loggerCatch(_0x6367('0x1c9')));if(_0x46e776[_0x6367('0x19d')](_0x363e25[_0x6367('0x1b1')],_0x566cbf,_0x32d02a)){if(_0x8d8bb0[_0x6367('0xfc')]+_0x8d8bb0[_0x6367('0xfd')]+_0x8d8bb0['countnoanswerretry']+_0x8d8bb0[_0x6367('0xfe')]+_0x8d8bb0[_0x6367('0xff')]+_0x8d8bb0[_0x6367('0x12b')]+_0x8d8bb0['countmachineretry']+_0x8d8bb0[_0x6367('0x100')]>=_0x32d02a[_0x6367('0x101')]){_0x46e776[_0x6367('0x102')](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x363e25[_0x6367('0x1b1')]);}else{_0x46e776[_0x6367('0x104')](_0x8d8bb0,_0x4bd5d6,_0x2bb1ad,_0x363e25[_0x6367('0x1b1')]);}}}});};Dialer['prototype'][_0x6367('0x102')]=function(_0x5cf7e6,_0x4dce49,_0x233b78,_0xf5e5a5){var _0x4c4404=new Final(_0x5cf7e6);_0x4c4404[_0x6367('0xab')]=0xf;_0x4c4404[_0x6367('0xac')]=_0x6367('0x1ca');this[_0x6367('0x104')](_0x4c4404,_0x4dce49,_0x233b78,_0xf5e5a5);};Dialer[_0x6367('0xaf')][_0x6367('0x104')]=function(_0x24e422,_0x3d274d,_0x4e1977,_0x69fc06){this[_0x6367('0xd1')](_0x24e422)[_0x6367('0x3f')](function(){return _0x3d274d(msgResponse(_0x6367('0x1ae'),'Success',_0x69fc06));})[_0x6367('0xb9')](function(){return _0x4e1977(msgResponse(_0x6367('0x1cb'),'Failure',_0x6367('0x1cc')));});};Dialer[_0x6367('0xaf')][_0x6367('0xa')]=function(_0x3e2d7a){var _0x45fc3c=_0x3e2d7a[_0x6367('0x1cd')]/0x64;var _0x284f9c=_0x3e2d7a['outboundDropCallsDayTimeout']/(_0x3e2d7a[_0x6367('0x69')]+_0x3e2d7a[_0x6367('0x63')]);var _0x149983=Math[_0x6367('0x1ce')](_0x3e2d7a['predictiveIntervalAvailable']*(_0x3e2d7a[_0x6367('0x1cf')]/0x64));var _0x340c60=Math['round'](_0x3e2d7a['predictiveIntervalAvailable']*(_0x3e2d7a[_0x6367('0x1d0')]/0x64));var _0x37ec76=_0x3e2d7a[_0x6367('0x53')]+_0x3e2d7a[_0x6367('0x58')];var _0x5af513=Math[_0x6367('0x1d1')](_0x3e2d7a[_0x6367('0x7a')]*_0x3e2d7a[_0x6367('0x7c')]*_0x3e2d7a[_0x6367('0x74')]*_0x3e2d7a[_0x6367('0x75')]);if(_[_0x6367('0x41')](_0x3e2d7a['startProgressive'])){if(!_[_0x6367('0x41')](_0x3e2d7a[_0x6367('0x29')])){_0x3e2d7a[_0x6367('0x29')]=undefined;loggerPredictive[_0x6367('0x9d')](_0x6367('0x1d2'),_0x6367('0x1d3'));}if(!_[_0x6367('0x41')](_0x3e2d7a[_0x6367('0x99')])){loggerPredictive['error'](_0x6367('0x1d2'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3e2d7a[_0x6367('0x99')]);_0x3e2d7a[_0x6367('0x99')]=undefined;}_0x3e2d7a['startProgressive']=moment()[_0x6367('0x83')](_0x6367('0x118'));loggerPredictive[_0x6367('0x86')](_0x3e2d7a[_0x6367('0x43')],_0x6367('0x1d4'),_0x3e2d7a['startProgressive']);this[_0x6367('0x15d')](_0x3e2d7a,0x1);}else if(ifInterval(_0x3e2d7a[_0x6367('0x1d5')],_0x3e2d7a[_0x6367('0x7e')])){this[_0x6367('0x15d')](_0x3e2d7a,0x1);loggerPredictiveCalls[_0x6367('0x86')](_0x6367('0x1d6'),_0x3e2d7a[_0x6367('0x7e')],_0x3e2d7a[_0x6367('0x43')]);_0x3e2d7a[_0x6367('0x7a')]=0x0;_0x3e2d7a[_0x6367('0x120')]=0x0;}else if(_0x45fc3c<_0x284f9c&&_0x3e2d7a[_0x6367('0x1d7')]===_0x6367('0x1d8')){freeVariablesPredictive(_0x3e2d7a);loggerPredictive[_0x6367('0x86')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x6367('0x1d9'),_0x284f9c,_0x6367('0x7e'),_0x3e2d7a[_0x6367('0x43')]);}else if(_0x5af513<_0x3e2d7a['predictiveIntervalErlangCallsDroppedCalls']&&_0x3e2d7a[_0x6367('0x1d7')]===_0x6367('0x1d8')){freeVariablesPredictive(_0x3e2d7a);loggerPredictive[_0x6367('0x86')](_0x6367('0x1da'),'Max\x20Drop\x20',_0x5af513,_0x6367('0x1db'),_0x3e2d7a[_0x6367('0x120')],_0x6367('0x7e'),_0x3e2d7a[_0x6367('0x43')]);}else if(!ifInterval(_0x3e2d7a[_0x6367('0x1d5')],_0x3e2d7a[_0x6367('0x7e')])&&_[_0x6367('0x41')](_0x3e2d7a['startPredictive'])&&!_[_0x6367('0x41')](_0x3e2d7a[_0x6367('0x7e')])){_0x3e2d7a[_0x6367('0x29')]=moment()['format'](_0x6367('0x118'));loggerPredictive['info'](_0x3e2d7a[_0x6367('0x43')],_0x6367('0x1dc'),_0x3e2d7a[_0x6367('0x29')]);this[_0x6367('0x1dd')](_0x3e2d7a[_0x6367('0x1d5')])[_0x6367('0x3f')](this['getDataPredictive'](_0x3e2d7a))[_0x6367('0x3f')](mergeDataErlangB(_0x3e2d7a))[_0x6367('0x3f')](this[_0x6367('0x1de')](_0x3e2d7a))['catch'](loggerCatchPredictive(_0x6367('0x1df'),_0x3e2d7a));}else if(!ifInterval(_0x3e2d7a[_0x6367('0x1d5')],_0x3e2d7a['startPredictive'])){_0x3e2d7a[_0x6367('0x120')]=0x0;_0x3e2d7a['startPredictive']=moment()['format'](_0x6367('0x118'));loggerPredictive[_0x6367('0x86')](_0x3e2d7a[_0x6367('0x43')],_0x6367('0x1e0'),_0x3e2d7a[_0x6367('0x29')]);clearInterval(_0x3e2d7a[_0x6367('0x99')]);_0x3e2d7a[_0x6367('0x99')]=undefined;this[_0x6367('0x1dd')](_0x3e2d7a['dialPredictiveInterval'])['then'](this['getDataPredictive'](_0x3e2d7a))[_0x6367('0x3f')](mergeDataErlangB(_0x3e2d7a))[_0x6367('0x3f')](this[_0x6367('0x1de')](_0x3e2d7a))[_0x6367('0xb9')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3e2d7a));}else if(_0x3e2d7a['predictiveIntervalAvailable']&&_0x37ec76<_0x3e2d7a['predictiveIntervalAvailable']-_0x340c60){freeVariablesPredictive(_0x3e2d7a);loggerPredictive[_0x6367('0x86')](_0x3e2d7a[_0x6367('0x43')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x37ec76,')\x20are\x20less\x20than\x20threshold\x20(',_0x3e2d7a[_0x6367('0x77')],'-',_0x340c60,'=',_0x3e2d7a['predictiveIntervalAvailable']-_0x340c60,')');}else if(_0x3e2d7a[_0x6367('0x77')]&&_0x37ec76>_0x3e2d7a['predictiveIntervalAvailable']+_0x149983){freeVariablesPredictive(_0x3e2d7a);loggerPredictive[_0x6367('0x86')](_0x3e2d7a[_0x6367('0x43')],_0x6367('0x1e1'),_0x37ec76,')\x20are\x20more\x20than\x20threshold\x20(',_0x3e2d7a[_0x6367('0x77')],'+',_0x149983,'=',_0x3e2d7a[_0x6367('0x77')]+_0x149983,')');}};Dialer['prototype']['getDataPredictive']=function(_0x2864b5){var _0x407025=this;return function(_0x2eceb9){return new BPromise(function(_0x573265,_0x339976){_[_0x6367('0x96')](_0x2864b5,_0x2eceb9[0x0]);if(checkGetDataPredictive(_0x2eceb9[0x0])){var _0x9c5fa=_0x2864b5[_0x6367('0x77')]=_0x2864b5[_0x6367('0x58')]+_0x2864b5[_0x6367('0x53')];var _0x39b8df=_0x2864b5[_0x6367('0x1d5')]*0x3c;var _0x5722d0=_0x2eceb9[0x0][_0x6367('0x90')]+_0x2eceb9[0x0][_0x6367('0x71')];var _0x5e99eb=(_0x2eceb9[0x0]['predictiveIntervalAnsweredCalls']+_0x2eceb9[0x0][_0x6367('0x72')]+_0x2eceb9[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2eceb9[0x0][_0x6367('0x78')];_0x2864b5[_0x6367('0x74')]=_0x5e99eb>0x0?_0x5e99eb:0x1;switch(_0x2864b5[_0x6367('0x1d7')]){case'dropRate':var _0x401150=_0x2864b5['dialPredictiveOptimizationPercentage']/0x64;return _0x407025['abandonmentRate'](_0x9c5fa,_0x39b8df,_0x5722d0,_0x5e99eb,_0x401150)['then'](function(_0x4f47cf){return _0x573265(_0x4f47cf);});case'agentBusyFactor':var _0x49d320=_0x2864b5[_0x6367('0x1cd')]/0x64;return _0x407025[_0x6367('0x1e2')](_0x9c5fa,_0x39b8df,_0x5722d0,_0x5e99eb,_0x49d320)['then'](function(_0x333771){return _0x573265(_0x333771);});default:return _0x339976(msgResponse('[getDataPredictive]','Failure',_0x6367('0x1e3')));}}else{return _0x339976(msgResponse(_0x6367('0x1e4'),_0x6367('0x14b'),'check\x20failure'));}});};};Dialer[_0x6367('0xaf')][_0x6367('0x1e5')]=function(_0x4e2f4e){var _0x2cec94=this;return function(_0x3fbf54){return new BPromise(function(_0x248d72,_0x376457){_[_0x6367('0x96')](_0x4e2f4e,_0x3fbf54[0x0]);if(checkGetDataPredictive(_0x3fbf54[0x0])){loggerPredictive['info'](JSON[_0x6367('0x4d')](_0x3fbf54[0x0]));if(_0x4e2f4e[_0x6367('0x1d7')]===_0x6367('0x1d8')){return _0x2cec94[_0x6367('0xcf')](_0x4e2f4e['id'])['then'](function(_0x48c048){var _0x1f02d7=_0x4e2f4e[_0x6367('0x1e6')]-_0x48c048[0x0][_0x6367('0x1e7')];var _0x1f893e=_0x4e2f4e['dialPredictiveInterval']*0x3c;var _0x121333=_0x3fbf54[0x0][_0x6367('0x90')]+_0x3fbf54[0x0][_0x6367('0x71')];var _0x32a87e=(_0x3fbf54[0x0][_0x6367('0x70')]+_0x3fbf54[0x0][_0x6367('0x72')]+_0x3fbf54[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3fbf54[0x0]['predictiveIntervalTotalCalls'];var _0x3269e4=_0x4e2f4e[_0x6367('0x1cd')]/0x64;_0x4e2f4e[_0x6367('0x76')]=_0x48c048[0x0][_0x6367('0x1e7')]||0x0;_0x4e2f4e[_0x6367('0x74')]=_0x32a87e>0x0?_0x32a87e:0x1;return _0x2cec94['abandonmentRate'](_0x1f02d7,_0x1f893e,_0x121333,_0x32a87e,_0x3269e4);})[_0x6367('0x3f')](function(_0x47d193){return _0x248d72(_0x47d193);})[_0x6367('0xb9')](function(_0x34b9f2){return _0x376457(msgResponse('[CatchErlangB]',_0x6367('0x14b'),JSON['stringify'](_0x34b9f2)));});}if(_0x4e2f4e['dialPredictiveOptimization']==='agentBusyFactor'){return _0x2cec94[_0x6367('0xcf')](_0x4e2f4e['id'])[_0x6367('0x3f')](function(_0x4045d3){var _0x52a7a5=_0x4e2f4e[_0x6367('0x1e6')]-_0x4045d3[0x0][_0x6367('0x1e7')];var _0x195dde=_0x4e2f4e[_0x6367('0x1d5')]*0x3c;var _0x1d9fd3=_0x3fbf54[0x0]['predictiveIntervalAvgTalktime']+_0x3fbf54[0x0][_0x6367('0x71')];var _0x26508b=(_0x3fbf54[0x0][_0x6367('0x70')]+_0x3fbf54[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3fbf54[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3fbf54[0x0][_0x6367('0x78')];var _0x351fbe=_0x4e2f4e[_0x6367('0x1cd')]/0x64;_0x4e2f4e[_0x6367('0x76')]=_0x4045d3[0x0][_0x6367('0x1e7')]||0x0;_0x4e2f4e['predictiveIntervalHitRate']=_0x26508b>0x0?_0x26508b:0x1;return _0x2cec94[_0x6367('0x1e2')](_0x52a7a5,_0x195dde,_0x1d9fd3,_0x26508b,_0x351fbe);})[_0x6367('0x3f')](function(_0x4ec9e4){return _0x248d72(_0x4ec9e4);})[_0x6367('0xb9')](function(_0x931c1c){return _0x376457(msgResponse(_0x6367('0x1e8'),_0x6367('0x14b'),JSON[_0x6367('0x4d')](_0x931c1c)));});}}else{return _0x376457(msgResponse(_0x6367('0x1e4'),_0x6367('0x14b'),_0x6367('0x1e9')));}});};};Dialer[_0x6367('0xaf')]['startMethodPredictive']=function(_0x12cd52){var _0x16728c=this;return function(){var _0x3bf9b2=0x0;var _0x4bea30=Math['floor'](_0x12cd52['erlangCallToSecond']*0x3e8);if(_0x4bea30>0x0){_0x4bea30=_0x4bea30<0x64?0x64:_0x4bea30;loggerPredictive[_0x6367('0x86')](_0x12cd52[_0x6367('0x43')],_0x6367('0x1ea'),_0x4bea30,_0x6367('0x4e'));_0x12cd52[_0x6367('0x99')]=setInterval(function(){_0x16728c['handlePredictive'](_0x12cd52);loggerPredictiveCalls[_0x6367('0x86')]('[handlePredictive]',_0x3bf9b2+=0x1);},_0x4bea30);}else{loggerPredictive[_0x6367('0x86')](_0x12cd52['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x6367('0xaf')][_0x6367('0x1eb')]=function(_0x20aabd,_0x5ed900){var _0x20d10f=this;return function(_0x47e4db){if(_[_0x6367('0x4b')](_0x47e4db)){if(_['isNil'](_0x5ed900[_0x6367('0xdc')])||!_0x5ed900[_0x6367('0x1ec')]){if(_0x20aabd['dialMethod']===_0x6367('0x9')){_0x20aabd[_0x6367('0x134')]=_['isUndefined'](_0x20aabd[_0x6367('0x134')])?!![]:_0x20aabd[_0x6367('0x134')];var _0x6a5186=uuid['v4']();_0x20d10f[_0x6367('0xb3')][_0x6a5186]=new Action(_0x20aabd,_0x5ed900,_0x6a5186);loggerBooked[_0x6367('0x86')]('[booked][checkContactBlack]',_0x6a5186,_0x6367('0x1ed'),JSON[_0x6367('0x4d')](_0x20aabd['queueStatusComplete']),'Queue:\x20',_0x20aabd[_0x6367('0x43')]);if(_0x20aabd['queueStatusComplete']){_0x20aabd[_0x6367('0x134')]=![];_0x20d10f[_0x6367('0x2b')][_0x20d10f[_0x6367('0xb3')][_0x6a5186][_0x6367('0xbd')]]=[];ami[_0x6367('0x150')]({'actionid':_0x6a5186,'action':_0x6367('0x1ee'),'queue':_0x20aabd[_0x6367('0x43')]})['catch'](function(){_0x20d10f[_0x6367('0xbc')](_0x20aabd);_0x20d10f['rescheduleContact']({'active':![],'ContactId':_0x20d10f['actions'][_0x6a5186][_0x6367('0x108')],'ListId':_0x20d10f[_0x6367('0xb3')][_0x6a5186][_0x6367('0xdb')],'VoiceQueueId':_0x20d10f[_0x6367('0xb3')][_0x6a5186][_0x6367('0xdd')]||undefined,'CampaignId':_0x20d10f['actions'][_0x6a5186]['CampaignId']||undefined})[_0x6367('0xb9')](loggerCatch(_0x6367('0x1ef')));delete _0x20d10f['actions'][_0x6a5186];});}else{loggerBooked['info'](_0x6367('0x1f0'),JSON[_0x6367('0x4d')](_0x20aabd[_0x6367('0x134')]),_0x6367('0x1f1'),_0x20aabd['name']);_0x20d10f[_0x6367('0xbc')](_0x20aabd);_0x20d10f[_0x6367('0xc6')]({'active':![],'ContactId':_0x20d10f[_0x6367('0xb3')][_0x6a5186][_0x6367('0x108')],'ListId':_0x20d10f[_0x6367('0xb3')][_0x6a5186][_0x6367('0xdb')],'VoiceQueueId':_0x20d10f[_0x6367('0xb3')][_0x6a5186][_0x6367('0xdd')]||undefined,'CampaignId':_0x20d10f[_0x6367('0xb3')][_0x6a5186][_0x6367('0x109')]||undefined})[_0x6367('0xb9')](loggerCatch(_0x6367('0x1ef')));delete _0x20d10f[_0x6367('0xb3')][_0x6a5186];}}else{return _0x20d10f[_0x6367('0x170')](_0x20aabd,_0x5ed900);}}else{if(getDiff(_0x5ed900['scheduledat'])<_0x20aabd[_0x6367('0x1f2')]*0x3c){if(_0x5ed900['Agent']&&!_0x5ed900[_0x6367('0x162')][_0x6367('0x1f3')]){_0x20d10f[_0x6367('0x22')][_0x6367('0x140')](_0x5ed900['id'])[_0x6367('0x20')](function(){_0x20d10f[_0x6367('0xbc')](_0x20aabd);});}else{_0x20d10f[_0x6367('0xc8')]({'active':![]},_0x5ed900['id'],0x1)[_0x6367('0x20')](function(){_0x20d10f['updateOriginated'](_0x20aabd);});}}else{_0x20aabd[_0x6367('0x6d')]+=0x1;_0x20d10f[_0x6367('0xbc')](_0x20aabd);if(_0x20aabd[_0x6367('0x1f4')]){_0x20d10f[_0x6367('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5ed900[_0x6367('0x108')],'ListId':_0x5ed900[_0x6367('0xdb')],'VoiceQueueId':_0x5ed900[_0x6367('0xdd')]||undefined,'CampaignId':_0x5ed900[_0x6367('0x109')]||undefined})['catch'](loggerCatch(_0x6367('0x1f5')));_0x20d10f[_0x6367('0xd3')](createObjHistory(_0x20aabd,_0x5ed900,_0x6367('0x1f6'),0x17,'RecallInQueue'))[_0x6367('0xb9')](loggerCatch(_0x6367('0x1f7')));}else{_0x20d10f[_0x6367('0xe4')](createObjHistory(_0x20aabd,_0x5ed900,'RECALLFAILEDTIMEOUT',0x16,_0x6367('0x1f8')),_0x6367('0x1f9'),_0x6367('0x1fa'));}}}}else{_0x20aabd[_0x6367('0x64')]+=0x1;_0x20d10f[_0x6367('0xe4')](createObjHistory(_0x20aabd,_0x5ed900,'BLACKLIST',0xd,_0x6367('0x1fb')),'[Originate][historyBlacklist]',_0x6367('0x1fc'));throw'inBlackList';}};};Dialer[_0x6367('0xaf')][_0x6367('0x166')]=function(_0x1764d1){var _0x152aa4=this;var _0x358b78=_0x1764d1[_0x6367('0x1fd')]-_0x1764d1['originated']-_0x1764d1['temp'];emitCampaignSummary(_0x1764d1);if(_0x358b78>0x0){if(_0x358b78>this[_0x6367('0x26')]){_0x358b78=this[_0x6367('0x26')];}_0x1764d1[_0x6367('0xcb')]+=_0x358b78;this[_0x6367('0xcd')](_0x1764d1['id'],_0x358b78,_0x1764d1[_0x6367('0x1fe')],_0x1764d1)['then'](function(_0x536b36){_0x1764d1['temp']-=_0x358b78;_0x1764d1['temp']=_0x1764d1[_0x6367('0xcb')]>0x0?_0x1764d1[_0x6367('0xcb')]:0x0;if(!checkContactEmpty(_0x536b36)){_0x1764d1[_0x6367('0x42')]=_0x6367('0xa4');logger['info']('[getContactCampaign2][Empty]'+_0x1764d1[_0x6367('0x43')]);}else{_0x1764d1['originated']+=_0x536b36[_0x6367('0x13a')];_0x1764d1[_0x6367('0x42')]=_0x6367('0x1ff');for(var _0x457b75=0x0;_0x457b75<_0x536b36[_0x6367('0x13a')];_0x457b75+=0x1){_0x1764d1[_0x6367('0x200')]+=0x1;if(_[_0x6367('0xb6')](_0x536b36[_0x457b75])||_['isNil'](_0x536b36[_0x457b75][_0x6367('0x189')])||_[_0x6367('0xb6')](_0x536b36[_0x457b75][_0x6367('0x189')][_0x6367('0x173')])){_0x152aa4[_0x6367('0xd8')](_0x6367('0x201'),_0x1764d1,_0x536b36[_0x457b75]);}else{_0x152aa4[_0x6367('0xc2')](_[_0x6367('0xda')](_0x536b36[_0x457b75],[_0x6367('0x109'),'Contact.phone']))['then'](_0x152aa4['checkContactBlack'](_0x1764d1,_0x536b36[_0x457b75]))['catch'](_0x152aa4[_0x6367('0xd7')]('[actionOriginateIvr]\x20',_0x1764d1));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x1764d1,_0x358b78));}};Dialer[_0x6367('0xaf')][_0x6367('0x15d')]=function(_0x3fcfa1,_0x3bf1a8){var _0x542c6c=this;var _0x458dbf=[];var _0x148b2f=_0x3bf1a8>=0x1?_0x3bf1a8:0x1;if(_0x3fcfa1[_0x6367('0x5f')]===_0x6367('0x9')){_0x148b2f=0x1;}var _0x31973b=Math[_0x6367('0x1d1')](_0x3fcfa1['available']*_0x148b2f)-_0x3fcfa1[_0x6367('0x79')]-_0x3fcfa1[_0x6367('0xcb')];emitVoiceQueueSummary(_0x3fcfa1);if(_0x3fcfa1['dialLimitQueue']>0x0){var _0x48c192=_0x3fcfa1[_0x6367('0x202')]-_0x3fcfa1[_0x6367('0x79')]-_0x3fcfa1['talking']-_0x3fcfa1[_0x6367('0xcb')]-_0x3fcfa1[_0x6367('0x54')];if(_0x31973b>_0x48c192){_0x31973b=_0x48c192;}}if(_0x31973b>0x0){if(_0x3fcfa1[_0x6367('0x5f')]===_0x6367('0x9')){_0x31973b=0x1;}if(_0x31973b>this[_0x6367('0x26')]){_0x31973b=this[_0x6367('0x26')];}_0x3fcfa1[_0x6367('0xcb')]+=_0x31973b;for(var _0x15b51d in this[_0x6367('0x24')]){if(typeof this[_0x6367('0x24')][_0x15b51d]!=='undefined'){if(this[_0x6367('0x24')][_0x15b51d][_0x6367('0xab')]==='not_inuse'&&this[_0x6367('0x24')][_0x15b51d][_0x6367('0xb7')]===_0x6367('0x203')){_0x458dbf[_0x6367('0x132')](this['agents'][_0x15b51d]['id']);}}}this[_0x6367('0xca')](_0x3fcfa1['id'],_0x458dbf,_0x31973b,_0x3fcfa1[_0x6367('0x1fe')],_0x3fcfa1)[_0x6367('0x3f')](function(_0x596996){_0x3fcfa1[_0x6367('0xcb')]-=_0x31973b;_0x3fcfa1[_0x6367('0xcb')]=_0x3fcfa1[_0x6367('0xcb')]>0x0?_0x3fcfa1[_0x6367('0xcb')]:0x0;if(!checkContactEmpty(_0x596996)){_0x542c6c[_0x6367('0xc0')](_0x3fcfa1)[_0x6367('0x3f')](sendMessageReschedule(_0x3fcfa1))[_0x6367('0xb9')](loggerCatch(_0x6367('0x204')));}else{_0x3fcfa1[_0x6367('0x79')]+=_0x596996['length'];_0x3fcfa1[_0x6367('0x42')]=_0x3fcfa1[_0x6367('0x5f')]==='booked'?_0x6367('0x17b'):_0x6367('0x1ff');for(var _0xa9c5e8=0x0;_0xa9c5e8<_0x596996['length'];_0xa9c5e8+=0x1){if(_[_0x6367('0xb6')](_0x596996[_0xa9c5e8])||_[_0x6367('0xb6')](_0x596996[_0xa9c5e8][_0x6367('0x189')])||_['isNil'](_0x596996[_0xa9c5e8][_0x6367('0x189')][_0x6367('0x173')])){_0x542c6c[_0x6367('0xd8')]('[actionOriginate]\x20',_0x3fcfa1,_0x596996[_0xa9c5e8]);}else{_0x542c6c['checkIsBlackList'](_[_0x6367('0xda')](_0x596996[_0xa9c5e8],[_0x6367('0xdd'),'Contact.phone']))[_0x6367('0x3f')](_0x542c6c[_0x6367('0x1eb')](_0x3fcfa1,_0x596996[_0xa9c5e8]))['catch'](_0x542c6c[_0x6367('0xd7')]('[actionOriginate]\x20',_0x3fcfa1));}}}})[_0x6367('0xb9')](loggerGetContactDialer(_0x6367('0x205'),_0x3fcfa1,_0x31973b));}};Dialer['prototype'][_0x6367('0x99')]=function(_0x4b3563){if(_0x4b3563[_0x6367('0x202')]>0x0){var _0x4196d4=_0x4b3563[_0x6367('0x202')]-_0x4b3563['originated']-_0x4b3563[_0x6367('0x58')];if(_0x4196d4>0x0){this[_0x6367('0x206')](_0x4b3563);}else{loggerPredictiveCalls['info'](_0x6367('0x207'));}}else{this[_0x6367('0x206')](_0x4b3563);}};Dialer[_0x6367('0xaf')][_0x6367('0x206')]=function(_0x29e797){var _0x4b5a6c=this;var _0x11e641=[];_0x29e797[_0x6367('0x79')]+=0x1;for(var _0x3ed28d in this[_0x6367('0x24')]){if(typeof this[_0x6367('0x24')][_0x3ed28d]!==_0x6367('0xb5')){if(this[_0x6367('0x24')][_0x3ed28d][_0x6367('0xab')]===_0x6367('0x208')&&this[_0x6367('0x24')][_0x3ed28d]['status']===_0x6367('0x203')){_0x11e641[_0x6367('0x132')](this['agents'][_0x3ed28d]['id']);}}}this[_0x6367('0xca')](_0x29e797['id'],_0x11e641,0x1,_0x29e797[_0x6367('0x1fe')],_0x29e797)[_0x6367('0x3f')](function(_0x390496){if(!checkContactEmpty(_0x390496)){checkContactLowerLimitOriginate(_0x29e797,0x1,0x0);_0x4b5a6c[_0x6367('0xc0')](_0x29e797)[_0x6367('0x3f')](sendMessageReschedule(_0x29e797))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x29e797['message']=_0x6367('0x1ff');if(_['isNil'](_0x390496[0x0])||_[_0x6367('0xb6')](_0x390496[0x0][_0x6367('0x189')])||_[_0x6367('0xb6')](_0x390496[0x0][_0x6367('0x189')][_0x6367('0x173')])){_0x4b5a6c[_0x6367('0xd8')](_0x6367('0x201'),_0x29e797,_0x390496[0x0]);}else{_0x4b5a6c[_0x6367('0xc1')](_['pick'](_0x390496[0x0],[_0x6367('0xdd'),_0x6367('0x209')]))['then'](_0x4b5a6c[_0x6367('0x1eb')](_0x29e797,_0x390496[0x0]))[_0x6367('0xb9')](_0x4b5a6c[_0x6367('0xd7')](_0x6367('0x20a'),_0x29e797));}}})[_0x6367('0xb9')](loggerGetContactDialer(_0x6367('0x20b'),_0x29e797,0x1));emitVoiceQueueSummary(_0x29e797);};Dialer['prototype'][_0x6367('0x20c')]=function(_0x239186,_0x1866c7,_0x21ecd8,_0x47f85d,_0x300d59,_0xf2e026){loggerPredictive[_0x6367('0x86')](_0x6367('0x20d'));loggerPredictive[_0x6367('0x86')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x239186);loggerPredictive[_0x6367('0x86')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1866c7);loggerPredictive['info'](_0x6367('0x20e'),_0x21ecd8);loggerPredictive[_0x6367('0x86')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x47f85d);loggerPredictive['info'](_0x6367('0x20f'),_0x300d59);loggerPredictive[_0x6367('0x86')](_0x6367('0x8f'));return new BPromise(function(_0x563e61,_0x476f8b){if(_0x239186<=0x0||isNaN(_0x239186)){return _0x476f8b(msgResponse(_0x6367('0x210'),_0x6367('0x4c'),_0x6367('0x211')+_0x239186));}if(_0x21ecd8<=0x0||isNaN(_0x21ecd8)){return _0x476f8b(msgResponse(_0x6367('0x210'),'Error',_0x6367('0x212')+_0x21ecd8));}if(_0x47f85d<=0x0||isNaN(_0x47f85d)){return _0x476f8b(msgResponse('[abandonmentRate]',_0x6367('0x4c'),_0x6367('0x213')+_0x47f85d));}if(_0x1866c7<=0x0||isNaN(_0x1866c7)){return _0x476f8b(msgResponse(_0x6367('0x210'),_0x6367('0x4c'),_0x6367('0x214')+_0x1866c7));}if(_0x300d59<=0x0||isNaN(_0x300d59)){return _0x476f8b(msgResponse(_0x6367('0x210'),_0x6367('0x4c'),_0x6367('0x215')+_0x300d59));}_0xf2e026=_0xf2e026||0x0;var _0x12b06d=0x1/_0x21ecd8;var _0xd64c9b=0x0;var _0x3fb5cb=0x0;var _0x324e79=0x0;var _0x478196=0x0;for(var _0x96b835=0x0;_0x324e79<_0x300d59;_0x96b835+=0x1){_0x3fb5cb=_0x96b835/_0x1866c7;_0xd64c9b=(_0x47f85d*_0x3fb5cb+_0xf2e026)/_0x12b06d;_0x324e79=erlangb(_0xd64c9b,_0x239186);_0x478196=_0xd64c9b/_0x239186*(0x1-erlangb(_0xd64c9b,_0x239186));}return _0x563e61({'erlangCalls':_0x96b835,'erlangCallToSecond':_0x1866c7/_0x96b835,'erlangAbandonmentRate':_0x324e79,'erlangBusyFactor':_0x478196});});};Dialer[_0x6367('0xaf')][_0x6367('0x1e2')]=function(_0x555a47,_0x356f15,_0x558605,_0x5542b8,_0x5f0f94,_0x507a90){loggerPredictive[_0x6367('0x86')](_0x6367('0x216'));loggerPredictive[_0x6367('0x86')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x555a47);loggerPredictive[_0x6367('0x86')](_0x6367('0x217'),_0x356f15);loggerPredictive['info'](_0x6367('0x20e'),_0x558605);loggerPredictive[_0x6367('0x86')](_0x6367('0x218'),_0x5542b8);loggerPredictive['info'](_0x6367('0x219'),_0x5f0f94);loggerPredictive[_0x6367('0x86')](_0x6367('0x8f'));return new BPromise(function(_0x3e5204,_0x512e2c){if(_0x555a47<=0x0||isNaN(_0x555a47)){return _0x512e2c(msgResponse(_0x6367('0x21a'),_0x6367('0x4c'),'m\x20=\x20'+_0x555a47));}if(_0x558605<=0x0||isNaN(_0x558605)){return _0x512e2c(msgResponse(_0x6367('0x21a'),_0x6367('0x4c'),'Ts\x20=\x20'+_0x558605));}if(_0x5542b8<=0x0||isNaN(_0x5542b8)){return _0x512e2c(msgResponse(_0x6367('0x21a'),_0x6367('0x4c'),_0x6367('0x213')+_0x5542b8));}if(_0x356f15<=0x0||isNaN(_0x356f15)){return _0x512e2c(msgResponse(_0x6367('0x21a'),'Error',_0x6367('0x214')+_0x356f15));}if(_0x5f0f94<=0x0||isNaN(_0x5f0f94)){return _0x512e2c(msgResponse(_0x6367('0x21a'),_0x6367('0x4c'),_0x6367('0x21b')+_0x5f0f94));}_0x507a90=_0x507a90||0x0;var _0x1a1fa5=0x1/_0x558605;var _0x1446b2=0x0;var _0x1ede61=0x0;var _0x1d268e=0x0;var _0x4e70a2=0x0;for(var _0x4d2180=0x0;_0x4e70a2<_0x5f0f94;_0x4d2180+=0x1){_0x1ede61=_0x4d2180/_0x356f15;_0x1446b2=(_0x5542b8*_0x1ede61+_0x507a90)/_0x1a1fa5;_0x1d268e=erlangb(_0x1446b2,_0x555a47);_0x4e70a2=_0x1446b2/_0x555a47*(0x1-erlangb(_0x1446b2,_0x555a47));}return _0x3e5204({'erlangCalls':_0x4d2180,'erlangCallToSecond':_0x356f15/_0x4d2180,'erlangAbandonmentRate':_0x1d268e,'erlangBusyFactor':_0x4e70a2});});};module['exports']=Dialer; \ No newline at end of file +var _0x2f6c=['responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','queueCallerAbandonCreateState','countdropretry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','strategy','rrmemory','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','content','true','Action','indexOf','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','handleIvr','dialGlobalInterval','dialTimezone','dialPreviewRecallmeReminder','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originate][error]','originate\x20action\x20Error','response','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','dialPredictiveOptimization','outboundQueuePauses','agentBusyFactor','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','Interval','Error','stringify','milliseconds','seconds','emit','outbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','diff','clearing\x20variable\x20start\x20progressive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','is\x20disactive','state','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','isNil','status','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','pick','ContactId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','isTrunkReachable','trunks','SIP/%s','reachable','unmonitored','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','uniqueid','outboundAnswerAgiCallsDay','statedesc','HangupInAMD','membername','AMD','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','countglobal','amd','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','custom:amd','[syncHangupInAMDIvr]','Machine','countbusyretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime'];(function(_0x6da6f0,_0xc2f7d7){var _0x305d0d=function(_0x34c183){while(--_0x34c183){_0x6da6f0['push'](_0x6da6f0['shift']());}};_0x305d0d(++_0xc2f7d7);}(_0x2f6c,0x103));var _0xc2f6=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x2f6c[_0x221b8c];return _0x3fab9f;};'use strict';var util=require(_0xc2f6('0x0'));var _=require(_0xc2f6('0x1'));var BPromise=require(_0xc2f6('0x2'));var uuid=require(_0xc2f6('0x3'));var moment=require(_0xc2f6('0x4'));var rr=require('rr');var md5=require(_0xc2f6('0x5'));var Redis=require(_0xc2f6('0x6'));var ut=require(_0xc2f6('0x7'));var config=require(_0xc2f6('0x8'));var logger=require(_0xc2f6('0x9'))(_0xc2f6('0xa'));var loggerBooked=require(_0xc2f6('0x9'))(_0xc2f6('0xb'));var loggerPredictive=require(_0xc2f6('0x9'))(_0xc2f6('0xc'));var loggerPredictiveCalls=require('../../../config/logger')(_0xc2f6('0xd'));var loggerSyncQueueSummary=require(_0xc2f6('0x9'))(_0xc2f6('0xe'));var ami=require(_0xc2f6('0xf'));config['redis']=_[_0xc2f6('0x10')](config['redis'],{'host':_0xc2f6('0x11'),'port':0x18eb});var io=require(_0xc2f6('0x12'))(new Redis(config[_0xc2f6('0x13')]));var cmHopper=require(_0xc2f6('0x14'));var cmHopperHistory=require(_0xc2f6('0x15'));var cmHopperBlack=require(_0xc2f6('0x16'));var voiceQueueRt=require(_0xc2f6('0x17'));var RpcSetting=require('../rpc/setting');var Action=require('./action');var History=require('./history');var Final=require(_0xc2f6('0x18'));var AgentComplete=require(_0xc2f6('0x19'));var QueueCallerAbandon=require(_0xc2f6('0x1a'));var Hangup=require(_0xc2f6('0x1b'));var ipAgi=process[_0xc2f6('0x1c')][_0xc2f6('0x1d')]||_0xc2f6('0x1e');var strategy={'rrmemory':'rrmemory','roundrobin':_0xc2f6('0x1f')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xc2f6('0x20')][_0xc2f6('0x21')]=function(_0x339559){this['tail']=this['tail']?this[_0xc2f6('0x22')][_0xc2f6('0x23')](_0x339559):_0x339559();};function Dialer(_0x299bc7,_0x30123c){this[_0xc2f6('0x24')]=new Sequence();this[_0xc2f6('0x25')]=_0x30123c;this['voiceQueues']=_0x299bc7[_0xc2f6('0x26')];this[_0xc2f6('0x27')]=_0x299bc7[_0xc2f6('0x27')];this[_0xc2f6('0x28')]=_0x299bc7['agents'];this['trunks']=_0x299bc7['trunks'];this[_0xc2f6('0x29')]=config[_0xc2f6('0x29')]||0x2;this[_0xc2f6('0x2a')]={};this[_0xc2f6('0x2b')]={};this[_0xc2f6('0x2c')]={};this[_0xc2f6('0x2d')]={};this[_0xc2f6('0x2e')]={};this[_0xc2f6('0x2f')]={};this[_0xc2f6('0x30')]={};this[_0xc2f6('0x31')]={};this[_0xc2f6('0x32')]={};this['queueBookedRR']={};ami['on'](_0xc2f6('0x33'),this[_0xc2f6('0x34')][_0xc2f6('0x35')](this));ami['on']('queuecallerabandon',this[_0xc2f6('0x36')][_0xc2f6('0x35')](this));ami['on'](_0xc2f6('0x37'),this[_0xc2f6('0x38')][_0xc2f6('0x35')](this));ami['on'](_0xc2f6('0x39'),this[_0xc2f6('0x3a')][_0xc2f6('0x35')](this));ami['on']('custom:queuesummary',this[_0xc2f6('0xe')][_0xc2f6('0x35')](this));ami['on'](_0xc2f6('0x3b'),this[_0xc2f6('0x3c')][_0xc2f6('0x35')](this));ami['on'](_0xc2f6('0x3d'),this[_0xc2f6('0x3e')]['bind'](this));ami['on']('varset',this[_0xc2f6('0x3f')][_0xc2f6('0x35')](this));ami['on'](_0xc2f6('0x40'),this[_0xc2f6('0x41')]['bind'](this));ami['on'](_0xc2f6('0x42'),this[_0xc2f6('0x43')][_0xc2f6('0x35')](this));this[_0xc2f6('0x44')]();this['loopClearZombieChannels']();RpcSetting[_0xc2f6('0x45')]()[_0xc2f6('0x46')](function(_0x267d5f){previewRecallmeReminderInterval=_0x267d5f[_0xc2f6('0x47')];});}function isNotNull(_0x83b35d){return _0x83b35d!==null&&!_[_0xc2f6('0x48')](_0x83b35d);}function checkIsLoggedIn(_0x26ae2a,_0x5cedc9){return function(){if(_0x5cedc9<=0x0){_0x26ae2a[_0xc2f6('0x49')]=_0xc2f6('0x4a');throw _0x26ae2a[_0xc2f6('0x4b')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x42de8b){return _0x42de8b;}function checkIsActive(_0x48cece,_0x3ee44e){return function(){if(!isActive(_0x3ee44e)){_0x48cece[_0xc2f6('0x49')]=_0xc2f6('0x4c');throw _0x48cece['name']+_0xc2f6('0x4d');}};}function checkInterval(_0x121a21){return function(){if(!isNotNull(_0x121a21['Interval'])){_0x121a21[_0xc2f6('0x49')]=_0xc2f6('0x4e');throw _0x121a21[_0xc2f6('0x4b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x121a21['Interval'][_0xc2f6('0x4f')])){_0x121a21['message']='INTERVAL_IS_NULL';throw _0x121a21[_0xc2f6('0x4b')]+_0xc2f6('0x50');}if(!isNotNull(_[_0xc2f6('0x51')](_0x121a21[_0xc2f6('0x52')][_0xc2f6('0x4f')]))){_0x121a21[_0xc2f6('0x49')]=_0xc2f6('0x4e');throw _0x121a21[_0xc2f6('0x4b')]+_0xc2f6('0x50');}};}function msgResponse(_0x17d003,_0x1359be,_0x1c3c52){return{'action':_0x17d003,'response':_0x1359be,'message':_0x1c3c52,'stack':_0x1c3c52};}function myreject(_0x57fd29){return function(_0x282a41){return _0x57fd29(msgResponse('[ifTime][Action]',_0xc2f6('0x53'),JSON[_0xc2f6('0x54')](_0x282a41)));};}function getSeconds(_0x47732a,_0x3b8082){var _0x50f08=moment(_0x47732a)[_0xc2f6('0x55')](0x0);var _0xeef82b=moment(_0x3b8082)['milliseconds'](0x0);return _0x50f08['diff'](_0xeef82b,_0xc2f6('0x56'));}function emit(_0xcf48ff,_0x202250,_0x212554){io['to'](_0xcf48ff)[_0xc2f6('0x57')](_0x202250,_0x212554);}function emitVoiceQueueSummary(_0x1b0af1){if(_0x1b0af1['type']===_0xc2f6('0x58')){var _0x38a881={'id':_0x1b0af1['id'],'name':_0x1b0af1[_0xc2f6('0x4b')],'strategy':_0x1b0af1['strategy'],'answered':_0x1b0af1[_0xc2f6('0x59')],'available':_0x1b0af1[_0xc2f6('0x5a')],'loggedIn':_0x1b0af1[_0xc2f6('0x5b')],'pTalking':_0x1b0af1['pTalking'],'sumBillable':_0x1b0af1[_0xc2f6('0x5c')],'sumDuration':_0x1b0af1[_0xc2f6('0x5d')],'sumHoldTime':_0x1b0af1[_0xc2f6('0x5e')]||0x0,'talking':_0x1b0af1[_0xc2f6('0x5f')],'total':_0x1b0af1[_0xc2f6('0x60')],'type':_0x1b0af1[_0xc2f6('0x61')],'unmanaged':_0x1b0af1['unmanaged'],'abandoned':_0x1b0af1[_0xc2f6('0x62')],'waiting':_0x1b0af1[_0xc2f6('0x63')],'loggedInDb':_0x1b0af1['loggedInDb'],'dialActive':_0x1b0af1[_0xc2f6('0x64')],'dialMethod':_0x1b0af1['dialMethod'],'dialOriginateCallerIdName':_0x1b0af1[_0xc2f6('0x65')],'dialOriginateCallerIdNumber':_0x1b0af1[_0xc2f6('0x66')],'dialOriginateTimeout':_0x1b0af1['dialOriginateTimeout'],'dialPrefix':_0x1b0af1['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1b0af1['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1b0af1[_0xc2f6('0x67')],'outboundBlacklistCallsDay':_0x1b0af1[_0xc2f6('0x68')],'outboundBusyCallsDay':_0x1b0af1[_0xc2f6('0x69')],'outboundCongestionCallsDay':_0x1b0af1[_0xc2f6('0x6a')],'outboundDropCallsDayACS':_0x1b0af1[_0xc2f6('0x6b')],'outboundDropCallsDayCallersExit':_0x1b0af1[_0xc2f6('0x6c')],'outboundDropCallsDayTimeout':_0x1b0af1['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1b0af1[_0xc2f6('0x6d')],'outboundNoSuchCallsDay':_0x1b0af1[_0xc2f6('0x6e')],'outboundOriginateFailureCallsDay':_0x1b0af1['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1b0af1[_0xc2f6('0x6f')],'outboundRejectCallsDay':_0x1b0af1[_0xc2f6('0x70')],'outboundUnknownCallsDay':_0x1b0af1[_0xc2f6('0x71')],'predictiveIntervalAnsweredCalls':_0x1b0af1[_0xc2f6('0x72')],'predictiveIntervalAvgHoldtime':_0x1b0af1[_0xc2f6('0x73')],'predictiveIntervalAvgTalktime':_0x1b0af1[_0xc2f6('0x74')],'predictiveIntervalDroppedCallsCallersExit':_0x1b0af1[_0xc2f6('0x75')],'predictiveIntervalDroppedCallsTimeout':_0x1b0af1['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1b0af1['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1b0af1['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1b0af1[_0xc2f6('0x76')],'predictiveIntervalMultiplicativeFactor':_0x1b0af1[_0xc2f6('0x77')],'predictiveIntervalPauses':_0x1b0af1[_0xc2f6('0x78')],'predictiveIntervalAvailable':_0x1b0af1[_0xc2f6('0x79')],'predictiveIntervalTotalCalls':_0x1b0af1[_0xc2f6('0x7a')],'message':_0x1b0af1[_0xc2f6('0x49')],'originated':_0x1b0af1[_0xc2f6('0x7b')],'erlangCalls':_0x1b0af1[_0xc2f6('0x7c')],'erlangCallToSecond':_0x1b0af1[_0xc2f6('0x7d')],'erlangAbandonmentRate':_0x1b0af1['erlangAbandonmentRate'],'erlangBusyFactor':_0x1b0af1['erlangBusyFactor'],'startPredictive':_0x1b0af1[_0xc2f6('0x2f')],'startProgressive':_0x1b0af1['startProgressive']};if(_0x1b0af1[_0xc2f6('0x7e')]){_0x38a881[_0xc2f6('0x7e')]={'id':_0x1b0af1['Trunk']['id'],'name':_0x1b0af1[_0xc2f6('0x7e')][_0xc2f6('0x4b')],'active':_0x1b0af1['Trunk'][_0xc2f6('0x7f')],'callerid':_0x1b0af1[_0xc2f6('0x7e')][_0xc2f6('0x80')]};}if(_0x1b0af1[_0xc2f6('0x52')]){_0x38a881[_0xc2f6('0x52')]={'id':_0x1b0af1[_0xc2f6('0x52')]['id'],'name':_0x1b0af1[_0xc2f6('0x52')]['name']};}var _0xeac182=md5(JSON[_0xc2f6('0x54')](_0x38a881));if(_0x1b0af1[_0xc2f6('0x5')]!==_0xeac182){_0x1b0af1[_0xc2f6('0x5')]=_0xeac182;emit(util[_0xc2f6('0x81')](_0xc2f6('0x82'),_0x38a881[_0xc2f6('0x4b')]),_0xc2f6('0x83'),_0x38a881);}}}function emitCampaignSummary(_0x3ef61f){if(_0x3ef61f[_0xc2f6('0x61')]==='ivr'){emit(util['format'](_0xc2f6('0x84'),_0x3ef61f[_0xc2f6('0x4b')]),_0xc2f6('0x85'),_0x3ef61f);}}function checkGetDataPredictive(_0x2cee35){if(isNotNull(_0x2cee35)&&!_[_0xc2f6('0x51')](_0x2cee35)){loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x87'));loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x88'),_0x2cee35['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cee35['predictiveIntervalAnsweredCalls']);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cee35[_0xc2f6('0x89')]);loggerPredictive[_0xc2f6('0x86')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cee35['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x8a'),_0x2cee35['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0xc2f6('0x8b'),_0x2cee35[_0xc2f6('0x74')]);loggerPredictive[_0xc2f6('0x86')]('---------------------------');if(_0x2cee35[_0xc2f6('0x7a')]>0x0){if(!_['isUndefined'](_0x2cee35[_0xc2f6('0x74')])&&_0x2cee35['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x8c'));if(!_[_0xc2f6('0x48')](_0x2cee35[_0xc2f6('0x73')])&&_0x2cee35['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xc2f6('0x86')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x8d'));}}else{loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x8e'));}return![];}function mergeDataErlangB(_0x5a8699){return function(_0x42d3bf){loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x8f'));loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x90'),_0x42d3bf[_0xc2f6('0x7c')]);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x91'),_0x42d3bf[_0xc2f6('0x7d')]);loggerPredictive['info'](_0xc2f6('0x92'),_0x42d3bf[_0xc2f6('0x93')]);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x94'),_0x42d3bf['erlangBusyFactor']);loggerPredictive[_0xc2f6('0x86')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42d3bf['erlangAbandonmentRate']);loggerPredictive[_0xc2f6('0x86')]('---------------------------');_['merge'](_0x5a8699,_0x42d3bf);};}function getDiff(_0x207743){var _0x342e5a=moment()['milliseconds'](0x0);var _0x1de640=moment(_0x207743)[_0xc2f6('0x55')](0x0);return _0x342e5a[_0xc2f6('0x95')](_0x1de640,'seconds');}function ifInterval(_0x477597,_0x203345){if(_[_0xc2f6('0x48')](_0x203345)){return![];}return getDiff(_0x203345)<_0x477597*0x3c;}function freeVariablesPredictive(_0x3fd086){if(isNotNull(_0x3fd086)){if(!_[_0xc2f6('0x48')](_0x3fd086['startProgressive'])){_0x3fd086[_0xc2f6('0x30')]=undefined;loggerPredictive[_0xc2f6('0x86')](_0x3fd086[_0xc2f6('0x4b')],_0xc2f6('0x96'));}if(!_[_0xc2f6('0x48')](_0x3fd086[_0xc2f6('0x2f')])){_0x3fd086['startPredictive']=undefined;loggerPredictive['info'](_0x3fd086[_0xc2f6('0x4b')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xc2f6('0x48')](_0x3fd086[_0xc2f6('0x97')])){clearInterval(_0x3fd086[_0xc2f6('0x97')]);_0x3fd086['handlePredictive']=undefined;loggerPredictive[_0xc2f6('0x86')](_0x3fd086['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x4b0f1e,_0x410141){if(_0x410141===0x0){return 0x0;}var _0x372f2e=0x1;for(var _0x58c992=0x1;_0x58c992<=_0x410141;_0x58c992+=0x1){_0x372f2e=0x1+_0x372f2e*_0x58c992/_0x4b0f1e;}return 0x1/_0x372f2e;}function isVoiceQueueOutbound(_0x5357ad){return _0x5357ad==='outbound';}function isNotPreview(_0x1797f0){return _0x1797f0!=='preview';}function isCampaignIvr(_0x3eed24){return _0x3eed24===_0xc2f6('0x98');}function getCallerId(_0x13c495,_0x4e3d39,_0xc3df2c){if(!_[_0xc2f6('0x48')](_0xc3df2c)&&typeof _0xc3df2c===_0xc2f6('0x99')&&!_[_0xc2f6('0x51')](_0xc3df2c)){if(!_[_0xc2f6('0x48')](_0x4e3d39)&&typeof _0x4e3d39==='string'&&!_[_0xc2f6('0x51')](_0x4e3d39)){return util[_0xc2f6('0x81')](_0xc2f6('0x9a'),_0x4e3d39,_0xc3df2c);}return util[_0xc2f6('0x81')](_0xc2f6('0x9a'),_0xc3df2c,_0xc3df2c);}if(!_[_0xc2f6('0x48')](_0x13c495)&&typeof _0x13c495===_0xc2f6('0x99')&&!_[_0xc2f6('0x51')](_0x13c495)){return _0x13c495;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x50e7e4,_0x2d0988){return function(_0x5366d0){freeVariablesPredictive(_0x2d0988);emitVoiceQueueSummary(_0x2d0988);emitCampaignSummary(_0x2d0988);loggerSyncQueueSummary[_0xc2f6('0x9b')](_0x50e7e4,util[_0xc2f6('0x9c')](_0x5366d0,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x31ff2e,_0x25e721){return function(_0x2e1625){loggerPredictive['error'](_0x25e721['name'],_0x31ff2e);loggerPredictive[_0xc2f6('0x9b')](_0x2e1625['stack']);freeVariablesPredictive(_0x25e721);};}function loggerCatch(_0x2e58dd){return function(_0x101d07){logger['error'](_0x2e58dd,util[_0xc2f6('0x9c')](_0x101d07,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1afdf0){return _0x1afdf0&&!_[_0xc2f6('0x48')](_0x1afdf0)&&_0x1afdf0[_0xc2f6('0x9d')]>0x0;}function decremetOriginate(_0x48b36c){if(!_[_0xc2f6('0x48')](_0x48b36c)&&_0x48b36c!==null){if(typeof _0x48b36c[_0xc2f6('0x7b')]!==_0xc2f6('0x9e')){if(_0x48b36c[_0xc2f6('0x7b')]>0x0){_0x48b36c['originated']-=0x1;}else{logger['error'](_0xc2f6('0x9f'));}}}else{logger[_0xc2f6('0x9b')](_0xc2f6('0xa0'));}}function checkContactLowerLimitOriginate(_0x48bba2,_0x466b98,_0x4ae36a){if(_0x466b98>_0x4ae36a){for(var _0x30c27e=0x0;_0x30c27e<_0x466b98-_0x4ae36a;_0x30c27e+=0x1){decremetOriginate(_0x48bba2);}}}function loggerGetContactDialer(_0x2a6a22,_0xb99578,_0x2ca2c4){return function(_0xb4c7ee){checkContactLowerLimitOriginate(_0xb99578,_0x2ca2c4,0x0);logger[_0xc2f6('0x9b')](_0x2a6a22,util[_0xc2f6('0x9c')](_0xb4c7ee,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x45b94a){return function(_0xdce5f1){if(isNotNull(_0xdce5f1)&&isNotNull(_0xdce5f1[0x0])){if(_0xdce5f1[0x0][_0xc2f6('0xa1')]>0x0){_0x45b94a[_0xc2f6('0x49')]=_0xc2f6('0xa2');logger['info'](_0xc2f6('0xa3')+_0x45b94a[_0xc2f6('0x4b')],_0xdce5f1[0x0][_0xc2f6('0xa1')],_0xc2f6('0xa4'));}else{_0x45b94a[_0xc2f6('0x49')]='AVAILABLE_CONTACTS_FINISHED';logger['info']('[getContactDialer2][Empty]'+_0x45b94a[_0xc2f6('0x4b')]);}}};}function notSendMessagesQueue(_0x113044){if(_0x113044[_0xc2f6('0xa5')]){freeVariablesPredictive(_0x113044);if(_0x113044[_0xc2f6('0x7b')]===0x0&&_0x113044['talking']===0x0&&_0x113044[_0xc2f6('0x63')]===0x0&&(_0x113044['pTalking']||0x0)===0x0){_0x113044['sendMessageOneNotActive']=![];_0x113044['available']=0x0;_0x113044[_0xc2f6('0x49')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xc2f6('0xa6'),_0x113044[_0xc2f6('0x4b')],_0xc2f6('0xa7'));}else{_0x113044[_0xc2f6('0x49')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xc2f6('0x9b')](_0xc2f6('0xa6'),_0x113044['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x113044);}}function notSendMessagesCampaign(_0x4400a0){if(_0x4400a0['sendMessageOneNotActive']){if(_0x4400a0[_0xc2f6('0x7b')]===0x0){_0x4400a0[_0xc2f6('0xa5')]=![];_0x4400a0[_0xc2f6('0x49')]=_0xc2f6('0x4c');loggerSyncQueueSummary[_0xc2f6('0x9b')](_0xc2f6('0xa8'),_0x4400a0[_0xc2f6('0x4b')],'is\x20not\x20active');}else{_0x4400a0[_0xc2f6('0x49')]=_0xc2f6('0xa9');loggerSyncQueueSummary[_0xc2f6('0x9b')](_0xc2f6('0xa8'),_0x4400a0[_0xc2f6('0x4b')],_0xc2f6('0xaa'));}emitCampaignSummary(_0x4400a0);}}function createObjHistory(_0x2db87f,_0x26eac4,_0x32673b,_0x935759,_0x220a02){_0x2db87f['message']=_0x32673b;var _0xa36e2f=new Action(_0x2db87f,_0x26eac4);var _0x43fefe=new History(_0xa36e2f);_0x43fefe[_0xc2f6('0xab')]=_0x935759;_0x43fefe['statedesc']=_0x220a02;_0x43fefe[_0xc2f6('0xac')]=_0xa36e2f[_0xc2f6('0xad')];return _0x43fefe;}Dialer[_0xc2f6('0x20')][_0xc2f6('0xae')]=function(){var _0x12091b=this;setInterval(function(){_0x12091b[_0xc2f6('0xaf')](_0x12091b[_0xc2f6('0x2d')],_0xc2f6('0xb0'));_0x12091b[_0xc2f6('0xaf')](_0x12091b['actions'],_0xc2f6('0xb1'));},0x32c8);};Dialer[_0xc2f6('0x20')][_0xc2f6('0xaf')]=function(_0x5964d2,_0x1b1739){var _0x57e87d=this;for(var _0x56dd3c in _0x5964d2){if(typeof _0x5964d2[_0x56dd3c]!==_0xc2f6('0x9e')){this[_0xc2f6('0x24')]['enqueue'](function(){if(!_[_0xc2f6('0xb2')](_0x5964d2[_0x56dd3c])){return ami['Action']({'action':_0xc2f6('0xb3'),'channel':_0x5964d2[_0x56dd3c]['channel']})[_0xc2f6('0xb4')](function(_0x2630a8){if(_0x2630a8['message']===_0xc2f6('0xb5')){setTimeout(function(){if(_0x5964d2[_0x56dd3c]&&_0x5964d2[_0x56dd3c][_0xc2f6('0x61')]!==_0xc2f6('0x98')){_0x57e87d['updateOriginated'](_0x57e87d['voiceQueues'][_0x5964d2[_0x56dd3c][_0xc2f6('0xb6')]]);logger[_0xc2f6('0x9b')](_0xc2f6('0xb7'),_0x1b1739,_0x56dd3c,_0x5964d2[_0x56dd3c][_0xc2f6('0xb6')]);delete _0x5964d2[_0x56dd3c];}if(_0x5964d2[_0x56dd3c]&&_0x5964d2[_0x56dd3c]['type']===_0xc2f6('0x98')){_0x57e87d[_0xc2f6('0xb8')](_0x57e87d['campaigns'][_0x5964d2[_0x56dd3c][_0xc2f6('0xb6')]]);logger['error'](_0xc2f6('0xb9'),_0x1b1739,_0x56dd3c,_0x5964d2[_0x56dd3c]['queue']);delete _0x5964d2[_0x56dd3c];}},0x2328);}});}});}}};Dialer[_0xc2f6('0x20')][_0xc2f6('0xba')]=function(_0xe6fffc){return BPromise[_0xc2f6('0xbb')]()['then'](cmHopper['countReScheduled'](_0xe6fffc))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xbc')));};Dialer[_0xc2f6('0x20')]['checkIsBlackList']=function(_0x4dbe74){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopperBlack[_0xc2f6('0xbd')](_0x4dbe74))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xbe')));};Dialer[_0xc2f6('0x20')][_0xc2f6('0xbf')]=function(_0x3fc78b){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopperBlack['checkIsBlackListIvr'](_0x3fc78b))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xc0')));};Dialer[_0xc2f6('0x20')]['averageHandleTime']=function(_0x592879){return BPromise['resolve']()[_0xc2f6('0x46')](cmHopperHistory[_0xc2f6('0xc1')](_0x592879))[_0xc2f6('0xb4')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xc2f6('0x20')][_0xc2f6('0xc2')]=function(_0x759963){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopper['rescheduleContact'](_0x759963))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xc3')));};Dialer[_0xc2f6('0x20')][_0xc2f6('0xc4')]=function(_0x52442b,_0x135a70,_0x4ec77d){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopper[_0xc2f6('0xc4')](_0x52442b,_0x135a70,_0x4ec77d))['catch'](loggerCatch(_0xc2f6('0xc5')));};Dialer[_0xc2f6('0x20')]['getContactDialer']=function(_0xb45218,_0x465317,_0x188bad,_0x1c9427,_0x2ef5cc){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopper[_0xc2f6('0xc6')](_0xb45218,_0x465317,_0x188bad,_0x1c9427))[_0xc2f6('0xb4')](function(_0x35c970){_0x2ef5cc[_0xc2f6('0xc7')]-=_0x188bad;_0x2ef5cc['temp']=_0x2ef5cc[_0xc2f6('0xc7')]>0x0?_0x2ef5cc['temp']:0x0;loggerCatch(_0xc2f6('0xc8'))(_0x35c970);});};Dialer[_0xc2f6('0x20')][_0xc2f6('0xc9')]=function(_0xd0e9da,_0x59679b,_0x30e630,_0xeac1e2){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopper['getContactDialerIvr'](_0xd0e9da,_0x59679b,_0x30e630))[_0xc2f6('0xb4')](function(_0x341f39){_0xeac1e2[_0xc2f6('0xc7')]-=_0x59679b;_0xeac1e2[_0xc2f6('0xc7')]=_0xeac1e2[_0xc2f6('0xc7')]>0x0?_0xeac1e2[_0xc2f6('0xc7')]:0x0;loggerCatch(_0xc2f6('0xca'))(_0x341f39);});};Dialer[_0xc2f6('0x20')][_0xc2f6('0xcb')]=function(_0x264361){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](voiceQueueRt['getVoiceQueueRtPauses'](_0x264361))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xcc')));};Dialer[_0xc2f6('0x20')][_0xc2f6('0xcd')]=function(_0x3880bb){return BPromise[_0xc2f6('0xbb')]()['then'](cmHopper[_0xc2f6('0xcd')](_0x3880bb))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0xc2f6('0xce')]=function(_0x435ef2){return BPromise['resolve']()[_0xc2f6('0x46')](cmHopperHistory[_0xc2f6('0xce')](_0x435ef2))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xcf')));};Dialer['prototype'][_0xc2f6('0xb8')]=function(_0x48c702){if(!_[_0xc2f6('0x48')](_0x48c702)&&_0x48c702!==null){if(typeof _0x48c702[_0xc2f6('0x7b')]!=='undefined'){if(_0x48c702[_0xc2f6('0x7b')]>0x0){_0x48c702['originated']-=0x1;}else{logger[_0xc2f6('0x9b')](_0xc2f6('0xd0'));}}}else{logger[_0xc2f6('0x9b')](_0xc2f6('0xd1'));}};Dialer[_0xc2f6('0x20')][_0xc2f6('0xd2')]=function(_0x52baee,_0x4b3643){var _0x30b609=this;return function(_0x31d316){_0x30b609[_0xc2f6('0xb8')](_0x4b3643);logger[_0xc2f6('0x9b')](_0x52baee,util[_0xc2f6('0x9c')](_0x31d316,{'showHidden':![],'depth':null}));};};Dialer[_0xc2f6('0x20')][_0xc2f6('0xd3')]=function(_0x78ea76,_0x5d927f,_0x4e76df){var _0xde507f={'state':0x19,'statedesc':_0xc2f6('0xd4')};this['updateOriginated'](_0x5d927f);this['saveInDb'](_[_0xc2f6('0xd5')](_0xde507f,_[_0xc2f6('0xd6')](_0x4e76df,[_0xc2f6('0xd7'),'ListId','UserId',_0xc2f6('0xd8'),_0xc2f6('0xd9')])),'[emptyContact][createHistory]',_0xc2f6('0xda'));logger[_0xc2f6('0x9b')](_0x78ea76);};Dialer[_0xc2f6('0x20')][_0xc2f6('0xdb')]=function(_0x15a794){return _0x15a794===_0xc2f6('0xdc');};Dialer[_0xc2f6('0x20')][_0xc2f6('0xdd')]=function(_0x8bb3fb){return!_[_0xc2f6('0x48')](_0x8bb3fb)&&_0x8bb3fb&&!_[_0xc2f6('0x48')](_0x8bb3fb[_0xc2f6('0x4b')])&&!_[_0xc2f6('0x48')](_0x8bb3fb[_0xc2f6('0x7f')])&&_0x8bb3fb[_0xc2f6('0x7f')]&&(this[_0xc2f6('0xde')][util[_0xc2f6('0x81')](_0xc2f6('0xdf'),_0x8bb3fb[_0xc2f6('0x4b')])][_0xc2f6('0xb3')]===_0xc2f6('0xe0')||this[_0xc2f6('0xde')][util[_0xc2f6('0x81')](_0xc2f6('0xdf'),_0x8bb3fb[_0xc2f6('0x4b')])][_0xc2f6('0xb3')]===_0xc2f6('0xe1'));};Dialer[_0xc2f6('0x20')]['saveInDb']=function(_0x1c0deb,_0x38b6a0,_0x5ab7bf){this[_0xc2f6('0xce')](_0x1c0deb)[_0xc2f6('0xb4')](loggerCatch(_0x38b6a0));this[_0xc2f6('0xcd')](_0x1c0deb)[_0xc2f6('0xb4')](loggerCatch(_0x5ab7bf));};Dialer[_0xc2f6('0x20')][_0xc2f6('0x3f')]=function(_0x376888){var _0xec3c2f=this['uniqueId'][_0x376888['uniqueid']];var _0x4139f5;if(!_[_0xc2f6('0xb2')](_0x376888)&&!_[_0xc2f6('0xb2')](_0x376888[_0xc2f6('0xe2')])&&!_['isNil'](_0x376888['variable'][_0xc2f6('0xe3')])&&_0x376888[_0xc2f6('0xe4')]===_0xc2f6('0xe5')&&_0xec3c2f){if(_0xec3c2f[_0xc2f6('0x61')]!==_0xc2f6('0x98')&&this['voiceQueues'][_0xec3c2f[_0xc2f6('0xb6')]][_0xc2f6('0xe6')]&&_0x376888['value']===_0xc2f6('0xe7')){delete this[_0xc2f6('0x2d')][_0x376888[_0xc2f6('0xe8')]];this[_0xc2f6('0xb8')](this['voiceQueues'][_0xec3c2f[_0xc2f6('0xb6')]]);this['voiceQueues'][_0xec3c2f[_0xc2f6('0xb6')]][_0xc2f6('0x67')]+=0x1;this[_0xc2f6('0x26')][_0xec3c2f['queue']][_0xc2f6('0xe9')]+=0x1;_0x4139f5=new Hangup(_0xec3c2f,_0x376888);_0x4139f5[_0xc2f6('0xab')]=0x12;_0x4139f5[_0xc2f6('0xea')]=_0xc2f6('0xeb');_0x4139f5[_0xc2f6('0xec')]=_0xc2f6('0xed');ami[_0xc2f6('0x57')]('custom:amd',ut[_0xc2f6('0xee')](_0x4139f5,'amd'));this[_0xc2f6('0xef')](_0x4139f5,_0xc2f6('0xf0'),_0xc2f6('0xf1'));}if(_0xec3c2f[_0xc2f6('0x61')]!==_0xc2f6('0x98')&&this[_0xc2f6('0x26')][_0xec3c2f['queue']][_0xc2f6('0xe6')]&&_0x376888[_0xc2f6('0xf2')]===_0xc2f6('0xf3')){var _0x22275f=this;return new BPromise(function(_0x408b49,_0xda202c){delete _0x22275f['uniqueId'][_0x376888[_0xc2f6('0xe8')]];_0x22275f['updateOriginated'](_0x22275f[_0xc2f6('0x26')][_0xec3c2f[_0xc2f6('0xb6')]]);_0x22275f[_0xc2f6('0x26')][_0xec3c2f[_0xc2f6('0xb6')]][_0xc2f6('0x67')]+=0x1;_0x22275f[_0xc2f6('0x26')][_0xec3c2f['queue']][_0xc2f6('0xe9')]+=0x1;var _0xfa7872=_0x22275f[_0xc2f6('0x26')][_0xec3c2f['queue']];var _0x1eab3b=new Hangup(_0xec3c2f,_0x376888);_0x1eab3b[_0xc2f6('0xab')]=0x13;_0x1eab3b[_0xc2f6('0xea')]='Machine';_0x1eab3b[_0xc2f6('0xec')]=_0xc2f6('0xed');_0x1eab3b['countmachineretry']+=0x1;_0x1eab3b[_0xc2f6('0xf4')]+=0x1;_0x1eab3b[_0xc2f6('0xf5')]=!![];ami[_0xc2f6('0x57')]('custom:amd',ut[_0xc2f6('0xee')](_0x1eab3b,_0xc2f6('0xf5')));_0x22275f[_0xc2f6('0xce')](_0x1eab3b)[_0xc2f6('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1eab3b['countbusyretry']+_0x1eab3b[_0xc2f6('0xf6')]+_0x1eab3b['countnoanswerretry']+_0x1eab3b[_0xc2f6('0xf7')]+_0x1eab3b['countdropretry']+_0x1eab3b[_0xc2f6('0xf8')]+_0x1eab3b[_0xc2f6('0xf9')]+_0x1eab3b['countagentrejectretry']>=_0xfa7872[_0xc2f6('0xfa')]){_0x22275f[_0xc2f6('0xfb')](_0x1eab3b,_0x408b49,_0xda202c,'reason19\x20machine....');}else{if(_0x1eab3b[_0xc2f6('0xf9')]>=_0xfa7872['dialMachineMaxRetry']){_0x22275f['createStateFinal'](_0x1eab3b,_0x408b49,_0xda202c,_0xc2f6('0xfc'));}else{_0x22275f[_0xc2f6('0xc2')]({'active':![],'countmachineretry':_0x1eab3b[_0xc2f6('0xf9')],'scheduledat':moment()[_0xc2f6('0xfd')](_0xfa7872[_0xc2f6('0xfe')],_0xc2f6('0xff'))['format'](_0xc2f6('0x100')),'ContactId':_0x1eab3b[_0xc2f6('0xd7')],'ListId':_0x1eab3b[_0xc2f6('0x101')],'VoiceQueueId':_0x1eab3b[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x1eab3b[_0xc2f6('0xd9')]||undefined})['catch'](loggerCatch(_0xc2f6('0x102')));_0x408b49({'reschedule':0x1});}}});}if(_0xec3c2f[_0xc2f6('0x61')]===_0xc2f6('0x98')&&this[_0xc2f6('0x27')][_0xec3c2f[_0xc2f6('0xb6')]][_0xc2f6('0xe6')]&&_0x376888[_0xc2f6('0xf2')]==='HANGUP'){delete this[_0xc2f6('0x2d')][_0x376888[_0xc2f6('0xe8')]];this['updateOriginated'](this[_0xc2f6('0x27')][_0xec3c2f[_0xc2f6('0xb6')]]);_0x4139f5=new Hangup(_0xec3c2f,_0x376888);_0x4139f5[_0xc2f6('0xab')]=0x12;_0x4139f5[_0xc2f6('0xea')]=_0xc2f6('0xeb');_0x4139f5[_0xc2f6('0xec')]=_0xc2f6('0xed');ami[_0xc2f6('0x57')](_0xc2f6('0x103'),ut[_0xc2f6('0xee')](_0x4139f5,_0xc2f6('0xf5')));this[_0xc2f6('0xef')](_0x4139f5,'[syncHangupInAMDIvr][createHistory]',_0xc2f6('0x104'));}if(_0xec3c2f[_0xc2f6('0x61')]==='ivr'&&this[_0xc2f6('0x27')][_0xec3c2f['queue']][_0xc2f6('0xe6')]&&_0x376888[_0xc2f6('0xf2')]===_0xc2f6('0xf3')){var _0x22275f=this;return new BPromise(function(_0x235e3b,_0xb9f0a6){delete _0x22275f[_0xc2f6('0x2d')][_0x376888['uniqueid']];_0x22275f[_0xc2f6('0xb8')](_0x22275f['campaigns'][_0xec3c2f['queue']]);_0x22275f['campaigns'][_0xec3c2f[_0xc2f6('0xb6')]]['outboundAnswerCallsDay']+=0x1;_0x22275f['campaigns'][_0xec3c2f[_0xc2f6('0xb6')]][_0xc2f6('0xe9')]+=0x1;var _0x20d366=_0x22275f[_0xc2f6('0x27')][_0xec3c2f['queue']];var _0x6b6a1=new Hangup(_0xec3c2f,_0x376888);_0x6b6a1['state']=0x13;_0x6b6a1[_0xc2f6('0xea')]=_0xc2f6('0x105');_0x6b6a1[_0xc2f6('0xec')]=_0xc2f6('0xed');_0x6b6a1[_0xc2f6('0xf9')]+=0x1;_0x6b6a1[_0xc2f6('0xf4')]+=0x1;_0x6b6a1[_0xc2f6('0xf5')]=!![];ami[_0xc2f6('0x57')](_0xc2f6('0x103'),ut[_0xc2f6('0xee')](_0x6b6a1,_0xc2f6('0xf5')));_0x22275f[_0xc2f6('0xce')](_0x6b6a1)[_0xc2f6('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x6b6a1[_0xc2f6('0x106')]+_0x6b6a1[_0xc2f6('0xf6')]+_0x6b6a1['countnoanswerretry']+_0x6b6a1[_0xc2f6('0xf7')]+_0x6b6a1['countdropretry']+_0x6b6a1[_0xc2f6('0xf8')]+_0x6b6a1['countmachineretry']+_0x6b6a1[_0xc2f6('0x107')]>=_0x20d366[_0xc2f6('0xfa')]){_0x22275f[_0xc2f6('0xfb')](_0x6b6a1,_0x235e3b,_0xb9f0a6,_0xc2f6('0x108'));}else{if(_0x6b6a1[_0xc2f6('0xf9')]>=_0x20d366[_0xc2f6('0x109')]){_0x22275f[_0xc2f6('0x10a')](_0x6b6a1,_0x235e3b,_0xb9f0a6,_0xc2f6('0xfc'));}else{_0x22275f[_0xc2f6('0xc2')]({'active':![],'countmachineretry':_0x6b6a1[_0xc2f6('0xf9')],'scheduledat':moment()['add'](_0x20d366[_0xc2f6('0xfe')],_0xc2f6('0xff'))['format'](_0xc2f6('0x100')),'ContactId':_0x6b6a1[_0xc2f6('0xd7')],'ListId':_0x6b6a1['ListId'],'VoiceQueueId':_0x6b6a1[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x6b6a1[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x102')));_0x235e3b({'reschedule':0x1});}}});}}};Dialer[_0xc2f6('0x20')][_0xc2f6('0x3c')]=function(_0x295d5c){var _0x1a65cf=this[_0xc2f6('0x2d')][_0x295d5c[_0xc2f6('0xe8')]];var _0x42fede=this;var _0xb02efd;if(_0x1a65cf&&_0x1a65cf[_0xc2f6('0x61')]===_0xc2f6('0x98')){delete this['uniqueId'][_0x295d5c['uniqueid']];this[_0xc2f6('0xb8')](this[_0xc2f6('0x27')][_0x1a65cf['queue']]);this[_0xc2f6('0x27')][_0x1a65cf[_0xc2f6('0xb6')]][_0xc2f6('0x10b')]+=0x1;_0xb02efd=new Hangup(_0x1a65cf,_0x295d5c);this['createHistory'](_0xb02efd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x10c')));this['moveContactManagedDialer'](_0xb02efd)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x1a65cf&&_0x1a65cf[_0xc2f6('0x61')]!==_0xc2f6('0x98')&&isNotNull(this[_0xc2f6('0x26')][_0x1a65cf['queue']][_0xc2f6('0x10d')])){delete this[_0xc2f6('0x2d')][_0x295d5c[_0xc2f6('0xe8')]];this[_0xc2f6('0xb8')](this['voiceQueues'][_0x1a65cf[_0xc2f6('0xb6')]]);this[_0xc2f6('0x26')][_0x1a65cf['queue']][_0xc2f6('0x67')]+=0x1;this['voiceQueues'][_0x1a65cf[_0xc2f6('0xb6')]][_0xc2f6('0xe9')]+=0x1;_0xb02efd=new Hangup(_0x1a65cf,_0x295d5c);_0xb02efd[_0xc2f6('0xab')]=0x10;_0xb02efd['statedesc']=_0xc2f6('0x10e');_0xb02efd[_0xc2f6('0xec')]=_0xc2f6('0x10f');this[_0xc2f6('0xce')](_0xb02efd)[_0xc2f6('0xb4')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xc2f6('0xcd')](_0xb02efd)['catch'](loggerCatch(_0xc2f6('0x110')));}if(_0x1a65cf&&_0x1a65cf['type']!==_0xc2f6('0x98')&&!isNotNull(this[_0xc2f6('0x26')][_0x1a65cf[_0xc2f6('0xb6')]][_0xc2f6('0x10d')])){delete this[_0xc2f6('0x2d')][_0x295d5c[_0xc2f6('0xe8')]];this['updateOriginated'](this[_0xc2f6('0x26')][_0x1a65cf[_0xc2f6('0xb6')]]);this[_0xc2f6('0x26')][_0x1a65cf[_0xc2f6('0xb6')]][_0xc2f6('0x71')]+=0x1;_0xb02efd=new Hangup(_0x1a65cf,_0x295d5c);_0xb02efd[_0xc2f6('0xab')]=0xc;_0xb02efd[_0xc2f6('0xea')]=_0x295d5c[_0xc2f6('0x111')];_0xb02efd[_0xc2f6('0xec')]=_0xc2f6('0x112');this[_0xc2f6('0xce')](_0xb02efd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x10c')));this[_0xc2f6('0xcd')](_0xb02efd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x110')));}};Dialer['prototype']['syncAgentComplete']=function(_0x3e2fd1){var _0x336880=this[_0xc2f6('0x2d')][_0x3e2fd1[_0xc2f6('0xe8')]];var _0x88f5fe=this;if(this['voiceQueues'][_0x3e2fd1['queue']]){if(_0x336880&&_0x336880[_0xc2f6('0x61')]!==_0xc2f6('0x98')){delete this[_0xc2f6('0x2d')][_0x3e2fd1[_0xc2f6('0xe8')]];this['voiceQueues'][_0x3e2fd1[_0xc2f6('0xb6')]]['outboundAnswerCallsDay']+=0x1;var _0x1a84a1=new AgentComplete(_0x336880,_0x3e2fd1);if(_0x3e2fd1[_0xc2f6('0x113')]===_0xc2f6('0x114')){_0x1a84a1[_0xc2f6('0x115')]=this[_0xc2f6('0x26')][_0x3e2fd1['queue']][_0xc2f6('0x116')]&&this[_0xc2f6('0x26')][_0x3e2fd1[_0xc2f6('0xb6')]][_0xc2f6('0x117')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xc2f6('0xce')](_0x1a84a1)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x118')));this[_0xc2f6('0xcd')](_0x1a84a1)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x119')));}}};Dialer[_0xc2f6('0x20')][_0xc2f6('0x34')]=function(_0x34c4a5){if(this[_0xc2f6('0x26')][_0x34c4a5[_0xc2f6('0xb6')]]){if(this[_0xc2f6('0x2d')][_0x34c4a5['uniqueid']]&&this[_0xc2f6('0x2d')][_0x34c4a5['uniqueid']][_0xc2f6('0x61')]!==_0xc2f6('0x98')){this[_0xc2f6('0xb8')](this[_0xc2f6('0x26')][_0x34c4a5[_0xc2f6('0xb6')]]);this[_0xc2f6('0x2d')][_0x34c4a5[_0xc2f6('0xe8')]][_0xc2f6('0x11a')]=moment()[_0xc2f6('0x81')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x574b3b){this['createHistory'](_0x574b3b)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x118')));this[_0xc2f6('0xcd')](_0x574b3b)['catch'](loggerCatch(_0xc2f6('0x11b')));};Dialer['prototype'][_0xc2f6('0x36')]=function(_0x2f9835){var _0x4eb452=this[_0xc2f6('0x2d')][_0x2f9835[_0xc2f6('0xe8')]];var _0x21a302=this;if(this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]]){if(_0x4eb452&&_0x4eb452[_0xc2f6('0x61')]!==_0xc2f6('0x98')){delete this[_0xc2f6('0x2d')][_0x2f9835[_0xc2f6('0xe8')]];this[_0xc2f6('0xb8')](this[_0xc2f6('0x26')][_0x2f9835['queue']]);_0x4eb452['droptime']=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));var _0x351bc9=new QueueCallerAbandon(_0x4eb452,_0x2f9835);if(getSeconds(_0x4eb452[_0xc2f6('0x11c')],_0x4eb452[_0xc2f6('0x11d')])>=_0x4eb452[_0xc2f6('0x11e')]){this[_0xc2f6('0x26')][_0x2f9835['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x11f')]+=0x1;this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x120')]+=0x1;_0x351bc9['state']=0xa;_0x351bc9['statedesc']=_0xc2f6('0x121');_0x351bc9[_0xc2f6('0x122')]='TIMEOUT';_0x351bc9['agiafterat']=this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x116')]?moment()[_0xc2f6('0x81')](_0xc2f6('0x100')):undefined;_0x351bc9['countdropretry']+=0x1;_0x351bc9[_0xc2f6('0xf4')]+=0x1;if(_0x351bc9['countdropretry']>=this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]]['dialDropMaxRetry']){this[_0xc2f6('0x123')](_0x351bc9);}else{this[_0xc2f6('0xc2')]({'active':![],'countdropretry':_0x351bc9[_0xc2f6('0x124')],'scheduledat':moment()[_0xc2f6('0xfd')](this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]]['dialDropRetryFrequency'],_0xc2f6('0xff'))[_0xc2f6('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4eb452['ContactId'],'ListId':_0x4eb452['ListId'],'VoiceQueueId':_0x4eb452[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x4eb452[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch('[rescheduleContact][Drop]'));var _0x3a060d=new History(_0x351bc9);_0x3a060d[_0xc2f6('0xab')]=0xa;_0x3a060d[_0xc2f6('0xea')]=_0xc2f6('0x121');_0x3a060d[_0xc2f6('0xad')]=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));_0x3a060d[_0xc2f6('0xac')]=_0x3a060d[_0xc2f6('0xad')];_0x3a060d['calleridname']=_0x351bc9[_0xc2f6('0x125')];_0x3a060d[_0xc2f6('0x126')]=_0x351bc9['calleridnum'];this[_0xc2f6('0xce')](_0x3a060d)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x127')));}}else{this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x75')]+=0x1;this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x6c')]+=0x1;_0x351bc9[_0xc2f6('0xab')]=0xb;_0x351bc9[_0xc2f6('0xea')]=_0xc2f6('0x128');_0x351bc9[_0xc2f6('0x122')]=_0xc2f6('0x129');_0x351bc9[_0xc2f6('0xf8')]+=0x1;_0x351bc9[_0xc2f6('0xf4')]+=0x1;if(_0x351bc9['countabandonedretry']>=this[_0xc2f6('0x26')][_0x2f9835['queue']][_0xc2f6('0x12a')]){this[_0xc2f6('0x123')](_0x351bc9);}else{this[_0xc2f6('0xc2')]({'active':![],'countabandonedretry':_0x351bc9[_0xc2f6('0xf8')],'scheduledat':moment()[_0xc2f6('0xfd')](this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x12b')],_0xc2f6('0xff'))[_0xc2f6('0x81')](_0xc2f6('0x100')),'ContactId':_0x4eb452['ContactId'],'ListId':_0x4eb452[_0xc2f6('0x101')],'VoiceQueueId':_0x4eb452[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x4eb452[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x12c')));var _0x3a060d=new History(_0x351bc9);_0x3a060d[_0xc2f6('0xab')]=0xb;_0x3a060d['statedesc']=_0xc2f6('0x128');_0x3a060d['starttime']=moment()['format'](_0xc2f6('0x100'));_0x3a060d[_0xc2f6('0xac')]=_0x3a060d[_0xc2f6('0xad')];_0x3a060d[_0xc2f6('0x125')]=_0x351bc9[_0xc2f6('0x125')];_0x3a060d['calleridnum']=_0x351bc9[_0xc2f6('0x126')];this[_0xc2f6('0xce')](_0x3a060d)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x12d')));}}}}};Dialer[_0xc2f6('0x20')][_0xc2f6('0x3e')]=function(_0x4ce60c){if(this['actions'][_0x4ce60c[_0xc2f6('0xe8')]]){this[_0xc2f6('0x2b')][_0x4ce60c['uniqueid']][_0xc2f6('0x12e')]=_0x4ce60c['channel'];}if(this['uniqueId'][_0x4ce60c['uniqueid']]){this[_0xc2f6('0x2d')][_0x4ce60c[_0xc2f6('0xe8')]][_0xc2f6('0x12e')]=_0x4ce60c[_0xc2f6('0x12e')];}};Dialer[_0xc2f6('0x20')]['syncQueueMember']=function(_0x1c3db7){if(strategy[this[_0xc2f6('0x26')][this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]['strategy']]==='roundrobin'){if(this[_0xc2f6('0x2b')][_0x1c3db7['actionid']]&&_[_0xc2f6('0xb2')](this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0x130')])&&_0x1c3db7['status']==='1'&&_0x1c3db7[_0xc2f6('0x131')]==='0'){if(this['agents'][_0x1c3db7[_0xc2f6('0x132')]]){if(!this[_0xc2f6('0x28')][_0x1c3db7[_0xc2f6('0x132')]][_0xc2f6('0x130')]){this['agents'][_0x1c3db7[_0xc2f6('0x132')]][_0xc2f6('0x130')]=!![];this['actions'][_0x1c3db7['actionid']][_0xc2f6('0x130')]=!![];this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0x132')]=_0x1c3db7[_0xc2f6('0x132')];}}}}else if((strategy[this['voiceQueues'][this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]][_0xc2f6('0x133')]]||_0xc2f6('0x134'))===_0xc2f6('0x134')){if(this[_0xc2f6('0x2b')][_0x1c3db7['actionid']]){if(this['agents'][_0x1c3db7[_0xc2f6('0x132')]]){this['actions'][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0x132')]=_0x1c3db7[_0xc2f6('0x132')];if(_[_0xc2f6('0xb2')](this[_0xc2f6('0x32')][this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]])){this[_0xc2f6('0x32')][this[_0xc2f6('0x2b')][_0x1c3db7['actionid']][_0xc2f6('0xb6')]]=[];}this[_0xc2f6('0x32')][this['actions'][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]['push'](_[_0xc2f6('0xd5')](_[_0xc2f6('0xd6')](this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]],[_0xc2f6('0x135'),_0xc2f6('0x132')]),{'status':_0x1c3db7[_0xc2f6('0xb3')],'paused':_0x1c3db7[_0xc2f6('0x131')]}));}}}};function unlockQueueStatus(_0x119ec4,_0x187e2d){setTimeout(function(){if(_[_0xc2f6('0x48')](_0x119ec4[_0xc2f6('0x136')])){loggerBooked[_0xc2f6('0x9b')](_0xc2f6('0x137'),_0x187e2d);}_0x119ec4[_0xc2f6('0x136')]=!![];loggerBooked[_0xc2f6('0x86')](_0xc2f6('0x138'),_0x187e2d,JSON[_0xc2f6('0x54')](_[_0xc2f6('0xd6')](_0x119ec4,[_0xc2f6('0x4b'),_0xc2f6('0x136')])));},0x1f3);}Dialer[_0xc2f6('0x20')][_0xc2f6('0x43')]=function(_0x9ade08){var _0x5368c3=this;var _0x49e1c5=_0x5368c3[_0xc2f6('0x26')][_0x5368c3[_0xc2f6('0x2b')][_0x9ade08['actionid']][_0xc2f6('0xb6')]];if(strategy[this[_0xc2f6('0x26')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]['strategy']]===_0xc2f6('0x1f')){if(this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]]&&this['actions'][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0x132')]){this[_0xc2f6('0x25')][_0xc2f6('0x139')](this['actions'][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0x135')],this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]]['stateinterface'])[_0xc2f6('0xb4')](function(_0x1bb075){logger[_0xc2f6('0x9b')](_0xc2f6('0x13a'),util[_0xc2f6('0x9c')](_0x1bb075,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5368c3[_0xc2f6('0xb8')](_0x5368c3['voiceQueues'][_0x5368c3[_0xc2f6('0x2b')][_0x9ade08['actionid']][_0xc2f6('0xb6')]]);_0x5368c3[_0xc2f6('0x28')][_0x5368c3['actions'][_0x9ade08[_0xc2f6('0x12f')]]['stateinterface']][_0xc2f6('0x130')]=![];delete _0x5368c3[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]];unlockQueueStatus(_0x49e1c5);});}else{this[_0xc2f6('0xb8')](this[_0xc2f6('0x26')][this['actions'][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]);this[_0xc2f6('0xc2')]({'active':![],'ContactId':this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xd7')],'ListId':this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0x101')],'VoiceQueueId':this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xd8')]||undefined,'CampaignId':this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x13b')));delete this[_0xc2f6('0x2b')][_0x9ade08['actionid']];unlockQueueStatus(_0x49e1c5);}}else if((strategy[this[_0xc2f6('0x26')][this[_0xc2f6('0x2b')][_0x9ade08['actionid']][_0xc2f6('0xb6')]][_0xc2f6('0x133')]]||_0xc2f6('0x134'))==='rrmemory'){var _0x52c38e;if(this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]]&&!_[_0xc2f6('0x51')](this[_0xc2f6('0x32')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]])){if(this[_0xc2f6('0x13c')][_0x5368c3[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]){this[_0xc2f6('0x13c')][_0x5368c3[_0xc2f6('0x2b')][_0x9ade08['actionid']][_0xc2f6('0xb6')]]=this[_0xc2f6('0x13c')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]]['queue']]?this[_0xc2f6('0x13c')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]:this[_0xc2f6('0x32')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]]['queue']]?this[_0xc2f6('0x32')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]][_0xc2f6('0x13d')]||0x0:0x0;}this[_0xc2f6('0x32')][this['actions'][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]][_0xc2f6('0x13d')]=this[_0xc2f6('0x13c')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]];for(var _0xcfd3bf=0x0;_0xcfd3bf=0x0;})['catch'](myreject(_0x29696e)));}}else{_0x430874[_0xc2f6('0x154')](ami[_0xc2f6('0x15a')]({'action':_0xc2f6('0x155'),'command':util[_0xc2f6('0x81')](_0xc2f6('0x156'),_0x44bd39,!_['isUndefined'](config[_0xc2f6('0x150')][_0x3bb728])?_0x3bb728:'')})[_0xc2f6('0x46')](function(_0x329412){return _0x329412[_0xc2f6('0x158')][_0xc2f6('0x15b')]('true')>=0x0;})[_0xc2f6('0xb4')](myreject(_0x29696e)));}BPromise[_0xc2f6('0x15c')](_0x430874)[_0xc2f6('0x46')](function(_0x57da5e){var _0x19dd0e=_[_0xc2f6('0x15d')](_0x57da5e);if(_0x19dd0e){return _0x535a33(_0x19dd0e);}else{_0x358bbd[_0xc2f6('0x49')]=_0x5b12b7?'GLOBAL_INTERVAL_IS_OVERTIME':_0xc2f6('0x15e');return _0x29696e(msgResponse(_0xc2f6('0x15f'),_0xc2f6('0x14c'),'Global:\x20'+_0x5b12b7+'\x20'+_0x2427c6+_0xc2f6('0x160')+util[_0xc2f6('0x9c')](_0x44bd39,{'showHidden':![],'depth':null})+_0xc2f6('0x161')+_0x3bb728));}})[_0xc2f6('0xb4')](function(_0x3b28f5){return _0x29696e(msgResponse(_0xc2f6('0x14a'),_0xc2f6('0x14c'),JSON[_0xc2f6('0x54')](_0x3b28f5)));});});};Dialer['prototype'][_0xc2f6('0x162')]=function(_0x38649e){var _0x7c50af=this;return function(){switch(_0x38649e[_0xc2f6('0x163')]){case _0xc2f6('0x164'):freeVariablesPredictive(_0x38649e);_0x7c50af['handlePower'](_0x38649e,0x1);break;case _0xc2f6('0x165'):freeVariablesPredictive(_0x38649e);_0x7c50af[_0xc2f6('0x166')](_0x38649e,_0x38649e[_0xc2f6('0x167')]);break;case _0xc2f6('0xc'):_0x7c50af[_0xc2f6('0xc')](_0x38649e);break;case _0xc2f6('0xb'):freeVariablesPredictive(_0x38649e);_0x7c50af['handlePower'](_0x38649e,0x1);break;default:freeVariablesPredictive(_0x38649e);logger['error'](_0xc2f6('0x168'),_0x38649e[_0xc2f6('0x4b')],_0xc2f6('0x169'));}};};Dialer[_0xc2f6('0x20')]['checkPreviewRecallReminder']=function(_0x54ce07){return BPromise['resolve']()[_0xc2f6('0x46')](cmHopper[_0xc2f6('0x16a')](_0x54ce07['id'],previewRecallmeReminderInterval))['then'](function(_0x24171c){for(var _0x30f33b=0x0;_0x30f33b<_0x24171c[_0xc2f6('0x9d')];_0x30f33b++){var _0x5f5cd9=_0x24171c[_0x30f33b][_0xc2f6('0x16b')]['name'];if(_0x5f5cd9)io['to'](util[_0xc2f6('0x81')](_0xc2f6('0x16c'),_0x5f5cd9))[_0xc2f6('0x57')](_0xc2f6('0x16d'),{'hopper':_0x24171c[_0x30f33b]});}})[_0xc2f6('0xb4')](function(_0x1aaeef){});};Dialer[_0xc2f6('0x20')]['launchHandleIvr']=function(_0x5cc33a){var _0x3adf0d=this;return function(){_0x3adf0d[_0xc2f6('0x16e')](_0x5cc33a);};};Dialer[_0xc2f6('0x20')][_0xc2f6('0xe')]=function(_0x4f36e0){var _0x5785e8=this;if(isNotPreview(_0x4f36e0[_0xc2f6('0x163')])){if(isVoiceQueueOutbound(_0x4f36e0['type'])&&isActive(_0x4f36e0[_0xc2f6('0x64')])){_0x4f36e0[_0xc2f6('0xa5')]=!![];BPromise[_0xc2f6('0xbb')]()['then'](checkIsLoggedIn(_0x4f36e0,_0x4f36e0[_0xc2f6('0x5b')]))[_0xc2f6('0x46')](checkIsActive(_0x4f36e0,_0x4f36e0['dialActive']))['then'](checkInterval(_0x4f36e0))[_0xc2f6('0x46')](_0x5785e8['checkIsTrunkReachable'](_0x4f36e0))[_0xc2f6('0x46')](_0x5785e8[_0xc2f6('0x149')](_0x4f36e0[_0xc2f6('0x16f')],_0x4f36e0[_0xc2f6('0x170')],_0x4f36e0[_0xc2f6('0x4b')],_0x4f36e0))[_0xc2f6('0x46')](_0x5785e8[_0xc2f6('0x14b')](_0x4f36e0[_0xc2f6('0x52')],_0x4f36e0[_0xc2f6('0x170')],_0x4f36e0[_0xc2f6('0x4b')],_0x4f36e0))['then'](_0x5785e8[_0xc2f6('0x162')](_0x4f36e0))[_0xc2f6('0xb4')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4f36e0));}else{notSendMessagesQueue(_0x4f36e0);}}else{freeVariablesPredictive(_0x4f36e0);if(_0x4f36e0[_0xc2f6('0x171')]){_0x5785e8['checkPreviewRecallReminder'](_0x4f36e0);}}};Dialer[_0xc2f6('0x20')]['syncCampaigns']=function(){var _0xde9788=this;var _0x111a79;for(var _0x5ea493 in this[_0xc2f6('0x27')]){if(typeof this[_0xc2f6('0x27')][_0x5ea493]!==_0xc2f6('0x9e')){_0x111a79=this[_0xc2f6('0x27')][_0x5ea493];if(isCampaignIvr(_0x111a79[_0xc2f6('0x61')])&&isActive(_0x111a79['active'])){_0x111a79[_0xc2f6('0xa5')]=!![];BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](checkIsActive(_0x111a79,_0x111a79[_0xc2f6('0x7f')]))[_0xc2f6('0x46')](checkInterval(_0x111a79))['then'](_0xde9788[_0xc2f6('0x147')](_0x111a79))['then'](_0xde9788['checkIfTime'](_0x111a79['dialGlobalInterval'],_0x111a79[_0xc2f6('0x170')],_0x111a79[_0xc2f6('0x4b')],_0x111a79))[_0xc2f6('0x46')](_0xde9788['checkIfTimeIntervals'](_0x111a79[_0xc2f6('0x52')],_0x111a79[_0xc2f6('0x170')],_0x111a79['name'],_0x111a79))['then'](_0xde9788[_0xc2f6('0x172')](_0x111a79))[_0xc2f6('0xb4')](loggerCatchQueueSummary(_0xc2f6('0x173'),_0x111a79));}else{notSendMessagesCampaign(_0x111a79);}}}};function getCallerIdRandom(_0x1a6300,_0x513596){var _0x5e0885;var _0x25b002;var _0x35749d;if(_0x513596<=0x0){_0x513596=0x1;}_0x5e0885=new RegExp(_0xc2f6('0x174')+_0x513596+'}$');_0x25b002=Math[_0xc2f6('0x175')](0xa,_0x513596-0x1);_0x35749d=Math[_0xc2f6('0x175')](0xa,_0x513596)-0x1;return util[_0xc2f6('0x81')]('%s',_[_0xc2f6('0x176')](_0x1a6300,_0x5e0885,_[_0xc2f6('0x177')](_0x25b002,_0x35749d)));}function extractCalleridName(_0x518b0c){var _0x3a65a1=_0x518b0c[_0xc2f6('0x178')](/"(.*?)"/);return _0x3a65a1?_0x3a65a1[0x1]:_0x518b0c;}function extractCalleridNumber(_0x5e8953){var _0x463303=_0x5e8953[_0xc2f6('0x178')](/<(.*?)>/);return _0x463303?_0x463303[0x1]:_0x5e8953;}Dialer['prototype'][_0xc2f6('0x179')]=function(_0x509b20,_0x57bc60){var _0x1df291=this;var _0x2c7564=uuid['v4']();this[_0xc2f6('0x2b')][_0x2c7564]=new Action(_0x509b20,_0x57bc60,_0x2c7564);return new BPromise(function(_0x397f14,_0x5dc3b9){if(_['isUndefined'](_0x509b20)&&typeof _0x509b20!=='object'){return _0x5dc3b9(msgResponse(_0xc2f6('0x17a'),'Failure',_0xc2f6('0x17b')));}if(_[_0xc2f6('0x48')](_0x57bc60['Contact'][_0xc2f6('0x17c')])||_0x57bc60[_0xc2f6('0x17d')][_0xc2f6('0x17c')]===null){return _0x5dc3b9(msgResponse(_0xc2f6('0x17a'),_0xc2f6('0x14c'),_0xc2f6('0x17e')));}var _0x292166={'XMD-CALLERID':_0x1df291['actions'][_0x2c7564][_0xc2f6('0x17f')](),'XMD-AGI':_0x509b20[_0xc2f6('0x10d')]?util['format'](_0xc2f6('0x180'),ipAgi,_0x509b20[_0xc2f6('0x10d')]):_0xc2f6('0x181'),'XMD-AGIAFTER':_0x509b20['dialQueueProject2']?util[_0xc2f6('0x81')]('\x22agi://%s/square,%s\x22',ipAgi,_0x509b20[_0xc2f6('0x116')]):'NONE','XMD-QUEUE':_0x509b20[_0xc2f6('0x61')]==='outbound'?util[_0xc2f6('0x81')]('\x22%s,%s%s,,,%s\x22',_0x509b20[_0xc2f6('0x4b')],_0x509b20['dialQueueOptions']||'',_0x509b20[_0xc2f6('0x117')]?'c':'',_0x509b20['dialQueueTimeout']||0x3):_0xc2f6('0x181'),'XMD-CONTACTID':_0x57bc60['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1df291[_0xc2f6('0x2b')][_0x2c7564][_0xc2f6('0x17f')](),'XMD-AMD':_0x509b20[_0xc2f6('0xe6')]?'ACTIVE':'NONE','XMD-DESTINATION':_0xc2f6('0xe5')};if(_0x509b20[_0xc2f6('0xe6')]){_0x292166[_0xc2f6('0x182')]=_0x509b20[_0xc2f6('0x183')]||0x9c4;_0x292166[_0xc2f6('0x184')]=_0x509b20[_0xc2f6('0x185')]||0x5dc;_0x292166[_0xc2f6('0x186')]=_0x509b20[_0xc2f6('0x187')]||0x320;_0x292166[_0xc2f6('0x188')]=_0x509b20[_0xc2f6('0x189')]||0x1388;_0x292166['XMD-AMDMINWORDLENGTH']=_0x509b20['dialAMDMinWordLength']||0x64;_0x292166[_0xc2f6('0x18a')]=_0x509b20[_0xc2f6('0x18b')]||0x32;_0x292166[_0xc2f6('0x18c')]=_0x509b20[_0xc2f6('0x18d')]||0x3;_0x292166[_0xc2f6('0x18e')]=_0x509b20[_0xc2f6('0x18f')]||0x100;_0x292166[_0xc2f6('0x190')]=_0x509b20['dialAMDMaximumWordLength']||0x1388;}if(_0x509b20[_0xc2f6('0x61')]==='outbound'){_0x292166[_0xc2f6('0x191')]=_0x57bc60[_0xc2f6('0xd8')];}else{_0x292166[_0xc2f6('0x192')]=_0x57bc60['CampaignId'];}for(var _0x289970 in _0x57bc60[_0xc2f6('0x17d')]){if(typeof _0x57bc60[_0xc2f6('0x17d')][_0x289970]!==_0xc2f6('0x9e')){if(isNotNull(_0x57bc60[_0xc2f6('0x17d')][_0x289970])&&_0x289970!=='id'&&_0x289970!==_0xc2f6('0x193')&&_0x289970!==_0xc2f6('0x194')&&_0x289970!==_0xc2f6('0x195')){_0x292166[util[_0xc2f6('0x81')](_0xc2f6('0x196'),_0xc2f6('0x197'),_['toUpper'](_0x289970))]=_0x57bc60[_0xc2f6('0x17d')][_0x289970];}}}var _0x119441=_0x1df291[_0xc2f6('0xdd')](_0x509b20[_0xc2f6('0x7e')])?getCallerId(_0x509b20[_0xc2f6('0x7e')]['callerid'],_0x509b20[_0xc2f6('0x65')],_0x509b20[_0xc2f6('0x198')]>0x0?getCallerIdRandom(_0x509b20[_0xc2f6('0x66')],_0x509b20[_0xc2f6('0x198')]):_0x509b20['dialOriginateCallerIdNumber']):getCallerId(_[_0xc2f6('0xb2')](_0x509b20[_0xc2f6('0x199')])?_0x509b20[_0xc2f6('0x7e')][_0xc2f6('0x80')]:_0x509b20[_0xc2f6('0x199')][_0xc2f6('0x80')],_0x509b20[_0xc2f6('0x65')],_0x509b20[_0xc2f6('0x198')]>0x0?getCallerIdRandom(_0x509b20['dialOriginateCallerIdNumber'],_0x509b20['dialRandomLastDigitCallerIdNumber']):_0x509b20[_0xc2f6('0x66')]);if(_0x119441){_0x292166[_0xc2f6('0x19a')]=_0x1df291['actions'][_0x2c7564][_0xc2f6('0x19b')]=extractCalleridName(_0x119441);_0x292166[_0xc2f6('0x19c')]=_0x1df291[_0xc2f6('0x2b')][_0x2c7564][_0xc2f6('0x19d')]=extractCalleridNumber(_0x119441);}return ami['Action']({'actionid':_0x2c7564,'action':_0xc2f6('0x17a'),'channel':_0x1df291['isTrunkReachable'](_0x509b20[_0xc2f6('0x7e')])?util['format'](_0xc2f6('0x19e'),_0x509b20['Trunk']['name'],isNotNull(_0x509b20[_0xc2f6('0x19f')])?_0x509b20['dialPrefix'][_0xc2f6('0x1a0')]()||'':'',_0x509b20[_0xc2f6('0x1a1')]>0x0?_0x57bc60[_0xc2f6('0x17d')][_0xc2f6('0x17c')]['substring'](_0x509b20[_0xc2f6('0x1a1')]):_0x57bc60[_0xc2f6('0x17d')][_0xc2f6('0x17c')]):util[_0xc2f6('0x81')](_0xc2f6('0x19e'),_[_0xc2f6('0xb2')](_0x509b20['TrunkBackup'])?_0x509b20[_0xc2f6('0x7e')][_0xc2f6('0x4b')]:_0x509b20[_0xc2f6('0x199')][_0xc2f6('0x4b')],isNotNull(_0x509b20[_0xc2f6('0x19f')])?_0x509b20[_0xc2f6('0x19f')][_0xc2f6('0x1a0')]()||'':'',_0x509b20['dialCutDigit']>0x0?_0x57bc60[_0xc2f6('0x17d')][_0xc2f6('0x17c')][_0xc2f6('0x1a2')](_0x509b20[_0xc2f6('0x1a1')]):_0x57bc60[_0xc2f6('0x17d')]['phone']),'callerid':_0x119441,'Exten':'xcally-motion-dialer','Context':_0xc2f6('0x1a3'),'Priority':'1','variable':_0x292166,'timeout':(_0x509b20[_0xc2f6('0x1a4')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c7564})[_0xc2f6('0x46')](function(_0x27b35a){return _0x397f14(_0x27b35a);})['catch'](function(_0x3b3ac8){_0x509b20['outboundOriginateFailureCallsDay']+=0x1;var _0x43d8cc=new History(_0x1df291[_0xc2f6('0x2b')][_0x2c7564]);logger[_0xc2f6('0x9b')](util[_0xc2f6('0x81')]('[originateError]:\x20%s',JSON['stringify'](_0x3b3ac8)));_0x43d8cc[_0xc2f6('0xab')]=0xe;_0x43d8cc[_0xc2f6('0xea')]='OriginateError';_0x43d8cc[_0xc2f6('0xad')]=moment()[_0xc2f6('0x81')]('YYYY-MM-DD\x20HH:mm:ss');_0x43d8cc['endtime']=_0x43d8cc[_0xc2f6('0xad')];_0x1df291[_0xc2f6('0xce')](_0x43d8cc)['catch'](loggerCatch(_0xc2f6('0x1a5')));_0x1df291[_0xc2f6('0xcd')](_0x43d8cc)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1a5')))['finally'](function(){delete _0x1df291[_0xc2f6('0x2b')][_0x2c7564];return _0x5dc3b9(msgResponse('originate',_0xc2f6('0x53'),_0xc2f6('0x1a6')));});});});};Dialer[_0xc2f6('0x20')][_0xc2f6('0x38')]=function(_0x4a76b7){var _0x5071ac=this[_0xc2f6('0x2b')][_0x4a76b7[_0xc2f6('0x12f')]];if(_0x5071ac){delete this[_0xc2f6('0x2b')][_0x4a76b7['actionid']];_0x5071ac[_0xc2f6('0x11d')]=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));var _0x119a20=_0x5071ac[_0xc2f6('0x61')]==='ivr'?this[_0xc2f6('0x27')][_0x5071ac[_0xc2f6('0xb6')]]:this['voiceQueues'][_0x5071ac['getQueue']()];if(!this['isSuccess'](_0x4a76b7[_0xc2f6('0x1a7')])){this[_0xc2f6('0xb8')](_0x119a20);return this['callProgressDetecting'](_0x5071ac,_0x119a20,_0x4a76b7)[_0xc2f6('0xb4')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xc2f6('0x2d')][_0x4a76b7['uniqueid']]=_0x5071ac;}};Dialer[_0xc2f6('0x20')][_0xc2f6('0x1a8')]=function(_0x7e7613,_0x406781,_0x6fb53f){var _0x37b856=new History(_0x406781);if(_0x37b856[_0xc2f6('0x106')]+_0x37b856[_0xc2f6('0xf6')]+_0x37b856[_0xc2f6('0x1a9')]+_0x37b856[_0xc2f6('0xf7')]+_0x37b856[_0xc2f6('0x124')]+_0x37b856[_0xc2f6('0xf8')]+_0x37b856['countmachineretry']+_0x37b856[_0xc2f6('0x107')]>=_0x6fb53f[_0xc2f6('0xfa')]-0x1){return!![];}switch(_0x7e7613){case 0x3:if(_0x37b856[_0xc2f6('0x1a9')]>=_0x6fb53f[_0xc2f6('0x1aa')]-0x1){return!![];}this[_0xc2f6('0xc2')]({'active':![],'countnoanswerretry':_0x37b856[_0xc2f6('0x1a9')]+=0x1,'scheduledat':moment()['add'](_0x6fb53f['dialNoAnswerRetryFrequency'],_0xc2f6('0xff'))[_0xc2f6('0x81')](_0xc2f6('0x100')),'ContactId':_0x37b856['ContactId'],'ListId':_0x37b856[_0xc2f6('0x101')],'VoiceQueueId':_0x37b856['VoiceQueueId']||undefined,'CampaignId':_0x37b856[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x37b856[_0xc2f6('0x106')]>=_0x6fb53f[_0xc2f6('0x1ab')]-0x1){return!![];}this[_0xc2f6('0xc2')]({'active':![],'countbusyretry':_0x37b856['countbusyretry']+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0x1ac')],'minutes')[_0xc2f6('0x81')](_0xc2f6('0x100')),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856[_0xc2f6('0x101')],'VoiceQueueId':_0x37b856[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x37b856[_0xc2f6('0xd9')]||undefined})['catch'](loggerCatch(_0xc2f6('0x1ad')));break;case 0x8:if(_0x37b856[_0xc2f6('0xf6')]>=_0x6fb53f[_0xc2f6('0x1ae')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x37b856[_0xc2f6('0xf6')]+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0x1af')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856['ListId'],'VoiceQueueId':_0x37b856['VoiceQueueId']||undefined,'CampaignId':_0x37b856[_0xc2f6('0xd9')]||undefined})['catch'](loggerCatch(_0xc2f6('0x1b0')));break;case 0x0:if(_0x37b856[_0xc2f6('0xf7')]>=_0x6fb53f['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xc2f6('0xc2')]({'active':![],'countnosuchnumberretry':_0x37b856[_0xc2f6('0xf7')]+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0x1b1')],_0xc2f6('0xff'))[_0xc2f6('0x81')](_0xc2f6('0x100')),'ContactId':_0x37b856['ContactId'],'ListId':_0x37b856[_0xc2f6('0x101')],'VoiceQueueId':_0x37b856[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x37b856['CampaignId']||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1b2')));}break;case 0xa:if(_0x37b856[_0xc2f6('0x124')]>=_0x6fb53f['dialDropMaxRetry']-0x1){return!![];}this[_0xc2f6('0xc2')]({'active':![],'countdropretry':_0x37b856[_0xc2f6('0x124')]+=0x1,'scheduledat':moment()['add'](_0x6fb53f[_0xc2f6('0x1b3')],_0xc2f6('0xff'))['format'](_0xc2f6('0x100')),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856['ListId'],'VoiceQueueId':_0x37b856[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x37b856[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1b4')));break;case 0xb:if(_0x37b856[_0xc2f6('0xf8')]>=_0x6fb53f['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xc2f6('0xc2')]({'active':![],'countabandonedretry':_0x37b856['countabandonedretry']+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0x12b')],_0xc2f6('0xff'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856[_0xc2f6('0x101')],'VoiceQueueId':_0x37b856['VoiceQueueId']||undefined,'CampaignId':_0x37b856['CampaignId']||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x12c')));break;case 0x13:if(_0x37b856[_0xc2f6('0xf9')]>=_0x6fb53f[_0xc2f6('0x109')]-0x1){return!![];}this[_0xc2f6('0xc2')]({'active':![],'countmachineretry':_0x37b856['countmachineretry']+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0xfe')],_0xc2f6('0xff'))[_0xc2f6('0x81')](_0xc2f6('0x100')),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856[_0xc2f6('0x101')],'VoiceQueueId':_0x37b856[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x37b856[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x37b856[_0xc2f6('0x107')]>=_0x6fb53f[_0xc2f6('0x1b5')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x37b856[_0xc2f6('0x107')]+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0x1b6')],'minutes')['format'](_0xc2f6('0x100')),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856['ListId'],'VoiceQueueId':_0x37b856[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x37b856['CampaignId']||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1b7')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x64109f,_0x94701d,_0x5ee35e){var _0x104144=this;var _0x437bbd=new History(_0x64109f);return new BPromise(function(_0xcead8e,_0x32fc5b){if(_[_0xc2f6('0x48')](_0x94701d)&&typeof _0x94701d!==_0xc2f6('0x1b8')){return _0x32fc5b(msgResponse(_0xc2f6('0x1b9'),_0xc2f6('0x14c'),_0xc2f6('0x1ba')));}if(_[_0xc2f6('0x48')](_0x5ee35e)&&typeof _0x5ee35e!==_0xc2f6('0x1b8')){return _0x32fc5b(msgResponse(_0xc2f6('0x1b9'),_0xc2f6('0x14c'),'evt\x20is\x20undefine'));}switch(_0x5ee35e['reason']){case'0':_0x94701d[_0xc2f6('0x6e')]+=0x1;_0x437bbd[_0xc2f6('0xab')]=0x0;_0x437bbd['statedesc']=_0xc2f6('0x1bb');_0x437bbd['countnosuchnumberretry']+=0x1;_0x437bbd[_0xc2f6('0xf4')]+=0x1;ami[_0xc2f6('0x57')]('custom:agentnosuchnumber',ut['buildObj'](_0x64109f,'nosuchnumber'));_0x104144[_0xc2f6('0xce')](_0x437bbd)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x104144[_0xc2f6('0x1a8')](0x0,_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0xf7')]>=_0x94701d[_0xc2f6('0x1bc')]){_0x104144[_0xc2f6('0x10a')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1bd'));}else{_0x104144[_0xc2f6('0xfb')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1bd'));}}break;case'3':_0x94701d[_0xc2f6('0x6d')]+=0x1;_0x437bbd[_0xc2f6('0xab')]=0x3;_0x437bbd['statedesc']=_0xc2f6('0x1be');_0x437bbd[_0xc2f6('0x1a9')]+=0x1;_0x437bbd['countglobal']+=0x1;ami[_0xc2f6('0x57')](_0xc2f6('0x1bf'),ut[_0xc2f6('0xee')](_0x64109f,'noanswer'));_0x104144['createHistory'](_0x437bbd)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x104144[_0xc2f6('0x1a8')](0x3,_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0x1a9')]>=_0x94701d[_0xc2f6('0x1aa')]){_0x104144[_0xc2f6('0x10a')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c0'));}else{_0x104144['stateGlobal'](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c0'));}}break;case'5':_0x94701d[_0xc2f6('0x69')]+=0x1;_0x437bbd[_0xc2f6('0xab')]=0x5;_0x437bbd[_0xc2f6('0xea')]=_0xc2f6('0x1c1');_0x437bbd['countbusyretry']+=0x1;_0x437bbd[_0xc2f6('0xf4')]+=0x1;ami[_0xc2f6('0x57')](_0xc2f6('0x1c2'),ut[_0xc2f6('0xee')](_0x64109f,_0xc2f6('0x1c3')));_0x104144[_0xc2f6('0xce')](_0x437bbd)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x104144[_0xc2f6('0x1a8')](0x5,_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0x106')]>=_0x94701d[_0xc2f6('0x1ab')]){_0x104144[_0xc2f6('0x10a')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c4'));}else{_0x104144[_0xc2f6('0xfb')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c4'));}}break;case'8':_0x94701d['outboundCongestionCallsDay']+=0x1;_0x437bbd[_0xc2f6('0xab')]=0x8;_0x437bbd[_0xc2f6('0xea')]=_0xc2f6('0x1c5');_0x437bbd[_0xc2f6('0xf6')]+=0x1;_0x437bbd['countglobal']+=0x1;ami[_0xc2f6('0x57')](_0xc2f6('0x1c6'),ut['buildObj'](_0x64109f,_0xc2f6('0x1c7')));_0x104144[_0xc2f6('0xce')](_0x437bbd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1c8')));if(_0x104144[_0xc2f6('0x1a8')](0x8,_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0xf6')]>=_0x94701d[_0xc2f6('0x1ae')]){_0x104144[_0xc2f6('0x10a')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c9'));}else{_0x104144['stateGlobal'](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c9'));}}break;case'11':_0x94701d[_0xc2f6('0x1ca')]+=0x1;_0x437bbd[_0xc2f6('0xab')]=0xb;_0x437bbd['statedesc']='Abandoned';_0x437bbd['countabandonedretry']+=0x1;_0x437bbd['countglobal']+=0x1;_0x104144[_0xc2f6('0xce')](_0x437bbd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x12d')));if(_0x104144['checkRetriveMax'](0xb,_0x64109f,_0x94701d)){if(_0x437bbd['countabandonedretry']>=_0x94701d[_0xc2f6('0x12a')]){_0x104144['createStateFinal'](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1cb'));}else{_0x104144[_0xc2f6('0xfb')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1cb'));}}break;case'20':_0x94701d[_0xc2f6('0x70')]+=0x1;_0x437bbd[_0xc2f6('0xab')]=0x14;_0x437bbd[_0xc2f6('0xea')]='AgentReject';_0x437bbd[_0xc2f6('0x107')]+=0x1;_0x437bbd[_0xc2f6('0xf4')]+=0x1;ami[_0xc2f6('0x57')](_0xc2f6('0x1cc'),ut[_0xc2f6('0xee')](_0x64109f,_0xc2f6('0x1cd')));_0x104144[_0xc2f6('0xce')](_0x437bbd)[_0xc2f6('0xb4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x104144['checkRetriveMax'](0x14,_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0x107')]>=_0x94701d[_0xc2f6('0x1b5')]){_0x104144['createStateFinal'](_0x437bbd,_0xcead8e,_0x32fc5b,'reason\x2020\x20agentreject');}else{_0x104144[_0xc2f6('0xfb')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1ce'));}}break;default:_0x94701d['outboundUnknownCallsDay']+=0x1;_0x437bbd[_0xc2f6('0xab')]=0xc;_0x437bbd[_0xc2f6('0xea')]=_0x5ee35e[_0xc2f6('0x113')];_0x104144['createHistory'](_0x437bbd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1cf')));if(_0x104144[_0xc2f6('0x1a8')](_0x5ee35e[_0xc2f6('0x113')],_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0x106')]+_0x437bbd[_0xc2f6('0xf6')]+_0x437bbd['countnoanswerretry']+_0x437bbd[_0xc2f6('0xf7')]+_0x437bbd[_0xc2f6('0x124')]+_0x437bbd['countabandonedretry']+_0x437bbd[_0xc2f6('0xf9')]+_0x437bbd['countagentrejectretry']>=_0x94701d['dialGlobalMaxRetry']){_0x104144[_0xc2f6('0xfb')](_0x437bbd,_0xcead8e,_0x32fc5b,_0x5ee35e[_0xc2f6('0x113')]);}else{_0x104144[_0xc2f6('0x10a')](_0x437bbd,_0xcead8e,_0x32fc5b,_0x5ee35e[_0xc2f6('0x113')]);}}}});};Dialer[_0xc2f6('0x20')][_0xc2f6('0xfb')]=function(_0x46ddd3,_0x2086c8,_0x26bb7c,_0x1dad30){var _0x3f1b8e=new Final(_0x46ddd3);_0x3f1b8e['state']=0xf;_0x3f1b8e[_0xc2f6('0xea')]=_0xc2f6('0x1d0');this[_0xc2f6('0x10a')](_0x3f1b8e,_0x2086c8,_0x26bb7c,_0x1dad30);};Dialer[_0xc2f6('0x20')][_0xc2f6('0x10a')]=function(_0xb145ff,_0x1485f5,_0xa87b79,_0x10ab0e){this[_0xc2f6('0xcd')](_0xb145ff)['then'](function(){return _0x1485f5(msgResponse(_0xc2f6('0x1b9'),_0xc2f6('0xdc'),_0x10ab0e));})[_0xc2f6('0xb4')](function(){return _0xa87b79(msgResponse('[moveContactManagedDialer][0]',_0xc2f6('0x14c'),_0xc2f6('0x1d1')));});};Dialer['prototype'][_0xc2f6('0xc')]=function(_0x4d3863){var _0x3f6153=_0x4d3863[_0xc2f6('0x1d2')]/0x64;var _0xaa9c0d=_0x4d3863[_0xc2f6('0x11f')]/(_0x4d3863['outboundDropCallsDayTimeout']+_0x4d3863[_0xc2f6('0x67')]);var _0x37d657=Math['round'](_0x4d3863['predictiveIntervalAvailable']*(_0x4d3863['predictiveIntervalMaxThreshold']/0x64));var _0x447764=Math['round'](_0x4d3863[_0xc2f6('0x79')]*(_0x4d3863['predictiveIntervalMinThreshold']/0x64));var _0xab660d=_0x4d3863['available']+_0x4d3863[_0xc2f6('0x5f')];var _0x27755c=Math[_0xc2f6('0x1d3')](_0x4d3863[_0xc2f6('0x7c')]*_0x4d3863['erlangAbandonmentRate']*_0x4d3863[_0xc2f6('0x76')]*_0x4d3863[_0xc2f6('0x77')]);if(_['isUndefined'](_0x4d3863[_0xc2f6('0x30')])){if(!_[_0xc2f6('0x48')](_0x4d3863[_0xc2f6('0x2f')])){_0x4d3863['startPredictive']=undefined;loggerPredictive['error'](_0xc2f6('0x1d4'),_0xc2f6('0x1d5'));}if(!_['isUndefined'](_0x4d3863[_0xc2f6('0x97')])){loggerPredictive[_0xc2f6('0x9b')](_0xc2f6('0x1d4'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x4d3863[_0xc2f6('0x97')]);_0x4d3863['handlePredictive']=undefined;}_0x4d3863[_0xc2f6('0x30')]=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));loggerPredictive[_0xc2f6('0x86')](_0x4d3863[_0xc2f6('0x4b')],_0xc2f6('0x1d6'),_0x4d3863[_0xc2f6('0x30')]);this[_0xc2f6('0x166')](_0x4d3863,0x1);}else if(ifInterval(_0x4d3863['dialPredictiveInterval'],_0x4d3863[_0xc2f6('0x30')])){this[_0xc2f6('0x166')](_0x4d3863,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x4d3863[_0xc2f6('0x30')],_0x4d3863[_0xc2f6('0x4b')]);_0x4d3863[_0xc2f6('0x7c')]=0x0;_0x4d3863[_0xc2f6('0x120')]=0x0;}else if(_0x3f6153<_0xaa9c0d&&_0x4d3863['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x4d3863);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x1d7'),'Dropped\x20calls\x20day',_0xaa9c0d,_0xc2f6('0x30'),_0x4d3863['name']);}else if(_0x27755c<_0x4d3863['predictiveIntervalErlangCallsDroppedCalls']&&_0x4d3863['dialPredictiveOptimization']===_0xc2f6('0x1d8')){freeVariablesPredictive(_0x4d3863);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x1d9'),'Max\x20Drop\x20',_0x27755c,_0xc2f6('0x1da'),_0x4d3863[_0xc2f6('0x120')],_0xc2f6('0x30'),_0x4d3863[_0xc2f6('0x4b')]);}else if(!ifInterval(_0x4d3863[_0xc2f6('0x1db')],_0x4d3863[_0xc2f6('0x30')])&&_[_0xc2f6('0x48')](_0x4d3863[_0xc2f6('0x2f')])&&!_[_0xc2f6('0x48')](_0x4d3863[_0xc2f6('0x30')])){_0x4d3863[_0xc2f6('0x2f')]=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));loggerPredictive[_0xc2f6('0x86')](_0x4d3863[_0xc2f6('0x4b')],_0xc2f6('0x1dc'),_0x4d3863['startPredictive']);this[_0xc2f6('0x1dd')](_0x4d3863[_0xc2f6('0x1db')])[_0xc2f6('0x46')](this[_0xc2f6('0x1de')](_0x4d3863))[_0xc2f6('0x46')](mergeDataErlangB(_0x4d3863))[_0xc2f6('0x46')](this['startMethodPredictive'](_0x4d3863))[_0xc2f6('0xb4')](loggerCatchPredictive(_0xc2f6('0x1df'),_0x4d3863));}else if(!ifInterval(_0x4d3863['dialPredictiveInterval'],_0x4d3863[_0xc2f6('0x2f')])){_0x4d3863['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4d3863['startPredictive']=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));loggerPredictive[_0xc2f6('0x86')](_0x4d3863['name'],_0xc2f6('0x1e0'),_0x4d3863[_0xc2f6('0x2f')]);clearInterval(_0x4d3863[_0xc2f6('0x97')]);_0x4d3863[_0xc2f6('0x97')]=undefined;this[_0xc2f6('0x1dd')](_0x4d3863['dialPredictiveInterval'])[_0xc2f6('0x46')](this[_0xc2f6('0x1de')](_0x4d3863))[_0xc2f6('0x46')](mergeDataErlangB(_0x4d3863))['then'](this[_0xc2f6('0x1e1')](_0x4d3863))['catch'](loggerCatchPredictive(_0xc2f6('0x1e2'),_0x4d3863));}else if(_0x4d3863[_0xc2f6('0x79')]&&_0xab660d<_0x4d3863[_0xc2f6('0x79')]-_0x447764){freeVariablesPredictive(_0x4d3863);loggerPredictive['info'](_0x4d3863[_0xc2f6('0x4b')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xab660d,_0xc2f6('0x1e3'),_0x4d3863['predictiveIntervalAvailable'],'-',_0x447764,'=',_0x4d3863['predictiveIntervalAvailable']-_0x447764,')');}else if(_0x4d3863['predictiveIntervalAvailable']&&_0xab660d>_0x4d3863[_0xc2f6('0x79')]+_0x37d657){freeVariablesPredictive(_0x4d3863);loggerPredictive[_0xc2f6('0x86')](_0x4d3863[_0xc2f6('0x4b')],_0xc2f6('0x1e4'),_0xab660d,_0xc2f6('0x1e5'),_0x4d3863[_0xc2f6('0x79')],'+',_0x37d657,'=',_0x4d3863[_0xc2f6('0x79')]+_0x37d657,')');}};Dialer['prototype'][_0xc2f6('0x1de')]=function(_0x250a47){var _0x5a4492=this;return function(_0x1179dc){return new BPromise(function(_0x1c51d0,_0x17f236){_['merge'](_0x250a47,_0x1179dc[0x0]);if(checkGetDataPredictive(_0x1179dc[0x0])){var _0x2f1b70=_0x250a47[_0xc2f6('0x79')]=_0x250a47['talking']+_0x250a47[_0xc2f6('0x5a')];var _0xd794d2=_0x250a47[_0xc2f6('0x1db')]*0x3c;var _0x29e691=_0x1179dc[0x0]['predictiveIntervalAvgTalktime']+_0x1179dc[0x0]['predictiveIntervalAvgHoldtime'];var _0x403eaf=(_0x1179dc[0x0]['predictiveIntervalAnsweredCalls']+_0x1179dc[0x0][_0xc2f6('0x89')]+_0x1179dc[0x0][_0xc2f6('0x75')])/_0x1179dc[0x0]['predictiveIntervalTotalCalls'];_0x250a47[_0xc2f6('0x76')]=_0x403eaf>0x0?_0x403eaf:0x1;switch(_0x250a47['dialPredictiveOptimization']){case _0xc2f6('0x1d8'):var _0x4e0812=_0x250a47[_0xc2f6('0x1d2')]/0x64;return _0x5a4492[_0xc2f6('0x1e6')](_0x2f1b70,_0xd794d2,_0x29e691,_0x403eaf,_0x4e0812)[_0xc2f6('0x46')](function(_0x119203){return _0x1c51d0(_0x119203);});case'agentBusyFactor':var _0x4585fb=_0x250a47[_0xc2f6('0x1d2')]/0x64;return _0x5a4492[_0xc2f6('0x1e7')](_0x2f1b70,_0xd794d2,_0x29e691,_0x403eaf,_0x4585fb)[_0xc2f6('0x46')](function(_0x2b9121){return _0x1c51d0(_0x2b9121);});default:return _0x17f236(msgResponse(_0xc2f6('0x1e8'),'Failure',_0xc2f6('0x1e9')));}}else{return _0x17f236(msgResponse(_0xc2f6('0x1e8'),'Failure',_0xc2f6('0x1ea')));}});};};Dialer[_0xc2f6('0x20')][_0xc2f6('0x1eb')]=function(_0x1adf3e){var _0x4aa414=this;return function(_0x1169c1){return new BPromise(function(_0x5c4b61,_0x5af2d9){_['merge'](_0x1adf3e,_0x1169c1[0x0]);if(checkGetDataPredictive(_0x1169c1[0x0])){loggerPredictive['info'](JSON[_0xc2f6('0x54')](_0x1169c1[0x0]));if(_0x1adf3e[_0xc2f6('0x1ec')]===_0xc2f6('0x1d8')){return _0x4aa414[_0xc2f6('0xcb')](_0x1adf3e['id'])[_0xc2f6('0x46')](function(_0x46b2a8){var _0x51af63=_0x1adf3e[_0xc2f6('0x5b')]-_0x46b2a8[0x0][_0xc2f6('0x1ed')];var _0x307d38=_0x1adf3e[_0xc2f6('0x1db')]*0x3c;var _0x1d5fb8=_0x1169c1[0x0][_0xc2f6('0x74')]+_0x1169c1[0x0][_0xc2f6('0x73')];var _0xa88e7a=(_0x1169c1[0x0][_0xc2f6('0x72')]+_0x1169c1[0x0][_0xc2f6('0x89')]+_0x1169c1[0x0][_0xc2f6('0x75')])/_0x1169c1[0x0][_0xc2f6('0x7a')];var _0x3be4dc=_0x1adf3e[_0xc2f6('0x1d2')]/0x64;_0x1adf3e[_0xc2f6('0x78')]=_0x46b2a8[0x0][_0xc2f6('0x1ed')]||0x0;_0x1adf3e['predictiveIntervalHitRate']=_0xa88e7a>0x0?_0xa88e7a:0x1;return _0x4aa414[_0xc2f6('0x1e6')](_0x51af63,_0x307d38,_0x1d5fb8,_0xa88e7a,_0x3be4dc);})['then'](function(_0x1f8f56){return _0x5c4b61(_0x1f8f56);})[_0xc2f6('0xb4')](function(_0x36881e){return _0x5af2d9(msgResponse('[CatchErlangB]',_0xc2f6('0x14c'),JSON[_0xc2f6('0x54')](_0x36881e)));});}if(_0x1adf3e[_0xc2f6('0x1ec')]===_0xc2f6('0x1ee')){return _0x4aa414[_0xc2f6('0xcb')](_0x1adf3e['id'])[_0xc2f6('0x46')](function(_0x8541f5){var _0x5e5f24=_0x1adf3e[_0xc2f6('0x5b')]-_0x8541f5[0x0][_0xc2f6('0x1ed')];var _0x429b00=_0x1adf3e[_0xc2f6('0x1db')]*0x3c;var _0x26ec47=_0x1169c1[0x0][_0xc2f6('0x74')]+_0x1169c1[0x0][_0xc2f6('0x73')];var _0x59c6c0=(_0x1169c1[0x0][_0xc2f6('0x72')]+_0x1169c1[0x0][_0xc2f6('0x89')]+_0x1169c1[0x0][_0xc2f6('0x75')])/_0x1169c1[0x0][_0xc2f6('0x7a')];var _0x22f947=_0x1adf3e[_0xc2f6('0x1d2')]/0x64;_0x1adf3e[_0xc2f6('0x78')]=_0x8541f5[0x0][_0xc2f6('0x1ed')]||0x0;_0x1adf3e[_0xc2f6('0x76')]=_0x59c6c0>0x0?_0x59c6c0:0x1;return _0x4aa414[_0xc2f6('0x1e7')](_0x5e5f24,_0x429b00,_0x26ec47,_0x59c6c0,_0x22f947);})[_0xc2f6('0x46')](function(_0x52ffd1){return _0x5c4b61(_0x52ffd1);})[_0xc2f6('0xb4')](function(_0x450703){return _0x5af2d9(msgResponse(_0xc2f6('0x1ef'),_0xc2f6('0x14c'),JSON['stringify'](_0x450703)));});}}else{return _0x5af2d9(msgResponse(_0xc2f6('0x1e8'),_0xc2f6('0x14c'),_0xc2f6('0x1ea')));}});};};Dialer[_0xc2f6('0x20')][_0xc2f6('0x1e1')]=function(_0x2f153a){var _0x3e4e44=this;return function(){var _0x518283=0x0;var _0x5264dc=Math[_0xc2f6('0x1d3')](_0x2f153a[_0xc2f6('0x7d')]*0x3e8);if(_0x5264dc>0x0){_0x5264dc=_0x5264dc<0x64?0x64:_0x5264dc;loggerPredictive['info'](_0x2f153a[_0xc2f6('0x4b')],'one\x20call\x20every:',_0x5264dc,_0xc2f6('0x55'));_0x2f153a[_0xc2f6('0x97')]=setInterval(function(){_0x3e4e44[_0xc2f6('0x97')](_0x2f153a);loggerPredictiveCalls[_0xc2f6('0x86')](_0xc2f6('0x1f0'),_0x518283+=0x1);},_0x5264dc);}else{loggerPredictive[_0xc2f6('0x86')](_0x2f153a[_0xc2f6('0x4b')],_0xc2f6('0x1f1'));}};};Dialer[_0xc2f6('0x20')][_0xc2f6('0x1f2')]=function(_0x22cb25,_0x4ac890){var _0x425354=this;return function(_0x542a09){if(_[_0xc2f6('0x51')](_0x542a09)){if(_[_0xc2f6('0xb2')](_0x4ac890[_0xc2f6('0x1f3')])||!_0x4ac890['recallme']){if(_0x22cb25[_0xc2f6('0x163')]===_0xc2f6('0xb')){_0x22cb25[_0xc2f6('0x136')]=_[_0xc2f6('0x48')](_0x22cb25['queueStatusComplete'])?!![]:_0x22cb25['queueStatusComplete'];var _0x1c5c77=uuid['v4']();_0x425354[_0xc2f6('0x2b')][_0x1c5c77]=new Action(_0x22cb25,_0x4ac890,_0x1c5c77);loggerBooked[_0xc2f6('0x86')](_0xc2f6('0x1f4'),_0x1c5c77,_0xc2f6('0x1f5'),JSON[_0xc2f6('0x54')](_0x22cb25[_0xc2f6('0x136')]),_0xc2f6('0x1f6'),_0x22cb25[_0xc2f6('0x4b')]);if(_0x22cb25[_0xc2f6('0x136')]){_0x22cb25[_0xc2f6('0x136')]=![];_0x425354[_0xc2f6('0x32')][_0x425354[_0xc2f6('0x2b')][_0x1c5c77][_0xc2f6('0xb6')]]=[];ami[_0xc2f6('0x15a')]({'actionid':_0x1c5c77,'action':_0xc2f6('0x1f7'),'queue':_0x22cb25['name']})[_0xc2f6('0xb4')](function(){_0x425354[_0xc2f6('0xb8')](_0x22cb25);_0x425354[_0xc2f6('0xc2')]({'active':![],'ContactId':_0x425354['actions'][_0x1c5c77]['ContactId'],'ListId':_0x425354[_0xc2f6('0x2b')][_0x1c5c77][_0xc2f6('0x101')],'VoiceQueueId':_0x425354[_0xc2f6('0x2b')][_0x1c5c77][_0xc2f6('0xd8')]||undefined,'CampaignId':_0x425354['actions'][_0x1c5c77][_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1f8')));delete _0x425354[_0xc2f6('0x2b')][_0x1c5c77];});}else{loggerBooked[_0xc2f6('0x86')]('[booked][checkContactBlack][else]',JSON[_0xc2f6('0x54')](_0x22cb25[_0xc2f6('0x136')]),_0xc2f6('0x1f6'),_0x22cb25[_0xc2f6('0x4b')]);_0x425354[_0xc2f6('0xb8')](_0x22cb25);_0x425354[_0xc2f6('0xc2')]({'active':![],'ContactId':_0x425354[_0xc2f6('0x2b')][_0x1c5c77]['ContactId'],'ListId':_0x425354[_0xc2f6('0x2b')][_0x1c5c77]['ListId'],'VoiceQueueId':_0x425354['actions'][_0x1c5c77][_0xc2f6('0xd8')]||undefined,'CampaignId':_0x425354[_0xc2f6('0x2b')][_0x1c5c77][_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1f8')));delete _0x425354['actions'][_0x1c5c77];}}else{return _0x425354[_0xc2f6('0x179')](_0x22cb25,_0x4ac890);}}else{if(getDiff(_0x4ac890[_0xc2f6('0x1f9')])<_0x22cb25['dialRecallMeTimeout']*0x3c){if(_0x4ac890[_0xc2f6('0x16b')]&&!_0x4ac890[_0xc2f6('0x16b')][_0xc2f6('0x1fa')]){_0x425354[_0xc2f6('0x25')][_0xc2f6('0x139')](_0x4ac890['id'])['finally'](function(){_0x425354['updateOriginated'](_0x22cb25);});}else{_0x425354[_0xc2f6('0xc4')]({'active':![]},_0x4ac890['id'],0x1)[_0xc2f6('0x23')](function(){_0x425354[_0xc2f6('0xb8')](_0x22cb25);});}}else{_0x22cb25[_0xc2f6('0x6f')]+=0x1;_0x425354[_0xc2f6('0xb8')](_0x22cb25);if(_0x22cb25[_0xc2f6('0x1fb')]){_0x425354['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4ac890[_0xc2f6('0xd7')],'ListId':_0x4ac890[_0xc2f6('0x101')],'VoiceQueueId':_0x4ac890[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x4ac890[_0xc2f6('0xd9')]||undefined})['catch'](loggerCatch(_0xc2f6('0x1fc')));_0x425354['createHistory'](createObjHistory(_0x22cb25,_0x4ac890,_0xc2f6('0x1fd'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0xc2f6('0x1fe')));}else{_0x425354['saveInDb'](createObjHistory(_0x22cb25,_0x4ac890,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x22cb25[_0xc2f6('0x68')]+=0x1;_0x425354[_0xc2f6('0xef')](createObjHistory(_0x22cb25,_0x4ac890,_0xc2f6('0x1ff'),0xd,'Blacklist'),_0xc2f6('0x200'),_0xc2f6('0x201'));throw'inBlackList';}};};Dialer[_0xc2f6('0x20')][_0xc2f6('0x16e')]=function(_0x19f458){var _0x2ea9cf=this;var _0x151645=_0x19f458[_0xc2f6('0x202')]-_0x19f458[_0xc2f6('0x7b')]-_0x19f458[_0xc2f6('0xc7')];emitCampaignSummary(_0x19f458);if(_0x151645>0x0){if(_0x151645>this[_0xc2f6('0x29')]){_0x151645=this[_0xc2f6('0x29')];}_0x19f458[_0xc2f6('0xc7')]+=_0x151645;this['getContactDialerIvr'](_0x19f458['id'],_0x151645,_0x19f458[_0xc2f6('0x203')],_0x19f458)[_0xc2f6('0x46')](function(_0x37456e){_0x19f458[_0xc2f6('0xc7')]-=_0x151645;_0x19f458[_0xc2f6('0xc7')]=_0x19f458[_0xc2f6('0xc7')]>0x0?_0x19f458[_0xc2f6('0xc7')]:0x0;if(!checkContactEmpty(_0x37456e)){_0x19f458[_0xc2f6('0x49')]=_0xc2f6('0x204');logger['info'](_0xc2f6('0x205')+_0x19f458[_0xc2f6('0x4b')]);}else{_0x19f458[_0xc2f6('0x7b')]+=_0x37456e['length'];_0x19f458['message']=_0xc2f6('0x206');for(var _0x540373=0x0;_0x540373<_0x37456e['length'];_0x540373+=0x1){_0x19f458[_0xc2f6('0x207')]+=0x1;if(_[_0xc2f6('0xb2')](_0x37456e[_0x540373])||_[_0xc2f6('0xb2')](_0x37456e[_0x540373][_0xc2f6('0x17d')])||_[_0xc2f6('0xb2')](_0x37456e[_0x540373]['Contact'][_0xc2f6('0x17c')])){_0x2ea9cf[_0xc2f6('0xd3')](_0xc2f6('0x208'),_0x19f458,_0x37456e[_0x540373]);}else{_0x2ea9cf[_0xc2f6('0xbf')](_[_0xc2f6('0xd6')](_0x37456e[_0x540373],['CampaignId','Contact.phone']))[_0xc2f6('0x46')](_0x2ea9cf[_0xc2f6('0x1f2')](_0x19f458,_0x37456e[_0x540373]))['catch'](_0x2ea9cf[_0xc2f6('0xd2')](_0xc2f6('0x209'),_0x19f458));}}}})[_0xc2f6('0xb4')](loggerGetContactDialer(_0xc2f6('0x20a'),_0x19f458,_0x151645));}};Dialer[_0xc2f6('0x20')]['handlePower']=function(_0x413b6a,_0xfece92){var _0x3e8cac=this;var _0x5e26f6=[];var _0x41b3f5=_0xfece92>=0x1?_0xfece92:0x1;if(_0x413b6a[_0xc2f6('0x163')]===_0xc2f6('0xb')){_0x41b3f5=0x1;}var _0x182ff3=Math['floor'](_0x413b6a[_0xc2f6('0x5a')]*_0x41b3f5)-_0x413b6a[_0xc2f6('0x7b')]-_0x413b6a[_0xc2f6('0xc7')];emitVoiceQueueSummary(_0x413b6a);if(_0x413b6a[_0xc2f6('0x20b')]>0x0){var _0x11365b=_0x413b6a[_0xc2f6('0x20b')]-_0x413b6a[_0xc2f6('0x7b')]-_0x413b6a[_0xc2f6('0x5f')]-_0x413b6a[_0xc2f6('0xc7')]-_0x413b6a['pTalking'];if(_0x182ff3>_0x11365b){_0x182ff3=_0x11365b;}}if(_0x182ff3>0x0){if(_0x413b6a['dialMethod']==='booked'){_0x182ff3=0x1;}if(_0x182ff3>this[_0xc2f6('0x29')]){_0x182ff3=this[_0xc2f6('0x29')];}_0x413b6a[_0xc2f6('0xc7')]+=_0x182ff3;for(var _0x2776a4 in this[_0xc2f6('0x28')]){if(typeof this['agents'][_0x2776a4]!==_0xc2f6('0x9e')){if(this[_0xc2f6('0x28')][_0x2776a4]['state']===_0xc2f6('0x20c')&&this['agents'][_0x2776a4][_0xc2f6('0xb3')]==='reachable'){_0x5e26f6[_0xc2f6('0x154')](this['agents'][_0x2776a4]['id']);}}}this['getContactDialer'](_0x413b6a['id'],_0x5e26f6,_0x182ff3,_0x413b6a[_0xc2f6('0x203')],_0x413b6a)['then'](function(_0x25715b){_0x413b6a[_0xc2f6('0xc7')]-=_0x182ff3;_0x413b6a[_0xc2f6('0xc7')]=_0x413b6a[_0xc2f6('0xc7')]>0x0?_0x413b6a['temp']:0x0;if(!checkContactEmpty(_0x25715b)){_0x3e8cac['countReScheduled'](_0x413b6a)[_0xc2f6('0x46')](sendMessageReschedule(_0x413b6a))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xbc')));}else{_0x413b6a['originated']+=_0x25715b[_0xc2f6('0x9d')];_0x413b6a['message']=_0x413b6a[_0xc2f6('0x163')]==='booked'?'ACTIVE':'RUNNING';for(var _0x1bccd7=0x0;_0x1bccd7<_0x25715b[_0xc2f6('0x9d')];_0x1bccd7+=0x1){if(_['isNil'](_0x25715b[_0x1bccd7])||_[_0xc2f6('0xb2')](_0x25715b[_0x1bccd7][_0xc2f6('0x17d')])||_['isNil'](_0x25715b[_0x1bccd7]['Contact'][_0xc2f6('0x17c')])){_0x3e8cac[_0xc2f6('0xd3')](_0xc2f6('0x208'),_0x413b6a,_0x25715b[_0x1bccd7]);}else{_0x3e8cac[_0xc2f6('0xbd')](_[_0xc2f6('0xd6')](_0x25715b[_0x1bccd7],[_0xc2f6('0xd8'),_0xc2f6('0x20d')]))[_0xc2f6('0x46')](_0x3e8cac[_0xc2f6('0x1f2')](_0x413b6a,_0x25715b[_0x1bccd7]))[_0xc2f6('0xb4')](_0x3e8cac[_0xc2f6('0xd2')](_0xc2f6('0x208'),_0x413b6a));}}}})[_0xc2f6('0xb4')](loggerGetContactDialer('[getContactDialer2]',_0x413b6a,_0x182ff3));}};Dialer[_0xc2f6('0x20')][_0xc2f6('0x97')]=function(_0x58c79f){if(_0x58c79f[_0xc2f6('0x20b')]>0x0){var _0x599506=_0x58c79f[_0xc2f6('0x20b')]-_0x58c79f['originated']-_0x58c79f['talking'];if(_0x599506>0x0){this[_0xc2f6('0x20e')](_0x58c79f);}else{loggerPredictiveCalls[_0xc2f6('0x86')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x58c79f);}};Dialer[_0xc2f6('0x20')]['tryOriginatePredictive']=function(_0x3ffe63){var _0x17ede6=this;var _0x2162d2=[];_0x3ffe63[_0xc2f6('0x7b')]+=0x1;for(var _0xda5577 in this[_0xc2f6('0x28')]){if(typeof this[_0xc2f6('0x28')][_0xda5577]!=='undefined'){if(this[_0xc2f6('0x28')][_0xda5577][_0xc2f6('0xab')]===_0xc2f6('0x20c')&&this['agents'][_0xda5577][_0xc2f6('0xb3')]===_0xc2f6('0xe0')){_0x2162d2[_0xc2f6('0x154')](this['agents'][_0xda5577]['id']);}}}this[_0xc2f6('0xc6')](_0x3ffe63['id'],_0x2162d2,0x1,_0x3ffe63[_0xc2f6('0x203')],_0x3ffe63)[_0xc2f6('0x46')](function(_0x5dea38){if(!checkContactEmpty(_0x5dea38)){checkContactLowerLimitOriginate(_0x3ffe63,0x1,0x0);_0x17ede6[_0xc2f6('0xba')](_0x3ffe63)[_0xc2f6('0x46')](sendMessageReschedule(_0x3ffe63))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3ffe63[_0xc2f6('0x49')]=_0xc2f6('0x206');if(_[_0xc2f6('0xb2')](_0x5dea38[0x0])||_[_0xc2f6('0xb2')](_0x5dea38[0x0]['Contact'])||_[_0xc2f6('0xb2')](_0x5dea38[0x0][_0xc2f6('0x17d')][_0xc2f6('0x17c')])){_0x17ede6[_0xc2f6('0xd3')](_0xc2f6('0x208'),_0x3ffe63,_0x5dea38[0x0]);}else{_0x17ede6[_0xc2f6('0xbd')](_[_0xc2f6('0xd6')](_0x5dea38[0x0],['VoiceQueueId','Contact.phone']))['then'](_0x17ede6[_0xc2f6('0x1f2')](_0x3ffe63,_0x5dea38[0x0]))[_0xc2f6('0xb4')](_0x17ede6[_0xc2f6('0xd2')](_0xc2f6('0x20f'),_0x3ffe63));}}})[_0xc2f6('0xb4')](loggerGetContactDialer(_0xc2f6('0x210'),_0x3ffe63,0x1));emitVoiceQueueSummary(_0x3ffe63);};Dialer[_0xc2f6('0x20')]['abandonmentRate']=function(_0x38b23f,_0x202195,_0x56b264,_0x224100,_0xf0cc8a,_0x4c8999){loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x211'));loggerPredictive[_0xc2f6('0x86')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38b23f);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x212'),_0x202195);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x213'),_0x56b264);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x214'),_0x224100);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x215'),_0xf0cc8a);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x216'));return new BPromise(function(_0x29c2ae,_0x3ad9d){if(_0x38b23f<=0x0||isNaN(_0x38b23f)){return _0x3ad9d(msgResponse(_0xc2f6('0x217'),_0xc2f6('0x53'),'m\x20=\x20'+_0x38b23f));}if(_0x56b264<=0x0||isNaN(_0x56b264)){return _0x3ad9d(msgResponse('[abandonmentRate]','Error',_0xc2f6('0x218')+_0x56b264));}if(_0x224100<=0x0||isNaN(_0x224100)){return _0x3ad9d(msgResponse('[abandonmentRate]',_0xc2f6('0x53'),_0xc2f6('0x219')+_0x224100));}if(_0x202195<=0x0||isNaN(_0x202195)){return _0x3ad9d(msgResponse(_0xc2f6('0x217'),_0xc2f6('0x53'),'interval\x20=\x20'+_0x202195));}if(_0xf0cc8a<=0x0||isNaN(_0xf0cc8a)){return _0x3ad9d(msgResponse(_0xc2f6('0x217'),_0xc2f6('0x53'),_0xc2f6('0x21a')+_0xf0cc8a));}_0x4c8999=_0x4c8999||0x0;var _0x4ede73=0x1/_0x56b264;var _0x4682d7=0x0;var _0x3443cf=0x0;var _0x243a63=0x0;var _0x28970a=0x0;for(var _0x346e44=0x0;_0x243a63<_0xf0cc8a;_0x346e44+=0x1){_0x3443cf=_0x346e44/_0x202195;_0x4682d7=(_0x224100*_0x3443cf+_0x4c8999)/_0x4ede73;_0x243a63=erlangb(_0x4682d7,_0x38b23f);_0x28970a=_0x4682d7/_0x38b23f*(0x1-erlangb(_0x4682d7,_0x38b23f));}return _0x29c2ae({'erlangCalls':_0x346e44,'erlangCallToSecond':_0x202195/_0x346e44,'erlangAbandonmentRate':_0x243a63,'erlangBusyFactor':_0x28970a});});};Dialer[_0xc2f6('0x20')][_0xc2f6('0x1e7')]=function(_0x362988,_0x1c446e,_0xa411bd,_0x459b49,_0x332a89,_0x4173ff){loggerPredictive['info'](_0xc2f6('0x21b'));loggerPredictive['info'](_0xc2f6('0x21c'),_0x362988);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x212'),_0x1c446e);loggerPredictive[_0xc2f6('0x86')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa411bd);loggerPredictive[_0xc2f6('0x86')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x459b49);loggerPredictive[_0xc2f6('0x86')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x332a89);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x216'));return new BPromise(function(_0x2f1de5,_0x1d2783){if(_0x362988<=0x0||isNaN(_0x362988)){return _0x1d2783(msgResponse(_0xc2f6('0x21d'),_0xc2f6('0x53'),_0xc2f6('0x21e')+_0x362988));}if(_0xa411bd<=0x0||isNaN(_0xa411bd)){return _0x1d2783(msgResponse(_0xc2f6('0x21d'),_0xc2f6('0x53'),_0xc2f6('0x218')+_0xa411bd));}if(_0x459b49<=0x0||isNaN(_0x459b49)){return _0x1d2783(msgResponse(_0xc2f6('0x21d'),_0xc2f6('0x53'),_0xc2f6('0x219')+_0x459b49));}if(_0x1c446e<=0x0||isNaN(_0x1c446e)){return _0x1d2783(msgResponse(_0xc2f6('0x21d'),_0xc2f6('0x53'),'interval\x20=\x20'+_0x1c446e));}if(_0x332a89<=0x0||isNaN(_0x332a89)){return _0x1d2783(msgResponse(_0xc2f6('0x21d'),'Error','Umin\x20=\x20'+_0x332a89));}_0x4173ff=_0x4173ff||0x0;var _0x285e23=0x1/_0xa411bd;var _0x15f404=0x0;var _0x60f9cb=0x0;var _0x2ca6cb=0x0;var _0x2727a9=0x0;for(var _0x2fb724=0x0;_0x2727a9<_0x332a89;_0x2fb724+=0x1){_0x60f9cb=_0x2fb724/_0x1c446e;_0x15f404=(_0x459b49*_0x60f9cb+_0x4173ff)/_0x285e23;_0x2ca6cb=erlangb(_0x15f404,_0x362988);_0x2727a9=_0x15f404/_0x362988*(0x1-erlangb(_0x15f404,_0x362988));}return _0x2f1de5({'erlangCalls':_0x2fb724,'erlangCallToSecond':_0x1c446e/_0x2fb724,'erlangAbandonmentRate':_0x2ca6cb,'erlangBusyFactor':_0x2727a9});});};module[_0xc2f6('0x21f')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index f5ec762..6c235a7 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x59fd=['responsetime','droptime','endtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','number','starttime'];(function(_0x1a7e14,_0x100435){var _0x53abf8=function(_0x4767ab){while(--_0x4767ab){_0x1a7e14['push'](_0x1a7e14['shift']());}};_0x53abf8(++_0x100435);}(_0x59fd,0x1f3));var _0xd59f=function(_0x5764e1,_0x2ec298){_0x5764e1=_0x5764e1-0x0;var _0x4b4e23=_0x59fd[_0x5764e1];return _0x4b4e23;};'use strict';var util=require(_0xd59f('0x0'));var _=require(_0xd59f('0x1'));var moment=require(_0xd59f('0x2'));function getSeconds(_0x23a1c4,_0x42330d){var _0x45a47e=moment(_0x23a1c4)[_0xd59f('0x3')](0x0);var _0x320e80=moment(_0x42330d)[_0xd59f('0x3')](0x0);return _0x45a47e['diff'](_0x320e80,_0xd59f('0x4'));}function QueueCallerAbandon(_0x479cc9,_0x3ee1bd){this['scheduledat']=_0x479cc9['scheduledat'];this[_0xd59f('0x5')]=_0x479cc9[_0xd59f('0x5')];this[_0xd59f('0x6')]=_0x479cc9[_0xd59f('0x5')]==='outbound'?_0xd59f('0x7'):_0x479cc9[_0xd59f('0x5')];this[_0xd59f('0x8')]=_0x479cc9[_0xd59f('0x8')];this[_0xd59f('0x9')]=_0x479cc9[_0xd59f('0x9')];this['countnoanswerretry']=_0x479cc9[_0xd59f('0xa')];this[_0xd59f('0xb')]=_0x479cc9[_0xd59f('0x8')]+_0x479cc9[_0xd59f('0x9')]+_0x479cc9[_0xd59f('0xa')]+_0x479cc9['countnosuchnumberretry']+_0x479cc9[_0xd59f('0xc')]+_0x479cc9[_0xd59f('0xd')]+_0x479cc9['countmachineretry']+_0x479cc9[_0xd59f('0xe')];this[_0xd59f('0xf')]=_0x479cc9[_0xd59f('0xf')];this[_0xd59f('0xc')]=_0x479cc9['countdropretry'];this['countabandonedretry']=_0x479cc9[_0xd59f('0xd')];this[_0xd59f('0x10')]=_0x479cc9['countmachineretry'];this[_0xd59f('0xe')]=_0x479cc9['countagentrejectretry'];this['uniqueid']=_0x3ee1bd['uniqueid'];this['calleridname']=_0x479cc9['name'];this['calleridnum']=_0x479cc9[_0xd59f('0x11')];this[_0xd59f('0x12')]=_0x479cc9[_0xd59f('0x12')];this[_0xd59f('0x13')]=_0x479cc9['responsetime'];this[_0xd59f('0x14')]=_0x479cc9[_0xd59f('0x14')];this[_0xd59f('0x15')]=this['droptime'];this['ringtime']=getSeconds(_0x479cc9[_0xd59f('0x13')],_0x479cc9['starttime']);this[_0xd59f('0x16')]=getSeconds(this[_0xd59f('0x14')],_0x479cc9['responsetime']);this[_0xd59f('0x17')]=0x0;this[_0xd59f('0x7')]=_0x3ee1bd[_0xd59f('0x7')];this[_0xd59f('0x18')]=_0x3ee1bd['connectedlinename'];this[_0xd59f('0x19')]=_0x3ee1bd[_0xd59f('0x19')];this[_0xd59f('0x1a')]=_0x479cc9[_0xd59f('0x1a')];this[_0xd59f('0x1b')]=_0x479cc9[_0xd59f('0x1b')];this[_0xd59f('0x1c')]=_0x479cc9[_0xd59f('0x1c')];this[_0xd59f('0x1d')]=_0x479cc9['recallme'];this[_0xd59f('0x1e')]=_0x479cc9[_0xd59f('0x1e')];this[_0xd59f('0x1f')]=_0x479cc9[_0xd59f('0x1f')];this['UserId']=_0x479cc9['UserId'];this[_0xd59f('0x20')]=_0x479cc9[_0xd59f('0x20')];this['CampaignId']=_0x479cc9[_0xd59f('0x21')];this[_0xd59f('0x22')]=_0x479cc9['originatecalleridnum']||'';this[_0xd59f('0x23')]=_0x479cc9[_0xd59f('0x23')]||'';}module[_0xd59f('0x24')]=QueueCallerAbandon; \ No newline at end of file +var _0x363f=['milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x363f,0x1cb));var _0xf363=function(_0x5d7358,_0x594ab7){_0x5d7358=_0x5d7358-0x0;var _0x558421=_0x363f[_0x5d7358];return _0x558421;};'use strict';var util=require(_0xf363('0x0'));var _=require(_0xf363('0x1'));var moment=require(_0xf363('0x2'));function getSeconds(_0x41c7bd,_0x1e2b3d){var _0x7dff70=moment(_0x41c7bd)[_0xf363('0x3')](0x0);var _0x522fbb=moment(_0x1e2b3d)['milliseconds'](0x0);return _0x7dff70[_0xf363('0x4')](_0x522fbb,_0xf363('0x5'));}function QueueCallerAbandon(_0x3203dd,_0x304fb1){this[_0xf363('0x6')]=_0x3203dd['scheduledat'];this[_0xf363('0x7')]=_0x3203dd[_0xf363('0x7')];this[_0xf363('0x8')]=_0x3203dd[_0xf363('0x7')]==='outbound'?_0xf363('0x9'):_0x3203dd[_0xf363('0x7')];this[_0xf363('0xa')]=_0x3203dd[_0xf363('0xa')];this['countcongestionretry']=_0x3203dd[_0xf363('0xb')];this[_0xf363('0xc')]=_0x3203dd[_0xf363('0xc')];this[_0xf363('0xd')]=_0x3203dd[_0xf363('0xa')]+_0x3203dd[_0xf363('0xb')]+_0x3203dd['countnoanswerretry']+_0x3203dd[_0xf363('0xe')]+_0x3203dd[_0xf363('0xf')]+_0x3203dd[_0xf363('0x10')]+_0x3203dd['countmachineretry']+_0x3203dd[_0xf363('0x11')];this[_0xf363('0xe')]=_0x3203dd[_0xf363('0xe')];this[_0xf363('0xf')]=_0x3203dd['countdropretry'];this[_0xf363('0x10')]=_0x3203dd[_0xf363('0x10')];this['countmachineretry']=_0x3203dd[_0xf363('0x12')];this[_0xf363('0x11')]=_0x3203dd[_0xf363('0x11')];this[_0xf363('0x13')]=_0x304fb1[_0xf363('0x13')];this[_0xf363('0x14')]=_0x3203dd['name'];this['calleridnum']=_0x3203dd['number'];this[_0xf363('0x15')]=_0x3203dd['starttime'];this['responsetime']=_0x3203dd[_0xf363('0x16')];this[_0xf363('0x17')]=_0x3203dd[_0xf363('0x17')];this[_0xf363('0x18')]=this[_0xf363('0x17')];this[_0xf363('0x19')]=getSeconds(_0x3203dd[_0xf363('0x16')],_0x3203dd['starttime']);this[_0xf363('0x1a')]=getSeconds(this[_0xf363('0x17')],_0x3203dd['responsetime']);this[_0xf363('0x1b')]=0x0;this[_0xf363('0x9')]=_0x304fb1[_0xf363('0x9')];this[_0xf363('0x1c')]=_0x304fb1[_0xf363('0x1d')];this[_0xf363('0x1e')]=_0x304fb1['reason'];this[_0xf363('0x1f')]=_0x3203dd['callback'];this[_0xf363('0x20')]=_0x3203dd['callbackuniqueid'];this[_0xf363('0x21')]=_0x3203dd['callbackat'];this[_0xf363('0x22')]=_0x3203dd[_0xf363('0x22')];this[_0xf363('0x23')]=_0x3203dd['ContactId'];this[_0xf363('0x24')]=_0x3203dd[_0xf363('0x24')];this[_0xf363('0x25')]=_0x3203dd['UserId'];this[_0xf363('0x26')]=_0x3203dd['VoiceQueueId'];this[_0xf363('0x27')]=_0x3203dd[_0xf363('0x27')];this[_0xf363('0x28')]=_0x3203dd['originatecalleridnum']||'';this[_0xf363('0x29')]=_0x3203dd[_0xf363('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 88e91cc..2d534e7 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x5df266,_0x46a5bd){var _0x18a2a4=function(_0x56d524){while(--_0x56d524){_0x5df266['push'](_0x5df266['shift']());}};_0x18a2a4(++_0x46a5bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x8a34a9,_0x365707){var _0x5bfebb=function(_0x2ddc23){while(--_0x2ddc23){_0x8a34a9['push'](_0x8a34a9['shift']());}};_0x5bfebb(++_0x365707);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 5e8fd28..268bab0 100644 --- a/server/services/ami/fax/index.js +++ b/server/services/ami/fax/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','actions','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','bluebird','moment','tiff2pdf','../../../config/logger','fax','../ami','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','channelstate','channelstatedesc','variable','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred'];(function(_0x12a051,_0x363f69){var _0x390cf0=function(_0x47d300){while(--_0x47d300){_0x12a051['push'](_0x12a051['shift']());}};_0x390cf0(++_0x363f69);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb7e7[_0x1a36a5];return _0x746243;};'use strict';var util=require(_0x7b7e('0x0'));var _=require('lodash');var BPromise=require(_0x7b7e('0x1'));var uuid=require('uuid');var moment=require(_0x7b7e('0x2'));var path=require('path');var tiff2pdf=require(_0x7b7e('0x3'));var gs=require('./util/gs');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var ami=require(_0x7b7e('0x6'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x7b7e('0x7'));var Action=require(_0x7b7e('0x8'));var faxAccount=require(_0x7b7e('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x7b7e('0xa'));function Fax(_0x223587){this[_0x7b7e('0xb')]={};this[_0x7b7e('0xc')]=_0x223587[_0x7b7e('0xc')];this[_0x7b7e('0xd')]=_0x223587[_0x7b7e('0xd')];this['actions']={};ami['on'](_0x7b7e('0xe'),this[_0x7b7e('0xf')][_0x7b7e('0x10')](this));ami['on'](_0x7b7e('0x11'),this[_0x7b7e('0x12')][_0x7b7e('0x10')](this));ami['on'](_0x7b7e('0x13'),this[_0x7b7e('0x14')][_0x7b7e('0x10')](this));ami['on']('newexten',this[_0x7b7e('0x15')][_0x7b7e('0x10')](this));ami['on']('faxstatus',this[_0x7b7e('0x16')]['bind'](this));ami['on']('receivefax',this[_0x7b7e('0x17')][_0x7b7e('0x10')](this));ami['on'](_0x7b7e('0x18'),this[_0x7b7e('0x19')][_0x7b7e('0x10')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x7b7e('0x10')](this));}Fax[_0x7b7e('0x1a')][_0x7b7e('0xf')]=function(_0x26aaec){if(_0x26aaec[_0x7b7e('0x1b')]===_0x7b7e('0x1c')){for(var _0x242368 in this[_0x7b7e('0xc')]){if(this[_0x7b7e('0xc')][_0x7b7e('0x1d')](_0x242368)){if(_0x26aaec[_0x7b7e('0x1e')]===this[_0x7b7e('0xc')][_0x242368][_0x7b7e('0x1f')]){this[_0x7b7e('0xb')][_0x26aaec[_0x7b7e('0x20')]]={};this[_0x7b7e('0xb')][_0x26aaec[_0x7b7e('0x20')]]['channel']=_0x26aaec[_0x7b7e('0x21')];this[_0x7b7e('0xb')][_0x26aaec[_0x7b7e('0x20')]]['id']=this['faxAccounts'][_0x242368]['id'];this[_0x7b7e('0xb')][_0x26aaec[_0x7b7e('0x20')]][_0x7b7e('0x22')]=this[_0x7b7e('0xc')][_0x242368][_0x7b7e('0x22')];logger[_0x7b7e('0x23')](_0x26aaec[_0x7b7e('0x20')],_0x7b7e('0x24'));}}}}if(this['actions'][_0x26aaec['uniqueid']]){this['channels'][_0x26aaec[_0x7b7e('0x20')]]={};this[_0x7b7e('0xb')][_0x26aaec[_0x7b7e('0x20')]]['channel']=_0x26aaec['channel'];logger['info'](_0x26aaec[_0x7b7e('0x20')],_0x7b7e('0x24'));}};Fax[_0x7b7e('0x1a')][_0x7b7e('0x12')]=function(_0x3ceaf5){if(this['channels'][_0x3ceaf5[_0x7b7e('0x20')]]){for(var _0x21a15 in _0x3ceaf5['variable']){if(_0x3ceaf5['variable']['hasOwnProperty'](_0x21a15)){this[_0x7b7e('0xb')][_0x3ceaf5[_0x7b7e('0x20')]][_0x21a15]=_0x3ceaf5['value'];}}}};Fax[_0x7b7e('0x1a')]['syncNewState']=function(_0x1b4341){if(this[_0x7b7e('0xb')][_0x1b4341[_0x7b7e('0x20')]]){this['channels'][_0x1b4341[_0x7b7e('0x20')]][_0x7b7e('0x25')]=_0x1b4341[_0x7b7e('0x25')];this[_0x7b7e('0xb')][_0x1b4341[_0x7b7e('0x20')]]['channelstatedesc']=_0x1b4341[_0x7b7e('0x26')];}};Fax['prototype'][_0x7b7e('0x15')]=function(_0x1c7de4){if(this[_0x7b7e('0xb')][_0x1c7de4[_0x7b7e('0x20')]]){for(var _0x378faa in _0x1c7de4[_0x7b7e('0x27')]){if(_0x1c7de4[_0x7b7e('0x27')]['hasOwnProperty'](_0x378faa)){this['channels'][_0x1c7de4[_0x7b7e('0x20')]][_0x378faa]=_0x1c7de4[_0x7b7e('0x28')];}}}};Fax['prototype'][_0x7b7e('0x16')]=function(_0x2a4754){if(this[_0x7b7e('0xb')][_0x2a4754['uniqueid']]){this[_0x7b7e('0xb')][_0x2a4754[_0x7b7e('0x20')]][_0x7b7e('0x29')]=_0x2a4754[_0x7b7e('0x29')];this[_0x7b7e('0xb')][_0x2a4754[_0x7b7e('0x20')]][_0x7b7e('0x2a')]=_0x2a4754[_0x7b7e('0x2a')];this[_0x7b7e('0xb')][_0x2a4754[_0x7b7e('0x20')]][_0x7b7e('0x1f')]=_0x2a4754[_0x7b7e('0x1f')];this[_0x7b7e('0xb')][_0x2a4754[_0x7b7e('0x20')]][_0x7b7e('0x2b')]=_0x2a4754[_0x7b7e('0x2b')];logger['info'](_0x2a4754[_0x7b7e('0x20')],_0x7b7e('0x2c'));}};Fax[_0x7b7e('0x1a')][_0x7b7e('0x17')]=function(_0x36abfc){var _0x909c65=this;if(this[_0x7b7e('0xb')][_0x36abfc[_0x7b7e('0x20')]]){var _0x1c6d11=this[_0x7b7e('0xb')][_0x36abfc['uniqueid']]['id'];this[_0x7b7e('0xb')][_0x36abfc[_0x7b7e('0x20')]][_0x7b7e('0x2d')]=_0x36abfc[_0x7b7e('0x2d')];this['channels'][_0x36abfc[_0x7b7e('0x20')]][_0x7b7e('0x2e')]=_0x36abfc[_0x7b7e('0x2e')];this['channels'][_0x36abfc['uniqueid']][_0x7b7e('0x1f')]=_0x36abfc['localstationid'];this[_0x7b7e('0xb')][_0x36abfc[_0x7b7e('0x20')]]['resolution']=_0x36abfc[_0x7b7e('0x2f')];this[_0x7b7e('0xb')][_0x36abfc[_0x7b7e('0x20')]][_0x7b7e('0x30')]=_0x36abfc[_0x7b7e('0x30')];this[_0x7b7e('0xb')][_0x36abfc[_0x7b7e('0x20')]][_0x7b7e('0x2b')]=_0x36abfc[_0x7b7e('0x2b')];this['channels'][_0x36abfc['uniqueid']][_0x7b7e('0x31')]=_0x36abfc['calleridnum'];if(this[_0x7b7e('0xb')][_0x36abfc['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x36abfc[_0x7b7e('0x2b')],'/var/opt/motion2/server/files/attachments/',function(_0x2f9982){logger['info'](_0x36abfc[_0x7b7e('0x20')],_0x7b7e('0x32'),_0x2f9982[_0x7b7e('0x33')]);attachment[_0x7b7e('0x34')]({'name':path['parse'](_0x36abfc[_0x7b7e('0x2b')])[_0x7b7e('0x22')],'basename':path[_0x7b7e('0x35')](_0x36abfc[_0x7b7e('0x2b')])[_0x7b7e('0x22')]+_0x7b7e('0x36'),'type':'application/pdf'})['then'](function(_0x5827f7){faxAccount[_0x7b7e('0x37')](_0x1c6d11,{'from':_0x36abfc[_0x7b7e('0x31')],'mapKey':_0x7b7e('0x5'),'body':path[_0x7b7e('0x35')](_0x36abfc[_0x7b7e('0x2b')])[_0x7b7e('0x22')]+'.pdf','AttachmentId':_0x5827f7['id']})[_0x7b7e('0x38')](function(_0x42e560){logger['error'](_0x36abfc['uniqueid'],_0x7b7e('0x39'),JSON[_0x7b7e('0x3a')](_0x42e560));});})[_0x7b7e('0x38')](function(_0x378a29){logger[_0x7b7e('0x3b')](_0x36abfc[_0x7b7e('0x20')],'\x20receiveFax\x20',JSON[_0x7b7e('0x3a')](_0x378a29));});});}logger['info'](_0x36abfc[_0x7b7e('0x20')],_0x7b7e('0x3c'));}};Fax[_0x7b7e('0x1a')][_0x7b7e('0x3d')]=function(_0x58e4e6){if(this[_0x7b7e('0x3e')][_0x58e4e6[_0x7b7e('0x20')]]){_[_0x7b7e('0x3f')](this[_0x7b7e('0xb')][_0x58e4e6[_0x7b7e('0x20')]],_['pick'](_0x58e4e6,[_0x7b7e('0x40'),_0x7b7e('0x41')]));}};function updateStatus(_0x21868a){if(_0x21868a[_0x7b7e('0x42')]){faxMessage[_0x7b7e('0x43')](_0x21868a['AttachmentId'],{'failMessage':_0x7b7e('0x44')})[_0x7b7e('0x45')](function(_0x46d4ee){ut[_0x7b7e('0x46')](_0x7b7e('0x47'),_0x46d4ee);})[_0x7b7e('0x38')](function(_0x210768){ut['logger'](_0x7b7e('0x48'),_0x210768);});}else{ut['logger'](_0x7b7e('0x49'));}}Fax[_0x7b7e('0x1a')]['updateStatus']=function(_0x36f1be,_0x44e3a0,_0x16c81d){var _0x3afe88=this;var _0x412d1b={};if(_0x44e3a0){_0x412d1b={'read':_0x44e3a0};}else{_0x412d1b={'failMessage':_0x16c81d};}if(this[_0x7b7e('0x3e')][_0x36f1be][_0x7b7e('0x42')]){faxMessage['update'](this[_0x7b7e('0x3e')][_0x36f1be][_0x7b7e('0x42')],_0x412d1b)[_0x7b7e('0x45')](function(_0x24481a){ut['logger']('[Fax][Message][Updated]',_0x24481a);})['catch'](function(_0x2471ad){ut[_0x7b7e('0x46')](_0x7b7e('0x4a'),_0x2471ad);})['finally'](function(){delete _0x3afe88['channels'][_0x36f1be];delete _0x3afe88[_0x7b7e('0x3e')][_0x36f1be];});}else{ut[_0x7b7e('0x46')]('[Fax][Message][NoUpdate2]');delete this[_0x7b7e('0xb')][_0x36f1be];delete this[_0x7b7e('0x3e')][_0x36f1be];}};Fax[_0x7b7e('0x1a')]['syncHangup']=function(_0x2b0657){var _0x1d9af5=this;if(this['channels'][_0x2b0657[_0x7b7e('0x20')]]){if(this[_0x7b7e('0x3e')][_0x2b0657[_0x7b7e('0x20')]]){this[_0x7b7e('0xb')][_0x2b0657[_0x7b7e('0x20')]]['id']=this[_0x7b7e('0x3e')][_0x2b0657[_0x7b7e('0x20')]]['id'];this[_0x7b7e('0xb')][_0x2b0657[_0x7b7e('0x20')]]['name']=this[_0x7b7e('0x3e')][_0x2b0657[_0x7b7e('0x20')]]['name'];}logger[_0x7b7e('0x23')](_0x2b0657[_0x7b7e('0x20')],this[_0x7b7e('0x3e')][_0x2b0657['uniqueid']]?_0x7b7e('0x4b'):'\x20hangup\x20faxRiceive\x20',JSON[_0x7b7e('0x3a')](this[_0x7b7e('0xb')][_0x2b0657['uniqueid']]));if(this[_0x7b7e('0x3e')][_0x2b0657[_0x7b7e('0x20')]]){if(this['channels'][_0x2b0657[_0x7b7e('0x20')]][_0x7b7e('0x4c')]>0x0&&this[_0x7b7e('0xb')][_0x2b0657[_0x7b7e('0x20')]]['faxstatus']===_0x7b7e('0x4d')){this[_0x7b7e('0x4e')](_0x2b0657[_0x7b7e('0x20')],!![]);}else{this[_0x7b7e('0x4e')](_0x2b0657[_0x7b7e('0x20')],![],this[_0x7b7e('0xb')][_0x2b0657[_0x7b7e('0x20')]][_0x7b7e('0x4f')]?_0x7b7e('0x50')+this[_0x7b7e('0xb')][_0x2b0657['uniqueid']][_0x7b7e('0x4f')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x7b7e('0x51')]=function(_0x7cbe6c){var _0x1eb4b1=this;return new BPromise(function(_0x3dfd33,_0x5cd4ae){_0x1eb4b1[_0x7b7e('0x52')](_0x7cbe6c,_0x1eb4b1[_0x7b7e('0xc')][_0x7cbe6c[_0x7b7e('0x53')]])[_0x7b7e('0x45')](function(_0x169540){ut[_0x7b7e('0x46')]('[Fax][execOriginate][success]',_0x169540);_0x3dfd33(ut[_0x7b7e('0x33')]('Fax\x20received'));})['catch'](function(_0x43a61b){ut['logger'](_0x7b7e('0x54'),_0x43a61b);updateStatus(_0x7cbe6c);_0x5cd4ae(ut['message'](_0x7b7e('0x55')));});});};Fax[_0x7b7e('0x1a')]['checkAfterSend']=function(_0x2c167d){var _0x2da71e=this;return new BPromise(function(_0x57e88f,_0x106a16){var _0x27a552=_0x2da71e[_0x7b7e('0x56')](_0x2da71e[_0x7b7e('0xc')][_0x2c167d[_0x7b7e('0x53')]][_0x7b7e('0x57')],_0x2c167d);if(_0x27a552[_0x7b7e('0x58')]){_0x57e88f(ut[_0x7b7e('0x33')](_0x7b7e('0x59')));}else{_0x106a16(ut[_0x7b7e('0x33')](_0x27a552['message']));}});};function originate(_0x59ecf9,_0x34e7df,_0x46ac1f){return new BPromise(function(_0x2c6e3a,_0x348c77){if(_0x46ac1f){var _0xea39fa=util[_0x7b7e('0x5a')](_0x7b7e('0x5b'),path['parse'](_0x59ecf9[_0x7b7e('0x5c')])[_0x7b7e('0x22')],_0x59ecf9['path']);gs[_0x7b7e('0x5d')](_0xea39fa)[_0x7b7e('0x45')](function(){_0x59ecf9[_0x7b7e('0x5c')]=util[_0x7b7e('0x5a')](_0x7b7e('0x5e'),path[_0x7b7e('0x35')](_0x59ecf9[_0x7b7e('0x5c')])[_0x7b7e('0x5f')],path[_0x7b7e('0x35')](_0x59ecf9[_0x7b7e('0x5c')])[_0x7b7e('0x22')]);_0x34e7df['XMF-PATH']=_0x59ecf9[_0x7b7e('0x5c')];ut[_0x7b7e('0x46')](_0x7b7e('0x60'),'');ami[_0x7b7e('0x61')](ut[_0x7b7e('0x62')](_0x59ecf9,_0x34e7df))[_0x7b7e('0x45')](function(_0xfdd68c){_0x2c6e3a(_0xfdd68c);})['catch'](function(_0x2158b8){_0x348c77(_0x2158b8);});})[_0x7b7e('0x38')](function(_0x1eb5ce){_0x348c77(_0x1eb5ce);});}else{ami['Action'](ut[_0x7b7e('0x62')](_0x59ecf9,_0x34e7df))[_0x7b7e('0x45')](function(_0x381ee6){_0x2c6e3a(_0x381ee6);})[_0x7b7e('0x38')](function(_0x435cc9){_0x348c77(_0x435cc9);});}});}Fax['prototype']['execOriginate']=function(_0x5af831,_0x397923){var _0x8b339c=this;return new BPromise(function(_0x24c6fe,_0x518a97){var _0x37714b=uuid['v4']();var _0x23e2cc=ut[_0x7b7e('0x63')](_0x5af831,_0x397923);_0x8b339c['actions'][_0x37714b]=new Action(_0x37714b,_0x397923,_0x5af831);var _0x2983bf=_0x8b339c[_0x7b7e('0x3e')][_0x37714b];if(path[_0x7b7e('0x35')](_0x5af831[_0x7b7e('0x5c')])['ext']===_0x7b7e('0x36')){originate(_0x2983bf,_0x23e2cc,!![])[_0x7b7e('0x45')](function(_0xa52b93){_0x24c6fe(_0xa52b93);})[_0x7b7e('0x38')](function(_0x4f0745){_0x518a97(_0x4f0745);});}else{originate(_0x2983bf,_0x23e2cc,![])['then'](function(_0x2b5d20){_0x24c6fe(_0x2b5d20);})['catch'](function(_0x1ecb55){_0x518a97(_0x1ecb55);});}});};Fax[_0x7b7e('0x1a')][_0x7b7e('0x64')]=function(_0x30b703){return!_['isNil'](_0x30b703)&&!_[_0x7b7e('0x65')](_0x30b703[_0x7b7e('0x22')])&&!_[_0x7b7e('0x65')](_0x30b703[_0x7b7e('0x66')])&&_0x30b703[_0x7b7e('0x66')]&&!_[_0x7b7e('0x65')](this[_0x7b7e('0xd')][util[_0x7b7e('0x5a')](_0x7b7e('0x67'),_0x30b703[_0x7b7e('0x22')])])&&!_[_0x7b7e('0x65')](this[_0x7b7e('0xd')][util[_0x7b7e('0x5a')](_0x7b7e('0x67'),_0x30b703[_0x7b7e('0x22')])][_0x7b7e('0x2a')])&&(this['trunks'][util[_0x7b7e('0x5a')](_0x7b7e('0x67'),_0x30b703[_0x7b7e('0x22')])][_0x7b7e('0x2a')]===_0x7b7e('0x68')||this[_0x7b7e('0xd')][util[_0x7b7e('0x5a')]('SIP/%s',_0x30b703[_0x7b7e('0x22')])][_0x7b7e('0x2a')]===_0x7b7e('0x69'));};Fax[_0x7b7e('0x1a')][_0x7b7e('0x56')]=function(_0x4b4f55,_0x51d41f){if(!this[_0x7b7e('0x64')](_0x4b4f55)){ut[_0x7b7e('0x46')](_0x7b7e('0x6a'),_[_0x7b7e('0x65')](_0x4b4f55)?'':_0x4b4f55[_0x7b7e('0x22')]+_0x7b7e('0x6b'));return{'isValid':![],'message':_0x7b7e('0x6c')};}if(_[_0x7b7e('0x65')](_0x51d41f[_0x7b7e('0x5')])){ut[_0x7b7e('0x46')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x7b7e('0x3a')](_0x51d41f));return{'isValid':![],'message':_0x7b7e('0x6d')};}if(_[_0x7b7e('0x65')](_0x51d41f[_0x7b7e('0x5c')])){ut[_0x7b7e('0x46')](_0x7b7e('0x6e'),JSON[_0x7b7e('0x3a')](_0x51d41f));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x7b7e('0x6f')};};module['exports']=Fax; \ No newline at end of file +var _0x02ce=['operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','path','execute','%s/%s.tif','XMF-PATH','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncReceiveFax','hangup','originateresponse','prototype','context','hasOwnProperty','exten','localstationid','channel','name','info','uniqueid','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus'];(function(_0x53734e,_0x4d5240){var _0x422ab4=function(_0x33a2a5){while(--_0x33a2a5){_0x53734e['push'](_0x53734e['shift']());}};_0x422ab4(++_0x4d5240);}(_0x02ce,0x1ac));var _0xe02c=function(_0x4573b7,_0x4ce14c){_0x4573b7=_0x4573b7-0x0;var _0x6879be=_0x02ce[_0x4573b7];return _0x6879be;};'use strict';var util=require(_0xe02c('0x0'));var _=require(_0xe02c('0x1'));var BPromise=require(_0xe02c('0x2'));var uuid=require('uuid');var moment=require(_0xe02c('0x3'));var path=require('path');var tiff2pdf=require(_0xe02c('0x4'));var gs=require(_0xe02c('0x5'));var logger=require(_0xe02c('0x6'))(_0xe02c('0x7'));var ami=require(_0xe02c('0x8'));var rpcDb=require(_0xe02c('0x9'));var Channel=require(_0xe02c('0xa'));var ut=require(_0xe02c('0xb'));var Action=require(_0xe02c('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0xe02c('0xd'));function Fax(_0x2d85d7){this[_0xe02c('0xe')]={};this[_0xe02c('0xf')]=_0x2d85d7[_0xe02c('0xf')];this[_0xe02c('0x10')]=_0x2d85d7[_0xe02c('0x10')];this[_0xe02c('0x11')]={};ami['on'](_0xe02c('0x12'),this[_0xe02c('0x13')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x15'),this[_0xe02c('0x16')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x17'),this[_0xe02c('0x18')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x19'),this['syncNewExten'][_0xe02c('0x14')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0xe02c('0x14')](this));ami['on']('receivefax',this[_0xe02c('0x1a')]['bind'](this));ami['on'](_0xe02c('0x1b'),this['syncHangup'][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x1c'),this['syncOriginateResponse'][_0xe02c('0x14')](this));}Fax[_0xe02c('0x1d')]['syncNewchannel']=function(_0x12a564){if(_0x12a564[_0xe02c('0x1e')]==='from-voip-provider'){for(var _0x52917f in this[_0xe02c('0xf')]){if(this['faxAccounts'][_0xe02c('0x1f')](_0x52917f)){if(_0x12a564[_0xe02c('0x20')]===this[_0xe02c('0xf')][_0x52917f][_0xe02c('0x21')]){this[_0xe02c('0xe')][_0x12a564['uniqueid']]={};this[_0xe02c('0xe')][_0x12a564['uniqueid']]['channel']=_0x12a564[_0xe02c('0x22')];this[_0xe02c('0xe')][_0x12a564['uniqueid']]['id']=this[_0xe02c('0xf')][_0x52917f]['id'];this[_0xe02c('0xe')][_0x12a564['uniqueid']][_0xe02c('0x23')]=this[_0xe02c('0xf')][_0x52917f][_0xe02c('0x23')];logger[_0xe02c('0x24')](_0x12a564[_0xe02c('0x25')],_0xe02c('0x26'));}}}}if(this[_0xe02c('0x11')][_0x12a564[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x12a564[_0xe02c('0x25')]]={};this[_0xe02c('0xe')][_0x12a564['uniqueid']][_0xe02c('0x22')]=_0x12a564[_0xe02c('0x22')];logger[_0xe02c('0x24')](_0x12a564[_0xe02c('0x25')],_0xe02c('0x26'));}};Fax[_0xe02c('0x1d')][_0xe02c('0x16')]=function(_0x1c14d6){if(this['channels'][_0x1c14d6[_0xe02c('0x25')]]){for(var _0x3790eb in _0x1c14d6[_0xe02c('0x27')]){if(_0x1c14d6['variable'][_0xe02c('0x1f')](_0x3790eb)){this[_0xe02c('0xe')][_0x1c14d6[_0xe02c('0x25')]][_0x3790eb]=_0x1c14d6[_0xe02c('0x28')];}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x18')]=function(_0x22a285){if(this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]]['channelstate']=_0x22a285[_0xe02c('0x29')];this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]][_0xe02c('0x2a')]=_0x22a285[_0xe02c('0x2a')];}};Fax[_0xe02c('0x1d')]['syncNewExten']=function(_0x436bcc){if(this[_0xe02c('0xe')][_0x436bcc['uniqueid']]){for(var _0x1ce34c in _0x436bcc[_0xe02c('0x27')]){if(_0x436bcc[_0xe02c('0x27')][_0xe02c('0x1f')](_0x1ce34c)){this[_0xe02c('0xe')][_0x436bcc['uniqueid']][_0x1ce34c]=_0x436bcc['value'];}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x2b')]=function(_0x57928e){if(this[_0xe02c('0xe')][_0x57928e['uniqueid']]){this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]][_0xe02c('0x2c')]=_0x57928e[_0xe02c('0x2c')];this[_0xe02c('0xe')][_0x57928e['uniqueid']][_0xe02c('0x2d')]=_0x57928e['status'];this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]][_0xe02c('0x21')]=_0x57928e[_0xe02c('0x21')];this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]]['filename']=_0x57928e[_0xe02c('0x2e')];logger[_0xe02c('0x24')](_0x57928e['uniqueid'],_0xe02c('0x2f'));}};Fax[_0xe02c('0x1d')]['syncReceiveFax']=function(_0x396a06){var _0x4e4df6=this;if(this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]]){var _0x5b05e1=this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]]['id'];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x30')]=_0x396a06[_0xe02c('0x30')];this['channels'][_0x396a06[_0xe02c('0x25')]]['pagestransferred']=_0x396a06['pagestransferred'];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x21')]=_0x396a06[_0xe02c('0x21')];this['channels'][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x31')]=_0x396a06[_0xe02c('0x31')];this['channels'][_0x396a06['uniqueid']][_0xe02c('0x32')]=_0x396a06[_0xe02c('0x32')];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x2e')]=_0x396a06[_0xe02c('0x2e')];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x33')]=_0x396a06['calleridnum'];if(this[_0xe02c('0xe')][_0x396a06['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x396a06[_0xe02c('0x2e')],_0xe02c('0x34'),function(_0x958cbc){logger[_0xe02c('0x24')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x35'),_0x958cbc[_0xe02c('0x36')]);attachment[_0xe02c('0x37')]({'name':path['parse'](_0x396a06['filename'])[_0xe02c('0x23')],'basename':path[_0xe02c('0x38')](_0x396a06[_0xe02c('0x2e')])['name']+_0xe02c('0x39'),'type':_0xe02c('0x3a')})[_0xe02c('0x3b')](function(_0x1fb73c){faxAccount[_0xe02c('0x3c')](_0x5b05e1,{'from':_0x396a06[_0xe02c('0x33')],'mapKey':_0xe02c('0x7'),'body':path[_0xe02c('0x38')](_0x396a06[_0xe02c('0x2e')])[_0xe02c('0x23')]+'.pdf','AttachmentId':_0x1fb73c['id']})[_0xe02c('0x3d')](function(_0x18895e){logger[_0xe02c('0x3e')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x3f'),JSON[_0xe02c('0x40')](_0x18895e));});})[_0xe02c('0x3d')](function(_0x3502a5){logger[_0xe02c('0x3e')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x41'),JSON[_0xe02c('0x40')](_0x3502a5));});});}logger[_0xe02c('0x24')](_0x396a06['uniqueid'],_0xe02c('0x41'));}};Fax['prototype'][_0xe02c('0x42')]=function(_0x324911){if(this[_0xe02c('0x11')][_0x324911[_0xe02c('0x25')]]){_[_0xe02c('0x43')](this[_0xe02c('0xe')][_0x324911[_0xe02c('0x25')]],_[_0xe02c('0x44')](_0x324911,[_0xe02c('0x45'),_0xe02c('0x46')]));}};function updateStatus(_0x4f2a6e){if(_0x4f2a6e[_0xe02c('0x47')]){faxMessage[_0xe02c('0x48')](_0x4f2a6e[_0xe02c('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xe02c('0x3b')](function(_0x5ab97d){ut[_0xe02c('0x49')]('[Fax][Message][Error][Updated]',_0x5ab97d);})['catch'](function(_0x5b66f4){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x5b66f4);});}else{ut['logger'](_0xe02c('0x4a'));}}Fax[_0xe02c('0x1d')][_0xe02c('0x4b')]=function(_0x35fbe2,_0x5d963d,_0x274beb){var _0x133f3a=this;var _0x4d2bff={};if(_0x5d963d){_0x4d2bff={'read':_0x5d963d};}else{_0x4d2bff={'failMessage':_0x274beb};}if(this[_0xe02c('0x11')][_0x35fbe2][_0xe02c('0x47')]){faxMessage[_0xe02c('0x48')](this['actions'][_0x35fbe2]['AttachmentId'],_0x4d2bff)[_0xe02c('0x3b')](function(_0x44a9f3){ut[_0xe02c('0x49')]('[Fax][Message][Updated]',_0x44a9f3);})[_0xe02c('0x3d')](function(_0x53765c){ut['logger'](_0xe02c('0x4c'),_0x53765c);})[_0xe02c('0x4d')](function(){delete _0x133f3a['channels'][_0x35fbe2];delete _0x133f3a[_0xe02c('0x11')][_0x35fbe2];});}else{ut[_0xe02c('0x49')](_0xe02c('0x4e'));delete this['channels'][_0x35fbe2];delete this[_0xe02c('0x11')][_0x35fbe2];}};Fax[_0xe02c('0x1d')]['syncHangup']=function(_0x3788e8){var _0x31ba51=this;if(this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]){if(this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]['id']=this[_0xe02c('0x11')][_0x3788e8['uniqueid']]['id'];this['channels'][_0x3788e8['uniqueid']][_0xe02c('0x23')]=this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]['name'];}logger['info'](_0x3788e8[_0xe02c('0x25')],this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]?_0xe02c('0x4f'):_0xe02c('0x50'),JSON['stringify'](this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]));if(this['actions'][_0x3788e8['uniqueid']]){if(this[_0xe02c('0xe')][_0x3788e8['uniqueid']]['faxpages']>0x0&&this['channels'][_0x3788e8[_0xe02c('0x25')]][_0xe02c('0x51')]===_0xe02c('0x52')){this[_0xe02c('0x4b')](_0x3788e8[_0xe02c('0x25')],!![]);}else{this[_0xe02c('0x4b')](_0x3788e8['uniqueid'],![],this[_0xe02c('0xe')][_0x3788e8['uniqueid']]['faxstatusstring']?_0xe02c('0x53')+this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]][_0xe02c('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x55')]=function(_0x5d2119){var _0xa7133f=this;return new BPromise(function(_0x44bfd0,_0x4cc74d){_0xa7133f[_0xe02c('0x56')](_0x5d2119,_0xa7133f[_0xe02c('0xf')][_0x5d2119[_0xe02c('0x57')]])[_0xe02c('0x3b')](function(_0x323f3b){ut[_0xe02c('0x49')](_0xe02c('0x58'),_0x323f3b);_0x44bfd0(ut['message'](_0xe02c('0x59')));})['catch'](function(_0x558344){ut['logger'](_0xe02c('0x5a'),_0x558344);updateStatus(_0x5d2119);_0x4cc74d(ut[_0xe02c('0x36')](_0xe02c('0x5b')));});});};Fax[_0xe02c('0x1d')]['checkAfterSend']=function(_0x32e149){var _0x327777=this;return new BPromise(function(_0x503bb3,_0x597a64){var _0x4b0ec3=_0x327777[_0xe02c('0x5c')](_0x327777[_0xe02c('0xf')][_0x32e149['FaxAccountId']]['Trunk'],_0x32e149);if(_0x4b0ec3[_0xe02c('0x5d')]){_0x503bb3(ut[_0xe02c('0x36')](_0xe02c('0x5e')));}else{_0x597a64(ut[_0xe02c('0x36')](_0x4b0ec3[_0xe02c('0x36')]));}});};function originate(_0x5bb01d,_0x39c7db,_0x12ac9f){return new BPromise(function(_0x3f277b,_0x2776c0){if(_0x12ac9f){var _0x11c506=util[_0xe02c('0x5f')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xe02c('0x38')](_0x5bb01d[_0xe02c('0x60')])['name'],_0x5bb01d[_0xe02c('0x60')]);gs[_0xe02c('0x61')](_0x11c506)[_0xe02c('0x3b')](function(){_0x5bb01d[_0xe02c('0x60')]=util['format'](_0xe02c('0x62'),path[_0xe02c('0x38')](_0x5bb01d['path'])['dir'],path['parse'](_0x5bb01d[_0xe02c('0x60')])[_0xe02c('0x23')]);_0x39c7db[_0xe02c('0x63')]=_0x5bb01d[_0xe02c('0x60')];ut[_0xe02c('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0xe02c('0x64')](ut[_0xe02c('0x65')](_0x5bb01d,_0x39c7db))[_0xe02c('0x3b')](function(_0x4cc653){_0x3f277b(_0x4cc653);})['catch'](function(_0x4c3c91){_0x2776c0(_0x4c3c91);});})[_0xe02c('0x3d')](function(_0x43d7f7){_0x2776c0(_0x43d7f7);});}else{ami[_0xe02c('0x64')](ut[_0xe02c('0x65')](_0x5bb01d,_0x39c7db))['then'](function(_0x182805){_0x3f277b(_0x182805);})['catch'](function(_0x5a5dba){_0x2776c0(_0x5a5dba);});}});}Fax[_0xe02c('0x1d')][_0xe02c('0x56')]=function(_0x331061,_0x1bbf6a){var _0xea4547=this;return new BPromise(function(_0x2d132e,_0x748217){var _0x12aaea=uuid['v4']();var _0x5ead59=ut[_0xe02c('0x66')](_0x331061,_0x1bbf6a);_0xea4547[_0xe02c('0x11')][_0x12aaea]=new Action(_0x12aaea,_0x1bbf6a,_0x331061);var _0x2386cf=_0xea4547[_0xe02c('0x11')][_0x12aaea];if(path[_0xe02c('0x38')](_0x331061[_0xe02c('0x60')])[_0xe02c('0x67')]===_0xe02c('0x39')){originate(_0x2386cf,_0x5ead59,!![])[_0xe02c('0x3b')](function(_0x411cd5){_0x2d132e(_0x411cd5);})['catch'](function(_0x58acfd){_0x748217(_0x58acfd);});}else{originate(_0x2386cf,_0x5ead59,![])[_0xe02c('0x3b')](function(_0x2a5d54){_0x2d132e(_0x2a5d54);})[_0xe02c('0x3d')](function(_0x76fb21){_0x748217(_0x76fb21);});}});};Fax[_0xe02c('0x1d')]['isTrunkReachable']=function(_0x405b16){return!_[_0xe02c('0x68')](_0x405b16)&&!_[_0xe02c('0x68')](_0x405b16[_0xe02c('0x23')])&&!_[_0xe02c('0x68')](_0x405b16[_0xe02c('0x69')])&&_0x405b16[_0xe02c('0x69')]&&!_[_0xe02c('0x68')](this[_0xe02c('0x10')][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16[_0xe02c('0x23')])])&&!_['isNil'](this['trunks'][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16['name'])][_0xe02c('0x2d')])&&(this['trunks'][util[_0xe02c('0x5f')]('SIP/%s',_0x405b16[_0xe02c('0x23')])][_0xe02c('0x2d')]===_0xe02c('0x6b')||this[_0xe02c('0x10')][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16[_0xe02c('0x23')])][_0xe02c('0x2d')]===_0xe02c('0x6c'));};Fax[_0xe02c('0x1d')]['checkTrunk']=function(_0x5a118f,_0x4d6753){if(!this[_0xe02c('0x6d')](_0x5a118f)){ut[_0xe02c('0x49')](_0xe02c('0x6e'),_[_0xe02c('0x68')](_0x5a118f)?'':_0x5a118f[_0xe02c('0x23')]+_0xe02c('0x6f'));return{'isValid':![],'message':_0xe02c('0x70')};}if(_[_0xe02c('0x68')](_0x4d6753[_0xe02c('0x7')])){ut[_0xe02c('0x49')](_0xe02c('0x71'),JSON[_0xe02c('0x40')](_0x4d6753));return{'isValid':![],'message':_0xe02c('0x72')};}if(_['isNil'](_0x4d6753['path'])){ut[_0xe02c('0x49')](_0xe02c('0x73'),JSON[_0xe02c('0x40')](_0x4d6753));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xe02c('0x74')};};module[_0xe02c('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 1e0ea05..f406afd 100644 --- a/server/services/ami/fax/rpcDb.js +++ b/server/services/ami/fax/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x607f=['resolve','then','catch','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','notify'];(function(_0x71ae3c,_0x404627){var _0x194072=function(_0x13c008){while(--_0x13c008){_0x71ae3c['push'](_0x71ae3c['shift']());}};_0x194072(++_0x404627);}(_0x607f,0x107));var _0xf607=function(_0xb987b7,_0x44b4e4){_0xb987b7=_0xb987b7-0x0;var _0x2efdbb=_0x607f[_0xb987b7];return _0x2efdbb;};'use strict';var util=require(_0xf607('0x0'));var BPromise=require(_0xf607('0x1'));var logger=require(_0xf607('0x2'))(_0xf607('0x3'));var _=require('lodash');var faxAccount=require(_0xf607('0x4'));function loggerCatch(_0x21723c){return function(_0x5eb54f){logger[_0xf607('0x5')](_0x21723c,util['inspect'](_0x5eb54f,{'showHidden':![],'depth':null}));};}exports[_0xf607('0x6')]=function(_0xd4b062,_0x468bab){return BPromise[_0xf607('0x7')]()[_0xf607('0x8')](faxAccount['notify'](_0xd4b062,_0x468bab))[_0xf607('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x4588=['inspect','notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4588,0x155));var _0x8458=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x4588[_0x23b655];return _0x364b32;};'use strict';var util=require(_0x8458('0x0'));var BPromise=require(_0x8458('0x1'));var logger=require(_0x8458('0x2'))(_0x8458('0x3'));var _=require(_0x8458('0x4'));var faxAccount=require(_0x8458('0x5'));function loggerCatch(_0x29c90f){return function(_0x38ffd8){logger[_0x8458('0x6')](_0x29c90f,util[_0x8458('0x7')](_0x38ffd8,{'showHidden':![],'depth':null}));};}exports[_0x8458('0x8')]=function(_0x3a47f9,_0x51f67e){return BPromise[_0x8458('0x9')]()['then'](faxAccount[_0x8458('0x8')](_0x3a47f9,_0x51f67e))[_0x8458('0xa')](loggerCatch(_0x8458('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index fdb0ec5..f417f8d 100644 --- a/server/services/ami/fax/util/gs.js +++ b/server/services/ami/fax/util/gs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7aa5=['../../../../config/logger','fax','bluebird','exec','info','Exec\x20gs','inspect','util'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x7aa5,0x107));var _0x57aa=function(_0xa8fab7,_0x88c3e8){_0xa8fab7=_0xa8fab7-0x0;var _0x28e65e=_0x7aa5[_0xa8fab7];return _0x28e65e;};'use strict';var util=require(_0x57aa('0x0'));var logger=require(_0x57aa('0x1'))(_0x57aa('0x2'));var BPromise=require(_0x57aa('0x3'));var exec=require('child_process')[_0x57aa('0x4')];exports['execute']=function(_0x4fcaec){return new BPromise(function(_0x1292e2,_0x3adf18){exec(_0x4fcaec,function(_0x10affd,_0x1cccd1,_0x57b933){logger[_0x57aa('0x5')](_0x57aa('0x6'),_0x1cccd1);if(_0x10affd){logger[_0x57aa('0x5')](_0x57aa('0x6'),'\x20Error\x20:',util[_0x57aa('0x7')](_0x10affd,{'showHidden':![],'depth':null}),_0x1cccd1,_0x57b933);_0x3adf18(_0x10affd);}_0x1292e2(_0x1cccd1);});});}; \ No newline at end of file +var _0x09ee=['util','../../../../config/logger','bluebird','child_process','execute','info','inspect'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x09ee,0x149));var _0xe09e=function(_0x1e1858,_0x2bc0ec){_0x1e1858=_0x1e1858-0x0;var _0x4d8d7a=_0x09ee[_0x1e1858];return _0x4d8d7a;};'use strict';var util=require(_0xe09e('0x0'));var logger=require(_0xe09e('0x1'))('fax');var BPromise=require(_0xe09e('0x2'));var exec=require(_0xe09e('0x3'))['exec'];exports[_0xe09e('0x4')]=function(_0x21f55e){return new BPromise(function(_0x1d70de,_0x1703c9){exec(_0x21f55e,function(_0x2db072,_0x1144cd,_0x36b613){logger['info']('Exec\x20gs',_0x1144cd);if(_0x2db072){logger[_0xe09e('0x5')]('Exec\x20gs','\x20Error\x20:',util[_0xe09e('0x6')](_0x2db072,{'showHidden':![],'depth':null}),_0x1144cd,_0x36b613);_0x1703c9(_0x2db072);}_0x1d70de(_0x1144cd);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 2f694fc..0580a33 100644 --- a/server/services/ami/fax/util/util.js +++ b/server/services/ami/fax/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a4d=['lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>'];(function(_0x4b6c16,_0x1e2006){var _0x214d6d=function(_0x4c5f96){while(--_0x4c5f96){_0x4b6c16['push'](_0x4b6c16['shift']());}};_0x214d6d(++_0x1e2006);}(_0x4a4d,0x90));var _0xd4a4=function(_0x5aa992,_0x559ebb){_0x5aa992=_0x5aa992-0x0;var _0x2e2d59=_0x4a4d[_0x5aa992];return _0x2e2d59;};'use strict';var util=require('util');var _=require(_0xd4a4('0x0'));var moment=require(_0xd4a4('0x1'));var logger=require(_0xd4a4('0x2'))(_0xd4a4('0x3'));exports[_0xd4a4('0x4')]=function(_0x2bdc46){return{'message':_0x2bdc46};};exports[_0xd4a4('0x5')]=function(_0x239904,_0x9a884d){logger[_0xd4a4('0x6')](_0x239904,util[_0xd4a4('0x7')](_0x9a884d,{'showHidden':![],'depth':null}));};exports[_0xd4a4('0x8')]=function(_0x4edc5b,_0x400297){var _0x566434={'XMF-ECM':_0x400297['ecm'],'XMF-HEADERINFO':_0x400297[_0xd4a4('0x9')],'XMF-MINRATE':_0x400297[_0xd4a4('0xa')],'XMF-MAXRATE':_0x400297[_0xd4a4('0xb')],'XMF-MODEM':util['format'](_0xd4a4('0xc'),_0x400297[_0xd4a4('0xd')]),'XMF-GATEWAY':_0x400297[_0xd4a4('0xe')],'XMF-FAXDETECT':_0x400297[_0xd4a4('0xf')],'XMF-T38TIMEOUT':_0x400297['t38timeout'],'XMF-LOCALSTATIONID':_0x400297[_0xd4a4('0x10')],'XMF-PATH':_0x4edc5b[_0xd4a4('0x11')]};return _0x566434;};exports[_0xd4a4('0x12')]=function(_0xd33538,_0xa99371){return{'actionid':_0xd33538[_0xd4a4('0x13')],'action':'originate','channel':_0xd33538['channel'],'Exten':_0xd4a4('0x14'),'Context':_0xd4a4('0x15'),'Priority':'1','callerid':util[_0xd4a4('0x16')](_0xd4a4('0x17'),_0xd33538[_0xd4a4('0x9')]?_0xd33538['headerinfo']:'',_0xd33538[_0xd4a4('0x10')]),'variable':_0xa99371,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xd33538['uniqueid']};}; \ No newline at end of file +var _0x1333=['channel','xcally-motion-fax','from-sip','lodash','moment','fax','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','t38timeout','localstationid','path','variablesAction','uniqueid','originate'];(function(_0x5a2407,_0x424b22){var _0x78524b=function(_0x5bbb6f){while(--_0x5bbb6f){_0x5a2407['push'](_0x5a2407['shift']());}};_0x78524b(++_0x424b22);}(_0x1333,0x137));var _0x3133=function(_0x484a4d,_0x31f4b3){_0x484a4d=_0x484a4d-0x0;var _0x515e22=_0x1333[_0x484a4d];return _0x515e22;};'use strict';var util=require('util');var _=require(_0x3133('0x0'));var moment=require(_0x3133('0x1'));var logger=require('../../../../config/logger')(_0x3133('0x2'));exports['message']=function(_0x445a37){return{'message':_0x445a37};};exports[_0x3133('0x3')]=function(_0x29f4df,_0x2d3bf6){logger[_0x3133('0x4')](_0x29f4df,util[_0x3133('0x5')](_0x2d3bf6,{'showHidden':![],'depth':null}));};exports[_0x3133('0x6')]=function(_0x246397,_0x23d25d){var _0xce7964={'XMF-ECM':_0x23d25d[_0x3133('0x7')],'XMF-HEADERINFO':_0x23d25d[_0x3133('0x8')],'XMF-MINRATE':_0x23d25d[_0x3133('0x9')],'XMF-MAXRATE':_0x23d25d[_0x3133('0xa')],'XMF-MODEM':util[_0x3133('0xb')](_0x3133('0xc'),_0x23d25d['modem']),'XMF-GATEWAY':_0x23d25d['gateway'],'XMF-FAXDETECT':_0x23d25d['faxdetect'],'XMF-T38TIMEOUT':_0x23d25d[_0x3133('0xd')],'XMF-LOCALSTATIONID':_0x23d25d[_0x3133('0xe')],'XMF-PATH':_0x246397[_0x3133('0xf')]};return _0xce7964;};exports[_0x3133('0x10')]=function(_0x217125,_0x3a8ff3){return{'actionid':_0x217125[_0x3133('0x11')],'action':_0x3133('0x12'),'channel':_0x217125[_0x3133('0x13')],'Exten':_0x3133('0x14'),'Context':_0x3133('0x15'),'Priority':'1','callerid':util[_0x3133('0xb')]('\x22%s\x22\x20<%s>',_0x217125['headerinfo']?_0x217125[_0x3133('0x8')]:'',_0x217125[_0x3133('0xe')]),'variable':_0x3a8ff3,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x217125[_0x3133('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 07018bd..bc839a6 100644 --- a/server/services/ami/index.js +++ b/server/services/ami/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84bc=['./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','initVoiceExtensions','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','bluebird','util','./server','./realtime','./report','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x84bc,0x141));var _0xc84b=function(_0x4c9f8e,_0x250507){_0x4c9f8e=_0x4c9f8e-0x0;var _0x5512f1=_0x84bc[_0x4c9f8e];return _0x5512f1;};'use strict';var BPromise=require(_0xc84b('0x0'));var util=require(_0xc84b('0x1'));var moment=require('moment');var server=require(_0xc84b('0x2'));var Realtime=require(_0xc84b('0x3'));var Report=require(_0xc84b('0x4'));var Acw=require(_0xc84b('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xc84b('0x6'));var Preview=require(_0xc84b('0x7'));var Fax=require('./fax');var user=require(_0xc84b('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xc84b('0x9'));var voiceCallReport=require(_0xc84b('0xa'));var trunk=require(_0xc84b('0xb'));var trigger=require(_0xc84b('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0xc84b('0xd'));var campaign=require(_0xc84b('0xe'));var voiceExtension=require(_0xc84b('0xf'));var faxAccount=require(_0xc84b('0x10'));var zendesk=require(_0xc84b('0x11'));var salesforce=require(_0xc84b('0x12'));var sugarcrm=require(_0xc84b('0x13'));var freshdesk=require(_0xc84b('0x14'));var desk=require(_0xc84b('0x15'));var zoho=require(_0xc84b('0x16'));var vtiger=require(_0xc84b('0x17'));var freshsales=require(_0xc84b('0x18'));var servicenow=require(_0xc84b('0x19'));var dynamics365=require(_0xc84b('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xc84b('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc84b('0x1c')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc84b('0x1c')](_0xc84b('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc84b('0x1e')]()[_0xc84b('0x1f')](user[_0xc84b('0x20')]())['then'](realtime[_0xc84b('0x21')]())[_0xc84b('0x1f')](user['getTelephones']())[_0xc84b('0x1f')](realtime[_0xc84b('0x22')]())[_0xc84b('0x1f')](trunk['getTrunks']())[_0xc84b('0x1f')](realtime['initTrunks']())[_0xc84b('0x1f')](voiceQueue[_0xc84b('0x23')]())[_0xc84b('0x1f')](realtime[_0xc84b('0x24')]())[_0xc84b('0x1f')](trigger[_0xc84b('0x25')]())['then'](realtime[_0xc84b('0x26')]())[_0xc84b('0x1f')](template[_0xc84b('0x27')]())[_0xc84b('0x1f')](realtime[_0xc84b('0x28')]())[_0xc84b('0x1f')](zendesk['getZendeskAccounts']())[_0xc84b('0x1f')](realtime[_0xc84b('0x29')]())['then'](salesforce[_0xc84b('0x2a')]())[_0xc84b('0x1f')](realtime[_0xc84b('0x2b')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0xc84b('0x1f')](realtime[_0xc84b('0x2c')]())['then'](freshdesk[_0xc84b('0x2d')]())[_0xc84b('0x1f')](realtime[_0xc84b('0x2e')]())[_0xc84b('0x1f')](desk['getDeskAccounts']())[_0xc84b('0x1f')](realtime[_0xc84b('0x2f')]())[_0xc84b('0x1f')](zoho['getZohoAccounts']())[_0xc84b('0x1f')](realtime[_0xc84b('0x30')]())[_0xc84b('0x1f')](vtiger[_0xc84b('0x31')]())[_0xc84b('0x1f')](realtime[_0xc84b('0x32')]())['then'](freshsales['getFreshsalesAccounts']())[_0xc84b('0x1f')](realtime[_0xc84b('0x33')]())[_0xc84b('0x1f')](servicenow['getServicenowAccounts']())['then'](realtime['initServicenowAccounts']())[_0xc84b('0x1f')](dynamics365[_0xc84b('0x34')]())[_0xc84b('0x1f')](realtime[_0xc84b('0x35')]())[_0xc84b('0x1f')](campaign['getCampaigns']())[_0xc84b('0x1f')](realtime[_0xc84b('0x36')]())[_0xc84b('0x1f')](voiceExtension['getVoiceExtensions']())[_0xc84b('0x1f')](realtime[_0xc84b('0x37')]())['then'](faxAccount['getFaxAccounts']())[_0xc84b('0x1f')](realtime[_0xc84b('0x38')]())[_0xc84b('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0xc84b('0x1e')]()[_0xc84b('0x1f')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0xc84b('0x39')]())[_0xc84b('0x1f')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xc84b('0x1f')](realtime[_0xc84b('0x3a')]())[_0xc84b('0x1f')](cmHopperHistory[_0xc84b('0x3b')]())['then'](realtime[_0xc84b('0x3c')]())[_0xc84b('0x1f')](voiceCallReport['getVoiceCallReports']())[_0xc84b('0x1f')](realtime[_0xc84b('0x3d')]())[_0xc84b('0x3e')](function(_0x335e0b){logger[_0xc84b('0x3f')](_0xc84b('0x40'),util[_0xc84b('0x41')](_0x335e0b,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x1be408){return initRealtime();})[_0xc84b('0x1f')](function(){return initParams();})[_0xc84b('0x1f')](function(){report[_0xc84b('0x42')]();setInterval(initRealtime,0x1388);})[_0xc84b('0x3e')](function(_0x57c360){logger[_0xc84b('0x3f')]('[index.js][main]',util['inspect'](_0x57c360,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x80cc=['./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','[index.js][initParams]','inspect','listen','catch','util','./server','./realtime','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x80cc,0xfa));var _0xc80c=function(_0x11ea79,_0x511dc6){_0x11ea79=_0x11ea79-0x0;var _0x107ef2=_0x80cc[_0x11ea79];return _0x107ef2;};'use strict';var BPromise=require('bluebird');var util=require(_0xc80c('0x0'));var moment=require('moment');var server=require(_0xc80c('0x1'));var Realtime=require(_0xc80c('0x2'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xc80c('0x3'));var Dialer=require(_0xc80c('0x4'));var Preview=require(_0xc80c('0x5'));var Fax=require(_0xc80c('0x6'));var user=require(_0xc80c('0x7'));var voiceQueue=require(_0xc80c('0x8'));var voiceQueueReport=require(_0xc80c('0x9'));var voiceCallReport=require(_0xc80c('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0xc80c('0xb'));var template=require(_0xc80c('0xc'));var cmHopperHistory=require(_0xc80c('0xd'));var campaign=require(_0xc80c('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xc80c('0xf'));var zendesk=require(_0xc80c('0x10'));var salesforce=require(_0xc80c('0x11'));var sugarcrm=require(_0xc80c('0x12'));var freshdesk=require(_0xc80c('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xc80c('0x14'));var vtiger=require(_0xc80c('0x15'));var freshsales=require(_0xc80c('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xc80c('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xc80c('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc80c('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xc80c('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc80c('0x1b')]()[_0xc80c('0x1c')](user[_0xc80c('0x1d')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x1e')]())[_0xc80c('0x1c')](user[_0xc80c('0x1f')]())['then'](realtime[_0xc80c('0x20')]())[_0xc80c('0x1c')](trunk[_0xc80c('0x21')]())[_0xc80c('0x1c')](realtime['initTrunks']())[_0xc80c('0x1c')](voiceQueue['getVoiceQueues']())['then'](realtime['initVoiceQueues']())[_0xc80c('0x1c')](trigger[_0xc80c('0x22')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x23')]())['then'](template[_0xc80c('0x24')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x25')]())[_0xc80c('0x1c')](zendesk[_0xc80c('0x26')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x27')]())[_0xc80c('0x1c')](salesforce[_0xc80c('0x28')]())['then'](realtime[_0xc80c('0x29')]())[_0xc80c('0x1c')](sugarcrm[_0xc80c('0x2a')]())[_0xc80c('0x1c')](realtime['initSugarcrmAccounts']())[_0xc80c('0x1c')](freshdesk[_0xc80c('0x2b')]())[_0xc80c('0x1c')](realtime['initFreshdeskAccounts']())[_0xc80c('0x1c')](desk['getDeskAccounts']())[_0xc80c('0x1c')](realtime[_0xc80c('0x2c')]())[_0xc80c('0x1c')](zoho['getZohoAccounts']())[_0xc80c('0x1c')](realtime[_0xc80c('0x2d')]())[_0xc80c('0x1c')](vtiger[_0xc80c('0x2e')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x2f')]())[_0xc80c('0x1c')](freshsales[_0xc80c('0x30')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x31')]())['then'](servicenow['getServicenowAccounts']())['then'](realtime[_0xc80c('0x32')]())[_0xc80c('0x1c')](dynamics365[_0xc80c('0x33')]())['then'](realtime['initDynamics365Accounts']())[_0xc80c('0x1c')](campaign[_0xc80c('0x34')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x35')]())[_0xc80c('0x1c')](voiceExtension['getVoiceExtensions']())[_0xc80c('0x1c')](realtime[_0xc80c('0x36')]())['then'](faxAccount[_0xc80c('0x37')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x38')]())[_0xc80c('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xc80c('0x1b')]()[_0xc80c('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0xc80c('0x1c')](realtime[_0xc80c('0x39')]())[_0xc80c('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0xc80c('0x3a')]())['then'](cmHopperHistory[_0xc80c('0x3b')]())['then'](realtime[_0xc80c('0x3c')]())[_0xc80c('0x1c')](voiceCallReport[_0xc80c('0x3d')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x3e')]())['catch'](function(_0x2fdeb2){logger['error'](_0xc80c('0x3f'),util[_0xc80c('0x40')](_0x2fdeb2,{'showHidden':![],'depth':null}));});}function main(){return server[_0xc80c('0x41')](realtime,preview,fax)[_0xc80c('0x1c')](function(_0x162167){return initRealtime();})['then'](function(){return initParams();})[_0xc80c('0x1c')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xc80c('0x42')](function(_0x3d3ef2){logger['error']('[index.js][main]',util['inspect'](_0x3d3ef2,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 37072ed..6961a3d 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x4c91d5,_0x86eae){var _0x38cb43=function(_0x3c3ebf){while(--_0x3c3ebf){_0x4c91d5['push'](_0x4c91d5['shift']());}};_0x38cb43(++_0x86eae);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0xcb91[_0x33bcdb];return _0x18a9bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file +var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x2fbf2c,_0xb5a8f9){var _0x132005=function(_0xaa95bb){while(--_0xaa95bb){_0x2fbf2c['push'](_0x2fbf2c['shift']());}};_0x132005(++_0xb5a8f9);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 4419e4c..93f3fb1 100644 --- a/server/services/ami/model/campaign.js +++ b/server/services/ami/model/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad3b=['name','type','campaign','originated','temp','ivrTotalCallsDays','message','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x3d48a8,_0x4e458d){var _0x18cfd0=function(_0x3992b3){while(--_0x3992b3){_0x3d48a8['push'](_0x3d48a8['shift']());}};_0x18cfd0(++_0x4e458d);}(_0xad3b,0xf5));var _0xbad3=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0xad3b[_0x81e39d];return _0x548fbb;};'use strict';function Campaign(_0x297141){this['id']=_0x297141['id']||0x0;this[_0xbad3('0x0')]=_0x297141[_0xbad3('0x0')]||'';this[_0xbad3('0x1')]=_0x297141[_0xbad3('0x1')]||_0xbad3('0x2');this[_0xbad3('0x3')]=0x0;this[_0xbad3('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xbad3('0x5')]=0x0;this[_0xbad3('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0xbad3('0x7')]=_0x297141[_0xbad3('0x7')];this['limitCalls']=_0x297141[_0xbad3('0x8')];this['dialTimezone']=_0x297141['dialTimezone']||null;this[_0xbad3('0x9')]=_0x297141[_0xbad3('0x9')]?_0x297141[_0xbad3('0x9')]:null;this[_0xbad3('0xa')]=_0x297141[_0xbad3('0xa')];this[_0xbad3('0xb')]=_0x297141[_0xbad3('0xb')];this[_0xbad3('0xc')]=_0x297141[_0xbad3('0xc')]||0x1e;this[_0xbad3('0xd')]=_0x297141[_0xbad3('0xd')];this[_0xbad3('0xe')]=_0x297141[_0xbad3('0xe')];this[_0xbad3('0xf')]=_0x297141[_0xbad3('0xf')];this[_0xbad3('0x10')]=_0x297141['dialBusyRetryFrequency'];this[_0xbad3('0x11')]=_0x297141['dialNoAnswerMaxRetry'];this[_0xbad3('0x12')]=_0x297141[_0xbad3('0x12')];this['dialGlobalMaxRetry']=_0x297141[_0xbad3('0x13')];this[_0xbad3('0x14')]=_0x297141[_0xbad3('0x14')]||0x3;this[_0xbad3('0x15')]=_0x297141[_0xbad3('0x15')]||0x96;this[_0xbad3('0x16')]=_0x297141['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x297141[_0xbad3('0x17')]||0x96;this[_0xbad3('0x18')]=_0x297141[_0xbad3('0x18')]||0x3;this[_0xbad3('0x19')]=_0x297141[_0xbad3('0x19')]||0x96;this['dialMachineMaxRetry']=_0x297141[_0xbad3('0x1a')]||0x3;this[_0xbad3('0x1b')]=_0x297141[_0xbad3('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x297141['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x297141[_0xbad3('0x1c')]||0x96;this[_0xbad3('0x1d')]=_0x297141['dialOrderByScheduledAt']||_0xbad3('0x1e');this[_0xbad3('0x1f')]=_0x297141['dialPrefix']||undefined;this[_0xbad3('0x20')]=_0x297141[_0xbad3('0x20')]||undefined;this[_0xbad3('0x21')]=_0x297141[_0xbad3('0x21')]||undefined;this[_0xbad3('0x22')]=_0x297141[_0xbad3('0x22')]?_0x297141[_0xbad3('0x22')]:undefined;this[_0xbad3('0x23')]=_0x297141[_0xbad3('0x23')]?_0x297141[_0xbad3('0x23')]:undefined;this[_0xbad3('0x24')]=_0x297141[_0xbad3('0x24')]?_0x297141['Interval']:undefined;this[_0xbad3('0x25')]=_0x297141[_0xbad3('0x25')]?_0x297141[_0xbad3('0x25')]:undefined;this[_0xbad3('0x26')]=_0x297141[_0xbad3('0x25')]?_0x297141[_0xbad3('0x25')][_0xbad3('0x0')]:undefined;this[_0xbad3('0x27')]=_0x297141[_0xbad3('0x27')]||![];this[_0xbad3('0x28')]=_0x297141['dialAMDInitialSilence'];this[_0xbad3('0x29')]=_0x297141[_0xbad3('0x29')];this[_0xbad3('0x2a')]=_0x297141[_0xbad3('0x2a')];this[_0xbad3('0x2b')]=_0x297141['dialAMDTotalAnalysisTime'];this[_0xbad3('0x2c')]=_0x297141[_0xbad3('0x2c')];this[_0xbad3('0x2d')]=_0x297141[_0xbad3('0x2d')];this[_0xbad3('0x2e')]=_0x297141[_0xbad3('0x2e')];this['dialAMDSilenceThreshold']=_0x297141[_0xbad3('0x2f')];this[_0xbad3('0x30')]=_0x297141['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0x2ae4=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','originated','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x2ae4,0x6e));var _0x42ae=function(_0x287009,_0x16e129){_0x287009=_0x287009-0x0;var _0x54f613=_0x2ae4[_0x287009];return _0x54f613;};'use strict';function Campaign(_0x3be0d2){this['id']=_0x3be0d2['id']||0x0;this[_0x42ae('0x0')]=_0x3be0d2['name']||'';this['type']=_0x3be0d2['type']||'campaign';this[_0x42ae('0x1')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x42ae('0x2')]='';this[_0x42ae('0x3')]=!![];this['active']=_0x3be0d2[_0x42ae('0x4')];this[_0x42ae('0x5')]=_0x3be0d2[_0x42ae('0x5')];this[_0x42ae('0x6')]=_0x3be0d2[_0x42ae('0x6')]||null;this[_0x42ae('0x7')]=_0x3be0d2[_0x42ae('0x7')]?_0x3be0d2[_0x42ae('0x7')]:null;this['dialOriginateCallerIdName']=_0x3be0d2[_0x42ae('0x8')];this['dialOriginateCallerIdNumber']=_0x3be0d2['dialOriginateCallerIdNumber'];this[_0x42ae('0x9')]=_0x3be0d2['dialOriginateTimeout']||0x1e;this[_0x42ae('0xa')]=_0x3be0d2[_0x42ae('0xa')];this[_0x42ae('0xb')]=_0x3be0d2[_0x42ae('0xb')];this[_0x42ae('0xc')]=_0x3be0d2[_0x42ae('0xc')];this[_0x42ae('0xd')]=_0x3be0d2[_0x42ae('0xd')];this[_0x42ae('0xe')]=_0x3be0d2[_0x42ae('0xe')];this[_0x42ae('0xf')]=_0x3be0d2['dialNoAnswerRetryFrequency'];this[_0x42ae('0x10')]=_0x3be0d2['dialGlobalMaxRetry'];this[_0x42ae('0x11')]=_0x3be0d2[_0x42ae('0x11')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3be0d2['dialNoSuchNumberRetryFrequency']||0x96;this[_0x42ae('0x12')]=_0x3be0d2['dialDropMaxRetry']||0x3;this[_0x42ae('0x13')]=_0x3be0d2[_0x42ae('0x13')]||0x96;this[_0x42ae('0x14')]=_0x3be0d2[_0x42ae('0x14')]||0x3;this[_0x42ae('0x15')]=_0x3be0d2[_0x42ae('0x15')]||0x96;this[_0x42ae('0x16')]=_0x3be0d2[_0x42ae('0x16')]||0x3;this[_0x42ae('0x17')]=_0x3be0d2[_0x42ae('0x17')]||0x96;this[_0x42ae('0x18')]=_0x3be0d2[_0x42ae('0x18')]||0x3;this[_0x42ae('0x19')]=_0x3be0d2['dialAgentRejectRetryFrequency']||0x96;this[_0x42ae('0x1a')]=_0x3be0d2[_0x42ae('0x1a')]||_0x42ae('0x1b');this[_0x42ae('0x1c')]=_0x3be0d2[_0x42ae('0x1c')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x3be0d2[_0x42ae('0x1d')]||undefined;this[_0x42ae('0x1e')]=_0x3be0d2[_0x42ae('0x1e')]||undefined;this[_0x42ae('0x1f')]=_0x3be0d2['TrunkBackup']?_0x3be0d2[_0x42ae('0x1f')]:undefined;this['Trunk']=_0x3be0d2['Trunk']?_0x3be0d2[_0x42ae('0x20')]:undefined;this[_0x42ae('0x21')]=_0x3be0d2[_0x42ae('0x21')]?_0x3be0d2[_0x42ae('0x21')]:undefined;this['SquareProject']=_0x3be0d2['SquareProject']?_0x3be0d2[_0x42ae('0x22')]:undefined;this['dialQueueProject']=_0x3be0d2[_0x42ae('0x22')]?_0x3be0d2[_0x42ae('0x22')][_0x42ae('0x0')]:undefined;this[_0x42ae('0x23')]=_0x3be0d2[_0x42ae('0x23')]||![];this[_0x42ae('0x24')]=_0x3be0d2[_0x42ae('0x24')];this[_0x42ae('0x25')]=_0x3be0d2[_0x42ae('0x25')];this['dialAMDAfterGreetingSilence']=_0x3be0d2['dialAMDAfterGreetingSilence'];this[_0x42ae('0x26')]=_0x3be0d2[_0x42ae('0x26')];this[_0x42ae('0x27')]=_0x3be0d2[_0x42ae('0x27')];this[_0x42ae('0x28')]=_0x3be0d2[_0x42ae('0x28')];this[_0x42ae('0x29')]=_0x3be0d2[_0x42ae('0x29')];this[_0x42ae('0x2a')]=_0x3be0d2[_0x42ae('0x2a')];this[_0x42ae('0x2b')]=_0x3be0d2[_0x42ae('0x2b')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 659c6cb..cf6b2c6 100644 --- a/server/services/ami/model/channel.js +++ b/server/services/ami/model/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f56=['uniqueid','exten','answered','answertime','endtime','abandoned','lastapplication','duration','billableseconds','type','tag','disposition','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context'];(function(_0x48fa9c,_0x29ae25){var _0x228464=function(_0x2d63f5){while(--_0x2d63f5){_0x48fa9c['push'](_0x48fa9c['shift']());}};_0x228464(++_0x29ae25);}(_0x2f56,0xb5));var _0x62f5=function(_0x1ee94d,_0x1188e7){_0x1ee94d=_0x1ee94d-0x0;var _0x19701e=_0x2f56[_0x1ee94d];return _0x19701e;};'use strict';function Channel(){this[_0x62f5('0x0')]=null;this[_0x62f5('0x1')]='';this[_0x62f5('0x2')]='';this[_0x62f5('0x3')]=0x0;this['calleridname']='';this[_0x62f5('0x4')]=undefined;this[_0x62f5('0x5')]=undefined;this[_0x62f5('0x6')]=0x0;this[_0x62f5('0x7')]='';this[_0x62f5('0x8')]=0x0;this['linkedid']=0x0;this[_0x62f5('0x9')]=0x0;this[_0x62f5('0xa')]=![];this[_0x62f5('0xb')]=null;this[_0x62f5('0xc')]=null;this['unmanaged']=![];this[_0x62f5('0xd')]=![];this[_0x62f5('0xe')]='';this['lastdata']='';this[_0x62f5('0xf')]=0x0;this[_0x62f5('0x10')]=0x0;this['holdtime']=0x0;this[_0x62f5('0x11')]=null;this[_0x62f5('0x12')]=null;this[_0x62f5('0x13')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x62f5('0x14')]=null;this[_0x62f5('0x15')]=[];this[_0x62f5('0x16')]=undefined;this[_0x62f5('0x17')]=undefined;this[_0x62f5('0x18')]=undefined;this[_0x62f5('0x19')]=0x0;}module[_0x62f5('0x1a')]=Channel; \ No newline at end of file +var _0x8ff4=['answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','type','disposition','monitor','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','calleridnum','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered'];(function(_0x33b055,_0x3f9370){var _0x88fa1c=function(_0x3c0ec4){while(--_0x3c0ec4){_0x33b055['push'](_0x33b055['shift']());}};_0x88fa1c(++_0x3f9370);}(_0x8ff4,0x11f));var _0x48ff=function(_0x2724ab,_0x4890a8){_0x2724ab=_0x2724ab-0x0;var _0x3e05d8=_0x8ff4[_0x2724ab];return _0x3e05d8;};'use strict';function Channel(){this[_0x48ff('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x48ff('0x1')]=0x0;this[_0x48ff('0x2')]='';this['connectedlinenum']=undefined;this[_0x48ff('0x3')]=undefined;this[_0x48ff('0x4')]=0x0;this[_0x48ff('0x5')]='';this[_0x48ff('0x6')]=0x0;this[_0x48ff('0x7')]=0x0;this[_0x48ff('0x8')]=0x0;this[_0x48ff('0x9')]=![];this[_0x48ff('0xa')]=null;this[_0x48ff('0xb')]=null;this[_0x48ff('0xc')]=![];this[_0x48ff('0xd')]=![];this[_0x48ff('0xe')]='';this[_0x48ff('0xf')]='';this[_0x48ff('0x10')]=0x0;this['billableseconds']=0x0;this[_0x48ff('0x11')]=0x0;this[_0x48ff('0x12')]=null;this['tag']=null;this[_0x48ff('0x13')]=null;this[_0x48ff('0x14')]=![];this['monitorFilename']=null;this[_0x48ff('0x15')]=null;this[_0x48ff('0x16')]=[];this['transfercalleridnum']=undefined;this[_0x48ff('0x17')]=undefined;this[_0x48ff('0x18')]=undefined;this[_0x48ff('0x19')]=0x0;}module[_0x48ff('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 9c2edc1..38dbc60 100644 --- a/server/services/ami/model/deskAccount.js +++ b/server/services/ami/model/deskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0007=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x51cd85,_0x5f3d6c){var _0x4c1531=function(_0x2e1844){while(--_0x2e1844){_0x51cd85['push'](_0x51cd85['shift']());}};_0x4c1531(++_0x5f3d6c);}(_0x0007,0x120));var _0x7000=function(_0x1255d6,_0x481067){_0x1255d6=_0x1255d6-0x0;var _0x1397af=_0x0007[_0x1255d6];return _0x1397af;};'use strict';function DeskAccount(_0x287a58){this['id']=_0x287a58['id']||0x0;this[_0x7000('0x0')]=_0x287a58[_0x7000('0x0')]||'';this[_0x7000('0x1')]=_0x287a58[_0x7000('0x1')]||'';this[_0x7000('0x2')]=_0x287a58[_0x7000('0x2')]||'';this['authType']=_0x287a58[_0x7000('0x3')]||'';this['password']=_0x287a58[_0x7000('0x4')]||'';this[_0x7000('0x5')]=_0x287a58[_0x7000('0x5')]||'';this[_0x7000('0x6')]=_0x287a58[_0x7000('0x6')]||'';this[_0x7000('0x7')]=_0x287a58['token']||'';this[_0x7000('0x8')]=_0x287a58[_0x7000('0x8')]||'';this['type']=_0x287a58[_0x7000('0x9')]||'';this[_0x7000('0xa')]=_0x287a58[_0x7000('0xa')]||'';this['Configurations']=_0x287a58[_0x7000('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x43a4=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43a4,0x8d));var _0x443a=function(_0x776414,_0x10d2de){_0x776414=_0x776414-0x0;var _0x7ec5f6=_0x43a4[_0x776414];return _0x7ec5f6;};'use strict';function DeskAccount(_0xcbffd8){this['id']=_0xcbffd8['id']||0x0;this[_0x443a('0x0')]=_0xcbffd8[_0x443a('0x0')]||'';this[_0x443a('0x1')]=_0xcbffd8[_0x443a('0x1')]||'';this[_0x443a('0x2')]=_0xcbffd8['remoteUri']||'';this[_0x443a('0x3')]=_0xcbffd8[_0x443a('0x3')]||'';this['password']=_0xcbffd8[_0x443a('0x4')]||'';this[_0x443a('0x5')]=_0xcbffd8[_0x443a('0x5')]||'';this[_0x443a('0x6')]=_0xcbffd8[_0x443a('0x6')]||'';this[_0x443a('0x7')]=_0xcbffd8['token']||'';this[_0x443a('0x8')]=_0xcbffd8['tokenSecret']||'';this[_0x443a('0x9')]=_0xcbffd8[_0x443a('0x9')]||'';this['serverUrl']=_0xcbffd8[_0x443a('0xa')]||'';this[_0x443a('0xb')]=_0xcbffd8[_0x443a('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 536166f..3d4d4a5 100644 --- a/server/services/ami/model/dynamics365Account.js +++ b/server/services/ami/model/dynamics365Account.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e56=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','Configurations','CloudProvider'];(function(_0x17f7db,_0x13323d){var _0x10cc54=function(_0x3253c7){while(--_0x3253c7){_0x17f7db['push'](_0x17f7db['shift']());}};_0x10cc54(++_0x13323d);}(_0x7e56,0x156));var _0x67e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e56[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x443ed2){this['id']=_0x443ed2['id']||0x0;this[_0x67e5('0x0')]=_0x443ed2[_0x67e5('0x0')]||'';this[_0x67e5('0x1')]=_0x443ed2[_0x67e5('0x1')]||'';this['password']=_0x443ed2[_0x67e5('0x2')]||'';this[_0x67e5('0x3')]=_0x443ed2[_0x67e5('0x3')]||'';this[_0x67e5('0x4')]=_0x443ed2[_0x67e5('0x4')]||'';this[_0x67e5('0x5')]=_0x443ed2[_0x67e5('0x5')]||'';this[_0x67e5('0x6')]=_0x443ed2[_0x67e5('0x6')]||{};this['serverUrl']=_0x443ed2['serverUrl']||'';this['modernAuthentication']=_0x443ed2[_0x67e5('0x7')]||![];this[_0x67e5('0x8')]=_0x443ed2[_0x67e5('0x8')]||{};this['CloudProvider']=_0x443ed2[_0x67e5('0x9')]||{};}module[_0x67e5('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x8fc2=['Configurations','CloudProvider','exports','name','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x51a85c,_0x2660a3){var _0x55001f=function(_0x39ec46){while(--_0x39ec46){_0x51a85c['push'](_0x51a85c['shift']());}};_0x55001f(++_0x2660a3);}(_0x8fc2,0x12c));var _0x28fc=function(_0x8b1862,_0x41368a){_0x8b1862=_0x8b1862-0x0;var _0x5dad8d=_0x8fc2[_0x8b1862];return _0x5dad8d;};'use strict';function Dynamics365Account(_0x1d651b){this['id']=_0x1d651b['id']||0x0;this[_0x28fc('0x0')]=_0x1d651b[_0x28fc('0x0')]||'';this['username']=_0x1d651b['username']||'';this[_0x28fc('0x1')]=_0x1d651b['password']||'';this['remoteUri']=_0x1d651b[_0x28fc('0x2')]||'';this['tenantId']=_0x1d651b[_0x28fc('0x3')]||'';this['clientId']=_0x1d651b[_0x28fc('0x4')]||'';this['clientSecret']=_0x1d651b[_0x28fc('0x5')]||{};this[_0x28fc('0x6')]=_0x1d651b['serverUrl']||'';this[_0x28fc('0x7')]=_0x1d651b[_0x28fc('0x7')]||![];this[_0x28fc('0x8')]=_0x1d651b[_0x28fc('0x8')]||{};this['CloudProvider']=_0x1d651b[_0x28fc('0x9')]||{};}module[_0x28fc('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index d461269..53947d9 100644 --- a/server/services/ami/model/faxAccount.js +++ b/server/services/ami/model/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1718=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x458e5a,_0x252f0f){var _0x37d3=function(_0x43547d){while(--_0x43547d){_0x458e5a['push'](_0x458e5a['shift']());}};_0x37d3(++_0x252f0f);}(_0x1718,0x190));var _0x8171=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1718[_0x20a584];return _0x4b41a8;};'use strict';function FaxAccount(_0x30284a){this['id']=_0x30284a['id']||0x0;this[_0x8171('0x0')]=_0x30284a[_0x8171('0x0')]||'';this[_0x8171('0x1')]=_0x30284a[_0x8171('0x1')];this['ecm']=_0x30284a['ecm'];this['headerinfo']=_0x30284a[_0x8171('0x2')];this['localstationid']=_0x30284a[_0x8171('0x3')];this['minrate']=_0x30284a[_0x8171('0x4')]||0x960;this[_0x8171('0x5')]=_0x30284a['maxrate']||0x3840;this[_0x8171('0x6')]=_0x30284a[_0x8171('0x6')]||_0x8171('0x7');this[_0x8171('0x8')]=_0x30284a[_0x8171('0x8')]||'no';this[_0x8171('0x9')]=_0x30284a[_0x8171('0x9')]||'no';this[_0x8171('0xa')]=_0x30284a[_0x8171('0xa')]||0x1388;this[_0x8171('0xb')]=_0x30284a['tech']||_0x8171('0xc');this['Trunk']=_0x30284a[_0x8171('0xd')]?_0x30284a['Trunk']:undefined;this['ListId']=_0x30284a[_0x8171('0xe')];this[_0x8171('0xf')]=_0x30284a[_0x8171('0xf')];}module[_0x8171('0x10')]=FaxAccount; \ No newline at end of file +var _0x1106=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x18ab26,_0x2cb289){var _0x4009b2=function(_0x1817c9){while(--_0x1817c9){_0x18ab26['push'](_0x18ab26['shift']());}};_0x4009b2(++_0x2cb289);}(_0x1106,0x99));var _0x6110=function(_0x49df79,_0x45d796){_0x49df79=_0x49df79-0x0;var _0x34febf=_0x1106[_0x49df79];return _0x34febf;};'use strict';function FaxAccount(_0x1255f2){this['id']=_0x1255f2['id']||0x0;this[_0x6110('0x0')]=_0x1255f2[_0x6110('0x0')]||'';this[_0x6110('0x1')]=_0x1255f2['description'];this[_0x6110('0x2')]=_0x1255f2[_0x6110('0x2')];this[_0x6110('0x3')]=_0x1255f2[_0x6110('0x3')];this[_0x6110('0x4')]=_0x1255f2[_0x6110('0x4')];this[_0x6110('0x5')]=_0x1255f2['minrate']||0x960;this[_0x6110('0x6')]=_0x1255f2[_0x6110('0x6')]||0x3840;this[_0x6110('0x7')]=_0x1255f2[_0x6110('0x7')]||_0x6110('0x8');this[_0x6110('0x9')]=_0x1255f2['gateway']||'no';this[_0x6110('0xa')]=_0x1255f2[_0x6110('0xa')]||'no';this[_0x6110('0xb')]=_0x1255f2[_0x6110('0xb')]||0x1388;this[_0x6110('0xc')]=_0x1255f2[_0x6110('0xc')]||_0x6110('0xd');this[_0x6110('0xe')]=_0x1255f2[_0x6110('0xe')]?_0x1255f2[_0x6110('0xe')]:undefined;this[_0x6110('0xf')]=_0x1255f2[_0x6110('0xf')];this['key']=_0x1255f2[_0x6110('0x10')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index e273182..4702862 100644 --- a/server/services/ami/model/freshdeskAccount.js +++ b/server/services/ami/model/freshdeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7364=['exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x146ed6,_0x505aae){var _0x4c67e3=function(_0x4699a1){while(--_0x4699a1){_0x146ed6['push'](_0x146ed6['shift']());}};_0x4c67e3(++_0x505aae);}(_0x7364,0x163));var _0x4736=function(_0x5b29ff,_0x3221bf){_0x5b29ff=_0x5b29ff-0x0;var _0x1beb99=_0x7364[_0x5b29ff];return _0x1beb99;};'use strict';function FreshdeskAccount(_0x2b60fa){this['id']=_0x2b60fa['id']||0x0;this[_0x4736('0x0')]=_0x2b60fa[_0x4736('0x0')]||'';this['username']=_0x2b60fa[_0x4736('0x1')]||'';this[_0x4736('0x2')]=_0x2b60fa['token']||'';this[_0x4736('0x3')]=_0x2b60fa[_0x4736('0x3')]||'';this[_0x4736('0x4')]=_0x2b60fa[_0x4736('0x4')]||'';this['Configurations']=_0x2b60fa['Configurations']||{};}module[_0x4736('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0x2b01=['exports','name','username','apiKey','token','serverUrl','Configurations'];(function(_0x2cea0e,_0x217e1b){var _0x95c171=function(_0x393e82){while(--_0x393e82){_0x2cea0e['push'](_0x2cea0e['shift']());}};_0x95c171(++_0x217e1b);}(_0x2b01,0x1e4));var _0x12b0=function(_0x1a1b24,_0x2a2514){_0x1a1b24=_0x1a1b24-0x0;var _0x3ee752=_0x2b01[_0x1a1b24];return _0x3ee752;};'use strict';function FreshdeskAccount(_0x551f78){this['id']=_0x551f78['id']||0x0;this[_0x12b0('0x0')]=_0x551f78[_0x12b0('0x0')]||'';this[_0x12b0('0x1')]=_0x551f78[_0x12b0('0x1')]||'';this[_0x12b0('0x2')]=_0x551f78[_0x12b0('0x3')]||'';this['remoteUri']=_0x551f78['remoteUri']||'';this[_0x12b0('0x4')]=_0x551f78[_0x12b0('0x4')]||'';this[_0x12b0('0x5')]=_0x551f78['Configurations']||{};}module[_0x12b0('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 2604912..f22cfbf 100644 --- a/server/services/ami/model/freshsalesAccount.js +++ b/server/services/ami/model/freshsalesAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f47=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x6f47,0xc7));var _0x76f4=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x6f47[_0x39096d];return _0x13da4f;};'use strict';function FreshsalesAccount(_0xd05ad8){this['id']=_0xd05ad8['id']||0x0;this[_0x76f4('0x0')]=_0xd05ad8[_0x76f4('0x0')]||'';this['username']=_0xd05ad8[_0x76f4('0x1')]||'';this['apiKey']=_0xd05ad8[_0x76f4('0x2')]||'';this['remoteUri']=_0xd05ad8[_0x76f4('0x3')]||'';this[_0x76f4('0x4')]=_0xd05ad8[_0x76f4('0x4')]||'';this[_0x76f4('0x5')]=_0xd05ad8['Configurations']||{};}module[_0x76f4('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x2b83=['username','apiKey','token','serverUrl','Configurations','name'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x2b83,0x1d3));var _0x32b8=function(_0x3f6e13,_0x517137){_0x3f6e13=_0x3f6e13-0x0;var _0x5b5264=_0x2b83[_0x3f6e13];return _0x5b5264;};'use strict';function FreshsalesAccount(_0x52d8cb){this['id']=_0x52d8cb['id']||0x0;this[_0x32b8('0x0')]=_0x52d8cb[_0x32b8('0x0')]||'';this['username']=_0x52d8cb[_0x32b8('0x1')]||'';this[_0x32b8('0x2')]=_0x52d8cb[_0x32b8('0x3')]||'';this['remoteUri']=_0x52d8cb['remoteUri']||'';this[_0x32b8('0x4')]=_0x52d8cb[_0x32b8('0x4')]||'';this['Configurations']=_0x52d8cb[_0x32b8('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 96bc6ac..53f8469 100644 --- a/server/services/ami/model/queueReport.js +++ b/server/services/ami/model/queueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9adb=['exten','assigned','lastAssignedTo','motionChannel','voice','mohtime','type','inbound','uniqueid','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x9adb,0x1e6));var _0xb9ad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9adb[_0x20a584];return _0x4b41a8;};'use strict';function QueueReport(){this[_0xb9ad('0x0')]=_0xb9ad('0x1');this[_0xb9ad('0x2')]='';this['calleridnum']='';this[_0xb9ad('0x3')]='';this[_0xb9ad('0x4')]='';this['queuecallerjoinAt']=null;this[_0xb9ad('0x5')]=null;this[_0xb9ad('0x6')]=0x1;this[_0xb9ad('0x7')]=0x1;this[_0xb9ad('0x8')]=![];this[_0xb9ad('0x9')]=null;this[_0xb9ad('0xa')]=![];this[_0xb9ad('0xb')]=null;this['queuecallerexit']=![];this[_0xb9ad('0xc')]=null;this[_0xb9ad('0xd')]=0x1;this[_0xb9ad('0xe')]='';this['connectedlinenum']='';this[_0xb9ad('0xf')]='';this[_0xb9ad('0x10')]='';this[_0xb9ad('0x11')]='';this[_0xb9ad('0x12')]='';this['priority']='';this['holdtime']=0x0;this[_0xb9ad('0x13')]=![];this[_0xb9ad('0x14')]='';this[_0xb9ad('0x15')]=_0xb9ad('0x16');this[_0xb9ad('0x17')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0xb6c6=['queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','lastAssignedTo','motionChannel','voice','variables','exports','uniqueid','calleridnum','calleridname'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0xb6c6,0x12d));var _0x6b6c=function(_0x553184,_0x18908e){_0x553184=_0x553184-0x0;var _0x39804e=_0xb6c6[_0x553184];return _0x39804e;};'use strict';function QueueReport(){this['type']='inbound';this[_0x6b6c('0x0')]='';this[_0x6b6c('0x1')]='';this[_0x6b6c('0x2')]='';this[_0x6b6c('0x3')]='';this[_0x6b6c('0x4')]=null;this[_0x6b6c('0x5')]=null;this['position']=0x1;this['count']=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x6b6c('0x6')]=null;this[_0x6b6c('0x7')]=0x1;this['channel']='';this[_0x6b6c('0x8')]='';this[_0x6b6c('0x9')]='';this[_0x6b6c('0xa')]='';this[_0x6b6c('0xb')]='';this['exten']='';this[_0x6b6c('0xc')]='';this[_0x6b6c('0xd')]=0x0;this['assigned']=![];this[_0x6b6c('0xe')]='';this[_0x6b6c('0xf')]=_0x6b6c('0x10');this['mohtime']=0x0;this[_0x6b6c('0x11')]={};}module[_0x6b6c('0x12')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index dd0ad0c..b953c58 100644 --- a/server/services/ami/model/salesforceAccount.js +++ b/server/services/ami/model/salesforceAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03cf=['type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x03cf,0x67));var _0xf03c=function(_0x34a551,_0x144ef8){_0x34a551=_0x34a551-0x0;var _0x4f9504=_0x03cf[_0x34a551];return _0x4f9504;};'use strict';function SalesforceAccount(_0x1c7fbc){this['id']=_0x1c7fbc['id']||0x0;this['name']=_0x1c7fbc[_0xf03c('0x0')]||'';this[_0xf03c('0x1')]=_0x1c7fbc[_0xf03c('0x1')]||'';this[_0xf03c('0x2')]=_0x1c7fbc[_0xf03c('0x2')]||'';this[_0xf03c('0x3')]=_0x1c7fbc[_0xf03c('0x3')]||'';this[_0xf03c('0x4')]=_0x1c7fbc['clientId']||'';this[_0xf03c('0x5')]=_0x1c7fbc[_0xf03c('0x5')]||'';this[_0xf03c('0x6')]=_0x1c7fbc[_0xf03c('0x6')]||'';this[_0xf03c('0x7')]=_0x1c7fbc['type']||_0xf03c('0x8');this[_0xf03c('0x9')]=_0x1c7fbc['serverUrl']||'';this[_0xf03c('0xa')]=_0x1c7fbc[_0xf03c('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xa212=['securityToken','type','serverUrl','Configurations','name','remoteUri','clientId','clientSecret'];(function(_0x2b7b04,_0x5491aa){var _0x4b0728=function(_0x4947a3){while(--_0x4947a3){_0x2b7b04['push'](_0x2b7b04['shift']());}};_0x4b0728(++_0x5491aa);}(_0xa212,0xec));var _0x2a21=function(_0x2369de,_0x5e3e41){_0x2369de=_0x2369de-0x0;var _0x5cf9b2=_0xa212[_0x2369de];return _0x5cf9b2;};'use strict';function SalesforceAccount(_0x34134a){this['id']=_0x34134a['id']||0x0;this[_0x2a21('0x0')]=_0x34134a[_0x2a21('0x0')]||'';this['username']=_0x34134a['username']||'';this['remoteUri']=_0x34134a[_0x2a21('0x1')]||'';this['password']=_0x34134a['password']||'';this[_0x2a21('0x2')]=_0x34134a[_0x2a21('0x2')]||'';this[_0x2a21('0x3')]=_0x34134a[_0x2a21('0x3')]||'';this[_0x2a21('0x4')]=_0x34134a['securityToken']||'';this[_0x2a21('0x5')]=_0x34134a[_0x2a21('0x5')]||'integrationTab';this['serverUrl']=_0x34134a[_0x2a21('0x6')]||'';this[_0x2a21('0x7')]=_0x34134a[_0x2a21('0x7')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index c5ef248..01435c8 100644 --- a/server/services/ami/model/servicenowAccount.js +++ b/server/services/ami/model/servicenowAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52d6=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x771be8,_0x3cfc65){var _0x596fd5=function(_0x1cc3e8){while(--_0x1cc3e8){_0x771be8['push'](_0x771be8['shift']());}};_0x596fd5(++_0x3cfc65);}(_0x52d6,0xfd));var _0x652d=function(_0x36b832,_0x3b0282){_0x36b832=_0x36b832-0x0;var _0x4119a9=_0x52d6[_0x36b832];return _0x4119a9;};'use strict';function ServicenowAccount(_0x5b7554){this['id']=_0x5b7554['id']||0x0;this[_0x652d('0x0')]=_0x5b7554[_0x652d('0x0')]||'';this[_0x652d('0x1')]=_0x5b7554[_0x652d('0x1')]||'';this['password']=_0x5b7554[_0x652d('0x2')]||'';this[_0x652d('0x3')]=_0x5b7554[_0x652d('0x3')]||'';this[_0x652d('0x4')]=_0x5b7554[_0x652d('0x4')]||'';this['Configurations']=_0x5b7554[_0x652d('0x5')]||{};}module[_0x652d('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x3222=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x102243,_0x2b4dde){var _0x1d302c=function(_0x50c1fb){while(--_0x50c1fb){_0x102243['push'](_0x102243['shift']());}};_0x1d302c(++_0x2b4dde);}(_0x3222,0x94));var _0x2322=function(_0x17a310,_0x46ec78){_0x17a310=_0x17a310-0x0;var _0x145786=_0x3222[_0x17a310];return _0x145786;};'use strict';function ServicenowAccount(_0x4f1da8){this['id']=_0x4f1da8['id']||0x0;this['name']=_0x4f1da8[_0x2322('0x0')]||'';this[_0x2322('0x1')]=_0x4f1da8['username']||'';this[_0x2322('0x2')]=_0x4f1da8[_0x2322('0x2')]||'';this[_0x2322('0x3')]=_0x4f1da8[_0x2322('0x3')]||'';this['serverUrl']=_0x4f1da8[_0x2322('0x4')]||'';this[_0x2322('0x5')]=_0x4f1da8['Configurations']||{};}module[_0x2322('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 11a87d2..c41cc15 100644 --- a/server/services/ami/model/sugarcrmAccount.js +++ b/server/services/ami/model/sugarcrmAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0996=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x1bb26d,_0x4887db){var _0x8317ac=function(_0x505381){while(--_0x505381){_0x1bb26d['push'](_0x1bb26d['shift']());}};_0x8317ac(++_0x4887db);}(_0x0996,0x13d));var _0x6099=function(_0x37b750,_0x3cd433){_0x37b750=_0x37b750-0x0;var _0x476cea=_0x0996[_0x37b750];return _0x476cea;};'use strict';function SugarcrmAccount(_0x204bba){this['id']=_0x204bba['id']||0x0;this[_0x6099('0x0')]=_0x204bba[_0x6099('0x0')]||'';this[_0x6099('0x1')]=_0x204bba[_0x6099('0x1')]||'';this[_0x6099('0x2')]=_0x204bba[_0x6099('0x2')]||'';this[_0x6099('0x3')]=_0x204bba[_0x6099('0x3')]||'';this[_0x6099('0x4')]=_0x204bba[_0x6099('0x4')]||'';this[_0x6099('0x5')]=_0x204bba[_0x6099('0x5')]||{};}module[_0x6099('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xb455=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4343f1,_0x325dce){var _0x5d84a0=function(_0x53c23f){while(--_0x53c23f){_0x4343f1['push'](_0x4343f1['shift']());}};_0x5d84a0(++_0x325dce);}(_0xb455,0xdf));var _0x5b45=function(_0x4cac72,_0x24d93b){_0x4cac72=_0x4cac72-0x0;var _0x143234=_0xb455[_0x4cac72];return _0x143234;};'use strict';function SugarcrmAccount(_0xe82cef){this['id']=_0xe82cef['id']||0x0;this[_0x5b45('0x0')]=_0xe82cef[_0x5b45('0x0')]||'';this[_0x5b45('0x1')]=_0xe82cef['username']||'';this[_0x5b45('0x2')]=_0xe82cef[_0x5b45('0x2')]||'';this[_0x5b45('0x3')]=_0xe82cef[_0x5b45('0x3')]||'';this[_0x5b45('0x4')]=_0xe82cef[_0x5b45('0x4')]||'';this[_0x5b45('0x5')]=_0xe82cef['Configurations']||{};}module[_0x5b45('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 283c42f..9fac711 100644 --- a/server/services/ami/model/telephone.js +++ b/server/services/ami/model/telephone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c29=['accountcode','state','status','unknown','exports','name'];(function(_0x58f68e,_0x1710c2){var _0x562a5b=function(_0x20adc0){while(--_0x20adc0){_0x58f68e['push'](_0x58f68e['shift']());}};_0x562a5b(++_0x1710c2);}(_0x6c29,0x1c1));var _0x96c2=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x6c29[_0xf79bae];return _0x5d2cb7;};'use strict';function Telephone(_0x2c6a75){this['id']=_0x2c6a75['id']||0x0;this[_0x96c2('0x0')]=_0x2c6a75[_0x96c2('0x0')]||'';this[_0x96c2('0x1')]=_0x2c6a75[_0x96c2('0x1')]||'';this[_0x96c2('0x2')]='unknown';this['stateTime']=0x0;this[_0x96c2('0x3')]=_0x96c2('0x4');this['address']='';}module[_0x96c2('0x5')]=Telephone; \ No newline at end of file +var _0x1d57=['unknown','address','exports','name','accountcode','state','stateTime','status'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1d57,0x123));var _0x71d5=function(_0x39cc8f,_0xb60cd8){_0x39cc8f=_0x39cc8f-0x0;var _0x15e616=_0x1d57[_0x39cc8f];return _0x15e616;};'use strict';function Telephone(_0xafc682){this['id']=_0xafc682['id']||0x0;this[_0x71d5('0x0')]=_0xafc682[_0x71d5('0x0')]||'';this[_0x71d5('0x1')]=_0xafc682['accountcode']||'';this[_0x71d5('0x2')]='unknown';this[_0x71d5('0x3')]=0x0;this[_0x71d5('0x4')]=_0x71d5('0x5');this[_0x71d5('0x6')]='';}module[_0x71d5('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index e2683ce..05571b0 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x128bc6,_0x2979ad){var _0xa3bb1f=function(_0x4f89c5){while(--_0x4f89c5){_0x128bc6['push'](_0x128bc6['shift']());}};_0xa3bb1f(++_0x2979ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1a5916,_0x1036e9){var _0x1605fd=function(_0x3649be){while(--_0x3649be){_0x1a5916['push'](_0x1a5916['shift']());}};_0x1605fd(++_0x1036e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 765a4e0..161643f 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x9a29ea,_0x5b8b29){_0x9a29ea=_0x9a29ea-0x0;var _0x11f261=_0x5eb8[_0x9a29ea];return _0x11f261;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x4fd218,_0x3ad1f1){var _0x398d42=function(_0x4cec0e){while(--_0x4cec0e){_0x4fd218['push'](_0x4fd218['shift']());}};_0x398d42(++_0x3ad1f1);}(_0xda2d,0x102));var _0xdda2=function(_0x33dcc2,_0x18dd35){_0x33dcc2=_0x33dcc2-0x0;var _0x300ce5=_0xda2d[_0x33dcc2];return _0x300ce5;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index b6bae47..797694a 100644 --- a/server/services/ami/model/trunk.js +++ b/server/services/ami/model/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a2c=['name','state','unknown','stateTime','status','registry','indexOf','host','port','domain','domainport','refresh','stateRegistry','address','defaultuser','active'];(function(_0x5dcd95,_0x1e72d4){var _0x271b17=function(_0x57b81b){while(--_0x57b81b){_0x5dcd95['push'](_0x5dcd95['shift']());}};_0x271b17(++_0x1e72d4);}(_0x8a2c,0x15f));var _0xc8a2=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8a2c[_0x16b9ed];return _0x66b1f8;};'use strict';function Trunk(_0x25714f){this['id']=_0x25714f['id']||0x0;this[_0xc8a2('0x0')]=_0x25714f['active']||![];this[_0xc8a2('0x1')]=_0x25714f[_0xc8a2('0x1')]||'';this[_0xc8a2('0x2')]=_0xc8a2('0x3');this[_0xc8a2('0x4')]=0x0;this[_0xc8a2('0x5')]='unknown';this['registry']=_0x25714f[_0xc8a2('0x6')]&&_0x25714f[_0xc8a2('0x6')][_0xc8a2('0x7')](':')?_0x25714f[_0xc8a2('0x6')]['split'](':')[0x0]:'';this[_0xc8a2('0x8')]='';this[_0xc8a2('0x9')]='';this[_0xc8a2('0xa')]='';this[_0xc8a2('0xb')]='';this[_0xc8a2('0xc')]='';this[_0xc8a2('0xd')]=_0xc8a2('0x3');this['registrationtime']='';this[_0xc8a2('0xe')]='';this[_0xc8a2('0xf')]=_0x25714f['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file +var _0x5d89=['indexOf','split','host','port','domainport','refresh','stateRegistry','address','exports','active','name','state','stateTime','status','unknown','registry'];(function(_0x4d2943,_0x501535){var _0x51f1b3=function(_0x3432da){while(--_0x3432da){_0x4d2943['push'](_0x4d2943['shift']());}};_0x51f1b3(++_0x501535);}(_0x5d89,0x139));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x33b9e1){this['id']=_0x33b9e1['id']||0x0;this[_0x95d8('0x0')]=_0x33b9e1['active']||![];this[_0x95d8('0x1')]=_0x33b9e1[_0x95d8('0x1')]||'';this[_0x95d8('0x2')]='unknown';this[_0x95d8('0x3')]=0x0;this[_0x95d8('0x4')]=_0x95d8('0x5');this[_0x95d8('0x6')]=_0x33b9e1[_0x95d8('0x6')]&&_0x33b9e1['registry'][_0x95d8('0x7')](':')?_0x33b9e1[_0x95d8('0x6')][_0x95d8('0x8')](':')[0x0]:'';this[_0x95d8('0x9')]='';this[_0x95d8('0xa')]='';this['domain']='';this[_0x95d8('0xb')]='';this[_0x95d8('0xc')]='';this[_0x95d8('0xd')]=_0x95d8('0x5');this['registrationtime']='';this[_0x95d8('0xe')]='';this['defaultuser']=_0x33b9e1['defaultuser']||'';}module[_0x95d8('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 87166ec..d101335 100644 --- a/server/services/ami/model/voiceExtension.js +++ b/server/services/ami/model/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac31=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x5878eb,_0x225811){var _0x56dae6=function(_0x4efaf6){while(--_0x4efaf6){_0x5878eb['push'](_0x5878eb['shift']());}};_0x56dae6(++_0x225811);}(_0xac31,0x112));var _0x1ac3=function(_0xc275f6,_0xd12554){_0xc275f6=_0xc275f6-0x0;var _0x32df33=_0xac31[_0xc275f6];return _0x32df33;};'use strict';function voiceExtension(_0x21d6da){this['id']=_0x21d6da['id']||0x0;this[_0x1ac3('0x0')]=_0x21d6da['exten']||'';this['recordingFormat']=_0x21d6da[_0x1ac3('0x1')]||_0x1ac3('0x2');this[_0x1ac3('0x3')]=_0x21d6da[_0x1ac3('0x3')]||![];}module[_0x1ac3('0x4')]=voiceExtension; \ No newline at end of file +var _0x83de=['exten','none','mandatoryDisposition','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x83de,0x1a4));var _0xe83d=function(_0x5f44ba,_0x1f318e){_0x5f44ba=_0x5f44ba-0x0;var _0x312dbe=_0x83de[_0x5f44ba];return _0x312dbe;};'use strict';function voiceExtension(_0x3351fe){this['id']=_0x3351fe['id']||0x0;this[_0xe83d('0x0')]=_0x3351fe[_0xe83d('0x0')]||'';this['recordingFormat']=_0x3351fe['recordingFormat']||_0xe83d('0x1');this[_0xe83d('0x2')]=_0x3351fe[_0xe83d('0x2')]||![];}module[_0xe83d('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 9572354..88d2373 100644 --- a/server/services/ami/model/voiceQueue.js +++ b/server/services/ami/model/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7be5=['dialGlobalInterval','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','busy','invalid','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','temp','dialTimezone'];(function(_0xa4b263,_0x5e7e3f){var _0x32b791=function(_0x2deb12){while(--_0x2deb12){_0xa4b263['push'](_0xa4b263['shift']());}};_0x32b791(++_0x5e7e3f);}(_0x7be5,0x146));var _0x57be=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7be5[_0x20a584];return _0x4b41a8;};'use strict';var statusDesc=[_0x57be('0x0'),'not_inuse','inuse',_0x57be('0x1'),_0x57be('0x2'),_0x57be('0x3'),_0x57be('0x4'),_0x57be('0x5'),_0x57be('0x6')];var monitorFormat={'wav':'wav','wav49':_0x57be('0x7'),'gsm':_0x57be('0x8')};var strategy={'rrmemory':_0x57be('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x41d03b){this['id']=_0x41d03b['id']||0x0;this[_0x57be('0xa')]=_0x41d03b[_0x57be('0xa')]||'';this['monitor_format']=_0x41d03b[_0x57be('0xb')]||'';this['type']=_0x41d03b[_0x57be('0xc')]||_0x57be('0xd');this[_0x57be('0xe')]=0x0;this['talking']=0x0;this[_0x57be('0xf')]=0x0;this[_0x57be('0x10')]=0x0;this[_0x57be('0x11')]=0x0;this[_0x57be('0x12')]=0x0;this['sumBillable']=0x0;this[_0x57be('0x13')]=0x0;this[_0x57be('0x14')]=0x0;this['loggedIn']=0x0;this[_0x57be('0x15')]=0x0;this[_0x57be('0x16')]=_0x41d03b[_0x57be('0x16')]||![];this[_0x57be('0x17')]=_0x41d03b[_0x57be('0x17')]||0xa;this[_0x57be('0x18')]=_0x41d03b[_0x57be('0x18')]||'no';this[_0x57be('0x19')]=!![];this['message']='';this['originated']=0x0;this[_0x57be('0x1a')]=0x0;this[_0x57be('0x1b')]=_0x41d03b[_0x57be('0x1b')]||null;this['dialGlobalInterval']=_0x41d03b[_0x57be('0x1c')]?_0x41d03b[_0x57be('0x1c')]:null;this['dialActive']=_0x41d03b['dialActive'];this[_0x57be('0x1d')]=_0x41d03b[_0x57be('0x1d')]||'progressive';this[_0x57be('0x1e')]=_0x41d03b[_0x57be('0x1e')]||0x0;this[_0x57be('0x1f')]=_0x41d03b[_0x57be('0x1f')]||0x0;this[_0x57be('0x20')]=_0x41d03b[_0x57be('0x20')]||0x1;this[_0x57be('0x21')]=_0x41d03b['dialPredictiveOptimization']||_0x57be('0x22');this[_0x57be('0x23')]=_0x41d03b[_0x57be('0x23')]||0.03;this[_0x57be('0x24')]=_0x41d03b[_0x57be('0x24')]||0x258;this[_0x57be('0x25')]=_0x41d03b['dialOriginateCallerIdName']||_0x57be('0x26');this[_0x57be('0x27')]=_0x41d03b[_0x57be('0x27')]||'anonymous';this[_0x57be('0x28')]=_0x41d03b[_0x57be('0x28')]||0x1e;this[_0x57be('0x29')]=_0x41d03b[_0x57be('0x29')]||_0x57be('0x2a');this[_0x57be('0x2b')]=_0x41d03b[_0x57be('0x2b')]||0x3;this[_0x57be('0x2c')]=_0x41d03b[_0x57be('0x2c')]||undefined;this[_0x57be('0x2d')]=_0x41d03b[_0x57be('0x2d')]||0x3;this[_0x57be('0x2e')]=_0x41d03b[_0x57be('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x41d03b[_0x57be('0x2f')]||0x3;this[_0x57be('0x30')]=_0x41d03b[_0x57be('0x30')]||0x96;this[_0x57be('0x31')]=_0x41d03b['dialNoAnswerMaxRetry']||0x3;this[_0x57be('0x32')]=_0x41d03b[_0x57be('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x41d03b['dialNoSuchNumberMaxRetry']||0x3;this[_0x57be('0x33')]=_0x41d03b['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x41d03b[_0x57be('0x34')]||0x3;this[_0x57be('0x35')]=_0x41d03b[_0x57be('0x35')]||0x96;this[_0x57be('0x36')]=_0x41d03b[_0x57be('0x36')]||0x3;this[_0x57be('0x37')]=_0x41d03b[_0x57be('0x37')]||0x96;this['dialMachineMaxRetry']=_0x41d03b[_0x57be('0x38')]||0x3;this['dialMachineRetryFrequency']=_0x41d03b[_0x57be('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x41d03b[_0x57be('0x3a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x41d03b[_0x57be('0x3b')]||0x96;this[_0x57be('0x3c')]=_0x41d03b['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x41d03b['Trunk']?_0x41d03b[_0x57be('0x3d')]:undefined;this[_0x57be('0x3e')]=_0x41d03b[_0x57be('0x3e')]?_0x41d03b['TrunkBackup']:undefined;this[_0x57be('0x3f')]=_0x41d03b[_0x57be('0x3f')]||undefined;this[_0x57be('0x40')]=_0x41d03b['Interval']?_0x41d03b['Interval']:undefined;this[_0x57be('0x41')]=_0x41d03b['dialOrderByScheduledAt']||_0x57be('0x42');this['dialRandomLastDigitCallerIdNumber']=_0x41d03b[_0x57be('0x43')]||undefined;this[_0x57be('0x44')]=_0x41d03b['dialCutDigit']||undefined;this['strategy']=strategy[_0x41d03b[_0x57be('0x45')]]||_0x57be('0x9');this[_0x57be('0x46')]=!![];this[_0x57be('0x47')]=_0x41d03b[_0x57be('0x47')]||![];this[_0x57be('0x48')]=_0x41d03b[_0x57be('0x48')];this[_0x57be('0x49')]=_0x41d03b[_0x57be('0x49')];this['dialAMDAfterGreetingSilence']=_0x41d03b[_0x57be('0x4a')];this[_0x57be('0x4b')]=_0x41d03b[_0x57be('0x4b')];this[_0x57be('0x4c')]=_0x41d03b[_0x57be('0x4c')];this[_0x57be('0x4d')]=_0x41d03b[_0x57be('0x4d')];this[_0x57be('0x4e')]=_0x41d03b['dialAMDMaximumNumberOfWords'];this[_0x57be('0x4f')]=_0x41d03b['dialAMDSilenceThreshold'];this[_0x57be('0x50')]=_0x41d03b['dialAMDMaximumWordLength'];this[_0x57be('0x51')]=0x0;this['pTalking']=0x0;this['timeout']=_0x41d03b[_0x57be('0x52')];this[_0x57be('0x53')]=0x0;this[_0x57be('0x54')]=0x0;this[_0x57be('0x55')]=0x0;this[_0x57be('0x56')]=0x0;this[_0x57be('0x57')]=0x0;this[_0x57be('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x57be('0x59')]=0x0;this[_0x57be('0x5a')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x57be('0x5b')]=0x0;this['outboundReCallsDay']=0x0;this[_0x57be('0x5c')]=0x0;this['startProgressive']=undefined;this[_0x57be('0x5d')]=undefined;this[_0x57be('0x5e')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x57be('0x5f')]=0x0;this[_0x57be('0x60')]=0x0;this[_0x57be('0x61')]=0x0;this[_0x57be('0x62')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x57be('0x63')]=0x0;this[_0x57be('0x64')]=0x0;this[_0x57be('0x65')]=0x0;this[_0x57be('0x66')]=_0x41d03b['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x57be('0x67')]=_0x41d03b[_0x57be('0x68')]||0xa;this[_0x57be('0x69')]=0x0;this[_0x57be('0x6a')]=0x0;this[_0x57be('0x6b')]=0x1;this['erlangCalls']=0x0;this[_0x57be('0x6c')]=0x0;this[_0x57be('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this[_0x57be('0x6e')]=_0x41d03b['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x41d03b['dialRecallInQueue']||![];this[_0x57be('0x6f')]=!!_0x41d03b[_0x57be('0x6f')]||![];this[_0x57be('0x70')]=!!_0x41d03b[_0x57be('0x70')]||![];this['dialQueueProject2']=_0x41d03b['dialQueueProject2']||undefined;this[_0x57be('0x71')]=_0x41d03b[_0x57be('0x71')]||![];this[_0x57be('0x72')]=_0x41d03b['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x41d03b['monitor_format']]?monitorFormat[_0x41d03b['monitor_format']]:undefined;this['mandatoryDisposition']=_0x41d03b[_0x57be('0x73')]||![];this['mandatoryDispositionPause']=_0x41d03b[_0x57be('0x74')]?_0x41d03b[_0x57be('0x74')]:undefined;}module[_0x57be('0x75')]=VoiceQueue; \ No newline at end of file +var _0x7583=['dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','busy','invalid','unavailable','ringing','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated'];(function(_0x48fbd2,_0xc69e3f){var _0x22d60e=function(_0x52c1d7){while(--_0x52c1d7){_0x48fbd2['push'](_0x48fbd2['shift']());}};_0x22d60e(++_0xc69e3f);}(_0x7583,0x1c1));var _0x3758=function(_0x2040dd,_0x156a63){_0x2040dd=_0x2040dd-0x0;var _0x27688f=_0x7583[_0x2040dd];return _0x27688f;};'use strict';var statusDesc=[_0x3758('0x0'),'not_inuse','inuse',_0x3758('0x1'),_0x3758('0x2'),_0x3758('0x3'),_0x3758('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':'wav','wav49':_0x3758('0x5'),'gsm':_0x3758('0x6')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x3758('0x7')};function VoiceQueue(_0x3637e4){this['id']=_0x3637e4['id']||0x0;this[_0x3758('0x8')]=_0x3637e4[_0x3758('0x8')]||'';this[_0x3758('0x9')]=_0x3637e4[_0x3758('0x9')]||'';this[_0x3758('0xa')]=_0x3637e4[_0x3758('0xa')]||_0x3758('0xb');this[_0x3758('0xc')]=0x0;this[_0x3758('0xd')]=0x0;this[_0x3758('0xe')]=0x0;this[_0x3758('0xf')]=0x0;this[_0x3758('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x3758('0x11')]=0x0;this[_0x3758('0x12')]=0x0;this['abandoned']=0x0;this[_0x3758('0x13')]=0x0;this[_0x3758('0x14')]=0x0;this[_0x3758('0x15')]=_0x3637e4[_0x3758('0x15')]||![];this[_0x3758('0x16')]=_0x3637e4['acwTimeout']||0xa;this['autopause']=_0x3637e4[_0x3758('0x17')]||'no';this[_0x3758('0x18')]=!![];this[_0x3758('0x19')]='';this[_0x3758('0x1a')]=0x0;this['temp']=0x0;this[_0x3758('0x1b')]=_0x3637e4[_0x3758('0x1b')]||null;this[_0x3758('0x1c')]=_0x3637e4[_0x3758('0x1c')]?_0x3637e4[_0x3758('0x1c')]:null;this['dialActive']=_0x3637e4[_0x3758('0x1d')];this[_0x3758('0x1e')]=_0x3637e4[_0x3758('0x1e')]||_0x3758('0x1f');this[_0x3758('0x20')]=_0x3637e4[_0x3758('0x20')]||0x0;this[_0x3758('0x21')]=_0x3637e4[_0x3758('0x21')]||0x0;this[_0x3758('0x22')]=_0x3637e4['dialPowerLevel']||0x1;this[_0x3758('0x23')]=_0x3637e4[_0x3758('0x23')]||'dropRate';this[_0x3758('0x24')]=_0x3637e4['dialPredictiveOptimizationPercentage']||0.03;this[_0x3758('0x25')]=_0x3637e4[_0x3758('0x25')]||0x258;this['dialOriginateCallerIdName']=_0x3637e4[_0x3758('0x26')]||_0x3758('0x27');this[_0x3758('0x28')]=_0x3637e4[_0x3758('0x28')]||'anonymous';this['dialOriginateTimeout']=_0x3637e4[_0x3758('0x29')]||0x1e;this['dialQueueOptions']=_0x3637e4['dialQueueOptions']||_0x3758('0x2a');this['dialQueueTimeout']=_0x3637e4[_0x3758('0x2b')]||0x3;this['dialQueueProject']=_0x3637e4[_0x3758('0x2c')]||undefined;this[_0x3758('0x2d')]=_0x3637e4[_0x3758('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x3637e4[_0x3758('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x3637e4[_0x3758('0x2f')]||0x3;this[_0x3758('0x30')]=_0x3637e4[_0x3758('0x30')]||0x96;this[_0x3758('0x31')]=_0x3637e4[_0x3758('0x31')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3637e4[_0x3758('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x3637e4[_0x3758('0x33')]||0x3;this[_0x3758('0x34')]=_0x3637e4[_0x3758('0x34')]||0x96;this[_0x3758('0x35')]=_0x3637e4[_0x3758('0x35')]||0x3;this['dialDropRetryFrequency']=_0x3637e4[_0x3758('0x36')]||0x96;this[_0x3758('0x37')]=_0x3637e4['dialAbandonedMaxRetry']||0x3;this[_0x3758('0x38')]=_0x3637e4[_0x3758('0x38')]||0x96;this[_0x3758('0x39')]=_0x3637e4[_0x3758('0x39')]||0x3;this[_0x3758('0x3a')]=_0x3637e4[_0x3758('0x3a')]||0x96;this[_0x3758('0x3b')]=_0x3637e4[_0x3758('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3637e4[_0x3758('0x3c')]||0x96;this['dialGlobalMaxRetry']=_0x3637e4[_0x3758('0x3d')]||0x4;this[_0x3758('0x3e')]=_0x3637e4[_0x3758('0x3e')]?_0x3637e4[_0x3758('0x3e')]:undefined;this[_0x3758('0x3f')]=_0x3637e4[_0x3758('0x3f')]?_0x3637e4[_0x3758('0x3f')]:undefined;this[_0x3758('0x40')]=_0x3637e4['dialPrefix']||undefined;this['Interval']=_0x3637e4[_0x3758('0x41')]?_0x3637e4[_0x3758('0x41')]:undefined;this[_0x3758('0x42')]=_0x3637e4[_0x3758('0x42')]||'DESC';this[_0x3758('0x43')]=_0x3637e4[_0x3758('0x43')]||undefined;this[_0x3758('0x44')]=_0x3637e4['dialCutDigit']||undefined;this[_0x3758('0x45')]=strategy[_0x3637e4['strategy']]||_0x3758('0x46');this[_0x3758('0x47')]=!![];this[_0x3758('0x48')]=_0x3637e4['dialAMDActive']||![];this[_0x3758('0x49')]=_0x3637e4[_0x3758('0x49')];this[_0x3758('0x4a')]=_0x3637e4['dialAMDGreeting'];this[_0x3758('0x4b')]=_0x3637e4[_0x3758('0x4b')];this[_0x3758('0x4c')]=_0x3637e4[_0x3758('0x4c')];this['dialAMDMinWordLength']=_0x3637e4['dialAMDMinWordLength'];this[_0x3758('0x4d')]=_0x3637e4[_0x3758('0x4d')];this['dialAMDMaximumNumberOfWords']=_0x3637e4[_0x3758('0x4e')];this['dialAMDSilenceThreshold']=_0x3637e4[_0x3758('0x4f')];this[_0x3758('0x50')]=_0x3637e4['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x3758('0x51')]=0x0;this[_0x3758('0x52')]=_0x3637e4[_0x3758('0x52')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x3758('0x53')]=0x0;this[_0x3758('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x3758('0x55')]=0x0;this[_0x3758('0x56')]=0x0;this[_0x3758('0x57')]=0x0;this[_0x3758('0x58')]=0x0;this[_0x3758('0x59')]=0x0;this[_0x3758('0x5a')]=0x0;this[_0x3758('0x5b')]=0x0;this[_0x3758('0x5c')]=0x0;this[_0x3758('0x5d')]=0x0;this[_0x3758('0x5e')]=undefined;this[_0x3758('0x5f')]=undefined;this[_0x3758('0x60')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x3758('0x61')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x3758('0x62')]=0x0;this[_0x3758('0x63')]=0x0;this[_0x3758('0x64')]=0x0;this[_0x3758('0x65')]=0x0;this[_0x3758('0x66')]=_0x3637e4[_0x3758('0x67')]||0x14;this['predictiveIntervalMinThreshold']=_0x3637e4['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x3758('0x68')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x3758('0x69')]=0x1;this[_0x3758('0x6a')]=0x0;this[_0x3758('0x6b')]=0x0;this[_0x3758('0x6c')]=0x0;this[_0x3758('0x6d')]=0x0;this['dialRecallMeTimeout']=_0x3637e4[_0x3758('0x6e')]||0x1e;this['dialRecallInQueue']=_0x3637e4['dialRecallInQueue']||![];this[_0x3758('0x6f')]=!!_0x3637e4[_0x3758('0x6f')]||![];this[_0x3758('0x70')]=!!_0x3637e4[_0x3758('0x70')]||![];this[_0x3758('0x71')]=_0x3637e4[_0x3758('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x3637e4[_0x3758('0x72')]||![];this[_0x3758('0x73')]=_0x3637e4['dialAgiAfterHangupAgent']||![];this[_0x3758('0x9')]=monitorFormat[_0x3637e4[_0x3758('0x9')]]?monitorFormat[_0x3637e4[_0x3758('0x9')]]:undefined;this[_0x3758('0x74')]=_0x3637e4[_0x3758('0x74')]||![];this[_0x3758('0x75')]=_0x3637e4[_0x3758('0x75')]?_0x3637e4[_0x3758('0x75')]:undefined;}module[_0x3758('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8f2e628..477a7a5 100644 --- a/server/services/ami/model/vtigerAccount.js +++ b/server/services/ami/model/vtigerAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62e6=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x193857,_0x476b7d){var _0x2dbf2a=function(_0x4c5e97){while(--_0x4c5e97){_0x193857['push'](_0x193857['shift']());}};_0x2dbf2a(++_0x476b7d);}(_0x62e6,0x151));var _0x662e=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0x62e6[_0x2f0057];return _0x17f2c3;};'use strict';function VtigerAccount(_0x46761f){this['id']=_0x46761f['id']||0x0;this[_0x662e('0x0')]=_0x46761f[_0x662e('0x0')]||'';this[_0x662e('0x1')]=_0x46761f[_0x662e('0x1')]||'';this[_0x662e('0x2')]=_0x46761f[_0x662e('0x2')]||'';this[_0x662e('0x3')]=_0x46761f[_0x662e('0x3')]||'';this[_0x662e('0x4')]=_0x46761f['serverUrl']||'';this[_0x662e('0x5')]=_0x46761f['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x0012=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0012,0x160));var _0x2001=function(_0x15faf8,_0x393a55){_0x15faf8=_0x15faf8-0x0;var _0x245288=_0x0012[_0x15faf8];return _0x245288;};'use strict';function VtigerAccount(_0xb3eb2a){this['id']=_0xb3eb2a['id']||0x0;this['name']=_0xb3eb2a[_0x2001('0x0')]||'';this['username']=_0xb3eb2a[_0x2001('0x1')]||'';this[_0x2001('0x2')]=_0xb3eb2a[_0x2001('0x2')]||'';this[_0x2001('0x3')]=_0xb3eb2a[_0x2001('0x3')]||'';this[_0x2001('0x4')]=_0xb3eb2a[_0x2001('0x4')]||'';this[_0x2001('0x5')]=_0xb3eb2a[_0x2001('0x5')]||{};}module[_0x2001('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 316dca7..61e4356 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa914=['authType','type','integrationTab','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x439ce1,_0x50e744){var _0x31810d=function(_0x415778){while(--_0x415778){_0x439ce1['push'](_0x439ce1['shift']());}};_0x31810d(++_0x50e744);}(_0xa914,0x1e5));var _0x4a91=function(_0x3e26b8,_0x336ff7){_0x3e26b8=_0x3e26b8-0x0;var _0x41f8cd=_0xa914[_0x3e26b8];return _0x41f8cd;};'use strict';function ZendeskAccount(_0x204cad){this['id']=_0x204cad['id']||0x0;this[_0x4a91('0x0')]=_0x204cad[_0x4a91('0x0')]||'';this[_0x4a91('0x1')]=_0x204cad[_0x4a91('0x1')]||'';this[_0x4a91('0x2')]=_0x204cad[_0x4a91('0x2')]||'';this['token']=_0x204cad[_0x4a91('0x3')]||'';this[_0x4a91('0x4')]=_0x204cad['remoteUri']||'';this[_0x4a91('0x5')]=_0x204cad[_0x4a91('0x5')]||'';this[_0x4a91('0x6')]=_0x204cad[_0x4a91('0x6')]||_0x4a91('0x7');this['serverUrl']=_0x204cad['serverUrl']||'';this[_0x4a91('0x8')]=_0x204cad[_0x4a91('0x8')]||{};}module[_0x4a91('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x7efb=['Configurations','name','password','token','authType','type','integrationTab','serverUrl'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7efb,0x161));var _0xb7ef=function(_0x50dd32,_0x4de5f3){_0x50dd32=_0x50dd32-0x0;var _0x369653=_0x7efb[_0x50dd32];return _0x369653;};'use strict';function ZendeskAccount(_0x455f65){this['id']=_0x455f65['id']||0x0;this[_0xb7ef('0x0')]=_0x455f65[_0xb7ef('0x0')]||'';this['username']=_0x455f65['username']||'';this[_0xb7ef('0x1')]=_0x455f65[_0xb7ef('0x1')]||'';this['token']=_0x455f65[_0xb7ef('0x2')]||'';this['remoteUri']=_0x455f65['remoteUri']||'';this[_0xb7ef('0x3')]=_0x455f65[_0xb7ef('0x3')]||'';this[_0xb7ef('0x4')]=_0x455f65[_0xb7ef('0x4')]||_0xb7ef('0x5');this[_0xb7ef('0x6')]=_0x455f65[_0xb7ef('0x6')]||'';this[_0xb7ef('0x7')]=_0x455f65['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index dfa197d..312db48 100644 --- a/server/services/ami/model/zohoAccount.js +++ b/server/services/ami/model/zohoAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc269=['code','refreshToken','Configurations','exports','name','description','host','zone','clientSecret','serverUrl'];(function(_0x451997,_0x2c73c4){var _0x183d0d=function(_0x5e184b){while(--_0x5e184b){_0x451997['push'](_0x451997['shift']());}};_0x183d0d(++_0x2c73c4);}(_0xc269,0x1d0));var _0x9c26=function(_0x2deefd,_0x4c110f){_0x2deefd=_0x2deefd-0x0;var _0x5e649e=_0xc269[_0x2deefd];return _0x5e649e;};'use strict';function ZohoAccount(_0x12dc07){this['id']=_0x12dc07['id']||0x0;this[_0x9c26('0x0')]=_0x12dc07['name']||'';this['description']=_0x12dc07[_0x9c26('0x1')]||'';this[_0x9c26('0x2')]=_0x12dc07[_0x9c26('0x2')]||'';this['zone']=_0x12dc07[_0x9c26('0x3')]||'';this['clientId']=_0x12dc07['clientId']||'';this[_0x9c26('0x4')]=_0x12dc07[_0x9c26('0x4')]||'';this['serverUrl']=_0x12dc07[_0x9c26('0x5')]||'';this[_0x9c26('0x6')]=_0x12dc07[_0x9c26('0x6')]||'';this[_0x9c26('0x7')]=_0x12dc07[_0x9c26('0x7')]||'';this[_0x9c26('0x8')]=_0x12dc07[_0x9c26('0x8')]||{};}module[_0x9c26('0x9')]=ZohoAccount; \ No newline at end of file +var _0xd919=['host','zone','clientId','clientSecret','serverUrl','code','Configurations','exports','name','description'];(function(_0x509083,_0xa6676b){var _0x4b2495=function(_0x2a14f5){while(--_0x2a14f5){_0x509083['push'](_0x509083['shift']());}};_0x4b2495(++_0xa6676b);}(_0xd919,0x102));var _0x9d91=function(_0x5166df,_0xe2472e){_0x5166df=_0x5166df-0x0;var _0x272f9f=_0xd919[_0x5166df];return _0x272f9f;};'use strict';function ZohoAccount(_0x13930c){this['id']=_0x13930c['id']||0x0;this[_0x9d91('0x0')]=_0x13930c[_0x9d91('0x0')]||'';this[_0x9d91('0x1')]=_0x13930c[_0x9d91('0x1')]||'';this[_0x9d91('0x2')]=_0x13930c[_0x9d91('0x2')]||'';this[_0x9d91('0x3')]=_0x13930c[_0x9d91('0x3')]||'';this[_0x9d91('0x4')]=_0x13930c[_0x9d91('0x4')]||'';this[_0x9d91('0x5')]=_0x13930c[_0x9d91('0x5')]||'';this['serverUrl']=_0x13930c[_0x9d91('0x6')]||'';this[_0x9d91('0x7')]=_0x13930c[_0x9d91('0x7')]||'';this['refreshToken']=_0x13930c['refreshToken']||'';this[_0x9d91('0x8')]=_0x13930c['Configurations']||{};}module[_0x9d91('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 9b80933..36da099 100644 --- a/server/services/ami/preview/action.js +++ b/server/services/ami/preview/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x069e=['lodash','moment','string','isNil','uniqueid','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util'];(function(_0x6d9347,_0x4d84d8){var _0x474fe1=function(_0x33ceeb){while(--_0x33ceeb){_0x6d9347['push'](_0x6d9347['shift']());}};_0x474fe1(++_0x4d84d8);}(_0x069e,0x15f));var _0xe069=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x069e[_0x2d4421];return _0x2d3b01;};'use strict';var util=require(_0xe069('0x0'));var _=require(_0xe069('0x1'));var moment=require(_0xe069('0x2'));function checkNameSurname(_0x4b9f17,_0x1a040a,_0x428f10){var _0x50a2ed='';if(!_['isNil'](_0x1a040a)&&_0xe069('0x3')===typeof _0x1a040a){_0x50a2ed+=_0x1a040a;}if(!_[_0xe069('0x4')](_0x428f10)&&_0xe069('0x3')===typeof _0x428f10){_0x50a2ed+='\x20'+_0x428f10;}if(_0x50a2ed!==''){return _0x50a2ed;}return _0x4b9f17;}function Action(_0x598f9b,_0x8395d5,_0x5aeb9e,_0x54099c,_0x4107e9){this[_0xe069('0x5')]=_0x5aeb9e||undefined;this['idContact']=_0x598f9b['id'];this[_0xe069('0x6')]=_0x8395d5[_0xe069('0x7')];this[_0xe069('0x8')]=_0x8395d5['type'];this[_0xe069('0x9')]=_0xe069('0x6');this[_0xe069('0xa')]=![];this['membername']=_['isNil'](_0x598f9b[_0xe069('0xb')])?undefined:_0x598f9b[_0xe069('0xb')]['name'];this[_0xe069('0xc')]=this[_0xe069('0xd')]?util[_0xe069('0xe')](_0xe069('0xf'),this['membername']):_0x54099c||undefined;this[_0xe069('0x10')]=checkNameSurname(_0x598f9b[_0xe069('0x11')][_0xe069('0x12')],_0x598f9b[_0xe069('0x11')][_0xe069('0x13')],_0x598f9b['Contact'][_0xe069('0x14')]);this[_0xe069('0x15')]=_0x598f9b[_0xe069('0x15')]||![];this['calleridnum']=_0x598f9b['Contact'][_0xe069('0x12')];this['scheduledat']=_0x598f9b['scheduledat'];this[_0xe069('0x16')]=_0x598f9b['countbusyretry']||0x0;this[_0xe069('0x17')]=_0x598f9b[_0xe069('0x17')]||0x0;this['countnoanswerretry']=_0x598f9b[_0xe069('0x18')]||0x0;this[_0xe069('0x19')]=(_0x598f9b['countbusyretry']||0x0)+(_0x598f9b['countcongestionretry']||0x0)+(_0x598f9b[_0xe069('0x18')]||0x0)+(_0x598f9b[_0xe069('0x1a')]||0x0)+(_0x598f9b[_0xe069('0x1b')]||0x0)+(_0x598f9b[_0xe069('0x1c')]||0x0)+(_0x598f9b[_0xe069('0x1d')]||0x0)+(_0x598f9b['countagentrejectretry']||0x0);this[_0xe069('0x1a')]=_0x598f9b[_0xe069('0x1a')]||0x0;this[_0xe069('0x1b')]=_0x598f9b['countdropretry']||0x0;this[_0xe069('0x1c')]=_0x598f9b['countabandonedretry']||0x0;this[_0xe069('0x1d')]=_0x598f9b[_0xe069('0x1d')]||0x0;this[_0xe069('0x1e')]=_0x598f9b[_0xe069('0x1e')]||0x0;this[_0xe069('0x1f')]=_0x598f9b['callback'];this['callbackuniqueid']=_0x598f9b[_0xe069('0x20')];this[_0xe069('0x21')]=_0x598f9b[_0xe069('0x21')];this[_0xe069('0x22')]=_0x598f9b[_0xe069('0x22')];this[_0xe069('0x23')]=_0x598f9b[_0xe069('0x23')];this['ListId']=_0x598f9b[_0xe069('0x24')];this[_0xe069('0x25')]=_['isNil'](_0x598f9b['Agent'])?_0x598f9b[_0xe069('0x25')]:_0x598f9b[_0xe069('0xb')]['id'];this['VoiceQueueId']=_0x598f9b[_0xe069('0x26')];this['originatecalleridnum']='';this[_0xe069('0x27')]='';}Action[_0xe069('0x28')][_0xe069('0x29')]=function(){return util[_0xe069('0xe')](_0xe069('0x2a'),this[_0xe069('0x10')],this['number']);};module[_0xe069('0x2b')]=Action; \ No newline at end of file +var _0x5bb8=['membername','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent'];(function(_0x24786e,_0x179471){var _0xb5c2b0=function(_0x34bfeb){while(--_0x34bfeb){_0x24786e['push'](_0x24786e['shift']());}};_0xb5c2b0(++_0x179471);}(_0x5bb8,0xd4));var _0x85bb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5bb8[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x85bb('0x0'));var _=require(_0x85bb('0x1'));var moment=require(_0x85bb('0x2'));function checkNameSurname(_0xa4482f,_0x49d393,_0x464bfb){var _0x7f2917='';if(!_[_0x85bb('0x3')](_0x49d393)&&_0x85bb('0x4')===typeof _0x49d393){_0x7f2917+=_0x49d393;}if(!_[_0x85bb('0x3')](_0x464bfb)&&_0x85bb('0x4')===typeof _0x464bfb){_0x7f2917+='\x20'+_0x464bfb;}if(_0x7f2917!==''){return _0x7f2917;}return _0xa4482f;}function Action(_0x3b0210,_0x240976,_0x5db46d,_0x222d2a,_0x17899e){this[_0x85bb('0x5')]=_0x5db46d||undefined;this['idContact']=_0x3b0210['id'];this[_0x85bb('0x6')]=_0x240976[_0x85bb('0x7')];this[_0x85bb('0x8')]=_0x240976[_0x85bb('0x8')];this[_0x85bb('0x9')]=_0x85bb('0x6');this[_0x85bb('0xa')]=![];this['membername']=_[_0x85bb('0x3')](_0x3b0210[_0x85bb('0xb')])?undefined:_0x3b0210[_0x85bb('0xb')][_0x85bb('0x7')];this[_0x85bb('0xc')]=this[_0x85bb('0xd')]?util['format']('SIP/%s',this[_0x85bb('0xd')]):_0x222d2a||undefined;this[_0x85bb('0xe')]=checkNameSurname(_0x3b0210[_0x85bb('0xf')][_0x85bb('0x10')],_0x3b0210[_0x85bb('0xf')][_0x85bb('0x11')],_0x3b0210[_0x85bb('0xf')][_0x85bb('0x12')]);this[_0x85bb('0x13')]=_0x3b0210[_0x85bb('0x13')]||![];this[_0x85bb('0x14')]=_0x3b0210[_0x85bb('0xf')]['phone'];this['scheduledat']=_0x3b0210[_0x85bb('0x15')];this['countbusyretry']=_0x3b0210[_0x85bb('0x16')]||0x0;this['countcongestionretry']=_0x3b0210[_0x85bb('0x17')]||0x0;this[_0x85bb('0x18')]=_0x3b0210[_0x85bb('0x18')]||0x0;this[_0x85bb('0x19')]=(_0x3b0210['countbusyretry']||0x0)+(_0x3b0210[_0x85bb('0x17')]||0x0)+(_0x3b0210[_0x85bb('0x18')]||0x0)+(_0x3b0210['countnosuchnumberretry']||0x0)+(_0x3b0210[_0x85bb('0x1a')]||0x0)+(_0x3b0210['countabandonedretry']||0x0)+(_0x3b0210[_0x85bb('0x1b')]||0x0)+(_0x3b0210[_0x85bb('0x1c')]||0x0);this['countnosuchnumberretry']=_0x3b0210[_0x85bb('0x1d')]||0x0;this['countdropretry']=_0x3b0210[_0x85bb('0x1a')]||0x0;this['countabandonedretry']=_0x3b0210['countabandonedretry']||0x0;this[_0x85bb('0x1b')]=_0x3b0210[_0x85bb('0x1b')]||0x0;this[_0x85bb('0x1c')]=_0x3b0210['countagentrejectretry']||0x0;this[_0x85bb('0x1e')]=_0x3b0210['callback'];this[_0x85bb('0x1f')]=_0x3b0210[_0x85bb('0x1f')];this[_0x85bb('0x20')]=_0x3b0210[_0x85bb('0x20')];this[_0x85bb('0x21')]=_0x3b0210[_0x85bb('0x21')];this[_0x85bb('0x22')]=_0x3b0210['ContactId'];this[_0x85bb('0x23')]=_0x3b0210[_0x85bb('0x23')];this[_0x85bb('0x24')]=_[_0x85bb('0x3')](_0x3b0210[_0x85bb('0xb')])?_0x3b0210[_0x85bb('0x24')]:_0x3b0210[_0x85bb('0xb')]['id'];this[_0x85bb('0x25')]=_0x3b0210['VoiceQueueId'];this['originatecalleridnum']='';this[_0x85bb('0x26')]='';}Action[_0x85bb('0x27')][_0x85bb('0x28')]=function(){return util[_0x85bb('0x29')](_0x85bb('0x2a'),this[_0x85bb('0xe')],this[_0x85bb('0x2b')]);};module[_0x85bb('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index c83b1fb..9ccd18b 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8958=['Busy','custom:agentbusy','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countglobal','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','phone','trim','getCallerId','callerid','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridnum','extractCalleridNumber','addVariables','variablesAction','[originated][increment]','OriginateError','syncOriginateResponse','actionid','logLookAgent','responsetime','response','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','variables','filterKey','addVariable','keys','value','[syncVarSet][Preview]','inspect','transfererlinkedid','exports','lodash','ioredis','../../../config/logger','preview','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','bind','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','name','active','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','hasOwnProperty','dialMethod','booked','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','actions','queue','pick','UserId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','linkedid','ANSWER','answertime','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','complete','buildObj','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry'];(function(_0xa536ab,_0x34344a){var _0x2d4c47=function(_0xc6eaa3){while(--_0xc6eaa3){_0xa536ab['push'](_0xa536ab['shift']());}};_0x2d4c47(++_0x34344a);}(_0x8958,0x93));var _0x8895=function(_0x366554,_0x245bcb){_0x366554=_0x366554-0x0;var _0x37a290=_0x8958[_0x366554];return _0x37a290;};'use strict';var util=require('util');var _=require(_0x8895('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require('md5');var Redis=require(_0x8895('0x1'));var config=require('../../../config/environment');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var loggerAction=require(_0x8895('0x2'))('actionPreview');var ami=require(_0x8895('0x4'));var rpcDb=require(_0x8895('0x5'));var Action=require(_0x8895('0x6'));var ut=require(_0x8895('0x7'));config[_0x8895('0x8')]=_['defaults'](config[_0x8895('0x8')],{'host':_0x8895('0x9'),'port':0x18eb});var io=require(_0x8895('0xa'))(new Redis(config[_0x8895('0x8')]));var Sequence=function(){};Sequence[_0x8895('0xb')][_0x8895('0xc')]=function(_0x22a12b){this[_0x8895('0xd')]=this[_0x8895('0xd')]?this[_0x8895('0xd')]['finally'](_0x22a12b):_0x22a12b();};function Preview(_0x1cf600){this[_0x8895('0xe')]=new Sequence();this[_0x8895('0xf')]=_0x1cf600[_0x8895('0x10')];this[_0x8895('0x11')]=_0x1cf600[_0x8895('0x11')];this['actions']={};this[_0x8895('0x12')]=_0x1cf600[_0x8895('0x12')];this[_0x8895('0x13')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x8895('0x14')](this));ami['on']('hangup',this[_0x8895('0x15')][_0x8895('0x14')](this));ami['on'](_0x8895('0x16'),this[_0x8895('0x17')][_0x8895('0x14')](this));ami['on']('dialend',this[_0x8895('0x18')][_0x8895('0x14')](this));ami['on'](_0x8895('0x19'),this[_0x8895('0x1a')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1b'),this[_0x8895('0x1c')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1d'),this[_0x8895('0x1e')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1f'),this[_0x8895('0x20')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x3daf43,_0x456282,_0x2d189c){io['to'](_0x3daf43)[_0x8895('0x21')](_0x456282,_0x2d189c);}function emitCampaignPreview(_0x3f7d5a){if(_0x3f7d5a[_0x8895('0x22')]===_0x8895('0x23')){var _0xc1ce17={'id':_0x3f7d5a['id'],'name':_0x3f7d5a['name'],'strategy':_0x3f7d5a[_0x8895('0x24')],'answered':_0x3f7d5a[_0x8895('0x25')],'available':_0x3f7d5a[_0x8895('0x26')],'loggedIn':_0x3f7d5a[_0x8895('0x27')],'pTalking':_0x3f7d5a[_0x8895('0x28')],'sumBillable':_0x3f7d5a['sumBillable'],'sumDuration':_0x3f7d5a['sumDuration'],'sumHoldTime':_0x3f7d5a[_0x8895('0x29')]||0x0,'talking':_0x3f7d5a[_0x8895('0x2a')],'total':_0x3f7d5a[_0x8895('0x2b')],'type':_0x3f7d5a[_0x8895('0x22')],'unmanaged':_0x3f7d5a['unmanaged'],'abandoned':_0x3f7d5a[_0x8895('0x2c')],'waiting':_0x3f7d5a[_0x8895('0x2d')],'loggedInDb':_0x3f7d5a[_0x8895('0x2e')],'dialActive':_0x3f7d5a['dialActive'],'dialMethod':_0x3f7d5a['dialMethod'],'dialOriginateCallerIdName':_0x3f7d5a[_0x8895('0x2f')],'dialOriginateCallerIdNumber':_0x3f7d5a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3f7d5a[_0x8895('0x30')],'dialPrefix':_0x3f7d5a[_0x8895('0x31')],'outboundAnswerAgiCallsDay':_0x3f7d5a[_0x8895('0x32')],'outboundAnswerCallsDay':_0x3f7d5a[_0x8895('0x33')],'outboundBlacklistCallsDay':_0x3f7d5a[_0x8895('0x34')],'outboundBusyCallsDay':_0x3f7d5a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3f7d5a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3f7d5a[_0x8895('0x35')],'outboundDropCallsDayCallersExit':_0x3f7d5a[_0x8895('0x36')],'outboundDropCallsDayTimeout':_0x3f7d5a[_0x8895('0x37')],'outboundNoAnswerCallsDay':_0x3f7d5a[_0x8895('0x38')],'outboundNoSuchCallsDay':_0x3f7d5a[_0x8895('0x39')],'outboundOriginateFailureCallsDay':_0x3f7d5a['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3f7d5a['outboundReCallsDay'],'outboundRejectCallsDay':_0x3f7d5a[_0x8895('0x3a')],'outboundUnknownCallsDay':_0x3f7d5a[_0x8895('0x3b')],'outboundAbandonedCallsDay':_0x3f7d5a[_0x8895('0x3c')],'predictiveIntervalAnsweredCalls':_0x3f7d5a[_0x8895('0x3d')],'predictiveIntervalAvgHoldtime':_0x3f7d5a[_0x8895('0x3e')],'predictiveIntervalAvgTalktime':_0x3f7d5a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3f7d5a[_0x8895('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x3f7d5a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3f7d5a[_0x8895('0x40')],'predictiveIntervalErlangCallsDroppedCalls':_0x3f7d5a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3f7d5a[_0x8895('0x41')],'predictiveIntervalMultiplicativeFactor':_0x3f7d5a[_0x8895('0x42')],'predictiveIntervalPauses':_0x3f7d5a[_0x8895('0x43')],'predictiveIntervalAvailable':_0x3f7d5a[_0x8895('0x44')],'predictiveIntervalTotalCalls':_0x3f7d5a[_0x8895('0x45')],'message':_0x3f7d5a['message'],'originated':_0x3f7d5a[_0x8895('0x46')],'erlangCalls':_0x3f7d5a[_0x8895('0x47')],'erlangCallToSecond':_0x3f7d5a[_0x8895('0x48')],'erlangAbandonmentRate':_0x3f7d5a[_0x8895('0x49')],'erlangBusyFactor':_0x3f7d5a[_0x8895('0x4a')],'startPredictive':_0x3f7d5a['startPredictive'],'startProgressive':_0x3f7d5a[_0x8895('0x4b')]};if(_0x3f7d5a['Trunk']){_0xc1ce17[_0x8895('0x4c')]={'id':_0x3f7d5a['Trunk']['id'],'name':_0x3f7d5a[_0x8895('0x4c')][_0x8895('0x4d')],'active':_0x3f7d5a[_0x8895('0x4c')][_0x8895('0x4e')],'callerid':_0x3f7d5a[_0x8895('0x4c')]['callerid']};}if(_0x3f7d5a[_0x8895('0x4f')]){_0xc1ce17['Interval']={'id':_0x3f7d5a[_0x8895('0x4f')]['id'],'name':_0x3f7d5a[_0x8895('0x4f')][_0x8895('0x4d')]};}var _0x9297ea=md5(JSON[_0x8895('0x50')](_0xc1ce17));if(_0x3f7d5a[_0x8895('0x51')]!==_0x9297ea){_0x3f7d5a['md5']=_0x9297ea;emit(util[_0x8895('0x52')](_0x8895('0x53'),_0xc1ce17['name']),_0x8895('0x54'),_0xc1ce17);}}}function emitVoiceQueueChannelRemove(_0x54ca09){logger[_0x8895('0x55')](_0x8895('0x56'),JSON['stringify'](_0x54ca09));emit(util[_0x8895('0x52')](_0x8895('0x53'),_0x54ca09['name']),'voice_queue_channel:remove',_0x54ca09);io[_0x8895('0x21')](_0x8895('0x57'),_0x54ca09);}function notSendMessagesQueue(_0x55aacc){if(_0x55aacc[_0x8895('0x58')]){if(_0x55aacc[_0x8895('0x46')]===0x0&&_0x55aacc['pTalking']===0x0){_0x55aacc[_0x8895('0x58')]=![];_0x55aacc[_0x8895('0x26')]=0x0;_0x55aacc[_0x8895('0x59')]=0x0;_0x55aacc[_0x8895('0x5a')]=_0x8895('0x5b');ut[_0x8895('0x5c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x55aacc[_0x8895('0x4d')]+'\x20is\x20not\x20active');}else{_0x55aacc[_0x8895('0x5a')]=_0x8895('0x5d');ut['logger'](_0x8895('0x5e'),_0x55aacc['name']+_0x8895('0x5f'));}emitCampaignPreview(_0x55aacc);}}Preview['prototype']['loopCampaigns']=function(){var _0x51277b=this;setInterval(function(){_0x51277b['syncCampaigns']();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x447ed6=this[_0x8895('0xf')];this['clockClearZombieChannels']+=0x1;for(var _0x4835d7 in _0x447ed6){if(_0x447ed6[_0x8895('0x60')](_0x4835d7)&&(_0x447ed6[_0x4835d7][_0x8895('0x61')]==='preview'||_0x447ed6[_0x4835d7][_0x8895('0x61')]===_0x8895('0x62'))&&_0x447ed6[_0x4835d7][_0x8895('0x22')]===_0x8895('0x23')){if(this[_0x8895('0x13')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x447ed6['hasOwnProperty'](_0x4835d7)&&_0x447ed6[_0x4835d7][_0x8895('0x61')]==='preview'&&_0x447ed6[_0x4835d7][_0x8895('0x22')]===_0x8895('0x23')){if(_0x447ed6[_0x4835d7][_0x8895('0x63')]){this[_0x8895('0x64')](_0x447ed6[_0x4835d7]);if(_0x447ed6[_0x4835d7]['dialPreviewAutoRecallMe'])this[_0x8895('0x65')](_0x447ed6[_0x4835d7]);}else{notSendMessagesQueue(_0x447ed6[_0x4835d7]);}}}};Preview[_0x8895('0xb')][_0x8895('0x66')]=function(_0x167302){var _0x2d585c=this;this[_0x8895('0xe')][_0x8895('0xc')](function(){if(!_[_0x8895('0x67')](_0x2d585c['actions'][_0x167302])){loggerAction[_0x8895('0x55')](_0x8895('0x68'),_0x167302,'Queue',_0x2d585c[_0x8895('0x69')][_0x167302]['queue'],'originated:\x20',JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302]['queue']][_0x8895('0x46')]),'pTalking:\x20',JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]][_0x8895('0x28')]),JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0x69')][_0x167302]['dialAnswer']),JSON['stringify'](_[_0x8895('0x6b')](_0x2d585c[_0x8895('0x69')][_0x167302],['contactId',_0x8895('0x6c'),'VoiceQueueId','ListId'])));return ami[_0x8895('0x6d')]({'action':'status','channel':_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6e')]})[_0x8895('0x6f')](function(_0x459e1a){if(_0x459e1a[_0x8895('0x5a')]===_0x8895('0x70')){setTimeout(function(){if(_0x2d585c[_0x8895('0x69')][_0x167302]){ut[_0x8895('0x71')](_0x2d585c['campaignsPreview'][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]],_0x8895('0x72'));if(_0x2d585c['actions'][_0x167302][_0x8895('0x73')]===!![]){ut[_0x8895('0x74')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]],_0x8895('0x72'));ut[_0x8895('0x75')](_0x8895('0x76')+_0x167302,_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]);}ut['loggerError'](_0x8895('0x77')+_0x167302,_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]);delete _0x2d585c[_0x8895('0x69')][_0x167302];}},0x2328);}});}});};Preview[_0x8895('0xb')]['clearZombieChannels']=function(){var _0x1b3c99=this;loggerAction[_0x8895('0x55')](_0x8895('0x78'),_[_0x8895('0x79')](this[_0x8895('0x69')]));for(var _0x58dd6c in this[_0x8895('0x69')]){if(_0x1b3c99[_0x8895('0x69')][_0x8895('0x60')](_0x58dd6c)){_0x1b3c99['clearZombieChannel'](_0x58dd6c);}}};Preview[_0x8895('0xb')][_0x8895('0x65')]=function(_0x2c777b){var _0x4ec8eb=this;rpcDb[_0x8895('0x7a')](_0x2c777b['id'],ut[_0x8895('0x7b')](this['agents']))[_0x8895('0x7c')](function(_0x26f68c){if(!_['isNil'](_0x26f68c)){for(var _0x2f990a=0x0;_0x2f990a<_0x26f68c[_0x8895('0x7d')];_0x2f990a+=0x1){if(ut[_0x8895('0x7e')](_0x26f68c[_0x2f990a][_0x8895('0x7f')])<_0x2c777b['dialRecallMeTimeout']*0x3c){if(_0x26f68c[_0x2f990a]['Agent']&&!_0x26f68c[_0x2f990a][_0x8895('0x80')][_0x8895('0x81')]){_0x4ec8eb[_0x8895('0x82')](_0x26f68c[_0x2f990a]['id'])['then'](ut[_0x8895('0x83')](_0x8895('0x84')))['catch'](ut[_0x8895('0x83')]('[RecallMe]'));}else{rpcDb[_0x8895('0x85')](_0x26f68c[_0x2f990a]['id']);}}else{var _0x2bd955=new Action(_0x26f68c[_0x2f990a],_0x2c777b);_0x2bd955[_0x8895('0x86')]=moment()[_0x8895('0x52')](_0x8895('0x87'));_0x2c777b['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x2bd955,0x17,_0x8895('0x88'));if(_0x2c777b[_0x8895('0x89')]){rpcDb['rescheduleContactInQueue'](ut[_0x8895('0x8a')](_0x26f68c[_0x2f990a]));rpcDb[_0x8895('0x8b')](_0x2bd955,_0x8895('0x8c'));}else{ut[_0x8895('0x8d')](_0x2bd955,0x16,'RecallFailedTimeout');rpcDb[_0x8895('0x8b')](_0x2bd955,_0x8895('0x8e'));rpcDb[_0x8895('0x8f')](_0x2bd955,_0x8895('0x8e'));}}}}})[_0x8895('0x6f')](ut[_0x8895('0x83')](_0x8895('0x90')));};Preview[_0x8895('0xb')][_0x8895('0x64')]=function(_0x21c7bb){_0x21c7bb[_0x8895('0x58')]=!![];if(ut[_0x8895('0x91')](_0x21c7bb[_0x8895('0x27')])){_0x21c7bb[_0x8895('0x5a')]=_0x8895('0x92');}else if(!ut['isActive'](_0x21c7bb['dialActive'])){_0x21c7bb['message']=_0x8895('0x5b');}else if(!this[_0x8895('0x93')](_0x21c7bb[_0x8895('0x4c')])){if(!this[_0x8895('0x93')](_0x21c7bb[_0x8895('0x94')])){_0x21c7bb['message']=_0x8895('0x95');}else{_0x21c7bb[_0x8895('0x5a')]='ACTIVE';}}else{_0x21c7bb[_0x8895('0x5a')]=_0x8895('0x96');}emitCampaignPreview(_0x21c7bb);};Preview[_0x8895('0xb')][_0x8895('0x97')]=function(_0x3ee89e,_0x526ac9,_0x6440ea){var _0x3c318c=this;var _0x119624=this[_0x8895('0x69')][_0x526ac9];var _0x113ac4=this[_0x8895('0xf')][_0x119624[_0x8895('0x6a')]];var _0x5e7048;if(_0x113ac4){switch(_0x6440ea){case'1':_0x113ac4[_0x8895('0x39')]+=0x1;_0x119624[_0x8895('0x98')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x0,_0x8895('0x9a'));ami[_0x8895('0x21')](_0x8895('0x9b'),ut['buildObj'](_0x119624,_0x8895('0x9c')));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0x9d'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xa0'));}else{if(_0x119624['countnosuchnumberretry']>=_0x113ac4[_0x8895('0xa1')]){rpcDb['createCustomerFinal'](_0x119624,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0x98'),_0x113ac4['dialNoSuchNumberRetryFrequency']),_0x119624[_0x8895('0xa4')],_0x119624['activeContact']);}}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;case _0x8895('0xa6'):var _0x42d342=moment()[_0x8895('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x119624['responsetime']=_0x42d342;_0x119624[_0x8895('0xa7')]=_0x42d342;_0x119624['dialAnswer']=!![];_0x113ac4[_0x8895('0x28')]+=0x1;logger[_0x8895('0x55')]('[syncHangup][talking][increment]',_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],_0x8895('0xaa'),_0x113ac4[_0x8895('0x28')]);ami['emit'](_0x8895('0xab'),ut['buildObj'](_0x119624,'connect',this[_0x8895('0xf')][_0x119624['queue']]));if(_0x113ac4[_0x8895('0xac')]){ami[_0x8895('0x21')](_0x8895('0xad'),ut[_0x8895('0xae')](_0x119624));}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0x119624,_0x8895('0xaf'),this[_0x8895('0xf')][_0x119624[_0x8895('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x8895('0xb0')](_0x119624,_0x8895('0xaf')));_0x113ac4[_0x8895('0x33')]+=0x1;_0x113ac4['total']+=0x1;_0x113ac4[_0x8895('0x25')]+=0x1;ut[_0x8895('0x74')](_0x113ac4,_0x8895('0xb1'));_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut['logCustomer'](_0x119624,0x4,_0x8895('0xb2'));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0xb3'));rpcDb[_0x8895('0x8f')](_0x119624,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x8895('0xb4')](_0x119624);_0x113ac4[_0x8895('0xb5')]+=_0x119624['talktime'];_0x113ac4[_0x8895('0xb6')]+=_0x119624[_0x8895('0xb7')];logger[_0x8895('0x55')](_0x8895('0xb8'),_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],'pTalking:\x20',_0x113ac4[_0x8895('0x28')]);delete this['actions'][_0x3ee89e[_0x8895('0xa5')]];break;case _0x8895('0xb9'):_0x113ac4[_0x8895('0xba')]+=0x1;_0x119624[_0x8895('0xbb')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x5,_0x8895('0xbc'));ami[_0x8895('0x21')](_0x8895('0xbd'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xbe')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0xf,'Global');rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xc0'));}else{if(_0x119624[_0x8895('0xbb')]>=_0x113ac4[_0x8895('0xc1')]){rpcDb['createCustomerFinal'](_0x119624,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xbb'),_0x113ac4[_0x8895('0xc2')]),_0x119624[_0x8895('0xa4')],_0x119624['activeContact']);}}break;case _0x8895('0xc3'):_0x113ac4[_0x8895('0x38')]+=0x1;_0x119624['countnoanswerretry']+=0x1;_0x119624[_0x8895('0xc4')]=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x3,_0x8895('0xc5'));ami[_0x8895('0x21')](_0x8895('0xc6'),ut['buildObj'](_0x119624,_0x8895('0xc7')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xc8'));}else{if(_0x119624['countnoanswerretry']>=_0x113ac4['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xc9'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xca'),_0x113ac4[_0x8895('0xcb')]),_0x119624['unlockAgent'],_0x119624[_0x8895('0xcc')]);}}break;case _0x8895('0xcd'):_0x113ac4[_0x8895('0xce')]+=0x1;_0x119624['countcongestionretry']+=0x1;_0x119624['countglobal']=ut['totalGlobal'](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x8,_0x8895('0xcf'));ami[_0x8895('0x21')](_0x8895('0xd0'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xd1')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,'Global');rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xd2'));}else{if(_0x119624[_0x8895('0xd3')]>=_0x113ac4[_0x8895('0xd4')]){rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xd5'));}else{rpcDb[_0x8895('0xa2')](ut['scheduledAt'](_0x119624,_0x8895('0xd3'),_0x113ac4[_0x8895('0xc2')]),_0x119624[_0x8895('0xa4')],_0x119624[_0x8895('0xcc')]);}}break;case _0x8895('0xd6'):_0x113ac4['outboundRejectCallsDay']+=0x1;_0x119624[_0x8895('0xd7')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x14,_0x8895('0xd8'));ami[_0x8895('0x21')](_0x8895('0xd9'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xda')));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xdb'));if(ut['totalGlobal'](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0x14,_0x8895('0xd8'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xdc'));}else{if(_0x119624['countagentrejectretry']>=_0x113ac4[_0x8895('0xdd')]){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xdc'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xd7'),_0x113ac4['dialAgentRejectRetryFrequency']),_0x119624['unlockAgent'],_0x119624[_0x8895('0xcc')]);}}break;case'ABANDONED':_0x113ac4['outboundAbandonedCallsDay']+=0x1;_0x119624[_0x8895('0xde')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0xb,_0x8895('0xdf'));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xe0'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xe0'));}else{if(_0x119624[_0x8895('0xe1')]>=_0x113ac4[_0x8895('0xe2')]){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xe0'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,'countabandonedretry',_0x113ac4[_0x8895('0xe3')]),_0x119624[_0x8895('0xa4')],_0x119624[_0x8895('0xcc')]);}}break;case'18':_0x113ac4[_0x8895('0x3b')]+=0x1;_0x119624[_0x8895('0xe4')]+=0x1;_0x119624[_0x8895('0xc4')]=ut[_0x8895('0x99')](_0x119624);ut['logCustomer'](_0x119624,0x12,_0x3ee89e[_0x8895('0xe5')]||_0x3ee89e[_0x8895('0xe6')]);ami[_0x8895('0x21')](_0x8895('0xe7'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xe8')));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0xe9'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut['cloneAction'](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xe9'));}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;case'19':_0x113ac4[_0x8895('0x3b')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x13,_0x3ee89e[_0x8895('0xe5')]||_0x3ee89e[_0x8895('0xe6')]);ami[_0x8895('0x21')](_0x8895('0xe7'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xe8')));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xea'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xea'));}else{rpcDb[_0x8895('0x8f')](_0x119624,'[callProgressDetectingCustomer][machine]');}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;default:if(_0x119624['dialAnswer']){ut['decrementTalkink'](_0x113ac4,_0x8895('0xeb'));ut['loggerError'](_0x8895('0xec')+_0x113ac4['name'],_0x3ee89e);}_0x113ac4['outboundUnknownCallsDay']+=0x1;_0x119624[_0x8895('0xc4')]=ut['totalGlobal'](_0x119624);ut[_0x8895('0x8d')](_0x119624,0xc,_0x3ee89e['cause-txt']||_0x3ee89e[_0x8895('0xe6')]);rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,'Global');rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xed'));}else{rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xed'));}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];}if(!(_0x119624[_0x8895('0x73')]&&_0x6440ea==='16')){ut[_0x8895('0x71')](_0x113ac4,_0x8895('0xee'));logger[_0x8895('0x55')](_0x8895('0xef'),_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],_0x8895('0xf0'),_0x113ac4['originated']);}if(_0x6440ea!==_0x8895('0xa6')){delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];delete this[_0x8895('0x69')][_0x3ee89e['destlinkedid']];}}};Preview[_0x8895('0xb')][_0x8895('0xf1')]=function(_0xf3b3e5,_0x20752d,_0x124e1b){if(_[_0x8895('0xf2')](_0x20752d)&&_0x8895('0xf3')!==typeof _0x20752d){return;}if(_[_0x8895('0xf2')](_0x124e1b)&&_0x8895('0xf3')!==typeof _0x124e1b){return;}switch(_0x124e1b[_0x8895('0xf4')]){case'0':ut[_0x8895('0xf5')](_0xf3b3e5,0x0,_0x8895('0x9a'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xf7'));break;case'3':ut[_0x8895('0xf5')](_0xf3b3e5,0x3,_0x8895('0xc5'));rpcDb['createAgentHistory'](_0xf3b3e5,_0x8895('0xf8'));break;case'5':ut['logAgent'](_0xf3b3e5,0x5,_0x8895('0xbc'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xf9'));break;case'8':ut['logAgent'](_0xf3b3e5,0x8,_0x8895('0xcf'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8895('0xf5')](_0xf3b3e5,0x16,'AnswerAGI');rpcDb[_0x8895('0xf6')](_0xf3b3e5,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xf3b3e5,0xc,_0x124e1b[_0x8895('0xf4')]);rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xfa'));}ut[_0x8895('0x71')](_0x20752d,_0x8895('0xfb'));logger['info'](_0x8895('0xfc'),_0xf3b3e5['uniqueid'],'\x20Queue',_0x20752d[_0x8895('0x4d')],_0x8895('0xf0'),_0x20752d['originated']);delete this[_0x8895('0x69')][_0xf3b3e5[_0x8895('0xa8')]];};Preview[_0x8895('0xb')]['checkInBlack']=function(_0x3816b4,_0x431b18,_0x114200,_0x54e1b5,_0x465c2b){var _0x34a3c9=this;return new BPromise(function(_0x87bfe4,_0x3a1882){if(_[_0x8895('0x67')](_0x431b18)||_[_0x8895('0x67')](_0x431b18[_0x8895('0xfd')])||_[_0x8895('0x67')](_0x431b18['Contact']['phone'])||_[_0x8895('0x67')](_0x431b18['VoiceQueueId'])){_0x3a1882(ut[_0x8895('0x5a')](_0x8895('0xfe'),_0x54e1b5,_0x465c2b));return;}var _0x270a6e=uuid['v4']();var _0x21d14b=_0x34a3c9[_0x8895('0xf')][_0x431b18[_0x8895('0xff')][_0x8895('0x4d')]];var _0x44951a=_0x114200?_0x34a3c9[_0x8895('0x12')][_0x114200]['id']:undefined;_0x34a3c9[_0x8895('0x69')][_0x270a6e]=new Action(_0x431b18,_0x21d14b,_0x270a6e,_0x114200,_0x44951a);var _0x119bf3=_0x34a3c9[_0x8895('0x69')][_0x270a6e];_0x119bf3['unlockAgent']=_0x54e1b5;_0x119bf3[_0x8895('0xcc')]=_0x465c2b;_0x119bf3[_0x8895('0x100')]=_0x114200;if(_[_0x8895('0x101')](_0x3816b4)){_0x34a3c9[_0x8895('0x102')](_0x119bf3,_0x21d14b,_0x431b18,_0x114200)[_0x8895('0x7c')](function(_0x3c68a9){logger[_0x8895('0x55')](_0x8895('0x103'),_0x8895('0x104')+_0x119bf3[_0x8895('0x6a')]+_0x8895('0x105')+_0x119bf3[_0x8895('0x106')],JSON[_0x8895('0x50')](_0x3c68a9));ami[_0x8895('0x21')]('custom:agentcalled',ut[_0x8895('0xb0')](_0x119bf3,'called',_0x34a3c9['campaignsPreview'][_0x119bf3['queue']]));_0x87bfe4(ut[_0x8895('0x5a')](_0x8895('0x107')));})[_0x8895('0x6f')](function(_0x560732){ut[_0x8895('0x5c')](_0x8895('0x108'),_0x560732);_0x3a1882(ut[_0x8895('0x5a')]('Call\x20failed',_0x54e1b5,_0x465c2b));});}else{_0x21d14b[_0x8895('0x34')]+=0x1;ut[_0x8895('0x109')](_0x119bf3);rpcDb[_0x8895('0x10a')](_0x119bf3,'[Blacklist][error]');delete _0x34a3c9[_0x8895('0x69')][_0x270a6e];_0x3a1882(ut[_0x8895('0x5a')](_0x8895('0x10b'),_0x54e1b5,_0x465c2b));}});};Preview[_0x8895('0xb')][_0x8895('0x93')]=function(_0x3273c1){return!_['isNil'](_0x3273c1)&&!_[_0x8895('0x67')](_0x3273c1[_0x8895('0x4d')])&&!_['isNil'](_0x3273c1[_0x8895('0x4e')])&&_0x3273c1[_0x8895('0x4e')]&&!_[_0x8895('0x67')](this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1[_0x8895('0x4d')])])&&!_[_0x8895('0x67')](this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1['name'])]['status'])&&(this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1[_0x8895('0x4d')])][_0x8895('0x10d')]===_0x8895('0x10e')||this[_0x8895('0x11')][util['format']('SIP/%s',_0x3273c1[_0x8895('0x4d')])][_0x8895('0x10d')]===_0x8895('0x10f'));};Preview[_0x8895('0xb')][_0x8895('0x82')]=function(_0x3b465c,_0x28aeb9){var _0x2ff7e6=this;return new BPromise(function(_0x1be275,_0x8f1f00){_0x2ff7e6['execRun'](_0x3b465c,_0x28aeb9)[_0x8895('0x7c')](function(_0x5033d6){_0x1be275(_[_0x8895('0x6b')](_0x5033d6,[_0x8895('0x5a')]));})[_0x8895('0x6f')](function(_0x5e109c){if(_0x5e109c['unlock']){rpcDb['unlockContact'](_0x3b465c);}if(_0x5e109c[_0x8895('0x4e')]){rpcDb['disableContact'](_0x3b465c);}_0x8f1f00(_[_0x8895('0x6b')](_0x5e109c,[_0x8895('0x5a')]));});});};Preview[_0x8895('0xb')]['execRun']=function(_0x3ccf2a,_0x3a348d){var _0x50136b=this;return new BPromise(function(_0x2bd804,_0x564234){var _0x9ce4f5,_0xa87a01;rpcDb[_0x8895('0x110')](_0x3ccf2a)[_0x8895('0x7c')](function(_0x1d5fd7){if(!_['isNil'](_0x1d5fd7[0x0])){_0xa87a01=_0x1d5fd7[0x0]['recallme']?![]:!![];_0x9ce4f5=_0x1d5fd7[0x0][_0x8895('0x111')]?!![]:![];_0x9ce4f5=_0x3a348d?!![]:_0x9ce4f5;}var _0x41d7f9=_0x50136b[_0x8895('0x112')](_0x1d5fd7);if(_0x41d7f9[_0x8895('0x113')]){rpcDb[_0x8895('0x114')](_[_0x8895('0x6b')](_0x1d5fd7[0x0],['VoiceQueueId','Contact.phone']))[_0x8895('0x7c')](function(_0x3a6226){_0x50136b[_0x8895('0x115')](_0x3a6226,_0x1d5fd7[0x0],_0x3a348d,_0xa87a01,_0x9ce4f5)[_0x8895('0x7c')](function(_0x448496){_0x2bd804(_0x448496);})['catch'](function(_0x50baed){_0x564234(_0x50baed);});})[_0x8895('0x6f')](function(_0x4f0a55){ut['logger'](_0x8895('0x116'),_0x4f0a55);_0x564234(ut[_0x8895('0x5a')]('Call\x20unsuccessful',_0xa87a01,_0x9ce4f5));});}else{_0x564234(ut[_0x8895('0x5a')](_0x41d7f9['message'],_0xa87a01,_0x9ce4f5));}})[_0x8895('0x6f')](function(_0x242a19){ut[_0x8895('0x5c')](_0x8895('0x117'),_0x242a19);_0x564234(ut[_0x8895('0x5a')](_0x8895('0x118'),![],!![]));});});};Preview['prototype'][_0x8895('0x112')]=function(_0x3ecc83){if(_[_0x8895('0x67')](_0x3ecc83)||_[_0x8895('0x101')](_0x3ecc83)||!_[_0x8895('0x67')](_0x3ecc83[0x0][_0x8895('0x80')])&&_['isNil'](_0x3ecc83[0x0][_0x8895('0x80')][_0x8895('0x4d')])){ut[_0x8895('0x5c')](_0x8895('0x119'),_0x3ecc83);return{'isValid':![],'message':_0x8895('0x11a')};}var _0x57230f=this['campaignsPreview'][_0x3ecc83[0x0]['Queue'][_0x8895('0x4d')]];_0x57230f[_0x8895('0x5a')]=_0x8895('0x96');if(_['isNil'](_0x57230f)){ut['logger'](_0x8895('0x11b'),_0x57230f);return{'isValid':![],'message':_0x8895('0x11c')};}if(!this[_0x8895('0x93')](_0x57230f[_0x8895('0x4c')])){ut[_0x8895('0x5c')](_0x8895('0x11d'),'campaign\x20Name:\x20'+_0x57230f['name']+_0x8895('0x11e'));if(!this[_0x8895('0x93')](_0x57230f['TrunkBackup'])){ut[_0x8895('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x57230f['name']+_0x8895('0x11f'));return{'isValid':![],'message':_0x8895('0x120')};}}if(!ut[_0x8895('0x121')](_0x57230f['dialActive'])){ut[_0x8895('0x5c')]('[Preview][validateContact][Campaign\x20Active]',_0x57230f[_0x8895('0x4d')]+_0x8895('0x122'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x57230f[_0x8895('0x4d')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x8895('0x123')};};Preview[_0x8895('0xb')][_0x8895('0x102')]=function(_0x20f05c,_0x5eca7f,_0x4036ab,_0x4bf06a){var _0x2f2490=this;return new BPromise(function(_0x28506a,_0x30baea){var _0x2ecc8b=_0x20f05c[_0x8895('0xa8')];var _0x1f5eb7=_0x2f2490[_0x8895('0x93')](_0x5eca7f[_0x8895('0x4c')])?util[_0x8895('0x52')](_0x8895('0x124'),_0x5eca7f[_0x8895('0x4c')]['name'],_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x31')])?'':_0x5eca7f[_0x8895('0x31')]['trim']()||'',_0x5eca7f[_0x8895('0x125')]>0x0?_0x4036ab[_0x8895('0xfd')]['phone'][_0x8895('0x126')](_0x5eca7f[_0x8895('0x125')]):_0x4036ab[_0x8895('0xfd')][_0x8895('0x127')]):util[_0x8895('0x52')](_0x8895('0x124'),_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x94')])?_0x5eca7f[_0x8895('0x4c')]['name']:_0x5eca7f['TrunkBackup'][_0x8895('0x4d')],_['isNil'](_0x5eca7f[_0x8895('0x31')])?'':_0x5eca7f[_0x8895('0x31')][_0x8895('0x128')]()||'',_0x5eca7f['dialCutDigit']>0x0?_0x4036ab[_0x8895('0xfd')]['phone'][_0x8895('0x126')](_0x5eca7f[_0x8895('0x125')]):_0x4036ab['Contact'][_0x8895('0x127')]);var _0x30e5a2=_0x2f2490[_0x8895('0x93')](_0x5eca7f[_0x8895('0x4c')])?ut[_0x8895('0x129')](_0x5eca7f['Trunk'][_0x8895('0x12a')],_0x5eca7f[_0x8895('0x2f')],_0x5eca7f['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x5eca7f[_0x8895('0x12b')],_0x5eca7f['dialRandomLastDigitCallerIdNumber']):_0x5eca7f[_0x8895('0x12b')]):ut[_0x8895('0x129')](_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x94')])?_0x5eca7f[_0x8895('0x4c')][_0x8895('0x12a')]:_0x5eca7f['TrunkBackup'][_0x8895('0x12a')],_0x5eca7f[_0x8895('0x2f')],_0x5eca7f[_0x8895('0x12c')]>0x0?ut[_0x8895('0x12d')](_0x5eca7f[_0x8895('0x12b')],_0x5eca7f[_0x8895('0x12c')]):_0x5eca7f[_0x8895('0x12b')]);if(_0x30e5a2){_0x20f05c['originatecalleridname']=ut['extractCalleridName'](_0x30e5a2);_0x20f05c[_0x8895('0x12e')]=ut[_0x8895('0x12f')](_0x30e5a2);}var _0x43523c=ut[_0x8895('0x130')](_0x5eca7f,_0x4036ab,_0x1f5eb7,_0x30e5a2,_0x2ecc8b,_0x20f05c);_['merge'](_0x20f05c,ut['toLowerVariables'](_0x43523c));_0x20f05c[_0x8895('0x86')]=moment()[_0x8895('0x52')](_0x8895('0x87'));ami[_0x8895('0x6d')](ut[_0x8895('0x131')](_0x20f05c,_0x5eca7f,_0x43523c,_0x20f05c[_0x8895('0xcc')],_0x4bf06a))['then'](function(_0x4c4148){_0x5eca7f[_0x8895('0x46')]+=0x1;logger[_0x8895('0x55')](_0x8895('0x132'),_0x2ecc8b,_0x8895('0xa9'),_0x5eca7f[_0x8895('0x4d')],_0x8895('0xf0'),_0x5eca7f[_0x8895('0x46')]);_0x28506a(_0x4c4148);})[_0x8895('0x6f')](function(_0x18a523){ut['logAgent'](_0x20f05c,0xe,_0x8895('0x133'));rpcDb[_0x8895('0xf6')](_0x20f05c,'[originateFailure][logOriginateFailure]');_0x30baea(_0x18a523);});});};Preview[_0x8895('0xb')][_0x8895('0x1a')]=function(_0x3ff7fa){if(this[_0x8895('0x69')][_0x3ff7fa[_0x8895('0xa5')]]){this[_0x8895('0x69')][_0x3ff7fa[_0x8895('0xa5')]][_0x8895('0x6e')]=_0x3ff7fa['channel'];}};Preview['prototype'][_0x8895('0x134')]=function(_0xc93e09){var _0x398041=this;var _0xc35be9=this[_0x8895('0x69')][_0xc93e09[_0x8895('0x135')]];if(_0xc35be9){if(_0xc35be9['lookAgent']&&this[_0x8895('0x12')][_0xc35be9[_0x8895('0x100')]]){ut[_0x8895('0x136')](_0xc35be9,this['agents'][_0xc35be9[_0x8895('0x100')]][_0x8895('0x4d')],this[_0x8895('0x12')][_0xc35be9['lookAgent']]['id']);}var _0x1a62b4=_['clone'](_0xc35be9);_0x1a62b4[_0x8895('0x137')]=moment()[_0x8895('0x52')](_0x8895('0x87'));var _0x447dc0=_0x398041[_0x8895('0xf')][_0xc35be9['queue']];if(ut['isFailure'](_0xc93e09[_0x8895('0x138')])){if(_0xc35be9['unlockAgent']){rpcDb[_0x8895('0x139')](_0xc35be9[_0x8895('0x106')]);}if(_0xc35be9[_0x8895('0xcc')]){rpcDb[_0x8895('0x85')](_0xc35be9[_0x8895('0x106')]);}ami[_0x8895('0x21')](_0x8895('0x13a'),ut[_0x8895('0xb0')](_0xc35be9,'rejected',this[_0x8895('0xf')][_0xc35be9[_0x8895('0x6a')]]));this[_0x8895('0xf1')](_0x1a62b4,_0x447dc0,_0xc93e09);}else{_0xc35be9['starttime']=moment()[_0x8895('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x8895('0xf5')](_0x1a62b4,0x4,_0x8895('0xb2'));rpcDb[_0x8895('0xf6')](_0x1a62b4,_0x8895('0x13b'));}}};Preview[_0x8895('0xb')][_0x8895('0x15')]=function(_0x55d290){var _0x1186fa=this;var _0x466d3a=this[_0x8895('0x69')][_0x55d290['linkedid']];var _0x268d3c;if(_0x466d3a){_0x268d3c=this['campaignsPreview'][_0x466d3a[_0x8895('0x6a')]];logger[_0x8895('0x55')](_0x8895('0x13c'),_0x55d290[_0x8895('0xa5')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],_0x8895('0xaa'),_0x268d3c[_0x8895('0x28')]);}if(this[_0x8895('0x69')][_0x55d290[_0x8895('0xa5')]]&&_0x55d290[_0x8895('0xa5')]!==_0x55d290['uniqueid']){if(_0x55d290['cause']==='16'&&this[_0x8895('0x69')][_0x55d290[_0x8895('0xa5')]][_0x8895('0x73')]){this['callProgressDetectingCustomer'](_0x55d290,_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')]);}else if(this['actions'][_0x55d290[_0x8895('0xa5')]]['dialAnswer']){logger[_0x8895('0x55')](_0x8895('0x13e'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],'pTalking:\x20',_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')]);}}else if(_0x466d3a&&_[_0x8895('0x67')](_0x466d3a[_0x8895('0x13f')])&&_0x268d3c[_0x8895('0x140')]&&_0x55d290[_0x8895('0xa5')]===_0x55d290['uniqueid']&&_[_0x8895('0x67')](_0x55d290[_0x8895('0xf4')])&&_0x55d290[_0x8895('0x13d')]==='16'&&_0x55d290[_0x8895('0x141')]==='6'&&_[_0x8895('0xf2')](_0x466d3a[_0x8895('0x142')])){if(_0x466d3a['unlockAgent']){rpcDb['unlockContact'](_0x466d3a[_0x8895('0x106')]);}if(_0x466d3a[_0x8895('0xcc')]){rpcDb[_0x8895('0x85')](_0x466d3a[_0x8895('0x106')]);}_0x55d290[_0x8895('0xf4')]='22';this[_0x8895('0xf1')](_0x466d3a,_0x268d3c,_0x55d290);}else if(_0x466d3a&&_0x466d3a[_0x8895('0x142')]){if(_0x55d290['cause']==='16'&&this['actions'][_0x55d290[_0x8895('0xa5')]]['dialAnswer']){logger[_0x8895('0x55')](_0x8895('0x143'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],'\x20Queue',_0x268d3c[_0x8895('0x4d')],_0x8895('0xaa'),_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290['linkedid'],_0x55d290[_0x8895('0x13d')]);}else if(this[_0x8895('0x69')][_0x55d290['linkedid']][_0x8895('0x73')]){logger[_0x8895('0x55')](_0x8895('0x13e'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],'pTalking:\x20',_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290['linkedid'],_0x55d290[_0x8895('0x13d')]);}}};Preview[_0x8895('0xb')]['syncDialEnd']=function(_0x4c4240){if(this[_0x8895('0x69')][_0x4c4240[_0x8895('0x144')]]&&_0x4c4240[_0x8895('0x144')]!==_0x4c4240[_0x8895('0x145')]){this[_0x8895('0x97')](_0x4c4240,_0x4c4240[_0x8895('0x144')],_0x4c4240[_0x8895('0xe6')]);}};Preview[_0x8895('0xb')]['syncHangupRequest']=function(_0x28ec87){if(this['actions'][_0x28ec87[_0x8895('0xa5')]]&&_0x28ec87[_0x8895('0xa5')]!==_0x28ec87[_0x8895('0xa8')]&&!this[_0x8895('0x69')][_0x28ec87[_0x8895('0xa5')]]['dialAnswer']){if(_0x28ec87[_0x8895('0x13d')]==='1'){this[_0x8895('0x97')](_0x28ec87,_0x28ec87[_0x8895('0xa5')],_0x28ec87[_0x8895('0x13d')]);}}};Preview[_0x8895('0xb')]['addVariable']=function(_0x419702,_0x3a7d70,_0x4b937f){if(this['actions'][_0x419702]){if(_[_0x8895('0x67')](this[_0x8895('0x69')][_0x419702][_0x8895('0x146')])){this[_0x8895('0x69')][_0x419702][_0x8895('0x146')]={};}this[_0x8895('0x69')][_0x419702][_0x8895('0x146')][_0x3a7d70]=_0x4b937f;}};Preview['prototype'][_0x8895('0x1c')]=function(_0x49928b){try{if(!_[_0x8895('0x67')](_0x49928b)){if(ut[_0x8895('0x147')](_['keys'](_0x49928b['variable'])[0x0])){this[_0x8895('0x148')](_0x49928b[_0x8895('0xa8')],_[_0x8895('0x149')](_0x49928b['variable'])[0x0],_0x49928b[_0x8895('0x14a')]);}}}catch(_0x47837c){logger['error'](_0x8895('0x14b'),util[_0x8895('0x14c')](_0x47837c,{'showHidden':![],'depth':null}));}};Preview[_0x8895('0xb')][_0x8895('0x1e')]=function(_0x592e3b){if(_0x592e3b){if(this[_0x8895('0x69')][_0x592e3b['transfertargetlinkedid']]){this[_0x8895('0x69')][_0x592e3b['transfertargetlinkedid']][_0x8895('0x142')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0xe5a83a){if(_0xe5a83a){if(this[_0x8895('0x69')][_0xe5a83a[_0x8895('0x14d')]]){this[_0x8895('0x69')][_0xe5a83a[_0x8895('0x14d')]][_0x8895('0x142')]=!![];}}};module[_0x8895('0x14e')]=Preview; \ No newline at end of file +var _0xd6d6=['[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','custom:agentconnect','buildObj','acw','buildAcw','custom:agentcomplete','complete','[16]','createCustomerFinal','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','uniqueid','\x20Queue','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','activeContact','CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','lookAgent','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','phone','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','YYYY-MM-DD\x20HH:mm:ss','isFailure','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','blindtransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','booked','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory'];(function(_0x2b1144,_0x1fb2fa){var _0x24591e=function(_0x258e6c){while(--_0x258e6c){_0x2b1144['push'](_0x2b1144['shift']());}};_0x24591e(++_0x1fb2fa);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x137560,_0x2ca4b2){_0x137560=_0x137560-0x0;var _0x11d3c2=_0xd6d6[_0x137560];return _0x11d3c2;};'use strict';var util=require(_0x6d6d('0x0'));var _=require(_0x6d6d('0x1'));var BPromise=require(_0x6d6d('0x2'));var uuid=require(_0x6d6d('0x3'));var moment=require('moment');var md5=require(_0x6d6d('0x4'));var Redis=require(_0x6d6d('0x5'));var config=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var loggerAction=require(_0x6d6d('0x7'))(_0x6d6d('0x9'));var ami=require('../ami');var rpcDb=require(_0x6d6d('0xa'));var Action=require(_0x6d6d('0xb'));var ut=require(_0x6d6d('0xc'));config[_0x6d6d('0xd')]=_[_0x6d6d('0xe')](config[_0x6d6d('0xd')],{'host':_0x6d6d('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x6d6d('0x10')][_0x6d6d('0x11')]=function(_0x23b18a){this[_0x6d6d('0x12')]=this[_0x6d6d('0x12')]?this['tail'][_0x6d6d('0x13')](_0x23b18a):_0x23b18a();};function Preview(_0x158f82){this['sequence']=new Sequence();this['campaignsPreview']=_0x158f82[_0x6d6d('0x14')];this[_0x6d6d('0x15')]=_0x158f82[_0x6d6d('0x15')];this[_0x6d6d('0x16')]={};this[_0x6d6d('0x17')]=_0x158f82[_0x6d6d('0x17')];this[_0x6d6d('0x18')]=0x0;ami['on'](_0x6d6d('0x19'),this['syncOriginateResponse'][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x1b'),this[_0x6d6d('0x1c')][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x1d'),this['syncHangupRequest'][_0x6d6d('0x1a')](this));ami['on']('dialend',this[_0x6d6d('0x1e')][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x1f'),this['syncNewExten']['bind'](this));ami['on'](_0x6d6d('0x20'),this[_0x6d6d('0x21')][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x22'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x6d6d('0x23'),this['syncBlindTransfer'][_0x6d6d('0x1a')](this));this[_0x6d6d('0x24')](this[_0x6d6d('0x25')]);}function emit(_0x450352,_0x40d35b,_0x3242d8){io['to'](_0x450352)[_0x6d6d('0x26')](_0x40d35b,_0x3242d8);}function emitCampaignPreview(_0x230ad7){if(_0x230ad7[_0x6d6d('0x27')]===_0x6d6d('0x28')){var _0x24b10d={'id':_0x230ad7['id'],'name':_0x230ad7[_0x6d6d('0x29')],'strategy':_0x230ad7[_0x6d6d('0x2a')],'answered':_0x230ad7[_0x6d6d('0x2b')],'available':_0x230ad7[_0x6d6d('0x2c')],'loggedIn':_0x230ad7[_0x6d6d('0x2d')],'pTalking':_0x230ad7[_0x6d6d('0x2e')],'sumBillable':_0x230ad7['sumBillable'],'sumDuration':_0x230ad7[_0x6d6d('0x2f')],'sumHoldTime':_0x230ad7[_0x6d6d('0x30')]||0x0,'talking':_0x230ad7[_0x6d6d('0x31')],'total':_0x230ad7[_0x6d6d('0x32')],'type':_0x230ad7[_0x6d6d('0x27')],'unmanaged':_0x230ad7[_0x6d6d('0x33')],'abandoned':_0x230ad7['abandoned'],'waiting':_0x230ad7[_0x6d6d('0x34')],'loggedInDb':_0x230ad7[_0x6d6d('0x35')],'dialActive':_0x230ad7[_0x6d6d('0x36')],'dialMethod':_0x230ad7[_0x6d6d('0x37')],'dialOriginateCallerIdName':_0x230ad7[_0x6d6d('0x38')],'dialOriginateCallerIdNumber':_0x230ad7[_0x6d6d('0x39')],'dialOriginateTimeout':_0x230ad7[_0x6d6d('0x3a')],'dialPrefix':_0x230ad7['dialPrefix'],'outboundAnswerAgiCallsDay':_0x230ad7[_0x6d6d('0x3b')],'outboundAnswerCallsDay':_0x230ad7[_0x6d6d('0x3c')],'outboundBlacklistCallsDay':_0x230ad7['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x230ad7['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x230ad7[_0x6d6d('0x3d')],'outboundDropCallsDayACS':_0x230ad7[_0x6d6d('0x3e')],'outboundDropCallsDayCallersExit':_0x230ad7[_0x6d6d('0x3f')],'outboundDropCallsDayTimeout':_0x230ad7['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x230ad7[_0x6d6d('0x40')],'outboundNoSuchCallsDay':_0x230ad7[_0x6d6d('0x41')],'outboundOriginateFailureCallsDay':_0x230ad7[_0x6d6d('0x42')],'outboundReCallsDay':_0x230ad7[_0x6d6d('0x43')],'outboundRejectCallsDay':_0x230ad7[_0x6d6d('0x44')],'outboundUnknownCallsDay':_0x230ad7[_0x6d6d('0x45')],'outboundAbandonedCallsDay':_0x230ad7[_0x6d6d('0x46')],'predictiveIntervalAnsweredCalls':_0x230ad7[_0x6d6d('0x47')],'predictiveIntervalAvgHoldtime':_0x230ad7[_0x6d6d('0x48')],'predictiveIntervalAvgTalktime':_0x230ad7[_0x6d6d('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x230ad7['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x230ad7[_0x6d6d('0x4a')],'predictiveIntervalErlangCalls':_0x230ad7['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x230ad7[_0x6d6d('0x4b')],'predictiveIntervalHitRate':_0x230ad7[_0x6d6d('0x4c')],'predictiveIntervalMultiplicativeFactor':_0x230ad7[_0x6d6d('0x4d')],'predictiveIntervalPauses':_0x230ad7[_0x6d6d('0x4e')],'predictiveIntervalAvailable':_0x230ad7['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x230ad7[_0x6d6d('0x4f')],'message':_0x230ad7['message'],'originated':_0x230ad7[_0x6d6d('0x50')],'erlangCalls':_0x230ad7[_0x6d6d('0x51')],'erlangCallToSecond':_0x230ad7['erlangCallToSecond'],'erlangAbandonmentRate':_0x230ad7[_0x6d6d('0x52')],'erlangBusyFactor':_0x230ad7[_0x6d6d('0x53')],'startPredictive':_0x230ad7[_0x6d6d('0x54')],'startProgressive':_0x230ad7[_0x6d6d('0x55')]};if(_0x230ad7[_0x6d6d('0x56')]){_0x24b10d[_0x6d6d('0x56')]={'id':_0x230ad7[_0x6d6d('0x56')]['id'],'name':_0x230ad7[_0x6d6d('0x56')][_0x6d6d('0x29')],'active':_0x230ad7[_0x6d6d('0x56')][_0x6d6d('0x57')],'callerid':_0x230ad7[_0x6d6d('0x56')][_0x6d6d('0x58')]};}if(_0x230ad7[_0x6d6d('0x59')]){_0x24b10d['Interval']={'id':_0x230ad7[_0x6d6d('0x59')]['id'],'name':_0x230ad7[_0x6d6d('0x59')][_0x6d6d('0x29')]};}var _0x5e4f38=md5(JSON['stringify'](_0x24b10d));if(_0x230ad7['md5']!==_0x5e4f38){_0x230ad7[_0x6d6d('0x4')]=_0x5e4f38;emit(util[_0x6d6d('0x5a')](_0x6d6d('0x5b'),_0x24b10d['name']),_0x6d6d('0x5c'),_0x24b10d);}}}function emitVoiceQueueChannelRemove(_0x2607c1){logger[_0x6d6d('0x5d')](_0x6d6d('0x5e'),JSON['stringify'](_0x2607c1));emit(util['format']('voice:queue:%s',_0x2607c1[_0x6d6d('0x29')]),_0x6d6d('0x5f'),_0x2607c1);io[_0x6d6d('0x26')](_0x6d6d('0x60'),_0x2607c1);}function notSendMessagesQueue(_0x4e918b){if(_0x4e918b[_0x6d6d('0x61')]){if(_0x4e918b[_0x6d6d('0x50')]===0x0&&_0x4e918b[_0x6d6d('0x2e')]===0x0){_0x4e918b[_0x6d6d('0x61')]=![];_0x4e918b[_0x6d6d('0x2c')]=0x0;_0x4e918b[_0x6d6d('0x62')]=0x0;_0x4e918b['message']=_0x6d6d('0x63');ut[_0x6d6d('0x64')](_0x6d6d('0x65'),_0x4e918b[_0x6d6d('0x29')]+_0x6d6d('0x66'));}else{_0x4e918b[_0x6d6d('0x67')]=_0x6d6d('0x68');ut['logger'](_0x6d6d('0x65'),_0x4e918b[_0x6d6d('0x29')]+_0x6d6d('0x69'));}emitCampaignPreview(_0x4e918b);}}Preview[_0x6d6d('0x10')][_0x6d6d('0x24')]=function(){var _0x5d9268=this;setInterval(function(){_0x5d9268[_0x6d6d('0x6a')]();},0x7cf);};Preview[_0x6d6d('0x10')]['syncCampaigns']=function(){var _0x452de2=this['campaignsPreview'];this[_0x6d6d('0x18')]+=0x1;for(var _0x43c03c in _0x452de2){if(_0x452de2['hasOwnProperty'](_0x43c03c)&&(_0x452de2[_0x43c03c][_0x6d6d('0x37')]===_0x6d6d('0x8')||_0x452de2[_0x43c03c][_0x6d6d('0x37')]===_0x6d6d('0x6b'))&&_0x452de2[_0x43c03c][_0x6d6d('0x27')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x6d6d('0x18')]=0x0;this['clearZombieChannels']();}}if(_0x452de2['hasOwnProperty'](_0x43c03c)&&_0x452de2[_0x43c03c][_0x6d6d('0x37')]===_0x6d6d('0x8')&&_0x452de2[_0x43c03c][_0x6d6d('0x27')]==='outbound'){if(_0x452de2[_0x43c03c][_0x6d6d('0x36')]){this['setMessage'](_0x452de2[_0x43c03c]);if(_0x452de2[_0x43c03c][_0x6d6d('0x6c')])this[_0x6d6d('0x6d')](_0x452de2[_0x43c03c]);}else{notSendMessagesQueue(_0x452de2[_0x43c03c]);}}}};Preview[_0x6d6d('0x10')][_0x6d6d('0x6e')]=function(_0x75f298){var _0x2669f0=this;this[_0x6d6d('0x6f')]['enqueue'](function(){if(!_[_0x6d6d('0x70')](_0x2669f0[_0x6d6d('0x16')][_0x75f298])){loggerAction[_0x6d6d('0x5d')](_0x6d6d('0x71'),_0x75f298,_0x6d6d('0x72'),_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x73')],_0x6d6d('0x74'),JSON[_0x6d6d('0x75')](_0x2669f0['campaignsPreview'][_0x2669f0['actions'][_0x75f298][_0x6d6d('0x73')]][_0x6d6d('0x50')]),_0x6d6d('0x76'),JSON[_0x6d6d('0x75')](_0x2669f0[_0x6d6d('0x25')][_0x2669f0['actions'][_0x75f298][_0x6d6d('0x73')]][_0x6d6d('0x2e')]),JSON[_0x6d6d('0x75')](_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x77')]),JSON[_0x6d6d('0x75')](_[_0x6d6d('0x78')](_0x2669f0[_0x6d6d('0x16')][_0x75f298],[_0x6d6d('0x79'),_0x6d6d('0x7a'),_0x6d6d('0x7b'),_0x6d6d('0x7c')])));return ami['Action']({'action':_0x6d6d('0x7d'),'channel':_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x7e')]})[_0x6d6d('0x7f')](function(_0x340bf9){if(_0x340bf9['message']===_0x6d6d('0x80')){setTimeout(function(){if(_0x2669f0[_0x6d6d('0x16')][_0x75f298]){ut[_0x6d6d('0x81')](_0x2669f0['campaignsPreview'][_0x2669f0['actions'][_0x75f298][_0x6d6d('0x73')]],'[clearZombieChannel]');if(_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x77')]===!![]){ut[_0x6d6d('0x82')](_0x2669f0[_0x6d6d('0x25')][_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x73')]],_0x6d6d('0x83'));ut[_0x6d6d('0x84')](_0x6d6d('0x85')+_0x75f298,_0x2669f0[_0x6d6d('0x16')][_0x75f298]['queue']);}ut[_0x6d6d('0x84')](_0x6d6d('0x86')+_0x75f298,_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x73')]);delete _0x2669f0[_0x6d6d('0x16')][_0x75f298];}},0x2328);}});}});};Preview[_0x6d6d('0x10')][_0x6d6d('0x87')]=function(){var _0x5e5ace=this;loggerAction['info'](_0x6d6d('0x88'),_[_0x6d6d('0x89')](this['actions']));for(var _0x3e98a0 in this[_0x6d6d('0x16')]){if(_0x5e5ace[_0x6d6d('0x16')][_0x6d6d('0x8a')](_0x3e98a0)){_0x5e5ace[_0x6d6d('0x6e')](_0x3e98a0);}}};Preview[_0x6d6d('0x10')][_0x6d6d('0x6d')]=function(_0x1ef7fb){var _0x2abd8c=this;rpcDb[_0x6d6d('0x8b')](_0x1ef7fb['id'],ut[_0x6d6d('0x8c')](this[_0x6d6d('0x17')]))[_0x6d6d('0x8d')](function(_0x2671ec){if(!_[_0x6d6d('0x70')](_0x2671ec)){for(var _0x50d8dd=0x0;_0x50d8dd<_0x2671ec[_0x6d6d('0x8e')];_0x50d8dd+=0x1){if(ut[_0x6d6d('0x8f')](_0x2671ec[_0x50d8dd]['scheduledat'])<_0x1ef7fb[_0x6d6d('0x90')]*0x3c){if(_0x2671ec[_0x50d8dd][_0x6d6d('0x91')]&&!_0x2671ec[_0x50d8dd][_0x6d6d('0x91')][_0x6d6d('0x92')]){_0x2abd8c[_0x6d6d('0x93')](_0x2671ec[_0x50d8dd]['id'])[_0x6d6d('0x8d')](ut[_0x6d6d('0x94')](_0x6d6d('0x95')))[_0x6d6d('0x7f')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x6d6d('0x96')](_0x2671ec[_0x50d8dd]['id']);}}else{var _0x325fe2=new Action(_0x2671ec[_0x50d8dd],_0x1ef7fb);_0x325fe2[_0x6d6d('0x97')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1ef7fb[_0x6d6d('0x43')]+=0x1;ut['logCustomer'](_0x325fe2,0x17,_0x6d6d('0x98'));if(_0x1ef7fb['dialRecallInQueue']){rpcDb[_0x6d6d('0x99')](ut[_0x6d6d('0x9a')](_0x2671ec[_0x50d8dd]));rpcDb[_0x6d6d('0x9b')](_0x325fe2,_0x6d6d('0x9c'));}else{ut[_0x6d6d('0x9d')](_0x325fe2,0x16,_0x6d6d('0x9e'));rpcDb['createCustomerHistory'](_0x325fe2,_0x6d6d('0x9f'));rpcDb['createCustomerFinal'](_0x325fe2,_0x6d6d('0x9f'));}}}}})['catch'](ut[_0x6d6d('0x94')](_0x6d6d('0xa0')));};Preview[_0x6d6d('0x10')][_0x6d6d('0xa1')]=function(_0x29b68b){_0x29b68b[_0x6d6d('0x61')]=!![];if(ut[_0x6d6d('0xa2')](_0x29b68b['loggedIn'])){_0x29b68b['message']=_0x6d6d('0xa3');}else if(!ut['isActive'](_0x29b68b[_0x6d6d('0x36')])){_0x29b68b['message']=_0x6d6d('0x63');}else if(!this[_0x6d6d('0xa4')](_0x29b68b[_0x6d6d('0x56')])){if(!this[_0x6d6d('0xa4')](_0x29b68b[_0x6d6d('0xa5')])){_0x29b68b[_0x6d6d('0x67')]='TRUNK_IS_NOT_REACHABLE';}else{_0x29b68b[_0x6d6d('0x67')]=_0x6d6d('0xa6');}}else{_0x29b68b[_0x6d6d('0x67')]=_0x6d6d('0xa6');}emitCampaignPreview(_0x29b68b);};Preview[_0x6d6d('0x10')][_0x6d6d('0xa7')]=function(_0x30e31f,_0x589d64,_0x3fa820){var _0x4ec43e=this;var _0x2103a1=this[_0x6d6d('0x16')][_0x589d64];var _0x1aa25d=this[_0x6d6d('0x25')][_0x2103a1[_0x6d6d('0x73')]];var _0x1d1d1d;if(_0x1aa25d){switch(_0x3fa820){case'1':_0x1aa25d[_0x6d6d('0x41')]+=0x1;_0x2103a1[_0x6d6d('0xa8')]+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut['totalGlobal'](_0x2103a1);ut['logCustomer'](_0x2103a1,0x0,_0x6d6d('0xaa'));ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x2103a1,_0x6d6d('0xab')));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xac'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,'Global');rpcDb['createCustomerFinal'](_0x1d1d1d,_0x6d6d('0xb0'));}else{if(_0x2103a1['countnosuchnumberretry']>=_0x1aa25d['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x2103a1,_0x6d6d('0xb0'));}else{rpcDb['rescheduleContact'](ut[_0x6d6d('0xb1')](_0x2103a1,'countnosuchnumberretry',_0x1aa25d[_0x6d6d('0xb2')]),_0x2103a1[_0x6d6d('0xb3')],_0x2103a1['activeContact']);}}delete this['actions'][_0x30e31f[_0x6d6d('0xb4')]];break;case _0x6d6d('0xb5'):var _0x26812a=moment()[_0x6d6d('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x2103a1[_0x6d6d('0xb6')]=_0x26812a;_0x2103a1[_0x6d6d('0xb7')]=_0x26812a;_0x2103a1[_0x6d6d('0x77')]=!![];_0x1aa25d[_0x6d6d('0x2e')]+=0x1;logger['info'](_0x6d6d('0xb8'),_0x2103a1['uniqueid'],'\x20Queue',_0x1aa25d['name'],_0x6d6d('0x76'),_0x1aa25d['pTalking']);ami[_0x6d6d('0x26')](_0x6d6d('0xb9'),ut[_0x6d6d('0xba')](_0x2103a1,'connect',this['campaignsPreview'][_0x2103a1[_0x6d6d('0x73')]]));if(_0x1aa25d[_0x6d6d('0xbb')]){ami['emit']('custom:agentConnectPreview',ut[_0x6d6d('0xbc')](_0x2103a1));}break;case'16':ami[_0x6d6d('0x26')](_0x6d6d('0xbd'),ut[_0x6d6d('0xba')](_0x2103a1,_0x6d6d('0xbe'),this[_0x6d6d('0x25')][_0x2103a1[_0x6d6d('0x73')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2103a1,'complete'));_0x1aa25d['outboundAnswerCallsDay']+=0x1;_0x1aa25d['total']+=0x1;_0x1aa25d['answered']+=0x1;ut['decrementTalkink'](_0x1aa25d,_0x6d6d('0xbf'));_0x2103a1[_0x6d6d('0xa9')]=ut[_0x6d6d('0xad')](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0x4,'Answer');rpcDb['createCustomerHistory'](_0x2103a1,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xc1'));rpcDb[_0x6d6d('0xc2')](_0x2103a1);_0x1aa25d[_0x6d6d('0x2f')]+=_0x2103a1['talktime'];_0x1aa25d['sumBillable']+=_0x2103a1[_0x6d6d('0xc3')];logger[_0x6d6d('0x5d')]('[syncHangup][talking][decrement]',_0x2103a1[_0x6d6d('0xc4')],_0x6d6d('0xc5'),_0x1aa25d[_0x6d6d('0x29')],_0x6d6d('0x76'),_0x1aa25d[_0x6d6d('0x2e')]);delete this['actions'][_0x30e31f[_0x6d6d('0xb4')]];break;case'BUSY':_0x1aa25d[_0x6d6d('0xc6')]+=0x1;_0x2103a1['countbusyretry']+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut['totalGlobal'](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0x5,_0x6d6d('0xc7'));ami[_0x6d6d('0x26')](_0x6d6d('0xc8'),ut[_0x6d6d('0xba')](_0x2103a1,_0x6d6d('0xc9')));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xca'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,_0x6d6d('0xcc'));}else{if(_0x2103a1[_0x6d6d('0xcd')]>=_0x1aa25d[_0x6d6d('0xce')]){rpcDb['createCustomerFinal'](_0x2103a1,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6d6d('0xcf')](ut['scheduledAt'](_0x2103a1,_0x6d6d('0xcd'),_0x1aa25d[_0x6d6d('0xd0')]),_0x2103a1['unlockAgent'],_0x2103a1['activeContact']);}}break;case _0x6d6d('0xd1'):_0x1aa25d['outboundNoAnswerCallsDay']+=0x1;_0x2103a1[_0x6d6d('0xd2')]+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut[_0x6d6d('0xad')](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0x3,_0x6d6d('0xd3'));ami[_0x6d6d('0x26')](_0x6d6d('0xd4'),ut[_0x6d6d('0xba')](_0x2103a1,'noanswer'));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xd5'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d['dialGlobalMaxRetry']){_0x1d1d1d=ut['cloneAction'](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,_0x6d6d('0xd6'));}else{if(_0x2103a1['countnoanswerretry']>=_0x1aa25d[_0x6d6d('0xd7')]){rpcDb[_0x6d6d('0xc0')](_0x2103a1,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x6d6d('0xcf')](ut[_0x6d6d('0xb1')](_0x2103a1,_0x6d6d('0xd2'),_0x1aa25d[_0x6d6d('0xd8')]),_0x2103a1[_0x6d6d('0xb3')],_0x2103a1['activeContact']);}}break;case _0x6d6d('0xd9'):_0x1aa25d[_0x6d6d('0x3d')]+=0x1;_0x2103a1['countcongestionretry']+=0x1;_0x2103a1['countglobal']=ut[_0x6d6d('0xad')](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0x8,_0x6d6d('0xda'));ami[_0x6d6d('0x26')]('custom:agentcongestion',ut[_0x6d6d('0xba')](_0x2103a1,'congestion'));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xdb'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,_0x6d6d('0xdc'));}else{if(_0x2103a1[_0x6d6d('0xdd')]>=_0x1aa25d[_0x6d6d('0xde')]){rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xdb'));}else{rpcDb[_0x6d6d('0xcf')](ut[_0x6d6d('0xb1')](_0x2103a1,_0x6d6d('0xdd'),_0x1aa25d[_0x6d6d('0xd0')]),_0x2103a1[_0x6d6d('0xb3')],_0x2103a1[_0x6d6d('0xdf')]);}}break;case _0x6d6d('0xe0'):_0x1aa25d[_0x6d6d('0x44')]+=0x1;_0x2103a1['countagentrejectretry']+=0x1;_0x2103a1['countglobal']=ut[_0x6d6d('0xad')](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0x14,_0x6d6d('0xe1'));ami[_0x6d6d('0x26')](_0x6d6d('0xe2'),ut[_0x6d6d('0xba')](_0x2103a1,_0x6d6d('0xe3')));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xe4'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0x14,_0x6d6d('0xe1'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,_0x6d6d('0xe5'));}else{if(_0x2103a1['countagentrejectretry']>=_0x1aa25d[_0x6d6d('0xe6')]){rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xe5'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2103a1,'countagentrejectretry',_0x1aa25d[_0x6d6d('0xe7')]),_0x2103a1['unlockAgent'],_0x2103a1['activeContact']);}}break;case _0x6d6d('0xe8'):_0x1aa25d[_0x6d6d('0x46')]+=0x1;_0x2103a1[_0x6d6d('0xe9')]+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut[_0x6d6d('0xad')](_0x2103a1);ut['logCustomer'](_0x2103a1,0xb,_0x6d6d('0xea'));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xeb'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut['cloneAction'](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb['createCustomerFinal'](_0x1d1d1d,_0x6d6d('0xeb'));}else{if(_0x2103a1['countabandonedetry']>=_0x1aa25d[_0x6d6d('0xec')]){rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xeb'));}else{rpcDb['rescheduleContact'](ut[_0x6d6d('0xb1')](_0x2103a1,_0x6d6d('0xe9'),_0x1aa25d['dialAbandonedRetryFrequency']),_0x2103a1[_0x6d6d('0xb3')],_0x2103a1[_0x6d6d('0xdf')]);}}break;case'18':_0x1aa25d[_0x6d6d('0x45')]+=0x1;_0x2103a1[_0x6d6d('0xed')]+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut[_0x6d6d('0xad')](_0x2103a1);ut['logCustomer'](_0x2103a1,0x12,_0x30e31f[_0x6d6d('0xee')]||_0x30e31f[_0x6d6d('0xef')]);ami['emit'](_0x6d6d('0xf0'),ut[_0x6d6d('0xba')](_0x2103a1,_0x6d6d('0xf1')));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xf2'));if(ut['totalGlobal'](_0x2103a1)>=_0x1aa25d['dialGlobalMaxRetry']){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,_0x6d6d('0xf2'));}else{rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xf2'));}delete this[_0x6d6d('0x16')][_0x30e31f['linkedid']];break;case'19':_0x1aa25d['outboundUnknownCallsDay']+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut[_0x6d6d('0xad')](_0x2103a1);ut['logCustomer'](_0x2103a1,0x13,_0x30e31f[_0x6d6d('0xee')]||_0x30e31f[_0x6d6d('0xef')]);ami[_0x6d6d('0x26')](_0x6d6d('0xf0'),ut[_0x6d6d('0xba')](_0x2103a1,'amd'));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xf3'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb['createCustomerFinal'](_0x1d1d1d,_0x6d6d('0xf3'));}else{rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xf3'));}delete this[_0x6d6d('0x16')][_0x30e31f[_0x6d6d('0xb4')]];break;default:if(_0x2103a1[_0x6d6d('0x77')]){ut[_0x6d6d('0x82')](_0x1aa25d,_0x6d6d('0xf4'));ut[_0x6d6d('0x84')](_0x6d6d('0xf5')+_0x1aa25d[_0x6d6d('0x29')],_0x30e31f);}_0x1aa25d[_0x6d6d('0x45')]+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut['totalGlobal'](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0xc,_0x30e31f[_0x6d6d('0xee')]||_0x30e31f[_0x6d6d('0xef')]);rpcDb[_0x6d6d('0x9b')](_0x2103a1,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xf6'));}delete this[_0x6d6d('0x16')][_0x30e31f[_0x6d6d('0xb4')]];}if(!(_0x2103a1['dialAnswer']&&_0x3fa820==='16')){ut[_0x6d6d('0x81')](_0x1aa25d,_0x6d6d('0xf7'));logger[_0x6d6d('0x5d')](_0x6d6d('0xf8'),_0x2103a1[_0x6d6d('0xc4')],_0x6d6d('0xc5'),_0x1aa25d[_0x6d6d('0x29')],_0x6d6d('0x74'),_0x1aa25d[_0x6d6d('0x50')]);}if(_0x3fa820!==_0x6d6d('0xb5')){delete this[_0x6d6d('0x16')][_0x30e31f[_0x6d6d('0xb4')]];delete this[_0x6d6d('0x16')][_0x30e31f[_0x6d6d('0xf9')]];}}};Preview[_0x6d6d('0x10')]['callProgressDetectingAgent']=function(_0x23d98a,_0x4cd7d8,_0x5e32ad){if(_[_0x6d6d('0xfa')](_0x4cd7d8)&&_0x6d6d('0xfb')!==typeof _0x4cd7d8){return;}if(_[_0x6d6d('0xfa')](_0x5e32ad)&&'object'!==typeof _0x5e32ad){return;}switch(_0x5e32ad[_0x6d6d('0xfc')]){case'0':ut[_0x6d6d('0xfd')](_0x23d98a,0x0,_0x6d6d('0xaa'));rpcDb[_0x6d6d('0xfe')](_0x23d98a,_0x6d6d('0xff'));break;case'3':ut[_0x6d6d('0xfd')](_0x23d98a,0x3,_0x6d6d('0xd3'));rpcDb[_0x6d6d('0xfe')](_0x23d98a,_0x6d6d('0x100'));break;case'5':ut[_0x6d6d('0xfd')](_0x23d98a,0x5,'Busy');rpcDb['createAgentHistory'](_0x23d98a,_0x6d6d('0x101'));break;case'8':ut[_0x6d6d('0xfd')](_0x23d98a,0x8,_0x6d6d('0xda'));rpcDb[_0x6d6d('0xfe')](_0x23d98a,_0x6d6d('0x102'));break;case'22':ut[_0x6d6d('0xfd')](_0x23d98a,0x16,_0x6d6d('0x103'));rpcDb['createAgentHistory'](_0x23d98a,_0x6d6d('0x104'));break;default:ut[_0x6d6d('0xfd')](_0x23d98a,0xc,_0x5e32ad[_0x6d6d('0xfc')]);rpcDb[_0x6d6d('0xfe')](_0x23d98a,'[callProgressDetectingAgent][logCongestion]');}ut[_0x6d6d('0x81')](_0x4cd7d8,_0x6d6d('0x105'));logger[_0x6d6d('0x5d')]('[originated][decrement][callProgressDetectingAgent]',_0x23d98a[_0x6d6d('0xc4')],_0x6d6d('0xc5'),_0x4cd7d8[_0x6d6d('0x29')],_0x6d6d('0x74'),_0x4cd7d8[_0x6d6d('0x50')]);delete this[_0x6d6d('0x16')][_0x23d98a[_0x6d6d('0xc4')]];};Preview[_0x6d6d('0x10')][_0x6d6d('0x106')]=function(_0xbe6d17,_0x193312,_0x1eafcb,_0x517f2f,_0x2f1b59){var _0x53160d=this;return new BPromise(function(_0x4b61e4,_0x4dc27b){if(_['isNil'](_0x193312)||_['isNil'](_0x193312[_0x6d6d('0x107')])||_['isNil'](_0x193312[_0x6d6d('0x107')]['phone'])||_[_0x6d6d('0x70')](_0x193312[_0x6d6d('0x7b')])){_0x4dc27b(ut['message']('Contact\x20is\x20undefined',_0x517f2f,_0x2f1b59));return;}var _0x23f498=uuid['v4']();var _0x5592fd=_0x53160d[_0x6d6d('0x25')][_0x193312[_0x6d6d('0x72')][_0x6d6d('0x29')]];var _0x53b797=_0x1eafcb?_0x53160d[_0x6d6d('0x17')][_0x1eafcb]['id']:undefined;_0x53160d['actions'][_0x23f498]=new Action(_0x193312,_0x5592fd,_0x23f498,_0x1eafcb,_0x53b797);var _0x38d705=_0x53160d[_0x6d6d('0x16')][_0x23f498];_0x38d705['unlockAgent']=_0x517f2f;_0x38d705['activeContact']=_0x2f1b59;_0x38d705[_0x6d6d('0x108')]=_0x1eafcb;if(_['isEmpty'](_0xbe6d17)){_0x53160d[_0x6d6d('0x109')](_0x38d705,_0x5592fd,_0x193312,_0x1eafcb)['then'](function(_0x3359c5){logger[_0x6d6d('0x5d')](_0x6d6d('0x10a'),'Queue:\x20'+_0x38d705['queue']+_0x6d6d('0x10b')+_0x38d705[_0x6d6d('0x10c')],JSON[_0x6d6d('0x75')](_0x3359c5));ami[_0x6d6d('0x26')](_0x6d6d('0x10d'),ut[_0x6d6d('0xba')](_0x38d705,_0x6d6d('0x10e'),_0x53160d['campaignsPreview'][_0x38d705[_0x6d6d('0x73')]]));_0x4b61e4(ut[_0x6d6d('0x67')](_0x6d6d('0x10f')));})[_0x6d6d('0x7f')](function(_0x2b483d){ut[_0x6d6d('0x64')](_0x6d6d('0x110'),_0x2b483d);_0x4dc27b(ut[_0x6d6d('0x67')](_0x6d6d('0x111'),_0x517f2f,_0x2f1b59));});}else{_0x5592fd['outboundBlacklistCallsDay']+=0x1;ut[_0x6d6d('0x112')](_0x38d705);rpcDb[_0x6d6d('0x113')](_0x38d705,_0x6d6d('0x114'));delete _0x53160d['actions'][_0x23f498];_0x4dc27b(ut['message'](_0x6d6d('0x115'),_0x517f2f,_0x2f1b59));}});};Preview[_0x6d6d('0x10')][_0x6d6d('0xa4')]=function(_0x112ed3){return!_[_0x6d6d('0x70')](_0x112ed3)&&!_[_0x6d6d('0x70')](_0x112ed3[_0x6d6d('0x29')])&&!_[_0x6d6d('0x70')](_0x112ed3[_0x6d6d('0x57')])&&_0x112ed3['active']&&!_['isNil'](this['trunks'][util[_0x6d6d('0x5a')](_0x6d6d('0x116'),_0x112ed3[_0x6d6d('0x29')])])&&!_[_0x6d6d('0x70')](this[_0x6d6d('0x15')][util[_0x6d6d('0x5a')](_0x6d6d('0x116'),_0x112ed3[_0x6d6d('0x29')])][_0x6d6d('0x7d')])&&(this[_0x6d6d('0x15')][util['format']('SIP/%s',_0x112ed3['name'])]['status']===_0x6d6d('0x117')||this['trunks'][util[_0x6d6d('0x5a')]('SIP/%s',_0x112ed3[_0x6d6d('0x29')])][_0x6d6d('0x7d')]==='unmonitored');};Preview['prototype'][_0x6d6d('0x93')]=function(_0xcbb056,_0x1269f3){var _0x1f44e0=this;return new BPromise(function(_0x577754,_0x5a5a4b){_0x1f44e0[_0x6d6d('0x118')](_0xcbb056,_0x1269f3)['then'](function(_0x2e25af){_0x577754(_['pick'](_0x2e25af,[_0x6d6d('0x67')]));})[_0x6d6d('0x7f')](function(_0x23c408){if(_0x23c408[_0x6d6d('0x119')]){rpcDb[_0x6d6d('0x11a')](_0xcbb056);}if(_0x23c408['active']){rpcDb['disableContact'](_0xcbb056);}_0x5a5a4b(_[_0x6d6d('0x78')](_0x23c408,[_0x6d6d('0x67')]));});});};Preview[_0x6d6d('0x10')][_0x6d6d('0x118')]=function(_0x3951e4,_0x1d863e){var _0x23f266=this;return new BPromise(function(_0xd26616,_0x576ef8){var _0x2670e4,_0x29005c;rpcDb[_0x6d6d('0x11b')](_0x3951e4)[_0x6d6d('0x8d')](function(_0x5d169e){if(!_['isNil'](_0x5d169e[0x0])){_0x29005c=_0x5d169e[0x0][_0x6d6d('0x11c')]?![]:!![];_0x2670e4=_0x5d169e[0x0]['recallme']?!![]:![];_0x2670e4=_0x1d863e?!![]:_0x2670e4;}var _0x4acf03=_0x23f266[_0x6d6d('0x11d')](_0x5d169e);if(_0x4acf03['isValid']){rpcDb['checkIsBlackList'](_[_0x6d6d('0x78')](_0x5d169e[0x0],[_0x6d6d('0x7b'),_0x6d6d('0x11e')]))[_0x6d6d('0x8d')](function(_0x523319){_0x23f266[_0x6d6d('0x106')](_0x523319,_0x5d169e[0x0],_0x1d863e,_0x29005c,_0x2670e4)[_0x6d6d('0x8d')](function(_0x25f457){_0xd26616(_0x25f457);})[_0x6d6d('0x7f')](function(_0x49c750){_0x576ef8(_0x49c750);});})[_0x6d6d('0x7f')](function(_0x148766){ut['logger']('[Preview][checkIsBlackList]',_0x148766);_0x576ef8(ut[_0x6d6d('0x67')](_0x6d6d('0x11f'),_0x29005c,_0x2670e4));});}else{_0x576ef8(ut['message'](_0x4acf03[_0x6d6d('0x67')],_0x29005c,_0x2670e4));}})[_0x6d6d('0x7f')](function(_0x3a7c8b){ut[_0x6d6d('0x64')](_0x6d6d('0x120'),_0x3a7c8b);_0x576ef8(ut[_0x6d6d('0x67')](_0x6d6d('0x11f'),![],!![]));});});};Preview[_0x6d6d('0x10')][_0x6d6d('0x11d')]=function(_0x3bd687){if(_[_0x6d6d('0x70')](_0x3bd687)||_[_0x6d6d('0x121')](_0x3bd687)||!_['isNil'](_0x3bd687[0x0][_0x6d6d('0x91')])&&_['isNil'](_0x3bd687[0x0][_0x6d6d('0x91')][_0x6d6d('0x29')])){ut[_0x6d6d('0x64')]('[Preview][validateContact][Empty\x20Contact]',_0x3bd687);return{'isValid':![],'message':'Empty\x20Contact'};}var _0xe718e8=this[_0x6d6d('0x25')][_0x3bd687[0x0][_0x6d6d('0x72')][_0x6d6d('0x29')]];_0xe718e8['message']=_0x6d6d('0xa6');if(_['isNil'](_0xe718e8)){ut[_0x6d6d('0x64')]('[Preview][validateContact][Empty\x20Campaign]',_0xe718e8);return{'isValid':![],'message':_0x6d6d('0x122')};}if(!this[_0x6d6d('0xa4')](_0xe718e8[_0x6d6d('0x56')])){ut['logger'](_0x6d6d('0x123'),'campaign\x20Name:\x20'+_0xe718e8[_0x6d6d('0x29')]+_0x6d6d('0x124'));if(!this['isTrunkReachable'](_0xe718e8[_0x6d6d('0xa5')])){ut['logger'](_0x6d6d('0x123'),_0xe718e8[_0x6d6d('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x6d6d('0x125')};}}if(!ut[_0x6d6d('0x126')](_0xe718e8['dialActive'])){ut[_0x6d6d('0x64')](_0x6d6d('0x127'),_0xe718e8[_0x6d6d('0x29')]+_0x6d6d('0x128'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0xe718e8[_0x6d6d('0x29')]+_0x6d6d('0x128')};}return{'isValid':!![],'message':_0x6d6d('0x129')};};Preview['prototype'][_0x6d6d('0x109')]=function(_0x1afe7a,_0x58c23d,_0x5a586c,_0x49e97f){var _0x253190=this;return new BPromise(function(_0x30f642,_0x3cb53d){var _0x11054e=_0x1afe7a[_0x6d6d('0xc4')];var _0x3204c6=_0x253190[_0x6d6d('0xa4')](_0x58c23d[_0x6d6d('0x56')])?util[_0x6d6d('0x5a')]('SIP/%s/%s%s',_0x58c23d[_0x6d6d('0x56')]['name'],_[_0x6d6d('0x70')](_0x58c23d['dialPrefix'])?'':_0x58c23d[_0x6d6d('0x12a')][_0x6d6d('0x12b')]()||'',_0x58c23d[_0x6d6d('0x12c')]>0x0?_0x5a586c[_0x6d6d('0x107')][_0x6d6d('0x12d')]['substring'](_0x58c23d['dialCutDigit']):_0x5a586c[_0x6d6d('0x107')]['phone']):util[_0x6d6d('0x5a')](_0x6d6d('0x12e'),_[_0x6d6d('0x70')](_0x58c23d['TrunkBackup'])?_0x58c23d[_0x6d6d('0x56')][_0x6d6d('0x29')]:_0x58c23d[_0x6d6d('0xa5')][_0x6d6d('0x29')],_[_0x6d6d('0x70')](_0x58c23d['dialPrefix'])?'':_0x58c23d[_0x6d6d('0x12a')][_0x6d6d('0x12b')]()||'',_0x58c23d[_0x6d6d('0x12c')]>0x0?_0x5a586c[_0x6d6d('0x107')][_0x6d6d('0x12d')]['substring'](_0x58c23d[_0x6d6d('0x12c')]):_0x5a586c['Contact']['phone']);var _0x509aea=_0x253190[_0x6d6d('0xa4')](_0x58c23d['Trunk'])?ut[_0x6d6d('0x12f')](_0x58c23d[_0x6d6d('0x56')][_0x6d6d('0x58')],_0x58c23d['dialOriginateCallerIdName'],_0x58c23d['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x58c23d[_0x6d6d('0x39')],_0x58c23d[_0x6d6d('0x130')]):_0x58c23d[_0x6d6d('0x39')]):ut[_0x6d6d('0x12f')](_[_0x6d6d('0x70')](_0x58c23d[_0x6d6d('0xa5')])?_0x58c23d[_0x6d6d('0x56')][_0x6d6d('0x58')]:_0x58c23d[_0x6d6d('0xa5')]['callerid'],_0x58c23d['dialOriginateCallerIdName'],_0x58c23d[_0x6d6d('0x130')]>0x0?ut[_0x6d6d('0x131')](_0x58c23d[_0x6d6d('0x39')],_0x58c23d['dialRandomLastDigitCallerIdNumber']):_0x58c23d[_0x6d6d('0x39')]);if(_0x509aea){_0x1afe7a[_0x6d6d('0x132')]=ut[_0x6d6d('0x133')](_0x509aea);_0x1afe7a[_0x6d6d('0x134')]=ut[_0x6d6d('0x135')](_0x509aea);}var _0x297c0d=ut[_0x6d6d('0x136')](_0x58c23d,_0x5a586c,_0x3204c6,_0x509aea,_0x11054e,_0x1afe7a);_[_0x6d6d('0x137')](_0x1afe7a,ut['toLowerVariables'](_0x297c0d));_0x1afe7a[_0x6d6d('0x97')]=moment()[_0x6d6d('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x6d6d('0x138')](ut[_0x6d6d('0x139')](_0x1afe7a,_0x58c23d,_0x297c0d,_0x1afe7a[_0x6d6d('0xdf')],_0x49e97f))[_0x6d6d('0x8d')](function(_0x25fe97){_0x58c23d['originated']+=0x1;logger['info'](_0x6d6d('0x13a'),_0x11054e,_0x6d6d('0xc5'),_0x58c23d[_0x6d6d('0x29')],_0x6d6d('0x74'),_0x58c23d[_0x6d6d('0x50')]);_0x30f642(_0x25fe97);})[_0x6d6d('0x7f')](function(_0x33a6b0){ut[_0x6d6d('0xfd')](_0x1afe7a,0xe,_0x6d6d('0x13b'));rpcDb['createAgentHistory'](_0x1afe7a,_0x6d6d('0x13c'));_0x3cb53d(_0x33a6b0);});});};Preview['prototype']['syncNewExten']=function(_0x5b1a34){if(this[_0x6d6d('0x16')][_0x5b1a34[_0x6d6d('0xb4')]]){this[_0x6d6d('0x16')][_0x5b1a34[_0x6d6d('0xb4')]][_0x6d6d('0x7e')]=_0x5b1a34[_0x6d6d('0x7e')];}};Preview[_0x6d6d('0x10')][_0x6d6d('0x13d')]=function(_0x295e50){var _0x3e7fbc=this;var _0x5b2f13=this[_0x6d6d('0x16')][_0x295e50[_0x6d6d('0x13e')]];if(_0x5b2f13){if(_0x5b2f13[_0x6d6d('0x108')]&&this[_0x6d6d('0x17')][_0x5b2f13[_0x6d6d('0x108')]]){ut[_0x6d6d('0x13f')](_0x5b2f13,this[_0x6d6d('0x17')][_0x5b2f13[_0x6d6d('0x108')]][_0x6d6d('0x29')],this[_0x6d6d('0x17')][_0x5b2f13['lookAgent']]['id']);}var _0x2f8e24=_['clone'](_0x5b2f13);_0x2f8e24[_0x6d6d('0xb6')]=moment()[_0x6d6d('0x5a')](_0x6d6d('0x140'));var _0x54fc39=_0x3e7fbc['campaignsPreview'][_0x5b2f13[_0x6d6d('0x73')]];if(ut[_0x6d6d('0x141')](_0x295e50['response'])){if(_0x5b2f13[_0x6d6d('0xb3')]){rpcDb[_0x6d6d('0x11a')](_0x5b2f13[_0x6d6d('0x10c')]);}if(_0x5b2f13[_0x6d6d('0xdf')]){rpcDb[_0x6d6d('0x96')](_0x5b2f13[_0x6d6d('0x10c')]);}ami[_0x6d6d('0x26')](_0x6d6d('0x142'),ut[_0x6d6d('0xba')](_0x5b2f13,_0x6d6d('0x143'),this[_0x6d6d('0x25')][_0x5b2f13['queue']]));this[_0x6d6d('0x144')](_0x2f8e24,_0x54fc39,_0x295e50);}else{_0x5b2f13[_0x6d6d('0x97')]=moment()[_0x6d6d('0x5a')](_0x6d6d('0x140'));ut[_0x6d6d('0xfd')](_0x2f8e24,0x4,'Answer');rpcDb['createAgentHistory'](_0x2f8e24,_0x6d6d('0x145'));}}};Preview[_0x6d6d('0x10')][_0x6d6d('0x1c')]=function(_0x1a87d6){var _0x23d3bf=this;var _0x2a4cf4=this['actions'][_0x1a87d6['linkedid']];var _0x1194f8;if(_0x2a4cf4){_0x1194f8=this[_0x6d6d('0x25')][_0x2a4cf4[_0x6d6d('0x73')]];logger[_0x6d6d('0x5d')](_0x6d6d('0x146'),_0x1a87d6[_0x6d6d('0xb4')],_0x6d6d('0xc5'),_0x1194f8[_0x6d6d('0x29')],'pTalking:\x20',_0x1194f8[_0x6d6d('0x2e')]);}if(this[_0x6d6d('0x16')][_0x1a87d6[_0x6d6d('0xb4')]]&&_0x1a87d6[_0x6d6d('0xb4')]!==_0x1a87d6['uniqueid']){if(_0x1a87d6[_0x6d6d('0x147')]==='16'&&this[_0x6d6d('0x16')][_0x1a87d6[_0x6d6d('0xb4')]][_0x6d6d('0x77')]){this[_0x6d6d('0xa7')](_0x1a87d6,_0x1a87d6['linkedid'],_0x1a87d6['cause']);}else if(this[_0x6d6d('0x16')][_0x1a87d6[_0x6d6d('0xb4')]][_0x6d6d('0x77')]){logger['info']('[syncHangup][talking][cause]',_0x1a87d6[_0x6d6d('0xb4')],_0x1a87d6[_0x6d6d('0x147')],_0x6d6d('0xc5'),_0x1194f8[_0x6d6d('0x29')],'pTalking:\x20',_0x1194f8['pTalking']);this[_0x6d6d('0xa7')](_0x1a87d6,_0x1a87d6[_0x6d6d('0xb4')],_0x1a87d6[_0x6d6d('0x147')]);}}else if(_0x2a4cf4&&_[_0x6d6d('0x70')](_0x2a4cf4[_0x6d6d('0x148')])&&_0x1194f8[_0x6d6d('0x149')]&&_0x1a87d6[_0x6d6d('0xb4')]===_0x1a87d6[_0x6d6d('0xc4')]&&_[_0x6d6d('0x70')](_0x1a87d6[_0x6d6d('0xfc')])&&_0x1a87d6[_0x6d6d('0x147')]==='16'&&_0x1a87d6['channelstate']==='6'&&_[_0x6d6d('0xfa')](_0x2a4cf4[_0x6d6d('0x14a')])){if(_0x2a4cf4['unlockAgent']){rpcDb[_0x6d6d('0x11a')](_0x2a4cf4[_0x6d6d('0x10c')]);}if(_0x2a4cf4[_0x6d6d('0xdf')]){rpcDb[_0x6d6d('0x96')](_0x2a4cf4[_0x6d6d('0x10c')]);}_0x1a87d6[_0x6d6d('0xfc')]='22';this[_0x6d6d('0x144')](_0x2a4cf4,_0x1194f8,_0x1a87d6);}else if(_0x2a4cf4&&_0x2a4cf4[_0x6d6d('0x14a')]){if(_0x1a87d6[_0x6d6d('0x147')]==='16'&&this[_0x6d6d('0x16')][_0x1a87d6['linkedid']]['dialAnswer']){logger['info'](_0x6d6d('0x14b'),_0x1a87d6[_0x6d6d('0xb4')],_0x1a87d6[_0x6d6d('0x147')],'\x20Queue',_0x1194f8[_0x6d6d('0x29')],_0x6d6d('0x76'),_0x1194f8[_0x6d6d('0x2e')]);this['callProgressDetectingCustomer'](_0x1a87d6,_0x1a87d6['linkedid'],_0x1a87d6[_0x6d6d('0x147')]);}else if(this['actions'][_0x1a87d6[_0x6d6d('0xb4')]][_0x6d6d('0x77')]){logger[_0x6d6d('0x5d')](_0x6d6d('0x14c'),_0x1a87d6[_0x6d6d('0xb4')],_0x1a87d6[_0x6d6d('0x147')],_0x6d6d('0xc5'),_0x1194f8[_0x6d6d('0x29')],_0x6d6d('0x76'),_0x1194f8[_0x6d6d('0x2e')]);this['callProgressDetectingCustomer'](_0x1a87d6,_0x1a87d6[_0x6d6d('0xb4')],_0x1a87d6[_0x6d6d('0x147')]);}}};Preview[_0x6d6d('0x10')]['syncDialEnd']=function(_0x3a47d4){if(this['actions'][_0x3a47d4['destlinkedid']]&&_0x3a47d4['destlinkedid']!==_0x3a47d4['destuniqueid']){this['callProgressDetectingCustomer'](_0x3a47d4,_0x3a47d4[_0x6d6d('0xf9')],_0x3a47d4['dialstatus']);}};Preview[_0x6d6d('0x10')][_0x6d6d('0x14d')]=function(_0x44a7ba){if(this[_0x6d6d('0x16')][_0x44a7ba['linkedid']]&&_0x44a7ba[_0x6d6d('0xb4')]!==_0x44a7ba[_0x6d6d('0xc4')]&&!this['actions'][_0x44a7ba['linkedid']][_0x6d6d('0x77')]){if(_0x44a7ba[_0x6d6d('0x147')]==='1'){this['callProgressDetectingCustomer'](_0x44a7ba,_0x44a7ba[_0x6d6d('0xb4')],_0x44a7ba[_0x6d6d('0x147')]);}}};Preview['prototype'][_0x6d6d('0x14e')]=function(_0x263039,_0x3becf6,_0x5a5f4d){if(this[_0x6d6d('0x16')][_0x263039]){if(_[_0x6d6d('0x70')](this[_0x6d6d('0x16')][_0x263039][_0x6d6d('0x14f')])){this[_0x6d6d('0x16')][_0x263039][_0x6d6d('0x14f')]={};}this['actions'][_0x263039][_0x6d6d('0x14f')][_0x3becf6]=_0x5a5f4d;}};Preview[_0x6d6d('0x10')][_0x6d6d('0x21')]=function(_0x48f8ad){try{if(!_[_0x6d6d('0x70')](_0x48f8ad)){if(ut[_0x6d6d('0x150')](_[_0x6d6d('0x151')](_0x48f8ad[_0x6d6d('0x152')])[0x0])){this[_0x6d6d('0x14e')](_0x48f8ad['uniqueid'],_[_0x6d6d('0x151')](_0x48f8ad['variable'])[0x0],_0x48f8ad[_0x6d6d('0x153')]);}}}catch(_0x37015c){logger['error']('[syncVarSet][Preview]',util[_0x6d6d('0x154')](_0x37015c,{'showHidden':![],'depth':null}));}};Preview[_0x6d6d('0x10')][_0x6d6d('0x155')]=function(_0x14cadd){if(_0x14cadd){if(this['actions'][_0x14cadd[_0x6d6d('0x156')]]){this[_0x6d6d('0x16')][_0x14cadd[_0x6d6d('0x156')]][_0x6d6d('0x14a')]=!![];}}};Preview[_0x6d6d('0x10')][_0x6d6d('0x157')]=function(_0x24fce3){if(_0x24fce3){if(this['actions'][_0x24fce3[_0x6d6d('0x158')]]){this[_0x6d6d('0x16')][_0x24fce3['transfererlinkedid']]['transfer']=!![];}}};module[_0x6d6d('0x159')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 55f3cf7..33c0d11 100644 --- a/server/services/ami/preview/rpcDb.js +++ b/server/services/ami/preview/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9398=['bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','exten','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util'];(function(_0x7ecc0,_0x3c5cc5){var _0x5d016b=function(_0x4229ad){while(--_0x4229ad){_0x7ecc0['push'](_0x7ecc0['shift']());}};_0x5d016b(++_0x3c5cc5);}(_0x9398,0x155));var _0x8939=function(_0x155710,_0x3c1337){_0x155710=_0x155710-0x0;var _0x172716=_0x9398[_0x155710];return _0x172716;};'use strict';var util=require(_0x8939('0x0'));var BPromise=require(_0x8939('0x1'));var logger=require(_0x8939('0x2'))(_0x8939('0x3'));var _=require(_0x8939('0x4'));var cmHopper=require(_0x8939('0x5'));var cmHopperFinal=require(_0x8939('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x8939('0x7'));var voiceQueueRt=require(_0x8939('0x8'));var agentReportPreview=require(_0x8939('0x9'));var voiceQueueReport=require(_0x8939('0xa'));function loggerCatch(_0x2032c2){return function(_0x2c2b51){logger[_0x8939('0xb')](_0x2032c2,util['inspect'](_0x2c2b51,{'showHidden':![],'depth':null}));};}function create(_0x309e64){return BPromise[_0x8939('0xc')]()[_0x8939('0xd')](cmHopperHistory[_0x8939('0xe')](_0x309e64))[_0x8939('0xf')](loggerCatch(_0x8939('0x10')));}function createAgent(_0x549df0){return BPromise[_0x8939('0xc')]()[_0x8939('0xd')](agentReportPreview[_0x8939('0xe')](_0x549df0))[_0x8939('0xf')](loggerCatch(_0x8939('0x10')));}function moveContact(_0x183a48){return BPromise[_0x8939('0xc')]()['then'](cmHopper[_0x8939('0x11')](_0x183a48,!![]))[_0x8939('0xf')](loggerCatch(_0x8939('0x12')));}exports['checkIsBlackList']=function(_0x11ca4e){return BPromise[_0x8939('0xc')]()[_0x8939('0xd')](cmHopperBlack[_0x8939('0x13')](_0x11ca4e))[_0x8939('0xf')](loggerCatch(_0x8939('0x14')));};exports[_0x8939('0x15')]=function(_0x87f79a){return BPromise[_0x8939('0xc')]()['then'](cmHopper['getContactPreview'](_0x87f79a))[_0x8939('0xf')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x16738b,_0x4dc658){create(_0x16738b)['catch'](loggerCatch(_0x4dc658));moveContact(_0x16738b)[_0x8939('0xf')](loggerCatch(_0x4dc658));};exports[_0x8939('0x16')]=function(_0x1e9d82,_0x342a1f){createAgent(_0x1e9d82)[_0x8939('0xf')](loggerCatch(_0x342a1f));};exports[_0x8939('0x17')]=function(_0x8172a6,_0x5f2d40){create(_0x8172a6)[_0x8939('0xf')](loggerCatch(_0x5f2d40));};exports[_0x8939('0x18')]=function(_0x35be58,_0x53b682){moveContact(_0x35be58)['catch'](loggerCatch(_0x53b682));};exports[_0x8939('0x19')]=function(_0x42a465,_0x3cb837,_0x5dff9c){if(_0x3cb837){_0x42a465[_0x8939('0x1a')]=null;}if(_0x5dff9c){_0x42a465['active']=![];}return BPromise[_0x8939('0xc')]()[_0x8939('0xd')](cmHopper[_0x8939('0x19')](_0x42a465))[_0x8939('0xf')](loggerCatch(_0x8939('0x1b')));};exports['countReScheduled']=function(_0x30bd37){return BPromise[_0x8939('0xc')]()[_0x8939('0xd')](cmHopper[_0x8939('0x1c')](_0x30bd37))['catch'](loggerCatch(_0x8939('0x1d')));};exports['unlockContact']=function(_0x424bc2){return BPromise['resolve']()['then'](cmHopper['unlockContact']({'UserId':null},_0x424bc2,0x1))[_0x8939('0xf')](loggerCatch(_0x8939('0x1e')));};exports[_0x8939('0x1f')]=function(_0x4db2dc){return BPromise[_0x8939('0xc')]()[_0x8939('0xd')](cmHopper[_0x8939('0x20')]({'active':![]},_0x4db2dc,0x1))[_0x8939('0xf')](loggerCatch(_0x8939('0x21')));};exports[_0x8939('0x22')]=function(_0x3890ce){var _0x1c90a7={};_0x1c90a7[_0x8939('0x23')]=_0x3890ce[_0x8939('0x23')];_0x1c90a7[_0x8939('0x24')]=_0x3890ce[_0x8939('0x24')];_0x1c90a7[_0x8939('0x25')]=_0x3890ce[_0x8939('0x25')];_0x1c90a7[_0x8939('0x26')]=_0x3890ce[_0x8939('0x26')];_0x1c90a7[_0x8939('0x27')]=_0x3890ce['queue'];_0x1c90a7[_0x8939('0x28')]=_0x3890ce[_0x8939('0x29')];_0x1c90a7['queuecallerleaveAt']=_0x3890ce['answertime'];_0x1c90a7[_0x8939('0x2a')]=0x1;_0x1c90a7[_0x8939('0x2b')]=_0x3890ce[_0x8939('0x2c')];_0x1c90a7[_0x8939('0x2d')]=_0x3890ce['membername'];_0x1c90a7[_0x8939('0x2e')]='from-sip';_0x1c90a7[_0x8939('0x2f')]='xcally-motion-preview';_0x1c90a7[_0x8939('0x30')]=0x0;_0x1c90a7[_0x8939('0x31')]=0x1;_0x1c90a7[_0x8939('0x32')]=_0x3890ce[_0x8939('0x33')];_0x1c90a7[_0x8939('0x34')]='COMPLETED';return BPromise[_0x8939('0xc')]()[_0x8939('0xd')](voiceQueueReport['create'](_0x1c90a7))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x8939('0x35')]=function(_0x4a5ae1,_0x1801cd){return BPromise['resolve']()['then'](cmHopper[_0x8939('0x35')](_0x4a5ae1,_0x1801cd))[_0x8939('0xf')](loggerCatch(_0x8939('0x36')));};exports[_0x8939('0x37')]=function(_0x5d7a7a){return BPromise[_0x8939('0xc')]()[_0x8939('0xd')](cmHopper['rescheduleContact'](_0x5d7a7a,!![],!![]))[_0x8939('0xf')](loggerCatch(_0x8939('0x38')));}; \ No newline at end of file +var _0x0f6d=['answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','then','getContactPreview','createAgentHistory','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt'];(function(_0x23ee5e,_0x372ba0){var _0xf78e80=function(_0x54361c){while(--_0x54361c){_0x23ee5e['push'](_0x23ee5e['shift']());}};_0xf78e80(++_0x372ba0);}(_0x0f6d,0x178));var _0xd0f6=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x0f6d[_0x58c20f];return _0x3b0318;};'use strict';var util=require(_0xd0f6('0x0'));var BPromise=require('bluebird');var logger=require(_0xd0f6('0x1'))(_0xd0f6('0x2'));var _=require(_0xd0f6('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xd0f6('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xd0f6('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xd0f6('0x6'));var voiceQueueReport=require(_0xd0f6('0x7'));function loggerCatch(_0x3dc3e6){return function(_0x2ecdd1){logger[_0xd0f6('0x8')](_0x3dc3e6,util[_0xd0f6('0x9')](_0x2ecdd1,{'showHidden':![],'depth':null}));};}function create(_0x6c7f0b){return BPromise[_0xd0f6('0xa')]()['then'](cmHopperHistory[_0xd0f6('0xb')](_0x6c7f0b))[_0xd0f6('0xc')](loggerCatch(_0xd0f6('0xd')));}function createAgent(_0x364bae){return BPromise['resolve']()['then'](agentReportPreview[_0xd0f6('0xb')](_0x364bae))[_0xd0f6('0xc')](loggerCatch(_0xd0f6('0xd')));}function moveContact(_0x24e0ac){return BPromise[_0xd0f6('0xa')]()['then'](cmHopper[_0xd0f6('0xe')](_0x24e0ac,!![]))[_0xd0f6('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xd0f6('0xf')]=function(_0x40ce48){return BPromise[_0xd0f6('0xa')]()[_0xd0f6('0x10')](cmHopperBlack[_0xd0f6('0xf')](_0x40ce48))[_0xd0f6('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xd0f6('0x11')]=function(_0x29f65a){return BPromise['resolve']()['then'](cmHopper[_0xd0f6('0x11')](_0x29f65a))[_0xd0f6('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0xd0f6('0xb')]=function(_0x3d7599,_0x3cb18c){create(_0x3d7599)[_0xd0f6('0xc')](loggerCatch(_0x3cb18c));moveContact(_0x3d7599)[_0xd0f6('0xc')](loggerCatch(_0x3cb18c));};exports[_0xd0f6('0x12')]=function(_0x216a59,_0x513d0f){createAgent(_0x216a59)[_0xd0f6('0xc')](loggerCatch(_0x513d0f));};exports['createCustomerHistory']=function(_0xbd0440,_0x55f080){create(_0xbd0440)[_0xd0f6('0xc')](loggerCatch(_0x55f080));};exports['createCustomerFinal']=function(_0x5834f2,_0xf72a75){moveContact(_0x5834f2)[_0xd0f6('0xc')](loggerCatch(_0xf72a75));};exports[_0xd0f6('0x13')]=function(_0x72dab6,_0x1a6d3c,_0x598d78){if(_0x1a6d3c){_0x72dab6[_0xd0f6('0x14')]=null;}if(_0x598d78){_0x72dab6['active']=![];}return BPromise['resolve']()[_0xd0f6('0x10')](cmHopper[_0xd0f6('0x13')](_0x72dab6))['catch'](loggerCatch(_0xd0f6('0x15')));};exports[_0xd0f6('0x16')]=function(_0x698719){return BPromise[_0xd0f6('0xa')]()['then'](cmHopper[_0xd0f6('0x16')](_0x698719))['catch'](loggerCatch(_0xd0f6('0x17')));};exports[_0xd0f6('0x18')]=function(_0x404646){return BPromise['resolve']()[_0xd0f6('0x10')](cmHopper[_0xd0f6('0x18')]({'UserId':null},_0x404646,0x1))[_0xd0f6('0xc')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x6ee9e8){return BPromise[_0xd0f6('0xa')]()[_0xd0f6('0x10')](cmHopper[_0xd0f6('0x18')]({'active':![]},_0x6ee9e8,0x1))[_0xd0f6('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xd0f6('0x19')]=function(_0x40bb9e){var _0xff354b={};_0xff354b['type']=_0x40bb9e[_0xd0f6('0x1a')];_0xff354b[_0xd0f6('0x1b')]=_0x40bb9e[_0xd0f6('0x1b')];_0xff354b[_0xd0f6('0x1c')]=_0x40bb9e[_0xd0f6('0x1c')];_0xff354b[_0xd0f6('0x1d')]=_0x40bb9e['calleridname'];_0xff354b[_0xd0f6('0x1e')]=_0x40bb9e[_0xd0f6('0x1e')];_0xff354b[_0xd0f6('0x1f')]=_0x40bb9e[_0xd0f6('0x20')];_0xff354b[_0xd0f6('0x21')]=_0x40bb9e['answertime'];_0xff354b[_0xd0f6('0x22')]=0x1;_0xff354b[_0xd0f6('0x23')]=_0x40bb9e[_0xd0f6('0x24')];_0xff354b['connectedlinename']=_0x40bb9e[_0xd0f6('0x25')];_0xff354b[_0xd0f6('0x26')]=_0xd0f6('0x27');_0xff354b[_0xd0f6('0x28')]=_0xd0f6('0x29');_0xff354b[_0xd0f6('0x2a')]=0x0;_0xff354b[_0xd0f6('0x2b')]=0x1;_0xff354b[_0xd0f6('0x2c')]=_0x40bb9e[_0xd0f6('0x25')];_0xff354b[_0xd0f6('0x2d')]=_0xd0f6('0x2e');return BPromise[_0xd0f6('0xa')]()[_0xd0f6('0x10')](voiceQueueReport[_0xd0f6('0x2f')](_0xff354b))['catch'](loggerCatch(_0xd0f6('0x30')));};exports[_0xd0f6('0x31')]=function(_0x7abcc3,_0xa85c7c){return BPromise[_0xd0f6('0xa')]()[_0xd0f6('0x10')](cmHopper[_0xd0f6('0x31')](_0x7abcc3,_0xa85c7c))[_0xd0f6('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x3a1489){return BPromise[_0xd0f6('0xa')]()[_0xd0f6('0x10')](cmHopper[_0xd0f6('0x13')](_0x3a1489,!![],!![]))[_0xd0f6('0xc')](loggerCatch(_0xd0f6('0x32')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index b95e369..6bf32c0 100644 --- a/server/services/ami/preview/util/util.js +++ b/server/services/ami/preview/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d0f=['xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','info','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','uniqueid','originate','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','channelAgent','voice','mandatoryDisposition','buildAcw','interface','not_inuse','status','push','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countnoanswerretry','countglobal','callback','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel'];(function(_0x397758,_0x8301b8){var _0x4d9d99=function(_0x274de4){while(--_0x274de4){_0x397758['push'](_0x397758['shift']());}};_0x4d9d99(++_0x8301b8);}(_0x4d0f,0x9d));var _0xf4d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d0f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf4d0('0x0'));var _=require(_0xf4d0('0x1'));var moment=require(_0xf4d0('0x2'));var logger=require(_0xf4d0('0x3'))(_0xf4d0('0x4'));var ipAgi=process[_0xf4d0('0x5')]['XCALLY_IP_AGI']||_0xf4d0('0x6');function getSeconds(_0x1c77ef,_0x158a01){var _0x742852=moment(_0x1c77ef)['milliseconds'](0x0);var _0x5648fb=moment(_0x158a01)[_0xf4d0('0x7')](0x0);return _0x742852[_0xf4d0('0x8')](_0x5648fb,_0xf4d0('0x9'));}exports[_0xf4d0('0xa')]=function(_0x6fa0b8){return function(_0x3e16d){logger['error'](_0x6fa0b8,util[_0xf4d0('0xb')](_0x3e16d,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4a6cd1,_0x51cd4a){logger[_0xf4d0('0xc')](_0x4a6cd1,util[_0xf4d0('0xb')](_0x51cd4a,{'showHidden':![],'depth':null}));};exports[_0xf4d0('0xd')]=function(_0x39f9c6,_0x7f28f5){logger[_0xf4d0('0xe')](_0x39f9c6,util[_0xf4d0('0xb')](_0x7f28f5,{'showHidden':![],'depth':null}));};exports[_0xf4d0('0xf')]=function(_0x436c16){return function(_0x52887c){logger[_0xf4d0('0xc')](_0x436c16,util[_0xf4d0('0xb')](_0x52887c,{'showHidden':![],'depth':null}));};};exports[_0xf4d0('0x10')]=function(_0x448ec0,_0x399167,_0x7342bc){return{'message':_0x448ec0,'unlock':_0x399167,'active':_0x7342bc};};exports[_0xf4d0('0x11')]=function(_0x442ad3,_0x2afdab,_0x45814a){if(!_[_0xf4d0('0x12')](_0x45814a)&&_0xf4d0('0x13')===typeof _0x45814a&&!_[_0xf4d0('0x14')](_0x45814a)){if(!_[_0xf4d0('0x12')](_0x2afdab)&&'string'===typeof _0x2afdab&&!_[_0xf4d0('0x14')](_0x2afdab)){return util['format'](_0xf4d0('0x15'),_0x2afdab,_0x45814a);}return util[_0xf4d0('0x16')]('\x22%s\x22\x20<%s>',_0x45814a,_0x45814a);}if(!_['isUndefined'](_0x442ad3)&&_0xf4d0('0x13')===typeof _0x442ad3&&!_[_0xf4d0('0x14')](_0x442ad3)){return _0x442ad3;}return'\x22\x22\x20<>';};exports[_0xf4d0('0x17')]=function(_0x1c8e1c){if(_[_0xf4d0('0x18')](_0x1c8e1c)){return![];}return _0x1c8e1c;};exports[_0xf4d0('0x19')]=function(_0x349737,_0xb8131c,_0x27d56b,_0x41d343,_0x5d8fdd,_0x248539){var _0x15f32a={'XMD-QUEUE':_0xb8131c[_0xf4d0('0x1a')]?_0xb8131c[_0xf4d0('0x1a')]['name']:'','XMD-CALLERID':_0x41d343,'XMD-CALLERID-PREVIEW':_0x248539?util['format'](_0xf4d0('0x15'),_0x248539[_0xf4d0('0x1b')],_0x248539[_0xf4d0('0x1c')]):_0x41d343,'XMD-DIALID':_0x5d8fdd,'XMD-CONTACTID':_0xb8131c[_0xf4d0('0x1d')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x41d343,'XMD-VOICEQUEUEID':_0xb8131c[_0xf4d0('0x1e')],'XMD-DIALCHANNEL':_0x27d56b,'XMD-DIALTIMEOUT':_0x349737['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xf4d0('0x16')](_0xf4d0('0x1f'),_0x349737[_0xf4d0('0x20')]?'g':'',_[_0xf4d0('0x14')](_0x349737[_0xf4d0('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x349737[_0xf4d0('0x22')]||'','XMD-AGI':_0x349737[_0xf4d0('0x23')]?util[_0xf4d0('0x16')](_0xf4d0('0x24'),ipAgi,_0x349737[_0xf4d0('0x23')]):_0xf4d0('0x25'),'XMD-AGIAFTER':_0x349737[_0xf4d0('0x20')]?util[_0xf4d0('0x16')](_0xf4d0('0x24'),ipAgi,_0x349737[_0xf4d0('0x20')]):_0xf4d0('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x248539?_0x248539[_0xf4d0('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x248539?_0x248539[_0xf4d0('0x27')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xf4d0('0x28')};if(!_[_0xf4d0('0x14')](_0x349737[_0xf4d0('0x21')])){_0x15f32a[util[_0xf4d0('0x16')]('%s',_0xf4d0('0x29'))]=_0x349737['monitor_format'];_0x15f32a[util[_0xf4d0('0x16')]('%s',_0xf4d0('0x2a'))]=_0x5d8fdd;}if(_0xb8131c&&_0xb8131c[_0xf4d0('0x2b')]){for(var _0xbf2abc in _0xb8131c['Contact']){if(_0xb8131c[_0xf4d0('0x2b')][_0xf4d0('0x2c')](_0xbf2abc)){if(!_[_0xf4d0('0x18')](_0xb8131c[_0xf4d0('0x2b')][_0xbf2abc])&&_0xbf2abc!=='id'&&_0xbf2abc!==_0xf4d0('0x2d')&&_0xbf2abc!==_0xf4d0('0x2e')&&_0xbf2abc!=='updatedAt'){_0x15f32a[util[_0xf4d0('0x16')](_0xf4d0('0x2f'),'XMD-',_[_0xf4d0('0x30')](_0xbf2abc))]=_0xb8131c[_0xf4d0('0x2b')][_0xbf2abc];}}}}return _0x15f32a;};exports[_0xf4d0('0x31')]=function(_0x2b44c2){var _0x39a44e={};for(var _0x56b9ea in _0x2b44c2){if(_0x2b44c2[_0xf4d0('0x2c')](_0x56b9ea)){_0x39a44e[util[_0xf4d0('0x16')]('%s',_[_0xf4d0('0x32')](_0x56b9ea))]=_0x2b44c2[_0x56b9ea];}}return{'variables':_0x39a44e};};exports[_0xf4d0('0x33')]=function(_0x23cfe1,_0x20f5f4){if(!_[_0xf4d0('0x18')](_0x23cfe1)){if(_0x23cfe1['hasOwnProperty'](_0xf4d0('0x34'))){if(_0x23cfe1[_0xf4d0('0x34')]>0x0){_0x23cfe1[_0xf4d0('0x34')]-=0x1;}else{logger[_0xf4d0('0xe')](_0xf4d0('0x35'),_0x20f5f4);}}}else{logger['error'](_0xf4d0('0x36'),_0x20f5f4);}};exports['logBlacklist']=function(_0x414be8){var _0x595edd=moment()[_0xf4d0('0x16')](_0xf4d0('0x37'));_0x414be8[_0xf4d0('0x38')]=0xd;_0x414be8[_0xf4d0('0x39')]=_0xf4d0('0x3a');_0x414be8[_0xf4d0('0x3b')]=_0x595edd;_0x414be8[_0xf4d0('0x3c')]=_0x595edd;_0x414be8['endtime']=_0x595edd;};exports[_0xf4d0('0x3d')]=function(_0x26d4a3,_0x16fa09,_0xd140e6){var _0x3a2a00=moment()[_0xf4d0('0x16')](_0xf4d0('0x37'));_0x26d4a3[_0xf4d0('0x38')]=_0x16fa09;_0x26d4a3[_0xf4d0('0x39')]=_0xd140e6;_0x26d4a3['responsetime']=_0x3a2a00;_0x26d4a3[_0xf4d0('0x3e')]=getSeconds(_0x26d4a3[_0xf4d0('0x3c')],_0x26d4a3[_0xf4d0('0x3b')]);};exports[_0xf4d0('0x3f')]=function(_0x49e3ed,_0x402203,_0x1e5c83){_0x49e3ed[_0xf4d0('0x40')]=_0x402203;_0x49e3ed[_0xf4d0('0x41')]=_0x1e5c83;};exports[_0xf4d0('0x42')]=function(_0x338513,_0x56f83c,_0xc40e6c){var _0x3339d1=moment()[_0xf4d0('0x16')](_0xf4d0('0x37'));_0x338513[_0xf4d0('0x38')]=_0x56f83c;_0x338513['statedesc']=_0xc40e6c;_0x338513[_0xf4d0('0x3c')]=_0x338513[_0xf4d0('0x3c')]?_0x338513[_0xf4d0('0x3c')]:_0x3339d1;_0x338513[_0xf4d0('0x43')]=_0x338513[_0xf4d0('0x43')]?_0x338513[_0xf4d0('0x43')]:_0x3339d1;_0x338513['ringtime']=getSeconds(_0x338513[_0xf4d0('0x3c')]||0x0,_0x338513[_0xf4d0('0x3b')]||0x0);_0x338513[_0xf4d0('0x44')]=_0x338513[_0xf4d0('0x45')]?getSeconds(_0x338513[_0xf4d0('0x43')],_0x338513['answertime']):0x0;};exports[_0xf4d0('0x46')]=function(_0x228bc3){return _0x228bc3===_0xf4d0('0x47');};exports['variablesAction']=function(_0x159d14,_0x5192c4,_0x2dbfa4,_0x480c39,_0x2ff44d){var _0x356f21=_0x480c39?'RECALL':_0x159d14[_0xf4d0('0x1b')];_0x356f21=_0x2ff44d?'BOOKED':_0x356f21;return{'actionid':_0x159d14[_0xf4d0('0x48')],'action':_0xf4d0('0x49'),'channel':_0x159d14['channelAgent'],'callerid':util[_0xf4d0('0x16')](_0xf4d0('0x15'),_0x356f21,_0x159d14[_0xf4d0('0x1c')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x2dbfa4,'timeout':(_0x5192c4[_0xf4d0('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x159d14[_0xf4d0('0x48')]};};exports[_0xf4d0('0x4b')]=function(_0x1c1689){return _0x1c1689[_0xf4d0('0x4c')]+_0x1c1689[_0xf4d0('0x4d')]+_0x1c1689['countnoanswerretry']+_0x1c1689[_0xf4d0('0x4e')]+_0x1c1689[_0xf4d0('0x4f')];};exports[_0xf4d0('0x50')]=function(_0x4300e5){var _0x10a1e8=_['clone'](_0x4300e5);_0x10a1e8[_0xf4d0('0x38')]=0xf;_0x10a1e8['statedesc']='Global';return _0x10a1e8;};exports['scheduledAt']=function(_0x2a6d7a,_0x3259fb,_0x34ae77){var _0x200314={};_0x200314[_0x3259fb]=_0x2a6d7a[_0x3259fb];_0x200314[_0xf4d0('0x51')]=![];_0x200314['scheduledat']=moment()['add'](_0x34ae77,_0xf4d0('0x52'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x200314[_0xf4d0('0x1d')]=_0x2a6d7a[_0xf4d0('0x1d')];_0x200314[_0xf4d0('0x53')]=_0x2a6d7a[_0xf4d0('0x53')];_0x200314[_0xf4d0('0x1e')]=_0x2a6d7a[_0xf4d0('0x1e')]||undefined;return _0x200314;};exports[_0xf4d0('0x54')]=function(_0xa6cb28,_0x6fcf62){if(!_['isNil'](_0xa6cb28)){if(_0xa6cb28[_0xf4d0('0x55')]>0x0){_0xa6cb28[_0xf4d0('0x55')]-=0x1;}else{logger[_0xf4d0('0xe')](_0x6fcf62,_0xf4d0('0x56'));}}else{logger[_0xf4d0('0xe')](_0x6fcf62,_0xf4d0('0x57'));}};exports[_0xf4d0('0x58')]=function(_0x2483a3){if(_0x2483a3<=0x0){return!![];}return![];};exports[_0xf4d0('0x59')]=function(_0x2cbdeb,_0x31b4b9,_0x2dfea7){_0x2cbdeb[_0xf4d0('0x5a')]=_0x31b4b9;_0x2cbdeb[_0xf4d0('0x5b')]=_0x2cbdeb[_0xf4d0('0x5c')];_0x2cbdeb['interface']=_0x2cbdeb[_0xf4d0('0x5d')];_0x2cbdeb['motionChannel']=_0xf4d0('0x5e');if(_0x2dfea7){_0x2cbdeb[_0xf4d0('0x5f')]=_0x2dfea7[_0xf4d0('0x5f')];}return _0x2cbdeb;};exports[_0xf4d0('0x60')]=function(_0x298a37){var _0x2a43e8={};_0x2a43e8[_0xf4d0('0x5c')]=_0x298a37['queue'];_0x2a43e8[_0xf4d0('0x61')]=_0x298a37['channelAgent'];_0x2a43e8['uniqueid']=_0x298a37[_0xf4d0('0x48')];return _0x2a43e8;};exports['agentReadyId']=function(_0x1c9588){var _0x23119c=[];for(var _0x3a35e7 in _0x1c9588){if(_0x1c9588['hasOwnProperty'](_0x3a35e7)){if(!_['isNil'](_0x1c9588[_0x3a35e7])&&_0x1c9588[_0x3a35e7]['state']===_0xf4d0('0x62')&&_0x1c9588[_0x3a35e7][_0xf4d0('0x63')]==='reachable'){_0x23119c[_0xf4d0('0x64')](_0x1c9588[_0x3a35e7]['id']);}}}return _0x23119c;};exports['getDiff']=function(_0x514d09){var _0x4c8c61=moment()['milliseconds'](0x0);var _0x41532d=moment(_0x514d09)['milliseconds'](0x0);return _0x4c8c61['diff'](_0x41532d,_0xf4d0('0x9'));};exports[_0xf4d0('0x65')]=function(_0x5af998){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5af998['ContactId'],'ListId':_0x5af998['ListId'],'VoiceQueueId':_0x5af998[_0xf4d0('0x1e')]||undefined,'CampaignId':_0x5af998[_0xf4d0('0x66')]||undefined};};exports[_0xf4d0('0x67')]=function(_0x23976a){if(_0x23976a===_0xf4d0('0x48')||_0x23976a===_0xf4d0('0x68')||_0x23976a===_0xf4d0('0x5c')||_0x23976a===_0xf4d0('0x69')||_0x23976a===_0xf4d0('0x6a')||_0x23976a===_0xf4d0('0x6b')||_0x23976a===_0xf4d0('0x40')||_0x23976a===_0xf4d0('0x5d')||_0x23976a===_0xf4d0('0x1b')||_0x23976a===_0xf4d0('0x51')||_0x23976a===_0xf4d0('0x1c')||_0x23976a===_0xf4d0('0x6c')||_0x23976a===_0xf4d0('0x4c')||_0x23976a===_0xf4d0('0x4d')||_0x23976a===_0xf4d0('0x6d')||_0x23976a===_0xf4d0('0x6e')||_0x23976a===_0xf4d0('0x6f')||_0x23976a==='callbackuniqueid'||_0x23976a===_0xf4d0('0x70')||_0x23976a===_0xf4d0('0x71')||_0x23976a===_0xf4d0('0x1d')||_0x23976a===_0xf4d0('0x53')||_0x23976a==='UserId'||_0x23976a===_0xf4d0('0x1e')||_0x23976a===_0xf4d0('0x72')||_0x23976a==='xmd-voicequeueid'||_0x23976a===_0xf4d0('0x73')||_0x23976a===_0xf4d0('0x74')||_0x23976a==='xmd-listid'||_0x23976a===_0xf4d0('0x75')||_0x23976a===_0xf4d0('0x76')||_0x23976a===_0xf4d0('0x77')||_0x23976a==='xmd-dialid'||_0x23976a===_0xf4d0('0x78')||_0x23976a===_0xf4d0('0x79')||_0x23976a===_0xf4d0('0x7a')||_0x23976a==='xmd-callerid'||_0x23976a===_0xf4d0('0x7b')||_0x23976a===_0xf4d0('0x7c')||_0x23976a==='rtpaudioqos'||_0x23976a===_0xf4d0('0x7d')||_0x23976a===_0xf4d0('0x7e')||_0x23976a===_0xf4d0('0x7f')||_0x23976a===_0xf4d0('0x80')||_0x23976a===_0xf4d0('0x81')||_0x23976a===_0xf4d0('0x82')||_0x23976a==='rtpaudioqosrttbridged'||_0x23976a===_0xf4d0('0x83')||_0x23976a===_0xf4d0('0x7d')||_0x23976a===_0xf4d0('0x7e')||_0x23976a===_0xf4d0('0x7f')||_0x23976a==='rtpaudioqosloss'||_0x23976a===_0xf4d0('0x81')||_0x23976a===_0xf4d0('0x82')||_0x23976a===_0xf4d0('0x84')||_0x23976a===_0xf4d0('0x85')||_0x23976a===_0xf4d0('0x86')||_0x23976a==='state'||_0x23976a===_0xf4d0('0x39')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x19fb04,_0x4a99c2){var _0x5db969,_0x1cbec1,_0x420da7;if(_0x4a99c2<=0x0){_0x4a99c2=0x1;}_0x5db969=new RegExp('\x5cw{0,'+_0x4a99c2+'}$');_0x1cbec1=Math['pow'](0xa,_0x4a99c2-0x1);_0x420da7=Math['pow'](0xa,_0x4a99c2)-0x1;return util['format']('%s',_[_0xf4d0('0x87')](_0x19fb04,_0x5db969,_['random'](_0x1cbec1,_0x420da7)));};exports[_0xf4d0('0x88')]=function(_0x1f642a){var _0x1c634b=_0x1f642a[_0xf4d0('0x89')](/"(.*?)"/);return _0x1c634b?_0x1c634b[0x1]:_0x1f642a;};exports[_0xf4d0('0x8a')]=function(_0x592d7f){var _0x8d78aa=_0x592d7f[_0xf4d0('0x89')](/<(.*?)>/);return _0x8d78aa?_0x8d78aa[0x1]:_0x592d7f;}; \ No newline at end of file +var _0x781c=['addVariables','name','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','starttime','logLookAgent','membername','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','scheduledat','add','minutes','ContactId','ListId','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','not_inuse','status','reachable','getDiff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','active','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','\x22%s\x22\x20<%s>','format','string','\x22\x22\x20<>','isActive','isNil'];(function(_0x4319db,_0x58e93b){var _0x35e467=function(_0x3233fc){while(--_0x3233fc){_0x4319db['push'](_0x4319db['shift']());}};_0x35e467(++_0x58e93b);}(_0x781c,0x1aa));var _0xc781=function(_0x585bb3,_0xb45590){_0x585bb3=_0x585bb3-0x0;var _0x2f5470=_0x781c[_0x585bb3];return _0x2f5470;};'use strict';var util=require(_0xc781('0x0'));var _=require(_0xc781('0x1'));var moment=require(_0xc781('0x2'));var logger=require(_0xc781('0x3'))(_0xc781('0x4'));var ipAgi=process[_0xc781('0x5')][_0xc781('0x6')]||_0xc781('0x7');function getSeconds(_0x7a942d,_0x1e2efe){var _0x15c2ba=moment(_0x7a942d)[_0xc781('0x8')](0x0);var _0x4f2e4b=moment(_0x1e2efe)[_0xc781('0x8')](0x0);return _0x15c2ba[_0xc781('0x9')](_0x4f2e4b,'seconds');}exports[_0xc781('0xa')]=function(_0x5e2ae2){return function(_0x528f90){logger[_0xc781('0xb')](_0x5e2ae2,util[_0xc781('0xc')](_0x528f90,{'showHidden':![],'depth':null}));};};exports[_0xc781('0xd')]=function(_0x48944a,_0x8cb846){logger[_0xc781('0xe')](_0x48944a,util[_0xc781('0xc')](_0x8cb846,{'showHidden':![],'depth':null}));};exports[_0xc781('0xf')]=function(_0x192cc5,_0x3eaf2d){logger[_0xc781('0xb')](_0x192cc5,util[_0xc781('0xc')](_0x3eaf2d,{'showHidden':![],'depth':null}));};exports[_0xc781('0x10')]=function(_0x4bf076){return function(_0x22626f){logger['info'](_0x4bf076,util[_0xc781('0xc')](_0x22626f,{'showHidden':![],'depth':null}));};};exports[_0xc781('0x11')]=function(_0x59261a,_0x2747cc,_0x53cb10){return{'message':_0x59261a,'unlock':_0x2747cc,'active':_0x53cb10};};exports[_0xc781('0x12')]=function(_0xa85410,_0x3c716b,_0x7eae76){if(!_[_0xc781('0x13')](_0x7eae76)&&'string'===typeof _0x7eae76&&!_[_0xc781('0x14')](_0x7eae76)){if(!_[_0xc781('0x13')](_0x3c716b)&&'string'===typeof _0x3c716b&&!_[_0xc781('0x14')](_0x3c716b)){return util['format'](_0xc781('0x15'),_0x3c716b,_0x7eae76);}return util[_0xc781('0x16')](_0xc781('0x15'),_0x7eae76,_0x7eae76);}if(!_[_0xc781('0x13')](_0xa85410)&&_0xc781('0x17')===typeof _0xa85410&&!_['isEmpty'](_0xa85410)){return _0xa85410;}return _0xc781('0x18');};exports[_0xc781('0x19')]=function(_0x88b787){if(_[_0xc781('0x1a')](_0x88b787)){return![];}return _0x88b787;};exports[_0xc781('0x1b')]=function(_0xd955f9,_0x4faa15,_0x12b777,_0x182c31,_0x91fc12,_0x1baf70){var _0xa73735={'XMD-QUEUE':_0x4faa15['Queue']?_0x4faa15['Queue'][_0xc781('0x1c')]:'','XMD-CALLERID':_0x182c31,'XMD-CALLERID-PREVIEW':_0x1baf70?util[_0xc781('0x16')](_0xc781('0x15'),_0x1baf70[_0xc781('0x1d')],_0x1baf70[_0xc781('0x1e')]):_0x182c31,'XMD-DIALID':_0x91fc12,'XMD-CONTACTID':_0x4faa15['ContactId'],'XMD-CDRTYPE':_0xc781('0x1f'),'CALLERID(all)':_0x182c31,'XMD-VOICEQUEUEID':_0x4faa15[_0xc781('0x20')],'XMD-DIALCHANNEL':_0x12b777,'XMD-DIALTIMEOUT':_0xd955f9['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xc781('0x16')](_0xc781('0x21'),_0xd955f9[_0xc781('0x22')]?'g':'',_[_0xc781('0x14')](_0xd955f9[_0xc781('0x23')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xd955f9['dialPreviewUrl']||'','XMD-AGI':_0xd955f9[_0xc781('0x24')]?util[_0xc781('0x16')](_0xc781('0x25'),ipAgi,_0xd955f9['dialQueueProject']):_0xc781('0x26'),'XMD-AGIAFTER':_0xd955f9[_0xc781('0x22')]?util[_0xc781('0x16')]('\x22agi://%s/square,%s\x22',ipAgi,_0xd955f9['dialQueueProject2']):_0xc781('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x1baf70?_0x1baf70[_0xc781('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x1baf70?_0x1baf70[_0xc781('0x28')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xc781('0x29')};if(!_['isEmpty'](_0xd955f9[_0xc781('0x23')])){_0xa73735[util['format']('%s',_0xc781('0x2a'))]=_0xd955f9[_0xc781('0x23')];_0xa73735[util[_0xc781('0x16')]('%s',_0xc781('0x2b'))]=_0x91fc12;}if(_0x4faa15&&_0x4faa15['Contact']){for(var _0x13a105 in _0x4faa15[_0xc781('0x2c')]){if(_0x4faa15['Contact'][_0xc781('0x2d')](_0x13a105)){if(!_['isNil'](_0x4faa15[_0xc781('0x2c')][_0x13a105])&&_0x13a105!=='id'&&_0x13a105!==_0xc781('0x2e')&&_0x13a105!==_0xc781('0x2f')&&_0x13a105!=='updatedAt'){_0xa73735[util[_0xc781('0x16')](_0xc781('0x30'),_0xc781('0x31'),_[_0xc781('0x32')](_0x13a105))]=_0x4faa15[_0xc781('0x2c')][_0x13a105];}}}}return _0xa73735;};exports['toLowerVariables']=function(_0x3dea36){var _0x261efe={};for(var _0x4c0860 in _0x3dea36){if(_0x3dea36[_0xc781('0x2d')](_0x4c0860)){_0x261efe[util[_0xc781('0x16')]('%s',_['toLower'](_0x4c0860))]=_0x3dea36[_0x4c0860];}}return{'variables':_0x261efe};};exports[_0xc781('0x33')]=function(_0x3ec60e,_0x38cd92){if(!_[_0xc781('0x1a')](_0x3ec60e)){if(_0x3ec60e[_0xc781('0x2d')](_0xc781('0x34'))){if(_0x3ec60e['originated']>0x0){_0x3ec60e[_0xc781('0x34')]-=0x1;}else{logger['error'](_0xc781('0x35'),_0x38cd92);}}}else{logger[_0xc781('0xb')](_0xc781('0x36'),_0x38cd92);}};exports[_0xc781('0x37')]=function(_0x2490a4){var _0x59b97d=moment()[_0xc781('0x16')](_0xc781('0x38'));_0x2490a4[_0xc781('0x39')]=0xd;_0x2490a4[_0xc781('0x3a')]=_0xc781('0x3b');_0x2490a4['starttime']=_0x59b97d;_0x2490a4[_0xc781('0x3c')]=_0x59b97d;_0x2490a4[_0xc781('0x3d')]=_0x59b97d;};exports[_0xc781('0x3e')]=function(_0x4c91d8,_0x34e607,_0x167d49){var _0x478f4b=moment()['format'](_0xc781('0x38'));_0x4c91d8['state']=_0x34e607;_0x4c91d8[_0xc781('0x3a')]=_0x167d49;_0x4c91d8['responsetime']=_0x478f4b;_0x4c91d8[_0xc781('0x3f')]=getSeconds(_0x4c91d8['responsetime'],_0x4c91d8[_0xc781('0x40')]);};exports[_0xc781('0x41')]=function(_0x35ad96,_0x1dc864,_0x55a120){_0x35ad96[_0xc781('0x42')]=_0x1dc864;_0x35ad96['UserId']=_0x55a120;};exports[_0xc781('0x43')]=function(_0x3e659f,_0xa627c5,_0x4edc81){var _0x4b9826=moment()[_0xc781('0x16')](_0xc781('0x38'));_0x3e659f[_0xc781('0x39')]=_0xa627c5;_0x3e659f[_0xc781('0x3a')]=_0x4edc81;_0x3e659f[_0xc781('0x3c')]=_0x3e659f[_0xc781('0x3c')]?_0x3e659f['responsetime']:_0x4b9826;_0x3e659f[_0xc781('0x3d')]=_0x3e659f[_0xc781('0x3d')]?_0x3e659f['endtime']:_0x4b9826;_0x3e659f[_0xc781('0x3f')]=getSeconds(_0x3e659f[_0xc781('0x3c')]||0x0,_0x3e659f['starttime']||0x0);_0x3e659f[_0xc781('0x44')]=_0x3e659f[_0xc781('0x45')]?getSeconds(_0x3e659f[_0xc781('0x3d')],_0x3e659f['answertime']):0x0;};exports[_0xc781('0x46')]=function(_0x57742d){return _0x57742d===_0xc781('0x47');};exports[_0xc781('0x48')]=function(_0x3e5986,_0xd2677e,_0x29a65a,_0x3f4253,_0x4ce638){var _0x30201d=_0x3f4253?_0xc781('0x49'):_0x3e5986[_0xc781('0x1d')];_0x30201d=_0x4ce638?_0xc781('0x4a'):_0x30201d;return{'actionid':_0x3e5986[_0xc781('0x4b')],'action':_0xc781('0x4c'),'channel':_0x3e5986[_0xc781('0x4d')],'callerid':util[_0xc781('0x16')](_0xc781('0x15'),_0x30201d,_0x3e5986[_0xc781('0x1e')]),'Exten':_0xc781('0x4e'),'Context':_0xc781('0x4f'),'Priority':'1','variable':_0x29a65a,'timeout':(_0xd2677e[_0xc781('0x50')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3e5986[_0xc781('0x4b')]};};exports[_0xc781('0x51')]=function(_0x4c559f){return _0x4c559f['countbusyretry']+_0x4c559f[_0xc781('0x52')]+_0x4c559f[_0xc781('0x53')]+_0x4c559f[_0xc781('0x54')]+_0x4c559f[_0xc781('0x55')];};exports['cloneAction']=function(_0x14a0fe){var _0x1864f8=_[_0xc781('0x56')](_0x14a0fe);_0x1864f8[_0xc781('0x39')]=0xf;_0x1864f8[_0xc781('0x3a')]=_0xc781('0x57');return _0x1864f8;};exports[_0xc781('0x58')]=function(_0x8bd523,_0x32f028,_0x1464ff){var _0x2194d4={};_0x2194d4[_0x32f028]=_0x8bd523[_0x32f028];_0x2194d4['active']=![];_0x2194d4[_0xc781('0x59')]=moment()[_0xc781('0x5a')](_0x1464ff,_0xc781('0x5b'))[_0xc781('0x16')](_0xc781('0x38'));_0x2194d4[_0xc781('0x5c')]=_0x8bd523['ContactId'];_0x2194d4[_0xc781('0x5d')]=_0x8bd523[_0xc781('0x5d')];_0x2194d4['VoiceQueueId']=_0x8bd523[_0xc781('0x20')]||undefined;return _0x2194d4;};exports['decrementTalkink']=function(_0x1acd58,_0x5516de){if(!_[_0xc781('0x1a')](_0x1acd58)){if(_0x1acd58['pTalking']>0x0){_0x1acd58['pTalking']-=0x1;}else{logger[_0xc781('0xb')](_0x5516de,_0xc781('0x5e'));}}else{logger[_0xc781('0xb')](_0x5516de,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xc781('0x5f')]=function(_0x22b47c){if(_0x22b47c<=0x0){return!![];}return![];};exports[_0xc781('0x60')]=function(_0x59f44a,_0x501b7e,_0x4bd480){_0x59f44a[_0xc781('0x61')]=_0x501b7e;_0x59f44a[_0xc781('0x1c')]=_0x59f44a[_0xc781('0x62')];_0x59f44a[_0xc781('0x63')]=_0x59f44a[_0xc781('0x4d')];_0x59f44a[_0xc781('0x64')]=_0xc781('0x65');if(_0x4bd480){_0x59f44a[_0xc781('0x66')]=_0x4bd480[_0xc781('0x66')];}return _0x59f44a;};exports['buildAcw']=function(_0x356435){var _0x2ccc33={};_0x2ccc33[_0xc781('0x62')]=_0x356435[_0xc781('0x62')];_0x2ccc33[_0xc781('0x63')]=_0x356435[_0xc781('0x4d')];_0x2ccc33[_0xc781('0x4b')]=_0x356435[_0xc781('0x4b')];return _0x2ccc33;};exports['agentReadyId']=function(_0x328567){var _0x2f96cf=[];for(var _0x108c81 in _0x328567){if(_0x328567[_0xc781('0x2d')](_0x108c81)){if(!_[_0xc781('0x1a')](_0x328567[_0x108c81])&&_0x328567[_0x108c81][_0xc781('0x39')]===_0xc781('0x67')&&_0x328567[_0x108c81][_0xc781('0x68')]===_0xc781('0x69')){_0x2f96cf['push'](_0x328567[_0x108c81]['id']);}}}return _0x2f96cf;};exports[_0xc781('0x6a')]=function(_0x539670){var _0x52ba5a=moment()[_0xc781('0x8')](0x0);var _0x313f6f=moment(_0x539670)['milliseconds'](0x0);return _0x52ba5a['diff'](_0x313f6f,'seconds');};exports[_0xc781('0x6b')]=function(_0x42ea78){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x42ea78[_0xc781('0x5c')],'ListId':_0x42ea78[_0xc781('0x5d')],'VoiceQueueId':_0x42ea78[_0xc781('0x20')]||undefined,'CampaignId':_0x42ea78[_0xc781('0x6c')]||undefined};};exports['filterKey']=function(_0x37e2fd){if(_0x37e2fd===_0xc781('0x4b')||_0x37e2fd===_0xc781('0x6d')||_0x37e2fd==='queue'||_0x37e2fd===_0xc781('0x6e')||_0x37e2fd===_0xc781('0x6f')||_0x37e2fd===_0xc781('0x70')||_0x37e2fd==='membername'||_0x37e2fd===_0xc781('0x4d')||_0x37e2fd===_0xc781('0x1d')||_0x37e2fd===_0xc781('0x71')||_0x37e2fd===_0xc781('0x1e')||_0x37e2fd===_0xc781('0x59')||_0x37e2fd===_0xc781('0x72')||_0x37e2fd===_0xc781('0x52')||_0x37e2fd===_0xc781('0x53')||_0x37e2fd===_0xc781('0x73')||_0x37e2fd===_0xc781('0x74')||_0x37e2fd===_0xc781('0x75')||_0x37e2fd===_0xc781('0x76')||_0x37e2fd===_0xc781('0x77')||_0x37e2fd===_0xc781('0x5c')||_0x37e2fd==='ListId'||_0x37e2fd===_0xc781('0x78')||_0x37e2fd==='VoiceQueueId'||_0x37e2fd==='sipcallid'||_0x37e2fd===_0xc781('0x79')||_0x37e2fd===_0xc781('0x7a')||_0x37e2fd===_0xc781('0x7b')||_0x37e2fd===_0xc781('0x7c')||_0x37e2fd===_0xc781('0x7d')||_0x37e2fd==='xmd-dialtimeout'||_0x37e2fd===_0xc781('0x7e')||_0x37e2fd===_0xc781('0x7f')||_0x37e2fd===_0xc781('0x80')||_0x37e2fd===_0xc781('0x81')||_0x37e2fd==='xmd-cdrtype'||_0x37e2fd===_0xc781('0x82')||_0x37e2fd===_0xc781('0x83')||_0x37e2fd===_0xc781('0x84')||_0x37e2fd===_0xc781('0x85')||_0x37e2fd==='rtpaudioqosbridged'||_0x37e2fd===_0xc781('0x86')||_0x37e2fd===_0xc781('0x87')||_0x37e2fd==='rtpaudioqosloss'||_0x37e2fd===_0xc781('0x88')||_0x37e2fd==='rtpaudioqosrtt'||_0x37e2fd==='rtpaudioqosrttbridged'||_0x37e2fd===_0xc781('0x85')||_0x37e2fd===_0xc781('0x89')||_0x37e2fd===_0xc781('0x86')||_0x37e2fd==='rtpaudioqosjitterbridged'||_0x37e2fd===_0xc781('0x8a')||_0x37e2fd===_0xc781('0x88')||_0x37e2fd===_0xc781('0x8b')||_0x37e2fd===_0xc781('0x8c')||_0x37e2fd===_0xc781('0x8d')||_0x37e2fd===_0xc781('0x8e')||_0x37e2fd==='state'||_0x37e2fd==='statedesc'){return![];}return!![];};exports[_0xc781('0x8f')]=function(_0x29ce4d,_0x58e707){var _0x2e766a,_0x448d9b,_0x510265;if(_0x58e707<=0x0){_0x58e707=0x1;}_0x2e766a=new RegExp(_0xc781('0x90')+_0x58e707+'}$');_0x448d9b=Math['pow'](0xa,_0x58e707-0x1);_0x510265=Math[_0xc781('0x91')](0xa,_0x58e707)-0x1;return util[_0xc781('0x16')]('%s',_[_0xc781('0x92')](_0x29ce4d,_0x2e766a,_[_0xc781('0x93')](_0x448d9b,_0x510265)));};exports[_0xc781('0x94')]=function(_0x1c4ee9){var _0x28eec9=_0x1c4ee9[_0xc781('0x95')](/"(.*?)"/);return _0x28eec9?_0x28eec9[0x1]:_0x1c4ee9;};exports[_0xc781('0x96')]=function(_0x30352e){var _0xd4966c=_0x30352e[_0xc781('0x95')](/<(.*?)>/);return _0xd4966c?_0xd4966c[0x1]:_0x30352e;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 77311f4..f876059 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa78d=['voicequeuechannel','voicechannel','queueadd','string','number','queuepause','boolean','reload'];(function(_0x1975c1,_0x30f4a1){var _0xbd0c64=function(_0x254603){while(--_0x254603){_0x1975c1['push'](_0x1975c1['shift']());}};_0xbd0c64(++_0x30f4a1);}(_0xa78d,0x1ca));var _0xda78=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xa78d[_0x173441];return _0x2423a8;};'use strict';exports[_0xda78('0x0')]={'queue':{'type':_0xda78('0x1'),'required':!![]},'interface':{'type':_0xda78('0x1'),'required':!![]},'membername':{'type':_0xda78('0x1'),'required':!![]},'penalty':{'type':_0xda78('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xda78('0x3')]={'interface':{'type':_0xda78('0x1'),'required':!![]},'paused':{'type':_0xda78('0x4')},'reason':{'type':_0xda78('0x1'),'required':![]}};exports[_0xda78('0x5')]={'module':{'type':_0xda78('0x1'),'required':![]}};exports[_0xda78('0x6')]={'uniqueid':{'type':_0xda78('0x1'),'required':!![]}};exports[_0xda78('0x7')]={'uniqueid':{'type':_0xda78('0x1'),'required':!![]},'filename':{'type':_0xda78('0x1')},'format':{'type':_0xda78('0x1')},'mixmonitorid':{'type':_0xda78('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xda78('0x1'),'required':!![]},'exten':{'type':_0xda78('0x1'),'required':!![]},'context':{'type':_0xda78('0x1')}}; \ No newline at end of file +var _0xe3e0=['voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','voicequeuechannel'];(function(_0x46f960,_0x9037c1){var _0x320b5a=function(_0x5418be){while(--_0x5418be){_0x46f960['push'](_0x46f960['shift']());}};_0x320b5a(++_0x9037c1);}(_0xe3e0,0xef));var _0x0e3e=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0xe3e0[_0x2becba];return _0x90b5dd;};'use strict';exports[_0x0e3e('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0e3e('0x1'),'required':!![]},'membername':{'type':_0x0e3e('0x1'),'required':!![]},'penalty':{'type':_0x0e3e('0x2'),'required':![]},'paused':{'type':_0x0e3e('0x3'),'required':![]}};exports[_0x0e3e('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x0e3e('0x1'),'required':!![]},'paused':{'type':_0x0e3e('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x0e3e('0x1'),'required':![]}};exports[_0x0e3e('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x0e3e('0x1')},'format':{'type':_0x0e3e('0x1')},'mixmonitorid':{'type':_0x0e3e('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0x0e3e('0x6')]={'uniqueid':{'type':_0x0e3e('0x1'),'required':!![]},'exten':{'type':_0x0e3e('0x1'),'required':!![]},'context':{'type':_0x0e3e('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 4e926c3..1c620f2 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dfc=['initAgents','length','format','isUndefined','initTrunks','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumBillable','initVoiceCallReports','outbound','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','name','mapKeys','isNil','interface','SIP/%s','total','sumHoldTime','sumDuration','isEmpty','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase'];(function(_0x1b8a73,_0x5a5a05){var _0x1b8c9b=function(_0x2e794b){while(--_0x2e794b){_0x1b8a73['push'](_0x1b8a73['shift']());}};_0x1b8c9b(++_0x5a5a05);}(_0x6dfc,0x112));var _0xc6df=function(_0x72a85d,_0x314187){_0x72a85d=_0x72a85d-0x0;var _0xb75c99=_0x6dfc[_0x72a85d];return _0xb75c99;};'use strict';var BPromise=require(_0xc6df('0x0'));var util=require(_0xc6df('0x1'));var _=require(_0xc6df('0x2'));var moment=require(_0xc6df('0x3'));var Agent=require(_0xc6df('0x4'));var Telephone=require(_0xc6df('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xc6df('0x6'));var Trigger=require(_0xc6df('0x7'));var Template=require('../model/template');var Campaign=require(_0xc6df('0x8'));var VoiceExtension=require(_0xc6df('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xc6df('0xa'));var FreshdeskAccount=require(_0xc6df('0xb'));var SugarcrmAccount=require(_0xc6df('0xc'));var ZohoAccount=require(_0xc6df('0xd'));var DeskAccount=require(_0xc6df('0xe'));var VtigerAccount=require(_0xc6df('0xf'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xc6df('0x10'));var FreshsalesAccount=require(_0xc6df('0x11'));var FaxAccount=require(_0xc6df('0x12'));var Realtime=function(){this[_0xc6df('0x13')]={};this[_0xc6df('0x14')]={};this[_0xc6df('0x15')]={};this[_0xc6df('0x16')]={};this[_0xc6df('0x17')]={};this[_0xc6df('0x18')]={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc6df('0x19')]={};this[_0xc6df('0x1a')]={};this[_0xc6df('0x1b')]={};this[_0xc6df('0x1c')]={};this[_0xc6df('0x1d')]={};this[_0xc6df('0x1e')]={};this[_0xc6df('0x1f')]={};this['salesforceAccounts']={};this[_0xc6df('0x20')]={};this[_0xc6df('0x21')]={};this[_0xc6df('0x22')]={};this[_0xc6df('0x23')]={};this[_0xc6df('0x24')]={};this[_0xc6df('0x25')]={};this[_0xc6df('0x26')]={};this[_0xc6df('0x27')]={};this[_0xc6df('0x28')]={};};function freeIsNotKey(_0x2a1f23,_0x45998f,_0x397ef5){var _0x1648ec=_['mapKeys'](_0x2a1f23,function(_0x4a1713,_0x2509f2){return _0x4a1713[_0x397ef5];});for(var _0x5ec473 in _0x45998f){if(_0x45998f[_0xc6df('0x29')](_0x5ec473)){if(!_0x1648ec[_0x5ec473]){delete _0x45998f[_0x5ec473];}}}}function freeIsNotKeySip(_0x5ee692,_0x349c37){var _0x4b7b33=_['mapKeys'](_0x5ee692,function(_0x32d373,_0x40d982){return util['format']('SIP/%s',_0x32d373[_0xc6df('0x2a')]);});for(var _0x1fde35 in _0x349c37){if(_0x349c37[_0xc6df('0x29')](_0x1fde35)){if(!_0x4b7b33[_0x1fde35]){delete _0x349c37[_0x1fde35];}}}}function freeIsNotKeyAgent(_0x4197a6,_0x24bdf9){var _0x25ab88=_[_0xc6df('0x2b')](_0x4197a6,function(_0x5e3e13,_0x11ca13){var _0x40f292=_[_0xc6df('0x2c')](_0x5e3e13[_0xc6df('0x2d')])?util['format'](_0xc6df('0x2e'),_0x5e3e13[_0xc6df('0x2a')]):_0x5e3e13['interface'];return _0x40f292;});for(var _0x1aaaa1 in _0x24bdf9){if(_0x24bdf9['hasOwnProperty'](_0x1aaaa1)){if(!_0x25ab88[_0x1aaaa1]){delete _0x24bdf9[_0x1aaaa1];}}}}function clearVoiceCallReports(_0x45d79b){_0x45d79b[_0xc6df('0x2f')]=0x0;_0x45d79b['answered']=0x0;_0x45d79b[_0xc6df('0x30')]=0x0;_0x45d79b[_0xc6df('0x31')]=0x0;_0x45d79b['sumBillable']=0x0;}function clearCampaigns(_0x4d4947){if(!_[_0xc6df('0x32')](_0x4d4947)){for(var _0x4dabf6 in _0x4d4947){if(_0x4d4947[_0xc6df('0x29')](_0x4dabf6)){_0x4d4947[_0x4dabf6]['ivrTotalCallsDays']=0x0;_0x4d4947[_0x4dabf6][_0xc6df('0x33')]=0x0;}}}}function clearVoiceQueues(_0x2ab8e6){if(!_['isEmpty'](_0x2ab8e6)){for(var _0x45e027 in _0x2ab8e6){if(_0x2ab8e6['hasOwnProperty'](_0x45e027)){_0x2ab8e6[_0x45e027][_0xc6df('0x2f')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x34')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x35')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x36')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x30')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x31')]=0x0;_0x2ab8e6[_0x45e027]['sumBillable']=0x0;_0x2ab8e6[_0x45e027]['outboundAnswerAgiCallsDay']=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x37')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x38')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x39')]=0x0;_0x2ab8e6[_0x45e027]['outboundNoSuchCallsDay']=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x3a')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x3b')]=0x0;_0x2ab8e6[_0x45e027]['outboundDropCallsDayCallersExit']=0x0;_0x2ab8e6[_0x45e027]['outboundBlacklistCallsDay']=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x3c')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x3d')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x3e')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x3f')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x40')]=0x0;_0x2ab8e6[_0x45e027][_0xc6df('0x41')]=!![];}}}}Realtime[_0xc6df('0x42')][_0xc6df('0x43')]=function(_0xc85905,_0x360c11){for(var _0x54b18b in _0x360c11){if(_0xc85905[_0xc6df('0x29')](_0x54b18b)){_0xc85905[_0x54b18b]=_0x360c11[_0x54b18b];}}};Realtime[_0xc6df('0x42')][_0xc6df('0x44')]=function(){var _0xf56c09=this;return function(_0x285eff){if(_0x285eff){freeIsNotKeyAgent(_0x285eff,_0xf56c09[_0xc6df('0x13')]);for(var _0xa13f41=0x0,_0x59cb51={},_0x5a753c={};_0xa13f41<_0x285eff[_0xc6df('0x45')];_0xa13f41+=0x1){_0x59cb51=_0x285eff[_0xa13f41];var _0x5af3f3=_[_0xc6df('0x2c')](_0x59cb51[_0xc6df('0x2d')])?util[_0xc6df('0x46')]('SIP/%s',_0x59cb51['name']):_0x59cb51[_0xc6df('0x2d')];if(_[_0xc6df('0x47')](_0xf56c09['agents'][_0x5af3f3])){_0xf56c09[_0xc6df('0x13')][_0x5af3f3]=new Agent(_0x59cb51);}else{_0xf56c09[_0xc6df('0x43')](_0xf56c09[_0xc6df('0x13')][_0x5af3f3],_0x59cb51);}}}return _0xf56c09[_0xc6df('0x13')];};};Realtime['prototype']['initTelephones']=function(){var _0x2d5ef1=this;return function(_0x53c89e){if(_0x53c89e){freeIsNotKeySip(_0x53c89e,_0x2d5ef1[_0xc6df('0x14')]);for(var _0x5b3e58=0x0,_0x3544ea={},_0x11ef53={};_0x5b3e58<_0x53c89e[_0xc6df('0x45')];_0x5b3e58+=0x1){_0x3544ea=_0x53c89e[_0x5b3e58];if(_[_0xc6df('0x47')](_0x2d5ef1[_0xc6df('0x14')][util[_0xc6df('0x46')](_0xc6df('0x2e'),_0x3544ea['name'])])){_0x2d5ef1['telephones'][util[_0xc6df('0x46')](_0xc6df('0x2e'),_0x3544ea[_0xc6df('0x2a')])]=new Telephone(_0x3544ea);}else{_0x2d5ef1[_0xc6df('0x43')](_0x2d5ef1[_0xc6df('0x14')][util['format'](_0xc6df('0x2e'),_0x3544ea[_0xc6df('0x2a')])],_0x3544ea);}}}return _0x2d5ef1[_0xc6df('0x14')];};};Realtime[_0xc6df('0x42')][_0xc6df('0x48')]=function(){var _0x52b46e=this;return function(_0x433d8a){if(_0x433d8a){freeIsNotKeySip(_0x433d8a,_0x52b46e[_0xc6df('0x15')]);for(var _0x591443=0x0,_0xbe255b={},_0x2e8319={};_0x591443<_0x433d8a[_0xc6df('0x45')];_0x591443+=0x1){_0xbe255b=_0x433d8a[_0x591443];if(_['isUndefined'](_0x52b46e[_0xc6df('0x15')][util[_0xc6df('0x46')](_0xc6df('0x2e'),_0xbe255b[_0xc6df('0x2a')])])){_0x52b46e[_0xc6df('0x15')][util['format'](_0xc6df('0x2e'),_0xbe255b[_0xc6df('0x2a')])]=new Trunk(_0xbe255b);}else{_0x52b46e[_0xc6df('0x43')](_0x52b46e['trunks'][util[_0xc6df('0x46')](_0xc6df('0x2e'),_0xbe255b['name'])],_0xbe255b);}}}return _0x52b46e[_0xc6df('0x15')];};};Realtime[_0xc6df('0x42')][_0xc6df('0x49')]=function(){var _0x2345de=this;return function(_0x1f3243){if(_0x1f3243){freeIsNotKey(_0x1f3243,_0x2345de[_0xc6df('0x16')],_0xc6df('0x2a'));for(var _0x23ae14=0x0,_0x1214f8={},_0x298c06={};_0x23ae14<_0x1f3243[_0xc6df('0x45')];_0x23ae14+=0x1){_0x1214f8=_0x1f3243[_0x23ae14];if(_[_0xc6df('0x47')](_0x2345de[_0xc6df('0x16')][_0x1214f8['name']])){_0x2345de[_0xc6df('0x16')][_0x1214f8['name']]=new VoiceQueue(_0x1214f8);}else{_0x2345de['mergeFromDatabase'](_0x2345de['voiceQueues'][_0x1214f8[_0xc6df('0x2a')]],_0x1214f8);}}}return _0x2345de[_0xc6df('0x16')];};};Realtime[_0xc6df('0x42')][_0xc6df('0x4a')]=function(){var _0xff8672=this;return function(_0x16898b){if(_0x16898b){freeIsNotKey(_0x16898b,_0xff8672['triggers'],'id');for(var _0x540d9a=0x0,_0x19e989={},_0x54ce8b={};_0x540d9a<_0x16898b[_0xc6df('0x45')];_0x540d9a+=0x1){_0x19e989=_0x16898b[_0x540d9a];if(_[_0xc6df('0x47')](_0xff8672[_0xc6df('0x17')][_0x19e989['id']])){_0xff8672[_0xc6df('0x17')][_0x19e989['id']]=new Trigger(_0x19e989);}else{_0xff8672[_0xc6df('0x43')](_0xff8672[_0xc6df('0x17')][_0x19e989['id']],_0x19e989);}}}return _0xff8672[_0xc6df('0x17')];};};Realtime[_0xc6df('0x42')][_0xc6df('0x4b')]=function(){var _0x1c86d2=this;return function(_0x2ffa05){if(_0x2ffa05){freeIsNotKey(_0x2ffa05,_0x1c86d2[_0xc6df('0x4c')],'id');for(var _0x35f821=0x0,_0x16fb16={},_0x4c31d1={};_0x35f821<_0x2ffa05['length'];_0x35f821+=0x1){_0x16fb16=_0x2ffa05[_0x35f821];if(_[_0xc6df('0x47')](_0x1c86d2['templates'][_0x16fb16['id']])){_0x1c86d2['templates'][_0x16fb16['id']]=new Template(_0x16fb16);}else{_0x1c86d2['mergeFromDatabase'](_0x1c86d2[_0xc6df('0x4c')][_0x16fb16['id']],_0x16fb16);}}}return _0x1c86d2[_0xc6df('0x4c')];};};Realtime[_0xc6df('0x42')][_0xc6df('0x4d')]=function(){var _0x663a1b=this;return function(_0x2cc1a7){if(_0x2cc1a7){freeIsNotKey(_0x2cc1a7,_0x663a1b['zendeskAccounts'],'id');for(var _0x34334e=0x0,_0x5d3bc7={},_0x1829e1={};_0x34334e<_0x2cc1a7['length'];_0x34334e+=0x1){_0x5d3bc7=_0x2cc1a7[_0x34334e];if(_[_0xc6df('0x47')](_0x663a1b[_0xc6df('0x1f')][_0x5d3bc7['id']])){_0x663a1b[_0xc6df('0x1f')][_0x5d3bc7['id']]=new ZendeskAccount(_0x5d3bc7);}else{_0x663a1b[_0xc6df('0x43')](_0x663a1b[_0xc6df('0x1f')][_0x5d3bc7['id']],_0x5d3bc7);}}}return _0x663a1b['zendeskAccounts'];};};Realtime[_0xc6df('0x42')][_0xc6df('0x4e')]=function(){var _0x54d6e6=this;return function(_0x6806a){if(_0x6806a){freeIsNotKey(_0x6806a,_0x54d6e6[_0xc6df('0x4f')],'id');for(var _0x53fd4b=0x0,_0x2f677f={},_0x3f6502={};_0x53fd4b<_0x6806a[_0xc6df('0x45')];_0x53fd4b+=0x1){_0x2f677f=_0x6806a[_0x53fd4b];if(_[_0xc6df('0x47')](_0x54d6e6[_0xc6df('0x4f')][_0x2f677f['id']])){_0x54d6e6[_0xc6df('0x4f')][_0x2f677f['id']]=new SalesforceAccount(_0x2f677f);}else{_0x54d6e6[_0xc6df('0x43')](_0x54d6e6['salesforceAccounts'][_0x2f677f['id']],_0x2f677f);}}}return _0x54d6e6[_0xc6df('0x4f')];};};Realtime[_0xc6df('0x42')][_0xc6df('0x50')]=function(){var _0x87813=this;return function(_0x501e84){if(_0x501e84){freeIsNotKey(_0x501e84,_0x87813[_0xc6df('0x21')],'id');for(var _0x4b7a33=0x0,_0x401fd9={},_0x13a01c={};_0x4b7a33<_0x501e84[_0xc6df('0x45')];_0x4b7a33+=0x1){_0x401fd9=_0x501e84[_0x4b7a33];if(_[_0xc6df('0x47')](_0x87813[_0xc6df('0x21')][_0x401fd9['id']])){_0x87813['freshdeskAccounts'][_0x401fd9['id']]=new FreshdeskAccount(_0x401fd9);}else{_0x87813[_0xc6df('0x43')](_0x87813[_0xc6df('0x21')][_0x401fd9['id']],_0x401fd9);}}}return _0x87813[_0xc6df('0x21')];};};Realtime[_0xc6df('0x42')][_0xc6df('0x51')]=function(){var _0x2bb2b1=this;return function(_0x27b7f6){if(_0x27b7f6){freeIsNotKey(_0x27b7f6,_0x2bb2b1[_0xc6df('0x22')],'id');for(var _0x3eda16=0x0,_0x462319={},_0x3380c8={};_0x3eda16<_0x27b7f6['length'];_0x3eda16+=0x1){_0x462319=_0x27b7f6[_0x3eda16];if(_[_0xc6df('0x47')](_0x2bb2b1['zohoAccounts'][_0x462319['id']])){_0x2bb2b1['zohoAccounts'][_0x462319['id']]=new ZohoAccount(_0x462319);}else{_0x2bb2b1[_0xc6df('0x43')](_0x2bb2b1['zohoAccounts'][_0x462319['id']],_0x462319);}}}return _0x2bb2b1[_0xc6df('0x22')];};};Realtime[_0xc6df('0x42')][_0xc6df('0x52')]=function(){var _0x8f44e2=this;return function(_0x277e1b){if(_0x277e1b){freeIsNotKey(_0x277e1b,_0x8f44e2[_0xc6df('0x23')],'id');for(var _0x56eee=0x0,_0x521811={},_0x354137={};_0x56eee<_0x277e1b[_0xc6df('0x45')];_0x56eee+=0x1){_0x521811=_0x277e1b[_0x56eee];if(_[_0xc6df('0x47')](_0x8f44e2['deskAccounts'][_0x521811['id']])){_0x8f44e2[_0xc6df('0x23')][_0x521811['id']]=new DeskAccount(_0x521811);}else{_0x8f44e2[_0xc6df('0x43')](_0x8f44e2[_0xc6df('0x23')][_0x521811['id']],_0x521811);}}}return _0x8f44e2[_0xc6df('0x23')];};};Realtime[_0xc6df('0x42')][_0xc6df('0x53')]=function(){var _0x1e4249=this;return function(_0x2d807c){if(_0x2d807c){freeIsNotKey(_0x2d807c,_0x1e4249[_0xc6df('0x20')],'id');for(var _0x4d8481=0x0,_0x174e46={},_0x3b3205={};_0x4d8481<_0x2d807c[_0xc6df('0x45')];_0x4d8481+=0x1){_0x174e46=_0x2d807c[_0x4d8481];if(_['isUndefined'](_0x1e4249[_0xc6df('0x20')][_0x174e46['id']])){_0x1e4249[_0xc6df('0x20')][_0x174e46['id']]=new SugarcrmAccount(_0x174e46);}else{_0x1e4249['mergeFromDatabase'](_0x1e4249['sugarcrmAccounts'][_0x174e46['id']],_0x174e46);}}}return _0x1e4249['sugarcrmAccounts'];};};Realtime[_0xc6df('0x42')][_0xc6df('0x54')]=function(){var _0x268cfa=this;return function(_0x3269a4){if(_0x3269a4){freeIsNotKey(_0x3269a4,_0x268cfa[_0xc6df('0x24')],'id');for(var _0x311b5f=0x0,_0x117820={},_0x395801={};_0x311b5f<_0x3269a4['length'];_0x311b5f+=0x1){_0x117820=_0x3269a4[_0x311b5f];if(_[_0xc6df('0x47')](_0x268cfa['vtigerAccounts'][_0x117820['id']])){_0x268cfa[_0xc6df('0x24')][_0x117820['id']]=new VtigerAccount(_0x117820);}else{_0x268cfa['mergeFromDatabase'](_0x268cfa[_0xc6df('0x24')][_0x117820['id']],_0x117820);}}}return _0x268cfa['vtigerAccounts'];};};Realtime[_0xc6df('0x42')][_0xc6df('0x55')]=function(){var _0x1de7b0=this;return function(_0x233f80){if(_0x233f80){freeIsNotKey(_0x233f80,_0x1de7b0['servicenowAccounts'],'id');for(var _0x483dfa=0x0,_0x98c3ce={},_0x1f7293={};_0x483dfa<_0x233f80[_0xc6df('0x45')];_0x483dfa+=0x1){_0x98c3ce=_0x233f80[_0x483dfa];if(_[_0xc6df('0x47')](_0x1de7b0['servicenowAccounts'][_0x98c3ce['id']])){_0x1de7b0[_0xc6df('0x25')][_0x98c3ce['id']]=new ServicenowAccount(_0x98c3ce);}else{_0x1de7b0[_0xc6df('0x43')](_0x1de7b0['servicenowAccounts'][_0x98c3ce['id']],_0x98c3ce);}}}return _0x1de7b0[_0xc6df('0x25')];};};Realtime['prototype'][_0xc6df('0x56')]=function(){var _0x2baedf=this;return function(_0xcf3dc8){if(_0xcf3dc8){freeIsNotKey(_0xcf3dc8,_0x2baedf['dynamics365Accounts'],'id');for(var _0x5c6890=0x0,_0x2465a8={},_0x111739={};_0x5c6890<_0xcf3dc8[_0xc6df('0x45')];_0x5c6890+=0x1){_0x2465a8=_0xcf3dc8[_0x5c6890];if(_[_0xc6df('0x47')](_0x2baedf['dynamics365Accounts'][_0x2465a8['id']])){_0x2baedf[_0xc6df('0x26')][_0x2465a8['id']]=new Dynamics365Account(_0x2465a8);}else{_0x2baedf[_0xc6df('0x43')](_0x2baedf[_0xc6df('0x26')][_0x2465a8['id']],_0x2465a8);}}}return _0x2baedf[_0xc6df('0x26')];};};Realtime['prototype'][_0xc6df('0x57')]=function(){var _0x464b76=this;return function(_0x4a7387){if(_0x4a7387){freeIsNotKey(_0x4a7387,_0x464b76[_0xc6df('0x27')],'id');for(var _0x182a66=0x0,_0x3f8a01={},_0x5a8f68={};_0x182a66<_0x4a7387['length'];_0x182a66+=0x1){_0x3f8a01=_0x4a7387[_0x182a66];if(_[_0xc6df('0x47')](_0x464b76[_0xc6df('0x27')][_0x3f8a01['id']])){_0x464b76[_0xc6df('0x27')][_0x3f8a01['id']]=new FreshsalesAccount(_0x3f8a01);}else{_0x464b76[_0xc6df('0x43')](_0x464b76['freshsalesAccounts'][_0x3f8a01['id']],_0x3f8a01);}}}return _0x464b76['freshsalesAccounts'];};};Realtime['prototype'][_0xc6df('0x58')]=function(){var _0x43ce8d=this;return function(_0x5910e0){for(var _0x3026e6=0x0;_0x3026e6<_0x5910e0[_0xc6df('0x45')];_0x3026e6+=0x1){_[_0xc6df('0x59')](_0x43ce8d[_0xc6df('0x16')][_0x5910e0[_0x3026e6][_0xc6df('0x2a')]],_0x5910e0[_0x3026e6]);}return _0x43ce8d['voiceQueues'];};};Realtime[_0xc6df('0x42')][_0xc6df('0x5a')]=function(){var _0x38a181=this;return function(_0x4df8fb){clearVoiceQueues(_0x38a181['voiceQueues']);if(_0x4df8fb){_0x4df8fb=_[_0xc6df('0x5b')](_0x4df8fb,'uniqueid');for(var _0x46a378 in _0x4df8fb){if(_0x4df8fb['hasOwnProperty'](_0x46a378)){var _0x56d732={};for(var _0x134c39=0x0;_0x134c39<_0x4df8fb[_0x46a378][_0xc6df('0x45')];_0x134c39+=0x1){var _0x450f89=_0x4df8fb[_0x46a378][_0x134c39]['queue'];if(_0x38a181['voiceQueues'][_0x450f89]){if(_0x4df8fb[_0x46a378][_0x134c39][_0xc6df('0x5c')]){_0x38a181['voiceQueues'][_0x450f89]['unmanaged']+=0x1;}if(_0x4df8fb[_0x46a378][_0x134c39][_0xc6df('0x5d')]){_0x38a181[_0xc6df('0x16')][_0x450f89]['abandoned']+=0x1;}_0x38a181['voiceQueues'][_0x450f89][_0xc6df('0x30')]+=moment(_0x4df8fb[_0x46a378][_0x134c39][_0xc6df('0x5e')])[_0xc6df('0x5f')](moment(_0x4df8fb[_0x46a378][_0x134c39][_0xc6df('0x60')]),_0xc6df('0x61'))||0x0;if(_0x134c39===_0x4df8fb[_0x46a378][_0xc6df('0x45')]-0x1){_0x38a181[_0xc6df('0x16')][_0x450f89][_0xc6df('0x31')]+=moment(_0x4df8fb[_0x46a378][_0x134c39][_0xc6df('0x62')]||_0x4df8fb[_0x46a378][_0x134c39][_0xc6df('0x63')]||_0x4df8fb[_0x46a378][_0x134c39][_0xc6df('0x64')])[_0xc6df('0x5f')](moment(_0x4df8fb[_0x46a378][_0x134c39]['queuecallerjoinAt']),_0xc6df('0x61'))||0x0;_0x38a181[_0xc6df('0x16')][_0x450f89][_0xc6df('0x2f')]+=0x1;if(_0x4df8fb[_0x46a378][_0x134c39][_0xc6df('0x65')]){_0x38a181[_0xc6df('0x16')][_0x450f89]['answered']+=0x1;_0x38a181[_0xc6df('0x16')][_0x450f89][_0xc6df('0x66')]+=moment(_0x4df8fb[_0x46a378][_0x134c39]['queuecallercompleteAt'])[_0xc6df('0x5f')](moment(_0x4df8fb[_0x46a378][_0x134c39][_0xc6df('0x5e')]),_0xc6df('0x61'))||0x0;}}else{_0x38a181['voiceQueues'][_0x450f89][_0xc6df('0x31')]+=_0x38a181[_0xc6df('0x16')][_0x450f89][_0xc6df('0x30')]||0x0;}}}}}}return _0x38a181['voiceQueues'];};};Realtime[_0xc6df('0x42')][_0xc6df('0x67')]=function(){var _0x4c4e26=this;return function(_0x57b4e1){clearVoiceCallReports(_0x4c4e26[_0xc6df('0x68')]);if(_0x57b4e1){for(var _0x5ab8f5=0x0;_0x5ab8f5<_0x57b4e1[_0xc6df('0x45')];_0x5ab8f5+=0x1){_0x4c4e26[_0xc6df('0x68')][_0xc6df('0x2f')]+=0x1;_0x4c4e26['outbound']['sumDuration']+=_0x57b4e1[_0x5ab8f5][_0xc6df('0x69')];if(_0x57b4e1[_0x5ab8f5]['disposition']===_0xc6df('0x6a')){_0x4c4e26[_0xc6df('0x68')][_0xc6df('0x34')]+=0x1;_0x4c4e26[_0xc6df('0x68')][_0xc6df('0x30')]+=_0x57b4e1[_0x5ab8f5]['duration']-_0x57b4e1[_0x5ab8f5][_0xc6df('0x6b')]||0x0;_0x4c4e26[_0xc6df('0x68')][_0xc6df('0x66')]+=_0x57b4e1[_0x5ab8f5][_0xc6df('0x6b')];}}}return _0x4c4e26[_0xc6df('0x68')];};};Realtime[_0xc6df('0x42')][_0xc6df('0x6c')]=function(){var _0xad562a=this;return function(_0x69476b){if(_0x69476b){freeIsNotKey(_0x69476b,_0xad562a[_0xc6df('0x18')],_0xc6df('0x2a'));for(var _0x46dfaf=0x0,_0x2adade={};_0x46dfaf<_0x69476b[_0xc6df('0x45')];_0x46dfaf+=0x1){_0x2adade=_0x69476b[_0x46dfaf];if(_[_0xc6df('0x47')](_0xad562a[_0xc6df('0x18')][_0x2adade['name']])){_0xad562a[_0xc6df('0x18')][_0x2adade[_0xc6df('0x2a')]]=new Campaign(_0x2adade);}else{_0xad562a[_0xc6df('0x43')](_0xad562a[_0xc6df('0x18')][_0x2adade['name']],_0x2adade);_0xad562a['campaigns'][_0x2adade['name']][_0xc6df('0x6d')]=_0x2adade['SquareProject']?_0x2adade[_0xc6df('0x6e')][_0xc6df('0x2a')]:undefined;}}}return _0xad562a[_0xc6df('0x18')];};};Realtime['prototype'][_0xc6df('0x6f')]=function(){var _0x4a8865=this;return function(_0x44ae75){if(_0x44ae75){freeIsNotKey(_0x44ae75,_0x4a8865[_0xc6df('0x19')],'id');for(var _0x3f74b1=0x0,_0x225c7b={};_0x3f74b1<_0x44ae75['length'];_0x3f74b1+=0x1){_0x225c7b=_0x44ae75[_0x3f74b1];if(_[_0xc6df('0x47')](_0x4a8865['voiceExtensions'][_0x225c7b['id']])){_0x4a8865[_0xc6df('0x19')][_0x225c7b['id']]=new VoiceExtension(_0x225c7b);}else{_0x4a8865['mergeFromDatabase'](_0x4a8865['voiceExtensions'][_0x225c7b['id']],_0x225c7b);}}}return _0x4a8865['voiceExtensions'];};};Realtime[_0xc6df('0x42')]['initCampaignHopperHistory']=function(){var _0x36242e=this;return function(_0x29f10f){clearCampaigns(_0x36242e[_0xc6df('0x18')]);for(var _0x52a0f6=0x0;_0x52a0f6<_0x29f10f[_0xc6df('0x45')];_0x52a0f6+=0x1){_[_0xc6df('0x59')](_0x36242e['campaigns'][_0x29f10f[_0x52a0f6][_0xc6df('0x2a')]],_0x29f10f[_0x52a0f6]);}return _0x36242e[_0xc6df('0x18')];};};Realtime[_0xc6df('0x42')][_0xc6df('0x70')]=function(){var _0x5d90a9=this;return function(_0x4075ec){if(_0x4075ec){freeIsNotKey(_0x4075ec,_0x5d90a9[_0xc6df('0x28')],'id');for(var _0x1aa5dd=0x0,_0x1978ee={},_0x14b887={};_0x1aa5dd<_0x4075ec[_0xc6df('0x45')];_0x1aa5dd+=0x1){_0x1978ee=_0x4075ec[_0x1aa5dd];if(_[_0xc6df('0x47')](_0x5d90a9[_0xc6df('0x28')][_0x1978ee['id']])){_0x5d90a9[_0xc6df('0x28')][_0x1978ee['id']]=new FaxAccount(_0x1978ee);}else{_0x5d90a9['mergeFromDatabase'](_0x5d90a9[_0xc6df('0x28')][_0x1978ee['id']],_0x1978ee);}}}return _0x5d90a9[_0xc6df('0x28')];};};module[_0xc6df('0x71')]=Realtime; \ No newline at end of file +var _0x4b1c=['util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','agents','telephones','triggers','templates','outbound','voiceExtensions','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','initTelephones','mergeFromDatabase','initTrunks','trunks','isUndefined','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','seconds','duration','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','bluebird'];(function(_0x2a563c,_0x30138e){var _0x3bcc5a=function(_0x372ba9){while(--_0x372ba9){_0x2a563c['push'](_0x2a563c['shift']());}};_0x3bcc5a(++_0x30138e);}(_0x4b1c,0x143));var _0xc4b1=function(_0x3a0bd9,_0x3e872b){_0x3a0bd9=_0x3a0bd9-0x0;var _0x2c4879=_0x4b1c[_0x3a0bd9];return _0x2c4879;};'use strict';var BPromise=require(_0xc4b1('0x0'));var util=require(_0xc4b1('0x1'));var _=require(_0xc4b1('0x2'));var moment=require(_0xc4b1('0x3'));var Agent=require(_0xc4b1('0x4'));var Telephone=require(_0xc4b1('0x5'));var Trunk=require(_0xc4b1('0x6'));var VoiceQueue=require(_0xc4b1('0x7'));var Trigger=require(_0xc4b1('0x8'));var Template=require(_0xc4b1('0x9'));var Campaign=require(_0xc4b1('0xa'));var VoiceExtension=require(_0xc4b1('0xb'));var ZendeskAccount=require(_0xc4b1('0xc'));var SalesforceAccount=require(_0xc4b1('0xd'));var FreshdeskAccount=require(_0xc4b1('0xe'));var SugarcrmAccount=require(_0xc4b1('0xf'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xc4b1('0x10'));var VtigerAccount=require(_0xc4b1('0x11'));var ServicenowAccount=require(_0xc4b1('0x12'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xc4b1('0x13')]={};this[_0xc4b1('0x14')]={};this['trunks']={};this['voiceQueues']={};this[_0xc4b1('0x15')]={};this['campaigns']={};this[_0xc4b1('0x16')]={};this[_0xc4b1('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc4b1('0x18')]={};this[_0xc4b1('0x19')]={};this[_0xc4b1('0x1a')]={};this['outboundChannels']={};this[_0xc4b1('0x1b')]={};this['settings']={};this[_0xc4b1('0x1c')]={};this[_0xc4b1('0x1d')]={};this[_0xc4b1('0x1e')]={};this[_0xc4b1('0x1f')]={};this[_0xc4b1('0x20')]={};this['deskAccounts']={};this[_0xc4b1('0x21')]={};this[_0xc4b1('0x22')]={};this[_0xc4b1('0x23')]={};this[_0xc4b1('0x24')]={};this[_0xc4b1('0x25')]={};};function freeIsNotKey(_0x3dde87,_0x1e9495,_0x410b0b){var _0x3a59f3=_[_0xc4b1('0x26')](_0x3dde87,function(_0x5bb429,_0x12368b){return _0x5bb429[_0x410b0b];});for(var _0x1f9482 in _0x1e9495){if(_0x1e9495[_0xc4b1('0x27')](_0x1f9482)){if(!_0x3a59f3[_0x1f9482]){delete _0x1e9495[_0x1f9482];}}}}function freeIsNotKeySip(_0x87e24f,_0x3b6ee3){var _0x1e13b8=_[_0xc4b1('0x26')](_0x87e24f,function(_0x130e3d,_0x545a53){return util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x130e3d[_0xc4b1('0x2a')]);});for(var _0x382337 in _0x3b6ee3){if(_0x3b6ee3[_0xc4b1('0x27')](_0x382337)){if(!_0x1e13b8[_0x382337]){delete _0x3b6ee3[_0x382337];}}}}function freeIsNotKeyAgent(_0x3d15db,_0x791ae3){var _0x3a165d=_[_0xc4b1('0x26')](_0x3d15db,function(_0x40e66d,_0x811367){var _0x124b82=_[_0xc4b1('0x2b')](_0x40e66d['interface'])?util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x40e66d['name']):_0x40e66d[_0xc4b1('0x2c')];return _0x124b82;});for(var _0x306996 in _0x791ae3){if(_0x791ae3[_0xc4b1('0x27')](_0x306996)){if(!_0x3a165d[_0x306996]){delete _0x791ae3[_0x306996];}}}}function clearVoiceCallReports(_0x3a56db){_0x3a56db[_0xc4b1('0x2d')]=0x0;_0x3a56db[_0xc4b1('0x2e')]=0x0;_0x3a56db[_0xc4b1('0x2f')]=0x0;_0x3a56db[_0xc4b1('0x30')]=0x0;_0x3a56db['sumBillable']=0x0;}function clearCampaigns(_0x39a20b){if(!_[_0xc4b1('0x31')](_0x39a20b)){for(var _0x3e6199 in _0x39a20b){if(_0x39a20b[_0xc4b1('0x27')](_0x3e6199)){_0x39a20b[_0x3e6199][_0xc4b1('0x32')]=0x0;_0x39a20b[_0x3e6199][_0xc4b1('0x33')]=0x0;}}}}function clearVoiceQueues(_0x4132cb){if(!_[_0xc4b1('0x31')](_0x4132cb)){for(var _0x93dd0c in _0x4132cb){if(_0x4132cb[_0xc4b1('0x27')](_0x93dd0c)){_0x4132cb[_0x93dd0c][_0xc4b1('0x2d')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x2e')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x34')]=0x0;_0x4132cb[_0x93dd0c]['abandoned']=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x2f')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x30')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x35')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x36')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x37')]=0x0;_0x4132cb[_0x93dd0c]['outboundBusyCallsDay']=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x38')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x39')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3a')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3b')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3c')]=0x0;_0x4132cb[_0x93dd0c]['outboundBlacklistCallsDay']=0x0;_0x4132cb[_0x93dd0c]['outboundOriginateFailureCallsDay']=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3d')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3e')]=0x0;_0x4132cb[_0x93dd0c]['outboundAnswerAgiCallsDay']=0x0;_0x4132cb[_0x93dd0c]['outboundAnswerCallsDay']=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3f')]=!![];}}}}Realtime[_0xc4b1('0x40')]['mergeFromDatabase']=function(_0x379f74,_0xbde6ef){for(var _0x16d024 in _0xbde6ef){if(_0x379f74['hasOwnProperty'](_0x16d024)){_0x379f74[_0x16d024]=_0xbde6ef[_0x16d024];}}};Realtime[_0xc4b1('0x40')]['initAgents']=function(){var _0x2f06cd=this;return function(_0x3e974b){if(_0x3e974b){freeIsNotKeyAgent(_0x3e974b,_0x2f06cd['agents']);for(var _0x1d7178=0x0,_0x1737fb={},_0x2e31a7={};_0x1d7178<_0x3e974b[_0xc4b1('0x41')];_0x1d7178+=0x1){_0x1737fb=_0x3e974b[_0x1d7178];var _0x2bd5bf=_[_0xc4b1('0x2b')](_0x1737fb[_0xc4b1('0x2c')])?util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x1737fb[_0xc4b1('0x2a')]):_0x1737fb['interface'];if(_['isUndefined'](_0x2f06cd[_0xc4b1('0x13')][_0x2bd5bf])){_0x2f06cd[_0xc4b1('0x13')][_0x2bd5bf]=new Agent(_0x1737fb);}else{_0x2f06cd['mergeFromDatabase'](_0x2f06cd[_0xc4b1('0x13')][_0x2bd5bf],_0x1737fb);}}}return _0x2f06cd[_0xc4b1('0x13')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x42')]=function(){var _0xbeec57=this;return function(_0xd847c8){if(_0xd847c8){freeIsNotKeySip(_0xd847c8,_0xbeec57[_0xc4b1('0x14')]);for(var _0x3a9c33=0x0,_0x5020f3={},_0x35d34d={};_0x3a9c33<_0xd847c8['length'];_0x3a9c33+=0x1){_0x5020f3=_0xd847c8[_0x3a9c33];if(_['isUndefined'](_0xbeec57[_0xc4b1('0x14')][util['format'](_0xc4b1('0x29'),_0x5020f3['name'])])){_0xbeec57[_0xc4b1('0x14')][util[_0xc4b1('0x28')]('SIP/%s',_0x5020f3[_0xc4b1('0x2a')])]=new Telephone(_0x5020f3);}else{_0xbeec57[_0xc4b1('0x43')](_0xbeec57[_0xc4b1('0x14')][util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x5020f3[_0xc4b1('0x2a')])],_0x5020f3);}}}return _0xbeec57[_0xc4b1('0x14')];};};Realtime['prototype'][_0xc4b1('0x44')]=function(){var _0x1fbb10=this;return function(_0x5d018f){if(_0x5d018f){freeIsNotKeySip(_0x5d018f,_0x1fbb10[_0xc4b1('0x45')]);for(var _0x306db8=0x0,_0x21f78a={},_0x4cd4c1={};_0x306db8<_0x5d018f[_0xc4b1('0x41')];_0x306db8+=0x1){_0x21f78a=_0x5d018f[_0x306db8];if(_[_0xc4b1('0x46')](_0x1fbb10['trunks'][util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x21f78a['name'])])){_0x1fbb10[_0xc4b1('0x45')][util['format'](_0xc4b1('0x29'),_0x21f78a['name'])]=new Trunk(_0x21f78a);}else{_0x1fbb10[_0xc4b1('0x43')](_0x1fbb10[_0xc4b1('0x45')][util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x21f78a[_0xc4b1('0x2a')])],_0x21f78a);}}}return _0x1fbb10[_0xc4b1('0x45')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x47')]=function(){var _0x55737d=this;return function(_0x33e176){if(_0x33e176){freeIsNotKey(_0x33e176,_0x55737d[_0xc4b1('0x48')],'name');for(var _0x4e5db9=0x0,_0x313ae5={},_0x377f10={};_0x4e5db9<_0x33e176['length'];_0x4e5db9+=0x1){_0x313ae5=_0x33e176[_0x4e5db9];if(_['isUndefined'](_0x55737d[_0xc4b1('0x48')][_0x313ae5['name']])){_0x55737d[_0xc4b1('0x48')][_0x313ae5['name']]=new VoiceQueue(_0x313ae5);}else{_0x55737d[_0xc4b1('0x43')](_0x55737d[_0xc4b1('0x48')][_0x313ae5[_0xc4b1('0x2a')]],_0x313ae5);}}}return _0x55737d[_0xc4b1('0x48')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x49')]=function(){var _0x317e03=this;return function(_0x335ddf){if(_0x335ddf){freeIsNotKey(_0x335ddf,_0x317e03[_0xc4b1('0x15')],'id');for(var _0x52d52c=0x0,_0x3aa318={},_0x3bd96b={};_0x52d52c<_0x335ddf[_0xc4b1('0x41')];_0x52d52c+=0x1){_0x3aa318=_0x335ddf[_0x52d52c];if(_[_0xc4b1('0x46')](_0x317e03['triggers'][_0x3aa318['id']])){_0x317e03[_0xc4b1('0x15')][_0x3aa318['id']]=new Trigger(_0x3aa318);}else{_0x317e03[_0xc4b1('0x43')](_0x317e03[_0xc4b1('0x15')][_0x3aa318['id']],_0x3aa318);}}}return _0x317e03[_0xc4b1('0x15')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x4a')]=function(){var _0x3f3d51=this;return function(_0x33a73a){if(_0x33a73a){freeIsNotKey(_0x33a73a,_0x3f3d51[_0xc4b1('0x16')],'id');for(var _0x3563d1=0x0,_0x13260a={},_0x398eff={};_0x3563d1<_0x33a73a[_0xc4b1('0x41')];_0x3563d1+=0x1){_0x13260a=_0x33a73a[_0x3563d1];if(_[_0xc4b1('0x46')](_0x3f3d51[_0xc4b1('0x16')][_0x13260a['id']])){_0x3f3d51[_0xc4b1('0x16')][_0x13260a['id']]=new Template(_0x13260a);}else{_0x3f3d51[_0xc4b1('0x43')](_0x3f3d51['templates'][_0x13260a['id']],_0x13260a);}}}return _0x3f3d51[_0xc4b1('0x16')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x4e8fa5=this;return function(_0x353c0d){if(_0x353c0d){freeIsNotKey(_0x353c0d,_0x4e8fa5[_0xc4b1('0x1c')],'id');for(var _0x38f067=0x0,_0xa2c208={},_0x2f9703={};_0x38f067<_0x353c0d[_0xc4b1('0x41')];_0x38f067+=0x1){_0xa2c208=_0x353c0d[_0x38f067];if(_['isUndefined'](_0x4e8fa5['zendeskAccounts'][_0xa2c208['id']])){_0x4e8fa5['zendeskAccounts'][_0xa2c208['id']]=new ZendeskAccount(_0xa2c208);}else{_0x4e8fa5['mergeFromDatabase'](_0x4e8fa5['zendeskAccounts'][_0xa2c208['id']],_0xa2c208);}}}return _0x4e8fa5[_0xc4b1('0x1c')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x4b')]=function(){var _0x284572=this;return function(_0x11e430){if(_0x11e430){freeIsNotKey(_0x11e430,_0x284572[_0xc4b1('0x1d')],'id');for(var _0x1da8ee=0x0,_0xd287e9={},_0x262f0a={};_0x1da8ee<_0x11e430[_0xc4b1('0x41')];_0x1da8ee+=0x1){_0xd287e9=_0x11e430[_0x1da8ee];if(_[_0xc4b1('0x46')](_0x284572[_0xc4b1('0x1d')][_0xd287e9['id']])){_0x284572[_0xc4b1('0x1d')][_0xd287e9['id']]=new SalesforceAccount(_0xd287e9);}else{_0x284572['mergeFromDatabase'](_0x284572[_0xc4b1('0x1d')][_0xd287e9['id']],_0xd287e9);}}}return _0x284572[_0xc4b1('0x1d')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x4c')]=function(){var _0x9ba3fc=this;return function(_0x460e20){if(_0x460e20){freeIsNotKey(_0x460e20,_0x9ba3fc[_0xc4b1('0x1f')],'id');for(var _0x1a0ecf=0x0,_0xddc717={},_0x52adda={};_0x1a0ecf<_0x460e20[_0xc4b1('0x41')];_0x1a0ecf+=0x1){_0xddc717=_0x460e20[_0x1a0ecf];if(_['isUndefined'](_0x9ba3fc['freshdeskAccounts'][_0xddc717['id']])){_0x9ba3fc[_0xc4b1('0x1f')][_0xddc717['id']]=new FreshdeskAccount(_0xddc717);}else{_0x9ba3fc['mergeFromDatabase'](_0x9ba3fc[_0xc4b1('0x1f')][_0xddc717['id']],_0xddc717);}}}return _0x9ba3fc[_0xc4b1('0x1f')];};};Realtime[_0xc4b1('0x40')]['initZohoAccounts']=function(){var _0x4cb24a=this;return function(_0x56bb09){if(_0x56bb09){freeIsNotKey(_0x56bb09,_0x4cb24a['zohoAccounts'],'id');for(var _0x43faff=0x0,_0x2b33e4={},_0x3b91e={};_0x43faff<_0x56bb09[_0xc4b1('0x41')];_0x43faff+=0x1){_0x2b33e4=_0x56bb09[_0x43faff];if(_[_0xc4b1('0x46')](_0x4cb24a['zohoAccounts'][_0x2b33e4['id']])){_0x4cb24a[_0xc4b1('0x20')][_0x2b33e4['id']]=new ZohoAccount(_0x2b33e4);}else{_0x4cb24a[_0xc4b1('0x43')](_0x4cb24a['zohoAccounts'][_0x2b33e4['id']],_0x2b33e4);}}}return _0x4cb24a[_0xc4b1('0x20')];};};Realtime['prototype'][_0xc4b1('0x4d')]=function(){var _0x2fab6a=this;return function(_0x2b2c3c){if(_0x2b2c3c){freeIsNotKey(_0x2b2c3c,_0x2fab6a[_0xc4b1('0x4e')],'id');for(var _0x16932f=0x0,_0x5d0e4c={},_0x4eb12a={};_0x16932f<_0x2b2c3c['length'];_0x16932f+=0x1){_0x5d0e4c=_0x2b2c3c[_0x16932f];if(_[_0xc4b1('0x46')](_0x2fab6a[_0xc4b1('0x4e')][_0x5d0e4c['id']])){_0x2fab6a[_0xc4b1('0x4e')][_0x5d0e4c['id']]=new DeskAccount(_0x5d0e4c);}else{_0x2fab6a[_0xc4b1('0x43')](_0x2fab6a[_0xc4b1('0x4e')][_0x5d0e4c['id']],_0x5d0e4c);}}}return _0x2fab6a[_0xc4b1('0x4e')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x4f')]=function(){var _0x4a1078=this;return function(_0x6a6dce){if(_0x6a6dce){freeIsNotKey(_0x6a6dce,_0x4a1078[_0xc4b1('0x1e')],'id');for(var _0x2fe2c1=0x0,_0x5a502e={},_0x5978ab={};_0x2fe2c1<_0x6a6dce['length'];_0x2fe2c1+=0x1){_0x5a502e=_0x6a6dce[_0x2fe2c1];if(_[_0xc4b1('0x46')](_0x4a1078['sugarcrmAccounts'][_0x5a502e['id']])){_0x4a1078[_0xc4b1('0x1e')][_0x5a502e['id']]=new SugarcrmAccount(_0x5a502e);}else{_0x4a1078['mergeFromDatabase'](_0x4a1078[_0xc4b1('0x1e')][_0x5a502e['id']],_0x5a502e);}}}return _0x4a1078['sugarcrmAccounts'];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x50')]=function(){var _0x32a349=this;return function(_0x1b7630){if(_0x1b7630){freeIsNotKey(_0x1b7630,_0x32a349[_0xc4b1('0x21')],'id');for(var _0x177d86=0x0,_0x4860e5={},_0x1a58dc={};_0x177d86<_0x1b7630['length'];_0x177d86+=0x1){_0x4860e5=_0x1b7630[_0x177d86];if(_[_0xc4b1('0x46')](_0x32a349[_0xc4b1('0x21')][_0x4860e5['id']])){_0x32a349[_0xc4b1('0x21')][_0x4860e5['id']]=new VtigerAccount(_0x4860e5);}else{_0x32a349['mergeFromDatabase'](_0x32a349['vtigerAccounts'][_0x4860e5['id']],_0x4860e5);}}}return _0x32a349[_0xc4b1('0x21')];};};Realtime['prototype'][_0xc4b1('0x51')]=function(){var _0x100233=this;return function(_0x42424c){if(_0x42424c){freeIsNotKey(_0x42424c,_0x100233[_0xc4b1('0x22')],'id');for(var _0x3f5630=0x0,_0x13b4ff={},_0x359f2d={};_0x3f5630<_0x42424c[_0xc4b1('0x41')];_0x3f5630+=0x1){_0x13b4ff=_0x42424c[_0x3f5630];if(_[_0xc4b1('0x46')](_0x100233[_0xc4b1('0x22')][_0x13b4ff['id']])){_0x100233[_0xc4b1('0x22')][_0x13b4ff['id']]=new ServicenowAccount(_0x13b4ff);}else{_0x100233[_0xc4b1('0x43')](_0x100233[_0xc4b1('0x22')][_0x13b4ff['id']],_0x13b4ff);}}}return _0x100233[_0xc4b1('0x22')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x52')]=function(){var _0x2aa068=this;return function(_0x4c1ac1){if(_0x4c1ac1){freeIsNotKey(_0x4c1ac1,_0x2aa068['dynamics365Accounts'],'id');for(var _0x113261=0x0,_0x2907b5={},_0x5249b5={};_0x113261<_0x4c1ac1[_0xc4b1('0x41')];_0x113261+=0x1){_0x2907b5=_0x4c1ac1[_0x113261];if(_[_0xc4b1('0x46')](_0x2aa068['dynamics365Accounts'][_0x2907b5['id']])){_0x2aa068[_0xc4b1('0x23')][_0x2907b5['id']]=new Dynamics365Account(_0x2907b5);}else{_0x2aa068['mergeFromDatabase'](_0x2aa068[_0xc4b1('0x23')][_0x2907b5['id']],_0x2907b5);}}}return _0x2aa068[_0xc4b1('0x23')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x53')]=function(){var _0x2c852d=this;return function(_0x595e7c){if(_0x595e7c){freeIsNotKey(_0x595e7c,_0x2c852d[_0xc4b1('0x24')],'id');for(var _0x491951=0x0,_0x39d28e={},_0x2c6662={};_0x491951<_0x595e7c[_0xc4b1('0x41')];_0x491951+=0x1){_0x39d28e=_0x595e7c[_0x491951];if(_['isUndefined'](_0x2c852d[_0xc4b1('0x24')][_0x39d28e['id']])){_0x2c852d[_0xc4b1('0x24')][_0x39d28e['id']]=new FreshsalesAccount(_0x39d28e);}else{_0x2c852d[_0xc4b1('0x43')](_0x2c852d[_0xc4b1('0x24')][_0x39d28e['id']],_0x39d28e);}}}return _0x2c852d[_0xc4b1('0x24')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x54')]=function(){var _0x3da19e=this;return function(_0x5c6470){for(var _0x422602=0x0;_0x422602<_0x5c6470[_0xc4b1('0x41')];_0x422602+=0x1){_[_0xc4b1('0x55')](_0x3da19e['voiceQueues'][_0x5c6470[_0x422602][_0xc4b1('0x2a')]],_0x5c6470[_0x422602]);}return _0x3da19e[_0xc4b1('0x48')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x56')]=function(){var _0x2795b2=this;return function(_0x1a2f72){clearVoiceQueues(_0x2795b2[_0xc4b1('0x48')]);if(_0x1a2f72){_0x1a2f72=_[_0xc4b1('0x57')](_0x1a2f72,_0xc4b1('0x58'));for(var _0x5b6f76 in _0x1a2f72){if(_0x1a2f72[_0xc4b1('0x27')](_0x5b6f76)){var _0x26a781={};for(var _0x31945a=0x0;_0x31945a<_0x1a2f72[_0x5b6f76][_0xc4b1('0x41')];_0x31945a+=0x1){var _0x325f9e=_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x59')];if(_0x2795b2[_0xc4b1('0x48')][_0x325f9e]){if(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5a')]){_0x2795b2[_0xc4b1('0x48')][_0x325f9e][_0xc4b1('0x34')]+=0x1;}if(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5b')]){_0x2795b2[_0xc4b1('0x48')][_0x325f9e][_0xc4b1('0x5c')]+=0x1;}_0x2795b2['voiceQueues'][_0x325f9e][_0xc4b1('0x2f')]+=moment(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5d')])[_0xc4b1('0x5e')](moment(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5f')]),'seconds')||0x0;if(_0x31945a===_0x1a2f72[_0x5b6f76][_0xc4b1('0x41')]-0x1){_0x2795b2[_0xc4b1('0x48')][_0x325f9e][_0xc4b1('0x30')]+=moment(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x60')]||_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x61')]||_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x62')])[_0xc4b1('0x5e')](moment(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5f')]),'seconds')||0x0;_0x2795b2[_0xc4b1('0x48')][_0x325f9e][_0xc4b1('0x2d')]+=0x1;if(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x63')]){_0x2795b2[_0xc4b1('0x48')][_0x325f9e][_0xc4b1('0x2e')]+=0x1;_0x2795b2['voiceQueues'][_0x325f9e][_0xc4b1('0x35')]+=moment(_0x1a2f72[_0x5b6f76][_0x31945a]['queuecallercompleteAt'])[_0xc4b1('0x5e')](moment(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5d')]),_0xc4b1('0x64'))||0x0;}}else{_0x2795b2['voiceQueues'][_0x325f9e][_0xc4b1('0x30')]+=_0x2795b2['voiceQueues'][_0x325f9e][_0xc4b1('0x2f')]||0x0;}}}}}}return _0x2795b2[_0xc4b1('0x48')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x1f97c2=this;return function(_0x50fe71){clearVoiceCallReports(_0x1f97c2[_0xc4b1('0x17')]);if(_0x50fe71){for(var _0x44bfa7=0x0;_0x44bfa7<_0x50fe71[_0xc4b1('0x41')];_0x44bfa7+=0x1){_0x1f97c2['outbound'][_0xc4b1('0x2d')]+=0x1;_0x1f97c2[_0xc4b1('0x17')][_0xc4b1('0x30')]+=_0x50fe71[_0x44bfa7]['duration'];if(_0x50fe71[_0x44bfa7]['disposition']==='ANSWERED'){_0x1f97c2[_0xc4b1('0x17')]['answered']+=0x1;_0x1f97c2[_0xc4b1('0x17')][_0xc4b1('0x2f')]+=_0x50fe71[_0x44bfa7][_0xc4b1('0x65')]-_0x50fe71[_0x44bfa7]['billableseconds']||0x0;_0x1f97c2[_0xc4b1('0x17')]['sumBillable']+=_0x50fe71[_0x44bfa7]['billableseconds'];}}}return _0x1f97c2['outbound'];};};Realtime['prototype'][_0xc4b1('0x66')]=function(){var _0x1fa6c7=this;return function(_0x36fc78){if(_0x36fc78){freeIsNotKey(_0x36fc78,_0x1fa6c7['campaigns'],_0xc4b1('0x2a'));for(var _0x7d515a=0x0,_0x579597={};_0x7d515a<_0x36fc78[_0xc4b1('0x41')];_0x7d515a+=0x1){_0x579597=_0x36fc78[_0x7d515a];if(_[_0xc4b1('0x46')](_0x1fa6c7[_0xc4b1('0x67')][_0x579597[_0xc4b1('0x2a')]])){_0x1fa6c7['campaigns'][_0x579597[_0xc4b1('0x2a')]]=new Campaign(_0x579597);}else{_0x1fa6c7[_0xc4b1('0x43')](_0x1fa6c7['campaigns'][_0x579597[_0xc4b1('0x2a')]],_0x579597);_0x1fa6c7[_0xc4b1('0x67')][_0x579597[_0xc4b1('0x2a')]][_0xc4b1('0x68')]=_0x579597[_0xc4b1('0x69')]?_0x579597[_0xc4b1('0x69')][_0xc4b1('0x2a')]:undefined;}}}return _0x1fa6c7[_0xc4b1('0x67')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x6a')]=function(){var _0x438597=this;return function(_0x1a9356){if(_0x1a9356){freeIsNotKey(_0x1a9356,_0x438597[_0xc4b1('0x18')],'id');for(var _0x488bb9=0x0,_0x19acbf={};_0x488bb9<_0x1a9356[_0xc4b1('0x41')];_0x488bb9+=0x1){_0x19acbf=_0x1a9356[_0x488bb9];if(_[_0xc4b1('0x46')](_0x438597['voiceExtensions'][_0x19acbf['id']])){_0x438597['voiceExtensions'][_0x19acbf['id']]=new VoiceExtension(_0x19acbf);}else{_0x438597[_0xc4b1('0x43')](_0x438597[_0xc4b1('0x18')][_0x19acbf['id']],_0x19acbf);}}}return _0x438597['voiceExtensions'];};};Realtime[_0xc4b1('0x40')]['initCampaignHopperHistory']=function(){var _0x58107d=this;return function(_0xdcbe4b){clearCampaigns(_0x58107d['campaigns']);for(var _0x4e7e26=0x0;_0x4e7e26<_0xdcbe4b[_0xc4b1('0x41')];_0x4e7e26+=0x1){_[_0xc4b1('0x55')](_0x58107d[_0xc4b1('0x67')][_0xdcbe4b[_0x4e7e26][_0xc4b1('0x2a')]],_0xdcbe4b[_0x4e7e26]);}return _0x58107d['campaigns'];};};Realtime['prototype'][_0xc4b1('0x6b')]=function(){var _0x23db4e=this;return function(_0x32fd75){if(_0x32fd75){freeIsNotKey(_0x32fd75,_0x23db4e[_0xc4b1('0x25')],'id');for(var _0x376736=0x0,_0x4ea096={},_0x6224c3={};_0x376736<_0x32fd75[_0xc4b1('0x41')];_0x376736+=0x1){_0x4ea096=_0x32fd75[_0x376736];if(_['isUndefined'](_0x23db4e[_0xc4b1('0x25')][_0x4ea096['id']])){_0x23db4e[_0xc4b1('0x25')][_0x4ea096['id']]=new FaxAccount(_0x4ea096);}else{_0x23db4e['mergeFromDatabase'](_0x23db4e[_0xc4b1('0x25')][_0x4ea096['id']],_0x4ea096);}}}return _0x23db4e[_0xc4b1('0x25')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index cb7ed58..e2a11b4 100644 --- a/server/services/ami/report/index.js +++ b/server/services/ami/report/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd392=['lastapplication','queue','lastdata','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','membername','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','voiceDialReport','transfererlinkedid','lodash','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','bind','voiceCallReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','find','interface','format','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','isNil','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','channel','split','calleridnum','outbound','destination','exten','type'];(function(_0x494986,_0x4debb8){var _0x1c805b=function(_0x53fd4a){while(--_0x53fd4a){_0x494986['push'](_0x494986['shift']());}};_0x1c805b(++_0x4debb8);}(_0xd392,0x19e));var _0x2d39=function(_0xbde176,_0x3f79cf){_0xbde176=_0xbde176-0x0;var _0xfef964=_0xd392[_0xbde176];return _0xfef964;};'use strict';var _=require(_0x2d39('0x0'));var moment=require('moment');var util=require(_0x2d39('0x1'));var config=require(_0x2d39('0x2'));var ami=require(_0x2d39('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x2d39('0x4'));var RpcMemberReport=require(_0x2d39('0x5'));var RpcVoiceQueueReport=require(_0x2d39('0x6'));var RpcVoiceRecording=require(_0x2d39('0x7'));var RpcVoiceTransferReport=require(_0x2d39('0x8'));var VoiceQueueReport=require(_0x2d39('0x9'));var VoiceCallReport=require(_0x2d39('0xa'));var VoiceAgentReport=require(_0x2d39('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x2d39('0xc'));function Report(_0x3838fd){this[_0x2d39('0xd')]=_0x3838fd;this[_0x2d39('0xe')]=_0x3838fd[_0x2d39('0xe')];this[_0x2d39('0xf')]=_0x3838fd[_0x2d39('0xf')];}Report[_0x2d39('0x10')][_0x2d39('0x11')]=function(_0x3a3dea){var _0x941737=new VoiceQueueReport(this[_0x2d39('0xd')]);var _0x46bb32=new VoiceAgentReport(this['realtime']);var _0x41cd19=new VoiceDialReport(this[_0x2d39('0xd')]);var _0x4aba0d=new VoiceCallReport(this[_0x2d39('0xd')]);var _0x4210ea=new UserReport(this[_0x2d39('0xd')]);if(config[_0x2d39('0x12')]&&config[_0x2d39('0x12')]['disabled']){ami['on'](_0x2d39('0x13'),this['voiceQueueReport'][_0x2d39('0x14')](this));ami['on']('custom:voiceCallReport',this[_0x2d39('0x15')][_0x2d39('0x14')](this));ami['on']('custom:voiceAgentReport',this[_0x2d39('0x16')][_0x2d39('0x14')](this));ami['on'](_0x2d39('0x17'),this['voiceDialReport']['bind'](this));ami['on'](_0x2d39('0x18'),this[_0x2d39('0x19')]['bind'](this));ami['on'](_0x2d39('0x1a'),this[_0x2d39('0x1b')]['bind'](this));}};Report['prototype'][_0x2d39('0x1c')]=function(_0x4c18a5){var _0x501daf;_0x501daf=_['find'](this[_0x2d39('0xe')],function(_0x13a4f9){return _0x13a4f9[_0x2d39('0x1d')]==_0x4c18a5||_0x13a4f9[_0x2d39('0x1e')]==_0x4c18a5;});if(_['isNil'](_0x501daf)){var _0x28db0c=_[_0x2d39('0x1f')](this[_0x2d39('0xf')],function(_0x2d5f54){return _0x2d5f54['accountcode']==_0x4c18a5||_0x2d5f54[_0x2d39('0x1e')]==_0x4c18a5;});if(_0x28db0c){_0x501daf=_[_0x2d39('0x1f')](this[_0x2d39('0xe')],function(_0x3a0f99){return _0x3a0f99[_0x2d39('0x20')]==util[_0x2d39('0x21')](_0x2d39('0x22'),_0x28db0c[_0x2d39('0x1e')]);});}}return _0x501daf;};Report[_0x2d39('0x10')][_0x2d39('0x23')]=function(_0x315e3c){for(var _0x2f0cf6=0x0;_0x2f0cf6<_0x315e3c[_0x2d39('0x24')];_0x2f0cf6+=0x1){var _0x2b1b18=this[_0x2d39('0x1c')](_0x315e3c[_0x2f0cf6][_0x2d39('0x25')]);if(_0x2b1b18){_0x315e3c[_0x2f0cf6]['accountcode']=_0x2b1b18['accountcode'];_0x315e3c[_0x2f0cf6][_0x2d39('0x26')]=!![];_0x315e3c[_0x2f0cf6]['lastAssignedTo']=_0x2b1b18[_0x2d39('0x1e')];_0x315e3c[_0x2f0cf6][_0x2d39('0x20')]=_[_0x2d39('0x27')](_0x2b1b18[_0x2d39('0x20')])?util[_0x2d39('0x21')](_0x2d39('0x22'),_0x2b1b18[_0x2d39('0x1e')]):_0x2b1b18['interface'];if(_0x315e3c[_0x2f0cf6][_0x2d39('0x28')]){_0x315e3c[_0x2f0cf6][_0x2d39('0x29')]=moment()[_0x2d39('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x315e3c[_0x2f0cf6][_0x2d39('0x2a')]){_0x315e3c[_0x2f0cf6][_0x2d39('0x2b')]=moment()[_0x2d39('0x21')](_0x2d39('0x2c'));}RpcMemberReport['voiceQueueReport'](_0x315e3c[_0x2f0cf6]);}RpcVoiceQueueReport[_0x2d39('0x2d')](_0x315e3c[_0x2f0cf6]);}};function extractCalleridNumber(_0x2f80d2){var _0x10f8a3=_0x2f80d2[_0x2d39('0x2e')](/<(.*?)>/);return _0x10f8a3?_0x10f8a3[0x1]:_0x2f80d2;}Report['prototype'][_0x2d39('0x2f')]=function(_0x2a9d5f){for(var _0x99ff29=0x0;_0x99ff29/);return _0x53fc60?_0x53fc60[0x1]:_0x4b020d;}Report[_0xc22d('0xf')][_0xc22d('0x2c')]=function(_0x4f0816){for(var _0x2d64e7=0x0;_0x2d64e7',_0x1ac742[_0xc22d('0x42')],_0x1ac742[_0xc22d('0x30')]);}if(RpcVoiceTransferReport[_0xc22d('0x43')][_0x1ac742['linkedid']]){var _0x380313=RpcVoiceTransferReport[_0xc22d('0x43')][_0x1ac742[_0xc22d('0x44')]];_0x380313[_0xc22d('0x45')]=_0x1ac742[_0xc22d('0x46')];RpcVoiceTransferReport[_0xc22d('0x1b')](_0x380313);delete RpcVoiceTransferReport[_0xc22d('0x43')][_0x1ac742[_0xc22d('0x44')]];}if(_[_0xc22d('0x25')](_0x1ac742[_0xc22d('0x47')])){_0x1ac742['type']=this['getCallType'](_0x1ac742);}if(_[_0xc22d('0x25')](_0x1ac742['UserId'])){var _0x5c5ec3=_0x1ac742['channel'][_0xc22d('0x2f')]('-')[0x0];var _0x1cde98=this[_0xc22d('0xd')][_0x5c5ec3];if(!_0x1cde98)_0x1cde98=this[_0xc22d('0x2c')](_0x1ac742[_0xc22d('0x20')]);if(_0x1cde98){_0x1ac742['UserId']=_0x1cde98['id'];_0x1ac742[_0xc22d('0x48')]=_0x1cde98['name'];}}RpcVoiceCallReport[_0xc22d('0x2b')](_0x1ac742);if(_0x1ac742['monitor']){for(var _0x1db2ca=0x0;_0x1db2ca<_0x1ac742[_0xc22d('0x49')]['length'];_0x1db2ca+=0x1){_0x1ac742[_0xc22d('0x4a')]=_0x1ac742['monitors'][_0x1db2ca][_0xc22d('0x4b')];_0x1ac742[_0xc22d('0x4c')]=_0x1ac742['monitors'][_0x1db2ca][_0xc22d('0x4c')];if(_0x1ac742['exten']==_0xc22d('0x4d')){_0x1ac742['calleridnum']=_0x1ac742[_0xc22d('0x41')];_0x1ac742[_0xc22d('0x42')]=_0x1ac742['connectedlinename'];_0x1ac742[_0xc22d('0x41')]=_0x1ac742[_0xc22d('0x20')];_0x1ac742[_0xc22d('0x4e')]=_0x1ac742['membername'];_0x1ac742[_0xc22d('0x34')]=_0x1ac742['originatecalleridnum'];}else if(_0x1ac742['exten']=='xcally-motion-dialer'){_0x1ac742[_0xc22d('0x30')]=_0x1ac742[_0xc22d('0x33')];_0x1ac742[_0xc22d('0x34')]=_0x1ac742[_0xc22d('0x3c')];}RpcVoiceRecording[_0xc22d('0x2b')](_0x1ac742);}}};Report[_0xc22d('0xf')][_0xc22d('0x17')]=function(_0x153a1f){if(_[_0xc22d('0x4f')](_0x153a1f)){_0x153a1f[_0xc22d('0x50')](function(_0x22194d){RpcVoiceAgentReport['create'](_0x22194d);});}else{RpcVoiceAgentReport[_0xc22d('0x2b')](_0x153a1f);}};Report[_0xc22d('0xf')][_0xc22d('0x19')]=function(_0x15fa14){RpcVoiceDialReport[_0xc22d('0x2b')](_0x15fa14);var _0x245a90;var _0x38fcc1;var _0xc34d09=_0x15fa14[_0xc22d('0x2e')];if(_[_0xc22d('0x51')](_0xc34d09,_0xc22d('0x52'))){_0x38fcc1=_0xc34d09[_0xc22d('0x53')](_0xc34d09[_0xc22d('0x54')]('/')+0x1,_0xc34d09[_0xc22d('0x54')]('@'));_0x245a90=_['find'](this[_0xc22d('0xd')],function(_0x1d17d5){return _0x1d17d5[_0xc22d('0x55')]==_0x38fcc1||_0x1d17d5[_0xc22d('0x56')]==_0x38fcc1||_0x1d17d5['accountcode']==_0x38fcc1;});}else{_0x38fcc1=_0xc34d09[_0xc22d('0x53')](_0xc34d09[_0xc22d('0x54')]('/')+0x1,_0xc34d09[_0xc22d('0x57')]('-'));_0x245a90=this[_0xc22d('0x1e')](_0x38fcc1);}if(_0x245a90){_0x15fa14[_0xc22d('0x26')]=_['isNil'](_0x245a90[_0xc22d('0x26')])?util[_0xc22d('0x21')]('SIP/%s',_0x245a90[_0xc22d('0x22')]):_0x245a90['interface'];_0x15fa14[_0xc22d('0x48')]=_0x245a90['name'];_0x15fa14[_0xc22d('0x20')]=_0x245a90[_0xc22d('0x20')];RpcMemberReport[_0xc22d('0x19')](_0x15fa14);}};Report[_0xc22d('0xf')][_0xc22d('0x1b')]=function(_0x452ef1){RpcVoiceTransferReport[_0xc22d('0x43')][_0x452ef1[_0xc22d('0x58')]]=_0x452ef1;};Report[_0xc22d('0xf')][_0xc22d('0x1d')]=function(_0x5da085){RpcVoiceTransferReport['attendedTransfer'](_0x5da085);};module[_0xc22d('0x59')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 0487daf..332bddb 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a21=['resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','error','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','stateRegistry','state','merge','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','agents','device','local','toLowerCase','toNumber','updateStatusRealtime','stateTime','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','name','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','substring','find','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','redis','trunks','telephones','registryentry','syncRegistry','registry','devicestatechange','syncDeviceState','bind','peerstatus','syncPeerStatus','syncRealtimeShow'];(function(_0x112df1,_0x13fb0d){var _0x78fdfa=function(_0x2635b8){while(--_0x2635b8){_0x112df1['push'](_0x112df1['shift']());}};_0x78fdfa(++_0x13fb0d);}(_0x5a21,0xd7));var _0x15a2=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x5a21[_0x397cfb];return _0x15fed9;};'use strict';var _=require('lodash');var moment=require(_0x15a2('0x0'));var util=require(_0x15a2('0x1'));var Redis=require(_0x15a2('0x2'));var BPromise=require(_0x15a2('0x3'));var config=require(_0x15a2('0x4'));var logger=require(_0x15a2('0x5'))(_0x15a2('0x6'));var ami=require(_0x15a2('0x7'));config['redis']=_[_0x15a2('0x8')](config['redis'],{'host':_0x15a2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x15a2('0xa')]));function UserReport(_0x11a0de){this[_0x15a2('0xb')]=_0x11a0de[_0x15a2('0xb')];this['agents']=_0x11a0de['agents'];this[_0x15a2('0xc')]=_0x11a0de[_0x15a2('0xc')];ami['on'](_0x15a2('0xd'),this[_0x15a2('0xe')]['bind'](this));ami['on'](_0x15a2('0xf'),this[_0x15a2('0xe')]['bind'](this));ami['on'](_0x15a2('0x10'),this[_0x15a2('0x11')][_0x15a2('0x12')](this));ami['on'](_0x15a2('0x13'),this[_0x15a2('0x14')][_0x15a2('0x12')](this));return this[_0x15a2('0x15')]();}function showSipRegistrations(){Promise[_0x15a2('0x16')]()[_0x15a2('0x17')](ami[_0x15a2('0x18')]())[_0x15a2('0x19')](function(_0x15685f){logger['error'](_0x15a2('0x1a'),util[_0x15a2('0x1b')](_0x15685f,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x15a2('0x16')]()['then'](ami[_0x15a2('0x1c')]())[_0x15a2('0x19')](function(_0x2de921){logger['error'](_0x15a2('0x1d'),util[_0x15a2('0x1b')](_0x2de921,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x15a2('0x16')]()[_0x15a2('0x17')](ami['actionSipPeerStatus']())[_0x15a2('0x19')](function(_0x4f19e4){logger[_0x15a2('0x1e')](_0x15a2('0x1f'),util[_0x15a2('0x1b')](_0x4f19e4,{'showHidden':![],'depth':null}));});}UserReport[_0x15a2('0x20')][_0x15a2('0x15')]=function(){setInterval(function(){BPromise[_0x15a2('0x16')]()[_0x15a2('0x17')](showSipRegistrations())[_0x15a2('0x17')](listDeviceStates())[_0x15a2('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x15a2('0x20')][_0x15a2('0x21')]=function(_0x1d7d3a){return _0x1d7d3a!==null&&!_[_0x15a2('0x22')](_0x1d7d3a);};UserReport[_0x15a2('0x20')]['emit']=function(_0x151f57,_0x450650,_0x3d8a1b){io['to'](_0x151f57)[_0x15a2('0x23')](_0x450650,_0x3d8a1b);};UserReport['prototype']['syncRegistry']=function(_0x1a9c15){try{if(this[_0x15a2('0x21')](_0x1a9c15)){logger['info'](_0x15a2('0x24'),_0x1a9c15[_0x15a2('0x25')],_0x1a9c15['state']);logger[_0x15a2('0x26')]('[userReport][registry]',util[_0x15a2('0x1b')](_0x1a9c15,{'showHidden':![],'depth':null}));var _0x5b7710=_['find'](this[_0x15a2('0xb')],{'defaultuser':_0x1a9c15[_0x15a2('0x25')]});if(_0x5b7710){_0x1a9c15[_0x15a2('0x27')]=_0x1a9c15[_0x15a2('0x28')];_[_0x15a2('0x29')](_0x5b7710,_[_0x15a2('0x2a')](_0x1a9c15,['event',_0x15a2('0x2b'),_0x15a2('0x25'),'state']));logger[_0x15a2('0x26')](_0x15a2('0x2c'),util[_0x15a2('0x1b')](_0x5b7710,{'showHidden':![],'depth':null}));this[_0x15a2('0x23')](util['format'](_0x15a2('0x2d'),_0x5b7710['name']),'trunk:save',_0x5b7710);}}}catch(_0x40ab11){logger[_0x15a2('0x1e')]('[userReport][registry]',util['inspect'](_0x40ab11,{'showHidden':![],'depth':null}));}};UserReport[_0x15a2('0x20')][_0x15a2('0x11')]=function(_0xe0a88b){try{if(this[_0x15a2('0x21')](_0xe0a88b)){logger[_0x15a2('0x2e')](_0x15a2('0x2f'),_0xe0a88b['device'],_0xe0a88b[_0x15a2('0x28')]);logger[_0x15a2('0x26')](_0x15a2('0x30'),util[_0x15a2('0x1b')](_0xe0a88b,{'showHidden':![],'depth':null}));if(this['agents'][_0xe0a88b['device']]){if(!this[_0x15a2('0x31')][_0xe0a88b[_0x15a2('0x32')]][_0x15a2('0x33')]||_0xe0a88b[_0x15a2('0x28')][_0x15a2('0x34')]()=='inuse'){this[_0x15a2('0x31')][_0xe0a88b[_0x15a2('0x32')]][_0x15a2('0x33')]=![];if(this[_0x15a2('0x31')][_0xe0a88b[_0x15a2('0x32')]][_0x15a2('0x28')]!==_0xe0a88b[_0x15a2('0x28')][_0x15a2('0x34')]()){this['agents'][_0xe0a88b['device']]['stateTime']=_[_0x15a2('0x35')](moment()['format']('x'));}this[_0x15a2('0x31')][_0xe0a88b['device']]['state']=_0xe0a88b[_0x15a2('0x28')]['toLowerCase']();this[_0x15a2('0x31')][_0xe0a88b['device']][_0x15a2('0x36')](_0xe0a88b);}}else if(this[_0x15a2('0xc')][_0xe0a88b[_0x15a2('0x32')]]){if(this[_0x15a2('0xc')][_0xe0a88b['device']][_0x15a2('0x28')]!==_0xe0a88b[_0x15a2('0x28')][_0x15a2('0x34')]()){this[_0x15a2('0xc')][_0xe0a88b[_0x15a2('0x32')]][_0x15a2('0x37')]=_[_0x15a2('0x35')](moment()[_0x15a2('0x38')]('x'));}this[_0x15a2('0xc')][_0xe0a88b['device']][_0x15a2('0x28')]=_0xe0a88b[_0x15a2('0x28')][_0x15a2('0x34')]();logger[_0x15a2('0x26')](_0x15a2('0x39'),util[_0x15a2('0x1b')](this[_0x15a2('0xc')][_0xe0a88b[_0x15a2('0x32')]],{'showHidden':![],'depth':null}));this[_0x15a2('0x23')](util['format']('telephone:%s',this[_0x15a2('0xc')][_0xe0a88b[_0x15a2('0x32')]][_0x15a2('0x3a')]),_0x15a2('0x3b'),this['telephones'][_0xe0a88b[_0x15a2('0x32')]]);}else if(this[_0x15a2('0xb')][_0xe0a88b[_0x15a2('0x32')]]){if(this[_0x15a2('0xb')][_0xe0a88b[_0x15a2('0x32')]][_0x15a2('0x28')]!==_0xe0a88b['state']['toLowerCase']()){this[_0x15a2('0xb')][_0xe0a88b[_0x15a2('0x32')]]['stateTime']=_[_0x15a2('0x35')](moment()[_0x15a2('0x38')]('x'));}this[_0x15a2('0xb')][_0xe0a88b[_0x15a2('0x32')]][_0x15a2('0x28')]=_0xe0a88b[_0x15a2('0x28')]['toLowerCase']();logger[_0x15a2('0x26')](_0x15a2('0x3c'),util[_0x15a2('0x1b')](this[_0x15a2('0xb')][_0xe0a88b[_0x15a2('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x15a2('0x38')]('trunk:%s',this[_0x15a2('0xb')][_0xe0a88b[_0x15a2('0x32')]][_0x15a2('0x3a')]),_0x15a2('0x3d'),this[_0x15a2('0xb')][_0xe0a88b[_0x15a2('0x32')]]);}else if(_[_0x15a2('0x3e')](_0xe0a88b['device'],_0x15a2('0x3f'))){var _0x286712=_0xe0a88b[_0x15a2('0x32')];var _0x3ea935=_0x286712[_0x15a2('0x40')](_0x286712['indexOf']('/')+0x1,_0x286712['indexOf']('@'));var _0x1be788=_[_0x15a2('0x41')](this[_0x15a2('0x31')],function(_0x3741be){return _0x3741be[_0x15a2('0x42')]==_0x3ea935||_0x3741be[_0x15a2('0x43')]==_0x3ea935||_0x3741be[_0x15a2('0x44')]==_0x3ea935;});if(_0x1be788){if(_0x1be788[_0x15a2('0x28')]!==_0xe0a88b[_0x15a2('0x28')][_0x15a2('0x34')]()){_0x1be788['stateTime']=_[_0x15a2('0x35')](moment()[_0x15a2('0x38')]('x'));}_0x1be788[_0x15a2('0x28')]=_0xe0a88b[_0x15a2('0x28')][_0x15a2('0x34')]();_0x1be788[_0x15a2('0x33')]=!![];_0x1be788[_0x15a2('0x36')](_0xe0a88b);}}}}catch(_0x33d613){logger[_0x15a2('0x1e')](_0x15a2('0x30'),util['inspect'](_0x33d613,{'showHidden':![],'depth':null}));}};UserReport[_0x15a2('0x20')]['syncPeerStatus']=function(_0x17d0f8){try{if(this[_0x15a2('0x21')](_0x17d0f8)&&this[_0x15a2('0x21')](_0x17d0f8[_0x15a2('0x13')])){logger['info'](_0x15a2('0x45'),_0x17d0f8[_0x15a2('0x46')],_0x17d0f8[_0x15a2('0x47')],_0x17d0f8['peerstatus']);logger[_0x15a2('0x26')](_0x15a2('0x48'),util[_0x15a2('0x1b')](_0x17d0f8,{'showHidden':![],'depth':null}));if(this[_0x15a2('0x31')][_0x17d0f8[_0x15a2('0x46')]]){if(!this[_0x15a2('0x31')][_0x17d0f8[_0x15a2('0x46')]][_0x15a2('0x33')]||_0x17d0f8['peerstatus'][_0x15a2('0x34')]()==_0x15a2('0x49')){this[_0x15a2('0x31')][_0x17d0f8[_0x15a2('0x46')]][_0x15a2('0x33')]=![];this['agents'][_0x17d0f8[_0x15a2('0x46')]][_0x15a2('0x4a')]=_0x17d0f8[_0x15a2('0x13')][_0x15a2('0x34')]();this[_0x15a2('0x31')][_0x17d0f8[_0x15a2('0x46')]][_0x15a2('0x47')]=_0x17d0f8[_0x15a2('0x47')];this[_0x15a2('0x31')][_0x17d0f8[_0x15a2('0x46')]][_0x15a2('0x36')](_0x17d0f8);}}else if(this[_0x15a2('0xc')][_0x17d0f8[_0x15a2('0x46')]]){this[_0x15a2('0xc')][_0x17d0f8['peer']][_0x15a2('0x4a')]=_0x17d0f8[_0x15a2('0x13')][_0x15a2('0x34')]();this[_0x15a2('0xc')][_0x17d0f8['peer']][_0x15a2('0x47')]=_0x17d0f8[_0x15a2('0x47')];logger[_0x15a2('0x26')](_0x15a2('0x4b'),util[_0x15a2('0x1b')](this[_0x15a2('0xc')][_0x17d0f8[_0x15a2('0x46')]],{'showHidden':![],'depth':null}));this[_0x15a2('0x23')](util[_0x15a2('0x38')](_0x15a2('0x4c'),this[_0x15a2('0xc')][_0x17d0f8[_0x15a2('0x46')]]['name']),_0x15a2('0x3b'),this['telephones'][_0x17d0f8[_0x15a2('0x46')]]);}else if(this[_0x15a2('0xb')][_0x17d0f8[_0x15a2('0x46')]]){this[_0x15a2('0xb')][_0x17d0f8['peer']][_0x15a2('0x4a')]=_0x17d0f8[_0x15a2('0x13')][_0x15a2('0x34')]();this[_0x15a2('0xb')][_0x17d0f8['peer']][_0x15a2('0x47')]=_0x17d0f8[_0x15a2('0x47')];logger[_0x15a2('0x26')](_0x15a2('0x4d'),util[_0x15a2('0x1b')](this[_0x15a2('0xb')][_0x17d0f8['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0x15a2('0x38')](_0x15a2('0x2d'),this['trunks'][_0x17d0f8[_0x15a2('0x46')]][_0x15a2('0x3a')]),_0x15a2('0x3d'),this[_0x15a2('0xb')][_0x17d0f8[_0x15a2('0x46')]]);}}}catch(_0x45efae){logger[_0x15a2('0x1e')]('[userReport][peerstatus]',util[_0x15a2('0x1b')](_0x45efae,{'showHidden':![],'depth':null}));}};module[_0x15a2('0x4e')]=UserReport; \ No newline at end of file +var _0xe78e=['[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','mobile','phone','accountcode','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','peerstatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','resolve','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','merge','omit','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','emit','format','trunk:%s','name','trunk:save','syncDeviceState','isNotNull','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe78e,0x1f0));var _0xee78=function(_0x43b7c5,_0x51de4f){_0x43b7c5=_0x43b7c5-0x0;var _0x324bad=_0xe78e[_0x43b7c5];return _0x324bad;};'use strict';var _=require(_0xee78('0x0'));var moment=require(_0xee78('0x1'));var util=require(_0xee78('0x2'));var Redis=require(_0xee78('0x3'));var BPromise=require(_0xee78('0x4'));var config=require(_0xee78('0x5'));var logger=require(_0xee78('0x6'))(_0xee78('0x7'));var ami=require(_0xee78('0x8'));config[_0xee78('0x9')]=_['defaults'](config[_0xee78('0x9')],{'host':_0xee78('0xa'),'port':0x18eb});var io=require(_0xee78('0xb'))(new Redis(config['redis']));function UserReport(_0x54432e){this[_0xee78('0xc')]=_0x54432e[_0xee78('0xc')];this['agents']=_0x54432e[_0xee78('0xd')];this[_0xee78('0xe')]=_0x54432e[_0xee78('0xe')];ami['on'](_0xee78('0xf'),this[_0xee78('0x10')][_0xee78('0x11')](this));ami['on'](_0xee78('0x12'),this[_0xee78('0x10')][_0xee78('0x11')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0xee78('0x11')](this));ami['on'](_0xee78('0x13'),this['syncPeerStatus'][_0xee78('0x11')](this));return this[_0xee78('0x14')]();}function showSipRegistrations(){Promise['resolve']()[_0xee78('0x15')](ami[_0xee78('0x16')]())[_0xee78('0x17')](function(_0x231a57){logger[_0xee78('0x18')](_0xee78('0x19'),util['inspect'](_0x231a57,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xee78('0x1a')]()['then'](ami['actionDeviceStateList']())[_0xee78('0x17')](function(_0x57511e){logger['error']('[userReport][devicestatelist]',util[_0xee78('0x1b')](_0x57511e,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xee78('0x1a')]()[_0xee78('0x15')](ami[_0xee78('0x1c')]())[_0xee78('0x17')](function(_0x4d8d66){logger[_0xee78('0x18')](_0xee78('0x1d'),util[_0xee78('0x1b')](_0x4d8d66,{'showHidden':![],'depth':null}));});}UserReport[_0xee78('0x1e')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xee78('0x1a')]()['then'](showSipRegistrations())[_0xee78('0x15')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xee78('0x1e')]['isNotNull']=function(_0x6610d4){return _0x6610d4!==null&&!_[_0xee78('0x1f')](_0x6610d4);};UserReport[_0xee78('0x1e')]['emit']=function(_0x76edde,_0x4adb84,_0x21899a){io['to'](_0x76edde)['emit'](_0x4adb84,_0x21899a);};UserReport[_0xee78('0x1e')][_0xee78('0x10')]=function(_0x58d3cb){try{if(this['isNotNull'](_0x58d3cb)){logger['info'](_0xee78('0x20'),_0x58d3cb[_0xee78('0x21')],_0x58d3cb[_0xee78('0x22')]);logger['debug'](_0xee78('0x23'),util[_0xee78('0x1b')](_0x58d3cb,{'showHidden':![],'depth':null}));var _0x2f368f=_[_0xee78('0x24')](this[_0xee78('0xc')],{'defaultuser':_0x58d3cb[_0xee78('0x21')]});if(_0x2f368f){_0x58d3cb['stateRegistry']=_0x58d3cb['state'];_[_0xee78('0x25')](_0x2f368f,_[_0xee78('0x26')](_0x58d3cb,['event',_0xee78('0x27'),_0xee78('0x21'),'state']));logger[_0xee78('0x28')](_0xee78('0x29'),util[_0xee78('0x1b')](_0x2f368f,{'showHidden':![],'depth':null}));this[_0xee78('0x2a')](util[_0xee78('0x2b')](_0xee78('0x2c'),_0x2f368f[_0xee78('0x2d')]),_0xee78('0x2e'),_0x2f368f);}}}catch(_0x1c636f){logger[_0xee78('0x18')](_0xee78('0x23'),util['inspect'](_0x1c636f,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xee78('0x2f')]=function(_0x3a209f){try{if(this[_0xee78('0x30')](_0x3a209f)){logger[_0xee78('0x31')](_0xee78('0x32'),_0x3a209f[_0xee78('0x33')],_0x3a209f['state']);logger[_0xee78('0x28')]('[userReport][devicestatechange]',util[_0xee78('0x1b')](_0x3a209f,{'showHidden':![],'depth':null}));if(this[_0xee78('0xd')][_0x3a209f[_0xee78('0x33')]]){if(!this[_0xee78('0xd')][_0x3a209f[_0xee78('0x33')]][_0xee78('0x34')]||_0x3a209f[_0xee78('0x22')][_0xee78('0x35')]()==_0xee78('0x36')){this[_0xee78('0xd')][_0x3a209f[_0xee78('0x33')]]['local']=![];if(this[_0xee78('0xd')][_0x3a209f[_0xee78('0x33')]]['state']!==_0x3a209f[_0xee78('0x22')][_0xee78('0x35')]()){this[_0xee78('0xd')][_0x3a209f['device']][_0xee78('0x37')]=_[_0xee78('0x38')](moment()[_0xee78('0x2b')]('x'));}this[_0xee78('0xd')][_0x3a209f['device']][_0xee78('0x22')]=_0x3a209f[_0xee78('0x22')][_0xee78('0x35')]();this[_0xee78('0xd')][_0x3a209f['device']][_0xee78('0x39')](_0x3a209f);}}else if(this['telephones'][_0x3a209f[_0xee78('0x33')]]){if(this['telephones'][_0x3a209f[_0xee78('0x33')]]['state']!==_0x3a209f[_0xee78('0x22')][_0xee78('0x35')]()){this[_0xee78('0xe')][_0x3a209f[_0xee78('0x33')]][_0xee78('0x37')]=_['toNumber'](moment()['format']('x'));}this[_0xee78('0xe')][_0x3a209f[_0xee78('0x33')]][_0xee78('0x22')]=_0x3a209f[_0xee78('0x22')]['toLowerCase']();logger[_0xee78('0x28')](_0xee78('0x3a'),util[_0xee78('0x1b')](this[_0xee78('0xe')][_0x3a209f[_0xee78('0x33')]],{'showHidden':![],'depth':null}));this[_0xee78('0x2a')](util['format']('telephone:%s',this[_0xee78('0xe')][_0x3a209f[_0xee78('0x33')]][_0xee78('0x2d')]),'telephone:save',this[_0xee78('0xe')][_0x3a209f['device']]);}else if(this[_0xee78('0xc')][_0x3a209f[_0xee78('0x33')]]){if(this[_0xee78('0xc')][_0x3a209f[_0xee78('0x33')]]['state']!==_0x3a209f[_0xee78('0x22')][_0xee78('0x35')]()){this['trunks'][_0x3a209f[_0xee78('0x33')]][_0xee78('0x37')]=_[_0xee78('0x38')](moment()[_0xee78('0x2b')]('x'));}this[_0xee78('0xc')][_0x3a209f[_0xee78('0x33')]][_0xee78('0x22')]=_0x3a209f[_0xee78('0x22')][_0xee78('0x35')]();logger['debug'](_0xee78('0x3b'),util['inspect'](this['trunks'][_0x3a209f[_0xee78('0x33')]],{'showHidden':![],'depth':null}));this[_0xee78('0x2a')](util['format'](_0xee78('0x2c'),this['trunks'][_0x3a209f[_0xee78('0x33')]][_0xee78('0x2d')]),_0xee78('0x2e'),this[_0xee78('0xc')][_0x3a209f[_0xee78('0x33')]]);}else if(_[_0xee78('0x3c')](_0x3a209f[_0xee78('0x33')],_0xee78('0x3d'))){var _0x4230a7=_0x3a209f['device'];var _0x5c782b=_0x4230a7['substring'](_0x4230a7[_0xee78('0x3e')]('/')+0x1,_0x4230a7[_0xee78('0x3e')]('@'));var _0x29fd46=_[_0xee78('0x24')](this[_0xee78('0xd')],function(_0xc861c){return _0xc861c[_0xee78('0x3f')]==_0x5c782b||_0xc861c[_0xee78('0x40')]==_0x5c782b||_0xc861c[_0xee78('0x41')]==_0x5c782b;});if(_0x29fd46){if(_0x29fd46[_0xee78('0x22')]!==_0x3a209f['state'][_0xee78('0x35')]()){_0x29fd46[_0xee78('0x37')]=_[_0xee78('0x38')](moment()[_0xee78('0x2b')]('x'));}_0x29fd46['state']=_0x3a209f[_0xee78('0x22')][_0xee78('0x35')]();_0x29fd46[_0xee78('0x34')]=!![];_0x29fd46['updateStatusRealtime'](_0x3a209f);}}}}catch(_0x3c4803){logger[_0xee78('0x18')]('[userReport][devicestatechange]',util['inspect'](_0x3c4803,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xee78('0x42')]=function(_0x1cb4c7){try{if(this[_0xee78('0x30')](_0x1cb4c7)&&this['isNotNull'](_0x1cb4c7[_0xee78('0x13')])){logger[_0xee78('0x31')](_0xee78('0x43'),_0x1cb4c7[_0xee78('0x44')],_0x1cb4c7[_0xee78('0x45')],_0x1cb4c7[_0xee78('0x13')]);logger[_0xee78('0x28')](_0xee78('0x46'),util[_0xee78('0x1b')](_0x1cb4c7,{'showHidden':![],'depth':null}));if(this[_0xee78('0xd')][_0x1cb4c7[_0xee78('0x44')]]){if(!this[_0xee78('0xd')][_0x1cb4c7['peer']][_0xee78('0x34')]||_0x1cb4c7[_0xee78('0x13')][_0xee78('0x35')]()==_0xee78('0x47')){this['agents'][_0x1cb4c7[_0xee78('0x44')]][_0xee78('0x34')]=![];this[_0xee78('0xd')][_0x1cb4c7[_0xee78('0x44')]][_0xee78('0x48')]=_0x1cb4c7[_0xee78('0x13')][_0xee78('0x35')]();this[_0xee78('0xd')][_0x1cb4c7['peer']][_0xee78('0x45')]=_0x1cb4c7['address'];this[_0xee78('0xd')][_0x1cb4c7[_0xee78('0x44')]][_0xee78('0x39')](_0x1cb4c7);}}else if(this['telephones'][_0x1cb4c7['peer']]){this[_0xee78('0xe')][_0x1cb4c7[_0xee78('0x44')]][_0xee78('0x48')]=_0x1cb4c7[_0xee78('0x13')][_0xee78('0x35')]();this[_0xee78('0xe')][_0x1cb4c7['peer']][_0xee78('0x45')]=_0x1cb4c7[_0xee78('0x45')];logger['debug'](_0xee78('0x49'),util[_0xee78('0x1b')](this[_0xee78('0xe')][_0x1cb4c7[_0xee78('0x44')]],{'showHidden':![],'depth':null}));this[_0xee78('0x2a')](util['format'](_0xee78('0x4a'),this[_0xee78('0xe')][_0x1cb4c7[_0xee78('0x44')]][_0xee78('0x2d')]),_0xee78('0x4b'),this['telephones'][_0x1cb4c7[_0xee78('0x44')]]);}else if(this['trunks'][_0x1cb4c7[_0xee78('0x44')]]){this['trunks'][_0x1cb4c7['peer']][_0xee78('0x48')]=_0x1cb4c7[_0xee78('0x13')][_0xee78('0x35')]();this[_0xee78('0xc')][_0x1cb4c7[_0xee78('0x44')]][_0xee78('0x45')]=_0x1cb4c7[_0xee78('0x45')];logger[_0xee78('0x28')](_0xee78('0x4c'),util[_0xee78('0x1b')](this[_0xee78('0xc')][_0x1cb4c7[_0xee78('0x44')]],{'showHidden':![],'depth':null}));this[_0xee78('0x2a')](util[_0xee78('0x2b')](_0xee78('0x2c'),this['trunks'][_0x1cb4c7[_0xee78('0x44')]][_0xee78('0x2d')]),_0xee78('0x2e'),this[_0xee78('0xc')][_0x1cb4c7[_0xee78('0x44')]]);}}}catch(_0x59481c){logger[_0xee78('0x18')]('[userReport][peerstatus]',util['inspect'](_0x59481c,{'showHidden':![],'depth':null}));}};module[_0xee78('0x4d')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 410fb7c..7bcf6b2 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5482=['voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','emit','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','voice','merge','omit','event','privilege','interface','format','user:%s','membername','user:called','error','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels'];(function(_0x5adc6b,_0x2cdbe4){var _0x1c910d=function(_0x5a6b1a){while(--_0x5a6b1a){_0x5adc6b['push'](_0x5adc6b['shift']());}};_0x1c910d(++_0x2cdbe4);}(_0x5482,0x95));var _0x2548=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0x5482[_0x4bb2b9];return _0x40e2a2;};'use strict';var _=require(_0x2548('0x0'));var moment=require('moment');var util=require(_0x2548('0x1'));var Redis=require('ioredis');var config=require(_0x2548('0x2'));var logger=require(_0x2548('0x3'))(_0x2548('0x4'));var ami=require(_0x2548('0x5'));config[_0x2548('0x6')]=_[_0x2548('0x7')](config[_0x2548('0x6')],{'host':_0x2548('0x8'),'port':0x18eb});var io=require(_0x2548('0x9'))(new Redis(config[_0x2548('0x6')]));function VoiceAgentReport(_0x44d883){this[_0x2548('0xa')]={};this['voiceChannels']=_0x44d883['channels'];this[_0x2548('0xb')]=_0x44d883[_0x2548('0xb')];this[_0x2548('0xc')]=_0x44d883[_0x2548('0xc')];this[_0x2548('0xd')]={};ami['on'](_0x2548('0xe'),this[_0x2548('0xf')][_0x2548('0x10')](this));ami['on'](_0x2548('0x11'),this['syncAgentConnect'][_0x2548('0x10')](this));ami['on'](_0x2548('0x12'),this[_0x2548('0x13')][_0x2548('0x10')](this));ami['on']('queuecallerabandon',this[_0x2548('0x14')][_0x2548('0x10')](this));ami['on'](_0x2548('0x15'),this[_0x2548('0x16')][_0x2548('0x10')](this));ami['on'](_0x2548('0x17'),this[_0x2548('0x18')][_0x2548('0x10')](this));ami['on'](_0x2548('0x19'),this[_0x2548('0x1a')]['bind'](this));ami['on'](_0x2548('0x1b'),this[_0x2548('0x1c')][_0x2548('0x10')](this));ami['on'](_0x2548('0x1d'),this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0x2548('0x1e'),this['syncAttendedTransfer'][_0x2548('0x10')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x2548('0x10')](this));}VoiceAgentReport['prototype'][_0x2548('0x1f')]=function(_0x372845,_0xd585fd,_0x5a567d){io['to'](_0x372845)[_0x2548('0x1f')](_0xd585fd,_0x5a567d);};VoiceAgentReport[_0x2548('0x20')][_0x2548('0x21')]=function(_0x44b6ec){return _0x44b6ec!==null&&!_[_0x2548('0x22')](_0x44b6ec);};VoiceAgentReport[_0x2548('0x20')][_0x2548('0xf')]=function(_0x3e18df){try{if(this[_0x2548('0x21')](_0x3e18df)){logger[_0x2548('0x23')](_0x2548('0x24'),_0x3e18df[_0x2548('0x25')],_0x3e18df['membername'],_0x3e18df[_0x2548('0x26')]);logger[_0x2548('0x27')](_0x2548('0x28'),_0x3e18df[_0x2548('0x25')],util[_0x2548('0x29')](_0x3e18df,{'showHidden':![],'depth':null}));if(_[_0x2548('0x22')](this[_0x2548('0xa')][_0x3e18df[_0x2548('0x25')]])){this[_0x2548('0xa')][_0x3e18df['uniqueid']]={};}if(_[_0x2548('0x22')](this[_0x2548('0xa')][_0x3e18df[_0x2548('0x25')]][_0x3e18df[_0x2548('0x26')]])){this['channels'][_0x3e18df['uniqueid']][_0x3e18df[_0x2548('0x26')]]={'agentcalledAt':moment()['format'](_0x2548('0x2a')),'lastevent':_0x2548('0x2b'),'mandatoryDisposition':this[_0x2548('0xb')][_0x3e18df['queue']]?this[_0x2548('0xb')][_0x3e18df[_0x2548('0x2c')]]['mandatoryDisposition']||![]:![],'type':this[_0x2548('0xb')][_0x3e18df[_0x2548('0x2c')]]?this['voiceQueues'][_0x3e18df[_0x2548('0x2c')]][_0x2548('0x2d')]||_0x2548('0x2e'):_0x2548('0x2e'),'variables':this[_0x2548('0xd')][_0x3e18df[_0x2548('0x25')]],'motionChannel':_0x2548('0x2f')};}_[_0x2548('0x30')](this['channels'][_0x3e18df[_0x2548('0x25')]][_0x3e18df[_0x2548('0x26')]],_[_0x2548('0x31')](_0x3e18df,[_0x2548('0x32'),_0x2548('0x33')]));logger[_0x2548('0x27')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x3e18df[_0x2548('0x25')],util[_0x2548('0x29')](this[_0x2548('0xa')][_0x3e18df['uniqueid']][_0x3e18df[_0x2548('0x26')]],{'showHidden':![],'depth':null}));ami[_0x2548('0x1f')]('custom:agentcalled',this[_0x2548('0xa')][_0x3e18df[_0x2548('0x25')]][_0x3e18df[_0x2548('0x26')]]);var _0x17c0c1={'id':this[_0x2548('0xc')][_0x3e18df[_0x2548('0x34')]]['id'],'calleridnum':this[_0x2548('0xa')][_0x3e18df['uniqueid']][_0x3e18df[_0x2548('0x26')]]['calleridnum'],'queue':this[_0x2548('0xa')][_0x3e18df[_0x2548('0x25')]][_0x3e18df[_0x2548('0x26')]][_0x2548('0x2c')],'variables':this[_0x2548('0xa')][_0x3e18df['uniqueid']][_0x3e18df[_0x2548('0x26')]][_0x2548('0xd')]};logger[_0x2548('0x27')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x3e18df[_0x2548('0x25')],util[_0x2548('0x29')](_0x17c0c1,{'showHidden':![],'depth':null}));this['emit'](util[_0x2548('0x35')](_0x2548('0x36'),_0x3e18df[_0x2548('0x37')]),_0x2548('0x38'),_0x17c0c1);}}catch(_0x4194c6){logger[_0x2548('0x39')]('[%s][voiceAgentReport][agentcalled]',_0x3e18df[_0x2548('0x25')],util['inspect'](_0x4194c6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2548('0x20')][_0x2548('0x3a')]=function(_0x2168d5){try{if(this[_0x2548('0x21')](_0x2168d5)){if(this['channels'][_0x2168d5[_0x2548('0x25')]]){logger[_0x2548('0x27')](_0x2548('0x3b'),_0x2168d5['uniqueid'],util['inspect'](_0x2168d5,{'showHidden':![],'depth':null}));for(var _0x1d5c51 in this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]]){if(this[_0x2548('0xa')][_0x2168d5['uniqueid']][_0x2548('0x3c')](_0x1d5c51)){if(_0x2168d5[_0x2548('0x26')]===_0x1d5c51){logger[_0x2548('0x23')](_0x2548('0x3d'),_0x2168d5[_0x2548('0x25')],_0x2168d5['membername'],_0x2168d5['destuniqueid']);this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x3e')]=moment()[_0x2548('0x35')](_0x2548('0x2a'));this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x3f')]=_0x2168d5[_0x2548('0x3f')];this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51]['connectedlinenum']=_0x2168d5[_0x2548('0x40')];this[_0x2548('0xa')][_0x2168d5['uniqueid']][_0x1d5c51][_0x2548('0x41')]=_0x2168d5['destchannelstate'];this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x42')]=_0x2168d5['destchannelstatedesc'];this['channels'][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x43')]=_0x2168d5[_0x2548('0x43')];this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x44')]='connect';if(this['voiceChannels'][this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x25')]]){var _0x520959=this[_0x2548('0x45')][this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x25')]][_0x2548('0x46')];this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x46')]=_0x520959;_0x2168d5[_0x2548('0x46')]=_0x520959;}_[_0x2548('0x30')](this[_0x2548('0xc')][_0x2168d5[_0x2548('0x34')]],_[_0x2548('0x47')](_0x2168d5,[_0x2548('0x2c'),_0x2548('0x48'),_0x2548('0x46')]));logger[_0x2548('0x27')](_0x2548('0x49'),_0x2168d5[_0x2548('0x25')],util[_0x2548('0x29')](this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x2168d5[_0x2548('0x26')]],{'showHidden':![],'depth':null}));ami[_0x2548('0x1f')]('custom:agentconnect',this[_0x2548('0xa')][_0x2168d5['uniqueid']][_0x2168d5[_0x2548('0x26')]]);logger[_0x2548('0x27')](_0x2548('0x4a'),_0x2168d5['uniqueid'],util[_0x2548('0x29')](this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x2168d5['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x2548('0x1f')](util['format'](_0x2548('0x36'),_0x2168d5[_0x2548('0x37')]),_0x2548('0x4b'),this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x2168d5[_0x2548('0x26')]]);}else if(!this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51]['agentringnoanswer']&&!this[_0x2548('0xa')][_0x2168d5['uniqueid']][_0x1d5c51][_0x2548('0x15')]){logger['info'](_0x2548('0x4c'),_0x2168d5[_0x2548('0x25')],this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x37')],_0x1d5c51);this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x12')]=!![];this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x4d')]=moment()[_0x2548('0x35')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x4e')]=_0x2168d5['destuniqueid'];this['channels'][_0x2168d5['uniqueid']][_0x1d5c51][_0x2548('0x4f')]=_0x2168d5[_0x2548('0x37')];this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51]['lastevent']=_0x2548('0x50');this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51][_0x2548('0x51')]=_0x2548('0x50');logger[_0x2548('0x27')](_0x2548('0x52'),_0x2168d5['uniqueid'],util[_0x2548('0x29')](this[_0x2548('0xa')][_0x2168d5[_0x2548('0x25')]][_0x1d5c51],{'showHidden':![],'depth':null}));ami[_0x2548('0x1f')](_0x2548('0x53'),this['channels'][_0x2168d5['uniqueid']][_0x1d5c51]);}}}}}}catch(_0x13dfda){logger[_0x2548('0x39')]('[%s][voiceAgentReport][agentconnect]',_0x2168d5['uniqueid'],util['inspect'](_0x13dfda,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2548('0x20')][_0x2548('0x13')]=function(_0x1170af){try{if(this['isNotNull'](_0x1170af)){logger[_0x2548('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x1170af[_0x2548('0x25')],util['inspect'](_0x1170af,{'showHidden':![],'depth':null}));if(this[_0x2548('0xa')][_0x1170af[_0x2548('0x25')]]&&this[_0x2548('0xa')][_0x1170af[_0x2548('0x25')]][_0x1170af[_0x2548('0x26')]]){logger[_0x2548('0x23')](_0x2548('0x54'),_0x1170af[_0x2548('0x25')],_0x1170af[_0x2548('0x37')],_0x1170af[_0x2548('0x26')]);this['channels'][_0x1170af[_0x2548('0x25')]][_0x1170af['destuniqueid']][_0x2548('0x12')]=!![];this[_0x2548('0xa')][_0x1170af[_0x2548('0x25')]][_0x1170af['destuniqueid']]['agentringnoanswerAt']=moment()['format'](_0x2548('0x2a'));this['channels'][_0x1170af[_0x2548('0x25')]][_0x1170af[_0x2548('0x26')]][_0x2548('0x44')]='rejected';this[_0x2548('0xa')][_0x1170af['uniqueid']][_0x1170af[_0x2548('0x26')]][_0x2548('0x51')]='rejected';logger[_0x2548('0x27')](_0x2548('0x55'),_0x1170af['uniqueid'],util[_0x2548('0x29')](this[_0x2548('0xa')][_0x1170af[_0x2548('0x25')]][_0x1170af[_0x2548('0x26')]],{'showHidden':![],'depth':null}));ami[_0x2548('0x1f')](_0x2548('0x56'),this['channels'][_0x1170af[_0x2548('0x25')]][_0x1170af[_0x2548('0x26')]]);}}}catch(_0x21324a){logger['error'](_0x2548('0x57'),_0x1170af['uniqueid'],util[_0x2548('0x29')](_0x21324a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2548('0x20')]['syncQueueCallerAbandon']=function(_0x495ca4){try{if(this[_0x2548('0x21')](_0x495ca4)){logger['debug'](_0x2548('0x58'),_0x495ca4[_0x2548('0x25')],util['inspect'](_0x495ca4,{'showHidden':![],'depth':null}));if(this[_0x2548('0xa')][_0x495ca4[_0x2548('0x25')]]){for(var _0x44d686 in this['channels'][_0x495ca4[_0x2548('0x25')]]){if(this[_0x2548('0xa')][_0x495ca4[_0x2548('0x25')]]['hasOwnProperty'](_0x44d686)&&!this[_0x2548('0xa')][_0x495ca4[_0x2548('0x25')]][_0x44d686][_0x2548('0x12')]&&!this[_0x2548('0xa')][_0x495ca4[_0x2548('0x25')]][_0x44d686][_0x2548('0x15')]){logger[_0x2548('0x23')](_0x2548('0x59'),_0x495ca4['uniqueid'],this['channels'][_0x495ca4[_0x2548('0x25')]][_0x44d686][_0x2548('0x37')],_0x44d686);this['channels'][_0x495ca4['uniqueid']][_0x44d686]['agentringnoanswer']=!![];this['channels'][_0x495ca4[_0x2548('0x25')]][_0x44d686]['agentringnoanswerAt']=moment()[_0x2548('0x35')](_0x2548('0x2a'));this['channels'][_0x495ca4[_0x2548('0x25')]][_0x44d686]['lastevent']=_0x2548('0x5a');this['channels'][_0x495ca4[_0x2548('0x25')]][_0x44d686][_0x2548('0x51')]=_0x2548('0x5a');logger[_0x2548('0x27')](_0x2548('0x5b'),_0x495ca4[_0x2548('0x25')],util[_0x2548('0x29')](this[_0x2548('0xa')][_0x495ca4[_0x2548('0x25')]][_0x44d686],{'showHidden':![],'depth':null}));ami[_0x2548('0x1f')]('custom:agentqueuecallerabandon',this[_0x2548('0xa')][_0x495ca4[_0x2548('0x25')]][_0x44d686]);}}}}}catch(_0x5df266){logger['error'](_0x2548('0x5c'),_0x495ca4['uniqueid'],util['inspect'](_0x5df266,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2548('0x20')][_0x2548('0x16')]=function(_0x5eddaf){try{if(this[_0x2548('0x21')](_0x5eddaf)){logger[_0x2548('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x5eddaf['uniqueid'],util[_0x2548('0x29')](_0x5eddaf,{'showHidden':![],'depth':null}));if(this['channels'][_0x5eddaf[_0x2548('0x25')]]){for(var _0x2ca620 in this['channels'][_0x5eddaf[_0x2548('0x25')]]){if(this['channels'][_0x5eddaf[_0x2548('0x25')]][_0x2548('0x3c')](_0x2ca620)){if(this[_0x2548('0xa')][_0x5eddaf[_0x2548('0x25')]][_0x2ca620][_0x2548('0x3e')]&&!this['channels'][_0x5eddaf[_0x2548('0x25')]][_0x2ca620][_0x2548('0x15')]){logger[_0x2548('0x23')](_0x2548('0x5d'),_0x5eddaf[_0x2548('0x25')],this['channels'][_0x5eddaf['uniqueid']][_0x2ca620][_0x2548('0x37')],_0x2ca620);this[_0x2548('0xa')][_0x5eddaf[_0x2548('0x25')]][_0x2ca620][_0x2548('0x15')]=!![];this['channels'][_0x5eddaf[_0x2548('0x25')]][_0x2ca620]['agentcompleteAt']=moment()[_0x2548('0x35')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5eddaf[_0x2548('0x25')]][_0x2ca620][_0x2548('0x44')]=_0x2548('0x5e');this[_0x2548('0xa')][_0x5eddaf['uniqueid']][_0x2ca620][_0x2548('0x51')]=_0x5eddaf[_0x2548('0x51')]==_0x2548('0x5f')?_0x2548('0x60'):_0x5eddaf[_0x2548('0x51')];this[_0x2548('0xa')][_0x5eddaf['uniqueid']][_0x2ca620][_0x2548('0x61')]=_0x5eddaf[_0x2548('0x61')];if(this[_0x2548('0xb')][_0x5eddaf['queue']]&&this[_0x2548('0xb')][_0x5eddaf['queue']][_0x2548('0x62')]){this[_0x2548('0xa')][_0x5eddaf[_0x2548('0x25')]][_0x2ca620][_0x2548('0x63')]=this[_0x2548('0xb')][_0x5eddaf[_0x2548('0x2c')]][_0x2548('0x64')];this[_0x2548('0xa')][_0x5eddaf['uniqueid']][_0x2ca620][_0x2548('0x65')]=!![];}this[_0x2548('0xc')][_0x5eddaf[_0x2548('0x34')]]=_['omit'](this['agents'][_0x5eddaf['interface']],[_0x2548('0x2c'),_0x2548('0x48')]);logger[_0x2548('0x27')](_0x2548('0x66'),_0x5eddaf[_0x2548('0x25')],util[_0x2548('0x29')](this[_0x2548('0xa')][_0x5eddaf['uniqueid']][_0x2ca620],{'showHidden':![],'depth':null}));ami[_0x2548('0x1f')](_0x2548('0x67'),this[_0x2548('0xa')][_0x5eddaf[_0x2548('0x25')]][_0x2ca620]);logger[_0x2548('0x27')](_0x2548('0x68'),_0x5eddaf['uniqueid'],util[_0x2548('0x29')]({'id':this[_0x2548('0xc')][_0x5eddaf['interface']]['id'],'destaccountcode':_0x5eddaf[_0x2548('0x69')]},{'showHidden':![],'depth':null}));this[_0x2548('0x1f')](util[_0x2548('0x35')](_0x2548('0x36'),_0x5eddaf[_0x2548('0x37')]),_0x2548('0x6a'),{'id':this['agents'][_0x5eddaf['interface']]['id'],'destaccountcode':_0x5eddaf[_0x2548('0x69')]});}}}}}}catch(_0x5e63d5){logger[_0x2548('0x39')]('[%s][voiceAgentReport][agentcomplete]',_0x5eddaf[_0x2548('0x25')],util[_0x2548('0x29')](_0x5e63d5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2548('0x20')]['syncVarSet']=function(_0x2b3358){try{if(this[_0x2548('0x21')](_0x2b3358)){logger[_0x2548('0x27')](_0x2548('0x6b'),_0x2b3358[_0x2548('0x25')],util[_0x2548('0x29')](_0x2b3358,{'showHidden':![],'depth':null}));this[_0x2548('0x6c')](_0x2b3358['uniqueid'],_[_0x2548('0x6d')](_0x2b3358['variable'])[0x0],_0x2b3358[_0x2548('0x6e')]);if(this[_0x2548('0xa')][_0x2b3358[_0x2548('0x25')]]){for(var _0x12782f in this[_0x2548('0xa')][_0x2b3358[_0x2548('0x25')]]){if(this['channels'][_0x2b3358[_0x2548('0x25')]][_0x2548('0x3c')](_0x12782f)){logger[_0x2548('0x23')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x2b3358[_0x2548('0x25')],_0x12782f,_[_0x2548('0x6d')](_0x2b3358[_0x2548('0x6f')])[0x0],_0x2b3358[_0x2548('0x6e')]);if(_['isUndefined'](this[_0x2548('0xa')][_0x2b3358[_0x2548('0x25')]][_0x12782f]['variables'])){this[_0x2548('0xa')][_0x2b3358['uniqueid']][_0x12782f][_0x2548('0xd')]={};}this['channels'][_0x2b3358[_0x2548('0x25')]][_0x12782f][_0x2548('0xd')]=this[_0x2548('0xd')][_0x2b3358[_0x2548('0x25')]];}}}}}catch(_0x422e25){logger['error'](_0x2548('0x70'),_0x2b3358[_0x2548('0x25')],util[_0x2548('0x29')](_0x422e25,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2548('0x20')][_0x2548('0x6c')]=function(_0x4836dc,_0x242c85,_0x2207c6){var _0x1c5095=[_0x2548('0x71'),_0x2548('0x72'),_0x2548('0x73'),_0x2548('0x74'),'rtpaudioqosloss',_0x2548('0x75'),_0x2548('0x76'),_0x2548('0x77'),_0x2548('0x78'),'sipuri',_0x2548('0x79'),_0x2548('0x7a'),_0x2548('0x7b'),'memberdynamic',_0x2548('0x7c'),_0x2548('0x7d'),'membername',_0x2548('0x7e'),_0x2548('0x7f')];if(!_[_0x2548('0x80')](_0x242c85)&&!_[_0x2548('0x81')](_0x1c5095,_0x242c85)){if(_[_0x2548('0x22')](this['variables'][_0x4836dc])){this[_0x2548('0xd')][_0x4836dc]={};}this[_0x2548('0xd')][_0x4836dc][_0x242c85]=_0x2207c6;}};VoiceAgentReport[_0x2548('0x20')][_0x2548('0x1a')]=function(_0x37791b){try{if(this[_0x2548('0x21')](_0x37791b)){logger[_0x2548('0x27')](_0x2548('0x82'),_0x37791b[_0x2548('0x25')],util[_0x2548('0x29')](_0x37791b,{'showHidden':![],'depth':null}));if(this[_0x2548('0xa')][_0x37791b[_0x2548('0x25')]]){for(var _0x5bd6fc in this[_0x2548('0xa')][_0x37791b[_0x2548('0x25')]]){if(this[_0x2548('0xa')][_0x37791b[_0x2548('0x25')]][_0x2548('0x3c')](_0x5bd6fc)){if(this[_0x2548('0xa')][_0x37791b['uniqueid']][_0x5bd6fc][_0x2548('0x51')]==_0x2548('0x5f')&&this[_0x2548('0xa')][_0x37791b[_0x2548('0x25')]][_0x5bd6fc]['agentcomplete']){logger[_0x2548('0x23')](_0x2548('0x83'),_0x37791b[_0x2548('0x25')],_0x5bd6fc);this[_0x2548('0xa')][_0x37791b[_0x2548('0x25')]][_0x5bd6fc][_0x2548('0x84')]=moment()[_0x2548('0x35')](_0x2548('0x2a'));}}}logger[_0x2548('0x27')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x37791b[_0x2548('0x25')],util[_0x2548('0x29')](_[_0x2548('0x85')](this['channels'][_0x37791b[_0x2548('0x25')]]),{'showHidden':![],'depth':null}));ami[_0x2548('0x1f')](_0x2548('0x86'),_[_0x2548('0x85')](this[_0x2548('0xa')][_0x37791b[_0x2548('0x25')]]));delete this[_0x2548('0xa')][_0x37791b['uniqueid']];}if(this['variables'][_0x37791b[_0x2548('0x25')]]){delete this['variables'][_0x37791b[_0x2548('0x25')]];}}}catch(_0x3b7924){logger['error'](_0x2548('0x87'),_0x37791b[_0x2548('0x25')],util['inspect'](_0x3b7924,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2548('0x20')][_0x2548('0x88')]=function(_0xd07dc9){try{if(this[_0x2548('0x21')](_0xd07dc9)){logger[_0x2548('0x27')](_0x2548('0x89'),_0xd07dc9[_0x2548('0x25')],util[_0x2548('0x29')](_0xd07dc9,{'showHidden':![],'depth':null}));if(this[_0x2548('0xa')][_0xd07dc9[_0x2548('0x8a')]]){for(var _0x4ba7f8 in this[_0x2548('0xa')][_0xd07dc9[_0x2548('0x8a')]]){if(this[_0x2548('0xa')][_0xd07dc9['transfereeuniqueid']]['hasOwnProperty'](_0x4ba7f8)){if(_0xd07dc9[_0x2548('0x8b')]===_0x4ba7f8){logger[_0x2548('0x23')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xd07dc9[_0x2548('0x25')],this[_0x2548('0xa')][_0xd07dc9[_0x2548('0x8a')]][_0x4ba7f8][_0x2548('0x37')],_0x4ba7f8);var _0x478072=moment();this[_0x2548('0xa')][_0xd07dc9['transfereeuniqueid']][_0x4ba7f8]['agentcomplete']=!![];this[_0x2548('0xa')][_0xd07dc9[_0x2548('0x8a')]][_0x4ba7f8]['agentcompleteAt']=moment()[_0x2548('0x35')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xd07dc9[_0x2548('0x8a')]][_0x4ba7f8][_0x2548('0x44')]='complete';this[_0x2548('0xa')][_0xd07dc9['transfereeuniqueid']][_0x4ba7f8][_0x2548('0x51')]='transfer';this[_0x2548('0xa')][_0xd07dc9[_0x2548('0x8a')]][_0x4ba7f8][_0x2548('0x61')]=_0x478072[_0x2548('0x8c')](this[_0x2548('0xa')][_0xd07dc9['transfereeuniqueid']][_0x4ba7f8]['agentconnectAt'],_0x2548('0x8d'));}}}}if(this[_0x2548('0xa')][_0xd07dc9[_0x2548('0x8e')]]){var _0x5492a7=this[_0x2548('0xa')][_0xd07dc9['secondtransfereruniqueid']];this[_0x2548('0xa')][_0xd07dc9[_0x2548('0x8e')]]=this[_0x2548('0xa')][_0xd07dc9['transfereeuniqueid']];this['channels'][_0xd07dc9[_0x2548('0x8a')]]=_0x5492a7;}}}catch(_0x39daaf){logger[_0x2548('0x39')](_0x2548('0x8f'),_0xd07dc9[_0x2548('0x25')],util[_0x2548('0x29')](_0x39daaf,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2548('0x90')]=function(_0xd42d01){try{if(this[_0x2548('0x21')](_0xd42d01)){logger['debug'](_0x2548('0x91'),_0xd42d01['uniqueid'],util[_0x2548('0x29')](_0xd42d01,{'showHidden':![],'depth':null}));if(this[_0x2548('0xa')][_0xd42d01['transfereeuniqueid']]){for(var _0x642655 in this[_0x2548('0xa')][_0xd42d01[_0x2548('0x8a')]]){if(this['channels'][_0xd42d01['transfereeuniqueid']][_0x2548('0x3c')](_0x642655)){if(_0xd42d01[_0x2548('0x92')]===_0x642655){logger['info'](_0x2548('0x93'),_0xd42d01['uniqueid'],this[_0x2548('0xa')][_0xd42d01['transfereeuniqueid']][_0x642655][_0x2548('0x37')],_0x642655);var _0x2386c4=moment();this[_0x2548('0xa')][_0xd42d01[_0x2548('0x8a')]][_0x642655][_0x2548('0x15')]=!![];this[_0x2548('0xa')][_0xd42d01[_0x2548('0x8a')]][_0x642655][_0x2548('0x84')]=_0x2386c4;this[_0x2548('0xa')][_0xd42d01[_0x2548('0x8a')]][_0x642655]['lastevent']=_0x2548('0x5e');this[_0x2548('0xa')][_0xd42d01[_0x2548('0x8a')]][_0x642655]['reason']='transfer';this[_0x2548('0xa')][_0xd42d01[_0x2548('0x8a')]][_0x642655][_0x2548('0x61')]=_0x2386c4['diff'](this[_0x2548('0xa')][_0xd42d01[_0x2548('0x8a')]][_0x642655][_0x2548('0x3e')],_0x2548('0x8d'));}}}}}}catch(_0x412d8a){logger[_0x2548('0x39')](_0x2548('0x94'),_0xd42d01[_0x2548('0x25')],util[_0x2548('0x29')](_0x412d8a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x20b10b){var _0x5725eb='';try{if(this['isNotNull'](_0x20b10b)){logger['debug'](_0x2548('0x95'),_0x20b10b[_0x2548('0x25')],util['inspect'](_0x20b10b,{'showHidden':![],'depth':null}));if(_0x20b10b[_0x2548('0x96')]){_0x5725eb=_0x20b10b[_0x2548('0x96')][_0x2548('0x97')](0x0,_0x20b10b[_0x2548('0x96')][_0x2548('0x98')]('-'));if(this[_0x2548('0xc')][_0x5725eb]){logger[_0x2548('0x23')](_0x2548('0x99'),_0x20b10b[_0x2548('0x25')],_0x5725eb);this[_0x2548('0xc')][_0x5725eb][_0x2548('0x9a')]=!![];}}}}catch(_0xa93eba){logger[_0x2548('0x39')](_0x2548('0x9b'),_0x20b10b['uniqueid'],util[_0x2548('0x29')](_0xa93eba,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2548('0x20')][_0x2548('0x9c')]=function(_0x4e1cfa){var _0x573afa='';try{if(this[_0x2548('0x21')](_0x4e1cfa)){logger[_0x2548('0x27')](_0x2548('0x9d'),_0x4e1cfa[_0x2548('0x25')],util[_0x2548('0x29')](_0x4e1cfa,{'showHidden':![],'depth':null}));if(_0x4e1cfa['channel']){_0x573afa=_0x4e1cfa[_0x2548('0x96')][_0x2548('0x97')](0x0,_0x4e1cfa['channel'][_0x2548('0x98')]('-'));if(this[_0x2548('0xc')][_0x573afa]){logger[_0x2548('0x23')](_0x2548('0x9e'),_0x4e1cfa[_0x2548('0x25')],_0x573afa);this[_0x2548('0xc')][_0x573afa][_0x2548('0x9a')]=![];}}}}catch(_0x23cce7){logger[_0x2548('0x39')](_0x2548('0x9f'),_0x4e1cfa[_0x2548('0x25')],util[_0x2548('0x29')](_0x23cce7,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xd478=['queue','mandatoryDisposition','type','inbound','variables','voice','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','interface','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','pick','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isUndefined','syncAgentCalled','isNotNull','info','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','YYYY-MM-DD\x20HH:mm:ss','called'];(function(_0x5a99af,_0x29b238){var _0x7aaaef=function(_0x13f857){while(--_0x13f857){_0x5a99af['push'](_0x5a99af['shift']());}};_0x7aaaef(++_0x29b238);}(_0xd478,0x1b1));var _0x8d47=function(_0x2f2dba,_0x451d2e){_0x2f2dba=_0x2f2dba-0x0;var _0x27e85e=_0xd478[_0x2f2dba];return _0x27e85e;};'use strict';var _=require(_0x8d47('0x0'));var moment=require(_0x8d47('0x1'));var util=require(_0x8d47('0x2'));var Redis=require(_0x8d47('0x3'));var config=require(_0x8d47('0x4'));var logger=require('../../../config/logger')(_0x8d47('0x5'));var ami=require(_0x8d47('0x6'));config[_0x8d47('0x7')]=_[_0x8d47('0x8')](config[_0x8d47('0x7')],{'host':_0x8d47('0x9'),'port':0x18eb});var io=require(_0x8d47('0xa'))(new Redis(config[_0x8d47('0x7')]));function VoiceAgentReport(_0x5d7906){this[_0x8d47('0xb')]={};this[_0x8d47('0xc')]=_0x5d7906[_0x8d47('0xb')];this[_0x8d47('0xd')]=_0x5d7906[_0x8d47('0xd')];this[_0x8d47('0xe')]=_0x5d7906[_0x8d47('0xe')];this['variables']={};ami['on'](_0x8d47('0xf'),this['syncAgentCalled'][_0x8d47('0x10')](this));ami['on'](_0x8d47('0x11'),this[_0x8d47('0x12')][_0x8d47('0x10')](this));ami['on'](_0x8d47('0x13'),this['syncAgentRingNoAnswer'][_0x8d47('0x10')](this));ami['on'](_0x8d47('0x14'),this['syncQueueCallerAbandon'][_0x8d47('0x10')](this));ami['on'](_0x8d47('0x15'),this[_0x8d47('0x16')]['bind'](this));ami['on'](_0x8d47('0x17'),this[_0x8d47('0x18')][_0x8d47('0x10')](this));ami['on'](_0x8d47('0x19'),this['syncHangup'][_0x8d47('0x10')](this));ami['on'](_0x8d47('0x1a'),this['syncMusicOnHoldStart'][_0x8d47('0x10')](this));ami['on'](_0x8d47('0x1b'),this[_0x8d47('0x1c')][_0x8d47('0x10')](this));ami['on']('attendedtransfer',this[_0x8d47('0x1d')]['bind'](this));ami['on']('blindtransfer',this[_0x8d47('0x1e')][_0x8d47('0x10')](this));}VoiceAgentReport[_0x8d47('0x1f')]['emit']=function(_0x58e3cf,_0x3b8f83,_0x2bd558){io['to'](_0x58e3cf)[_0x8d47('0x20')](_0x3b8f83,_0x2bd558);};VoiceAgentReport['prototype']['isNotNull']=function(_0xb2cc29){return _0xb2cc29!==null&&!_[_0x8d47('0x21')](_0xb2cc29);};VoiceAgentReport[_0x8d47('0x1f')][_0x8d47('0x22')]=function(_0x4ed7ea){try{if(this[_0x8d47('0x23')](_0x4ed7ea)){logger[_0x8d47('0x24')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4ed7ea[_0x8d47('0x25')],_0x4ed7ea[_0x8d47('0x26')],_0x4ed7ea[_0x8d47('0x27')]);logger[_0x8d47('0x28')](_0x8d47('0x29'),_0x4ed7ea[_0x8d47('0x25')],util['inspect'](_0x4ed7ea,{'showHidden':![],'depth':null}));if(_[_0x8d47('0x21')](this['channels'][_0x4ed7ea['uniqueid']])){this[_0x8d47('0xb')][_0x4ed7ea['uniqueid']]={};}if(_[_0x8d47('0x21')](this[_0x8d47('0xb')][_0x4ed7ea[_0x8d47('0x25')]][_0x4ed7ea[_0x8d47('0x27')]])){this[_0x8d47('0xb')][_0x4ed7ea['uniqueid']][_0x4ed7ea['destuniqueid']]={'agentcalledAt':moment()['format'](_0x8d47('0x2a')),'lastevent':_0x8d47('0x2b'),'mandatoryDisposition':this['voiceQueues'][_0x4ed7ea[_0x8d47('0x2c')]]?this[_0x8d47('0xd')][_0x4ed7ea['queue']][_0x8d47('0x2d')]||![]:![],'type':this[_0x8d47('0xd')][_0x4ed7ea[_0x8d47('0x2c')]]?this[_0x8d47('0xd')][_0x4ed7ea[_0x8d47('0x2c')]][_0x8d47('0x2e')]||_0x8d47('0x2f'):'inbound','variables':this[_0x8d47('0x30')][_0x4ed7ea[_0x8d47('0x25')]],'motionChannel':_0x8d47('0x31')};}_[_0x8d47('0x32')](this[_0x8d47('0xb')][_0x4ed7ea['uniqueid']][_0x4ed7ea[_0x8d47('0x27')]],_[_0x8d47('0x33')](_0x4ed7ea,[_0x8d47('0x34'),_0x8d47('0x35')]));logger[_0x8d47('0x28')](_0x8d47('0x36'),_0x4ed7ea[_0x8d47('0x25')],util[_0x8d47('0x37')](this[_0x8d47('0xb')][_0x4ed7ea[_0x8d47('0x25')]][_0x4ed7ea[_0x8d47('0x27')]],{'showHidden':![],'depth':null}));ami['emit'](_0x8d47('0x38'),this[_0x8d47('0xb')][_0x4ed7ea[_0x8d47('0x25')]][_0x4ed7ea['destuniqueid']]);var _0x190fba={'id':this[_0x8d47('0xe')][_0x4ed7ea[_0x8d47('0x39')]]['id'],'calleridnum':this[_0x8d47('0xb')][_0x4ed7ea['uniqueid']][_0x4ed7ea[_0x8d47('0x27')]][_0x8d47('0x3a')],'queue':this[_0x8d47('0xb')][_0x4ed7ea[_0x8d47('0x25')]][_0x4ed7ea[_0x8d47('0x27')]][_0x8d47('0x2c')],'variables':this['channels'][_0x4ed7ea[_0x8d47('0x25')]][_0x4ed7ea['destuniqueid']]['variables']};logger[_0x8d47('0x28')](_0x8d47('0x3b'),_0x4ed7ea[_0x8d47('0x25')],util[_0x8d47('0x37')](_0x190fba,{'showHidden':![],'depth':null}));this[_0x8d47('0x20')](util[_0x8d47('0x3c')](_0x8d47('0x3d'),_0x4ed7ea[_0x8d47('0x26')]),'user:called',_0x190fba);}}catch(_0x41d095){logger[_0x8d47('0x3e')](_0x8d47('0x3f'),_0x4ed7ea[_0x8d47('0x25')],util['inspect'](_0x41d095,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8d47('0x1f')][_0x8d47('0x12')]=function(_0x2a70ec){try{if(this[_0x8d47('0x23')](_0x2a70ec)){if(this['channels'][_0x2a70ec[_0x8d47('0x25')]]){logger[_0x8d47('0x28')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x2a70ec[_0x8d47('0x25')],util[_0x8d47('0x37')](_0x2a70ec,{'showHidden':![],'depth':null}));for(var _0x4d6089 in this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]]){if(this['channels'][_0x2a70ec[_0x8d47('0x25')]][_0x8d47('0x40')](_0x4d6089)){if(_0x2a70ec['destuniqueid']===_0x4d6089){logger[_0x8d47('0x24')](_0x8d47('0x41'),_0x2a70ec['uniqueid'],_0x2a70ec[_0x8d47('0x26')],_0x2a70ec[_0x8d47('0x27')]);this['channels'][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089][_0x8d47('0x42')]=moment()['format'](_0x8d47('0x2a'));this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089][_0x8d47('0x43')]=_0x2a70ec[_0x8d47('0x43')];this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089]['connectedlinenum']=_0x2a70ec['connectedlinenum'];this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089]['destchannelstate']=_0x2a70ec[_0x8d47('0x44')];this['channels'][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089][_0x8d47('0x45')]=_0x2a70ec['destchannelstatedesc'];this['channels'][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089][_0x8d47('0x46')]=_0x2a70ec[_0x8d47('0x46')];this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089][_0x8d47('0x47')]=_0x8d47('0x48');if(this[_0x8d47('0xc')][this[_0x8d47('0xb')][_0x2a70ec['uniqueid']][_0x4d6089]['uniqueid']]){var _0x34ee8e=this[_0x8d47('0xc')][this['channels'][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089][_0x8d47('0x25')]]['routealias'];this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089][_0x8d47('0x49')]=_0x34ee8e;_0x2a70ec['routealias']=_0x34ee8e;}_[_0x8d47('0x32')](this['agents'][_0x2a70ec[_0x8d47('0x39')]],_[_0x8d47('0x4a')](_0x2a70ec,[_0x8d47('0x2c'),'destconnectedlinenum','routealias']));logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x2a70ec[_0x8d47('0x25')],util[_0x8d47('0x37')](this['channels'][_0x2a70ec['uniqueid']][_0x2a70ec['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x8d47('0x20')](_0x8d47('0x4b'),this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x2a70ec[_0x8d47('0x27')]]);logger[_0x8d47('0x28')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x2a70ec[_0x8d47('0x25')],util[_0x8d47('0x37')](this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x2a70ec[_0x8d47('0x27')]],{'showHidden':![],'depth':null}));this[_0x8d47('0x20')](util[_0x8d47('0x3c')](_0x8d47('0x3d'),_0x2a70ec['membername']),_0x8d47('0x4c'),this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x2a70ec['destuniqueid']]);}else if(!this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089]['agentringnoanswer']&&!this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089][_0x8d47('0x15')]){logger[_0x8d47('0x24')](_0x8d47('0x4d'),_0x2a70ec['uniqueid'],this['channels'][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089][_0x8d47('0x26')],_0x4d6089);this[_0x8d47('0xb')][_0x2a70ec['uniqueid']][_0x4d6089][_0x8d47('0x13')]=!![];this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089][_0x8d47('0x4e')]=moment()[_0x8d47('0x3c')](_0x8d47('0x2a'));this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089]['answeredelsewheredestinationuniqueid']=_0x2a70ec[_0x8d47('0x27')];this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089][_0x8d47('0x4f')]=_0x2a70ec[_0x8d47('0x26')];this[_0x8d47('0xb')][_0x2a70ec['uniqueid']][_0x4d6089]['lastevent']=_0x8d47('0x50');this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089]['reason']=_0x8d47('0x50');logger[_0x8d47('0x28')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x2a70ec['uniqueid'],util[_0x8d47('0x37')](this['channels'][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089],{'showHidden':![],'depth':null}));ami[_0x8d47('0x20')]('custom:agentansweredelsewhere',this[_0x8d47('0xb')][_0x2a70ec[_0x8d47('0x25')]][_0x4d6089]);}}}}}}catch(_0x31bfab){logger[_0x8d47('0x3e')](_0x8d47('0x51'),_0x2a70ec[_0x8d47('0x25')],util[_0x8d47('0x37')](_0x31bfab,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8d47('0x52')]=function(_0x1fdb1e){try{if(this['isNotNull'](_0x1fdb1e)){logger[_0x8d47('0x28')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x1fdb1e['uniqueid'],util[_0x8d47('0x37')](_0x1fdb1e,{'showHidden':![],'depth':null}));if(this[_0x8d47('0xb')][_0x1fdb1e[_0x8d47('0x25')]]&&this[_0x8d47('0xb')][_0x1fdb1e[_0x8d47('0x25')]][_0x1fdb1e[_0x8d47('0x27')]]){logger[_0x8d47('0x24')](_0x8d47('0x53'),_0x1fdb1e[_0x8d47('0x25')],_0x1fdb1e['membername'],_0x1fdb1e['destuniqueid']);this[_0x8d47('0xb')][_0x1fdb1e[_0x8d47('0x25')]][_0x1fdb1e[_0x8d47('0x27')]]['agentringnoanswer']=!![];this['channels'][_0x1fdb1e[_0x8d47('0x25')]][_0x1fdb1e[_0x8d47('0x27')]][_0x8d47('0x4e')]=moment()['format'](_0x8d47('0x2a'));this[_0x8d47('0xb')][_0x1fdb1e[_0x8d47('0x25')]][_0x1fdb1e['destuniqueid']][_0x8d47('0x47')]=_0x8d47('0x54');this[_0x8d47('0xb')][_0x1fdb1e[_0x8d47('0x25')]][_0x1fdb1e['destuniqueid']][_0x8d47('0x55')]=_0x8d47('0x54');logger['debug'](_0x8d47('0x56'),_0x1fdb1e['uniqueid'],util[_0x8d47('0x37')](this[_0x8d47('0xb')][_0x1fdb1e[_0x8d47('0x25')]][_0x1fdb1e[_0x8d47('0x27')]],{'showHidden':![],'depth':null}));ami[_0x8d47('0x20')](_0x8d47('0x57'),this['channels'][_0x1fdb1e[_0x8d47('0x25')]][_0x1fdb1e[_0x8d47('0x27')]]);}}}catch(_0x1db69d){logger[_0x8d47('0x3e')](_0x8d47('0x58'),_0x1fdb1e[_0x8d47('0x25')],util[_0x8d47('0x37')](_0x1db69d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8d47('0x1f')][_0x8d47('0x59')]=function(_0x3e657b){try{if(this[_0x8d47('0x23')](_0x3e657b)){logger[_0x8d47('0x28')](_0x8d47('0x5a'),_0x3e657b[_0x8d47('0x25')],util[_0x8d47('0x37')](_0x3e657b,{'showHidden':![],'depth':null}));if(this[_0x8d47('0xb')][_0x3e657b[_0x8d47('0x25')]]){for(var _0x39c7bd in this[_0x8d47('0xb')][_0x3e657b[_0x8d47('0x25')]]){if(this['channels'][_0x3e657b[_0x8d47('0x25')]]['hasOwnProperty'](_0x39c7bd)&&!this[_0x8d47('0xb')][_0x3e657b['uniqueid']][_0x39c7bd]['agentringnoanswer']&&!this['channels'][_0x3e657b[_0x8d47('0x25')]][_0x39c7bd][_0x8d47('0x15')]){logger[_0x8d47('0x24')](_0x8d47('0x5b'),_0x3e657b[_0x8d47('0x25')],this[_0x8d47('0xb')][_0x3e657b[_0x8d47('0x25')]][_0x39c7bd][_0x8d47('0x26')],_0x39c7bd);this['channels'][_0x3e657b[_0x8d47('0x25')]][_0x39c7bd][_0x8d47('0x13')]=!![];this[_0x8d47('0xb')][_0x3e657b[_0x8d47('0x25')]][_0x39c7bd][_0x8d47('0x4e')]=moment()[_0x8d47('0x3c')](_0x8d47('0x2a'));this['channels'][_0x3e657b[_0x8d47('0x25')]][_0x39c7bd]['lastevent']=_0x8d47('0x5c');this[_0x8d47('0xb')][_0x3e657b[_0x8d47('0x25')]][_0x39c7bd][_0x8d47('0x55')]=_0x8d47('0x5c');logger[_0x8d47('0x28')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x3e657b[_0x8d47('0x25')],util[_0x8d47('0x37')](this['channels'][_0x3e657b[_0x8d47('0x25')]][_0x39c7bd],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0x8d47('0xb')][_0x3e657b['uniqueid']][_0x39c7bd]);}}}}}catch(_0x4c3f9a){logger['error'](_0x8d47('0x5d'),_0x3e657b['uniqueid'],util[_0x8d47('0x37')](_0x4c3f9a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8d47('0x1f')][_0x8d47('0x16')]=function(_0x26dcc8){try{if(this[_0x8d47('0x23')](_0x26dcc8)){logger[_0x8d47('0x28')](_0x8d47('0x5e'),_0x26dcc8[_0x8d47('0x25')],util['inspect'](_0x26dcc8,{'showHidden':![],'depth':null}));if(this['channels'][_0x26dcc8[_0x8d47('0x25')]]){for(var _0x381dc7 in this[_0x8d47('0xb')][_0x26dcc8[_0x8d47('0x25')]]){if(this[_0x8d47('0xb')][_0x26dcc8['uniqueid']][_0x8d47('0x40')](_0x381dc7)){if(this[_0x8d47('0xb')][_0x26dcc8[_0x8d47('0x25')]][_0x381dc7][_0x8d47('0x42')]&&!this[_0x8d47('0xb')][_0x26dcc8[_0x8d47('0x25')]][_0x381dc7][_0x8d47('0x15')]){logger[_0x8d47('0x24')](_0x8d47('0x5f'),_0x26dcc8[_0x8d47('0x25')],this[_0x8d47('0xb')][_0x26dcc8[_0x8d47('0x25')]][_0x381dc7][_0x8d47('0x26')],_0x381dc7);this['channels'][_0x26dcc8[_0x8d47('0x25')]][_0x381dc7][_0x8d47('0x15')]=!![];this[_0x8d47('0xb')][_0x26dcc8[_0x8d47('0x25')]][_0x381dc7][_0x8d47('0x60')]=moment()[_0x8d47('0x3c')](_0x8d47('0x2a'));this[_0x8d47('0xb')][_0x26dcc8[_0x8d47('0x25')]][_0x381dc7][_0x8d47('0x47')]=_0x8d47('0x61');this[_0x8d47('0xb')][_0x26dcc8[_0x8d47('0x25')]][_0x381dc7][_0x8d47('0x55')]=_0x26dcc8['reason']==_0x8d47('0x62')?_0x8d47('0x63'):_0x26dcc8[_0x8d47('0x55')];this['channels'][_0x26dcc8['uniqueid']][_0x381dc7]['talktime']=_0x26dcc8[_0x8d47('0x64')];if(this['voiceQueues'][_0x26dcc8[_0x8d47('0x2c')]]&&this['voiceQueues'][_0x26dcc8[_0x8d47('0x2c')]][_0x8d47('0x65')]){this['channels'][_0x26dcc8['uniqueid']][_0x381dc7][_0x8d47('0x66')]=this['voiceQueues'][_0x26dcc8['queue']][_0x8d47('0x67')];this[_0x8d47('0xb')][_0x26dcc8[_0x8d47('0x25')]][_0x381dc7][_0x8d47('0x68')]=!![];}this[_0x8d47('0xe')][_0x26dcc8[_0x8d47('0x39')]]=_['omit'](this['agents'][_0x26dcc8[_0x8d47('0x39')]],[_0x8d47('0x2c'),_0x8d47('0x69')]);logger[_0x8d47('0x28')](_0x8d47('0x6a'),_0x26dcc8[_0x8d47('0x25')],util[_0x8d47('0x37')](this['channels'][_0x26dcc8[_0x8d47('0x25')]][_0x381dc7],{'showHidden':![],'depth':null}));ami[_0x8d47('0x20')](_0x8d47('0x6b'),this[_0x8d47('0xb')][_0x26dcc8['uniqueid']][_0x381dc7]);logger[_0x8d47('0x28')](_0x8d47('0x6c'),_0x26dcc8['uniqueid'],util[_0x8d47('0x37')]({'id':this[_0x8d47('0xe')][_0x26dcc8['interface']]['id'],'destaccountcode':_0x26dcc8[_0x8d47('0x6d')]},{'showHidden':![],'depth':null}));this[_0x8d47('0x20')](util[_0x8d47('0x3c')](_0x8d47('0x3d'),_0x26dcc8[_0x8d47('0x26')]),'user:agentcomplete',{'id':this[_0x8d47('0xe')][_0x26dcc8['interface']]['id'],'destaccountcode':_0x26dcc8['destaccountcode']});}}}}}}catch(_0x3d78c9){logger[_0x8d47('0x3e')](_0x8d47('0x6e'),_0x26dcc8[_0x8d47('0x25')],util[_0x8d47('0x37')](_0x3d78c9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8d47('0x18')]=function(_0x5d751f){try{if(this[_0x8d47('0x23')](_0x5d751f)){logger[_0x8d47('0x28')](_0x8d47('0x6f'),_0x5d751f[_0x8d47('0x25')],util['inspect'](_0x5d751f,{'showHidden':![],'depth':null}));this[_0x8d47('0x70')](_0x5d751f[_0x8d47('0x25')],_['keys'](_0x5d751f[_0x8d47('0x71')])[0x0],_0x5d751f[_0x8d47('0x72')]);if(this['channels'][_0x5d751f[_0x8d47('0x25')]]){for(var _0x50d1fc in this[_0x8d47('0xb')][_0x5d751f[_0x8d47('0x25')]]){if(this[_0x8d47('0xb')][_0x5d751f[_0x8d47('0x25')]]['hasOwnProperty'](_0x50d1fc)){logger[_0x8d47('0x24')](_0x8d47('0x73'),_0x5d751f[_0x8d47('0x25')],_0x50d1fc,_[_0x8d47('0x74')](_0x5d751f['variable'])[0x0],_0x5d751f[_0x8d47('0x72')]);if(_[_0x8d47('0x21')](this[_0x8d47('0xb')][_0x5d751f['uniqueid']][_0x50d1fc][_0x8d47('0x30')])){this['channels'][_0x5d751f[_0x8d47('0x25')]][_0x50d1fc][_0x8d47('0x30')]={};}this[_0x8d47('0xb')][_0x5d751f[_0x8d47('0x25')]][_0x50d1fc][_0x8d47('0x30')]=this[_0x8d47('0x30')][_0x5d751f['uniqueid']];}}}}}catch(_0x4be630){logger[_0x8d47('0x3e')](_0x8d47('0x75'),_0x5d751f[_0x8d47('0x25')],util[_0x8d47('0x37')](_0x4be630,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8d47('0x1f')][_0x8d47('0x70')]=function(_0x178742,_0x380db0,_0x741803){var _0x2ff68c=[_0x8d47('0x76'),_0x8d47('0x77'),_0x8d47('0x78'),_0x8d47('0x79'),_0x8d47('0x7a'),_0x8d47('0x7b'),_0x8d47('0x7c'),_0x8d47('0x7d'),'sipcallid','sipuri',_0x8d47('0x7e'),_0x8d47('0x7f'),_0x8d47('0x80'),'memberdynamic','memberinterface',_0x8d47('0x81'),_0x8d47('0x26'),_0x8d47('0x82'),_0x8d47('0x83')];if(!_[_0x8d47('0x84')](_0x380db0)&&!_[_0x8d47('0x85')](_0x2ff68c,_0x380db0)){if(_[_0x8d47('0x21')](this[_0x8d47('0x30')][_0x178742])){this['variables'][_0x178742]={};}this[_0x8d47('0x30')][_0x178742][_0x380db0]=_0x741803;}};VoiceAgentReport[_0x8d47('0x1f')][_0x8d47('0x86')]=function(_0x352423){try{if(this[_0x8d47('0x23')](_0x352423)){logger[_0x8d47('0x28')]('[%s][voiceAgentReport][hangup]\x20event:',_0x352423[_0x8d47('0x25')],util[_0x8d47('0x37')](_0x352423,{'showHidden':![],'depth':null}));if(this[_0x8d47('0xb')][_0x352423['uniqueid']]){for(var _0x3350f9 in this[_0x8d47('0xb')][_0x352423[_0x8d47('0x25')]]){if(this[_0x8d47('0xb')][_0x352423[_0x8d47('0x25')]][_0x8d47('0x40')](_0x3350f9)){if(this[_0x8d47('0xb')][_0x352423['uniqueid']][_0x3350f9][_0x8d47('0x55')]=='transfer'&&this['channels'][_0x352423[_0x8d47('0x25')]][_0x3350f9][_0x8d47('0x15')]){logger['info'](_0x8d47('0x87'),_0x352423['uniqueid'],_0x3350f9);this[_0x8d47('0xb')][_0x352423[_0x8d47('0x25')]][_0x3350f9]['agentcompleteAt']=moment()[_0x8d47('0x3c')](_0x8d47('0x2a'));}}}logger[_0x8d47('0x28')](_0x8d47('0x88'),_0x352423['uniqueid'],util['inspect'](_[_0x8d47('0x89')](this['channels'][_0x352423[_0x8d47('0x25')]]),{'showHidden':![],'depth':null}));ami[_0x8d47('0x20')]('custom:voiceAgentReport',_[_0x8d47('0x89')](this['channels'][_0x352423['uniqueid']]));delete this[_0x8d47('0xb')][_0x352423[_0x8d47('0x25')]];}if(this[_0x8d47('0x30')][_0x352423[_0x8d47('0x25')]]){delete this[_0x8d47('0x30')][_0x352423['uniqueid']];}}}catch(_0x3a8f41){logger[_0x8d47('0x3e')](_0x8d47('0x8a'),_0x352423['uniqueid'],util[_0x8d47('0x37')](_0x3a8f41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8d47('0x1f')][_0x8d47('0x1d')]=function(_0x197122){try{if(this[_0x8d47('0x23')](_0x197122)){logger[_0x8d47('0x28')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x197122['uniqueid'],util[_0x8d47('0x37')](_0x197122,{'showHidden':![],'depth':null}));if(this['channels'][_0x197122[_0x8d47('0x8b')]]){for(var _0x3fd2fa in this[_0x8d47('0xb')][_0x197122[_0x8d47('0x8b')]]){if(this[_0x8d47('0xb')][_0x197122[_0x8d47('0x8b')]]['hasOwnProperty'](_0x3fd2fa)){if(_0x197122[_0x8d47('0x8c')]===_0x3fd2fa){logger['info'](_0x8d47('0x8d'),_0x197122[_0x8d47('0x25')],this['channels'][_0x197122[_0x8d47('0x8b')]][_0x3fd2fa]['membername'],_0x3fd2fa);var _0x298279=moment();this[_0x8d47('0xb')][_0x197122[_0x8d47('0x8b')]][_0x3fd2fa][_0x8d47('0x15')]=!![];this['channels'][_0x197122[_0x8d47('0x8b')]][_0x3fd2fa][_0x8d47('0x60')]=moment()[_0x8d47('0x3c')](_0x8d47('0x2a'));this[_0x8d47('0xb')][_0x197122[_0x8d47('0x8b')]][_0x3fd2fa][_0x8d47('0x47')]='complete';this[_0x8d47('0xb')][_0x197122[_0x8d47('0x8b')]][_0x3fd2fa][_0x8d47('0x55')]=_0x8d47('0x62');this['channels'][_0x197122[_0x8d47('0x8b')]][_0x3fd2fa]['talktime']=_0x298279['diff'](this[_0x8d47('0xb')][_0x197122['transfereeuniqueid']][_0x3fd2fa][_0x8d47('0x42')],_0x8d47('0x8e'));}}}}if(this[_0x8d47('0xb')][_0x197122[_0x8d47('0x8f')]]){var _0x4aba4d=this['channels'][_0x197122[_0x8d47('0x8f')]];this[_0x8d47('0xb')][_0x197122['secondtransfereruniqueid']]=this['channels'][_0x197122[_0x8d47('0x8b')]];this[_0x8d47('0xb')][_0x197122[_0x8d47('0x8b')]]=_0x4aba4d;}}}catch(_0x531c33){logger[_0x8d47('0x3e')](_0x8d47('0x90'),_0x197122[_0x8d47('0x25')],util[_0x8d47('0x37')](_0x531c33,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8d47('0x1f')][_0x8d47('0x1e')]=function(_0x28a2fe){try{if(this[_0x8d47('0x23')](_0x28a2fe)){logger[_0x8d47('0x28')](_0x8d47('0x91'),_0x28a2fe['uniqueid'],util[_0x8d47('0x37')](_0x28a2fe,{'showHidden':![],'depth':null}));if(this[_0x8d47('0xb')][_0x28a2fe[_0x8d47('0x8b')]]){for(var _0x373606 in this['channels'][_0x28a2fe[_0x8d47('0x8b')]]){if(this[_0x8d47('0xb')][_0x28a2fe['transfereeuniqueid']][_0x8d47('0x40')](_0x373606)){if(_0x28a2fe['transfereruniqueid']===_0x373606){logger['info'](_0x8d47('0x92'),_0x28a2fe['uniqueid'],this[_0x8d47('0xb')][_0x28a2fe[_0x8d47('0x8b')]][_0x373606][_0x8d47('0x26')],_0x373606);var _0x2aca82=moment();this[_0x8d47('0xb')][_0x28a2fe[_0x8d47('0x8b')]][_0x373606][_0x8d47('0x15')]=!![];this[_0x8d47('0xb')][_0x28a2fe['transfereeuniqueid']][_0x373606]['agentcompleteAt']=_0x2aca82;this[_0x8d47('0xb')][_0x28a2fe[_0x8d47('0x8b')]][_0x373606][_0x8d47('0x47')]='complete';this['channels'][_0x28a2fe['transfereeuniqueid']][_0x373606][_0x8d47('0x55')]='transfer';this[_0x8d47('0xb')][_0x28a2fe[_0x8d47('0x8b')]][_0x373606][_0x8d47('0x64')]=_0x2aca82[_0x8d47('0x93')](this[_0x8d47('0xb')][_0x28a2fe[_0x8d47('0x8b')]][_0x373606][_0x8d47('0x42')],_0x8d47('0x8e'));}}}}}}catch(_0x53a40b){logger[_0x8d47('0x3e')](_0x8d47('0x94'),_0x28a2fe['uniqueid'],util['inspect'](_0x53a40b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8d47('0x1f')]['syncMusicOnHoldStart']=function(_0x293186){var _0x59af38='';try{if(this[_0x8d47('0x23')](_0x293186)){logger['debug'](_0x8d47('0x95'),_0x293186[_0x8d47('0x25')],util[_0x8d47('0x37')](_0x293186,{'showHidden':![],'depth':null}));if(_0x293186[_0x8d47('0x96')]){_0x59af38=_0x293186[_0x8d47('0x96')][_0x8d47('0x97')](0x0,_0x293186[_0x8d47('0x96')][_0x8d47('0x98')]('-'));if(this['agents'][_0x59af38]){logger['info'](_0x8d47('0x99'),_0x293186[_0x8d47('0x25')],_0x59af38);this[_0x8d47('0xe')][_0x59af38]['onhold']=!![];}}}}catch(_0x4b3a86){logger['error'](_0x8d47('0x9a'),_0x293186['uniqueid'],util[_0x8d47('0x37')](_0x4b3a86,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8d47('0x1c')]=function(_0x295b79){var _0x360c2d='';try{if(this[_0x8d47('0x23')](_0x295b79)){logger[_0x8d47('0x28')](_0x8d47('0x9b'),_0x295b79['uniqueid'],util[_0x8d47('0x37')](_0x295b79,{'showHidden':![],'depth':null}));if(_0x295b79['channel']){_0x360c2d=_0x295b79[_0x8d47('0x96')]['substring'](0x0,_0x295b79[_0x8d47('0x96')][_0x8d47('0x98')]('-'));if(this[_0x8d47('0xe')][_0x360c2d]){logger['info'](_0x8d47('0x9c'),_0x295b79[_0x8d47('0x25')],_0x360c2d);this[_0x8d47('0xe')][_0x360c2d]['onhold']=![];}}}}catch(_0xf0da38){logger[_0x8d47('0x3e')](_0x8d47('0x9d'),_0x295b79['uniqueid'],util['inspect'](_0xf0da38,{'showHidden':![],'depth':null}));}};module[_0x8d47('0x9e')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index ba4e881..0c2e8b9 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','transferType','resolve','then','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','BlindTransfer','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','merge','pick','keys','context','channel','split','xcally-motion-preview','format','user:%s','name','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','from-sip','destconnectedlinenum','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','blindTransfers','application','applicationdata','appdata','startsWith','CDR(routeAlias)','queue','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastapplication','lastdata','toLowerCase','cdr(','match','type','isNil','channelstate','answered','answertime','diff','connectedlinenum','connectedlinename','destinationchannel','disposition','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','variable','mixmonitor_filename','value','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s'];(function(_0x28d109,_0x227664){var _0x12578d=function(_0x37633b){while(--_0x37633b){_0x28d109['push'](_0x28d109['shift']());}};_0x12578d(++_0x227664);}(_0x54ef,0x112));var _0xf54e=function(_0x3eb1e7,_0x23471c){_0x3eb1e7=_0x3eb1e7-0x0;var _0x195616=_0x54ef[_0x3eb1e7];return _0x195616;};'use strict';var _=require(_0xf54e('0x0'));var moment=require(_0xf54e('0x1'));var util=require(_0xf54e('0x2'));var path=require('path');var Redis=require(_0xf54e('0x3'));var config=require(_0xf54e('0x4'));var logger=require(_0xf54e('0x5'))(_0xf54e('0x6'));var ami=require(_0xf54e('0x7'));var Channel=require(_0xf54e('0x8'));var RpcSetting=require(_0xf54e('0x9'));var applications=['set','queue',_0xf54e('0xa'),_0xf54e('0xb'),_0xf54e('0xc'),'voicemail'];var dispositions=[_0xf54e('0xd'),'FAILED',_0xf54e('0xe'),_0xf54e('0xd'),'NO\x20ANSWER',_0xf54e('0xd'),_0xf54e('0xf'),_0xf54e('0x10'),_0xf54e('0xe'),'FAILED',_0xf54e('0xe')];config[_0xf54e('0x11')]=_[_0xf54e('0x12')](config[_0xf54e('0x11')],{'host':'localhost','port':0x18eb});var io=require(_0xf54e('0x13'))(new Redis(config['redis']));function VoiceCallReport(_0x4bd828){this[_0xf54e('0x14')]=_0x4bd828[_0xf54e('0x14')];this[_0xf54e('0x15')]=_0x4bd828[_0xf54e('0x15')];this['blindTransfers']={};ami['on'](_0xf54e('0x16'),this[_0xf54e('0x17')][_0xf54e('0x18')](this));ami['on'](_0xf54e('0x19'),this['syncNewExten'][_0xf54e('0x18')](this));ami['on'](_0xf54e('0x1a'),this[_0xf54e('0x1b')]['bind'](this));ami['on']('newstate',this[_0xf54e('0x1c')][_0xf54e('0x18')](this));ami['on'](_0xf54e('0x1d'),this[_0xf54e('0x1e')][_0xf54e('0x18')](this));ami['on'](_0xf54e('0x1f'),this[_0xf54e('0x20')][_0xf54e('0x18')](this));ami['on'](_0xf54e('0x21'),this[_0xf54e('0x22')][_0xf54e('0x18')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xf54e('0x18')](this));ami['on']('blindtransfer',this[_0xf54e('0x23')][_0xf54e('0x18')](this));ami['on'](_0xf54e('0x24'),this[_0xf54e('0x25')][_0xf54e('0x18')](this));ami['on'](_0xf54e('0x26'),this[_0xf54e('0x27')][_0xf54e('0x18')](this));try{logger[_0xf54e('0x28')](_0xf54e('0x29'));ami[_0xf54e('0x2a')]();}catch(_0x5b83df){logger[_0xf54e('0x2b')]('[voiceCallReport][coreshowchannels]',util[_0xf54e('0x2c')](_0x5b83df,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf54e('0x2d')][_0xf54e('0x2e')]=function(_0x474b61){return _0x474b61!==null&&!_[_0xf54e('0x2f')](_0x474b61);};VoiceCallReport[_0xf54e('0x2d')][_0xf54e('0x30')]=function(_0x43488d,_0x2342a9,_0x33457f){io['to'](_0x43488d)[_0xf54e('0x30')](_0x2342a9,_0x33457f);};VoiceCallReport[_0xf54e('0x2d')][_0xf54e('0x22')]=function(_0x5390b8){try{if(this[_0xf54e('0x2e')](_0x5390b8)){logger['info'](_0xf54e('0x31'),_0x5390b8['uniqueid'],_0x5390b8[_0xf54e('0x32')],_0x5390b8[_0xf54e('0x33')]);logger[_0xf54e('0x34')](_0xf54e('0x35'),_0x5390b8[_0xf54e('0x36')],util[_0xf54e('0x2c')](_0x5390b8,{'showHidden':![],'depth':null}));if(_0x5390b8[_0xf54e('0x36')]===_0x5390b8['linkedid']){if(!_['isUndefined'](this[_0xf54e('0x14')][_0x5390b8[_0xf54e('0x36')]])){_[_0xf54e('0x37')](this[_0xf54e('0x14')][_0x5390b8[_0xf54e('0x36')]],_[_0xf54e('0x38')](_0x5390b8,_[_0xf54e('0x39')](this[_0xf54e('0x14')][_0x5390b8[_0xf54e('0x36')]])));}}if(_0x5390b8[_0xf54e('0x3a')]==='from-sip'){if(this['agents'][_0x5390b8[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]]){if(_0x5390b8['exten']==_0xf54e('0x3d')){this[_0xf54e('0x15')][_0x5390b8[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]]['destconnectedlinenum']=_0x5390b8['connectedlinenum'];this['emit'](util[_0xf54e('0x3e')](_0xf54e('0x3f'),this[_0xf54e('0x15')][_0x5390b8[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]][_0xf54e('0x40')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x5390b8['channel'][_0xf54e('0x3c')]('-')[0x0]][_0xf54e('0x41')],'destconnectedlinenum':_0x5390b8['connectedlinenum']});}}}}}catch(_0x4d9b06){logger[_0xf54e('0x2b')](_0xf54e('0x42'),_0x5390b8[_0xf54e('0x36')],util['inspect'](_0x4d9b06,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf54e('0x2d')][_0xf54e('0x1b')]=function(_0x50aeca){try{if(this[_0xf54e('0x2e')](_0x50aeca)){logger[_0xf54e('0x34')](_0xf54e('0x43'),_0x50aeca[_0xf54e('0x36')],util[_0xf54e('0x2c')](_0x50aeca,{'showHidden':![],'depth':null}));if(this[_0xf54e('0x14')][_0x50aeca['uniqueid']])return;if(_0x50aeca['channel']===_0xf54e('0x44'))return;if(_0x50aeca[_0xf54e('0x36')]!==_0x50aeca[_0xf54e('0x45')]&&!this['blindTransfers'][_0x50aeca[_0xf54e('0x45')]])return;logger[_0xf54e('0x28')](_0xf54e('0x46'),_0x50aeca[_0xf54e('0x36')],_0x50aeca[_0xf54e('0x3a')],_0x50aeca[_0xf54e('0x47')]);this[_0xf54e('0x14')][_0x50aeca[_0xf54e('0x36')]]=new Channel();this[_0xf54e('0x14')][_0x50aeca[_0xf54e('0x36')]][_0xf54e('0x48')]=moment()[_0xf54e('0x3e')](_0xf54e('0x49'));this[_0xf54e('0x14')][_0x50aeca[_0xf54e('0x36')]]['disposition']=dispositions[_['toNumber'](_0x50aeca['channelstate'])];_[_0xf54e('0x37')](this[_0xf54e('0x14')][_0x50aeca['uniqueid']],_[_0xf54e('0x38')](_0x50aeca,_[_0xf54e('0x39')](this[_0xf54e('0x14')][_0x50aeca['uniqueid']])));if(_0x50aeca[_0xf54e('0x3a')]===_0xf54e('0x4a')){if(this[_0xf54e('0x15')][_0x50aeca[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]]){if(_[_0xf54e('0x2f')](this[_0xf54e('0x15')][_0x50aeca[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]]['destconnectedlinenum'])){this[_0xf54e('0x15')][_0x50aeca[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]][_0xf54e('0x4b')]=_0x50aeca[_0xf54e('0x47')];logger[_0xf54e('0x34')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x50aeca[_0xf54e('0x36')],util['inspect']({'id':this[_0xf54e('0x15')][_0x50aeca['channel'][_0xf54e('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xf54e('0x15')][_0x50aeca[_0xf54e('0x3b')]['split']('-')[0x0]][_0xf54e('0x41')],'destconnectedlinenum':_0x50aeca[_0xf54e('0x47')]},{'showHidden':![],'depth':null}));this[_0xf54e('0x30')](util[_0xf54e('0x3e')](_0xf54e('0x3f'),this['agents'][_0x50aeca[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]][_0xf54e('0x40')]),_0xf54e('0x4c'),{'id':this['agents'][_0x50aeca[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x50aeca[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]][_0xf54e('0x41')],'destconnectedlinenum':_0x50aeca[_0xf54e('0x47')]});}}}}}catch(_0x557964){logger[_0xf54e('0x2b')](_0xf54e('0x4d'),_0x50aeca[_0xf54e('0x36')],util[_0xf54e('0x2c')](_0x557964,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf54e('0x2d')][_0xf54e('0x17')]=function(_0x1231d0){try{if(this[_0xf54e('0x2e')](_0x1231d0)){logger[_0xf54e('0x34')](_0xf54e('0x4e'),_0x1231d0[_0xf54e('0x36')],util[_0xf54e('0x2c')](_0x1231d0,{'showHidden':![],'depth':null}));if(_0x1231d0[_0xf54e('0x3b')]===_0xf54e('0x44')||_0x1231d0[_0xf54e('0x47')]==='h')return;if(_0x1231d0[_0xf54e('0x36')]===_0x1231d0[_0xf54e('0x45')]||this[_0xf54e('0x4f')][_0x1231d0[_0xf54e('0x45')]]){_0x1231d0[_0xf54e('0x50')]=_0x1231d0['application']['toLowerCase']();_0x1231d0[_0xf54e('0x51')]=_0x1231d0[_0xf54e('0x52')]||_0x1231d0[_0xf54e('0x51')];if(_0x1231d0[_0xf54e('0x52')]&&!_0x1231d0[_0xf54e('0x52')][_0xf54e('0x53')](_0xf54e('0x54'))&&_0x1231d0[_0xf54e('0x50')]!==_0xf54e('0x55')){_0x1231d0[_0xf54e('0x51')]=_0x1231d0[_0xf54e('0x51')]['toLowerCase']();}logger[_0xf54e('0x28')](_0xf54e('0x56'),_0x1231d0[_0xf54e('0x36')],_0x1231d0[_0xf54e('0x50')],_0x1231d0[_0xf54e('0x51')]);if(_[_0xf54e('0x2f')](this[_0xf54e('0x14')][_0x1231d0['uniqueid']])){this[_0xf54e('0x14')][_0x1231d0[_0xf54e('0x36')]]=new Channel();this[_0xf54e('0x14')][_0x1231d0['uniqueid']][_0xf54e('0x48')]=_0x1231d0['duration']?moment()[_0xf54e('0x57')](moment[_0xf54e('0x58')](_0x1231d0[_0xf54e('0x58')])['seconds'](),_0xf54e('0x59'))[_0xf54e('0x3e')](_0xf54e('0x49')):moment()[_0xf54e('0x3e')](_0xf54e('0x49'));this[_0xf54e('0x14')][_0x1231d0[_0xf54e('0x36')]]['disposition']='NO\x20ANSWER';}_[_0xf54e('0x37')](this[_0xf54e('0x14')][_0x1231d0['uniqueid']],_[_0xf54e('0x38')](_0x1231d0,_['keys'](this[_0xf54e('0x14')][_0x1231d0['uniqueid']])));if(_[_0xf54e('0x5a')](applications,_0x1231d0[_0xf54e('0x50')])){this[_0xf54e('0x14')][_0x1231d0[_0xf54e('0x36')]][_0xf54e('0x5b')]=_0x1231d0[_0xf54e('0x50')];this['channels'][_0x1231d0['uniqueid']][_0xf54e('0x5c')]=_0x1231d0[_0xf54e('0x51')];if(_0x1231d0['application']==='set'&&_[_0xf54e('0x53')](_0x1231d0['applicationdata'][_0xf54e('0x5d')](),_0xf54e('0x5e'))){var _0x47596c=_0x1231d0[_0xf54e('0x51')][_0xf54e('0x3c')]('=');var _0x20c90d=_0x47596c[0x0][_0xf54e('0x5d')]()[_0xf54e('0x5f')](/cdr\((.*)\)/);if(_0x20c90d){if(_0x20c90d[0x1]===_0xf54e('0x60')&&!_[_0xf54e('0x61')](this[_0xf54e('0x14')][_0x1231d0[_0xf54e('0x36')]][_0x20c90d[0x1]]))return;this[_0xf54e('0x14')][_0x1231d0[_0xf54e('0x36')]][_0x20c90d[0x1]]=_0x47596c[0x1];}}else if(_0x1231d0['application']===_0xf54e('0x55')){this[_0xf54e('0x14')][_0x1231d0[_0xf54e('0x36')]][_0xf54e('0x55')]=_0x1231d0[_0xf54e('0x51')]['split'](',')[0x0];}}}}}catch(_0xf50b1b){logger[_0xf54e('0x2b')]('[%s][voiceCallReport][newexten]',_0x1231d0['uniqueid'],util[_0xf54e('0x2c')](_0xf50b1b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf54e('0x1c')]=function(_0x39c5eb){try{if(this[_0xf54e('0x2e')](_0x39c5eb)){logger[_0xf54e('0x28')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x39c5eb[_0xf54e('0x36')],_0x39c5eb['linkedid'],_0x39c5eb[_0xf54e('0x32')],_0x39c5eb[_0xf54e('0x33')]);logger[_0xf54e('0x34')]('[%s][voiceCallReport][newstate]\x20event:',_0x39c5eb[_0xf54e('0x36')],util['inspect'](_0x39c5eb,{'showHidden':![],'depth':null}));if(_0x39c5eb[_0xf54e('0x62')]!=='6')return;if(_0x39c5eb[_0xf54e('0x36')]!==_0x39c5eb['linkedid']){var _0x380b4f=moment();if(this['channels'][_0x39c5eb[_0xf54e('0x45')]]){if(!this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]][_0xf54e('0x63')]){this[_0xf54e('0x14')][_0x39c5eb['linkedid']][_0xf54e('0x63')]=!![];this[_0xf54e('0x14')][_0x39c5eb['linkedid']][_0xf54e('0x64')]=_0x380b4f[_0xf54e('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]][_0xf54e('0x48')]){this['channels'][_0x39c5eb[_0xf54e('0x45')]]['holdtime']=_0x380b4f[_0xf54e('0x65')](this[_0xf54e('0x14')][_0x39c5eb['linkedid']][_0xf54e('0x48')],_0xf54e('0x59'));}}this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]][_0xf54e('0x45')]=_0x39c5eb[_0xf54e('0x36')];if(_0x39c5eb[_0xf54e('0x33')]!==_0xf54e('0x3d')){this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]][_0xf54e('0x66')]=_0x39c5eb['calleridnum'];}this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]][_0xf54e('0x67')]=_0x39c5eb['calleridname'];this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]][_0xf54e('0x68')]=_0x39c5eb[_0xf54e('0x3b')];this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]][_0xf54e('0x69')]=dispositions[_['toNumber'](_0x39c5eb[_0xf54e('0x62')])];if(this[_0xf54e('0x15')][_0x39c5eb[_0xf54e('0x3b')]['split']('-')[0x0]]){this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]][_0xf54e('0x6a')]=this[_0xf54e('0x15')][_0x39c5eb['channel']['split']('-')[0x0]]['id'];this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]][_0xf54e('0x6b')]=this[_0xf54e('0x15')][_0x39c5eb[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]][_0xf54e('0x40')];}}if(this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x36')]]){if(!this[_0xf54e('0x14')][_0x39c5eb['uniqueid']][_0xf54e('0x63')]){this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x36')]][_0xf54e('0x63')]=!![];this['channels'][_0x39c5eb[_0xf54e('0x36')]][_0xf54e('0x64')]=_0x380b4f[_0xf54e('0x3e')](_0xf54e('0x49'));if(this['channels'][_0x39c5eb[_0xf54e('0x36')]][_0xf54e('0x48')]){this[_0xf54e('0x14')][_0x39c5eb['uniqueid']]['holdtime']=_0x380b4f[_0xf54e('0x65')](this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x36')]][_0xf54e('0x48')],_0xf54e('0x59'));}}if(_0x39c5eb[_0xf54e('0x33')]!==_0xf54e('0x3d')){this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x36')]]['connectedlinenum']=_0x39c5eb[_0xf54e('0x33')];}this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x36')]][_0xf54e('0x67')]=_0x39c5eb[_0xf54e('0x32')];this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x36')]][_0xf54e('0x68')]=_0x39c5eb[_0xf54e('0x3b')];this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x36')]][_0xf54e('0x69')]=dispositions[_['toNumber'](_0x39c5eb[_0xf54e('0x62')])];}}else{if(this[_0xf54e('0x14')][_0x39c5eb['uniqueid']]){if(this['agents'][_0x39c5eb[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]]){this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x36')]][_0xf54e('0x6a')]=this[_0xf54e('0x15')][_0x39c5eb[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]]['id'];this[_0xf54e('0x14')][_0x39c5eb['uniqueid']][_0xf54e('0x6b')]=this[_0xf54e('0x15')][_0x39c5eb[_0xf54e('0x3b')]['split']('-')[0x0]][_0xf54e('0x40')];}}}if(_0x39c5eb['context']===_0xf54e('0x4a')){if(this['agents'][_0x39c5eb[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]]){this['agents'][_0x39c5eb['channel'][_0xf54e('0x3c')]('-')[0x0]][_0xf54e('0x4b')]=_0x39c5eb[_0xf54e('0x47')];var _0x406261,_0x389f16;if(this['channels'][_0x39c5eb['uniqueid']]){_0x406261=this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x36')]][_0xf54e('0x6c')];_0x389f16=this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x36')]][_0xf54e('0x55')];}else if(this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]]){_0x406261=this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]]['routealias'];_0x389f16=this[_0xf54e('0x14')][_0x39c5eb[_0xf54e('0x45')]]['queue'];}logger['debug'](_0xf54e('0x6d'),_0x39c5eb[_0xf54e('0x36')],util[_0xf54e('0x2c')]({'id':this[_0xf54e('0x15')][_0x39c5eb[_0xf54e('0x3b')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xf54e('0x15')][_0x39c5eb[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]][_0xf54e('0x41')],'destconnectedlinenum':_0x39c5eb['exten'],'routealias':_0x406261,'queue':_0x389f16||undefined},{'showHidden':![],'depth':null}));this[_0xf54e('0x30')](util[_0xf54e('0x3e')](_0xf54e('0x3f'),this[_0xf54e('0x15')][_0x39c5eb['channel'][_0xf54e('0x3c')]('-')[0x0]][_0xf54e('0x40')]),_0xf54e('0x4c'),{'id':this[_0xf54e('0x15')][_0x39c5eb[_0xf54e('0x3b')]['split']('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0xf54e('0x15')][_0x39c5eb['channel']['split']('-')[0x0]][_0xf54e('0x41')],'destconnectedlinenum':_0x39c5eb[_0xf54e('0x47')],'routealias':_0x406261,'queue':_0x389f16||undefined});}}}}catch(_0x242f5c){logger[_0xf54e('0x2b')](_0xf54e('0x6e'),_0x39c5eb[_0xf54e('0x36')],util[_0xf54e('0x2c')](_0x242f5c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf54e('0x2d')][_0xf54e('0x6f')]=function(_0x5e1007,_0x3dddbd){try{if(this[_0xf54e('0x14')][_0x5e1007]){logger[_0xf54e('0x28')](_0xf54e('0x70'),_0x5e1007,_0x3dddbd);this[_0xf54e('0x14')][_0x5e1007][_0xf54e('0x71')]=!![];if(_['endsWith'](_0x3dddbd,_0xf54e('0x72'))){_0x3dddbd=_0x3dddbd[_0xf54e('0x73')](_0xf54e('0x72'),_0xf54e('0x74'));}this[_0xf54e('0x14')][_0x5e1007][_0xf54e('0x75')]=_0x3dddbd;var _0x57553f=_[_0xf54e('0x76')](this[_0xf54e('0x14')][_0x5e1007][_0xf54e('0x77')],{'filename':_0x3dddbd});if(_[_0xf54e('0x61')](_0x57553f)){this['channels'][_0x5e1007]['monitors'][_0xf54e('0x78')]({'filename':_0x3dddbd,'createdAt':moment()[_0xf54e('0x3e')](_0xf54e('0x49')),'mixmonitorid':'','status':_0xf54e('0x79')});}}}catch(_0x3005f0){logger[_0xf54e('0x2b')]('[%s][voiceCallReport][mixMonitorFilename]',_0x5e1007,util[_0xf54e('0x2c')](_0x3005f0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf54e('0x2d')][_0xf54e('0x1e')]=function(_0x2136c2){try{if(this[_0xf54e('0x2e')](_0x2136c2)){logger[_0xf54e('0x34')]('[%s][voiceCallReport][varset]\x20event:',_0x2136c2[_0xf54e('0x36')],util['inspect'](_0x2136c2,{'showHidden':![],'depth':null}));if(this[_0xf54e('0x14')][_0x2136c2['uniqueid']]&&_0x2136c2[_0xf54e('0x3b')]!=_0xf54e('0x44')){if(this[_0xf54e('0x2e')](_0x2136c2[_0xf54e('0x7a')])){if(this[_0xf54e('0x2e')](_0x2136c2['variable'][_0xf54e('0x7b')])){logger[_0xf54e('0x28')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x2136c2[_0xf54e('0x36')],_0x2136c2[_0xf54e('0x7c')]);this[_0xf54e('0x6f')](_0x2136c2[_0xf54e('0x36')],_0x2136c2['value']);}else if(this[_0xf54e('0x2e')](_0x2136c2[_0xf54e('0x7a')]['xmd-phone'])){logger[_0xf54e('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x2136c2['uniqueid'],_0x2136c2[_0xf54e('0x7c')]);this['channels'][_0x2136c2[_0xf54e('0x36')]][_0xf54e('0x33')]=_0x2136c2[_0xf54e('0x7c')];}else if(this[_0xf54e('0x2e')](_0x2136c2[_0xf54e('0x7a')]['xmd-callerid'])){logger[_0xf54e('0x28')](_0xf54e('0x7d'),_0x2136c2[_0xf54e('0x36')],_0x2136c2[_0xf54e('0x7c')]);this['channels'][_0x2136c2[_0xf54e('0x36')]]['callerid']=_0x2136c2[_0xf54e('0x7c')];}else if(this[_0xf54e('0x2e')](_0x2136c2['variable'][_0xf54e('0x7e')])){logger[_0xf54e('0x28')](_0xf54e('0x7f'),_0x2136c2[_0xf54e('0x36')],_0x2136c2['value']);this[_0xf54e('0x14')][_0x2136c2[_0xf54e('0x36')]][_0xf54e('0x60')]=_0x2136c2['value'];}else if(this['isNotNull'](_0x2136c2[_0xf54e('0x7a')]['xmd-queue'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x2136c2[_0xf54e('0x36')],_0x2136c2[_0xf54e('0x7c')][_0xf54e('0x3c')](',')[0x0]);this[_0xf54e('0x14')][_0x2136c2[_0xf54e('0x36')]][_0xf54e('0x55')]=_0x2136c2[_0xf54e('0x7c')][_0xf54e('0x3c')](',')[0x0];}else if(this[_0xf54e('0x2e')](_0x2136c2['variable'][_0xf54e('0x80')])){logger['info'](_0xf54e('0x81'),_0x2136c2[_0xf54e('0x36')],_0x2136c2['value']);this[_0xf54e('0x14')][_0x2136c2['uniqueid']][_0xf54e('0x82')]=_0x2136c2[_0xf54e('0x7c')];}else if(this[_0xf54e('0x2e')](_0x2136c2[_0xf54e('0x7a')][_0xf54e('0x83')])){logger[_0xf54e('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x2136c2['uniqueid'],_0x2136c2['value']);this[_0xf54e('0x14')][_0x2136c2['uniqueid']][_0xf54e('0x84')]=_0x2136c2[_0xf54e('0x7c')];}else if(this[_0xf54e('0x2e')](_0x2136c2[_0xf54e('0x7a')][_0xf54e('0x85')])){logger['info'](_0xf54e('0x86'),_0x2136c2[_0xf54e('0x36')],_0x2136c2[_0xf54e('0x7c')]);this[_0xf54e('0x14')][_0x2136c2[_0xf54e('0x36')]][_0xf54e('0x87')]=_0x2136c2['value'];}else if(this[_0xf54e('0x2e')](_0x2136c2[_0xf54e('0x7a')][_0xf54e('0x88')])){logger[_0xf54e('0x28')](_0xf54e('0x89'),_0x2136c2['uniqueid'],_0x2136c2[_0xf54e('0x7c')]);this[_0xf54e('0x14')][_0x2136c2[_0xf54e('0x36')]][_0xf54e('0x55')]=_0x2136c2[_0xf54e('0x7c')];}else if(this[_0xf54e('0x2e')](_0x2136c2[_0xf54e('0x7a')][_0xf54e('0x8a')])){logger[_0xf54e('0x28')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x2136c2[_0xf54e('0x36')],_0x2136c2[_0xf54e('0x7c')]);this['channels'][_0x2136c2['uniqueid']][_0xf54e('0x8b')]=_0x2136c2['value'];}}}else if(this[_0xf54e('0x2e')](_0x2136c2[_0xf54e('0x7a')][_0xf54e('0x7b')])){if(_0x2136c2[_0xf54e('0x7c')]){var _0x54ea96=path[_0xf54e('0x8c')](_0x2136c2[_0xf54e('0x7c')])['name'];logger[_0xf54e('0x28')](_0xf54e('0x8d'),_0x54ea96,_0x2136c2[_0xf54e('0x7c')]);this[_0xf54e('0x6f')](_0x54ea96,_0x2136c2[_0xf54e('0x7c')]);}}else if(this[_0xf54e('0x14')][_0x2136c2[_0xf54e('0x45')]]){if(this[_0xf54e('0x2e')](_0x2136c2[_0xf54e('0x7a')])){if(this[_0xf54e('0x2e')](_0x2136c2[_0xf54e('0x7a')]['sipcallid'])){logger['info'](_0xf54e('0x8e'),_0x2136c2[_0xf54e('0x45')],_0x2136c2[_0xf54e('0x7c')]);this[_0xf54e('0x14')][_0x2136c2[_0xf54e('0x45')]]['sipcalllinkedid']=_0x2136c2[_0xf54e('0x7c')];}}}}}catch(_0x24b324){logger[_0xf54e('0x2b')](_0xf54e('0x8f'),_0x2136c2['uniqueid'],util[_0xf54e('0x2c')](_0x24b324,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf54e('0x2d')][_0xf54e('0x20')]=function(_0x17d37f){try{if(this[_0xf54e('0x2e')](_0x17d37f)){logger[_0xf54e('0x34')](_0xf54e('0x90'),_0x17d37f[_0xf54e('0x36')],util[_0xf54e('0x2c')](_0x17d37f,{'showHidden':![],'depth':null}));if(this[_0xf54e('0x4f')][_0x17d37f[_0xf54e('0x45')]]){if(this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f[_0xf54e('0x45')]]['linkedid']]){this[_0xf54e('0x14')][this['blindTransfers'][_0x17d37f['linkedid']][_0xf54e('0x45')]][_0xf54e('0x36')]=_0x17d37f[_0xf54e('0x36')];this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f[_0xf54e('0x45')]][_0xf54e('0x45')]][_0xf54e('0x63')]=this[_0xf54e('0x14')][_0x17d37f[_0xf54e('0x36')]][_0xf54e('0x63')];this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f['linkedid']][_0xf54e('0x45')]][_0xf54e('0x64')]=this[_0xf54e('0x14')][_0x17d37f[_0xf54e('0x36')]][_0xf54e('0x64')];this['channels'][this['blindTransfers'][_0x17d37f[_0xf54e('0x45')]][_0xf54e('0x45')]]['destinationchannel']=this['channels'][this[_0xf54e('0x4f')][_0x17d37f['linkedid']][_0xf54e('0x45')]][_0xf54e('0x3b')];this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f[_0xf54e('0x45')]][_0xf54e('0x45')]]['disposition']=this[_0xf54e('0x14')][_0x17d37f[_0xf54e('0x36')]]['disposition'];this[_0xf54e('0x14')][_0x17d37f[_0xf54e('0x36')]]=this['channels'][this[_0xf54e('0x4f')][_0x17d37f[_0xf54e('0x45')]][_0xf54e('0x45')]];delete this['channels'][this['blindTransfers'][_0x17d37f[_0xf54e('0x45')]][_0xf54e('0x45')]];}else if(this['channels'][this['blindTransfers'][_0x17d37f['linkedid']][_0xf54e('0x36')]]){this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f['linkedid']][_0xf54e('0x36')]][_0xf54e('0x36')]=[this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f[_0xf54e('0x45')]]['uniqueid']]['linkedid'],this['channels'][this['blindTransfers'][_0x17d37f['linkedid']][_0xf54e('0x36')]]['linkedid']=this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f['linkedid']][_0xf54e('0x36')]]['uniqueid']][0x0];this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f[_0xf54e('0x45')]][_0xf54e('0x36')]][_0xf54e('0x63')]=this[_0xf54e('0x14')][_0x17d37f[_0xf54e('0x36')]]['answered'];this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f[_0xf54e('0x45')]][_0xf54e('0x36')]][_0xf54e('0x64')]=this['channels'][_0x17d37f[_0xf54e('0x36')]][_0xf54e('0x64')];this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f[_0xf54e('0x45')]][_0xf54e('0x36')]]['destinationchannel']=this['channels'][this['blindTransfers'][_0x17d37f[_0xf54e('0x45')]][_0xf54e('0x36')]][_0xf54e('0x3b')];this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f['linkedid']][_0xf54e('0x36')]][_0xf54e('0x69')]=this['channels'][_0x17d37f[_0xf54e('0x36')]][_0xf54e('0x69')];this[_0xf54e('0x14')][_0x17d37f['uniqueid']]=this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f[_0xf54e('0x45')]][_0xf54e('0x36')]];delete this[_0xf54e('0x14')][this[_0xf54e('0x4f')][_0x17d37f[_0xf54e('0x45')]][_0xf54e('0x36')]];}}if(this['channels'][_0x17d37f[_0xf54e('0x36')]]){logger['info'](_0xf54e('0x91'),_0x17d37f[_0xf54e('0x36')],_0x17d37f[_0xf54e('0x92')]);var _0x227683=moment();this[_0xf54e('0x14')][_0x17d37f[_0xf54e('0x36')]][_0xf54e('0x93')]=_0x227683['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x17d37f[_0xf54e('0x36')]]['duration']=_0x227683[_0xf54e('0x65')](this['channels'][_0x17d37f[_0xf54e('0x36')]][_0xf54e('0x48')],'seconds');if(this[_0xf54e('0x14')][_0x17d37f[_0xf54e('0x36')]][_0xf54e('0x63')]){this[_0xf54e('0x14')][_0x17d37f[_0xf54e('0x36')]][_0xf54e('0x94')]=_0x227683[_0xf54e('0x65')](this[_0xf54e('0x14')][_0x17d37f[_0xf54e('0x36')]][_0xf54e('0x64')],_0xf54e('0x59'));this['channels'][_0x17d37f[_0xf54e('0x36')]][_0xf54e('0x95')]=this[_0xf54e('0x14')][_0x17d37f['uniqueid']][_0xf54e('0x58')]-this['channels'][_0x17d37f[_0xf54e('0x36')]][_0xf54e('0x94')];}if(_0x17d37f[_0xf54e('0x3a')]===_0xf54e('0x4a')){if(this[_0xf54e('0x15')][_0x17d37f[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]]){this[_0xf54e('0x15')][_0x17d37f[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]]=_[_0xf54e('0x96')](this['agents'][_0x17d37f['channel']['split']('-')[0x0]],[_0xf54e('0x4b')]);logger[_0xf54e('0x34')](_0xf54e('0x97'),_0x17d37f['uniqueid'],util[_0xf54e('0x2c')]({'id':this[_0xf54e('0x15')][_0x17d37f['channel'][_0xf54e('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xf54e('0x15')][_0x17d37f[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]][_0xf54e('0x41')]},{'showHidden':![],'depth':null}));this[_0xf54e('0x30')](util[_0xf54e('0x3e')]('user:%s',this['agents'][_0x17d37f[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]][_0xf54e('0x40')]),_0xf54e('0x98'),{'id':this['agents'][_0x17d37f[_0xf54e('0x3b')][_0xf54e('0x3c')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x17d37f[_0xf54e('0x3b')]['split']('-')[0x0]][_0xf54e('0x41')]});for(var _0x3a2788=0x0;_0x3a27880x0?_0x9e660c:0x0;this[_0xd3b0('0x12')][_0x6c01f1['queue']][_0xd3b0('0x59')]=this[_0xd3b0('0x12')][_0x6c01f1[_0xd3b0('0x69')]][_0xd3b0('0x59')]>_[_0xd3b0('0x6e')](_0x6c01f1['loggedin'])?_['toNumber'](_0x6c01f1[_0xd3b0('0x6f')]):this[_0xd3b0('0x12')][_0x6c01f1[_0xd3b0('0x69')]][_0xd3b0('0x59')];this[_0xd3b0('0x52')](this[_0xd3b0('0x12')][_0x6c01f1['queue']],'queuesummary');}logger[_0xd3b0('0x4d')](_0xd3b0('0x71'),util[_0xd3b0('0x3f')](this[_0xd3b0('0x12')][_0x6c01f1[_0xd3b0('0x69')]],{'showHidden':![],'depth':null}));ami[_0xd3b0('0x45')](_0xd3b0('0x72'),this['voiceQueues'][_0x6c01f1['queue']]);}}}catch(_0xc2ae78){logger[_0xd3b0('0x3e')](_0xd3b0('0x67'),util['inspect'](_0xc2ae78,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd3b0('0x73')]=function(_0x507b36){logger[_0xd3b0('0x4d')](_0xd3b0('0x74'),util['inspect'](_0x507b36,{'showHidden':![],'depth':null}));this[_0xd3b0('0x13')]=!![];};VoiceQueueReport[_0xd3b0('0xb')][_0xd3b0('0x75')]=function(_0x5893a8){try{if(this[_0xd3b0('0x68')](_0x5893a8)){logger[_0xd3b0('0x4d')](_0xd3b0('0x76'),_0x5893a8['uniqueid'],util[_0xd3b0('0x3f')](_0x5893a8,{'showHidden':![],'depth':null}));if(_[_0xd3b0('0x77')](this[_0xd3b0('0xf')][_0x5893a8[_0xd3b0('0x48')]]))this[_0xd3b0('0xf')][_0x5893a8[_0xd3b0('0x48')]]=[];if(_[_0xd3b0('0x77')](this[_0xd3b0('0x38')][_0x5893a8[_0xd3b0('0x48')]]))this[_0xd3b0('0x38')][_0x5893a8[_0xd3b0('0x48')]]={};var _0x4576d5=new QueueReport();_0x4576d5[_0xd3b0('0x50')]=_0x5893a8[_0xd3b0('0x69')];_0x4576d5[_0xd3b0('0x78')]=this[_0xd3b0('0x12')][_0x4576d5[_0xd3b0('0x50')]]&&this[_0xd3b0('0x12')][_0x4576d5['name']][_0xd3b0('0x78')]?this[_0xd3b0('0x12')][_0x4576d5['name']][_0xd3b0('0x78')]||_0xd3b0('0x79'):_0xd3b0('0x79');_0x4576d5[_0xd3b0('0x69')]=_0x5893a8[_0xd3b0('0x69')];_0x4576d5[_0xd3b0('0x7a')]=moment()[_0xd3b0('0x49')](_0xd3b0('0x7b'));_0x4576d5['position']=_0x5893a8[_0xd3b0('0x7c')];_0x4576d5[_0xd3b0('0x7d')]=_0x5893a8[_0xd3b0('0x7d')];_0x4576d5[_0xd3b0('0x48')]=_0x5893a8[_0xd3b0('0x48')];_0x4576d5[_0xd3b0('0x7e')]=this[_0xd3b0('0x38')][_0x5893a8[_0xd3b0('0x48')]][_0xd3b0('0x7e')];logger['info'](_0xd3b0('0x7f'),_0x4576d5[_0xd3b0('0x50')],_0x4576d5[_0xd3b0('0x78')]);_[_0xd3b0('0x80')](_0x4576d5,_['pick'](_0x5893a8,_[_0xd3b0('0x81')](_0x4576d5)));this[_0xd3b0('0xf')][_0x5893a8[_0xd3b0('0x48')]]['push'](_0x4576d5);this[_0xd3b0('0x38')][_0x5893a8['uniqueid']]=_0x4576d5;this[_0xd3b0('0x46')](_0x4576d5,_0xd3b0('0x1a'));}}catch(_0x2c339b){logger[_0xd3b0('0x3e')](_0xd3b0('0x76'),_0x5893a8[_0xd3b0('0x48')],util['inspect'](_0x2c339b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x5630e2){try{if(this[_0xd3b0('0x68')](_0x5630e2)){logger[_0xd3b0('0x4d')](_0xd3b0('0x82'),_0x5630e2[_0xd3b0('0x48')],util[_0xd3b0('0x3f')](_0x5630e2,{'showHidden':![],'depth':null}));if(this[_0xd3b0('0xf')][_0x5630e2['uniqueid']]){var _0x1c7925=_['last'](this[_0xd3b0('0xf')][_0x5630e2[_0xd3b0('0x48')]]);_0x1c7925[_0xd3b0('0x83')]=![];_0x1c7925[_0xd3b0('0x84')]=null;_0x1c7925[_0xd3b0('0x85')]=_0x5630e2['holdtime'];_0x1c7925[_0xd3b0('0x86')]=_0x5630e2[_0xd3b0('0x86')];_0x1c7925[_0xd3b0('0x1b')]=!![];_0x1c7925[_0xd3b0('0x87')]=moment()['format'](_0xd3b0('0x7b'));_0x1c7925[_0xd3b0('0x4f')]=_0xd3b0('0x88');_0x1c7925[_0xd3b0('0x89')]=null;logger['info'](_0xd3b0('0x8a'),_0x1c7925[_0xd3b0('0x50')],_0x1c7925[_0xd3b0('0x78')]);this[_0xd3b0('0x38')][_0x5630e2['uniqueid']]=_0x1c7925;this[_0xd3b0('0x43')](_0x1c7925,'queuecallerabandon');}}}catch(_0x130d38){logger[_0xd3b0('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5630e2[_0xd3b0('0x48')],util[_0xd3b0('0x3f')](_0x130d38,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd3b0('0xb')][_0xd3b0('0x1e')]=function(_0x3cdf68){try{if(this[_0xd3b0('0x68')](_0x3cdf68)){logger[_0xd3b0('0x4d')](_0xd3b0('0x8b'),_0x3cdf68[_0xd3b0('0x48')],util[_0xd3b0('0x3f')](_0x3cdf68,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3cdf68[_0xd3b0('0x48')]]){var _0x152b62=_[_0xd3b0('0x8c')](this[_0xd3b0('0xf')][_0x3cdf68[_0xd3b0('0x48')]]);_0x152b62[_0xd3b0('0x8d')]=moment()['format'](_0xd3b0('0x7b'));_0x152b62[_0xd3b0('0x8e')]=_0x3cdf68[_0xd3b0('0x8e')];_0x152b62[_0xd3b0('0x8f')]=_0x3cdf68[_0xd3b0('0x8f')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x152b62['name'],_0x152b62[_0xd3b0('0x78')],_0x3cdf68[_0xd3b0('0x8e')],_0x3cdf68[_0xd3b0('0x8f')]);this[_0xd3b0('0x38')][_0x3cdf68['uniqueid']]=_0x152b62;this[_0xd3b0('0x46')](_0x152b62,'queuecallerleave');}}}catch(_0x105087){logger[_0xd3b0('0x3e')]('[%s][voiceQueueReport][queuecallerleave]',_0x3cdf68[_0xd3b0('0x48')],util[_0xd3b0('0x3f')](_0x105087,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd3b0('0xb')][_0xd3b0('0x22')]=function(_0x2e046a){try{if(this[_0xd3b0('0x68')](_0x2e046a)){logger[_0xd3b0('0x4d')]('[%s][voiceQueueReport][agentconnect]',_0x2e046a[_0xd3b0('0x48')],util[_0xd3b0('0x3f')](_0x2e046a,{'showHidden':![],'depth':null}));if(this[_0xd3b0('0xf')][_0x2e046a['uniqueid']]){var _0x31fa82=_[_0xd3b0('0x8c')](this[_0xd3b0('0xf')][_0x2e046a[_0xd3b0('0x48')]]);_0x31fa82['queuecallercomplete']=!![];_0x31fa82[_0xd3b0('0x4f')]='COMPLETEDBYAGENT';logger[_0xd3b0('0x6b')](_0xd3b0('0x90'),_0x31fa82[_0xd3b0('0x50')],_0x31fa82[_0xd3b0('0x78')]);}}}catch(_0x4e97c2){logger[_0xd3b0('0x3e')](_0xd3b0('0x91'),_0x2e046a[_0xd3b0('0x48')],util['inspect'](_0x4e97c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd3b0('0xb')][_0xd3b0('0x20')]=function(_0x58861d){try{if(this[_0xd3b0('0x68')](_0x58861d)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x58861d['uniqueid'],util[_0xd3b0('0x3f')](_0x58861d,{'showHidden':![],'depth':null}));if(this[_0xd3b0('0xf')][_0x58861d['uniqueid']]){var _0x11d6c3=_['last'](this[_0xd3b0('0xf')][_0x58861d['uniqueid']]);_0x11d6c3[_0xd3b0('0x1b')]=![];_0x11d6c3['queuecallerabandonAt']=null;_0x11d6c3['assigned']=!![];_0x11d6c3['lastAssignedTo']=_0x58861d[_0xd3b0('0x92')];_0x11d6c3['holdtime']=_0x58861d[_0xd3b0('0x85')];_0x11d6c3[_0xd3b0('0x83')]=!![];_0x11d6c3[_0xd3b0('0x93')]=![];_0x11d6c3[_0xd3b0('0x94')]=null;if(!_0x11d6c3[_0xd3b0('0x95')]){if(_0x58861d[_0xd3b0('0x96')]=='transfer'){_0x11d6c3['queuecallerexitreason']=_0xd3b0('0x97');logger['info'](_0xd3b0('0x98'),_0x11d6c3[_0xd3b0('0x50')],_0x11d6c3['type']);}else{if(_[_0xd3b0('0x99')](_0x58861d[_0xd3b0('0x3b')][_0xd3b0('0x9a')](),'local/')){if(this['queueReports'][_0x58861d[_0xd3b0('0x9b')]]){var _0x4959fc=_['last'](this[_0xd3b0('0xf')][_0x58861d[_0xd3b0('0x9b')]]);_0x4959fc[_0xd3b0('0x83')]=![];_0x4959fc[_0xd3b0('0x93')]=!![];_0x4959fc['queuecallerexitAt']=moment(_0x11d6c3[_0xd3b0('0x7a')])['add'](_0x58861d[_0xd3b0('0x85')],_0xd3b0('0x9c'))[_0xd3b0('0x49')](_0xd3b0('0x7b'));_0x4959fc[_0xd3b0('0x4f')]=_0xd3b0('0x9d');_0x4959fc[_0xd3b0('0x95')]=!![];_0x4959fc[_0xd3b0('0x9e')]=_0xd3b0('0x9f');_0x4959fc['transferexten']=_0x58861d[_0xd3b0('0xa0')];_0x4959fc[_0xd3b0('0xa1')]=_0x58861d['uniqueid'];logger['info'](_0xd3b0('0xa2'),_0x4959fc[_0xd3b0('0x50')],_0x4959fc['type']);var _0x3be671=this[_0xd3b0('0xf')][_0x58861d[_0xd3b0('0x9b')]];this[_0xd3b0('0xf')][_0x58861d[_0xd3b0('0x9b')]]=this[_0xd3b0('0xf')][_0x58861d[_0xd3b0('0x48')]];this[_0xd3b0('0xf')][_0x58861d[_0xd3b0('0x48')]]=_0x3be671;}}else{_0x11d6c3[_0xd3b0('0x4f')]=_0xd3b0('0xa3')+_0x58861d[_0xd3b0('0x96')][_0xd3b0('0xa4')]();logger[_0xd3b0('0x6b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x11d6c3[_0xd3b0('0x50')],_0x11d6c3[_0xd3b0('0x78')],_0x11d6c3[_0xd3b0('0x4f')]);}}}this[_0xd3b0('0x38')][_0x58861d[_0xd3b0('0x48')]]=_0x11d6c3;this[_0xd3b0('0x43')](_0x11d6c3,_0xd3b0('0x1f'));}}}catch(_0x3a340c){logger[_0xd3b0('0x3e')](_0xd3b0('0xa5'),_0x58861d['uniqueid'],util['inspect'](_0x3a340c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd3b0('0xb')][_0xd3b0('0x24')]=function(_0x6756b3){try{if(this[_0xd3b0('0x68')](_0x6756b3)){logger[_0xd3b0('0x4d')](_0xd3b0('0xa6'),_0x6756b3[_0xd3b0('0x48')],util[_0xd3b0('0x3f')](_0x6756b3,{'showHidden':![],'depth':null}));this['addVariable'](_0x6756b3[_0xd3b0('0x48')],_[_0xd3b0('0x81')](_0x6756b3[_0xd3b0('0xa7')])[0x0],_0x6756b3[_0xd3b0('0xa8')]);if(this[_0xd3b0('0xf')][_0x6756b3['uniqueid']]){var _0x59802e=_[_0xd3b0('0x8c')](this[_0xd3b0('0xf')][_0x6756b3['uniqueid']]);if(_0x59802e){if(this[_0xd3b0('0x68')](_0x6756b3[_0xd3b0('0xa7')])&&this[_0xd3b0('0x68')](_0x6756b3[_0xd3b0('0xa7')][_0xd3b0('0xa9')])){switch(_0x6756b3[_0xd3b0('0xa8')]){case _0xd3b0('0xaa'):_0x59802e['queuecallerexit']=![];_0x59802e[_0xd3b0('0x94')]=null;break;case _0xd3b0('0xab'):_0x59802e[_0xd3b0('0xac')]=_0xd3b0('0xad');_0x59802e[_0xd3b0('0x93')]=!![];_0x59802e[_0xd3b0('0x94')]=moment()[_0xd3b0('0x49')](_0xd3b0('0x7b'));_0x59802e[_0xd3b0('0x8d')]=moment()[_0xd3b0('0x49')](_0xd3b0('0x7b'));logger[_0xd3b0('0x4d')](_0xd3b0('0xae'),_0x6756b3['uniqueid'],util[_0xd3b0('0x3f')](_0x59802e,{'showHidden':![],'depth':null}));ami[_0xd3b0('0x45')](_0xd3b0('0xaf'),_0x59802e);break;default:_0x59802e[_0xd3b0('0x93')]=!![];_0x59802e[_0xd3b0('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x59802e[_0xd3b0('0x8d')]=moment()['format'](_0xd3b0('0x7b'));}_0x59802e[_0xd3b0('0x1b')]=![];_0x59802e[_0xd3b0('0x87')]=null;_0x59802e[_0xd3b0('0x4f')]=_0x6756b3[_0xd3b0('0xa8')];this[_0xd3b0('0x38')][_0x6756b3[_0xd3b0('0x48')]]=_0x59802e;this[_0xd3b0('0x43')](_0x59802e,_0xd3b0('0x23'));}else if(this[_0xd3b0('0x68')](_0x6756b3['variable'])&&this[_0xd3b0('0x68')](_0x6756b3['variable']['queueposition'])){if(!_0x59802e[_0xd3b0('0x1b')]){_0x59802e['queuecallerexit']=!![];_0x59802e[_0xd3b0('0x94')]=moment()[_0xd3b0('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x59802e[_0xd3b0('0x4f')]='EXITWITHKEY';_0x59802e[_0xd3b0('0x8d')]=moment()[_0xd3b0('0x49')](_0xd3b0('0x7b'));this[_0xd3b0('0x38')][_0x6756b3['uniqueid']]=_0x59802e;}}logger[_0xd3b0('0x6b')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x6756b3[_0xd3b0('0x48')],_0x59802e[_0xd3b0('0x50')],_0x59802e[_0xd3b0('0x78')],_[_0xd3b0('0x81')](_0x6756b3[_0xd3b0('0xa7')])[0x0],_0x6756b3[_0xd3b0('0xa8')]);_0x59802e[_0xd3b0('0x15')]=this[_0xd3b0('0x15')][_0x6756b3[_0xd3b0('0x48')]];}}}}catch(_0x32396a){logger['error'](_0xd3b0('0xa6'),_0x6756b3['uniqueid'],util[_0xd3b0('0x3f')](_0x32396a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x1ec3d4,_0x41810a,_0x465cef){var _0x39394f=[_0xd3b0('0xb0'),'rtpaudioqosbridged','rtpaudioqosjitter',_0xd3b0('0xb1'),'rtpaudioqosloss',_0xd3b0('0xb2'),_0xd3b0('0xb3'),'rtpaudioqosrttbridged',_0xd3b0('0xb4'),_0xd3b0('0xb5'),'bridgepeer','bridgepvtcallid',_0xd3b0('0xb6'),_0xd3b0('0xb7'),_0xd3b0('0xb8'),_0xd3b0('0xb9'),'membername',_0xd3b0('0xba'),_0xd3b0('0xbb')];if(!_['isNil'](_0x41810a)&&!_[_0xd3b0('0xbc')](_0x39394f,_0x41810a)){if(_[_0xd3b0('0x77')](this[_0xd3b0('0x15')][_0x1ec3d4])){this[_0xd3b0('0x15')][_0x1ec3d4]={};}this['variables'][_0x1ec3d4][_0x41810a]=_0x465cef;}};VoiceQueueReport[_0xd3b0('0xb')]['syncHangup']=function(_0x293451){try{if(this[_0xd3b0('0x68')](_0x293451)){logger[_0xd3b0('0x4d')]('[%s][voiceQueueReport][hangup]',_0x293451[_0xd3b0('0x48')],util[_0xd3b0('0x3f')](_0x293451,{'showHidden':![],'depth':null}));if(this[_0xd3b0('0xf')][_0x293451[_0xd3b0('0x48')]]){for(var _0x15c914=0x0,_0x4ceb89={};_0x15c9140x0?_0x2b67c2:0x0;this[_0xaf9a('0x12')][_0x107590[_0xaf9a('0x67')]][_0xaf9a('0x6e')]=this[_0xaf9a('0x12')][_0x107590[_0xaf9a('0x67')]][_0xaf9a('0x6e')]>_[_0xaf9a('0x6d')](_0x107590['loggedin'])?_['toNumber'](_0x107590['loggedin']):this[_0xaf9a('0x12')][_0x107590[_0xaf9a('0x67')]][_0xaf9a('0x6e')];this[_0xaf9a('0x4f')](this[_0xaf9a('0x12')][_0x107590[_0xaf9a('0x67')]],_0xaf9a('0x16'));}logger[_0xaf9a('0x45')](_0xaf9a('0x6f'),util[_0xaf9a('0x3d')](this[_0xaf9a('0x12')][_0x107590[_0xaf9a('0x67')]],{'showHidden':![],'depth':null}));ami[_0xaf9a('0x43')](_0xaf9a('0x70'),this[_0xaf9a('0x12')][_0x107590['queue']]);}}}catch(_0xfb790a){logger[_0xaf9a('0x3b')](_0xaf9a('0x71'),util[_0xaf9a('0x3d')](_0xfb790a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xaf9a('0x19')]=function(_0x1aba97){logger[_0xaf9a('0x45')](_0xaf9a('0x72'),util[_0xaf9a('0x3d')](_0x1aba97,{'showHidden':![],'depth':null}));this[_0xaf9a('0x13')]=!![];};VoiceQueueReport[_0xaf9a('0xa')][_0xaf9a('0x1b')]=function(_0x287b8e){try{if(this['isNotNull'](_0x287b8e)){logger[_0xaf9a('0x45')](_0xaf9a('0x73'),_0x287b8e[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x287b8e,{'showHidden':![],'depth':null}));if(_[_0xaf9a('0x74')](this[_0xaf9a('0xe')][_0x287b8e[_0xaf9a('0x48')]]))this['queueReports'][_0x287b8e[_0xaf9a('0x48')]]=[];if(_['isUndefined'](this['channels'][_0x287b8e[_0xaf9a('0x48')]]))this['channels'][_0x287b8e[_0xaf9a('0x48')]]={};var _0x17c220=new QueueReport();_0x17c220['name']=_0x287b8e[_0xaf9a('0x67')];_0x17c220[_0xaf9a('0x58')]=this[_0xaf9a('0x12')][_0x17c220[_0xaf9a('0x4d')]]&&this[_0xaf9a('0x12')][_0x17c220['name']][_0xaf9a('0x58')]?this['voiceQueues'][_0x17c220[_0xaf9a('0x4d')]][_0xaf9a('0x58')]||_0xaf9a('0x50'):_0xaf9a('0x50');_0x17c220[_0xaf9a('0x67')]=_0x287b8e['queue'];_0x17c220[_0xaf9a('0x75')]=moment()[_0xaf9a('0x49')](_0xaf9a('0x76'));_0x17c220[_0xaf9a('0x77')]=_0x287b8e['position'];_0x17c220[_0xaf9a('0x78')]=_0x287b8e['count'];_0x17c220['uniqueid']=_0x287b8e[_0xaf9a('0x48')];_0x17c220['routealias']=this[_0xaf9a('0x10')][_0x287b8e[_0xaf9a('0x48')]]['routealias'];logger[_0xaf9a('0x69')](_0xaf9a('0x79'),_0x17c220['name'],_0x17c220[_0xaf9a('0x58')]);_['merge'](_0x17c220,_['pick'](_0x287b8e,_[_0xaf9a('0x7a')](_0x17c220)));this[_0xaf9a('0xe')][_0x287b8e[_0xaf9a('0x48')]][_0xaf9a('0x7b')](_0x17c220);this[_0xaf9a('0x10')][_0x287b8e[_0xaf9a('0x48')]]=_0x17c220;this['emitVoiceQueueChannelSave'](_0x17c220,_0xaf9a('0x1a'));}}catch(_0x92895d){logger[_0xaf9a('0x3b')](_0xaf9a('0x73'),_0x287b8e['uniqueid'],util[_0xaf9a('0x3d')](_0x92895d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xaf9a('0x7c')]=function(_0x577d45){try{if(this['isNotNull'](_0x577d45)){logger[_0xaf9a('0x45')](_0xaf9a('0x7d'),_0x577d45[_0xaf9a('0x48')],util['inspect'](_0x577d45,{'showHidden':![],'depth':null}));if(this[_0xaf9a('0xe')][_0x577d45['uniqueid']]){var _0x4eecfe=_['last'](this['queueReports'][_0x577d45[_0xaf9a('0x48')]]);_0x4eecfe[_0xaf9a('0x7e')]=![];_0x4eecfe[_0xaf9a('0x7f')]=null;_0x4eecfe['holdtime']=_0x577d45[_0xaf9a('0x80')];_0x4eecfe[_0xaf9a('0x81')]=_0x577d45[_0xaf9a('0x81')];_0x4eecfe['queuecallerabandon']=!![];_0x4eecfe[_0xaf9a('0x82')]=moment()[_0xaf9a('0x49')](_0xaf9a('0x76'));_0x4eecfe[_0xaf9a('0x4c')]='ABANDONED';_0x4eecfe['lastAssignedTo']=null;logger[_0xaf9a('0x69')](_0xaf9a('0x83'),_0x4eecfe[_0xaf9a('0x4d')],_0x4eecfe['type']);this[_0xaf9a('0x10')][_0x577d45[_0xaf9a('0x48')]]=_0x4eecfe;this['emitVoiceQueueChannelRemove'](_0x4eecfe,_0xaf9a('0x1c'));}}}catch(_0x520e85){logger[_0xaf9a('0x3b')](_0xaf9a('0x7d'),_0x577d45[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x520e85,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf9a('0xa')]['syncQueueCallerLeave']=function(_0x185122){try{if(this[_0xaf9a('0x63')](_0x185122)){logger['debug'](_0xaf9a('0x84'),_0x185122[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x185122,{'showHidden':![],'depth':null}));if(this[_0xaf9a('0xe')][_0x185122[_0xaf9a('0x48')]]){var _0x40fbca=_['last'](this[_0xaf9a('0xe')][_0x185122[_0xaf9a('0x48')]]);_0x40fbca['queuecallerleaveAt']=moment()[_0xaf9a('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x40fbca[_0xaf9a('0x85')]=_0x185122[_0xaf9a('0x85')];_0x40fbca[_0xaf9a('0x86')]=_0x185122[_0xaf9a('0x86')];logger['info'](_0xaf9a('0x87'),_0x40fbca[_0xaf9a('0x4d')],_0x40fbca[_0xaf9a('0x58')],_0x185122['connectedlinenum'],_0x185122[_0xaf9a('0x86')]);this[_0xaf9a('0x10')][_0x185122[_0xaf9a('0x48')]]=_0x40fbca;this[_0xaf9a('0x44')](_0x40fbca,_0xaf9a('0x88'));}}}catch(_0x48e223){logger['error'](_0xaf9a('0x84'),_0x185122[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x48e223,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf9a('0xa')][_0xaf9a('0x1f')]=function(_0xa898bb){try{if(this[_0xaf9a('0x63')](_0xa898bb)){logger[_0xaf9a('0x45')]('[%s][voiceQueueReport][agentconnect]',_0xa898bb['uniqueid'],util[_0xaf9a('0x3d')](_0xa898bb,{'showHidden':![],'depth':null}));if(this[_0xaf9a('0xe')][_0xa898bb[_0xaf9a('0x48')]]){var _0x35ff45=_['last'](this[_0xaf9a('0xe')][_0xa898bb[_0xaf9a('0x48')]]);_0x35ff45[_0xaf9a('0x7e')]=!![];_0x35ff45[_0xaf9a('0x4c')]=_0xaf9a('0x89');logger['info'](_0xaf9a('0x8a'),_0x35ff45[_0xaf9a('0x4d')],_0x35ff45[_0xaf9a('0x58')]);}}}catch(_0xb7748e){logger[_0xaf9a('0x3b')]('[%s][voiceQueueReport][agentconnect]',_0xa898bb[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0xb7748e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf9a('0xa')]['syncAgentComplete']=function(_0x1f6314){try{if(this[_0xaf9a('0x63')](_0x1f6314)){logger[_0xaf9a('0x45')]('[%s][voiceQueueReport][agentcomplete]',_0x1f6314[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x1f6314,{'showHidden':![],'depth':null}));if(this[_0xaf9a('0xe')][_0x1f6314[_0xaf9a('0x48')]]){var _0x4af3a4=_['last'](this['queueReports'][_0x1f6314[_0xaf9a('0x48')]]);_0x4af3a4[_0xaf9a('0x1c')]=![];_0x4af3a4[_0xaf9a('0x82')]=null;_0x4af3a4[_0xaf9a('0x8b')]=!![];_0x4af3a4[_0xaf9a('0x8c')]=_0x1f6314[_0xaf9a('0x8d')];_0x4af3a4[_0xaf9a('0x80')]=_0x1f6314['holdtime'];_0x4af3a4[_0xaf9a('0x7e')]=!![];_0x4af3a4[_0xaf9a('0x8e')]=![];_0x4af3a4[_0xaf9a('0x8f')]=null;if(!_0x4af3a4[_0xaf9a('0x90')]){if(_0x1f6314[_0xaf9a('0x91')]=='transfer'){_0x4af3a4[_0xaf9a('0x4c')]=_0xaf9a('0x92');logger[_0xaf9a('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4af3a4[_0xaf9a('0x4d')],_0x4af3a4[_0xaf9a('0x58')]);}else{if(_[_0xaf9a('0x93')](_0x1f6314['channel']['toLowerCase'](),'local/')){if(this[_0xaf9a('0xe')][_0x1f6314['linkedid']]){var _0x5c15db=_[_0xaf9a('0x94')](this[_0xaf9a('0xe')][_0x1f6314[_0xaf9a('0x95')]]);_0x5c15db[_0xaf9a('0x7e')]=![];_0x5c15db[_0xaf9a('0x8e')]=!![];_0x5c15db[_0xaf9a('0x8f')]=moment(_0x4af3a4['queuecallerjoinAt'])[_0xaf9a('0x96')](_0x1f6314[_0xaf9a('0x80')],_0xaf9a('0x97'))[_0xaf9a('0x49')](_0xaf9a('0x76'));_0x5c15db[_0xaf9a('0x4c')]='FORWARDTRANSFER';_0x5c15db[_0xaf9a('0x90')]=!![];_0x5c15db[_0xaf9a('0x98')]=_0xaf9a('0x99');_0x5c15db[_0xaf9a('0x9a')]=_0x1f6314[_0xaf9a('0x9b')];_0x5c15db[_0xaf9a('0x9c')]=_0x1f6314[_0xaf9a('0x48')];logger[_0xaf9a('0x69')](_0xaf9a('0x9d'),_0x5c15db[_0xaf9a('0x4d')],_0x5c15db['type']);var _0x5eaa95=this['queueReports'][_0x1f6314[_0xaf9a('0x95')]];this[_0xaf9a('0xe')][_0x1f6314['linkedid']]=this['queueReports'][_0x1f6314[_0xaf9a('0x48')]];this[_0xaf9a('0xe')][_0x1f6314['uniqueid']]=_0x5eaa95;}}else{_0x4af3a4[_0xaf9a('0x4c')]=_0xaf9a('0x9e')+_0x1f6314[_0xaf9a('0x91')][_0xaf9a('0x9f')]();logger[_0xaf9a('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x4af3a4[_0xaf9a('0x4d')],_0x4af3a4[_0xaf9a('0x58')],_0x4af3a4[_0xaf9a('0x4c')]);}}}this[_0xaf9a('0x10')][_0x1f6314[_0xaf9a('0x48')]]=_0x4af3a4;this['emitVoiceQueueChannelRemove'](_0x4af3a4,_0xaf9a('0xa0'));}}}catch(_0x517f51){logger[_0xaf9a('0x3b')](_0xaf9a('0xa1'),_0x1f6314[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x517f51,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf9a('0xa')][_0xaf9a('0x21')]=function(_0x2522b6){try{if(this[_0xaf9a('0x63')](_0x2522b6)){logger['debug']('[%s][voiceQueueReport][varset]',_0x2522b6[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x2522b6,{'showHidden':![],'depth':null}));this[_0xaf9a('0xa2')](_0x2522b6[_0xaf9a('0x48')],_[_0xaf9a('0x7a')](_0x2522b6[_0xaf9a('0xa3')])[0x0],_0x2522b6[_0xaf9a('0xa4')]);if(this[_0xaf9a('0xe')][_0x2522b6[_0xaf9a('0x48')]]){var _0x2006a0=_['last'](this[_0xaf9a('0xe')][_0x2522b6['uniqueid']]);if(_0x2006a0){if(this[_0xaf9a('0x63')](_0x2522b6['variable'])&&this[_0xaf9a('0x63')](_0x2522b6[_0xaf9a('0xa3')]['queuestatus'])){switch(_0x2522b6[_0xaf9a('0xa4')]){case _0xaf9a('0xa5'):_0x2006a0[_0xaf9a('0x8e')]=![];_0x2006a0[_0xaf9a('0x8f')]=null;break;case _0xaf9a('0xa6'):_0x2006a0['lastevent']='timeout';_0x2006a0[_0xaf9a('0x8e')]=!![];_0x2006a0['queuecallerexitAt']=moment()[_0xaf9a('0x49')](_0xaf9a('0x76'));_0x2006a0[_0xaf9a('0xa7')]=moment()[_0xaf9a('0x49')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xaf9a('0x45')](_0xaf9a('0xa8'),_0x2522b6['uniqueid'],util[_0xaf9a('0x3d')](_0x2006a0,{'showHidden':![],'depth':null}));ami[_0xaf9a('0x43')]('custom:timeout',_0x2006a0);break;default:_0x2006a0[_0xaf9a('0x8e')]=!![];_0x2006a0['queuecallerexitAt']=moment()['format'](_0xaf9a('0x76'));_0x2006a0[_0xaf9a('0xa7')]=moment()[_0xaf9a('0x49')](_0xaf9a('0x76'));}_0x2006a0[_0xaf9a('0x1c')]=![];_0x2006a0[_0xaf9a('0x82')]=null;_0x2006a0[_0xaf9a('0x4c')]=_0x2522b6[_0xaf9a('0xa4')];this[_0xaf9a('0x10')][_0x2522b6[_0xaf9a('0x48')]]=_0x2006a0;this[_0xaf9a('0x41')](_0x2006a0,_0xaf9a('0x20'));}else if(this[_0xaf9a('0x63')](_0x2522b6['variable'])&&this[_0xaf9a('0x63')](_0x2522b6['variable'][_0xaf9a('0xa9')])){if(!_0x2006a0['queuecallerabandon']){_0x2006a0[_0xaf9a('0x8e')]=!![];_0x2006a0[_0xaf9a('0x8f')]=moment()[_0xaf9a('0x49')](_0xaf9a('0x76'));_0x2006a0[_0xaf9a('0x4c')]=_0xaf9a('0xaa');_0x2006a0[_0xaf9a('0xa7')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xaf9a('0x10')][_0x2522b6[_0xaf9a('0x48')]]=_0x2006a0;}}logger[_0xaf9a('0x69')](_0xaf9a('0xab'),_0x2522b6['uniqueid'],_0x2006a0['name'],_0x2006a0['type'],_[_0xaf9a('0x7a')](_0x2522b6[_0xaf9a('0xa3')])[0x0],_0x2522b6[_0xaf9a('0xa4')]);_0x2006a0[_0xaf9a('0x15')]=this[_0xaf9a('0x15')][_0x2522b6[_0xaf9a('0x48')]];}}}}catch(_0x152f1f){logger[_0xaf9a('0x3b')](_0xaf9a('0xac'),_0x2522b6[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x152f1f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf9a('0xa')][_0xaf9a('0xa2')]=function(_0xa8fa0e,_0x3a6c62,_0x28283e){var _0x14fd68=[_0xaf9a('0xad'),_0xaf9a('0xae'),_0xaf9a('0xaf'),_0xaf9a('0xb0'),_0xaf9a('0xb1'),'rtpaudioqoslossbridged',_0xaf9a('0xb2'),_0xaf9a('0xb3'),_0xaf9a('0xb4'),_0xaf9a('0xb5'),_0xaf9a('0xb6'),'bridgepvtcallid',_0xaf9a('0xb7'),'memberdynamic','memberinterface',_0xaf9a('0xb8'),_0xaf9a('0x8d'),_0xaf9a('0xb9'),_0xaf9a('0xba')];if(!_[_0xaf9a('0x35')](_0x3a6c62)&&!_[_0xaf9a('0xbb')](_0x14fd68,_0x3a6c62)){if(_[_0xaf9a('0x74')](this[_0xaf9a('0x15')][_0xa8fa0e])){this['variables'][_0xa8fa0e]={};}this[_0xaf9a('0x15')][_0xa8fa0e][_0x3a6c62]=_0x28283e;}};VoiceQueueReport['prototype'][_0xaf9a('0x23')]=function(_0x2145d0){try{if(this[_0xaf9a('0x63')](_0x2145d0)){logger[_0xaf9a('0x45')]('[%s][voiceQueueReport][hangup]',_0x2145d0['uniqueid'],util[_0xaf9a('0x3d')](_0x2145d0,{'showHidden':![],'depth':null}));if(this[_0xaf9a('0xe')][_0x2145d0[_0xaf9a('0x48')]]){for(var _0x41245e=0x0,_0x547c16={};_0x41245e=0x0?moment(_0x6bdbc4[_0x2e9a('0x16')])[_0x2e9a('0xe')](_0x6bdbc4[_0x2e9a('0x17')],_0x2e9a('0xf')):null,'data1':_0x2e9a('0x18'),'data2':_0x6bdbc4[_0x2e9a('0x11')],'data3':_0x6bdbc4['exten'],'data4':_0x6bdbc4[_0x2e9a('0x19')]||null,'role':'agent','internal':_0x6bdbc4[_0x2e9a('0x11')]?_[_0x2e9a('0x1a')](_0x6bdbc4[_0x2e9a('0x11')]):undefined,'uniqueid':_0x6bdbc4['uniqueid']},'log':_0x2e9a('0x13')});}; \ No newline at end of file +var _0x0c2d=['Request','CreateMemberReport','voice','lastAssignedTo','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','agent','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','seconds','exten','dialstring','lodash','util','../client','queuecallerexitAt'];(function(_0x36b3f4,_0x2c6ae2){var _0x139d9e=function(_0x43e077){while(--_0x43e077){_0x36b3f4['push'](_0x36b3f4['shift']());}};_0x139d9e(++_0x2c6ae2);}(_0x0c2d,0x1c8));var _0xd0c2=function(_0x4092a0,_0x29716d){_0x4092a0=_0x4092a0-0x0;var _0x4aaba4=_0x0c2d[_0x4092a0];return _0x4aaba4;};'use strict';var moment=require('moment');var _=require(_0xd0c2('0x0'));var util=require(_0xd0c2('0x1'));var client=require(_0xd0c2('0x2'));exports['voiceQueueReport']=function(_0x418927){var _0x45ba3a=_0x418927['queuecallercompleteAt']||_0x418927[_0xd0c2('0x3')];return client[_0xd0c2('0x4')](_0xd0c2('0x5'),{'body':{'channel':_0xd0c2('0x6'),'membername':_0x418927[_0xd0c2('0x7')],'interface':_['isNil'](_0x418927[_0xd0c2('0x8')])?util['format'](_0xd0c2('0x9'),_0x418927[_0xd0c2('0x7')]):_0x418927[_0xd0c2('0x8')],'type':_0xd0c2('0xa'),'enterAt':_0x418927[_0xd0c2('0xb')],'exitAt':_0x45ba3a,'duration':moment(_0x45ba3a)[_0xd0c2('0xc')](_0x418927[_0xd0c2('0xb')],'seconds'),'data1':'inbound','data2':_0x418927['calleridnum'],'data3':_0x418927['exten'],'data4':null,'data5':_0x418927['queue'],'role':_0xd0c2('0xd'),'internal':_0x418927[_0xd0c2('0xe')]?_['toNumber'](_0x418927['accountcode']):undefined,'uniqueid':_0x418927[_0xd0c2('0xf')]},'log':'CreateMemberReport'});};exports[_0xd0c2('0x10')]=function(_0x35cbb5){return client[_0xd0c2('0x4')](_0xd0c2('0x5'),{'body':{'channel':_0xd0c2('0x6'),'membername':_0x35cbb5[_0xd0c2('0x11')],'interface':_0x35cbb5[_0xd0c2('0x8')],'type':'TALKING','enterAt':_0x35cbb5[_0xd0c2('0x12')],'exitAt':_0x35cbb5[_0xd0c2('0x13')],'duration':moment(_0x35cbb5[_0xd0c2('0x13')])[_0xd0c2('0xc')](_0x35cbb5[_0xd0c2('0x12')],'seconds')>=0x0?moment(_0x35cbb5[_0xd0c2('0x13')])[_0xd0c2('0xc')](_0x35cbb5[_0xd0c2('0x12')],_0xd0c2('0x14')):null,'data1':'outbound','data2':_0x35cbb5['accountcode'],'data3':_0x35cbb5[_0xd0c2('0x15')],'data4':_0x35cbb5[_0xd0c2('0x16')]||null,'role':_0xd0c2('0xd'),'internal':_0x35cbb5[_0xd0c2('0xe')]?_['toNumber'](_0x35cbb5[_0xd0c2('0xe')]):undefined,'uniqueid':_0x35cbb5[_0xd0c2('0xf')]},'log':_0xd0c2('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 05874d5..34b4385 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbe2=['../client','getSettings','Request','ShowSetting','previewRecallmeReminderInterval','GetSettings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbe2,0x1da));var _0x2fbe=function(_0xdca687,_0x4bca5f){_0xdca687=_0xdca687-0x0;var _0x29c676=_0xfbe2[_0xdca687];return _0x29c676;};'use strict';var client=require(_0x2fbe('0x0'));exports[_0x2fbe('0x1')]=function(){return client[_0x2fbe('0x2')](_0x2fbe('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x2fbe('0x4')]},'log':_0x2fbe('0x5')});}; \ No newline at end of file +var _0x0efe=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x0efe,0x110));var _0xe0ef=function(_0x30bd6c,_0x5b990a){_0x30bd6c=_0x30bd6c-0x0;var _0x448544=_0x0efe[_0x30bd6c];return _0x448544;};'use strict';var client=require(_0xe0ef('0x0'));exports[_0xe0ef('0x1')]=function(){return client['Request'](_0xe0ef('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe0ef('0x3'),_0xe0ef('0x4')]},'log':_0xe0ef('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 4074c64..441d2f0 100644 --- a/server/services/ami/rpc/template.js +++ b/server/services/ami/rpc/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6200=['name','html','../client','getTemplates','GetTemplate'];(function(_0x397e82,_0x7e3120){var _0x4e5447=function(_0x584b46){while(--_0x584b46){_0x397e82['push'](_0x397e82['shift']());}};_0x4e5447(++_0x7e3120);}(_0x6200,0x192));var _0x0620=function(_0x2151e1,_0xa0fab0){_0x2151e1=_0x2151e1-0x0;var _0xa6e109=_0x6200[_0x2151e1];return _0xa6e109;};'use strict';var client=require(_0x0620('0x0'));exports[_0x0620('0x1')]=function(_0x56958d){return function(_0x1c33ac){return client['Request'](_0x0620('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0620('0x3'),_0x0620('0x4')]},'log':_0x0620('0x2')});};}; \ No newline at end of file +var _0x8969=['html','GetTemplate','../client','getTemplates','Request','name'];(function(_0x57af8a,_0x392a38){var _0x315899=function(_0x2a29ea){while(--_0x2a29ea){_0x57af8a['push'](_0x57af8a['shift']());}};_0x315899(++_0x392a38);}(_0x8969,0xc2));var _0x9896=function(_0x2ddbfc,_0x206fad){_0x2ddbfc=_0x2ddbfc-0x0;var _0x1d2b2d=_0x8969[_0x2ddbfc];return _0x1d2b2d;};'use strict';var client=require(_0x9896('0x0'));exports[_0x9896('0x1')]=function(_0x217790){return function(_0x405a17){return client[_0x9896('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x9896('0x3'),_0x9896('0x4')]},'log':_0x9896('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 42a7061..ef535af 100644 --- a/server/services/ami/rpc/trigger.js +++ b/server/services/ami/rpc/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2b9=['action','data1','data2','data3','data4','data5','data6','data7','../client','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','value','operator','Actions'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xe2b9,0x94));var _0x9e2b=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xe2b9[_0xbe200f];return _0x192597;};'use strict';var client=require(_0x9e2b('0x0'));exports['getTriggers']=function(_0x20cd54){return function(_0x571ad3){return client[_0x9e2b('0x1')](_0x9e2b('0x2'),{'options':{'raw':![],'attributes':['id',_0x9e2b('0x3'),_0x9e2b('0x4'),_0x9e2b('0x5')],'include':[{'model':_0x9e2b('0x6'),'as':_0x9e2b('0x7'),'attributes':['id',_0x9e2b('0x8'),'operator',_0x9e2b('0x9')]},{'model':_0x9e2b('0x6'),'as':'AnyConditions','attributes':['id','field',_0x9e2b('0xa'),'value']},{'model':'Action','as':_0x9e2b('0xb'),'attributes':['id',_0x9e2b('0xc'),_0x9e2b('0xd'),_0x9e2b('0xe'),_0x9e2b('0xf'),_0x9e2b('0x10'),_0x9e2b('0x11'),_0x9e2b('0x12'),_0x9e2b('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xf957=['AnyConditions','Actions','action','data2','data3','data4','data6','data7','../client','GetTrigger','name','channel','Condition','AllConditions','field','value'];(function(_0x10a39a,_0x2c6f68){var _0x1fa08b=function(_0x2bf76d){while(--_0x2bf76d){_0x10a39a['push'](_0x10a39a['shift']());}};_0x1fa08b(++_0x2c6f68);}(_0xf957,0x198));var _0x7f95=function(_0xc54428,_0x71395c){_0xc54428=_0xc54428-0x0;var _0x32caf0=_0xf957[_0xc54428];return _0x32caf0;};'use strict';var client=require(_0x7f95('0x0'));exports['getTriggers']=function(_0x1664de){return function(_0x2f3397){return client['Request'](_0x7f95('0x1'),{'options':{'raw':![],'attributes':['id',_0x7f95('0x2'),_0x7f95('0x3'),'status'],'include':[{'model':_0x7f95('0x4'),'as':_0x7f95('0x5'),'attributes':['id',_0x7f95('0x6'),'operator',_0x7f95('0x7')]},{'model':_0x7f95('0x4'),'as':_0x7f95('0x8'),'attributes':['id','field','operator',_0x7f95('0x7')]},{'model':'Action','as':_0x7f95('0x9'),'attributes':['id',_0x7f95('0xa'),'data1',_0x7f95('0xb'),_0x7f95('0xc'),_0x7f95('0xd'),'data5',_0x7f95('0xe'),_0x7f95('0xf')]}]},'log':_0x7f95('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f70fceb..90af82c 100644 --- a/server/services/ami/rpc/trunk.js +++ b/server/services/ami/rpc/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x440f=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x3671ef,_0x2ffc8d){var _0x1aba48=function(_0x55c949){while(--_0x55c949){_0x3671ef['push'](_0x3671ef['shift']());}};_0x1aba48(++_0x2ffc8d);}(_0x440f,0xfc));var _0xf440=function(_0x268c88,_0x18a43f){_0x268c88=_0x268c88-0x0;var _0x1b085c=_0x440f[_0x268c88];return _0x1b085c;};'use strict';var client=require(_0xf440('0x0'));exports[_0xf440('0x1')]=function(_0x205eb4){return function(_0x3d2b30){return client[_0xf440('0x2')](_0xf440('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf440('0x4'),_0xf440('0x5'),_0xf440('0x6')]},'log':_0xf440('0x3')});};}; \ No newline at end of file +var _0x6d44=['Request','GetTrunk','name','defaultuser','../client','getTrunks'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x6d44,0x70));var _0x46d4=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0x6d44[_0x4664db];return _0x5615b4;};'use strict';var client=require(_0x46d4('0x0'));exports[_0x46d4('0x1')]=function(_0x1cd59e){return function(_0x3528a4){return client[_0x46d4('0x2')](_0x46d4('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x46d4('0x4'),'registry',_0x46d4('0x5')]},'log':_0x46d4('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 8da472e..6ca1e86 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0xddcb76,_0x17e172){var _0x48fd39=function(_0x1c45ce){while(--_0x1c45ce){_0xddcb76['push'](_0xddcb76['shift']());}};_0x48fd39(++_0x17e172);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x128c3b,_0x5c5814){var _0x537c4a=function(_0x3d3fa9){while(--_0x3d3fa9){_0x128c3b['push'](_0x128c3b['shift']());}};_0x537c4a(++_0x5c5814);}(_0xedd9,0xfc));var _0x9edd=function(_0xdbd7ed,_0x16adb9){_0xdbd7ed=_0xdbd7ed-0x0;var _0x1ee990=_0xedd9[_0xdbd7ed];return _0x1ee990;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ee03576..b1223c5 100644 --- a/server/services/ami/rpc/voiceAgentReport.js +++ b/server/services/ami/rpc/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfadf=['update','../client','create','Request','CreateVoiceAgentReport'];(function(_0x66e905,_0x510d76){var _0x427cde=function(_0x30c3cd){while(--_0x30c3cd){_0x66e905['push'](_0x66e905['shift']());}};_0x427cde(++_0x510d76);}(_0xfadf,0x128));var _0xffad=function(_0x56e654,_0x5625c){_0x56e654=_0x56e654-0x0;var _0x237130=_0xfadf[_0x56e654];return _0x237130;};'use strict';var client=require(_0xffad('0x0'));exports[_0xffad('0x1')]=function(_0x478b7d){return client[_0xffad('0x2')](_0xffad('0x3'),{'body':_0x478b7d,'log':_0xffad('0x3')});};exports[_0xffad('0x4')]=function(_0x1d9ebd,_0x437249,_0x2b1877){return client[_0xffad('0x2')]('UpdateVoiceAgentReport',{'body':_0x1d9ebd,'options':{'where':{'uniqueid':_0x437249,'interface':_0x2b1877,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xefc5=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0xefc5,0x1e0));var _0x5efc=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0xefc5[_0x38fb8b];return _0x1ec681;};'use strict';var client=require(_0x5efc('0x0'));exports['create']=function(_0x536fc1){return client[_0x5efc('0x1')](_0x5efc('0x2'),{'body':_0x536fc1,'log':_0x5efc('0x2')});};exports[_0x5efc('0x3')]=function(_0x22d026,_0x390d92,_0x31532a){return client[_0x5efc('0x1')]('UpdateVoiceAgentReport',{'body':_0x22d026,'options':{'where':{'uniqueid':_0x390d92,'interface':_0x31532a,'agentcomplete':!![]}},'log':_0x5efc('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 59e12e5..73e4505 100644 --- a/server/services/ami/rpc/voiceCallReport.js +++ b/server/services/ami/rpc/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc132=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports'];(function(_0x28ee78,_0x4fcb33){var _0x1e2096=function(_0x46e16c){while(--_0x46e16c){_0x28ee78['push'](_0x28ee78['shift']());}};_0x1e2096(++_0x4fcb33);}(_0xc132,0x95));var _0x2c13=function(_0x4dea62,_0x1148a2){_0x4dea62=_0x4dea62-0x0;var _0x15e36f=_0xc132[_0x4dea62];return _0x15e36f;};'use strict';var moment=require(_0x2c13('0x0'));var util=require(_0x2c13('0x1'));var _=require(_0x2c13('0x2'));var client=require(_0x2c13('0x3'));exports[_0x2c13('0x4')]=function(_0x1b7be7){return client['Request'](_0x2c13('0x5'),{'body':_[_0x2c13('0x6')](_0x1b7be7,{'source':_0x1b7be7[_0x2c13('0x7')],'destinationcontext':_0x1b7be7[_0x2c13('0x8')],'callerid':_0x1b7be7[_0x2c13('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x2c13('0x5')});};exports[_0x2c13('0xa')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x2c13('0xb')](_0x2c13('0xc'))[_0x2c13('0xd')](_0x2c13('0xe')),moment()[_0x2c13('0xf')](_0x2c13('0xc'))[_0x2c13('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x2c13('0x10'),_0x2c13('0x11'),_0x2c13('0x12')]},'log':_0x2c13('0x13')});};}; \ No newline at end of file +var _0xa113=['GetVoiceCallReport','outbound','startOf','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','GetVoiceCallReports','moment','util','lodash','Request','merge','calleridnum','callerid','DOCUMENTATION','CreateVoiceCallReport'];(function(_0x15e578,_0x3b2d6f){var _0x4a33c7=function(_0x3ff3fb){while(--_0x3ff3fb){_0x15e578['push'](_0x15e578['shift']());}};_0x4a33c7(++_0x3b2d6f);}(_0xa113,0x195));var _0x3a11=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa113[_0x4baae2];return _0x1a2285;};'use strict';var moment=require(_0x3a11('0x0'));var util=require(_0x3a11('0x1'));var _=require(_0x3a11('0x2'));var client=require('../client');exports['create']=function(_0x1cc13d){return client[_0x3a11('0x3')]('CreateVoiceCallReport',{'body':_[_0x3a11('0x4')](_0x1cc13d,{'source':_0x1cc13d[_0x3a11('0x5')],'destinationcontext':_0x1cc13d['context'],'callerid':_0x1cc13d[_0x3a11('0x6')],'amaflags':_0x3a11('0x7')}),'log':_0x3a11('0x8')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x3a11('0x3')](_0x3a11('0x9'),{'options':{'where':{'type':[_0x3a11('0xa')],'createdAt':{'$between':[moment()[_0x3a11('0xb')]('day')[_0x3a11('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x3a11('0xd')]('day')['format'](_0x3a11('0xe'))]}},'attributes':[_0x3a11('0xf'),_0x3a11('0x10'),'duration','billableseconds']},'log':_0x3a11('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 7b659ea..2ad1cfe 100644 --- a/server/services/ami/rpc/voiceDialReport.js +++ b/server/services/ami/rpc/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x469e=['../client','create','Request','CreateVoiceDialReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x469e,0x1a4));var _0xe469=function(_0x3b5bca,_0x326805){_0x3b5bca=_0x3b5bca-0x0;var _0x39833=_0x469e[_0x3b5bca];return _0x39833;};'use strict';var client=require(_0xe469('0x0'));exports[_0xe469('0x1')]=function(_0x399c5d){return client[_0xe469('0x2')](_0xe469('0x3'),{'body':_0x399c5d,'log':_0xe469('0x3')});}; \ No newline at end of file +var _0x98e8=['CreateVoiceDialReport','create','Request'];(function(_0x1cd822,_0x4ce89f){var _0x1ff5a4=function(_0x4d0800){while(--_0x4d0800){_0x1cd822['push'](_0x1cd822['shift']());}};_0x1ff5a4(++_0x4ce89f);}(_0x98e8,0xf1));var _0x898e=function(_0x15a966,_0x12af14){_0x15a966=_0x15a966-0x0;var _0x27747f=_0x98e8[_0x15a966];return _0x27747f;};'use strict';var client=require('../client');exports[_0x898e('0x0')]=function(_0x5d318c){return client[_0x898e('0x1')](_0x898e('0x2'),{'body':_0x5d318c,'log':_0x898e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 3a11dbb..b621739 100644 --- a/server/services/ami/rpc/voiceExtension.js +++ b/server/services/ami/rpc/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf4c=['recordingFormat','getVoiceExtensions','Request','exten'];(function(_0x5ab849,_0x4e987d){var _0x388e26=function(_0x39f4d6){while(--_0x39f4d6){_0x5ab849['push'](_0x5ab849['shift']());}};_0x388e26(++_0x4e987d);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x59777d,_0x852eea){_0x59777d=_0x59777d-0x0;var _0x572d4b=_0xaf4c[_0x59777d];return _0x572d4b;};'use strict';var client=require('../client');exports[_0xcaf4('0x0')]=function(){return function(){return client[_0xcaf4('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xcaf4('0x2'),_0xcaf4('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xcaf4('0x0')});};}; \ No newline at end of file +var _0x87ae=['recordingFormat','getVoiceExtensions','Request'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0x87ae,0xf5));var _0xe87a=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x87ae[_0x1d9aa0];return _0x226868;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0xe87a('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0xe87a('0x1')],'where':{'VoiceExtensionId':null}},'log':_0xe87a('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 4d9b75b..988963c 100644 --- a/server/services/ami/rpc/voiceQueue.js +++ b/server/services/ami/rpc/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35ef=['dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage'];(function(_0x32cc9a,_0x342819){var _0x19b875=function(_0x192712){while(--_0x192712){_0x32cc9a['push'](_0x32cc9a['shift']());}};_0x19b875(++_0x342819);}(_0x35ef,0xb6));var _0xf35e=function(_0x590862,_0x309a37){_0x590862=_0x590862-0x0;var _0x179b7d=_0x35ef[_0x590862];return _0x179b7d;};'use strict';var client=require(_0xf35e('0x0'));exports[_0xf35e('0x1')]=function(){return function(){return client[_0xf35e('0x2')](_0xf35e('0x3'),{'options':{'raw':![],'attributes':['id',_0xf35e('0x4'),_0xf35e('0x5'),_0xf35e('0x6'),_0xf35e('0x7'),'monitor_format',_0xf35e('0x8'),_0xf35e('0x9'),_0xf35e('0xa'),_0xf35e('0xb'),_0xf35e('0xc'),_0xf35e('0xd'),_0xf35e('0xe'),_0xf35e('0xf'),_0xf35e('0x10'),_0xf35e('0x11'),_0xf35e('0x12'),_0xf35e('0x13'),'dialQueueOptions',_0xf35e('0x14'),_0xf35e('0x15'),_0xf35e('0x16'),_0xf35e('0x17'),_0xf35e('0x18'),_0xf35e('0x19'),_0xf35e('0x1a'),'dialNoAnswerRetryFrequency',_0xf35e('0x1b'),_0xf35e('0x1c'),'dialGlobalInterval',_0xf35e('0x1d'),_0xf35e('0x1e'),_0xf35e('0x1f'),_0xf35e('0x20'),_0xf35e('0x21'),'dialAMDAfterGreetingSilence',_0xf35e('0x22'),_0xf35e('0x23'),_0xf35e('0x24'),_0xf35e('0x25'),_0xf35e('0x26'),'dialAMDMaximumWordLength',_0xf35e('0x27'),'dialRecallMeTimeout',_0xf35e('0x28'),_0xf35e('0x29'),_0xf35e('0x2a'),_0xf35e('0x2b'),'dialQueueProject2',_0xf35e('0x2c'),'strategy',_0xf35e('0x2d'),_0xf35e('0x2e'),_0xf35e('0x2f'),_0xf35e('0x30'),_0xf35e('0x31'),'dialDropRetryFrequency',_0xf35e('0x32'),_0xf35e('0x33'),'dialMachineMaxRetry',_0xf35e('0x34'),_0xf35e('0x35'),_0xf35e('0x36'),_0xf35e('0x37'),_0xf35e('0x38'),'dialPredictiveIntervalMinThreshold',_0xf35e('0x39'),_0xf35e('0x3a')],'include':[{'model':_0xf35e('0x3b'),'as':'Trunk','attributes':['id',_0xf35e('0x4'),_0xf35e('0x3c'),_0xf35e('0x3d')]},{'model':'Pause','as':_0xf35e('0x3e'),'attributes':['id',_0xf35e('0x4')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id','name',_0xf35e('0x3c'),_0xf35e('0x3d')]},{'model':_0xf35e('0x3f'),'as':'Interval','attributes':['id',_0xf35e('0x4')],'include':[{'model':_0xf35e('0x3f'),'as':_0xf35e('0x40'),'attributes':['id',_0xf35e('0x4'),_0xf35e('0x41')]}]}]},'log':_0xf35e('0x1')});};}; \ No newline at end of file +var _0x1f1f=['active','mandatoryDispositionPause','TrunkBackup','name','Interval','Intervals','interval','../client','getVoiceQueues','Request','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid'];(function(_0x39fa11,_0xf47bc6){var _0x2d70fb=function(_0x281063){while(--_0x281063){_0x39fa11['push'](_0x39fa11['shift']());}};_0x2d70fb(++_0xf47bc6);}(_0x1f1f,0x169));var _0xf1f1=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x1f1f[_0x135904];return _0x1ce7d5;};'use strict';var client=require(_0xf1f1('0x0'));exports[_0xf1f1('0x1')]=function(){return function(){return client[_0xf1f1('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xf1f1('0x3'),_0xf1f1('0x4'),_0xf1f1('0x5'),_0xf1f1('0x6'),_0xf1f1('0x7'),_0xf1f1('0x8'),'dialMethod',_0xf1f1('0x9'),_0xf1f1('0xa'),_0xf1f1('0xb'),_0xf1f1('0xc'),'dialPredictiveOptimizationPercentage',_0xf1f1('0xd'),_0xf1f1('0xe'),_0xf1f1('0xf'),'dialOriginateTimeout',_0xf1f1('0x10'),_0xf1f1('0x11'),'dialQueueProject',_0xf1f1('0x12'),_0xf1f1('0x13'),'dialBusyMaxRetry',_0xf1f1('0x14'),_0xf1f1('0x15'),'dialNoAnswerRetryFrequency',_0xf1f1('0x16'),_0xf1f1('0x17'),'dialGlobalInterval',_0xf1f1('0x18'),_0xf1f1('0x19'),'dialAMDActive','dialAMDInitialSilence','dialAMDGreeting',_0xf1f1('0x1a'),_0xf1f1('0x1b'),_0xf1f1('0x1c'),_0xf1f1('0x1d'),_0xf1f1('0x1e'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout',_0xf1f1('0x1f'),_0xf1f1('0x20'),_0xf1f1('0x21'),_0xf1f1('0x22'),_0xf1f1('0x23'),_0xf1f1('0x24'),_0xf1f1('0x6'),_0xf1f1('0x25'),_0xf1f1('0x26'),_0xf1f1('0x27'),'dialNoSuchNumberMaxRetry',_0xf1f1('0x28'),_0xf1f1('0x29'),_0xf1f1('0x2a'),'dialAbandonedMaxRetry',_0xf1f1('0x2b'),'dialMachineMaxRetry',_0xf1f1('0x2c'),_0xf1f1('0x2d'),'dialAgentRejectRetryFrequency',_0xf1f1('0x2e'),_0xf1f1('0x2f'),_0xf1f1('0x30'),_0xf1f1('0x31'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xf1f1('0x32'),'attributes':['id','name',_0xf1f1('0x33'),_0xf1f1('0x34')]},{'model':'Pause','as':_0xf1f1('0x35'),'attributes':['id','name']},{'model':_0xf1f1('0x32'),'as':_0xf1f1('0x36'),'attributes':['id',_0xf1f1('0x37'),_0xf1f1('0x33'),'active']},{'model':'Interval','as':'Interval','attributes':['id',_0xf1f1('0x37')],'include':[{'model':_0xf1f1('0x38'),'as':_0xf1f1('0x39'),'attributes':['id',_0xf1f1('0x37'),_0xf1f1('0x3a')]}]}]},'log':_0xf1f1('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 188eb5a..3ade82b 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x35b350,_0x20d86f){var _0x40a97f=function(_0x330ed2){while(--_0x330ed2){_0x35b350['push'](_0x35b350['shift']());}};_0x40a97f(++_0x20d86f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x4bae53,_0x115177){var _0xd6fb6c=function(_0x223ecc){while(--_0x223ecc){_0x4bae53['push'](_0x4bae53['shift']());}};_0xd6fb6c(++_0x115177);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 0e5c958..aab38d9 100644 --- a/server/services/ami/rpc/voiceQueueRt.js +++ b/server/services/ami/rpc/voiceQueueRt.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x019d=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x019d,0x17b));var _0xd019=function(_0x471036,_0x3d60c8){_0x471036=_0x471036-0x0;var _0x2fcd5e=_0x019d[_0x471036];return _0x2fcd5e;};'use strict';var client=require(_0xd019('0x0'));exports[_0xd019('0x1')]=function(_0xd24dc4){return function(){return client[_0xd019('0x2')](_0xd019('0x3'),{'options':{'where':{'VoiceQueueId':_0xd24dc4,'paused':!![]},'raw':!![]},'log':_0xd019('0x1')});};}; \ No newline at end of file +var _0x85b9=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x114ea9,_0x305a74){var _0x3d65ff=function(_0x46478a){while(--_0x46478a){_0x114ea9['push'](_0x114ea9['shift']());}};_0x3d65ff(++_0x305a74);}(_0x85b9,0x17f));var _0x985b=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x85b9[_0x45b034];return _0x509cb0;};'use strict';var client=require(_0x985b('0x0'));exports[_0x985b('0x1')]=function(_0x2ec2e7){return function(){return client[_0x985b('0x2')](_0x985b('0x3'),{'options':{'where':{'VoiceQueueId':_0x2ec2e7,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4ef24b8..2db294e 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x252d34,_0x8ca81a){var _0x1e7e12=function(_0x303cba){while(--_0x303cba){_0x252d34['push'](_0x252d34['shift']());}};_0x1e7e12(++_0x8ca81a);}(_0x7a54,0x106));var _0x47a5=function(_0x258e24,_0x349e7f){_0x258e24=_0x258e24-0x0;var _0x2d3d2a=_0x7a54[_0x258e24];return _0x2d3d2a;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x35d0b8,_0x471c19){var _0x2fc4c9=function(_0x5e9cb1){while(--_0x5e9cb1){_0x35d0b8['push'](_0x35d0b8['shift']());}};_0x2fc4c9(++_0x471c19);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index ca129d2..07a0e3b 100644 --- a/server/services/ami/rpc/voiceTransferReport.js +++ b/server/services/ami/rpc/voiceTransferReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3dc=['transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeaccountcode'];(function(_0x197171,_0x5acc59){var _0x1e23cc=function(_0x3ae9ab){while(--_0x3ae9ab){_0x197171['push'](_0x197171['shift']());}};_0x1e23cc(++_0x5acc59);}(_0xa3dc,0xbd));var _0xca3d=function(_0x3942ba,_0x453099){_0x3942ba=_0x3942ba-0x0;var _0x4b3c81=_0xa3dc[_0x3942ba];return _0x4b3c81;};'use strict';var client=require('../client');exports['transfers']={};exports[_0xca3d('0x0')]=function(_0x59cb7c){return client[_0xca3d('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x59cb7c[_0xca3d('0x2')],'transfererchannel':_0x59cb7c['transfererchannel'],'transferercalleridnum':_0x59cb7c[_0xca3d('0x3')],'transferercalleridname':_0x59cb7c[_0xca3d('0x4')],'transfererconnectedlinenum':_0x59cb7c['transfererconnectedlinenum'],'transfererconnectedlinename':_0x59cb7c['transfererconnectedlinename'],'transfereraccountcode':_0x59cb7c[_0xca3d('0x5')],'transferercontext':_0x59cb7c[_0xca3d('0x6')],'transfererexten':_0x59cb7c['transfererexten'],'transfererlinkedid':_0x59cb7c[_0xca3d('0x7')],'transfereechannel':_0x59cb7c[_0xca3d('0x8')],'transfereecalleridnum':_0x59cb7c['transfereecalleridnum'],'transfereecalleridname':_0x59cb7c['transfereecalleridname'],'transfereeconnectedlinenum':_0x59cb7c[_0xca3d('0x9')],'transfereeconnectedlinename':_0x59cb7c['transfereeconnectedlinename'],'transfereeaccountcode':_0x59cb7c[_0xca3d('0xa')],'transfereecontext':_0x59cb7c[_0xca3d('0xb')],'transfereeexten':_0x59cb7c[_0xca3d('0xc')],'transfereelinkedid':_0x59cb7c[_0xca3d('0xd')],'isexternal':_0x59cb7c['isexternal'],'context':_0x59cb7c[_0xca3d('0xe')],'extension':_0x59cb7c[_0xca3d('0xf')],'type':_0xca3d('0x10')},'log':_0xca3d('0x11')});};exports[_0xca3d('0x12')]=function(_0x3eeaab){return client[_0xca3d('0x1')](_0xca3d('0x11'),{'body':{'result':_0x3eeaab[_0xca3d('0x2')],'transfererchannel':_0x3eeaab[_0xca3d('0x13')],'transferercalleridnum':_0x3eeaab[_0xca3d('0x14')],'transferercalleridname':_0x3eeaab['origtransferercalleridname'],'transfererconnectedlinenum':_0x3eeaab[_0xca3d('0x15')],'transfererconnectedlinename':_0x3eeaab[_0xca3d('0x16')],'transfereraccountcode':_0x3eeaab[_0xca3d('0x17')],'transferercontext':_0x3eeaab[_0xca3d('0x18')],'transfererexten':_0x3eeaab[_0xca3d('0x19')],'transfererlinkedid':_0x3eeaab[_0xca3d('0x1a')],'transfereechannel':_0x3eeaab[_0xca3d('0x1b')],'transfereecalleridnum':_0x3eeaab[_0xca3d('0x1c')],'transfereecalleridname':_0x3eeaab[_0xca3d('0x1d')],'transfereeconnectedlinenum':_0x3eeaab[_0xca3d('0x1e')],'transfereeconnectedlinename':_0x3eeaab[_0xca3d('0x1f')],'transfereeaccountcode':_0x3eeaab[_0xca3d('0x20')],'transfereecontext':_0x3eeaab[_0xca3d('0x21')],'transfereeexten':_0x3eeaab[_0xca3d('0x22')],'transfereelinkedid':_0x3eeaab[_0xca3d('0x23')],'isexternal':_0x3eeaab[_0xca3d('0x24')],'context':_0x3eeaab[_0xca3d('0x25')],'extension':_0x3eeaab[_0xca3d('0x26')],'type':_0xca3d('0x27')},'log':_0xca3d('0x11')});}; \ No newline at end of file +var _0x2529=['CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','extension','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request'];(function(_0x29bd18,_0x5103e8){var _0x4b9e7e=function(_0x588741){while(--_0x588741){_0x29bd18['push'](_0x29bd18['shift']());}};_0x4b9e7e(++_0x5103e8);}(_0x2529,0x17d));var _0x9252=function(_0x13f050,_0x4c7195){_0x13f050=_0x13f050-0x0;var _0x24301a=_0x2529[_0x13f050];return _0x24301a;};'use strict';var client=require(_0x9252('0x0'));exports[_0x9252('0x1')]={};exports[_0x9252('0x2')]=function(_0x4d98fa){return client[_0x9252('0x3')](_0x9252('0x4'),{'body':{'result':_0x4d98fa[_0x9252('0x5')],'transfererchannel':_0x4d98fa[_0x9252('0x6')],'transferercalleridnum':_0x4d98fa[_0x9252('0x7')],'transferercalleridname':_0x4d98fa[_0x9252('0x8')],'transfererconnectedlinenum':_0x4d98fa[_0x9252('0x9')],'transfererconnectedlinename':_0x4d98fa['transfererconnectedlinename'],'transfereraccountcode':_0x4d98fa['transfereraccountcode'],'transferercontext':_0x4d98fa[_0x9252('0xa')],'transfererexten':_0x4d98fa[_0x9252('0xb')],'transfererlinkedid':_0x4d98fa[_0x9252('0xc')],'transfereechannel':_0x4d98fa[_0x9252('0xd')],'transfereecalleridnum':_0x4d98fa['transfereecalleridnum'],'transfereecalleridname':_0x4d98fa[_0x9252('0xe')],'transfereeconnectedlinenum':_0x4d98fa[_0x9252('0xf')],'transfereeconnectedlinename':_0x4d98fa['transfereeconnectedlinename'],'transfereeaccountcode':_0x4d98fa[_0x9252('0x10')],'transfereecontext':_0x4d98fa[_0x9252('0x11')],'transfereeexten':_0x4d98fa['transfereeexten'],'transfereelinkedid':_0x4d98fa[_0x9252('0x12')],'isexternal':_0x4d98fa[_0x9252('0x13')],'context':_0x4d98fa['context'],'extension':_0x4d98fa[_0x9252('0x14')],'type':'blind'},'log':_0x9252('0x4')});};exports['attendedTransfer']=function(_0x58facd){return client[_0x9252('0x3')](_0x9252('0x4'),{'body':{'result':_0x58facd['result'],'transfererchannel':_0x58facd[_0x9252('0x15')],'transferercalleridnum':_0x58facd[_0x9252('0x16')],'transferercalleridname':_0x58facd['origtransferercalleridname'],'transfererconnectedlinenum':_0x58facd[_0x9252('0x17')],'transfererconnectedlinename':_0x58facd[_0x9252('0x18')],'transfereraccountcode':_0x58facd[_0x9252('0x19')],'transferercontext':_0x58facd[_0x9252('0x1a')],'transfererexten':_0x58facd[_0x9252('0x1b')],'transfererlinkedid':_0x58facd['origtransfererlinkedid'],'transfereechannel':_0x58facd['transfertargetchannel'],'transfereecalleridnum':_0x58facd['transfertargetcalleridnum'],'transfereecalleridname':_0x58facd['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x58facd[_0x9252('0x1c')],'transfereeconnectedlinename':_0x58facd[_0x9252('0x1d')],'transfereeaccountcode':_0x58facd['transfertargetaccountcode'],'transfereecontext':_0x58facd[_0x9252('0x1e')],'transfereeexten':_0x58facd['transfertargetexten'],'transfereelinkedid':_0x58facd[_0x9252('0x1f')],'isexternal':_0x58facd[_0x9252('0x13')],'context':_0x58facd[_0x9252('0x20')],'extension':_0x58facd[_0x9252('0x21')],'type':_0x9252('0x22')},'log':_0x9252('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b8e7614..d01903c 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68b3=['predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','omit','undefined','channels','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','StopMixMonitor','destinationchannel','stop','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','values','Event\x20name\x20mandatory','emit','event','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Action','then','message','isConnected','command','Command','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68b3,0x1d8));var _0x368b=function(_0x52cff9,_0x58c63e){_0x52cff9=_0x52cff9-0x0;var _0x1e2ed9=_0x68b3[_0x52cff9];return _0x1e2ed9;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var jayson=require(_0x368b('0x2'));var schema=require(_0x368b('0x3'));var BPromise=require(_0x368b('0x4'));var moment=require('moment');var config=require(_0x368b('0x5'));var properties=require(_0x368b('0x6'));var ami=require(_0x368b('0x7'));exports[_0x368b('0x8')]=function(_0x5d68cb,_0x12eb8f,_0x41b15b){return new BPromise(function(_0x104dad,_0x23584a){var _0x4406c8={'QueuePause':function(_0x127c1e){return new Promise(function(_0x2dec1c,_0x142d05){var _0x23622f=util[_0x368b('0x9')](_0x368b('0xa'),'SIP',_0x127c1e[_0x368b('0xb')]);if(_0x5d68cb[_0x368b('0xc')]&&_0x5d68cb[_0x368b('0xc')][_0x23622f]&&_0x5d68cb['timers'][_0x23622f][_0x368b('0xd')]){_0x5d68cb[_0x368b('0xc')][_0x23622f][_0x368b('0xe')]();}if(_0x5d68cb['agents'][_0x23622f]){_0x5d68cb[_0x368b('0xf')][_0x23622f][_0x368b('0x10')]({'statePause':_0x127c1e['pause']?!![]:![]});}_0x2dec1c({'code':0xc8,'message':_0x368b('0x11')});});},'Reload':function(_0x250697){var _0x44e376=this;return new Promise(function(_0x4015fe,_0xdd5d13){if(ami['isConnected']()==![]){return _0xdd5d13(_0x44e376[_0x368b('0x12')](0x1f4,[config[_0x368b('0x13')]['ip'],config['asterisk'][_0x368b('0x14')],_0x368b('0x15')][_0x368b('0x16')]('\x20')));}_0x250697=_['pick'](_0x250697,_[_0x368b('0x17')](properties[_0x368b('0x18')]));_0x250697[_0x368b('0x19')]='Reload';return ami[_0x368b('0x1a')](_0x250697)[_0x368b('0x1b')](function(_0x1c2956){_0x4015fe({'code':0xc8,'message':_0x1c2956['message']});})['catch'](function(_0x3e2e9f){_0xdd5d13(_0x44e376[_0x368b('0x12')](0x1f5,_0x3e2e9f[_0x368b('0x1c')]));});});},'Command':function(_0x1e632a){var _0x1a4f20=this;return new Promise(function(_0x4b8fb7,_0x26447c){if(ami[_0x368b('0x1d')]()==![]){return _0x26447c(_0x1a4f20[_0x368b('0x12')](0x1f4,[config[_0x368b('0x13')]['ip'],config[_0x368b('0x13')][_0x368b('0x14')],_0x368b('0x15')][_0x368b('0x16')]('\x20')));}_0x1e632a=_['pick'](_0x1e632a,_0x368b('0x1e'));_0x1e632a[_0x368b('0x19')]=_0x368b('0x1f');return ami[_0x368b('0x1a')](_0x1e632a)[_0x368b('0x1b')](function(_0x4c2fca){_0x4b8fb7({'code':0xc8,'message':_0x4c2fca[_0x368b('0x20')]});})[_0x368b('0x21')](function(_0x3a22bd){_0x26447c(_0x1a4f20[_0x368b('0x12')](0x1f5,_0x3a22bd[_0x368b('0x1c')]));});});},'VoiceQueues':function(_0x85515f){return new Promise(function(_0x430e16,_0x11ea2d){var _0x3123c1=[];for(var _0x3f7f89 in _0x5d68cb[_0x368b('0x22')]){if(_0x5d68cb[_0x368b('0x22')][_0x368b('0x23')](_0x3f7f89)){var _0x376e61=_0x5d68cb[_0x368b('0x22')][_0x3f7f89];var _0x23a83a={'id':_0x376e61['id'],'name':_0x376e61[_0x368b('0xb')],'strategy':_0x376e61[_0x368b('0x24')],'answered':_0x376e61[_0x368b('0x25')],'available':_0x376e61[_0x368b('0x26')],'loggedIn':_0x376e61[_0x368b('0x27')],'pTalking':_0x376e61[_0x368b('0x28')],'sumBillable':_0x376e61[_0x368b('0x29')],'sumDuration':_0x376e61[_0x368b('0x2a')],'sumHoldTime':_0x376e61['sumHoldTime']||0x0,'talking':_0x376e61['talking'],'total':_0x376e61[_0x368b('0x2b')],'type':_0x376e61[_0x368b('0x2c')],'unmanaged':_0x376e61[_0x368b('0x2d')],'abandoned':_0x376e61[_0x368b('0x2e')],'waiting':_0x376e61['waiting'],'loggedInDb':_0x376e61[_0x368b('0x2f')]};if(_0x376e61[_0x368b('0x2c')]===_0x368b('0x30')){_0x23a83a[_0x368b('0x31')]=_0x376e61[_0x368b('0x31')];_0x23a83a['dialMethod']=_0x376e61[_0x368b('0x32')];_0x23a83a[_0x368b('0x33')]=_0x376e61[_0x368b('0x33')];_0x23a83a[_0x368b('0x34')]=_0x376e61['dialOriginateCallerIdNumber'];_0x23a83a['dialOriginateTimeout']=_0x376e61['dialOriginateTimeout'];_0x23a83a[_0x368b('0x35')]=_0x376e61[_0x368b('0x35')];_0x23a83a[_0x368b('0x36')]=_0x376e61[_0x368b('0x36')];_0x23a83a[_0x368b('0x37')]=_0x376e61['outboundAnswerAgiCallsDay'];_0x23a83a[_0x368b('0x38')]=_0x376e61[_0x368b('0x38')];_0x23a83a['outboundBlacklistCallsDay']=_0x376e61[_0x368b('0x39')];_0x23a83a[_0x368b('0x3a')]=_0x376e61['outboundBusyCallsDay'];_0x23a83a[_0x368b('0x3b')]=_0x376e61[_0x368b('0x3b')];_0x23a83a['outboundDropCallsDayACS']=_0x376e61[_0x368b('0x3c')];_0x23a83a['outboundDropCallsDayCallersExit']=_0x376e61['outboundDropCallsDayCallersExit'];_0x23a83a['outboundDropCallsDayTimeout']=_0x376e61[_0x368b('0x3d')];_0x23a83a[_0x368b('0x3e')]=_0x376e61[_0x368b('0x3e')];_0x23a83a[_0x368b('0x3f')]=_0x376e61[_0x368b('0x3f')];_0x23a83a[_0x368b('0x40')]=_0x376e61[_0x368b('0x40')];_0x23a83a[_0x368b('0x41')]=_0x376e61[_0x368b('0x41')];_0x23a83a[_0x368b('0x42')]=_0x376e61['outboundRejectCallsDay'];_0x23a83a[_0x368b('0x43')]=_0x376e61[_0x368b('0x43')];_0x23a83a['predictiveIntervalAnsweredCalls']=_0x376e61[_0x368b('0x44')];_0x23a83a[_0x368b('0x45')]=_0x376e61[_0x368b('0x45')];_0x23a83a[_0x368b('0x46')]=_0x376e61[_0x368b('0x46')];_0x23a83a['predictiveIntervalDroppedCallsCallersExit']=_0x376e61[_0x368b('0x47')];_0x23a83a[_0x368b('0x48')]=_0x376e61[_0x368b('0x48')];_0x23a83a[_0x368b('0x49')]=_0x376e61['predictiveIntervalErlangCalls'];_0x23a83a['predictiveIntervalErlangCallsDroppedCalls']=_0x376e61[_0x368b('0x4a')];_0x23a83a[_0x368b('0x4b')]=_0x376e61[_0x368b('0x4b')];_0x23a83a[_0x368b('0x4c')]=_0x376e61[_0x368b('0x4c')];_0x23a83a[_0x368b('0x4d')]=_0x376e61[_0x368b('0x4d')];_0x23a83a[_0x368b('0x4e')]=_0x376e61[_0x368b('0x4e')];_0x23a83a[_0x368b('0x4f')]=_0x376e61['predictiveIntervalTotalCalls'];_0x23a83a[_0x368b('0x1c')]=_0x376e61[_0x368b('0x1c')];_0x23a83a['originated']=_0x376e61[_0x368b('0x50')];_0x23a83a[_0x368b('0x51')]=_0x376e61[_0x368b('0x51')];_0x23a83a[_0x368b('0x52')]=_0x376e61['erlangCallToSecond'];_0x23a83a[_0x368b('0x53')]=_0x376e61[_0x368b('0x53')];_0x23a83a['erlangBusyFactor']=_0x376e61[_0x368b('0x54')];_0x23a83a[_0x368b('0x55')]=_0x376e61[_0x368b('0x55')];_0x23a83a['startProgressive']=_0x376e61[_0x368b('0x56')];}if(_0x376e61[_0x368b('0x57')]){_0x23a83a[_0x368b('0x57')]={'id':_0x376e61['Trunk']['id'],'name':_0x376e61['Trunk'][_0x368b('0xb')],'active':_0x376e61[_0x368b('0x57')]['active'],'callerid':_0x376e61[_0x368b('0x57')][_0x368b('0x58')]};}if(_0x376e61[_0x368b('0x59')]){_0x23a83a[_0x368b('0x59')]={'id':_0x376e61[_0x368b('0x59')]['id'],'name':_0x376e61[_0x368b('0x59')][_0x368b('0xb')]};}_0x3123c1[_0x368b('0x5a')](_0x23a83a);}}_0x430e16({'count':_0x3123c1[_0x368b('0x5b')],'rows':_0x3123c1});});},'UpdateVoiceQueue':function(_0x33914c){return new Promise(function(_0x321a64,_0x432df9){var _0xcaf3d0=_['find'](_0x5d68cb[_0x368b('0x22')],{'id':parseInt(_0x33914c['id'])});var _0x1fff8e=_[_0x368b('0x5c')](_0x33914c,['id']);if(_0xcaf3d0){for(var _0xf95817 in _0x1fff8e){if(typeof _0x1fff8e[_0xf95817]!==_0x368b('0x5d')&&typeof _0xcaf3d0[_0xf95817]!=='undefined'){_0xcaf3d0[_0xf95817]=_0x1fff8e[_0xf95817];}}_0x321a64(_0xcaf3d0);}else{_0x432df9();}});},'VoiceChannels':function(_0x5ed4c6){return new Promise(function(_0x131e50,_0x46b467){var _0x1c8755=_['values'](_0x5d68cb[_0x368b('0x5e')]);_0x131e50({'count':_0x1c8755[_0x368b('0x5b')],'rows':_0x1c8755});});},'VoiceChannelMixMonitor':function(_0xa87288){var _0xf22764=this;return new Promise(function(_0x3cae32,_0x1fdc4b){if(ami[_0x368b('0x1d')]()==![]){return _0x1fdc4b(_0xf22764[_0x368b('0x12')](0x1f4,[config[_0x368b('0x13')]['ip'],config[_0x368b('0x13')]['username'],_0x368b('0x15')]['join']('\x20')));}var _0x1a4370=schema(properties['voicechannel'])[_0x368b('0x3')](_0xa87288);if(_0x1a4370['length']>0x0){return _0x1fdc4b(_0xf22764[_0x368b('0x12')](0x1f4,_[_0x368b('0x5f')](_0x1a4370,_0x368b('0x1c'))[_0x368b('0x16')](',\x20')));}var _0x49b78c=_[_0x368b('0x60')](_0x5d68cb[_0x368b('0x5e')],{'uniqueid':_0xa87288[_0x368b('0x61')]});if(_0x49b78c&&_0x49b78c[_0x368b('0x62')]){var _0x424aa1=util[_0x368b('0x9')](_0x368b('0x63'),_0xa87288[_0x368b('0x64')]||_0xa87288[_0x368b('0x61')],_0xa87288['format']||_0x368b('0x65'));return ami[_0x368b('0x1a')]({'action':_0x368b('0x66'),'channel':_0x49b78c[_0x368b('0x62')],'file':_0x424aa1,'options':_0x368b('0x67')})['then'](function(_0x16492f){var _0x1ddb6e=_[_0x368b('0x60')](_0x49b78c[_0x368b('0x68')],{'filename':_0x368b('0x69')+_0x424aa1[_0x368b('0x6a')]()});if(_[_0x368b('0x6b')](_0x1ddb6e)){_0x49b78c['monitors']['push']({'filename':'/var/spool/asterisk/monitor/'+_0x424aa1['toLowerCase'](),'createdAt':moment()[_0x368b('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x16492f[_0x368b('0x6c')],'status':_0x368b('0x6d')});}else{_0x1ddb6e['mixmonitorid']=_0x16492f['mixmonitorid'];_0x1ddb6e[_0x368b('0x6e')]='rec';}_0x3cae32({'code':0xc8,'message':[_0xa87288[_0x368b('0x61')],_0x368b('0x6f'),_0x16492f['mixmonitorid']][_0x368b('0x16')]('\x20'),'mixmonitorid':_0x16492f[_0x368b('0x6c')]});})['catch'](function(_0x212b68){_0x1fdc4b(_0xf22764['error'](0x1f5,[_0xa87288[_0x368b('0x61')],_0x212b68[_0x368b('0x1c')][_0x368b('0x6a')]()][_0x368b('0x16')]('\x20')));});}else{return _0x1fdc4b(_0xf22764['error'](0x1f5,_0x368b('0x70')));}});},'VoiceChannelStopMixMonitor':function(_0x233a32){var _0x670789=this;return new Promise(function(_0x14974e,_0x49a634){if(ami[_0x368b('0x1d')]()==![]){return _0x49a634(_0x670789['error'](0x1f4,[config[_0x368b('0x13')]['ip'],config[_0x368b('0x13')]['username'],'ami\x20disconnected'][_0x368b('0x16')]('\x20')));}var _0xeea586=schema(properties[_0x368b('0x71')])[_0x368b('0x3')](_0x233a32);if(_0xeea586[_0x368b('0x5b')]>0x0){return _0x49a634(_0x670789['error'](0x1f4,_[_0x368b('0x5f')](_0xeea586,_0x368b('0x1c'))['join'](',\x20')));}var _0x2e5827=_[_0x368b('0x60')](_0x5d68cb[_0x368b('0x5e')],{'uniqueid':_0x233a32[_0x368b('0x61')]});if(_0x2e5827){return BPromise['resolve']()[_0x368b('0x1b')](function(){if(_0x2e5827[_0x368b('0x62')]){return ami[_0x368b('0x1a')]({'action':_0x368b('0x72'),'channel':_0x2e5827['channel'],'mixmonitorid':_0x233a32['mixmonitorid']})['catch'](function(_0x4b949f){});}})[_0x368b('0x1b')](function(){if(_0x2e5827[_0x368b('0x73')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x2e5827['destinationchannel'],'mixmonitorid':_0x233a32['mixmonitorid']})['catch'](function(_0x33c3a6){});}})[_0x368b('0x1b')](function(_0xca4639){var _0x5d5b4d=_[_0x368b('0x60')](_0x2e5827['monitors'],{'mixmonitorid':_0x233a32['mixmonitorid']});if(_0x5d5b4d){_0x5d5b4d[_0x368b('0x6e')]=_0x368b('0x74');}})[_0x368b('0x1b')](function(){var _0x17c862=util['format'](_0x368b('0x63'),_0x233a32[_0x368b('0x64')]||_0x233a32[_0x368b('0x61')],_0x233a32['format']||_0x368b('0x65'));var _0x159a89=_['find'](_0x2e5827[_0x368b('0x68')],{'filename':_0x368b('0x69')+_0x17c862['toLowerCase']()});if(_0x159a89){_0x159a89[_0x368b('0x6e')]='stop';}})[_0x368b('0x1b')](function(){_0x14974e({'code':0xc8,'message':[_0x233a32[_0x368b('0x61')],'StopMixMonitor\x20Success'][_0x368b('0x16')]('\x20')});})[_0x368b('0x21')](function(_0x3785af){_0x49a634(_0x670789[_0x368b('0x12')](0x1f5,[_0x233a32[_0x368b('0x61')],_0x3785af['message'][_0x368b('0x6a')]()][_0x368b('0x16')]('\x20')));});}else{return _0x49a634(_0x670789[_0x368b('0x12')](0x1f5,_0x368b('0x70')));}});},'VoiceQueuesChannels':function(_0x321168){return new Promise(function(_0x1c9cce,_0x3432f2){var _0x2ab1eb=_['values'](_0x5d68cb[_0x368b('0x75')]);_0x1c9cce({'count':_0x2ab1eb[_0x368b('0x5b')],'rows':_0x2ab1eb});});},'VoiceQueuesChannel':function(_0x4c04bf){var _0x273d33=this;return new Promise(function(_0x18b97b,_0x2f94d3){var _0x543ca3=schema(properties['voicequeuechannel'])[_0x368b('0x3')](_0x4c04bf);if(_0x543ca3[_0x368b('0x5b')]>0x0){return _0x2f94d3(_0x273d33[_0x368b('0x12')](0x1f4,_[_0x368b('0x5f')](_0x543ca3,'message')[_0x368b('0x16')](',\x20')));}var _0x5d7ed8=_[_0x368b('0x60')](_0x5d68cb[_0x368b('0x75')],{'uniqueid':_0x4c04bf[_0x368b('0x61')]});if(_0x5d7ed8){_0x18b97b(_0x5d7ed8);}else{return _0x2f94d3(_0x273d33['error'](0x1f5,_0x368b('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x2e9cbe){var _0x2c02ca=this;return new Promise(function(_0x4d6255,_0x51dffd){if(ami['isConnected']()==![]){return _0x51dffd(_0x2c02ca[_0x368b('0x12')](0x1f4,[config[_0x368b('0x13')]['ip'],config[_0x368b('0x13')][_0x368b('0x14')],_0x368b('0x15')]['join']('\x20')));}var _0x8710f7=schema(properties[_0x368b('0x76')])['validate'](_0x2e9cbe);if(_0x8710f7[_0x368b('0x5b')]>0x0){return _0x51dffd(_0x2c02ca['error'](0x1f4,_['map'](_0x8710f7,_0x368b('0x1c'))[_0x368b('0x16')](',\x20')));}var _0x46e660=_[_0x368b('0x60')](_0x5d68cb[_0x368b('0x75')],{'uniqueid':_0x2e9cbe[_0x368b('0x61')]});if(_0x46e660&&_0x46e660[_0x368b('0x62')]){return ami[_0x368b('0x1a')]({'action':_0x368b('0x77'),'channel':_0x46e660[_0x368b('0x62')]})['then'](function(_0x5ed540){_0x4d6255({'code':0xc8,'message':[_0x2e9cbe['uniqueid'],_0x5ed540['message'][_0x368b('0x6a')]()]['join']('\x20')});})['catch'](function(_0x23a1d6){_0x51dffd(_0x2c02ca[_0x368b('0x12')](0x1f5,[_0x2e9cbe[_0x368b('0x61')],_0x23a1d6[_0x368b('0x1c')][_0x368b('0x6a')]()][_0x368b('0x16')]('\x20')));});}else{return _0x51dffd(_0x2c02ca[_0x368b('0x12')](0x1f5,_0x368b('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x57b1c4){var _0x19e179=this;return new Promise(function(_0x99599c,_0x55f183){if(ami[_0x368b('0x1d')]()==![]){return _0x55f183(_0x19e179[_0x368b('0x12')](0x1f4,[config[_0x368b('0x13')]['ip'],config[_0x368b('0x13')][_0x368b('0x14')],_0x368b('0x15')][_0x368b('0x16')]('\x20')));}var _0x41e848=schema(properties[_0x368b('0x78')])[_0x368b('0x3')](_0x57b1c4);if(_0x41e848[_0x368b('0x5b')]>0x0){return _0x55f183(_0x19e179[_0x368b('0x12')](0x1f4,_[_0x368b('0x5f')](_0x41e848,_0x368b('0x1c'))['join'](',\x20')));}var _0x49ad9d=_[_0x368b('0x60')](_0x5d68cb[_0x368b('0x75')],{'uniqueid':_0x57b1c4[_0x368b('0x61')]});if(_0x49ad9d&&_0x49ad9d['channel']){return ami[_0x368b('0x1a')]({'action':_0x368b('0x79'),'channel':_0x49ad9d[_0x368b('0x62')],'exten':_0x57b1c4['exten'],'context':_0x57b1c4[_0x368b('0x7a')]||_0x49ad9d[_0x368b('0x7a')],'priority':0x1})['then'](function(_0x235c63){_0x99599c({'code':0xc8,'message':[_0x57b1c4[_0x368b('0x61')],_0x235c63[_0x368b('0x1c')]['toLowerCase']()]['join']('\x20')});})[_0x368b('0x21')](function(_0x52a495){_0x55f183(_0x19e179[_0x368b('0x12')](0x1f5,[_0x57b1c4[_0x368b('0x61')],_0x52a495[_0x368b('0x1c')][_0x368b('0x6a')]()]['join']('\x20')));});}else{return _0x55f183(_0x19e179[_0x368b('0x12')](0x1f5,_0x368b('0x70')));}});},'Agents':function(_0x1bb54f){return new Promise(function(_0x54c95a,_0x134054){var _0x46d5d3=_[_0x368b('0x7b')](_0x5d68cb[_0x368b('0xf')]);_0x54c95a({'count':_0x46d5d3['length'],'rows':_0x46d5d3});});},'Telephones':function(_0x407ab1){return new Promise(function(_0x4844fe,_0x1740a6){var _0x1374e0=_[_0x368b('0x7b')](_0x5d68cb['telephones']);_0x4844fe({'count':_0x1374e0['length'],'rows':_0x1374e0});});},'Trunks':function(_0x4bb209){return new Promise(function(_0x57435b,_0x221d92){var _0x3146a9=_['values'](_0x5d68cb['trunks']);_0x57435b({'count':_0x3146a9[_0x368b('0x5b')],'rows':_0x3146a9});});},'OutboundChannels':function(_0x4a5d99){return new Promise(function(_0x197d3a,_0x1697e4){var _0x570efe=_[_0x368b('0x7b')](_0x5d68cb['outboundChannels']);_0x197d3a({'count':_0x570efe[_0x368b('0x5b')],'rows':_0x570efe});});},'Outbound':function(_0x5294bf){return new Promise(function(_0x1dd4a7,_0x12cad7){_0x1dd4a7(_0x5d68cb['outbound']);});},'Campaigns':function(_0x64d199){return new Promise(function(_0x50e5d3,_0x147d22){var _0x2798e1=_['values'](_0x5d68cb['campaigns']);_0x50e5d3({'count':_0x2798e1[_0x368b('0x5b')],'rows':_0x2798e1});});},'VoiceQueuesPreview':function(_0x4ee51f){var _0x5aede6=this;return new Promise(function(_0x38bd68,_0x54c442){_0x12eb8f['run'](_0x4ee51f['id'])['then'](function(_0x4f5958){_0x38bd68({'code':0xc8,'message':_0x4f5958[_0x368b('0x1c')]});})['catch'](function(_0x303c52){_0x54c442(_0x5aede6[_0x368b('0x12')](0x1f4,_0x303c52['message']));});});},'EventManager':function(_0x302d6d){var _0x3f5e7b=this;return new Promise(function(_0x50de42,_0xe4bbd0){if(!_0x302d6d['event']){return _0xe4bbd0(_0x3f5e7b['error'](0x1f4,_0x368b('0x7c')));}ami[_0x368b('0x7d')]('custom:'+_0x302d6d[_0x368b('0x7e')],_0x302d6d['message']);_0x50de42({'code':0xc8,'message':_0x302d6d});});},'FaxAccounts':function(_0x4af1d3){return new Promise(function(_0x379dc9,_0x4d7151){var _0xb4049=_['values'](_0x5d68cb['faxAccounts']);_0x379dc9({'count':_0xb4049[_0x368b('0x5b')],'rows':_0xb4049});});},'SendFax':function(_0x5b02ca){var _0x30235b=this;return new Promise(function(_0x2b2c54,_0x3082df){_0x41b15b[_0x368b('0x7f')](_0x5b02ca)[_0x368b('0x1b')](function(_0x150a34){_0x2b2c54({'code':0xc8,'message':_0x150a34['message']});})[_0x368b('0x21')](function(_0x11ed4b){_0x3082df(_0x30235b[_0x368b('0x12')](0x1f4,_0x11ed4b[_0x368b('0x1c')]));});});},'CheckAfterSend':function(_0x134e28){var _0x498a81=this;return new Promise(function(_0x313462,_0x39db39){_0x41b15b[_0x368b('0x80')](_0x134e28)[_0x368b('0x1b')](function(_0x531cb4){_0x313462({'code':0xc8,'message':_0x531cb4[_0x368b('0x1c')]});})[_0x368b('0x21')](function(_0x19e5c4){_0x39db39(_0x498a81[_0x368b('0x12')](0x1f4,_0x19e5c4[_0x368b('0x1c')]));});});}};var _0x2eeb1c=jayson[_0x368b('0x81')](_0x4406c8)[_0x368b('0x82')]();_0x2eeb1c['on']('error',function(_0x4136e6){return _0x23584a(_0x4136e6);});_0x2eeb1c[_0x368b('0x8')](0x232a,_0x368b('0x83'),function(){console[_0x368b('0x84')](_0x368b('0x85'),0x232a);return _0x104dad(_0x368b('0x86')+0x232a);});});}; \ No newline at end of file +var _0x4bd3=['loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','length','find','undefined','voicechannel','map','uniqueid','%s.%s','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','MixMonitor\x20Success','channels','resolve','channel','destinationchannel','StopMixMonitor','stop','wav','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','voicequeuechannel','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','../properties','../ami','listen','format','%s/%s','SIP','timers','timer','agents','pause','QueuePause','isConnected','error','asterisk','username','pick','keys','module','action','Reload','Action','then','message','catch','ami\x20disconnected','join','command','content','voiceQueues','hasOwnProperty','name','strategy','available'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x4bd3,0x174));var _0x34bd=function(_0x13c4a8,_0x4a592b){_0x13c4a8=_0x13c4a8-0x0;var _0x4eab39=_0x4bd3[_0x13c4a8];return _0x4eab39;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var jayson=require(_0x34bd('0x1'));var schema=require(_0x34bd('0x2'));var BPromise=require('bluebird');var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x34bd('0x3'));var ami=require(_0x34bd('0x4'));exports[_0x34bd('0x5')]=function(_0x5846f3,_0x2133c5,_0x2a15a2){return new BPromise(function(_0x5c2a7a,_0x3e8744){var _0x213716={'QueuePause':function(_0x51a4d7){return new Promise(function(_0xd600e1,_0x76de8d){var _0x3260ff=util[_0x34bd('0x6')](_0x34bd('0x7'),_0x34bd('0x8'),_0x51a4d7['name']);if(_0x5846f3[_0x34bd('0x9')]&&_0x5846f3[_0x34bd('0x9')][_0x3260ff]&&_0x5846f3[_0x34bd('0x9')][_0x3260ff][_0x34bd('0xa')]){_0x5846f3['timers'][_0x3260ff]['updateAcw']();}if(_0x5846f3[_0x34bd('0xb')][_0x3260ff]){_0x5846f3['agents'][_0x3260ff]['updateStatusRealtime']({'statePause':_0x51a4d7[_0x34bd('0xc')]?!![]:![]});}_0xd600e1({'code':0xc8,'message':_0x34bd('0xd')});});},'Reload':function(_0x282af4){var _0x1d627d=this;return new Promise(function(_0x2ee180,_0x14cd37){if(ami[_0x34bd('0xe')]()==![]){return _0x14cd37(_0x1d627d[_0x34bd('0xf')](0x1f4,[config[_0x34bd('0x10')]['ip'],config['asterisk'][_0x34bd('0x11')],'ami\x20disconnected']['join']('\x20')));}_0x282af4=_[_0x34bd('0x12')](_0x282af4,_[_0x34bd('0x13')](properties[_0x34bd('0x14')]));_0x282af4[_0x34bd('0x15')]=_0x34bd('0x16');return ami[_0x34bd('0x17')](_0x282af4)[_0x34bd('0x18')](function(_0x1c12e8){_0x2ee180({'code':0xc8,'message':_0x1c12e8[_0x34bd('0x19')]});})[_0x34bd('0x1a')](function(_0x4b5ebb){_0x14cd37(_0x1d627d['error'](0x1f5,_0x4b5ebb[_0x34bd('0x19')]));});});},'Command':function(_0x324f7d){var _0x265e70=this;return new Promise(function(_0x220666,_0x3976e4){if(ami[_0x34bd('0xe')]()==![]){return _0x3976e4(_0x265e70[_0x34bd('0xf')](0x1f4,[config[_0x34bd('0x10')]['ip'],config[_0x34bd('0x10')]['username'],_0x34bd('0x1b')][_0x34bd('0x1c')]('\x20')));}_0x324f7d=_[_0x34bd('0x12')](_0x324f7d,_0x34bd('0x1d'));_0x324f7d[_0x34bd('0x15')]='Command';return ami['Action'](_0x324f7d)['then'](function(_0x4edf84){_0x220666({'code':0xc8,'message':_0x4edf84[_0x34bd('0x1e')]});})['catch'](function(_0x10fc4b){_0x3976e4(_0x265e70[_0x34bd('0xf')](0x1f5,_0x10fc4b[_0x34bd('0x19')]));});});},'VoiceQueues':function(_0x5c3c85){return new Promise(function(_0x41bffd,_0x14479a){var _0x4f0dff=[];for(var _0x457006 in _0x5846f3['voiceQueues']){if(_0x5846f3[_0x34bd('0x1f')][_0x34bd('0x20')](_0x457006)){var _0x264c94=_0x5846f3[_0x34bd('0x1f')][_0x457006];var _0x56baf7={'id':_0x264c94['id'],'name':_0x264c94[_0x34bd('0x21')],'strategy':_0x264c94[_0x34bd('0x22')],'answered':_0x264c94['answered'],'available':_0x264c94[_0x34bd('0x23')],'loggedIn':_0x264c94[_0x34bd('0x24')],'pTalking':_0x264c94[_0x34bd('0x25')],'sumBillable':_0x264c94[_0x34bd('0x26')],'sumDuration':_0x264c94[_0x34bd('0x27')],'sumHoldTime':_0x264c94[_0x34bd('0x28')]||0x0,'talking':_0x264c94[_0x34bd('0x29')],'total':_0x264c94['total'],'type':_0x264c94[_0x34bd('0x2a')],'unmanaged':_0x264c94[_0x34bd('0x2b')],'abandoned':_0x264c94['abandoned'],'waiting':_0x264c94['waiting'],'loggedInDb':_0x264c94[_0x34bd('0x2c')]};if(_0x264c94[_0x34bd('0x2a')]===_0x34bd('0x2d')){_0x56baf7['dialActive']=_0x264c94['dialActive'];_0x56baf7[_0x34bd('0x2e')]=_0x264c94[_0x34bd('0x2e')];_0x56baf7[_0x34bd('0x2f')]=_0x264c94[_0x34bd('0x2f')];_0x56baf7['dialOriginateCallerIdNumber']=_0x264c94[_0x34bd('0x30')];_0x56baf7[_0x34bd('0x31')]=_0x264c94[_0x34bd('0x31')];_0x56baf7[_0x34bd('0x32')]=_0x264c94[_0x34bd('0x32')];_0x56baf7[_0x34bd('0x33')]=_0x264c94['temp'];_0x56baf7[_0x34bd('0x34')]=_0x264c94['outboundAnswerAgiCallsDay'];_0x56baf7[_0x34bd('0x35')]=_0x264c94[_0x34bd('0x35')];_0x56baf7[_0x34bd('0x36')]=_0x264c94['outboundBlacklistCallsDay'];_0x56baf7[_0x34bd('0x37')]=_0x264c94[_0x34bd('0x37')];_0x56baf7['outboundCongestionCallsDay']=_0x264c94[_0x34bd('0x38')];_0x56baf7[_0x34bd('0x39')]=_0x264c94[_0x34bd('0x39')];_0x56baf7['outboundDropCallsDayCallersExit']=_0x264c94[_0x34bd('0x3a')];_0x56baf7[_0x34bd('0x3b')]=_0x264c94['outboundDropCallsDayTimeout'];_0x56baf7[_0x34bd('0x3c')]=_0x264c94[_0x34bd('0x3c')];_0x56baf7[_0x34bd('0x3d')]=_0x264c94[_0x34bd('0x3d')];_0x56baf7[_0x34bd('0x3e')]=_0x264c94[_0x34bd('0x3e')];_0x56baf7['outboundReCallsDay']=_0x264c94['outboundReCallsDay'];_0x56baf7['outboundRejectCallsDay']=_0x264c94[_0x34bd('0x3f')];_0x56baf7[_0x34bd('0x40')]=_0x264c94['outboundUnknownCallsDay'];_0x56baf7['predictiveIntervalAnsweredCalls']=_0x264c94[_0x34bd('0x41')];_0x56baf7['predictiveIntervalAvgHoldtime']=_0x264c94['predictiveIntervalAvgHoldtime'];_0x56baf7[_0x34bd('0x42')]=_0x264c94[_0x34bd('0x42')];_0x56baf7[_0x34bd('0x43')]=_0x264c94[_0x34bd('0x43')];_0x56baf7[_0x34bd('0x44')]=_0x264c94['predictiveIntervalDroppedCallsTimeout'];_0x56baf7['predictiveIntervalErlangCalls']=_0x264c94[_0x34bd('0x45')];_0x56baf7['predictiveIntervalErlangCallsDroppedCalls']=_0x264c94[_0x34bd('0x46')];_0x56baf7[_0x34bd('0x47')]=_0x264c94[_0x34bd('0x47')];_0x56baf7[_0x34bd('0x48')]=_0x264c94[_0x34bd('0x48')];_0x56baf7['predictiveIntervalPauses']=_0x264c94[_0x34bd('0x49')];_0x56baf7[_0x34bd('0x4a')]=_0x264c94[_0x34bd('0x4a')];_0x56baf7[_0x34bd('0x4b')]=_0x264c94['predictiveIntervalTotalCalls'];_0x56baf7[_0x34bd('0x19')]=_0x264c94['message'];_0x56baf7[_0x34bd('0x4c')]=_0x264c94[_0x34bd('0x4c')];_0x56baf7['erlangCalls']=_0x264c94[_0x34bd('0x4d')];_0x56baf7['erlangCallToSecond']=_0x264c94[_0x34bd('0x4e')];_0x56baf7[_0x34bd('0x4f')]=_0x264c94[_0x34bd('0x4f')];_0x56baf7[_0x34bd('0x50')]=_0x264c94[_0x34bd('0x50')];_0x56baf7[_0x34bd('0x51')]=_0x264c94[_0x34bd('0x51')];_0x56baf7['startProgressive']=_0x264c94['startProgressive'];}if(_0x264c94['Trunk']){_0x56baf7[_0x34bd('0x52')]={'id':_0x264c94[_0x34bd('0x52')]['id'],'name':_0x264c94[_0x34bd('0x52')][_0x34bd('0x21')],'active':_0x264c94['Trunk'][_0x34bd('0x53')],'callerid':_0x264c94[_0x34bd('0x52')][_0x34bd('0x54')]};}if(_0x264c94[_0x34bd('0x55')]){_0x56baf7[_0x34bd('0x55')]={'id':_0x264c94['Interval']['id'],'name':_0x264c94[_0x34bd('0x55')]['name']};}_0x4f0dff['push'](_0x56baf7);}}_0x41bffd({'count':_0x4f0dff[_0x34bd('0x56')],'rows':_0x4f0dff});});},'UpdateVoiceQueue':function(_0x53a114){return new Promise(function(_0x8474fb,_0x293457){var _0x18d71e=_[_0x34bd('0x57')](_0x5846f3[_0x34bd('0x1f')],{'id':parseInt(_0x53a114['id'])});var _0x5b061a=_['omit'](_0x53a114,['id']);if(_0x18d71e){for(var _0x33e8e8 in _0x5b061a){if(typeof _0x5b061a[_0x33e8e8]!=='undefined'&&typeof _0x18d71e[_0x33e8e8]!==_0x34bd('0x58')){_0x18d71e[_0x33e8e8]=_0x5b061a[_0x33e8e8];}}_0x8474fb(_0x18d71e);}else{_0x293457();}});},'VoiceChannels':function(_0x223adb){return new Promise(function(_0x23b29,_0x540b04){var _0x4ad00c=_['values'](_0x5846f3['channels']);_0x23b29({'count':_0x4ad00c[_0x34bd('0x56')],'rows':_0x4ad00c});});},'VoiceChannelMixMonitor':function(_0x510c27){var _0x21d2ea=this;return new Promise(function(_0x5c0f86,_0x24033f){if(ami[_0x34bd('0xe')]()==![]){return _0x24033f(_0x21d2ea[_0x34bd('0xf')](0x1f4,[config[_0x34bd('0x10')]['ip'],config[_0x34bd('0x10')]['username'],_0x34bd('0x1b')][_0x34bd('0x1c')]('\x20')));}var _0x1f4d0b=schema(properties[_0x34bd('0x59')])[_0x34bd('0x2')](_0x510c27);if(_0x1f4d0b['length']>0x0){return _0x24033f(_0x21d2ea[_0x34bd('0xf')](0x1f4,_[_0x34bd('0x5a')](_0x1f4d0b,'message')[_0x34bd('0x1c')](',\x20')));}var _0x1a935e=_['find'](_0x5846f3['channels'],{'uniqueid':_0x510c27[_0x34bd('0x5b')]});if(_0x1a935e&&_0x1a935e['channel']){var _0x499642=util[_0x34bd('0x6')](_0x34bd('0x5c'),_0x510c27['filename']||_0x510c27['uniqueid'],_0x510c27['format']||'wav');return ami[_0x34bd('0x17')]({'action':_0x34bd('0x5d'),'channel':_0x1a935e['channel'],'file':_0x499642,'options':'ai(mixmonitorid)'})['then'](function(_0x477fd4){var _0x7df072=_['find'](_0x1a935e[_0x34bd('0x5e')],{'filename':_0x34bd('0x5f')+_0x499642[_0x34bd('0x60')]()});if(_[_0x34bd('0x61')](_0x7df072)){_0x1a935e[_0x34bd('0x5e')][_0x34bd('0x62')]({'filename':'/var/spool/asterisk/monitor/'+_0x499642[_0x34bd('0x60')](),'createdAt':moment()[_0x34bd('0x6')](_0x34bd('0x63')),'mixmonitorid':_0x477fd4[_0x34bd('0x64')],'status':'rec'});}else{_0x7df072[_0x34bd('0x64')]=_0x477fd4['mixmonitorid'];_0x7df072[_0x34bd('0x65')]='rec';}_0x5c0f86({'code':0xc8,'message':[_0x510c27[_0x34bd('0x5b')],_0x34bd('0x66'),_0x477fd4[_0x34bd('0x64')]][_0x34bd('0x1c')]('\x20'),'mixmonitorid':_0x477fd4[_0x34bd('0x64')]});})[_0x34bd('0x1a')](function(_0x6db4ba){_0x24033f(_0x21d2ea[_0x34bd('0xf')](0x1f5,[_0x510c27[_0x34bd('0x5b')],_0x6db4ba[_0x34bd('0x19')][_0x34bd('0x60')]()]['join']('\x20')));});}else{return _0x24033f(_0x21d2ea[_0x34bd('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x15fea7){var _0x4f2091=this;return new Promise(function(_0x3fc297,_0x50ed7f){if(ami[_0x34bd('0xe')]()==![]){return _0x50ed7f(_0x4f2091[_0x34bd('0xf')](0x1f4,[config[_0x34bd('0x10')]['ip'],config[_0x34bd('0x10')][_0x34bd('0x11')],_0x34bd('0x1b')][_0x34bd('0x1c')]('\x20')));}var _0xeffa5d=schema(properties[_0x34bd('0x59')])[_0x34bd('0x2')](_0x15fea7);if(_0xeffa5d[_0x34bd('0x56')]>0x0){return _0x50ed7f(_0x4f2091[_0x34bd('0xf')](0x1f4,_[_0x34bd('0x5a')](_0xeffa5d,_0x34bd('0x19'))[_0x34bd('0x1c')](',\x20')));}var _0x4a0c28=_['find'](_0x5846f3[_0x34bd('0x67')],{'uniqueid':_0x15fea7[_0x34bd('0x5b')]});if(_0x4a0c28){return BPromise[_0x34bd('0x68')]()[_0x34bd('0x18')](function(){if(_0x4a0c28[_0x34bd('0x69')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x4a0c28['channel'],'mixmonitorid':_0x15fea7['mixmonitorid']})[_0x34bd('0x1a')](function(_0x19fde8){});}})['then'](function(){if(_0x4a0c28[_0x34bd('0x6a')]){return ami[_0x34bd('0x17')]({'action':_0x34bd('0x6b'),'channel':_0x4a0c28['destinationchannel'],'mixmonitorid':_0x15fea7[_0x34bd('0x64')]})[_0x34bd('0x1a')](function(_0x2fac2a){});}})[_0x34bd('0x18')](function(_0x1d8e0f){var _0x26e763=_[_0x34bd('0x57')](_0x4a0c28[_0x34bd('0x5e')],{'mixmonitorid':_0x15fea7['mixmonitorid']});if(_0x26e763){_0x26e763['status']=_0x34bd('0x6c');}})['then'](function(){var _0x2959aa=util[_0x34bd('0x6')](_0x34bd('0x5c'),_0x15fea7['filename']||_0x15fea7['uniqueid'],_0x15fea7[_0x34bd('0x6')]||_0x34bd('0x6d'));var _0x3c2e61=_['find'](_0x4a0c28['monitors'],{'filename':_0x34bd('0x5f')+_0x2959aa[_0x34bd('0x60')]()});if(_0x3c2e61){_0x3c2e61[_0x34bd('0x65')]=_0x34bd('0x6c');}})[_0x34bd('0x18')](function(){_0x3fc297({'code':0xc8,'message':[_0x15fea7[_0x34bd('0x5b')],_0x34bd('0x6e')][_0x34bd('0x1c')]('\x20')});})[_0x34bd('0x1a')](function(_0x4f397f){_0x50ed7f(_0x4f2091['error'](0x1f5,[_0x15fea7[_0x34bd('0x5b')],_0x4f397f['message'][_0x34bd('0x60')]()][_0x34bd('0x1c')]('\x20')));});}else{return _0x50ed7f(_0x4f2091[_0x34bd('0xf')](0x1f5,_0x34bd('0x6f')));}});},'VoiceQueuesChannels':function(_0x4a5e55){return new Promise(function(_0x50ae2e,_0x3d60fa){var _0x2273af=_[_0x34bd('0x70')](_0x5846f3['queueChannels']);_0x50ae2e({'count':_0x2273af[_0x34bd('0x56')],'rows':_0x2273af});});},'VoiceQueuesChannel':function(_0x4832d5){var _0x3ec753=this;return new Promise(function(_0x35d9be,_0x171a14){var _0x55876d=schema(properties[_0x34bd('0x71')])['validate'](_0x4832d5);if(_0x55876d['length']>0x0){return _0x171a14(_0x3ec753[_0x34bd('0xf')](0x1f4,_[_0x34bd('0x5a')](_0x55876d,_0x34bd('0x19'))['join'](',\x20')));}var _0x3f909d=_[_0x34bd('0x57')](_0x5846f3[_0x34bd('0x72')],{'uniqueid':_0x4832d5['uniqueid']});if(_0x3f909d){_0x35d9be(_0x3f909d);}else{return _0x171a14(_0x3ec753[_0x34bd('0xf')](0x1f5,_0x34bd('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x385ab3){var _0x44fc41=this;return new Promise(function(_0x19ad93,_0xbb9b5d){if(ami[_0x34bd('0xe')]()==![]){return _0xbb9b5d(_0x44fc41[_0x34bd('0xf')](0x1f4,[config[_0x34bd('0x10')]['ip'],config[_0x34bd('0x10')][_0x34bd('0x11')],'ami\x20disconnected'][_0x34bd('0x1c')]('\x20')));}var _0x507806=schema(properties[_0x34bd('0x73')])['validate'](_0x385ab3);if(_0x507806[_0x34bd('0x56')]>0x0){return _0xbb9b5d(_0x44fc41[_0x34bd('0xf')](0x1f4,_[_0x34bd('0x5a')](_0x507806,_0x34bd('0x19'))[_0x34bd('0x1c')](',\x20')));}var _0x4556ce=_[_0x34bd('0x57')](_0x5846f3[_0x34bd('0x72')],{'uniqueid':_0x385ab3[_0x34bd('0x5b')]});if(_0x4556ce&&_0x4556ce[_0x34bd('0x69')]){return ami['Action']({'action':'Hangup','channel':_0x4556ce[_0x34bd('0x69')]})[_0x34bd('0x18')](function(_0xfc56a3){_0x19ad93({'code':0xc8,'message':[_0x385ab3['uniqueid'],_0xfc56a3['message']['toLowerCase']()][_0x34bd('0x1c')]('\x20')});})[_0x34bd('0x1a')](function(_0x438458){_0xbb9b5d(_0x44fc41[_0x34bd('0xf')](0x1f5,[_0x385ab3[_0x34bd('0x5b')],_0x438458['message'][_0x34bd('0x60')]()]['join']('\x20')));});}else{return _0xbb9b5d(_0x44fc41[_0x34bd('0xf')](0x1f5,_0x34bd('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x500a25){var _0x36ebad=this;return new Promise(function(_0x5df452,_0x242093){if(ami['isConnected']()==![]){return _0x242093(_0x36ebad[_0x34bd('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x34bd('0x10')][_0x34bd('0x11')],_0x34bd('0x1b')][_0x34bd('0x1c')]('\x20')));}var _0x2de8a0=schema(properties[_0x34bd('0x74')])[_0x34bd('0x2')](_0x500a25);if(_0x2de8a0[_0x34bd('0x56')]>0x0){return _0x242093(_0x36ebad['error'](0x1f4,_[_0x34bd('0x5a')](_0x2de8a0,_0x34bd('0x19'))[_0x34bd('0x1c')](',\x20')));}var _0x49d395=_['find'](_0x5846f3['queueChannels'],{'uniqueid':_0x500a25[_0x34bd('0x5b')]});if(_0x49d395&&_0x49d395[_0x34bd('0x69')]){return ami['Action']({'action':_0x34bd('0x75'),'channel':_0x49d395['channel'],'exten':_0x500a25[_0x34bd('0x76')],'context':_0x500a25[_0x34bd('0x77')]||_0x49d395[_0x34bd('0x77')],'priority':0x1})['then'](function(_0x474c2f){_0x5df452({'code':0xc8,'message':[_0x500a25['uniqueid'],_0x474c2f[_0x34bd('0x19')][_0x34bd('0x60')]()][_0x34bd('0x1c')]('\x20')});})[_0x34bd('0x1a')](function(_0x1fe8cc){_0x242093(_0x36ebad[_0x34bd('0xf')](0x1f5,[_0x500a25[_0x34bd('0x5b')],_0x1fe8cc[_0x34bd('0x19')][_0x34bd('0x60')]()][_0x34bd('0x1c')]('\x20')));});}else{return _0x242093(_0x36ebad[_0x34bd('0xf')](0x1f5,_0x34bd('0x6f')));}});},'Agents':function(_0x44c5d4){return new Promise(function(_0x48d9b9,_0x59c473){var _0x2c1b4f=_[_0x34bd('0x70')](_0x5846f3[_0x34bd('0xb')]);_0x48d9b9({'count':_0x2c1b4f[_0x34bd('0x56')],'rows':_0x2c1b4f});});},'Telephones':function(_0x36aca5){return new Promise(function(_0x49455c,_0x1799dd){var _0x1d4259=_[_0x34bd('0x70')](_0x5846f3[_0x34bd('0x78')]);_0x49455c({'count':_0x1d4259['length'],'rows':_0x1d4259});});},'Trunks':function(_0x2b838a){return new Promise(function(_0x572ac2,_0x5e329b){var _0x49ba99=_['values'](_0x5846f3[_0x34bd('0x79')]);_0x572ac2({'count':_0x49ba99[_0x34bd('0x56')],'rows':_0x49ba99});});},'OutboundChannels':function(_0x6ec278){return new Promise(function(_0x5c8e2e,_0x326888){var _0x21588f=_[_0x34bd('0x70')](_0x5846f3[_0x34bd('0x7a')]);_0x5c8e2e({'count':_0x21588f[_0x34bd('0x56')],'rows':_0x21588f});});},'Outbound':function(_0x1353b0){return new Promise(function(_0x4624fc,_0x5b0585){_0x4624fc(_0x5846f3[_0x34bd('0x2d')]);});},'Campaigns':function(_0x4456c5){return new Promise(function(_0x4451ef,_0x4be22a){var _0x5403fa=_[_0x34bd('0x70')](_0x5846f3['campaigns']);_0x4451ef({'count':_0x5403fa[_0x34bd('0x56')],'rows':_0x5403fa});});},'VoiceQueuesPreview':function(_0x384905){var _0x2e2ba1=this;return new Promise(function(_0x9f4df7,_0x22aa49){_0x2133c5[_0x34bd('0x7b')](_0x384905['id'])[_0x34bd('0x18')](function(_0xf45fee){_0x9f4df7({'code':0xc8,'message':_0xf45fee['message']});})[_0x34bd('0x1a')](function(_0x1ae798){_0x22aa49(_0x2e2ba1[_0x34bd('0xf')](0x1f4,_0x1ae798['message']));});});},'EventManager':function(_0x2b56eb){var _0x4022a0=this;return new Promise(function(_0xca91e2,_0x4502e6){if(!_0x2b56eb['event']){return _0x4502e6(_0x4022a0[_0x34bd('0xf')](0x1f4,_0x34bd('0x7c')));}ami[_0x34bd('0x7d')](_0x34bd('0x7e')+_0x2b56eb[_0x34bd('0x7f')],_0x2b56eb[_0x34bd('0x19')]);_0xca91e2({'code':0xc8,'message':_0x2b56eb});});},'FaxAccounts':function(_0x1203fc){return new Promise(function(_0x193f37,_0x15651a){var _0x3b95f6=_['values'](_0x5846f3[_0x34bd('0x80')]);_0x193f37({'count':_0x3b95f6[_0x34bd('0x56')],'rows':_0x3b95f6});});},'SendFax':function(_0x19d537){var _0x1e9839=this;return new Promise(function(_0x2f7caf,_0x38752d){_0x2a15a2[_0x34bd('0x81')](_0x19d537)[_0x34bd('0x18')](function(_0x199390){_0x2f7caf({'code':0xc8,'message':_0x199390[_0x34bd('0x19')]});})[_0x34bd('0x1a')](function(_0x1d735f){_0x38752d(_0x1e9839[_0x34bd('0xf')](0x1f4,_0x1d735f[_0x34bd('0x19')]));});});},'CheckAfterSend':function(_0x47a050){var _0x70c6a9=this;return new Promise(function(_0x545d68,_0x45ae98){_0x2a15a2[_0x34bd('0x82')](_0x47a050)[_0x34bd('0x18')](function(_0x24d607){_0x545d68({'code':0xc8,'message':_0x24d607[_0x34bd('0x19')]});})[_0x34bd('0x1a')](function(_0x334c57){_0x45ae98(_0x70c6a9[_0x34bd('0xf')](0x1f4,_0x334c57['message']));});});}};var _0x285f8a=jayson[_0x34bd('0x83')](_0x213716)[_0x34bd('0x84')]();_0x285f8a['on']('error',function(_0x4519eb){return _0x3e8744(_0x4519eb);});_0x285f8a[_0x34bd('0x5')](0x232a,_0x34bd('0x85'),function(){console[_0x34bd('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x5c2a7a(_0x34bd('0x87')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 0d06a33..7abc3c9 100644 --- a/server/services/ami/trigger/cmContact/index.js +++ b/server/services/ami/trigger/cmContact/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a19=['data1','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','updatedAt','resolve','getContacts','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','emit','exec'];(function(_0x2b0532,_0x279504){var _0x2b078e=function(_0x2df235){while(--_0x2df235){_0x2b0532['push'](_0x2b0532['shift']());}};_0x2b078e(++_0x279504);}(_0x9a19,0x114));var _0x99a1=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0x9a19[_0x5f519b];return _0x2461e2;};'use strict';var _=require(_0x99a1('0x0'));var BPromise=require(_0x99a1('0x1'));var Redis=require(_0x99a1('0x2'));var util=require('util');var config=require(_0x99a1('0x3'));var logger=require(_0x99a1('0x4'))(_0x99a1('0x5'));var cmContactRpc=require(_0x99a1('0x6'));config[_0x99a1('0x7')]=_[_0x99a1('0x8')](config[_0x99a1('0x7')],{'host':_0x99a1('0x9'),'port':0x18eb});var io=require(_0x99a1('0xa'))(new Redis(config[_0x99a1('0x7')]));function emit(_0x65045d,_0x523b9e,_0x4d2a5c,_0x5aa6c2,_0x56f50){logger[_0x99a1('0xb')]('[CM][%s][%s]',_0x65045d,_0x523b9e['id'],_0x4d2a5c,_0x5aa6c2,JSON['stringify'](_0x56f50));io['to'](_0x4d2a5c)[_0x99a1('0xc')](_0x5aa6c2,_0x56f50);}exports[_0x99a1('0xd')]=function(_0x23db53,_0x26473f,_0x1551a1,_0x537032){var _0x28ee99,_0xdd29e1;var _0x27d65f={};var _0x418dee=Number(_0x1551a1[_0x99a1('0xe')]);var _0x1bc7aa=_0x1551a1[_0x99a1('0xf')]?Boolean(Number(_0x1551a1[_0x99a1('0xf')])):![];var _0xf713b9;var _0x40c19c=![];if(!_[_0x99a1('0x10')](_0x1551a1[_0x99a1('0x11')])){if(_0x1551a1[_0x99a1('0x11')]=='1')_0x40c19c=!![];}if(!_0x40c19c){if(_0x537032[_0x99a1('0x12')]){_0x27d65f['id']=_0x537032[_0x99a1('0x12')];}}if(!_0x27d65f['id']){_0x27d65f['ListId']=_0x418dee;_0xf713b9=_0x1551a1[_0x99a1('0x13')]&&_0x1551a1[_0x99a1('0x13')]!=='0'?_0x1551a1[_0x99a1('0x13')][_0x99a1('0x14')](','):[_0x99a1('0x15')];_0x27d65f[_0x99a1('0x16')]=_[_0x99a1('0x17')](_0xf713b9,function(_0x4e645b){var _0x4f049c={};_0x4f049c[_0x4e645b]=_0x537032[_0x99a1('0x18')]?_0x537032[_0x99a1('0x19')]:_0x537032[_0x99a1('0x1a')];return _0x4f049c;});}var _0x1fcd00=['id',_0x99a1('0x1b'),_0x99a1('0x1c'),_0x99a1('0x15'),_0x99a1('0x1d'),_0x99a1('0x1e'),_0x99a1('0x1f'),_0x99a1('0x20'),'scheduledAt',_0x99a1('0x21')];var _0x20007e=_['union'](_0x1fcd00,_0xf713b9);BPromise[_0x99a1('0x22')]()['then'](cmContactRpc[_0x99a1('0x23')]({'attributes':_0x20007e,'where':_0x27d65f}))[_0x99a1('0x24')](function(_0x2d6f20){_0xdd29e1=_0x2d6f20;if(!_[_0x99a1('0x25')](_0xdd29e1)){if(_0xdd29e1['length']===0x1){_0x28ee99=_0xdd29e1[0x0];logger[_0x99a1('0xb')](_0x99a1('0x26'),_0x537032['uniqueid'],_0x26473f['id'],_0x28ee99['id']);}else{logger[_0x99a1('0xb')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x537032[_0x99a1('0x27')],_0x26473f['id'],_[_0x99a1('0x17')](_0xdd29e1,'id')[_0x99a1('0x28')](','));}return;}else{logger[_0x99a1('0xb')](_0x99a1('0x29'),_0x537032[_0x99a1('0x27')],_0x26473f['id']);var _0x4fe7f7={'ListId':_0x418dee};var _0x114b38=_0x1551a1['data4']&&_0x1551a1['data4']!=='0'?_0x1551a1[_0x99a1('0x2a')]:_0x99a1('0x15');if(_0x1bc7aa){logger[_0x99a1('0xb')](_0x99a1('0x2b'),_0x537032[_0x99a1('0x27')],_0x26473f['id']);_0x4fe7f7[_0x114b38]=_[_0x99a1('0x10')](_0x537032[_0x99a1('0x18')])?_0x537032['calleridnum']:_0x537032[_0x99a1('0x19')];if(_['isNil'](_0x537032[_0x99a1('0x18')])){_0x4fe7f7[_0x99a1('0x1b')]=_0x537032[_0x99a1('0x2c')]&&_0x537032['calleridname']!==_0x99a1('0x2d')?_0x537032[_0x99a1('0x2c')]:'Unknown';}else{_0x4fe7f7[_0x99a1('0x1b')]=_0x537032[_0x99a1('0x2e')]&&_0x537032[_0x99a1('0x2e')]!==_0x99a1('0x2d')?_0x537032[_0x99a1('0x2e')]:_0x99a1('0x2f');}return BPromise[_0x99a1('0x22')]()[_0x99a1('0x24')](cmContactRpc['createContact'](_0x4fe7f7))['then'](function(_0x3fa342){_0x28ee99=_0x3fa342;_0xdd29e1['push'](_0x3fa342);if(_0x28ee99){logger[_0x99a1('0xb')](_0x99a1('0x30'),_0x537032['uniqueid'],_0x26473f['id'],_0x28ee99['id']);}return;});}else{logger[_0x99a1('0xb')](_0x99a1('0x31'),_0x537032[_0x99a1('0x27')],_0x26473f['id']);_0x4fe7f7[_0x114b38]=_[_0x99a1('0x10')](_0x537032[_0x99a1('0x18')])?_0x537032[_0x99a1('0x1a')]:_0x537032[_0x99a1('0x19')];if(_[_0x99a1('0x10')](_0x537032[_0x99a1('0x18')])){_0x4fe7f7[_0x99a1('0x1b')]=_0x537032[_0x99a1('0x2c')]&&_0x537032[_0x99a1('0x2c')]!==_0x99a1('0x2d')?_0x537032[_0x99a1('0x2c')]:'Unknown';}else{_0x4fe7f7['firstName']=_0x537032[_0x99a1('0x2e')]&&_0x537032[_0x99a1('0x2e')]!==_0x99a1('0x2d')?_0x537032[_0x99a1('0x2e')]:_0x99a1('0x2f');}_0x28ee99=_0x4fe7f7;_0xdd29e1[_0x99a1('0x32')](_0x4fe7f7);return;}}})[_0x99a1('0x24')](function(){if(_0x23db53){emit(_0x537032['uniqueid'],_0x26473f,util[_0x99a1('0x33')](_0x99a1('0x34'),_0x23db53['name']),util[_0x99a1('0x33')](_0x99a1('0x35'),_0x1551a1[_0x99a1('0x36')][_0x99a1('0x37')]()),{'evt':_[_0x99a1('0x38')](_0x537032,{'autoCreate':_0x1bc7aa}),'contact':_0x28ee99===undefined?{}:_0x28ee99,'contacts':_0xdd29e1[_0x99a1('0x39')]===0x0?undefined:_0xdd29e1});}});}; \ No newline at end of file +var _0x81bd=['Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','createdAt','scheduledAt','union','resolve','then','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','','calleridname'];(function(_0x475e33,_0x42824a){var _0x318871=function(_0x54394c){while(--_0x54394c){_0x475e33['push'](_0x475e33['shift']());}};_0x318871(++_0x42824a);}(_0x81bd,0x7c));var _0xd81b=function(_0x11afe7,_0x2dcbae){_0x11afe7=_0x11afe7-0x0;var _0x2967b5=_0x81bd[_0x11afe7];return _0x2967b5;};'use strict';var _=require(_0xd81b('0x0'));var BPromise=require(_0xd81b('0x1'));var Redis=require(_0xd81b('0x2'));var util=require(_0xd81b('0x3'));var config=require(_0xd81b('0x4'));var logger=require(_0xd81b('0x5'))(_0xd81b('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0xd81b('0x7')]=_[_0xd81b('0x8')](config[_0xd81b('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd81b('0x9'))(new Redis(config[_0xd81b('0x7')]));function emit(_0x1f3f2c,_0x562084,_0x5e14e8,_0xa4cf97,_0x5468d5){logger[_0xd81b('0xa')](_0xd81b('0xb'),_0x1f3f2c,_0x562084['id'],_0x5e14e8,_0xa4cf97,JSON[_0xd81b('0xc')](_0x5468d5));io['to'](_0x5e14e8)[_0xd81b('0xd')](_0xa4cf97,_0x5468d5);}exports[_0xd81b('0xe')]=function(_0x1ff60f,_0x4391be,_0x17e09f,_0x2090e1){var _0x23c789,_0x215b92;var _0x3914f7={};var _0x1afb8f=Number(_0x17e09f['data1']);var _0x21dfff=_0x17e09f['data2']?Boolean(Number(_0x17e09f[_0xd81b('0xf')])):![];var _0xe75568;var _0x5f0b6b=![];if(!_[_0xd81b('0x10')](_0x17e09f['data5'])){if(_0x17e09f[_0xd81b('0x11')]=='1')_0x5f0b6b=!![];}if(!_0x5f0b6b){if(_0x2090e1[_0xd81b('0x12')]){_0x3914f7['id']=_0x2090e1[_0xd81b('0x12')];}}if(!_0x3914f7['id']){_0x3914f7[_0xd81b('0x13')]=_0x1afb8f;_0xe75568=_0x17e09f[_0xd81b('0x14')]&&_0x17e09f['data3']!=='0'?_0x17e09f[_0xd81b('0x14')][_0xd81b('0x15')](','):['phone'];_0x3914f7[_0xd81b('0x16')]=_[_0xd81b('0x17')](_0xe75568,function(_0x4657cf){var _0x15e860={};_0x15e860[_0x4657cf]=_0x2090e1[_0xd81b('0x18')]?_0x2090e1[_0xd81b('0x19')]:_0x2090e1[_0xd81b('0x1a')];return _0x15e860;});}var _0x3d4d34=['id',_0xd81b('0x1b'),_0xd81b('0x1c'),_0xd81b('0x1d'),_0xd81b('0x1e'),_0xd81b('0x1f'),_0xd81b('0x13'),_0xd81b('0x20'),_0xd81b('0x21'),'updatedAt'];var _0x4d566e=_[_0xd81b('0x22')](_0x3d4d34,_0xe75568);BPromise[_0xd81b('0x23')]()[_0xd81b('0x24')](cmContactRpc['getContacts']({'attributes':_0x4d566e,'where':_0x3914f7}))[_0xd81b('0x24')](function(_0x6571a6){_0x215b92=_0x6571a6;if(!_['isEmpty'](_0x215b92)){if(_0x215b92[_0xd81b('0x25')]===0x1){_0x23c789=_0x215b92[0x0];logger[_0xd81b('0xa')](_0xd81b('0x26'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id'],_0x23c789['id']);}else{logger[_0xd81b('0xa')](_0xd81b('0x28'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id'],_[_0xd81b('0x17')](_0x215b92,'id')[_0xd81b('0x29')](','));}return;}else{logger[_0xd81b('0xa')](_0xd81b('0x2a'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id']);var _0x596389={'ListId':_0x1afb8f};var _0x28768f=_0x17e09f[_0xd81b('0x2b')]&&_0x17e09f[_0xd81b('0x2b')]!=='0'?_0x17e09f[_0xd81b('0x2b')]:_0xd81b('0x1d');if(_0x21dfff){logger[_0xd81b('0xa')](_0xd81b('0x2c'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id']);_0x596389[_0x28768f]=_[_0xd81b('0x10')](_0x2090e1['routeId'])?_0x2090e1[_0xd81b('0x1a')]:_0x2090e1['destcalleridnum'];if(_['isNil'](_0x2090e1[_0xd81b('0x18')])){_0x596389[_0xd81b('0x1b')]=_0x2090e1['calleridname']&&_0x2090e1['calleridname']!==_0xd81b('0x2d')?_0x2090e1[_0xd81b('0x2e')]:_0xd81b('0x2f');}else{_0x596389[_0xd81b('0x1b')]=_0x2090e1[_0xd81b('0x30')]&&_0x2090e1[_0xd81b('0x30')]!==''?_0x2090e1[_0xd81b('0x30')]:_0xd81b('0x2f');}return BPromise['resolve']()['then'](cmContactRpc[_0xd81b('0x31')](_0x596389))[_0xd81b('0x24')](function(_0x50472a){_0x23c789=_0x50472a;_0x215b92['push'](_0x50472a);if(_0x23c789){logger['info'](_0xd81b('0x32'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id'],_0x23c789['id']);}return;});}else{logger[_0xd81b('0xa')](_0xd81b('0x33'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id']);_0x596389[_0x28768f]=_[_0xd81b('0x10')](_0x2090e1[_0xd81b('0x18')])?_0x2090e1['calleridnum']:_0x2090e1[_0xd81b('0x19')];if(_['isNil'](_0x2090e1[_0xd81b('0x18')])){_0x596389[_0xd81b('0x1b')]=_0x2090e1[_0xd81b('0x2e')]&&_0x2090e1[_0xd81b('0x2e')]!==_0xd81b('0x2d')?_0x2090e1[_0xd81b('0x2e')]:_0xd81b('0x2f');}else{_0x596389[_0xd81b('0x1b')]=_0x2090e1[_0xd81b('0x30')]&&_0x2090e1[_0xd81b('0x30')]!==_0xd81b('0x2d')?_0x2090e1[_0xd81b('0x30')]:_0xd81b('0x2f');}_0x23c789=_0x596389;_0x215b92['push'](_0x596389);return;}}})['then'](function(){if(_0x1ff60f){emit(_0x2090e1[_0xd81b('0x27')],_0x4391be,util[_0xd81b('0x34')](_0xd81b('0x35'),_0x1ff60f['name']),util[_0xd81b('0x34')](_0xd81b('0x36'),_0x17e09f['action'][_0xd81b('0x37')]()),{'evt':_[_0xd81b('0x38')](_0x2090e1,{'autoCreate':_0x21dfff}),'contact':_0x23c789===undefined?{}:_0x23c789,'contacts':_0x215b92['length']===0x0?undefined:_0x215b92});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 8d4b0b5..d561e7a 100644 --- a/server/services/ami/trigger/index.js +++ b/server/services/ami/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ba6=['bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:offlineMessage','prototype','info','stringify','clone','motionChannel','undefined','voice','checkTriggers','interface','status','checkTrigger','variables','length','action','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','location','uriLocation','data4','windowWidth','data5','800','data6','winApplication','winArguments','emit','format','user:%s','trigger:%s:%s','toLowerCase','merge','name','trigger:%s','exec','integration','queue','routeId','urlforward','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','created','equals','exports','util','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0x2ba6,0x1ea));var _0x62ba=function(_0x587eb1,_0x395488){_0x587eb1=_0x587eb1-0x0;var _0x82f69f=_0x2ba6[_0x587eb1];return _0x82f69f;};'use strict';var util=require(_0x62ba('0x0'));var _=require(_0x62ba('0x1'));var url=require(_0x62ba('0x2'));var Mustache=require(_0x62ba('0x3'));var Redis=require(_0x62ba('0x4'));var urlforward=require('./urlforward');var integration=require(_0x62ba('0x5'));var cmContact=require(_0x62ba('0x6'));var script=require(_0x62ba('0x7'));var config=require(_0x62ba('0x8'));var logger=require(_0x62ba('0x9'))(_0x62ba('0xa'));var ami=require('../ami');config[_0x62ba('0xb')]=_[_0x62ba('0xc')](config[_0x62ba('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x62ba('0xd'))(new Redis(config['redis']));var operators={'equals':function(_0xb60414,_0xc1cb24){return _0xb60414==_0xc1cb24;},'not_equals':function(_0x2bc3da,_0x15d2fa){return _0x2bc3da!=_0x15d2fa;}};var barAndWebActions=[_0x62ba('0xe'),_0x62ba('0x2'),_0x62ba('0xf')];function Trigger(_0x22c473){this[_0x62ba('0x10')]=_0x22c473['triggers'];this[_0x62ba('0x11')]=_0x22c473[_0x62ba('0x11')];this[_0x62ba('0x12')]=_0x22c473['voiceQueues'];this['templates']=_0x22c473[_0x62ba('0x13')];this[_0x62ba('0x14')]=_0x22c473[_0x62ba('0x14')];this[_0x62ba('0x15')]=_0x22c473[_0x62ba('0x15')];this[_0x62ba('0x16')]=_0x22c473[_0x62ba('0x16')];this[_0x62ba('0x17')]=_0x22c473[_0x62ba('0x17')];this[_0x62ba('0x18')]=_0x22c473[_0x62ba('0x18')];this[_0x62ba('0x19')]=_0x22c473['zohoAccounts'];this[_0x62ba('0x1a')]=_0x22c473[_0x62ba('0x1a')];this[_0x62ba('0x1b')]=_0x22c473[_0x62ba('0x1b')];this['servicenowAccounts']=_0x22c473[_0x62ba('0x1c')];this[_0x62ba('0x1d')]=_0x22c473[_0x62ba('0x1d')];this[_0x62ba('0x1e')]=_0x22c473[_0x62ba('0x1e')];this[_0x62ba('0x1f')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x62ba('0x17')],'freshdesk':this[_0x62ba('0x16')],'sugarcrm':this[_0x62ba('0x18')],'zoho':this[_0x62ba('0x19')],'desk':this[_0x62ba('0x1a')],'vtiger':this[_0x62ba('0x1b')],'dynamics365':this[_0x62ba('0x1d')],'freshsales':this[_0x62ba('0x1e')],'servicenow':this[_0x62ba('0x1c')]};ami['on'](_0x62ba('0x20'),this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on'](_0x62ba('0x23'),this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on'](_0x62ba('0x24'),this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on'](_0x62ba('0x25'),this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on'](_0x62ba('0x26'),this[_0x62ba('0x21')]['bind'](this));ami['on'](_0x62ba('0x27'),this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on'](_0x62ba('0x28'),this[_0x62ba('0x21')]['bind'](this));ami['on'](_0x62ba('0x29'),this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on']('custom:agentreject',this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on']('custom:amd',this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on'](_0x62ba('0x2a'),this['syncCustomEvent'][_0x62ba('0x22')](this));ami['on'](_0x62ba('0x2b'),this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on'](_0x62ba('0x2c'),this[_0x62ba('0x2d')]['bind'](this));ami['on'](_0x62ba('0x2e'),this[_0x62ba('0x2d')]['bind'](this));ami['on'](_0x62ba('0x2f'),this[_0x62ba('0x2d')][_0x62ba('0x22')](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0x62ba('0x22')](this));ami['on'](_0x62ba('0x30'),this['syncCustomEvent']['bind'](this));ami['on'](_0x62ba('0x31'),this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on'](_0x62ba('0x32'),this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on']('custom:outgoingmessage',this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on'](_0x62ba('0x33'),this[_0x62ba('0x21')][_0x62ba('0x22')](this));ami['on']('custom:rejectmessage',this[_0x62ba('0x21')]['bind'](this));ami['on'](_0x62ba('0x34'),this[_0x62ba('0x21')]['bind'](this));}Trigger[_0x62ba('0x35')]['emit']=function(_0xe225b2,_0x2cc332,_0x175ac7){logger[_0x62ba('0x36')](_0xe225b2,_0x2cc332,JSON[_0x62ba('0x37')](_0x175ac7));io['to'](_0xe225b2)['emit'](_0x2cc332,_0x175ac7);};Trigger['prototype'][_0x62ba('0x21')]=function(_0x319b5a){var _0x403fce=_[_0x62ba('0x38')](_0x319b5a);if(typeof _0x403fce[_0x62ba('0x39')]===_0x62ba('0x3a')){_0x403fce['motionChannel']=_0x62ba('0x3b');}this[_0x62ba('0x3c')](_0x403fce);};Trigger['prototype'][_0x62ba('0x2d')]=function(_0x3a1978){if(this[_0x62ba('0x11')][_0x3a1978[_0x62ba('0x3d')]]){this[_0x62ba('0x21')](_0x3a1978);}};Trigger[_0x62ba('0x35')][_0x62ba('0x3c')]=function(_0x2d0d44){var _0x583a37;for(var _0x97b5a0 in this[_0x62ba('0x10')]){if(this[_0x62ba('0x10')]['hasOwnProperty'](_0x97b5a0)){if(this[_0x62ba('0x10')][_0x97b5a0][_0x62ba('0x3e')]){_0x583a37=this[_0x62ba('0x3f')](this[_0x62ba('0x10')][_0x97b5a0],_0x2d0d44);if(_0x583a37){_['merge'](_0x2d0d44,_0x2d0d44[_0x62ba('0x40')]);for(var _0x12d4c7=0x0,_0x4b3179,_0x81857,_0x24df57;_0x12d4c70x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x5b8d0b,_0x45e40d){var _0x44995e=function(_0x3b658f){while(--_0x3b658f){_0x5b8d0b['push'](_0x5b8d0b['shift']());}};_0x44995e(++_0x45e40d);}(_0x3e74,0x175));var _0x43e7=function(_0x5e0808,_0x5bdbf6){_0x5e0808=_0x5e0808-0x0;var _0x3f219b=_0x3e74[_0x5e0808];return _0x3f219b;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 876534a..f95f68f 100644 --- a/server/services/ami/trigger/integration/dynamics365.js +++ b/server/services/ami/trigger/integration/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa236=['forEach','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incidents','assign','getString','Descriptions','/contacts(','/systemusers(','Fields','phonecall','queue','callDirection','phonecalls','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','then','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','4.0','headers','substring','lastIndexOf','enduserId','message','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!'];(function(_0x2ab648,_0x591316){var _0x3d6159=function(_0xa5161b){while(--_0xa5161b){_0x2ab648['push'](_0x2ab648['shift']());}};_0x3d6159(++_0x591316);}(_0xa236,0x1e4));var _0x6a23=function(_0xf69b44,_0x3c5946){_0xf69b44=_0xf69b44-0x0;var _0x2dc245=_0xa236[_0xf69b44];return _0x2dc245;};'use strict';var _=require(_0x6a23('0x0'));var rp=require(_0x6a23('0x1'));var util=require('util');var intUtil=require(_0x6a23('0x2'));var md5=require(_0x6a23('0x3'));var Redis=require(_0x6a23('0x4'));var logger=require(_0x6a23('0x5'))(_0x6a23('0x6'));var config=require('../../../../config/environment');config[_0x6a23('0x7')]=_[_0x6a23('0x8')](config[_0x6a23('0x7')],{'host':_0x6a23('0x9'),'port':0x18eb});var io=require(_0x6a23('0xa'))(new Redis(config[_0x6a23('0x7')]));function getAuthToken(_0x38ef95,_0x350b14,_0x1c4084){if(_0x38ef95[_0x6a23('0xb')]){_0x38ef95[_0x6a23('0xc')]=_0x38ef95[_0x6a23('0xd')][_0x6a23('0xe')];_0x38ef95[_0x6a23('0xf')]=_0x38ef95[_0x6a23('0xd')][_0x6a23('0x10')];return Promise[_0x6a23('0x11')](_0x38ef95[_0x6a23('0xd')][_0x6a23('0x12')]);}var _0x129770={'method':_0x6a23('0x13'),'uri':_0x350b14,'form':{'client_id':_0x38ef95[_0x6a23('0x14')],'resource':_0x38ef95[_0x6a23('0xc')],'username':_0x38ef95[_0x6a23('0x15')],'password':_0x38ef95[_0x6a23('0x16')],'grant_type':_0x6a23('0x16'),'client_secret':_0x38ef95['clientSecret']},'json':!![]};return rp(_0x129770)['then'](function(_0x38cfe3){return _0x38cfe3[_0x6a23('0x17')];})[_0x6a23('0x18')](function(_0x4b437d){logger['error']('['+[_0x1c4084[_0x6a23('0x19')]()]+_0x6a23('0x1a'));return _0x4b437d['message'];});}function getUser(_0x3394fe,_0x50afae,_0x450983,_0x4a9825,_0x164fc3,_0x8ee701){return new Promise(function(_0x24934c,_0x14679f){return getAuthToken(_0x50afae,_0x4a9825,_0x8ee701)['then'](function(_0x50216e){var _0x579aa1={'method':'GET','uri':_0x164fc3+_0x6a23('0x1b'),'headers':{'Authorization':_0x6a23('0x1c')+_0x50216e,'OData-Version':'4.0'},'json':!![]};return rp(_0x579aa1);})[_0x6a23('0x1d')](function(_0x225884){var _0x1bd598=_0x225884[_0x6a23('0x1e')];var _0x329559=![];var _0x47a754=null;if(!_[_0x6a23('0x1f')](_0x450983)){if(intUtil[_0x6a23('0x20')](_0x450983[_0x6a23('0x21')])){_0x3394fe['userEmail']=_0x450983['email'];for(_0x47a754=0x0;_0x47a754<_0x1bd598[_0x6a23('0x22')];_0x47a754++){if(_0x1bd598[_0x47a754][_0x6a23('0x23')]===_0x450983[_0x6a23('0x21')]&&!_0x1bd598[_0x47a754][_0x6a23('0x24')]){_0x329559=!![];logger[_0x6a23('0x25')]('['+[_0x8ee701[_0x6a23('0x19')]()]+_0x6a23('0x26')+_0x1bd598[_0x47a754]['systemuserid']+'!');_0x3394fe[_0x6a23('0x27')]=_0x1bd598[_0x47a754][_0x6a23('0x28')];}}}}if(!_0x329559){logger[_0x6a23('0x25')]('['+[_0x8ee701['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3394fe['userEmail']=_0x50afae[_0x6a23('0x15')];for(_0x47a754=0x0;_0x47a754<_0x1bd598[_0x6a23('0x22')];_0x47a754++){if(_0x1bd598[_0x47a754][_0x6a23('0x23')]===_0x50afae[_0x6a23('0x15')]){_0x3394fe[_0x6a23('0x27')]=_0x1bd598[_0x47a754]['systemuserid'];}}}_0x24934c(_0x3394fe);})['catch'](function(_0x23a4f4){_0x14679f(_0x23a4f4['message']);});});}function createEndUser(_0x5ebaaf,_0x2d9ab1,_0x2dadc9,_0x176853,_0x276040,_0x23203e){return new Promise(function(_0x53f735,_0x59f89a){return getAuthToken(_0x2d9ab1,_0x2dadc9,_0x23203e)[_0x6a23('0x1d')](function(_0x1d6446){var _0x5f45f7=_0x23203e[_0x6a23('0x29')]()===_0x6a23('0x2a')?_0x276040[_0x6a23('0x2b')]:_0x276040[_0x6a23('0x2c')];var _0x5de71c={'method':_0x6a23('0x13'),'uri':_0x176853+_0x6a23('0x2d'),'body':{'telephone1':_0x5f45f7,'fullname':_0x5f45f7,'firstname':_0x5f45f7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x5ebaaf[_0x6a23('0x27')]+')'},'headers':{'Authorization':_0x6a23('0x1c')+_0x1d6446,'OData-Version':_0x6a23('0x2e')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5de71c);})['then'](function(_0x1a3c12){var _0x2bcecd=_0x1a3c12[_0x6a23('0x2f')]['odata-entityid'];var _0x9ee247=_0x2bcecd[_0x6a23('0x30')](_0x2bcecd[_0x6a23('0x31')]('(')+0x1,_0x2bcecd['lastIndexOf'](')'));_0x5ebaaf[_0x6a23('0x32')]=_0x9ee247;_0x53f735(_0x5ebaaf);})[_0x6a23('0x18')](function(_0x41302a){_0x59f89a(_0x41302a[_0x6a23('0x33')]);});});}function getEndUser(_0x552b67,_0x26412a,_0x18468e,_0x5b6974,_0x16a2e5,_0x4597da,_0x5a06f2){var _0x5c62b2=_0x4597da[_0x6a23('0x29')]()===_0x6a23('0x2a')?_0x16a2e5[_0x6a23('0x2b')]:_0x16a2e5['calleridnum'];return getAuthToken(_0x26412a,_0x18468e,_0x4597da)[_0x6a23('0x1d')](function(_0x1cc0af){var _0x4058a4={'method':_0x6a23('0x34'),'uri':_0x5b6974+_0x6a23('0x35')+_0x5c62b2[_0x6a23('0x36')]('+',_0x6a23('0x37'))+'\x27','headers':{'Authorization':_0x6a23('0x1c')+_0x1cc0af,'If-None-Match':null,'OData-Version':_0x6a23('0x2e')},'json':!![]};return rp(_0x4058a4);})[_0x6a23('0x1d')](function(_0x1aee5f){var _0x479e66=![];if(!_0x1aee5f)return _0x479e66;var _0x34d305=_0x1aee5f[_0x6a23('0x1e')];for(var _0x10ac26=0x0;_0x10ac26<_0x34d305[_0x6a23('0x22')];_0x10ac26++){if(_0x34d305[_0x10ac26][_0x6a23('0x38')]===_0x5c62b2){_0x479e66=!![];_0x552b67['enduserId']=_0x34d305[_0x10ac26][_0x6a23('0x39')];}}return _0x479e66;})['then'](function(_0x525c0c){if(_0x525c0c)return _0x552b67;if(_0x5a06f2===_0x6a23('0x3a')){logger[_0x6a23('0x25')]('['+[_0x4597da[_0x6a23('0x19')]()]+_0x6a23('0x3b'));return _0x552b67;}return createEndUser(_0x552b67,_0x26412a,_0x18468e,_0x5b6974,_0x16a2e5,_0x4597da)[_0x6a23('0x1d')](function(_0x5ef7f1){logger[_0x6a23('0x25')]('['+[_0x4597da[_0x6a23('0x19')]()]+_0x6a23('0x3c'),_0x5ef7f1[_0x6a23('0x32')]);return _0x5ef7f1;});});}function getCustomFields(_0x5a387c,_0x4c06c0,_0x63461){var _0x4ccfff={};if(_0x5a387c[_0x6a23('0x22')]>0x0){_[_0x6a23('0x3d')](_0x5a387c,function(_0x274bf6){if(_[_0x6a23('0x3e')]([_0x6a23('0x3f'),_0x6a23('0x40')],_0x274bf6[_0x6a23('0x41')])&&_0x274bf6[_0x6a23('0x42')]&&!_0x274bf6['customField']){var _0x3b8e84=_0x274bf6[_0x6a23('0x43')][_0x6a23('0x29')]();var _0x31a9c3=_0x3b8e84[_0x6a23('0x30')](0x0,_0x3b8e84['indexOf']('_'));var _0x365d8f=_0x3b8e84['substring'](_0x3b8e84[_0x6a23('0x44')]('_')+0x1);if(_0x31a9c3===_0x63461){_0x4ccfff[_0x365d8f]=_0x274bf6[_0x6a23('0x45')];}}});}return _0x4ccfff;}function getTicket(_0x4e8fbe,_0x2292bd,_0x2ff62f,_0x19fce7,_0x5b608b,_0x1530a7,_0x21d233){return new Promise(function(_0x22dfc5,_0x4acd1e){var _0xc0304;return getAuthToken(_0x2292bd,_0x2ff62f,_0x21d233)[_0x6a23('0x1d')](function(_0x289e14){if(_0x1530a7[_0x6a23('0x46')]==='incident'){_0xc0304={'method':_0x6a23('0x13'),'uri':_0x19fce7+_0x6a23('0x47'),'body':Object[_0x6a23('0x48')]({},{'title':intUtil[_0x6a23('0x49')](_0x1530a7['Subjects'],_0x5b608b,'\x20'),'description':intUtil[_0x6a23('0x49')](_0x1530a7[_0x6a23('0x4a')],_0x5b608b,'\x0a'),'customerid_contact@odata.bind':_0x4e8fbe[_0x6a23('0x32')]?_0x6a23('0x4b')+_0x4e8fbe['enduserId']+')':undefined,'ownerid@odata.bind':_0x6a23('0x4c')+_0x4e8fbe[_0x6a23('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x1530a7[_0x6a23('0x4d')],_0x5b608b,_0x1530a7[_0x6a23('0x46')])),'headers':{'Authorization':_0x6a23('0x1c')+_0x289e14,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1530a7['ticketType']===_0x6a23('0x4e')){var _0x173616=_0x4e8fbe[_0x6a23('0x32')]?[{'partyid_systemuser@odata.bind':_0x6a23('0x4c')+_0x4e8fbe[_0x6a23('0x27')]+')','participationtypemask':_0x4e8fbe['callDirection']===_0x6a23('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x6a23('0x4b')+_0x4e8fbe[_0x6a23('0x32')]+')','participationtypemask':_0x4e8fbe['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x6a23('0x4c')+_0x4e8fbe[_0x6a23('0x27')]+')','participationtypemask':_0x4e8fbe[_0x6a23('0x50')]===_0x6a23('0x4f')?0x2:0x1}];_0xc0304={'method':'POST','uri':_0x19fce7+_0x6a23('0x51'),'body':Object[_0x6a23('0x48')]({},{'subject':intUtil[_0x6a23('0x49')](_0x1530a7['Subjects'],_0x5b608b,'\x20'),'phonenumber':String(_0x5b608b[_0x6a23('0x2c')]),'description':intUtil[_0x6a23('0x49')](_0x1530a7['Descriptions'],_0x5b608b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4e8fbe[_0x6a23('0x32')]?'/contacts('+_0x4e8fbe['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4e8fbe[_0x6a23('0x27')]+')','directioncode':_0x4e8fbe['callDirection']===_0x6a23('0x4f')?![]:!![],'phonecall_activity_parties':_0x173616},getCustomFields(_0x1530a7['Fields'],_0x5b608b,_0x1530a7['ticketType'])),'headers':{'Authorization':_0x6a23('0x1c')+_0x289e14,'OData-Version':_0x6a23('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xc0304);})[_0x6a23('0x1d')](function(_0x40bdce){var _0x448910=_0x40bdce[_0x6a23('0x2f')]['odata-entityid'];var _0x39d7f6=_0x448910[_0x6a23('0x30')](_0x448910[_0x6a23('0x31')]('(')+0x1,_0x448910['lastIndexOf'](')'));_0x4e8fbe[_0x6a23('0x52')]=_0x39d7f6;_0x22dfc5(_0x4e8fbe);})[_0x6a23('0x18')](function(_0x8dbadc){_0x4acd1e(_0x8dbadc['message']);});});}function emit(_0x17c2dc,_0x35b60a,_0x2e944b,_0x45fb0a){var _0x480dae={'uri':util['format'](_0x6a23('0x53'),_0x17c2dc,_0x2e944b,_0x45fb0a)};io['to'](util[_0x6a23('0x54')](_0x6a23('0x55'),_0x35b60a))[_0x6a23('0x56')](_0x6a23('0x57'),_0x480dae);}exports['cs']=function(_0x50dcaf,_0x1f97a2,_0x503099,_0x305222,_0x43fa24,_0x271922,_0x4ea9a3,_0x4815ec){var _0x598ce6={};_0x271922['remoteUri']=_0x271922['modernAuthentication']?intUtil['stripTrailingSlash'](_0x271922[_0x6a23('0xd')]['data7']):intUtil[_0x6a23('0x58')](_0x271922[_0x6a23('0xc')]);_0x271922[_0x6a23('0x59')]=intUtil[_0x6a23('0x58')](_0x271922[_0x6a23('0x59')]);_0x598ce6[_0x6a23('0x50')]=_0x4815ec==='queue'||_0x4815ec===_0x6a23('0x5a')?_0x6a23('0x4f'):_0x6a23('0x2a');var _0xdc173c=_0x271922['modernAuthentication']?util['format'](_0x6a23('0x5b'),_0x271922['CloudProvider'][_0x6a23('0xe')]):util[_0x6a23('0x54')](_0x6a23('0x5b'),_0x271922[_0x6a23('0xc')]);var _0x3b890b=util['format'](_0x6a23('0x5c'),_0x271922[_0x6a23('0xf')]);var _0x2a9e17=util[_0x6a23('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x271922[_0x6a23('0x59')],_0x1f97a2['uniqueid'],md5(_0x1f97a2[_0x6a23('0x5d')]));if(_0x43fa24&&_0x43fa24['monitor_format']){logger['info'](_0x6a23('0x5e'),_0x6a23('0x5f'));_0x1f97a2[_0x6a23('0x60')]=_0x2a9e17;}else if(_0x4ea9a3&&_0x4ea9a3[_0x6a23('0x61')]&&_0x4ea9a3['recordingFormat']!==_0x6a23('0x62')){logger['info'](_0x6a23('0x63'),_0x6a23('0x5f'));_0x1f97a2['recordingURL']=_0x2a9e17;}else{_0x1f97a2[_0x6a23('0x60')]='';}return getUser(_0x598ce6,_0x271922,_0x305222,_0x3b890b,_0xdc173c,_0x4815ec)[_0x6a23('0x1d')](function(_0x1dc9af){logger[_0x6a23('0x25')]('['+_0x4815ec[_0x6a23('0x19')]()+_0x6a23('0x64'),_0x1dc9af[_0x6a23('0x27')]);logger[_0x6a23('0x25')]('['+_0x4815ec[_0x6a23('0x19')]()+_0x6a23('0x65'),_0x1dc9af[_0x6a23('0x66')]);return getEndUser(_0x1dc9af,_0x271922,_0x3b890b,_0xdc173c,_0x1f97a2,_0x4815ec,_0x503099['moduleCreate']);})[_0x6a23('0x1d')](function(_0x5fb0c){logger[_0x6a23('0x25')]('['+_0x4815ec[_0x6a23('0x19')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x5fb0c[_0x6a23('0x32')]);logger[_0x6a23('0x25')]('['+_0x4815ec[_0x6a23('0x19')]()+_0x6a23('0x67'),_0x1f97a2['calleridnum']);return getTicket(_0x5fb0c,_0x271922,_0x3b890b,_0xdc173c,_0x1f97a2,_0x503099,_0x4815ec);})[_0x6a23('0x1d')](function(_0x3f892f){logger[_0x6a23('0x25')](util[_0x6a23('0x54')]('['+_0x4815ec[_0x6a23('0x19')]()+_0x6a23('0x68'),_0x503099[_0x6a23('0x46')],_0x3f892f[_0x6a23('0x52')]));logger[_0x6a23('0x25')](util['format']('['+_0x4815ec['toUpperCase']()+_0x6a23('0x69'),_0x4815ec));if(_0x4815ec!==_0x6a23('0x5a')){logger['info']('['+_0x4815ec[_0x6a23('0x19')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x271922[_0x6a23('0xc')],_0x305222[_0x6a23('0x6a')],_0x503099[_0x6a23('0x46')],_0x3f892f['ticketId']);}})[_0x6a23('0x18')](function(_0x43469c){logger[_0x6a23('0x6b')]('['+_0x4815ec[_0x6a23('0x19')]()+_0x6a23('0x6c'),_0x43469c[_0x6a23('0x33')]);});}; \ No newline at end of file +var _0xfa56=['../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','resolve','data5','POST','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','isNil','validateEmail','email','userEmail','length','isdisabled','info','systemuserid','userId','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Fields','phonecall','callDirection','queue','phonecalls','Subjects','Descriptions','headers','ticketId','format','user:%s','emit','trigger:browser:url','data7','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','md5','ioredis','../../../../config/logger','dynamics365'];(function(_0x56de00,_0xd08a91){var _0x1d6ce5=function(_0x109911){while(--_0x109911){_0x56de00['push'](_0x56de00['shift']());}};_0x1d6ce5(++_0xd08a91);}(_0xfa56,0x19a));var _0x6fa5=function(_0x3f9f54,_0x4a5fa5){_0x3f9f54=_0x3f9f54-0x0;var _0x3de22b=_0xfa56[_0x3f9f54];return _0x3de22b;};'use strict';var _=require(_0x6fa5('0x0'));var rp=require('request-promise');var util=require(_0x6fa5('0x1'));var intUtil=require('./util');var md5=require(_0x6fa5('0x2'));var Redis=require(_0x6fa5('0x3'));var logger=require(_0x6fa5('0x4'))(_0x6fa5('0x5'));var config=require(_0x6fa5('0x6'));config[_0x6fa5('0x7')]=_[_0x6fa5('0x8')](config[_0x6fa5('0x7')],{'host':_0x6fa5('0x9'),'port':0x18eb});var io=require(_0x6fa5('0xa'))(new Redis(config['redis']));function getAuthToken(_0x5b0132,_0x862094,_0x4f0b2a){if(_0x5b0132[_0x6fa5('0xb')]){_0x5b0132[_0x6fa5('0xc')]=_0x5b0132[_0x6fa5('0xd')]['data7'];_0x5b0132['tenantId']=_0x5b0132[_0x6fa5('0xd')]['data2'];return Promise[_0x6fa5('0xe')](_0x5b0132[_0x6fa5('0xd')][_0x6fa5('0xf')]);}var _0x572566={'method':_0x6fa5('0x10'),'uri':_0x862094,'form':{'client_id':_0x5b0132['clientId'],'resource':_0x5b0132[_0x6fa5('0xc')],'username':_0x5b0132[_0x6fa5('0x11')],'password':_0x5b0132[_0x6fa5('0x12')],'grant_type':'password','client_secret':_0x5b0132[_0x6fa5('0x13')]},'json':!![]};return rp(_0x572566)['then'](function(_0x40f2fc){return _0x40f2fc[_0x6fa5('0x14')];})['catch'](function(_0xb7f061){logger[_0x6fa5('0x15')]('['+[_0x4f0b2a[_0x6fa5('0x16')]()]+_0x6fa5('0x17'));return _0xb7f061[_0x6fa5('0x18')];});}function getUser(_0x4acb63,_0x21db1a,_0x5d6851,_0x4a50d7,_0xf795a7,_0x52330f){return new Promise(function(_0x5331e7,_0x21ec8c){return getAuthToken(_0x21db1a,_0x4a50d7,_0x52330f)['then'](function(_0x438816){var _0x1a89c8={'method':_0x6fa5('0x19'),'uri':_0xf795a7+_0x6fa5('0x1a'),'headers':{'Authorization':_0x6fa5('0x1b')+_0x438816,'OData-Version':_0x6fa5('0x1c')},'json':!![]};return rp(_0x1a89c8);})[_0x6fa5('0x1d')](function(_0x488988){var _0x13e1a2=_0x488988[_0x6fa5('0x1e')];var _0x5a070f=![];var _0x57be40=null;if(!_[_0x6fa5('0x1f')](_0x5d6851)){if(intUtil[_0x6fa5('0x20')](_0x5d6851[_0x6fa5('0x21')])){_0x4acb63[_0x6fa5('0x22')]=_0x5d6851[_0x6fa5('0x21')];for(_0x57be40=0x0;_0x57be40<_0x13e1a2[_0x6fa5('0x23')];_0x57be40++){if(_0x13e1a2[_0x57be40]['internalemailaddress']===_0x5d6851[_0x6fa5('0x21')]&&!_0x13e1a2[_0x57be40][_0x6fa5('0x24')]){_0x5a070f=!![];logger[_0x6fa5('0x25')]('['+[_0x52330f[_0x6fa5('0x16')]()]+']\x20Agent\x20found\x20'+_0x13e1a2[_0x57be40][_0x6fa5('0x26')]+'!');_0x4acb63['userId']=_0x13e1a2[_0x57be40][_0x6fa5('0x26')];}}}}if(!_0x5a070f){logger[_0x6fa5('0x25')]('['+[_0x52330f[_0x6fa5('0x16')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4acb63[_0x6fa5('0x22')]=_0x21db1a[_0x6fa5('0x11')];for(_0x57be40=0x0;_0x57be40<_0x13e1a2[_0x6fa5('0x23')];_0x57be40++){if(_0x13e1a2[_0x57be40]['internalemailaddress']===_0x21db1a[_0x6fa5('0x11')]){_0x4acb63[_0x6fa5('0x27')]=_0x13e1a2[_0x57be40][_0x6fa5('0x26')];}}}_0x5331e7(_0x4acb63);})[_0x6fa5('0x28')](function(_0x1f93bf){_0x21ec8c(_0x1f93bf[_0x6fa5('0x18')]);});});}function createEndUser(_0x5a6580,_0x5b5b97,_0x119c06,_0x4f7e2f,_0x4eb2c,_0x224637){return new Promise(function(_0x185cce,_0x5ac94b){return getAuthToken(_0x5b5b97,_0x119c06,_0x224637)['then'](function(_0x149ab8){var _0x35e485=_0x224637[_0x6fa5('0x29')]()===_0x6fa5('0x2a')?_0x4eb2c[_0x6fa5('0x2b')]:_0x4eb2c[_0x6fa5('0x2c')];var _0x59e7cc={'method':_0x6fa5('0x10'),'uri':_0x4f7e2f+_0x6fa5('0x2d'),'body':{'telephone1':_0x35e485,'fullname':_0x35e485,'firstname':_0x35e485,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6fa5('0x2e')+_0x5a6580[_0x6fa5('0x27')]+')'},'headers':{'Authorization':_0x6fa5('0x1b')+_0x149ab8,'OData-Version':_0x6fa5('0x1c')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x59e7cc);})[_0x6fa5('0x1d')](function(_0x5c1b98){var _0x552da1=_0x5c1b98['headers']['odata-entityid'];var _0x372af2=_0x552da1[_0x6fa5('0x2f')](_0x552da1[_0x6fa5('0x30')]('(')+0x1,_0x552da1['lastIndexOf'](')'));_0x5a6580[_0x6fa5('0x31')]=_0x372af2;_0x185cce(_0x5a6580);})[_0x6fa5('0x28')](function(_0x74cf4c){_0x5ac94b(_0x74cf4c[_0x6fa5('0x18')]);});});}function getEndUser(_0x2d71c8,_0x97c747,_0x5dd5e1,_0x542c68,_0x191b16,_0x365bd8,_0x375de9){var _0x186378=_0x365bd8[_0x6fa5('0x29')]()===_0x6fa5('0x2a')?_0x191b16['destcalleridnum']:_0x191b16[_0x6fa5('0x2c')];return getAuthToken(_0x97c747,_0x5dd5e1,_0x365bd8)['then'](function(_0x296798){var _0x4d87c0={'method':_0x6fa5('0x19'),'uri':_0x542c68+_0x6fa5('0x32')+_0x186378[_0x6fa5('0x33')]('+',_0x6fa5('0x34'))+'\x27','headers':{'Authorization':_0x6fa5('0x1b')+_0x296798,'If-None-Match':null,'OData-Version':_0x6fa5('0x1c')},'json':!![]};return rp(_0x4d87c0);})[_0x6fa5('0x1d')](function(_0xcd38a1){var _0x31314d=![];if(!_0xcd38a1)return _0x31314d;var _0x3be4d2=_0xcd38a1[_0x6fa5('0x1e')];for(var _0x108c98=0x0;_0x108c98<_0x3be4d2[_0x6fa5('0x23')];_0x108c98++){if(_0x3be4d2[_0x108c98]['telephone1']===_0x186378){_0x31314d=!![];_0x2d71c8[_0x6fa5('0x31')]=_0x3be4d2[_0x108c98][_0x6fa5('0x35')];}}return _0x31314d;})['then'](function(_0x450c00){if(_0x450c00)return _0x2d71c8;if(_0x375de9==='nothing'){logger[_0x6fa5('0x25')]('['+[_0x365bd8[_0x6fa5('0x16')]()]+_0x6fa5('0x36'));return _0x2d71c8;}return createEndUser(_0x2d71c8,_0x97c747,_0x5dd5e1,_0x542c68,_0x191b16,_0x365bd8)[_0x6fa5('0x1d')](function(_0x490492){logger[_0x6fa5('0x25')]('['+[_0x365bd8[_0x6fa5('0x16')]()]+_0x6fa5('0x37'),_0x490492[_0x6fa5('0x31')]);return _0x490492;});});}function getCustomFields(_0x2f8086,_0x1e9df2,_0xc23625){var _0x2e01b1={};if(_0x2f8086[_0x6fa5('0x23')]>0x0){_[_0x6fa5('0x38')](_0x2f8086,function(_0x45e78e){if(_[_0x6fa5('0x39')]([_0x6fa5('0x3a'),'picklist'],_0x45e78e[_0x6fa5('0x3b')])&&_0x45e78e[_0x6fa5('0x3c')]&&!_0x45e78e[_0x6fa5('0x3d')]){var _0x37587a=_0x45e78e[_0x6fa5('0x3e')][_0x6fa5('0x29')]();var _0x367ef9=_0x37587a[_0x6fa5('0x2f')](0x0,_0x37587a[_0x6fa5('0x3f')]('_'));var _0x5eefc6=_0x37587a['substring'](_0x37587a['indexOf']('_')+0x1);if(_0x367ef9===_0xc23625){_0x2e01b1[_0x5eefc6]=_0x45e78e[_0x6fa5('0x40')];}}});}return _0x2e01b1;}function getTicket(_0x56d73d,_0x47bee0,_0x46cb4,_0x523fb7,_0x5d5dc3,_0x531972,_0x4c5866){return new Promise(function(_0x3e6b38,_0x23ddc6){var _0x296d9c;return getAuthToken(_0x47bee0,_0x46cb4,_0x4c5866)[_0x6fa5('0x1d')](function(_0x201b70){if(_0x531972[_0x6fa5('0x41')]===_0x6fa5('0x42')){_0x296d9c={'method':_0x6fa5('0x10'),'uri':_0x523fb7+_0x6fa5('0x43'),'body':Object[_0x6fa5('0x44')]({},{'title':intUtil[_0x6fa5('0x45')](_0x531972['Subjects'],_0x5d5dc3,'\x20'),'description':intUtil['getString'](_0x531972['Descriptions'],_0x5d5dc3,'\x0a'),'customerid_contact@odata.bind':_0x56d73d[_0x6fa5('0x31')]?'/contacts('+_0x56d73d[_0x6fa5('0x31')]+')':undefined,'ownerid@odata.bind':_0x6fa5('0x2e')+_0x56d73d['userId']+')','caseorigincode':'1'},getCustomFields(_0x531972[_0x6fa5('0x46')],_0x5d5dc3,_0x531972['ticketType'])),'headers':{'Authorization':_0x6fa5('0x1b')+_0x201b70,'OData-Version':_0x6fa5('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x531972[_0x6fa5('0x41')]===_0x6fa5('0x47')){var _0x4814db=_0x56d73d[_0x6fa5('0x31')]?[{'partyid_systemuser@odata.bind':_0x6fa5('0x2e')+_0x56d73d[_0x6fa5('0x27')]+')','participationtypemask':_0x56d73d[_0x6fa5('0x48')]===_0x6fa5('0x49')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x56d73d[_0x6fa5('0x31')]+')','participationtypemask':_0x56d73d[_0x6fa5('0x48')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x6fa5('0x2e')+_0x56d73d[_0x6fa5('0x27')]+')','participationtypemask':_0x56d73d[_0x6fa5('0x48')]===_0x6fa5('0x49')?0x2:0x1}];_0x296d9c={'method':'POST','uri':_0x523fb7+_0x6fa5('0x4a'),'body':Object[_0x6fa5('0x44')]({},{'subject':intUtil['getString'](_0x531972[_0x6fa5('0x4b')],_0x5d5dc3,'\x20'),'phonenumber':String(_0x5d5dc3[_0x6fa5('0x2c')]),'description':intUtil[_0x6fa5('0x45')](_0x531972[_0x6fa5('0x4c')],_0x5d5dc3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x56d73d['enduserId']?'/contacts('+_0x56d73d[_0x6fa5('0x31')]+')':undefined,'ownerid@odata.bind':_0x6fa5('0x2e')+_0x56d73d['userId']+')','directioncode':_0x56d73d[_0x6fa5('0x48')]==='queue'?![]:!![],'phonecall_activity_parties':_0x4814db},getCustomFields(_0x531972[_0x6fa5('0x46')],_0x5d5dc3,_0x531972[_0x6fa5('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x201b70,'OData-Version':_0x6fa5('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x296d9c);})['then'](function(_0x105fb2){var _0x3510c0=_0x105fb2[_0x6fa5('0x4d')]['odata-entityid'];var _0x5c2d00=_0x3510c0[_0x6fa5('0x2f')](_0x3510c0[_0x6fa5('0x30')]('(')+0x1,_0x3510c0[_0x6fa5('0x30')](')'));_0x56d73d[_0x6fa5('0x4e')]=_0x5c2d00;_0x3e6b38(_0x56d73d);})['catch'](function(_0x4674d1){_0x23ddc6(_0x4674d1[_0x6fa5('0x18')]);});});}function emit(_0x530079,_0x3e72ff,_0x2a8ba2,_0x2eb67c){var _0x1e9390={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x530079,_0x2a8ba2,_0x2eb67c)};io['to'](util[_0x6fa5('0x4f')](_0x6fa5('0x50'),_0x3e72ff))[_0x6fa5('0x51')](_0x6fa5('0x52'),_0x1e9390);}exports['cs']=function(_0x36db02,_0x583bce,_0x12488b,_0x49e4aa,_0x2e37ee,_0x2706ca,_0x39888e,_0x1679eb){var _0x14f7c7={};_0x2706ca[_0x6fa5('0xc')]=_0x2706ca[_0x6fa5('0xb')]?intUtil['stripTrailingSlash'](_0x2706ca[_0x6fa5('0xd')][_0x6fa5('0x53')]):intUtil['stripTrailingSlash'](_0x2706ca[_0x6fa5('0xc')]);_0x2706ca[_0x6fa5('0x54')]=intUtil[_0x6fa5('0x55')](_0x2706ca[_0x6fa5('0x54')]);_0x14f7c7[_0x6fa5('0x48')]=_0x1679eb==='queue'||_0x1679eb===_0x6fa5('0x56')?'queue':_0x6fa5('0x2a');var _0x3f45b0=_0x2706ca[_0x6fa5('0xb')]?util[_0x6fa5('0x4f')](_0x6fa5('0x57'),_0x2706ca[_0x6fa5('0xd')][_0x6fa5('0x53')]):util[_0x6fa5('0x4f')](_0x6fa5('0x57'),_0x2706ca[_0x6fa5('0xc')]);var _0x4c3505=util[_0x6fa5('0x4f')](_0x6fa5('0x58'),_0x2706ca[_0x6fa5('0x59')]);var _0xf6b4b5=util[_0x6fa5('0x4f')](_0x6fa5('0x5a'),_0x2706ca[_0x6fa5('0x54')],_0x583bce[_0x6fa5('0x5b')],md5(_0x583bce[_0x6fa5('0x5b')]));if(_0x2e37ee&&_0x2e37ee[_0x6fa5('0x5c')]){logger[_0x6fa5('0x25')](_0x6fa5('0x5d'),_0x6fa5('0x5e'));_0x583bce[_0x6fa5('0x5f')]=_0xf6b4b5;}else if(_0x39888e&&_0x39888e['recordingFormat']&&_0x39888e[_0x6fa5('0x60')]!==_0x6fa5('0x61')){logger['info']('[OUTBOUND]',_0x6fa5('0x5e'));_0x583bce['recordingURL']=_0xf6b4b5;}else{_0x583bce[_0x6fa5('0x5f')]='';}return getUser(_0x14f7c7,_0x2706ca,_0x49e4aa,_0x4c3505,_0x3f45b0,_0x1679eb)[_0x6fa5('0x1d')](function(_0x285a91){logger['info']('['+_0x1679eb['toUpperCase']()+_0x6fa5('0x62'),_0x285a91['userId']);logger[_0x6fa5('0x25')]('['+_0x1679eb[_0x6fa5('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x285a91[_0x6fa5('0x22')]);return getEndUser(_0x285a91,_0x2706ca,_0x4c3505,_0x3f45b0,_0x583bce,_0x1679eb,_0x12488b['moduleCreate']);})[_0x6fa5('0x1d')](function(_0x1ad120){logger[_0x6fa5('0x25')]('['+_0x1679eb[_0x6fa5('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x1ad120[_0x6fa5('0x31')]);logger[_0x6fa5('0x25')]('['+_0x1679eb[_0x6fa5('0x16')]()+_0x6fa5('0x63'),_0x583bce[_0x6fa5('0x2c')]);return getTicket(_0x1ad120,_0x2706ca,_0x4c3505,_0x3f45b0,_0x583bce,_0x12488b,_0x1679eb);})[_0x6fa5('0x1d')](function(_0x1c0e2c){logger[_0x6fa5('0x25')](util[_0x6fa5('0x4f')]('['+_0x1679eb[_0x6fa5('0x16')]()+_0x6fa5('0x64'),_0x12488b[_0x6fa5('0x41')],_0x1c0e2c[_0x6fa5('0x4e')]));logger[_0x6fa5('0x25')](util[_0x6fa5('0x4f')]('['+_0x1679eb['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x1679eb));if(_0x1679eb!==_0x6fa5('0x56')){logger[_0x6fa5('0x25')]('['+_0x1679eb[_0x6fa5('0x16')]()+']',_0x6fa5('0x65'));emit(_0x2706ca[_0x6fa5('0xc')],_0x49e4aa[_0x6fa5('0x66')],_0x12488b['ticketType'],_0x1c0e2c['ticketId']);}})[_0x6fa5('0x28')](function(_0x4d007b){logger[_0x6fa5('0x15')]('['+_0x1679eb[_0x6fa5('0x16')]()+_0x6fa5('0x67'),_0x4d007b[_0x6fa5('0x18')]);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 1313bed..f1ccf2c 100644 --- a/server/services/ami/trigger/integration/freshdesk.js +++ b/server/services/ami/trigger/integration/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9936=['Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','map','includes','string','type','nameField','customField','toLowerCase','picklist','push','variable','idField','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','stringify','unmanaged','toUpperCase','recordingURL','lastevent','lodash','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridname','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','remoteUri','POST','then','info'];(function(_0x33a096,_0x33c176){var _0x56aa67=function(_0xe638d6){while(--_0xe638d6){_0x33a096['push'](_0x33a096['shift']());}};_0x56aa67(++_0x33c176);}(_0x9936,0xf5));var _0x6993=function(_0x9e575,_0x5894d4){_0x9e575=_0x9e575-0x0;var _0x522277=_0x9936[_0x9e575];return _0x522277;};'use strict';var _=require(_0x6993('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x6993('0x1'));var Redis=require(_0x6993('0x2'));var intUtil=require(_0x6993('0x3'));var config=require(_0x6993('0x4'));var logger=require('../../../../config/logger')('freshdesk');config[_0x6993('0x5')]=_[_0x6993('0x6')](config[_0x6993('0x5')],{'host':_0x6993('0x7'),'port':0x18eb});var io=require(_0x6993('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0x6993('0x9'),'Accept':_0x6993('0x9')};function emit(_0x2734aa,_0x1a6a31,_0x20ac53){io['to'](_0x2734aa)[_0x6993('0xa')](_0x1a6a31,_0x20ac53);}function getTicket(_0x4576c0,_0x203bba,_0x10ece8,_0x25049e,_0x2ed4ba){logger['info'](_0x6993('0xb'));var _0x1d836f=_[_0x6993('0xc')]({'responder_id':_0x203bba['id'],'requester_id':_0x10ece8['id'],'name':util[_0x6993('0xd')]('Caller\x20-\x20%s',_0x2ed4ba[_0x6993('0xe')]),'phone':_0x2ed4ba['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6993('0xf')](_0x25049e[_0x6993('0x10')],_0x2ed4ba,'\x20'),'description':intUtil[_0x6993('0xf')](_0x25049e[_0x6993('0x11')],_0x2ed4ba,'
'),'tags':getTags(_0x25049e[_0x6993('0x12')],_0x6993('0x13'))},getCustomFields(_0x25049e[_0x6993('0x14')],_0x2ed4ba));_0x1d836f[_0x6993('0x15')]=_[_0x6993('0x16')](_[_0x6993('0x17')](_0x1d836f[_0x6993('0x15')],'id'),'value');return request({'uri':util['format']('%s/api/v2/tickets',_0x4576c0[_0x6993('0x18')]),'method':_0x6993('0x19'),'body':_0x1d836f})[_0x6993('0x1a')](function(_0x3ec14d){logger[_0x6993('0x1b')](_0x6993('0x1c'));return _0x3ec14d;});}function getUser(_0x1c52ad,_0x37fc05){if(intUtil['validateEmail'](_0x37fc05)){return request({'uri':util[_0x6993('0xd')](_0x6993('0x1d'),_0x1c52ad['remoteUri']),'qs':{'email':_0x37fc05}})[_0x6993('0x1a')](function(_0x205f73){if(_0x205f73[_0x6993('0x1e')]){logger[_0x6993('0x1b')](_0x6993('0x1f'));return _[_0x6993('0x20')](_0x205f73,function(_0x37e646){return _0x37e646[_0x6993('0x21')]['email']===_0x37fc05;});}else{logger[_0x6993('0x1b')](_0x6993('0x22'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x1c52ad[_0x6993('0x18')])})[_0x6993('0x1a')](function(_0x3bed80){logger['info'](_0x6993('0x23'));return _0x3bed80;});}});}else{logger[_0x6993('0x1b')](_0x6993('0x24'));return request({'uri':util[_0x6993('0xd')]('%s/api/v2/agents/me',_0x1c52ad[_0x6993('0x18')])})[_0x6993('0x1a')](function(_0x1c27c4){logger[_0x6993('0x1b')](_0x6993('0x23'));return _0x1c27c4;});}}function getEndUser(_0x1925f0,_0x1abd1c,_0x30e1f8){logger[_0x6993('0x1b')](_0x6993('0x25'),_0x30e1f8);return request({'uri':util['format'](_0x6993('0x26'),_0x1925f0[_0x6993('0x18')]),'qs':{'phone':_0x30e1f8}})[_0x6993('0x1a')](function(_0x8afab0){if(_0x8afab0[_0x6993('0x1e')]){logger['info'](_0x6993('0x27'));return _[_0x6993('0x20')](_0x8afab0,{'phone':_0x30e1f8});}else{logger[_0x6993('0x1b')](_0x6993('0x28'));return request({'uri':util[_0x6993('0xd')](_0x6993('0x26'),_0x1925f0[_0x6993('0x18')]),'method':_0x6993('0x19'),'body':{'name':_0x1abd1c,'phone':_0x30e1f8}})[_0x6993('0x1a')](function(_0x3c7db0){logger[_0x6993('0x1b')](_0x6993('0x29'));return _0x3c7db0;});}});}function getAuth(_0x578d42){return util[_0x6993('0xd')](_0x6993('0x2a'),new Buffer(_0x578d42[_0x6993('0x2b')]+':X')[_0x6993('0x2c')]('base64'));}function request(_0x1b467a){logger[_0x6993('0x2d')](_0x6993('0x2e'),JSON['stringify'](_0x1b467a));return rp(_[_0x6993('0x6')](_0x1b467a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5efcf4,_0x17ec20){var _0x2829dd=[];if(_0x5efcf4&&_0x5efcf4[_0x6993('0x1e')]>0x0){_0x2829dd=_[_0x6993('0x2f')](_0x5efcf4,_0x17ec20);}return _0x2829dd;}function getCustomFields(_0x5becd8,_0x298e68){var _0x2976b8=[];var _0x35b9c9={'custom_fields':[]};if(_0x5becd8['length']>0x0){_['forEach'](_0x5becd8,function(_0x12af74){if(_[_0x6993('0x30')]([_0x6993('0x31'),'picklist'],_0x12af74[_0x6993('0x32')])&&_0x12af74[_0x6993('0x33')]&&!_0x12af74[_0x6993('0x34')]){_0x35b9c9[_0x12af74[_0x6993('0x33')][_0x6993('0x35')]()]=_0x12af74['content'][_0x6993('0x2c')]();}else if(_[_0x6993('0x30')](['string',_0x6993('0x36')],_0x12af74[_0x6993('0x32')])&&_0x12af74['idField']&&_0x12af74['customField']){_0x35b9c9[_0x6993('0x15')][_0x6993('0x37')]({'id':_0x12af74['idField'],'value':_0x12af74['content'][_0x6993('0x2c')]()});}else if(_0x12af74[_0x6993('0x32')]===_0x6993('0x38')&&_0x12af74['variableName']&&_0x12af74[_0x6993('0x39')]&&_0x12af74['customField']){_0x298e68[_0x12af74[_0x6993('0x3a')]]&&_0x35b9c9[_0x6993('0x15')][_0x6993('0x37')]({'id':_0x12af74[_0x6993('0x39')],'value':_0x298e68[_0x12af74[_0x6993('0x3a')]][_0x6993('0x2c')]()});}else if(_0x12af74['type']===_0x6993('0x3b')&&_0x12af74[_0x6993('0x3c')]&&_0x12af74['Variable'][_0x6993('0x13')]&&_0x12af74['idField']&&_0x12af74[_0x6993('0x34')]){_0x298e68[_0x12af74[_0x6993('0x3c')]['name'][_0x6993('0x35')]()]&&_0x35b9c9[_0x6993('0x15')][_0x6993('0x37')]({'id':_0x12af74[_0x6993('0x39')],'value':_0x298e68[_0x12af74[_0x6993('0x3c')][_0x6993('0x13')]['toLowerCase']()][_0x6993('0x2c')]()});}});}return _0x35b9c9;}exports['queue']=function(_0x3e543d,_0x1032d3,_0x4de859,_0x4188de,_0x528546,_0x24991f){var _0x3fa3e3,_0x577240;_0x24991f[_0x6993('0x18')]=intUtil[_0x6993('0x3d')](_0x24991f['remoteUri']);_0x24991f[_0x6993('0x3e')]=intUtil[_0x6993('0x3d')](_0x24991f['serverUrl']);if(_0x528546&&_0x528546[_0x6993('0x3f')]){logger[_0x6993('0x1b')](_0x6993('0x40'),'Recording\x20is\x20enabled!');_0x1032d3['recordingURL']=util['format'](_0x6993('0x41'),_0x24991f['serverUrl'],_0x1032d3[_0x6993('0x42')],md5(_0x1032d3['uniqueid']));}else{_0x1032d3['recordingURL']='';}headers[_0x6993('0x43')]=getAuth(_0x24991f);return getUser(_0x24991f,_0x4188de[_0x6993('0x44')])['then'](function(_0x46c133){_0x3fa3e3=_0x46c133;logger['info'](_0x6993('0x45'),_0x3fa3e3['id']);return getEndUser(_0x24991f,_0x1032d3[_0x6993('0xe')],_0x1032d3[_0x6993('0x46')]);})['then'](function(_0x14c24a){_0x577240=_0x14c24a;logger['info'](_0x6993('0x47'),_0x577240['id']);return getTicket(_0x24991f,_0x3fa3e3,_0x577240,_0x4de859,_0x1032d3);})[_0x6993('0x1a')](function(_0x1d7b75){if(_0x1d7b75&&_0x1d7b75['id']){logger[_0x6993('0x1b')](_0x6993('0x1c'));logger['info'](_0x6993('0x48'),_0x1d7b75['id']);logger[_0x6993('0x1b')](_0x6993('0x40'),_0x6993('0x49'));emit(util[_0x6993('0xd')](_0x6993('0x4a'),_0x4188de[_0x6993('0x13')]),_0x6993('0x4b'),{'uri':util['format'](_0x6993('0x4c'),_0x24991f['remoteUri'],_0x1d7b75['id'])});}})[_0x6993('0x4d')](function(_0x4815d3){logger[_0x6993('0x4e')]('[QUEUE]',JSON['stringify'](_0x4815d3));});};exports[_0x6993('0x4f')]=function(_0xe4912d,_0x48f912,_0x5d1e98,_0x564f82,_0x3ae4ed,_0x35921b,_0x535875){var _0x2b7961,_0x39ace;_0x35921b[_0x6993('0x18')]=intUtil['stripTrailingSlash'](_0x35921b['remoteUri']);_0x35921b[_0x6993('0x3e')]=intUtil[_0x6993('0x3d')](_0x35921b[_0x6993('0x3e')]);if(_0x535875&&_0x535875[_0x6993('0x50')]&&_0x535875[_0x6993('0x50')]!==_0x6993('0x51')){logger[_0x6993('0x1b')](_0x6993('0x52'),_0x6993('0x53'));_0x48f912['recordingURL']=util['format'](_0x6993('0x41'),_0x35921b['serverUrl'],_0x48f912[_0x6993('0x42')],md5(_0x48f912['uniqueid']));}headers[_0x6993('0x43')]=getAuth(_0x35921b);return getUser(_0x35921b,_0x564f82[_0x6993('0x44')])[_0x6993('0x1a')](function(_0xbe6976){_0x2b7961=_0xbe6976;logger[_0x6993('0x1b')](_0x6993('0x45'),_0x2b7961['id']);return getEndUser(_0x35921b,_0x48f912[_0x6993('0x54')],_0x48f912[_0x6993('0x55')]);})[_0x6993('0x1a')](function(_0x85f86c){_0x39ace=_0x85f86c;logger['info'](_0x6993('0x47'),_0x39ace['id']);return getTicket(_0x35921b,_0x2b7961,_0x39ace,_0x5d1e98,_0x48f912);})['then'](function(_0x3850a9){if(_0x3850a9&&_0x3850a9['id']){logger[_0x6993('0x1b')](_0x6993('0x1c'));logger[_0x6993('0x1b')](_0x6993('0x48'),_0x3850a9['id']);logger[_0x6993('0x1b')](_0x6993('0x52'),_0x6993('0x49'));emit(util[_0x6993('0xd')](_0x6993('0x4a'),_0x564f82[_0x6993('0x13')]),_0x6993('0x4b'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x35921b[_0x6993('0x18')],_0x3850a9['id'])});}})[_0x6993('0x4d')](function(_0x4aadc8){logger[_0x6993('0x4e')]('[OUTBOUND]',JSON[_0x6993('0x56')](_0x4aadc8));});};exports[_0x6993('0x57')]=function(_0x412c65,_0x252e88,_0x2a0871,_0x1d2277,_0x285f19,_0x4b405c){var _0x5a5417,_0x413d8f;_0x4b405c[_0x6993('0x18')]=intUtil[_0x6993('0x3d')](_0x4b405c['remoteUri']);_0x4b405c[_0x6993('0x3e')]=intUtil[_0x6993('0x3d')](_0x4b405c[_0x6993('0x3e')]);if(_0x285f19&&_0x285f19[_0x6993('0x3f')]){logger['info']('['+_0x252e88['lastevent'][_0x6993('0x58')]()+']',_0x6993('0x53'));_0x252e88[_0x6993('0x59')]=util[_0x6993('0xd')](_0x6993('0x41'),_0x4b405c['serverUrl'],_0x252e88[_0x6993('0x42')],md5(_0x252e88['uniqueid']));}else{_0x252e88[_0x6993('0x59')]='';}headers[_0x6993('0x43')]=getAuth(_0x4b405c);return getUser(_0x4b405c,'')['then'](function(_0x505b65){_0x5a5417=_0x505b65;logger[_0x6993('0x1b')](_0x6993('0x45'),_0x5a5417['id']);return getEndUser(_0x4b405c,_0x252e88['calleridname'],_0x252e88['calleridnum']);})['then'](function(_0x577a97){_0x413d8f=_0x577a97;logger[_0x6993('0x1b')](_0x6993('0x47'),_0x413d8f['id']);return getTicket(_0x4b405c,_0x5a5417,_0x413d8f,_0x2a0871,_0x252e88);})['then'](function(_0x40aa48){if(_0x40aa48){logger[_0x6993('0x1b')](_0x6993('0x1c'));logger[_0x6993('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x40aa48['id']);}})['catch'](function(_0xb48c13){logger['error']('['+_0x252e88[_0x6993('0x5a')][_0x6993('0x58')]()+']',JSON[_0x6993('0x56')](_0xb48c13));});}; \ No newline at end of file +var _0x1fe9=['variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','uniqueid','destcalleridname','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','calleridnum','catch','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','value','%s/api/v2/tickets','POST','then','%s/api/v2/agents','remoteUri','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','type','nameField','customField','toLowerCase','content','push','idField','variable'];(function(_0x423cea,_0x5dee91){var _0x1080a7=function(_0x97e4d8){while(--_0x97e4d8){_0x423cea['push'](_0x423cea['shift']());}};_0x1080a7(++_0x5dee91);}(_0x1fe9,0xde));var _0x91fe=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1fe9[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var rp=require(_0x91fe('0x0'));var md5=require(_0x91fe('0x1'));var util=require(_0x91fe('0x2'));var Redis=require(_0x91fe('0x3'));var intUtil=require(_0x91fe('0x4'));var config=require(_0x91fe('0x5'));var logger=require(_0x91fe('0x6'))(_0x91fe('0x7'));config[_0x91fe('0x8')]=_[_0x91fe('0x9')](config[_0x91fe('0x8')],{'host':_0x91fe('0xa'),'port':0x18eb});var io=require(_0x91fe('0xb'))(new Redis(config[_0x91fe('0x8')]));var headers={'Content-Type':_0x91fe('0xc'),'Accept':_0x91fe('0xc')};function emit(_0x4e28b1,_0x1c5182,_0x5aaa3a){io['to'](_0x4e28b1)[_0x91fe('0xd')](_0x1c5182,_0x5aaa3a);}function getTicket(_0x35608f,_0xdee5a6,_0x476081,_0x40f37b,_0x314226){logger[_0x91fe('0xe')](_0x91fe('0xf'));var _0x54c471=_[_0x91fe('0x10')]({'responder_id':_0xdee5a6['id'],'requester_id':_0x476081['id'],'name':util[_0x91fe('0x11')](_0x91fe('0x12'),_0x314226['calleridname']),'phone':_0x314226['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x91fe('0x13')](_0x40f37b[_0x91fe('0x14')],_0x314226,'\x20'),'description':intUtil[_0x91fe('0x13')](_0x40f37b[_0x91fe('0x15')],_0x314226,'
'),'tags':getTags(_0x40f37b[_0x91fe('0x16')],_0x91fe('0x17'))},getCustomFields(_0x40f37b[_0x91fe('0x18')],_0x314226));_0x54c471[_0x91fe('0x19')]=_['mapValues'](_['keyBy'](_0x54c471[_0x91fe('0x19')],'id'),_0x91fe('0x1a'));return request({'uri':util['format'](_0x91fe('0x1b'),_0x35608f['remoteUri']),'method':_0x91fe('0x1c'),'body':_0x54c471})[_0x91fe('0x1d')](function(_0x438c56){logger[_0x91fe('0xe')]('Ticket\x20created!');return _0x438c56;});}function getUser(_0x3c397f,_0x5c2f6b){if(intUtil['validateEmail'](_0x5c2f6b)){return request({'uri':util[_0x91fe('0x11')](_0x91fe('0x1e'),_0x3c397f[_0x91fe('0x1f')]),'qs':{'email':_0x5c2f6b}})['then'](function(_0x3fe292){if(_0x3fe292['length']){logger[_0x91fe('0xe')]('Agent\x20found!');return _[_0x91fe('0x20')](_0x3fe292,function(_0x3b3f45){return _0x3b3f45['contact']['email']===_0x5c2f6b;});}else{logger[_0x91fe('0xe')](_0x91fe('0x21'));return request({'uri':util['format'](_0x91fe('0x22'),_0x3c397f[_0x91fe('0x1f')])})[_0x91fe('0x1d')](function(_0x26c43c){logger[_0x91fe('0xe')]('Admin\x20account\x20selected.');return _0x26c43c;});}});}else{logger['info'](_0x91fe('0x23'));return request({'uri':util[_0x91fe('0x11')](_0x91fe('0x22'),_0x3c397f[_0x91fe('0x1f')])})[_0x91fe('0x1d')](function(_0xa7fd16){logger['info'](_0x91fe('0x24'));return _0xa7fd16;});}}function getEndUser(_0x43d067,_0x37c722,_0x2b775e){logger['info'](_0x91fe('0x25'),_0x2b775e);return request({'uri':util[_0x91fe('0x11')]('%s/api/v2/contacts',_0x43d067[_0x91fe('0x1f')]),'qs':{'phone':_0x2b775e}})[_0x91fe('0x1d')](function(_0x3f97ee){if(_0x3f97ee[_0x91fe('0x26')]){logger[_0x91fe('0xe')](_0x91fe('0x27'));return _['find'](_0x3f97ee,{'phone':_0x2b775e});}else{logger[_0x91fe('0xe')](_0x91fe('0x28'));return request({'uri':util['format']('%s/api/v2/contacts',_0x43d067[_0x91fe('0x1f')]),'method':_0x91fe('0x1c'),'body':{'name':_0x37c722,'phone':_0x2b775e}})['then'](function(_0x276eab){logger['info'](_0x91fe('0x29'));return _0x276eab;});}});}function getAuth(_0x2b1b8f){return util['format'](_0x91fe('0x2a'),new Buffer(_0x2b1b8f[_0x91fe('0x2b')]+':X')[_0x91fe('0x2c')](_0x91fe('0x2d')));}function request(_0x5a0f3c){logger[_0x91fe('0x2e')](_0x91fe('0x2f'),JSON[_0x91fe('0x30')](_0x5a0f3c));return rp(_[_0x91fe('0x9')](_0x5a0f3c,{'method':_0x91fe('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x40fc50,_0x5dd186){var _0x23c567=[];if(_0x40fc50&&_0x40fc50['length']>0x0){_0x23c567=_['map'](_0x40fc50,_0x5dd186);}return _0x23c567;}function getCustomFields(_0x9a0f05,_0x1f9f2f){var _0x3145cc=[];var _0x592ac2={'custom_fields':[]};if(_0x9a0f05[_0x91fe('0x26')]>0x0){_[_0x91fe('0x32')](_0x9a0f05,function(_0x1ca876){if(_[_0x91fe('0x33')](['string','picklist'],_0x1ca876[_0x91fe('0x34')])&&_0x1ca876[_0x91fe('0x35')]&&!_0x1ca876[_0x91fe('0x36')]){_0x592ac2[_0x1ca876[_0x91fe('0x35')][_0x91fe('0x37')]()]=_0x1ca876[_0x91fe('0x38')]['toString']();}else if(_[_0x91fe('0x33')](['string','picklist'],_0x1ca876[_0x91fe('0x34')])&&_0x1ca876['idField']&&_0x1ca876[_0x91fe('0x36')]){_0x592ac2['custom_fields'][_0x91fe('0x39')]({'id':_0x1ca876[_0x91fe('0x3a')],'value':_0x1ca876[_0x91fe('0x38')][_0x91fe('0x2c')]()});}else if(_0x1ca876[_0x91fe('0x34')]===_0x91fe('0x3b')&&_0x1ca876['variableName']&&_0x1ca876['idField']&&_0x1ca876[_0x91fe('0x36')]){_0x1f9f2f[_0x1ca876['variableName']]&&_0x592ac2[_0x91fe('0x19')][_0x91fe('0x39')]({'id':_0x1ca876[_0x91fe('0x3a')],'value':_0x1f9f2f[_0x1ca876[_0x91fe('0x3c')]][_0x91fe('0x2c')]()});}else if(_0x1ca876[_0x91fe('0x34')]===_0x91fe('0x3d')&&_0x1ca876['Variable']&&_0x1ca876[_0x91fe('0x3e')][_0x91fe('0x17')]&&_0x1ca876[_0x91fe('0x3a')]&&_0x1ca876[_0x91fe('0x36')]){_0x1f9f2f[_0x1ca876['Variable'][_0x91fe('0x17')]['toLowerCase']()]&&_0x592ac2[_0x91fe('0x19')][_0x91fe('0x39')]({'id':_0x1ca876['idField'],'value':_0x1f9f2f[_0x1ca876['Variable'][_0x91fe('0x17')][_0x91fe('0x37')]()][_0x91fe('0x2c')]()});}});}return _0x592ac2;}exports[_0x91fe('0x3f')]=function(_0x46b39d,_0x4f6233,_0x562ae5,_0xeac37,_0x49124a,_0x3d0dd7){var _0x573d27,_0x2d817d;_0x3d0dd7['remoteUri']=intUtil[_0x91fe('0x40')](_0x3d0dd7[_0x91fe('0x1f')]);_0x3d0dd7[_0x91fe('0x41')]=intUtil[_0x91fe('0x40')](_0x3d0dd7['serverUrl']);if(_0x49124a&&_0x49124a[_0x91fe('0x42')]){logger[_0x91fe('0xe')]('[QUEUE]',_0x91fe('0x43'));_0x4f6233[_0x91fe('0x44')]=util['format'](_0x91fe('0x45'),_0x3d0dd7[_0x91fe('0x41')],_0x4f6233['uniqueid'],md5(_0x4f6233['uniqueid']));}else{_0x4f6233[_0x91fe('0x44')]='';}headers[_0x91fe('0x46')]=getAuth(_0x3d0dd7);return getUser(_0x3d0dd7,_0xeac37[_0x91fe('0x47')])[_0x91fe('0x1d')](function(_0x588ea7){_0x573d27=_0x588ea7;logger[_0x91fe('0xe')](_0x91fe('0x48'),_0x573d27['id']);return getEndUser(_0x3d0dd7,_0x4f6233[_0x91fe('0x49')],_0x4f6233['calleridnum']);})[_0x91fe('0x1d')](function(_0xc04cb){_0x2d817d=_0xc04cb;logger['info'](_0x91fe('0x4a'),_0x2d817d['id']);return getTicket(_0x3d0dd7,_0x573d27,_0x2d817d,_0x562ae5,_0x4f6233);})['then'](function(_0xb4066e){if(_0xb4066e&&_0xb4066e['id']){logger[_0x91fe('0xe')](_0x91fe('0x4b'));logger[_0x91fe('0xe')]('The\x20Ticket\x20ID\x20is:',_0xb4066e['id']);logger[_0x91fe('0xe')](_0x91fe('0x4c'),_0x91fe('0x4d'));emit(util[_0x91fe('0x11')]('user:%s',_0xeac37[_0x91fe('0x17')]),_0x91fe('0x4e'),{'uri':util[_0x91fe('0x11')](_0x91fe('0x4f'),_0x3d0dd7['remoteUri'],_0xb4066e['id'])});}})['catch'](function(_0x33e0a8){logger[_0x91fe('0x50')]('[QUEUE]',JSON['stringify'](_0x33e0a8));});};exports[_0x91fe('0x51')]=function(_0x1afc98,_0xbcbd7b,_0xfd2391,_0x23dfb2,_0x16c80c,_0x29547d,_0x1ec675){var _0x4d94fd,_0x193a82;_0x29547d[_0x91fe('0x1f')]=intUtil[_0x91fe('0x40')](_0x29547d['remoteUri']);_0x29547d['serverUrl']=intUtil[_0x91fe('0x40')](_0x29547d[_0x91fe('0x41')]);if(_0x1ec675&&_0x1ec675[_0x91fe('0x52')]&&_0x1ec675[_0x91fe('0x52')]!==_0x91fe('0x53')){logger[_0x91fe('0xe')]('[OUTBOUND]',_0x91fe('0x43'));_0xbcbd7b[_0x91fe('0x44')]=util[_0x91fe('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x29547d[_0x91fe('0x41')],_0xbcbd7b[_0x91fe('0x54')],md5(_0xbcbd7b[_0x91fe('0x54')]));}headers[_0x91fe('0x46')]=getAuth(_0x29547d);return getUser(_0x29547d,_0x23dfb2[_0x91fe('0x47')])[_0x91fe('0x1d')](function(_0x26f513){_0x4d94fd=_0x26f513;logger['info'](_0x91fe('0x48'),_0x4d94fd['id']);return getEndUser(_0x29547d,_0xbcbd7b[_0x91fe('0x55')],_0xbcbd7b['destcalleridnum']);})[_0x91fe('0x1d')](function(_0x35cf91){_0x193a82=_0x35cf91;logger[_0x91fe('0xe')](_0x91fe('0x4a'),_0x193a82['id']);return getTicket(_0x29547d,_0x4d94fd,_0x193a82,_0xfd2391,_0xbcbd7b);})['then'](function(_0x55fc5d){if(_0x55fc5d&&_0x55fc5d['id']){logger[_0x91fe('0xe')]('Ticket\x20created!');logger[_0x91fe('0xe')](_0x91fe('0x56'),_0x55fc5d['id']);logger[_0x91fe('0xe')](_0x91fe('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x91fe('0x11')](_0x91fe('0x58'),_0x23dfb2[_0x91fe('0x17')]),_0x91fe('0x4e'),{'uri':util[_0x91fe('0x11')](_0x91fe('0x4f'),_0x29547d['remoteUri'],_0x55fc5d['id'])});}})['catch'](function(_0x238e07){logger[_0x91fe('0x50')]('[OUTBOUND]',JSON[_0x91fe('0x30')](_0x238e07));});};exports[_0x91fe('0x59')]=function(_0x8e36f9,_0x25d8dc,_0x198352,_0xc0e214,_0x1fd672,_0x5701e3){var _0x5a4ea6,_0x41fafb;_0x5701e3[_0x91fe('0x1f')]=intUtil[_0x91fe('0x40')](_0x5701e3['remoteUri']);_0x5701e3[_0x91fe('0x41')]=intUtil[_0x91fe('0x40')](_0x5701e3[_0x91fe('0x41')]);if(_0x1fd672&&_0x1fd672['monitor_format']){logger[_0x91fe('0xe')]('['+_0x25d8dc[_0x91fe('0x5a')][_0x91fe('0x5b')]()+']',_0x91fe('0x43'));_0x25d8dc[_0x91fe('0x44')]=util['format'](_0x91fe('0x45'),_0x5701e3[_0x91fe('0x41')],_0x25d8dc[_0x91fe('0x54')],md5(_0x25d8dc[_0x91fe('0x54')]));}else{_0x25d8dc[_0x91fe('0x44')]='';}headers['Authorization']=getAuth(_0x5701e3);return getUser(_0x5701e3,'')[_0x91fe('0x1d')](function(_0x3eb285){_0x5a4ea6=_0x3eb285;logger[_0x91fe('0xe')]('The\x20User\x20ID\x20is:',_0x5a4ea6['id']);return getEndUser(_0x5701e3,_0x25d8dc['calleridname'],_0x25d8dc[_0x91fe('0x5c')]);})['then'](function(_0x479a35){_0x41fafb=_0x479a35;logger[_0x91fe('0xe')](_0x91fe('0x4a'),_0x41fafb['id']);return getTicket(_0x5701e3,_0x5a4ea6,_0x41fafb,_0x198352,_0x25d8dc);})['then'](function(_0x263291){if(_0x263291){logger[_0x91fe('0xe')](_0x91fe('0x4b'));logger[_0x91fe('0xe')](_0x91fe('0x56'),_0x263291['id']);}})[_0x91fe('0x5d')](function(_0x42fa89){logger[_0x91fe('0x50')]('['+_0x25d8dc['lastevent'][_0x91fe('0x5b')]()+']',JSON[_0x91fe('0x30')](_0x42fa89));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 791b729..5941236 100644 --- a/server/services/ami/trigger/integration/freshsales.js +++ b/server/services/ami/trigger/integration/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8e8=['length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','then','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','userEmail','/api/lookup?q=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','users'];(function(_0x110f22,_0x141e35){var _0x1f176e=function(_0x25bb8b){while(--_0x25bb8b){_0x110f22['push'](_0x110f22['shift']());}};_0x1f176e(++_0x141e35);}(_0xa8e8,0x90));var _0x8a8e=function(_0x3240ff,_0x3b9c3d){_0x3240ff=_0x3240ff-0x0;var _0x514858=_0xa8e8[_0x3240ff];return _0x514858;};'use strict';var _=require(_0x8a8e('0x0'));var rp=require(_0x8a8e('0x1'));var md5=require(_0x8a8e('0x2'));var util=require('util');var moment=require(_0x8a8e('0x3'));var Promise=require(_0x8a8e('0x4'));var Redis=require(_0x8a8e('0x5'));var intUtil=require(_0x8a8e('0x6'));var config=require(_0x8a8e('0x7'));var logger=require(_0x8a8e('0x8'))(_0x8a8e('0x9'));config[_0x8a8e('0xa')]=_['defaults'](config['redis'],{'host':_0x8a8e('0xb'),'port':0x18eb});var io=require(_0x8a8e('0xc'))(new Redis(config[_0x8a8e('0xa')]));function getAdminId(_0x10b149,_0x3ae4bf,_0x4d583f,_0x453667){return new Promise(function(_0x3f9b1c,_0x5a9953){var _0x42c37a=![];var _0x413e03={'method':_0x8a8e('0xd'),'uri':_0x453667+_0x8a8e('0xe'),'json':!![]};_0x413e03['headers']=_0x4d583f;logger[_0x8a8e('0xf')](_0x8a8e('0x10'));return rp(_0x413e03)['then'](function(_0x5dae87){if(_0x5dae87){var _0xdc640f=_0x5dae87[_0x8a8e('0x11')];var _0x2b438c=null;for(_0x2b438c=0x0;_0x2b438c<_0xdc640f[_0x8a8e('0x12')];_0x2b438c++){if(_0xdc640f[_0x2b438c][_0x8a8e('0x13')]===_0x10b149[_0x8a8e('0x14')]){_0x10b149['adminId']=_0xdc640f[_0x2b438c]['id'];_0x42c37a=!![];}}if(_0x42c37a){logger[_0x8a8e('0xf')](_0x8a8e('0x15'),_0x10b149[_0x8a8e('0x16')]);_0x3f9b1c(_0x10b149);}else{_0x5a9953({'statusCode':0x194,'message':_0x8a8e('0x17')});}}else{_0x5a9953({'statusCode':0x194,'message':_0x8a8e('0x17')});}})[_0x8a8e('0x18')](function(_0x2cefdb){logger[_0x8a8e('0x19')]('['+[_0x3ae4bf[_0x8a8e('0x1a')]()]+']',_0x2cefdb[_0x8a8e('0x1b')]);_0x5a9953(_0x2cefdb);});});}function getUser(_0xa31b8,_0x4f7378,_0x15271a){return function(_0x2b1e5a){return new Promise(function(_0x14e3a7,_0x4a005f){var _0x410987={'method':_0x8a8e('0xd'),'uri':_0x15271a+_0x8a8e('0xe'),'json':!![]};_0x410987[_0x8a8e('0x1c')]=_0x4f7378;logger['info']('Getting\x20user\x20list');return rp(_0x410987)[_0x8a8e('0x1d')](function(_0x187d76){if(_0x187d76){var _0xd04a95=_0x187d76['users'];var _0x4384d5=![];var _0x12dfdf=null;if(_0x2b1e5a[_0x8a8e('0x1e')]!==null){logger['info'](_0x8a8e('0x1f'),_0x2b1e5a[_0x8a8e('0x1e')]);_0x2b1e5a['userEmail']=_0x2b1e5a['agentEmail'];for(_0x12dfdf=0x0;_0x12dfdf<_0xd04a95[_0x8a8e('0x12')];_0x12dfdf++){if(_0xd04a95[_0x12dfdf]['email']===_0x2b1e5a[_0x8a8e('0x1e')]){_0x4384d5=!![];_0x2b1e5a[_0x8a8e('0x20')]=_0xd04a95[_0x12dfdf]['id'];logger[_0x8a8e('0xf')](_0x8a8e('0x21'),_0x2b1e5a[_0x8a8e('0x20')]);}}}if(!_0x4384d5){logger[_0x8a8e('0xf')]('Admin\x20selected');_0x2b1e5a[_0x8a8e('0x22')]=_0x2b1e5a[_0x8a8e('0x14')];_0x2b1e5a[_0x8a8e('0x20')]=_0x2b1e5a['adminId'];_0x4384d5=!![];}if(_0x4384d5){_0x14e3a7(_0x2b1e5a);}else{_0x4a005f({'statusCode':0x194,'message':_0x8a8e('0x17')});}}else{_0x4a005f({'statusCode':0x194,'message':_0x8a8e('0x17')});}})[_0x8a8e('0x18')](function(_0x8ba22e){logger[_0x8a8e('0x19')]('['+[_0xa31b8[_0x8a8e('0x1a')]()]+']',_0x8ba22e[_0x8a8e('0x1b')]);_0x4a005f(_0x8ba22e);});});};}function searchContact(_0x3629db,_0x2041f0,_0x117efb,_0x280035){return new Promise(function(_0x41c0d9,_0x3a0993){var _0x403a54={'method':'GET','headers':_0x2041f0,'uri':_0x3629db+_0x8a8e('0x23')+_0x280035+'&f='+_0x117efb+_0x8a8e('0x24'),'json':!![]};rp(_0x403a54)[_0x8a8e('0x1d')](function(_0x48bb98){var _0x317749=_[_0x8a8e('0x25')](_0x48bb98[_0x8a8e('0x26')][_0x8a8e('0x26')],[_0x117efb,_0x280035]);_0x41c0d9(_0x317749);})[_0x8a8e('0x18')](function(_0x5c6b96){_0x3a0993(_0x5c6b96);});});}function getEndUser(_0x560fc9,_0x34ce44,_0x556823){return function(_0x54d992){return new Promise(function(_0x450299,_0x54d7fa){logger[_0x8a8e('0xf')](util[_0x8a8e('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x54d992[_0x8a8e('0x28')]));searchContact(_0x556823,_0x34ce44,_0x8a8e('0x29'),_0x54d992[_0x8a8e('0x28')])['then'](function(_0xe7fae){if(_0xe7fae){_0x54d992[_0x8a8e('0x2a')]=_0xe7fae['id'];logger[_0x8a8e('0xf')](_0x8a8e('0x2b'),_0x54d992[_0x8a8e('0x2a')]);return _0x450299(_0x54d992);}searchContact(_0x556823,_0x34ce44,_0x8a8e('0x2c'),_0x54d992['contactNumber'])[_0x8a8e('0x1d')](function(_0x4187c4){if(_0x4187c4){_0x54d992[_0x8a8e('0x2a')]=_0x4187c4['id'];logger[_0x8a8e('0xf')](_0x8a8e('0x2d'),_0x54d992['endUserId']);return _0x450299(_0x54d992);}createEndUser(_0x54d992,_0x560fc9,_0x34ce44,_0x556823)[_0x8a8e('0x1d')](function(_0x2348aa){logger[_0x8a8e('0xf')]('Contact\x20created:',_0x2348aa[_0x8a8e('0x2a')]);return _0x450299(_0x2348aa);});});})[_0x8a8e('0x18')](function(_0x294003){_0x54d7fa(_0x294003);});});};}function createEndUser(_0x5b6e7a,_0x220eae,_0x598da7,_0xc3a6fe){return new Promise(function(_0x4a2604,_0x3cdc56){var _0x584468=moment();var _0x4d0ca6={'method':_0x8a8e('0x2e'),'uri':_0xc3a6fe+'/api/contacts','body':{'contact':{'last_name':_0x5b6e7a[_0x8a8e('0x28')],'work_number':_0x5b6e7a[_0x8a8e('0x28')],'mobile_number':_0x5b6e7a[_0x8a8e('0x28')],'owner_id':_0x5b6e7a[_0x8a8e('0x20')],'created_at':_0x584468[_0x8a8e('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4d0ca6[_0x8a8e('0x1c')]=_0x598da7;logger[_0x8a8e('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4d0ca6)[_0x8a8e('0x1d')](function(_0x5cd7f9){_0x5b6e7a[_0x8a8e('0x2a')]=_0x5cd7f9['contact']['id'];_0x4a2604(_0x5b6e7a);})[_0x8a8e('0x18')](function(_0x534f84){logger[_0x8a8e('0x19')]('['+[_0x220eae[_0x8a8e('0x1a')]()]+']',_0x534f84[_0x8a8e('0x1b')]);_0x3cdc56(_0x534f84[_0x8a8e('0x1b')]);});});}function getTicket(_0x17263f,_0x2c595b,_0x2b8885,_0x56bff8,_0x37923f){return function(_0x5d8984){logger[_0x8a8e('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x48c628,_0x2e3498){var _0x5a28ba=moment();var _0x208df9={'method':_0x8a8e('0x2e'),'uri':_0x2b8885+_0x8a8e('0x2f'),'body':{'title':intUtil[_0x8a8e('0x30')](_0x56bff8[_0x8a8e('0x31')],_0x37923f,'\x20'),'description':intUtil['getString'](_0x56bff8[_0x8a8e('0x32')],_0x37923f,'\x0a'),'owner_id':_0x5d8984['userId'],'creater_id':_0x5d8984[_0x8a8e('0x16')],'targetable_id':_0x5d8984[_0x8a8e('0x2a')],'targetable_type':_0x8a8e('0x33'),'created_at':_0x5a28ba['format'](_0x8a8e('0x34')),'due_date':_0x5a28ba['add'](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x208df9[_0x8a8e('0x1c')]=_0x2c595b;return rp(_0x208df9)[_0x8a8e('0x1d')](function(_0x282434){_0x5d8984['ticketId']=_0x282434[_0x8a8e('0x35')]['id'];logger[_0x8a8e('0xf')](_0x8a8e('0x36'),_0x5d8984[_0x8a8e('0x37')]);_0x48c628(_0x5d8984);})[_0x8a8e('0x18')](function(_0xcb0b23){logger[_0x8a8e('0x19')]('['+[_0x17263f[_0x8a8e('0x1a')]()]+']',_0xcb0b23[_0x8a8e('0x1b')]);_0x2e3498(_0xcb0b23[_0x8a8e('0x1b')]);});});};}function emit(_0x457c21,_0x340882,_0xe03b67){var _0x84cda0={'uri':_0x457c21+_0x8a8e('0x38')+_0xe03b67};io['to'](util[_0x8a8e('0x27')](_0x8a8e('0x39'),_0x340882))[_0x8a8e('0x3a')]('trigger:browser:url',_0x84cda0);}exports['cs']=function(_0x5da53e,_0x395e20,_0x2bfa76,_0x509023,_0x4d3350,_0x4d0c3f,_0x108480,_0x45c075){var _0x2ca485={};var _0x279222={'Authorization':_0x8a8e('0x3b')+_0x4d0c3f[_0x8a8e('0x3c')]};_0x4d0c3f[_0x8a8e('0x3d')]=intUtil['stripTrailingSlash'](_0x4d0c3f['remoteUri']);_0x4d0c3f['serverUrl']=intUtil[_0x8a8e('0x3e')](_0x4d0c3f[_0x8a8e('0x3f')]);var _0x1e1bfb=_0x4d0c3f[_0x8a8e('0x3d')];_0x2ca485['adminEmail']=_0x4d0c3f[_0x8a8e('0x40')];_0x2ca485[_0x8a8e('0x28')]=_0x45c075[_0x8a8e('0x41')]()===_0x8a8e('0x42')?_0x395e20[_0x8a8e('0x43')]:_0x395e20[_0x8a8e('0x44')];_0x2ca485[_0x8a8e('0x45')]=_0x45c075==='queue'||_0x45c075===_0x8a8e('0x46')?'queue':_0x8a8e('0x42');if(_0x509023){_0x2ca485[_0x8a8e('0x1e')]=_0x509023['email'];}var _0x19b064=util[_0x8a8e('0x27')](_0x8a8e('0x47'),_0x4d0c3f[_0x8a8e('0x3f')],_0x395e20[_0x8a8e('0x48')],md5(_0x395e20[_0x8a8e('0x48')]));if(_0x4d3350&&_0x4d3350[_0x8a8e('0x49')]){logger[_0x8a8e('0xf')]('[QUEUE]',_0x8a8e('0x4a'));_0x395e20[_0x8a8e('0x4b')]=_0x19b064;}else if(_0x108480&&_0x108480[_0x8a8e('0x4c')]&&_0x108480['recordingFormat']!==_0x8a8e('0x4d')){logger['info'](_0x8a8e('0x4e'),_0x8a8e('0x4a'));_0x395e20[_0x8a8e('0x4b')]=_0x19b064;}else{_0x395e20[_0x8a8e('0x4b')]='';}return getAdminId(_0x2ca485,_0x45c075,_0x279222,_0x1e1bfb)[_0x8a8e('0x1d')](getUser(_0x45c075,_0x279222,_0x1e1bfb))[_0x8a8e('0x1d')](getEndUser(_0x45c075,_0x279222,_0x1e1bfb))[_0x8a8e('0x1d')](getTicket(_0x45c075,_0x279222,_0x1e1bfb,_0x2bfa76,_0x395e20))[_0x8a8e('0x1d')](function(_0x37d2f2){logger['info'](util[_0x8a8e('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x37d2f2[_0x8a8e('0x37')]));if(_0x45c075!=='unmanaged'){logger[_0x8a8e('0xf')]('['+[_0x45c075['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x1e1bfb,_0x509023[_0x8a8e('0x4f')],_0x37d2f2[_0x8a8e('0x2a')]);}})[_0x8a8e('0x18')](function(_0x322020){logger[_0x8a8e('0x19')]('['+[_0x45c075[_0x8a8e('0x1a')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x8a8e('0x50')](_0x322020,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd62a=['YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','task','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','adminEmail','username','toLowerCase','destcalleridnum','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','email','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','GET','Getting\x20user\x20list','users','agentEmail','length','User\x20found:','userId','Admin\x20selected','userEmail','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts'];(function(_0x5f10d9,_0x16a7d5){var _0x1c7ec4=function(_0x36ef7e){while(--_0x36ef7e){_0x5f10d9['push'](_0x5f10d9['shift']());}};_0x1c7ec4(++_0x16a7d5);}(_0xd62a,0x1c2));var _0xad62=function(_0x42c70d,_0x492bae){_0x42c70d=_0x42c70d-0x0;var _0x242101=_0xd62a[_0x42c70d];return _0x242101;};'use strict';var _=require(_0xad62('0x0'));var rp=require('request-promise');var md5=require(_0xad62('0x1'));var util=require(_0xad62('0x2'));var moment=require(_0xad62('0x3'));var Promise=require(_0xad62('0x4'));var Redis=require('ioredis');var intUtil=require(_0xad62('0x5'));var config=require(_0xad62('0x6'));var logger=require(_0xad62('0x7'))(_0xad62('0x8'));config['redis']=_['defaults'](config[_0xad62('0x9')],{'host':_0xad62('0xa'),'port':0x18eb});var io=require(_0xad62('0xb'))(new Redis(config['redis']));function getAdminId(_0x650b76,_0x713e65,_0x1e3cbe,_0x410fea){return new Promise(function(_0x165db1,_0x55a63d){var _0x191391=![];var _0x653ffc={'method':'GET','uri':_0x410fea+_0xad62('0xc'),'json':!![]};_0x653ffc[_0xad62('0xd')]=_0x1e3cbe;logger[_0xad62('0xe')](_0xad62('0xf'));return rp(_0x653ffc)[_0xad62('0x10')](function(_0x6c465d){if(_0x6c465d){var _0x1fd257=_0x6c465d['users'];var _0x40631b=null;for(_0x40631b=0x0;_0x40631b<_0x1fd257['length'];_0x40631b++){if(_0x1fd257[_0x40631b][_0xad62('0x11')]===_0x650b76['adminEmail']){_0x650b76[_0xad62('0x12')]=_0x1fd257[_0x40631b]['id'];_0x191391=!![];}}if(_0x191391){logger[_0xad62('0xe')]('Admin\x20found:',_0x650b76[_0xad62('0x12')]);_0x165db1(_0x650b76);}else{_0x55a63d({'statusCode':0x194,'message':_0xad62('0x13')});}}else{_0x55a63d({'statusCode':0x194,'message':_0xad62('0x13')});}})[_0xad62('0x14')](function(_0x50ed7a){logger['error']('['+[_0x713e65[_0xad62('0x15')]()]+']',_0x50ed7a[_0xad62('0x16')]);_0x55a63d(_0x50ed7a);});});}function getUser(_0x42ba67,_0x5b57eb,_0x1fba44){return function(_0x3e9dc5){return new Promise(function(_0x93e388,_0x9d6112){var _0x81986f={'method':_0xad62('0x17'),'uri':_0x1fba44+_0xad62('0xc'),'json':!![]};_0x81986f['headers']=_0x5b57eb;logger[_0xad62('0xe')](_0xad62('0x18'));return rp(_0x81986f)[_0xad62('0x10')](function(_0x3ff887){if(_0x3ff887){var _0x4d3133=_0x3ff887[_0xad62('0x19')];var _0x337be2=![];var _0x48c310=null;if(_0x3e9dc5[_0xad62('0x1a')]!==null){logger[_0xad62('0xe')]('Getting\x20user\x20with\x20email',_0x3e9dc5[_0xad62('0x1a')]);_0x3e9dc5['userEmail']=_0x3e9dc5[_0xad62('0x1a')];for(_0x48c310=0x0;_0x48c310<_0x4d3133[_0xad62('0x1b')];_0x48c310++){if(_0x4d3133[_0x48c310][_0xad62('0x11')]===_0x3e9dc5[_0xad62('0x1a')]){_0x337be2=!![];_0x3e9dc5['userId']=_0x4d3133[_0x48c310]['id'];logger[_0xad62('0xe')](_0xad62('0x1c'),_0x3e9dc5[_0xad62('0x1d')]);}}}if(!_0x337be2){logger['info'](_0xad62('0x1e'));_0x3e9dc5[_0xad62('0x1f')]=_0x3e9dc5['adminEmail'];_0x3e9dc5[_0xad62('0x1d')]=_0x3e9dc5[_0xad62('0x12')];_0x337be2=!![];}if(_0x337be2){_0x93e388(_0x3e9dc5);}else{_0x9d6112({'statusCode':0x194,'message':_0xad62('0x13')});}}else{_0x9d6112({'statusCode':0x194,'message':_0xad62('0x13')});}})['catch'](function(_0x3bf20f){logger[_0xad62('0x20')]('['+[_0x42ba67['toUpperCase']()]+']',_0x3bf20f[_0xad62('0x16')]);_0x9d6112(_0x3bf20f);});});};}function searchContact(_0x31a161,_0x54ff47,_0x1a9237,_0x37242e){return new Promise(function(_0x5a6e2e,_0x1cf9bf){var _0x59ad63={'method':_0xad62('0x17'),'headers':_0x54ff47,'uri':_0x31a161+_0xad62('0x21')+_0x37242e+_0xad62('0x22')+_0x1a9237+_0xad62('0x23'),'json':!![]};rp(_0x59ad63)[_0xad62('0x10')](function(_0x266875){var _0x2f5aab=_[_0xad62('0x24')](_0x266875[_0xad62('0x25')]['contacts'],[_0x1a9237,_0x37242e]);_0x5a6e2e(_0x2f5aab);})[_0xad62('0x14')](function(_0xb2fc95){_0x1cf9bf(_0xb2fc95);});});}function getEndUser(_0x5a3de4,_0x34aa77,_0xc76f4){return function(_0x24866f){return new Promise(function(_0x4244ae,_0x15e56f){logger['info'](util[_0xad62('0x26')]('Searching\x20contact\x20with\x20phone\x20%s',_0x24866f['contactNumber']));searchContact(_0xc76f4,_0x34aa77,_0xad62('0x27'),_0x24866f[_0xad62('0x28')])[_0xad62('0x10')](function(_0x2e0e1b){if(_0x2e0e1b){_0x24866f[_0xad62('0x29')]=_0x2e0e1b['id'];logger['info'](_0xad62('0x2a'),_0x24866f[_0xad62('0x29')]);return _0x4244ae(_0x24866f);}searchContact(_0xc76f4,_0x34aa77,_0xad62('0x2b'),_0x24866f[_0xad62('0x28')])[_0xad62('0x10')](function(_0x1403b8){if(_0x1403b8){_0x24866f[_0xad62('0x29')]=_0x1403b8['id'];logger[_0xad62('0xe')](_0xad62('0x2c'),_0x24866f[_0xad62('0x29')]);return _0x4244ae(_0x24866f);}createEndUser(_0x24866f,_0x5a3de4,_0x34aa77,_0xc76f4)[_0xad62('0x10')](function(_0x1e86a3){logger[_0xad62('0xe')](_0xad62('0x2d'),_0x1e86a3[_0xad62('0x29')]);return _0x4244ae(_0x1e86a3);});});})[_0xad62('0x14')](function(_0x4b7221){_0x15e56f(_0x4b7221);});});};}function createEndUser(_0x3136b3,_0x3b3a34,_0x52b4e5,_0x15531e){return new Promise(function(_0x36bf64,_0x4dbd12){var _0x46b4c1=moment();var _0xa9080b={'method':_0xad62('0x2e'),'uri':_0x15531e+_0xad62('0x2f'),'body':{'contact':{'last_name':_0x3136b3[_0xad62('0x28')],'work_number':_0x3136b3[_0xad62('0x28')],'mobile_number':_0x3136b3[_0xad62('0x28')],'owner_id':_0x3136b3[_0xad62('0x1d')],'created_at':_0x46b4c1['format'](_0xad62('0x30'))}},'json':!![]};_0xa9080b[_0xad62('0xd')]=_0x52b4e5;logger['info'](_0xad62('0x31'));return rp(_0xa9080b)[_0xad62('0x10')](function(_0xb0a21c){_0x3136b3[_0xad62('0x29')]=_0xb0a21c[_0xad62('0x32')]['id'];_0x36bf64(_0x3136b3);})['catch'](function(_0x217331){logger[_0xad62('0x20')]('['+[_0x3b3a34[_0xad62('0x15')]()]+']',_0x217331['message']);_0x4dbd12(_0x217331[_0xad62('0x16')]);});});}function getTicket(_0x577fd7,_0xfff6a7,_0x46a848,_0x3a5a73,_0x5764d8){return function(_0x4c5862){logger[_0xad62('0xe')](_0xad62('0x33'));return new Promise(function(_0x562ee7,_0x40c20c){var _0x4fc8a4=moment();var _0x4ce6a9={'method':'POST','uri':_0x46a848+_0xad62('0x34'),'body':{'title':intUtil[_0xad62('0x35')](_0x3a5a73['Subjects'],_0x5764d8,'\x20'),'description':intUtil['getString'](_0x3a5a73[_0xad62('0x36')],_0x5764d8,'\x0a'),'owner_id':_0x4c5862[_0xad62('0x1d')],'creater_id':_0x4c5862[_0xad62('0x12')],'targetable_id':_0x4c5862[_0xad62('0x29')],'targetable_type':_0xad62('0x37'),'created_at':_0x4fc8a4[_0xad62('0x26')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4fc8a4['add'](0x1e,'m')[_0xad62('0x26')](_0xad62('0x30'))},'json':!![]};_0x4ce6a9[_0xad62('0xd')]=_0xfff6a7;return rp(_0x4ce6a9)[_0xad62('0x10')](function(_0x4d0f15){_0x4c5862['ticketId']=_0x4d0f15[_0xad62('0x38')]['id'];logger[_0xad62('0xe')]('Task\x20created:',_0x4c5862[_0xad62('0x39')]);_0x562ee7(_0x4c5862);})['catch'](function(_0x3e7c2c){logger[_0xad62('0x20')]('['+[_0x577fd7[_0xad62('0x15')]()]+']',_0x3e7c2c[_0xad62('0x16')]);_0x40c20c(_0x3e7c2c[_0xad62('0x16')]);});});};}function emit(_0x43bee1,_0x3cc764,_0x779b0f){var _0x3e4cfd={'uri':_0x43bee1+_0xad62('0x3a')+_0x779b0f};io['to'](util[_0xad62('0x26')](_0xad62('0x3b'),_0x3cc764))['emit'](_0xad62('0x3c'),_0x3e4cfd);}exports['cs']=function(_0x2adfe4,_0x24ad57,_0x49ea77,_0x5b95ab,_0x4a28cf,_0x44e887,_0x24fd18,_0x4b4f06){var _0x3f69fc={};var _0x24234e={'Authorization':_0xad62('0x3d')+_0x44e887[_0xad62('0x3e')]};_0x44e887['remoteUri']=intUtil[_0xad62('0x3f')](_0x44e887['remoteUri']);_0x44e887[_0xad62('0x40')]=intUtil[_0xad62('0x3f')](_0x44e887[_0xad62('0x40')]);var _0x141495=_0x44e887[_0xad62('0x41')];_0x3f69fc[_0xad62('0x42')]=_0x44e887[_0xad62('0x43')];_0x3f69fc[_0xad62('0x28')]=_0x4b4f06[_0xad62('0x44')]()==='outbound'?_0x24ad57[_0xad62('0x45')]:_0x24ad57['calleridnum'];_0x3f69fc['callDirection']=_0x4b4f06===_0xad62('0x46')||_0x4b4f06==='unmanaged'?'queue':_0xad62('0x47');if(_0x5b95ab){_0x3f69fc[_0xad62('0x1a')]=_0x5b95ab[_0xad62('0x11')];}var _0x5537ae=util[_0xad62('0x26')](_0xad62('0x48'),_0x44e887[_0xad62('0x40')],_0x24ad57[_0xad62('0x49')],md5(_0x24ad57[_0xad62('0x49')]));if(_0x4a28cf&&_0x4a28cf[_0xad62('0x4a')]){logger[_0xad62('0xe')](_0xad62('0x4b'),_0xad62('0x4c'));_0x24ad57[_0xad62('0x4d')]=_0x5537ae;}else if(_0x24fd18&&_0x24fd18['recordingFormat']&&_0x24fd18['recordingFormat']!==_0xad62('0x4e')){logger[_0xad62('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x24ad57[_0xad62('0x4d')]=_0x5537ae;}else{_0x24ad57['recordingURL']='';}return getAdminId(_0x3f69fc,_0x4b4f06,_0x24234e,_0x141495)['then'](getUser(_0x4b4f06,_0x24234e,_0x141495))[_0xad62('0x10')](getEndUser(_0x4b4f06,_0x24234e,_0x141495))[_0xad62('0x10')](getTicket(_0x4b4f06,_0x24234e,_0x141495,_0x49ea77,_0x24ad57))[_0xad62('0x10')](function(_0x4a1908){logger['info'](util[_0xad62('0x26')](_0xad62('0x4f'),_0x4a1908[_0xad62('0x39')]));if(_0x4b4f06!=='unmanaged'){logger['info']('['+[_0x4b4f06[_0xad62('0x15')]()]+']',_0xad62('0x50'));emit(_0x141495,_0x5b95ab[_0xad62('0x51')],_0x4a1908['endUserId']);}})['catch'](function(_0x35829f){logger[_0xad62('0x20')]('['+[_0x4b4f06['toUpperCase']()]+_0xad62('0x52'),util['inspect'](_0x35829f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 846754f..62c38cf 100644 --- a/server/services/ami/trigger/integration/index.js +++ b/server/services/ami/trigger/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bd4=['data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','sugarcrm','servicenow','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','exec','data1','toLowerCase','data2','find','Configurations'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0bd4,0xd3));var _0x40bd=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x0bd4[_0x2ca616];return _0x53155f;};'use strict';var _=require(_0x40bd('0x0'));var util=require(_0x40bd('0x1'));var zendesk=require(_0x40bd('0x2'));var salesforce=require(_0x40bd('0x3'));var sugarcrm=require(_0x40bd('0x4'));var freshdesk=require(_0x40bd('0x5'));var zoho=require(_0x40bd('0x6'));var desk=require(_0x40bd('0x7'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x40bd('0x8'));var integrations=[_0x40bd('0x9'),_0x40bd('0xa'),'sugarcrm',_0x40bd('0xb'),_0x40bd('0xc'),_0x40bd('0xd'),_0x40bd('0xe'),_0x40bd('0xf'),_0x40bd('0x10'),'servicenow'];exports[_0x40bd('0x11')]=function(_0x593371,_0x289399,_0x1aaa6a,_0x56e7ca,_0x16c44b,_0x332b2b){if(_0x1aaa6a){if(_['includes'](integrations,_0x593371[_0x40bd('0x12')][_0x40bd('0x13')]())){try{var _0x501963=null;var _0x10b7b5='';var _0x245eea=_0x1aaa6a[_0x593371[_0x40bd('0x12')][_0x40bd('0x13')]()];if(_0x245eea){var _0xac333f=_0x245eea[_0x593371[_0x40bd('0x14')]];if(_0xac333f){var _0x4ddb68=_[_0x40bd('0x15')](_0xac333f[_0x40bd('0x16')],{'id':parseInt(_0x593371[_0x40bd('0x17')],0xa)});if(_0x4ddb68){if(_0x56e7ca){if(_0x16c44b&&_0x289399['queue']){_0x10b7b5=_0x40bd('0x18');}else if(_0x289399[_0x40bd('0x19')]){_0x10b7b5=_0x40bd('0x1a');}else{console['log'](_0x40bd('0x1b'),_0x289399);}}else{_0x10b7b5=_0x40bd('0x1c');}switch(_0x593371[_0x40bd('0x12')][_0x40bd('0x13')]()){case'zendesk':zendesk[_0x10b7b5](_0x593371,_0x289399,_0x4ddb68,_0x56e7ca,_0x16c44b,_0xac333f,_0x332b2b);break;case _0x40bd('0xa'):salesforce[_0x10b7b5](_0x593371,_0x289399,_0x4ddb68,_0x56e7ca,_0x16c44b,_0xac333f,_0x332b2b);break;case _0x40bd('0x1d'):sugarcrm[_0x10b7b5](_0x593371,_0x289399,_0x4ddb68,_0x56e7ca,_0x16c44b,_0xac333f,_0x332b2b);break;case _0x40bd('0xb'):freshdesk[_0x10b7b5](_0x593371,_0x289399,_0x4ddb68,_0x56e7ca,_0x16c44b,_0xac333f,_0x332b2b);break;case _0x40bd('0xc'):zoho[_0x10b7b5](_0x593371,_0x289399,_0x4ddb68,_0x56e7ca,_0x16c44b,_0xac333f,_0x332b2b);break;case _0x40bd('0xd'):desk[_0x10b7b5](_0x593371,_0x289399,_0x4ddb68,_0x56e7ca,_0x16c44b,_0xac333f,_0x332b2b);break;case _0x40bd('0xe'):vtiger[_0x10b7b5](_0x593371,_0x289399,_0x4ddb68,_0x56e7ca,_0x16c44b,_0xac333f,_0x332b2b);break;case _0x40bd('0x10'):freshsales['cs'](_0x593371,_0x289399,_0x4ddb68,_0x56e7ca,_0x16c44b,_0xac333f,_0x332b2b,_0x10b7b5);break;case _0x40bd('0x1e'):servicenow['cs'](_0x593371,_0x289399,_0x4ddb68,_0x56e7ca,_0x16c44b,_0xac333f,_0x332b2b,_0x10b7b5);break;case'dynamics365':dynamics365['cs'](_0x593371,_0x289399,_0x4ddb68,_0x56e7ca,_0x16c44b,_0xac333f,_0x332b2b,_0x10b7b5);break;default:console[_0x40bd('0x1f')](_0x40bd('0x20'));}}else{_0x501963=require(_0x40bd('0x21'))(_0x593371[_0x40bd('0x12')]['toLowerCase']());_0x501963[_0x40bd('0x22')](_0x40bd('0x23'),util[_0x40bd('0x24')](_0x40bd('0x25'),_0x593371[_0x40bd('0x12')][_0x40bd('0x13')](),_0x593371[_0x40bd('0x17')]));}}else{_0x501963=require(_0x40bd('0x21'))(_0x593371[_0x40bd('0x12')][_0x40bd('0x13')]());_0x501963[_0x40bd('0x22')](_0x40bd('0x23'),util[_0x40bd('0x24')](_0x40bd('0x26'),_0x593371[_0x40bd('0x12')][_0x40bd('0x13')](),_0x593371[_0x40bd('0x14')]));}}else{}}catch(_0x3302be){console[_0x40bd('0x22')](_0x3302be);}}}}; \ No newline at end of file +var _0xe48e=['unmanaged','zendesk','sugarcrm','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','outbound'];(function(_0x2a0cbe,_0xfbf284){var _0x515b89=function(_0x286dc3){while(--_0x286dc3){_0x2a0cbe['push'](_0x2a0cbe['shift']());}};_0x515b89(++_0xfbf284);}(_0xe48e,0x10b));var _0xee48=function(_0x4963f5,_0x3f56b1){_0x4963f5=_0x4963f5-0x0;var _0x2f4577=_0xe48e[_0x4963f5];return _0x2f4577;};'use strict';var _=require(_0xee48('0x0'));var util=require(_0xee48('0x1'));var zendesk=require(_0xee48('0x2'));var salesforce=require(_0xee48('0x3'));var sugarcrm=require(_0xee48('0x4'));var freshdesk=require(_0xee48('0x5'));var zoho=require('./zoho');var desk=require(_0xee48('0x6'));var vtiger=require(_0xee48('0x7'));var servicenow=require(_0xee48('0x8'));var dynamics365=require(_0xee48('0x9'));var freshsales=require(_0xee48('0xa'));var integrations=['zendesk',_0xee48('0xb'),'sugarcrm',_0xee48('0xc'),_0xee48('0xd'),_0xee48('0xe'),_0xee48('0xf'),_0xee48('0x10'),_0xee48('0x11'),_0xee48('0x12')];exports[_0xee48('0x13')]=function(_0x543ffb,_0x41580e,_0x1f1cad,_0xf93b26,_0x202e39,_0x486741){if(_0x1f1cad){if(_[_0xee48('0x14')](integrations,_0x543ffb['data1'][_0xee48('0x15')]())){try{var _0xa1877f=null;var _0x208165='';var _0x4bd6a3=_0x1f1cad[_0x543ffb[_0xee48('0x16')]['toLowerCase']()];if(_0x4bd6a3){var _0x5beede=_0x4bd6a3[_0x543ffb[_0xee48('0x17')]];if(_0x5beede){var _0x181254=_[_0xee48('0x18')](_0x5beede[_0xee48('0x19')],{'id':parseInt(_0x543ffb[_0xee48('0x1a')],0xa)});if(_0x181254){if(_0xf93b26){if(_0x202e39&&_0x41580e[_0xee48('0x1b')]){_0x208165=_0xee48('0x1b');}else if(_0x41580e['routeId']){_0x208165=_0xee48('0x1c');}else{console['log']('EVENT\x20UNKNOWN',_0x41580e);}}else{_0x208165=_0xee48('0x1d');}switch(_0x543ffb['data1']['toLowerCase']()){case _0xee48('0x1e'):zendesk[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case'salesforce':salesforce[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0x1f'):sugarcrm[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0xc'):freshdesk[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0xd'):zoho[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0xe'):desk[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0xf'):vtiger[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0x11'):freshsales['cs'](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741,_0x208165);break;case _0xee48('0x12'):servicenow['cs'](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741,_0x208165);break;case _0xee48('0x10'):dynamics365['cs'](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741,_0x208165);break;default:console['log'](_0xee48('0x20'));}}else{_0xa1877f=require(_0xee48('0x21'))(_0x543ffb[_0xee48('0x16')]['toLowerCase']());_0xa1877f[_0xee48('0x22')]('[EXEC]',util[_0xee48('0x23')](_0xee48('0x24'),_0x543ffb[_0xee48('0x16')]['toLowerCase'](),_0x543ffb[_0xee48('0x1a')]));}}else{_0xa1877f=require(_0xee48('0x21'))(_0x543ffb['data1']['toLowerCase']());_0xa1877f[_0xee48('0x22')]('[EXEC]',util[_0xee48('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x543ffb[_0xee48('0x16')][_0xee48('0x15')](),_0x543ffb[_0xee48('0x17')]));}}else{}}catch(_0x3b0f93){console['error'](_0x3b0f93);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 01be8eb..5d6d3df 100644 --- a/server/services/ami/trigger/integration/salesforce.js +++ b/server/services/ami/trigger/integration/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ab7=['resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','moduleSearch','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Account','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','includes','picklist','idField','toString','variable','variableName','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','error','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','WhatId','account','AccountId','lead','leadId','info','sobject','create','isNil','validateEmail','User','find','execute','length','Email'];(function(_0x2171e4,_0x28d903){var _0x41d49e=function(_0x141d62){while(--_0x141d62){_0x2171e4['push'](_0x2171e4['shift']());}};_0x41d49e(++_0x28d903);}(_0x5ab7,0xd5));var _0x75ab=function(_0x127d2c,_0x17df8a){_0x127d2c=_0x127d2c-0x0;var _0x15fa4d=_0x5ab7[_0x127d2c];return _0x15fa4d;};'use strict';var _=require(_0x75ab('0x0'));var rp=require(_0x75ab('0x1'));var moment=require(_0x75ab('0x2'));var BPromise=require(_0x75ab('0x3'));var md5=require(_0x75ab('0x4'));var jsforce=require('jsforce');var util=require(_0x75ab('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x75ab('0x6'))(_0x75ab('0x7'));config[_0x75ab('0x8')]=_[_0x75ab('0x9')](config[_0x75ab('0x8')],{'host':_0x75ab('0xa'),'port':0x18eb});var io=require(_0x75ab('0xb'))(new Redis(config[_0x75ab('0x8')]));function emit(_0x549017,_0x1d33e8,_0x46dd71){io['to'](_0x549017)[_0x75ab('0xc')](_0x1d33e8,_0x46dd71);}function getTicket(_0x270857,_0xcec9b1,_0x4335fd,_0x1a5c53,_0x5b2105,_0x43a5ac,_0x5dd8ba,_0x54a62a){var _0x5bbd62=Object[_0x75ab('0xd')]({},{'OwnerId':_0xcec9b1['id'],'Subject':intUtil[_0x75ab('0xe')](_0x1a5c53[_0x75ab('0xf')],_0x5b2105,'\x20'),'Description':intUtil[_0x75ab('0xe')](_0x1a5c53[_0x75ab('0x10')],_0x5b2105,'\x0a')},getCustomFields(_0x43a5ac,_0x5b2105));if(_0x4335fd){if(_0x1a5c53[_0x75ab('0x11')]===_0x75ab('0x12')){_0x5bbd62[_0x75ab('0x13')]=moment[_0x75ab('0x14')]();_0x5bbd62['IsReminderSet']=![];_0x5bbd62[_0x75ab('0x15')]=![];if(_0x4335fd[_0x75ab('0x16')]===_0x75ab('0x17')||_0x4335fd[_0x75ab('0x16')]==='lead'){_0x5bbd62['WhoId']=_0x4335fd['id'];}else if(_0x4335fd[_0x75ab('0x16')]==='account'){_0x5bbd62[_0x75ab('0x18')]=_0x4335fd['id'];}}else if(_0x1a5c53[_0x75ab('0x11')]==='Case'){if(_0x4335fd[_0x75ab('0x16')]===_0x75ab('0x17')){_0x5bbd62['ContactId']=_0x4335fd['id'];}else if(_0x4335fd['endUserType']===_0x75ab('0x19')){_0x5bbd62[_0x75ab('0x1a')]=_0x4335fd['id'];}else if(_0x4335fd[_0x75ab('0x16')]===_0x75ab('0x1b')&&_0x1a5c53['leadId']){_0x5bbd62[_0x1a5c53[_0x75ab('0x1c')]]=_0x4335fd['id'];}else{logger[_0x75ab('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x5dd8ba[_0x75ab('0x1e')](_0x1a5c53[_0x75ab('0x11')])[_0x75ab('0x1f')](_0x5bbd62);}function getUser(_0x5d34bc,_0x59caaa,_0x49026c){if(!_[_0x75ab('0x20')](_0x59caaa)&&intUtil[_0x75ab('0x21')](_0x59caaa)){var _0x1bf28c={'Email':_0x59caaa};var _0x188126={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x49026c['sobject'](_0x75ab('0x22'))[_0x75ab('0x23')](_0x1bf28c,_0x188126)[_0x75ab('0x24')]()['then'](function(_0x53ceb1){if(_0x53ceb1[_0x75ab('0x25')]){var _0x3d2db4=_[_0x75ab('0x23')](_0x53ceb1,function(_0x351374){return _0x351374[_0x75ab('0x26')]===_0x59caaa;});if(_0x3d2db4){logger[_0x75ab('0x1d')]('Agent\x20%s\x20found.',_0x59caaa);return BPromise[_0x75ab('0x27')]({'id':_0x3d2db4['Id'],'name':_0x3d2db4['Name']});}}else{logger[_0x75ab('0x1d')](_0x75ab('0x28'),_0x59caaa);return _0x49026c['identity']()[_0x75ab('0x29')](function(_0x41bedb){return BPromise['resolve']({'id':_0x41bedb[_0x75ab('0x2a')],'name':_0x41bedb[_0x75ab('0x2b')]});});}});}else{logger[_0x75ab('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x59caaa);return _0x49026c[_0x75ab('0x2c')]()[_0x75ab('0x29')](function(_0x1dc9ff){return BPromise[_0x75ab('0x27')]({'id':_0x1dc9ff[_0x75ab('0x2a')],'name':_0x1dc9ff[_0x75ab('0x2b')]});});}}function getEndUser(_0x3e7006,_0x1afa61,_0xbe1eba,_0x525234,_0x4ef56c){var _0x1c67b0={'$or':{'Phone':_0x525234}};var _0x309429={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x525234,_0x1afa61[_0x75ab('0x2d')]);switch(_0x1afa61[_0x75ab('0x2d')]){case'contact_lead':var _0x5712df=_['cloneDeep'](_0x1c67b0);if(_0x1afa61[_0x75ab('0x2e')]){var _0x4861a3={};_0x4861a3[_0x1afa61[_0x75ab('0x2e')]]=_0x525234;_[_0x75ab('0x2f')](_0x5712df['$or'],_0x4861a3);}return _0x4ef56c[_0x75ab('0x1e')](_0x75ab('0x30'))[_0x75ab('0x23')](_0x5712df,_0x309429)[_0x75ab('0x24')]()[_0x75ab('0x29')](function(_0x19857f){if(_0x19857f&&_0x19857f[_0x75ab('0x25')]){return _0x19857f;}else{var _0x91a352=_[_0x75ab('0x31')](_0x1c67b0);if(_0x1afa61['additionalSearchLead']){var _0x3645af={};_0x3645af[_0x1afa61[_0x75ab('0x32')]]=_0x525234;_['merge'](_0x91a352['$or'],_0x3645af);}return _0x4ef56c[_0x75ab('0x1e')](_0x75ab('0x33'))[_0x75ab('0x23')](_0x91a352,_0x309429);}});case _0x75ab('0x34'):var _0x4cb5f2=_[_0x75ab('0x31')](_0x1c67b0);if(_0x1afa61[_0x75ab('0x35')]){var _0x4861a3={};_0x4861a3[_0x1afa61[_0x75ab('0x35')]]=_0x525234;_[_0x75ab('0x2f')](_0x4cb5f2[_0x75ab('0x36')],_0x4861a3);}return _0x4ef56c[_0x75ab('0x1e')]('Account')[_0x75ab('0x23')](_0x4cb5f2,_0x309429)[_0x75ab('0x24')]()[_0x75ab('0x29')](function(_0x3d8bbd){if(_0x3d8bbd&&_0x3d8bbd[_0x75ab('0x25')]){return _0x3d8bbd;}else{var _0x178688=_['cloneDeep'](_0x1c67b0);if(_0x1afa61[_0x75ab('0x2e')]){var _0x1e675a={};_0x1e675a[_0x1afa61[_0x75ab('0x2e')]]=_0x525234;_[_0x75ab('0x2f')](_0x178688[_0x75ab('0x36')],_0x1e675a);}return _0x4ef56c[_0x75ab('0x1e')](_0x75ab('0x30'))[_0x75ab('0x23')](_0x178688,_0x309429)[_0x75ab('0x29')](function(_0x488cf9){if(_0x488cf9&&_0x488cf9[_0x75ab('0x25')]){return _0x488cf9;}else{var _0x36181d=_[_0x75ab('0x31')](_0x1c67b0);if(_0x1afa61['additionalSearchLead']){var _0x31a6d4={};_0x31a6d4[_0x1afa61['additionalSearchLead']]=_0x525234;_[_0x75ab('0x2f')](_0x36181d[_0x75ab('0x36')],_0x31a6d4);}return _0x4ef56c[_0x75ab('0x1e')]('Lead')[_0x75ab('0x23')](_0x36181d,_0x309429);}});}});case _0x75ab('0x17'):var _0x5712df=_[_0x75ab('0x31')](_0x1c67b0);if(_0x1afa61[_0x75ab('0x2e')]){var _0x4861a3={};_0x4861a3[_0x1afa61['additionalSearchContact']]=_0x525234;_[_0x75ab('0x2f')](_0x5712df['$or'],_0x4861a3);}return _0x4ef56c[_0x75ab('0x1e')](_0x75ab('0x30'))['find'](_0x5712df,_0x309429)[_0x75ab('0x24')]();case _0x75ab('0x1b'):var _0x4d64b8=_[_0x75ab('0x31')](_0x1c67b0);if(_0x1afa61[_0x75ab('0x32')]){var _0x4861a3={};_0x4861a3[_0x1afa61['additionalSearchLead']]=_0x525234;_[_0x75ab('0x2f')](_0x4d64b8[_0x75ab('0x36')],_0x4861a3);}return _0x4ef56c[_0x75ab('0x1e')](_0x75ab('0x33'))[_0x75ab('0x23')](_0x4d64b8,_0x309429);case _0x75ab('0x19'):var _0x4cb5f2=_[_0x75ab('0x31')](_0x1c67b0);if(_0x1afa61['additionalSearchAccount']){var _0x4861a3={};_0x4861a3[_0x1afa61[_0x75ab('0x35')]]=_0x525234;_[_0x75ab('0x2f')](_0x4cb5f2['$or'],_0x4861a3);}return _0x4ef56c[_0x75ab('0x1e')](_0x75ab('0x37'))[_0x75ab('0x23')](_0x4cb5f2,_0x309429);default:return null;}})[_0x75ab('0x29')](function(_0x353b57){if(_0x353b57&&_0x353b57[_0x75ab('0x25')]){var _0x281a29=_['first'](_0x353b57);if(_0x281a29){return BPromise['resolve']({'id':_0x281a29['Id'],'name':_0x281a29[_0x75ab('0x38')],'phone':_0x281a29[_0x75ab('0x39')],'endUserType':_0x281a29[_0x75ab('0x3a')][_0x75ab('0x3b')][_0x75ab('0x3c')]()});}}})[_0x75ab('0x29')](function(_0x490ef6){if(_0x490ef6){logger[_0x75ab('0x1d')](_0x75ab('0x3d'),_0x490ef6[_0x75ab('0x16')],_0x525234);return BPromise[_0x75ab('0x27')](_0x490ef6);}else{logger['info'](_0x75ab('0x3e'),_0x525234);var _0x510c02={'Phone':_0x525234};if(_0x1afa61[_0x75ab('0x3f')]){if(_0x1afa61['moduleCreate']===_0x75ab('0x17')){logger['info'](_0x75ab('0x40'),_0x525234,_0x1afa61[_0x75ab('0x3f')]);_0x510c02[_0x75ab('0x41')]=_0xbe1eba!==_0x75ab('0x42')?_0xbe1eba:util[_0x75ab('0x43')](_0x75ab('0x44'),_0x525234);}else if(_0x1afa61['moduleCreate']===_0x75ab('0x1b')){logger['info'](_0x75ab('0x40'),_0x525234,_0x1afa61['moduleCreate']);_0x510c02[_0x75ab('0x41')]=_0xbe1eba!==''?_0xbe1eba:util['format']('Caller\x20-\x20%s',_0x525234);_0x510c02[_0x75ab('0x45')]=_0x75ab('0x46');}else if(_0x1afa61['moduleCreate']==='account'){logger[_0x75ab('0x1d')](_0x75ab('0x40'),_0x525234,_0x1afa61[_0x75ab('0x3f')]);_0x510c02[_0x75ab('0x38')]=_0xbe1eba!==_0x75ab('0x42')?_0xbe1eba:util[_0x75ab('0x43')](_0x75ab('0x44'),_0x525234);}else{return null;}}return _0x4ef56c['sobject'](_[_0x75ab('0x47')](_0x1afa61[_0x75ab('0x3f')]))[_0x75ab('0x1f')](_0x510c02)[_0x75ab('0x29')](function(_0x5b84a8){return BPromise[_0x75ab('0x27')]({'id':_0x5b84a8['id'],'endUserType':_0x1afa61['moduleCreate']});});}});}function getCustomFields(_0xc64c,_0x5e4d05){var _0x15b252={};if(_0xc64c[_0x75ab('0x25')]>0x0){_['forEach'](_0xc64c,function(_0x374009){if(_[_0x75ab('0x48')](['string',_0x75ab('0x49')],_0x374009['type'])&&_0x374009[_0x75ab('0x4a')]){_0x15b252[_0x374009[_0x75ab('0x4a')]]=_0x374009['content'][_0x75ab('0x4b')]();}else if(_0x374009[_0x75ab('0x3b')]===_0x75ab('0x4c')&&_0x374009[_0x75ab('0x4d')]&&_0x374009[_0x75ab('0x4a')]){_0x5e4d05[_0x374009[_0x75ab('0x4d')]]&&(_0x15b252[_0x374009['idField']]=_0x5e4d05[_0x374009['variableName']][_0x75ab('0x4b')]());}else if(_0x374009[_0x75ab('0x3b')]==='customVariable'&&_0x374009[_0x75ab('0x4e')]&&_0x374009[_0x75ab('0x4e')][_0x75ab('0x4f')]&&_0x374009['idField']){_0x5e4d05[_0x374009[_0x75ab('0x4e')]['name']['toLowerCase']()]&&(_0x15b252[_0x374009[_0x75ab('0x4a')]]=_0x5e4d05[_0x374009[_0x75ab('0x4e')][_0x75ab('0x4f')][_0x75ab('0x3c')]()][_0x75ab('0x4b')]());}});}return _0x15b252;}function getConnection(_0x491c7d){var _0x34a7c5=_0x491c7d['password']['concat'](_0x491c7d[_0x75ab('0x50')]);var _0x27b1ce=new jsforce[(_0x75ab('0x51'))]({'oauth2':{'loginUrl':_0x491c7d[_0x75ab('0x52')]||_0x75ab('0x53'),'clientId':_0x491c7d[_0x75ab('0x54')],'clientSecret':_0x491c7d[_0x75ab('0x55')]}});return _0x27b1ce[_0x75ab('0x56')](_0x491c7d[_0x75ab('0x57')],_0x34a7c5)['then'](function(){logger[_0x75ab('0x1d')]('Connection\x20established.');return _0x27b1ce;});}exports[_0x75ab('0x58')]=function(_0x4733df,_0x4af8b9,_0x421779,_0x294343,_0x17bd83,_0x1bf37d){var _0x295b76,_0x1e0e23,_0x293116,_0x2b29ea;_0x1bf37d[_0x75ab('0x59')]=intUtil['stripTrailingSlash'](_0x1bf37d[_0x75ab('0x59')]);_0x1bf37d[_0x75ab('0x52')]=intUtil[_0x75ab('0x5a')](_0x1bf37d['remoteUri']);if(_0x17bd83&&_0x17bd83[_0x75ab('0x5b')]){logger[_0x75ab('0x1d')](_0x75ab('0x5c'),_0x75ab('0x5d'));_0x4af8b9[_0x75ab('0x5e')]=util[_0x75ab('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1bf37d[_0x75ab('0x59')],_0x4af8b9[_0x75ab('0x5f')],md5(_0x4af8b9[_0x75ab('0x5f')]));}else{_0x4af8b9['recordingURL']='';}return getConnection(_0x1bf37d)[_0x75ab('0x29')](function(_0x246945){_0x2b29ea=_0x246945;return getUser(_0x1bf37d,_0x294343[_0x75ab('0x60')],_0x2b29ea);})[_0x75ab('0x29')](function(_0x2f2a1e){_0x295b76=_0x2f2a1e;return getEndUser(_0x1bf37d,_0x421779,_0x4af8b9[_0x75ab('0x61')],_0x4af8b9[_0x75ab('0x62')],_0x2b29ea);})['then'](function(_0x141f54){_0x1e0e23=_0x141f54;return getTicket(_0x1bf37d,_0x295b76,_0x1e0e23,_0x421779,_0x4af8b9,_0x421779[_0x75ab('0x63')],_0x2b29ea,_0x75ab('0x58'));})['then'](function(_0x4d470e){_0x293116=_0x4d470e;logger['info'](_0x75ab('0x64'),_0x293116['id']);logger[_0x75ab('0x1d')](_0x75ab('0x65'),_0x293116['id'],_0x294343[_0x75ab('0x4f')],_0x1bf37d[_0x75ab('0x3b')]);switch(_0x1bf37d['type']){case _0x75ab('0x66'):emit(util[_0x75ab('0x43')]('user:%s',_0x294343[_0x75ab('0x4f')]),_0x75ab('0x67'),{'recordId':_0x293116['id']});break;case _0x75ab('0x68'):emit(util['format'](_0x75ab('0x69'),_0x294343['name']),_0x75ab('0x6a'),{'uri':util[_0x75ab('0x43')](_0x75ab('0x6b'),_0x2b29ea[_0x75ab('0x6c')],_0x293116['id'])});break;default:logger['error'](_0x75ab('0x6d'));}})[_0x75ab('0x6e')](function(_0xf41a9b){logger['error'](_0x75ab('0x5c'),_0xf41a9b);});};exports[_0x75ab('0x6f')]=function(_0x27de50,_0x54b23b,_0x185380,_0xb88f7d,_0x31db60,_0xc6f86b,_0xd9ec6a){var _0x5ddd2a,_0x5b00d4,_0x3aab15,_0x45fbd6;_0xc6f86b[_0x75ab('0x59')]=intUtil[_0x75ab('0x5a')](_0xc6f86b['serverUrl']);_0xc6f86b[_0x75ab('0x52')]=intUtil[_0x75ab('0x5a')](_0xc6f86b['remoteUri']);if(_0xd9ec6a&&_0xd9ec6a[_0x75ab('0x70')]&&_0xd9ec6a['recordingFormat']!==_0x75ab('0x71')){logger[_0x75ab('0x1d')](_0x75ab('0x72'),'Recording\x20is\x20enabled!');_0x54b23b[_0x75ab('0x5e')]=util[_0x75ab('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc6f86b[_0x75ab('0x59')],_0x54b23b['uniqueid'],md5(_0x54b23b[_0x75ab('0x5f')]));}return getConnection(_0xc6f86b)[_0x75ab('0x29')](function(_0x5a450a){_0x45fbd6=_0x5a450a;return getUser(_0xc6f86b,_0xb88f7d[_0x75ab('0x60')],_0x45fbd6);})[_0x75ab('0x29')](function(_0x10e179){_0x5ddd2a=_0x10e179;return getEndUser(_0xc6f86b,_0x185380,_0x54b23b[_0x75ab('0x73')],_0x54b23b[_0x75ab('0x74')],_0x45fbd6);})[_0x75ab('0x29')](function(_0x112b07){_0x5b00d4=_0x112b07;return getTicket(_0xc6f86b,_0x5ddd2a,_0x5b00d4,_0x185380,_0x54b23b,_0x185380[_0x75ab('0x63')],_0x45fbd6,_0x75ab('0x6f'));})[_0x75ab('0x29')](function(_0x5de79b){_0x3aab15=_0x5de79b;logger[_0x75ab('0x1d')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3aab15['id']);logger[_0x75ab('0x1d')](_0x75ab('0x75'),_0x3aab15['id'],_0xb88f7d[_0x75ab('0x4f')],_0xc6f86b[_0x75ab('0x3b')]);switch(_0xc6f86b[_0x75ab('0x3b')]){case _0x75ab('0x66'):emit(util[_0x75ab('0x43')](_0x75ab('0x69'),_0xb88f7d[_0x75ab('0x4f')]),'trigger:salesforce:display',{'recordId':_0x3aab15['id']});break;case'newTab':emit(util['format'](_0x75ab('0x69'),_0xb88f7d['name']),'trigger:browser:url',{'uri':util[_0x75ab('0x43')](_0x75ab('0x6b'),_0x45fbd6[_0x75ab('0x6c')],_0x3aab15['id'])});break;default:logger[_0x75ab('0x76')](_0x75ab('0x72'),_0x75ab('0x77'));}})['catch'](function(_0x50027d){logger[_0x75ab('0x76')](_0x75ab('0x72'),_0x50027d);});};exports[_0x75ab('0x78')]=function(_0x3681c0,_0x267a3b,_0xdd3549,_0x41b709,_0x9fb927,_0xa6cdf8){var _0x13f8e9,_0x5205b7,_0x4233ca,_0x347097;_0xa6cdf8[_0x75ab('0x59')]=intUtil[_0x75ab('0x5a')](_0xa6cdf8[_0x75ab('0x59')]);_0xa6cdf8['remoteUri']=intUtil[_0x75ab('0x5a')](_0xa6cdf8[_0x75ab('0x52')]);if(_0x9fb927&&_0x9fb927['monitor_format']){logger['info']('['+_0x267a3b[_0x75ab('0x79')][_0x75ab('0x7a')]()+']','Recording\x20is\x20enabled!');_0x267a3b[_0x75ab('0x5e')]=util[_0x75ab('0x43')](_0x75ab('0x7b'),_0xa6cdf8[_0x75ab('0x59')],_0x267a3b[_0x75ab('0x5f')],md5(_0x267a3b[_0x75ab('0x5f')]));}else{_0x267a3b[_0x75ab('0x5e')]='';}return getConnection(_0xa6cdf8)[_0x75ab('0x29')](function(_0x172902){_0x347097=_0x172902;if(!_[_0x75ab('0x20')](_0x41b709)){return getUser(_0xa6cdf8,_0x41b709['name'],_0x347097);}else{return getUser(_0xa6cdf8,null,_0x347097);}})[_0x75ab('0x29')](function(_0x28f0d5){_0x13f8e9=_0x28f0d5;return getEndUser(_0xa6cdf8,_0xdd3549,_0x267a3b['calleridname'],_0x267a3b['calleridnum'],_0x347097);})[_0x75ab('0x29')](function(_0x3cfda1){_0x5205b7=_0x3cfda1;return getTicket(_0xa6cdf8,_0x13f8e9,_0x5205b7,_0xdd3549,_0x267a3b,_0xdd3549['Fields'],_0x347097);})[_0x75ab('0x29')](function(_0x1862fd){_0x4233ca=_0x1862fd;logger[_0x75ab('0x1d')]('['+_0x267a3b[_0x75ab('0x79')][_0x75ab('0x7a')]()+_0x75ab('0x7c'),_0x4233ca['id']);logger[_0x75ab('0x1d')]('['+_0x267a3b[_0x75ab('0x79')][_0x75ab('0x7a')]()+_0x75ab('0x7d'),_0xa6cdf8[_0x75ab('0x3b')]);})[_0x75ab('0x6e')](function(_0x5d412e){logger[_0x75ab('0x76')]('['+_0x267a3b['lastevent'][_0x75ab('0x7a')]()+']',_0x5d412e);});}; \ No newline at end of file +var _0x7d9a=['queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','instanceUrl','[OUTBOUND]','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','WhatId','ticketType','Case','ContactId','account','AccountId','lead','leadId','info','sobject','create','isNil','validateEmail','User','find','execute','then','Email','Agent\x20%s\x20found.','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','length','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','upperFirst','includes','picklist','idField','toString','variable','variableName','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','clientSecret','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x7d9a,0x114));var _0xa7d9=function(_0x462923,_0x292368){_0x462923=_0x462923-0x0;var _0x5d5707=_0x7d9a[_0x462923];return _0x5d5707;};'use strict';var _=require(_0xa7d9('0x0'));var rp=require(_0xa7d9('0x1'));var moment=require(_0xa7d9('0x2'));var BPromise=require('bluebird');var md5=require(_0xa7d9('0x3'));var jsforce=require(_0xa7d9('0x4'));var util=require(_0xa7d9('0x5'));var Redis=require(_0xa7d9('0x6'));var intUtil=require(_0xa7d9('0x7'));var config=require(_0xa7d9('0x8'));var logger=require('../../../../config/logger')(_0xa7d9('0x9'));config[_0xa7d9('0xa')]=_[_0xa7d9('0xb')](config[_0xa7d9('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xa7d9('0xc'))(new Redis(config[_0xa7d9('0xa')]));function emit(_0x873b4d,_0x4de00,_0x1028f5){io['to'](_0x873b4d)[_0xa7d9('0xd')](_0x4de00,_0x1028f5);}function getTicket(_0x2b4976,_0x37ad17,_0x2cdf4b,_0x40473d,_0x2e6aad,_0x3fcf51,_0xeb0ffb,_0x51987f){var _0x4ffa63=Object[_0xa7d9('0xe')]({},{'OwnerId':_0x37ad17['id'],'Subject':intUtil['getString'](_0x40473d[_0xa7d9('0xf')],_0x2e6aad,'\x20'),'Description':intUtil[_0xa7d9('0x10')](_0x40473d[_0xa7d9('0x11')],_0x2e6aad,'\x0a')},getCustomFields(_0x3fcf51,_0x2e6aad));if(_0x2cdf4b){if(_0x40473d['ticketType']===_0xa7d9('0x12')){_0x4ffa63[_0xa7d9('0x13')]=moment[_0xa7d9('0x14')]();_0x4ffa63[_0xa7d9('0x15')]=![];_0x4ffa63[_0xa7d9('0x16')]=![];if(_0x2cdf4b[_0xa7d9('0x17')]===_0xa7d9('0x18')||_0x2cdf4b[_0xa7d9('0x17')]==='lead'){_0x4ffa63[_0xa7d9('0x19')]=_0x2cdf4b['id'];}else if(_0x2cdf4b[_0xa7d9('0x17')]==='account'){_0x4ffa63[_0xa7d9('0x1a')]=_0x2cdf4b['id'];}}else if(_0x40473d[_0xa7d9('0x1b')]===_0xa7d9('0x1c')){if(_0x2cdf4b[_0xa7d9('0x17')]===_0xa7d9('0x18')){_0x4ffa63[_0xa7d9('0x1d')]=_0x2cdf4b['id'];}else if(_0x2cdf4b[_0xa7d9('0x17')]===_0xa7d9('0x1e')){_0x4ffa63[_0xa7d9('0x1f')]=_0x2cdf4b['id'];}else if(_0x2cdf4b[_0xa7d9('0x17')]===_0xa7d9('0x20')&&_0x40473d[_0xa7d9('0x21')]){_0x4ffa63[_0x40473d[_0xa7d9('0x21')]]=_0x2cdf4b['id'];}else{logger[_0xa7d9('0x22')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0xeb0ffb[_0xa7d9('0x23')](_0x40473d[_0xa7d9('0x1b')])[_0xa7d9('0x24')](_0x4ffa63);}function getUser(_0xa85b99,_0x3a4519,_0x8d0e1e){if(!_[_0xa7d9('0x25')](_0x3a4519)&&intUtil[_0xa7d9('0x26')](_0x3a4519)){var _0x5bcc68={'Email':_0x3a4519};var _0x515b03={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x8d0e1e[_0xa7d9('0x23')](_0xa7d9('0x27'))[_0xa7d9('0x28')](_0x5bcc68,_0x515b03)[_0xa7d9('0x29')]()[_0xa7d9('0x2a')](function(_0x298d4b){if(_0x298d4b['length']){var _0x5d9a71=_['find'](_0x298d4b,function(_0x18edaa){return _0x18edaa[_0xa7d9('0x2b')]===_0x3a4519;});if(_0x5d9a71){logger[_0xa7d9('0x22')](_0xa7d9('0x2c'),_0x3a4519);return BPromise['resolve']({'id':_0x5d9a71['Id'],'name':_0x5d9a71['Name']});}}else{logger[_0xa7d9('0x22')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3a4519);return _0x8d0e1e[_0xa7d9('0x2d')]()[_0xa7d9('0x2a')](function(_0x19d4ed){return BPromise['resolve']({'id':_0x19d4ed[_0xa7d9('0x2e')],'name':_0x19d4ed[_0xa7d9('0x2f')]});});}});}else{logger[_0xa7d9('0x22')](_0xa7d9('0x30'),_0x3a4519);return _0x8d0e1e[_0xa7d9('0x2d')]()['then'](function(_0x4bb720){return BPromise['resolve']({'id':_0x4bb720['user_id'],'name':_0x4bb720['display_name']});});}}function getEndUser(_0x136983,_0x19b543,_0x2ad739,_0x52d344,_0x101523){var _0x1b886f={'$or':{'Phone':_0x52d344}};var _0x10a0b7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa7d9('0x31')]()['then'](function(){logger[_0xa7d9('0x22')](_0xa7d9('0x32'),_0x52d344,_0x19b543['moduleSearch']);switch(_0x19b543[_0xa7d9('0x33')]){case _0xa7d9('0x34'):var _0x2f9cef=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543['additionalSearchContact']){var _0x67d1a1={};_0x67d1a1[_0x19b543[_0xa7d9('0x36')]]=_0x52d344;_[_0xa7d9('0x37')](_0x2f9cef['$or'],_0x67d1a1);}return _0x101523[_0xa7d9('0x23')](_0xa7d9('0x38'))['find'](_0x2f9cef,_0x10a0b7)['execute']()[_0xa7d9('0x2a')](function(_0x135a1e){if(_0x135a1e&&_0x135a1e[_0xa7d9('0x39')]){return _0x135a1e;}else{var _0x3a6c1d=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543[_0xa7d9('0x3a')]){var _0x2e8d2b={};_0x2e8d2b[_0x19b543[_0xa7d9('0x3a')]]=_0x52d344;_[_0xa7d9('0x37')](_0x3a6c1d[_0xa7d9('0x3b')],_0x2e8d2b);}return _0x101523[_0xa7d9('0x23')](_0xa7d9('0x3c'))['find'](_0x3a6c1d,_0x10a0b7);}});case _0xa7d9('0x3d'):var _0x8d4ea2=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543['additionalSearchAccount']){var _0x67d1a1={};_0x67d1a1[_0x19b543['additionalSearchAccount']]=_0x52d344;_[_0xa7d9('0x37')](_0x8d4ea2['$or'],_0x67d1a1);}return _0x101523[_0xa7d9('0x23')]('Account')[_0xa7d9('0x28')](_0x8d4ea2,_0x10a0b7)['execute']()['then'](function(_0x259db6){if(_0x259db6&&_0x259db6[_0xa7d9('0x39')]){return _0x259db6;}else{var _0x39a650=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543[_0xa7d9('0x36')]){var _0x5344e0={};_0x5344e0[_0x19b543[_0xa7d9('0x36')]]=_0x52d344;_[_0xa7d9('0x37')](_0x39a650['$or'],_0x5344e0);}return _0x101523[_0xa7d9('0x23')](_0xa7d9('0x38'))[_0xa7d9('0x28')](_0x39a650,_0x10a0b7)[_0xa7d9('0x2a')](function(_0x3f9fed){if(_0x3f9fed&&_0x3f9fed[_0xa7d9('0x39')]){return _0x3f9fed;}else{var _0x3131f0=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543['additionalSearchLead']){var _0x195bbc={};_0x195bbc[_0x19b543[_0xa7d9('0x3a')]]=_0x52d344;_[_0xa7d9('0x37')](_0x3131f0[_0xa7d9('0x3b')],_0x195bbc);}return _0x101523['sobject'](_0xa7d9('0x3c'))[_0xa7d9('0x28')](_0x3131f0,_0x10a0b7);}});}});case _0xa7d9('0x18'):var _0x2f9cef=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543[_0xa7d9('0x36')]){var _0x67d1a1={};_0x67d1a1[_0x19b543[_0xa7d9('0x36')]]=_0x52d344;_[_0xa7d9('0x37')](_0x2f9cef[_0xa7d9('0x3b')],_0x67d1a1);}return _0x101523[_0xa7d9('0x23')]('Contact')['find'](_0x2f9cef,_0x10a0b7)[_0xa7d9('0x29')]();case'lead':var _0x2e7148=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543[_0xa7d9('0x3a')]){var _0x67d1a1={};_0x67d1a1[_0x19b543[_0xa7d9('0x3a')]]=_0x52d344;_[_0xa7d9('0x37')](_0x2e7148[_0xa7d9('0x3b')],_0x67d1a1);}return _0x101523[_0xa7d9('0x23')](_0xa7d9('0x3c'))[_0xa7d9('0x28')](_0x2e7148,_0x10a0b7);case'account':var _0x8d4ea2=_['cloneDeep'](_0x1b886f);if(_0x19b543[_0xa7d9('0x3e')]){var _0x67d1a1={};_0x67d1a1[_0x19b543['additionalSearchAccount']]=_0x52d344;_['merge'](_0x8d4ea2['$or'],_0x67d1a1);}return _0x101523[_0xa7d9('0x23')](_0xa7d9('0x3f'))[_0xa7d9('0x28')](_0x8d4ea2,_0x10a0b7);default:return null;}})[_0xa7d9('0x2a')](function(_0x468807){if(_0x468807&&_0x468807['length']){var _0x28b0ce=_[_0xa7d9('0x40')](_0x468807);if(_0x28b0ce){return BPromise[_0xa7d9('0x31')]({'id':_0x28b0ce['Id'],'name':_0x28b0ce[_0xa7d9('0x41')],'phone':_0x28b0ce[_0xa7d9('0x42')],'endUserType':_0x28b0ce['attributes'][_0xa7d9('0x43')]['toLowerCase']()});}}})['then'](function(_0x3a66c7){if(_0x3a66c7){logger[_0xa7d9('0x22')](_0xa7d9('0x44'),_0x3a66c7[_0xa7d9('0x17')],_0x52d344);return BPromise['resolve'](_0x3a66c7);}else{logger[_0xa7d9('0x22')](_0xa7d9('0x45'),_0x52d344);var _0x3de4cb={'Phone':_0x52d344};if(_0x19b543[_0xa7d9('0x46')]){if(_0x19b543[_0xa7d9('0x46')]==='contact'){logger[_0xa7d9('0x22')](_0xa7d9('0x47'),_0x52d344,_0x19b543[_0xa7d9('0x46')]);_0x3de4cb['LastName']=_0x2ad739!==_0xa7d9('0x48')?_0x2ad739:util[_0xa7d9('0x49')](_0xa7d9('0x4a'),_0x52d344);}else if(_0x19b543[_0xa7d9('0x46')]===_0xa7d9('0x20')){logger[_0xa7d9('0x22')](_0xa7d9('0x47'),_0x52d344,_0x19b543['moduleCreate']);_0x3de4cb[_0xa7d9('0x4b')]=_0x2ad739!==_0xa7d9('0x48')?_0x2ad739:util['format'](_0xa7d9('0x4a'),_0x52d344);_0x3de4cb['Company']='No\x20Company';}else if(_0x19b543[_0xa7d9('0x46')]===_0xa7d9('0x1e')){logger[_0xa7d9('0x22')](_0xa7d9('0x47'),_0x52d344,_0x19b543[_0xa7d9('0x46')]);_0x3de4cb[_0xa7d9('0x41')]=_0x2ad739!==_0xa7d9('0x48')?_0x2ad739:util[_0xa7d9('0x49')](_0xa7d9('0x4a'),_0x52d344);}else{return null;}}return _0x101523[_0xa7d9('0x23')](_[_0xa7d9('0x4c')](_0x19b543[_0xa7d9('0x46')]))[_0xa7d9('0x24')](_0x3de4cb)[_0xa7d9('0x2a')](function(_0x1d2978){return BPromise[_0xa7d9('0x31')]({'id':_0x1d2978['id'],'endUserType':_0x19b543[_0xa7d9('0x46')]});});}});}function getCustomFields(_0x469a5c,_0x3db162){var _0x49e28e={};if(_0x469a5c[_0xa7d9('0x39')]>0x0){_['forEach'](_0x469a5c,function(_0x3ee243){if(_[_0xa7d9('0x4d')](['string',_0xa7d9('0x4e')],_0x3ee243[_0xa7d9('0x43')])&&_0x3ee243[_0xa7d9('0x4f')]){_0x49e28e[_0x3ee243[_0xa7d9('0x4f')]]=_0x3ee243['content'][_0xa7d9('0x50')]();}else if(_0x3ee243[_0xa7d9('0x43')]===_0xa7d9('0x51')&&_0x3ee243[_0xa7d9('0x52')]&&_0x3ee243[_0xa7d9('0x4f')]){_0x3db162[_0x3ee243[_0xa7d9('0x52')]]&&(_0x49e28e[_0x3ee243['idField']]=_0x3db162[_0x3ee243[_0xa7d9('0x52')]][_0xa7d9('0x50')]());}else if(_0x3ee243['type']==='customVariable'&&_0x3ee243[_0xa7d9('0x53')]&&_0x3ee243[_0xa7d9('0x53')][_0xa7d9('0x54')]&&_0x3ee243[_0xa7d9('0x4f')]){_0x3db162[_0x3ee243[_0xa7d9('0x53')]['name'][_0xa7d9('0x55')]()]&&(_0x49e28e[_0x3ee243[_0xa7d9('0x4f')]]=_0x3db162[_0x3ee243['Variable'][_0xa7d9('0x54')][_0xa7d9('0x55')]()][_0xa7d9('0x50')]());}});}return _0x49e28e;}function getConnection(_0x21542a){var _0x357f87=_0x21542a[_0xa7d9('0x56')]['concat'](_0x21542a[_0xa7d9('0x57')]);var _0x2bc77c=new jsforce[(_0xa7d9('0x58'))]({'oauth2':{'loginUrl':_0x21542a[_0xa7d9('0x59')]||'https://login.salesforce.com','clientId':_0x21542a['clientId'],'clientSecret':_0x21542a[_0xa7d9('0x5a')]}});return _0x2bc77c['login'](_0x21542a['username'],_0x357f87)[_0xa7d9('0x2a')](function(){logger[_0xa7d9('0x22')](_0xa7d9('0x5b'));return _0x2bc77c;});}exports['queue']=function(_0x525816,_0x24aaee,_0x5b9a04,_0x31ee89,_0x23a443,_0x2cb89e){var _0x384fd0,_0x2ef5e7,_0x728aed,_0x3ebab9;_0x2cb89e['serverUrl']=intUtil[_0xa7d9('0x5c')](_0x2cb89e[_0xa7d9('0x5d')]);_0x2cb89e[_0xa7d9('0x59')]=intUtil[_0xa7d9('0x5c')](_0x2cb89e[_0xa7d9('0x59')]);if(_0x23a443&&_0x23a443[_0xa7d9('0x5e')]){logger[_0xa7d9('0x22')](_0xa7d9('0x5f'),_0xa7d9('0x60'));_0x24aaee[_0xa7d9('0x61')]=util[_0xa7d9('0x49')](_0xa7d9('0x62'),_0x2cb89e['serverUrl'],_0x24aaee[_0xa7d9('0x63')],md5(_0x24aaee['uniqueid']));}else{_0x24aaee['recordingURL']='';}return getConnection(_0x2cb89e)[_0xa7d9('0x2a')](function(_0x133603){_0x3ebab9=_0x133603;return getUser(_0x2cb89e,_0x31ee89[_0xa7d9('0x64')],_0x3ebab9);})[_0xa7d9('0x2a')](function(_0x31dbc3){_0x384fd0=_0x31dbc3;return getEndUser(_0x2cb89e,_0x5b9a04,_0x24aaee[_0xa7d9('0x65')],_0x24aaee['calleridnum'],_0x3ebab9);})[_0xa7d9('0x2a')](function(_0xddb00f){_0x2ef5e7=_0xddb00f;return getTicket(_0x2cb89e,_0x384fd0,_0x2ef5e7,_0x5b9a04,_0x24aaee,_0x5b9a04['Fields'],_0x3ebab9,_0xa7d9('0x66'));})[_0xa7d9('0x2a')](function(_0x36d230){_0x728aed=_0x36d230;logger[_0xa7d9('0x22')](_0xa7d9('0x67'),_0x728aed['id']);logger[_0xa7d9('0x22')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x728aed['id'],_0x31ee89[_0xa7d9('0x54')],_0x2cb89e['type']);switch(_0x2cb89e[_0xa7d9('0x43')]){case _0xa7d9('0x68'):emit(util['format'](_0xa7d9('0x69'),_0x31ee89[_0xa7d9('0x54')]),'trigger:salesforce:display',{'recordId':_0x728aed['id']});break;case'newTab':emit(util[_0xa7d9('0x49')](_0xa7d9('0x69'),_0x31ee89[_0xa7d9('0x54')]),_0xa7d9('0x6a'),{'uri':util['format'](_0xa7d9('0x6b'),_0x3ebab9['instanceUrl'],_0x728aed['id'])});break;default:logger[_0xa7d9('0x6c')](_0xa7d9('0x6d'));}})[_0xa7d9('0x6e')](function(_0x5a7032){logger[_0xa7d9('0x6c')]('[QUEUE]',_0x5a7032);});};exports['outbound']=function(_0x369278,_0xc01bbc,_0x44c214,_0x5ea58c,_0x538504,_0x4ac7ff,_0x394ae7){var _0x29c6cf,_0x4138a7,_0x1cafb8,_0x7cf374;_0x4ac7ff[_0xa7d9('0x5d')]=intUtil['stripTrailingSlash'](_0x4ac7ff[_0xa7d9('0x5d')]);_0x4ac7ff[_0xa7d9('0x59')]=intUtil[_0xa7d9('0x5c')](_0x4ac7ff['remoteUri']);if(_0x394ae7&&_0x394ae7[_0xa7d9('0x6f')]&&_0x394ae7[_0xa7d9('0x6f')]!==_0xa7d9('0x70')){logger['info']('[OUTBOUND]',_0xa7d9('0x60'));_0xc01bbc[_0xa7d9('0x61')]=util[_0xa7d9('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ac7ff['serverUrl'],_0xc01bbc[_0xa7d9('0x63')],md5(_0xc01bbc['uniqueid']));}return getConnection(_0x4ac7ff)[_0xa7d9('0x2a')](function(_0xa3bb9){_0x7cf374=_0xa3bb9;return getUser(_0x4ac7ff,_0x5ea58c[_0xa7d9('0x64')],_0x7cf374);})[_0xa7d9('0x2a')](function(_0xeee298){_0x29c6cf=_0xeee298;return getEndUser(_0x4ac7ff,_0x44c214,_0xc01bbc[_0xa7d9('0x71')],_0xc01bbc[_0xa7d9('0x72')],_0x7cf374);})['then'](function(_0x8019d2){_0x4138a7=_0x8019d2;return getTicket(_0x4ac7ff,_0x29c6cf,_0x4138a7,_0x44c214,_0xc01bbc,_0x44c214['Fields'],_0x7cf374,'outbound');})[_0xa7d9('0x2a')](function(_0x1ea47b){_0x1cafb8=_0x1ea47b;logger[_0xa7d9('0x22')](_0xa7d9('0x73'),_0x1cafb8['id']);logger[_0xa7d9('0x22')](_0xa7d9('0x74'),_0x1cafb8['id'],_0x5ea58c[_0xa7d9('0x54')],_0x4ac7ff[_0xa7d9('0x43')]);switch(_0x4ac7ff[_0xa7d9('0x43')]){case _0xa7d9('0x68'):emit(util[_0xa7d9('0x49')](_0xa7d9('0x69'),_0x5ea58c[_0xa7d9('0x54')]),_0xa7d9('0x75'),{'recordId':_0x1cafb8['id']});break;case _0xa7d9('0x76'):emit(util[_0xa7d9('0x49')](_0xa7d9('0x69'),_0x5ea58c[_0xa7d9('0x54')]),'trigger:browser:url',{'uri':util['format'](_0xa7d9('0x6b'),_0x7cf374[_0xa7d9('0x77')],_0x1cafb8['id'])});break;default:logger[_0xa7d9('0x6c')](_0xa7d9('0x78'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x3aeb25){logger[_0xa7d9('0x6c')](_0xa7d9('0x78'),_0x3aeb25);});};exports['unmanaged']=function(_0x52856a,_0x470398,_0x41589b,_0xcb5df4,_0x3ec21f,_0x5e89bf){var _0x3cd6cc,_0x16e962,_0x2ca7f1,_0x267c99;_0x5e89bf[_0xa7d9('0x5d')]=intUtil[_0xa7d9('0x5c')](_0x5e89bf['serverUrl']);_0x5e89bf[_0xa7d9('0x59')]=intUtil[_0xa7d9('0x5c')](_0x5e89bf[_0xa7d9('0x59')]);if(_0x3ec21f&&_0x3ec21f[_0xa7d9('0x5e')]){logger[_0xa7d9('0x22')]('['+_0x470398[_0xa7d9('0x79')][_0xa7d9('0x7a')]()+']',_0xa7d9('0x60'));_0x470398[_0xa7d9('0x61')]=util[_0xa7d9('0x49')](_0xa7d9('0x62'),_0x5e89bf[_0xa7d9('0x5d')],_0x470398[_0xa7d9('0x63')],md5(_0x470398[_0xa7d9('0x63')]));}else{_0x470398[_0xa7d9('0x61')]='';}return getConnection(_0x5e89bf)[_0xa7d9('0x2a')](function(_0x53d0dc){_0x267c99=_0x53d0dc;if(!_['isNil'](_0xcb5df4)){return getUser(_0x5e89bf,_0xcb5df4['name'],_0x267c99);}else{return getUser(_0x5e89bf,null,_0x267c99);}})['then'](function(_0xb1d04){_0x3cd6cc=_0xb1d04;return getEndUser(_0x5e89bf,_0x41589b,_0x470398['calleridname'],_0x470398[_0xa7d9('0x7b')],_0x267c99);})[_0xa7d9('0x2a')](function(_0x4fa7f3){_0x16e962=_0x4fa7f3;return getTicket(_0x5e89bf,_0x3cd6cc,_0x16e962,_0x41589b,_0x470398,_0x41589b['Fields'],_0x267c99);})['then'](function(_0x3b278a){_0x2ca7f1=_0x3b278a;logger['info']('['+_0x470398['lastevent']['toUpperCase']()+_0xa7d9('0x7c'),_0x2ca7f1['id']);logger[_0xa7d9('0x22')]('['+_0x470398['lastevent']['toUpperCase']()+_0xa7d9('0x7d'),_0x5e89bf['type']);})[_0xa7d9('0x6e')](function(_0x4289f5){logger[_0xa7d9('0x6c')]('['+_0x470398[_0xa7d9('0x79')][_0xa7d9('0x7a')]()+']',_0x4289f5);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 82b8148..9f093f5 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87cc=['%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','trigger:browser:url','username','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','sys_id','info','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminId','adminEmail','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','toLowerCase','content','idField','toString','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'];(function(_0x459439,_0x35ca27){var _0x2a0a27=function(_0x1cc2e0){while(--_0x1cc2e0){_0x459439['push'](_0x459439['shift']());}};_0x2a0a27(++_0x35ca27);}(_0x87cc,0x15c));var _0xc87c=function(_0x162e84,_0xa5ef5b){_0x162e84=_0x162e84-0x0;var _0x3b9523=_0x87cc[_0x162e84];return _0x3b9523;};'use strict';var _=require(_0xc87c('0x0'));var Promise=require(_0xc87c('0x1'));var rp=require(_0xc87c('0x2'));var util=require(_0xc87c('0x3'));var md5=require(_0xc87c('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xc87c('0x5'));var logger=require('../../../../config/logger')(_0xc87c('0x6'));config[_0xc87c('0x7')]=_[_0xc87c('0x8')](config[_0xc87c('0x7')],{'host':_0xc87c('0x9'),'port':0x18eb});var io=require(_0xc87c('0xa'))(new Redis(config['redis']));function getAdminUser(_0x5eb881,_0x39f25a,_0x2c8a46,_0x3969f7,_0x5bad24,_0x31e872){return new Promise(function(_0x5b74dc,_0x1ad282){var _0x24ecb6={'method':_0xc87c('0xb'),'uri':_0x3969f7+_0xc87c('0xc')+'&'+_0x5bad24+'&'+_0x31e872,'auth':_0x39f25a,'json':!![]};return rp(_0x24ecb6)[_0xc87c('0xd')](function(_0x5ecee8){if(_0x5ecee8[_0xc87c('0xe')]['length']>0x0){_0x2c8a46['adminId']=_0x5ecee8[_0xc87c('0xe')][0x0][_0xc87c('0xf')];}logger[_0xc87c('0x10')]('['+[_0x5eb881['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x2c8a46);_0x5b74dc(_0x2c8a46);})[_0xc87c('0x11')](function(_0x1cafae){logger[_0xc87c('0x12')]('['+[_0x5eb881[_0xc87c('0x13')]()]+']',_0x1cafae['message']);_0x1ad282(_0x1cafae[_0xc87c('0x14')]);});});}function getUser(_0x34be78,_0x5e65f6,_0x54538e,_0x25311f,_0x14f385){return function(_0x599fe1){logger['info']('['+[_0x34be78[_0xc87c('0x13')]()]+_0xc87c('0x15'),_0x599fe1);return new Promise(function(_0x3b7265,_0xc9bb2){if(intUtil[_0xc87c('0x16')](_0x599fe1[_0xc87c('0x17')])){var _0x3cc563={'method':_0xc87c('0xb'),'uri':_0x54538e+_0xc87c('0x18')+_0x599fe1[_0xc87c('0x17')]+'&'+_0x25311f+'&'+_0x14f385,'auth':_0x5e65f6,'json':!![]};logger[_0xc87c('0x10')]('['+[_0x34be78[_0xc87c('0x13')]()]+_0xc87c('0x19'),_0x3cc563);return rp(_0x3cc563)[_0xc87c('0xd')](function(_0x53864c){logger[_0xc87c('0x10')]('['+[_0x34be78[_0xc87c('0x13')]()]+_0xc87c('0x1a'),_0x53864c);if(_0x53864c['result'][_0xc87c('0x1b')]>0x0&&String(_0x53864c[_0xc87c('0xe')][0x0][_0xc87c('0x1c')])===_0xc87c('0x1d')){_0x599fe1[_0xc87c('0x1e')]=_0x53864c[_0xc87c('0xe')][0x0][_0xc87c('0xf')];}else{_0x599fe1['userId']=_0x599fe1[_0xc87c('0x1f')];_0x599fe1[_0xc87c('0x17')]=_0x599fe1[_0xc87c('0x20')];}logger[_0xc87c('0x10')]('['+[_0x34be78[_0xc87c('0x13')]()]+'],\x20getUser\x20crm',_0x599fe1);_0x3b7265(_0x599fe1);})[_0xc87c('0x11')](function(_0x5dd06b){logger[_0xc87c('0x12')]('['+[_0x34be78[_0xc87c('0x13')]()]+']',_0x5dd06b['message']);_0xc9bb2(_0x5dd06b['message']);});}else{logger['info']('['+[_0x34be78['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x599fe1[_0xc87c('0x1e')]=_0x599fe1[_0xc87c('0x1f')];_0x599fe1[_0xc87c('0x17')]=_0x599fe1['adminEmail'];_0x3b7265(_0x599fe1);}});};}function createEndUser(_0x3915e3,_0x254791,_0x4e59ff,_0x4d9ca0,_0x45f4ba){logger[_0xc87c('0x10')]('['+[_0x3915e3[_0xc87c('0x13')]()]+'],\x20createEndUser\x20input\x20crm',_0x4e59ff);return new Promise(function(_0xcfae8b,_0x1dcc68){var _0x5eb3ea={'method':_0xc87c('0x21'),'uri':_0x4d9ca0+_0xc87c('0x22')+_0x45f4ba,'body':{'user_name':_0x4e59ff[_0xc87c('0x23')],'roles':_0xc87c('0x24'),'first_name':_0x4e59ff[_0xc87c('0x23')],'active':_0xc87c('0x1d'),'date_format':_0xc87c('0x25'),'phone':_0x4e59ff[_0xc87c('0x23')]},'auth':_0x254791,'json':!![]};return rp(_0x5eb3ea)[_0xc87c('0xd')](function(_0x2842d6){logger[_0xc87c('0x10')]('['+[_0x3915e3[_0xc87c('0x13')]()]+_0xc87c('0x26'),_0x2842d6[_0xc87c('0xe')]);_0x4e59ff['endUserId']=_0x2842d6[_0xc87c('0xe')][_0xc87c('0xf')];_0xcfae8b(_0x4e59ff);})['catch'](function(_0x56c732){logger[_0xc87c('0x12')]('['+[_0x3915e3['toUpperCase']()]+']',_0x56c732['message']);_0x1dcc68(_0x56c732[_0xc87c('0x14')]);});});}function getEndUser(_0x991136,_0xf52eb1,_0x498eeb,_0x33e617,_0x17ba8d){return function(_0x366652){logger[_0xc87c('0x10')]('['+[_0x991136[_0xc87c('0x13')]()]+_0xc87c('0x27'),_0x366652);return new Promise(function(_0x2ec4bd,_0x36a7f8){var _0xa0b3bf={'method':_0xc87c('0xb'),'uri':_0x498eeb+'sys_user?sysparm_query=phone%3D'+_0x366652[_0xc87c('0x23')]+'&'+_0x33e617+'&'+_0x17ba8d,'auth':_0xf52eb1,'json':!![]};return rp(_0xa0b3bf)[_0xc87c('0xd')](function(_0x4a3b9c){if(_0x4a3b9c[_0xc87c('0xe')]['length']>0x0){_0x366652['endUserId']=_0x4a3b9c[_0xc87c('0xe')][0x0][_0xc87c('0xf')];logger[_0xc87c('0x10')]('['+[_0x991136[_0xc87c('0x13')]()]+'],\x20getEndUser\x20crm',_0x366652);_0x2ec4bd(_0x366652);}else{return createEndUser(_0x991136,_0xf52eb1,_0x366652,_0x498eeb,_0x33e617)[_0xc87c('0xd')](function(_0x17bb89){logger[_0xc87c('0x10')]('['+[_0x991136['toUpperCase']()]+_0xc87c('0x28'),_0x17bb89);_0x2ec4bd(_0x17bb89);});}})[_0xc87c('0x11')](function(_0x3d0c04){logger['error']('['+[_0x991136[_0xc87c('0x13')]()]+']',_0x3d0c04[_0xc87c('0x14')]);_0x36a7f8(_0x3d0c04['message']);});});};}function getCustomFields(_0x4b987d,_0x1b0162){var _0x46ffcf={};if(_0x4b987d['length']>0x0){_[_0xc87c('0x29')](_0x4b987d,function(_0x17c0f){if(_[_0xc87c('0x2a')]([_0xc87c('0x2b'),_0xc87c('0x2c')],_0x17c0f[_0xc87c('0x2d')])&&_0x17c0f['nameField']&&!_0x17c0f[_0xc87c('0x2e')]){_0x46ffcf[_0x17c0f['nameField'][_0xc87c('0x2f')]()]=_0x17c0f[_0xc87c('0x30')]['toString']();}else if(_[_0xc87c('0x2a')](['string',_0xc87c('0x2c')],_0x17c0f[_0xc87c('0x2d')])&&_0x17c0f[_0xc87c('0x31')]&&_0x17c0f['customField']){_0x46ffcf[_0x17c0f['idField'][_0xc87c('0x2f')]()]=_0x17c0f[_0xc87c('0x30')][_0xc87c('0x32')]();}else if(_0x17c0f[_0xc87c('0x2d')]===_0xc87c('0x33')&&_0x17c0f['variableName']&&_0x17c0f[_0xc87c('0x31')]&&_0x17c0f[_0xc87c('0x2e')]){_0x46ffcf[_0x17c0f[_0xc87c('0x31')][_0xc87c('0x2f')]()]=_0x1b0162[_0x17c0f['variableName']][_0xc87c('0x32')]();}else if(_0x17c0f['type']===_0xc87c('0x34')&&_0x17c0f[_0xc87c('0x35')]&&_0x17c0f[_0xc87c('0x35')][_0xc87c('0x36')]&&_0x17c0f[_0xc87c('0x31')]&&_0x17c0f[_0xc87c('0x2e')]){_0x46ffcf[_0x17c0f['idField'][_0xc87c('0x2f')]()]=_0x1b0162[_0x17c0f[_0xc87c('0x35')][_0xc87c('0x36')][_0xc87c('0x2f')]()]['toString']();}});}return _0x46ffcf;}function getTicket(_0x2d6cf7,_0x1017fc,_0x3e5e90,_0x30434f,_0x2ab47e,_0x405307){return function(_0x56e976){logger[_0xc87c('0x10')]('['+[_0x2d6cf7[_0xc87c('0x13')]()]+_0xc87c('0x37'),_0x56e976);return new Promise(function(_0x1a1db2,_0x8438bd){var _0x3f86e7=_0x2d6cf7[_0xc87c('0x2f')]()===_0xc87c('0x38')?_0x56e976[_0xc87c('0x1e')]:_0x56e976['endUserId'];var _0x3334f0={'method':_0xc87c('0x21'),'uri':_0x3e5e90+_0xc87c('0x39')+'?'+_0x405307,'body':Object[_0xc87c('0x3a')]({},{'active':_0xc87c('0x1d'),'caller_id':_0x3f86e7,'assigned_to':_0x56e976[_0xc87c('0x1e')],'short_description':intUtil[_0xc87c('0x3b')](_0x30434f[_0xc87c('0x3c')],_0x2ab47e,'\x20'),'description':intUtil[_0xc87c('0x3b')](_0x30434f['Descriptions'],_0x2ab47e,'\x0a')},getCustomFields(_0x30434f[_0xc87c('0x3d')],_0x2ab47e)),'auth':_0x1017fc,'json':!![]};return rp(_0x3334f0)[_0xc87c('0xd')](function(_0x20b025){logger[_0xc87c('0x10')]('['+[_0x2d6cf7['toUpperCase']()]+_0xc87c('0x3e'),_0x20b025['result']);_0x56e976[_0xc87c('0x3f')]=_0x20b025[_0xc87c('0xe')][_0xc87c('0xf')];_0x56e976[_0xc87c('0x40')]=_0x20b025['result']['number'];logger[_0xc87c('0x10')]('['+[_0x2d6cf7[_0xc87c('0x13')]()]+_0xc87c('0x41'),_0x56e976);_0x1a1db2(_0x56e976);})[_0xc87c('0x11')](function(_0x56fbea){logger[_0xc87c('0x12')]('['+[_0x2d6cf7[_0xc87c('0x13')]()]+']',_0x56fbea[_0xc87c('0x14')]);_0x8438bd(_0x56fbea['message']);});});};}function createRemoteTag(_0x314c0f,_0x386903,_0xab57c2,_0x422ec8){return new Promise(function(_0x3dd1e2,_0x466e21){var _0x1586bf={'method':'POST','uri':_0xab57c2+_0xc87c('0x42')+'?'+_0x422ec8,'body':{'short_description':_0x314c0f,'global':!![],'active':!![],'name':_0x314c0f},'auth':_0x386903,'json':!![]};return rp(_0x1586bf)[_0xc87c('0xd')](function(_0x5dfe8e){var _0x59b73e=_0x5dfe8e[_0xc87c('0xe')]['sys_id'];_0x3dd1e2(_0x59b73e);});});}function getRemoteTag(_0x59132d,_0x53f30d,_0x19f467,_0x4c78f3,_0xc21cdc){return new Promise(function(_0x28d3b3,_0x2fdbc1){var _0x44a6e8={'method':_0xc87c('0xb'),'uri':_0x19f467+_0xc87c('0x42')+_0xc87c('0x43')+_0x59132d+'&'+_0x4c78f3,'auth':_0x53f30d,'json':!![]};return rp(_0x44a6e8)[_0xc87c('0xd')](function(_0x1bdbbc){if(_0x1bdbbc[_0xc87c('0xe')]['length']>0x0){var _0x59e4fe=_0x1bdbbc[_0xc87c('0xe')][0x0][_0xc87c('0xf')];_0x28d3b3(_0x59e4fe);}else{return createRemoteTag(_0x59132d,_0x53f30d,_0x19f467,_0x4c78f3)[_0xc87c('0xd')](function(_0x38078e){_0x28d3b3(_0x38078e);});}});});}function assignTagToIncident(_0x2e9b75,_0x45556a,_0xe31823,_0x396ddc,_0x11c177){return new Promise(function(_0xf38da9,_0x56c9c8){var _0x94d573={'method':_0xc87c('0x21'),'uri':_0xe31823+_0xc87c('0x44')+'?'+_0x11c177,'body':{'label':_0x2e9b75,'table':_0xc87c('0x39'),'id_type':'Incident','table_key':_0x396ddc[_0xc87c('0x3f')],'title':'Incident\x20-\x20'+_0x396ddc[_0xc87c('0x40')],'id_display':_0x396ddc[_0xc87c('0x40')]},'auth':_0x45556a,'json':!![]};return rp(_0x94d573)[_0xc87c('0xd')](function(_0x29e020){_0xf38da9();})[_0xc87c('0x11')](function(){_0xf38da9();});});}function manageTags(_0x4b95e1,_0x6527b,_0x44e3f0,_0x11acfc,_0x2adac3,_0x5ce9d6,_0x597949){return new Promise(function(_0x6afec9,_0x25efdf){var _0x3a8b51=[];_0x6527b['forEach'](function(_0x443f94){_0x3a8b51['push'](getRemoteTag(_0x443f94,_0x44e3f0,_0x11acfc,_0x5ce9d6,_0x597949));});return Promise[_0xc87c('0x45')](_0x3a8b51)[_0xc87c('0xd')](function(_0x37529c){if(_0x37529c[_0xc87c('0x1b')]){logger[_0xc87c('0x10')]('['+[_0x4b95e1[_0xc87c('0x13')]()]+_0xc87c('0x46'),_0x37529c);var _0x2e30f3=[];_0x37529c[_0xc87c('0x29')](function(_0x50393d){_0x2e30f3[_0xc87c('0x47')](assignTagToIncident(_0x50393d,_0x44e3f0,_0x11acfc,_0x2adac3,_0x5ce9d6));});return Promise[_0xc87c('0x45')](_0x2e30f3)[_0xc87c('0xd')](function(){_0x6afec9();})['catch'](function(){_0x6afec9();});}else{_0x6afec9();}});});}function getTags(_0x3956dd,_0x24afcd,_0x14ca2a,_0x2b288f,_0x3838e3,_0x482d4f){return function(_0x44f47f){return new Promise(function(_0x396e03,_0x255463){var _0x5ae5ba=[];var _0x2b186f=_0x2b288f[_0xc87c('0x48')];if(_0x2b186f&&_0x2b186f['length']>0x0){_0x5ae5ba=_[_0xc87c('0x49')](_0x2b186f,_0xc87c('0x36'));}if(_0x5ae5ba[_0xc87c('0x1b')]>0x0){return manageTags(_0x3956dd,_0x5ae5ba,_0x24afcd,_0x14ca2a,_0x44f47f,_0x3838e3,_0x482d4f)['then'](function(){_0x396e03(_0x44f47f);});}else{_0x396e03(_0x44f47f);}});};}function emit(_0x439078,_0x138ff1,_0x382726){var _0x2934b6=_0xc87c('0x4a')+_0xc87c('0x4b')+_0xc87c('0x4c')+'%255EORDERBYDESCnumber';var _0x5d25fe={'uri':_0x439078+_0xc87c('0x4d')+_0x382726+_0x2934b6};io['to'](util['format'](_0xc87c('0x4e'),_0x138ff1))['emit'](_0xc87c('0x4f'),_0x5d25fe);}exports['cs']=function(_0x3fffb3,_0x380fc9,_0x2318df,_0x21b456,_0x286818,_0x4b74a9,_0x3c0c02,_0x37ede6){var _0x150f4a={};var _0x3c5a42={'user':_0x4b74a9[_0xc87c('0x50')],'pass':_0x4b74a9['password']};var _0x1afacd=_0xc87c('0x51');var _0x39880e='sysparm_display_value=true';_0x4b74a9['remoteUri']=intUtil['stripTrailingSlash'](_0x4b74a9[_0xc87c('0x52')]);_0x4b74a9[_0xc87c('0x53')]=intUtil[_0xc87c('0x54')](_0x4b74a9['serverUrl']);var _0x2a3162=util[_0xc87c('0x55')](_0xc87c('0x56'),_0x4b74a9[_0xc87c('0x52')]);_0x150f4a[_0xc87c('0x17')]=!_[_0xc87c('0x57')](_0x21b456)?_0x21b456['email']:null;_0x150f4a['adminEmail']=_0x4b74a9[_0xc87c('0x58')];_0x150f4a[_0xc87c('0x23')]=_0x37ede6[_0xc87c('0x2f')]()===_0xc87c('0x38')?_0x380fc9[_0xc87c('0x59')]:_0x380fc9[_0xc87c('0x5a')];_0x150f4a[_0xc87c('0x5b')]=_0x37ede6==='queue'||_0x37ede6===_0xc87c('0x5c')?_0xc87c('0x5d'):_0xc87c('0x38');var _0x1623d8=util[_0xc87c('0x55')](_0xc87c('0x5e'),_0x4b74a9[_0xc87c('0x53')],_0x380fc9['uniqueid'],md5(_0x380fc9[_0xc87c('0x5f')]));if(_0x286818&&_0x286818['monitor_format']){logger[_0xc87c('0x10')](_0xc87c('0x60'),_0xc87c('0x61'));_0x380fc9[_0xc87c('0x62')]=_0x1623d8;}else if(_0x3c0c02&&_0x3c0c02[_0xc87c('0x63')]&&_0x3c0c02[_0xc87c('0x63')]!==_0xc87c('0x64')){logger['info'](_0xc87c('0x65'),_0xc87c('0x61'));_0x380fc9[_0xc87c('0x62')]=_0x1623d8;}else{_0x380fc9[_0xc87c('0x62')]='';}return getAdminUser(_0x37ede6,_0x3c5a42,_0x150f4a,_0x2a3162,_0x39880e,_0x1afacd)['then'](getUser(_0x37ede6,_0x3c5a42,_0x2a3162,_0x39880e,_0x1afacd))[_0xc87c('0xd')](getEndUser(_0x37ede6,_0x3c5a42,_0x2a3162,_0x39880e,_0x1afacd))[_0xc87c('0xd')](getTicket(_0x37ede6,_0x3c5a42,_0x2a3162,_0x2318df,_0x380fc9,_0x39880e))[_0xc87c('0xd')](function(_0x62c243){logger[_0xc87c('0x10')](util[_0xc87c('0x55')](_0xc87c('0x66'),_0x62c243[_0xc87c('0x3f')]));logger[_0xc87c('0x10')](util['format'](_0xc87c('0x67'),_0x37ede6));if(_0x37ede6!=='unmanaged'){logger[_0xc87c('0x10')]('['+[_0x37ede6[_0xc87c('0x13')]()]+']',_0xc87c('0x68'));emit(_0x4b74a9[_0xc87c('0x52')],_0x21b456[_0xc87c('0x36')],_0x62c243['ticketId']);}})[_0xc87c('0x11')](function(_0x3a5c51){logger[_0xc87c('0x12')]('['+[_0x37ede6['toUpperCase']()]+_0xc87c('0x69'),util['inspect'](_0x3a5c51,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9e75=['sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','forEach','includes','string','picklist','type','nameField','toLowerCase','content','toString','idField','customField','variableName','customVariable','Variable','name','outbound','getString','Descriptions','Fields','ticketNumber','number',']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','incident','Incident','ticketId','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','format','%s/api/now/table/','remoteUri','email','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','active','true','userId','adminEmail','],\x20createEndUser\x20input\x20crm'];(function(_0x1f8d09,_0x556797){var _0x388031=function(_0x1cdc0a){while(--_0x1cdc0a){_0x1f8d09['push'](_0x1f8d09['shift']());}};_0x388031(++_0x556797);}(_0x9e75,0xb5));var _0x59e7=function(_0x5a4483,_0x3b66c6){_0x5a4483=_0x5a4483-0x0;var _0x3364fb=_0x9e75[_0x5a4483];return _0x3364fb;};'use strict';var _=require(_0x59e7('0x0'));var Promise=require(_0x59e7('0x1'));var rp=require('request-promise');var util=require(_0x59e7('0x2'));var md5=require(_0x59e7('0x3'));var Redis=require(_0x59e7('0x4'));var intUtil=require(_0x59e7('0x5'));var config=require(_0x59e7('0x6'));var logger=require('../../../../config/logger')(_0x59e7('0x7'));config[_0x59e7('0x8')]=_['defaults'](config['redis'],{'host':_0x59e7('0x9'),'port':0x18eb});var io=require(_0x59e7('0xa'))(new Redis(config[_0x59e7('0x8')]));function getAdminUser(_0x129f91,_0x323999,_0xac04e2,_0x4d0643,_0x4350af,_0x3737f6){return new Promise(function(_0x1a9fcb,_0x5760f8){var _0x3f4d78={'method':_0x59e7('0xb'),'uri':_0x4d0643+_0x59e7('0xc')+'&'+_0x4350af+'&'+_0x3737f6,'auth':_0x323999,'json':!![]};return rp(_0x3f4d78)[_0x59e7('0xd')](function(_0x13b442){if(_0x13b442[_0x59e7('0xe')][_0x59e7('0xf')]>0x0){_0xac04e2[_0x59e7('0x10')]=_0x13b442[_0x59e7('0xe')][0x0][_0x59e7('0x11')];}logger[_0x59e7('0x12')]('['+[_0x129f91['toUpperCase']()]+_0x59e7('0x13'),_0xac04e2);_0x1a9fcb(_0xac04e2);})[_0x59e7('0x14')](function(_0x9da049){logger[_0x59e7('0x15')]('['+[_0x129f91[_0x59e7('0x16')]()]+']',_0x9da049['message']);_0x5760f8(_0x9da049[_0x59e7('0x17')]);});});}function getUser(_0x2affc2,_0x19a8dc,_0x437945,_0x3789c8,_0x58275d){return function(_0x425b76){logger[_0x59e7('0x12')]('['+[_0x2affc2['toUpperCase']()]+_0x59e7('0x18'),_0x425b76);return new Promise(function(_0x1055d1,_0x48851d){if(intUtil[_0x59e7('0x19')](_0x425b76[_0x59e7('0x1a')])){var _0x59c3d8={'method':_0x59e7('0xb'),'uri':_0x437945+_0x59e7('0x1b')+_0x425b76['userEmail']+'&'+_0x3789c8+'&'+_0x58275d,'auth':_0x19a8dc,'json':!![]};logger['info']('['+[_0x2affc2['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x59c3d8);return rp(_0x59c3d8)[_0x59e7('0xd')](function(_0x399c64){logger[_0x59e7('0x12')]('['+[_0x2affc2['toUpperCase']()]+'],\x20getUser\x20entity',_0x399c64);if(_0x399c64[_0x59e7('0xe')][_0x59e7('0xf')]>0x0&&String(_0x399c64[_0x59e7('0xe')][0x0][_0x59e7('0x1c')])===_0x59e7('0x1d')){_0x425b76[_0x59e7('0x1e')]=_0x399c64[_0x59e7('0xe')][0x0][_0x59e7('0x11')];}else{_0x425b76[_0x59e7('0x1e')]=_0x425b76[_0x59e7('0x10')];_0x425b76[_0x59e7('0x1a')]=_0x425b76['adminEmail'];}logger[_0x59e7('0x12')]('['+[_0x2affc2[_0x59e7('0x16')]()]+'],\x20getUser\x20crm',_0x425b76);_0x1055d1(_0x425b76);})['catch'](function(_0xe7a7b9){logger[_0x59e7('0x15')]('['+[_0x2affc2[_0x59e7('0x16')]()]+']',_0xe7a7b9['message']);_0x48851d(_0xe7a7b9[_0x59e7('0x17')]);});}else{logger['info']('['+[_0x2affc2[_0x59e7('0x16')]()]+']\x20using\x20admin\x20profile');_0x425b76['userId']=_0x425b76[_0x59e7('0x10')];_0x425b76['userEmail']=_0x425b76[_0x59e7('0x1f')];_0x1055d1(_0x425b76);}});};}function createEndUser(_0x4bcf9c,_0xa4d207,_0x38e4eb,_0xef14b8,_0x22f376){logger[_0x59e7('0x12')]('['+[_0x4bcf9c[_0x59e7('0x16')]()]+_0x59e7('0x20'),_0x38e4eb);return new Promise(function(_0x293535,_0x9488c8){var _0x56ca8b={'method':'POST','uri':_0xef14b8+_0x59e7('0x21')+_0x22f376,'body':{'user_name':_0x38e4eb[_0x59e7('0x22')],'roles':_0x59e7('0x23'),'first_name':_0x38e4eb['endUserNumber'],'active':'true','date_format':'System','phone':_0x38e4eb[_0x59e7('0x22')]},'auth':_0xa4d207,'json':!![]};return rp(_0x56ca8b)['then'](function(_0xbc9e5){logger[_0x59e7('0x12')]('['+[_0x4bcf9c[_0x59e7('0x16')]()]+_0x59e7('0x24'),_0xbc9e5[_0x59e7('0xe')]);_0x38e4eb[_0x59e7('0x25')]=_0xbc9e5[_0x59e7('0xe')][_0x59e7('0x11')];_0x293535(_0x38e4eb);})[_0x59e7('0x14')](function(_0x2fb83b){logger[_0x59e7('0x15')]('['+[_0x4bcf9c[_0x59e7('0x16')]()]+']',_0x2fb83b['message']);_0x9488c8(_0x2fb83b[_0x59e7('0x17')]);});});}function getEndUser(_0xa1c400,_0x57433f,_0x4cbad5,_0x5d8311,_0x532506){return function(_0x4ea653){logger['info']('['+[_0xa1c400['toUpperCase']()]+_0x59e7('0x26'),_0x4ea653);return new Promise(function(_0x790908,_0x5bfc86){var _0x392970={'method':_0x59e7('0xb'),'uri':_0x4cbad5+_0x59e7('0x27')+_0x4ea653[_0x59e7('0x22')]+'&'+_0x5d8311+'&'+_0x532506,'auth':_0x57433f,'json':!![]};return rp(_0x392970)[_0x59e7('0xd')](function(_0x502230){if(_0x502230['result'][_0x59e7('0xf')]>0x0){_0x4ea653[_0x59e7('0x25')]=_0x502230[_0x59e7('0xe')][0x0]['sys_id'];logger[_0x59e7('0x12')]('['+[_0xa1c400[_0x59e7('0x16')]()]+'],\x20getEndUser\x20crm',_0x4ea653);_0x790908(_0x4ea653);}else{return createEndUser(_0xa1c400,_0x57433f,_0x4ea653,_0x4cbad5,_0x5d8311)[_0x59e7('0xd')](function(_0x4e0bdb){logger[_0x59e7('0x12')]('['+[_0xa1c400['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x4e0bdb);_0x790908(_0x4e0bdb);});}})[_0x59e7('0x14')](function(_0x6e069c){logger[_0x59e7('0x15')]('['+[_0xa1c400['toUpperCase']()]+']',_0x6e069c[_0x59e7('0x17')]);_0x5bfc86(_0x6e069c[_0x59e7('0x17')]);});});};}function getCustomFields(_0x26d23a,_0x1b37a3){var _0x226f9d={};if(_0x26d23a[_0x59e7('0xf')]>0x0){_[_0x59e7('0x28')](_0x26d23a,function(_0x1ffab6){if(_[_0x59e7('0x29')]([_0x59e7('0x2a'),_0x59e7('0x2b')],_0x1ffab6[_0x59e7('0x2c')])&&_0x1ffab6[_0x59e7('0x2d')]&&!_0x1ffab6['customField']){_0x226f9d[_0x1ffab6['nameField'][_0x59e7('0x2e')]()]=_0x1ffab6[_0x59e7('0x2f')][_0x59e7('0x30')]();}else if(_[_0x59e7('0x29')]([_0x59e7('0x2a'),_0x59e7('0x2b')],_0x1ffab6[_0x59e7('0x2c')])&&_0x1ffab6[_0x59e7('0x31')]&&_0x1ffab6[_0x59e7('0x32')]){_0x226f9d[_0x1ffab6['idField'][_0x59e7('0x2e')]()]=_0x1ffab6[_0x59e7('0x2f')][_0x59e7('0x30')]();}else if(_0x1ffab6[_0x59e7('0x2c')]==='variable'&&_0x1ffab6[_0x59e7('0x33')]&&_0x1ffab6[_0x59e7('0x31')]&&_0x1ffab6[_0x59e7('0x32')]){_0x226f9d[_0x1ffab6[_0x59e7('0x31')][_0x59e7('0x2e')]()]=_0x1b37a3[_0x1ffab6[_0x59e7('0x33')]][_0x59e7('0x30')]();}else if(_0x1ffab6['type']===_0x59e7('0x34')&&_0x1ffab6[_0x59e7('0x35')]&&_0x1ffab6[_0x59e7('0x35')][_0x59e7('0x36')]&&_0x1ffab6[_0x59e7('0x31')]&&_0x1ffab6[_0x59e7('0x32')]){_0x226f9d[_0x1ffab6[_0x59e7('0x31')][_0x59e7('0x2e')]()]=_0x1b37a3[_0x1ffab6[_0x59e7('0x35')][_0x59e7('0x36')][_0x59e7('0x2e')]()][_0x59e7('0x30')]();}});}return _0x226f9d;}function getTicket(_0x5caab3,_0x15a7f5,_0x4ea2f1,_0x7e477c,_0x33b3f8,_0x22396b){return function(_0x2b7de5){logger[_0x59e7('0x12')]('['+[_0x5caab3[_0x59e7('0x16')]()]+']\x20getTicket\x20input\x20crm',_0x2b7de5);return new Promise(function(_0x53c7ba,_0x416f84){var _0x32ef10=_0x5caab3[_0x59e7('0x2e')]()===_0x59e7('0x37')?_0x2b7de5[_0x59e7('0x1e')]:_0x2b7de5[_0x59e7('0x25')];var _0x5b4eb7={'method':'POST','uri':_0x4ea2f1+'incident'+'?'+_0x22396b,'body':Object['assign']({},{'active':_0x59e7('0x1d'),'caller_id':_0x32ef10,'assigned_to':_0x2b7de5[_0x59e7('0x1e')],'short_description':intUtil[_0x59e7('0x38')](_0x7e477c['Subjects'],_0x33b3f8,'\x20'),'description':intUtil[_0x59e7('0x38')](_0x7e477c[_0x59e7('0x39')],_0x33b3f8,'\x0a')},getCustomFields(_0x7e477c[_0x59e7('0x3a')],_0x33b3f8)),'auth':_0x15a7f5,'json':!![]};return rp(_0x5b4eb7)[_0x59e7('0xd')](function(_0x577a15){logger[_0x59e7('0x12')]('['+[_0x5caab3['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x577a15[_0x59e7('0xe')]);_0x2b7de5['ticketId']=_0x577a15[_0x59e7('0xe')][_0x59e7('0x11')];_0x2b7de5[_0x59e7('0x3b')]=_0x577a15[_0x59e7('0xe')][_0x59e7('0x3c')];logger[_0x59e7('0x12')]('['+[_0x5caab3[_0x59e7('0x16')]()]+_0x59e7('0x3d'),_0x2b7de5);_0x53c7ba(_0x2b7de5);})[_0x59e7('0x14')](function(_0x54ff1d){logger[_0x59e7('0x15')]('['+[_0x5caab3[_0x59e7('0x16')]()]+']',_0x54ff1d[_0x59e7('0x17')]);_0x416f84(_0x54ff1d[_0x59e7('0x17')]);});});};}function createRemoteTag(_0x1df474,_0x2347c1,_0x3b3d13,_0x3b595d){return new Promise(function(_0x59ee5c,_0x388676){var _0x37ffbf={'method':_0x59e7('0x3e'),'uri':_0x3b3d13+_0x59e7('0x3f')+'?'+_0x3b595d,'body':{'short_description':_0x1df474,'global':!![],'active':!![],'name':_0x1df474},'auth':_0x2347c1,'json':!![]};return rp(_0x37ffbf)['then'](function(_0x1b21cc){var _0xbb4583=_0x1b21cc[_0x59e7('0xe')]['sys_id'];_0x59ee5c(_0xbb4583);});});}function getRemoteTag(_0x5f9415,_0x435ca9,_0x550051,_0x42abc1,_0x1814c5){return new Promise(function(_0x7a6166,_0x531af9){var _0x5b5ca1={'method':_0x59e7('0xb'),'uri':_0x550051+_0x59e7('0x3f')+_0x59e7('0x40')+_0x5f9415+'&'+_0x42abc1,'auth':_0x435ca9,'json':!![]};return rp(_0x5b5ca1)[_0x59e7('0xd')](function(_0x429c88){if(_0x429c88['result']['length']>0x0){var _0x4a07d3=_0x429c88['result'][0x0][_0x59e7('0x11')];_0x7a6166(_0x4a07d3);}else{return createRemoteTag(_0x5f9415,_0x435ca9,_0x550051,_0x42abc1)['then'](function(_0x215315){_0x7a6166(_0x215315);});}});});}function assignTagToIncident(_0x2aaed6,_0x1537ac,_0xa87d69,_0x4bd53e,_0x16317f){return new Promise(function(_0x2b599a,_0x28e167){var _0x39754c={'method':'POST','uri':_0xa87d69+_0x59e7('0x41')+'?'+_0x16317f,'body':{'label':_0x2aaed6,'table':_0x59e7('0x42'),'id_type':_0x59e7('0x43'),'table_key':_0x4bd53e[_0x59e7('0x44')],'title':_0x59e7('0x45')+_0x4bd53e[_0x59e7('0x3b')],'id_display':_0x4bd53e['ticketNumber']},'auth':_0x1537ac,'json':!![]};return rp(_0x39754c)['then'](function(_0x5cff1b){_0x2b599a();})[_0x59e7('0x14')](function(){_0x2b599a();});});}function manageTags(_0x235168,_0x297e7e,_0x3842b9,_0x484fe7,_0x1e0d9e,_0x46ae8f,_0x10180f){return new Promise(function(_0x3f33c7,_0x4c823d){var _0x9ef4c8=[];_0x297e7e[_0x59e7('0x28')](function(_0x536a40){_0x9ef4c8[_0x59e7('0x46')](getRemoteTag(_0x536a40,_0x3842b9,_0x484fe7,_0x46ae8f,_0x10180f));});return Promise[_0x59e7('0x47')](_0x9ef4c8)[_0x59e7('0xd')](function(_0xca9f77){if(_0xca9f77[_0x59e7('0xf')]){logger[_0x59e7('0x12')]('['+[_0x235168['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0xca9f77);var _0x5d3378=[];_0xca9f77[_0x59e7('0x28')](function(_0x375a2c){_0x5d3378['push'](assignTagToIncident(_0x375a2c,_0x3842b9,_0x484fe7,_0x1e0d9e,_0x46ae8f));});return Promise[_0x59e7('0x47')](_0x5d3378)[_0x59e7('0xd')](function(){_0x3f33c7();})['catch'](function(){_0x3f33c7();});}else{_0x3f33c7();}});});}function getTags(_0x46ca93,_0xe840e,_0x23dd57,_0x1f9b4b,_0x33ef67,_0xe473be){return function(_0xde1a3f){return new Promise(function(_0x15445d,_0x13846e){var _0x579c70=[];var _0x598e41=_0x1f9b4b[_0x59e7('0x48')];if(_0x598e41&&_0x598e41[_0x59e7('0xf')]>0x0){_0x579c70=_[_0x59e7('0x49')](_0x598e41,_0x59e7('0x36'));}if(_0x579c70[_0x59e7('0xf')]>0x0){return manageTags(_0x46ca93,_0x579c70,_0xe840e,_0x23dd57,_0xde1a3f,_0x33ef67,_0xe473be)[_0x59e7('0xd')](function(){_0x15445d(_0xde1a3f);});}else{_0x15445d(_0xde1a3f);}});};}function emit(_0x338651,_0x1402c0,_0x1eaddb){var _0x537dea=_0x59e7('0x4a')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x59e7('0x4b');var _0x4f3ae3={'uri':_0x338651+_0x59e7('0x4c')+_0x1eaddb+_0x537dea};io['to'](util['format'](_0x59e7('0x4d'),_0x1402c0))[_0x59e7('0x4e')](_0x59e7('0x4f'),_0x4f3ae3);}exports['cs']=function(_0x1bf081,_0x115a0d,_0x4237c8,_0xa84792,_0x5005f6,_0x5de212,_0x2afba7,_0x5933de){var _0x2fa9fd={};var _0x395a5b={'user':_0x5de212[_0x59e7('0x50')],'pass':_0x5de212[_0x59e7('0x51')]};var _0x7e29e2=_0x59e7('0x52');var _0x11bfde=_0x59e7('0x53');_0x5de212['remoteUri']=intUtil['stripTrailingSlash'](_0x5de212['remoteUri']);_0x5de212[_0x59e7('0x54')]=intUtil[_0x59e7('0x55')](_0x5de212['serverUrl']);var _0x434b8f=util[_0x59e7('0x56')](_0x59e7('0x57'),_0x5de212[_0x59e7('0x58')]);_0x2fa9fd[_0x59e7('0x1a')]=!_['isNil'](_0xa84792)?_0xa84792[_0x59e7('0x59')]:null;_0x2fa9fd[_0x59e7('0x1f')]=_0x5de212[_0x59e7('0x59')];_0x2fa9fd[_0x59e7('0x22')]=_0x5933de[_0x59e7('0x2e')]()===_0x59e7('0x37')?_0x115a0d['destcalleridnum']:_0x115a0d[_0x59e7('0x5a')];_0x2fa9fd[_0x59e7('0x5b')]=_0x5933de===_0x59e7('0x5c')||_0x5933de==='unmanaged'?_0x59e7('0x5c'):_0x59e7('0x37');var _0x37f9d8=util[_0x59e7('0x56')](_0x59e7('0x5d'),_0x5de212[_0x59e7('0x54')],_0x115a0d[_0x59e7('0x5e')],md5(_0x115a0d[_0x59e7('0x5e')]));if(_0x5005f6&&_0x5005f6[_0x59e7('0x5f')]){logger[_0x59e7('0x12')](_0x59e7('0x60'),'Recording\x20is\x20enabled!');_0x115a0d[_0x59e7('0x61')]=_0x37f9d8;}else if(_0x2afba7&&_0x2afba7[_0x59e7('0x62')]&&_0x2afba7[_0x59e7('0x62')]!==_0x59e7('0x63')){logger[_0x59e7('0x12')](_0x59e7('0x64'),_0x59e7('0x65'));_0x115a0d['recordingURL']=_0x37f9d8;}else{_0x115a0d[_0x59e7('0x61')]='';}return getAdminUser(_0x5933de,_0x395a5b,_0x2fa9fd,_0x434b8f,_0x11bfde,_0x7e29e2)[_0x59e7('0xd')](getUser(_0x5933de,_0x395a5b,_0x434b8f,_0x11bfde,_0x7e29e2))['then'](getEndUser(_0x5933de,_0x395a5b,_0x434b8f,_0x11bfde,_0x7e29e2))[_0x59e7('0xd')](getTicket(_0x5933de,_0x395a5b,_0x434b8f,_0x4237c8,_0x115a0d,_0x11bfde))['then'](function(_0x7636b7){logger[_0x59e7('0x12')](util[_0x59e7('0x56')](_0x59e7('0x66'),_0x7636b7['ticketId']));logger[_0x59e7('0x12')](util[_0x59e7('0x56')](_0x59e7('0x67'),_0x5933de));if(_0x5933de!==_0x59e7('0x68')){logger[_0x59e7('0x12')]('['+[_0x5933de[_0x59e7('0x16')]()]+']',_0x59e7('0x69'));emit(_0x5de212[_0x59e7('0x58')],_0xa84792[_0x59e7('0x36')],_0x7636b7[_0x59e7('0x44')]);}})['catch'](function(_0xa8765f){logger['error']('['+[_0x5933de[_0x59e7('0x16')]()]+_0x59e7('0x6a'),util['inspect'](_0xa8765f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index cf340ca..5c10d72 100644 --- a/server/services/ami/trigger/integration/sugarcrm.js +++ b/server/services/ami/trigger/integration/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc178=['calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','toLowerCase','content','string','customField','variable','custom_fields','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0xc178,0x91));var _0x8c17=function(_0x13f6dc,_0x50d971){_0x13f6dc=_0x13f6dc-0x0;var _0x5cca3f=_0xc178[_0x13f6dc];return _0x5cca3f;};'use strict';var _=require(_0x8c17('0x0'));var rp=require(_0x8c17('0x1'));var BPromise=require(_0x8c17('0x2'));var md5=require(_0x8c17('0x3'));var util=require(_0x8c17('0x4'));var Redis=require(_0x8c17('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x8c17('0x6'))(_0x8c17('0x7'));config['redis']=_['defaults'](config[_0x8c17('0x8')],{'host':_0x8c17('0x9'),'port':0x18eb});var io=require(_0x8c17('0xa'))(new Redis(config[_0x8c17('0x8')]));var def={'method':_0x8c17('0xb'),'json':!![]};function emit(_0x35b357,_0x5d3bd0,_0x16484b){io['to'](_0x35b357)['emit'](_0x5d3bd0,_0x16484b);}function getTicket(_0x2e43f6,_0x35ccd1,_0xb4e3ba,_0x399f51,_0x19d1a0,_0xd94c0a,_0x2bed49,_0x5300d3){logger[_0x8c17('0xc')](_0x8c17('0xd'));var _0x12cc7c=new Date();var _0x5058fe=[{'name':_0x8c17('0xe'),'value':intUtil[_0x8c17('0xf')](_0x399f51['Subjects'],_0x19d1a0,'\x20')},{'name':_0x8c17('0x10'),'value':_0x35ccd1['id']},{'name':_0x8c17('0x11'),'value':_0x35ccd1['id']},{'name':_0x8c17('0x12'),'value':intUtil[_0x8c17('0xf')](_0x399f51[_0x8c17('0x13')],_0x19d1a0,'\x0a')},{'name':'date_start','value':_0x12cc7c[_0x8c17('0x14')]()[_0x8c17('0x15')](0x0,0x13)[_0x8c17('0x16')]('T','\x20')},{'name':_0x8c17('0x17'),'value':'0'},{'name':_0x8c17('0x18'),'value':'15'},{'name':'parent_id','value':_0xb4e3ba['id']},{'name':_0x8c17('0x19'),'value':_0x8c17('0x1a')},{'name':'parent_name','value':_0xb4e3ba['name']},{'name':'direction','value':_0x5300d3}];if(_0xd94c0a['length']){_[_0x8c17('0x1b')](_0xd94c0a,function(_0x14aa9e){if(_0x19d1a0[_0x14aa9e[_0x8c17('0x1c')]]){_0x5058fe[_0x8c17('0x1d')]({'name':_0x14aa9e[_0x8c17('0x1e')],'value':_0x19d1a0[_0x14aa9e['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x8c17('0x1f'),'response_type':_0x8c17('0x1f'),'rest_data':JSON[_0x8c17('0x20')]({'session':_0x2bed49['id'],'module_name':_0x8c17('0x21'),'name_value_list':_0x5058fe})}});}function getAuth(_0x29e5b7){return util[_0x8c17('0x22')](_0x8c17('0x23'),new Buffer(_0x29e5b7['apiKey']+':X')[_0x8c17('0x24')]('base64'));}function getServerInfo(_0x158c5a){return request({'form':{'method':_0x8c17('0x25'),'input_type':_0x8c17('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x158c5a['id']})}});}function getUser(_0x46ef6e,_0xc88917,_0x562834){if(!_[_0x8c17('0x26')](_0xc88917)){logger[_0x8c17('0xc')](_0x8c17('0x27'),_0xc88917);return request({'form':{'method':_0x8c17('0x28'),'input_type':_0x8c17('0x1f'),'response_type':'JSON','rest_data':JSON[_0x8c17('0x20')]({'session':_0x562834['id'],'module_name':_0x8c17('0x29'),'query':util[_0x8c17('0x22')](_0x8c17('0x2a'),_0xc88917),'order_by':'','offset':'0','select_fields':['id',_0x8c17('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8c17('0x2b')](function(_0x4bb873){if(_0x4bb873[_0x8c17('0x2c')][_0x8c17('0x2d')]){var _0x1222de=_['find'](_0x4bb873['entry_list'],function(_0x535f85){return _0x535f85[_0x8c17('0x2e')][_0x8c17('0x2f')][_0x8c17('0x30')]===_0xc88917;});if(_0x1222de){logger[_0x8c17('0xc')](_0x8c17('0x31'));return BPromise[_0x8c17('0x32')]({'id':_0x1222de[_0x8c17('0x2e')]['id'][_0x8c17('0x30')],'name':_0x1222de['name_value_list'][_0x8c17('0xe')][_0x8c17('0x30')]});}}logger['info'](_0x8c17('0x33'));return BPromise['resolve']({'id':_0x562834[_0x8c17('0x2e')][_0x8c17('0x34')][_0x8c17('0x30')],'name':_0x562834[_0x8c17('0x2e')][_0x8c17('0x2f')][_0x8c17('0x30')]});});}else{logger['info'](_0x8c17('0x35'));return BPromise[_0x8c17('0x32')]({'id':_0x562834['name_value_list'][_0x8c17('0x34')]['value'],'name':_0x562834[_0x8c17('0x2e')][_0x8c17('0x2f')][_0x8c17('0x30')]});}}function getEndUser(_0x75d83c,_0x17b7f9,_0x357e83,_0x3190c8){logger[_0x8c17('0xc')]('Searching\x20enduser\x20with\x20phone',_0x357e83);return request({'form':{'method':_0x8c17('0x28'),'input_type':_0x8c17('0x1f'),'response_type':_0x8c17('0x1f'),'rest_data':JSON[_0x8c17('0x20')]({'session':_0x3190c8['id'],'module_name':_0x8c17('0x1a'),'query':util[_0x8c17('0x22')](_0x8c17('0x36'),_0x357e83),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8c17('0x2b')](function(_0x1c7b89){if(_0x1c7b89['entry_list'][_0x8c17('0x2d')]){var _0x3c49f9=_['find'](_0x1c7b89[_0x8c17('0x2c')],function(_0x159601){return _0x159601[_0x8c17('0x2e')][_0x8c17('0x37')][_0x8c17('0x30')]===_0x357e83;});if(_0x3c49f9){logger[_0x8c17('0xc')](_0x8c17('0x38'));return BPromise[_0x8c17('0x32')]({'id':_0x3c49f9['name_value_list']['id']['value'],'name':_0x3c49f9[_0x8c17('0x2e')][_0x8c17('0xe')][_0x8c17('0x30')],'phone':_0x3c49f9['name_value_list'][_0x8c17('0x37')][_0x8c17('0x30')]});}}else{logger[_0x8c17('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x8c17('0x39'),'input_type':_0x8c17('0x1f'),'response_type':'JSON','rest_data':JSON[_0x8c17('0x20')]({'session':_0x3190c8['id'],'module_name':_0x8c17('0x1a'),'name_value_list':[{'name':_0x8c17('0x3a'),'value':_0x17b7f9!==_0x8c17('0x3b')?_0x17b7f9:util[_0x8c17('0x22')](_0x8c17('0x3c'),_0x357e83)},{'name':_0x8c17('0x37'),'value':_0x357e83}]})}})[_0x8c17('0x2b')](function(_0x4b78e2){logger['info'](_0x8c17('0x3d'));return BPromise[_0x8c17('0x32')]({'id':_0x4b78e2['id'],'name':_0x4b78e2[_0x8c17('0x2c')][_0x8c17('0x3a')][_0x8c17('0x30')],'phone':_0x4b78e2[_0x8c17('0x2c')][_0x8c17('0x37')][_0x8c17('0x30')]});});}});}function request(_0x241e82){logger[_0x8c17('0x3e')](_0x8c17('0x3f'),JSON[_0x8c17('0x20')](_0x241e82));return rp(_[_0x8c17('0x40')](def,_0x241e82));}function getTags(_0x358a9f,_0x1bb3b6){var _0x427b15=[];if(_0x358a9f&&_0x358a9f[_0x8c17('0x2d')]>0x0){_0x427b15=_[_0x8c17('0x41')](_0x358a9f,_0x1bb3b6);}return _0x427b15;}function getCustomFields(_0x4d6d42,_0x46e128){var _0x40145f=[];var _0x483680={'custom_fields':[]};if(_0x4d6d42[_0x8c17('0x2d')]>0x0){_[_0x8c17('0x1b')](_0x4d6d42,function(_0xc3249e){if(_0xc3249e[_0x8c17('0x42')]==='string'&&_0xc3249e[_0x8c17('0x43')]&&!_0xc3249e['customField']){_0x483680[_0xc3249e[_0x8c17('0x43')][_0x8c17('0x44')]()]=_0xc3249e[_0x8c17('0x45')][_0x8c17('0x24')]();}else if(_0xc3249e[_0x8c17('0x42')]===_0x8c17('0x46')&&_0xc3249e[_0x8c17('0x1e')]&&_0xc3249e[_0x8c17('0x47')]){_0x483680['custom_fields']['push']({'id':_0xc3249e['idField'],'value':_0xc3249e[_0x8c17('0x45')][_0x8c17('0x24')]()});}else if(_0xc3249e[_0x8c17('0x42')]===_0x8c17('0x48')&&_0xc3249e[_0x8c17('0x1c')]&&_0xc3249e[_0x8c17('0x1e')]&&_0xc3249e[_0x8c17('0x47')]){_0x46e128[_0xc3249e[_0x8c17('0x1c')]]&&_0x483680[_0x8c17('0x49')][_0x8c17('0x1d')]({'id':_0xc3249e['idField'],'value':_0x46e128[_0xc3249e[_0x8c17('0x1c')]][_0x8c17('0x24')]()});}else if(_0xc3249e['type']===_0x8c17('0x4a')&&_0xc3249e[_0x8c17('0x4b')]&&_0xc3249e[_0x8c17('0x4b')][_0x8c17('0xe')]&&_0xc3249e['idField']&&_0xc3249e['customField']){_0x46e128[_0xc3249e['Variable'][_0x8c17('0xe')][_0x8c17('0x44')]()]&&_0x483680[_0x8c17('0x49')][_0x8c17('0x1d')]({'id':_0xc3249e[_0x8c17('0x1e')],'value':_0x46e128[_0xc3249e[_0x8c17('0x4b')][_0x8c17('0xe')][_0x8c17('0x44')]()][_0x8c17('0x24')]()});}});}return _0x483680;}function getConnection(_0x2ebaa6){return request({'method':_0x8c17('0xb'),'form':{'method':'login','input_type':_0x8c17('0x1f'),'response_type':_0x8c17('0x1f'),'rest_data':JSON[_0x8c17('0x20')]({'user_auth':{'user_name':_0x2ebaa6[_0x8c17('0x4c')],'password':_0x2ebaa6[_0x8c17('0x4d')],'encryption':_0x8c17('0x4e')},'application':_0x8c17('0x4f')})}})['then'](function(_0x288871){var _0x3bd1e7=_0x288871;if(_0x3bd1e7['id']){def[_0x8c17('0x50')]=_0x3bd1e7['id'];return BPromise[_0x8c17('0x32')](_0x3bd1e7);}else{throw new Error(util[_0x8c17('0x22')](_0x8c17('0x51'),_0x2ebaa6['id']));}});}function setRelationship(_0x2f6ed3,_0x23da21,_0x49f5bd,_0x5a76d2){return request({'form':{'method':'set_relationship','input_type':_0x8c17('0x1f'),'response_type':'JSON','rest_data':JSON[_0x8c17('0x20')]({'session':_0x2f6ed3['id'],'module_name':_0x8c17('0x21'),'module_id':_0x49f5bd['id'],'link_field_name':_0x5a76d2,'related_ids':[_0x23da21['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x8c17('0x52')]=function(_0x3983c3,_0x453870,_0x2ca681,_0x28d8b6,_0x537d26,_0x4d75cb){var _0x5c23c0,_0x28334c,_0x5b7181,_0x2dda1f;_0x4d75cb[_0x8c17('0x53')]=intUtil[_0x8c17('0x54')](_0x4d75cb['remoteUri']);_0x4d75cb[_0x8c17('0x55')]=intUtil['stripTrailingSlash'](_0x4d75cb[_0x8c17('0x55')]);def['uri']=util[_0x8c17('0x22')](_0x8c17('0x56'),_0x4d75cb[_0x8c17('0x53')]);if(_0x537d26&&_0x537d26[_0x8c17('0x57')]){logger[_0x8c17('0xc')](_0x8c17('0x58'),_0x8c17('0x59'));_0x453870[_0x8c17('0x5a')]=util[_0x8c17('0x22')](_0x8c17('0x5b'),_0x4d75cb[_0x8c17('0x55')],_0x453870['uniqueid'],md5(_0x453870[_0x8c17('0x5c')]));}else{_0x453870[_0x8c17('0x5a')]='';}return getConnection(_0x4d75cb)[_0x8c17('0x2b')](function(_0x138d87){_0x2dda1f=_0x138d87;return getUser(_0x4d75cb,_0x28d8b6[_0x8c17('0xe')],_0x2dda1f);})[_0x8c17('0x2b')](function(_0x1c10f8){_0x5c23c0=_0x1c10f8;logger[_0x8c17('0xc')](_0x8c17('0x5d'),_0x5c23c0['id']);return getEndUser(_0x4d75cb,_0x453870[_0x8c17('0x5e')],_0x453870[_0x8c17('0x5f')],_0x2dda1f);})[_0x8c17('0x2b')](function(_0x537fd8){_0x28334c=_0x537fd8;logger[_0x8c17('0xc')](_0x8c17('0x60'),_0x28334c['id']);return getTicket(_0x4d75cb,_0x5c23c0,_0x28334c,_0x2ca681,_0x453870,_0x2ca681[_0x8c17('0x61')],_0x2dda1f,_0x8c17('0x62'));})[_0x8c17('0x2b')](function(_0xc60fef){_0x5b7181=_0xc60fef;logger[_0x8c17('0xc')](_0x8c17('0x63'));logger[_0x8c17('0xc')](_0x8c17('0x64'),_0x5b7181['id']);return setRelationship(_0x2dda1f,_0x5c23c0,_0x5b7181,_0x8c17('0x65'));})['then'](function(){return setRelationship(_0x2dda1f,_0x28334c,_0x5b7181,_0x8c17('0x66'));})[_0x8c17('0x2b')](function(){return getServerInfo(_0x2dda1f);})[_0x8c17('0x2b')](function(_0x53a798){var _0x4d5ae3=parseInt(_0x53a798['version']['charAt'](0x0));var _0x21e2ce=util[_0x8c17('0x22')](_0x8c17('0x67'),_0x4d75cb[_0x8c17('0x53')],_0x5b7181['id']);if(_0x4d5ae3>0x6){_0x21e2ce=util[_0x8c17('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4d75cb[_0x8c17('0x53')],_0x5b7181['id']);}logger[_0x8c17('0xc')]('[QUEUE]',_0x8c17('0x68'));emit(util[_0x8c17('0x22')](_0x8c17('0x69'),_0x28d8b6[_0x8c17('0xe')]),_0x8c17('0x6a'),{'uri':_0x21e2ce});})[_0x8c17('0x6b')](function(_0x155ca8){logger[_0x8c17('0x6c')](_0x8c17('0x58'),JSON[_0x8c17('0x20')](_0x155ca8));});};exports[_0x8c17('0x6d')]=function(_0x23ee78,_0x8f90a9,_0x1a25e2,_0x3189bf,_0x2bcb99,_0x269f77,_0x76f71d){var _0x226b02,_0x544429,_0x332d9d,_0x1a1abe;_0x269f77[_0x8c17('0x53')]=intUtil[_0x8c17('0x54')](_0x269f77[_0x8c17('0x53')]);_0x269f77[_0x8c17('0x55')]=intUtil[_0x8c17('0x54')](_0x269f77['serverUrl']);def[_0x8c17('0x6e')]=util[_0x8c17('0x22')](_0x8c17('0x56'),_0x269f77['remoteUri']);if(_0x76f71d&&_0x76f71d[_0x8c17('0x6f')]&&_0x76f71d['recordingFormat']!==_0x8c17('0x70')){logger[_0x8c17('0xc')](_0x8c17('0x71'),_0x8c17('0x59'));_0x8f90a9[_0x8c17('0x5a')]=util['format'](_0x8c17('0x5b'),_0x269f77[_0x8c17('0x55')],_0x8f90a9[_0x8c17('0x5c')],md5(_0x8f90a9[_0x8c17('0x5c')]));}return getConnection(_0x269f77)[_0x8c17('0x2b')](function(_0x466e5f){_0x1a1abe=_0x466e5f;return getUser(_0x269f77,_0x3189bf[_0x8c17('0xe')],_0x1a1abe);})[_0x8c17('0x2b')](function(_0x2e3efb){_0x226b02=_0x2e3efb;logger[_0x8c17('0xc')]('The\x20User\x20ID\x20is:',_0x226b02['id']);return getEndUser(_0x269f77,_0x8f90a9['destcalleridname'],_0x8f90a9[_0x8c17('0x72')],_0x1a1abe);})['then'](function(_0x4b7e54){_0x544429=_0x4b7e54;logger[_0x8c17('0xc')](_0x8c17('0x60'),_0x544429['id']);return getTicket(_0x269f77,_0x226b02,_0x544429,_0x1a25e2,_0x8f90a9,_0x1a25e2[_0x8c17('0x61')],_0x1a1abe,_0x8c17('0x73'));})[_0x8c17('0x2b')](function(_0x23449e){_0x332d9d=_0x23449e;logger[_0x8c17('0xc')](_0x8c17('0x63'));logger[_0x8c17('0xc')](_0x8c17('0x64'),_0x332d9d['id']);return setRelationship(_0x1a1abe,_0x226b02,_0x332d9d,_0x8c17('0x65'));})[_0x8c17('0x2b')](function(){return setRelationship(_0x1a1abe,_0x544429,_0x332d9d,_0x8c17('0x66'));})[_0x8c17('0x2b')](function(){return getServerInfo(_0x1a1abe);})[_0x8c17('0x2b')](function(_0x1f97c9){var _0x209172=parseInt(_0x1f97c9['version'][_0x8c17('0x74')](0x0));var _0x4cd7f5=util[_0x8c17('0x22')](_0x8c17('0x67'),_0x269f77['remoteUri'],_0x332d9d['id']);if(_0x209172>0x6){_0x4cd7f5=util[_0x8c17('0x22')](_0x8c17('0x75'),_0x269f77[_0x8c17('0x53')],_0x332d9d['id']);}logger[_0x8c17('0xc')]('[OUTBOUND]',_0x8c17('0x68'));emit(util['format'](_0x8c17('0x69'),_0x3189bf[_0x8c17('0xe')]),_0x8c17('0x6a'),{'uri':_0x4cd7f5});})[_0x8c17('0x6b')](function(_0x29d60a){logger[_0x8c17('0x6c')](_0x8c17('0x71'),JSON[_0x8c17('0x20')](_0x29d60a));});};exports['unmanaged']=function(_0x3d6627,_0x117476,_0x2266c2,_0xb24da,_0x2be207,_0x3fd7bc){var _0x5084e6,_0x35b435,_0x5b9b05,_0x2940ed;_0x3fd7bc[_0x8c17('0x53')]=intUtil[_0x8c17('0x54')](_0x3fd7bc[_0x8c17('0x53')]);_0x3fd7bc[_0x8c17('0x55')]=intUtil['stripTrailingSlash'](_0x3fd7bc[_0x8c17('0x55')]);def[_0x8c17('0x6e')]=util[_0x8c17('0x22')](_0x8c17('0x56'),_0x3fd7bc[_0x8c17('0x53')]);if(_0x2be207&&_0x2be207[_0x8c17('0x57')]){logger['info']('['+_0x117476[_0x8c17('0x76')]['toUpperCase']()+']',_0x8c17('0x59'));_0x117476[_0x8c17('0x5a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3fd7bc[_0x8c17('0x55')],_0x117476[_0x8c17('0x5c')],md5(_0x117476[_0x8c17('0x5c')]));}else{_0x117476[_0x8c17('0x5a')]='';}return getConnection(_0x3fd7bc)['then'](function(_0xc5e023){_0x2940ed=_0xc5e023;if(!_[_0x8c17('0x26')](_0xb24da)){return getUser(_0x3fd7bc,_0xb24da[_0x8c17('0xe')],_0x2940ed);}else{return getUser(_0x3fd7bc,null,_0x2940ed);}})[_0x8c17('0x2b')](function(_0x172b95){_0x5084e6=_0x172b95;logger[_0x8c17('0xc')](_0x8c17('0x5d'),_0x5084e6['id']);return getEndUser(_0x3fd7bc,_0x117476[_0x8c17('0x5e')],_0x117476[_0x8c17('0x5f')],_0x2940ed);})[_0x8c17('0x2b')](function(_0x264e9c){_0x35b435=_0x264e9c;logger[_0x8c17('0xc')](_0x8c17('0x60'),_0x35b435['id']);return getTicket(_0x3fd7bc,_0x5084e6,_0x35b435,_0x2266c2,_0x117476,_0x2266c2['Fields'],_0x2940ed,_0x8c17('0x62'));})['then'](function(_0x34f8a0){_0x5b9b05=_0x34f8a0;logger[_0x8c17('0xc')]('Ticket\x20created!');logger['info'](_0x8c17('0x64'),_0x5b9b05['id']);return setRelationship(_0x2940ed,_0x5084e6,_0x5b9b05,_0x8c17('0x65'));})['then'](function(){return setRelationship(_0x2940ed,_0x35b435,_0x5b9b05,_0x8c17('0x66'));})[_0x8c17('0x2b')](function(){return getServerInfo(_0x2940ed);})[_0x8c17('0x6b')](function(_0x10dcbe){logger[_0x8c17('0x6c')]('['+_0x117476['lastevent'][_0x8c17('0x77')]()+']',JSON['stringify'](_0x10dcbe));});}; \ No newline at end of file +var _0x8e49=['Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','name_value_list','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','string','nameField','customField','toLowerCase','content','type','idField','custom_fields','variable','customVariable','Variable','login','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','unmanaged','uri','monitor_format','lastevent','toUpperCase','error','lodash','util','ioredis','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','description','getString','date_start','replace','duration_hours','parent_type','Contacts','parent_name','direction','length','forEach','push','variableName','JSON','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil'];(function(_0x1e7c08,_0x33c5a5){var _0x2c6018=function(_0x3d4acf){while(--_0x3d4acf){_0x1e7c08['push'](_0x1e7c08['shift']());}};_0x2c6018(++_0x33c5a5);}(_0x8e49,0x1b3));var _0x98e4=function(_0x32bb6b,_0x1a5fbe){_0x32bb6b=_0x32bb6b-0x0;var _0x58dcb4=_0x8e49[_0x32bb6b];return _0x58dcb4;};'use strict';var _=require(_0x98e4('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x98e4('0x1'));var Redis=require(_0x98e4('0x2'));var intUtil=require('./util');var config=require(_0x98e4('0x3'));var logger=require('../../../../config/logger')(_0x98e4('0x4'));config[_0x98e4('0x5')]=_[_0x98e4('0x6')](config[_0x98e4('0x5')],{'host':_0x98e4('0x7'),'port':0x18eb});var io=require(_0x98e4('0x8'))(new Redis(config[_0x98e4('0x5')]));var def={'method':_0x98e4('0x9'),'json':!![]};function emit(_0x23920d,_0x2c7aa9,_0x3cc052){io['to'](_0x23920d)[_0x98e4('0xa')](_0x2c7aa9,_0x3cc052);}function getTicket(_0x16da2c,_0x4e8f1b,_0x29429c,_0x10cdb0,_0x246857,_0x4534b7,_0x2fd218,_0x494a3b){logger[_0x98e4('0xb')](_0x98e4('0xc'));var _0x1d690d=new Date();var _0x1aa801=[{'name':_0x98e4('0xd'),'value':intUtil['getString'](_0x10cdb0[_0x98e4('0xe')],_0x246857,'\x20')},{'name':_0x98e4('0xf'),'value':_0x4e8f1b['id']},{'name':'created_by','value':_0x4e8f1b['id']},{'name':_0x98e4('0x10'),'value':intUtil[_0x98e4('0x11')](_0x10cdb0['Descriptions'],_0x246857,'\x0a')},{'name':_0x98e4('0x12'),'value':_0x1d690d['toISOString']()['slice'](0x0,0x13)[_0x98e4('0x13')]('T','\x20')},{'name':_0x98e4('0x14'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x29429c['id']},{'name':_0x98e4('0x15'),'value':_0x98e4('0x16')},{'name':_0x98e4('0x17'),'value':_0x29429c[_0x98e4('0xd')]},{'name':_0x98e4('0x18'),'value':_0x494a3b}];if(_0x4534b7[_0x98e4('0x19')]){_[_0x98e4('0x1a')](_0x4534b7,function(_0x8e83c9){if(_0x246857[_0x8e83c9['variableName']]){_0x1aa801[_0x98e4('0x1b')]({'name':_0x8e83c9['idField'],'value':_0x246857[_0x8e83c9[_0x98e4('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x98e4('0x1d'),'rest_data':JSON['stringify']({'session':_0x2fd218['id'],'module_name':'Calls','name_value_list':_0x1aa801})}});}function getAuth(_0x5a27b2){return util['format'](_0x98e4('0x1e'),new Buffer(_0x5a27b2[_0x98e4('0x1f')]+':X')[_0x98e4('0x20')](_0x98e4('0x21')));}function getServerInfo(_0x4206ff){return request({'form':{'method':_0x98e4('0x22'),'input_type':_0x98e4('0x1d'),'response_type':_0x98e4('0x1d'),'rest_data':JSON[_0x98e4('0x23')]({'session':_0x4206ff['id']})}});}function getUser(_0x3a502d,_0x48c34c,_0x22c1c1){if(!_[_0x98e4('0x24')](_0x48c34c)){logger['info'](_0x98e4('0x25'),_0x48c34c);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x98e4('0x1d'),'rest_data':JSON[_0x98e4('0x23')]({'session':_0x22c1c1['id'],'module_name':_0x98e4('0x26'),'query':util[_0x98e4('0x27')](_0x98e4('0x28'),_0x48c34c),'order_by':'','offset':'0','select_fields':['id',_0x98e4('0xd'),_0x98e4('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x98e4('0x2a')](function(_0x2cdb5){if(_0x2cdb5[_0x98e4('0x2b')][_0x98e4('0x19')]){var _0x34556c=_[_0x98e4('0x2c')](_0x2cdb5[_0x98e4('0x2b')],function(_0x3ae3c3){return _0x3ae3c3['name_value_list'][_0x98e4('0x29')][_0x98e4('0x2d')]===_0x48c34c;});if(_0x34556c){logger[_0x98e4('0xb')](_0x98e4('0x2e'));return BPromise['resolve']({'id':_0x34556c[_0x98e4('0x2f')]['id']['value'],'name':_0x34556c[_0x98e4('0x2f')][_0x98e4('0xd')][_0x98e4('0x2d')]});}}logger[_0x98e4('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x98e4('0x30')]({'id':_0x22c1c1[_0x98e4('0x2f')][_0x98e4('0x31')][_0x98e4('0x2d')],'name':_0x22c1c1[_0x98e4('0x2f')]['user_name'][_0x98e4('0x2d')]});});}else{logger[_0x98e4('0xb')](_0x98e4('0x32'));return BPromise[_0x98e4('0x30')]({'id':_0x22c1c1[_0x98e4('0x2f')][_0x98e4('0x31')][_0x98e4('0x2d')],'name':_0x22c1c1[_0x98e4('0x2f')]['user_name']['value']});}}function getEndUser(_0x233322,_0x4281e4,_0x7fa56a,_0x1dea47){logger['info']('Searching\x20enduser\x20with\x20phone',_0x7fa56a);return request({'form':{'method':_0x98e4('0x33'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x98e4('0x23')]({'session':_0x1dea47['id'],'module_name':_0x98e4('0x16'),'query':util[_0x98e4('0x27')](_0x98e4('0x34'),_0x7fa56a),'order_by':'','offset':'0','select_fields':['id',_0x98e4('0xd'),_0x98e4('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x98e4('0x2a')](function(_0x1a17a4){if(_0x1a17a4[_0x98e4('0x2b')][_0x98e4('0x19')]){var _0x124157=_[_0x98e4('0x2c')](_0x1a17a4[_0x98e4('0x2b')],function(_0x3cdc29){return _0x3cdc29[_0x98e4('0x2f')][_0x98e4('0x35')][_0x98e4('0x2d')]===_0x7fa56a;});if(_0x124157){logger[_0x98e4('0xb')](_0x98e4('0x36'));return BPromise[_0x98e4('0x30')]({'id':_0x124157[_0x98e4('0x2f')]['id'][_0x98e4('0x2d')],'name':_0x124157[_0x98e4('0x2f')][_0x98e4('0xd')][_0x98e4('0x2d')],'phone':_0x124157[_0x98e4('0x2f')][_0x98e4('0x35')][_0x98e4('0x2d')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x98e4('0x37'),'input_type':_0x98e4('0x1d'),'response_type':_0x98e4('0x1d'),'rest_data':JSON[_0x98e4('0x23')]({'session':_0x1dea47['id'],'module_name':_0x98e4('0x16'),'name_value_list':[{'name':_0x98e4('0x38'),'value':_0x4281e4!==_0x98e4('0x39')?_0x4281e4:util[_0x98e4('0x27')](_0x98e4('0x3a'),_0x7fa56a)},{'name':_0x98e4('0x35'),'value':_0x7fa56a}]})}})[_0x98e4('0x2a')](function(_0xba1ffa){logger[_0x98e4('0xb')](_0x98e4('0x3b'));return BPromise[_0x98e4('0x30')]({'id':_0xba1ffa['id'],'name':_0xba1ffa[_0x98e4('0x2b')]['first_name'][_0x98e4('0x2d')],'phone':_0xba1ffa[_0x98e4('0x2b')][_0x98e4('0x35')][_0x98e4('0x2d')]});});}});}function request(_0x1548cf){logger[_0x98e4('0x3c')]('[HTTP]',JSON[_0x98e4('0x23')](_0x1548cf));return rp(_[_0x98e4('0x3d')](def,_0x1548cf));}function getTags(_0x5c6842,_0x3f90a5){var _0x135e09=[];if(_0x5c6842&&_0x5c6842[_0x98e4('0x19')]>0x0){_0x135e09=_['map'](_0x5c6842,_0x3f90a5);}return _0x135e09;}function getCustomFields(_0xc46ea,_0x13a266){var _0x55a919=[];var _0x28c67e={'custom_fields':[]};if(_0xc46ea[_0x98e4('0x19')]>0x0){_[_0x98e4('0x1a')](_0xc46ea,function(_0x582232){if(_0x582232['type']===_0x98e4('0x3e')&&_0x582232[_0x98e4('0x3f')]&&!_0x582232[_0x98e4('0x40')]){_0x28c67e[_0x582232[_0x98e4('0x3f')][_0x98e4('0x41')]()]=_0x582232[_0x98e4('0x42')][_0x98e4('0x20')]();}else if(_0x582232[_0x98e4('0x43')]===_0x98e4('0x3e')&&_0x582232[_0x98e4('0x44')]&&_0x582232['customField']){_0x28c67e[_0x98e4('0x45')][_0x98e4('0x1b')]({'id':_0x582232[_0x98e4('0x44')],'value':_0x582232['content'][_0x98e4('0x20')]()});}else if(_0x582232[_0x98e4('0x43')]===_0x98e4('0x46')&&_0x582232[_0x98e4('0x1c')]&&_0x582232['idField']&&_0x582232[_0x98e4('0x40')]){_0x13a266[_0x582232[_0x98e4('0x1c')]]&&_0x28c67e[_0x98e4('0x45')][_0x98e4('0x1b')]({'id':_0x582232[_0x98e4('0x44')],'value':_0x13a266[_0x582232[_0x98e4('0x1c')]][_0x98e4('0x20')]()});}else if(_0x582232[_0x98e4('0x43')]===_0x98e4('0x47')&&_0x582232[_0x98e4('0x48')]&&_0x582232[_0x98e4('0x48')][_0x98e4('0xd')]&&_0x582232[_0x98e4('0x44')]&&_0x582232['customField']){_0x13a266[_0x582232[_0x98e4('0x48')][_0x98e4('0xd')][_0x98e4('0x41')]()]&&_0x28c67e[_0x98e4('0x45')]['push']({'id':_0x582232[_0x98e4('0x44')],'value':_0x13a266[_0x582232[_0x98e4('0x48')][_0x98e4('0xd')]['toLowerCase']()][_0x98e4('0x20')]()});}});}return _0x28c67e;}function getConnection(_0xc354d2){return request({'method':_0x98e4('0x9'),'form':{'method':_0x98e4('0x49'),'input_type':_0x98e4('0x1d'),'response_type':_0x98e4('0x1d'),'rest_data':JSON[_0x98e4('0x23')]({'user_auth':{'user_name':_0xc354d2['username'],'password':_0xc354d2[_0x98e4('0x4a')],'encryption':'PLAIN'},'application':_0x98e4('0x4b')})}})[_0x98e4('0x2a')](function(_0x4362f7){var _0x3c1454=_0x4362f7;if(_0x3c1454['id']){def[_0x98e4('0x4c')]=_0x3c1454['id'];return BPromise[_0x98e4('0x30')](_0x3c1454);}else{throw new Error(util[_0x98e4('0x27')](_0x98e4('0x4d'),_0xc354d2['id']));}});}function setRelationship(_0x2e1bc8,_0x54646f,_0x21fd2c,_0x128d91){return request({'form':{'method':_0x98e4('0x4e'),'input_type':_0x98e4('0x1d'),'response_type':_0x98e4('0x1d'),'rest_data':JSON['stringify']({'session':_0x2e1bc8['id'],'module_name':_0x98e4('0x4f'),'module_id':_0x21fd2c['id'],'link_field_name':_0x128d91,'related_ids':[_0x54646f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x98e4('0x50')]=function(_0x420a83,_0x390c62,_0x269069,_0x3db23c,_0x578212,_0x1fab26){var _0x5e9bec,_0x3665b9,_0xf301dd,_0x5e3539;_0x1fab26[_0x98e4('0x51')]=intUtil[_0x98e4('0x52')](_0x1fab26[_0x98e4('0x51')]);_0x1fab26['serverUrl']=intUtil['stripTrailingSlash'](_0x1fab26[_0x98e4('0x53')]);def['uri']=util[_0x98e4('0x27')](_0x98e4('0x54'),_0x1fab26['remoteUri']);if(_0x578212&&_0x578212['monitor_format']){logger['info'](_0x98e4('0x55'),_0x98e4('0x56'));_0x390c62['recordingURL']=util[_0x98e4('0x27')](_0x98e4('0x57'),_0x1fab26[_0x98e4('0x53')],_0x390c62[_0x98e4('0x58')],md5(_0x390c62[_0x98e4('0x58')]));}else{_0x390c62[_0x98e4('0x59')]='';}return getConnection(_0x1fab26)[_0x98e4('0x2a')](function(_0xac6ab1){_0x5e3539=_0xac6ab1;return getUser(_0x1fab26,_0x3db23c['name'],_0x5e3539);})['then'](function(_0x219ca2){_0x5e9bec=_0x219ca2;logger[_0x98e4('0xb')](_0x98e4('0x5a'),_0x5e9bec['id']);return getEndUser(_0x1fab26,_0x390c62[_0x98e4('0x5b')],_0x390c62[_0x98e4('0x5c')],_0x5e3539);})[_0x98e4('0x2a')](function(_0x293406){_0x3665b9=_0x293406;logger[_0x98e4('0xb')](_0x98e4('0x5d'),_0x3665b9['id']);return getTicket(_0x1fab26,_0x5e9bec,_0x3665b9,_0x269069,_0x390c62,_0x269069[_0x98e4('0x5e')],_0x5e3539,_0x98e4('0x5f'));})[_0x98e4('0x2a')](function(_0x2d74f1){_0xf301dd=_0x2d74f1;logger[_0x98e4('0xb')](_0x98e4('0x60'));logger[_0x98e4('0xb')](_0x98e4('0x61'),_0xf301dd['id']);return setRelationship(_0x5e3539,_0x5e9bec,_0xf301dd,_0x98e4('0x62'));})[_0x98e4('0x2a')](function(){return setRelationship(_0x5e3539,_0x3665b9,_0xf301dd,_0x98e4('0x63'));})[_0x98e4('0x2a')](function(){return getServerInfo(_0x5e3539);})[_0x98e4('0x2a')](function(_0x2559d1){var _0x27add8=parseInt(_0x2559d1['version'][_0x98e4('0x64')](0x0));var _0x24ed9f=util[_0x98e4('0x27')](_0x98e4('0x65'),_0x1fab26[_0x98e4('0x51')],_0xf301dd['id']);if(_0x27add8>0x6){_0x24ed9f=util[_0x98e4('0x27')](_0x98e4('0x66'),_0x1fab26['remoteUri'],_0xf301dd['id']);}logger[_0x98e4('0xb')](_0x98e4('0x55'),_0x98e4('0x67'));emit(util[_0x98e4('0x27')](_0x98e4('0x68'),_0x3db23c[_0x98e4('0xd')]),_0x98e4('0x69'),{'uri':_0x24ed9f});})[_0x98e4('0x6a')](function(_0x24e0ea){logger['error']('[QUEUE]',JSON[_0x98e4('0x23')](_0x24e0ea));});};exports['outbound']=function(_0x109396,_0x3e583d,_0xf83529,_0x3104e4,_0x5c4f84,_0x3b1a8e,_0x34e26b){var _0xa5dbb1,_0x22355,_0x2c7829,_0x5188e0;_0x3b1a8e['remoteUri']=intUtil[_0x98e4('0x52')](_0x3b1a8e[_0x98e4('0x51')]);_0x3b1a8e['serverUrl']=intUtil['stripTrailingSlash'](_0x3b1a8e[_0x98e4('0x53')]);def['uri']=util[_0x98e4('0x27')](_0x98e4('0x54'),_0x3b1a8e['remoteUri']);if(_0x34e26b&&_0x34e26b[_0x98e4('0x6b')]&&_0x34e26b['recordingFormat']!==_0x98e4('0x6c')){logger[_0x98e4('0xb')](_0x98e4('0x6d'),_0x98e4('0x56'));_0x3e583d['recordingURL']=util[_0x98e4('0x27')](_0x98e4('0x57'),_0x3b1a8e[_0x98e4('0x53')],_0x3e583d[_0x98e4('0x58')],md5(_0x3e583d[_0x98e4('0x58')]));}return getConnection(_0x3b1a8e)[_0x98e4('0x2a')](function(_0x21ffdb){_0x5188e0=_0x21ffdb;return getUser(_0x3b1a8e,_0x3104e4[_0x98e4('0xd')],_0x5188e0);})[_0x98e4('0x2a')](function(_0x10a1fd){_0xa5dbb1=_0x10a1fd;logger['info'](_0x98e4('0x5a'),_0xa5dbb1['id']);return getEndUser(_0x3b1a8e,_0x3e583d[_0x98e4('0x6e')],_0x3e583d['destcalleridnum'],_0x5188e0);})[_0x98e4('0x2a')](function(_0x4ecf1f){_0x22355=_0x4ecf1f;logger[_0x98e4('0xb')](_0x98e4('0x5d'),_0x22355['id']);return getTicket(_0x3b1a8e,_0xa5dbb1,_0x22355,_0xf83529,_0x3e583d,_0xf83529[_0x98e4('0x5e')],_0x5188e0,_0x98e4('0x6f'));})['then'](function(_0xdabeb5){_0x2c7829=_0xdabeb5;logger[_0x98e4('0xb')](_0x98e4('0x60'));logger[_0x98e4('0xb')](_0x98e4('0x61'),_0x2c7829['id']);return setRelationship(_0x5188e0,_0xa5dbb1,_0x2c7829,_0x98e4('0x62'));})[_0x98e4('0x2a')](function(){return setRelationship(_0x5188e0,_0x22355,_0x2c7829,_0x98e4('0x63'));})[_0x98e4('0x2a')](function(){return getServerInfo(_0x5188e0);})['then'](function(_0x2279c5){var _0x21afa5=parseInt(_0x2279c5['version']['charAt'](0x0));var _0x593ff0=util[_0x98e4('0x27')](_0x98e4('0x65'),_0x3b1a8e[_0x98e4('0x51')],_0x2c7829['id']);if(_0x21afa5>0x6){_0x593ff0=util[_0x98e4('0x27')](_0x98e4('0x66'),_0x3b1a8e[_0x98e4('0x51')],_0x2c7829['id']);}logger[_0x98e4('0xb')](_0x98e4('0x6d'),_0x98e4('0x67'));emit(util[_0x98e4('0x27')](_0x98e4('0x68'),_0x3104e4['name']),_0x98e4('0x69'),{'uri':_0x593ff0});})[_0x98e4('0x6a')](function(_0x5c0554){logger['error'](_0x98e4('0x6d'),JSON[_0x98e4('0x23')](_0x5c0554));});};exports[_0x98e4('0x70')]=function(_0x5bb8bb,_0x1ea6bc,_0x53ffa1,_0x52e289,_0x2fa896,_0x4ac02b){var _0x13b8c7,_0xbe48dd,_0x2b443f,_0x4ef091;_0x4ac02b[_0x98e4('0x51')]=intUtil[_0x98e4('0x52')](_0x4ac02b[_0x98e4('0x51')]);_0x4ac02b[_0x98e4('0x53')]=intUtil['stripTrailingSlash'](_0x4ac02b[_0x98e4('0x53')]);def[_0x98e4('0x71')]=util[_0x98e4('0x27')]('%s/service/v4_1/rest.php',_0x4ac02b[_0x98e4('0x51')]);if(_0x2fa896&&_0x2fa896[_0x98e4('0x72')]){logger[_0x98e4('0xb')]('['+_0x1ea6bc[_0x98e4('0x73')][_0x98e4('0x74')]()+']',_0x98e4('0x56'));_0x1ea6bc['recordingURL']=util['format'](_0x98e4('0x57'),_0x4ac02b['serverUrl'],_0x1ea6bc['uniqueid'],md5(_0x1ea6bc['uniqueid']));}else{_0x1ea6bc[_0x98e4('0x59')]='';}return getConnection(_0x4ac02b)[_0x98e4('0x2a')](function(_0x572f5d){_0x4ef091=_0x572f5d;if(!_[_0x98e4('0x24')](_0x52e289)){return getUser(_0x4ac02b,_0x52e289[_0x98e4('0xd')],_0x4ef091);}else{return getUser(_0x4ac02b,null,_0x4ef091);}})[_0x98e4('0x2a')](function(_0x1a7650){_0x13b8c7=_0x1a7650;logger[_0x98e4('0xb')]('The\x20User\x20ID\x20is:',_0x13b8c7['id']);return getEndUser(_0x4ac02b,_0x1ea6bc[_0x98e4('0x5b')],_0x1ea6bc[_0x98e4('0x5c')],_0x4ef091);})[_0x98e4('0x2a')](function(_0x2420b6){_0xbe48dd=_0x2420b6;logger[_0x98e4('0xb')](_0x98e4('0x5d'),_0xbe48dd['id']);return getTicket(_0x4ac02b,_0x13b8c7,_0xbe48dd,_0x53ffa1,_0x1ea6bc,_0x53ffa1[_0x98e4('0x5e')],_0x4ef091,'Inbound');})['then'](function(_0x383819){_0x2b443f=_0x383819;logger[_0x98e4('0xb')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x2b443f['id']);return setRelationship(_0x4ef091,_0x13b8c7,_0x2b443f,'users');})['then'](function(){return setRelationship(_0x4ef091,_0xbe48dd,_0x2b443f,'contacts');})['then'](function(){return getServerInfo(_0x4ef091);})[_0x98e4('0x6a')](function(_0x583aac){logger[_0x98e4('0x75')]('['+_0x1ea6bc['lastevent'][_0x98e4('0x74')]()+']',JSON['stringify'](_0x583aac));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index 870d64d..9f84969 100644 --- a/server/services/ami/trigger/integration/util.js +++ b/server/services/ami/trigger/integration/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc97=['slice','isNil','test','util','getString','length','sortBy','string','push','type','variableName','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','variable','join'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xfc97,0x87));var _0x7fc9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfc97[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x7fc9('0x0'));exports[_0x7fc9('0x1')]=function(_0x46a063,_0xe0554a,_0x5a1dbb){var _0x2f6550=[];if(_0x46a063[_0x7fc9('0x2')]>0x0){var _0xb1b282=_[_0x7fc9('0x3')](_0x46a063,['id']);for(var _0x1119c4=0x0;_0x1119c4<_0xb1b282['length'];_0x1119c4++){var _0x1a4606=_0xb1b282[_0x1119c4];if(_0x1a4606['type']===_0x7fc9('0x4')){_0x2f6550[_0x7fc9('0x5')](_0x1a4606['content']);}else if(_0x1a4606[_0x7fc9('0x6')]==='variable'&&_0x1a4606['variableName']){_0xe0554a[_0x1a4606[_0x7fc9('0x7')]]&&_0x2f6550[_0x7fc9('0x5')](_0xe0554a[_0x1a4606['variableName']]['toString']());}else if(_0x1a4606[_0x7fc9('0x6')]===_0x7fc9('0x8')&&_0x1a4606[_0x7fc9('0x9')]&&_0x1a4606[_0x7fc9('0x9')][_0x7fc9('0xa')]){_0xe0554a[_0x1a4606[_0x7fc9('0x9')][_0x7fc9('0xa')][_0x7fc9('0xb')]()]&&_0x2f6550[_0x7fc9('0x5')](_0xe0554a[_0x1a4606[_0x7fc9('0x9')][_0x7fc9('0xa')][_0x7fc9('0xb')]()]['toString']());}else if(_0x1a4606[_0x7fc9('0x6')]===_0x7fc9('0xc')){if(_0x1a4606[_0x7fc9('0xd')]==='string'&&_0x1a4606[_0x7fc9('0xe')]){_0x2f6550[_0x7fc9('0x5')](util[_0x7fc9('0xf')](_0x7fc9('0x10'),_0x1a4606['key'],_0x1a4606['keyContent']));}else if(_0x1a4606[_0x7fc9('0xd')]===_0x7fc9('0x11')&&_0x1a4606[_0x7fc9('0x7')]&&_0x1a4606['key']){_0xe0554a[_0x1a4606[_0x7fc9('0x7')]]&&_0x2f6550['push'](util[_0x7fc9('0xf')](_0x7fc9('0x10'),_0x1a4606['key'],_0xe0554a[_0x1a4606[_0x7fc9('0x7')]]));}else if(_0x1a4606['keyType']===_0x7fc9('0x8')&&_0x1a4606[_0x7fc9('0x9')]&&_0x1a4606[_0x7fc9('0x9')][_0x7fc9('0xa')]&&_0x1a4606[_0x7fc9('0xe')]){_0xe0554a[_0x1a4606[_0x7fc9('0x9')][_0x7fc9('0xa')][_0x7fc9('0xb')]()]&&_0x2f6550[_0x7fc9('0x5')](util[_0x7fc9('0xf')](_0x7fc9('0x10'),_0x1a4606[_0x7fc9('0xe')],_0xe0554a[_0x1a4606[_0x7fc9('0x9')][_0x7fc9('0xa')]['toLowerCase']()]));}}}}return _0x2f6550[_0x7fc9('0x12')](_0x5a1dbb);};exports['stripTrailingSlash']=function(_0x3cdc2f){var _0x5b18c7=_0x3cdc2f[_0x7fc9('0x13')](-0x1);if(_0x5b18c7==='/'){_0x3cdc2f=_0x3cdc2f['substring'](0x0,_0x3cdc2f['lastIndexOf'](_0x5b18c7));}return _0x3cdc2f;};exports['validateEmail']=function(_0x9563f1){if(!_[_0x7fc9('0x14')](_0x9563f1)&&_0x9563f1!==''){var _0x4aa6d8=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x4aa6d8[_0x7fc9('0x15')](String(_0x9563f1)[_0x7fc9('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x3c99=['push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','variable','%s:\x20%s','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','util','getString','length','sortBy','type','string','content','variableName'];(function(_0x1939e0,_0x552adc){var _0x19ff37=function(_0xbb4df){while(--_0xbb4df){_0x1939e0['push'](_0x1939e0['shift']());}};_0x19ff37(++_0x552adc);}(_0x3c99,0xa0));var _0x93c9=function(_0x39feee,_0x7f34eb){_0x39feee=_0x39feee-0x0;var _0x5076e7=_0x3c99[_0x39feee];return _0x5076e7;};'use strict';var _=require('lodash');var util=require(_0x93c9('0x0'));exports[_0x93c9('0x1')]=function(_0x4f1971,_0xb35b83,_0x358e23){var _0x3c77a8=[];if(_0x4f1971[_0x93c9('0x2')]>0x0){var _0x4589fe=_[_0x93c9('0x3')](_0x4f1971,['id']);for(var _0x3a4cac=0x0;_0x3a4cac<_0x4589fe[_0x93c9('0x2')];_0x3a4cac++){var _0xc07574=_0x4589fe[_0x3a4cac];if(_0xc07574[_0x93c9('0x4')]===_0x93c9('0x5')){_0x3c77a8['push'](_0xc07574[_0x93c9('0x6')]);}else if(_0xc07574['type']==='variable'&&_0xc07574['variableName']){_0xb35b83[_0xc07574[_0x93c9('0x7')]]&&_0x3c77a8[_0x93c9('0x8')](_0xb35b83[_0xc07574[_0x93c9('0x7')]][_0x93c9('0x9')]());}else if(_0xc07574['type']===_0x93c9('0xa')&&_0xc07574['Variable']&&_0xc07574[_0x93c9('0xb')][_0x93c9('0xc')]){_0xb35b83[_0xc07574[_0x93c9('0xb')][_0x93c9('0xc')][_0x93c9('0xd')]()]&&_0x3c77a8[_0x93c9('0x8')](_0xb35b83[_0xc07574[_0x93c9('0xb')][_0x93c9('0xc')]['toLowerCase']()][_0x93c9('0x9')]());}else if(_0xc07574['type']===_0x93c9('0xe')){if(_0xc07574[_0x93c9('0xf')]===_0x93c9('0x5')&&_0xc07574[_0x93c9('0x10')]){_0x3c77a8[_0x93c9('0x8')](util[_0x93c9('0x11')]('%s:\x20%s',_0xc07574[_0x93c9('0x10')],_0xc07574[_0x93c9('0x12')]));}else if(_0xc07574['keyType']===_0x93c9('0x13')&&_0xc07574[_0x93c9('0x7')]&&_0xc07574[_0x93c9('0x10')]){_0xb35b83[_0xc07574[_0x93c9('0x7')]]&&_0x3c77a8[_0x93c9('0x8')](util['format']('%s:\x20%s',_0xc07574[_0x93c9('0x10')],_0xb35b83[_0xc07574[_0x93c9('0x7')]]));}else if(_0xc07574[_0x93c9('0xf')]===_0x93c9('0xa')&&_0xc07574[_0x93c9('0xb')]&&_0xc07574[_0x93c9('0xb')]['name']&&_0xc07574[_0x93c9('0x10')]){_0xb35b83[_0xc07574['Variable'][_0x93c9('0xc')][_0x93c9('0xd')]()]&&_0x3c77a8[_0x93c9('0x8')](util[_0x93c9('0x11')](_0x93c9('0x14'),_0xc07574[_0x93c9('0x10')],_0xb35b83[_0xc07574[_0x93c9('0xb')][_0x93c9('0xc')][_0x93c9('0xd')]()]));}}}}return _0x3c77a8[_0x93c9('0x15')](_0x358e23);};exports[_0x93c9('0x16')]=function(_0x5df7ae){var _0x4331c6=_0x5df7ae[_0x93c9('0x17')](-0x1);if(_0x4331c6==='/'){_0x5df7ae=_0x5df7ae[_0x93c9('0x18')](0x0,_0x5df7ae['lastIndexOf'](_0x4331c6));}return _0x5df7ae;};exports[_0x93c9('0x19')]=function(_0x420052){if(!_[_0x93c9('0x1a')](_0x420052)&&_0x420052!==''){var _0x3aa585=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x3aa585[_0x93c9('0x1b')](String(_0x420052)[_0x93c9('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 9d67aed..480f6b0 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x3db4df,_0x1e53fe){var _0x4c6ec4=function(_0x4225de){while(--_0x4225de){_0x3db4df['push'](_0x3db4df['shift']());}};_0x4c6ec4(++_0x1e53fe);}(_0xe706,0xa3));var _0x6e70=function(_0x1b5bc2,_0x453d84){_0x1b5bc2=_0x1b5bc2-0x0;var _0x1a5382=_0xe706[_0x1b5bc2];return _0x1a5382;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 6a10589..2b6475b 100644 --- a/server/services/ami/trigger/integration/zendesk.js +++ b/server/services/ami/trigger/integration/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x224b=['The\x20User\x20ID\x20is:','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','debug','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','push','variable','idField','custom_fields','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization'];(function(_0x443c59,_0x548025){var _0x449628=function(_0x48d7db){while(--_0x48d7db){_0x443c59['push'](_0x443c59['shift']());}};_0x449628(++_0x548025);}(_0x224b,0x158));var _0xb224=function(_0x25c5bf,_0xb5e5de){_0x25c5bf=_0x25c5bf-0x0;var _0x53fe2e=_0x224b[_0x25c5bf];return _0x53fe2e;};'use strict';var _=require(_0xb224('0x0'));var rp=require(_0xb224('0x1'));var md5=require(_0xb224('0x2'));var util=require(_0xb224('0x3'));var Redis=require('ioredis');var intUtil=require(_0xb224('0x4'));var config=require('../../../../config/environment');var logger=require(_0xb224('0x5'))(_0xb224('0x6'));config[_0xb224('0x7')]=_[_0xb224('0x8')](config[_0xb224('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xb224('0x9'))(new Redis(config[_0xb224('0x7')]));function emit(_0x1617ae,_0x3ad245,_0x55d9a2){io['to'](_0x1617ae)[_0xb224('0xa')](_0x3ad245,_0x55d9a2);}var headers={'Content-Type':_0xb224('0xb'),'Accept':_0xb224('0xb')};function getTicket(_0x4ac0ff,_0x1b4e3c,_0x48d2f3,_0x17e7d3,_0x40d120){logger[_0xb224('0xc')](_0xb224('0xd'));return request({'uri':util[_0xb224('0xe')](_0xb224('0xf'),_0x4ac0ff[_0xb224('0x10')]),'method':_0xb224('0x11'),'body':{'ticket':_[_0xb224('0x12')]({'requester_id':_0x48d2f3['id'],'submitter_id':_0x1b4e3c?_0x1b4e3c['id']:undefined,'assignee_id':_0x1b4e3c?_0x1b4e3c['id']:undefined,'tags':getTags(_0x17e7d3[_0xb224('0x13')],_0xb224('0x14')),'subject':intUtil[_0xb224('0x15')](_0x17e7d3['Subjects'],_0x40d120,'\x20'),'description':intUtil[_0xb224('0x15')](_0x17e7d3['Descriptions'],_0x40d120,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb224('0x15')](_0x17e7d3[_0xb224('0x16')],_0x40d120,'\x0a')}},getCustomFields(_0x17e7d3[_0xb224('0x17')],_0x40d120))}})[_0xb224('0x18')](function(_0x19a259){logger['info']('Ticket\x20created!');return _0x19a259[_0xb224('0x19')];});}function getUser(_0x480b56,_0x536a17){if(intUtil[_0xb224('0x1a')](_0x536a17)){logger[_0xb224('0xc')](_0xb224('0x1b'),_0x536a17);return request({'uri':util['format']('%s/search.json',_0x480b56['remoteUri']),'qs':{'query':util[_0xb224('0xe')](_0xb224('0x1c'),_0x536a17)}})[_0xb224('0x18')](function(_0x16bd8b){if(_0x16bd8b[_0xb224('0x1d')]){logger['info'](_0xb224('0x1e'));return _[_0xb224('0x1f')](_0x16bd8b['results'],{'email':_0x536a17,'role':_0xb224('0x20')});}else{logger['info'](_0xb224('0x21'));return request({'uri':util[_0xb224('0xe')](_0xb224('0x22'),_0x480b56['remoteUri'])})[_0xb224('0x18')](function(_0x3988d0){logger[_0xb224('0xc')]('Admin\x20account\x20selected.');return _0x3988d0['user'];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb224('0xe')](_0xb224('0x22'),_0x480b56[_0xb224('0x10')])})['then'](function(_0x383997){logger['info'](_0xb224('0x23'));return _0x383997[_0xb224('0x24')];});}}function getEndUser(_0x4c2212,_0x54cb2d,_0x42aedf){logger[_0xb224('0xc')](_0xb224('0x25'),_0x42aedf);return request({'uri':util[_0xb224('0xe')](_0xb224('0x26'),_0x4c2212[_0xb224('0x10')]),'qs':{'query':util[_0xb224('0xe')](_0xb224('0x27'),_0x42aedf)}})['then'](function(_0x3de217){var _0x3d0320;if(_0x3de217['results']['length']){_0x3de217[_0xb224('0x28')]=_[_0xb224('0x29')](_0x3de217['results'],{'suspended':![],'role':_0xb224('0x2a')});if(_0x3de217['results'][_0xb224('0x2b')]){_0x3d0320=_[_0xb224('0x2c')](_0x3de217[_0xb224('0x28')]);}}if(_0x3d0320){logger['info']('Enduser\x20found!');return _0x3d0320;}else{logger[_0xb224('0xc')](_0xb224('0x2d'));return request({'uri':util[_0xb224('0xe')](_0xb224('0x2e'),_0x4c2212['remoteUri']),'method':'POST','body':{'user':{'role':_0xb224('0x2a'),'name':util[_0xb224('0xe')]('Caller\x20-\x20%s',_0x54cb2d||_0x42aedf),'phone':_0x42aedf}}})[_0xb224('0x18')](function(_0x9c6ebd){logger[_0xb224('0xc')](_0xb224('0x2f'));return _0x9c6ebd['user'];});}});}function getAuth(_0xe6be32){var _0x509062;if(_0xe6be32[_0xb224('0x30')]===_0xb224('0x31')){_0x509062=util['format'](_0xb224('0x32'),_0xe6be32[_0xb224('0x33')],_0xe6be32[_0xb224('0x31')]);}else if(_0xe6be32['authType']===_0xb224('0x34')){_0x509062=util[_0xb224('0xe')]('%s/token:%s',_0xe6be32[_0xb224('0x33')],_0xe6be32[_0xb224('0x34')]);}return util['format'](_0xb224('0x35'),new Buffer(_0x509062)[_0xb224('0x36')]('base64'));}function request(_0x44b774){logger[_0xb224('0x37')]('[HTTP]',JSON['stringify'](_0x44b774));return rp(_['defaults'](_0x44b774,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3fd9cf,_0x417125){var _0x3972b8=[];if(_0x3fd9cf&&_0x3fd9cf[_0xb224('0x2b')]>0x0){_0x3972b8=_[_0xb224('0x38')](_0x3fd9cf,_0x417125);}return _0x3972b8;}function getCustomFields(_0x8b61dd,_0x250fcb){var _0x598210=[];var _0x26e8f4={'custom_fields':[]};if(_0x8b61dd['length']>0x0){_[_0xb224('0x39')](_0x8b61dd,function(_0x3605f0){if(_[_0xb224('0x3a')](['string',_0xb224('0x3b')],_0x3605f0[_0xb224('0x3c')])&&_0x3605f0[_0xb224('0x3d')]&&!_0x3605f0[_0xb224('0x3e')]){_0x26e8f4[_0x3605f0['nameField'][_0xb224('0x3f')]()]=_0x3605f0[_0xb224('0x40')][_0xb224('0x36')]();}else if(_['includes']([_0xb224('0x41'),_0xb224('0x3b')],_0x3605f0[_0xb224('0x3c')])&&_0x3605f0['idField']&&_0x3605f0[_0xb224('0x3e')]){_0x26e8f4['custom_fields'][_0xb224('0x42')]({'id':_0x3605f0['idField'],'value':_0x3605f0['content'][_0xb224('0x36')]()});}else if(_0x3605f0[_0xb224('0x3c')]===_0xb224('0x43')&&_0x3605f0['variableName']&&_0x3605f0[_0xb224('0x44')]&&_0x3605f0[_0xb224('0x3e')]){_0x250fcb[_0x3605f0['variableName']]&&_0x26e8f4[_0xb224('0x45')][_0xb224('0x42')]({'id':_0x3605f0[_0xb224('0x44')],'value':_0x250fcb[_0x3605f0[_0xb224('0x46')]]['toString']()});}else if(_0x3605f0['type']===_0xb224('0x47')&&_0x3605f0[_0xb224('0x48')]&&_0x3605f0[_0xb224('0x48')][_0xb224('0x14')]&&_0x3605f0[_0xb224('0x44')]&&_0x3605f0[_0xb224('0x3e')]){_0x250fcb[_0x3605f0[_0xb224('0x48')][_0xb224('0x14')]['toLowerCase']()]&&_0x26e8f4[_0xb224('0x45')][_0xb224('0x42')]({'id':_0x3605f0[_0xb224('0x44')],'value':_0x250fcb[_0x3605f0[_0xb224('0x48')][_0xb224('0x14')]['toLowerCase']()]['toString']()});}});}return _0x26e8f4;}exports[_0xb224('0x49')]=function(_0x1f8f6c,_0x436cb5,_0xc3d933,_0xcb0570,_0x369745,_0x261799){var _0x24534b,_0x4933ea;_0x261799[_0xb224('0x10')]=intUtil[_0xb224('0x4a')](_0x261799[_0xb224('0x10')]);_0x261799[_0xb224('0x4b')]=intUtil[_0xb224('0x4a')](_0x261799[_0xb224('0x4b')]);if(_0x369745&&_0x369745[_0xb224('0x4c')]){logger[_0xb224('0xc')](_0xb224('0x4d'),_0xb224('0x4e'));_0x436cb5[_0xb224('0x4f')]=util[_0xb224('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x261799['serverUrl'],_0x436cb5[_0xb224('0x50')],md5(_0x436cb5[_0xb224('0x50')]));}else{_0x436cb5[_0xb224('0x4f')]='';}headers['Authorization']=getAuth(_0x261799);return getUser(_0x261799,_0xcb0570[_0xb224('0x51')])[_0xb224('0x18')](function(_0xb7c7c7){_0x24534b=_0xb7c7c7;logger[_0xb224('0xc')]('The\x20User\x20ID\x20is:',_0x24534b['id']);return getEndUser(_0x261799,_0x436cb5[_0xb224('0x52')],_0x436cb5[_0xb224('0x53')]);})['then'](function(_0x1df31f){_0x4933ea=_0x1df31f;logger[_0xb224('0xc')](_0xb224('0x54'),_0x4933ea['id']);return getTicket(_0x261799,_0x24534b,_0x4933ea,_0xc3d933,_0x436cb5);})[_0xb224('0x18')](function(_0xb51cd6){if(_0xb51cd6){logger['info']('The\x20Ticket\x20ID\x20is:',_0xb51cd6['id']);switch(_0x261799[_0xb224('0x3c')]){case _0xb224('0x55'):logger[_0xb224('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xb224('0x56'),_0x261799[_0xb224('0x10')],_0x24534b['id'],_0xb51cd6['id']),'method':'POST'});case _0xb224('0x57'):logger[_0xb224('0xc')](_0xb224('0x4d'),_0xb224('0x58'));emit(util[_0xb224('0xe')]('user:%s',_0xcb0570[_0xb224('0x14')]),_0xb224('0x59'),{'uri':util[_0xb224('0xe')]('%s/agent/tickets/%s',_0x261799['remoteUri']['replace'](_0xb224('0x5a'),''),_0xb51cd6['id'])});break;default:logger[_0xb224('0x5b')]('[QUEUE]',_0xb224('0x5c'));}}})[_0xb224('0x5d')](function(_0x2a0f3c){logger[_0xb224('0x5b')](_0xb224('0x5e'),util['inspect'](_0x2a0f3c,{'showHidden':!![],'depth':null}));});};exports[_0xb224('0x5f')]=function(_0x451083,_0x27df64,_0x1d2211,_0x47a28,_0x58c071,_0xf0e83,_0x3a26b0){var _0x5f09b2,_0x33062;_0xf0e83[_0xb224('0x10')]=intUtil[_0xb224('0x4a')](_0xf0e83[_0xb224('0x10')]);_0xf0e83[_0xb224('0x4b')]=intUtil['stripTrailingSlash'](_0xf0e83[_0xb224('0x4b')]);if(_0x3a26b0&&_0x3a26b0[_0xb224('0x60')]&&_0x3a26b0[_0xb224('0x60')]!=='none'){logger[_0xb224('0xc')](_0xb224('0x61'),_0xb224('0x4e'));_0x27df64[_0xb224('0x4f')]=util[_0xb224('0xe')](_0xb224('0x62'),_0xf0e83[_0xb224('0x4b')],_0x27df64['uniqueid'],md5(_0x27df64['uniqueid']));}headers[_0xb224('0x63')]=getAuth(_0xf0e83);return getUser(_0xf0e83,_0x47a28[_0xb224('0x51')])[_0xb224('0x18')](function(_0x2f7502){_0x5f09b2=_0x2f7502;logger[_0xb224('0xc')](_0xb224('0x64'),_0x5f09b2['id']);return getEndUser(_0xf0e83,_0x27df64['destcalleridname'],_0x27df64[_0xb224('0x65')]);})[_0xb224('0x18')](function(_0x29ba48){_0x33062=_0x29ba48;logger[_0xb224('0xc')](_0xb224('0x54'),_0x33062['id']);return getTicket(_0xf0e83,_0x5f09b2,_0x33062,_0x1d2211,_0x27df64);})[_0xb224('0x18')](function(_0x235b8e){if(_0x235b8e){logger[_0xb224('0xc')](_0xb224('0x66'),_0x235b8e['id']);switch(_0xf0e83['type']){case _0xb224('0x55'):logger[_0xb224('0xc')](_0xb224('0x61'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xb224('0x56'),_0xf0e83[_0xb224('0x10')],_0x5f09b2['id'],_0x235b8e['id']),'method':_0xb224('0x11')});case _0xb224('0x57'):logger[_0xb224('0xc')](_0xb224('0x61'),_0xb224('0x58'));emit(util[_0xb224('0xe')](_0xb224('0x67'),_0x47a28[_0xb224('0x14')]),_0xb224('0x59'),{'uri':util[_0xb224('0xe')](_0xb224('0x68'),_0xf0e83[_0xb224('0x10')]['replace'](_0xb224('0x5a'),''),_0x235b8e['id'])});break;default:logger[_0xb224('0x5b')](_0xb224('0x61'),_0xb224('0x5c'));}}})[_0xb224('0x5d')](function(_0x3788a8){logger['error'](_0xb224('0x69'),util[_0xb224('0x6a')](_0x3788a8,{'showHidden':!![],'depth':null}));});};exports[_0xb224('0x6b')]=function(_0x2ab385,_0x5c5f61,_0x15ca6f,_0x147c96,_0x1654e7,_0x8590b6){var _0xa93342,_0x1ce040;_0x8590b6[_0xb224('0x10')]=intUtil['stripTrailingSlash'](_0x8590b6[_0xb224('0x10')]);_0x8590b6[_0xb224('0x4b')]=intUtil['stripTrailingSlash'](_0x8590b6[_0xb224('0x4b')]);if(_0x1654e7&&_0x1654e7[_0xb224('0x4c')]){logger[_0xb224('0xc')]('['+_0x5c5f61['lastevent'][_0xb224('0x6c')]()+']','Recording\x20is\x20enabled!');_0x5c5f61[_0xb224('0x4f')]=util[_0xb224('0xe')](_0xb224('0x62'),_0x8590b6[_0xb224('0x4b')],_0x5c5f61[_0xb224('0x50')],md5(_0x5c5f61[_0xb224('0x50')]));}else{_0x5c5f61['recordingURL']='';}headers[_0xb224('0x63')]=getAuth(_0x8590b6);return getUser(_0x8590b6)[_0xb224('0x18')](function(_0x1063c6){_0xa93342=_0x1063c6;logger[_0xb224('0xc')](_0xb224('0x64'),_0xa93342['id']);return getEndUser(_0x8590b6,_0x5c5f61[_0xb224('0x52')],_0x5c5f61[_0xb224('0x53')]);})[_0xb224('0x18')](function(_0x390138){_0x1ce040=_0x390138;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1ce040['id']);return getTicket(_0x8590b6,_0xa93342,_0x1ce040,_0x15ca6f,_0x5c5f61);})[_0xb224('0x18')](function(_0xa4b77f){if(_0xa4b77f){logger['info'](_0xb224('0x66'),_0xa4b77f['id']);}})[_0xb224('0x5d')](function(_0x29fba0){logger[_0xb224('0x5b')]('['+_0x5c5f61[_0xb224('0x6d')][_0xb224('0x6c')]()+']'+_0xb224('0x6e'),util[_0xb224('0x6a')](_0x29fba0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4994=['%s/token:%s','Basic\x20%s','base64','debug','stringify','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','push','idField','variable','variableName','custom_fields','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','newTab','trigger:browser:url','%s/agent/tickets/%s','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','Authorization','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','%s/search.json','then','find','results','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token'];(function(_0xfcfc6,_0x14899c){var _0x32fdd6=function(_0x5a1efb){while(--_0x5a1efb){_0xfcfc6['push'](_0xfcfc6['shift']());}};_0x32fdd6(++_0x14899c);}(_0x4994,0xb1));var _0x4499=function(_0x56d0a5,_0x475130){_0x56d0a5=_0x56d0a5-0x0;var _0xfa01b4=_0x4994[_0x56d0a5];return _0xfa01b4;};'use strict';var _=require(_0x4499('0x0'));var rp=require(_0x4499('0x1'));var md5=require(_0x4499('0x2'));var util=require(_0x4499('0x3'));var Redis=require('ioredis');var intUtil=require(_0x4499('0x4'));var config=require(_0x4499('0x5'));var logger=require(_0x4499('0x6'))(_0x4499('0x7'));config[_0x4499('0x8')]=_[_0x4499('0x9')](config[_0x4499('0x8')],{'host':_0x4499('0xa'),'port':0x18eb});var io=require(_0x4499('0xb'))(new Redis(config[_0x4499('0x8')]));function emit(_0xe547da,_0x5f12ce,_0x201b4b){io['to'](_0xe547da)[_0x4499('0xc')](_0x5f12ce,_0x201b4b);}var headers={'Content-Type':_0x4499('0xd'),'Accept':'application/json'};function getTicket(_0x29d146,_0x51a2e4,_0x4fec69,_0x1791ed,_0x5c6fbf){logger[_0x4499('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x4499('0xf')](_0x4499('0x10'),_0x29d146[_0x4499('0x11')]),'method':_0x4499('0x12'),'body':{'ticket':_[_0x4499('0x13')]({'requester_id':_0x4fec69['id'],'submitter_id':_0x51a2e4?_0x51a2e4['id']:undefined,'assignee_id':_0x51a2e4?_0x51a2e4['id']:undefined,'tags':getTags(_0x1791ed[_0x4499('0x14')],_0x4499('0x15')),'subject':intUtil[_0x4499('0x16')](_0x1791ed[_0x4499('0x17')],_0x5c6fbf,'\x20'),'description':intUtil[_0x4499('0x16')](_0x1791ed['Descriptions'],_0x5c6fbf,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4499('0x16')](_0x1791ed[_0x4499('0x18')],_0x5c6fbf,'\x0a')}},getCustomFields(_0x1791ed[_0x4499('0x19')],_0x5c6fbf))}})['then'](function(_0x1b775e){logger[_0x4499('0xe')](_0x4499('0x1a'));return _0x1b775e[_0x4499('0x1b')];});}function getUser(_0x2c9ff5,_0xc4829d){if(intUtil[_0x4499('0x1c')](_0xc4829d)){logger[_0x4499('0xe')]('Getting\x20agent\x20with\x20email',_0xc4829d);return request({'uri':util[_0x4499('0xf')](_0x4499('0x1d'),_0x2c9ff5['remoteUri']),'qs':{'query':util[_0x4499('0xf')]('type:user\x20role:agent\x20email:%s',_0xc4829d)}})[_0x4499('0x1e')](function(_0x5218c8){if(_0x5218c8['count']){logger['info']('Agent\x20found!');return _[_0x4499('0x1f')](_0x5218c8[_0x4499('0x20')],{'email':_0xc4829d,'role':_0x4499('0x21')});}else{logger[_0x4499('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4499('0xf')](_0x4499('0x22'),_0x2c9ff5[_0x4499('0x11')])})['then'](function(_0x3b61e4){logger[_0x4499('0xe')]('Admin\x20account\x20selected.');return _0x3b61e4[_0x4499('0x23')];});}});}else{logger['info'](_0x4499('0x24'));return request({'uri':util[_0x4499('0xf')](_0x4499('0x22'),_0x2c9ff5[_0x4499('0x11')])})[_0x4499('0x1e')](function(_0x3cfc6d){logger[_0x4499('0xe')](_0x4499('0x25'));return _0x3cfc6d[_0x4499('0x23')];});}}function getEndUser(_0x474bc8,_0x2373fb,_0x18691f){logger[_0x4499('0xe')](_0x4499('0x26'),_0x18691f);return request({'uri':util[_0x4499('0xf')](_0x4499('0x1d'),_0x474bc8[_0x4499('0x11')]),'qs':{'query':util[_0x4499('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x18691f)}})[_0x4499('0x1e')](function(_0x55734d){var _0x3d7881;if(_0x55734d[_0x4499('0x20')][_0x4499('0x27')]){_0x55734d[_0x4499('0x20')]=_[_0x4499('0x28')](_0x55734d[_0x4499('0x20')],{'suspended':![],'role':_0x4499('0x29')});if(_0x55734d['results']['length']){_0x3d7881=_[_0x4499('0x2a')](_0x55734d[_0x4499('0x20')]);}}if(_0x3d7881){logger[_0x4499('0xe')](_0x4499('0x2b'));return _0x3d7881;}else{logger['info'](_0x4499('0x2c'));return request({'uri':util[_0x4499('0xf')](_0x4499('0x2d'),_0x474bc8[_0x4499('0x11')]),'method':_0x4499('0x12'),'body':{'user':{'role':_0x4499('0x29'),'name':util[_0x4499('0xf')](_0x4499('0x2e'),_0x2373fb||_0x18691f),'phone':_0x18691f}}})['then'](function(_0x7b6e6b){logger['info'](_0x4499('0x2f'));return _0x7b6e6b[_0x4499('0x23')];});}});}function getAuth(_0x5498e3){var _0x1a2f34;if(_0x5498e3[_0x4499('0x30')]==='password'){_0x1a2f34=util[_0x4499('0xf')](_0x4499('0x31'),_0x5498e3[_0x4499('0x32')],_0x5498e3[_0x4499('0x33')]);}else if(_0x5498e3[_0x4499('0x30')]===_0x4499('0x34')){_0x1a2f34=util[_0x4499('0xf')](_0x4499('0x35'),_0x5498e3[_0x4499('0x32')],_0x5498e3[_0x4499('0x34')]);}return util['format'](_0x4499('0x36'),new Buffer(_0x1a2f34)['toString'](_0x4499('0x37')));}function request(_0x5d1ee2){logger[_0x4499('0x38')]('[HTTP]',JSON[_0x4499('0x39')](_0x5d1ee2));return rp(_['defaults'](_0x5d1ee2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4e8d37,_0x45b627){var _0x1fdc61=[];if(_0x4e8d37&&_0x4e8d37[_0x4499('0x27')]>0x0){_0x1fdc61=_['map'](_0x4e8d37,_0x45b627);}return _0x1fdc61;}function getCustomFields(_0x3461fc,_0x33d398){var _0x1b0106=[];var _0x5d8176={'custom_fields':[]};if(_0x3461fc[_0x4499('0x27')]>0x0){_[_0x4499('0x3a')](_0x3461fc,function(_0x356751){if(_[_0x4499('0x3b')]([_0x4499('0x3c'),_0x4499('0x3d')],_0x356751[_0x4499('0x3e')])&&_0x356751[_0x4499('0x3f')]&&!_0x356751[_0x4499('0x40')]){_0x5d8176[_0x356751[_0x4499('0x3f')][_0x4499('0x41')]()]=_0x356751[_0x4499('0x42')][_0x4499('0x43')]();}else if(_[_0x4499('0x3b')](['string','picklist'],_0x356751['type'])&&_0x356751['idField']&&_0x356751[_0x4499('0x40')]){_0x5d8176['custom_fields'][_0x4499('0x44')]({'id':_0x356751[_0x4499('0x45')],'value':_0x356751[_0x4499('0x42')][_0x4499('0x43')]()});}else if(_0x356751[_0x4499('0x3e')]===_0x4499('0x46')&&_0x356751[_0x4499('0x47')]&&_0x356751[_0x4499('0x45')]&&_0x356751[_0x4499('0x40')]){_0x33d398[_0x356751['variableName']]&&_0x5d8176[_0x4499('0x48')][_0x4499('0x44')]({'id':_0x356751['idField'],'value':_0x33d398[_0x356751[_0x4499('0x47')]][_0x4499('0x43')]()});}else if(_0x356751[_0x4499('0x3e')]===_0x4499('0x49')&&_0x356751[_0x4499('0x4a')]&&_0x356751[_0x4499('0x4a')][_0x4499('0x15')]&&_0x356751['idField']&&_0x356751[_0x4499('0x40')]){_0x33d398[_0x356751[_0x4499('0x4a')]['name'][_0x4499('0x41')]()]&&_0x5d8176[_0x4499('0x48')][_0x4499('0x44')]({'id':_0x356751[_0x4499('0x45')],'value':_0x33d398[_0x356751[_0x4499('0x4a')][_0x4499('0x15')][_0x4499('0x41')]()][_0x4499('0x43')]()});}});}return _0x5d8176;}exports[_0x4499('0x4b')]=function(_0xcf7d89,_0x2e620f,_0x33550d,_0x368b1c,_0x18af95,_0x56bc1a){var _0x16fc05,_0x4815e7;_0x56bc1a[_0x4499('0x11')]=intUtil['stripTrailingSlash'](_0x56bc1a['remoteUri']);_0x56bc1a[_0x4499('0x4c')]=intUtil[_0x4499('0x4d')](_0x56bc1a[_0x4499('0x4c')]);if(_0x18af95&&_0x18af95[_0x4499('0x4e')]){logger['info'](_0x4499('0x4f'),_0x4499('0x50'));_0x2e620f[_0x4499('0x51')]=util[_0x4499('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56bc1a[_0x4499('0x4c')],_0x2e620f[_0x4499('0x52')],md5(_0x2e620f[_0x4499('0x52')]));}else{_0x2e620f['recordingURL']='';}headers['Authorization']=getAuth(_0x56bc1a);return getUser(_0x56bc1a,_0x368b1c[_0x4499('0x53')])['then'](function(_0x1f44ab){_0x16fc05=_0x1f44ab;logger['info']('The\x20User\x20ID\x20is:',_0x16fc05['id']);return getEndUser(_0x56bc1a,_0x2e620f[_0x4499('0x54')],_0x2e620f[_0x4499('0x55')]);})[_0x4499('0x1e')](function(_0x57df14){_0x4815e7=_0x57df14;logger[_0x4499('0xe')](_0x4499('0x56'),_0x4815e7['id']);return getTicket(_0x56bc1a,_0x16fc05,_0x4815e7,_0x33550d,_0x2e620f);})['then'](function(_0x8ace0c){if(_0x8ace0c){logger[_0x4499('0xe')](_0x4499('0x57'),_0x8ace0c['id']);switch(_0x56bc1a['type']){case _0x4499('0x58'):logger[_0x4499('0xe')](_0x4499('0x4f'),_0x4499('0x59'));return request({'uri':util['format'](_0x4499('0x5a'),_0x56bc1a[_0x4499('0x11')],_0x16fc05['id'],_0x8ace0c['id']),'method':_0x4499('0x12')});case'newTab':logger[_0x4499('0xe')](_0x4499('0x4f'),_0x4499('0x5b'));emit(util[_0x4499('0xf')](_0x4499('0x5c'),_0x368b1c[_0x4499('0x15')]),'trigger:browser:url',{'uri':util[_0x4499('0xf')]('%s/agent/tickets/%s',_0x56bc1a[_0x4499('0x11')]['replace'](_0x4499('0x5d'),''),_0x8ace0c['id'])});break;default:logger[_0x4499('0x5e')](_0x4499('0x4f'),_0x4499('0x5f'));}}})[_0x4499('0x60')](function(_0x21f997){logger[_0x4499('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x21f997,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x1eb036,_0x37ac75,_0x22a662,_0x137f1e,_0x2e7f41,_0x5e147b,_0x3195d5){var _0x516475,_0x44927e;_0x5e147b[_0x4499('0x11')]=intUtil[_0x4499('0x4d')](_0x5e147b[_0x4499('0x11')]);_0x5e147b[_0x4499('0x4c')]=intUtil[_0x4499('0x4d')](_0x5e147b[_0x4499('0x4c')]);if(_0x3195d5&&_0x3195d5[_0x4499('0x61')]&&_0x3195d5[_0x4499('0x61')]!==_0x4499('0x62')){logger[_0x4499('0xe')](_0x4499('0x63'),_0x4499('0x50'));_0x37ac75['recordingURL']=util['format'](_0x4499('0x64'),_0x5e147b[_0x4499('0x4c')],_0x37ac75[_0x4499('0x52')],md5(_0x37ac75[_0x4499('0x52')]));}headers['Authorization']=getAuth(_0x5e147b);return getUser(_0x5e147b,_0x137f1e[_0x4499('0x53')])[_0x4499('0x1e')](function(_0x59559d){_0x516475=_0x59559d;logger['info'](_0x4499('0x65'),_0x516475['id']);return getEndUser(_0x5e147b,_0x37ac75[_0x4499('0x66')],_0x37ac75[_0x4499('0x67')]);})[_0x4499('0x1e')](function(_0x36a8f8){_0x44927e=_0x36a8f8;logger[_0x4499('0xe')]('The\x20Enduser\x20ID\x20is:',_0x44927e['id']);return getTicket(_0x5e147b,_0x516475,_0x44927e,_0x22a662,_0x37ac75);})[_0x4499('0x1e')](function(_0x3c94b1){if(_0x3c94b1){logger['info'](_0x4499('0x57'),_0x3c94b1['id']);switch(_0x5e147b[_0x4499('0x3e')]){case _0x4499('0x58'):logger[_0x4499('0xe')](_0x4499('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4499('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5e147b[_0x4499('0x11')],_0x516475['id'],_0x3c94b1['id']),'method':_0x4499('0x12')});case _0x4499('0x68'):logger[_0x4499('0xe')](_0x4499('0x63'),_0x4499('0x5b'));emit(util['format'](_0x4499('0x5c'),_0x137f1e[_0x4499('0x15')]),_0x4499('0x69'),{'uri':util['format'](_0x4499('0x6a'),_0x5e147b['remoteUri'][_0x4499('0x6b')](_0x4499('0x5d'),''),_0x3c94b1['id'])});break;default:logger['error'](_0x4499('0x63'),_0x4499('0x5f'));}}})[_0x4499('0x60')](function(_0x30523a){logger[_0x4499('0x5e')](_0x4499('0x6c'),util[_0x4499('0x6d')](_0x30523a,{'showHidden':!![],'depth':null}));});};exports[_0x4499('0x6e')]=function(_0x3c372b,_0x573d64,_0x39441d,_0x64ad21,_0x18680f,_0x55b342){var _0x53f986,_0x2f5eba;_0x55b342[_0x4499('0x11')]=intUtil[_0x4499('0x4d')](_0x55b342['remoteUri']);_0x55b342[_0x4499('0x4c')]=intUtil[_0x4499('0x4d')](_0x55b342[_0x4499('0x4c')]);if(_0x18680f&&_0x18680f[_0x4499('0x4e')]){logger[_0x4499('0xe')]('['+_0x573d64[_0x4499('0x6f')][_0x4499('0x70')]()+']',_0x4499('0x50'));_0x573d64[_0x4499('0x51')]=util[_0x4499('0xf')](_0x4499('0x64'),_0x55b342[_0x4499('0x4c')],_0x573d64[_0x4499('0x52')],md5(_0x573d64['uniqueid']));}else{_0x573d64[_0x4499('0x51')]='';}headers[_0x4499('0x71')]=getAuth(_0x55b342);return getUser(_0x55b342)['then'](function(_0x2550f4){_0x53f986=_0x2550f4;logger[_0x4499('0xe')](_0x4499('0x65'),_0x53f986['id']);return getEndUser(_0x55b342,_0x573d64[_0x4499('0x54')],_0x573d64[_0x4499('0x55')]);})['then'](function(_0x46d163){_0x2f5eba=_0x46d163;logger[_0x4499('0xe')](_0x4499('0x56'),_0x2f5eba['id']);return getTicket(_0x55b342,_0x53f986,_0x2f5eba,_0x39441d,_0x573d64);})[_0x4499('0x1e')](function(_0x72ced6){if(_0x72ced6){logger[_0x4499('0xe')](_0x4499('0x57'),_0x72ced6['id']);}})[_0x4499('0x60')](function(_0x3befdd){logger[_0x4499('0x5e')]('['+_0x573d64['lastevent'][_0x4499('0x70')]()+']'+_0x4499('0x72'),util[_0x4499('0x6d')](_0x3befdd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index b0ea396..4ab93c0 100644 --- a/server/services/ami/trigger/integration/zoho.js +++ b/server/services/ami/trigger/integration/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9193=['zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','Outbound','unmanaged','toUpperCase','Recording\x20is\x20enabled!','lodash','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','picklist','type','idField','content','toString','variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','catch','error','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','data','https://www.zohoapis.','role','first_name','last_name','code','SUCCESS','details','startCase','moduleCreate','The\x20failing\x20result\x20is','log','CREATE\x20ERROR','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x9193,0x1dc));var _0x3919=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x9193[_0x2caaef];return _0xd011f8;};'use strict';var _=require(_0x3919('0x0'));var rp=require('request-promise');var md5=require(_0x3919('0x1'));var util=require(_0x3919('0x2'));var intUtil=require(_0x3919('0x3'));var moment=require(_0x3919('0x4'));var Redis=require('ioredis');var BPromise=require(_0x3919('0x5'));var config=require(_0x3919('0x6'));var logger=require(_0x3919('0x7'))('zoho');config[_0x3919('0x8')]=_['defaults'](config[_0x3919('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x3919('0x9'))(new Redis(config['redis']));function emit(_0x59739a,_0x3ab65b,_0x1e8d40){io['to'](_0x59739a)[_0x3919('0xa')](_0x3ab65b,_0x1e8d40);}function request(_0x2cd1d8){logger['debug'](_0x3919('0xb'),JSON[_0x3919('0xc')](_0x2cd1d8));return rp(_0x2cd1d8);}function getCustomFields(_0x47f701,_0x37919a){var _0x1a9951={};if(_0x47f701[_0x3919('0xd')]>0x0){_[_0x3919('0xe')](_0x47f701,function(_0xebba8b){if(_['includes'](['string',_0x3919('0xf')],_0xebba8b[_0x3919('0x10')])&&_0xebba8b[_0x3919('0x11')]){_0x1a9951[_0xebba8b['idField']]=_0xebba8b[_0x3919('0x12')][_0x3919('0x13')]();}else if(_0xebba8b[_0x3919('0x10')]===_0x3919('0x14')&&_0xebba8b['variableName']&&_0xebba8b[_0x3919('0x11')]&&_0x37919a[_0xebba8b['variableName']]){_0x1a9951[_0xebba8b['idField']]=_0x37919a[_0xebba8b['variableName']][_0x3919('0x13')]();}else if(_0xebba8b[_0x3919('0x10')]==='customVariable'&&_0xebba8b['Variable']&&_0xebba8b['Variable'][_0x3919('0x15')]&&_0xebba8b[_0x3919('0x11')]&&_0x37919a[_0xebba8b['Variable']['name']['toLowerCase']()]){_0x1a9951[_0xebba8b[_0x3919('0x11')]]=_0x37919a[_0xebba8b['Variable'][_0x3919('0x15')][_0x3919('0x16')]()][_0x3919('0x13')]();}});}return _0x1a9951;}function getName(_0x4ca45a){if(_0x4ca45a[_0x3919('0x17')]('\x20')>0x0){var _0x1555bd=_0x4ca45a[_0x3919('0x18')](/ (.+)/);if(_0x1555bd[0x1]){return _0x1555bd;}}return[_0x4ca45a,_0x4ca45a];}var accountsTokens={};function getAccessToken(_0x387e0e){return new Promise(function(_0x1bc445,_0x511418){if(!_[_0x3919('0x19')](accountsTokens[_0x387e0e['id']])&&!_[_0x3919('0x19')](accountsTokens[_0x387e0e['id']][_0x3919('0x1a')])){if(moment()[_0x3919('0x1b')](accountsTokens[_0x387e0e['id']][_0x3919('0x1c')])){_0x1bc445(accountsTokens[_0x387e0e['id']][_0x3919('0x1a')]);}}var _0x37ccbc;switch(_0x387e0e[_0x3919('0x1d')]){case'US':_0x37ccbc=_0x3919('0x1e');break;case'AU':_0x37ccbc=_0x3919('0x1f');break;case'EU':_0x37ccbc=_0x3919('0x20');break;case'IN':_0x37ccbc='https://accounts.zoho.in';break;case'CN':_0x37ccbc=_0x3919('0x21');break;default:_0x37ccbc=_0x3919('0x20');break;}var _0x575619={'method':_0x3919('0x22'),'uri':_0x37ccbc+_0x3919('0x23'),'qs':{'refresh_token':_0x387e0e[_0x3919('0x24')],'client_id':_0x387e0e[_0x3919('0x25')],'client_secret':_0x387e0e[_0x3919('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x575619)[_0x3919('0x27')](function(_0x953e20){accountsTokens[_0x387e0e['id']]={'access_token':_0x953e20[_0x3919('0x1a')],'expires_in':moment()[_0x3919('0x28')](_0x953e20[_0x3919('0x1c')],'seconds')};_0x1bc445(_0x953e20[_0x3919('0x1a')]);})[_0x3919('0x29')](function(_0x373864){logger[_0x3919('0x2a')]('Failing\x20creating\x20the\x20access_token',_0x373864[_0x3919('0x2b')]);_0x511418(_0x373864);});});}function getUser(_0x367376,_0x1f1fa3,_0x4a721d,_0x73c5cb){logger['info'](_0x3919('0x2c'));return request({'method':_0x3919('0x2d'),'uri':util[_0x3919('0x2e')](_0x3919('0x2f'),_0x1f1fa3),'qs':{'type':_0x3919('0x30')},'headers':{'Authorization':_0x3919('0x31')+_0x367376},'json':!![]})[_0x3919('0x27')](function(_0x447ca2){if(_0x447ca2[_0x3919('0x32')]){var _0x4c27fc=-0x1;if(_[_0x3919('0x33')](_0x447ca2[_0x3919('0x32')])){if(!_[_0x3919('0x19')](_0x73c5cb)){_0x4c27fc=_[_0x3919('0x34')](_0x447ca2[_0x3919('0x32')],function(_0x4978dd){return _0x4978dd[_0x3919('0x35')]===_0x73c5cb;});}if(_0x4c27fc>=0x0){logger[_0x3919('0x36')](_0x3919('0x37'));}else{logger[_0x3919('0x36')](_0x3919('0x38'));_0x4c27fc=_[_0x3919('0x34')](_0x447ca2[_0x3919('0x32')],function(_0x5b5d46){return _0x5b5d46[_0x3919('0x39')][_0x3919('0x15')]==='Administrator';});}return _0x447ca2[_0x3919('0x32')][_0x4c27fc];}else{if(_0x447ca2[_0x3919('0x3a')]['profile'][_0x3919('0x15')]===_0x3919('0x3b')){logger[_0x3919('0x36')](_0x3919('0x38'));user=_0x447ca2[_0x3919('0x3a')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x447ca2));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x3919('0xc')](_0x447ca2));}}}else{logger[_0x3919('0x2a')]('The\x20failing\x20result\x20is',JSON[_0x3919('0xc')](_0x447ca2));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x3919('0xc')](_0x447ca2));}})[_0x3919('0x29')](function(_0x2c4bcd){console['error'](_0x2c4bcd);});}function getZohoUser(_0x311206,_0x1dd9f3){return new BPromise(function(_0x3cca8d,_0x4e4907){request(_0x311206)[_0x3919('0x27')](function(_0x3375c0){var _0x35f8aa=null;if(_0x3375c0){_0x35f8aa=_0x3375c0[_0x3919('0x3c')][0x0];_0x35f8aa['enduserType']=_0x1dd9f3;}_0x3cca8d(_0x35f8aa);})['catch'](function(_0x2e365b){_0x4e4907(_0x2e365b);});});}function createEndUser(_0x21783e,_0x15b7ad,_0x16435b,_0xa8942e,_0x552060,_0x20b165){var _0x16435b=getName(_0x16435b);return request({'method':'POST','uri':_0x3919('0x3d')+_0x15b7ad+'/crm/v2/'+_['startCase'](_0x20b165['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x16435b[0x1],'First_Name':_0x16435b[0x0],'Phone':_0xa8942e,'Owner':{'name':!_[_0x3919('0x19')](_0x552060['role'][_0x3919('0x15')])?_0x552060[_0x3919('0x3e')][_0x3919('0x15')]:!_[_0x3919('0x19')](_0x552060[_0x3919('0x3f')])?_0x552060[_0x3919('0x3f')]+'\x20'+_0x552060[_0x3919('0x40')]:_0x552060[_0x3919('0x40')],'id':_0x552060['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x21783e},'json':!![]})[_0x3919('0x27')](function(_0x3ac03d){if(_0x3ac03d&&_0x3ac03d['data'][0x0][_0x3919('0x41')]===_0x3919('0x42')){var _0x84d721=_0x3ac03d[_0x3919('0x3c')][0x0][_0x3919('0x43')];_0x84d721['enduserType']=_[_0x3919('0x44')](_0x20b165[_0x3919('0x45')])+'s';return _0x84d721;}logger[_0x3919('0x2a')](_0x3919('0x46'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON['stringify'](data));})['catch'](function(_0xad101f){console[_0x3919('0x47')](_0x3919('0x48'),_0xad101f);});}function getEndUser(_0x2c5141,_0x51170a,_0x504a58,_0x2fa48a,_0x4b9321,_0x1e8160,_0x50b47f){var _0x1a3070={'method':_0x3919('0x2d'),'uri':'','headers':{'Authorization':_0x3919('0x31')+_0x2c5141},'json':!![]};switch(_0x50b47f[_0x3919('0x49')]){case'contact_lead':_0x1a3070[_0x3919('0x4a')]=_0x3919('0x3d')+_0x51170a+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4b9321+'))';return getZohoUser(_0x1a3070,_0x3919('0x4b'))[_0x3919('0x27')](function(_0x24247c){if(_0x24247c)return _0x24247c;_0x1a3070['uri']=_0x3919('0x3d')+_0x51170a+_0x3919('0x4c')+_0x4b9321+'))';return getZohoUser(_0x1a3070,_0x3919('0x4d'))[_0x3919('0x27')](function(_0x4c1608){if(_0x4c1608)return _0x4c1608;if(_0x50b47f[_0x3919('0x45')]!='nothing'){return createEndUser(_0x2c5141,_0x51170a,_0x2fa48a,_0x4b9321,_0x1e8160,_0x50b47f);}else{return{};}});});break;case _0x3919('0x4e'):_0x1a3070[_0x3919('0x4a')]='https://www.zohoapis.'+_0x51170a+_0x3919('0x4f')+_0x4b9321+'))';return getZohoUser(_0x1a3070,_0x3919('0x4b'))[_0x3919('0x27')](function(_0x2eeb93){if(_0x2eeb93)return _0x2eeb93;if(_0x50b47f['moduleCreate']!=_0x3919('0x50')){return createEndUser(_0x2c5141,_0x51170a,_0x2fa48a,_0x4b9321,_0x1e8160,_0x50b47f);}else{return{};}});break;case _0x3919('0x51'):_0x1a3070['uri']='https://www.zohoapis.'+_0x51170a+_0x3919('0x4c')+_0x4b9321+'))';return getZohoUser(_0x1a3070,'Leads')[_0x3919('0x27')](function(_0x4b8b8c){if(_0x4b8b8c)return _0x4b8b8c;if(_0x50b47f[_0x3919('0x45')]!='nothing'){return createEndUser(_0x2c5141,_0x51170a,_0x2fa48a,_0x4b9321,_0x1e8160,_0x50b47f);}else{return{};}});break;}}function getCall(_0x3f5c08,_0x34a84b,_0x56bd90,_0x35436e,_0x3b4716,_0x58710c,_0x565205,_0x3353e5){logger['info'](_0x3919('0x52'));var _0x5556de={};_0x5556de['Owner']={'name':!_['isNil'](_0x35436e[_0x3919('0x3e')][_0x3919('0x15')])&&!_[_0x3919('0x19')](_0x35436e['profile'][_0x3919('0x15')])&&_0x35436e[_0x3919('0x39')][_0x3919('0x15')]===_0x3919('0x53')?_0x35436e['role'][_0x3919('0x15')]:!_[_0x3919('0x19')](_0x35436e['first_name'])?_0x35436e[_0x3919('0x3f')]+'\x20'+_0x35436e[_0x3919('0x40')]:_0x35436e[_0x3919('0x40')],'id':_0x35436e['id']};_0x5556de[_0x3919('0x54')]=intUtil[_0x3919('0x55')](_0x58710c[_0x3919('0x56')],_0x565205,'\x20');_0x5556de['Description']=intUtil[_0x3919('0x55')](_0x58710c[_0x3919('0x57')],_0x565205,'\x0a');if(_0x3b4716[_0x3919('0x58')]===_0x3919('0x4b')){_0x5556de[_0x3919('0x59')]={'name':!_[_0x3919('0x19')](_0x3b4716[_0x3919('0x5a')])?_0x3b4716['Full_Name']:!_[_0x3919('0x19')](_0x3b4716[_0x3919('0x5b')])?_0x3b4716[_0x3919('0x5b')]+'\x20'+_0x3b4716['Last_Name']:_0x3b4716[_0x3919('0x5c')],'id':_0x3b4716['id']};}if(_0x3b4716[_0x3919('0x58')]==='Leads'){_0x5556de[_0x3919('0x5d')]={'name':!_[_0x3919('0x19')](_0x3b4716[_0x3919('0x5a')])?_0x3b4716[_0x3919('0x5a')]:!_[_0x3919('0x19')](_0x3b4716[_0x3919('0x5b')])?_0x3b4716['First_Name']+'\x20'+_0x3b4716[_0x3919('0x5c')]:_0x3b4716[_0x3919('0x5c')],'id':_0x3b4716['id']};_0x5556de[_0x3919('0x5e')]=_[_0x3919('0x44')](_0x3b4716[_0x3919('0x58')]);}if(_0x565205[_0x3919('0x5f')]){_0x5556de[_0x3919('0x60')]=moment[_0x3919('0x61')](parseInt(_0x565205['talktime'])*0x3e8)['format'](_0x3919('0x62'));}else if(_0x565205[_0x3919('0x63')]&&_0x565205[_0x3919('0x64')]){_0x5556de[_0x3919('0x60')]=moment[_0x3919('0x61')](moment(_0x565205[_0x3919('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0x3919('0x65')](moment(_0x565205[_0x3919('0x66')],'YYYY-MM-DDTHH:mm:ss')))[_0x3919('0x2e')](_0x3919('0x62'));}switch(_0x565205[_0x3919('0x67')]){case _0x3919('0x68'):_0x5556de[_0x3919('0x69')]=_0x3919('0x6a');break;case _0x3919('0x6b'):case _0x3919('0x6c'):_0x5556de[_0x3919('0x69')]=_0x3919('0x6d');break;case _0x3919('0x6e'):_0x5556de[_0x3919('0x69')]=_0x3919('0x6f');break;case _0x3919('0x70'):_0x5556de[_0x3919('0x69')]=_0x3919('0x71');break;case'timeout':_0x5556de[_0x3919('0x69')]=_0x3919('0x72');default:}_0x5556de[_0x3919('0x73')]=(_0x3353e5==='outbound'?moment(_0x565205[_0x3919('0x66')])[_0x3919('0x2e')](_0x3919('0x74')):moment(_0x565205[_0x3919('0x75')])['format'](_0x3919('0x74')))||moment()[_0x3919('0x2e')](_0x3919('0x74'));_0x5556de[_0x3919('0x76')]=_0x3353e5||_0x3919('0x77');_0x5556de=_[_0x3919('0x78')](_0x5556de,getCustomFields(_0x58710c[_0x3919('0x79')],_0x565205));return request({'method':_0x3919('0x22'),'uri':'https://www.zohoapis.'+_0x34a84b+'/crm/v2/Calls','headers':{'Authorization':_0x3919('0x31')+_0x3f5c08},'body':{'data':[_0x5556de]},'json':!![]})[_0x3919('0x27')](function(_0x7ad6c7){if(_0x7ad6c7&&_0x7ad6c7['data'][0x0][_0x3919('0x41')]===_0x3919('0x42')){logger[_0x3919('0x36')](_0x3919('0x7a'));return{'id':_0x7ad6c7['data'][0x0][_0x3919('0x43')]['id']};}})[_0x3919('0x29')](function(_0x47268c){logger[_0x3919('0x36')](_0x3919('0x7b'),_0x47268c[_0x3919('0x2b')]);console['log'](_0x3919('0x7b'),_0x47268c);});}exports['queue']=function(_0x30d1c8,_0x5bfc91,_0x235843,_0x534792,_0x284487,_0x602a52){var _0xcaf8ea,_0x551840,_0x65fc5a;_0x602a52[_0x3919('0x7c')]=intUtil[_0x3919('0x7d')](_0x602a52[_0x3919('0x7c')]);_0x602a52[_0x3919('0x7e')]=intUtil[_0x3919('0x7d')](_0x602a52[_0x3919('0x7e')]);if(_0x284487&&_0x284487[_0x3919('0x7f')]){logger['info'](_0x3919('0x80'),'Recording\x20is\x20enabled!');_0x5bfc91[_0x3919('0x81')]=_0x602a52[_0x3919('0x7e')]+_0x3919('0x82')+_0x5bfc91[_0x3919('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x5bfc91[_0x3919('0x83')]);}else{_0x5bfc91[_0x3919('0x81')]='';}var _0x282b56=_0x602a52[_0x3919('0x7c')]===_0x3919('0x84')?'eu':_0x3919('0x85');return getAccessToken(_0x602a52)[_0x3919('0x27')](function(_0x3c9b6d){_0x65fc5a=_0x3c9b6d;return getUser(_0x65fc5a,_0x282b56,_0x602a52,_0x534792[_0x3919('0x35')]);})[_0x3919('0x27')](function(_0x186231){_0xcaf8ea=_0x186231;logger[_0x3919('0x36')](_0x3919('0x86'),_0xcaf8ea['id']);return getEndUser(_0x65fc5a,_0x282b56,_0x602a52,_0x5bfc91[_0x3919('0x87')],_0x5bfc91[_0x3919('0x88')],_0xcaf8ea,_0x235843);})[_0x3919('0x27')](function(_0x85c940){_0x551840=_0x85c940;return getCall(_0x65fc5a,_0x282b56,_0x602a52,_0xcaf8ea,_0x551840,_0x235843,_0x5bfc91,_0x3919('0x77'));})[_0x3919('0x27')](function(_0x513c72){if(_0x513c72){logger[_0x3919('0x36')](_0x3919('0x89'),_0x513c72['id']);logger[_0x3919('0x36')](_0x3919('0x80'),_0x3919('0x8a'));emit(util[_0x3919('0x2e')](_0x3919('0x8b'),_0x534792[_0x3919('0x15')]),_0x3919('0x8c'),{'uri':_0x3919('0x8d')+_0x602a52[_0x3919('0x7c')]+_0x3919('0x8e')+_0x513c72['id']});}})[_0x3919('0x29')](function(_0xb0f743){logger[_0x3919('0x2a')](_0x3919('0x80'),JSON['stringify'](_0xb0f743));});};exports[_0x3919('0x8f')]=function(_0x3415e4,_0x14f54a,_0x542be1,_0x2ec7f8,_0x469f55,_0x3bf17b,_0x3ae67a){var _0x4d5037,_0x567f8c,_0x282cd8;_0x3bf17b[_0x3919('0x7c')]=intUtil[_0x3919('0x7d')](_0x3bf17b[_0x3919('0x7c')]);_0x3bf17b['serverUrl']=intUtil[_0x3919('0x7d')](_0x3bf17b[_0x3919('0x7e')]);if(_0x3ae67a&&_0x3ae67a['recordingFormat']&&_0x3ae67a[_0x3919('0x90')]!=='none'){logger[_0x3919('0x36')](_0x3919('0x91'),'Recording\x20is\x20enabled!');_0x14f54a[_0x3919('0x81')]=_0x3bf17b['serverUrl']+_0x3919('0x82')+_0x14f54a['uniqueid']+_0x3919('0x92')+md5(_0x14f54a[_0x3919('0x83')]);}var _0x226715=_0x3bf17b[_0x3919('0x7c')]===_0x3919('0x84')?'eu':_0x3919('0x85');return getAccessToken(_0x3bf17b)[_0x3919('0x27')](function(_0x34f109){_0x282cd8=_0x34f109;return getUser(_0x282cd8,_0x226715,_0x3bf17b,_0x2ec7f8['email']);})[_0x3919('0x27')](function(_0xd8c7ad){_0x4d5037=_0xd8c7ad;logger[_0x3919('0x36')](_0x3919('0x86'),_0x4d5037['id']);return getEndUser(_0x282cd8,_0x226715,_0x3bf17b,_0x14f54a[_0x3919('0x93')],_0x14f54a['destcalleridnum'],_0x4d5037,_0x542be1);})['then'](function(_0x4e6c52){_0x567f8c=_0x4e6c52;return getCall(_0x282cd8,_0x226715,_0x3bf17b,_0x4d5037,_0x567f8c,_0x542be1,_0x14f54a,_0x3919('0x94'));})[_0x3919('0x27')](function(_0x233427){if(_0x233427){logger[_0x3919('0x36')](_0x3919('0x89'),_0x233427['id']);logger['info'](_0x3919('0x91'),_0x3919('0x8a'));emit(util[_0x3919('0x2e')](_0x3919('0x8b'),_0x2ec7f8[_0x3919('0x15')]),'trigger:browser:url',{'uri':_0x3919('0x8d')+_0x3bf17b[_0x3919('0x7c')]+_0x3919('0x8e')+_0x233427['id']});}})['catch'](function(_0x4424c6){logger[_0x3919('0x2a')](_0x3919('0x91'),JSON[_0x3919('0xc')](_0x4424c6));});};exports[_0x3919('0x95')]=function(_0x213bc5,_0x58de21,_0xc0c6,_0x5d6b1b,_0x1cc014,_0x14c638){var _0x59c76b,_0x59ef66,_0x3ff300;_0x14c638['host']=intUtil[_0x3919('0x7d')](_0x14c638[_0x3919('0x7c')]);_0x14c638['serverUrl']=intUtil[_0x3919('0x7d')](_0x14c638['serverUrl']);if(_0x1cc014&&_0x1cc014['monitor_format']){logger[_0x3919('0x36')]('['+_0x58de21['lastevent'][_0x3919('0x96')]()+']',_0x3919('0x97'));_0x58de21[_0x3919('0x81')]=_0x14c638[_0x3919('0x7e')]+_0x3919('0x82')+_0x58de21[_0x3919('0x83')]+_0x3919('0x92')+md5(_0x58de21[_0x3919('0x83')]);}else{_0x58de21[_0x3919('0x81')]='';}var _0x39310e=_0x14c638[_0x3919('0x7c')]===_0x3919('0x84')?'eu':'com';return getAccessToken(_0x14c638)[_0x3919('0x27')](function(_0x33df31){_0x3ff300=_0x33df31;return getUser(_0x3ff300,_0x39310e,_0x14c638);})[_0x3919('0x27')](function(_0x1e9a95){_0x59c76b=_0x1e9a95;logger['info'](_0x3919('0x86'),_0x59c76b['id']);return getEndUser(_0x3ff300,_0x39310e,_0x14c638,_0x58de21[_0x3919('0x87')],_0x58de21[_0x3919('0x88')],_0x59c76b,_0xc0c6);})[_0x3919('0x27')](function(_0x408ddd){_0x59ef66=_0x408ddd;return getCall(_0x3ff300,_0x39310e,_0x14c638,_0x59c76b,_0x59ef66,_0xc0c6,_0x58de21,'Inbound');})[_0x3919('0x27')](function(_0x485c57){if(_0x485c57){logger[_0x3919('0x36')](_0x3919('0x89'),_0x485c57['id']);}})['catch'](function(_0x40c3e8){logger[_0x3919('0x2a')]('['+_0x58de21[_0x3919('0x67')][_0x3919('0x96')]()+']',JSON['stringify'](_0x40c3e8));});}; \ No newline at end of file +var _0x7da8=['none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','enduserType','log','CREATE\x20ERROR','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','lead','Owner','administrator','getString','Subjects','Description','Who_Id','First_Name','What_Id','Full_Name','Last_Name','$se_module','talktime','Call_Duration','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','Call_Result','complete','connect','Answered','rejected','abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','/crm/v2/Calls','code','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat'];(function(_0x1900fe,_0x4b52f0){var _0x6b6776=function(_0x161ec4){while(--_0x161ec4){_0x1900fe['push'](_0x1900fe['shift']());}};_0x6b6776(++_0x4b52f0);}(_0x7da8,0xa6));var _0x87da=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7da8[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x87da('0x0'));var rp=require(_0x87da('0x1'));var md5=require(_0x87da('0x2'));var util=require(_0x87da('0x3'));var intUtil=require(_0x87da('0x4'));var moment=require(_0x87da('0x5'));var Redis=require(_0x87da('0x6'));var BPromise=require(_0x87da('0x7'));var config=require('../../../../config/environment');var logger=require(_0x87da('0x8'))(_0x87da('0x9'));config[_0x87da('0xa')]=_[_0x87da('0xb')](config['redis'],{'host':_0x87da('0xc'),'port':0x18eb});var io=require(_0x87da('0xd'))(new Redis(config['redis']));function emit(_0x13df28,_0x114ad3,_0x53fa8c){io['to'](_0x13df28)[_0x87da('0xe')](_0x114ad3,_0x53fa8c);}function request(_0x4cb8ba){logger[_0x87da('0xf')](_0x87da('0x10'),JSON[_0x87da('0x11')](_0x4cb8ba));return rp(_0x4cb8ba);}function getCustomFields(_0x17b806,_0x15fa0a){var _0x54012d={};if(_0x17b806[_0x87da('0x12')]>0x0){_['forEach'](_0x17b806,function(_0x2b444b){if(_[_0x87da('0x13')]([_0x87da('0x14'),_0x87da('0x15')],_0x2b444b[_0x87da('0x16')])&&_0x2b444b[_0x87da('0x17')]){_0x54012d[_0x2b444b[_0x87da('0x17')]]=_0x2b444b[_0x87da('0x18')]['toString']();}else if(_0x2b444b['type']===_0x87da('0x19')&&_0x2b444b[_0x87da('0x1a')]&&_0x2b444b[_0x87da('0x17')]&&_0x15fa0a[_0x2b444b['variableName']]){_0x54012d[_0x2b444b[_0x87da('0x17')]]=_0x15fa0a[_0x2b444b[_0x87da('0x1a')]][_0x87da('0x1b')]();}else if(_0x2b444b[_0x87da('0x16')]===_0x87da('0x1c')&&_0x2b444b[_0x87da('0x1d')]&&_0x2b444b[_0x87da('0x1d')][_0x87da('0x1e')]&&_0x2b444b[_0x87da('0x17')]&&_0x15fa0a[_0x2b444b[_0x87da('0x1d')][_0x87da('0x1e')][_0x87da('0x1f')]()]){_0x54012d[_0x2b444b[_0x87da('0x17')]]=_0x15fa0a[_0x2b444b[_0x87da('0x1d')]['name']['toLowerCase']()][_0x87da('0x1b')]();}});}return _0x54012d;}function getName(_0x4cde83){if(_0x4cde83[_0x87da('0x20')]('\x20')>0x0){var _0x277757=_0x4cde83[_0x87da('0x21')](/ (.+)/);if(_0x277757[0x1]){return _0x277757;}}return[_0x4cde83,_0x4cde83];}var accountsTokens={};function getAccessToken(_0x17ced5){return new Promise(function(_0x11d76c,_0x2ce586){if(!_[_0x87da('0x22')](accountsTokens[_0x17ced5['id']])&&!_[_0x87da('0x22')](accountsTokens[_0x17ced5['id']][_0x87da('0x23')])){if(moment()[_0x87da('0x24')](accountsTokens[_0x17ced5['id']][_0x87da('0x25')])){_0x11d76c(accountsTokens[_0x17ced5['id']][_0x87da('0x23')]);}}var _0x432522;switch(_0x17ced5[_0x87da('0x26')]){case'US':_0x432522=_0x87da('0x27');break;case'AU':_0x432522='https://accounts.zoho.com.au';break;case'EU':_0x432522=_0x87da('0x28');break;case'IN':_0x432522=_0x87da('0x29');break;case'CN':_0x432522=_0x87da('0x2a');break;default:_0x432522=_0x87da('0x28');break;}var _0x209c77={'method':_0x87da('0x2b'),'uri':_0x432522+'/oauth/v2/token','qs':{'refresh_token':_0x17ced5[_0x87da('0x2c')],'client_id':_0x17ced5[_0x87da('0x2d')],'client_secret':_0x17ced5['clientSecret'],'grant_type':_0x87da('0x2e')},'json':!![]};return rp(_0x209c77)[_0x87da('0x2f')](function(_0x3b5cd7){accountsTokens[_0x17ced5['id']]={'access_token':_0x3b5cd7[_0x87da('0x23')],'expires_in':moment()[_0x87da('0x30')](_0x3b5cd7[_0x87da('0x25')],_0x87da('0x31'))};_0x11d76c(_0x3b5cd7['access_token']);})['catch'](function(_0x3f1e3d){logger[_0x87da('0x32')](_0x87da('0x33'),_0x3f1e3d[_0x87da('0x34')]);_0x2ce586(_0x3f1e3d);});});}function getUser(_0x4485f0,_0x2de7a8,_0xa7fb97,_0x5c5be9){logger[_0x87da('0x35')](_0x87da('0x36'));return request({'method':_0x87da('0x37'),'uri':util[_0x87da('0x38')](_0x87da('0x39'),_0x2de7a8),'qs':{'type':_0x87da('0x3a')},'headers':{'Authorization':_0x87da('0x3b')+_0x4485f0},'json':!![]})[_0x87da('0x2f')](function(_0x53ab40){if(_0x53ab40[_0x87da('0x3c')]){var _0x2c2e00=-0x1;if(_['isArrayLikeObject'](_0x53ab40['users'])){if(!_[_0x87da('0x22')](_0x5c5be9)){_0x2c2e00=_[_0x87da('0x3d')](_0x53ab40[_0x87da('0x3c')],function(_0x34b13f){return _0x34b13f[_0x87da('0x3e')]===_0x5c5be9;});}if(_0x2c2e00>=0x0){logger[_0x87da('0x35')]('Agent\x20found!');}else{logger[_0x87da('0x35')]('Using\x20the\x20admin\x20account!');_0x2c2e00=_[_0x87da('0x3d')](_0x53ab40[_0x87da('0x3c')],function(_0x491816){return _0x491816[_0x87da('0x3f')][_0x87da('0x1e')]===_0x87da('0x40');});}return _0x53ab40['users'][_0x2c2e00];}else{if(_0x53ab40[_0x87da('0x41')]['profile'][_0x87da('0x1e')]===_0x87da('0x40')){logger[_0x87da('0x35')](_0x87da('0x42'));user=_0x53ab40[_0x87da('0x41')];return user;}else{logger[_0x87da('0x32')](_0x87da('0x43'),JSON['stringify'](_0x53ab40));throw new Error(_0x87da('0x44')+JSON['stringify'](_0x53ab40));}}}else{logger[_0x87da('0x32')](_0x87da('0x43'),JSON['stringify'](_0x53ab40));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x53ab40));}})[_0x87da('0x45')](function(_0x2bb603){console['error'](_0x2bb603);});}function getZohoUser(_0x5d5651,_0x417062){return new BPromise(function(_0x500caa,_0x4b2f97){request(_0x5d5651)[_0x87da('0x2f')](function(_0x150547){var _0x4039a3=null;if(_0x150547){_0x4039a3=_0x150547[_0x87da('0x46')][0x0];_0x4039a3['enduserType']=_0x417062;}_0x500caa(_0x4039a3);})[_0x87da('0x45')](function(_0x27209b){_0x4b2f97(_0x27209b);});});}function createEndUser(_0x23b0ff,_0x1db8bd,_0xfdf476,_0x5a15bb,_0x34044c,_0xe207e1){var _0xfdf476=getName(_0xfdf476);return request({'method':_0x87da('0x2b'),'uri':_0x87da('0x47')+_0x1db8bd+_0x87da('0x48')+_[_0x87da('0x49')](_0xe207e1[_0x87da('0x4a')])+'s','body':{'data':[{'Last_Name':_0xfdf476[0x1],'First_Name':_0xfdf476[0x0],'Phone':_0x5a15bb,'Owner':{'name':!_['isNil'](_0x34044c[_0x87da('0x4b')][_0x87da('0x1e')])?_0x34044c[_0x87da('0x4b')][_0x87da('0x1e')]:!_['isNil'](_0x34044c[_0x87da('0x4c')])?_0x34044c[_0x87da('0x4c')]+'\x20'+_0x34044c[_0x87da('0x4d')]:_0x34044c['last_name'],'id':_0x34044c['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x23b0ff},'json':!![]})['then'](function(_0x2117c1){if(_0x2117c1&&_0x2117c1[_0x87da('0x46')][0x0]['code']===_0x87da('0x4e')){var _0x420556=_0x2117c1[_0x87da('0x46')][0x0][_0x87da('0x4f')];_0x420556[_0x87da('0x50')]=_[_0x87da('0x49')](_0xe207e1[_0x87da('0x4a')])+'s';return _0x420556;}logger[_0x87da('0x32')]('The\x20failing\x20result\x20is',JSON[_0x87da('0x11')](data));throw new Error('Error:\x20'+JSON[_0x87da('0x11')](data));})[_0x87da('0x45')](function(_0x5edb8d){console[_0x87da('0x51')](_0x87da('0x52'),_0x5edb8d);});}function getEndUser(_0x127e7d,_0x519c9a,_0x5b8595,_0x22a75f,_0x227887,_0x24189b,_0x205acc){var _0x2879a7={'method':_0x87da('0x37'),'uri':'','headers':{'Authorization':_0x87da('0x3b')+_0x127e7d},'json':!![]};switch(_0x205acc['moduleSearch']){case'contact_lead':_0x2879a7[_0x87da('0x53')]=_0x87da('0x47')+_0x519c9a+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x227887+'))';return getZohoUser(_0x2879a7,_0x87da('0x54'))[_0x87da('0x2f')](function(_0x3a98e9){if(_0x3a98e9)return _0x3a98e9;_0x2879a7[_0x87da('0x53')]=_0x87da('0x47')+_0x519c9a+_0x87da('0x55')+_0x227887+'))';return getZohoUser(_0x2879a7,_0x87da('0x56'))[_0x87da('0x2f')](function(_0x72feb2){if(_0x72feb2)return _0x72feb2;if(_0x205acc[_0x87da('0x4a')]!='nothing'){return createEndUser(_0x127e7d,_0x519c9a,_0x22a75f,_0x227887,_0x24189b,_0x205acc);}else{return{};}});});break;case _0x87da('0x57'):_0x2879a7[_0x87da('0x53')]=_0x87da('0x47')+_0x519c9a+_0x87da('0x58')+_0x227887+'))';return getZohoUser(_0x2879a7,'Contacts')['then'](function(_0x45ef5c){if(_0x45ef5c)return _0x45ef5c;if(_0x205acc['moduleCreate']!=_0x87da('0x59')){return createEndUser(_0x127e7d,_0x519c9a,_0x22a75f,_0x227887,_0x24189b,_0x205acc);}else{return{};}});break;case _0x87da('0x5a'):_0x2879a7[_0x87da('0x53')]=_0x87da('0x47')+_0x519c9a+_0x87da('0x55')+_0x227887+'))';return getZohoUser(_0x2879a7,_0x87da('0x56'))[_0x87da('0x2f')](function(_0x3d763e){if(_0x3d763e)return _0x3d763e;if(_0x205acc['moduleCreate']!='nothing'){return createEndUser(_0x127e7d,_0x519c9a,_0x22a75f,_0x227887,_0x24189b,_0x205acc);}else{return{};}});break;}}function getCall(_0x594724,_0x3cd1ed,_0x1fd5c0,_0x5d25d8,_0x1db518,_0x337eb3,_0x17e542,_0x184ac3){logger[_0x87da('0x35')]('Creating\x20new\x20call...');var _0x262d94={};_0x262d94[_0x87da('0x5b')]={'name':!_[_0x87da('0x22')](_0x5d25d8[_0x87da('0x4b')][_0x87da('0x1e')])&&!_[_0x87da('0x22')](_0x5d25d8[_0x87da('0x3f')][_0x87da('0x1e')])&&_0x5d25d8[_0x87da('0x3f')]['name']===_0x87da('0x5c')?_0x5d25d8['role'][_0x87da('0x1e')]:!_[_0x87da('0x22')](_0x5d25d8[_0x87da('0x4c')])?_0x5d25d8[_0x87da('0x4c')]+'\x20'+_0x5d25d8[_0x87da('0x4d')]:_0x5d25d8['last_name'],'id':_0x5d25d8['id']};_0x262d94['Subject']=intUtil[_0x87da('0x5d')](_0x337eb3[_0x87da('0x5e')],_0x17e542,'\x20');_0x262d94[_0x87da('0x5f')]=intUtil[_0x87da('0x5d')](_0x337eb3['Descriptions'],_0x17e542,'\x0a');if(_0x1db518[_0x87da('0x50')]===_0x87da('0x54')){_0x262d94[_0x87da('0x60')]={'name':!_[_0x87da('0x22')](_0x1db518['Full_Name'])?_0x1db518['Full_Name']:!_[_0x87da('0x22')](_0x1db518[_0x87da('0x61')])?_0x1db518[_0x87da('0x61')]+'\x20'+_0x1db518['Last_Name']:_0x1db518['Last_Name'],'id':_0x1db518['id']};}if(_0x1db518[_0x87da('0x50')]===_0x87da('0x56')){_0x262d94[_0x87da('0x62')]={'name':!_[_0x87da('0x22')](_0x1db518[_0x87da('0x63')])?_0x1db518[_0x87da('0x63')]:!_[_0x87da('0x22')](_0x1db518['First_Name'])?_0x1db518[_0x87da('0x61')]+'\x20'+_0x1db518[_0x87da('0x64')]:_0x1db518[_0x87da('0x64')],'id':_0x1db518['id']};_0x262d94[_0x87da('0x65')]=_['startCase'](_0x1db518[_0x87da('0x50')]);}if(_0x17e542[_0x87da('0x66')]){_0x262d94[_0x87da('0x67')]=moment['utc'](parseInt(_0x17e542['talktime'])*0x3e8)['format']('mm:ss');}else if(_0x17e542[_0x87da('0x68')]&&_0x17e542[_0x87da('0x69')]){_0x262d94[_0x87da('0x67')]=moment['utc'](moment(_0x17e542[_0x87da('0x69')],_0x87da('0x6a'))['diff'](moment(_0x17e542[_0x87da('0x6b')],'YYYY-MM-DDTHH:mm:ss')))[_0x87da('0x38')](_0x87da('0x6c'));}switch(_0x17e542[_0x87da('0x6d')]){case'called':_0x262d94[_0x87da('0x6e')]='Called';break;case _0x87da('0x6f'):case _0x87da('0x70'):_0x262d94[_0x87da('0x6e')]=_0x87da('0x71');break;case _0x87da('0x72'):_0x262d94['Call_Result']='Rejected';break;case _0x87da('0x73'):_0x262d94[_0x87da('0x6e')]='Abandoned';break;case'timeout':_0x262d94[_0x87da('0x6e')]=_0x87da('0x74');default:}_0x262d94[_0x87da('0x75')]=(_0x184ac3===_0x87da('0x76')?moment(_0x17e542[_0x87da('0x6b')])[_0x87da('0x38')](_0x87da('0x6a')):moment(_0x17e542[_0x87da('0x77')])[_0x87da('0x38')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x87da('0x38')]('YYYY-MM-DDTHH:mm:ss');_0x262d94['Call_Type']=_0x184ac3||_0x87da('0x78');_0x262d94=_[_0x87da('0x79')](_0x262d94,getCustomFields(_0x337eb3['Fields'],_0x17e542));return request({'method':_0x87da('0x2b'),'uri':_0x87da('0x47')+_0x3cd1ed+_0x87da('0x7a'),'headers':{'Authorization':_0x87da('0x3b')+_0x594724},'body':{'data':[_0x262d94]},'json':!![]})[_0x87da('0x2f')](function(_0x4cb44f){if(_0x4cb44f&&_0x4cb44f['data'][0x0][_0x87da('0x7b')]===_0x87da('0x4e')){logger[_0x87da('0x35')](_0x87da('0x7c'));return{'id':_0x4cb44f[_0x87da('0x46')][0x0][_0x87da('0x4f')]['id']};}})[_0x87da('0x45')](function(_0x49a85f){logger[_0x87da('0x35')](_0x87da('0x7d'),_0x49a85f[_0x87da('0x34')]);console['log'](_0x87da('0x7d'),_0x49a85f);});}exports[_0x87da('0x7e')]=function(_0xc59dba,_0x48f5c5,_0x4bc831,_0x52f289,_0x420696,_0x1bc36f){var _0x58736f,_0x39b904,_0x5e5801;_0x1bc36f[_0x87da('0x7f')]=intUtil[_0x87da('0x80')](_0x1bc36f[_0x87da('0x7f')]);_0x1bc36f[_0x87da('0x81')]=intUtil[_0x87da('0x80')](_0x1bc36f['serverUrl']);if(_0x420696&&_0x420696[_0x87da('0x82')]){logger[_0x87da('0x35')]('[QUEUE]','Recording\x20is\x20enabled!');_0x48f5c5[_0x87da('0x83')]=_0x1bc36f['serverUrl']+_0x87da('0x84')+_0x48f5c5[_0x87da('0x85')]+_0x87da('0x86')+md5(_0x48f5c5['uniqueid']);}else{_0x48f5c5[_0x87da('0x83')]='';}var _0x41bccb=_0x1bc36f[_0x87da('0x7f')]===_0x87da('0x87')?'eu':_0x87da('0x88');return getAccessToken(_0x1bc36f)[_0x87da('0x2f')](function(_0x2855f0){_0x5e5801=_0x2855f0;return getUser(_0x5e5801,_0x41bccb,_0x1bc36f,_0x52f289[_0x87da('0x3e')]);})[_0x87da('0x2f')](function(_0x12924d){_0x58736f=_0x12924d;logger[_0x87da('0x35')](_0x87da('0x89'),_0x58736f['id']);return getEndUser(_0x5e5801,_0x41bccb,_0x1bc36f,_0x48f5c5[_0x87da('0x8a')],_0x48f5c5[_0x87da('0x8b')],_0x58736f,_0x4bc831);})[_0x87da('0x2f')](function(_0x417662){_0x39b904=_0x417662;return getCall(_0x5e5801,_0x41bccb,_0x1bc36f,_0x58736f,_0x39b904,_0x4bc831,_0x48f5c5,_0x87da('0x78'));})[_0x87da('0x2f')](function(_0x3edd35){if(_0x3edd35){logger[_0x87da('0x35')]('The\x20Call\x20ID\x20is:',_0x3edd35['id']);logger[_0x87da('0x35')](_0x87da('0x8c'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x87da('0x8d'),_0x52f289[_0x87da('0x1e')]),_0x87da('0x8e'),{'uri':_0x87da('0x8f')+_0x1bc36f[_0x87da('0x7f')]+_0x87da('0x90')+_0x3edd35['id']});}})[_0x87da('0x45')](function(_0x29a0ea){logger[_0x87da('0x32')](_0x87da('0x8c'),JSON[_0x87da('0x11')](_0x29a0ea));});};exports[_0x87da('0x76')]=function(_0x5f3b5d,_0x5a44d8,_0x20f93b,_0x351a36,_0xe987d1,_0x30c89a,_0x285f3a){var _0x1b7552,_0x17a3f5,_0x48bd44;_0x30c89a[_0x87da('0x7f')]=intUtil[_0x87da('0x80')](_0x30c89a['host']);_0x30c89a[_0x87da('0x81')]=intUtil[_0x87da('0x80')](_0x30c89a[_0x87da('0x81')]);if(_0x285f3a&&_0x285f3a[_0x87da('0x91')]&&_0x285f3a[_0x87da('0x91')]!==_0x87da('0x92')){logger[_0x87da('0x35')](_0x87da('0x93'),_0x87da('0x94'));_0x5a44d8[_0x87da('0x83')]=_0x30c89a['serverUrl']+_0x87da('0x84')+_0x5a44d8[_0x87da('0x85')]+_0x87da('0x86')+md5(_0x5a44d8['uniqueid']);}var _0x482277=_0x30c89a['host']===_0x87da('0x87')?'eu':_0x87da('0x88');return getAccessToken(_0x30c89a)['then'](function(_0x31153d){_0x48bd44=_0x31153d;return getUser(_0x48bd44,_0x482277,_0x30c89a,_0x351a36['email']);})[_0x87da('0x2f')](function(_0x165ff1){_0x1b7552=_0x165ff1;logger[_0x87da('0x35')](_0x87da('0x89'),_0x1b7552['id']);return getEndUser(_0x48bd44,_0x482277,_0x30c89a,_0x5a44d8[_0x87da('0x95')],_0x5a44d8[_0x87da('0x96')],_0x1b7552,_0x20f93b);})['then'](function(_0x120f74){_0x17a3f5=_0x120f74;return getCall(_0x48bd44,_0x482277,_0x30c89a,_0x1b7552,_0x17a3f5,_0x20f93b,_0x5a44d8,_0x87da('0x97'));})[_0x87da('0x2f')](function(_0x1a7c7e){if(_0x1a7c7e){logger[_0x87da('0x35')](_0x87da('0x98'),_0x1a7c7e['id']);logger[_0x87da('0x35')](_0x87da('0x93'),_0x87da('0x99'));emit(util[_0x87da('0x38')](_0x87da('0x8d'),_0x351a36[_0x87da('0x1e')]),'trigger:browser:url',{'uri':_0x87da('0x8f')+_0x30c89a[_0x87da('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1a7c7e['id']});}})['catch'](function(_0xd5615){logger[_0x87da('0x32')](_0x87da('0x93'),JSON['stringify'](_0xd5615));});};exports[_0x87da('0x9a')]=function(_0x3c35d4,_0x21718,_0x55e808,_0x33cf12,_0x3367e4,_0x263abe){var _0x3859c6,_0x1bc41b,_0x405158;_0x263abe[_0x87da('0x7f')]=intUtil[_0x87da('0x80')](_0x263abe[_0x87da('0x7f')]);_0x263abe[_0x87da('0x81')]=intUtil[_0x87da('0x80')](_0x263abe[_0x87da('0x81')]);if(_0x3367e4&&_0x3367e4[_0x87da('0x82')]){logger['info']('['+_0x21718[_0x87da('0x6d')][_0x87da('0x9b')]()+']',_0x87da('0x94'));_0x21718['recordingURL']=_0x263abe[_0x87da('0x81')]+_0x87da('0x84')+_0x21718[_0x87da('0x85')]+_0x87da('0x86')+md5(_0x21718[_0x87da('0x85')]);}else{_0x21718[_0x87da('0x83')]='';}var _0x290752=_0x263abe['host']===_0x87da('0x87')?'eu':_0x87da('0x88');return getAccessToken(_0x263abe)[_0x87da('0x2f')](function(_0x3720cc){_0x405158=_0x3720cc;return getUser(_0x405158,_0x290752,_0x263abe);})[_0x87da('0x2f')](function(_0x4db71c){_0x3859c6=_0x4db71c;logger['info'](_0x87da('0x89'),_0x3859c6['id']);return getEndUser(_0x405158,_0x290752,_0x263abe,_0x21718[_0x87da('0x8a')],_0x21718[_0x87da('0x8b')],_0x3859c6,_0x55e808);})[_0x87da('0x2f')](function(_0x4f1cd2){_0x1bc41b=_0x4f1cd2;return getCall(_0x405158,_0x290752,_0x263abe,_0x3859c6,_0x1bc41b,_0x55e808,_0x21718,_0x87da('0x78'));})[_0x87da('0x2f')](function(_0x56a469){if(_0x56a469){logger[_0x87da('0x35')](_0x87da('0x98'),_0x56a469['id']);}})[_0x87da('0x45')](function(_0x44332a){logger[_0x87da('0x32')]('['+_0x21718[_0x87da('0x6d')][_0x87da('0x9b')]()+']',JSON[_0x87da('0x11')](_0x44332a));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index ba9715f..e8d684a 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b73=['shelljs','mustache','trigger','exec','data2','Script','data3','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x972692,_0x2a1c56){var _0x542e84=function(_0xe63f21){while(--_0xe63f21){_0x972692['push'](_0x972692['shift']());}};_0x542e84(++_0x2a1c56);}(_0x5b73,0x1d3));var _0x35b7=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x5b73[_0xabbd2f];return _0x34a040;};'use strict';var util=require(_0x35b7('0x0'));var sh=require(_0x35b7('0x1'));var Mustache=require(_0x35b7('0x2'));var logger=require('../../../../config/logger')(_0x35b7('0x3'));exports[_0x35b7('0x4')]=function(_0x1b1478,_0x3fb300){var _0x1335b7=_0x1b1478[_0x35b7('0x5')]?_0x1b1478[_0x35b7('0x5')]:_0x35b7('0x6');var _0x1db6d9=_0x1b1478[_0x35b7('0x7')]?Mustache['render'](_0x1b1478[_0x35b7('0x7')],_0x3fb300):_0x3fb300;sh['exec'](_0x1db6d9,function(_0xb2d06f,_0x30985,_0x23cafd){if(_0xb2d06f!==0x0){logger[_0x35b7('0x8')](util[_0x35b7('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x1335b7,_0x1db6d9,_0xb2d06f,_0x23cafd));}else{logger[_0x35b7('0xa')](util[_0x35b7('0x9')](_0x35b7('0xb'),_0x1335b7,_0x1db6d9,_0x30985));}});}; \ No newline at end of file +var _0x3d4d=['render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3'];(function(_0x3b3a17,_0x2c7c9a){var _0x4c5a33=function(_0x3d549f){while(--_0x3d549f){_0x3b3a17['push'](_0x3b3a17['shift']());}};_0x4c5a33(++_0x2c7c9a);}(_0x3d4d,0xe8));var _0xd3d4=function(_0x5bc1f4,_0x1a793f){_0x5bc1f4=_0x5bc1f4-0x0;var _0x5cd8ce=_0x3d4d[_0x5bc1f4];return _0x5cd8ce;};'use strict';var util=require(_0xd3d4('0x0'));var sh=require(_0xd3d4('0x1'));var Mustache=require(_0xd3d4('0x2'));var logger=require(_0xd3d4('0x3'))(_0xd3d4('0x4'));exports['exec']=function(_0x27f633,_0x2a2eb3){var _0x1331a2=_0x27f633[_0xd3d4('0x5')]?_0x27f633[_0xd3d4('0x5')]:_0xd3d4('0x6');var _0x628fd8=_0x27f633[_0xd3d4('0x7')]?Mustache[_0xd3d4('0x8')](_0x27f633['data3'],_0x2a2eb3):_0x2a2eb3;sh[_0xd3d4('0x9')](_0x628fd8,function(_0x2cb0a2,_0x39be57,_0x41aa7c){if(_0x2cb0a2!==0x0){logger[_0xd3d4('0xa')](util[_0xd3d4('0xb')](_0xd3d4('0xc'),_0x1331a2,_0x628fd8,_0x2cb0a2,_0x41aa7c));}else{logger[_0xd3d4('0xd')](util[_0xd3d4('0xb')](_0xd3d4('0xe'),_0x1331a2,_0x628fd8,_0x39be57));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 3fea03a..4cced9c 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x302d=['%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','then','isNil',',\x20request\x20body:\x20','object','stringify','catch','statusCode','name','message','request-promise','util','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','number','data5','headers','data6','parse','error','GET','DELETE','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0x302d,0x1d2));var _0xd302=function(_0x22320c,_0x20d5f5){_0x22320c=_0x22320c-0x0;var _0x29a5f6=_0x302d[_0x22320c];return _0x29a5f6;};'use strict';var rp=require(_0xd302('0x0'));var util=require(_0xd302('0x1'));var _=require('lodash');var Mustache=require(_0xd302('0x2'));var logger=require(_0xd302('0x3'))(_0xd302('0x4'));exports[_0xd302('0x5')]=function(_0x35408c,_0x1cc304){var _0x14fbc3,_0x2147fc;var _0x26f7b2={'method':_0x35408c[_0xd302('0x6')][_0xd302('0x7')](),'uri':Mustache[_0xd302('0x8')](_0x35408c['data2'],_0x1cc304),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x35408c['data5'])===_0xd302('0x9')&&parseInt(_0x35408c[_0xd302('0xa')])>=0x1&&parseInt(_0x35408c[_0xd302('0xa')])<=0xa?parseInt(_0x35408c[_0xd302('0xa')])*0x3e8:0x5*0x3e8};try{_0x26f7b2[_0xd302('0xb')]=_0x35408c[_0xd302('0xc')]?JSON[_0xd302('0xd')](Mustache[_0xd302('0x8')](_0x35408c[_0xd302('0xc')],_0x1cc304)):{};}catch(_0x1dfb30){logger[_0xd302('0xe')](_0x1dfb30['stack']);}switch(_0x35408c[_0xd302('0x6')][_0xd302('0x7')]()){case _0xd302('0xf'):case _0xd302('0x10'):_0x14fbc3=null;_0x26f7b2['qs']=_0x1cc304;break;case'POST':case _0xd302('0x11'):if(_0x35408c[_0xd302('0x12')]){try{_0x14fbc3=JSON[_0xd302('0xd')](Mustache['render'](_0x35408c[_0xd302('0x12')],_0x1cc304));_0x26f7b2[_0xd302('0x13')]=_0x14fbc3;}catch(_0x5863f5){logger[_0xd302('0xe')](_0x5863f5[_0xd302('0x14')]);logger[_0xd302('0xe')](_0xd302('0x15'));}}else{_0x14fbc3=_0x1cc304;_0x26f7b2[_0xd302('0x13')]=_0x14fbc3;}break;}logger[_0xd302('0x16')](util[_0xd302('0x17')](_0xd302('0x18'),_0x35408c[_0xd302('0x6')],_0x35408c[_0xd302('0x19')],JSON['stringify'](_0x26f7b2)));rp(_0x26f7b2)[_0xd302('0x1a')](function(_0x4de98d){_0x14fbc3=!_[_0xd302('0x1b')](_0x14fbc3)?_0xd302('0x1c')+_0x14fbc3:'';_0x2147fc=typeof _0x4de98d['body']===_0xd302('0x1d')?JSON[_0xd302('0x1e')](_0x4de98d[_0xd302('0x13')]):_0x4de98d[_0xd302('0x13')];logger[_0xd302('0x16')](util[_0xd302('0x17')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x35408c['data1'],_0x35408c[_0xd302('0x19')],_0x4de98d['statusCode'],_0x2147fc));})[_0xd302('0x1f')](function(_0x4f59ab){logger[_0xd302('0xe')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x35408c['data1'],_0x35408c['data2'],_0x4f59ab[_0xd302('0x20')],_0x4f59ab[_0xd302('0x21')],_0x4f59ab[_0xd302('0x22')]));});}; \ No newline at end of file +var _0x5909=['data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','stringify','then','isNil','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','trigger','exec','data1','toUpperCase','data2','data5','number','headers','data6','render','error','stack','GET','DELETE','POST','PUT'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0x5909,0x14b));var _0x9590=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x5909[_0x3a8dc1];return _0x4b3595;};'use strict';var rp=require(_0x9590('0x0'));var util=require(_0x9590('0x1'));var _=require(_0x9590('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x9590('0x3'));exports[_0x9590('0x4')]=function(_0x585f53,_0x4d8a74){var _0x5cfea2,_0x16bf21;var _0x1e45af={'method':_0x585f53[_0x9590('0x5')][_0x9590('0x6')](),'uri':Mustache['render'](_0x585f53[_0x9590('0x7')],_0x4d8a74),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x585f53[_0x9590('0x8')])===_0x9590('0x9')&&parseInt(_0x585f53[_0x9590('0x8')])>=0x1&&parseInt(_0x585f53[_0x9590('0x8')])<=0xa?parseInt(_0x585f53[_0x9590('0x8')])*0x3e8:0x5*0x3e8};try{_0x1e45af[_0x9590('0xa')]=_0x585f53[_0x9590('0xb')]?JSON['parse'](Mustache[_0x9590('0xc')](_0x585f53[_0x9590('0xb')],_0x4d8a74)):{};}catch(_0x53b423){logger[_0x9590('0xd')](_0x53b423[_0x9590('0xe')]);}switch(_0x585f53['data1']['toUpperCase']()){case _0x9590('0xf'):case _0x9590('0x10'):_0x5cfea2=null;_0x1e45af['qs']=_0x4d8a74;break;case _0x9590('0x11'):case _0x9590('0x12'):if(_0x585f53[_0x9590('0x13')]){try{_0x5cfea2=JSON[_0x9590('0x14')](Mustache[_0x9590('0xc')](_0x585f53[_0x9590('0x13')],_0x4d8a74));_0x1e45af[_0x9590('0x15')]=_0x5cfea2;}catch(_0x383237){logger[_0x9590('0xd')](_0x383237['stack']);logger['error'](_0x9590('0x16'));}}else{_0x5cfea2=_0x4d8a74;_0x1e45af[_0x9590('0x15')]=_0x5cfea2;}break;}logger['info'](util[_0x9590('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x585f53['data1'],_0x585f53[_0x9590('0x7')],JSON[_0x9590('0x18')](_0x1e45af)));rp(_0x1e45af)[_0x9590('0x19')](function(_0x348db9){_0x5cfea2=!_[_0x9590('0x1a')](_0x5cfea2)?',\x20request\x20body:\x20'+_0x5cfea2:'';_0x16bf21=typeof _0x348db9['body']===_0x9590('0x1b')?JSON[_0x9590('0x18')](_0x348db9['body']):_0x348db9['body'];logger[_0x9590('0x1c')](util['format'](_0x9590('0x1d'),_0x585f53[_0x9590('0x5')],_0x585f53[_0x9590('0x7')],_0x348db9[_0x9590('0x1e')],_0x16bf21));})[_0x9590('0x1f')](function(_0x4671f9){logger[_0x9590('0xd')](util[_0x9590('0x17')](_0x9590('0x20'),_0x585f53['data1'],_0x585f53['data2'],_0x4671f9[_0x9590('0x1e')],_0x4671f9[_0x9590('0x21')],_0x4671f9[_0x9590('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 6935e24..35d8fa2 100644 --- a/server/services/email/client.js +++ b/server/services/email/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfb4=['exports','bluebird','../../config/logger','routing','http','Request','debug','rpc','error','message','result','catch'];(function(_0x277fa4,_0x51fbc6){var _0x2374d3=function(_0x278ed9){while(--_0x278ed9){_0x277fa4['push'](_0x277fa4['shift']());}};_0x2374d3(++_0x51fbc6);}(_0xbfb4,0x1a5));var _0x4bfb=function(_0x51f2b3,_0x34ce8d){_0x51f2b3=_0x51f2b3-0x0;var _0x5d2b4a=_0xbfb4[_0x51f2b3];return _0x5d2b4a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x4bfb('0x0'));var logger=require(_0x4bfb('0x1'))(_0x4bfb('0x2'));var client=jayson['client'][_0x4bfb('0x3')]({'port':0x2329});client[_0x4bfb('0x4')]=function(_0x16b439,_0xc6633b){return new BPromise(function(_0x412a16,_0x523edf){return client['request'](_0x16b439,_0xc6633b)['then'](function(_0xc7d643){logger[_0x4bfb('0x5')](_0x4bfb('0x6'),_0x4bfb('0x2'),_0x16b439,_0xc6633b,_0xc7d643);if(_0xc7d643['error']){logger[_0x4bfb('0x7')]('rpc','routing',_0x16b439,_0xc7d643[_0x4bfb('0x7')][_0x4bfb('0x8')],_0xc6633b);return _0x523edf(_0xc7d643[_0x4bfb('0x7')]['message']);}else{return _0x412a16(_0xc7d643[_0x4bfb('0x9')]);}})[_0x4bfb('0xa')](function(_0x31676d){logger['error'](_0x4bfb('0x6'),_0x4bfb('0x2'),_0x16b439,_0x31676d,_0xc6633b);return _0x523edf(_0x31676d);});});};module[_0x4bfb('0xb')]=client; \ No newline at end of file +var _0x6e93=['exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message','result','catch'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x6e93,0x1e1));var _0x36e9=function(_0x1387d8,_0x43145d){_0x1387d8=_0x1387d8-0x0;var _0x20c70c=_0x6e93[_0x1387d8];return _0x20c70c;};'use strict';var jayson=require(_0x36e9('0x0'));var BPromise=require(_0x36e9('0x1'));var logger=require(_0x36e9('0x2'))(_0x36e9('0x3'));var client=jayson[_0x36e9('0x4')][_0x36e9('0x5')]({'port':0x2329});client[_0x36e9('0x6')]=function(_0x3c4678,_0x51bcda){return new BPromise(function(_0x28618b,_0x4711d7){return client[_0x36e9('0x7')](_0x3c4678,_0x51bcda)['then'](function(_0x255b21){logger[_0x36e9('0x8')](_0x36e9('0x9'),_0x36e9('0x3'),_0x3c4678,_0x51bcda,_0x255b21);if(_0x255b21[_0x36e9('0xa')]){logger[_0x36e9('0xa')](_0x36e9('0x9'),_0x36e9('0x3'),_0x3c4678,_0x255b21[_0x36e9('0xa')][_0x36e9('0xb')],_0x51bcda);return _0x4711d7(_0x255b21[_0x36e9('0xa')][_0x36e9('0xb')]);}else{return _0x28618b(_0x255b21[_0x36e9('0xc')]);}})[_0x36e9('0xd')](function(_0xec5fd7){logger[_0x36e9('0xa')](_0x36e9('0x9'),_0x36e9('0x3'),_0x3c4678,_0xec5fd7,_0x51bcda);return _0x4711d7(_0xec5fd7);});});};module[_0x36e9('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5456608..df039a8 100644 --- a/server/services/email/index.js +++ b/server/services/email/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d32=['mailAccounts','listen','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','getMailAccounts','refresh'];(function(_0x8b15,_0x4c7b01){var _0x2b8613=function(_0x27ae61){while(--_0x27ae61){_0x8b15['push'](_0x8b15['shift']());}};_0x2b8613(++_0x4c7b01);}(_0x1d32,0x9b));var _0x21d3=function(_0x52e6fb,_0x4dad24){_0x52e6fb=_0x52e6fb-0x0;var _0x4ad463=_0x1d32[_0x52e6fb];return _0x4ad463;};'use strict';var server=require(_0x21d3('0x0'));var Realtime=require(_0x21d3('0x1'));var EmailChannel=require(_0x21d3('0x2'));var mailAccount=require(_0x21d3('0x3'));var setting=require(_0x21d3('0x4'));var logger=require(_0x21d3('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x21d3('0x6')]()[_0x21d3('0x7')](mailAccount[_0x21d3('0x8')]())[_0x21d3('0x7')](realtime['initMailAccounts']())['then'](function(){email[_0x21d3('0x9')](realtime[_0x21d3('0xa')]);return realtime;});}function main(){return server[_0x21d3('0xb')](realtime,email)[_0x21d3('0x7')](function(){return initRealtime();})[_0x21d3('0x7')](function(){return setting['getSettings']();})[_0x21d3('0x7')](function(_0x568263){return setInterval(initRealtime,_0x568263[_0x21d3('0xc')]*0x3e8);})[_0x21d3('0xd')](function(_0x4fbce6){logger['error'](_0x21d3('0xe'),_0x4fbce6);});}main(); \ No newline at end of file +var _0x571a=['refresh','mailAccounts','listen','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','getMailAccounts','then','initMailAccounts'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x571a,0x96));var _0xa571=function(_0x49c373,_0x1e47e1){_0x49c373=_0x49c373-0x0;var _0x57905f=_0x571a[_0x49c373];return _0x57905f;};'use strict';var server=require(_0xa571('0x0'));var Realtime=require(_0xa571('0x1'));var EmailChannel=require(_0xa571('0x2'));var mailAccount=require(_0xa571('0x3'));var setting=require(_0xa571('0x4'));var logger=require(_0xa571('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa571('0x6')]()['then'](mailAccount[_0xa571('0x7')]())[_0xa571('0x8')](realtime[_0xa571('0x9')]())[_0xa571('0x8')](function(){email[_0xa571('0xa')](realtime[_0xa571('0xb')]);return realtime;});}function main(){return server[_0xa571('0xc')](realtime,email)['then'](function(){return initRealtime();})[_0xa571('0x8')](function(){return setting['getSettings']();})['then'](function(_0x37b8f7){return setInterval(initRealtime,_0x37b8f7[_0xa571('0xd')]*0x3e8);})[_0xa571('0xe')](function(_0x3a345b){logger['error'](_0xa571('0xf'),_0x3a345b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index e5d60da..6b18ffc 100644 --- a/server/services/email/lib/email.js +++ b/server/services/email/lib/email.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e37=['firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','error','sendMail','send','verifySmtp','Smtp','smtp','verify','verified','exports','bluebird','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','prototype','emit','name','Imap','total','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','active','provider','custom','service','imapAccounts','email','box','handleImapBox','bind','handleImapEmail','handleImapEnd','handleImapError','status','disabled','messageStatus','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s'];(function(_0x1fd1ae,_0x2f518a){var _0x427d94=function(_0x3e8037){while(--_0x3e8037){_0x1fd1ae['push'](_0x1fd1ae['shift']());}};_0x427d94(++_0x2f518a);}(_0x7e37,0x1a7));var _0x77e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e37[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x77e3('0x0'));var md5=require('md5');var Redis=require(_0x77e3('0x1'));var config=require(_0x77e3('0x2'));var logger=require(_0x77e3('0x3'))('email');config[_0x77e3('0x4')]=_[_0x77e3('0x5')](config['redis'],{'host':_0x77e3('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x77e3('0x4')]));var EmailImap=require(_0x77e3('0x7'));var EmailSmtp=require(_0x77e3('0x8'));var mailAccount=require(_0x77e3('0x9'));var md5Accounts={};function EmailChannel(_0xa0d47f){logger[_0x77e3('0xa')](_0x77e3('0xb'));this[_0x77e3('0xc')]=_0xa0d47f[_0x77e3('0xc')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x77e3('0xd')][_0x77e3('0xe')]=function(_0xde2a32){var _0xf37f43=this[_0x77e3('0xc')][_0xde2a32];var _0x38212f={'id':_0xf37f43['id'],'name':_0xf37f43[_0x77e3('0xf')],'key':_0xf37f43['key'],'active':_0xf37f43['active'],'Imap':{'status':_0xf37f43[_0x77e3('0x10')]['status'],'messageStatus':_0xf37f43[_0x77e3('0x10')]['messageStatus'],'total':_0xf37f43[_0x77e3('0x10')][_0x77e3('0x11')]}};if(_[_0x77e3('0x12')](md5Accounts[_0xde2a32])){md5Accounts[_0xde2a32]={};}var _0x50858e=md5(JSON[_0x77e3('0x13')](_0x38212f));if(md5Accounts[_0xde2a32][_0x77e3('0x14')]!==_0x50858e){md5Accounts[_0xde2a32][_0x77e3('0x14')]=_0x50858e;io['emit'](_0x77e3('0x15'),_0x38212f);}};EmailChannel[_0x77e3('0xd')][_0x77e3('0x16')]=function(_0x48845f){for(var _0x37b046 in _0x48845f){if(_0x48845f[_0x77e3('0x17')](_0x37b046)){if(_0x48845f[_0x37b046][_0x77e3('0x10')]&&_0x48845f[_0x37b046][_0x77e3('0x18')]){var _0x236994=_0x48845f[_0x37b046]['Imap'];if(!_0x236994['service']&&_0x48845f[_0x37b046][_0x77e3('0x19')]!==_0x77e3('0x1a'))_0x236994[_0x77e3('0x1b')]=_0x48845f[_0x37b046][_0x77e3('0x19')];if(!this[_0x77e3('0x1c')]['hasOwnProperty'](_0x236994['id'])){this[_0x77e3('0x1c')][_0x236994['id']]=new EmailImap(_0x236994,_0x48845f[_0x37b046][_0x77e3('0x1d')]);this[_0x77e3('0x1c')][_0x236994['id']]['on'](_0x77e3('0x1e'),this[_0x77e3('0x1f')][_0x77e3('0x20')](this,_0x37b046));this[_0x77e3('0x1c')][_0x236994['id']]['on'](_0x77e3('0x1d'),this[_0x77e3('0x21')][_0x77e3('0x20')](this,_0x37b046));this[_0x77e3('0x1c')][_0x236994['id']]['on']('end',this[_0x77e3('0x22')][_0x77e3('0x20')](this,_0x37b046));this[_0x77e3('0x1c')][_0x236994['id']]['on']('error',this[_0x77e3('0x23')][_0x77e3('0x20')](this,_0x37b046));}}else{if(_['isNil'](this['mailAccounts'][_0x37b046][_0x77e3('0x10')])){this['mailAccounts'][_0x37b046][_0x77e3('0x10')]={};}this['mailAccounts'][_0x37b046][_0x77e3('0x10')][_0x77e3('0x24')]=_0x77e3('0x25');this['mailAccounts'][_0x37b046][_0x77e3('0x10')][_0x77e3('0x26')]='';this[_0x77e3('0xe')](_0x37b046);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x1e6a1b,_0x314a53){if(this[_0x77e3('0xc')][_0x1e6a1b]){this['mailAccounts'][_0x1e6a1b][_0x77e3('0x10')][_0x77e3('0x24')]=_0x77e3('0x27');this[_0x77e3('0xc')][_0x1e6a1b][_0x77e3('0x10')][_0x77e3('0x26')]=_0x314a53[_0x77e3('0xf')];if(_0x314a53['messages']){this[_0x77e3('0xc')][_0x1e6a1b][_0x77e3('0x10')][_0x77e3('0x11')]=_0x314a53['messages']['total'];}return this[_0x77e3('0xe')](_0x1e6a1b);}};EmailChannel[_0x77e3('0xd')][_0x77e3('0x21')]=function(_0x5b12d6,_0x5d6c31){logger[_0x77e3('0xa')](_0x77e3('0x28'),_0x5d6c31[_0x77e3('0x29')],_0x5d6c31[_0x77e3('0x2a')],_0x5d6c31[_0x77e3('0x2b')],_0x5b12d6);if(this[_0x77e3('0xc')][_0x5b12d6]){return mailAccount['notify'](_0x5b12d6,_0x5d6c31)[_0x77e3('0x2c')](function(_0x561675){if(_0x561675){logger[_0x77e3('0xa')](_0x77e3('0x2d'));}})[_0x77e3('0x2e')](function(_0x2b9477){logger['error'](_0x77e3('0x2f'),JSON[_0x77e3('0x13')](_0x2b9477));});}};EmailChannel[_0x77e3('0xd')]['handleImapEnd']=function(_0x41d933){if(this[_0x77e3('0xc')][_0x41d933]&&this[_0x77e3('0xc')][_0x41d933][_0x77e3('0x10')]){if(this[_0x77e3('0x1c')][this[_0x77e3('0xc')][_0x41d933]['Imap']['id']]){delete this[_0x77e3('0x1c')][this[_0x77e3('0xc')][_0x41d933][_0x77e3('0x10')]['id']];}this['mailAccounts'][_0x41d933][_0x77e3('0x10')][_0x77e3('0x30')]=moment();this['emit'](_0x41d933);}};EmailChannel[_0x77e3('0xd')][_0x77e3('0x23')]=function(_0x54a680,_0x215894){if(this[_0x77e3('0xc')][_0x54a680]){this[_0x77e3('0xc')][_0x54a680][_0x77e3('0x10')]['status']=_0x77e3('0x31');this[_0x77e3('0xc')][_0x54a680][_0x77e3('0x10')][_0x77e3('0x26')]=_0x215894;return this['emit'](_0x54a680);}};EmailChannel[_0x77e3('0xd')][_0x77e3('0x32')]=function(_0x2c1738,_0xf1a90c){return this['smtp'][_0x77e3('0x33')](_0x2c1738,_0xf1a90c);};EmailChannel[_0x77e3('0xd')][_0x77e3('0x34')]=function(_0x164737){var _0x2e6ab7=this;if(this['mailAccounts'][_0x164737['id']]){if(_[_0x77e3('0x12')](this[_0x77e3('0xc')][_0x164737['id']][_0x77e3('0x35')])){this[_0x77e3('0xc')][_0x164737['id']][_0x77e3('0x35')]={};}this[_0x77e3('0xc')][_0x164737['id']][_0x77e3('0x35')]['lastSync']=moment();return new BPromise(function(_0x2fb447,_0xbf533){return _0x2e6ab7[_0x77e3('0x36')][_0x77e3('0x37')](_0x164737)[_0x77e3('0x2c')](function(_0x16466e){_0x2e6ab7[_0x77e3('0xc')][_0x164737['id']][_0x77e3('0x35')]['status']=_0x77e3('0x38');_0x2e6ab7[_0x77e3('0xc')][_0x164737['id']]['Smtp'][_0x77e3('0x26')]='';_0x2e6ab7[_0x77e3('0xe')](_0x164737['id']);_0x2fb447(_0x16466e);})['catch'](function(_0x20f146){_0x2e6ab7[_0x77e3('0xc')][_0x164737['id']]['Smtp'][_0x77e3('0x24')]=_0x77e3('0x31');_0x2e6ab7[_0x77e3('0xc')][_0x164737['id']]['Smtp']['messageStatus']=_0x20f146;_0x2e6ab7[_0x77e3('0xe')](_0x164737['id']);_0xbf533(_0x20f146);});});}return this['smtp'][_0x77e3('0x37')](_0x164737);};module[_0x77e3('0x39')]=EmailChannel; \ No newline at end of file +var _0x7fd1=['handleImapError','connected','total','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','Smtp','lastSync','then','verified','verify','exports','lodash','moment','ioredis','../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','imapAccounts','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error'];(function(_0x165c51,_0x389bb0){var _0x1434f2=function(_0x1fa079){while(--_0x1fa079){_0x165c51['push'](_0x165c51['shift']());}};_0x1434f2(++_0x389bb0);}(_0x7fd1,0xc4));var _0x17fd=function(_0x5d8e31,_0xa6e523){_0x5d8e31=_0x5d8e31-0x0;var _0x502059=_0x7fd1[_0x5d8e31];return _0x502059;};'use strict';var _=require(_0x17fd('0x0'));var moment=require(_0x17fd('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x17fd('0x2'));var config=require('../../../config/environment');var logger=require(_0x17fd('0x3'))(_0x17fd('0x4'));config['redis']=_[_0x17fd('0x5')](config['redis'],{'host':_0x17fd('0x6'),'port':0x18eb});var io=require(_0x17fd('0x7'))(new Redis(config[_0x17fd('0x8')]));var EmailImap=require(_0x17fd('0x9'));var EmailSmtp=require(_0x17fd('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0xa57016){logger[_0x17fd('0xb')](_0x17fd('0xc'));this[_0x17fd('0xd')]=_0xa57016[_0x17fd('0xd')];this['imapAccounts']={};this[_0x17fd('0xe')]=new EmailSmtp();}EmailChannel[_0x17fd('0xf')][_0x17fd('0x10')]=function(_0x123d5b){var _0x6b60d5=this[_0x17fd('0xd')][_0x123d5b];var _0x1beb5c={'id':_0x6b60d5['id'],'name':_0x6b60d5[_0x17fd('0x11')],'key':_0x6b60d5[_0x17fd('0x12')],'active':_0x6b60d5[_0x17fd('0x13')],'Imap':{'status':_0x6b60d5[_0x17fd('0x14')][_0x17fd('0x15')],'messageStatus':_0x6b60d5[_0x17fd('0x14')][_0x17fd('0x16')],'total':_0x6b60d5[_0x17fd('0x14')]['total']}};if(_[_0x17fd('0x17')](md5Accounts[_0x123d5b])){md5Accounts[_0x123d5b]={};}var _0x101c47=md5(JSON[_0x17fd('0x18')](_0x1beb5c));if(md5Accounts[_0x123d5b][_0x17fd('0x19')]!==_0x101c47){md5Accounts[_0x123d5b][_0x17fd('0x19')]=_0x101c47;io[_0x17fd('0x10')](_0x17fd('0x1a'),_0x1beb5c);}};EmailChannel['prototype'][_0x17fd('0x1b')]=function(_0x16fb67){for(var _0x113b82 in _0x16fb67){if(_0x16fb67[_0x17fd('0x1c')](_0x113b82)){if(_0x16fb67[_0x113b82][_0x17fd('0x14')]&&_0x16fb67[_0x113b82]['active']){var _0x3df7d3=_0x16fb67[_0x113b82]['Imap'];if(!_0x3df7d3[_0x17fd('0x1d')]&&_0x16fb67[_0x113b82][_0x17fd('0x1e')]!==_0x17fd('0x1f'))_0x3df7d3[_0x17fd('0x1d')]=_0x16fb67[_0x113b82]['provider'];if(!this[_0x17fd('0x20')][_0x17fd('0x1c')](_0x3df7d3['id'])){this['imapAccounts'][_0x3df7d3['id']]=new EmailImap(_0x3df7d3,_0x16fb67[_0x113b82][_0x17fd('0x4')]);this['imapAccounts'][_0x3df7d3['id']]['on'](_0x17fd('0x21'),this[_0x17fd('0x22')]['bind'](this,_0x113b82));this[_0x17fd('0x20')][_0x3df7d3['id']]['on'](_0x17fd('0x4'),this[_0x17fd('0x23')][_0x17fd('0x24')](this,_0x113b82));this[_0x17fd('0x20')][_0x3df7d3['id']]['on'](_0x17fd('0x25'),this[_0x17fd('0x26')][_0x17fd('0x24')](this,_0x113b82));this['imapAccounts'][_0x3df7d3['id']]['on'](_0x17fd('0x27'),this[_0x17fd('0x28')]['bind'](this,_0x113b82));}}else{if(_[_0x17fd('0x17')](this[_0x17fd('0xd')][_0x113b82][_0x17fd('0x14')])){this['mailAccounts'][_0x113b82][_0x17fd('0x14')]={};}this['mailAccounts'][_0x113b82][_0x17fd('0x14')][_0x17fd('0x15')]='disabled';this[_0x17fd('0xd')][_0x113b82][_0x17fd('0x14')]['messageStatus']='';this[_0x17fd('0x10')](_0x113b82);}}}};EmailChannel[_0x17fd('0xf')]['handleImapBox']=function(_0x542e97,_0x22db8f){if(this[_0x17fd('0xd')][_0x542e97]){this[_0x17fd('0xd')][_0x542e97]['Imap'][_0x17fd('0x15')]=_0x17fd('0x29');this[_0x17fd('0xd')][_0x542e97]['Imap'][_0x17fd('0x16')]=_0x22db8f[_0x17fd('0x11')];if(_0x22db8f['messages']){this[_0x17fd('0xd')][_0x542e97][_0x17fd('0x14')][_0x17fd('0x2a')]=_0x22db8f[_0x17fd('0x2b')]['total'];}return this[_0x17fd('0x10')](_0x542e97);}};EmailChannel[_0x17fd('0xf')][_0x17fd('0x23')]=function(_0x1ea1a1,_0x417472){logger['info'](_0x17fd('0x2c'),_0x417472[_0x17fd('0x2d')],_0x417472[_0x17fd('0x2e')],_0x417472['from'],_0x1ea1a1);if(this[_0x17fd('0xd')][_0x1ea1a1]){return mailAccount[_0x17fd('0x2f')](_0x1ea1a1,_0x417472)['then'](function(_0x28038f){if(_0x28038f){logger[_0x17fd('0xb')](_0x17fd('0x30'));}})[_0x17fd('0x31')](function(_0x477a6f){logger[_0x17fd('0x27')](_0x17fd('0x32'),JSON[_0x17fd('0x18')](_0x477a6f));});}};EmailChannel[_0x17fd('0xf')]['handleImapEnd']=function(_0x4250ee){if(this[_0x17fd('0xd')][_0x4250ee]&&this['mailAccounts'][_0x4250ee][_0x17fd('0x14')]){if(this['imapAccounts'][this[_0x17fd('0xd')][_0x4250ee][_0x17fd('0x14')]['id']]){delete this[_0x17fd('0x20')][this[_0x17fd('0xd')][_0x4250ee][_0x17fd('0x14')]['id']];}this[_0x17fd('0xd')][_0x4250ee][_0x17fd('0x14')]['lastSync']=moment();this[_0x17fd('0x10')](_0x4250ee);}};EmailChannel[_0x17fd('0xf')][_0x17fd('0x28')]=function(_0x51be76,_0x2fe0d2){if(this['mailAccounts'][_0x51be76]){this[_0x17fd('0xd')][_0x51be76]['Imap'][_0x17fd('0x15')]=_0x17fd('0x27');this[_0x17fd('0xd')][_0x51be76][_0x17fd('0x14')][_0x17fd('0x16')]=_0x2fe0d2;return this[_0x17fd('0x10')](_0x51be76);}};EmailChannel[_0x17fd('0xf')][_0x17fd('0x33')]=function(_0x424c72,_0x1c03a5){return this[_0x17fd('0xe')][_0x17fd('0x34')](_0x424c72,_0x1c03a5);};EmailChannel[_0x17fd('0xf')]['verifySmtp']=function(_0x29c3c5){var _0x3a7086=this;if(this[_0x17fd('0xd')][_0x29c3c5['id']]){if(_[_0x17fd('0x17')](this[_0x17fd('0xd')][_0x29c3c5['id']]['Smtp'])){this[_0x17fd('0xd')][_0x29c3c5['id']][_0x17fd('0x35')]={};}this[_0x17fd('0xd')][_0x29c3c5['id']][_0x17fd('0x35')][_0x17fd('0x36')]=moment();return new BPromise(function(_0x255b56,_0x118e2c){return _0x3a7086[_0x17fd('0xe')]['verify'](_0x29c3c5)[_0x17fd('0x37')](function(_0x3f3c5a){_0x3a7086[_0x17fd('0xd')][_0x29c3c5['id']][_0x17fd('0x35')][_0x17fd('0x15')]=_0x17fd('0x38');_0x3a7086[_0x17fd('0xd')][_0x29c3c5['id']][_0x17fd('0x35')][_0x17fd('0x16')]='';_0x3a7086[_0x17fd('0x10')](_0x29c3c5['id']);_0x255b56(_0x3f3c5a);})[_0x17fd('0x31')](function(_0x56db9b){_0x3a7086[_0x17fd('0xd')][_0x29c3c5['id']]['Smtp'][_0x17fd('0x15')]=_0x17fd('0x27');_0x3a7086[_0x17fd('0xd')][_0x29c3c5['id']][_0x17fd('0x35')][_0x17fd('0x16')]=_0x56db9b;_0x3a7086[_0x17fd('0x10')](_0x29c3c5['id']);_0x118e2c(_0x56db9b);});});}return this['smtp'][_0x17fd('0x39')](_0x29c3c5);};module[_0x17fd('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index b83e378..9590bd4 100644 --- a/server/services/email/lib/imap.js +++ b/server/services/email/lib/imap.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8aad=['handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','handleFetchMessage','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','closeBox','stringify','textCode','hasOwnProperty','lodash','util','mailparser','iconv','Iconv','./utils','mailbox','account','getAccount','imap','ready','handleReady','bind','once','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','email','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','required','openBox','handleOpenBox','box','readUnseen'];(function(_0x139745,_0x503124){var _0x2cd695=function(_0x2ab1ba){while(--_0x2ab1ba){_0x139745['push'](_0x139745['shift']());}};_0x2cd695(++_0x503124);}(_0x8aad,0x146));var _0xd8aa=function(_0x51729d,_0x2e3c63){_0x51729d=_0x51729d-0x0;var _0x1fdad2=_0x8aad[_0x51729d];return _0x1fdad2;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var Imap=require('imap');var simpleParser=require(_0xd8aa('0x2'))['simpleParser'];var Iconv=require(_0xd8aa('0x3'))[_0xd8aa('0x4')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0xd8aa('0x5'));var logger=require('../../../config/logger')('email');function EmailImap(_0x16b648,_0x43ddeb){this[_0xd8aa('0x6')]='INBOX';this[_0xd8aa('0x7')]=this[_0xd8aa('0x8')](_0x16b648,_0x43ddeb);this[_0xd8aa('0x9')]=new Imap(this[_0xd8aa('0x7')]);this['imap']['once'](_0xd8aa('0xa'),this[_0xd8aa('0xb')][_0xd8aa('0xc')](this));this[_0xd8aa('0x9')][_0xd8aa('0xd')]('end',this[_0xd8aa('0xe')][_0xd8aa('0xc')](this));this[_0xd8aa('0x9')]['on'](_0xd8aa('0xf'),this[_0xd8aa('0x10')][_0xd8aa('0xc')](this));this[_0xd8aa('0x9')][_0xd8aa('0x11')]();}util[_0xd8aa('0x12')](EmailImap,EventEmitter);EmailImap[_0xd8aa('0x13')]['getAccount']=function(_0x5a8c79,_0x275eff){var _0x319ffe={'connTimeout':_0x5a8c79[_0xd8aa('0x14')]?_0x5a8c79['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5a8c79[_0xd8aa('0x15')]?_0x5a8c79[_0xd8aa('0x15')]*0x3e8:0x1388};if(_0x5a8c79[_0xd8aa('0x16')]){_0x319ffe[_0xd8aa('0x17')]=_0x5a8c79['user'];_0x319ffe[_0xd8aa('0x18')]=_0x275eff||_0x5a8c79[_0xd8aa('0x17')]||'anonymous@xcally.com';if(_0x5a8c79[_0xd8aa('0x19')]){_0x319ffe[_0xd8aa('0x1a')]=utils[_0xd8aa('0x1b')](_0x5a8c79[_0xd8aa('0x1c')][_0xd8aa('0x1d')],_0x5a8c79['user']);}else{_0x319ffe[_0xd8aa('0x1e')]=_0x5a8c79[_0xd8aa('0x1e')];}}else{if(_0x5a8c79[_0xd8aa('0x1f')]){_0x319ffe[_0xd8aa('0x17')]=_0x5a8c79['user'];_0x319ffe[_0xd8aa('0x1e')]=_0x5a8c79[_0xd8aa('0x1e')];}}_0x319ffe[_0xd8aa('0x20')]=_0x5a8c79[_0xd8aa('0x20')];_0x319ffe[_0xd8aa('0x21')]=_0x5a8c79['port']||0x3e1;if(_0x5a8c79[_0xd8aa('0x22')]){_0x319ffe[_0xd8aa('0x22')]=!![];}else{_0x319ffe[_0xd8aa('0x22')]=![];_0x319ffe['autotls']=_0xd8aa('0x23');}return _0x319ffe;};EmailImap[_0xd8aa('0x13')][_0xd8aa('0xb')]=function(){this[_0xd8aa('0x9')][_0xd8aa('0x24')](this[_0xd8aa('0x6')],![],this[_0xd8aa('0x25')][_0xd8aa('0xc')](this));};EmailImap[_0xd8aa('0x13')][_0xd8aa('0x25')]=function(_0x6614ab,_0x370d6f){if(_0x6614ab){this[_0xd8aa('0x10')](_0x6614ab,!![]);}else{this['emit'](_0xd8aa('0x26'),_0x370d6f);this[_0xd8aa('0x27')]();}};EmailImap[_0xd8aa('0x13')][_0xd8aa('0x28')]=function(_0x26cff3){if(_0x26cff3){this[_0xd8aa('0x10')](_0x26cff3,!![]);}else{this[_0xd8aa('0x9')][_0xd8aa('0x29')]();}};EmailImap[_0xd8aa('0x13')][_0xd8aa('0x27')]=function(){this['imap'][_0xd8aa('0x2a')]([_0xd8aa('0x2b')],this[_0xd8aa('0x2c')]['bind'](this));};EmailImap[_0xd8aa('0x13')]['handleReadUnseen']=function(_0x3052c6,_0x441466){if(_0x3052c6){this[_0xd8aa('0x10')](_0x3052c6,!![]);}else{if(_0x441466[_0xd8aa('0x2d')]){try{var _0x44f783=this[_0xd8aa('0x9')][_0xd8aa('0x2e')](_0x441466,{'bodies':'','markSeen':!![]});_0x44f783['on'](_0xd8aa('0x2f'),this['handleFetchMessage'][_0xd8aa('0xc')](this));_0x44f783[_0xd8aa('0xd')](_0xd8aa('0xf'),this[_0xd8aa('0x30')][_0xd8aa('0xc')](this));_0x44f783[_0xd8aa('0xd')](_0xd8aa('0x29'),this[_0xd8aa('0x31')]['bind'](this));}catch(_0x265217){logger[_0xd8aa('0xf')](_0x265217);}}else{this[_0xd8aa('0x9')]['closeBox'](!![],this[_0xd8aa('0x28')][_0xd8aa('0xc')](this));}}};EmailImap[_0xd8aa('0x13')][_0xd8aa('0x32')]=function(_0x249564){_0x249564['on'](_0xd8aa('0x33'),this[_0xd8aa('0x34')][_0xd8aa('0xc')](this));_0x249564[_0xd8aa('0xd')]('attributes',this[_0xd8aa('0x35')][_0xd8aa('0xc')](this));_0x249564[_0xd8aa('0xd')](_0xd8aa('0x29'),this[_0xd8aa('0x36')][_0xd8aa('0xc')](this));};EmailImap[_0xd8aa('0x13')][_0xd8aa('0x34')]=function(_0xb8bfe6){simpleParser(_0xb8bfe6,{'Iconv':Iconv},this['handleSimpleParser'][_0xd8aa('0xc')](this));};EmailImap['prototype'][_0xd8aa('0x35')]=function(){};EmailImap[_0xd8aa('0x13')]['handleMessageEnd']=function(){};EmailImap[_0xd8aa('0x13')][_0xd8aa('0x37')]=function(_0xb503cc,_0x18da91){if(_0xb503cc){logger[_0xd8aa('0xf')](_0xb503cc);}else{var _0x567b24=this;utils['parser'](this[_0xd8aa('0x7')],_0x18da91,function(_0x4debd0){_0x567b24[_0xd8aa('0x38')](_0xd8aa('0x18'),_0x4debd0);});}};EmailImap[_0xd8aa('0x13')][_0xd8aa('0x31')]=function(){this[_0xd8aa('0x9')][_0xd8aa('0x39')](!![],this[_0xd8aa('0x28')][_0xd8aa('0xc')](this));};EmailImap[_0xd8aa('0x13')][_0xd8aa('0x30')]=function(_0x36ea98){this['handleError'](_0x36ea98);this[_0xd8aa('0x9')][_0xd8aa('0x39')](!![],this[_0xd8aa('0x28')]['bind'](this));};EmailImap[_0xd8aa('0x13')][_0xd8aa('0xe')]=function(){this[_0xd8aa('0x38')](_0xd8aa('0x29'));};EmailImap[_0xd8aa('0x13')][_0xd8aa('0x10')]=function(_0x2b28f9,_0x4570b7){logger[_0xd8aa('0xf')](_0xd8aa('0x10'),this[_0xd8aa('0x7')][_0xd8aa('0x18')],JSON[_0xd8aa('0x3a')](_0x2b28f9));var _0x18bea0='';if(_0x2b28f9){if(_0x2b28f9[_0xd8aa('0x3b')]){_0x18bea0=_0x2b28f9[_0xd8aa('0x3b')];}else{for(var _0x1577ff in _0x2b28f9){if(_0x2b28f9[_0xd8aa('0x3c')](_0x1577ff)){_0x18bea0+=_['upperFirst'](_0x1577ff)+':\x20'+_0x2b28f9[_0x1577ff]+'\x0a';}}}}if(_0x4570b7){this[_0xd8aa('0x9')][_0xd8aa('0x29')]();}else{this[_0xd8aa('0x38')](_0xd8aa('0xf'),_0x18bea0);this[_0xd8aa('0x38')](_0xd8aa('0x29'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x524e=['mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','generateXOAuth2Token','data5','password','host','port','tls','autotls','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','handleReadUnseen','length','fetch','message','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleFetchError','stringify','textCode','upperFirst','exports','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x524e,0x15e));var _0xe524=function(_0x12d02d,_0x17f40a){_0x12d02d=_0x12d02d-0x0;var _0x1c8e08=_0x524e[_0x12d02d];return _0x1c8e08;};'use strict';var _=require('lodash');var util=require('util');var Imap=require(_0xe524('0x0'));var simpleParser=require(_0xe524('0x1'))[_0xe524('0x2')];var Iconv=require(_0xe524('0x3'))[_0xe524('0x4')];var EventEmitter=require(_0xe524('0x5'))[_0xe524('0x6')];var utils=require(_0xe524('0x7'));var logger=require(_0xe524('0x8'))(_0xe524('0x9'));function EmailImap(_0x4f75d6,_0xaaeaa9){this[_0xe524('0xa')]=_0xe524('0xb');this['account']=this[_0xe524('0xc')](_0x4f75d6,_0xaaeaa9);this[_0xe524('0x0')]=new Imap(this[_0xe524('0xd')]);this[_0xe524('0x0')][_0xe524('0xe')](_0xe524('0xf'),this[_0xe524('0x10')][_0xe524('0x11')](this));this[_0xe524('0x0')][_0xe524('0xe')](_0xe524('0x12'),this[_0xe524('0x13')][_0xe524('0x11')](this));this[_0xe524('0x0')]['on'](_0xe524('0x14'),this[_0xe524('0x15')]['bind'](this));this['imap'][_0xe524('0x16')]();}util[_0xe524('0x17')](EmailImap,EventEmitter);EmailImap[_0xe524('0x18')][_0xe524('0xc')]=function(_0x20a852,_0x57c1b6){var _0x12ff75={'connTimeout':_0x20a852['connTimeout']?_0x20a852[_0xe524('0x19')]*0x3e8:0x2710,'authTimeout':_0x20a852[_0xe524('0x1a')]?_0x20a852['authTimeout']*0x3e8:0x1388};if(_0x20a852[_0xe524('0x1b')]){_0x12ff75['user']=_0x20a852[_0xe524('0x1c')];_0x12ff75['email']=_0x57c1b6||_0x20a852[_0xe524('0x1c')]||'anonymous@xcally.com';if(_0x20a852['modernAuthentication']){_0x12ff75['xoauth2']=utils[_0xe524('0x1d')](_0x20a852['CloudProvider'][_0xe524('0x1e')],_0x20a852[_0xe524('0x1c')]);}else{_0x12ff75[_0xe524('0x1f')]=_0x20a852[_0xe524('0x1f')];}}else{if(_0x20a852['authentication']){_0x12ff75[_0xe524('0x1c')]=_0x20a852[_0xe524('0x1c')];_0x12ff75['password']=_0x20a852[_0xe524('0x1f')];}}_0x12ff75[_0xe524('0x20')]=_0x20a852[_0xe524('0x20')];_0x12ff75[_0xe524('0x21')]=_0x20a852[_0xe524('0x21')]||0x3e1;if(_0x20a852[_0xe524('0x22')]){_0x12ff75[_0xe524('0x22')]=!![];}else{_0x12ff75[_0xe524('0x22')]=![];_0x12ff75[_0xe524('0x23')]='required';}return _0x12ff75;};EmailImap[_0xe524('0x18')]['handleReady']=function(){this['imap'][_0xe524('0x24')](this[_0xe524('0xa')],![],this[_0xe524('0x25')][_0xe524('0x11')](this));};EmailImap['prototype'][_0xe524('0x25')]=function(_0x4a03bc,_0x17e245){if(_0x4a03bc){this[_0xe524('0x15')](_0x4a03bc,!![]);}else{this[_0xe524('0x26')](_0xe524('0x27'),_0x17e245);this[_0xe524('0x28')]();}};EmailImap[_0xe524('0x18')][_0xe524('0x29')]=function(_0x583cc3){if(_0x583cc3){this['handleError'](_0x583cc3,!![]);}else{this[_0xe524('0x0')][_0xe524('0x12')]();}};EmailImap[_0xe524('0x18')][_0xe524('0x28')]=function(){this[_0xe524('0x0')]['search'](['UNSEEN'],this[_0xe524('0x2a')][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')][_0xe524('0x2a')]=function(_0x25c0a1,_0x517fa0){if(_0x25c0a1){this[_0xe524('0x15')](_0x25c0a1,!![]);}else{if(_0x517fa0[_0xe524('0x2b')]){try{var _0x4a4e15=this['imap'][_0xe524('0x2c')](_0x517fa0,{'bodies':'','markSeen':!![]});_0x4a4e15['on'](_0xe524('0x2d'),this['handleFetchMessage'][_0xe524('0x11')](this));_0x4a4e15['once'](_0xe524('0x14'),this['handleFetchError'][_0xe524('0x11')](this));_0x4a4e15[_0xe524('0xe')](_0xe524('0x12'),this['handleFetchEnd'][_0xe524('0x11')](this));}catch(_0x5238c9){logger[_0xe524('0x14')](_0x5238c9);}}else{this[_0xe524('0x0')][_0xe524('0x2e')](!![],this['handleCloseBox'][_0xe524('0x11')](this));}}};EmailImap[_0xe524('0x18')]['handleFetchMessage']=function(_0x27817e){_0x27817e['on'](_0xe524('0x2f'),this[_0xe524('0x30')][_0xe524('0x11')](this));_0x27817e['once'](_0xe524('0x31'),this[_0xe524('0x32')][_0xe524('0x11')](this));_0x27817e[_0xe524('0xe')](_0xe524('0x12'),this[_0xe524('0x33')][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')]['handleMessageBody']=function(_0x150a9f){simpleParser(_0x150a9f,{'Iconv':Iconv},this['handleSimpleParser'][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')]['handleMessageAttributes']=function(){};EmailImap[_0xe524('0x18')]['handleMessageEnd']=function(){};EmailImap[_0xe524('0x18')][_0xe524('0x34')]=function(_0x38758e,_0x3103e9){if(_0x38758e){logger[_0xe524('0x14')](_0x38758e);}else{var _0x10f911=this;utils[_0xe524('0x35')](this[_0xe524('0xd')],_0x3103e9,function(_0x5e8e64){_0x10f911[_0xe524('0x26')](_0xe524('0x9'),_0x5e8e64);});}};EmailImap[_0xe524('0x18')][_0xe524('0x36')]=function(){this[_0xe524('0x0')][_0xe524('0x2e')](!![],this[_0xe524('0x29')][_0xe524('0x11')](this));};EmailImap['prototype'][_0xe524('0x37')]=function(_0x849307){this[_0xe524('0x15')](_0x849307);this['imap'][_0xe524('0x2e')](!![],this['handleCloseBox'][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')][_0xe524('0x13')]=function(){this[_0xe524('0x26')](_0xe524('0x12'));};EmailImap[_0xe524('0x18')][_0xe524('0x15')]=function(_0x52cd0e,_0x8969fb){logger[_0xe524('0x14')](_0xe524('0x15'),this[_0xe524('0xd')][_0xe524('0x9')],JSON[_0xe524('0x38')](_0x52cd0e));var _0x4a4a16='';if(_0x52cd0e){if(_0x52cd0e[_0xe524('0x39')]){_0x4a4a16=_0x52cd0e[_0xe524('0x39')];}else{for(var _0x3fe124 in _0x52cd0e){if(_0x52cd0e['hasOwnProperty'](_0x3fe124)){_0x4a4a16+=_[_0xe524('0x3a')](_0x3fe124)+':\x20'+_0x52cd0e[_0x3fe124]+'\x0a';}}}}if(_0x8969fb){this['imap']['end']();}else{this[_0xe524('0x26')](_0xe524('0x14'),_0x4a4a16);this['emit'](_0xe524('0x12'));}};module[_0xe524('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index f8a1709..25a0bdb 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0e1=['verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','send','createTransport','compile','sendMail','toString','prototype'];(function(_0xe70fa2,_0x3df449){var _0x44c946=function(_0x5051cd){while(--_0x5051cd){_0xe70fa2['push'](_0xe70fa2['shift']());}};_0x44c946(++_0x3df449);}(_0xd0e1,0xad));var _0x1d0e=function(_0x230c2a,_0x1496b9){_0x230c2a=_0x230c2a-0x0;var _0x375223=_0xd0e1[_0x230c2a];return _0x375223;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x1d0e('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0x1d0e('0x1')]=function(_0x2eae70,_0x3e61ce){return new Promise(function(_0x51c9a0,_0x14add7){var _0x4e32f0=nodemailer[_0x1d0e('0x2')](_0x2eae70);_0x4e32f0['use'](_0x1d0e('0x3'),inlineBase64());_0x4e32f0[_0x1d0e('0x4')](_0x3e61ce,function(_0x46e684,_0x4f9f38){if(_0x46e684){_0x14add7(_0x46e684[_0x1d0e('0x5')]());}else{_0x51c9a0(_0x4f9f38);}});});};EmailSmtp[_0x1d0e('0x6')][_0x1d0e('0x7')]=function(_0x2389dd){return new Promise(function(_0x13bf88,_0x406e33){var _0x2b8341=nodemailer[_0x1d0e('0x2')](_0x2389dd);_0x2b8341[_0x1d0e('0x7')](function(_0x1751c8,_0x23edf4){if(_0x1751c8){_0x406e33(_0x1751c8['toString']());}else{if(_0x23edf4){_0x13bf88(_0x23edf4);}else{_0x406e33(_0x1d0e('0x8'));}}});});};module[_0x1d0e('0x9')]=EmailSmtp; \ No newline at end of file +var _0xbbcb=['sendMail','verify','toString','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x153588,_0x190799){var _0x4af2a4=function(_0x15e8ec){while(--_0x15e8ec){_0x153588['push'](_0x153588['shift']());}};_0x4af2a4(++_0x190799);}(_0xbbcb,0x177));var _0xbbbc=function(_0x50609f,_0x5a23af){_0x50609f=_0x50609f-0x0;var _0x20a2e4=_0xbbcb[_0x50609f];return _0x20a2e4;};'use strict';var nodemailer=require(_0xbbbc('0x0'));var inlineBase64=require(_0xbbbc('0x1'));function EmailSmtp(){}EmailSmtp[_0xbbbc('0x2')][_0xbbbc('0x3')]=function(_0x5d1e0c,_0x5038a3){return new Promise(function(_0x5e709c,_0x1c7ae0){var _0x20b141=nodemailer[_0xbbbc('0x4')](_0x5d1e0c);_0x20b141['use']('compile',inlineBase64());_0x20b141[_0xbbbc('0x5')](_0x5038a3,function(_0x4d6ac3,_0x14eb25){if(_0x4d6ac3){_0x1c7ae0(_0x4d6ac3['toString']());}else{_0x5e709c(_0x14eb25);}});});};EmailSmtp[_0xbbbc('0x2')][_0xbbbc('0x6')]=function(_0x10143a){return new Promise(function(_0x43c68e,_0x14f262){var _0x432269=nodemailer[_0xbbbc('0x4')](_0x10143a);_0x432269[_0xbbbc('0x6')](function(_0x26d16e,_0x16eb49){if(_0x26d16e){_0x14f262(_0x26d16e[_0xbbbc('0x7')]());}else{if(_0x16eb49){_0x43c68e(_0x16eb49);}else{_0x14f262(_0xbbbc('0x8'));}}});});};module[_0xbbbc('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 7cf7eca..bc7314a 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbde=['email','isEmpty','originCc','bcc','type','attachment','attachment-','format','%s-%s','now','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','from','subject','messageId','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','length','slice','split','pop','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x397fa1[_0xecbd('0x10')](0x0,-0x1)['join']('\x20'):_0x15da24[_0xecbd('0xd')];}return'Anonymous';}function getLastName(_0x2647e7){var _0x40f9cf=_[_0xecbd('0x7')](_0x2647e7[_0xecbd('0x8')]);if(_0x40f9cf&&_0x40f9cf['name']){var _0xe3615d=_0x40f9cf[_0xecbd('0xd')][_0xecbd('0x11')](/\s+/);return _0xe3615d[_0xecbd('0xf')]>0x1?_0xe3615d[_0xecbd('0x12')]():'';}return'';}function getMails(_0x1cedc0,_0x5e261b){var _0x177c4e='';for(var _0x458ee3=0x0;_0x458ee3<_0x5e261b[_0xecbd('0x8')][_0xecbd('0xf')];_0x458ee3+=0x1){if(_0x5e261b[_0xecbd('0x8')][_0x458ee3]['address']!==_0x1cedc0){if(!_['isEmpty'](_0x177c4e)){_0x177c4e+=',';}_0x177c4e+=_0x5e261b[_0xecbd('0x8')][_0x458ee3]['name']||_0x5e261b[_0xecbd('0x8')][_0x458ee3][_0xecbd('0x9')]||'';_0x177c4e+='\x20<';_0x177c4e+=_0x5e261b['value'][_0x458ee3][_0xecbd('0x9')]?_0x5e261b[_0xecbd('0x8')][_0x458ee3][_0xecbd('0x9')]:'anonymous'+random['generate'](0x6)+_0xecbd('0xc');_0x177c4e+='>';}}return _0x177c4e;}function parseEmail(_0x2ed086,_0xc061d0,_0x5113d8){if(_0xc061d0[_0xecbd('0x13')]){var _0x448d2b=/)<[^<]*)*<\/script>/gi;while(_0x448d2b[_0xecbd('0x14')](_0xc061d0[_0xecbd('0x13')])){_0xc061d0[_0xecbd('0x13')]=_0xc061d0['html'][_0xecbd('0x15')](_0x448d2b,'');}if(_0xc061d0[_0xecbd('0x13')][_0xecbd('0x16')](_0xecbd('0x17'))){var _0x437f93=[];_0xc061d0[_0xecbd('0x18')][_0xecbd('0x19')](_0xe277b3=>{_0x437f93[_0xecbd('0x1a')](_0xe277b3[_0xecbd('0x1b')]);});var _0x4418b3=/]+>/g;var _0x4a611e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x44aeee=_0xc061d0[_0xecbd('0x13')]['replace'](_0x4a611e,_0xecbd('0x1c'));var _0x37e2c3=_0x44aeee[_0xecbd('0x15')](_0x4418b3,'_IMG');for(let _0x3d5483=0x0;_0x3d5483<_0x437f93[_0xecbd('0xf')];_0x3d5483++){var _0x41eae0=_0x37e2c3[_0xecbd('0x15')](_0xecbd('0x1d'),_0xecbd('0x1e')+_0x437f93[_0x3d5483]+_0xecbd('0x1f'));_0x37e2c3=_0x41eae0;}_0xc061d0[_0xecbd('0x13')]=_0x37e2c3;}_0x5113d8[_0xecbd('0x20')]=_0xc061d0[_0xecbd('0x13')];}else{_0x5113d8['body']=_0xc061d0[_0xecbd('0x21')];}if(_0x5113d8['body']){_0x5113d8[_0xecbd('0x20')]=_0x5113d8[_0xecbd('0x20')][_0xecbd('0x15')](/0x0){var _0x2e3c60=[_0xecbd('0x34'),_0xecbd('0x35'),_0xecbd('0x36')];for(var _0x3378a0=0x0;_0x3378a0<_0xc061d0[_0xecbd('0x33')][_0xecbd('0xf')];_0x3378a0++){var _0xf85b1e=_[_0xecbd('0x37')](_0x2e3c60,_0xc061d0[_0xecbd('0x33')][_0x3378a0][_0xecbd('0x38')]);if(_0xf85b1e>=0x0){_0x5113d8[_0xecbd('0x39')]=!![];}}}return _0x5113d8;}exports['parser']=function(_0x4c1443,_0x1d39f8,_0x67dee3){var _0x22d34e={'from':getAddress(_0x1d39f8[_0xecbd('0x3a')]),'firstName':getFirstName(_0x1d39f8[_0xecbd('0x3a')]),'lastName':getLastName(_0x1d39f8[_0xecbd('0x3a')]),'mapKey':_0xecbd('0x25'),'message':{'from':getMails(_0x4c1443['email'],_0x1d39f8[_0xecbd('0x3a')]),'to':_0x4c1443['email'],'cc':'','subject':_0x1d39f8[_0xecbd('0x3b')]||'','messageId':_0x1d39f8[_0xecbd('0x3c')],'inReplyTo':_0x1d39f8['inReplyTo'],'sentAt':moment(_0x1d39f8['date'])[_0xecbd('0x2c')](_0xecbd('0x3d')),'attach':![],'attachments':[]}};if(!_0x1d39f8[_0xecbd('0x13')]&&!_0x1d39f8[_0xecbd('0x21')]){var _0x2c3f9f=_['filter'](_0x1d39f8[_0xecbd('0x18')],{'contentType':_0xecbd('0x3e')});if(_0x2c3f9f['length']){logger[_0xecbd('0x3f')](util[_0xecbd('0x2c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1d39f8[_0xecbd('0x3c')]));tnef[_0xecbd('0x40')](_[_0xecbd('0x41')](_0x2c3f9f)['content'],function(_0x578980,_0x1aebe9){if(_0x1aebe9){_0x1d39f8[_0xecbd('0x13')]=_0x1aebe9[_0xecbd('0x42')]||_0xecbd('0x43');if(_0x1aebe9[_0xecbd('0x44')]){for(var _0x136f72=0x0;_0x136f72<_0x1aebe9['Attachments']['length'];_0x136f72++){var _0x45d4d5=_0x1aebe9['Attachments'][_0x136f72];_0x22d34e[_0xecbd('0x23')][_0xecbd('0x18')][_0xecbd('0x1a')]({'filename':_0x45d4d5[_0xecbd('0x45')],'content':Buffer[_0xecbd('0x3a')](_0x45d4d5[_0xecbd('0x46')])});}}}_0x67dee3(parseEmail(_0x4c1443,_0x1d39f8,_0x22d34e));});}else{_0x1d39f8[_0xecbd('0x13')]='

Empty\x20message

';_0x67dee3(parseEmail(_0x4c1443,_0x1d39f8,_0x22d34e));}}else{_0x67dee3(parseEmail(_0x4c1443,_0x1d39f8,_0x22d34e));}};exports[_0xecbd('0x47')]=function(_0x128b7b,_0x462c43){var _0x32cc51=[_0xecbd('0x48')+(_0x462c43||''),_0xecbd('0x49')+_0x128b7b,'',''];return Buffer['from'](_0x32cc51['join'](''),_0xecbd('0x4a'))[_0xecbd('0x4b')](_0xecbd('0x4c'));}; \ No newline at end of file +var _0x7a9d=['application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','generate','html','test','includes','push','replace','_IMG','\x20[Attachment:\x20','\x20]','body','message','originTo','originCc','bcc','attachments','attach','attachment','attachment-','format','%s-%s','join','server/files/attachments/','writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter'];(function(_0x2f83ff,_0x26e088){var _0x33af8f=function(_0x3afa08){while(--_0x3afa08){_0x2f83ff['push'](_0x2f83ff['shift']());}};_0x33af8f(++_0x26e088);}(_0x7a9d,0xe9));var _0xd7a9=function(_0x5b201e,_0x191138){_0x5b201e=_0x5b201e-0x0;var _0x2ffc51=_0x7a9d[_0x5b201e];return _0x2ffc51;};'use strict';var _=require(_0xd7a9('0x0'));var moment=require(_0xd7a9('0x1'));var random=require(_0xd7a9('0x2'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0xd7a9('0x3'));var logger=require(_0xd7a9('0x4'))(_0xd7a9('0x5'));var config=require(_0xd7a9('0x6'));function getAddress(_0x4ec0f9){var _0xbe9bbb=_[_0xd7a9('0x7')](_0x4ec0f9[_0xd7a9('0x8')]);return _0xbe9bbb&&_0xbe9bbb[_0xd7a9('0x9')]?_0xbe9bbb[_0xd7a9('0x9')]:_0xd7a9('0xa')+random['generate'](0x6)+_0xd7a9('0xb');}function getFirstName(_0x13f00e){var _0xf167a3=_[_0xd7a9('0x7')](_0x13f00e[_0xd7a9('0x8')]);if(_0xf167a3&&_0xf167a3['name']){if(_0xf167a3[_0xd7a9('0xc')]==_0xf167a3[_0xd7a9('0x9')]){return _0xf167a3['name'][_0xd7a9('0xd')](0x0,_0xf167a3[_0xd7a9('0xc')][_0xd7a9('0xe')]('@'));}var _0x3a7124=_0xf167a3['name'][_0xd7a9('0xf')](/\s+/);return _0x3a7124[_0xd7a9('0x10')]>0x1?_0x3a7124[_0xd7a9('0x11')](0x0,-0x1)['join']('\x20'):_0xf167a3['name'];}return _0xd7a9('0x12');}function getLastName(_0x47bcc0){var _0x368ad9=_['head'](_0x47bcc0['value']);if(_0x368ad9&&_0x368ad9[_0xd7a9('0xc')]){var _0x3b5439=_0x368ad9[_0xd7a9('0xc')][_0xd7a9('0xf')](/\s+/);return _0x3b5439[_0xd7a9('0x10')]>0x1?_0x3b5439[_0xd7a9('0x13')]():'';}return'';}function getMails(_0x103c94,_0x5f0734){var _0xb91455='';for(var _0x34d8f5=0x0;_0x34d8f5<_0x5f0734[_0xd7a9('0x8')][_0xd7a9('0x10')];_0x34d8f5+=0x1){if(_0x5f0734[_0xd7a9('0x8')][_0x34d8f5][_0xd7a9('0x9')]!==_0x103c94){if(!_[_0xd7a9('0x14')](_0xb91455)){_0xb91455+=',';}_0xb91455+=_0x5f0734[_0xd7a9('0x8')][_0x34d8f5][_0xd7a9('0xc')]||_0x5f0734[_0xd7a9('0x8')][_0x34d8f5][_0xd7a9('0x9')]||'';_0xb91455+='\x20<';_0xb91455+=_0x5f0734[_0xd7a9('0x8')][_0x34d8f5][_0xd7a9('0x9')]?_0x5f0734[_0xd7a9('0x8')][_0x34d8f5]['address']:'anonymous'+random[_0xd7a9('0x15')](0x6)+_0xd7a9('0xb');_0xb91455+='>';}}return _0xb91455;}function parseEmail(_0x432065,_0x46fc85,_0x3cb3db){if(_0x46fc85[_0xd7a9('0x16')]){var _0x35afc9=/)<[^<]*)*<\/script>/gi;while(_0x35afc9[_0xd7a9('0x17')](_0x46fc85[_0xd7a9('0x16')])){_0x46fc85['html']=_0x46fc85['html']['replace'](_0x35afc9,'');}if(_0x46fc85[_0xd7a9('0x16')][_0xd7a9('0x18')]('{_0x59da76[_0xd7a9('0x19')](_0x1e104b['filename']);});var _0x233821=/]+>/g;var _0x4842bd=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x34de80=_0x46fc85[_0xd7a9('0x16')][_0xd7a9('0x1a')](_0x4842bd,'_SRC');var _0x27eb47=_0x34de80[_0xd7a9('0x1a')](_0x233821,_0xd7a9('0x1b'));for(let _0xfbd91b=0x0;_0xfbd91b<_0x59da76['length'];_0xfbd91b++){var _0x151cbc=_0x27eb47[_0xd7a9('0x1a')](_0xd7a9('0x1b'),_0xd7a9('0x1c')+_0x59da76[_0xfbd91b]+_0xd7a9('0x1d'));_0x27eb47=_0x151cbc;}_0x46fc85['html']=_0x27eb47;}_0x3cb3db[_0xd7a9('0x1e')]=_0x46fc85[_0xd7a9('0x16')];}else{_0x3cb3db[_0xd7a9('0x1e')]=_0x46fc85['textAsHtml'];}if(_0x3cb3db['body']){_0x3cb3db['body']=_0x3cb3db[_0xd7a9('0x1e')][_0xd7a9('0x1a')](/0x0){var _0x1f0dd7=[_0xd7a9('0x2e'),_0xd7a9('0x2f'),_0xd7a9('0x30')];for(var _0x198ef7=0x0;_0x198ef7<_0x46fc85['headerLines']['length'];_0x198ef7++){var _0x5af330=_['indexOf'](_0x1f0dd7,_0x46fc85[_0xd7a9('0x2d')][_0x198ef7][_0xd7a9('0x31')]);if(_0x5af330>=0x0){_0x3cb3db[_0xd7a9('0x32')]=!![];}}}return _0x3cb3db;}exports[_0xd7a9('0x33')]=function(_0x26d216,_0x3dbeae,_0xc39cf2){var _0x19024b={'from':getAddress(_0x3dbeae[_0xd7a9('0x34')]),'firstName':getFirstName(_0x3dbeae[_0xd7a9('0x34')]),'lastName':getLastName(_0x3dbeae[_0xd7a9('0x34')]),'mapKey':'email','message':{'from':getMails(_0x26d216[_0xd7a9('0x5')],_0x3dbeae[_0xd7a9('0x34')]),'to':_0x26d216['email'],'cc':'','subject':_0x3dbeae[_0xd7a9('0x35')]||'','messageId':_0x3dbeae[_0xd7a9('0x36')],'inReplyTo':_0x3dbeae['inReplyTo'],'sentAt':moment(_0x3dbeae[_0xd7a9('0x37')])[_0xd7a9('0x27')](_0xd7a9('0x38')),'attach':![],'attachments':[]}};if(!_0x3dbeae['html']&&!_0x3dbeae[_0xd7a9('0x39')]){var _0x230987=_[_0xd7a9('0x3a')](_0x3dbeae[_0xd7a9('0x23')],{'contentType':_0xd7a9('0x3b')});if(_0x230987[_0xd7a9('0x10')]){logger[_0xd7a9('0x3c')](util[_0xd7a9('0x27')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x3dbeae['messageId']));tnef[_0xd7a9('0x3d')](_[_0xd7a9('0x3e')](_0x230987)['content'],function(_0x43fba3,_0x29425d){if(_0x29425d){_0x3dbeae[_0xd7a9('0x16')]=_0x29425d[_0xd7a9('0x3f')]||_0xd7a9('0x40');if(_0x29425d[_0xd7a9('0x41')]){for(var _0x253927=0x0;_0x253927<_0x29425d[_0xd7a9('0x41')][_0xd7a9('0x10')];_0x253927++){var _0x5da74d=_0x29425d[_0xd7a9('0x41')][_0x253927];_0x19024b['message'][_0xd7a9('0x23')][_0xd7a9('0x19')]({'filename':_0x5da74d[_0xd7a9('0x42')],'content':Buffer['from'](_0x5da74d[_0xd7a9('0x43')])});}}}_0xc39cf2(parseEmail(_0x26d216,_0x3dbeae,_0x19024b));});}else{_0x3dbeae[_0xd7a9('0x16')]=_0xd7a9('0x40');_0xc39cf2(parseEmail(_0x26d216,_0x3dbeae,_0x19024b));}}else{_0xc39cf2(parseEmail(_0x26d216,_0x3dbeae,_0x19024b));}};exports[_0xd7a9('0x44')]=function(_0x33b3ae,_0x296b31){var _0x95dcc=[_0xd7a9('0x45')+(_0x296b31||''),_0xd7a9('0x46')+_0x33b3ae,'',''];return Buffer[_0xd7a9('0x34')](_0x95dcc['join'](''),_0xd7a9('0x47'))['toString'](_0xd7a9('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 4e7a4ea..05d3e02 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e9c=['SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x1a33a2,_0x1082f7){var _0x33127e=function(_0x166bea){while(--_0x166bea){_0x1a33a2['push'](_0x1a33a2['shift']());}};_0x33127e(++_0x1082f7);}(_0x8e9c,0xbd));var _0xc8e9=function(_0x3a1418,_0x5cd648){_0x3a1418=_0x3a1418-0x0;var _0x143998=_0x8e9c[_0x3a1418];return _0x143998;};'use strict';var _=require(_0xc8e9('0x0'));function MailAccount(_0x186c1c){this['id']=_0x186c1c['id']||0x0;this[_0xc8e9('0x1')]=_0x186c1c[_0xc8e9('0x1')]||_0xc8e9('0x2');this['key']=_0x186c1c['key']||_0xc8e9('0x3');this[_0xc8e9('0x4')]=_0x186c1c[_0xc8e9('0x4')]||![];this['Imap']=_0x186c1c[_0xc8e9('0x5')]||[];this[_0xc8e9('0x6')]=_0x186c1c[_0xc8e9('0x6')]||[];}module[_0xc8e9('0x7')]=MailAccount; \ No newline at end of file +var _0x388a=['lodash','name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x40d8d1,_0x47df01){var _0x582e70=function(_0x5b1457){while(--_0x5b1457){_0x40d8d1['push'](_0x40d8d1['shift']());}};_0x582e70(++_0x47df01);}(_0x388a,0xbd));var _0xa388=function(_0x32774f,_0x343dc9){_0x32774f=_0x32774f-0x0;var _0x47fdcc=_0x388a[_0x32774f];return _0x47fdcc;};'use strict';var _=require(_0xa388('0x0'));function MailAccount(_0x99e133){this['id']=_0x99e133['id']||0x0;this[_0xa388('0x1')]=_0x99e133['name']||_0xa388('0x2');this[_0xa388('0x3')]=_0x99e133[_0xa388('0x3')]||_0xa388('0x4');this[_0xa388('0x5')]=_0x99e133[_0xa388('0x5')]||![];this[_0xa388('0x6')]=_0x99e133['Imap']||[];this[_0xa388('0x7')]=_0x99e133[_0xa388('0x7')]||[];}module[_0xa388('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index e28be65..3144d22 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3f6=['merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','isUndefined'];(function(_0x50db88,_0x15102a){var _0x391841=function(_0x4987f4){while(--_0x4987f4){_0x50db88['push'](_0x50db88['shift']());}};_0x391841(++_0x15102a);}(_0xb3f6,0x12e));var _0x6b3f=function(_0x37421b,_0x1b67e4){_0x37421b=_0x37421b-0x0;var _0x2a6472=_0xb3f6[_0x37421b];return _0x2a6472;};'use strict';var _=require(_0x6b3f('0x0'));var MailAccount=require(_0x6b3f('0x1'));var Realtime=function(){this[_0x6b3f('0x2')]={};};function freeIsNotKey(_0x4cecb5,_0x576740,_0x33dad5){var _0xb48b2c=_[_0x6b3f('0x3')](_0x4cecb5,function(_0x571ef3,_0x5b9439){return _0x571ef3[_0x33dad5];});for(var _0x583c9b in _0x576740){if(_0x576740[_0x6b3f('0x4')](_0x583c9b)){if(!_0xb48b2c[_0x583c9b]){delete _0x576740[_0x583c9b];}}}}Realtime['prototype'][_0x6b3f('0x5')]=function(_0x535162,_0x432ec9){for(var _0x3db044 in _0x432ec9){if(_0x535162[_0x6b3f('0x4')](_0x3db044)){_0x535162[_0x3db044]=_0x432ec9[_0x3db044];}}};Realtime[_0x6b3f('0x6')][_0x6b3f('0x7')]=function(){var _0x241580=this;return function(_0x207eea){if(_0x207eea){freeIsNotKey(_0x207eea,_0x241580[_0x6b3f('0x2')],'id');for(var _0x38374b=0x0,_0x3441c2={},_0x51e0d6={};_0x38374b<_0x207eea[_0x6b3f('0x8')];_0x38374b+=0x1){_0x3441c2=_0x207eea[_0x38374b];if(_[_0x6b3f('0x9')](_0x241580[_0x6b3f('0x2')][_0x3441c2['id']])){_0x241580[_0x6b3f('0x2')][_0x3441c2['id']]=new MailAccount(_0x3441c2);}else{_[_0x6b3f('0xa')](_0x241580[_0x6b3f('0x2')][_0x3441c2['id']],_0x3441c2);}}}return _0x241580[_0x6b3f('0x2')];};};module[_0x6b3f('0xb')]=Realtime; \ No newline at end of file +var _0x13d5=['exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','merge'];(function(_0xba9ee6,_0x3f1034){var _0x24c4e8=function(_0x535828){while(--_0x535828){_0xba9ee6['push'](_0xba9ee6['shift']());}};_0x24c4e8(++_0x3f1034);}(_0x13d5,0x14b));var _0x513d=function(_0x500caf,_0x45fed3){_0x500caf=_0x500caf-0x0;var _0x54448c=_0x13d5[_0x500caf];return _0x54448c;};'use strict';var _=require(_0x513d('0x0'));var MailAccount=require(_0x513d('0x1'));var Realtime=function(){this[_0x513d('0x2')]={};};function freeIsNotKey(_0x321d68,_0x39f87e,_0x33825d){var _0x10ac72=_['mapKeys'](_0x321d68,function(_0xdf5d5b,_0x5945f8){return _0xdf5d5b[_0x33825d];});for(var _0x1a5b05 in _0x39f87e){if(_0x39f87e[_0x513d('0x3')](_0x1a5b05)){if(!_0x10ac72[_0x1a5b05]){delete _0x39f87e[_0x1a5b05];}}}}Realtime['prototype'][_0x513d('0x4')]=function(_0x5ad442,_0x3f3cbd){for(var _0x513649 in _0x3f3cbd){if(_0x5ad442['hasOwnProperty'](_0x513649)){_0x5ad442[_0x513649]=_0x3f3cbd[_0x513649];}}};Realtime[_0x513d('0x5')][_0x513d('0x6')]=function(){var _0x3eece9=this;return function(_0x17aaee){if(_0x17aaee){freeIsNotKey(_0x17aaee,_0x3eece9[_0x513d('0x2')],'id');for(var _0x12d65a=0x0,_0x599a27={},_0x31d106={};_0x12d65a<_0x17aaee[_0x513d('0x7')];_0x12d65a+=0x1){_0x599a27=_0x17aaee[_0x12d65a];if(_['isUndefined'](_0x3eece9[_0x513d('0x2')][_0x599a27['id']])){_0x3eece9[_0x513d('0x2')][_0x599a27['id']]=new MailAccount(_0x599a27);}else{_[_0x513d('0x8')](_0x3eece9['mailAccounts'][_0x599a27['id']],_0x599a27);}}}return _0x3eece9[_0x513d('0x2')];};};module[_0x513d('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 4821293..4a7dd74 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62f1=['data5','MailServerOut','Smtp','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId','Imap','CloudProvider','type'];(function(_0x186e2,_0x50fe14){var _0x5fa69d=function(_0x5e1ef4){while(--_0x5e1ef4){_0x186e2['push'](_0x186e2['shift']());}};_0x5fa69d(++_0x50fe14);}(_0x62f1,0x112));var _0x162f=function(_0x9b243f,_0x3f5ece){_0x9b243f=_0x9b243f-0x0;var _0x2a3d3b=_0x62f1[_0x9b243f];return _0x2a3d3b;};'use strict';var client=require(_0x162f('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x162f('0x1')](_0x162f('0x2'),{'options':{'attributes':['id',_0x162f('0x3'),_0x162f('0x4'),_0x162f('0x5'),_0x162f('0x6'),_0x162f('0x7'),_0x162f('0x8'),_0x162f('0x9'),_0x162f('0xa')],'raw':![],'include':[{'model':'MailServerIn','as':_0x162f('0xb'),'include':[{'model':_0x162f('0xc'),'attributes':['id','name',_0x162f('0x5'),_0x162f('0xd'),_0x162f('0xe')],'as':'CloudProvider'}]},{'model':_0x162f('0xf'),'as':_0x162f('0x10'),'include':[{'model':_0x162f('0xc'),'attributes':['id',_0x162f('0x3'),'service',_0x162f('0xd'),_0x162f('0xe')],'as':_0x162f('0xc')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x489525,_0x248b66){return client['Request'](_0x162f('0x11'),{'account':{'id':_0x489525},'body':_0x248b66,'log':_0x162f('0x11')});}; \ No newline at end of file +var _0x6d38=['getMailAccounts','Request','GetMailAccount','service','active','key','ListId','MailServerIn','Imap','CloudProvider','name','data5','MailServerOut','getMailAccount','NotifyMailAccount'];(function(_0x53c901,_0x2b3bba){var _0x236693=function(_0x1d42b0){while(--_0x1d42b0){_0x53c901['push'](_0x53c901['shift']());}};_0x236693(++_0x2b3bba);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require('../client');exports[_0x86d3('0x0')]=function(){return function(){return client[_0x86d3('0x1')](_0x86d3('0x2'),{'options':{'attributes':['id','name','provider',_0x86d3('0x3'),'email',_0x86d3('0x4'),_0x86d3('0x5'),_0x86d3('0x6'),'TemplateId'],'raw':![],'include':[{'model':_0x86d3('0x7'),'as':_0x86d3('0x8'),'include':[{'model':_0x86d3('0x9'),'attributes':['id',_0x86d3('0xa'),'service','type',_0x86d3('0xb')],'as':_0x86d3('0x9')}]},{'model':_0x86d3('0xc'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x86d3('0xa'),_0x86d3('0x3'),'type','data5'],'as':_0x86d3('0x9')}]}]},'log':_0x86d3('0xd')});};};exports['notify']=function(_0x9fd6e8,_0x5e9606){return client[_0x86d3('0x1')](_0x86d3('0xe'),{'account':{'id':_0x9fd6e8},'body':_0x5e9606,'log':_0x86d3('0xe')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 0049206..b11ee57 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1411=['../client','loginMailFrequency','GetSettings'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0x1411,0x93));var _0x1141=function(_0x5b1389,_0x3f0664){_0x5b1389=_0x5b1389-0x0;var _0x559a88=_0x1411[_0x5b1389];return _0x559a88;};'use strict';var client=require(_0x1141('0x0'));exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1141('0x1')]},'log':_0x1141('0x2')});}; \ No newline at end of file +var _0x4201=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x4201,0x153));var _0x1420=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0x4201[_0x1c8cc6];return _0x522936;};'use strict';var client=require(_0x1420('0x0'));exports[_0x1420('0x1')]=function(){return client[_0x1420('0x2')](_0x1420('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1420('0x4')]},'log':_0x1420('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 66421b2..f6c1631 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 5593574..a37506e 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64fe=['polling','redis','defaults','localhost','socket.io-redis','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','ioredis','../../config/environment','createServer','listen','port','socket.io','websocket'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x64fe,0xad));var _0xe64f=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x64fe[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var http=require('http');var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xe64f('0x0'));var config=require(_0xe64f('0x1'));var app=express();var server=http[_0xe64f('0x2')](app);server['timeout']=0xdbba0;if(sticky[_0xe64f('0x3')](server,config[_0xe64f('0x4')])){var socketio=require(_0xe64f('0x5'))(server,{'transports':[_0xe64f('0x6'),_0xe64f('0x7')]});config[_0xe64f('0x8')]=_[_0xe64f('0x9')](config['redis'],{'host':_0xe64f('0xa'),'port':0x18eb});socketio['adapter'](require(_0xe64f('0xb'))({'pubClient':new Redis(config[_0xe64f('0x8')]),'subClient':new Redis(config[_0xe64f('0x8')])}));require('../../config/triggers')[_0xe64f('0xc')]();require(_0xe64f('0xd'))['default'](socketio);require(_0xe64f('0xe'))['default'](app);require('../../routes')[_0xe64f('0xc')](app);}else{server[_0xe64f('0xf')](_0xe64f('0x10'),function(){console[_0xe64f('0x11')](_0xe64f('0x12'),config['port']);});}exports=module[_0xe64f('0x13')]=app; \ No newline at end of file +var _0xc178=['ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers','default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session'];(function(_0x42457a,_0xb24256){var _0x409ae1=function(_0x34083f){while(--_0x34083f){_0x42457a['push'](_0x42457a['shift']());}};_0x409ae1(++_0xb24256);}(_0xc178,0x1dc));var _0x8c17=function(_0x565719,_0x4d27a6){_0x565719=_0x565719-0x0;var _0x37bc1b=_0xc178[_0x565719];return _0x37bc1b;};'use strict';var _=require(_0x8c17('0x0'));var http=require(_0x8c17('0x1'));var express=require(_0x8c17('0x2'));var sticky=require(_0x8c17('0x3'));var Redis=require(_0x8c17('0x4'));var config=require(_0x8c17('0x5'));var app=express();var server=http[_0x8c17('0x6')](app);server[_0x8c17('0x7')]=0xdbba0;if(sticky[_0x8c17('0x8')](server,config[_0x8c17('0x9')])){var socketio=require(_0x8c17('0xa'))(server,{'transports':['websocket',_0x8c17('0xb')]});config[_0x8c17('0xc')]=_[_0x8c17('0xd')](config[_0x8c17('0xc')],{'host':_0x8c17('0xe'),'port':0x18eb});socketio['adapter'](require(_0x8c17('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x8c17('0xc')])}));require(_0x8c17('0x10'))['default']();require('../../config/socketio')['default'](socketio);require('../../config/express')[_0x8c17('0x11')](app);require(_0x8c17('0x12'))[_0x8c17('0x11')](app);}else{server[_0x8c17('0x13')](_0x8c17('0x14'),function(){console[_0x8c17('0x15')](_0x8c17('0x16'),config[_0x8c17('0x9')]);});}exports=module[_0x8c17('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 7dffc93..d1111ce 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf94e=['routing','client','request','then','rpc','error','message','result','catch','exports','bluebird','../../config/logger'];(function(_0x57e86e,_0x34dd52){var _0x4cfa2c=function(_0x391cf4){while(--_0x391cf4){_0x57e86e['push'](_0x57e86e['shift']());}};_0x4cfa2c(++_0x34dd52);}(_0xf94e,0x1c6));var _0xef94=function(_0x11987e,_0x35050e){_0x11987e=_0x11987e-0x0;var _0x3e82eb=_0xf94e[_0x11987e];return _0x3e82eb;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xef94('0x0'));var logger=require(_0xef94('0x1'))(_0xef94('0x2'));var client=jayson[_0xef94('0x3')]['http']({'port':0x2329});client['Request']=function(_0x1d7ec3,_0x136fe3){return new BPromise(function(_0xf850f9,_0xffa51c){return client[_0xef94('0x4')](_0x1d7ec3,_0x136fe3)[_0xef94('0x5')](function(_0xa0d700){logger['debug'](_0xef94('0x6'),_0xef94('0x2'),_0x1d7ec3,_0x136fe3,_0xa0d700);if(_0xa0d700['error']){logger[_0xef94('0x7')](_0xef94('0x6'),_0xef94('0x2'),_0x1d7ec3,_0xa0d700[_0xef94('0x7')][_0xef94('0x8')],_0x136fe3);return _0xffa51c(_0xa0d700[_0xef94('0x7')][_0xef94('0x8')]);}else{return _0xf850f9(_0xa0d700[_0xef94('0x9')]);}})[_0xef94('0xa')](function(_0x301641){logger[_0xef94('0x7')](_0xef94('0x6'),_0xef94('0x2'),_0x1d7ec3,_0x301641,_0x136fe3);return _0xffa51c(_0x301641);});});};module[_0xef94('0xb')]=client; \ No newline at end of file +var _0x7581=['catch','exports','jayson/promise','bluebird','routing','http','Request','request','then','debug','error','rpc','message','result'];(function(_0x55a5b7,_0x1a63b0){var _0x3f50c1=function(_0x3a114e){while(--_0x3a114e){_0x55a5b7['push'](_0x55a5b7['shift']());}};_0x3f50c1(++_0x1a63b0);}(_0x7581,0x136));var _0x1758=function(_0x24a3a0,_0x4bdfa0){_0x24a3a0=_0x24a3a0-0x0;var _0x14c7c2=_0x7581[_0x24a3a0];return _0x14c7c2;};'use strict';var jayson=require(_0x1758('0x0'));var BPromise=require(_0x1758('0x1'));var logger=require('../../config/logger')(_0x1758('0x2'));var client=jayson['client'][_0x1758('0x3')]({'port':0x2329});client[_0x1758('0x4')]=function(_0x32ff92,_0x4c5c3a){return new BPromise(function(_0x2fa3c0,_0x33fdf2){return client[_0x1758('0x5')](_0x32ff92,_0x4c5c3a)[_0x1758('0x6')](function(_0x377042){logger[_0x1758('0x7')]('rpc',_0x1758('0x2'),_0x32ff92,_0x4c5c3a,_0x377042);if(_0x377042[_0x1758('0x8')]){logger[_0x1758('0x8')](_0x1758('0x9'),_0x1758('0x2'),_0x32ff92,_0x377042[_0x1758('0x8')][_0x1758('0xa')],_0x4c5c3a);return _0x33fdf2(_0x377042[_0x1758('0x8')][_0x1758('0xa')]);}else{return _0x2fa3c0(_0x377042[_0x1758('0xb')]);}})[_0x1758('0xc')](function(_0x38aae5){logger[_0x1758('0x8')](_0x1758('0x9'),_0x1758('0x2'),_0x32ff92,_0x38aae5,_0x4c5c3a);return _0x33fdf2(_0x38aae5);});});};module[_0x1758('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 4c1ee8f..e575f84 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ea0=['./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x7ea0,0xc7));var _0x07ea=function(_0x626473,_0x45b72b){_0x626473=_0x626473-0x0;var _0x3851e8=_0x7ea0[_0x626473];return _0x3851e8;};'use strict';var BPromise=require(_0x07ea('0x0'));var server=require(_0x07ea('0x1'));var Realtime=require('./realtime');var user=require(_0x07ea('0x2'));var interval=require(_0x07ea('0x3'));var openchannelQueue=require(_0x07ea('0x4'));var chatQueue=require(_0x07ea('0x5'));var smsQueue=require(_0x07ea('0x6'));var mailQueue=require(_0x07ea('0x7'));var faxQueue=require(_0x07ea('0x8'));var whatsappQueue=require(_0x07ea('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x07ea('0xa')]()[_0x07ea('0xb')](user['getAgents']())['then'](realtime[_0x07ea('0xc')]())[_0x07ea('0xb')](interval[_0x07ea('0xd')]())['then'](realtime[_0x07ea('0xe')]())[_0x07ea('0xb')](openchannelQueue[_0x07ea('0xf')]())[_0x07ea('0xb')](realtime['initOpenchannelQueues']())[_0x07ea('0xb')](chatQueue[_0x07ea('0x10')]())[_0x07ea('0xb')](realtime[_0x07ea('0x11')]())[_0x07ea('0xb')](smsQueue[_0x07ea('0x12')]())[_0x07ea('0xb')](realtime[_0x07ea('0x13')]())[_0x07ea('0xb')](mailQueue[_0x07ea('0x14')]())[_0x07ea('0xb')](realtime[_0x07ea('0x15')]())[_0x07ea('0xb')](faxQueue[_0x07ea('0x16')]())[_0x07ea('0xb')](realtime[_0x07ea('0x17')]())[_0x07ea('0xb')](whatsappQueue[_0x07ea('0x18')]())[_0x07ea('0xb')](realtime[_0x07ea('0x19')]())[_0x07ea('0xb')](function(){return realtime;});}function main(){return server[_0x07ea('0x1a')](realtime)[_0x07ea('0xb')](function(_0x261912){return initRealtime();})[_0x07ea('0xb')](function(_0x608a43){return setInterval(initRealtime,0x1388);})[_0x07ea('0x1b')](function(_0x374388){console[_0x07ea('0x1c')](_0x374388);});}main(); \ No newline at end of file +var _0x2531=['then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getSmsQueues','getMailQueues','initMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','getAgents'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x2531,0x14f));var _0x1253=function(_0x4aa73d,_0x30d6a5){_0x4aa73d=_0x4aa73d-0x0;var _0xfb66c2=_0x2531[_0x4aa73d];return _0xfb66c2;};'use strict';var BPromise=require(_0x1253('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0x1253('0x1'));var interval=require(_0x1253('0x2'));var openchannelQueue=require(_0x1253('0x3'));var chatQueue=require(_0x1253('0x4'));var smsQueue=require(_0x1253('0x5'));var mailQueue=require(_0x1253('0x6'));var faxQueue=require(_0x1253('0x7'));var whatsappQueue=require(_0x1253('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0x1253('0x9')]())[_0x1253('0xa')](realtime['initAgents']())[_0x1253('0xa')](interval[_0x1253('0xb')]())[_0x1253('0xa')](realtime[_0x1253('0xc')]())[_0x1253('0xa')](openchannelQueue[_0x1253('0xd')]())['then'](realtime[_0x1253('0xe')]())[_0x1253('0xa')](chatQueue['getChatQueues']())[_0x1253('0xa')](realtime['initChatQueues']())[_0x1253('0xa')](smsQueue[_0x1253('0xf')]())[_0x1253('0xa')](realtime['initSmsQueues']())['then'](mailQueue[_0x1253('0x10')]())[_0x1253('0xa')](realtime[_0x1253('0x11')]())['then'](faxQueue['getFaxQueues']())[_0x1253('0xa')](realtime['initFaxQueues']())[_0x1253('0xa')](whatsappQueue[_0x1253('0x12')]())['then'](realtime[_0x1253('0x13')]())[_0x1253('0xa')](function(){return realtime;});}function main(){return server[_0x1253('0x14')](realtime)[_0x1253('0xa')](function(_0x155559){return initRealtime();})[_0x1253('0xa')](function(_0x33ee7d){return setInterval(initRealtime,0x1388);})[_0x1253('0x15')](function(_0xf3211e){console[_0x1253('0x16')](_0xf3211e);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 5b9ceec..debf884 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x376579,_0x4a6a93){var _0x522be4=function(_0x46131a){while(--_0x46131a){_0x376579['push'](_0x376579['shift']());}};_0x522be4(++_0x4a6a93);}(_0x326f,0xd1));var _0xf326=function(_0x364efa,_0x200d4f){_0x364efa=_0x364efa-0x0;var _0x2440fc=_0x326f[_0x364efa];return _0x2440fc;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x164400,_0xce648f){var _0x5306ea=function(_0x44c512){while(--_0x44c512){_0x164400['push'](_0x164400['shift']());}};_0x5306ea(++_0xce648f);}(_0x2ef3,0xba));var _0x32ef=function(_0x551be4,_0x1a921b){_0x551be4=_0x551be4-0x0;var _0x173190=_0x2ef3[_0x551be4];return _0x173190;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 19e7819..1b6608e 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4d0=['sendMailMessage','SendMail','bluebird','client','request','then','error','result','catch'];(function(_0x414f5e,_0x5a083e){var _0x52f196=function(_0x389cad){while(--_0x389cad){_0x414f5e['push'](_0x414f5e['shift']());}};_0x52f196(++_0x5a083e);}(_0xe4d0,0x122));var _0x0e4d=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xe4d0[_0x8a969d];return _0x1d8dc7;};'use strict';var BPromise=require(_0x0e4d('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x0e4d('0x1')]['http']({'port':0x232b});function request(_0x13afd3,_0x2caab3){return new BPromise(function(_0x6ad0c7,_0x184e20){return client[_0x0e4d('0x2')](_0x13afd3,_0x2caab3)[_0x0e4d('0x3')](function(_0x5df8e0){if(_0x5df8e0[_0x0e4d('0x4')]){return _0x184e20(_0x5df8e0[_0x0e4d('0x4')]['message']);}else{return _0x6ad0c7(_0x5df8e0[_0x0e4d('0x5')]);}})[_0x0e4d('0x6')](function(_0x10a443){return _0x184e20(_0x10a443);});});}exports[_0x0e4d('0x7')]=function(_0x4c2f03,_0x2304d5){return request(_0x0e4d('0x8'),{'account':_0x4c2f03,'message':_0x2304d5});}; \ No newline at end of file +var _0x261c=['catch','SendMail','bluebird','client','http','request','then','error','message'];(function(_0x1147d5,_0x4b4c17){var _0x380e4d=function(_0x2d6333){while(--_0x2d6333){_0x1147d5['push'](_0x1147d5['shift']());}};_0x380e4d(++_0x4b4c17);}(_0x261c,0x89));var _0xc261=function(_0x5426d0,_0x4a4f10){_0x5426d0=_0x5426d0-0x0;var _0x37be89=_0x261c[_0x5426d0];return _0x37be89;};'use strict';var BPromise=require(_0xc261('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xc261('0x1')][_0xc261('0x2')]({'port':0x232b});function request(_0xfb29d7,_0x590d54){return new BPromise(function(_0x2d550a,_0x1b93e4){return client[_0xc261('0x3')](_0xfb29d7,_0x590d54)[_0xc261('0x4')](function(_0x4d7b28){if(_0x4d7b28[_0xc261('0x5')]){return _0x1b93e4(_0x4d7b28[_0xc261('0x5')][_0xc261('0x6')]);}else{return _0x2d550a(_0x4d7b28['result']);}})[_0xc261('0x7')](function(_0x470c33){return _0x1b93e4(_0x470c33);});});}exports['sendMailMessage']=function(_0x384bfc,_0x55af8d){return request(_0xc261('0x8'),{'account':_0x384bfc,'message':_0x55af8d});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index c7003d4..3658518 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1131=['redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','mail','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','smsPause','mailCapacity','mailCurrentCapacity','faxCurrentCapacity','openchannelStatus','openchannelStatusTime','busyQueue','md5','emit','user:save','exports','moment'];(function(_0x310a54,_0x212d9a){var _0x4e4caa=function(_0x6baec9){while(--_0x6baec9){_0x310a54['push'](_0x310a54['shift']());}};_0x4e4caa(++_0x212d9a);}(_0x1131,0x71));var _0x1113=function(_0x22003f,_0x5d858c){_0x22003f=_0x22003f-0x0;var _0x5a8c5f=_0x1131[_0x22003f];return _0x5a8c5f;};'use strict';var _=require('lodash');var moment=require(_0x1113('0x0'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x1113('0x1')]=_[_0x1113('0x2')](config[_0x1113('0x1')],{'host':_0x1113('0x3'),'port':0x18eb});var io=require(_0x1113('0x4'))(new Redis(config[_0x1113('0x1')]));function Agent(_0x57dd30){this['id']=_0x57dd30['id']||0x0;this[_0x1113('0x5')]=_0x57dd30['name']||'';this[_0x1113('0x6')]=_0x57dd30['online']||!![];this['voicePause']=_0x57dd30[_0x1113('0x7')]||![];this[_0x1113('0x8')]=_0x57dd30[_0x1113('0x8')]||![];this[_0x1113('0x9')]=_0x57dd30[_0x1113('0x9')]||![];this[_0x1113('0xa')]=_0x57dd30[_0x1113('0xa')]||![];this['smsPause']=_0x57dd30['smsPause']||![];this[_0x1113('0xb')]=_0x57dd30[_0x1113('0xb')]||![];this[_0x1113('0xc')]='unknown';this[_0x1113('0xd')]=0x0;this[_0x1113('0xe')]=_0x57dd30['chatCapacity']||0x0;this[_0x1113('0xf')]=0x0;this[_0x1113('0x10')]=_0x1113('0x11');this[_0x1113('0x12')]=0x0;this['mailCapacity']=_0x57dd30['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x1113('0x11');this[_0x1113('0x13')]=0x0;this[_0x1113('0x14')]=_0x57dd30[_0x1113('0x14')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x1113('0x15')]=_0x1113('0x11');this[_0x1113('0x16')]=0x0;this[_0x1113('0x17')]=_0x57dd30[_0x1113('0x17')]||0x0;this[_0x1113('0x18')]=0x0;this[_0x1113('0x19')]=_0x1113('0x11');this[_0x1113('0x1a')]=0x0;this[_0x1113('0x1b')]=_0x57dd30['whatsappCapacity']||0x0;this[_0x1113('0x1c')]=0x0;this['openchannelStatus']=_0x1113('0x11');this['openchannelStatusTime']=0x0;this[_0x1113('0x1d')]=_0x57dd30[_0x1113('0x1d')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this['busyQueue']=undefined;this['md5']='';this[_0x1113('0x1e')]();}Agent[_0x1113('0x1f')][_0x1113('0x20')]=function(_0x1e3316){if(this[_0x1e3316+_0x1113('0x21')]>0x0){if(this[_0x1e3316+_0x1113('0x22')]>0x0&&this[_0x1e3316+_0x1113('0x21')]>=this[_0x1e3316+_0x1113('0x22')]){return _0x1113('0x23');}else{return'working';}}else{return _0x1113('0x24');}};Agent[_0x1113('0x1f')][_0x1113('0x1e')]=function(){var _0x4bae79=[_0x1113('0x25'),'chat',_0x1113('0x26'),_0x1113('0x27'),_0x1113('0x28'),_0x1113('0x29')];for(var _0x4a3c5a=0x0;_0x4a3c5a<_0x4bae79[_0x1113('0x2a')];_0x4a3c5a+=0x1){var _0x270cdc=this[_0x1113('0x20')](_0x4bae79[_0x4a3c5a]);if(this[_0x4bae79[_0x4a3c5a]+_0x1113('0x2b')]!==_0x270cdc){this[_0x4bae79[_0x4a3c5a]+'StatusTime']=_[_0x1113('0x2c')](moment()[_0x1113('0x2d')]('x'));}this[_0x4bae79[_0x4a3c5a]+_0x1113('0x2b')]=_0x270cdc;}var _0x4f88f3={'id':this['id'],'name':this[_0x1113('0x5')],'online':this[_0x1113('0x6')],'voicePause':this[_0x1113('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0x1113('0x9')],'smsPause':this[_0x1113('0x2e')],'faxPause':this[_0x1113('0xa')],'openchannelPause':this[_0x1113('0xb')],'chatStatus':this[_0x1113('0xc')],'chatStatusTime':this[_0x1113('0xd')],'chatCapacity':this[_0x1113('0xe')],'chatCurrentCapacity':this[_0x1113('0xf')],'mailStatus':this[_0x1113('0x10')],'mailStatusTime':this[_0x1113('0x12')],'mailCapacity':this[_0x1113('0x2f')],'mailCurrentCapacity':this[_0x1113('0x30')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x1113('0x14')],'faxCurrentCapacity':this[_0x1113('0x31')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x1113('0x16')],'smsCapacity':this[_0x1113('0x17')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x1113('0x19')],'whatsappStatusTime':this[_0x1113('0x1a')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x1113('0x1c')],'openchannelStatus':this[_0x1113('0x32')],'openchannelStatusTime':this[_0x1113('0x33')],'openchannelCapacity':this[_0x1113('0x1d')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x1113('0x34')]};var _0x2b12db=md5(JSON['stringify'](_0x4f88f3));if(this[_0x1113('0x35')]!==_0x2b12db){this['md5']=_0x2b12db;io[_0x1113('0x36')](_0x1113('0x37'),_0x4f88f3);}};module[_0x1113('0x38')]=Agent; \ No newline at end of file +var _0xd0f5=['smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','smsCapacity','busy','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xd0f5,0xda));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5d0f('0x0'));var moment=require(_0x5d0f('0x1'));var md5=require('md5');var Redis=require(_0x5d0f('0x2'));var config=require(_0x5d0f('0x3'));config[_0x5d0f('0x4')]=_[_0x5d0f('0x5')](config[_0x5d0f('0x4')],{'host':_0x5d0f('0x6'),'port':0x18eb});var io=require(_0x5d0f('0x7'))(new Redis(config[_0x5d0f('0x4')]));function Agent(_0x47e372){this['id']=_0x47e372['id']||0x0;this[_0x5d0f('0x8')]=_0x47e372[_0x5d0f('0x8')]||'';this['online']=_0x47e372[_0x5d0f('0x9')]||!![];this[_0x5d0f('0xa')]=_0x47e372[_0x5d0f('0xa')]||![];this[_0x5d0f('0xb')]=_0x47e372['chatPause']||![];this[_0x5d0f('0xc')]=_0x47e372[_0x5d0f('0xc')]||![];this[_0x5d0f('0xd')]=_0x47e372['faxPause']||![];this[_0x5d0f('0xe')]=_0x47e372[_0x5d0f('0xe')]||![];this['openchannelPause']=_0x47e372[_0x5d0f('0xf')]||![];this[_0x5d0f('0x10')]='unknown';this[_0x5d0f('0x11')]=0x0;this[_0x5d0f('0x12')]=_0x47e372[_0x5d0f('0x12')]||0x0;this[_0x5d0f('0x13')]=0x0;this['mailStatus']='unknown';this[_0x5d0f('0x14')]=0x0;this['mailCapacity']=_0x47e372[_0x5d0f('0x15')]||0x0;this[_0x5d0f('0x16')]=0x0;this[_0x5d0f('0x17')]=_0x5d0f('0x18');this[_0x5d0f('0x19')]=0x0;this[_0x5d0f('0x1a')]=_0x47e372[_0x5d0f('0x1a')]||0x0;this[_0x5d0f('0x1b')]=0x0;this[_0x5d0f('0x1c')]=_0x5d0f('0x18');this[_0x5d0f('0x1d')]=0x0;this['smsCapacity']=_0x47e372['smsCapacity']||0x0;this[_0x5d0f('0x1e')]=0x0;this[_0x5d0f('0x1f')]=_0x5d0f('0x18');this[_0x5d0f('0x20')]=0x0;this['whatsappCapacity']=_0x47e372[_0x5d0f('0x21')]||0x0;this[_0x5d0f('0x22')]=0x0;this[_0x5d0f('0x23')]=_0x5d0f('0x18');this[_0x5d0f('0x24')]=0x0;this[_0x5d0f('0x25')]=_0x47e372[_0x5d0f('0x25')]||0x0;this[_0x5d0f('0x26')]=0x0;this['busy']=![];this[_0x5d0f('0x27')]=undefined;this[_0x5d0f('0x28')]='';this[_0x5d0f('0x29')]();}Agent[_0x5d0f('0x2a')][_0x5d0f('0x2b')]=function(_0x44e38a){if(this[_0x44e38a+_0x5d0f('0x2c')]>0x0){if(this[_0x44e38a+_0x5d0f('0x2d')]>0x0&&this[_0x44e38a+'CurrentCapacity']>=this[_0x44e38a+'Capacity']){return _0x5d0f('0x2e');}else{return _0x5d0f('0x2f');}}else{return'idle';}};Agent[_0x5d0f('0x2a')][_0x5d0f('0x29')]=function(){var _0x3053cf=['mail',_0x5d0f('0x30'),_0x5d0f('0x31'),'fax',_0x5d0f('0x32'),_0x5d0f('0x33')];for(var _0x1f4af5=0x0;_0x1f4af5<_0x3053cf[_0x5d0f('0x34')];_0x1f4af5+=0x1){var _0x34985a=this[_0x5d0f('0x2b')](_0x3053cf[_0x1f4af5]);if(this[_0x3053cf[_0x1f4af5]+_0x5d0f('0x35')]!==_0x34985a){this[_0x3053cf[_0x1f4af5]+_0x5d0f('0x36')]=_[_0x5d0f('0x37')](moment()[_0x5d0f('0x38')]('x'));}this[_0x3053cf[_0x1f4af5]+_0x5d0f('0x35')]=_0x34985a;}var _0x372a6f={'id':this['id'],'name':this['name'],'online':this[_0x5d0f('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x5d0f('0xb')],'mailPause':this[_0x5d0f('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x5d0f('0xd')],'openchannelPause':this[_0x5d0f('0xf')],'chatStatus':this[_0x5d0f('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x5d0f('0x12')],'chatCurrentCapacity':this[_0x5d0f('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x5d0f('0x14')],'mailCapacity':this[_0x5d0f('0x15')],'mailCurrentCapacity':this[_0x5d0f('0x16')],'faxStatus':this[_0x5d0f('0x17')],'faxStatusTime':this[_0x5d0f('0x19')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x5d0f('0x1c')],'smsStatusTime':this[_0x5d0f('0x1d')],'smsCapacity':this[_0x5d0f('0x39')],'smsCurrentCapacity':this[_0x5d0f('0x1e')],'whatsappStatus':this[_0x5d0f('0x1f')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x5d0f('0x22')],'openchannelStatus':this[_0x5d0f('0x23')],'openchannelStatusTime':this[_0x5d0f('0x24')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x5d0f('0x26')],'busy':this[_0x5d0f('0x3a')],'busyQueue':this[_0x5d0f('0x27')]};var _0x631bd7=md5(JSON['stringify'](_0x372a6f));if(this[_0x5d0f('0x28')]!==_0x631bd7){this[_0x5d0f('0x28')]=_0x631bd7;io[_0x5d0f('0x3b')](_0x5d0f('0x3c'),_0x372a6f);}};module[_0x5d0f('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fda5414..a7b9218 100644 --- a/server/services/routing/model/chatQueue.js +++ b/server/services/routing/model/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5f1=['available','waiting','stringify','format','emit','chat_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','md5','updateRealtime','updateRouting','mapAgentsId','_rr','map','Agents','prototype','paused','length','online','loggedIn'];(function(_0x36aed4,_0x4300cf){var _0x20c152=function(_0x1d2b15){while(--_0x1d2b15){_0x36aed4['push'](_0x36aed4['shift']());}};_0x20c152(++_0x4300cf);}(_0xc5f1,0xfa));var _0x1c5f=function(_0x393bc6,_0x25ed53){_0x393bc6=_0x393bc6-0x0;var _0x482841=_0xc5f1[_0x393bc6];return _0x482841;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1c5f('0x0'));var Redis=require(_0x1c5f('0x1'));var config=require(_0x1c5f('0x2'));config[_0x1c5f('0x3')]=_[_0x1c5f('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x33f7f8){this['id']=_0x33f7f8['id']||0x0;this[_0x1c5f('0x5')]=_0x33f7f8[_0x1c5f('0x5')]||'';this['timeout']=_0x33f7f8[_0x1c5f('0x6')]||0xa;this[_0x1c5f('0x7')]=_0x33f7f8['strategy']||'beepall';this['Agents']=_0x33f7f8['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x1c5f('0x8')]='';this['updateRouting']();this[_0x1c5f('0x9')]();}ChatQueue['prototype'][_0x1c5f('0xa')]=function(){var _0x5103cc=this[_0x1c5f('0xb')][_0x1c5f('0xc')];this['mapAgentsId']=_[_0x1c5f('0xd')](this[_0x1c5f('0xe')],'id');this[_0x1c5f('0xb')][_0x1c5f('0xc')]=_0x5103cc;};ChatQueue[_0x1c5f('0xf')][_0x1c5f('0x9')]=function(){this['loggedIn']=0x0;this[_0x1c5f('0x10')]=0x0;for(var _0x455353=0x0;_0x455353=0x0?this[_0x1c5f('0x14')]:0x0;var _0x1ab53f={'id':this['id'],'available':this[_0x1c5f('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x1c5f('0x5')],'paused':this[_0x1c5f('0x10')],'waiting':this[_0x1c5f('0x15')]};var _0x42cd88=md5(JSON[_0x1c5f('0x16')](_0x1ab53f));if(this[_0x1c5f('0x8')]!==_0x42cd88){this[_0x1c5f('0x8')]=_0x42cd88;io['to'](util[_0x1c5f('0x17')]('chat:queue:%s',_0x1ab53f['name']))[_0x1c5f('0x18')](_0x1c5f('0x19'),_0x1ab53f);}};module[_0x1c5f('0x1a')]=ChatQueue; \ No newline at end of file +var _0x4892=['chatPause','available','stringify','format','emit','chat_queue:save','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','md5','updateRouting','updateRealtime','_rr','mapAgentsId','map','prototype','loggedIn','paused','length','online'];(function(_0x4fd19c,_0x5637f5){var _0x1c653d=function(_0x21a365){while(--_0x21a365){_0x4fd19c['push'](_0x4fd19c['shift']());}};_0x1c653d(++_0x5637f5);}(_0x4892,0x1e2));var _0x2489=function(_0x5e667d,_0x2aceb8){_0x5e667d=_0x5e667d-0x0;var _0x58c5f9=_0x4892[_0x5e667d];return _0x58c5f9;};'use strict';var _=require(_0x2489('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x2489('0x1'));var config=require(_0x2489('0x2'));config[_0x2489('0x3')]=_['defaults'](config['redis'],{'host':_0x2489('0x4'),'port':0x18eb});var io=require(_0x2489('0x5'))(new Redis(config[_0x2489('0x3')]));function ChatQueue(_0x56e776){this['id']=_0x56e776['id']||0x0;this[_0x2489('0x6')]=_0x56e776[_0x2489('0x6')]||'';this[_0x2489('0x7')]=_0x56e776['timeout']||0xa;this[_0x2489('0x8')]=_0x56e776[_0x2489('0x8')]||_0x2489('0x9');this['Agents']=_0x56e776[_0x2489('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x2489('0xb')]='';this[_0x2489('0xc')]();this[_0x2489('0xd')]();}ChatQueue['prototype'][_0x2489('0xc')]=function(){var _0x4f3912=this['mapAgentsId'][_0x2489('0xe')];this[_0x2489('0xf')]=_[_0x2489('0x10')](this['Agents'],'id');this[_0x2489('0xf')][_0x2489('0xe')]=_0x4f3912;};ChatQueue[_0x2489('0x11')][_0x2489('0xd')]=function(){this[_0x2489('0x12')]=0x0;this[_0x2489('0x13')]=0x0;for(var _0x41eb03=0x0;_0x41eb03=0x0?this[_0x2489('0x17')]:0x0;var _0x5cb003={'id':this['id'],'available':this[_0x2489('0x17')],'loggedIn':this[_0x2489('0x12')],'name':this[_0x2489('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x466c06=md5(JSON[_0x2489('0x18')](_0x5cb003));if(this[_0x2489('0xb')]!==_0x466c06){this['md5']=_0x466c06;io['to'](util[_0x2489('0x19')]('chat:queue:%s',_0x5cb003[_0x2489('0x6')]))[_0x2489('0x1a')](_0x2489('0x1b'),_0x5cb003);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 6ae34bb..802126f 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f7e=['exports','lodash','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','name','md5','fax_queue:save'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0x3f7e,0xbe));var _0xe3f7=function(_0x59b917,_0x34b28a){_0x59b917=_0x59b917-0x0;var _0x3884e5=_0x3f7e[_0x59b917];return _0x3884e5;};'use strict';var _=require(_0xe3f7('0x0'));var md5=require('md5');var util=require(_0xe3f7('0x1'));var Redis=require('ioredis');var config=require(_0xe3f7('0x2'));config['redis']=_[_0xe3f7('0x3')](config[_0xe3f7('0x4')],{'host':_0xe3f7('0x5'),'port':0x18eb});var io=require(_0xe3f7('0x6'))(new Redis(config[_0xe3f7('0x4')]));function FaxQueue(_0x2222a1){this['id']=_0x2222a1['id']||0x0;this['name']=_0x2222a1['name']||'';this[_0xe3f7('0x7')]=_0x2222a1[_0xe3f7('0x7')]||0xa;this[_0xe3f7('0x8')]=_0x2222a1['strategy']||_0xe3f7('0x9');this[_0xe3f7('0xa')]=_0x2222a1[_0xe3f7('0xa')];this[_0xe3f7('0xb')]={};this[_0xe3f7('0xc')]=0x0;this['md5']='';this[_0xe3f7('0xd')]();this[_0xe3f7('0xe')]();}FaxQueue[_0xe3f7('0xf')][_0xe3f7('0xd')]=function(){var _0x1bf6ba=this[_0xe3f7('0xb')][_0xe3f7('0x10')];this['mapAgentsId']=_[_0xe3f7('0x11')](this[_0xe3f7('0xa')],'id');this['mapAgentsId'][_0xe3f7('0x10')]=_0x1bf6ba;};FaxQueue[_0xe3f7('0xf')][_0xe3f7('0xe')]=function(){this[_0xe3f7('0x12')]=0x0;this[_0xe3f7('0x13')]=0x0;for(var _0x44ec67=0x0;_0x44ec67=0x0?this[_0xe3f7('0x16')]:0x0;var _0x358865={'id':this['id'],'available':this[_0xe3f7('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xe3f7('0x17')],'paused':this[_0xe3f7('0x13')],'waiting':this[_0xe3f7('0xc')]};var _0x532e08=md5(JSON['stringify'](_0x358865));if(this[_0xe3f7('0x18')]!==_0x532e08){this[_0xe3f7('0x18')]=_0x532e08;io['to'](util['format']('fax:queue:%s',_0x358865['name']))['emit'](_0xe3f7('0x19'),_0x358865);}};module[_0xe3f7('0x1a')]=FaxQueue; \ No newline at end of file +var _0xa8aa=['loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','prototype'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa8aa,0xe4));var _0xaa8a=function(_0x916813,_0xbe72d2){_0x916813=_0x916813-0x0;var _0x4b8240=_0xa8aa[_0x916813];return _0x4b8240;};'use strict';var _=require('lodash');var md5=require(_0xaa8a('0x0'));var util=require(_0xaa8a('0x1'));var Redis=require('ioredis');var config=require(_0xaa8a('0x2'));config[_0xaa8a('0x3')]=_['defaults'](config[_0xaa8a('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xaa8a('0x4'))(new Redis(config[_0xaa8a('0x3')]));function FaxQueue(_0x3a7fec){this['id']=_0x3a7fec['id']||0x0;this['name']=_0x3a7fec[_0xaa8a('0x5')]||'';this['timeout']=_0x3a7fec[_0xaa8a('0x6')]||0xa;this['strategy']=_0x3a7fec[_0xaa8a('0x7')]||_0xaa8a('0x8');this[_0xaa8a('0x9')]=_0x3a7fec[_0xaa8a('0x9')];this['mapAgentsId']={};this[_0xaa8a('0xa')]=0x0;this[_0xaa8a('0x0')]='';this[_0xaa8a('0xb')]();this[_0xaa8a('0xc')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x89bec5=this[_0xaa8a('0xd')]['_rr'];this[_0xaa8a('0xd')]=_['map'](this[_0xaa8a('0x9')],'id');this[_0xaa8a('0xd')]['_rr']=_0x89bec5;};FaxQueue[_0xaa8a('0xe')][_0xaa8a('0xc')]=function(){this[_0xaa8a('0xf')]=0x0;this[_0xaa8a('0x10')]=0x0;for(var _0x3a1d14=0x0;_0x3a1d14=0x0?this[_0xaa8a('0x14')]:0x0;var _0x515cbc={'id':this['id'],'available':this[_0xaa8a('0x14')],'loggedIn':this[_0xaa8a('0xf')],'name':this['name'],'paused':this[_0xaa8a('0x10')],'waiting':this['waiting']};var _0x359b18=md5(JSON[_0xaa8a('0x15')](_0x515cbc));if(this[_0xaa8a('0x0')]!==_0x359b18){this[_0xaa8a('0x0')]=_0x359b18;io['to'](util[_0xaa8a('0x16')](_0xaa8a('0x17'),_0x515cbc[_0xaa8a('0x5')]))[_0xaa8a('0x18')](_0xaa8a('0x19'),_0x515cbc);}};module[_0xaa8a('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 6374a56..b0a4768 100644 --- a/server/services/routing/model/interval.js +++ b/server/services/routing/model/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20ed=['Intervals','exports','name'];(function(_0x11a705,_0x39607d){var _0x2cf586=function(_0x558347){while(--_0x558347){_0x11a705['push'](_0x11a705['shift']());}};_0x2cf586(++_0x39607d);}(_0x20ed,0x1ee));var _0xd20e=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x20ed[_0x1b6c6d];return _0x290d9d;};'use strict';function Interval(_0x425bd8){this['id']=_0x425bd8['id']||0x0;this[_0xd20e('0x0')]=_0x425bd8[_0xd20e('0x0')]||'';this[_0xd20e('0x1')]=_0x425bd8['Intervals']||{};}module[_0xd20e('0x2')]=Interval; \ No newline at end of file +var _0x5679=['exports','name','Intervals'];(function(_0x20bdff,_0x3bcf0d){var _0x5edb15=function(_0x34daa3){while(--_0x34daa3){_0x20bdff['push'](_0x20bdff['shift']());}};_0x5edb15(++_0x3bcf0d);}(_0x5679,0x199));var _0x9567=function(_0x2c97be,_0x1079a2){_0x2c97be=_0x2c97be-0x0;var _0x382e46=_0x5679[_0x2c97be];return _0x382e46;};'use strict';function Interval(_0x4fa227){this['id']=_0x4fa227['id']||0x0;this[_0x9567('0x0')]=_0x4fa227[_0x9567('0x0')]||'';this[_0x9567('0x1')]=_0x4fa227[_0x9567('0x1')]||{};}module[_0x9567('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 1374773..fc7ea89 100644 --- a/server/services/routing/model/mailQueue.js +++ b/server/services/routing/model/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01dc=['ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','format','emit','mail_queue:save','lodash','md5'];(function(_0x53d3b0,_0x62aa42){var _0x44f608=function(_0x47f276){while(--_0x47f276){_0x53d3b0['push'](_0x53d3b0['shift']());}};_0x44f608(++_0x62aa42);}(_0x01dc,0x85));var _0xc01d=function(_0x5a7871,_0x33661e){_0x5a7871=_0x5a7871-0x0;var _0x2f555c=_0x01dc[_0x5a7871];return _0x2f555c;};'use strict';var _=require(_0xc01d('0x0'));var md5=require(_0xc01d('0x1'));var util=require('util');var Redis=require(_0xc01d('0x2'));var config=require('../../../config/environment');config[_0xc01d('0x3')]=_['defaults'](config[_0xc01d('0x3')],{'host':_0xc01d('0x4'),'port':0x18eb});var io=require(_0xc01d('0x5'))(new Redis(config[_0xc01d('0x3')]));function MailQueue(_0x91293){this['id']=_0x91293['id']||0x0;this['name']=_0x91293[_0xc01d('0x6')]||'';this[_0xc01d('0x7')]=_0x91293[_0xc01d('0x7')]||0xa;this[_0xc01d('0x8')]=_0x91293[_0xc01d('0x8')]||_0xc01d('0x9');this[_0xc01d('0xa')]=_0x91293[_0xc01d('0xa')];this[_0xc01d('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0xc01d('0xc')]();this[_0xc01d('0xd')]();}MailQueue[_0xc01d('0xe')][_0xc01d('0xc')]=function(){var _0x10db69=this[_0xc01d('0xb')][_0xc01d('0xf')];this['mapAgentsId']=_[_0xc01d('0x10')](this[_0xc01d('0xa')],'id');this[_0xc01d('0xb')][_0xc01d('0xf')]=_0x10db69;};MailQueue['prototype'][_0xc01d('0xd')]=function(){this[_0xc01d('0x11')]=0x0;this[_0xc01d('0x12')]=0x0;for(var _0x3e3471=0x0;_0x3e3471=0x0?this[_0xc01d('0x16')]:0x0;var _0x57af42={'id':this['id'],'available':this[_0xc01d('0x16')],'loggedIn':this[_0xc01d('0x11')],'name':this[_0xc01d('0x6')],'paused':this[_0xc01d('0x12')],'waiting':this['waiting']};var _0x82c5b9=md5(JSON[_0xc01d('0x17')](_0x57af42));if(this[_0xc01d('0x1')]!==_0x82c5b9){this[_0xc01d('0x1')]=_0x82c5b9;io['to'](util[_0xc01d('0x18')]('mail:queue:%s',_0x57af42['name']))[_0xc01d('0x19')](_0xc01d('0x1a'),_0x57af42);}};module['exports']=MailQueue; \ No newline at end of file +var _0x764b=['beepall','Agents','updateRouting','updateRealtime','prototype','_rr','length','online','loggedIn','available','paused','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy'];(function(_0x1776e3,_0x14e945){var _0x102946=function(_0x3455c7){while(--_0x3455c7){_0x1776e3['push'](_0x1776e3['shift']());}};_0x102946(++_0x14e945);}(_0x764b,0x146));var _0xb764=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x764b[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xb764('0x0'));var md5=require(_0xb764('0x1'));var util=require('util');var Redis=require(_0xb764('0x2'));var config=require(_0xb764('0x3'));config[_0xb764('0x4')]=_[_0xb764('0x5')](config[_0xb764('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xb764('0x6'))(new Redis(config[_0xb764('0x4')]));function MailQueue(_0x3fe267){this['id']=_0x3fe267['id']||0x0;this['name']=_0x3fe267[_0xb764('0x7')]||'';this[_0xb764('0x8')]=_0x3fe267['timeout']||0xa;this[_0xb764('0x9')]=_0x3fe267[_0xb764('0x9')]||_0xb764('0xa');this[_0xb764('0xb')]=_0x3fe267['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xb764('0x1')]='';this[_0xb764('0xc')]();this[_0xb764('0xd')]();}MailQueue[_0xb764('0xe')][_0xb764('0xc')]=function(){var _0x421db9=this['mapAgentsId'][_0xb764('0xf')];this['mapAgentsId']=_['map'](this[_0xb764('0xb')],'id');this['mapAgentsId'][_0xb764('0xf')]=_0x421db9;};MailQueue[_0xb764('0xe')][_0xb764('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x488f23=0x0;_0x488f23=0x0?this['available']:0x0;var _0x57a637={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb764('0x12')],'name':this[_0xb764('0x7')],'paused':this['paused'],'waiting':this[_0xb764('0x15')]};var _0x3e3cc4=md5(JSON[_0xb764('0x16')](_0x57a637));if(this['md5']!==_0x3e3cc4){this[_0xb764('0x1')]=_0x3e3cc4;io['to'](util[_0xb764('0x17')](_0xb764('0x18'),_0x57a637[_0xb764('0x7')]))[_0xb764('0x19')](_0xb764('0x1a'),_0x57a637);}};module[_0xb764('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index d704890..e46ccf4 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x2ef3,0xba));var _0x32ef=function(_0x425fe4,_0x281d96){_0x425fe4=_0x425fe4-0x0;var _0x479788=_0x2ef3[_0x425fe4];return _0x479788;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x19ab90,_0x23773c){var _0x45b682=function(_0x21ae73){while(--_0x21ae73){_0x19ab90['push'](_0x19ab90['shift']());}};_0x45b682(++_0x23773c);}(_0xadb5,0xad));var _0x5adb=function(_0x3b0cf2,_0x4533f1){_0x3b0cf2=_0x3b0cf2-0x0;var _0xcc39dc=_0xadb5[_0x3b0cf2];return _0xcc39dc;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index b341e51..36c4bcc 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x136c=['online','loggedIn','available','stringify','format','sms:queue:%s','emit','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','paused'];(function(_0x310747,_0x20742a){var _0x2f3e5e=function(_0x1ac176){while(--_0x1ac176){_0x310747['push'](_0x310747['shift']());}};_0x2f3e5e(++_0x20742a);}(_0x136c,0x1d2));var _0xc136=function(_0x2d7e54,_0xd91b9c){_0x2d7e54=_0x2d7e54-0x0;var _0x389c86=_0x136c[_0x2d7e54];return _0x389c86;};'use strict';var _=require(_0xc136('0x0'));var md5=require(_0xc136('0x1'));var util=require('util');var Redis=require(_0xc136('0x2'));var config=require(_0xc136('0x3'));config[_0xc136('0x4')]=_[_0xc136('0x5')](config[_0xc136('0x4')],{'host':_0xc136('0x6'),'port':0x18eb});var io=require(_0xc136('0x7'))(new Redis(config[_0xc136('0x4')]));function SmsQueue(_0x104d18){this['id']=_0x104d18['id']||0x0;this['name']=_0x104d18[_0xc136('0x8')]||'';this['timeout']=_0x104d18[_0xc136('0x9')]||0xa;this[_0xc136('0xa')]=_0x104d18[_0xc136('0xa')]||'beepall';this[_0xc136('0xb')]=_0x104d18['Agents'];this[_0xc136('0xc')]={};this[_0xc136('0xd')]=0x0;this[_0xc136('0x1')]='';this[_0xc136('0xe')]();this[_0xc136('0xf')]();}SmsQueue[_0xc136('0x10')][_0xc136('0xe')]=function(){var _0x303ebe=this[_0xc136('0xc')]['_rr'];this['mapAgentsId']=_[_0xc136('0x11')](this['Agents'],'id');this[_0xc136('0xc')][_0xc136('0x12')]=_0x303ebe;};SmsQueue[_0xc136('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xc136('0x13')]=0x0;for(var _0x36d55d=0x0;_0x36d55d=0x0?this[_0xc136('0x16')]:0x0;var _0x59503b={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xc136('0x8')],'paused':this['paused'],'waiting':this[_0xc136('0xd')]};var _0x18de2e=md5(JSON[_0xc136('0x17')](_0x59503b));if(this[_0xc136('0x1')]!==_0x18de2e){this['md5']=_0x18de2e;io['to'](util[_0xc136('0x18')](_0xc136('0x19'),_0x59503b['name']))[_0xc136('0x1a')]('sms_queue:save',_0x59503b);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x3036=['strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','length','online','loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','exports','util','ioredis','../../../config/environment','defaults','redis','name','timeout'];(function(_0x243931,_0x4a2a9e){var _0x4a26a0=function(_0x5c25a5){while(--_0x5c25a5){_0x243931['push'](_0x243931['shift']());}};_0x4a26a0(++_0x4a2a9e);}(_0x3036,0x1a9));var _0x6303=function(_0x36f45d,_0x962c3e){_0x36f45d=_0x36f45d-0x0;var _0x4bdf50=_0x3036[_0x36f45d];return _0x4bdf50;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x6303('0x0'));var Redis=require(_0x6303('0x1'));var config=require(_0x6303('0x2'));config['redis']=_[_0x6303('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6303('0x4')]));function SmsQueue(_0x48d0c8){this['id']=_0x48d0c8['id']||0x0;this[_0x6303('0x5')]=_0x48d0c8[_0x6303('0x5')]||'';this[_0x6303('0x6')]=_0x48d0c8['timeout']||0xa;this[_0x6303('0x7')]=_0x48d0c8[_0x6303('0x7')]||_0x6303('0x8');this[_0x6303('0x9')]=_0x48d0c8[_0x6303('0x9')];this[_0x6303('0xa')]={};this[_0x6303('0xb')]=0x0;this[_0x6303('0xc')]='';this[_0x6303('0xd')]();this['updateRealtime']();}SmsQueue[_0x6303('0xe')][_0x6303('0xd')]=function(){var _0x3ac7ef=this[_0x6303('0xa')][_0x6303('0xf')];this['mapAgentsId']=_[_0x6303('0x10')](this[_0x6303('0x9')],'id');this[_0x6303('0xa')][_0x6303('0xf')]=_0x3ac7ef;};SmsQueue[_0x6303('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2726ef=0x0;_0x2726ef=0x0?this[_0x6303('0x16')]:0x0;var _0x36a6af={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6303('0x13')],'name':this[_0x6303('0x5')],'paused':this[_0x6303('0x15')],'waiting':this[_0x6303('0xb')]};var _0x33474f=md5(JSON[_0x6303('0x17')](_0x36a6af));if(this[_0x6303('0xc')]!==_0x33474f){this[_0x6303('0xc')]=_0x33474f;io['to'](util[_0x6303('0x18')](_0x6303('0x19'),_0x36a6af[_0x6303('0x5')]))['emit']('sms_queue:save',_0x36a6af);}};module[_0x6303('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index c29221e..3b62cd1 100644 --- a/server/services/routing/model/whatsappQueue.js +++ b/server/services/routing/model/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ce0=['_rr','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','name','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype'];(function(_0x3032cc,_0x306bbf){var _0x5926bd=function(_0x55ee99){while(--_0x55ee99){_0x3032cc['push'](_0x3032cc['shift']());}};_0x5926bd(++_0x306bbf);}(_0x8ce0,0x158));var _0x08ce=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x8ce0[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x08ce('0x0'));var md5=require(_0x08ce('0x1'));var util=require(_0x08ce('0x2'));var Redis=require(_0x08ce('0x3'));var config=require(_0x08ce('0x4'));config[_0x08ce('0x5')]=_[_0x08ce('0x6')](config[_0x08ce('0x5')],{'host':_0x08ce('0x7'),'port':0x18eb});var io=require(_0x08ce('0x8'))(new Redis(config['redis']));function WhatsappQueue(_0x13c1ef){this['id']=_0x13c1ef['id']||0x0;this['name']=_0x13c1ef['name']||'';this[_0x08ce('0x9')]=_0x13c1ef[_0x08ce('0x9')]||0xa;this['strategy']=_0x13c1ef['strategy']||_0x08ce('0xa');this[_0x08ce('0xb')]=_0x13c1ef['Agents'];this[_0x08ce('0xc')]={};this[_0x08ce('0xd')]=0x0;this[_0x08ce('0x1')]='';this[_0x08ce('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x08ce('0xf')][_0x08ce('0xe')]=function(){var _0x5ec62d=this[_0x08ce('0xc')][_0x08ce('0x10')];this[_0x08ce('0xc')]=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x5ec62d;};WhatsappQueue['prototype'][_0x08ce('0x11')]=function(){this[_0x08ce('0x12')]=0x0;this[_0x08ce('0x13')]=0x0;for(var _0x46774d=0x0;_0x46774d=0x0?this[_0x08ce('0x17')]:0x0;var _0x3f0ab9={'id':this['id'],'available':this[_0x08ce('0x17')],'loggedIn':this[_0x08ce('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x08ce('0xd')]};var _0xf2203=md5(JSON[_0x08ce('0x18')](_0x3f0ab9));if(this[_0x08ce('0x1')]!==_0xf2203){this[_0x08ce('0x1')]=_0xf2203;io['to'](util[_0x08ce('0x19')](_0x08ce('0x1a'),_0x3f0ab9[_0x08ce('0x1b')]))[_0x08ce('0x1c')](_0x08ce('0x1d'),_0x3f0ab9);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xaab8=['prototype','loggedIn','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','updateRouting','map','_rr'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xaab8,0xcf));var _0x8aab=function(_0x4872ce,_0x1eb5fc){_0x4872ce=_0x4872ce-0x0;var _0x2ad042=_0xaab8[_0x4872ce];return _0x2ad042;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x8aab('0x0'));var config=require(_0x8aab('0x1'));config[_0x8aab('0x2')]=_[_0x8aab('0x3')](config[_0x8aab('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x8aab('0x4'))(new Redis(config[_0x8aab('0x2')]));function WhatsappQueue(_0x50a4f4){this['id']=_0x50a4f4['id']||0x0;this['name']=_0x50a4f4[_0x8aab('0x5')]||'';this[_0x8aab('0x6')]=_0x50a4f4[_0x8aab('0x6')]||0xa;this['strategy']=_0x50a4f4[_0x8aab('0x7')]||_0x8aab('0x8');this[_0x8aab('0x9')]=_0x50a4f4[_0x8aab('0x9')];this[_0x8aab('0xa')]={};this[_0x8aab('0xb')]=0x0;this[_0x8aab('0xc')]='';this['updateRouting']();this[_0x8aab('0xd')]();}WhatsappQueue['prototype'][_0x8aab('0xe')]=function(){var _0x1054cc=this[_0x8aab('0xa')]['_rr'];this['mapAgentsId']=_[_0x8aab('0xf')](this['Agents'],'id');this[_0x8aab('0xa')][_0x8aab('0x10')]=_0x1054cc;};WhatsappQueue[_0x8aab('0x11')][_0x8aab('0xd')]=function(){this[_0x8aab('0x12')]=0x0;this['paused']=0x0;for(var _0x11692b=0x0;_0x11692b=0x0?this[_0x8aab('0x16')]:0x0;var _0x2dfe8c={'id':this['id'],'available':this[_0x8aab('0x16')],'loggedIn':this[_0x8aab('0x12')],'name':this[_0x8aab('0x5')],'paused':this[_0x8aab('0x15')],'waiting':this[_0x8aab('0xb')]};var _0x1a5bfb=md5(JSON[_0x8aab('0x17')](_0x2dfe8c));if(this[_0x8aab('0xc')]!==_0x1a5bfb){this[_0x8aab('0xc')]=_0x1a5bfb;io['to'](util[_0x8aab('0x18')](_0x8aab('0x19'),_0x2dfe8c[_0x8aab('0x5')]))['emit'](_0x8aab('0x1a'),_0x2dfe8c);}};module[_0x8aab('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index f4383df..4b58d52 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x33884d,_0x2d27b2){var _0x576efd=function(_0x4fc961){while(--_0x4fc961){_0x33884d['push'](_0x33884d['shift']());}};_0x576efd(++_0x2d27b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x547515,_0x41c2c4){_0x547515=_0x547515-0x0;var _0x2fdecf=_0xb10b[_0x547515];return _0x2fdecf;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index acd4ba7..4fbdfe6 100644 --- a/server/services/routing/rpc/chatInteraction.js +++ b/server/services/routing/rpc/chatInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedcf=['update','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','../client'];(function(_0x58696b,_0x5899b2){var _0x4da6c5=function(_0xa7a9ae){while(--_0xa7a9ae){_0x58696b['push'](_0x58696b['shift']());}};_0x4da6c5(++_0x5899b2);}(_0xedcf,0x1c1));var _0xfedc=function(_0x53877d,_0x224cad){_0x53877d=_0x53877d-0x0;var _0x2af6e4=_0xedcf[_0x53877d];return _0x2af6e4;};'use strict';var client=require(_0xfedc('0x0'));exports[_0xfedc('0x1')]=function(_0x537893,_0x859d8f){return client[_0xfedc('0x2')](_0xfedc('0x3'),{'body':_0x859d8f,'options':{'where':{'id':_0x537893}},'log':_0xfedc('0x4')});};exports['addTags']=function(_0x2eb89c,_0x353713){return client[_0xfedc('0x2')](_0xfedc('0x5'),{'body':_0x353713,'options':{'where':{'id':_0x2eb89c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6cb4=['update','Request','updateChatInteraction','addTags','AddTagsToChatInteraction','../client'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6cb4,0xe3));var _0x46cb=function(_0x532eed,_0x1ff6d8){_0x532eed=_0x532eed-0x0;var _0x1c239c=_0x6cb4[_0x532eed];return _0x1c239c;};'use strict';var client=require(_0x46cb('0x0'));exports[_0x46cb('0x1')]=function(_0x2c5f57,_0x1b6059){return client[_0x46cb('0x2')]('UpdateChatInteraction',{'body':_0x1b6059,'options':{'where':{'id':_0x2c5f57}},'log':_0x46cb('0x3')});};exports[_0x46cb('0x4')]=function(_0x662259,_0x3089e9){return client[_0x46cb('0x2')](_0x46cb('0x5'),{'body':_0x3089e9,'options':{'where':{'id':_0x662259}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index f5a5406..a301720 100644 --- a/server/services/routing/rpc/chatMessage.js +++ b/server/services/routing/rpc/chatMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c98=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x5705cd,_0x350347){var _0x4597b4=function(_0x55f633){while(--_0x55f633){_0x5705cd['push'](_0x5705cd['shift']());}};_0x4597b4(++_0x350347);}(_0x4c98,0xcd));var _0x84c9=function(_0x3bfa00,_0x1e2b0f){_0x3bfa00=_0x3bfa00-0x0;var _0x3bd161=_0x4c98[_0x3bfa00];return _0x3bd161;};'use strict';var client=require('../client');exports[_0x84c9('0x0')]=function(_0x404115){return client[_0x84c9('0x1')](_0x84c9('0x2'),{'body':_0x404115,'log':_0x84c9('0x3')});}; \ No newline at end of file +var _0x4162=['Request','CreateChatMessage','createChatMessage','../client'];(function(_0x20c893,_0xbef2b4){var _0xc705e8=function(_0x449739){while(--_0x449739){_0x20c893['push'](_0x20c893['shift']());}};_0xc705e8(++_0xbef2b4);}(_0x4162,0x1b3));var _0x2416=function(_0x54e88b,_0x29a4da){_0x54e88b=_0x54e88b-0x0;var _0x53a57e=_0x4162[_0x54e88b];return _0x53a57e;};'use strict';var client=require(_0x2416('0x0'));exports['create']=function(_0xe3e5be){return client[_0x2416('0x1')](_0x2416('0x2'),{'body':_0xe3e5be,'log':_0x2416('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index c04b063..cbb10fd 100644 --- a/server/services/routing/rpc/chatQueue.js +++ b/server/services/routing/rpc/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaeab=['User','Agents','online','chatPause','getChatQueues','../client','Request','name','timeout','strategy'];(function(_0x7326b,_0x242d52){var _0x485232=function(_0x5cd219){while(--_0x5cd219){_0x7326b['push'](_0x7326b['shift']());}};_0x485232(++_0x242d52);}(_0xaeab,0x91));var _0xbaea=function(_0x287fbf,_0x5d26a6){_0x287fbf=_0x287fbf-0x0;var _0x44c8b3=_0xaeab[_0x287fbf];return _0x44c8b3;};'use strict';var client=require(_0xbaea('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xbaea('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xbaea('0x2'),_0xbaea('0x3'),_0xbaea('0x4')],'include':[{'model':_0xbaea('0x5'),'as':_0xbaea('0x6'),'attributes':['id',_0xbaea('0x2'),_0xbaea('0x7'),_0xbaea('0x8')]}]},'log':_0xbaea('0x9')});};}; \ No newline at end of file +var _0x9c50=['chatPause','GetChatQueue','timeout','Agents','name'];(function(_0x430f44,_0x4ae21b){var _0x1f6b0f=function(_0x35968f){while(--_0x35968f){_0x430f44['push'](_0x430f44['shift']());}};_0x1f6b0f(++_0x4ae21b);}(_0x9c50,0xec));var _0x09c5=function(_0x46cd25,_0x771a25){_0x46cd25=_0x46cd25-0x0;var _0x556def=_0x9c50[_0x46cd25];return _0x556def;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client['Request'](_0x09c5('0x0'),{'options':{'raw':![],'attributes':['id','name',_0x09c5('0x1'),'strategy'],'include':[{'model':'User','as':_0x09c5('0x2'),'attributes':['id',_0x09c5('0x3'),'online',_0x09c5('0x4')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 3c24677..44ad657 100644 --- a/server/services/routing/rpc/chatQueueReport.js +++ b/server/services/routing/rpc/chatQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b59=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x3b59,0x9c));var _0x93b5=function(_0x5cedbc,_0x48fc4d){_0x5cedbc=_0x5cedbc-0x0;var _0x5d73a0=_0x3b59[_0x5cedbc];return _0x5d73a0;};'use strict';var client=require(_0x93b5('0x0'));exports[_0x93b5('0x1')]=function(_0x4430dd){return client[_0x93b5('0x2')](_0x93b5('0x3'),{'body':_0x4430dd,'log':_0x93b5('0x3')});};exports['update']=function(_0x268d0e,_0x5c9d7e){return client[_0x93b5('0x2')](_0x93b5('0x4'),{'body':_0x5c9d7e,'options':{'where':{'uniqueid':_0x268d0e},'order':[['id',_0x93b5('0x5')]],'limit':0x1},'log':_0x93b5('0x4')});}; \ No newline at end of file +var _0x21a3=['../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x117a90,_0x1deb3d){var _0x1c73cd=function(_0x420778){while(--_0x420778){_0x117a90['push'](_0x117a90['shift']());}};_0x1c73cd(++_0x1deb3d);}(_0x21a3,0x66));var _0x321a=function(_0xb64e9e,_0x519fb2){_0xb64e9e=_0xb64e9e-0x0;var _0x1c63f4=_0x21a3[_0xb64e9e];return _0x1c63f4;};'use strict';var client=require(_0x321a('0x0'));exports['create']=function(_0x2b85b5){return client[_0x321a('0x1')](_0x321a('0x2'),{'body':_0x2b85b5,'log':_0x321a('0x2')});};exports[_0x321a('0x3')]=function(_0x185e2a,_0x5df495){return client['Request'](_0x321a('0x4'),{'body':_0x5df495,'options':{'where':{'uniqueid':_0x185e2a},'order':[['id',_0x321a('0x5')]],'limit':0x1},'log':_0x321a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index a27fefc..eef717a 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x592d48,_0x23f1ba){var _0x5d789e=function(_0x156900){while(--_0x156900){_0x592d48['push'](_0x592d48['shift']());}};_0x5d789e(++_0x23f1ba);}(_0x7a54,0x106));var _0x47a5=function(_0x4b8559,_0x36e5e4){_0x4b8559=_0x4b8559-0x0;var _0x16ae6b=_0x7a54[_0x4b8559];return _0x16ae6b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x7a54,0x106));var _0x47a5=function(_0x37764f,_0x4a9dbf){_0x37764f=_0x37764f-0x0;var _0x3742a6=_0x7a54[_0x37764f];return _0x3742a6;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index c84ff06..1b7fe9b 100644 --- a/server/services/routing/rpc/faxMessage.js +++ b/server/services/routing/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf86c=['createFaxMessage','create','Request','CreateFaxMessage'];(function(_0x1cc8a2,_0x5dce88){var _0xadb7a6=function(_0x385f03){while(--_0x385f03){_0x1cc8a2['push'](_0x1cc8a2['shift']());}};_0xadb7a6(++_0x5dce88);}(_0xf86c,0x99));var _0xcf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xcf86('0x0')]=function(_0x4d727f){return client[_0xcf86('0x1')](_0xcf86('0x2'),{'body':_0x4d727f,'log':_0xcf86('0x3')});}; \ No newline at end of file +var _0x1f58=['create','Request','CreateFaxMessage','../client'];(function(_0x38e7eb,_0x5315b9){var _0x420b11=function(_0xe5347){while(--_0xe5347){_0x38e7eb['push'](_0x38e7eb['shift']());}};_0x420b11(++_0x5315b9);}(_0x1f58,0x19f));var _0x81f5=function(_0x120c9e,_0xb7938f){_0x120c9e=_0x120c9e-0x0;var _0x25eff5=_0x1f58[_0x120c9e];return _0x25eff5;};'use strict';var client=require(_0x81f5('0x0'));exports[_0x81f5('0x1')]=function(_0x57a721){return client[_0x81f5('0x2')](_0x81f5('0x3'),{'body':_0x57a721,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 8980405..f8a6d9d 100644 --- a/server/services/routing/rpc/faxQueue.js +++ b/server/services/routing/rpc/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29f5=['Agents','faxPause','../client','GetFaxQueue','name','timeout','strategy','User'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x29f5,0x72));var _0x529f=function(_0x34feb6,_0x1968cb){_0x34feb6=_0x34feb6-0x0;var _0xfb691b=_0x29f5[_0x34feb6];return _0xfb691b;};'use strict';var client=require(_0x529f('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0x529f('0x1'),{'options':{'raw':![],'attributes':['id',_0x529f('0x2'),_0x529f('0x3'),_0x529f('0x4')],'include':[{'model':_0x529f('0x5'),'as':_0x529f('0x6'),'attributes':['id','name','online',_0x529f('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x45de=['Request','GetFaxQueue','name','Agents','faxPause','getFaxQueues'];(function(_0x12ce9f,_0x3fa7f2){var _0x2da60e=function(_0x4e6363){while(--_0x4e6363){_0x12ce9f['push'](_0x12ce9f['shift']());}};_0x2da60e(++_0x3fa7f2);}(_0x45de,0x1e5));var _0xe45d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x45de[_0x3b380d];return _0x54502b;};'use strict';var client=require('../client');exports[_0xe45d('0x0')]=function(){return function(){return client[_0xe45d('0x1')](_0xe45d('0x2'),{'options':{'raw':![],'attributes':['id',_0xe45d('0x3'),'timeout','strategy'],'include':[{'model':'User','as':_0xe45d('0x4'),'attributes':['id','name','online',_0xe45d('0x5')]}]},'log':_0xe45d('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index c9995f9..35541cc 100644 --- a/server/services/routing/rpc/faxQueueReport.js +++ b/server/services/routing/rpc/faxQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9af9=['CreateFaxQueueReport','DESC','../client','create','Request'];(function(_0x262c80,_0x4fbf1f){var _0x4ba8c4=function(_0x1f19f0){while(--_0x1f19f0){_0x262c80['push'](_0x262c80['shift']());}};_0x4ba8c4(++_0x4fbf1f);}(_0x9af9,0x7a));var _0x99af=function(_0x44bb89,_0x56be76){_0x44bb89=_0x44bb89-0x0;var _0xb00d80=_0x9af9[_0x44bb89];return _0xb00d80;};'use strict';var client=require(_0x99af('0x0'));exports[_0x99af('0x1')]=function(_0x4b5b6b){return client[_0x99af('0x2')]('CreateFaxQueueReport',{'body':_0x4b5b6b,'log':_0x99af('0x3')});};exports['update']=function(_0x5f4a26,_0x384a6c){return client['Request']('UpdateFaxQueueReport',{'body':_0x384a6c,'options':{'where':{'uniqueid':_0x5f4a26},'order':[['id',_0x99af('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x12e5=['../client','CreateFaxQueueReport','Request','UpdateFaxQueueReport','DESC'];(function(_0x434e1a,_0x16f187){var _0x15081a=function(_0x2f94ec){while(--_0x2f94ec){_0x434e1a['push'](_0x434e1a['shift']());}};_0x15081a(++_0x16f187);}(_0x12e5,0xe6));var _0x512e=function(_0x1af6b4,_0x1dcdbe){_0x1af6b4=_0x1af6b4-0x0;var _0x51190f=_0x12e5[_0x1af6b4];return _0x51190f;};'use strict';var client=require(_0x512e('0x0'));exports['create']=function(_0xbba0fa){return client['Request'](_0x512e('0x1'),{'body':_0xbba0fa,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x1c2b8b,_0x7307da){return client[_0x512e('0x2')](_0x512e('0x3'),{'body':_0x7307da,'options':{'where':{'uniqueid':_0x1c2b8b},'order':[['id',_0x512e('0x4')]],'limit':0x1},'log':_0x512e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 1c09e1d..5d1d321 100644 --- a/server/services/routing/rpc/interval.js +++ b/server/services/routing/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fee=['name','Intervals','getIntervals','GetInterval'];(function(_0x3fd29d,_0x385450){var _0x4010c1=function(_0x171dac){while(--_0x171dac){_0x3fd29d['push'](_0x3fd29d['shift']());}};_0x4010c1(++_0x385450);}(_0x0fee,0x82));var _0xe0fe=function(_0x20639f,_0x3dd24b){_0x20639f=_0x20639f-0x0;var _0x4d15d9=_0x0fee[_0x20639f];return _0x4d15d9;};'use strict';var client=require('../client');exports[_0xe0fe('0x0')]=function(){return function(){return client['Request'](_0xe0fe('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe0fe('0x2')],'include':[{'model':'Interval','as':_0xe0fe('0x3'),'attributes':['id',_0xe0fe('0x2'),'interval']}]},'log':_0xe0fe('0x0')});};}; \ No newline at end of file +var _0xca2a=['Request','GetInterval','Interval','Intervals','name','interval','../client','getIntervals'];(function(_0x4ade91,_0x50aaa3){var _0x238bec=function(_0x370855){while(--_0x370855){_0x4ade91['push'](_0x4ade91['shift']());}};_0x238bec(++_0x50aaa3);}(_0xca2a,0x9e));var _0xaca2=function(_0x553cca,_0x20e9b5){_0x553cca=_0x553cca-0x0;var _0x464da1=_0xca2a[_0x553cca];return _0x464da1;};'use strict';var client=require(_0xaca2('0x0'));exports[_0xaca2('0x1')]=function(){return function(){return client[_0xaca2('0x2')](_0xaca2('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xaca2('0x4'),'as':_0xaca2('0x5'),'attributes':['id',_0xaca2('0x6'),_0xaca2('0x7')]}]},'log':_0xaca2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 9cb7eab..4ab3ea9 100644 --- a/server/services/routing/rpc/mailInteraction.js +++ b/server/services/routing/rpc/mailInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf61e=['addTags','AddTagsToMailInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0xf61e,0x191));var _0xef61=function(_0x4b79e2,_0xa833b7){_0x4b79e2=_0x4b79e2-0x0;var _0xf12ba9=_0xf61e[_0x4b79e2];return _0xf12ba9;};'use strict';var client=require(_0xef61('0x0'));exports[_0xef61('0x1')]=function(_0xe535c3,_0xcf15bd){return client[_0xef61('0x2')](_0xef61('0x3'),{'body':_0xcf15bd,'options':{'where':{'id':_0xe535c3}},'log':_0xef61('0x4')});};exports[_0xef61('0x5')]=function(_0x2bd1d0,_0x14122a){return client[_0xef61('0x2')](_0xef61('0x6'),{'body':_0x14122a,'options':{'where':{'id':_0x2bd1d0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x1eba=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x1eba[_0x30ae5e];return _0x1f2e93;};'use strict';var client=require(_0xa1eb('0x0'));exports[_0xa1eb('0x1')]=function(_0x406a58,_0x2158d5){return client[_0xa1eb('0x2')]('UpdateMailInteraction',{'body':_0x2158d5,'options':{'where':{'id':_0x406a58}},'log':'updateMailInteraction'});};exports[_0xa1eb('0x3')]=function(_0x34be5a,_0x16a13a){return client[_0xa1eb('0x2')](_0xa1eb('0x4'),{'body':_0x16a13a,'options':{'where':{'id':_0x34be5a}},'log':_0xa1eb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 92bfad1..bfbda8a 100644 --- a/server/services/routing/rpc/mailMessage.js +++ b/server/services/routing/rpc/mailMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4639=['CreateMailMessage','../client','create','Request'];(function(_0x16fe20,_0x4c4051){var _0x44c6db=function(_0x2eab6c){while(--_0x2eab6c){_0x16fe20['push'](_0x16fe20['shift']());}};_0x44c6db(++_0x4c4051);}(_0x4639,0x1e9));var _0x9463=function(_0x375072,_0x1ad2ed){_0x375072=_0x375072-0x0;var _0x3e82e7=_0x4639[_0x375072];return _0x3e82e7;};'use strict';var client=require(_0x9463('0x0'));exports[_0x9463('0x1')]=function(_0x3546eb){return client[_0x9463('0x2')](_0x9463('0x3'),{'body':_0x3546eb,'log':'createMailMessage'});}; \ No newline at end of file +var _0x7f37=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x354bbe,_0x5390ee){var _0x3eec63=function(_0x3f36c2){while(--_0x3f36c2){_0x354bbe['push'](_0x354bbe['shift']());}};_0x3eec63(++_0x5390ee);}(_0x7f37,0x182));var _0x77f3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x7f37[_0x53ccf2];return _0x5a2964;};'use strict';var client=require(_0x77f3('0x0'));exports[_0x77f3('0x1')]=function(_0x3bf6c){return client[_0x77f3('0x2')](_0x77f3('0x3'),{'body':_0x3bf6c,'log':_0x77f3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 14f49e0..d9b91a7 100644 --- a/server/services/routing/rpc/mailQueue.js +++ b/server/services/routing/rpc/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0cd=['Agents','mailPause','getMailQueues','Request','GetMailQueue','name','strategy','User'];(function(_0x4e3168,_0x38530c){var _0x4e9cc6=function(_0x4dffa3){while(--_0x4dffa3){_0x4e3168['push'](_0x4e3168['shift']());}};_0x4e9cc6(++_0x38530c);}(_0xc0cd,0x73));var _0xdc0c=function(_0x2802c1,_0x4d7aeb){_0x2802c1=_0x2802c1-0x0;var _0xc0b60b=_0xc0cd[_0x2802c1];return _0xc0b60b;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0xdc0c('0x0')](_0xdc0c('0x1'),{'options':{'raw':![],'attributes':['id',_0xdc0c('0x2'),'timeout',_0xdc0c('0x3')],'include':[{'model':_0xdc0c('0x4'),'as':_0xdc0c('0x5'),'attributes':['id','name','online',_0xdc0c('0x6')]}]},'log':_0xdc0c('0x7')});};}; \ No newline at end of file +var _0x60ae=['mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','online'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x60ae,0xbe));var _0xe60a=function(_0x2b51c2,_0x401991){_0x2b51c2=_0x2b51c2-0x0;var _0x234ecd=_0x60ae[_0x2b51c2];return _0x234ecd;};'use strict';var client=require('../client');exports[_0xe60a('0x0')]=function(){return function(){return client[_0xe60a('0x1')](_0xe60a('0x2'),{'options':{'raw':![],'attributes':['id',_0xe60a('0x3'),_0xe60a('0x4'),_0xe60a('0x5')],'include':[{'model':_0xe60a('0x6'),'as':'Agents','attributes':['id',_0xe60a('0x3'),_0xe60a('0x7'),_0xe60a('0x8')]}]},'log':_0xe60a('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index bf07f5f..207ff40 100644 --- a/server/services/routing/rpc/mailQueueReport.js +++ b/server/services/routing/rpc/mailQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76b6=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x7b84a4,_0x2b5817){var _0x4a2465=function(_0x2176d5){while(--_0x2176d5){_0x7b84a4['push'](_0x7b84a4['shift']());}};_0x4a2465(++_0x2b5817);}(_0x76b6,0xa9));var _0x676b=function(_0x4bfe15,_0x40a1b8){_0x4bfe15=_0x4bfe15-0x0;var _0x35f3cd=_0x76b6[_0x4bfe15];return _0x35f3cd;};'use strict';var client=require(_0x676b('0x0'));exports[_0x676b('0x1')]=function(_0xb8b22){return client[_0x676b('0x2')]('CreateMailQueueReport',{'body':_0xb8b22,'log':_0x676b('0x3')});};exports[_0x676b('0x4')]=function(_0x1e7879,_0x993bea){return client[_0x676b('0x2')](_0x676b('0x5'),{'body':_0x993bea,'options':{'where':{'uniqueid':_0x1e7879},'order':[['id',_0x676b('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xd85a=['update','Request','UpdateMailQueueReport','DESC','../client','create'];(function(_0x4d962b,_0x57bf97){var _0x15ca5d=function(_0xa8ee01){while(--_0xa8ee01){_0x4d962b['push'](_0x4d962b['shift']());}};_0x15ca5d(++_0x57bf97);}(_0xd85a,0x82));var _0xad85=function(_0x47ec61,_0x21c69a){_0x47ec61=_0x47ec61-0x0;var _0x3d9d9c=_0xd85a[_0x47ec61];return _0x3d9d9c;};'use strict';var client=require(_0xad85('0x0'));exports[_0xad85('0x1')]=function(_0x35a208){return client['Request']('CreateMailQueueReport',{'body':_0x35a208,'log':'CreateMailQueueReport'});};exports[_0xad85('0x2')]=function(_0x3b154b,_0x18489f){return client[_0xad85('0x3')](_0xad85('0x4'),{'body':_0x18489f,'options':{'where':{'uniqueid':_0x3b154b},'order':[['id',_0xad85('0x5')]],'limit':0x1},'log':_0xad85('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index ca6a674..cff6aaf 100644 --- a/server/services/routing/rpc/openchannelInteraction.js +++ b/server/services/routing/rpc/openchannelInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a55=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x554010,_0x343f1f){var _0x137448=function(_0x4c0d75){while(--_0x4c0d75){_0x554010['push'](_0x554010['shift']());}};_0x137448(++_0x343f1f);}(_0x5a55,0x117));var _0x55a5=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x5a55[_0x3e6d5d];return _0x238923;};'use strict';var client=require(_0x55a5('0x0'));exports['update']=function(_0x475917,_0x3df40c){return client['Request'](_0x55a5('0x1'),{'body':_0x3df40c,'options':{'where':{'id':_0x475917}},'log':_0x55a5('0x2')});};exports[_0x55a5('0x3')]=function(_0x30b416,_0xeb8099){return client[_0x55a5('0x4')](_0x55a5('0x5'),{'body':_0xeb8099,'options':{'where':{'id':_0x30b416}},'log':_0x55a5('0x6')});}; \ No newline at end of file +var _0x9933=['updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction','../client'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9933,0x18f));var _0x3993=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9933[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x3993('0x0'));exports['update']=function(_0x503ed6,_0x5368a1){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x5368a1,'options':{'where':{'id':_0x503ed6}},'log':_0x3993('0x1')});};exports['addTags']=function(_0x23c5b1,_0x2d1b0d){return client[_0x3993('0x2')](_0x3993('0x3'),{'body':_0x2d1b0d,'options':{'where':{'id':_0x23c5b1}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index d3781bc..07185b4 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd48a=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x1d67f0,_0x492dd8){var _0x327cdb=function(_0x1c9a41){while(--_0x1c9a41){_0x1d67f0['push'](_0x1d67f0['shift']());}};_0x327cdb(++_0x492dd8);}(_0xd48a,0xb5));var _0xad48=function(_0x3b10e3,_0xabe1d4){_0x3b10e3=_0x3b10e3-0x0;var _0x162ae0=_0xd48a[_0x3b10e3];return _0x162ae0;};'use strict';var client=require(_0xad48('0x0'));exports[_0xad48('0x1')]=function(_0x58250c){return client[_0xad48('0x2')](_0xad48('0x3'),{'body':_0x58250c,'log':_0xad48('0x4')});}; \ No newline at end of file +var _0xde95=['../client','create'];(function(_0x34f8c8,_0x40602c){var _0x555272=function(_0x103f95){while(--_0x103f95){_0x34f8c8['push'](_0x34f8c8['shift']());}};_0x555272(++_0x40602c);}(_0xde95,0x7c));var _0x5de9=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xde95[_0x4a3898];return _0x25ceb0;};'use strict';var client=require(_0x5de9('0x0'));exports[_0x5de9('0x1')]=function(_0x21e221){return client['Request']('CreateOpenchannelMessage',{'body':_0x21e221,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d656349..a58ac63 100644 --- a/server/services/routing/rpc/openchannelQueue.js +++ b/server/services/routing/rpc/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bc6=['online','../client','getOpenchannelQueues','Request','User','name'];(function(_0x2fded4,_0x1baa3f){var _0x34ac86=function(_0x40d9c7){while(--_0x40d9c7){_0x2fded4['push'](_0x2fded4['shift']());}};_0x34ac86(++_0x1baa3f);}(_0x2bc6,0x163));var _0x62bc=function(_0x55beda,_0x4b5634){_0x55beda=_0x55beda-0x0;var _0x3f0b5b=_0x2bc6[_0x55beda];return _0x3f0b5b;};'use strict';var client=require(_0x62bc('0x0'));exports[_0x62bc('0x1')]=function(){return function(){return client[_0x62bc('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x62bc('0x3'),'as':'Agents','attributes':['id',_0x62bc('0x4'),_0x62bc('0x5'),'openchannelPause']}]},'log':_0x62bc('0x1')});};}; \ No newline at end of file +var _0x0849=['getOpenchannelQueues','name','timeout','User','Agents','online','../client'];(function(_0xddea0b,_0x4e413c){var _0x44de97=function(_0x33f0c6){while(--_0x33f0c6){_0xddea0b['push'](_0xddea0b['shift']());}};_0x44de97(++_0x4e413c);}(_0x0849,0xca));var _0x9084=function(_0x24ee9b,_0x389de0){_0x24ee9b=_0x24ee9b-0x0;var _0x54c5d1=_0x0849[_0x24ee9b];return _0x54c5d1;};'use strict';var client=require(_0x9084('0x0'));exports[_0x9084('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x9084('0x2'),_0x9084('0x3'),'strategy'],'include':[{'model':_0x9084('0x4'),'as':_0x9084('0x5'),'attributes':['id',_0x9084('0x2'),_0x9084('0x6'),'openchannelPause']}]},'log':_0x9084('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 38a9490..ac3eed4 100644 --- a/server/services/routing/rpc/openchannelQueueReport.js +++ b/server/services/routing/rpc/openchannelQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb138=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x471d46,_0x403ede){var _0x5a9d7f=function(_0x21d9e2){while(--_0x21d9e2){_0x471d46['push'](_0x471d46['shift']());}};_0x5a9d7f(++_0x403ede);}(_0xb138,0x1de));var _0x8b13=function(_0x556b1d,_0xa0f67e){_0x556b1d=_0x556b1d-0x0;var _0x346381=_0xb138[_0x556b1d];return _0x346381;};'use strict';var client=require(_0x8b13('0x0'));exports[_0x8b13('0x1')]=function(_0x22bf8a){return client[_0x8b13('0x2')](_0x8b13('0x3'),{'body':_0x22bf8a,'log':_0x8b13('0x3')});};exports[_0x8b13('0x4')]=function(_0x20282d,_0x1aa56a){return client[_0x8b13('0x2')](_0x8b13('0x5'),{'body':_0x1aa56a,'options':{'where':{'uniqueid':_0x20282d},'order':[['id',_0x8b13('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x2539=['CreateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x1d2009,_0x28ccaf){var _0x2df180=function(_0x27003){while(--_0x27003){_0x1d2009['push'](_0x1d2009['shift']());}};_0x2df180(++_0x28ccaf);}(_0x2539,0x147));var _0x9253=function(_0x3b91a0,_0x39d03d){_0x3b91a0=_0x3b91a0-0x0;var _0x52859a=_0x2539[_0x3b91a0];return _0x52859a;};'use strict';var client=require(_0x9253('0x0'));exports[_0x9253('0x1')]=function(_0x35542a){return client[_0x9253('0x2')](_0x9253('0x3'),{'body':_0x35542a,'log':_0x9253('0x3')});};exports['update']=function(_0x2a18dc,_0xecd5e9){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0xecd5e9,'options':{'where':{'uniqueid':_0x2a18dc},'order':[['id',_0x9253('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 38445b3..efc8e92 100644 --- a/server/services/routing/rpc/smsInteraction.js +++ b/server/services/routing/rpc/smsInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1247=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1247,0xb6));var _0x7124=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0x1247[_0x13c70c];return _0x50f0f2;};'use strict';var client=require(_0x7124('0x0'));exports[_0x7124('0x1')]=function(_0x498325,_0x4d37c0){return client[_0x7124('0x2')](_0x7124('0x3'),{'body':_0x4d37c0,'options':{'where':{'id':_0x498325}},'log':_0x7124('0x4')});};exports['addTags']=function(_0x3bdce3,_0x3ab32e){return client[_0x7124('0x2')](_0x7124('0x5'),{'body':_0x3ab32e,'options':{'where':{'id':_0x3bdce3}},'log':_0x7124('0x6')});}; \ No newline at end of file +var _0xad36=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0xad36,0x11c));var _0x6ad3=function(_0x3da3af,_0x1496ac){_0x3da3af=_0x3da3af-0x0;var _0x57fce9=_0xad36[_0x3da3af];return _0x57fce9;};'use strict';var client=require('../client');exports[_0x6ad3('0x0')]=function(_0x3e139,_0x31d949){return client[_0x6ad3('0x1')](_0x6ad3('0x2'),{'body':_0x31d949,'options':{'where':{'id':_0x3e139}},'log':_0x6ad3('0x3')});};exports[_0x6ad3('0x4')]=function(_0x17a9b2,_0x3d8fee){return client['Request'](_0x6ad3('0x5'),{'body':_0x3d8fee,'options':{'where':{'id':_0x17a9b2}},'log':_0x6ad3('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 167211b..88cfa29 100644 --- a/server/services/routing/rpc/smsMessage.js +++ b/server/services/routing/rpc/smsMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf575=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf575,0x15c));var _0x5f57=function(_0x47b709,_0x5dc3df){_0x47b709=_0x47b709-0x0;var _0x3e1bca=_0xf575[_0x47b709];return _0x3e1bca;};'use strict';var client=require(_0x5f57('0x0'));exports[_0x5f57('0x1')]=function(_0x3daa5d){return client[_0x5f57('0x2')](_0x5f57('0x3'),{'body':_0x3daa5d,'log':_0x5f57('0x4')});}; \ No newline at end of file +var _0x3806=['createSmsMessage','Request'];(function(_0x45e299,_0x37704d){var _0x1a895f=function(_0x5c12ac){while(--_0x5c12ac){_0x45e299['push'](_0x45e299['shift']());}};_0x1a895f(++_0x37704d);}(_0x3806,0x77));var _0x6380=function(_0x5eb1d6,_0x2a79e9){_0x5eb1d6=_0x5eb1d6-0x0;var _0x328f8c=_0x3806[_0x5eb1d6];return _0x328f8c;};'use strict';var client=require('../client');exports['create']=function(_0x4e23cf){return client[_0x6380('0x0')]('CreateSmsMessage',{'body':_0x4e23cf,'log':_0x6380('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 0f25e51..bbeec30 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x20122d,_0x35732d){var _0x35a7db=function(_0x4e1bc1){while(--_0x4e1bc1){_0x20122d['push'](_0x20122d['shift']());}};_0x35a7db(++_0x35732d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x267f2b,_0x139286){var _0x367d07=function(_0x33c247){while(--_0x33c247){_0x267f2b['push'](_0x267f2b['shift']());}};_0x367d07(++_0x139286);}(_0xb7e7,0x121));var _0x7b7e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb7e7[_0x342700];return _0x53406f;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 96da3e9..af978cb 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x41fa2a,_0x2e5c95){var _0x5856a1=function(_0x21f9d8){while(--_0x21f9d8){_0x41fa2a['push'](_0x41fa2a['shift']());}};_0x5856a1(++_0x2e5c95);}(_0x34e8,0x12c));var _0x834e=function(_0x198688,_0x4e2e49){_0x198688=_0x198688-0x0;var _0x5b2e4f=_0x34e8[_0x198688];return _0x5b2e4f;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0xa59b6e,_0x3fd4c8){var _0x578fc3=function(_0x5d7cb6){while(--_0x5d7cb6){_0xa59b6e['push'](_0xa59b6e['shift']());}};_0x578fc3(++_0x3fd4c8);}(_0x55ca,0x126));var _0xa55c=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x55ca[_0x458363];return _0x4d0290;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2e60516..05311a6 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x252ace,_0xf5f2e5){var _0x8ff6c7=function(_0x46ebd0){while(--_0x46ebd0){_0x252ace['push'](_0x252ace['shift']());}};_0x8ff6c7(++_0xf5f2e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x373370,_0x433cda){var _0x7cb97b=function(_0x3e6854){while(--_0x3e6854){_0x373370['push'](_0x373370['shift']());}};_0x7cb97b(++_0x433cda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 787594e..bd7bdcc 100644 --- a/server/services/routing/rpc/whatsappInteraction.js +++ b/server/services/routing/rpc/whatsappInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7046=['addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_0x7046,0x144));var _0x6704=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7046[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x6704('0x0'));exports[_0x6704('0x1')]=function(_0x322b5a,_0x3e2b36){return client['Request'](_0x6704('0x2'),{'body':_0x3e2b36,'options':{'where':{'id':_0x322b5a}},'log':_0x6704('0x3')});};exports[_0x6704('0x4')]=function(_0x5258e7,_0x1e9b2a){return client[_0x6704('0x5')](_0x6704('0x6'),{'body':_0x1e9b2a,'options':{'where':{'id':_0x5258e7}},'log':_0x6704('0x7')});}; \ No newline at end of file +var _0x1a38=['addTagsToWhatsappInteraction','../client','update','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction'];(function(_0x1813d0,_0x3685b1){var _0x485e3d=function(_0x334a02){while(--_0x334a02){_0x1813d0['push'](_0x1813d0['shift']());}};_0x485e3d(++_0x3685b1);}(_0x1a38,0xb0));var _0x81a3=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x1a38[_0xb833b1];return _0x1ab87a;};'use strict';var client=require(_0x81a3('0x0'));exports[_0x81a3('0x1')]=function(_0xfb6477,_0x5eb8e9){return client['Request']('UpdateWhatsappInteraction',{'body':_0x5eb8e9,'options':{'where':{'id':_0xfb6477}},'log':_0x81a3('0x2')});};exports[_0x81a3('0x3')]=function(_0x2faf46,_0x28fd86){return client[_0x81a3('0x4')](_0x81a3('0x5'),{'body':_0x28fd86,'options':{'where':{'id':_0x2faf46}},'log':_0x81a3('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 01bf7ae..08f8c12 100644 --- a/server/services/routing/rpc/whatsappMessage.js +++ b/server/services/routing/rpc/whatsappMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f40=['../client','create','Request','createWhatsappMessage'];(function(_0x39d549,_0x3d3a9f){var _0x3e4016=function(_0x3b4320){while(--_0x3b4320){_0x39d549['push'](_0x39d549['shift']());}};_0x3e4016(++_0x3d3a9f);}(_0x4f40,0xa8));var _0x04f4=function(_0x4cc70b,_0x2575c7){_0x4cc70b=_0x4cc70b-0x0;var _0x3d1822=_0x4f40[_0x4cc70b];return _0x3d1822;};'use strict';var client=require(_0x04f4('0x0'));exports[_0x04f4('0x1')]=function(_0x37792b){return client[_0x04f4('0x2')]('CreateWhatsappMessage',{'body':_0x37792b,'log':_0x04f4('0x3')});}; \ No newline at end of file +var _0x192b=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x61a8a0,_0x3db16b){var _0x1f85d7=function(_0x511493){while(--_0x511493){_0x61a8a0['push'](_0x61a8a0['shift']());}};_0x1f85d7(++_0x3db16b);}(_0x192b,0x1cc));var _0xb192=function(_0x582b12,_0x4a9f8e){_0x582b12=_0x582b12-0x0;var _0x5a362a=_0x192b[_0x582b12];return _0x5a362a;};'use strict';var client=require(_0xb192('0x0'));exports[_0xb192('0x1')]=function(_0x335e4b){return client[_0xb192('0x2')](_0xb192('0x3'),{'body':_0x335e4b,'log':_0xb192('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 361bed7..bf9ff18 100644 --- a/server/services/routing/rpc/whatsappQueue.js +++ b/server/services/routing/rpc/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1ef=['GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0xe1519b,_0x57ffe8){var _0x1e6eba=function(_0x364d41){while(--_0x364d41){_0xe1519b['push'](_0xe1519b['shift']());}};_0x1e6eba(++_0x57ffe8);}(_0xa1ef,0x147));var _0xfa1e=function(_0x348ea7,_0x591405){_0x348ea7=_0x348ea7-0x0;var _0x5eafdf=_0xa1ef[_0x348ea7];return _0x5eafdf;};'use strict';var client=require(_0xfa1e('0x0'));exports[_0xfa1e('0x1')]=function(){return function(){return client[_0xfa1e('0x2')](_0xfa1e('0x3'),{'options':{'raw':![],'attributes':['id',_0xfa1e('0x4'),'timeout',_0xfa1e('0x5')],'include':[{'model':_0xfa1e('0x6'),'as':_0xfa1e('0x7'),'attributes':['id','name',_0xfa1e('0x8'),_0xfa1e('0x9')]}]},'log':_0xfa1e('0x1')});};}; \ No newline at end of file +var _0x390d=['timeout','User','name','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x443f79,_0x33e446){var _0x3847e4=function(_0x42fa01){while(--_0x42fa01){_0x443f79['push'](_0x443f79['shift']());}};_0x3847e4(++_0x33e446);}(_0x390d,0x14d));var _0xd390=function(_0x28eb5a,_0x318185){_0x28eb5a=_0x28eb5a-0x0;var _0x5b71c0=_0x390d[_0x28eb5a];return _0x5b71c0;};'use strict';var client=require(_0xd390('0x0'));exports[_0xd390('0x1')]=function(){return function(){return client[_0xd390('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xd390('0x3'),'strategy'],'include':[{'model':_0xd390('0x4'),'as':'Agents','attributes':['id',_0xd390('0x5'),_0xd390('0x6'),_0xd390('0x7')]}]},'log':_0xd390('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 22842e8..5669246 100644 --- a/server/services/routing/rpc/whatsappQueueReport.js +++ b/server/services/routing/rpc/whatsappQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8dc=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0xf9b961,_0x329dd9){var _0x19b997=function(_0x2c01d7){while(--_0x2c01d7){_0xf9b961['push'](_0xf9b961['shift']());}};_0x19b997(++_0x329dd9);}(_0xc8dc,0xb9));var _0xcc8d=function(_0x54fdd8,_0x2e81ae){_0x54fdd8=_0x54fdd8-0x0;var _0x4f6f8a=_0xc8dc[_0x54fdd8];return _0x4f6f8a;};'use strict';var client=require('../client');exports[_0xcc8d('0x0')]=function(_0x101138){return client[_0xcc8d('0x1')](_0xcc8d('0x2'),{'body':_0x101138,'log':_0xcc8d('0x2')});};exports['update']=function(_0x700fc,_0x380164){return client['Request'](_0xcc8d('0x3'),{'body':_0x380164,'options':{'where':{'uniqueid':_0x700fc},'order':[['id',_0xcc8d('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x299e=['create','Request','CreateWhatsappQueueReport','update','DESC','../client'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0x299e,0xd7));var _0xe299=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x299e[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0xe299('0x0'));exports[_0xe299('0x1')]=function(_0x313a10){return client[_0xe299('0x2')](_0xe299('0x3'),{'body':_0x313a10,'log':'CreateWhatsappQueueReport'});};exports[_0xe299('0x4')]=function(_0x1e5f17,_0x10b2f0){return client[_0xe299('0x2')]('UpdateWhatsappQueueReport',{'body':_0x10b2f0,'options':{'where':{'uniqueid':_0x1e5f17},'order':[['id',_0xe299('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 97d7229..283bd15 100644 --- a/server/services/routing/server/applications/agent.js +++ b/server/services/routing/server/applications/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1eab=['close','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','find','channel','format','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x1eab,0xad));var _0xb1ea=function(_0x35549d,_0x599776){_0x35549d=_0x35549d-0x0;var _0x86dc1f=_0x1eab[_0x35549d];return _0x86dc1f;};'use strict';var schema=require(_0xb1ea('0x0'));var _=require('lodash');var util=require(_0xb1ea('0x1'));var seqqueue=require(_0xb1ea('0x2'));var logger=require(_0xb1ea('0x3'))('routing');var strategy=require(_0xb1ea('0x4'));var queue=schema({'name':{'type':_0xb1ea('0x5'),'required':!![],'message':_0xb1ea('0x6')},'timeout':{'type':_0xb1ea('0x7'),'message':_0xb1ea('0x8')}});function writeLog(_0xcd0e09,_0x3f58ab,_0x4edb8f){return logger[_0xb1ea('0x9')](util['format'](_0xb1ea('0xa'),_0xcd0e09,_0x3f58ab[_0xb1ea('0xb')],_0x4edb8f));}function handleFindAgent(_0x100b10){return function(_0x36dfa2){return _0x36dfa2[_0xb1ea('0xb')][_0xb1ea('0xc')]()===_0x100b10[_0xb1ea('0xc')]();};}exports['consequence']=function(_0x17d993,_0x419616,_0x2bc539,_0x4cb288){return function(_0x304ace){try{var _0xa7015c={'name':_0x419616[0x0],'timeout':_0x419616[0x1]};var _0x281208=queue[_0xb1ea('0x0')](_0xa7015c,{'typecast':!![]});if(_0x281208[_0xb1ea('0xd')]){logger[_0xb1ea('0xe')](_0xb1ea('0xf'),_0x17d993,_[_0xb1ea('0x10')](_0x281208,_0xb1ea('0x11'))[_0xb1ea('0x12')](',\x20'));_0x304ace['stop']();}else{var _0x25fc8f=_[_0xb1ea('0x13')](_0x2bc539['agents'],handleFindAgent(_0xa7015c[_0xb1ea('0xb')]));if(_0x25fc8f){var _0x2f6cbb=(_0xa7015c['timeout']||0xa)*0x3e8;var _0xd3b1b7,_0x1d835f;var _0x2c3b7a=seqqueue['createQueue'](_0x2f6cbb);_0x2c3b7a['id']=_0x17d993;_0x2c3b7a['atimeout']=_0x2f6cbb;_0x2c3b7a[_0xb1ea('0x14')]=_0x4cb288['channel'];writeLog(_0x17d993,_0x25fc8f,util[_0xb1ea('0x15')](_0xb1ea('0x16'),_0x2f6cbb));_0x2bc539['rules'][_0x17d993]['on'](_0xb1ea('0x17'),function(){logger[_0xb1ea('0x9')](_0xb1ea('0x18'),_0x17d993);clearTimeout(_0x1d835f);_0x1d835f=undefined;_0x2c3b7a[_0xb1ea('0x19')]();if(_0x2bc539[_0xb1ea('0x1a')][_0x17d993]){delete _0x2bc539[_0xb1ea('0x1a')][_0x17d993];}_0x304ace[_0xb1ea('0x1b')]();});_0x2bc539[_0xb1ea('0x1a')][_0x17d993]['on'](_0xb1ea('0x1c'),function(){if(_0x2bc539[_0xb1ea('0x1a')][_0x17d993]){delete _0x2bc539[_0xb1ea('0x1a')][_0x17d993];}});_0x1d835f=setTimeout(function(){logger[_0xb1ea('0x9')](_0xb1ea('0x1d'),_0x17d993);clearTimeout(_0x1d835f);_0x2c3b7a[_0xb1ea('0x19')]();_0x304ace[_0xb1ea('0x1e')]();},_0x2f6cbb);strategy['agent'](_0x2c3b7a,_0x25fc8f,_0x2bc539,_0x4cb288);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x17d993,_0xa7015c[_0xb1ea('0xb')]);_0x304ace['stop']();}}}catch(_0x49c910){console['log'](_0x49c910);logger[_0xb1ea('0xe')](_0xb1ea('0x1f'),_0x17d993,_0x49c910[_0xb1ea('0x20')]);_0x304ace['stop']();}};}; \ No newline at end of file +var _0x5a26=['agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','name','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','createQueue','atimeout','channel','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete'];(function(_0x46b22a,_0x5bf83a){var _0x44c2e8=function(_0x21b6fc){while(--_0x21b6fc){_0x46b22a['push'](_0x46b22a['shift']());}};_0x44c2e8(++_0x5bf83a);}(_0x5a26,0x165));var _0x65a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a26[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x65a2('0x0'));var _=require(_0x65a2('0x1'));var util=require('util');var seqqueue=require(_0x65a2('0x2'));var logger=require(_0x65a2('0x3'))(_0x65a2('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x65a2('0x5')},'timeout':{'type':_0x65a2('0x6'),'message':_0x65a2('0x7')}});function writeLog(_0x1a3056,_0x4de9a0,_0x5a6fd8){return logger['info'](util[_0x65a2('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1a3056,_0x4de9a0[_0x65a2('0x9')],_0x5a6fd8));}function handleFindAgent(_0x530f8c){return function(_0x3ef77f){return _0x3ef77f[_0x65a2('0x9')]['toLowerCase']()===_0x530f8c['toLowerCase']();};}exports['consequence']=function(_0x58a332,_0x31c0e0,_0xd9115c,_0x5903f8){return function(_0x586d67){try{var _0x8b22ab={'name':_0x31c0e0[0x0],'timeout':_0x31c0e0[0x1]};var _0x34d15e=queue[_0x65a2('0x0')](_0x8b22ab,{'typecast':!![]});if(_0x34d15e[_0x65a2('0xa')]){logger[_0x65a2('0xb')](_0x65a2('0xc'),_0x58a332,_[_0x65a2('0xd')](_0x34d15e,_0x65a2('0xe'))[_0x65a2('0xf')](',\x20'));_0x586d67[_0x65a2('0x10')]();}else{var _0x3afca5=_[_0x65a2('0x11')](_0xd9115c['agents'],handleFindAgent(_0x8b22ab[_0x65a2('0x9')]));if(_0x3afca5){var _0x38d8ab=(_0x8b22ab['timeout']||0xa)*0x3e8;var _0x21e8c6,_0x4b5344;var _0x4881a4=seqqueue[_0x65a2('0x12')](_0x38d8ab);_0x4881a4['id']=_0x58a332;_0x4881a4[_0x65a2('0x13')]=_0x38d8ab;_0x4881a4[_0x65a2('0x14')]=_0x5903f8[_0x65a2('0x14')];writeLog(_0x58a332,_0x3afca5,util[_0x65a2('0x8')]('START:%s',_0x38d8ab));_0xd9115c[_0x65a2('0x15')][_0x58a332]['on'](_0x65a2('0x16'),function(){logger[_0x65a2('0x17')](_0x65a2('0x18'),_0x58a332);clearTimeout(_0x4b5344);_0x4b5344=undefined;_0x4881a4[_0x65a2('0x19')]();if(_0xd9115c['rules'][_0x58a332]){delete _0xd9115c['rules'][_0x58a332];}_0x586d67[_0x65a2('0x10')]();});_0xd9115c[_0x65a2('0x15')][_0x58a332]['on'](_0x65a2('0x1a'),function(){if(_0xd9115c[_0x65a2('0x15')][_0x58a332]){delete _0xd9115c[_0x65a2('0x15')][_0x58a332];}});_0x4b5344=setTimeout(function(){logger[_0x65a2('0x17')]('[%s][AGENT]\x20ROUTING\x20END',_0x58a332);clearTimeout(_0x4b5344);_0x4881a4[_0x65a2('0x19')]();_0x586d67['next']();},_0x38d8ab);strategy[_0x65a2('0x1b')](_0x4881a4,_0x3afca5,_0xd9115c,_0x5903f8);}else{logger[_0x65a2('0xb')](_0x65a2('0x1c'),_0x58a332,_0x8b22ab['name']);_0x586d67[_0x65a2('0x10')]();}}}catch(_0x2d22c4){console[_0x65a2('0x1d')](_0x2d22c4);logger['error'](_0x65a2('0x1e'),_0x58a332,_0x2d22c4[_0x65a2('0x1f')]);_0x586d67['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 13529af..36a98d7 100644 --- a/server/services/routing/server/applications/amazonlex.js +++ b/server/services/routing/server/applications/amazonlex.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f29=['providerName','providerResponse','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','message','amazonlex'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0x9f29,0x1eb));var _0x99f2=function(_0x596995,_0xbcdbec){_0x596995=_0x596995-0x0;var _0x564675=_0x9f29[_0x596995];return _0x564675;};'use strict';var _=require(_0x99f2('0x0'));var moment=require(_0x99f2('0x1'));var AWS=require(_0x99f2('0x2'));var utils=require(_0x99f2('0x3'));var logger=require(_0x99f2('0x4'))(_0x99f2('0x5'));var rpc={'chatMessage':require(_0x99f2('0x6')),'openchannelMessage':require(_0x99f2('0x7')),'mailMessage':require(_0x99f2('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x99f2('0x9')),'whatsappMessage':require(_0x99f2('0xa'))};exports[_0x99f2('0xb')]=function(_0x2d98df,_0x53bd3e){return function(_0x33a365){try{if(!_[_0x99f2('0xc')](this[_0x99f2('0xd')][_0x99f2('0xe')])){logger[_0x99f2('0xf')](_0x99f2('0x10'),_0x2d98df,_0x99f2('0x11'));return _0x33a365[_0x99f2('0x12')]();}var _0x383dc5={'ContactId':this['contact']['id'],'sentAt':moment()[_0x99f2('0x13')](_0x99f2('0x14')),'direction':_0x99f2('0x15')};if(this['channel']===_0x99f2('0x16')||this[_0x99f2('0x17')]==='whatsapp'){_0x383dc5['phone']=this[_0x99f2('0xd')][_0x99f2('0x18')];}var _0x5ed9fd=this[_0x99f2('0x17')];if(_0x5ed9fd===_0x99f2('0x19')){_0x383dc5[_0x99f2('0x1a')]=this[_0x99f2('0x1b')]['id'];}else{_0x383dc5[_[_0x99f2('0x1c')](_0x5ed9fd)+'AccountId']=this['account']['id'];}_0x383dc5[_[_0x99f2('0x1c')](_0x5ed9fd)+_0x99f2('0x1d')]=this['interaction']['id'];if(this[_0x99f2('0xd')][_0x99f2('0x1e')]){var _0xed57b7=_0x53bd3e[0x4];if(!_[_0x99f2('0x1f')](_0xed57b7)){_0x383dc5[_0x99f2('0x20')]=utils[_0x99f2('0x21')](_0xed57b7,this);return rpc[_0x5ed9fd+_0x99f2('0x22')][_0x99f2('0x23')](_0x383dc5)['then'](function(_0x566112){logger[_0x99f2('0xf')]('[%s][AMAZONLEX]\x20%s',_0x2d98df,_0x383dc5[_0x99f2('0x20')]);})[_0x99f2('0x24')](function(_0x464852){logger[_0x99f2('0x25')]('[%s][AMAZONLEX]\x20%s',_0x2d98df,JSON[_0x99f2('0x26')](_0x464852));})[_0x99f2('0x27')](function(){logger[_0x99f2('0xf')](_0x99f2('0x28'),_0x2d98df);_0x33a365[_0x99f2('0x29')]();});}else{logger[_0x99f2('0xf')](_0x99f2('0x2a'),_0x2d98df);_0x33a365[_0x99f2('0x29')]();}}else{var _0x42cbb6=this;var _0x5713cf=new AWS[(_0x99f2('0x2b'))]({'accessKeyId':_0x53bd3e[0x0],'secretAccessKey':_0x53bd3e[0x1],'region':_0x53bd3e[0x2]});var _0x1c0f96={'botAlias':_0x99f2('0x2c'),'botName':_0x53bd3e[0x3],'inputText':this['message']['body'],'userId':this[_0x99f2('0x17')]+':'+this[_0x99f2('0xd')]['id'][_0x99f2('0x2d')]()};_0x5713cf[_0x99f2('0x2e')](_0x1c0f96,function(_0x16704d,_0x1d2f16){if(_0x16704d){logger['error'](_0x99f2('0x10'),_0x2d98df,_0x16704d[_0x99f2('0x2f')]);_0x33a365['next']();}else if(_0x1d2f16&&_0x1d2f16[_0x99f2('0x2f')]){_0x42cbb6[_0x99f2('0x20')][_0x99f2('0x30')]=_0x1d2f16;_0x383dc5[_0x99f2('0x20')]=_0x1d2f16['message'];_0x383dc5[_0x99f2('0x31')]=_0x99f2('0x30');_0x383dc5[_0x99f2('0x32')]=JSON[_0x99f2('0x26')](_0x1d2f16);return rpc[_0x5ed9fd+_0x99f2('0x22')]['create'](_0x383dc5)[_0x99f2('0x33')](function(_0x4a55ff){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2d98df,_0x383dc5[_0x99f2('0x20')]);if(_0x1d2f16[_0x99f2('0x34')]==_0x99f2('0x35')){_0x33a365[_0x99f2('0x12')]();}else{_0x33a365['stop']();}})[_0x99f2('0x24')](function(_0x4b7ef1){logger['error'](_0x99f2('0x10'),_0x2d98df,JSON['stringify'](_0x4b7ef1));_0x33a365['next']();});}else{_0x33a365[_0x99f2('0x12')]();}});}}catch(_0x12c5cd){logger[_0x99f2('0x25')](_0x99f2('0x10'),_0x2d98df,JSON[_0x99f2('0x26')](_0x12c5cd));_0x33a365[_0x99f2('0x29')]();}};}; \ No newline at end of file +var _0xa2b6=['isEmpty','body','create','then','catch','stringify','finally','stop','LexRuntime','$LATEST','message','toString','error','amazonlex','providerName','Message','dialogState','Failed','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','created'];(function(_0x2d83e3,_0x1413da){var _0x29eb0f=function(_0x29fa1b){while(--_0x29fa1b){_0x2d83e3['push'](_0x2d83e3['shift']());}};_0x29eb0f(++_0x1413da);}(_0xa2b6,0xc2));var _0x6a2b=function(_0x49faf,_0x327df2){_0x49faf=_0x49faf-0x0;var _0x3ce6cd=_0xa2b6[_0x49faf];return _0x3ce6cd;};'use strict';var _=require(_0x6a2b('0x0'));var moment=require(_0x6a2b('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x6a2b('0x2'))(_0x6a2b('0x3'));var rpc={'chatMessage':require(_0x6a2b('0x4')),'openchannelMessage':require(_0x6a2b('0x5')),'mailMessage':require(_0x6a2b('0x6')),'smsMessage':require(_0x6a2b('0x7')),'faxMessage':require(_0x6a2b('0x8')),'whatsappMessage':require(_0x6a2b('0x9'))};exports['consequence']=function(_0x425319,_0x3ea002){return function(_0x385769){try{if(!_['isNil'](this[_0x6a2b('0xa')]['UserId'])){logger[_0x6a2b('0xb')](_0x6a2b('0xc'),_0x425319,_0x6a2b('0xd'));return _0x385769[_0x6a2b('0xe')]();}var _0xc3a64d={'ContactId':this[_0x6a2b('0xf')]['id'],'sentAt':moment()['format'](_0x6a2b('0x10')),'direction':_0x6a2b('0x11')};if(this[_0x6a2b('0x12')]===_0x6a2b('0x13')||this[_0x6a2b('0x12')]==='whatsapp'){_0xc3a64d[_0x6a2b('0x14')]=this['interaction'][_0x6a2b('0x14')];}var _0x3134f7=this['channel'];if(_0x3134f7==='chat'){_0xc3a64d[_0x6a2b('0x15')]=this[_0x6a2b('0x16')]['id'];}else{_0xc3a64d[_[_0x6a2b('0x17')](_0x3134f7)+_0x6a2b('0x18')]=this[_0x6a2b('0x16')]['id'];}_0xc3a64d[_[_0x6a2b('0x17')](_0x3134f7)+'InteractionId']=this['interaction']['id'];if(this[_0x6a2b('0xa')][_0x6a2b('0x19')]){var _0x221699=_0x3ea002[0x4];if(!_[_0x6a2b('0x1a')](_0x221699)){_0xc3a64d[_0x6a2b('0x1b')]=utils['getMustacheRender'](_0x221699,this);return rpc[_0x3134f7+'Message'][_0x6a2b('0x1c')](_0xc3a64d)[_0x6a2b('0x1d')](function(_0x1e0818){logger[_0x6a2b('0xb')](_0x6a2b('0xc'),_0x425319,_0xc3a64d[_0x6a2b('0x1b')]);})[_0x6a2b('0x1e')](function(_0x314123){logger['error'](_0x6a2b('0xc'),_0x425319,JSON[_0x6a2b('0x1f')](_0x314123));})[_0x6a2b('0x20')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x425319);_0x385769[_0x6a2b('0x21')]();});}else{logger[_0x6a2b('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x425319);_0x385769[_0x6a2b('0x21')]();}}else{var _0x26adfd=this;var _0x1920a8=new AWS[(_0x6a2b('0x22'))]({'accessKeyId':_0x3ea002[0x0],'secretAccessKey':_0x3ea002[0x1],'region':_0x3ea002[0x2]});var _0x312ddd={'botAlias':_0x6a2b('0x23'),'botName':_0x3ea002[0x3],'inputText':this[_0x6a2b('0x24')][_0x6a2b('0x1b')],'userId':this[_0x6a2b('0x12')]+':'+this[_0x6a2b('0xa')]['id'][_0x6a2b('0x25')]()};_0x1920a8['postText'](_0x312ddd,function(_0x20f7d5,_0x5ee767){if(_0x20f7d5){logger[_0x6a2b('0x26')]('[%s][AMAZONLEX]\x20%s',_0x425319,_0x20f7d5[_0x6a2b('0x24')]);_0x385769[_0x6a2b('0xe')]();}else if(_0x5ee767&&_0x5ee767[_0x6a2b('0x24')]){_0x26adfd[_0x6a2b('0x1b')][_0x6a2b('0x27')]=_0x5ee767;_0xc3a64d[_0x6a2b('0x1b')]=_0x5ee767[_0x6a2b('0x24')];_0xc3a64d[_0x6a2b('0x28')]=_0x6a2b('0x27');_0xc3a64d['providerResponse']=JSON[_0x6a2b('0x1f')](_0x5ee767);return rpc[_0x3134f7+_0x6a2b('0x29')][_0x6a2b('0x1c')](_0xc3a64d)[_0x6a2b('0x1d')](function(_0x17e169){logger['info'](_0x6a2b('0xc'),_0x425319,_0xc3a64d[_0x6a2b('0x1b')]);if(_0x5ee767[_0x6a2b('0x2a')]==_0x6a2b('0x2b')){_0x385769[_0x6a2b('0xe')]();}else{_0x385769[_0x6a2b('0x21')]();}})[_0x6a2b('0x1e')](function(_0x5a0900){logger['error'](_0x6a2b('0xc'),_0x425319,JSON[_0x6a2b('0x1f')](_0x5a0900));_0x385769['next']();});}else{_0x385769[_0x6a2b('0xe')]();}});}}catch(_0x404ea0){logger['error'](_0x6a2b('0xc'),_0x425319,JSON[_0x6a2b('0x1f')](_0x404ea0));_0x385769[_0x6a2b('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index c7a0152..721f301 100644 --- a/server/services/routing/server/applications/autoreply.js +++ b/server/services/routing/server/applications/autoreply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9ff=['interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','channel','chat','account','upperFirst','InteractionId','Message','messageId','html','','replace','';_0x28b26b[_0xfd9f('0x31')]={'Auto-Submitted':_0xfd9f('0x32'),'X-Auto-Response-Suppress':_0xfd9f('0x33'),'Precedence':_0xfd9f('0x34')};return mailRpc['sendMailMessage'](this[_0xfd9f('0x28')][_0xfd9f('0x35')],_0x28b26b)[_0xfd9f('0x36')](function(_0x250365){logger['info'](_0xfd9f('0x37'),_0x55080d);_0x28b26b['messageId']=_0x250365[_0xfd9f('0x1e')]['messageId'];return rpc[_0x3ba2ed+_0xfd9f('0x2b')][_0xfd9f('0x38')](_0x28b26b);})[_0xfd9f('0x36')](function(_0x3cbf2a){logger[_0xfd9f('0x10')](_0xfd9f('0x15'),_0x55080d,JSON[_0xfd9f('0x39')](_0x3cbf2a));})[_0xfd9f('0x3a')](function(_0x485fda){logger[_0xfd9f('0x3b')](_0xfd9f('0x3c'),_0x55080d,JSON['stringify'](_0x485fda));})['finally'](function(){Promise[_0xfd9f('0x3d')]()[_0xfd9f('0x36')](function(){if(_0xa06d29[0x0]!=='2'||_0xd30c06[_0xfd9f('0x17')])return;return rpc[_0x3ba2ed+_0xfd9f('0x3e')]['update'](_0xd30c06['id'],{'autoreplyExecuted':!![]})['then'](function(_0x45b5ce){logger[_0xfd9f('0x10')](_0xfd9f('0x18'),_0x55080d,JSON[_0xfd9f('0x39')](_0x45b5ce));})[_0xfd9f('0x3a')](function(_0x59e1d3){logger[_0xfd9f('0x3b')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x55080d,JSON[_0xfd9f('0x39')](_0x59e1d3));});})[_0xfd9f('0x36')](function(){_0x15e312[_0xfd9f('0x12')]();});});}else{return rpc[this[_0xfd9f('0x26')]+_0xfd9f('0x2b')][_0xfd9f('0x38')](_0x28b26b)['then'](function(){logger[_0xfd9f('0x10')](_0xfd9f('0x15'),_0x55080d,_0x28b26b[_0xfd9f('0xe')]);})[_0xfd9f('0x3a')](function(_0x6dcd9c){logger[_0xfd9f('0x3b')](_0xfd9f('0x15'),_0x55080d,JSON['stringify'](_0x6dcd9c));})[_0xfd9f('0x3f')](function(){Promise[_0xfd9f('0x3d')]()['then'](function(){if(_0xa06d29[0x0]!=='2'||_0xd30c06[_0xfd9f('0x17')])return;return rpc[_0x3ba2ed+_0xfd9f('0x3e')]['update'](_0xd30c06['id'],{'autoreplyExecuted':!![]})[_0xfd9f('0x36')](function(_0x4aecc8){logger[_0xfd9f('0x10')](_0xfd9f('0x18'),_0x55080d,JSON[_0xfd9f('0x39')](_0x4aecc8));})['catch'](function(_0x33351a){logger[_0xfd9f('0x3b')](_0xfd9f('0x40'),_0x55080d,JSON[_0xfd9f('0x39')](_0x33351a));});})[_0xfd9f('0x36')](function(){_0x15e312[_0xfd9f('0x12')]();});});}}}catch(_0x573260){logger[_0xfd9f('0x3b')](_0xfd9f('0x15'),_0x55080d,JSON['stringify'](_0x573260));_0x15e312[_0xfd9f('0x41')]();}};}; \ No newline at end of file +var _0xf94f=['update','catch','resolve','autoreplyExecuted','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','messageId','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','Interaction'];(function(_0x258802,_0x253d57){var _0x2d3222=function(_0x22a5b5){while(--_0x22a5b5){_0x258802['push'](_0x258802['shift']());}};_0x2d3222(++_0x253d57);}(_0xf94f,0xda));var _0xff94=function(_0x184190,_0x58a277){_0x184190=_0x184190-0x0;var _0x643117=_0xf94f[_0x184190];return _0x643117;};'use strict';var _=require(_0xff94('0x0'));var moment=require('moment');var utils=require(_0xff94('0x1'));var logger=require(_0xff94('0x2'))(_0xff94('0x3'));var rpc={'chatMessage':require(_0xff94('0x4')),'openchannelMessage':require(_0xff94('0x5')),'mailMessage':require(_0xff94('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xff94('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xff94('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xff94('0x9')),'smsInteraction':require(_0xff94('0xa')),'faxInteraction':require(_0xff94('0xb')),'whatsappInteraction':require(_0xff94('0xc'))};var mailRpc=require(_0xff94('0xd'));exports[_0xff94('0xe')]=function(_0x2a8639,_0x4d94cb,_0x4ae20a,_0x5ebb2f){return function(_0x3db16d){try{var _0x24ac8d=this[_0xff94('0xf')];if(_0x24ac8d===_0xff94('0x10')&&_0x5ebb2f[_0xff94('0x11')][_0xff94('0x12')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x2a8639,_0xff94('0x13'));return _0x3db16d[_0xff94('0x14')]();}if(_0x4d94cb[0x0]==='1'&&(_[_0xff94('0x15')](this[_0xff94('0x16')][_0xff94('0x17')])||!this[_0xff94('0x16')][_0xff94('0x17')])){logger[_0xff94('0x18')](_0xff94('0x19'),_0x2a8639,'Autoreply\x20already\x20sent');return _0x3db16d[_0xff94('0x14')]();}if(_0x4d94cb[0x0]==='2'&&this[_0xff94('0x16')]['autoreplyExecuted']){logger['info'](_0xff94('0x1a'),_0x2a8639,_0xff94('0x1b'));return _0x3db16d[_0xff94('0x14')]();}var _0x37f712={'ContactId':this['contact']['id'],'sentAt':moment()[_0xff94('0x1c')](_0xff94('0x1d')),'direction':_0xff94('0x1e')};if(this[_0xff94('0xf')]===_0xff94('0x10')){_0x37f712['body']=utils[_0xff94('0x1f')](_0x4d94cb[0x2],this);}else{_0x37f712['body']=utils[_0xff94('0x1f')](_0x4d94cb[0x1],this);}if(this['message']){_0x37f712['to']=this[_0xff94('0x20')][_0xff94('0x21')]||'';if(this[_0xff94('0xf')]===_0xff94('0x10')&&_0x4d94cb[0x1]==='1'){_0x37f712['cc']=this[_0xff94('0x20')]['cc']||'';}_0x37f712[_0xff94('0x21')]=this[_0xff94('0x20')]['to']||'';_0x37f712[_0xff94('0x22')]=this[_0xff94('0x20')]['phone']||'';_0x37f712[_0xff94('0x23')]=!![];if(this['message'][_0xff94('0x24')]){_0x37f712['subject']='';_0x37f712['subject']+=_[_0xff94('0x25')](this[_0xff94('0x20')][_0xff94('0x24')],_0xff94('0x26'))?'':_0xff94('0x27');_0x37f712[_0xff94('0x24')]+=this[_0xff94('0x20')][_0xff94('0x24')];}}if(this['channel']===_0xff94('0x28')){_0x37f712['ChatWebsiteId']=this[_0xff94('0x29')]['id'];}else{_0x37f712[_[_0xff94('0x2a')](this[_0xff94('0xf')])+_0xff94('0x2b')]=this['account']['id'];}_0x37f712[_[_0xff94('0x2a')](this['channel'])+_0xff94('0x2c')]=this[_0xff94('0x16')]['id'];var _0xeb27ef=this['interaction'];if(rpc[this[_0xff94('0xf')]+_0xff94('0x2d')]){if(this['channel']===_0xff94('0x10')){_0x37f712['inReplyTo']=this[_0xff94('0x20')][_0xff94('0x2e')];_0x37f712['html']=_0xff94('0x2f')+_[_0xff94('0x30')](_0x37f712[_0xff94('0x11')],_0xff94('0x31'),_0xff94('0x32'))+_0xff94('0x33');_0x37f712[_0xff94('0x34')]={'Auto-Submitted':_0xff94('0x35'),'X-Auto-Response-Suppress':_0xff94('0x36'),'Precedence':_0xff94('0x37')};return mailRpc[_0xff94('0x38')](this[_0xff94('0x29')][_0xff94('0x39')],_0x37f712)[_0xff94('0x3a')](function(_0x6a4c1e){logger['info'](_0xff94('0x3b'),_0x2a8639);_0x37f712[_0xff94('0x2e')]=_0x6a4c1e['message'][_0xff94('0x2e')];return rpc[_0x24ac8d+_0xff94('0x2d')][_0xff94('0x3c')](_0x37f712);})[_0xff94('0x3a')](function(_0x206e77){logger['info'](_0xff94('0x19'),_0x2a8639,JSON['stringify'](_0x206e77));})['catch'](function(_0x10768e){logger[_0xff94('0x3d')](_0xff94('0x3e'),_0x2a8639,JSON[_0xff94('0x3f')](_0x10768e));})[_0xff94('0x40')](function(){Promise['resolve']()['then'](function(){if(_0x4d94cb[0x0]!=='2'||_0xeb27ef['autoreplyExecuted'])return;return rpc[_0x24ac8d+_0xff94('0x41')][_0xff94('0x42')](_0xeb27ef['id'],{'autoreplyExecuted':!![]})[_0xff94('0x3a')](function(_0x10359c){logger[_0xff94('0x18')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2a8639,JSON['stringify'](_0x10359c));})[_0xff94('0x43')](function(_0x1be228){logger[_0xff94('0x3d')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2a8639,JSON[_0xff94('0x3f')](_0x1be228));});})['then'](function(){_0x3db16d['next']();});});}else{return rpc[this[_0xff94('0xf')]+'Message'][_0xff94('0x3c')](_0x37f712)['then'](function(){logger[_0xff94('0x18')]('[%s][AUTOREPLY]\x20%s',_0x2a8639,_0x37f712[_0xff94('0x11')]);})[_0xff94('0x43')](function(_0x48895d){logger[_0xff94('0x3d')](_0xff94('0x19'),_0x2a8639,JSON[_0xff94('0x3f')](_0x48895d));})['finally'](function(){Promise[_0xff94('0x44')]()[_0xff94('0x3a')](function(){if(_0x4d94cb[0x0]!=='2'||_0xeb27ef[_0xff94('0x45')])return;return rpc[_0x24ac8d+'Interaction'][_0xff94('0x42')](_0xeb27ef['id'],{'autoreplyExecuted':!![]})[_0xff94('0x3a')](function(_0x2f9cf1){logger[_0xff94('0x18')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2a8639,JSON['stringify'](_0x2f9cf1));})[_0xff94('0x43')](function(_0xf8d444){logger[_0xff94('0x3d')](_0xff94('0x46'),_0x2a8639,JSON[_0xff94('0x3f')](_0xf8d444));});})[_0xff94('0x3a')](function(){_0x3db16d[_0xff94('0x14')]();});});}}}catch(_0x1f9bc8){logger[_0xff94('0x3d')]('[%s][AUTOREPLY]\x20%s',_0x2a8639,JSON[_0xff94('0x3f')](_0x1f9bc8));_0x3db16d['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 8072df5..d9e716b 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c35=['../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x0c35,0xc0));var _0x50c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0c35[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x50c3('0x0'));var logger=require(_0x50c3('0x1'))(_0x50c3('0x2'));var rpc={'chatInteraction':require(_0x50c3('0x3')),'openchannelInteraction':require(_0x50c3('0x4')),'smsInteraction':require(_0x50c3('0x5')),'mailInteraction':require(_0x50c3('0x6')),'faxInteraction':require(_0x50c3('0x7')),'whatsappInteraction':require(_0x50c3('0x8'))};exports[_0x50c3('0x9')]=function(_0x2a0e83,_0x3fd681,_0x518b4c,_0x2b8407){return function(_0x13d092){try{logger['info'](_0x50c3('0xa'),_0x2a0e83,_0x3fd681[0x0]);var _0x317811={'closed':0x1,'closedAt':moment()[_0x50c3('0xb')](_0x50c3('0xc')),'closeReason':'system','disposition':_0x3fd681[0x0]};if(rpc[_0x2b8407[_0x50c3('0xd')]+'Interaction']){rpc[_0x2b8407[_0x50c3('0xd')]+_0x50c3('0xe')]['update'](_0x2b8407[_0x50c3('0xf')]['id'],_0x317811)[_0x50c3('0x10')](function(_0x49e9f2){logger[_0x50c3('0x11')](_0x50c3('0x12'),_0x2a0e83,_0x2b8407[_0x50c3('0xf')]['id']);})[_0x50c3('0x13')](function(_0x4e447d){logger[_0x50c3('0x14')]('[%s][CLOSE]\x20%s',_0x2a0e83,JSON[_0x50c3('0x15')](_0x4e447d));})[_0x50c3('0x16')](function(){_0x13d092[_0x50c3('0x17')]();});}}catch(_0x1cca96){logger[_0x50c3('0x14')](_0x50c3('0x18'),_0x2a0e83,JSON[_0x50c3('0x15')](_0x1cca96));_0x13d092[_0x50c3('0x17')]();}};}; \ No newline at end of file +var _0x3ce0=['../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','channel','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop'];(function(_0x2f9af1,_0x5e3b6a){var _0x3aad5a=function(_0x284c46){while(--_0x284c46){_0x2f9af1['push'](_0x2f9af1['shift']());}};_0x3aad5a(++_0x5e3b6a);}(_0x3ce0,0xcf));var _0x03ce=function(_0x7caf39,_0x34fe33){_0x7caf39=_0x7caf39-0x0;var _0x23585c=_0x3ce0[_0x7caf39];return _0x23585c;};'use strict';var moment=require('moment');var logger=require(_0x03ce('0x0'))(_0x03ce('0x1'));var rpc={'chatInteraction':require(_0x03ce('0x2')),'openchannelInteraction':require(_0x03ce('0x3')),'smsInteraction':require(_0x03ce('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x03ce('0x5'))};exports[_0x03ce('0x6')]=function(_0x30db23,_0xcd3711,_0x1c34a9,_0x24e5e1){return function(_0xf6f09b){try{logger[_0x03ce('0x7')](_0x03ce('0x8'),_0x30db23,_0xcd3711[0x0]);var _0x1eb6f2={'closed':0x1,'closedAt':moment()[_0x03ce('0x9')](_0x03ce('0xa')),'closeReason':'system','disposition':_0xcd3711[0x0]};if(rpc[_0x24e5e1['channel']+_0x03ce('0xb')]){rpc[_0x24e5e1[_0x03ce('0xc')]+'Interaction'][_0x03ce('0xd')](_0x24e5e1['interaction']['id'],_0x1eb6f2)[_0x03ce('0xe')](function(_0x4d7e76){logger[_0x03ce('0x7')](_0x03ce('0xf'),_0x30db23,_0x24e5e1[_0x03ce('0x10')]['id']);})[_0x03ce('0x11')](function(_0x111f20){logger[_0x03ce('0x12')](_0x03ce('0x13'),_0x30db23,JSON[_0x03ce('0x14')](_0x111f20));})[_0x03ce('0x15')](function(){_0xf6f09b[_0x03ce('0x16')]();});}}catch(_0x32b132){logger[_0x03ce('0x12')](_0x03ce('0x13'),_0x30db23,JSON[_0x03ce('0x14')](_0x32b132));_0xf6f09b[_0x03ce('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index e673552..64f1823 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbff5=['metadata','error','catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','format','out','sms','channel','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','created','isEmpty','body','getMustacheRender','create','then','info','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','speech','providerName','dialogflow','providerResponse','Message'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xbff5,0x1bc));var _0x5bff=function(_0x5465a0,_0x580d9a){_0x5465a0=_0x5465a0-0x0;var _0x15dfbb=_0xbff5[_0x5465a0];return _0x15dfbb;};'use strict';var _=require(_0x5bff('0x0'));var moment=require(_0x5bff('0x1'));var apiai=require(_0x5bff('0x2'));var md5=require(_0x5bff('0x3'));var utils=require(_0x5bff('0x4'));var logger=require(_0x5bff('0x5'))(_0x5bff('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5bff('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5bff('0x8')),'whatsappMessage':require(_0x5bff('0x9'))};exports[_0x5bff('0xa')]=function(_0xa54c57,_0x43605a){return function(_0xd4b9dc){try{if(!_[_0x5bff('0xb')](this[_0x5bff('0xc')][_0x5bff('0xd')])){logger['info'](_0x5bff('0xe'),_0xa54c57,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xd4b9dc[_0x5bff('0xf')]();}var _0x40b806={'ContactId':this['contact']['id'],'sentAt':moment()[_0x5bff('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5bff('0x11')};if(this['channel']===_0x5bff('0x12')||this[_0x5bff('0x13')]==='whatsapp'){_0x40b806[_0x5bff('0x14')]=this['interaction'][_0x5bff('0x14')];}var _0x635926=this['channel'];if(_0x635926===_0x5bff('0x15')){_0x40b806[_0x5bff('0x16')]=this['account']['id'];}else{_0x40b806[_['upperFirst'](_0x635926)+_0x5bff('0x17')]=this[_0x5bff('0x18')]['id'];}_0x40b806[_[_0x5bff('0x19')](_0x635926)+'InteractionId']=this[_0x5bff('0xc')]['id'];if(this[_0x5bff('0xc')][_0x5bff('0x1a')]){var _0x56c7b2=_0x43605a[0x2];if(!_[_0x5bff('0x1b')](_0x56c7b2)){_0x40b806[_0x5bff('0x1c')]=utils[_0x5bff('0x1d')](_0x56c7b2,this);return rpc[_0x635926+'Message'][_0x5bff('0x1e')](_0x40b806)[_0x5bff('0x1f')](function(_0x36653b){logger[_0x5bff('0x20')]('[%s][DIALOGFLOW]\x20%s',_0xa54c57,_0x40b806[_0x5bff('0x1c')]);})['catch'](function(_0x878040){logger['error'](_0x5bff('0xe'),_0xa54c57,JSON[_0x5bff('0x21')](_0x878040));})[_0x5bff('0x22')](function(){logger[_0x5bff('0x20')](_0x5bff('0x23'),_0xa54c57);_0xd4b9dc[_0x5bff('0x24')]();});}else{logger[_0x5bff('0x20')](_0x5bff('0x25'),_0xa54c57);_0xd4b9dc[_0x5bff('0x24')]();}}else{var _0x490bc1=this;var _0x5f2593=apiai(_0x43605a[0x0],{'language':_0x43605a[0x1]||'en'});return _0x5f2593[_0x5bff('0x26')](this[_0x5bff('0x27')][_0x5bff('0x1c')],{'sessionId':md5(this[_0x5bff('0xc')]['id'])})[_0x5bff('0x1f')](function(_0x3913fd){_0x490bc1[_0x5bff('0x1c')]['dialogflow']=_0x3913fd;_0x40b806['body']=_0x3913fd[_0x5bff('0x28')]['fulfillment'][_0x5bff('0x29')];_0x40b806[_0x5bff('0x2a')]=_0x5bff('0x2b');_0x40b806[_0x5bff('0x2c')]=JSON[_0x5bff('0x21')](_0x3913fd);return rpc[_0x635926+_0x5bff('0x2d')][_0x5bff('0x1e')](_0x40b806)[_0x5bff('0x1f')](function(_0x5a4e82){logger['info'](_0x5bff('0xe'),_0xa54c57,_0x40b806[_0x5bff('0x1c')]);if(_0x3913fd['result'][_0x5bff('0x2e')]['endConversation']){_0xd4b9dc['next']();}else{_0xd4b9dc[_0x5bff('0x24')]();}})['catch'](function(_0x3ed23b){logger[_0x5bff('0x2f')](_0x5bff('0xe'),_0xa54c57,JSON[_0x5bff('0x21')](_0x3ed23b));_0xd4b9dc['next']();});})[_0x5bff('0x30')](function(_0x4ee6f1){logger[_0x5bff('0x2f')]('[%s][DIALOGFLOW]\x20%s',_0xa54c57,_0x4ee6f1[_0x5bff('0x27')]);_0xd4b9dc[_0x5bff('0xf')]();});}}catch(_0x293513){logger[_0x5bff('0x2f')](_0x5bff('0xe'),_0xa54c57,JSON[_0x5bff('0x21')](_0x293513));_0xd4b9dc['stop']();}};}; \ No newline at end of file +var _0x74af=['Message','create','then','body','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','fulfillment','speech','providerName','providerResponse','stringify','result','metadata','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','account','AccountId','InteractionId','created','isEmpty'];(function(_0x37b86d,_0x3a3702){var _0x559494=function(_0x4a1038){while(--_0x4a1038){_0x37b86d['push'](_0x37b86d['shift']());}};_0x559494(++_0x3a3702);}(_0x74af,0x178));var _0xf74a=function(_0x40469b,_0x37da85){_0x40469b=_0x40469b-0x0;var _0x47fa10=_0x74af[_0x40469b];return _0x47fa10;};'use strict';var _=require(_0xf74a('0x0'));var moment=require(_0xf74a('0x1'));var apiai=require(_0xf74a('0x2'));var md5=require(_0xf74a('0x3'));var utils=require(_0xf74a('0x4'));var logger=require(_0xf74a('0x5'))('routing');var rpc={'chatMessage':require(_0xf74a('0x6')),'openchannelMessage':require(_0xf74a('0x7')),'mailMessage':require(_0xf74a('0x8')),'smsMessage':require(_0xf74a('0x9')),'faxMessage':require(_0xf74a('0xa')),'whatsappMessage':require(_0xf74a('0xb'))};exports[_0xf74a('0xc')]=function(_0x543438,_0x32601f){return function(_0x444108){try{if(!_[_0xf74a('0xd')](this[_0xf74a('0xe')][_0xf74a('0xf')])){logger[_0xf74a('0x10')](_0xf74a('0x11'),_0x543438,_0xf74a('0x12'));return _0x444108[_0xf74a('0x13')]();}var _0x15c591={'ContactId':this[_0xf74a('0x14')]['id'],'sentAt':moment()[_0xf74a('0x15')](_0xf74a('0x16')),'direction':_0xf74a('0x17')};if(this[_0xf74a('0x18')]==='sms'||this[_0xf74a('0x18')]==='whatsapp'){_0x15c591[_0xf74a('0x19')]=this[_0xf74a('0xe')][_0xf74a('0x19')];}var _0x1e58b4=this[_0xf74a('0x18')];if(_0x1e58b4===_0xf74a('0x1a')){_0x15c591['ChatWebsiteId']=this[_0xf74a('0x1b')]['id'];}else{_0x15c591[_['upperFirst'](_0x1e58b4)+_0xf74a('0x1c')]=this[_0xf74a('0x1b')]['id'];}_0x15c591[_['upperFirst'](_0x1e58b4)+_0xf74a('0x1d')]=this[_0xf74a('0xe')]['id'];if(this[_0xf74a('0xe')][_0xf74a('0x1e')]){var _0x5820b2=_0x32601f[0x2];if(!_[_0xf74a('0x1f')](_0x5820b2)){_0x15c591['body']=utils['getMustacheRender'](_0x5820b2,this);return rpc[_0x1e58b4+_0xf74a('0x20')][_0xf74a('0x21')](_0x15c591)[_0xf74a('0x22')](function(_0x5e3a30){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x543438,_0x15c591[_0xf74a('0x23')]);})[_0xf74a('0x24')](function(_0x226afb){logger[_0xf74a('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x543438,JSON['stringify'](_0x226afb));})[_0xf74a('0x26')](function(){logger['info'](_0xf74a('0x27'),_0x543438);_0x444108[_0xf74a('0x28')]();});}else{logger[_0xf74a('0x10')](_0xf74a('0x29'),_0x543438);_0x444108[_0xf74a('0x28')]();}}else{var _0x402b2a=this;var _0x32c37c=apiai(_0x32601f[0x0],{'language':_0x32601f[0x1]||'en'});return _0x32c37c['textRequest'](this[_0xf74a('0x2a')]['body'],{'sessionId':md5(this[_0xf74a('0xe')]['id'])})[_0xf74a('0x22')](function(_0x2a57d3){_0x402b2a[_0xf74a('0x23')][_0xf74a('0x2b')]=_0x2a57d3;_0x15c591[_0xf74a('0x23')]=_0x2a57d3['result'][_0xf74a('0x2c')][_0xf74a('0x2d')];_0x15c591[_0xf74a('0x2e')]=_0xf74a('0x2b');_0x15c591[_0xf74a('0x2f')]=JSON[_0xf74a('0x30')](_0x2a57d3);return rpc[_0x1e58b4+_0xf74a('0x20')][_0xf74a('0x21')](_0x15c591)[_0xf74a('0x22')](function(_0x5cc49d){logger[_0xf74a('0x10')](_0xf74a('0x11'),_0x543438,_0x15c591['body']);if(_0x2a57d3[_0xf74a('0x31')][_0xf74a('0x32')]['endConversation']){_0x444108[_0xf74a('0x13')]();}else{_0x444108['stop']();}})[_0xf74a('0x24')](function(_0x515b42){logger[_0xf74a('0x25')](_0xf74a('0x11'),_0x543438,JSON[_0xf74a('0x30')](_0x515b42));_0x444108[_0xf74a('0x13')]();});})['catch'](function(_0x5b165e){logger['error'](_0xf74a('0x11'),_0x543438,_0x5b165e['message']);_0x444108[_0xf74a('0x13')]();});}}catch(_0x11278a){logger['error'](_0xf74a('0x11'),_0x543438,JSON[_0xf74a('0x30')](_0x11278a));_0x444108[_0xf74a('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index e8f7ddf..a3e131a 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25d5=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','Message','then','catch','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','error','lodash','md5','bluebird'];(function(_0x17c4ae,_0x4d56cb){var _0x411db8=function(_0x5c541b){while(--_0x5c541b){_0x17c4ae['push'](_0x17c4ae['shift']());}};_0x411db8(++_0x4d56cb);}(_0x25d5,0x91));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x525d('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x525d('0x1'));var moment=require('moment');var Promise=require(_0x525d('0x2'));var logger=require(_0x525d('0x3'))(_0x525d('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x525d('0x5')),'openchannelMessage':require(_0x525d('0x6')),'mailMessage':require(_0x525d('0x7')),'smsMessage':require(_0x525d('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x525d('0x9'))};function createMessage(_0x273141,_0x1a0233,_0x260f76,_0x289b02){return new Promise(function(_0x119257,_0xd3a9f4){var _0xd6be48=_[_0x525d('0xa')](_0x260f76);_0xd6be48['body']=_0x289b02;return rpc[_0x1a0233+_0x525d('0xb')]['create'](_0xd6be48)[_0x525d('0xc')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x273141,_0xd6be48['body']);_0x119257();})[_0x525d('0xd')](function(_0x3ea30e){logger['error'](_0x525d('0xe'),_0x273141,JSON[_0x525d('0xf')](_0x3ea30e));_0xd3a9f4(_0x3ea30e);});});}exports[_0x525d('0x10')]=function(_0x56b3ce,_0x1a23c7){return function(_0x1fc306){try{if(!_[_0x525d('0x11')](this[_0x525d('0x12')]['UserId'])){logger[_0x525d('0x13')](_0x525d('0xe'),_0x56b3ce,_0x525d('0x14'));return _0x1fc306[_0x525d('0x15')]();}var _0x39f756={'ContactId':this[_0x525d('0x16')]['id'],'sentAt':moment()[_0x525d('0x17')](_0x525d('0x18')),'direction':'out'};if(this['channel']===_0x525d('0x19')||this[_0x525d('0x1a')]===_0x525d('0x1b')){_0x39f756[_0x525d('0x1c')]=this[_0x525d('0x12')][_0x525d('0x1c')];}var _0x53325b=this[_0x525d('0x1a')];if(_0x53325b===_0x525d('0x1d')){_0x39f756[_0x525d('0x1e')]=this[_0x525d('0x1f')]['id'];}else{_0x39f756[_[_0x525d('0x20')](_0x53325b)+_0x525d('0x21')]=this['account']['id'];}_0x39f756[_[_0x525d('0x20')](_0x53325b)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x525d('0x22')]){var _0x5a18f8=_0x1a23c7[0x4];if(!_[_0x525d('0x23')](_0x5a18f8)){_0x39f756[_0x525d('0x24')]=utils[_0x525d('0x25')](_0x5a18f8,this);return rpc[_0x53325b+_0x525d('0xb')][_0x525d('0x26')](_0x39f756)['then'](function(_0x291cc3){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x56b3ce,_0x39f756[_0x525d('0x24')]);})[_0x525d('0xd')](function(_0x5322ea){logger['error'](_0x525d('0xe'),_0x56b3ce,JSON['stringify'](_0x5322ea));})[_0x525d('0x27')](function(){logger[_0x525d('0x13')](_0x525d('0x28'),_0x56b3ce);_0x1fc306[_0x525d('0x29')]();});}else{logger[_0x525d('0x13')](_0x525d('0x2a'),_0x56b3ce);_0x1fc306[_0x525d('0x29')]();}}else{var _0x589e42=this;var _0x3a4886=_0x1a23c7[0x2]['replace'](/\\n/g,'\x0a');var _0x1d70cb={'credentials':{'private_key':_0x3a4886,'client_email':_0x1a23c7[0x1]}};var _0x1aaf92=new dialogflow['SessionsClient'](_0x1d70cb);var _0x54856d=_0x1aaf92[_0x525d('0x2b')](_0x1a23c7[0x0],md5(_0x589e42['interaction']['id']));var _0x3e6eb8={'session':_0x54856d,'queryInput':{'text':{'text':_0x589e42[_0x525d('0x2c')][_0x525d('0x24')],'languageCode':_0x1a23c7[0x3]||'en'}}};return _0x1aaf92[_0x525d('0x2d')](_0x3e6eb8)['then'](function(_0x574ae9){if(_0x574ae9&&_0x574ae9[_0x525d('0x2e')]){_0x589e42[_0x525d('0x24')][_0x525d('0x2f')]=_0x574ae9;var _0x3ce7d3=_0x574ae9[0x0];var _0x3cecd5=_0x3ce7d3[_0x525d('0x30')][_0x525d('0x31')]&&_0x3ce7d3[_0x525d('0x30')][_0x525d('0x31')]['fields']?_0x3ce7d3[_0x525d('0x30')]['diagnosticInfo'][_0x525d('0x32')]['end_conversation'][_0x525d('0x33')]:![];_0x589e42['body'][_0x525d('0x34')]=_0x3ce7d3[_0x525d('0x30')][_0x525d('0x35')];_0x589e42['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x3ce7d3[_0x525d('0x30')][_0x525d('0x36')];_0x589e42[_0x525d('0x24')][_0x525d('0x37')]=_0x3ce7d3[_0x525d('0x30')][_0x525d('0x31')]&&_0x3ce7d3['queryResult'][_0x525d('0x31')][_0x525d('0x32')]?_0x3ce7d3[_0x525d('0x30')][_0x525d('0x31')][_0x525d('0x32')][_0x525d('0x38')][_0x525d('0x33')]:![];_0x589e42[_0x525d('0x24')][_0x525d('0x39')]=_0x3ce7d3[_0x525d('0x30')]['intent'][_0x525d('0x3a')];_0x589e42[_0x525d('0x24')][_0x525d('0x3b')]=_0x3ce7d3[_0x525d('0x30')][_0x525d('0x3c')][_0x525d('0x3d')];_0x589e42[_0x525d('0x24')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x3ce7d3[_0x525d('0x30')][_0x525d('0x3c')][_0x525d('0x3e')];_0x589e42[_0x525d('0x24')][_0x525d('0x3f')]=_0x3ce7d3[_0x525d('0x30')][_0x525d('0x40')];_0x589e42[_0x525d('0x24')][_0x525d('0x41')]=_0x3ce7d3[_0x525d('0x30')][_0x525d('0x42')];_0x589e42['body'][_0x525d('0x43')]=_0x3ce7d3[_0x525d('0x30')]['intentDetectionConfidence'];_0x39f756[_0x525d('0x44')]=_0x525d('0x2f');_0x39f756[_0x525d('0x45')]=JSON[_0x525d('0xf')](_0x574ae9);var _0x4a2e21=[];for(var _0x5adad8=0x0;_0x5adad8<_0x574ae9[_0x525d('0x2e')];_0x5adad8++){var _0x11159e=_0x574ae9[_0x5adad8];if(_0x11159e&&_0x11159e['queryResult']&&_0x11159e[_0x525d('0x30')][_0x525d('0x46')]){_0x4a2e21[_0x525d('0x47')](createMessage(_0x56b3ce,_0x53325b,_0x39f756,_0x11159e[_0x525d('0x30')]['fulfillmentText']));}}return Promise[_0x525d('0x48')](_0x4a2e21)[_0x525d('0xc')](function(){if(_0x3cecd5){_0x1fc306[_0x525d('0x15')]();}else{_0x1fc306['stop']();}})['catch'](function(_0x4787f2){logger['error'](_0x525d('0xe'),_0x56b3ce,JSON[_0x525d('0xf')](_0x4787f2));_0x1fc306[_0x525d('0x15')]();});}})[_0x525d('0xd')](function(_0x13e6a7){logger[_0x525d('0x49')]('[%s][DIALOGFLOWV2]\x20%s',_0x56b3ce,_0x13e6a7[_0x525d('0x2c')]);_0x1fc306[_0x525d('0x15')]();});}}catch(_0x472a6a){logger[_0x525d('0x49')](_0x525d('0xe'),_0x56b3ce,JSON['stringify'](_0x472a6a));_0x1fc306[_0x525d('0x29')]();}};}; \ No newline at end of file +var _0x0f3c=['chat','ChatWebsiteId','account','upperFirst','InteractionId','isEmpty','getMustacheRender','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','push','message','lodash','dialogflow','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','info','catch','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0f3c,0x189));var _0xc0f3=function(_0x160d0d,_0x1e15e8){_0x160d0d=_0x160d0d-0x0;var _0xe9d470=_0x0f3c[_0x160d0d];return _0xe9d470;};'use strict';var _=require(_0xc0f3('0x0'));var dialogflow=require(_0xc0f3('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require('bluebird');var logger=require(_0xc0f3('0x2'))(_0xc0f3('0x3'));var utils=require(_0xc0f3('0x4'));var rpc={'chatMessage':require(_0xc0f3('0x5')),'openchannelMessage':require(_0xc0f3('0x6')),'mailMessage':require(_0xc0f3('0x7')),'smsMessage':require(_0xc0f3('0x8')),'faxMessage':require(_0xc0f3('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x37d939,_0x2c517e,_0x48fc5d,_0x435864){return new Promise(function(_0x399c29,_0x5dd244){var _0x1fa4f9=_[_0xc0f3('0xa')](_0x48fc5d);_0x1fa4f9[_0xc0f3('0xb')]=_0x435864;return rpc[_0x2c517e+_0xc0f3('0xc')][_0xc0f3('0xd')](_0x1fa4f9)[_0xc0f3('0xe')](function(){logger[_0xc0f3('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x37d939,_0x1fa4f9[_0xc0f3('0xb')]);_0x399c29();})[_0xc0f3('0x10')](function(_0xadc11a){logger['error'](_0xc0f3('0x11'),_0x37d939,JSON[_0xc0f3('0x12')](_0xadc11a));_0x5dd244(_0xadc11a);});});}exports[_0xc0f3('0x13')]=function(_0x125e58,_0x5c6ff2){return function(_0x46eeb4){try{if(!_[_0xc0f3('0x14')](this[_0xc0f3('0x15')][_0xc0f3('0x16')])){logger[_0xc0f3('0xf')](_0xc0f3('0x11'),_0x125e58,_0xc0f3('0x17'));return _0x46eeb4[_0xc0f3('0x18')]();}var _0x63efe4={'ContactId':this[_0xc0f3('0x19')]['id'],'sentAt':moment()[_0xc0f3('0x1a')](_0xc0f3('0x1b')),'direction':_0xc0f3('0x1c')};if(this['channel']===_0xc0f3('0x1d')||this[_0xc0f3('0x1e')]===_0xc0f3('0x1f')){_0x63efe4[_0xc0f3('0x20')]=this[_0xc0f3('0x15')]['phone'];}var _0x3c4218=this[_0xc0f3('0x1e')];if(_0x3c4218===_0xc0f3('0x21')){_0x63efe4[_0xc0f3('0x22')]=this[_0xc0f3('0x23')]['id'];}else{_0x63efe4[_[_0xc0f3('0x24')](_0x3c4218)+'AccountId']=this[_0xc0f3('0x23')]['id'];}_0x63efe4[_['upperFirst'](_0x3c4218)+_0xc0f3('0x25')]=this[_0xc0f3('0x15')]['id'];if(this[_0xc0f3('0x15')]['created']){var _0x37a752=_0x5c6ff2[0x4];if(!_[_0xc0f3('0x26')](_0x37a752)){_0x63efe4['body']=utils[_0xc0f3('0x27')](_0x37a752,this);return rpc[_0x3c4218+_0xc0f3('0xc')][_0xc0f3('0xd')](_0x63efe4)['then'](function(_0x58f2b2){logger[_0xc0f3('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x125e58,_0x63efe4[_0xc0f3('0xb')]);})[_0xc0f3('0x10')](function(_0x2d6cea){logger[_0xc0f3('0x28')](_0xc0f3('0x11'),_0x125e58,JSON[_0xc0f3('0x12')](_0x2d6cea));})[_0xc0f3('0x29')](function(){logger[_0xc0f3('0xf')](_0xc0f3('0x2a'),_0x125e58);_0x46eeb4[_0xc0f3('0x2b')]();});}else{logger[_0xc0f3('0xf')](_0xc0f3('0x2c'),_0x125e58);_0x46eeb4[_0xc0f3('0x2b')]();}}else{var _0x43532d=this;var _0x11e7b9=_0x5c6ff2[0x2]['replace'](/\\n/g,'\x0a');var _0x1dc591={'credentials':{'private_key':_0x11e7b9,'client_email':_0x5c6ff2[0x1]}};var _0x459246=new dialogflow[(_0xc0f3('0x2d'))](_0x1dc591);var _0x4f2e88=_0x459246[_0xc0f3('0x2e')](_0x5c6ff2[0x0],md5(_0x43532d['interaction']['id']));var _0x4edb85={'session':_0x4f2e88,'queryInput':{'text':{'text':_0x43532d['message'][_0xc0f3('0xb')],'languageCode':_0x5c6ff2[0x3]||'en'}}};return _0x459246[_0xc0f3('0x2f')](_0x4edb85)['then'](function(_0x4d5e0b){if(_0x4d5e0b&&_0x4d5e0b[_0xc0f3('0x30')]){_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x31')]=_0x4d5e0b;var _0x1e732c=_0x4d5e0b[0x0];var _0xe830cb=_0x1e732c['queryResult'][_0xc0f3('0x32')]&&_0x1e732c[_0xc0f3('0x33')]['diagnosticInfo'][_0xc0f3('0x34')]?_0x1e732c[_0xc0f3('0x33')]['diagnosticInfo'][_0xc0f3('0x34')][_0xc0f3('0x35')][_0xc0f3('0x36')]:![];_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x37')]=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x38')];_0x43532d['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x1e732c['queryResult'][_0xc0f3('0x39')];_0x43532d['body'][_0xc0f3('0x3a')]=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x32')]&&_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x32')][_0xc0f3('0x34')]?_0x1e732c['queryResult'][_0xc0f3('0x32')][_0xc0f3('0x34')][_0xc0f3('0x35')]['boolValue']:![];_0x43532d[_0xc0f3('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x3b')]['name'];_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x3c')]=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x3b')][_0xc0f3('0x3d')];_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x3e')]=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x3b')][_0xc0f3('0x3f')];_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x40')]=_0x1e732c[_0xc0f3('0x33')]['languageCode'];_0x43532d[_0xc0f3('0xb')]['DIALOGFLOWV2_QUERYTEXT']=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x41')];_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x42')]=_0x1e732c['queryResult'][_0xc0f3('0x43')];_0x63efe4['providerName']=_0xc0f3('0x31');_0x63efe4[_0xc0f3('0x44')]=JSON['stringify'](_0x4d5e0b);var _0x568d21=[];for(var _0x341f9c=0x0;_0x341f9c<_0x4d5e0b[_0xc0f3('0x30')];_0x341f9c++){var _0x1268c3=_0x4d5e0b[_0x341f9c];if(_0x1268c3&&_0x1268c3[_0xc0f3('0x33')]&&_0x1268c3[_0xc0f3('0x33')]['fulfillmentText']){_0x568d21[_0xc0f3('0x45')](createMessage(_0x125e58,_0x3c4218,_0x63efe4,_0x1268c3[_0xc0f3('0x33')]['fulfillmentText']));}}return Promise['all'](_0x568d21)[_0xc0f3('0xe')](function(){if(_0xe830cb){_0x46eeb4[_0xc0f3('0x18')]();}else{_0x46eeb4[_0xc0f3('0x2b')]();}})[_0xc0f3('0x10')](function(_0x2c7d9d){logger[_0xc0f3('0x28')](_0xc0f3('0x11'),_0x125e58,JSON[_0xc0f3('0x12')](_0x2c7d9d));_0x46eeb4[_0xc0f3('0x18')]();});}})['catch'](function(_0x5e1cd5){logger[_0xc0f3('0x28')](_0xc0f3('0x11'),_0x125e58,_0x5e1cd5[_0xc0f3('0x46')]);_0x46eeb4[_0xc0f3('0x18')]();});}}catch(_0x2fdebc){logger[_0xc0f3('0x28')](_0xc0f3('0x11'),_0x125e58,JSON[_0xc0f3('0x12')](_0x2fdebc));_0x46eeb4['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 248d350..7718cec 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32b9=['getMustacheRender','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString'];(function(_0x174e61,_0x46aed1){var _0x42798f=function(_0x33fec0){while(--_0x33fec0){_0x174e61['push'](_0x174e61['shift']());}};_0x42798f(++_0x46aed1);}(_0x32b9,0x1b0));var _0x932b=function(_0xbcd129,_0x34f162){_0xbcd129=_0xbcd129-0x0;var _0x3a95c8=_0x32b9[_0xbcd129];return _0x3a95c8;};'use strict';var schema=require(_0x932b('0x0'));var _=require(_0x932b('0x1'));var htmlToText=require(_0x932b('0x2'));var utils=require(_0x932b('0x3'));var logger=require('../../../../config/logger')(_0x932b('0x4'));var gotoif=schema({'condition':{'type':_0x932b('0x5'),'required':!![],'message':_0x932b('0x6')},'priorityTrue':{'type':'number','message':_0x932b('0x7')},'priorityFalse':{'type':'number','message':_0x932b('0x8')}});exports['consequence']=function(_0x93c142,_0x20f583){return function(_0x5c5407){try{var _0x212b9c={'condition':htmlToText[_0x932b('0x9')](utils[_0x932b('0xa')](_0x20f583[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x20f583[0x1],'priorityFalse':_0x20f583[0x2]};var _0x2eb870=gotoif[_0x932b('0x0')](_0x212b9c,{'typecast':!![]});if(_0x2eb870['length']){logger['error']('[%s][GOTOIF]\x20%s',_0x93c142,_['map'](_0x2eb870,_0x932b('0xb'))[_0x932b('0xc')](',\x20'));_0x5c5407[_0x932b('0xd')]();}else{try{var _0x2f9264=eval('('+_0x212b9c[_0x932b('0xe')]+')');var _0x128fbb=_0x2f9264?_0x212b9c[_0x932b('0xf')]:_0x212b9c[_0x932b('0x10')];logger[_0x932b('0x11')](_0x932b('0x12'),_0x93c142,_0x212b9c[_0x932b('0xe')],_0x2f9264,_0x128fbb||_0x932b('0x13'));if(_0x128fbb){var _0x408c01=_[_0x932b('0x14')](_0x5c5407['rules'](),{'p':_0x128fbb});if(_0x408c01>=0x0){logger['info'](_0x932b('0x15'),_0x93c142,_0x128fbb||'next',_0x408c01);_0x5c5407['next'](_0x408c01);}else{logger[_0x932b('0x11')](_0x932b('0x16'),_0x93c142,_0x128fbb||_0x932b('0x13'));_0x5c5407['stop']();}}else{_0x5c5407['next']();}}catch(_0x5eb229){logger[_0x932b('0x17')](_0x932b('0x18'),_0x93c142,_0x5eb229[_0x932b('0xb')]);_0x5c5407[_0x932b('0xd')]();}}}catch(_0x4b335a){logger[_0x932b('0x17')]('[%s][GOTOIF]\x20%s',_0x93c142,JSON[_0x932b('0x19')](_0x4b335a));_0x5c5407['stop']();}};}; \ No newline at end of file +var _0xd48f=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','stop','condition','priorityTrue','priorityFalse','next','findIndex','rules','info'];(function(_0x2e2ebd,_0x294539){var _0x1c0f8b=function(_0x8f78cf){while(--_0x8f78cf){_0x2e2ebd['push'](_0x2e2ebd['shift']());}};_0x1c0f8b(++_0x294539);}(_0xd48f,0xf6));var _0xfd48=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xd48f[_0x8a969d];return _0x1d8dc7;};'use strict';var schema=require(_0xfd48('0x0'));var _=require(_0xfd48('0x1'));var htmlToText=require(_0xfd48('0x2'));var utils=require(_0xfd48('0x3'));var logger=require(_0xfd48('0x4'))(_0xfd48('0x5'));var gotoif=schema({'condition':{'type':_0xfd48('0x6'),'required':!![],'message':_0xfd48('0x7')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xfd48('0x8'),'message':_0xfd48('0x9')}});exports[_0xfd48('0xa')]=function(_0x2b1f34,_0x1ab846){return function(_0x5df777){try{var _0x1fc65f={'condition':htmlToText[_0xfd48('0xb')](utils[_0xfd48('0xc')](_0x1ab846[0x0],this),{'wordwrap':![]})[_0xfd48('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1ab846[0x1],'priorityFalse':_0x1ab846[0x2]};var _0x2b4ab1=gotoif[_0xfd48('0x0')](_0x1fc65f,{'typecast':!![]});if(_0x2b4ab1[_0xfd48('0xe')]){logger['error'](_0xfd48('0xf'),_0x2b1f34,_['map'](_0x2b4ab1,'message')['join'](',\x20'));_0x5df777[_0xfd48('0x10')]();}else{try{var _0x269906=eval('('+_0x1fc65f[_0xfd48('0x11')]+')');var _0x24b011=_0x269906?_0x1fc65f[_0xfd48('0x12')]:_0x1fc65f[_0xfd48('0x13')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x2b1f34,_0x1fc65f[_0xfd48('0x11')],_0x269906,_0x24b011||_0xfd48('0x14'));if(_0x24b011){var _0x11753d=_[_0xfd48('0x15')](_0x5df777[_0xfd48('0x16')](),{'p':_0x24b011});if(_0x11753d>=0x0){logger[_0xfd48('0x17')](_0xfd48('0x18'),_0x2b1f34,_0x24b011||_0xfd48('0x14'),_0x11753d);_0x5df777['next'](_0x11753d);}else{logger[_0xfd48('0x17')](_0xfd48('0x19'),_0x2b1f34,_0x24b011||'next');_0x5df777[_0xfd48('0x10')]();}}else{_0x5df777[_0xfd48('0x14')]();}}catch(_0x2d7837){logger[_0xfd48('0x1a')](_0xfd48('0x1b'),_0x2b1f34,_0x2d7837[_0xfd48('0x1c')]);_0x5df777[_0xfd48('0x10')]();}}}catch(_0x1b37d7){logger[_0xfd48('0x1a')]('[%s][GOTOIF]\x20%s',_0x2b1f34,JSON[_0xfd48('0x1d')](_0x1b37d7));_0x5df777[_0xfd48('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index c40125f..d64593a 100644 --- a/server/services/routing/server/applications/gotop.js +++ b/server/services/routing/server/applications/gotop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3893=['validate','lodash','../../../../config/logger','routing','number','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','findIndex','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify'];(function(_0x13795,_0x2c18b7){var _0x2f2d95=function(_0x28eaaf){while(--_0x28eaaf){_0x13795['push'](_0x13795['shift']());}};_0x2f2d95(++_0x2c18b7);}(_0x3893,0x1ed));var _0x3389=function(_0x42e9c2,_0xf71604){_0x42e9c2=_0x42e9c2-0x0;var _0x1e7c80=_0x3893[_0x42e9c2];return _0x1e7c80;};'use strict';var schema=require(_0x3389('0x0'));var _=require(_0x3389('0x1'));var logger=require(_0x3389('0x2'))(_0x3389('0x3'));var gotop=schema({'priority':{'type':_0x3389('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x365e55,_0x3630e7){return function(_0x13beb3){try{var _0x426051={'priority':_0x3630e7[0x0]};var _0x3915fd=gotop[_0x3389('0x0')](_0x426051,{'typecast':!![]});if(_0x3915fd[_0x3389('0x5')]){logger[_0x3389('0x6')](_0x3389('0x7'),_0x365e55,_[_0x3389('0x8')](_0x3915fd,'message')[_0x3389('0x9')](',\x20'));_0x13beb3[_0x3389('0xa')]();}else{logger[_0x3389('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x365e55,_0x426051['priority']);if(_0x426051['priority']){var _0x18d0cf=_[_0x3389('0xc')](_0x13beb3['rules'](),{'p':_0x426051[_0x3389('0xd')]});if(_0x18d0cf>=0x0){logger[_0x3389('0xb')](_0x3389('0xe'),_0x365e55,_0x426051[_0x3389('0xd')]||_0x3389('0xf'),_0x18d0cf);_0x13beb3[_0x3389('0xf')](_0x18d0cf);}else{logger[_0x3389('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x365e55,_0x426051['priority']||'next');_0x13beb3['stop']();}}else{_0x13beb3['next']();}}}catch(_0x533aa3){logger[_0x3389('0x6')](_0x3389('0x7'),_0x365e55,JSON[_0x3389('0x10')](_0x533aa3));_0x13beb3[_0x3389('0xa')]();}};}; \ No newline at end of file +var _0x92c3=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x92c3,0xa6));var _0x392c=function(_0x1fa220,_0x5004c5){_0x1fa220=_0x1fa220-0x0;var _0x58eafb=_0x92c3[_0x1fa220];return _0x58eafb;};'use strict';var schema=require(_0x392c('0x0'));var _=require(_0x392c('0x1'));var logger=require(_0x392c('0x2'))(_0x392c('0x3'));var gotop=schema({'priority':{'type':_0x392c('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x392c('0x5')]=function(_0x412bbc,_0xed407d){return function(_0x4e979d){try{var _0x37ffda={'priority':_0xed407d[0x0]};var _0xe6f45b=gotop[_0x392c('0x0')](_0x37ffda,{'typecast':!![]});if(_0xe6f45b[_0x392c('0x6')]){logger[_0x392c('0x7')](_0x392c('0x8'),_0x412bbc,_[_0x392c('0x9')](_0xe6f45b,_0x392c('0xa'))[_0x392c('0xb')](',\x20'));_0x4e979d[_0x392c('0xc')]();}else{logger[_0x392c('0xd')](_0x392c('0xe'),_0x412bbc,_0x37ffda[_0x392c('0xf')]);if(_0x37ffda[_0x392c('0xf')]){var _0x4a55ea=_[_0x392c('0x10')](_0x4e979d[_0x392c('0x11')](),{'p':_0x37ffda[_0x392c('0xf')]});if(_0x4a55ea>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x412bbc,_0x37ffda[_0x392c('0xf')]||'next',_0x4a55ea);_0x4e979d[_0x392c('0x12')](_0x4a55ea);}else{logger[_0x392c('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x412bbc,_0x37ffda['priority']||_0x392c('0x12'));_0x4e979d[_0x392c('0xc')]();}}else{_0x4e979d['next']();}}}catch(_0x15caaa){logger[_0x392c('0x7')](_0x392c('0x8'),_0x412bbc,JSON[_0x392c('0x13')](_0x15caaa));_0x4e979d[_0x392c('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index bcba563..9e910d2 100644 --- a/server/services/routing/server/applications/message.js +++ b/server/services/routing/server/applications/message.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e21=['chat','account','upperFirst','InteractionId','Message','create','then','catch','error','stringify','stop','[%s][MESSAGE]\x20%s','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','channel'];(function(_0x5a6a1c,_0xb802eb){var _0x132a0e=function(_0x4c3280){while(--_0x4c3280){_0x5a6a1c['push'](_0x5a6a1c['shift']());}};_0x132a0e(++_0xb802eb);}(_0x0e21,0xe8));var _0x10e2=function(_0x4db330,_0x4150dc){_0x4db330=_0x4db330-0x0;var _0xbdba2b=_0x0e21[_0x4db330];return _0xbdba2b;};'use strict';var _=require('lodash');var utils=require(_0x10e2('0x0'));var logger=require(_0x10e2('0x1'))(_0x10e2('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x10e2('0x3')),'mailMessage':require(_0x10e2('0x4')),'smsMessage':require(_0x10e2('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x10e2('0x6')]=function(_0x340513,_0x2fb9e4){return function(_0x44e30e){try{var _0x4e1687={'body':utils[_0x10e2('0x7')](_0x2fb9e4[0x0],this),'ContactId':this[_0x10e2('0x8')]['id']};if(this[_0x10e2('0x9')]===_0x10e2('0xa')){_0x4e1687['ChatWebsiteId']=this[_0x10e2('0xb')]['id'];}else{_0x4e1687[_['upperFirst'](this['channel'])+'AccountId']=this[_0x10e2('0xb')]['id'];}_0x4e1687[_[_0x10e2('0xc')](this['channel'])+_0x10e2('0xd')]=this['interaction']['id'];if(rpc[this[_0x10e2('0x9')]+_0x10e2('0xe')]){return rpc[this[_0x10e2('0x9')]+'Message'][_0x10e2('0xf')](_0x4e1687)[_0x10e2('0x10')](function(_0x411688){logger['info']('[%s][MESSAGE]\x20%s',_0x340513,_0x4e1687['body']);_0x44e30e['next']();})[_0x10e2('0x11')](function(_0x14568a){logger[_0x10e2('0x12')]('[%s][MESSAGE]\x20%s',_0x340513,JSON[_0x10e2('0x13')](_0x14568a));_0x44e30e[_0x10e2('0x14')]();});}}catch(_0x1d6f9d){logger[_0x10e2('0x12')](_0x10e2('0x15'),_0x340513,JSON[_0x10e2('0x13')](_0x1d6f9d));_0x44e30e['stop']();}};}; \ No newline at end of file +var _0x56ff=['[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','contact','channel','ChatWebsiteId','upperFirst','AccountId','account','interaction','Message','create','then','info'];(function(_0x3c9161,_0x106ab4){var _0x25dbf4=function(_0x595c49){while(--_0x595c49){_0x3c9161['push'](_0x3c9161['shift']());}};_0x25dbf4(++_0x106ab4);}(_0x56ff,0x66));var _0xf56f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x56ff[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf56f('0x0'));var utils=require(_0xf56f('0x1'));var logger=require('../../../../config/logger')(_0xf56f('0x2'));var rpc={'chatMessage':require(_0xf56f('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf56f('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf56f('0x5'))};exports[_0xf56f('0x6')]=function(_0x3f9855,_0x5c7395){return function(_0x2c65e9){try{var _0x4bdb26={'body':utils['getMustacheRender'](_0x5c7395[0x0],this),'ContactId':this[_0xf56f('0x7')]['id']};if(this[_0xf56f('0x8')]==='chat'){_0x4bdb26[_0xf56f('0x9')]=this['account']['id'];}else{_0x4bdb26[_[_0xf56f('0xa')](this[_0xf56f('0x8')])+_0xf56f('0xb')]=this[_0xf56f('0xc')]['id'];}_0x4bdb26[_[_0xf56f('0xa')](this[_0xf56f('0x8')])+'InteractionId']=this[_0xf56f('0xd')]['id'];if(rpc[this[_0xf56f('0x8')]+_0xf56f('0xe')]){return rpc[this[_0xf56f('0x8')]+_0xf56f('0xe')][_0xf56f('0xf')](_0x4bdb26)[_0xf56f('0x10')](function(_0x2ab689){logger[_0xf56f('0x11')](_0xf56f('0x12'),_0x3f9855,_0x4bdb26['body']);_0x2c65e9[_0xf56f('0x13')]();})[_0xf56f('0x14')](function(_0x537bd9){logger[_0xf56f('0x15')]('[%s][MESSAGE]\x20%s',_0x3f9855,JSON[_0xf56f('0x16')](_0x537bd9));_0x2c65e9[_0xf56f('0x17')]();});}}catch(_0x225800){logger[_0xf56f('0x15')](_0xf56f('0x12'),_0x3f9855,JSON['stringify'](_0x225800));_0x2c65e9[_0xf56f('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 9f21872..636018b 100644 --- a/server/services/routing/server/applications/noop.js +++ b/server/services/routing/server/applications/noop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee38=['[%s][NOOP]\x20%s','getMustacheRender','next','stringify','./utils','../../../../config/logger','routing','consequence'];(function(_0x5d55b1,_0x5597b4){var _0x1416f3=function(_0x5eb3ef){while(--_0x5eb3ef){_0x5d55b1['push'](_0x5d55b1['shift']());}};_0x1416f3(++_0x5597b4);}(_0xee38,0x174));var _0x8ee3=function(_0x7e8a0d,_0x5bd980){_0x7e8a0d=_0x7e8a0d-0x0;var _0x500554=_0xee38[_0x7e8a0d];return _0x500554;};'use strict';var utils=require(_0x8ee3('0x0'));var logger=require(_0x8ee3('0x1'))(_0x8ee3('0x2'));exports[_0x8ee3('0x3')]=function(_0x4c7f6b,_0x1f8554){return function(_0x4dfa74){try{logger['info'](_0x8ee3('0x4'),_0x4c7f6b,utils[_0x8ee3('0x5')](_0x1f8554[0x0],this));_0x4dfa74[_0x8ee3('0x6')]();}catch(_0x1c6681){logger['error'](_0x8ee3('0x4'),_0x4c7f6b,JSON[_0x8ee3('0x7')](_0x1c6681));_0x4dfa74['stop']();}};}; \ No newline at end of file +var _0xbac3=['stringify','./utils','../../../../config/logger','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0xbac3,0x69));var _0x3bac=function(_0x6fbc80,_0x355ace){_0x6fbc80=_0x6fbc80-0x0;var _0x57c2ff=_0xbac3[_0x6fbc80];return _0x57c2ff;};'use strict';var utils=require(_0x3bac('0x0'));var logger=require(_0x3bac('0x1'))('routing');exports['consequence']=function(_0x1492b7,_0x20e2f4){return function(_0x106136){try{logger[_0x3bac('0x2')](_0x3bac('0x3'),_0x1492b7,utils[_0x3bac('0x4')](_0x20e2f4[0x0],this));_0x106136[_0x3bac('0x5')]();}catch(_0xd2d69a){logger[_0x3bac('0x6')](_0x3bac('0x3'),_0x1492b7,JSON[_0x3bac('0x7')](_0xd2d69a));_0x106136['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 37d1821..8fb7937 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x179a=['pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','InteractionId','interaction','upperFirst','MessageId','chat','AccountId','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','create\x20queue\x20report','waiting','accepted','info','[%s][STOP:QUEUE][NAME:%s]','message','QueueReport','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions'];(function(_0x338b01,_0x11aeab){var _0x4efe34=function(_0x4f6349){while(--_0x4f6349){_0x338b01['push'](_0x338b01['shift']());}};_0x4efe34(++_0x11aeab);}(_0x179a,0x8c));var _0xa179=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0x179a[_0x1af5b2];return _0xf1aa2d;};'use strict';var schema=require(_0xa179('0x0'));var _=require(_0xa179('0x1'));var util=require(_0xa179('0x2'));var seqqueue=require(_0xa179('0x3'));var moment=require(_0xa179('0x4'));var Redis=require('ioredis');var config=require(_0xa179('0x5'));var logger=require(_0xa179('0x6'))(_0xa179('0x7'));var strategy=require('./strategy');config['redis']=_['defaults'](config[_0xa179('0x8')],{'host':_0xa179('0x9'),'port':0x18eb});var io=require(_0xa179('0xa'))(new Redis(config['redis']));var attributes=['id',_0xa179('0xb'),_0xa179('0xc'),_0xa179('0xd'),_0xa179('0xe'),_0xa179('0xf')];function emit(_0x1d12d6,_0x486487,_0x578529){io['to'](_0x1d12d6)[_0xa179('0x10')](_0x486487,_0x578529);}function emitChannelQueueInteraction(_0x5f012a,_0x527782,_0x2130af,_0x27d9a3,_0x55a1b3,_0xb6ff32,_0x495cce,_0x59baf3){var _0x553a59=_[_0xa179('0x11')](_0x2130af);_0x553a59['queue_id']=_0x59baf3;_0x553a59['queue']=_0x527782;_0x553a59[_0xa179('0xc')]=_0x27d9a3;_0x553a59['id']=_0x55a1b3;if(_0xb6ff32){_0x495cce[util[_0xa179('0x12')](_0xa179('0x13'),_0x5f012a)][_0x55a1b3]=_[_0xa179('0x14')](_0x553a59,attributes);}else{delete _0x495cce[util[_0xa179('0x12')]('%sQueuesWaitingInteractions',_0x5f012a)][_0x55a1b3];}emit(util[_0xa179('0x12')](_0xa179('0x15'),_0x5f012a,_0x527782),util[_0xa179('0x12')](_0xa179('0x16'),_0x5f012a,_0xb6ff32?'save':_0xa179('0x17')),_['pick'](_0x553a59,attributes));}var rpc={'openchannelQueueReport':require(_0xa179('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xa179('0x19')),'smsQueueReport':require(_0xa179('0x1a')),'faxQueueReport':require(_0xa179('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0xa179('0x1c')},'timeout':{'type':'number','message':_0xa179('0x1d')}});function startRouting(_0x199909,_0x29d593,_0xa3bdb7,_0x1358e4){if(_0x199909&&_0x29d593&&_0xa3bdb7){_0x29d593['waiting']+=0x1;var _0x1770e4={'uniqueid':_0x199909,'from':_0xa3bdb7[_0xa179('0x1e')]?_0xa3bdb7[_0xa179('0x1e')][_0xa179('0xe')]:'','joinAt':moment()[_0xa179('0x12')](_0xa179('0x1f')),'ContactId':_0xa3bdb7[_0xa179('0x20')]?_0xa3bdb7[_0xa179('0x20')]['id']:null,'ListId':_0xa3bdb7[_0xa179('0x21')]?_0xa3bdb7[_0xa179('0x21')]['id']:null};_0x1770e4[_['upperFirst'](_0xa3bdb7[_0xa179('0x22')])+_0xa179('0x23')]=_0x29d593['id']||null;_0x1770e4[_['upperFirst'](_0xa3bdb7[_0xa179('0x22')])+_0xa179('0x24')]=_0xa3bdb7[_0xa179('0x25')]?_0xa3bdb7[_0xa179('0x25')]['id']:null;_0x1770e4[_[_0xa179('0x26')](_0xa3bdb7[_0xa179('0x22')])+_0xa179('0x27')]=_0xa3bdb7['message']?_0xa3bdb7['message']['id']:null;_0x1770e4[_[_0xa179('0x26')](_0xa3bdb7[_0xa179('0x22')])+(_0xa3bdb7[_0xa179('0x22')]!==_0xa179('0x28')?_0xa179('0x29'):'WebsiteId')]=_0xa3bdb7[_0xa179('0xc')]?_0xa3bdb7['account']['id']:null;logger['info'](util[_0xa179('0x12')](_0xa179('0x2a'),_0x199909,_0x29d593['name']));emitChannelQueueInteraction(_0xa3bdb7['channel'],_0x29d593[_0xa179('0x2b')],_0x1770e4,_0xa3bdb7['account'][_0xa179('0x2b')],_0xa3bdb7['message']['id'],!![],_0x1358e4,_0x29d593['id']);if(rpc[_0xa3bdb7[_0xa179('0x22')]+'QueueReport']){return rpc[_0xa3bdb7[_0xa179('0x22')]+'QueueReport'][_0xa179('0x2c')](_0x1770e4)[_0xa179('0x2d')](function(_0x3ed3f2){logger[_0xa179('0x2e')](_0xa179('0x2f'));});}}}function stopRouting(_0x27af8a,_0x3d1afa,_0x4900f3,_0x3c34df){if(_0x27af8a&&_0x3d1afa){_0x3d1afa[_0xa179('0x30')]-=0x1;var _0x3ee9ad={'leaveAt':moment()[_0xa179('0x12')](_0xa179('0x1f')),'acceptAt':moment()['format'](_0xa179('0x1f')),'reason':_0xa179('0x31')};logger[_0xa179('0x32')](util[_0xa179('0x12')](_0xa179('0x33'),_0x27af8a,_0x3d1afa[_0xa179('0x2b')]));emitChannelQueueInteraction(_0x4900f3[_0xa179('0x22')],_0x3d1afa[_0xa179('0x2b')],_0x4900f3[_0xa179('0x1e')],_0x4900f3[_0xa179('0xc')][_0xa179('0x2b')],_0x4900f3[_0xa179('0x34')]['id'],![],_0x3c34df,_0x3d1afa['id']);if(rpc[_0x4900f3[_0xa179('0x22')]+_0xa179('0x35')]){return rpc[_0x4900f3[_0xa179('0x22')]+_0xa179('0x35')][_0xa179('0x36')](_0x27af8a,_0x3ee9ad)['catch'](function(_0x144cb9){logger[_0xa179('0x2e')]('update\x20queue\x20report');});}}}function endRouting(_0x2038cd,_0x44fee7,_0x50dd7d,_0x4a9444){if(_0x2038cd&&_0x44fee7){_0x44fee7['waiting']-=0x1;var _0x33349a={'leaveAt':moment()[_0xa179('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xa179('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa179('0x37')};logger['info'](util[_0xa179('0x12')](_0xa179('0x38'),_0x2038cd,_0x44fee7[_0xa179('0x2b')]));emitChannelQueueInteraction(_0x50dd7d['channel'],_0x44fee7[_0xa179('0x2b')],_0x50dd7d['body'],_0x50dd7d[_0xa179('0xc')][_0xa179('0x2b')],_0x50dd7d[_0xa179('0x34')]['id'],![],_0x4a9444);if(rpc[_0x50dd7d['channel']+_0xa179('0x35')]){return rpc[_0x50dd7d['channel']+_0xa179('0x35')][_0xa179('0x36')](_0x2038cd,_0x33349a)['catch'](function(_0x2e8869){logger[_0xa179('0x2e')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x19e537){return function(_0x309c86){return _0x309c86[_0xa179('0x2b')][_0xa179('0x39')]()===_0x19e537[_0xa179('0x39')]();};}exports[_0xa179('0x3a')]=function(_0x13484b,_0x581b38,_0x50ef2d,_0x5bedce){return function(_0x5e9469){try{var _0x1ba12c={'name':_0x581b38[0x0],'timeout':_0x581b38[0x1]};var _0x4f5b3e=queue[_0xa179('0x0')](_0x1ba12c,{'typecast':!![]});if(_0x4f5b3e[_0xa179('0x3b')]){logger['error'](_0xa179('0x3c'),_0x13484b,_[_0xa179('0x3d')](_0x4f5b3e,_0xa179('0x34'))[_0xa179('0x3e')](',\x20'));_0x5e9469[_0xa179('0x3f')]();}else{var _0x1656d5=_[_0xa179('0x40')](_0x50ef2d[_0x5bedce[_0xa179('0x22')]+_0xa179('0x41')],handleFindQueue(_0x1ba12c[_0xa179('0x2b')]));if(_0x1656d5){startRouting(_0x13484b,_0x1656d5,_0x5bedce,_0x50ef2d);var _0xd9df1a=(_0x1656d5[_0xa179('0x37')]||0xa)*0x3e8;var _0x28a181=(_0x1ba12c[_0xa179('0x37')]||0x14)*0x3e8;var _0xfbc640,_0x39f271;if(_0xd9df1a>_0x28a181){_0x28a181=_0xd9df1a;}var _0xbeb9ea=seqqueue[_0xa179('0x42')](_0xd9df1a);_0xbeb9ea['id']=_0x13484b;_0xbeb9ea[_0xa179('0x43')]=_0xd9df1a;_0xbeb9ea['qtimeout']=_0x28a181;_0xbeb9ea[_0xa179('0x22')]=_0x5bedce[_0xa179('0x22')];_0x50ef2d[_0xa179('0x44')][_0x13484b]['on'](_0xa179('0x45'),function(){logger[_0xa179('0x32')](_0xa179('0x46'),_0x13484b);stopRouting(_0x13484b,_0x1656d5,_0x5bedce,_0x50ef2d);clearTimeout(_0xfbc640);_0xfbc640=undefined;_0xbeb9ea['close'](!![]);if(_0x50ef2d[_0xa179('0x44')][_0x13484b]){delete _0x50ef2d[_0xa179('0x44')][_0x13484b];}_0x5e9469[_0xa179('0x3f')]();});_0x50ef2d[_0xa179('0x44')][_0x13484b]['on'](_0xa179('0x47'),function(){if(_0x50ef2d[_0xa179('0x44')][_0x13484b]){delete _0x50ef2d[_0xa179('0x44')][_0x13484b];}});_0xfbc640=setTimeout(function(){logger[_0xa179('0x32')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x13484b);endRouting(_0x13484b,_0x1656d5,_0x5bedce,_0x50ef2d);clearTimeout(_0xfbc640);_0xbeb9ea[_0xa179('0x48')](!![]);_0x5e9469[_0xa179('0x49')]();},_0x28a181);switch(_0x1656d5[_0xa179('0x4a')]){case'rrmemory':strategy[_0xa179('0x4b')](_0xbeb9ea,_0x1656d5,_0x50ef2d,_0x5bedce);break;default:strategy[_0xa179('0x4c')](_0xbeb9ea,_0x1656d5,_0x50ef2d,_0x5bedce);}}else{logger[_0xa179('0x2e')](_0xa179('0x4d'),_0x13484b,_0x1ba12c[_0xa179('0x2b')]);_0x5e9469[_0xa179('0x3f')]();}}}catch(_0x50c85c){console[_0xa179('0x4e')](_0x50c85c);logger['error']('[%s][QUEUE]\x20%s',_0x13484b,_0x50c85c[_0xa179('0x4f')]);_0x5e9469['stop']();}};}; \ No newline at end of file +var _0xf7fc=['[%s][STOP:QUEUE][NAME:%s]','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','length','[%s][QUEUE]\x20%s','map','stop','Queues','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','moment','../../../../config/environment','../../../../config/logger','routing','defaults','redis','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','waiting'];(function(_0x37bcd8,_0x27bed9){var _0x422480=function(_0x510db3){while(--_0x510db3){_0x37bcd8['push'](_0x37bcd8['shift']());}};_0x422480(++_0x27bed9);}(_0xf7fc,0x1bb));var _0xcf7f=function(_0x54fae5,_0x323b8e){_0x54fae5=_0x54fae5-0x0;var _0xd761bd=_0xf7fc[_0x54fae5];return _0xd761bd;};'use strict';var schema=require(_0xcf7f('0x0'));var _=require(_0xcf7f('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0xcf7f('0x2'));var Redis=require('ioredis');var config=require(_0xcf7f('0x3'));var logger=require(_0xcf7f('0x4'))(_0xcf7f('0x5'));var strategy=require('./strategy');config['redis']=_[_0xcf7f('0x6')](config[_0xcf7f('0x7')],{'host':_0xcf7f('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcf7f('0x7')]));var attributes=['id','queue_id',_0xcf7f('0x9'),_0xcf7f('0xa'),_0xcf7f('0xb'),_0xcf7f('0xc')];function emit(_0x2d78e9,_0x49040d,_0x29810f){io['to'](_0x2d78e9)[_0xcf7f('0xd')](_0x49040d,_0x29810f);}function emitChannelQueueInteraction(_0xd084aa,_0x177371,_0x33251d,_0x51a30,_0x447292,_0x484659,_0x28bd90,_0x3ae24a){var _0x1c21e1=_[_0xcf7f('0xe')](_0x33251d);_0x1c21e1[_0xcf7f('0xf')]=_0x3ae24a;_0x1c21e1[_0xcf7f('0xa')]=_0x177371;_0x1c21e1[_0xcf7f('0x9')]=_0x51a30;_0x1c21e1['id']=_0x447292;if(_0x484659){_0x28bd90[util['format'](_0xcf7f('0x10'),_0xd084aa)][_0x447292]=_[_0xcf7f('0x11')](_0x1c21e1,attributes);}else{delete _0x28bd90[util[_0xcf7f('0x12')]('%sQueuesWaitingInteractions',_0xd084aa)][_0x447292];}emit(util[_0xcf7f('0x12')](_0xcf7f('0x13'),_0xd084aa,_0x177371),util[_0xcf7f('0x12')]('%s_queue_waiting_interaction:%s',_0xd084aa,_0x484659?'save':_0xcf7f('0x14')),_[_0xcf7f('0x11')](_0x1c21e1,attributes));}var rpc={'openchannelQueueReport':require(_0xcf7f('0x15')),'mailQueueReport':require(_0xcf7f('0x16')),'chatQueueReport':require(_0xcf7f('0x17')),'smsQueueReport':require(_0xcf7f('0x18')),'faxQueueReport':require(_0xcf7f('0x19')),'whatsappQueueReport':require(_0xcf7f('0x1a'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xcf7f('0x1b')},'timeout':{'type':_0xcf7f('0x1c'),'message':_0xcf7f('0x1d')}});function startRouting(_0x5ab572,_0x21183f,_0x3a36c1,_0x5f1833){if(_0x5ab572&&_0x21183f&&_0x3a36c1){_0x21183f['waiting']+=0x1;var _0x3bccc3={'uniqueid':_0x5ab572,'from':_0x3a36c1[_0xcf7f('0x1e')]?_0x3a36c1['body'][_0xcf7f('0xb')]:'','joinAt':moment()[_0xcf7f('0x12')](_0xcf7f('0x1f')),'ContactId':_0x3a36c1[_0xcf7f('0x20')]?_0x3a36c1['contact']['id']:null,'ListId':_0x3a36c1[_0xcf7f('0x21')]?_0x3a36c1[_0xcf7f('0x21')]['id']:null};_0x3bccc3[_[_0xcf7f('0x22')](_0x3a36c1['channel'])+'QueueId']=_0x21183f['id']||null;_0x3bccc3[_[_0xcf7f('0x22')](_0x3a36c1[_0xcf7f('0x23')])+_0xcf7f('0x24')]=_0x3a36c1[_0xcf7f('0x25')]?_0x3a36c1['interaction']['id']:null;_0x3bccc3[_['upperFirst'](_0x3a36c1[_0xcf7f('0x23')])+'MessageId']=_0x3a36c1[_0xcf7f('0x26')]?_0x3a36c1[_0xcf7f('0x26')]['id']:null;_0x3bccc3[_[_0xcf7f('0x22')](_0x3a36c1[_0xcf7f('0x23')])+(_0x3a36c1[_0xcf7f('0x23')]!=='chat'?_0xcf7f('0x27'):'WebsiteId')]=_0x3a36c1[_0xcf7f('0x9')]?_0x3a36c1['account']['id']:null;logger[_0xcf7f('0x28')](util[_0xcf7f('0x12')](_0xcf7f('0x29'),_0x5ab572,_0x21183f[_0xcf7f('0x2a')]));emitChannelQueueInteraction(_0x3a36c1[_0xcf7f('0x23')],_0x21183f[_0xcf7f('0x2a')],_0x3bccc3,_0x3a36c1[_0xcf7f('0x9')]['name'],_0x3a36c1['message']['id'],!![],_0x5f1833,_0x21183f['id']);if(rpc[_0x3a36c1[_0xcf7f('0x23')]+_0xcf7f('0x2b')]){return rpc[_0x3a36c1[_0xcf7f('0x23')]+_0xcf7f('0x2b')]['create'](_0x3bccc3)['catch'](function(_0x3538a6){logger[_0xcf7f('0x2c')](_0xcf7f('0x2d'));});}}}function stopRouting(_0x238fb0,_0x25d9f5,_0x72b0db,_0x4cc326){if(_0x238fb0&&_0x25d9f5){_0x25d9f5[_0xcf7f('0x2e')]-=0x1;var _0xfa6703={'leaveAt':moment()[_0xcf7f('0x12')](_0xcf7f('0x1f')),'acceptAt':moment()[_0xcf7f('0x12')](_0xcf7f('0x1f')),'reason':'accepted'};logger[_0xcf7f('0x28')](util[_0xcf7f('0x12')](_0xcf7f('0x2f'),_0x238fb0,_0x25d9f5['name']));emitChannelQueueInteraction(_0x72b0db[_0xcf7f('0x23')],_0x25d9f5[_0xcf7f('0x2a')],_0x72b0db[_0xcf7f('0x1e')],_0x72b0db['account'][_0xcf7f('0x2a')],_0x72b0db[_0xcf7f('0x26')]['id'],![],_0x4cc326,_0x25d9f5['id']);if(rpc[_0x72b0db[_0xcf7f('0x23')]+_0xcf7f('0x2b')]){return rpc[_0x72b0db[_0xcf7f('0x23')]+_0xcf7f('0x2b')]['update'](_0x238fb0,_0xfa6703)[_0xcf7f('0x30')](function(_0x5c6e98){logger['error'](_0xcf7f('0x31'));});}}}function endRouting(_0x3f5310,_0xca20e2,_0x5b4cb2,_0x5ee9ca){if(_0x3f5310&&_0xca20e2){_0xca20e2[_0xcf7f('0x2e')]-=0x1;var _0x43339b={'leaveAt':moment()[_0xcf7f('0x12')](_0xcf7f('0x1f')),'exitAt':moment()[_0xcf7f('0x12')](_0xcf7f('0x1f')),'reason':_0xcf7f('0x32')};logger['info'](util[_0xcf7f('0x12')](_0xcf7f('0x33'),_0x3f5310,_0xca20e2[_0xcf7f('0x2a')]));emitChannelQueueInteraction(_0x5b4cb2[_0xcf7f('0x23')],_0xca20e2[_0xcf7f('0x2a')],_0x5b4cb2[_0xcf7f('0x1e')],_0x5b4cb2[_0xcf7f('0x9')][_0xcf7f('0x2a')],_0x5b4cb2[_0xcf7f('0x26')]['id'],![],_0x5ee9ca);if(rpc[_0x5b4cb2[_0xcf7f('0x23')]+_0xcf7f('0x2b')]){return rpc[_0x5b4cb2[_0xcf7f('0x23')]+_0xcf7f('0x2b')][_0xcf7f('0x34')](_0x3f5310,_0x43339b)[_0xcf7f('0x30')](function(_0x5eb94b){logger['error'](_0xcf7f('0x31'));});}}}function handleFindQueue(_0x3834fc){return function(_0x33397c){return _0x33397c[_0xcf7f('0x2a')][_0xcf7f('0x35')]()===_0x3834fc[_0xcf7f('0x35')]();};}exports['consequence']=function(_0x284d84,_0x20c251,_0x14038c,_0x13ae28){return function(_0x5c7671){try{var _0x152225={'name':_0x20c251[0x0],'timeout':_0x20c251[0x1]};var _0x5a1459=queue[_0xcf7f('0x0')](_0x152225,{'typecast':!![]});if(_0x5a1459[_0xcf7f('0x36')]){logger[_0xcf7f('0x2c')](_0xcf7f('0x37'),_0x284d84,_[_0xcf7f('0x38')](_0x5a1459,_0xcf7f('0x26'))['join'](',\x20'));_0x5c7671[_0xcf7f('0x39')]();}else{var _0x3baff9=_['find'](_0x14038c[_0x13ae28['channel']+_0xcf7f('0x3a')],handleFindQueue(_0x152225[_0xcf7f('0x2a')]));if(_0x3baff9){startRouting(_0x284d84,_0x3baff9,_0x13ae28,_0x14038c);var _0x288be8=(_0x3baff9['timeout']||0xa)*0x3e8;var _0x5a09f4=(_0x152225[_0xcf7f('0x32')]||0x14)*0x3e8;var _0x4f4d1c,_0x27255e;if(_0x288be8>_0x5a09f4){_0x5a09f4=_0x288be8;}var _0x461e14=seqqueue['createQueue'](_0x288be8);_0x461e14['id']=_0x284d84;_0x461e14['atimeout']=_0x288be8;_0x461e14['qtimeout']=_0x5a09f4;_0x461e14[_0xcf7f('0x23')]=_0x13ae28[_0xcf7f('0x23')];_0x14038c[_0xcf7f('0x3b')][_0x284d84]['on'](_0xcf7f('0x3c'),function(){logger[_0xcf7f('0x28')](_0xcf7f('0x3d'),_0x284d84);stopRouting(_0x284d84,_0x3baff9,_0x13ae28,_0x14038c);clearTimeout(_0x4f4d1c);_0x4f4d1c=undefined;_0x461e14[_0xcf7f('0x3e')](!![]);if(_0x14038c[_0xcf7f('0x3b')][_0x284d84]){delete _0x14038c[_0xcf7f('0x3b')][_0x284d84];}_0x5c7671[_0xcf7f('0x39')]();});_0x14038c[_0xcf7f('0x3b')][_0x284d84]['on']('complete',function(){if(_0x14038c[_0xcf7f('0x3b')][_0x284d84]){delete _0x14038c[_0xcf7f('0x3b')][_0x284d84];}});_0x4f4d1c=setTimeout(function(){logger['info'](_0xcf7f('0x3f'),_0x284d84);endRouting(_0x284d84,_0x3baff9,_0x13ae28,_0x14038c);clearTimeout(_0x4f4d1c);_0x461e14['close'](!![]);_0x5c7671[_0xcf7f('0x40')]();},_0x5a09f4);switch(_0x3baff9['strategy']){case _0xcf7f('0x41'):strategy[_0xcf7f('0x41')](_0x461e14,_0x3baff9,_0x14038c,_0x13ae28);break;default:strategy[_0xcf7f('0x42')](_0x461e14,_0x3baff9,_0x14038c,_0x13ae28);}}else{logger[_0xcf7f('0x2c')](_0xcf7f('0x43'),_0x284d84,_0x152225['name']);_0x5c7671[_0xcf7f('0x39')]();}}}catch(_0x98590e){console[_0xcf7f('0x44')](_0x98590e);logger['error'](_0xcf7f('0x37'),_0x284d84,_0x98590e[_0xcf7f('0x45')]);_0x5c7671[_0xcf7f('0x39')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index e6c754d..87d950a 100644 --- a/server/services/routing/server/applications/strategy/agent.js +++ b/server/services/routing/server/applications/strategy/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8b0=['routing','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb8b0,0x92));var _0x0b8b=function(_0x383fdd,_0x5123bb){_0x383fdd=_0x383fdd-0x0;var _0x58fefb=_0xb8b0[_0x383fdd];return _0x58fefb;};'use strict';var _=require(_0x0b8b('0x0'));var uuid=require(_0x0b8b('0x1'));var util=require(_0x0b8b('0x2'));var logger=require(_0x0b8b('0x3'))(_0x0b8b('0x4'));var Agent=function(_0x3b363c,_0x1e948b,_0xa8aae8,_0xcbb2ee){this['notificationId']=uuid['v4']();this[_0x0b8b('0x5')]=_0x3b363c;this[_0x0b8b('0x6')]=_0x1e948b;this[_0x0b8b('0x7')]=_0xa8aae8;this[_0x0b8b('0x4')]=_0xcbb2ee;this[_0x0b8b('0x5')][_0x0b8b('0x8')](this[_0x0b8b('0x9')][_0x0b8b('0xa')](this),this['handleTimeout'][_0x0b8b('0xa')](this));this['squeue']['on']('timeout',this[_0x0b8b('0xb')][_0x0b8b('0xa')](this));this['squeue']['on'](_0x0b8b('0xc'),this[_0x0b8b('0xd')][_0x0b8b('0xa')](this));};Agent[_0x0b8b('0xe')][_0x0b8b('0x8')]=function(){this[_0x0b8b('0x5')]['push'](this[_0x0b8b('0x9')][_0x0b8b('0xa')](this),this[_0x0b8b('0xb')][_0x0b8b('0xa')](this));};Agent[_0x0b8b('0xe')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x0b8b('0x9')]=function(_0x5eeed6){logger[_0x0b8b('0xf')](_0x0b8b('0x10'),this['squeue']['id'],this[_0x0b8b('0x6')]['id']);if(_[_0x0b8b('0x11')](this[_0x0b8b('0x7')][_0x0b8b('0x12')][this[_0x0b8b('0x6')]['id']])){logger[_0x0b8b('0xf')](_0x0b8b('0x13'),this[_0x0b8b('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x0b8b('0x8')][_0x0b8b('0xa')](this),0x3e8);}else{if(this[_0x0b8b('0x4')][_0x0b8b('0x14')]||util[_0x0b8b('0x15')](this[_0x0b8b('0x5')]['id'],this['realtime'][_0x0b8b('0x12')][this['agent']['id']],this[_0x0b8b('0x5')]['channel'],![])){this[_0x0b8b('0x7')][_0x0b8b('0x12')][this[_0x0b8b('0x6')]['id']]['busy']=!![];this[_0x0b8b('0x7')][_0x0b8b('0x12')][this[_0x0b8b('0x6')]['id']][_0x0b8b('0x16')]=undefined;util[_0x0b8b('0x17')](this[_0x0b8b('0x18')],this[_0x0b8b('0x5')]['id'],this[_0x0b8b('0x7')][_0x0b8b('0x12')][this['agent']['id']],null,this['routing']);util[_0x0b8b('0x19')](this[_0x0b8b('0x5')]['id'],this['realtime'][_0x0b8b('0x12')][this[_0x0b8b('0x6')]['id']],_0x0b8b('0x1a')+(this[_0x0b8b('0x4')][_0x0b8b('0x14')]?_0x0b8b('0x1b'):''));}else{logger[_0x0b8b('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x0b8b('0x5')]['id'],this[_0x0b8b('0x6')]['id']);setTimeout(this[_0x0b8b('0x8')]['bind'](this),0x3e8);}}};Agent['prototype'][_0x0b8b('0xb')]=function(_0x1ad634){if(_[_0x0b8b('0x11')](this[_0x0b8b('0x7')][_0x0b8b('0x12')][this[_0x0b8b('0x6')]['id']])){return logger['info'](_0x0b8b('0x13'),this['squeue']['id'],this[_0x0b8b('0x6')]['id']);}else{logger[_0x0b8b('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x0b8b('0x5')]['id'],this[_0x0b8b('0x6')]['id']);util['hideNotification'](this[_0x0b8b('0x18')],this[_0x0b8b('0x5')]['id'],this['realtime'][_0x0b8b('0x12')][this['agent']['id']],null,this[_0x0b8b('0x4')]);this[_0x0b8b('0x7')][_0x0b8b('0x12')][this[_0x0b8b('0x6')]['id']]['busy']=![];this[_0x0b8b('0x7')][_0x0b8b('0x12')][this[_0x0b8b('0x6')]['id']][_0x0b8b('0x16')]=undefined;util['writeLog'](this[_0x0b8b('0x5')]['id'],this[_0x0b8b('0x7')][_0x0b8b('0x12')][this[_0x0b8b('0x6')]['id']],_0x1ad634?'STOP':_0x0b8b('0x1c'));}if(!_0x1ad634){setTimeout(this['push'][_0x0b8b('0xa')](this),0x3e8);}};function agent(_0x55e9ad,_0x51a666,_0x1386d4,_0x418107){return new Agent(_0x55e9ad,_0x51a666,_0x1386d4,_0x418107);}module[_0x0b8b('0x1d')]=agent; \ No newline at end of file +var _0xd902=['info','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','lodash','uuid','./util','routing','notificationId','agent','realtime','handleRun','bind','handleTimeout','squeue','drained','handleDrained','prototype','push','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0xd902,0x153));var _0x2d90=function(_0x2c5ec9,_0x4d69fe){_0x2c5ec9=_0x2c5ec9-0x0;var _0x460637=_0xd902[_0x2c5ec9];return _0x460637;};'use strict';var _=require(_0x2d90('0x0'));var uuid=require(_0x2d90('0x1'));var util=require(_0x2d90('0x2'));var logger=require('../../../../../config/logger')(_0x2d90('0x3'));var Agent=function(_0x52fca5,_0x1c59b2,_0x445af9,_0x26bbf3){this[_0x2d90('0x4')]=uuid['v4']();this['squeue']=_0x52fca5;this[_0x2d90('0x5')]=_0x1c59b2;this[_0x2d90('0x6')]=_0x445af9;this[_0x2d90('0x3')]=_0x26bbf3;this['squeue']['push'](this[_0x2d90('0x7')][_0x2d90('0x8')](this),this[_0x2d90('0x9')]['bind'](this));this[_0x2d90('0xa')]['on']('timeout',this[_0x2d90('0x9')][_0x2d90('0x8')](this));this[_0x2d90('0xa')]['on'](_0x2d90('0xb'),this[_0x2d90('0xc')][_0x2d90('0x8')](this));};Agent[_0x2d90('0xd')][_0x2d90('0xe')]=function(){this[_0x2d90('0xa')][_0x2d90('0xe')](this[_0x2d90('0x7')]['bind'](this),this[_0x2d90('0x9')][_0x2d90('0x8')](this));};Agent[_0x2d90('0xd')]['handleDrained']=function(){this[_0x2d90('0x9')](!![]);};Agent[_0x2d90('0xd')][_0x2d90('0x7')]=function(_0x3fe1cb){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x2d90('0xa')]['id'],this[_0x2d90('0x5')]['id']);if(_[_0x2d90('0xf')](this[_0x2d90('0x6')][_0x2d90('0x10')][this['agent']['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x2d90('0x5')]['id']);setTimeout(this[_0x2d90('0xe')][_0x2d90('0x8')](this),0x3e8);}else{if(this[_0x2d90('0x3')][_0x2d90('0x11')]||util[_0x2d90('0x12')](this[_0x2d90('0xa')]['id'],this['realtime']['agents'][this[_0x2d90('0x5')]['id']],this['squeue'][_0x2d90('0x13')],![])){this['realtime'][_0x2d90('0x10')][this[_0x2d90('0x5')]['id']][_0x2d90('0x14')]=!![];this[_0x2d90('0x6')][_0x2d90('0x10')][this[_0x2d90('0x5')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0x2d90('0x4')],this[_0x2d90('0xa')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0x2d90('0x3')]);util[_0x2d90('0x15')](this[_0x2d90('0xa')]['id'],this[_0x2d90('0x6')][_0x2d90('0x10')][this[_0x2d90('0x5')]['id']],_0x2d90('0x16')+(this[_0x2d90('0x3')][_0x2d90('0x11')]?_0x2d90('0x17'):''));}else{logger['info'](_0x2d90('0x18'),this[_0x2d90('0xa')]['id'],this[_0x2d90('0x5')]['id']);setTimeout(this[_0x2d90('0xe')][_0x2d90('0x8')](this),0x3e8);}}};Agent[_0x2d90('0xd')][_0x2d90('0x9')]=function(_0x537932){if(_[_0x2d90('0xf')](this['realtime']['agents'][this[_0x2d90('0x5')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x2d90('0xa')]['id'],this[_0x2d90('0x5')]['id']);}else{logger[_0x2d90('0x19')](_0x2d90('0x1a'),this[_0x2d90('0xa')]['id'],this['agent']['id']);util[_0x2d90('0x1b')](this['notificationId'],this[_0x2d90('0xa')]['id'],this[_0x2d90('0x6')]['agents'][this[_0x2d90('0x5')]['id']],null,this[_0x2d90('0x3')]);this['realtime']['agents'][this[_0x2d90('0x5')]['id']][_0x2d90('0x14')]=![];this[_0x2d90('0x6')][_0x2d90('0x10')][this[_0x2d90('0x5')]['id']]['busyQueue']=undefined;util[_0x2d90('0x15')](this[_0x2d90('0xa')]['id'],this['realtime'][_0x2d90('0x10')][this[_0x2d90('0x5')]['id']],_0x537932?'STOP':'TIMEOUT');}if(!_0x537932){setTimeout(this[_0x2d90('0xe')][_0x2d90('0x8')](this),0x3e8);}};function agent(_0x5041a2,_0x30db7a,_0x3f5dad,_0x2538c6){return new Agent(_0x5041a2,_0x30db7a,_0x3f5dad,_0x2538c6);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index d4b1696..2097903 100644 --- a/server/services/routing/server/applications/strategy/beepall.js +++ b/server/services/routing/server/applications/strategy/beepall.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3ea=['handleTimeout','handleDrained','prototype','push','isNil','length','Agents','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busy','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','busyQueue','exports','lodash','uuid','./util','routing','notificationId','squeue','queue','realtime','handleRun','bind'];(function(_0x275b16,_0xb0a60d){var _0x1f8ce0=function(_0x4004c5){while(--_0x4004c5){_0x275b16['push'](_0x275b16['shift']());}};_0x1f8ce0(++_0xb0a60d);}(_0xb3ea,0x10d));var _0xab3e=function(_0x160c20,_0x495237){_0x160c20=_0x160c20-0x0;var _0x38c93f=_0xb3ea[_0x160c20];return _0x38c93f;};'use strict';var _=require(_0xab3e('0x0'));var uuid=require(_0xab3e('0x1'));var util=require(_0xab3e('0x2'));var logger=require('../../../../../config/logger')(_0xab3e('0x3'));var Beepall=function(_0x4b9d20,_0x283dbe,_0x5d862a,_0x30e8e6){this[_0xab3e('0x4')]=uuid['v4']();this[_0xab3e('0x5')]=_0x4b9d20;this[_0xab3e('0x6')]=_0x283dbe;this[_0xab3e('0x7')]=_0x5d862a;this['routing']=_0x30e8e6;this[_0xab3e('0x5')]['push'](this[_0xab3e('0x8')][_0xab3e('0x9')](this),this['handleTimeout'][_0xab3e('0x9')](this));this[_0xab3e('0x5')]['on']('timeout',this[_0xab3e('0xa')][_0xab3e('0x9')](this));this['squeue']['on']('drained',this[_0xab3e('0xb')][_0xab3e('0x9')](this));};Beepall[_0xab3e('0xc')][_0xab3e('0xd')]=function(){this[_0xab3e('0x5')][_0xab3e('0xd')](this['handleRun']['bind'](this),this['handleTimeout'][_0xab3e('0x9')](this));};Beepall[_0xab3e('0xc')][_0xab3e('0xb')]=function(_0x2394e6){this['handleTimeout'](!![]);};Beepall[_0xab3e('0xc')]['handleRun']=function(_0x54f51c){var _0x1fb92b=!![];if(!_[_0xab3e('0xe')](this['queue'])&&!_[_0xab3e('0xe')](this[_0xab3e('0x6')]['Agents'])&&this[_0xab3e('0x6')]['Agents'][_0xab3e('0xf')]>0x0){for(var _0x57be98=0x0,_0x5594f1;_0x57be980x0){for(var _0x1b7c00=0x0,_0x57825d;_0x1b7c000x0&&_0x34b353[_0x3e075c+_0xc583('0x24')]>=_0x34b353[_0x3e075c+_0xc583('0x23')]){writeLog(_0x542256,_0x34b353,_0x3e075c[_0xc583('0x25')]()+_0xc583('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x2dafb4,_0x44f76a,_0x4adde3,_0x162c85,_0x483357){return sendNotification(!![],_0x2dafb4,_0x44f76a,_0x4adde3,_0x162c85,_0x483357);};exports[_0xc583('0x27')]=function(_0x8d4ecb,_0x1c80b1,_0x3ed083,_0x1b2b49,_0x19079b){return sendNotification(![],_0x8d4ecb,_0x1c80b1,_0x3ed083,_0x1b2b49,_0x19079b);};exports[_0xc583('0x28')]=writeLog; \ No newline at end of file +var _0x32f4=['../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','name','user:save','split','\x20interaction','notificationSound','account','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','emit','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','util','../utils','mustache'];(function(_0x548461,_0x32b5f1){var _0x15b46e=function(_0x3a65ad){while(--_0x3a65ad){_0x548461['push'](_0x548461['shift']());}};_0x15b46e(++_0x32b5f1);}(_0x32f4,0x154));var _0x432f=function(_0x113961,_0x878072){_0x113961=_0x113961-0x0;var _0x3a96ff=_0x32f4[_0x113961];return _0x3a96ff;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var utils=require(_0x432f('0x2'));var Mustache=require(_0x432f('0x3'));var Redis=require('ioredis');var config=require(_0x432f('0x4'));var logger=require(_0x432f('0x5'))('routing');config[_0x432f('0x6')]=_[_0x432f('0x7')](config[_0x432f('0x6')],{'host':_0x432f('0x8'),'port':0x18eb});var io=require(_0x432f('0x9'))(new Redis(config['redis']));function emit(_0x5b5f08,_0x2f66fd,_0x32b062){io['to'](_0x5b5f08)['emit'](_0x2f66fd,_0x32b062);}function sendNotification(_0x2a2ef6,_0x5aaf1a,_0x1cdcfd,_0x340fe9,_0x3a0d4b,_0x13369a){io['to'](util[_0x432f('0xa')]('user:%s',_0x340fe9[_0x432f('0xb')]))['emit'](_0x432f('0xc'),_0x340fe9);var _0x4b6c02=_0x13369a||{};var _0x138967=_0x1cdcfd[_0x432f('0xd')]('.');var _0x53459c={'uniqueid':_0x5aaf1a,'channel':_0x138967[0x0],'id':_0x138967[0x1],'title':_0x138967[0x0]+_0x432f('0xe'),'interactionId':_0x138967[0x2],'queue':_0x3a0d4b?_0x3a0d4b[_0x432f('0xb')]:null,'sound':_0x4b6c02['account'][_0x432f('0xf')],'shake':_0x4b6c02[_0x432f('0x10')]['notificationShake']};try{if(!_0x4b6c02['body']){_0x4b6c02[_0x432f('0x11')]={};}if(_0x3a0d4b){_0x4b6c02[_0x432f('0x11')][_0x432f('0x12')]=_0x3a0d4b;}else if(_0x4b6c02[_0x432f('0x11')][_0x432f('0x12')]){delete _0x4b6c02['body'][_0x432f('0x12')];}_0x53459c[_0x432f('0x13')]=utils[_0x432f('0x14')](_0x4b6c02[_0x432f('0x10')]['notificationTemplate'],_0x4b6c02);}catch(_0xdd0293){_0x53459c[_0x432f('0x13')]=_0x432f('0x15');logger[_0x432f('0x16')](util[_0x432f('0xa')](_0x432f('0x17'),_0x5aaf1a,_0xdd0293['message']));}io['to'](util[_0x432f('0xa')]('user:%s',_0x340fe9[_0x432f('0xb')]))[_0x432f('0x18')](util[_0x432f('0xa')](_0x432f('0x19'),_0x2a2ef6?_0x432f('0x1a'):_0x432f('0x1b')),_0x53459c);}function writeLog(_0x10f39b,_0x1899e6,_0x693eb3){return logger[_0x432f('0x1c')](util[_0x432f('0xa')](_0x432f('0x1d'),_0x10f39b,_0x1899e6['name'],_0x693eb3));}exports['isAgentAvailable']=function(_0x343d13,_0x5c4deb,_0x28968e,_0x5b9c70){if(_0x5c4deb[_0x432f('0x1e')]){writeLog(_0x343d13,_0x5c4deb,_0x432f('0x1f'));return![];}if(!_0x5c4deb[_0x432f('0x20')]){writeLog(_0x343d13,_0x5c4deb,_0x432f('0x21'));return![];}if(_0x5c4deb[_0x28968e+_0x432f('0x22')]){writeLog(_0x343d13,_0x5c4deb,_0x432f('0x23'));return![];}if(_0x5b9c70&&_0x5c4deb['hasOwnProperty'](_0x28968e+_0x432f('0x24'))&&_0x5c4deb[_0x432f('0x25')](_0x28968e+'CurrentCapacity')){if(_0x5c4deb[_0x28968e+_0x432f('0x24')]>0x0&&_0x5c4deb[_0x28968e+_0x432f('0x26')]>=_0x5c4deb[_0x28968e+_0x432f('0x24')]){writeLog(_0x343d13,_0x5c4deb,_0x28968e[_0x432f('0x27')]()+_0x432f('0x28'));return![];}}return!![];};exports[_0x432f('0x29')]=function(_0x138a6a,_0x5a3d18,_0x294bfe,_0x4eeae1,_0x1f1fdd){return sendNotification(!![],_0x138a6a,_0x5a3d18,_0x294bfe,_0x4eeae1,_0x1f1fdd);};exports['hideNotification']=function(_0x20404d,_0x5a2c14,_0x3f768b,_0x489ba6,_0x325a9c){return sendNotification(![],_0x20404d,_0x5a2c14,_0x3f768b,_0x489ba6,_0x325a9c);};exports[_0x432f('0x2a')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index f2ee508..f5ec11c 100644 --- a/server/services/routing/server/applications/system.js +++ b/server/services/routing/server/applications/system.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfc9=['isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xbfc9,0x173));var _0x9bfc=function(_0x54846a,_0x246639){_0x54846a=_0x54846a-0x0;var _0x31cc5c=_0xbfc9[_0x54846a];return _0x31cc5c;};'use strict';var schema=require(_0x9bfc('0x0'));var sh=require(_0x9bfc('0x1'));var _=require('lodash');var utils=require(_0x9bfc('0x2'));var logger=require('../../../../config/logger')(_0x9bfc('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x9bfc('0x4')}});exports[_0x9bfc('0x5')]=function(_0x3e57c6,_0x379fa3){return function(_0x555887){try{var _0x34b4ab={'command':_0x379fa3[0x0]};var _0x277959=system[_0x9bfc('0x0')](_0x34b4ab,{'typecast':!![]});if(_0x277959[_0x9bfc('0x6')]){logger[_0x9bfc('0x7')](_0x9bfc('0x8'),_0x3e57c6,_[_0x9bfc('0x9')](_0x277959,_0x9bfc('0xa'))[_0x9bfc('0xb')](',\x20'));logger[_0x9bfc('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3e57c6);_0x555887[_0x9bfc('0xd')]();}else{var _0x1ce4f9=this;var _0xbe23b4=utils[_0x9bfc('0xe')](_0x379fa3[0x0],this);logger[_0x9bfc('0xc')](_0x9bfc('0xf'),_0x3e57c6,_0xbe23b4);sh['exec'](_[_0x9bfc('0x10')](_0xbe23b4),function(_0x4513d3,_0x24550a){logger[_0x9bfc('0xc')](_0x9bfc('0x11'),_0x3e57c6,_0x4513d3);if(_0x4513d3==0x0){var _0x3d5470=_0x24550a[_0x9bfc('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x9bfc('0x13')](_0x379fa3[0x1])||_[_0x9bfc('0x14')](_0x379fa3[0x1])){logger[_0x9bfc('0xc')](_0x9bfc('0x15'),_0x3e57c6);_0x1ce4f9['body'][_0x379fa3[0x1]]=_0x3d5470;}else{logger[_0x9bfc('0xc')](_0x9bfc('0x16'),_0x3e57c6,_0x379fa3[0x1],_0x3d5470);_0x1ce4f9[_0x9bfc('0x17')][_0x379fa3[0x1]]=_0x3d5470;}}_0x555887[_0x9bfc('0xd')]();});}}catch(_0x4baed5){logger[_0x9bfc('0x7')](_0x9bfc('0x8'),_0x3e57c6,_[_0x9bfc('0x18')](_0x4baed5)?JSON['stringify'](_0x4baed5):_0x4baed5);logger[_0x9bfc('0xc')](_0x9bfc('0x19'),_0x3e57c6);_0x555887[_0x9bfc('0xd')]();}};}; \ No newline at end of file +var _0x66cd=['replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim'];(function(_0x54b011,_0x29963b){var _0x630659=function(_0x34cff3){while(--_0x34cff3){_0x54b011['push'](_0x54b011['shift']());}};_0x630659(++_0x29963b);}(_0x66cd,0xa4));var _0xd66c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x66cd[_0x432682];return _0x463d05;};'use strict';var schema=require(_0xd66c('0x0'));var sh=require(_0xd66c('0x1'));var _=require(_0xd66c('0x2'));var utils=require(_0xd66c('0x3'));var logger=require('../../../../config/logger')(_0xd66c('0x4'));var system=schema({'command':{'type':_0xd66c('0x5'),'required':!![],'message':_0xd66c('0x6')}});exports[_0xd66c('0x7')]=function(_0x20903e,_0x58116b){return function(_0x19c213){try{var _0x43b318={'command':_0x58116b[0x0]};var _0x142583=system['validate'](_0x43b318,{'typecast':!![]});if(_0x142583[_0xd66c('0x8')]){logger['error'](_0xd66c('0x9'),_0x20903e,_['map'](_0x142583,_0xd66c('0xa'))[_0xd66c('0xb')](',\x20'));logger[_0xd66c('0xc')](_0xd66c('0xd'),_0x20903e);_0x19c213[_0xd66c('0xe')]();}else{var _0x4cd181=this;var _0xc0e9a7=utils[_0xd66c('0xf')](_0x58116b[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x20903e,_0xc0e9a7);sh[_0xd66c('0x10')](_[_0xd66c('0x11')](_0xc0e9a7),function(_0x780f42,_0x569dd1){logger[_0xd66c('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x20903e,_0x780f42);if(_0x780f42==0x0){var _0x5bb143=_0x569dd1[_0xd66c('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xd66c('0x13')](_0x58116b[0x1])||_['isEmpty'](_0x58116b[0x1])){logger[_0xd66c('0xc')](_0xd66c('0x14'),_0x20903e);_0x4cd181[_0xd66c('0x15')][_0x58116b[0x1]]=_0x5bb143;}else{logger['info'](_0xd66c('0x16'),_0x20903e,_0x58116b[0x1],_0x5bb143);_0x4cd181['body'][_0x58116b[0x1]]=_0x5bb143;}}_0x19c213['next']();});}}catch(_0x14765a){logger[_0xd66c('0x17')](_0xd66c('0x9'),_0x20903e,_[_0xd66c('0x18')](_0x14765a)?JSON[_0xd66c('0x19')](_0x14765a):_0x14765a);logger[_0xd66c('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x20903e);_0x19c213['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index f540183..1b4447d 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47c8=['message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','next','[%s][TAG]\x20%s','isObject','info','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../../../config/logger','number','consequence','length','error','map'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x47c8,0x11e));var _0x847c=function(_0x53bba4,_0x59d3ba){_0x53bba4=_0x53bba4-0x0;var _0x2b0428=_0x47c8[_0x53bba4];return _0x2b0428;};'use strict';var schema=require(_0x847c('0x0'));var _=require(_0x847c('0x1'));var rpc={'chatInteraction':require(_0x847c('0x2')),'openchannelInteraction':require(_0x847c('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x847c('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x847c('0x5'))('routing');var tag=schema({'tag':{'type':_0x847c('0x6'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x847c('0x7')]=function(_0x359188,_0x336b0c,_0x3ee25f,_0x1b6b4c){return function(_0x3a5bfb){try{var _0x27f9bf={'tag':_0x336b0c[0x0]};var _0x226b51=tag[_0x847c('0x0')](_0x27f9bf,{'typecast':!![]});if(_0x226b51[_0x847c('0x8')]){logger[_0x847c('0x9')]('[%s][TAG]\x20%s',_0x359188,_[_0x847c('0xa')](_0x226b51,_0x847c('0xb'))[_0x847c('0xc')](',\x20'));logger['info'](_0x847c('0xd'),_0x359188);_0x3a5bfb['next']();}else{var _0x3f6543={'ids':[_0x336b0c[0x0]]};if(rpc[_0x1b6b4c['channel']+'Interaction']){rpc[_0x1b6b4c[_0x847c('0xe')]+_0x847c('0xf')][_0x847c('0x10')](_0x1b6b4c[_0x847c('0x11')]['id'],_0x3f6543)[_0x847c('0x12')](function(_0x23be17){logger['info'](_0x847c('0x13'),_0x359188,_0x336b0c[0x1],_0x1b6b4c[_0x847c('0xe')],_0x1b6b4c[_0x847c('0x11')]['id']);})[_0x847c('0x14')](function(_0x1daeac){logger[_0x847c('0x9')]('[%s][TAG]\x20%s',_0x359188,JSON[_0x847c('0x15')](_0x1daeac));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x359188);})[_0x847c('0x16')](function(){_0x3a5bfb[_0x847c('0x17')]();});}}}catch(_0x4222ca){logger[_0x847c('0x9')](_0x847c('0x18'),_0x359188,_[_0x847c('0x19')](_0x4222ca)?JSON[_0x847c('0x15')](_0x4222ca):_0x4222ca);logger[_0x847c('0x1a')](_0x847c('0xd'),_0x359188);_0x3a5bfb[_0x847c('0x17')]();}};}; \ No newline at end of file +var _0xa05f=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa05f,0x106));var _0xfa05=function(_0x565b76,_0x1d150b){_0x565b76=_0x565b76-0x0;var _0x80f363=_0xa05f[_0x565b76];return _0x80f363;};'use strict';var schema=require(_0xfa05('0x0'));var _=require(_0xfa05('0x1'));var rpc={'chatInteraction':require(_0xfa05('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xfa05('0x3')),'mailInteraction':require(_0xfa05('0x4')),'faxInteraction':require(_0xfa05('0x5')),'whatsappInteraction':require(_0xfa05('0x6'))};var logger=require('../../../../config/logger')(_0xfa05('0x7'));var tag=schema({'tag':{'type':_0xfa05('0x8'),'required':!![],'message':_0xfa05('0x9')}});exports[_0xfa05('0xa')]=function(_0xd78aff,_0x3c6920,_0x2e504d,_0x259c3f){return function(_0x2cac9b){try{var _0x49e1f3={'tag':_0x3c6920[0x0]};var _0x44420a=tag[_0xfa05('0x0')](_0x49e1f3,{'typecast':!![]});if(_0x44420a[_0xfa05('0xb')]){logger['error'](_0xfa05('0xc'),_0xd78aff,_[_0xfa05('0xd')](_0x44420a,_0xfa05('0xe'))[_0xfa05('0xf')](',\x20'));logger[_0xfa05('0x10')](_0xfa05('0x11'),_0xd78aff);_0x2cac9b[_0xfa05('0x12')]();}else{var _0x1d7ab7={'ids':[_0x3c6920[0x0]]};if(rpc[_0x259c3f[_0xfa05('0x13')]+_0xfa05('0x14')]){rpc[_0x259c3f[_0xfa05('0x13')]+_0xfa05('0x14')][_0xfa05('0x15')](_0x259c3f[_0xfa05('0x16')]['id'],_0x1d7ab7)[_0xfa05('0x17')](function(_0x3db5be){logger['info'](_0xfa05('0x18'),_0xd78aff,_0x3c6920[0x1],_0x259c3f[_0xfa05('0x13')],_0x259c3f[_0xfa05('0x16')]['id']);})[_0xfa05('0x19')](function(_0x2a1a81){logger[_0xfa05('0x1a')](_0xfa05('0xc'),_0xd78aff,JSON[_0xfa05('0x1b')](_0x2a1a81));logger[_0xfa05('0x10')](_0xfa05('0x11'),_0xd78aff);})[_0xfa05('0x1c')](function(){_0x2cac9b[_0xfa05('0x12')]();});}}}catch(_0x38febd){logger[_0xfa05('0x1a')]('[%s][TAG]\x20%s',_0xd78aff,_[_0xfa05('0x1d')](_0x38febd)?JSON['stringify'](_0x38febd):_0x38febd);logger[_0xfa05('0x10')](_0xfa05('0x11'),_0xd78aff);_0x2cac9b['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 1478b17..87507b9 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d7f=['params','stringify','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','login','push'];(function(_0x41887a,_0x258971){var _0x5bd9fc=function(_0x450775){while(--_0x450775){_0x41887a['push'](_0x41887a['shift']());}};_0x5bd9fc(++_0x258971);}(_0x1d7f,0x75));var _0xf1d7=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1d7f[_0x397e5f];return _0x5302b8;};'use strict';var rp=require(_0xf1d7('0x0'));var logger=require(_0xf1d7('0x1'))(_0xf1d7('0x2'));var _=require(_0xf1d7('0x3'));var arr=[];exports['consequence']=function(_0xc53d1f,_0x4907f8){return function(_0x49ac3a){var _0x277045=_0x4907f8[0xa];var _0x57fbf3=_0x4907f8[0xb];var _0xf48cb6=_0x4907f8[0xc];var _0x40938d=_0x4907f8[0xd];var _0x4f1769=_0x4907f8[0xe];var _0x295de7=_0x4907f8[0xf][_0xf1d7('0x4')](/\n/g,_0xf1d7('0x5'));var _0x1c1ca7=_0x4907f8[0x10][_0xf1d7('0x4')](/\n/g,'\x20');if(!arr[_0xf1d7('0x6')](_0x57fbf3)){arr['push'](_0x57fbf3);var _0x217ef9=_0x4907f8[0x3];var _0x5aa57a=_0x4907f8[0x4];var _0x49e17d=_0x4907f8[0x1];var _0x12a107=_0x4907f8[0x0];var _0x4cb75d={};_0x4cb75d[_0xf1d7('0x7')]=_0x4907f8[0x8]+_0xf1d7('0x8')+_0xf48cb6+'|'+_0x277045+'|'+_0x40938d+'|'+_0x57fbf3+'|'+_0x4f1769;_0x4cb75d[_0xf1d7('0x9')]=_0x4907f8[0x7]+_0xf1d7('0x8')+_0xf48cb6+'|'+_0x277045+'|'+_0x40938d+'|'+_0x57fbf3+'|'+_0x4f1769+'|'+_0x295de7+'|'+_0x1c1ca7;_0x4cb75d[_0xf1d7('0xa')]=_0x4907f8[0x9];var _0x24c43={};_0x24c43[_0xf1d7('0xb')]=_0xf1d7('0xc');_0x24c43['method']=_0xf1d7('0xd');var _0x461ad7=[];_0x461ad7[_0xf1d7('0xe')](_0x4907f8[0x2]);_0x461ad7[_0xf1d7('0xe')](_0x4907f8[0x5]);_0x461ad7[_0xf1d7('0xe')](_0x4907f8[0x6]);_0x24c43[_0xf1d7('0xf')]=_0x461ad7;_0x24c43['id']=0x1;var _0x2b1f76=JSON[_0xf1d7('0x10')](_0x24c43);var _0x59334c={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x217ef9,'headers':{'Content-Type':'application/json-rpc'},'body':_0x2b1f76};return rp(_0x59334c)['then'](function(_0x521620){const _0x3756ed=JSON[_0xf1d7('0x11')](_0x521620);if(!_0x3756ed[_0xf1d7('0x12')][_0xf1d7('0x13')]){throw new Error(_0xf1d7('0x14'));}var _0x1220e9=_0x57fbf3;var _0x4f0ed6=_0xf1d7('0x15')+_0x49e17d+_0xf1d7('0x16')+_0x12a107+'&sessionId='+_0x1220e9+_0xf1d7('0x17')+JSON[_0xf1d7('0x10')](_0x4cb75d);var _0x3d36cf=_0x5aa57a+'?'+_0x4f0ed6;return rp(_0x3d36cf);})[_0xf1d7('0x18')](function(_0x418679){logger['info'](_0xf1d7('0x19'),_0xc53d1f,_0x418679);_0x49ac3a[_0xf1d7('0x1a')]();})[_0xf1d7('0x1b')](function(_0x92dbdc){logger['error'](_0xf1d7('0x1c'),_0xc53d1f,_[_0xf1d7('0x1d')](_0x92dbdc)?JSON['stringify'](_0x92dbdc):_0x92dbdc);_0x49ac3a['stop']();});}else{logger[_0xf1d7('0x1e')](_0xf1d7('0x1f'),_0xc53d1f);_0x49ac3a[_0xf1d7('0x20')]();}};}; \ No newline at end of file +var _0x619d=['info','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','params','stringify','utf8','application/json-rpc','then','parse','result','channelId=','&serviceId=','&sessionId=','&data='];(function(_0x342bf3,_0x1f18cc){var _0x1baa7a=function(_0x4ef8c3){while(--_0x4ef8c3){_0x342bf3['push'](_0x342bf3['shift']());}};_0x1baa7a(++_0x1f18cc);}(_0x619d,0x133));var _0xd619=function(_0x36c173,_0x4f0212){_0x36c173=_0x36c173-0x0;var _0x51a580=_0x619d[_0x36c173];return _0x51a580;};'use strict';var rp=require('request-promise');var logger=require(_0xd619('0x0'))('routing');var _=require(_0xd619('0x1'));var arr=[];exports['consequence']=function(_0x4ad0d2,_0x87c143){return function(_0x267fc9){var _0x5c078a=_0x87c143[0xa];var _0x52db06=_0x87c143[0xb];var _0x38f24f=_0x87c143[0xc];var _0x34608f=_0x87c143[0xd];var _0x1c2aac=_0x87c143[0xe];var _0xaf17cb=_0x87c143[0xf][_0xd619('0x2')](/\n/g,_0xd619('0x3'));var _0x44198f=_0x87c143[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xd619('0x4')](_0x52db06)){arr[_0xd619('0x5')](_0x52db06);var _0x2f9a35=_0x87c143[0x3];var _0x5357a8=_0x87c143[0x4];var _0x463b82=_0x87c143[0x1];var _0x5b7b02=_0x87c143[0x0];var _0x46c4c8={};_0x46c4c8[_0xd619('0x6')]=_0x87c143[0x8]+_0xd619('0x7')+_0x38f24f+'|'+_0x5c078a+'|'+_0x34608f+'|'+_0x52db06+'|'+_0x1c2aac;_0x46c4c8[_0xd619('0x8')]=_0x87c143[0x7]+'?params='+_0x38f24f+'|'+_0x5c078a+'|'+_0x34608f+'|'+_0x52db06+'|'+_0x1c2aac+'|'+_0xaf17cb+'|'+_0x44198f;_0x46c4c8['title']=_0x87c143[0x9];var _0x3b5378={};_0x3b5378[_0xd619('0x9')]=_0xd619('0xa');_0x3b5378[_0xd619('0xb')]='login';var _0x3cce7c=[];_0x3cce7c[_0xd619('0x5')](_0x87c143[0x2]);_0x3cce7c['push'](_0x87c143[0x5]);_0x3cce7c['push'](_0x87c143[0x6]);_0x3b5378[_0xd619('0xc')]=_0x3cce7c;_0x3b5378['id']=0x1;var _0x1cebc5=JSON[_0xd619('0xd')](_0x3b5378);var _0xa9ff5e={'encoding':_0xd619('0xe'),'method':'POST','timeout':0x2710,'url':_0x2f9a35,'headers':{'Content-Type':_0xd619('0xf')},'body':_0x1cebc5};return rp(_0xa9ff5e)[_0xd619('0x10')](function(_0x4cd9f0){const _0x240b3b=JSON[_0xd619('0x11')](_0x4cd9f0);if(!_0x240b3b[_0xd619('0x12')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x8a3879=_0x52db06;var _0x5aabd8=_0xd619('0x13')+_0x463b82+_0xd619('0x14')+_0x5b7b02+_0xd619('0x15')+_0x8a3879+_0xd619('0x16')+JSON['stringify'](_0x46c4c8);var _0xe7cc5b=_0x5357a8+'?'+_0x5aabd8;return rp(_0xe7cc5b);})[_0xd619('0x10')](function(_0x3a7fe1){logger[_0xd619('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4ad0d2,_0x3a7fe1);_0x267fc9[_0xd619('0x18')]();})[_0xd619('0x19')](function(_0x3f75ab){logger[_0xd619('0x1a')](_0xd619('0x1b'),_0x4ad0d2,_['isObject'](_0x3f75ab)?JSON['stringify'](_0x3f75ab):_0x3f75ab);_0x267fc9[_0xd619('0x18')]();});}else{logger[_0xd619('0x17')](_0xd619('0x1c'),_0x4ad0d2);_0x267fc9[_0xd619('0x1d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 7c89258..486eb03 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x555216,_0x2c83b9){var _0x4b0a7a=function(_0x4dbef1){while(--_0x4dbef1){_0x555216['push'](_0x555216['shift']());}};_0x4b0a7a(++_0x2c83b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x4b778b,_0x4cf753){var _0x1c7151=function(_0x47be9b){while(--_0x47be9b){_0x4b778b['push'](_0x4b778b['shift']());}};_0x1c7151(++_0x4cf753);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index fdab24e..562179f 100644 --- a/server/services/routing/server/index.js +++ b/server/services/routing/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x720c=['update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','account','notificationTemplate','body','format','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport'];(function(_0x7b7f8f,_0x22b2b5){var _0xb9d0e=function(_0x24e478){while(--_0x24e478){_0x7b7f8f['push'](_0x7b7f8f['shift']());}};_0xb9d0e(++_0x22b2b5);}(_0x720c,0x154));var _0xc720=function(_0xa75b7a,_0x26f042){_0xa75b7a=_0xa75b7a-0x0;var _0x5bf337=_0x720c[_0xa75b7a];return _0x5bf337;};'use strict';var _=require(_0xc720('0x0'));var util=require('util');var path=require(_0xc720('0x1'));var fs=require('fs');var jayson=require(_0xc720('0x2'));var BPromise=require(_0xc720('0x3'));var uuid=require(_0xc720('0x4'));var utils=require('./applications/utils');var config=require(_0xc720('0x5'));var logger=require(_0xc720('0x6'))(_0xc720('0x7'));var rpc={'openchannelQueueReport':require(_0xc720('0x8')),'mailQueueReport':require(_0xc720('0x9')),'chatQueueReport':require(_0xc720('0xa')),'smsQueueReport':require(_0xc720('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xc720('0xc'))};var RuleEngine=require(_0xc720('0xd'));function getId(_0x10a2c8,_0x1a2a00,_0xd3b083){return util['format']('%s.%s.%s',_0x10a2c8,_0x1a2a00||0x0,_0xd3b083||0x0);}function getIntervals(_0x106f93,_0x4bea5d){var _0x2d0a1d=[];if(!_[_0xc720('0xe')](_0x4bea5d['IntervalId'])&&!_[_0xc720('0xe')](_0x106f93[_0x4bea5d[_0xc720('0xf')]])&&!_[_0xc720('0xe')](_0x106f93[_0x4bea5d[_0xc720('0xf')]][_0xc720('0x10')])){_0x2d0a1d=_['map'](_0x106f93[_0x4bea5d[_0xc720('0xf')]][_0xc720('0x10')],_0xc720('0x11'));}else if(!_[_0xc720('0xe')](_0x4bea5d['interval'])){_0x2d0a1d=[_0x4bea5d[_0xc720('0x11')]];}return _0x2d0a1d;}exports[_0xc720('0x12')]=function(_0x3df0eb){_0x3df0eb['rules']={};return new BPromise(function(_0x475cf9,_0xc41ec9){var _0x37f24d={'Start':function(_0x2f7eaf){var _0xebcb34=this;return new Promise(function(_0x4f351a,_0x59a614){if(_0x2f7eaf){try{var _0x29fd3f=[];var _0x583e07=getId(_0x2f7eaf[_0xc720('0x13')],_0x2f7eaf[_0xc720('0x14')]?_0x2f7eaf['message']['id']:0x0,_0x2f7eaf[_0xc720('0x15')]?_0x2f7eaf[_0xc720('0x15')]['id']:0x0);if(_0x2f7eaf[_0xc720('0x16')]&&_[_0xc720('0x17')](_0x2f7eaf[_0xc720('0x16')])&&_0x2f7eaf[_0xc720('0x16')][_0xc720('0x18')]){for(var _0x496604=0x0;_0x496604<_0x2f7eaf[_0xc720('0x16')]['length'];_0x496604+=0x1){var _0x565252=_0x2f7eaf['applications'][_0x496604];if(fs[_0xc720('0x19')](path[_0xc720('0x1a')](__dirname,_0xc720('0x16'),_0x565252[_0xc720('0x1b')]+_0xc720('0x1c')))){var _0x4f0312=[];switch(_0x565252[_0xc720('0x1b')]['toLowerCase']()){case _0xc720('0x1d'):var _0x5e7d60=_0x565252[_0xc720('0x1e')][_0xc720('0x1f')](',');if(_0x2f7eaf['channel']===_0xc720('0x20')){_0x4f0312[_0xc720('0x21')](_0x5e7d60[0x0]);_0x4f0312[_0xc720('0x21')](_0x5e7d60[0x1]);_0x4f0312[_0xc720('0x21')](_0x5e7d60[_0xc720('0x22')](0x2,_0x5e7d60[_0xc720('0x18')])[_0xc720('0x1a')](','));}else{_0x4f0312['push'](_0x5e7d60[0x0]);_0x4f0312[_0xc720('0x21')](_0x5e7d60[_0xc720('0x22')](0x1,_0x5e7d60['length'])[_0xc720('0x1a')](','));}break;case _0xc720('0x23'):var _0x4ff333=_0x565252[_0xc720('0x1e')]['split'](',');_0x4f0312[_0xc720('0x21')](_0x4ff333[0x0]);_0x4f0312[_0xc720('0x21')](_0x4ff333[0x1]);_0x4f0312[_0xc720('0x21')](_0x4ff333[_0xc720('0x22')](0x2,_0x4ff333[_0xc720('0x18')])[_0xc720('0x1a')](','));break;case _0xc720('0x24'):var _0x54e736=_0x565252['appdata'][_0xc720('0x1f')](',');_0x4f0312[_0xc720('0x21')](_0x54e736[0x0]);_0x4f0312['push'](_0x54e736[0x1]);_0x4f0312[_0xc720('0x21')](_0x54e736[0x2]);_0x4f0312['push'](_0x54e736[0x3]);_0x4f0312[_0xc720('0x21')](_0x54e736[_0xc720('0x22')](0x4,_0x54e736['length'])[_0xc720('0x1a')](','));break;case _0xc720('0x25'):var _0x99c86e=_0x565252[_0xc720('0x1e')][_0xc720('0x1f')](',');_0x4f0312[_0xc720('0x21')](_0x99c86e[0x0]);_0x4f0312[_0xc720('0x21')](_0x99c86e[0x1]);_0x4f0312[_0xc720('0x21')](_0x99c86e[0x2]);_0x4f0312[_0xc720('0x21')](_0x99c86e[0x3]);_0x4f0312[_0xc720('0x21')](_0x99c86e['slice'](0x4,_0x99c86e[_0xc720('0x18')])['join'](','));break;case _0xc720('0x14'):_0x4f0312['push'](_0x565252['appdata']);break;case _0xc720('0x26'):_0x4f0312[_0xc720('0x21')](_0x565252[_0xc720('0x27')]);_0x4f0312[_0xc720('0x21')](_0x565252['appdata']);break;case _0xc720('0x28'):var _0x1a4511=utils['getMustacheRender'](_0x2f7eaf[_0xc720('0x29')][_0xc720('0x2a')],_0x2f7eaf);var _0x192826=_0x565252[_0xc720('0x1e')]['split'](',');_0x4f0312[_0xc720('0x21')](_0x192826[0x0]);_0x4f0312[_0xc720('0x21')](_0x192826[0x1]);_0x4f0312['push'](_0x192826[0x2]);_0x4f0312['push'](_0x192826[0x3]);_0x4f0312[_0xc720('0x21')](_0x192826[0x4]);_0x4f0312[_0xc720('0x21')](_0x192826[0x5]);_0x4f0312['push'](_0x192826[0x6]);_0x4f0312[_0xc720('0x21')](_0x192826[0x7]);_0x4f0312['push'](_0x192826[0x8]);_0x4f0312[_0xc720('0x21')](_0x192826[0x9]);_0x4f0312[_0xc720('0x21')](_0x192826[0xa]);_0x4f0312[_0xc720('0x21')](_0x2f7eaf[_0xc720('0x15')]['id']);_0x4f0312[_0xc720('0x21')](_0x2f7eaf['message']['id']);_0x4f0312[_0xc720('0x21')](_0x565252['ChatWebsiteId']);_0x4f0312[_0xc720('0x21')](_0x2f7eaf['interaction']['ContactId']);_0x4f0312[_0xc720('0x21')](_0x2f7eaf[_0xc720('0x2b')][_0xc720('0x2b')]);_0x4f0312[_0xc720('0x21')](_0x1a4511);break;default:_0x4f0312=_[_0xc720('0xe')](_0x565252['appdata'])?[]:_0x565252[_0xc720('0x1e')]['split'](',');}var _0x427145={'id':util[_0xc720('0x2c')]('%s:%s:%s',_0x583e07,_0x565252['id'],_0x565252[_0xc720('0x1b')]),'condition':require(_0xc720('0x2d'))[_0xc720('0x2e')](_0x583e07,getIntervals(_0x3df0eb[_0xc720('0x2f')],_0x565252),_0x3df0eb),'consequence':require(_0xc720('0x30')+_0x565252[_0xc720('0x1b')])[_0xc720('0x31')](_0x583e07,_0x4f0312,_0x3df0eb,_0x2f7eaf),'p':_0x565252['priority']||0x0};logger[_0xc720('0x32')](_0xc720('0x33'),_0x427145['id'],_0xc720('0x34'),getIntervals(_0x3df0eb['intervals'],_0x565252)[_0xc720('0x1a')](_0xc720('0x35')));_0x29fd3f[_0xc720('0x21')](_0x427145);}else{logger[_0xc720('0x36')](_0xc720('0x37'),path[_0xc720('0x1a')](__dirname,_0xc720('0x16'),_0x565252[_0xc720('0x1b')]+_0xc720('0x1c')));}}_0x3df0eb['rules'][_0x583e07]=new RuleEngine(_0x29fd3f);_0x3df0eb[_0xc720('0x38')][_0x583e07][_0xc720('0x39')](_0x2f7eaf,function(_0x1b292e){logger['info'](_0xc720('0x3a'),JSON[_0xc720('0x3b')](_0x1b292e[_0xc720('0x3c')]));if(_0x3df0eb['rules'][_0x583e07]){_0x3df0eb[_0xc720('0x38')][_0x583e07][_0xc720('0x3d')](_0xc720('0x3e'));}});return _0x4f351a({'code':0xc8,'message':_0x2f7eaf});}else{logger[_0xc720('0x32')](_0xc720('0x3f'));return _0x4f351a({'code':0xc8,'message':_0x2f7eaf});}}catch(_0x2ce582){logger[_0xc720('0x36')](_0x2ce582[_0xc720('0x40')]);return _0x59a614(_0xebcb34['error'](0x1f4,_0x2ce582));}}return _0x59a614(_0xc720('0x41'));});},'AcceptMessage':function(_0x3a20bd){var _0x744344=this;return new Promise(function(_0x105438,_0x288866){if(_0x3a20bd[_0xc720('0x42')]&&_0x3a20bd['agent']['id']){if(_0x3df0eb[_0xc720('0x43')][_0x3a20bd['agent']['id']]){_0x3df0eb[_0xc720('0x43')][_0x3a20bd[_0xc720('0x42')]['id']][_0xc720('0x44')]=![];_0x3df0eb[_0xc720('0x43')][_0x3a20bd['agent']['id']][_0xc720('0x45')]=undefined;}}if(_0x3a20bd[_0xc720('0x14')]&&_0x3a20bd[_0xc720('0x14')]['id']){try{var _0x57f100=getId(_0x3a20bd['channel'],_0x3a20bd['message']?_0x3a20bd['message']['id']:0x0,_0x3a20bd[_0xc720('0x15')]?_0x3a20bd[_0xc720('0x15')]['id']:0x0);if(_0x3df0eb['rules'][_0x57f100]){_0x3df0eb[_0xc720('0x38')][_0x57f100]['emit'](_0xc720('0x46'));if(rpc[_0x3a20bd['channel']+_0xc720('0x47')]){rpc[_0x3a20bd[_0xc720('0x13')]+'QueueReport'][_0xc720('0x48')](_0x57f100,{'UserId':_0x3a20bd[_0xc720('0x14')]['UserId']})[_0xc720('0x49')](function(_0x1d1d8c){logger['error'](_0xc720('0x4a'));});}}return _0x105438({'code':0xc8,'message':_0x3a20bd});}catch(_0x22ac1b){logger[_0xc720('0x36')](_0x22ac1b[_0xc720('0x40')]);return _0x288866(_0x744344[_0xc720('0x36')](0x1f4,_0x22ac1b));}}logger[_0xc720('0x36')]('message\x20is\x20empty');return _0x288866(_0x744344['error'](0x1f4,_0xc720('0x4b')));});},'RejectMessage':function(_0xd3f375){var _0x3a800d=this;return new Promise(function(_0x3da8d7,_0x2778e2){if(_0xd3f375['agent']&&_0xd3f375[_0xc720('0x42')]['id']){try{if(_0x3df0eb['agents'][_0xd3f375[_0xc720('0x42')]['id']]){_0x3df0eb[_0xc720('0x43')][_0xd3f375[_0xc720('0x42')]['id']][_0xc720('0x44')]=![];_0x3df0eb[_0xc720('0x43')][_0xd3f375[_0xc720('0x42')]['id']][_0xc720('0x45')]=undefined;}return _0x3da8d7({'code':0xc8,'message':_0xd3f375});}catch(_0x2d31be){logger[_0xc720('0x36')](_0x2d31be[_0xc720('0x40')]);return _0x2778e2(_0x3a800d[_0xc720('0x36')](0x1f4,_0x2d31be));}}logger[_0xc720('0x36')](_0xc720('0x4b'));return _0x2778e2(_0x3a800d[_0xc720('0x36')](0x1f4,_0xc720('0x4b')));});},'AbandonInteraction':function(_0x3930a4){var _0x1a4bd8=this;return new Promise(function(_0x3272e7,_0x2dbda1){if(_0x3930a4[_0xc720('0x13')]&&_0x3930a4[_0xc720('0x15')]&&_0x3930a4['interaction']['id']){try{var _0x11e2c7=getId(_0x3930a4[_0xc720('0x13')],_0x3930a4[_0xc720('0x14')]?_0x3930a4[_0xc720('0x14')]['id']:0x0,_0x3930a4[_0xc720('0x15')]?_0x3930a4[_0xc720('0x15')]['id']:0x0);if(_0x3df0eb['rules'][_0x11e2c7]){_0x3df0eb['rules'][_0x11e2c7]['emit'](_0xc720('0x46'));}return _0x3272e7({'code':0xc8,'message':_0x3930a4});}catch(_0x2f7d92){logger['error'](_0x2f7d92['stack']);return _0x2dbda1(_0x1a4bd8[_0xc720('0x36')](0x1f4,_0x2f7d92));}}logger[_0xc720('0x36')]('message\x20is\x20empty');return _0x2dbda1(_0x1a4bd8['error'](0x1f4,_0xc720('0x4b')));});},'AgentCapacity':function(_0x3dba57){var _0x5d9529=this;return new Promise(function(_0x12e021,_0x3c1992){if(_0x3df0eb[_0xc720('0x43')][_0xc720('0x4c')](_0x3dba57['id'])){for(var _0xeea761 in _0x3dba57[_0xc720('0x4d')]){if(_0x3dba57[_0xc720('0x4d')]['hasOwnProperty'](_0xeea761)){if(_0x3df0eb[_0xc720('0x43')][_0x3dba57['id']][_0xc720('0x4c')](_0xeea761+_0xc720('0x4e'))){_0x3df0eb[_0xc720('0x43')][_0x3dba57['id']][_0xeea761+_0xc720('0x4e')]=parseInt(_0x3dba57[_0xc720('0x4d')][_0xeea761],0xa);}}}_0x3df0eb['agents'][_0x3dba57['id']][_0xc720('0x4f')]();return _0x12e021({'code':0xc8,'message':_0x3df0eb[_0xc720('0x43')][_0x3dba57['id']]});}else{return _0x3c1992(_0x5d9529[_0xc720('0x36')](0x1f4,_0xc720('0x50')));}});},'Agents':function(_0x19784d){return new Promise(function(_0x135377,_0xc98dbc){var _0x58e517=_[_0xc720('0x51')](_0x3df0eb[_0xc720('0x43')]);_0x135377({'count':_0x58e517['length'],'rows':_0x58e517});});},'ChatQueues':function(_0x1055a4){return new Promise(function(_0x148276,_0xff64cf){var _0x2e2681=[];for(var _0x405d20 in _0x3df0eb[_0xc720('0x52')]){if(_0x3df0eb['chatQueues']['hasOwnProperty'](_0x405d20)){var _0x86e09f=_0x3df0eb[_0xc720('0x52')][_0x405d20];var _0x296519={'id':_0x86e09f['id'],'available':_0x86e09f['available'],'loggedIn':_0x86e09f[_0xc720('0x53')],'name':_0x86e09f['name'],'paused':_0x86e09f[_0xc720('0x54')],'waiting':_0x86e09f[_0xc720('0x55')]};_0x2e2681[_0xc720('0x21')](_0x296519);}}_0x148276({'count':_0x2e2681[_0xc720('0x18')],'rows':_0x2e2681});});},'MailQueues':function(_0x1b1a88){return new Promise(function(_0x3d1438,_0x5040cf){var _0x147150=[];for(var _0x163727 in _0x3df0eb['mailQueues']){if(_0x3df0eb[_0xc720('0x56')][_0xc720('0x4c')](_0x163727)){var _0x493443=_0x3df0eb[_0xc720('0x56')][_0x163727];var _0x2d3990={'id':_0x493443['id'],'available':_0x493443['available'],'loggedIn':_0x493443[_0xc720('0x53')],'name':_0x493443[_0xc720('0x57')],'paused':_0x493443[_0xc720('0x54')],'waiting':_0x493443[_0xc720('0x55')]};_0x147150[_0xc720('0x21')](_0x2d3990);}}_0x3d1438({'count':_0x147150[_0xc720('0x18')],'rows':_0x147150});});},'OpenchannelQueues':function(_0x1f3c99){return new Promise(function(_0x421d62,_0x46e301){var _0x111d05=[];for(var _0x52828f in _0x3df0eb[_0xc720('0x58')]){if(_0x3df0eb[_0xc720('0x58')][_0xc720('0x4c')](_0x52828f)){var _0xf2f53e=_0x3df0eb[_0xc720('0x58')][_0x52828f];var _0x2ab2e9={'id':_0xf2f53e['id'],'available':_0xf2f53e[_0xc720('0x59')],'loggedIn':_0xf2f53e[_0xc720('0x53')],'name':_0xf2f53e[_0xc720('0x57')],'paused':_0xf2f53e[_0xc720('0x54')],'waiting':_0xf2f53e[_0xc720('0x55')]};_0x111d05[_0xc720('0x21')](_0x2ab2e9);}}_0x421d62({'count':_0x111d05[_0xc720('0x18')],'rows':_0x111d05});});},'SmsQueues':function(_0x5ca8d5){return new Promise(function(_0x51f28d,_0x585808){var _0x27b219=[];for(var _0x4b9687 in _0x3df0eb[_0xc720('0x5a')]){if(_0x3df0eb['smsQueues']['hasOwnProperty'](_0x4b9687)){var _0x5937fb=_0x3df0eb[_0xc720('0x5a')][_0x4b9687];var _0x1bbf51={'id':_0x5937fb['id'],'available':_0x5937fb['available'],'loggedIn':_0x5937fb[_0xc720('0x53')],'name':_0x5937fb[_0xc720('0x57')],'paused':_0x5937fb[_0xc720('0x54')],'waiting':_0x5937fb['waiting']};_0x27b219[_0xc720('0x21')](_0x1bbf51);}}_0x51f28d({'count':_0x27b219[_0xc720('0x18')],'rows':_0x27b219});});},'FaxQueues':function(_0xdcc8f2){return new Promise(function(_0x18d5d6,_0x14e729){var _0x5eb2a7=[];for(var _0x211a01 in _0x3df0eb[_0xc720('0x5b')]){if(_0x3df0eb[_0xc720('0x5b')][_0xc720('0x4c')](_0x211a01)){var _0x40cd62=_0x3df0eb[_0xc720('0x5b')][_0x211a01];var _0x4a3886={'id':_0x40cd62['id'],'available':_0x40cd62[_0xc720('0x59')],'loggedIn':_0x40cd62[_0xc720('0x53')],'name':_0x40cd62[_0xc720('0x57')],'paused':_0x40cd62['paused'],'waiting':_0x40cd62[_0xc720('0x55')]};_0x5eb2a7[_0xc720('0x21')](_0x4a3886);}}_0x18d5d6({'count':_0x5eb2a7[_0xc720('0x18')],'rows':_0x5eb2a7});});},'WhatsappQueues':function(_0x5b56b2){return new Promise(function(_0x326c7e,_0x116acc){var _0x4226a5=[];for(var _0x36ba41 in _0x3df0eb[_0xc720('0x5c')]){if(_0x3df0eb[_0xc720('0x5c')]['hasOwnProperty'](_0x36ba41)){var _0x5b8e9f=_0x3df0eb[_0xc720('0x5c')][_0x36ba41];var _0x211e16={'id':_0x5b8e9f['id'],'available':_0x5b8e9f[_0xc720('0x59')],'loggedIn':_0x5b8e9f[_0xc720('0x53')],'name':_0x5b8e9f[_0xc720('0x57')],'paused':_0x5b8e9f['paused'],'waiting':_0x5b8e9f[_0xc720('0x55')]};_0x4226a5['push'](_0x211e16);}}_0x326c7e({'count':_0x4226a5[_0xc720('0x18')],'rows':_0x4226a5});});},'ChatQueuesWaitingInteractions':function(_0x3150fa){return new Promise(function(_0x525167,_0x77c32d){var _0x5c8799=_[_0xc720('0x51')](_0x3df0eb[_0xc720('0x5d')]);_0x525167({'count':_0x5c8799['length'],'rows':_0x5c8799});});},'MailQueuesWaitingInteractions':function(_0x55cc7e){return new Promise(function(_0x3d768a,_0x25d3f6){var _0x143345=_[_0xc720('0x51')](_0x3df0eb[_0xc720('0x5e')]);_0x3d768a({'count':_0x143345[_0xc720('0x18')],'rows':_0x143345});});},'OpenchannelQueuesWaitingInteractions':function(_0x2ccb69){return new Promise(function(_0x10ead0,_0xb4a710){var _0x37e153=_[_0xc720('0x51')](_0x3df0eb['openchannelQueuesWaitingInteractions']);_0x10ead0({'count':_0x37e153['length'],'rows':_0x37e153});});},'SmsQueuesWaitingInteractions':function(_0x5ea92c){return new Promise(function(_0x4e36aa,_0x5805b9){var _0x3493b1=_[_0xc720('0x51')](_0x3df0eb[_0xc720('0x5f')]);_0x4e36aa({'count':_0x3493b1[_0xc720('0x18')],'rows':_0x3493b1});});},'FaxQueuesWaitingInteractions':function(_0x1e45a1){return new Promise(function(_0x3d2996,_0x1e600e){var _0x59e69e=_[_0xc720('0x51')](_0x3df0eb[_0xc720('0x60')]);_0x3d2996({'count':_0x59e69e[_0xc720('0x18')],'rows':_0x59e69e});});},'WhatsappQueuesWaitingInteractions':function(_0x348a9a){return new Promise(function(_0x4f7e24,_0x308806){var _0x3d7421=_[_0xc720('0x51')](_0x3df0eb[_0xc720('0x61')]);_0x4f7e24({'count':_0x3d7421[_0xc720('0x18')],'rows':_0x3d7421});});}};var _0x11d1f8=jayson[_0xc720('0x62')](_0x37f24d)[_0xc720('0x63')]();_0x11d1f8['on'](_0xc720('0x36'),function(_0x30ac2e){logger[_0xc720('0x36')](JSON[_0xc720('0x3b')](_0x30ac2e));return _0xc41ec9(_0x30ac2e);});_0x11d1f8[_0xc720('0x12')](0x232c,_0xc720('0x64'),function(){console[_0xc720('0x65')](_0xc720('0x66'),0x232c);return _0x475cf9('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xc788=['../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','IntervalId','isNil','map','interval','listen','rules','channel','message','interaction','isArray','length','applications','join','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','app','./interval','intervals','./applications/','priority','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','error','stack','routing\x20is\x20empty','agent','busy','agents','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','uuid','./applications/utils','../../../config/environment'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xc788,0xc4));var _0x8c78=function(_0x515283,_0x813dea){_0x515283=_0x515283-0x0;var _0x38f836=_0xc788[_0x515283];return _0x38f836;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x8c78('0x3'));var utils=require(_0x8c78('0x4'));var config=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x8c78('0x8')),'chatQueueReport':require(_0x8c78('0x9')),'smsQueueReport':require(_0x8c78('0xa')),'faxQueueReport':require(_0x8c78('0xb')),'whatsappQueueReport':require(_0x8c78('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x247188,_0x299d9d,_0x9bc075){return util[_0x8c78('0xd')](_0x8c78('0xe'),_0x247188,_0x299d9d||0x0,_0x9bc075||0x0);}function getIntervals(_0x39e116,_0x4f3e43){var _0x13db9c=[];if(!_['isNil'](_0x4f3e43[_0x8c78('0xf')])&&!_[_0x8c78('0x10')](_0x39e116[_0x4f3e43['IntervalId']])&&!_[_0x8c78('0x10')](_0x39e116[_0x4f3e43[_0x8c78('0xf')]]['Intervals'])){_0x13db9c=_[_0x8c78('0x11')](_0x39e116[_0x4f3e43['IntervalId']]['Intervals'],_0x8c78('0x12'));}else if(!_[_0x8c78('0x10')](_0x4f3e43[_0x8c78('0x12')])){_0x13db9c=[_0x4f3e43[_0x8c78('0x12')]];}return _0x13db9c;}exports[_0x8c78('0x13')]=function(_0x3d1306){_0x3d1306[_0x8c78('0x14')]={};return new BPromise(function(_0x930233,_0x2f44af){var _0x1157d0={'Start':function(_0x4ff4b0){var _0x1fa78e=this;return new Promise(function(_0x293cfe,_0x57ad11){if(_0x4ff4b0){try{var _0x45b85f=[];var _0x554464=getId(_0x4ff4b0[_0x8c78('0x15')],_0x4ff4b0[_0x8c78('0x16')]?_0x4ff4b0[_0x8c78('0x16')]['id']:0x0,_0x4ff4b0[_0x8c78('0x17')]?_0x4ff4b0['interaction']['id']:0x0);if(_0x4ff4b0['applications']&&_[_0x8c78('0x18')](_0x4ff4b0['applications'])&&_0x4ff4b0['applications'][_0x8c78('0x19')]){for(var _0x56c191=0x0;_0x56c191<_0x4ff4b0[_0x8c78('0x1a')][_0x8c78('0x19')];_0x56c191+=0x1){var _0x517cde=_0x4ff4b0[_0x8c78('0x1a')][_0x56c191];if(fs['existsSync'](path[_0x8c78('0x1b')](__dirname,_0x8c78('0x1a'),_0x517cde['app']+_0x8c78('0x1c')))){var _0x188cc3=[];switch(_0x517cde['app'][_0x8c78('0x1d')]()){case _0x8c78('0x1e'):var _0x3cda9a=_0x517cde[_0x8c78('0x1f')][_0x8c78('0x20')](',');if(_0x4ff4b0[_0x8c78('0x15')]===_0x8c78('0x21')){_0x188cc3[_0x8c78('0x22')](_0x3cda9a[0x0]);_0x188cc3[_0x8c78('0x22')](_0x3cda9a[0x1]);_0x188cc3['push'](_0x3cda9a[_0x8c78('0x23')](0x2,_0x3cda9a[_0x8c78('0x19')])[_0x8c78('0x1b')](','));}else{_0x188cc3['push'](_0x3cda9a[0x0]);_0x188cc3[_0x8c78('0x22')](_0x3cda9a['slice'](0x1,_0x3cda9a[_0x8c78('0x19')])[_0x8c78('0x1b')](','));}break;case _0x8c78('0x24'):var _0x496c51=_0x517cde[_0x8c78('0x1f')][_0x8c78('0x20')](',');_0x188cc3['push'](_0x496c51[0x0]);_0x188cc3[_0x8c78('0x22')](_0x496c51[0x1]);_0x188cc3[_0x8c78('0x22')](_0x496c51[_0x8c78('0x23')](0x2,_0x496c51[_0x8c78('0x19')])[_0x8c78('0x1b')](','));break;case _0x8c78('0x25'):var _0x5ba7d4=_0x517cde[_0x8c78('0x1f')]['split'](',');_0x188cc3[_0x8c78('0x22')](_0x5ba7d4[0x0]);_0x188cc3[_0x8c78('0x22')](_0x5ba7d4[0x1]);_0x188cc3[_0x8c78('0x22')](_0x5ba7d4[0x2]);_0x188cc3['push'](_0x5ba7d4[0x3]);_0x188cc3[_0x8c78('0x22')](_0x5ba7d4[_0x8c78('0x23')](0x4,_0x5ba7d4['length'])[_0x8c78('0x1b')](','));break;case _0x8c78('0x26'):var _0x32bc1f=_0x517cde['appdata'][_0x8c78('0x20')](',');_0x188cc3[_0x8c78('0x22')](_0x32bc1f[0x0]);_0x188cc3[_0x8c78('0x22')](_0x32bc1f[0x1]);_0x188cc3['push'](_0x32bc1f[0x2]);_0x188cc3[_0x8c78('0x22')](_0x32bc1f[0x3]);_0x188cc3[_0x8c78('0x22')](_0x32bc1f['slice'](0x4,_0x32bc1f[_0x8c78('0x19')])[_0x8c78('0x1b')](','));break;case _0x8c78('0x16'):_0x188cc3[_0x8c78('0x22')](_0x517cde[_0x8c78('0x1f')]);break;case _0x8c78('0x27'):_0x188cc3[_0x8c78('0x22')](_0x517cde[_0x8c78('0x28')]);_0x188cc3[_0x8c78('0x22')](_0x517cde[_0x8c78('0x1f')]);break;case'tvox':var _0x3e9bf1=utils[_0x8c78('0x29')](_0x4ff4b0[_0x8c78('0x2a')][_0x8c78('0x2b')],_0x4ff4b0);var _0x34481a=_0x517cde['appdata'][_0x8c78('0x20')](',');_0x188cc3[_0x8c78('0x22')](_0x34481a[0x0]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x1]);_0x188cc3['push'](_0x34481a[0x2]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x3]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x4]);_0x188cc3['push'](_0x34481a[0x5]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x6]);_0x188cc3['push'](_0x34481a[0x7]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x8]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x9]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0xa]);_0x188cc3[_0x8c78('0x22')](_0x4ff4b0['interaction']['id']);_0x188cc3[_0x8c78('0x22')](_0x4ff4b0['message']['id']);_0x188cc3[_0x8c78('0x22')](_0x517cde[_0x8c78('0x2c')]);_0x188cc3[_0x8c78('0x22')](_0x4ff4b0['interaction']['ContactId']);_0x188cc3[_0x8c78('0x22')](_0x4ff4b0[_0x8c78('0x2d')][_0x8c78('0x2d')]);_0x188cc3[_0x8c78('0x22')](_0x3e9bf1);break;default:_0x188cc3=_[_0x8c78('0x10')](_0x517cde[_0x8c78('0x1f')])?[]:_0x517cde[_0x8c78('0x1f')][_0x8c78('0x20')](',');}var _0x1f0a2b={'id':util[_0x8c78('0xd')](_0x8c78('0x2e'),_0x554464,_0x517cde['id'],_0x517cde[_0x8c78('0x2f')]),'condition':require(_0x8c78('0x30'))['condition'](_0x554464,getIntervals(_0x3d1306[_0x8c78('0x31')],_0x517cde),_0x3d1306),'consequence':require(_0x8c78('0x32')+_0x517cde['app'])['consequence'](_0x554464,_0x188cc3,_0x3d1306,_0x4ff4b0),'p':_0x517cde[_0x8c78('0x33')]||0x0};logger[_0x8c78('0x34')]('Push\x20new\x20rule',_0x1f0a2b['id'],_0x8c78('0x35'),getIntervals(_0x3d1306[_0x8c78('0x31')],_0x517cde)['join'](_0x8c78('0x36')));_0x45b85f[_0x8c78('0x22')](_0x1f0a2b);}else{logger['error'](_0x8c78('0x37'),path[_0x8c78('0x1b')](__dirname,_0x8c78('0x1a'),_0x517cde[_0x8c78('0x2f')]+_0x8c78('0x1c')));}}_0x3d1306['rules'][_0x554464]=new RuleEngine(_0x45b85f);_0x3d1306['rules'][_0x554464][_0x8c78('0x38')](_0x4ff4b0,function(_0x2f6a6b){logger[_0x8c78('0x34')](_0x8c78('0x39'),JSON[_0x8c78('0x3a')](_0x2f6a6b[_0x8c78('0x3b')]));if(_0x3d1306[_0x8c78('0x14')][_0x554464]){_0x3d1306[_0x8c78('0x14')][_0x554464][_0x8c78('0x3c')](_0x8c78('0x3d'));}});return _0x293cfe({'code':0xc8,'message':_0x4ff4b0});}else{logger[_0x8c78('0x34')]('No\x20applications\x20to\x20execute');return _0x293cfe({'code':0xc8,'message':_0x4ff4b0});}}catch(_0x1015bf){logger[_0x8c78('0x3e')](_0x1015bf[_0x8c78('0x3f')]);return _0x57ad11(_0x1fa78e[_0x8c78('0x3e')](0x1f4,_0x1015bf));}}return _0x57ad11(_0x8c78('0x40'));});},'AcceptMessage':function(_0x556a51){var _0x356e47=this;return new Promise(function(_0x4588cd,_0x464601){if(_0x556a51[_0x8c78('0x41')]&&_0x556a51[_0x8c78('0x41')]['id']){if(_0x3d1306['agents'][_0x556a51[_0x8c78('0x41')]['id']]){_0x3d1306['agents'][_0x556a51['agent']['id']][_0x8c78('0x42')]=![];_0x3d1306[_0x8c78('0x43')][_0x556a51[_0x8c78('0x41')]['id']]['busyQueue']=undefined;}}if(_0x556a51[_0x8c78('0x16')]&&_0x556a51[_0x8c78('0x16')]['id']){try{var _0x41b995=getId(_0x556a51[_0x8c78('0x15')],_0x556a51[_0x8c78('0x16')]?_0x556a51[_0x8c78('0x16')]['id']:0x0,_0x556a51[_0x8c78('0x17')]?_0x556a51[_0x8c78('0x17')]['id']:0x0);if(_0x3d1306[_0x8c78('0x14')][_0x41b995]){_0x3d1306['rules'][_0x41b995][_0x8c78('0x3c')](_0x8c78('0x44'));if(rpc[_0x556a51[_0x8c78('0x15')]+_0x8c78('0x45')]){rpc[_0x556a51['channel']+_0x8c78('0x45')][_0x8c78('0x46')](_0x41b995,{'UserId':_0x556a51[_0x8c78('0x16')][_0x8c78('0x47')]})['catch'](function(_0x336b95){logger[_0x8c78('0x3e')](_0x8c78('0x48'));});}}return _0x4588cd({'code':0xc8,'message':_0x556a51});}catch(_0x551e0f){logger[_0x8c78('0x3e')](_0x551e0f['stack']);return _0x464601(_0x356e47[_0x8c78('0x3e')](0x1f4,_0x551e0f));}}logger[_0x8c78('0x3e')](_0x8c78('0x49'));return _0x464601(_0x356e47[_0x8c78('0x3e')](0x1f4,_0x8c78('0x49')));});},'RejectMessage':function(_0x462b89){var _0xf68e0=this;return new Promise(function(_0x38fec1,_0x19d807){if(_0x462b89[_0x8c78('0x41')]&&_0x462b89[_0x8c78('0x41')]['id']){try{if(_0x3d1306[_0x8c78('0x43')][_0x462b89[_0x8c78('0x41')]['id']]){_0x3d1306[_0x8c78('0x43')][_0x462b89['agent']['id']][_0x8c78('0x42')]=![];_0x3d1306[_0x8c78('0x43')][_0x462b89[_0x8c78('0x41')]['id']][_0x8c78('0x4a')]=undefined;}return _0x38fec1({'code':0xc8,'message':_0x462b89});}catch(_0x5d046f){logger[_0x8c78('0x3e')](_0x5d046f[_0x8c78('0x3f')]);return _0x19d807(_0xf68e0[_0x8c78('0x3e')](0x1f4,_0x5d046f));}}logger[_0x8c78('0x3e')](_0x8c78('0x49'));return _0x19d807(_0xf68e0[_0x8c78('0x3e')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1e616c){var _0x42a34e=this;return new Promise(function(_0x486b61,_0x334432){if(_0x1e616c['channel']&&_0x1e616c[_0x8c78('0x17')]&&_0x1e616c[_0x8c78('0x17')]['id']){try{var _0x257533=getId(_0x1e616c[_0x8c78('0x15')],_0x1e616c[_0x8c78('0x16')]?_0x1e616c[_0x8c78('0x16')]['id']:0x0,_0x1e616c[_0x8c78('0x17')]?_0x1e616c['interaction']['id']:0x0);if(_0x3d1306[_0x8c78('0x14')][_0x257533]){_0x3d1306[_0x8c78('0x14')][_0x257533]['emit'](_0x8c78('0x44'));}return _0x486b61({'code':0xc8,'message':_0x1e616c});}catch(_0x3529aa){logger['error'](_0x3529aa[_0x8c78('0x3f')]);return _0x334432(_0x42a34e[_0x8c78('0x3e')](0x1f4,_0x3529aa));}}logger[_0x8c78('0x3e')](_0x8c78('0x49'));return _0x334432(_0x42a34e[_0x8c78('0x3e')](0x1f4,_0x8c78('0x49')));});},'AgentCapacity':function(_0x43f403){var _0x445630=this;return new Promise(function(_0x20a0d9,_0x1b3600){if(_0x3d1306[_0x8c78('0x43')][_0x8c78('0x4b')](_0x43f403['id'])){for(var _0x1468f2 in _0x43f403[_0x8c78('0x4c')]){if(_0x43f403['capacity'][_0x8c78('0x4b')](_0x1468f2)){if(_0x3d1306['agents'][_0x43f403['id']][_0x8c78('0x4b')](_0x1468f2+'CurrentCapacity')){_0x3d1306['agents'][_0x43f403['id']][_0x1468f2+'CurrentCapacity']=parseInt(_0x43f403[_0x8c78('0x4c')][_0x1468f2],0xa);}}}_0x3d1306['agents'][_0x43f403['id']]['updateRealtime']();return _0x20a0d9({'code':0xc8,'message':_0x3d1306['agents'][_0x43f403['id']]});}else{return _0x1b3600(_0x445630[_0x8c78('0x3e')](0x1f4,_0x8c78('0x4d')));}});},'Agents':function(_0x142b45){return new Promise(function(_0x19156a,_0x4d0b26){var _0x333272=_[_0x8c78('0x4e')](_0x3d1306[_0x8c78('0x43')]);_0x19156a({'count':_0x333272[_0x8c78('0x19')],'rows':_0x333272});});},'ChatQueues':function(_0x334d0a){return new Promise(function(_0x3c3332,_0x3990c2){var _0x54d561=[];for(var _0x25c255 in _0x3d1306[_0x8c78('0x4f')]){if(_0x3d1306[_0x8c78('0x4f')][_0x8c78('0x4b')](_0x25c255)){var _0x3e1ee0=_0x3d1306[_0x8c78('0x4f')][_0x25c255];var _0x4bdb7e={'id':_0x3e1ee0['id'],'available':_0x3e1ee0[_0x8c78('0x50')],'loggedIn':_0x3e1ee0['loggedIn'],'name':_0x3e1ee0[_0x8c78('0x51')],'paused':_0x3e1ee0[_0x8c78('0x52')],'waiting':_0x3e1ee0[_0x8c78('0x53')]};_0x54d561['push'](_0x4bdb7e);}}_0x3c3332({'count':_0x54d561[_0x8c78('0x19')],'rows':_0x54d561});});},'MailQueues':function(_0x3e2961){return new Promise(function(_0x3f3aff,_0x4fa0b0){var _0x1fa8a4=[];for(var _0x2240cd in _0x3d1306['mailQueues']){if(_0x3d1306[_0x8c78('0x54')][_0x8c78('0x4b')](_0x2240cd)){var _0x1763a7=_0x3d1306['mailQueues'][_0x2240cd];var _0x3780cd={'id':_0x1763a7['id'],'available':_0x1763a7[_0x8c78('0x50')],'loggedIn':_0x1763a7[_0x8c78('0x55')],'name':_0x1763a7[_0x8c78('0x51')],'paused':_0x1763a7[_0x8c78('0x52')],'waiting':_0x1763a7[_0x8c78('0x53')]};_0x1fa8a4[_0x8c78('0x22')](_0x3780cd);}}_0x3f3aff({'count':_0x1fa8a4[_0x8c78('0x19')],'rows':_0x1fa8a4});});},'OpenchannelQueues':function(_0x240f1e){return new Promise(function(_0x5646ff,_0x1f2b8f){var _0x21b400=[];for(var _0x3c6886 in _0x3d1306[_0x8c78('0x56')]){if(_0x3d1306[_0x8c78('0x56')][_0x8c78('0x4b')](_0x3c6886)){var _0x33b1e4=_0x3d1306[_0x8c78('0x56')][_0x3c6886];var _0x2c1cf5={'id':_0x33b1e4['id'],'available':_0x33b1e4['available'],'loggedIn':_0x33b1e4[_0x8c78('0x55')],'name':_0x33b1e4[_0x8c78('0x51')],'paused':_0x33b1e4['paused'],'waiting':_0x33b1e4['waiting']};_0x21b400[_0x8c78('0x22')](_0x2c1cf5);}}_0x5646ff({'count':_0x21b400['length'],'rows':_0x21b400});});},'SmsQueues':function(_0x103be3){return new Promise(function(_0x1c5c15,_0x3a3172){var _0x476835=[];for(var _0x1b2c45 in _0x3d1306[_0x8c78('0x57')]){if(_0x3d1306['smsQueues']['hasOwnProperty'](_0x1b2c45)){var _0x3e0e40=_0x3d1306[_0x8c78('0x57')][_0x1b2c45];var _0x44c309={'id':_0x3e0e40['id'],'available':_0x3e0e40[_0x8c78('0x50')],'loggedIn':_0x3e0e40[_0x8c78('0x55')],'name':_0x3e0e40['name'],'paused':_0x3e0e40[_0x8c78('0x52')],'waiting':_0x3e0e40[_0x8c78('0x53')]};_0x476835[_0x8c78('0x22')](_0x44c309);}}_0x1c5c15({'count':_0x476835[_0x8c78('0x19')],'rows':_0x476835});});},'FaxQueues':function(_0x1237a3){return new Promise(function(_0x9e1f41,_0x5d92c8){var _0x3a4c7a=[];for(var _0x155725 in _0x3d1306['faxQueues']){if(_0x3d1306[_0x8c78('0x58')][_0x8c78('0x4b')](_0x155725)){var _0xae45a8=_0x3d1306[_0x8c78('0x58')][_0x155725];var _0x3f2496={'id':_0xae45a8['id'],'available':_0xae45a8[_0x8c78('0x50')],'loggedIn':_0xae45a8[_0x8c78('0x55')],'name':_0xae45a8[_0x8c78('0x51')],'paused':_0xae45a8[_0x8c78('0x52')],'waiting':_0xae45a8[_0x8c78('0x53')]};_0x3a4c7a[_0x8c78('0x22')](_0x3f2496);}}_0x9e1f41({'count':_0x3a4c7a[_0x8c78('0x19')],'rows':_0x3a4c7a});});},'WhatsappQueues':function(_0x3ba98a){return new Promise(function(_0x3ed782,_0x16106d){var _0x400659=[];for(var _0x1b1876 in _0x3d1306['whatsappQueues']){if(_0x3d1306[_0x8c78('0x59')]['hasOwnProperty'](_0x1b1876)){var _0x5b12d8=_0x3d1306[_0x8c78('0x59')][_0x1b1876];var _0x28fbc1={'id':_0x5b12d8['id'],'available':_0x5b12d8[_0x8c78('0x50')],'loggedIn':_0x5b12d8[_0x8c78('0x55')],'name':_0x5b12d8['name'],'paused':_0x5b12d8[_0x8c78('0x52')],'waiting':_0x5b12d8[_0x8c78('0x53')]};_0x400659[_0x8c78('0x22')](_0x28fbc1);}}_0x3ed782({'count':_0x400659['length'],'rows':_0x400659});});},'ChatQueuesWaitingInteractions':function(_0x9722d1){return new Promise(function(_0xb84d81,_0x2fbf59){var _0x313ec9=_['values'](_0x3d1306[_0x8c78('0x5a')]);_0xb84d81({'count':_0x313ec9[_0x8c78('0x19')],'rows':_0x313ec9});});},'MailQueuesWaitingInteractions':function(_0x5e2fc3){return new Promise(function(_0x4a6bb3,_0x4d393e){var _0x269c5b=_[_0x8c78('0x4e')](_0x3d1306[_0x8c78('0x5b')]);_0x4a6bb3({'count':_0x269c5b[_0x8c78('0x19')],'rows':_0x269c5b});});},'OpenchannelQueuesWaitingInteractions':function(_0x4d03c1){return new Promise(function(_0xae30e3,_0x4da14f){var _0x2f6e82=_[_0x8c78('0x4e')](_0x3d1306[_0x8c78('0x5c')]);_0xae30e3({'count':_0x2f6e82[_0x8c78('0x19')],'rows':_0x2f6e82});});},'SmsQueuesWaitingInteractions':function(_0x37059a){return new Promise(function(_0x15dc4a,_0x5b1a37){var _0x5c67c9=_['values'](_0x3d1306[_0x8c78('0x5d')]);_0x15dc4a({'count':_0x5c67c9[_0x8c78('0x19')],'rows':_0x5c67c9});});},'FaxQueuesWaitingInteractions':function(_0x53b653){return new Promise(function(_0xb40796,_0x1e6d75){var _0x21c6ef=_['values'](_0x3d1306[_0x8c78('0x5e')]);_0xb40796({'count':_0x21c6ef['length'],'rows':_0x21c6ef});});},'WhatsappQueuesWaitingInteractions':function(_0x26ca11){return new Promise(function(_0x253e6f,_0x3f013b){var _0x401567=_[_0x8c78('0x4e')](_0x3d1306[_0x8c78('0x5f')]);_0x253e6f({'count':_0x401567[_0x8c78('0x19')],'rows':_0x401567});});}};var _0xda7142=jayson[_0x8c78('0x60')](_0x1157d0)[_0x8c78('0x61')]();_0xda7142['on'](_0x8c78('0x3e'),function(_0x4d71dd){logger['error'](JSON[_0x8c78('0x3a')](_0x4d71dd));return _0x2f44af(_0x4d71dd);});_0xda7142[_0x8c78('0x13')](0x232c,_0x8c78('0x62'),function(){console['log'](_0x8c78('0x63'),0x232c);return _0x930233(_0x8c78('0x64')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 2b86ffb..a0eb665 100644 --- a/server/services/routing/server/interval.js +++ b/server/services/routing/server/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc34d=['[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','jayson/promise','lodash','http','request','then','error','message','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','indexOf'];(function(_0x249b3a,_0x331efa){var _0x3b867d=function(_0x29f27f){while(--_0x29f27f){_0x249b3a['push'](_0x249b3a['shift']());}};_0x3b867d(++_0x331efa);}(_0xc34d,0x82));var _0xdc34=function(_0x194643,_0x141ed1){_0x194643=_0x194643-0x0;var _0x4c4390=_0xc34d[_0x194643];return _0x4c4390;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xdc34('0x0'));var _=require(_0xdc34('0x1'));var logger=require('../../../config/logger')('routing');var client=jayson['client'][_0xdc34('0x2')]({'port':0x232a});function request(_0x2b46d7,_0x1bcb9e){return new BPromise(function(_0x183911,_0xfd6481){return client[_0xdc34('0x3')](_0x2b46d7,_0x1bcb9e)[_0xdc34('0x4')](function(_0xd66f03){if(_0xd66f03[_0xdc34('0x5')]){return _0xfd6481(_0xd66f03[_0xdc34('0x5')][_0xdc34('0x6')]);}else{return _0x183911(_0xd66f03['result']);}})[_0xdc34('0x7')](function(_0x4fd3a8){return _0xfd6481(_0x4fd3a8);});});}exports[_0xdc34('0x8')]=function(_0x38b7ea,_0x47c3f2,_0x3ad69e){return function(_0x5e82c5){if(_0x3ad69e[_0xdc34('0x9')]&&!_0x3ad69e['rules'][_0x38b7ea]){logger['info'](_0xdc34('0xa'),_0x38b7ea);return _0x5e82c5['stop']();}var _0x4d5539=[];for(var _0x4162b8=0x0;_0x4162b8<_0x47c3f2['length'];_0x4162b8+=0x1){_0x4d5539[_0xdc34('0xb')](request(_0xdc34('0xc'),{'command':util['format']('iftime\x20%s',_0x47c3f2[_0x4162b8])})[_0xdc34('0x4')](function(_0x392b51){return _0x392b51&&_0x392b51[_0xdc34('0x6')]&&_0x392b51[_0xdc34('0x6')][_0xdc34('0xd')]('true')>=0x0?!![]:![];})[_0xdc34('0x7')](function(_0x1f610f){logger[_0xdc34('0x5')](_0xdc34('0xe'),_0x38b7ea,_0x47c3f2[_0x4162b8]);}));}BPromise[_0xdc34('0xf')](_0x4d5539)[_0xdc34('0x4')](function(_0x5e1d0e){var _0x51ab55=_[_0xdc34('0x10')](_0x5e1d0e);logger[_0xdc34('0x11')](_0xdc34('0x12'),_0x38b7ea,_0x47c3f2[_0xdc34('0x13')](_0xdc34('0x14')),_0x51ab55);_0x5e82c5[_0xdc34('0x15')](_0x51ab55);})[_0xdc34('0x7')](function(_0xa991a5){console[_0xdc34('0x16')](_0xa991a5);logger[_0xdc34('0x5')]('[%s][INTERVAL]\x20%s\x20%s',_0x38b7ea,_0x47c3f2[_0xdc34('0x13')](_0xdc34('0x14')),_0xa991a5[_0xdc34('0x17')]);_0x5e82c5['stop']();});};}; \ No newline at end of file +var _0xe2aa=['jayson/promise','lodash','../../../config/logger','routing','client','http','then','error','result','catch','rules','info','stop','length','push','format','iftime\x20%s','message','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','bluebird'];(function(_0xd3798a,_0x32434b){var _0x2af40c=function(_0x171b60){while(--_0x171b60){_0xd3798a['push'](_0xd3798a['shift']());}};_0x2af40c(++_0x32434b);}(_0xe2aa,0x14f));var _0xae2a=function(_0x6af35d,_0x56c294){_0x6af35d=_0x6af35d-0x0;var _0x4cca9f=_0xe2aa[_0x6af35d];return _0x4cca9f;};'use strict';var util=require('util');var BPromise=require(_0xae2a('0x0'));var jayson=require(_0xae2a('0x1'));var _=require(_0xae2a('0x2'));var logger=require(_0xae2a('0x3'))(_0xae2a('0x4'));var client=jayson[_0xae2a('0x5')][_0xae2a('0x6')]({'port':0x232a});function request(_0x212bb7,_0x124e85){return new BPromise(function(_0x26cdf2,_0xcf5093){return client['request'](_0x212bb7,_0x124e85)[_0xae2a('0x7')](function(_0x3ebb4c){if(_0x3ebb4c['error']){return _0xcf5093(_0x3ebb4c[_0xae2a('0x8')]['message']);}else{return _0x26cdf2(_0x3ebb4c[_0xae2a('0x9')]);}})[_0xae2a('0xa')](function(_0x415479){return _0xcf5093(_0x415479);});});}exports['condition']=function(_0x19c676,_0x31fba5,_0x210f7c){return function(_0x2967f8){if(_0x210f7c[_0xae2a('0xb')]&&!_0x210f7c[_0xae2a('0xb')][_0x19c676]){logger[_0xae2a('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x19c676);return _0x2967f8[_0xae2a('0xd')]();}var _0x33567c=[];for(var _0x4281b2=0x0;_0x4281b2<_0x31fba5[_0xae2a('0xe')];_0x4281b2+=0x1){_0x33567c[_0xae2a('0xf')](request('Command',{'command':util[_0xae2a('0x10')](_0xae2a('0x11'),_0x31fba5[_0x4281b2])})[_0xae2a('0x7')](function(_0x104d7c){return _0x104d7c&&_0x104d7c[_0xae2a('0x12')]&&_0x104d7c[_0xae2a('0x12')]['indexOf'](_0xae2a('0x13'))>=0x0?!![]:![];})[_0xae2a('0xa')](function(_0x5e2323){logger[_0xae2a('0x8')]('[%s][INTERVAL]\x20%s',_0x19c676,_0x31fba5[_0x4281b2]);}));}BPromise[_0xae2a('0x14')](_0x33567c)['then'](function(_0x4b36a6){var _0x24c707=_[_0xae2a('0x15')](_0x4b36a6);logger[_0xae2a('0xc')](_0xae2a('0x16'),_0x19c676,_0x31fba5[_0xae2a('0x17')](_0xae2a('0x18')),_0x24c707);_0x2967f8[_0xae2a('0x19')](_0x24c707);})[_0xae2a('0xa')](function(_0x2395f7){console[_0xae2a('0x1a')](_0x2395f7);logger[_0xae2a('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x19c676,_0x31fba5[_0xae2a('0x17')](_0xae2a('0x18')),_0x2395f7[_0xae2a('0x1b')]);_0x2967f8[_0xae2a('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 8bf29bd..8f01dbb 100644 --- a/server/services/xdr/agents.controller.js +++ b/server/services/xdr/agents.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9a7=['connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','transfereeuniqueid','calleridname','agententerreason','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','format','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','talktime','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connectedlinename'];(function(_0x3a34c3,_0x60d93){var _0xdcbcca=function(_0x38ba91){while(--_0x38ba91){_0x3a34c3['push'](_0x3a34c3['shift']());}};_0xdcbcca(++_0x60d93);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb9a7[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x563857,_0x5f1a52){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x2'),_0x563857[_0x7b9a('0x3')],_0x563857[_0x7b9a('0x4')],_0x563857[_0x7b9a('0x5')],_0x563857[_0x7b9a('0x6')],_0x563857[_0x7b9a('0x7')],_0x563857[_0x7b9a('0x8')],_0x563857[_0x7b9a('0x9')],_0x563857[_0x7b9a('0xa')]));if(_0x563857[_0x7b9a('0x5')]){utils['getVoiceQueueByName'](_0x563857[_0x7b9a('0x5')])[_0x7b9a('0xb')](function(_0x56a199){if(_0x56a199){_0x563857['type']=_0x56a199['type'];_0x563857[_0x7b9a('0xc')]=_0x563857[_0x7b9a('0xd')]?_0x56a199['acw']:![];_0x563857[_0x7b9a('0xe')]=_0x563857['agentacw']?_0x56a199[_0x7b9a('0xf')]:0x0;}utils['request'](_0x7b9a('0x10'),_0x563857);});}else{utils[_0x7b9a('0x11')](_0x7b9a('0x10'),_0x563857);}if(_0x5f1a52){delete transfers[_0x563857['uniqueid']];}else{delete agents[_0x563857[_0x7b9a('0x12')]];}}exports[_0x7b9a('0x13')]=function(_0x5e3875){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentcalled]',_0x5e3875[_0x7b9a('0x3')]),_0x5e3875);agents[_0x5e3875[_0x7b9a('0x12')]]=_0x5e3875;agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x18');agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinenum']=null;agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinename']=null;utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x19'),_0x5e3875[_0x7b9a('0x3')],agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x6')],_0x5e3875[_0x7b9a('0x12')]));}catch(_0x283cc3){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x1b'),_0x5e3875[_0x7b9a('0x3')]),_0x283cc3);}};exports[_0x7b9a('0x1c')]=function(_0x58aed7){try{if(!_[_0x7b9a('0x1d')](agents[_0x58aed7['destuniqueid']])){utils[_0x7b9a('0x14')](util['format'](_0x7b9a('0x1e'),_0x58aed7[_0x7b9a('0x3')]),_0x58aed7);utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x1f'),_0x58aed7[_0x7b9a('0x3')],agents[_0x58aed7['destuniqueid']][_0x7b9a('0x6')],_0x58aed7[_0x7b9a('0x12')]));agents[_0x58aed7[_0x7b9a('0x12')]][_0x7b9a('0x1c')]=!![];agents[_0x58aed7[_0x7b9a('0x12')]]['agentringnoanswerAt']=utils[_0x7b9a('0x17')]();agents[_0x58aed7[_0x7b9a('0x12')]]['lastevent']=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']][_0x7b9a('0x21')]=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']]['holdtime']=_0x58aed7[_0x7b9a('0x22')]?parseInt(_0x58aed7['ringtime'])/0x3e8:0x0;agents[_0x58aed7['destuniqueid']][_0x7b9a('0x23')]=0x0;unanswered['push'](_0x58aed7['destuniqueid']);}}catch(_0x3847b4){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x1e'),_0x58aed7['uniqueid']),_0x3847b4);}};exports[_0x7b9a('0x24')]=function(_0x2e6144){try{_[_0x7b9a('0x25')](agents,function(_0x5b64d7,_0x45ccf5){if(_0x5b64d7[_0x7b9a('0x3')]==_0x2e6144[_0x7b9a('0x3')]&&!_[_0x7b9a('0x26')](unanswered,_0x5b64d7[_0x7b9a('0x12')])){utils[_0x7b9a('0x14')](util['format']('[%s][agents][queuecallerabandon]',_0x2e6144[_0x7b9a('0x3')]),_0x2e6144);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e6144[_0x7b9a('0x3')],_0x5b64d7[_0x7b9a('0x6')],_0x5b64d7['destuniqueid']));_0x5b64d7['agentringnoanswer']=!![];_0x5b64d7[_0x7b9a('0x27')]=utils[_0x7b9a('0x17')]();_0x5b64d7['lastevent']=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x21')]=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x29')]=_0x2e6144[_0x7b9a('0x29')];_0x5b64d7['talktime']=0x0;writeDB(_0x5b64d7);}});}catch(_0x46bcd0){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x2a'),_0x2e6144[_0x7b9a('0x3')]),_0x46bcd0);}};exports[_0x7b9a('0x2b')]=function(_0x5f1da4){try{if(agents[_0x5f1da4['destuniqueid']]){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]',_0x5f1da4[_0x7b9a('0x3')]),_0x5f1da4);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x5f1da4[_0x7b9a('0x3')],agents[_0x5f1da4[_0x7b9a('0x12')]]['membername'],_0x5f1da4['destuniqueid']));agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2c')]=utils[_0x7b9a('0x17')]();agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x9')]=_0x5f1da4[_0x7b9a('0x9')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2d')]=_0x5f1da4['connectedlinename'];agents[_0x5f1da4[_0x7b9a('0x12')]]['holdtime']=_0x5f1da4[_0x7b9a('0x22')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x2e');_[_0x7b9a('0x25')](agents,function(_0x89951b,_0x5e504f){if(_0x89951b[_0x7b9a('0x12')]!=_0x5f1da4[_0x7b9a('0x12')]&&_0x89951b[_0x7b9a('0x3')]==_0x5f1da4[_0x7b9a('0x3')]){_0x89951b['talktime']=0x0;_0x89951b[_0x7b9a('0x29')]=_0x5f1da4[_0x7b9a('0x22')];_0x89951b[_0x7b9a('0x1c')]=!![];_0x89951b[_0x7b9a('0x27')]=utils['now']();_0x89951b[_0x7b9a('0xa')]='answered_elsewhere';_0x89951b[_0x7b9a('0x21')]=_0x7b9a('0x2f');_0x89951b[_0x7b9a('0x30')]=_0x5f1da4[_0x7b9a('0x12')];_0x89951b[_0x7b9a('0x31')]=_0x5f1da4[_0x7b9a('0x6')];writeDB(_0x89951b);}});}}catch(_0x56e274){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x32'),_0x5f1da4['uniqueid']),_0x56e274);}};exports['agentcomplete']=function(_0x3724fe){try{if(!_[_0x7b9a('0x1d')](agents[_0x3724fe[_0x7b9a('0x12')]])){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe['uniqueid']),_0x3724fe);utils['info'](util['format'](_0x7b9a('0x34'),_0x3724fe[_0x7b9a('0x3')],agents[_0x3724fe['destuniqueid']][_0x7b9a('0x6')],_0x3724fe[_0x7b9a('0x12')]));agents[_0x3724fe[_0x7b9a('0x12')]]['agentcomplete']=!![];agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt']=utils[_0x7b9a('0x17')]();agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt'],agents[_0x3724fe[_0x7b9a('0x12')]]['agentconnectAt']);agents[_0x3724fe[_0x7b9a('0x12')]]['reason']=_0x3724fe['reason'];agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x36');writeDB(agents[_0x3724fe[_0x7b9a('0x12')]]);}}catch(_0x1cbd5a){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe[_0x7b9a('0x3')]),_0x1cbd5a);}};exports['blindtransfer']=function(_0x1d7957){try{if(!_[_0x7b9a('0x1d')](agents[_0x1d7957['transfereruniqueid']])){utils['debug'](util['format'](_0x7b9a('0x37'),_0x1d7957[_0x7b9a('0x3')]),_0x1d7957);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1d7957[_0x7b9a('0x3')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x6')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')]));agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x39')]=!![];agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x3b');agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3c')]=_0x1d7957['extension'];agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3d')]=agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')];}}catch(_0x2b0db5){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]',_0x1d7957['uniqueid']),_0x2b0db5);}};exports['attendedtransfer']=function(_0x12c5bf){try{utils[_0x7b9a('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf['origtransfereruniqueid']),_0x12c5bf);if(_0x12c5bf['origtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x3e')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf[_0x7b9a('0x3f')]])){utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x40'),_0x12c5bf[_0x7b9a('0x41')],agents[_0x12c5bf[_0x7b9a('0x3f')]]['membername']));agents[_0x12c5bf[_0x7b9a('0x3f')]]['transfer']=!![];agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3c')]=_0x12c5bf['origtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x3f')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x41')];}if(_0x12c5bf[_0x7b9a('0x43')]&&agents[_0x12c5bf[_0x7b9a('0x43')]]){agents[_0x12c5bf['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfereeuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x43')]]);transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x8')]=agents[_0x12c5bf['secondtransfereruniqueid']][_0x7b9a('0x8')];transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x44')]=agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x44')];transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x43')]]['agentconnectAt']=utils['now']();transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x45')]=0x2;}}else if(_0x12c5bf['secondtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x46')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf['origtransfereruniqueid']])){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x40'),_0x12c5bf['origtransfereruniqueid'],agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x6')]));agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x39')]=!![];agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x3c')]=_0x12c5bf['secondtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x41')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x3f')];}if(_0x12c5bf['transfertargetuniqueid']&&agents[_0x12c5bf[_0x7b9a('0x47')]]){agents[_0x12c5bf['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfertargetuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x47')]]);transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x8')]=agents[_0x12c5bf[_0x7b9a('0x41')]]['calleridnum'];transfers[_0x12c5bf[_0x7b9a('0x47')]]['calleridname']=agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x44')];transfers[_0x12c5bf['transfertargetuniqueid']]['agentcalledAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x47')]]['agentconnectAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf['transfertargetuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x45')]=0x2;}}}catch(_0x5118b3){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf[_0x7b9a('0x41')]),_0x5118b3);}};exports[_0x7b9a('0x48')]=function(_0x3fd697){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3fd697);if(agents[_0x3fd697['uniqueid']]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]==='timeout'){if(_0x3fd697[_0x7b9a('0x4a')]==='21'){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='rejected';agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x4b');}utils['info'](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x21')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);var _0x2090ef=unanswered['indexOf'](_0x3fd697['uniqueid']);if(_0x2090ef>-0x1){unanswered[_0x7b9a('0x4c')](_0x2090ef,0x1);}}if(transfers[_0x3fd697[_0x7b9a('0x3')]]){transfers[_0x3fd697['uniqueid']][_0x7b9a('0xd')]=!![];transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')]=utils['now']();transfers[_0x3fd697['uniqueid']][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],transfers[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='agent';transfers[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x36');utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],transfers[_0x3fd697[_0x7b9a('0x3')]]['membername'],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(transfers[_0x3fd697[_0x7b9a('0x3')]],!![]);}if(agents[_0x3fd697[_0x7b9a('0x3')]]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x2c')]){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xd')]=!![];agents[_0x3fd697[_0x7b9a('0x3')]]['agentcompleteAt']=utils['now']();agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x23')]=utils['diffTime'](agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]=agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x39')]?_0x7b9a('0x39'):_0x7b9a('0x4e');agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]='complete';utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x4f'),_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);}}catch(_0x3022e0){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3022e0);}}; \ No newline at end of file +var _0x2f68=['called','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','holdtime','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','abandoned','agentconnect','[%s][agents][agentconnect]','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','complete','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','./utils','format','uniqueid','channel','membername','interface','lastevent','queue','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt'];(function(_0x1c04c5,_0x2514e5){var _0x1b6ef4=function(_0x40961f){while(--_0x40961f){_0x1c04c5['push'](_0x1c04c5['shift']());}};_0x1b6ef4(++_0x2514e5);}(_0x2f68,0x9a));var _0x82f6=function(_0x219e5d,_0x184f6d){_0x219e5d=_0x219e5d-0x0;var _0x5bbbe0=_0x2f68[_0x219e5d];return _0x5bbbe0;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var utils=require(_0x82f6('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x24c877,_0x3a9c8f){utils['info'](util[_0x82f6('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x24c877[_0x82f6('0x3')],_0x24c877[_0x82f6('0x4')],_0x24c877['queue'],_0x24c877[_0x82f6('0x5')],_0x24c877[_0x82f6('0x6')],_0x24c877['calleridnum'],_0x24c877['connectedlinenum'],_0x24c877[_0x82f6('0x7')]));if(_0x24c877['queue']){utils['getVoiceQueueByName'](_0x24c877[_0x82f6('0x8')])[_0x82f6('0x9')](function(_0x250d71){if(_0x250d71){_0x24c877['type']=_0x250d71[_0x82f6('0xa')];_0x24c877[_0x82f6('0xb')]=_0x24c877['agentcomplete']?_0x250d71[_0x82f6('0xc')]:![];_0x24c877[_0x82f6('0xd')]=_0x24c877[_0x82f6('0xb')]?_0x250d71[_0x82f6('0xe')]:0x0;}utils[_0x82f6('0xf')](_0x82f6('0x10'),_0x24c877);});}else{utils['request'](_0x82f6('0x10'),_0x24c877);}if(_0x3a9c8f){delete transfers[_0x24c877[_0x82f6('0x3')]];}else{delete agents[_0x24c877['destuniqueid']];}}exports[_0x82f6('0x11')]=function(_0x1f8bf5){try{utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x13'),_0x1f8bf5[_0x82f6('0x3')]),_0x1f8bf5);agents[_0x1f8bf5[_0x82f6('0x14')]]=_0x1f8bf5;agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x15')]=utils['now']();agents[_0x1f8bf5[_0x82f6('0x14')]]['lastevent']=_0x82f6('0x16');agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x17')]=null;agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x18')]=null;utils[_0x82f6('0x19')](util[_0x82f6('0x2')](_0x82f6('0x1a'),_0x1f8bf5[_0x82f6('0x3')],agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x5')],_0x1f8bf5[_0x82f6('0x14')]));}catch(_0x2652a9){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')]('[%s][agents][agentcalled]',_0x1f8bf5[_0x82f6('0x3')]),_0x2652a9);}};exports[_0x82f6('0x1c')]=function(_0x55cbce){try{if(!_[_0x82f6('0x1d')](agents[_0x55cbce[_0x82f6('0x14')]])){utils[_0x82f6('0x12')](util[_0x82f6('0x2')]('[%s][agents][agentringnoanswer]',_0x55cbce[_0x82f6('0x3')]),_0x55cbce);utils['info'](util[_0x82f6('0x2')](_0x82f6('0x1e'),_0x55cbce['uniqueid'],agents[_0x55cbce['destuniqueid']][_0x82f6('0x5')],_0x55cbce[_0x82f6('0x14')]));agents[_0x55cbce['destuniqueid']]['agentringnoanswer']=!![];agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x1f')]=utils['now']();agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x7')]='timeout';agents[_0x55cbce['destuniqueid']][_0x82f6('0x20')]='timeout';agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x21')]=_0x55cbce['ringtime']?parseInt(_0x55cbce[_0x82f6('0x22')])/0x3e8:0x0;agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x23')]=0x0;unanswered[_0x82f6('0x24')](_0x55cbce['destuniqueid']);}}catch(_0x40a071){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x25'),_0x55cbce[_0x82f6('0x3')]),_0x40a071);}};exports[_0x82f6('0x26')]=function(_0x27e473){try{_[_0x82f6('0x27')](agents,function(_0x1e1aa4,_0x402449){if(_0x1e1aa4[_0x82f6('0x3')]==_0x27e473[_0x82f6('0x3')]&&!_[_0x82f6('0x28')](unanswered,_0x1e1aa4[_0x82f6('0x14')])){utils['debug'](util[_0x82f6('0x2')](_0x82f6('0x29'),_0x27e473[_0x82f6('0x3')]),_0x27e473);utils['info'](util[_0x82f6('0x2')](_0x82f6('0x2a'),_0x27e473[_0x82f6('0x3')],_0x1e1aa4[_0x82f6('0x5')],_0x1e1aa4[_0x82f6('0x14')]));_0x1e1aa4[_0x82f6('0x1c')]=!![];_0x1e1aa4[_0x82f6('0x1f')]=utils[_0x82f6('0x2b')]();_0x1e1aa4[_0x82f6('0x7')]=_0x82f6('0x2c');_0x1e1aa4[_0x82f6('0x20')]=_0x82f6('0x2c');_0x1e1aa4[_0x82f6('0x21')]=_0x27e473[_0x82f6('0x21')];_0x1e1aa4['talktime']=0x0;writeDB(_0x1e1aa4);}});}catch(_0x13a409){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x29'),_0x27e473[_0x82f6('0x3')]),_0x13a409);}};exports[_0x82f6('0x2d')]=function(_0x34c2f1){try{if(agents[_0x34c2f1[_0x82f6('0x14')]]){utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x2e'),_0x34c2f1[_0x82f6('0x3')]),_0x34c2f1);utils[_0x82f6('0x19')](util[_0x82f6('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x34c2f1[_0x82f6('0x3')],agents[_0x34c2f1['destuniqueid']]['membername'],_0x34c2f1[_0x82f6('0x14')]));agents[_0x34c2f1[_0x82f6('0x14')]]['agentconnectAt']=utils[_0x82f6('0x2b')]();agents[_0x34c2f1[_0x82f6('0x14')]][_0x82f6('0x17')]=_0x34c2f1['connectedlinenum'];agents[_0x34c2f1[_0x82f6('0x14')]]['connectedlinename']=_0x34c2f1[_0x82f6('0x18')];agents[_0x34c2f1['destuniqueid']][_0x82f6('0x21')]=_0x34c2f1['ringtime'];agents[_0x34c2f1[_0x82f6('0x14')]][_0x82f6('0x7')]='connect';_[_0x82f6('0x27')](agents,function(_0x368c11,_0x3e7c53){if(_0x368c11[_0x82f6('0x14')]!=_0x34c2f1['destuniqueid']&&_0x368c11[_0x82f6('0x3')]==_0x34c2f1[_0x82f6('0x3')]){_0x368c11[_0x82f6('0x23')]=0x0;_0x368c11[_0x82f6('0x21')]=_0x34c2f1['ringtime'];_0x368c11[_0x82f6('0x1c')]=!![];_0x368c11[_0x82f6('0x1f')]=utils['now']();_0x368c11[_0x82f6('0x7')]=_0x82f6('0x2f');_0x368c11[_0x82f6('0x20')]=_0x82f6('0x2f');_0x368c11[_0x82f6('0x30')]=_0x34c2f1['destuniqueid'];_0x368c11[_0x82f6('0x31')]=_0x34c2f1['membername'];writeDB(_0x368c11);}});}}catch(_0x139614){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x2e'),_0x34c2f1[_0x82f6('0x3')]),_0x139614);}};exports[_0x82f6('0x32')]=function(_0x43fefc){try{if(!_['isNil'](agents[_0x43fefc[_0x82f6('0x14')]])){utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x33'),_0x43fefc['uniqueid']),_0x43fefc);utils[_0x82f6('0x19')](util['format'](_0x82f6('0x34'),_0x43fefc[_0x82f6('0x3')],agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x5')],_0x43fefc[_0x82f6('0x14')]));agents[_0x43fefc[_0x82f6('0x14')]]['agentcomplete']=!![];agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x35')]=utils[_0x82f6('0x2b')]();agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x23')]=utils[_0x82f6('0x36')](agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x35')],agents[_0x43fefc['destuniqueid']][_0x82f6('0x37')]);agents[_0x43fefc[_0x82f6('0x14')]]['reason']=_0x43fefc[_0x82f6('0x20')];agents[_0x43fefc['destuniqueid']][_0x82f6('0x7')]='complete';writeDB(agents[_0x43fefc[_0x82f6('0x14')]]);}}catch(_0x31dec7){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x33'),_0x43fefc[_0x82f6('0x3')]),_0x31dec7);}};exports['blindtransfer']=function(_0x3cb1f0){try{if(!_[_0x82f6('0x1d')](agents[_0x3cb1f0['transfereruniqueid']])){utils['debug'](util[_0x82f6('0x2')](_0x82f6('0x38'),_0x3cb1f0[_0x82f6('0x3')]),_0x3cb1f0);utils['info'](util[_0x82f6('0x2')](_0x82f6('0x39'),_0x3cb1f0[_0x82f6('0x3')],agents[_0x3cb1f0[_0x82f6('0x3a')]]['membername'],agents[_0x3cb1f0['transfereruniqueid']][_0x82f6('0x3')]));agents[_0x3cb1f0[_0x82f6('0x3a')]][_0x82f6('0x3b')]=!![];agents[_0x3cb1f0['transfereruniqueid']][_0x82f6('0x3c')]=_0x82f6('0x3d');agents[_0x3cb1f0['transfereruniqueid']]['transferexten']=_0x3cb1f0['extension'];agents[_0x3cb1f0[_0x82f6('0x3a')]]['transferuniqueid']=agents[_0x3cb1f0[_0x82f6('0x3a')]]['uniqueid'];}}catch(_0x33c359){utils['error'](util[_0x82f6('0x2')]('[%s][agents][blindtransfer]',_0x3cb1f0[_0x82f6('0x3')]),_0x33c359);}};exports[_0x82f6('0x3e')]=function(_0x44de65){try{utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x3f'),_0x44de65['origtransfereruniqueid']),_0x44de65);if(_0x44de65[_0x82f6('0x40')]==_0x44de65[_0x82f6('0x41')]){if(!_[_0x82f6('0x1d')](agents[_0x44de65['secondtransfereruniqueid']])){utils['info'](util[_0x82f6('0x2')](_0x82f6('0x42'),_0x44de65[_0x82f6('0x40')],agents[_0x44de65[_0x82f6('0x43')]]['membername']));agents[_0x44de65[_0x82f6('0x43')]][_0x82f6('0x3b')]=!![];agents[_0x44de65[_0x82f6('0x43')]]['transfertype']='ATTENDED';agents[_0x44de65['secondtransfereruniqueid']][_0x82f6('0x44')]=_0x44de65[_0x82f6('0x45')];agents[_0x44de65[_0x82f6('0x43')]][_0x82f6('0x46')]=_0x44de65[_0x82f6('0x40')];}if(_0x44de65[_0x82f6('0x47')]&&agents[_0x44de65[_0x82f6('0x47')]]){agents[_0x44de65[_0x82f6('0x47')]]['agententerreason']=0x1;transfers[_0x44de65[_0x82f6('0x47')]]=_[_0x82f6('0x48')](agents[_0x44de65[_0x82f6('0x47')]]);transfers[_0x44de65[_0x82f6('0x47')]]['calleridnum']=agents[_0x44de65['secondtransfereruniqueid']][_0x82f6('0x49')];transfers[_0x44de65[_0x82f6('0x47')]]['calleridname']=agents[_0x44de65[_0x82f6('0x43')]][_0x82f6('0x4a')];transfers[_0x44de65[_0x82f6('0x47')]]['agentcalledAt']=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x47')]][_0x82f6('0x37')]=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x47')]][_0x82f6('0x21')]=0x0;transfers[_0x44de65['transfereeuniqueid']][_0x82f6('0x4b')]=0x2;}}else if(_0x44de65[_0x82f6('0x43')]==_0x44de65[_0x82f6('0x4c')]){if(!_[_0x82f6('0x1d')](agents[_0x44de65[_0x82f6('0x40')]])){utils['info'](util[_0x82f6('0x2')](_0x82f6('0x42'),_0x44de65[_0x82f6('0x40')],agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x5')]));agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x3b')]=!![];agents[_0x44de65[_0x82f6('0x40')]]['transfertype']=_0x82f6('0x4d');agents[_0x44de65['origtransfereruniqueid']][_0x82f6('0x44')]=_0x44de65[_0x82f6('0x4e')];agents[_0x44de65['origtransfereruniqueid']][_0x82f6('0x46')]=_0x44de65[_0x82f6('0x43')];}if(_0x44de65[_0x82f6('0x4f')]&&agents[_0x44de65['transfertargetuniqueid']]){agents[_0x44de65['transfertargetuniqueid']][_0x82f6('0x4b')]=0x1;transfers[_0x44de65[_0x82f6('0x4f')]]=_['clone'](agents[_0x44de65['transfertargetuniqueid']]);transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x49')]=agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x49')];transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x4a')]=agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x4a')];transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x15')]=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x4f')]]['agentconnectAt']=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x21')]=0x0;transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x4b')]=0x2;}}}catch(_0x4ef838){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x3f'),_0x44de65['origtransfereruniqueid']),_0x4ef838);}};exports[_0x82f6('0x50')]=function(_0x192dc7){try{utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x51'),_0x192dc7[_0x82f6('0x3')]),_0x192dc7);if(agents[_0x192dc7[_0x82f6('0x3')]]&&agents[_0x192dc7['uniqueid']][_0x82f6('0x20')]==='timeout'){if(_0x192dc7[_0x82f6('0x52')]==='21'){agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')]=_0x82f6('0x53');agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x7')]=_0x82f6('0x53');}utils[_0x82f6('0x19')](util[_0x82f6('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x192dc7[_0x82f6('0x3')],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x5')],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')],agents[_0x192dc7[_0x82f6('0x3')]]['lastevent']));writeDB(agents[_0x192dc7[_0x82f6('0x3')]]);var _0x443547=unanswered['indexOf'](_0x192dc7['uniqueid']);if(_0x443547>-0x1){unanswered[_0x82f6('0x54')](_0x443547,0x1);}}if(transfers[_0x192dc7[_0x82f6('0x3')]]){transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x32')]=!![];transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x35')]=utils['now']();transfers[_0x192dc7[_0x82f6('0x3')]]['talktime']=utils[_0x82f6('0x36')](transfers[_0x192dc7['uniqueid']][_0x82f6('0x35')],transfers[_0x192dc7['uniqueid']][_0x82f6('0x37')]);transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')]='agent';transfers[_0x192dc7[_0x82f6('0x3')]]['lastevent']=_0x82f6('0x55');utils[_0x82f6('0x19')](util[_0x82f6('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x192dc7[_0x82f6('0x3')],transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x5')],transfers[_0x192dc7['uniqueid']]['reason'],transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x7')]));writeDB(transfers[_0x192dc7[_0x82f6('0x3')]],!![]);}if(agents[_0x192dc7[_0x82f6('0x3')]]&&agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x37')]){agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x32')]=!![];agents[_0x192dc7['uniqueid']][_0x82f6('0x35')]=utils[_0x82f6('0x2b')]();agents[_0x192dc7['uniqueid']][_0x82f6('0x23')]=utils[_0x82f6('0x36')](agents[_0x192dc7[_0x82f6('0x3')]]['agentcompleteAt'],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x37')]);agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')]=agents[_0x192dc7['uniqueid']][_0x82f6('0x3b')]?_0x82f6('0x3b'):_0x82f6('0x56');agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x7')]=_0x82f6('0x55');utils['info'](util[_0x82f6('0x2')](_0x82f6('0x57'),_0x192dc7[_0x82f6('0x3')],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x5')],agents[_0x192dc7['uniqueid']][_0x82f6('0x20')],agents[_0x192dc7['uniqueid']][_0x82f6('0x7')]));writeDB(agents[_0x192dc7[_0x82f6('0x3')]]);}}catch(_0x425e33){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x51'),_0x192dc7[_0x82f6('0x3')]),_0x425e33);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9074059..db94154 100644 --- a/server/services/xdr/calls.controller.js +++ b/server/services/xdr/calls.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0ad=['OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lastapplication','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','recording','newchannel','linkedid'];(function(_0x3f65df,_0x59783a){var _0x533f28=function(_0x5dbdef){while(--_0x5dbdef){_0x3f65df['push'](_0x3f65df['shift']());}};_0x533f28(++_0x59783a);}(_0xe0ad,0x1a5));var _0xde0a=function(_0xe5992b,_0x576302){_0xe5992b=_0xe5992b-0x0;var _0x448d5b=_0xe0ad[_0xe5992b];return _0x448d5b;};'use strict';var _=require(_0xde0a('0x0'));var util=require('util');var utils=require(_0xde0a('0x1'));var transfers=require(_0xde0a('0x2'));var dispositions=[_0xde0a('0x3'),_0xde0a('0x4'),'FAILED',_0xde0a('0x3'),_0xde0a('0x3'),_0xde0a('0x3'),_0xde0a('0x5'),_0xde0a('0x6'),_0xde0a('0x4'),_0xde0a('0x4'),_0xde0a('0x4')];var channels={};function writeDB(_0x153450){var _0x2e25a3;if(transfers[_0xde0a('0x7')][_0x153450[_0xde0a('0x8')]]){_0x2e25a3=_0x153450[_0xde0a('0x8')];_0x153450[_0xde0a('0x8')]=transfers[_0xde0a('0x7')][_0x153450[_0xde0a('0x8')]][_0xde0a('0x9')];}utils['info'](util[_0xde0a('0xa')](_0xde0a('0xb'),_0x153450['uniqueid'],_0x153450[_0xde0a('0xc')],_0x153450[_0xde0a('0xd')],_0x153450[_0xde0a('0xe')],_0x153450[_0xde0a('0xf')],_0x153450[_0xde0a('0x10')],_0x153450[_0xde0a('0x11')],_0x153450[_0xde0a('0x12')]));if(_0x153450[_0xde0a('0x13')]){utils['getUserByInternal'](_0x153450[_0xde0a('0x13')])[_0xde0a('0x14')](function(_0x50dba6){if(_0x50dba6){_0x153450[_0xde0a('0x15')]=_0x50dba6['id'];}utils[_0xde0a('0x16')](_0xde0a('0x17'),_0x153450);});}else{utils[_0xde0a('0x16')](_0xde0a('0x17'),_0x153450);}if(channels[_0x153450['uniqueid']]){delete channels[_0x153450[_0xde0a('0x8')]];}else if(_0x2e25a3&&channels[_0x2e25a3]){if(!transfers[_0xde0a('0x7')][_0x2e25a3][_0xde0a('0x18')])delete transfers[_0xde0a('0x7')][_0x2e25a3];delete channels[_0x2e25a3];}}exports[_0xde0a('0x19')]=function(_0x4e1b2a){try{utils['debug'](util['format']('[%s][calls][newchannel]',_0x4e1b2a[_0xde0a('0x8')]),_0x4e1b2a);if(_0x4e1b2a['uniqueid']==_0x4e1b2a[_0xde0a('0x1a')]&&_0x4e1b2a['channel']!=_0xde0a('0x1b')){utils[_0xde0a('0x1c')](util['format'](_0xde0a('0x1d'),_0x4e1b2a[_0xde0a('0x8')],_0x4e1b2a[_0xde0a('0x1e')],_0x4e1b2a[_0xde0a('0x1f')]));channels[_0x4e1b2a['uniqueid']]={'uniqueid':_0x4e1b2a['uniqueid'],'accountcode':_0x4e1b2a[_0xde0a('0x13')],'source':_0x4e1b2a[_0xde0a('0x10')],'destination':_0x4e1b2a['exten'],'destinationcontext':_0x4e1b2a[_0xde0a('0x1e')],'channel':_0x4e1b2a['channel'],'starttime':utils[_0xde0a('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xde0a('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x2dee8a){utils[_0xde0a('0x21')](util[_0xde0a('0xa')]('[%s][calls][newchannel]',_0x4e1b2a[_0xde0a('0x8')]),_0x2dee8a);}};exports['newstate']=function(_0x419887){try{utils[_0xde0a('0x22')](util[_0xde0a('0xa')](_0xde0a('0x23'),_0x419887[_0xde0a('0x8')]),_0x419887);if(!_[_0xde0a('0x24')](channels[_0x419887[_0xde0a('0x8')]])&&_0x419887[_0xde0a('0x25')]==0x6){utils[_0xde0a('0x1c')](util['format'](_0xde0a('0x26'),_0x419887['uniqueid'],_0x419887[_0xde0a('0x1e')],_0x419887['channel']));if(_['isNil'](channels[_0x419887[_0xde0a('0x8')]][_0xde0a('0x27')])){channels[_0x419887[_0xde0a('0x8')]][_0xde0a('0x27')]=utils['now']();}}else if(!_[_0xde0a('0x24')](channels[_0x419887['linkedid']])&&_0x419887[_0xde0a('0x25')]==0x6&&_0x419887[_0xde0a('0x1e')]!=_0xde0a('0x28')){utils['info'](util[_0xde0a('0xa')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x419887[_0xde0a('0x8')],_0x419887[_0xde0a('0x1a')],_0x419887['context'],_0x419887[_0xde0a('0xc')]));channels[_0x419887[_0xde0a('0x1a')]]['accountcode']=_0x419887[_0xde0a('0x13')];channels[_0x419887[_0xde0a('0x1a')]][_0xde0a('0x29')]=_0x419887['channel'];if(_[_0xde0a('0x24')](channels[_0x419887[_0xde0a('0x1a')]][_0xde0a('0x2a')])){channels[_0x419887['linkedid']]['answertime']=utils[_0xde0a('0x20')]();}channels[_0x419887[_0xde0a('0x1a')]][_0xde0a('0x2b')]=dispositions[_[_0xde0a('0x2c')](_0x419887[_0xde0a('0x25')])]||_0xde0a('0x5');}}catch(_0x18d131){utils[_0xde0a('0x21')](util[_0xde0a('0xa')](_0xde0a('0x23'),_0x419887['uniqueid']),_0x18d131);}};exports['hangup']=function(_0x6d816f){try{if(!_[_0xde0a('0x24')](channels[_0x6d816f[_0xde0a('0x8')]])){utils[_0xde0a('0x22')](util[_0xde0a('0xa')](_0xde0a('0x2d'),_0x6d816f[_0xde0a('0x8')]),_0x6d816f);if(_[_0xde0a('0x24')](channels[_0x6d816f['uniqueid']][_0xde0a('0x2e')])){channels[_0x6d816f['uniqueid']][_0xde0a('0x2e')]=_0x6d816f[_0xde0a('0x2f')]+'\x20<'+_0x6d816f[_0xde0a('0x10')]+'>';}utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x30'),_0x6d816f[_0xde0a('0x8')],channels[_0x6d816f['uniqueid']][_0xde0a('0x2e')],_0x6d816f[_0xde0a('0x31')]));channels[_0x6d816f['uniqueid']][_0xde0a('0x32')]=utils[_0xde0a('0x20')]();channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x33')]=utils[_0xde0a('0x34')](channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x32')],channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x35')]);channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x36')]=channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x2a')]?utils[_0xde0a('0x34')](channels[_0x6d816f[_0xde0a('0x8')]]['endtime'],channels[_0x6d816f[_0xde0a('0x8')]][_0xde0a('0x2a')]):0x0;writeDB(channels[_0x6d816f[_0xde0a('0x8')]]);}}catch(_0xc12f77){utils[_0xde0a('0x21')](util[_0xde0a('0xa')](_0xde0a('0x2d'),_0x6d816f[_0xde0a('0x8')]),_0xc12f77);}};exports[_0xde0a('0x37')]=function(_0x2f7855){try{if(!_['isNil'](channels[_0x2f7855[_0xde0a('0x38')]])){utils[_0xde0a('0x22')](util[_0xde0a('0xa')](_0xde0a('0x39'),_0x2f7855[_0xde0a('0x3a')]),_0x2f7855);if(channels[_0x2f7855[_0xde0a('0x38')]][_0xde0a('0xc')]==_0x2f7855[_0xde0a('0x3b')]){utils[_0xde0a('0x1c')](util['format'](_0xde0a('0x3c'),_0x2f7855[_0xde0a('0x3a')],_0x2f7855[_0xde0a('0x38')],_0x2f7855[_0xde0a('0x3d')]));channels[_0x2f7855[_0xde0a('0x38')]][_0xde0a('0x29')]=_0x2f7855['secondtransfererchannel'];channels[_0x2f7855[_0xde0a('0x38')]]['userfield']=_0xde0a('0x3e');}else if(channels[_0x2f7855[_0xde0a('0x38')]]['channel']=_0x2f7855[_0xde0a('0x3f')]){utils[_0xde0a('0x1c')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2f7855['origtransfereruniqueid'],_0x2f7855[_0xde0a('0x38')],_0x2f7855[_0xde0a('0x40')]));channels[_0x2f7855[_0xde0a('0x38')]][_0xde0a('0x29')]=_0x2f7855[_0xde0a('0x40')];channels[_0x2f7855[_0xde0a('0x38')]][_0xde0a('0x41')]=_0xde0a('0x3e');}}}catch(_0x28b219){utils[_0xde0a('0x21')](util[_0xde0a('0xa')]('[%s][calls][attendedtransfer]',_0x2f7855[_0xde0a('0x3a')]),_0x28b219);}};exports['musiconholdstart']=function(_0x15110c){try{if(!_[_0xde0a('0x24')](channels[_0x15110c['uniqueid']])){utils['debug'](util[_0xde0a('0xa')](_0xde0a('0x42'),_0x15110c[_0xde0a('0x8')]),_0x15110c);channels[_0x15110c[_0xde0a('0x8')]][_0xde0a('0x43')]=utils[_0xde0a('0x20')]();utils['info'](util[_0xde0a('0xa')](_0xde0a('0x44'),_0x15110c[_0xde0a('0x8')],channels[_0x15110c['uniqueid']][_0xde0a('0x43')]));}}catch(_0x386563){utils[_0xde0a('0x21')](util[_0xde0a('0xa')]('[%s][calls][musiconholdstart]',_0x15110c[_0xde0a('0x8')]),_0x386563);}};exports[_0xde0a('0x45')]=function(_0x4aa9a1){try{if(!_[_0xde0a('0x24')](channels[_0x4aa9a1[_0xde0a('0x8')]])){utils['debug'](util[_0xde0a('0xa')]('[%s][calls][musiconholdstop]',_0x4aa9a1['uniqueid']),_0x4aa9a1);if(!_[_0xde0a('0x24')](channels[_0x4aa9a1[_0xde0a('0x8')]]['musiconholdstartAt'])){channels[_0x4aa9a1[_0xde0a('0x8')]]['mohtime']+=utils['diffTime'](utils[_0xde0a('0x20')](),channels[_0x4aa9a1[_0xde0a('0x8')]][_0xde0a('0x43')]);utils['info'](util['format'](_0xde0a('0x46'),_0x4aa9a1[_0xde0a('0x8')],channels[_0x4aa9a1[_0xde0a('0x8')]][_0xde0a('0x47')]));delete channels[_0x4aa9a1[_0xde0a('0x8')]][_0xde0a('0x43')];}}}catch(_0x2850a4){utils[_0xde0a('0x21')](util[_0xde0a('0xa')]('[%s][calls][musiconholdstop]',_0x4aa9a1[_0xde0a('0x8')]),_0x2850a4);}};exports[_0xde0a('0x48')]=function(_0x4d2659){try{if(!_['isNil'](channels[_0x4d2659[_0xde0a('0x8')]])){utils[_0xde0a('0x22')](util[_0xde0a('0xa')](_0xde0a('0x49'),_0x4d2659[_0xde0a('0x8')]),_0x4d2659);if(!_['isNil'](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x4b')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4d2659['uniqueid'],_0x4d2659['value']));channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x4c')]=_0x4d2659['value'];}if(!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')]['xmd-phone'])){utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x4d'),_0x4d2659['uniqueid'],_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x4f')]=_0x4d2659[_0xde0a('0x4e')];channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x2e')]='\x22'+_0x4d2659[_0xde0a('0x4e')]+_0xde0a('0x50')+_0x4d2659[_0xde0a('0x4e')]+'>';}if(!_[_0xde0a('0x24')](_0x4d2659['variable'][_0xde0a('0x51')])||!_['isNil'](_0x4d2659[_0xde0a('0x4a')]['xmd-callerid'])){utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x52'),_0x4d2659[_0xde0a('0x8')],!_['isNil'](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x51')])?_0xde0a('0x51'):'xmd-callerid',_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x2e')]=_0x4d2659[_0xde0a('0x4e')];}if(!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x53')])||!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x54')])){utils['info'](util[_0xde0a('0xa')](_0xde0a('0x52'),_0x4d2659[_0xde0a('0x8')],!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x53')])?_0xde0a('0x53'):_0xde0a('0x54'),_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]]['lastapplication']=_0xde0a('0x55');channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x56')]=_0x4d2659['value'];channels[_0x4d2659['uniqueid']][_0xde0a('0xd')]=!![];}if(!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x57')])){utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x58'),_0x4d2659[_0xde0a('0x8')],_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]]['ContactId']=_0x4d2659[_0xde0a('0x4e')];}if(!_[_0xde0a('0x24')](_0x4d2659['variable'][_0xde0a('0x59')])){utils['info'](util['format'](_0xde0a('0x5a'),_0x4d2659[_0xde0a('0x8')],_0x4d2659['value']));channels[_0x4d2659[_0xde0a('0x8')]]['type']=_0x4d2659[_0xde0a('0x4e')];}if(!_[_0xde0a('0x24')](_0x4d2659[_0xde0a('0x4a')][_0xde0a('0x5b')])){utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x5c'),_0x4d2659['uniqueid'],_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]]['routeid']=_0x4d2659[_0xde0a('0x4e')];}if(!_[_0xde0a('0x24')](_0x4d2659['variable'][_0xde0a('0x5d')])){utils[_0xde0a('0x1c')](util[_0xde0a('0xa')](_0xde0a('0x5e'),_0x4d2659['uniqueid'],_0x4d2659[_0xde0a('0x4e')]));channels[_0x4d2659[_0xde0a('0x8')]][_0xde0a('0x5d')]=_0x4d2659[_0xde0a('0x4e')];}}}catch(_0x189bc4){utils[_0xde0a('0x21')](util['format']('[%s][calls][varset]',_0x4d2659['uniqueid']),_0x189bc4);}};exports[_0xde0a('0x5f')]=function(_0x5772d3){try{if(!_['isNil'](channels[_0x5772d3[_0xde0a('0x8')]])){utils['debug'](util[_0xde0a('0xa')](_0xde0a('0x60'),_0x5772d3[_0xde0a('0x8')]),_0x5772d3);utils[_0xde0a('0x1c')](util[_0xde0a('0xa')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x5772d3['uniqueid'],_0x5772d3[_0xde0a('0x61')],_0x5772d3[_0xde0a('0x62')]));if(_0x5772d3[_0xde0a('0x61')][_0xde0a('0x63')]()==_0xde0a('0x64')&&_[_0xde0a('0x65')](_0x5772d3[_0xde0a('0x62')]['toLowerCase'](),_0xde0a('0x66'))){var _0x568ead=_0x5772d3[_0xde0a('0x62')][_0xde0a('0x67')]('=');var _0x57d7ed=_0x568ead[0x0][_0xde0a('0x68')](_0x568ead[0x0][_0xde0a('0x69')]('(')+0x1,_0x568ead[0x0]['lastIndexOf'](')'));var _0x572413=_0x568ead[0x1];channels[_0x5772d3[_0xde0a('0x8')]][_0x57d7ed]=_0x572413;}if(!_[_0xde0a('0x6a')]([_0xde0a('0x6b'),_0xde0a('0x6c'),_0xde0a('0x6d'),_0xde0a('0x64'),_0xde0a('0x6e')],_0x5772d3['application'][_0xde0a('0x63')]())){channels[_0x5772d3['uniqueid']][_0xde0a('0x6f')]=_0x5772d3['application'];channels[_0x5772d3[_0xde0a('0x8')]][_0xde0a('0x56')]=_0x5772d3[_0xde0a('0x62')];}}}catch(_0x263e20){utils[_0xde0a('0x21')](util[_0xde0a('0xa')](_0xde0a('0x60'),_0x5772d3['uniqueid']),_0x263e20);}}; \ No newline at end of file +var _0x4d0a=['error','[%s][calls][newchannel]','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','channelstate','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','transfertargetchannel','origtransfererchannel','userfield','_attended','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','noop','execif','lastdata','lodash','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','membername','interface','calleridnum','lastevent','accountcode','then','UserId','CreateVoiceCallReport','request','newchannel','debug','linkedid','OutgoingSpoolFailed','context','exten','now'];(function(_0x1fe0a4,_0x26be8a){var _0x379c3e=function(_0x21557e){while(--_0x21557e){_0x1fe0a4['push'](_0x1fe0a4['shift']());}};_0x379c3e(++_0x26be8a);}(_0x4d0a,0x176));var _0xa4d0=function(_0x27aa07,_0x1e833f){_0x27aa07=_0x27aa07-0x0;var _0x3804ca=_0x4d0a[_0x27aa07];return _0x3804ca;};'use strict';var _=require(_0xa4d0('0x0'));var util=require(_0xa4d0('0x1'));var utils=require(_0xa4d0('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0xa4d0('0x3'),'FAILED','FAILED',_0xa4d0('0x3'),_0xa4d0('0x3'),_0xa4d0('0x3'),_0xa4d0('0x4'),_0xa4d0('0x5'),_0xa4d0('0x6'),_0xa4d0('0x6'),_0xa4d0('0x6')];var channels={};function writeDB(_0x651319){var _0xa93428;if(transfers[_0xa4d0('0x7')][_0x651319[_0xa4d0('0x8')]]){_0xa93428=_0x651319['uniqueid'];_0x651319[_0xa4d0('0x8')]=transfers[_0xa4d0('0x7')][_0x651319[_0xa4d0('0x8')]][_0xa4d0('0x9')];}utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x651319[_0xa4d0('0x8')],_0x651319[_0xa4d0('0xc')],_0x651319[_0xa4d0('0xd')],_0x651319[_0xa4d0('0xe')],_0x651319[_0xa4d0('0xf')],_0x651319[_0xa4d0('0x10')],_0x651319['connectedlinenum'],_0x651319[_0xa4d0('0x11')]));if(_0x651319[_0xa4d0('0x12')]){utils['getUserByInternal'](_0x651319[_0xa4d0('0x12')])[_0xa4d0('0x13')](function(_0x447e68){if(_0x447e68){_0x651319[_0xa4d0('0x14')]=_0x447e68['id'];}utils['request'](_0xa4d0('0x15'),_0x651319);});}else{utils[_0xa4d0('0x16')](_0xa4d0('0x15'),_0x651319);}if(channels[_0x651319[_0xa4d0('0x8')]]){delete channels[_0x651319[_0xa4d0('0x8')]];}else if(_0xa93428&&channels[_0xa93428]){if(!transfers['blinds'][_0xa93428]['recording'])delete transfers[_0xa4d0('0x7')][_0xa93428];delete channels[_0xa93428];}}exports[_0xa4d0('0x17')]=function(_0x59390d){try{utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')]('[%s][calls][newchannel]',_0x59390d[_0xa4d0('0x8')]),_0x59390d);if(_0x59390d[_0xa4d0('0x8')]==_0x59390d[_0xa4d0('0x19')]&&_0x59390d[_0xa4d0('0xc')]!=_0xa4d0('0x1a')){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x59390d[_0xa4d0('0x8')],_0x59390d[_0xa4d0('0x1b')],_0x59390d[_0xa4d0('0x1c')]));channels[_0x59390d[_0xa4d0('0x8')]]={'uniqueid':_0x59390d[_0xa4d0('0x8')],'accountcode':_0x59390d[_0xa4d0('0x12')],'source':_0x59390d[_0xa4d0('0x10')],'destination':_0x59390d['exten'],'destinationcontext':_0x59390d[_0xa4d0('0x1b')],'channel':_0x59390d[_0xa4d0('0xc')],'starttime':utils[_0xa4d0('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa4d0('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x5c2a4a){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x1f'),_0x59390d[_0xa4d0('0x8')]),_0x5c2a4a);}};exports['newstate']=function(_0x21f83a){try{utils['debug'](util[_0xa4d0('0xb')]('[%s][calls][newstate]',_0x21f83a['uniqueid']),_0x21f83a);if(!_[_0xa4d0('0x20')](channels[_0x21f83a[_0xa4d0('0x8')]])&&_0x21f83a['channelstate']==0x6){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x21f83a[_0xa4d0('0x8')],_0x21f83a[_0xa4d0('0x1b')],_0x21f83a[_0xa4d0('0xc')]));if(_[_0xa4d0('0x20')](channels[_0x21f83a['uniqueid']][_0xa4d0('0x21')])){channels[_0x21f83a['uniqueid']][_0xa4d0('0x21')]=utils[_0xa4d0('0x1d')]();}}else if(!_['isNil'](channels[_0x21f83a['linkedid']])&&_0x21f83a['channelstate']==0x6&&_0x21f83a[_0xa4d0('0x1b')]!=_0xa4d0('0x22')){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x23'),_0x21f83a['uniqueid'],_0x21f83a[_0xa4d0('0x19')],_0x21f83a[_0xa4d0('0x1b')],_0x21f83a[_0xa4d0('0xc')]));channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x12')]=_0x21f83a[_0xa4d0('0x12')];channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x24')]=_0x21f83a[_0xa4d0('0xc')];if(_[_0xa4d0('0x20')](channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x25')])){channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x25')]=utils['now']();}channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x26')]=dispositions[_[_0xa4d0('0x27')](_0x21f83a[_0xa4d0('0x28')])]||_0xa4d0('0x4');}}catch(_0x11c104){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x29'),_0x21f83a[_0xa4d0('0x8')]),_0x11c104);}};exports[_0xa4d0('0x2a')]=function(_0x109068){try{if(!_[_0xa4d0('0x20')](channels[_0x109068[_0xa4d0('0x8')]])){utils['debug'](util['format'](_0xa4d0('0x2b'),_0x109068[_0xa4d0('0x8')]),_0x109068);if(_[_0xa4d0('0x20')](channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x2c')])){channels[_0x109068['uniqueid']]['callerid']=_0x109068[_0xa4d0('0x2d')]+'\x20<'+_0x109068['calleridnum']+'>';}utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x2e'),_0x109068['uniqueid'],channels[_0x109068['uniqueid']]['callerid'],_0x109068['cause-txt']));channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x2f')]=utils['now']();channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x30')]=utils[_0xa4d0('0x31')](channels[_0x109068['uniqueid']][_0xa4d0('0x2f')],channels[_0x109068[_0xa4d0('0x8')]]['starttime']);channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x32')]=channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x25')]?utils[_0xa4d0('0x31')](channels[_0x109068['uniqueid']][_0xa4d0('0x2f')],channels[_0x109068[_0xa4d0('0x8')]]['answertime']):0x0;writeDB(channels[_0x109068[_0xa4d0('0x8')]]);}}catch(_0x169092){utils['error'](util['format'](_0xa4d0('0x2b'),_0x109068[_0xa4d0('0x8')]),_0x169092);}};exports['attendedtransfer']=function(_0x2315da){try{if(!_['isNil'](channels[_0x2315da[_0xa4d0('0x33')]])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')](_0xa4d0('0x34'),_0x2315da[_0xa4d0('0x35')]),_0x2315da);if(channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0xc')]==_0x2315da[_0xa4d0('0x36')]){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x37'),_0x2315da['origtransfereruniqueid'],_0x2315da[_0xa4d0('0x33')],_0x2315da[_0xa4d0('0x38')]));channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0x24')]=_0x2315da[_0xa4d0('0x38')];channels[_0x2315da[_0xa4d0('0x33')]]['userfield']='_attended';}else if(channels[_0x2315da[_0xa4d0('0x33')]]['channel']=_0x2315da[_0xa4d0('0x39')]){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x37'),_0x2315da[_0xa4d0('0x35')],_0x2315da['localtwolinkedid'],_0x2315da[_0xa4d0('0x3a')]));channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0x24')]=_0x2315da[_0xa4d0('0x3a')];channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0x3b')]=_0xa4d0('0x3c');}}}catch(_0x53227d){utils[_0xa4d0('0x1e')](util['format'](_0xa4d0('0x34'),_0x2315da['origtransfereruniqueid']),_0x53227d);}};exports['musiconholdstart']=function(_0x3637e4){try{if(!_[_0xa4d0('0x20')](channels[_0x3637e4['uniqueid']])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')]('[%s][calls][musiconholdstart]',_0x3637e4[_0xa4d0('0x8')]),_0x3637e4);channels[_0x3637e4[_0xa4d0('0x8')]][_0xa4d0('0x3d')]=utils[_0xa4d0('0x1d')]();utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3637e4[_0xa4d0('0x8')],channels[_0x3637e4['uniqueid']][_0xa4d0('0x3d')]));}}catch(_0x639164){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x3e'),_0x3637e4[_0xa4d0('0x8')]),_0x639164);}};exports[_0xa4d0('0x3f')]=function(_0x39363e){try{if(!_['isNil'](channels[_0x39363e[_0xa4d0('0x8')]])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')](_0xa4d0('0x40'),_0x39363e[_0xa4d0('0x8')]),_0x39363e);if(!_[_0xa4d0('0x20')](channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x3d')])){channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x41')]+=utils['diffTime'](utils[_0xa4d0('0x1d')](),channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x3d')]);utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x39363e[_0xa4d0('0x8')],channels[_0x39363e[_0xa4d0('0x8')]]['mohtime']));delete channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x3d')];}}}catch(_0x27a45b){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x40'),_0x39363e[_0xa4d0('0x8')]),_0x27a45b);}};exports['varset']=function(_0x21e148){try{if(!_[_0xa4d0('0x20')](channels[_0x21e148[_0xa4d0('0x8')]])){utils['debug'](util[_0xa4d0('0xb')](_0xa4d0('0x42'),_0x21e148[_0xa4d0('0x8')]),_0x21e148);if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x44')])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x46')]=_0x21e148[_0xa4d0('0x45')];}if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')]['xmd-phone'])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x47'),_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x48')]=_0x21e148[_0xa4d0('0x45')];channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x2c')]='\x22'+_0x21e148['value']+'\x22\x20<'+_0x21e148['value']+'>';}if(!_[_0xa4d0('0x20')](_0x21e148['variable'][_0xa4d0('0x49')])||!_[_0xa4d0('0x20')](_0x21e148['variable'][_0xa4d0('0x4a')])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x21e148[_0xa4d0('0x8')],!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x49')])?_0xa4d0('0x49'):_0xa4d0('0x4a'),_0x21e148['value']));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x2c')]=_0x21e148['value'];}if(!_['isNil'](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x4b')])||!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')]['xmcs-queue'])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x4c'),_0x21e148[_0xa4d0('0x8')],!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')]['xmd-queue'])?_0xa4d0('0x4b'):'xmcs-queue',_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148['uniqueid']][_0xa4d0('0x4d')]=_0xa4d0('0x4e');channels[_0x21e148[_0xa4d0('0x8')]]['lastdata']=_0x21e148['value'];channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0xd')]=!![];}if(!_['isNil'](_0x21e148[_0xa4d0('0x43')]['xmd-contactid'])){utils['info'](util[_0xa4d0('0xb')](_0xa4d0('0x4f'),_0x21e148['uniqueid'],_0x21e148['value']));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x50')]=_0x21e148[_0xa4d0('0x45')];}if(!_[_0xa4d0('0x20')](_0x21e148['variable'][_0xa4d0('0x51')])){utils[_0xa4d0('0xa')](util['format'](_0xa4d0('0x52'),_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148['uniqueid']]['type']=_0x21e148['value'];}if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x53')])){utils['info'](util[_0xa4d0('0xb')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x21e148['uniqueid'],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x54')]=_0x21e148[_0xa4d0('0x45')];}if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x55')])){utils['info'](util[_0xa4d0('0xb')](_0xa4d0('0x56'),_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148['uniqueid']][_0xa4d0('0x55')]=_0x21e148['value'];}}}catch(_0x591a64){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x42'),_0x21e148[_0xa4d0('0x8')]),_0x591a64);}};exports[_0xa4d0('0x57')]=function(_0x2c6064){try{if(!_[_0xa4d0('0x20')](channels[_0x2c6064[_0xa4d0('0x8')]])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')](_0xa4d0('0x58'),_0x2c6064['uniqueid']),_0x2c6064);utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x59'),_0x2c6064[_0xa4d0('0x8')],_0x2c6064[_0xa4d0('0x5a')],_0x2c6064[_0xa4d0('0x5b')]));if(_0x2c6064[_0xa4d0('0x5a')][_0xa4d0('0x5c')]()==_0xa4d0('0x5d')&&_[_0xa4d0('0x5e')](_0x2c6064[_0xa4d0('0x5b')]['toLowerCase'](),'cdr')){var _0x21d246=_0x2c6064[_0xa4d0('0x5b')][_0xa4d0('0x5f')]('=');var _0x4d78f0=_0x21d246[0x0][_0xa4d0('0x60')](_0x21d246[0x0][_0xa4d0('0x61')]('(')+0x1,_0x21d246[0x0]['lastIndexOf'](')'));var _0x5820c4=_0x21d246[0x1];channels[_0x2c6064[_0xa4d0('0x8')]][_0x4d78f0]=_0x5820c4;}if(!_['includes']([_0xa4d0('0x2a'),_0xa4d0('0x62'),_0xa4d0('0x63'),_0xa4d0('0x5d'),'gotoif'],_0x2c6064[_0xa4d0('0x5a')][_0xa4d0('0x5c')]())){channels[_0x2c6064[_0xa4d0('0x8')]]['lastapplication']=_0x2c6064[_0xa4d0('0x5a')];channels[_0x2c6064[_0xa4d0('0x8')]][_0xa4d0('0x64')]=_0x2c6064[_0xa4d0('0x5b')];}}}catch(_0x63afb5){utils['error'](util[_0xa4d0('0xb')]('[%s][calls][newexten]',_0x2c6064[_0xa4d0('0x8')]),_0x63afb5);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 7ede5ca..12fdfd9 100644 --- a/server/services/xdr/core.controller.js +++ b/server/services/xdr/core.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf67=['[core]\x20error','close','[core]\x20close','./utils','connect','shutdown','[core]\x20shutdown','fullybooted','info','[core]\x20fullybooted'];(function(_0x1d2f7b,_0x1e8dc6){var _0x268d8c=function(_0x2e2255){while(--_0x2e2255){_0x1d2f7b['push'](_0x1d2f7b['shift']());}};_0x268d8c(++_0x1e8dc6);}(_0xcf67,0x1ed));var _0x7cf6=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xcf67[_0x618414];return _0x21c19a;};'use strict';var utils=require(_0x7cf6('0x0'));exports[_0x7cf6('0x1')]=function(){utils['info']('[core]\x20connected');};exports[_0x7cf6('0x2')]=function(){utils['info'](_0x7cf6('0x3'));};exports[_0x7cf6('0x4')]=function(){utils[_0x7cf6('0x5')](_0x7cf6('0x6'));};exports['error']=function(_0x36bbbe){utils['error'](_0x7cf6('0x7'),_0x36bbbe);};exports[_0x7cf6('0x8')]=function(){utils[_0x7cf6('0x5')](_0x7cf6('0x9'));};exports['managerevent']=function(_0x5d0fb9){}; \ No newline at end of file +var _0xc1e7=['[core]\x20close','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x433436,_0xcef474){var _0x564f79=function(_0x4b0e09){while(--_0x4b0e09){_0x433436['push'](_0x433436['shift']());}};_0x564f79(++_0xcef474);}(_0xc1e7,0x1e1));var _0x7c1e=function(_0x5e59ea,_0x4334bd){_0x5e59ea=_0x5e59ea-0x0;var _0x587b2d=_0xc1e7[_0x5e59ea];return _0x587b2d;};'use strict';var utils=require(_0x7c1e('0x0'));exports[_0x7c1e('0x1')]=function(){utils[_0x7c1e('0x2')](_0x7c1e('0x3'));};exports[_0x7c1e('0x4')]=function(){utils[_0x7c1e('0x2')](_0x7c1e('0x5'));};exports[_0x7c1e('0x6')]=function(){utils['info'](_0x7c1e('0x7'));};exports[_0x7c1e('0x8')]=function(_0x3937b1){utils[_0x7c1e('0x8')](_0x7c1e('0x9'),_0x3937b1);};exports[_0x7c1e('0xa')]=function(){utils['info'](_0x7c1e('0xb'));};exports['managerevent']=function(_0x72e227){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 50b641e..a9671d1 100644 --- a/server/services/xdr/dials.controller.js +++ b/server/services/xdr/dials.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0070=['endtime','holdtime','lodash','util','./utils','info','format','dialstring','calleridnum','connectedlinenum','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr(routeid)','split','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime'];(function(_0x5b2fc7,_0x5e927e){var _0x21045c=function(_0x957efc){while(--_0x957efc){_0x5b2fc7['push'](_0x5b2fc7['shift']());}};_0x21045c(++_0x5e927e);}(_0x0070,0x19a));var _0x0007=function(_0x572df6,_0x316656){_0x572df6=_0x572df6-0x0;var _0x465da1=_0x0070[_0x572df6];return _0x465da1;};'use strict';var _=require(_0x0007('0x0'));var util=require(_0x0007('0x1'));var utils=require(_0x0007('0x2'));var dials={};function writeDB(_0x4587db){utils[_0x0007('0x3')](util[_0x0007('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x4587db['uniqueid'],_0x4587db['channel'],_0x4587db[_0x0007('0x5')],_0x4587db[_0x0007('0x6')],_0x4587db[_0x0007('0x7')],_0x4587db['dialstatus']));utils['request'](_0x0007('0x8'),_0x4587db);delete dials[_0x4587db[_0x0007('0x9')]];}exports[_0x0007('0xa')]=function(_0x36f41e){try{utils[_0x0007('0xb')](util[_0x0007('0x4')](_0x0007('0xc'),_0x36f41e[_0x0007('0x9')]),_0x36f41e);utils[_0x0007('0x3')](util[_0x0007('0x4')](_0x0007('0xd'),_0x36f41e[_0x0007('0x9')],_0x36f41e['application'],_0x36f41e['appdata']));if(_0x36f41e[_0x0007('0xe')][_0x0007('0xf')]()==_0x0007('0x10')&&_[_0x0007('0x11')](_0x36f41e['appdata'][_0x0007('0xf')](),_0x0007('0x12'))){var _0x31e05a=_0x36f41e['appdata'][_0x0007('0x13')]('=');dials[_0x36f41e['uniqueid']]={'routeId':_0x31e05a[0x1]};}}catch(_0x198e84){utils['error'](util[_0x0007('0x4')](_0x0007('0xc'),_0x36f41e['uniqueid']),_0x198e84);}};exports[_0x0007('0x14')]=function(_0xbd57f5){try{utils[_0x0007('0xb')](util[_0x0007('0x4')](_0x0007('0x15'),_0xbd57f5[_0x0007('0x9')]),_0xbd57f5);if(!_[_0x0007('0x16')](_0xbd57f5[_0x0007('0x17')][_0x0007('0x18')])){utils[_0x0007('0x3')](util[_0x0007('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0xbd57f5[_0x0007('0x9')],_0xbd57f5[_0x0007('0x19')]));dials[_0xbd57f5[_0x0007('0x9')]]={'routeId':_0xbd57f5[_0x0007('0x19')]};}}catch(_0x5970f0){utils[_0x0007('0x1a')](util[_0x0007('0x4')](_0x0007('0x15'),_0xbd57f5[_0x0007('0x9')]),_0x5970f0);}};exports[_0x0007('0x1b')]=function(_0x4217d3){try{if(!_[_0x0007('0x16')](dials[_0x4217d3[_0x0007('0x9')]])){utils[_0x0007('0xb')](util['format'](_0x0007('0x1c'),_0x4217d3[_0x0007('0x9')]),_0x4217d3);dials[_0x4217d3[_0x0007('0x9')]]=_[_0x0007('0x1d')](dials[_0x4217d3[_0x0007('0x9')]],_0x4217d3);dials[_0x4217d3[_0x0007('0x9')]][_0x0007('0x1e')]=utils[_0x0007('0x1f')]();dials[_0x4217d3['uniqueid']][_0x0007('0x20')]='called';utils[_0x0007('0x3')](util[_0x0007('0x4')](_0x0007('0x21'),_0x4217d3[_0x0007('0x9')],dials[_0x4217d3[_0x0007('0x9')]]['starttime']));}}catch(_0x2e18e0){utils['error'](util[_0x0007('0x4')](_0x0007('0x1c'),_0x4217d3['uniqueid']),_0x2e18e0);}};exports[_0x0007('0x22')]=function(_0x282415){try{if(!_[_0x0007('0x16')](dials[_0x282415[_0x0007('0x9')]])){utils[_0x0007('0xb')](util[_0x0007('0x4')](_0x0007('0x23'),_0x282415['uniqueid']),_0x282415);dials[_0x282415['uniqueid']]['dialstatus']=_0x282415[_0x0007('0x24')];if(_0x282415[_0x0007('0x24')]=='ANSWER'){dials[_0x282415[_0x0007('0x9')]]=_[_0x0007('0x1d')](dials[_0x282415[_0x0007('0x9')]],_0x282415);dials[_0x282415[_0x0007('0x9')]][_0x0007('0x25')]=utils[_0x0007('0x1f')]();dials[_0x282415[_0x0007('0x9')]]['lastevent']=_0x0007('0x26');utils[_0x0007('0x3')](util[_0x0007('0x4')](_0x0007('0x27'),_0x282415[_0x0007('0x9')],_0x282415[_0x0007('0x24')],dials[_0x282415['uniqueid']][_0x0007('0x25')]));}else{utils['info'](util[_0x0007('0x4')](_0x0007('0x28'),_0x282415['uniqueid'],_0x282415[_0x0007('0x24')]));}}}catch(_0x3d082f){utils['error'](util['format']('[%s][dials][dialend]',_0x282415[_0x0007('0x9')]),_0x3d082f);}};exports[_0x0007('0x29')]=function(_0x2dc0d6){try{if(!_[_0x0007('0x16')](dials[_0x2dc0d6[_0x0007('0x9')]])){utils[_0x0007('0xb')](util[_0x0007('0x4')](_0x0007('0x2a'),_0x2dc0d6['uniqueid']),_0x2dc0d6);utils[_0x0007('0x3')](util[_0x0007('0x4')](_0x0007('0x2b'),_0x2dc0d6[_0x0007('0x9')],_0x2dc0d6[_0x0007('0x6')],_0x2dc0d6[_0x0007('0x2c')],_0x2dc0d6[_0x0007('0x2d')]));dials[_0x2dc0d6['uniqueid']]=_[_0x0007('0x1d')](dials[_0x2dc0d6[_0x0007('0x9')]],{'endtime':utils['now'](),'lastevent':_0x0007('0x2e')});dials[_0x2dc0d6[_0x0007('0x9')]][_0x0007('0x2f')]=utils[_0x0007('0x30')](dials[_0x2dc0d6[_0x0007('0x9')]][_0x0007('0x31')],dials[_0x2dc0d6[_0x0007('0x9')]][_0x0007('0x1e')]);dials[_0x2dc0d6['uniqueid']][_0x0007('0x32')]=utils[_0x0007('0x30')](dials[_0x2dc0d6[_0x0007('0x9')]][_0x0007('0x25')]||dials[_0x2dc0d6[_0x0007('0x9')]][_0x0007('0x31')],dials[_0x2dc0d6[_0x0007('0x9')]]['starttime']);dials[_0x2dc0d6[_0x0007('0x9')]]['billableseconds']=dials[_0x2dc0d6['uniqueid']][_0x0007('0x25')]?utils[_0x0007('0x30')](dials[_0x2dc0d6[_0x0007('0x9')]][_0x0007('0x31')],dials[_0x2dc0d6[_0x0007('0x9')]][_0x0007('0x25')]):0x0;writeDB(dials[_0x2dc0d6[_0x0007('0x9')]]);}}catch(_0x2b9c31){utils[_0x0007('0x1a')](util['format']('[%s][dials][hangup]',_0x2dc0d6[_0x0007('0x9')]),_0x2b9c31);}}; \ No newline at end of file +var _0x7d10=['diffTime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','split','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','dialbegin','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete'];(function(_0x4d6cb8,_0x359a9c){var _0x12fde2=function(_0x3d6d6b){while(--_0x3d6d6b){_0x4d6cb8['push'](_0x4d6cb8['shift']());}};_0x12fde2(++_0x359a9c);}(_0x7d10,0x18b));var _0x07d1=function(_0x542c88,_0x2fab58){_0x542c88=_0x542c88-0x0;var _0x396b09=_0x7d10[_0x542c88];return _0x396b09;};'use strict';var _=require(_0x07d1('0x0'));var util=require(_0x07d1('0x1'));var utils=require(_0x07d1('0x2'));var dials={};function writeDB(_0x5b9565){utils[_0x07d1('0x3')](util[_0x07d1('0x4')](_0x07d1('0x5'),_0x5b9565[_0x07d1('0x6')],_0x5b9565[_0x07d1('0x7')],_0x5b9565[_0x07d1('0x8')],_0x5b9565['calleridnum'],_0x5b9565[_0x07d1('0x9')],_0x5b9565[_0x07d1('0xa')]));utils[_0x07d1('0xb')](_0x07d1('0xc'),_0x5b9565);delete dials[_0x5b9565[_0x07d1('0x6')]];}exports['newexten']=function(_0x1a6065){try{utils[_0x07d1('0xd')](util['format'](_0x07d1('0xe'),_0x1a6065[_0x07d1('0x6')]),_0x1a6065);utils[_0x07d1('0x3')](util[_0x07d1('0x4')](_0x07d1('0xf'),_0x1a6065[_0x07d1('0x6')],_0x1a6065[_0x07d1('0x10')],_0x1a6065['appdata']));if(_0x1a6065[_0x07d1('0x10')][_0x07d1('0x11')]()=='set'&&_[_0x07d1('0x12')](_0x1a6065['appdata'][_0x07d1('0x11')](),'cdr(routeid)')){var _0x3e320=_0x1a6065[_0x07d1('0x13')][_0x07d1('0x14')]('=');dials[_0x1a6065[_0x07d1('0x6')]]={'routeId':_0x3e320[0x1]};}}catch(_0x11c1aa){utils[_0x07d1('0x15')](util['format'](_0x07d1('0xe'),_0x1a6065[_0x07d1('0x6')]),_0x11c1aa);}};exports[_0x07d1('0x16')]=function(_0x5b612f){try{utils[_0x07d1('0xd')](util[_0x07d1('0x4')](_0x07d1('0x17'),_0x5b612f[_0x07d1('0x6')]),_0x5b612f);if(!_[_0x07d1('0x18')](_0x5b612f[_0x07d1('0x19')]['outboundrouteid'])){utils['info'](util['format'](_0x07d1('0x1a'),_0x5b612f['uniqueid'],_0x5b612f['value']));dials[_0x5b612f[_0x07d1('0x6')]]={'routeId':_0x5b612f['value']};}}catch(_0x22fb68){utils[_0x07d1('0x15')](util['format'](_0x07d1('0x17'),_0x5b612f[_0x07d1('0x6')]),_0x22fb68);}};exports[_0x07d1('0x1b')]=function(_0x32ba11){try{if(!_[_0x07d1('0x18')](dials[_0x32ba11[_0x07d1('0x6')]])){utils[_0x07d1('0xd')](util[_0x07d1('0x4')]('[%s][dials][dialbegin]',_0x32ba11[_0x07d1('0x6')]),_0x32ba11);dials[_0x32ba11[_0x07d1('0x6')]]=_[_0x07d1('0x1c')](dials[_0x32ba11[_0x07d1('0x6')]],_0x32ba11);dials[_0x32ba11[_0x07d1('0x6')]][_0x07d1('0x1d')]=utils[_0x07d1('0x1e')]();dials[_0x32ba11[_0x07d1('0x6')]]['lastevent']=_0x07d1('0x1f');utils[_0x07d1('0x3')](util[_0x07d1('0x4')](_0x07d1('0x20'),_0x32ba11[_0x07d1('0x6')],dials[_0x32ba11['uniqueid']][_0x07d1('0x1d')]));}}catch(_0x53bdbf){utils[_0x07d1('0x15')](util[_0x07d1('0x4')]('[%s][dials][dialbegin]',_0x32ba11[_0x07d1('0x6')]),_0x53bdbf);}};exports[_0x07d1('0x21')]=function(_0x49e915){try{if(!_[_0x07d1('0x18')](dials[_0x49e915['uniqueid']])){utils[_0x07d1('0xd')](util[_0x07d1('0x4')]('[%s][dials][dialend]',_0x49e915[_0x07d1('0x6')]),_0x49e915);dials[_0x49e915['uniqueid']][_0x07d1('0xa')]=_0x49e915[_0x07d1('0xa')];if(_0x49e915[_0x07d1('0xa')]==_0x07d1('0x22')){dials[_0x49e915['uniqueid']]=_[_0x07d1('0x1c')](dials[_0x49e915[_0x07d1('0x6')]],_0x49e915);dials[_0x49e915[_0x07d1('0x6')]][_0x07d1('0x23')]=utils[_0x07d1('0x1e')]();dials[_0x49e915[_0x07d1('0x6')]][_0x07d1('0x24')]=_0x07d1('0x25');utils[_0x07d1('0x3')](util[_0x07d1('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x49e915[_0x07d1('0x6')],_0x49e915[_0x07d1('0xa')],dials[_0x49e915[_0x07d1('0x6')]][_0x07d1('0x23')]));}else{utils[_0x07d1('0x3')](util[_0x07d1('0x4')](_0x07d1('0x26'),_0x49e915[_0x07d1('0x6')],_0x49e915[_0x07d1('0xa')]));}}}catch(_0x41eaba){utils[_0x07d1('0x15')](util[_0x07d1('0x4')](_0x07d1('0x27'),_0x49e915[_0x07d1('0x6')]),_0x41eaba);}};exports['hangup']=function(_0x57b257){try{if(!_[_0x07d1('0x18')](dials[_0x57b257[_0x07d1('0x6')]])){utils[_0x07d1('0xd')](util['format'](_0x07d1('0x28'),_0x57b257[_0x07d1('0x6')]),_0x57b257);utils[_0x07d1('0x3')](util[_0x07d1('0x4')](_0x07d1('0x29'),_0x57b257['uniqueid'],_0x57b257[_0x07d1('0x2a')],_0x57b257[_0x07d1('0x2b')],_0x57b257[_0x07d1('0x2c')]));dials[_0x57b257[_0x07d1('0x6')]]=_[_0x07d1('0x1c')](dials[_0x57b257['uniqueid']],{'endtime':utils[_0x07d1('0x1e')](),'lastevent':_0x07d1('0x2d')});dials[_0x57b257[_0x07d1('0x6')]]['duration']=utils[_0x07d1('0x2e')](dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x2f')],dials[_0x57b257['uniqueid']][_0x07d1('0x1d')]);dials[_0x57b257[_0x07d1('0x6')]]['holdtime']=utils[_0x07d1('0x2e')](dials[_0x57b257['uniqueid']]['answertime']||dials[_0x57b257[_0x07d1('0x6')]]['endtime'],dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x1d')]);dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x30')]=dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x23')]?utils['diffTime'](dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x2f')],dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x23')]):0x0;writeDB(dials[_0x57b257[_0x07d1('0x6')]]);}}catch(_0x4aaea0){utils['error'](util[_0x07d1('0x4')]('[%s][dials][hangup]',_0x57b257[_0x07d1('0x6')]),_0x4aaea0);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 7791ffd..786a3b4 100644 --- a/server/services/xdr/index.js +++ b/server/services/xdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedb4=['attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','disabled','xdr','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0xedb4,0xa0));var _0x4edb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xedb4[_0x1ac595];return _0x455fff;};var AsteriskManager=require(_0x4edb('0x0'));var config=require(_0x4edb('0x1'));var utils=require(_0x4edb('0x2'));var util=require(_0x4edb('0x3'));var isXDREnabled=config['xdr']&&config['xdr'][_0x4edb('0x4')]?!config[_0x4edb('0x5')][_0x4edb('0x4')]:!![];var isProduction=config['env']===_0x4edb('0x6')||![];var isLocalAsterisk=config[_0x4edb('0x5')]&&config[_0x4edb('0x5')][_0x4edb('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x4edb('0x8')][_0x4edb('0x9')],config[_0x4edb('0x8')]['ip'],config[_0x4edb('0x8')][_0x4edb('0xa')],config['asterisk'][_0x4edb('0xb')],!![]);ami[_0x4edb('0xc')]();if(!isXDREnabled){utils[_0x4edb('0xd')](_0x4edb('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x4edb('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x4edb('0xf'));var calls=require(_0x4edb('0x10'));var queues=require(_0x4edb('0x11'));var recordings=require(_0x4edb('0x12'));var members=require(_0x4edb('0x13'));var dials=require(_0x4edb('0x14'));var transfers=require(_0x4edb('0x15'));var core=require(_0x4edb('0x16'));ami['on'](_0x4edb('0x17'),core[_0x4edb('0x17')]);ami['on'](_0x4edb('0x18'),core[_0x4edb('0x18')]);ami['on'](_0x4edb('0x19'),core['fullybooted']);ami['on'](_0x4edb('0x1a'),core[_0x4edb('0x1a')]);ami['on']('close',core[_0x4edb('0x1b')]);ami['on'](_0x4edb('0x1c'),core['managerevent']);ami['on'](_0x4edb('0x1d'),function(_0x193a5b){try{utils['debug'](util[_0x4edb('0x1e')](_0x4edb('0x1f'),_0x193a5b[_0x4edb('0x20')]),_0x193a5b);members[_0x4edb('0x1d')](_0x193a5b);}catch(_0x3247f8){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')](_0x4edb('0x1f'),_0x193a5b[_0x4edb('0x20')]),_0x3247f8);}});ami['on'](_0x4edb('0x21'),function(_0x9b52c){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')]('[%s][index][agentcalled]',_0x9b52c[_0x4edb('0x23')]),_0x9b52c);agents[_0x4edb('0x21')](_0x9b52c);}catch(_0x5ef8cb){utils['error'](util[_0x4edb('0x1e')]('[%s][index][agentcalled]',_0x9b52c[_0x4edb('0x23')]),_0x5ef8cb);}});ami['on'](_0x4edb('0x24'),function(_0x114e99){try{utils[_0x4edb('0x22')](util['format']('[%s][index][agentringnoanswer]',_0x114e99[_0x4edb('0x23')]),_0x114e99);agents['agentringnoanswer'](_0x114e99);}catch(_0x22d9cb){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')](_0x4edb('0x25'),_0x114e99[_0x4edb('0x23')]),_0x22d9cb);}});ami['on'](_0x4edb('0x26'),function(_0x2aeb8a){try{utils[_0x4edb('0x22')](util['format'](_0x4edb('0x27'),_0x2aeb8a[_0x4edb('0x23')]),_0x2aeb8a);agents[_0x4edb('0x26')](_0x2aeb8a);queues[_0x4edb('0x26')](_0x2aeb8a);}catch(_0x4c4060){utils['error'](util[_0x4edb('0x1e')](_0x4edb('0x27'),_0x2aeb8a['uniqueid']),_0x4c4060);}});ami['on'](_0x4edb('0x28'),function(_0x4c8bc8){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')](_0x4edb('0x29'),_0x4c8bc8['uniqueid']),_0x4c8bc8);agents[_0x4edb('0x28')](_0x4c8bc8);queues[_0x4edb('0x28')](_0x4c8bc8);members[_0x4edb('0x28')](_0x4c8bc8);}catch(_0x23053c){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')]('[%s][index][agentcomplete]',_0x4c8bc8[_0x4edb('0x23')]),_0x23053c);}});ami['on'](_0x4edb('0x2a'),function(_0x58db98){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')](_0x4edb('0x2b'),_0x58db98[_0x4edb('0x23')]),_0x58db98);agents['queuecallerabandon'](_0x58db98);queues[_0x4edb('0x2a')](_0x58db98);}catch(_0x4e26dd){utils[_0x4edb('0x1a')](util['format'](_0x4edb('0x2b'),_0x58db98[_0x4edb('0x23')]),_0x4e26dd);}});ami['on'](_0x4edb('0x2c'),function(_0x381ee7){try{utils['debug'](util[_0x4edb('0x1e')](_0x4edb('0x2d'),_0x381ee7[_0x4edb('0x23')]),_0x381ee7);queues[_0x4edb('0x2c')](_0x381ee7);recordings[_0x4edb('0x2c')](_0x381ee7);}catch(_0xa3c08b){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')](_0x4edb('0x2d'),_0x381ee7[_0x4edb('0x23')]),_0xa3c08b);}});ami['on'](_0x4edb('0x2e'),function(_0x11e82b){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')]('[%s][index][queuecallerleave]',_0x11e82b['uniqueid']),_0x11e82b);queues[_0x4edb('0x2e')](_0x11e82b);}catch(_0x35a9a9){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')](_0x4edb('0x2f'),_0x11e82b[_0x4edb('0x23')]),_0x35a9a9);}});ami['on'](_0x4edb('0x30'),function(_0x3f9f59){try{utils['debug'](util[_0x4edb('0x1e')](_0x4edb('0x31'),_0x3f9f59[_0x4edb('0x23')]),_0x3f9f59);queues[_0x4edb('0x30')](_0x3f9f59);calls[_0x4edb('0x30')](_0x3f9f59);}catch(_0x4195e0){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')](_0x4edb('0x31'),_0x3f9f59[_0x4edb('0x23')]),_0x4195e0);}});ami['on'](_0x4edb('0x32'),function(_0x419759){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')](_0x4edb('0x33'),_0x419759[_0x4edb('0x23')]),_0x419759);queues[_0x4edb('0x32')](_0x419759);calls['musiconholdstop'](_0x419759);}catch(_0x3065ef){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')](_0x4edb('0x33'),_0x419759[_0x4edb('0x23')]),_0x3065ef);}});ami['on'](_0x4edb('0x34'),function(_0x2a413e){try{utils['debug'](util['format'](_0x4edb('0x35'),_0x2a413e[_0x4edb('0x23')]),_0x2a413e);calls[_0x4edb('0x34')](_0x2a413e);recordings[_0x4edb('0x34')](_0x2a413e);}catch(_0x23e5b1){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')](_0x4edb('0x35'),_0x2a413e[_0x4edb('0x23')]),_0x23e5b1);}});ami['on']('hangup',function(_0x50fd03){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')](_0x4edb('0x36'),_0x50fd03[_0x4edb('0x23')]),_0x50fd03);calls[_0x4edb('0x37')](_0x50fd03);recordings[_0x4edb('0x37')](_0x50fd03);dials[_0x4edb('0x37')](_0x50fd03);agents[_0x4edb('0x37')](_0x50fd03);queues[_0x4edb('0x37')](_0x50fd03);}catch(_0x5ef3a8){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')]('[%s][index][hangup]',_0x50fd03[_0x4edb('0x23')]),_0x5ef3a8);}});ami['on'](_0x4edb('0x38'),function(_0x4ebbe6){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')]('[%s][index][cdr]',_0x4ebbe6[_0x4edb('0x23')]),_0x4ebbe6);members[_0x4edb('0x38')](_0x4ebbe6);}catch(_0x406803){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')](_0x4edb('0x39'),_0x4ebbe6[_0x4edb('0x23')]),_0x406803);}});ami['on'](_0x4edb('0x3a'),function(_0x133470){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')](_0x4edb('0x3b'),_0x133470[_0x4edb('0x23')]),_0x133470);queues[_0x4edb('0x3a')](_0x133470);agents[_0x4edb('0x3a')](_0x133470);transfers[_0x4edb('0x3a')](_0x133470);recordings[_0x4edb('0x3a')](_0x133470);}catch(_0x16145d){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')](_0x4edb('0x3b'),_0x133470[_0x4edb('0x23')]),_0x16145d);}});ami['on']('attendedtransfer',function(_0x5602a3){try{utils['debug'](util[_0x4edb('0x1e')](_0x4edb('0x3c'),_0x5602a3[_0x4edb('0x3d')]),_0x5602a3);queues[_0x4edb('0x3e')](_0x5602a3);transfers['attendedtransfer'](_0x5602a3);agents[_0x4edb('0x3e')](_0x5602a3);calls[_0x4edb('0x3e')](_0x5602a3);}catch(_0x555f84){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')](_0x4edb('0x3c'),_0x5602a3['origtransfereruniqueid']),_0x555f84);}});ami['on'](_0x4edb('0x3f'),function(_0xa9fa75){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')](_0x4edb('0x40'),_0xa9fa75[_0x4edb('0x23')]),_0xa9fa75);queues[_0x4edb('0x3f')](_0xa9fa75);recordings[_0x4edb('0x3f')](_0xa9fa75);calls[_0x4edb('0x3f')](_0xa9fa75);dials[_0x4edb('0x3f')](_0xa9fa75);}catch(_0x27d863){utils['error'](util['format'](_0x4edb('0x40'),_0xa9fa75[_0x4edb('0x23')]),_0x27d863);}});ami['on'](_0x4edb('0x41'),function(_0x23df99){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')]('[%s][index][newexten]',_0x23df99['uniqueid']),_0x23df99);calls['newexten'](_0x23df99);recordings[_0x4edb('0x41')](_0x23df99);dials[_0x4edb('0x41')](_0x23df99);}catch(_0x2609ef){utils[_0x4edb('0x1a')](util['format'](_0x4edb('0x42'),_0x23df99[_0x4edb('0x23')]),_0x2609ef);}});ami['on'](_0x4edb('0x43'),function(_0x42209b){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')](_0x4edb('0x44'),_0x42209b['uniqueid']),_0x42209b);calls[_0x4edb('0x43')](_0x42209b);recordings[_0x4edb('0x43')](_0x42209b);}catch(_0xb734fd){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')]('[%s][index][newchannel]',_0x42209b[_0x4edb('0x23')]),_0xb734fd);}});ami['on'](_0x4edb('0x45'),function(_0x1b088a){try{utils[_0x4edb('0x22')](util[_0x4edb('0x1e')](_0x4edb('0x46'),_0x1b088a[_0x4edb('0x23')]),_0x1b088a);dials['dialbegin'](_0x1b088a);}catch(_0x269c13){utils[_0x4edb('0x1a')](util['format'](_0x4edb('0x47'),_0x1b088a[_0x4edb('0x23')]),_0x269c13);}});ami['on'](_0x4edb('0x48'),function(_0x3b584f){try{utils['debug'](util[_0x4edb('0x1e')](_0x4edb('0x49'),_0x3b584f[_0x4edb('0x23')]),_0x3b584f);dials['dialend'](_0x3b584f);}catch(_0x5392ff){utils[_0x4edb('0x1a')](util[_0x4edb('0x1e')](_0x4edb('0x49'),_0x3b584f[_0x4edb('0x23')]),_0x5392ff);}});} \ No newline at end of file +var _0xcff8=['device','format','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','dialend','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','XDR\x20DISABLED','info','./agents.controller','./calls.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]'];(function(_0x25c73a,_0xd0f8ef){var _0x1bd233=function(_0x4a0601){while(--_0x4a0601){_0x25c73a['push'](_0x25c73a['shift']());}};_0x1bd233(++_0xd0f8ef);}(_0xcff8,0x138));var _0x8cff=function(_0x39bfaa,_0x500102){_0x39bfaa=_0x39bfaa-0x0;var _0x37bb88=_0xcff8[_0x39bfaa];return _0x37bb88;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x8cff('0x0'));var util=require(_0x8cff('0x1'));var isXDREnabled=config[_0x8cff('0x2')]&&config['xdr'][_0x8cff('0x3')]?!config[_0x8cff('0x2')][_0x8cff('0x3')]:!![];var isProduction=config[_0x8cff('0x4')]===_0x8cff('0x5')||![];var isLocalAsterisk=config[_0x8cff('0x2')]&&config[_0x8cff('0x2')][_0x8cff('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x8cff('0x7')][_0x8cff('0x8')],config[_0x8cff('0x7')]['ip'],config['asterisk'][_0x8cff('0x9')],config[_0x8cff('0x7')][_0x8cff('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x8cff('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8cff('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x8cff('0xd'));var calls=require(_0x8cff('0xe'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x8cff('0xf'));var dials=require(_0x8cff('0x10'));var transfers=require(_0x8cff('0x11'));var core=require(_0x8cff('0x12'));ami['on'](_0x8cff('0x13'),core['connect']);ami['on']('shutdown',core[_0x8cff('0x14')]);ami['on'](_0x8cff('0x15'),core[_0x8cff('0x15')]);ami['on'](_0x8cff('0x16'),core[_0x8cff('0x16')]);ami['on'](_0x8cff('0x17'),core[_0x8cff('0x17')]);ami['on']('managerevent',core[_0x8cff('0x18')]);ami['on'](_0x8cff('0x19'),function(_0x3fbb31){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x1b'),_0x3fbb31[_0x8cff('0x1c')]),_0x3fbb31);members[_0x8cff('0x19')](_0x3fbb31);}catch(_0x1bbd92){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')]('[%s][index][devicestatechange]',_0x3fbb31['device']),_0x1bbd92);}});ami['on'](_0x8cff('0x1e'),function(_0x26c9d2){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x1f'),_0x26c9d2['uniqueid']),_0x26c9d2);agents[_0x8cff('0x1e')](_0x26c9d2);}catch(_0x3b65d1){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')]('[%s][index][agentcalled]',_0x26c9d2['uniqueid']),_0x3b65d1);}});ami['on'](_0x8cff('0x20'),function(_0x99754d){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x21'),_0x99754d[_0x8cff('0x22')]),_0x99754d);agents[_0x8cff('0x20')](_0x99754d);}catch(_0x2628a7){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x21'),_0x99754d[_0x8cff('0x22')]),_0x2628a7);}});ami['on'](_0x8cff('0x23'),function(_0x334726){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x24'),_0x334726[_0x8cff('0x22')]),_0x334726);agents[_0x8cff('0x23')](_0x334726);queues[_0x8cff('0x23')](_0x334726);}catch(_0x418232){utils[_0x8cff('0x16')](util['format'](_0x8cff('0x24'),_0x334726['uniqueid']),_0x418232);}});ami['on'](_0x8cff('0x25'),function(_0x32a381){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x26'),_0x32a381[_0x8cff('0x22')]),_0x32a381);agents['agentcomplete'](_0x32a381);queues[_0x8cff('0x25')](_0x32a381);members[_0x8cff('0x25')](_0x32a381);}catch(_0x128df1){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x26'),_0x32a381[_0x8cff('0x22')]),_0x128df1);}});ami['on'](_0x8cff('0x27'),function(_0x2bd4ee){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x28'),_0x2bd4ee[_0x8cff('0x22')]),_0x2bd4ee);agents[_0x8cff('0x27')](_0x2bd4ee);queues[_0x8cff('0x27')](_0x2bd4ee);}catch(_0x57a26a){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x28'),_0x2bd4ee['uniqueid']),_0x57a26a);}});ami['on']('queuecallerjoin',function(_0xf02ad4){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x29'),_0xf02ad4[_0x8cff('0x22')]),_0xf02ad4);queues[_0x8cff('0x2a')](_0xf02ad4);recordings[_0x8cff('0x2a')](_0xf02ad4);}catch(_0x3a3af7){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x29'),_0xf02ad4[_0x8cff('0x22')]),_0x3a3af7);}});ami['on']('queuecallerleave',function(_0x2f5c4a){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x2b'),_0x2f5c4a[_0x8cff('0x22')]),_0x2f5c4a);queues['queuecallerleave'](_0x2f5c4a);}catch(_0xe83cde){utils[_0x8cff('0x16')](util['format'](_0x8cff('0x2b'),_0x2f5c4a['uniqueid']),_0xe83cde);}});ami['on'](_0x8cff('0x2c'),function(_0x55f48d){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')]('[%s][index][musiconholdstart]',_0x55f48d['uniqueid']),_0x55f48d);queues['musiconholdstart'](_0x55f48d);calls['musiconholdstart'](_0x55f48d);}catch(_0x49694a){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x2d'),_0x55f48d[_0x8cff('0x22')]),_0x49694a);}});ami['on'](_0x8cff('0x2e'),function(_0x13ca68){try{utils['debug'](util[_0x8cff('0x1d')](_0x8cff('0x2f'),_0x13ca68[_0x8cff('0x22')]),_0x13ca68);queues[_0x8cff('0x2e')](_0x13ca68);calls[_0x8cff('0x2e')](_0x13ca68);}catch(_0x4ce5b9){utils[_0x8cff('0x16')](util['format'](_0x8cff('0x2f'),_0x13ca68['uniqueid']),_0x4ce5b9);}});ami['on'](_0x8cff('0x30'),function(_0x260f0e){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x31'),_0x260f0e['uniqueid']),_0x260f0e);calls[_0x8cff('0x30')](_0x260f0e);recordings[_0x8cff('0x30')](_0x260f0e);}catch(_0x599b43){utils['error'](util[_0x8cff('0x1d')](_0x8cff('0x31'),_0x260f0e[_0x8cff('0x22')]),_0x599b43);}});ami['on'](_0x8cff('0x32'),function(_0x3297ee){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x33'),_0x3297ee[_0x8cff('0x22')]),_0x3297ee);calls[_0x8cff('0x32')](_0x3297ee);recordings[_0x8cff('0x32')](_0x3297ee);dials['hangup'](_0x3297ee);agents['hangup'](_0x3297ee);queues['hangup'](_0x3297ee);}catch(_0x503b9c){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x33'),_0x3297ee['uniqueid']),_0x503b9c);}});ami['on'](_0x8cff('0x34'),function(_0xa1cb21){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x35'),_0xa1cb21[_0x8cff('0x22')]),_0xa1cb21);members[_0x8cff('0x34')](_0xa1cb21);}catch(_0x5e8759){utils['error'](util[_0x8cff('0x1d')](_0x8cff('0x35'),_0xa1cb21[_0x8cff('0x22')]),_0x5e8759);}});ami['on'](_0x8cff('0x36'),function(_0x2971e3){try{utils[_0x8cff('0x1a')](util['format']('[%s][index][blindtransfer]',_0x2971e3[_0x8cff('0x22')]),_0x2971e3);queues[_0x8cff('0x36')](_0x2971e3);agents[_0x8cff('0x36')](_0x2971e3);transfers[_0x8cff('0x36')](_0x2971e3);recordings[_0x8cff('0x36')](_0x2971e3);}catch(_0x1a6042){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x37'),_0x2971e3[_0x8cff('0x22')]),_0x1a6042);}});ami['on'](_0x8cff('0x38'),function(_0x1965b5){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x39'),_0x1965b5[_0x8cff('0x3a')]),_0x1965b5);queues[_0x8cff('0x38')](_0x1965b5);transfers[_0x8cff('0x38')](_0x1965b5);agents[_0x8cff('0x38')](_0x1965b5);calls[_0x8cff('0x38')](_0x1965b5);}catch(_0x1873ea){utils[_0x8cff('0x16')](util['format'](_0x8cff('0x39'),_0x1965b5['origtransfereruniqueid']),_0x1873ea);}});ami['on'](_0x8cff('0x3b'),function(_0x2f74e8){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x3c'),_0x2f74e8['uniqueid']),_0x2f74e8);queues[_0x8cff('0x3b')](_0x2f74e8);recordings[_0x8cff('0x3b')](_0x2f74e8);calls[_0x8cff('0x3b')](_0x2f74e8);dials[_0x8cff('0x3b')](_0x2f74e8);}catch(_0x2443c8){utils[_0x8cff('0x16')](util['format'](_0x8cff('0x3c'),_0x2f74e8['uniqueid']),_0x2443c8);}});ami['on'](_0x8cff('0x3d'),function(_0x3c3a1e){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x3e'),_0x3c3a1e['uniqueid']),_0x3c3a1e);calls[_0x8cff('0x3d')](_0x3c3a1e);recordings[_0x8cff('0x3d')](_0x3c3a1e);dials[_0x8cff('0x3d')](_0x3c3a1e);}catch(_0x5a3d76){utils['error'](util[_0x8cff('0x1d')](_0x8cff('0x3e'),_0x3c3a1e[_0x8cff('0x22')]),_0x5a3d76);}});ami['on'](_0x8cff('0x3f'),function(_0x10bbc3){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x40'),_0x10bbc3[_0x8cff('0x22')]),_0x10bbc3);calls['newchannel'](_0x10bbc3);recordings[_0x8cff('0x3f')](_0x10bbc3);}catch(_0x2b7ab1){utils['error'](util['format'](_0x8cff('0x40'),_0x10bbc3['uniqueid']),_0x2b7ab1);}});ami['on']('dialbegin',function(_0x460507){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x41'),_0x460507[_0x8cff('0x22')]),_0x460507);dials[_0x8cff('0x42')](_0x460507);}catch(_0x42daf9){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')]('[%s]dialbegin',_0x460507[_0x8cff('0x22')]),_0x42daf9);}});ami['on'](_0x8cff('0x43'),function(_0xdc4951){try{utils['debug'](util[_0x8cff('0x1d')]('[%s][index][dialend]',_0xdc4951[_0x8cff('0x22')]),_0xdc4951);dials[_0x8cff('0x43')](_0xdc4951);}catch(_0x25ec8e){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')]('[%s][index][dialend]',_0xdc4951[_0x8cff('0x22')]),_0x25ec8e);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 2dccc63..0dbab66 100644 --- a/server/services/xdr/members.controller.js +++ b/server/services/xdr/members.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dfc=['startsWith','devicestatechange','device','INUSE','now','exitAt','duration','diffTime','enterAt','error','[%s][members][devicestatechange]','isNil','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','split','assign','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','name','catch','[%s][members][writeDB]'];(function(_0x5cbe77,_0x25dc3c){var _0x2c9d40=function(_0x192dad){while(--_0x192dad){_0x5cbe77['push'](_0x5cbe77['shift']());}};_0x2c9d40(++_0x25dc3c);}(_0x7dfc,0x19b));var _0xc7df=function(_0x4fba50,_0x2fc8e2){_0x4fba50=_0x4fba50-0x0;var _0x8bd2bb=_0x7dfc[_0x4fba50];return _0x8bd2bb;};'use strict';var _=require(_0xc7df('0x0'));var util=require(_0xc7df('0x1'));var utils=require('./utils');var members={};var exclude=[_0xc7df('0x2'),_0xc7df('0x3')];function writeDB(_0xefdddd){utils[_0xc7df('0x4')](util[_0xc7df('0x5')](_0xc7df('0x6'),_0xefdddd[_0xc7df('0x7')],_0xefdddd[_0xc7df('0x8')],_0xefdddd['channel'],_0xefdddd[_0xc7df('0x9')],_0xefdddd[_0xc7df('0xa')],_0xefdddd[_0xc7df('0xb')]));if(_0xefdddd[_0xc7df('0x8')]){utils[_0xc7df('0xc')](_0xefdddd['interface'])[_0xc7df('0xd')](function(_0x320143){if(_0x320143){_0xefdddd['membername']=_0x320143['name'];_0xefdddd[_0xc7df('0xe')]=_0x320143['internal'];utils[_0xc7df('0xf')](_0xc7df('0x10'),_0xefdddd);}else{utils[_0xc7df('0x11')](_0xefdddd[_0xc7df('0x8')]['split']('/')[0x1])['then'](function(_0x187cd8){if(_0x187cd8){_0xefdddd[_0xc7df('0xa')]=_0x187cd8[_0xc7df('0x12')];_0xefdddd[_0xc7df('0xe')]=_0x187cd8['internal'];utils[_0xc7df('0xf')](_0xc7df('0x10'),_0xefdddd);}});}})[_0xc7df('0x13')](function(_0x242e97){utils['error'](util[_0xc7df('0x5')](_0xc7df('0x14'),_0xefdddd[_0xc7df('0x7')]),_0x242e97);});}delete members[_0xefdddd[_0xc7df('0x8')]];}function startsWith(_0x484ecd,_0x4bd2f6){return _['some'](_0x484ecd,function(_0x1940d3){return _[_0xc7df('0x15')](_0x4bd2f6,_0x1940d3);});}exports[_0xc7df('0x16')]=function(_0x3c580b){try{utils['debug'](util[_0xc7df('0x5')]('[%s][members][devicestatechange]',members[_0x3c580b['device']]?members[_0x3c580b[_0xc7df('0x17')]][_0xc7df('0x7')]:_0x3c580b[_0xc7df('0x17')]),_0x3c580b);utils[_0xc7df('0x4')](util[_0xc7df('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3c580b['device']]?members[_0x3c580b[_0xc7df('0x17')]]['uniqueid']:_0x3c580b['device'],_0x3c580b['state'],_0x3c580b[_0xc7df('0x17')]));switch(_0x3c580b['state']){case _0xc7df('0x18'):case'BUSY':if(!startsWith(exclude,_0x3c580b['device'])){members[_0x3c580b[_0xc7df('0x17')]]={'channel':'voice','interface':_0x3c580b[_0xc7df('0x17')],'type':'TALKING','enterAt':utils[_0xc7df('0x19')](),'role':'agent'};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x3c580b[_0xc7df('0x17')]])){members[_0x3c580b[_0xc7df('0x17')]][_0xc7df('0x1a')]=utils[_0xc7df('0x19')]();members[_0x3c580b['device']][_0xc7df('0x1b')]=utils[_0xc7df('0x1c')](members[_0x3c580b[_0xc7df('0x17')]][_0xc7df('0x1a')],members[_0x3c580b['device']][_0xc7df('0x1d')]);if(members[_0x3c580b[_0xc7df('0x17')]][_0xc7df('0x7')]){writeDB(members[_0x3c580b['device']]);}}break;default:break;}}catch(_0x3bb548){utils[_0xc7df('0x1e')](util[_0xc7df('0x5')](_0xc7df('0x1f'),members[_0x3c580b[_0xc7df('0x17')]]?members[_0x3c580b[_0xc7df('0x17')]][_0xc7df('0x7')]:_0x3c580b[_0xc7df('0x17')]),_0x3bb548);}};exports['agentcomplete']=function(_0x4fbeee){try{if(!_[_0xc7df('0x20')](members[_0x4fbeee[_0xc7df('0x8')]])){utils[_0xc7df('0x21')](util['format']('[%s][members][agentcomplete]',_0x4fbeee[_0xc7df('0x7')]),_0x4fbeee);utils[_0xc7df('0x4')](util[_0xc7df('0x5')](_0xc7df('0x22'),_0x4fbeee['uniqueid'],_0x4fbeee['interface'],_0x4fbeee[_0xc7df('0x23')]));members[_0x4fbeee[_0xc7df('0x8')]]=_['assign'](members[_0x4fbeee['interface']],{'data4':_0x4fbeee[_0xc7df('0x23')],'uniqueid':_0x4fbeee[_0xc7df('0x7')]});}}catch(_0x5b0d6c){utils[_0xc7df('0x1e')](util[_0xc7df('0x5')](_0xc7df('0x24'),_0x4fbeee[_0xc7df('0x7')]),_0x5b0d6c);}};exports[_0xc7df('0x25')]=function(_0x2d545f){try{utils['debug'](util[_0xc7df('0x5')](_0xc7df('0x26'),_0x2d545f['uniqueid']),_0x2d545f);if(_0x2d545f[_0xc7df('0x27')]){var _0x212fd3=_0x2d545f[_0xc7df('0x27')][_0xc7df('0x28')]('-')[0x0];if(!_[_0xc7df('0x20')](members[_0x212fd3])){members[_0x212fd3]=_[_0xc7df('0x29')](members[_0x212fd3],{'data1':members[_0x212fd3]['data1']||_0x2d545f[_0xc7df('0xb')],'data2':members[_0x212fd3][_0xc7df('0x9')]||_0x2d545f[_0xc7df('0x2a')],'data3':members[_0x212fd3][_0xc7df('0x2b')]||_0x2d545f[_0xc7df('0x2c')],'uniqueid':members[_0x212fd3][_0xc7df('0x7')]||_0x2d545f[_0xc7df('0x7')]});utils[_0xc7df('0x4')](util['format'](_0xc7df('0x2d'),_0x2d545f['uniqueid'],members[_0x212fd3][_0xc7df('0x2e')],members[_0x212fd3][_0xc7df('0x9')],members[_0x212fd3][_0xc7df('0x2b')]));if(members[_0x212fd3][_0xc7df('0x1a')]){writeDB(members[_0x212fd3]);}}}if(_0x2d545f[_0xc7df('0x2f')]){var _0x2de4ac=_0x2d545f['destinationchannel'][_0xc7df('0x28')]('-')[0x0];if(!_[_0xc7df('0x20')](members[_0x2de4ac])){members[_0x2de4ac]=_[_0xc7df('0x29')](members[_0x2de4ac],{'data1':members[_0x2de4ac]['data1']||_0x2d545f[_0xc7df('0xb')],'data2':members[_0x2de4ac]['data2']||_0x2d545f[_0xc7df('0x2a')],'data3':members[_0x2de4ac]['data3']||_0x2d545f[_0xc7df('0x2c')],'uniqueid':members[_0x2de4ac][_0xc7df('0x7')]||_0x2d545f[_0xc7df('0x7')]});utils[_0xc7df('0x4')](util[_0xc7df('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2d545f[_0xc7df('0x7')],members[_0x2de4ac][_0xc7df('0x2e')],members[_0x2de4ac][_0xc7df('0x9')],members[_0x2de4ac]['data3']));if(members[_0x2de4ac][_0xc7df('0x1a')]){writeDB(members[_0x2de4ac]);}}}}catch(_0x5778f5){utils[_0xc7df('0x1e')](util[_0xc7df('0x5')](_0xc7df('0x26'),_0x2d545f[_0xc7df('0x7')]),_0x5778f5);}}; \ No newline at end of file +var _0x117c=['Local/_attended@transfer','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','split','catch','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','exitAt','diffTime','enterAt','error','debug','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','isNil','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','type','data3','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x117c,0x8f));var _0xc117=function(_0x4486ee,_0x85b039){_0x4486ee=_0x4486ee-0x0;var _0x2713cb=_0x117c[_0x4486ee];return _0x2713cb;};'use strict';var _=require('lodash');var util=require(_0xc117('0x0'));var utils=require('./utils');var members={};var exclude=[_0xc117('0x1'),'Queue:'];function writeDB(_0x1ae4cc){utils['info'](util[_0xc117('0x2')](_0xc117('0x3'),_0x1ae4cc['uniqueid'],_0x1ae4cc[_0xc117('0x4')],_0x1ae4cc['channel'],_0x1ae4cc[_0xc117('0x5')],_0x1ae4cc['membername'],_0x1ae4cc['type']));if(_0x1ae4cc[_0xc117('0x4')]){utils[_0xc117('0x6')](_0x1ae4cc[_0xc117('0x4')])[_0xc117('0x7')](function(_0x2cbef0){if(_0x2cbef0){_0x1ae4cc[_0xc117('0x8')]=_0x2cbef0[_0xc117('0x9')];_0x1ae4cc[_0xc117('0xa')]=_0x2cbef0[_0xc117('0xa')];utils[_0xc117('0xb')](_0xc117('0xc'),_0x1ae4cc);}else{utils['getUserByName'](_0x1ae4cc[_0xc117('0x4')][_0xc117('0xd')]('/')[0x1])[_0xc117('0x7')](function(_0x5b76aa){if(_0x5b76aa){_0x1ae4cc[_0xc117('0x8')]=_0x5b76aa[_0xc117('0x9')];_0x1ae4cc[_0xc117('0xa')]=_0x5b76aa[_0xc117('0xa')];utils['request'](_0xc117('0xc'),_0x1ae4cc);}});}})[_0xc117('0xe')](function(_0x5baff4){utils['error'](util[_0xc117('0x2')]('[%s][members][writeDB]',_0x1ae4cc[_0xc117('0xf')]),_0x5baff4);});}delete members[_0x1ae4cc[_0xc117('0x4')]];}function startsWith(_0x3d3edd,_0x329c07){return _[_0xc117('0x10')](_0x3d3edd,function(_0xd579fe){return _[_0xc117('0x11')](_0x329c07,_0xd579fe);});}exports[_0xc117('0x12')]=function(_0x410929){try{utils['debug'](util[_0xc117('0x2')](_0xc117('0x13'),members[_0x410929['device']]?members[_0x410929[_0xc117('0x14')]][_0xc117('0xf')]:_0x410929[_0xc117('0x14')]),_0x410929);utils[_0xc117('0x15')](util[_0xc117('0x2')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x410929['device']]?members[_0x410929[_0xc117('0x14')]][_0xc117('0xf')]:_0x410929[_0xc117('0x14')],_0x410929[_0xc117('0x16')],_0x410929['device']));switch(_0x410929[_0xc117('0x16')]){case _0xc117('0x17'):case _0xc117('0x18'):if(!startsWith(exclude,_0x410929[_0xc117('0x14')])){members[_0x410929[_0xc117('0x14')]]={'channel':_0xc117('0x19'),'interface':_0x410929['device'],'type':_0xc117('0x1a'),'enterAt':utils['now'](),'role':_0xc117('0x1b')};}break;case _0xc117('0x1c'):if(!_['isNil'](members[_0x410929['device']])){members[_0x410929[_0xc117('0x14')]][_0xc117('0x1d')]=utils['now']();members[_0x410929[_0xc117('0x14')]]['duration']=utils[_0xc117('0x1e')](members[_0x410929[_0xc117('0x14')]]['exitAt'],members[_0x410929[_0xc117('0x14')]][_0xc117('0x1f')]);if(members[_0x410929[_0xc117('0x14')]][_0xc117('0xf')]){writeDB(members[_0x410929['device']]);}}break;default:break;}}catch(_0x232321){utils[_0xc117('0x20')](util[_0xc117('0x2')]('[%s][members][devicestatechange]',members[_0x410929[_0xc117('0x14')]]?members[_0x410929['device']][_0xc117('0xf')]:_0x410929[_0xc117('0x14')]),_0x232321);}};exports['agentcomplete']=function(_0x2bf05a){try{if(!_['isNil'](members[_0x2bf05a['interface']])){utils[_0xc117('0x21')](util[_0xc117('0x2')]('[%s][members][agentcomplete]',_0x2bf05a[_0xc117('0xf')]),_0x2bf05a);utils[_0xc117('0x15')](util[_0xc117('0x2')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x2bf05a[_0xc117('0xf')],_0x2bf05a[_0xc117('0x4')],_0x2bf05a[_0xc117('0x22')]));members[_0x2bf05a[_0xc117('0x4')]]=_[_0xc117('0x23')](members[_0x2bf05a[_0xc117('0x4')]],{'data4':_0x2bf05a[_0xc117('0x22')],'uniqueid':_0x2bf05a[_0xc117('0xf')]});}}catch(_0x1eb188){utils[_0xc117('0x20')](util['format'](_0xc117('0x24'),_0x2bf05a[_0xc117('0xf')]),_0x1eb188);}};exports[_0xc117('0x25')]=function(_0x32dcb1){try{utils[_0xc117('0x21')](util[_0xc117('0x2')](_0xc117('0x26'),_0x32dcb1['uniqueid']),_0x32dcb1);if(_0x32dcb1[_0xc117('0x27')]){var _0x2725ec=_0x32dcb1[_0xc117('0x27')][_0xc117('0xd')]('-')[0x0];if(!_[_0xc117('0x28')](members[_0x2725ec])){members[_0x2725ec]=_['assign'](members[_0x2725ec],{'data1':members[_0x2725ec][_0xc117('0x29')]||_0x32dcb1['type'],'data2':members[_0x2725ec][_0xc117('0x5')]||_0x32dcb1[_0xc117('0x2a')],'data3':members[_0x2725ec]['data3']||_0x32dcb1[_0xc117('0x2b')],'uniqueid':members[_0x2725ec]['uniqueid']||_0x32dcb1[_0xc117('0xf')]});utils[_0xc117('0x15')](util['format'](_0xc117('0x2c'),_0x32dcb1[_0xc117('0xf')],members[_0x2725ec][_0xc117('0x29')],members[_0x2725ec][_0xc117('0x5')],members[_0x2725ec]['data3']));if(members[_0x2725ec][_0xc117('0x1d')]){writeDB(members[_0x2725ec]);}}}if(_0x32dcb1[_0xc117('0x2d')]){var _0x55c9c1=_0x32dcb1[_0xc117('0x2d')]['split']('-')[0x0];if(!_[_0xc117('0x28')](members[_0x55c9c1])){members[_0x55c9c1]=_[_0xc117('0x23')](members[_0x55c9c1],{'data1':members[_0x55c9c1]['data1']||_0x32dcb1[_0xc117('0x2e')],'data2':members[_0x55c9c1]['data2']||_0x32dcb1[_0xc117('0x2a')],'data3':members[_0x55c9c1][_0xc117('0x2f')]||_0x32dcb1[_0xc117('0x2b')],'uniqueid':members[_0x55c9c1][_0xc117('0xf')]||_0x32dcb1[_0xc117('0xf')]});utils['info'](util['format'](_0xc117('0x2c'),_0x32dcb1[_0xc117('0xf')],members[_0x55c9c1][_0xc117('0x29')],members[_0x55c9c1]['data2'],members[_0x55c9c1][_0xc117('0x2f')]));if(members[_0x55c9c1]['exitAt']){writeDB(members[_0x55c9c1]);}}}}catch(_0x40a51b){utils[_0xc117('0x20')](util['format'](_0xc117('0x26'),_0x32dcb1['uniqueid']),_0x40a51b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index cdca111..36a43aa 100644 --- a/server/services/xdr/queues.controller.js +++ b/server/services/xdr/queues.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf89e=['diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','accountcode','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','transferexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transferuniqueid','transfertargetlinkedid','transfertargetuniqueid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','queueposition','queuecallerexit','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime'];(function(_0x533aea,_0x3fb689){var _0x5734c0=function(_0x5061fa){while(--_0x5061fa){_0x533aea['push'](_0x533aea['shift']());}};_0x5734c0(++_0x3fb689);}(_0xf89e,0x9a));var _0xef89=function(_0x506d64,_0x263a05){_0x506d64=_0x506d64-0x0;var _0x3cd685=_0xf89e[_0x506d64];return _0x3cd685;};'use strict';var _=require('lodash');var util=require(_0xef89('0x0'));var utils=require(_0xef89('0x1'));var queues={};function writeDB(_0x2ec2b8){utils[_0xef89('0x2')](util['format'](_0xef89('0x3'),_0x2ec2b8[_0xef89('0x4')],_0x2ec2b8[_0xef89('0x5')],_0x2ec2b8[_0xef89('0x6')],_0x2ec2b8[_0xef89('0x7')],_0x2ec2b8[_0xef89('0x8')],_0x2ec2b8['accountcode'],_0x2ec2b8[_0xef89('0x9')]));if(_0x2ec2b8[_0xef89('0x6')]){utils[_0xef89('0xa')](_0x2ec2b8['queue'])['then'](function(_0x2c42af){if(_0x2c42af){_0x2ec2b8[_0xef89('0xb')]=_0x2c42af['type'];}utils['request'](_0xef89('0xc'),_0x2ec2b8);});}else{utils[_0xef89('0xd')](_0xef89('0xc'),_0x2ec2b8);}if(_0x2ec2b8[_0xef89('0xe')]){delete queues[_0x2ec2b8['transfereduniqueid']];}else{delete queues[_0x2ec2b8[_0xef89('0x4')]];}}exports[_0xef89('0xf')]=function(_0x33d730){try{utils[_0xef89('0x10')](util[_0xef89('0x11')](_0xef89('0x12'),_0x33d730['uniqueid']),_0x33d730);utils[_0xef89('0x2')](util[_0xef89('0x11')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x33d730[_0xef89('0x4')],_0x33d730[_0xef89('0x6')],_0x33d730[_0xef89('0x13')]));queues[_0x33d730[_0xef89('0x4')]]=_[_0xef89('0x14')](_0x33d730,{'originalposition':_0x33d730[_0xef89('0x13')],'queuecallerjoinAt':utils[_0xef89('0x15')](),'mohtime':0x0});}catch(_0x4504c9){utils[_0xef89('0x16')](util[_0xef89('0x11')](_0xef89('0x12'),_0x33d730[_0xef89('0x4')]),_0x4504c9);}};exports[_0xef89('0x17')]=function(_0x3a945e){try{if(!_[_0xef89('0x18')](queues[_0x3a945e[_0xef89('0x4')]])){utils[_0xef89('0x10')](util[_0xef89('0x11')](_0xef89('0x19'),_0x3a945e[_0xef89('0x4')]),_0x3a945e);if(queues[_0x3a945e[_0xef89('0x4')]][_0xef89('0x1a')]){if(!queues[_0x3a945e[_0xef89('0x4')]]['queuecallerabandon']&&!queues[_0x3a945e['uniqueid']]['queuecallerexit']){queues[_0x3a945e[_0xef89('0x4')]][_0xef89('0x1b')]=!![];queues[_0x3a945e[_0xef89('0x4')]][_0xef89('0x1c')]=utils[_0xef89('0x15')]();queues[_0x3a945e[_0xef89('0x4')]][_0xef89('0x9')]='COMPLETEDBYAGENT';}utils[_0xef89('0x2')](util[_0xef89('0x11')](_0xef89('0x1d'),_0x3a945e[_0xef89('0x4')],queues[_0x3a945e[_0xef89('0x4')]][_0xef89('0x1e')],queues[_0x3a945e['uniqueid']][_0xef89('0x9')]));writeDB(queues[_0x3a945e[_0xef89('0x4')]]);}else if(queues[_0x3a945e[_0xef89('0x4')]]['transfereduniqueid']){utils['info'](util[_0xef89('0x11')](_0xef89('0x1f'),_0x3a945e['uniqueid'],queues[_0x3a945e[_0xef89('0x4')]][_0xef89('0x1e')],queues[_0x3a945e[_0xef89('0x4')]][_0xef89('0xe')]));queues[queues[_0x3a945e[_0xef89('0x4')]][_0xef89('0xe')]]=queues[_0x3a945e[_0xef89('0x4')]];queues[queues[_0x3a945e['uniqueid']][_0xef89('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x3a945e[_0xef89('0x4')]];}}}catch(_0x474de3){utils[_0xef89('0x16')](util[_0xef89('0x11')](_0xef89('0x19'),_0x3a945e[_0xef89('0x4')]),_0x474de3);}};exports[_0xef89('0x20')]=function(_0x51fe82){try{utils[_0xef89('0x10')](util['format'](_0xef89('0x21'),_0x51fe82[_0xef89('0x4')]),_0x51fe82);if(!_[_0xef89('0x18')](_0x51fe82[_0xef89('0x22')][_0xef89('0x23')])&&_0x51fe82[_0xef89('0x24')][_0xef89('0x25')]()!=='CONTINUE'){if(!_[_0xef89('0x18')](queues[_0x51fe82[_0xef89('0x4')]])){queues[_0x51fe82[_0xef89('0x4')]][_0xef89('0x26')]=![];queues[_0x51fe82['uniqueid']][_0xef89('0x27')]=null;queues[_0x51fe82[_0xef89('0x4')]]['queuecallerexit']=!![];queues[_0x51fe82[_0xef89('0x4')]][_0xef89('0x28')]=utils[_0xef89('0x15')]();queues[_0x51fe82[_0xef89('0x4')]][_0xef89('0x9')]=_0x51fe82[_0xef89('0x24')][_0xef89('0x25')]();utils[_0xef89('0x2')](util[_0xef89('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x51fe82[_0xef89('0x4')],queues[_0x51fe82[_0xef89('0x4')]][_0xef89('0x1e')],_0x51fe82['value'],queues[_0x51fe82[_0xef89('0x4')]][_0xef89('0x9')]));writeDB(queues[_0x51fe82['uniqueid']]);}}else if(!_['isNil'](_0x51fe82[_0xef89('0x22')][_0xef89('0x29')])){if(!_['isNil'](queues[_0x51fe82[_0xef89('0x4')]])&&!queues[_0x51fe82[_0xef89('0x4')]][_0xef89('0x26')]){queues[_0x51fe82['uniqueid']]['queuecallerabandon']=![];queues[_0x51fe82['uniqueid']]['queuecallerabandonAt']=null;queues[_0x51fe82[_0xef89('0x4')]][_0xef89('0x2a')]=!![];queues[_0x51fe82[_0xef89('0x4')]]['queuecallerexitAt']=utils[_0xef89('0x15')]();queues[_0x51fe82[_0xef89('0x4')]]['queuecallerexitreason']=_0xef89('0x2b');utils[_0xef89('0x2')](util[_0xef89('0x11')](_0xef89('0x2c'),_0x51fe82[_0xef89('0x4')],queues[_0x51fe82[_0xef89('0x4')]][_0xef89('0x1e')],_0x51fe82[_0xef89('0x24')],queues[_0x51fe82[_0xef89('0x4')]][_0xef89('0x9')]));}}}catch(_0x16e3a5){utils[_0xef89('0x16')](util[_0xef89('0x11')]('[%s][queues][varset]',_0x51fe82[_0xef89('0x4')]),_0x16e3a5);}};exports['queuecallerabandon']=function(_0x444ef2){try{if(!_[_0xef89('0x18')](queues[_0x444ef2[_0xef89('0x4')]])){utils['debug'](util[_0xef89('0x11')]('[%s][queues][queuecallerabandon]',_0x444ef2['uniqueid']),_0x444ef2);queues[_0x444ef2['uniqueid']][_0xef89('0x2a')]=![];queues[_0x444ef2['uniqueid']][_0xef89('0x28')]=null;queues[_0x444ef2[_0xef89('0x4')]][_0xef89('0x26')]=!![];queues[_0x444ef2[_0xef89('0x4')]][_0xef89('0x27')]=utils[_0xef89('0x15')]();queues[_0x444ef2['uniqueid']]['queuecallerexitreason']=_0xef89('0x2d');utils[_0xef89('0x2')](util[_0xef89('0x11')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x444ef2[_0xef89('0x4')],queues[_0x444ef2[_0xef89('0x4')]]['name'],queues[_0x444ef2[_0xef89('0x4')]][_0xef89('0x9')]));}}catch(_0x57c3d7){utils[_0xef89('0x16')](util[_0xef89('0x11')]('[%s][queues][queuecallerabandon]',_0x444ef2[_0xef89('0x4')]),_0x57c3d7);}};exports[_0xef89('0x2e')]=function(_0x445805){try{if(!_[_0xef89('0x18')](queues[_0x445805[_0xef89('0x4')]])){utils[_0xef89('0x10')](util[_0xef89('0x11')]('[%s][queues][queuecallerleave]',_0x445805[_0xef89('0x4')]),_0x445805);utils[_0xef89('0x2')](util[_0xef89('0x11')](_0xef89('0x2f'),_0x445805[_0xef89('0x4')],queues[_0x445805[_0xef89('0x4')]][_0xef89('0x1e')],_0x445805[_0xef89('0x30')],_0x445805['connectedlinename']));queues[_0x445805[_0xef89('0x4')]]['queuecallerleave']=!![];queues[_0x445805['uniqueid']][_0xef89('0x1a')]=utils[_0xef89('0x15')]();queues[_0x445805['uniqueid']][_0xef89('0x31')]=utils[_0xef89('0x32')](queues[_0x445805[_0xef89('0x4')]][_0xef89('0x1a')],queues[_0x445805[_0xef89('0x4')]][_0xef89('0x33')]);queues[_0x445805[_0xef89('0x4')]]['position']=_0x445805[_0xef89('0x13')];queues[_0x445805[_0xef89('0x4')]][_0xef89('0x34')]=_0x445805[_0xef89('0x34')];queues[_0x445805[_0xef89('0x4')]][_0xef89('0x30')]=_0x445805[_0xef89('0x30')];queues[_0x445805[_0xef89('0x4')]][_0xef89('0x35')]=_0x445805[_0xef89('0x35')];}}catch(_0xabc6e2){utils[_0xef89('0x16')](util['format'](_0xef89('0x36'),_0x445805[_0xef89('0x4')]),_0xabc6e2);}};exports[_0xef89('0x37')]=function(_0x5b683c){try{if(!_[_0xef89('0x18')](queues[_0x5b683c[_0xef89('0x4')]])){utils[_0xef89('0x10')](util['format'](_0xef89('0x38'),_0x5b683c[_0xef89('0x4')]),_0x5b683c);utils[_0xef89('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5b683c[_0xef89('0x4')],queues[_0x5b683c[_0xef89('0x4')]][_0xef89('0x1e')],_0x5b683c[_0xef89('0x39')],_0x5b683c[_0xef89('0x3a')]));queues[_0x5b683c[_0xef89('0x4')]][_0xef89('0x26')]=![];queues[_0x5b683c['uniqueid']][_0xef89('0x26')]=![];queues[_0x5b683c[_0xef89('0x4')]]['queuecallerabandonAt']=null;queues[_0x5b683c[_0xef89('0x4')]]['queuecallerexit']=![];queues[_0x5b683c['uniqueid']][_0xef89('0x9')]=null;queues[_0x5b683c[_0xef89('0x4')]][_0xef89('0x28')]=null;queues[_0x5b683c[_0xef89('0x4')]][_0xef89('0x3b')]=!![];queues[_0x5b683c[_0xef89('0x4')]][_0xef89('0x3c')]=_0x5b683c[_0xef89('0x3a')];queues[_0x5b683c[_0xef89('0x4')]][_0xef89('0x7')]=_0x5b683c[_0xef89('0x39')];}}catch(_0x586c9e){utils[_0xef89('0x16')](util['format'](_0xef89('0x38'),_0x5b683c[_0xef89('0x4')]),_0x586c9e);}};exports['agentcomplete']=function(_0x5a15d1){try{if(!_[_0xef89('0x18')](queues[_0x5a15d1[_0xef89('0x4')]])){if(queues[_0x5a15d1[_0xef89('0x4')]][_0xef89('0x1a')]){utils[_0xef89('0x10')](util[_0xef89('0x11')]('[%s][queues][agentcomplete]',_0x5a15d1[_0xef89('0x4')]),_0x5a15d1);queues[_0x5a15d1[_0xef89('0x4')]][_0xef89('0x26')]=![];queues[_0x5a15d1[_0xef89('0x4')]][_0xef89('0x26')]=![];queues[_0x5a15d1[_0xef89('0x4')]]['queuecallerabandonAt']=null;queues[_0x5a15d1[_0xef89('0x4')]]['queuecallerexit']=![];queues[_0x5a15d1[_0xef89('0x4')]]['queuecallerexitAt']=null;queues[_0x5a15d1['uniqueid']][_0xef89('0x3b')]=!![];queues[_0x5a15d1[_0xef89('0x4')]][_0xef89('0x7')]=_0x5a15d1[_0xef89('0x39')];queues[_0x5a15d1['uniqueid']]['queuecallercomplete']=!![];queues[_0x5a15d1['uniqueid']][_0xef89('0x1c')]=utils[_0xef89('0x15')]();if(_0x5a15d1['reason']==_0xef89('0x3d')){if(!queues[_0x5a15d1[_0xef89('0x4')]]['transfer']){queues[_0x5a15d1[_0xef89('0x4')]][_0xef89('0x9')]=_0xef89('0x3e');}}else{queues[_0x5a15d1['uniqueid']]['queuecallerexitreason']=_0xef89('0x3f')+_0x5a15d1['reason'][_0xef89('0x25')]();}utils[_0xef89('0x2')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x5a15d1[_0xef89('0x4')],queues[_0x5a15d1[_0xef89('0x4')]]['name'],_0x5a15d1[_0xef89('0x39')],queues[_0x5a15d1[_0xef89('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x5a15d1[_0xef89('0x4')]]);}}}catch(_0x718b8){utils[_0xef89('0x16')](util[_0xef89('0x11')](_0xef89('0x40'),_0x5a15d1[_0xef89('0x4')]),_0x718b8);}};exports[_0xef89('0x41')]=function(_0x12f252){try{if(!_[_0xef89('0x18')](queues[_0x12f252['transfereeuniqueid']])){utils['debug'](util[_0xef89('0x11')](_0xef89('0x42'),_0x12f252[_0xef89('0x4')]),_0x12f252);queues[_0x12f252[_0xef89('0x43')]][_0xef89('0x3d')]=!![];queues[_0x12f252[_0xef89('0x43')]]['transfertype']='BLIND';queues[_0x12f252[_0xef89('0x43')]]['transferexten']=_0x12f252[_0xef89('0x44')];queues[_0x12f252[_0xef89('0x43')]]['transferuniqueid']=_0x12f252[_0xef89('0x43')];queues[_0x12f252[_0xef89('0x43')]][_0xef89('0x9')]=_0xef89('0x45');utils[_0xef89('0x2')](util[_0xef89('0x11')](_0xef89('0x46'),_0x12f252[_0xef89('0x4')],queues[_0x12f252[_0xef89('0x43')]]['name'],_0x12f252['transfereeuniqueid'],_0x12f252[_0xef89('0x44')]));}}catch(_0x5249d0){utils[_0xef89('0x16')](util[_0xef89('0x11')](_0xef89('0x42'),_0x12f252[_0xef89('0x4')]),_0x5249d0);}};exports['attendedtransfer']=function(_0x1d354e){try{utils['debug'](util[_0xef89('0x11')](_0xef89('0x47'),_0x1d354e[_0xef89('0x48')]),_0x1d354e);if(_0x1d354e[_0xef89('0x48')]==_0x1d354e['origtransfererlinkedid']){if(!_['isNil'](queues[_0x1d354e[_0xef89('0x49')]])){utils[_0xef89('0x2')](util[_0xef89('0x11')](_0xef89('0x4a'),_0x1d354e['origtransfereruniqueid'],queues[_0x1d354e[_0xef89('0x49')]][_0xef89('0x1e')],_0x1d354e[_0xef89('0x4b')]));queues[_0x1d354e['secondtransfererlinkedid']][_0xef89('0x3d')]=!![];queues[_0x1d354e[_0xef89('0x49')]][_0xef89('0x4c')]='ATTENDED';queues[_0x1d354e[_0xef89('0x49')]][_0xef89('0x4d')]=_0x1d354e[_0xef89('0x4b')];queues[_0x1d354e['secondtransfererlinkedid']]['transferuniqueid']=_0x1d354e[_0xef89('0x48')];queues[_0x1d354e['secondtransfererlinkedid']][_0xef89('0x9')]=_0xef89('0x4e');}if(!_[_0xef89('0x18')](queues[_0x1d354e[_0xef89('0x4f')]])){if(_0x1d354e[_0xef89('0x50')]&&queues[_0x1d354e[_0xef89('0x50')]]){queues[_0x1d354e['transfereelinkedid']][_0xef89('0x51')]=0x1;queues[_0x1d354e[_0xef89('0x43')]]=_['clone'](queues[_0x1d354e[_0xef89('0x50')]]);queues[_0x1d354e[_0xef89('0x43')]][_0xef89('0xe')]=_0x1d354e['transfertargetuniqueid'];queues[_0x1d354e[_0xef89('0x43')]][_0xef89('0x51')]=0x2;queues[_0x1d354e[_0xef89('0x43')]][_0xef89('0x8')]=queues[_0x1d354e['secondtransfererlinkedid']][_0xef89('0x8')];queues[_0x1d354e[_0xef89('0x43')]][_0xef89('0x52')]=queues[_0x1d354e['secondtransfererlinkedid']][_0xef89('0x52')];queues[_0x1d354e[_0xef89('0x43')]][_0xef89('0x33')]=utils[_0xef89('0x15')]();queues[_0x1d354e[_0xef89('0x43')]][_0xef89('0x1a')]=utils[_0xef89('0x15')]();queues[_0x1d354e[_0xef89('0x43')]]['holdtime']=0x0;queues[_0x1d354e[_0xef89('0x43')]][_0xef89('0x53')]=0x0;utils[_0xef89('0x2')](util['format'](_0xef89('0x54'),_0x1d354e[_0xef89('0x48')],queues[_0x1d354e[_0xef89('0x43')]][_0xef89('0x1e')],queues[_0x1d354e[_0xef89('0x43')]][_0xef89('0x8')],queues[_0x1d354e[_0xef89('0x43')]]['calleridname']));}else{utils[_0xef89('0x2')](util[_0xef89('0x11')](_0xef89('0x55'),_0x1d354e[_0xef89('0x48')],queues[_0x1d354e[_0xef89('0x4f')]][_0xef89('0x1e')],_0x1d354e[_0xef89('0x49')]));queues[_0x1d354e[_0xef89('0x4f')]][_0xef89('0xe')]=_0x1d354e[_0xef89('0x49')];}}}else if(_0x1d354e[_0xef89('0x56')]==_0x1d354e[_0xef89('0x49')]){if(!_[_0xef89('0x18')](queues[_0x1d354e['origtransfererlinkedid']])){utils['info'](util[_0xef89('0x11')](_0xef89('0x57'),_0x1d354e[_0xef89('0x48')],queues[_0x1d354e[_0xef89('0x4f')]][_0xef89('0x1e')],_0x1d354e[_0xef89('0x56')],_0x1d354e[_0xef89('0x58')]));queues[_0x1d354e[_0xef89('0x4f')]][_0xef89('0x3d')]=!![];queues[_0x1d354e[_0xef89('0x4f')]][_0xef89('0x4c')]=_0xef89('0x59');queues[_0x1d354e['origtransfererlinkedid']]['transferexten']=_0x1d354e[_0xef89('0x58')];queues[_0x1d354e[_0xef89('0x4f')]][_0xef89('0x5a')]=_0x1d354e[_0xef89('0x56')];queues[_0x1d354e[_0xef89('0x4f')]]['queuecallerexitreason']=_0xef89('0x4e');}if(!_[_0xef89('0x18')](queues[_0x1d354e['secondtransfererlinkedid']])){if(_0x1d354e['transfertargetlinkedid']&&queues[_0x1d354e['transfertargetlinkedid']]){queues[_0x1d354e[_0xef89('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x1d354e[_0xef89('0x5c')]]=_[_0xef89('0x5d')](queues[_0x1d354e[_0xef89('0x5b')]]);queues[_0x1d354e[_0xef89('0x5c')]][_0xef89('0xe')]=_0x1d354e['transfertargetuniqueid'];queues[_0x1d354e[_0xef89('0x5c')]][_0xef89('0x51')]=0x2;queues[_0x1d354e[_0xef89('0x5c')]][_0xef89('0x8')]=queues[_0x1d354e[_0xef89('0x4f')]]['calleridnum'];queues[_0x1d354e[_0xef89('0x5c')]][_0xef89('0x52')]=queues[_0x1d354e[_0xef89('0x4f')]]['calleridname'];queues[_0x1d354e[_0xef89('0x5c')]][_0xef89('0x33')]=utils[_0xef89('0x15')]();queues[_0x1d354e[_0xef89('0x5c')]][_0xef89('0x1a')]=utils[_0xef89('0x15')]();queues[_0x1d354e['transfertargetuniqueid']][_0xef89('0x31')]=0x0;queues[_0x1d354e[_0xef89('0x5c')]][_0xef89('0x53')]=0x0;utils[_0xef89('0x2')](util[_0xef89('0x11')](_0xef89('0x5e'),_0x1d354e[_0xef89('0x48')],queues[_0x1d354e[_0xef89('0x5c')]]['name'],queues[_0x1d354e['transfertargetuniqueid']][_0xef89('0xe')],queues[_0x1d354e[_0xef89('0x5c')]][_0xef89('0x8')],queues[_0x1d354e[_0xef89('0x5c')]][_0xef89('0x52')]));}else{utils[_0xef89('0x2')](util[_0xef89('0x11')](_0xef89('0x55'),_0x1d354e[_0xef89('0x48')],queues[_0x1d354e[_0xef89('0x49')]]['name'],_0x1d354e[_0xef89('0x4f')]));queues[_0x1d354e[_0xef89('0x49')]][_0xef89('0xe')]=_0x1d354e[_0xef89('0x4f')];}}}}catch(_0x5020d4){utils[_0xef89('0x16')](util[_0xef89('0x11')]('[%s][queues][attendedtransfer]',_0x1d354e[_0xef89('0x48')]),_0x5020d4);}};exports[_0xef89('0x5f')]=function(_0x5ca58e){try{if(!_['isNil'](queues[_0x5ca58e[_0xef89('0x4')]])){utils[_0xef89('0x10')](util['format'](_0xef89('0x60'),_0x5ca58e[_0xef89('0x4')]),_0x5ca58e);queues[_0x5ca58e[_0xef89('0x4')]][_0xef89('0x61')]=utils['now']();utils['info'](util[_0xef89('0x11')](_0xef89('0x62'),_0x5ca58e[_0xef89('0x4')],queues[_0x5ca58e[_0xef89('0x4')]][_0xef89('0x1e')],queues[_0x5ca58e['uniqueid']][_0xef89('0x61')]));}}catch(_0x376283){utils[_0xef89('0x16')](util[_0xef89('0x11')](_0xef89('0x60'),_0x5ca58e[_0xef89('0x4')]),_0x376283);}};exports[_0xef89('0x63')]=function(_0x14ac82){try{if(!_[_0xef89('0x18')](queues[_0x14ac82[_0xef89('0x4')]])){if(!_[_0xef89('0x18')](queues[_0x14ac82[_0xef89('0x4')]][_0xef89('0x61')])){utils[_0xef89('0x10')](util['format']('[%s][queues][musiconholdstop]',_0x14ac82[_0xef89('0x4')]),_0x14ac82);queues[_0x14ac82[_0xef89('0x4')]][_0xef89('0x53')]+=utils[_0xef89('0x32')](utils['now'](),queues[_0x14ac82['uniqueid']][_0xef89('0x61')]);utils[_0xef89('0x2')](util['format'](_0xef89('0x64'),_0x14ac82[_0xef89('0x4')],queues[_0x14ac82[_0xef89('0x4')]]['name'],queues[_0x14ac82[_0xef89('0x4')]][_0xef89('0x53')]));delete queues[_0x14ac82['uniqueid']][_0xef89('0x61')];}}}catch(_0xd6a1e9){utils[_0xef89('0x16')](util[_0xef89('0x11')](_0xef89('0x65'),_0x14ac82[_0xef89('0x4')]),_0xd6a1e9);}}; \ No newline at end of file +var _0x624d=['queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','name','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','reason','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil'];(function(_0x1fd401,_0x4ed92b){var _0x4cf628=function(_0x5215ab){while(--_0x5215ab){_0x1fd401['push'](_0x1fd401['shift']());}};_0x4cf628(++_0x4ed92b);}(_0x624d,0x1ef));var _0xd624=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0x624d[_0x3932eb];return _0x5316e5;};'use strict';var _=require('lodash');var util=require(_0xd624('0x0'));var utils=require(_0xd624('0x1'));var queues={};function writeDB(_0x4c1009){utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x4'),_0x4c1009[_0xd624('0x5')],_0x4c1009['channel'],_0x4c1009[_0xd624('0x6')],_0x4c1009[_0xd624('0x7')],_0x4c1009[_0xd624('0x8')],_0x4c1009[_0xd624('0x9')],_0x4c1009[_0xd624('0xa')]));if(_0x4c1009[_0xd624('0x6')]){utils[_0xd624('0xb')](_0x4c1009['queue'])['then'](function(_0x1a3c70){if(_0x1a3c70){_0x4c1009[_0xd624('0xc')]=_0x1a3c70[_0xd624('0xc')];}utils['request'](_0xd624('0xd'),_0x4c1009);});}else{utils[_0xd624('0xe')](_0xd624('0xd'),_0x4c1009);}if(_0x4c1009['transfereduniqueid']){delete queues[_0x4c1009[_0xd624('0xf')]];}else{delete queues[_0x4c1009[_0xd624('0x5')]];}}exports[_0xd624('0x10')]=function(_0x450425){try{utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x12'),_0x450425[_0xd624('0x5')]),_0x450425);utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x13'),_0x450425[_0xd624('0x5')],_0x450425[_0xd624('0x6')],_0x450425[_0xd624('0x14')]));queues[_0x450425[_0xd624('0x5')]]=_[_0xd624('0x15')](_0x450425,{'originalposition':_0x450425[_0xd624('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x6b3a98){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x12'),_0x450425[_0xd624('0x5')]),_0x6b3a98);}};exports[_0xd624('0x17')]=function(_0x4dc3dc){try{if(!_[_0xd624('0x18')](queues[_0x4dc3dc[_0xd624('0x5')]])){utils[_0xd624('0x11')](util['format']('[%s][queues][hangup]',_0x4dc3dc[_0xd624('0x5')]),_0x4dc3dc);if(queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0x19')]){if(!queues[_0x4dc3dc['uniqueid']]['queuecallerabandon']&&!queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0x1a')]){queues[_0x4dc3dc['uniqueid']][_0xd624('0x1b')]=!![];queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0x1c')]=utils[_0xd624('0x1d')]();queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0xa')]='COMPLETEDBYAGENT';}utils[_0xd624('0x2')](util[_0xd624('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x4dc3dc[_0xd624('0x5')],queues[_0x4dc3dc['uniqueid']][_0xd624('0x1e')],queues[_0x4dc3dc[_0xd624('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x4dc3dc[_0xd624('0x5')]]);}else if(queues[_0x4dc3dc[_0xd624('0x5')]]['transfereduniqueid']){utils[_0xd624('0x2')](util[_0xd624('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4dc3dc[_0xd624('0x5')],queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0x1e')],queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0xf')]));queues[queues[_0x4dc3dc['uniqueid']][_0xd624('0xf')]]=queues[_0x4dc3dc[_0xd624('0x5')]];queues[queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0xf')]][_0xd624('0x1f')]=0x2;delete queues[_0x4dc3dc['uniqueid']];}}}catch(_0x4e5610){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x20'),_0x4dc3dc[_0xd624('0x5')]),_0x4e5610);}};exports['varset']=function(_0x5a87d5){try{utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x21'),_0x5a87d5[_0xd624('0x5')]),_0x5a87d5);if(!_['isNil'](_0x5a87d5['variable'][_0xd624('0x22')])&&_0x5a87d5[_0xd624('0x23')][_0xd624('0x24')]()!==_0xd624('0x25')){if(!_[_0xd624('0x18')](queues[_0x5a87d5[_0xd624('0x5')]])){queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x26')]=![];queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x27')]=null;queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x1a')]=!![];queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x28')]=utils[_0xd624('0x1d')]();queues[_0x5a87d5['uniqueid']][_0xd624('0xa')]=_0x5a87d5[_0xd624('0x23')][_0xd624('0x24')]();utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x29'),_0x5a87d5[_0xd624('0x5')],queues[_0x5a87d5['uniqueid']][_0xd624('0x1e')],_0x5a87d5[_0xd624('0x23')],queues[_0x5a87d5[_0xd624('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x5a87d5[_0xd624('0x5')]]);}}else if(!_[_0xd624('0x18')](_0x5a87d5[_0xd624('0x2a')][_0xd624('0x2b')])){if(!_[_0xd624('0x18')](queues[_0x5a87d5[_0xd624('0x5')]])&&!queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x26')]){queues[_0x5a87d5['uniqueid']]['queuecallerabandon']=![];queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x27')]=null;queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x1a')]=!![];queues[_0x5a87d5['uniqueid']][_0xd624('0x28')]=utils[_0xd624('0x1d')]();queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0xa')]=_0xd624('0x2c');utils[_0xd624('0x2')](util['format'](_0xd624('0x2d'),_0x5a87d5[_0xd624('0x5')],queues[_0x5a87d5['uniqueid']][_0xd624('0x1e')],_0x5a87d5[_0xd624('0x23')],queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0xa')]));}}}catch(_0x167bbb){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x21'),_0x5a87d5[_0xd624('0x5')]),_0x167bbb);}};exports[_0xd624('0x26')]=function(_0x21e264){try{if(!_[_0xd624('0x18')](queues[_0x21e264[_0xd624('0x5')]])){utils[_0xd624('0x11')](util['format'](_0xd624('0x2e'),_0x21e264['uniqueid']),_0x21e264);queues[_0x21e264['uniqueid']][_0xd624('0x1a')]=![];queues[_0x21e264['uniqueid']][_0xd624('0x28')]=null;queues[_0x21e264[_0xd624('0x5')]][_0xd624('0x26')]=!![];queues[_0x21e264['uniqueid']][_0xd624('0x27')]=utils['now']();queues[_0x21e264[_0xd624('0x5')]][_0xd624('0xa')]=_0xd624('0x2f');utils[_0xd624('0x2')](util[_0xd624('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x21e264['uniqueid'],queues[_0x21e264['uniqueid']][_0xd624('0x1e')],queues[_0x21e264[_0xd624('0x5')]][_0xd624('0xa')]));}}catch(_0x3eee8d){utils[_0xd624('0x16')](util['format'](_0xd624('0x2e'),_0x21e264[_0xd624('0x5')]),_0x3eee8d);}};exports['queuecallerleave']=function(_0x5bbff5){try{if(!_[_0xd624('0x18')](queues[_0x5bbff5[_0xd624('0x5')]])){utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x30'),_0x5bbff5[_0xd624('0x5')]),_0x5bbff5);utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x31'),_0x5bbff5[_0xd624('0x5')],queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x1e')],_0x5bbff5[_0xd624('0x32')],_0x5bbff5['connectedlinename']));queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x33')]=!![];queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x19')]=utils[_0xd624('0x1d')]();queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x34')]=utils['diffTime'](queues[_0x5bbff5[_0xd624('0x5')]]['queuecallerleaveAt'],queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x35')]);queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x14')]=_0x5bbff5[_0xd624('0x14')];queues[_0x5bbff5['uniqueid']][_0xd624('0x36')]=_0x5bbff5[_0xd624('0x36')];queues[_0x5bbff5[_0xd624('0x5')]]['connectedlinenum']=_0x5bbff5[_0xd624('0x32')];queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x37')]=_0x5bbff5[_0xd624('0x37')];}}catch(_0x28eecf){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x30'),_0x5bbff5[_0xd624('0x5')]),_0x28eecf);}};exports['agentconnect']=function(_0x31bd66){try{if(!_[_0xd624('0x18')](queues[_0x31bd66[_0xd624('0x5')]])){utils[_0xd624('0x11')](util['format']('[%s][queues][agentconnect]',_0x31bd66['uniqueid']),_0x31bd66);utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x38'),_0x31bd66[_0xd624('0x5')],queues[_0x31bd66[_0xd624('0x5')]][_0xd624('0x1e')],_0x31bd66[_0xd624('0x39')],_0x31bd66['destaccountcode']));queues[_0x31bd66['uniqueid']][_0xd624('0x26')]=![];queues[_0x31bd66[_0xd624('0x5')]][_0xd624('0x26')]=![];queues[_0x31bd66[_0xd624('0x5')]]['queuecallerabandonAt']=null;queues[_0x31bd66[_0xd624('0x5')]]['queuecallerexit']=![];queues[_0x31bd66['uniqueid']][_0xd624('0xa')]=null;queues[_0x31bd66[_0xd624('0x5')]][_0xd624('0x28')]=null;queues[_0x31bd66[_0xd624('0x5')]][_0xd624('0x3a')]=!![];queues[_0x31bd66[_0xd624('0x5')]][_0xd624('0x9')]=_0x31bd66[_0xd624('0x3b')];queues[_0x31bd66[_0xd624('0x5')]]['lastAssignedTo']=_0x31bd66[_0xd624('0x39')];}}catch(_0x2094b6){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x3c'),_0x31bd66['uniqueid']),_0x2094b6);}};exports[_0xd624('0x3d')]=function(_0x2ea095){try{if(!_[_0xd624('0x18')](queues[_0x2ea095[_0xd624('0x5')]])){if(queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x19')]){utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x3e'),_0x2ea095[_0xd624('0x5')]),_0x2ea095);queues[_0x2ea095[_0xd624('0x5')]]['queuecallerabandon']=![];queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x26')]=![];queues[_0x2ea095['uniqueid']][_0xd624('0x27')]=null;queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x1a')]=![];queues[_0x2ea095['uniqueid']][_0xd624('0x28')]=null;queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x3a')]=!![];queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x7')]=_0x2ea095[_0xd624('0x39')];queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x1b')]=!![];queues[_0x2ea095[_0xd624('0x5')]]['queuecallercompleteAt']=utils[_0xd624('0x1d')]();if(_0x2ea095['reason']==_0xd624('0x3f')){if(!queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x3f')]){queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0xa')]='TRANSFER';}}else{queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0xa')]=_0xd624('0x40')+_0x2ea095[_0xd624('0x41')][_0xd624('0x24')]();}utils[_0xd624('0x2')](util[_0xd624('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x2ea095['uniqueid'],queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x1e')],_0x2ea095[_0xd624('0x39')],queues[_0x2ea095[_0xd624('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x2ea095[_0xd624('0x5')]]);}}}catch(_0x1fb9b8){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x3e'),_0x2ea095[_0xd624('0x5')]),_0x1fb9b8);}};exports[_0xd624('0x42')]=function(_0x34d01f){try{if(!_[_0xd624('0x18')](queues[_0x34d01f[_0xd624('0x43')]])){utils[_0xd624('0x11')](util['format'](_0xd624('0x44'),_0x34d01f[_0xd624('0x5')]),_0x34d01f);queues[_0x34d01f['transfereeuniqueid']][_0xd624('0x3f')]=!![];queues[_0x34d01f[_0xd624('0x43')]][_0xd624('0x45')]=_0xd624('0x46');queues[_0x34d01f[_0xd624('0x43')]][_0xd624('0x47')]=_0x34d01f['extension'];queues[_0x34d01f[_0xd624('0x43')]][_0xd624('0x48')]=_0x34d01f['transfereeuniqueid'];queues[_0x34d01f[_0xd624('0x43')]][_0xd624('0xa')]=_0xd624('0x49');utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x4a'),_0x34d01f['uniqueid'],queues[_0x34d01f[_0xd624('0x43')]]['name'],_0x34d01f[_0xd624('0x43')],_0x34d01f[_0xd624('0x4b')]));}}catch(_0x2b176d){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x44'),_0x34d01f['uniqueid']),_0x2b176d);}};exports[_0xd624('0x4c')]=function(_0x10060e){try{utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x4d'),_0x10060e[_0xd624('0x4e')]),_0x10060e);if(_0x10060e[_0xd624('0x4e')]==_0x10060e[_0xd624('0x4f')]){if(!_[_0xd624('0x18')](queues[_0x10060e[_0xd624('0x50')]])){utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x51'),_0x10060e[_0xd624('0x4e')],queues[_0x10060e[_0xd624('0x50')]][_0xd624('0x1e')],_0x10060e[_0xd624('0x52')]));queues[_0x10060e[_0xd624('0x50')]]['transfer']=!![];queues[_0x10060e[_0xd624('0x50')]]['transfertype']=_0xd624('0x53');queues[_0x10060e[_0xd624('0x50')]][_0xd624('0x47')]=_0x10060e['origtransfererexten'];queues[_0x10060e[_0xd624('0x50')]][_0xd624('0x48')]=_0x10060e[_0xd624('0x4e')];queues[_0x10060e['secondtransfererlinkedid']][_0xd624('0xa')]=_0xd624('0x54');}if(!_[_0xd624('0x18')](queues[_0x10060e[_0xd624('0x4f')]])){if(_0x10060e[_0xd624('0x55')]&&queues[_0x10060e[_0xd624('0x55')]]){queues[_0x10060e[_0xd624('0x55')]]['queuecallerenterreason']=0x1;queues[_0x10060e[_0xd624('0x43')]]=_[_0xd624('0x56')](queues[_0x10060e[_0xd624('0x55')]]);queues[_0x10060e[_0xd624('0x43')]][_0xd624('0xf')]=_0x10060e[_0xd624('0x57')];queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x1f')]=0x2;queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x8')]=queues[_0x10060e[_0xd624('0x50')]][_0xd624('0x8')];queues[_0x10060e['transfereeuniqueid']][_0xd624('0x58')]=queues[_0x10060e[_0xd624('0x50')]][_0xd624('0x58')];queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x35')]=utils[_0xd624('0x1d')]();queues[_0x10060e[_0xd624('0x43')]]['queuecallerleaveAt']=utils[_0xd624('0x1d')]();queues[_0x10060e['transfereeuniqueid']][_0xd624('0x34')]=0x0;queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x59')]=0x0;utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x5a'),_0x10060e[_0xd624('0x4e')],queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x1e')],queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x8')],queues[_0x10060e[_0xd624('0x43')]]['calleridname']));}else{utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x5b'),_0x10060e[_0xd624('0x4e')],queues[_0x10060e['origtransfererlinkedid']][_0xd624('0x1e')],_0x10060e[_0xd624('0x50')]));queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0xf')]=_0x10060e[_0xd624('0x50')];}}}else if(_0x10060e[_0xd624('0x5c')]==_0x10060e['secondtransfererlinkedid']){if(!_[_0xd624('0x18')](queues[_0x10060e[_0xd624('0x4f')]])){utils[_0xd624('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x10060e[_0xd624('0x4e')],queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x1e')],_0x10060e[_0xd624('0x5c')],_0x10060e['secondtransfererexten']));queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x3f')]=!![];queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x45')]='ATTENDED';queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x47')]=_0x10060e[_0xd624('0x5d')];queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x48')]=_0x10060e[_0xd624('0x5c')];queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0xa')]=_0xd624('0x54');}if(!_[_0xd624('0x18')](queues[_0x10060e[_0xd624('0x50')]])){if(_0x10060e[_0xd624('0x5e')]&&queues[_0x10060e[_0xd624('0x5e')]]){queues[_0x10060e[_0xd624('0x5e')]][_0xd624('0x1f')]=0x1;queues[_0x10060e['transfertargetuniqueid']]=_[_0xd624('0x56')](queues[_0x10060e[_0xd624('0x5e')]]);queues[_0x10060e['transfertargetuniqueid']][_0xd624('0xf')]=_0x10060e[_0xd624('0x57')];queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x1f')]=0x2;queues[_0x10060e['transfertargetuniqueid']][_0xd624('0x8')]=queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x8')];queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x58')]=queues[_0x10060e['origtransfererlinkedid']]['calleridname'];queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x35')]=utils[_0xd624('0x1d')]();queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x19')]=utils[_0xd624('0x1d')]();queues[_0x10060e[_0xd624('0x57')]]['holdtime']=0x0;queues[_0x10060e['transfertargetuniqueid']]['mohtime']=0x0;utils['info'](util['format'](_0xd624('0x5f'),_0x10060e['origtransfereruniqueid'],queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x1e')],queues[_0x10060e[_0xd624('0x57')]][_0xd624('0xf')],queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x8')],queues[_0x10060e['transfertargetuniqueid']][_0xd624('0x58')]));}else{utils[_0xd624('0x2')](util[_0xd624('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x10060e[_0xd624('0x4e')],queues[_0x10060e['secondtransfererlinkedid']]['name'],_0x10060e[_0xd624('0x4f')]));queues[_0x10060e[_0xd624('0x50')]][_0xd624('0xf')]=_0x10060e[_0xd624('0x4f')];}}}}catch(_0x2f8b91){utils['error'](util[_0xd624('0x3')]('[%s][queues][attendedtransfer]',_0x10060e[_0xd624('0x4e')]),_0x2f8b91);}};exports[_0xd624('0x60')]=function(_0x2122ec){try{if(!_[_0xd624('0x18')](queues[_0x2122ec[_0xd624('0x5')]])){utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x61'),_0x2122ec[_0xd624('0x5')]),_0x2122ec);queues[_0x2122ec['uniqueid']][_0xd624('0x62')]=utils[_0xd624('0x1d')]();utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x63'),_0x2122ec[_0xd624('0x5')],queues[_0x2122ec[_0xd624('0x5')]][_0xd624('0x1e')],queues[_0x2122ec[_0xd624('0x5')]][_0xd624('0x62')]));}}catch(_0x51085e){utils['error'](util[_0xd624('0x3')](_0xd624('0x61'),_0x2122ec[_0xd624('0x5')]),_0x51085e);}};exports[_0xd624('0x64')]=function(_0x241f40){try{if(!_[_0xd624('0x18')](queues[_0x241f40[_0xd624('0x5')]])){if(!_[_0xd624('0x18')](queues[_0x241f40[_0xd624('0x5')]][_0xd624('0x62')])){utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x65'),_0x241f40[_0xd624('0x5')]),_0x241f40);queues[_0x241f40[_0xd624('0x5')]]['mohtime']+=utils[_0xd624('0x66')](utils[_0xd624('0x1d')](),queues[_0x241f40['uniqueid']][_0xd624('0x62')]);utils['info'](util['format'](_0xd624('0x67'),_0x241f40[_0xd624('0x5')],queues[_0x241f40[_0xd624('0x5')]][_0xd624('0x1e')],queues[_0x241f40[_0xd624('0x5')]][_0xd624('0x59')]));delete queues[_0x241f40[_0xd624('0x5')]]['musiconholdstartAt'];}}}catch(_0x372993){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x65'),_0x241f40[_0xd624('0x5')]),_0x372993);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 0fe6227..ef01ee6 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb393=['split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','linkedid','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb393,0x9a));var _0x3b39=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb393[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3b39('0x0'));var util=require(_0x3b39('0x1'));var utils=require(_0x3b39('0x2'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x37243a){var _0xf7d7c8;utils['info'](util[_0x3b39('0x3')](_0x3b39('0x4'),_0x37243a[_0x3b39('0x5')]));if(transfers[_0x3b39('0x6')][_0x37243a[_0x3b39('0x5')]]){_0xf7d7c8=_0x37243a[_0x3b39('0x5')];_0x37243a['uniqueid']=transfers[_0x3b39('0x6')][_0x37243a[_0x3b39('0x5')]][_0x3b39('0x7')];}if(_0x37243a[_0x3b39('0x8')]){utils[_0x3b39('0x9')](_0x37243a['accountcode'])[_0x3b39('0xa')](function(_0x58d368){if(_0x58d368){_0x37243a[_0x3b39('0xb')]=_0x58d368[_0x3b39('0xc')];_0x37243a[_0x3b39('0xd')]=_0x58d368['id'];}utils[_0x3b39('0xe')](_0x3b39('0xf'),_0x37243a);});}else{utils[_0x3b39('0xe')]('CreateVoiceRecording',_0x37243a);}if(_0xf7d7c8)delete transfers[_0x3b39('0x6')][_0xf7d7c8];}exports[_0x3b39('0x10')]=function(_0x4b6e7e){try{utils[_0x3b39('0x11')](util[_0x3b39('0x3')]('[%s][recordings][newchannel]',_0x4b6e7e[_0x3b39('0x5')]),_0x4b6e7e);if(_0x4b6e7e[_0x3b39('0x5')]==_0x4b6e7e['linkedid']){utils[_0x3b39('0x12')](util[_0x3b39('0x3')](_0x3b39('0x13'),_0x4b6e7e[_0x3b39('0x5')],_0x4b6e7e[_0x3b39('0x14')],_0x4b6e7e[_0x3b39('0x15')]));recordings[_0x4b6e7e[_0x3b39('0x5')]]={'uniqueid':_0x4b6e7e['uniqueid'],'accountcode':_0x4b6e7e[_0x3b39('0x8')],'exten':_0x4b6e7e['exten'],'context':_0x4b6e7e[_0x3b39('0x14')],'channel':_0x4b6e7e[_0x3b39('0x16')],'monitors':[]};}}catch(_0x2ecc03){utils[_0x3b39('0x17')](util[_0x3b39('0x3')](_0x3b39('0x18'),_0x4b6e7e[_0x3b39('0x5')]),_0x2ecc03);}};exports[_0x3b39('0x19')]=function(_0x45b466){try{utils[_0x3b39('0x11')](util[_0x3b39('0x3')](_0x3b39('0x1a'),_0x45b466['uniqueid']),_0x45b466);if(!_[_0x3b39('0x1b')](recordings[_0x45b466[_0x3b39('0x5')]])&&_0x45b466['channelstate']==0x6){utils['info'](util[_0x3b39('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x45b466[_0x3b39('0x5')],_0x45b466['context'],_0x45b466[_0x3b39('0x16')]));}else if(!_[_0x3b39('0x1b')](recordings[_0x45b466[_0x3b39('0x1c')]])&&_0x45b466[_0x3b39('0x1d')]==0x6&&_0x45b466[_0x3b39('0x14')]!=_0x3b39('0x1e')){utils[_0x3b39('0x12')](util[_0x3b39('0x3')](_0x3b39('0x1f'),_0x45b466['uniqueid'],_0x45b466[_0x3b39('0x1c')],_0x45b466[_0x3b39('0x14')],_0x45b466[_0x3b39('0x16')]));recordings[_0x45b466[_0x3b39('0x1c')]][_0x3b39('0x8')]=_0x45b466[_0x3b39('0x8')];}}catch(_0x4d942d){utils['error'](util[_0x3b39('0x3')](_0x3b39('0x1a'),_0x45b466['uniqueid']),_0x4d942d);}};exports[_0x3b39('0x20')]=function(_0x20819b){try{if(!_['isNil'](_0x20819b[_0x3b39('0x21')])&&!_['isNil'](_0x20819b['variable'][_0x3b39('0x22')])){utils['debug'](util[_0x3b39('0x3')](_0x3b39('0x23'),_0x20819b[_0x3b39('0x5')]),_0x20819b);utils['info'](util[_0x3b39('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x20819b[_0x3b39('0x5')],_0x20819b[_0x3b39('0x21')],_0x20819b[_0x3b39('0x24')]));if(_['endsWith'](_0x20819b[_0x3b39('0x24')],_0x3b39('0x25'))){_0x20819b[_0x3b39('0x24')]=_0x20819b['value'][_0x3b39('0x26')](_0x3b39('0x25'),_0x3b39('0x27'));}if(recordings[_0x20819b[_0x3b39('0x1c')]]){var _0x390774=_[_0x3b39('0x28')](recordings[_0x20819b[_0x3b39('0x1c')]][_0x3b39('0x29')],{'value':_0x20819b[_0x3b39('0x24')]});if(_[_0x3b39('0x1b')](_0x390774)){recordings[_0x20819b[_0x3b39('0x1c')]][_0x3b39('0x29')]['push']({'value':_0x20819b[_0x3b39('0x24')]});}}}}catch(_0x1a23bf){utils['error'](util['format'](_0x3b39('0x23'),_0x20819b[_0x3b39('0x5')]),_0x1a23bf);}};exports[_0x3b39('0x2a')]=function(_0x28f61e){try{if(!_[_0x3b39('0x1b')](recordings[_0x28f61e[_0x3b39('0x5')]])){utils[_0x3b39('0x11')](util[_0x3b39('0x3')](_0x3b39('0x2b'),_0x28f61e[_0x3b39('0x5')]),_0x28f61e);utils[_0x3b39('0x12')](util[_0x3b39('0x3')](_0x3b39('0x2c'),_0x28f61e['uniqueid'],_0x28f61e[_0x3b39('0x2d')],_0x28f61e[_0x3b39('0x2e')],_0x28f61e[_0x3b39('0x2f')]));recordings[_0x28f61e[_0x3b39('0x5')]][_0x3b39('0x2d')]=_0x28f61e[_0x3b39('0x2d')];recordings[_0x28f61e[_0x3b39('0x5')]][_0x3b39('0x2e')]=_0x28f61e[_0x3b39('0x2e')];recordings[_0x28f61e[_0x3b39('0x5')]][_0x3b39('0x30')]=_0x28f61e[_0x3b39('0x30')];recordings[_0x28f61e[_0x3b39('0x5')]][_0x3b39('0x31')]=_0x28f61e['connectedlinename'];if(recordings[_0x28f61e[_0x3b39('0x5')]]['type']=='outbound'&&recordings[_0x28f61e['uniqueid']][_0x3b39('0x8')]){recordings[_0x28f61e[_0x3b39('0x5')]][_0x3b39('0x30')]=recordings[_0x28f61e['uniqueid']]['accountcode'];recordings[_0x28f61e[_0x3b39('0x5')]]['connectedlinename']='';}recordings[_0x28f61e[_0x3b39('0x5')]][_0x3b39('0x29')]['forEach'](function(_0x1d232d){var _0x6c9383=_['clone'](recordings[_0x28f61e[_0x3b39('0x5')]]);_0x6c9383[_0x3b39('0x24')]=_0x1d232d[_0x3b39('0x24')];writeDB(_0x6c9383);});delete recordings[_0x28f61e[_0x3b39('0x5')]];}}catch(_0xc08a29){utils[_0x3b39('0x17')](util[_0x3b39('0x3')](_0x3b39('0x2b'),_0x28f61e['uniqueid']),_0xc08a29);}};exports[_0x3b39('0x32')]=function(_0x305e9a){try{if(!_[_0x3b39('0x1b')](recordings[_0x305e9a[_0x3b39('0x5')]])){utils['debug'](util['format'](_0x3b39('0x33'),_0x305e9a[_0x3b39('0x5')]),_0x305e9a);utils[_0x3b39('0x12')](util[_0x3b39('0x3')](_0x3b39('0x34'),_0x305e9a[_0x3b39('0x5')],_0x305e9a[_0x3b39('0x35')],_0x305e9a[_0x3b39('0x36')]));if(_0x305e9a['application'][_0x3b39('0x37')]()==_0x3b39('0x38')&&_[_0x3b39('0x39')](_0x305e9a[_0x3b39('0x36')][_0x3b39('0x37')](),_0x3b39('0x3a'))){var _0x2d3db3=_0x305e9a[_0x3b39('0x36')][_0x3b39('0x3b')]('=');var _0x20430f=_0x2d3db3[0x0][_0x3b39('0x3c')](_0x2d3db3[0x0][_0x3b39('0x3d')]('(')+0x1,_0x2d3db3[0x0]['lastIndexOf'](')'));var _0x4b5022=_0x2d3db3[0x1];recordings[_0x305e9a[_0x3b39('0x5')]][_0x20430f]=_0x4b5022;}}}catch(_0x24d756){utils['error'](util[_0x3b39('0x3')]('[%s][recordings][newexten]',_0x305e9a[_0x3b39('0x5')]),_0x24d756);}};exports[_0x3b39('0x3e')]=function(_0x3a7450){try{if(!_[_0x3b39('0x1b')](recordings[_0x3a7450[_0x3b39('0x5')]])){utils['debug'](util[_0x3b39('0x3')](_0x3b39('0x3f'),_0x3a7450['uniqueid']),_0x3a7450);utils[_0x3b39('0x12')](util[_0x3b39('0x3')](_0x3b39('0x40'),_0x3a7450[_0x3b39('0x5')],_0x3a7450[_0x3b39('0x41')]));recordings[_0x3a7450[_0x3b39('0x5')]][_0x3b39('0x41')]=_0x3a7450[_0x3b39('0x41')];}}catch(_0xcdcd7a){utils[_0x3b39('0x17')](util[_0x3b39('0x3')]('[%s][recordings][queuecallerjoin]',_0x3a7450[_0x3b39('0x5')]),_0xcdcd7a);}};exports[_0x3b39('0x42')]=function(_0x27d08a){try{utils['debug'](util['format'](_0x3b39('0x43'),_0x27d08a[_0x3b39('0x5')]),_0x27d08a);utils[_0x3b39('0x12')](util[_0x3b39('0x3')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x27d08a[_0x3b39('0x5')],_0x27d08a['transferercalleridnum'],_0x27d08a['transferercalleridname'],_0x27d08a[_0x3b39('0x44')],_0x27d08a[_0x3b39('0x45')]));if(recordings[_0x27d08a['transfereruniqueid']]&&transfers[_0x3b39('0x6')][_0x27d08a[_0x3b39('0x46')]]){transfers[_0x3b39('0x6')][_0x27d08a[_0x3b39('0x46')]]['recording']=!![];}}catch(_0x166305){utils['error'](util['format'](_0x3b39('0x43'),_0x27d08a[_0x3b39('0x5')]),_0x166305);}}; \ No newline at end of file +var _0xd01b=['channel','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','context','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.wav49','find','monitors','error','[%s][recordings][varset]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','getUserByInternal','accountcode','then','membername','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','exten'];(function(_0x450559,_0x2d336b){var _0xdf7c0c=function(_0x1a2d29){while(--_0x1a2d29){_0x450559['push'](_0x450559['shift']());}};_0xdf7c0c(++_0x2d336b);}(_0xd01b,0x1de));var _0xbd01=function(_0x425213,_0x4ea76b){_0x425213=_0x425213-0x0;var _0x4d3448=_0xd01b[_0x425213];return _0x4d3448;};'use strict';var _=require('lodash');var util=require(_0xbd01('0x0'));var utils=require(_0xbd01('0x1'));var transfers=require(_0xbd01('0x2'));var recordings={};function writeDB(_0x4e29b3){var _0x2b358f;utils[_0xbd01('0x3')](util[_0xbd01('0x4')](_0xbd01('0x5'),_0x4e29b3[_0xbd01('0x6')]));if(transfers[_0xbd01('0x7')][_0x4e29b3[_0xbd01('0x6')]]){_0x2b358f=_0x4e29b3[_0xbd01('0x6')];_0x4e29b3[_0xbd01('0x6')]=transfers[_0xbd01('0x7')][_0x4e29b3[_0xbd01('0x6')]]['transfereeuniqueid'];}if(_0x4e29b3['accountcode']){utils[_0xbd01('0x8')](_0x4e29b3[_0xbd01('0x9')])[_0xbd01('0xa')](function(_0x32caee){if(_0x32caee){_0x4e29b3[_0xbd01('0xb')]=_0x32caee['name'];_0x4e29b3[_0xbd01('0xc')]=_0x32caee['id'];}utils[_0xbd01('0xd')](_0xbd01('0xe'),_0x4e29b3);});}else{utils[_0xbd01('0xd')](_0xbd01('0xe'),_0x4e29b3);}if(_0x2b358f)delete transfers[_0xbd01('0x7')][_0x2b358f];}exports[_0xbd01('0xf')]=function(_0x3e8b0f){try{utils['debug'](util['format'](_0xbd01('0x10'),_0x3e8b0f[_0xbd01('0x6')]),_0x3e8b0f);if(_0x3e8b0f[_0xbd01('0x6')]==_0x3e8b0f[_0xbd01('0x11')]){utils[_0xbd01('0x3')](util[_0xbd01('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x3e8b0f['uniqueid'],_0x3e8b0f['context'],_0x3e8b0f[_0xbd01('0x12')]));recordings[_0x3e8b0f['uniqueid']]={'uniqueid':_0x3e8b0f[_0xbd01('0x6')],'accountcode':_0x3e8b0f[_0xbd01('0x9')],'exten':_0x3e8b0f['exten'],'context':_0x3e8b0f['context'],'channel':_0x3e8b0f[_0xbd01('0x13')],'monitors':[]};}}catch(_0x545ac8){utils['error'](util[_0xbd01('0x4')](_0xbd01('0x10'),_0x3e8b0f[_0xbd01('0x6')]),_0x545ac8);}};exports[_0xbd01('0x14')]=function(_0x440c4b){try{utils['debug'](util['format'](_0xbd01('0x15'),_0x440c4b['uniqueid']),_0x440c4b);if(!_[_0xbd01('0x16')](recordings[_0x440c4b[_0xbd01('0x6')]])&&_0x440c4b['channelstate']==0x6){utils[_0xbd01('0x3')](util[_0xbd01('0x4')](_0xbd01('0x17'),_0x440c4b[_0xbd01('0x6')],_0x440c4b['context'],_0x440c4b['channel']));}else if(!_[_0xbd01('0x16')](recordings[_0x440c4b[_0xbd01('0x11')]])&&_0x440c4b[_0xbd01('0x18')]==0x6&&_0x440c4b[_0xbd01('0x19')]!=_0xbd01('0x1a')){utils[_0xbd01('0x3')](util[_0xbd01('0x4')](_0xbd01('0x1b'),_0x440c4b[_0xbd01('0x6')],_0x440c4b[_0xbd01('0x11')],_0x440c4b[_0xbd01('0x19')],_0x440c4b[_0xbd01('0x13')]));recordings[_0x440c4b[_0xbd01('0x11')]][_0xbd01('0x9')]=_0x440c4b['accountcode'];}}catch(_0x237ec2){utils['error'](util[_0xbd01('0x4')]('[%s][recordings][newstate]',_0x440c4b['uniqueid']),_0x237ec2);}};exports[_0xbd01('0x1c')]=function(_0x146866){try{if(!_[_0xbd01('0x16')](_0x146866['variable'])&&!_['isNil'](_0x146866[_0xbd01('0x1d')][_0xbd01('0x1e')])){utils[_0xbd01('0x1f')](util[_0xbd01('0x4')]('[%s][recordings][varset]',_0x146866[_0xbd01('0x6')]),_0x146866);utils['info'](util[_0xbd01('0x4')](_0xbd01('0x20'),_0x146866[_0xbd01('0x6')],_0x146866[_0xbd01('0x1d')],_0x146866['value']));if(_[_0xbd01('0x21')](_0x146866[_0xbd01('0x22')],'.wav49')){_0x146866[_0xbd01('0x22')]=_0x146866[_0xbd01('0x22')][_0xbd01('0x23')](_0xbd01('0x24'),'.WAV');}if(recordings[_0x146866['linkedid']]){var _0x5611da=_[_0xbd01('0x25')](recordings[_0x146866[_0xbd01('0x11')]]['monitors'],{'value':_0x146866['value']});if(_[_0xbd01('0x16')](_0x5611da)){recordings[_0x146866['linkedid']][_0xbd01('0x26')]['push']({'value':_0x146866[_0xbd01('0x22')]});}}}}catch(_0xbc5b36){utils[_0xbd01('0x27')](util[_0xbd01('0x4')](_0xbd01('0x28'),_0x146866[_0xbd01('0x6')]),_0xbc5b36);}};exports['hangup']=function(_0x33d6af){try{if(!_['isNil'](recordings[_0x33d6af[_0xbd01('0x6')]])){utils['debug'](util[_0xbd01('0x4')]('[%s][recordings][hangup]',_0x33d6af[_0xbd01('0x6')]),_0x33d6af);utils['info'](util[_0xbd01('0x4')](_0xbd01('0x29'),_0x33d6af['uniqueid'],_0x33d6af['calleridnum'],_0x33d6af[_0xbd01('0x2a')],_0x33d6af[_0xbd01('0x2b')]));recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x2c')]=_0x33d6af['calleridnum'];recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x2a')]=_0x33d6af[_0xbd01('0x2a')];recordings[_0x33d6af[_0xbd01('0x6')]]['connectedlinenum']=_0x33d6af[_0xbd01('0x2d')];recordings[_0x33d6af[_0xbd01('0x6')]]['connectedlinename']=_0x33d6af[_0xbd01('0x2e')];if(recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x2f')]==_0xbd01('0x30')&&recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x9')]){recordings[_0x33d6af[_0xbd01('0x6')]]['connectedlinenum']=recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x9')];recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x2e')]='';}recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x26')][_0xbd01('0x31')](function(_0x41034c){var _0x5834a2=_['clone'](recordings[_0x33d6af[_0xbd01('0x6')]]);_0x5834a2['value']=_0x41034c[_0xbd01('0x22')];writeDB(_0x5834a2);});delete recordings[_0x33d6af['uniqueid']];}}catch(_0x30ad71){utils[_0xbd01('0x27')](util[_0xbd01('0x4')](_0xbd01('0x32'),_0x33d6af[_0xbd01('0x6')]),_0x30ad71);}};exports['newexten']=function(_0x4656ab){try{if(!_[_0xbd01('0x16')](recordings[_0x4656ab['uniqueid']])){utils['debug'](util['format'](_0xbd01('0x33'),_0x4656ab['uniqueid']),_0x4656ab);utils[_0xbd01('0x3')](util[_0xbd01('0x4')](_0xbd01('0x34'),_0x4656ab[_0xbd01('0x6')],_0x4656ab[_0xbd01('0x35')],_0x4656ab[_0xbd01('0x36')]));if(_0x4656ab['application'][_0xbd01('0x37')]()==_0xbd01('0x38')&&_['startsWith'](_0x4656ab[_0xbd01('0x36')]['toLowerCase'](),_0xbd01('0x39'))){var _0x254eac=_0x4656ab[_0xbd01('0x36')]['split']('=');var _0xe019a7=_0x254eac[0x0][_0xbd01('0x3a')](_0x254eac[0x0][_0xbd01('0x3b')]('(')+0x1,_0x254eac[0x0][_0xbd01('0x3b')](')'));var _0x7bea4b=_0x254eac[0x1];recordings[_0x4656ab[_0xbd01('0x6')]][_0xe019a7]=_0x7bea4b;}}}catch(_0x1b1a6f){utils[_0xbd01('0x27')](util[_0xbd01('0x4')](_0xbd01('0x33'),_0x4656ab[_0xbd01('0x6')]),_0x1b1a6f);}};exports['queuecallerjoin']=function(_0x192b51){try{if(!_[_0xbd01('0x16')](recordings[_0x192b51[_0xbd01('0x6')]])){utils[_0xbd01('0x1f')](util[_0xbd01('0x4')](_0xbd01('0x3c'),_0x192b51[_0xbd01('0x6')]),_0x192b51);utils[_0xbd01('0x3')](util['format'](_0xbd01('0x3d'),_0x192b51[_0xbd01('0x6')],_0x192b51[_0xbd01('0x3e')]));recordings[_0x192b51[_0xbd01('0x6')]]['queue']=_0x192b51[_0xbd01('0x3e')];}}catch(_0x18135f){utils[_0xbd01('0x27')](util[_0xbd01('0x4')]('[%s][recordings][queuecallerjoin]',_0x192b51[_0xbd01('0x6')]),_0x18135f);}};exports[_0xbd01('0x3f')]=function(_0x18a191){try{utils[_0xbd01('0x1f')](util[_0xbd01('0x4')](_0xbd01('0x40'),_0x18a191[_0xbd01('0x6')]),_0x18a191);utils[_0xbd01('0x3')](util['format'](_0xbd01('0x41'),_0x18a191[_0xbd01('0x6')],_0x18a191[_0xbd01('0x42')],_0x18a191[_0xbd01('0x43')],_0x18a191[_0xbd01('0x44')],_0x18a191['transfereecalleridname']));if(recordings[_0x18a191[_0xbd01('0x45')]]&&transfers[_0xbd01('0x7')][_0x18a191['transfereruniqueid']]){transfers[_0xbd01('0x7')][_0x18a191[_0xbd01('0x45')]][_0xbd01('0x46')]=!![];}}catch(_0x26d9cb){utils[_0xbd01('0x27')](util['format'](_0xbd01('0x40'),_0x18a191['uniqueid']),_0x26d9cb);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 6416978..88ed46b 100644 --- a/server/services/xdr/transfers.controller.js +++ b/server/services/xdr/transfers.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa135=['info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetconnectedlinenum','transfertargetaccountcode','error','./utils'];(function(_0x4b85a1,_0x1d48f4){var _0x16a58f=function(_0x3f27eb){while(--_0x3f27eb){_0x4b85a1['push'](_0x4b85a1['shift']());}};_0x16a58f(++_0x1d48f4);}(_0xa135,0x109));var _0x5a13=function(_0x59f3a2,_0x2e64e7){_0x59f3a2=_0x59f3a2-0x0;var _0x6deddd=_0xa135[_0x59f3a2];return _0x6deddd;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x5a13('0x0'));function writeDB(_0x45347c){utils[_0x5a13('0x1')](util['format'](_0x5a13('0x2'),_0x45347c[_0x5a13('0x3')]===_0x5a13('0x4')?_0x45347c[_0x5a13('0x5')]:_0x45347c[_0x5a13('0x6')],_0x45347c[_0x5a13('0x3')]));utils[_0x5a13('0x7')]('CreateVoiceTransferReport',_0x45347c);}exports[_0x5a13('0x8')]={};exports[_0x5a13('0x9')]=function(_0x1b48b2){try{utils[_0x5a13('0xa')](util[_0x5a13('0xb')](_0x5a13('0xc'),_0x1b48b2[_0x5a13('0x6')]),_0x1b48b2);utils[_0x5a13('0x1')](util['format'](_0x5a13('0xd'),_0x1b48b2[_0x5a13('0x6')],_0x1b48b2[_0x5a13('0xe')],_0x1b48b2['transferercalleridname'],_0x1b48b2[_0x5a13('0xf')],_0x1b48b2[_0x5a13('0x10')]));_0x1b48b2[_0x5a13('0x3')]=_0x5a13('0x11');exports['blinds'][_0x1b48b2[_0x5a13('0x12')]]=_0x1b48b2;writeDB(_0x1b48b2);}catch(_0x4e1e83){utils['error'](util['format'](_0x5a13('0xc'),_0x1b48b2[_0x5a13('0x6')]),_0x4e1e83);}};exports[_0x5a13('0x13')]=function(_0x3c8daa){try{utils[_0x5a13('0xa')](util[_0x5a13('0xb')](_0x5a13('0x14'),_0x3c8daa[_0x5a13('0x5')]),_0x3c8daa);utils[_0x5a13('0x1')](util[_0x5a13('0xb')](_0x5a13('0x15'),_0x3c8daa[_0x5a13('0x5')],_0x3c8daa['origtransferercalleridnum'],_0x3c8daa[_0x5a13('0x16')],_0x3c8daa[_0x5a13('0x17')],_0x3c8daa['transfertargetcalleridname']));_0x3c8daa=_['assign'](_0x3c8daa,{'transfererchannel':_0x3c8daa[_0x5a13('0x18')],'transferercalleridnum':_0x3c8daa[_0x5a13('0x19')],'transferercalleridname':_0x3c8daa[_0x5a13('0x16')],'transfererconnectedlinenum':_0x3c8daa['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3c8daa[_0x5a13('0x1a')],'transfereraccountcode':_0x3c8daa['origtransfereraccountcode'],'transferercontext':_0x3c8daa[_0x5a13('0x1b')],'transfererexten':_0x3c8daa[_0x5a13('0x1c')],'transfererlinkedid':_0x3c8daa[_0x5a13('0x1d')],'context':_0x3c8daa[_0x5a13('0x1e')],'extension':_0x3c8daa[_0x5a13('0x1f')],'type':_0x5a13('0x4')});if(_[_0x5a13('0x20')](_0x3c8daa[_0x5a13('0x21')])){_0x3c8daa=_[_0x5a13('0x22')](_0x3c8daa,{'transfereechannel':_0x3c8daa['transfertargetchannel'],'transfereecalleridnum':_0x3c8daa[_0x5a13('0x17')],'transfereecalleridname':_0x3c8daa['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3c8daa[_0x5a13('0x23')],'transfereeconnectedlinename':_0x3c8daa['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3c8daa[_0x5a13('0x24')],'transfereecontext':_0x3c8daa['transfertargetcontext'],'transfereeexten':_0x3c8daa['transfertargetexten'],'transfereelinkedid':_0x3c8daa['transfertargetlinkedid']});}writeDB(_0x3c8daa);}catch(_0x25b540){utils[_0x5a13('0x25')](util[_0x5a13('0xb')](_0x5a13('0x14'),_0x3c8daa[_0x5a13('0x5')]),_0x25b540);}}; \ No newline at end of file +var _0x3699=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','blind','error','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil'];(function(_0x3fb7a1,_0x365d08){var _0x117022=function(_0x70a506){while(--_0x70a506){_0x3fb7a1['push'](_0x3fb7a1['shift']());}};_0x117022(++_0x365d08);}(_0x3699,0x157));var _0x9369=function(_0x3763df,_0x2bcb27){_0x3763df=_0x3763df-0x0;var _0x545b39=_0x3699[_0x3763df];return _0x545b39;};'use strict';var _=require(_0x9369('0x0'));var util=require('util');var utils=require(_0x9369('0x1'));function writeDB(_0xa4a89b){utils[_0x9369('0x2')](util[_0x9369('0x3')](_0x9369('0x4'),_0xa4a89b[_0x9369('0x5')]===_0x9369('0x6')?_0xa4a89b[_0x9369('0x7')]:_0xa4a89b[_0x9369('0x8')],_0xa4a89b[_0x9369('0x5')]));utils[_0x9369('0x9')](_0x9369('0xa'),_0xa4a89b);}exports[_0x9369('0xb')]={};exports['blindtransfer']=function(_0x131d2b){try{utils[_0x9369('0xc')](util[_0x9369('0x3')](_0x9369('0xd'),_0x131d2b[_0x9369('0x8')]),_0x131d2b);utils[_0x9369('0x2')](util[_0x9369('0x3')](_0x9369('0xe'),_0x131d2b[_0x9369('0x8')],_0x131d2b[_0x9369('0xf')],_0x131d2b[_0x9369('0x10')],_0x131d2b['transfereecalleridnum'],_0x131d2b['transfereecalleridname']));_0x131d2b[_0x9369('0x5')]=_0x9369('0x11');exports[_0x9369('0xb')][_0x131d2b['transfereruniqueid']]=_0x131d2b;writeDB(_0x131d2b);}catch(_0x8362a1){utils[_0x9369('0x12')](util[_0x9369('0x3')]('[%s][transfers][blindtransfer]',_0x131d2b['uniqueid']),_0x8362a1);}};exports[_0x9369('0x13')]=function(_0x505647){try{utils[_0x9369('0xc')](util[_0x9369('0x3')]('[%s][transfers][attendedtransfer]',_0x505647['origtransfereruniqueid']),_0x505647);utils[_0x9369('0x2')](util[_0x9369('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x505647[_0x9369('0x7')],_0x505647[_0x9369('0x14')],_0x505647[_0x9369('0x15')],_0x505647[_0x9369('0x16')],_0x505647[_0x9369('0x17')]));_0x505647=_[_0x9369('0x18')](_0x505647,{'transfererchannel':_0x505647[_0x9369('0x19')],'transferercalleridnum':_0x505647[_0x9369('0x14')],'transferercalleridname':_0x505647['origtransferercalleridname'],'transfererconnectedlinenum':_0x505647[_0x9369('0x1a')],'transfererconnectedlinename':_0x505647[_0x9369('0x1b')],'transfereraccountcode':_0x505647[_0x9369('0x1c')],'transferercontext':_0x505647[_0x9369('0x1d')],'transfererexten':_0x505647[_0x9369('0x1e')],'transfererlinkedid':_0x505647[_0x9369('0x1f')],'context':_0x505647[_0x9369('0x20')],'extension':_0x505647[_0x9369('0x21')],'type':_0x9369('0x6')});if(_[_0x9369('0x22')](_0x505647['transfereechannel'])){_0x505647=_[_0x9369('0x18')](_0x505647,{'transfereechannel':_0x505647['transfertargetchannel'],'transfereecalleridnum':_0x505647[_0x9369('0x16')],'transfereecalleridname':_0x505647[_0x9369('0x17')],'transfereeconnectedlinenum':_0x505647[_0x9369('0x23')],'transfereeconnectedlinename':_0x505647[_0x9369('0x24')],'transfereeaccountcode':_0x505647[_0x9369('0x25')],'transfereecontext':_0x505647[_0x9369('0x26')],'transfereeexten':_0x505647[_0x9369('0x27')],'transfereelinkedid':_0x505647[_0x9369('0x28')]});}writeDB(_0x505647);}catch(_0x3c231b){utils[_0x9369('0x12')](util[_0x9369('0x3')](_0x9369('0x29'),_0x505647[_0x9369('0x7')]),_0x3c231b);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index fdacbc1..89d1935 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57d8=['error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','info','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','[utils][getVoiceQueueByName]','addTime','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','xdr','debug','inspect'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x57d8,0x1e7));var _0x857d=function(_0xa232b6,_0x4e0e3e){_0xa232b6=_0xa232b6-0x0;var _0x9c47aa=_0x57d8[_0xa232b6];return _0x9c47aa;};'use strict';var BPromise=require(_0x857d('0x0'));var jayson=require(_0x857d('0x1'));var moment=require(_0x857d('0x2'));var util=require(_0x857d('0x3'));var client=jayson['client'][_0x857d('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x857d('0x5'));exports['info']=function(_0x228866,_0x54c6f9){logger['info'](_0x228866,_0x54c6f9?util['inspect'](_0x54c6f9,{'showHidden':![],'depth':null}):'');};exports[_0x857d('0x6')]=function(_0x30eaa5,_0x27a710){logger[_0x857d('0x6')](_0x30eaa5,_0x27a710?util[_0x857d('0x7')](_0x27a710,{'showHidden':![],'depth':null}):'');};exports[_0x857d('0x8')]=function(_0x48bee9,_0x44eb27){logger[_0x857d('0x8')](_0x48bee9,_0x44eb27?util[_0x857d('0x7')](_0x44eb27,{'showHidden':![],'depth':null}):'');};exports[_0x857d('0x9')]=function(_0x251d1a,_0x50764c){return client['request'](_0x251d1a,{'body':_0x50764c})[_0x857d('0xa')](function(_0x587aef){logger['debug'](_0x857d('0xb'),_0x251d1a,_0x587aef?util[_0x857d('0x7')](_0x587aef,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x2241ee){logger[_0x857d('0x8')](_0x857d('0xb'),_0x251d1a,_0x2241ee?util[_0x857d('0x7')](_0x2241ee,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2025ed){return client['request'](_0x857d('0xc'),{'options':{'raw':!![],'attributes':['id',_0x857d('0xd'),_0x857d('0xe'),'interface'],'where':_0x2025ed,'limit':0x1}})[_0x857d('0xa')](function(_0x49a5a0){logger[_0x857d('0x6')](_0x857d('0xf'),JSON[_0x857d('0x10')](_0x2025ed),_0x49a5a0?util[_0x857d('0x7')](_0x49a5a0,{'showHidden':![],'depth':null}):'');return _0x49a5a0[_0x857d('0x11')][_0x857d('0x12')]?_0x49a5a0[_0x857d('0x11')][0x0]:null;});}exports[_0x857d('0x13')]=function(_0x2de457){return new BPromise(function(_0x3ee607,_0x3a46b0){if(_0x2de457){return getUser({'internal':_0x2de457})[_0x857d('0xa')](function(_0x432a31){logger[_0x857d('0x14')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2de457,_0x432a31?_0x857d('0x15'):_0x857d('0x16'));return _0x3ee607(_0x432a31);})[_0x857d('0x17')](function(_0x294018){logger[_0x857d('0x8')](_0x857d('0x18'),_0x294018?util[_0x857d('0x7')](_0x294018,{'showHidden':![],'depth':null}):'');return _0x3ee607(null);});}return _0x3ee607(null);});};exports[_0x857d('0x19')]=function(_0x50be2a){return new BPromise(function(_0x3d7a0f,_0xb10b21){if(_0x50be2a){return getUser({'interface':_0x50be2a})[_0x857d('0xa')](function(_0x5803d0){logger[_0x857d('0x14')](_0x857d('0x1a'),_0x50be2a,_0x5803d0?_0x857d('0x15'):'notfound');return _0x3d7a0f(_0x5803d0);})[_0x857d('0x17')](function(_0x591d0f){logger[_0x857d('0x8')](_0x857d('0x1b'),_0x591d0f?util[_0x857d('0x7')](_0x591d0f,{'showHidden':![],'depth':null}):'');return _0x3d7a0f(null);});}return _0x3d7a0f(null);});};exports[_0x857d('0x1c')]=function(_0x5cd9e8){return new BPromise(function(_0x36ade1,_0x1394d0){if(_0x5cd9e8){return getUser({'name':_0x5cd9e8})['then'](function(_0x1f3ffd){logger[_0x857d('0x14')]('[utils][getUserByName]\x20name:%s\x20%s',_0x5cd9e8,_0x1f3ffd?_0x857d('0x15'):_0x857d('0x16'));return _0x36ade1(_0x1f3ffd);})[_0x857d('0x17')](function(_0x2df5f2){logger[_0x857d('0x8')](_0x857d('0x1d'),_0x2df5f2?util[_0x857d('0x7')](_0x2df5f2,{'showHidden':![],'depth':null}):'');return _0x36ade1(null);});}return _0x36ade1(null);});};exports[_0x857d('0x1e')]=function(_0x204dc1){return new BPromise(function(_0x4698e6,_0x111ba8){if(_0x204dc1){return client[_0x857d('0x9')](_0x857d('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x857d('0xe'),_0x857d('0x20'),'acw','acwTimeout'],'where':{'name':_0x204dc1},'limit':0x1}})[_0x857d('0xa')](function(_0x3b0ce5){logger[_0x857d('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x204dc1,_0x3b0ce5?util[_0x857d('0x7')](_0x3b0ce5,{'showHidden':![],'depth':null}):'');logger[_0x857d('0x14')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x204dc1,_0x3b0ce5?_0x857d('0x15'):'notfound');return _0x4698e6(_0x3b0ce5[_0x857d('0x11')][_0x857d('0x12')]?_0x3b0ce5[_0x857d('0x11')][0x0]:null);})[_0x857d('0x17')](function(_0x1bc1b2){logger[_0x857d('0x8')](_0x857d('0x21'),_0x1bc1b2?util[_0x857d('0x7')](_0x1bc1b2,{'showHidden':![],'depth':null}):'');return _0x4698e6(null);});}return _0x4698e6(null);});};exports[_0x857d('0x22')]=function(_0x176d2d,_0x9a865d){return moment(_0x176d2d)['add'](_0x9a865d,_0x857d('0x23'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x857d('0x24')]=function(_0x2065f3,_0x219907){return moment(_0x2065f3)[_0x857d('0x25')](_0x219907,_0x857d('0x23'))[_0x857d('0x26')](_0x857d('0x27'));};exports[_0x857d('0x28')]=function(_0x5ca98e,_0x2961a9){return moment(_0x5ca98e)[_0x857d('0x29')](moment(_0x2961a9),_0x857d('0x23'));};exports[_0x857d('0x2a')]=function(_0x5ee7a9,_0x592e0f){return parseInt(_0x5ee7a9,0xa)+parseInt(_0x592e0f,0xa);};exports['now']=function(){return moment()[_0x857d('0x26')](_0x857d('0x27'));};exports[_0x857d('0x2b')]=function(_0x7364b2,_0x8b4db6){if(_0x8b4db6){return moment(_0x7364b2)[_0x857d('0x2b')](_0x8b4db6);}return!![];};exports['isBefore']=function(_0x461c62,_0x1732e4){if(_0x1732e4){return moment(_0x461c62)[_0x857d('0x2c')](_0x1732e4);}else if(_0x461c62){return!![];}return![];}; \ No newline at end of file +var _0x016c=['name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal'];(function(_0x348e9e,_0x591b78){var _0x13a00e=function(_0x34245b){while(--_0x34245b){_0x348e9e['push'](_0x348e9e['shift']());}};_0x13a00e(++_0x591b78);}(_0x016c,0x1da));var _0xc016=function(_0x3ebe35,_0x2c960c){_0x3ebe35=_0x3ebe35-0x0;var _0x4817f5=_0x016c[_0x3ebe35];return _0x4817f5;};'use strict';var BPromise=require(_0xc016('0x0'));var jayson=require(_0xc016('0x1'));var moment=require(_0xc016('0x2'));var util=require('util');var client=jayson['client'][_0xc016('0x3')]({'port':0x2329});var logger=require(_0xc016('0x4'))(_0xc016('0x5'));exports[_0xc016('0x6')]=function(_0x2b697e,_0x9be815){logger['info'](_0x2b697e,_0x9be815?util[_0xc016('0x7')](_0x9be815,{'showHidden':![],'depth':null}):'');};exports[_0xc016('0x8')]=function(_0x385e8e,_0x212e52){logger['debug'](_0x385e8e,_0x212e52?util['inspect'](_0x212e52,{'showHidden':![],'depth':null}):'');};exports[_0xc016('0x9')]=function(_0x2463f3,_0x5bff08){logger[_0xc016('0x9')](_0x2463f3,_0x5bff08?util[_0xc016('0x7')](_0x5bff08,{'showHidden':![],'depth':null}):'');};exports[_0xc016('0xa')]=function(_0x29fa2c,_0x7484d){return client[_0xc016('0xa')](_0x29fa2c,{'body':_0x7484d})[_0xc016('0xb')](function(_0x5d74aa){logger[_0xc016('0x8')](_0xc016('0xc'),_0x29fa2c,_0x5d74aa?util['inspect'](_0x5d74aa,{'showHidden':![],'depth':null}):'');})[_0xc016('0xd')](function(_0xeff5e7){logger[_0xc016('0x9')]('[utils][request]\x20name:%s',_0x29fa2c,_0xeff5e7?util['inspect'](_0xeff5e7,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5b07ec){return client['request'](_0xc016('0xe'),{'options':{'raw':!![],'attributes':['id',_0xc016('0xf'),_0xc016('0x10'),'interface'],'where':_0x5b07ec,'limit':0x1}})[_0xc016('0xb')](function(_0x1b6e76){logger[_0xc016('0x8')](_0xc016('0x11'),JSON[_0xc016('0x12')](_0x5b07ec),_0x1b6e76?util[_0xc016('0x7')](_0x1b6e76,{'showHidden':![],'depth':null}):'');return _0x1b6e76[_0xc016('0x13')][_0xc016('0x14')]?_0x1b6e76[_0xc016('0x13')][0x0]:null;});}exports[_0xc016('0x15')]=function(_0x2601b6){return new BPromise(function(_0x31727f,_0x3bbce2){if(_0x2601b6){return getUser({'internal':_0x2601b6})[_0xc016('0xb')](function(_0x5435bd){logger[_0xc016('0x6')](_0xc016('0x16'),_0x2601b6,_0x5435bd?_0xc016('0x17'):_0xc016('0x18'));return _0x31727f(_0x5435bd);})[_0xc016('0xd')](function(_0x4e7aac){logger[_0xc016('0x9')](_0xc016('0x19'),_0x4e7aac?util[_0xc016('0x7')](_0x4e7aac,{'showHidden':![],'depth':null}):'');return _0x31727f(null);});}return _0x31727f(null);});};exports[_0xc016('0x1a')]=function(_0x1522fa){return new BPromise(function(_0x37ecd1,_0x48324b){if(_0x1522fa){return getUser({'interface':_0x1522fa})[_0xc016('0xb')](function(_0x2077fd){logger[_0xc016('0x6')](_0xc016('0x1b'),_0x1522fa,_0x2077fd?'found':_0xc016('0x18'));return _0x37ecd1(_0x2077fd);})[_0xc016('0xd')](function(_0x2468dc){logger[_0xc016('0x9')](_0xc016('0x1c'),_0x2468dc?util['inspect'](_0x2468dc,{'showHidden':![],'depth':null}):'');return _0x37ecd1(null);});}return _0x37ecd1(null);});};exports[_0xc016('0x1d')]=function(_0x5f0635){return new BPromise(function(_0x345717,_0x18a976){if(_0x5f0635){return getUser({'name':_0x5f0635})[_0xc016('0xb')](function(_0x590e84){logger[_0xc016('0x6')](_0xc016('0x1e'),_0x5f0635,_0x590e84?'found':_0xc016('0x18'));return _0x345717(_0x590e84);})[_0xc016('0xd')](function(_0x4bf43b){logger['error'](_0xc016('0x1f'),_0x4bf43b?util['inspect'](_0x4bf43b,{'showHidden':![],'depth':null}):'');return _0x345717(null);});}return _0x345717(null);});};exports[_0xc016('0x20')]=function(_0x965afb){return new BPromise(function(_0x1f2131,_0x55c529){if(_0x965afb){return client[_0xc016('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0xc016('0x21'),_0xc016('0x22'),'acwTimeout'],'where':{'name':_0x965afb},'limit':0x1}})[_0xc016('0xb')](function(_0x4aa50e){logger[_0xc016('0x8')](_0xc016('0x23'),_0x965afb,_0x4aa50e?util[_0xc016('0x7')](_0x4aa50e,{'showHidden':![],'depth':null}):'');logger[_0xc016('0x6')](_0xc016('0x24'),_0x965afb,_0x4aa50e?'found':_0xc016('0x18'));return _0x1f2131(_0x4aa50e[_0xc016('0x13')][_0xc016('0x14')]?_0x4aa50e[_0xc016('0x13')][0x0]:null);})[_0xc016('0xd')](function(_0x1678be){logger[_0xc016('0x9')](_0xc016('0x25'),_0x1678be?util[_0xc016('0x7')](_0x1678be,{'showHidden':![],'depth':null}):'');return _0x1f2131(null);});}return _0x1f2131(null);});};exports['addTime']=function(_0x585028,_0x240028){return moment(_0x585028)[_0xc016('0x26')](_0x240028,_0xc016('0x27'))[_0xc016('0x28')](_0xc016('0x29'));};exports[_0xc016('0x2a')]=function(_0x4a53b4,_0x3cb61c){return moment(_0x4a53b4)[_0xc016('0x2b')](_0x3cb61c,_0xc016('0x27'))['format'](_0xc016('0x29'));};exports[_0xc016('0x2c')]=function(_0x29f482,_0x190e69){return moment(_0x29f482)['diff'](moment(_0x190e69),_0xc016('0x27'));};exports[_0xc016('0x2d')]=function(_0x245cae,_0x336a3e){return parseInt(_0x245cae,0xa)+parseInt(_0x336a3e,0xa);};exports[_0xc016('0x2e')]=function(){return moment()[_0xc016('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xc016('0x2f')]=function(_0x988293,_0x4a02ae){if(_0x4a02ae){return moment(_0x988293)[_0xc016('0x2f')](_0x4a02ae);}return!![];};exports['isBefore']=function(_0x5736eb,_0x320081){if(_0x320081){return moment(_0x5736eb)[_0xc016('0x30')](_0x320081);}else if(_0x5736eb){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 7bb990d..df6f137 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1088=['then','catch','user','no-user','data','timestamp','error','api','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','body','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','client','name','ensureDir'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x1088,0xb1));var _0x8108=function(_0x1b650a,_0x41a453){_0x1b650a=_0x1b650a-0x0;var _0x3ac6b1=_0x1088[_0x1b650a];return _0x3ac6b1;};var fs=require(_0x8108('0x0'));var _=require(_0x8108('0x1'));var ewinston=require(_0x8108('0x2'));var path=require(_0x8108('0x3'));var util=require(_0x8108('0x4'));var fileLogger=require('./loggers')[_0x8108('0x5')];var safeTemplate=require(_0x8108('0x6'))[_0x8108('0x7')];var maskSensitiveData=require(_0x8108('0x8'))[_0x8108('0x9')];function ClientSideLogger(){function _0x2ac5bb(_0x20353b){var _0x3104c6=path[_0x8108('0xa')]('/var',_0x8108('0xb'),'xcally');var _0x4656e8=path[_0x8108('0xa')](_0x8108('0xc'),_0x20353b['role']+'-'+_0x20353b[_0x8108('0xd')]);return fs[_0x8108('0xe')](path[_0x8108('0xa')](_0x3104c6,_0x4656e8))[_0x8108('0xf')](function(){var _0x25274c=fileLogger(_0x8108('0xc'),path['join'](_0x3104c6,_0x4656e8));return _0x25274c;})[_0x8108('0x10')](function(_0xd8d246){throw _0xd8d246;});}this[_0x8108('0xb')]=function(_0x892ddf,_0x4cbd6f,_0x6c748f,_0x5c692a){return _0x2ac5bb(_0x892ddf[_0x8108('0x11')])[_0x8108('0xf')](function(_0x1614e4){var _0x3af8cd=_0x1614e4[_0x4cbd6f];return _0x3af8cd;})[_0x8108('0xf')](function(_0x3b9a5d){var _0x157aa1=_0x892ddf[_0x8108('0x11')]?_0x892ddf['user']['id']:_0x8108('0x12');var _0x1be683=_0x5c692a[_0x8108('0x13')];var _0x4c4ca1=_0x5c692a[_0x8108('0x14')];var _0x48559f=new Date(Number(_0x4c4ca1));return _0x3b9a5d(_0x157aa1,_0x48559f,_0x6c748f,_0x1be683);})[_0x8108('0x10')](function(_0x5cb8ae){fileLogger('client')[_0x8108('0x15')](_0x5cb8ae);});};}function setupLoggers(_0x59f2f1){return new Promise(function(_0x12c932){var _0x3ebf14=new ClientSideLogger();var _0x27f366=fileLogger(_0x8108('0x16'));var _0x5de4cd=fileLogger('auth');_0x59f2f1['set']('client-side-logger',_0x3ebf14);_0x59f2f1[_0x8108('0x17')](ewinston[_0x8108('0x18')]({'winstonInstance':_0x27f366,'meta':![],'statusLevels':!![],'msg':function(_0x2111b5,_0x1413da){var _0x2086fb=_0x8108('0x19');if(!_[_0x8108('0x1a')](_0x2111b5['body'])){_0x2086fb+=_0x8108('0x1b');var _0x4e12b5=_0x2111b5['body'];maskSensitiveData(_0x4e12b5);}return safeTemplate(util[_0x8108('0x1c')](_0x2086fb,_0x2111b5[_0x8108('0x1d')],_0x2111b5[_0x8108('0x1e')][_0x8108('0x1f')]?_0x2111b5[_0x8108('0x1e')][_0x8108('0x1f')]:_0x2111b5['connection'][_0x8108('0x20')]||_0x2111b5['ip'],_0x2111b5[_0x8108('0x21')],_0x1413da[_0x8108('0x22')],_0x1413da[_0x8108('0x23')],_0x2111b5['user']?_0x2111b5['user']['id']:null,_0x2111b5[_0x8108('0x11')]?_0x2111b5[_0x8108('0x11')]['name']:null,_0x2111b5[_0x8108('0x11')]?_0x2111b5['user'][_0x8108('0x24')]:null,_0x4e12b5?util[_0x8108('0x25')](_0x4e12b5,![],null):''));}}));_0x59f2f1['use'](ewinston[_0x8108('0x18')]({'winstonInstance':_0x5de4cd,'meta':![],'statusLevels':!![],'msg':function(_0x507a94,_0x4f130e){var _0xe08c32=_0x8108('0x26');if(_0x507a94['body']&&_0x507a94['body'][_0x8108('0x27')]&&_0x507a94[_0x8108('0x28')][_0x8108('0x29')]){_0xe08c32=_0x8108('0x2a');}return util[_0x8108('0x1c')](_0xe08c32,_0x507a94[_0x8108('0x1d')],_0x507a94[_0x8108('0x1e')][_0x8108('0x1f')]?_0x507a94[_0x8108('0x1e')][_0x8108('0x1f')]:_0x507a94[_0x8108('0x2b')]['remoteAddress']||_0x507a94['ip'],_0x507a94[_0x8108('0x21')],_0x4f130e[_0x8108('0x22')],_0x4f130e['responseTime'],_0x507a94[_0x8108('0x11')]?_0x507a94[_0x8108('0x11')]['id']:null,_0x507a94[_0x8108('0x11')]?_0x507a94['user'][_0x8108('0xd')]:null,_0x507a94[_0x8108('0x11')]?_0x507a94[_0x8108('0x11')]['role']:null,_0x507a94[_0x8108('0x28')]&&_0x507a94[_0x8108('0x28')]['device']?_0x507a94[_0x8108('0x28')][_0x8108('0x27')]:_0x8108('0x2c'),_0x507a94['body']&&_0x507a94[_0x8108('0x28')][_0x8108('0x29')]?_0x507a94[_0x8108('0x28')][_0x8108('0x29')]:'',_0x507a94['body']&&_0x507a94[_0x8108('0x28')][_0x8108('0x2d')]?_0x507a94[_0x8108('0x28')][_0x8108('0x2d')]:'');},'ignoreRoute':function(_0x3ac236){var _0x395cdd=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x395cdd[_0x8108('0x2e')](_0x3ac236[_0x8108('0x21')]);}}));return _0x12c932();});}exports[_0x8108('0x2f')]=setupLoggers; \ No newline at end of file +var _0x144f=['statusCode','other','agent_name','test','setupLoggers','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','name','user','then','no-user','data','catch','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format'];(function(_0xe1b2a8,_0x38f786){var _0x554804=function(_0x412030){while(--_0x412030){_0xe1b2a8['push'](_0xe1b2a8['shift']());}};_0x554804(++_0x38f786);}(_0x144f,0x1ef));var _0xf144=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x144f[_0x19950b];return _0x3c6b41;};var fs=require('fs-extra');var _=require(_0xf144('0x0'));var ewinston=require(_0xf144('0x1'));var path=require(_0xf144('0x2'));var util=require(_0xf144('0x3'));var fileLogger=require(_0xf144('0x4'))[_0xf144('0x5')];var safeTemplate=require(_0xf144('0x6'))['safeTemplate'];var maskSensitiveData=require(_0xf144('0x7'))[_0xf144('0x8')];function ClientSideLogger(){function _0x444114(_0x31e011){var _0x301594=path[_0xf144('0x9')](_0xf144('0xa'),_0xf144('0xb'),'xcally');var _0x961cf6=path['join'](_0xf144('0xc'),_0x31e011[_0xf144('0xd')]+'-'+_0x31e011[_0xf144('0xe')]);return fs['ensureDir'](path[_0xf144('0x9')](_0x301594,_0x961cf6))['then'](function(){var _0x3344b2=fileLogger(_0xf144('0xc'),path[_0xf144('0x9')](_0x301594,_0x961cf6));return _0x3344b2;})['catch'](function(_0x12729f){throw _0x12729f;});}this[_0xf144('0xb')]=function(_0x59851e,_0x4f0152,_0x1293de,_0x14811b){return _0x444114(_0x59851e[_0xf144('0xf')])[_0xf144('0x10')](function(_0x39e7f5){var _0xff76f8=_0x39e7f5[_0x4f0152];return _0xff76f8;})[_0xf144('0x10')](function(_0x50fd2b){var _0xa38c3e=_0x59851e['user']?_0x59851e[_0xf144('0xf')]['id']:_0xf144('0x11');var _0x3f5363=_0x14811b[_0xf144('0x12')];var _0x19d32e=_0x14811b['timestamp'];var _0x17e80c=new Date(Number(_0x19d32e));return _0x50fd2b(_0xa38c3e,_0x17e80c,_0x1293de,_0x3f5363);})[_0xf144('0x13')](function(_0x48a62c){fileLogger(_0xf144('0xc'))[_0xf144('0x14')](_0x48a62c);});};}function setupLoggers(_0x40a605){return new Promise(function(_0x16b1fc){var _0x1c1e82=new ClientSideLogger();var _0xae8e66=fileLogger(_0xf144('0x15'));var _0x204041=fileLogger(_0xf144('0x16'));_0x40a605[_0xf144('0x17')](_0xf144('0x18'),_0x1c1e82);_0x40a605[_0xf144('0x19')](ewinston[_0xf144('0x1a')]({'winstonInstance':_0xae8e66,'meta':![],'statusLevels':!![],'msg':function(_0x56f8d2,_0x5e8241){var _0x3dc66a=_0xf144('0x1b');if(!_[_0xf144('0x1c')](_0x56f8d2[_0xf144('0x1d')])){_0x3dc66a+=_0xf144('0x1e');var _0x5d3b87=_0x56f8d2[_0xf144('0x1d')];maskSensitiveData(_0x5d3b87);}return safeTemplate(util['format'](_0x3dc66a,_0x56f8d2[_0xf144('0x1f')],_0x56f8d2[_0xf144('0x20')]['x-forwarded-for']?_0x56f8d2[_0xf144('0x20')][_0xf144('0x21')]:_0x56f8d2[_0xf144('0x22')][_0xf144('0x23')]||_0x56f8d2['ip'],_0x56f8d2[_0xf144('0x24')],_0x5e8241['statusCode'],_0x5e8241[_0xf144('0x25')],_0x56f8d2[_0xf144('0xf')]?_0x56f8d2['user']['id']:null,_0x56f8d2[_0xf144('0xf')]?_0x56f8d2[_0xf144('0xf')]['name']:null,_0x56f8d2[_0xf144('0xf')]?_0x56f8d2[_0xf144('0xf')]['role']:null,_0x5d3b87?util[_0xf144('0x26')](_0x5d3b87,![],null):''));}}));_0x40a605['use'](ewinston[_0xf144('0x1a')]({'winstonInstance':_0x204041,'meta':![],'statusLevels':!![],'msg':function(_0x3a9347,_0x3e0524){var _0x516be3=_0xf144('0x27');if(_0x3a9347[_0xf144('0x1d')]&&_0x3a9347['body'][_0xf144('0x28')]&&_0x3a9347[_0xf144('0x1d')][_0xf144('0x29')]){_0x516be3=_0xf144('0x2a');}return util[_0xf144('0x2b')](_0x516be3,_0x3a9347['method'],_0x3a9347['headers'][_0xf144('0x21')]?_0x3a9347[_0xf144('0x20')][_0xf144('0x21')]:_0x3a9347[_0xf144('0x22')][_0xf144('0x23')]||_0x3a9347['ip'],_0x3a9347[_0xf144('0x24')],_0x3e0524[_0xf144('0x2c')],_0x3e0524['responseTime'],_0x3a9347[_0xf144('0xf')]?_0x3a9347['user']['id']:null,_0x3a9347[_0xf144('0xf')]?_0x3a9347['user'][_0xf144('0xe')]:null,_0x3a9347[_0xf144('0xf')]?_0x3a9347[_0xf144('0xf')][_0xf144('0xd')]:null,_0x3a9347[_0xf144('0x1d')]&&_0x3a9347[_0xf144('0x1d')][_0xf144('0x28')]?_0x3a9347[_0xf144('0x1d')][_0xf144('0x28')]:_0xf144('0x2d'),_0x3a9347[_0xf144('0x1d')]&&_0x3a9347[_0xf144('0x1d')][_0xf144('0x29')]?_0x3a9347['body']['agent_id']:'',_0x3a9347[_0xf144('0x1d')]&&_0x3a9347['body'][_0xf144('0x2e')]?_0x3a9347[_0xf144('0x1d')][_0xf144('0x2e')]:'');},'ignoreRoute':function(_0x218404){var _0x3c3c65=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3c3c65[_0xf144('0x2f')](_0x218404[_0xf144('0x24')]);}}));return _0x16b1fc();});}exports[_0xf144('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 2fe206f..3086284 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e75=['%s-%s','error','fileLogger','path','util','moment','../config/environment','debugLevel','redBG\x20white','red','bold\x20yellow','white','bold\x20white','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','{{{','meta','keys','length','level','Logger','transports','Console','warn','File'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x3e75,0x150));var _0x53e7=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0x3e75[_0x5b077b];return _0x16faf7;};'use strict';var path=require(_0x53e7('0x0'));var util=require(_0x53e7('0x1'));var moment=require(_0x53e7('0x2'));var winston=require('winston');var config=require(_0x53e7('0x3'));var debugLevel=config[_0x53e7('0x4')]?config[_0x53e7('0x4')]['toLowerCase']():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x53e7('0x5'),'error':_0x53e7('0x6'),'warn':_0x53e7('0x7'),'info':_0x53e7('0x8'),'print':_0x53e7('0x9'),'success':'bold\x20green','http':_0x53e7('0xa'),'verbose':'bold\x20magenta','debug':_0x53e7('0xb'),'silly':_0x53e7('0xc')};winston[_0x53e7('0xd')](XC_LOG_COLORS);function getLogFileName(_0x573ff0,_0x39c1f8,_0x1a662f){var _0x5b36be=_0x573ff0||_0x53e7('0xe');return path[_0x53e7('0xf')](_0x5b36be,util[_0x53e7('0x10')](_0x53e7('0x11'),_0x39c1f8,_0x1a662f));}function formatter(_0x47ed0b,_0x2749a4){_0x2749a4[_0x53e7('0x12')]=_0x2749a4[_0x53e7('0x12')][_0x53e7('0x13')](/@@{/g,'{{{')['replace'](/}@@/g,_0x53e7('0x14'))[_0x53e7('0x13')](/@{/g,'{{')[_0x53e7('0x13')](/}@/g,'}}');return util[_0x53e7('0x10')](_0x53e7('0x15'),moment()[_0x53e7('0x10')](_0x53e7('0x16')),_0x2749a4['level'][_0x53e7('0x17')](),_0x47ed0b,_0x2749a4[_0x53e7('0x12')]);}function fileFormat(_0x567033,_0x57d1a1){_0x57d1a1[_0x53e7('0x12')]=_0x57d1a1[_0x53e7('0x12')][_0x53e7('0x13')](/@@{/g,_0x53e7('0x18'))['replace'](/}@@/g,_0x53e7('0x14'))[_0x53e7('0x13')](/@{/g,'{{')[_0x53e7('0x13')](/}@/g,'}}');var _0x301cb7=_0x57d1a1[_0x53e7('0x19')]&&Object[_0x53e7('0x1a')](_0x57d1a1[_0x53e7('0x19')])[_0x53e7('0x1b')]?'\x0a\x09'+JSON['stringify'](_0x57d1a1['meta']):'';return util[_0x53e7('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x53e7('0x10')](_0x53e7('0x16')),_0x57d1a1[_0x53e7('0x1c')][_0x53e7('0x17')](),_0x567033,_0x57d1a1[_0x53e7('0x12')],_0x301cb7);}function consoleLogger(){var _0x429d1c=new winston[(_0x53e7('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x53e7('0x1e'))][(_0x53e7('0x1f'))]({'level':_0x53e7('0x20'),'json':![],'formatter':function(_0x35d070){return formatter('',_0x35d070);}})]});return _0x429d1c;}function fileLogger(_0x69cb72,_0x20f77c){var _0x5e98dc=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x53e7('0x1e'))][(_0x53e7('0x21'))]({'name':util[_0x53e7('0x10')](_0x53e7('0x22'),_0x69cb72,_0x53e7('0x23')),'filename':getLogFileName(_0x20f77c,_0x69cb72,_0x53e7('0x23')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1da551){return fileFormat(_0x69cb72,_0x1da551);}}),new winston[(_0x53e7('0x1e'))]['File']({'name':util[_0x53e7('0x10')]('%s-%s',_0x69cb72,debugLevel),'filename':getLogFileName(_0x20f77c,_0x69cb72,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x517a01){return fileFormat(_0x69cb72,_0x517a01);}}),new winston[(_0x53e7('0x1e'))][(_0x53e7('0x1f'))]({'level':_0x53e7('0x20'),'json':![],'formatter':function(_0x2d2e7c){return fileFormat(_0x69cb72,_0x2d2e7c);}})]});return _0x5e98dc;}exports['consoleLogger']=consoleLogger;exports[_0x53e7('0x24')]=fileLogger; \ No newline at end of file +var _0x17d5=['[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','format','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','{{{','meta','length','stringify'];(function(_0x4c131c,_0x1dfe72){var _0x38bfc5=function(_0x120a41){while(--_0x120a41){_0x4c131c['push'](_0x4c131c['shift']());}};_0x38bfc5(++_0x1dfe72);}(_0x17d5,0x7a));var _0x517d=function(_0x25c953,_0x8ad5d3){_0x25c953=_0x25c953-0x0;var _0x95d4eb=_0x17d5[_0x25c953];return _0x95d4eb;};'use strict';var path=require(_0x517d('0x0'));var util=require('util');var moment=require('moment');var winston=require(_0x517d('0x1'));var config=require(_0x517d('0x2'));var debugLevel=config[_0x517d('0x3')]?config[_0x517d('0x3')][_0x517d('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x517d('0x5'),'error':_0x517d('0x6'),'warn':_0x517d('0x7'),'info':_0x517d('0x8'),'print':_0x517d('0x9'),'success':_0x517d('0xa'),'http':'gray','verbose':'bold\x20magenta','debug':_0x517d('0xb'),'silly':_0x517d('0xc')};winston[_0x517d('0xd')](XC_LOG_COLORS);function getLogFileName(_0x81aebf,_0x3e7aa6,_0x5d5746){var _0x4ab396=_0x81aebf||_0x517d('0xe');return path['join'](_0x4ab396,util[_0x517d('0xf')]('%s-%s.log',_0x3e7aa6,_0x5d5746));}function formatter(_0x5e7fb7,_0x44ceb4){_0x44ceb4[_0x517d('0x10')]=_0x44ceb4['message'][_0x517d('0x11')](/@@{/g,'{{{')[_0x517d('0x11')](/}@@/g,_0x517d('0x12'))[_0x517d('0x11')](/@{/g,'{{')[_0x517d('0x11')](/}@/g,'}}');return util['format'](_0x517d('0x13'),moment()[_0x517d('0xf')](_0x517d('0x14')),_0x44ceb4['level'][_0x517d('0x15')](),_0x5e7fb7,_0x44ceb4[_0x517d('0x10')]);}function fileFormat(_0x3cd329,_0xd1cbd5){_0xd1cbd5[_0x517d('0x10')]=_0xd1cbd5[_0x517d('0x10')][_0x517d('0x11')](/@@{/g,_0x517d('0x16'))['replace'](/}@@/g,_0x517d('0x12'))[_0x517d('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x2ba5ec=_0xd1cbd5[_0x517d('0x17')]&&Object['keys'](_0xd1cbd5[_0x517d('0x17')])[_0x517d('0x18')]?'\x0a\x09'+JSON[_0x517d('0x19')](_0xd1cbd5[_0x517d('0x17')]):'';return util['format'](_0x517d('0x1a'),moment()[_0x517d('0xf')](_0x517d('0x14')),_0xd1cbd5[_0x517d('0x1b')][_0x517d('0x15')](),_0x3cd329,_0xd1cbd5[_0x517d('0x10')],_0x2ba5ec);}function consoleLogger(){var _0xd8e02a=new winston[(_0x517d('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x517d('0x1d'))][(_0x517d('0x1e'))]({'level':_0x517d('0x1f'),'json':![],'formatter':function(_0x3f4b10){return formatter('',_0x3f4b10);}})]});return _0xd8e02a;}function fileLogger(_0x10c155,_0x2282dd){var _0x1cbdd4=new winston[(_0x517d('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x517d('0x20'))]({'name':util[_0x517d('0xf')](_0x517d('0x21'),_0x10c155,_0x517d('0x22')),'filename':getLogFileName(_0x2282dd,_0x10c155,'error'),'level':_0x517d('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x39a82f){return fileFormat(_0x10c155,_0x39a82f);}}),new winston[(_0x517d('0x1d'))][(_0x517d('0x20'))]({'name':util[_0x517d('0xf')](_0x517d('0x21'),_0x10c155,debugLevel),'filename':getLogFileName(_0x2282dd,_0x10c155,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x294621){return fileFormat(_0x10c155,_0x294621);}}),new winston[(_0x517d('0x1d'))][(_0x517d('0x1e'))]({'level':_0x517d('0x1f'),'json':![],'formatter':function(_0x5518fe){return fileFormat(_0x10c155,_0x5518fe);}})]});return _0x1cbdd4;}exports[_0x517d('0x23')]=consoleLogger;exports[_0x517d('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 3baa1b0..9625235 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0x4975,0x86));var _0x5497=function(_0x5bc011,_0x2e9861){_0x5bc011=_0x5bc011-0x0;var _0x246523=_0x4975[_0x5bc011];return _0x246523;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData; \ No newline at end of file +var _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0xc5a7fb,_0x5cac5b){var _0xe75710=function(_0x1d9ab4){while(--_0x1d9ab4){_0xc5a7fb['push'](_0xc5a7fb['shift']());}};_0xe75710(++_0x5cac5b);}(_0x14a0,0x8e));var _0x014a=function(_0x9c173d,_0x5d1ff5){_0x9c173d=_0x9c173d-0x0;var _0x503208=_0x14a0[_0x9c173d];return _0x503208;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index e5d315d..d4e8da4 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f4c=['map','isPlainObject','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','replace','isArray'];(function(_0x57decf,_0x49455c){var _0x54a450=function(_0x7816b5){while(--_0x7816b5){_0x57decf['push'](_0x57decf['shift']());}};_0x54a450(++_0x49455c);}(_0x8f4c,0x113));var _0xc8f4=function(_0x149155,_0x4668d9){_0x149155=_0x149155-0x0;var _0x154d7a=_0x8f4c[_0x149155];return _0x154d7a;};var _=require(_0xc8f4('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x292fb6){return _0x292fb6==='{{'?_0xc8f4('0x1'):_0xc8f4('0x2');}function safeTemplate(_0x19893b){var _0x134d73=_0x19893b;if(typeof _0x19893b==='string'){_0x134d73=_0x19893b[_0xc8f4('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xc8f4('0x4')](_0x19893b)){_0x134d73=_0x19893b[_0xc8f4('0x5')](function(_0x56c9b1){return safeTemplate(_0x56c9b1);});}else if(_[_0xc8f4('0x6')](_0x19893b)){_0x134d73=Object['keys'](_0x19893b)['reduce'](function(_0x520063,_0x373506){_0x520063[_0x373506]=safeTemplate(_0x19893b[_0x373506]);return _0x520063;},{});}return _0x134d73;}module['exports'][_0xc8f4('0x7')]=safeTemplate; \ No newline at end of file +var _0x3423=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace'];(function(_0x3aea87,_0xbc220d){var _0x509124=function(_0x422da0){while(--_0x422da0){_0x3aea87['push'](_0x3aea87['shift']());}};_0x509124(++_0xbc220d);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4a04c7){return _0x4a04c7==='{{'?_0x3342('0x0'):_0x3342('0x1');}function safeTemplate(_0x3477de){var _0x3b763d=_0x3477de;if(typeof _0x3477de===_0x3342('0x2')){_0x3b763d=_0x3477de[_0x3342('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3342('0x4')](_0x3477de)){_0x3b763d=_0x3477de[_0x3342('0x5')](function(_0x3075f8){return safeTemplate(_0x3075f8);});}else if(_[_0x3342('0x6')](_0x3477de)){_0x3b763d=Object[_0x3342('0x7')](_0x3477de)[_0x3342('0x8')](function(_0x29c40c,_0x420d4b){_0x29c40c[_0x420d4b]=safeTemplate(_0x3477de[_0x420d4b]);return _0x29c40c;},{});}return _0x3b763d;}module[_0x3342('0x9')][_0x3342('0xa')]=safeTemplate; \ No newline at end of file diff --git a/snippet/3.0.0/index.html b/snippet/3.0.0/index.html index 0fea840..e8abdfe 100644 --- a/snippet/3.0.0/index.html +++ b/snippet/3.0.0/index.html @@ -1,17 +1,85 @@ -xCally Motion Chat
") + + + + + + + + +
+
+ + +
+
+
{{ actualTitle }} +
+ + + {{ actualTitle }} + + + + +
+ + +
+ +
+
\ No newline at end of file + " + ng-click="vm.close(); $event.stopPropagation();" + > + + +
+ +
+ +
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + diff --git a/snippet/3.0.0/scripts/app.js b/snippet/3.0.0/scripts/app.js index 210848b..7c3a8af 100644 --- a/snippet/3.0.0/scripts/app.js +++ b/snippet/3.0.0/scripts/app.js @@ -1,2 +1,42 @@ -/*! For license information please see app.js.LICENSE.txt */ -"use strict";(self.webpackChunkmotion_chat=self.webpackChunkmotion_chat||[]).push([["app"],{"./src/styles/app.scss":()=>{}},e=>{e.O(0,["vendor","vendor-index","vendor-angular-76f2ed34","vendor-angular-58d021f3","vendor-ng-embed","vendor-moment","vendor-jquery","vendor-jquery.textcomplete","vendor-emojionearea","vendor-emojione","vendor-angular-sanitize","vendor-angular-resource","vendor-angular-messages","vendor-angular-material","vendor-angular-local-storage","vendor-angular-animate","vendor-urlMatcher","vendor-transition","vendor-stateService","vendor-stateDirectives","vendor-flow","chat"],(()=>("./src/styles/app.scss",e(e.s="./src/styles/app.scss")))),e.O()}]); \ No newline at end of file +/*! + * ************************************************************************* + * * * + * * xCALLY Motion - The Omnichannel Contact Center * + * * Copyright (c) Xenialab s.r.l. All Rights Reserved * + * * * + * ************************************************************************* + * * * + * * Email: info@xcally.com * + * * Website: https://www.xcally.com * + * * * + * ************************************************************************* + * * * + * * The SOFTWARE PRODUCT is protected by copyright laws and international * + * * copyright treaties, as well as other intellectual property laws and * + * * treaties. The SOFTWARE PRODUCT is licensed, not sold. * + * * * + * ************************************************************************* + */ +"use strict"; +(self["webpackChunkmotion_chat"] = self["webpackChunkmotion_chat"] || []).push([["app"],{ + +/***/ "./src/styles/app.scss": +/*!*****************************!*\ + !*** ./src/styles/app.scss ***! + \*****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }) + +}, +/******/ __webpack_require__ => { // webpackRuntimeModules +/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) +/******/ __webpack_require__.O(0, ["chat"], () => (__webpack_exec__("./src/styles/app.scss"))); +/******/ var __webpack_exports__ = __webpack_require__.O(); +/******/ } +]); +//# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/snippet/3.0.0/scripts/app.js.LICENSE.txt b/snippet/3.0.0/scripts/app.js.LICENSE.txt deleted file mode 100644 index 15c6a44..0000000 --- a/snippet/3.0.0/scripts/app.js.LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * ************************************************************************* - * * * - * * xCALLY Motion - The Omnichannel Contact Center * - * * Copyright (c) Xenialab s.r.l. All Rights Reserved * - * * * - * ************************************************************************* - * * * - * * Email: info@xcally.com * - * * Website: https://www.xcally.com * - * * * - * ************************************************************************* - * * * - * * The SOFTWARE PRODUCT is protected by copyright laws and international * - * * copyright treaties, as well as other intellectual property laws and * - * * treaties. The SOFTWARE PRODUCT is licensed, not sold. * - * * * - * ************************************************************************* - */ diff --git a/snippet/3.0.0/scripts/app.js.map b/snippet/3.0.0/scripts/app.js.map new file mode 100644 index 0000000..9b8ff55 --- /dev/null +++ b/snippet/3.0.0/scripts/app.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scripts/app.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA","sources":["webpack://motion-chat/./src/styles/app.scss?077d"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport {};"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/snippet/3.0.0/scripts/chat.js b/snippet/3.0.0/scripts/chat.js index dae50a6..3f336b9 100644 --- a/snippet/3.0.0/scripts/chat.js +++ b/snippet/3.0.0/scripts/chat.js @@ -1,3 +1,149116 @@ -/*! For license information please see chat.js.LICENSE.txt */ -(self.webpackChunkmotion_chat=self.webpackChunkmotion_chat||[]).push([["chat"],{"./node_modules/@flowjs/ng-flow/dist/ng-flow.js":(e,t,n)=>{var o=n("./node_modules/@flowjs/flow.js/src/flow.js");angular.module("flow.provider",[]).provider("flowFactory",(function(){"use strict";this.defaults={},this.factory=function(e){return new o(e)},this.events=[],this.on=function(e,t){this.events.push([e,t])},this.$get=function(){var e=this.factory,t=this.defaults,n=this.events;return{create:function(o){var r=e(angular.extend({},t,o));return angular.forEach(n,(function(e){r.on(e[0],e[1])})),r}}}})),angular.module("flow.init",["flow.provider"]).controller("flowCtrl",["$scope","$attrs","$parse","flowFactory",function(e,t,n,o){var r=angular.extend({},e.$eval(t.flowInit)),s=e.$eval(t.flowObject)||o.create(r),a=function(t){var n=Array.prototype.slice.call(arguments);n.shift();var o=e.$broadcast.apply(e,["flow::"+t,s].concat(n));if({progress:1,filesSubmitted:1,fileSuccess:1,fileError:1,complete:1}[t]&&e.$applyAsync(),o.defaultPrevented)return!1};s.on("catchAll",a),e.$on("$destroy",(function(){s.off("catchAll",a)})),e.$flow=s,t.hasOwnProperty("flowName")&&(n(t.flowName).assign(e,s),e.$on("$destroy",(function(){n(t.flowName).assign(e)})))}]).directive("flowInit",[function(){return{scope:!0,controller:"flowCtrl"}}]),angular.module("flow.btn",["flow.init"]).directive("flowBtn",[function(){return{restrict:"EA",scope:!1,require:"^flowInit",link:function(e,t,n){var o=n.hasOwnProperty("flowDirectory"),r=n.hasOwnProperty("flowSingleFile"),s=n.hasOwnProperty("flowAttrs")&&e.$eval(n.flowAttrs);e.$flow.assignBrowse(t,o,r,s)}}}]),angular.module("flow.dragEvents",["flow.init"]).directive("flowPreventDrop",(function(){return{scope:!1,link:function(e,t,n){t.bind("drop dragover",(function(e){e.preventDefault()}))}}})).directive("flowDragEnter",["$timeout",function(e){return{scope:!1,link:function(t,n,o){var r,s=!1;n.bind("dragover",(function(n){var a,i,d;i=!1,d=(a=n).dataTransfer||a.originalEvent.dataTransfer,angular.forEach(d&&d.types,(function(e){"Files"===e&&(i=!0)})),i&&(s||(t.$apply(o.flowDragEnter),s=!0),e.cancel(r),n.preventDefault())})),n.bind("dragleave drop",(function(n){e.cancel(r),r=e((function(){t.$eval(o.flowDragLeave),r=null,s=!1}),100)}))}}}]),angular.module("flow.drop",["flow.init"]).directive("flowDrop",(function(){return{scope:!1,require:"^flowInit",link:function(e,t,n){function o(){e.$flow.assignDrop(t)}n.flowDropEnabled?e.$watch(n.flowDropEnabled,(function(n){n?o():e.$flow.unAssignDrop(t)})):o()}}})),function(e){"use strict";var t=e.module("flow.events",["flow.init"]);e.forEach({fileSuccess:["$file","$message"],fileProgress:["$file"],fileAdded:["$file","$event"],filesAdded:["$files","$event"],filesSubmitted:["$files","$event"],fileRetry:["$file"],fileRemoved:["$file"],fileError:["$file","$message"],uploadStart:[],complete:[],progress:[],error:["$message","$file"]},(function(n,o){var r,s="flow"+((r=o).charAt(0).toUpperCase()+r.slice(1));"flowUploadStart"==s&&(s="flowUploadStarted"),t.directive(s,[function(){return{require:"^flowInit",controller:["$scope","$attrs",function(t,r){t.$on("flow::"+o,(function(){var o=Array.prototype.slice.call(arguments),a=o.shift();if(t.$flow===o.shift()){var i={};e.forEach(n,(function(e,t){i[e]=o[t]})),!1===t.$eval(r[s],i)&&a.preventDefault()}}))}]}}])}))}(angular),angular.module("flow.img",["flow.init"]).directive("flowImg",[function(){return{scope:!1,require:"^flowInit",link:function(e,t,n){var o=n.flowImg;e.$watch(o,(function(t){if(t){var o=new FileReader;o.readAsDataURL(t.file),o.onload=function(t){e.$apply((function(){n.$set("src",t.target.result)}))}}}))}}}]),angular.module("flow.transfers",["flow.init"]).directive("flowTransfers",[function(){return{scope:!0,require:"^flowInit",link:function(e){e.transfers=e.$flow.files}}}]),angular.module("flow",["flow.provider","flow.init","flow.events","flow.btn","flow.drop","flow.transfers","flow.img","flow.dragEvents"])},"./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js":(e,t,n)=>{"use strict";var o,r=n("./node_modules/@uirouter/core/lib-esm/index.js"),s=n("./node_modules/@uirouter/angularjs/lib-esm/angular.js"),a=n("./node_modules/@uirouter/angularjs/lib-esm/services.js"),i=n("./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js");function d(e,t,n,o,i){var d=(0,r.parse)("viewDecl.controllerAs"),u=(0,r.parse)("viewDecl.resolveAs");return{restrict:"ECA",priority:-400,compile:function(o){var m=o.html();return o.empty(),function(o,_){var c=_.data("$uiView");if(!c)return _.html(m),void e(_.contents())(o);var h=c.$cfg||{viewDecl:{},getTemplate:r.noop},f=h.path&&new r.ResolveContext(h.path);_.html(h.getTemplate(_,f)||m),r.trace.traceUIViewFill(c.$uiView,_.html());var p=e(_.contents()),M=h.controller,y=d(h),L=u(h),Y=f&&(0,a.D)(f);if(o[L]=Y,M){var g=t(M,(0,r.extend)({},Y,{$scope:o,$element:_}));y&&(o[y]=g,o[y][L]=Y),_.data("$ngControllerController",g),_.children().data("$ngControllerController",g),l(i,n,g,o,h)}if((0,r.isString)(h.component))var v=(0,r.kebobString)(h.component),k=new RegExp("^(x-|data-)?"+v+"$","i"),j=o.$watch((function(){var e=[].slice.call(_[0].children).filter((function(e){return e&&e.tagName&&k.exec(e.tagName)}));return e&&s.ng.element(e).data("$"+h.component+"Controller")}),(function(e){e&&(l(i,n,e,o,h),j())}));p(o)}}}}o=["$view","$animate","$uiViewScroll","$interpolate","$q",function(e,t,n,o,a){var d={$cfg:{viewDecl:{$context:e._pluginapi._rootViewContext()}},$uiView:{}},u={count:0,restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(m,l,_){return function(m,l,c){var h,f,p,M,y=c.onload||"",L=c.autoscroll,Y=function(e,n,o){s.ng.version.minor>2?t.enter(e,null,n).then(o):t.enter(e,null,n,o)},g=function(e,n){s.ng.version.minor>2?t.leave(e).then(n):t.leave(e,n)},v=l.inheritedData("$uiView")||d,k=o(c.uiView||c.name||"")(m)||"$default",j={$type:"ng1",id:u.count++,name:k,fqn:v.$uiView.fqn?v.$uiView.fqn+"."+k:k,config:null,configUpdated:function(e){(!e||e instanceof i.qO)&&(M!==e&&(r.trace.traceUIViewConfigUpdated(j,e&&e.viewDecl&&e.viewDecl.$context),M=e,b(e)))},get creationContext(){var e=(0,r.parse)("$cfg.viewDecl.$context")(v),t=(0,r.parse)("$uiView.creationContext")(v);return e||t}};r.trace.traceUIViewEvent("Linking",j),l.data("$uiView",{$uiView:j}),b();var w=e.registerUIView(j);function b(e){var t=m.$new(),o=a.defer(),s=a.defer(),i={$cfg:e,$uiView:j},d={$animEnter:o.promise,$animLeave:s.promise,$$animLeave:s};t.$emit("$viewContentLoading",k);var u=_(t,(function(e){e.data("$uiViewAnim",d),e.data("$uiView",i),Y(e,l,(function(){o.resolve(),p&&p.$emit("$viewContentAnimationEnded"),((0,r.isDefined)(L)&&!L||m.$eval(L))&&n(e)})),function(){if(h&&(r.trace.traceUIViewEvent("Removing (previous) el",h.data("$uiView")),h.remove(),h=null),p&&(r.trace.traceUIViewEvent("Destroying scope",j),p.$destroy(),p=null),f){var e=f.data("$uiViewAnim");r.trace.traceUIViewEvent("Animate out",e),g(f,(function(){e.$$animLeave.resolve(),h=null})),h=f,f=null}}()}));f=u,(p=t).$emit("$viewContentLoaded",e||M),p.$eval(y)}m.$on("$destroy",(function(){r.trace.traceUIViewEvent("Destroying/Unregistering",j),w()}))}}};return u}],d.$inject=["$compile","$controller","$transitions","$view","$q"];var u="function"==typeof s.ng.module("ui.router").component,m=0;function l(e,t,n,o,s){!(0,r.isFunction)(n.$onInit)||(s.viewDecl.component||s.viewDecl.componentProvider)&&u||n.$onInit();var a=(0,r.tail)(s.path).state.self,i={bind:n};if((0,r.isFunction)(n.uiOnParamsChanged)){var d=new r.ResolveContext(s.path).getResolvable("$transition$").data;o.$on("$destroy",t.onSuccess({},(function(e){if(e!==d&&-1===e.exiting().indexOf(a)){var t=e.params("to"),o=e.params("from"),s=function(e){return e.paramSchema},i=e.treeChanges("to").map(s).reduce(r.unnestR,[]),u=e.treeChanges("from").map(s).reduce(r.unnestR,[]),m=i.filter((function(e){var n=u.indexOf(e);return-1===n||!u[n].type.equals(t[e.id],o[e.id])}));if(m.length){var l=m.map((function(e){return e.id})),_=(0,r.filter)(t,(function(e,t){return-1!==l.indexOf(t)}));n.uiOnParamsChanged(_,e)}}}),i))}if((0,r.isFunction)(n.uiCanExit)){var l=m++,_="_uiCanExitIds",c=function(e){return!!e&&(e[_]&&!0===e[_][l]||c(e.redirectedFrom()))},h={exiting:a.name};o.$on("$destroy",t.onBefore(h,(function(t){var o,r=t[_]=t[_]||{};return c(t)||(o=e.when(n.uiCanExit(t))).then((function(e){return r[l]=!1!==e})),o}),i))}}s.ng.module("ui.router.state").directive("uiView",o),s.ng.module("ui.router.state").directive("uiView",d)},"./node_modules/@uirouter/angularjs/lib-esm/services.js":(e,t,n)=>{"use strict";n.d(t,{D:()=>k});var o=n("./node_modules/@uirouter/angularjs/lib-esm/angular.js"),r=n("./node_modules/@uirouter/core/lib-esm/index.js"),s=n("./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"),a=function(){function e(){var e=this;this._useHttp=o.ng.version.minor<3,this.$get=["$http","$templateCache","$injector",function(t,n,o){return e.$templateRequest=o.has&&o.has("$templateRequest")&&o.get("$templateRequest"),e.$http=t,e.$templateCache=n,e}]}return e.prototype.useHttpService=function(e){this._useHttp=e},e.prototype.fromConfig=function(e,t,n){var o=function(e){return r.services.$q.when(e).then((function(e){return{template:e}}))},s=function(e){return r.services.$q.when(e).then((function(e){return{component:e}}))};return(0,r.isDefined)(e.template)?o(this.fromString(e.template,t)):(0,r.isDefined)(e.templateUrl)?o(this.fromUrl(e.templateUrl,t)):(0,r.isDefined)(e.templateProvider)?o(this.fromProvider(e.templateProvider,t,n)):(0,r.isDefined)(e.component)?s(e.component):(0,r.isDefined)(e.componentProvider)?s(this.fromComponentProvider(e.componentProvider,t,n)):o("")},e.prototype.fromString=function(e,t){return(0,r.isFunction)(e)?e(t):e},e.prototype.fromUrl=function(e,t){return(0,r.isFunction)(e)&&(e=e(t)),null==e?null:this._useHttp?this.$http.get(e,{cache:this.$templateCache,headers:{Accept:"text/html"}}).then((function(e){return e.data})):this.$templateRequest(e)},e.prototype.fromProvider=function(e,t,n){var o=r.services.$injector.annotate(e),s=(0,r.isArray)(e)?(0,r.tail)(e):e;return new r.Resolvable("",s,o).get(n)},e.prototype.fromComponentProvider=function(e,t,n){var o=r.services.$injector.annotate(e),s=(0,r.isArray)(e)?(0,r.tail)(e):e;return new r.Resolvable("",s,o).get(n)},e.prototype.makeComponentTemplate=function(e,t,n,s){s=s||{};var a=o.ng.version.minor>=3?"::":"",d=function(e){var t=(0,r.kebobString)(e);return/^(x|data)-/.exec(t)?"x-"+t:t},u=function(e){var t=r.services.$injector.get(e+"Directive");if(!t||!t.length)throw new Error("Unable to find component named '"+e+"'");return t.map(i).reduce(r.unnestR,[])}(n).map((function(n){var o=n.name,i=n.type,u=d(o);if(e.attr(u)&&!s[o])return u+"='"+e.attr(u)+"'";var m=s[o]||o;if("@"===i)return u+"='{{"+a+"$resolve."+m+"}}'";if("&"===i){var l=t.getResolvable(m),_=l&&l.data,c=_&&r.services.$injector.annotate(_)||[];return u+"='$resolve."+m+((0,r.isArray)(_)?"["+(_.length-1)+"]":"")+"("+c.join(",")+")'"}return u+"='"+a+"$resolve."+m+"'"})).join(" "),m=d(n);return"<"+m+" "+u+">"},e}(),i=function(e){return(0,r.isObject)(e.bindToController)?d(e.bindToController):d(e.scope)},d=function(e){return Object.keys(e||{}).map((function(t){return[t,/^([=<@&])[?]?(.*)/.exec(e[t])]})).filter((function(e){return(0,r.isDefined)(e)&&(0,r.isArray)(e[1])})).map((function(e){return{name:e[1][2]||e[0],type:e[1][1]}}))},u=n("./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js"),m=function(e){return function(t){var n=t[e],o="onExit"===e?"from":"to";return n?function(e,t){var s=new r.ResolveContext(e.treeChanges(o)).subContext(t.$$state()),a=(0,r.extend)(k(s),{$state$:t,$transition$:e});return r.services.$injector.invoke(n,this,a)}:void 0}},l=function(){function e(e){this._urlListeners=[],this.$locationProvider=e;var t=(0,r.val)(e);(0,r.createProxyFunctions)(t,this,t,["hashPrefix"])}return e.monkeyPatchPathParameterType=function(e){var t=e.urlMatcherFactory.type("path");t.encode=function(e){return null!=e?e.toString().replace(/(~|\/)/g,(function(e){return{"~":"~~","/":"~2F"}[e]})):e},t.decode=function(e){return null!=e?e.toString().replace(/(~~|~2F)/g,(function(e){return{"~~":"~","~2F":"/"}[e]})):e}},e.prototype.dispose=function(){},e.prototype.onChange=function(e){var t=this;return this._urlListeners.push(e),function(){return(0,r.removeFrom)(t._urlListeners)(e)}},e.prototype.html5Mode=function(){var e=this.$locationProvider.html5Mode();return(e=(0,r.isObject)(e)?e.enabled:e)&&this.$sniffer.history},e.prototype.baseHref=function(){return this._baseHref||(this._baseHref=this.$browser.baseHref()||this.$window.location.pathname)},e.prototype.url=function(e,t,n){return void 0===t&&(t=!1),(0,r.isDefined)(e)&&this.$location.url(e),t&&this.$location.replace(),n&&this.$location.state(n),this.$location.url()},e.prototype._runtimeServices=function(e,t,n,o,s){var a=this;this.$location=t,this.$sniffer=n,this.$browser=o,this.$window=s,e.$on("$locationChangeSuccess",(function(e){return a._urlListeners.forEach((function(t){return t(e)}))}));var i=(0,r.val)(t);(0,r.createProxyFunctions)(i,this,i,["replace","path","search","hash"]),(0,r.createProxyFunctions)(i,this,i,["port","protocol","host"])},e}(),_=n("./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js");o.ng.module("ui.router.angular1",[]);var c=o.ng.module("ui.router.init",["ng"]),h=o.ng.module("ui.router.util",["ui.router.init"]),f=o.ng.module("ui.router.router",["ui.router.util"]),p=o.ng.module("ui.router.state",["ui.router.router","ui.router.util","ui.router.angular1"]),M=o.ng.module("ui.router",["ui.router.init","ui.router.state","ui.router.angular1"]),y=(o.ng.module("ui.router.compat",["ui.router"]),null);function L(e){(y=this.router=new r.UIRouter).stateProvider=new u.X(y.stateRegistry,y.stateService),y.stateRegistry.decorator("views",s.LB),y.stateRegistry.decorator("onExit",m("onExit")),y.stateRegistry.decorator("onRetain",m("onRetain")),y.stateRegistry.decorator("onEnter",m("onEnter")),y.viewService._pluginapi._viewConfigFactory("ng1",(0,s.OB)()),y.urlService.config._decodeParams=!1;var t=y.locationService=y.locationConfig=new l(e);function n(e,n,o,r,s,a,i){return t._runtimeServices(s,e,r,n,o),delete y.router,delete y.$get,y}return l.monkeyPatchPathParameterType(y),y.router=y,y.$get=n,n.$inject=["$location","$browser","$window","$sniffer","$rootScope","$http","$templateCache"],y}L.$inject=["$locationProvider"];var Y=function(e){return["$uiRouterProvider",function(t){var n=t.router[e];return n.$get=function(){return n},n}]};function g(e,t,n){if(r.services.$injector=e,r.services.$q=t,!Object.prototype.hasOwnProperty.call(e,"strictDi"))try{e.invoke((function(e){}))}catch(t){e.strictDi=!!/strict mode/.exec(t&&t.toString())}n.stateRegistry.get().map((function(e){return e.$$state().resolvables})).reduce(r.unnestR,[]).filter((function(e){return"deferred"===e.deps})).forEach((function(t){return t.deps=e.annotate(t.resolveFn,e.strictDi)}))}function v(e){e.$watch((function(){r.trace.approximateDigests++}))}g.$inject=["$injector","$q","$uiRouter"],v.$inject=["$rootScope"],c.provider("$uiRouter",L),f.provider("$urlRouter",["$uiRouterProvider",function(e){return e.urlRouterProvider=new _.L(e)}]),h.provider("$urlService",Y("urlService")),h.provider("$urlMatcherFactory",["$uiRouterProvider",function(){return y.urlMatcherFactory}]),h.provider("$templateFactory",(function(){return new a})),p.provider("$stateRegistry",Y("stateRegistry")),p.provider("$uiRouterGlobals",Y("globals")),p.provider("$transitions",Y("transitionService")),p.provider("$state",["$uiRouterProvider",function(){return(0,r.extend)(y.stateProvider,{$get:function(){return y.stateService}})}]),p.factory("$stateParams",["$uiRouter",function(e){return e.globals.params}]),M.factory("$view",(function(){return y.viewService})),M.service("$trace",(function(){return r.trace})),M.run(v),h.run(["$urlMatcherFactory",function(e){}]),p.run(["$state",function(e){}]),f.run(["$urlRouter",function(e){}]),c.run(g);var k=function(e){return e.getTokens().filter(r.isString).map((function(t){var n=e.getResolvable(t);return[t,"NOWAIT"===e.getPolicy(n).async?n.promise:n.data]})).reduce(r.applyPairs,{})}},"./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js":(e,t,n)=>{"use strict";var o=n("./node_modules/@uirouter/angularjs/lib-esm/angular.js");function r(e){var t=function(t,n,o){return e.is(t,n,o)};return t.$stateful=!0,t}function s(e){var t=function(t,n,o){return e.includes(t,n,o)};return t.$stateful=!0,t}r.$inject=["$state"],s.$inject=["$state"],o.ng.module("ui.router.state").filter("isState",r).filter("includedByState",s)},"./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js":(e,t,n)=>{"use strict";n.d(t,{X:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/index.js"),r=function(){function e(t,n){this.stateRegistry=t,this.stateService=n,(0,o.createProxyFunctions)((0,o.val)(e.prototype),this,(0,o.val)(this))}return e.prototype.decorator=function(e,t){return this.stateRegistry.decorator(e,t)||this},e.prototype.state=function(e,t){return(0,o.isObject)(e)?t=e:t.name=e,this.stateRegistry.register(t),this},e.prototype.onInvalid=function(e){return this.stateService.onInvalid(e)},e}()},"./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js":(e,t,n)=>{"use strict";n.d(t,{OB:()=>r,LB:()=>a,qO:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/index.js");function r(){var e=null;return function(t,n){return e=e||o.services.$injector.get("$templateFactory"),[new d(t,n,e)]}}var s=function(e,t){return e.reduce((function(e,n){return e||(0,o.isDefined)(t[n])}),!1)};function a(e){if(!e.parent)return{};var t=["component","bindings","componentProvider"],n=["templateProvider","templateUrl","template","notify","async"].concat(["controller","controllerProvider","controllerAs","resolveAs"]),r=t.concat(n);if((0,o.isDefined)(e.views)&&s(r,e))throw new Error("State '"+e.name+"' has a 'views' object. It cannot also have \"view properties\" at the state level. Move the following properties into a view (in the 'views' object): "+r.filter((function(t){return(0,o.isDefined)(e[t])})).join(", "));var a={},i=e.views||{$default:(0,o.pick)(e,r)};return(0,o.forEach)(i,(function(r,i){if(i=i||"$default",(0,o.isString)(r)&&(r={component:r}),r=(0,o.extend)({},r),s(t,r)&&s(n,r))throw new Error("Cannot combine: "+t.join("|")+" with: "+n.join("|")+" in stateview: '"+i+"@"+e.name+"'");r.resolveAs=r.resolveAs||"$resolve",r.$type="ng1",r.$context=e,r.$name=i;var d=o.ViewService.normalizeUIViewTarget(r.$context,r.$name);r.$uiViewName=d.uiViewName,r.$uiViewContextAnchor=d.uiViewContextAnchor,a[i]=r})),a}var i=0,d=function(){function e(e,t,n){var o=this;this.path=e,this.viewDecl=t,this.factory=n,this.$id=i++,this.loaded=!1,this.getTemplate=function(e,t){return o.component?o.factory.makeComponentTemplate(e,t,o.component,o.viewDecl.bindings):o.template}}return e.prototype.load=function(){var e=this,t=o.services.$q,n=new o.ResolveContext(this.path),r=this.path.reduce((function(e,t){return(0,o.extend)(e,t.paramValues)}),{}),s={template:t.when(this.factory.fromConfig(this.viewDecl,r,n)),controller:t.when(this.getController(n))};return t.all(s).then((function(t){return o.trace.traceViewServiceEvent("Loaded",e),e.controller=t.controller,(0,o.extend)(e,t.template),e}))},e.prototype.getController=function(e){var t=this.viewDecl.controllerProvider;if(!(0,o.isInjectable)(t))return this.viewDecl.controller;var n=o.services.$injector.annotate(t),r=(0,o.isArray)(t)?(0,o.tail)(t):t;return new o.Resolvable("",r,n).get(e)},e}()},"./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js":(e,t,n)=>{"use strict";n.d(t,{L:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/index.js"),r=function(){function e(e){this.router=e}return e.injectableHandler=function(e,t){return function(n){return o.services.$injector.invoke(t,null,{$match:n,$stateParams:e.globals.params})}},e.prototype.$get=function(){var e=this.router.urlService;return this.router.urlRouter.update(!0),e.interceptDeferred||e.listen(),this.router.urlRouter},e.prototype.rule=function(e){var t=this;if(!(0,o.isFunction)(e))throw new Error("'rule' must be a function");var n=new o.BaseUrlRule((function(){return e(o.services.$injector,t.router.locationService)}),o.identity);return this.router.urlService.rules.rule(n),this},e.prototype.otherwise=function(e){var t=this,n=this.router.urlService.rules;if((0,o.isString)(e))n.otherwise(e);else{if(!(0,o.isFunction)(e))throw new Error("'rule' must be a string or function");n.otherwise((function(){return e(o.services.$injector,t.router.locationService)}))}return this},e.prototype.when=function(t,n){return((0,o.isArray)(n)||(0,o.isFunction)(n))&&(n=e.injectableHandler(this.router,n)),this.router.urlService.rules.when(t,n),this},e.prototype.deferIntercept=function(e){this.router.urlService.deferIntercept(e)},e}()},"./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js":(e,t,n)=>{"use strict";n("./node_modules/@uirouter/angularjs/lib-esm/angular.js").ng.module("ui.router.state").provider("$uiViewScroll",(function(){var e=!1;this.useAnchorScroll=function(){e=!0},this.$get=["$anchorScroll","$timeout",function(t,n){return e?t:function(e){return n((function(){e[0].scrollIntoView()}),0,!1)}}]}))},"./node_modules/@uirouter/core/lib-esm/common/common.js":(e,t,n)=>{"use strict";n.d(t,{Jz:()=>i,xZ:()=>u,Qs:()=>m,Ed:()=>l,l7:()=>_,fS:()=>c,yR:()=>h,ZT:()=>f,WR:()=>p,ED:()=>M,d3:()=>y,nA:()=>L,LH:()=>Y,Wk:()=>g,ce:()=>v,LQ:()=>k,mX:()=>j,ei:()=>w,CE:()=>b,hX:()=>D,sE:()=>T,js:()=>S,UI:()=>H,VO:()=>x,XC:()=>E,o8:()=>P,M7:()=>O,FN:()=>$,Ez:()=>A,v_:()=>F,UW:()=>R,sp:()=>W,ym:()=>C,bb:()=>z,Gb:()=>I,JG:()=>J,HX:()=>V,jv:()=>N});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),a=function(){for(var e=0,t=0,n=arguments.length;t=0&&e.splice(n,1),e})),Y=(0,r.WA)((function(e,t){return e.push(t),t})),g=function(e){return e.slice().forEach((function(t){"function"==typeof t&&t(),L(e,t)}))};function v(e){for(var t=[],n=1;n{"use strict";n.d(t,{H:()=>o,u:()=>r});var o=function(e,t){return t.reduce((function(t,n){return t[n]=(o=e+"."+n+"()",function(){throw new Error("No implementation for "+o+". The framework specific code did not implement this method.")}),t;var o}),{})},r={$q:void 0,$injector:void 0}},"./node_modules/@uirouter/core/lib-esm/common/glob.js":(e,t,n)=>{"use strict";n.d(t,{r:()=>o});var o=function(){function e(e){this.text=e,this.glob=e.split(".");var t=this.text.split(".").map((function(e){return"**"===e?"(?:|(?:\\.[^.]*)*)":"*"===e?"\\.[^.]*":"\\."+e})).join("");this.regexp=new RegExp("^"+t+"$")}return e.is=function(e){return!!/[!,*]+/.exec(e)},e.fromString=function(t){return e.is(t)?new e(t):null},e.prototype.matches=function(e){return this.regexp.test("."+e)},e}()},"./node_modules/@uirouter/core/lib-esm/common/hof.js":(e,t,n)=>{"use strict";n.d(t,{WA:()=>r,zG:()=>a,vg:()=>i,OH:()=>d,Qc:()=>u,ff:()=>m,xD:()=>l,or:()=>_,$6:()=>c,Yj:()=>h,is:()=>f,P0:()=>p,uj:()=>M});var o=function(){for(var e=0,t=0,n=arguments.length;t=e.length)return e.apply(this,arguments);var n=Array.prototype.slice.call(arguments);return t.bind.apply(t,o([this],n))}}function s(){var e=arguments,t=e.length-1;return function(){for(var n=t,o=e[t].apply(this,arguments);n--;)o=e[n].call(this,o);return o}}function a(){for(var e=[],t=0;t{"use strict";n.d(t,{o8:()=>a,$K:()=>i,Ft:()=>d,le:()=>u,mf:()=>m,hj:()=>l,HD:()=>_,Kn:()=>c,kJ:()=>h,J_:()=>f,Kj:()=>p,Qh:()=>M,tI:()=>y});var o=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),r=Object.prototype.toString,s=function(e){return function(t){return typeof t===e}},a=s("undefined"),i=(0,o.ff)(a),d=function(e){return null===e},u=(0,o.or)(d,a),m=s("function"),l=s("number"),_=s("string"),c=function(e){return null!==e&&"object"==typeof e},h=Array.isArray,f=function(e){return"[object Date]"===r.call(e)},p=function(e){return"[object RegExp]"===r.call(e)};function M(e){if(h(e)&&e.length){var t=e.slice(0,-1),n=e.slice(-1);return!(t.filter((0,o.ff)(_)).length||n.filter((0,o.ff)(m)).length)}return m(e)}var y=(0,o.xD)(c,(0,o.zG)((0,o.vg)("then"),m))},"./node_modules/@uirouter/core/lib-esm/common/queue.js":(e,t,n)=>{"use strict";n.d(t,{c:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=function(){function e(e,t){void 0===e&&(e=[]),void 0===t&&(t=null),this._items=e,this._limit=t,this._evictListeners=[],this.onEvict=(0,o.LH)(this._evictListeners)}return e.prototype.enqueue=function(e){var t=this._items;return t.push(e),this._limit&&t.length>this._limit&&this.evict(),e},e.prototype.evict=function(){var e=this._items.shift();return this._evictListeners.forEach((function(t){return t(e)})),e},e.prototype.dequeue=function(){if(this.size())return this._items.splice(0,1)[0]},e.prototype.clear=function(){var e=this._items;return this._items=[],e},e.prototype.size=function(){return this._items.length},e.prototype.remove=function(e){var t=this._items.indexOf(e);return t>-1&&this._items.splice(t,1)[0]},e.prototype.peekTail=function(){return this._items[this._items.length-1]},e.prototype.peekHead=function(){if(this.size())return this._items[0]},e}()},"./node_modules/@uirouter/core/lib-esm/common/safeConsole.js":(e,t,n)=>{"use strict";n.d(t,{L:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r={log:o.ZT,error:o.ZT,table:o.ZT},s="undefined"!=typeof document&&document.documentMode&&9===document.documentMode?window&&window.console?function(e){var t=function(t){return Function.prototype.bind.call(t,e)};return{log:t(e.log),error:t(e.log),table:t(e.log)}}(window.console):r:console.table&&console.error?console:function(e){var t=e.log.bind(e);return{log:t,error:e.error?e.error.bind(e):t,table:e.table?e.table.bind(e):t}}(console)},"./node_modules/@uirouter/core/lib-esm/common/strings.js":(e,t,n)=>{"use strict";n.d(t,{BS:()=>i,NE:()=>d,L$:()=>u,XF:()=>m,iC:()=>l,Pz:()=>h,Lb:()=>p,cW:()=>M,C7:()=>y,Fb:()=>L,HV:()=>Y,PX:()=>g,iV:()=>v});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js");function i(e,t){return t.length<=e?t:t.substr(0,e-3)+"..."}function d(e,t){for(;t.length{"use strict";n.d(t,{g4:()=>c});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/safeConsole.js");function d(e){if(!e)return"ui-view (defunct)";var t=e.creationContext?e.creationContext.name||"(root)":"(none)";return"[ui-view#"+e.id+" "+e.$type+":"+e.fqn+" ("+e.name+"@"+t+")]"}function u(e){return(0,s.hj)(e)?o[e]:o[o[e]]}!function(e){e[e.RESOLVE=0]="RESOLVE",e[e.TRANSITION=1]="TRANSITION",e[e.HOOK=2]="HOOK",e[e.UIVIEW=3]="UIVIEW",e[e.VIEWCONFIG=4]="VIEWCONFIG"}(o||(o={}));var m=(0,r.Qc)("$id"),l=(0,r.Qc)("router.$id"),_=function(e){return"Transition #"+m(e)+"-"+l(e)},c=new(function(){function e(){this._enabled={},this.approximateDigests=0}return e.prototype._set=function(e,t){var n=this;t.length||(t=Object.keys(o).map((function(e){return parseInt(e,10)})).filter((function(e){return!isNaN(e)})).map((function(e){return o[e]}))),t.map(u).forEach((function(t){return n._enabled[t]=e}))},e.prototype.enable=function(){for(var e=[],t=0;t "+(0,a.Pz)(e))},e.prototype.traceTransitionIgnored=function(e){this.enabled(o.TRANSITION)&&i.L.log(_(e)+": Ignored <> "+(0,a.Pz)(e))},e.prototype.traceHookInvocation=function(e,t,n){if(this.enabled(o.HOOK)){var s=(0,r.Qc)("traceData.hookType")(n)||"internal",d=(0,r.Qc)("traceData.context.state.name")(n)||(0,r.Qc)("traceData.context")(n)||"unknown",u=(0,a.XF)(e.registeredHook.callback);i.L.log(_(t)+": Hook -> "+s+" context: "+d+", "+(0,a.BS)(200,u))}},e.prototype.traceHookResult=function(e,t,n){this.enabled(o.HOOK)&&i.L.log(_(t)+": <- Hook returned: "+(0,a.BS)(200,(0,a.Pz)(e)))},e.prototype.traceResolvePath=function(e,t,n){this.enabled(o.RESOLVE)&&i.L.log(_(n)+": Resolving "+e+" ("+t+")")},e.prototype.traceResolvableResolved=function(e,t){this.enabled(o.RESOLVE)&&i.L.log(_(t)+": <- Resolved "+e+" to: "+(0,a.BS)(200,(0,a.Pz)(e.data)))},e.prototype.traceError=function(e,t){this.enabled(o.TRANSITION)&&i.L.log(_(t)+": <- Rejected "+(0,a.Pz)(t)+", reason: "+e)},e.prototype.traceSuccess=function(e,t){this.enabled(o.TRANSITION)&&i.L.log(_(t)+": <- Success "+(0,a.Pz)(t)+", final state: "+e.name)},e.prototype.traceUIViewEvent=function(e,t,n){void 0===n&&(n=""),this.enabled(o.UIVIEW)&&i.L.log("ui-view: "+(0,a.NE)(30,e)+" "+d(t)+n)},e.prototype.traceUIViewConfigUpdated=function(e,t){this.enabled(o.UIVIEW)&&this.traceUIViewEvent("Updating",e," with ViewConfig from context='"+t+"'")},e.prototype.traceUIViewFill=function(e,t){this.enabled(o.UIVIEW)&&this.traceUIViewEvent("Fill",e," with: "+(0,a.BS)(200,t))},e.prototype.traceViewSync=function(e){if(this.enabled(o.VIEWCONFIG)){var t="uiview component fqn",n=e.map((function(e){var n,o=e.uiView,r=e.viewConfig,s=o&&o.fqn,a=r&&r.viewDecl.$context.name+": ("+r.viewDecl.$name+")";return(n={})[t]=s,n["view config state (view name)"]=a,n})).sort((function(e,n){return(e[t]||"").localeCompare(n[t]||"")}));i.L.table(n)}},e.prototype.traceViewServiceEvent=function(e,t){this.enabled(o.VIEWCONFIG)&&i.L.log("VIEWCONFIG: "+e+" "+function(e){var t=e.viewDecl,n=t.$context.name||"(root)";return"[View#"+e.$id+" from '"+n+"' state]: target ui-view: '"+t.$uiViewName+"@"+t.$uiViewContextAnchor+"'"}(t))},e.prototype.traceViewServiceUIViewEvent=function(e,t){this.enabled(o.VIEWCONFIG)&&i.L.log("VIEWCONFIG: "+e+" "+d(t))},e}())},"./node_modules/@uirouter/core/lib-esm/globals.js":(e,t,n)=>{"use strict";n.d(t,{k:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/params/stateParams.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/queue.js"),s=function(){function e(){this.params=new o.i,this.lastStartedTransitionId=-1,this.transitionHistory=new r.c([],1),this.successfulTransitions=new r.c([],1)}return e.prototype.dispose=function(){this.transitionHistory.clear(),this.successfulTransitions.clear(),this.transition=null},e}()},"./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js":(e,t,n)=>{"use strict";n.d(t,{v:()=>s,A:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),r=function(e){var t=e.router,n=e.entering().filter((function(e){return!!e.$$state().lazyLoad})).map((function(t){return a(e,t)}));return o.u.$q.all(n).then((function(){if("url"!==e.originalTransition().options().source){var n=e.targetState();return t.stateService.target(n.identifier(),n.params(),n.options())}var o=t.urlService,r=o.match(o.parts()),s=r&&r.rule;if(s&&"STATE"===s.type){var a=s.state,i=r.match;return t.stateService.target(a,i,e.options())}t.urlService.sync()}))},s=function(e){return e.onBefore({entering:function(e){return!!e.lazyLoad}},r)};function a(e,t){var n=t.$$state().lazyLoad,r=n._promise;return r||(r=n._promise=o.u.$q.when(n(e,t)).then((function(t){return t&&Array.isArray(t.states)&&t.states.forEach((function(t){return e.router.stateRegistry.register(t)})),t})).then((function(e){return delete t.lazyLoad,delete t.$$state().lazyLoad,delete n._promise,e}),(function(e){return delete n._promise,o.u.$q.reject(e)}))),r}},"./node_modules/@uirouter/core/lib-esm/interface.js":(e,t,n)=>{},"./node_modules/@uirouter/core/lib-esm/params/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/params/param.js":(e,t,n)=>{"use strict";n.d(t,{_:()=>o,d:()=>m});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),d=n("./node_modules/@uirouter/core/lib-esm/params/paramType.js"),u=Object.prototype.hasOwnProperty;!function(e){e[e.PATH=0]="PATH",e[e.SEARCH=1]="SEARCH",e[e.CONFIG=2]="CONFIG"}(o||(o={}));var m=function(){function e(e,t,n,i,m){var l=function(e,t,n){var s=!1===n.reloadOnSearch&&t===o.SEARCH||void 0,i=(0,r.sE)([n.dynamic,s],a.$K),d=(0,a.$K)(i)?{dynamic:i}:{},m=function(e){function t(){return e.value}e=function(e){return 0===["value","type","squash","array","dynamic"].filter(u.bind(e||{})).length}(e)?{value:e}:e,t.__cacheable=!0;var n=(0,a.Qh)(e.value)?e.value:t;return(0,r.l7)(e,{$$fn:n})}(n&&n.params&&n.params[e]);return(0,r.l7)(d,m)}(e,n,m);t=function(e,t,n,r,s){if(e.type&&t&&"string"!==t.name)throw new Error("Param '"+r+"' has two type configurations.");if(e.type&&t&&"string"===t.name&&s.type(e.type))return s.type(e.type);if(t)return t;if(!e.type){var a=n===o.CONFIG?"any":n===o.PATH?"path":n===o.SEARCH?"query":"string";return s.type(a)}return e.type instanceof d._?e.type:s.type(e.type)}(l,t,n,e,i.paramTypes);var _,c,h=(_={array:n===o.SEARCH&&"auto"},c=e.match(/\[\]$/)?{array:!0}:{},(0,r.l7)(_,c,l).array);t=h?t.$asArray(h,n===o.SEARCH):t;var f=void 0!==l.value||n===o.SEARCH,p=(0,a.$K)(l.dynamic)?!!l.dynamic:!!t.dynamic,M=(0,a.$K)(l.raw)?!!l.raw:!!t.raw,y=function(e,t,n){var o=e.squash;if(!t||!1===o)return!1;if(!(0,a.$K)(o)||null==o)return n;if(!0===o||(0,a.HD)(o))return o;throw new Error("Invalid squash policy: '"+o+"'. Valid policies: false, true, or arbitrary string")}(l,f,i.defaultSquashPolicy()),L=function(e,t,n,o){var i=[{from:"",to:n||t?void 0:""},{from:null,to:n||t?void 0:""}],d=(0,a.kJ)(e.replace)?e.replace:[];(0,a.HD)(o)&&d.push({from:o,to:void 0});var u=(0,r.UI)(d,(0,s.vg)("from"));return(0,r.hX)(i,(function(e){return-1===u.indexOf(e.from)})).concat(d)}(l,h,f,y),Y=(0,a.$K)(l.inherit)?!!l.inherit:!!t.inherit;(0,r.l7)(this,{id:e,type:t,location:n,isOptional:f,dynamic:p,raw:M,squash:y,replace:L,inherit:Y,array:h,config:l})}return e.values=function(e,t){void 0===t&&(t={});for(var n={},o=0,r=e;o{"use strict";n.d(t,{_:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=function(){function e(e){this.pattern=/.*/,this.inherit=!0,(0,o.l7)(this,e)}return e.prototype.is=function(e,t){return!0},e.prototype.encode=function(e,t){return e},e.prototype.decode=function(e,t){return e},e.prototype.equals=function(e,t){return e==t},e.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},e.prototype.toString=function(){return"{ParamType:"+this.name+"}"},e.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},e.prototype.$asArray=function(e,t){if(!e)return this;if("auto"===e&&!t)throw new Error("'auto' array mode is for query parameters only");return new a(this,e)},e}();function a(e,t){var n=this;function s(e){return(0,r.kJ)(e)?e:(0,r.$K)(e)?[e]:[]}function a(e,n){return function(a){if((0,r.kJ)(a)&&0===a.length)return a;var i=s(a),d=(0,o.UI)(i,e);return!0===n?0===(0,o.hX)(d,(function(e){return!e})).length:function(e){switch(e.length){case 0:return;case 1:return"auto"===t?e[0]:e;default:return e}}(d)}}function i(e){return function(t,n){var o=s(t),r=s(n);if(o.length!==r.length)return!1;for(var a=0;a{"use strict";n.d(t,{p:()=>u});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),d=n("./node_modules/@uirouter/core/lib-esm/params/paramType.js"),u=function(){function e(){this.enqueue=!0,this.typeQueue=[],this.defaultTypes=(0,r.ei)(e.prototype,["hash","string","query","path","int","bool","date","json","any"]),this.types=(0,r.ED)((0,r.UI)(this.defaultTypes,(function(e,t){return new d._((0,r.l7)({name:t},e))})),{})}return e.prototype.dispose=function(){this.types={}},e.prototype.type=function(e,t,n){if(!(0,s.$K)(t))return this.types[e];if(this.types.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return this.types[e]=new d._((0,r.l7)({name:e},t)),n&&(this.typeQueue.push({name:e,def:n}),this.enqueue||this._flushTypeQueue()),this},e.prototype._flushTypeQueue=function(){for(;this.typeQueue.length;){var e=this.typeQueue.shift();if(e.pattern)throw new Error("You cannot override a type's .pattern at runtime.");(0,r.l7)(this.types[e.name],i.u.$injector.invoke(e.def))}},e}();o=function(e){var t=function(e){return null!=e?e.toString():e},n={encode:t,decode:t,is:(0,a.is)(String),pattern:/.*/,equals:function(e,t){return e==t}};return(0,r.l7)({},n,e)},(0,r.l7)(u.prototype,{string:o({}),path:o({pattern:/[^/]*/}),query:o({}),hash:o({inherit:!1}),int:o({decode:function(e){return parseInt(e,10)},is:function(e){return!(0,s.le)(e)&&this.decode(e.toString())===e},pattern:/-?\d+/}),bool:o({encode:function(e){return e?1:0},decode:function(e){return 0!==parseInt(e,10)},is:(0,a.is)(Boolean),pattern:/0|1/}),date:o({encode:function(e){return this.is(e)?[e.getFullYear(),("0"+(e.getMonth()+1)).slice(-2),("0"+e.getDate()).slice(-2)].join("-"):void 0},decode:function(e){if(this.is(e))return e;var t=this.capture.exec(e);return t?new Date(t[1],t[2]-1,t[3]):void 0},is:function(e){return e instanceof Date&&!isNaN(e.valueOf())},equals:function(e,t){return["getFullYear","getMonth","getDate"].reduce((function(n,o){return n&&e[o]()===t[o]()}),!0)},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/}),json:o({encode:r.Qs,decode:r.xZ,is:(0,a.is)(Object),equals:r.fS,pattern:/[^/]*/}),any:o({encode:r.yR,decode:r.yR,is:function(){return!0},equals:r.fS})})},"./node_modules/@uirouter/core/lib-esm/params/stateParams.js":(e,t,n)=>{"use strict";n.d(t,{i:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=function(){function e(e){void 0===e&&(e={}),(0,o.l7)(this,e)}return e.prototype.$inherit=function(e,t,n){var r,s=(0,o.mX)(t,n),a={},i=[];for(var d in s)if(s[d]&&s[d].params&&(r=Object.keys(s[d].params)).length)for(var u in r)i.indexOf(r[u])>=0||(i.push(r[u]),a[r[u]]=this[r[u]]);return(0,o.l7)({},a,e)},e}()},"./node_modules/@uirouter/core/lib-esm/path/pathNode.js":(e,t,n)=>{"use strict";n.d(t,{V:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/params/param.js"),a=function(){function e(t){if(t instanceof e){var n=t;this.state=n.state,this.paramSchema=n.paramSchema.slice(),this.paramValues=(0,o.l7)({},n.paramValues),this.resolvables=n.resolvables.slice(),this.views=n.views&&n.views.slice()}else{var r=t;this.state=r,this.paramSchema=r.parameters({inherit:!1}),this.paramValues={},this.resolvables=r.resolvables.map((function(e){return e.clone()}))}}return e.prototype.clone=function(){return new e(this)},e.prototype.applyRawParams=function(e){return this.paramValues=this.paramSchema.reduce((function(t,n){return(0,o.bb)(t,[(r=n).id,r.value(e[r.id])]);var r}),{}),this},e.prototype.parameter=function(e){return(0,o.sE)(this.paramSchema,(0,r.OH)("id",e))},e.prototype.equals=function(e,t){var n=this.diff(e,t);return n&&0===n.length},e.prototype.diff=function(e,t){if(this.state!==e.state)return!1;var n=t?t(this):this.paramSchema;return s.d.changed(n,this.paramValues,e.paramValues)},e.clone=function(e){return e.clone()},e}()},"./node_modules/@uirouter/core/lib-esm/path/pathUtils.js":(e,t,n)=>{"use strict";n.d(t,{C:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/state/targetState.js"),a=n("./node_modules/@uirouter/core/lib-esm/path/pathNode.js"),i=function(){function e(){}return e.makeTargetState=function(e,t){var n=(0,o.Gb)(t).state;return new s.F(e,n,t.map((0,r.vg)("paramValues")).reduce(o.LQ,{}),{})},e.buildPath=function(e){var t=e.params();return e.$state().path.map((function(e){return new a.V(e).applyRawParams(t)}))},e.buildToPath=function(t,n){var o=e.buildPath(n);return n.options().inherit?e.inheritParams(t,o,Object.keys(n.params())):o},e.applyViewConfigs=function(t,n,r){n.filter((function(e){return(0,o.d3)(r,e.state)})).forEach((function(r){var s=(0,o.VO)(r.state.views||{}),a=e.subPath(n,(function(e){return e===r})),i=s.map((function(e){return t.createViewConfig(a,e)}));r.views=i.reduce(o.M7,[])}))},e.inheritParams=function(e,t,n){void 0===n&&(n=[]);var s=e.map((function(e){return e.paramSchema})).reduce(o.M7,[]).filter((function(e){return!e.inherit})).map((0,r.vg)("id"));return t.map((function(t){var i=(0,o.l7)({},t&&t.paramValues),d=(0,o.ei)(i,n);i=(0,o.CE)(i,n);var u,m,l,_=(0,o.CE)((u=e,m=t.state,l=(0,o.sE)(u,(0,r.OH)("state",m)),(0,o.l7)({},l&&l.paramValues)||{}),s),c=(0,o.l7)(i,_,d);return new a.V(t.state).applyRawParams(c)}))},e.treeChanges=function(t,n,o){for(var r,s,a,i,d,u,m=Math.min(t.length,n.length),l=0;l{"use strict";n.d(t,{u:()=>o});var o={when:{LAZY:"LAZY",EAGER:"EAGER"},async:{WAIT:"WAIT",NOWAIT:"NOWAIT"}}},"./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js":(e,t,n)=>{"use strict";n.d(t,{X:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),d=function(){function e(t,n,s,a,d){if(this.resolved=!1,this.promise=void 0,t instanceof e)(0,o.l7)(this,t);else if((0,i.mf)(n)){if((0,i.le)(t))throw new Error("new Resolvable(): token argument is required");if(!(0,i.mf)(n))throw new Error("new Resolvable(): resolveFn argument must be a function");this.token=t,this.policy=a,this.resolveFn=n,this.deps=s||[],this.data=d,this.resolved=void 0!==d,this.promise=this.resolved?r.u.$q.when(this.data):void 0}else if((0,i.Kn)(t)&&t.token&&(t.hasOwnProperty("resolveFn")||t.hasOwnProperty("data"))){var u=t;return new e(u.token,u.resolveFn,u.deps,u.policy,u.data)}}return e.prototype.getPolicy=function(e){var t=this.policy||{},n=e&&e.resolvePolicy||{};return{when:t.when||n.when||"LAZY",async:t.async||n.async||"WAIT"}},e.prototype.resolve=function(e,t){var n=this,a=r.u.$q,d=e.findNode(this),u=d&&d.state,m=this.getPolicy(u).async,l=(0,i.mf)(m)?m:o.yR;return this.promise=a.when().then((function(){return a.all(e.getDependencies(n).map((function(n){return n.get(e,t)})))})).then((function(e){return n.resolveFn.apply(null,e)})).then(l).then((function(e){return n.data=e,n.resolved=!0,n.resolveFn=null,s.g4.traceResolvableResolved(n,t),n.data}))},e.prototype.get=function(e,t){return this.promise||this.resolve(e,t)},e.prototype.toString=function(){return"Resolvable(token: "+(0,a.Pz)(this.token)+", requires: ["+this.deps.map(a.Pz)+"])"},e.prototype.clone=function(){return new e(this)},e.fromData=function(t,n){return new e(t,(function(){return n}),null,null,n)},e}()},"./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js":(e,t,n)=>{"use strict";n.d(t,{l:()=>f});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),i=n("./node_modules/@uirouter/core/lib-esm/resolve/interface.js"),d=n("./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"),u=n("./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"),m=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),l=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),_=i.u.when,c=[_.EAGER,_.LAZY],h=[_.EAGER],f=function(){function e(e){this._path=e}return e.prototype.getTokens=function(){return this._path.reduce((function(e,t){return e.concat(t.resolvables.map((function(e){return e.token})))}),[]).reduce(o.v_,[])},e.prototype.getResolvable=function(e){var t=this._path.map((function(e){return e.resolvables})).reduce(o.M7,[]).filter((function(t){return t.token===e}));return(0,o.Gb)(t)},e.prototype.getPolicy=function(e){var t=this.findNode(e);return e.getPolicy(t.state)},e.prototype.subContext=function(t){return new e(u.C.subPath(this._path,(function(e){return e.state===t})))},e.prototype.addResolvables=function(e,t){var n=(0,o.sE)(this._path,(0,r.OH)("state",t)),s=e.map((function(e){return e.token}));n.resolvables=n.resolvables.filter((function(e){return-1===s.indexOf(e.token)})).concat(e)},e.prototype.resolvePath=function(e,t){var n=this;void 0===e&&(e="LAZY");var d=((0,o.d3)(c,e)?e:"LAZY")===i.u.when.EAGER?h:c;s.g4.traceResolvePath(this._path,e,t);var u=function(e,t){return function(r){return(0,o.d3)(e,n.getPolicy(r)[t])}},m=this._path.reduce((function(e,o){var s=o.resolvables.filter(u(d,"when")),a=s.filter(u(["NOWAIT"],"async")),i=s.filter((0,r.ff)(u(["NOWAIT"],"async"))),m=n.subContext(o.state),l=function(e){return e.get(m,t).then((function(t){return{token:e.token,value:t}}))};return a.forEach(l),e.concat(i.map(l))}),[]);return a.u.$q.all(m)},e.prototype.injector=function(){return this._injector||(this._injector=new p(this))},e.prototype.findNode=function(e){return(0,o.sE)(this._path,(function(t){return(0,o.d3)(t.resolvables,e)}))},e.prototype.getDependencies=function(e){var t=this,n=this.findNode(e),r=(u.C.subPath(this._path,(function(e){return e===n}))||this._path).reduce((function(e,t){return e.concat(t.resolvables)}),[]).filter((function(t){return t!==e}));return e.deps.map((function(e){var n=r.filter((function(t){return t.token===e}));if(n.length)return(0,o.Gb)(n);var s=t.injector().getNative(e);if((0,l.wV)(s))throw new Error("Could not find Dependency Injection token: "+(0,m.Pz)(e));return new d.X(e,(function(){return s}),[],s)}))},e}(),p=function(){function e(e){this.context=e,this.native=this.get("Native Injector")||a.u.$injector}return e.prototype.get=function(e){var t=this.context.getResolvable(e);if(t){if("NOWAIT"===this.context.getPolicy(t).async)return t.get(this.context);if(!t.resolved)throw new Error("Resolvable async .get() not complete:"+(0,m.Pz)(t.token));return t.data}return this.getNative(e)},e.prototype.getAsync=function(e){var t=this.context.getResolvable(e);return t?t.get(this.context):a.u.$q.when(this.native.get(e))},e.prototype.getNative=function(e){return this.native&&this.native.get(e)},e}()},"./node_modules/@uirouter/core/lib-esm/router.js":(e,t,n)=>{"use strict";n.d(t,{a:()=>y});var o=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlRouter.js"),s=n("./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"),a=n("./node_modules/@uirouter/core/lib-esm/view/view.js"),i=n("./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js"),d=n("./node_modules/@uirouter/core/lib-esm/state/stateService.js"),u=n("./node_modules/@uirouter/core/lib-esm/globals.js"),m=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),l=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),_=n("./node_modules/@uirouter/core/lib-esm/url/urlService.js"),c=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),h=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),f=0,p=(0,h.HV)("LocationServices",["url","path","search","hash","onChange"]),M=(0,h.HV)("LocationConfig",["port","protocol","host","baseHref","html5Mode","hashPrefix"]),y=function(){function e(e,t){void 0===e&&(e=p),void 0===t&&(t=M),this.locationService=e,this.locationConfig=t,this.$id=f++,this._disposed=!1,this._disposables=[],this.trace=c.g4,this.viewService=new a.s(this),this.globals=new u.k,this.transitionService=new s.Z(this),this.urlMatcherFactory=new o.y(this),this.urlRouter=new r.g(this),this.urlService=new _.i(this),this.stateRegistry=new i.q(this),this.stateService=new d.b(this),this._plugins={},this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()),this.globals.$current=this.stateRegistry.root(),this.globals.current=this.globals.$current.self,this.disposable(this.globals),this.disposable(this.stateService),this.disposable(this.stateRegistry),this.disposable(this.transitionService),this.disposable(this.urlService),this.disposable(e),this.disposable(t)}return e.prototype.disposable=function(e){this._disposables.push(e)},e.prototype.dispose=function(e){var t=this;e&&(0,l.mf)(e.dispose)?e.dispose(this):(this._disposed=!0,this._disposables.slice().forEach((function(e){try{"function"==typeof e.dispose&&e.dispose(t),(0,m.nA)(t._disposables,e)}catch(e){}})))},e.prototype.plugin=function(e,t){void 0===t&&(t={});var n=new e(this,t);if(!n.name)throw new Error("Required property `name` missing on plugin: "+n);return this._disposables.push(n),this._plugins[n.name]=n},e.prototype.getPlugin=function(e){return e?this._plugins[e]:(0,m.VO)(this._plugins)},e}()},"./node_modules/@uirouter/core/lib-esm/state/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js":(e,t,n)=>{"use strict";n.d(t,{t:()=>M});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),i=n("./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"),d=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js");function u(e){return e.name}function m(e){return e.self.$$state=function(){return e},e.self}function l(e){return e.parent&&e.parent.data&&(e.data=e.self.data=(0,o.ED)(e.parent.data,e.data)),e.data}var _=function(e,t){return function(n){var s=n.self;if(s&&s.url&&s.name&&s.name.match(/\.\*\*$/)){var a={};(0,o.JG)(s,a),a.url+="{remainder:any}",s=a}var i=n.parent,d=function(e){if(!(0,r.HD)(e))return!1;var t="^"===e.charAt(0);return{val:t?e.substring(1):e,root:t}}(s.url),u=d?e.compile(d.val,{state:s}):s.url;if(!u)return null;if(!e.isMatcher(u))throw new Error("Invalid url '"+u+"' in state '"+n+"'");return d&&d.root?u:(i&&i.navigable||t()).url.append(u)}},c=function(e){return function(t){return!e(t)&&t.url?t:t.parent?t.parent.navigable:null}};function h(e){return e.parent?e.parent.path.concat(e):[e]}function f(e){var t=e.parent?(0,o.l7)({},e.parent.includes):{};return t[e.name]=!0,t}function p(e){var t,n,u=function(e){return e.provide||e.token},m=(0,a.uj)([[(0,a.vg)("resolveFn"),function(e){return new i.X(u(e),e.resolveFn,e.deps,e.policy)}],[(0,a.vg)("useFactory"),function(e){return new i.X(u(e),e.useFactory,e.deps||e.dependencies,e.policy)}],[(0,a.vg)("useClass"),function(e){return new i.X(u(e),(function(){return new e.useClass}),[],e.policy)}],[(0,a.vg)("useValue"),function(e){return new i.X(u(e),(function(){return e.useValue}),[],e.policy,e.useValue)}],[(0,a.vg)("useExisting"),function(e){return new i.X(u(e),o.yR,[e.useExisting],e.policy)}]]),l=(0,a.uj)([[(0,a.zG)((0,a.vg)("val"),r.HD),function(e){return new i.X(e.token,o.yR,[e.val],e.policy)}],[(0,a.zG)((0,a.vg)("val"),r.kJ),function(e){return new i.X(e.token,(0,o.Gb)(e.val),e.val.slice(0,-1),e.policy)}],[(0,a.zG)((0,a.vg)("val"),r.mf),function(e){return new i.X(e.token,e.val,(t=e.val,n=d.u.$injector,t.$inject||n&&n.annotate(t,n.strictDi)||"deferred"),e.policy);var t,n}]]),_=(0,a.uj)([[(0,a.is)(i.X),function(e){return e}],[function(e){return!(!e.token||!e.resolveFn)},m],[function(e){return!(!e.provide&&!e.token||!(e.useValue||e.useFactory||e.useExisting||e.useClass))},m],[function(e){return!!(e&&e.val&&((0,r.HD)(e.val)||(0,r.kJ)(e.val)||(0,r.mf)(e.val)))},l],[(0,a.P0)(!0),function(e){throw new Error("Invalid resolve value: "+(0,s.Pz)(e))}]]),c=e.resolve;return((0,r.kJ)(c)?c:(t=c,n=e.resolvePolicy||{},Object.keys(t||{}).map((function(e){return{token:e,val:t[e],deps:void 0,policy:n[e]}})))).map(_)}var M=function(){function e(e,t){this.matcher=e;var n,r=this,s=function(){return e.find("")},i=function(e){return""===e.name};this.builders={name:[u],self:[m],parent:[function(t){return i(t)?null:e.find(r.parentName(t))||s()}],data:[l],url:[_(t,s)],navigable:[c(i)],params:[(n=t.paramFactory,function(e){var t=e.url&&e.url.parameters({inherit:!1})||[],r=(0,o.VO)((0,o.js)((0,o.CE)(e.params||{},t.map((0,a.vg)("id"))),(function(t,o){return n.fromConfig(o,null,e.self)})));return t.concat(r).map((function(e){return[e.id,e]})).reduce(o.bb,{})})],views:[],path:[h],includes:[f],resolvables:[p]}}return e.prototype.builder=function(e,t){var n=this.builders,o=n[e]||[];return(0,r.HD)(e)&&!(0,r.$K)(t)?o.length>1?o:o[0]:(0,r.HD)(e)&&(0,r.mf)(t)?(n[e]=o,n[e].push(t),function(){return n[e].splice(n[e].indexOf(t,1))&&null}):void 0},e.prototype.build=function(e){var t=this.matcher,n=this.builders,r=this.parentName(e);if(r&&!t.find(r,void 0,!1))return null;for(var s in n)if(n.hasOwnProperty(s)){var a=n[s].reduce((function(e,t){return function(n){return t(n,e)}}),o.ZT);e[s]=a(e)}return e},e.prototype.parentName=function(e){var t=e.name||"",n=t.split(".");if("**"===n.pop()&&n.pop(),n.length){if(e.parent)throw new Error("States that specify the 'parent:' property should not have a '.' in their name ("+t+")");return n.join(".")}return e.parent?(0,r.HD)(e.parent)?e.parent:e.parent.name:""},e.prototype.name=function(e){var t=e.name;if(-1!==t.indexOf(".")||!e.parent)return t;var n=(0,r.HD)(e.parent)?e.parent:e.parent.name;return n?n+"."+t:t},e}()},"./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js":(e,t,n)=>{"use strict";n.d(t,{Q:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/safeConsole.js"),a=function(){function e(e){this._states=e}return e.prototype.isRelative=function(e){return 0===(e=e||"").indexOf(".")||0===e.indexOf("^")},e.prototype.find=function(e,t,n){if(void 0===n&&(n=!0),e||""===e){var a=(0,o.HD)(e),i=a?e:e.name;this.isRelative(i)&&(i=this.resolvePath(i,t));var d=this._states[i];if(d&&(a||!(a||d!==e&&d.self!==e)))return d;if(a&&n){var u=(0,r.VO)(this._states).filter((function(e){return e.__stateObjectCache.nameGlob&&e.__stateObjectCache.nameGlob.matches(i)}));return u.length>1&&s.L.error("stateMatcher.find: Found multiple matches for "+i+" using glob: ",u.map((function(e){return e.name}))),u[0]}}},e.prototype.resolvePath=function(e,t){if(!t)throw new Error("No reference point given for path '"+e+"'");for(var n=this.find(t),o=e.split("."),r=o.length,s=0,a=n;s{"use strict";n.d(t,{l:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/glob.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),i=function(){function e(t){return e.create(t||{})}return e.create=function(t){t=e.isStateClass(t)?new t:t;var n=(0,o.ED)((0,o.ED)(t,e.prototype));return t.$$state=function(){return n},n.self=t,n.__stateObjectCache={nameGlob:s.r.fromString(n.name)},n},e.prototype.is=function(e){return this===e||this.self===e||this.fqn()===e},e.prototype.fqn=function(){if(!(this.parent&&this.parent instanceof this.constructor))return this.name;var e=this.parent.fqn();return e?e+"."+this.name:this.name},e.prototype.root=function(){return this.parent&&this.parent.root()||this},e.prototype.parameters=function(e){return((e=(0,o.ce)(e,{inherit:!0,matchingKeys:null})).inherit&&this.parent&&this.parent.parameters()||[]).concat((0,o.VO)(this.params)).filter((function(t){return!e.matchingKeys||e.matchingKeys.hasOwnProperty(t.id)}))},e.prototype.parameter=function(e,t){return void 0===t&&(t={}),this.url&&this.url.parameter(e,t)||(0,o.sE)((0,o.VO)(this.params),(0,r.OH)("id",e))||t.inherit&&this.parent&&this.parent.parameter(e)},e.prototype.toString=function(){return this.fqn()},e.isStateClass=function(e){return(0,a.mf)(e)&&!0===e.__uiRouterState},e.isStateDeclaration=function(e){return(0,a.mf)(e.$$state)},e.isState=function(e){return(0,a.Kn)(e.__stateObjectCache)},e}()},"./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js":(e,t,n)=>{"use strict";n.d(t,{L:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/state/stateObject.js"),s=function(){function e(e,t,n,o){this.router=e,this.states=t,this.builder=n,this.listeners=o,this.queue=[]}return e.prototype.dispose=function(){this.queue=[]},e.prototype.register=function(e){var t=this.queue,n=r.l.create(e),s=n.name;if(!(0,o.HD)(s))throw new Error("State must have a valid name");if(this.states.hasOwnProperty(s)||(0,o.d3)(t.map((0,o.vg)("name")),s))throw new Error("State '"+s+"' is already defined");return t.push(n),this.flush(),n},e.prototype.flush=function(){for(var e=this,t=this,n=t.queue,o=t.states,r=t.builder,s=[],a=[],i={},d=function(t){return e.states.hasOwnProperty(t)&&e.states[t]},u=function(){s.length&&e.listeners.forEach((function(e){return e("registered",s.map((function(e){return e.self})))}))};n.length>0;){var m=n.shift(),l=m.name,_=r.build(m),c=a.indexOf(m);if(_){var h=d(l);if(h&&h.name===l)throw new Error("State '"+l+"' is already defined");var f=d(l+".**");f&&this.router.stateRegistry.deregister(f),o[l]=m,this.attachRoute(m),c>=0&&a.splice(c,1),s.push(m)}else{var p=i[l];if(i[l]=n.length,c>=0&&p===n.length)return n.push(m),u(),o;c<0&&a.push(m),n.push(m)}}return u(),o},e.prototype.attachRoute=function(e){if(!e.abstract&&e.url){var t=this.router.urlService.rules;t.rule(t.urlRuleFactory.create(e))}},e}()},"./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js":(e,t,n)=>{"use strict";n.d(t,{q:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js"),r=n("./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js"),s=n("./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),d=function(){function e(e){this.router=e,this.states={},this.listeners=[],this.matcher=new o.Q(this.states),this.builder=new r.t(this.matcher,e.urlMatcherFactory),this.stateQueue=new s.L(e,this.states,this.builder,this.listeners),this._registerRoot()}return e.prototype._registerRoot=function(){(this._root=this.stateQueue.register({name:"",url:"^",views:null,params:{"#":{value:null,type:"hash",dynamic:!0}},abstract:!0})).navigable=null},e.prototype.dispose=function(){var e=this;this.stateQueue.dispose(),this.listeners=[],this.get().forEach((function(t){return e.get(t)&&e.deregister(t)}))},e.prototype.onStatesChanged=function(e){return this.listeners.push(e),function(){(0,a.nA)(this.listeners)(e)}.bind(this)},e.prototype.root=function(){return this._root},e.prototype.register=function(e){return this.stateQueue.register(e)},e.prototype._deregisterTree=function(e){var t=this,n=this.get().map((function(e){return e.$$state()})),o=function(e){var t=n.filter((function(t){return-1!==e.indexOf(t.parent)}));return 0===t.length?t:t.concat(o(t))},r=o([e]),s=[e].concat(r).reverse();return s.forEach((function(e){var n=t.router.urlService.rules;n.rules().filter((0,i.OH)("state",e)).forEach((function(e){return n.removeRule(e)})),delete t.states[e.name]})),s},e.prototype.deregister=function(e){var t=this.get(e);if(!t)throw new Error("Can't deregister state; not found: "+e);var n=this._deregisterTree(t.$$state());return this.listeners.forEach((function(e){return e("deregistered",n.map((function(e){return e.self})))})),n},e.prototype.get=function(e,t){var n=this;if(0===arguments.length)return Object.keys(this.states).map((function(e){return n.states[e].self}));var o=this.matcher.find(e,t);return o&&o.self||null},e.prototype.decorator=function(e,t){return this.builder.builder(e,t)},e}()},"./node_modules/@uirouter/core/lib-esm/state/targetState.js":(e,t,n)=>{"use strict";n.d(t,{F:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),a=function(){function e(e,t,n,o){this._stateRegistry=e,this._identifier=t,this._identifier=t,this._params=(0,s.l7)({},n||{}),this._options=(0,s.l7)({},o||{}),this._definition=e.matcher.find(t,this._options.relative)}return e.prototype.name=function(){return this._definition&&this._definition.name||this._identifier},e.prototype.identifier=function(){return this._identifier},e.prototype.params=function(){return this._params},e.prototype.$state=function(){return this._definition},e.prototype.state=function(){return this._definition&&this._definition.self},e.prototype.options=function(){return this._options},e.prototype.exists=function(){return!(!this._definition||!this._definition.self)},e.prototype.valid=function(){return!this.error()},e.prototype.error=function(){var e=this.options().relative;if(!this._definition&&e){var t=e.name?e.name:e;return"Could not resolve '"+this.name()+"' from state '"+t+"'"}return this._definition?this._definition.self?void 0:"State '"+this.name()+"' has an invalid definition":"No such state '"+this.name()+"'"},e.prototype.toString=function(){return"'"+this.name()+"'"+(0,r.Pz)(this.params())},e.prototype.withState=function(t){return new e(this._stateRegistry,t,this._params,this._options)},e.prototype.withParams=function(t,n){void 0===n&&(n=!1);var o=n?t:(0,s.l7)({},this._params,t);return new e(this._stateRegistry,this._identifier,o,this._options)},e.prototype.withOptions=function(t,n){void 0===n&&(n=!1);var o=n?t:(0,s.l7)({},this._options,t);return new e(this._stateRegistry,this._identifier,this._params,o)},e.isDef=function(e){return e&&e.state&&((0,o.HD)(e.state)||(0,o.Kn)(e.state)&&(0,o.HD)(e.state.name))},e}()},"./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js":(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js"),a=n("./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"),i=function(){function e(e){this.transition=e}return e.prototype.buildHooksForPhase=function(e){var t=this;return this.transition.router.transitionService._pluginapi._getEvents(e).map((function(e){return t.buildHooks(e)})).reduce(o.M7,[]).filter(o.yR)},e.prototype.buildHooks=function(e){var t=this.transition,n=t.treeChanges(),r=this.getMatchingHooks(e,n,t);if(!r)return[];var i,d={transition:t,current:t.options().current};return r.map((function(r){return r.matches(n,t)[e.criteriaMatchPath.name].map((function(n){var i=(0,o.l7)({bind:r.bind,traceData:{hookType:e.name,context:n}},d),u=e.criteriaMatchPath.scope===s.c.STATE?n.state.self:null,m=new a.I(t,u,r,i);return{hook:r,node:n,transitionHook:m}}))})).reduce(o.M7,[]).sort((i=e.reverseSort,void 0===i&&(i=!1),function(e,t){var n=i?-1:1,o=(e.node.state.path.length-t.node.state.path.length)*n;return 0!==o?o:t.hook.priority-e.hook.priority})).map((function(e){return e.transitionHook}))},e.prototype.getMatchingHooks=function(e,t,n){var a=e.hookPhase===s.k.CREATE,i=this.transition.router.transitionService;return(a?[i]:[this.transition,i]).map((function(t){return t.getHooks(e.name)})).filter((0,o.sp)(r.kJ,"broken event named: "+e.name)).reduce(o.M7,[]).filter((function(e){return e.matches(t,n)}))},e}()},"./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js":(e,t,n)=>{"use strict";n.d(t,{cN:()=>s,BU:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js");function s(e,t,n){var r=(0,o.HD)(t)?[t]:t;return!!((0,o.mf)(r)?r:function(e){for(var t=r,n=0;n{"use strict";var o,r;n.d(t,{k:()=>o,c:()=>r}),function(e){e[e.CREATE=0]="CREATE",e[e.BEFORE=1]="BEFORE",e[e.RUN=2]="RUN",e[e.SUCCESS=3]="SUCCESS",e[e.ERROR=4]="ERROR"}(o||(o={})),function(e){e[e.TRANSITION=0]="TRANSITION",e[e.STATE=1]="STATE"}(r||(r={}))},"./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js":(e,t,n)=>{"use strict";n.d(t,{K:()=>o,i:()=>d});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js");!function(e){e[e.SUPERSEDED=2]="SUPERSEDED",e[e.ABORTED=3]="ABORTED",e[e.INVALID=4]="INVALID",e[e.IGNORED=5]="IGNORED",e[e.ERROR=6]="ERROR"}(o||(o={}));var i=0,d=function(){function e(e,t,n){this.$id=i++,this.type=e,this.message=t,this.detail=n}return e.isRejectionPromise=function(t){return t&&"function"==typeof t.then&&(0,a.is)(e)(t._transitionRejection)},e.superseded=function(t,n){var r=new e(o.SUPERSEDED,"The transition has been superseded by a different transition",t);return n&&n.redirected&&(r.redirected=!0),r},e.redirected=function(t){return e.superseded(t,{redirected:!0})},e.invalid=function(t){return new e(o.INVALID,"This transition is invalid",t)},e.ignored=function(t){return new e(o.IGNORED,"The transition was ignored",t)},e.aborted=function(t){return new e(o.ABORTED,"The transition has been aborted",t)},e.errored=function(t){return new e(o.ERROR,"The transition errored",t)},e.normalize=function(t){return(0,a.is)(e)(t)?t:e.errored(t)},e.prototype.toString=function(){var e,t=(e=this.detail)&&e.toString!==Object.prototype.toString?e.toString():(0,s.Pz)(e),n=this;return"Transition Rejection($id: "+n.$id+" type: "+n.type+", message: "+n.message+", detail: "+t+")"},e.prototype.toPromise=function(){return(0,r.l7)((0,r.jv)(this),{_transitionRejection:this})},e}()},"./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js":(e,t,n)=>{"use strict";n.d(t,{t:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"),r=function(e,t,n,r,s,a,i,d){void 0===s&&(s=!1),void 0===a&&(a=o.I.HANDLE_RESULT),void 0===i&&(i=o.I.REJECT_ERROR),void 0===d&&(d=!1),this.name=e,this.hookPhase=t,this.hookOrder=n,this.criteriaMatchPath=r,this.reverseSort=s,this.getResultHandler=a,this.getErrorHandler=i,this.synchronous=d}},"./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js":(e,t,n)=>{"use strict";n.d(t,{I:()=>c});var o=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),d=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),u=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),m=n("./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"),l=n("./node_modules/@uirouter/core/lib-esm/state/targetState.js"),_={current:r.ZT,transition:null,traceData:{},bind:null},c=function(){function e(e,t,n,s){var a=this;this.transition=e,this.stateContext=t,this.registeredHook=n,this.options=s,this.isSuperseded=function(){return a.type.hookPhase===o.k.RUN&&!a.options.transition.isActive()},this.options=(0,r.ce)(s,_),this.type=n.eventType}return e.chain=function(e,t){return e.reduce((function(e,t){return e.then((function(){return t.invokeHook()}))}),t||u.u.$q.when())},e.invokeHooks=function(t,n){for(var o=0;o=t.invokeLimit&&t.deregister()}}},e.prototype.handleHookResult=function(e){var t=this;return this.getNotCurrentRejection()||((0,a.tI)(e)?e.then((function(e){return t.handleHookResult(e)})):(d.g4.traceHookResult(e,this.transition,this.options),!1===e?m.i.aborted("Hook aborted transition").toPromise():(0,i.is)(l.F)(e)?m.i.redirected(e).toPromise():void 0))},e.prototype.getNotCurrentRejection=function(){var e=this.transition.router;return e._disposed?m.i.aborted("UIRouter instance #"+e.$id+" has been stopped (disposed)").toPromise():this.transition._aborted?m.i.aborted().toPromise():this.isSuperseded()?m.i.superseded(this.options.current()).toPromise():void 0},e.prototype.toString=function(){var e=this.options,t=this.registeredHook,n=(0,i.Qc)("traceData.hookType")(e)||"internal",o=(0,i.Qc)("traceData.context.state.name")(e)||(0,i.Qc)("traceData.context")(e)||"unknown",r=(0,s.iC)(t.callback);return n+" context: "+o+", "+(0,s.BS)(200,r)},e.HANDLE_RESULT=function(e){return function(t){return e.handleHookResult(t)}},e.LOG_REJECTED_RESULT=function(e){return function(t){(0,a.tI)(t)&&t.catch((function(t){return e.logError(m.i.normalize(t))}))}},e.LOG_ERROR=function(e){return function(t){return e.logError(t)}},e.REJECT_ERROR=function(e){return function(e){return(0,r.jv)(e)}},e.THROW_ERROR=function(e){return function(e){throw e}},e}()},"./node_modules/@uirouter/core/lib-esm/transition/transitionService.js":(e,t,n)=>{"use strict";n.d(t,{Z:()=>C,q:()=>W});var o=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js"),r=n("./node_modules/@uirouter/core/lib-esm/transition/transition.js"),s=n("./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"),a=n("./node_modules/@uirouter/core/lib-esm/router.js"),i=n("./node_modules/@uirouter/core/lib-esm/resolve/index.js"),d=n("./node_modules/@uirouter/core/lib-esm/common/index.js");function u(e){e.addResolvable(i.XU.fromData(a.a,e.router),""),e.addResolvable(i.XU.fromData(r.u,e),""),e.addResolvable(i.XU.fromData("$transition$",e),""),e.addResolvable(i.XU.fromData("$stateParams",e.params()),""),e.entering().forEach((function(t){e.addResolvable(i.XU.fromData("$state$",t),t)}))}var m=["$transition$",r.u],l=(0,d.d3)(m),_=function(e){var t=(0,d.VO)(e.treeChanges()).reduce(d.M7,[]).reduce(d.v_,[]),n=function(e){return l(e.token)?i.XU.fromData(e.token,null):e};t.forEach((function(e){e.resolvables=e.resolvables.map(n)}))},c=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),h=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),f=n("./node_modules/@uirouter/core/lib-esm/state/targetState.js"),p=function(e){var t=e.to().redirectTo;if(t){var n=e.router.stateService;return(0,c.mf)(t)?h.u.$q.when(t(e)).then(o):o(t)}function o(t){if(t)return t instanceof f.F?t:(0,c.HD)(t)?n.target(t,e.params(),e.options()):t.state||t.params?n.target(t.state||e.to(),t.params||e.params(),e.options()):void 0}};function M(e){return function(t,n){return(0,n.$$state()[e])(t,n)}}var y=M("onExit"),L=M("onRetain"),Y=M("onEnter"),g=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),v=n("./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"),k=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),j=1e3,w=function(e){return new v.l(e.treeChanges().to).resolvePath("EAGER",e).then(g.ZT)},b=function(e,t){return new v.l(e.treeChanges().to).subContext(t.$$state()).resolvePath("LAZY",e).then(g.ZT)},D=function(e){return new v.l(e.treeChanges().to).resolvePath("LAZY",e).then(g.ZT)},T=function(e){var t=h.u.$q,n=e.views("entering");if(n.length)return t.all(n.map((function(e){return t.when(e.load())}))).then(g.ZT)},S=function(e){var t=e.views("entering"),n=e.views("exiting");if(t.length||n.length){var o=e.router.viewService;n.forEach((function(e){return o.deactivateViewConfig(e)})),t.forEach((function(e){return o.activateViewConfig(e)})),o.sync()}},H=function(e){var t=e.router.globals,n=function(){t.transition===e&&(t.transition=null)};e.onSuccess({},(function(){t.successfulTransitions.enqueue(e),t.$current=e.$to(),t.current=t.$current.self,(0,g.JG)(e.params(),t.params)}),{priority:1e4}),e.promise.then(n,n)},x=function(e){var t=e.options(),n=e.router.stateService,o=e.router.urlRouter;if("url"!==t.source&&t.location&&n.$current.navigable){var r={replace:"replace"===t.location};o.push(n.$current.navigable.url,n.params,r)}o.update(!0)},E=n("./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js"),P=n("./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js"),O=n("./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"),$=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),A=n("./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js");function F(e){var t=e._ignoredReason();if(t){$.g4.traceTransitionIgnored(e);var n=e.router.globals.transition;return"SameAsCurrent"===t&&n&&n.abort(),A.i.ignored().toPromise()}}function R(e){if(!e.valid())throw new Error(e.error().toString())}var W={location:!0,relative:null,inherit:!1,notify:!0,reload:!1,supercede:!0,custom:{},current:function(){return null},source:"unknown"},C=function(){function e(e){this._transitionCount=0,this._eventTypes=[],this._registeredHooks={},this._criteriaPaths={},this._router=e,this.$view=e.viewService,this._deregisterHookFns={},this._pluginapi=(0,g.WR)((0,k.P0)(this),{},(0,k.P0)(this),["_definePathType","_defineEvent","_getPathTypes","_getEvents","getHooks"]),this._defineCorePaths(),this._defineCoreEvents(),this._registerCoreTransitionHooks(),e.globals.successfulTransitions.onEvict(_)}return e.prototype.onCreate=function(e,t,n){},e.prototype.onBefore=function(e,t,n){},e.prototype.onStart=function(e,t,n){},e.prototype.onExit=function(e,t,n){},e.prototype.onRetain=function(e,t,n){},e.prototype.onEnter=function(e,t,n){},e.prototype.onFinish=function(e,t,n){},e.prototype.onSuccess=function(e,t,n){},e.prototype.onError=function(e,t,n){},e.prototype.dispose=function(e){(0,g.VO)(this._registeredHooks).forEach((function(e){return e.forEach((function(t){t._deregistered=!0,(0,g.nA)(e,t)}))}))},e.prototype.create=function(e,t){return new r.u(e,t,this._router)},e.prototype._defineCoreEvents=function(){var e=o.k,t=O.I,n=this._criteriaPaths,r=!1,s=!0;this._defineEvent("onCreate",e.CREATE,0,n.to,r,t.LOG_REJECTED_RESULT,t.THROW_ERROR,s),this._defineEvent("onBefore",e.BEFORE,0,n.to),this._defineEvent("onStart",e.RUN,0,n.to),this._defineEvent("onExit",e.RUN,100,n.exiting,!0),this._defineEvent("onRetain",e.RUN,200,n.retained),this._defineEvent("onEnter",e.RUN,300,n.entering),this._defineEvent("onFinish",e.RUN,400,n.to),this._defineEvent("onSuccess",e.SUCCESS,0,n.to,r,t.LOG_REJECTED_RESULT,t.LOG_ERROR,s),this._defineEvent("onError",e.ERROR,0,n.to,r,t.LOG_REJECTED_RESULT,t.LOG_ERROR,s)},e.prototype._defineCorePaths=function(){var e=o.c.STATE,t=o.c.TRANSITION;this._definePathType("to",t),this._definePathType("from",t),this._definePathType("exiting",e),this._definePathType("retained",e),this._definePathType("entering",e)},e.prototype._defineEvent=function(e,t,n,o,r,a,i,d){void 0===r&&(r=!1),void 0===a&&(a=O.I.HANDLE_RESULT),void 0===i&&(i=O.I.REJECT_ERROR),void 0===d&&(d=!1);var u=new P.t(e,t,n,o,r,a,i,d);this._eventTypes.push(u),(0,s.BU)(this,this,u)},e.prototype._getEvents=function(e){return((0,c.$K)(e)?this._eventTypes.filter((function(t){return t.hookPhase===e})):this._eventTypes.slice()).sort((function(e,t){var n=e.hookPhase-t.hookPhase;return 0===n?e.hookOrder-t.hookOrder:n}))},e.prototype._definePathType=function(e,t){this._criteriaPaths[e]={name:e,scope:t}},e.prototype._getPathTypes=function(){return this._criteriaPaths},e.prototype.getHooks=function(e){return this._registeredHooks[e]},e.prototype._registerCoreTransitionHooks=function(){var e=this._deregisterHookFns;e.addCoreResolves=this.onCreate({},u),e.ignored=this.onBefore({},F,{priority:-9999}),e.invalid=function(e){return e.onBefore({},R,{priority:-1e4})}(this),e.redirectTo=function(e){return e.onStart({to:function(e){return!!e.redirectTo}},p)}(this),e.onExit=function(e){return e.onExit({exiting:function(e){return!!e.onExit}},y)}(this),e.onRetain=function(e){return e.onRetain({retained:function(e){return!!e.onRetain}},L)}(this),e.onEnter=function(e){return e.onEnter({entering:function(e){return!!e.onEnter}},Y)}(this),e.eagerResolve=function(e){return e.onStart({},w,{priority:j})}(this),e.lazyResolve=function(e){return e.onEnter({entering:(0,k.P0)(!0)},b,{priority:j})}(this),e.resolveAll=function(e){return e.onFinish({},D,{priority:j})}(this),e.loadViews=function(e){return e.onFinish({},T)}(this),e.activateViews=function(e){return e.onSuccess({},S)}(this),e.updateGlobals=function(e){return e.onCreate({},H)}(this),e.updateUrl=function(e){return e.onSuccess({},x,{priority:9999})}(this),e.lazyLoad=(0,E.v)(this)},e}()},"./node_modules/@uirouter/core/lib-esm/url/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/url/urlConfig.js":(e,t,n)=>{"use strict";n.d(t,{F:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/params/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),s=function(){function e(e){var t=this;this.router=e,this.paramTypes=new o.ParamTypes,this._decodeParams=!0,this._isCaseInsensitive=!1,this._isStrictMode=!0,this._defaultSquashPolicy=!1,this.dispose=function(){return t.paramTypes.dispose()},this.baseHref=function(){return t.router.locationConfig.baseHref()},this.hashPrefix=function(e){return t.router.locationConfig.hashPrefix(e)},this.host=function(){return t.router.locationConfig.host()},this.html5Mode=function(){return t.router.locationConfig.html5Mode()},this.port=function(){return t.router.locationConfig.port()},this.protocol=function(){return t.router.locationConfig.protocol()}}return e.prototype.caseInsensitive=function(e){return this._isCaseInsensitive=(0,r.$K)(e)?e:this._isCaseInsensitive},e.prototype.defaultSquashPolicy=function(e){if((0,r.$K)(e)&&!0!==e&&!1!==e&&!(0,r.HD)(e))throw new Error("Invalid squash policy: "+e+". Valid policies: false, true, arbitrary-string");return this._defaultSquashPolicy=(0,r.$K)(e)?e:this._defaultSquashPolicy},e.prototype.strictMode=function(e){return this._isStrictMode=(0,r.$K)(e)?e:this._isStrictMode},e.prototype.type=function(e,t,n){var o=this.paramTypes.type(e,t,n);return(0,r.$K)(t)?this:o},e}()},"./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js":(e,t,n)=>{"use strict";n.d(t,{y:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"),s=n("./node_modules/@uirouter/core/lib-esm/params/index.js"),a=function(){return(a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n{"use strict";n.d(t,{g:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlRule.js"),s=function(){function e(e){var t=this;this.router=e,this.sync=function(e){return t.router.urlService.sync(e)},this.listen=function(e){return t.router.urlService.listen(e)},this.deferIntercept=function(e){return t.router.urlService.deferIntercept(e)},this.match=function(e){return t.router.urlService.match(e)},this.initial=function(e){return t.router.urlService.rules.initial(e)},this.otherwise=function(e){return t.router.urlService.rules.otherwise(e)},this.removeRule=function(e){return t.router.urlService.rules.removeRule(e)},this.rule=function(e){return t.router.urlService.rules.rule(e)},this.rules=function(){return t.router.urlService.rules.rules()},this.sort=function(e){return t.router.urlService.rules.sort(e)},this.when=function(e,n,o){return t.router.urlService.rules.when(e,n,o)},this.urlRuleFactory=new r.I(e)}return e.prototype.update=function(e){var t=this.router.locationService;e?this.location=t.url():t.url()!==this.location&&t.url(this.location,!0)},e.prototype.push=function(e,t,n){var o=n&&!!n.replace;this.router.urlService.url(e.format(t||{}),o)},e.prototype.href=function(e,t,n){var r=e.format(t);if(null==r)return null;n=n||{absolute:!1};var s=this.router.urlService.config,a=s.html5Mode();if(a||null===r||(r="#"+s.hashPrefix()+r),r=function(e,t,n,r){return"/"===r?e:t?(0,o.Lb)(r)+e:n?r.slice(1)+e:e}(r,a,n.absolute,s.baseHref()),!n.absolute||!r)return r;var i=!a&&r?"/":"",d=s.port(),u=80===d||443===d?"":":"+d;return[s.protocol(),"://",s.host(),u,i,r].join("")},Object.defineProperty(e.prototype,"interceptDeferred",{get:function(){return this.router.urlService.interceptDeferred},enumerable:!1,configurable:!0}),e}()},"./node_modules/@uirouter/core/lib-esm/url/urlRule.js":(e,t,n)=>{"use strict";n.d(t,{I:()=>d,n:()=>u});var o=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),i=n("./node_modules/@uirouter/core/lib-esm/state/stateObject.js"),d=function(){function e(e){this.router=e}return e.prototype.compile=function(e){return this.router.urlMatcherFactory.compile(e)},e.prototype.create=function(e,t){var n=this,s=i.l.isState,d=i.l.isStateDeclaration,m=(0,a.uj)([[r.HD,function(e){return m(n.compile(e))}],[(0,a.is)(o.x),function(e){return n.fromUrlMatcher(e,t)}],[(0,a.or)(s,d),function(e){return n.fromState(e,n.router)}],[(0,a.is)(RegExp),function(e){return n.fromRegExp(e,t)}],[r.mf,function(e){return new u(e,t)}]]),l=m(e);if(!l)throw new Error("invalid 'what' in when()");return l},e.prototype.fromUrlMatcher=function(e,t){var n=t;(0,r.HD)(t)&&(t=this.router.urlMatcherFactory.compile(t)),(0,a.is)(o.x)(t)&&(n=function(e){return t.format(e)});var i={urlMatcher:e,matchPriority:function(t){var n=e.parameters().filter((function(e){return e.isOptional}));return n.length?n.filter((function(e){return t[e.id]})).length/n.length:1e-6},type:"URLMATCHER"};return(0,s.l7)(new u((function(t){var n=e.exec(t.path,t.search,t.hash);return e.validates(n)&&n}),n),i)},e.prototype.fromState=function(e,t){var n=i.l.isStateDeclaration(e)?e.$$state():e,o={state:n,type:"STATE"};return(0,s.l7)(this.fromUrlMatcher(n.url,(function(e){var o=t.stateService,r=t.globals;o.href(n,e)!==o.href(r.current,r.params)&&o.transitionTo(n,e,{inherit:!0,source:"url"})})),o)},e.prototype.fromRegExp=function(e,t){if(e.global||e.sticky)throw new Error("Rule RegExp must not be global or sticky");var n=(0,r.HD)(t)?function(e){return t.replace(/\$(\$|\d{1,2})/,(function(t,n){return e["$"===n?0:Number(n)]}))}:t,o={regexp:e,type:"REGEXP"};return(0,s.l7)(new u((function(t){return e.exec(t.path)}),n),o)},e.isUrlRule=function(e){return e&&["type","match","handler"].every((function(t){return(0,r.$K)(e[t])}))},e}(),u=function(e,t){var n=this;this.match=e,this.type="RAW",this.matchPriority=function(e){return 0-n.$id},this.handler=t||s.yR}},"./node_modules/@uirouter/core/lib-esm/url/urlRules.js":(e,t,n)=>{"use strict";n.d(t,{h:()=>u});var o,r=n("./node_modules/@uirouter/core/lib-esm/state/index.js"),s=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),i=n("./node_modules/@uirouter/core/lib-esm/url/urlRule.js");function d(e){if(!((0,a.mf)(e)||(0,a.HD)(e)||(0,a.is)(r.TargetState)(e)||r.TargetState.isDef(e)))throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property");return(0,a.mf)(e)?e:(0,a.P0)(e)}o=function(e,t){var n=function(e,t){return(t.priority||0)-(e.priority||0)}(e,t);return 0!==n||0!==(n=function(e,t){var n={STATE:4,URLMATCHER:4,REGEXP:3,RAW:2,OTHER:1};return(n[e.type]||0)-(n[t.type]||0)}(e,t))||0!==(n=function(e,t){return e.urlMatcher&&t.urlMatcher?s.x.compare(e.urlMatcher,t.urlMatcher):0}(e,t))?n:function(e,t){var n={STATE:!0,URLMATCHER:!0};return n[e.type]&&n[t.type]?0:(e.$id||0)-(t.$id||0)}(e,t)};var u=function(){function e(e){this.router=e,this._sortFn=o,this._rules=[],this._id=0,this.urlRuleFactory=new i.I(e)}return e.prototype.dispose=function(e){this._rules=[],delete this._otherwiseFn},e.prototype.initial=function(e){var t=d(e);this.rule(this.urlRuleFactory.create((function(e,t){return 0===t.globals.transitionHistory.size()&&!!/^\/?$/.exec(e.path)}),t))},e.prototype.otherwise=function(e){var t=d(e);this._otherwiseFn=this.urlRuleFactory.create((0,a.P0)(!0),t),this._sorted=!1},e.prototype.removeRule=function(e){(0,a.nA)(this._rules,e)},e.prototype.rule=function(e){var t=this;if(!i.I.isUrlRule(e))throw new Error("invalid rule");return e.$id=this._id++,e.priority=e.priority||0,this._rules.push(e),this._sorted=!1,function(){return t.removeRule(e)}},e.prototype.rules=function(){return this.ensureSorted(),this._rules.concat(this._otherwiseFn?[this._otherwiseFn]:[])},e.prototype.sort=function(e){for(var t=this.stableSort(this._rules,this._sortFn=e||this._sortFn),n=0,o=0;o{"use strict";n.d(t,{i:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlRules.js"),s=n("./node_modules/@uirouter/core/lib-esm/url/urlConfig.js"),a=n("./node_modules/@uirouter/core/lib-esm/state/index.js"),i=function(){function e(e){var t=this;this.router=e,this.interceptDeferred=!1,this.rules=new r.h(this.router),this.config=new s.F(this.router),this.url=function(e,n,o){return t.router.locationService.url(e,n,o)},this.path=function(){return t.router.locationService.path()},this.search=function(){return t.router.locationService.search()},this.hash=function(){return t.router.locationService.hash()},this.onChange=function(e){return t.router.locationService.onChange(e)}}return e.prototype.dispose=function(){this.listen(!1),this.rules.dispose()},e.prototype.parts=function(){return{path:this.path(),search:this.search(),hash:this.hash()}},e.prototype.sync=function(e){if(!e||!e.defaultPrevented){var t=this.router,n=t.urlService,r=t.stateService,s={path:n.path(),search:n.search(),hash:n.hash()},i=this.match(s);(0,o.uj)([[o.HD,function(e){return n.url(e,!0)}],[a.TargetState.isDef,function(e){return r.go(e.state,e.params,e.options)}],[(0,o.is)(a.TargetState),function(e){return r.go(e.state(),e.params(),e.options())}]])(i&&i.rule.handler(i.match,s,this.router))}},e.prototype.listen=function(e){var t=this;if(!1!==e)return this._stopListeningFn=this._stopListeningFn||this.router.urlService.onChange((function(e){return t.sync(e)}));this._stopListeningFn&&this._stopListeningFn(),delete this._stopListeningFn},e.prototype.deferIntercept=function(e){void 0===e&&(e=!0),this.interceptDeferred=e},e.prototype.match=function(e){e=(0,o.l7)({path:"",search:{},hash:""},e);for(var t,n,r,s=this.rules.rules(),a=0;at.weight?i:t}return t},e}()},"./node_modules/@uirouter/core/lib-esm/vanilla.js":(e,t,n)=>{"use strict";n("./node_modules/@uirouter/core/lib-esm/vanilla/index.js")},"./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js":(e,t,n)=>{"use strict";n.d(t,{U:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"),s=function(){function e(e,t){var n=this;this.fireAfterUpdate=t,this._listeners=[],this._listener=function(e){return n._listeners.forEach((function(t){return t(e)}))},this.hash=function(){return(0,r.en)(n._get()).hash},this.path=function(){return(0,r.en)(n._get()).path},this.search=function(){return(0,r.Qf)((0,r.en)(n._get()).search)},this._location=o.Jz.location,this._history=o.Jz.history}return e.prototype.url=function(e,t){return void 0===t&&(t=!0),(0,o.$K)(e)&&e!==this._get()&&(this._set(null,null,e,t),this.fireAfterUpdate&&this._listeners.forEach((function(t){return t({url:e})}))),(0,r.Q2)(this)},e.prototype.onChange=function(e){var t=this;return this._listeners.push(e),function(){return(0,o.nA)(t._listeners,e)}},e.prototype.dispose=function(e){(0,o.Wk)(this._listeners)},e}()},"./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js":(e,t,n)=>{"use strict";n.d(t,{u:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=function(){function e(e,t){void 0===t&&(t=!1),this._isHtml5=t,this._baseHref=void 0,this._hashPrefix=""}return e.prototype.port=function(){return location.port?Number(location.port):"https"===this.protocol()?443:80},e.prototype.protocol=function(){return location.protocol.replace(/:/g,"")},e.prototype.host=function(){return location.hostname},e.prototype.html5Mode=function(){return this._isHtml5},e.prototype.hashPrefix=function(e){return(0,o.$K)(e)?this._hashPrefix=e:this._hashPrefix},e.prototype.baseHref=function(e){return(0,o.$K)(e)&&(this._baseHref=e),(0,o.o8)(this._baseHref)&&(this._baseHref=this.getBaseHref()),this._baseHref},e.prototype.getBaseHref=function(){var e=document.getElementsByTagName("base")[0];return e&&e.href?e.href.replace(/^([^/:]*:)?\/\/[^/]*/,""):this._isHtml5?"/":location.pathname||"/"},e.prototype.dispose=function(){},e}()},"./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js":(e,t,n)=>{"use strict";n.d(t,{R:()=>i});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),s=n("./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"),a=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(t){var n=e.call(this,t,!1)||this;return r.Jz.addEventListener("hashchange",n._listener,!1),n}return a(t,e),t.prototype._get=function(){return(0,r.Ld)(this._location.hash)},t.prototype._set=function(e,t,n,o){this._location.hash=n},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t),r.Jz.removeEventListener("hashchange",this._listener)},t}(s.U)},"./node_modules/@uirouter/core/lib-esm/vanilla/injector.js":(e,t,n)=>{"use strict";n("./node_modules/@uirouter/core/lib-esm/common/index.js")},"./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js":(e,t,n)=>{"use strict";n.d(t,{W:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=function(){var e=this;this.dispose=r.ZT,this._baseHref="",this._port=80,this._protocol="http",this._host="localhost",this._hashPrefix="",this.port=function(){return e._port},this.protocol=function(){return e._protocol},this.host=function(){return e._host},this.baseHref=function(){return e._baseHref},this.html5Mode=function(){return!1},this.hashPrefix=function(t){return(0,o.$K)(t)?e._hashPrefix=t:e._hashPrefix}}},"./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js":(e,t,n)=>{"use strict";n.d(t,{I:()=>a});var o,r=n("./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"),s=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=function(e){function t(t){return e.call(this,t,!0)||this}return s(t,e),t.prototype._get=function(){return this._url},t.prototype._set=function(e,t,n,o){this._url=n},t}(r.U)},"./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js":(e,t,n)=>{"use strict";var o=n("./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js"),r=n("./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js"),s=n("./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"),a=n("./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js"),i=n("./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js"),d=n("./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js");n("./node_modules/@uirouter/core/lib-esm/vanilla/injector.js"),n("./node_modules/@uirouter/core/lib-esm/vanilla/q.js"),n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),(0,s._D)("vanilla.hashBangLocation",!1,r.R,o.u),(0,s._D)("vanilla.pushStateLocation",!0,a.h,o.u),(0,s._D)("vanilla.memoryLocation",!1,i.I,d.W)},"./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js":(e,t,n)=>{"use strict";n.d(t,{h:()=>i});var o,r=n("./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),a=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(t){var n=e.call(this,t,!0)||this;return n._config=t.urlService.config,s.Jz.addEventListener("popstate",n._listener,!1),n}return a(t,e),t.prototype._getBasePrefix=function(){return(0,s.Lb)(this._config.baseHref())},t.prototype._get=function(){var e=this._location,t=e.pathname,n=e.hash,o=e.search;o=(0,s.C7)(o)[1],n=(0,s.cW)(n)[1];var r=this._getBasePrefix(),a=t===this._config.baseHref(),i=t.substr(0,r.length)===r;return(t=a?"/":i?t.substring(r.length):t)+(o?"?"+o:"")+(n?"#"+n:"")},t.prototype._set=function(e,t,n,o){var r=this._getBasePrefix(),s=n&&"/"!==n[0]?"/":"",a=""===n||"/"===n?this._config.baseHref():r+s+n;o?this._history.replaceState(e,t,a):this._history.pushState(e,t,a)},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t),s.Jz.removeEventListener("popstate",this._listener)},t}(r.U)},"./node_modules/@uirouter/core/lib-esm/vanilla/q.js":(e,t,n)=>{"use strict";n("./node_modules/@uirouter/core/lib-esm/common/index.js")},"./node_modules/@uirouter/core/lib-esm/vanilla/utils.js":(e,t,n)=>{"use strict";n.d(t,{Qf:()=>s,en:()=>a,Q2:()=>i,_D:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=function(e,t){var n=t[0],r=t[1];return e.hasOwnProperty(n)?(0,o.kJ)(e[n])?e[n].push(r):e[n]=[e[n],r]:e[n]=r,e},s=function(e){return e.split("&").filter(o.yR).map(o.Fb).reduce(r,{})};function a(e){var t=function(e){return e||""},n=(0,o.cW)(e).map(t),r=n[0],s=n[1],a=(0,o.C7)(r).map(t);return{path:a[0],search:a[1],hash:s,url:e}}var i=function(e){var t=e.path(),n=e.search(),r=e.hash(),s=Object.keys(n).map((function(e){var t=n[e];return((0,o.kJ)(t)?t:[t]).map((function(t){return e+"="+t}))})).reduce(o.M7,[]).join("&");return t+(s?"?"+s:"")+(r?"#"+r:"")};function d(e,t,n,o){return function(r){var s=r.locationService=new n(r),a=r.locationConfig=new o(r,t);return{name:e,service:s,configuration:a,dispose:function(e){e.dispose(s),e.dispose(a)}}}}},"./node_modules/@uirouter/core/lib-esm/view/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/view/view.js":(e,t,n)=>{"use strict";n.d(t,{s:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),i=function(){function e(e){var t=this;this.router=e,this._uiViews=[],this._viewConfigs=[],this._viewConfigFactories={},this._listeners=[],this._pluginapi={_rootViewContext:this._rootViewContext.bind(this),_viewConfigFactory:this._viewConfigFactory.bind(this),_registeredUIView:function(e){return(0,o.sE)(t._uiViews,(function(n){return t.router.$id+"."+n.id===e}))},_registeredUIViews:function(){return t._uiViews},_activeViewConfigs:function(){return t._viewConfigs},_onSync:function(e){return t._listeners.push(e),function(){return(0,o.nA)(t._listeners,e)}}}}return e.normalizeUIViewTarget=function(e,t){void 0===t&&(t="");var n=t.split("@"),o=n[0]||"$default",r=(0,s.HD)(n[1])?n[1]:"^",a=/^(\^(?:\.\^)*)\.(.*$)/.exec(o);if(a&&(r=a[1],o=a[2]),"!"===o.charAt(0)&&(o=o.substr(1),r=""),/^(\^(?:\.\^)*)$/.exec(r)){var i=r.split(".").reduce((function(e,t){return e.parent}),e);r=i.name}else"."===r&&(r=e.name);return{uiViewName:o,uiViewContextAnchor:r}},e.prototype._rootViewContext=function(e){return this._rootContext=e||this._rootContext},e.prototype._viewConfigFactory=function(e,t){this._viewConfigFactories[e]=t},e.prototype.createViewConfig=function(e,t){var n=this._viewConfigFactories[t.$type];if(!n)throw new Error("ViewService: No view config factory registered for type "+t.$type);var o=n(e,t);return(0,s.kJ)(o)?o:[o]},e.prototype.deactivateViewConfig=function(e){a.g4.traceViewServiceEvent("<- Removing",e),(0,o.nA)(this._viewConfigs,e)},e.prototype.activateViewConfig=function(e){a.g4.traceViewServiceEvent("-> Registering",e),this._viewConfigs.push(e)},e.prototype.sync=function(){var t=this,n=this._uiViews.map((function(e){return[e.fqn,e]})).reduce(o.bb,{});function s(e){for(var t=e.viewDecl.$context,n=0;++n&&t.parent;)t=t.parent;return n}var i=(0,r.WA)((function(e,t,n,o){return t*(e(n)-e(o))})),d=this._uiViews.sort(i((function(e){var t=function(e){return e&&e.parent?t(e.parent)+1:1};return 1e4*e.fqn.split(".").length+t(e.creationContext)}),1)).map((function(o){var r=t._viewConfigs.filter(e.matches(n,o));return r.length>1&&r.sort(i(s,-1)),{uiView:o,viewConfig:r[0]}})),u=d.map((function(e){return e.viewConfig})),m=this._viewConfigs.filter((function(e){return!(0,o.d3)(u,e)})).map((function(e){return{uiView:void 0,viewConfig:e}}));d.forEach((function(e){-1!==t._uiViews.indexOf(e.uiView)&&e.uiView.configUpdated(e.viewConfig)}));var l=d.concat(m);this._listeners.forEach((function(e){return e(l)})),a.g4.traceViewSync(l)},e.prototype.registerUIView=function(e){a.g4.traceViewServiceUIViewEvent("-> Registering",e);var t=this._uiViews;return t.filter((function(t){return t.fqn===e.fqn&&t.$type===e.$type})).length&&a.g4.traceViewServiceUIViewEvent("!!!! duplicate uiView named:",e),t.push(e),this.sync(),function(){-1!==t.indexOf(e)?(a.g4.traceViewServiceUIViewEvent("<- Deregistering",e),(0,o.nA)(t)(e)):a.g4.traceViewServiceUIViewEvent("Tried removing non-registered uiView",e)}},e.prototype.available=function(){return this._uiViews.map((0,r.vg)("fqn"))},e.prototype.active=function(){return this._uiViews.filter((0,r.vg)("$config")).map((0,r.vg)("name"))},e.matches=function(e,t){return function(n){if(t.$type!==n.viewDecl.$type)return!1;var r=n.viewDecl,s=r.$uiViewName.split("."),a=t.fqn.split(".");if(!(0,o.fS)(s,a.slice(0-s.length)))return!1;var i=1-s.length||void 0,d=a.slice(0,i).join("."),u=e[d].creationContext;return r.$uiViewContextAnchor===(u&&u.name)}},e}()},"./node_modules/angular-aria/angular-aria.js":()=>{!function(e,t){"use strict";var n="ngAriaDisable",o=t.module("ngAria",["ng"]).info({angularVersion:"1.8.2"}).provider("$aria",(function(){var e={ariaHidden:!0,ariaChecked:!0,ariaReadonly:!0,ariaDisabled:!0,ariaRequired:!0,ariaInvalid:!0,ariaValue:!0,tabindex:!0,bindKeydown:!0,bindRoleForClick:!0};function o(t,o,r,a){return function(i,d,u){if(!u.hasOwnProperty(n)){var m=u.$normalize(o);!e[m]||s(d,r)||u[m]||i.$watch(u[t],(function(e){e=a?!e:!!e,d.attr(o,e)}))}}}this.config=function(n){e=t.extend(e,n)},this.$get=function(){return{config:function(t){return e[t]},$$watchExpr:o}}})),r=["BUTTON","A","INPUT","TEXTAREA","SELECT","DETAILS","SUMMARY"],s=function(e,t){if(-1!==t.indexOf(e[0].nodeName))return!0};o.directive("ngShow",["$aria",function(e){return e.$$watchExpr("ngShow","aria-hidden",[],!0)}]).directive("ngHide",["$aria",function(e){return e.$$watchExpr("ngHide","aria-hidden",[],!1)}]).directive("ngValue",["$aria",function(e){return e.$$watchExpr("ngValue","aria-checked",r,!1)}]).directive("ngChecked",["$aria",function(e){return e.$$watchExpr("ngChecked","aria-checked",r,!1)}]).directive("ngReadonly",["$aria",function(e){return e.$$watchExpr("ngReadonly","aria-readonly",r,!1)}]).directive("ngRequired",["$aria",function(e){return e.$$watchExpr("ngRequired","aria-required",r,!1)}]).directive("ngModel",["$aria",function(e){function t(t,n,o,a){return e.config(n)&&!o.attr(t)&&(a||!s(o,r))&&("hidden"!==o.attr("type")||"INPUT"!==o[0].nodeName)}function o(e,t){return!t.attr("role")&&t.attr("type")===e&&!s(t,r)}return{restrict:"A",require:"ngModel",priority:200,compile:function(r,s){if(!s.hasOwnProperty(n)){var a=function(e,t){var n=e.type,o=e.role;return"checkbox"===(n||o)||"menuitemcheckbox"===o?"checkbox":"radio"===(n||o)||"menuitemradio"===o?"radio":"range"===n||"progressbar"===o||"slider"===o?"range":""}(s);return{post:function(n,r,s,i){var d=t("tabindex","tabindex",r,!1);function u(){return i.$modelValue}switch(a){case"radio":case"checkbox":o(a,r)&&r.attr("role",a),t("aria-checked","ariaChecked",r,!1)&&n.$watch(u,"radio"===a?function(e){var t=s.value==i.$viewValue;r.attr("aria-checked",t)}:function(){r.attr("aria-checked",!i.$isEmpty(i.$viewValue))}),d&&r.attr("tabindex",0);break;case"range":if(o(a,r)&&r.attr("role","slider"),e.config("ariaValue")){var m=!r.attr("aria-valuemin")&&(s.hasOwnProperty("min")||s.hasOwnProperty("ngMin")),l=!r.attr("aria-valuemax")&&(s.hasOwnProperty("max")||s.hasOwnProperty("ngMax")),_=!r.attr("aria-valuenow");m&&s.$observe("min",(function(e){r.attr("aria-valuemin",e)})),l&&s.$observe("max",(function(e){r.attr("aria-valuemax",e)})),_&&n.$watch(u,(function(e){r.attr("aria-valuenow",e)}))}d&&r.attr("tabindex",0)}!s.hasOwnProperty("ngRequired")&&i.$validators.required&&t("aria-required","ariaRequired",r,!1)&&s.$observe("required",(function(){r.attr("aria-required",!!s.required)})),t("aria-invalid","ariaInvalid",r,!0)&&n.$watch((function(){return i.$invalid}),(function(e){r.attr("aria-invalid",!!e)}))}}}}}}]).directive("ngDisabled",["$aria",function(e){return e.$$watchExpr("ngDisabled","aria-disabled",r,!1)}]).directive("ngMessages",(function(){return{restrict:"A",require:"?ngMessages",link:function(e,t,o,r){o.hasOwnProperty(n)||t.attr("aria-live")||t.attr("aria-live","assertive")}}})).directive("ngClick",["$aria","$parse",function(e,t){return{restrict:"A",compile:function(o,a){if(!a.hasOwnProperty(n)){var i=t(a.ngClick);return function(t,n,o){s(n,r)||(e.config("bindRoleForClick")&&!n.attr("role")&&n.attr("role","button"),e.config("tabindex")&&!n.attr("tabindex")&&n.attr("tabindex",0),!e.config("bindKeydown")||o.ngKeydown||o.ngKeypress||o.ngKeyup||n.on("keydown",(function(e){var n=e.which||e.keyCode;13!==n&&32!==n||(-1!==r.indexOf(e.target.nodeName)||e.target.isContentEditable||e.preventDefault(),t.$apply((function(){i(t,{$event:e})})))})))}}}}}]).directive("ngDblclick",["$aria",function(e){return function(t,o,a){a.hasOwnProperty(n)||!e.config("tabindex")||o.attr("tabindex")||s(o,r)||o.attr("tabindex",0)}}])}(window,window.angular)},"./node_modules/angular-rateit/dist/ng-rateit.js":()=>{angular.module("ngRateIt",["ng"]).directive("ngRateIt",["$q",function(e){"use strict";return{scope:{ngModel:"=",min:"=?min",max:"=?max",step:"=?step",readOnly:"&?readOnly",pristine:"=?pristine",resetable:"&?resetable",starWidth:"=?starWidth",starHeight:"=?starHeight",canelWidth:"=?canelWidth",cancelHeight:"=?cancelHeight",rated:"&?rated",reset:"&?reset",beforeRated:"&?beforeRated",beforeReset:"&?beforeReset"},templateUrl:"ngRateIt/ng-rate-it.html",require:"ngModel",replace:!0,link:function(t,n,o){o.readOnly||(t.readOnly=function(){return!1}),o.resetable||(t.resetable=function(){return!0}),o.beforeRated||(t.beforeRated=function(){var t=e.defer();return t.resolve(),t.promise}),o.rated||(t.rated=function(){}),o.beforeReset||(t.beforeReset=function(){var t=e.defer();return t.resolve(),t.promise}),o.reset||(t.reset=function(){})},controller:"ngRateItController"}}]).controller("ngRateItController",["$scope","$timeout",function(e,t){"use strict";e.isTouch=!!window.hasOwnProperty("ontouchstart")||window.navigator.msMaxTouchPoints>0,e.orgValue=angular.copy(e.ngModel),e.min=e.min||0,e.max=e.max||5,e.step=e.step||.5,e.pristine=e.orgValue===e.ngModel,e.starWidth=e.starWidth||16,e.starPartWidth=e.starWidth*e.step,e.starHeight=e.starHeight||16,e.canelWidth=e.canelWidth||e.starWidth,e.cancelHeight=e.cancelHeight||e.starHeight;var n=e.max-e.min,o=n/e.step,r=e.$watch("ngModel",(function(){e.pristine=e.orgValue===e.ngModel})),s=function(e){return(e+1)/o*n};e.getStartParts=function(){return new Array(o)},e.getStarOffset=function(t){var n=1/e.step;return-e.starWidth/n*(t%n)},e.isSelected=function(t){return s(t)<=e.ngModel-e.min},e.removeRating=function(){e.resetable()&&!e.readOnly()&&e.beforeReset({rating:e.ngModel}).then((function(){e.ngModel=e.min,e.reset({rating:e.ngModel})}))},e.setValue=function(n){if(!e.readOnly()){var o=angular.copy(e.min+s(n));e.beforeRated({rating:o}).then((function(){e.ngModel=o,t((function(){e.rated({rating:e.ngModel})}))}))}},e.$on("$destroy",(function(){r()}))}]).run(["$templateCache",function(e){"use strict";e.put("ngRateIt/ng-rate-it.html",'
')}])},"./src/js/index.module.js":(e,t,n)=>{"use strict";n("./node_modules/angular-animate/index.js"),n("./node_modules/angular-aria/index.js"),n("./node_modules/angular-messages/index.js"),n("./node_modules/angular-material/index.js"),n("./node_modules/angular-resource/index.js"),n("./node_modules/angular-sanitize/index.js"),n("./node_modules/ng-csv/build/ng-csv.min.js"),n("./node_modules/ng-embed/src/ng-embed.js"),n("./node_modules/@uirouter/angularjs/lib-esm/index.js"),n("./node_modules/angular-local-storage/index.js"),n("./node_modules/angular-rateit/dist/ng-rateit.js"),n("./node_modules/@flowjs/ng-flow/dist/ng-flow.js"),n("./node_modules/emojionearea/dist/emojionearea.js"),n("./node_modules/jquery-textcomplete/dist/jquery.textcomplete.js");var o=n("./node_modules/moment/moment.js"),r=n.n(o),s=n("./node_modules/lodash.map/index.js"),a=n.n(s);function i(e,t,n,o,s,i,d,u,m){const l=this;function _(t,n,o){const r=i.get(t)||{};o?delete r[e.location]:r[e.location]=n,i.set(t,r)}function c(n){var o;e.layout.up=n,_(u,e.layout),o=n?"show":"hide",t.parent.postMessage({cmd:o},"*"),e.$$phase||e.$apply()}e.location=e.settings.location,l.$onInit=function(){e.status="init";const o=e.settings.color,r=e.settings.textColor,s=e.settings.textButtonColor||e.settings.textColor,a=e.settings.color_button,d=e.settings.backgroundColor,l=Math.max(document.documentElement.clientHeight,window.innerHeight||0),_=document.documentElement.clientWidth;document.documentElement.style.setProperty("--xc-ws-div-color",o),document.documentElement.style.setProperty("--xc-ws-text-color",r),document.documentElement.style.setProperty("--xc-ws-text-button-color",s),document.documentElement.style.setProperty("--xc-ws-button-color",a),document.documentElement.style.setProperty("--xc-ws-background-color",d),document.documentElement.style.setProperty("--xc-ws-client-height",l),document.documentElement.style.setProperty("--xc-ws-client-width",_);let h=!1;const f=i.get(m)||{},p=i.get(u)||{};e.visitor=f[e.location]?f[e.location]:{},e.layout=p[e.location]?p[e.location]:{},e.visitor.interaction&&e.layout.up?h=!0:e.layout.up=!0,"bottom_right"===e.settings.alignment&&c(h),n.go(function(){const t=e.settings.online,n=!!(e.visitor&&e.visitor.interaction&&e.visitor.interaction.id),o=Number(e.settings.maxInteractions)&&Number(e.settings.openedInteractions)>=Number(e.settings.maxInteractions);return!!(n||!o&&t)}()?"app.online":"app.offline",null,{location:"replace"});let M="";M=e.settings.online||!e.settings.hideWhenOffline?"init":"offline",t.parent.postMessage({cmd:M,div_color:o,text_color:r,client_height:l,client_width:_},"*");const y=document.createElement("style");document.head.appendChild(y),y.sheet.insertRule(".mdi-send:before {color:"+e.settings.color+"!important}")},l.close=function(){const t=e.visitor.interaction;if(t&&t.id){const s=o.confirm().parent(angular.element(document.querySelector("#chat-app"))).clickOutsideToClose(!0).title(e.settings.closingQuestion||"Do you want to close the interaction?").ok("Ok").cancel("Cancel");o.show(s).then((function(){return d.chatInteraction.customUpdate({id:t.id,closed:!0,closeReason:"contact",closedAt:r()().format("YYYY-MM-DD HH:mm:ss")}).$promise})).then((function(){n.go("app.closing",null,{location:"replace"})})).catch((function(e){console.error("keep open",e)}))}},l.toggle=c,l.download=function(){const t=s.defer(),n=e.visitor.interaction;return n&&n.id&&d.chatInteraction.getMessages({intid:n.id,includeAll:!0}).$promise.then((function(n){t.resolve(a()(n.rows.slice(1),(function(t){let n;if("in"===t.direction&&(n=e.settings.customerAlias||e.visitor.from||"Visitor"+t.ContactId),"out"===t.direction)switch(e.settings.agentIdentifier){case"website_alias":n=t.UserId?e.settings.agentAlias+t.UserId:"System";break;case"agent_alias":n=t.UserId?t.User.alias||t.User.fullname:"System";break;case"agent_fullname":n=t.UserId?t.User.fullname:"System";break;default:n=t.UserId?e.settings.agentAlias+t.UserId:"System"}return{sender:n,message:t.body,createdAt:r()(t.createdAt).format("MM/DD/YYYY HH:mm:ss")}})))})).catch((function(e){console.error(e)})),t.promise},l.getHeaderShape=function(){return"rounded"===e.settings.header_shape?"15px":"0px"};const h={online:["online","chat","waiting","closing","unmanaged"],offline:["offline"]};Object.defineProperty(e,"actualTitle",{get(){let t=e.settings.defaultTitle;return h.online.includes(e.status)?t=e.settings.header_online:h.offline.includes(e.status)&&(t=e.settings.header_offline),t}}),e.updateStorage=_,window.addEventListener("message",(function(e){"show"===e.data.evt?c(!0):"hide"===e.data.evt&&c(!1)}),!1)}i.$inject=["$rootScope","$window","$state","$mdDialog","$q","localStorageService","api","STORAGE_LAYOUT","STORAGE_VISITOR"];var d=n("./node_modules/lodash.forin/index.js"),u=n.n(d),m=n("./node_modules/lodash.isnil/index.js"),l=n.n(m),_=n("./src/js/chat/index.tpl.html"),c=n("./src/js/closing/index.tpl.html"),h=n("./src/js/offline/index.tpl.html"),f=n("./src/js/online/index.tpl.html"),p=n("./src/js/unmanaged/index.tpl.html"),M=n("./src/js/waiting/index.tpl.html");function y(e,t){const n=t.search();e.settings={cursor:"pointer",hide:!0},u()(n,(function(t,n){""===t||l()(t)||("true"===t&&(t=!0),"false"===t&&(t=!1),e.settings[n]=t)}))}function L(e,t,n,o,r,s){n.html5Mode(!0),o.defaults.headers.get||(o.defaults.headers.get={}),o.defaults.headers.get["If-Modified-Since"]="Mon, 26 Jul 1997 05:00:00 GMT",o.defaults.headers.get["Cache-Control"]="no-cache",o.defaults.headers.get.Pragma="no-cache",r.setPrefix(s),e.state("app",{abstract:!0}).state("app.waiting",{url:"/waiting",templateUrl:M,controller:"WaitingController as vm"}).state("app.online",{url:"/online",templateUrl:f,controller:"OnlineController as vm"}).state("app.offline",{url:"/offline",templateUrl:h,controller:"OfflineController as vm"}).state("app.chat",{url:"/chat",templateUrl:_,controller:"ChatController as vm"}).state("app.unmanaged",{url:"/unmanaged",templateUrl:p,controller:"UnmanagedController as vm"}).state("app.closing",{url:"/closing",templateUrl:c,controller:"ClosingController as vm"})}L.$inject=["$stateProvider","$urlRouterProvider","$locationProvider","$httpProvider","localStorageServiceProvider","STORAGE_PREFIX"],y.$inject=["$rootScope","$location"];var Y=n("./node_modules/lodash.merge/index.js"),g=n.n(Y);function v(e,t,n,o,r,s){const a=this;function i(t){return function(o){a.errors[t]=o.data;const r=n.simple().textContent(e.settings.formSubmitFailureMessage||"Form submission error").toastClass("md-failure-toast").position("top");n.show(r)}}function d(){e.loading=!1}function u(){e.settings.online?t.go("app.online",null,{location:"replace"}):t.go("app.offline",null,{location:"replace"})}function m(){a.form={},a.upColor=null,a.downColor=null,a.userForm.$setPristine(),a.userForm.$setUntouched(),delete e.visitor.interaction,e.enableDownload=!1}a.$onInit=function(){e.status="closing",e.updateStorage(r,null,!0),e.updateStorage(s,null,!0),e.loading=!1},a.submit=function(){e.loading=!0,e.visitor.interaction&&e.visitor.interaction.id?o.chatInteraction.close(g()({id:e.visitor.interaction.id,ratingType:e.settings.ratingType,customer:e.settings.customerAlias||e.visitor.from},a.form)).$promise.then((function(){delete a.errors.submit;const t=n.simple().textContent(e.settings.formSubmitSuccessMessage||"Form properly submitted").toastClass("md-success-toast").parent(angular.element(document.querySelector("#chat-toolbar")));n.show(t)})).then(m).then(u).catch(i("submit")).finally(d):(d(),i("submit"))},a.skip=function(){m(),u()},a.form={},a.errors={}}function k(e,t){const n={id:"@id",token:e.settings.token},o={};return o.baseUrl=e.settings.remote+"/api/",o.chatWebsite=t(o.baseUrl+"chat/websites/:id",n,{notify:{method:"POST",url:o.baseUrl+"chat/websites/:id/notify"},offline:{method:"POST",url:o.baseUrl+"chat/websites/:id/offline"},getFields:{method:"GET",url:o.baseUrl+"chat/websites/:id/fields"}}),o.chatInteraction=t(o.baseUrl+"chat/interactions/:id",n,{update:{method:"PUT",url:o.baseUrl+"chat/interactions/:id"},customUpdate:{method:"PUT",url:o.baseUrl+"chat/interactions/:id/custom_update"},close:{method:"PUT",url:o.baseUrl+"chat/interactions/:id/close"},getMessages:{method:"GET",url:o.baseUrl+"chat/interactions/:intid/my_messages"},uploadAttachment:{method:"POST",url:o.baseUrl+"chat/interactions/:id/attachment_upload",headers:{"Content-Type":void 0},transformRequest:angular.identity},downloadAttachment:{method:"GET",url:o.baseUrl+"chat/interactions/:id/attachment_download"}}),o.chatMessage=t(o.baseUrl+"chat/messages/:id",n,{update:{method:"PUT",url:o.baseUrl+"chat/messages/:id"}}),o}v.$inject=["$rootScope","$state","$mdToast","api","STORAGE_VISITOR","STORAGE_LAYOUT"],k.$inject=["$rootScope","$resource"];var j=n("./node_modules/lodash.find/index.js"),w=n.n(j),b=n("./node_modules/lodash.values/index.js"),D=n.n(b),T=n("./node_modules/jquery/dist/jquery.js");function S(e,t,n,o,r,s,a,i,d,u){const m=this;let _,c,h,f;function p(){n((function(){const e=r[0].getElementsByClassName("chat-messages")[0];e&&(e.scrollTop=e.scrollHeight)}))}function M(e){return function(t){m.errors[e]=t.data,p()}}function y(e){i.chatWebsite.notify(e).$promise.then((function(e){delete m.errors.chatMessageError,l()(t.visitor.interaction)&&(t.visitor.interaction={id:e.interaction.id},t.updateStorage(d,t.visitor)),_[0].emojioneArea.setText(""),p()})).catch(M("chatMessageError"))}function L(){t.settings.online?s.go("app.online",null,{location:"replace"}):s.go("app.offline",null,{location:"replace"})}function Y(){t.visitor&&t.visitor.interaction&&t.visitor.interaction.id&&i.chatInteraction.get({id:t.visitor.interaction.id}).$promise.then((function(e){delete m.errors.getInteraction,e.closed&&(t.visitor.interaction.closed=!0,t.updateStorage(d,t.visitor),"unmanaged"===e.disposition?s.go("app.unmanaged",null,{location:"replace"}):s.go("app.closing",null,{location:"replace"}))})).catch((function(e){switch(e.status){case 403:s.go("app.closing",null,{location:"replace"});break;case 404:t.updateStorage(d,null,!0),t.updateStorage(u,null,!0),L();break;case 405:s.go("app.unmanaged",null,{location:"replace"});break;default:console.error(e)}}))}function v(e){const n=_[0].emojioneArea.getText();e&&13===e.keyCode&&e.shiftKey||e&&13!==e.keyCode||""!==n&&y(g()({body:n},t.visitor))}function k(){t.visitor&&t.visitor.interaction&&t.visitor.interaction.id&&i.chatInteraction.getMessages({intid:t.visitor.interaction.id,includeAgent:!0,id:f||void 0}).$promise.then((function(e){if(delete m.errors.interaction,e.count){let o=!1,r=0;for(r=0,o=!1;r'+e.name+"",AttachmentId:e.id},t.visitor))):M("sendAttachment")}),M("sendAttachment"))},e.$on("$destroy",(function(){o.cancel(c),o.cancel(h),c=null,h=null})),t.$on("$download",(function(e,n){n&&n(D()(t.messages))}))}S.$inject=["$scope","$rootScope","$timeout","$interval","$document","$state","$http","api","STORAGE_VISITOR","STORAGE_LAYOUT"];var H=n("./node_modules/lodash.random/index.js"),x=n.n(H),E=n("./node_modules/lodash.clonedeep/index.js"),P=n.n(E),O=n("./node_modules/json-form-data/src/jsonToFormData.js"),$=n.n(O);function A(e,t,n,o,r,s,a){const i=this;let d=null,u=null;t.typeField="";const m={showLeafArrayIndexes:!0,includeNullValues:!1,mapping:function(e){return"boolean"==typeof e?+e?"1":"0":e}};function _(){delete i.errors.submit,t.$emit("hide"),i.fields=P()(u),i.form={},i.userForm.$setPristine(),i.userForm.$setUntouched();const e=r.simple().textContent(t.settings.formSubmitSuccessMessage||"Form properly submitted").toastClass("md-success-toast").parent(angular.element(document.querySelector("#chat-toolbar")));r.show(e)}i.trustAsHtml=function(e){return n.trustAsHtml(e)},i.initUploadButton=function(t){const n=i.fields[t],o=s.find(".upload-item");if(o.length){const t=angular.element(o[0].querySelector(".upload-button")),r=angular.element(o[0].querySelector("input[type=file]")),s=t.find("label");s.length&&s.css("display","none"),t.on("click",(()=>{s.css("display","none"),"function"==typeof r.trigger?r.trigger("click"):r[0].click()})),r.on("change",(t=>{e.$apply((function(){"string"==typeof n.props.error&&(n.props.error=null);const e=Array.from(t.target.files),o=1048576*n.config.size;e.some((e=>e.size>=o))?(n.options=[],n.props.error=n.config.sizeErrMessage):n.options=e.map((e=>{const{name:t,size:n,type:o}=e;return{name:t,size:n,type:o,file:e}})),i.form[n.props.title]=n.options}))}))}},i.removeFileItem=function(e,t){e.options.splice(t,1),i.form[e.props.title]=e.options},i.setupFileInput=function(e){console.log("form item setup",e);const t=s.find(".upload-item"),n=angular.element(t[0].querySelector("input[type=file]")),{multipleUpload:o,accept:r}=e.config;o&&n.attr("multiple","multiple"),r&&n[0].setAttribute("accept",r)},i.makeFileOptionsVisible=function(){const e=Array.from(s.find(".filename-label")),t=e[e.length-1];t&&t.scrollIntoView&&t.scrollIntoView()},i.$onInit=function(){t.status="offline",i.visitor={id:t.settings.id,mapKeyOffline:"firstName",from:"Anonymous"+x()(1,1e6)},t.settings.showMenu=!1,t.loading=!1,o.chatWebsite.getFields({id:t.settings.id,online:!1}).$promise.then((function(e){e.count&&(d=e.fromKey,u=P()(e.rows),i.fields=P()(u))})).then((function(){for(let e=0;e]+)>)/i);i.checkHTML[e]=t(n.props.helpText)}}})).catch((function(e){console.error(e)}))},i.submit=function(){t.loading=!0;const e={...i.form};for(let n=0;ne.file))))}const n=Array.isArray(i.fields)?i.fields.filter((e=>"upload"===e.type)):[],s=g()({body:e},i.visitor),u=null!=e&&n.length>0,c=null!==e&&"{}"!==JSON.stringify(e);var h,f;(u?(h=s,a({url:`${o.baseUrl}chat/websites/${h.id}/offline`,headers:{"Content-Type":void 0},data:$()(h,{...m,initialFormData:new FormData}),method:"POST"})):c?o.chatWebsite.offline(s).$promise:Promise.reject("INVALID_FORM")).then(_).catch((f="submit",function(e){const n=r.simple().textContent(t.settings.formSubmitFailureMessage||"Form submission error").toastClass("md-failure-toast").parent(angular.element(document.querySelector("#chat-toolbar")));r.show(n),i.errors[f]=e.data})).finally((()=>{i.form.invalid||(i.form={}),t.loading=!1}))},i.toggle=function(e,t){i.form[e]||(i.form[e]=[]);const n=i.form[e].indexOf(t);n>-1?i.form[e].splice(n,1):i.form[e].push(t)},i.exists=function(e,t){return i.form[e]||(i.form[e]=[]),i.form[e].indexOf(t)>-1},i.checkHTML=[],i.form={},i.errors={},i.userForm={}}function F(e,t,n,o,s,a){const i=this;let d=null;function u(){return"Anonymous"+x()(1,1e6)}i.checkHTML=[],i.form={},i.errors={},i.userForm={},i.disableItem=!1,i.trustAsHtml=function(e){return n.trustAsHtml(e)},i.$onInit=function(){if(e.status="online",e.visitor&&e.visitor.interaction)if(e.visitor.interaction.id)if(e.visitor.interaction.UserId)t.go("app.chat",null,{location:"replace"});else{const t=e.visitor.interaction.id,n=JSON.stringify({channel:"chat",interaction:{id:t},message:{id:e.visitor.message.id},disposition:"abandoned",closed:!0,closeReason:"contact",closedAt:r()().format("YYYY-MM-DD HH:mm:ss")});o({url:`${e.settings.remote}/api/chat/interactions/${t}/abandon?token=${e.settings.token}`,headers:{"Content-Type":"application/json; charset=utf-8"},data:n,method:"PUT"}),e.visitor={id:e.settings.id,mapKey:"firstName",from:u()},e.settings.showMenu=!1,e.updateStorage(a,e.visitor),s.chatWebsite.getFields({id:e.settings.id,online:!0}).$promise.then((function(e){e.count&&(d=e.fromKey,i.fields=e.rows)})).then((function(){for(let e=0;e]+)>)/i);i.checkHTML[e]=n(t.props.helpText)}}})).catch((function(e){console.error(e)}))}else t.go("app.waiting",null,{location:"replace"});else e.visitor={id:e.settings.id,mapKey:"firstName",from:u()},e.settings.showMenu=!1,e.updateStorage(a,e.visitor),s.chatWebsite.getFields({id:e.settings.id,online:!0}).$promise.then((function(e){e.count&&(d=e.fromKey,i.fields=e.rows)})).then((function(){for(let e=0;e]+)>)/i);i.checkHTML[e]=n(t.props.helpText)}}})).catch((function(e){console.error(e)}))},i.submit=function(){let n="New chat request \n";for(let t=0;t-1?i.form[e].splice(n,1):i.form[e].push(t)},i.exists=function(e,t){return i.form[e]||(i.form[e]=[]),i.form[e].indexOf(t)>-1}}function R(e,t,n,o,r,s){const a=this;function i(){e.settings.online?t.go("app.online",null,{location:"replace"}):t.go("app.offline",null,{location:"replace"})}function d(){a.form={},a.upColor=null,a.downColor=null,a.userForm.$setPristine(),a.userForm.$setUntouched(),e.visitor={},e.enableDownload=!1,e.$emit("hide")}function u(t){return function(o){a.errors[t]=o.data;const r=n.simple().textContent(e.settings.formSubmitFailureMessage||"Form submission error").toastClass("md-failure-toast").parent(angular.element(document.querySelector("#chat-toolbar")));n.show(r)}}function m(){e.loading=!1}a.form={},a.errors={},a.$onInit=function(){e.status="unmanaged",e.updateStorage(r,null,!0),e.updateStorage(s,null,!0),e.loading=!1},a.submit=function(){e.loading=!0,e.visitor.interaction&&e.visitor.interaction.id?o.chatInteraction.customUpdate({id:e.visitor.interaction.id,note:a.form.note}).$promise.then((function(){delete a.errors.submit;const t=n.simple().textContent(e.settings.formSubmitSuccessMessage||"Form properly submitted").toastClass("md-success-toast").parent(angular.element(document.querySelector("#chat-toolbar")));n.show(t)})).then(d).then(i).catch(u("submit")).finally(m):(m(),u("submit"))},a.skip=function(){d(),i()}}function W(e,t,n,o,s,a,i,d){let u,m=!1;function l(){let t={},n=!1;a.chatInteraction.get({id:e.visitor.interaction.id}).$promise.then((function(n){return t=n,a.chatInteraction.getMessages({intid:e.visitor.interaction.id}).$promise})).then((function(r){n=r.rows.length>1,t.closed?(e.visitor.interaction.closed=!0,e.updateStorage(i,e.visitor),"unmanaged"===t.disposition&&o.go("app.unmanaged",null,{location:"replace"})):t.UserId?(e.visitor.interaction.UserId=t.UserId,e.updateStorage(i,e.visitor),o.go("app.chat",null,{location:"replace"})):n&&o.go("app.chat",null,{location:"replace"})})).catch((function(e){switch(e.status){case 403:o.go("app.closing",null,{location:"replace"});break;case 405:o.go("app.unmanaged",null,{location:"replace"});break;default:console.error(e)}}))}function _(){if(e.visitor&&e.visitor.interaction&&e.visitor.interaction.id&&!m){m=!0;const t=new XMLHttpRequest;t.open("PUT",e.settings.remote+"/api/chat/interactions/"+e.visitor.interaction.id+"/abandon?token="+e.settings.token,!1),t.setRequestHeader("Content-type","application/json; charset=utf-8"),t.send(JSON.stringify({channel:"chat",interaction:{id:e.visitor.interaction.id},message:{id:e.visitor.message.id},disposition:"abandoned",closed:!0,closeReason:"contact",closedAt:r()().format("YYYY-MM-DD HH:mm:ss")})),4===t.readyState&&200===t.status&&(e.updateStorage(i,null,!0),e.updateStorage(d,null,!0))}}this.$onInit=function(){e.status="waiting",e.visitor&&e.visitor.interaction&&e.visitor.interaction.id&&(u=n(l,3e3))},t.$on("$destroy",(function(){s.removeEventListener("beforeunload",_),s.removeEventListener("unload",_),n.cancel(u)})),s.addEventListener("beforeunload",_),s.addEventListener("unload",_)}function C(e){return function(t){return e.trustAsHtml(t)}}A.$inject=["$scope","$rootScope","$sce","api","$mdToast","$element","$http"],F.$inject=["$rootScope","$state","$sce","$http","api","STORAGE_VISITOR"],R.$inject=["$rootScope","$state","$mdToast","api","STORAGE_VISITOR","STORAGE_LAYOUT"],W.$inject=["$rootScope","$scope","$interval","$state","$window","api","STORAGE_VISITOR","STORAGE_LAYOUT"],C.$inject=["$sce"],angular.module("motion-chat",["ngAnimate","ngAria","ngMessages","ngMaterial","ngResource","ngSanitize","ngCsv","ngEmbed","ui.router","LocalStorageModule","ngRateIt","flow"]).filter("toTrusted",C).constant("STORAGE_PREFIX","motion_chat").constant("STORAGE_VISITOR","visitor").constant("STORAGE_LAYOUT","layout").directive("ngEnter",(function(){return function(e,t,n){t.bind("keydown keypress",(function(t){13===t.which&&(e.$apply((function(){e.$eval(n.ngEnter)})),t.preventDefault())}))}})).directive("ngPrint",(function(){return{link:function(e,t){t.on("click",(function(){document.getElementById("chatContent1")&&function(e,t){const n=document.createElement("div"),o=t.visitor,s=t.settings;let a;for(let e=0;e"+document.title+""),i.document.write(""),i.document.write("

Website: "+s.referer+"

"),i.document.write("

Start Time: "+r()(a).format("YYYY-MM-DD HH:mm:ss")+"

"),i.document.write("

Print Time: "+r()().format("YYYY-MM-DD HH:mm:ss")+"

"),i.document.write(n.innerHTML),i.document.write(""),i.document.close(),i.focus(),i.print(),i.close()}(0,e)}))},restrict:"A"}})).controller("ChatController",S).controller("ClosingController",v).config(["$mdGestureProvider",function(e){e.skipClickHijack()}]).controller("IndexController",i).factory("api",k).config(L).run(y).controller("OfflineController",A).config(["$mdGestureProvider",function(e){e.skipClickHijack()}]).controller("OnlineController",F).controller("UnmanagedController",R).controller("WaitingController",W)},"./node_modules/expose-loader/dist/runtime/getGlobalThis.js":(e,t,n)=>{"use strict";e.exports=function(){if("object"==typeof globalThis)return globalThis;var e;try{e=this||new Function("return this")()}catch(e){if("object"==typeof window)return window;if("object"==typeof self)return self;if(void 0!==n.g)return n.g}return e}()},"./node_modules/json-form-data/src/jsonToFormData.js":function(e,t){var n,o;(o=this)||(o={}),void 0===(n=function(){return o.jsonToFormData=function(){function e(e){return"[object Array]"==={}.toString.call(e)}function t(t){return!(e(t)||"object"!=typeof t||!t||t instanceof Blob||t instanceof Date)}function n(){return"function"==typeof FormData}function o(){if(n())return new FormData}function r(n,o,s,a){var i=0;for(var d in n){if(n.hasOwnProperty(d)){var u=a||d,m=o.mapping(n[d]);if(a&&t(n)&&(u=a+"["+d+"]"),a&&e(n)&&(u=e(m)||o.showLeafArrayIndexes?a+"["+i+"]":a+"[]"),e(m)||t(m))r(m,o,s,u);else if(m instanceof FileList)for(var l=0;l=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-dz.js":function(e,t,n){!function(e){"use strict";var t=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},n={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},o=function(e){return function(o,r,s,a){var i=t(o),d=n[e][t(o)];return 2===i&&(d=d[r?0:1]),d.replace(/%d/i,o)}},r=["جانفي","فيفري","مارس","أفريل","ماي","جوان","جويلية","أوت","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar-dz",{months:r,monthsShort:r,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:o("s"),ss:o("s"),m:o("m"),mm:o("m"),h:o("h"),hh:o("h"),d:o("d"),dd:o("d"),M:o("M"),MM:o("M"),y:o("y"),yy:o("y")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:0,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-kw.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ar-kw",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:0,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-ly.js":function(e,t,n){!function(e){"use strict";var t={1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",0:"0"},n=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},o={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},r=function(e){return function(t,r,s,a){var i=n(t),d=o[e][n(t)];return 2===i&&(d=d[r?0:1]),d.replace(/%d/i,t)}},s=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar-ly",{months:s,monthsShort:s,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:r("s"),ss:r("s"),m:r("m"),mm:r("m"),h:r("h"),hh:r("h"),d:r("d"),dd:r("d"),M:r("M"),MM:r("M"),y:r("y"),yy:r("y")},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-ma.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-sa.js":function(e,t,n){!function(e){"use strict";var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"};e.defineLocale("ar-sa",{months:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},preparse:function(e){return e.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-tn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ar-tn",{months:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar.js":function(e,t,n){!function(e){"use strict";var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},o=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},r={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},s=function(e){return function(t,n,s,a){var i=o(t),d=r[e][o(t)];return 2===i&&(d=d[n?0:1]),d.replace(/%d/i,t)}},a=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar",{months:a,monthsShort:a,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:s("s"),ss:s("s"),m:s("m"),mm:s("m"),h:s("h"),hh:s("h"),d:s("d"),dd:s("d"),M:s("M"),MM:s("M"),y:s("y"),yy:s("y")},preparse:function(e){return e.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/az.js":function(e,t,n){!function(e){"use strict";var t={1:"-inci",5:"-inci",8:"-inci",70:"-inci",80:"-inci",2:"-nci",7:"-nci",20:"-nci",50:"-nci",3:"-üncü",4:"-üncü",100:"-üncü",6:"-ncı",9:"-uncu",10:"-uncu",30:"-uncu",60:"-ıncı",90:"-ıncı"};e.defineLocale("az",{months:"yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),monthsShort:"yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),weekdays:"Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə".split("_"),weekdaysShort:"Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən".split("_"),weekdaysMin:"Bz_BE_ÇA_Çə_CA_Cü_Şə".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[sabah saat] LT",nextWeek:"[gələn həftə] dddd [saat] LT",lastDay:"[dünən] LT",lastWeek:"[keçən həftə] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s əvvəl",s:"bir neçə saniyə",ss:"%d saniyə",m:"bir dəqiqə",mm:"%d dəqiqə",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir il",yy:"%d il"},meridiemParse:/gecə|səhər|gündüz|axşam/,isPM:function(e){return/^(gündüz|axşam)$/.test(e)},meridiem:function(e,t,n){return e<4?"gecə":e<12?"səhər":e<17?"gündüz":"axşam"},dayOfMonthOrdinalParse:/\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,ordinal:function(e){if(0===e)return e+"-ıncı";var n=e%10;return e+(t[n]||t[e%100-n]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/be.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return"m"===n?t?"хвіліна":"хвіліну":"h"===n?t?"гадзіна":"гадзіну":e+" "+(o=+e,r={ss:t?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:t?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:t?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"}[n].split("_"),o%10==1&&o%100!=11?r[0]:o%10>=2&&o%10<=4&&(o%100<10||o%100>=20)?r[1]:r[2]);var o,r}e.defineLocale("be",{months:{format:"студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня".split("_"),standalone:"студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань".split("_")},monthsShort:"студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж".split("_"),weekdays:{format:"нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу".split("_"),standalone:"нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота".split("_"),isFormat:/\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/},weekdaysShort:"нд_пн_ат_ср_чц_пт_сб".split("_"),weekdaysMin:"нд_пн_ат_ср_чц_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сёння ў] LT",nextDay:"[Заўтра ў] LT",lastDay:"[Учора ў] LT",nextWeek:function(){return"[У] dddd [ў] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[У мінулую] dddd [ў] LT";case 1:case 2:case 4:return"[У мінулы] dddd [ў] LT"}},sameElse:"L"},relativeTime:{future:"праз %s",past:"%s таму",s:"некалькі секунд",m:t,mm:t,h:t,hh:t,d:"дзень",dd:t,M:"месяц",MM:t,y:"год",yy:t},meridiemParse:/ночы|раніцы|дня|вечара/,isPM:function(e){return/^(дня|вечара)$/.test(e)},meridiem:function(e,t,n){return e<4?"ночы":e<12?"раніцы":e<17?"дня":"вечара"},dayOfMonthOrdinalParse:/\d{1,2}-(і|ы|га)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":case"w":case"W":return e%10!=2&&e%10!=3||e%100==12||e%100==13?e+"-ы":e+"-і";case"D":return e+"-га";default:return e}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bg.js":function(e,t,n){!function(e){"use strict";e.defineLocale("bg",{months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"яну_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Днес в] LT",nextDay:"[Утре в] LT",nextWeek:"dddd [в] LT",lastDay:"[Вчера в] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Миналата] dddd [в] LT";case 1:case 2:case 4:case 5:return"[Миналия] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",ss:"%d секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",w:"седмица",ww:"%d седмици",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},dayOfMonthOrdinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(e){var t=e%10,n=e%100;return 0===e?e+"-ев":0===n?e+"-ен":n>10&&n<20?e+"-ти":1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bm.js":function(e,t,n){!function(e){"use strict";e.defineLocale("bm",{months:"Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo".split("_"),monthsShort:"Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des".split("_"),weekdays:"Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri".split("_"),weekdaysShort:"Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib".split("_"),weekdaysMin:"Ka_Nt_Ta_Ar_Al_Ju_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"MMMM [tile] D [san] YYYY",LLL:"MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm",LLLL:"dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm"},calendar:{sameDay:"[Bi lɛrɛ] LT",nextDay:"[Sini lɛrɛ] LT",nextWeek:"dddd [don lɛrɛ] LT",lastDay:"[Kunu lɛrɛ] LT",lastWeek:"dddd [tɛmɛnen lɛrɛ] LT",sameElse:"L"},relativeTime:{future:"%s kɔnɔ",past:"a bɛ %s bɔ",s:"sanga dama dama",ss:"sekondi %d",m:"miniti kelen",mm:"miniti %d",h:"lɛrɛ kelen",hh:"lɛrɛ %d",d:"tile kelen",dd:"tile %d",M:"kalo kelen",MM:"kalo %d",y:"san kelen",yy:"san %d"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bn-bd.js":function(e,t,n){!function(e){"use strict";var t={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},n={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};e.defineLocale("bn-bd",{months:"জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),weekdaysMin:"রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",ss:"%d সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(e){return e.replace(/[১২৩৪৫৬৭৮৯০]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/রাত|ভোর|সকাল|দুপুর|বিকাল|সন্ধ্যা|রাত/,meridiemHour:function(e,t){return 12===e&&(e=0),"রাত"===t?e<4?e:e+12:"ভোর"===t||"সকাল"===t?e:"দুপুর"===t?e>=3?e:e+12:"বিকাল"===t||"সন্ধ্যা"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"রাত":e<6?"ভোর":e<12?"সকাল":e<15?"দুপুর":e<18?"বিকাল":e<20?"সন্ধ্যা":"রাত"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bn.js":function(e,t,n){!function(e){"use strict";var t={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},n={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};e.defineLocale("bn",{months:"জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),weekdaysMin:"রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",ss:"%d সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(e){return e.replace(/[১২৩৪৫৬৭৮৯০]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/রাত|সকাল|দুপুর|বিকাল|রাত/,meridiemHour:function(e,t){return 12===e&&(e=0),"রাত"===t&&e>=4||"দুপুর"===t&&e<5||"বিকাল"===t?e+12:e},meridiem:function(e,t,n){return e<4?"রাত":e<10?"সকাল":e<17?"দুপুর":e<20?"বিকাল":"রাত"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bo.js":function(e,t,n){!function(e){"use strict";var t={1:"༡",2:"༢",3:"༣",4:"༤",5:"༥",6:"༦",7:"༧",8:"༨",9:"༩",0:"༠"},n={"༡":"1","༢":"2","༣":"3","༤":"4","༥":"5","༦":"6","༧":"7","༨":"8","༩":"9","༠":"0"};e.defineLocale("bo",{months:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),monthsShort:"ཟླ་1_ཟླ་2_ཟླ་3_ཟླ་4_ཟླ་5_ཟླ་6_ཟླ་7_ཟླ་8_ཟླ་9_ཟླ་10_ཟླ་11_ཟླ་12".split("_"),monthsShortRegex:/^(ཟླ་\d{1,2})/,monthsParseExact:!0,weekdays:"གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་".split("_"),weekdaysShort:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),weekdaysMin:"ཉི_ཟླ_མིག_ལྷག_ཕུར_སངས_སྤེན".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[དི་རིང] LT",nextDay:"[སང་ཉིན] LT",nextWeek:"[བདུན་ཕྲག་རྗེས་མ], LT",lastDay:"[ཁ་སང] LT",lastWeek:"[བདུན་ཕྲག་མཐའ་མ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ལ་",past:"%s སྔན་ལ",s:"ལམ་སང",ss:"%d སྐར་ཆ།",m:"སྐར་མ་གཅིག",mm:"%d སྐར་མ",h:"ཆུ་ཚོད་གཅིག",hh:"%d ཆུ་ཚོད",d:"ཉིན་གཅིག",dd:"%d ཉིན་",M:"ཟླ་བ་གཅིག",MM:"%d ཟླ་བ",y:"ལོ་གཅིག",yy:"%d ལོ"},preparse:function(e){return e.replace(/[༡༢༣༤༥༦༧༨༩༠]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,meridiemHour:function(e,t){return 12===e&&(e=0),"མཚན་མོ"===t&&e>=4||"ཉིན་གུང"===t&&e<5||"དགོང་དག"===t?e+12:e},meridiem:function(e,t,n){return e<4?"མཚན་མོ":e<10?"ཞོགས་ཀས":e<17?"ཉིན་གུང":e<20?"དགོང་དག":"མཚན་མོ"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/br.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return e+" "+function(e,t){return 2===t?function(e){var t={m:"v",b:"v",d:"z"};return void 0===t[e.charAt(0)]?e:t[e.charAt(0)]+e.substring(1)}(e):e}({mm:"munutenn",MM:"miz",dd:"devezh"}[n],e)}function n(e){return e>9?n(e%10):e}var o=[/^gen/i,/^c[ʼ\']hwe/i,/^meu/i,/^ebr/i,/^mae/i,/^(mez|eve)/i,/^gou/i,/^eos/i,/^gwe/i,/^her/i,/^du/i,/^ker/i],r=/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,s=[/^Su/i,/^Lu/i,/^Me([^r]|$)/i,/^Mer/i,/^Ya/i,/^Gw/i,/^Sa/i];e.defineLocale("br",{months:"Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),weekdaysParse:s,fullWeekdaysParse:[/^sul/i,/^lun/i,/^meurzh/i,/^merc[ʼ\']her/i,/^yaou/i,/^gwener/i,/^sadorn/i],shortWeekdaysParse:[/^Sul/i,/^Lun/i,/^Meu/i,/^Mer/i,/^Yao/i,/^Gwe/i,/^Sad/i],minWeekdaysParse:s,monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,monthsShortStrictRegex:/^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY HH:mm",LLLL:"dddd, D [a viz] MMMM YYYY HH:mm"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warcʼhoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Decʼh da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s ʼzo",s:"un nebeud segondennoù",ss:"%d eilenn",m:"ur vunutenn",mm:t,h:"un eur",hh:"%d eur",d:"un devezh",dd:t,M:"ur miz",MM:t,y:"ur bloaz",yy:function(e){switch(n(e)){case 1:case 3:case 4:case 5:case 9:return e+" bloaz";default:return e+" vloaz"}}},dayOfMonthOrdinalParse:/\d{1,2}(añ|vet)/,ordinal:function(e){return e+(1===e?"añ":"vet")},week:{dow:1,doy:4},meridiemParse:/a.m.|g.m./,isPM:function(e){return"g.m."===e},meridiem:function(e,t,n){return e<12?"a.m.":"g.m."}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bs.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){var o=e+" ";switch(n){case"ss":return o+(1===e?"sekunda":2===e||3===e||4===e?"sekunde":"sekundi");case"m":return t?"jedna minuta":"jedne minute";case"mm":return o+(1===e?"minuta":2===e||3===e||4===e?"minute":"minuta");case"h":return t?"jedan sat":"jednog sata";case"hh":return o+(1===e?"sat":2===e||3===e||4===e?"sata":"sati");case"dd":return o+(1===e?"dan":"dana");case"MM":return o+(1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci");case"yy":return o+(1===e?"godina":2===e||3===e||4===e?"godine":"godina")}}e.defineLocale("bs",{months:"januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:t,m:t,mm:t,h:t,hh:t,d:"dan",dd:t,M:"mjesec",MM:t,y:"godinu",yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ca.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ca",{months:{standalone:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),format:"de gener_de febrer_de març_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.".split("_"),monthsParseExact:!0,weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dt_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a les] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a les] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"d'aquí %s",past:"fa %s",s:"uns segons",ss:"%d segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(e,t){var n=1===e?"r":2===e?"n":3===e?"r":4===e?"t":"è";return"w"!==t&&"W"!==t||(n="a"),e+n},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/cs.js":function(e,t,n){!function(e){"use strict";var t="leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"),n="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),o=[/^led/i,/^úno/i,/^bře/i,/^dub/i,/^kvě/i,/^(čvn|červen$|června)/i,/^(čvc|červenec|července)/i,/^srp/i,/^zář/i,/^říj/i,/^lis/i,/^pro/i],r=/^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i;function s(e){return e>1&&e<5&&1!=~~(e/10)}function a(e,t,n,o){var r=e+" ";switch(n){case"s":return t||o?"pár sekund":"pár sekundami";case"ss":return t||o?r+(s(e)?"sekundy":"sekund"):r+"sekundami";case"m":return t?"minuta":o?"minutu":"minutou";case"mm":return t||o?r+(s(e)?"minuty":"minut"):r+"minutami";case"h":return t?"hodina":o?"hodinu":"hodinou";case"hh":return t||o?r+(s(e)?"hodiny":"hodin"):r+"hodinami";case"d":return t||o?"den":"dnem";case"dd":return t||o?r+(s(e)?"dny":"dní"):r+"dny";case"M":return t||o?"měsíc":"měsícem";case"MM":return t||o?r+(s(e)?"měsíce":"měsíců"):r+"měsíci";case"y":return t||o?"rok":"rokem";case"yy":return t||o?r+(s(e)?"roky":"let"):r+"lety"}}e.defineLocale("cs",{months:t,monthsShort:n,monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i,monthsShortStrictRegex:/^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm",l:"D. M. YYYY"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s:a,ss:a,m:a,mm:a,h:a,hh:a,d:a,dd:a,M:a,MM:a,y:a,yy:a},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/cv.js":function(e,t,n){!function(e){"use strict";e.defineLocale("cv",{months:"кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав".split("_"),monthsShort:"кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш".split("_"),weekdays:"вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун".split("_"),weekdaysShort:"выр_тун_ытл_юн_кӗҫ_эрн_шӑм".split("_"),weekdaysMin:"вр_тн_ыт_юн_кҫ_эр_шм".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]",LLL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm",LLLL:"dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm"},calendar:{sameDay:"[Паян] LT [сехетре]",nextDay:"[Ыран] LT [сехетре]",lastDay:"[Ӗнер] LT [сехетре]",nextWeek:"[Ҫитес] dddd LT [сехетре]",lastWeek:"[Иртнӗ] dddd LT [сехетре]",sameElse:"L"},relativeTime:{future:function(e){return e+(/сехет$/i.exec(e)?"рен":/ҫул$/i.exec(e)?"тан":"ран")},past:"%s каялла",s:"пӗр-ик ҫеккунт",ss:"%d ҫеккунт",m:"пӗр минут",mm:"%d минут",h:"пӗр сехет",hh:"%d сехет",d:"пӗр кун",dd:"%d кун",M:"пӗр уйӑх",MM:"%d уйӑх",y:"пӗр ҫул",yy:"%d ҫул"},dayOfMonthOrdinalParse:/\d{1,2}-мӗш/,ordinal:"%d-мӗш",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/cy.js":function(e,t,n){!function(e){"use strict";e.defineLocale("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn ôl",s:"ychydig eiliadau",ss:"%d eiliad",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},dayOfMonthOrdinalParse:/\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,ordinal:function(e){var t="";return e>20?t=40===e||50===e||60===e||80===e||100===e?"fed":"ain":e>0&&(t=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"][e]),e+t},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/da.js":function(e,t,n){!function(e){"use strict";e.defineLocale("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn_man_tir_ons_tor_fre_lør".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"på dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[i] dddd[s kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",ss:"%d sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/de-at.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?r[n][0]:r[n][1]}e.defineLocale("de-at",{months:"Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:t,mm:"%d Minuten",h:t,hh:"%d Stunden",d:t,dd:t,w:t,ww:"%d Wochen",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/de-ch.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?r[n][0]:r[n][1]}e.defineLocale("de-ch",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:t,mm:"%d Minuten",h:t,hh:"%d Stunden",d:t,dd:t,w:t,ww:"%d Wochen",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/de.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?r[n][0]:r[n][1]}e.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:t,mm:"%d Minuten",h:t,hh:"%d Stunden",d:t,dd:t,w:t,ww:"%d Wochen",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/dv.js":function(e,t,n){!function(e){"use strict";var t=["ޖެނުއަރީ","ފެބްރުއަރީ","މާރިޗު","އޭޕްރީލު","މޭ","ޖޫން","ޖުލައި","އޯގަސްޓު","ސެޕްޓެމްބަރު","އޮކްޓޯބަރު","ނޮވެމްބަރު","ޑިސެމްބަރު"],n=["އާދިއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"];e.defineLocale("dv",{months:t,monthsShort:t,weekdays:n,weekdaysShort:n,weekdaysMin:"އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/M/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/މކ|މފ/,isPM:function(e){return"މފ"===e},meridiem:function(e,t,n){return e<12?"މކ":"މފ"},calendar:{sameDay:"[މިއަދު] LT",nextDay:"[މާދަމާ] LT",nextWeek:"dddd LT",lastDay:"[އިއްޔެ] LT",lastWeek:"[ފާއިތުވި] dddd LT",sameElse:"L"},relativeTime:{future:"ތެރޭގައި %s",past:"ކުރިން %s",s:"ސިކުންތުކޮޅެއް",ss:"d% ސިކުންތު",m:"މިނިޓެއް",mm:"މިނިޓު %d",h:"ގަޑިއިރެއް",hh:"ގަޑިއިރު %d",d:"ދުވަހެއް",dd:"ދުވަސް %d",M:"މަހެއް",MM:"މަސް %d",y:"އަހަރެއް",yy:"އަހަރު %d"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:7,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/el.js":function(e,t,n){!function(e){"use strict";e.defineLocale("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(e,t){return e?"string"==typeof t&&/D/.test(t.substring(0,t.indexOf("MMMM")))?this._monthsGenitiveEl[e.month()]:this._monthsNominativeEl[e.month()]:this._monthsNominativeEl},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(e,t,n){return e>11?n?"μμ":"ΜΜ":n?"πμ":"ΠΜ"},isPM:function(e){return"μ"===(e+"").toLowerCase()[0]},meridiemParse:/[ΠΜ]\.?Μ?\.?/i,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendarEl:{sameDay:"[Σήμερα {}] LT",nextDay:"[Αύριο {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Χθες {}] LT",lastWeek:function(){switch(this.day()){case 6:return"[το προηγούμενο] dddd [{}] LT";default:return"[την προηγούμενη] dddd [{}] LT"}},sameElse:"L"},calendar:function(e,t){var n,o=this._calendarEl[e],r=t&&t.hours();return n=o,("undefined"!=typeof Function&&n instanceof Function||"[object Function]"===Object.prototype.toString.call(n))&&(o=o.apply(t)),o.replace("{}",r%12==1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"λίγα δευτερόλεπτα",ss:"%d δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},dayOfMonthOrdinalParse:/\d{1,2}η/,ordinal:"%dη",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-au.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:0,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-ca.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"YYYY-MM-DD",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-gb.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-ie.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-ie",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-il.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-il",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-in.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-in",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-nz.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-nz",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-sg.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-sg",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/eo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mart_apr_maj_jun_jul_aŭg_sept_okt_nov_dec".split("_"),weekdays:"dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato".split("_"),weekdaysShort:"dim_lun_mard_merk_ĵaŭ_ven_sab".split("_"),weekdaysMin:"di_lu_ma_me_ĵa_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"[la] D[-an de] MMMM, YYYY",LLL:"[la] D[-an de] MMMM, YYYY HH:mm",LLLL:"dddd[n], [la] D[-an de] MMMM, YYYY HH:mm",llll:"ddd, [la] D[-an de] MMM, YYYY HH:mm"},meridiemParse:/[ap]\.t\.m/i,isPM:function(e){return"p"===e.charAt(0).toLowerCase()},meridiem:function(e,t,n){return e>11?n?"p.t.m.":"P.T.M.":n?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodiaŭ je] LT",nextDay:"[Morgaŭ je] LT",nextWeek:"dddd[n je] LT",lastDay:"[Hieraŭ je] LT",lastWeek:"[pasintan] dddd[n je] LT",sameElse:"L"},relativeTime:{future:"post %s",past:"antaŭ %s",s:"kelkaj sekundoj",ss:"%d sekundoj",m:"unu minuto",mm:"%d minutoj",h:"unu horo",hh:"%d horoj",d:"unu tago",dd:"%d tagoj",M:"unu monato",MM:"%d monatoj",y:"unu jaro",yy:"%d jaroj"},dayOfMonthOrdinalParse:/\d{1,2}a/,ordinal:"%da",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es-do.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es-do",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es-mx.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es-mx",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:0,doy:4},invalidDate:"Fecha inválida"})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es-us.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es-us",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"MM/DD/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4},invalidDate:"Fecha inválida"})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/et.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["mõne sekundi","mõni sekund","paar sekundit"],ss:[e+"sekundi",e+"sekundit"],m:["ühe minuti","üks minut"],mm:[e+" minuti",e+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[e+" tunni",e+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[e+" kuu",e+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[e+" aasta",e+" aastat"]};return t?r[n][2]?r[n][2]:r[n][1]:o?r[n][0]:r[n][1]}e.defineLocale("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:"%d päeva",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/eu.js":function(e,t,n){!function(e){"use strict";e.defineLocale("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),monthsParseExact:!0,weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] HH:mm",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] HH:mm",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] HH:mm",llll:"ddd, YYYY[ko] MMM D[a] HH:mm"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",ss:"%d segundo",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fa.js":function(e,t,n){!function(e){"use strict";var t={1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"},n={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"};e.defineLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysShort:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/قبل از ظهر|بعد از ظهر/,isPM:function(e){return/بعد از ظهر/.test(e)},meridiem:function(e,t,n){return e<12?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",ss:"%d ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(e){return e.replace(/[۰-۹]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},dayOfMonthOrdinalParse:/\d{1,2}م/,ordinal:"%dم",week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fi.js":function(e,t,n){!function(e){"use strict";var t="nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" "),n=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",t[7],t[8],t[9]];function o(e,o,r,s){var a="";switch(r){case"s":return s?"muutaman sekunnin":"muutama sekunti";case"ss":a=s?"sekunnin":"sekuntia";break;case"m":return s?"minuutin":"minuutti";case"mm":a=s?"minuutin":"minuuttia";break;case"h":return s?"tunnin":"tunti";case"hh":a=s?"tunnin":"tuntia";break;case"d":return s?"päivän":"päivä";case"dd":a=s?"päivän":"päivää";break;case"M":return s?"kuukauden":"kuukausi";case"MM":a=s?"kuukauden":"kuukautta";break;case"y":return s?"vuoden":"vuosi";case"yy":a=s?"vuoden":"vuotta"}return function(e,o){return e<10?o?n[e]:t[e]:e}(e,s)+" "+a}e.defineLocale("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] HH.mm",llll:"ddd, Do MMM YYYY, [klo] HH.mm"},calendar:{sameDay:"[tänään] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s päästä",past:"%s sitten",s:o,ss:o,m:o,mm:o,h:o,hh:o,d:o,dd:o,M:o,MM:o,y:o,yy:o},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fil.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fil",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fo",{months:"januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur".split("_"),weekdaysShort:"sun_mán_týs_mik_hós_frí_ley".split("_"),weekdaysMin:"su_má_tý_mi_hó_fr_le".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D. MMMM, YYYY HH:mm"},calendar:{sameDay:"[Í dag kl.] LT",nextDay:"[Í morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Í gjár kl.] LT",lastWeek:"[síðstu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s síðani",s:"fá sekund",ss:"%d sekundir",m:"ein minuttur",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaður",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fr-ca.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fr-ca",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(e,t){switch(t){default:case"M":case"Q":case"D":case"DDD":case"d":return e+(1===e?"er":"e");case"w":case"W":return e+(1===e?"re":"e")}}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fr-ch.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fr-ch",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(e,t){switch(t){default:case"M":case"Q":case"D":case"DDD":case"d":return e+(1===e?"er":"e");case"w":case"W":return e+(1===e?"re":"e")}},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fr.js":function(e,t,n){!function(e){"use strict";var t=/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,n=[/^janv/i,/^févr/i,/^mars/i,/^avr/i,/^mai/i,/^juin/i,/^juil/i,/^août/i,/^sept/i,/^oct/i,/^nov/i,/^déc/i];e.defineLocale("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsRegex:t,monthsShortRegex:t,monthsStrictRegex:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,monthsShortStrictRegex:/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",w:"une semaine",ww:"%d semaines",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|)/,ordinal:function(e,t){switch(t){case"D":return e+(1===e?"er":"");default:case"M":case"Q":case"DDD":case"d":return e+(1===e?"er":"e");case"w":case"W":return e+(1===e?"re":"e")}},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fy.js":function(e,t,n){!function(e){"use strict";var t="jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.".split("_"),n="jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_");e.defineLocale("fy",{months:"jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsParseExact:!0,weekdays:"snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon".split("_"),weekdaysShort:"si._mo._ti._wo._to._fr._so.".split("_"),weekdaysMin:"Si_Mo_Ti_Wo_To_Fr_So".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[hjoed om] LT",nextDay:"[moarn om] LT",nextWeek:"dddd [om] LT",lastDay:"[juster om] LT",lastWeek:"[ôfrûne] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oer %s",past:"%s lyn",s:"in pear sekonden",ss:"%d sekonden",m:"ien minút",mm:"%d minuten",h:"ien oere",hh:"%d oeren",d:"ien dei",dd:"%d dagen",M:"ien moanne",MM:"%d moannen",y:"ien jier",yy:"%d jierren"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ga.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ga",{months:["Eanáir","Feabhra","Márta","Aibreán","Bealtaine","Meitheamh","Iúil","Lúnasa","Meán Fómhair","Deireadh Fómhair","Samhain","Nollaig"],monthsShort:["Ean","Feabh","Márt","Aib","Beal","Meith","Iúil","Lún","M.F.","D.F.","Samh","Noll"],monthsParseExact:!0,weekdays:["Dé Domhnaigh","Dé Luain","Dé Máirt","Dé Céadaoin","Déardaoin","Dé hAoine","Dé Sathairn"],weekdaysShort:["Domh","Luan","Máirt","Céad","Déar","Aoine","Sath"],weekdaysMin:["Do","Lu","Má","Cé","Dé","A","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Inniu ag] LT",nextDay:"[Amárach ag] LT",nextWeek:"dddd [ag] LT",lastDay:"[Inné ag] LT",lastWeek:"dddd [seo caite] [ag] LT",sameElse:"L"},relativeTime:{future:"i %s",past:"%s ó shin",s:"cúpla soicind",ss:"%d soicind",m:"nóiméad",mm:"%d nóiméad",h:"uair an chloig",hh:"%d uair an chloig",d:"lá",dd:"%d lá",M:"mí",MM:"%d míonna",y:"bliain",yy:"%d bliain"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(e){return e+(1===e?"d":e%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gd.js":function(e,t,n){!function(e){"use strict";e.defineLocale("gd",{months:["Am Faoilleach","An Gearran","Am Màrt","An Giblean","An Cèitean","An t-Ògmhios","An t-Iuchar","An Lùnastal","An t-Sultain","An Dàmhair","An t-Samhain","An Dùbhlachd"],monthsShort:["Faoi","Gear","Màrt","Gibl","Cèit","Ògmh","Iuch","Lùn","Sult","Dàmh","Samh","Dùbh"],monthsParseExact:!0,weekdays:["Didòmhnaich","Diluain","Dimàirt","Diciadain","Diardaoin","Dihaoine","Disathairne"],weekdaysShort:["Did","Dil","Dim","Dic","Dia","Dih","Dis"],weekdaysMin:["Dò","Lu","Mà","Ci","Ar","Ha","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[An-diugh aig] LT",nextDay:"[A-màireach aig] LT",nextWeek:"dddd [aig] LT",lastDay:"[An-dè aig] LT",lastWeek:"dddd [seo chaidh] [aig] LT",sameElse:"L"},relativeTime:{future:"ann an %s",past:"bho chionn %s",s:"beagan diogan",ss:"%d diogan",m:"mionaid",mm:"%d mionaidean",h:"uair",hh:"%d uairean",d:"latha",dd:"%d latha",M:"mìos",MM:"%d mìosan",y:"bliadhna",yy:"%d bliadhna"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(e){return e+(1===e?"d":e%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gl.js":function(e,t,n){!function(e){"use strict";e.defineLocale("gl",{months:"xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro".split("_"),monthsShort:"xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"domingo_luns_martes_mércores_xoves_venres_sábado".split("_"),weekdaysShort:"dom._lun._mar._mér._xov._ven._sáb.".split("_"),weekdaysMin:"do_lu_ma_mé_xo_ve_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(e){return 0===e.indexOf("un")?"n"+e:"en "+e},past:"hai %s",s:"uns segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gom-deva.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["थोडया सॅकंडांनी","थोडे सॅकंड"],ss:[e+" सॅकंडांनी",e+" सॅकंड"],m:["एका मिणटान","एक मिनूट"],mm:[e+" मिणटांनी",e+" मिणटां"],h:["एका वरान","एक वर"],hh:[e+" वरांनी",e+" वरां"],d:["एका दिसान","एक दीस"],dd:[e+" दिसांनी",e+" दीस"],M:["एका म्हयन्यान","एक म्हयनो"],MM:[e+" म्हयन्यानी",e+" म्हयने"],y:["एका वर्सान","एक वर्स"],yy:[e+" वर्सांनी",e+" वर्सां"]};return o?r[n][0]:r[n][1]}e.defineLocale("gom-deva",{months:{standalone:"जानेवारी_फेब्रुवारी_मार्च_एप्रील_मे_जून_जुलय_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),format:"जानेवारीच्या_फेब्रुवारीच्या_मार्चाच्या_एप्रीलाच्या_मेयाच्या_जूनाच्या_जुलयाच्या_ऑगस्टाच्या_सप्टेंबराच्या_ऑक्टोबराच्या_नोव्हेंबराच्या_डिसेंबराच्या".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"जाने._फेब्रु._मार्च_एप्री._मे_जून_जुल._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"आयतार_सोमार_मंगळार_बुधवार_बिरेस्तार_सुक्रार_शेनवार".split("_"),weekdaysShort:"आयत._सोम._मंगळ._बुध._ब्रेस्त._सुक्र._शेन.".split("_"),weekdaysMin:"आ_सो_मं_बु_ब्रे_सु_शे".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [वाजतां]",LTS:"A h:mm:ss [वाजतां]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [वाजतां]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [वाजतां]",llll:"ddd, D MMM YYYY, A h:mm [वाजतां]"},calendar:{sameDay:"[आयज] LT",nextDay:"[फाल्यां] LT",nextWeek:"[फुडलो] dddd[,] LT",lastDay:"[काल] LT",lastWeek:"[फाटलो] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s आदीं",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}(वेर)/,ordinal:function(e,t){switch(t){case"D":return e+"वेर";default:case"M":case"Q":case"DDD":case"d":case"w":case"W":return e}},week:{dow:0,doy:3},meridiemParse:/राती|सकाळीं|दनपारां|सांजे/,meridiemHour:function(e,t){return 12===e&&(e=0),"राती"===t?e<4?e:e+12:"सकाळीं"===t?e:"दनपारां"===t?e>12?e:e+12:"सांजे"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"राती":e<12?"सकाळीं":e<16?"दनपारां":e<20?"सांजे":"राती"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gom-latn.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["thoddea sekondamni","thodde sekond"],ss:[e+" sekondamni",e+" sekond"],m:["eka mintan","ek minut"],mm:[e+" mintamni",e+" mintam"],h:["eka voran","ek vor"],hh:[e+" voramni",e+" voram"],d:["eka disan","ek dis"],dd:[e+" disamni",e+" dis"],M:["eka mhoinean","ek mhoino"],MM:[e+" mhoineamni",e+" mhoine"],y:["eka vorsan","ek voros"],yy:[e+" vorsamni",e+" vorsam"]};return o?r[n][0]:r[n][1]}e.defineLocale("gom-latn",{months:{standalone:"Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr".split("_"),format:"Janerachea_Febrerachea_Marsachea_Abrilachea_Maiachea_Junachea_Julaiachea_Agostachea_Setembrachea_Otubrachea_Novembrachea_Dezembrachea".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Aitar_Somar_Mongllar_Budhvar_Birestar_Sukrar_Son'var".split("_"),weekdaysShort:"Ait._Som._Mon._Bud._Bre._Suk._Son.".split("_"),weekdaysMin:"Ai_Sm_Mo_Bu_Br_Su_Sn".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [vazta]",LTS:"A h:mm:ss [vazta]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [vazta]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [vazta]",llll:"ddd, D MMM YYYY, A h:mm [vazta]"},calendar:{sameDay:"[Aiz] LT",nextDay:"[Faleam] LT",nextWeek:"[Fuddlo] dddd[,] LT",lastDay:"[Kal] LT",lastWeek:"[Fattlo] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s adim",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}(er)/,ordinal:function(e,t){switch(t){case"D":return e+"er";default:case"M":case"Q":case"DDD":case"d":case"w":case"W":return e}},week:{dow:0,doy:3},meridiemParse:/rati|sokallim|donparam|sanje/,meridiemHour:function(e,t){return 12===e&&(e=0),"rati"===t?e<4?e:e+12:"sokallim"===t?e:"donparam"===t?e>12?e:e+12:"sanje"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"rati":e<12?"sokallim":e<16?"donparam":e<20?"sanje":"rati"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gu.js":function(e,t,n){!function(e){"use strict";var t={1:"૧",2:"૨",3:"૩",4:"૪",5:"૫",6:"૬",7:"૭",8:"૮",9:"૯",0:"૦"},n={"૧":"1","૨":"2","૩":"3","૪":"4","૫":"5","૬":"6","૭":"7","૮":"8","૯":"9","૦":"0"};e.defineLocale("gu",{months:"જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર".split("_"),monthsShort:"જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.".split("_"),monthsParseExact:!0,weekdays:"રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર".split("_"),weekdaysShort:"રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ".split("_"),weekdaysMin:"ર_સો_મં_બુ_ગુ_શુ_શ".split("_"),longDateFormat:{LT:"A h:mm વાગ્યે",LTS:"A h:mm:ss વાગ્યે",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm વાગ્યે",LLLL:"dddd, D MMMM YYYY, A h:mm વાગ્યે"},calendar:{sameDay:"[આજ] LT",nextDay:"[કાલે] LT",nextWeek:"dddd, LT",lastDay:"[ગઇકાલે] LT",lastWeek:"[પાછલા] dddd, LT",sameElse:"L"},relativeTime:{future:"%s મા",past:"%s પહેલા",s:"અમુક પળો",ss:"%d સેકંડ",m:"એક મિનિટ",mm:"%d મિનિટ",h:"એક કલાક",hh:"%d કલાક",d:"એક દિવસ",dd:"%d દિવસ",M:"એક મહિનો",MM:"%d મહિનો",y:"એક વર્ષ",yy:"%d વર્ષ"},preparse:function(e){return e.replace(/[૧૨૩૪૫૬૭૮૯૦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/રાત|બપોર|સવાર|સાંજ/,meridiemHour:function(e,t){return 12===e&&(e=0),"રાત"===t?e<4?e:e+12:"સવાર"===t?e:"બપોર"===t?e>=10?e:e+12:"સાંજ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"રાત":e<10?"સવાર":e<17?"બપોર":e<20?"સાંજ":"રાત"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/he.js":function(e,t,n){!function(e){"use strict";e.defineLocale("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY HH:mm",LLLL:"dddd, D [ב]MMMM YYYY HH:mm",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",ss:"%d שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(e){return 2===e?"שעתיים":e+" שעות"},d:"יום",dd:function(e){return 2===e?"יומיים":e+" ימים"},M:"חודש",MM:function(e){return 2===e?"חודשיים":e+" חודשים"},y:"שנה",yy:function(e){return 2===e?"שנתיים":e%10==0&&10!==e?e+" שנה":e+" שנים"}},meridiemParse:/אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,isPM:function(e){return/^(אחה"צ|אחרי הצהריים|בערב)$/.test(e)},meridiem:function(e,t,n){return e<5?"לפנות בוקר":e<10?"בבוקר":e<12?n?'לפנה"צ':"לפני הצהריים":e<18?n?'אחה"צ':"אחרי הצהריים":"בערב"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hi.js":function(e,t,n){!function(e){"use strict";var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},o=[/^जन/i,/^फ़र|फर/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सितं|सित/i,/^अक्टू/i,/^नव|नवं/i,/^दिसं|दिस/i];e.defineLocale("hi",{months:{format:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),standalone:"जनवरी_फरवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितंबर_अक्टूबर_नवंबर_दिसंबर".split("_")},monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),weekdays:"रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm बजे",LTS:"A h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm बजे",LLLL:"dddd, D MMMM YYYY, A h:mm बजे"},monthsParse:o,longMonthsParse:o,shortMonthsParse:[/^जन/i,/^फ़र/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सित/i,/^अक्टू/i,/^नव/i,/^दिस/i],monthsRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsShortRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsStrictRegex:/^(जनवरी?|फ़रवरी|फरवरी?|मार्च?|अप्रैल?|मई?|जून?|जुलाई?|अगस्त?|सितम्बर|सितंबर|सित?\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर?|दिसम्बर|दिसंबर?)/i,monthsShortStrictRegex:/^(जन\.?|फ़र\.?|मार्च?|अप्रै\.?|मई?|जून?|जुल\.?|अग\.?|सित\.?|अक्टू\.?|नव\.?|दिस\.?)/i,calendar:{sameDay:"[आज] LT",nextDay:"[कल] LT",nextWeek:"dddd, LT",lastDay:"[कल] LT",lastWeek:"[पिछले] dddd, LT",sameElse:"L"},relativeTime:{future:"%s में",past:"%s पहले",s:"कुछ ही क्षण",ss:"%d सेकंड",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/रात|सुबह|दोपहर|शाम/,meridiemHour:function(e,t){return 12===e&&(e=0),"रात"===t?e<4?e:e+12:"सुबह"===t?e:"दोपहर"===t?e>=10?e:e+12:"शाम"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"रात":e<10?"सुबह":e<17?"दोपहर":e<20?"शाम":"रात"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hr.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){var o=e+" ";switch(n){case"ss":return o+(1===e?"sekunda":2===e||3===e||4===e?"sekunde":"sekundi");case"m":return t?"jedna minuta":"jedne minute";case"mm":return o+(1===e?"minuta":2===e||3===e||4===e?"minute":"minuta");case"h":return t?"jedan sat":"jednog sata";case"hh":return o+(1===e?"sat":2===e||3===e||4===e?"sata":"sati");case"dd":return o+(1===e?"dan":"dana");case"MM":return o+(1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci");case"yy":return o+(1===e?"godina":2===e||3===e||4===e?"godine":"godina")}}e.defineLocale("hr",{months:{format:"siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca".split("_"),standalone:"siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_")},monthsShort:"sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"Do MMMM YYYY",LLL:"Do MMMM YYYY H:mm",LLLL:"dddd, Do MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:return"[prošlu] [nedjelju] [u] LT";case 3:return"[prošlu] [srijedu] [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:t,m:t,mm:t,h:t,hh:t,d:"dan",dd:t,M:"mjesec",MM:t,y:"godinu",yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hu.js":function(e,t,n){!function(e){"use strict";var t="vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ");function n(e,t,n,o){var r=e;switch(n){case"s":return o||t?"néhány másodperc":"néhány másodperce";case"ss":return r+(o||t)?" másodperc":" másodperce";case"m":return"egy"+(o||t?" perc":" perce");case"mm":return r+(o||t?" perc":" perce");case"h":return"egy"+(o||t?" óra":" órája");case"hh":return r+(o||t?" óra":" órája");case"d":return"egy"+(o||t?" nap":" napja");case"dd":return r+(o||t?" nap":" napja");case"M":return"egy"+(o||t?" hónap":" hónapja");case"MM":return r+(o||t?" hónap":" hónapja");case"y":return"egy"+(o||t?" év":" éve");case"yy":return r+(o||t?" év":" éve")}return""}function o(e){return(e?"":"[múlt] ")+"["+t[this.day()]+"] LT[-kor]"}e.defineLocale("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan._feb._márc._ápr._máj._jún._júl._aug._szept._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"},meridiemParse:/de|du/i,isPM:function(e){return"u"===e.charAt(1).toLowerCase()},meridiem:function(e,t,n){return e<12?!0===n?"de":"DE":!0===n?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return o.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return o.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:n,ss:n,m:n,mm:n,h:n,hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hy-am.js":function(e,t,n){!function(e){"use strict";e.defineLocale("hy-am",{months:{format:"հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի".split("_"),standalone:"հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր".split("_")},monthsShort:"հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ".split("_"),weekdays:"կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ".split("_"),weekdaysShort:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),weekdaysMin:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY թ.",LLL:"D MMMM YYYY թ., HH:mm",LLLL:"dddd, D MMMM YYYY թ., HH:mm"},calendar:{sameDay:"[այսօր] LT",nextDay:"[վաղը] LT",lastDay:"[երեկ] LT",nextWeek:function(){return"dddd [օրը ժամը] LT"},lastWeek:function(){return"[անցած] dddd [օրը ժամը] LT"},sameElse:"L"},relativeTime:{future:"%s հետո",past:"%s առաջ",s:"մի քանի վայրկյան",ss:"%d վայրկյան",m:"րոպե",mm:"%d րոպե",h:"ժամ",hh:"%d ժամ",d:"օր",dd:"%d օր",M:"ամիս",MM:"%d ամիս",y:"տարի",yy:"%d տարի"},meridiemParse:/գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,isPM:function(e){return/^(ցերեկվա|երեկոյան)$/.test(e)},meridiem:function(e){return e<4?"գիշերվա":e<12?"առավոտվա":e<17?"ցերեկվա":"երեկոյան"},dayOfMonthOrdinalParse:/\d{1,2}|\d{1,2}-(ին|րդ)/,ordinal:function(e,t){switch(t){case"DDD":case"w":case"W":case"DDDo":return 1===e?e+"-ին":e+"-րդ";default:return e}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/id.js":function(e,t,n){!function(e){"use strict";e.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|siang|sore|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"siang"===t?e>=11?e:e+12:"sore"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"pagi":e<15?"siang":e<19?"sore":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",ss:"%d detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/is.js":function(e,t,n){!function(e){"use strict";function t(e){return e%100==11||e%10!=1}function n(e,n,o,r){var s=e+" ";switch(o){case"s":return n||r?"nokkrar sekúndur":"nokkrum sekúndum";case"ss":return t(e)?s+(n||r?"sekúndur":"sekúndum"):s+"sekúnda";case"m":return n?"mínúta":"mínútu";case"mm":return t(e)?s+(n||r?"mínútur":"mínútum"):n?s+"mínúta":s+"mínútu";case"hh":return t(e)?s+(n||r?"klukkustundir":"klukkustundum"):s+"klukkustund";case"d":return n?"dagur":r?"dag":"degi";case"dd":return t(e)?n?s+"dagar":s+(r?"daga":"dögum"):n?s+"dagur":s+(r?"dag":"degi");case"M":return n?"mánuður":r?"mánuð":"mánuði";case"MM":return t(e)?n?s+"mánuðir":s+(r?"mánuði":"mánuðum"):n?s+"mánuður":s+(r?"mánuð":"mánuði");case"y":return n||r?"ár":"ári";case"yy":return t(e)?s+(n||r?"ár":"árum"):s+(n||r?"ár":"ári")}}e.defineLocale("is",{months:"janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),weekdays:"sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),weekdaysShort:"sun_mán_þri_mið_fim_fös_lau".split("_"),weekdaysMin:"Su_Má_Þr_Mi_Fi_Fö_La".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd, D. MMMM YYYY [kl.] H:mm"},calendar:{sameDay:"[í dag kl.] LT",nextDay:"[á morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[í gær kl.] LT",lastWeek:"[síðasta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s síðan",s:n,ss:n,m:n,mm:n,h:"klukkustund",hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/it-ch.js":function(e,t,n){!function(e){"use strict";e.defineLocale("it-ch",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:function(){switch(this.day()){case 0:return"[la scorsa] dddd [alle] LT";default:return"[lo scorso] dddd [alle] LT"}},sameElse:"L"},relativeTime:{future:function(e){return(/^[0-9].+$/.test(e)?"tra":"in")+" "+e},past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/it.js":function(e,t,n){!function(e){"use strict";e.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:function(){return"[Oggi a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextDay:function(){return"[Domani a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextWeek:function(){return"dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastDay:function(){return"[Ieri a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastWeek:function(){switch(this.day()){case 0:return"[La scorsa] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT";default:return"[Lo scorso] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"}},sameElse:"L"},relativeTime:{future:"tra %s",past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",w:"una settimana",ww:"%d settimane",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ja.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ja",{eras:[{since:"2019-05-01",offset:1,name:"令和",narrow:"㋿",abbr:"R"},{since:"1989-01-08",until:"2019-04-30",offset:1,name:"平成",narrow:"㍻",abbr:"H"},{since:"1926-12-25",until:"1989-01-07",offset:1,name:"昭和",narrow:"㍼",abbr:"S"},{since:"1912-07-30",until:"1926-12-24",offset:1,name:"大正",narrow:"㍽",abbr:"T"},{since:"1873-01-01",until:"1912-07-29",offset:6,name:"明治",narrow:"㍾",abbr:"M"},{since:"0001-01-01",until:"1873-12-31",offset:1,name:"西暦",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"紀元前",narrow:"BC",abbr:"BC"}],eraYearOrdinalRegex:/(元|\d+)年/,eraYearOrdinalParse:function(e,t){return"元"===t[1]?1:parseInt(t[1]||e,10)},months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日 dddd HH:mm",l:"YYYY/MM/DD",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日(ddd) HH:mm"},meridiemParse:/午前|午後/i,isPM:function(e){return"午後"===e},meridiem:function(e,t,n){return e<12?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:function(e){return e.week()!==this.week()?"[来週]dddd LT":"dddd LT"},lastDay:"[昨日] LT",lastWeek:function(e){return this.week()!==e.week()?"[先週]dddd LT":"dddd LT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}日/,ordinal:function(e,t){switch(t){case"y":return 1===e?"元年":e+"年";case"d":case"D":case"DDD":return e+"日";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",ss:"%d秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/jv.js":function(e,t,n){!function(e){"use strict";e.defineLocale("jv",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des".split("_"),weekdays:"Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu".split("_"),weekdaysShort:"Min_Sen_Sel_Reb_Kem_Jem_Sep".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sp".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/enjing|siyang|sonten|ndalu/,meridiemHour:function(e,t){return 12===e&&(e=0),"enjing"===t?e:"siyang"===t?e>=11?e:e+12:"sonten"===t||"ndalu"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"enjing":e<15?"siyang":e<19?"sonten":"ndalu"},calendar:{sameDay:"[Dinten puniko pukul] LT",nextDay:"[Mbenjang pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kala wingi pukul] LT",lastWeek:"dddd [kepengker pukul] LT",sameElse:"L"},relativeTime:{future:"wonten ing %s",past:"%s ingkang kepengker",s:"sawetawis detik",ss:"%d detik",m:"setunggal menit",mm:"%d menit",h:"setunggal jam",hh:"%d jam",d:"sedinten",dd:"%d dinten",M:"sewulan",MM:"%d wulan",y:"setaun",yy:"%d taun"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ka.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ka",{months:"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),monthsShort:"იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),weekdays:{standalone:"კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),format:"კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_"),isFormat:/(წინა|შემდეგ)/},weekdaysShort:"კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),weekdaysMin:"კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[დღეს] LT[-ზე]",nextDay:"[ხვალ] LT[-ზე]",lastDay:"[გუშინ] LT[-ზე]",nextWeek:"[შემდეგ] dddd LT[-ზე]",lastWeek:"[წინა] dddd LT-ზე",sameElse:"L"},relativeTime:{future:function(e){return e.replace(/(წამ|წუთ|საათ|წელ|დღ|თვ)(ი|ე)/,(function(e,t,n){return"ი"===n?t+"ში":t+n+"ში"}))},past:function(e){return/(წამი|წუთი|საათი|დღე|თვე)/.test(e)?e.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(e)?e.replace(/წელი$/,"წლის წინ"):e},s:"რამდენიმე წამი",ss:"%d წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},dayOfMonthOrdinalParse:/0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,ordinal:function(e){return 0===e?e:1===e?e+"-ლი":e<20||e<=100&&e%20==0||e%100==0?"მე-"+e:e+"-ე"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/kk.js":function(e,t,n){!function(e){"use strict";var t={0:"-ші",1:"-ші",2:"-ші",3:"-ші",4:"-ші",5:"-ші",6:"-шы",7:"-ші",8:"-ші",9:"-шы",10:"-шы",20:"-шы",30:"-шы",40:"-шы",50:"-ші",60:"-шы",70:"-ші",80:"-ші",90:"-шы",100:"-ші"};e.defineLocale("kk",{months:"қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан".split("_"),monthsShort:"қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел".split("_"),weekdays:"жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі".split("_"),weekdaysShort:"жек_дүй_сей_сәр_бей_жұм_сен".split("_"),weekdaysMin:"жк_дй_сй_ср_бй_жм_сн".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгін сағат] LT",nextDay:"[Ертең сағат] LT",nextWeek:"dddd [сағат] LT",lastDay:"[Кеше сағат] LT",lastWeek:"[Өткен аптаның] dddd [сағат] LT",sameElse:"L"},relativeTime:{future:"%s ішінде",past:"%s бұрын",s:"бірнеше секунд",ss:"%d секунд",m:"бір минут",mm:"%d минут",h:"бір сағат",hh:"%d сағат",d:"бір күн",dd:"%d күн",M:"бір ай",MM:"%d ай",y:"бір жыл",yy:"%d жыл"},dayOfMonthOrdinalParse:/\d{1,2}-(ші|шы)/,ordinal:function(e){return e+(t[e]||t[e%10]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/km.js":function(e,t,n){!function(e){"use strict";var t={1:"១",2:"២",3:"៣",4:"៤",5:"៥",6:"៦",7:"៧",8:"៨",9:"៩",0:"០"},n={"១":"1","២":"2","៣":"3","៤":"4","៥":"5","៦":"6","៧":"7","៨":"8","៩":"9","០":"0"};e.defineLocale("km",{months:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),monthsShort:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),weekdays:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysShort:"អា_ច_អ_ព_ព្រ_សុ_ស".split("_"),weekdaysMin:"អា_ច_អ_ព_ព្រ_សុ_ស".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/ព្រឹក|ល្ងាច/,isPM:function(e){return"ល្ងាច"===e},meridiem:function(e,t,n){return e<12?"ព្រឹក":"ល្ងាច"},calendar:{sameDay:"[ថ្ងៃនេះ ម៉ោង] LT",nextDay:"[ស្អែក ម៉ោង] LT",nextWeek:"dddd [ម៉ោង] LT",lastDay:"[ម្សិលមិញ ម៉ោង] LT",lastWeek:"dddd [សប្តាហ៍មុន] [ម៉ោង] LT",sameElse:"L"},relativeTime:{future:"%sទៀត",past:"%sមុន",s:"ប៉ុន្មានវិនាទី",ss:"%d វិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},dayOfMonthOrdinalParse:/ទី\d{1,2}/,ordinal:"ទី%d",preparse:function(e){return e.replace(/[១២៣៤៥៦៧៨៩០]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/kn.js":function(e,t,n){!function(e){"use strict";var t={1:"೧",2:"೨",3:"೩",4:"೪",5:"೫",6:"೬",7:"೭",8:"೮",9:"೯",0:"೦"},n={"೧":"1","೨":"2","೩":"3","೪":"4","೫":"5","೬":"6","೭":"7","೮":"8","೯":"9","೦":"0"};e.defineLocale("kn",{months:"ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್".split("_"),monthsShort:"ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ".split("_"),monthsParseExact:!0,weekdays:"ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ".split("_"),weekdaysShort:"ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ".split("_"),weekdaysMin:"ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[ಇಂದು] LT",nextDay:"[ನಾಳೆ] LT",nextWeek:"dddd, LT",lastDay:"[ನಿನ್ನೆ] LT",lastWeek:"[ಕೊನೆಯ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ನಂತರ",past:"%s ಹಿಂದೆ",s:"ಕೆಲವು ಕ್ಷಣಗಳು",ss:"%d ಸೆಕೆಂಡುಗಳು",m:"ಒಂದು ನಿಮಿಷ",mm:"%d ನಿಮಿಷ",h:"ಒಂದು ಗಂಟೆ",hh:"%d ಗಂಟೆ",d:"ಒಂದು ದಿನ",dd:"%d ದಿನ",M:"ಒಂದು ತಿಂಗಳು",MM:"%d ತಿಂಗಳು",y:"ಒಂದು ವರ್ಷ",yy:"%d ವರ್ಷ"},preparse:function(e){return e.replace(/[೧೨೩೪೫೬೭೮೯೦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/,meridiemHour:function(e,t){return 12===e&&(e=0),"ರಾತ್ರಿ"===t?e<4?e:e+12:"ಬೆಳಿಗ್ಗೆ"===t?e:"ಮಧ್ಯಾಹ್ನ"===t?e>=10?e:e+12:"ಸಂಜೆ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"ರಾತ್ರಿ":e<10?"ಬೆಳಿಗ್ಗೆ":e<17?"ಮಧ್ಯಾಹ್ನ":e<20?"ಸಂಜೆ":"ರಾತ್ರಿ"},dayOfMonthOrdinalParse:/\d{1,2}(ನೇ)/,ordinal:function(e){return e+"ನೇ"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ko.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h:mm",LLLL:"YYYY년 MMMM D일 dddd A h:mm",l:"YYYY.MM.DD.",ll:"YYYY년 MMMM D일",lll:"YYYY년 MMMM D일 A h:mm",llll:"YYYY년 MMMM D일 dddd A h:mm"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇 초",ss:"%d초",m:"1분",mm:"%d분",h:"한 시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한 달",MM:"%d달",y:"일 년",yy:"%d년"},dayOfMonthOrdinalParse:/\d{1,2}(일|월|주)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"일";case"M":return e+"월";case"w":case"W":return e+"주";default:return e}},meridiemParse:/오전|오후/,isPM:function(e){return"오후"===e},meridiem:function(e,t,n){return e<12?"오전":"오후"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ku.js":function(e,t,n){!function(e){"use strict";var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},o=["کانونی دووەم","شوبات","ئازار","نیسان","ئایار","حوزەیران","تەمموز","ئاب","ئەیلوول","تشرینی یەكەم","تشرینی دووەم","كانونی یەکەم"];e.defineLocale("ku",{months:o,monthsShort:o,weekdays:"یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌".split("_"),weekdaysShort:"یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌".split("_"),weekdaysMin:"ی_د_س_چ_پ_ه_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/ئێواره‌|به‌یانی/,isPM:function(e){return/ئێواره‌/.test(e)},meridiem:function(e,t,n){return e<12?"به‌یانی":"ئێواره‌"},calendar:{sameDay:"[ئه‌مرۆ كاتژمێر] LT",nextDay:"[به‌یانی كاتژمێر] LT",nextWeek:"dddd [كاتژمێر] LT",lastDay:"[دوێنێ كاتژمێر] LT",lastWeek:"dddd [كاتژمێر] LT",sameElse:"L"},relativeTime:{future:"له‌ %s",past:"%s",s:"چه‌ند چركه‌یه‌ك",ss:"چركه‌ %d",m:"یه‌ك خوله‌ك",mm:"%d خوله‌ك",h:"یه‌ك كاتژمێر",hh:"%d كاتژمێر",d:"یه‌ك ڕۆژ",dd:"%d ڕۆژ",M:"یه‌ك مانگ",MM:"%d مانگ",y:"یه‌ك ساڵ",yy:"%d ساڵ"},preparse:function(e){return e.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ky.js":function(e,t,n){!function(e){"use strict";var t={0:"-чү",1:"-чи",2:"-чи",3:"-чү",4:"-чү",5:"-чи",6:"-чы",7:"-чи",8:"-чи",9:"-чу",10:"-чу",20:"-чы",30:"-чу",40:"-чы",50:"-чү",60:"-чы",70:"-чи",80:"-чи",90:"-чу",100:"-чү"};e.defineLocale("ky",{months:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),monthsShort:"янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),weekdays:"Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби".split("_"),weekdaysShort:"Жек_Дүй_Шей_Шар_Бей_Жум_Ише".split("_"),weekdaysMin:"Жк_Дй_Шй_Шр_Бй_Жм_Иш".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгүн саат] LT",nextDay:"[Эртең саат] LT",nextWeek:"dddd [саат] LT",lastDay:"[Кечээ саат] LT",lastWeek:"[Өткөн аптанын] dddd [күнү] [саат] LT",sameElse:"L"},relativeTime:{future:"%s ичинде",past:"%s мурун",s:"бирнече секунд",ss:"%d секунд",m:"бир мүнөт",mm:"%d мүнөт",h:"бир саат",hh:"%d саат",d:"бир күн",dd:"%d күн",M:"бир ай",MM:"%d ай",y:"бир жыл",yy:"%d жыл"},dayOfMonthOrdinalParse:/\d{1,2}-(чи|чы|чү|чу)/,ordinal:function(e){return e+(t[e]||t[e%10]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lb.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return t?r[n][0]:r[n][1]}function n(e){if(e=parseInt(e,10),isNaN(e))return!1;if(e<0)return!0;if(e<10)return 4<=e&&e<=7;if(e<100){var t=e%10;return n(0===t?e/10:t)}if(e<1e4){for(;e>=10;)e/=10;return n(e)}return n(e/=1e3)}e.defineLocale("lb",{months:"Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mé_Dë_Më_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm [Auer]",LTS:"H:mm:ss [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm [Auer]",LLLL:"dddd, D. MMMM YYYY H:mm [Auer]"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gëschter um] LT",lastWeek:function(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:return"[Leschte] dddd [um] LT"}}},relativeTime:{future:function(e){return n(e.substr(0,e.indexOf(" ")))?"a "+e:"an "+e},past:function(e){return n(e.substr(0,e.indexOf(" ")))?"viru "+e:"virun "+e},s:"e puer Sekonnen",ss:"%d Sekonnen",m:t,mm:"%d Minutten",h:t,hh:"%d Stonnen",d:t,dd:"%d Deeg",M:t,MM:"%d Méint",y:t,yy:"%d Joer"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("lo",{months:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),monthsShort:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),weekdays:"ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysShort:"ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysMin:"ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"ວັນdddd D MMMM YYYY HH:mm"},meridiemParse:/ຕອນເຊົ້າ|ຕອນແລງ/,isPM:function(e){return"ຕອນແລງ"===e},meridiem:function(e,t,n){return e<12?"ຕອນເຊົ້າ":"ຕອນແລງ"},calendar:{sameDay:"[ມື້ນີ້ເວລາ] LT",nextDay:"[ມື້ອື່ນເວລາ] LT",nextWeek:"[ວັນ]dddd[ໜ້າເວລາ] LT",lastDay:"[ມື້ວານນີ້ເວລາ] LT",lastWeek:"[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT",sameElse:"L"},relativeTime:{future:"ອີກ %s",past:"%sຜ່ານມາ",s:"ບໍ່ເທົ່າໃດວິນາທີ",ss:"%d ວິນາທີ",m:"1 ນາທີ",mm:"%d ນາທີ",h:"1 ຊົ່ວໂມງ",hh:"%d ຊົ່ວໂມງ",d:"1 ມື້",dd:"%d ມື້",M:"1 ເດືອນ",MM:"%d ເດືອນ",y:"1 ປີ",yy:"%d ປີ"},dayOfMonthOrdinalParse:/(ທີ່)\d{1,2}/,ordinal:function(e){return"ທີ່"+e}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lt.js":function(e,t,n){!function(e){"use strict";var t={ss:"sekundė_sekundžių_sekundes",m:"minutė_minutės_minutę",mm:"minutės_minučių_minutes",h:"valanda_valandos_valandą",hh:"valandos_valandų_valandas",d:"diena_dienos_dieną",dd:"dienos_dienų_dienas",M:"mėnuo_mėnesio_mėnesį",MM:"mėnesiai_mėnesių_mėnesius",y:"metai_metų_metus",yy:"metai_metų_metus"};function n(e,t,n,o){return t?r(n)[0]:o?r(n)[1]:r(n)[2]}function o(e){return e%10==0||e>10&&e<20}function r(e){return t[e].split("_")}function s(e,t,s,a){var i=e+" ";return 1===e?i+n(0,t,s[0],a):t?i+(o(e)?r(s)[1]:r(s)[0]):a?i+r(s)[1]:i+(o(e)?r(s)[1]:r(s)[2])}e.defineLocale("lt",{months:{format:"sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio".split("_"),standalone:"sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis".split("_"),isFormat:/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/},monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:{format:"sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį".split("_"),standalone:"sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis".split("_"),isFormat:/dddd HH:mm/},weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_Šeš".split("_"),weekdaysMin:"S_P_A_T_K_Pn_Š".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], HH:mm [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], HH:mm [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]"},calendar:{sameDay:"[Šiandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[Praėjusį] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prieš %s",s:function(e,t,n,o){return t?"kelios sekundės":o?"kelių sekundžių":"kelias sekundes"},ss:s,m:n,mm:s,h:n,hh:s,d:n,dd:s,M:n,MM:s,y:n,yy:s},dayOfMonthOrdinalParse:/\d{1,2}-oji/,ordinal:function(e){return e+"-oji"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lv.js":function(e,t,n){!function(e){"use strict";var t={ss:"sekundes_sekundēm_sekunde_sekundes".split("_"),m:"minūtes_minūtēm_minūte_minūtes".split("_"),mm:"minūtes_minūtēm_minūte_minūtes".split("_"),h:"stundas_stundām_stunda_stundas".split("_"),hh:"stundas_stundām_stunda_stundas".split("_"),d:"dienas_dienām_diena_dienas".split("_"),dd:"dienas_dienām_diena_dienas".split("_"),M:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),MM:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),y:"gada_gadiem_gads_gadi".split("_"),yy:"gada_gadiem_gads_gadi".split("_")};function n(e,t,n){return n?t%10==1&&t%100!=11?e[2]:e[3]:t%10==1&&t%100!=11?e[0]:e[1]}function o(e,o,r){return e+" "+n(t[r],e,o)}function r(e,o,r){return n(t[r],e,o)}e.defineLocale("lv",{months:"janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),weekdays:"svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY.",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, HH:mm",LLLL:"YYYY. [gada] D. MMMM, dddd, HH:mm"},calendar:{sameDay:"[Šodien pulksten] LT",nextDay:"[Rīt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pagājušā] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"pēc %s",past:"pirms %s",s:function(e,t){return t?"dažas sekundes":"dažām sekundēm"},ss:o,m:r,mm:o,h:r,hh:o,d:r,dd:o,M:r,MM:o,y:r,yy:o},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/me.js":function(e,t,n){!function(e){"use strict";var t={words:{ss:["sekund","sekunda","sekundi"],m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mjesec","mjeseca","mjeseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(e,t){return 1===e?t[0]:e>=2&&e<=4?t[1]:t[2]},translate:function(e,n,o){var r=t.words[o];return 1===o.length?n?r[0]:r[1]:e+" "+t.correctGrammaticalCase(e,r)}};e.defineLocale("me",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sjutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){return["[prošle] [nedjelje] [u] LT","[prošlog] [ponedjeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srijede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"nekoliko sekundi",ss:t.translate,m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:"dan",dd:t.translate,M:"mjesec",MM:t.translate,y:"godinu",yy:t.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mi.js":function(e,t,n){!function(e){"use strict";e.defineLocale("mi",{months:"Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea".split("_"),monthsShort:"Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki".split("_"),monthsRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i,weekdays:"Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei".split("_"),weekdaysShort:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),weekdaysMin:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [i] HH:mm",LLLL:"dddd, D MMMM YYYY [i] HH:mm"},calendar:{sameDay:"[i teie mahana, i] LT",nextDay:"[apopo i] LT",nextWeek:"dddd [i] LT",lastDay:"[inanahi i] LT",lastWeek:"dddd [whakamutunga i] LT",sameElse:"L"},relativeTime:{future:"i roto i %s",past:"%s i mua",s:"te hēkona ruarua",ss:"%d hēkona",m:"he meneti",mm:"%d meneti",h:"te haora",hh:"%d haora",d:"he ra",dd:"%d ra",M:"he marama",MM:"%d marama",y:"he tau",yy:"%d tau"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mk.js":function(e,t,n){!function(e){"use strict";e.defineLocale("mk",{months:"јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),monthsShort:"јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),weekdays:"недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),weekdaysShort:"нед_пон_вто_сре_чет_пет_саб".split("_"),weekdaysMin:"нe_пo_вт_ср_че_пе_сa".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Денес во] LT",nextDay:"[Утре во] LT",nextWeek:"[Во] dddd [во] LT",lastDay:"[Вчера во] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Изминатата] dddd [во] LT";case 1:case 2:case 4:case 5:return"[Изминатиот] dddd [во] LT"}},sameElse:"L"},relativeTime:{future:"за %s",past:"пред %s",s:"неколку секунди",ss:"%d секунди",m:"една минута",mm:"%d минути",h:"еден час",hh:"%d часа",d:"еден ден",dd:"%d дена",M:"еден месец",MM:"%d месеци",y:"една година",yy:"%d години"},dayOfMonthOrdinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(e){var t=e%10,n=e%100;return 0===e?e+"-ев":0===n?e+"-ен":n>10&&n<20?e+"-ти":1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ml.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ml",{months:"ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),monthsShort:"ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),monthsParseExact:!0,weekdays:"ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച".split("_"),weekdaysShort:"ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി".split("_"),weekdaysMin:"ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ".split("_"),longDateFormat:{LT:"A h:mm -നു",LTS:"A h:mm:ss -നു",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm -നു",LLLL:"dddd, D MMMM YYYY, A h:mm -നു"},calendar:{sameDay:"[ഇന്ന്] LT",nextDay:"[നാളെ] LT",nextWeek:"dddd, LT",lastDay:"[ഇന്നലെ] LT",lastWeek:"[കഴിഞ്ഞ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s കഴിഞ്ഞ്",past:"%s മുൻപ്",s:"അൽപ നിമിഷങ്ങൾ",ss:"%d സെക്കൻഡ്",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiemParse:/രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,meridiemHour:function(e,t){return 12===e&&(e=0),"രാത്രി"===t&&e>=4||"ഉച്ച കഴിഞ്ഞ്"===t||"വൈകുന്നേരം"===t?e+12:e},meridiem:function(e,t,n){return e<4?"രാത്രി":e<12?"രാവിലെ":e<17?"ഉച്ച കഴിഞ്ഞ്":e<20?"വൈകുന്നേരം":"രാത്രി"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mn.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){switch(n){case"s":return t?"хэдхэн секунд":"хэдхэн секундын";case"ss":return e+(t?" секунд":" секундын");case"m":case"mm":return e+(t?" минут":" минутын");case"h":case"hh":return e+(t?" цаг":" цагийн");case"d":case"dd":return e+(t?" өдөр":" өдрийн");case"M":case"MM":return e+(t?" сар":" сарын");case"y":case"yy":return e+(t?" жил":" жилийн");default:return e}}e.defineLocale("mn",{months:"Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар".split("_"),monthsShort:"1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар".split("_"),monthsParseExact:!0,weekdays:"Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба".split("_"),weekdaysShort:"Ням_Дав_Мяг_Лха_Пүр_Баа_Бям".split("_"),weekdaysMin:"Ня_Да_Мя_Лх_Пү_Ба_Бя".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY оны MMMMын D",LLL:"YYYY оны MMMMын D HH:mm",LLLL:"dddd, YYYY оны MMMMын D HH:mm"},meridiemParse:/ҮӨ|ҮХ/i,isPM:function(e){return"ҮХ"===e},meridiem:function(e,t,n){return e<12?"ҮӨ":"ҮХ"},calendar:{sameDay:"[Өнөөдөр] LT",nextDay:"[Маргааш] LT",nextWeek:"[Ирэх] dddd LT",lastDay:"[Өчигдөр] LT",lastWeek:"[Өнгөрсөн] dddd LT",sameElse:"L"},relativeTime:{future:"%s дараа",past:"%s өмнө",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2} өдөр/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+" өдөр";default:return e}}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mr.js":function(e,t,n){!function(e){"use strict";var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};function o(e,t,n,o){var r="";if(t)switch(n){case"s":r="काही सेकंद";break;case"ss":r="%d सेकंद";break;case"m":r="एक मिनिट";break;case"mm":r="%d मिनिटे";break;case"h":r="एक तास";break;case"hh":r="%d तास";break;case"d":r="एक दिवस";break;case"dd":r="%d दिवस";break;case"M":r="एक महिना";break;case"MM":r="%d महिने";break;case"y":r="एक वर्ष";break;case"yy":r="%d वर्षे"}else switch(n){case"s":r="काही सेकंदां";break;case"ss":r="%d सेकंदां";break;case"m":r="एका मिनिटा";break;case"mm":r="%d मिनिटां";break;case"h":r="एका तासा";break;case"hh":r="%d तासां";break;case"d":r="एका दिवसा";break;case"dd":r="%d दिवसां";break;case"M":r="एका महिन्या";break;case"MM":r="%d महिन्यां";break;case"y":r="एका वर्षा";break;case"yy":r="%d वर्षां"}return r.replace(/%d/i,e)}e.defineLocale("mr",{months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm वाजता",LTS:"A h:mm:ss वाजता",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm वाजता",LLLL:"dddd, D MMMM YYYY, A h:mm वाजता"},calendar:{sameDay:"[आज] LT",nextDay:"[उद्या] LT",nextWeek:"dddd, LT",lastDay:"[काल] LT",lastWeek:"[मागील] dddd, LT",sameElse:"L"},relativeTime:{future:"%sमध्ये",past:"%sपूर्वी",s:o,ss:o,m:o,mm:o,h:o,hh:o,d:o,dd:o,M:o,MM:o,y:o,yy:o},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/पहाटे|सकाळी|दुपारी|सायंकाळी|रात्री/,meridiemHour:function(e,t){return 12===e&&(e=0),"पहाटे"===t||"सकाळी"===t?e:"दुपारी"===t||"सायंकाळी"===t||"रात्री"===t?e>=12?e:e+12:void 0},meridiem:function(e,t,n){return e>=0&&e<6?"पहाटे":e<12?"सकाळी":e<17?"दुपारी":e<20?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ms-my.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"tengahari"===t?e>=11?e:e+12:"petang"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"pagi":e<15?"tengahari":e<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ms.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ms",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"tengahari"===t?e>=11?e:e+12:"petang"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"pagi":e<15?"tengahari":e<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mt.js":function(e,t,n){!function(e){"use strict";e.defineLocale("mt",{months:"Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru".split("_"),monthsShort:"Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ".split("_"),weekdays:"Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt".split("_"),weekdaysShort:"Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib".split("_"),weekdaysMin:"Ħa_Tn_Tl_Er_Ħa_Ġi_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Illum fil-]LT",nextDay:"[Għada fil-]LT",nextWeek:"dddd [fil-]LT",lastDay:"[Il-bieraħ fil-]LT",lastWeek:"dddd [li għadda] [fil-]LT",sameElse:"L"},relativeTime:{future:"f’ %s",past:"%s ilu",s:"ftit sekondi",ss:"%d sekondi",m:"minuta",mm:"%d minuti",h:"siegħa",hh:"%d siegħat",d:"ġurnata",dd:"%d ġranet",M:"xahar",MM:"%d xhur",y:"sena",yy:"%d sni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/my.js":function(e,t,n){!function(e){"use strict";var t={1:"၁",2:"၂",3:"၃",4:"၄",5:"၅",6:"၆",7:"၇",8:"၈",9:"၉",0:"၀"},n={"၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","၀":"0"};e.defineLocale("my",{months:"ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ".split("_"),monthsShort:"ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ".split("_"),weekdays:"တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ".split("_"),weekdaysShort:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),weekdaysMin:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ယနေ.] LT [မှာ]",nextDay:"[မနက်ဖြန်] LT [မှာ]",nextWeek:"dddd LT [မှာ]",lastDay:"[မနေ.က] LT [မှာ]",lastWeek:"[ပြီးခဲ့သော] dddd LT [မှာ]",sameElse:"L"},relativeTime:{future:"လာမည့် %s မှာ",past:"လွန်ခဲ့သော %s က",s:"စက္ကန်.အနည်းငယ်",ss:"%d စက္ကန့်",m:"တစ်မိနစ်",mm:"%d မိနစ်",h:"တစ်နာရီ",hh:"%d နာရီ",d:"တစ်ရက်",dd:"%d ရက်",M:"တစ်လ",MM:"%d လ",y:"တစ်နှစ်",yy:"%d နှစ်"},preparse:function(e){return e.replace(/[၁၂၃၄၅၆၇၈၉၀]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nb.js":function(e,t,n){!function(e){"use strict";e.defineLocale("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] HH:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"noen sekunder",ss:"%d sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",w:"en uke",ww:"%d uker",M:"en måned",MM:"%d måneder",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ne.js":function(e,t,n){!function(e){"use strict";var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};e.defineLocale("ne",{months:"जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),monthsShort:"जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),monthsParseExact:!0,weekdays:"आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),weekdaysShort:"आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),weekdaysMin:"आ._सो._मं._बु._बि._शु._श.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"Aको h:mm बजे",LTS:"Aको h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, Aको h:mm बजे",LLLL:"dddd, D MMMM YYYY, Aको h:mm बजे"},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/राति|बिहान|दिउँसो|साँझ/,meridiemHour:function(e,t){return 12===e&&(e=0),"राति"===t?e<4?e:e+12:"बिहान"===t?e:"दिउँसो"===t?e>=10?e:e+12:"साँझ"===t?e+12:void 0},meridiem:function(e,t,n){return e<3?"राति":e<12?"बिहान":e<16?"दिउँसो":e<20?"साँझ":"राति"},calendar:{sameDay:"[आज] LT",nextDay:"[भोलि] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] LT",lastWeek:"[गएको] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%sमा",past:"%s अगाडि",s:"केही क्षण",ss:"%d सेकेण्ड",m:"एक मिनेट",mm:"%d मिनेट",h:"एक घण्टा",hh:"%d घण्टा",d:"एक दिन",dd:"%d दिन",M:"एक महिना",MM:"%d महिना",y:"एक बर्ष",yy:"%d बर्ष"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nl-be.js":function(e,t,n){!function(e){"use strict";var t="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),o=[/^jan/i,/^feb/i,/^maart|mrt.?$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],r=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;e.defineLocale("nl-be",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nl.js":function(e,t,n){!function(e){"use strict";var t="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),o=[/^jan/i,/^feb/i,/^maart|mrt.?$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],r=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;e.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",w:"één week",ww:"%d weken",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"su._må._ty._on._to._fr._lau.".split("_"),weekdaysMin:"su_må_ty_on_to_fr_la".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I går klokka] LT",lastWeek:"[Føregåande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s sidan",s:"nokre sekund",ss:"%d sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",w:"ei veke",ww:"%d veker",M:"ein månad",MM:"%d månader",y:"eit år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/oc-lnc.js":function(e,t,n){!function(e){"use strict";e.defineLocale("oc-lnc",{months:{standalone:"genièr_febrièr_març_abril_mai_junh_julhet_agost_setembre_octòbre_novembre_decembre".split("_"),format:"de genièr_de febrièr_de març_d'abril_de mai_de junh_de julhet_d'agost_de setembre_d'octòbre_de novembre_de decembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._març_abr._mai_junh_julh._ago._set._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"dimenge_diluns_dimars_dimècres_dijòus_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dm._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dm_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:"[uèi a] LT",nextDay:"[deman a] LT",nextWeek:"dddd [a] LT",lastDay:"[ièr a] LT",lastWeek:"dddd [passat a] LT",sameElse:"L"},relativeTime:{future:"d'aquí %s",past:"fa %s",s:"unas segondas",ss:"%d segondas",m:"una minuta",mm:"%d minutas",h:"una ora",hh:"%d oras",d:"un jorn",dd:"%d jorns",M:"un mes",MM:"%d meses",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(e,t){var n=1===e?"r":2===e?"n":3===e?"r":4===e?"t":"è";return"w"!==t&&"W"!==t||(n="a"),e+n},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pa-in.js":function(e,t,n){!function(e){"use strict";var t={1:"੧",2:"੨",3:"੩",4:"੪",5:"੫",6:"੬",7:"੭",8:"੮",9:"੯",0:"੦"},n={"੧":"1","੨":"2","੩":"3","੪":"4","੫":"5","੬":"6","੭":"7","੮":"8","੯":"9","੦":"0"};e.defineLocale("pa-in",{months:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),monthsShort:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),weekdays:"ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ".split("_"),weekdaysShort:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),weekdaysMin:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),longDateFormat:{LT:"A h:mm ਵਜੇ",LTS:"A h:mm:ss ਵਜੇ",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm ਵਜੇ",LLLL:"dddd, D MMMM YYYY, A h:mm ਵਜੇ"},calendar:{sameDay:"[ਅਜ] LT",nextDay:"[ਕਲ] LT",nextWeek:"[ਅਗਲਾ] dddd, LT",lastDay:"[ਕਲ] LT",lastWeek:"[ਪਿਛਲੇ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ਵਿੱਚ",past:"%s ਪਿਛਲੇ",s:"ਕੁਝ ਸਕਿੰਟ",ss:"%d ਸਕਿੰਟ",m:"ਇਕ ਮਿੰਟ",mm:"%d ਮਿੰਟ",h:"ਇੱਕ ਘੰਟਾ",hh:"%d ਘੰਟੇ",d:"ਇੱਕ ਦਿਨ",dd:"%d ਦਿਨ",M:"ਇੱਕ ਮਹੀਨਾ",MM:"%d ਮਹੀਨੇ",y:"ਇੱਕ ਸਾਲ",yy:"%d ਸਾਲ"},preparse:function(e){return e.replace(/[੧੨੩੪੫੬੭੮੯੦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,meridiemHour:function(e,t){return 12===e&&(e=0),"ਰਾਤ"===t?e<4?e:e+12:"ਸਵੇਰ"===t?e:"ਦੁਪਹਿਰ"===t?e>=10?e:e+12:"ਸ਼ਾਮ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"ਰਾਤ":e<10?"ਸਵੇਰ":e<17?"ਦੁਪਹਿਰ":e<20?"ਸ਼ਾਮ":"ਰਾਤ"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pl.js":function(e,t,n){!function(e){"use strict";var t="styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"),n="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),o=[/^sty/i,/^lut/i,/^mar/i,/^kwi/i,/^maj/i,/^cze/i,/^lip/i,/^sie/i,/^wrz/i,/^paź/i,/^lis/i,/^gru/i];function r(e){return e%10<5&&e%10>1&&~~(e/10)%10!=1}function s(e,t,n){var o=e+" ";switch(n){case"ss":return o+(r(e)?"sekundy":"sekund");case"m":return t?"minuta":"minutę";case"mm":return o+(r(e)?"minuty":"minut");case"h":return t?"godzina":"godzinę";case"hh":return o+(r(e)?"godziny":"godzin");case"ww":return o+(r(e)?"tygodnie":"tygodni");case"MM":return o+(r(e)?"miesiące":"miesięcy");case"yy":return o+(r(e)?"lata":"lat")}}e.defineLocale("pl",{months:function(e,o){return e?/D MMMM/.test(o)?n[e.month()]:t[e.month()]:t},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"ndz_pon_wt_śr_czw_pt_sob".split("_"),weekdaysMin:"Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:function(){switch(this.day()){case 0:return"[W niedzielę o] LT";case 2:return"[We wtorek o] LT";case 3:return"[W środę o] LT";case 6:return"[W sobotę o] LT";default:return"[W] dddd [o] LT"}},lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",ss:s,m:s,mm:s,h:s,hh:s,d:"1 dzień",dd:"%d dni",w:"tydzień",ww:s,M:"miesiąc",MM:s,y:"rok",yy:s},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pt-br.js":function(e,t,n){!function(e){"use strict";e.defineLocale("pt-br",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sáb".split("_"),weekdaysMin:"do_2ª_3ª_4ª_5ª_6ª_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"poucos segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",invalidDate:"Data inválida"})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pt.js":function(e,t,n){!function(e){"use strict";e.defineLocale("pt",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Do_2ª_3ª_4ª_5ª_6ª_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",w:"uma semana",ww:"%d semanas",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ro.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){var o=" ";return(e%100>=20||e>=100&&e%100==0)&&(o=" de "),e+o+{ss:"secunde",mm:"minute",hh:"ore",dd:"zile",ww:"săptămâni",MM:"luni",yy:"ani"}[n]}e.defineLocale("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._feb._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",ss:t,m:"un minut",mm:t,h:"o oră",hh:t,d:"o zi",dd:t,w:"o săptămână",ww:t,M:"o lună",MM:t,y:"un an",yy:t},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ru.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return"m"===n?t?"минута":"минуту":e+" "+(o=+e,r={ss:t?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:t?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",ww:"неделя_недели_недель",MM:"месяц_месяца_месяцев",yy:"год_года_лет"}[n].split("_"),o%10==1&&o%100!=11?r[0]:o%10>=2&&o%10<=4&&(o%100<10||o%100>=20)?r[1]:r[2]);var o,r}var n=[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i];e.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:n,longMonthsParse:n,shortMonthsParse:n,monthsRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsShortRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsStrictRegex:/^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,monthsShortStrictRegex:/^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., H:mm",LLLL:"dddd, D MMMM YYYY г., H:mm"},calendar:{sameDay:"[Сегодня, в] LT",nextDay:"[Завтра, в] LT",lastDay:"[Вчера, в] LT",nextWeek:function(e){if(e.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В следующее] dddd, [в] LT";case 1:case 2:case 4:return"[В следующий] dddd, [в] LT";case 3:case 5:case 6:return"[В следующую] dddd, [в] LT"}},lastWeek:function(e){if(e.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В прошлое] dddd, [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd, [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd, [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",ss:t,m:t,mm:t,h:"час",hh:t,d:"день",dd:t,w:"неделя",ww:t,M:"месяц",MM:t,y:"год",yy:t},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(e){return/^(дня|вечера)$/.test(e)},meridiem:function(e,t,n){return e<4?"ночи":e<12?"утра":e<17?"дня":"вечера"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":return e+"-й";case"D":return e+"-го";case"w":case"W":return e+"-я";default:return e}},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sd.js":function(e,t,n){!function(e){"use strict";var t=["جنوري","فيبروري","مارچ","اپريل","مئي","جون","جولاءِ","آگسٽ","سيپٽمبر","آڪٽوبر","نومبر","ڊسمبر"],n=["آچر","سومر","اڱارو","اربع","خميس","جمع","ڇنڇر"];e.defineLocale("sd",{months:t,monthsShort:t,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(e){return"شام"===e},meridiem:function(e,t,n){return e<12?"صبح":"شام"},calendar:{sameDay:"[اڄ] LT",nextDay:"[سڀاڻي] LT",nextWeek:"dddd [اڳين هفتي تي] LT",lastDay:"[ڪالهه] LT",lastWeek:"[گزريل هفتي] dddd [تي] LT",sameElse:"L"},relativeTime:{future:"%s پوء",past:"%s اڳ",s:"چند سيڪنڊ",ss:"%d سيڪنڊ",m:"هڪ منٽ",mm:"%d منٽ",h:"هڪ ڪلاڪ",hh:"%d ڪلاڪ",d:"هڪ ڏينهن",dd:"%d ڏينهن",M:"هڪ مهينو",MM:"%d مهينا",y:"هڪ سال",yy:"%d سال"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/se.js":function(e,t,n){!function(e){"use strict";e.defineLocale("se",{months:"ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu".split("_"),monthsShort:"ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov".split("_"),weekdays:"sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat".split("_"),weekdaysShort:"sotn_vuos_maŋ_gask_duor_bear_láv".split("_"),weekdaysMin:"s_v_m_g_d_b_L".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"MMMM D. [b.] YYYY",LLL:"MMMM D. [b.] YYYY [ti.] HH:mm",LLLL:"dddd, MMMM D. [b.] YYYY [ti.] HH:mm"},calendar:{sameDay:"[otne ti] LT",nextDay:"[ihttin ti] LT",nextWeek:"dddd [ti] LT",lastDay:"[ikte ti] LT",lastWeek:"[ovddit] dddd [ti] LT",sameElse:"L"},relativeTime:{future:"%s geažes",past:"maŋit %s",s:"moadde sekunddat",ss:"%d sekunddat",m:"okta minuhta",mm:"%d minuhtat",h:"okta diimmu",hh:"%d diimmut",d:"okta beaivi",dd:"%d beaivvit",M:"okta mánnu",MM:"%d mánut",y:"okta jahki",yy:"%d jagit"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/si.js":function(e,t,n){!function(e){"use strict";e.defineLocale("si",{months:"ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්".split("_"),monthsShort:"ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ".split("_"),weekdays:"ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා".split("_"),weekdaysShort:"ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන".split("_"),weekdaysMin:"ඉ_ස_අ_බ_බ්‍ර_සි_සෙ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"a h:mm",LTS:"a h:mm:ss",L:"YYYY/MM/DD",LL:"YYYY MMMM D",LLL:"YYYY MMMM D, a h:mm",LLLL:"YYYY MMMM D [වැනි] dddd, a h:mm:ss"},calendar:{sameDay:"[අද] LT[ට]",nextDay:"[හෙට] LT[ට]",nextWeek:"dddd LT[ට]",lastDay:"[ඊයේ] LT[ට]",lastWeek:"[පසුගිය] dddd LT[ට]",sameElse:"L"},relativeTime:{future:"%sකින්",past:"%sකට පෙර",s:"තත්පර කිහිපය",ss:"තත්පර %d",m:"මිනිත්තුව",mm:"මිනිත්තු %d",h:"පැය",hh:"පැය %d",d:"දිනය",dd:"දින %d",M:"මාසය",MM:"මාස %d",y:"වසර",yy:"වසර %d"},dayOfMonthOrdinalParse:/\d{1,2} වැනි/,ordinal:function(e){return e+" වැනි"},meridiemParse:/පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,isPM:function(e){return"ප.ව."===e||"පස් වරු"===e},meridiem:function(e,t,n){return e>11?n?"ප.ව.":"පස් වරු":n?"පෙ.ව.":"පෙර වරු"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sk.js":function(e,t,n){!function(e){"use strict";var t="január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_"),n="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_");function o(e){return e>1&&e<5}function r(e,t,n,r){var s=e+" ";switch(n){case"s":return t||r?"pár sekúnd":"pár sekundami";case"ss":return t||r?s+(o(e)?"sekundy":"sekúnd"):s+"sekundami";case"m":return t?"minúta":r?"minútu":"minútou";case"mm":return t||r?s+(o(e)?"minúty":"minút"):s+"minútami";case"h":return t?"hodina":r?"hodinu":"hodinou";case"hh":return t||r?s+(o(e)?"hodiny":"hodín"):s+"hodinami";case"d":return t||r?"deň":"dňom";case"dd":return t||r?s+(o(e)?"dni":"dní"):s+"dňami";case"M":return t||r?"mesiac":"mesiacom";case"MM":return t||r?s+(o(e)?"mesiace":"mesiacov"):s+"mesiacmi";case"y":return t||r?"rok":"rokom";case"yy":return t||r?s+(o(e)?"roky":"rokov"):s+"rokmi"}}e.defineLocale("sk",{months:t,monthsShort:n,weekdays:"nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_št_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_št_pi_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeľu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo štvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[včera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulú nedeľu o] LT";case 1:case 2:return"[minulý] dddd [o] LT";case 3:return"[minulú stredu o] LT";case 4:case 5:return"[minulý] dddd [o] LT";case 6:return"[minulú sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:r,ss:r,m:r,mm:r,h:r,hh:r,d:r,dd:r,M:r,MM:r,y:r,yy:r},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sl.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r=e+" ";switch(n){case"s":return t||o?"nekaj sekund":"nekaj sekundami";case"ss":return r+(1===e?t?"sekundo":"sekundi":2===e?t||o?"sekundi":"sekundah":e<5?t||o?"sekunde":"sekundah":"sekund");case"m":return t?"ena minuta":"eno minuto";case"mm":return r+(1===e?t?"minuta":"minuto":2===e?t||o?"minuti":"minutama":e<5?t||o?"minute":"minutami":t||o?"minut":"minutami");case"h":return t?"ena ura":"eno uro";case"hh":return r+(1===e?t?"ura":"uro":2===e?t||o?"uri":"urama":e<5?t||o?"ure":"urami":t||o?"ur":"urami");case"d":return t||o?"en dan":"enim dnem";case"dd":return r+(1===e?t||o?"dan":"dnem":2===e?t||o?"dni":"dnevoma":t||o?"dni":"dnevi");case"M":return t||o?"en mesec":"enim mesecem";case"MM":return r+(1===e?t||o?"mesec":"mesecem":2===e?t||o?"meseca":"mesecema":e<5?t||o?"mesece":"meseci":t||o?"mesecev":"meseci");case"y":return t||o?"eno leto":"enim letom";case"yy":return r+(1===e?t||o?"leto":"letom":2===e?t||o?"leti":"letoma":e<5?t||o?"leta":"leti":t||o?"let":"leti")}}e.defineLocale("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._čet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_če_pe_so".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[včeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:return"[prejšnjo] [nedeljo] [ob] LT";case 3:return"[prejšnjo] [sredo] [ob] LT";case 6:return"[prejšnjo] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[prejšnji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"čez %s",past:"pred %s",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sq.js":function(e,t,n){!function(e){"use strict";e.defineLocale("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),weekdays:"E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),weekdaysShort:"Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_Më_E_P_Sh".split("_"),weekdaysParseExact:!0,meridiemParse:/PD|MD/,isPM:function(e){return"M"===e.charAt(0)},meridiem:function(e,t,n){return e<12?"PD":"MD"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Sot në] LT",nextDay:"[Nesër në] LT",nextWeek:"dddd [në] LT",lastDay:"[Dje në] LT",lastWeek:"dddd [e kaluar në] LT",sameElse:"L"},relativeTime:{future:"në %s",past:"%s më parë",s:"disa sekonda",ss:"%d sekonda",m:"një minutë",mm:"%d minuta",h:"një orë",hh:"%d orë",d:"një ditë",dd:"%d ditë",M:"një muaj",MM:"%d muaj",y:"një vit",yy:"%d vite"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sr-cyrl.js":function(e,t,n){!function(e){"use strict";var t={words:{ss:["секунда","секунде","секунди"],m:["један минут","једне минуте"],mm:["минут","минуте","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],dd:["дан","дана","дана"],MM:["месец","месеца","месеци"],yy:["година","године","година"]},correctGrammaticalCase:function(e,t){return 1===e?t[0]:e>=2&&e<=4?t[1]:t[2]},translate:function(e,n,o){var r=t.words[o];return 1===o.length?n?r[0]:r[1]:e+" "+t.correctGrammaticalCase(e,r)}};e.defineLocale("sr-cyrl",{months:"јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),monthsShort:"јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),monthsParseExact:!0,weekdays:"недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),weekdaysShort:"нед._пон._уто._сре._чет._пет._суб.".split("_"),weekdaysMin:"не_по_ут_ср_че_пе_су".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){return["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",ss:t.translate,m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:"дан",dd:t.translate,M:"месец",MM:t.translate,y:"годину",yy:t.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sr.js":function(e,t,n){!function(e){"use strict";var t={words:{ss:["sekunda","sekunde","sekundi"],m:["jedan minut","jedne minute"],mm:["minut","minute","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mesec","meseca","meseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(e,t){return 1===e?t[0]:e>=2&&e<=4?t[1]:t[2]},translate:function(e,n,o){var r=t.words[o];return 1===o.length?n?r[0]:r[1]:e+" "+t.correctGrammaticalCase(e,r)}};e.defineLocale("sr",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sre._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){return["[prošle] [nedelje] [u] LT","[prošlog] [ponedeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",ss:t.translate,m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:"dan",dd:t.translate,M:"mesec",MM:t.translate,y:"godinu",yy:t.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ss.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ss",{months:"Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split("_"),monthsShort:"Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo".split("_"),weekdays:"Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo".split("_"),weekdaysShort:"Lis_Umb_Lsb_Les_Lsi_Lsh_Umg".split("_"),weekdaysMin:"Li_Us_Lb_Lt_Ls_Lh_Ug".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Namuhla nga] LT",nextDay:"[Kusasa nga] LT",nextWeek:"dddd [nga] LT",lastDay:"[Itolo nga] LT",lastWeek:"dddd [leliphelile] [nga] LT",sameElse:"L"},relativeTime:{future:"nga %s",past:"wenteka nga %s",s:"emizuzwana lomcane",ss:"%d mzuzwana",m:"umzuzu",mm:"%d emizuzu",h:"lihora",hh:"%d emahora",d:"lilanga",dd:"%d emalanga",M:"inyanga",MM:"%d tinyanga",y:"umnyaka",yy:"%d iminyaka"},meridiemParse:/ekuseni|emini|entsambama|ebusuku/,meridiem:function(e,t,n){return e<11?"ekuseni":e<15?"emini":e<19?"entsambama":"ebusuku"},meridiemHour:function(e,t){return 12===e&&(e=0),"ekuseni"===t?e:"emini"===t?e>=11?e:e+12:"entsambama"===t||"ebusuku"===t?0===e?0:e+12:void 0},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:"%d",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sv.js":function(e,t,n){!function(e){"use strict";e.defineLocale("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"[På] dddd LT",lastWeek:"[I] dddd[s] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",ss:"%d sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}(\:e|\:a)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?":e":1===t||2===t?":a":":e")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sw.js":function(e,t,n){!function(e){"use strict";e.defineLocale("sw",{months:"Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des".split("_"),weekdays:"Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi".split("_"),weekdaysShort:"Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos".split("_"),weekdaysMin:"J2_J3_J4_J5_Al_Ij_J1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"hh:mm A",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[leo saa] LT",nextDay:"[kesho saa] LT",nextWeek:"[wiki ijayo] dddd [saat] LT",lastDay:"[jana] LT",lastWeek:"[wiki iliyopita] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s baadaye",past:"tokea %s",s:"hivi punde",ss:"sekunde %d",m:"dakika moja",mm:"dakika %d",h:"saa limoja",hh:"masaa %d",d:"siku moja",dd:"siku %d",M:"mwezi mmoja",MM:"miezi %d",y:"mwaka mmoja",yy:"miaka %d"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ta.js":function(e,t,n){!function(e){"use strict";var t={1:"௧",2:"௨",3:"௩",4:"௪",5:"௫",6:"௬",7:"௭",8:"௮",9:"௯",0:"௦"},n={"௧":"1","௨":"2","௩":"3","௪":"4","௫":"5","௬":"6","௭":"7","௮":"8","௯":"9","௦":"0"};e.defineLocale("ta",{months:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),monthsShort:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),weekdays:"ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை".split("_"),weekdaysShort:"ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி".split("_"),weekdaysMin:"ஞா_தி_செ_பு_வி_வெ_ச".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, HH:mm",LLLL:"dddd, D MMMM YYYY, HH:mm"},calendar:{sameDay:"[இன்று] LT",nextDay:"[நாளை] LT",nextWeek:"dddd, LT",lastDay:"[நேற்று] LT",lastWeek:"[கடந்த வாரம்] dddd, LT",sameElse:"L"},relativeTime:{future:"%s இல்",past:"%s முன்",s:"ஒரு சில விநாடிகள்",ss:"%d விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},dayOfMonthOrdinalParse:/\d{1,2}வது/,ordinal:function(e){return e+"வது"},preparse:function(e){return e.replace(/[௧௨௩௪௫௬௭௮௯௦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,meridiem:function(e,t,n){return e<2?" யாமம்":e<6?" வைகறை":e<10?" காலை":e<14?" நண்பகல்":e<18?" எற்பாடு":e<22?" மாலை":" யாமம்"},meridiemHour:function(e,t){return 12===e&&(e=0),"யாமம்"===t?e<2?e:e+12:"வைகறை"===t||"காலை"===t||"நண்பகல்"===t&&e>=10?e:e+12},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/te.js":function(e,t,n){!function(e){"use strict";e.defineLocale("te",{months:"జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్".split("_"),monthsShort:"జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.".split("_"),monthsParseExact:!0,weekdays:"ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం".split("_"),weekdaysShort:"ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని".split("_"),weekdaysMin:"ఆ_సో_మం_బు_గు_శు_శ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[నేడు] LT",nextDay:"[రేపు] LT",nextWeek:"dddd, LT",lastDay:"[నిన్న] LT",lastWeek:"[గత] dddd, LT",sameElse:"L"},relativeTime:{future:"%s లో",past:"%s క్రితం",s:"కొన్ని క్షణాలు",ss:"%d సెకన్లు",m:"ఒక నిమిషం",mm:"%d నిమిషాలు",h:"ఒక గంట",hh:"%d గంటలు",d:"ఒక రోజు",dd:"%d రోజులు",M:"ఒక నెల",MM:"%d నెలలు",y:"ఒక సంవత్సరం",yy:"%d సంవత్సరాలు"},dayOfMonthOrdinalParse:/\d{1,2}వ/,ordinal:"%dవ",meridiemParse:/రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,meridiemHour:function(e,t){return 12===e&&(e=0),"రాత్రి"===t?e<4?e:e+12:"ఉదయం"===t?e:"మధ్యాహ్నం"===t?e>=10?e:e+12:"సాయంత్రం"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"రాత్రి":e<10?"ఉదయం":e<17?"మధ్యాహ్నం":e<20?"సాయంత్రం":"రాత్రి"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tet.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tet",{months:"Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu".split("_"),weekdaysShort:"Dom_Seg_Ters_Kua_Kint_Sest_Sab".split("_"),weekdaysMin:"Do_Seg_Te_Ku_Ki_Ses_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Ohin iha] LT",nextDay:"[Aban iha] LT",nextWeek:"dddd [iha] LT",lastDay:"[Horiseik iha] LT",lastWeek:"dddd [semana kotuk] [iha] LT",sameElse:"L"},relativeTime:{future:"iha %s",past:"%s liuba",s:"segundu balun",ss:"segundu %d",m:"minutu ida",mm:"minutu %d",h:"oras ida",hh:"oras %d",d:"loron ida",dd:"loron %d",M:"fulan ida",MM:"fulan %d",y:"tinan ida",yy:"tinan %d"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tg.js":function(e,t,n){!function(e){"use strict";var t={0:"-ум",1:"-ум",2:"-юм",3:"-юм",4:"-ум",5:"-ум",6:"-ум",7:"-ум",8:"-ум",9:"-ум",10:"-ум",12:"-ум",13:"-ум",20:"-ум",30:"-юм",40:"-ум",50:"-ум",60:"-ум",70:"-ум",80:"-ум",90:"-ум",100:"-ум"};e.defineLocale("tg",{months:{format:"январи_феврали_марти_апрели_майи_июни_июли_августи_сентябри_октябри_ноябри_декабри".split("_"),standalone:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_")},monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе".split("_"),weekdaysShort:"яшб_дшб_сшб_чшб_пшб_ҷум_шнб".split("_"),weekdaysMin:"яш_дш_сш_чш_пш_ҷм_шб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Имрӯз соати] LT",nextDay:"[Фардо соати] LT",lastDay:"[Дирӯз соати] LT",nextWeek:"dddd[и] [ҳафтаи оянда соати] LT",lastWeek:"dddd[и] [ҳафтаи гузашта соати] LT",sameElse:"L"},relativeTime:{future:"баъди %s",past:"%s пеш",s:"якчанд сония",m:"як дақиқа",mm:"%d дақиқа",h:"як соат",hh:"%d соат",d:"як рӯз",dd:"%d рӯз",M:"як моҳ",MM:"%d моҳ",y:"як сол",yy:"%d сол"},meridiemParse:/шаб|субҳ|рӯз|бегоҳ/,meridiemHour:function(e,t){return 12===e&&(e=0),"шаб"===t?e<4?e:e+12:"субҳ"===t?e:"рӯз"===t?e>=11?e:e+12:"бегоҳ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"шаб":e<11?"субҳ":e<16?"рӯз":e<19?"бегоҳ":"шаб"},dayOfMonthOrdinalParse:/\d{1,2}-(ум|юм)/,ordinal:function(e){return e+(t[e]||t[e%10]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/th.js":function(e,t,n){!function(e){"use strict";e.defineLocale("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.".split("_"),monthsParseExact:!0,weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา H:mm",LLLL:"วันddddที่ D MMMM YYYY เวลา H:mm"},meridiemParse:/ก่อนเที่ยง|หลังเที่ยง/,isPM:function(e){return"หลังเที่ยง"===e},meridiem:function(e,t,n){return e<12?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",ss:"%d วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",w:"1 สัปดาห์",ww:"%d สัปดาห์",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tk.js":function(e,t,n){!function(e){"use strict";var t={1:"'inji",5:"'inji",8:"'inji",70:"'inji",80:"'inji",2:"'nji",7:"'nji",20:"'nji",50:"'nji",3:"'ünji",4:"'ünji",100:"'ünji",6:"'njy",9:"'unjy",10:"'unjy",30:"'unjy",60:"'ynjy",90:"'ynjy"};e.defineLocale("tk",{months:"Ýanwar_Fewral_Mart_Aprel_Maý_Iýun_Iýul_Awgust_Sentýabr_Oktýabr_Noýabr_Dekabr".split("_"),monthsShort:"Ýan_Few_Mar_Apr_Maý_Iýn_Iýl_Awg_Sen_Okt_Noý_Dek".split("_"),weekdays:"Ýekşenbe_Duşenbe_Sişenbe_Çarşenbe_Penşenbe_Anna_Şenbe".split("_"),weekdaysShort:"Ýek_Duş_Siş_Çar_Pen_Ann_Şen".split("_"),weekdaysMin:"Ýk_Dş_Sş_Çr_Pn_An_Şn".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün sagat] LT",nextDay:"[ertir sagat] LT",nextWeek:"[indiki] dddd [sagat] LT",lastDay:"[düýn] LT",lastWeek:"[geçen] dddd [sagat] LT",sameElse:"L"},relativeTime:{future:"%s soň",past:"%s öň",s:"birnäçe sekunt",m:"bir minut",mm:"%d minut",h:"bir sagat",hh:"%d sagat",d:"bir gün",dd:"%d gün",M:"bir aý",MM:"%d aý",y:"bir ýyl",yy:"%d ýyl"},ordinal:function(e,n){switch(n){case"d":case"D":case"Do":case"DD":return e;default:if(0===e)return e+"'unjy";var o=e%10;return e+(t[o]||t[e%100-o]||t[e>=100?100:null])}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tl-ph.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tlh.js":function(e,t,n){!function(e){"use strict";var t="pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_");function n(e,n,o,r){var s=function(e){var n=Math.floor(e%1e3/100),o=Math.floor(e%100/10),r=e%10,s="";return n>0&&(s+=t[n]+"vatlh"),o>0&&(s+=(""!==s?" ":"")+t[o]+"maH"),r>0&&(s+=(""!==s?" ":"")+t[r]),""===s?"pagh":s}(e);switch(o){case"ss":return s+" lup";case"mm":return s+" tup";case"hh":return s+" rep";case"dd":return s+" jaj";case"MM":return s+" jar";case"yy":return s+" DIS"}}e.defineLocale("tlh",{months:"tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’".split("_"),monthsShort:"jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’".split("_"),monthsParseExact:!0,weekdays:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysShort:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysMin:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[DaHjaj] LT",nextDay:"[wa’leS] LT",nextWeek:"LLL",lastDay:"[wa’Hu’] LT",lastWeek:"LLL",sameElse:"L"},relativeTime:{future:function(e){var t=e;return-1!==e.indexOf("jaj")?t.slice(0,-3)+"leS":-1!==e.indexOf("jar")?t.slice(0,-3)+"waQ":-1!==e.indexOf("DIS")?t.slice(0,-3)+"nem":t+" pIq"},past:function(e){var t=e;return-1!==e.indexOf("jaj")?t.slice(0,-3)+"Hu’":-1!==e.indexOf("jar")?t.slice(0,-3)+"wen":-1!==e.indexOf("DIS")?t.slice(0,-3)+"ben":t+" ret"},s:"puS lup",ss:n,m:"wa’ tup",mm:n,h:"wa’ rep",hh:n,d:"wa’ jaj",dd:n,M:"wa’ jar",MM:n,y:"wa’ DIS",yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tr.js":function(e,t,n){!function(e){"use strict";var t={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"};e.defineLocale("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pts_Sal_Çar_Per_Cum_Cts".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),meridiem:function(e,t,n){return e<12?n?"öö":"ÖÖ":n?"ös":"ÖS"},meridiemParse:/öö|ÖÖ|ös|ÖS/,isPM:function(e){return"ös"===e||"ÖS"===e},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[gelecek] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",ss:"%d saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",w:"bir hafta",ww:"%d hafta",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinal:function(e,n){switch(n){case"d":case"D":case"Do":case"DD":return e;default:if(0===e)return e+"'ıncı";var o=e%10;return e+(t[o]||t[e%100-o]||t[e>=100?100:null])}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tzl.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["viensas secunds","'iensas secunds"],ss:[e+" secunds",e+" secunds"],m:["'n míut","'iens míut"],mm:[e+" míuts",e+" míuts"],h:["'n þora","'iensa þora"],hh:[e+" þoras",e+" þoras"],d:["'n ziua","'iensa ziua"],dd:[e+" ziuas",e+" ziuas"],M:["'n mes","'iens mes"],MM:[e+" mesen",e+" mesen"],y:["'n ar","'iens ar"],yy:[e+" ars",e+" ars"]};return o||t?r[n][0]:r[n][1]}e.defineLocale("tzl",{months:"Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar".split("_"),monthsShort:"Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec".split("_"),weekdays:"Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi".split("_"),weekdaysShort:"Súl_Lún_Mai_Már_Xhú_Vié_Sát".split("_"),weekdaysMin:"Sú_Lú_Ma_Má_Xh_Vi_Sá".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM [dallas] YYYY",LLL:"D. MMMM [dallas] YYYY HH.mm",LLLL:"dddd, [li] D. MMMM [dallas] YYYY HH.mm"},meridiemParse:/d\'o|d\'a/i,isPM:function(e){return"d'o"===e.toLowerCase()},meridiem:function(e,t,n){return e>11?n?"d'o":"D'O":n?"d'a":"D'A"},calendar:{sameDay:"[oxhi à] LT",nextDay:"[demà à] LT",nextWeek:"dddd [à] LT",lastDay:"[ieiri à] LT",lastWeek:"[sür el] dddd [lasteu à] LT",sameElse:"L"},relativeTime:{future:"osprei %s",past:"ja%s",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tzm-latn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tzm-latn",{months:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",ss:"%d imik",m:"minuḍ",mm:"%d minuḍ",h:"saɛa",hh:"%d tassaɛin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tzm.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",ss:"%d ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ug-cn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ug-cn",{months:"يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر".split("_"),monthsShort:"يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر".split("_"),weekdays:"يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە".split("_"),weekdaysShort:"يە_دۈ_سە_چا_پە_جۈ_شە".split("_"),weekdaysMin:"يە_دۈ_سە_چا_پە_جۈ_شە".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY-يىلىM-ئاينىڭD-كۈنى",LLL:"YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm",LLLL:"dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm"},meridiemParse:/يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/,meridiemHour:function(e,t){return 12===e&&(e=0),"يېرىم كېچە"===t||"سەھەر"===t||"چۈشتىن بۇرۇن"===t?e:"چۈشتىن كېيىن"===t||"كەچ"===t?e+12:e>=11?e:e+12},meridiem:function(e,t,n){var o=100*e+t;return o<600?"يېرىم كېچە":o<900?"سەھەر":o<1130?"چۈشتىن بۇرۇن":o<1230?"چۈش":o<1800?"چۈشتىن كېيىن":"كەچ"},calendar:{sameDay:"[بۈگۈن سائەت] LT",nextDay:"[ئەتە سائەت] LT",nextWeek:"[كېلەركى] dddd [سائەت] LT",lastDay:"[تۆنۈگۈن] LT",lastWeek:"[ئالدىنقى] dddd [سائەت] LT",sameElse:"L"},relativeTime:{future:"%s كېيىن",past:"%s بۇرۇن",s:"نەچچە سېكونت",ss:"%d سېكونت",m:"بىر مىنۇت",mm:"%d مىنۇت",h:"بىر سائەت",hh:"%d سائەت",d:"بىر كۈن",dd:"%d كۈن",M:"بىر ئاي",MM:"%d ئاي",y:"بىر يىل",yy:"%d يىل"},dayOfMonthOrdinalParse:/\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"-كۈنى";case"w":case"W":return e+"-ھەپتە";default:return e}},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/uk.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return"m"===n?t?"хвилина":"хвилину":"h"===n?t?"година":"годину":e+" "+(o=+e,r={ss:t?"секунда_секунди_секунд":"секунду_секунди_секунд",mm:t?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:t?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"}[n].split("_"),o%10==1&&o%100!=11?r[0]:o%10>=2&&o%10<=4&&(o%100<10||o%100>=20)?r[1]:r[2]);var o,r}function n(e){return function(){return e+"о"+(11===this.hours()?"б":"")+"] LT"}}e.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:function(e,t){var n={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")};return!0===e?n.nominative.slice(1,7).concat(n.nominative.slice(0,1)):e?n[/(\[[ВвУу]\]) ?dddd/.test(t)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(t)?"genitive":"nominative"][e.day()]:n.nominative},weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., HH:mm",LLLL:"dddd, D MMMM YYYY р., HH:mm"},calendar:{sameDay:n("[Сьогодні "),nextDay:n("[Завтра "),lastDay:n("[Вчора "),nextWeek:n("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return n("[Минулої] dddd [").call(this);case 1:case 2:case 4:return n("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",ss:t,m:t,mm:t,h:"годину",hh:t,d:"день",dd:t,M:"місяць",MM:t,y:"рік",yy:t},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(e){return/^(дня|вечора)$/.test(e)},meridiem:function(e,t,n){return e<4?"ночі":e<12?"ранку":e<17?"дня":"вечора"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":case"w":case"W":return e+"-й";case"D":return e+"-го";default:return e}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ur.js":function(e,t,n){!function(e){"use strict";var t=["جنوری","فروری","مارچ","اپریل","مئی","جون","جولائی","اگست","ستمبر","اکتوبر","نومبر","دسمبر"],n=["اتوار","پیر","منگل","بدھ","جمعرات","جمعہ","ہفتہ"];e.defineLocale("ur",{months:t,monthsShort:t,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(e){return"شام"===e},meridiem:function(e,t,n){return e<12?"صبح":"شام"},calendar:{sameDay:"[آج بوقت] LT",nextDay:"[کل بوقت] LT",nextWeek:"dddd [بوقت] LT",lastDay:"[گذشتہ روز بوقت] LT",lastWeek:"[گذشتہ] dddd [بوقت] LT",sameElse:"L"},relativeTime:{future:"%s بعد",past:"%s قبل",s:"چند سیکنڈ",ss:"%d سیکنڈ",m:"ایک منٹ",mm:"%d منٹ",h:"ایک گھنٹہ",hh:"%d گھنٹے",d:"ایک دن",dd:"%d دن",M:"ایک ماہ",MM:"%d ماہ",y:"ایک سال",yy:"%d سال"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/uz-latn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("uz-latn",{months:"Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr".split("_"),monthsShort:"Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek".split("_"),weekdays:"Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba".split("_"),weekdaysShort:"Yak_Dush_Sesh_Chor_Pay_Jum_Shan".split("_"),weekdaysMin:"Ya_Du_Se_Cho_Pa_Ju_Sha".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Bugun soat] LT [da]",nextDay:"[Ertaga] LT [da]",nextWeek:"dddd [kuni soat] LT [da]",lastDay:"[Kecha soat] LT [da]",lastWeek:"[O'tgan] dddd [kuni soat] LT [da]",sameElse:"L"},relativeTime:{future:"Yaqin %s ichida",past:"Bir necha %s oldin",s:"soniya",ss:"%d soniya",m:"bir daqiqa",mm:"%d daqiqa",h:"bir soat",hh:"%d soat",d:"bir kun",dd:"%d kun",M:"bir oy",MM:"%d oy",y:"bir yil",yy:"%d yil"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/uz.js":function(e,t,n){!function(e){"use strict";e.defineLocale("uz",{months:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",ss:"%d фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/vi.js":function(e,t,n){!function(e){"use strict";e.defineLocale("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12".split("_"),monthsParseExact:!0,weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysParseExact:!0,meridiemParse:/sa|ch/i,isPM:function(e){return/^ch$/i.test(e)},meridiem:function(e,t,n){return e<12?n?"sa":"SA":n?"ch":"CH"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY HH:mm",LLLL:"dddd, D MMMM [năm] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần trước lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",ss:"%d giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",w:"một tuần",ww:"%d tuần",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/x-pseudo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("x-pseudo",{months:"J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér".split("_"),monthsShort:"J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc".split("_"),monthsParseExact:!0,weekdays:"S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý".split("_"),weekdaysShort:"S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát".split("_"),weekdaysMin:"S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[T~ódá~ý át] LT",nextDay:"[T~ómó~rró~w át] LT",nextWeek:"dddd [át] LT",lastDay:"[Ý~ést~érdá~ý át] LT",lastWeek:"[L~ást] dddd [át] LT",sameElse:"L"},relativeTime:{future:"í~ñ %s",past:"%s á~gó",s:"á ~féw ~sécó~ñds",ss:"%d s~écóñ~ds",m:"á ~míñ~úté",mm:"%d m~íñú~tés",h:"á~ñ hó~úr",hh:"%d h~óúrs",d:"á ~dáý",dd:"%d d~áýs",M:"á ~móñ~th",MM:"%d m~óñt~hs",y:"á ~ýéár",yy:"%d ý~éárs"},dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/yo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("yo",{months:"Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀".split("_"),monthsShort:"Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀".split("_"),weekdays:"Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta".split("_"),weekdaysShort:"Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá".split("_"),weekdaysMin:"Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Ònì ni] LT",nextDay:"[Ọ̀la ni] LT",nextWeek:"dddd [Ọsẹ̀ tón'bọ] [ni] LT",lastDay:"[Àna ni] LT",lastWeek:"dddd [Ọsẹ̀ tólọ́] [ni] LT",sameElse:"L"},relativeTime:{future:"ní %s",past:"%s kọjá",s:"ìsẹjú aayá die",ss:"aayá %d",m:"ìsẹjú kan",mm:"ìsẹjú %d",h:"wákati kan",hh:"wákati %d",d:"ọjọ́ kan",dd:"ọjọ́ %d",M:"osù kan",MM:"osù %d",y:"ọdún kan",yy:"ọdún %d"},dayOfMonthOrdinalParse:/ọjọ́\s\d{1,2}/,ordinal:"ọjọ́ %d",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-cn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"下午"===t||"晚上"===t?e+12:e>=11?e:e+12},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1130?"上午":o<1230?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:function(e){return e.week()!==this.week()?"[下]dddLT":"[本]dddLT"},lastDay:"[昨天]LT",lastWeek:function(e){return this.week()!==e.week()?"[上]dddLT":"[本]dddLT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|周)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"周";default:return e}},relativeTime:{future:"%s后",past:"%s前",s:"几秒",ss:"%d 秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",w:"1 周",ww:"%d 周",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-hk.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-hk",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1200?"上午":1200===o?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-mo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-mo",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"D/M/YYYY",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1130?"上午":o<1230?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-tw.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1130?"上午":o<1230?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale sync recursive ^\\.\\/.*$":(e,t,n)=>{var o={"./af":"./node_modules/moment/locale/af.js","./af.js":"./node_modules/moment/locale/af.js","./ar":"./node_modules/moment/locale/ar.js","./ar-dz":"./node_modules/moment/locale/ar-dz.js","./ar-dz.js":"./node_modules/moment/locale/ar-dz.js","./ar-kw":"./node_modules/moment/locale/ar-kw.js","./ar-kw.js":"./node_modules/moment/locale/ar-kw.js","./ar-ly":"./node_modules/moment/locale/ar-ly.js","./ar-ly.js":"./node_modules/moment/locale/ar-ly.js","./ar-ma":"./node_modules/moment/locale/ar-ma.js","./ar-ma.js":"./node_modules/moment/locale/ar-ma.js","./ar-sa":"./node_modules/moment/locale/ar-sa.js","./ar-sa.js":"./node_modules/moment/locale/ar-sa.js","./ar-tn":"./node_modules/moment/locale/ar-tn.js","./ar-tn.js":"./node_modules/moment/locale/ar-tn.js","./ar.js":"./node_modules/moment/locale/ar.js","./az":"./node_modules/moment/locale/az.js","./az.js":"./node_modules/moment/locale/az.js","./be":"./node_modules/moment/locale/be.js","./be.js":"./node_modules/moment/locale/be.js","./bg":"./node_modules/moment/locale/bg.js","./bg.js":"./node_modules/moment/locale/bg.js","./bm":"./node_modules/moment/locale/bm.js","./bm.js":"./node_modules/moment/locale/bm.js","./bn":"./node_modules/moment/locale/bn.js","./bn-bd":"./node_modules/moment/locale/bn-bd.js","./bn-bd.js":"./node_modules/moment/locale/bn-bd.js","./bn.js":"./node_modules/moment/locale/bn.js","./bo":"./node_modules/moment/locale/bo.js","./bo.js":"./node_modules/moment/locale/bo.js","./br":"./node_modules/moment/locale/br.js","./br.js":"./node_modules/moment/locale/br.js","./bs":"./node_modules/moment/locale/bs.js","./bs.js":"./node_modules/moment/locale/bs.js","./ca":"./node_modules/moment/locale/ca.js","./ca.js":"./node_modules/moment/locale/ca.js","./cs":"./node_modules/moment/locale/cs.js","./cs.js":"./node_modules/moment/locale/cs.js","./cv":"./node_modules/moment/locale/cv.js","./cv.js":"./node_modules/moment/locale/cv.js","./cy":"./node_modules/moment/locale/cy.js","./cy.js":"./node_modules/moment/locale/cy.js","./da":"./node_modules/moment/locale/da.js","./da.js":"./node_modules/moment/locale/da.js","./de":"./node_modules/moment/locale/de.js","./de-at":"./node_modules/moment/locale/de-at.js","./de-at.js":"./node_modules/moment/locale/de-at.js","./de-ch":"./node_modules/moment/locale/de-ch.js","./de-ch.js":"./node_modules/moment/locale/de-ch.js","./de.js":"./node_modules/moment/locale/de.js","./dv":"./node_modules/moment/locale/dv.js","./dv.js":"./node_modules/moment/locale/dv.js","./el":"./node_modules/moment/locale/el.js","./el.js":"./node_modules/moment/locale/el.js","./en-au":"./node_modules/moment/locale/en-au.js","./en-au.js":"./node_modules/moment/locale/en-au.js","./en-ca":"./node_modules/moment/locale/en-ca.js","./en-ca.js":"./node_modules/moment/locale/en-ca.js","./en-gb":"./node_modules/moment/locale/en-gb.js","./en-gb.js":"./node_modules/moment/locale/en-gb.js","./en-ie":"./node_modules/moment/locale/en-ie.js","./en-ie.js":"./node_modules/moment/locale/en-ie.js","./en-il":"./node_modules/moment/locale/en-il.js","./en-il.js":"./node_modules/moment/locale/en-il.js","./en-in":"./node_modules/moment/locale/en-in.js","./en-in.js":"./node_modules/moment/locale/en-in.js","./en-nz":"./node_modules/moment/locale/en-nz.js","./en-nz.js":"./node_modules/moment/locale/en-nz.js","./en-sg":"./node_modules/moment/locale/en-sg.js","./en-sg.js":"./node_modules/moment/locale/en-sg.js","./eo":"./node_modules/moment/locale/eo.js","./eo.js":"./node_modules/moment/locale/eo.js","./es":"./node_modules/moment/locale/es.js","./es-do":"./node_modules/moment/locale/es-do.js","./es-do.js":"./node_modules/moment/locale/es-do.js","./es-mx":"./node_modules/moment/locale/es-mx.js","./es-mx.js":"./node_modules/moment/locale/es-mx.js","./es-us":"./node_modules/moment/locale/es-us.js","./es-us.js":"./node_modules/moment/locale/es-us.js","./es.js":"./node_modules/moment/locale/es.js","./et":"./node_modules/moment/locale/et.js","./et.js":"./node_modules/moment/locale/et.js","./eu":"./node_modules/moment/locale/eu.js","./eu.js":"./node_modules/moment/locale/eu.js","./fa":"./node_modules/moment/locale/fa.js","./fa.js":"./node_modules/moment/locale/fa.js","./fi":"./node_modules/moment/locale/fi.js","./fi.js":"./node_modules/moment/locale/fi.js","./fil":"./node_modules/moment/locale/fil.js","./fil.js":"./node_modules/moment/locale/fil.js","./fo":"./node_modules/moment/locale/fo.js","./fo.js":"./node_modules/moment/locale/fo.js","./fr":"./node_modules/moment/locale/fr.js","./fr-ca":"./node_modules/moment/locale/fr-ca.js","./fr-ca.js":"./node_modules/moment/locale/fr-ca.js","./fr-ch":"./node_modules/moment/locale/fr-ch.js","./fr-ch.js":"./node_modules/moment/locale/fr-ch.js","./fr.js":"./node_modules/moment/locale/fr.js","./fy":"./node_modules/moment/locale/fy.js","./fy.js":"./node_modules/moment/locale/fy.js","./ga":"./node_modules/moment/locale/ga.js","./ga.js":"./node_modules/moment/locale/ga.js","./gd":"./node_modules/moment/locale/gd.js","./gd.js":"./node_modules/moment/locale/gd.js","./gl":"./node_modules/moment/locale/gl.js","./gl.js":"./node_modules/moment/locale/gl.js","./gom-deva":"./node_modules/moment/locale/gom-deva.js","./gom-deva.js":"./node_modules/moment/locale/gom-deva.js","./gom-latn":"./node_modules/moment/locale/gom-latn.js","./gom-latn.js":"./node_modules/moment/locale/gom-latn.js","./gu":"./node_modules/moment/locale/gu.js","./gu.js":"./node_modules/moment/locale/gu.js","./he":"./node_modules/moment/locale/he.js","./he.js":"./node_modules/moment/locale/he.js","./hi":"./node_modules/moment/locale/hi.js","./hi.js":"./node_modules/moment/locale/hi.js","./hr":"./node_modules/moment/locale/hr.js","./hr.js":"./node_modules/moment/locale/hr.js","./hu":"./node_modules/moment/locale/hu.js","./hu.js":"./node_modules/moment/locale/hu.js","./hy-am":"./node_modules/moment/locale/hy-am.js","./hy-am.js":"./node_modules/moment/locale/hy-am.js","./id":"./node_modules/moment/locale/id.js","./id.js":"./node_modules/moment/locale/id.js","./is":"./node_modules/moment/locale/is.js","./is.js":"./node_modules/moment/locale/is.js","./it":"./node_modules/moment/locale/it.js","./it-ch":"./node_modules/moment/locale/it-ch.js","./it-ch.js":"./node_modules/moment/locale/it-ch.js","./it.js":"./node_modules/moment/locale/it.js","./ja":"./node_modules/moment/locale/ja.js","./ja.js":"./node_modules/moment/locale/ja.js","./jv":"./node_modules/moment/locale/jv.js","./jv.js":"./node_modules/moment/locale/jv.js","./ka":"./node_modules/moment/locale/ka.js","./ka.js":"./node_modules/moment/locale/ka.js","./kk":"./node_modules/moment/locale/kk.js","./kk.js":"./node_modules/moment/locale/kk.js","./km":"./node_modules/moment/locale/km.js","./km.js":"./node_modules/moment/locale/km.js","./kn":"./node_modules/moment/locale/kn.js","./kn.js":"./node_modules/moment/locale/kn.js","./ko":"./node_modules/moment/locale/ko.js","./ko.js":"./node_modules/moment/locale/ko.js","./ku":"./node_modules/moment/locale/ku.js","./ku.js":"./node_modules/moment/locale/ku.js","./ky":"./node_modules/moment/locale/ky.js","./ky.js":"./node_modules/moment/locale/ky.js","./lb":"./node_modules/moment/locale/lb.js","./lb.js":"./node_modules/moment/locale/lb.js","./lo":"./node_modules/moment/locale/lo.js","./lo.js":"./node_modules/moment/locale/lo.js","./lt":"./node_modules/moment/locale/lt.js","./lt.js":"./node_modules/moment/locale/lt.js","./lv":"./node_modules/moment/locale/lv.js","./lv.js":"./node_modules/moment/locale/lv.js","./me":"./node_modules/moment/locale/me.js","./me.js":"./node_modules/moment/locale/me.js","./mi":"./node_modules/moment/locale/mi.js","./mi.js":"./node_modules/moment/locale/mi.js","./mk":"./node_modules/moment/locale/mk.js","./mk.js":"./node_modules/moment/locale/mk.js","./ml":"./node_modules/moment/locale/ml.js","./ml.js":"./node_modules/moment/locale/ml.js","./mn":"./node_modules/moment/locale/mn.js","./mn.js":"./node_modules/moment/locale/mn.js","./mr":"./node_modules/moment/locale/mr.js","./mr.js":"./node_modules/moment/locale/mr.js","./ms":"./node_modules/moment/locale/ms.js","./ms-my":"./node_modules/moment/locale/ms-my.js","./ms-my.js":"./node_modules/moment/locale/ms-my.js","./ms.js":"./node_modules/moment/locale/ms.js","./mt":"./node_modules/moment/locale/mt.js","./mt.js":"./node_modules/moment/locale/mt.js","./my":"./node_modules/moment/locale/my.js","./my.js":"./node_modules/moment/locale/my.js","./nb":"./node_modules/moment/locale/nb.js","./nb.js":"./node_modules/moment/locale/nb.js","./ne":"./node_modules/moment/locale/ne.js","./ne.js":"./node_modules/moment/locale/ne.js","./nl":"./node_modules/moment/locale/nl.js","./nl-be":"./node_modules/moment/locale/nl-be.js","./nl-be.js":"./node_modules/moment/locale/nl-be.js","./nl.js":"./node_modules/moment/locale/nl.js","./nn":"./node_modules/moment/locale/nn.js","./nn.js":"./node_modules/moment/locale/nn.js","./oc-lnc":"./node_modules/moment/locale/oc-lnc.js","./oc-lnc.js":"./node_modules/moment/locale/oc-lnc.js","./pa-in":"./node_modules/moment/locale/pa-in.js","./pa-in.js":"./node_modules/moment/locale/pa-in.js","./pl":"./node_modules/moment/locale/pl.js","./pl.js":"./node_modules/moment/locale/pl.js","./pt":"./node_modules/moment/locale/pt.js","./pt-br":"./node_modules/moment/locale/pt-br.js","./pt-br.js":"./node_modules/moment/locale/pt-br.js","./pt.js":"./node_modules/moment/locale/pt.js","./ro":"./node_modules/moment/locale/ro.js","./ro.js":"./node_modules/moment/locale/ro.js","./ru":"./node_modules/moment/locale/ru.js","./ru.js":"./node_modules/moment/locale/ru.js","./sd":"./node_modules/moment/locale/sd.js","./sd.js":"./node_modules/moment/locale/sd.js","./se":"./node_modules/moment/locale/se.js","./se.js":"./node_modules/moment/locale/se.js","./si":"./node_modules/moment/locale/si.js","./si.js":"./node_modules/moment/locale/si.js","./sk":"./node_modules/moment/locale/sk.js","./sk.js":"./node_modules/moment/locale/sk.js","./sl":"./node_modules/moment/locale/sl.js","./sl.js":"./node_modules/moment/locale/sl.js","./sq":"./node_modules/moment/locale/sq.js","./sq.js":"./node_modules/moment/locale/sq.js","./sr":"./node_modules/moment/locale/sr.js","./sr-cyrl":"./node_modules/moment/locale/sr-cyrl.js","./sr-cyrl.js":"./node_modules/moment/locale/sr-cyrl.js","./sr.js":"./node_modules/moment/locale/sr.js","./ss":"./node_modules/moment/locale/ss.js","./ss.js":"./node_modules/moment/locale/ss.js","./sv":"./node_modules/moment/locale/sv.js","./sv.js":"./node_modules/moment/locale/sv.js","./sw":"./node_modules/moment/locale/sw.js","./sw.js":"./node_modules/moment/locale/sw.js","./ta":"./node_modules/moment/locale/ta.js","./ta.js":"./node_modules/moment/locale/ta.js","./te":"./node_modules/moment/locale/te.js","./te.js":"./node_modules/moment/locale/te.js","./tet":"./node_modules/moment/locale/tet.js","./tet.js":"./node_modules/moment/locale/tet.js","./tg":"./node_modules/moment/locale/tg.js","./tg.js":"./node_modules/moment/locale/tg.js","./th":"./node_modules/moment/locale/th.js","./th.js":"./node_modules/moment/locale/th.js","./tk":"./node_modules/moment/locale/tk.js","./tk.js":"./node_modules/moment/locale/tk.js","./tl-ph":"./node_modules/moment/locale/tl-ph.js","./tl-ph.js":"./node_modules/moment/locale/tl-ph.js","./tlh":"./node_modules/moment/locale/tlh.js","./tlh.js":"./node_modules/moment/locale/tlh.js","./tr":"./node_modules/moment/locale/tr.js","./tr.js":"./node_modules/moment/locale/tr.js","./tzl":"./node_modules/moment/locale/tzl.js","./tzl.js":"./node_modules/moment/locale/tzl.js","./tzm":"./node_modules/moment/locale/tzm.js","./tzm-latn":"./node_modules/moment/locale/tzm-latn.js","./tzm-latn.js":"./node_modules/moment/locale/tzm-latn.js","./tzm.js":"./node_modules/moment/locale/tzm.js","./ug-cn":"./node_modules/moment/locale/ug-cn.js","./ug-cn.js":"./node_modules/moment/locale/ug-cn.js","./uk":"./node_modules/moment/locale/uk.js","./uk.js":"./node_modules/moment/locale/uk.js","./ur":"./node_modules/moment/locale/ur.js","./ur.js":"./node_modules/moment/locale/ur.js","./uz":"./node_modules/moment/locale/uz.js","./uz-latn":"./node_modules/moment/locale/uz-latn.js","./uz-latn.js":"./node_modules/moment/locale/uz-latn.js","./uz.js":"./node_modules/moment/locale/uz.js","./vi":"./node_modules/moment/locale/vi.js","./vi.js":"./node_modules/moment/locale/vi.js","./x-pseudo":"./node_modules/moment/locale/x-pseudo.js","./x-pseudo.js":"./node_modules/moment/locale/x-pseudo.js","./yo":"./node_modules/moment/locale/yo.js","./yo.js":"./node_modules/moment/locale/yo.js","./zh-cn":"./node_modules/moment/locale/zh-cn.js","./zh-cn.js":"./node_modules/moment/locale/zh-cn.js","./zh-hk":"./node_modules/moment/locale/zh-hk.js","./zh-hk.js":"./node_modules/moment/locale/zh-hk.js","./zh-mo":"./node_modules/moment/locale/zh-mo.js","./zh-mo.js":"./node_modules/moment/locale/zh-mo.js","./zh-tw":"./node_modules/moment/locale/zh-tw.js","./zh-tw.js":"./node_modules/moment/locale/zh-tw.js"};function r(e){var t=s(e);return n(t)}function s(e){if(!n.o(o,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return o[e]}r.keys=function(){return Object.keys(o)},r.resolve=s,e.exports=r,r.id="./node_modules/moment/locale sync recursive ^\\.\\/.*$"},"./node_modules/ng-csv/build/ng-csv.min.js":(e,t)=>{var n;n=window,document,angular.module("ngCsv.config",[]).value("ngCsv.config",{debug:!0}).config(["$compileProvider",function(e){angular.isDefined(e.urlSanitizationWhitelist)?e.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|data):/):e.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|data):/)}]),angular.module("ngCsv.directives",["ngCsv.services"]),angular.module("ngCsv.services",[]),angular.module("ngCsv",["ngCsv.config","ngCsv.services","ngCsv.directives","ngSanitize"]),e.exports===t&&(e.exports="ngCsv"),angular.module("ngCsv.services").service("CSV",["$q",function(e){var t="\r\n",n={"\\t":"\t","\\b":"\b","\\v":"\v","\\f":"\f","\\r":"\r"};this.stringifyField=function(e,t){return"locale"===t.decimalSep&&this.isFloat(e)?e.toLocaleString():"."!==t.decimalSep&&this.isFloat(e)?e.toString().replace(".",t.decimalSep):"string"==typeof e?(e=e.replace(/"/g,'""'),(t.quoteStrings||e.indexOf(",")>-1||e.indexOf("\n")>-1||e.indexOf("\r")>-1)&&(e=t.txtDelim+e+t.txtDelim),e):"boolean"==typeof e?e?"TRUE":"FALSE":e},this.isFloat=function(e){return+e===e&&(!isFinite(e)||Boolean(e%1))},this.stringify=function(n,o){var r=e.defer(),s=this,a="",i="",d=e.when(n).then((function(e){var n,d;angular.isDefined(o.header)&&o.header&&(n=[],angular.forEach(o.header,(function(e){this.push(s.stringifyField(e,o))}),n),d=n.join(o.fieldSep?o.fieldSep:","),i+=d+t);var u,m,l=[];angular.isArray(e)?l=e:angular.isFunction(e)&&(l=e()),angular.isDefined(o.label)&&o.label&&"boolean"==typeof o.label&&(u=[],angular.forEach(l[0],(function(e,t){this.push(s.stringifyField(t,o))}),u),m=u.join(o.fieldSep?o.fieldSep:","),i+=m+t),angular.forEach(l,(function(e,n){var r,a,d=angular.copy(l[n]);a=[];var u=o.columnOrder?o.columnOrder:d;angular.forEach(u,(function(e){var t=o.columnOrder?d[e]:e;this.push(s.stringifyField(t,o))}),a),r=a.join(o.fieldSep?o.fieldSep:","),i+=n'),i=angular.element(a.children()[0]);i.attr("href",n.URL.createObjectURL(o)),i.attr("download",e.getFilename()),i.attr("target","_blank"),r.find("body").append(a),s((function(){i[0].click(),i.remove()}),null)}}()})),e.$apply()}))}}}])},"./src/js/chat/index.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/5e32f2e1a6d11e8f150e.html"},"./src/js/closing/index.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/00860aee362cdeeb1080.html"},"./src/js/offline/index.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/1b90d6b0c511f3791069.html"},"./src/js/online/index.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/26fbe83f4ba96d6e6cf1.html"},"./src/js/unmanaged/index.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/3f18dac5f545add792db.html"},"./src/js/waiting/index.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/6043a16afdb829ba5934.html"}},e=>{var t=t=>e(e.s=t);e.O(0,["vendor-index","vendor-angular-76f2ed34","vendor-angular-58d021f3","vendor-ng-embed","vendor-moment","vendor-jquery","vendor-jquery.textcomplete","vendor-emojionearea","vendor-emojione","vendor-angular-sanitize","vendor-angular-resource","vendor-angular-messages","vendor-angular-material","vendor-angular-local-storage","vendor-angular-animate","vendor-urlMatcher","vendor-transition","vendor-stateService","vendor-stateDirectives","vendor-flow"],(()=>(t("./node_modules/jquery/dist/jquery.js"),t("./node_modules/angular/index-exposed.js"),t("./node_modules/moment/moment.js"),t("./node_modules/@flowjs/flow.js/src/flow.js"),t("./node_modules/emojione/lib/js/emojione.js"),t("./src/js/index.module.js")))),e.O()}]); +(self["webpackChunkmotion_chat"] = self["webpackChunkmotion_chat"] || []).push([["chat"],{ + +/***/ "./node_modules/@flowjs/flow.js/src/flow.js": +/*!**************************************************!*\ + !*** ./node_modules/@flowjs/flow.js/src/flow.js ***! + \**************************************************/ +/***/ ((module, exports, __webpack_require__) => { + +/* module decorator */ module = __webpack_require__.nmd(module); +var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** + * @license MIT + */ +(function(window, document, undefined) {'use strict'; + if (!window || !document) { + console.warn('Flowjs needs window and document objects to work'); + return; + } + // ie10+ + var ie10plus = window.navigator.msPointerEnabled; + /** + * Flow.js is a library providing multiple simultaneous, stable and + * resumable uploads via the HTML5 File API. + * @param [opts] + * @param {number|Function} [opts.chunkSize] + * @param {bool} [opts.forceChunkSize] + * @param {number} [opts.simultaneousUploads] + * @param {bool} [opts.singleFile] + * @param {string} [opts.fileParameterName] + * @param {number} [opts.progressCallbacksInterval] + * @param {number} [opts.speedSmoothingFactor] + * @param {Object|Function} [opts.query] + * @param {Object|Function} [opts.headers] + * @param {bool} [opts.withCredentials] + * @param {Function} [opts.preprocess] + * @param {string} [opts.method] + * @param {string|Function} [opts.testMethod] + * @param {string|Function} [opts.uploadMethod] + * @param {bool} [opts.prioritizeFirstAndLastChunk] + * @param {bool} [opts.allowDuplicateUploads] + * @param {string|Function} [opts.target] + * @param {number} [opts.maxChunkRetries] + * @param {number} [opts.chunkRetryInterval] + * @param {Array.} [opts.permanentErrors] + * @param {Array.} [opts.successStatuses] + * @param {Function} [opts.initFileFn] + * @param {Function} [opts.readFileFn] + * @param {Function} [opts.generateUniqueIdentifier] + * @constructor + */ + function Flow(opts) { + /** + * Supported by browser? + * @type {boolean} + */ + this.support = ( + typeof File !== 'undefined' && + typeof Blob !== 'undefined' && + typeof FileList !== 'undefined' && + ( + !!Blob.prototype.slice || !!Blob.prototype.webkitSlice || !!Blob.prototype.mozSlice || + false + ) // slicing files support + ); + + if (!this.support) { + return ; + } + + /** + * Check if directory upload is supported + * @type {boolean} + */ + this.supportDirectory = ( + /Chrome/.test(window.navigator.userAgent) || + /Firefox/.test(window.navigator.userAgent) || + /Edge/.test(window.navigator.userAgent) + ); + + /** + * List of FlowFile objects + * @type {Array.} + */ + this.files = []; + + /** + * Default options for flow.js + * @type {Object} + */ + this.defaults = { + chunkSize: 1024 * 1024, + forceChunkSize: false, + simultaneousUploads: 3, + singleFile: false, + fileParameterName: 'file', + progressCallbacksInterval: 500, + speedSmoothingFactor: 0.1, + query: {}, + headers: {}, + withCredentials: false, + preprocess: null, + changeRawDataBeforeSend: null, + method: 'multipart', + testMethod: 'GET', + uploadMethod: 'POST', + prioritizeFirstAndLastChunk: false, + allowDuplicateUploads: false, + target: '/', + testChunks: true, + generateUniqueIdentifier: null, + maxChunkRetries: 0, + chunkRetryInterval: null, + permanentErrors: [404, 413, 415, 500, 501], + successStatuses: [200, 201, 202], + onDropStopPropagation: false, + initFileFn: null, + readFileFn: webAPIFileRead + }; + + /** + * Current options + * @type {Object} + */ + this.opts = {}; + + /** + * List of events: + * key stands for event name + * value array list of callbacks + * @type {} + */ + this.events = {}; + + var $ = this; + + /** + * On drop event + * @function + * @param {MouseEvent} event + */ + this.onDrop = function (event) { + if ($.opts.onDropStopPropagation) { + event.stopPropagation(); + } + event.preventDefault(); + var dataTransfer = event.dataTransfer; + if (dataTransfer.items && dataTransfer.items[0] && + dataTransfer.items[0].webkitGetAsEntry) { + $.webkitReadDataTransfer(event); + } else { + $.addFiles(dataTransfer.files, event); + } + }; + + /** + * Prevent default + * @function + * @param {MouseEvent} event + */ + this.preventEvent = function (event) { + event.preventDefault(); + }; + + + /** + * Current options + * @type {Object} + */ + this.opts = Flow.extend({}, this.defaults, opts || {}); + + } + + Flow.prototype = { + /** + * Set a callback for an event, possible events: + * fileSuccess(file), fileProgress(file), fileAdded(file, event), + * fileRemoved(file), fileRetry(file), fileError(file, message), + * complete(), progress(), error(message, file), pause() + * @function + * @param {string} event + * @param {Function} callback + */ + on: function (event, callback) { + event = event.toLowerCase(); + if (!this.events.hasOwnProperty(event)) { + this.events[event] = []; + } + this.events[event].push(callback); + }, + + /** + * Remove event callback + * @function + * @param {string} [event] removes all events if not specified + * @param {Function} [fn] removes all callbacks of event if not specified + */ + off: function (event, fn) { + if (event !== undefined) { + event = event.toLowerCase(); + if (fn !== undefined) { + if (this.events.hasOwnProperty(event)) { + arrayRemove(this.events[event], fn); + } + } else { + delete this.events[event]; + } + } else { + this.events = {}; + } + }, + + /** + * Fire an event + * @function + * @param {string} event event name + * @param {...} args arguments of a callback + * @return {bool} value is false if at least one of the event handlers which handled this event + * returned false. Otherwise it returns true. + */ + fire: function (event, args) { + // `arguments` is an object, not array, in FF, so: + args = Array.prototype.slice.call(arguments); + event = event.toLowerCase(); + var preventDefault = false; + if (this.events.hasOwnProperty(event)) { + each(this.events[event], function (callback) { + preventDefault = callback.apply(this, args.slice(1)) === false || preventDefault; + }, this); + } + if (event != 'catchall') { + args.unshift('catchAll'); + preventDefault = this.fire.apply(this, args) === false || preventDefault; + } + return !preventDefault; + }, + + /** + * Read webkit dataTransfer object + * @param event + */ + webkitReadDataTransfer: function (event) { + var $ = this; + var queue = event.dataTransfer.items.length; + var files = []; + each(event.dataTransfer.items, function (item) { + var entry = item.webkitGetAsEntry(); + if (!entry) { + decrement(); + return ; + } + if (entry.isFile) { + // due to a bug in Chrome's File System API impl - #149735 + fileReadSuccess(item.getAsFile(), entry.fullPath); + } else { + readDirectory(entry.createReader()); + } + }); + function readDirectory(reader) { + reader.readEntries(function (entries) { + if (entries.length) { + queue += entries.length; + each(entries, function(entry) { + if (entry.isFile) { + var fullPath = entry.fullPath; + entry.file(function (file) { + fileReadSuccess(file, fullPath); + }, readError); + } else if (entry.isDirectory) { + readDirectory(entry.createReader()); + } + }); + readDirectory(reader); + } else { + decrement(); + } + }, readError); + } + function fileReadSuccess(file, fullPath) { + // relative path should not start with "/" + file.relativePath = fullPath.substring(1); + files.push(file); + decrement(); + } + function readError(fileError) { + decrement(); + throw fileError; + } + function decrement() { + if (--queue == 0) { + $.addFiles(files, event); + } + } + }, + + /** + * Generate unique identifier for a file + * @function + * @param {FlowFile} file + * @returns {string} + */ + generateUniqueIdentifier: function (file) { + var custom = this.opts.generateUniqueIdentifier; + if (typeof custom === 'function') { + return custom(file); + } + // Some confusion in different versions of Firefox + var relativePath = file.relativePath || file.webkitRelativePath || file.fileName || file.name; + return file.size + '-' + relativePath.replace(/[^0-9a-zA-Z_-]/img, ''); + }, + + /** + * Upload next chunk from the queue + * @function + * @returns {boolean} + * @private + */ + uploadNextChunk: function (preventEvents) { + // In some cases (such as videos) it's really handy to upload the first + // and last chunk of a file quickly; this let's the server check the file's + // metadata and determine if there's even a point in continuing. + var found = false; + if (this.opts.prioritizeFirstAndLastChunk) { + each(this.files, function (file) { + if (!file.paused && file.chunks.length && + file.chunks[0].status() === 'pending') { + file.chunks[0].send(); + found = true; + return false; + } + if (!file.paused && file.chunks.length > 1 && + file.chunks[file.chunks.length - 1].status() === 'pending') { + file.chunks[file.chunks.length - 1].send(); + found = true; + return false; + } + }); + if (found) { + return found; + } + } + + // Now, simply look for the next, best thing to upload + each(this.files, function (file) { + if (!file.paused) { + each(file.chunks, function (chunk) { + if (chunk.status() === 'pending') { + chunk.send(); + found = true; + return false; + } + }); + } + if (found) { + return false; + } + }); + if (found) { + return true; + } + + // The are no more outstanding chunks to upload, check is everything is done + var outstanding = false; + each(this.files, function (file) { + if (!file.isComplete()) { + outstanding = true; + return false; + } + }); + if (!outstanding && !preventEvents) { + // All chunks have been uploaded, complete + async(function () { + this.fire('complete'); + }, this); + } + return false; + }, + + + /** + * Assign a browse action to one or more DOM nodes. + * @function + * @param {Element|Array.} domNodes + * @param {boolean} isDirectory Pass in true to allow directories to + * @param {boolean} singleFile prevent multi file upload + * @param {Object} attributes set custom attributes: + * http://www.w3.org/TR/html-markup/input.file.html#input.file-attributes + * eg: accept: 'image/*' + * be selected (Chrome only). + */ + assignBrowse: function (domNodes, isDirectory, singleFile, attributes) { + if (domNodes instanceof Element) { + domNodes = [domNodes]; + } + + each(domNodes, function (domNode) { + var input; + if (domNode.tagName === 'INPUT' && domNode.type === 'file') { + input = domNode; + } else { + input = document.createElement('input'); + input.setAttribute('type', 'file'); + // display:none - not working in opera 12 + extend(input.style, { + visibility: 'hidden', + position: 'absolute', + width: '1px', + height: '1px' + }); + // for opera 12 browser, input must be assigned to a document + domNode.appendChild(input); + // https://developer.mozilla.org/en/using_files_from_web_applications) + // event listener is executed two times + // first one - original mouse click event + // second - input.click(), input is inside domNode + domNode.addEventListener('click', function() { + input.click(); + }, false); + } + if (!this.opts.singleFile && !singleFile) { + input.setAttribute('multiple', 'multiple'); + } + if (isDirectory) { + input.setAttribute('webkitdirectory', 'webkitdirectory'); + } + each(attributes, function (value, key) { + input.setAttribute(key, value); + }); + // When new files are added, simply append them to the overall list + var $ = this; + input.addEventListener('change', function (e) { + if (e.target.value) { + $.addFiles(e.target.files, e); + e.target.value = ''; + } + }, false); + }, this); + }, + + /** + * Assign one or more DOM nodes as a drop target. + * @function + * @param {Element|Array.} domNodes + */ + assignDrop: function (domNodes) { + if (typeof domNodes.length === 'undefined') { + domNodes = [domNodes]; + } + each(domNodes, function (domNode) { + domNode.addEventListener('dragover', this.preventEvent, false); + domNode.addEventListener('dragenter', this.preventEvent, false); + domNode.addEventListener('drop', this.onDrop, false); + }, this); + }, + + /** + * Un-assign drop event from DOM nodes + * @function + * @param domNodes + */ + unAssignDrop: function (domNodes) { + if (typeof domNodes.length === 'undefined') { + domNodes = [domNodes]; + } + each(domNodes, function (domNode) { + domNode.removeEventListener('dragover', this.preventEvent); + domNode.removeEventListener('dragenter', this.preventEvent); + domNode.removeEventListener('drop', this.onDrop); + }, this); + }, + + /** + * Returns a boolean indicating whether or not the instance is currently + * uploading anything. + * @function + * @returns {boolean} + */ + isUploading: function () { + var uploading = false; + each(this.files, function (file) { + if (file.isUploading()) { + uploading = true; + return false; + } + }); + return uploading; + }, + + /** + * should upload next chunk + * @function + * @returns {boolean|number} + */ + _shouldUploadNext: function () { + var num = 0; + var should = true; + var simultaneousUploads = this.opts.simultaneousUploads; + each(this.files, function (file) { + each(file.chunks, function(chunk) { + if (chunk.status() === 'uploading') { + num++; + if (num >= simultaneousUploads) { + should = false; + return false; + } + } + }); + }); + // if should is true then return uploading chunks's length + return should && num; + }, + + /** + * Start or resume uploading. + * @function + */ + upload: function () { + // Make sure we don't start too many uploads at once + var ret = this._shouldUploadNext(); + if (ret === false) { + return; + } + // Kick off the queue + this.fire('uploadStart'); + var started = false; + for (var num = 1; num <= this.opts.simultaneousUploads - ret; num++) { + started = this.uploadNextChunk(true) || started; + } + if (!started) { + async(function () { + this.fire('complete'); + }, this); + } + }, + + /** + * Resume uploading. + * @function + */ + resume: function () { + each(this.files, function (file) { + if (!file.isComplete()) { + file.resume(); + } + }); + }, + + /** + * Pause uploading. + * @function + */ + pause: function () { + each(this.files, function (file) { + file.pause(); + }); + }, + + /** + * Cancel upload of all FlowFile objects and remove them from the list. + * @function + */ + cancel: function () { + for (var i = this.files.length - 1; i >= 0; i--) { + this.files[i].cancel(); + } + }, + + /** + * Returns a number between 0 and 1 indicating the current upload progress + * of all files. + * @function + * @returns {number} + */ + progress: function () { + var totalDone = 0; + var totalSize = 0; + // Resume all chunks currently being uploaded + each(this.files, function (file) { + totalDone += file.progress() * file.size; + totalSize += file.size; + }); + return totalSize > 0 ? totalDone / totalSize : 0; + }, + + /** + * Add a HTML5 File object to the list of files. + * @function + * @param {File} file + * @param {Event} [event] event is optional + */ + addFile: function (file, event) { + this.addFiles([file], event); + }, + + /** + * Add a HTML5 File object to the list of files. + * @function + * @param {FileList|Array} fileList + * @param {Event} [event] event is optional + */ + addFiles: function (fileList, event) { + var files = []; + each(fileList, function (file) { + // https://github.com/flowjs/flow.js/issues/55 + if ((!ie10plus || ie10plus && file.size > 0) && !(file.size % 4096 === 0 && (file.name === '.' || file.fileName === '.'))) { + var uniqueIdentifier = this.generateUniqueIdentifier(file); + if (this.opts.allowDuplicateUploads || !this.getFromUniqueIdentifier(uniqueIdentifier)) { + var f = new FlowFile(this, file, uniqueIdentifier); + if (this.fire('fileAdded', f, event)) { + files.push(f); + } + } + } + }, this); + if (this.fire('filesAdded', files, event)) { + each(files, function (file) { + if (this.opts.singleFile && this.files.length > 0) { + this.removeFile(this.files[0]); + } + this.files.push(file); + }, this); + this.fire('filesSubmitted', files, event); + } + }, + + + /** + * Cancel upload of a specific FlowFile object from the list. + * @function + * @param {FlowFile} file + */ + removeFile: function (file) { + for (var i = this.files.length - 1; i >= 0; i--) { + if (this.files[i] === file) { + this.files.splice(i, 1); + file.abort(); + this.fire('fileRemoved', file); + } + } + }, + + /** + * Look up a FlowFile object by its unique identifier. + * @function + * @param {string} uniqueIdentifier + * @returns {boolean|FlowFile} false if file was not found + */ + getFromUniqueIdentifier: function (uniqueIdentifier) { + var ret = false; + each(this.files, function (file) { + if (file.uniqueIdentifier === uniqueIdentifier) { + ret = file; + } + }); + return ret; + }, + + /** + * Returns the total size of all files in bytes. + * @function + * @returns {number} + */ + getSize: function () { + var totalSize = 0; + each(this.files, function (file) { + totalSize += file.size; + }); + return totalSize; + }, + + /** + * Returns the total size uploaded of all files in bytes. + * @function + * @returns {number} + */ + sizeUploaded: function () { + var size = 0; + each(this.files, function (file) { + size += file.sizeUploaded(); + }); + return size; + }, + + /** + * Returns remaining time to upload all files in seconds. Accuracy is based on average speed. + * If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY` + * @function + * @returns {number} + */ + timeRemaining: function () { + var sizeDelta = 0; + var averageSpeed = 0; + each(this.files, function (file) { + if (!file.paused && !file.error) { + sizeDelta += file.size - file.sizeUploaded(); + averageSpeed += file.averageSpeed; + } + }); + if (sizeDelta && !averageSpeed) { + return Number.POSITIVE_INFINITY; + } + if (!sizeDelta && !averageSpeed) { + return 0; + } + return Math.floor(sizeDelta / averageSpeed); + } + }; + + + + + + + /** + * FlowFile class + * @name FlowFile + * @param {Flow} flowObj + * @param {File} file + * @param {string} uniqueIdentifier + * @constructor + */ + function FlowFile(flowObj, file, uniqueIdentifier) { + + /** + * Reference to parent Flow instance + * @type {Flow} + */ + this.flowObj = flowObj; + + /** + * Used to store the bytes read + * @type {Blob|string} + */ + this.bytes = null; + + /** + * Reference to file + * @type {File} + */ + this.file = file; + + /** + * File name. Some confusion in different versions of Firefox + * @type {string} + */ + this.name = file.fileName || file.name; + + /** + * File size + * @type {number} + */ + this.size = file.size; + + /** + * Relative file path + * @type {string} + */ + this.relativePath = file.relativePath || file.webkitRelativePath || this.name; + + /** + * File unique identifier + * @type {string} + */ + this.uniqueIdentifier = (uniqueIdentifier === undefined ? flowObj.generateUniqueIdentifier(file) : uniqueIdentifier); + + /** + * Size of Each Chunk + * @type {number} + */ + this.chunkSize = 0; + + /** + * List of chunks + * @type {Array.} + */ + this.chunks = []; + + /** + * Indicated if file is paused + * @type {boolean} + */ + this.paused = false; + + /** + * Indicated if file has encountered an error + * @type {boolean} + */ + this.error = false; + + /** + * Average upload speed + * @type {number} + */ + this.averageSpeed = 0; + + /** + * Current upload speed + * @type {number} + */ + this.currentSpeed = 0; + + /** + * Date then progress was called last time + * @type {number} + * @private + */ + this._lastProgressCallback = Date.now(); + + /** + * Previously uploaded file size + * @type {number} + * @private + */ + this._prevUploadedSize = 0; + + /** + * Holds previous progress + * @type {number} + * @private + */ + this._prevProgress = 0; + + this.bootstrap(); + } + + FlowFile.prototype = { + /** + * Update speed parameters + * @link http://stackoverflow.com/questions/2779600/how-to-estimate-download-time-remaining-accurately + * @function + */ + measureSpeed: function () { + var timeSpan = Date.now() - this._lastProgressCallback; + if (!timeSpan) { + return ; + } + var smoothingFactor = this.flowObj.opts.speedSmoothingFactor; + var uploaded = this.sizeUploaded(); + // Prevent negative upload speed after file upload resume + this.currentSpeed = Math.max((uploaded - this._prevUploadedSize) / timeSpan * 1000, 0); + this.averageSpeed = smoothingFactor * this.currentSpeed + (1 - smoothingFactor) * this.averageSpeed; + this._prevUploadedSize = uploaded; + }, + + /** + * For internal usage only. + * Callback when something happens within the chunk. + * @function + * @param {FlowChunk} chunk + * @param {string} event can be 'progress', 'success', 'error' or 'retry' + * @param {string} [message] + */ + chunkEvent: function (chunk, event, message) { + switch (event) { + case 'progress': + if (Date.now() - this._lastProgressCallback < + this.flowObj.opts.progressCallbacksInterval) { + break; + } + this.measureSpeed(); + this.flowObj.fire('fileProgress', this, chunk); + this.flowObj.fire('progress'); + this._lastProgressCallback = Date.now(); + break; + case 'error': + this.error = true; + this.abort(true); + this.flowObj.fire('fileError', this, message, chunk); + this.flowObj.fire('error', message, this, chunk); + break; + case 'success': + if (this.error) { + return; + } + this.measureSpeed(); + this.flowObj.fire('fileProgress', this, chunk); + this.flowObj.fire('progress'); + this._lastProgressCallback = Date.now(); + if (this.isComplete()) { + this.currentSpeed = 0; + this.averageSpeed = 0; + this.flowObj.fire('fileSuccess', this, message, chunk); + } + break; + case 'retry': + this.flowObj.fire('fileRetry', this, chunk); + break; + } + }, + + /** + * Pause file upload + * @function + */ + pause: function() { + this.paused = true; + this.abort(); + }, + + /** + * Resume file upload + * @function + */ + resume: function() { + this.paused = false; + this.flowObj.upload(); + }, + + /** + * Abort current upload + * @function + */ + abort: function (reset) { + this.currentSpeed = 0; + this.averageSpeed = 0; + var chunks = this.chunks; + if (reset) { + this.chunks = []; + } + each(chunks, function (c) { + if (c.status() === 'uploading') { + c.abort(); + this.flowObj.uploadNextChunk(); + } + }, this); + }, + + /** + * Cancel current upload and remove from a list + * @function + */ + cancel: function () { + this.flowObj.removeFile(this); + }, + + /** + * Retry aborted file upload + * @function + */ + retry: function () { + this.bootstrap(); + this.flowObj.upload(); + }, + + /** + * Clear current chunks and slice file again + * @function + */ + bootstrap: function () { + if (typeof this.flowObj.opts.initFileFn === "function") { + this.flowObj.opts.initFileFn(this); + } + + this.abort(true); + this.error = false; + // Rebuild stack of chunks from file + this._prevProgress = 0; + var round = this.flowObj.opts.forceChunkSize ? Math.ceil : Math.floor; + this.chunkSize = evalOpts(this.flowObj.opts.chunkSize, this); + var chunks = Math.max( + round(this.size / this.chunkSize), 1 + ); + for (var offset = 0; offset < chunks; offset++) { + this.chunks.push( + new FlowChunk(this.flowObj, this, offset) + ); + } + }, + + /** + * Get current upload progress status + * @function + * @returns {number} from 0 to 1 + */ + progress: function () { + if (this.error) { + return 1; + } + if (this.chunks.length === 1) { + this._prevProgress = Math.max(this._prevProgress, this.chunks[0].progress()); + return this._prevProgress; + } + // Sum up progress across everything + var bytesLoaded = 0; + each(this.chunks, function (c) { + // get chunk progress relative to entire file + bytesLoaded += c.progress() * (c.endByte - c.startByte); + }); + var percent = bytesLoaded / this.size; + // We don't want to lose percentages when an upload is paused + this._prevProgress = Math.max(this._prevProgress, percent > 0.9999 ? 1 : percent); + return this._prevProgress; + }, + + /** + * Indicates if file is being uploaded at the moment + * @function + * @returns {boolean} + */ + isUploading: function () { + var uploading = false; + each(this.chunks, function (chunk) { + if (chunk.status() === 'uploading') { + uploading = true; + return false; + } + }); + return uploading; + }, + + /** + * Indicates if file is has finished uploading and received a response + * @function + * @returns {boolean} + */ + isComplete: function () { + var outstanding = false; + each(this.chunks, function (chunk) { + var status = chunk.status(); + if (status === 'pending' || status === 'uploading' || status === 'reading' || chunk.preprocessState === 1 || chunk.readState === 1) { + outstanding = true; + return false; + } + }); + return !outstanding; + }, + + /** + * Count total size uploaded + * @function + * @returns {number} + */ + sizeUploaded: function () { + var size = 0; + each(this.chunks, function (chunk) { + size += chunk.sizeUploaded(); + }); + return size; + }, + + /** + * Returns remaining time to finish upload file in seconds. Accuracy is based on average speed. + * If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY` + * @function + * @returns {number} + */ + timeRemaining: function () { + if (this.paused || this.error) { + return 0; + } + var delta = this.size - this.sizeUploaded(); + if (delta && !this.averageSpeed) { + return Number.POSITIVE_INFINITY; + } + if (!delta && !this.averageSpeed) { + return 0; + } + return Math.floor(delta / this.averageSpeed); + }, + + /** + * Get file type + * @function + * @returns {string} + */ + getType: function () { + return this.file.type && this.file.type.split('/')[1]; + }, + + /** + * Get file extension + * @function + * @returns {string} + */ + getExtension: function () { + return this.name.substr((~-this.name.lastIndexOf(".") >>> 0) + 2).toLowerCase(); + } + }; + + /** + * Default read function using the webAPI + * + * @function webAPIFileRead(fileObj, startByte, endByte, fileType, chunk) + * + */ + function webAPIFileRead(fileObj, startByte, endByte, fileType, chunk) { + var function_name = 'slice'; + + if (fileObj.file.slice) + function_name = 'slice'; + else if (fileObj.file.mozSlice) + function_name = 'mozSlice'; + else if (fileObj.file.webkitSlice) + function_name = 'webkitSlice'; + + chunk.readFinished(fileObj.file[function_name](startByte, endByte, fileType)); + } + + + /** + * Class for storing a single chunk + * @name FlowChunk + * @param {Flow} flowObj + * @param {FlowFile} fileObj + * @param {number} offset + * @constructor + */ + function FlowChunk(flowObj, fileObj, offset) { + + /** + * Reference to parent flow object + * @type {Flow} + */ + this.flowObj = flowObj; + + /** + * Reference to parent FlowFile object + * @type {FlowFile} + */ + this.fileObj = fileObj; + + /** + * File offset + * @type {number} + */ + this.offset = offset; + + /** + * Indicates if chunk existence was checked on the server + * @type {boolean} + */ + this.tested = false; + + /** + * Number of retries performed + * @type {number} + */ + this.retries = 0; + + /** + * Pending retry + * @type {boolean} + */ + this.pendingRetry = false; + + /** + * Preprocess state + * @type {number} 0 = unprocessed, 1 = processing, 2 = finished + */ + this.preprocessState = 0; + + /** + * Read state + * @type {number} 0 = not read, 1 = reading, 2 = finished + */ + this.readState = 0; + + + /** + * Bytes transferred from total request size + * @type {number} + */ + this.loaded = 0; + + /** + * Total request size + * @type {number} + */ + this.total = 0; + + /** + * Size of a chunk + * @type {number} + */ + this.chunkSize = this.fileObj.chunkSize; + + /** + * Chunk start byte in a file + * @type {number} + */ + this.startByte = this.offset * this.chunkSize; + + /** + * A specific filename for this chunk which otherwise default to the main name + * @type {string} + */ + this.filename = null; + + /** + * Compute the endbyte in a file + * + */ + this.computeEndByte = function() { + var endByte = Math.min(this.fileObj.size, (this.offset + 1) * this.chunkSize); + if (this.fileObj.size - endByte < this.chunkSize && !this.flowObj.opts.forceChunkSize) { + // The last chunk will be bigger than the chunk size, + // but less than 2 * this.chunkSize + endByte = this.fileObj.size; + } + return endByte; + } + + /** + * Chunk end byte in a file + * @type {number} + */ + this.endByte = this.computeEndByte(); + + /** + * XMLHttpRequest + * @type {XMLHttpRequest} + */ + this.xhr = null; + + var $ = this; + + /** + * Send chunk event + * @param event + * @param {...} args arguments of a callback + */ + this.event = function (event, args) { + args = Array.prototype.slice.call(arguments); + args.unshift($); + $.fileObj.chunkEvent.apply($.fileObj, args); + }; + /** + * Catch progress event + * @param {ProgressEvent} event + */ + this.progressHandler = function(event) { + if (event.lengthComputable) { + $.loaded = event.loaded ; + $.total = event.total; + } + $.event('progress', event); + }; + + /** + * Catch test event + * @param {Event} event + */ + this.testHandler = function(event) { + var status = $.status(true); + if (status === 'error') { + $.event(status, $.message()); + $.flowObj.uploadNextChunk(); + } else if (status === 'success') { + $.tested = true; + $.event(status, $.message()); + $.flowObj.uploadNextChunk(); + } else if (!$.fileObj.paused) { + // Error might be caused by file pause method + // Chunks does not exist on the server side + $.tested = true; + $.send(); + } + }; + + /** + * Upload has stopped + * @param {Event} event + */ + this.doneHandler = function(event) { + var status = $.status(); + if (status === 'success' || status === 'error') { + delete this.data; + $.event(status, $.message()); + $.flowObj.uploadNextChunk(); + } else if (!$.fileObj.paused) { + $.event('retry', $.message()); + $.pendingRetry = true; + $.abort(); + $.retries++; + var retryInterval = $.flowObj.opts.chunkRetryInterval; + if (retryInterval !== null) { + setTimeout(function () { + $.send(); + }, retryInterval); + } else { + $.send(); + } + } + }; + } + + FlowChunk.prototype = { + /** + * Get params for a request + * @function + */ + getParams: function () { + return { + flowChunkNumber: this.offset + 1, + flowChunkSize: this.chunkSize, + flowCurrentChunkSize: this.endByte - this.startByte, + flowTotalSize: this.fileObj.size, + flowIdentifier: this.fileObj.uniqueIdentifier, + flowFilename: this.fileObj.name, + flowRelativePath: this.fileObj.relativePath, + flowTotalChunks: this.fileObj.chunks.length + }; + }, + + /** + * Get target option with query params + * @function + * @param params + * @returns {string} + */ + getTarget: function(target, params){ + if (params.length == 0) { + return target; + } + + if(target.indexOf('?') < 0) { + target += '?'; + } else { + target += '&'; + } + return target + params.join('&'); + }, + + /** + * Makes a GET request without any data to see if the chunk has already + * been uploaded in a previous session + * @function + */ + test: function () { + // Set up request and listen for event + this.xhr = new XMLHttpRequest(); + this.xhr.addEventListener("load", this.testHandler, false); + this.xhr.addEventListener("error", this.testHandler, false); + var testMethod = evalOpts(this.flowObj.opts.testMethod, this.fileObj, this); + var data = this.prepareXhrRequest(testMethod, true); + this.xhr.send(data); + }, + + /** + * Finish preprocess state + * @function + */ + preprocessFinished: function () { + // Re-compute the endByte after the preprocess function to allow an + // implementer of preprocess to set the fileObj size + this.endByte = this.computeEndByte(); + + this.preprocessState = 2; + this.send(); + }, + + /** + * Finish read state + * @function + */ + readFinished: function (bytes) { + this.readState = 2; + this.bytes = bytes; + this.send(); + }, + + + /** + * Uploads the actual data in a POST call + * @function + */ + send: function () { + var preprocess = this.flowObj.opts.preprocess; + var read = this.flowObj.opts.readFileFn; + if (typeof preprocess === 'function') { + switch (this.preprocessState) { + case 0: + this.preprocessState = 1; + preprocess(this); + return; + case 1: + return; + } + } + switch (this.readState) { + case 0: + this.readState = 1; + read(this.fileObj, this.startByte, this.endByte, this.fileObj.file.type, this); + return; + case 1: + return; + } + if (this.flowObj.opts.testChunks && !this.tested) { + this.test(); + return; + } + + this.loaded = 0; + this.total = 0; + this.pendingRetry = false; + + // Set up request and listen for event + this.xhr = new XMLHttpRequest(); + this.xhr.upload.addEventListener('progress', this.progressHandler, false); + this.xhr.addEventListener("load", this.doneHandler, false); + this.xhr.addEventListener("error", this.doneHandler, false); + + var uploadMethod = evalOpts(this.flowObj.opts.uploadMethod, this.fileObj, this); + var data = this.prepareXhrRequest(uploadMethod, false, this.flowObj.opts.method, this.bytes); + var changeRawDataBeforeSend = this.flowObj.opts.changeRawDataBeforeSend; + if (typeof changeRawDataBeforeSend === 'function') { + data = changeRawDataBeforeSend(this, data); + } + this.xhr.send(data); + }, + + /** + * Abort current xhr request + * @function + */ + abort: function () { + // Abort and reset + var xhr = this.xhr; + this.xhr = null; + if (xhr) { + xhr.abort(); + } + }, + + /** + * Retrieve current chunk upload status + * @function + * @returns {string} 'pending', 'uploading', 'success', 'error' + */ + status: function (isTest) { + if (this.readState === 1) { + return 'reading'; + } else if (this.pendingRetry || this.preprocessState === 1) { + // if pending retry then that's effectively the same as actively uploading, + // there might just be a slight delay before the retry starts + return 'uploading'; + } else if (!this.xhr) { + return 'pending'; + } else if (this.xhr.readyState < 4) { + // Status is really 'OPENED', 'HEADERS_RECEIVED' + // or 'LOADING' - meaning that stuff is happening + return 'uploading'; + } else { + if (this.flowObj.opts.successStatuses.indexOf(this.xhr.status) > -1) { + // HTTP 200, perfect + // HTTP 202 Accepted - The request has been accepted for processing, but the processing has not been completed. + return 'success'; + } else if (this.flowObj.opts.permanentErrors.indexOf(this.xhr.status) > -1 || + !isTest && this.retries >= this.flowObj.opts.maxChunkRetries) { + // HTTP 413/415/500/501, permanent error + return 'error'; + } else { + // this should never happen, but we'll reset and queue a retry + // a likely case for this would be 503 service unavailable + this.abort(); + return 'pending'; + } + } + }, + + /** + * Get response from xhr request + * @function + * @returns {String} + */ + message: function () { + return this.xhr ? this.xhr.responseText : ''; + }, + + /** + * Get upload progress + * @function + * @returns {number} + */ + progress: function () { + if (this.pendingRetry) { + return 0; + } + var s = this.status(); + if (s === 'success' || s === 'error') { + return 1; + } else if (s === 'pending') { + return 0; + } else { + return this.total > 0 ? this.loaded / this.total : 0; + } + }, + + /** + * Count total size uploaded + * @function + * @returns {number} + */ + sizeUploaded: function () { + var size = this.endByte - this.startByte; + // can't return only chunk.loaded value, because it is bigger than chunk size + if (this.status() !== 'success') { + size = this.progress() * size; + } + return size; + }, + + /** + * Prepare Xhr request. Set query, headers and data + * @param {string} method GET or POST + * @param {bool} isTest is this a test request + * @param {string} [paramsMethod] octet or form + * @param {Blob} [blob] to send + * @returns {FormData|Blob|Null} data to send + */ + prepareXhrRequest: function(method, isTest, paramsMethod, blob) { + // Add data from the query options + var query = evalOpts(this.flowObj.opts.query, this.fileObj, this, isTest); + query = extend(query || {}, this.getParams()); + + var target = evalOpts(this.flowObj.opts.target, this.fileObj, this, isTest); + var data = null; + if (method === 'GET' || paramsMethod === 'octet') { + // Add data from the query options + var params = []; + each(query, function (v, k) { + params.push([encodeURIComponent(k), encodeURIComponent(v)].join('=')); + }); + target = this.getTarget(target, params); + data = blob || null; + } else { + // Add data from the query options + data = new FormData(); + each(query, function (v, k) { + data.append(k, v); + }); + if (typeof blob !== "undefined") { + data.append(this.flowObj.opts.fileParameterName, blob, this.filename || this.fileObj.file.name); + } + } + + this.xhr.open(method, target, true); + this.xhr.withCredentials = this.flowObj.opts.withCredentials; + + // Add data from header options + each(evalOpts(this.flowObj.opts.headers, this.fileObj, this, isTest), function (v, k) { + this.xhr.setRequestHeader(k, v); + }, this); + + return data; + } + }; + + /** + * Remove value from array + * @param array + * @param value + */ + function arrayRemove(array, value) { + var index = array.indexOf(value); + if (index > -1) { + array.splice(index, 1); + } + } + + /** + * If option is a function, evaluate it with given params + * @param {*} data + * @param {...} args arguments of a callback + * @returns {*} + */ + function evalOpts(data, args) { + if (typeof data === "function") { + // `arguments` is an object, not array, in FF, so: + args = Array.prototype.slice.call(arguments); + data = data.apply(null, args.slice(1)); + } + return data; + } + Flow.evalOpts = evalOpts; + + /** + * Execute function asynchronously + * @param fn + * @param context + */ + function async(fn, context) { + setTimeout(fn.bind(context), 0); + } + + /** + * Extends the destination object `dst` by copying all of the properties from + * the `src` object(s) to `dst`. You can specify multiple `src` objects. + * @function + * @param {Object} dst Destination object. + * @param {...Object} src Source object(s). + * @returns {Object} Reference to `dst`. + */ + function extend(dst, src) { + each(arguments, function(obj) { + if (obj !== dst) { + each(obj, function(value, key){ + dst[key] = value; + }); + } + }); + return dst; + } + Flow.extend = extend; + + /** + * Iterate each element of an object + * @function + * @param {Array|Object} obj object or an array to iterate + * @param {Function} callback first argument is a value and second is a key. + * @param {Object=} context Object to become context (`this`) for the iterator function. + */ + function each(obj, callback, context) { + if (!obj) { + return ; + } + var key; + // Is Array? + // Array.isArray won't work, not only arrays can be iterated by index https://github.com/flowjs/ng-flow/issues/236# + if (typeof(obj.length) !== 'undefined') { + for (key = 0; key < obj.length; key++) { + if (callback.call(context, obj[key], key) === false) { + return ; + } + } + } else { + for (key in obj) { + if (obj.hasOwnProperty(key) && callback.call(context, obj[key], key) === false) { + return ; + } + } + } + } + Flow.each = each; + + /** + * FlowFile constructor + * @type {FlowFile} + */ + Flow.FlowFile = FlowFile; + + /** + * FlowFile constructor + * @type {FlowChunk} + */ + Flow.FlowChunk = FlowChunk; + + /** + * Library version + * @type {string} + */ + Flow.version = '<%= version %>'; + + if ( true && module && typeof module.exports === "object" ) { + // Expose Flow as module.exports in loaders that implement the Node + // module pattern (including browserify). Do not create the global, since + // the user will be storing it themselves locally, and globals are frowned + // upon in the Node module world. + module.exports = Flow; + } else { + // Otherwise expose Flow to the global object as usual + window.Flow = Flow; + + // Register as a named AMD module, since Flow can be concatenated with other + // files that may use define, but not via a proper concatenation script that + // understands anonymous AMD modules. A named AMD is safest and most robust + // way to register. Lowercase flow is used because AMD module names are + // derived from file names, and Flow is normally delivered in a lowercase + // file name. Do this after creating the global so that if an AMD module wants + // to call noConflict to hide this version of Flow, it will work. + if ( true ) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return Flow; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } + } +})(typeof window !== 'undefined' && window, typeof document !== 'undefined' && document); + + +/***/ }), + +/***/ "./node_modules/@flowjs/ng-flow/dist/ng-flow.js": +/*!******************************************************!*\ + !*** ./node_modules/@flowjs/ng-flow/dist/ng-flow.js ***! + \******************************************************/ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/* provided dependency */ var Flow = __webpack_require__(/*! @flowjs/flow.js */ "./node_modules/@flowjs/flow.js/src/flow.js"); +/** + * @description + * var app = angular.module('App', ['flow.provider'], function(flowFactoryProvider){ + * flowFactoryProvider.defaults = {target: '/'}; + * }); + * @name flowFactoryProvider + */ +angular.module('flow.provider', []) +.provider('flowFactory', function() { + 'use strict'; + /** + * Define the default properties for flow.js + * @name flowFactoryProvider.defaults + * @type {Object} + */ + this.defaults = {}; + + /** + * Flow, MaybeFlow or NotFlow + * @name flowFactoryProvider.factory + * @type {function} + * @return {Flow} + */ + this.factory = function (options) { + return new Flow(options); + }; + + /** + * Define the default events + * @name flowFactoryProvider.events + * @type {Array} + * @private + */ + this.events = []; + + /** + * Add default events + * @name flowFactoryProvider.on + * @function + * @param {string} event + * @param {Function} callback + */ + this.on = function (event, callback) { + this.events.push([event, callback]); + }; + + this.$get = function() { + var fn = this.factory; + var defaults = this.defaults; + var events = this.events; + return { + 'create': function(opts) { + // combine default options with global options and options + var flow = fn(angular.extend({}, defaults, opts)); + angular.forEach(events, function (event) { + flow.on(event[0], event[1]); + }); + return flow; + } + }; + }; +}); +angular.module('flow.init', ['flow.provider']) + .controller('flowCtrl', ['$scope', '$attrs', '$parse', 'flowFactory', + function ($scope, $attrs, $parse, flowFactory) { + + var options = angular.extend({}, $scope.$eval($attrs.flowInit)); + + // use existing flow object or create a new one + var flow = $scope.$eval($attrs.flowObject) || flowFactory.create(options); + + var catchAllHandler = function(eventName){ + var args = Array.prototype.slice.call(arguments); + args.shift(); + var event = $scope.$broadcast.apply($scope, ['flow::' + eventName, flow].concat(args)); + if ({ + 'progress':1, 'filesSubmitted':1, 'fileSuccess': 1, 'fileError': 1, 'complete': 1 + }[eventName]) { + $scope.$applyAsync(); + } + if (event.defaultPrevented) { + return false; + } + }; + + flow.on('catchAll', catchAllHandler); + $scope.$on('$destroy', function(){ + flow.off('catchAll', catchAllHandler); + }); + + $scope.$flow = flow; + + if ($attrs.hasOwnProperty('flowName')) { + $parse($attrs.flowName).assign($scope, flow); + $scope.$on('$destroy', function () { + $parse($attrs.flowName).assign($scope); + }); + } + }]) + .directive('flowInit', [function() { + return { + scope: true, + controller: 'flowCtrl' + }; + }]); +angular.module('flow.btn', ['flow.init']) +.directive('flowBtn', [function() { + return { + 'restrict': 'EA', + 'scope': false, + 'require': '^flowInit', + 'link': function(scope, element, attrs) { + var isDirectory = attrs.hasOwnProperty('flowDirectory'); + var isSingleFile = attrs.hasOwnProperty('flowSingleFile'); + var inputAttrs = attrs.hasOwnProperty('flowAttrs') && scope.$eval(attrs.flowAttrs); + scope.$flow.assignBrowse(element, isDirectory, isSingleFile, inputAttrs); + } + }; +}]); +angular.module('flow.dragEvents', ['flow.init']) +/** + * @name flowPreventDrop + * Prevent loading files then dropped on element + */ + .directive('flowPreventDrop', function() { + return { + 'scope': false, + 'link': function(scope, element, attrs) { + element.bind('drop dragover', function (event) { + event.preventDefault(); + }); + } + }; + }) +/** + * @name flowDragEnter + * executes `flowDragEnter` and `flowDragLeave` events + */ + .directive('flowDragEnter', ['$timeout', function($timeout) { + return { + 'scope': false, + 'link': function(scope, element, attrs) { + var promise; + var enter = false; + element.bind('dragover', function (event) { + if (!isFileDrag(event)) { + return ; + } + if (!enter) { + scope.$apply(attrs.flowDragEnter); + enter = true; + } + $timeout.cancel(promise); + event.preventDefault(); + }); + element.bind('dragleave drop', function (event) { + $timeout.cancel(promise); + promise = $timeout(function () { + scope.$eval(attrs.flowDragLeave); + promise = null; + enter = false; + }, 100); + }); + function isFileDrag(dragEvent) { + var fileDrag = false; + var dataTransfer = dragEvent.dataTransfer || dragEvent.originalEvent.dataTransfer; + angular.forEach(dataTransfer && dataTransfer.types, function(val) { + if (val === 'Files') { + fileDrag = true; + } + }); + return fileDrag; + } + } + }; + }]); + +angular.module('flow.drop', ['flow.init']) +.directive('flowDrop', function() { + return { + 'scope': false, + 'require': '^flowInit', + 'link': function(scope, element, attrs) { + if (attrs.flowDropEnabled) { + scope.$watch(attrs.flowDropEnabled, function (value) { + if (value) { + assignDrop(); + } else { + unAssignDrop(); + } + }); + } else { + assignDrop(); + } + function assignDrop() { + scope.$flow.assignDrop(element); + } + function unAssignDrop() { + scope.$flow.unAssignDrop(element); + } + } + }; +}); + +!function (angular) {'use strict'; + var module = angular.module('flow.events', ['flow.init']); + var events = { + fileSuccess: ['$file', '$message'], + fileProgress: ['$file'], + fileAdded: ['$file', '$event'], + filesAdded: ['$files', '$event'], + filesSubmitted: ['$files', '$event'], + fileRetry: ['$file'], + fileRemoved: ['$file'], + fileError: ['$file', '$message'], + uploadStart: [], + complete: [], + progress: [], + error: ['$message', '$file'] + }; + + angular.forEach(events, function (eventArgs, eventName) { + var name = 'flow' + capitaliseFirstLetter(eventName); + if (name == 'flowUploadStart') { + name = 'flowUploadStarted';// event alias + } + module.directive(name, [function() { + return { + require: '^flowInit', + controller: ['$scope', '$attrs', function ($scope, $attrs) { + $scope.$on('flow::' + eventName, function () { + var funcArgs = Array.prototype.slice.call(arguments); + var event = funcArgs.shift();// remove angular event + // remove flow object and ignore event if it is from parent directive + if ($scope.$flow !== funcArgs.shift()) { + return ; + } + var args = {}; + angular.forEach(eventArgs, function(value, key) { + args[value] = funcArgs[key]; + }); + if ($scope.$eval($attrs[name], args) === false) { + event.preventDefault(); + } + }); + }] + }; + }]); + }); + + function capitaliseFirstLetter(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + } +}(angular); + +angular.module('flow.img', ['flow.init']) +.directive('flowImg', [function() { + return { + 'scope': false, + 'require': '^flowInit', + 'link': function(scope, element, attrs) { + var file = attrs.flowImg; + scope.$watch(file, function (file) { + if (!file) { + return ; + } + var fileReader = new FileReader(); + fileReader.readAsDataURL(file.file); + fileReader.onload = function (event) { + scope.$apply(function () { + attrs.$set('src', event.target.result); + }); + }; + }); + } + }; +}]); +angular.module('flow.transfers', ['flow.init']) +.directive('flowTransfers', [function() { + return { + 'scope': true, + 'require': '^flowInit', + 'link': function(scope) { + scope.transfers = scope.$flow.files; + } + }; +}]); +angular.module('flow', ['flow.provider', 'flow.init', 'flow.events', 'flow.btn', + 'flow.drop', 'flow.transfers', 'flow.img', 'flow.dragEvents']); + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/angular.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/angular.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ng": () => (/* binding */ ng) +/* harmony export */ }); +/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! angular */ "./node_modules/angular/index-exposed.js"); +/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_0__); +/** @publicapi @module ng1 */ /** */ + +/** @hidden */ var ng_from_global = angular; +/** @hidden */ var ng = angular__WEBPACK_IMPORTED_MODULE_0__ && angular__WEBPACK_IMPORTED_MODULE_0__.module ? angular__WEBPACK_IMPORTED_MODULE_0__ : ng_from_global; +//# sourceMappingURL=angular.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* eslint-disable @typescript-eslint/no-empty-interface */ +/* eslint-disable prefer-const */ +/** + * # Angular 1 Directives + * + * These are the directives included in UI-Router for Angular 1. + * These directives are used in templates to create viewports and link/navigate to states. + * + * @preferred @publicapi @module directives + */ /** */ + + +/** @hidden */ +function parseStateRef(ref) { + var paramsOnly = ref.match(/^\s*({[^}]*})\s*$/); + if (paramsOnly) + ref = '(' + paramsOnly[1] + ')'; + var parsed = ref.replace(/\n/g, ' ').match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/); + if (!parsed || parsed.length !== 4) + throw new Error("Invalid state ref '" + ref + "'"); + return { state: parsed[1] || null, paramExpr: parsed[3] || null }; +} +/** @hidden */ +function stateContext(el) { + var $uiView = el.parent().inheritedData('$uiView'); + var path = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.parse)('$cfg.path')($uiView); + return path ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(path).state.name : undefined; +} +/** @hidden */ +function processedDef($state, $element, def) { + var uiState = def.uiState || $state.current.name; + var uiStateOpts = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)(defaultOpts($element, $state), def.uiStateOpts || {}); + var href = $state.href(uiState, def.uiStateParams, uiStateOpts); + return { uiState: uiState, uiStateParams: def.uiStateParams, uiStateOpts: uiStateOpts, href: href }; +} +/** @hidden */ +function getTypeInfo(el) { + // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. + var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]'; + var isForm = el[0].nodeName === 'FORM'; + return { + attr: isForm ? 'action' : isSvg ? 'xlink:href' : 'href', + isAnchor: el.prop('tagName').toUpperCase() === 'A', + clickable: !isForm, + }; +} +/** @hidden */ +function clickHook(el, $state, $timeout, type, getDef) { + return function (e) { + var button = e.which || e.button, target = getDef(); + if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || el.attr('target'))) { + // HACK: This is to allow ng-clicks to be processed before the transition is initiated: + var transition_1 = $timeout(function () { + if (!el.attr('disabled')) { + $state.go(target.uiState, target.uiStateParams, target.uiStateOpts); + } + }); + e.preventDefault(); + // if the state has no URL, ignore one preventDefault from the directive. + var ignorePreventDefaultCount_1 = type.isAnchor && !target.href ? 1 : 0; + e.preventDefault = function () { + if (ignorePreventDefaultCount_1-- <= 0) + $timeout.cancel(transition_1); + }; + } + }; +} +/** @hidden */ +function defaultOpts(el, $state) { + return { + relative: stateContext(el) || $state.$current, + inherit: true, + source: 'sref', + }; +} +/** @hidden */ +function bindEvents(element, scope, hookFn, uiStateOpts) { + var events; + if (uiStateOpts) { + events = uiStateOpts.events; + } + if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(events)) { + events = ['click']; + } + var on = element.on ? 'on' : 'bind'; + for (var _i = 0, events_1 = events; _i < events_1.length; _i++) { + var event_1 = events_1[_i]; + element[on](event_1, hookFn); + } + scope.$on('$destroy', function () { + var off = element.off ? 'off' : 'unbind'; + for (var _i = 0, events_2 = events; _i < events_2.length; _i++) { + var event_2 = events_2[_i]; + element[off](event_2, hookFn); + } + }); +} +/** + * `ui-sref`: A directive for linking to a state + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * ### Linked State + * The attribute value of the `ui-sref` is the name of the state to link to. + * + * #### Example: + * This will activate the `home` state when the link is clicked. + * ```html + * Home + * ``` + * + * ### Relative Links + * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]). + * You just need to be aware that the path is relative to the state that *created* the link. + * This allows a state to create a relative `ui-sref` which always targets the same destination. + * + * #### Example: + * Both these links are relative to the parent state, even when a child state is currently active. + * ```html + * child 1 state + * child 2 state + * ``` + * + * This link activates the parent state. + * ```html + * Return + * ``` + * + * ### hrefs + * If the linked state has a URL, the directive will automatically generate and + * update the `href` attribute (using the [[StateService.href]] method). + * + * #### Example: + * Assuming the `users` state has a url of `/users/` + * ```html + * Users + * ``` + * + * ### Parameter Values + * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state. + * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses. + * The content inside the parentheses is an expression, evaluated to the parameter values. + * + * #### Example: + * This example renders a list of links to users. + * The state's `userId` parameter value comes from each user's `user.id` property. + * ```html + *
  • + * {{ user.displayName }} + *
  • + * ``` + * + * Note: + * The parameter values expression is `$watch`ed for updates. + * + * ### Transition Options + * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute. + * Options are restricted to `location`, `inherit`, and `reload`. + * + * #### Example: + * ```html + * Home + * ``` + * + * ### Other DOM Events + * + * You can also customize which DOM events to respond to (instead of `click`) by + * providing an `events` array in the `ui-sref-opts` attribute. + * + * #### Example: + * ```html + * + * ``` + * + * ### Highlighting the active link + * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link. + * + * ### Examples + * If you have the following template: + * + * ```html + * Home + * About + * Next page + * + * + * ``` + * + * Then (assuming the current state is `contacts`) the rendered html including hrefs would be: + * + * ```html + * Home + * About + * Next page + * + *
      + *
    • + * Joe + *
    • + *
    • + * Alice + *
    • + *
    • + * Bob + *
    • + *
    + * + * Home + * ``` + * + * ### Notes + * + * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses. + * #### Example: + * Sets the `lang` parameter to `en` and remains on the same state. + * + * ```html + * English + * ``` + * + * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example. + * + * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons). + * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive. + */ +var uiSrefDirective; +uiSrefDirective = [ + '$uiRouter', + '$timeout', + function $StateRefDirective($uiRouter, $timeout) { + var $state = $uiRouter.stateService; + return { + restrict: 'A', + require: ['?^uiSrefActive', '?^uiSrefActiveEq'], + link: function (scope, element, attrs, uiSrefActive) { + var type = getTypeInfo(element); + var active = uiSrefActive[1] || uiSrefActive[0]; + var unlinkInfoFn = null; + var rawDef = {}; + var getDef = function () { return processedDef($state, element, rawDef); }; + var ref = parseStateRef(attrs.uiSref); + rawDef.uiState = ref.state; + rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {}; + function update() { + var def = getDef(); + if (unlinkInfoFn) + unlinkInfoFn(); + if (active) + unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams); + if (def.href != null) + attrs.$set(type.attr, def.href); + } + if (ref.paramExpr) { + scope.$watch(ref.paramExpr, function (val) { + rawDef.uiStateParams = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)({}, val); + update(); + }, true); + rawDef.uiStateParams = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)({}, scope.$eval(ref.paramExpr)); + } + update(); + scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update)); + scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update)); + if (!type.clickable) + return; + var hookFn = clickHook(element, $state, $timeout, type, getDef); + bindEvents(element, scope, hookFn, rawDef.uiStateOpts); + }, + }; + }, +]; +/** + * `ui-state`: A fully dynamic directive for linking to a state + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.** + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * ### Linked State + * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to. + * **This is in contrast with `ui-sref`, which takes a state name as a string literal.** + * + * #### Example: + * Create a list of links. + * ```html + *
  • + * {{ link.displayName }} + *
  • + * ``` + * + * ### Relative Links + * If the expression evaluates to a relative path, it is processed like [[uiSref]]. + * You just need to be aware that the path is relative to the state that *created* the link. + * This allows a state to create relative `ui-state` which always targets the same destination. + * + * ### hrefs + * If the linked state has a URL, the directive will automatically generate and + * update the `href` attribute (using the [[StateService.href]] method). + * + * ### Parameter Values + * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state. + * Param values should be provided using the `ui-state-params` attribute. + * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression. + * + * #### Example: + * This example renders a list of links with param values. + * The state's `userId` parameter value comes from each user's `user.id` property. + * ```html + *
  • + * {{ link.displayName }} + *
  • + * ``` + * + * ### Transition Options + * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute. + * Options are restricted to `location`, `inherit`, and `reload`. + * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression. + * + * #### Example: + * ```html + * Home + * ``` + * + * ### Other DOM Events + * + * You can also customize which DOM events to respond to (instead of `click`) by + * providing an `events` array in the `ui-state-opts` attribute. + * + * #### Example: + * ```html + * + * ``` + * + * ### Highlighting the active link + * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link. + * + * ### Notes + * + * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`. + * However, it might be simpler to use [[uiSref]] parameter-only links. + * + * #### Example: + * Sets the `lang` parameter to `en` and remains on the same state. + * + * ```html + * English + * ``` + * + * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example. + * ``` + */ +var uiStateDirective; +uiStateDirective = [ + '$uiRouter', + '$timeout', + function $StateRefDynamicDirective($uiRouter, $timeout) { + var $state = $uiRouter.stateService; + return { + restrict: 'A', + require: ['?^uiSrefActive', '?^uiSrefActiveEq'], + link: function (scope, element, attrs, uiSrefActive) { + var type = getTypeInfo(element); + var active = uiSrefActive[1] || uiSrefActive[0]; + var unlinkInfoFn = null; + var hookFn; + var rawDef = {}; + var getDef = function () { return processedDef($state, element, rawDef); }; + var inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts']; + var watchDeregFns = inputAttrs.reduce(function (acc, attr) { return ((acc[attr] = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.noop), acc); }, {}); + function update() { + var def = getDef(); + if (unlinkInfoFn) + unlinkInfoFn(); + if (active) + unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams); + if (def.href != null) + attrs.$set(type.attr, def.href); + } + inputAttrs.forEach(function (field) { + rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null; + attrs.$observe(field, function (expr) { + watchDeregFns[field](); + watchDeregFns[field] = scope.$watch(expr, function (newval) { + rawDef[field] = newval; + update(); + }, true); + }); + }); + update(); + scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update)); + scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update)); + if (!type.clickable) + return; + hookFn = clickHook(element, $state, $timeout, type, getDef); + bindEvents(element, scope, hookFn, rawDef.uiStateOpts); + }, + }; + }, +]; +/** + * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active + * + * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the + * related directive's state is active (and remove them when it is inactive). + * + * The primary use-case is to highlight the active link in navigation menus, + * distinguishing it from the inactive menu items. + * + * ### Linking to a `ui-sref` or `ui-state` + * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element. + * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**. + * + * ### Matching + * + * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**. + * This is a "fuzzy match" which uses [[StateService.includes]]. + * + * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active). + * This is an "exact match" which uses [[StateService.is]]. + * + * ### Parameter values + * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted. + * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted. + * + * #### Example: + * ```html + *
  • + * {{ user.lastName }} + *
  • + * ``` + * + * ### Examples + * + * Given the following template: + * #### Example: + * ```html + * + * ``` + * + * When the app state is `app.user` (or any child state), + * and contains the state parameter "user" with value "bilbobaggins", + * the resulting HTML will appear as (note the 'active' class): + * + * ```html + * + * ``` + * + * ### Glob mode + * + * It is possible to pass `ui-sref-active` an expression that evaluates to an object. + * The objects keys represent active class names and values represent the respective state names/globs. + * `ui-sref-active` will match if the current active state **includes** any of + * the specified state names/globs, even the abstract ones. + * + * #### Example: + * Given the following template, with "admin" being an abstract state: + * ```html + *
    + * Roles + *
    + * ``` + * + * Arrays are also supported as values in the `ngClass`-like interface. + * This allows multiple states to add `active` class. + * + * #### Example: + * Given the following template, with "admin.roles" being the current state, the class will be added too: + * ```html + *
    + * Roles + *
    + * ``` + * + * When the current state is "admin.roles" the "active" class will be applied to both the `
    ` and `` elements. + * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`. + * + * ### Notes: + * + * - The class name is interpolated **once** during the directives link time (any further changes to the + * interpolated value are ignored). + * + * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'` + */ +var uiSrefActiveDirective; +uiSrefActiveDirective = [ + '$state', + '$stateParams', + '$interpolate', + '$uiRouter', + function $StateRefActiveDirective($state, $stateParams, $interpolate, $uiRouter) { + return { + restrict: 'A', + controller: [ + '$scope', + '$element', + '$attrs', + function ($scope, $element, $attrs) { + var states = []; + var activeEqClass; + var uiSrefActive; + // There probably isn't much point in $observing this + // uiSrefActive and uiSrefActiveEq share the same directive object with some + // slight difference in logic routing + activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope); + try { + uiSrefActive = $scope.$eval($attrs.uiSrefActive); + } + catch (e) { + // Do nothing. uiSrefActive is not a valid expression. + // Fall back to using $interpolate below + } + uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope); + setStatesFromDefinitionObject(uiSrefActive); + // Allow uiSref to communicate with uiSrefActive[Equals] + this.$$addStateInfo = function (newState, newParams) { + // we already got an explicit state provided by ui-sref-active, so we + // shadow the one that comes from ui-sref + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(uiSrefActive) && states.length > 0) { + return; + } + var deregister = addState(newState, newParams, uiSrefActive); + update(); + return deregister; + }; + function updateAfterTransition(trans) { + trans.promise.then(update, _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.noop); + } + $scope.$on('$destroy', setupEventListeners()); + if ($uiRouter.globals.transition) { + updateAfterTransition($uiRouter.globals.transition); + } + function setupEventListeners() { + var deregisterStatesChangedListener = $uiRouter.stateRegistry.onStatesChanged(handleStatesChanged); + var deregisterOnStartListener = $uiRouter.transitionService.onStart({}, updateAfterTransition); + var deregisterStateChangeSuccessListener = $scope.$on('$stateChangeSuccess', update); + return function cleanUp() { + deregisterStatesChangedListener(); + deregisterOnStartListener(); + deregisterStateChangeSuccessListener(); + }; + } + function handleStatesChanged() { + setStatesFromDefinitionObject(uiSrefActive); + } + function setStatesFromDefinitionObject(statesDefinition) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(statesDefinition)) { + states = []; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.forEach)(statesDefinition, function (stateOrName, activeClass) { + // Helper function to abstract adding state. + var addStateForClass = function (stateOrName, activeClass) { + var ref = parseStateRef(stateOrName); + addState(ref.state, $scope.$eval(ref.paramExpr), activeClass); + }; + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isString)(stateOrName)) { + // If state is string, just add it. + addStateForClass(stateOrName, activeClass); + } + else if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(stateOrName)) { + // If state is an array, iterate over it and add each array item individually. + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.forEach)(stateOrName, function (stateOrName) { + addStateForClass(stateOrName, activeClass); + }); + } + }); + } + } + function addState(stateName, stateParams, activeClass) { + var state = $state.get(stateName, stateContext($element)); + var stateInfo = { + state: state || { name: stateName }, + params: stateParams, + activeClass: activeClass, + }; + states.push(stateInfo); + return function removeState() { + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.removeFrom)(states)(stateInfo); + }; + } + // Update route state + function update() { + var splitClasses = function (str) { return str.split(/\s/).filter(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.identity); }; + var getClasses = function (stateList) { + return stateList + .map(function (x) { return x.activeClass; }) + .map(splitClasses) + .reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []); + }; + var allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.uniqR, []); + var fuzzyClasses = getClasses(states.filter(function (x) { return $state.includes(x.state.name, x.params); })); + var exactlyMatchesAny = !!states.filter(function (x) { return $state.is(x.state.name, x.params); }).length; + var exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : []; + var addClasses = fuzzyClasses.concat(exactClasses).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.uniqR, []); + var removeClasses = allClasses.filter(function (cls) { return !(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.inArray)(addClasses, cls); }); + $scope.$evalAsync(function () { + addClasses.forEach(function (className) { return $element.addClass(className); }); + removeClasses.forEach(function (className) { return $element.removeClass(className); }); + }); + } + update(); + }, + ], + }; + }, +]; +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state') + .directive('uiSref', uiSrefDirective) + .directive('uiSrefActive', uiSrefActiveDirective) + .directive('uiSrefActiveEq', uiSrefActiveDirective) + .directive('uiState', uiStateDirective); +//# sourceMappingURL=stateDirectives.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "uiView": () => (/* binding */ uiView) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); +/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); +/** @publicapi @module directives */ /** */ + + + + +/** + * `ui-view`: A viewport directive which is filled in by a view from the active state. + * + * ### Attributes + * + * - `name`: (Optional) A view name. + * The name should be unique amongst the other views in the same state. + * You can have views of the same name that live in different states. + * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]). + * + * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated. + * Uses [[$uiViewScroll]] to do the scrolling. + * + * - `onload`: Expression to evaluate whenever the view updates. + * + * #### Example: + * A view can be unnamed or named. + * ```html + * + *
    + * + * + *
    + * + * + * + * ``` + * + * You can only have one unnamed view within any template (or root html). If you are only using a + * single view and it is unnamed then you can populate it like so: + * + * ```html + *
    + * $stateProvider.state("home", { + * template: "

    HELLO!

    " + * }) + * ``` + * + * The above is a convenient shortcut equivalent to specifying your view explicitly with the + * [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name: + * + * ```js + * $stateProvider.state("home", { + * views: { + * "": { + * template: "

    HELLO!

    " + * } + * } + * }) + * ``` + * + * But typically you'll only use the views property if you name your view or have more than one view + * in the same template. There's not really a compelling reason to name a view if its the only one, + * but you could if you wanted, like so: + * + * ```html + *
    + * ``` + * + * ```js + * $stateProvider.state("home", { + * views: { + * "main": { + * template: "

    HELLO!

    " + * } + * } + * }) + * ``` + * + * Really though, you'll use views to set up multiple views: + * + * ```html + *
    + *
    + *
    + * ``` + * + * ```js + * $stateProvider.state("home", { + * views: { + * "": { + * template: "

    HELLO!

    " + * }, + * "chart": { + * template: "" + * }, + * "data": { + * template: "" + * } + * } + * }) + * ``` + * + * #### Examples for `autoscroll`: + * ```html + * + * + * + * + * + * + * + * ``` + * + * Resolve data: + * + * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this + * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template. + * + * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the + * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which + * depends on `$resolve` data. + * + * #### Example: + * ```js + * $stateProvider.state('home', { + * template: '', + * resolve: { + * user: function(UserService) { return UserService.fetchUser(); } + * } + * }); + * ``` + */ +var uiView; +// eslint-disable-next-line prefer-const +uiView = [ + '$view', + '$animate', + '$uiViewScroll', + '$interpolate', + '$q', + function $ViewDirective($view, $animate, $uiViewScroll, $interpolate, $q) { + function getRenderer() { + return { + enter: function (element, target, cb) { + if (_angular__WEBPACK_IMPORTED_MODULE_1__.ng.version.minor > 2) { + $animate.enter(element, null, target).then(cb); + } + else { + $animate.enter(element, null, target, cb); + } + }, + leave: function (element, cb) { + if (_angular__WEBPACK_IMPORTED_MODULE_1__.ng.version.minor > 2) { + $animate.leave(element).then(cb); + } + else { + $animate.leave(element, cb); + } + }, + }; + } + function configsEqual(config1, config2) { + return config1 === config2; + } + var rootData = { + $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } }, + $uiView: {}, + }; + var directive = { + count: 0, + restrict: 'ECA', + terminal: true, + priority: 400, + transclude: 'element', + compile: function (tElement, tAttrs, $transclude) { + return function (scope, $element, attrs) { + var onloadExp = attrs['onload'] || '', autoScrollExp = attrs['autoscroll'], renderer = getRenderer(), inherited = $element.inheritedData('$uiView') || rootData, name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default'; + var previousEl, currentEl, currentScope, viewConfig; + var activeUIView = { + $type: 'ng1', + id: directive.count++, + name: name, + fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + '.' + name : name, + config: null, + configUpdated: configUpdatedCallback, + get creationContext() { + // The context in which this ui-view "tag" was created + var fromParentTagConfig = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('$cfg.viewDecl.$context')(inherited); + // Allow + // See https://github.com/angular-ui/ui-router/issues/3355 + var fromParentTag = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('$uiView.creationContext')(inherited); + return fromParentTagConfig || fromParentTag; + }, + }; + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Linking', activeUIView); + function configUpdatedCallback(config) { + if (config && !(config instanceof _statebuilders_views__WEBPACK_IMPORTED_MODULE_3__.Ng1ViewConfig)) + return; + if (configsEqual(viewConfig, config)) + return; + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context); + viewConfig = config; + updateView(config); + } + $element.data('$uiView', { $uiView: activeUIView }); + updateView(); + var unregister = $view.registerUIView(activeUIView); + scope.$on('$destroy', function () { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Destroying/Unregistering', activeUIView); + unregister(); + }); + function cleanupLastView() { + if (previousEl) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Removing (previous) el', previousEl.data('$uiView')); + previousEl.remove(); + previousEl = null; + } + if (currentScope) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Destroying scope', activeUIView); + currentScope.$destroy(); + currentScope = null; + } + if (currentEl) { + var _viewData_1 = currentEl.data('$uiViewAnim'); + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Animate out', _viewData_1); + renderer.leave(currentEl, function () { + _viewData_1.$$animLeave.resolve(); + previousEl = null; + }); + previousEl = currentEl; + currentEl = null; + } + } + function updateView(config) { + var newScope = scope.$new(); + var animEnter = $q.defer(), animLeave = $q.defer(); + var $uiViewData = { + $cfg: config, + $uiView: activeUIView, + }; + var $uiViewAnim = { + $animEnter: animEnter.promise, + $animLeave: animLeave.promise, + $$animLeave: animLeave, + }; + /** + * @ngdoc event + * @name ui.router.state.directive:ui-view#$viewContentLoading + * @eventOf ui.router.state.directive:ui-view + * @eventType emits on ui-view directive scope + * @description + * + * Fired once the view **begins loading**, *before* the DOM is rendered. + * + * @param {Object} event Event object. + * @param {string} viewName Name of the view. + */ + newScope.$emit('$viewContentLoading', name); + var cloned = $transclude(newScope, function (clone) { + clone.data('$uiViewAnim', $uiViewAnim); + clone.data('$uiView', $uiViewData); + renderer.enter(clone, $element, function onUIViewEnter() { + animEnter.resolve(); + if (currentScope) + currentScope.$emit('$viewContentAnimationEnded'); + if (((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(autoScrollExp) && !autoScrollExp) || scope.$eval(autoScrollExp)) { + $uiViewScroll(clone); + } + }); + cleanupLastView(); + }); + currentEl = cloned; + currentScope = newScope; + /** + * @ngdoc event + * @name ui.router.state.directive:ui-view#$viewContentLoaded + * @eventOf ui.router.state.directive:ui-view + * @eventType emits on ui-view directive scope + * @description * + * Fired once the view is **loaded**, *after* the DOM is rendered. + * + * @param {Object} event Event object. + */ + currentScope.$emit('$viewContentLoaded', config || viewConfig); + currentScope.$eval(onloadExp); + } + }; + }, + }; + return directive; + }, +]; +$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q']; +/** @hidden */ +function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q) { + var getControllerAs = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('viewDecl.controllerAs'); + var getResolveAs = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('viewDecl.resolveAs'); + return { + restrict: 'ECA', + priority: -400, + compile: function (tElement) { + var initial = tElement.html(); + tElement.empty(); + return function (scope, $element) { + var data = $element.data('$uiView'); + if (!data) { + $element.html(initial); + $compile($element.contents())(scope); + return; + } + var cfg = data.$cfg || { viewDecl: {}, getTemplate: _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.noop }; + var resolveCtx = cfg.path && new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(cfg.path); + $element.html(cfg.getTemplate($element, resolveCtx) || initial); + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewFill(data.$uiView, $element.html()); + var link = $compile($element.contents()); + var controller = cfg.controller; + var controllerAs = getControllerAs(cfg); + var resolveAs = getResolveAs(cfg); + var locals = resolveCtx && (0,_services__WEBPACK_IMPORTED_MODULE_2__.getLocals)(resolveCtx); + scope[resolveAs] = locals; + if (controller) { + var controllerInstance = ($controller(controller, (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)({}, locals, { $scope: scope, $element: $element }))); + if (controllerAs) { + scope[controllerAs] = controllerInstance; + scope[controllerAs][resolveAs] = locals; + } + // TODO: Use $view service as a central point for registering component-level hooks + // Then, when a component is created, tell the $view service, so it can invoke hooks + // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element }); + // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element })); + $element.data('$ngControllerController', controllerInstance); + $element.children().data('$ngControllerController', controllerInstance); + registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg); + } + // Wait for the component to appear in the DOM + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(cfg.component)) { + var kebobName = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.kebobString)(cfg.component); + var tagRegexp_1 = new RegExp("^(x-|data-)?" + kebobName + "$", 'i'); + var getComponentController = function () { + var directiveEl = [].slice + .call($element[0].children) + .filter(function (el) { return el && el.tagName && tagRegexp_1.exec(el.tagName); }); + return directiveEl && _angular__WEBPACK_IMPORTED_MODULE_1__.ng.element(directiveEl).data("$" + cfg.component + "Controller"); + }; + var deregisterWatch_1 = scope.$watch(getComponentController, function (ctrlInstance) { + if (!ctrlInstance) + return; + registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg); + deregisterWatch_1(); + }); + } + link(scope); + }; + }, + }; +} +/** @hidden */ +var hasComponentImpl = typeof _angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router')['component'] === 'function'; +/** @hidden incrementing id */ +var _uiCanExitId = 0; +/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */ +function registerControllerCallbacks($q, $transitions, controllerInstance, $scope, cfg) { + // Call $onInit() ASAP + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.$onInit) && + !((cfg.viewDecl.component || cfg.viewDecl.componentProvider) && hasComponentImpl)) { + controllerInstance.$onInit(); + } + var viewState = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.tail)(cfg.path).state.self; + var hookOptions = { bind: controllerInstance }; + // Add component-level hook for onUiParamsChanged + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.uiOnParamsChanged)) { + var resolveContext = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(cfg.path); + var viewCreationTrans_1 = resolveContext.getResolvable('$transition$').data; + // Fire callback on any successful transition + var paramsUpdated = function ($transition$) { + // Exit early if the $transition$ is the same as the view was created within. + // Exit early if the $transition$ will exit the state the view is for. + if ($transition$ === viewCreationTrans_1 || $transition$.exiting().indexOf(viewState) !== -1) + return; + var toParams = $transition$.params('to'); + var fromParams = $transition$.params('from'); + var getNodeSchema = function (node) { return node.paramSchema; }; + var toSchema = $transition$.treeChanges('to').map(getNodeSchema).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); + var fromSchema = $transition$.treeChanges('from').map(getNodeSchema).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); + // Find the to params that have different values than the from params + var changedToParams = toSchema.filter(function (param) { + var idx = fromSchema.indexOf(param); + return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]); + }); + // Only trigger callback if a to param has changed or is new + if (changedToParams.length) { + var changedKeys_1 = changedToParams.map(function (x) { return x.id; }); + // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params. + var newValues = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.filter)(toParams, function (val, key) { return changedKeys_1.indexOf(key) !== -1; }); + controllerInstance.uiOnParamsChanged(newValues, $transition$); + } + }; + $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions)); + } + // Add component-level hook for uiCanExit + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.uiCanExit)) { + var id_1 = _uiCanExitId++; + var cacheProp_1 = '_uiCanExitIds'; + // Returns true if a redirect transition already answered truthy + var prevTruthyAnswer_1 = function (trans) { + return !!trans && ((trans[cacheProp_1] && trans[cacheProp_1][id_1] === true) || prevTruthyAnswer_1(trans.redirectedFrom())); + }; + // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition + var wrappedHook = function (trans) { + var promise; + var ids = (trans[cacheProp_1] = trans[cacheProp_1] || {}); + if (!prevTruthyAnswer_1(trans)) { + promise = $q.when(controllerInstance.uiCanExit(trans)); + promise.then(function (val) { return (ids[id_1] = val !== false); }); + } + return promise; + }; + var criteria = { exiting: viewState.name }; + $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions)); + } +} +_angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router.state').directive('uiView', uiView); +_angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router.state').directive('uiView', $ViewDirectiveFill); +//# sourceMappingURL=viewDirective.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getLocals": () => (/* reexport safe */ _services__WEBPACK_IMPORTED_MODULE_1__.getLocals), +/* harmony export */ "watchDigests": () => (/* reexport safe */ _services__WEBPACK_IMPORTED_MODULE_1__.watchDigests), +/* harmony export */ "Ng1ViewConfig": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.Ng1ViewConfig), +/* harmony export */ "getNg1ViewConfigFactory": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.getNg1ViewConfigFactory), +/* harmony export */ "ng1ViewsBuilder": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.ng1ViewsBuilder), +/* harmony export */ "StateProvider": () => (/* reexport safe */ _stateProvider__WEBPACK_IMPORTED_MODULE_3__.StateProvider), +/* harmony export */ "UrlRouterProvider": () => (/* reexport safe */ _urlRouterProvider__WEBPACK_IMPORTED_MODULE_4__.UrlRouterProvider), +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), +/* harmony export */ "core": () => (/* reexport module object */ _uirouter_core__WEBPACK_IMPORTED_MODULE_10__) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/angularjs/lib-esm/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(["default","core"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); +/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); +/* harmony import */ var _stateProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateProvider */ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js"); +/* harmony import */ var _urlRouterProvider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./urlRouterProvider */ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js"); +/* harmony import */ var _injectables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./injectables */ "./node_modules/@uirouter/angularjs/lib-esm/injectables.js"); +/* harmony import */ var _injectables__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_injectables__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _directives_stateDirectives__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./directives/stateDirectives */ "./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js"); +/* harmony import */ var _stateFilters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stateFilters */ "./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js"); +/* harmony import */ var _directives_viewDirective__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./directives/viewDirective */ "./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js"); +/* harmony import */ var _viewScroll__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./viewScroll */ "./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _uirouter_core__WEBPACK_IMPORTED_MODULE_10__) if(["default","core","getLocals","watchDigests","Ng1ViewConfig","getNg1ViewConfigFactory","ng1ViewsBuilder","StateProvider","UrlRouterProvider"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _uirouter_core__WEBPACK_IMPORTED_MODULE_10__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/** + * Main entry point for angular 1.x build + * @publicapi @module ng1 + */ /** */ + + + + + + + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ('ui.router'); + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/injectables.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/injectables.js ***! + \*****************************************************************/ +/***/ (() => { + +/** + * The current (or pending) State Parameters + * + * An injectable global **Service Object** which holds the state parameters for the latest **SUCCESSFUL** transition. + * + * The values are not updated until *after* a `Transition` successfully completes. + * + * **Also:** an injectable **Per-Transition Object** object which holds the pending state parameters for the pending `Transition` currently running. + * + * ### Deprecation warning: + * + * The value injected for `$stateParams` is different depending on where it is injected. + * + * - When injected into an angular service, the object injected is the global **Service Object** with the parameter values for the latest successful `Transition`. + * - When injected into transition hooks, resolves, or view controllers, the object is the **Per-Transition Object** with the parameter values for the running `Transition`. + * + * Because of these confusing details, this service is deprecated. + * + * ### Instead of using the global `$stateParams` service object, + * inject [[$uiRouterGlobals]] and use [[UIRouterGlobals.params]] + * + * ```js + * MyService.$inject = ['$uiRouterGlobals']; + * function MyService($uiRouterGlobals) { + * return { + * paramValues: function () { + * return $uiRouterGlobals.params; + * } + * } + * } + * ``` + * + * ### Instead of using the per-transition `$stateParams` object, + * inject the current `Transition` (as [[$transition$]]) and use [[Transition.params]] + * + * ```js + * MyController.$inject = ['$transition$']; + * function MyController($transition$) { + * var username = $transition$.params().username; + * // .. do something with username + * } + * ``` + * + * --- + * + * This object can be injected into other services. + * + * #### Deprecated Example: + * ```js + * SomeService.$inject = ['$http', '$stateParams']; + * function SomeService($http, $stateParams) { + * return { + * getUser: function() { + * return $http.get('/api/users/' + $stateParams.username); + * } + * } + * }; + * angular.service('SomeService', SomeService); + * ``` + * @deprecated + */ +var $stateParams; +/** + * Global UI-Router variables + * + * The router global state as a **Service Object** (injectable during runtime). + * + * This object contains globals such as the current state and current parameter values. + */ +var $uiRouterGlobals; +/** + * The UI-Router instance + * + * The [[UIRouter]] singleton (the router instance) as a **Service Object** (injectable during runtime). + * + * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap. + * It has references to the other UI-Router services + * + * #### Note: This object is also exposed as [[$uiRouterProvider]] for injection during angular config time. + */ +var $uiRouter; +/** + * The UI-Router instance + * + * The [[UIRouter]] singleton (the router instance) as a **Provider Object** (injectable during config phase). + * + * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap. + * It has references to the other UI-Router services + * + * #### Note: This object is also exposed as [[$uiRouter]] for injection during runtime. + */ +var $uiRouterProvider; +/** + * Transition debug/tracing + * + * The [[Trace]] singleton as a **Service Object** (injectable during runtime). + * + * Enables or disables Transition tracing which can help to debug issues. + */ +var $trace; +/** + * The Transition Service + * + * The [[TransitionService]] singleton as a **Service Object** (injectable during runtime). + * + * This angular service exposes the [[TransitionService]] singleton, which is primarily + * used to register global transition hooks. + * + * #### Note: This object is also exposed as [[$transitionsProvider]] for injection during the config phase. + */ +var $transitions; +/** + * The Transition Service + * + * The [[TransitionService]] singleton as a **Provider Object** (injectable during config phase) + * + * This angular service exposes the [[TransitionService]] singleton, which is primarily + * used to register global transition hooks. + * + * #### Note: This object is also exposed as [[$transitions]] for injection during runtime. + */ +var $transitionsProvider; +/** + * The current [[Transition]] object + * + * The current [[Transition]] object as a **Per-Transition Object** (injectable into Resolve, Hooks, Controllers) + * + * This object returns information about the current transition, including: + * + * - To/from states + * - To/from parameters + * - Transition options + * - States being entered, exited, and retained + * - Resolve data + * - A Promise for the transition + * - Any transition failure information + * - An injector for both Service and Per-Transition Objects + */ +var $transition$; +/** + * The State Service + * + * The [[StateService]] singleton as a **Service Object** (injectable during runtime). + * + * This service used to manage and query information on registered states. + * It exposes state related APIs including: + * + * - Start a [[Transition]] + * - Imperatively lazy load states + * - Check if a state is currently active + * - Look up states by name + * - Build URLs for a state+parameters + * - Configure the global Transition error handler + * + * This angular service exposes the [[StateService]] singleton. + */ +var $state; +/** + * The State Registry + * + * The [[StateRegistry]] singleton as a **Service Object** (injectable during runtime). + * + * This service is used to register/deregister states. + * It has state registration related APIs including: + * + * - Register/deregister states + * - Listen for state registration/deregistration + * - Get states by name + * - Add state decorators (to customize the state creation process) + * + * #### Note: This object is also exposed as [[$stateRegistryProvider]] for injection during the config phase. + */ +var $stateRegistry; +/** + * The State Registry + * + * The [[StateRegistry]] singleton as a **Provider Object** (injectable during config time). + * + * This service is used to register/deregister states. + * It has state registration related APIs including: + * + * - Register/deregister states + * - Listen for state registration/deregistration + * - Get states by name + * - Add state decorators (to customize the state creation process) + * + * #### Note: This object is also exposed as [[$stateRegistry]] for injection during runtime. + */ +var $stateRegistryProvider; +/** + * The View Scroll provider + * + * The [[UIViewScrollProvider]] as a **Provider Object** (injectable during config time). + * + * This angular service exposes the [[UIViewScrollProvider]] singleton and is + * used to disable UI-Router's scroll behavior. + */ +var $uiViewScrollProvider; +/** + * The View Scroll function + * + * The View Scroll function as a **Service Object** (injectable during runtime). + * + * This is a function that scrolls an element into view. + * The element is scrolled after a `$timeout` so the DOM has time to refresh. + * + * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor, + * this can be enabled by calling [[UIViewScrollProvider.useAnchorScroll]]. + * + * Note: this function is used by the [[directives.uiView]] when the `autoscroll` expression evaluates to true. + */ +var $uiViewScroll; +/** + * The StateProvider + * + * An angular1-only [[StateProvider]] as a **Provider Object** (injectable during config time). + * + * This angular service exposes the [[StateProvider]] singleton. + * + * The `StateProvider` is primarily used to register states or add custom state decorators. + * + * ##### Note: This provider is a ng1 vestige. + * It is a passthrough to [[$stateRegistry]] and [[$state]]. + */ +var $stateProvider; +/** + * The URL Service Provider + * + * The [[UrlService]] singleton as a **Provider Object** (injectable during the angular config phase). + * + * A service used to configure and interact with the URL. + * It has URL related APIs including: + * + * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]]) + * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]]) + * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]]) + * - delay initial URL synchronization [[UrlService.deferIntercept]]. + * - get or set the current url: [[UrlService.url]] + * + * ##### Note: This service can also be injected during runtime as [[$urlService]]. + */ +var $urlServiceProvider; +/** + * The URL Service + * + * The [[UrlService]] singleton as a **Service Object** (injectable during runtime). + * + * Note: This service can also be injected during the config phase as [[$urlServiceProvider]]. + * + * Used to configure the URL. + * It has URL related APIs including: + * + * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]]) + * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]]) + * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]]) + * - delay initial URL synchronization [[UrlService.deferIntercept]]. + * - get or set the current url: [[UrlService.url]] + * + * ##### Note: This service can also be injected during the config phase as [[$urlServiceProvider]]. + */ +var $urlService; +/** + * The URL Router Provider + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlServiceProvider]] instead. + * + * The [[UrlRouter]] singleton as a **Provider Object** (injectable during config time). + * + * #### Note: This object is also exposed as [[$urlRouter]] for injection during runtime. + * + * @deprecated + */ +var $urlRouterProvider; +/** + * The Url Router + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. + * + * The [[UrlRouter]] singleton as a **Service Object** (injectable during runtime). + * + * #### Note: This object is also exposed as [[$urlRouterProvider]] for injection during angular config time. + * + * @deprecated + */ +var $urlRouter; +/** + * The URL Matcher Factory + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. + * + * The [[UrlMatcherFactory]] singleton as a **Service Object** (injectable during runtime). + * + * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects. + * + * #### Note: This object is also exposed as [[$urlMatcherFactoryProvider]] for injection during angular config time. + * + * @deprecated + */ +var $urlMatcherFactory; +/** + * The URL Matcher Factory + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. + * + * The [[UrlMatcherFactory]] singleton as a **Provider Object** (injectable during config time). + * + * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects. + * + * #### Note: This object is also exposed as [[$urlMatcherFactory]] for injection during runtime. + * + * @deprecated + */ +var $urlMatcherFactoryProvider; +//# sourceMappingURL=injectables.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/interface.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/interface.js ***! + \***************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/locationServices.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/locationServices.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Ng1LocationServices": () => (/* binding */ Ng1LocationServices) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module ng1 */ /** */ + + +/** + * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service + * @internalapi + */ +var Ng1LocationServices = /** @class */ (function () { + function Ng1LocationServices($locationProvider) { + // .onChange() registry + this._urlListeners = []; + this.$locationProvider = $locationProvider; + var _lp = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)($locationProvider); + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_lp, this, _lp, ['hashPrefix']); + } + /** + * Applys ng1-specific path parameter encoding + * + * The Angular 1 `$location` service is a bit weird. + * It doesn't allow slashes to be encoded/decoded bi-directionally. + * + * See the writeup at https://github.com/angular-ui/ui-router/issues/2598 + * + * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F + * + * @param router + */ + Ng1LocationServices.monkeyPatchPathParameterType = function (router) { + var pathType = router.urlMatcherFactory.type('path'); + pathType.encode = function (x) { + return x != null ? x.toString().replace(/(~|\/)/g, function (m) { return ({ '~': '~~', '/': '~2F' }[m]); }) : x; + }; + pathType.decode = function (x) { + return x != null ? x.toString().replace(/(~~|~2F)/g, function (m) { return ({ '~~': '~', '~2F': '/' }[m]); }) : x; + }; + }; + // eslint-disable-next-line @typescript-eslint/no-empty-function + Ng1LocationServices.prototype.dispose = function () { }; + Ng1LocationServices.prototype.onChange = function (callback) { + var _this = this; + this._urlListeners.push(callback); + return function () { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._urlListeners)(callback); }; + }; + Ng1LocationServices.prototype.html5Mode = function () { + var html5Mode = this.$locationProvider.html5Mode(); + html5Mode = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isObject)(html5Mode) ? html5Mode.enabled : html5Mode; + return html5Mode && this.$sniffer.history; + }; + Ng1LocationServices.prototype.baseHref = function () { + return this._baseHref || (this._baseHref = this.$browser.baseHref() || this.$window.location.pathname); + }; + Ng1LocationServices.prototype.url = function (newUrl, replace, state) { + if (replace === void 0) { replace = false; } + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newUrl)) + this.$location.url(newUrl); + if (replace) + this.$location.replace(); + if (state) + this.$location.state(state); + return this.$location.url(); + }; + Ng1LocationServices.prototype._runtimeServices = function ($rootScope, $location, $sniffer, $browser, $window) { + var _this = this; + this.$location = $location; + this.$sniffer = $sniffer; + this.$browser = $browser; + this.$window = $window; + // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange + $rootScope.$on('$locationChangeSuccess', function (evt) { return _this._urlListeners.forEach(function (fn) { return fn(evt); }); }); + var _loc = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)($location); + // Bind these LocationService functions to $location + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_loc, this, _loc, ['replace', 'path', 'search', 'hash']); + // Bind these LocationConfig functions to $location + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_loc, this, _loc, ['port', 'protocol', 'host']); + }; + return Ng1LocationServices; +}()); + +//# sourceMappingURL=locationServices.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/services.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/services.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "watchDigests": () => (/* binding */ watchDigests), +/* harmony export */ "getLocals": () => (/* binding */ getLocals) +/* harmony export */ }); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); +/* harmony import */ var _templateFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./templateFactory */ "./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js"); +/* harmony import */ var _stateProvider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateProvider */ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js"); +/* harmony import */ var _statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./statebuilders/onEnterExitRetain */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js"); +/* harmony import */ var _locationServices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./locationServices */ "./node_modules/@uirouter/angularjs/lib-esm/locationServices.js"); +/* harmony import */ var _urlRouterProvider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./urlRouterProvider */ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js"); +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/** + * # Angular 1 types + * + * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc. + * The customizations to the core types for Angular UI-Router are documented here. + * + * The optional [[$resolve]] service is also documented here. + * + * @preferred @publicapi @module ng1 + */ /** */ + + + + + + + + +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.angular1', []); +var mod_init = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.init', ['ng']); +var mod_util = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.util', ['ui.router.init']); +var mod_rtr = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.router', ['ui.router.util']); +var mod_state = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']); +var mod_main = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']); +var mod_cmpt = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.compat', ['ui.router']); +var router = null; +$uiRouterProvider.$inject = ['$locationProvider']; +/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */ +function $uiRouterProvider($locationProvider) { + // Create a new instance of the Router when the $uiRouterProvider is initialized + router = this.router = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.UIRouter(); + router.stateProvider = new _stateProvider__WEBPACK_IMPORTED_MODULE_4__.StateProvider(router.stateRegistry, router.stateService); + // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties + router.stateRegistry.decorator('views', _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.ng1ViewsBuilder); + router.stateRegistry.decorator('onExit', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onExit')); + router.stateRegistry.decorator('onRetain', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onRetain')); + router.stateRegistry.decorator('onEnter', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onEnter')); + router.viewService._pluginapi._viewConfigFactory('ng1', (0,_statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.getNg1ViewConfigFactory)()); + // Disable decoding of params by UrlMatcherFactory because $location already handles this + router.urlService.config._decodeParams = false; + var ng1LocationService = (router.locationService = router.locationConfig = new _locationServices__WEBPACK_IMPORTED_MODULE_6__.Ng1LocationServices($locationProvider)); + _locationServices__WEBPACK_IMPORTED_MODULE_6__.Ng1LocationServices.monkeyPatchPathParameterType(router); + // backwards compat: also expose router instance as $uiRouterProvider.router + router['router'] = router; + router['$get'] = $get; + $get.$inject = ['$location', '$browser', '$window', '$sniffer', '$rootScope', '$http', '$templateCache']; + function $get($location, $browser, $window, $sniffer, $rootScope, $http, $templateCache) { + ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser, $window); + delete router['router']; + delete router['$get']; + return router; + } + return router; +} +var getProviderFor = function (serviceName) { return [ + '$uiRouterProvider', + function ($urp) { + var service = $urp.router[serviceName]; + service['$get'] = function () { return service; }; + return service; + }, +]; }; +// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime) +runBlock.$inject = ['$injector', '$q', '$uiRouter']; +function runBlock($injector, $q, $uiRouter) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector = $injector; + _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q = $q; + // https://github.com/angular-ui/ui-router/issues/3678 + if (!Object.prototype.hasOwnProperty.call($injector, 'strictDi')) { + try { + $injector.invoke(function (checkStrictDi) { }); + } + catch (error) { + $injector.strictDi = !!/strict mode/.exec(error && error.toString()); + } + } + // The $injector is now available. + // Find any resolvables that had dependency annotation deferred + $uiRouter.stateRegistry + .get() + .map(function (x) { return x.$$state().resolvables; }) + .reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []) + .filter(function (x) { return x.deps === 'deferred'; }) + .forEach(function (resolvable) { return (resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi)); }); +} +// $urlRouter service and $urlRouterProvider +var getUrlRouterProvider = function (uiRouter) { return (uiRouter.urlRouterProvider = new _urlRouterProvider__WEBPACK_IMPORTED_MODULE_7__.UrlRouterProvider(uiRouter)); }; +// $state service and $stateProvider +// $urlRouter service and $urlRouterProvider +var getStateProvider = function () { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)(router.stateProvider, { $get: function () { return router.stateService; } }); }; +watchDigests.$inject = ['$rootScope']; +function watchDigests($rootScope) { + $rootScope.$watch(function () { + _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.trace.approximateDigests++; + }); +} +mod_init.provider('$uiRouter', $uiRouterProvider); +mod_rtr.provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]); +mod_util.provider('$urlService', getProviderFor('urlService')); +mod_util.provider('$urlMatcherFactory', ['$uiRouterProvider', function () { return router.urlMatcherFactory; }]); +mod_util.provider('$templateFactory', function () { return new _templateFactory__WEBPACK_IMPORTED_MODULE_3__.TemplateFactory(); }); +mod_state.provider('$stateRegistry', getProviderFor('stateRegistry')); +mod_state.provider('$uiRouterGlobals', getProviderFor('globals')); +mod_state.provider('$transitions', getProviderFor('transitionService')); +mod_state.provider('$state', ['$uiRouterProvider', getStateProvider]); +mod_state.factory('$stateParams', ['$uiRouter', function ($uiRouter) { return $uiRouter.globals.params; }]); +mod_main.factory('$view', function () { return router.viewService; }); +mod_main.service('$trace', function () { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.trace; }); +mod_main.run(watchDigests); +mod_util.run(['$urlMatcherFactory', function ($urlMatcherFactory) { }]); +mod_state.run(['$state', function ($state) { }]); +mod_rtr.run(['$urlRouter', function ($urlRouter) { }]); +mod_init.run(runBlock); +/** @hidden TODO: find a place to move this */ +var getLocals = function (ctx) { + var tokens = ctx.getTokens().filter(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isString); + var tuples = tokens.map(function (key) { + var resolvable = ctx.getResolvable(key); + var waitPolicy = ctx.getPolicy(resolvable).async; + return [key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data]; + }); + return tuples.reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.applyPairs, {}); +}; +//# sourceMappingURL=services.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$IsStateFilter": () => (/* binding */ $IsStateFilter), +/* harmony export */ "$IncludedByStateFilter": () => (/* binding */ $IncludedByStateFilter) +/* harmony export */ }); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/** @publicapi @module ng1 */ /** */ + +/** + * `isState` Filter: truthy if the current state is the parameter + * + * Translates to [[StateService.is]] `$state.is("stateName")`. + * + * #### Example: + * ```html + *
    show if state is 'stateName'
    + * ``` + */ +$IsStateFilter.$inject = ['$state']; +function $IsStateFilter($state) { + var isFilter = function (state, params, options) { + return $state.is(state, params, options); + }; + isFilter.$stateful = true; + return isFilter; +} +/** + * `includedByState` Filter: truthy if the current state includes the parameter + * + * Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`. + * + * #### Example: + * ```html + *
    show if state includes 'fullOrPartialStateName'
    + * ``` + */ +$IncludedByStateFilter.$inject = ['$state']; +function $IncludedByStateFilter($state) { + var includesFilter = function (state, params, options) { + return $state.includes(state, params, options); + }; + includesFilter.$stateful = true; + return includesFilter; +} +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state').filter('isState', $IsStateFilter).filter('includedByState', $IncludedByStateFilter); + +//# sourceMappingURL=stateFilters.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateProvider": () => (/* binding */ StateProvider) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module ng1 */ /** */ + +/** + * The Angular 1 `StateProvider` + * + * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely + * on state. + * + * A state corresponds to a "place" in the application in terms of the overall UI and + * navigation. A state describes (via the controller / template / view properties) what + * the UI looks like and does at that place. + * + * States often have things in common, and the primary way of factoring out these + * commonalities in this model is via the state hierarchy, i.e. parent/child states aka + * nested states. + * + * The `$stateProvider` provides interfaces to declare these states for your app. + */ +var StateProvider = /** @class */ (function () { + function StateProvider(stateRegistry, stateService) { + this.stateRegistry = stateRegistry; + this.stateService = stateService; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)(StateProvider.prototype), this, (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)(this)); + } + /** + * Decorates states when they are registered + * + * Allows you to extend (carefully) or override (at your own peril) the + * `stateBuilder` object used internally by [[StateRegistry]]. + * This can be used to add custom functionality to ui-router, + * for example inferring templateUrl based on the state name. + * + * When passing only a name, it returns the current (original or decorated) builder + * function that matches `name`. + * + * The builder functions that can be decorated are listed below. Though not all + * necessarily have a good use case for decoration, that is up to you to decide. + * + * In addition, users can attach custom decorators, which will generate new + * properties within the state's internal definition. There is currently no clear + * use-case for this beyond accessing internal states (i.e. $state.$current), + * however, expect this to become increasingly relevant as we introduce additional + * meta-programming features. + * + * **Warning**: Decorators should not be interdependent because the order of + * execution of the builder functions in non-deterministic. Builder functions + * should only be dependent on the state definition object and super function. + * + * + * Existing builder functions and current return values: + * + * - **parent** `{object}` - returns the parent state object. + * - **data** `{object}` - returns state data, including any inherited data that is not + * overridden by own values (if any). + * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher} + * or `null`. + * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is + * navigable). + * - **params** `{object}` - returns an array of state params that are ensured to + * be a super-set of parent's params. + * - **views** `{object}` - returns a views object where each key is an absolute view + * name (i.e. "viewName@stateName") and each value is the config object + * (template, controller) for the view. Even when you don't use the views object + * explicitly on a state config, one is still created for you internally. + * So by decorating this builder function you have access to decorating template + * and controller properties. + * - **ownParams** `{object}` - returns an array of params that belong to the state, + * not including any params defined by ancestor states. + * - **path** `{string}` - returns the full path from the root down to this state. + * Needed for state activation. + * - **includes** `{object}` - returns an object that includes every state that + * would pass a `$state.includes()` test. + * + * #### Example: + * Override the internal 'views' builder with a function that takes the state + * definition, and a reference to the internal function being overridden: + * ```js + * $stateProvider.decorator('views', function (state, parent) { + * let result = {}, + * views = parent(state); + * + * angular.forEach(views, function (config, name) { + * let autoName = (state.name + '.' + name).replace('.', '/'); + * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html'; + * result[name] = config; + * }); + * return result; + * }); + * + * $stateProvider.state('home', { + * views: { + * 'contact.list': { controller: 'ListController' }, + * 'contact.item': { controller: 'ItemController' } + * } + * }); + * ``` + * + * + * ```js + * // Auto-populates list and item views with /partials/home/contact/list.html, + * // and /partials/home/contact/item.html, respectively. + * $state.go('home'); + * ``` + * + * @param {string} name The name of the builder function to decorate. + * @param {object} func A function that is responsible for decorating the original + * builder function. The function receives two parameters: + * + * - `{object}` - state - The state config object. + * - `{object}` - super - The original builder function. + * + * @return {object} $stateProvider - $stateProvider instance + */ + StateProvider.prototype.decorator = function (name, func) { + return this.stateRegistry.decorator(name, func) || this; + }; + StateProvider.prototype.state = function (name, definition) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isObject)(name)) { + definition = name; + } + else { + definition.name = name; + } + this.stateRegistry.register(definition); + return this; + }; + /** + * Registers an invalid state handler + * + * This is a passthrough to [[StateService.onInvalid]] for ng1. + */ + StateProvider.prototype.onInvalid = function (callback) { + return this.stateService.onInvalid(callback); + }; + return StateProvider; +}()); + +//# sourceMappingURL=stateProvider.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js ***! + \*************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getStateHookBuilder": () => (/* binding */ getStateHookBuilder) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); +/** @publicapi @module ng1 */ /** */ + + +/** + * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`, + * `onRetain` callback hooks on a [[Ng1StateDeclaration]]. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * ensures that those hooks are injectable for @uirouter/angularjs (ng1). + * + * @internalapi + */ +var getStateHookBuilder = function (hookName) { + return function stateHookBuilder(stateObject) { + var hook = stateObject[hookName]; + var pathname = hookName === 'onExit' ? 'from' : 'to'; + function decoratedNg1Hook(trans, state) { + var resolveContext = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(trans.treeChanges(pathname)); + var subContext = resolveContext.subContext(state.$$state()); + var locals = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)((0,_services__WEBPACK_IMPORTED_MODULE_1__.getLocals)(subContext), { $state$: state, $transition$: trans }); + return _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.invoke(hook, this, locals); + } + return hook ? decoratedNg1Hook : undefined; + }; +}; +//# sourceMappingURL=onEnterExitRetain.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getNg1ViewConfigFactory": () => (/* binding */ getNg1ViewConfigFactory), +/* harmony export */ "ng1ViewsBuilder": () => (/* binding */ ng1ViewsBuilder), +/* harmony export */ "Ng1ViewConfig": () => (/* binding */ Ng1ViewConfig) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module ng1 */ /** */ + +/** @internalapi */ +function getNg1ViewConfigFactory() { + var templateFactory = null; + return function (path, view) { + templateFactory = templateFactory || _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.get('$templateFactory'); + return [new Ng1ViewConfig(path, view, templateFactory)]; + }; +} +/** @internalapi */ +var hasAnyKey = function (keys, obj) { return keys.reduce(function (acc, key) { return acc || (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(obj[key]); }, false); }; +/** + * This is a [[StateBuilder.builder]] function for angular1 `views`. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * handles the `views` property with logic specific to @uirouter/angularjs (ng1). + * + * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object + * and applies the state-level configuration to a view named `$default`. + * + * @internalapi + */ +function ng1ViewsBuilder(state) { + // Do not process root state + if (!state.parent) + return {}; + var tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'], ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'], compKeys = ['component', 'bindings', 'componentProvider'], nonCompKeys = tplKeys.concat(ctrlKeys), allViewKeys = compKeys.concat(nonCompKeys); + // Do not allow a state to have both state-level props and also a `views: {}` property. + // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state. + // However, the `$default` approach should not be mixed with a separate `views: ` block. + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(state.views) && hasAnyKey(allViewKeys, state)) { + throw new Error("State '" + state.name + "' has a 'views' object. " + + "It cannot also have \"view properties\" at the state level. " + + "Move the following properties into a view (in the 'views' object): " + + (" " + allViewKeys.filter(function (key) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(state[key]); }).join(', '))); + } + var views = {}, viewsObject = state.views || { $default: (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.pick)(state, allViewKeys) }; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.forEach)(viewsObject, function (config, name) { + // Account for views: { "": { template... } } + name = name || '$default'; + // Account for views: { header: "headerComponent" } + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(config)) + config = { component: config }; + // Make a shallow copy of the config object + config = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)({}, config); + // Do not allow a view to mix props for component-style view with props for template/controller-style view + if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) { + throw new Error("Cannot combine: " + compKeys.join('|') + " with: " + nonCompKeys.join('|') + " in stateview: '" + name + "@" + state.name + "'"); + } + config.resolveAs = config.resolveAs || '$resolve'; + config.$type = 'ng1'; + config.$context = state; + config.$name = name; + var normalized = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ViewService.normalizeUIViewTarget(config.$context, config.$name); + config.$uiViewName = normalized.uiViewName; + config.$uiViewContextAnchor = normalized.uiViewContextAnchor; + views[name] = config; + }); + return views; +} +/** @hidden */ +var id = 0; +/** @internalapi */ +var Ng1ViewConfig = /** @class */ (function () { + function Ng1ViewConfig(path, viewDecl, factory) { + var _this = this; + this.path = path; + this.viewDecl = viewDecl; + this.factory = factory; + this.$id = id++; + this.loaded = false; + this.getTemplate = function (uiView, context) { + return _this.component + ? _this.factory.makeComponentTemplate(uiView, context, _this.component, _this.viewDecl.bindings) + : _this.template; + }; + } + Ng1ViewConfig.prototype.load = function () { + var _this = this; + var $q = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$q; + var context = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(this.path); + var params = this.path.reduce(function (acc, node) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)(acc, node.paramValues); }, {}); + var promises = { + template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)), + controller: $q.when(this.getController(context)), + }; + return $q.all(promises).then(function (results) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceViewServiceEvent('Loaded', _this); + _this.controller = results.controller; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)(_this, results.template); // Either { template: "tpl" } or { component: "cmpName" } + return _this; + }); + }; + /** + * Gets the controller for a view configuration. + * + * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller. + */ + Ng1ViewConfig.prototype.getController = function (context) { + var provider = this.viewDecl.controllerProvider; + if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isInjectable)(provider)) + return this.viewDecl.controller; + var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.annotate(provider); + var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.tail)(provider) : provider; + var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.Resolvable('', providerFn, deps); + return resolvable.get(context); + }; + return Ng1ViewConfig; +}()); + +//# sourceMappingURL=views.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TemplateFactory": () => (/* binding */ TemplateFactory) +/* harmony export */ }); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module view */ /** */ + + +/** + * Service which manages loading of templates from a ViewConfig. + */ +var TemplateFactory = /** @class */ (function () { + function TemplateFactory() { + var _this = this; + /** @hidden */ this._useHttp = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.version.minor < 3; + /** @hidden */ this.$get = [ + '$http', + '$templateCache', + '$injector', + function ($http, $templateCache, $injector) { + _this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest'); + _this.$http = $http; + _this.$templateCache = $templateCache; + return _this; + }, + ]; + } + /** @hidden */ + TemplateFactory.prototype.useHttpService = function (value) { + this._useHttp = value; + }; + /** + * Creates a template from a configuration object. + * + * @param config Configuration object for which to load a template. + * The following properties are search in the specified order, and the first one + * that is defined is used to create the template: + * + * @param params Parameters to pass to the template function. + * @param context The resolve context associated with the template's view + * + * @return {string|object} The template html as a string, or a promise for + * that string,or `null` if no template is configured. + */ + TemplateFactory.prototype.fromConfig = function (config, params, context) { + var defaultTemplate = ''; + var asTemplate = function (result) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(result).then(function (str) { return ({ template: str }); }); }; + var asComponent = function (result) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(result).then(function (str) { return ({ component: str }); }); }; + return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.template) + ? asTemplate(this.fromString(config.template, params)) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.templateUrl) + ? asTemplate(this.fromUrl(config.templateUrl, params)) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.templateProvider) + ? asTemplate(this.fromProvider(config.templateProvider, params, context)) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.component) + ? asComponent(config.component) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.componentProvider) + ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) + : asTemplate(defaultTemplate); + }; + /** + * Creates a template from a string or a function returning a string. + * + * @param template html template as a string or function that returns an html template as a string. + * @param params Parameters to pass to the template function. + * + * @return {string|object} The template html as a string, or a promise for that + * string. + */ + TemplateFactory.prototype.fromString = function (template, params) { + return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isFunction)(template) ? template(params) : template; + }; + /** + * Loads a template from the a URL via `$http` and `$templateCache`. + * + * @param {string|Function} url url of the template to load, or a function + * that returns a url. + * @param {Object} params Parameters to pass to the url function. + * @return {string|Promise.} The template html as a string, or a promise + * for that string. + */ + TemplateFactory.prototype.fromUrl = function (url, params) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isFunction)(url)) + url = url(params); + if (url == null) + return null; + if (this._useHttp) { + return this.$http + .get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } }) + .then(function (response) { + return response.data; + }); + } + return this.$templateRequest(url); + }; + /** + * Creates a template by invoking an injectable provider function. + * + * @param provider Function to invoke via `locals` + * @param {Function} injectFn a function used to invoke the template provider + * @return {string|Promise.} The template html as a string, or a promise + * for that string. + */ + TemplateFactory.prototype.fromProvider = function (provider, params, context) { + var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(provider); + var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(provider) : provider; + var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.Resolvable('', providerFn, deps); + return resolvable.get(context); + }; + /** + * Creates a component's template by invoking an injectable provider function. + * + * @param provider Function to invoke via `locals` + * @param {Function} injectFn a function used to invoke the template provider + * @return {string} The template html as a string: "". + */ + TemplateFactory.prototype.fromComponentProvider = function (provider, params, context) { + var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(provider); + var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(provider) : provider; + var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.Resolvable('', providerFn, deps); + return resolvable.get(context); + }; + /** + * Creates a template from a component's name + * + * This implements route-to-component. + * It works by retrieving the component (directive) metadata from the injector. + * It analyses the component's bindings, then constructs a template that instantiates the component. + * The template wires input and output bindings to resolves or from the parent component. + * + * @param uiView {object} The parent ui-view (for binding outputs to callbacks) + * @param context The ResolveContext (for binding outputs to callbacks returned from resolves) + * @param component {string} Component's name in camel case. + * @param bindings An object defining the component's bindings: {foo: '<'} + * @return {string} The template as a string: "". + */ + TemplateFactory.prototype.makeComponentTemplate = function (uiView, context, component, bindings) { + bindings = bindings || {}; + // Bind once prefix + var prefix = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.version.minor >= 3 ? '::' : ''; + // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-` + var kebob = function (camelCase) { + var kebobed = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.kebobString)(camelCase); + return /^(x|data)-/.exec(kebobed) ? "x-" + kebobed : kebobed; + }; + var attributeTpl = function (input) { + var name = input.name, type = input.type; + var attrName = kebob(name); + // If the ui-view has an attribute which matches a binding on the routed component + // then pass that attribute through to the routed component template. + // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:` + if (uiView.attr(attrName) && !bindings[name]) + return attrName + "='" + uiView.attr(attrName) + "'"; + var resolveName = bindings[name] || name; + // Pre-evaluate the expression for "@" bindings by enclosing in {{ }} + // some-attr="{{ ::$resolve.someResolveName }}" + if (type === '@') + return attrName + "='{{" + prefix + "$resolve." + resolveName + "}}'"; + // Wire "&" callbacks to resolves that return a callback function + // Get the result of the resolve (should be a function) and annotate it to get its arguments. + // some-attr="$resolve.someResolveResultName(foo, bar)" + if (type === '&') { + var res = context.getResolvable(resolveName); + var fn = res && res.data; + var args = (fn && _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(fn)) || []; + // account for array style injection, i.e., ['foo', function(foo) {}] + var arrayIdxStr = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(fn) ? "[" + (fn.length - 1) + "]" : ''; + return attrName + "='$resolve." + resolveName + arrayIdxStr + "(" + args.join(',') + ")'"; + } + // some-attr="::$resolve.someResolveName" + return attrName + "='" + prefix + "$resolve." + resolveName + "'"; + }; + var attrs = getComponentBindings(component).map(attributeTpl).join(' '); + var kebobName = kebob(component); + return "<" + kebobName + " " + attrs + ">"; + }; + return TemplateFactory; +}()); + +// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&') +function getComponentBindings(name) { + var cmpDefs = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.get(name + 'Directive'); // could be multiple + if (!cmpDefs || !cmpDefs.length) + throw new Error("Unable to find component named '" + name + "'"); + return cmpDefs.map(getBindings).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []); +} +// Given a directive definition, find its object input attributes +// Use different properties, depending on the type of directive (component, bindToController, normal) +var getBindings = function (def) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(def.bindToController)) + return scopeBindings(def.bindToController); + return scopeBindings(def.scope); +}; +// for ng 1.2 style, process the scope: { input: "=foo" } +// for ng 1.3 through ng 1.5, process the component's bindToController: { input: "=foo" } object +var scopeBindings = function (bindingsObj) { + return Object.keys(bindingsObj || {}) + // [ 'input', [ '=foo', '=', 'foo' ] ] + .map(function (key) { return [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])]; }) + // skip malformed values + .filter(function (tuple) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(tuple) && (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(tuple[1]); }) + // { name: ('foo' || 'input'), type: '=' } + .map(function (tuple) { return ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] }); }); +}; +//# sourceMappingURL=templateFactory.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRouterProvider": () => (/* binding */ UrlRouterProvider) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module url */ /** */ + + +/** + * Manages rules for client-side URL + * + * ### Deprecation warning: + * This class is now considered to be an internal API + * Use the [[UrlService]] instead. + * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]]. + * + * This class manages the router rules for what to do when the URL changes. + * + * This provider remains for backwards compatibility. + * + * @internalapi + * @deprecated + */ +var UrlRouterProvider = /** @class */ (function () { + /** @hidden */ + function UrlRouterProvider(/** @hidden */ router) { + this.router = router; + } + UrlRouterProvider.injectableHandler = function (router, handler) { + return function (match) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params }); }; + }; + /** @hidden */ + UrlRouterProvider.prototype.$get = function () { + var urlService = this.router.urlService; + this.router.urlRouter.update(true); + if (!urlService.interceptDeferred) + urlService.listen(); + return this.router.urlRouter; + }; + /** + * Registers a url handler function. + * + * Registers a low level url handler (a `rule`). + * A rule detects specific URL patterns and returns a redirect, or performs some action. + * + * If a rule returns a string, the URL is replaced with the string, and all rules are fired again. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * // Here's an example of how you might allow case insensitive urls + * $urlRouterProvider.rule(function ($injector, $location) { + * var path = $location.path(), + * normalized = path.toLowerCase(); + * + * if (path !== normalized) { + * return normalized; + * } + * }); + * }); + * ``` + * + * @param ruleFn + * Handler function that takes `$injector` and `$location` services as arguments. + * You can use them to detect a url and return a different url as a string. + * + * @return [[UrlRouterProvider]] (`this`) + */ + UrlRouterProvider.prototype.rule = function (ruleFn) { + var _this = this; + if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(ruleFn)) + throw new Error("'rule' must be a function"); + var match = function () { return ruleFn(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector, _this.router.locationService); }; + var rule = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.BaseUrlRule(match, _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.identity); + this.router.urlService.rules.rule(rule); + return this; + }; + /** + * Defines the path or behavior to use when no url can be matched. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * // if the path doesn't match any of the urls you configured + * // otherwise will take care of routing the user to the + * // specified url + * $urlRouterProvider.otherwise('/index'); + * + * // Example of using function rule as param + * $urlRouterProvider.otherwise(function ($injector, $location) { + * return '/a/valid/url'; + * }); + * }); + * ``` + * + * @param rule + * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`. + * The function version is passed two params: `$injector` and `$location` services, and should return a url string. + * + * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance + */ + UrlRouterProvider.prototype.otherwise = function (rule) { + var _this = this; + var urlRules = this.router.urlService.rules; + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(rule)) { + urlRules.otherwise(rule); + } + else if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(rule)) { + urlRules.otherwise(function () { return rule(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector, _this.router.locationService); }); + } + else { + throw new Error("'rule' must be a string or function"); + } + return this; + }; + /** + * Registers a handler for a given url matching. + * + * If the handler is a string, it is + * treated as a redirect, and is interpolated according to the syntax of match + * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise). + * + * If the handler is a function, it is injectable. + * It gets invoked if `$location` matches. + * You have the option of inject the match object as `$match`. + * + * The handler can return + * + * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter` + * will continue trying to find another one that matches. + * - **string** which is treated as a redirect and passed to `$location.url()` + * - **void** or any **truthy** value tells `$urlRouter` that the url was handled. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * $urlRouterProvider.when($state.url, function ($match, $stateParams) { + * if ($state.$current.navigable !== state || + * !equalForKeys($match, $stateParams) { + * $state.transitionTo(state, $match, false); + * } + * }); + * }); + * ``` + * + * @param what A pattern string to match, compiled as a [[UrlMatcher]]. + * @param handler The path (or function that returns a path) that you want to redirect your user to. + * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]] + * + * Note: the handler may also invoke arbitrary code, such as `$state.go()` + */ + UrlRouterProvider.prototype.when = function (what, handler) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isArray)(handler) || (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handler)) { + handler = UrlRouterProvider.injectableHandler(this.router, handler); + } + this.router.urlService.rules.when(what, handler); + return this; + }; + /** + * Disables monitoring of the URL. + * + * Call this method before UI-Router has bootstrapped. + * It will stop UI-Router from performing the initial url sync. + * + * This can be useful to perform some asynchronous initialization before the router starts. + * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router']); + * + * app.config(function ($urlRouterProvider) { + * // Prevent $urlRouter from automatically intercepting URL changes; + * $urlRouterProvider.deferIntercept(); + * }) + * + * app.run(function (MyService, $urlRouter, $http) { + * $http.get("/stuff").then(function(resp) { + * MyService.doStuff(resp.data); + * $urlRouter.listen(); + * $urlRouter.sync(); + * }); + * }); + * ``` + * + * @param defer Indicates whether to defer location change interception. + * Passing no parameter is equivalent to `true`. + */ + UrlRouterProvider.prototype.deferIntercept = function (defer) { + this.router.urlService.deferIntercept(defer); + }; + return UrlRouterProvider; +}()); + +//# sourceMappingURL=urlRouterProvider.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js": +/*!****************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/** @publicapi @module ng1 */ /** */ + +/** @hidden */ +function $ViewScrollProvider() { + var useAnchorScroll = false; + this.useAnchorScroll = function () { + useAnchorScroll = true; + }; + this.$get = [ + '$anchorScroll', + '$timeout', + function ($anchorScroll, $timeout) { + if (useAnchorScroll) { + return $anchorScroll; + } + return function ($element) { + return $timeout(function () { + $element[0].scrollIntoView(); + }, 0, false); + }; + }, + ]; +} +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider); +//# sourceMappingURL=viewScroll.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/common.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/common.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "root": () => (/* binding */ root), +/* harmony export */ "fromJson": () => (/* binding */ fromJson), +/* harmony export */ "toJson": () => (/* binding */ toJson), +/* harmony export */ "forEach": () => (/* binding */ forEach), +/* harmony export */ "extend": () => (/* binding */ extend), +/* harmony export */ "equals": () => (/* binding */ equals), +/* harmony export */ "identity": () => (/* binding */ identity), +/* harmony export */ "noop": () => (/* binding */ noop), +/* harmony export */ "createProxyFunctions": () => (/* binding */ createProxyFunctions), +/* harmony export */ "inherit": () => (/* binding */ inherit), +/* harmony export */ "inArray": () => (/* binding */ inArray), +/* harmony export */ "_inArray": () => (/* binding */ _inArray), +/* harmony export */ "removeFrom": () => (/* binding */ removeFrom), +/* harmony export */ "_removeFrom": () => (/* binding */ _removeFrom), +/* harmony export */ "pushTo": () => (/* binding */ pushTo), +/* harmony export */ "_pushTo": () => (/* binding */ _pushTo), +/* harmony export */ "deregAll": () => (/* binding */ deregAll), +/* harmony export */ "defaults": () => (/* binding */ defaults), +/* harmony export */ "mergeR": () => (/* binding */ mergeR), +/* harmony export */ "ancestors": () => (/* binding */ ancestors), +/* harmony export */ "pick": () => (/* binding */ pick), +/* harmony export */ "omit": () => (/* binding */ omit), +/* harmony export */ "pluck": () => (/* binding */ pluck), +/* harmony export */ "filter": () => (/* binding */ filter), +/* harmony export */ "find": () => (/* binding */ find), +/* harmony export */ "mapObj": () => (/* binding */ mapObj), +/* harmony export */ "map": () => (/* binding */ map), +/* harmony export */ "values": () => (/* binding */ values), +/* harmony export */ "allTrueR": () => (/* binding */ allTrueR), +/* harmony export */ "anyTrueR": () => (/* binding */ anyTrueR), +/* harmony export */ "unnestR": () => (/* binding */ unnestR), +/* harmony export */ "flattenR": () => (/* binding */ flattenR), +/* harmony export */ "pushR": () => (/* binding */ pushR), +/* harmony export */ "uniqR": () => (/* binding */ uniqR), +/* harmony export */ "unnest": () => (/* binding */ unnest), +/* harmony export */ "flatten": () => (/* binding */ flatten), +/* harmony export */ "assertPredicate": () => (/* binding */ assertPredicate), +/* harmony export */ "assertMap": () => (/* binding */ assertMap), +/* harmony export */ "assertFn": () => (/* binding */ assertFn), +/* harmony export */ "pairs": () => (/* binding */ pairs), +/* harmony export */ "arrayTuples": () => (/* binding */ arrayTuples), +/* harmony export */ "applyPairs": () => (/* binding */ applyPairs), +/* harmony export */ "tail": () => (/* binding */ tail), +/* harmony export */ "copy": () => (/* binding */ copy), +/* harmony export */ "_extend": () => (/* binding */ _extend), +/* harmony export */ "silenceUncaughtInPromise": () => (/* binding */ silenceUncaughtInPromise), +/* harmony export */ "silentRejection": () => (/* binding */ silentRejection) +/* harmony export */ }); +/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _coreservices__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +}; +/** + * Random utility functions used in the UI-Router code + * + * These functions are exported, but are subject to change without notice. + * + * @packageDocumentation + * @preferred + */ + + + +var root = (typeof self === 'object' && self.self === self && self) || + (typeof __webpack_require__.g === 'object' && __webpack_require__.g.global === __webpack_require__.g && __webpack_require__.g) || + undefined; +var angular = root.angular || {}; +var fromJson = angular.fromJson || JSON.parse.bind(JSON); +var toJson = angular.toJson || JSON.stringify.bind(JSON); +var forEach = angular.forEach || _forEach; +var extend = Object.assign || _extend; +var equals = angular.equals || _equals; +function identity(x) { + return x; +} +function noop() { } +/** + * Builds proxy functions on the `to` object which pass through to the `from` object. + * + * For each key in `fnNames`, creates a proxy function on the `to` object. + * The proxy function calls the real function on the `from` object. + * + * + * #### Example: + * This example creates an new class instance whose functions are prebound to the new'd object. + * ```js + * class Foo { + * constructor(data) { + * // Binds all functions from Foo.prototype to 'this', + * // then copies them to 'this' + * bindFunctions(Foo.prototype, this, this); + * this.data = data; + * } + * + * log() { + * console.log(this.data); + * } + * } + * + * let myFoo = new Foo([1,2,3]); + * var logit = myFoo.log; + * logit(); // logs [1, 2, 3] from the myFoo 'this' instance + * ``` + * + * #### Example: + * This example creates a bound version of a service function, and copies it to another object + * ``` + * + * var SomeService = { + * this.data = [3, 4, 5]; + * this.log = function() { + * console.log(this.data); + * } + * } + * + * // Constructor fn + * function OtherThing() { + * // Binds all functions from SomeService to SomeService, + * // then copies them to 'this' + * bindFunctions(SomeService, this, SomeService); + * } + * + * let myOtherThing = new OtherThing(); + * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this' + * ``` + * + * @param source A function that returns the source object which contains the original functions to be bound + * @param target A function that returns the target object which will receive the bound functions + * @param bind A function that returns the object which the functions will be bound to + * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object) + * @param latebind If true, the binding of the function is delayed until the first time it's invoked + */ +function createProxyFunctions(source, target, bind, fnNames, latebind) { + if (latebind === void 0) { latebind = false; } + var bindFunction = function (fnName) { return source()[fnName].bind(bind()); }; + var makeLateRebindFn = function (fnName) { + return function lateRebindFunction() { + target[fnName] = bindFunction(fnName); + return target[fnName].apply(null, arguments); + }; + }; + fnNames = fnNames || Object.keys(source()); + return fnNames.reduce(function (acc, name) { + acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name); + return acc; + }, target); +} +/** + * prototypal inheritance helper. + * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it + */ +var inherit = function (parent, extra) { return extend(Object.create(parent), extra); }; +/** Given an array, returns true if the object is found in the array, (using indexOf) */ +var inArray = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_inArray); +function _inArray(array, obj) { + return array.indexOf(obj) !== -1; +} +/** + * Given an array, and an item, if the item is found in the array, it removes it (in-place). + * The same array is returned + */ +var removeFrom = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_removeFrom); +function _removeFrom(array, obj) { + var idx = array.indexOf(obj); + if (idx >= 0) + array.splice(idx, 1); + return array; +} +/** pushes a values to an array and returns the value */ +var pushTo = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_pushTo); +function _pushTo(arr, val) { + return arr.push(val), val; +} +/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */ +var deregAll = function (functions) { + return functions.slice().forEach(function (fn) { + typeof fn === 'function' && fn(); + removeFrom(functions, fn); + }); +}; +/** + * Applies a set of defaults to an options object. The options object is filtered + * to only those properties of the objects in the defaultsList. + * Earlier objects in the defaultsList take precedence when applying defaults. + */ +function defaults(opts) { + var defaultsList = []; + for (var _i = 1; _i < arguments.length; _i++) { + defaultsList[_i - 1] = arguments[_i]; + } + var defaultVals = extend.apply(void 0, __spreadArrays([{}], defaultsList.reverse())); + return extend(defaultVals, pick(opts || {}, Object.keys(defaultVals))); +} +/** Reduce function that merges each element of the list into a single object, using extend */ +var mergeR = function (memo, item) { return extend(memo, item); }; +/** + * Finds the common ancestor path between two states. + * + * @param {Object} first The first state. + * @param {Object} second The second state. + * @return {Array} Returns an array of state names in descending order, not including the root. + */ +function ancestors(first, second) { + var path = []; + // tslint:disable-next-line:forin + for (var n in first.path) { + if (first.path[n] !== second.path[n]) + break; + path.push(first.path[n]); + } + return path; +} +/** + * Return a copy of the object only containing the whitelisted properties. + * + * #### Example: + * ``` + * var foo = { a: 1, b: 2, c: 3 }; + * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 } + * ``` + * @param obj the source object + * @param propNames an Array of strings, which are the whitelisted property names + */ +function pick(obj, propNames) { + var objCopy = {}; + for (var _prop in obj) { + if (propNames.indexOf(_prop) !== -1) { + objCopy[_prop] = obj[_prop]; + } + } + return objCopy; +} +/** + * Return a copy of the object omitting the blacklisted properties. + * + * @example + * ``` + * + * var foo = { a: 1, b: 2, c: 3 }; + * var ab = omit(foo, ['a', 'b']); // { c: 3 } + * ``` + * @param obj the source object + * @param propNames an Array of strings, which are the blacklisted property names + */ +function omit(obj, propNames) { + return Object.keys(obj) + .filter((0,_hof__WEBPACK_IMPORTED_MODULE_1__.not)(inArray(propNames))) + .reduce(function (acc, key) { return ((acc[key] = obj[key]), acc); }, {}); +} +/** + * Maps an array, or object to a property (by name) + */ +function pluck(collection, propName) { + return map(collection, (0,_hof__WEBPACK_IMPORTED_MODULE_1__.prop)(propName)); +} +/** Filters an Array or an Object's properties based on a predicate */ +function filter(collection, callback) { + var arr = (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(collection), result = arr ? [] : {}; + var accept = arr ? function (x) { return result.push(x); } : function (x, key) { return (result[key] = x); }; + forEach(collection, function (item, i) { + if (callback(item, i)) + accept(item, i); + }); + return result; +} +/** Finds an object from an array, or a property of an object, that matches a predicate */ +function find(collection, callback) { + var result; + forEach(collection, function (item, i) { + if (result) + return; + if (callback(item, i)) + result = item; + }); + return result; +} +/** Given an object, returns a new object, where each property is transformed by the callback function */ +var mapObj = map; +/** Maps an array or object properties using a callback function */ +function map(collection, callback, target) { + target = target || ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(collection) ? [] : {}); + forEach(collection, function (item, i) { return (target[i] = callback(item, i)); }); + return target; +} +/** + * Given an object, return its enumerable property values + * + * @example + * ``` + * + * let foo = { a: 1, b: 2, c: 3 } + * let vals = values(foo); // [ 1, 2, 3 ] + * ``` + */ +var values = function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); }; +/** + * Reduce function that returns true if all of the values are truthy. + * + * @example + * ``` + * + * let vals = [ 1, true, {}, "hello world"]; + * vals.reduce(allTrueR, true); // true + * + * vals.push(0); + * vals.reduce(allTrueR, true); // false + * ``` + */ +var allTrueR = function (memo, elem) { return memo && elem; }; +/** + * Reduce function that returns true if any of the values are truthy. + * + * * @example + * ``` + * + * let vals = [ 0, null, undefined ]; + * vals.reduce(anyTrueR, true); // false + * + * vals.push("hello world"); + * vals.reduce(anyTrueR, true); // true + * ``` + */ +var anyTrueR = function (memo, elem) { return memo || elem; }; +/** + * Reduce function which un-nests a single level of arrays + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * input.reduce(unnestR, []) // [ "a", "b", "c", "d", [ "double, "nested" ] ] + * ``` + */ +var unnestR = function (memo, elem) { return memo.concat(elem); }; +/** + * Reduce function which recursively un-nests all arrays + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * input.reduce(unnestR, []) // [ "a", "b", "c", "d", "double, "nested" ] + * ``` + */ +var flattenR = function (memo, elem) { + return (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem); +}; +/** + * Reduce function that pushes an object to an array, then returns the array. + * Mostly just for [[flattenR]] and [[uniqR]] + */ +function pushR(arr, obj) { + arr.push(obj); + return arr; +} +/** Reduce function that filters out duplicates */ +var uniqR = function (acc, token) { return (inArray(acc, token) ? acc : pushR(acc, token)); }; +/** + * Return a new array with a single level of arrays unnested. + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * unnest(input) // [ "a", "b", "c", "d", [ "double, "nested" ] ] + * ``` + */ +var unnest = function (arr) { return arr.reduce(unnestR, []); }; +/** + * Return a completely flattened version of an array. + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * flatten(input) // [ "a", "b", "c", "d", "double, "nested" ] + * ``` + */ +var flatten = function (arr) { return arr.reduce(flattenR, []); }; +/** + * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass. + * @example + * ``` + * + * let isNumber = (obj) => typeof(obj) === 'number'; + * let allNumbers = [ 1, 2, 3, 4, 5 ]; + * allNumbers.filter(assertPredicate(isNumber)); //OK + * + * let oneString = [ 1, 2, 3, 4, "5" ]; + * oneString.filter(assertPredicate(isNumber, "Not all numbers")); // throws Error(""Not all numbers""); + * ``` + */ +var assertPredicate = assertFn; +/** + * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test. + * @example + * ``` + * + * var data = { foo: 1, bar: 2 }; + * + * let keys = [ 'foo', 'bar' ] + * let values = keys.map(assertMap(key => data[key], "Key not found")); + * // values is [1, 2] + * + * let keys = [ 'foo', 'bar', 'baz' ] + * let values = keys.map(assertMap(key => data[key], "Key not found")); + * // throws Error("Key not found") + * ``` + */ +var assertMap = assertFn; +function assertFn(predicateOrMap, errMsg) { + if (errMsg === void 0) { errMsg = 'assert failure'; } + return function (obj) { + var result = predicateOrMap(obj); + if (!result) { + throw new Error((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(errMsg) ? errMsg(obj) : errMsg); + } + return result; + }; +} +/** + * Like _.pairs: Given an object, returns an array of key/value pairs + * + * @example + * ``` + * + * pairs({ foo: "FOO", bar: "BAR }) // [ [ "foo", "FOO" ], [ "bar": "BAR" ] ] + * ``` + */ +var pairs = function (obj) { return Object.keys(obj).map(function (key) { return [key, obj[key]]; }); }; +/** + * Given two or more parallel arrays, returns an array of tuples where + * each tuple is composed of [ a[i], b[i], ... z[i] ] + * + * @example + * ``` + * + * let foo = [ 0, 2, 4, 6 ]; + * let bar = [ 1, 3, 5, 7 ]; + * let baz = [ 10, 30, 50, 70 ]; + * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ] + * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ] + * ``` + */ +function arrayTuples() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (args.length === 0) + return []; + var maxArrayLen = args.reduce(function (min, arr) { return Math.min(arr.length, min); }, 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER + var result = []; + var _loop_1 = function (i) { + // This is a hot function + // Unroll when there are 1-4 arguments + switch (args.length) { + case 1: + result.push([args[0][i]]); + break; + case 2: + result.push([args[0][i], args[1][i]]); + break; + case 3: + result.push([args[0][i], args[1][i], args[2][i]]); + break; + case 4: + result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); + break; + default: + result.push(args.map(function (array) { return array[i]; })); + break; + } + }; + for (var i = 0; i < maxArrayLen; i++) { + _loop_1(i); + } + return result; +} +/** + * Reduce function which builds an object from an array of [key, value] pairs. + * + * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration. + * + * Each keyValueTuple should be an array with values [ key: string, value: any ] + * + * @example + * ``` + * + * var pairs = [ ["fookey", "fooval"], ["barkey", "barval"] ] + * + * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {}) + * // pairsToObj == { fookey: "fooval", barkey: "barval" } + * + * // Or, more simply: + * var pairsToObj = pairs.reduce(applyPairs, {}) + * // pairsToObj == { fookey: "fooval", barkey: "barval" } + * ``` + */ +function applyPairs(memo, keyValTuple) { + var key, value; + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(keyValTuple)) + key = keyValTuple[0], value = keyValTuple[1]; + if (!(0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(key)) + throw new Error('invalid parameters to applyPairs'); + memo[key] = value; + return memo; +} +/** Get the last element of an array */ +function tail(arr) { + return (arr.length && arr[arr.length - 1]) || undefined; +} +/** + * shallow copy from src to dest + */ +function copy(src, dest) { + if (dest) + Object.keys(dest).forEach(function (key) { return delete dest[key]; }); + if (!dest) + dest = {}; + return extend(dest, src); +} +/** Naive forEach implementation works with Objects or Arrays */ +function _forEach(obj, cb, _this) { + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(obj)) + return obj.forEach(cb, _this); + Object.keys(obj).forEach(function (key) { return cb(obj[key], key); }); +} +function _extend(toObj) { + for (var i = 1; i < arguments.length; i++) { + var obj = arguments[i]; + if (!obj) + continue; + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; j++) { + toObj[keys[j]] = obj[keys[j]]; + } + } + return toObj; +} +function _equals(o1, o2) { + if (o1 === o2) + return true; + if (o1 === null || o2 === null) + return false; + if (o1 !== o1 && o2 !== o2) + return true; // NaN === NaN + var t1 = typeof o1, t2 = typeof o2; + if (t1 !== t2 || t1 !== 'object') + return false; + var tup = [o1, o2]; + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(tup)) + return _arraysEq(o1, o2); + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isDate)(tup)) + return o1.getTime() === o2.getTime(); + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isRegExp)(tup)) + return o1.toString() === o2.toString(); + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(tup)) + return true; // meh + var predicates = [_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction, _predicates__WEBPACK_IMPORTED_MODULE_0__.isArray, _predicates__WEBPACK_IMPORTED_MODULE_0__.isDate, _predicates__WEBPACK_IMPORTED_MODULE_0__.isRegExp]; + if (predicates.map(_hof__WEBPACK_IMPORTED_MODULE_1__.any).reduce(function (b, fn) { return b || !!fn(tup); }, false)) + return false; + var keys = {}; + // tslint:disable-next-line:forin + for (var key in o1) { + if (!_equals(o1[key], o2[key])) + return false; + keys[key] = true; + } + for (var key in o2) { + if (!keys[key]) + return false; + } + return true; +} +function _arraysEq(a1, a2) { + if (a1.length !== a2.length) + return false; + return arrayTuples(a1, a2).reduce(function (b, t) { return b && _equals(t[0], t[1]); }, true); +} +// issue #2676 +var silenceUncaughtInPromise = function (promise) { return promise.catch(function (e) { return 0; }) && promise; }; +var silentRejection = function (error) { return silenceUncaughtInPromise(_coreservices__WEBPACK_IMPORTED_MODULE_2__.services.$q.reject(error)); }; +//# sourceMappingURL=common.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js": +/*!********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/coreservices.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "makeStub": () => (/* binding */ makeStub), +/* harmony export */ "services": () => (/* binding */ services) +/* harmony export */ }); +var noImpl = function (fnname) { return function () { + throw new Error("No implementation for " + fnname + ". The framework specific code did not implement this method."); +}; }; +var makeStub = function (service, methods) { + return methods.reduce(function (acc, key) { return ((acc[key] = noImpl(service + "." + key + "()")), acc); }, {}); +}; +var services = { + $q: undefined, + $injector: undefined, +}; + +//# sourceMappingURL=coreservices.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/glob.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/glob.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Glob": () => (/* binding */ Glob) +/* harmony export */ }); +/** + * Matches state names using glob-like pattern strings. + * + * Globs can be used in specific APIs including: + * + * - [[StateService.is]] + * - [[StateService.includes]] + * - The first argument to Hook Registration functions like [[TransitionService.onStart]] + * - [[HookMatchCriteria]] and [[HookMatchCriterion]] + * + * A `Glob` string is a pattern which matches state names. + * Nested state names are split into segments (separated by a dot) when processing. + * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz'] + * + * Globs work according to the following rules: + * + * ### Exact match: + * + * The glob `'A.B'` matches the state named exactly `'A.B'`. + * + * | Glob |Matches states named|Does not match state named| + * |:------------|:--------------------|:---------------------| + * | `'A'` | `'A'` | `'B'` , `'A.C'` | + * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` | + * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`| + * + * ### Single star (`*`) + * + * A single star (`*`) is a wildcard that matches exactly one segment. + * + * | Glob |Matches states named |Does not match state named | + * |:------------|:---------------------|:--------------------------| + * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` | + * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` | + * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`| + * + * ### Double star (`**`) + * + * A double star (`'**'`) is a wildcard that matches *zero or more segments* + * + * | Glob |Matches states named |Does not match state named | + * |:------------|:----------------------------------------------|:----------------------------------| + * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) | + * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` | + * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` | + * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` | + * + * @packageDocumentation + */ +var Glob = /** @class */ (function () { + function Glob(text) { + this.text = text; + this.glob = text.split('.'); + var regexpString = this.text + .split('.') + .map(function (seg) { + if (seg === '**') + return '(?:|(?:\\.[^.]*)*)'; + if (seg === '*') + return '\\.[^.]*'; + return '\\.' + seg; + }) + .join(''); + this.regexp = new RegExp('^' + regexpString + '$'); + } + /** Returns true if the string has glob-like characters in it */ + Glob.is = function (text) { + return !!/[!,*]+/.exec(text); + }; + /** Returns a glob from the string, or null if the string isn't Glob-like */ + Glob.fromString = function (text) { + return Glob.is(text) ? new Glob(text) : null; + }; + Glob.prototype.matches = function (name) { + return this.regexp.test('.' + name); + }; + return Glob; +}()); + +//# sourceMappingURL=glob.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/hof.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/hof.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "curry": () => (/* binding */ curry), +/* harmony export */ "compose": () => (/* binding */ compose), +/* harmony export */ "pipe": () => (/* binding */ pipe), +/* harmony export */ "prop": () => (/* binding */ prop), +/* harmony export */ "propEq": () => (/* binding */ propEq), +/* harmony export */ "parse": () => (/* binding */ parse), +/* harmony export */ "not": () => (/* binding */ not), +/* harmony export */ "and": () => (/* binding */ and), +/* harmony export */ "or": () => (/* binding */ or), +/* harmony export */ "all": () => (/* binding */ all), +/* harmony export */ "any": () => (/* binding */ any), +/* harmony export */ "is": () => (/* binding */ is), +/* harmony export */ "eq": () => (/* binding */ eq), +/* harmony export */ "val": () => (/* binding */ val), +/* harmony export */ "invoke": () => (/* binding */ invoke), +/* harmony export */ "pattern": () => (/* binding */ pattern) +/* harmony export */ }); +/** + * Higher order functions + * + * These utility functions are exported, but are subject to change without notice. + * + * @packageDocumentation + */ +var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +}; +/** + * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function. + * + * Given a function with N parameters, returns a new function that supports partial application. + * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters, + * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to + * accept more parameters until all N parameters have been supplied. + * + * + * This contrived example uses a partially applied function as an predicate, which returns true + * if an object is found in both arrays. + * @example + * ``` + * // returns true if an object is in both of the two arrays + * function inBoth(array1, array2, object) { + * return array1.indexOf(object) !== -1 && + * array2.indexOf(object) !== 1; + * } + * let obj1, obj2, obj3, obj4, obj5, obj6, obj7 + * let foos = [obj1, obj3] + * let bars = [obj3, obj4, obj5] + * + * // A curried "copy" of inBoth + * let curriedInBoth = curry(inBoth); + * // Partially apply both the array1 and array2 + * let inFoosAndBars = curriedInBoth(foos, bars); + * + * // Supply the final argument; since all arguments are + * // supplied, the original inBoth function is then called. + * let obj1InBoth = inFoosAndBars(obj1); // false + * + * // Use the inFoosAndBars as a predicate. + * // Filter, on each iteration, supplies the final argument + * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ]; + * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ] + * + * ``` + * + * @param fn + * @returns {*|function(): (*|any)} + */ +function curry(fn) { + return function curried() { + if (arguments.length >= fn.length) { + return fn.apply(this, arguments); + } + var args = Array.prototype.slice.call(arguments); + return curried.bind.apply(curried, __spreadArrays([this], args)); + }; +} +/** + * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left + * given: f(x), g(x), h(x) + * let composed = compose(f,g,h) + * then, composed is: f(g(h(x))) + */ +function compose() { + var args = arguments; + var start = args.length - 1; + return function () { + var i = start, result = args[start].apply(this, arguments); + while (i--) + result = args[i].call(this, result); + return result; + }; +} +/** + * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right + * given: f(x), g(x), h(x) + * let piped = pipe(f,g,h); + * then, piped is: h(g(f(x))) + */ +function pipe() { + var funcs = []; + for (var _i = 0; _i < arguments.length; _i++) { + funcs[_i] = arguments[_i]; + } + return compose.apply(null, [].slice.call(arguments).reverse()); +} +/** + * Given a property name, returns a function that returns that property from an object + * let obj = { foo: 1, name: "blarg" }; + * let getName = prop("name"); + * getName(obj) === "blarg" + */ +var prop = function (name) { return function (obj) { return obj && obj[name]; }; }; +/** + * Given a property name and a value, returns a function that returns a boolean based on whether + * the passed object has a property that matches the value + * let obj = { foo: 1, name: "blarg" }; + * let getName = propEq("name", "blarg"); + * getName(obj) === true + */ +var propEq = curry(function (name, _val, obj) { return obj && obj[name] === _val; }); +/** + * Given a dotted property name, returns a function that returns a nested property from an object, or undefined + * let obj = { id: 1, nestedObj: { foo: 1, name: "blarg" }, }; + * let getName = prop("nestedObj.name"); + * getName(obj) === "blarg" + * let propNotFound = prop("this.property.doesnt.exist"); + * propNotFound(obj) === undefined + */ +var parse = function (name) { return pipe.apply(null, name.split('.').map(prop)); }; +/** + * Given a function that returns a truthy or falsey value, returns a + * function that returns the opposite (falsey or truthy) value given the same inputs + */ +var not = function (fn) { return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return !fn.apply(null, args); +}; }; +/** + * Given two functions that return truthy or falsey values, returns a function that returns truthy + * if both functions return truthy for the given arguments + */ +function and(fn1, fn2) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return fn1.apply(null, args) && fn2.apply(null, args); + }; +} +/** + * Given two functions that return truthy or falsey values, returns a function that returns truthy + * if at least one of the functions returns truthy for the given arguments + */ +function or(fn1, fn2) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return fn1.apply(null, args) || fn2.apply(null, args); + }; +} +/** + * Check if all the elements of an array match a predicate function + * + * @param fn1 a predicate function `fn1` + * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array + */ +var all = function (fn1) { return function (arr) { return arr.reduce(function (b, x) { return b && !!fn1(x); }, true); }; }; +// tslint:disable-next-line:variable-name +var any = function (fn1) { return function (arr) { return arr.reduce(function (b, x) { return b || !!fn1(x); }, false); }; }; +/** Given a class, returns a Predicate function that returns true if the object is of that class */ +var is = function (ctor) { return function (obj) { + return (obj != null && obj.constructor === ctor) || obj instanceof ctor; +}; }; +/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */ +var eq = function (value) { return function (other) { return value === other; }; }; +/** Given a value, returns a function which returns the value */ +var val = function (v) { return function () { return v; }; }; +function invoke(fnName, args) { + return function (obj) { return obj[fnName].apply(obj, args); }; +} +/** + * Sorta like Pattern Matching (a functional programming conditional construct) + * + * See http://c2.com/cgi/wiki?PatternMatching + * + * This is a conditional construct which allows a series of predicates and output functions + * to be checked and then applied. Each predicate receives the input. If the predicate + * returns truthy, then its matching output function (mapping function) is provided with + * the input and, then the result is returned. + * + * Each combination (2-tuple) of predicate + output function should be placed in an array + * of size 2: [ predicate, mapFn ] + * + * These 2-tuples should be put in an outer array. + * + * @example + * ``` + * + * // Here's a 2-tuple where the first element is the isString predicate + * // and the second element is a function that returns a description of the input + * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ]; + * + * // Second tuple: predicate "isNumber", mapfn returns a description + * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ]; + * + * let third = [ (input) => input === null, (input) => `Oh, null...` ]; + * + * let fourth = [ (input) => input === undefined, (input) => `notdefined` ]; + * + * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]); + * + * console.log(descriptionOf(undefined)); // 'notdefined' + * console.log(descriptionOf(55)); // '(55) That's a number!' + * console.log(descriptionOf("foo")); // 'Here's your string foo' + * ``` + * + * @param struct A 2D array. Each element of the array should be an array, a 2-tuple, + * with a Predicate and a mapping/output function + * @returns {function(any): *} + */ +function pattern(struct) { + return function (x) { + for (var i = 0; i < struct.length; i++) { + if (struct[i][0](x)) + return struct[i][1](x); + } + }; +} +//# sourceMappingURL=hof.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/index.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "_extend": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._extend), +/* harmony export */ "_inArray": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._inArray), +/* harmony export */ "_pushTo": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._pushTo), +/* harmony export */ "_removeFrom": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._removeFrom), +/* harmony export */ "allTrueR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.allTrueR), +/* harmony export */ "ancestors": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.ancestors), +/* harmony export */ "anyTrueR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.anyTrueR), +/* harmony export */ "applyPairs": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.applyPairs), +/* harmony export */ "arrayTuples": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples), +/* harmony export */ "assertFn": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertFn), +/* harmony export */ "assertMap": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertMap), +/* harmony export */ "assertPredicate": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertPredicate), +/* harmony export */ "copy": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.copy), +/* harmony export */ "createProxyFunctions": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions), +/* harmony export */ "defaults": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.defaults), +/* harmony export */ "deregAll": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.deregAll), +/* harmony export */ "equals": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.equals), +/* harmony export */ "extend": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.extend), +/* harmony export */ "filter": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.filter), +/* harmony export */ "find": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.find), +/* harmony export */ "flatten": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.flatten), +/* harmony export */ "flattenR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.flattenR), +/* harmony export */ "forEach": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.forEach), +/* harmony export */ "fromJson": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.fromJson), +/* harmony export */ "identity": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.identity), +/* harmony export */ "inArray": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.inArray), +/* harmony export */ "inherit": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.inherit), +/* harmony export */ "map": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.map), +/* harmony export */ "mapObj": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.mapObj), +/* harmony export */ "mergeR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.mergeR), +/* harmony export */ "noop": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.noop), +/* harmony export */ "omit": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.omit), +/* harmony export */ "pairs": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pairs), +/* harmony export */ "pick": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pick), +/* harmony export */ "pluck": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pluck), +/* harmony export */ "pushR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pushR), +/* harmony export */ "pushTo": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pushTo), +/* harmony export */ "removeFrom": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.removeFrom), +/* harmony export */ "root": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.root), +/* harmony export */ "silenceUncaughtInPromise": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise), +/* harmony export */ "silentRejection": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.silentRejection), +/* harmony export */ "tail": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.tail), +/* harmony export */ "toJson": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.toJson), +/* harmony export */ "uniqR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.uniqR), +/* harmony export */ "unnest": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.unnest), +/* harmony export */ "unnestR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.unnestR), +/* harmony export */ "values": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.values), +/* harmony export */ "makeStub": () => (/* reexport safe */ _coreservices__WEBPACK_IMPORTED_MODULE_1__.makeStub), +/* harmony export */ "services": () => (/* reexport safe */ _coreservices__WEBPACK_IMPORTED_MODULE_1__.services), +/* harmony export */ "Glob": () => (/* reexport safe */ _glob__WEBPACK_IMPORTED_MODULE_2__.Glob), +/* harmony export */ "all": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.all), +/* harmony export */ "and": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.and), +/* harmony export */ "any": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.any), +/* harmony export */ "compose": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.compose), +/* harmony export */ "curry": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.curry), +/* harmony export */ "eq": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.eq), +/* harmony export */ "invoke": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.invoke), +/* harmony export */ "is": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.is), +/* harmony export */ "not": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.not), +/* harmony export */ "or": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.or), +/* harmony export */ "parse": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.parse), +/* harmony export */ "pattern": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.pattern), +/* harmony export */ "pipe": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.pipe), +/* harmony export */ "prop": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.prop), +/* harmony export */ "propEq": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.propEq), +/* harmony export */ "val": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.val), +/* harmony export */ "isArray": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isArray), +/* harmony export */ "isDate": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isDate), +/* harmony export */ "isDefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isDefined), +/* harmony export */ "isFunction": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction), +/* harmony export */ "isInjectable": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isInjectable), +/* harmony export */ "isNull": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNull), +/* harmony export */ "isNullOrUndefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNullOrUndefined), +/* harmony export */ "isNumber": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNumber), +/* harmony export */ "isObject": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isObject), +/* harmony export */ "isPromise": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isPromise), +/* harmony export */ "isRegExp": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isRegExp), +/* harmony export */ "isString": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isString), +/* harmony export */ "isUndefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isUndefined), +/* harmony export */ "Queue": () => (/* reexport safe */ _queue__WEBPACK_IMPORTED_MODULE_5__.Queue), +/* harmony export */ "beforeAfterSubstr": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.beforeAfterSubstr), +/* harmony export */ "fnToString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.fnToString), +/* harmony export */ "functionToString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.functionToString), +/* harmony export */ "hostRegex": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.hostRegex), +/* harmony export */ "joinNeighborsR": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.joinNeighborsR), +/* harmony export */ "kebobString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.kebobString), +/* harmony export */ "maxLength": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.maxLength), +/* harmony export */ "padString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.padString), +/* harmony export */ "splitEqual": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitEqual), +/* harmony export */ "splitHash": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitHash), +/* harmony export */ "splitOnDelim": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitOnDelim), +/* harmony export */ "splitQuery": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitQuery), +/* harmony export */ "stringify": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.stringify), +/* harmony export */ "stripLastPathElement": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.stripLastPathElement), +/* harmony export */ "trimHashVal": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.trimHashVal), +/* harmony export */ "Category": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.Category), +/* harmony export */ "Trace": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.Trace), +/* harmony export */ "trace": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.trace) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _glob__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _queue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); +/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _trace__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/predicates.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/predicates.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "isUndefined": () => (/* binding */ isUndefined), +/* harmony export */ "isDefined": () => (/* binding */ isDefined), +/* harmony export */ "isNull": () => (/* binding */ isNull), +/* harmony export */ "isNullOrUndefined": () => (/* binding */ isNullOrUndefined), +/* harmony export */ "isFunction": () => (/* binding */ isFunction), +/* harmony export */ "isNumber": () => (/* binding */ isNumber), +/* harmony export */ "isString": () => (/* binding */ isString), +/* harmony export */ "isObject": () => (/* binding */ isObject), +/* harmony export */ "isArray": () => (/* binding */ isArray), +/* harmony export */ "isDate": () => (/* binding */ isDate), +/* harmony export */ "isRegExp": () => (/* binding */ isRegExp), +/* harmony export */ "isInjectable": () => (/* binding */ isInjectable), +/* harmony export */ "isPromise": () => (/* binding */ isPromise) +/* harmony export */ }); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/** + * Predicates + * + * These predicates return true/false based on the input. + * Although these functions are exported, they are subject to change without notice. + * + * @packageDocumentation + */ + +var toStr = Object.prototype.toString; +var tis = function (t) { return function (x) { return typeof x === t; }; }; +var isUndefined = tis('undefined'); +var isDefined = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isUndefined); +var isNull = function (o) { return o === null; }; +var isNullOrUndefined = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.or)(isNull, isUndefined); +var isFunction = tis('function'); +var isNumber = tis('number'); +var isString = tis('string'); +var isObject = function (x) { return x !== null && typeof x === 'object'; }; +var isArray = Array.isArray; +var isDate = (function (x) { return toStr.call(x) === '[object Date]'; }); +var isRegExp = (function (x) { return toStr.call(x) === '[object RegExp]'; }); +/** + * Predicate which checks if a value is injectable + * + * A value is "injectable" if it is a function, or if it is an ng1 array-notation-style array + * where all the elements in the array are Strings, except the last one, which is a Function + */ +function isInjectable(val) { + if (isArray(val) && val.length) { + var head = val.slice(0, -1), tail = val.slice(-1); + return !(head.filter((0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isString)).length || tail.filter((0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isFunction)).length); + } + return isFunction(val); +} +/** + * Predicate which checks if a value looks like a Promise + * + * It is probably a Promise if it's an object, and it has a `then` property which is a Function + */ +var isPromise = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.and)(isObject, (0,_hof__WEBPACK_IMPORTED_MODULE_0__.pipe)((0,_hof__WEBPACK_IMPORTED_MODULE_0__.prop)('then'), isFunction)); +//# sourceMappingURL=predicates.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/queue.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/queue.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Queue": () => (/* binding */ Queue) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + +var Queue = /** @class */ (function () { + function Queue(_items, _limit) { + if (_items === void 0) { _items = []; } + if (_limit === void 0) { _limit = null; } + this._items = _items; + this._limit = _limit; + this._evictListeners = []; + this.onEvict = (0,_common__WEBPACK_IMPORTED_MODULE_0__.pushTo)(this._evictListeners); + } + Queue.prototype.enqueue = function (item) { + var items = this._items; + items.push(item); + if (this._limit && items.length > this._limit) + this.evict(); + return item; + }; + Queue.prototype.evict = function () { + var item = this._items.shift(); + this._evictListeners.forEach(function (fn) { return fn(item); }); + return item; + }; + Queue.prototype.dequeue = function () { + if (this.size()) + return this._items.splice(0, 1)[0]; + }; + Queue.prototype.clear = function () { + var current = this._items; + this._items = []; + return current; + }; + Queue.prototype.size = function () { + return this._items.length; + }; + Queue.prototype.remove = function (item) { + var idx = this._items.indexOf(item); + return idx > -1 && this._items.splice(idx, 1)[0]; + }; + Queue.prototype.peekTail = function () { + return this._items[this._items.length - 1]; + }; + Queue.prototype.peekHead = function () { + if (this.size()) + return this._items[0]; + }; + return Queue; +}()); + +//# sourceMappingURL=queue.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/safeConsole.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "safeConsole": () => (/* binding */ safeConsole) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/** + * workaround for missing console object in IE9 when dev tools haven't been opened o_O + * @packageDocumentation + */ +/* tslint:disable:no-console */ + +var noopConsoleStub = { log: _common__WEBPACK_IMPORTED_MODULE_0__.noop, error: _common__WEBPACK_IMPORTED_MODULE_0__.noop, table: _common__WEBPACK_IMPORTED_MODULE_0__.noop }; +function ie9Console(console) { + var bound = function (fn) { return Function.prototype.bind.call(fn, console); }; + return { + log: bound(console.log), + error: bound(console.log), + table: bound(console.log), + }; +} +function fallbackConsole(console) { + var log = console.log.bind(console); + var error = console.error ? console.error.bind(console) : log; + var table = console.table ? console.table.bind(console) : log; + return { log: log, error: error, table: table }; +} +function getSafeConsole() { + // @ts-ignore + var isIE9 = typeof document !== 'undefined' && document.documentMode && document.documentMode === 9; + if (isIE9) { + return window && window.console ? ie9Console(window.console) : noopConsoleStub; + } + else if (!console.table || !console.error) { + return fallbackConsole(console); + } + else { + return console; + } +} +var safeConsole = getSafeConsole(); +//# sourceMappingURL=safeConsole.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/strings.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/strings.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "maxLength": () => (/* binding */ maxLength), +/* harmony export */ "padString": () => (/* binding */ padString), +/* harmony export */ "kebobString": () => (/* binding */ kebobString), +/* harmony export */ "functionToString": () => (/* binding */ functionToString), +/* harmony export */ "fnToString": () => (/* binding */ fnToString), +/* harmony export */ "stringify": () => (/* binding */ stringify), +/* harmony export */ "beforeAfterSubstr": () => (/* binding */ beforeAfterSubstr), +/* harmony export */ "hostRegex": () => (/* binding */ hostRegex), +/* harmony export */ "stripLastPathElement": () => (/* binding */ stripLastPathElement), +/* harmony export */ "splitHash": () => (/* binding */ splitHash), +/* harmony export */ "splitQuery": () => (/* binding */ splitQuery), +/* harmony export */ "splitEqual": () => (/* binding */ splitEqual), +/* harmony export */ "trimHashVal": () => (/* binding */ trimHashVal), +/* harmony export */ "splitOnDelim": () => (/* binding */ splitOnDelim), +/* harmony export */ "joinNeighborsR": () => (/* binding */ joinNeighborsR) +/* harmony export */ }); +/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/** + * Functions that manipulate strings + * + * Although these functions are exported, they are subject to change without notice. + * + * @packageDocumentation + */ + + + + +/** + * Returns a string shortened to a maximum length + * + * If the string is already less than the `max` length, return the string. + * Else return the string, shortened to `max - 3` and append three dots ("..."). + * + * @param max the maximum length of the string to return + * @param str the input string + */ +function maxLength(max, str) { + if (str.length <= max) + return str; + return str.substr(0, max - 3) + '...'; +} +/** + * Returns a string, with spaces added to the end, up to a desired str length + * + * If the string is already longer than the desired length, return the string. + * Else returns the string, with extra spaces on the end, such that it reaches `length` characters. + * + * @param length the desired length of the string to return + * @param str the input string + */ +function padString(length, str) { + while (str.length < length) + str += ' '; + return str; +} +function kebobString(camelCase) { + return camelCase + .replace(/^([A-Z])/, function ($1) { return $1.toLowerCase(); }) // replace first char + .replace(/([A-Z])/g, function ($1) { return '-' + $1.toLowerCase(); }); // replace rest +} +function functionToString(fn) { + var fnStr = fnToString(fn); + var namedFunctionMatch = fnStr.match(/^(function [^ ]+\([^)]*\))/); + var toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr; + var fnName = fn['name'] || ''; + if (fnName && toStr.match(/function \(/)) { + return 'function ' + fnName + toStr.substr(9); + } + return toStr; +} +function fnToString(fn) { + var _fn = (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(fn) ? fn.slice(-1)[0] : fn; + return (_fn && _fn.toString()) || 'undefined'; +} +var isRejection = _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__.Rejection.isRejectionPromise; +var hasToString = function (obj) { + return (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(obj) && !(0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(obj) && obj.constructor !== Object && (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(obj.toString); +}; +var stringifyPattern = (0,_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('undefined')], + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isNull, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('null')], + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isPromise, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('[Promise]')], + [isRejection, function (x) { return x._transitionRejection.toString(); }], + [hasToString, function (x) { return x.toString(); }], + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isInjectable, functionToString], + [(0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)(true), _common__WEBPACK_IMPORTED_MODULE_2__.identity], +]); +function stringify(o) { + var seen = []; + function format(value) { + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(value)) { + if (seen.indexOf(value) !== -1) + return '[circular ref]'; + seen.push(value); + } + return stringifyPattern(value); + } + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined)(o)) { + // Workaround for IE & Edge Spec incompatibility where replacer function would not be called when JSON.stringify + // is given `undefined` as value. To work around that, we simply detect `undefined` and bail out early by + // manually stringifying it. + return format(o); + } + return JSON.stringify(o, function (key, value) { return format(value); }).replace(/\\"/g, '"'); +} +/** Returns a function that splits a string on a character or substring */ +var beforeAfterSubstr = function (char) { return function (str) { + if (!str) + return ['', '']; + var idx = str.indexOf(char); + if (idx === -1) + return [str, '']; + return [str.substr(0, idx), str.substr(idx + 1)]; +}; }; +var hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/'); +var stripLastPathElement = function (str) { return str.replace(/\/[^/]*$/, ''); }; +var splitHash = beforeAfterSubstr('#'); +var splitQuery = beforeAfterSubstr('?'); +var splitEqual = beforeAfterSubstr('='); +var trimHashVal = function (str) { return (str ? str.replace(/^#/, '') : ''); }; +/** + * Splits on a delimiter, but returns the delimiters in the array + * + * #### Example: + * ```js + * var splitOnSlashes = splitOnDelim('/'); + * splitOnSlashes("/foo"); // ["/", "foo"] + * splitOnSlashes("/foo/"); // ["/", "foo", "/"] + * ``` + */ +function splitOnDelim(delim) { + var re = new RegExp('(' + delim + ')', 'g'); + return function (str) { return str.split(re).filter(_common__WEBPACK_IMPORTED_MODULE_2__.identity); }; +} +/** + * Reduce fn that joins neighboring strings + * + * Given an array of strings, returns a new array + * where all neighboring strings have been joined. + * + * #### Example: + * ```js + * let arr = ["foo", "bar", 1, "baz", "", "qux" ]; + * arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ] + * ``` + */ +function joinNeighborsR(acc, x) { + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)((0,_common__WEBPACK_IMPORTED_MODULE_2__.tail)(acc)) && (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(x)) + return acc.slice(0, -1).concat((0,_common__WEBPACK_IMPORTED_MODULE_2__.tail)(acc) + x); + return (0,_common__WEBPACK_IMPORTED_MODULE_2__.pushR)(acc, x); +} +//# sourceMappingURL=strings.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/trace.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/trace.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Category": () => (/* binding */ Category), +/* harmony export */ "Trace": () => (/* binding */ Trace), +/* harmony export */ "trace": () => (/* binding */ trace) +/* harmony export */ }); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _safeConsole__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./safeConsole */ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js"); +/** + * # Transition tracing (debug) + * + * Enable transition tracing to print transition information to the console, + * in order to help debug your application. + * Tracing logs detailed information about each Transition to your console. + * + * To enable tracing, import the [[Trace]] singleton and enable one or more categories. + * + * ### ES6 + * ```js + * import {trace} from "@uirouter/core"; + * trace.enable(1, 5); // TRANSITION and VIEWCONFIG + * ``` + * + * ### CJS + * ```js + * let trace = require("@uirouter/core").trace; + * trace.enable("TRANSITION", "VIEWCONFIG"); + * ``` + * + * ### Globals + * ```js + * let trace = window["@uirouter/core"].trace; + * trace.enable(); // Trace everything (very verbose) + * ``` + * + * ### Angular 1: + * ```js + * app.run($trace => $trace.enable()); + * ``` + * + * @packageDocumentation + */ + + + + +function uiViewString(uiview) { + if (!uiview) + return 'ui-view (defunct)'; + var state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)'; + return "[ui-view#" + uiview.id + " " + uiview.$type + ":" + uiview.fqn + " (" + uiview.name + "@" + state + ")]"; +} +var viewConfigString = function (viewConfig) { + var view = viewConfig.viewDecl; + var state = view.$context.name || '(root)'; + return "[View#" + viewConfig.$id + " from '" + state + "' state]: target ui-view: '" + view.$uiViewName + "@" + view.$uiViewContextAnchor + "'"; +}; +function normalizedCat(input) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isNumber)(input) ? Category[input] : Category[Category[input]]; +} +/** + * Trace categories Enum + * + * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]] + * + * `trace.enable(Category.TRANSITION)` + * + * These can also be provided using a matching string, or position ordinal + * + * `trace.enable("TRANSITION")` + * + * `trace.enable(1)` + */ +var Category; +(function (Category) { + Category[Category["RESOLVE"] = 0] = "RESOLVE"; + Category[Category["TRANSITION"] = 1] = "TRANSITION"; + Category[Category["HOOK"] = 2] = "HOOK"; + Category[Category["UIVIEW"] = 3] = "UIVIEW"; + Category[Category["VIEWCONFIG"] = 4] = "VIEWCONFIG"; +})(Category || (Category = {})); + +var _tid = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('$id'); +var _rid = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('router.$id'); +var transLbl = function (trans) { return "Transition #" + _tid(trans) + "-" + _rid(trans); }; +/** + * Prints UI-Router Transition trace information to the console. + */ +var Trace = /** @class */ (function () { + /** @internal */ + function Trace() { + /** @internal */ + this._enabled = {}; + this.approximateDigests = 0; + } + /** @internal */ + Trace.prototype._set = function (enabled, categories) { + var _this = this; + if (!categories.length) { + categories = Object.keys(Category) + .map(function (k) { return parseInt(k, 10); }) + .filter(function (k) { return !isNaN(k); }) + .map(function (key) { return Category[key]; }); + } + categories.map(normalizedCat).forEach(function (category) { return (_this._enabled[category] = enabled); }); + }; + Trace.prototype.enable = function () { + var categories = []; + for (var _i = 0; _i < arguments.length; _i++) { + categories[_i] = arguments[_i]; + } + this._set(true, categories); + }; + Trace.prototype.disable = function () { + var categories = []; + for (var _i = 0; _i < arguments.length; _i++) { + categories[_i] = arguments[_i]; + } + this._set(false, categories); + }; + /** + * Retrieves the enabled stateus of a [[Category]] + * + * ```js + * trace.enabled("VIEWCONFIG"); // true or false + * ``` + * + * @returns boolean true if the category is enabled + */ + Trace.prototype.enabled = function (category) { + return !!this._enabled[normalizedCat(category)]; + }; + /** @internal called by ui-router code */ + Trace.prototype.traceTransitionStart = function (trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Started -> " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceTransitionIgnored = function (trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Ignored <> " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceHookInvocation = function (step, trans, options) { + if (!this.enabled(Category.HOOK)) + return; + var event = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.hookType')(options) || 'internal', context = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.context.state.name')(options) || (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.context')(options) || 'unknown', name = (0,_strings__WEBPACK_IMPORTED_MODULE_2__.functionToString)(step.registeredHook.callback); + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Hook -> " + event + " context: " + context + ", " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, name)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceHookResult = function (hookResult, trans, transitionOptions) { + if (!this.enabled(Category.HOOK)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Hook returned: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(hookResult))); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceResolvePath = function (path, when, trans) { + if (!this.enabled(Category.RESOLVE)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Resolving " + path + " (" + when + ")"); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceResolvableResolved = function (resolvable, trans) { + if (!this.enabled(Category.RESOLVE)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Resolved " + resolvable + " to: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(resolvable.data))); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceError = function (reason, trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Rejected " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans) + ", reason: " + reason); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceSuccess = function (finalState, trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Success " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans) + ", final state: " + finalState.name); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceUIViewEvent = function (event, viewData, extra) { + if (extra === void 0) { extra = ''; } + if (!this.enabled(Category.UIVIEW)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("ui-view: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.padString)(30, event) + " " + uiViewString(viewData) + extra); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceUIViewConfigUpdated = function (viewData, context) { + if (!this.enabled(Category.UIVIEW)) + return; + this.traceUIViewEvent('Updating', viewData, " with ViewConfig from context='" + context + "'"); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceUIViewFill = function (viewData, html) { + if (!this.enabled(Category.UIVIEW)) + return; + this.traceUIViewEvent('Fill', viewData, " with: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, html)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceViewSync = function (pairs) { + if (!this.enabled(Category.VIEWCONFIG)) + return; + var uivheader = 'uiview component fqn'; + var cfgheader = 'view config state (view name)'; + var mapping = pairs + .map(function (_a) { + var _b; + var uiView = _a.uiView, viewConfig = _a.viewConfig; + var uiv = uiView && uiView.fqn; + var cfg = viewConfig && viewConfig.viewDecl.$context.name + ": (" + viewConfig.viewDecl.$name + ")"; + return _b = {}, _b[uivheader] = uiv, _b[cfgheader] = cfg, _b; + }) + .sort(function (a, b) { return (a[uivheader] || '').localeCompare(b[uivheader] || ''); }); + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.table(mapping); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceViewServiceEvent = function (event, viewConfig) { + if (!this.enabled(Category.VIEWCONFIG)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("VIEWCONFIG: " + event + " " + viewConfigString(viewConfig)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceViewServiceUIViewEvent = function (event, viewData) { + if (!this.enabled(Category.VIEWCONFIG)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("VIEWCONFIG: " + event + " " + uiViewString(viewData)); + }; + return Trace; +}()); + +/** + * The [[Trace]] singleton + * + * #### Example: + * ```js + * import {trace} from "@uirouter/core"; + * trace.enable(1, 5); + * ``` + */ +var trace = new Trace(); + +//# sourceMappingURL=trace.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/globals.js": +/*!********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/globals.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UIRouterGlobals": () => (/* binding */ UIRouterGlobals) +/* harmony export */ }); +/* harmony import */ var _params_stateParams__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./params/stateParams */ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js"); +/* harmony import */ var _common_queue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./common/queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); + + +/** + * Global router state + * + * This is where we hold the global mutable state such as current state, current + * params, current transition, etc. + */ +var UIRouterGlobals = /** @class */ (function () { + function UIRouterGlobals() { + /** + * Current parameter values + * + * The parameter values from the latest successful transition + */ + this.params = new _params_stateParams__WEBPACK_IMPORTED_MODULE_0__.StateParams(); + /** @internal */ + this.lastStartedTransitionId = -1; + /** @internal */ + this.transitionHistory = new _common_queue__WEBPACK_IMPORTED_MODULE_1__.Queue([], 1); + /** @internal */ + this.successfulTransitions = new _common_queue__WEBPACK_IMPORTED_MODULE_1__.Queue([], 1); + } + UIRouterGlobals.prototype.dispose = function () { + this.transitionHistory.clear(); + this.successfulTransitions.clear(); + this.transition = null; + }; + return UIRouterGlobals; +}()); + +//# sourceMappingURL=globals.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerAddCoreResolvables": () => (/* binding */ registerAddCoreResolvables), +/* harmony export */ "treeChangesCleanup": () => (/* binding */ treeChangesCleanup) +/* harmony export */ }); +/* harmony import */ var _transition_transition__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transition/transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); +/* harmony import */ var _router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../router */ "./node_modules/@uirouter/core/lib-esm/router.js"); +/* harmony import */ var _resolve__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../resolve */ "./node_modules/@uirouter/core/lib-esm/resolve/index.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + +function addCoreResolvables(trans) { + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(_router__WEBPACK_IMPORTED_MODULE_1__.UIRouter, trans.router), ''); + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(_transition_transition__WEBPACK_IMPORTED_MODULE_0__.Transition, trans), ''); + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$transition$', trans), ''); + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$stateParams', trans.params()), ''); + trans.entering().forEach(function (state) { + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$state$', state), state); + }); +} +var registerAddCoreResolvables = function (transitionService) { + return transitionService.onCreate({}, addCoreResolvables); +}; +var TRANSITION_TOKENS = ['$transition$', _transition_transition__WEBPACK_IMPORTED_MODULE_0__.Transition]; +var isTransition = (0,_common__WEBPACK_IMPORTED_MODULE_3__.inArray)(TRANSITION_TOKENS); +// References to Transition in the treeChanges pathnodes makes all +// previous Transitions reachable in memory, causing a memory leak +// This function removes resolves for '$transition$' and `Transition` from the treeChanges. +// Do not use this on current transitions, only on old ones. +var treeChangesCleanup = function (trans) { + var nodes = (0,_common__WEBPACK_IMPORTED_MODULE_3__.values)(trans.treeChanges()).reduce(_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []).reduce(_common__WEBPACK_IMPORTED_MODULE_3__.uniqR, []); + // If the resolvable is a Transition, return a new resolvable with null data + var replaceTransitionWithNull = function (r) { + return isTransition(r.token) ? _resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(r.token, null) : r; + }; + nodes.forEach(function (node) { + node.resolvables = node.resolvables.map(replaceTransitionWithNull); + }); +}; +//# sourceMappingURL=coreResolvables.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerIgnoredTransitionHook": () => (/* binding */ registerIgnoredTransitionHook) +/* harmony export */ }); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); + + +/** + * A [[TransitionHookFn]] that skips a transition if it should be ignored + * + * This hook is invoked at the end of the onBefore phase. + * + * If the transition should be ignored (because no parameter or states changed) + * then the transition is ignored and not processed. + */ +function ignoredHook(trans) { + var ignoredReason = trans._ignoredReason(); + if (!ignoredReason) + return; + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceTransitionIgnored(trans); + var pending = trans.router.globals.transition; + // The user clicked a link going back to the *current state* ('A') + // However, there is also a pending transition in flight (to 'B') + // Abort the transition to 'B' because the user now wants to be back at 'A'. + if (ignoredReason === 'SameAsCurrent' && pending) { + pending.abort(); + } + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__.Rejection.ignored().toPromise(); +} +var registerIgnoredTransitionHook = function (transitionService) { + return transitionService.onBefore({}, ignoredHook, { priority: -9999 }); +}; +//# sourceMappingURL=ignoredTransition.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerInvalidTransitionHook": () => (/* binding */ registerInvalidTransitionHook) +/* harmony export */ }); +/** + * A [[TransitionHookFn]] that rejects the Transition if it is invalid + * + * This hook is invoked at the end of the onBefore phase. + * If the transition is invalid (for example, param values do not validate) + * then the transition is rejected. + */ +function invalidTransitionHook(trans) { + if (!trans.valid()) { + throw new Error(trans.error().toString()); + } +} +var registerInvalidTransitionHook = function (transitionService) { + return transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 }); +}; +//# sourceMappingURL=invalidTransition.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerLazyLoadHook": () => (/* binding */ registerLazyLoadHook), +/* harmony export */ "lazyLoadState": () => (/* binding */ lazyLoadState) +/* harmony export */ }); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + +/** + * A [[TransitionHookFn]] that performs lazy loading + * + * When entering a state "abc" which has a `lazyLoad` function defined: + * - Invoke the `lazyLoad` function (unless it is already in process) + * - Flag the hook function as "in process" + * - The function should return a promise (that resolves when lazy loading is complete) + * - Wait for the promise to settle + * - If the promise resolves to a [[LazyLoadResult]], then register those states + * - Flag the hook function as "not in process" + * - If the hook was successful + * - Remove the `lazyLoad` function from the state declaration + * - If all the hooks were successful + * - Retry the transition (by returning a TargetState) + * + * ``` + * .state('abc', { + * component: 'fooComponent', + * lazyLoad: () => import('./fooComponent') + * }); + * ``` + * + * See [[StateDeclaration.lazyLoad]] + */ +var lazyLoadHook = function (transition) { + var router = transition.router; + function retryTransition() { + if (transition.originalTransition().options().source !== 'url') { + // The original transition was not triggered via url sync + // The lazy state should be loaded now, so re-try the original transition + var orig = transition.targetState(); + return router.stateService.target(orig.identifier(), orig.params(), orig.options()); + } + // The original transition was triggered via url sync + // Run the URL rules and find the best match + var $url = router.urlService; + var result = $url.match($url.parts()); + var rule = result && result.rule; + // If the best match is a state, redirect the transition (instead + // of calling sync() which supersedes the current transition) + if (rule && rule.type === 'STATE') { + var state = rule.state; + var params = result.match; + return router.stateService.target(state, params, transition.options()); + } + // No matching state found, so let .sync() choose the best non-state match/otherwise + router.urlService.sync(); + } + var promises = transition + .entering() + .filter(function (state) { return !!state.$$state().lazyLoad; }) + .map(function (state) { return lazyLoadState(transition, state); }); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.all(promises).then(retryTransition); +}; +var registerLazyLoadHook = function (transitionService) { + return transitionService.onBefore({ entering: function (state) { return !!state.lazyLoad; } }, lazyLoadHook); +}; +/** + * Invokes a state's lazy load function + * + * @param transition a Transition context + * @param state the state to lazy load + * @returns A promise for the lazy load result + */ +function lazyLoadState(transition, state) { + var lazyLoadFn = state.$$state().lazyLoad; + // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked + var promise = lazyLoadFn['_promise']; + if (!promise) { + var success = function (result) { + delete state.lazyLoad; + delete state.$$state().lazyLoad; + delete lazyLoadFn['_promise']; + return result; + }; + var error = function (err) { + delete lazyLoadFn['_promise']; + return _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.reject(err); + }; + promise = lazyLoadFn['_promise'] = _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.when(lazyLoadFn(transition, state)) + .then(updateStateRegistry) + .then(success, error); + } + /** Register any lazy loaded state definitions */ + function updateStateRegistry(result) { + if (result && Array.isArray(result.states)) { + result.states.forEach(function (_state) { return transition.router.stateRegistry.register(_state); }); + } + return result; + } + return promise; +} +//# sourceMappingURL=lazyLoad.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerOnExitHook": () => (/* binding */ registerOnExitHook), +/* harmony export */ "registerOnRetainHook": () => (/* binding */ registerOnRetainHook), +/* harmony export */ "registerOnEnterHook": () => (/* binding */ registerOnEnterHook) +/* harmony export */ }); +/** + * A factory which creates an onEnter, onExit or onRetain transition hook function + * + * The returned function invokes the (for instance) state.onEnter hook when the + * state is being entered. + */ +function makeEnterExitRetainHook(hookName) { + return function (transition, state) { + var _state = state.$$state(); + var hookFn = _state[hookName]; + return hookFn(transition, state); + }; +} +/** + * The [[TransitionStateHookFn]] for onExit + * + * When the state is being exited, the state's .onExit function is invoked. + * + * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);` + * + * See: [[IHookRegistry.onExit]] + */ +var onExitHook = makeEnterExitRetainHook('onExit'); +var registerOnExitHook = function (transitionService) { + return transitionService.onExit({ exiting: function (state) { return !!state.onExit; } }, onExitHook); +}; +/** + * The [[TransitionStateHookFn]] for onRetain + * + * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked. + * + * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);` + * + * See: [[IHookRegistry.onRetain]] + */ +var onRetainHook = makeEnterExitRetainHook('onRetain'); +var registerOnRetainHook = function (transitionService) { + return transitionService.onRetain({ retained: function (state) { return !!state.onRetain; } }, onRetainHook); +}; +/** + * The [[TransitionStateHookFn]] for onEnter + * + * When the state is being entered, the state's .onEnter function is invoked. + * + * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);` + * + * See: [[IHookRegistry.onEnter]] + */ +var onEnterHook = makeEnterExitRetainHook('onEnter'); +var registerOnEnterHook = function (transitionService) { + return transitionService.onEnter({ entering: function (state) { return !!state.onEnter; } }, onEnterHook); +}; +//# sourceMappingURL=onEnterExitRetain.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerRedirectToHook": () => (/* binding */ registerRedirectToHook) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); + + + +/** + * A [[TransitionHookFn]] that redirects to a different state or params + * + * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);` + * + * See [[StateDeclaration.redirectTo]] + */ +var redirectToHook = function (trans) { + var redirect = trans.to().redirectTo; + if (!redirect) + return; + var $state = trans.router.stateService; + function handleResult(result) { + if (!result) + return; + if (result instanceof _state_targetState__WEBPACK_IMPORTED_MODULE_2__.TargetState) + return result; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(result)) + return $state.target(result, trans.params(), trans.options()); + if (result['state'] || result['params']) + return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options()); + } + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(redirect)) { + return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(redirect(trans)).then(handleResult); + } + return handleResult(redirect); +}; +var registerRedirectToHook = function (transitionService) { + return transitionService.onStart({ to: function (state) { return !!state.redirectTo; } }, redirectToHook); +}; +//# sourceMappingURL=redirectTo.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/resolve.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/resolve.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "RESOLVE_HOOK_PRIORITY": () => (/* binding */ RESOLVE_HOOK_PRIORITY), +/* harmony export */ "registerEagerResolvePath": () => (/* binding */ registerEagerResolvePath), +/* harmony export */ "registerLazyResolveState": () => (/* binding */ registerLazyResolveState), +/* harmony export */ "registerResolveRemaining": () => (/* binding */ registerResolveRemaining) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + +var RESOLVE_HOOK_PRIORITY = 1000; +/** + * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path + * + * Registered using `transitionService.onStart({}, eagerResolvePath, { priority: 1000 });` + * + * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for. + * + * See [[StateDeclaration.resolve]] + */ +var eagerResolvePath = function (trans) { + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).resolvePath('EAGER', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerEagerResolvePath = function (transitionService) { + return transitionService.onStart({}, eagerResolvePath, { priority: RESOLVE_HOOK_PRIORITY }); +}; +/** + * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path + * + * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState, { priority: 1000 });` + * + * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for. + * + * See [[StateDeclaration.resolve]] + */ +var lazyResolveState = function (trans, state) { + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).subContext(state.$$state()).resolvePath('LAZY', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerLazyResolveState = function (transitionService) { + return transitionService.onEnter({ entering: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.val)(true) }, lazyResolveState, { priority: RESOLVE_HOOK_PRIORITY }); +}; +/** + * A [[TransitionHookFn]] which resolves any dynamically added (LAZY or EAGER) Resolvables. + * + * Registered using `transitionService.onFinish({}, eagerResolvePath, { priority: 1000 });` + * + * After all entering states have been entered, this hook resolves any remaining Resolvables. + * These are typically dynamic resolves which were added by some Transition Hook using [[Transition.addResolvable]]. + * + * See [[StateDeclaration.resolve]] + */ +var resolveRemaining = function (trans) { + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).resolvePath('LAZY', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerResolveRemaining = function (transitionService) { + return transitionService.onFinish({}, resolveRemaining, { priority: RESOLVE_HOOK_PRIORITY }); +}; +//# sourceMappingURL=resolve.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js": +/*!********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerUpdateGlobalState": () => (/* binding */ registerUpdateGlobalState) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + +/** + * A [[TransitionHookFn]] which updates global UI-Router state + * + * Registered using `transitionService.onBefore({}, updateGlobalState);` + * + * Before a [[Transition]] starts, updates the global value of "the current transition" ([[Globals.transition]]). + * After a successful [[Transition]], updates the global values of "the current state" + * ([[Globals.current]] and [[Globals.$current]]) and "the current param values" ([[Globals.params]]). + * + * See also the deprecated properties: + * [[StateService.transition]], [[StateService.current]], [[StateService.params]] + */ +var updateGlobalState = function (trans) { + var globals = trans.router.globals; + var transitionSuccessful = function () { + globals.successfulTransitions.enqueue(trans); + globals.$current = trans.$to(); + globals.current = globals.$current.self; + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.copy)(trans.params(), globals.params); + }; + var clearCurrentTransition = function () { + // Do not clear globals.transition if a different transition has started in the meantime + if (globals.transition === trans) + globals.transition = null; + }; + trans.onSuccess({}, transitionSuccessful, { priority: 10000 }); + trans.promise.then(clearCurrentTransition, clearCurrentTransition); +}; +var registerUpdateGlobalState = function (transitionService) { + return transitionService.onCreate({}, updateGlobalState); +}; +//# sourceMappingURL=updateGlobals.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/url.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/url.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerUpdateUrl": () => (/* binding */ registerUpdateUrl) +/* harmony export */ }); +/** + * A [[TransitionHookFn]] which updates the URL after a successful transition + * + * Registered using `transitionService.onSuccess({}, updateUrl);` + */ +var updateUrl = function (transition) { + var options = transition.options(); + var $state = transition.router.stateService; + var $urlRouter = transition.router.urlRouter; + // Dont update the url in these situations: + // The transition was triggered by a URL sync (options.source === 'url') + // The user doesn't want the url to update (options.location === false) + // The destination state, and all parents have no navigable url + if (options.source !== 'url' && options.location && $state.$current.navigable) { + var urlOptions = { replace: options.location === 'replace' }; + $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions); + } + $urlRouter.update(true); +}; +var registerUpdateUrl = function (transitionService) { + return transitionService.onSuccess({}, updateUrl, { priority: 9999 }); +}; +//# sourceMappingURL=url.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/views.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/views.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerLoadEnteringViews": () => (/* binding */ registerLoadEnteringViews), +/* harmony export */ "registerActivateViews": () => (/* binding */ registerActivateViews) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + + +/** + * A [[TransitionHookFn]] which waits for the views to load + * + * Registered using `transitionService.onStart({}, loadEnteringViews);` + * + * Allows the views to do async work in [[ViewConfig.load]] before the transition continues. + * In angular 1, this includes loading the templates. + */ +var loadEnteringViews = function (transition) { + var $q = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q; + var enteringViews = transition.views('entering'); + if (!enteringViews.length) + return; + return $q.all(enteringViews.map(function (view) { return $q.when(view.load()); })).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerLoadEnteringViews = function (transitionService) { + return transitionService.onFinish({}, loadEnteringViews); +}; +/** + * A [[TransitionHookFn]] which activates the new views when a transition is successful. + * + * Registered using `transitionService.onSuccess({}, activateViews);` + * + * After a transition is complete, this hook deactivates the old views from the previous state, + * and activates the new views from the destination state. + * + * See [[ViewService]] + */ +var activateViews = function (transition) { + var enteringViews = transition.views('entering'); + var exitingViews = transition.views('exiting'); + if (!enteringViews.length && !exitingViews.length) + return; + var $view = transition.router.viewService; + exitingViews.forEach(function (vc) { return $view.deactivateViewConfig(vc); }); + enteringViews.forEach(function (vc) { return $view.activateViewConfig(vc); }); + $view.sync(); +}; +var registerActivateViews = function (transitionService) { + return transitionService.onSuccess({}, activateViews); +}; +//# sourceMappingURL=views.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/index.js": +/*!******************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/index.js ***! + \******************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Category": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Category), +/* harmony export */ "Glob": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Glob), +/* harmony export */ "Queue": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Queue), +/* harmony export */ "Trace": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Trace), +/* harmony export */ "_extend": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._extend), +/* harmony export */ "_inArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._inArray), +/* harmony export */ "_pushTo": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._pushTo), +/* harmony export */ "_removeFrom": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._removeFrom), +/* harmony export */ "all": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.all), +/* harmony export */ "allTrueR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.allTrueR), +/* harmony export */ "ancestors": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.ancestors), +/* harmony export */ "and": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.and), +/* harmony export */ "any": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.any), +/* harmony export */ "anyTrueR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.anyTrueR), +/* harmony export */ "applyPairs": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.applyPairs), +/* harmony export */ "arrayTuples": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.arrayTuples), +/* harmony export */ "assertFn": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertFn), +/* harmony export */ "assertMap": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertMap), +/* harmony export */ "assertPredicate": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertPredicate), +/* harmony export */ "beforeAfterSubstr": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.beforeAfterSubstr), +/* harmony export */ "compose": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.compose), +/* harmony export */ "copy": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.copy), +/* harmony export */ "createProxyFunctions": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions), +/* harmony export */ "curry": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.curry), +/* harmony export */ "defaults": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.defaults), +/* harmony export */ "deregAll": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.deregAll), +/* harmony export */ "eq": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.eq), +/* harmony export */ "equals": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.equals), +/* harmony export */ "extend": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.extend), +/* harmony export */ "filter": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.filter), +/* harmony export */ "find": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.find), +/* harmony export */ "flatten": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.flatten), +/* harmony export */ "flattenR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.flattenR), +/* harmony export */ "fnToString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.fnToString), +/* harmony export */ "forEach": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.forEach), +/* harmony export */ "fromJson": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.fromJson), +/* harmony export */ "functionToString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.functionToString), +/* harmony export */ "hostRegex": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.hostRegex), +/* harmony export */ "identity": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.identity), +/* harmony export */ "inArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.inArray), +/* harmony export */ "inherit": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.inherit), +/* harmony export */ "invoke": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.invoke), +/* harmony export */ "is": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.is), +/* harmony export */ "isArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isArray), +/* harmony export */ "isDate": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isDate), +/* harmony export */ "isDefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isDefined), +/* harmony export */ "isFunction": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isFunction), +/* harmony export */ "isInjectable": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isInjectable), +/* harmony export */ "isNull": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNull), +/* harmony export */ "isNullOrUndefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNullOrUndefined), +/* harmony export */ "isNumber": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNumber), +/* harmony export */ "isObject": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isObject), +/* harmony export */ "isPromise": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isPromise), +/* harmony export */ "isRegExp": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isRegExp), +/* harmony export */ "isString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isString), +/* harmony export */ "isUndefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isUndefined), +/* harmony export */ "joinNeighborsR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.joinNeighborsR), +/* harmony export */ "kebobString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.kebobString), +/* harmony export */ "makeStub": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.makeStub), +/* harmony export */ "map": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.map), +/* harmony export */ "mapObj": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.mapObj), +/* harmony export */ "maxLength": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.maxLength), +/* harmony export */ "mergeR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.mergeR), +/* harmony export */ "noop": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.noop), +/* harmony export */ "not": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.not), +/* harmony export */ "omit": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.omit), +/* harmony export */ "or": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.or), +/* harmony export */ "padString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.padString), +/* harmony export */ "pairs": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pairs), +/* harmony export */ "parse": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.parse), +/* harmony export */ "pattern": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pattern), +/* harmony export */ "pick": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pick), +/* harmony export */ "pipe": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pipe), +/* harmony export */ "pluck": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pluck), +/* harmony export */ "prop": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.prop), +/* harmony export */ "propEq": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.propEq), +/* harmony export */ "pushR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pushR), +/* harmony export */ "pushTo": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pushTo), +/* harmony export */ "removeFrom": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.removeFrom), +/* harmony export */ "root": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.root), +/* harmony export */ "services": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.services), +/* harmony export */ "silenceUncaughtInPromise": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise), +/* harmony export */ "silentRejection": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.silentRejection), +/* harmony export */ "splitEqual": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitEqual), +/* harmony export */ "splitHash": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitHash), +/* harmony export */ "splitOnDelim": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitOnDelim), +/* harmony export */ "splitQuery": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitQuery), +/* harmony export */ "stringify": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.stringify), +/* harmony export */ "stripLastPathElement": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.stripLastPathElement), +/* harmony export */ "tail": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.tail), +/* harmony export */ "toJson": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.toJson), +/* harmony export */ "trace": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.trace), +/* harmony export */ "trimHashVal": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.trimHashVal), +/* harmony export */ "uniqR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.uniqR), +/* harmony export */ "unnest": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.unnest), +/* harmony export */ "unnestR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.unnestR), +/* harmony export */ "val": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.val), +/* harmony export */ "values": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.values), +/* harmony export */ "PathNode": () => (/* reexport safe */ _path_index__WEBPACK_IMPORTED_MODULE_2__.PathNode), +/* harmony export */ "PathUtils": () => (/* reexport safe */ _path_index__WEBPACK_IMPORTED_MODULE_2__.PathUtils), +/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.NATIVE_INJECTOR_TOKEN), +/* harmony export */ "Resolvable": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.Resolvable), +/* harmony export */ "ResolveContext": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.ResolveContext), +/* harmony export */ "defaultResolvePolicy": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.defaultResolvePolicy), +/* harmony export */ "resolvePolicies": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.resolvePolicies), +/* harmony export */ "HookBuilder": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.HookBuilder), +/* harmony export */ "RegisteredHook": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.RegisteredHook), +/* harmony export */ "RejectType": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.RejectType), +/* harmony export */ "Rejection": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.Rejection), +/* harmony export */ "Transition": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.Transition), +/* harmony export */ "TransitionEventType": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionEventType), +/* harmony export */ "TransitionHook": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHook), +/* harmony export */ "TransitionHookPhase": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHookPhase), +/* harmony export */ "TransitionHookScope": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHookScope), +/* harmony export */ "TransitionService": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionService), +/* harmony export */ "defaultTransOpts": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.defaultTransOpts), +/* harmony export */ "makeEvent": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.makeEvent), +/* harmony export */ "matchState": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.matchState), +/* harmony export */ "UIRouterGlobals": () => (/* reexport safe */ _globals__WEBPACK_IMPORTED_MODULE_8__.UIRouterGlobals), +/* harmony export */ "UIRouter": () => (/* reexport safe */ _router__WEBPACK_IMPORTED_MODULE_9__.UIRouter), +/* harmony export */ "UIRouterPluginBase": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_11__.UIRouterPluginBase) +/* harmony export */ }); +/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _params_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./params/index */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _params_index__WEBPACK_IMPORTED_MODULE_1__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _params_index__WEBPACK_IMPORTED_MODULE_1__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _path_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./path/index */ "./node_modules/@uirouter/core/lib-esm/path/index.js"); +/* harmony import */ var _resolve_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./resolve/index */ "./node_modules/@uirouter/core/lib-esm/resolve/index.js"); +/* harmony import */ var _state_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./state/index */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _state_index__WEBPACK_IMPORTED_MODULE_4__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _state_index__WEBPACK_IMPORTED_MODULE_4__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _transition_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./transition/index */ "./node_modules/@uirouter/core/lib-esm/transition/index.js"); +/* harmony import */ var _url_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./url/index */ "./node_modules/@uirouter/core/lib-esm/url/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _url_index__WEBPACK_IMPORTED_MODULE_6__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _url_index__WEBPACK_IMPORTED_MODULE_6__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _view_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./view/index */ "./node_modules/@uirouter/core/lib-esm/view/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _view_index__WEBPACK_IMPORTED_MODULE_7__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState","BaseUrlRule","ParamFactory","UrlConfig","UrlMatcher","UrlMatcherFactory","UrlRouter","UrlRuleFactory","UrlRules","UrlService"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _view_index__WEBPACK_IMPORTED_MODULE_7__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./globals */ "./node_modules/@uirouter/core/lib-esm/globals.js"); +/* harmony import */ var _router__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./router */ "./node_modules/@uirouter/core/lib-esm/router.js"); +/* harmony import */ var _vanilla__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./vanilla */ "./node_modules/@uirouter/core/lib-esm/vanilla.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _vanilla__WEBPACK_IMPORTED_MODULE_10__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState","BaseUrlRule","ParamFactory","UrlConfig","UrlMatcher","UrlMatcherFactory","UrlRouter","UrlRuleFactory","UrlRules","UrlService","ViewService","UIRouterGlobals","UIRouter"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _vanilla__WEBPACK_IMPORTED_MODULE_10__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/interface.js"); + + + + + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/interface.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/interface.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UIRouterPluginBase": () => (/* binding */ UIRouterPluginBase) +/* harmony export */ }); +var UIRouterPluginBase = /** @class */ (function () { + function UIRouterPluginBase() { + } + UIRouterPluginBase.prototype.dispose = function (router) { }; + return UIRouterPluginBase; +}()); + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/index.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "DefType": () => (/* reexport safe */ _param__WEBPACK_IMPORTED_MODULE_1__.DefType), +/* harmony export */ "Param": () => (/* reexport safe */ _param__WEBPACK_IMPORTED_MODULE_1__.Param), +/* harmony export */ "ParamTypes": () => (/* reexport safe */ _paramTypes__WEBPACK_IMPORTED_MODULE_2__.ParamTypes), +/* harmony export */ "StateParams": () => (/* reexport safe */ _stateParams__WEBPACK_IMPORTED_MODULE_3__.StateParams), +/* harmony export */ "ParamType": () => (/* reexport safe */ _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/params/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _param__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _paramTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./paramTypes */ "./node_modules/@uirouter/core/lib-esm/params/paramTypes.js"); +/* harmony import */ var _stateParams__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateParams */ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js"); +/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); +/** + * This module contains code for State Parameters. + * + * See [[ParamDeclaration]] + * + * @packageDocumentation @preferred + */ + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/interface.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/interface.js ***! + \*****************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/param.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/param.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "DefType": () => (/* binding */ DefType), +/* harmony export */ "Param": () => (/* binding */ Param) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); + + + + + +var hasOwn = Object.prototype.hasOwnProperty; +var isShorthand = function (cfg) { + return ['value', 'type', 'squash', 'array', 'dynamic'].filter(hasOwn.bind(cfg || {})).length === 0; +}; +var DefType; +(function (DefType) { + DefType[DefType["PATH"] = 0] = "PATH"; + DefType[DefType["SEARCH"] = 1] = "SEARCH"; + DefType[DefType["CONFIG"] = 2] = "CONFIG"; +})(DefType || (DefType = {})); + +function getParamDeclaration(paramName, location, state) { + var noReloadOnSearch = (state.reloadOnSearch === false && location === DefType.SEARCH) || undefined; + var dynamic = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)([state.dynamic, noReloadOnSearch], _common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined); + var defaultConfig = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(dynamic) ? { dynamic: dynamic } : {}; + var paramConfig = unwrapShorthand(state && state.params && state.params[paramName]); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(defaultConfig, paramConfig); +} +function unwrapShorthand(cfg) { + cfg = isShorthand(cfg) ? { value: cfg } : cfg; + getStaticDefaultValue['__cacheable'] = true; + function getStaticDefaultValue() { + return cfg.value; + } + var $$fn = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isInjectable)(cfg.value) ? cfg.value : getStaticDefaultValue; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(cfg, { $$fn: $$fn }); +} +function getType(cfg, urlType, location, id, paramTypes) { + if (cfg.type && urlType && urlType.name !== 'string') + throw new Error("Param '" + id + "' has two type configurations."); + if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type)) + return paramTypes.type(cfg.type); + if (urlType) + return urlType; + if (!cfg.type) { + var type = location === DefType.CONFIG + ? 'any' + : location === DefType.PATH + ? 'path' + : location === DefType.SEARCH + ? 'query' + : 'string'; + return paramTypes.type(type); + } + return cfg.type instanceof _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType ? cfg.type : paramTypes.type(cfg.type); +} +/** returns false, true, or the squash value to indicate the "default parameter url squash policy". */ +function getSquashPolicy(config, isOptional, defaultPolicy) { + var squash = config.squash; + if (!isOptional || squash === false) + return false; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(squash) || squash == null) + return defaultPolicy; + if (squash === true || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) + return squash; + throw new Error("Invalid squash policy: '" + squash + "'. Valid policies: false, true, or arbitrary string"); +} +function getReplace(config, arrayMode, isOptional, squash) { + var defaultPolicy = [ + { from: '', to: isOptional || arrayMode ? undefined : '' }, + { from: null, to: isOptional || arrayMode ? undefined : '' }, + ]; + var replace = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(config.replace) ? config.replace : []; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) + replace.push({ from: squash, to: undefined }); + var configuredKeys = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(replace, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('from')); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.filter)(defaultPolicy, function (item) { return configuredKeys.indexOf(item.from) === -1; }).concat(replace); +} +var Param = /** @class */ (function () { + function Param(id, type, location, urlConfig, state) { + var config = getParamDeclaration(id, location, state); + type = getType(config, type, location, id, urlConfig.paramTypes); + var arrayMode = getArrayMode(); + type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type; + var isOptional = config.value !== undefined || location === DefType.SEARCH; + var dynamic = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.dynamic) ? !!config.dynamic : !!type.dynamic; + var raw = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.raw) ? !!config.raw : !!type.raw; + var squash = getSquashPolicy(config, isOptional, urlConfig.defaultSquashPolicy()); + var replace = getReplace(config, arrayMode, isOptional, squash); + var inherit = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.inherit) ? !!config.inherit : !!type.inherit; + // array config: param name (param[]) overrides default settings. explicit config overrides param name. + function getArrayMode() { + var arrayDefaults = { array: location === DefType.SEARCH ? 'auto' : false }; + var arrayParamNomenclature = id.match(/\[\]$/) ? { array: true } : {}; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(arrayDefaults, arrayParamNomenclature, config).array; + } + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, { id: id, type: type, location: location, isOptional: isOptional, dynamic: dynamic, raw: raw, squash: squash, replace: replace, inherit: inherit, array: arrayMode, config: config }); + } + Param.values = function (params, values) { + if (values === void 0) { values = {}; } + var paramValues = {}; + for (var _i = 0, params_1 = params; _i < params_1.length; _i++) { + var param = params_1[_i]; + paramValues[param.id] = param.value(values[param.id]); + } + return paramValues; + }; + /** + * Finds [[Param]] objects which have different param values + * + * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects + * + * @param params: The list of Param objects to filter + * @param values1: The first set of parameter values + * @param values2: the second set of parameter values + * + * @returns any Param objects whose values were different between values1 and values2 + */ + Param.changed = function (params, values1, values2) { + if (values1 === void 0) { values1 = {}; } + if (values2 === void 0) { values2 = {}; } + return params.filter(function (param) { return !param.type.equals(values1[param.id], values2[param.id]); }); + }; + /** + * Checks if two param value objects are equal (for a set of [[Param]] objects) + * + * @param params The list of [[Param]] objects to check + * @param values1 The first set of param values + * @param values2 The second set of param values + * + * @returns true if the param values in values1 and values2 are equal + */ + Param.equals = function (params, values1, values2) { + if (values1 === void 0) { values1 = {}; } + if (values2 === void 0) { values2 = {}; } + return Param.changed(params, values1, values2).length === 0; + }; + /** Returns true if a the parameter values are valid, according to the Param definitions */ + Param.validates = function (params, values) { + if (values === void 0) { values = {}; } + return params.map(function (param) { return param.validates(values[param.id]); }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.allTrueR, true); + }; + Param.prototype.isDefaultValue = function (value) { + return this.isOptional && this.type.equals(this.value(), value); + }; + /** + * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the + * default value, which may be the result of an injectable function. + */ + Param.prototype.value = function (value) { + var _this = this; + /** + * [Internal] Get the default value of a parameter, which may be an injectable function. + */ + var getDefaultValue = function () { + if (_this._defaultValueCache) + return _this._defaultValueCache.defaultValue; + if (!_common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector) + throw new Error('Injectable functions cannot be called at configuration time'); + var defaultValue = _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector.invoke(_this.config.$$fn); + if (defaultValue !== null && defaultValue !== undefined && !_this.type.is(defaultValue)) + throw new Error("Default value (" + defaultValue + ") for parameter '" + _this.id + "' is not an instance of ParamType (" + _this.type.name + ")"); + if (_this.config.$$fn['__cacheable']) { + _this._defaultValueCache = { defaultValue: defaultValue }; + } + return defaultValue; + }; + var replaceSpecialValues = function (val) { + for (var _i = 0, _a = _this.replace; _i < _a.length; _i++) { + var tuple = _a[_i]; + if (tuple.from === val) + return tuple.to; + } + return val; + }; + value = replaceSpecialValues(value); + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isUndefined)(value) ? getDefaultValue() : this.type.$normalize(value); + }; + Param.prototype.isSearch = function () { + return this.location === DefType.SEARCH; + }; + Param.prototype.validates = function (value) { + // There was no parameter value, but the param is optional + if (((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isUndefined)(value) || value === null) && this.isOptional) + return true; + // The value was not of the correct ParamType, and could not be decoded to the correct ParamType + var normalized = this.type.$normalize(value); + if (!this.type.is(normalized)) + return false; + // The value was of the correct type, but when encoded, did not match the ParamType's regexp + var encoded = this.type.encode(normalized); + return !((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(encoded) && !this.type.pattern.exec(encoded)); + }; + Param.prototype.toString = function () { + return "{Param:" + this.id + " " + this.type + " squash: '" + this.squash + "' optional: " + this.isOptional + "}"; + }; + return Param; +}()); + +//# sourceMappingURL=param.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/paramType.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/paramType.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ParamType": () => (/* binding */ ParamType) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + + +/** + * An internal class which implements [[ParamTypeDefinition]]. + * + * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types. + * When a param type definition is registered, an instance of this class is created internally. + * + * This class has naive implementations for all the [[ParamTypeDefinition]] methods. + * + * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values. + * + * #### Example: + * ```js + * var paramTypeDef = { + * decode: function(val) { return parseInt(val, 10); }, + * encode: function(val) { return val && val.toString(); }, + * equals: function(a, b) { return this.is(a) && a === b; }, + * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; }, + * pattern: /\d+/ + * } + * + * var paramType = new ParamType(paramTypeDef); + * ``` + */ +var ParamType = /** @class */ (function () { + /** + * @param def A configuration object which contains the custom type definition. The object's + * properties will override the default methods and/or pattern in `ParamType`'s public interface. + * @returns a new ParamType object + */ + function ParamType(def) { + /** @inheritdoc */ + this.pattern = /.*/; + /** @inheritdoc */ + this.inherit = true; + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, def); + } + // consider these four methods to be "abstract methods" that should be overridden + /** @inheritdoc */ + ParamType.prototype.is = function (val, key) { + return true; + }; + /** @inheritdoc */ + ParamType.prototype.encode = function (val, key) { + return val; + }; + /** @inheritdoc */ + ParamType.prototype.decode = function (val, key) { + return val; + }; + /** @inheritdoc */ + ParamType.prototype.equals = function (a, b) { + // tslint:disable-next-line:triple-equals + return a == b; + }; + ParamType.prototype.$subPattern = function () { + var sub = this.pattern.toString(); + return sub.substr(1, sub.length - 2); + }; + ParamType.prototype.toString = function () { + return "{ParamType:" + this.name + "}"; + }; + /** Given an encoded string, or a decoded object, returns a decoded object */ + ParamType.prototype.$normalize = function (val) { + return this.is(val) ? val : this.decode(val); + }; + /** + * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'. + * e.g.: + * - urlmatcher pattern "/path?{queryParam[]:int}" + * - url: "/path?queryParam=1&queryParam=2 + * - $stateParams.queryParam will be [1, 2] + * if `mode` is "auto", then + * - url: "/path?queryParam=1 will create $stateParams.queryParam: 1 + * - url: "/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2] + */ + ParamType.prototype.$asArray = function (mode, isSearch) { + if (!mode) + return this; + if (mode === 'auto' && !isSearch) + throw new Error("'auto' array mode is for query parameters only"); + return new ArrayType(this, mode); + }; + return ParamType; +}()); + +/** Wraps up a `ParamType` object to handle array values. */ +function ArrayType(type, mode) { + var _this = this; + // Wrap non-array value as array + function arrayWrap(val) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(val) ? val : (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(val) ? [val] : []; + } + // Unwrap array value for "auto" mode. Return undefined for empty array. + function arrayUnwrap(val) { + switch (val.length) { + case 0: + return undefined; + case 1: + return mode === 'auto' ? val[0] : val; + default: + return val; + } + } + // Wraps type (.is/.encode/.decode) functions to operate on each value of an array + function arrayHandler(callback, allTruthyMode) { + return function handleArray(val) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(val) && val.length === 0) + return val; + var arr = arrayWrap(val); + var result = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(arr, callback); + return allTruthyMode === true ? (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.filter)(result, function (x) { return !x; }).length === 0 : arrayUnwrap(result); + }; + } + // Wraps type (.equals) functions to operate on each value of an array + function arrayEqualsHandler(callback) { + return function handleArray(val1, val2) { + var left = arrayWrap(val1), right = arrayWrap(val2); + if (left.length !== right.length) + return false; + for (var i = 0; i < left.length; i++) { + if (!callback(left[i], right[i])) + return false; + } + return true; + }; + } + ['encode', 'decode', 'equals', '$normalize'].forEach(function (name) { + var paramTypeFn = type[name].bind(type); + var wrapperFn = name === 'equals' ? arrayEqualsHandler : arrayHandler; + _this[name] = wrapperFn(paramTypeFn); + }); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, { + dynamic: type.dynamic, + name: type.name, + pattern: type.pattern, + inherit: type.inherit, + raw: type.raw, + is: arrayHandler(type.is.bind(type), true), + $arrayMode: mode, + }); +} +//# sourceMappingURL=paramType.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/paramTypes.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/paramTypes.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ParamTypes": () => (/* binding */ ParamTypes) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); + + + + + +/** + * A registry for parameter types. + * + * This registry manages the built-in (and custom) parameter types. + * + * The built-in parameter types are: + * + * - [[string]] + * - [[path]] + * - [[query]] + * - [[hash]] + * - [[int]] + * - [[bool]] + * - [[date]] + * - [[json]] + * - [[any]] + * + * To register custom parameter types, use [[UrlConfig.type]], i.e., + * + * ```js + * router.urlService.config.type(customType) + * ``` + */ +var ParamTypes = /** @class */ (function () { + function ParamTypes() { + this.enqueue = true; + this.typeQueue = []; + this.defaultTypes = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.pick)(ParamTypes.prototype, [ + 'hash', + 'string', + 'query', + 'path', + 'int', + 'bool', + 'date', + 'json', + 'any', + ]); + // Register default types. Store them in the prototype of this.types. + var makeType = function (definition, name) { return new _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ name: name }, definition)); }; + this.types = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(this.defaultTypes, makeType), {}); + } + ParamTypes.prototype.dispose = function () { + this.types = {}; + }; + /** + * Registers a parameter type + * + * End users should call [[UrlMatcherFactory.type]], which delegates to this method. + */ + ParamTypes.prototype.type = function (name, definition, definitionFn) { + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(definition)) + return this.types[name]; + if (this.types.hasOwnProperty(name)) + throw new Error("A type named '" + name + "' has already been defined."); + this.types[name] = new _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ name: name }, definition)); + if (definitionFn) { + this.typeQueue.push({ name: name, def: definitionFn }); + if (!this.enqueue) + this._flushTypeQueue(); + } + return this; + }; + ParamTypes.prototype._flushTypeQueue = function () { + while (this.typeQueue.length) { + var type = this.typeQueue.shift(); + if (type.pattern) + throw new Error("You cannot override a type's .pattern at runtime."); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this.types[type.name], _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector.invoke(type.def)); + } + }; + return ParamTypes; +}()); + +function initDefaultTypes() { + var makeDefaultType = function (def) { + var valToString = function (val) { return (val != null ? val.toString() : val); }; + var defaultTypeBase = { + encode: valToString, + decode: valToString, + is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(String), + pattern: /.*/, + // tslint:disable-next-line:triple-equals + equals: function (a, b) { return a == b; }, + }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, defaultTypeBase, def); + }; + // Default Parameter Type Definitions + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(ParamTypes.prototype, { + string: makeDefaultType({}), + path: makeDefaultType({ + pattern: /[^/]*/, + }), + query: makeDefaultType({}), + hash: makeDefaultType({ + inherit: false, + }), + int: makeDefaultType({ + decode: function (val) { return parseInt(val, 10); }, + is: function (val) { + return !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isNullOrUndefined)(val) && this.decode(val.toString()) === val; + }, + pattern: /-?\d+/, + }), + bool: makeDefaultType({ + encode: function (val) { return (val && 1) || 0; }, + decode: function (val) { return parseInt(val, 10) !== 0; }, + is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Boolean), + pattern: /0|1/, + }), + date: makeDefaultType({ + encode: function (val) { + return !this.is(val) + ? undefined + : [val.getFullYear(), ('0' + (val.getMonth() + 1)).slice(-2), ('0' + val.getDate()).slice(-2)].join('-'); + }, + decode: function (val) { + if (this.is(val)) + return val; + var match = this.capture.exec(val); + return match ? new Date(match[1], match[2] - 1, match[3]) : undefined; + }, + is: function (val) { return val instanceof Date && !isNaN(val.valueOf()); }, + equals: function (l, r) { + return ['getFullYear', 'getMonth', 'getDate'].reduce(function (acc, fn) { return acc && l[fn]() === r[fn](); }, true); + }, + pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/, + capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/, + }), + json: makeDefaultType({ + encode: _common_common__WEBPACK_IMPORTED_MODULE_0__.toJson, + decode: _common_common__WEBPACK_IMPORTED_MODULE_0__.fromJson, + is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Object), + equals: _common_common__WEBPACK_IMPORTED_MODULE_0__.equals, + pattern: /[^/]*/, + }), + // does not encode/decode + any: makeDefaultType({ + encode: _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, + decode: _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, + is: function () { return true; }, + equals: _common_common__WEBPACK_IMPORTED_MODULE_0__.equals, + }), + }); +} +initDefaultTypes(); +//# sourceMappingURL=paramTypes.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/stateParams.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateParams": () => (/* binding */ StateParams) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + +var StateParams = /** @class */ (function () { + function StateParams(params) { + if (params === void 0) { params = {}; } + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, params); + } + /** + * Merges a set of parameters with all parameters inherited between the common parents of the + * current state and a given destination state. + * + * @param {Object} newParams The set of parameters which will be composited with inherited params. + * @param {Object} $current Internal definition of object representing the current state. + * @param {Object} $to Internal definition of object representing state to transition to. + */ + StateParams.prototype.$inherit = function (newParams, $current, $to) { + var parentParams; + var parents = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.ancestors)($current, $to), inherited = {}, inheritList = []; + for (var i in parents) { + if (!parents[i] || !parents[i].params) + continue; + parentParams = Object.keys(parents[i].params); + if (!parentParams.length) + continue; + for (var j in parentParams) { + if (inheritList.indexOf(parentParams[j]) >= 0) + continue; + inheritList.push(parentParams[j]); + inherited[parentParams[j]] = this[parentParams[j]]; + } + } + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, inherited, newParams); + }; + return StateParams; +}()); + +//# sourceMappingURL=stateParams.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/path/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/path/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PathNode": () => (/* reexport safe */ _pathNode__WEBPACK_IMPORTED_MODULE_0__.PathNode), +/* harmony export */ "PathUtils": () => (/* reexport safe */ _pathUtils__WEBPACK_IMPORTED_MODULE_1__.PathUtils) +/* harmony export */ }); +/* harmony import */ var _pathNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); +/* harmony import */ var _pathUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/path/pathNode.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PathNode": () => (/* binding */ PathNode) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); + + + +/** + * A node in a [[TreeChanges]] path + * + * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path. + * Each PathNode corresponds to a state being entered, exited, or retained. + * The stateful information includes parameter values and resolve data. + */ +var PathNode = /** @class */ (function () { + function PathNode(stateOrNode) { + if (stateOrNode instanceof PathNode) { + var node = stateOrNode; + this.state = node.state; + this.paramSchema = node.paramSchema.slice(); + this.paramValues = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, node.paramValues); + this.resolvables = node.resolvables.slice(); + this.views = node.views && node.views.slice(); + } + else { + var state = stateOrNode; + this.state = state; + this.paramSchema = state.parameters({ inherit: false }); + this.paramValues = {}; + this.resolvables = state.resolvables.map(function (res) { return res.clone(); }); + } + } + PathNode.prototype.clone = function () { + return new PathNode(this); + }; + /** Sets [[paramValues]] for the node, from the values of an object hash */ + PathNode.prototype.applyRawParams = function (params) { + var getParamVal = function (paramDef) { return [paramDef.id, paramDef.value(params[paramDef.id])]; }; + this.paramValues = this.paramSchema.reduce(function (memo, pDef) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs)(memo, getParamVal(pDef)); }, {}); + return this; + }; + /** Gets a specific [[Param]] metadata that belongs to the node */ + PathNode.prototype.parameter = function (name) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this.paramSchema, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', name)); + }; + /** + * @returns true if the state and parameter values for another PathNode are + * equal to the state and param values for this PathNode + */ + PathNode.prototype.equals = function (node, paramsFn) { + var diff = this.diff(node, paramsFn); + return diff && diff.length === 0; + }; + /** + * Finds Params with different parameter values on another PathNode. + * + * Given another node (of the same state), finds the parameter values which differ. + * Returns the [[Param]] (schema objects) whose parameter values differ. + * + * Given another node for a different state, returns `false` + * + * @param node The node to compare to + * @param paramsFn A function that returns which parameters should be compared. + * @returns The [[Param]]s which differ, or null if the two nodes are for different states + */ + PathNode.prototype.diff = function (node, paramsFn) { + if (this.state !== node.state) + return false; + var params = paramsFn ? paramsFn(this) : this.paramSchema; + return _params_param__WEBPACK_IMPORTED_MODULE_2__.Param.changed(params, this.paramValues, node.paramValues); + }; + /** + * Returns a clone of the PathNode + * @deprecated use instance method `node.clone()` + */ + PathNode.clone = function (node) { return node.clone(); }; + return PathNode; +}()); + +//# sourceMappingURL=pathNode.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/path/pathUtils.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PathUtils": () => (/* binding */ PathUtils) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); +/* harmony import */ var _pathNode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); + + + + +/** + * This class contains functions which convert TargetStates, Nodes and paths from one type to another. + */ +var PathUtils = /** @class */ (function () { + function PathUtils() { + } + /** Given a PathNode[], create an TargetState */ + PathUtils.makeTargetState = function (registry, path) { + var state = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(path).state; + return new _state_targetState__WEBPACK_IMPORTED_MODULE_2__.TargetState(registry, state, path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.mergeR, {}), {}); + }; + PathUtils.buildPath = function (targetState) { + var toParams = targetState.params(); + return targetState.$state().path.map(function (state) { return new _pathNode__WEBPACK_IMPORTED_MODULE_3__.PathNode(state).applyRawParams(toParams); }); + }; + /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */ + PathUtils.buildToPath = function (fromPath, targetState) { + var toPath = PathUtils.buildPath(targetState); + if (targetState.options().inherit) { + return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params())); + } + return toPath; + }; + /** + * Creates ViewConfig objects and adds to nodes. + * + * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state + */ + PathUtils.applyViewConfigs = function ($view, path, states) { + // Only apply the viewConfigs to the nodes for the given states + path + .filter(function (node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(states, node.state); }) + .forEach(function (node) { + var viewDecls = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(node.state.views || {}); + var subPath = PathUtils.subPath(path, function (n) { return n === node; }); + var viewConfigs = viewDecls.map(function (view) { return $view.createViewConfig(subPath, view); }); + node.views = viewConfigs.reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); + }); + }; + /** + * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath + * + * For a parameter in a node to be inherited from the from path: + * - The toPath's node must have a matching node in the fromPath (by state). + * - The parameter name must not be found in the toKeys parameter array. + * + * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some + * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams, + * it is not inherited from the fromPath. + */ + PathUtils.inheritParams = function (fromPath, toPath, toKeys) { + if (toKeys === void 0) { toKeys = []; } + function nodeParamVals(path, state) { + var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(path, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('state', state)); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, node && node.paramValues); + } + var noInherit = fromPath + .map(function (node) { return node.paramSchema; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(function (param) { return !param.inherit; }) + .map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('id')); + /** + * Given an [[PathNode]] "toNode", return a new [[PathNode]] with param values inherited from the + * matching node in fromPath. Only inherit keys that aren't found in "toKeys" from the node in "fromPath"" + */ + function makeInheritedParamsNode(toNode) { + // All param values for the node (may include default key/vals, when key was not found in toParams) + var toParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, toNode && toNode.paramValues); + // limited to only those keys found in toParams + var incomingParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.pick)(toParamVals, toKeys); + toParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(toParamVals, toKeys); + var fromParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(nodeParamVals(fromPath, toNode.state) || {}, noInherit); + // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals + var ownParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(toParamVals, fromParamVals, incomingParamVals); + return new _pathNode__WEBPACK_IMPORTED_MODULE_3__.PathNode(toNode.state).applyRawParams(ownParamVals); + } + // The param keys specified by the incoming toParams + return toPath.map(makeInheritedParamsNode); + }; + /** + * Computes the tree changes (entering, exiting) between a fromPath and toPath. + */ + PathUtils.treeChanges = function (fromPath, toPath, reloadState) { + var max = Math.min(fromPath.length, toPath.length); + var keep = 0; + var nodesMatch = function (node1, node2) { return node1.equals(node2, PathUtils.nonDynamicParams); }; + while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) { + keep++; + } + /** Given a retained node, return a new node which uses the to node's param values */ + function applyToParams(retainedNode, idx) { + var cloned = retainedNode.clone(); + cloned.paramValues = toPath[idx].paramValues; + return cloned; + } + var from, retained, exiting, entering, to; + from = fromPath; + retained = from.slice(0, keep); + exiting = from.slice(keep); + // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped + var retainedWithToParams = retained.map(applyToParams); + entering = toPath.slice(keep); + to = retainedWithToParams.concat(entering); + return { from: from, to: to, retained: retained, retainedWithToParams: retainedWithToParams, exiting: exiting, entering: entering }; + }; + /** + * Returns a new path which is: the subpath of the first path which matches the second path. + * + * The new path starts from root and contains any nodes that match the nodes in the second path. + * It stops before the first non-matching node. + * + * Nodes are compared using their state property and their parameter values. + * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes. + * + * @param pathA the first path + * @param pathB the second path + * @param paramsFn a function which returns the parameters to consider when comparing + * + * @returns an array of PathNodes from the first path which match the nodes in the second path + */ + PathUtils.matching = function (pathA, pathB, paramsFn) { + var done = false; + var tuples = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(pathA, pathB); + return tuples.reduce(function (matching, _a) { + var nodeA = _a[0], nodeB = _a[1]; + done = done || !nodeA.equals(nodeB, paramsFn); + return done ? matching : matching.concat(nodeA); + }, []); + }; + /** + * Returns true if two paths are identical. + * + * @param pathA + * @param pathB + * @param paramsFn a function which returns the parameters to consider when comparing + * @returns true if the the states and parameter values for both paths are identical + */ + PathUtils.equals = function (pathA, pathB, paramsFn) { + return pathA.length === pathB.length && PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length; + }; + /** + * Return a subpath of a path, which stops at the first matching node + * + * Given an array of nodes, returns a subset of the array starting from the first node, + * stopping when the first node matches the predicate. + * + * @param path a path of [[PathNode]]s + * @param predicate a [[Predicate]] fn that matches [[PathNode]]s + * @returns a subpath up to the matching node, or undefined if no match is found + */ + PathUtils.subPath = function (path, predicate) { + var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(path, predicate); + var elementIdx = path.indexOf(node); + return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1); + }; + PathUtils.nonDynamicParams = function (node) { + return node.state.parameters({ inherit: false }).filter(function (param) { return !param.dynamic; }); + }; + /** Gets the raw parameter values from a path */ + PathUtils.paramValues = function (path) { return path.reduce(function (acc, node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(acc, node.paramValues); }, {}); }; + return PathUtils; +}()); + +//# sourceMappingURL=pathUtils.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/index.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "resolvePolicies": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.resolvePolicies), +/* harmony export */ "Resolvable": () => (/* reexport safe */ _resolvable__WEBPACK_IMPORTED_MODULE_1__.Resolvable), +/* harmony export */ "defaultResolvePolicy": () => (/* reexport safe */ _resolvable__WEBPACK_IMPORTED_MODULE_1__.defaultResolvePolicy), +/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* reexport safe */ _resolveContext__WEBPACK_IMPORTED_MODULE_2__.NATIVE_INJECTOR_TOKEN), +/* harmony export */ "ResolveContext": () => (/* reexport safe */ _resolveContext__WEBPACK_IMPORTED_MODULE_2__.ResolveContext) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js"); +/* harmony import */ var _resolvable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _resolveContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/interface.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "resolvePolicies": () => (/* binding */ resolvePolicies) +/* harmony export */ }); +var resolvePolicies = { + when: { + LAZY: 'LAZY', + EAGER: 'EAGER', + }, + async: { + WAIT: 'WAIT', + NOWAIT: 'NOWAIT', + }, +}; +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "defaultResolvePolicy": () => (/* binding */ defaultResolvePolicy), +/* harmony export */ "Resolvable": () => (/* binding */ Resolvable) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + + + + + + +// TODO: explicitly make this user configurable +var defaultResolvePolicy = { + when: 'LAZY', + async: 'WAIT', +}; +/** + * The basic building block for the resolve system. + * + * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise), + * and the unwrapped-when-complete (.data) result of the resolveFn. + * + * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the + * resolveFn) and returns the resulting promise. + * + * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first + * parameter to those fns. + */ +var Resolvable = /** @class */ (function () { + function Resolvable(arg1, resolveFn, deps, policy, data) { + this.resolved = false; + this.promise = undefined; + if (arg1 instanceof Resolvable) { + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, arg1); + } + else if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(resolveFn)) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isNullOrUndefined)(arg1)) + throw new Error('new Resolvable(): token argument is required'); + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(resolveFn)) + throw new Error('new Resolvable(): resolveFn argument must be a function'); + this.token = arg1; + this.policy = policy; + this.resolveFn = resolveFn; + this.deps = deps || []; + this.data = data; + this.resolved = data !== undefined; + this.promise = this.resolved ? _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(this.data) : undefined; + } + else if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(arg1) && arg1.token && (arg1.hasOwnProperty('resolveFn') || arg1.hasOwnProperty('data'))) { + var literal = arg1; + return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data); + } + } + Resolvable.prototype.getPolicy = function (state) { + var thisPolicy = this.policy || {}; + var statePolicy = (state && state.resolvePolicy) || {}; + return { + when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when, + async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async, + }; + }; + /** + * Asynchronously resolve this Resolvable's data + * + * Given a ResolveContext that this Resolvable is found in: + * Wait for this Resolvable's dependencies, then invoke this Resolvable's function + * and update the Resolvable's state + */ + Resolvable.prototype.resolve = function (resolveContext, trans) { + var _this = this; + var $q = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q; + // Gets all dependencies from ResolveContext and wait for them to be resolved + var getResolvableDependencies = function () { + return $q.all(resolveContext.getDependencies(_this).map(function (resolvable) { return resolvable.get(resolveContext, trans); })); + }; + // Invokes the resolve function passing the resolved dependencies as arguments + var invokeResolveFn = function (resolvedDeps) { return _this.resolveFn.apply(null, resolvedDeps); }; + var node = resolveContext.findNode(this); + var state = node && node.state; + var asyncPolicy = this.getPolicy(state).async; + var customAsyncPolicy = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(asyncPolicy) ? asyncPolicy : _common_common__WEBPACK_IMPORTED_MODULE_0__.identity; + // After the final value has been resolved, update the state of the Resolvable + var applyResolvedValue = function (resolvedValue) { + _this.data = resolvedValue; + _this.resolved = true; + _this.resolveFn = null; + _common_trace__WEBPACK_IMPORTED_MODULE_2__.trace.traceResolvableResolved(_this, trans); + return _this.data; + }; + // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick. + return (this.promise = $q + .when() + .then(getResolvableDependencies) + .then(invokeResolveFn) + .then(customAsyncPolicy) + .then(applyResolvedValue)); + }; + /** + * Gets a promise for this Resolvable's data. + * + * Fetches the data and returns a promise. + * Returns the existing promise if it has already been fetched once. + */ + Resolvable.prototype.get = function (resolveContext, trans) { + return this.promise || this.resolve(resolveContext, trans); + }; + Resolvable.prototype.toString = function () { + return "Resolvable(token: " + (0,_common_strings__WEBPACK_IMPORTED_MODULE_3__.stringify)(this.token) + ", requires: [" + this.deps.map(_common_strings__WEBPACK_IMPORTED_MODULE_3__.stringify) + "])"; + }; + Resolvable.prototype.clone = function () { + return new Resolvable(this); + }; + Resolvable.fromData = function (token, data) { return new Resolvable(token, function () { return data; }, null, null, data); }; + return Resolvable; +}()); + +//# sourceMappingURL=resolvable.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* binding */ NATIVE_INJECTOR_TOKEN), +/* harmony export */ "ResolveContext": () => (/* binding */ ResolveContext) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js"); +/* harmony import */ var _resolvable__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + + + + +var whens = _interface__WEBPACK_IMPORTED_MODULE_4__.resolvePolicies.when; +var ALL_WHENS = [whens.EAGER, whens.LAZY]; +var EAGER_WHENS = [whens.EAGER]; +// tslint:disable-next-line:no-inferrable-types +var NATIVE_INJECTOR_TOKEN = 'Native Injector'; +/** + * Encapsulates Dependency Injection for a path of nodes + * + * UI-Router states are organized as a tree. + * A nested state has a path of ancestors to the root of the tree. + * When a state is being activated, each element in the path is wrapped as a [[PathNode]]. + * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated. + * + * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path. + */ +var ResolveContext = /** @class */ (function () { + function ResolveContext(_path) { + this._path = _path; + } + /** Gets all the tokens found in the resolve context, de-duplicated */ + ResolveContext.prototype.getTokens = function () { + return this._path.reduce(function (acc, node) { return acc.concat(node.resolvables.map(function (r) { return r.token; })); }, []).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.uniqR, []); + }; + /** + * Gets the Resolvable that matches the token + * + * Gets the last Resolvable that matches the token in this context, or undefined. + * Throws an error if it doesn't exist in the ResolveContext + */ + ResolveContext.prototype.getResolvable = function (token) { + var matching = this._path + .map(function (node) { return node.resolvables; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(function (r) { return r.token === token; }); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(matching); + }; + /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */ + ResolveContext.prototype.getPolicy = function (resolvable) { + var node = this.findNode(resolvable); + return resolvable.getPolicy(node.state); + }; + /** + * Returns a ResolveContext that includes a portion of this one + * + * Given a state, this method creates a new ResolveContext from this one. + * The new context starts at the first node (root) and stops at the node for the `state` parameter. + * + * #### Why + * + * When a transition is created, the nodes in the "To Path" are injected from a ResolveContext. + * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables. + * The "To State" can inject values from its own resolvables, as well as those from all its ancestor state's (node's). + * This method is used to create a narrower context when injecting ancestor nodes. + * + * @example + * `let ABCD = new ResolveContext([A, B, C, D]);` + * + * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`: + * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`. + * However, `B` should only be able to access resolvables from `A`, `B`. + * + * When resolving for the `B` node, first take the full "To Path" Context `[A,B,C,D]` and limit to the subpath `[A,B]`. + * `let AB = ABCD.subcontext(a)` + */ + ResolveContext.prototype.subContext = function (state) { + return new ResolveContext(_path_pathUtils__WEBPACK_IMPORTED_MODULE_6__.PathUtils.subPath(this._path, function (node) { return node.state === state; })); + }; + /** + * Adds Resolvables to the node that matches the state + * + * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block). + * The resolvable is added to the node matching the `state` parameter. + * + * These new resolvables are not automatically fetched. + * The calling code should either fetch them, fetch something that depends on them, + * or rely on [[resolvePath]] being called when some state is being entered. + * + * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default. + * + * @param newResolvables the new Resolvables + * @param state Used to find the node to put the resolvable on + */ + ResolveContext.prototype.addResolvables = function (newResolvables, state) { + var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this._path, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('state', state)); + var keys = newResolvables.map(function (r) { return r.token; }); + node.resolvables = node.resolvables.filter(function (r) { return keys.indexOf(r.token) === -1; }).concat(newResolvables); + }; + /** + * Returns a promise for an array of resolved path Element promises + * + * @param when + * @param trans + * @returns {Promise|any} + */ + ResolveContext.prototype.resolvePath = function (when, trans) { + var _this = this; + if (when === void 0) { when = 'LAZY'; } + // This option determines which 'when' policy Resolvables we are about to fetch. + var whenOption = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(ALL_WHENS, when) ? when : 'LAZY'; + // If the caller specified EAGER, only the EAGER Resolvables are fetched. + // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.` + var matchedWhens = whenOption === _interface__WEBPACK_IMPORTED_MODULE_4__.resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS; + // get the subpath to the state argument, if provided + _common_trace__WEBPACK_IMPORTED_MODULE_2__.trace.traceResolvePath(this._path, when, trans); + var matchesPolicy = function (acceptedVals, whenOrAsync) { return function (resolvable) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(acceptedVals, _this.getPolicy(resolvable)[whenOrAsync]); + }; }; + // Trigger all the (matching) Resolvables in the path + // Reduce all the "WAIT" Resolvables into an array + var promises = this._path.reduce(function (acc, node) { + var nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when')); + var nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async')); + var wait = nodeResolvables.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.not)(matchesPolicy(['NOWAIT'], 'async'))); + // For the matching Resolvables, start their async fetch process. + var subContext = _this.subContext(node.state); + var getResult = function (r) { + return r + .get(subContext, trans) + // Return a tuple that includes the Resolvable's token + .then(function (value) { return ({ token: r.token, value: value }); }); + }; + nowait.forEach(getResult); + return acc.concat(wait.map(getResult)); + }, []); + // Wait for all the "WAIT" resolvables + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.all(promises); + }; + ResolveContext.prototype.injector = function () { + return this._injector || (this._injector = new UIInjectorImpl(this)); + }; + ResolveContext.prototype.findNode = function (resolvable) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this._path, function (node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(node.resolvables, resolvable); }); + }; + /** + * Gets the async dependencies of a Resolvable + * + * Given a Resolvable, returns its dependencies as a Resolvable[] + */ + ResolveContext.prototype.getDependencies = function (resolvable) { + var _this = this; + var node = this.findNode(resolvable); + // Find which other resolvables are "visible" to the `resolvable` argument + // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path) + var subPath = _path_pathUtils__WEBPACK_IMPORTED_MODULE_6__.PathUtils.subPath(this._path, function (x) { return x === node; }) || this._path; + var availableResolvables = subPath + .reduce(function (acc, _node) { return acc.concat(_node.resolvables); }, []) // all of subpath's resolvables + .filter(function (res) { return res !== resolvable; }); // filter out the `resolvable` argument + var getDependency = function (token) { + var matching = availableResolvables.filter(function (r) { return r.token === token; }); + if (matching.length) + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(matching); + var fromInjector = _this.injector().getNative(token); + if ((0,_common__WEBPACK_IMPORTED_MODULE_8__.isUndefined)(fromInjector)) { + throw new Error('Could not find Dependency Injection token: ' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_7__.stringify)(token)); + } + return new _resolvable__WEBPACK_IMPORTED_MODULE_5__.Resolvable(token, function () { return fromInjector; }, [], fromInjector); + }; + return resolvable.deps.map(getDependency); + }; + return ResolveContext; +}()); + +/** @internal */ +var UIInjectorImpl = /** @class */ (function () { + function UIInjectorImpl(context) { + this.context = context; + this.native = this.get(NATIVE_INJECTOR_TOKEN) || _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector; + } + UIInjectorImpl.prototype.get = function (token) { + var resolvable = this.context.getResolvable(token); + if (resolvable) { + if (this.context.getPolicy(resolvable).async === 'NOWAIT') { + return resolvable.get(this.context); + } + if (!resolvable.resolved) { + throw new Error('Resolvable async .get() not complete:' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_7__.stringify)(resolvable.token)); + } + return resolvable.data; + } + return this.getNative(token); + }; + UIInjectorImpl.prototype.getAsync = function (token) { + var resolvable = this.context.getResolvable(token); + if (resolvable) + return resolvable.get(this.context); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(this.native.get(token)); + }; + UIInjectorImpl.prototype.getNative = function (token) { + return this.native && this.native.get(token); + }; + return UIInjectorImpl; +}()); +//# sourceMappingURL=resolveContext.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/router.js": +/*!*******************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/router.js ***! + \*******************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UIRouter": () => (/* binding */ UIRouter) +/* harmony export */ }); +/* harmony import */ var _url_urlMatcherFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./url/urlMatcherFactory */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js"); +/* harmony import */ var _url_urlRouter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./url/urlRouter */ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js"); +/* harmony import */ var _transition_transitionService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./transition/transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); +/* harmony import */ var _view_view__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./view/view */ "./node_modules/@uirouter/core/lib-esm/view/view.js"); +/* harmony import */ var _state_stateRegistry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./state/stateRegistry */ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js"); +/* harmony import */ var _state_stateService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./state/stateService */ "./node_modules/@uirouter/core/lib-esm/state/stateService.js"); +/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./globals */ "./node_modules/@uirouter/core/lib-esm/globals.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _url_urlService__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./url/urlService */ "./node_modules/@uirouter/core/lib-esm/url/urlService.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + + + + + + + +/** @internal */ +var _routerInstance = 0; +/** @internal */ +var locSvcFns = ['url', 'path', 'search', 'hash', 'onChange']; +/** @internal */ +var locCfgFns = ['port', 'protocol', 'host', 'baseHref', 'html5Mode', 'hashPrefix']; +/** @internal */ +var locationServiceStub = (0,_common__WEBPACK_IMPORTED_MODULE_11__.makeStub)('LocationServices', locSvcFns); +/** @internal */ +var locationConfigStub = (0,_common__WEBPACK_IMPORTED_MODULE_11__.makeStub)('LocationConfig', locCfgFns); +/** + * An instance of UI-Router. + * + * This object contains references to service APIs which define your application's routing behavior. + */ +var UIRouter = /** @class */ (function () { + /** + * Creates a new `UIRouter` object + * + * @param locationService a [[LocationServices]] implementation + * @param locationConfig a [[LocationConfig]] implementation + * @internal + */ + function UIRouter(locationService, locationConfig) { + if (locationService === void 0) { locationService = locationServiceStub; } + if (locationConfig === void 0) { locationConfig = locationConfigStub; } + this.locationService = locationService; + this.locationConfig = locationConfig; + /** @internal */ this.$id = _routerInstance++; + /** @internal */ this._disposed = false; + /** @internal */ this._disposables = []; + /** Enable/disable tracing to the javascript console */ + this.trace = _common_trace__WEBPACK_IMPORTED_MODULE_10__.trace; + /** Provides services related to ui-view synchronization */ + this.viewService = new _view_view__WEBPACK_IMPORTED_MODULE_3__.ViewService(this); + /** An object that contains global router state, such as the current state and params */ + this.globals = new _globals__WEBPACK_IMPORTED_MODULE_6__.UIRouterGlobals(); + /** A service that exposes global Transition Hooks */ + this.transitionService = new _transition_transitionService__WEBPACK_IMPORTED_MODULE_2__.TransitionService(this); + /** + * Deprecated for public use. Use [[urlService]] instead. + * @deprecated Use [[urlService]] instead + */ + this.urlMatcherFactory = new _url_urlMatcherFactory__WEBPACK_IMPORTED_MODULE_0__.UrlMatcherFactory(this); + /** + * Deprecated for public use. Use [[urlService]] instead. + * @deprecated Use [[urlService]] instead + */ + this.urlRouter = new _url_urlRouter__WEBPACK_IMPORTED_MODULE_1__.UrlRouter(this); + /** Provides services related to the URL */ + this.urlService = new _url_urlService__WEBPACK_IMPORTED_MODULE_9__.UrlService(this); + /** Provides a registry for states, and related registration services */ + this.stateRegistry = new _state_stateRegistry__WEBPACK_IMPORTED_MODULE_4__.StateRegistry(this); + /** Provides services related to states */ + this.stateService = new _state_stateService__WEBPACK_IMPORTED_MODULE_5__.StateService(this); + /** @internal plugin instances are registered here */ + this._plugins = {}; + this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()); + this.globals.$current = this.stateRegistry.root(); + this.globals.current = this.globals.$current.self; + this.disposable(this.globals); + this.disposable(this.stateService); + this.disposable(this.stateRegistry); + this.disposable(this.transitionService); + this.disposable(this.urlService); + this.disposable(locationService); + this.disposable(locationConfig); + } + /** Registers an object to be notified when the router is disposed */ + UIRouter.prototype.disposable = function (disposable) { + this._disposables.push(disposable); + }; + /** + * Disposes this router instance + * + * When called, clears resources retained by the router by calling `dispose(this)` on all + * registered [[disposable]] objects. + * + * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only. + * + * @internal + * @param disposable (optional) the disposable to dispose + */ + UIRouter.prototype.dispose = function (disposable) { + var _this = this; + if (disposable && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_8__.isFunction)(disposable.dispose)) { + disposable.dispose(this); + return undefined; + } + this._disposed = true; + this._disposables.slice().forEach(function (d) { + try { + typeof d.dispose === 'function' && d.dispose(_this); + (0,_common_common__WEBPACK_IMPORTED_MODULE_7__.removeFrom)(_this._disposables, d); + } + catch (ignored) { } + }); + }; + /** + * Adds a plugin to UI-Router + * + * This method adds a UI-Router Plugin. + * A plugin can enhance or change UI-Router behavior using any public API. + * + * #### Example: + * ```js + * import { MyCoolPlugin } from "ui-router-cool-plugin"; + * + * var plugin = router.addPlugin(MyCoolPlugin); + * ``` + * + * ### Plugin authoring + * + * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object. + * + * The plugin can implement its functionality using any of the public APIs of [[UIRouter]]. + * For example, it may configure router options or add a Transition Hook. + * + * The plugin can then be published as a separate module. + * + * #### Example: + * ```js + * export class MyAuthPlugin implements UIRouterPlugin { + * constructor(router: UIRouter, options: any) { + * this.name = "MyAuthPlugin"; + * let $transitions = router.transitionService; + * let $state = router.stateService; + * + * let authCriteria = { + * to: (state) => state.data && state.data.requiresAuth + * }; + * + * function authHook(transition: Transition) { + * let authService = transition.injector().get('AuthService'); + * if (!authService.isAuthenticated()) { + * return $state.target('login'); + * } + * } + * + * $transitions.onStart(authCriteria, authHook); + * } + * } + * ``` + * + * @param plugin one of: + * - a plugin class which implements [[UIRouterPlugin]] + * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance + * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance + * @param options options to pass to the plugin class/factory + * @returns the registered plugin instance + */ + UIRouter.prototype.plugin = function (plugin, options) { + if (options === void 0) { options = {}; } + var pluginInstance = new plugin(this, options); + if (!pluginInstance.name) + throw new Error('Required property `name` missing on plugin: ' + pluginInstance); + this._disposables.push(pluginInstance); + return (this._plugins[pluginInstance.name] = pluginInstance); + }; + UIRouter.prototype.getPlugin = function (pluginName) { + return pluginName ? this._plugins[pluginName] : (0,_common_common__WEBPACK_IMPORTED_MODULE_7__.values)(this._plugins); + }; + return UIRouter; +}()); + +//# sourceMappingURL=router.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/index.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateBuilder": () => (/* reexport safe */ _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.StateBuilder), +/* harmony export */ "resolvablesBuilder": () => (/* reexport safe */ _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.resolvablesBuilder), +/* harmony export */ "StateObject": () => (/* reexport safe */ _stateObject__WEBPACK_IMPORTED_MODULE_2__.StateObject), +/* harmony export */ "StateMatcher": () => (/* reexport safe */ _stateMatcher__WEBPACK_IMPORTED_MODULE_3__.StateMatcher), +/* harmony export */ "StateQueueManager": () => (/* reexport safe */ _stateQueueManager__WEBPACK_IMPORTED_MODULE_4__.StateQueueManager), +/* harmony export */ "StateRegistry": () => (/* reexport safe */ _stateRegistry__WEBPACK_IMPORTED_MODULE_5__.StateRegistry), +/* harmony export */ "StateService": () => (/* reexport safe */ _stateService__WEBPACK_IMPORTED_MODULE_6__.StateService), +/* harmony export */ "TargetState": () => (/* reexport safe */ _targetState__WEBPACK_IMPORTED_MODULE_7__.TargetState) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/state/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _stateBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateBuilder */ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js"); +/* harmony import */ var _stateObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); +/* harmony import */ var _stateMatcher__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateMatcher */ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js"); +/* harmony import */ var _stateQueueManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateQueueManager */ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js"); +/* harmony import */ var _stateRegistry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stateRegistry */ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js"); +/* harmony import */ var _stateService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./stateService */ "./node_modules/@uirouter/core/lib-esm/state/stateService.js"); +/* harmony import */ var _targetState__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); +/** + * # The state subsystem + * + * This subsystem implements the ui-router state tree + * + * - The [[StateService]] has state-related service methods such as: + * - [[StateService.get]]: Get a registered [[StateDeclaration]] object + * - [[StateService.go]]: Transition from the current state to a new state + * - [[StateService.reload]]: Reload the current state + * - [[StateService.target]]: Get a [[TargetState]] (useful when redirecting from a Transition Hook) + * - [[StateService.onInvalid]]: Register a callback for when a transition to an invalid state is started + * - [[StateService.defaultErrorHandler]]: Register a global callback for when a transition errors + * - The [[StateDeclaration]] interface defines the shape of a state declaration + * - The [[StateRegistry]] contains all the registered states + * - States can be added/removed using the [[StateRegistry.register]] and [[StateRegistry.deregister]] + * - Note: Bootstrap state registration differs by front-end framework. + * - Get notified of state registration/deregistration using [[StateRegistry.onStatesChanged]]. + * + * @packageDocumentation + */ + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/interface.js": +/*!****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/interface.js ***! + \****************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "resolvablesBuilder": () => (/* binding */ resolvablesBuilder), +/* harmony export */ "StateBuilder": () => (/* binding */ StateBuilder) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../resolve/resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + + + + + + +var parseUrl = function (url) { + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(url)) + return false; + var root = url.charAt(0) === '^'; + return { val: root ? url.substring(1) : url, root: root }; +}; +function nameBuilder(state) { + return state.name; +} +function selfBuilder(state) { + state.self.$$state = function () { return state; }; + return state.self; +} +function dataBuilder(state) { + if (state.parent && state.parent.data) { + state.data = state.self.data = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(state.parent.data, state.data); + } + return state.data; +} +var getUrlBuilder = function ($urlMatcherFactoryProvider, root) { + return function urlBuilder(stateObject) { + var stateDec = stateObject.self; + // For future states, i.e., states whose name ends with `.**`, + // match anything that starts with the url prefix + if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\.\*\*$/)) { + var newStateDec = {}; + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.copy)(stateDec, newStateDec); + newStateDec.url += '{remainder:any}'; // match any path (.*) + stateDec = newStateDec; + } + var parent = stateObject.parent; + var parsed = parseUrl(stateDec.url); + var url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, { state: stateDec }); + if (!url) + return null; + if (!$urlMatcherFactoryProvider.isMatcher(url)) + throw new Error("Invalid url '" + url + "' in state '" + stateObject + "'"); + return parsed && parsed.root ? url : ((parent && parent.navigable) || root()).url.append(url); + }; +}; +var getNavigableBuilder = function (isRoot) { + return function navigableBuilder(state) { + return !isRoot(state) && state.url ? state : state.parent ? state.parent.navigable : null; + }; +}; +var getParamsBuilder = function (paramFactory) { + return function paramsBuilder(state) { + var makeConfigParam = function (config, id) { return paramFactory.fromConfig(id, null, state.self); }; + var urlParams = (state.url && state.url.parameters({ inherit: false })) || []; + var nonUrlParams = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.mapObj)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(state.params || {}, urlParams.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('id'))), makeConfigParam)); + return urlParams + .concat(nonUrlParams) + .map(function (p) { return [p.id, p]; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs, {}); + }; +}; +function pathBuilder(state) { + return state.parent ? state.parent.path.concat(state) : /*root*/ [state]; +} +function includesBuilder(state) { + var includes = state.parent ? (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, state.parent.includes) : {}; + includes[state.name] = true; + return includes; +} +/** + * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]]. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * validates the `resolve` property and converts it to a [[Resolvable]] array. + * + * resolve: input value can be: + * + * { + * // analyzed but not injected + * myFooResolve: function() { return "myFooData"; }, + * + * // function.toString() parsed, "DependencyName" dep as string (not min-safe) + * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() }, + * + * // Array split; "DependencyName" dep as string + * myBazResolve: [ "DependencyName", function(dep) { return dep.fetchSomethingAsPromise() }, + * + * // Array split; DependencyType dep as token (compared using ===) + * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() }, + * + * // val.$inject used as deps + * // where: + * // corgeResolve.$inject = ["DependencyName"]; + * // function corgeResolve(dep) { dep.fetchSometingAsPromise() } + * // then "DependencyName" dep as string + * myCorgeResolve: corgeResolve, + * + * // inject service by name + * // When a string is found, desugar creating a resolve that injects the named service + * myGraultResolve: "SomeService" + * } + * + * or: + * + * [ + * new Resolvable("myFooResolve", function() { return "myFooData" }), + * new Resolvable("myBarResolve", function(dep) { return dep.fetchSomethingAsPromise() }, [ "DependencyName" ]), + * { provide: "myBazResolve", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ "DependencyName" ] } + * ] + */ +function resolvablesBuilder(state) { + /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */ + var objects2Tuples = function (resolveObj, resolvePolicies) { + return Object.keys(resolveObj || {}).map(function (token) { return ({ + token: token, + val: resolveObj[token], + deps: undefined, + policy: resolvePolicies[token], + }); }); + }; + /** fetch DI annotations from a function or ng1-style array */ + var annotate = function (fn) { + var $injector = _common_coreservices__WEBPACK_IMPORTED_MODULE_5__.services.$injector; + // ng1 doesn't have an $injector until runtime. + // If the $injector doesn't exist, use "deferred" literal as a + // marker indicating they should be annotated when runtime starts + return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || 'deferred'; + }; + /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */ + var isResolveLiteral = function (obj) { return !!(obj.token && obj.resolveFn); }; + /** true if the object looks like a provide literal, or a ng2 Provider */ + var isLikeNg2Provider = function (obj) { + return !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass)); + }; + /** true if the object looks like a tuple from obj2Tuples */ + var isTupleFromObj = function (obj) { + return !!(obj && obj.val && ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(obj.val) || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(obj.val) || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction)(obj.val))); + }; + /** extracts the token from a Provider or provide literal */ + var getToken = function (p) { return p.provide || p.token; }; + // prettier-ignore: Given a literal resolve or provider object, returns a Resolvable + var literal2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('resolveFn'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), p.resolveFn, p.deps, p.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useFactory'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), p.useFactory, p.deps || p.dependencies, p.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useClass'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), function () { return new p.useClass(); }, [], p.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useValue'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), function () { return p.useValue; }, [], p.policy, p.useValue); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useExisting'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, [p.useExisting], p.policy); }], + ]); + // prettier-ignore + var tuple2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, [tuple.val], tuple.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(tuple.val), tuple.val.slice(0, -1), tuple.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy); }], + ]); + // prettier-ignore + var item2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable), function (r) { return r; }], + [isResolveLiteral, literal2Resolvable], + [isLikeNg2Provider, literal2Resolvable], + [isTupleFromObj, tuple2Resolvable], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.val)(true), function (obj) { throw new Error('Invalid resolve value: ' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(obj)); },], + ]); + // If resolveBlock is already an array, use it as-is. + // Otherwise, assume it's an object and convert to an Array of tuples + var decl = state.resolve; + var items = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {}); + return items.map(item2Resolvable); +} +/** + * A internal global service + * + * StateBuilder is a factory for the internal [[StateObject]] objects. + * + * When you register a state with the [[StateRegistry]], you register a plain old javascript object which + * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding + * [[StateObject]] object, which has an API and is used internally. + * + * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function + * using the [[builder]] method. + */ +var StateBuilder = /** @class */ (function () { + function StateBuilder(matcher, urlMatcherFactory) { + this.matcher = matcher; + var self = this; + var root = function () { return matcher.find(''); }; + var isRoot = function (state) { return state.name === ''; }; + function parentBuilder(state) { + if (isRoot(state)) + return null; + return matcher.find(self.parentName(state)) || root(); + } + this.builders = { + name: [nameBuilder], + self: [selfBuilder], + parent: [parentBuilder], + data: [dataBuilder], + // Build a URLMatcher if necessary, either via a relative or absolute URL + url: [getUrlBuilder(urlMatcherFactory, root)], + // Keep track of the closest ancestor state that has a URL (i.e. is navigable) + navigable: [getNavigableBuilder(isRoot)], + params: [getParamsBuilder(urlMatcherFactory.paramFactory)], + // Each framework-specific ui-router implementation should define its own `views` builder + // e.g., src/ng1/statebuilders/views.ts + views: [], + // Keep a full path from the root down to this state as this is needed for state activation. + path: [pathBuilder], + // Speed up $state.includes() as it's used a lot + includes: [includesBuilder], + resolvables: [resolvablesBuilder], + }; + } + StateBuilder.prototype.builder = function (name, fn) { + var builders = this.builders; + var array = builders[name] || []; + // Backwards compat: if only one builder exists, return it, else return whole arary. + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(name) && !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(fn)) + return array.length > 1 ? array : array[0]; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(name) || !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction)(fn)) + return; + builders[name] = array; + builders[name].push(fn); + return function () { return builders[name].splice(builders[name].indexOf(fn, 1)) && null; }; + }; + /** + * Builds all of the properties on an essentially blank State object, returning a State object which has all its + * properties and API built. + * + * @param state an uninitialized State object + * @returns the built State object + */ + StateBuilder.prototype.build = function (state) { + var _a = this, matcher = _a.matcher, builders = _a.builders; + var parent = this.parentName(state); + if (parent && !matcher.find(parent, undefined, false)) { + return null; + } + for (var key in builders) { + if (!builders.hasOwnProperty(key)) + continue; + var chain = builders[key].reduce(function (parentFn, step) { return function (_state) { return step(_state, parentFn); }; }, _common_common__WEBPACK_IMPORTED_MODULE_0__.noop); + state[key] = chain(state); + } + return state; + }; + StateBuilder.prototype.parentName = function (state) { + // name = 'foo.bar.baz.**' + var name = state.name || ''; + // segments = ['foo', 'bar', 'baz', '.**'] + var segments = name.split('.'); + // segments = ['foo', 'bar', 'baz'] + var lastSegment = segments.pop(); + // segments = ['foo', 'bar'] (ignore .** segment for future states) + if (lastSegment === '**') + segments.pop(); + if (segments.length) { + if (state.parent) { + throw new Error("States that specify the 'parent:' property should not have a '.' in their name (" + name + ")"); + } + // 'foo.bar' + return segments.join('.'); + } + if (!state.parent) + return ''; + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(state.parent) ? state.parent : state.parent.name; + }; + StateBuilder.prototype.name = function (state) { + var name = state.name; + if (name.indexOf('.') !== -1 || !state.parent) + return name; + var parentName = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(state.parent) ? state.parent : state.parent.name; + return parentName ? parentName + '.' + name : name; + }; + return StateBuilder; +}()); + +//# sourceMappingURL=stateBuilder.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateMatcher": () => (/* binding */ StateMatcher) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_safeConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/safeConsole */ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js"); + + + +var StateMatcher = /** @class */ (function () { + function StateMatcher(_states) { + this._states = _states; + } + StateMatcher.prototype.isRelative = function (stateName) { + stateName = stateName || ''; + return stateName.indexOf('.') === 0 || stateName.indexOf('^') === 0; + }; + StateMatcher.prototype.find = function (stateOrName, base, matchGlob) { + if (matchGlob === void 0) { matchGlob = true; } + if (!stateOrName && stateOrName !== '') + return undefined; + var isStr = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(stateOrName); + var name = isStr ? stateOrName : stateOrName.name; + if (this.isRelative(name)) + name = this.resolvePath(name, base); + var state = this._states[name]; + if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) { + return state; + } + else if (isStr && matchGlob) { + var _states = (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.values)(this._states); + var matches = _states.filter(function (_state) { return _state.__stateObjectCache.nameGlob && _state.__stateObjectCache.nameGlob.matches(name); }); + if (matches.length > 1) { + _common_safeConsole__WEBPACK_IMPORTED_MODULE_2__.safeConsole.error("stateMatcher.find: Found multiple matches for " + name + " using glob: ", matches.map(function (match) { return match.name; })); + } + return matches[0]; + } + return undefined; + }; + StateMatcher.prototype.resolvePath = function (name, base) { + if (!base) + throw new Error("No reference point given for path '" + name + "'"); + var baseState = this.find(base); + var splitName = name.split('.'); + var pathLength = splitName.length; + var i = 0, current = baseState; + for (; i < pathLength; i++) { + if (splitName[i] === '' && i === 0) { + current = baseState; + continue; + } + if (splitName[i] === '^') { + if (!current.parent) + throw new Error("Path '" + name + "' not valid for state '" + baseState.name + "'"); + current = current.parent; + continue; + } + break; + } + var relName = splitName.slice(i).join('.'); + return current.name + (current.name && relName ? '.' : '') + relName; + }; + return StateMatcher; +}()); + +//# sourceMappingURL=stateMatcher.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateObject.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateObject": () => (/* binding */ StateObject) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_glob__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + + + + +/** + * Internal representation of a UI-Router state. + * + * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]]. + * + * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object. + * + * This class prototypally inherits from the corresponding [[StateDeclaration]]. + * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]]. + */ +var StateObject = /** @class */ (function () { + /** @deprecated use State.create() */ + function StateObject(config) { + return StateObject.create(config || {}); + } + /** + * Create a state object to put the private/internal implementation details onto. + * The object's prototype chain looks like: + * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...) + * + * @param stateDecl the user-supplied State Declaration + * @returns {StateObject} an internal State object + */ + StateObject.create = function (stateDecl) { + stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl; + var state = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(stateDecl, StateObject.prototype)); + stateDecl.$$state = function () { return state; }; + state.self = stateDecl; + state.__stateObjectCache = { + nameGlob: _common_glob__WEBPACK_IMPORTED_MODULE_2__.Glob.fromString(state.name), + }; + return state; + }; + /** + * Returns true if the provided parameter is the same state. + * + * Compares the identity of the state against the passed value, which is either an object + * reference to the actual `State` instance, the original definition object passed to + * `$stateProvider.state()`, or the fully-qualified name. + * + * @param ref Can be one of (a) a `State` instance, (b) an object that was passed + * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string. + * @returns Returns `true` if `ref` matches the current `State` instance. + */ + StateObject.prototype.is = function (ref) { + return this === ref || this.self === ref || this.fqn() === ref; + }; + /** + * @deprecated this does not properly handle dot notation + * @returns Returns a dot-separated name of the state. + */ + StateObject.prototype.fqn = function () { + if (!this.parent || !(this.parent instanceof this.constructor)) + return this.name; + var name = this.parent.fqn(); + return name ? name + '.' + this.name : this.name; + }; + /** + * Returns the root node of this state's tree. + * + * @returns The root of this state's tree. + */ + StateObject.prototype.root = function () { + return (this.parent && this.parent.root()) || this; + }; + /** + * Gets the state's `Param` objects + * + * Gets the list of [[Param]] objects owned by the state. + * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects. + * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object + * + * @param opts options + */ + StateObject.prototype.parameters = function (opts) { + opts = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(opts, { inherit: true, matchingKeys: null }); + var inherited = (opts.inherit && this.parent && this.parent.parameters()) || []; + return inherited + .concat((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.params)) + .filter(function (param) { return !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id); }); + }; + /** + * Returns a single [[Param]] that is owned by the state + * + * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s. + * @param id the name of the [[Param]] to return + * @param opts options + */ + StateObject.prototype.parameter = function (id, opts) { + if (opts === void 0) { opts = {}; } + return ((this.url && this.url.parameter(id, opts)) || + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.params), (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', id)) || + (opts.inherit && this.parent && this.parent.parameter(id))); + }; + StateObject.prototype.toString = function () { + return this.fqn(); + }; + /** Predicate which returns true if the object is an class with @State() decorator */ + StateObject.isStateClass = function (stateDecl) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isFunction)(stateDecl) && stateDecl['__uiRouterState'] === true; + }; + /** Predicate which returns true if the object is a [[StateDeclaration]] object */ + StateObject.isStateDeclaration = function (obj) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isFunction)(obj['$$state']); }; + /** Predicate which returns true if the object is an internal [[StateObject]] object */ + StateObject.isState = function (obj) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isObject)(obj['__stateObjectCache']); }; + return StateObject; +}()); + +//# sourceMappingURL=stateObject.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateQueueManager": () => (/* binding */ StateQueueManager) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _stateObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); + + +var StateQueueManager = /** @class */ (function () { + function StateQueueManager(router, states, builder, listeners) { + this.router = router; + this.states = states; + this.builder = builder; + this.listeners = listeners; + this.queue = []; + } + StateQueueManager.prototype.dispose = function () { + this.queue = []; + }; + StateQueueManager.prototype.register = function (stateDecl) { + var queue = this.queue; + var state = _stateObject__WEBPACK_IMPORTED_MODULE_1__.StateObject.create(stateDecl); + var name = state.name; + if (!(0,_common__WEBPACK_IMPORTED_MODULE_0__.isString)(name)) + throw new Error('State must have a valid name'); + if (this.states.hasOwnProperty(name) || (0,_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(queue.map((0,_common__WEBPACK_IMPORTED_MODULE_0__.prop)('name')), name)) + throw new Error("State '" + name + "' is already defined"); + queue.push(state); + this.flush(); + return state; + }; + StateQueueManager.prototype.flush = function () { + var _this = this; + var _a = this, queue = _a.queue, states = _a.states, builder = _a.builder; + var registered = [], // states that got registered + orphans = [], // states that don't yet have a parent registered + previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered + var getState = function (name) { return _this.states.hasOwnProperty(name) && _this.states[name]; }; + var notifyListeners = function () { + if (registered.length) { + _this.listeners.forEach(function (listener) { + return listener('registered', registered.map(function (s) { return s.self; })); + }); + } + }; + while (queue.length > 0) { + var state = queue.shift(); + var name_1 = state.name; + var result = builder.build(state); + var orphanIdx = orphans.indexOf(state); + if (result) { + var existingState = getState(name_1); + if (existingState && existingState.name === name_1) { + throw new Error("State '" + name_1 + "' is already defined"); + } + var existingFutureState = getState(name_1 + '.**'); + if (existingFutureState) { + // Remove future state of the same name + this.router.stateRegistry.deregister(existingFutureState); + } + states[name_1] = state; + this.attachRoute(state); + if (orphanIdx >= 0) + orphans.splice(orphanIdx, 1); + registered.push(state); + continue; + } + var prev = previousQueueLength[name_1]; + previousQueueLength[name_1] = queue.length; + if (orphanIdx >= 0 && prev === queue.length) { + // Wait until two consecutive iterations where no additional states were dequeued successfully. + // throw new Error(`Cannot register orphaned state '${name}'`); + queue.push(state); + notifyListeners(); + return states; + } + else if (orphanIdx < 0) { + orphans.push(state); + } + queue.push(state); + } + notifyListeners(); + return states; + }; + StateQueueManager.prototype.attachRoute = function (state) { + if (state.abstract || !state.url) + return; + var rulesApi = this.router.urlService.rules; + rulesApi.rule(rulesApi.urlRuleFactory.create(state)); + }; + return StateQueueManager; +}()); + +//# sourceMappingURL=stateQueueManager.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js": +/*!********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateRegistry": () => (/* binding */ StateRegistry) +/* harmony export */ }); +/* harmony import */ var _stateMatcher__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./stateMatcher */ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js"); +/* harmony import */ var _stateBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateBuilder */ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js"); +/* harmony import */ var _stateQueueManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateQueueManager */ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + + + +/** + * A registry for all of the application's [[StateDeclaration]]s + * + * This API is found at `router.stateRegistry` ([[UIRouter.stateRegistry]]) + */ +var StateRegistry = /** @class */ (function () { + /** @internal */ + function StateRegistry(router) { + this.router = router; + this.states = {}; + /** @internal */ + this.listeners = []; + this.matcher = new _stateMatcher__WEBPACK_IMPORTED_MODULE_0__.StateMatcher(this.states); + this.builder = new _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.StateBuilder(this.matcher, router.urlMatcherFactory); + this.stateQueue = new _stateQueueManager__WEBPACK_IMPORTED_MODULE_2__.StateQueueManager(router, this.states, this.builder, this.listeners); + this._registerRoot(); + } + /** @internal */ + StateRegistry.prototype._registerRoot = function () { + var rootStateDef = { + name: '', + url: '^', + views: null, + params: { + '#': { value: null, type: 'hash', dynamic: true }, + }, + abstract: true, + }; + var _root = (this._root = this.stateQueue.register(rootStateDef)); + _root.navigable = null; + }; + /** @internal */ + StateRegistry.prototype.dispose = function () { + var _this = this; + this.stateQueue.dispose(); + this.listeners = []; + this.get().forEach(function (state) { return _this.get(state) && _this.deregister(state); }); + }; + /** + * Listen for a State Registry events + * + * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry. + * + * #### Example: + * ```js + * let allStates = registry.get(); + * + * // Later, invoke deregisterFn() to remove the listener + * let deregisterFn = registry.onStatesChanged((event, states) => { + * switch(event) { + * case: 'registered': + * states.forEach(state => allStates.push(state)); + * break; + * case: 'deregistered': + * states.forEach(state => { + * let idx = allStates.indexOf(state); + * if (idx !== -1) allStates.splice(idx, 1); + * }); + * break; + * } + * }); + * ``` + * + * @param listener a callback function invoked when the registered states changes. + * The function receives two parameters, `event` and `state`. + * See [[StateRegistryListener]] + * @return a function that deregisters the listener + */ + StateRegistry.prototype.onStatesChanged = function (listener) { + this.listeners.push(listener); + return function deregisterListener() { + (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.removeFrom)(this.listeners)(listener); + }.bind(this); + }; + /** + * Gets the implicit root state + * + * Gets the root of the state tree. + * The root state is implicitly created by UI-Router. + * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]] + * + * @return the root [[StateObject]] + */ + StateRegistry.prototype.root = function () { + return this._root; + }; + /** + * Adds a state to the registry + * + * Registers a [[StateDeclaration]] or queues it for registration. + * + * Note: a state will be queued if the state's parent isn't yet registered. + * + * @param stateDefinition the definition of the state to register. + * @returns the internal [[StateObject]] object. + * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]). + * If the state was only queued, then the object is not fully built. + */ + StateRegistry.prototype.register = function (stateDefinition) { + return this.stateQueue.register(stateDefinition); + }; + /** @internal */ + StateRegistry.prototype._deregisterTree = function (state) { + var _this = this; + var all = this.get().map(function (s) { return s.$$state(); }); + var getChildren = function (states) { + var _children = all.filter(function (s) { return states.indexOf(s.parent) !== -1; }); + return _children.length === 0 ? _children : _children.concat(getChildren(_children)); + }; + var children = getChildren([state]); + var deregistered = [state].concat(children).reverse(); + deregistered.forEach(function (_state) { + var rulesApi = _this.router.urlService.rules; + // Remove URL rule + rulesApi + .rules() + .filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.propEq)('state', _state)) + .forEach(function (rule) { return rulesApi.removeRule(rule); }); + // Remove state from registry + delete _this.states[_state.name]; + }); + return deregistered; + }; + /** + * Removes a state from the registry + * + * This removes a state from the registry. + * If the state has children, they are are also removed from the registry. + * + * @param stateOrName the state's name or object representation + * @returns {StateObject[]} a list of removed states + */ + StateRegistry.prototype.deregister = function (stateOrName) { + var _state = this.get(stateOrName); + if (!_state) + throw new Error("Can't deregister state; not found: " + stateOrName); + var deregisteredStates = this._deregisterTree(_state.$$state()); + this.listeners.forEach(function (listener) { + return listener('deregistered', deregisteredStates.map(function (s) { return s.self; })); + }); + return deregisteredStates; + }; + StateRegistry.prototype.get = function (stateOrName, base) { + var _this = this; + if (arguments.length === 0) + return Object.keys(this.states).map(function (name) { return _this.states[name].self; }); + var found = this.matcher.find(stateOrName, base); + return (found && found.self) || null; + }; + /** + * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`). + * More than one BuilderFunction can be registered for a given property. + * + * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects. + * + * @param property The name of the State property being registered for. + * @param builderFunction The BuilderFunction which will be used to build the State property + * @returns a function which deregisters the BuilderFunction + */ + StateRegistry.prototype.decorator = function (property, builderFunction) { + return this.builder.builder(property, builderFunction); + }; + return StateRegistry; +}()); + +//# sourceMappingURL=stateRegistry.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateService.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateService.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateService": () => (/* binding */ StateService) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_queue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); +/* harmony import */ var _path_pathNode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../path/pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); +/* harmony import */ var _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../transition/transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); +/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _targetState__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _common_glob__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../common/glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); +/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); +/* harmony import */ var _hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../hooks/lazyLoad */ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + + + + + + + + + + + + +/** + * Provides services related to ui-router states. + * + * This API is located at `router.stateService` ([[UIRouter.stateService]]) + */ +var StateService = /** @class */ (function () { + /** @internal */ + function StateService(/** @internal */ router) { + this.router = router; + /** @internal */ + this.invalidCallbacks = []; + /** @internal */ + this._defaultErrorHandler = function $defaultErrorHandler($error$) { + if ($error$ instanceof Error && $error$.stack) { + console.error($error$); + console.error($error$.stack); + } + else if ($error$ instanceof _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection) { + console.error($error$.toString()); + if ($error$.detail && $error$.detail.stack) + console.error($error$.detail.stack); + } + else { + console.error($error$); + } + }; + var getters = ['current', '$current', 'params', 'transition']; + var boundFns = Object.keys(StateService.prototype).filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.not)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(getters))); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)((0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.val)(StateService.prototype), this, (0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.val)(this), boundFns); + } + Object.defineProperty(StateService.prototype, "transition", { + /** + * The [[Transition]] currently in progress (or null) + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.transition]] + */ + get: function () { + return this.router.globals.transition; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(StateService.prototype, "params", { + /** + * The latest successful state parameters + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.params]] + */ + get: function () { + return this.router.globals.params; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(StateService.prototype, "current", { + /** + * The current [[StateDeclaration]] + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.current]] + */ + get: function () { + return this.router.globals.current; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(StateService.prototype, "$current", { + /** + * The current [[StateObject]] (an internal API) + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.$current]] + */ + get: function () { + return this.router.globals.$current; + }, + enumerable: false, + configurable: true + }); + /** @internal */ + StateService.prototype.dispose = function () { + this.defaultErrorHandler(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); + this.invalidCallbacks = []; + }; + /** + * Handler for when [[transitionTo]] is called with an invalid state. + * + * Invokes the [[onInvalid]] callbacks, in natural order. + * Each callback's return value is checked in sequence until one of them returns an instance of TargetState. + * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises. + * + * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned. + * + * @internal + */ + StateService.prototype._handleInvalidTargetState = function (fromPath, toState) { + var _this = this; + var fromState = _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__.PathUtils.makeTargetState(this.router.stateRegistry, fromPath); + var globals = this.router.globals; + var latestThing = function () { return globals.transitionHistory.peekTail(); }; + var latest = latestThing(); + var callbackQueue = new _common_queue__WEBPACK_IMPORTED_MODULE_2__.Queue(this.invalidCallbacks.slice()); + var injector = new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_11__.ResolveContext(fromPath).injector(); + var checkForRedirect = function (result) { + if (!(result instanceof _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState)) { + return; + } + var target = result; + // Recreate the TargetState, in case the state is now defined. + target = _this.target(target.identifier(), target.params(), target.options()); + if (!target.valid()) { + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.invalid(target.error()).toPromise(); + } + if (latestThing() !== latest) { + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.superseded().toPromise(); + } + return _this.transitionTo(target.identifier(), target.params(), target.options()); + }; + function invokeNextCallback() { + var nextCallback = callbackQueue.dequeue(); + if (nextCallback === undefined) + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.invalid(toState.error()).toPromise(); + var callbackResult = _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(nextCallback(toState, fromState, injector)); + return callbackResult.then(checkForRedirect).then(function (result) { return result || invokeNextCallback(); }); + } + return invokeNextCallback(); + }; + /** + * Registers an Invalid State handler + * + * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]] + * has been called with an invalid state reference parameter + * + * Example: + * ```js + * stateService.onInvalid(function(to, from, injector) { + * if (to.name() === 'foo') { + * let lazyLoader = injector.get('LazyLoadService'); + * return lazyLoader.load('foo') + * .then(() => stateService.target('foo')); + * } + * }); + * ``` + * + * @param {function} callback invoked when the toState is invalid + * This function receives the (invalid) toState, the fromState, and an injector. + * The function may optionally return a [[TargetState]] or a Promise for a TargetState. + * If one is returned, it is treated as a redirect. + * + * @returns a function which deregisters the callback + */ + StateService.prototype.onInvalid = function (callback) { + this.invalidCallbacks.push(callback); + return function deregisterListener() { + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(this.invalidCallbacks)(callback); + }.bind(this); + }; + /** + * Reloads the current state + * + * A method that force reloads the current state, or a partial state hierarchy. + * All resolves are re-resolved, and components reinstantiated. + * + * #### Example: + * ```js + * let app angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.reload = function(){ + * $state.reload(); + * } + * }); + * ``` + * + * Note: `reload()` is just an alias for: + * + * ```js + * $state.transitionTo($state.current, $state.params, { + * reload: true, inherit: false + * }); + * ``` + * + * @param reloadState A state name or a state object. + * If present, this state and all its children will be reloaded, but ancestors will not reload. + * + * #### Example: + * ```js + * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item' + * //and current state is 'contacts.detail.item' + * let app angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.reload = function(){ + * //will reload 'contact.detail' and nested 'contact.detail.item' states + * $state.reload('contact.detail'); + * } + * }); + * ``` + * + * @returns A promise representing the state of the new transition. See [[StateService.go]] + */ + StateService.prototype.reload = function (reloadState) { + return this.transitionTo(this.current, this.params, { + reload: (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(reloadState) ? reloadState : true, + inherit: false, + notify: false, + }); + }; + /** + * Transition to a different state and/or parameters + * + * Convenience method for transitioning to a new state. + * + * `$state.go` calls `$state.transitionTo` internally but automatically sets options to + * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`. + * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`). + * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters + * inherit from the current parameter values (because of `inherit: true`). + * + * #### Example: + * ```js + * let app = angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.changeState = function () { + * $state.go('contact.detail'); + * }; + * }); + * ``` + * + * @param to Absolute state name, state object, or relative state path (relative to current state). + * + * Some examples: + * + * - `$state.go('contact.detail')` - will go to the `contact.detail` state + * - `$state.go('^')` - will go to the parent state + * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state + * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state + * + * @param params A map of the parameters that will be sent to the state, will populate $stateParams. + * + * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`). + * This allows, for example, going to a sibling state that shares parameters defined by a parent state. + * + * @param options Transition options + * + * @returns {promise} A promise representing the state of the new transition. + */ + StateService.prototype.go = function (to, params, options) { + var defautGoOpts = { relative: this.$current, inherit: true }; + var transOpts = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, defautGoOpts, _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__.defaultTransOpts); + return this.transitionTo(to, params, transOpts); + }; + /** + * Creates a [[TargetState]] + * + * This is a factory method for creating a TargetState + * + * This may be returned from a Transition Hook to redirect a transition, for example. + */ + StateService.prototype.target = function (identifier, params, options) { + if (options === void 0) { options = {}; } + // If we're reloading, find the state object to reload from + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isObject)(options.reload) && !options.reload.name) + throw new Error('Invalid reload state object'); + var reg = this.router.stateRegistry; + options.reloadState = + options.reload === true ? reg.root() : reg.matcher.find(options.reload, options.relative); + if (options.reload && !options.reloadState) + throw new Error("No such reload state '" + ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(options.reload) ? options.reload : options.reload.name) + "'"); + return new _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState(this.router.stateRegistry, identifier, params, options); + }; + /** @internal */ + StateService.prototype.getCurrentPath = function () { + var _this = this; + var globals = this.router.globals; + var latestSuccess = globals.successfulTransitions.peekTail(); + var rootPath = function () { return [new _path_pathNode__WEBPACK_IMPORTED_MODULE_5__.PathNode(_this.router.stateRegistry.root())]; }; + return latestSuccess ? latestSuccess.treeChanges().to : rootPath(); + }; + /** + * Low-level method for transitioning to a new state. + * + * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations. + * + * #### Example: + * ```js + * let app = angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.changeState = function () { + * $state.transitionTo('contact.detail'); + * }; + * }); + * ``` + * + * @param to State name or state object. + * @param toParams A map of the parameters that will be sent to the state, + * will populate $stateParams. + * @param options Transition options + * + * @returns A promise representing the state of the new transition. See [[go]] + */ + StateService.prototype.transitionTo = function (to, toParams, options) { + var _this = this; + if (toParams === void 0) { toParams = {}; } + if (options === void 0) { options = {}; } + var router = this.router; + var globals = router.globals; + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__.defaultTransOpts); + var getCurrent = function () { return globals.transition; }; + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(options, { current: getCurrent }); + var ref = this.target(to, toParams, options); + var currentPath = this.getCurrentPath(); + if (!ref.exists()) + return this._handleInvalidTargetState(currentPath, ref); + if (!ref.valid()) + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silentRejection)(ref.error()); + if (options.supercede === false && getCurrent()) { + return (_transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.ignored('Another transition is in progress and supercede has been set to false in TransitionOptions for the transition. So the transition was ignored in favour of the existing one in progress.').toPromise()); + } + /** + * Special handling for Ignored, Aborted, and Redirected transitions + * + * The semantics for the transition.run() promise and the StateService.transitionTo() + * promise differ. For instance, the run() promise may be rejected because it was + * IGNORED, but the transitionTo() promise is resolved because from the user perspective + * no error occurred. Likewise, the transition.run() promise may be rejected because of + * a Redirect, but the transitionTo() promise is chained to the new Transition's promise. + */ + var rejectedTransitionHandler = function (trans) { return function (error) { + if (error instanceof _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection) { + var isLatest = router.globals.lastStartedTransitionId <= trans.$id; + if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.IGNORED) { + isLatest && router.urlRouter.update(); + // Consider ignored `Transition.run()` as a successful `transitionTo` + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(globals.current); + } + var detail = error.detail; + if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.SUPERSEDED && error.redirected && detail instanceof _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState) { + // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully + // by returning the promise for the new (redirect) `Transition.run()`. + var redirect = trans.redirect(detail); + return redirect.run().catch(rejectedTransitionHandler(redirect)); + } + if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.ABORTED) { + isLatest && router.urlRouter.update(); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.reject(error); + } + } + var errorHandler = _this.defaultErrorHandler(); + errorHandler(error); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.reject(error); + }; }; + var transition = this.router.transitionService.create(currentPath, ref); + var transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition)); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise)(transitionToPromise); // issue #2676 + // Return a promise for the transition, which also has the transition object on it. + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(transitionToPromise, { transition: transition }); + }; + /** + * Checks if the current state *is* the provided state + * + * Similar to [[includes]] but only checks for the full state name. + * If params is supplied then it will be tested for strict equality against the current + * active params object, so all params must match with none missing and no extras. + * + * #### Example: + * ```js + * $state.$current.name = 'contacts.details.item'; + * + * // absolute name + * $state.is('contact.details.item'); // returns true + * $state.is(contactDetailItemStateObject); // returns true + * ``` + * + * // relative name (. and ^), typically from a template + * // E.g. from the 'contacts.details' template + * ```html + *
    Item
    + * ``` + * + * @param stateOrName The state name (absolute or relative) or state object you'd like to check. + * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like + * to test against the current active state. + * @param options An options object. The options are: + * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will + * test relative to `options.relative` state (or name). + * + * @returns Returns true if it is the state. + */ + StateService.prototype.is = function (stateOrName, params, options) { + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, { relative: this.$current }); + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative); + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) + return undefined; + if (this.$current !== state) + return false; + if (!params) + return true; + var schema = state.parameters({ inherit: true, matchingKeys: params }); + return _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.equals(schema, _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.values(schema, params), this.params); + }; + /** + * Checks if the current state *includes* the provided state + * + * A method to determine if the current active state is equal to or is the child of the + * state stateName. If any params are passed then they will be tested for a match as well. + * Not all the parameters need to be passed, just the ones you'd like to test for equality. + * + * #### Example when `$state.$current.name === 'contacts.details.item'` + * ```js + * // Using partial names + * $state.includes("contacts"); // returns true + * $state.includes("contacts.details"); // returns true + * $state.includes("contacts.details.item"); // returns true + * $state.includes("contacts.list"); // returns false + * $state.includes("about"); // returns false + * ``` + * + * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`: + * ```js + * $state.includes("*.details.*.*"); // returns true + * $state.includes("*.details.**"); // returns true + * $state.includes("**.item.**"); // returns true + * $state.includes("*.details.item.url"); // returns true + * $state.includes("*.details.*.url"); // returns true + * $state.includes("*.details.*"); // returns false + * $state.includes("item.**"); // returns false + * ``` + * + * @param stateOrName A partial name, relative name, glob pattern, + * or state object to be searched for within the current state name. + * @param params A param object, e.g. `{sectionId: section.id}`, + * that you'd like to test against the current active state. + * @param options An options object. The options are: + * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will + * test relative to `options.relative` state (or name). + * + * @returns {boolean} Returns true if it does include the state + */ + StateService.prototype.includes = function (stateOrName, params, options) { + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, { relative: this.$current }); + var glob = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(stateOrName) && _common_glob__WEBPACK_IMPORTED_MODULE_10__.Glob.fromString(stateOrName); + if (glob) { + if (!glob.matches(this.$current.name)) + return false; + stateOrName = this.$current.name; + } + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) + return undefined; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(include[state.name])) + return false; + if (!params) + return true; + var schema = state.parameters({ inherit: true, matchingKeys: params }); + return _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.equals(schema, _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.values(schema, params), this.params); + }; + /** + * Generates a URL for a state and parameters + * + * Returns the url for the given state populated with the given params. + * + * #### Example: + * ```js + * expect($state.href("about.person", { person: "bob" })).toEqual("/about/bob"); + * ``` + * + * @param stateOrName The state name or state object you'd like to generate a url from. + * @param params An object of parameter values to fill the state's required parameters. + * @param options Options object. The options are: + * + * @returns {string} compiled state url + */ + StateService.prototype.href = function (stateOrName, params, options) { + var defaultHrefOpts = { + lossy: true, + inherit: true, + absolute: false, + relative: this.$current, + }; + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, defaultHrefOpts); + params = params || {}; + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative); + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) + return null; + if (options.inherit) + params = this.params.$inherit(params, this.$current, state); + var nav = state && options.lossy ? state.navigable : state; + if (!nav || nav.url === undefined || nav.url === null) { + return null; + } + return this.router.urlRouter.href(nav.url, params, { absolute: options.absolute }); + }; + /** + * Sets or gets the default [[transitionTo]] error handler. + * + * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition. + * This includes errors caused by resolves and transition hooks. + * + * Note: + * This handler does not receive certain Transition rejections. + * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]]. + * + * The built-in default error handler logs the error to the console. + * + * You can provide your own custom handler. + * + * #### Example: + * ```js + * stateService.defaultErrorHandler(function() { + * // Do not log transitionTo errors + * }); + * ``` + * + * @param handler a global error handler function + * @returns the current global error handler + */ + StateService.prototype.defaultErrorHandler = function (handler) { + return (this._defaultErrorHandler = handler || this._defaultErrorHandler); + }; + StateService.prototype.get = function (stateOrName, base) { + var reg = this.router.stateRegistry; + if (arguments.length === 0) + return reg.get(); + return reg.get(stateOrName, base || this.$current); + }; + /** + * Lazy loads a state + * + * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function. + * + * @param stateOrName the state that should be lazy loaded + * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc) + * Note: If no transition is provided, a noop transition is created using the from the current state to the current state. + * This noop transition is not actually run. + * + * @returns a promise to lazy load + */ + StateService.prototype.lazyLoad = function (stateOrName, transition) { + var state = this.get(stateOrName); + if (!state || !state.lazyLoad) + throw new Error('Can not lazy load ' + stateOrName); + var currentPath = this.getCurrentPath(); + var target = _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__.PathUtils.makeTargetState(this.router.stateRegistry, currentPath); + transition = transition || this.router.transitionService.create(currentPath, target); + return (0,_hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_12__.lazyLoadState)(transition, state); + }; + return StateService; +}()); + +//# sourceMappingURL=stateService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/targetState.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/targetState.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TargetState": () => (/* binding */ TargetState) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + +/** + * Encapsulate the target (destination) state/params/options of a [[Transition]]. + * + * This class is frequently used to redirect a transition to a new destination. + * + * See: + * + * - [[HookResult]] + * - [[TransitionHookFn]] + * - [[TransitionService.onStart]] + * + * To create a `TargetState`, use [[StateService.target]]. + * + * --- + * + * This class wraps: + * + * 1) an identifier for a state + * 2) a set of parameters + * 3) and transition options + * 4) the registered state object (the [[StateDeclaration]]) + * + * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can + * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string). + * The `TargetState` class normalizes those options. + * + * A `TargetState` may be valid (the state being targeted exists in the registry) + * or invalid (the state being targeted is not registered). + */ +var TargetState = /** @class */ (function () { + /** + * The TargetState constructor + * + * Note: Do not construct a `TargetState` manually. + * To create a `TargetState`, use the [[StateService.target]] factory method. + * + * @param _stateRegistry The StateRegistry to use to look up the _definition + * @param _identifier An identifier for a state. + * Either a fully-qualified state name, or the object used to define the state. + * @param _params Parameters for the target state + * @param _options Transition options. + * + * @internal + */ + function TargetState(_stateRegistry, _identifier, _params, _options) { + this._stateRegistry = _stateRegistry; + this._identifier = _identifier; + this._identifier = _identifier; + this._params = (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, _params || {}); + this._options = (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, _options || {}); + this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative); + } + /** The name of the state this object targets */ + TargetState.prototype.name = function () { + return (this._definition && this._definition.name) || this._identifier; + }; + /** The identifier used when creating this TargetState */ + TargetState.prototype.identifier = function () { + return this._identifier; + }; + /** The target parameter values */ + TargetState.prototype.params = function () { + return this._params; + }; + /** The internal state object (if it was found) */ + TargetState.prototype.$state = function () { + return this._definition; + }; + /** The internal state declaration (if it was found) */ + TargetState.prototype.state = function () { + return this._definition && this._definition.self; + }; + /** The target options */ + TargetState.prototype.options = function () { + return this._options; + }; + /** True if the target state was found */ + TargetState.prototype.exists = function () { + return !!(this._definition && this._definition.self); + }; + /** True if the object is valid */ + TargetState.prototype.valid = function () { + return !this.error(); + }; + /** If the object is invalid, returns the reason why */ + TargetState.prototype.error = function () { + var base = this.options().relative; + if (!this._definition && !!base) { + var stateName = base.name ? base.name : base; + return "Could not resolve '" + this.name() + "' from state '" + stateName + "'"; + } + if (!this._definition) + return "No such state '" + this.name() + "'"; + if (!this._definition.self) + return "State '" + this.name() + "' has an invalid definition"; + }; + TargetState.prototype.toString = function () { + return "'" + this.name() + "'" + (0,_common_strings__WEBPACK_IMPORTED_MODULE_1__.stringify)(this.params()); + }; + /** + * Returns a copy of this TargetState which targets a different state. + * The new TargetState has the same parameter values and transition options. + * + * @param state The new state that should be targeted + */ + TargetState.prototype.withState = function (state) { + return new TargetState(this._stateRegistry, state, this._params, this._options); + }; + /** + * Returns a copy of this TargetState, using the specified parameter values. + * + * @param params the new parameter values to use + * @param replace When false (default) the new parameter values will be merged with the current values. + * When true the parameter values will be used instead of the current values. + */ + TargetState.prototype.withParams = function (params, replace) { + if (replace === void 0) { replace = false; } + var newParams = replace ? params : (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, this._params, params); + return new TargetState(this._stateRegistry, this._identifier, newParams, this._options); + }; + /** + * Returns a copy of this TargetState, using the specified Transition Options. + * + * @param options the new options to use + * @param replace When false (default) the new options will be merged with the current options. + * When true the options will be used instead of the current options. + */ + TargetState.prototype.withOptions = function (options, replace) { + if (replace === void 0) { replace = false; } + var newOpts = replace ? options : (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, this._options, options); + return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts); + }; + /** Returns true if the object has a state property that might be a state or state name */ + TargetState.isDef = function (obj) { + return obj && obj.state && ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(obj.state) || ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(obj.state) && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(obj.state.name))); + }; + return TargetState; +}()); + +//# sourceMappingURL=targetState.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "HookBuilder": () => (/* binding */ HookBuilder) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); + + + + +/** + * This class returns applicable TransitionHooks for a specific Transition instance. + * + * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g. + * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is + * determined by the type of hook) + * + * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition. + * + * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder + * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private + * in the Transition class, so we must also provide the Transition's _treeChanges) + */ +var HookBuilder = /** @class */ (function () { + function HookBuilder(transition) { + this.transition = transition; + } + HookBuilder.prototype.buildHooksForPhase = function (phase) { + var _this = this; + var $transitions = this.transition.router.transitionService; + return $transitions._pluginapi + ._getEvents(phase) + .map(function (type) { return _this.buildHooks(type); }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(_common_common__WEBPACK_IMPORTED_MODULE_0__.identity); + }; + /** + * Returns an array of newly built TransitionHook objects. + * + * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]]. + * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s) + * - For each of the [[PathNode]]s, creates a TransitionHook + * + * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'. + */ + HookBuilder.prototype.buildHooks = function (hookType) { + var transition = this.transition; + var treeChanges = transition.treeChanges(); + // Find all the matching registered hooks for a given hook type + var matchingHooks = this.getMatchingHooks(hookType, treeChanges, transition); + if (!matchingHooks) + return []; + var baseHookOptions = { + transition: transition, + current: transition.options().current, + }; + var makeTransitionHooks = function (hook) { + // Fetch the Nodes that caused this hook to match. + var matches = hook.matches(treeChanges, transition); + // Select the PathNode[] that will be used as TransitionHook context objects + var matchingNodes = matches[hookType.criteriaMatchPath.name]; + // Return an array of HookTuples + return matchingNodes.map(function (node) { + var _options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ + bind: hook.bind, + traceData: { hookType: hookType.name, context: node }, + }, baseHookOptions); + var state = hookType.criteriaMatchPath.scope === _interface__WEBPACK_IMPORTED_MODULE_2__.TransitionHookScope.STATE ? node.state.self : null; + var transitionHook = new _transitionHook__WEBPACK_IMPORTED_MODULE_3__.TransitionHook(transition, state, hook, _options); + return { hook: hook, node: node, transitionHook: transitionHook }; + }); + }; + return matchingHooks + .map(makeTransitionHooks) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .sort(tupleSort(hookType.reverseSort)) + .map(function (tuple) { return tuple.transitionHook; }); + }; + /** + * Finds all RegisteredHooks from: + * - The Transition object instance hook registry + * - The TransitionService ($transitions) global hook registry + * + * which matched: + * - the eventType + * - the matchCriteria (to, from, exiting, retained, entering) + * + * @returns an array of matched [[RegisteredHook]]s + */ + HookBuilder.prototype.getMatchingHooks = function (hookType, treeChanges, transition) { + var isCreate = hookType.hookPhase === _interface__WEBPACK_IMPORTED_MODULE_2__.TransitionHookPhase.CREATE; + // Instance and Global hook registries + var $transitions = this.transition.router.transitionService; + var registries = isCreate ? [$transitions] : [this.transition, $transitions]; + return registries + .map(function (reg) { return reg.getHooks(hookType.name); }) // Get named hooks from registries + .filter((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.assertPredicate)(_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray, "broken event named: " + hookType.name)) // Sanity check + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array + .filter(function (hook) { return hook.matches(treeChanges, transition); }); // Only those satisfying matchCriteria + }; + return HookBuilder; +}()); + +/** + * A factory for a sort function for HookTuples. + * + * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares + * the EventHook priority. + * + * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth + * @returns a tuple sort function + */ +function tupleSort(reverseDepthSort) { + if (reverseDepthSort === void 0) { reverseDepthSort = false; } + return function nodeDepthThenPriority(l, r) { + var factor = reverseDepthSort ? -1 : 1; + var depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor; + return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority; + }; +} +//# sourceMappingURL=hookBuilder.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "matchState": () => (/* binding */ matchState), +/* harmony export */ "RegisteredHook": () => (/* binding */ RegisteredHook), +/* harmony export */ "makeEvent": () => (/* binding */ makeEvent) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); + + +/** + * Determines if the given state matches the matchCriteria + * + * @internal + * + * @param state a State Object to test against + * @param criterion + * - If a string, matchState uses the string as a glob-matcher against the state name + * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name + * and returns a positive match if any of the globs match. + * - If a function, matchState calls the function with the state and returns true if the function's result is truthy. + * @returns {boolean} + */ +function matchState(state, criterion, transition) { + var toMatch = (0,_common__WEBPACK_IMPORTED_MODULE_0__.isString)(criterion) ? [criterion] : criterion; + function matchGlobs(_state) { + var globStrings = toMatch; + for (var i = 0; i < globStrings.length; i++) { + var glob = new _common__WEBPACK_IMPORTED_MODULE_0__.Glob(globStrings[i]); + if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) { + return true; + } + } + return false; + } + var matchFn = ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(toMatch) ? toMatch : matchGlobs); + return !!matchFn(state, transition); +} +/** + * The registration data for a registered transition hook + */ +var RegisteredHook = /** @class */ (function () { + function RegisteredHook(tranSvc, eventType, callback, matchCriteria, removeHookFromRegistry, options) { + if (options === void 0) { options = {}; } + this.tranSvc = tranSvc; + this.eventType = eventType; + this.callback = callback; + this.matchCriteria = matchCriteria; + this.removeHookFromRegistry = removeHookFromRegistry; + this.invokeCount = 0; + this._deregistered = false; + this.priority = options.priority || 0; + this.bind = options.bind || null; + this.invokeLimit = options.invokeLimit; + } + /** + * Gets the matching [[PathNode]]s + * + * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing + * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes. + * + * Returning `null` is significant to distinguish between the default + * "match-all criterion value" of `true` compared to a `() => true` function, + * when the nodes is an empty array. + * + * This is useful to allow a transition match criteria of `entering: true` + * to still match a transition, even when `entering === []`. Contrast that + * with `entering: (state) => true` which only matches when a state is actually + * being entered. + */ + RegisteredHook.prototype._matchingNodes = function (nodes, criterion, transition) { + if (criterion === true) + return nodes; + var matching = nodes.filter(function (node) { return matchState(node.state, criterion, transition); }); + return matching.length ? matching : null; + }; + /** + * Gets the default match criteria (all `true`) + * + * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.: + * + * ```js + * { + * to: true, + * from: true, + * entering: true, + * exiting: true, + * retained: true, + * } + */ + RegisteredHook.prototype._getDefaultMatchCriteria = function () { + return (0,_common__WEBPACK_IMPORTED_MODULE_0__.mapObj)(this.tranSvc._pluginapi._getPathTypes(), function () { return true; }); + }; + /** + * Gets matching nodes as [[IMatchingNodes]] + * + * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to: + * + * ```js + * let matches: IMatchingNodes = { + * to: _matchingNodes([tail(treeChanges.to)], mc.to), + * from: _matchingNodes([tail(treeChanges.from)], mc.from), + * exiting: _matchingNodes(treeChanges.exiting, mc.exiting), + * retained: _matchingNodes(treeChanges.retained, mc.retained), + * entering: _matchingNodes(treeChanges.entering, mc.entering), + * }; + * ``` + */ + RegisteredHook.prototype._getMatchingNodes = function (treeChanges, transition) { + var _this = this; + var criteria = (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this._getDefaultMatchCriteria(), this.matchCriteria); + var paths = (0,_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.tranSvc._pluginapi._getPathTypes()); + return paths.reduce(function (mn, pathtype) { + // STATE scope criteria matches against every node in the path. + // TRANSITION scope criteria matches against only the last node in the path + var isStateHook = pathtype.scope === _interface__WEBPACK_IMPORTED_MODULE_1__.TransitionHookScope.STATE; + var path = treeChanges[pathtype.name] || []; + var nodes = isStateHook ? path : [(0,_common__WEBPACK_IMPORTED_MODULE_0__.tail)(path)]; + mn[pathtype.name] = _this._matchingNodes(nodes, criteria[pathtype.name], transition); + return mn; + }, {}); + }; + /** + * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]] + * + * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values + * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering) + */ + RegisteredHook.prototype.matches = function (treeChanges, transition) { + var matches = this._getMatchingNodes(treeChanges, transition); + // Check if all the criteria matched the TreeChanges object + var allMatched = (0,_common__WEBPACK_IMPORTED_MODULE_0__.values)(matches).every(_common__WEBPACK_IMPORTED_MODULE_0__.identity); + return allMatched ? matches : null; + }; + RegisteredHook.prototype.deregister = function () { + this.removeHookFromRegistry(this); + this._deregistered = true; + }; + return RegisteredHook; +}()); + +/** Return a registration function of the requested type. */ +function makeEvent(registry, transitionService, eventType) { + // Create the object which holds the registered transition hooks. + var _registeredHooks = (registry._registeredHooks = registry._registeredHooks || {}); + var hooks = (_registeredHooks[eventType.name] = []); + var removeHookFn = (0,_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(hooks); + // Create hook registration function on the IHookRegistry for the event + registry[eventType.name] = hookRegistrationFn; + function hookRegistrationFn(matchObject, callback, options) { + if (options === void 0) { options = {}; } + var registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, removeHookFn, options); + hooks.push(registeredHook); + return registeredHook.deregister.bind(registeredHook); + } + return hookRegistrationFn; +} +//# sourceMappingURL=hookRegistry.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/index.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/index.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionHookPhase": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase), +/* harmony export */ "TransitionHookScope": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope), +/* harmony export */ "HookBuilder": () => (/* reexport safe */ _hookBuilder__WEBPACK_IMPORTED_MODULE_1__.HookBuilder), +/* harmony export */ "RegisteredHook": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.RegisteredHook), +/* harmony export */ "makeEvent": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.makeEvent), +/* harmony export */ "matchState": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.matchState), +/* harmony export */ "RejectType": () => (/* reexport safe */ _rejectFactory__WEBPACK_IMPORTED_MODULE_3__.RejectType), +/* harmony export */ "Rejection": () => (/* reexport safe */ _rejectFactory__WEBPACK_IMPORTED_MODULE_3__.Rejection), +/* harmony export */ "Transition": () => (/* reexport safe */ _transition__WEBPACK_IMPORTED_MODULE_4__.Transition), +/* harmony export */ "TransitionHook": () => (/* reexport safe */ _transitionHook__WEBPACK_IMPORTED_MODULE_5__.TransitionHook), +/* harmony export */ "TransitionEventType": () => (/* reexport safe */ _transitionEventType__WEBPACK_IMPORTED_MODULE_6__.TransitionEventType), +/* harmony export */ "TransitionService": () => (/* reexport safe */ _transitionService__WEBPACK_IMPORTED_MODULE_7__.TransitionService), +/* harmony export */ "defaultTransOpts": () => (/* reexport safe */ _transitionService__WEBPACK_IMPORTED_MODULE_7__.defaultTransOpts) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _hookBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hookBuilder */ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js"); +/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); +/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _transition__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); +/* harmony import */ var _transitionEventType__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./transitionEventType */ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js"); +/* harmony import */ var _transitionService__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); +/** + * # Transition subsystem + * + * This module contains APIs related to a Transition. + * + * See: + * - [[TransitionService]] + * - [[Transition]] + * - [[HookFn]], [[TransitionHookFn]], [[TransitionStateHookFn]], [[HookMatchCriteria]], [[HookResult]] + * + * @packageDocumentation @preferred + */ + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/interface.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/interface.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionHookPhase": () => (/* binding */ TransitionHookPhase), +/* harmony export */ "TransitionHookScope": () => (/* binding */ TransitionHookScope) +/* harmony export */ }); +var TransitionHookPhase; +(function (TransitionHookPhase) { + TransitionHookPhase[TransitionHookPhase["CREATE"] = 0] = "CREATE"; + TransitionHookPhase[TransitionHookPhase["BEFORE"] = 1] = "BEFORE"; + TransitionHookPhase[TransitionHookPhase["RUN"] = 2] = "RUN"; + TransitionHookPhase[TransitionHookPhase["SUCCESS"] = 3] = "SUCCESS"; + TransitionHookPhase[TransitionHookPhase["ERROR"] = 4] = "ERROR"; +})(TransitionHookPhase || (TransitionHookPhase = {})); +var TransitionHookScope; +(function (TransitionHookScope) { + TransitionHookScope[TransitionHookScope["TRANSITION"] = 0] = "TRANSITION"; + TransitionHookScope[TransitionHookScope["STATE"] = 1] = "STATE"; +})(TransitionHookScope || (TransitionHookScope = {})); + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "RejectType": () => (/* binding */ RejectType), +/* harmony export */ "Rejection": () => (/* binding */ Rejection) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + + +/** An enum for Transition Rejection reasons */ +var RejectType; +(function (RejectType) { + /** + * A new transition superseded this one. + * + * While this transition was running, a new transition started. + * This transition is cancelled because it was superseded by new transition. + */ + RejectType[RejectType["SUPERSEDED"] = 2] = "SUPERSEDED"; + /** + * The transition was aborted + * + * The transition was aborted by a hook which returned `false` + */ + RejectType[RejectType["ABORTED"] = 3] = "ABORTED"; + /** + * The transition was invalid + * + * The transition was never started because it was invalid + */ + RejectType[RejectType["INVALID"] = 4] = "INVALID"; + /** + * The transition was ignored + * + * The transition was ignored because it would have no effect. + * + * Either: + * + * - The transition is targeting the current state and parameter values + * - The transition is targeting the same state and parameter values as the currently running transition. + */ + RejectType[RejectType["IGNORED"] = 5] = "IGNORED"; + /** + * The transition errored. + * + * This generally means a hook threw an error or returned a rejected promise + */ + RejectType[RejectType["ERROR"] = 6] = "ERROR"; +})(RejectType || (RejectType = {})); + +/** @internal */ +var id = 0; +var Rejection = /** @class */ (function () { + function Rejection(type, message, detail) { + /** @internal */ + this.$id = id++; + this.type = type; + this.message = message; + this.detail = detail; + } + /** Returns true if the obj is a rejected promise created from the `asPromise` factory */ + Rejection.isRejectionPromise = function (obj) { + return obj && typeof obj.then === 'function' && (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Rejection)(obj._transitionRejection); + }; + /** Returns a Rejection due to transition superseded */ + Rejection.superseded = function (detail, options) { + var message = 'The transition has been superseded by a different transition'; + var rejection = new Rejection(RejectType.SUPERSEDED, message, detail); + if (options && options.redirected) { + rejection.redirected = true; + } + return rejection; + }; + /** Returns a Rejection due to redirected transition */ + Rejection.redirected = function (detail) { + return Rejection.superseded(detail, { redirected: true }); + }; + /** Returns a Rejection due to invalid transition */ + Rejection.invalid = function (detail) { + var message = 'This transition is invalid'; + return new Rejection(RejectType.INVALID, message, detail); + }; + /** Returns a Rejection due to ignored transition */ + Rejection.ignored = function (detail) { + var message = 'The transition was ignored'; + return new Rejection(RejectType.IGNORED, message, detail); + }; + /** Returns a Rejection due to aborted transition */ + Rejection.aborted = function (detail) { + var message = 'The transition has been aborted'; + return new Rejection(RejectType.ABORTED, message, detail); + }; + /** Returns a Rejection due to aborted transition */ + Rejection.errored = function (detail) { + var message = 'The transition errored'; + return new Rejection(RejectType.ERROR, message, detail); + }; + /** + * Returns a Rejection + * + * Normalizes a value as a Rejection. + * If the value is already a Rejection, returns it. + * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR). + * + * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection. + */ + Rejection.normalize = function (detail) { + return (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Rejection)(detail) ? detail : Rejection.errored(detail); + }; + Rejection.prototype.toString = function () { + var detailString = function (d) { return (d && d.toString !== Object.prototype.toString ? d.toString() : (0,_common_strings__WEBPACK_IMPORTED_MODULE_1__.stringify)(d)); }; + var detail = detailString(this.detail); + var _a = this, $id = _a.$id, type = _a.type, message = _a.message; + return "Transition Rejection($id: " + $id + " type: " + type + ", message: " + message + ", detail: " + detail + ")"; + }; + Rejection.prototype.toPromise = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silentRejection)(this), { _transitionRejection: this }); + }; + return Rejection; +}()); + +//# sourceMappingURL=rejectFactory.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transition.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transition.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Transition": () => (/* binding */ Transition) +/* harmony export */ }); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); +/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); +/* harmony import */ var _hookBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./hookBuilder */ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js"); +/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../resolve/resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); +/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + + // has or is using + + + + + + + + + +/** @internal */ +var stateSelf = (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('self'); +/** + * Represents a transition between two states. + * + * When navigating to a state, we are transitioning **from** the current state **to** the new state. + * + * This object contains all contextual information about the to/from states, parameters, resolves. + * It has information about all states being entered and exited as a result of the transition. + */ +var Transition = /** @class */ (function () { + /** + * Creates a new Transition object. + * + * If the target state is not valid, an error is thrown. + * + * @internal + * + * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath` + * encapsulates the "from state". + * @param targetState The target state and parameters being transitioned to (also, the transition options) + * @param router The [[UIRouter]] instance + * @internal + */ + function Transition(fromPath, targetState, router) { + var _this = this; + /** @internal */ + this._deferred = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.defer(); + /** + * This promise is resolved or rejected based on the outcome of the Transition. + * + * When the transition is successful, the promise is resolved + * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error + */ + this.promise = this._deferred.promise; + /** @internal Holds the hook registration functions such as those passed to Transition.onStart() */ + this._registeredHooks = {}; + /** @internal */ + this._hookBuilder = new _hookBuilder__WEBPACK_IMPORTED_MODULE_9__.HookBuilder(this); + /** Checks if this transition is currently active/running. */ + this.isActive = function () { return _this.router.globals.transition === _this; }; + this.router = router; + this._targetState = targetState; + if (!targetState.valid()) { + throw new Error(targetState.error()); + } + // current() is assumed to come from targetState.options, but provide a naive implementation otherwise. + this._options = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.extend)({ current: (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.val)(this) }, targetState.options()); + this.$id = router.transitionService._transitionCount++; + var toPath = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.buildToPath(fromPath, targetState); + this._treeChanges = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.treeChanges(fromPath, toPath, this._options.reloadState); + this.createTransitionHookRegFns(); + var onCreateHooks = this._hookBuilder.buildHooksForPhase(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.CREATE); + _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(onCreateHooks, function () { return null; }); + this.applyViewConfigs(router); + } + /** @internal */ + Transition.prototype.onBefore = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onStart = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onExit = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onRetain = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onEnter = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onFinish = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onSuccess = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onError = function (criteria, callback, options) { + return; + }; + /** @internal + * Creates the transition-level hook registration functions + * (which can then be used to register hooks) + */ + Transition.prototype.createTransitionHookRegFns = function () { + var _this = this; + this.router.transitionService._pluginapi + ._getEvents() + .filter(function (type) { return type.hookPhase !== _interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.CREATE; }) + .forEach(function (type) { return (0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.makeEvent)(_this, _this.router.transitionService, type); }); + }; + /** @internal */ + Transition.prototype.getHooks = function (hookName) { + return this._registeredHooks[hookName]; + }; + Transition.prototype.applyViewConfigs = function (router) { + var enteringStates = this._treeChanges.entering.map(function (node) { return node.state; }); + _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates); + }; + /** + * @internal + * @returns the internal from [State] object + */ + Transition.prototype.$from = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.tail)(this._treeChanges.from).state; + }; + /** + * @internal + * @returns the internal to [State] object + */ + Transition.prototype.$to = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.tail)(this._treeChanges.to).state; + }; + /** + * Returns the "from state" + * + * Returns the state that the transition is coming *from*. + * + * @returns The state declaration object for the Transition's ("from state"). + */ + Transition.prototype.from = function () { + return this.$from().self; + }; + /** + * Returns the "to state" + * + * Returns the state that the transition is going *to*. + * + * @returns The state declaration object for the Transition's target state ("to state"). + */ + Transition.prototype.to = function () { + return this.$to().self; + }; + /** + * Gets the Target State + * + * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object. + * + * @returns the [[TargetState]] of this Transition + */ + Transition.prototype.targetState = function () { + return this._targetState; + }; + /** + * Determines whether two transitions are equivalent. + * @deprecated + */ + Transition.prototype.is = function (compare) { + if (compare instanceof Transition) { + // TODO: Also compare parameters + return this.is({ to: compare.$to().name, from: compare.$from().name }); + } + return !((compare.to && !(0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.matchState)(this.$to(), compare.to, this)) || + (compare.from && !(0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.matchState)(this.$from(), compare.from, this))); + }; + Transition.prototype.params = function (pathname) { + if (pathname === void 0) { pathname = 'to'; } + return Object.freeze(this._treeChanges[pathname].map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.mergeR, {})); + }; + Transition.prototype.paramsChanged = function () { + var fromParams = this.params('from'); + var toParams = this.params('to'); + // All the parameters declared on both the "to" and "from" paths + var allParamDescriptors = [] + .concat(this._treeChanges.to) + .concat(this._treeChanges.from) + .map(function (pathNode) { return pathNode.paramSchema; }) + .reduce(_common__WEBPACK_IMPORTED_MODULE_15__.flattenR, []) + .reduce(_common__WEBPACK_IMPORTED_MODULE_15__.uniqR, []); + var changedParamDescriptors = _params_param__WEBPACK_IMPORTED_MODULE_11__.Param.changed(allParamDescriptors, fromParams, toParams); + return changedParamDescriptors.reduce(function (changedValues, descriptor) { + changedValues[descriptor.id] = toParams[descriptor.id]; + return changedValues; + }, {}); + }; + /** + * Creates a [[UIInjector]] Dependency Injector + * + * Returns a Dependency Injector for the Transition's target state (to state). + * The injector provides resolve values which the target state has access to. + * + * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2). + * + * #### Example: + * ```js + * .onEnter({ entering: 'myState' }, trans => { + * var myResolveValue = trans.injector().get('myResolve'); + * // Inject a global service from the global/native injector (if it exists) + * var MyService = trans.injector().get('MyService'); + * }) + * ``` + * + * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched. + * You can use [[UIInjector.getAsync]] to get a promise for the data. + * #### Example: + * ```js + * .onBefore({}, trans => { + * return trans.injector().getAsync('myResolve').then(myResolveValue => + * return myResolveValue !== 'ABORT'; + * }); + * }); + * ``` + * + * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to. + * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`. + * #### Example: + * ```js + * .onEnter({ to: 'foo.bar' }, trans => { + * // returns result of `foo` state's `myResolve` resolve + * // even though `foo.bar` also has a `myResolve` resolve + * var fooData = trans.injector('foo').get('myResolve'); + * }); + * ``` + * + * If you need resolve data from the exiting states, pass `'from'` as `pathName`. + * The resolve data from the `from` path will be returned. + * #### Example: + * ```js + * .onExit({ exiting: 'foo.bar' }, trans => { + * // Gets the resolve value of `myResolve` from the state being exited + * var fooData = trans.injector(null, 'from').get('myResolve'); + * }); + * ``` + * + * + * @param state Limits the resolves provided to only the resolves the provided state has access to. + * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states. + * + * @returns a [[UIInjector]] + */ + Transition.prototype.injector = function (state, pathName) { + if (pathName === void 0) { pathName = 'to'; } + var path = this._treeChanges[pathName]; + if (state) + path = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.subPath(path, function (node) { return node.state === state || node.state.name === state; }); + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(path).injector(); + }; + /** + * Gets all available resolve tokens (keys) + * + * This method can be used in conjunction with [[injector]] to inspect the resolve values + * available to the Transition. + * + * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states + * in the Transition's [[TreeChanges.to]] path. + * + * #### Example: + * This example logs all resolve values + * ```js + * let tokens = trans.getResolveTokens(); + * tokens.forEach(token => console.log(token + " = " + trans.injector().get(token))); + * ``` + * + * #### Example: + * This example creates promises for each resolve value. + * This triggers fetches of resolves (if any have not yet been fetched). + * When all promises have all settled, it logs the resolve values. + * ```js + * let tokens = trans.getResolveTokens(); + * let promise = tokens.map(token => trans.injector().getAsync(token)); + * Promise.all(promises).then(values => console.log("Resolved values: " + values)); + * ``` + * + * Note: Angular 1 users whould use `$q.all()` + * + * @param pathname resolve context's path name (e.g., `to` or `from`) + * + * @returns an array of resolve tokens (keys) + */ + Transition.prototype.getResolveTokens = function (pathname) { + if (pathname === void 0) { pathname = 'to'; } + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(this._treeChanges[pathname]).getTokens(); + }; + /** + * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition. + * + * Allows a transition hook to dynamically add a Resolvable to this Transition. + * + * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]). + * + * If a `state` argument is provided, the Resolvable is processed when that state is being entered. + * If no `state` is provided then the root state is used. + * If the given `state` has already been entered, the Resolvable is processed when any child state is entered. + * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition. + * + * The `state` argument also scopes the resolved data. + * The resolved data is available from the injector for that `state` and any children states. + * + * #### Example: + * ```js + * transitionService.onBefore({}, transition => { + * transition.addResolvable({ + * token: 'myResolve', + * deps: ['MyService'], + * resolveFn: myService => myService.getData() + * }); + * }); + * ``` + * + * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]]) + * @param state the state in the "to path" which should receive the new resolve (otherwise, the root state) + */ + Transition.prototype.addResolvable = function (resolvable, state) { + if (state === void 0) { state = ''; } + resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.is)(_resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__.Resolvable)(resolvable) ? resolvable : new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__.Resolvable(resolvable); + var stateName = typeof state === 'string' ? state : state.name; + var topath = this._treeChanges.to; + var targetNode = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.find)(topath, function (node) { return node.state.name === stateName; }); + var resolveContext = new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(topath); + resolveContext.addResolvables([resolvable], targetNode.state); + }; + /** + * Gets the transition from which this transition was redirected. + * + * If the current transition is a redirect, this method returns the transition that was redirected. + * + * #### Example: + * ```js + * let transitionA = $state.go('A').transition + * transitionA.onStart({}, () => $state.target('B')); + * $transitions.onSuccess({ to: 'B' }, (trans) => { + * trans.to().name === 'B'; // true + * trans.redirectedFrom() === transitionA; // true + * }); + * ``` + * + * @returns The previous Transition, or null if this Transition is not the result of a redirection + */ + Transition.prototype.redirectedFrom = function () { + return this._options.redirectedFrom || null; + }; + /** + * Gets the original transition in a redirect chain + * + * A transition might belong to a long chain of multiple redirects. + * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain. + * + * #### Example: + * ```js + * // states + * registry.register({ name: 'A', redirectTo: 'B' }); + * registry.register({ name: 'B', redirectTo: 'C' }); + * registry.register({ name: 'C', redirectTo: 'D' }); + * registry.register({ name: 'D' }); + * + * let transitionA = $state.go('A').transition + * + * $transitions.onSuccess({ to: 'D' }, (trans) => { + * trans.to().name === 'D'; // true + * trans.redirectedFrom().to().name === 'C'; // true + * trans.originalTransition() === transitionA; // true + * trans.originalTransition().to().name === 'A'; // true + * }); + * ``` + * + * @returns The original Transition that started a redirect chain + */ + Transition.prototype.originalTransition = function () { + var rf = this.redirectedFrom(); + return (rf && rf.originalTransition()) || this; + }; + /** + * Get the transition options + * + * @returns the options for this Transition. + */ + Transition.prototype.options = function () { + return this._options; + }; + /** + * Gets the states being entered. + * + * @returns an array of states that will be entered during this transition. + */ + Transition.prototype.entering = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.entering, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf); + }; + /** + * Gets the states being exited. + * + * @returns an array of states that will be exited during this transition. + */ + Transition.prototype.exiting = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.exiting, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf).reverse(); + }; + /** + * Gets the states being retained. + * + * @returns an array of states that are already entered from a previous Transition, that will not be + * exited during this Transition + */ + Transition.prototype.retained = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.retained, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf); + }; + /** + * Get the [[ViewConfig]]s associated with this Transition + * + * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects. + * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., "to" or "entering"). + * + * @param pathname the name of the path to fetch views for: + * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`) + * @param state If provided, only returns the `ViewConfig`s for a single state in the path + * + * @returns a list of ViewConfig objects for the given path. + */ + Transition.prototype.views = function (pathname, state) { + if (pathname === void 0) { pathname = 'entering'; } + var path = this._treeChanges[pathname]; + path = !state ? path : path.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.propEq)('state', state)); + return path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('views')).filter(_common_common__WEBPACK_IMPORTED_MODULE_3__.identity).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []); + }; + Transition.prototype.treeChanges = function (pathname) { + return pathname ? this._treeChanges[pathname] : this._treeChanges; + }; + /** + * Creates a new transition that is a redirection of the current one. + * + * This transition can be returned from a [[TransitionService]] hook to + * redirect a transition to a new state and/or set of parameters. + * + * @internal + * + * @returns Returns a new [[Transition]] instance. + */ + Transition.prototype.redirect = function (targetState) { + var redirects = 1, trans = this; + // tslint:disable-next-line:no-conditional-assignment + while ((trans = trans.redirectedFrom()) != null) { + if (++redirects > 20) + throw new Error("Too many consecutive Transition redirects (20+)"); + } + var redirectOpts = { redirectedFrom: this, source: 'redirect' }; + // If the original transition was caused by URL sync, then use { location: 'replace' } + // on the new transition (unless the target state explicitly specifies location: false). + // This causes the original url to be replaced with the url for the redirect target + // so the original url disappears from the browser history. + if (this.options().source === 'url' && targetState.options().location !== false) { + redirectOpts.location = 'replace'; + } + var newOptions = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.extend)({}, this.options(), targetState.options(), redirectOpts); + targetState = targetState.withOptions(newOptions, true); + var newTransition = this.router.transitionService.create(this._treeChanges.from, targetState); + var originalEnteringNodes = this._treeChanges.entering; + var redirectEnteringNodes = newTransition._treeChanges.entering; + // --- Re-use resolve data from original transition --- + // When redirecting from a parent state to a child state where the parent parameter values haven't changed + // (because of the redirect), the resolves fetched by the original transition are still valid in the + // redirected transition. + // + // This allows you to define a redirect on a parent state which depends on an async resolve value. + // You can wait for the resolve, then redirect to a child state based on the result. + // The redirected transition does not have to re-fetch the resolve. + // --------------------------------------------------------- + var nodeIsReloading = function (reloadState) { return function (node) { + return reloadState && node.state.includes[reloadState.name]; + }; }; + // Find any "entering" nodes in the redirect path that match the original path and aren't being reloaded + var matchingEnteringNodes = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.nonDynamicParams).filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.not)(nodeIsReloading(targetState.options().reloadState))); + // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes. + matchingEnteringNodes.forEach(function (node, idx) { + node.resolvables = originalEnteringNodes[idx].resolvables; + }); + return newTransition; + }; + /** @internal If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */ + Transition.prototype._changedParams = function () { + var tc = this._treeChanges; + /** Return undefined if it's not a "dynamic" transition, for the following reasons */ + // If user explicitly wants a reload + if (this._options.reload) + return undefined; + // If any states are exiting or entering + if (tc.exiting.length || tc.entering.length) + return undefined; + // If to/from path lengths differ + if (tc.to.length !== tc.from.length) + return undefined; + // If the to/from paths are different + var pathsDiffer = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.arrayTuples)(tc.to, tc.from) + .map(function (tuple) { return tuple[0].state !== tuple[1].state; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.anyTrueR, false); + if (pathsDiffer) + return undefined; + // Find any parameter values that differ + var nodeSchemas = tc.to.map(function (node) { return node.paramSchema; }); + var _a = [tc.to, tc.from].map(function (path) { return path.map(function (x) { return x.paramValues; }); }), toValues = _a[0], fromValues = _a[1]; + var tuples = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.arrayTuples)(nodeSchemas, toValues, fromValues); + return tuples.map(function (_a) { + var schema = _a[0], toVals = _a[1], fromVals = _a[2]; + return _params_param__WEBPACK_IMPORTED_MODULE_11__.Param.changed(schema, toVals, fromVals); + }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []); + }; + /** + * Returns true if the transition is dynamic. + * + * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed. + * + * @returns true if the Transition is dynamic + */ + Transition.prototype.dynamic = function () { + var changes = this._changedParams(); + return !changes ? false : changes.map(function (x) { return x.dynamic; }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.anyTrueR, false); + }; + /** + * Returns true if the transition is ignored. + * + * A transition is ignored if no states are entered nor exited, and no parameter values have changed. + * + * @returns true if the Transition is ignored. + */ + Transition.prototype.ignored = function () { + return !!this._ignoredReason(); + }; + /** @internal */ + Transition.prototype._ignoredReason = function () { + var pending = this.router.globals.transition; + var reloadState = this._options.reloadState; + var same = function (pathA, pathB) { + if (pathA.length !== pathB.length) + return false; + var matching = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.matching(pathA, pathB); + return pathA.length === matching.filter(function (node) { return !reloadState || !node.state.includes[reloadState.name]; }).length; + }; + var newTC = this.treeChanges(); + var pendTC = pending && pending.treeChanges(); + if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) + return 'SameAsPending'; + if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) + return 'SameAsCurrent'; + }; + /** + * Runs the transition + * + * This method is generally called from the [[StateService.transitionTo]] + * + * @internal + * + * @returns a promise for a successful transition. + */ + Transition.prototype.run = function () { + var _this = this; + var runAllHooks = _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.runAllHooks; + // Gets transition hooks array for the given phase + var getHooksFor = function (phase) { return _this._hookBuilder.buildHooksForPhase(phase); }; + // When the chain is complete, then resolve or reject the deferred + var transitionSuccess = function () { + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceSuccess(_this.$to(), _this); + _this.success = true; + _this._deferred.resolve(_this.to()); + runAllHooks(getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.SUCCESS)); + }; + var transitionError = function (reason) { + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceError(reason, _this); + _this.success = false; + _this._deferred.reject(reason); + _this._error = reason; + runAllHooks(getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.ERROR)); + }; + var runTransition = function () { + // Wait to build the RUN hook chain until the BEFORE hooks are done + // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object. + var allRunHooks = getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.RUN); + var done = function () { return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(undefined); }; + return _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(allRunHooks, done); + }; + var startTransition = function () { + var globals = _this.router.globals; + globals.lastStartedTransitionId = _this.$id; + globals.transition = _this; + globals.transitionHistory.enqueue(_this); + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceTransitionStart(_this); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(undefined); + }; + var allBeforeHooks = getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.BEFORE); + _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(allBeforeHooks, startTransition) + .then(runTransition) + .then(transitionSuccess, transitionError); + return this.promise; + }; + /** + * Checks if the Transition is valid + * + * @returns true if the Transition is valid + */ + Transition.prototype.valid = function () { + return !this.error() || this.success !== undefined; + }; + /** + * Aborts this transition + * + * Imperative API to abort a Transition. + * This only applies to Transitions that are not yet complete. + */ + Transition.prototype.abort = function () { + // Do not set flag if the transition is already complete + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isUndefined)(this.success)) { + this._aborted = true; + } + }; + /** + * The Transition error reason. + * + * If the transition is invalid (and could not be run), returns the reason the transition is invalid. + * If the transition was valid and ran, but was not successful, returns the reason the transition failed. + * + * @returns a transition rejection explaining why the transition is invalid, or the reason the transition failed. + */ + Transition.prototype.error = function () { + var state = this.$to(); + if (state.self.abstract) { + return _rejectFactory__WEBPACK_IMPORTED_MODULE_14__.Rejection.invalid("Cannot transition to abstract state '" + state.name + "'"); + } + var paramDefs = state.parameters(); + var values = this.params(); + var invalidParams = paramDefs.filter(function (param) { return !param.validates(values[param.id]); }); + if (invalidParams.length) { + var invalidValues = invalidParams.map(function (param) { return "[" + param.id + ":" + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(values[param.id]) + "]"; }).join(', '); + var detail = "The following parameter values are not valid for state '" + state.name + "': " + invalidValues; + return _rejectFactory__WEBPACK_IMPORTED_MODULE_14__.Rejection.invalid(detail); + } + if (this.success === false) + return this._error; + }; + /** + * A string representation of the Transition + * + * @returns A string representation of the Transition + */ + Transition.prototype.toString = function () { + var fromStateOrName = this.from(); + var toStateOrName = this.to(); + var avoidEmptyHash = function (params) { + return params['#'] !== null && params['#'] !== undefined ? params : (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.omit)(params, ['#']); + }; + // (X) means the to state is invalid. + var id = this.$id, from = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(fromStateOrName) ? fromStateOrName.name : fromStateOrName, fromParams = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(avoidEmptyHash(this._treeChanges.from.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.mergeR, {}))), toValid = this.valid() ? '' : '(X) ', to = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(toStateOrName) ? toStateOrName.name : toStateOrName, toParams = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(avoidEmptyHash(this.params())); + return "Transition#" + id + "( '" + from + "'" + fromParams + " -> " + toValid + "'" + to + "'" + toParams + " )"; + }; + /** @internal */ + Transition.diToken = Transition; + return Transition; +}()); + +//# sourceMappingURL=transition.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionEventType": () => (/* binding */ TransitionEventType) +/* harmony export */ }); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); + +/** + * This class defines a type of hook, such as `onBefore` or `onEnter`. + * Plugins can define custom hook types, such as sticky states does for `onInactive`. + */ +var TransitionEventType = /** @class */ (function () { + /* tslint:disable:no-inferrable-types */ + function TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { + if (reverseSort === void 0) { reverseSort = false; } + if (getResultHandler === void 0) { getResultHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_0__.TransitionHook.HANDLE_RESULT; } + if (getErrorHandler === void 0) { getErrorHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_0__.TransitionHook.REJECT_ERROR; } + if (synchronous === void 0) { synchronous = false; } + this.name = name; + this.hookPhase = hookPhase; + this.hookOrder = hookOrder; + this.criteriaMatchPath = criteriaMatchPath; + this.reverseSort = reverseSort; + this.getResultHandler = getResultHandler; + this.getErrorHandler = getErrorHandler; + this.synchronous = synchronous; + } + return TransitionEventType; +}()); + +//# sourceMappingURL=transitionEventType.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionHook": () => (/* binding */ TransitionHook) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); + + + + + + + + + +var defaultOptions = { + current: _common_common__WEBPACK_IMPORTED_MODULE_1__.noop, + transition: null, + traceData: {}, + bind: null, +}; +var TransitionHook = /** @class */ (function () { + function TransitionHook(transition, stateContext, registeredHook, options) { + var _this = this; + this.transition = transition; + this.stateContext = stateContext; + this.registeredHook = registeredHook; + this.options = options; + this.isSuperseded = function () { return _this.type.hookPhase === _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase.RUN && !_this.options.transition.isActive(); }; + this.options = (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.defaults)(options, defaultOptions); + this.type = registeredHook.eventType; + } + /** + * Chains together an array of TransitionHooks. + * + * Given a list of [[TransitionHook]] objects, chains them together. + * Each hook is invoked after the previous one completes. + * + * #### Example: + * ```js + * var hooks: TransitionHook[] = getHooks(); + * let promise: Promise = TransitionHook.chain(hooks); + * + * promise.then(handleSuccess, handleError); + * ``` + * + * @param hooks the list of hooks to chain together + * @param waitFor if provided, the chain is `.then()`'ed off this promise + * @returns a `Promise` for sequentially invoking the hooks (in order) + */ + TransitionHook.chain = function (hooks, waitFor) { + // Chain the next hook off the previous + var createHookChainR = function (prev, nextHook) { return prev.then(function () { return nextHook.invokeHook(); }); }; + return hooks.reduce(createHookChainR, waitFor || _common_coreservices__WEBPACK_IMPORTED_MODULE_6__.services.$q.when()); + }; + /** + * Invokes all the provided TransitionHooks, in order. + * Each hook's return value is checked. + * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned. + * If no hook returns a promise, then all hooks are processed synchronously. + * + * @param hooks the list of TransitionHooks to invoke + * @param doneCallback a callback that is invoked after all the hooks have successfully completed + * + * @returns a promise for the async result, or the result of the callback + */ + TransitionHook.invokeHooks = function (hooks, doneCallback) { + for (var idx = 0; idx < hooks.length; idx++) { + var hookResult = hooks[idx].invokeHook(); + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(hookResult)) { + var remainingHooks = hooks.slice(idx + 1); + return TransitionHook.chain(remainingHooks, hookResult).then(doneCallback); + } + } + return doneCallback(); + }; + /** + * Run all TransitionHooks, ignoring their return value. + */ + TransitionHook.runAllHooks = function (hooks) { + hooks.forEach(function (hook) { return hook.invokeHook(); }); + }; + TransitionHook.prototype.logError = function (err) { + this.transition.router.stateService.defaultErrorHandler()(err); + }; + TransitionHook.prototype.invokeHook = function () { + var _this = this; + var hook = this.registeredHook; + if (hook._deregistered) + return; + var notCurrent = this.getNotCurrentRejection(); + if (notCurrent) + return notCurrent; + var options = this.options; + _common_trace__WEBPACK_IMPORTED_MODULE_5__.trace.traceHookInvocation(this, this.transition, options); + var invokeCallback = function () { return hook.callback.call(options.bind, _this.transition, _this.stateContext); }; + var normalizeErr = function (err) { return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err).toPromise(); }; + var handleError = function (err) { return hook.eventType.getErrorHandler(_this)(err); }; + var handleResult = function (result) { return hook.eventType.getResultHandler(_this)(result); }; + try { + var result = invokeCallback(); + if (!this.type.synchronous && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result)) { + return result.catch(normalizeErr).then(handleResult, handleError); + } + else { + return handleResult(result); + } + } + catch (err) { + // If callback throws (synchronously) + return handleError(_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err)); + } + finally { + if (hook.invokeLimit && ++hook.invokeCount >= hook.invokeLimit) { + hook.deregister(); + } + } + }; + /** + * This method handles the return value of a Transition Hook. + * + * A hook can return false (cancel), a TargetState (redirect), + * or a promise (which may later resolve to false or a redirect) + * + * This also handles "transition superseded" -- when a new transition + * was started while the hook was still running + */ + TransitionHook.prototype.handleHookResult = function (result) { + var _this = this; + var notCurrent = this.getNotCurrentRejection(); + if (notCurrent) + return notCurrent; + // Hook returned a promise + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result)) { + // Wait for the promise, then reprocess with the resulting value + return result.then(function (val) { return _this.handleHookResult(val); }); + } + _common_trace__WEBPACK_IMPORTED_MODULE_5__.trace.traceHookResult(result, this.transition, this.options); + // Hook returned false + if (result === false) { + // Abort this Transition + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted('Hook aborted transition').toPromise(); + } + var isTargetState = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.is)(_state_targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState); + // hook returned a TargetState + if (isTargetState(result)) { + // Halt the current Transition and redirect (a new Transition) to the TargetState. + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.redirected(result).toPromise(); + } + }; + /** + * Return a Rejection promise if the transition is no longer current due + * to a stopped router (disposed), or a new transition has started and superseded this one. + */ + TransitionHook.prototype.getNotCurrentRejection = function () { + var router = this.transition.router; + // The router is stopped + if (router._disposed) { + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted("UIRouter instance #" + router.$id + " has been stopped (disposed)").toPromise(); + } + if (this.transition._aborted) { + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted().toPromise(); + } + // This transition is no longer current. + // Another transition started while this hook was still running. + if (this.isSuperseded()) { + // Abort this transition + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.superseded(this.options.current()).toPromise(); + } + }; + TransitionHook.prototype.toString = function () { + var _a = this, options = _a.options, registeredHook = _a.registeredHook; + var event = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.hookType')(options) || 'internal', context = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.context.state.name')(options) || (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.context')(options) || 'unknown', name = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.fnToString)(registeredHook.callback); + return event + " context: " + context + ", " + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, name); + }; + /** + * These GetResultHandler(s) are used by [[invokeHook]] below + * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]]) + */ + TransitionHook.HANDLE_RESULT = function (hook) { return function (result) { + return hook.handleHookResult(result); + }; }; + /** + * If the result is a promise rejection, log it. + * Otherwise, ignore the result. + */ + TransitionHook.LOG_REJECTED_RESULT = function (hook) { return function (result) { + (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result) && result.catch(function (err) { return hook.logError(_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err)); }); + return undefined; + }; }; + /** + * These GetErrorHandler(s) are used by [[invokeHook]] below + * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]]) + */ + TransitionHook.LOG_ERROR = function (hook) { return function (error) { return hook.logError(error); }; }; + TransitionHook.REJECT_ERROR = function (hook) { return function (error) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.silentRejection)(error); }; }; + TransitionHook.THROW_ERROR = function (hook) { return function (error) { + throw error; + }; }; + return TransitionHook; +}()); + +//# sourceMappingURL=transitionHook.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionService.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "defaultTransOpts": () => (/* binding */ defaultTransOpts), +/* harmony export */ "TransitionService": () => (/* binding */ TransitionService) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _transition__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); +/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); +/* harmony import */ var _hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hooks/coreResolvables */ "./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js"); +/* harmony import */ var _hooks_redirectTo__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../hooks/redirectTo */ "./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js"); +/* harmony import */ var _hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../hooks/onEnterExitRetain */ "./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js"); +/* harmony import */ var _hooks_resolve__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../hooks/resolve */ "./node_modules/@uirouter/core/lib-esm/hooks/resolve.js"); +/* harmony import */ var _hooks_views__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../hooks/views */ "./node_modules/@uirouter/core/lib-esm/hooks/views.js"); +/* harmony import */ var _hooks_updateGlobals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../hooks/updateGlobals */ "./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js"); +/* harmony import */ var _hooks_url__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../hooks/url */ "./node_modules/@uirouter/core/lib-esm/hooks/url.js"); +/* harmony import */ var _hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../hooks/lazyLoad */ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js"); +/* harmony import */ var _transitionEventType__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./transitionEventType */ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _hooks_ignoredTransition__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../hooks/ignoredTransition */ "./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js"); +/* harmony import */ var _hooks_invalidTransition__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../hooks/invalidTransition */ "./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js"); + + + + + + + + + + + + + + + + + + +/** + * The default [[Transition]] options. + * + * Include this object when applying custom defaults: + * let reloadOpts = { reload: true, notify: true } + * let options = defaults(theirOpts, customDefaults, defaultOptions); + */ +var defaultTransOpts = { + location: true, + relative: null, + inherit: false, + notify: true, + reload: false, + supercede: true, + custom: {}, + current: function () { return null; }, + source: 'unknown', +}; +/** + * This class provides services related to Transitions. + * + * - Most importantly, it allows global Transition Hooks to be registered. + * - It allows the default transition error handler to be set. + * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]). + * + * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class. + * + * This API is located at `router.transitionService` ([[UIRouter.transitionService]]) + */ +var TransitionService = /** @class */ (function () { + /** @internal */ + function TransitionService(_router) { + /** @internal */ + this._transitionCount = 0; + /** The transition hook types, such as `onEnter`, `onStart`, etc */ + this._eventTypes = []; + /** @internal The registered transition hooks */ + this._registeredHooks = {}; + /** The paths on a criteria object */ + this._criteriaPaths = {}; + this._router = _router; + this.$view = _router.viewService; + this._deregisterHookFns = {}; + this._pluginapi = ((0,_common_common__WEBPACK_IMPORTED_MODULE_14__.createProxyFunctions)((0,_common_hof__WEBPACK_IMPORTED_MODULE_15__.val)(this), {}, (0,_common_hof__WEBPACK_IMPORTED_MODULE_15__.val)(this), [ + '_definePathType', + '_defineEvent', + '_getPathTypes', + '_getEvents', + 'getHooks', + ])); + this._defineCorePaths(); + this._defineCoreEvents(); + this._registerCoreTransitionHooks(); + _router.globals.successfulTransitions.onEvict(_hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__.treeChangesCleanup); + } + /** + * Registers a [[TransitionHookFn]], called *while a transition is being constructed*. + * + * Registers a transition lifecycle hook, which is invoked during transition construction. + * + * This low level hook should only be used by plugins. + * This can be a useful time for plugins to add resolves or mutate the transition as needed. + * The Sticky States plugin uses this hook to modify the treechanges. + * + * ### Lifecycle + * + * `onCreate` hooks are invoked *while a transition is being constructed*. + * + * ### Return value + * + * The hook's return value is ignored + * + * @internal + * @param criteria defines which Transitions the Hook should be invoked for. + * @param callback the hook function which will be invoked. + * @param options the registration options + * @returns a function which deregisters the hook. + */ + TransitionService.prototype.onCreate = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onBefore = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onStart = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onExit = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onRetain = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onEnter = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onFinish = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onSuccess = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onError = function (criteria, callback, options) { + return; + }; + /** + * dispose + * @internal + */ + TransitionService.prototype.dispose = function (router) { + (0,_common_common__WEBPACK_IMPORTED_MODULE_14__.values)(this._registeredHooks).forEach(function (hooksArray) { + return hooksArray.forEach(function (hook) { + hook._deregistered = true; + (0,_common_common__WEBPACK_IMPORTED_MODULE_14__.removeFrom)(hooksArray, hook); + }); + }); + }; + /** + * Creates a new [[Transition]] object + * + * This is a factory function for creating new Transition objects. + * It is used internally by the [[StateService]] and should generally not be called by application code. + * + * @internal + * @param fromPath the path to the current state (the from state) + * @param targetState the target state (destination) + * @returns a Transition + */ + TransitionService.prototype.create = function (fromPath, targetState) { + return new _transition__WEBPACK_IMPORTED_MODULE_1__.Transition(fromPath, targetState, this._router); + }; + /** @internal */ + TransitionService.prototype._defineCoreEvents = function () { + var Phase = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase; + var TH = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook; + var paths = this._criteriaPaths; + var NORMAL_SORT = false, REVERSE_SORT = true; + var SYNCHRONOUS = true; + this._defineEvent('onCreate', Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS); + this._defineEvent('onBefore', Phase.BEFORE, 0, paths.to); + this._defineEvent('onStart', Phase.RUN, 0, paths.to); + this._defineEvent('onExit', Phase.RUN, 100, paths.exiting, REVERSE_SORT); + this._defineEvent('onRetain', Phase.RUN, 200, paths.retained); + this._defineEvent('onEnter', Phase.RUN, 300, paths.entering); + this._defineEvent('onFinish', Phase.RUN, 400, paths.to); + this._defineEvent('onSuccess', Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); + this._defineEvent('onError', Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); + }; + /** @internal */ + TransitionService.prototype._defineCorePaths = function () { + var STATE = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope.STATE, TRANSITION = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope.TRANSITION; + this._definePathType('to', TRANSITION); + this._definePathType('from', TRANSITION); + this._definePathType('exiting', STATE); + this._definePathType('retained', STATE); + this._definePathType('entering', STATE); + }; + /** @internal */ + TransitionService.prototype._defineEvent = function (name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { + if (reverseSort === void 0) { reverseSort = false; } + if (getResultHandler === void 0) { getResultHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook.HANDLE_RESULT; } + if (getErrorHandler === void 0) { getErrorHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook.REJECT_ERROR; } + if (synchronous === void 0) { synchronous = false; } + var eventType = new _transitionEventType__WEBPACK_IMPORTED_MODULE_11__.TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous); + this._eventTypes.push(eventType); + (0,_hookRegistry__WEBPACK_IMPORTED_MODULE_2__.makeEvent)(this, this, eventType); + }; + /** @internal */ + TransitionService.prototype._getEvents = function (phase) { + var transitionHookTypes = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_13__.isDefined)(phase) + ? this._eventTypes.filter(function (type) { return type.hookPhase === phase; }) + : this._eventTypes.slice(); + return transitionHookTypes.sort(function (l, r) { + var cmpByPhase = l.hookPhase - r.hookPhase; + return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase; + }); + }; + /** + * Adds a Path to be used as a criterion against a TreeChanges path + * + * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path. + * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)` + * Each state in the exiting path is checked against the criteria and returned as part of the match. + * + * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path. + * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)` + * Only the tail of the `to` path is checked against the criteria and returned as part of the match. + * + * @internal + */ + TransitionService.prototype._definePathType = function (name, hookScope) { + this._criteriaPaths[name] = { name: name, scope: hookScope }; + }; + /** @internal */ + // tslint:disable-next-line + TransitionService.prototype._getPathTypes = function () { + return this._criteriaPaths; + }; + /** @internal */ + TransitionService.prototype.getHooks = function (hookName) { + return this._registeredHooks[hookName]; + }; + /** @internal */ + TransitionService.prototype._registerCoreTransitionHooks = function () { + var fns = this._deregisterHookFns; + fns.addCoreResolves = (0,_hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__.registerAddCoreResolvables)(this); + fns.ignored = (0,_hooks_ignoredTransition__WEBPACK_IMPORTED_MODULE_16__.registerIgnoredTransitionHook)(this); + fns.invalid = (0,_hooks_invalidTransition__WEBPACK_IMPORTED_MODULE_17__.registerInvalidTransitionHook)(this); + // Wire up redirectTo hook + fns.redirectTo = (0,_hooks_redirectTo__WEBPACK_IMPORTED_MODULE_4__.registerRedirectToHook)(this); + // Wire up onExit/Retain/Enter state hooks + fns.onExit = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnExitHook)(this); + fns.onRetain = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnRetainHook)(this); + fns.onEnter = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnEnterHook)(this); + // Wire up Resolve hooks + fns.eagerResolve = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerEagerResolvePath)(this); + fns.lazyResolve = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerLazyResolveState)(this); + fns.resolveAll = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerResolveRemaining)(this); + // Wire up the View management hooks + fns.loadViews = (0,_hooks_views__WEBPACK_IMPORTED_MODULE_7__.registerLoadEnteringViews)(this); + fns.activateViews = (0,_hooks_views__WEBPACK_IMPORTED_MODULE_7__.registerActivateViews)(this); + // Updates global state after a transition + fns.updateGlobals = (0,_hooks_updateGlobals__WEBPACK_IMPORTED_MODULE_8__.registerUpdateGlobalState)(this); + // After globals.current is updated at priority: 10000 + fns.updateUrl = (0,_hooks_url__WEBPACK_IMPORTED_MODULE_9__.registerUpdateUrl)(this); + // Lazy load state trees + fns.lazyLoad = (0,_hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_10__.registerLazyLoadHook)(this); + }; + return TransitionService; +}()); + +//# sourceMappingURL=transitionService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/index.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlMatcher": () => (/* reexport safe */ _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher), +/* harmony export */ "ParamFactory": () => (/* reexport safe */ _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__.ParamFactory), +/* harmony export */ "UrlMatcherFactory": () => (/* reexport safe */ _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__.UrlMatcherFactory), +/* harmony export */ "UrlRouter": () => (/* reexport safe */ _urlRouter__WEBPACK_IMPORTED_MODULE_3__.UrlRouter), +/* harmony export */ "BaseUrlRule": () => (/* reexport safe */ _urlRule__WEBPACK_IMPORTED_MODULE_4__.BaseUrlRule), +/* harmony export */ "UrlRuleFactory": () => (/* reexport safe */ _urlRule__WEBPACK_IMPORTED_MODULE_4__.UrlRuleFactory), +/* harmony export */ "UrlService": () => (/* reexport safe */ _urlService__WEBPACK_IMPORTED_MODULE_5__.UrlService), +/* harmony export */ "UrlRules": () => (/* reexport safe */ _urlRules__WEBPACK_IMPORTED_MODULE_6__.UrlRules), +/* harmony export */ "UrlConfig": () => (/* reexport safe */ _urlConfig__WEBPACK_IMPORTED_MODULE_7__.UrlConfig) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/url/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(["default","UrlRules","UrlConfig"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./urlMatcherFactory */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js"); +/* harmony import */ var _urlRouter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./urlRouter */ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js"); +/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); +/* harmony import */ var _urlService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./urlService */ "./node_modules/@uirouter/core/lib-esm/url/urlService.js"); +/* harmony import */ var _urlRules__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./urlRules */ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js"); +/* harmony import */ var _urlConfig__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./urlConfig */ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js"); + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/interface.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/interface.js ***! + \**************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlConfig.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlConfig": () => (/* binding */ UrlConfig) +/* harmony export */ }); +/* harmony import */ var _params__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../params */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + +/** + * An API to customize the URL behavior and retrieve URL configuration + * + * This API is used to customize the behavior of the URL. + * This includes optional trailing slashes ([[strictMode]]), case sensitivity ([[caseInsensitive]]), + * and custom parameter encoding (custom [[type]]). + * + * It also has information about the location (url) configuration such as [[port]] and [[baseHref]]. + * This information can be used to build absolute URLs, such as + * `https://example.com:443/basepath/state/substate?param1=a#hashvalue`; + * + * This API is found at `router.urlService.config` (see: [[UIRouter.urlService]], [[URLService.config]]) + */ +var UrlConfig = /** @class */ (function () { + /** @internal */ function UrlConfig(/** @internal */ router) { + var _this = this; + this.router = router; + /** @internal */ this.paramTypes = new _params__WEBPACK_IMPORTED_MODULE_0__.ParamTypes(); + /** @internal */ this._decodeParams = true; + /** @internal */ this._isCaseInsensitive = false; + /** @internal */ this._isStrictMode = true; + /** @internal */ this._defaultSquashPolicy = false; + /** @internal */ this.dispose = function () { return _this.paramTypes.dispose(); }; + // Delegate these calls to the current LocationConfig implementation + /** + * Gets the base Href, e.g., `http://localhost/approot/` + * + * @return the application's base href + */ + this.baseHref = function () { return _this.router.locationConfig.baseHref(); }; + /** + * Gets or sets the hashPrefix + * + * This only applies when not running in [[html5Mode]] (pushstate mode) + * + * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the "hashbang" portion. + * + * @return the hash prefix + */ + this.hashPrefix = function (newprefix) { return _this.router.locationConfig.hashPrefix(newprefix); }; + /** + * Gets the host, e.g., `localhost` + * + * @return the protocol + */ + this.host = function () { return _this.router.locationConfig.host(); }; + /** + * Returns true when running in pushstate mode + * + * @return true when running in html5 mode (pushstate mode). + */ + this.html5Mode = function () { return _this.router.locationConfig.html5Mode(); }; + /** + * Gets the port, e.g., `80` + * + * @return the port number + */ + this.port = function () { return _this.router.locationConfig.port(); }; + /** + * Gets the protocol, e.g., `http` + * + * @return the protocol + */ + this.protocol = function () { return _this.router.locationConfig.protocol(); }; + } + /** + * Defines whether URL matching should be case sensitive (the default behavior), or not. + * + * #### Example: + * ```js + * // Allow case insensitive url matches + * urlService.config.caseInsensitive(true); + * ``` + * + * @param value `false` to match URL in a case sensitive manner; otherwise `true`; + * @returns the current value of caseInsensitive + */ + UrlConfig.prototype.caseInsensitive = function (value) { + return (this._isCaseInsensitive = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._isCaseInsensitive); + }; + /** + * Sets the default behavior when generating or matching URLs with default parameter values. + * + * #### Example: + * ```js + * // Remove default parameter values from the url + * urlService.config.defaultSquashPolicy(true); + * ``` + * + * @param value A string that defines the default parameter URL squashing behavior. + * - `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL + * - `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the + * parameter is surrounded by slashes, squash (remove) one slash from the URL + * - any other string, e.g. "~": When generating an href with a default parameter value, squash (remove) + * the parameter value from the URL and replace it with this string. + * @returns the current value of defaultSquashPolicy + */ + UrlConfig.prototype.defaultSquashPolicy = function (value) { + if ((0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) && value !== true && value !== false && !(0,_common__WEBPACK_IMPORTED_MODULE_1__.isString)(value)) + throw new Error("Invalid squash policy: " + value + ". Valid policies: false, true, arbitrary-string"); + return (this._defaultSquashPolicy = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._defaultSquashPolicy); + }; + /** + * Defines whether URLs should match trailing slashes, or not (the default behavior). + * + * #### Example: + * ```js + * // Allow optional trailing slashes + * urlService.config.strictMode(false); + * ``` + * + * @param value `false` to match trailing slashes in URLs, otherwise `true`. + * @returns the current value of strictMode + */ + UrlConfig.prototype.strictMode = function (value) { + return (this._isStrictMode = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._isStrictMode); + }; + /** + * Creates and registers a custom [[ParamType]] object + * + * A custom parameter type can be used to generate URLs with typed parameters or custom encoding/decoding. + * + * #### Note: Register custom types *before using them* in a state definition. + * + * #### Example: + * ```js + * // Encode object parameter as JSON string + * urlService.config.type('myjson', { + * encode: (obj) => JSON.stringify(obj), + * decode: (str) => JSON.parse(str), + * is: (val) => typeof(val) === 'object', + * pattern: /[^/]+/, + * equals: (a, b) => _.isEqual(a, b), + * }); + * ``` + * + * See [[ParamTypeDefinition]] for more examples + * + * @param name The type name. + * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted. + * @param definitionFn A function that is injected before the app runtime starts. + * The result of this function should be a [[ParamTypeDefinition]]. + * The result is merged into the existing `definition`. + * See [[ParamType]] for information on the values accepted. + * + * @returns if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined + */ + UrlConfig.prototype.type = function (name, definition, definitionFn) { + var type = this.paramTypes.type(name, definition, definitionFn); + return !(0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(definition) ? type : this; + }; + return UrlConfig; +}()); + +//# sourceMappingURL=urlConfig.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlMatcher": () => (/* binding */ UrlMatcher) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + +function quoteRegExp(str, param) { + var surroundPattern = ['', ''], result = str.replace(/[\\\[\]\^$*+?.()|{}]/g, '\\$&'); + if (!param) + return result; + switch (param.squash) { + case false: + surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; + break; + case true: + result = result.replace(/\/$/, ''); + surroundPattern = ['(?:/(', ')|/)?']; + break; + default: + surroundPattern = ["(" + param.squash + "|", ')?']; + break; + } + return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1]; +} +var memoizeTo = function (obj, _prop, fn) { return (obj[_prop] = obj[_prop] || fn()); }; +var splitOnSlash = (0,_common_strings__WEBPACK_IMPORTED_MODULE_4__.splitOnDelim)('/'); +var defaultConfig = { + state: { params: {} }, + strict: true, + caseInsensitive: true, + decodeParams: true, +}; +/** + * Matches URLs against patterns. + * + * Matches URLs against patterns and extracts named parameters from the path or the search + * part of the URL. + * + * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query) + * parameters. Multiple search parameter names are separated by '&'. Search parameters + * do not influence whether or not a URL is matched, but their values are passed through into + * the matched parameters returned by [[UrlMatcher.exec]]. + * + * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`) + * or colon placeholders (`/somePath/:param`). + * + * - *A parameter RegExp* may be defined for a param after a colon + * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder. + * The regexp must match for the url to be matched. + * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash. + * + * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]]. + * + * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters. + * See [[UrlMatcherFactory.type]] for more information. + * + * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`). + * A catch-all * parameter value will contain the remainder of the URL. + * + * --- + * + * Parameter names may contain only word characters (latin letters, digits, and underscore) and + * must be unique within the pattern (across both path and search parameters). + * A path parameter matches any number of characters other than '/'. For catch-all + * placeholders the path parameter matches any number of characters. + * + * Examples: + * + * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for + * trailing slashes, and patterns have to match the entire path, not just a prefix. + * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or + * '/user/bob/details'. The second path segment will be captured as the parameter 'id'. + * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax. + * * `'/user/{id:[^/]*}'` - Same as the previous example. + * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id + * parameter consists of 1 to 8 hex digits. + * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the + * path into the parameter 'path'. + * * `'/files/*path'` - ditto. + * * `'/calendar/{start:date}'` - Matches "/calendar/2014-11-12" (because the pattern defined + * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start + * + */ +var UrlMatcher = /** @class */ (function () { + /** + * @param pattern The pattern to compile into a matcher. + * @param paramTypes The [[ParamTypes]] registry + * @param paramFactory A [[ParamFactory]] object + * @param config A [[UrlMatcherCompileConfig]] configuration object + */ + function UrlMatcher(pattern, paramTypes, paramFactory, config) { + var _this = this; + /** @internal */ + this._cache = { path: [this] }; + /** @internal */ + this._children = []; + /** @internal */ + this._params = []; + /** @internal */ + this._segments = []; + /** @internal */ + this._compiled = []; + this.config = config = (0,_common__WEBPACK_IMPORTED_MODULE_5__.defaults)(config, defaultConfig); + this.pattern = pattern; + // Find all placeholders and create a compiled pattern, using either classic or curly syntax: + // '*' name + // ':' name + // '{' name '}' + // '{' name ':' regexp '}' + // The regular expression is somewhat complicated due to the need to allow curly braces + // inside the regular expression. The placeholder regexp breaks down as follows: + // ([:*])([\w\[\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case) + // \{([\w\[\]]+)(?:\:\s*( ... ))?\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case + // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either + // [^{}\\]+ - anything other than curly braces or backslash + // \\. - a backslash escape + // \{(?:[^{}\\]+|\\.)*\} - a matched set of curly braces containing other atoms + var placeholder = /([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; + var searchPlaceholder = /([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; + var patterns = []; + var last = 0; + var matchArray; + var checkParamErrors = function (id) { + if (!UrlMatcher.nameValidator.test(id)) + throw new Error("Invalid parameter name '" + id + "' in pattern '" + pattern + "'"); + if ((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(_this._params, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', id))) + throw new Error("Duplicate parameter name '" + id + "' in pattern '" + pattern + "'"); + }; + // Split into static segments separated by path parameter placeholders. + // The number of segments is always 1 more than the number of parameters. + var matchDetails = function (m, isSearch) { + // IE[78] returns '' for unmatched groups instead of null + var id = m[2] || m[3]; + var regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\s\\S]*' : null); + var makeRegexpType = function (str) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(paramTypes.type(isSearch ? 'query' : 'path'), { + pattern: new RegExp(str, _this.config.caseInsensitive ? 'i' : undefined), + }); + }; + return { + id: id, + regexp: regexp, + segment: pattern.substring(last, m.index), + type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp), + }; + }; + var details; + var segment; + // tslint:disable-next-line:no-conditional-assignment + while ((matchArray = placeholder.exec(pattern))) { + details = matchDetails(matchArray, false); + if (details.segment.indexOf('?') >= 0) + break; // we're into the search part + checkParamErrors(details.id); + this._params.push(paramFactory.fromPath(details.id, details.type, config.state)); + this._segments.push(details.segment); + patterns.push([details.segment, (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(this._params)]); + last = placeholder.lastIndex; + } + segment = pattern.substring(last); + // Find any search parameter names and remove them from the last segment + var i = segment.indexOf('?'); + if (i >= 0) { + var search = segment.substring(i); + segment = segment.substring(0, i); + if (search.length > 0) { + last = 0; + // tslint:disable-next-line:no-conditional-assignment + while ((matchArray = searchPlaceholder.exec(search))) { + details = matchDetails(matchArray, true); + checkParamErrors(details.id); + this._params.push(paramFactory.fromSearch(details.id, details.type, config.state)); + last = placeholder.lastIndex; + // check if ?& + } + } + } + this._segments.push(segment); + this._compiled = patterns.map(function (_pattern) { return quoteRegExp.apply(null, _pattern); }).concat(quoteRegExp(segment)); + } + /** @internal */ + UrlMatcher.encodeDashes = function (str) { + // Replace dashes with encoded "\-" + return encodeURIComponent(str).replace(/-/g, function (c) { return "%5C%" + c.charCodeAt(0).toString(16).toUpperCase(); }); + }; + /** @internal Given a matcher, return an array with the matcher's path segments and path params, in order */ + UrlMatcher.pathSegmentsAndParams = function (matcher) { + var staticSegments = matcher._segments; + var pathParams = matcher._params.filter(function (p) { return p.location === _params_param__WEBPACK_IMPORTED_MODULE_3__.DefType.PATH; }); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(staticSegments, pathParams.concat(undefined)) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(function (x) { return x !== '' && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(x); }); + }; + /** @internal Given a matcher, return an array with the matcher's query params */ + UrlMatcher.queryParams = function (matcher) { + return matcher._params.filter(function (p) { return p.location === _params_param__WEBPACK_IMPORTED_MODULE_3__.DefType.SEARCH; }); + }; + /** + * Compare two UrlMatchers + * + * This comparison function converts a UrlMatcher into static and dynamic path segments. + * Each static path segment is a static string between a path separator (slash character). + * Each dynamic segment is a path parameter. + * + * The comparison function sorts static segments before dynamic ones. + */ + UrlMatcher.compare = function (a, b) { + /** + * Turn a UrlMatcher and all its parent matchers into an array + * of slash literals '/', string literals, and Param objects + * + * This example matcher matches strings like "/foo/:param/tail": + * var matcher = $umf.compile("/foo").append($umf.compile("/:param")).append($umf.compile("/")).append($umf.compile("tail")); + * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ] + * + * Caches the result as `matcher._cache.segments` + */ + var segments = function (matcher) { + return (matcher._cache.segments = + matcher._cache.segments || + matcher._cache.path + .map(UrlMatcher.pathSegmentsAndParams) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .reduce(_common_strings__WEBPACK_IMPORTED_MODULE_4__.joinNeighborsR, []) + .map(function (x) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x) ? splitOnSlash(x) : x); }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, [])); + }; + /** + * Gets the sort weight for each segment of a UrlMatcher + * + * Caches the result as `matcher._cache.weights` + */ + var weights = function (matcher) { + return (matcher._cache.weights = + matcher._cache.weights || + segments(matcher).map(function (segment) { + // Sort slashes first, then static strings, the Params + if (segment === '/') + return 1; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(segment)) + return 2; + if (segment instanceof _params_param__WEBPACK_IMPORTED_MODULE_3__.Param) + return 3; + })); + }; + /** + * Pads shorter array in-place (mutates) + */ + var padArrays = function (l, r, padVal) { + var len = Math.max(l.length, r.length); + while (l.length < len) + l.push(padVal); + while (r.length < len) + r.push(padVal); + }; + var weightsA = weights(a), weightsB = weights(b); + padArrays(weightsA, weightsB, 0); + var _pairs = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(weightsA, weightsB); + var cmp, i; + for (i = 0; i < _pairs.length; i++) { + cmp = _pairs[i][0] - _pairs[i][1]; + if (cmp !== 0) + return cmp; + } + return 0; + }; + /** + * Creates a new concatenated UrlMatcher + * + * Builds a new UrlMatcher by appending another UrlMatcher to this one. + * + * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`. + */ + UrlMatcher.prototype.append = function (url) { + this._children.push(url); + url._cache = { + path: this._cache.path.concat(url), + parent: this, + pattern: null, + }; + return url; + }; + /** @internal */ + UrlMatcher.prototype.isRoot = function () { + return this._cache.path[0] === this; + }; + /** Returns the input pattern string */ + UrlMatcher.prototype.toString = function () { + return this.pattern; + }; + UrlMatcher.prototype._getDecodedParamValue = function (value, param) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(value)) { + if (this.config.decodeParams && !param.type.raw) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(value)) { + value = value.map(function (paramValue) { return decodeURIComponent(paramValue); }); + } + else { + value = decodeURIComponent(value); + } + } + value = param.type.decode(value); + } + return param.value(value); + }; + /** + * Tests the specified url/path against this matcher. + * + * Tests if the given url matches this matcher's pattern, and returns an object containing the captured + * parameter values. Returns null if the path does not match. + * + * The returned object contains the values + * of any search parameters that are mentioned in the pattern, but their value may be null if + * they are not present in `search`. This means that search parameters are always treated + * as optional. + * + * #### Example: + * ```js + * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', { + * x: '1', q: 'hello' + * }); + * // returns { id: 'bob', q: 'hello', r: null } + * ``` + * + * @param path The URL path to match, e.g. `$location.path()`. + * @param search URL search parameters, e.g. `$location.search()`. + * @param hash URL hash e.g. `$location.hash()`. + * @param options + * + * @returns The captured parameter values. + */ + UrlMatcher.prototype.exec = function (path, search, hash, options) { + var _this = this; + if (search === void 0) { search = {}; } + if (options === void 0) { options = {}; } + var match = memoizeTo(this._cache, 'pattern', function () { + return new RegExp([ + '^', + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.unnest)(_this._cache.path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('_compiled'))).join(''), + _this.config.strict === false ? '/?' : '', + '$', + ].join(''), _this.config.caseInsensitive ? 'i' : undefined); + }).exec(path); + if (!match) + return null; + // options = defaults(options, { isolate: false }); + var allParams = this.parameters(), pathParams = allParams.filter(function (param) { return !param.isSearch(); }), searchParams = allParams.filter(function (param) { return param.isSearch(); }), nPathSegments = this._cache.path.map(function (urlm) { return urlm._segments.length - 1; }).reduce(function (a, x) { return a + x; }), values = {}; + if (nPathSegments !== match.length - 1) + throw new Error("Unbalanced capture group in route '" + this.pattern + "'"); + function decodePathArray(paramVal) { + var reverseString = function (str) { return str.split('').reverse().join(''); }; + var unquoteDashes = function (str) { return str.replace(/\\-/g, '-'); }; + var split = reverseString(paramVal).split(/-(?!\\)/); + var allReversed = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(split, reverseString); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(allReversed, unquoteDashes).reverse(); + } + for (var i = 0; i < nPathSegments; i++) { + var param = pathParams[i]; + var value = match[i + 1]; + // if the param value matches a pre-replace pair, replace the value before decoding. + for (var j = 0; j < param.replace.length; j++) { + if (param.replace[j].from === value) + value = param.replace[j].to; + } + if (value && param.array === true) + value = decodePathArray(value); + values[param.id] = this._getDecodedParamValue(value, param); + } + searchParams.forEach(function (param) { + var value = search[param.id]; + for (var j = 0; j < param.replace.length; j++) { + if (param.replace[j].from === value) + value = param.replace[j].to; + } + values[param.id] = _this._getDecodedParamValue(value, param); + }); + if (hash) + values['#'] = hash; + return values; + }; + /** + * @internal + * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance. + * + * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the + * pattern has no parameters, an empty array is returned. + */ + UrlMatcher.prototype.parameters = function (opts) { + if (opts === void 0) { opts = {}; } + if (opts.inherit === false) + return this._params; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.unnest)(this._cache.path.map(function (matcher) { return matcher._params; })); + }; + /** + * @internal + * Returns a single parameter from this UrlMatcher by id + * + * @param id + * @param opts + * @returns {T|Param|any|boolean|UrlMatcher|null} + */ + UrlMatcher.prototype.parameter = function (id, opts) { + var _this = this; + if (opts === void 0) { opts = {}; } + var findParam = function () { + for (var _i = 0, _a = _this._params; _i < _a.length; _i++) { + var param = _a[_i]; + if (param.id === id) + return param; + } + }; + var parent = this._cache.parent; + return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null; + }; + /** + * Validates the input parameter values against this UrlMatcher + * + * Checks an object hash of parameters to validate their correctness according to the parameter + * types of this `UrlMatcher`. + * + * @param params The object hash of parameters to validate. + * @returns Returns `true` if `params` validates, otherwise `false`. + */ + UrlMatcher.prototype.validates = function (params) { + var validParamVal = function (param, val) { return !param || param.validates(val); }; + params = params || {}; + // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher + var paramSchema = this.parameters().filter(function (paramDef) { return params.hasOwnProperty(paramDef.id); }); + return paramSchema.map(function (paramDef) { return validParamVal(paramDef, params[paramDef.id]); }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.allTrueR, true); + }; + /** + * Given a set of parameter values, creates a URL from this UrlMatcher. + * + * Creates a URL that matches this pattern by substituting the specified values + * for the path and search parameters. + * + * #### Example: + * ```js + * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' }); + * // returns '/user/bob?q=yes' + * ``` + * + * @param values the values to substitute for the parameters in this pattern. + * @returns the formatted URL (path and optionally search part). + */ + UrlMatcher.prototype.format = function (values) { + if (values === void 0) { values = {}; } + // Build the full path of UrlMatchers (including all parent UrlMatchers) + var urlMatchers = this._cache.path; + // Extract all the static segments and Params (processed as ParamDetails) + // into an ordered array + var pathSegmentsAndParams = urlMatchers + .map(UrlMatcher.pathSegmentsAndParams) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .map(function (x) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x) ? x : getDetails(x)); }); + // Extract the query params into a separate array + var queryParams = urlMatchers + .map(UrlMatcher.queryParams) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .map(getDetails); + var isInvalid = function (param) { return param.isValid === false; }; + if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) { + return null; + } + /** + * Given a Param, applies the parameter value, then returns detailed information about it + */ + function getDetails(param) { + // Normalize to typed value + var value = param.value(values[param.id]); + var isValid = param.validates(value); + var isDefaultValue = param.isDefaultValue(value); + // Check if we're in squash mode for the parameter + var squash = isDefaultValue ? param.squash : false; + // Allow the Parameter's Type to encode the value + var encoded = param.type.encode(value); + return { param: param, value: value, isValid: isValid, isDefaultValue: isDefaultValue, squash: squash, encoded: encoded }; + } + // Build up the path-portion from the list of static segments and parameters + var pathString = pathSegmentsAndParams.reduce(function (acc, x) { + // The element is a static segment (a raw string); just append it + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x)) + return acc + x; + // Otherwise, it's a ParamDetails. + var squash = x.squash, encoded = x.encoded, param = x.param; + // If squash is === true, try to remove a slash from the path + if (squash === true) + return acc.match(/\/$/) ? acc.slice(0, -1) : acc; + // If squash is a string, use the string for the param value + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) + return acc + squash; + if (squash !== false) + return acc; // ? + if (encoded == null) + return acc; + // If this parameter value is an array, encode the value using encodeDashes + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(encoded)) + return acc + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(encoded, UrlMatcher.encodeDashes).join('-'); + // If the parameter type is "raw", then do not encodeURIComponent + if (param.raw) + return acc + encoded; + // Encode the value + return acc + encodeURIComponent(encoded); + }, ''); + // Build the query string by applying parameter values (array or regular) + // then mapping to key=value, then flattening and joining using "&" + var queryString = queryParams + .map(function (paramDetails) { + var param = paramDetails.param, squash = paramDetails.squash, encoded = paramDetails.encoded, isDefaultValue = paramDetails.isDefaultValue; + if (encoded == null || (isDefaultValue && squash !== false)) + return; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(encoded)) + encoded = [encoded]; + if (encoded.length === 0) + return; + if (!param.raw) + encoded = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(encoded, encodeURIComponent); + return encoded.map(function (val) { return param.id + "=" + val; }); + }) + .filter(_common_common__WEBPACK_IMPORTED_MODULE_0__.identity) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .join('&'); + // Concat the pathstring with the queryString (if exists) and the hashString (if exists) + return pathString + (queryString ? "?" + queryString : '') + (values['#'] ? '#' + values['#'] : ''); + }; + /** @internal */ + UrlMatcher.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/; + return UrlMatcher; +}()); + +//# sourceMappingURL=urlMatcher.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ParamFactory": () => (/* binding */ ParamFactory), +/* harmony export */ "UrlMatcherFactory": () => (/* binding */ UrlMatcherFactory) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _params__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../params */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); +var __assign = (undefined && undefined.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; + + + +var ParamFactory = /** @class */ (function () { + function ParamFactory(router) { + this.router = router; + } + ParamFactory.prototype.fromConfig = function (id, type, state) { + return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.CONFIG, this.router.urlService.config, state); + }; + ParamFactory.prototype.fromPath = function (id, type, state) { + return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.PATH, this.router.urlService.config, state); + }; + ParamFactory.prototype.fromSearch = function (id, type, state) { + return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.SEARCH, this.router.urlService.config, state); + }; + return ParamFactory; +}()); + +/** + * Factory for [[UrlMatcher]] instances. + * + * The factory is available to ng1 services as + * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`. + */ +var UrlMatcherFactory = /** @class */ (function () { + // TODO: move implementations to UrlConfig (urlService.config) + function UrlMatcherFactory(/** @internal */ router) { + var _this = this; + this.router = router; + /** Creates a new [[Param]] for a given location (DefType) */ + this.paramFactory = new ParamFactory(this.router); + // TODO: Check if removal of this will break anything, then remove these + this.UrlMatcher = _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher; + this.Param = _params__WEBPACK_IMPORTED_MODULE_2__.Param; + /** @deprecated use [[UrlConfig.caseInsensitive]] */ + this.caseInsensitive = function (value) { return _this.router.urlService.config.caseInsensitive(value); }; + /** @deprecated use [[UrlConfig.defaultSquashPolicy]] */ + this.defaultSquashPolicy = function (value) { return _this.router.urlService.config.defaultSquashPolicy(value); }; + /** @deprecated use [[UrlConfig.strictMode]] */ + this.strictMode = function (value) { return _this.router.urlService.config.strictMode(value); }; + /** @deprecated use [[UrlConfig.type]] */ + this.type = function (name, definition, definitionFn) { + return _this.router.urlService.config.type(name, definition, definitionFn) || _this; + }; + } + /** + * Creates a [[UrlMatcher]] for the specified pattern. + * + * @param pattern The URL pattern. + * @param config The config object hash. + * @returns The UrlMatcher. + */ + UrlMatcherFactory.prototype.compile = function (pattern, config) { + var urlConfig = this.router.urlService.config; + // backward-compatible support for config.params -> config.state.params + var params = config && !config.state && config.params; + config = params ? __assign({ state: { params: params } }, config) : config; + var globalConfig = { + strict: urlConfig._isStrictMode, + caseInsensitive: urlConfig._isCaseInsensitive, + decodeParams: urlConfig._decodeParams, + }; + return new _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher(pattern, urlConfig.paramTypes, this.paramFactory, (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)(globalConfig, config)); + }; + /** + * Returns true if the specified object is a [[UrlMatcher]], or false otherwise. + * + * @param object The object to perform the type check against. + * @returns `true` if the object matches the `UrlMatcher` interface, by + * implementing all the same methods. + */ + UrlMatcherFactory.prototype.isMatcher = function (object) { + // TODO: typeof? + if (!(0,_common__WEBPACK_IMPORTED_MODULE_0__.isObject)(object)) + return false; + var result = true; + (0,_common__WEBPACK_IMPORTED_MODULE_0__.forEach)(_urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher.prototype, function (val, name) { + if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(val)) + result = result && (0,_common__WEBPACK_IMPORTED_MODULE_0__.isDefined)(object[name]) && (0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(object[name]); + }); + return result; + }; + /** @internal */ + UrlMatcherFactory.prototype.$get = function () { + var urlConfig = this.router.urlService.config; + urlConfig.paramTypes.enqueue = false; + urlConfig.paramTypes._flushTypeQueue(); + return this; + }; + return UrlMatcherFactory; +}()); + +//# sourceMappingURL=urlMatcherFactory.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlRouter.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRouter": () => (/* binding */ UrlRouter) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); + + +function appendBasePath(url, isHtml5, absolute, baseHref) { + if (baseHref === '/') + return url; + if (isHtml5) + return (0,_common__WEBPACK_IMPORTED_MODULE_0__.stripLastPathElement)(baseHref) + url; + if (absolute) + return baseHref.slice(1) + url; + return url; +} +/** + * Updates URL and responds to URL changes + * + * ### Deprecation warning: + * This class is now considered to be an internal API + * Use the [[UrlService]] instead. + * For configuring URL rules, use the [[UrlRules]] which can be found as [[UrlService.rules]]. + */ +var UrlRouter = /** @class */ (function () { + /** @internal */ + function UrlRouter(/** @internal */ router) { + var _this = this; + this.router = router; + // Delegate these calls to [[UrlService]] + /** @deprecated use [[UrlService.sync]]*/ + this.sync = function (evt) { return _this.router.urlService.sync(evt); }; + /** @deprecated use [[UrlService.listen]]*/ + this.listen = function (enabled) { return _this.router.urlService.listen(enabled); }; + /** @deprecated use [[UrlService.deferIntercept]]*/ + this.deferIntercept = function (defer) { return _this.router.urlService.deferIntercept(defer); }; + /** @deprecated use [[UrlService.match]]*/ + this.match = function (urlParts) { return _this.router.urlService.match(urlParts); }; + // Delegate these calls to [[UrlRules]] + /** @deprecated use [[UrlRules.initial]]*/ + this.initial = function (handler) { + return _this.router.urlService.rules.initial(handler); + }; + /** @deprecated use [[UrlRules.otherwise]]*/ + this.otherwise = function (handler) { + return _this.router.urlService.rules.otherwise(handler); + }; + /** @deprecated use [[UrlRules.removeRule]]*/ + this.removeRule = function (rule) { return _this.router.urlService.rules.removeRule(rule); }; + /** @deprecated use [[UrlRules.rule]]*/ + this.rule = function (rule) { return _this.router.urlService.rules.rule(rule); }; + /** @deprecated use [[UrlRules.rules]]*/ + this.rules = function () { return _this.router.urlService.rules.rules(); }; + /** @deprecated use [[UrlRules.sort]]*/ + this.sort = function (compareFn) { return _this.router.urlService.rules.sort(compareFn); }; + /** @deprecated use [[UrlRules.when]]*/ + this.when = function (matcher, handler, options) { return _this.router.urlService.rules.when(matcher, handler, options); }; + this.urlRuleFactory = new _urlRule__WEBPACK_IMPORTED_MODULE_1__.UrlRuleFactory(router); + } + /** Internal API. */ + UrlRouter.prototype.update = function (read) { + var $url = this.router.locationService; + if (read) { + this.location = $url.url(); + return; + } + if ($url.url() === this.location) + return; + $url.url(this.location, true); + }; + /** + * Internal API. + * + * Pushes a new location to the browser history. + * + * @internal + * @param urlMatcher + * @param params + * @param options + */ + UrlRouter.prototype.push = function (urlMatcher, params, options) { + var replace = options && !!options.replace; + this.router.urlService.url(urlMatcher.format(params || {}), replace); + }; + /** + * Builds and returns a URL with interpolated parameters + * + * #### Example: + * ```js + * matcher = $umf.compile("/about/:person"); + * params = { person: "bob" }; + * $bob = $urlRouter.href(matcher, params); + * // $bob == "/about/bob"; + * ``` + * + * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate. + * @param params An object of parameter values to fill the matcher's required parameters. + * @param options Options object. The options are: + * + * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl". + * + * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher` + */ + UrlRouter.prototype.href = function (urlMatcher, params, options) { + var url = urlMatcher.format(params); + if (url == null) + return null; + options = options || { absolute: false }; + var cfg = this.router.urlService.config; + var isHtml5 = cfg.html5Mode(); + if (!isHtml5 && url !== null) { + url = '#' + cfg.hashPrefix() + url; + } + url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref()); + if (!options.absolute || !url) { + return url; + } + var slash = !isHtml5 && url ? '/' : ''; + var cfgPort = cfg.port(); + var port = (cfgPort === 80 || cfgPort === 443 ? '' : ':' + cfgPort); + return [cfg.protocol(), '://', cfg.host(), port, slash, url].join(''); + }; + Object.defineProperty(UrlRouter.prototype, "interceptDeferred", { + /** @deprecated use [[UrlService.interceptDeferred]]*/ + get: function () { + return this.router.urlService.interceptDeferred; + }, + enumerable: false, + configurable: true + }); + return UrlRouter; +}()); + +//# sourceMappingURL=urlRouter.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlRule.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRuleFactory": () => (/* binding */ UrlRuleFactory), +/* harmony export */ "BaseUrlRule": () => (/* binding */ BaseUrlRule) +/* harmony export */ }); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _state_stateObject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../state/stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); + + + + + +/** + * Creates a [[UrlRule]] + * + * Creates a [[UrlRule]] from a: + * + * - `string` + * - [[UrlMatcher]] + * - `RegExp` + * - [[StateObject]] + */ +var UrlRuleFactory = /** @class */ (function () { + function UrlRuleFactory(router) { + this.router = router; + } + UrlRuleFactory.prototype.compile = function (str) { + return this.router.urlMatcherFactory.compile(str); + }; + UrlRuleFactory.prototype.create = function (what, handler) { + var _this = this; + var isState = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isState, isStateDeclaration = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isStateDeclaration; + var makeRule = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString, function (_what) { return makeRule(_this.compile(_what)); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_urlMatcher__WEBPACK_IMPORTED_MODULE_0__.UrlMatcher), function (_what) { return _this.fromUrlMatcher(_what, handler); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.or)(isState, isStateDeclaration), function (_what) { return _this.fromState(_what, _this.router); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(RegExp), function (_what) { return _this.fromRegExp(_what, handler); }], + [_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction, function (_what) { return new BaseUrlRule(_what, handler); }], + ]); + var rule = makeRule(what); + if (!rule) + throw new Error("invalid 'what' in when()"); + return rule; + }; + /** + * A UrlRule which matches based on a UrlMatcher + * + * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]] + * + * ## Handler as a function + * + * If `handler` is a function, the function is invoked with: + * + * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]]) + * - url: the current Url ([[UrlParts]]) + * - router: the router object ([[UIRouter]]) + * + * #### Example: + * ```js + * var urlMatcher = $umf.compile("/foo/:fooId/:barId"); + * var rule = factory.fromUrlMatcher(urlMatcher, match => "/home/" + match.fooId + "/" + match.barId); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); // '/home/123/456' + * ``` + * + * ## Handler as UrlMatcher + * + * If `handler` is a UrlMatcher, the handler matcher is used to create the new url. + * The `handler` UrlMatcher is formatted using the matched param from the first matcher. + * The url is replaced with the result. + * + * #### Example: + * ```js + * var urlMatcher = $umf.compile("/foo/:fooId/:barId"); + * var handler = $umf.compile("/home/:fooId/:barId"); + * var rule = factory.fromUrlMatcher(urlMatcher, handler); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); // '/home/123/456' + * ``` + */ + UrlRuleFactory.prototype.fromUrlMatcher = function (urlMatcher, handler) { + var _handler = handler; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(handler)) + handler = this.router.urlMatcherFactory.compile(handler); + if ((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_urlMatcher__WEBPACK_IMPORTED_MODULE_0__.UrlMatcher)(handler)) + _handler = function (match) { return handler.format(match); }; + function matchUrlParamters(url) { + var params = urlMatcher.exec(url.path, url.search, url.hash); + return urlMatcher.validates(params) && params; + } + // Prioritize URLs, lowest to highest: + // - Some optional URL parameters, but none matched + // - No optional parameters in URL + // - Some optional parameters, some matched + // - Some optional parameters, all matched + function matchPriority(params) { + var optional = urlMatcher.parameters().filter(function (param) { return param.isOptional; }); + if (!optional.length) + return 0.000001; + var matched = optional.filter(function (param) { return params[param.id]; }); + return matched.length / optional.length; + } + var details = { urlMatcher: urlMatcher, matchPriority: matchPriority, type: 'URLMATCHER' }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(new BaseUrlRule(matchUrlParamters, _handler), details); + }; + /** + * A UrlRule which matches a state by its url + * + * #### Example: + * ```js + * var rule = factory.fromState($state.get('foo'), router); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); + * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' } + * ``` + */ + UrlRuleFactory.prototype.fromState = function (stateOrDecl, router) { + var state = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isStateDeclaration(stateOrDecl) ? stateOrDecl.$$state() : stateOrDecl; + /** + * Handles match by transitioning to matched state + * + * First checks if the router should start a new transition. + * A new transition is not required if the current state's URL + * and the new URL are already identical + */ + var handler = function (match) { + var $state = router.stateService; + var globals = router.globals; + if ($state.href(state, match) !== $state.href(globals.current, globals.params)) { + $state.transitionTo(state, match, { inherit: true, source: 'url' }); + } + }; + var details = { state: state, type: 'STATE' }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(this.fromUrlMatcher(state.url, handler), details); + }; + /** + * A UrlRule which matches based on a regular expression + * + * The `handler` may be either a [[UrlRuleHandlerFn]] or a string. + * + * ## Handler as a function + * + * If `handler` is a function, the function is invoked with: + * + * - regexp match array (from `regexp`) + * - url: the current Url ([[UrlParts]]) + * - router: the router object ([[UIRouter]]) + * + * #### Example: + * ```js + * var rule = factory.fromRegExp(/^\/foo\/(bar|baz)$/, match => "/home/" + match[1]) + * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ] + * var result = rule.handler(match); // '/home/bar' + * ``` + * + * ## Handler as string + * + * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked. + * The string is first interpolated using `string.replace()` style pattern. + * + * #### Example: + * ```js + * var rule = factory.fromRegExp(/^\/foo\/(bar|baz)$/, "/home/$1") + * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ] + * var result = rule.handler(match); // '/home/bar' + * ``` + */ + UrlRuleFactory.prototype.fromRegExp = function (regexp, handler) { + if (regexp.global || regexp.sticky) + throw new Error('Rule RegExp must not be global or sticky'); + /** + * If handler is a string, the url will be replaced by the string. + * If the string has any String.replace() style variables in it (like `$2`), + * they will be replaced by the captures from [[match]] + */ + var redirectUrlTo = function (match) { + // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern + return handler.replace(/\$(\$|\d{1,2})/, function (m, what) { return match[what === '$' ? 0 : Number(what)]; }); + }; + var _handler = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(handler) ? redirectUrlTo : handler; + var matchParamsFromRegexp = function (url) { return regexp.exec(url.path); }; + var details = { regexp: regexp, type: 'REGEXP' }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(new BaseUrlRule(matchParamsFromRegexp, _handler), details); + }; + UrlRuleFactory.isUrlRule = function (obj) { return obj && ['type', 'match', 'handler'].every(function (key) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(obj[key]); }); }; + return UrlRuleFactory; +}()); + +/** + * A base rule which calls `match` + * + * The value from the `match` function is passed through to the `handler`. + * @internal + */ +var BaseUrlRule = /** @class */ (function () { + function BaseUrlRule(match, handler) { + var _this = this; + this.match = match; + this.type = 'RAW'; + this.matchPriority = function (match) { return 0 - _this.$id; }; + this.handler = handler || _common_common__WEBPACK_IMPORTED_MODULE_2__.identity; + } + return BaseUrlRule; +}()); + +//# sourceMappingURL=urlRule.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlRules.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRules": () => (/* binding */ UrlRules) +/* harmony export */ }); +/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../state */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); + + + + +var prioritySort = function (a, b) { return (b.priority || 0) - (a.priority || 0); }; +var typeSort = function (a, b) { + var weights = { STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1 }; + return (weights[a.type] || 0) - (weights[b.type] || 0); +}; +var urlMatcherSort = function (a, b) { + return !a.urlMatcher || !b.urlMatcher ? 0 : _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher.compare(a.urlMatcher, b.urlMatcher); +}; +var idSort = function (a, b) { + // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL + var useMatchPriority = { STATE: true, URLMATCHER: true }; + var equal = useMatchPriority[a.type] && useMatchPriority[b.type]; + return equal ? 0 : (a.$id || 0) - (b.$id || 0); +}; +/** + * Default rule priority sorting function. + * + * Sorts rules by: + * + * - Explicit priority (set rule priority using [[UrlRules.when]]) + * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1) + * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule. + * - Rule registration order (for rule types other than STATE and URLMATCHER) + * - Equally sorted State and UrlMatcher rules will each match the URL. + * Then, the *best* match is chosen based on how many parameter values were matched. + */ +var defaultRuleSortFn; +defaultRuleSortFn = function (a, b) { + var cmp = prioritySort(a, b); + if (cmp !== 0) + return cmp; + cmp = typeSort(a, b); + if (cmp !== 0) + return cmp; + cmp = urlMatcherSort(a, b); + if (cmp !== 0) + return cmp; + return idSort(a, b); +}; +function getHandlerFn(handler) { + if (!(0,_common__WEBPACK_IMPORTED_MODULE_2__.isFunction)(handler) && !(0,_common__WEBPACK_IMPORTED_MODULE_2__.isString)(handler) && !(0,_common__WEBPACK_IMPORTED_MODULE_2__.is)(_state__WEBPACK_IMPORTED_MODULE_0__.TargetState)(handler) && !_state__WEBPACK_IMPORTED_MODULE_0__.TargetState.isDef(handler)) { + throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property"); + } + return (0,_common__WEBPACK_IMPORTED_MODULE_2__.isFunction)(handler) ? handler : (0,_common__WEBPACK_IMPORTED_MODULE_2__.val)(handler); +} +/** + * API for managing URL rules + * + * This API is used to create and manage URL rules. + * URL rules are a mechanism to respond to specific URL patterns. + * + * The most commonly used methods are [[otherwise]] and [[when]]. + * + * This API is found at `router.urlService.rules` (see: [[UIRouter.urlService]], [[URLService.rules]]) + */ +var UrlRules = /** @class */ (function () { + /** @internal */ + function UrlRules(/** @internal */ router) { + this.router = router; + /** @internal */ this._sortFn = defaultRuleSortFn; + /** @internal */ this._rules = []; + /** @internal */ this._id = 0; + this.urlRuleFactory = new _urlRule__WEBPACK_IMPORTED_MODULE_3__.UrlRuleFactory(router); + } + /** @internal */ + UrlRules.prototype.dispose = function (router) { + this._rules = []; + delete this._otherwiseFn; + }; + /** + * Defines the initial state, path, or behavior to use when the app starts. + * + * This rule defines the initial/starting state for the application. + * + * This rule is triggered the first time the URL is checked (when the app initially loads). + * The rule is triggered only when the url matches either `""` or `"/"`. + * + * Note: The rule is intended to be used when the root of the application is directly linked to. + * When the URL is *not* `""` or `"/"` and doesn't match other rules, the [[otherwise]] rule is triggered. + * This allows 404-like behavior when an unknown URL is deep-linked. + * + * #### Example: + * Start app at `home` state. + * ```js + * .initial({ state: 'home' }); + * ``` + * + * #### Example: + * Start app at `/home` (by url) + * ```js + * .initial('/home'); + * ``` + * + * #### Example: + * When no other url rule matches, go to `home` state + * ```js + * .initial((matchValue, url, router) => { + * console.log('initial state'); + * return { state: 'home' }; + * }) + * ``` + * + * @param handler The initial state or url path, or a function which returns the state or url path (or performs custom logic). + */ + UrlRules.prototype.initial = function (handler) { + var handlerFn = getHandlerFn(handler); + var matchFn = function (urlParts, router) { + return router.globals.transitionHistory.size() === 0 && !!/^\/?$/.exec(urlParts.path); + }; + this.rule(this.urlRuleFactory.create(matchFn, handlerFn)); + }; + /** + * Defines the state, url, or behavior to use when no other rule matches the URL. + * + * This rule is matched when *no other rule* matches. + * It is generally used to handle unknown URLs (similar to "404" behavior, but on the client side). + * + * - If `handler` a string, it is treated as a url redirect + * + * #### Example: + * When no other url rule matches, redirect to `/index` + * ```js + * .otherwise('/index'); + * ``` + * + * - If `handler` is an object with a `state` property, the state is activated. + * + * #### Example: + * When no other url rule matches, redirect to `home` and provide a `dashboard` parameter value. + * ```js + * .otherwise({ state: 'home', params: { dashboard: 'default' } }); + * ``` + * + * - If `handler` is a function, the function receives the current url ([[UrlParts]]) and the [[UIRouter]] object. + * The function can perform actions, and/or return a value. + * + * #### Example: + * When no other url rule matches, manually trigger a transition to the `home` state + * ```js + * .otherwise((matchValue, urlParts, router) => { + * router.stateService.go('home'); + * }); + * ``` + * + * #### Example: + * When no other url rule matches, go to `home` state + * ```js + * .otherwise((matchValue, urlParts, router) => { + * return { state: 'home' }; + * }); + * ``` + * + * @param handler The url path to redirect to, or a function which returns the url path (or performs custom logic). + */ + UrlRules.prototype.otherwise = function (handler) { + var handlerFn = getHandlerFn(handler); + this._otherwiseFn = this.urlRuleFactory.create((0,_common__WEBPACK_IMPORTED_MODULE_2__.val)(true), handlerFn); + this._sorted = false; + }; + /** + * Remove a rule previously registered + * + * @param rule the matcher rule that was previously registered using [[rule]] + */ + UrlRules.prototype.removeRule = function (rule) { + (0,_common__WEBPACK_IMPORTED_MODULE_2__.removeFrom)(this._rules, rule); + }; + /** + * Manually adds a URL Rule. + * + * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]]. + * This api can be used directly for more control (to register a [[BaseUrlRule]], for example). + * Rules can be created using [[urlRuleFactory]], or created manually as simple objects. + * + * A rule should have a `match` function which returns truthy if the rule matched. + * It should also have a `handler` function which is invoked if the rule is the best match. + * + * @return a function that deregisters the rule + */ + UrlRules.prototype.rule = function (rule) { + var _this = this; + if (!_urlRule__WEBPACK_IMPORTED_MODULE_3__.UrlRuleFactory.isUrlRule(rule)) + throw new Error('invalid rule'); + rule.$id = this._id++; + rule.priority = rule.priority || 0; + this._rules.push(rule); + this._sorted = false; + return function () { return _this.removeRule(rule); }; + }; + /** + * Gets all registered rules + * + * @returns an array of all the registered rules + */ + UrlRules.prototype.rules = function () { + this.ensureSorted(); + return this._rules.concat(this._otherwiseFn ? [this._otherwiseFn] : []); + }; + /** + * Defines URL Rule priorities + * + * More than one rule ([[UrlRule]]) might match a given URL. + * This `compareFn` is used to sort the rules by priority. + * Higher priority rules should sort earlier. + * + * The [[defaultRuleSortFn]] is used by default. + * + * You only need to call this function once. + * The `compareFn` will be used to sort the rules as each is registered. + * + * If called without any parameter, it will re-sort the rules. + * + * --- + * + * Url rules may come from multiple sources: states's urls ([[StateDeclaration.url]]), [[when]], and [[rule]]. + * Each rule has a (user-provided) [[UrlRule.priority]], a [[UrlRule.type]], and a [[UrlRule.$id]] + * The `$id` is is the order in which the rule was registered. + * + * The sort function should use these data, or data found on a specific type + * of [[UrlRule]] (such as [[StateRule.state]]), to order the rules as desired. + * + * #### Example: + * This compare function prioritizes rules by the order in which the rules were registered. + * A rule registered earlier has higher priority. + * + * ```js + * function compareFn(a, b) { + * return a.$id - b.$id; + * } + * ``` + * + * @param compareFn a function that compares to [[UrlRule]] objects. + * The `compareFn` should abide by the `Array.sort` compare function rules. + * Given two rules, `a` and `b`, return a negative number if `a` should be higher priority. + * Return a positive number if `b` should be higher priority. + * Return `0` if the rules are identical. + * + * See the [mozilla reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description) + * for details. + */ + UrlRules.prototype.sort = function (compareFn) { + var sorted = this.stableSort(this._rules, (this._sortFn = compareFn || this._sortFn)); + // precompute _sortGroup values and apply to each rule + var group = 0; + for (var i = 0; i < sorted.length; i++) { + sorted[i]._group = group; + if (i < sorted.length - 1 && this._sortFn(sorted[i], sorted[i + 1]) !== 0) { + group++; + } + } + this._rules = sorted; + this._sorted = true; + }; + /** @internal */ + UrlRules.prototype.ensureSorted = function () { + this._sorted || this.sort(); + }; + /** @internal */ + UrlRules.prototype.stableSort = function (arr, compareFn) { + var arrOfWrapper = arr.map(function (elem, idx) { return ({ elem: elem, idx: idx }); }); + arrOfWrapper.sort(function (wrapperA, wrapperB) { + var cmpDiff = compareFn(wrapperA.elem, wrapperB.elem); + return cmpDiff === 0 ? wrapperA.idx - wrapperB.idx : cmpDiff; + }); + return arrOfWrapper.map(function (wrapper) { return wrapper.elem; }); + }; + /** + * Registers a `matcher` and `handler` for custom URLs handling. + * + * The `matcher` can be: + * + * - a [[UrlMatcher]]: See: [[UrlMatcherFactory.compile]] + * - a `string`: The string is compiled to a [[UrlMatcher]] + * - a `RegExp`: The regexp is used to match the url. + * + * The `handler` can be: + * + * - a string: The url is redirected to the value of the string. + * - a function: The url is redirected to the return value of the function. + * + * --- + * + * When the `handler` is a `string` and the `matcher` is a `UrlMatcher` (or string), the redirect + * string is interpolated with parameter values. + * + * #### Example: + * When the URL is `/foo/123` the rule will redirect to `/bar/123`. + * ```js + * .when("/foo/:param1", "/bar/:param1") + * ``` + * + * --- + * + * When the `handler` is a string and the `matcher` is a `RegExp`, the redirect string is + * interpolated with capture groups from the RegExp. + * + * #### Example: + * When the URL is `/foo/123` the rule will redirect to `/bar/123`. + * ```js + * .when(new RegExp("^/foo/(.*)$"), "/bar/$1"); + * ``` + * + * --- + * + * When the handler is a function, it receives the matched value, the current URL, and the `UIRouter` object (See [[UrlRuleHandlerFn]]). + * The "matched value" differs based on the `matcher`. + * For [[UrlMatcher]]s, it will be the matched state params. + * For `RegExp`, it will be the match array from `regexp.exec()`. + * + * If the handler returns a string, the URL is redirected to the string. + * + * #### Example: + * When the URL is `/foo/123` the rule will redirect to `/bar/123`. + * ```js + * .when(new RegExp("^/foo/(.*)$"), match => "/bar/" + match[1]); + * ``` + * + * Note: the `handler` may also invoke arbitrary code, such as `$state.go()` + * + * @param matcher A pattern `string` to match, compiled as a [[UrlMatcher]], or a `RegExp`. + * @param handler The path to redirect to, or a function that returns the path. + * @param options `{ priority: number }` + * + * @return the registered [[UrlRule]] + */ + UrlRules.prototype.when = function (matcher, handler, options) { + var rule = this.urlRuleFactory.create(matcher, handler); + if ((0,_common__WEBPACK_IMPORTED_MODULE_2__.isDefined)(options && options.priority)) + rule.priority = options.priority; + this.rule(rule); + return rule; + }; + return UrlRules; +}()); + +//# sourceMappingURL=urlRules.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlService.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlService.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlService": () => (/* binding */ UrlService) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlRules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlRules */ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js"); +/* harmony import */ var _urlConfig__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./urlConfig */ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js"); +/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../state */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); + + + + +/** + * API for URL management + */ +var UrlService = /** @class */ (function () { + /** @internal */ + function UrlService(/** @internal */ router) { + var _this = this; + this.router = router; + /** @internal */ this.interceptDeferred = false; + /** + * The nested [[UrlRules]] API for managing URL rules and rewrites + * + * See: [[UrlRules]] for details + */ + this.rules = new _urlRules__WEBPACK_IMPORTED_MODULE_1__.UrlRules(this.router); + /** + * The nested [[UrlConfig]] API to configure the URL and retrieve URL information + * + * See: [[UrlConfig]] for details + */ + this.config = new _urlConfig__WEBPACK_IMPORTED_MODULE_2__.UrlConfig(this.router); + // Delegate these calls to the current LocationServices implementation + /** + * Gets the current url, or updates the url + * + * ### Getting the current URL + * + * When no arguments are passed, returns the current URL. + * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values. + * + * For example, the URL may be stored in the hash ([[HashLocationServices]]) or + * have a base HREF prepended ([[PushStateLocationServices]]). + * + * The raw URL in the browser might be: + * + * ``` + * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor + * ``` + * + * or + * + * ``` + * http://mysite.com/basepath/internal/path/123?param1=foo#anchor + * ``` + * + * then this method returns: + * + * ``` + * /internal/path/123?param1=foo#anchor + * ``` + * + * + * #### Example: + * ```js + * locationServices.url(); // "/some/path?query=value#anchor" + * ``` + * + * ### Updating the URL + * + * When `newurl` arguments is provided, changes the URL to reflect `newurl` + * + * #### Example: + * ```js + * locationServices.url("/some/path?query=value#anchor", true); + * ``` + * + * @param newurl The new value for the URL. + * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values. + * It should not include the protocol, site, port, or base path of an absolute HREF. + * @param replace When true, replaces the current history entry (instead of appending it) with this new url + * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it) + * + * @return the url (after potentially being processed) + */ + this.url = function (newurl, replace, state) { + return _this.router.locationService.url(newurl, replace, state); + }; + /** + * Gets the path part of the current url + * + * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path` + * + * @return the path portion of the url + */ + this.path = function () { return _this.router.locationService.path(); }; + /** + * Gets the search part of the current url as an object + * + * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }` + * + * @return the search (query) portion of the url, as an object + */ + this.search = function () { return _this.router.locationService.search(); }; + /** + * Gets the hash part of the current url + * + * If the current URL is `/some/path?query=value#anchor`, this returns `anchor` + * + * @return the hash (anchor) portion of the url + */ + this.hash = function () { return _this.router.locationService.hash(); }; + /** + * @internal + * + * Registers a low level url change handler + * + * Note: Because this is a low level handler, it's not recommended for general use. + * + * #### Example: + * ```js + * let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt)); + * ``` + * + * @param callback a function that will be called when the url is changing + * @return a function that de-registers the callback + */ + this.onChange = function (callback) { return _this.router.locationService.onChange(callback); }; + } + /** @internal */ + UrlService.prototype.dispose = function () { + this.listen(false); + this.rules.dispose(); + }; + /** + * Gets the current URL parts + * + * This method returns the different parts of the current URL (the [[path]], [[search]], and [[hash]]) as a [[UrlParts]] object. + */ + UrlService.prototype.parts = function () { + return { path: this.path(), search: this.search(), hash: this.hash() }; + }; + /** + * Activates the best rule for the current URL + * + * Checks the current URL for a matching [[UrlRule]], then invokes that rule's handler. + * This method is called internally any time the URL has changed. + * + * This effectively activates the state (or redirect, etc) which matches the current URL. + * + * #### Example: + * ```js + * urlService.deferIntercept(); + * + * fetch('/states.json').then(resp => resp.json()).then(data => { + * data.forEach(state => $stateRegistry.register(state)); + * urlService.listen(); + * // Find the matching URL and invoke the handler. + * urlService.sync(); + * }); + * ``` + */ + UrlService.prototype.sync = function (evt) { + if (evt && evt.defaultPrevented) + return; + var _a = this.router, urlService = _a.urlService, stateService = _a.stateService; + var url = { path: urlService.path(), search: urlService.search(), hash: urlService.hash() }; + var best = this.match(url); + var applyResult = (0,_common__WEBPACK_IMPORTED_MODULE_0__.pattern)([ + [_common__WEBPACK_IMPORTED_MODULE_0__.isString, function (newurl) { return urlService.url(newurl, true); }], + [_state__WEBPACK_IMPORTED_MODULE_3__.TargetState.isDef, function (def) { return stateService.go(def.state, def.params, def.options); }], + [(0,_common__WEBPACK_IMPORTED_MODULE_0__.is)(_state__WEBPACK_IMPORTED_MODULE_3__.TargetState), function (target) { return stateService.go(target.state(), target.params(), target.options()); }], + ]); + applyResult(best && best.rule.handler(best.match, url, this.router)); + }; + /** + * Starts or stops listening for URL changes + * + * Call this sometime after calling [[deferIntercept]] to start monitoring the url. + * This causes UI-Router to start listening for changes to the URL, if it wasn't already listening. + * + * If called with `false`, UI-Router will stop listening (call listen(true) to start listening again). + * + * #### Example: + * ```js + * urlService.deferIntercept(); + * + * fetch('/states.json').then(resp => resp.json()).then(data => { + * data.forEach(state => $stateRegistry.register(state)); + * // Start responding to URL changes + * urlService.listen(); + * urlService.sync(); + * }); + * ``` + * + * @param enabled `true` or `false` to start or stop listening to URL changes + */ + UrlService.prototype.listen = function (enabled) { + var _this = this; + if (enabled === false) { + this._stopListeningFn && this._stopListeningFn(); + delete this._stopListeningFn; + } + else { + return (this._stopListeningFn = + this._stopListeningFn || this.router.urlService.onChange(function (evt) { return _this.sync(evt); })); + } + }; + /** + * Disables monitoring of the URL. + * + * Call this method before UI-Router has bootstrapped. + * It will stop UI-Router from performing the initial url sync. + * + * This can be useful to perform some asynchronous initialization before the router starts. + * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL. + * + * #### Example: + * ```js + * // Prevent UI-Router from automatically intercepting URL changes when it starts; + * urlService.deferIntercept(); + * + * fetch('/states.json').then(resp => resp.json()).then(data => { + * data.forEach(state => $stateRegistry.register(state)); + * urlService.listen(); + * urlService.sync(); + * }); + * ``` + * + * @param defer Indicates whether to defer location change interception. + * Passing no parameter is equivalent to `true`. + */ + UrlService.prototype.deferIntercept = function (defer) { + if (defer === undefined) + defer = true; + this.interceptDeferred = defer; + }; + /** + * Matches a URL + * + * Given a URL (as a [[UrlParts]] object), check all rules and determine the best matching rule. + * Return the result as a [[MatchResult]]. + */ + UrlService.prototype.match = function (url) { + var _this = this; + url = (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ path: '', search: {}, hash: '' }, url); + var rules = this.rules.rules(); + // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined + var checkRule = function (rule) { + var match = rule.match(url, _this.router); + return match && { match: match, rule: rule, weight: rule.matchPriority(match) }; + }; + // The rules are pre-sorted. + // - Find the first matching rule. + // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`. + // - Choose the rule with the highest match weight. + var best; + for (var i = 0; i < rules.length; i++) { + // Stop when there is a 'best' rule and the next rule sorts differently than it. + if (best && best.rule._group !== rules[i]._group) + break; + var current = checkRule(rules[i]); + // Pick the best MatchResult + best = !best || (current && current.weight > best.weight) ? current : best; + } + return best; + }; + return UrlService; +}()); + +//# sourceMappingURL=urlService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla.js": +/*!********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _vanilla_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vanilla/index */ "./node_modules/@uirouter/core/lib-esm/vanilla/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _vanilla_index__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _vanilla_index__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); + +//# sourceMappingURL=vanilla.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "BaseLocationServices": () => (/* binding */ BaseLocationServices) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); + + +/** A base `LocationServices` */ +var BaseLocationServices = /** @class */ (function () { + function BaseLocationServices(router, fireAfterUpdate) { + var _this = this; + this.fireAfterUpdate = fireAfterUpdate; + this._listeners = []; + this._listener = function (evt) { return _this._listeners.forEach(function (cb) { return cb(evt); }); }; + this.hash = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).hash; }; + this.path = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).path; }; + this.search = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getParams)((0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).search); }; + this._location = _common__WEBPACK_IMPORTED_MODULE_0__.root.location; + this._history = _common__WEBPACK_IMPORTED_MODULE_0__.root.history; + } + BaseLocationServices.prototype.url = function (url, replace) { + if (replace === void 0) { replace = true; } + if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isDefined)(url) && url !== this._get()) { + this._set(null, null, url, replace); + if (this.fireAfterUpdate) { + this._listeners.forEach(function (cb) { return cb({ url: url }); }); + } + } + return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.buildUrl)(this); + }; + BaseLocationServices.prototype.onChange = function (cb) { + var _this = this; + this._listeners.push(cb); + return function () { return (0,_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._listeners, cb); }; + }; + BaseLocationServices.prototype.dispose = function (router) { + (0,_common__WEBPACK_IMPORTED_MODULE_0__.deregAll)(this._listeners); + }; + return BaseLocationServices; +}()); + +//# sourceMappingURL=baseLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "BrowserLocationConfig": () => (/* binding */ BrowserLocationConfig) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + +/** A `LocationConfig` that delegates to the browser's `location` object */ +var BrowserLocationConfig = /** @class */ (function () { + function BrowserLocationConfig(router, _isHtml5) { + if (_isHtml5 === void 0) { _isHtml5 = false; } + this._isHtml5 = _isHtml5; + this._baseHref = undefined; + this._hashPrefix = ''; + } + BrowserLocationConfig.prototype.port = function () { + if (location.port) { + return Number(location.port); + } + return this.protocol() === 'https' ? 443 : 80; + }; + BrowserLocationConfig.prototype.protocol = function () { + return location.protocol.replace(/:/g, ''); + }; + BrowserLocationConfig.prototype.host = function () { + return location.hostname; + }; + BrowserLocationConfig.prototype.html5Mode = function () { + return this._isHtml5; + }; + BrowserLocationConfig.prototype.hashPrefix = function (newprefix) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newprefix) ? (this._hashPrefix = newprefix) : this._hashPrefix; + }; + BrowserLocationConfig.prototype.baseHref = function (href) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(href)) + this._baseHref = href; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined)(this._baseHref)) + this._baseHref = this.getBaseHref(); + return this._baseHref; + }; + BrowserLocationConfig.prototype.getBaseHref = function () { + var baseTag = document.getElementsByTagName('base')[0]; + if (baseTag && baseTag.href) { + return baseTag.href.replace(/^([^/:]*:)?\/\/[^/]*/, ''); + } + return this._isHtml5 ? '/' : location.pathname || '/'; + }; + BrowserLocationConfig.prototype.dispose = function () { }; + return BrowserLocationConfig; +}()); + +//# sourceMappingURL=browserLocationConfig.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "HashLocationService": () => (/* binding */ HashLocationService) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + + +/** A `LocationServices` that uses the browser hash "#" to get/set the current location */ +var HashLocationService = /** @class */ (function (_super) { + __extends(HashLocationService, _super); + function HashLocationService(router) { + var _this = _super.call(this, router, false) || this; + _common__WEBPACK_IMPORTED_MODULE_0__.root.addEventListener('hashchange', _this._listener, false); + return _this; + } + HashLocationService.prototype._get = function () { + return (0,_common__WEBPACK_IMPORTED_MODULE_0__.trimHashVal)(this._location.hash); + }; + HashLocationService.prototype._set = function (state, title, url, replace) { + this._location.hash = url; + }; + HashLocationService.prototype.dispose = function (router) { + _super.prototype.dispose.call(this, router); + _common__WEBPACK_IMPORTED_MODULE_0__.root.removeEventListener('hashchange', this._listener); + }; + return HashLocationService; +}(_baseLocationService__WEBPACK_IMPORTED_MODULE_1__.BaseLocationServices)); + +//# sourceMappingURL=hashLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/index.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$q": () => (/* reexport safe */ _q__WEBPACK_IMPORTED_MODULE_1__.$q), +/* harmony export */ "$injector": () => (/* reexport safe */ _injector__WEBPACK_IMPORTED_MODULE_2__.$injector), +/* harmony export */ "BaseLocationServices": () => (/* reexport safe */ _baseLocationService__WEBPACK_IMPORTED_MODULE_3__.BaseLocationServices), +/* harmony export */ "HashLocationService": () => (/* reexport safe */ _hashLocationService__WEBPACK_IMPORTED_MODULE_4__.HashLocationService), +/* harmony export */ "MemoryLocationService": () => (/* reexport safe */ _memoryLocationService__WEBPACK_IMPORTED_MODULE_5__.MemoryLocationService), +/* harmony export */ "PushStateLocationService": () => (/* reexport safe */ _pushStateLocationService__WEBPACK_IMPORTED_MODULE_6__.PushStateLocationService), +/* harmony export */ "MemoryLocationConfig": () => (/* reexport safe */ _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_7__.MemoryLocationConfig), +/* harmony export */ "BrowserLocationConfig": () => (/* reexport safe */ _browserLocationConfig__WEBPACK_IMPORTED_MODULE_8__.BrowserLocationConfig), +/* harmony export */ "buildUrl": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.buildUrl), +/* harmony export */ "getParams": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.getParams), +/* harmony export */ "keyValsToObjectR": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.keyValsToObjectR), +/* harmony export */ "locationPluginFactory": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.locationPluginFactory), +/* harmony export */ "parseUrl": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.parseUrl), +/* harmony export */ "hashLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.hashLocationPlugin), +/* harmony export */ "memoryLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.memoryLocationPlugin), +/* harmony export */ "pushStateLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.pushStateLocationPlugin), +/* harmony export */ "servicesPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.servicesPlugin) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/vanilla/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _q__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./q */ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js"); +/* harmony import */ var _injector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./injector */ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js"); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +/* harmony import */ var _hashLocationService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hashLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js"); +/* harmony import */ var _memoryLocationService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./memoryLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js"); +/* harmony import */ var _pushStateLocationService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./pushStateLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js"); +/* harmony import */ var _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./memoryLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js"); +/* harmony import */ var _browserLocationConfig__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./browserLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js"); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); +/* harmony import */ var _plugins__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./plugins */ "./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js"); +/** + * Naive, pure JS implementation of core ui-router services + * + * @packageDocumentation + */ + + + + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/injector.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$injector": () => (/* binding */ $injector) +/* harmony export */ }); +/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + +// globally available injectables +var globals = {}; +var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm; +var ARGUMENT_NAMES = /([^\s,]+)/g; +/** + * A basic angular1-like injector api + * + * This object implements four methods similar to the + * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector) + * + * UI-Router evolved from an angular 1 library to a framework agnostic library. + * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection. + * + * This object provides a naive implementation of a globally scoped dependency injection system. + * It supports the following DI approaches: + * + * ### Function parameter names + * + * A function's `.toString()` is called, and the parameter names are parsed. + * This only works when the parameter names aren't "mangled" by a minifier such as UglifyJS. + * + * ```js + * function injectedFunction(FooService, BarService) { + * // FooService and BarService are injected + * } + * ``` + * + * ### Function annotation + * + * A function may be annotated with an array of dependency names as the `$inject` property. + * + * ```js + * injectedFunction.$inject = [ 'FooService', 'BarService' ]; + * function injectedFunction(fs, bs) { + * // FooService and BarService are injected as fs and bs parameters + * } + * ``` + * + * ### Array notation + * + * An array provides the names of the dependencies to inject (as strings). + * The function is the last element of the array. + * + * ```js + * [ 'FooService', 'BarService', function (fs, bs) { + * // FooService and BarService are injected as fs and bs parameters + * }] + * ``` + * + * @type {$InjectorLike} + */ +var $injector = { + /** Gets an object from DI based on a string token */ + get: function (name) { return globals[name]; }, + /** Returns true if an object named `name` exists in global DI */ + has: function (name) { return $injector.get(name) != null; }, + /** + * Injects a function + * + * @param fn the function to inject + * @param context the function's `this` binding + * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }` + */ + invoke: function (fn, context, locals) { + var all = (0,_common_index__WEBPACK_IMPORTED_MODULE_0__.extend)({}, globals, locals || {}); + var params = $injector.annotate(fn); + var ensureExist = (0,_common_index__WEBPACK_IMPORTED_MODULE_0__.assertPredicate)(function (key) { return all.hasOwnProperty(key); }, function (key) { return "DI can't find injectable: '" + key + "'"; }); + var args = params.filter(ensureExist).map(function (x) { return all[x]; }); + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isFunction)(fn)) + return fn.apply(context, args); + else + return fn.slice(-1)[0].apply(context, args); + }, + /** + * Returns a function's dependencies + * + * Analyzes a function (or array) and returns an array of DI tokens that the function requires. + * @return an array of `string`s + */ + annotate: function (fn) { + if (!(0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isInjectable)(fn)) + throw new Error("Not an injectable function: " + fn); + if (fn && fn.$inject) + return fn.$inject; + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isArray)(fn)) + return fn.slice(0, -1); + var fnStr = fn.toString().replace(STRIP_COMMENTS, ''); + var result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES); + return result || []; + }, +}; +//# sourceMappingURL=injector.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/interface.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/interface.js ***! + \******************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "MemoryLocationConfig": () => (/* binding */ MemoryLocationConfig) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + + +/** A `LocationConfig` mock that gets/sets all config from an in-memory object */ +var MemoryLocationConfig = /** @class */ (function () { + function MemoryLocationConfig() { + var _this = this; + this.dispose = _common_common__WEBPACK_IMPORTED_MODULE_1__.noop; + this._baseHref = ''; + this._port = 80; + this._protocol = 'http'; + this._host = 'localhost'; + this._hashPrefix = ''; + this.port = function () { return _this._port; }; + this.protocol = function () { return _this._protocol; }; + this.host = function () { return _this._host; }; + this.baseHref = function () { return _this._baseHref; }; + this.html5Mode = function () { return false; }; + this.hashPrefix = function (newval) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newval) ? (_this._hashPrefix = newval) : _this._hashPrefix); }; + } + return MemoryLocationConfig; +}()); + +//# sourceMappingURL=memoryLocationConfig.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "MemoryLocationService": () => (/* binding */ MemoryLocationService) +/* harmony export */ }); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + +/** A `LocationServices` that gets/sets the current location from an in-memory object */ +var MemoryLocationService = /** @class */ (function (_super) { + __extends(MemoryLocationService, _super); + function MemoryLocationService(router) { + return _super.call(this, router, true) || this; + } + MemoryLocationService.prototype._get = function () { + return this._url; + }; + MemoryLocationService.prototype._set = function (state, title, url, replace) { + this._url = url; + }; + return MemoryLocationService; +}(_baseLocationService__WEBPACK_IMPORTED_MODULE_0__.BaseLocationServices)); + +//# sourceMappingURL=memoryLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js": +/*!****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "servicesPlugin": () => (/* binding */ servicesPlugin), +/* harmony export */ "hashLocationPlugin": () => (/* binding */ hashLocationPlugin), +/* harmony export */ "pushStateLocationPlugin": () => (/* binding */ pushStateLocationPlugin), +/* harmony export */ "memoryLocationPlugin": () => (/* binding */ memoryLocationPlugin) +/* harmony export */ }); +/* harmony import */ var _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./browserLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js"); +/* harmony import */ var _hashLocationService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hashLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js"); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); +/* harmony import */ var _pushStateLocationService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pushStateLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js"); +/* harmony import */ var _memoryLocationService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./memoryLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js"); +/* harmony import */ var _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./memoryLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js"); +/* harmony import */ var _injector__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./injector */ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js"); +/* harmony import */ var _q__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./q */ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + + + + + + + + + +function servicesPlugin(router) { + _common_coreservices__WEBPACK_IMPORTED_MODULE_8__.services.$injector = _injector__WEBPACK_IMPORTED_MODULE_6__.$injector; + _common_coreservices__WEBPACK_IMPORTED_MODULE_8__.services.$q = _q__WEBPACK_IMPORTED_MODULE_7__.$q; + return { name: 'vanilla.services', $q: _q__WEBPACK_IMPORTED_MODULE_7__.$q, $injector: _injector__WEBPACK_IMPORTED_MODULE_6__.$injector, dispose: function () { return null; } }; +} +/** A `UIRouterPlugin` uses the browser hash to get/set the current location */ +var hashLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.hashBangLocation', false, _hashLocationService__WEBPACK_IMPORTED_MODULE_1__.HashLocationService, _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__.BrowserLocationConfig); +/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */ +var pushStateLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.pushStateLocation', true, _pushStateLocationService__WEBPACK_IMPORTED_MODULE_3__.PushStateLocationService, _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__.BrowserLocationConfig); +/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */ +var memoryLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.memoryLocation', false, _memoryLocationService__WEBPACK_IMPORTED_MODULE_4__.MemoryLocationService, _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_5__.MemoryLocationConfig); +//# sourceMappingURL=plugins.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PushStateLocationService": () => (/* binding */ PushStateLocationService) +/* harmony export */ }); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + + +/** + * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis + * + * Uses `history.pushState` and `history.replaceState` + */ +var PushStateLocationService = /** @class */ (function (_super) { + __extends(PushStateLocationService, _super); + function PushStateLocationService(router) { + var _this = _super.call(this, router, true) || this; + _this._config = router.urlService.config; + _common__WEBPACK_IMPORTED_MODULE_1__.root.addEventListener('popstate', _this._listener, false); + return _this; + } + /** + * Gets the base prefix without: + * - trailing slash + * - trailing filename + * - protocol and hostname + * + * If , this returns '/base'. + * If , this returns '/foo/base'. + * If , this returns '/base'. + * If , this returns '/base'. + * If , this returns ''. + * If , this returns ''. + * If , this returns ''. + * + * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element + */ + PushStateLocationService.prototype._getBasePrefix = function () { + return (0,_common__WEBPACK_IMPORTED_MODULE_1__.stripLastPathElement)(this._config.baseHref()); + }; + PushStateLocationService.prototype._get = function () { + var _a = this._location, pathname = _a.pathname, hash = _a.hash, search = _a.search; + search = (0,_common__WEBPACK_IMPORTED_MODULE_1__.splitQuery)(search)[1]; // strip ? if found + hash = (0,_common__WEBPACK_IMPORTED_MODULE_1__.splitHash)(hash)[1]; // strip # if found + var basePrefix = this._getBasePrefix(); + var exactBaseHrefMatch = pathname === this._config.baseHref(); + var startsWithBase = pathname.substr(0, basePrefix.length) === basePrefix; + pathname = exactBaseHrefMatch ? '/' : startsWithBase ? pathname.substring(basePrefix.length) : pathname; + return pathname + (search ? '?' + search : '') + (hash ? '#' + hash : ''); + }; + PushStateLocationService.prototype._set = function (state, title, url, replace) { + var basePrefix = this._getBasePrefix(); + var slash = url && url[0] !== '/' ? '/' : ''; + var fullUrl = url === '' || url === '/' ? this._config.baseHref() : basePrefix + slash + url; + if (replace) { + this._history.replaceState(state, title, fullUrl); + } + else { + this._history.pushState(state, title, fullUrl); + } + }; + PushStateLocationService.prototype.dispose = function (router) { + _super.prototype.dispose.call(this, router); + _common__WEBPACK_IMPORTED_MODULE_1__.root.removeEventListener('popstate', this._listener); + }; + return PushStateLocationService; +}(_baseLocationService__WEBPACK_IMPORTED_MODULE_0__.BaseLocationServices)); + +//# sourceMappingURL=pushStateLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/q.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$q": () => (/* binding */ $q) +/* harmony export */ }); +/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + +/** + * An angular1-like promise api + * + * This object implements four methods similar to the + * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q) + * + * UI-Router evolved from an angular 1 library to a framework agnostic library. + * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection. + * + * This API provides native ES6 promise support wrapped as a $q-like API. + * Internally, UI-Router uses this $q object to perform promise operations. + * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular. + * + * $q-like promise api + */ +var $q = { + /** Normalizes a value as a promise */ + when: function (val) { return new Promise(function (resolve, reject) { return resolve(val); }); }, + /** Normalizes a value as a promise rejection */ + reject: function (val) { + return new Promise(function (resolve, reject) { + reject(val); + }); + }, + /** @returns a deferred object, which has `resolve` and `reject` functions */ + defer: function () { + var deferred = {}; + deferred.promise = new Promise(function (resolve, reject) { + deferred.resolve = resolve; + deferred.reject = reject; + }); + return deferred; + }, + /** Like Promise.all(), but also supports object key/promise notation like $q */ + all: function (promises) { + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isArray)(promises)) { + return Promise.all(promises); + } + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isObject)(promises)) { + // Convert promises map to promises array. + // When each promise resolves, map it to a tuple { key: key, val: val } + var chain = Object.keys(promises).map(function (key) { return promises[key].then(function (val) { return ({ key: key, val: val }); }); }); + // Then wait for all promises to resolve, and convert them back to an object + return $q.all(chain).then(function (values) { + return values.reduce(function (acc, tuple) { + acc[tuple.key] = tuple.val; + return acc; + }, {}); + }); + } + }, +}; +//# sourceMappingURL=q.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/utils.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "keyValsToObjectR": () => (/* binding */ keyValsToObjectR), +/* harmony export */ "getParams": () => (/* binding */ getParams), +/* harmony export */ "parseUrl": () => (/* binding */ parseUrl), +/* harmony export */ "buildUrl": () => (/* binding */ buildUrl), +/* harmony export */ "locationPluginFactory": () => (/* binding */ locationPluginFactory) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + +var keyValsToObjectR = function (accum, _a) { + var key = _a[0], val = _a[1]; + if (!accum.hasOwnProperty(key)) { + accum[key] = val; + } + else if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isArray)(accum[key])) { + accum[key].push(val); + } + else { + accum[key] = [accum[key], val]; + } + return accum; +}; +var getParams = function (queryString) { + return queryString.split('&').filter(_common__WEBPACK_IMPORTED_MODULE_0__.identity).map(_common__WEBPACK_IMPORTED_MODULE_0__.splitEqual).reduce(keyValsToObjectR, {}); +}; +function parseUrl(url) { + var orEmptyString = function (x) { return x || ''; }; + var _a = (0,_common__WEBPACK_IMPORTED_MODULE_0__.splitHash)(url).map(orEmptyString), beforehash = _a[0], hash = _a[1]; + var _b = (0,_common__WEBPACK_IMPORTED_MODULE_0__.splitQuery)(beforehash).map(orEmptyString), path = _b[0], search = _b[1]; + return { path: path, search: search, hash: hash, url: url }; +} +var buildUrl = function (loc) { + var path = loc.path(); + var searchObject = loc.search(); + var hash = loc.hash(); + var search = Object.keys(searchObject) + .map(function (key) { + var param = searchObject[key]; + var vals = (0,_common__WEBPACK_IMPORTED_MODULE_0__.isArray)(param) ? param : [param]; + return vals.map(function (val) { return key + '=' + val; }); + }) + .reduce(_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .join('&'); + return path + (search ? '?' + search : '') + (hash ? '#' + hash : ''); +}; +function locationPluginFactory(name, isHtml5, serviceClass, configurationClass) { + return function (uiRouter) { + var service = (uiRouter.locationService = new serviceClass(uiRouter)); + var configuration = (uiRouter.locationConfig = new configurationClass(uiRouter, isHtml5)); + function dispose(router) { + router.dispose(service); + router.dispose(configuration); + } + return { name: name, service: service, configuration: configuration, dispose: dispose }; + }; +} +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/view/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/view/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ViewService": () => (/* reexport safe */ _view__WEBPACK_IMPORTED_MODULE_1__.ViewService) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/view/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./view */ "./node_modules/@uirouter/core/lib-esm/view/view.js"); + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/view/interface.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/view/interface.js ***! + \***************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/view/view.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/view/view.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ViewService": () => (/* binding */ ViewService) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); + + + + +/** + * The View service + * + * This service pairs existing `ui-view` components (which live in the DOM) + * with view configs (from the state declaration objects: [[StateDeclaration.views]]). + * + * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]]. + * The views from exited states are deactivated via [[deactivateViewConfig]]. + * (See: the [[registerActivateViews]] Transition Hook) + * + * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]]. + * + * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]]) + * are configured with the matching [[ViewConfig]](s) + * + */ +var ViewService = /** @class */ (function () { + /** @internal */ + function ViewService(/** @internal */ router) { + var _this = this; + this.router = router; + /** @internal */ this._uiViews = []; + /** @internal */ this._viewConfigs = []; + /** @internal */ this._viewConfigFactories = {}; + /** @internal */ this._listeners = []; + /** @internal */ + this._pluginapi = { + _rootViewContext: this._rootViewContext.bind(this), + _viewConfigFactory: this._viewConfigFactory.bind(this), + _registeredUIView: function (id) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(_this._uiViews, function (view) { return _this.router.$id + "." + view.id === id; }); }, + _registeredUIViews: function () { return _this._uiViews; }, + _activeViewConfigs: function () { return _this._viewConfigs; }, + _onSync: function (listener) { + _this._listeners.push(listener); + return function () { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._listeners, listener); }; + }, + }; + } + /** + * Normalizes a view's name from a state.views configuration block. + * + * This should be used by a framework implementation to calculate the values for + * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]]. + * + * @param context the context object (state declaration) that the view belongs to + * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]] + * + * @returns the normalized uiViewName and uiViewContextAnchor that the view targets + */ + ViewService.normalizeUIViewTarget = function (context, rawViewName) { + if (rawViewName === void 0) { rawViewName = ''; } + // TODO: Validate incoming view name with a regexp to allow: + // ex: "view.name@foo.bar" , "^.^.view.name" , "view.name@^.^" , "" , + // "@" , "$default@^" , "!$default.$default" , "!foo.bar" + var viewAtContext = rawViewName.split('@'); + var uiViewName = viewAtContext[0] || '$default'; // default to unnamed view + var uiViewContextAnchor = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(viewAtContext[1]) ? viewAtContext[1] : '^'; // default to parent context + // Handle relative view-name sugar syntax. + // Matches rawViewName "^.^.^.foo.bar" into array: ["^.^.^.foo.bar", "^.^.^", "foo.bar"], + var relativeViewNameSugar = /^(\^(?:\.\^)*)\.(.*$)/.exec(uiViewName); + if (relativeViewNameSugar) { + // Clobbers existing contextAnchor (rawViewName validation will fix this) + uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to "^.^.^" + uiViewName = relativeViewNameSugar[2]; // set view-name to "foo.bar" + } + if (uiViewName.charAt(0) === '!') { + uiViewName = uiViewName.substr(1); + uiViewContextAnchor = ''; // target absolutely from root + } + // handle parent relative targeting "^.^.^" + var relativeMatch = /^(\^(?:\.\^)*)$/; + if (relativeMatch.exec(uiViewContextAnchor)) { + var anchorState = uiViewContextAnchor.split('.').reduce(function (anchor, x) { return anchor.parent; }, context); + uiViewContextAnchor = anchorState.name; + } + else if (uiViewContextAnchor === '.') { + uiViewContextAnchor = context.name; + } + return { uiViewName: uiViewName, uiViewContextAnchor: uiViewContextAnchor }; + }; + /** @internal */ + ViewService.prototype._rootViewContext = function (context) { + return (this._rootContext = context || this._rootContext); + }; + /** @internal */ + ViewService.prototype._viewConfigFactory = function (viewType, factory) { + this._viewConfigFactories[viewType] = factory; + }; + ViewService.prototype.createViewConfig = function (path, decl) { + var cfgFactory = this._viewConfigFactories[decl.$type]; + if (!cfgFactory) + throw new Error('ViewService: No view config factory registered for type ' + decl.$type); + var cfgs = cfgFactory(path, decl); + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(cfgs) ? cfgs : [cfgs]; + }; + /** + * Deactivates a ViewConfig. + * + * This function deactivates a `ViewConfig`. + * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired. + * + * @param viewConfig The ViewConfig view to deregister. + */ + ViewService.prototype.deactivateViewConfig = function (viewConfig) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceEvent('<- Removing', viewConfig); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(this._viewConfigs, viewConfig); + }; + ViewService.prototype.activateViewConfig = function (viewConfig) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceEvent('-> Registering', viewConfig); + this._viewConfigs.push(viewConfig); + }; + ViewService.prototype.sync = function () { + var _this = this; + var uiViewsByFqn = this._uiViews.map(function (uiv) { return [uiv.fqn, uiv]; }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs, {}); + // Return a weighted depth value for a uiView. + // The depth is the nesting depth of ui-views (based on FQN; times 10,000) + // plus the depth of the state that is populating the uiView + function uiViewDepth(uiView) { + var stateDepth = function (context) { return (context && context.parent ? stateDepth(context.parent) + 1 : 1); }; + return uiView.fqn.split('.').length * 10000 + stateDepth(uiView.creationContext); + } + // Return the ViewConfig's context's depth in the context tree. + function viewConfigDepth(config) { + var context = config.viewDecl.$context, count = 0; + while (++count && context.parent) + context = context.parent; + return count; + } + // Given a depth function, returns a compare function which can return either ascending or descending order + var depthCompare = (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(function (depthFn, posNeg, left, right) { return posNeg * (depthFn(left) - depthFn(right)); }); + var matchingConfigPair = function (uiView) { + var matchingConfigs = _this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView)); + if (matchingConfigs.length > 1) { + // This is OK. Child states can target a ui-view that the parent state also targets (the child wins) + // Sort by depth and return the match from the deepest child + // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs); + matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending + } + return { uiView: uiView, viewConfig: matchingConfigs[0] }; + }; + var configureUIView = function (tuple) { + // If a parent ui-view is reconfigured, it could destroy child ui-views. + // Before configuring a child ui-view, make sure it's still in the active uiViews array. + if (_this._uiViews.indexOf(tuple.uiView) !== -1) + tuple.uiView.configUpdated(tuple.viewConfig); + }; + // Sort views by FQN and state depth. Process uiviews nearest the root first. + var uiViewTuples = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair); + var matchedViewConfigs = uiViewTuples.map(function (tuple) { return tuple.viewConfig; }); + var unmatchedConfigTuples = this._viewConfigs + .filter(function (config) { return !(0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(matchedViewConfigs, config); }) + .map(function (viewConfig) { return ({ uiView: undefined, viewConfig: viewConfig }); }); + uiViewTuples.forEach(configureUIView); + var allTuples = uiViewTuples.concat(unmatchedConfigTuples); + this._listeners.forEach(function (cb) { return cb(allTuples); }); + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewSync(allTuples); + }; + /** + * Registers a `ui-view` component + * + * When a `ui-view` component is created, it uses this method to register itself. + * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]]. + * + * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`, + * and what the view's state context is. + * + * Note: There is no corresponding `deregisterUIView`. + * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself. + * + * @param uiView The metadata for a UIView + * @return a de-registration function used when the view is destroyed. + */ + ViewService.prototype.registerUIView = function (uiView) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('-> Registering', uiView); + var uiViews = this._uiViews; + var fqnAndTypeMatches = function (uiv) { return uiv.fqn === uiView.fqn && uiv.$type === uiView.$type; }; + if (uiViews.filter(fqnAndTypeMatches).length) + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('!!!! duplicate uiView named:', uiView); + uiViews.push(uiView); + this.sync(); + return function () { + var idx = uiViews.indexOf(uiView); + if (idx === -1) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('Tried removing non-registered uiView', uiView); + return; + } + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('<- Deregistering', uiView); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(uiViews)(uiView); + }; + }; + /** + * Returns the list of views currently available on the page, by fully-qualified name. + * + * @return {Array} Returns an array of fully-qualified view names. + */ + ViewService.prototype.available = function () { + return this._uiViews.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('fqn')); + }; + /** + * Returns the list of views on the page containing loaded content. + * + * @return {Array} Returns an array of fully-qualified view names. + */ + ViewService.prototype.active = function () { + return this._uiViews.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('$config')).map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('name')); + }; + /** + * Given a ui-view and a ViewConfig, determines if they "match". + * + * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in + * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of. + * + * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or + * can be a segmented ui-view path, describing a portion of a ui-view fqn. + * + * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type + * + * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if: + * - the ui-view's name matches the ViewConfig's target name + * - the ui-view's context matches the ViewConfig's anchor + * + * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if: + * - There exists a parent ui-view where: + * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name + * - the parent ui-view's context matches the ViewConfig's anchor + * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn + * + * Example: + * + * DOM: + * + * + * + * + * + * + * + * + * + * uiViews: [ + * { fqn: "$default", creationContext: { name: "" } }, + * { fqn: "$default.foo", creationContext: { name: "A" } }, + * { fqn: "$default.foo.$default", creationContext: { name: "A.B" } } + * { fqn: "$default.foo.$default.bar", creationContext: { name: "A.B.C" } } + * ] + * + * These four view configs all match the ui-view with the fqn: "$default.foo.$default.bar": + * + * - ViewConfig1: { uiViewName: "bar", uiViewContextAnchor: "A.B.C" } + * - ViewConfig2: { uiViewName: "$default.bar", uiViewContextAnchor: "A.B" } + * - ViewConfig3: { uiViewName: "foo.$default.bar", uiViewContextAnchor: "A" } + * - ViewConfig4: { uiViewName: "$default.foo.$default.bar", uiViewContextAnchor: "" } + * + * Using ViewConfig3 as an example, it matches the ui-view with fqn "$default.foo.$default.bar" because: + * - The ViewConfig's segmented target name is: [ "foo", "$default", "bar" ] + * - There exists a parent ui-view (which has fqn: "$default.foo") where: + * - the parent ui-view's name "foo" matches the first segment "foo" of the ViewConfig's target name + * - the parent ui-view's context "A" matches the ViewConfig's anchor context "A" + * - And the remaining segments [ "$default", "bar" ].join("."_ of the ViewConfig's target name match + * the tail of the ui-view's fqn "default.bar" + * + * @internal + */ + ViewService.matches = function (uiViewsByFqn, uiView) { return function (viewConfig) { + // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc + if (uiView.$type !== viewConfig.viewDecl.$type) + return false; + // Split names apart from both viewConfig and uiView into segments + var vc = viewConfig.viewDecl; + var vcSegments = vc.$uiViewName.split('.'); + var uivSegments = uiView.fqn.split('.'); + // Check if the tails of the segment arrays match. ex, these arrays' tails match: + // vc: ["foo", "bar"], uiv fqn: ["$default", "foo", "bar"] + if (!(0,_common_common__WEBPACK_IMPORTED_MODULE_0__.equals)(vcSegments, uivSegments.slice(0 - vcSegments.length))) + return false; + // Now check if the fqn ending at the first segment of the viewConfig matches the context: + // ["$default", "foo"].join(".") == "$default.foo", does the ui-view $default.foo context match? + var negOffset = 1 - vcSegments.length || undefined; + var fqnToFirstSegment = uivSegments.slice(0, negOffset).join('.'); + var uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext; + return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name); + }; }; + return ViewService; +}()); + +//# sourceMappingURL=view.js.map + +/***/ }), + +/***/ "./node_modules/angular-animate/angular-animate.js": +/*!*********************************************************!*\ + !*** ./node_modules/angular-animate/angular-animate.js ***! + \*********************************************************/ +/***/ (() => { + +/** + * @license AngularJS v1.8.2 + * (c) 2010-2020 Google LLC. http://angularjs.org + * License: MIT + */ +(function(window, angular) {'use strict'; + +var ELEMENT_NODE = 1; +var COMMENT_NODE = 8; + +var ADD_CLASS_SUFFIX = '-add'; +var REMOVE_CLASS_SUFFIX = '-remove'; +var EVENT_CLASS_PREFIX = 'ng-'; +var ACTIVE_CLASS_SUFFIX = '-active'; +var PREPARE_CLASS_SUFFIX = '-prepare'; + +var NG_ANIMATE_CLASSNAME = 'ng-animate'; +var NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren'; + +// Detect proper transitionend/animationend event names. +var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT; + +// If unprefixed events are not supported but webkit-prefixed are, use the latter. +// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them. +// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend` +// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`. +// Register both events in case `window.onanimationend` is not supported because of that, +// do the same for `transitionend` as Safari is likely to exhibit similar behavior. +// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit +// therefore there is no reason to test anymore for other vendor prefixes: +// http://caniuse.com/#search=transition +if ((window.ontransitionend === undefined) && (window.onwebkittransitionend !== undefined)) { + CSS_PREFIX = '-webkit-'; + TRANSITION_PROP = 'WebkitTransition'; + TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend'; +} else { + TRANSITION_PROP = 'transition'; + TRANSITIONEND_EVENT = 'transitionend'; +} + +if ((window.onanimationend === undefined) && (window.onwebkitanimationend !== undefined)) { + CSS_PREFIX = '-webkit-'; + ANIMATION_PROP = 'WebkitAnimation'; + ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend'; +} else { + ANIMATION_PROP = 'animation'; + ANIMATIONEND_EVENT = 'animationend'; +} + +var DURATION_KEY = 'Duration'; +var PROPERTY_KEY = 'Property'; +var DELAY_KEY = 'Delay'; +var TIMING_KEY = 'TimingFunction'; +var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount'; +var ANIMATION_PLAYSTATE_KEY = 'PlayState'; +var SAFE_FAST_FORWARD_DURATION_VALUE = 9999; + +var ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY; +var ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY; +var TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY; +var TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY; + +var ngMinErr = angular.$$minErr('ng'); +function assertArg(arg, name, reason) { + if (!arg) { + throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required')); + } + return arg; +} + +function mergeClasses(a,b) { + if (!a && !b) return ''; + if (!a) return b; + if (!b) return a; + if (isArray(a)) a = a.join(' '); + if (isArray(b)) b = b.join(' '); + return a + ' ' + b; +} + +function packageStyles(options) { + var styles = {}; + if (options && (options.to || options.from)) { + styles.to = options.to; + styles.from = options.from; + } + return styles; +} + +function pendClasses(classes, fix, isPrefix) { + var className = ''; + classes = isArray(classes) + ? classes + : classes && isString(classes) && classes.length + ? classes.split(/\s+/) + : []; + forEach(classes, function(klass, i) { + if (klass && klass.length > 0) { + className += (i > 0) ? ' ' : ''; + className += isPrefix ? fix + klass + : klass + fix; + } + }); + return className; +} + +function removeFromArray(arr, val) { + var index = arr.indexOf(val); + if (val >= 0) { + arr.splice(index, 1); + } +} + +function stripCommentsFromElement(element) { + if (element instanceof jqLite) { + switch (element.length) { + case 0: + return element; + + case 1: + // there is no point of stripping anything if the element + // is the only element within the jqLite wrapper. + // (it's important that we retain the element instance.) + if (element[0].nodeType === ELEMENT_NODE) { + return element; + } + break; + + default: + return jqLite(extractElementNode(element)); + } + } + + if (element.nodeType === ELEMENT_NODE) { + return jqLite(element); + } +} + +function extractElementNode(element) { + if (!element[0]) return element; + for (var i = 0; i < element.length; i++) { + var elm = element[i]; + if (elm.nodeType === ELEMENT_NODE) { + return elm; + } + } +} + +function $$addClass($$jqLite, element, className) { + forEach(element, function(elm) { + $$jqLite.addClass(elm, className); + }); +} + +function $$removeClass($$jqLite, element, className) { + forEach(element, function(elm) { + $$jqLite.removeClass(elm, className); + }); +} + +function applyAnimationClassesFactory($$jqLite) { + return function(element, options) { + if (options.addClass) { + $$addClass($$jqLite, element, options.addClass); + options.addClass = null; + } + if (options.removeClass) { + $$removeClass($$jqLite, element, options.removeClass); + options.removeClass = null; + } + }; +} + +function prepareAnimationOptions(options) { + options = options || {}; + if (!options.$$prepared) { + var domOperation = options.domOperation || noop; + options.domOperation = function() { + options.$$domOperationFired = true; + domOperation(); + domOperation = noop; + }; + options.$$prepared = true; + } + return options; +} + +function applyAnimationStyles(element, options) { + applyAnimationFromStyles(element, options); + applyAnimationToStyles(element, options); +} + +function applyAnimationFromStyles(element, options) { + if (options.from) { + element.css(options.from); + options.from = null; + } +} + +function applyAnimationToStyles(element, options) { + if (options.to) { + element.css(options.to); + options.to = null; + } +} + +function mergeAnimationDetails(element, oldAnimation, newAnimation) { + var target = oldAnimation.options || {}; + var newOptions = newAnimation.options || {}; + + var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || ''); + var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || ''); + var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove); + + if (newOptions.preparationClasses) { + target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses); + delete newOptions.preparationClasses; + } + + // noop is basically when there is no callback; otherwise something has been set + var realDomOperation = target.domOperation !== noop ? target.domOperation : null; + + extend(target, newOptions); + + // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this. + if (realDomOperation) { + target.domOperation = realDomOperation; + } + + if (classes.addClass) { + target.addClass = classes.addClass; + } else { + target.addClass = null; + } + + if (classes.removeClass) { + target.removeClass = classes.removeClass; + } else { + target.removeClass = null; + } + + oldAnimation.addClass = target.addClass; + oldAnimation.removeClass = target.removeClass; + + return target; +} + +function resolveElementClasses(existing, toAdd, toRemove) { + var ADD_CLASS = 1; + var REMOVE_CLASS = -1; + + var flags = {}; + existing = splitClassesToLookup(existing); + + toAdd = splitClassesToLookup(toAdd); + forEach(toAdd, function(value, key) { + flags[key] = ADD_CLASS; + }); + + toRemove = splitClassesToLookup(toRemove); + forEach(toRemove, function(value, key) { + flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS; + }); + + var classes = { + addClass: '', + removeClass: '' + }; + + forEach(flags, function(val, klass) { + var prop, allow; + if (val === ADD_CLASS) { + prop = 'addClass'; + allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX]; + } else if (val === REMOVE_CLASS) { + prop = 'removeClass'; + allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX]; + } + if (allow) { + if (classes[prop].length) { + classes[prop] += ' '; + } + classes[prop] += klass; + } + }); + + function splitClassesToLookup(classes) { + if (isString(classes)) { + classes = classes.split(' '); + } + + var obj = {}; + forEach(classes, function(klass) { + // sometimes the split leaves empty string values + // incase extra spaces were applied to the options + if (klass.length) { + obj[klass] = true; + } + }); + return obj; + } + + return classes; +} + +function getDomNode(element) { + return (element instanceof jqLite) ? element[0] : element; +} + +function applyGeneratedPreparationClasses($$jqLite, element, event, options) { + var classes = ''; + if (event) { + classes = pendClasses(event, EVENT_CLASS_PREFIX, true); + } + if (options.addClass) { + classes = concatWithSpace(classes, pendClasses(options.addClass, ADD_CLASS_SUFFIX)); + } + if (options.removeClass) { + classes = concatWithSpace(classes, pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX)); + } + if (classes.length) { + options.preparationClasses = classes; + element.addClass(classes); + } +} + +function clearGeneratedClasses(element, options) { + if (options.preparationClasses) { + element.removeClass(options.preparationClasses); + options.preparationClasses = null; + } + if (options.activeClasses) { + element.removeClass(options.activeClasses); + options.activeClasses = null; + } +} + +function blockKeyframeAnimations(node, applyBlock) { + var value = applyBlock ? 'paused' : ''; + var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY; + applyInlineStyle(node, [key, value]); + return [key, value]; +} + +function applyInlineStyle(node, styleTuple) { + var prop = styleTuple[0]; + var value = styleTuple[1]; + node.style[prop] = value; +} + +function concatWithSpace(a,b) { + if (!a) return b; + if (!b) return a; + return a + ' ' + b; +} + +var helpers = { + blockTransitions: function(node, duration) { + // we use a negative delay value since it performs blocking + // yet it doesn't kill any existing transitions running on the + // same element which makes this safe for class-based animations + var value = duration ? '-' + duration + 's' : ''; + applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]); + return [TRANSITION_DELAY_PROP, value]; + } +}; + +var $$rAFSchedulerFactory = ['$$rAF', function($$rAF) { + var queue, cancelFn; + + function scheduler(tasks) { + // we make a copy since RAFScheduler mutates the state + // of the passed in array variable and this would be difficult + // to track down on the outside code + queue = queue.concat(tasks); + nextTick(); + } + + queue = scheduler.queue = []; + + /* waitUntilQuiet does two things: + * 1. It will run the FINAL `fn` value only when an uncanceled RAF has passed through + * 2. It will delay the next wave of tasks from running until the quiet `fn` has run. + * + * The motivation here is that animation code can request more time from the scheduler + * before the next wave runs. This allows for certain DOM properties such as classes to + * be resolved in time for the next animation to run. + */ + scheduler.waitUntilQuiet = function(fn) { + if (cancelFn) cancelFn(); + + cancelFn = $$rAF(function() { + cancelFn = null; + fn(); + nextTick(); + }); + }; + + return scheduler; + + function nextTick() { + if (!queue.length) return; + + var items = queue.shift(); + for (var i = 0; i < items.length; i++) { + items[i](); + } + + if (!cancelFn) { + $$rAF(function() { + if (!cancelFn) nextTick(); + }); + } + } +}]; + +/** + * @ngdoc directive + * @name ngAnimateChildren + * @restrict AE + * @element ANY + * + * @description + * + * ngAnimateChildren allows you to specify that children of this element should animate even if any + * of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move` + * (structural) animation, child elements that also have an active structural animation are not animated. + * + * Note that even if `ngAnimateChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation). + * + * + * @param {string} ngAnimateChildren If the value is empty, `true` or `on`, + * then child animations are allowed. If the value is `false`, child animations are not allowed. + * + * @example + * + +
    + + +
    +
    +
    + List of items: +
    Item {{item}}
    +
    +
    +
    +
    + + + .container.ng-enter, + .container.ng-leave { + transition: all ease 1.5s; + } + + .container.ng-enter, + .container.ng-leave-active { + opacity: 0; + } + + .container.ng-leave, + .container.ng-enter-active { + opacity: 1; + } + + .item { + background: firebrick; + color: #FFF; + margin-bottom: 10px; + } + + .item.ng-enter, + .item.ng-leave { + transition: transform 1.5s ease; + } + + .item.ng-enter { + transform: translateX(50px); + } + + .item.ng-enter-active { + transform: translateX(0); + } + + + angular.module('ngAnimateChildren', ['ngAnimate']) + .controller('MainController', function MainController() { + this.animateChildren = false; + this.enterElement = false; + }); + +
    + */ +var $$AnimateChildrenDirective = ['$interpolate', function($interpolate) { + return { + link: function(scope, element, attrs) { + var val = attrs.ngAnimateChildren; + if (isString(val) && val.length === 0) { //empty attribute + element.data(NG_ANIMATE_CHILDREN_DATA, true); + } else { + // Interpolate and set the value, so that it is available to + // animations that run right after compilation + setData($interpolate(val)(scope)); + attrs.$observe('ngAnimateChildren', setData); + } + + function setData(value) { + value = value === 'on' || value === 'true'; + element.data(NG_ANIMATE_CHILDREN_DATA, value); + } + } + }; +}]; + +/* exported $AnimateCssProvider */ + +var ANIMATE_TIMER_KEY = '$$animateCss'; + +/** + * @ngdoc service + * @name $animateCss + * @kind object + * + * @description + * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes + * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT + * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or + * directives to create more complex animations that can be purely driven using CSS code. + * + * Note that only browsers that support CSS transitions and/or keyframe animations are capable of + * rendering animations triggered via `$animateCss` (bad news for IE9 and lower). + * + * ## General Use + * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that + * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however, + * any automatic control over cancelling animations and/or preventing animations from being run on + * child elements will not be handled by AngularJS. For this to work as expected, please use `$animate` to + * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger + * the CSS animation. + * + * The example below shows how we can create a folding animation on an element using `ng-if`: + * + * ```html + * + *
    + * This element will go BOOM + *
    + * + * ``` + * + * Now we create the **JavaScript animation** that will trigger the CSS transition: + * + * ```js + * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { + * return { + * enter: function(element, doneFn) { + * var height = element[0].offsetHeight; + * return $animateCss(element, { + * from: { height:'0px' }, + * to: { height:height + 'px' }, + * duration: 1 // one second + * }); + * } + * } + * }]); + * ``` + * + * ## More Advanced Uses + * + * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks + * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code. + * + * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation, + * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with + * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order + * to provide a working animation that will run in CSS. + * + * The example below showcases a more advanced version of the `.fold-animation` from the example above: + * + * ```js + * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { + * return { + * enter: function(element, doneFn) { + * var height = element[0].offsetHeight; + * return $animateCss(element, { + * addClass: 'red large-text pulse-twice', + * easing: 'ease-out', + * from: { height:'0px' }, + * to: { height:height + 'px' }, + * duration: 1 // one second + * }); + * } + * } + * }]); + * ``` + * + * Since we're adding/removing CSS classes then the CSS transition will also pick those up: + * + * ```css + * /* since a hardcoded duration value of 1 was provided in the JavaScript animation code, + * the CSS classes below will be transitioned despite them being defined as regular CSS classes */ + * .red { background:red; } + * .large-text { font-size:20px; } + * + * /* we can also use a keyframe animation and $animateCss will make it work alongside the transition */ + * .pulse-twice { + * animation: 0.5s pulse linear 2; + * -webkit-animation: 0.5s pulse linear 2; + * } + * + * @keyframes pulse { + * from { transform: scale(0.5); } + * to { transform: scale(1.5); } + * } + * + * @-webkit-keyframes pulse { + * from { -webkit-transform: scale(0.5); } + * to { -webkit-transform: scale(1.5); } + * } + * ``` + * + * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen. + * + * ## How the Options are handled + * + * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation + * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline + * styles using the `from` and `to` properties. + * + * ```js + * var animator = $animateCss(element, { + * from: { background:'red' }, + * to: { background:'blue' } + * }); + * animator.start(); + * ``` + * + * ```css + * .rotating-animation { + * animation:0.5s rotate linear; + * -webkit-animation:0.5s rotate linear; + * } + * + * @keyframes rotate { + * from { transform: rotate(0deg); } + * to { transform: rotate(360deg); } + * } + * + * @-webkit-keyframes rotate { + * from { -webkit-transform: rotate(0deg); } + * to { -webkit-transform: rotate(360deg); } + * } + * ``` + * + * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is + * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition + * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition + * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied + * and spread across the transition and keyframe animation. + * + * ## What is returned + * + * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually + * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are + * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties: + * + * ```js + * var animator = $animateCss(element, { ... }); + * ``` + * + * Now what do the contents of our `animator` variable look like: + * + * ```js + * { + * // starts the animation + * start: Function, + * + * // ends (aborts) the animation + * end: Function + * } + * ``` + * + * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends. + * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and styles may have been + * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties + * and that changing them will not reconfigure the parameters of the animation. + * + * ### runner.done() vs runner.then() + * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the + * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**. + * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()` + * unless you really need a digest to kick off afterwards. + * + * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss + * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code). + * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works. + * + * @param {DOMElement} element the element that will be animated + * @param {object} options the animation-related options that will be applied during the animation + * + * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied + * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.) + * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and + * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted. + * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both). + * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`). + * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`). + * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation. + * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition. + * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation. + * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation. + * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0` + * is provided then the animation will be skipped entirely. + * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is + * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value + * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same + * CSS delay value. + * * `stagger` - A numeric time value representing the delay between successively animated elements + * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.}) + * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a + * `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`) + * * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occurring on the classes being added and removed.) + * * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once + * the animation is closed. This is useful for when the styles are used purely for the sake of + * the animation and do not have a lasting visual effect on the element (e.g. a collapse and open animation). + * By default this value is set to `false`. + * + * @return {object} an object with start and end methods and details about the animation. + * + * * `start` - The method to start the animation. This will return a `Promise` when called. + * * `end` - This method will cancel the animation and remove all applied CSS classes and styles. + */ +var ONE_SECOND = 1000; + +var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3; +var CLOSING_TIME_BUFFER = 1.5; + +var DETECT_CSS_PROPERTIES = { + transitionDuration: TRANSITION_DURATION_PROP, + transitionDelay: TRANSITION_DELAY_PROP, + transitionProperty: TRANSITION_PROP + PROPERTY_KEY, + animationDuration: ANIMATION_DURATION_PROP, + animationDelay: ANIMATION_DELAY_PROP, + animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY +}; + +var DETECT_STAGGER_CSS_PROPERTIES = { + transitionDuration: TRANSITION_DURATION_PROP, + transitionDelay: TRANSITION_DELAY_PROP, + animationDuration: ANIMATION_DURATION_PROP, + animationDelay: ANIMATION_DELAY_PROP +}; + +function getCssKeyframeDurationStyle(duration) { + return [ANIMATION_DURATION_PROP, duration + 's']; +} + +function getCssDelayStyle(delay, isKeyframeAnimation) { + var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP; + return [prop, delay + 's']; +} + +function computeCssStyles($window, element, properties) { + var styles = Object.create(null); + var detectedStyles = $window.getComputedStyle(element) || {}; + forEach(properties, function(formalStyleName, actualStyleName) { + var val = detectedStyles[formalStyleName]; + if (val) { + var c = val.charAt(0); + + // only numerical-based values have a negative sign or digit as the first value + if (c === '-' || c === '+' || c >= 0) { + val = parseMaxTime(val); + } + + // by setting this to null in the event that the delay is not set or is set directly as 0 + // then we can still allow for negative values to be used later on and not mistake this + // value for being greater than any other negative value. + if (val === 0) { + val = null; + } + styles[actualStyleName] = val; + } + }); + + return styles; +} + +function parseMaxTime(str) { + var maxValue = 0; + var values = str.split(/\s*,\s*/); + forEach(values, function(value) { + // it's always safe to consider only second values and omit `ms` values since + // getComputedStyle will always handle the conversion for us + if (value.charAt(value.length - 1) === 's') { + value = value.substring(0, value.length - 1); + } + value = parseFloat(value) || 0; + maxValue = maxValue ? Math.max(value, maxValue) : value; + }); + return maxValue; +} + +function truthyTimingValue(val) { + return val === 0 || val != null; +} + +function getCssTransitionDurationStyle(duration, applyOnlyDuration) { + var style = TRANSITION_PROP; + var value = duration + 's'; + if (applyOnlyDuration) { + style += DURATION_KEY; + } else { + value += ' linear all'; + } + return [style, value]; +} + +// we do not reassign an already present style value since +// if we detect the style property value again we may be +// detecting styles that were added via the `from` styles. +// We make use of `isDefined` here since an empty string +// or null value (which is what getPropertyValue will return +// for a non-existing style) will still be marked as a valid +// value for the style (a falsy value implies that the style +// is to be removed at the end of the animation). If we had a simple +// "OR" statement then it would not be enough to catch that. +function registerRestorableStyles(backup, node, properties) { + forEach(properties, function(prop) { + backup[prop] = isDefined(backup[prop]) + ? backup[prop] + : node.style.getPropertyValue(prop); + }); +} + +var $AnimateCssProvider = ['$animateProvider', /** @this */ function($animateProvider) { + + this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout', '$$animateCache', + '$$forceReflow', '$sniffer', '$$rAFScheduler', '$$animateQueue', + function($window, $$jqLite, $$AnimateRunner, $timeout, $$animateCache, + $$forceReflow, $sniffer, $$rAFScheduler, $$animateQueue) { + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function computeCachedCssStyles(node, className, cacheKey, allowNoDuration, properties) { + var timings = $$animateCache.get(cacheKey); + + if (!timings) { + timings = computeCssStyles($window, node, properties); + if (timings.animationIterationCount === 'infinite') { + timings.animationIterationCount = 1; + } + } + + // if a css animation has no duration we + // should mark that so that repeated addClass/removeClass calls are skipped + var hasDuration = allowNoDuration || (timings.transitionDuration > 0 || timings.animationDuration > 0); + + // we keep putting this in multiple times even though the value and the cacheKey are the same + // because we're keeping an internal tally of how many duplicate animations are detected. + $$animateCache.put(cacheKey, timings, hasDuration); + + return timings; + } + + function computeCachedCssStaggerStyles(node, className, cacheKey, properties) { + var stagger; + var staggerCacheKey = 'stagger-' + cacheKey; + + // if we have one or more existing matches of matching elements + // containing the same parent + CSS styles (which is how cacheKey works) + // then staggering is possible + if ($$animateCache.count(cacheKey) > 0) { + stagger = $$animateCache.get(staggerCacheKey); + + if (!stagger) { + var staggerClassName = pendClasses(className, '-stagger'); + + $$jqLite.addClass(node, staggerClassName); + + stagger = computeCssStyles($window, node, properties); + + // force the conversion of a null value to zero incase not set + stagger.animationDuration = Math.max(stagger.animationDuration, 0); + stagger.transitionDuration = Math.max(stagger.transitionDuration, 0); + + $$jqLite.removeClass(node, staggerClassName); + + $$animateCache.put(staggerCacheKey, stagger, true); + } + } + + return stagger || {}; + } + + var rafWaitQueue = []; + function waitUntilQuiet(callback) { + rafWaitQueue.push(callback); + $$rAFScheduler.waitUntilQuiet(function() { + $$animateCache.flush(); + + // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable. + // PLEASE EXAMINE THE `$$forceReflow` service to understand why. + var pageWidth = $$forceReflow(); + + // we use a for loop to ensure that if the queue is changed + // during this looping then it will consider new requests + for (var i = 0; i < rafWaitQueue.length; i++) { + rafWaitQueue[i](pageWidth); + } + rafWaitQueue.length = 0; + }); + } + + function computeTimings(node, className, cacheKey, allowNoDuration) { + var timings = computeCachedCssStyles(node, className, cacheKey, allowNoDuration, DETECT_CSS_PROPERTIES); + var aD = timings.animationDelay; + var tD = timings.transitionDelay; + timings.maxDelay = aD && tD + ? Math.max(aD, tD) + : (aD || tD); + timings.maxDuration = Math.max( + timings.animationDuration * timings.animationIterationCount, + timings.transitionDuration); + + return timings; + } + + return function init(element, initialOptions) { + // all of the animation functions should create + // a copy of the options data, however, if a + // parent service has already created a copy then + // we should stick to using that + var options = initialOptions || {}; + if (!options.$$prepared) { + options = prepareAnimationOptions(copy(options)); + } + + var restoreStyles = {}; + var node = getDomNode(element); + if (!node + || !node.parentNode + || !$$animateQueue.enabled()) { + return closeAndReturnNoopAnimator(); + } + + var temporaryStyles = []; + var classes = element.attr('class'); + var styles = packageStyles(options); + var animationClosed; + var animationPaused; + var animationCompleted; + var runner; + var runnerHost; + var maxDelay; + var maxDelayTime; + var maxDuration; + var maxDurationTime; + var startTime; + var events = []; + + if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) { + return closeAndReturnNoopAnimator(); + } + + var method = options.event && isArray(options.event) + ? options.event.join(' ') + : options.event; + + var isStructural = method && options.structural; + var structuralClassName = ''; + var addRemoveClassName = ''; + + if (isStructural) { + structuralClassName = pendClasses(method, EVENT_CLASS_PREFIX, true); + } else if (method) { + structuralClassName = method; + } + + if (options.addClass) { + addRemoveClassName += pendClasses(options.addClass, ADD_CLASS_SUFFIX); + } + + if (options.removeClass) { + if (addRemoveClassName.length) { + addRemoveClassName += ' '; + } + addRemoveClassName += pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX); + } + + // there may be a situation where a structural animation is combined together + // with CSS classes that need to resolve before the animation is computed. + // However this means that there is no explicit CSS code to block the animation + // from happening (by setting 0s none in the class name). If this is the case + // we need to apply the classes before the first rAF so we know to continue if + // there actually is a detected transition or keyframe animation + if (options.applyClassesEarly && addRemoveClassName.length) { + applyAnimationClasses(element, options); + } + + var preparationClasses = [structuralClassName, addRemoveClassName].join(' ').trim(); + var fullClassName = classes + ' ' + preparationClasses; + var hasToStyles = styles.to && Object.keys(styles.to).length > 0; + var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0; + + // there is no way we can trigger an animation if no styles and + // no classes are being applied which would then trigger a transition, + // unless there a is raw keyframe value that is applied to the element. + if (!containsKeyframeAnimation + && !hasToStyles + && !preparationClasses) { + return closeAndReturnNoopAnimator(); + } + + var stagger, cacheKey = $$animateCache.cacheKey(node, method, options.addClass, options.removeClass); + if ($$animateCache.containsCachedAnimationWithoutDuration(cacheKey)) { + preparationClasses = null; + return closeAndReturnNoopAnimator(); + } + + if (options.stagger > 0) { + var staggerVal = parseFloat(options.stagger); + stagger = { + transitionDelay: staggerVal, + animationDelay: staggerVal, + transitionDuration: 0, + animationDuration: 0 + }; + } else { + stagger = computeCachedCssStaggerStyles(node, preparationClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES); + } + + if (!options.$$skipPreparationClasses) { + $$jqLite.addClass(element, preparationClasses); + } + + var applyOnlyDuration; + + if (options.transitionStyle) { + var transitionStyle = [TRANSITION_PROP, options.transitionStyle]; + applyInlineStyle(node, transitionStyle); + temporaryStyles.push(transitionStyle); + } + + if (options.duration >= 0) { + applyOnlyDuration = node.style[TRANSITION_PROP].length > 0; + var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration); + + // we set the duration so that it will be picked up by getComputedStyle later + applyInlineStyle(node, durationStyle); + temporaryStyles.push(durationStyle); + } + + if (options.keyframeStyle) { + var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle]; + applyInlineStyle(node, keyframeStyle); + temporaryStyles.push(keyframeStyle); + } + + var itemIndex = stagger + ? options.staggerIndex >= 0 + ? options.staggerIndex + : $$animateCache.count(cacheKey) + : 0; + + var isFirst = itemIndex === 0; + + // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY + // without causing any combination of transitions to kick in. By adding a negative delay value + // it forces the setup class' transition to end immediately. We later then remove the negative + // transition delay to allow for the transition to naturally do it's thing. The beauty here is + // that if there is no transition defined then nothing will happen and this will also allow + // other transitions to be stacked on top of each other without any chopping them out. + if (isFirst && !options.skipBlocking) { + helpers.blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE); + } + + var timings = computeTimings(node, fullClassName, cacheKey, !isStructural); + var relativeDelay = timings.maxDelay; + maxDelay = Math.max(relativeDelay, 0); + maxDuration = timings.maxDuration; + + var flags = {}; + flags.hasTransitions = timings.transitionDuration > 0; + flags.hasAnimations = timings.animationDuration > 0; + flags.hasTransitionAll = flags.hasTransitions && timings.transitionProperty === 'all'; + flags.applyTransitionDuration = hasToStyles && ( + (flags.hasTransitions && !flags.hasTransitionAll) + || (flags.hasAnimations && !flags.hasTransitions)); + flags.applyAnimationDuration = options.duration && flags.hasAnimations; + flags.applyTransitionDelay = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions); + flags.applyAnimationDelay = truthyTimingValue(options.delay) && flags.hasAnimations; + flags.recalculateTimingStyles = addRemoveClassName.length > 0; + + if (flags.applyTransitionDuration || flags.applyAnimationDuration) { + maxDuration = options.duration ? parseFloat(options.duration) : maxDuration; + + if (flags.applyTransitionDuration) { + flags.hasTransitions = true; + timings.transitionDuration = maxDuration; + applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0; + temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration)); + } + + if (flags.applyAnimationDuration) { + flags.hasAnimations = true; + timings.animationDuration = maxDuration; + temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration)); + } + } + + if (maxDuration === 0 && !flags.recalculateTimingStyles) { + return closeAndReturnNoopAnimator(); + } + + var activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX); + + if (options.delay != null) { + var delayStyle; + if (typeof options.delay !== 'boolean') { + delayStyle = parseFloat(options.delay); + // number in options.delay means we have to recalculate the delay for the closing timeout + maxDelay = Math.max(delayStyle, 0); + } + + if (flags.applyTransitionDelay) { + temporaryStyles.push(getCssDelayStyle(delayStyle)); + } + + if (flags.applyAnimationDelay) { + temporaryStyles.push(getCssDelayStyle(delayStyle, true)); + } + } + + // we need to recalculate the delay value since we used a pre-emptive negative + // delay value and the delay value is required for the final event checking. This + // property will ensure that this will happen after the RAF phase has passed. + if (options.duration == null && timings.transitionDuration > 0) { + flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst; + } + + maxDelayTime = maxDelay * ONE_SECOND; + maxDurationTime = maxDuration * ONE_SECOND; + if (!options.skipBlocking) { + flags.blockTransition = timings.transitionDuration > 0; + flags.blockKeyframeAnimation = timings.animationDuration > 0 && + stagger.animationDelay > 0 && + stagger.animationDuration === 0; + } + + if (options.from) { + if (options.cleanupStyles) { + registerRestorableStyles(restoreStyles, node, Object.keys(options.from)); + } + applyAnimationFromStyles(element, options); + } + + if (flags.blockTransition || flags.blockKeyframeAnimation) { + applyBlocking(maxDuration); + } else if (!options.skipBlocking) { + helpers.blockTransitions(node, false); + } + + // TODO(matsko): for 1.5 change this code to have an animator object for better debugging + return { + $$willAnimate: true, + end: endFn, + start: function() { + if (animationClosed) return; + + runnerHost = { + end: endFn, + cancel: cancelFn, + resume: null, //this will be set during the start() phase + pause: null + }; + + runner = new $$AnimateRunner(runnerHost); + + waitUntilQuiet(start); + + // we don't have access to pause/resume the animation + // since it hasn't run yet. AnimateRunner will therefore + // set noop functions for resume and pause and they will + // later be overridden once the animation is triggered + return runner; + } + }; + + function endFn() { + close(); + } + + function cancelFn() { + close(true); + } + + function close(rejected) { + // if the promise has been called already then we shouldn't close + // the animation again + if (animationClosed || (animationCompleted && animationPaused)) return; + animationClosed = true; + animationPaused = false; + + if (preparationClasses && !options.$$skipPreparationClasses) { + $$jqLite.removeClass(element, preparationClasses); + } + + if (activeClasses) { + $$jqLite.removeClass(element, activeClasses); + } + + blockKeyframeAnimations(node, false); + helpers.blockTransitions(node, false); + + forEach(temporaryStyles, function(entry) { + // There is only one way to remove inline style properties entirely from elements. + // By using `removeProperty` this works, but we need to convert camel-cased CSS + // styles down to hyphenated values. + node.style[entry[0]] = ''; + }); + + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + + if (Object.keys(restoreStyles).length) { + forEach(restoreStyles, function(value, prop) { + if (value) { + node.style.setProperty(prop, value); + } else { + node.style.removeProperty(prop); + } + }); + } + + // the reason why we have this option is to allow a synchronous closing callback + // that is fired as SOON as the animation ends (when the CSS is removed) or if + // the animation never takes off at all. A good example is a leave animation since + // the element must be removed just after the animation is over or else the element + // will appear on screen for one animation frame causing an overbearing flicker. + if (options.onDone) { + options.onDone(); + } + + if (events && events.length) { + // Remove the transitionend / animationend listener(s) + element.off(events.join(' '), onAnimationProgress); + } + + //Cancel the fallback closing timeout and remove the timer data + var animationTimerData = element.data(ANIMATE_TIMER_KEY); + if (animationTimerData) { + $timeout.cancel(animationTimerData[0].timer); + element.removeData(ANIMATE_TIMER_KEY); + } + + // if the preparation function fails then the promise is not setup + if (runner) { + runner.complete(!rejected); + } + } + + function applyBlocking(duration) { + if (flags.blockTransition) { + helpers.blockTransitions(node, duration); + } + + if (flags.blockKeyframeAnimation) { + blockKeyframeAnimations(node, !!duration); + } + } + + function closeAndReturnNoopAnimator() { + runner = new $$AnimateRunner({ + end: endFn, + cancel: cancelFn + }); + + // should flush the cache animation + waitUntilQuiet(noop); + close(); + + return { + $$willAnimate: false, + start: function() { + return runner; + }, + end: endFn + }; + } + + function onAnimationProgress(event) { + event.stopPropagation(); + var ev = event.originalEvent || event; + + if (ev.target !== node) { + // Since TransitionEvent / AnimationEvent bubble up, + // we have to ignore events by finished child animations + return; + } + + // we now always use `Date.now()` due to the recent changes with + // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info) + var timeStamp = ev.$manualTimeStamp || Date.now(); + + /* Firefox (or possibly just Gecko) likes to not round values up + * when a ms measurement is used for the animation */ + var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)); + + /* $manualTimeStamp is a mocked timeStamp value which is set + * within browserTrigger(). This is only here so that tests can + * mock animations properly. Real events fallback to event.timeStamp, + * or, if they don't, then a timeStamp is automatically created for them. + * We're checking to see if the timeStamp surpasses the expected delay, + * but we're using elapsedTime instead of the timeStamp on the 2nd + * pre-condition since animationPauseds sometimes close off early */ + if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { + // we set this flag to ensure that if the transition is paused then, when resumed, + // the animation will automatically close itself since transitions cannot be paused. + animationCompleted = true; + close(); + } + } + + function start() { + if (animationClosed) return; + if (!node.parentNode) { + close(); + return; + } + + // even though we only pause keyframe animations here the pause flag + // will still happen when transitions are used. Only the transition will + // not be paused since that is not possible. If the animation ends when + // paused then it will not complete until unpaused or cancelled. + var playPause = function(playAnimation) { + if (!animationCompleted) { + animationPaused = !playAnimation; + if (timings.animationDuration) { + var value = blockKeyframeAnimations(node, animationPaused); + if (animationPaused) { + temporaryStyles.push(value); + } else { + removeFromArray(temporaryStyles, value); + } + } + } else if (animationPaused && playAnimation) { + animationPaused = false; + close(); + } + }; + + // checking the stagger duration prevents an accidentally cascade of the CSS delay style + // being inherited from the parent. If the transition duration is zero then we can safely + // rely that the delay value is an intentional stagger delay style. + var maxStagger = itemIndex > 0 + && ((timings.transitionDuration && stagger.transitionDuration === 0) || + (timings.animationDuration && stagger.animationDuration === 0)) + && Math.max(stagger.animationDelay, stagger.transitionDelay); + if (maxStagger) { + $timeout(triggerAnimationStart, + Math.floor(maxStagger * itemIndex * ONE_SECOND), + false); + } else { + triggerAnimationStart(); + } + + // this will decorate the existing promise runner with pause/resume methods + runnerHost.resume = function() { + playPause(true); + }; + + runnerHost.pause = function() { + playPause(false); + }; + + function triggerAnimationStart() { + // just incase a stagger animation kicks in when the animation + // itself was cancelled entirely + if (animationClosed) return; + + applyBlocking(false); + + forEach(temporaryStyles, function(entry) { + var key = entry[0]; + var value = entry[1]; + node.style[key] = value; + }); + + applyAnimationClasses(element, options); + $$jqLite.addClass(element, activeClasses); + + if (flags.recalculateTimingStyles) { + fullClassName = node.getAttribute('class') + ' ' + preparationClasses; + cacheKey = $$animateCache.cacheKey(node, method, options.addClass, options.removeClass); + + timings = computeTimings(node, fullClassName, cacheKey, false); + relativeDelay = timings.maxDelay; + maxDelay = Math.max(relativeDelay, 0); + maxDuration = timings.maxDuration; + + if (maxDuration === 0) { + close(); + return; + } + + flags.hasTransitions = timings.transitionDuration > 0; + flags.hasAnimations = timings.animationDuration > 0; + } + + if (flags.applyAnimationDelay) { + relativeDelay = typeof options.delay !== 'boolean' && truthyTimingValue(options.delay) + ? parseFloat(options.delay) + : relativeDelay; + + maxDelay = Math.max(relativeDelay, 0); + timings.animationDelay = relativeDelay; + delayStyle = getCssDelayStyle(relativeDelay, true); + temporaryStyles.push(delayStyle); + node.style[delayStyle[0]] = delayStyle[1]; + } + + maxDelayTime = maxDelay * ONE_SECOND; + maxDurationTime = maxDuration * ONE_SECOND; + + if (options.easing) { + var easeProp, easeVal = options.easing; + if (flags.hasTransitions) { + easeProp = TRANSITION_PROP + TIMING_KEY; + temporaryStyles.push([easeProp, easeVal]); + node.style[easeProp] = easeVal; + } + if (flags.hasAnimations) { + easeProp = ANIMATION_PROP + TIMING_KEY; + temporaryStyles.push([easeProp, easeVal]); + node.style[easeProp] = easeVal; + } + } + + if (timings.transitionDuration) { + events.push(TRANSITIONEND_EVENT); + } + + if (timings.animationDuration) { + events.push(ANIMATIONEND_EVENT); + } + + startTime = Date.now(); + var timerTime = maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime; + var endTime = startTime + timerTime; + + var animationsData = element.data(ANIMATE_TIMER_KEY) || []; + var setupFallbackTimer = true; + if (animationsData.length) { + var currentTimerData = animationsData[0]; + setupFallbackTimer = endTime > currentTimerData.expectedEndTime; + if (setupFallbackTimer) { + $timeout.cancel(currentTimerData.timer); + } else { + animationsData.push(close); + } + } + + if (setupFallbackTimer) { + var timer = $timeout(onAnimationExpired, timerTime, false); + animationsData[0] = { + timer: timer, + expectedEndTime: endTime + }; + animationsData.push(close); + element.data(ANIMATE_TIMER_KEY, animationsData); + } + + if (events.length) { + element.on(events.join(' '), onAnimationProgress); + } + + if (options.to) { + if (options.cleanupStyles) { + registerRestorableStyles(restoreStyles, node, Object.keys(options.to)); + } + applyAnimationToStyles(element, options); + } + } + + function onAnimationExpired() { + var animationsData = element.data(ANIMATE_TIMER_KEY); + + // this will be false in the event that the element was + // removed from the DOM (via a leave animation or something + // similar) + if (animationsData) { + for (var i = 1; i < animationsData.length; i++) { + animationsData[i](); + } + element.removeData(ANIMATE_TIMER_KEY); + } + } + } + }; + }]; +}]; + +var $$AnimateCssDriverProvider = ['$$animationProvider', /** @this */ function($$animationProvider) { + $$animationProvider.drivers.push('$$animateCssDriver'); + + var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim'; + var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor'; + + var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out'; + var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in'; + + function isDocumentFragment(node) { + return node.parentNode && node.parentNode.nodeType === 11; + } + + this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document', + function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $sniffer, $$jqLite, $document) { + + // only browsers that support these properties can render animations + if (!$sniffer.animations && !$sniffer.transitions) return noop; + + var bodyNode = $document[0].body; + var rootNode = getDomNode($rootElement); + + var rootBodyElement = jqLite( + // this is to avoid using something that exists outside of the body + // we also special case the doc fragment case because our unit test code + // appends the $rootElement to the body after the app has been bootstrapped + isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode + ); + + return function initDriverFn(animationDetails) { + return animationDetails.from && animationDetails.to + ? prepareFromToAnchorAnimation(animationDetails.from, + animationDetails.to, + animationDetails.classes, + animationDetails.anchors) + : prepareRegularAnimation(animationDetails); + }; + + function filterCssClasses(classes) { + //remove all the `ng-` stuff + return classes.replace(/\bng-\S+\b/g, ''); + } + + function getUniqueValues(a, b) { + if (isString(a)) a = a.split(' '); + if (isString(b)) b = b.split(' '); + return a.filter(function(val) { + return b.indexOf(val) === -1; + }).join(' '); + } + + function prepareAnchoredAnimation(classes, outAnchor, inAnchor) { + var clone = jqLite(getDomNode(outAnchor).cloneNode(true)); + var startingClasses = filterCssClasses(getClassVal(clone)); + + outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); + inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); + + clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME); + + rootBodyElement.append(clone); + + var animatorIn, animatorOut = prepareOutAnimation(); + + // the user may not end up using the `out` animation and + // only making use of the `in` animation or vice-versa. + // In either case we should allow this and not assume the + // animation is over unless both animations are not used. + if (!animatorOut) { + animatorIn = prepareInAnimation(); + if (!animatorIn) { + return end(); + } + } + + var startingAnimator = animatorOut || animatorIn; + + return { + start: function() { + var runner; + + var currentAnimation = startingAnimator.start(); + currentAnimation.done(function() { + currentAnimation = null; + if (!animatorIn) { + animatorIn = prepareInAnimation(); + if (animatorIn) { + currentAnimation = animatorIn.start(); + currentAnimation.done(function() { + currentAnimation = null; + end(); + runner.complete(); + }); + return currentAnimation; + } + } + // in the event that there is no `in` animation + end(); + runner.complete(); + }); + + runner = new $$AnimateRunner({ + end: endFn, + cancel: endFn + }); + + return runner; + + function endFn() { + if (currentAnimation) { + currentAnimation.end(); + } + } + } + }; + + function calculateAnchorStyles(anchor) { + var styles = {}; + + var coords = getDomNode(anchor).getBoundingClientRect(); + + // we iterate directly since safari messes up and doesn't return + // all the keys for the coords object when iterated + forEach(['width','height','top','left'], function(key) { + var value = coords[key]; + switch (key) { + case 'top': + value += bodyNode.scrollTop; + break; + case 'left': + value += bodyNode.scrollLeft; + break; + } + styles[key] = Math.floor(value) + 'px'; + }); + return styles; + } + + function prepareOutAnimation() { + var animator = $animateCss(clone, { + addClass: NG_OUT_ANCHOR_CLASS_NAME, + delay: true, + from: calculateAnchorStyles(outAnchor) + }); + + // read the comment within `prepareRegularAnimation` to understand + // why this check is necessary + return animator.$$willAnimate ? animator : null; + } + + function getClassVal(element) { + return element.attr('class') || ''; + } + + function prepareInAnimation() { + var endingClasses = filterCssClasses(getClassVal(inAnchor)); + var toAdd = getUniqueValues(endingClasses, startingClasses); + var toRemove = getUniqueValues(startingClasses, endingClasses); + + var animator = $animateCss(clone, { + to: calculateAnchorStyles(inAnchor), + addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd, + removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove, + delay: true + }); + + // read the comment within `prepareRegularAnimation` to understand + // why this check is necessary + return animator.$$willAnimate ? animator : null; + } + + function end() { + clone.remove(); + outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); + inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); + } + } + + function prepareFromToAnchorAnimation(from, to, classes, anchors) { + var fromAnimation = prepareRegularAnimation(from, noop); + var toAnimation = prepareRegularAnimation(to, noop); + + var anchorAnimations = []; + forEach(anchors, function(anchor) { + var outElement = anchor['out']; + var inElement = anchor['in']; + var animator = prepareAnchoredAnimation(classes, outElement, inElement); + if (animator) { + anchorAnimations.push(animator); + } + }); + + // no point in doing anything when there are no elements to animate + if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return; + + return { + start: function() { + var animationRunners = []; + + if (fromAnimation) { + animationRunners.push(fromAnimation.start()); + } + + if (toAnimation) { + animationRunners.push(toAnimation.start()); + } + + forEach(anchorAnimations, function(animation) { + animationRunners.push(animation.start()); + }); + + var runner = new $$AnimateRunner({ + end: endFn, + cancel: endFn // CSS-driven animations cannot be cancelled, only ended + }); + + $$AnimateRunner.all(animationRunners, function(status) { + runner.complete(status); + }); + + return runner; + + function endFn() { + forEach(animationRunners, function(runner) { + runner.end(); + }); + } + } + }; + } + + function prepareRegularAnimation(animationDetails) { + var element = animationDetails.element; + var options = animationDetails.options || {}; + + if (animationDetails.structural) { + options.event = animationDetails.event; + options.structural = true; + options.applyClassesEarly = true; + + // we special case the leave animation since we want to ensure that + // the element is removed as soon as the animation is over. Otherwise + // a flicker might appear or the element may not be removed at all + if (animationDetails.event === 'leave') { + options.onDone = options.domOperation; + } + } + + // We assign the preparationClasses as the actual animation event since + // the internals of $animateCss will just suffix the event token values + // with `-active` to trigger the animation. + if (options.preparationClasses) { + options.event = concatWithSpace(options.event, options.preparationClasses); + } + + var animator = $animateCss(element, options); + + // the driver lookup code inside of $$animation attempts to spawn a + // driver one by one until a driver returns a.$$willAnimate animator object. + // $animateCss will always return an object, however, it will pass in + // a flag as a hint as to whether an animation was detected or not + return animator.$$willAnimate ? animator : null; + } + }]; +}]; + +// TODO(matsko): use caching here to speed things up for detection +// TODO(matsko): add documentation +// by the time... + +var $$AnimateJsProvider = ['$animateProvider', /** @this */ function($animateProvider) { + this.$get = ['$injector', '$$AnimateRunner', '$$jqLite', + function($injector, $$AnimateRunner, $$jqLite) { + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + // $animateJs(element, 'enter'); + return function(element, event, classes, options) { + var animationClosed = false; + + // the `classes` argument is optional and if it is not used + // then the classes will be resolved from the element's className + // property as well as options.addClass/options.removeClass. + if (arguments.length === 3 && isObject(classes)) { + options = classes; + classes = null; + } + + options = prepareAnimationOptions(options); + if (!classes) { + classes = element.attr('class') || ''; + if (options.addClass) { + classes += ' ' + options.addClass; + } + if (options.removeClass) { + classes += ' ' + options.removeClass; + } + } + + var classesToAdd = options.addClass; + var classesToRemove = options.removeClass; + + // the lookupAnimations function returns a series of animation objects that are + // matched up with one or more of the CSS classes. These animation objects are + // defined via the module.animation factory function. If nothing is detected then + // we don't return anything which then makes $animation query the next driver. + var animations = lookupAnimations(classes); + var before, after; + if (animations.length) { + var afterFn, beforeFn; + if (event === 'leave') { + beforeFn = 'leave'; + afterFn = 'afterLeave'; // TODO(matsko): get rid of this + } else { + beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1); + afterFn = event; + } + + if (event !== 'enter' && event !== 'move') { + before = packageAnimations(element, event, options, animations, beforeFn); + } + after = packageAnimations(element, event, options, animations, afterFn); + } + + // no matching animations + if (!before && !after) return; + + function applyOptions() { + options.domOperation(); + applyAnimationClasses(element, options); + } + + function close() { + animationClosed = true; + applyOptions(); + applyAnimationStyles(element, options); + } + + var runner; + + return { + $$willAnimate: true, + end: function() { + if (runner) { + runner.end(); + } else { + close(); + runner = new $$AnimateRunner(); + runner.complete(true); + } + return runner; + }, + start: function() { + if (runner) { + return runner; + } + + runner = new $$AnimateRunner(); + var closeActiveAnimations; + var chain = []; + + if (before) { + chain.push(function(fn) { + closeActiveAnimations = before(fn); + }); + } + + if (chain.length) { + chain.push(function(fn) { + applyOptions(); + fn(true); + }); + } else { + applyOptions(); + } + + if (after) { + chain.push(function(fn) { + closeActiveAnimations = after(fn); + }); + } + + runner.setHost({ + end: function() { + endAnimations(); + }, + cancel: function() { + endAnimations(true); + } + }); + + $$AnimateRunner.chain(chain, onComplete); + return runner; + + function onComplete(success) { + close(success); + runner.complete(success); + } + + function endAnimations(cancelled) { + if (!animationClosed) { + (closeActiveAnimations || noop)(cancelled); + onComplete(cancelled); + } + } + } + }; + + function executeAnimationFn(fn, element, event, options, onDone) { + var args; + switch (event) { + case 'animate': + args = [element, options.from, options.to, onDone]; + break; + + case 'setClass': + args = [element, classesToAdd, classesToRemove, onDone]; + break; + + case 'addClass': + args = [element, classesToAdd, onDone]; + break; + + case 'removeClass': + args = [element, classesToRemove, onDone]; + break; + + default: + args = [element, onDone]; + break; + } + + args.push(options); + + var value = fn.apply(fn, args); + if (value) { + if (isFunction(value.start)) { + value = value.start(); + } + + if (value instanceof $$AnimateRunner) { + value.done(onDone); + } else if (isFunction(value)) { + // optional onEnd / onCancel callback + return value; + } + } + + return noop; + } + + function groupEventedAnimations(element, event, options, animations, fnName) { + var operations = []; + forEach(animations, function(ani) { + var animation = ani[fnName]; + if (!animation) return; + + // note that all of these animations will run in parallel + operations.push(function() { + var runner; + var endProgressCb; + + var resolved = false; + var onAnimationComplete = function(rejected) { + if (!resolved) { + resolved = true; + (endProgressCb || noop)(rejected); + runner.complete(!rejected); + } + }; + + runner = new $$AnimateRunner({ + end: function() { + onAnimationComplete(); + }, + cancel: function() { + onAnimationComplete(true); + } + }); + + endProgressCb = executeAnimationFn(animation, element, event, options, function(result) { + var cancelled = result === false; + onAnimationComplete(cancelled); + }); + + return runner; + }); + }); + + return operations; + } + + function packageAnimations(element, event, options, animations, fnName) { + var operations = groupEventedAnimations(element, event, options, animations, fnName); + if (operations.length === 0) { + var a, b; + if (fnName === 'beforeSetClass') { + a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass'); + b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass'); + } else if (fnName === 'setClass') { + a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass'); + b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass'); + } + + if (a) { + operations = operations.concat(a); + } + if (b) { + operations = operations.concat(b); + } + } + + if (operations.length === 0) return; + + // TODO(matsko): add documentation + return function startAnimation(callback) { + var runners = []; + if (operations.length) { + forEach(operations, function(animateFn) { + runners.push(animateFn()); + }); + } + + if (runners.length) { + $$AnimateRunner.all(runners, callback); + } else { + callback(); + } + + return function endFn(reject) { + forEach(runners, function(runner) { + if (reject) { + runner.cancel(); + } else { + runner.end(); + } + }); + }; + }; + } + }; + + function lookupAnimations(classes) { + classes = isArray(classes) ? classes : classes.split(' '); + var matches = [], flagMap = {}; + for (var i = 0; i < classes.length; i++) { + var klass = classes[i], + animationFactory = $animateProvider.$$registeredAnimations[klass]; + if (animationFactory && !flagMap[klass]) { + matches.push($injector.get(animationFactory)); + flagMap[klass] = true; + } + } + return matches; + } + }]; +}]; + +var $$AnimateJsDriverProvider = ['$$animationProvider', /** @this */ function($$animationProvider) { + $$animationProvider.drivers.push('$$animateJsDriver'); + this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) { + return function initDriverFn(animationDetails) { + if (animationDetails.from && animationDetails.to) { + var fromAnimation = prepareAnimation(animationDetails.from); + var toAnimation = prepareAnimation(animationDetails.to); + if (!fromAnimation && !toAnimation) return; + + return { + start: function() { + var animationRunners = []; + + if (fromAnimation) { + animationRunners.push(fromAnimation.start()); + } + + if (toAnimation) { + animationRunners.push(toAnimation.start()); + } + + $$AnimateRunner.all(animationRunners, done); + + var runner = new $$AnimateRunner({ + end: endFnFactory(), + cancel: endFnFactory() + }); + + return runner; + + function endFnFactory() { + return function() { + forEach(animationRunners, function(runner) { + // at this point we cannot cancel animations for groups just yet. 1.5+ + runner.end(); + }); + }; + } + + function done(status) { + runner.complete(status); + } + } + }; + } else { + return prepareAnimation(animationDetails); + } + }; + + function prepareAnimation(animationDetails) { + // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations + var element = animationDetails.element; + var event = animationDetails.event; + var options = animationDetails.options; + var classes = animationDetails.classes; + return $$animateJs(element, event, classes, options); + } + }]; +}]; + +var NG_ANIMATE_ATTR_NAME = 'data-ng-animate'; +var NG_ANIMATE_PIN_DATA = '$ngAnimatePin'; +var $$AnimateQueueProvider = ['$animateProvider', /** @this */ function($animateProvider) { + var PRE_DIGEST_STATE = 1; + var RUNNING_STATE = 2; + var ONE_SPACE = ' '; + + var rules = this.rules = { + skip: [], + cancel: [], + join: [] + }; + + function getEventData(options) { + return { + addClass: options.addClass, + removeClass: options.removeClass, + from: options.from, + to: options.to + }; + } + + function makeTruthyCssClassMap(classString) { + if (!classString) { + return null; + } + + var keys = classString.split(ONE_SPACE); + var map = Object.create(null); + + forEach(keys, function(key) { + map[key] = true; + }); + return map; + } + + function hasMatchingClasses(newClassString, currentClassString) { + if (newClassString && currentClassString) { + var currentClassMap = makeTruthyCssClassMap(currentClassString); + return newClassString.split(ONE_SPACE).some(function(className) { + return currentClassMap[className]; + }); + } + } + + function isAllowed(ruleType, currentAnimation, previousAnimation) { + return rules[ruleType].some(function(fn) { + return fn(currentAnimation, previousAnimation); + }); + } + + function hasAnimationClasses(animation, and) { + var a = (animation.addClass || '').length > 0; + var b = (animation.removeClass || '').length > 0; + return and ? a && b : a || b; + } + + rules.join.push(function(newAnimation, currentAnimation) { + // if the new animation is class-based then we can just tack that on + return !newAnimation.structural && hasAnimationClasses(newAnimation); + }); + + rules.skip.push(function(newAnimation, currentAnimation) { + // there is no need to animate anything if no classes are being added and + // there is no structural animation that will be triggered + return !newAnimation.structural && !hasAnimationClasses(newAnimation); + }); + + rules.skip.push(function(newAnimation, currentAnimation) { + // why should we trigger a new structural animation if the element will + // be removed from the DOM anyway? + return currentAnimation.event === 'leave' && newAnimation.structural; + }); + + rules.skip.push(function(newAnimation, currentAnimation) { + // if there is an ongoing current animation then don't even bother running the class-based animation + return currentAnimation.structural && currentAnimation.state === RUNNING_STATE && !newAnimation.structural; + }); + + rules.cancel.push(function(newAnimation, currentAnimation) { + // there can never be two structural animations running at the same time + return currentAnimation.structural && newAnimation.structural; + }); + + rules.cancel.push(function(newAnimation, currentAnimation) { + // if the previous animation is already running, but the new animation will + // be triggered, but the new animation is structural + return currentAnimation.state === RUNNING_STATE && newAnimation.structural; + }); + + rules.cancel.push(function(newAnimation, currentAnimation) { + // cancel the animation if classes added / removed in both animation cancel each other out, + // but only if the current animation isn't structural + + if (currentAnimation.structural) return false; + + var nA = newAnimation.addClass; + var nR = newAnimation.removeClass; + var cA = currentAnimation.addClass; + var cR = currentAnimation.removeClass; + + // early detection to save the global CPU shortage :) + if ((isUndefined(nA) && isUndefined(nR)) || (isUndefined(cA) && isUndefined(cR))) { + return false; + } + + return hasMatchingClasses(nA, cR) || hasMatchingClasses(nR, cA); + }); + + this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$Map', + '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite', '$$forceReflow', + '$$isDocumentHidden', + function($$rAF, $rootScope, $rootElement, $document, $$Map, + $$animation, $$AnimateRunner, $templateRequest, $$jqLite, $$forceReflow, + $$isDocumentHidden) { + + var activeAnimationsLookup = new $$Map(); + var disabledElementsLookup = new $$Map(); + var animationsEnabled = null; + + function removeFromDisabledElementsLookup(evt) { + disabledElementsLookup.delete(evt.target); + } + + function postDigestTaskFactory() { + var postDigestCalled = false; + return function(fn) { + // we only issue a call to postDigest before + // it has first passed. This prevents any callbacks + // from not firing once the animation has completed + // since it will be out of the digest cycle. + if (postDigestCalled) { + fn(); + } else { + $rootScope.$$postDigest(function() { + postDigestCalled = true; + fn(); + }); + } + }; + } + + // Wait until all directive and route-related templates are downloaded and + // compiled. The $templateRequest.totalPendingRequests variable keeps track of + // all of the remote templates being currently downloaded. If there are no + // templates currently downloading then the watcher will still fire anyway. + var deregisterWatch = $rootScope.$watch( + function() { return $templateRequest.totalPendingRequests === 0; }, + function(isEmpty) { + if (!isEmpty) return; + deregisterWatch(); + + // Now that all templates have been downloaded, $animate will wait until + // the post digest queue is empty before enabling animations. By having two + // calls to $postDigest calls we can ensure that the flag is enabled at the + // very end of the post digest queue. Since all of the animations in $animate + // use $postDigest, it's important that the code below executes at the end. + // This basically means that the page is fully downloaded and compiled before + // any animations are triggered. + $rootScope.$$postDigest(function() { + $rootScope.$$postDigest(function() { + // we check for null directly in the event that the application already called + // .enabled() with whatever arguments that it provided it with + if (animationsEnabled === null) { + animationsEnabled = true; + } + }); + }); + } + ); + + var callbackRegistry = Object.create(null); + + // remember that the `customFilter`/`classNameFilter` are set during the + // provider/config stage therefore we can optimize here and setup helper functions + var customFilter = $animateProvider.customFilter(); + var classNameFilter = $animateProvider.classNameFilter(); + var returnTrue = function() { return true; }; + + var isAnimatableByFilter = customFilter || returnTrue; + var isAnimatableClassName = !classNameFilter ? returnTrue : function(node, options) { + var className = [node.getAttribute('class'), options.addClass, options.removeClass].join(' '); + return classNameFilter.test(className); + }; + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function normalizeAnimationDetails(element, animation) { + return mergeAnimationDetails(element, animation, {}); + } + + // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259. + var contains = window.Node.prototype.contains || /** @this */ function(arg) { + // eslint-disable-next-line no-bitwise + return this === arg || !!(this.compareDocumentPosition(arg) & 16); + }; + + function findCallbacks(targetParentNode, targetNode, event) { + var matches = []; + var entries = callbackRegistry[event]; + if (entries) { + forEach(entries, function(entry) { + if (contains.call(entry.node, targetNode)) { + matches.push(entry.callback); + } else if (event === 'leave' && contains.call(entry.node, targetParentNode)) { + matches.push(entry.callback); + } + }); + } + + return matches; + } + + function filterFromRegistry(list, matchContainer, matchCallback) { + var containerNode = extractElementNode(matchContainer); + return list.filter(function(entry) { + var isMatch = entry.node === containerNode && + (!matchCallback || entry.callback === matchCallback); + return !isMatch; + }); + } + + function cleanupEventListeners(phase, node) { + if (phase === 'close' && !node.parentNode) { + // If the element is not attached to a parentNode, it has been removed by + // the domOperation, and we can safely remove the event callbacks + $animate.off(node); + } + } + + var $animate = { + on: function(event, container, callback) { + var node = extractElementNode(container); + callbackRegistry[event] = callbackRegistry[event] || []; + callbackRegistry[event].push({ + node: node, + callback: callback + }); + + // Remove the callback when the element is removed from the DOM + jqLite(container).on('$destroy', function() { + var animationDetails = activeAnimationsLookup.get(node); + + if (!animationDetails) { + // If there's an animation ongoing, the callback calling code will remove + // the event listeners. If we'd remove here, the callbacks would be removed + // before the animation ends + $animate.off(event, container, callback); + } + }); + }, + + off: function(event, container, callback) { + if (arguments.length === 1 && !isString(arguments[0])) { + container = arguments[0]; + for (var eventType in callbackRegistry) { + callbackRegistry[eventType] = filterFromRegistry(callbackRegistry[eventType], container); + } + + return; + } + + var entries = callbackRegistry[event]; + if (!entries) return; + + callbackRegistry[event] = arguments.length === 1 + ? null + : filterFromRegistry(entries, container, callback); + }, + + pin: function(element, parentElement) { + assertArg(isElement(element), 'element', 'not an element'); + assertArg(isElement(parentElement), 'parentElement', 'not an element'); + element.data(NG_ANIMATE_PIN_DATA, parentElement); + }, + + push: function(element, event, options, domOperation) { + options = options || {}; + options.domOperation = domOperation; + return queueAnimation(element, event, options); + }, + + // this method has four signatures: + // () - global getter + // (bool) - global setter + // (element) - element getter + // (element, bool) - element setter + enabled: function(element, bool) { + var argCount = arguments.length; + + if (argCount === 0) { + // () - Global getter + bool = !!animationsEnabled; + } else { + var hasElement = isElement(element); + + if (!hasElement) { + // (bool) - Global setter + bool = animationsEnabled = !!element; + } else { + var node = getDomNode(element); + + if (argCount === 1) { + // (element) - Element getter + bool = !disabledElementsLookup.get(node); + } else { + // (element, bool) - Element setter + if (!disabledElementsLookup.has(node)) { + // The element is added to the map for the first time. + // Create a listener to remove it on `$destroy` (to avoid memory leak). + jqLite(element).on('$destroy', removeFromDisabledElementsLookup); + } + disabledElementsLookup.set(node, !bool); + } + } + } + + return bool; + } + }; + + return $animate; + + function queueAnimation(originalElement, event, initialOptions) { + // we always make a copy of the options since + // there should never be any side effects on + // the input data when running `$animateCss`. + var options = copy(initialOptions); + + var element = stripCommentsFromElement(originalElement); + var node = getDomNode(element); + var parentNode = node && node.parentNode; + + options = prepareAnimationOptions(options); + + // we create a fake runner with a working promise. + // These methods will become available after the digest has passed + var runner = new $$AnimateRunner(); + + // this is used to trigger callbacks in postDigest mode + var runInNextPostDigestOrNow = postDigestTaskFactory(); + + if (isArray(options.addClass)) { + options.addClass = options.addClass.join(' '); + } + + if (options.addClass && !isString(options.addClass)) { + options.addClass = null; + } + + if (isArray(options.removeClass)) { + options.removeClass = options.removeClass.join(' '); + } + + if (options.removeClass && !isString(options.removeClass)) { + options.removeClass = null; + } + + if (options.from && !isObject(options.from)) { + options.from = null; + } + + if (options.to && !isObject(options.to)) { + options.to = null; + } + + // If animations are hard-disabled for the whole application there is no need to continue. + // There are also situations where a directive issues an animation for a jqLite wrapper that + // contains only comment nodes. In this case, there is no way we can perform an animation. + if (!animationsEnabled || + !node || + !isAnimatableByFilter(node, event, initialOptions) || + !isAnimatableClassName(node, options)) { + close(); + return runner; + } + + var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; + + var documentHidden = $$isDocumentHidden(); + + // This is a hard disable of all animations the element itself, therefore there is no need to + // continue further past this point if not enabled + // Animations are also disabled if the document is currently hidden (page is not visible + // to the user), because browsers slow down or do not flush calls to requestAnimationFrame + var skipAnimations = documentHidden || disabledElementsLookup.get(node); + var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {}; + var hasExistingAnimation = !!existingAnimation.state; + + // there is no point in traversing the same collection of parent ancestors if a followup + // animation will be run on the same element that already did all that checking work + if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state !== PRE_DIGEST_STATE)) { + skipAnimations = !areAnimationsAllowed(node, parentNode, event); + } + + if (skipAnimations) { + // Callbacks should fire even if the document is hidden (regression fix for issue #14120) + if (documentHidden) notifyProgress(runner, event, 'start', getEventData(options)); + close(); + if (documentHidden) notifyProgress(runner, event, 'close', getEventData(options)); + return runner; + } + + if (isStructural) { + closeChildAnimations(node); + } + + var newAnimation = { + structural: isStructural, + element: element, + event: event, + addClass: options.addClass, + removeClass: options.removeClass, + close: close, + options: options, + runner: runner + }; + + if (hasExistingAnimation) { + var skipAnimationFlag = isAllowed('skip', newAnimation, existingAnimation); + if (skipAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + close(); + return runner; + } else { + mergeAnimationDetails(element, existingAnimation, newAnimation); + return existingAnimation.runner; + } + } + var cancelAnimationFlag = isAllowed('cancel', newAnimation, existingAnimation); + if (cancelAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + // this will end the animation right away and it is safe + // to do so since the animation is already running and the + // runner callback code will run in async + existingAnimation.runner.end(); + } else if (existingAnimation.structural) { + // this means that the animation is queued into a digest, but + // hasn't started yet. Therefore it is safe to run the close + // method which will call the runner methods in async. + existingAnimation.close(); + } else { + // this will merge the new animation options into existing animation options + mergeAnimationDetails(element, existingAnimation, newAnimation); + + return existingAnimation.runner; + } + } else { + // a joined animation means that this animation will take over the existing one + // so an example would involve a leave animation taking over an enter. Then when + // the postDigest kicks in the enter will be ignored. + var joinAnimationFlag = isAllowed('join', newAnimation, existingAnimation); + if (joinAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + normalizeAnimationDetails(element, newAnimation); + } else { + applyGeneratedPreparationClasses($$jqLite, element, isStructural ? event : null, options); + + event = newAnimation.event = existingAnimation.event; + options = mergeAnimationDetails(element, existingAnimation, newAnimation); + + //we return the same runner since only the option values of this animation will + //be fed into the `existingAnimation`. + return existingAnimation.runner; + } + } + } + } else { + // normalization in this case means that it removes redundant CSS classes that + // already exist (addClass) or do not exist (removeClass) on the element + normalizeAnimationDetails(element, newAnimation); + } + + // when the options are merged and cleaned up we may end up not having to do + // an animation at all, therefore we should check this before issuing a post + // digest callback. Structural animations will always run no matter what. + var isValidAnimation = newAnimation.structural; + if (!isValidAnimation) { + // animate (from/to) can be quickly checked first, otherwise we check if any classes are present + isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0) + || hasAnimationClasses(newAnimation); + } + + if (!isValidAnimation) { + close(); + clearElementAnimationState(node); + return runner; + } + + // the counter keeps track of cancelled animations + var counter = (existingAnimation.counter || 0) + 1; + newAnimation.counter = counter; + + markElementAnimationState(node, PRE_DIGEST_STATE, newAnimation); + + $rootScope.$$postDigest(function() { + // It is possible that the DOM nodes inside `originalElement` have been replaced. This can + // happen if the animated element is a transcluded clone and also has a `templateUrl` + // directive on it. Therefore, we must recreate `element` in order to interact with the + // actual DOM nodes. + // Note: We still need to use the old `node` for certain things, such as looking up in + // HashMaps where it was used as the key. + + element = stripCommentsFromElement(originalElement); + + var animationDetails = activeAnimationsLookup.get(node); + var animationCancelled = !animationDetails; + animationDetails = animationDetails || {}; + + // if addClass/removeClass is called before something like enter then the + // registered parent element may not be present. The code below will ensure + // that a final value for parent element is obtained + var parentElement = element.parent() || []; + + // animate/structural/class-based animations all have requirements. Otherwise there + // is no point in performing an animation. The parent node must also be set. + var isValidAnimation = parentElement.length > 0 + && (animationDetails.event === 'animate' + || animationDetails.structural + || hasAnimationClasses(animationDetails)); + + // this means that the previous animation was cancelled + // even if the follow-up animation is the same event + if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) { + // if another animation did not take over then we need + // to make sure that the domOperation and options are + // handled accordingly + if (animationCancelled) { + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + } + + // if the event changed from something like enter to leave then we do + // it, otherwise if it's the same then the end result will be the same too + if (animationCancelled || (isStructural && animationDetails.event !== event)) { + options.domOperation(); + runner.end(); + } + + // in the event that the element animation was not cancelled or a follow-up animation + // isn't allowed to animate from here then we need to clear the state of the element + // so that any future animations won't read the expired animation data. + if (!isValidAnimation) { + clearElementAnimationState(node); + } + + return; + } + + // this combined multiple class to addClass / removeClass into a setClass event + // so long as a structural event did not take over the animation + event = !animationDetails.structural && hasAnimationClasses(animationDetails, true) + ? 'setClass' + : animationDetails.event; + + markElementAnimationState(node, RUNNING_STATE); + var realRunner = $$animation(element, event, animationDetails.options); + + // this will update the runner's flow-control events based on + // the `realRunner` object. + runner.setHost(realRunner); + notifyProgress(runner, event, 'start', getEventData(options)); + + realRunner.done(function(status) { + close(!status); + var animationDetails = activeAnimationsLookup.get(node); + if (animationDetails && animationDetails.counter === counter) { + clearElementAnimationState(node); + } + notifyProgress(runner, event, 'close', getEventData(options)); + }); + }); + + return runner; + + function notifyProgress(runner, event, phase, data) { + runInNextPostDigestOrNow(function() { + var callbacks = findCallbacks(parentNode, node, event); + if (callbacks.length) { + // do not optimize this call here to RAF because + // we don't know how heavy the callback code here will + // be and if this code is buffered then this can + // lead to a performance regression. + $$rAF(function() { + forEach(callbacks, function(callback) { + callback(element, phase, data); + }); + cleanupEventListeners(phase, node); + }); + } else { + cleanupEventListeners(phase, node); + } + }); + runner.progress(event, phase, data); + } + + function close(reject) { + clearGeneratedClasses(element, options); + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + options.domOperation(); + runner.complete(!reject); + } + } + + function closeChildAnimations(node) { + var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']'); + forEach(children, function(child) { + var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME), 10); + var animationDetails = activeAnimationsLookup.get(child); + if (animationDetails) { + switch (state) { + case RUNNING_STATE: + animationDetails.runner.end(); + /* falls through */ + case PRE_DIGEST_STATE: + activeAnimationsLookup.delete(child); + break; + } + } + }); + } + + function clearElementAnimationState(node) { + node.removeAttribute(NG_ANIMATE_ATTR_NAME); + activeAnimationsLookup.delete(node); + } + + /** + * This fn returns false if any of the following is true: + * a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed + * b) a parent element has an ongoing structural animation, and animateChildren is false + * c) the element is not a child of the body + * d) the element is not a child of the $rootElement + */ + function areAnimationsAllowed(node, parentNode, event) { + var bodyNode = $document[0].body; + var rootNode = getDomNode($rootElement); + + var bodyNodeDetected = (node === bodyNode) || node.nodeName === 'HTML'; + var rootNodeDetected = (node === rootNode); + var parentAnimationDetected = false; + var elementDisabled = disabledElementsLookup.get(node); + var animateChildren; + + var parentHost = jqLite.data(node, NG_ANIMATE_PIN_DATA); + if (parentHost) { + parentNode = getDomNode(parentHost); + } + + while (parentNode) { + if (!rootNodeDetected) { + // AngularJS doesn't want to attempt to animate elements outside of the application + // therefore we need to ensure that the rootElement is an ancestor of the current element + rootNodeDetected = (parentNode === rootNode); + } + + if (parentNode.nodeType !== ELEMENT_NODE) { + // no point in inspecting the #document element + break; + } + + var details = activeAnimationsLookup.get(parentNode) || {}; + // either an enter, leave or move animation will commence + // therefore we can't allow any animations to take place + // but if a parent animation is class-based then that's ok + if (!parentAnimationDetected) { + var parentNodeDisabled = disabledElementsLookup.get(parentNode); + + if (parentNodeDisabled === true && elementDisabled !== false) { + // disable animations if the user hasn't explicitly enabled animations on the + // current element + elementDisabled = true; + // element is disabled via parent element, no need to check anything else + break; + } else if (parentNodeDisabled === false) { + elementDisabled = false; + } + parentAnimationDetected = details.structural; + } + + if (isUndefined(animateChildren) || animateChildren === true) { + var value = jqLite.data(parentNode, NG_ANIMATE_CHILDREN_DATA); + if (isDefined(value)) { + animateChildren = value; + } + } + + // there is no need to continue traversing at this point + if (parentAnimationDetected && animateChildren === false) break; + + if (!bodyNodeDetected) { + // we also need to ensure that the element is or will be a part of the body element + // otherwise it is pointless to even issue an animation to be rendered + bodyNodeDetected = (parentNode === bodyNode); + } + + if (bodyNodeDetected && rootNodeDetected) { + // If both body and root have been found, any other checks are pointless, + // as no animation data should live outside the application + break; + } + + if (!rootNodeDetected) { + // If `rootNode` is not detected, check if `parentNode` is pinned to another element + parentHost = jqLite.data(parentNode, NG_ANIMATE_PIN_DATA); + if (parentHost) { + // The pin target element becomes the next parent element + parentNode = getDomNode(parentHost); + continue; + } + } + + parentNode = parentNode.parentNode; + } + + var allowAnimation = (!parentAnimationDetected || animateChildren) && elementDisabled !== true; + return allowAnimation && rootNodeDetected && bodyNodeDetected; + } + + function markElementAnimationState(node, state, details) { + details = details || {}; + details.state = state; + + node.setAttribute(NG_ANIMATE_ATTR_NAME, state); + + var oldValue = activeAnimationsLookup.get(node); + var newValue = oldValue + ? extend(oldValue, details) + : details; + activeAnimationsLookup.set(node, newValue); + } + }]; +}]; + +/** @this */ +var $$AnimateCacheProvider = function() { + + var KEY = '$$ngAnimateParentKey'; + var parentCounter = 0; + var cache = Object.create(null); + + this.$get = [function() { + return { + cacheKey: function(node, method, addClass, removeClass) { + var parentNode = node.parentNode; + var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter); + var parts = [parentID, method, node.getAttribute('class')]; + if (addClass) { + parts.push(addClass); + } + if (removeClass) { + parts.push(removeClass); + } + return parts.join(' '); + }, + + containsCachedAnimationWithoutDuration: function(key) { + var entry = cache[key]; + + // nothing cached, so go ahead and animate + // otherwise it should be a valid animation + return (entry && !entry.isValid) || false; + }, + + flush: function() { + cache = Object.create(null); + }, + + count: function(key) { + var entry = cache[key]; + return entry ? entry.total : 0; + }, + + get: function(key) { + var entry = cache[key]; + return entry && entry.value; + }, + + put: function(key, value, isValid) { + if (!cache[key]) { + cache[key] = { total: 1, value: value, isValid: isValid }; + } else { + cache[key].total++; + cache[key].value = value; + } + } + }; + }]; +}; + +/* exported $$AnimationProvider */ + +var $$AnimationProvider = ['$animateProvider', /** @this */ function($animateProvider) { + var NG_ANIMATE_REF_ATTR = 'ng-animate-ref'; + + var drivers = this.drivers = []; + + var RUNNER_STORAGE_KEY = '$$animationRunner'; + var PREPARE_CLASSES_KEY = '$$animatePrepareClasses'; + + function setRunner(element, runner) { + element.data(RUNNER_STORAGE_KEY, runner); + } + + function removeRunner(element) { + element.removeData(RUNNER_STORAGE_KEY); + } + + function getRunner(element) { + return element.data(RUNNER_STORAGE_KEY); + } + + this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$Map', '$$rAFScheduler', '$$animateCache', + function($$jqLite, $rootScope, $injector, $$AnimateRunner, $$Map, $$rAFScheduler, $$animateCache) { + + var animationQueue = []; + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function sortAnimations(animations) { + var tree = { children: [] }; + var i, lookup = new $$Map(); + + // this is done first beforehand so that the map + // is filled with a list of the elements that will be animated + for (i = 0; i < animations.length; i++) { + var animation = animations[i]; + lookup.set(animation.domNode, animations[i] = { + domNode: animation.domNode, + element: animation.element, + fn: animation.fn, + children: [] + }); + } + + for (i = 0; i < animations.length; i++) { + processNode(animations[i]); + } + + return flatten(tree); + + function processNode(entry) { + if (entry.processed) return entry; + entry.processed = true; + + var elementNode = entry.domNode; + var parentNode = elementNode.parentNode; + lookup.set(elementNode, entry); + + var parentEntry; + while (parentNode) { + parentEntry = lookup.get(parentNode); + if (parentEntry) { + if (!parentEntry.processed) { + parentEntry = processNode(parentEntry); + } + break; + } + parentNode = parentNode.parentNode; + } + + (parentEntry || tree).children.push(entry); + return entry; + } + + function flatten(tree) { + var result = []; + var queue = []; + var i; + + for (i = 0; i < tree.children.length; i++) { + queue.push(tree.children[i]); + } + + var remainingLevelEntries = queue.length; + var nextLevelEntries = 0; + var row = []; + + for (i = 0; i < queue.length; i++) { + var entry = queue[i]; + if (remainingLevelEntries <= 0) { + remainingLevelEntries = nextLevelEntries; + nextLevelEntries = 0; + result.push(row); + row = []; + } + row.push(entry); + entry.children.forEach(function(childEntry) { + nextLevelEntries++; + queue.push(childEntry); + }); + remainingLevelEntries--; + } + + if (row.length) { + result.push(row); + } + + return result; + } + } + + // TODO(matsko): document the signature in a better way + return function(element, event, options) { + options = prepareAnimationOptions(options); + var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; + + // there is no animation at the current moment, however + // these runner methods will get later updated with the + // methods leading into the driver's end/cancel methods + // for now they just stop the animation from starting + var runner = new $$AnimateRunner({ + end: function() { close(); }, + cancel: function() { close(true); } + }); + + if (!drivers.length) { + close(); + return runner; + } + + var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass)); + var tempClasses = options.tempClasses; + if (tempClasses) { + classes += ' ' + tempClasses; + options.tempClasses = null; + } + + if (isStructural) { + element.data(PREPARE_CLASSES_KEY, 'ng-' + event + PREPARE_CLASS_SUFFIX); + } + + setRunner(element, runner); + + animationQueue.push({ + // this data is used by the postDigest code and passed into + // the driver step function + element: element, + classes: classes, + event: event, + structural: isStructural, + options: options, + beforeStart: beforeStart, + close: close + }); + + element.on('$destroy', handleDestroyedElement); + + // we only want there to be one function called within the post digest + // block. This way we can group animations for all the animations that + // were apart of the same postDigest flush call. + if (animationQueue.length > 1) return runner; + + $rootScope.$$postDigest(function() { + var animations = []; + forEach(animationQueue, function(entry) { + // the element was destroyed early on which removed the runner + // form its storage. This means we can't animate this element + // at all and it already has been closed due to destruction. + if (getRunner(entry.element)) { + animations.push(entry); + } else { + entry.close(); + } + }); + + // now any future animations will be in another postDigest + animationQueue.length = 0; + + var groupedAnimations = groupAnimations(animations); + var toBeSortedAnimations = []; + + forEach(groupedAnimations, function(animationEntry) { + var element = animationEntry.from ? animationEntry.from.element : animationEntry.element; + var extraClasses = options.addClass; + + extraClasses = (extraClasses ? (extraClasses + ' ') : '') + NG_ANIMATE_CLASSNAME; + var cacheKey = $$animateCache.cacheKey(element[0], animationEntry.event, extraClasses, options.removeClass); + + toBeSortedAnimations.push({ + element: element, + domNode: getDomNode(element), + fn: function triggerAnimationStart() { + var startAnimationFn, closeFn = animationEntry.close; + + // in the event that we've cached the animation status for this element + // and it's in fact an invalid animation (something that has duration = 0) + // then we should skip all the heavy work from here on + if ($$animateCache.containsCachedAnimationWithoutDuration(cacheKey)) { + closeFn(); + return; + } + + // it's important that we apply the `ng-animate` CSS class and the + // temporary classes before we do any driver invoking since these + // CSS classes may be required for proper CSS detection. + animationEntry.beforeStart(); + + // in the event that the element was removed before the digest runs or + // during the RAF sequencing then we should not trigger the animation. + var targetElement = animationEntry.anchors + ? (animationEntry.from.element || animationEntry.to.element) + : animationEntry.element; + + if (getRunner(targetElement)) { + var operation = invokeFirstDriver(animationEntry); + if (operation) { + startAnimationFn = operation.start; + } + } + + if (!startAnimationFn) { + closeFn(); + } else { + var animationRunner = startAnimationFn(); + animationRunner.done(function(status) { + closeFn(!status); + }); + updateAnimationRunners(animationEntry, animationRunner); + } + } + }); + }); + + // we need to sort each of the animations in order of parent to child + // relationships. This ensures that the child classes are applied at the + // right time. + var finalAnimations = sortAnimations(toBeSortedAnimations); + for (var i = 0; i < finalAnimations.length; i++) { + var innerArray = finalAnimations[i]; + for (var j = 0; j < innerArray.length; j++) { + var entry = innerArray[j]; + var element = entry.element; + + // the RAFScheduler code only uses functions + finalAnimations[i][j] = entry.fn; + + // the first row of elements shouldn't have a prepare-class added to them + // since the elements are at the top of the animation hierarchy and they + // will be applied without a RAF having to pass... + if (i === 0) { + element.removeData(PREPARE_CLASSES_KEY); + continue; + } + + var prepareClassName = element.data(PREPARE_CLASSES_KEY); + if (prepareClassName) { + $$jqLite.addClass(element, prepareClassName); + } + } + } + + $$rAFScheduler(finalAnimations); + }); + + return runner; + + // TODO(matsko): change to reference nodes + function getAnchorNodes(node) { + var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']'; + var items = node.hasAttribute(NG_ANIMATE_REF_ATTR) + ? [node] + : node.querySelectorAll(SELECTOR); + var anchors = []; + forEach(items, function(node) { + var attr = node.getAttribute(NG_ANIMATE_REF_ATTR); + if (attr && attr.length) { + anchors.push(node); + } + }); + return anchors; + } + + function groupAnimations(animations) { + var preparedAnimations = []; + var refLookup = {}; + forEach(animations, function(animation, index) { + var element = animation.element; + var node = getDomNode(element); + var event = animation.event; + var enterOrMove = ['enter', 'move'].indexOf(event) >= 0; + var anchorNodes = animation.structural ? getAnchorNodes(node) : []; + + if (anchorNodes.length) { + var direction = enterOrMove ? 'to' : 'from'; + + forEach(anchorNodes, function(anchor) { + var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR); + refLookup[key] = refLookup[key] || {}; + refLookup[key][direction] = { + animationID: index, + element: jqLite(anchor) + }; + }); + } else { + preparedAnimations.push(animation); + } + }); + + var usedIndicesLookup = {}; + var anchorGroups = {}; + forEach(refLookup, function(operations, key) { + var from = operations.from; + var to = operations.to; + + if (!from || !to) { + // only one of these is set therefore we can't have an + // anchor animation since all three pieces are required + var index = from ? from.animationID : to.animationID; + var indexKey = index.toString(); + if (!usedIndicesLookup[indexKey]) { + usedIndicesLookup[indexKey] = true; + preparedAnimations.push(animations[index]); + } + return; + } + + var fromAnimation = animations[from.animationID]; + var toAnimation = animations[to.animationID]; + var lookupKey = from.animationID.toString(); + if (!anchorGroups[lookupKey]) { + var group = anchorGroups[lookupKey] = { + structural: true, + beforeStart: function() { + fromAnimation.beforeStart(); + toAnimation.beforeStart(); + }, + close: function() { + fromAnimation.close(); + toAnimation.close(); + }, + classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes), + from: fromAnimation, + to: toAnimation, + anchors: [] // TODO(matsko): change to reference nodes + }; + + // the anchor animations require that the from and to elements both have at least + // one shared CSS class which effectively marries the two elements together to use + // the same animation driver and to properly sequence the anchor animation. + if (group.classes.length) { + preparedAnimations.push(group); + } else { + preparedAnimations.push(fromAnimation); + preparedAnimations.push(toAnimation); + } + } + + anchorGroups[lookupKey].anchors.push({ + 'out': from.element, 'in': to.element + }); + }); + + return preparedAnimations; + } + + function cssClassesIntersection(a,b) { + a = a.split(' '); + b = b.split(' '); + var matches = []; + + for (var i = 0; i < a.length; i++) { + var aa = a[i]; + if (aa.substring(0,3) === 'ng-') continue; + + for (var j = 0; j < b.length; j++) { + if (aa === b[j]) { + matches.push(aa); + break; + } + } + } + + return matches.join(' '); + } + + function invokeFirstDriver(animationDetails) { + // we loop in reverse order since the more general drivers (like CSS and JS) + // may attempt more elements, but custom drivers are more particular + for (var i = drivers.length - 1; i >= 0; i--) { + var driverName = drivers[i]; + var factory = $injector.get(driverName); + var driver = factory(animationDetails); + if (driver) { + return driver; + } + } + } + + function beforeStart() { + tempClasses = (tempClasses ? (tempClasses + ' ') : '') + NG_ANIMATE_CLASSNAME; + $$jqLite.addClass(element, tempClasses); + + var prepareClassName = element.data(PREPARE_CLASSES_KEY); + if (prepareClassName) { + $$jqLite.removeClass(element, prepareClassName); + prepareClassName = null; + } + } + + function updateAnimationRunners(animation, newRunner) { + if (animation.from && animation.to) { + update(animation.from.element); + update(animation.to.element); + } else { + update(animation.element); + } + + function update(element) { + var runner = getRunner(element); + if (runner) runner.setHost(newRunner); + } + } + + function handleDestroyedElement() { + var runner = getRunner(element); + if (runner && (event !== 'leave' || !options.$$domOperationFired)) { + runner.end(); + } + } + + function close(rejected) { + element.off('$destroy', handleDestroyedElement); + removeRunner(element); + + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + options.domOperation(); + + if (tempClasses) { + $$jqLite.removeClass(element, tempClasses); + } + + runner.complete(!rejected); + } + }; + }]; +}]; + +/** + * @ngdoc directive + * @name ngAnimateSwap + * @restrict A + * @scope + * + * @description + * + * ngAnimateSwap is a animation-oriented directive that allows for the container to + * be removed and entered in whenever the associated expression changes. A + * common usecase for this directive is a rotating banner or slider component which + * contains one image being present at a time. When the active image changes + * then the old image will perform a `leave` animation and the new element + * will be inserted via an `enter` animation. + * + * @animations + * | Animation | Occurs | + * |----------------------------------|--------------------------------------| + * | {@link ng.$animate#enter enter} | when the new element is inserted to the DOM | + * | {@link ng.$animate#leave leave} | when the old element is removed from the DOM | + * + * @example + * + * + *
    + *
    + * {{ number }} + *
    + *
    + *
    + * + * angular.module('ngAnimateSwapExample', ['ngAnimate']) + * .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) { + * $scope.number = 0; + * $interval(function() { + * $scope.number++; + * }, 1000); + * + * var colors = ['red','blue','green','yellow','orange']; + * $scope.colorClass = function(number) { + * return colors[number % colors.length]; + * }; + * }]); + * + * + * .container { + * height:250px; + * width:250px; + * position:relative; + * overflow:hidden; + * border:2px solid black; + * } + * .container .cell { + * font-size:150px; + * text-align:center; + * line-height:250px; + * position:absolute; + * top:0; + * left:0; + * right:0; + * border-bottom:2px solid black; + * } + * .swap-animation.ng-enter, .swap-animation.ng-leave { + * transition:0.5s linear all; + * } + * .swap-animation.ng-enter { + * top:-250px; + * } + * .swap-animation.ng-enter-active { + * top:0px; + * } + * .swap-animation.ng-leave { + * top:0px; + * } + * .swap-animation.ng-leave-active { + * top:250px; + * } + * .red { background:red; } + * .green { background:green; } + * .blue { background:blue; } + * .yellow { background:yellow; } + * .orange { background:orange; } + * + *
    + */ +var ngAnimateSwapDirective = ['$animate', function($animate) { + return { + restrict: 'A', + transclude: 'element', + terminal: true, + priority: 550, // We use 550 here to ensure that the directive is caught before others, + // but after `ngIf` (at priority 600). + link: function(scope, $element, attrs, ctrl, $transclude) { + var previousElement, previousScope; + scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) { + if (previousElement) { + $animate.leave(previousElement); + } + if (previousScope) { + previousScope.$destroy(); + previousScope = null; + } + if (value || value === 0) { + $transclude(function(clone, childScope) { + previousElement = clone; + previousScope = childScope; + $animate.enter(clone, null, $element); + }); + } + }); + } + }; +}]; + +/** + * @ngdoc module + * @name ngAnimate + * @description + * + * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via + * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an AngularJS app. + * + * ## Usage + * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based + * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For + * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within + * the HTML element that the animation will be triggered on. + * + * ## Directive Support + * The following directives are "animation aware": + * + * | Directive | Supported Animations | + * |-------------------------------------------------------------------------------|---------------------------------------------------------------------------| + * | {@link ng.directive:form#animations form / ngForm} | add and remove ({@link ng.directive:form#css-classes various classes}) | + * | {@link ngAnimate.directive:ngAnimateSwap#animations ngAnimateSwap} | enter and leave | + * | {@link ng.directive:ngClass#animations ngClass / {{class}​}} | add and remove | + * | {@link ng.directive:ngClassEven#animations ngClassEven} | add and remove | + * | {@link ng.directive:ngClassOdd#animations ngClassOdd} | add and remove | + * | {@link ng.directive:ngHide#animations ngHide} | add and remove (the `ng-hide` class) | + * | {@link ng.directive:ngIf#animations ngIf} | enter and leave | + * | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave | + * | {@link module:ngMessages#animations ngMessage / ngMessageExp} | enter and leave | + * | {@link module:ngMessages#animations ngMessages} | add and remove (the `ng-active`/`ng-inactive` classes) | + * | {@link ng.directive:ngModel#animations ngModel} | add and remove ({@link ng.directive:ngModel#css-classes various classes}) | + * | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave, and move | + * | {@link ng.directive:ngShow#animations ngShow} | add and remove (the `ng-hide` class) | + * | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave | + * | {@link ngRoute.directive:ngView#animations ngView} | enter and leave | + * + * (More information can be found by visiting the documentation associated with each directive.) + * + * For a full breakdown of the steps involved during each animation event, refer to the + * {@link ng.$animate `$animate` API docs}. + * + * ## CSS-based Animations + * + * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML + * and CSS code we can create an animation that will be picked up by AngularJS when an underlying directive performs an operation. + * + * The example below shows how an `enter` animation can be made possible on an element using `ng-if`: + * + * ```html + *
    + * Fade me in out + *
    + * + * + * ``` + * + * Notice the CSS class **fade**? We can now create the CSS transition code that references this class: + * + * ```css + * /* The starting CSS styles for the enter animation */ + * .fade.ng-enter { + * transition:0.5s linear all; + * opacity:0; + * } + * + * /* The finishing CSS styles for the enter animation */ + * .fade.ng-enter.ng-enter-active { + * opacity:1; + * } + * ``` + * + * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two + * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition + * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards. + * + * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions: + * + * ```css + * /* now the element will fade out before it is removed from the DOM */ + * .fade.ng-leave { + * transition:0.5s linear all; + * opacity:1; + * } + * .fade.ng-leave.ng-leave-active { + * opacity:0; + * } + * ``` + * + * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class: + * + * ```css + * /* there is no need to define anything inside of the destination + * CSS class since the keyframe will take charge of the animation */ + * .fade.ng-leave { + * animation: my_fade_animation 0.5s linear; + * -webkit-animation: my_fade_animation 0.5s linear; + * } + * + * @keyframes my_fade_animation { + * from { opacity:1; } + * to { opacity:0; } + * } + * + * @-webkit-keyframes my_fade_animation { + * from { opacity:1; } + * to { opacity:0; } + * } + * ``` + * + * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element. + * + * ### CSS Class-based Animations + * + * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different + * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added + * and removed. + * + * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class: + * + * ```html + *
    + * Show and hide me + *
    + * + * + * + * ``` + * + * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since + * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest. + * + * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation + * with CSS styles. + * + * ```html + *
    + * Highlight this box + *
    + * + * + * + * ``` + * + * We can also make use of CSS keyframes by placing them within the CSS classes. + * + * + * ### CSS Staggering Animations + * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a + * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be + * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for + * the animation. The style property expected within the stagger class can either be a **transition-delay** or an + * **animation-delay** property (or both if your animation contains both transitions and keyframe animations). + * + * ```css + * .my-animation.ng-enter { + * /* standard transition code */ + * transition: 1s linear all; + * opacity:0; + * } + * .my-animation.ng-enter-stagger { + * /* this will have a 100ms delay between each successive leave animation */ + * transition-delay: 0.1s; + * + * /* As of 1.4.4, this must always be set: it signals ngAnimate + * to not accidentally inherit a delay property from another CSS class */ + * transition-duration: 0s; + * + * /* if you are using animations instead of transitions you should configure as follows: + * animation-delay: 0.1s; + * animation-duration: 0s; */ + * } + * .my-animation.ng-enter.ng-enter-active { + * /* standard transition styles */ + * opacity:1; + * } + * ``` + * + * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations + * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this + * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation + * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired. + * + * The following code will issue the **ng-leave-stagger** event on the element provided: + * + * ```js + * var kids = parent.children(); + * + * $animate.leave(kids[0]); //stagger index=0 + * $animate.leave(kids[1]); //stagger index=1 + * $animate.leave(kids[2]); //stagger index=2 + * $animate.leave(kids[3]); //stagger index=3 + * $animate.leave(kids[4]); //stagger index=4 + * + * window.requestAnimationFrame(function() { + * //stagger has reset itself + * $animate.leave(kids[5]); //stagger index=0 + * $animate.leave(kids[6]); //stagger index=1 + * + * $scope.$digest(); + * }); + * ``` + * + * Stagger animations are currently only supported within CSS-defined animations. + * + * ### The `ng-animate` CSS class + * + * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation. + * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations). + * + * Therefore, animations can be applied to an element using this temporary class directly via CSS. + * + * ```css + * .zipper.ng-animate { + * transition:0.5s linear all; + * } + * .zipper.ng-enter { + * opacity:0; + * } + * .zipper.ng-enter.ng-enter-active { + * opacity:1; + * } + * .zipper.ng-leave { + * opacity:1; + * } + * .zipper.ng-leave.ng-leave-active { + * opacity:0; + * } + * ``` + * + * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove + * the CSS class once an animation has completed.) + * + * + * ### The `ng-[event]-prepare` class + * + * This is a special class that can be used to prevent unwanted flickering / flash of content before + * the actual animation starts. The class is added as soon as an animation is initialized, but removed + * before the actual animation starts (after waiting for a $digest). + * It is also only added for *structural* animations (`enter`, `move`, and `leave`). + * + * In practice, flickering can appear when nesting elements with structural animations such as `ngIf` + * into elements that have class-based animations such as `ngClass`. + * + * ```html + *
    + *
    + *
    + *
    + *
    + * ``` + * + * It is possible that during the `enter` animation, the `.message` div will be briefly visible before it starts animating. + * In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts: + * + * ```css + * .message.ng-enter-prepare { + * opacity: 0; + * } + * ``` + * + * ### Animating between value changes + * + * Sometimes you need to animate between different expression states, whose values + * don't necessary need to be known or referenced in CSS styles. + * Unless possible with another {@link ngAnimate#directive-support "animation aware" directive}, + * that specific use case can always be covered with {@link ngAnimate.directive:ngAnimateSwap} as + * can be seen in {@link ngAnimate.directive:ngAnimateSwap#examples this example}. + * + * Note that {@link ngAnimate.directive:ngAnimateSwap} is a *structural directive*, which means it + * creates a new instance of the element (including any other/child directives it may have) and + * links it to a new scope every time *swap* happens. In some cases this might not be desirable + * (e.g. for performance reasons, or when you wish to retain internal state on the original + * element instance). + * + * ## JavaScript-based Animations + * + * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared + * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the + * `module.animation()` module function we can register the animation. + * + * Let's see an example of a enter/leave animation using `ngRepeat`: + * + * ```html + *
    + * {{ item }} + *
    + * ``` + * + * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`: + * + * ```js + * myModule.animation('.slide', [function() { + * return { + * // make note that other events (like addClass/removeClass) + * // have different function input parameters + * enter: function(element, doneFn) { + * jQuery(element).fadeIn(1000, doneFn); + * + * // remember to call doneFn so that AngularJS + * // knows that the animation has concluded + * }, + * + * move: function(element, doneFn) { + * jQuery(element).fadeIn(1000, doneFn); + * }, + * + * leave: function(element, doneFn) { + * jQuery(element).fadeOut(1000, doneFn); + * } + * } + * }]); + * ``` + * + * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as + * greensock.js and velocity.js. + * + * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define + * our animations inside of the same registered animation, however, the function input arguments are a bit different: + * + * ```html + *
    + * this box is moody + *
    + * + * + * + * ``` + * + * ```js + * myModule.animation('.colorful', [function() { + * return { + * addClass: function(element, className, doneFn) { + * // do some cool animation and call the doneFn + * }, + * removeClass: function(element, className, doneFn) { + * // do some cool animation and call the doneFn + * }, + * setClass: function(element, addedClass, removedClass, doneFn) { + * // do some cool animation and call the doneFn + * } + * } + * }]); + * ``` + * + * ## CSS + JS Animations Together + * + * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of AngularJS, + * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking + * charge of the animation**: + * + * ```html + *
    + * Slide in and out + *
    + * ``` + * + * ```js + * myModule.animation('.slide', [function() { + * return { + * enter: function(element, doneFn) { + * jQuery(element).slideIn(1000, doneFn); + * } + * } + * }]); + * ``` + * + * ```css + * .slide.ng-enter { + * transition:0.5s linear all; + * transform:translateY(-100px); + * } + * .slide.ng-enter.ng-enter-active { + * transform:translateY(0); + * } + * ``` + * + * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the + * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from + * our own JS-based animation code: + * + * ```js + * myModule.animation('.slide', ['$animateCss', function($animateCss) { + * return { + * enter: function(element) { +* // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`. + * return $animateCss(element, { + * event: 'enter', + * structural: true + * }); + * } + * } + * }]); + * ``` + * + * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework. + * + * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or + * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that + * data into `$animateCss` directly: + * + * ```js + * myModule.animation('.slide', ['$animateCss', function($animateCss) { + * return { + * enter: function(element) { + * return $animateCss(element, { + * event: 'enter', + * structural: true, + * addClass: 'maroon-setting', + * from: { height:0 }, + * to: { height: 200 } + * }); + * } + * } + * }]); + * ``` + * + * Now we can fill in the rest via our transition CSS code: + * + * ```css + * /* the transition tells ngAnimate to make the animation happen */ + * .slide.ng-enter { transition:0.5s linear all; } + * + * /* this extra CSS class will be absorbed into the transition + * since the $animateCss code is adding the class */ + * .maroon-setting { background:red; } + * ``` + * + * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over. + * + * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}. + * + * ## Animation Anchoring (via `ng-animate-ref`) + * + * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between + * structural areas of an application (like views) by pairing up elements using an attribute + * called `ng-animate-ref`. + * + * Let's say for example we have two views that are managed by `ng-view` and we want to show + * that there is a relationship between two components situated in within these views. By using the + * `ng-animate-ref` attribute we can identify that the two components are paired together and we + * can then attach an animation, which is triggered when the view changes. + * + * Say for example we have the following template code: + * + * ```html + * + *
    + *
    + * + * + *
    + * + * + * + * + * + * ``` + * + * Now, when the view changes (once the link is clicked), ngAnimate will examine the + * HTML contents to see if there is a match reference between any components in the view + * that is leaving and the view that is entering. It will scan both the view which is being + * removed (leave) and inserted (enter) to see if there are any paired DOM elements that + * contain a matching ref value. + * + * The two images match since they share the same ref value. ngAnimate will now create a + * transport element (which is a clone of the first image element) and it will then attempt + * to animate to the position of the second image element in the next view. For the animation to + * work a special CSS class called `ng-anchor` will be added to the transported element. + * + * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then + * ngAnimate will handle the entire transition for us as well as the addition and removal of + * any changes of CSS classes between the elements: + * + * ```css + * .banner.ng-anchor { + * /* this animation will last for 1 second since there are + * two phases to the animation (an `in` and an `out` phase) */ + * transition:0.5s linear all; + * } + * ``` + * + * We also **must** include animations for the views that are being entered and removed + * (otherwise anchoring wouldn't be possible since the new view would be inserted right away). + * + * ```css + * .view-animation.ng-enter, .view-animation.ng-leave { + * transition:0.5s linear all; + * position:fixed; + * left:0; + * top:0; + * width:100%; + * } + * .view-animation.ng-enter { + * transform:translateX(100%); + * } + * .view-animation.ng-leave, + * .view-animation.ng-enter.ng-enter-active { + * transform:translateX(0%); + * } + * .view-animation.ng-leave.ng-leave-active { + * transform:translateX(-100%); + * } + * ``` + * + * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur: + * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away + * from its origin. Once that animation is over then the `in` stage occurs which animates the + * element to its destination. The reason why there are two animations is to give enough time + * for the enter animation on the new element to be ready. + * + * The example above sets up a transition for both the in and out phases, but we can also target the out or + * in phases directly via `ng-anchor-out` and `ng-anchor-in`. + * + * ```css + * .banner.ng-anchor-out { + * transition: 0.5s linear all; + * + * /* the scale will be applied during the out animation, + * but will be animated away when the in animation runs */ + * transform: scale(1.2); + * } + * + * .banner.ng-anchor-in { + * transition: 1s linear all; + * } + * ``` + * + * + * + * + * ### Anchoring Demo + * + + + Home +
    +
    +
    +
    +
    + + angular.module('anchoringExample', ['ngAnimate', 'ngRoute']) + .config(['$routeProvider', function($routeProvider) { + $routeProvider.when('/', { + templateUrl: 'home.html', + controller: 'HomeController as home' + }); + $routeProvider.when('/profile/:id', { + templateUrl: 'profile.html', + controller: 'ProfileController as profile' + }); + }]) + .run(['$rootScope', function($rootScope) { + $rootScope.records = [ + { id: 1, title: 'Miss Beulah Roob' }, + { id: 2, title: 'Trent Morissette' }, + { id: 3, title: 'Miss Ava Pouros' }, + { id: 4, title: 'Rod Pouros' }, + { id: 5, title: 'Abdul Rice' }, + { id: 6, title: 'Laurie Rutherford Sr.' }, + { id: 7, title: 'Nakia McLaughlin' }, + { id: 8, title: 'Jordon Blanda DVM' }, + { id: 9, title: 'Rhoda Hand' }, + { id: 10, title: 'Alexandrea Sauer' } + ]; + }]) + .controller('HomeController', [function() { + //empty + }]) + .controller('ProfileController', ['$rootScope', '$routeParams', + function ProfileController($rootScope, $routeParams) { + var index = parseInt($routeParams.id, 10); + var record = $rootScope.records[index - 1]; + + this.title = record.title; + this.id = record.id; + }]); + + +

    Welcome to the home page

    +

    Please click on an element

    + + {{ record.title }} + +
    + +
    + {{ profile.title }} +
    +
    + + .record { + display:block; + font-size:20px; + } + .profile { + background:black; + color:white; + font-size:100px; + } + .view-container { + position:relative; + } + .view-container > .view.ng-animate { + position:absolute; + top:0; + left:0; + width:100%; + min-height:500px; + } + .view.ng-enter, .view.ng-leave, + .record.ng-anchor { + transition:0.5s linear all; + } + .view.ng-enter { + transform:translateX(100%); + } + .view.ng-enter.ng-enter-active, .view.ng-leave { + transform:translateX(0%); + } + .view.ng-leave.ng-leave-active { + transform:translateX(-100%); + } + .record.ng-anchor-out { + background:red; + } + +
    + * + * ### How is the element transported? + * + * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting + * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element + * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The + * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match + * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied + * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class + * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element + * will become visible since the shim class will be removed. + * + * ### How is the morphing handled? + * + * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out + * what CSS classes differ between the starting element and the destination element. These different CSS classes + * will be added/removed on the anchor element and a transition will be applied (the transition that is provided + * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will + * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that + * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since + * the cloned element is placed inside of root element which is likely close to the body element). + * + * Note that if the root element is on the `` element then the cloned node will be placed inside of body. + * + * + * ## Using $animate in your directive code + * + * So far we've explored how to feed in animations into an AngularJS application, but how do we trigger animations within our own directives in our application? + * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's + * imagine we have a greeting box that shows and hides itself when the data changes + * + * ```html + * Hi there + * ``` + * + * ```js + * ngModule.directive('greetingBox', ['$animate', function($animate) { + * return function(scope, element, attrs) { + * attrs.$observe('active', function(value) { + * value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on'); + * }); + * }); + * }]); + * ``` + * + * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element + * in our HTML code then we can trigger a CSS or JS animation to happen. + * + * ```css + * /* normally we would create a CSS class to reference on the element */ + * greeting-box.on { transition:0.5s linear all; background:green; color:white; } + * ``` + * + * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's + * possible be sure to visit the {@link ng.$animate $animate service API page}. + * + * + * ## Callbacks and Promises + * + * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger + * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has + * ended by chaining onto the returned promise that animation method returns. + * + * ```js + * // somewhere within the depths of the directive + * $animate.enter(element, parent).then(function() { + * //the animation has completed + * }); + * ``` + * + * (Note that earlier versions of AngularJS prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case + * anymore.) + * + * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering + * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view + * routing controller to hook into that: + * + * ```js + * ngModule.controller('HomePageController', ['$animate', function($animate) { + * $animate.on('enter', ngViewElement, function(element) { + * // the animation for this route has completed + * }]); + * }]) + * ``` + * + * (Note that you will need to trigger a digest within the callback to get AngularJS to notice any scope-related changes.) + */ + +var copy; +var extend; +var forEach; +var isArray; +var isDefined; +var isElement; +var isFunction; +var isObject; +var isString; +var isUndefined; +var jqLite; +var noop; + +/** + * @ngdoc service + * @name $animate + * @kind object + * + * @description + * The ngAnimate `$animate` service documentation is the same for the core `$animate` service. + * + * Click here {@link ng.$animate to learn more about animations with `$animate`}. + */ +angular.module('ngAnimate', [], function initAngularHelpers() { + // Access helpers from AngularJS core. + // Do it inside a `config` block to ensure `window.angular` is available. + noop = angular.noop; + copy = angular.copy; + extend = angular.extend; + jqLite = angular.element; + forEach = angular.forEach; + isArray = angular.isArray; + isString = angular.isString; + isObject = angular.isObject; + isUndefined = angular.isUndefined; + isDefined = angular.isDefined; + isFunction = angular.isFunction; + isElement = angular.isElement; +}) + .info({ angularVersion: '1.8.2' }) + .directive('ngAnimateSwap', ngAnimateSwapDirective) + + .directive('ngAnimateChildren', $$AnimateChildrenDirective) + .factory('$$rAFScheduler', $$rAFSchedulerFactory) + + .provider('$$animateQueue', $$AnimateQueueProvider) + .provider('$$animateCache', $$AnimateCacheProvider) + .provider('$$animation', $$AnimationProvider) + + .provider('$animateCss', $AnimateCssProvider) + .provider('$$animateCssDriver', $$AnimateCssDriverProvider) + + .provider('$$animateJs', $$AnimateJsProvider) + .provider('$$animateJsDriver', $$AnimateJsDriverProvider); + + +})(window, window.angular); + + +/***/ }), + +/***/ "./node_modules/angular-animate/index.js": +/*!***********************************************!*\ + !*** ./node_modules/angular-animate/index.js ***! + \***********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +__webpack_require__(/*! ./angular-animate */ "./node_modules/angular-animate/angular-animate.js"); +module.exports = 'ngAnimate'; + + +/***/ }), + +/***/ "./node_modules/angular-aria/angular-aria.js": +/*!***************************************************!*\ + !*** ./node_modules/angular-aria/angular-aria.js ***! + \***************************************************/ +/***/ (() => { + +/** + * @license AngularJS v1.8.2 + * (c) 2010-2020 Google LLC. http://angularjs.org + * License: MIT + */ +(function(window, angular) {'use strict'; + +/** + * @ngdoc module + * @name ngAria + * @description + * + * The `ngAria` module provides support for common + * [ARIA](http://www.w3.org/TR/wai-aria/) + * attributes that convey state or semantic information about the application for users + * of assistive technologies, such as screen readers. + * + * ## Usage + * + * For ngAria to do its magic, simply include the module `ngAria` as a dependency. The following + * directives are supported: + * `ngModel`, `ngChecked`, `ngReadonly`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`, + * `ngClick`, `ngDblClick`, and `ngMessages`. + * + * Below is a more detailed breakdown of the attributes handled by ngAria: + * + * | Directive | Supported Attributes | + * |---------------------------------------------|-----------------------------------------------------------------------------------------------------| + * | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles | + * | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled | + * | {@link ng.directive:ngRequired ngRequired} | aria-required | + * | {@link ng.directive:ngChecked ngChecked} | aria-checked | + * | {@link ng.directive:ngReadonly ngReadonly} | aria-readonly | + * | {@link ng.directive:ngValue ngValue} | aria-checked | + * | {@link ng.directive:ngShow ngShow} | aria-hidden | + * | {@link ng.directive:ngHide ngHide} | aria-hidden | + * | {@link ng.directive:ngDblclick ngDblclick} | tabindex | + * | {@link module:ngMessages ngMessages} | aria-live | + * | {@link ng.directive:ngClick ngClick} | tabindex, keydown event, button role | + * + * Find out more information about each directive by reading the + * {@link guide/accessibility ngAria Developer Guide}. + * + * ## Example + * Using ngDisabled with ngAria: + * ```html + * + * ``` + * Becomes: + * ```html + * + * ``` + * + * ## Disabling Specific Attributes + * It is possible to disable individual attributes added by ngAria with the + * {@link ngAria.$ariaProvider#config config} method. For more details, see the + * {@link guide/accessibility Developer Guide}. + * + * ## Disabling `ngAria` on Specific Elements + * It is possible to make `ngAria` ignore a specific element, by adding the `ng-aria-disable` + * attribute on it. Note that only the element itself (and not its child elements) will be ignored. + */ +var ARIA_DISABLE_ATTR = 'ngAriaDisable'; + +var ngAriaModule = angular.module('ngAria', ['ng']). + info({ angularVersion: '1.8.2' }). + provider('$aria', $AriaProvider); + +/** +* Internal Utilities +*/ +var nativeAriaNodeNames = ['BUTTON', 'A', 'INPUT', 'TEXTAREA', 'SELECT', 'DETAILS', 'SUMMARY']; + +var isNodeOneOf = function(elem, nodeTypeArray) { + if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) { + return true; + } +}; +/** + * @ngdoc provider + * @name $ariaProvider + * @this + * + * @description + * + * Used for configuring the ARIA attributes injected and managed by ngAria. + * + * ```js + * angular.module('myApp', ['ngAria'], function config($ariaProvider) { + * $ariaProvider.config({ + * ariaValue: true, + * tabindex: false + * }); + * }); + *``` + * + * ## Dependencies + * Requires the {@link ngAria} module to be installed. + * + */ +function $AriaProvider() { + var config = { + ariaHidden: true, + ariaChecked: true, + ariaReadonly: true, + ariaDisabled: true, + ariaRequired: true, + ariaInvalid: true, + ariaValue: true, + tabindex: true, + bindKeydown: true, + bindRoleForClick: true + }; + + /** + * @ngdoc method + * @name $ariaProvider#config + * + * @param {object} config object to enable/disable specific ARIA attributes + * + * - **ariaHidden** – `{boolean}` – Enables/disables aria-hidden tags + * - **ariaChecked** – `{boolean}` – Enables/disables aria-checked tags + * - **ariaReadonly** – `{boolean}` – Enables/disables aria-readonly tags + * - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags + * - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags + * - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags + * - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and + * aria-valuenow tags + * - **tabindex** – `{boolean}` – Enables/disables tabindex tags + * - **bindKeydown** – `{boolean}` – Enables/disables keyboard event binding on non-interactive + * elements (such as `div` or `li`) using ng-click, making them more accessible to users of + * assistive technologies + * - **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements (such as + * `div` or `li`) using ng-click, making them more accessible to users of assistive + * technologies + * + * @description + * Enables/disables various ARIA attributes + */ + this.config = function(newConfig) { + config = angular.extend(config, newConfig); + }; + + function watchExpr(attrName, ariaAttr, nativeAriaNodeNames, negate) { + return function(scope, elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + var ariaCamelName = attr.$normalize(ariaAttr); + if (config[ariaCamelName] && !isNodeOneOf(elem, nativeAriaNodeNames) && !attr[ariaCamelName]) { + scope.$watch(attr[attrName], function(boolVal) { + // ensure boolean value + boolVal = negate ? !boolVal : !!boolVal; + elem.attr(ariaAttr, boolVal); + }); + } + }; + } + /** + * @ngdoc service + * @name $aria + * + * @description + * + * The $aria service contains helper methods for applying common + * [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives. + * + * ngAria injects common accessibility attributes that tell assistive technologies when HTML + * elements are enabled, selected, hidden, and more. To see how this is performed with ngAria, + * let's review a code snippet from ngAria itself: + * + *```js + * ngAriaModule.directive('ngDisabled', ['$aria', function($aria) { + * return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nativeAriaNodeNames, false); + * }]) + *``` + * Shown above, the ngAria module creates a directive with the same signature as the + * traditional `ng-disabled` directive. But this ngAria version is dedicated to + * solely managing accessibility attributes on custom elements. The internal `$aria` service is + * used to watch the boolean attribute `ngDisabled`. If it has not been explicitly set by the + * developer, `aria-disabled` is injected as an attribute with its value synchronized to the + * value in `ngDisabled`. + * + * Because ngAria hooks into the `ng-disabled` directive, developers do not have to do + * anything to enable this feature. The `aria-disabled` attribute is automatically managed + * simply as a silent side-effect of using `ng-disabled` with the ngAria module. + * + * The full list of directives that interface with ngAria: + * * **ngModel** + * * **ngChecked** + * * **ngReadonly** + * * **ngRequired** + * * **ngDisabled** + * * **ngValue** + * * **ngShow** + * * **ngHide** + * * **ngClick** + * * **ngDblclick** + * * **ngMessages** + * + * Read the {@link guide/accessibility ngAria Developer Guide} for a thorough explanation of each + * directive. + * + * + * ## Dependencies + * Requires the {@link ngAria} module to be installed. + */ + this.$get = function() { + return { + config: function(key) { + return config[key]; + }, + $$watchExpr: watchExpr + }; + }; +} + + +ngAriaModule.directive('ngShow', ['$aria', function($aria) { + return $aria.$$watchExpr('ngShow', 'aria-hidden', [], true); +}]) +.directive('ngHide', ['$aria', function($aria) { + return $aria.$$watchExpr('ngHide', 'aria-hidden', [], false); +}]) +.directive('ngValue', ['$aria', function($aria) { + return $aria.$$watchExpr('ngValue', 'aria-checked', nativeAriaNodeNames, false); +}]) +.directive('ngChecked', ['$aria', function($aria) { + return $aria.$$watchExpr('ngChecked', 'aria-checked', nativeAriaNodeNames, false); +}]) +.directive('ngReadonly', ['$aria', function($aria) { + return $aria.$$watchExpr('ngReadonly', 'aria-readonly', nativeAriaNodeNames, false); +}]) +.directive('ngRequired', ['$aria', function($aria) { + return $aria.$$watchExpr('ngRequired', 'aria-required', nativeAriaNodeNames, false); +}]) +.directive('ngModel', ['$aria', function($aria) { + + function shouldAttachAttr(attr, normalizedAttr, elem, allowNonAriaNodes) { + return $aria.config(normalizedAttr) && + !elem.attr(attr) && + (allowNonAriaNodes || !isNodeOneOf(elem, nativeAriaNodeNames)) && + (elem.attr('type') !== 'hidden' || elem[0].nodeName !== 'INPUT'); + } + + function shouldAttachRole(role, elem) { + // if element does not have role attribute + // AND element type is equal to role (if custom element has a type equaling shape) <-- remove? + // AND element is not in nativeAriaNodeNames + return !elem.attr('role') && (elem.attr('type') === role) && !isNodeOneOf(elem, nativeAriaNodeNames); + } + + function getShape(attr, elem) { + var type = attr.type, + role = attr.role; + + return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' : + ((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' : + (type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' : ''; + } + + return { + restrict: 'A', + require: 'ngModel', + priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value + compile: function(elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + var shape = getShape(attr, elem); + + return { + post: function(scope, elem, attr, ngModel) { + var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem, false); + + function ngAriaWatchModelValue() { + return ngModel.$modelValue; + } + + function getRadioReaction(newVal) { + // Strict comparison would cause a BC + // eslint-disable-next-line eqeqeq + var boolVal = (attr.value == ngModel.$viewValue); + elem.attr('aria-checked', boolVal); + } + + function getCheckboxReaction() { + elem.attr('aria-checked', !ngModel.$isEmpty(ngModel.$viewValue)); + } + + switch (shape) { + case 'radio': + case 'checkbox': + if (shouldAttachRole(shape, elem)) { + elem.attr('role', shape); + } + if (shouldAttachAttr('aria-checked', 'ariaChecked', elem, false)) { + scope.$watch(ngAriaWatchModelValue, shape === 'radio' ? + getRadioReaction : getCheckboxReaction); + } + if (needsTabIndex) { + elem.attr('tabindex', 0); + } + break; + case 'range': + if (shouldAttachRole(shape, elem)) { + elem.attr('role', 'slider'); + } + if ($aria.config('ariaValue')) { + var needsAriaValuemin = !elem.attr('aria-valuemin') && + (attr.hasOwnProperty('min') || attr.hasOwnProperty('ngMin')); + var needsAriaValuemax = !elem.attr('aria-valuemax') && + (attr.hasOwnProperty('max') || attr.hasOwnProperty('ngMax')); + var needsAriaValuenow = !elem.attr('aria-valuenow'); + + if (needsAriaValuemin) { + attr.$observe('min', function ngAriaValueMinReaction(newVal) { + elem.attr('aria-valuemin', newVal); + }); + } + if (needsAriaValuemax) { + attr.$observe('max', function ngAriaValueMinReaction(newVal) { + elem.attr('aria-valuemax', newVal); + }); + } + if (needsAriaValuenow) { + scope.$watch(ngAriaWatchModelValue, function ngAriaValueNowReaction(newVal) { + elem.attr('aria-valuenow', newVal); + }); + } + } + if (needsTabIndex) { + elem.attr('tabindex', 0); + } + break; + } + + if (!attr.hasOwnProperty('ngRequired') && ngModel.$validators.required + && shouldAttachAttr('aria-required', 'ariaRequired', elem, false)) { + // ngModel.$error.required is undefined on custom controls + attr.$observe('required', function() { + elem.attr('aria-required', !!attr['required']); + }); + } + + if (shouldAttachAttr('aria-invalid', 'ariaInvalid', elem, true)) { + scope.$watch(function ngAriaInvalidWatch() { + return ngModel.$invalid; + }, function ngAriaInvalidReaction(newVal) { + elem.attr('aria-invalid', !!newVal); + }); + } + } + }; + } + }; +}]) +.directive('ngDisabled', ['$aria', function($aria) { + return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nativeAriaNodeNames, false); +}]) +.directive('ngMessages', function() { + return { + restrict: 'A', + require: '?ngMessages', + link: function(scope, elem, attr, ngMessages) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + if (!elem.attr('aria-live')) { + elem.attr('aria-live', 'assertive'); + } + } + }; +}) +.directive('ngClick',['$aria', '$parse', function($aria, $parse) { + return { + restrict: 'A', + compile: function(elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + var fn = $parse(attr.ngClick); + return function(scope, elem, attr) { + + if (!isNodeOneOf(elem, nativeAriaNodeNames)) { + + if ($aria.config('bindRoleForClick') && !elem.attr('role')) { + elem.attr('role', 'button'); + } + + if ($aria.config('tabindex') && !elem.attr('tabindex')) { + elem.attr('tabindex', 0); + } + + if ($aria.config('bindKeydown') && !attr.ngKeydown && !attr.ngKeypress && !attr.ngKeyup) { + elem.on('keydown', function(event) { + var keyCode = event.which || event.keyCode; + + if (keyCode === 13 || keyCode === 32) { + // If the event is triggered on a non-interactive element ... + if (nativeAriaNodeNames.indexOf(event.target.nodeName) === -1 && !event.target.isContentEditable) { + // ... prevent the default browser behavior (e.g. scrolling when pressing spacebar) + // See https://github.com/angular/angular.js/issues/16664 + event.preventDefault(); + } + scope.$apply(callback); + } + + function callback() { + fn(scope, { $event: event }); + } + }); + } + } + }; + } + }; +}]) +.directive('ngDblclick', ['$aria', function($aria) { + return function(scope, elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + if ($aria.config('tabindex') && !elem.attr('tabindex') && !isNodeOneOf(elem, nativeAriaNodeNames)) { + elem.attr('tabindex', 0); + } + }; +}]); + + +})(window, window.angular); + + +/***/ }), + +/***/ "./node_modules/angular-aria/index.js": +/*!********************************************!*\ + !*** ./node_modules/angular-aria/index.js ***! + \********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +__webpack_require__(/*! ./angular-aria */ "./node_modules/angular-aria/angular-aria.js"); +module.exports = 'ngAria'; + + +/***/ }), + +/***/ "./node_modules/angular-local-storage/dist/angular-local-storage.js": +/*!**************************************************************************!*\ + !*** ./node_modules/angular-local-storage/dist/angular-local-storage.js ***! + \**************************************************************************/ +/***/ (() => { + +/** + * An Angular module that gives you access to the browsers local storage + * @version v0.7.1 - 2017-06-21 + * @link https://github.com/grevory/angular-local-storage + * @author grevory + * @license MIT License, http://www.opensource.org/licenses/MIT + */ +(function (window, angular) { +var isDefined = angular.isDefined, + isUndefined = angular.isUndefined, + isNumber = angular.isNumber, + isObject = angular.isObject, + isArray = angular.isArray, + isString = angular.isString, + extend = angular.extend, + toJson = angular.toJson; + +angular + .module('LocalStorageModule', []) + .provider('localStorageService', function() { + // You should set a prefix to avoid overwriting any local storage variables from the rest of your app + // e.g. localStorageServiceProvider.setPrefix('yourAppName'); + // With provider you can use config as this: + // myApp.config(function (localStorageServiceProvider) { + // localStorageServiceProvider.prefix = 'yourAppName'; + // }); + this.prefix = 'ls'; + + // You could change web storage type localstorage or sessionStorage + this.storageType = 'localStorage'; + + // Cookie options (usually in case of fallback) + // expiry = Number of days before cookies expire // 0 = Does not expire + // path = The web path the cookie represents + // secure = Wether the cookies should be secure (i.e only sent on HTTPS requests) + this.cookie = { + expiry: 30, + path: '/', + secure: false + }; + + // Decides wether we should default to cookies if localstorage is not supported. + this.defaultToCookie = true; + + // Send signals for each of the following actions? + this.notify = { + setItem: true, + removeItem: false + }; + + // Setter for the prefix + this.setPrefix = function(prefix) { + this.prefix = prefix; + return this; + }; + + // Setter for the storageType + this.setStorageType = function(storageType) { + this.storageType = storageType; + return this; + }; + // Setter for defaultToCookie value, default is true. + this.setDefaultToCookie = function (shouldDefault) { + this.defaultToCookie = !!shouldDefault; // Double-not to make sure it's a bool value. + return this; + }; + // Setter for cookie config + this.setStorageCookie = function(exp, path, secure) { + this.cookie.expiry = exp; + this.cookie.path = path; + this.cookie.secure = secure; + return this; + }; + + // Setter for cookie domain + this.setStorageCookieDomain = function(domain) { + this.cookie.domain = domain; + return this; + }; + + // Setter for notification config + // itemSet & itemRemove should be booleans + this.setNotify = function(itemSet, itemRemove) { + this.notify = { + setItem: itemSet, + removeItem: itemRemove + }; + return this; + }; + + this.$get = ['$rootScope', '$window', '$document', '$parse','$timeout', function($rootScope, $window, $document, $parse, $timeout) { + var self = this; + var prefix = self.prefix; + var cookie = self.cookie; + var notify = self.notify; + var storageType = self.storageType; + var webStorage; + + // When Angular's $document is not available + if (!$document) { + $document = document; + } else if ($document[0]) { + $document = $document[0]; + } + + // If there is a prefix set in the config lets use that with an appended period for readability + if (prefix.substr(-1) !== '.') { + prefix = !!prefix ? prefix + '.' : ''; + } + var deriveQualifiedKey = function(key) { + return prefix + key; + }; + + // Removes prefix from the key. + var underiveQualifiedKey = function (key) { + return key.replace(new RegExp('^' + prefix, 'g'), ''); + }; + + // Check if the key is within our prefix namespace. + var isKeyPrefixOurs = function (key) { + return key.indexOf(prefix) === 0; + }; + + // Checks the browser to see if local storage is supported + var checkSupport = function () { + try { + var supported = (storageType in $window && $window[storageType] !== null); + + // When Safari (OS X or iOS) is in private browsing mode, it appears as though localStorage + // is available, but trying to call .setItem throws an exception. + // + // "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage + // that exceeded the quota." + var key = deriveQualifiedKey('__' + Math.round(Math.random() * 1e7)); + if (supported) { + webStorage = $window[storageType]; + webStorage.setItem(key, ''); + webStorage.removeItem(key); + } + + return supported; + } catch (e) { + // Only change storageType to cookies if defaulting is enabled. + if (self.defaultToCookie) + storageType = 'cookie'; + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + }; + var browserSupportsLocalStorage = checkSupport(); + + // Directly adds a value to local storage + // If local storage is not available in the browser use cookies + // Example use: localStorageService.add('library','angular'); + var addToLocalStorage = function (key, value, type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + // Let's convert undefined values to null to get the value consistent + if (isUndefined(value)) { + value = null; + } else { + value = toJson(value); + } + + // If this browser does not support local storage use cookies + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + + if (notify.setItem) { + $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'cookie'}); + } + return addToCookies(key, value); + } + + try { + if (webStorage) { + webStorage.setItem(deriveQualifiedKey(key), value); + } + if (notify.setItem) { + $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: self.storageType}); + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return addToCookies(key, value); + } + return true; + } finally { + setStorageType(previousType); + } + }; + + // Directly get a value from local storage + // Example use: localStorageService.get('library'); // returns 'angular' + var getFromLocalStorage = function (key, type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + + return getFromCookies(key); + } + + var item = webStorage ? webStorage.getItem(deriveQualifiedKey(key)) : null; + // angular.toJson will convert null to 'null', so a proper conversion is needed + // FIXME not a perfect solution, since a valid 'null' string can't be stored + if (!item || item === 'null') { + return null; + } + + try { + return JSON.parse(item); + } catch (e) { + return item; + } + } finally { + setStorageType(previousType); + } + }; + + // Remove an item from local storage + // Example use: localStorageService.remove('library'); // removes the key/value pair of library='angular' + // + // This is var-arg removal, check the last argument to see if it is a storageType + // and set type accordingly before removing. + // + var removeFromLocalStorage = function () { + var previousType = getStorageType(); + + try { + // can't pop on arguments, so we do this + var consumed = 0; + if (arguments.length >= 1 && + (arguments[arguments.length - 1] === 'localStorage' || + arguments[arguments.length - 1] === 'sessionStorage')) { + consumed = 1; + setStorageType(arguments[arguments.length - 1]); + } + + var i, key; + for (i = 0; i < arguments.length - consumed; i++) { + key = arguments[i]; + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + + if (notify.removeItem) { + $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: 'cookie'}); + } + removeFromCookies(key); + } + else { + try { + webStorage.removeItem(deriveQualifiedKey(key)); + if (notify.removeItem) { + $rootScope.$broadcast('LocalStorageModule.notification.removeitem', { + key: key, + storageType: self.storageType + }); + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + removeFromCookies(key); + } + } + } + } finally { + setStorageType(previousType); + } + }; + + // Return array of keys for local storage + // Example use: var keys = localStorageService.keys() + var getKeysForLocalStorage = function (type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + return []; + } + + var prefixLength = prefix.length; + var keys = []; + for (var key in webStorage) { + // Only return keys that are for this app + if (key.substr(0, prefixLength) === prefix) { + try { + keys.push(key.substr(prefixLength)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.Description); + return []; + } + } + } + + return keys; + } finally { + setStorageType(previousType); + } + }; + + // Remove all data for this app from local storage + // Also optionally takes a regular expression string and removes the matching key-value pairs + // Example use: localStorageService.clearAll(); + // Should be used mostly for development purposes + var clearAllFromLocalStorage = function (regularExpression, type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + // Setting both regular expressions independently + // Empty strings result in catchall RegExp + var prefixRegex = !!prefix ? new RegExp('^' + prefix) : new RegExp(); + var testRegex = !!regularExpression ? new RegExp(regularExpression) : new RegExp(); + + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + return clearAllFromCookies(); + } + if (!browserSupportsLocalStorage && !self.defaultToCookie) + return false; + var prefixLength = prefix.length; + + for (var key in webStorage) { + // Only remove items that are for this app and match the regular expression + if (prefixRegex.test(key) && testRegex.test(key.substr(prefixLength))) { + try { + removeFromLocalStorage(key.substr(prefixLength)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return clearAllFromCookies(); + } + } + } + + return true; + } finally { + setStorageType(previousType); + } + }; + + // Checks the browser to see if cookies are supported + var browserSupportsCookies = (function() { + try { + return $window.navigator.cookieEnabled || + ("cookie" in $document && ($document.cookie.length > 0 || + ($document.cookie = "test").indexOf.call($document.cookie, "test") > -1)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + }()); + + // Directly adds a value to cookies + // Typically used as a fallback if local storage is not available in the browser + // Example use: localStorageService.cookie.add('library','angular'); + var addToCookies = function (key, value, daysToExpiry, secure) { + + if (isUndefined(value)) { + return false; + } else if(isArray(value) || isObject(value)) { + value = toJson(value); + } + + if (!browserSupportsCookies) { + $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED'); + return false; + } + + try { + var expiry = '', + expiryDate = new Date(), + cookieDomain = ''; + + if (value === null) { + // Mark that the cookie has expired one day ago + expiryDate.setTime(expiryDate.getTime() + (-1 * 24 * 60 * 60 * 1000)); + expiry = "; expires=" + expiryDate.toGMTString(); + value = ''; + } else if (isNumber(daysToExpiry) && daysToExpiry !== 0) { + expiryDate.setTime(expiryDate.getTime() + (daysToExpiry * 24 * 60 * 60 * 1000)); + expiry = "; expires=" + expiryDate.toGMTString(); + } else if (cookie.expiry !== 0) { + expiryDate.setTime(expiryDate.getTime() + (cookie.expiry * 24 * 60 * 60 * 1000)); + expiry = "; expires=" + expiryDate.toGMTString(); + } + if (!!key) { + var cookiePath = "; path=" + cookie.path; + if (cookie.domain) { + cookieDomain = "; domain=" + cookie.domain; + } + /* Providing the secure parameter always takes precedence over config + * (allows developer to mix and match secure + non-secure) */ + if (typeof secure === 'boolean') { + if (secure === true) { + /* We've explicitly specified secure, + * add the secure attribute to the cookie (after domain) */ + cookieDomain += "; secure"; + } + // else - secure has been supplied but isn't true - so don't set secure flag, regardless of what config says + } + else if (cookie.secure === true) { + // secure parameter wasn't specified, get default from config + cookieDomain += "; secure"; + } + $document.cookie = deriveQualifiedKey(key) + "=" + encodeURIComponent(value) + expiry + cookiePath + cookieDomain; + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + return true; + }; + + // Directly get a value from a cookie + // Example use: localStorageService.cookie.get('library'); // returns 'angular' + var getFromCookies = function (key) { + if (!browserSupportsCookies) { + $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED'); + return false; + } + + var cookies = $document.cookie && $document.cookie.split(';') || []; + for(var i=0; i < cookies.length; i++) { + var thisCookie = cookies[i]; + while (thisCookie.charAt(0) === ' ') { + thisCookie = thisCookie.substring(1,thisCookie.length); + } + if (thisCookie.indexOf(deriveQualifiedKey(key) + '=') === 0) { + var storedValues = decodeURIComponent(thisCookie.substring(prefix.length + key.length + 1, thisCookie.length)); + try { + var parsedValue = JSON.parse(storedValues); + return typeof(parsedValue) === 'number' ? storedValues : parsedValue; + } catch(e) { + return storedValues; + } + } + } + return null; + }; + + var removeFromCookies = function (key) { + addToCookies(key,null); + }; + + var clearAllFromCookies = function () { + var thisCookie = null; + var prefixLength = prefix.length; + var cookies = $document.cookie.split(';'); + for(var i = 0; i < cookies.length; i++) { + thisCookie = cookies[i]; + + while (thisCookie.charAt(0) === ' ') { + thisCookie = thisCookie.substring(1, thisCookie.length); + } + + var key = thisCookie.substring(prefixLength, thisCookie.indexOf('=')); + removeFromCookies(key); + } + }; + + var getStorageType = function() { + return storageType; + }; + + var setStorageType = function(type) { + if (type && storageType !== type) { + storageType = type; + browserSupportsLocalStorage = checkSupport(); + } + return browserSupportsLocalStorage; + }; + + // Add a listener on scope variable to save its changes to local storage + // Return a function which when called cancels binding + var bindToScope = function(scope, key, def, lsKey, type) { + lsKey = lsKey || key; + var value = getFromLocalStorage(lsKey, type); + + if (value === null && isDefined(def)) { + value = def; + } else if (isObject(value) && isObject(def)) { + value = extend(value, def); + } + + $parse(key).assign(scope, value); + + return scope.$watch(key, function(newVal) { + addToLocalStorage(lsKey, newVal, type); + }, isObject(scope[key])); + }; + + // Add listener to local storage, for update callbacks. + if (browserSupportsLocalStorage) { + if ($window.addEventListener) { + $window.addEventListener("storage", handleStorageChangeCallback, false); + $rootScope.$on('$destroy', function() { + $window.removeEventListener("storage", handleStorageChangeCallback); + }); + } else if($window.attachEvent){ + // attachEvent and detachEvent are proprietary to IE v6-10 + $window.attachEvent("onstorage", handleStorageChangeCallback); + $rootScope.$on('$destroy', function() { + $window.detachEvent("onstorage", handleStorageChangeCallback); + }); + } + } + + // Callback handler for storage changed. + function handleStorageChangeCallback(e) { + if (!e) { e = $window.event; } + if (notify.setItem) { + if (isString(e.key) && isKeyPrefixOurs(e.key)) { + var key = underiveQualifiedKey(e.key); + // Use timeout, to avoid using $rootScope.$apply. + $timeout(function () { + $rootScope.$broadcast('LocalStorageModule.notification.changed', { key: key, newvalue: e.newValue, storageType: self.storageType }); + }); + } + } + } + + // Return localStorageService.length + // ignore keys that not owned + var lengthOfLocalStorage = function(type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + var count = 0; + var storage = $window[storageType]; + for(var i = 0; i < storage.length; i++) { + if(storage.key(i).indexOf(prefix) === 0 ) { + count++; + } + } + + return count; + } finally { + setStorageType(previousType); + } + }; + + var changePrefix = function(localStoragePrefix) { + prefix = localStoragePrefix; + }; + + return { + isSupported: browserSupportsLocalStorage, + getStorageType: getStorageType, + setStorageType: setStorageType, + setPrefix: changePrefix, + set: addToLocalStorage, + add: addToLocalStorage, //DEPRECATED + get: getFromLocalStorage, + keys: getKeysForLocalStorage, + remove: removeFromLocalStorage, + clearAll: clearAllFromLocalStorage, + bind: bindToScope, + deriveKey: deriveQualifiedKey, + underiveKey: underiveQualifiedKey, + length: lengthOfLocalStorage, + defaultToCookie: this.defaultToCookie, + cookie: { + isSupported: browserSupportsCookies, + set: addToCookies, + add: addToCookies, //DEPRECATED + get: getFromCookies, + remove: removeFromCookies, + clearAll: clearAllFromCookies + } + }; + }]; + }); +})(window, window.angular); + +/***/ }), + +/***/ "./node_modules/angular-local-storage/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/angular-local-storage/index.js ***! + \*****************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +__webpack_require__(/*! ./dist/angular-local-storage.js */ "./node_modules/angular-local-storage/dist/angular-local-storage.js"); +module.exports = 'LocalStorageModule'; + + +/***/ }), + +/***/ "./node_modules/angular-material/angular-material.js": +/*!***********************************************************!*\ + !*** ./node_modules/angular-material/angular-material.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/* provided dependency */ var __webpack_provided_window_dot_jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); +/*! + * AngularJS Material Design + * https://github.com/angular/material + * @license MIT + * v1.2.3 + */ +(function( window, angular, undefined ){ +"use strict"; + +(function(){ +"use strict"; + +angular.module('ngMaterial', ["ng","ngAnimate","ngAria","material.core","material.core.animate","material.core.gestures","material.core.interaction","material.core.layout","material.core.meta","material.core.theming.palette","material.core.theming","material.components.autocomplete","material.components.backdrop","material.components.bottomSheet","material.components.button","material.components.card","material.components.checkbox","material.components.chips","material.components.colors","material.components.content","material.components.datepicker","material.components.dialog","material.components.divider","material.components.fabActions","material.components.fabShared","material.components.fabSpeedDial","material.components.fabToolbar","material.components.gridList","material.components.icon","material.components.input","material.components.list","material.components.menu","material.components.menuBar","material.components.navBar","material.components.panel","material.components.progressCircular","material.components.progressLinear","material.components.radioButton","material.components.select","material.components.showHide","material.components.sidenav","material.components.slider","material.components.sticky","material.components.subheader","material.components.swipe","material.components.switch","material.components.tabs","material.components.toast","material.components.toolbar","material.components.tooltip","material.components.truncate","material.components.virtualRepeat","material.components.whiteframe"]); +})(); +(function(){ +"use strict"; + +/** + * Initialization function that validates environment + * requirements. + */ +DetectNgTouch.$inject = ["$log", "$injector"]; +MdCoreConfigure.$inject = ["$provide", "$mdThemingProvider"]; +rAFDecorator.$inject = ["$delegate"]; +qDecorator.$inject = ["$delegate"]; +angular + .module('material.core', [ + 'ngAnimate', + 'material.core.animate', + 'material.core.layout', + 'material.core.interaction', + 'material.core.gestures', + 'material.core.theming' + ]) + .config(MdCoreConfigure) + .run(DetectNgTouch); + + +/** + * Detect if the ng-Touch module is also being used. + * Warn if detected. + * @ngInject + */ +function DetectNgTouch($log, $injector) { + if ($injector.has('$swipe')) { + var msg = "" + + "You are using the ngTouch module. \n" + + "AngularJS Material already has mobile click, tap, and swipe support... \n" + + "ngTouch is not supported with AngularJS Material!"; + $log.warn(msg); + } +} + +/** + * @ngInject + */ +function MdCoreConfigure($provide, $mdThemingProvider) { + + $provide.decorator('$$rAF', ['$delegate', rAFDecorator]); + $provide.decorator('$q', ['$delegate', qDecorator]); + + $mdThemingProvider.theme('default') + .primaryPalette('indigo') + .accentPalette('pink') + .warnPalette('deep-orange') + .backgroundPalette('grey'); +} + +/** + * @ngInject + */ +function rAFDecorator($delegate) { + /** + * Use this to throttle events that come in often. + * The throttled function will always use the *last* invocation before the + * coming frame. + * + * For example, window resize events that fire many times a second: + * If we set to use an raf-throttled callback on window resize, then + * our callback will only be fired once per frame, with the last resize + * event that happened before that frame. + * + * @param {function} cb function to debounce + */ + $delegate.throttle = function(cb) { + var queuedArgs, alreadyQueued, queueCb, context; + return function debounced() { + queuedArgs = arguments; + context = this; + queueCb = cb; + if (!alreadyQueued) { + alreadyQueued = true; + $delegate(function() { + queueCb.apply(context, Array.prototype.slice.call(queuedArgs)); + alreadyQueued = false; + }); + } + }; + }; + return $delegate; +} + +/** + * @ngInject + */ +function qDecorator($delegate) { + /** + * Adds a shim for $q.resolve for AngularJS version that don't have it, + * so we don't have to think about it. + * + * via https://github.com/angular/angular.js/pull/11987 + */ + + // TODO(crisbeto): this won't be necessary once we drop AngularJS 1.3 + if (!$delegate.resolve) { + $delegate.resolve = $delegate.when; + } + return $delegate; +} + +})(); +(function(){ +"use strict"; + + +MdAutofocusDirective.$inject = ["$parse"];angular.module('material.core') + .directive('mdAutofocus', MdAutofocusDirective); + +/** + * @ngdoc directive + * @name mdAutofocus + * @module material.core.util + * + * @description + * + * `[md-autofocus]` provides an optional way to identify the focused element when a `$mdDialog`, + * `$mdBottomSheet`, `$mdMenu` or `$mdSidenav` opens or upon page load for input-like elements. + * + * When one of these opens, it will find the first nested element with the `[md-autofocus]` + * attribute directive and optional expression. An expression may be specified as the directive + * value to enable conditional activation of the autofocus. + * + * @usage + * + * ### Dialog + * + * + *
    + * + * + * + * + *
    + *
    + *
    + * + * ### Bottomsheet + * + * + * Comment Actions + * + * + * + * + * + * {{ item.name }} + * + * + * + * + * + * + * + * ### Autocomplete + * + * + * {{item.display}} + * + * + * + * ### Sidenav + * + *
    + * + * Left Nav! + * + * + * + * Center Content + * + * Open Left Menu + * + * + * + * + *
    + * + * + * + * + *
    + *
    + *
    + *
    + **/ +function MdAutofocusDirective($parse) { + return { + restrict: 'A', + link: { + pre: preLink + } + }; + + function preLink(scope, element, attr) { + var attrExp = attr.mdAutoFocus || attr.mdAutofocus || attr.mdSidenavFocus; + + // Initially update the expression by manually parsing the expression as per $watch source. + updateExpression($parse(attrExp)(scope)); + + // Only watch the expression if it is not empty. + if (attrExp) { + scope.$watch(attrExp, updateExpression); + } + + /** + * Updates the autofocus class which is used to determine whether the attribute + * expression evaluates to true or false. + * @param {string|boolean} value Attribute Value + */ + function updateExpression(value) { + + // Rather than passing undefined to the jqLite toggle class function we explicitly set the + // value to true. Otherwise the class will be just toggled instead of being forced. + if (angular.isUndefined(value)) { + value = true; + } + + element.toggleClass('md-autofocus', !!value); + } + } + +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.colorUtil + * @description + * Color Util + */ +angular + .module('material.core') + .factory('$mdColorUtil', ColorUtilFactory); + +function ColorUtilFactory() { + /** + * Converts hex value to RGBA string + * @param color {string} + * @returns {string} + */ + function hexToRgba (color) { + var hex = color[ 0 ] === '#' ? color.substr(1) : color, + dig = hex.length / 3, + red = hex.substr(0, dig), + green = hex.substr(dig, dig), + blue = hex.substr(dig * 2); + if (dig === 1) { + red += red; + green += green; + blue += blue; + } + return 'rgba(' + parseInt(red, 16) + ',' + parseInt(green, 16) + ',' + parseInt(blue, 16) + ',0.1)'; + } + + /** + * Converts rgba value to hex string + * @param {string} color + * @returns {string} + */ + function rgbaToHex(color) { + color = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); + + var hex = (color && color.length === 4) ? "#" + + ("0" + parseInt(color[1],10).toString(16)).slice(-2) + + ("0" + parseInt(color[2],10).toString(16)).slice(-2) + + ("0" + parseInt(color[3],10).toString(16)).slice(-2) : ''; + + return hex.toUpperCase(); + } + + /** + * Converts an RGB color to RGBA + * @param {string} color + * @returns {string} + */ + function rgbToRgba (color) { + return color.replace(')', ', 0.1)').replace('(', 'a('); + } + + /** + * Converts an RGBA color to RGB + * @param {string} color + * @returns {string} + */ + function rgbaToRgb (color) { + return color + ? color.replace('rgba', 'rgb').replace(/,[^),]+\)/, ')') + : 'rgb(0,0,0)'; + } + + return { + rgbaToHex: rgbaToHex, + hexToRgba: hexToRgba, + rgbToRgba: rgbToRgba, + rgbaToRgb: rgbaToRgb + }; +} + +})(); +(function(){ +"use strict"; + +angular.module('material.core') +.factory('$mdConstant', MdConstantFactory); + +/** + * Factory function that creates the grab-bag $mdConstant service. + * @ngInject + */ +function MdConstantFactory() { + + var prefixTestEl = document.createElement('div'); + var vendorPrefix = getVendorPrefix(prefixTestEl); + var isWebkit = /webkit/i.test(vendorPrefix); + var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; + + /** + * @param {string} name CSS property name + * @return {string} the property name supported by the browser + */ + function vendorProperty(name) { + // Add a dash between the prefix and name, to be able to transform the string into camelcase. + var prefixedName = vendorPrefix + '-' + name; + var ucPrefix = camelCase(prefixedName); + var lcPrefix = ucPrefix.charAt(0).toLowerCase() + ucPrefix.substring(1); + + return hasStyleProperty(prefixTestEl, name) ? name : // The current browser supports the un-prefixed property + hasStyleProperty(prefixTestEl, ucPrefix) ? ucPrefix : // The current browser only supports the prefixed property. + hasStyleProperty(prefixTestEl, lcPrefix) ? lcPrefix : name; // Some browsers are only supporting the prefix in lowercase. + } + + function hasStyleProperty(testElement, property) { + return angular.isDefined(testElement.style[property]); + } + + /** + * @param {!string} input value to convert to camelCase + * @return {string} camelCased version of the input string + */ + function camelCase(input) { + return input.replace(SPECIAL_CHARS_REGEXP, function(matches, separator, letter, offset) { + return offset ? letter.toUpperCase() : letter; + }); + } + + function getVendorPrefix(testElement) { + var prop, match; + var vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/; + + for (prop in testElement.style) { + if (match = vendorRegex.exec(prop)) { + return match[0]; + } + } + } + + var self = { + isInputKey : function(e) { return (e.keyCode >= 31 && e.keyCode <= 90); }, + isNumPadKey : function(e) { return (3 === e.location && e.keyCode >= 97 && e.keyCode <= 105); }, + isMetaKey: function(e) { return (e.keyCode >= 91 && e.keyCode <= 93); }, + isFnLockKey: function(e) { return (e.keyCode >= 112 && e.keyCode <= 145); }, + isNavigationKey : function(e) { + var kc = self.KEY_CODE, NAVIGATION_KEYS = [kc.SPACE, kc.ENTER, kc.UP_ARROW, kc.DOWN_ARROW]; + return (NAVIGATION_KEYS.indexOf(e.keyCode) != -1); + }, + hasModifierKey: function(e) { + return e.ctrlKey || e.metaKey || e.altKey; + }, + + /** + * Maximum size, in pixels, that can be explicitly set to an element. The actual value varies + * between browsers, but IE11 has the very lowest size at a mere 1,533,917px. Ideally we could + * compute this value, but Firefox always reports an element to have a size of zero if it + * goes over the max, meaning that we'd have to binary search for the value. + */ + ELEMENT_MAX_PIXELS: 1533917, + + /** + * Priority for a directive that should run before the directives from ngAria. + */ + BEFORE_NG_ARIA: 210, + + /** + * Common Keyboard actions and their associated keycode. + */ + KEY_CODE: { + COMMA: 188, + SEMICOLON : 186, + ENTER: 13, + ESCAPE: 27, + SPACE: 32, + PAGE_UP: 33, + PAGE_DOWN: 34, + END: 35, + HOME: 36, + LEFT_ARROW : 37, + UP_ARROW : 38, + RIGHT_ARROW : 39, + DOWN_ARROW : 40, + TAB : 9, + BACKSPACE: 8, + DELETE: 46 + }, + + /** + * Vendor prefixed CSS properties to be used to support the given functionality in older browsers + * as well. + */ + CSS: { + /* Constants */ + TRANSITIONEND: 'transitionend' + (isWebkit ? ' webkitTransitionEnd' : ''), + ANIMATIONEND: 'animationend' + (isWebkit ? ' webkitAnimationEnd' : ''), + + TRANSFORM: vendorProperty('transform'), + TRANSFORM_ORIGIN: vendorProperty('transformOrigin'), + TRANSITION: vendorProperty('transition'), + TRANSITION_DURATION: vendorProperty('transitionDuration'), + ANIMATION_PLAY_STATE: vendorProperty('animationPlayState'), + ANIMATION_DURATION: vendorProperty('animationDuration'), + ANIMATION_NAME: vendorProperty('animationName'), + ANIMATION_TIMING: vendorProperty('animationTimingFunction'), + ANIMATION_DIRECTION: vendorProperty('animationDirection') + }, + + /** + * As defined in core/style/_variables.scss + * + * $layout-breakpoint-xs: 600px !default; + * $layout-breakpoint-sm: 960px !default; + * $layout-breakpoint-md: 1280px !default; + * $layout-breakpoint-lg: 1920px !default; + * + */ + MEDIA: { + 'xs' : '(max-width: 599px)' , + 'gt-xs' : '(min-width: 600px)' , + 'sm' : '(min-width: 600px) and (max-width: 959px)' , + 'gt-sm' : '(min-width: 960px)' , + 'md' : '(min-width: 960px) and (max-width: 1279px)' , + 'gt-md' : '(min-width: 1280px)' , + 'lg' : '(min-width: 1280px) and (max-width: 1919px)', + 'gt-lg' : '(min-width: 1920px)' , + 'xl' : '(min-width: 1920px)' , + 'landscape' : '(orientation: landscape)' , + 'portrait' : '(orientation: portrait)' , + 'print' : 'print' + }, + + MEDIA_PRIORITY: [ + 'xl', + 'gt-lg', + 'lg', + 'gt-md', + 'md', + 'gt-sm', + 'sm', + 'gt-xs', + 'xs', + 'landscape', + 'portrait', + 'print' + ] + }; + + return self; +} + +})(); +(function(){ +"use strict"; + + angular + .module('material.core') + .config(["$provide", function($provide){ + $provide.decorator('$mdUtil', ['$delegate', function ($delegate){ + /** + * Inject the iterator facade to easily support iteration and accessors + * @see iterator below + */ + $delegate.iterator = MdIterator; + + return $delegate; + } + ]); + }]); + + /** + * iterator is a list facade to easily support iteration and accessors/ + * + * @param {any[]} items Array list which this iterator will enumerate + * @param {boolean=} reloop enables iterator to consider the list as an endless loop + * @return {{add: add, next: (function()), last: (function(): any|null), previous: (function()), count: (function(): number), hasNext: (function(*=): Array.length|*|number|boolean), inRange: (function(*): boolean), remove: remove, contains: (function(*=): *|boolean), itemAt: (function(*=): any|null), findBy: (function(*, *): *[]), hasPrevious: (function(*=): Array.length|*|number|boolean), items: (function(): *[]), indexOf: (function(*=): number), first: (function(): any|null)}} + * @constructor + */ + function MdIterator(items, reloop) { + var trueFn = function() { return true; }; + + if (items && !angular.isArray(items)) { + items = Array.prototype.slice.call(items); + } + + reloop = !!reloop; + var _items = items || []; + + // Published API + return { + items: getItems, + count: count, + + inRange: inRange, + contains: contains, + indexOf: indexOf, + itemAt: itemAt, + + findBy: findBy, + + add: add, + remove: remove, + + first: first, + last: last, + next: angular.bind(null, findSubsequentItem, false), + previous: angular.bind(null, findSubsequentItem, true), + + hasPrevious: hasPrevious, + hasNext: hasNext + }; + + /** + * Publish copy of the enumerable set + * @returns {Array|*} + */ + function getItems() { + return [].concat(_items); + } + + /** + * Determine length of the list + * @returns {Array.length|*|number} + */ + function count() { + return _items.length; + } + + /** + * Is the index specified valid + * @param index + * @returns {Array.length|*|number|boolean} + */ + function inRange(index) { + return _items.length && (index > -1) && (index < _items.length); + } + + /** + * Can the iterator proceed to the next item in the list; relative to + * the specified item. + * + * @param item + * @returns {Array.length|*|number|boolean} + */ + function hasNext(item) { + return item ? inRange(indexOf(item) + 1) : false; + } + + /** + * Can the iterator proceed to the previous item in the list; relative to + * the specified item. + * + * @param item + * @returns {Array.length|*|number|boolean} + */ + function hasPrevious(item) { + return item ? inRange(indexOf(item) - 1) : false; + } + + /** + * Get item at specified index/position + * @param index + * @returns {*} + */ + function itemAt(index) { + return inRange(index) ? _items[index] : null; + } + + /** + * Find all elements matching the key/value pair + * otherwise return null + * + * @param val + * @param key + * + * @return array + */ + function findBy(key, val) { + return _items.filter(function(item) { + return item[key] === val; + }); + } + + /** + * Add item to list + * @param item + * @param index + * @returns {*} + */ + function add(item, index) { + if (!item) return -1; + + if (!angular.isNumber(index)) { + index = _items.length; + } + + _items.splice(index, 0, item); + + return indexOf(item); + } + + /** + * Remove item from list... + * @param item + */ + function remove(item) { + if (contains(item)){ + _items.splice(indexOf(item), 1); + } + } + + /** + * Get the zero-based index of the target item + * @param item + * @returns {*} + */ + function indexOf(item) { + return _items.indexOf(item); + } + + /** + * Boolean existence check + * @param item + * @returns {boolean} + */ + function contains(item) { + return item && (indexOf(item) > -1); + } + + /** + * Return first item in the list + * @returns {*} + */ + function first() { + return _items.length ? _items[0] : null; + } + + /** + * Return last item in the list... + * @returns {*} + */ + function last() { + return _items.length ? _items[_items.length - 1] : null; + } + + /** + * Find the next item. If reloop is true and at the end of the list, it will go back to the + * first item. If given, the `validate` callback will be used to determine whether the next item + * is valid. If not valid, it will try to find the next item again. + * + * @param {boolean} backwards Specifies the direction of searching (forwards/backwards) + * @param {*} item The item whose subsequent item we are looking for + * @param {Function=} validate The `validate` function + * @param {integer=} limit The recursion limit + * + * @returns {*} The subsequent item or null + */ + function findSubsequentItem(backwards, item, validate, limit) { + validate = validate || trueFn; + + var curIndex = indexOf(item); + while (true) { + if (!inRange(curIndex)) return null; + + var nextIndex = curIndex + (backwards ? -1 : 1); + var foundItem = null; + if (inRange(nextIndex)) { + foundItem = _items[nextIndex]; + } else if (reloop) { + foundItem = backwards ? last() : first(); + nextIndex = indexOf(foundItem); + } + + if ((foundItem === null) || (nextIndex === limit)) return null; + if (validate(foundItem)) return foundItem; + + if (angular.isUndefined(limit)) limit = nextIndex; + + curIndex = nextIndex; + } + } + } + + +})(); +(function(){ +"use strict"; + + +mdMediaFactory.$inject = ["$mdConstant", "$rootScope", "$window"];angular.module('material.core') +.factory('$mdMedia', mdMediaFactory); + +/** + * @ngdoc service + * @name $mdMedia + * @module material.core + * + * @description + * `$mdMedia` is used to evaluate whether a given media query is true or false given the + * current device's screen / window size. The media query will be re-evaluated on resize, allowing + * you to register a watch. + * + * `$mdMedia` also has pre-programmed support for media queries that match the layout breakpoints: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    BreakpointmediaQuery
    xs(max-width: 599px)
    gt-xs(min-width: 600px)
    sm(min-width: 600px) and (max-width: 959px)
    gt-sm(min-width: 960px)
    md(min-width: 960px) and (max-width: 1279px)
    gt-md(min-width: 1280px)
    lg(min-width: 1280px) and (max-width: 1919px)
    gt-lg(min-width: 1920px)
    xl(min-width: 1920px)
    landscapelandscape
    portraitportrait
    printprint
    + * + * See Material Design's Layout - Adaptive UI for more details. + * + * + * + * + * + * @returns {boolean} a boolean representing whether or not the given media query is true or false. + * + * @usage + * + * app.controller('MyController', function($mdMedia, $scope) { + * $scope.$watch(function() { return $mdMedia('lg'); }, function(big) { + * $scope.bigScreen = big; + * }); + * + * $scope.screenIsSmall = $mdMedia('sm'); + * $scope.customQuery = $mdMedia('(min-width: 1234px)'); + * $scope.anotherCustom = $mdMedia('max-width: 300px'); + * }); + * + */ + +/* @ngInject */ +function mdMediaFactory($mdConstant, $rootScope, $window) { + var queries = {}; + var mqls = {}; + var results = {}; + var normalizeCache = {}; + + $mdMedia.getResponsiveAttribute = getResponsiveAttribute; + $mdMedia.getQuery = getQuery; + $mdMedia.watchResponsiveAttributes = watchResponsiveAttributes; + + return $mdMedia; + + function $mdMedia(query) { + var validated = queries[query]; + if (angular.isUndefined(validated)) { + validated = queries[query] = validate(query); + } + + var result = results[validated]; + if (angular.isUndefined(result)) { + result = add(validated); + } + + return result; + } + + function validate(query) { + return $mdConstant.MEDIA[query] || + ((query.charAt(0) !== '(') ? ('(' + query + ')') : query); + } + + function add(query) { + var result = mqls[query]; + if (!result) { + result = mqls[query] = $window.matchMedia(query); + } + + result.addListener(onQueryChange); + return (results[result.media] = !!result.matches); + } + + function onQueryChange(query) { + $rootScope.$evalAsync(function() { + results[query.media] = !!query.matches; + }); + } + + function getQuery(name) { + return mqls[name]; + } + + function getResponsiveAttribute(attrs, attrName) { + for (var i = 0; i < $mdConstant.MEDIA_PRIORITY.length; i++) { + var mediaName = $mdConstant.MEDIA_PRIORITY[i]; + if (!mqls[queries[mediaName]].matches) { + continue; + } + + var normalizedName = getNormalizedName(attrs, attrName + '-' + mediaName); + if (attrs[normalizedName]) { + return attrs[normalizedName]; + } + } + + // fallback on unprefixed + return attrs[getNormalizedName(attrs, attrName)]; + } + + function watchResponsiveAttributes(attrNames, attrs, watchFn) { + var unwatchFns = []; + attrNames.forEach(function(attrName) { + var normalizedName = getNormalizedName(attrs, attrName); + if (angular.isDefined(attrs[normalizedName])) { + unwatchFns.push( + attrs.$observe(normalizedName, angular.bind(void 0, watchFn, null))); + } + + for (var mediaName in $mdConstant.MEDIA) { + normalizedName = getNormalizedName(attrs, attrName + '-' + mediaName); + if (angular.isDefined(attrs[normalizedName])) { + unwatchFns.push( + attrs.$observe(normalizedName, angular.bind(void 0, watchFn, mediaName))); + } + } + }); + + return function unwatch() { + unwatchFns.forEach(function(fn) { fn(); }); + }; + } + + // Improves performance dramatically + function getNormalizedName(attrs, attrName) { + return normalizeCache[attrName] || + (normalizeCache[attrName] = attrs.$normalize(attrName)); + } +} + +})(); +(function(){ +"use strict"; + +angular + .module('material.core') + .config(["$provide", function($provide) { + $provide.decorator('$mdUtil', ['$delegate', function ($delegate) { + + // Inject the prefixer into our original $mdUtil service. + $delegate.prefixer = MdPrefixer; + + return $delegate; + }]); + }]); + +/** + * @param {string|string[]} initialAttributes + * @param {boolean} buildSelector + * @return {string|string[]|{buildSelector: (function(string|string[]): string), + * buildList: (function(string|string[]): string[]), + * hasAttribute: (function(JQLite|Element, string): HTMLElement), + * removeAttribute: (function(JQLite|Element, string): void)}} + * @constructor + */ +function MdPrefixer(initialAttributes, buildSelector) { + var PREFIXES = ['data', 'x']; + + if (initialAttributes) { + // The prefixer also accepts attributes as a parameter, and immediately builds a list or selector for + // the specified attributes. + return buildSelector ? _buildSelector(initialAttributes) : _buildList(initialAttributes); + } + + return { + buildList: _buildList, + buildSelector: _buildSelector, + hasAttribute: _hasAttribute, + removeAttribute: _removeAttribute + }; + + function _buildList(attributes) { + attributes = angular.isArray(attributes) ? attributes : [attributes]; + + attributes.forEach(function(item) { + PREFIXES.forEach(function(prefix) { + attributes.push(prefix + '-' + item); + }); + }); + + return attributes; + } + + function _buildSelector(attributes) { + attributes = angular.isArray(attributes) ? attributes : [attributes]; + + return _buildList(attributes) + .map(function(item) { + return '[' + item + ']'; + }) + .join(','); + } + + function _hasAttribute(element, attribute) { + element = _getNativeElement(element); + + if (!element) { + return false; + } + + var prefixedAttrs = _buildList(attribute); + + for (var i = 0; i < prefixedAttrs.length; i++) { + if (element.hasAttribute(prefixedAttrs[i])) { + return true; + } + } + + return false; + } + + function _removeAttribute(element, attribute) { + element = _getNativeElement(element); + + if (!element) { + return; + } + + _buildList(attribute).forEach(function(prefixedAttribute) { + element.removeAttribute(prefixedAttribute); + }); + } + + /** + * Transforms a jqLite or DOM element into a HTML element. + * This is useful when supporting jqLite elements and DOM elements at + * same time. + * @param element {JQLite|Element} Element to be parsed + * @returns {HTMLElement} Parsed HTMLElement + */ + function _getNativeElement(element) { + element = element[0] || element; + + if (element.nodeType) { + return element; + } + } + +} + +})(); +(function(){ +"use strict"; + +/* + * This var has to be outside the angular factory, otherwise when + * there are multiple material apps on the same page, each app + * will create its own instance of this array and the app's IDs + * will not be unique. + */ +UtilFactory.$inject = ["$document", "$timeout", "$compile", "$rootScope", "$$mdAnimate", "$interpolate", "$log", "$rootElement", "$window", "$$rAF"]; +var nextUniqueId = 0, isIos, isAndroid, isFirefox; + +// Support material-tools builds. +if (window.navigator) { + var userAgent = window.navigator.userAgent || window.navigator.vendor || window.opera; + isIos = userAgent.match(/ipad|iphone|ipod/i); + isAndroid = userAgent.match(/android/i); + isFirefox = userAgent.match(/(firefox|minefield)/i); +} + +/** + * @ngdoc module + * @name material.core.util + * @description + * Util + */ +angular +.module('material.core') +.factory('$mdUtil', UtilFactory); + +/** + * @ngInject + */ +function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $interpolate, $log, + $rootElement, $window, $$rAF) { + // Setup some core variables for the processTemplate method + var startSymbol = $interpolate.startSymbol(), + endSymbol = $interpolate.endSymbol(), + usesStandardSymbols = ((startSymbol === '{{') && (endSymbol === '}}')); + + // Polyfill document.contains for IE11. + document.contains || (document.contains = function (node) { + return document.body.contains(node); + }); + + /** + * Checks if the target element has the requested style by key + * @param {DOMElement|JQLite} target Target element + * @param {string} key Style key + * @param {string=} expectedVal Optional expected value + * @returns {boolean} Whether the target element has the style or not + */ + var hasComputedStyle = function (target, key, expectedVal) { + var hasValue = false; + + if (target && target.length) { + var computedStyles = $window.getComputedStyle(target[0]); + hasValue = angular.isDefined(computedStyles[key]) && + (expectedVal ? computedStyles[key] == expectedVal : true); + } + + return hasValue; + }; + + function validateCssValue(value) { + return !value ? '0' : + hasPx(value) || hasPercent(value) ? value : value + 'px'; + } + + function hasPx(value) { + return String(value).indexOf('px') > -1; + } + + function hasPercent(value) { + return String(value).indexOf('%') > -1; + } + + var $mdUtil = { + dom: {}, + isIos: isIos, + isAndroid: isAndroid, + now: window.performance && window.performance.now ? + angular.bind(window.performance, window.performance.now) : Date.now || function() { + return new Date().getTime(); + }, + + /** + * Cross-version compatibility method to retrieve an option of a ngModel controller, + * which supports the breaking changes in the AngularJS snapshot (SHA 87a2ff76af5d0a9268d8eb84db5755077d27c84c). + * @param {!ngModel.NgModelController} ngModelCtrl + * @param {!string} optionName + * @returns {string|number|boolean|Object|undefined} + */ + getModelOption: function (ngModelCtrl, optionName) { + if (!ngModelCtrl.$options) { + return; + } + + var $options = ngModelCtrl.$options; + + // The newer versions of AngularJS introduced a getOption function and made the option values + // no longer visible on the $options object. + return $options.getOption ? $options.getOption(optionName) : $options[optionName]; + }, + + /** + * Determines the current 'dir'ectional value based on the value of 'dir' + * attribute of the element. If that is not defined, it will try to use + * a 'dir' attribute of the body or html tag. + * + * @param {Object=} attrs a hash object with key-value pairs of normalized + * attribute names and their corresponding attribute values. + * @returns {boolean} true if the element's passed in attributes, + * the document, or the body indicates RTL mode, false otherwise. + */ + isRtl: function(attrs) { + var dir = angular.isDefined(attrs) && attrs.hasOwnProperty('dir') && attrs.dir; + + switch (dir) { + case 'ltr': + return false; + + case 'rtl': + return true; + } + + return ($document[0].dir === 'rtl' || $document[0].body.dir === 'rtl'); + }, + + /** + * Bi-directional accessor/mutator used to easily update an element's + * property based on the current 'dir'ectional value. + */ + bidi: function(element, property, lValue, rValue) { + var ltr = !this.isRtl(); + + // If accessor + if (arguments.length == 0) return ltr ? 'ltr' : 'rtl'; + + // If mutator + var elem = angular.element(element); + + if (ltr && angular.isDefined(lValue)) { + elem.css(property, validateCssValue(lValue)); + } + else if (!ltr && angular.isDefined(rValue)) { + elem.css(property, validateCssValue(rValue)); + } + }, + + bidiProperty: function (element, lProperty, rProperty, value) { + var ltr = !this.isRtl(); + + var elem = angular.element(element); + + if (ltr && angular.isDefined(lProperty)) { + elem.css(lProperty, validateCssValue(value)); + elem.css(rProperty, ''); + } + else if (!ltr && angular.isDefined(rProperty)) { + elem.css(rProperty, validateCssValue(value)); + elem.css(lProperty, ''); + } + }, + + clientRect: function(element, offsetParent, isOffsetRect) { + var node = getNode(element); + offsetParent = getNode(offsetParent || node.offsetParent || document.body); + var nodeRect = node.getBoundingClientRect(); + + // The user can ask for an offsetRect: a rect relative to the offsetParent, + // or a clientRect: a rect relative to the page + var offsetRect = isOffsetRect ? + offsetParent.getBoundingClientRect() : + {left: 0, top: 0, width: 0, height: 0}; + return { + left: nodeRect.left - offsetRect.left, + top: nodeRect.top - offsetRect.top, + width: nodeRect.width, + height: nodeRect.height + }; + }, + offsetRect: function(element, offsetParent) { + return $mdUtil.clientRect(element, offsetParent, true); + }, + + /** + * Annoying method to copy nodes to an array, thanks to IE. + * @param nodes + * @return {Array} + */ + nodesToArray: function(nodes) { + var results = [], i; + nodes = nodes || []; + + for (i = 0; i < nodes.length; ++i) { + results.push(nodes.item(i)); + } + return results; + }, + + /** + * Determines the absolute position of the viewport. + * Useful when making client rectangles absolute. + * @returns {number} + */ + getViewportTop: function() { + // If body scrolling is disabled, then use the cached viewport top value, otherwise get it + // fresh from the $window. + if ($mdUtil.disableScrollAround._count && $mdUtil.disableScrollAround._viewPortTop) { + return $mdUtil.disableScrollAround._viewPortTop; + } else { + return $window.scrollY || $window.pageYOffset || 0; + } + }, + + /** + * Finds the proper focus target by searching the DOM. + * + * @param {!JQLite} containerEl + * @param {string=} attributeVal + * @returns {JQLite|undefined} + */ + findFocusTarget: function(containerEl, attributeVal) { + var AUTO_FOCUS = this.prefixer('md-autofocus', true); + var elToFocus; + + elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS); + + // Scan for fallback to 'universal' API + if (!elToFocus) { + elToFocus = scanForFocusable(containerEl, AUTO_FOCUS); + } + + return elToFocus; + + /** + * Can target and nested children for specified Selector (attribute) + * whose value may be an expression that evaluates to True/False. + * @param {!JQLite} target + * @param {!string} selector + * @return {JQLite|undefined} + */ + function scanForFocusable(target, selector) { + var elFound, items = target[0].querySelectorAll(selector); + + // Find the last child element with the focus attribute + if (items && items.length) { + items.length && angular.forEach(items, function(it) { + it = angular.element(it); + + // Check the element for the md-autofocus class to ensure any associated expression + // evaluated to true. + var isFocusable = it.hasClass('md-autofocus'); + if (isFocusable) elFound = it; + }); + } + return elFound; + } + }, + + /** + * Disables scroll around the passed parent element. + * @param {Element|JQLite=} element Origin Element (not used) + * @param {Element|JQLite=} parent Element to disable scrolling within. + * Defaults to body if none supplied. + * @param {Object=} options Object of options to modify functionality + * - disableScrollMask Boolean of whether or not to create a scroll mask element or + * use the passed parent element. + */ + disableScrollAround: function(element, parent, options) { + options = options || {}; + + $mdUtil.disableScrollAround._count = Math.max(0, $mdUtil.disableScrollAround._count || 0); + $mdUtil.disableScrollAround._count++; + + if ($mdUtil.disableScrollAround._restoreScroll) { + return $mdUtil.disableScrollAround._restoreScroll; + } + + var body = $document[0].body; + var restoreBody = disableBodyScroll(); + var restoreElement = disableElementScroll(parent, options); + + return $mdUtil.disableScrollAround._restoreScroll = function() { + if (--$mdUtil.disableScrollAround._count <= 0) { + delete $mdUtil.disableScrollAround._viewPortTop; + restoreBody(); + restoreElement(); + delete $mdUtil.disableScrollAround._restoreScroll; + } + }; + + /** + * Creates a virtual scrolling mask to prevent touchmove, keyboard, scrollbar clicking, + * and wheel events. + * @param {!Element|!JQLite} elementToDisable + * @param {Object=} scrollMaskOptions Object of options to modify functionality + * - disableScrollMask Boolean of whether or not to create a scroll mask element or + * use the passed parent element. + * @returns {Function} + */ + function disableElementScroll(elementToDisable, scrollMaskOptions) { + var scrollMask; + var wrappedElementToDisable = angular.element(elementToDisable || body); + + if (scrollMaskOptions.disableScrollMask) { + scrollMask = wrappedElementToDisable; + } else { + scrollMask = angular.element( + '
    ' + + '
    ' + + '
    '); + wrappedElementToDisable.append(scrollMask); + } + + /** + * @param {Event} $event + */ + function preventDefault($event) { + $event.preventDefault(); + } + + scrollMask.on('wheel touchmove', preventDefault); + + return function restoreElementScroll() { + scrollMask.off('wheel touchmove', preventDefault); + + if (!scrollMaskOptions.disableScrollMask && scrollMask[0].parentNode) { + scrollMask[0].parentNode.removeChild(scrollMask[0]); + } + }; + } + + // Converts the body to a position fixed block and translate it to the proper scroll position + function disableBodyScroll() { + var documentElement = $document[0].documentElement; + + var prevDocumentStyle = documentElement.style.cssText || ''; + var prevBodyStyle = body.style.cssText || ''; + + var viewportTop = $mdUtil.getViewportTop(); + $mdUtil.disableScrollAround._viewPortTop = viewportTop; + var clientWidth = body.clientWidth; + var hasVerticalScrollbar = body.scrollHeight > body.clientHeight + 1; + + // Scroll may be set on element (for example by overflow-y: scroll) + // but Chrome is reporting the scrollTop position always on . + // scrollElement will allow to restore the scrollTop position to proper target. + var scrollElement = documentElement.scrollTop > 0 ? documentElement : body; + + if (hasVerticalScrollbar) { + angular.element(body).css({ + position: 'fixed', + width: '100%', + top: -viewportTop + 'px' + }); + } + + if (body.clientWidth < clientWidth) { + body.style.overflow = 'hidden'; + } + + return function restoreScroll() { + // Reset the inline style CSS to the previous. + body.style.cssText = prevBodyStyle; + documentElement.style.cssText = prevDocumentStyle; + + // The scroll position while being fixed + scrollElement.scrollTop = viewportTop; + }; + } + + }, + + enableScrolling: function() { + var restoreFn = this.disableScrollAround._restoreScroll; + restoreFn && restoreFn(); + }, + + floatingScrollbars: function() { + if (this.floatingScrollbars.cached === undefined) { + var tempNode = angular.element('
    ').css({ + width: '100%', + 'z-index': -1, + position: 'absolute', + height: '35px', + 'overflow-y': 'scroll' + }); + tempNode.children().css('height', '60px'); + + $document[0].body.appendChild(tempNode[0]); + this.floatingScrollbars.cached = + (tempNode[0].offsetWidth === tempNode[0].childNodes[0].offsetWidth); + tempNode.remove(); + } + return this.floatingScrollbars.cached; + }, + + /** + * Mobile safari only allows you to set focus in click event listeners. + * @param {Element|JQLite} element to focus + */ + forceFocus: function(element) { + var node = element[0] || element; + + document.addEventListener('click', function focusOnClick(ev) { + if (ev.target === node && ev.$focus) { + node.focus(); + ev.stopImmediatePropagation(); + ev.preventDefault(); + node.removeEventListener('click', focusOnClick); + } + }, true); + + var newEvent = document.createEvent('MouseEvents'); + newEvent.initMouseEvent('click', false, true, window, {}, 0, 0, 0, 0, + false, false, false, false, 0, null); + newEvent.$material = true; + newEvent.$focus = true; + node.dispatchEvent(newEvent); + }, + + /** + * facade to build md-backdrop element with desired styles + * NOTE: Use $compile to trigger backdrop postLink function + */ + createBackdrop: function(scope, addClass) { + return $compile($mdUtil.supplant('', [addClass]))(scope); + }, + + /** + * supplant() method from Crockford's `Remedial Javascript` + * Equivalent to use of $interpolate; without dependency on + * interpolation symbols and scope. Note: the '{}' can + * be property names, property chains, or array indices. + */ + supplant: function(template, values, pattern) { + pattern = pattern || /\{([^{}]*)\}/g; + return template.replace(pattern, function(a, b) { + var p = b.split('.'), + r = values; + try { + for (var s in p) { + if (p.hasOwnProperty(s)) { + r = r[p[s]]; + } + } + } catch (e) { + r = a; + } + return (typeof r === 'string' || typeof r === 'number') ? r : a; + }); + }, + + fakeNgModel: function() { + return { + $fake: true, + $setTouched: angular.noop, + $setViewValue: function(value) { + this.$viewValue = value; + this.$render(value); + this.$viewChangeListeners.forEach(function(cb) { + cb(); + }); + }, + $isEmpty: function(value) { + return ('' + value).length === 0; + }, + $parsers: [], + $formatters: [], + $viewChangeListeners: [], + $render: angular.noop + }; + }, + + /** + * @param {Function} func original function to be debounced + * @param {number} wait number of milliseconds to delay (since last debounce reset). + * Default value 10 msecs. + * @param {Object} scope in which to apply the function after debouncing ends + * @param {boolean} invokeApply should the $timeout trigger $digest() dirty checking + * @return {Function} A function, that, as long as it continues to be invoked, will not be + * triggered. The function will be called after it stops being called for N milliseconds. + */ + debounce: function(func, wait, scope, invokeApply) { + var timer; + + return function debounced() { + var context = scope, + args = Array.prototype.slice.call(arguments); + + $timeout.cancel(timer); + timer = $timeout(function() { + + timer = undefined; + func.apply(context, args); + + }, wait || 10, invokeApply); + }; + }, + + /** + * The function will not be called unless it has been more than `delay` milliseconds since the + * last call. + * @param {Function} func original function to throttle + * @param {number} delay number of milliseconds to delay + * @return {Function} a function that can only be triggered every `delay` milliseconds. + */ + throttle: function throttle(func, delay) { + var recent; + return function throttled() { + var context = this; + var args = arguments; + var now = $mdUtil.now(); + + if (!recent || (now - recent > delay)) { + func.apply(context, args); + recent = now; + } + }; + }, + + /** + * Measures the number of milliseconds taken to run the provided callback + * function. Uses a high-precision timer if available. + */ + time: function time(cb) { + var start = $mdUtil.now(); + cb(); + return $mdUtil.now() - start; + }, + + /** + * Create an implicit getter that caches its `getter()` + * lookup value + */ + valueOnUse : function (scope, key, getter) { + var value = null, args = Array.prototype.slice.call(arguments); + var params = (args.length > 3) ? args.slice(3) : []; + + Object.defineProperty(scope, key, { + get: function () { + if (value === null) value = getter.apply(scope, params); + return value; + } + }); + }, + + /** + * Get a unique ID. + * + * @returns {string} an unique numeric string + */ + nextUid: function() { + return '' + nextUniqueId++; + }, + + /** + * Stop watchers and events from firing on a scope without destroying it, + * by disconnecting it from its parent and its siblings' linked lists. + * @param {Object} scope to disconnect + */ + disconnectScope: function disconnectScope(scope) { + if (!scope) return; + + // we can't destroy the root scope or a scope that has been already destroyed + if (scope.$root === scope) return; + if (scope.$$destroyed) return; + + var parent = scope.$parent; + scope.$$disconnected = true; + + // See Scope.$destroy + if (parent.$$childHead === scope) parent.$$childHead = scope.$$nextSibling; + if (parent.$$childTail === scope) parent.$$childTail = scope.$$prevSibling; + if (scope.$$prevSibling) scope.$$prevSibling.$$nextSibling = scope.$$nextSibling; + if (scope.$$nextSibling) scope.$$nextSibling.$$prevSibling = scope.$$prevSibling; + + scope.$$nextSibling = scope.$$prevSibling = null; + + }, + + /** + * Undo the effects of disconnectScope(). + * @param {Object} scope to reconnect + */ + reconnectScope: function reconnectScope(scope) { + if (!scope) return; + + // we can't disconnect the root node or scope already disconnected + if (scope.$root === scope) return; + if (!scope.$$disconnected) return; + + var child = scope; + + var parent = child.$parent; + child.$$disconnected = false; + // See Scope.$new for this logic... + child.$$prevSibling = parent.$$childTail; + if (parent.$$childHead) { + parent.$$childTail.$$nextSibling = child; + parent.$$childTail = child; + } else { + parent.$$childHead = parent.$$childTail = child; + } + }, + + /** + * Get an element's siblings matching a given tag name. + * + * @param {JQLite|angular.element|HTMLElement} element Element to start walking the DOM from + * @param {string} tagName HTML tag name to match against + * @returns {Object[]} JQLite + */ + getSiblings: function getSiblings(element, tagName) { + var upperCasedTagName = tagName.toUpperCase(); + if (element instanceof angular.element) { + element = element[0]; + } + var siblings = Array.prototype.filter.call(element.parentNode.children, function(node) { + return element !== node && node.tagName.toUpperCase() === upperCasedTagName; + }); + return siblings.map(function (sibling) { + return angular.element(sibling); + }); + }, + + /** + * getClosest replicates jQuery.closest() to walk up the DOM tree until it finds a matching + * nodeName. + * + * @param {Node} el Element to start walking the DOM from + * @param {string|function} validateWith If a string is passed, it will be evaluated against + * each of the parent nodes' tag name. If a function is passed, the loop will call it with each + * of the parents and will use the return value to determine whether the node is a match. + * @param {boolean=} onlyParent Only start checking from the parent element, not `el`. + * @returns {Node|null} closest matching parent Node or null if not found + */ + getClosest: function getClosest(el, validateWith, onlyParent) { + if (angular.isString(validateWith)) { + var tagName = validateWith.toUpperCase(); + validateWith = function(el) { + return el.nodeName.toUpperCase() === tagName; + }; + } + + if (el instanceof angular.element) el = el[0]; + if (onlyParent) el = el.parentNode; + if (!el) return null; + + do { + if (validateWith(el)) { + return el; + } + } while (el = el.parentNode); + + return null; + }, + + /** + * Build polyfill for the Node.contains feature (if needed) + * @param {Node} node + * @param {Node} child + * @returns {Node} + */ + elementContains: function(node, child) { + var hasContains = (window.Node && window.Node.prototype && Node.prototype.contains); + var findFn = hasContains ? angular.bind(node, node.contains) : angular.bind(node, function(arg) { + // compares the positions of two nodes and returns a bitmask + return (node === child) || !!(this.compareDocumentPosition(arg) & 16); + }); + + return findFn(child); + }, + + /** + * Functional equivalent for $element.filter(‘md-bottom-sheet’) + * useful with interimElements where the element and its container are important... + * + * @param {JQLite} element to scan + * @param {string} nodeName of node to find (e.g. 'md-dialog') + * @param {boolean=} scanDeep optional flag to allow deep scans; defaults to 'false'. + * @param {boolean=} warnNotFound optional flag to enable log warnings; defaults to false + */ + extractElementByName: function(element, nodeName, scanDeep, warnNotFound) { + var found = scanTree(element); + if (!found && !!warnNotFound) { + $log.warn($mdUtil.supplant("Unable to find node '{0}' in element '{1}'.",[nodeName, element[0].outerHTML])); + } + + return angular.element(found || element); + + /** + * Breadth-First tree scan for element with matching `nodeName` + */ + function scanTree(element) { + return scanLevel(element) || (scanDeep ? scanChildren(element) : null); + } + + /** + * Case-insensitive scan of current elements only (do not descend). + */ + function scanLevel(element) { + if (element) { + for (var i = 0, len = element.length; i < len; i++) { + if (element[i].nodeName.toLowerCase() === nodeName) { + return element[i]; + } + } + } + return null; + } + + /** + * Scan children of specified node + */ + function scanChildren(element) { + var found; + if (element) { + for (var i = 0, len = element.length; i < len; i++) { + var target = element[i]; + if (!found) { + for (var j = 0, numChild = target.childNodes.length; j < numChild; j++) { + found = found || scanTree([target.childNodes[j]]); + } + } + } + } + return found; + } + + }, + + /** + * Give optional properties with no value a boolean true if attr provided or false otherwise + */ + initOptionalProperties: function(scope, attr, defaults) { + defaults = defaults || {}; + angular.forEach(scope.$$isolateBindings, function(binding, key) { + if (binding.optional && angular.isUndefined(scope[key])) { + var attrIsDefined = angular.isDefined(attr[binding.attrName]); + scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : attrIsDefined; + } + }); + }, + + /** + * Alternative to $timeout calls with 0 delay. + * nextTick() coalesces all calls within a single frame + * to minimize $digest thrashing + * + * @param {Function} callback function to be called after the tick + * @param {boolean=} digest true to call $rootScope.$digest() after callback + * @param {Object=} scope associated with callback. If the scope is destroyed, the callback will + * be skipped. + * @returns {*} + */ + nextTick: function(callback, digest, scope) { + // grab function reference for storing state details + var nextTick = $mdUtil.nextTick; + var timeout = nextTick.timeout; + var queue = nextTick.queue || []; + + // add callback to the queue + queue.push({scope: scope, callback: callback}); + + // set default value for digest + if (digest == null) digest = true; + + // store updated digest/queue values + nextTick.digest = nextTick.digest || digest; + nextTick.queue = queue; + + // either return existing timeout or create a new one + return timeout || (nextTick.timeout = $timeout(processQueue, 0, false)); + + /** + * Grab a copy of the current queue + * Clear the queue for future use + * Process the existing queue + * Trigger digest if necessary + */ + function processQueue() { + var queue = nextTick.queue; + var digest = nextTick.digest; + + nextTick.queue = []; + nextTick.timeout = null; + nextTick.digest = false; + + queue.forEach(function(queueItem) { + var skip = queueItem.scope && queueItem.scope.$$destroyed; + if (!skip) { + queueItem.callback(); + } + }); + + if (digest) $rootScope.$digest(); + } + }, + + /** + * Processes a template and replaces the start/end symbols if the application has + * overridden them. + * + * @param template The template to process whose start/end tags may be replaced. + * @returns {*} + */ + processTemplate: function(template) { + if (usesStandardSymbols) { + return template; + } else { + if (!template || !angular.isString(template)) return template; + return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); + } + }, + + /** + * Scan up dom hierarchy for enabled parent; + */ + getParentWithPointerEvents: function (element) { + var parent = element.parent(); + + // jqLite might return a non-null, but still empty, parent; so check for parent and length + while (hasComputedStyle(parent, 'pointer-events', 'none')) { + parent = parent.parent(); + } + + return parent; + }, + + getNearestContentElement: function (element) { + var current = element.parent()[0]; + // Look for the nearest parent md-content, stopping at the rootElement. + while (current && current !== $rootElement[0] && current !== document.body && current.nodeName.toUpperCase() !== 'MD-CONTENT') { + current = current.parentNode; + } + return current; + }, + + /** + * Checks if the current browser is natively supporting the `sticky` position. + * @returns {string} supported sticky property name + */ + checkStickySupport: function() { + var stickyProp; + var testEl = angular.element('
    '); + $document[0].body.appendChild(testEl[0]); + + var stickyProps = ['sticky', '-webkit-sticky']; + for (var i = 0; i < stickyProps.length; ++i) { + testEl.css({ + position: stickyProps[i], + top: 0, + 'z-index': 2 + }); + + if (testEl.css('position') == stickyProps[i]) { + stickyProp = stickyProps[i]; + break; + } + } + + testEl.remove(); + + return stickyProp; + }, + + /** + * Parses an attribute value, mostly a string. + * By default checks for negated values and returns `false´ if present. + * Negated values are: (native falsy) and negative strings like: + * `false` or `0`. + * @param value Attribute value which should be parsed. + * @param negatedCheck When set to false, won't check for negated values. + * @returns {boolean} + */ + parseAttributeBoolean: function(value, negatedCheck) { + return value === '' || !!value && (negatedCheck === false || value !== 'false' && value !== '0'); + }, + + hasComputedStyle: hasComputedStyle, + + /** + * Returns true if the parent form of the element has been submitted. + * @param element An AngularJS or HTML5 element. + * @returns {boolean} + */ + isParentFormSubmitted: function(element) { + var parent = $mdUtil.getClosest(element, 'form'); + var form = parent ? angular.element(parent).controller('form') : null; + + return form ? form.$submitted : false; + }, + + /** + * Animate the requested element's scrollTop to the requested scrollPosition with basic easing. + * @param {!Element} element The element to scroll. + * @param {number} scrollEnd The new/final scroll position. + * @param {number=} duration Duration of the scroll. Default is 1000ms. + */ + animateScrollTo: function(element, scrollEnd, duration) { + var scrollStart = element.scrollTop; + var scrollChange = scrollEnd - scrollStart; + var scrollingDown = scrollStart < scrollEnd; + var startTime = $mdUtil.now(); + + $$rAF(scrollChunk); + + function scrollChunk() { + var newPosition = calculateNewPosition(); + + element.scrollTop = newPosition; + + if (scrollingDown ? newPosition < scrollEnd : newPosition > scrollEnd) { + $$rAF(scrollChunk); + } + } + + function calculateNewPosition() { + var easeDuration = duration || 1000; + var currentTime = $mdUtil.now() - startTime; + + return ease(currentTime, scrollStart, scrollChange, easeDuration); + } + + function ease(currentTime, start, change, duration) { + // If the duration has passed (which can occur if our app loses focus due to $$rAF), jump + // straight to the proper position + if (currentTime > duration) { + return start + change; + } + + var ts = (currentTime /= duration) * currentTime; + var tc = ts * currentTime; + + return start + change * (-2 * tc + 3 * ts); + } + }, + + /** + * Provides an easy mechanism for removing duplicates from an array. + * + * var myArray = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]; + * + * $mdUtil.uniq(myArray) => [1, 2, 3, 4] + * + * @param {Array} array The array whose unique values should be returned. + * @returns {Array|void} A copy of the array containing only unique values. + */ + uniq: function(array) { + if (!array) { return; } + + return array.filter(function(value, index, self) { + return self.indexOf(value) === index; + }); + }, + + /** + * Gets the inner HTML content of the given HTMLElement. + * Only intended for use with SVG or Symbol elements in IE11. + * @param {Element} element + * @returns {string} the inner HTML of the element passed in + */ + getInnerHTML: function(element) { + // For SVG or Symbol elements, innerHTML returns `undefined` in IE. + // Reference: https://stackoverflow.com/q/28129956/633107 + // The XMLSerializer API is supported on IE11 and is the recommended workaround. + var serializer = new XMLSerializer(); + + return Array.prototype.map.call(element.childNodes, function (child) { + return serializer.serializeToString(child); + }).join(''); + }, + + /** + * Gets the outer HTML content of the given HTMLElement. + * Only intended for use with SVG or Symbol elements in IE11. + * @param {Element} element + * @returns {string} the outer HTML of the element passed in + */ + getOuterHTML: function(element) { + // For SVG or Symbol elements, outerHTML returns `undefined` in IE. + // Reference: https://stackoverflow.com/q/29888050/633107 + // The XMLSerializer API is supported on IE11 and is the recommended workaround. + var serializer = new XMLSerializer(); + return serializer.serializeToString(element); + }, + + /** + * Support: IE 9-11 only + * documentMode is an IE-only property + * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx + */ + msie: window.document.documentMode, + + getTouchAction: function() { + var testEl = document.createElement('div'); + var vendorPrefixes = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; + + for (var i = 0; i < vendorPrefixes.length; i++) { + var prefix = vendorPrefixes[i]; + var property = prefix ? prefix + 'TouchAction' : 'touchAction'; + if (angular.isDefined(testEl.style[property])) { + return property; + } + } + }, + + /** + * @param {Event} event the event to calculate the bubble path for + * @return {EventTarget[]} the set of nodes that this event could bubble up to + */ + getEventPath: function(event) { + var path = []; + var currentTarget = event.target; + while (currentTarget) { + path.push(currentTarget); + currentTarget = currentTarget.parentElement; + } + if (path.indexOf(window) === -1 && path.indexOf(document) === -1) + path.push(document); + if (path.indexOf(window) === -1) + path.push(window); + return path; + }, + + /** + * Gets the string the user has entered and removes Regex identifiers + * @param {string} term + * @returns {string} sanitized string + */ + sanitize: function(term) { + if (!term) return term; + return term.replace(/[\\^$*+?.()|{}[]/g, '\\$&'); + }, + + /********************************************************************************************** + * The following functions were sourced from + * https://github.com/angular/components/blob/3c37e4b1c1cb74a3d0a90d173240fc730d21d9d4/src/cdk/a11y/interactivity-checker/interactivity-checker.ts + **********************************************************************************************/ + + /** + * Gets whether an element is disabled. + * @param {HTMLElement} element Element to be checked. + * @returns {boolean} Whether the element is disabled. + */ + isDisabled: function(element) { + // This does not capture some cases, such as a non-form control with a disabled attribute or + // a form control inside of a disabled form, but should capture the most common cases. + return element.hasAttribute('disabled'); + }, + + /** + * Gets whether an element is visible for the purposes of interactivity. + * + * This will capture states like `display: none` and `visibility: hidden`, but not things like + * being clipped by an `overflow: hidden` parent or being outside the viewport. + * + * @param {HTMLElement} element + * @returns {boolean} Whether the element is visible. + */ + isVisible: function(element) { + return $mdUtil.hasGeometry(element) && getComputedStyle(element).visibility === 'visible'; + }, + + /** + * Gets whether an element can be reached via Tab key. + * Assumes that the element has already been checked with isFocusable. + * @param {HTMLElement} element Element to be checked. + * @returns {boolean} Whether the element is tabbable. + */ + isTabbable: function(element) { + var frameElement = $mdUtil.getFrameElement($mdUtil.getWindow(element)); + + if (frameElement) { + // Frame elements inherit their tabindex onto all child elements. + if ($mdUtil.getTabIndexValue(frameElement) === -1) { + return false; + } + + // Browsers disable tabbing to an element inside of an invisible frame. + if (!$mdUtil.isVisible(frameElement)) { + return false; + } + } + + var nodeName = element.nodeName.toLowerCase(); + var tabIndexValue = $mdUtil.getTabIndexValue(element); + + if (element.hasAttribute('contenteditable')) { + return tabIndexValue !== -1; + } + + if (nodeName === 'iframe' || nodeName === 'object') { + // The frame or object's content may be tabbable depending on the content, but it's + // not possibly to reliably detect the content of the frames. We always consider such + // elements as non-tabbable. + return false; + } + + // In iOS, the browser only considers some specific elements as tabbable. + if (isIos && !$mdUtil.isPotentiallyTabbableIOS(element)) { + return false; + } + + if (nodeName === 'audio') { + // Audio elements without controls enabled are never tabbable, regardless + // of the tabindex attribute explicitly being set. + if (!element.hasAttribute('controls')) { + return false; + } + // Audio elements with controls are by default tabbable unless the + // tabindex attribute is set to `-1` explicitly. + return tabIndexValue !== -1; + } + + if (nodeName === 'video') { + // For all video elements, if the tabindex attribute is set to `-1`, the video + // is not tabbable. Note: We cannot rely on the default `HTMLElement.tabIndex` + // property as that one is set to `-1` in Chrome, Edge and Safari v13.1. The + // tabindex attribute is the source of truth here. + if (tabIndexValue === -1) { + return false; + } + // If the tabindex is explicitly set, and not `-1` (as per check before), the + // video element is always tabbable (regardless of whether it has controls or not). + if (tabIndexValue !== null) { + return true; + } + // Otherwise (when no explicit tabindex is set), a video is only tabbable if it + // has controls enabled. Firefox is special as videos are always tabbable regardless + // of whether there are controls or not. + return isFirefox || element.hasAttribute('controls'); + } + + return element.tabIndex >= 0; + }, + + /** + * Gets whether an element can be focused by the user. + * @param {HTMLElement} element Element to be checked. + * @returns {boolean} Whether the element is focusable. + */ + isFocusable: function(element) { + // Perform checks in order of left to most expensive. + // Again, naive approach that does not capture many edge cases and browser quirks. + return $mdUtil.isPotentiallyFocusable(element) && !$mdUtil.isDisabled(element) && + $mdUtil.isVisible(element); + }, + + /** + * Gets whether an element is potentially focusable without taking current visible/disabled + * state into account. + * @param {HTMLElement} element + * @returns {boolean} + */ + isPotentiallyFocusable: function(element) { + // Inputs are potentially focusable *unless* they're type="hidden". + if ($mdUtil.isHiddenInput(element)) { + return false; + } + + return $mdUtil.isNativeFormElement(element) || + $mdUtil.isAnchorWithHref(element) || + element.hasAttribute('contenteditable') || + $mdUtil.hasValidTabIndex(element); + }, + + /** + * Checks whether the specified element is potentially tabbable on iOS. + * @param {HTMLElement} element + * @returns {boolean} + */ + isPotentiallyTabbableIOS: function(element) { + var nodeName = element.nodeName.toLowerCase(); + var inputType = nodeName === 'input' && element.type; + + return inputType === 'text' + || inputType === 'password' + || nodeName === 'select' + || nodeName === 'textarea'; + }, + + /** + * Returns the parsed tabindex from the element attributes instead of returning the + * evaluated tabindex from the browsers defaults. + * @param {HTMLElement} element + * @returns {null|number} + */ + getTabIndexValue: function(element) { + if (!$mdUtil.hasValidTabIndex(element)) { + return null; + } + + // See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054 + var tabIndex = parseInt(element.getAttribute('tabindex') || '', 10); + + return isNaN(tabIndex) ? -1 : tabIndex; + }, + + /** + * Gets whether an element has a valid tabindex. + * @param {HTMLElement} element + * @returns {boolean} + */ + hasValidTabIndex: function(element) { + if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) { + return false; + } + + var tabIndex = element.getAttribute('tabindex'); + + // IE11 parses tabindex="" as the value "-32768" + if (tabIndex == '-32768') { + return false; + } + + return !!(tabIndex && !isNaN(parseInt(tabIndex, 10))); + }, + + /** + * Checks whether the specified element has any geometry / rectangles. + * @param {HTMLElement} element + * @returns {boolean} + */ + hasGeometry: function(element) { + // Use logic from jQuery to check for an invisible element. + // See https://github.com/jquery/jquery/blob/8969732518470a7f8e654d5bc5be0b0076cb0b87/src/css/hiddenVisibleSelectors.js#L9 + return !!(element.offsetWidth || element.offsetHeight || + (typeof element.getClientRects === 'function' && element.getClientRects().length)); + }, + + /** + * Returns the frame element from a window object. Since browsers like MS Edge throw errors if + * the frameElement property is being accessed from a different host address, this property + * should be accessed carefully. + * @param {Window} window + * @returns {null|HTMLElement} + */ + getFrameElement: function(window) { + try { + return window.frameElement; + } catch (error) { + return null; + } + }, + + /** + * Gets the parent window of a DOM node with regards of being inside of an iframe. + * @param {HTMLElement} node + * @returns {Window} + */ + getWindow: function(node) { + // ownerDocument is null if `node` itself *is* a document. + return node.ownerDocument && node.ownerDocument.defaultView || window; + }, + + /** + * Gets whether an element's + * @param {Node} element + * @returns {boolean} + */ + isNativeFormElement: function(element) { + var nodeName = element.nodeName.toLowerCase(); + return nodeName === 'input' || + nodeName === 'select' || + nodeName === 'button' || + nodeName === 'textarea'; + }, + + /** + * Gets whether an element is an ``. + * @param {HTMLElement} element + * @returns {boolean} + */ + isHiddenInput: function(element) { + return $mdUtil.isInputElement(element) && element.type == 'hidden'; + }, + + /** + * Gets whether an element is an anchor that has an href attribute. + * @param {HTMLElement} element + * @returns {boolean} + */ + isAnchorWithHref: function(element) { + return $mdUtil.isAnchorElement(element) && element.hasAttribute('href'); + }, + + /** + * Gets whether an element is an input element. + * @param {HTMLElement} element + * @returns {boolean} + */ + isInputElement: function(element) { + return element.nodeName.toLowerCase() == 'input'; + }, + + /** + * Gets whether an element is an anchor element. + * @param {HTMLElement} element + * @returns {boolean} + */ + isAnchorElement: function(element) { + return element.nodeName.toLowerCase() == 'a'; + }, + + /********************************************************************************************** + * The following two functions were sourced from + * https://github.com/angular/components/blob/3c37e4b1c1cb74a3d0a90d173240fc730d21d9d4/src/cdk/a11y/focus-trap/focus-trap.ts#L268-L311 + **********************************************************************************************/ + + /** + * Get the first tabbable element from a DOM subtree (inclusive). + * @param {HTMLElement} root + * @returns {HTMLElement|null} + */ + getFirstTabbableElement: function(root) { + if ($mdUtil.isFocusable(root) && $mdUtil.isTabbable(root)) { + return root; + } + + // Iterate in DOM order. Note that IE doesn't have `children` for SVG so we fall + // back to `childNodes` which includes text nodes, comments etc. + var children = root.children || root.childNodes; + + for (var i = 0; i < children.length; i++) { + var tabbableChild = children[i].nodeType === $document[0].ELEMENT_NODE ? + $mdUtil.getFirstTabbableElement(children[i]) : null; + + if (tabbableChild) { + return tabbableChild; + } + } + + return null; + }, + + /** + * Get the last tabbable element from a DOM subtree (inclusive). + * @param {HTMLElement} root + * @returns {HTMLElement|null} + */ + getLastTabbableElement: function(root) { + if ($mdUtil.isFocusable(root) && $mdUtil.isTabbable(root)) { + return root; + } + + // Iterate in reverse DOM order. + var children = root.children || root.childNodes; + + for (var i = children.length - 1; i >= 0; i--) { + var tabbableChild = children[i].nodeType === $document[0].ELEMENT_NODE ? + $mdUtil.getLastTabbableElement(children[i]) : null; + + if (tabbableChild) { + return tabbableChild; + } + } + + return null; + } + }; + + // Instantiate other namespace utility methods + + $mdUtil.dom.animator = $$mdAnimate($mdUtil); + + return $mdUtil; + + function getNode(el) { + return el[0] || el; + } +} + +/** + * Since removing jQuery from the demos, some code that uses `element.focus()` is broken. + * We need to add `element.focus()`, because it's testable unlike `element[0].focus`. + */ +angular.element.prototype.focus = angular.element.prototype.focus || function() { + if (this.length) { + this[0].focus(); + } + return this; +}; + +angular.element.prototype.blur = angular.element.prototype.blur || function() { + if (this.length) { + this[0].blur(); + } + return this; +}; + +})(); +(function(){ +"use strict"; + +// Polyfill angular < 1.4 (provide $animateCss) +angular + .module('material.core') + .factory('$$mdAnimate', ["$q", "$timeout", "$mdConstant", "$animateCss", function($q, $timeout, $mdConstant, $animateCss) { + // Since $$mdAnimate is injected into $mdUtil... use a wrapper function + // to subsequently inject $mdUtil as an argument to the AnimateDomUtils + return function($mdUtil) { + return AnimateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss); + }; + }]); + +/** + * Factory function that requires special injections + */ +function AnimateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss) { + var self; + return self = { + translate3d : function(target, from, to, options) { + return $animateCss(target, { + from: from, + to: to, + addClass: options.transitionInClass, + removeClass: options.transitionOutClass, + duration: options.duration + }) + .start() + .then(function() { + // Resolve with reverser function... + return reverseTranslate; + }); + + /** + * Specific reversal of the request translate animation above... + */ + function reverseTranslate (newFrom) { + return $animateCss(target, { + to: newFrom || from, + addClass: options.transitionOutClass, + removeClass: options.transitionInClass, + duration: options.duration + }).start(); + } + }, + + /** + * Listen for transitionEnd event (with optional timeout) + * Announce completion or failure via promise handlers + */ + waitTransitionEnd: function (element, opts) { + var TIMEOUT = 3000; // fallback is 3 secs + + return $q(function(resolve, reject){ + opts = opts || { }; + + // If there is no transition is found, resolve immediately + // + // NOTE: using $mdUtil.nextTick() causes delays/issues + if (noTransitionFound(opts.cachedTransitionStyles)) { + TIMEOUT = 0; + } + + var timer = $timeout(finished, opts.timeout || TIMEOUT); + element.on($mdConstant.CSS.TRANSITIONEND, finished); + + /** + * Upon timeout or transitionEnd, reject or resolve (respectively) this promise. + * NOTE: Make sure this transitionEnd didn't bubble up from a child + */ + function finished(ev) { + if (ev && ev.target !== element[0]) return; + + if (ev) $timeout.cancel(timer); + element.off($mdConstant.CSS.TRANSITIONEND, finished); + + // Never reject since ngAnimate may cause timeouts due missed transitionEnd events + resolve(); + } + + /** + * Checks whether or not there is a transition. + * + * @param styles The cached styles to use for the calculation. If null, getComputedStyle() + * will be used. + * + * @returns {boolean} True if there is no transition/duration; false otherwise. + */ + function noTransitionFound(styles) { + styles = styles || window.getComputedStyle(element[0]); + + return styles.transitionDuration === '0s' || + (!styles.transition && !styles.transitionProperty); + } + }); + }, + + calculateTransformValues: function (element, originator) { + var origin = originator.element; + var bounds = originator.bounds; + + if (origin || bounds) { + var originBnds = origin ? self.clientRect(origin) || currentBounds() : self.copyRect(bounds); + var dialogRect = self.copyRect(element[0].getBoundingClientRect()); + var dialogCenterPt = self.centerPointFor(dialogRect); + var originCenterPt = self.centerPointFor(originBnds); + + return { + centerX: originCenterPt.x - dialogCenterPt.x, + centerY: originCenterPt.y - dialogCenterPt.y, + scaleX: Math.round(100 * Math.min(0.5, originBnds.width / dialogRect.width)) / 100, + scaleY: Math.round(100 * Math.min(0.5, originBnds.height / dialogRect.height)) / 100 + }; + } + return {centerX: 0, centerY: 0, scaleX: 0.5, scaleY: 0.5}; + + /** + * This is a fallback if the origin information is no longer valid, then the + * origin bounds simply becomes the current bounds for the dialogContainer's parent. + * @returns {null|DOMRect} + */ + function currentBounds() { + var container = element ? element.parent() : null; + var parent = container ? container.parent() : null; + + return parent ? self.clientRect(parent) : null; + } + }, + + /** + * Calculate the zoom transform from dialog to origin. + * + * We use this to set the dialog position immediately; + * then the md-transition-in actually translates back to + * `translate3d(0,0,0) scale(1.0)`... + * + * NOTE: all values are rounded to the nearest integer + */ + calculateZoomToOrigin: function (element, originator) { + var zoomTemplate = "translate3d( {centerX}px, {centerY}px, 0 ) scale( {scaleX}, {scaleY} )"; + var buildZoom = angular.bind(null, $mdUtil.supplant, zoomTemplate); + + return buildZoom(self.calculateTransformValues(element, originator)); + }, + + /** + * Calculate the slide transform from panel to origin. + * NOTE: all values are rounded to the nearest integer + */ + calculateSlideToOrigin: function (element, originator) { + var slideTemplate = "translate3d( {centerX}px, {centerY}px, 0 )"; + var buildSlide = angular.bind(null, $mdUtil.supplant, slideTemplate); + + return buildSlide(self.calculateTransformValues(element, originator)); + }, + + /** + * Enhance raw values to represent valid css stylings... + */ + toCss : function(raw) { + var css = { }; + var lookups = 'left top right bottom width height x y min-width min-height max-width max-height'; + + angular.forEach(raw, function(value,key) { + if (angular.isUndefined(value)) return; + + if (lookups.indexOf(key) >= 0) { + css[key] = value + 'px'; + } else { + switch (key) { + case 'transition': + convertToVendor(key, $mdConstant.CSS.TRANSITION, value); + break; + case 'transform': + convertToVendor(key, $mdConstant.CSS.TRANSFORM, value); + break; + case 'transformOrigin': + convertToVendor(key, $mdConstant.CSS.TRANSFORM_ORIGIN, value); + break; + case 'font-size': + css['font-size'] = value; // font sizes aren't always in px + break; + } + } + }); + + return css; + + function convertToVendor(key, vendor, value) { + angular.forEach(vendor.split(' '), function (key) { + css[key] = value; + }); + } + }, + + /** + * Convert the translate CSS value to key/value pair(s). + * @param {string} transform + * @param {boolean=} addTransition + * @param {string=} transition + * @return {Object} object containing CSS translate key/value pair(s) + */ + toTransformCss: function (transform, addTransition, transition) { + var css = {}; + angular.forEach($mdConstant.CSS.TRANSFORM.split(' '), function (key) { + css[key] = transform; + }); + + if (addTransition) { + transition = transition || "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important"; + css.transition = transition; + } + + return css; + }, + + /** + * Clone the Rect and calculate the height/width if needed. + * @param {DOMRect} source + * @param {DOMRect=} destination + * @returns {null|DOMRect} + */ + copyRect: function (source, destination) { + if (!source) return null; + + destination = destination || {}; + + angular.forEach('left top right bottom width height'.split(' '), function (key) { + destination[key] = Math.round(source[key]); + }); + + destination.width = destination.width || (destination.right - destination.left); + destination.height = destination.height || (destination.bottom - destination.top); + + return destination; + }, + + /** + * Calculate ClientRect of element; return null if hidden or zero size. + * @param {Element|string} element + * @returns {null|DOMRect} + */ + clientRect: function (element) { + var bounds = angular.element(element)[0].getBoundingClientRect(); + var isPositiveSizeClientRect = function (rect) { + return rect && (rect.width > 0) && (rect.height > 0); + }; + + // If the event origin element has zero size, it has probably been hidden. + return isPositiveSizeClientRect(bounds) ? self.copyRect(bounds) : null; + }, + + /** + * Calculate 'rounded' center point of Rect + * @param {DOMRect} targetRect + * @returns {{x: number, y: number}} + */ + centerPointFor: function (targetRect) { + return targetRect ? { + x: Math.round(targetRect.left + (targetRect.width / 2)), + y: Math.round(targetRect.top + (targetRect.height / 2)) + } : { x : 0, y : 0 }; + } + }; +} + + +})(); +(function(){ +"use strict"; + +if (angular.version.minor >= 4) { + angular.module('material.core.animate', []); +} else { +(function() { + "use strict"; + + var forEach = angular.forEach; + + var WEBKIT = angular.isDefined(document.documentElement.style.WebkitAppearance); + var TRANSITION_PROP = WEBKIT ? 'WebkitTransition' : 'transition'; + var ANIMATION_PROP = WEBKIT ? 'WebkitAnimation' : 'animation'; + var PREFIX = WEBKIT ? '-webkit-' : ''; + + var TRANSITION_EVENTS = (WEBKIT ? 'webkitTransitionEnd ' : '') + 'transitionend'; + var ANIMATION_EVENTS = (WEBKIT ? 'webkitAnimationEnd ' : '') + 'animationend'; + + var $$ForceReflowFactory = ['$document', function($document) { + return function() { + return $document[0].body.clientWidth + 1; + }; + }]; + + var $$rAFMutexFactory = ['$$rAF', function($$rAF) { + return function() { + var passed = false; + $$rAF(function() { + passed = true; + }); + return function(fn) { + passed ? fn() : $$rAF(fn); + }; + }; + }]; + + var $$AnimateRunnerFactory = ['$q', '$$rAFMutex', function($q, $$rAFMutex) { + var INITIAL_STATE = 0; + var DONE_PENDING_STATE = 1; + var DONE_COMPLETE_STATE = 2; + + function AnimateRunner(host) { + this.setHost(host); + + this._doneCallbacks = []; + this._runInAnimationFrame = $$rAFMutex(); + this._state = 0; + } + + AnimateRunner.prototype = { + setHost: function(host) { + this.host = host || {}; + }, + + done: function(fn) { + if (this._state === DONE_COMPLETE_STATE) { + fn(); + } else { + this._doneCallbacks.push(fn); + } + }, + + progress: angular.noop, + + getPromise: function() { + if (!this.promise) { + var self = this; + this.promise = $q(function(resolve, reject) { + self.done(function(status) { + status === false ? reject() : resolve(); + }); + }); + } + return this.promise; + }, + + then: function(resolveHandler, rejectHandler) { + return this.getPromise().then(resolveHandler, rejectHandler); + }, + + 'catch': function(handler) { + return this.getPromise()['catch'](handler); + }, + + 'finally': function(handler) { + return this.getPromise()['finally'](handler); + }, + + pause: function() { + if (this.host.pause) { + this.host.pause(); + } + }, + + resume: function() { + if (this.host.resume) { + this.host.resume(); + } + }, + + end: function() { + if (this.host.end) { + this.host.end(); + } + this._resolve(true); + }, + + cancel: function() { + if (this.host.cancel) { + this.host.cancel(); + } + this._resolve(false); + }, + + complete: function(response) { + var self = this; + if (self._state === INITIAL_STATE) { + self._state = DONE_PENDING_STATE; + self._runInAnimationFrame(function() { + self._resolve(response); + }); + } + }, + + _resolve: function(response) { + if (this._state !== DONE_COMPLETE_STATE) { + forEach(this._doneCallbacks, function(fn) { + fn(response); + }); + this._doneCallbacks.length = 0; + this._state = DONE_COMPLETE_STATE; + } + } + }; + + // Polyfill AnimateRunner.all which is used by input animations + AnimateRunner.all = function(runners, callback) { + var count = 0; + var status = true; + forEach(runners, function(runner) { + runner.done(onProgress); + }); + + function onProgress(response) { + status = status && response; + if (++count === runners.length) { + callback(status); + } + } + }; + + return AnimateRunner; + }]; + + angular + .module('material.core.animate', []) + .factory('$$forceReflow', $$ForceReflowFactory) + .factory('$$AnimateRunner', $$AnimateRunnerFactory) + .factory('$$rAFMutex', $$rAFMutexFactory) + .factory('$animateCss', ['$window', '$$rAF', '$$AnimateRunner', '$$forceReflow', '$$jqLite', '$timeout', '$animate', + function($window, $$rAF, $$AnimateRunner, $$forceReflow, $$jqLite, $timeout, $animate) { + + function init(element, options) { + + var temporaryStyles = []; + var node = getDomNode(element); + var areAnimationsAllowed = node && $animate.enabled(); + + var hasCompleteStyles = false; + var hasCompleteClasses = false; + + if (areAnimationsAllowed) { + if (options.transitionStyle) { + temporaryStyles.push([PREFIX + 'transition', options.transitionStyle]); + } + + if (options.keyframeStyle) { + temporaryStyles.push([PREFIX + 'animation', options.keyframeStyle]); + } + + if (options.delay) { + temporaryStyles.push([PREFIX + 'transition-delay', options.delay + 's']); + } + + if (options.duration) { + temporaryStyles.push([PREFIX + 'transition-duration', options.duration + 's']); + } + + hasCompleteStyles = options.keyframeStyle || + (options.to && (options.duration > 0 || options.transitionStyle)); + hasCompleteClasses = !!options.addClass || !!options.removeClass; + + blockTransition(element, true); + } + + var hasCompleteAnimation = areAnimationsAllowed && (hasCompleteStyles || hasCompleteClasses); + + applyAnimationFromStyles(element, options); + + var animationClosed = false; + var events, eventFn; + + return { + close: $window.close, + start: function() { + var runner = new $$AnimateRunner(); + waitUntilQuiet(function() { + blockTransition(element, false); + if (!hasCompleteAnimation) { + return close(); + } + + forEach(temporaryStyles, function(entry) { + var key = entry[0]; + var value = entry[1]; + node.style[camelCase(key)] = value; + }); + + applyClasses(element, options); + + var timings = computeTimings(element); + if (timings.duration === 0) { + return close(); + } + + var moreStyles = []; + + if (options.easing) { + if (timings.transitionDuration) { + moreStyles.push([PREFIX + 'transition-timing-function', options.easing]); + } + if (timings.animationDuration) { + moreStyles.push([PREFIX + 'animation-timing-function', options.easing]); + } + } + + if (options.delay && timings.animationDelay) { + moreStyles.push([PREFIX + 'animation-delay', options.delay + 's']); + } + + if (options.duration && timings.animationDuration) { + moreStyles.push([PREFIX + 'animation-duration', options.duration + 's']); + } + + forEach(moreStyles, function(entry) { + var key = entry[0]; + var value = entry[1]; + node.style[camelCase(key)] = value; + temporaryStyles.push(entry); + }); + + var maxDelay = timings.delay; + var maxDelayTime = maxDelay * 1000; + var maxDuration = timings.duration; + var maxDurationTime = maxDuration * 1000; + var startTime = Date.now(); + + events = []; + if (timings.transitionDuration) { + events.push(TRANSITION_EVENTS); + } + if (timings.animationDuration) { + events.push(ANIMATION_EVENTS); + } + events = events.join(' '); + eventFn = function(event) { + event.stopPropagation(); + var ev = event.originalEvent || event; + var timeStamp = ev.timeStamp || Date.now(); + var elapsedTime = parseFloat(ev.elapsedTime.toFixed(3)); + if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { + close(); + } + }; + element.on(events, eventFn); + + applyAnimationToStyles(element, options); + + $timeout(close, maxDelayTime + maxDurationTime * 1.5, false); + }); + + return runner; + + function close() { + if (animationClosed) return; + animationClosed = true; + + if (events && eventFn) { + element.off(events, eventFn); + } + applyClasses(element, options); + applyAnimationStyles(element, options); + forEach(temporaryStyles, function(entry) { + node.style[camelCase(entry[0])] = ''; + }); + runner.complete(true); + return runner; + } + } + }; + } + + function applyClasses(element, options) { + if (options.addClass) { + $$jqLite.addClass(element, options.addClass); + options.addClass = null; + } + if (options.removeClass) { + $$jqLite.removeClass(element, options.removeClass); + options.removeClass = null; + } + } + + function computeTimings(element) { + var node = getDomNode(element); + var cs = $window.getComputedStyle(node); + var tdr = parseMaxTime(cs[prop('transitionDuration')]); + var adr = parseMaxTime(cs[prop('animationDuration')]); + var tdy = parseMaxTime(cs[prop('transitionDelay')]); + var ady = parseMaxTime(cs[prop('animationDelay')]); + + adr *= (parseInt(cs[prop('animationIterationCount')], 10) || 1); + var duration = Math.max(adr, tdr); + var delay = Math.max(ady, tdy); + + return { + duration: duration, + delay: delay, + animationDuration: adr, + transitionDuration: tdr, + animationDelay: ady, + transitionDelay: tdy + }; + + function prop(key) { + return WEBKIT ? 'Webkit' + key.charAt(0).toUpperCase() + key.substr(1) + : key; + } + } + + function parseMaxTime(str) { + var maxValue = 0; + var values = (str || "").split(/\s*,\s*/); + forEach(values, function(value) { + // it's always safe to consider only second values and omit `ms` values since + // getComputedStyle will always handle the conversion for us + if (value.charAt(value.length - 1) == 's') { + value = value.substring(0, value.length - 1); + } + value = parseFloat(value) || 0; + maxValue = maxValue ? Math.max(value, maxValue) : value; + }); + return maxValue; + } + + var cancelLastRAFRequest; + var rafWaitQueue = []; + function waitUntilQuiet(callback) { + if (cancelLastRAFRequest) { + cancelLastRAFRequest(); // cancels the request + } + rafWaitQueue.push(callback); + cancelLastRAFRequest = $$rAF(function() { + cancelLastRAFRequest = null; + + // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable. + // PLEASE EXAMINE THE `$$forceReflow` service to understand why. + var pageWidth = $$forceReflow(); + + // we use a for loop to ensure that if the queue is changed + // during this looping then it will consider new requests + for (var i = 0; i < rafWaitQueue.length; i++) { + rafWaitQueue[i](pageWidth); + } + rafWaitQueue.length = 0; + }); + } + + function applyAnimationStyles(element, options) { + applyAnimationFromStyles(element, options); + applyAnimationToStyles(element, options); + } + + function applyAnimationFromStyles(element, options) { + if (options.from) { + element.css(options.from); + options.from = null; + } + } + + function applyAnimationToStyles(element, options) { + if (options.to) { + element.css(options.to); + options.to = null; + } + } + + function getDomNode(element) { + for (var i = 0; i < element.length; i++) { + if (element[i].nodeType === 1) return element[i]; + } + } + + function blockTransition(element, bool) { + var node = getDomNode(element); + var key = camelCase(PREFIX + 'transition-delay'); + node.style[key] = bool ? '-9999s' : ''; + } + + return init; + }]); + + /** + * Older browsers [FF31] expect camelCase + * property keys. + * e.g. + * animation-duration --> animationDuration + */ + function camelCase(str) { + return str.replace(/-[a-z]/g, function(str) { + return str.charAt(1).toUpperCase(); + }); + } + +})(); + +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.aria + * @description + * Aria Expectations for AngularJS Material components. + */ +MdAriaService.$inject = ["$$rAF", "$log", "$window", "$interpolate"]; +angular + .module('material.core') + .provider('$mdAria', MdAriaProvider); + +/** + * @ngdoc service + * @name $mdAriaProvider + * @module material.core.aria + * + * @description + * + * Modify options of the `$mdAria` service, which will be used by most of the AngularJS Material + * components. + * + * You are able to disable `$mdAria` warnings, by using the following markup. + * + * + * app.config(function($mdAriaProvider) { + * // Globally disables all ARIA warnings. + * $mdAriaProvider.disableWarnings(); + * }); + * + * + */ +function MdAriaProvider() { + + var config = { + /** Whether we should show ARIA warnings in the console if labels are missing on the element */ + showWarnings: true + }; + + return { + disableWarnings: disableWarnings, + $get: ["$$rAF", "$log", "$window", "$interpolate", function($$rAF, $log, $window, $interpolate) { + return MdAriaService.apply(config, arguments); + }] + }; + + /** + * @ngdoc method + * @name $mdAriaProvider#disableWarnings + * @description Disables all ARIA warnings generated by AngularJS Material. + */ + function disableWarnings() { + config.showWarnings = false; + } +} + +/* + * @ngInject + */ +function MdAriaService($$rAF, $log, $window, $interpolate) { + + // Load the showWarnings option from the current context and store it inside of a scope variable, + // because the context will be probably lost in some function calls. + var showWarnings = this.showWarnings; + + return { + expect: expect, + expectAsync: expectAsync, + expectWithText: expectWithText, + expectWithoutText: expectWithoutText, + getText: getText, + hasAriaLabel: hasAriaLabel, + parentHasAriaLabel: parentHasAriaLabel + }; + + /** + * Check if expected attribute has been specified on the target element or child + * @param {string|JQLite} element + * @param {string} attrName + * @param {string=} defaultValue What to set the attr to if no value is found + */ + function expect(element, attrName, defaultValue) { + + var node = angular.element(element)[0] || element; + + // if node exists and neither it nor its children have the attribute + if (node && + ((!node.hasAttribute(attrName) || + node.getAttribute(attrName).length === 0) && + !childHasAttribute(node, attrName))) { + + defaultValue = angular.isString(defaultValue) ? defaultValue.trim() : ''; + if (defaultValue.length) { + element.attr(attrName, defaultValue); + } else if (showWarnings) { + $log.warn('ARIA: Attribute "', attrName, '", required for accessibility, is missing on node:', node); + } + + } + } + + function expectAsync(element, attrName, defaultValueGetter) { + // Problem: when retrieving the element's contents synchronously to find the label, + // the text may not be defined yet in the case of a binding. + // There is a higher chance that a binding will be defined if we wait one frame. + $$rAF(function() { + expect(element, attrName, defaultValueGetter()); + }); + } + + function expectWithText(element, attrName) { + var content = getText(element) || ""; + var hasBinding = content.indexOf($interpolate.startSymbol()) > -1; + + if (hasBinding) { + expectAsync(element, attrName, function() { + return getText(element); + }); + } else { + expect(element, attrName, content); + } + } + + function expectWithoutText(element, attrName) { + var content = getText(element); + var hasBinding = content.indexOf($interpolate.startSymbol()) > -1; + + if (!hasBinding && !content) { + expect(element, attrName, content); + } + } + + /** + * @param {Element|JQLite} element + * @returns {string} + */ + function getText(element) { + element = element[0] || element; + var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT, null, false); + var text = ''; + + var node; + while (node = walker.nextNode()) { + if (!isAriaHiddenNode(node)) { + text += node.textContent; + } + } + + return text.trim() || ''; + + /** + * @param {Node} node + * @returns {boolean} + */ + function isAriaHiddenNode(node) { + while (node.parentNode && (node = node.parentNode) !== element) { + if (node.getAttribute && node.getAttribute('aria-hidden') === 'true') { + return true; + } + } + } + } + + function childHasAttribute(node, attrName) { + var hasChildren = node.hasChildNodes(), + hasAttr = false; + + function isHidden(el) { + var style = el.currentStyle ? el.currentStyle : $window.getComputedStyle(el); + return (style.display === 'none'); + } + + if (hasChildren) { + var children = node.childNodes; + for (var i=0; i < children.length; i++) { + var child = children[i]; + if (child.nodeType === 1 && child.hasAttribute(attrName)) { + if (!isHidden(child)) { + hasAttr = true; + } + } + } + } + return hasAttr; + } + + /** + * Check if expected element has aria label attribute + * @param element + */ + function hasAriaLabel(element) { + var node = angular.element(element)[0] || element; + + /* Check if compatible node type (ie: not HTML Document node) */ + if (!node.hasAttribute) { + return false; + } + + /* Check label or description attributes */ + return node.hasAttribute('aria-label') || node.hasAttribute('aria-labelledby') || node.hasAttribute('aria-describedby'); + } + + /** + * Check if expected element's parent has aria label attribute and has valid role and tagName + * @param {string|JQLite|Node & ParentNode} element + * @param {number=} level Number of levels deep search should be performed + */ + function parentHasAriaLabel(element, level) { + level = level || 1; + var node = angular.element(element)[0] || element; + if (!node.parentNode) { + return false; + } + if (performCheck(node.parentNode)) { + return true; + } + level--; + if (level) { + return parentHasAriaLabel(node.parentNode, level); + } + return false; + + function performCheck(parentNode) { + if (!hasAriaLabel(parentNode)) { + return false; + } + /* Perform role block-list check */ + if (parentNode.hasAttribute('role')) { + switch (parentNode.getAttribute('role').toLowerCase()) { + case 'command': + case 'definition': + case 'directory': + case 'grid': + case 'list': + case 'listitem': + case 'log': + case 'marquee': + case 'menu': + case 'menubar': + case 'note': + case 'presentation': + case 'separator': + case 'scrollbar': + case 'status': + case 'tablist': + return false; + } + } + /* Perform tagName block-list check */ + switch (parentNode.tagName.toLowerCase()) { + case 'abbr': + case 'acronym': + case 'address': + case 'applet': + case 'audio': + case 'b': + case 'bdi': + case 'bdo': + case 'big': + case 'blockquote': + case 'br': + case 'canvas': + case 'caption': + case 'center': + case 'cite': + case 'code': + case 'col': + case 'data': + case 'dd': + case 'del': + case 'dfn': + case 'dir': + case 'div': + case 'dl': + case 'em': + case 'embed': + case 'fieldset': + case 'figcaption': + case 'font': + case 'h1': + case 'h2': + case 'h3': + case 'h4': + case 'h5': + case 'h6': + case 'hgroup': + case 'html': + case 'i': + case 'ins': + case 'isindex': + case 'kbd': + case 'keygen': + case 'label': + case 'legend': + case 'li': + case 'map': + case 'mark': + case 'menu': + case 'object': + case 'ol': + case 'output': + case 'pre': + case 'presentation': + case 'q': + case 'rt': + case 'ruby': + case 'samp': + case 'small': + case 'source': + case 'span': + case 'status': + case 'strike': + case 'strong': + case 'sub': + case 'sup': + case 'svg': + case 'tbody': + case 'td': + case 'th': + case 'thead': + case 'time': + case 'tr': + case 'track': + case 'tt': + case 'ul': + case 'var': + return false; + } + return true; + } + } +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.compiler + * @description + * AngularJS Material template and element compiler. + */ +angular + .module('material.core') + .provider('$mdCompiler', MdCompilerProvider); + +MdCompilerProvider.$inject = ['$compileProvider']; +function MdCompilerProvider() { + + this.$get = ["$q", "$templateRequest", "$injector", "$compile", "$controller", + function($q, $templateRequest, $injector, $compile, $controller) { + return new MdCompilerService($q, $templateRequest, $injector, $compile, $controller); + }]; + + /** + * @ngdoc service + * @name $mdCompiler + * @module material.core.compiler + * @description + * The $mdCompiler service is an abstraction of AngularJS's compiler, that allows developers + * to compile an element with options like in a Directive Definition Object. + * + * > The compiler powers a lot of components inside of AngularJS Material. + * > Like the `$mdPanel` or `$mdDialog` services. + * + * @usage + * + * Basic Usage with a template + * + * + * $mdCompiler.compile({ + * templateUrl: 'modal.html', + * controller: 'ModalCtrl', + * locals: { + * modal: myModalInstance; + * } + * }).then(function (compileData) { + * compileData.element; // Compiled DOM element + * compileData.link(myScope); // Instantiate controller and link element to scope. + * }); + * + * + * Example with a content element + * + * + * + * // Create a virtual element and link it manually. + * // The compiler doesn't need to recompile the element each time. + * var myElement = $compile('Test')(myScope); + * + * $mdCompiler.compile({ + * contentElement: myElement + * }).then(function (compileData) { + * compileData.element // Content Element (same as above) + * compileData.link // This does nothing when using a contentElement. + * }); + * + * + * > Content Element is a significant performance improvement when the developer already knows + * > that the compiled element will be always the same and the scope will not change either. + * + * The `contentElement` option also supports DOM elements which will be temporary removed and + * restored at its old position. + * + * + * var domElement = document.querySelector('#myElement'); + * + * $mdCompiler.compile({ + * contentElement: myElement + * }).then(function (compileData) { + * compileData.element // Content Element (same as above) + * compileData.link // This does nothing when using a contentElement. + * }); + * + * + * The `$mdCompiler` can also query for the element in the DOM itself. + * + * + * $mdCompiler.compile({ + * contentElement: '#myElement' + * }).then(function (compileData) { + * compileData.element // Content Element (same as above) + * compileData.link // This does nothing when using a contentElement. + * }); + * + * + */ + function MdCompilerService($q, $templateRequest, $injector, $compile, $controller) { + + /** + * @private @const + * @type {!IQService} + */ + this.$q = $q; + + /** + * @private @const + * @type {!ITemplateRequestService} + */ + this.$templateRequest = $templateRequest; + + /** + * @private @const + * @type {!IInjectorService} + */ + this.$injector = $injector; + + /** + * @private @const + * @type{!ICompileService} + */ + this.$compile = $compile; + + /** + * @private @const + * @type {!IControllerService} + */ + this.$controller = $controller; + } + + /** + * @ngdoc method + * @name $mdCompiler#compile + * @description + * + * A method to compile a HTML template with the AngularJS compiler. + * The `$mdCompiler` is wrapper around the AngularJS compiler and provides extra functionality + * like controller instantiation or async resolves. + * + * @param {!Object} options An options object, with the following properties: + * + * - `controller` - `{string|function}` Controller fn that should be associated with + * newly created scope or the name of a registered controller if passed as a string. + * - `controllerAs` - `{string=}` A controller alias name. If present the controller will be + * published to scope under the `controllerAs` name. + * - `contentElement` - `{string|Element}`: Instead of using a template, which will be + * compiled each time, you can also use a DOM element.
    + * - `template` - `{string=}` An html template as a string. + * - `templateUrl` - `{string=}` A path to an html template. + * - `transformTemplate` - `{function(template)=}` A function which transforms the template after + * it is loaded. It will be given the template string as a parameter, and should + * return a a new string representing the transformed template. + * - `resolve` - `{Object.=}` - An optional map of dependencies which should + * be injected into the controller. If any of these dependencies are promises, the compiler + * will wait for them all to be resolved, or if one is rejected before the controller is + * instantiated `compile()` will fail.. + * * `key` - `{string}`: a name of a dependency to be injected into the controller. + * * `factory` - `{string|function}`: If `string` then it is an alias for a service. + * Otherwise if function, then it is injected and the return value is treated as the + * dependency. If the result is a promise, it is resolved before its value is + * injected into the controller. + * + * @returns {Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any, + * controller: Object=}>} promise A promise, which will be resolved with a `compileData` object. + * `compileData` has the following properties: + * + * - `element` - `{JQLite}`: an uncompiled element matching the provided template. + * - `link` - `{function(scope)}`: A link function, which, when called, will compile + * the element and instantiate the provided controller (if given). + * - `locals` - `{Object}`: The locals which will be passed into the controller once `link` is + * called. If `bindToController` is true, they will be copied to the ctrl instead + */ + MdCompilerService.prototype.compile = function(options) { + if (options.contentElement) { + return this._prepareContentElement(options); + } else { + return this._compileTemplate(options); + } + }; + + /** + * Instead of compiling any template, the compiler just fetches an existing HTML element from the + * DOM and provides a restore function to put the element back it old DOM position. + * @param {!Object} options Options to be used for the compiler. + * @returns {Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any}>} + */ + MdCompilerService.prototype._prepareContentElement = function(options) { + + var contentElement = this._fetchContentElement(options); + + return this.$q.resolve({ + element: contentElement.element, + cleanup: contentElement.restore, + locals: {}, + link: function() { + return contentElement.element; + } + }); + + }; + + /** + * Compiles a template by considering all options and waiting for all resolves to be ready. + * @param {!Object} options Compile options + * @returns {!Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any}>} Compile + * data with link function. + */ + MdCompilerService.prototype._compileTemplate = function(options) { + + var self = this; + var templateUrl = options.templateUrl; + var template = options.template || ''; + var resolve = angular.extend({}, options.resolve); + var locals = angular.extend({}, options.locals); + var transformTemplate = options.transformTemplate || angular.identity; + + // Take resolve values and invoke them. + // Resolves can either be a string (value: 'MyRegisteredAngularConst'), + // or an invokable 'factory' of sorts: (value: function ValueGetter($dependency) {}) + angular.forEach(resolve, function(value, key) { + if (angular.isString(value)) { + resolve[key] = self.$injector.get(value); + } else { + resolve[key] = self.$injector.invoke(value); + } + }); + + // Add the locals, which are just straight values to inject + // eg locals: { three: 3 }, will inject three into the controller + angular.extend(resolve, locals); + + if (templateUrl) { + resolve.$$ngTemplate = this.$templateRequest(templateUrl); + } else { + resolve.$$ngTemplate = this.$q.when(template); + } + + + // Wait for all the resolves to finish if they are promises + return this.$q.all(resolve).then(function(locals) { + + var template = transformTemplate(locals.$$ngTemplate, options); + var element = options.element || angular.element('
    ').html(template.trim()).contents(); + + return self._compileElement(locals, element, options); + }); + + }; + + /** + * Method to compile an element with the given options. + * @param {!Object} locals Locals to be injected to the controller if present + * @param {!JQLite} element Element to be compiled and linked + * @param {!Object} options Options to be used for linking. + * @returns {!{element: JQLite, link: Function, locals: Object, cleanup: any, controller: Object}} Compile data with link function. + */ + MdCompilerService.prototype._compileElement = function(locals, element, options) { + var self = this; + var ngLinkFn = this.$compile(element); + + var compileData = { + element: element, + cleanup: element.remove.bind(element), + locals: locals, + link: linkFn + }; + + function linkFn(scope) { + locals.$scope = scope; + + // Instantiate controller if the developer provided one. + if (options.controller) { + + var injectLocals = angular.extend({}, locals, { + $element: element + }); + + // Create the specified controller instance. + var ctrl = self._createController(options, injectLocals, locals); + + // Registering extra $destroy listeners should be avoided. + // Only register the listener if the controller implements a $onDestroy hook. + if (angular.isFunction(ctrl.$onDestroy)) { + scope.$on('$destroy', function() { + // Call the $onDestroy hook if it's present on the controller. + angular.isFunction(ctrl.$onDestroy) && ctrl.$onDestroy(); + }); + } + + // Unique identifier for AngularJS Route ngView controllers. + element.data('$ngControllerController', ctrl); + element.children().data('$ngControllerController', ctrl); + + // Expose the instantiated controller to the compile data + compileData.controller = ctrl; + } + + // Invoke the AngularJS $compile link function. + return ngLinkFn(scope); + } + + return compileData; + + }; + + /** + * Creates and instantiates a new controller with the specified options. + * @param {!Object} options Options that include the controller function or string. + * @param {!Object} injectLocals Locals to to be provided in the controller DI. + * @param {!Object} locals Locals to be injected to the controller. + * @returns {!Object} Created controller instance. + */ + MdCompilerService.prototype._createController = function(options, injectLocals, locals) { + var ctrl = this.$controller(options.controller, injectLocals); + + if (options.bindToController) { + angular.extend(ctrl, locals); + } + + if (options.controllerAs) { + injectLocals.$scope[options.controllerAs] = ctrl; + } + + // Call the $onInit hook if it's present on the controller. + angular.isFunction(ctrl.$onInit) && ctrl.$onInit(); + + return ctrl; + }; + + /** + * Fetches an element removing it from the DOM and using it temporary for the compiler. + * Elements which were fetched will be restored after use. + * @param {!Object} options Options to be used for the compilation. + * @returns {{element: !JQLite, restore: !function}} + */ + MdCompilerService.prototype._fetchContentElement = function(options) { + var contentEl = options.contentElement; + var restoreFn; + + if (angular.isString(contentEl)) { + contentEl = document.querySelector(contentEl); + restoreFn = createRestoreFn(contentEl); + } else { + contentEl = contentEl[0] || contentEl; + + // When the element is visible in the DOM, then we restore it at close of the dialog. + // Otherwise it will be removed from the DOM after close. + if (document.contains(contentEl)) { + restoreFn = createRestoreFn(contentEl); + } else { + restoreFn = function() { + if (contentEl.parentNode) { + contentEl.parentNode.removeChild(contentEl); + } + }; + } + } + + return { + element: angular.element(contentEl), + restore: restoreFn + }; + + function createRestoreFn(element) { + var parent = element.parentNode; + var nextSibling = element.nextElementSibling; + + return function() { + if (!nextSibling) { + // When the element didn't had any sibling, then it can be simply appended to the + // parent, because it plays no role, which index it had before. + parent.appendChild(element); + } else { + // When the element had a sibling, which marks the previous position of the element + // in the DOM, we insert it correctly before the sibling, to have the same index as + // before. + parent.insertBefore(element, nextSibling); + } + }; + } + }; +} + + +})(); +(function(){ +"use strict"; + + +MdGesture.$inject = ["$$MdGestureHandler", "$$rAF", "$timeout", "$mdUtil"]; +attachToDocument.$inject = ["$mdGesture", "$$MdGestureHandler", "$mdUtil"];var HANDLERS = {}; + +/** + * The state of the current 'pointer'. The pointer represents the state of the current touch. + * It contains normalized x and y coordinates from DOM events, + * as well as other information abstracted from the DOM. + */ +var pointer, lastPointer, maxClickDistance = 6; +var forceSkipClickHijack = false, disableAllGestures = false; + +/** + * The position of the most recent click if that click was on a label element. + * @type {{x: number, y: number}|null} + */ +var lastLabelClickPos = null; + +/** + * Used to attach event listeners once when multiple ng-apps are running. + * @type {boolean} + */ +var isInitialized = false; + +/** + * @ngdoc module + * @name material.core.gestures + * @description + * AngularJS Material Gesture handling for touch devices. + * This module replaced the usage of the HammerJS library. + */ +angular + .module('material.core.gestures', []) + .provider('$mdGesture', MdGestureProvider) + .factory('$$MdGestureHandler', MdGestureHandler) + .run(attachToDocument); + +/** + * @ngdoc service + * @name $mdGestureProvider + * @module material.core.gestures + * + * @description + * In some scenarios on mobile devices (without jQuery), the click events should NOT be hijacked. + * `$mdGestureProvider` is used to configure the Gesture module to ignore or skip click hijacking + * on mobile devices. + * + * You can also change the max click distance, `6px` by default, if you have issues on some touch + * screens. + * + * + * app.config(function($mdGestureProvider) { + * + * // For mobile devices without jQuery loaded, do not + * // intercept click events during the capture phase. + * $mdGestureProvider.skipClickHijack(); + * + * // If hijacking clicks, you may want to change the default click distance + * $mdGestureProvider.setMaxClickDistance(12); + * }); + * + * + */ +function MdGestureProvider() { } + +MdGestureProvider.prototype = { + + /** + * @ngdoc method + * @name $mdGestureProvider#disableAll + * + * @description + * Disable all gesture detection. This can be beneficial to application performance + * and memory usage. + */ + disableAll: function () { + disableAllGestures = true; + }, + + // Publish access to setter to configure a variable BEFORE the + // $mdGesture service is instantiated... + /** + * @ngdoc method + * @name $mdGestureProvider#skipClickHijack + * + * @description + * Tell the AngularJS Material Gesture module to skip (or ignore) click hijacking on mobile devices. + */ + skipClickHijack: function() { + return forceSkipClickHijack = true; + }, + + /** + * @ngdoc method + * @name $mdGestureProvider#setMaxClickDistance + * @param clickDistance {string} Distance in pixels. I.e. `12px`. + * @description + * Set the max distance from the origin of the touch event to trigger touch handlers. + */ + setMaxClickDistance: function(clickDistance) { + maxClickDistance = parseInt(clickDistance); + }, + + /** + * $get is used to build an instance of $mdGesture + * @ngInject + */ + $get : ["$$MdGestureHandler", "$$rAF", "$timeout", "$mdUtil", function($$MdGestureHandler, $$rAF, $timeout, $mdUtil) { + return new MdGesture($$MdGestureHandler, $$rAF, $timeout, $mdUtil); + }] +}; + + + +/** + * MdGesture factory construction function + * @ngInject + */ +function MdGesture($$MdGestureHandler, $$rAF, $timeout, $mdUtil) { + var touchActionProperty = $mdUtil.getTouchAction(); + var hasJQuery = (typeof __webpack_provided_window_dot_jQuery !== 'undefined') && (angular.element === __webpack_provided_window_dot_jQuery); + + var self = { + handler: addHandler, + register: register, + isAndroid: $mdUtil.isAndroid, + isIos: $mdUtil.isIos, + // On mobile w/out jQuery, we normally intercept clicks. Should we skip that? + isHijackingClicks: ($mdUtil.isIos || $mdUtil.isAndroid) && !hasJQuery && !forceSkipClickHijack + }; + + if (self.isHijackingClicks) { + self.handler('click', { + options: { + maxDistance: maxClickDistance + }, + onEnd: checkDistanceAndEmit('click') + }); + + self.handler('focus', { + options: { + maxDistance: maxClickDistance + }, + onEnd: function(ev, pointer) { + if (pointer.distance < this.state.options.maxDistance && canFocus(ev.target)) { + this.dispatchEvent(ev, 'focus', pointer); + ev.target.focus(); + } + } + }); + + self.handler('mouseup', { + options: { + maxDistance: maxClickDistance + }, + onEnd: checkDistanceAndEmit('mouseup') + }); + + self.handler('mousedown', { + onStart: function(ev) { + this.dispatchEvent(ev, 'mousedown'); + } + }); + } + + function checkDistanceAndEmit(eventName) { + return function(ev, pointer) { + if (pointer.distance < this.state.options.maxDistance) { + this.dispatchEvent(ev, eventName, pointer); + } + }; + } + + /** + * Register an element to listen for a handler. + * This allows an element to override the default options for a handler. + * Additionally, some handlers like drag and hold only dispatch events if + * the domEvent happens inside an element that's registered to listen for these events. + * + * @see GestureHandler for how overriding of default options works. + * @example $mdGesture.register(myElement, 'drag', { minDistance: 20, horizontal: false }) + */ + function register(element, handlerName, options) { + var handler = HANDLERS[handlerName.replace(/^\$md./, '')]; + if (!handler) { + throw new Error('Failed to register element with handler ' + handlerName + '. ' + + 'Available handlers: ' + Object.keys(HANDLERS).join(', ')); + } + return handler.registerElement(element, options); + } + + /* + * add a handler to $mdGesture. see below. + */ + function addHandler(name, definition) { + var handler = new $$MdGestureHandler(name); + angular.extend(handler, definition); + HANDLERS[name] = handler; + + return self; + } + + /** + * Register handlers. These listen to touch/start/move events, interpret them, + * and dispatch gesture events depending on options & conditions. These are all + * instances of GestureHandler. + * @see GestureHandler + */ + return self + /* + * The press handler dispatches an event on touchdown/touchend. + * It's a simple abstraction of touch/mouse/pointer start and end. + */ + .handler('press', { + onStart: function (ev, pointer) { + this.dispatchEvent(ev, '$md.pressdown'); + }, + onEnd: function (ev, pointer) { + this.dispatchEvent(ev, '$md.pressup'); + } + }) + + /* + * The hold handler dispatches an event if the user keeps their finger within + * the same area for ms. + * The hold handler will only run if a parent of the touch target is registered + * to listen for hold events through $mdGesture.register() + */ + .handler('hold', { + options: { + maxDistance: 6, + delay: 500 + }, + onCancel: function () { + $timeout.cancel(this.state.timeout); + }, + onStart: function (ev, pointer) { + // For hold, require a parent to be registered with $mdGesture.register() + // Because we prevent scroll events, this is necessary. + if (!this.state.registeredParent) return this.cancel(); + + this.state.pos = {x: pointer.x, y: pointer.y}; + this.state.timeout = $timeout(angular.bind(this, function holdDelayFn() { + this.dispatchEvent(ev, '$md.hold'); + this.cancel(); // we're done! + }), this.state.options.delay, false); + }, + onMove: function (ev, pointer) { + // Don't scroll while waiting for hold. + // If we don't preventDefault touchmove events here, Android will assume we don't + // want to listen to anymore touch events. It will start scrolling and stop sending + // touchmove events. + if (!touchActionProperty && ev.type === 'touchmove') ev.preventDefault(); + + // If the user moves greater than pixels, stop the hold timer + // set in onStart + var dx = this.state.pos.x - pointer.x; + var dy = this.state.pos.y - pointer.y; + if (Math.sqrt(dx * dx + dy * dy) > this.options.maxDistance) { + this.cancel(); + } + }, + onEnd: function () { + this.onCancel(); + } + }) + + /* + * The drag handler dispatches a drag event if the user holds and moves his finger greater than + * px in the x or y direction, depending on options.horizontal. + * The drag will be cancelled if the user moves his finger greater than * in + * the perpendicular direction. Eg if the drag is horizontal and the user moves his finger * + * pixels vertically, this handler won't consider the move part of a drag. + */ + .handler('drag', { + options: { + minDistance: 6, + horizontal: true, + cancelMultiplier: 1.5 + }, + /** + * @param {angular.JQLite} element where touch action styles need to be adjusted + * @param {{horizontal: boolean}=} options object whose horizontal property can specify to + * apply 'pan-y' or 'pan-x' touch actions. + */ + onSetup: function(element, options) { + if (touchActionProperty) { + // We check for horizontal to be false, because otherwise we would overwrite the default opts. + this.oldTouchAction = element[0].style[touchActionProperty]; + element[0].style[touchActionProperty] = options.horizontal ? 'pan-y' : 'pan-x'; + } + }, + /** + * @param {angular.JQLite} element where styles need to be cleaned up + */ + onCleanup: function(element) { + if (this.oldTouchAction) { + element[0].style[touchActionProperty] = this.oldTouchAction; + } else { + element[0].style[touchActionProperty] = null; + } + }, + onStart: function (ev) { + // For drag, require a parent to be registered with $mdGesture.register() + if (!this.state.registeredParent) this.cancel(); + }, + onMove: function (ev, pointer) { + var shouldStartDrag, shouldCancel; + // Don't scroll while deciding if this touchmove qualifies as a drag event. + // If we don't preventDefault touchmove events here, Android will assume we don't + // want to listen to anymore touch events. It will start scrolling and stop sending + // touchmove events. + if (!touchActionProperty && ev.type === 'touchmove') ev.preventDefault(); + + if (!this.state.dragPointer) { + if (this.state.options.horizontal) { + shouldStartDrag = Math.abs(pointer.distanceX) > this.state.options.minDistance; + shouldCancel = Math.abs(pointer.distanceY) > this.state.options.minDistance * this.state.options.cancelMultiplier; + } else { + shouldStartDrag = Math.abs(pointer.distanceY) > this.state.options.minDistance; + shouldCancel = Math.abs(pointer.distanceX) > this.state.options.minDistance * this.state.options.cancelMultiplier; + } + + if (shouldStartDrag) { + // Create a new pointer representing this drag, starting at this point where the drag started. + this.state.dragPointer = makeStartPointer(ev); + updatePointerState(ev, this.state.dragPointer); + this.dispatchEvent(ev, '$md.dragstart', this.state.dragPointer); + + } else if (shouldCancel) { + this.cancel(); + } + } else { + this.dispatchDragMove(ev); + } + }, + // Only dispatch dragmove events every frame; any more is unnecessary + dispatchDragMove: $$rAF.throttle(function (ev) { + // Make sure the drag didn't stop while waiting for the next frame + if (this.state.isRunning) { + updatePointerState(ev, this.state.dragPointer); + this.dispatchEvent(ev, '$md.drag', this.state.dragPointer); + } + }), + onEnd: function (ev, pointer) { + if (this.state.dragPointer) { + updatePointerState(ev, this.state.dragPointer); + this.dispatchEvent(ev, '$md.dragend', this.state.dragPointer); + } + } + }) + + /* + * The swipe handler will dispatch a swipe event if, on the end of a touch, + * the velocity and distance were high enough. + */ + .handler('swipe', { + options: { + minVelocity: 0.65, + minDistance: 10 + }, + onEnd: function (ev, pointer) { + var eventType; + + if (Math.abs(pointer.velocityX) > this.state.options.minVelocity && + Math.abs(pointer.distanceX) > this.state.options.minDistance) { + eventType = pointer.directionX == 'left' ? '$md.swipeleft' : '$md.swiperight'; + this.dispatchEvent(ev, eventType); + } + else if (Math.abs(pointer.velocityY) > this.state.options.minVelocity && + Math.abs(pointer.distanceY) > this.state.options.minDistance) { + eventType = pointer.directionY == 'up' ? '$md.swipeup' : '$md.swipedown'; + this.dispatchEvent(ev, eventType); + } + } + }); +} + +/** + * MdGestureHandler + * A GestureHandler is an object which is able to dispatch custom dom events + * based on native dom {touch,pointer,mouse}{start,move,end} events. + * + * A gesture will manage its lifecycle through the start,move,end, and cancel + * functions, which are called by native dom events. + * + * A gesture has the concept of 'options' (eg. a swipe's required velocity), which can be + * overridden by elements registering through $mdGesture.register(). + */ +function GestureHandler (name) { + this.name = name; + this.state = {}; +} + +function MdGestureHandler() { + var hasJQuery = (typeof __webpack_provided_window_dot_jQuery !== 'undefined') && (angular.element === __webpack_provided_window_dot_jQuery); + + GestureHandler.prototype = { + options: {}, + // jQuery listeners don't work with custom DOMEvents, so we have to dispatch events + // differently when jQuery is loaded + dispatchEvent: hasJQuery ? jQueryDispatchEvent : nativeDispatchEvent, + + // These are overridden by the registered handler + onSetup: angular.noop, + onCleanup: angular.noop, + onStart: angular.noop, + onMove: angular.noop, + onEnd: angular.noop, + onCancel: angular.noop, + + // onStart sets up a new state for the handler, which includes options from the + // nearest registered parent element of ev.target. + start: function (ev, pointer) { + if (this.state.isRunning) return; + var parentTarget = this.getNearestParent(ev.target); + // Get the options from the nearest registered parent + var parentTargetOptions = parentTarget && parentTarget.$mdGesture[this.name] || {}; + + this.state = { + isRunning: true, + // Override the default options with the nearest registered parent's options + options: angular.extend({}, this.options, parentTargetOptions), + // Pass in the registered parent node to the state so the onStart listener can use + registeredParent: parentTarget + }; + this.onStart(ev, pointer); + }, + move: function (ev, pointer) { + if (!this.state.isRunning) return; + this.onMove(ev, pointer); + }, + end: function (ev, pointer) { + if (!this.state.isRunning) return; + this.state.isRunning = false; + this.onEnd(ev, pointer); + }, + cancel: function (ev, pointer) { + this.onCancel(ev, pointer); + this.state = {}; + }, + + // Find and return the nearest parent element that has been registered to + // listen for this handler via $mdGesture.register(element, 'handlerName'). + getNearestParent: function (node) { + var current = node; + while (current) { + if ((current.$mdGesture || {})[this.name]) { + return current; + } + current = current.parentNode; + } + return null; + }, + + // Called from $mdGesture.register when an element registers itself with a handler. + // Store the options the user gave on the DOMElement itself. These options will + // be retrieved with getNearestParent when the handler starts. + registerElement: function (element, options) { + var self = this; + element[0].$mdGesture = element[0].$mdGesture || {}; + element[0].$mdGesture[this.name] = options || {}; + element.on('$destroy', onDestroy); + + self.onSetup(element, options || {}); + + return onDestroy; + + function onDestroy() { + delete element[0].$mdGesture[self.name]; + element.off('$destroy', onDestroy); + + self.onCleanup(element, options || {}); + } + } + }; + + return GestureHandler; + + /** + * Dispatch an event with jQuery + * TODO: Make sure this sends bubbling events + * + * @param srcEvent the original DOM touch event that started this. + * @param eventType the name of the custom event to send (eg 'click' or '$md.drag') + * @param eventPointer the pointer object that matches this event. + */ + function jQueryDispatchEvent(srcEvent, eventType, eventPointer) { + eventPointer = eventPointer || pointer; + var eventObj = new angular.element.Event(eventType); + + eventObj.$material = true; + eventObj.pointer = eventPointer; + eventObj.srcEvent = srcEvent; + + angular.extend(eventObj, { + clientX: eventPointer.x, + clientY: eventPointer.y, + screenX: eventPointer.x, + screenY: eventPointer.y, + pageX: eventPointer.x, + pageY: eventPointer.y, + ctrlKey: srcEvent.ctrlKey, + altKey: srcEvent.altKey, + shiftKey: srcEvent.shiftKey, + metaKey: srcEvent.metaKey + }); + angular.element(eventPointer.target).trigger(eventObj); + } + + /** + * NOTE: nativeDispatchEvent is very performance sensitive. + * @param srcEvent the original DOM touch event that started this. + * @param eventType the name of the custom event to send (eg 'click' or '$md.drag') + * @param eventPointer the pointer object that matches this event. + */ + function nativeDispatchEvent(srcEvent, eventType, eventPointer) { + eventPointer = eventPointer || pointer; + var eventObj; + + if (eventType === 'click' || eventType === 'mouseup' || eventType === 'mousedown') { + if (typeof window.MouseEvent === "function") { + eventObj = new MouseEvent(eventType, { + bubbles: true, + cancelable: true, + screenX: Number(srcEvent.screenX), + screenY: Number(srcEvent.screenY), + clientX: Number(eventPointer.x), + clientY: Number(eventPointer.y), + ctrlKey: srcEvent.ctrlKey, + altKey: srcEvent.altKey, + shiftKey: srcEvent.shiftKey, + metaKey: srcEvent.metaKey, + button: srcEvent.button, + buttons: srcEvent.buttons, + relatedTarget: srcEvent.relatedTarget || null + }); + } else { + eventObj = document.createEvent('MouseEvents'); + // This has been deprecated + // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent + eventObj.initMouseEvent( + eventType, true, true, window, srcEvent.detail, + eventPointer.x, eventPointer.y, eventPointer.x, eventPointer.y, + srcEvent.ctrlKey, srcEvent.altKey, srcEvent.shiftKey, srcEvent.metaKey, + srcEvent.button, srcEvent.relatedTarget || null + ); + } + } else { + if (typeof window.CustomEvent === "function") { + eventObj = new CustomEvent(eventType, { + bubbles: true, + cancelable: true, + detail: {} + }); + } else { + // This has been deprecated + // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/initCustomEvent + eventObj = document.createEvent('CustomEvent'); + eventObj.initCustomEvent(eventType, true, true, {}); + } + } + eventObj.$material = true; + eventObj.pointer = eventPointer; + eventObj.srcEvent = srcEvent; + eventPointer.target.dispatchEvent(eventObj); + } +} + +/** + * Attach Gestures: hook document and check shouldHijack clicks + * @ngInject + */ +function attachToDocument($mdGesture, $$MdGestureHandler, $mdUtil) { + if (disableAllGestures) { + return; + } + + if (!isInitialized && $mdGesture.isHijackingClicks) { + /* + * If hijack clicks is true, we preventDefault any click that wasn't + * sent by AngularJS Material. This is because on older Android & iOS, a false, or 'ghost', + * click event will be sent ~400ms after a touchend event happens. + * The only way to know if this click is real is to prevent any normal + * click events, and add a flag to events sent by material so we know not to prevent those. + * + * Two exceptions to click events that should be prevented are: + * - click events sent by the keyboard (eg form submit) + * - events that originate from an Ionic app + */ + document.addEventListener('click' , clickHijacker , true); + document.addEventListener('mouseup' , mouseInputHijacker, true); + document.addEventListener('mousedown', mouseInputHijacker, true); + document.addEventListener('focus' , mouseInputHijacker, true); + + isInitialized = true; + } + + function mouseInputHijacker(ev) { + var isKeyClick = !ev.clientX && !ev.clientY; + + if ( + !isKeyClick && + !ev.$material && + !ev.isIonicTap && + !isInputEventFromLabelClick(ev) && + (ev.type !== 'mousedown' || (!canFocus(ev.target) && !canFocus(document.activeElement))) + ) { + ev.preventDefault(); + ev.stopPropagation(); + } + } + + /** + * Ignore click events that don't come from AngularJS Material, Ionic, Input Label clicks, + * or key presses that generate click events. This helps to ignore the ghost tap events on + * older mobile browsers that get sent after a 300-400ms delay. + * @param ev MouseEvent or modified MouseEvent with $material, pointer, and other fields + */ + function clickHijacker(ev) { + var isKeyClick; + if ($mdUtil.isIos) { + isKeyClick = angular.isDefined(ev.webkitForce) && ev.webkitForce === 0; + } else { + isKeyClick = ev.clientX === 0 && ev.clientY === 0; + } + if (!isKeyClick && !ev.$material && !ev.isIonicTap && !isInputEventFromLabelClick(ev)) { + ev.preventDefault(); + ev.stopPropagation(); + lastLabelClickPos = null; + } else { + lastLabelClickPos = null; + if (ev.target.tagName.toLowerCase() === 'label') { + lastLabelClickPos = {x: ev.x, y: ev.y}; + } + } + } + + + // Listen to all events to cover all platforms. + var START_EVENTS = 'mousedown touchstart pointerdown'; + var MOVE_EVENTS = 'mousemove touchmove pointermove'; + var END_EVENTS = 'mouseup mouseleave touchend touchcancel pointerup pointercancel'; + + angular.element(document) + .on(START_EVENTS, gestureStart) + .on(MOVE_EVENTS, gestureMove) + .on(END_EVENTS, gestureEnd) + // For testing + .on('$$mdGestureReset', function gestureClearCache () { + lastPointer = pointer = null; + }); + + /** + * When a DOM event happens, run all registered gesture handlers' lifecycle + * methods which match the DOM event. + * Eg. when a 'touchstart' event happens, runHandlers('start') will call and + * run `handler.cancel()` and `handler.start()` on all registered handlers. + */ + function runHandlers(handlerEvent, event) { + var handler; + for (var name in HANDLERS) { + handler = HANDLERS[name]; + if (handler instanceof $$MdGestureHandler) { + + if (handlerEvent === 'start') { + // Run cancel to reset any handlers' state + handler.cancel(); + } + handler[handlerEvent](event, pointer); + } + } + } + + /* + * gestureStart vets if a start event is legitimate (and not part of a 'ghost click' from iOS/Android) + * If it is legitimate, we initiate the pointer state and mark the current pointer's type + * For example, for a touchstart event, mark the current pointer as a 'touch' pointer, so mouse events + * won't effect it. + */ + function gestureStart(ev) { + // If we're already touched down, abort + if (pointer) return; + + var now = +Date.now(); + + // iOS & old android bug: after a touch event, a click event is sent 350 ms later. + // If <400ms have passed, don't allow an event of a different type than the previous event + if (lastPointer && !typesMatch(ev, lastPointer) && (now - lastPointer.endTime < 1500)) { + return; + } + + pointer = makeStartPointer(ev); + + runHandlers('start', ev); + } + + /** + * If a move event happens of the right type, update the pointer and run all the move handlers. + * "of the right type": if a mousemove happens but our pointer started with a touch event, do + * nothing. + */ + function gestureMove(ev) { + if (!pointer || !typesMatch(ev, pointer)) return; + + updatePointerState(ev, pointer); + runHandlers('move', ev); + } + + /** + * If an end event happens of the right type, update the pointer, run endHandlers, and save the + * pointer as 'lastPointer'. + */ + function gestureEnd(ev) { + if (!pointer || !typesMatch(ev, pointer)) return; + + updatePointerState(ev, pointer); + pointer.endTime = +Date.now(); + + if (ev.type !== 'pointercancel') { + runHandlers('end', ev); + } + + lastPointer = pointer; + pointer = null; + } + +} + +// ******************** +// Module Functions +// ******************** + +/* + * Initiate the pointer. x, y, and the pointer's type. + */ +function makeStartPointer(ev) { + var point = getEventPoint(ev); + var startPointer = { + startTime: +Date.now(), + target: ev.target, + // 'p' for pointer events, 'm' for mouse, 't' for touch + type: ev.type.charAt(0) + }; + startPointer.startX = startPointer.x = point.pageX; + startPointer.startY = startPointer.y = point.pageY; + return startPointer; +} + +/* + * return whether the pointer's type matches the event's type. + * Eg if a touch event happens but the pointer has a mouse type, return false. + */ +function typesMatch(ev, pointer) { + return ev && pointer && ev.type.charAt(0) === pointer.type; +} + +/** + * Gets whether the given event is an input event that was caused by clicking on an + * associated label element. + * + * This is necessary because the browser will, upon clicking on a label element, fire an + * *extra* click event on its associated input (if any). mdGesture is able to flag the label + * click as with `$material` correctly, but not the second input click. + * + * In order to determine whether an input event is from a label click, we compare the (x, y) for + * the event to the (x, y) for the most recent label click (which is cleared whenever a non-label + * click occurs). Unfortunately, there are no event properties that tie the input and the label + * together (such as relatedTarget). + * + * @param {MouseEvent} event + * @returns {boolean} + */ +function isInputEventFromLabelClick(event) { + return lastLabelClickPos + && lastLabelClickPos.x === event.x + && lastLabelClickPos.y === event.y; +} + +/* + * Update the given pointer based upon the given DOMEvent. + * Distance, velocity, direction, duration, etc + */ +function updatePointerState(ev, pointer) { + var point = getEventPoint(ev); + var x = pointer.x = point.pageX; + var y = pointer.y = point.pageY; + + pointer.distanceX = x - pointer.startX; + pointer.distanceY = y - pointer.startY; + pointer.distance = Math.sqrt( + pointer.distanceX * pointer.distanceX + pointer.distanceY * pointer.distanceY + ); + + pointer.directionX = pointer.distanceX > 0 ? 'right' : pointer.distanceX < 0 ? 'left' : ''; + pointer.directionY = pointer.distanceY > 0 ? 'down' : pointer.distanceY < 0 ? 'up' : ''; + + pointer.duration = +Date.now() - pointer.startTime; + pointer.velocityX = pointer.distanceX / pointer.duration; + pointer.velocityY = pointer.distanceY / pointer.duration; +} + +/** + * Normalize the point where the DOM event happened whether it's touch or mouse. + * @returns point event obj with pageX and pageY on it. + */ +function getEventPoint(ev) { + ev = ev.originalEvent || ev; // support jQuery events + return (ev.touches && ev.touches[0]) || + (ev.changedTouches && ev.changedTouches[0]) || + ev; +} + +/** Checks whether an element can be focused. */ +function canFocus(element) { + return ( + !!element && + element.getAttribute('tabindex') !== '-1' && + !element.hasAttribute('disabled') && + ( + element.hasAttribute('tabindex') || + element.hasAttribute('href') || + element.isContentEditable || + ['INPUT', 'SELECT', 'BUTTON', 'TEXTAREA', 'VIDEO', 'AUDIO'].indexOf(element.nodeName) !== -1 + ) + ); +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.interaction + * @description + * User interaction detection to provide proper accessibility. + */ +MdInteractionService.$inject = ["$timeout", "$mdUtil", "$rootScope"]; +angular + .module('material.core.interaction', []) + .service('$mdInteraction', MdInteractionService); + + +/** + * @ngdoc service + * @name $mdInteraction + * @module material.core.interaction + * + * @description + * + * Service which keeps track of the last interaction type and validates them for several browsers. + * The service hooks into the document's body and listens for touch, mouse and keyboard events. + * + * The most recent interaction type can be retrieved by calling the `getLastInteractionType` method. + * + * Here is an example markup for using the interaction service. + * + * + * var lastType = $mdInteraction.getLastInteractionType(); + * + * if (lastType === 'keyboard') { + * // We only restore the focus for keyboard users. + * restoreFocus(); + * } + * + * + */ +function MdInteractionService($timeout, $mdUtil, $rootScope) { + this.$timeout = $timeout; + this.$mdUtil = $mdUtil; + this.$rootScope = $rootScope; + + // IE browsers can also trigger pointer events, which also leads to an interaction. + this.pointerEvent = 'MSPointerEvent' in window ? 'MSPointerDown' : 'PointerEvent' in window ? 'pointerdown' : null; + this.bodyElement = angular.element(document.body); + this.isBuffering = false; + this.bufferTimeout = null; + this.lastInteractionType = null; + this.lastInteractionTime = null; + this.inputHandler = this.onInputEvent.bind(this); + this.bufferedInputHandler = this.onBufferInputEvent.bind(this); + + // Type Mappings for the different events + // There will be three three interaction types + // `keyboard`, `mouse` and `touch` + // type `pointer` will be evaluated in `pointerMap` for IE Browser events + this.inputEventMap = { + 'keydown': 'keyboard', + 'mousedown': 'mouse', + 'mouseenter': 'mouse', + 'touchstart': 'touch', + 'pointerdown': 'pointer', + 'MSPointerDown': 'pointer' + }; + + // IE PointerDown events will be validated in `touch` or `mouse` + // Index numbers referenced here: https://msdn.microsoft.com/library/windows/apps/hh466130.aspx + this.iePointerMap = { + 2: 'touch', + 3: 'touch', + 4: 'mouse' + }; + + this.initializeEvents(); + this.$rootScope.$on('$destroy', this.deregister.bind(this)); +} + +/** + * Removes all event listeners created by $mdInteration on the + * body element. + */ +MdInteractionService.prototype.deregister = function() { + + this.bodyElement.off('keydown mousedown', this.inputHandler); + + if ('ontouchstart' in document.documentElement) { + this.bodyElement.off('touchstart', this.bufferedInputHandler); + } + + if (this.pointerEvent) { + this.bodyElement.off(this.pointerEvent, this.inputHandler); + } + +}; + +/** + * Initializes the interaction service, by registering all interaction events to the + * body element. + */ +MdInteractionService.prototype.initializeEvents = function() { + + this.bodyElement.on('keydown mousedown', this.inputHandler); + + if ('ontouchstart' in document.documentElement) { + this.bodyElement.on('touchstart', this.bufferedInputHandler); + } + + if (this.pointerEvent) { + this.bodyElement.on(this.pointerEvent, this.inputHandler); + } + +}; + +/** + * Event listener for normal interaction events, which should be tracked. + * @param event {MouseEvent|KeyboardEvent|PointerEvent|TouchEvent} + */ +MdInteractionService.prototype.onInputEvent = function(event) { + if (this.isBuffering) { + return; + } + + var type = this.inputEventMap[event.type]; + + if (type === 'pointer') { + type = this.iePointerMap[event.pointerType] || event.pointerType; + } + + this.lastInteractionType = type; + this.lastInteractionTime = this.$mdUtil.now(); +}; + +/** + * Event listener for interaction events which should be buffered (touch events). + * @param event {TouchEvent} + */ +MdInteractionService.prototype.onBufferInputEvent = function(event) { + this.$timeout.cancel(this.bufferTimeout); + + this.onInputEvent(event); + this.isBuffering = true; + + // The timeout of 650ms is needed to delay the touchstart, because otherwise the touch will call + // the `onInput` function multiple times. + this.bufferTimeout = this.$timeout(function() { + this.isBuffering = false; + }.bind(this), 650, false); + +}; + +/** + * @ngdoc method + * @name $mdInteraction#getLastInteractionType + * @description Retrieves the last interaction type triggered in body. + * @returns {string|null} Last interaction type. + */ +MdInteractionService.prototype.getLastInteractionType = function() { + return this.lastInteractionType; +}; + +/** + * @ngdoc method + * @name $mdInteraction#isUserInvoked + * @description Method to detect whether any interaction happened recently or not. + * @param {number=} checkDelay Time to check for any interaction to have been triggered. + * @returns {boolean} Whether there was any interaction or not. + */ +MdInteractionService.prototype.isUserInvoked = function(checkDelay) { + var delay = angular.isNumber(checkDelay) ? checkDelay : 15; + + // Check for any interaction to be within the specified check time. + return this.lastInteractionTime >= this.$mdUtil.now() - delay; +}; + +})(); +(function(){ +"use strict"; + +angular.module('material.core') + .provider('$$interimElement', InterimElementProvider); + +/** + * @ngdoc service + * @name $$interimElementProvider + * @module material.core.interimElement + * + * @description + * + * Factory that constructs `$$interimElement.$service` services. + * Used internally in material design for elements that appear on screen temporarily. + * The service provides a promise-like API for interacting with the temporary + * elements. + * + * + * app.service('$mdToast', function($$interimElement) { + * var $mdToast = $$interimElement(toastDefaultOptions); + * return $mdToast; + * }); + * + * + * @param {object=} defaultOptions Options used by default for the `show` method on the service. + * + * @returns {$$interimElement.$service} + */ + +function InterimElementProvider() { + InterimElementFactory.$inject = ["$document", "$q", "$rootScope", "$timeout", "$rootElement", "$animate", "$mdUtil", "$mdCompiler", "$mdTheming", "$injector", "$exceptionHandler"]; + createInterimElementProvider.$get = InterimElementFactory; + return createInterimElementProvider; + + /** + * Returns a new provider which allows configuration of a new interimElement + * service. Allows configuration of default options & methods for options, + * as well as configuration of 'preset' methods (eg dialog.basic(): basic is a preset method) + */ + function createInterimElementProvider(interimFactoryName) { + factory.$inject = ["$$interimElement", "$injector"]; + var EXPOSED_METHODS = ['onHide', 'onShow', 'onRemove']; + + var customMethods = {}; + var providerConfig = { + presets: {} + }; + + var provider = { + setDefaults: setDefaults, + addPreset: addPreset, + addMethod: addMethod, + $get: factory + }; + + /** + * all interim elements will come with the 'build' preset + */ + provider.addPreset('build', { + methods: ['controller', 'controllerAs', 'resolve', 'multiple', + 'template', 'templateUrl', 'themable', 'transformTemplate', 'parent', 'contentElement'] + }); + + return provider; + + /** + * Save the configured defaults to be used when the factory is instantiated + */ + function setDefaults(definition) { + providerConfig.optionsFactory = definition.options; + providerConfig.methods = (definition.methods || []).concat(EXPOSED_METHODS); + return provider; + } + + /** + * Add a method to the factory that isn't specific to any interim element operations + */ + function addMethod(name, fn) { + customMethods[name] = fn; + return provider; + } + + /** + * Save the configured preset to be used when the factory is instantiated + */ + function addPreset(name, definition) { + definition = definition || {}; + definition.methods = definition.methods || []; + definition.options = definition.options || function() { return {}; }; + + if (/^cancel|hide|show$/.test(name)) { + throw new Error("Preset '" + name + "' in " + interimFactoryName + " is reserved!"); + } + if (definition.methods.indexOf('_options') > -1) { + throw new Error("Method '_options' in " + interimFactoryName + " is reserved!"); + } + providerConfig.presets[name] = { + methods: definition.methods.concat(EXPOSED_METHODS), + optionsFactory: definition.options, + argOption: definition.argOption + }; + return provider; + } + + function addPresetMethod(presetName, methodName, method) { + providerConfig.presets[presetName][methodName] = method; + } + + /** + * Create a factory that has the given methods & defaults implementing interimElement + */ + /* @ngInject */ + function factory($$interimElement, $injector) { + var defaultMethods; + var defaultOptions; + var interimElementService = $$interimElement(); + + /* + * publicService is what the developer will be using. + * It has methods hide(), cancel(), show(), build(), and any other + * presets which were set during the config phase. + */ + var publicService = { + hide: interimElementService.hide, + cancel: interimElementService.cancel, + show: showInterimElement, + + // Special internal method to destroy an interim element without animations + // used when navigation changes causes a $scope.$destroy() action + destroy : destroyInterimElement + }; + + + defaultMethods = providerConfig.methods || []; + // This must be invoked after the publicService is initialized + defaultOptions = invokeFactory(providerConfig.optionsFactory, {}); + + // Copy over the simple custom methods + angular.forEach(customMethods, function(fn, name) { + publicService[name] = fn; + }); + + angular.forEach(providerConfig.presets, function(definition, name) { + var presetDefaults = invokeFactory(definition.optionsFactory, {}); + var presetMethods = (definition.methods || []).concat(defaultMethods); + + // Every interimElement built with a preset has a field called `$type`, + // which matches the name of the preset. + // Eg in preset 'confirm', options.$type === 'confirm' + angular.extend(presetDefaults, { $type: name }); + + // This creates a preset class which has setter methods for every + // method given in the `.addPreset()` function, as well as every + // method given in the `.setDefaults()` function. + // + // @example + // .setDefaults({ + // methods: ['hasBackdrop', 'clickOutsideToClose', 'escapeToClose', 'targetEvent'], + // options: dialogDefaultOptions + // }) + // .addPreset('alert', { + // methods: ['title', 'ok'], + // options: alertDialogOptions + // }) + // + // Set values will be passed to the options when interimElement.show() is called. + function Preset(opts) { + this._options = angular.extend({}, presetDefaults, opts); + } + angular.forEach(presetMethods, function(name) { + Preset.prototype[name] = function(value) { + this._options[name] = value; + return this; + }; + }); + + // Create shortcut method for one-linear methods + if (definition.argOption) { + var methodName = 'show' + name.charAt(0).toUpperCase() + name.slice(1); + publicService[methodName] = function(arg) { + var config = publicService[name](arg); + return publicService.show(config); + }; + } + + // eg $mdDialog.alert() will return a new alert preset + publicService[name] = function(arg) { + // If argOption is supplied, eg `argOption: 'content'`, then we assume + // if the argument is not an options object then it is the `argOption` option. + // + // @example `$mdToast.simple('hello')` // sets options.content to hello + // // because argOption === 'content' + if (arguments.length && definition.argOption && + !angular.isObject(arg) && !angular.isArray(arg)) { + + return (new Preset())[definition.argOption](arg); + + } else { + return new Preset(arg); + } + + }; + }); + + return publicService; + + /** + * + */ + function showInterimElement(opts) { + // opts is either a preset which stores its options on an _options field, + // or just an object made up of options + opts = opts || { }; + if (opts._options) opts = opts._options; + + return interimElementService.show( + angular.extend({}, defaultOptions, opts) + ); + } + + /** + * Special method to hide and destroy an interimElement WITHOUT + * any 'leave` or hide animations ( an immediate force hide/remove ) + * + * NOTE: This calls the onRemove() subclass method for each component... + * which must have code to respond to `options.$destroy == true` + */ + function destroyInterimElement(opts) { + return interimElementService.destroy(opts); + } + + /** + * Helper to call $injector.invoke with a local of the factory name for + * this provider. + * If an $mdDialog is providing options for a dialog and tries to inject + * $mdDialog, a circular dependency error will happen. + * We get around that by manually injecting $mdDialog as a local. + */ + function invokeFactory(factory, defaultVal) { + var locals = {}; + locals[interimFactoryName] = publicService; + return $injector.invoke(factory || function() { return defaultVal; }, {}, locals); + } + } + } + + /* @ngInject */ + function InterimElementFactory($document, $q, $rootScope, $timeout, $rootElement, $animate, + $mdUtil, $mdCompiler, $mdTheming, $injector, $exceptionHandler) { + return function createInterimElementService() { + var SHOW_CANCELLED = false; + + /** + * @ngdoc service + * @name $$interimElementProvider.$service + * + * @description + * A service used to control inserting and removing of an element from the DOM. + * It is used by $mdBottomSheet, $mdDialog, $mdToast, $mdMenu, $mdPanel, and $mdSelect. + */ + var service; + + var showPromises = []; // Promises for the interim's which are currently opening. + var hidePromises = []; // Promises for the interim's which are currently hiding. + var showingInterims = []; // Interim elements which are currently showing up. + + // Publish instance $$interimElement service; + return service = { + show: show, + hide: waitForInterim(hide), + cancel: waitForInterim(cancel), + destroy : destroy, + $injector_: $injector + }; + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#show + * @kind function + * + * @description + * Adds the `$interimElement` to the DOM and returns a special promise that will be resolved + * or rejected with hide or cancel, respectively. + * + * @param {Object} options map of options and values + * @returns {Promise} a Promise that will be resolved when hide() is called or rejected when + * cancel() is called. + */ + function show(options) { + options = options || {}; + var interimElement = new InterimElement(options || {}); + + // When an interim element is currently showing, we have to cancel it. + // Just hiding it, will resolve the InterimElement's promise, the promise should be + // rejected instead. + var hideAction = options.multiple ? $q.resolve() : $q.all(showPromises); + + if (!options.multiple) { + // Wait for all opening interim's to finish their transition. + hideAction = hideAction.then(function() { + // Wait for all closing and showing interim's to be completely closed. + var promiseArray = hidePromises.concat(showingInterims.map(service.cancel)); + return $q.all(promiseArray); + }); + } + + var showAction = hideAction.then(function() { + + return interimElement + .show() + .then(function () { + showingInterims.push(interimElement); + }) + .catch(function (reason) { + return reason; + }) + .finally(function() { + showPromises.splice(showPromises.indexOf(showAction), 1); + }); + + }); + + showPromises.push(showAction); + + // In AngularJS 1.6+, exceptions inside promises will cause a rejection. We need to handle + // the rejection and only log it if it's an error. + interimElement.deferred.promise.catch(function(fault) { + if (fault instanceof Error) { + $exceptionHandler(fault); + } + + return fault; + }); + + // Return a promise that will be resolved when the interim + // element is hidden or cancelled... + return interimElement.deferred.promise; + } + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#hide + * @kind function + * + * @description + * Removes the `$interimElement` from the DOM and resolves the Promise returned from `show()`. + * + * @param {*} reason Data used to resolve the Promise + * @param {object} options map of options and values + * @returns {Promise} a Promise that will be resolved after the element has been removed + * from the DOM. + */ + function hide(reason, options) { + options = options || {}; + + if (options.closeAll) { + // We have to make a shallow copy of the array, because otherwise the map will break. + return $q.all(showingInterims.slice().reverse().map(closeElement)); + } else if (options.closeTo !== undefined) { + return $q.all(showingInterims.slice(options.closeTo).map(closeElement)); + } + + // Hide the latest showing interim element. + return closeElement(showingInterims[showingInterims.length - 1]); + + /** + * @param {InterimElement} interim element to close + * @returns {Promise} + */ + function closeElement(interim) { + if (!interim) { + return $q.when(reason); + } + + var hideAction = interim + .remove(reason, false, options || { }) + .catch(function(reason) { return reason; }) + .finally(function() { + hidePromises.splice(hidePromises.indexOf(hideAction), 1); + }); + + showingInterims.splice(showingInterims.indexOf(interim), 1); + hidePromises.push(hideAction); + + return interim.deferred.promise; + } + } + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#cancel + * @kind function + * + * @description + * Removes the `$interimElement` from the DOM and rejects the Promise returned from `show()`. + * + * @param {*} reason Data used to resolve the Promise + * @param {object} options map of options and values + * @returns {Promise} Promise that will be resolved after the element has been removed + * from the DOM. + */ + function cancel(reason, options) { + var interim = showingInterims.pop(); + if (!interim) { + return $q.when(reason); + } + + var cancelAction = interim + .remove(reason, true, options || {}) + .catch(function(reason) { return reason; }) + .finally(function() { + hidePromises.splice(hidePromises.indexOf(cancelAction), 1); + }); + + hidePromises.push(cancelAction); + + // Since AngularJS 1.6.7, promises will be logged to $exceptionHandler when the promise + // is not handling the rejection. We create a pseudo catch handler, which will prevent the + // promise from being logged to the $exceptionHandler. + return interim.deferred.promise.catch(angular.noop); + } + + /** + * Creates a function to wait for at least one interim element to be available. + * @param callbackFn Function to be used as callback + * @returns {Function} + */ + function waitForInterim(callbackFn) { + return function() { + var fnArguments = arguments; + + if (!showingInterims.length) { + // When there are still interim's opening, then wait for the first interim element to + // finish its open animation. + if (showPromises.length) { + return showPromises[0].finally(function () { + return callbackFn.apply(service, fnArguments); + }); + } + + return $q.when("No interim elements currently showing up."); + } + + return callbackFn.apply(service, fnArguments); + }; + } + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#destroy + * @kind function + * + * Special method to quick-remove the interim element without running animations. This is + * useful when the parent component has been or is being destroyed. + * + * Note: interim elements are in "interim containers". + */ + function destroy(targetEl) { + var interim = !targetEl ? showingInterims.shift() : null; + + var parentEl = angular.element(targetEl).length && angular.element(targetEl)[0].parentNode; + + if (parentEl) { + // Try to find the interim in the stack which corresponds to the supplied DOM element. + var filtered = showingInterims.filter(function(entry) { + return entry.options.element[0] === parentEl; + }); + + // Note: This function might be called when the element already has been removed, + // in which case we won't find any matches. + if (filtered.length) { + interim = filtered[0]; + showingInterims.splice(showingInterims.indexOf(interim), 1); + } + } + + return interim ? interim.remove(SHOW_CANCELLED, false, { '$destroy': true }) : + $q.when(SHOW_CANCELLED); + } + + /* + * Internal Interim Element Object + * Used internally to manage the DOM element and related data + */ + function InterimElement(options) { + var self, element, showAction = $q.when(true); + + options = configureScopeAndTransitions(options); + + return self = { + options : options, + deferred: $q.defer(), + show : createAndTransitionIn, + remove : transitionOutAndRemove + }; + + /** + * Compile, link, and show this interim element. Use optional autoHide and transition-in + * effects. + * @return {Q.Promise} + */ + function createAndTransitionIn() { + return $q(function(resolve, reject) { + + // Trigger onCompiling callback before the compilation starts. + // This is useful, when modifying options, which can be influenced by developers. + options.onCompiling && options.onCompiling(options); + + compileElement(options) + .then(function(compiledData) { + element = linkElement(compiledData, options); + + // Expose the cleanup function from the compiler. + options.cleanupElement = compiledData.cleanup; + + showAction = showElement(element, options, compiledData.controller) + .then(resolve, rejectAll); + }).catch(rejectAll); + + function rejectAll(fault) { + // Force the '$md.show()' promise to reject + self.deferred.reject(fault); + + // Continue rejection propagation + reject(fault); + } + }); + } + + /** + * After the show process has finished/rejected: + * - announce 'removing', + * - perform the transition-out, and + * - perform optional clean up scope. + */ + function transitionOutAndRemove(response, isCancelled, opts) { + + // abort if the show() and compile failed + if (!element) return $q.when(false); + + options = angular.extend(options || {}, opts || {}); + options.cancelAutoHide && options.cancelAutoHide(); + options.element.triggerHandler('$mdInterimElementRemove'); + + if (options.$destroy === true) { + + return hideElement(options.element, options).then(function(){ + (isCancelled && rejectAll(response)) || resolveAll(response); + }); + + } else { + $q.when(showAction).finally(function() { + hideElement(options.element, options).then(function() { + isCancelled ? rejectAll(response) : resolveAll(response); + }, rejectAll); + }); + + return self.deferred.promise; + } + + + /** + * The `show()` returns a promise that will be resolved when the interim + * element is hidden or cancelled... + */ + function resolveAll(response) { + self.deferred.resolve(response); + } + + /** + * Force the '$md.show()' promise to reject + */ + function rejectAll(fault) { + self.deferred.reject(fault); + } + } + + /** + * Prepare optional isolated scope and prepare $animate with default enter and leave + * transitions for the new element instance. + */ + function configureScopeAndTransitions(options) { + options = options || { }; + if (options.template) { + options.template = $mdUtil.processTemplate(options.template); + } + + return angular.extend({ + preserveScope: false, + cancelAutoHide : angular.noop, + scope: options.scope || $rootScope.$new(options.isolateScope), + + /** + * Default usage to enable $animate to transition-in; can be easily overridden via 'options' + */ + onShow: function transitionIn(scope, element, options) { + return $animate.enter(element, options.parent); + }, + + /** + * Default usage to enable $animate to transition-out; can be easily overridden via 'options' + */ + onRemove: function transitionOut(scope, element) { + // Element could be undefined if a new element is shown before + // the old one finishes compiling. + return element && $animate.leave(element) || $q.when(); + } + }, options); + + } + + /** + * Compile an element with a templateUrl, controller, and locals + * @param {Object} options + * @return {Q.Promise<{element: JQLite=, link: Function, locals: Object, cleanup: any=, + * controller: Object=}>} + */ + function compileElement(options) { + + var compiled = !options.skipCompile ? $mdCompiler.compile(options) : null; + + return compiled || $q(function (resolve) { + resolve({ + locals: {}, + link: function () { + return options.element; + } + }); + }); + } + + /** + * Link an element with compiled configuration + * @param {{element: JQLite=, link: Function, locals: Object, controller: Object=}} compileData + * @param {Object} options + * @return {JQLite} + */ + function linkElement(compileData, options) { + angular.extend(compileData.locals, options); + + var element = compileData.link(options.scope); + + // Search for parent at insertion time, if not specified + options.element = element; + options.parent = findParent(element, options); + if (options.themable) $mdTheming(element); + + return element; + } + + /** + * Search for parent at insertion time, if not specified. + * @param {JQLite} element + * @param {Object} options + * @return {JQLite} + */ + function findParent(element, options) { + var parent = options.parent; + + // Search for parent at insertion time, if not specified + if (angular.isFunction(parent)) { + parent = parent(options.scope, element, options); + } else if (angular.isString(parent)) { + parent = angular.element($document[0].querySelector(parent)); + } else { + parent = angular.element(parent); + } + + // If parent querySelector/getter function fails, or it's just null, + // find a default. + if (!(parent || {}).length) { + var el; + if ($rootElement[0] && $rootElement[0].querySelector) { + el = $rootElement[0].querySelector(':not(svg) > body'); + } + if (!el) el = $rootElement[0]; + if (el.nodeName === '#comment') { + el = $document[0].body; + } + return angular.element(el); + } + + return parent; + } + + /** + * If auto-hide is enabled, start timer and prepare cancel function + */ + function startAutoHide() { + var autoHideTimer, cancelAutoHide = angular.noop; + + if (options.hideDelay) { + autoHideTimer = $timeout(service.hide, options.hideDelay) ; + cancelAutoHide = function() { + $timeout.cancel(autoHideTimer); + }; + } + + // Cache for subsequent use + options.cancelAutoHide = function() { + cancelAutoHide(); + options.cancelAutoHide = undefined; + }; + } + + /** + * Show the element (with transitions), notify complete and start optional auto hiding + * timer. + * @param {JQLite} element + * @param {Object} options + * @param {Object} controller + * @return {Q.Promise} + */ + function showElement(element, options, controller) { + // Trigger onShowing callback before the `show()` starts + var notifyShowing = options.onShowing || angular.noop; + // Trigger onComplete callback when the `show()` finishes + var notifyComplete = options.onComplete || angular.noop; + + // Necessary for consistency between AngularJS 1.5 and 1.6. + try { + // This fourth controller parameter is used by $mdDialog in beforeShow(). + notifyShowing(options.scope, element, options, controller); + } catch (e) { + return $q.reject(e); + } + + return $q(function (resolve, reject) { + try { + // Start transitionIn + $q.when(options.onShow(options.scope, element, options)) + .then(function () { + notifyComplete(options.scope, element, options); + startAutoHide(); + + resolve(element); + }, reject); + + } catch (e) { + reject(e.message); + } + }); + } + + function hideElement(element, options) { + var announceRemoving = options.onRemoving || angular.noop; + + return $q(function (resolve, reject) { + try { + // Start transitionIn + var action = $q.when(options.onRemove(options.scope, element, options) || true); + + // Trigger callback *before* the remove operation starts + announceRemoving(element, action); + + if (options.$destroy) { + // For $destroy, onRemove should be synchronous + resolve(element); + + if (!options.preserveScope && options.scope) { + // scope destroy should still be be done after the current digest is done + action.then(function() { options.scope.$destroy(); }); + } + } else { + // Wait until transition-out is done + action.then(function () { + if (!options.preserveScope && options.scope) { + options.scope.$destroy(); + } + + resolve(element); + }, reject); + } + } catch (e) { + reject(e.message); + } + }); + } + + } + }; + } +} + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + var $mdUtil, $interpolate, $log; + + var SUFFIXES = /(-gt)?-(sm|md|lg|print)/g; + var WHITESPACE = /\s+/g; + + var FLEX_OPTIONS = ['grow', 'initial', 'auto', 'none', 'noshrink', 'nogrow']; + var LAYOUT_OPTIONS = ['row', 'column']; + var ALIGNMENT_MAIN_AXIS= ["", "start", "center", "end", "stretch", "space-around", "space-between"]; + var ALIGNMENT_CROSS_AXIS= ["", "start", "center", "end", "stretch"]; + + var config = { + /** + * Enable directive attribute-to-class conversions + * Developers can use `` to quickly + * disable the Layout directives and prohibit the injection of Layout classNames + */ + enabled: true, + + /** + * List of mediaQuery breakpoints and associated suffixes + * [ + * { suffix: "sm", mediaQuery: "screen and (max-width: 599px)" }, + * { suffix: "md", mediaQuery: "screen and (min-width: 600px) and (max-width: 959px)" } + * ] + */ + breakpoints: [] + }; + + registerLayoutAPI(angular.module('material.core.layout', ['ng'])); + + /** + * registerLayoutAPI() + * + * The original AngularJS Material Layout solution used attribute selectors and CSS. + * + * ```html + *
    My Content
    + * ``` + * + * ```css + * [layout] { + * box-sizing: border-box; + * display:flex; + * } + * [layout=column] { + * flex-direction : column + * } + * ``` + * + * Use of attribute selectors creates significant performance impacts in some + * browsers... mainly IE. + * + * This module registers directives that allow the same layout attributes to be + * interpreted and converted to class selectors. The directive will add equivalent classes to + * each element that contains a Layout directive. + * + * ```html + *
    My Content
    + * ``` + * + * ```css + * .layout { + * box-sizing: border-box; + * display:flex; + * } + * .layout-column { + * flex-direction : column + * } + * ``` + */ + function registerLayoutAPI(module){ + var PREFIX_REGEXP = /^((?:x|data)[:\-_])/i; + var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; + + // NOTE: these are also defined in constants::MEDIA_PRIORITY and constants::MEDIA + var BREAKPOINTS = ["", "xs", "gt-xs", "sm", "gt-sm", "md", "gt-md", "lg", "gt-lg", "xl", "print"]; + var API_WITH_VALUES = ["layout", "flex", "flex-order", "flex-offset", "layout-align"]; + var API_NO_VALUES = ["show", "hide", "layout-padding", "layout-margin"]; + + + // Build directive registration functions for the standard Layout API... for all breakpoints. + angular.forEach(BREAKPOINTS, function(mqb) { + + // Attribute directives with expected, observable value(s) + angular.forEach(API_WITH_VALUES, function(name){ + var fullName = mqb ? name + "-" + mqb : name; + module.directive(directiveNormalize(fullName), attributeWithObserve(fullName)); + }); + + // Attribute directives with no expected value(s) + angular.forEach(API_NO_VALUES, function(name){ + var fullName = mqb ? name + "-" + mqb : name; + module.directive(directiveNormalize(fullName), attributeWithoutValue(fullName)); + }); + + }); + + // Register other, special directive functions for the Layout features: + module + .provider('$$mdLayout', function() { + // Publish internal service for Layouts + return { + $get : angular.noop, + validateAttributeValue : validateAttributeValue, + validateAttributeUsage : validateAttributeUsage, + /** + * Easy way to disable/enable the Layout API. + * When disabled, this stops all attribute-to-classname generations + */ + disableLayouts : function(isDisabled) { + config.enabled = (isDisabled !== true); + } + }; + }) + + .directive('mdLayoutCss' , disableLayoutDirective) + .directive('ngCloak' , buildCloakInterceptor('ng-cloak')) + + .directive('layoutWrap' , attributeWithoutValue('layout-wrap')) + .directive('layoutNowrap' , attributeWithoutValue('layout-nowrap')) + .directive('layoutNoWrap' , attributeWithoutValue('layout-no-wrap')) + .directive('layoutFill' , attributeWithoutValue('layout-fill')) + + // Determine if + .config(detectDisabledLayouts); + + /** + * Converts snake_case to camelCase. + * Also there is special case for Moz prefix starting with upper case letter. + * @param name Name to normalize + */ + function directiveNormalize(name) { + return name + .replace(PREFIX_REGEXP, '') + .replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { + return offset ? letter.toUpperCase() : letter; + }); + } + } + + + /** + * Detect if any of the HTML tags has a [md-layouts-disabled] attribute; + * If yes, then immediately disable all layout API features + * + * Note: this attribute should be specified on either the HTML or BODY tags + * @ngInject + */ + function detectDisabledLayouts() { + var isDisabled = !!document.querySelector('[md-layouts-disabled]'); + config.enabled = !isDisabled; + } + + /** + * Special directive that will disable ALL Layout conversions of layout + * attribute(s) to classname(s). + * + * + * + * + * + * ... + * + * + * Note: Using md-layout-css directive requires the developer to load the Material + * Layout Attribute stylesheet (which only uses attribute selectors): + * + * `angular-material.layout.css` + * + * Another option is to use the LayoutProvider to configure and disable the attribute + * conversions; this would obviate the use of the `md-layout-css` directive + */ + function disableLayoutDirective() { + // Return a 1x-only, first-match attribute directive + config.enabled = false; + + return { + restrict : 'A', + priority : '900' + }; + } + + /** + * Tail-hook ngCloak to delay the uncloaking while Layout transformers + * finish processing. Eliminates flicker with Material.Layouts + */ + function buildCloakInterceptor(className) { + return ['$timeout', function($timeout){ + return { + restrict : 'A', + priority : -10, // run after normal ng-cloak + compile : function(element) { + if (!config.enabled) return angular.noop; + + // Re-add the cloak + element.addClass(className); + + return function(scope, element) { + // Wait while layout injectors configure, then uncloak + // NOTE: $rAF does not delay enough... and this is a 1x-only event, + // $timeout is acceptable. + $timeout(function(){ + element.removeClass(className); + }, 10, false); + }; + } + }; + }]; + } + + + // ********************************************************************************* + // + // These functions create registration functions for AngularJS Material Layout attribute + // directives. This provides easy translation to switch AngularJS Material attribute selectors to + // CLASS selectors and directives; which has huge performance implications for IE Browsers. + // + // ********************************************************************************* + + /** + * Creates a directive registration function where a possible dynamic attribute + * value will be observed/watched. + * @param {string} className attribute name; eg `layout-gt-md` with value ="row" + */ + function attributeWithObserve(className) { + + return ['$mdUtil', '$interpolate', "$log", function(_$mdUtil_, _$interpolate_, _$log_) { + $mdUtil = _$mdUtil_; + $interpolate = _$interpolate_; + $log = _$log_; + + return { + restrict: 'A', + compile: function(element, attr) { + var linkFn; + if (config.enabled) { + // immediately replace static (non-interpolated) invalid values... + + validateAttributeUsage(className, attr, element, $log); + + validateAttributeValue(className, + getNormalizedAttrValue(className, attr, ""), + buildUpdateFn(element, className, attr) + ); + + linkFn = translateWithValueToCssClass; + } + + // Use for postLink to account for transforms after ng-transclude. + return linkFn || angular.noop; + } + }; + }]; + + /** + * Observe deprecated layout attributes and update the element's layout classes to match. + */ + function translateWithValueToCssClass(scope, element, attrs) { + var updateFn = updateClassWithValue(element, className, attrs); + var unwatch = attrs.$observe(attrs.$normalize(className), updateFn); + + updateFn(getNormalizedAttrValue(className, attrs, "")); + scope.$on("$destroy", function() { unwatch(); }); + } + } + + /** + * Creates a registration function for AngularJS Material Layout attribute directive. + * This is a `simple` transpose of attribute usage to class usage; where we ignore + * any attribute value. + */ + function attributeWithoutValue(className) { + return ['$mdUtil', '$interpolate', "$log", function(_$mdUtil_, _$interpolate_, _$log_) { + $mdUtil = _$mdUtil_; + $interpolate = _$interpolate_; + $log = _$log_; + + return { + restrict: 'A', + compile: function(element, attr) { + var linkFn; + if (config.enabled) { + // immediately replace static (non-interpolated) invalid values... + + validateAttributeValue(className, + getNormalizedAttrValue(className, attr, ""), + buildUpdateFn(element, className, attr) + ); + + translateToCssClass(null, element); + + // Use for postLink to account for transforms after ng-transclude. + linkFn = translateToCssClass; + } + + return linkFn || angular.noop; + } + }; + }]; + + /** + * Add transformed class selector. + */ + function translateToCssClass(scope, element) { + element.addClass(className); + } + } + + /** + * After link-phase, do NOT remove deprecated layout attribute selector. + * Instead watch the attribute so interpolated data-bindings to layout + * selectors will continue to be supported. + * + * $observe() the className and update with new class (after removing the last one) + * + * e.g. `layout="{{layoutDemo.direction}}"` will update... + * + * NOTE: The value must match one of the specified styles in the CSS. + * For example `flex-gt-md="{{size}}` where `scope.size == 47` will NOT work since + * only breakpoints for 0, 5, 10, 15... 100, 33, 34, 66, 67 are defined. + */ + function updateClassWithValue(element, className) { + var lastClass; + + return function updateClassFn(newValue) { + var value = validateAttributeValue(className, newValue || ""); + if (angular.isDefined(value)) { + if (lastClass) element.removeClass(lastClass); + lastClass = !value ? className : className + "-" + value.trim().replace(WHITESPACE, "-"); + element.addClass(lastClass); + } + }; + } + + /** + * Centralize warnings for known flexbox issues (especially IE-related issues) + */ + function validateAttributeUsage(className, attr, element, $log){ + var message, usage, url; + var nodeName = element[0].nodeName.toLowerCase(); + + switch (className.replace(SUFFIXES,"")) { + case "flex": + if ((nodeName === "md-button") || (nodeName === "fieldset")){ + // @see https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers + // Use
    wrapper inside (preferred) or outside + + usage = "<" + nodeName + " " + className + ">"; + url = "https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers"; + message = "Markup '{0}' may not work as expected in IE Browsers. Consult '{1}' for details."; + + $log.warn($mdUtil.supplant(message, [usage, url])); + } + } + } + + + /** + * For the Layout attribute value, validate or replace with default fallback value. + */ + function validateAttributeValue(className, value, updateFn) { + var origValue = value; + + if (!needsInterpolation(value)) { + switch (className.replace(SUFFIXES,"")) { + case 'layout' : + if (!findIn(value, LAYOUT_OPTIONS)) { + value = LAYOUT_OPTIONS[0]; // 'row'; + } + break; + + case 'flex' : + if (!findIn(value, FLEX_OPTIONS)) { + if (isNaN(value)) { + value = ''; + } + } + break; + + case 'flex-offset' : + case 'flex-order' : + if (!value || isNaN(+value)) { + value = '0'; + } + break; + + case 'layout-align' : + var axis = extractAlignAxis(value); + value = $mdUtil.supplant("{main}-{cross}",axis); + break; + + case 'layout-padding' : + case 'layout-margin' : + case 'layout-fill' : + case 'layout-wrap' : + case 'layout-nowrap' : + value = ''; + break; + } + + if (value !== origValue) { + (updateFn || angular.noop)(value); + } + } + + return value ? value.trim() : ""; + } + + /** + * Replace current attribute value with fallback value + */ + function buildUpdateFn(element, className, attrs) { + return function updateAttrValue(fallback) { + if (!needsInterpolation(fallback)) { + // Do not modify the element's attribute value; so + // uses '' will not + // be affected. Just update the attrs value. + attrs[attrs.$normalize(className)] = fallback; + } + }; + } + + /** + * See if the original value has interpolation symbols: + * e.g. flex-gt-md="{{triggerPoint}}" + */ + function needsInterpolation(value) { + return (value || "").indexOf($interpolate.startSymbol()) > -1; + } + + function getNormalizedAttrValue(className, attrs, defaultVal) { + var normalizedAttr = attrs.$normalize(className); + return attrs[normalizedAttr] ? attrs[normalizedAttr].trim().replace(WHITESPACE, "-") : + defaultVal || null; + } + + function findIn(item, list, replaceWith) { + item = replaceWith && item ? item.replace(WHITESPACE, replaceWith) : item; + + var found = false; + if (item) { + list.forEach(function(it) { + it = replaceWith ? it.replace(WHITESPACE, replaceWith) : it; + found = found || (it === item); + }); + } + return found; + } + + function extractAlignAxis(attrValue) { + var axis = { + main : "start", + cross: "stretch" + }, values; + + attrValue = (attrValue || ""); + + if (attrValue.indexOf("-") === 0 || attrValue.indexOf(" ") === 0) { + // For missing main-axis values + attrValue = "none" + attrValue; + } + + values = attrValue.toLowerCase().trim().replace(WHITESPACE, "-").split("-"); + if (values.length && (values[0] === "space")) { + // for main-axis values of "space-around" or "space-between" + values = [values[0]+"-"+values[1],values[2]]; + } + + if (values.length > 0) axis.main = values[0] || axis.main; + if (values.length > 1) axis.cross = values[1] || axis.cross; + + if (ALIGNMENT_MAIN_AXIS.indexOf(axis.main) < 0) axis.main = "start"; + if (ALIGNMENT_CROSS_AXIS.indexOf(axis.cross) < 0) axis.cross = "stretch"; + + return axis; + } +})(); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.liveannouncer + * @description + * AngularJS Material Live Announcer to provide accessibility for Voice Readers. + */ +MdLiveAnnouncer.$inject = ["$timeout"]; +angular + .module('material.core') + .service('$mdLiveAnnouncer', MdLiveAnnouncer); + +/** + * @ngdoc service + * @name $mdLiveAnnouncer + * @module material.core.liveannouncer + * + * @description + * + * Service to announce messages to supported screenreaders. + * + * > The `$mdLiveAnnouncer` service is internally used for components to provide proper accessibility. + * + * + * module.controller('AppCtrl', function($mdLiveAnnouncer) { + * // Basic announcement (Polite Mode) + * $mdLiveAnnouncer.announce('Hey Google'); + * + * // Custom announcement (Assertive Mode) + * $mdLiveAnnouncer.announce('Hey Google', 'assertive'); + * }); + * + * + */ +function MdLiveAnnouncer($timeout) { + /** @private @const @type {!angular.$timeout} */ + this._$timeout = $timeout; + + /** @private @const @type {!HTMLElement} */ + this._liveElement = this._createLiveElement(); + + /** @private @const @type {!number} */ + this._announceTimeout = 100; +} + +/** + * @ngdoc method + * @name $mdLiveAnnouncer#announce + * @description Announces messages to supported screenreaders. + * @param {string} message Message to be announced to the screenreader + * @param {'off'|'polite'|'assertive'} politeness The politeness of the announcer element. + */ +MdLiveAnnouncer.prototype.announce = function(message, politeness) { + if (!politeness) { + politeness = 'polite'; + } + + var self = this; + + self._liveElement.textContent = ''; + self._liveElement.setAttribute('aria-live', politeness); + + // This 100ms timeout is necessary for some browser + screen-reader combinations: + // - Both JAWS and NVDA over IE11 will not announce anything without a non-zero timeout. + // - With Chrome and IE11 with NVDA or JAWS, a repeated (identical) message won't be read a + // second time without clearing and then using a non-zero delay. + // (using JAWS 17 at time of this writing). + self._$timeout(function() { + self._liveElement.textContent = message; + }, self._announceTimeout, false); +}; + +/** + * Creates a live announcer element, which listens for DOM changes and announces them + * to the screenreaders. + * @returns {!HTMLElement} + * @private + */ +MdLiveAnnouncer.prototype._createLiveElement = function() { + var liveEl = document.createElement('div'); + + liveEl.classList.add('md-visually-hidden'); + liveEl.setAttribute('role', 'status'); + liveEl.setAttribute('aria-atomic', 'true'); + liveEl.setAttribute('aria-live', 'polite'); + + document.body.appendChild(liveEl); + + return liveEl; +}; + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc service + * @name $$mdMeta + * @module material.core.meta + * + * @description + * + * A provider and a service that simplifies meta tags access + * + * Note: This is intended only for use with dynamic meta tags such as browser color and title. + * Tags that are only processed when the page is rendered (such as `charset`, and `http-equiv`) + * will not work since `$$mdMeta` adds the tags after the page has already been loaded. + * + * ```js + * app.config(function($$mdMetaProvider) { + * var removeMeta = $$mdMetaProvider.setMeta('meta-name', 'content'); + * var metaValue = $$mdMetaProvider.getMeta('meta-name'); // -> 'content' + * + * removeMeta(); + * }); + * + * app.controller('myController', function($$mdMeta) { + * var removeMeta = $$mdMeta.setMeta('meta-name', 'content'); + * var metaValue = $$mdMeta.getMeta('meta-name'); // -> 'content' + * + * removeMeta(); + * }); + * ``` + * + * @returns {$$mdMeta.$service} + * + */ +angular.module('material.core.meta', []) + .provider('$$mdMeta', function () { + var head = angular.element(document.head); + var metaElements = {}; + + /** + * Checks if the requested element was written manually and maps it + * + * @param {string} name meta tag 'name' attribute value + * @returns {boolean} returns true if there is an element with the requested name + */ + function mapExistingElement(name) { + if (metaElements[name]) { + return true; + } + + var element = document.getElementsByName(name)[0]; + + if (!element) { + return false; + } + + metaElements[name] = angular.element(element); + + return true; + } + + /** + * @ngdoc method + * @name $$mdMeta#setMeta + * + * @description + * Creates meta element with the 'name' and 'content' attributes, + * if the meta tag is already created than we replace the 'content' value + * + * @param {string} name meta tag 'name' attribute value + * @param {string} content meta tag 'content' attribute value + * @returns {function} remove function + * + */ + function setMeta(name, content) { + mapExistingElement(name); + + if (!metaElements[name]) { + var newMeta = angular.element(''); + head.append(newMeta); + metaElements[name] = newMeta; + } + else { + metaElements[name].attr('content', content); + } + + return function () { + metaElements[name].attr('content', ''); + metaElements[name].remove(); + delete metaElements[name]; + }; + } + + /** + * @ngdoc method + * @name $$mdMeta#getMeta + * + * @description + * Gets the 'content' attribute value of the wanted meta element + * + * @param {string} name meta tag 'name' attribute value + * @returns {string} content attribute value + */ + function getMeta(name) { + if (!mapExistingElement(name)) { + throw Error('$$mdMeta: could not find a meta tag with the name \'' + name + '\''); + } + + return metaElements[name].attr('content'); + } + + var module = { + setMeta: setMeta, + getMeta: getMeta + }; + + return angular.extend({}, module, { + $get: function () { + return module; + } + }); + }); +})(); +(function(){ +"use strict"; + + /** + * @ngdoc module + * @name material.core.componentRegistry + * + * @description + * A component instance registration service. + * Note: currently this as a private service in the SideNav component. + */ + ComponentRegistry.$inject = ["$log", "$q"]; + angular.module('material.core') + .factory('$mdComponentRegistry', ComponentRegistry); + + /* + * @private + * @ngdoc factory + * @name ComponentRegistry + * @module material.core.componentRegistry + * + */ + function ComponentRegistry($log, $q) { + + var self; + var instances = []; + var pendings = { }; + + return self = { + /** + * Used to print an error when an instance for a handle isn't found. + */ + notFoundError: function(handle, msgContext) { + $log.error((msgContext || "") + 'No instance found for handle', handle); + }, + /** + * Return all registered instances as an array. + */ + getInstances: function() { + return instances; + }, + + /** + * Get a registered instance. + * @param handle the String handle to look up for a registered instance. + */ + get: function(handle) { + if (!isValidID(handle)) return null; + + var i, j, instance; + for (i = 0, j = instances.length; i < j; i++) { + instance = instances[i]; + if (instance.$$mdHandle === handle) { + return instance; + } + } + return null; + }, + + /** + * Register an instance. + * @param instance the instance to register + * @param handle the handle to identify the instance under. + */ + register: function(instance, handle) { + if (!handle) return angular.noop; + + instance.$$mdHandle = handle; + instances.push(instance); + resolveWhen(); + + return deregister; + + /** + * Remove registration for an instance + */ + function deregister() { + var index = instances.indexOf(instance); + if (index !== -1) { + instances.splice(index, 1); + } + } + + /** + * Resolve any pending promises for this instance + */ + function resolveWhen() { + var dfd = pendings[handle]; + if (dfd) { + dfd.forEach(function (promise) { + promise.resolve(instance); + }); + delete pendings[handle]; + } + } + }, + + /** + * Async accessor to registered component instance + * If not available then a promise is created to notify + * all listeners when the instance is registered. + */ + when : function(handle) { + if (isValidID(handle)) { + var deferred = $q.defer(); + var instance = self.get(handle); + + if (instance) { + deferred.resolve(instance); + } else { + if (pendings[handle] === undefined) { + pendings[handle] = []; + } + pendings[handle].push(deferred); + } + + return deferred.promise; + } + return $q.reject("Invalid `md-component-id` value."); + } + + }; + + function isValidID(handle){ + return handle && (handle !== ""); + } + + } + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdButtonInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-button. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the default ripple configuration + */ + + MdButtonInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdButtonInkRipple', MdButtonInkRipple); + + function MdButtonInkRipple($mdInkRipple) { + return { + attach: function attachRipple(scope, element, options) { + options = angular.extend(optionsForElement(element), options); + + return $mdInkRipple.attach(scope, element, options); + } + }; + + function optionsForElement(element) { + if (element.hasClass('md-icon-button')) { + return { + isMenuItem: element.hasClass('md-menu-item'), + fitRipple: true, + center: true + }; + } else { + return { + isMenuItem: element.hasClass('md-menu-item'), + dimBackground: true + }; + } + } + } +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdCheckboxInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-checkbox. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultripple configuration + */ + + MdCheckboxInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdCheckboxInkRipple', MdCheckboxInkRipple); + + function MdCheckboxInkRipple($mdInkRipple) { + return { + attach: attach + }; + + function attach(scope, element, options) { + return $mdInkRipple.attach(scope, element, angular.extend({ + center: true, + dimBackground: false, + fitRipple: true + }, options)); + } + } +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdListInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-list. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultripple configuration + */ + + MdListInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdListInkRipple', MdListInkRipple); + + function MdListInkRipple($mdInkRipple) { + return { + attach: attach + }; + + function attach(scope, element, options) { + return $mdInkRipple.attach(scope, element, angular.extend({ + center: false, + dimBackground: true, + outline: false, + rippleSize: 'full' + }, options)); + } + } +})(); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.ripple + * @description + * Ripple + */ +InkRippleCtrl.$inject = ["$scope", "$element", "rippleOptions", "$window", "$timeout", "$mdUtil", "$mdColorUtil"]; +InkRippleDirective.$inject = ["$mdButtonInkRipple", "$mdCheckboxInkRipple"]; +angular.module('material.core') + .provider('$mdInkRipple', InkRippleProvider) + .directive('mdInkRipple', InkRippleDirective) + .directive('mdNoInk', attrNoDirective) + .directive('mdNoBar', attrNoDirective) + .directive('mdNoStretch', attrNoDirective); + +var DURATION = 450; + +/** + * @ngdoc directive + * @name mdInkRipple + * @module material.core.ripple + * + * @description + * The `md-ink-ripple` directive allows you to specify the ripple color or if a ripple is allowed. + * + * @param {string|boolean} md-ink-ripple A color string `#FF0000` or boolean (`false` or `0`) for + * preventing ripple + * + * @usage + * ### String values + * + * + * Ripples in red + * + * + * + * Not rippling + * + * + * + * ### Interpolated values + * + * + * Ripples with the return value of 'randomColor' function + * + * + * + * Ripples if 'canRipple' function return value is not 'false' or '0' + * + * + */ +function InkRippleDirective ($mdButtonInkRipple, $mdCheckboxInkRipple) { + return { + controller: angular.noop, + link: function (scope, element, attr) { + attr.hasOwnProperty('mdInkRippleCheckbox') + ? $mdCheckboxInkRipple.attach(scope, element) + : $mdButtonInkRipple.attach(scope, element); + } + }; +} + +/** + * @ngdoc service + * @name $mdInkRipple + * @module material.core.ripple + * + * @description + * `$mdInkRipple` is a service for adding ripples to any element. + * + * @usage + * + * app.factory('$myElementInkRipple', function($mdInkRipple) { + * return { + * attach: function (scope, element, options) { + * return $mdInkRipple.attach(scope, element, angular.extend({ + * center: false, + * dimBackground: true + * }, options)); + * } + * }; + * }); + * + * app.controller('myController', function ($scope, $element, $myElementInkRipple) { + * $scope.onClick = function (ev) { + * $myElementInkRipple.attach($scope, angular.element(ev.target), { center: true }); + * } + * }); + * + */ + +/** + * @ngdoc service + * @name $mdInkRippleProvider + * @module material.core.ripple + * + * @description + * If you want to disable ink ripples globally, for all components, you can call the + * `disableInkRipple` method in your app's config. + * + * + * @usage + * + * app.config(function ($mdInkRippleProvider) { + * $mdInkRippleProvider.disableInkRipple(); + * }); + * + */ + +function InkRippleProvider () { + var isDisabledGlobally = false; + + return { + disableInkRipple: disableInkRipple, + $get: ["$injector", function($injector) { + return { attach: attach }; + + /** + * @ngdoc method + * @name $mdInkRipple#attach + * + * @description + * Attaching given scope, element and options to inkRipple controller + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultRipple configuration + * * `center` - Whether the ripple should start from the center of the container element + * * `dimBackground` - Whether the background should be dimmed with the ripple color + * * `colorElement` - The element the ripple should take its color from, defined by css property `color` + * * `fitRipple` - Whether the ripple should fill the element + */ + function attach (scope, element, options) { + if (isDisabledGlobally || element.controller('mdNoInk')) return angular.noop; + return $injector.instantiate(InkRippleCtrl, { + $scope: scope, + $element: element, + rippleOptions: options + }); + } + }] + }; + + /** + * @ngdoc method + * @name $mdInkRippleProvider#disableInkRipple + * + * @description + * A config-time method that, when called, disables ripples globally. + */ + function disableInkRipple () { + isDisabledGlobally = true; + } +} + +/** + * Controller used by the ripple service in order to apply ripples + * @ngInject + */ +function InkRippleCtrl ($scope, $element, rippleOptions, $window, $timeout, $mdUtil, $mdColorUtil) { + this.$window = $window; + this.$timeout = $timeout; + this.$mdUtil = $mdUtil; + this.$mdColorUtil = $mdColorUtil; + this.$scope = $scope; + this.$element = $element; + this.options = rippleOptions; + this.mousedown = false; + this.ripples = []; + this.timeout = null; // Stores a reference to the most-recent ripple timeout + this.lastRipple = null; + + $mdUtil.valueOnUse(this, 'container', this.createContainer); + + this.$element.addClass('md-ink-ripple'); + + // attach method for unit tests + ($element.controller('mdInkRipple') || {}).createRipple = angular.bind(this, this.createRipple); + ($element.controller('mdInkRipple') || {}).setColor = angular.bind(this, this.color); + + this.bindEvents(); +} + + +/** + * Either remove or unlock any remaining ripples when the user mouses off of the element (either by + * mouseup or mouseleave event) + */ +function autoCleanup (self, cleanupFn) { + if (self.mousedown || self.lastRipple) { + self.mousedown = false; + self.$mdUtil.nextTick(angular.bind(self, cleanupFn), false); + } +} + + +/** + * Returns the color that the ripple should be (either based on CSS or hard-coded) + * @returns {string} + */ +InkRippleCtrl.prototype.color = function (value) { + var self = this; + + // If assigning a color value, apply it to background and the ripple color + if (angular.isDefined(value)) { + self._color = self._parseColor(value); + } + + // If color lookup, use assigned, defined, or inherited + return self._color || self._parseColor(self.inkRipple()) || self._parseColor(getElementColor()); + + /** + * Finds the color element and returns its text color for use as default ripple color + * @returns {string} + */ + function getElementColor () { + var items = self.options && self.options.colorElement ? self.options.colorElement : []; + var elem = items.length ? items[ 0 ] : self.$element[ 0 ]; + + return elem ? self.$window.getComputedStyle(elem).color : 'rgb(0,0,0)'; + } +}; + +/** + * Updating the ripple colors based on the current inkRipple value + * or the element's computed style color + */ +InkRippleCtrl.prototype.calculateColor = function () { + return this.color(); +}; + + +/** + * Takes a string color and converts it to RGBA format + * @param {string} color + * @param {number} multiplier + * @returns {string} + */ +InkRippleCtrl.prototype._parseColor = function parseColor (color, multiplier) { + multiplier = multiplier || 1; + var colorUtil = this.$mdColorUtil; + + if (!color) return; + if (color.indexOf('rgba') === 0) return color.replace(/\d?\.?\d*\s*\)\s*$/, (0.1 * multiplier).toString() + ')'); + if (color.indexOf('rgb') === 0) return colorUtil.rgbToRgba(color); + if (color.indexOf('#') === 0) return colorUtil.hexToRgba(color); + +}; + +/** + * Binds events to the root element for + */ +InkRippleCtrl.prototype.bindEvents = function () { + this.$element.on('mousedown', angular.bind(this, this.handleMousedown)); + this.$element.on('mouseup touchend', angular.bind(this, this.handleMouseup)); + this.$element.on('mouseleave', angular.bind(this, this.handleMouseup)); + this.$element.on('touchmove', angular.bind(this, this.handleTouchmove)); +}; + +/** + * Create a new ripple on every mousedown event from the root element + * @param event {MouseEvent} + */ +InkRippleCtrl.prototype.handleMousedown = function (event) { + if (this.mousedown) return; + + // When jQuery is loaded, we have to get the original event + if (event.hasOwnProperty('originalEvent')) event = event.originalEvent; + this.mousedown = true; + if (this.options.center) { + this.createRipple(this.container.prop('clientWidth') / 2, this.container.prop('clientWidth') / 2); + } else { + + // We need to calculate the relative coordinates if the target is a sublayer of the ripple element + if (event.srcElement !== this.$element[0]) { + var layerRect = this.$element[0].getBoundingClientRect(); + var layerX = event.clientX - layerRect.left; + var layerY = event.clientY - layerRect.top; + + this.createRipple(layerX, layerY); + } else { + this.createRipple(event.offsetX, event.offsetY); + } + } +}; + +/** + * Either remove or unlock any remaining ripples when the user mouses off of the element (either by + * mouseup, touchend or mouseleave event) + */ +InkRippleCtrl.prototype.handleMouseup = function () { + this.$timeout(function () { + autoCleanup(this, this.clearRipples); + }.bind(this)); +}; + +/** + * Either remove or unlock any remaining ripples when the user mouses off of the element (by + * touchmove) + */ +InkRippleCtrl.prototype.handleTouchmove = function () { + autoCleanup(this, this.deleteRipples); +}; + +/** + * Cycles through all ripples and attempts to remove them. + */ +InkRippleCtrl.prototype.deleteRipples = function () { + for (var i = 0; i < this.ripples.length; i++) { + this.ripples[ i ].remove(); + } +}; + +/** + * Cycles through all ripples and attempts to remove them with fade. + * Depending on logic within `fadeInComplete`, some removals will be postponed. + */ +InkRippleCtrl.prototype.clearRipples = function () { + for (var i = 0; i < this.ripples.length; i++) { + this.fadeInComplete(this.ripples[ i ]); + } +}; + +/** + * Creates the ripple container element + * @returns {*} + */ +InkRippleCtrl.prototype.createContainer = function () { + var container = angular.element('
    '); + this.$element.append(container); + return container; +}; + +InkRippleCtrl.prototype.clearTimeout = function () { + if (this.timeout) { + this.$timeout.cancel(this.timeout); + this.timeout = null; + } +}; + +InkRippleCtrl.prototype.isRippleAllowed = function () { + var element = this.$element[0]; + do { + if (!element.tagName || element.tagName === 'BODY') break; + + if (element && angular.isFunction(element.hasAttribute)) { + if (element.hasAttribute('disabled')) return false; + if (this.inkRipple() === 'false' || this.inkRipple() === '0') return false; + } + + } while (element = element.parentNode); + return true; +}; + +/** + * The attribute `md-ink-ripple` may be a static or interpolated + * color value OR a boolean indicator (used to disable ripples) + */ +InkRippleCtrl.prototype.inkRipple = function () { + return this.$element.attr('md-ink-ripple'); +}; + +/** + * Creates a new ripple and adds it to the container. Also tracks ripple in `this.ripples`. + * @param left + * @param top + */ +InkRippleCtrl.prototype.createRipple = function (left, top) { + if (!this.isRippleAllowed()) return; + + var ctrl = this; + var colorUtil = ctrl.$mdColorUtil; + var ripple = angular.element('
    '); + var width = this.$element.prop('clientWidth'); + var height = this.$element.prop('clientHeight'); + var x = Math.max(Math.abs(width - left), left) * 2; + var y = Math.max(Math.abs(height - top), top) * 2; + var size = getSize(this.options.fitRipple, x, y); + var color = this.calculateColor(); + + ripple.css({ + left: left + 'px', + top: top + 'px', + background: 'black', + width: size + 'px', + height: size + 'px', + backgroundColor: colorUtil.rgbaToRgb(color), + borderColor: colorUtil.rgbaToRgb(color) + }); + this.lastRipple = ripple; + + // we only want one timeout to be running at a time + this.clearTimeout(); + this.timeout = this.$timeout(function () { + ctrl.clearTimeout(); + if (!ctrl.mousedown) ctrl.fadeInComplete(ripple); + }, DURATION * 0.35, false); + + if (this.options.dimBackground) this.container.css({ backgroundColor: color }); + this.container.append(ripple); + this.ripples.push(ripple); + ripple.addClass('md-ripple-placed'); + + this.$mdUtil.nextTick(function () { + + ripple.addClass('md-ripple-scaled md-ripple-active'); + ctrl.$timeout(function () { + ctrl.clearRipples(); + }, DURATION, false); + + }, false); + + function getSize (fit, x, y) { + return fit + ? Math.max(x, y) + : Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); + } +}; + + + +/** + * After fadeIn finishes, either kicks off the fade-out animation or queues the element for removal on mouseup + * @param ripple + */ +InkRippleCtrl.prototype.fadeInComplete = function (ripple) { + if (this.lastRipple === ripple) { + if (!this.timeout && !this.mousedown) { + this.removeRipple(ripple); + } + } else { + this.removeRipple(ripple); + } +}; + +/** + * Kicks off the animation for removing a ripple + * @param ripple {Element} + */ +InkRippleCtrl.prototype.removeRipple = function (ripple) { + var ctrl = this; + var index = this.ripples.indexOf(ripple); + if (index < 0) return; + this.ripples.splice(this.ripples.indexOf(ripple), 1); + ripple.removeClass('md-ripple-active'); + ripple.addClass('md-ripple-remove'); + if (this.ripples.length === 0) this.container.css({ backgroundColor: '' }); + // use a 2-second timeout in order to allow for the animation to finish + // we don't actually care how long the animation takes + this.$timeout(function () { + ctrl.fadeOutComplete(ripple); + }, DURATION, false); +}; + +/** + * Removes the provided ripple from the DOM + * @param ripple + */ +InkRippleCtrl.prototype.fadeOutComplete = function (ripple) { + ripple.remove(); + this.lastRipple = null; +}; + +/** + * Used to create an empty directive. This is used to track flag-directives whose children may have + * functionality based on them. + * + * Example: `md-no-ink` will potentially be used by all child directives. + */ +function attrNoDirective () { + return { controller: angular.noop }; +} + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdTabInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-tabs. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultripple configuration + */ + + MdTabInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdTabInkRipple', MdTabInkRipple); + + function MdTabInkRipple($mdInkRipple) { + return { + attach: attach + }; + + function attach(scope, element, options) { + return $mdInkRipple.attach(scope, element, angular.extend({ + center: false, + dimBackground: true, + outline: false, + rippleSize: 'full' + }, options)); + } + } +})(); + +})(); +(function(){ +"use strict"; + +angular.module('material.core.theming.palette', []) +.constant('$mdColorPalette', { + 'red': { + '50': '#ffebee', + '100': '#ffcdd2', + '200': '#ef9a9a', + '300': '#e57373', + '400': '#ef5350', + '500': '#f44336', + '600': '#e53935', + '700': '#d32f2f', + '800': '#c62828', + '900': '#b71c1c', + 'A100': '#ff8a80', + 'A200': '#ff5252', + 'A400': '#ff1744', + 'A700': '#d50000', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 400 500 600 A100 A200 A400', + 'contrastStrongLightColors': '700 800 900 A700' + }, + 'pink': { + '50': '#fce4ec', + '100': '#f8bbd0', + '200': '#f48fb1', + '300': '#f06292', + '400': '#ec407a', + '500': '#e91e63', + '600': '#d81b60', + '700': '#c2185b', + '800': '#ad1457', + '900': '#880e4f', + 'A100': '#ff80ab', + 'A200': '#ff4081', + 'A400': '#f50057', + 'A700': '#c51162', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 400 A100 A200 A400', + // White on 500 does not meet the minimum 4.5 contrast ratio (at 4.34), + // but it's worse with a dark foreground (3.61). + 'contrastStrongLightColors': '500 600 700 800 900 A700' + }, + 'purple': { + '50': '#f3e5f5', + '100': '#e1bee7', + '200': '#ce93d8', + '300': '#ba68c8', + '400': '#ab47bc', + '500': '#9c27b0', + '600': '#8e24aa', + '700': '#7b1fa2', + '800': '#6a1b9a', + '900': '#4a148c', + 'A100': '#ea80fc', + 'A200': '#e040fb', + 'A400': '#d500f9', + 'A700': '#aa00ff', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100 A200 A400', + 'contrastStrongLightColors': '400 500 600 700 800 900 A700' + }, + 'deep-purple': { + '50': '#ede7f6', + '100': '#d1c4e9', + '200': '#b39ddb', + '300': '#9575cd', + '400': '#7e57c2', + '500': '#673ab7', + '600': '#5e35b1', + '700': '#512da8', + '800': '#4527a0', + '900': '#311b92', + 'A100': '#b388ff', + 'A200': '#7c4dff', + 'A400': '#651fff', + 'A700': '#6200ea', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100', + 'contrastStrongLightColors': '400 500 600 700 800 900 A200 A400 A700' + }, + 'indigo': { + '50': '#e8eaf6', + '100': '#c5cae9', + '200': '#9fa8da', + '300': '#7986cb', + '400': '#5c6bc0', + '500': '#3f51b5', + '600': '#3949ab', + '700': '#303f9f', + '800': '#283593', + '900': '#1a237e', + 'A100': '#8c9eff', + 'A200': '#536dfe', + 'A400': '#3d5afe', + 'A700': '#304ffe', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100 A200', + 'contrastStrongLightColors': '400 500 600 700 800 900 A400 A700' + }, + 'blue': { + '50': '#e3f2fd', + '100': '#bbdefb', + '200': '#90caf9', + '300': '#64b5f6', + '400': '#42a5f5', + '500': '#2196f3', + '600': '#1e88e5', + '700': '#1976d2', + '800': '#1565c0', + '900': '#0d47a1', + 'A100': '#82b1ff', + 'A200': '#448aff', + 'A400': '#2979ff', + 'A700': '#2962ff', + 'contrastDefaultColor': 'light', + // White on A400 does not meet the minimum 4.5 contrast ratio (at 3.98), + // but it's worse with a dark foreground (3.94). + 'contrastDarkColors': '50 100 200 300 400 500 600 A100 A200', + 'contrastStrongLightColors': '700 800 900 A400 A700' + }, + 'light-blue': { + '50': '#e1f5fe', + '100': '#b3e5fc', + '200': '#81d4fa', + '300': '#4fc3f7', + '400': '#29b6f6', + '500': '#03a9f4', + '600': '#039be5', + '700': '#0288d1', + '800': '#0277bd', + '900': '#01579b', + 'A100': '#80d8ff', + 'A200': '#40c4ff', + 'A400': '#00b0ff', + 'A700': '#0091ea', + 'contrastDefaultColor': 'dark', + // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.07), + // but it's worse with a white foreground (3.85). + 'contrastStrongLightColors': '800 900 A700' + }, + 'cyan': { + '50': '#e0f7fa', + '100': '#b2ebf2', + '200': '#80deea', + '300': '#4dd0e1', + '400': '#26c6da', + '500': '#00bcd4', + '600': '#00acc1', + '700': '#0097a7', + '800': '#00838f', + '900': '#006064', + 'A100': '#84ffff', + 'A200': '#18ffff', + 'A400': '#00e5ff', + 'A700': '#00b8d4', + 'contrastDefaultColor': 'dark', + // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.47), + // but it's worse with a white foreground (3.5). + 'contrastStrongLightColors': '800 900' + }, + 'teal': { + '50': '#e0f2f1', + '100': '#b2dfdb', + '200': '#80cbc4', + '300': '#4db6ac', + '400': '#26a69a', + '500': '#009688', + '600': '#00897b', + '700': '#00796b', + '800': '#00695c', + '900': '#004d40', + 'A100': '#a7ffeb', + 'A200': '#64ffda', + 'A400': '#1de9b6', + 'A700': '#00bfa5', + 'contrastDefaultColor': 'dark', + // Dark on 500 does not meet the minimum 4.5 contrast ratio (at 4.27), + // but it's worse with a white foreground (3.67). + // White on 600 does not meet the minimum 4.5 contrast ratio (at 4.31), + // but it's worse with a dark foreground (3.64). + 'contrastStrongLightColors': '600 700 800 900' + }, + 'green': { + '50': '#e8f5e9', + '100': '#c8e6c9', + '200': '#a5d6a7', + '300': '#81c784', + '400': '#66bb6a', + '500': '#4caf50', + '600': '#43a047', + '700': '#388e3c', + '800': '#2e7d32', + '900': '#1b5e20', + 'A100': '#b9f6ca', + 'A200': '#69f0ae', + 'A400': '#00e676', + 'A700': '#00c853', + 'contrastDefaultColor': 'dark', + // White on 700 does not meet the minimum 4.5 contrast ratio (at 4.11), + // but it's worse with a dark foreground (3.81). + 'contrastStrongLightColors': '700 800 900' + }, + 'light-green': { + '50': '#f1f8e9', + '100': '#dcedc8', + '200': '#c5e1a5', + '300': '#aed581', + '400': '#9ccc65', + '500': '#8bc34a', + '600': '#7cb342', + '700': '#689f38', + '800': '#558b2f', + '900': '#33691e', + 'A100': '#ccff90', + 'A200': '#b2ff59', + 'A400': '#76ff03', + 'A700': '#64dd17', + 'contrastDefaultColor': 'dark', + 'contrastStrongLightColors': '800 900' + }, + 'lime': { + '50': '#f9fbe7', + '100': '#f0f4c3', + '200': '#e6ee9c', + '300': '#dce775', + '400': '#d4e157', + '500': '#cddc39', + '600': '#c0ca33', + '700': '#afb42b', + '800': '#9e9d24', + '900': '#827717', + 'A100': '#f4ff81', + 'A200': '#eeff41', + 'A400': '#c6ff00', + 'A700': '#aeea00', + 'contrastDefaultColor': 'dark', + 'contrastStrongLightColors': '900' + }, + 'yellow': { + '50': '#fffde7', + '100': '#fff9c4', + '200': '#fff59d', + '300': '#fff176', + '400': '#ffee58', + '500': '#ffeb3b', + '600': '#fdd835', + '700': '#fbc02d', + '800': '#f9a825', + '900': '#f57f17', + 'A100': '#ffff8d', + 'A200': '#ffff00', + 'A400': '#ffea00', + 'A700': '#ffd600', + 'contrastDefaultColor': 'dark' + }, + 'amber': { + '50': '#fff8e1', + '100': '#ffecb3', + '200': '#ffe082', + '300': '#ffd54f', + '400': '#ffca28', + '500': '#ffc107', + '600': '#ffb300', + '700': '#ffa000', + '800': '#ff8f00', + '900': '#ff6f00', + 'A100': '#ffe57f', + 'A200': '#ffd740', + 'A400': '#ffc400', + 'A700': '#ffab00', + 'contrastDefaultColor': 'dark' + }, + 'orange': { + '50': '#fff3e0', + '100': '#ffe0b2', + '200': '#ffcc80', + '300': '#ffb74d', + '400': '#ffa726', + '500': '#ff9800', + '600': '#fb8c00', + '700': '#f57c00', + '800': '#ef6c00', + '900': '#e65100', + 'A100': '#ffd180', + 'A200': '#ffab40', + 'A400': '#ff9100', + 'A700': '#ff6d00', + 'contrastDefaultColor': 'dark', + 'contrastStrongLightColors': '900' + }, + 'deep-orange': { + '50': '#fbe9e7', + '100': '#ffccbc', + '200': '#ffab91', + '300': '#ff8a65', + '400': '#ff7043', + '500': '#ff5722', + '600': '#f4511e', + '700': '#e64a19', + '800': '#d84315', + '900': '#bf360c', + 'A100': '#ff9e80', + 'A200': '#ff6e40', + 'A400': '#ff3d00', + 'A700': '#dd2c00', + 'contrastDefaultColor': 'dark', + // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.01), + // but it's worse with a white foreground (3.91). + // White on 800 does not meet the minimum 4.5 contrast ratio (at 4.43), + // but it's worse with a dark foreground (3.54). + 'contrastStrongLightColors': '800 900 A400 A700', + }, + 'brown': { + '50': '#efebe9', + '100': '#d7ccc8', + '200': '#bcaaa4', + '300': '#a1887f', + '400': '#8d6e63', + '500': '#795548', + '600': '#6d4c41', + '700': '#5d4037', + '800': '#4e342e', + '900': '#3e2723', + 'A100': '#d7ccc8', + 'A200': '#bcaaa4', + 'A400': '#8d6e63', + 'A700': '#5d4037', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100 A200', + 'contrastStrongLightColors': '400 500 600 700 800 900 A400 A700' + }, + 'grey': { + '50': '#fafafa', + '100': '#f5f5f5', + '200': '#eeeeee', + '300': '#e0e0e0', + '400': '#bdbdbd', + '500': '#9e9e9e', + '600': '#757575', + '700': '#616161', + '800': '#424242', + '900': '#212121', + 'A100': '#ffffff', + 'A200': '#000000', + 'A400': '#303030', + 'A700': '#616161', + 'contrastDefaultColor': 'dark', + 'contrastLightColors': '700 800 900 A200 A400 A700', + 'contrastStrongLightColors': '600' + }, + 'blue-grey': { + '50': '#eceff1', + '100': '#cfd8dc', + '200': '#b0bec5', + '300': '#90a4ae', + '400': '#78909c', + '500': '#607d8b', + '600': '#546e7a', + '700': '#455a64', + '800': '#37474f', + '900': '#263238', + 'A100': '#cfd8dc', + 'A200': '#b0bec5', + 'A400': '#78909c', + 'A700': '#455a64', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 400 A100 A200 A400', + // White on 500 does not meet the minimum 4.5 contrast ratio (at 4.37), + // but it's worse with a dark foreground. + 'contrastStrongLightColors': '500 600 700 800 900 A700' + } +}); + +})(); +(function(){ +"use strict"; + +(function(angular) { + 'use strict'; +/** + * @ngdoc module + * @name material.core.theming + * @description + * Theming + */ +detectDisabledThemes.$inject = ["$mdThemingProvider"]; +ThemingDirective.$inject = ["$mdTheming", "$interpolate", "$parse", "$mdUtil", "$q", "$log"]; +ThemableDirective.$inject = ["$mdTheming"]; +ThemingProvider.$inject = ["$mdColorPalette", "$$mdMetaProvider"]; +generateAllThemes.$inject = ["$injector", "$mdTheming"]; +angular.module('material.core.theming', ['material.core.theming.palette', 'material.core.meta']) + .directive('mdTheme', ThemingDirective) + .directive('mdThemable', ThemableDirective) + .directive('mdThemesDisabled', disableThemesDirective) + .provider('$mdTheming', ThemingProvider) + .config(detectDisabledThemes) + .run(generateAllThemes); + +/** + * Detect if the HTML or the BODY tags has a [md-themes-disabled] attribute + * If yes, then immediately disable all theme stylesheet generation and DOM injection + */ +/** + * @ngInject + */ +function detectDisabledThemes($mdThemingProvider) { + var isDisabled = !!document.querySelector('[md-themes-disabled]'); + $mdThemingProvider.disableTheming(isDisabled); +} + +/** + * @ngdoc service + * @name $mdThemingProvider + * @module material.core.theming + * + * @description Provider to configure the `$mdTheming` service. + * + * ### Default Theme + * The `$mdThemingProvider` uses by default the following theme configuration: + * + * - Primary Palette: `Blue` + * - Accent Palette: `Pink` + * - Warn Palette: `Deep-Orange` + * - Background Palette: `Grey` + * + * If you don't want to use the `md-theme` directive on the elements itself, you may want to overwrite + * the default theme.
    + * This can be done by using the following markup. + * + * + * myAppModule.config(function($mdThemingProvider) { + * $mdThemingProvider + * .theme('default') + * .primaryPalette('blue') + * .accentPalette('teal') + * .warnPalette('red') + * .backgroundPalette('grey'); + * }); + * + * + + * ### Dynamic Themes + * + * By default, if you change a theme at runtime, the `$mdTheming` service will not detect those changes.
    + * If you have an application, which changes its theme on runtime, you have to enable theme watching. + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Enable theme watching. + * $mdThemingProvider.alwaysWatchTheme(true); + * }); + * + * + * ### Custom Theme Styles + * + * Sometimes you may want to use your own theme styles for some custom components.
    + * You are able to register your own styles by using the following markup. + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Register our custom stylesheet into the theming provider. + * $mdThemingProvider.registerStyles(STYLESHEET); + * }); + * + * + * The `registerStyles` method only accepts strings as value, so you're actually not able to load an external + * stylesheet file into the `$mdThemingProvider`. + * + * If it's necessary to load an external stylesheet, we suggest using a bundler, which supports including raw content, + * like [raw-loader](https://github.com/webpack/raw-loader) for `webpack`. + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Register your custom stylesheet into the theming provider. + * $mdThemingProvider.registerStyles(require('../styles/my-component.theme.css')); + * }); + * + * + * ### Browser color + * + * Enables browser header coloring + * for more info please visit: + * https://developers.google.com/web/fundamentals/design-and-ui/browser-customization/theme-color + * + * Options parameter:
    + * `theme` - A defined theme via `$mdThemeProvider` to use the palettes from. Default is `default` theme.
    + * `palette` - Can be any one of the basic material design palettes, extended defined palettes and 'primary', + * 'accent', 'background' and 'warn'. Default is `primary`.
    + * `hue` - The hue from the selected palette. Default is `800`
    + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Enable browser color + * $mdThemingProvider.enableBrowserColor({ + * theme: 'myTheme', // Default is 'default' + * palette: 'accent', // Default is 'primary', any basic material palette and extended palettes are available + * hue: '200' // Default is '800' + * }); + * }); + * + */ + +/** + * Some Example Valid Theming Expressions + * ======================================= + * + * Intention group expansion: (valid for primary, accent, warn, background) + * + * {{primary-100}} - grab shade 100 from the primary palette + * {{primary-100-0.7}} - grab shade 100, apply opacity of 0.7 + * {{primary-100-contrast}} - grab shade 100's contrast color + * {{primary-hue-1}} - grab the shade assigned to hue-1 from the primary palette + * {{primary-hue-1-0.7}} - apply 0.7 opacity to primary-hue-1 + * {{primary-color}} - Generates .md-hue-1, .md-hue-2, .md-hue-3 with configured shades set for each hue + * {{primary-color-0.7}} - Apply 0.7 opacity to each of the above rules + * {{primary-contrast}} - Generates .md-hue-1, .md-hue-2, .md-hue-3 with configured contrast (ie. text) color shades set for each hue + * {{primary-contrast-0.7}} - Apply 0.7 opacity to each of the above rules + * {{primary-contrast-divider}} - Apply divider opacity to contrast color + * + * Foreground expansion: Applies rgba to black/white foreground text + * + * Old Foreground Expressions: + * {{foreground-1}} - used for primary text + * {{foreground-2}} - used for secondary text/divider + * {{foreground-3}} - used for disabled text + * {{foreground-4}} - used for dividers + * + * New Foreground Expressions: + * + * Apply primary text color for contrasting with default background + * {{background-default-contrast}} - default opacity + * {{background-default-contrast-secondary}} - opacity for secondary text + * {{background-default-contrast-hint}} - opacity for hints and placeholders + * {{background-default-contrast-disabled}} - opacity for disabled text + * {{background-default-contrast-divider}} - opacity for dividers + * + * Apply contrast color for specific shades + * {{background-50-contrast-icon}} - Apply contrast color for icon on background's shade 50 hue + */ + +// In memory generated CSS rules; registered by theme.name +var GENERATED = { }; + +// In memory storage of defined themes and color palettes (both loaded by CSS, and user specified) +var PALETTES; + +// Text colors are automatically generated based on background color when not specified +// Custom palettes can provide override colors +// @see https://material.io/archive/guidelines/style/color.html#color-usability +var DARK_FOREGROUND = { + name: 'dark', +}; +var LIGHT_FOREGROUND = { + name: 'light', +}; + +var DARK_SHADOW = '1px 1px 0px rgba(0,0,0,0.4), -1px -1px 0px rgba(0,0,0,0.4)'; +var LIGHT_SHADOW = ''; + +var DARK_CONTRAST_COLOR = colorToRgbaArray('rgba(0,0,0,0.87)'); +var LIGHT_CONTRAST_COLOR = colorToRgbaArray('rgba(255,255,255,0.87)'); +var STRONG_LIGHT_CONTRAST_COLOR = colorToRgbaArray('rgb(255,255,255)'); + +var THEME_COLOR_TYPES = ['primary', 'accent', 'warn', 'background']; +var DEFAULT_COLOR_TYPE = 'primary'; + +// A color in a theme will use these hues by default, if not specified by user. +var LIGHT_DEFAULT_HUES = { + 'accent': { + 'default': 'A200', + 'hue-1': 'A100', + 'hue-2': 'A400', + 'hue-3': 'A700' + }, + 'background': { + 'default': '50', + 'hue-1': 'A100', + 'hue-2': '100', + 'hue-3': '300' + } +}; + +var DARK_DEFAULT_HUES = { + 'background': { + 'default': 'A400', + 'hue-1': '800', + 'hue-2': '900', + 'hue-3': 'A200' + } +}; + +// Icon opacity values (active/inactive) from +// https://material.io/archive/guidelines/style/color.html#color-usability +var DARK_CONTRAST_OPACITY = { + 'icon': 0.54, + 'secondary': 0.54, + 'disabled': 0.38, + 'hint': 0.38, + 'divider': 0.12, +}; + +var LIGHT_CONTRAST_OPACITY = { + 'icon': 0.87, + 'secondary': 0.7, + 'disabled': 0.5, + 'hint': 0.5, + 'divider': 0.12 +}; + +// Icon opacity values (active/inactive) from +// https://material.io/archive/guidelines/style/color.html#color-usability +var STRONG_LIGHT_CONTRAST_OPACITY = { + 'icon': 1.0, + 'secondary': 0.7, + 'disabled': 0.5, + 'hint': 0.5, + 'divider': 0.12 +}; + +THEME_COLOR_TYPES.forEach(function(colorType) { + // Color types with unspecified default hues will use these default hue values + var defaultDefaultHues = { + 'default': '500', + 'hue-1': '300', + 'hue-2': '800', + 'hue-3': 'A100' + }; + if (!LIGHT_DEFAULT_HUES[colorType]) LIGHT_DEFAULT_HUES[colorType] = defaultDefaultHues; + if (!DARK_DEFAULT_HUES[colorType]) DARK_DEFAULT_HUES[colorType] = defaultDefaultHues; +}); + +var VALID_HUE_VALUES = [ + '50', '100', '200', '300', '400', '500', '600', + '700', '800', '900', 'A100', 'A200', 'A400', 'A700' +]; + +var themeConfig = { + disableTheming : false, // Generate our themes at run time; also disable stylesheet DOM injection + generateOnDemand : false, // Whether or not themes are to be generated on-demand (vs. eagerly). + registeredStyles : [], // Custom styles registered to be used in the theming of custom components. + nonce : null // Nonce to be added as an attribute to the generated themes style tags. +}; + +/** + * + */ +function ThemingProvider($mdColorPalette, $$mdMetaProvider) { + ThemingService.$inject = ["$rootScope", "$mdUtil", "$q", "$log"]; + PALETTES = { }; + var THEMES = { }; + + var themingProvider; + + var alwaysWatchTheme = false; + var defaultTheme = 'default'; + + // Load JS Defined Palettes + angular.extend(PALETTES, $mdColorPalette); + + // Default theme defined in core.js + + /** + * Adds `theme-color` and `msapplication-navbutton-color` meta tags with the color parameter + * @param {string} color Hex value of the wanted browser color + * @returns {function} Remove function of the meta tags + */ + var setBrowserColor = function (color) { + // Chrome, Firefox OS and Opera + var removeChrome = $$mdMetaProvider.setMeta('theme-color', color); + // Windows Phone + var removeWindows = $$mdMetaProvider.setMeta('msapplication-navbutton-color', color); + + return function () { + removeChrome(); + removeWindows(); + }; + }; + + /** + * @ngdoc method + * @name $mdThemingProvider#enableBrowserColor + * @description + * Enables browser header coloring. For more info please visit + * + * Web Fundamentals. + * @param {object=} options Options for the browser color, which include:
    + * - `theme` - `{string}`: A defined theme via `$mdThemeProvider` to use the palettes from. Default is `default` theme.
    + * - `palette` - `{string}`: Can be any one of the basic material design palettes, extended defined palettes, or `primary`, + * `accent`, `background`, and `warn`. Default is `primary`.
    + * - `hue` - `{string}`: The hue from the selected palette. Default is `800`.
    + * @returns {function} Function that removes the browser coloring when called. + */ + var enableBrowserColor = function (options) { + options = angular.isObject(options) ? options : {}; + + var theme = options.theme || 'default'; + var hue = options.hue || '800'; + + var palette = PALETTES[options.palette] || + PALETTES[THEMES[theme].colors[options.palette || 'primary'].name]; + + var color = angular.isObject(palette[hue]) ? palette[hue].hex : palette[hue]; + if (color.substr(0, 1) !== '#') color = '#' + color; + + return setBrowserColor(color); + }; + + return themingProvider = { + definePalette: definePalette, + extendPalette: extendPalette, + theme: registerTheme, + + /** + * return a read-only clone of the current theme configuration + */ + configuration : function() { + return angular.extend({ }, themeConfig, { + defaultTheme : defaultTheme, + alwaysWatchTheme : alwaysWatchTheme, + registeredStyles : [].concat(themeConfig.registeredStyles) + }); + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#disableTheming + * @description + * An easier way to disable theming without having to use `.constant("$MD_THEME_CSS","");`. + * This disables all dynamic theme style sheet generations and injections. + * @param {boolean=} isDisabled Disable all dynamic theme style sheet generations and injections + * if `true` or `undefined`. + */ + disableTheming: function(isDisabled) { + themeConfig.disableTheming = angular.isUndefined(isDisabled) || !!isDisabled; + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#registerStyles + * @param {string} styles The styles to be appended to AngularJS Material's built in theme CSS. + */ + registerStyles: function(styles) { + themeConfig.registeredStyles.push(styles); + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#setNonce + * @param {string} nonceValue The nonce to be added as an attribute to the theme style tags. + * Setting a value allows the use of CSP policy without using the `'unsafe-inline'` directive. + * The string must already be base64 encoded. You can use `btoa(string)` to do this encoding. + * In your CSP's `style-src`, you would then add an entry for `'nonce-nonceValue'`. + */ + setNonce: function(nonceValue) { + themeConfig.nonce = nonceValue; + }, + + generateThemesOnDemand: function(onDemand) { + themeConfig.generateOnDemand = onDemand; + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#setDefaultTheme + * @param {string} theme Default theme name to be applied to elements. + * Default value is `default`. + */ + setDefaultTheme: function(theme) { + defaultTheme = theme; + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#alwaysWatchTheme + * @param {boolean} alwaysWatch Whether or not to always watch themes for changes and re-apply + * classes when they change. Default is `false`. Enabling can reduce performance. + */ + alwaysWatchTheme: function(alwaysWatch) { + alwaysWatchTheme = alwaysWatch; + }, + + enableBrowserColor: enableBrowserColor, + + $get: ThemingService, + _LIGHT_DEFAULT_HUES: LIGHT_DEFAULT_HUES, + _DARK_DEFAULT_HUES: DARK_DEFAULT_HUES, + _PALETTES: PALETTES, + _THEMES: THEMES, + _parseRules: parseRules, + _rgba: rgba + }; + + /** + * @ngdoc method + * @name $mdThemingProvider#definePalette + * @description + * In the event that you need to define a custom color palette, you can use this function to + * make it available to your theme for use in its intention groups.
    + * Note that you must specify all hues in the definition map. + * @param {string} name Name of palette being defined + * @param {object} map Palette definition that includes hue definitions and contrast colors: + * - `'50'` - `{string}`: HEX color + * - `'100'` - `{string}`: HEX color + * - `'200'` - `{string}`: HEX color + * - `'300'` - `{string}`: HEX color + * - `'400'` - `{string}`: HEX color + * - `'500'` - `{string}`: HEX color + * - `'600'` - `{string}`: HEX color + * - `'700'` - `{string}`: HEX color + * - `'800'` - `{string}`: HEX color + * - `'900'` - `{string}`: HEX color + * - `'A100'` - `{string}`: HEX color + * - `'A200'` - `{string}`: HEX color + * - `'A400'` - `{string}`: HEX color + * - `'A700'` - `{string}`: HEX color + * - `'contrastDefaultColor'` - `{string}`: `light` or `dark` + * - `'contrastDarkColors'` - `{string[]}`: Hues which should use dark contrast colors (i.e. raised button text). + * For example: `['50', '100', '200', '300', '400', 'A100']`. + * - `'contrastLightColors'` - `{string[]}`: Hues which should use light contrast colors (i.e. raised button text). + * For example: `['500', '600', '700', '800', '900', 'A200', 'A400', 'A700']`. + */ + function definePalette(name, map) { + map = map || {}; + PALETTES[name] = checkPaletteValid(name, map); + return themingProvider; + } + + /** + * @ngdoc method + * @name $mdThemingProvider#extendPalette + * @description + * Sometimes it is easier to extend an existing color palette and then change a few properties, + * rather than defining a whole new palette. + * @param {string} name Name of palette being extended + * @param {object} map Palette definition that includes optional hue definitions and contrast colors: + * - `'50'` - `{string}`: HEX color + * - `'100'` - `{string}`: HEX color + * - `'200'` - `{string}`: HEX color + * - `'300'` - `{string}`: HEX color + * - `'400'` - `{string}`: HEX color + * - `'500'` - `{string}`: HEX color + * - `'600'` - `{string}`: HEX color + * - `'700'` - `{string}`: HEX color + * - `'800'` - `{string}`: HEX color + * - `'900'` - `{string}`: HEX color + * - `'A100'` - `{string}`: HEX color + * - `'A200'` - `{string}`: HEX color + * - `'A400'` - `{string}`: HEX color + * - `'A700'` - `{string}`: HEX color + * - `'contrastDefaultColor'` - `{string}`: `light` or `dark` + * - `'contrastDarkColors'` - `{string[]}`: Hues which should use dark contrast colors (i.e. raised button text). + * For example: `['50', '100', '200', '300', '400', 'A100']`. + * - `'contrastLightColors'` - `{string[]}`: Hues which should use light contrast colors (i.e. raised button text). + * For example: `['500', '600', '700', '800', '900', 'A200', 'A400', 'A700']`. + * @returns {object} A new object which is a copy of the given palette, `name`, + * with variables from `map` overwritten. + */ + function extendPalette(name, map) { + return checkPaletteValid(name, angular.extend({}, PALETTES[name] || {}, map)); + } + + // Make sure that palette has all required hues + function checkPaletteValid(name, map) { + var missingColors = VALID_HUE_VALUES.filter(function(field) { + return !map[field]; + }); + if (missingColors.length) { + throw new Error("Missing colors %1 in palette %2!" + .replace('%1', missingColors.join(', ')) + .replace('%2', name)); + } + + return map; + } + + /** + * @ngdoc method + * @name $mdThemingProvider#theme + * @description + * Register a theme (which is a collection of color palettes); i.e. `warn`, `accent`, + * `background`, and `primary`.
    + * Optionally inherit from an existing theme. + * @param {string} name Name of theme being registered + * @param {string=} inheritFrom Existing theme name to inherit from + */ + function registerTheme(name, inheritFrom) { + if (THEMES[name]) return THEMES[name]; + + inheritFrom = inheritFrom || 'default'; + + var parentTheme = typeof inheritFrom === 'string' ? THEMES[inheritFrom] : inheritFrom; + var theme = new Theme(name); + + if (parentTheme) { + angular.forEach(parentTheme.colors, function(color, colorType) { + theme.colors[colorType] = { + name: color.name, + // Make sure a COPY of the hues is given to the child color, + // not the same reference. + hues: angular.extend({}, color.hues) + }; + }); + } + THEMES[name] = theme; + + return theme; + } + + function Theme(name) { + var self = this; + self.name = name; + self.colors = {}; + + self.dark = setDark; + setDark(false); + + function setDark(isDark) { + isDark = arguments.length === 0 ? true : !!isDark; + + // If no change, abort + if (isDark === self.isDark) return; + + self.isDark = isDark; + + self.foregroundPalette = self.isDark ? LIGHT_FOREGROUND : DARK_FOREGROUND; + self.foregroundShadow = self.isDark ? DARK_SHADOW : LIGHT_SHADOW; + + // Light and dark themes have different default hues. + // Go through each existing color type for this theme, and for every + // hue value that is still the default hue value from the previous light/dark setting, + // set it to the default hue value from the new light/dark setting. + var newDefaultHues = self.isDark ? DARK_DEFAULT_HUES : LIGHT_DEFAULT_HUES; + var oldDefaultHues = self.isDark ? LIGHT_DEFAULT_HUES : DARK_DEFAULT_HUES; + angular.forEach(newDefaultHues, function(newDefaults, colorType) { + var color = self.colors[colorType]; + var oldDefaults = oldDefaultHues[colorType]; + if (color) { + for (var hueName in color.hues) { + if (color.hues[hueName] === oldDefaults[hueName]) { + color.hues[hueName] = newDefaults[hueName]; + } + } + } + }); + + return self; + } + + THEME_COLOR_TYPES.forEach(function(colorType) { + var defaultHues = (self.isDark ? DARK_DEFAULT_HUES : LIGHT_DEFAULT_HUES)[colorType]; + self[colorType + 'Palette'] = function setPaletteType(paletteName, hues) { + var color = self.colors[colorType] = { + name: paletteName, + hues: angular.extend({}, defaultHues, hues) + }; + + Object.keys(color.hues).forEach(function(name) { + if (!defaultHues[name]) { + throw new Error("Invalid hue name '%1' in theme %2's %3 color %4. Available hue names: %4" + .replace('%1', name) + .replace('%2', self.name) + .replace('%3', paletteName) + .replace('%4', Object.keys(defaultHues).join(', ')) + ); + } + }); + Object.keys(color.hues).map(function(key) { + return color.hues[key]; + }).forEach(function(hueValue) { + if (VALID_HUE_VALUES.indexOf(hueValue) === -1) { + throw new Error("Invalid hue value '%1' in theme %2's %3 color %4. Available hue values: %5" + .replace('%1', hueValue) + .replace('%2', self.name) + .replace('%3', colorType) + .replace('%4', paletteName) + .replace('%5', VALID_HUE_VALUES.join(', ')) + ); + } + }); + return self; + }; + }); + } + + /** + * @ngdoc service + * @name $mdTheming + * @module material.core.theming + * @description + * Service that makes an element apply theming related classes to itself. + * + * For more information on the hue objects, their default values, as well as valid hue values, please visit the custom hues section of Configuring a Theme. + * + * + * // Example component directive that we want to apply theming classes to. + * app.directive('myFancyDirective', function($mdTheming) { + * return { + * restrict: 'AE', + * link: function(scope, element, attrs) { + * // Initialize the service using our directive's element + * $mdTheming(element); + * + * $mdTheming.defineTheme('myTheme', { + * primary: 'blue', + * primaryHues: { + * default: '500', + * hue-1: '300', + * hue-2: '900', + * hue-3: 'A100' + * }, + * accent: 'pink', + * accentHues: { + * default: '600', + * hue-1: '300', + * hue-2: '200', + * hue-3: 'A500' + * }, + * warn: 'red', + * // It's not necessary to specify all hues in the object. + * warnHues: { + * default: '200', + * hue-3: 'A100' + * }, + * // It's not necessary to specify custom hues at all. + * background: 'grey', + * dark: true + * }); + * // Your directive's custom code here. + * } + * }; + * }); + * + * @param {element=} element Element that will have theming classes applied to it. + */ + + /** + * @ngdoc property + * @name $mdTheming#THEMES + * @description + * Property to get all the themes defined + * @returns {object} All the themes defined with their properties. + */ + + /** + * @ngdoc property + * @name $mdTheming#PALETTES + * @description + * Property to get all the palettes defined + * @returns {object} All the palettes defined with their colors. + */ + + /** + * @ngdoc method + * @name $mdTheming#registered + * @description + * Determine is specified theme name is a valid, registered theme + * @param {string} themeName the theme to check if registered + * @returns {boolean} whether the theme is registered or not + */ + + /** + * @ngdoc method + * @name $mdTheming#defaultTheme + * @description + * Returns the default theme + * @returns {string} The default theme + */ + + /** + * @ngdoc method + * @name $mdTheming#generateTheme + * @description + * Lazy generate themes - by default, every theme is generated when defined. + * You can disable this in the configuration section using the + * `$mdThemingProvider.generateThemesOnDemand(true);` + * + * The theme name that is passed in must match the name of the theme that was defined as part of + * the configuration block. + * + * @param {string} name theme name to generate + */ + + /** + * @ngdoc method + * @name $mdTheming#setBrowserColor + * @description + * Enables browser header coloring. For more info please visit + * + * Web Fundamentals. + * @param {object=} options Options for the browser color, which include:
    + * - `theme` - `{string}`: A defined theme via `$mdThemeProvider` to use the palettes from. + * Default is `default` theme.
    + * - `palette` - `{string}`: Can be any one of the basic material design palettes, extended + * defined palettes, or `primary`, `accent`, `background`, and `warn`. Default is `primary`. + *
    + * - `hue` - `{string}`: The hue from the selected palette. Default is `800`.
    + * @returns {function} Function that removes the browser coloring when called. + */ + + /** + * @ngdoc method + * @name $mdTheming#defineTheme + * @description + * Dynamically define a theme by using an options object that contains palette names. + * + * @param {string} name Theme name to define + * @param {object} options Theme definition options + * + * Options are:
    + * - `primary` - `{string}`: The name of the primary palette to use in the theme.
    + * - `primaryHues` - `{object=}`: Override hues for primary palette.
    + * - `accent` - `{string}`: The name of the accent palette to use in the theme.
    + * - `accentHues` - `{object=}`: Override hues for accent palette.
    + * - `warn` - `{string}`: The name of the warn palette to use in the theme.
    + * - `warnHues` - `{object=}`: Override hues for warn palette.
    + * - `background` - `{string}`: The name of the background palette to use in the theme.
    + * - `backgroundHues` - `{object=}`: Override hues for background palette.
    + * - `dark` - `{boolean}`: Indicates if it's a dark theme.
    + * @returns {Promise} A resolved promise with the new theme name. + */ + + /* @ngInject */ + function ThemingService($rootScope, $mdUtil, $q, $log) { + // Allow us to be invoked via a linking function signature. + var applyTheme = function (scope, el) { + if (el === undefined) { el = scope; scope = undefined; } + if (scope === undefined) { scope = $rootScope; } + applyTheme.inherit(el, el); + }; + + Object.defineProperty(applyTheme, 'THEMES', { + get: function () { + return angular.extend({}, THEMES); + } + }); + Object.defineProperty(applyTheme, 'PALETTES', { + get: function () { + return angular.extend({}, PALETTES); + } + }); + Object.defineProperty(applyTheme, 'ALWAYS_WATCH', { + get: function () { + return alwaysWatchTheme; + } + }); + applyTheme.inherit = inheritTheme; + applyTheme.registered = registered; + applyTheme.defaultTheme = function() { return defaultTheme; }; + applyTheme.generateTheme = function(name) { generateTheme(THEMES[name], name, themeConfig.nonce); }; + applyTheme.defineTheme = function(name, options) { + options = options || {}; + + var theme = registerTheme(name); + + if (options.primary) { + theme.primaryPalette(options.primary, options.primaryHues); + } + if (options.accent) { + theme.accentPalette(options.accent, options.accentHues); + } + if (options.warn) { + theme.warnPalette(options.warn, options.warnHues); + } + if (options.background) { + theme.backgroundPalette(options.background, options.backgroundHues); + } + if (options.dark){ + theme.dark(); + } + + this.generateTheme(name); + + return $q.resolve(name); + }; + applyTheme.setBrowserColor = enableBrowserColor; + + return applyTheme; + + /** + * Determine is specified theme name is a valid, registered theme + */ + function registered(themeName) { + if (themeName === undefined || themeName === '') return true; + return applyTheme.THEMES[themeName] !== undefined; + } + + /** + * Get theme name for the element, then update with Theme CSS class + */ + function inheritTheme (el, parent) { + var ctrl = parent.controller('mdTheme') || el.data('$mdThemeController'); + var scope = el.scope(); + + updateThemeClass(lookupThemeName()); + + if (ctrl) { + var watchTheme = alwaysWatchTheme || + ctrl.$shouldWatch || + $mdUtil.parseAttributeBoolean(el.attr('md-theme-watch')); + + if (watchTheme || ctrl.isAsyncTheme) { + var clearNameWatcher = function () { + if (unwatch) { + unwatch(); + unwatch = undefined; + } + }; + + var unwatch = ctrl.registerChanges(function(name) { + updateThemeClass(name); + + if (!watchTheme) { + clearNameWatcher(); + } + }); + + if (scope) { + scope.$on('$destroy', clearNameWatcher); + } else { + el.on('$destroy', clearNameWatcher); + } + } + } + + /** + * Find the theme name from the parent controller or element data + */ + function lookupThemeName() { + // As a few components (dialog) add their controllers later, we should also watch for a controller init. + return ctrl && ctrl.$mdTheme || (defaultTheme === 'default' ? '' : defaultTheme); + } + + /** + * Remove old theme class and apply a new one + * NOTE: if not a valid theme name, then the current name is not changed + */ + function updateThemeClass(theme) { + if (!theme) return; + if (!registered(theme)) { + $log.warn('Attempted to use unregistered theme \'' + theme + '\'. ' + + 'Register it with $mdThemingProvider.theme().'); + } + + var oldTheme = el.data('$mdThemeName'); + if (oldTheme) el.removeClass('md-' + oldTheme +'-theme'); + el.addClass('md-' + theme + '-theme'); + el.data('$mdThemeName', theme); + if (ctrl) { + el.data('$mdThemeController', ctrl); + } + } + } + + } +} + +function ThemingDirective($mdTheming, $interpolate, $parse, $mdUtil, $q, $log) { + return { + priority: 101, // has to be more than 100 to be before interpolation (issue on IE) + link: { + pre: function(scope, el, attrs) { + var registeredCallbacks = []; + + var startSymbol = $interpolate.startSymbol(); + var endSymbol = $interpolate.endSymbol(); + + var theme = attrs.mdTheme.trim(); + + var hasInterpolation = + theme.substr(0, startSymbol.length) === startSymbol && + theme.lastIndexOf(endSymbol) === theme.length - endSymbol.length; + + var oneTimeOperator = '::'; + var oneTimeBind = attrs.mdTheme + .split(startSymbol).join('') + .split(endSymbol).join('') + .trim() + .substr(0, oneTimeOperator.length) === oneTimeOperator; + + var getTheme = function () { + var interpolation = $interpolate(attrs.mdTheme)(scope); + return $parse(interpolation)(scope) || interpolation; + }; + + var ctrl = { + isAsyncTheme: angular.isFunction(getTheme()) || angular.isFunction(getTheme().then), + registerChanges: function (cb, context) { + if (context) { + cb = angular.bind(context, cb); + } + + registeredCallbacks.push(cb); + + return function () { + var index = registeredCallbacks.indexOf(cb); + + if (index > -1) { + registeredCallbacks.splice(index, 1); + } + }; + }, + $setTheme: function (theme) { + if (!$mdTheming.registered(theme)) { + $log.warn('attempted to use unregistered theme \'' + theme + '\''); + } + + ctrl.$mdTheme = theme; + + // Iterating backwards to support unregistering during iteration + // http://stackoverflow.com/a/9882349/890293 + // we don't use `reverse()` of array because it mutates the array and we don't want it + // to get re-indexed + for (var i = registeredCallbacks.length; i--;) { + registeredCallbacks[i](theme); + } + }, + $shouldWatch: $mdUtil.parseAttributeBoolean(el.attr('md-theme-watch')) || + $mdTheming.ALWAYS_WATCH || + (hasInterpolation && !oneTimeBind) + }; + + el.data('$mdThemeController', ctrl); + + var setParsedTheme = function (theme) { + if (typeof theme === 'string') { + return ctrl.$setTheme(theme); + } + + $q.when(angular.isFunction(theme) ? theme() : theme) + .then(function(name) { + ctrl.$setTheme(name); + }); + }; + + setParsedTheme(getTheme()); + + var unwatch = scope.$watch(getTheme, function(theme) { + if (theme) { + setParsedTheme(theme); + + if (!ctrl.$shouldWatch) { + unwatch(); + } + } + }); + } + } + }; +} + +/** + * Special directive that will disable ALL runtime Theme style generation and DOM injection + * + * + * + * + * + * ... + * + * + * Note: Using md-themes-css directive requires the developer to load external + * theme stylesheets; e.g. custom themes from Material-Tools: + * + * `angular-material.themes.css` + * + * Another option is to use the ThemingProvider to configure and disable the attribute + * conversions; this would obviate the use of the `md-themes-css` directive + * + */ +function disableThemesDirective() { + themeConfig.disableTheming = true; + + // Return a 1x-only, first-match attribute directive + return { + restrict : 'A', + priority : '900' + }; +} + +function ThemableDirective($mdTheming) { + return $mdTheming; +} + +function parseRules(theme, colorType, rules) { + checkValidPalette(theme, colorType); + + rules = rules.replace(/THEME_NAME/g, theme.name); + var themeNameRegex = new RegExp('\\.md-' + theme.name + '-theme', 'g'); + // Matches '{{ primary-color }}', etc + var hueRegex = new RegExp('([\'"])?{{\\s*([a-zA-Z]+)-?(color|default)?-?(contrast)?-?((?:\\d\\.?\\d*)|(?:[a-zA-Z]+))?\\s*}}(["\'])?','g'); + var simpleVariableRegex = /'?"?{{\s*([a-zA-Z]+)-(A?\d+|hue-[0-3]|shadow|default)-?(contrast)?-?((?:\d\.?\d*)|(?:[a-zA-Z]+))?\s*}}'?"?/g; + var defaultBgHue = theme.colors['background'].hues['default']; + var defaultBgContrastType = PALETTES[theme.colors['background'].name][defaultBgHue].contrastType; + + // find and replace simple variables where we use a specific hue, not an entire palette + // eg. "{{primary-100}}" + // \(' + THEME_COLOR_TYPES.join('\|') + '\)' + rules = rules.replace(simpleVariableRegex, function(match, colorType, hue, contrast, opacity) { + var regexColorType = colorType; + if (colorType === 'foreground') { + if (hue === 'shadow') { + return theme.foregroundShadow; + } else if (theme.foregroundPalette[hue]) { + // Use user defined palette number (ie: foreground-2) + return rgba(colorToRgbaArray(theme.foregroundPalette[hue])); + } else if (theme.foregroundPalette['1']){ + return rgba(colorToRgbaArray(theme.foregroundPalette['1'])); + } + // Default to background-default-contrast-{opacity} + colorType = 'background'; + contrast = 'contrast'; + if (!opacity && hue) { + // Convert references to legacy hues to opacities (i.e. foreground-4 to *-divider) + switch (hue) { + // hue-1 uses default opacity + case '2': + opacity = 'secondary'; + break; + case '3': + opacity = 'disabled'; + break; + case '4': + opacity = 'divider'; + } + } + hue = 'default'; + } + + // `default` is also accepted as a hue-value, because the background palettes are + // using it as a name for the default hue. + if (hue.indexOf('hue') === 0 || hue === 'default') { + hue = theme.colors[colorType].hues[hue]; + } + + var colorDetails = (PALETTES[ theme.colors[colorType].name ][hue] || ''); + + // If user has specified a foreground color, use those + if (colorType === 'background' && contrast && regexColorType !== 'foreground' && + colorDetails.contrastType === defaultBgContrastType) { + // Don't process if colorType was changed + switch (opacity) { + case 'secondary': + case 'icon': + if (theme.foregroundPalette['2']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['2'])); + } + break; + case 'disabled': + case 'hint': + if (theme.foregroundPalette['3']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['3'])); + } + break; + case 'divider': + if (theme.foregroundPalette['4']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['4'])); + } + break; + default: + if (theme.foregroundPalette['1']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['1'])); + } + break; + } + } + + if (contrast && opacity) { + opacity = colorDetails.opacity[opacity] || opacity; + } + + return rgba(colorDetails[contrast ? 'contrast' : 'value'], opacity); + }); + + var generatedRules = []; + + // For each type, generate rules for each hue (ie. default, md-hue-1, md-hue-2, md-hue-3) + angular.forEach(['default', 'hue-1', 'hue-2', 'hue-3'], function(hueName) { + var newRule = rules + .replace(hueRegex, function(match, _, matchedColorType, hueType, contrast, opacity) { + var color = theme.colors[matchedColorType]; + var palette = PALETTES[color.name]; + var hueValue = color.hues[hueName]; + if (contrast && opacity) { + opacity = palette[hueValue].opacity[opacity] || opacity; + } + return rgba(palette[hueValue][hueType === 'color' ? 'value' : 'contrast'], opacity); + }); + if (hueName !== 'default') { + newRule = newRule.replace(themeNameRegex, '.md-' + theme.name + '-theme.md-' + hueName); + } + + // Don't apply a selector rule to the default theme, making it easier to override + // styles of the base-component + if (theme.name === 'default') { + var themeRuleRegex = /((?:\s|>|\.|\w|-|:|\(|\)|\[|]|"|'|=)*)\.md-default-theme((?:\s|>|\.|\w|-|:|\(|\)|\[|]|"|'|=)*)/g; + + newRule = newRule.replace(themeRuleRegex, function(match, start, end) { + return match + ', ' + start + end; + }); + } + generatedRules.push(newRule); + }); + + return generatedRules; +} + +var rulesByType = {}; + +// Generate our themes at run time given the state of THEMES and PALETTES +function generateAllThemes($injector, $mdTheming) { + var head = document.head; + var firstChild = head ? head.firstElementChild : null; + var themeCss = !themeConfig.disableTheming && $injector.has('$MD_THEME_CSS') ? $injector.get('$MD_THEME_CSS') : ''; + + // Append our custom registered styles to the theme stylesheet. + themeCss += themeConfig.registeredStyles.join(''); + + if (!firstChild) return; + if (themeCss.length === 0) return; // no rules, so no point in running this expensive task + + // Expose contrast colors for palettes to ensure that text is always readable + angular.forEach(PALETTES, sanitizePalette); + + // MD_THEME_CSS is a string generated by the build process that includes all the themeable + // components as templates + + // Break the CSS into individual rules + var rules = splitCss(themeCss).map(function(rule) { + return rule.trim(); + }); + + THEME_COLOR_TYPES.forEach(function(type) { + rulesByType[type] = ''; + }); + + // Sort the rules based on type, allowing us to do color substitution on a per-type basis + rules.forEach(function(rule) { + // First: test that if the rule has '.md-accent', it goes into the accent set of rules + for (var i = 0, type; type = THEME_COLOR_TYPES[i]; i++) { + if (rule.indexOf('.md-' + type) > -1) { + return rulesByType[type] += rule; + } + } + + // If no eg 'md-accent' class is found, try to just find 'accent' in the rule and guess from + // there + for (i = 0; type = THEME_COLOR_TYPES[i]; i++) { + if (rule.indexOf(type) > -1) { + return rulesByType[type] += rule; + } + } + + // Default to the primary array + return rulesByType[DEFAULT_COLOR_TYPE] += rule; + }); + + // If themes are being generated on-demand, quit here. The user will later manually + // call generateTheme to do this on a theme-by-theme basis. + if (themeConfig.generateOnDemand) return; + + angular.forEach($mdTheming.THEMES, function(theme) { + if (!GENERATED[theme.name] && !($mdTheming.defaultTheme() !== 'default' && theme.name === 'default')) { + generateTheme(theme, theme.name, themeConfig.nonce); + } + }); + + + // ************************* + // Internal functions + // ************************* + + /** + * The user specifies a 'default' contrast color as either light or dark, then explicitly lists + * which hues are the opposite contrast (eg. A100 has dark, A200 has light). + * @param {!object} palette to sanitize + */ + function sanitizePalette(palette) { + var defaultContrast = palette.contrastDefaultColor; + var lightColors = palette.contrastLightColors || []; + var strongLightColors = palette.contrastStrongLightColors || []; + var darkColors = palette.contrastDarkColors || []; + + // These colors are provided as space-separated lists + if (typeof lightColors === 'string') lightColors = lightColors.split(' '); + if (typeof strongLightColors === 'string') strongLightColors = strongLightColors.split(' '); + if (typeof darkColors === 'string') darkColors = darkColors.split(' '); + + // Cleanup after ourselves + delete palette.contrastDefaultColor; + delete palette.contrastLightColors; + delete palette.contrastStrongLightColors; + delete palette.contrastDarkColors; + + /** + * @param {string} hueName + * @return {'dark'|'light'|'strongLight'} + */ + function getContrastType(hueName) { + if (defaultContrast === 'light' ? darkColors.indexOf(hueName) !== -1 : + (lightColors.indexOf(hueName) === -1 && strongLightColors.indexOf(hueName) === -1)) { + return 'dark'; + } + if (strongLightColors.indexOf(hueName) !== -1) { + return 'strongLight'; + } + return 'light'; + } + + /** + * @param {'dark'|'light'|'strongLight'} contrastType + * @return {[number, number, number]} [red, green, blue] array + */ + function getContrastColor(contrastType) { + switch (contrastType) { + default: + case 'strongLight': + return STRONG_LIGHT_CONTRAST_COLOR; + case 'light': + return LIGHT_CONTRAST_COLOR; + case 'dark': + return DARK_CONTRAST_COLOR; + } + } + + /** + * @param {'dark'|'light'|'strongLight'} contrastType + * @return {{secondary: number, divider: number, hint: number, icon: number, disabled: number}} + */ + function getOpacityValues(contrastType) { + switch (contrastType) { + default: + case 'strongLight': + return STRONG_LIGHT_CONTRAST_OPACITY; + case 'light': + return LIGHT_CONTRAST_OPACITY; + case 'dark': + return DARK_CONTRAST_OPACITY; + } + } + // Change { 'A100': '#fffeee' } to { 'A100': { value: '#fffeee', contrast:DARK_CONTRAST_COLOR } + angular.forEach(palette, function(hueValue, hueName) { + if (angular.isObject(hueValue)) return; // Already converted + // Map everything to rgb colors + var rgbValue = colorToRgbaArray(hueValue); + if (!rgbValue) { + throw new Error("Color %1, in palette %2's hue %3, is invalid. Hex or rgb(a) color expected." + .replace('%1', hueValue) + .replace('%2', palette.name) + .replace('%3', hueName)); + } + + var contrastType = getContrastType(hueName); + palette[hueName] = { + hex: palette[hueName], + value: rgbValue, + contrastType: contrastType, + contrast: getContrastColor(contrastType), + opacity: getOpacityValues(contrastType) + }; + }); + } + + /** + * @param {string} themeCss + * @returns {[]} a string representing a CSS file that is split, producing an array with a rule + * at each index. + */ + function splitCss(themeCss) { + var result = []; + var currentRule = ''; + var openedCurlyBrackets = 0; + var closedCurlyBrackets = 0; + + for (var i = 0; i < themeCss.length; i++) { + var character = themeCss.charAt(i); + + // Check for content in quotes + if (character === '\'' || character === '"') { + // Append text in quotes to current rule + var textInQuotes = themeCss.substring(i, themeCss.indexOf(character, i + 1)); + currentRule += textInQuotes; + + // Jump to the closing quote char + i += textInQuotes.length; + } else { + currentRule += character; + + if (character === '}') { + closedCurlyBrackets++; + if (closedCurlyBrackets === openedCurlyBrackets) { + closedCurlyBrackets = 0; + openedCurlyBrackets = 0; + result.push(currentRule); + currentRule = ''; + } + } else if (character === '{') { + openedCurlyBrackets++; + } + } + } + // Add comments added after last valid rule. + if (currentRule !== '') { + result.push(currentRule); + } + + return result; + } +} + +function generateTheme(theme, name, nonce) { + var head = document.head; + var firstChild = head ? head.firstElementChild : null; + + if (!GENERATED[name]) { + // For each theme, use the color palettes specified for + // `primary`, `warn` and `accent` to generate CSS rules. + THEME_COLOR_TYPES.forEach(function(colorType) { + var styleStrings = parseRules(theme, colorType, rulesByType[colorType]); + while (styleStrings.length) { + var styleContent = styleStrings.shift(); + if (styleContent) { + var style = document.createElement('style'); + style.setAttribute('md-theme-style', ''); + if (nonce) { + style.setAttribute('nonce', nonce); + } + style.appendChild(document.createTextNode(styleContent)); + head.insertBefore(style, firstChild); + } + } + }); + + GENERATED[theme.name] = true; + } + +} + + +function checkValidPalette(theme, colorType) { + // If theme attempts to use a palette that doesnt exist, throw error + if (!PALETTES[ (theme.colors[colorType] || {}).name ]) { + throw new Error( + "You supplied an invalid color palette for theme %1's %2 palette. Available palettes: %3" + .replace('%1', theme.name) + .replace('%2', colorType) + .replace('%3', Object.keys(PALETTES).join(', ')) + ); + } +} + +/** + * @param {string} clr rbg or rgba color + * @return {number[]|undefined} [red, green, blue] array if it can be computed + */ +function colorToRgbaArray(clr) { + if (angular.isArray(clr) && clr.length === 3) return clr; + if (/^rgb/.test(clr)) { + return clr.replace(/(^\s*rgba?\(|\)\s*$)/g, '').split(',').map(function(value, i) { + return i === 3 ? parseFloat(value) : parseInt(value, 10); + }); + } + if (clr.charAt(0) === '#') clr = clr.substring(1); + if (!/^([a-fA-F0-9]{3}){1,2}$/g.test(clr)) return; + + var dig = clr.length / 3; + var red = clr.substr(0, dig); + var grn = clr.substr(dig, dig); + var blu = clr.substr(dig * 2); + if (dig === 1) { + red += red; + grn += grn; + blu += blu; + } + return [parseInt(red, 16), parseInt(grn, 16), parseInt(blu, 16)]; +} + +function rgba(rgbArray, opacity) { + if (!rgbArray) return "rgb('0,0,0')"; + + if (rgbArray.length === 4) { + rgbArray = angular.copy(rgbArray); + opacity ? rgbArray.pop() : opacity = rgbArray.pop(); + } + return opacity && (typeof opacity == 'number' || (typeof opacity == 'string' && opacity.length)) ? + 'rgba(' + rgbArray.join(',') + ',' + opacity + ')' : + 'rgb(' + rgbArray.join(',') + ')'; +} + + +})(window.angular); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.autocomplete + */ +/* + * @see js folder for autocomplete implementation + */ +angular.module('material.components.autocomplete', [ + 'material.core', + 'material.components.icon', + 'material.components.virtualRepeat' +]); + +})(); +(function(){ +"use strict"; + + +MdAutocompleteCtrl.$inject = ["$scope", "$element", "$mdUtil", "$mdConstant", "$mdTheming", "$window", "$animate", "$rootElement", "$attrs", "$q", "$log", "$mdLiveAnnouncer"];angular + .module('material.components.autocomplete') + .controller('MdAutocompleteCtrl', MdAutocompleteCtrl); + +var ITEM_HEIGHT = 48, + MAX_ITEMS = 5, + MENU_PADDING = 8, + INPUT_PADDING = 2, // Padding provided by `md-input-container` + MODE_STANDARD = 'standard', + MODE_VIRTUAL = 'virtual'; + +function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming, $window, + $animate, $rootElement, $attrs, $q, $log, $mdLiveAnnouncer) { + + // Internal Variables. + var ctrl = this, + itemParts = $scope.itemsExpr.split(/ in /i), + itemExpr = itemParts[ 1 ], + elements = null, + cache = {}, + noBlur = false, + selectedItemWatchers = [], + hasFocus = false, + fetchesInProgress = 0, + enableWrapScroll = null, + inputModelCtrl = null, + debouncedOnResize = $mdUtil.debounce(onWindowResize), + mode = MODE_VIRTUAL; // default + + /** + * The root document element. This is used for attaching a top-level click handler to + * close the options panel when a click outside said panel occurs. We use `documentElement` + * instead of body because, when scrolling is disabled, some browsers consider the body element + * to be completely off the screen and propagate events directly to the html element. + * @type {!Object} angular.JQLite + */ + ctrl.documentElement = angular.element(document.documentElement); + + // Public Exported Variables with handlers + defineProperty('hidden', handleHiddenChange, true); + + // Public Exported Variables + ctrl.scope = $scope; + ctrl.parent = $scope.$parent; + ctrl.itemName = itemParts[0]; + ctrl.matches = []; + ctrl.loading = false; + ctrl.hidden = true; + ctrl.index = -1; + ctrl.activeOption = null; + ctrl.id = $mdUtil.nextUid(); + ctrl.isDisabled = null; + ctrl.isRequired = null; + ctrl.isReadonly = null; + ctrl.hasNotFound = false; + ctrl.selectedMessage = $scope.selectedMessage || 'selected'; + ctrl.noMatchMessage = $scope.noMatchMessage || 'There are no matches available.'; + ctrl.singleMatchMessage = $scope.singleMatchMessage || 'There is 1 match available.'; + ctrl.multipleMatchStartMessage = $scope.multipleMatchStartMessage || 'There are '; + ctrl.multipleMatchEndMessage = $scope.multipleMatchEndMessage || ' matches available.'; + ctrl.defaultEscapeOptions = 'clear'; + + // Public Exported Methods + ctrl.keydown = keydown; + ctrl.blur = blur; + ctrl.focus = focus; + ctrl.clear = clearValue; + ctrl.select = select; + ctrl.listEnter = onListEnter; + ctrl.listLeave = onListLeave; + ctrl.focusInput = focusInputElement; + ctrl.getCurrentDisplayValue = getCurrentDisplayValue; + ctrl.registerSelectedItemWatcher = registerSelectedItemWatcher; + ctrl.unregisterSelectedItemWatcher = unregisterSelectedItemWatcher; + ctrl.notFoundVisible = notFoundVisible; + ctrl.loadingIsVisible = loadingIsVisible; + ctrl.positionDropdown = positionDropdown; + + /** + * Report types to be used for the $mdLiveAnnouncer + * @enum {number} Unique flag id. + */ + var ReportType = { + Count: 1, + Selected: 2 + }; + + return init(); + + // initialization methods + + /** + * Initialize the controller, setup watchers, gather elements + */ + function init () { + + $mdUtil.initOptionalProperties($scope, $attrs, { + searchText: '', + selectedItem: null, + clearButton: false, + disableVirtualRepeat: false, + }); + + $mdTheming($element); + configureWatchers(); + $mdUtil.nextTick(function () { + + gatherElements(); + moveDropdown(); + + // Touch devices often do not send a click event on tap. We still want to focus the input + // and open the options pop-up in these cases. + $element.on('touchstart', focusInputElement); + + // Forward all focus events to the input element when autofocus is enabled + if ($scope.autofocus) { + $element.on('focus', focusInputElement); + } + if ($scope.inputAriaDescribedBy) { + elements.input.setAttribute('aria-describedby', $scope.inputAriaDescribedBy); + } + if (!$scope.floatingLabel) { + if ($scope.inputAriaLabel) { + elements.input.setAttribute('aria-label', $scope.inputAriaLabel); + } else if ($scope.inputAriaLabelledBy) { + elements.input.setAttribute('aria-labelledby', $scope.inputAriaLabelledBy); + } else if ($scope.placeholder) { + // If no aria-label or aria-labelledby references are defined, then just label using the + // placeholder. + elements.input.setAttribute('aria-label', $scope.placeholder); + } + } + }); + } + + function updateModelValidators() { + if (!$scope.requireMatch || !inputModelCtrl) return; + + inputModelCtrl.$setValidity('md-require-match', !!$scope.selectedItem || !$scope.searchText); + } + + /** + * Calculates the dropdown's position and applies the new styles to the menu element + * @returns {*} + */ + function positionDropdown () { + if (!elements) { + return $mdUtil.nextTick(positionDropdown, false, $scope); + } + + var dropdownHeight = ($scope.dropdownItems || MAX_ITEMS) * ITEM_HEIGHT; + var hrect = elements.wrap.getBoundingClientRect(), + vrect = elements.snap.getBoundingClientRect(), + root = elements.root.getBoundingClientRect(), + top = vrect.bottom - root.top, + bot = root.bottom - vrect.top, + left = hrect.left - root.left, + width = hrect.width, + offset = getVerticalOffset(), + position = $scope.dropdownPosition, + styles, enoughBottomSpace, enoughTopSpace; + var bottomSpace = root.bottom - vrect.bottom - MENU_PADDING + $mdUtil.getViewportTop(); + var topSpace = vrect.top - MENU_PADDING; + + // Automatically determine dropdown placement based on available space in viewport. + if (!position) { + enoughTopSpace = topSpace > dropdownHeight; + enoughBottomSpace = bottomSpace > dropdownHeight; + if (enoughBottomSpace) { + position = 'bottom'; + } else if (enoughTopSpace) { + position = 'top'; + } else { + position = topSpace > bottomSpace ? 'top' : 'bottom'; + } + } + // Adjust the width to account for the padding provided by `md-input-container` + if ($attrs.mdFloatingLabel) { + left += INPUT_PADDING; + width -= INPUT_PADDING * 2; + } + styles = { + left: left + 'px', + minWidth: width + 'px', + maxWidth: Math.max(hrect.right - root.left, root.right - hrect.left) - MENU_PADDING + 'px' + }; + + if (position === 'top') { + styles.top = 'auto'; + styles.bottom = bot + 'px'; + styles.maxHeight = Math.min(dropdownHeight, topSpace) + 'px'; + } else { + bottomSpace = root.bottom - hrect.bottom - MENU_PADDING + $mdUtil.getViewportTop(); + + styles.top = (top - offset) + 'px'; + styles.bottom = 'auto'; + styles.maxHeight = Math.min(dropdownHeight, bottomSpace) + 'px'; + } + + elements.$.scrollContainer.css(styles); + $mdUtil.nextTick(correctHorizontalAlignment, false, $scope); + + /** + * Calculates the vertical offset for floating label examples to account for ngMessages + * @returns {number} + */ + function getVerticalOffset () { + var offset = 0; + var inputContainer = $element.find('md-input-container'); + if (inputContainer.length) { + var input = inputContainer.find('input'); + offset = inputContainer.prop('offsetHeight'); + offset -= input.prop('offsetTop'); + offset -= input.prop('offsetHeight'); + // add in the height left up top for the floating label text + offset += inputContainer.prop('offsetTop'); + } + return offset; + } + + /** + * Makes sure that the menu doesn't go off of the screen on either side. + */ + function correctHorizontalAlignment () { + var dropdown = elements.scrollContainer.getBoundingClientRect(), + styles = {}; + if (dropdown.right > root.right) { + styles.left = (hrect.right - dropdown.width) + 'px'; + } + elements.$.scrollContainer.css(styles); + } + } + + /** + * Moves the dropdown menu to the body tag in order to avoid z-index and overflow issues. + */ + function moveDropdown () { + if (!elements.$.root.length) return; + $mdTheming(elements.$.scrollContainer); + elements.$.scrollContainer.detach(); + elements.$.root.append(elements.$.scrollContainer); + if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement); + } + + /** + * Sends focus to the input element. + */ + function focusInputElement () { + elements.input.focus(); + } + + /** + * Update the activeOption based on the selected item in the listbox. + * The activeOption is used in the template to set the aria-activedescendant attribute, which + * enables screen readers to properly handle visual focus within the listbox and announce the + * item's place in the list. I.e. "List item 3 of 50". Anytime that `ctrl.index` changes, this + * function needs to be called to update the activeOption. + */ + function updateActiveOption() { + var selectedOption = elements.scroller.querySelector('.selected'); + if (selectedOption) { + ctrl.activeOption = selectedOption.id; + } else { + ctrl.activeOption = null; + } + } + + /** + * Sets up any watchers used by autocomplete + */ + function configureWatchers () { + var wait = parseInt($scope.delay, 10) || 0; + + $attrs.$observe('disabled', function (value) { ctrl.isDisabled = $mdUtil.parseAttributeBoolean(value, false); }); + $attrs.$observe('required', function (value) { ctrl.isRequired = $mdUtil.parseAttributeBoolean(value, false); }); + $attrs.$observe('readonly', function (value) { ctrl.isReadonly = $mdUtil.parseAttributeBoolean(value, false); }); + + $scope.$watch('searchText', wait ? $mdUtil.debounce(handleSearchText, wait) : handleSearchText); + $scope.$watch('selectedItem', selectedItemChange); + + angular.element($window).on('resize', debouncedOnResize); + + $scope.$on('$destroy', cleanup); + } + + /** + * Removes any events or leftover elements created by this controller + */ + function cleanup () { + if (!ctrl.hidden) { + $mdUtil.enableScrolling(); + } + + angular.element($window).off('resize', debouncedOnResize); + + if (elements){ + var items = ['ul', 'scroller', 'scrollContainer', 'input']; + angular.forEach(items, function(key){ + elements.$[key].remove(); + }); + } + } + + /** + * Event handler to be called whenever the window resizes. + */ + function onWindowResize() { + if (!ctrl.hidden) { + positionDropdown(); + } + } + + /** + * Gathers all of the elements needed for this controller + */ + function gatherElements () { + + var snapWrap = gatherSnapWrap(); + + elements = { + main: $element[0], + scrollContainer: $element[0].querySelector('.md-virtual-repeat-container, .md-standard-list-container'), + scroller: $element[0].querySelector('.md-virtual-repeat-scroller, .md-standard-list-scroller'), + ul: $element.find('ul')[0], + input: $element.find('input')[0], + wrap: snapWrap.wrap, + snap: snapWrap.snap, + root: document.body, + }; + + elements.li = elements.ul.getElementsByTagName('li'); + elements.$ = getAngularElements(elements); + mode = elements.scrollContainer.classList.contains('md-standard-list-container') ? MODE_STANDARD : MODE_VIRTUAL; + inputModelCtrl = elements.$.input.controller('ngModel'); + } + + /** + * Gathers the snap and wrap elements + * + */ + function gatherSnapWrap() { + var element; + var value; + for (element = $element; element.length; element = element.parent()) { + value = element.attr('md-autocomplete-snap'); + if (angular.isDefined(value)) break; + } + + if (element.length) { + return { + snap: element[0], + wrap: (value.toLowerCase() === 'width') ? element[0] : $element.find('md-autocomplete-wrap')[0] + }; + } + + var wrap = $element.find('md-autocomplete-wrap')[0]; + return { + snap: wrap, + wrap: wrap + }; + } + + /** + * Gathers angular-wrapped versions of each element + * @param elements + * @returns {{}} + */ + function getAngularElements (elements) { + var obj = {}; + for (var key in elements) { + if (elements.hasOwnProperty(key)) obj[ key ] = angular.element(elements[ key ]); + } + return obj; + } + + // event/change handlers + + /** + * @param {Event} $event + */ + function preventDefault($event) { + $event.preventDefault(); + } + + /** + * @param {Event} $event + */ + function stopPropagation($event) { + $event.stopPropagation(); + } + + /** + * Handles changes to the `hidden` property. + * @param {boolean} hidden true to hide the options pop-up, false to show it. + * @param {boolean} oldHidden the previous value of hidden + */ + function handleHiddenChange (hidden, oldHidden) { + var scrollContainerElement; + + if (elements) { + scrollContainerElement = angular.element(elements.scrollContainer); + } + if (!hidden && oldHidden) { + positionDropdown(); + + // Report in polite mode, because the screen reader should finish the default description of + // the input element. + reportMessages(true, ReportType.Count | ReportType.Selected); + + if (elements) { + $mdUtil.disableScrollAround(elements.scrollContainer); + enableWrapScroll = disableElementScrollEvents(elements.wrap); + if ($mdUtil.isIos) { + ctrl.documentElement.on('touchend', handleTouchOutsidePanel); + if (scrollContainerElement) { + scrollContainerElement.on('touchstart touchmove touchend', stopPropagation); + } + } + ctrl.index = getDefaultIndex(); + $mdUtil.nextTick(function() { + updateActiveOption(); + updateScroll(); + }); + } + } else if (hidden && !oldHidden) { + if ($mdUtil.isIos) { + ctrl.documentElement.off('touchend', handleTouchOutsidePanel); + if (scrollContainerElement) { + scrollContainerElement.off('touchstart touchmove touchend', stopPropagation); + } + } + $mdUtil.enableScrolling(); + + if (enableWrapScroll) { + enableWrapScroll(); + enableWrapScroll = null; + } + } + } + + /** + * Handling touch events that bubble up to the document is required for closing the dropdown + * panel on touch outside of the options pop-up panel on iOS. + * @param {Event} $event + */ + function handleTouchOutsidePanel($event) { + ctrl.hidden = true; + // iOS does not blur the pop-up for touches on the scroll mask, so we have to do it. + doBlur(true); + } + + /** + * Disables scrolling for a specific element. + * @param {!string|!DOMElement} element to disable scrolling + * @return {Function} function to call to re-enable scrolling for the element + */ + function disableElementScrollEvents(element) { + var elementToDisable = angular.element(element); + elementToDisable.on('wheel touchmove', preventDefault); + + return function() { + elementToDisable.off('wheel touchmove', preventDefault); + }; + } + + /** + * When the user mouses over the dropdown menu, ignore blur events. + */ + function onListEnter () { + noBlur = true; + } + + /** + * When the user's mouse leaves the menu, blur events may hide the menu again. + */ + function onListLeave () { + if (!hasFocus && !ctrl.hidden) elements.input.focus(); + noBlur = false; + ctrl.hidden = shouldHide(); + } + + /** + * Handles changes to the selected item. + * @param selectedItem + * @param previousSelectedItem + */ + function selectedItemChange (selectedItem, previousSelectedItem) { + + updateModelValidators(); + + if (selectedItem) { + getDisplayValue(selectedItem).then(function (val) { + $scope.searchText = val; + handleSelectedItemChange(selectedItem, previousSelectedItem); + }); + } else if (previousSelectedItem && $scope.searchText) { + getDisplayValue(previousSelectedItem).then(function(displayValue) { + // Clear the searchText, when the selectedItem is set to null. + // Do not clear the searchText, when the searchText isn't matching with the previous + // selected item. + if (angular.isString($scope.searchText) + && displayValue.toString().toLowerCase() === $scope.searchText.toLowerCase()) { + $scope.searchText = ''; + } + }); + } + + if (selectedItem !== previousSelectedItem) { + announceItemChange(); + } + } + + /** + * Use the user-defined expression to announce changes each time a new item is selected + */ + function announceItemChange () { + angular.isFunction($scope.itemChange) && + $scope.itemChange(getItemAsNameVal($scope.selectedItem)); + } + + /** + * Use the user-defined expression to announce changes each time the search text is changed + */ + function announceTextChange () { + angular.isFunction($scope.textChange) && $scope.textChange(); + } + + /** + * Calls any external watchers listening for the selected item. Used in conjunction with + * `registerSelectedItemWatcher`. + * @param selectedItem + * @param previousSelectedItem + */ + function handleSelectedItemChange (selectedItem, previousSelectedItem) { + selectedItemWatchers.forEach(function (watcher) { + watcher(selectedItem, previousSelectedItem); + }); + } + + /** + * Register a function to be called when the selected item changes. + * @param cb + */ + function registerSelectedItemWatcher (cb) { + if (selectedItemWatchers.indexOf(cb) === -1) { + selectedItemWatchers.push(cb); + } + } + + /** + * Unregister a function previously registered for selected item changes. + * @param cb + */ + function unregisterSelectedItemWatcher (cb) { + var i = selectedItemWatchers.indexOf(cb); + if (i !== -1) { + selectedItemWatchers.splice(i, 1); + } + } + + /** + * Handles changes to the searchText property. + * @param {string} searchText + * @param {string} previousSearchText + */ + function handleSearchText (searchText, previousSearchText) { + ctrl.index = getDefaultIndex(); + + // do nothing on init + if (searchText === previousSearchText) return; + + updateModelValidators(); + + getDisplayValue($scope.selectedItem).then(function (val) { + // clear selected item if search text no longer matches it + if (searchText !== val) { + $scope.selectedItem = null; + + // trigger change event if available + if (searchText !== previousSearchText) { + announceTextChange(); + } + + // cancel results if search text is not long enough + if (!isMinLengthMet()) { + ctrl.matches = []; + + setLoading(false); + reportMessages(true, ReportType.Count); + + } else { + handleQuery(); + } + } + }); + + } + + /** + * Handles input blur event, determines if the dropdown should hide. + * @param {Event=} $event + */ + function blur($event) { + hasFocus = false; + + if (!noBlur) { + ctrl.hidden = shouldHide(); + evalAttr('ngBlur', { $event: $event }); + } else if (angular.isObject($event)) { + $event.stopImmediatePropagation(); + } + } + + /** + * Force blur on input element + * @param {boolean} forceBlur + */ + function doBlur(forceBlur) { + if (forceBlur) { + noBlur = false; + hasFocus = false; + } + elements.input.blur(); + } + + /** + * Handles input focus event, determines if the dropdown should show. + */ + function focus($event) { + hasFocus = true; + + if (isSearchable() && isMinLengthMet()) { + handleQuery(); + } + + ctrl.hidden = shouldHide(); + + evalAttr('ngFocus', { $event: $event }); + } + + /** + * Handles keyboard input. + * @param event + */ + function keydown (event) { + switch (event.keyCode) { + case $mdConstant.KEY_CODE.DOWN_ARROW: + if (ctrl.loading || hasSelection()) return; + event.stopPropagation(); + event.preventDefault(); + ctrl.index = ctrl.index + 1 > ctrl.matches.length - 1 ? 0 : Math.min(ctrl.index + 1, ctrl.matches.length - 1); + $mdUtil.nextTick(updateActiveOption); + updateScroll(); + break; + case $mdConstant.KEY_CODE.UP_ARROW: + if (ctrl.loading || hasSelection()) return; + event.stopPropagation(); + event.preventDefault(); + ctrl.index = ctrl.index - 1 < 0 ? ctrl.matches.length - 1 : Math.max(0, ctrl.index - 1); + $mdUtil.nextTick(updateActiveOption); + updateScroll(); + break; + case $mdConstant.KEY_CODE.TAB: + // If we hit tab, assume that we've left the list so it will close + onListLeave(); + + if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return; + select(ctrl.index); + break; + case $mdConstant.KEY_CODE.ENTER: + if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return; + if (hasSelection()) return; + event.stopImmediatePropagation(); + event.preventDefault(); + select(ctrl.index); + break; + case $mdConstant.KEY_CODE.ESCAPE: + event.preventDefault(); // Prevent browser from always clearing input + if (!shouldProcessEscape()) return; + event.stopPropagation(); + + clearSelectedItem(); + if ($scope.searchText && hasEscapeOption('clear')) { + clearSearchText(); + } + + // Manually hide (needed for mdNotFound support) + ctrl.hidden = true; + + if (hasEscapeOption('blur')) { + // Force the component to blur if they hit escape + doBlur(true); + } + + break; + default: + } + } + + // getters + + /** + * Returns the minimum length needed to display the dropdown. + * @returns {*} + */ + function getMinLength () { + return angular.isNumber($scope.minLength) ? $scope.minLength : 1; + } + + /** + * Returns the display value for an item. + * @param {*} item + * @returns {*} + */ + function getDisplayValue (item) { + return $q.when(getItemText(item) || item).then(function(itemText) { + if (itemText && !angular.isString(itemText)) { + $log.warn('md-autocomplete: Could not resolve display value to a string. ' + + 'Please check the `md-item-text` attribute.'); + } + + return itemText; + }); + + /** + * Getter function to invoke user-defined expression (in the directive) + * to convert your object to a single string. + * @param {*} item + * @returns {string|null} + */ + function getItemText (item) { + return (item && $scope.itemText) ? $scope.itemText(getItemAsNameVal(item)) : null; + } + } + + /** + * Returns the locals object for compiling item templates. + * @param {*} item + * @returns {Object|undefined} + */ + function getItemAsNameVal (item) { + if (!item) { + return undefined; + } + + var locals = {}; + if (ctrl.itemName) { + locals[ ctrl.itemName ] = item; + } + + return locals; + } + + /** + * Returns the default index based on whether or not autoselect is enabled. + * @returns {number} 0 if autoselect is enabled, -1 if not. + */ + function getDefaultIndex () { + return $scope.autoselect ? 0 : -1; + } + + /** + * Sets the loading parameter and updates the hidden state. + * @param value {boolean} Whether or not the component is currently loading. + */ + function setLoading(value) { + if (ctrl.loading !== value) { + ctrl.loading = value; + } + + // Always refresh the hidden variable as something else might have changed + ctrl.hidden = shouldHide(); + } + + /** + * Determines if the menu should be hidden. + * @returns {boolean} true if the menu should be hidden + */ + function shouldHide () { + return !shouldShow(); + } + + /** + * Determines whether the autocomplete is able to query within the current state. + * @returns {boolean} true if the query can be run + */ + function isSearchable() { + if (ctrl.loading && !hasMatches()) { + // No query when query is in progress. + return false; + } else if (hasSelection()) { + // No query if there is already a selection + return false; + } + else if (!hasFocus) { + // No query if the input does not have focus + return false; + } + return true; + } + + /** + * @returns {boolean} if the escape keydown should be processed, return true. + * Otherwise return false. + */ + function shouldProcessEscape() { + return hasEscapeOption('blur') || !ctrl.hidden || ctrl.loading || hasEscapeOption('clear') && $scope.searchText; + } + + /** + * @param {string} option check if this option is set + * @returns {boolean} if the specified escape option is set, return true. Return false otherwise. + */ + function hasEscapeOption(option) { + if (!angular.isString($scope.escapeOptions)) { + return ctrl.defaultEscapeOptions.indexOf(option) !== -1; + } else { + return $scope.escapeOptions.toLowerCase().indexOf(option) !== -1; + } + } + + /** + * Determines if the menu should be shown. + * @returns {boolean} true if the menu should be shown + */ + function shouldShow() { + if (ctrl.isReadonly) { + // Don't show if read only is set + return false; + } else if (!isSearchable()) { + // Don't show if a query is in progress, there is already a selection, + // or the input is not focused. + return false; + } + return (isMinLengthMet() && hasMatches()) || notFoundVisible(); + } + + /** + * @returns {boolean} true if the search text has matches. + */ + function hasMatches() { + return ctrl.matches.length ? true : false; + } + + /** + * @returns {boolean} true if the autocomplete has a valid selection. + */ + function hasSelection() { + return ctrl.scope.selectedItem ? true : false; + } + + /** + * @returns {boolean} true if the loading indicator is, or should be, visible. + */ + function loadingIsVisible() { + return ctrl.loading && !hasSelection(); + } + + /** + * @returns {*} the display value of the current item. + */ + function getCurrentDisplayValue () { + return getDisplayValue(ctrl.matches[ ctrl.index ]); + } + + /** + * Determines if the minimum length is met by the search text. + * @returns {*} true if the minimum length is met by the search text + */ + function isMinLengthMet () { + return ($scope.searchText || '').length >= getMinLength(); + } + + // actions + + /** + * Defines a public property with a handler and a default value. + * @param {string} key + * @param {Function} handler function + * @param {*} defaultValue default value + */ + function defineProperty (key, handler, defaultValue) { + Object.defineProperty(ctrl, key, { + get: function () { return defaultValue; }, + set: function (newValue) { + var oldValue = defaultValue; + defaultValue = newValue; + handler(newValue, oldValue); + } + }); + } + + /** + * Selects the item at the given index. + * @param {number} index to select + */ + function select (index) { + // force form to update state for validation + $mdUtil.nextTick(function () { + getDisplayValue(ctrl.matches[ index ]).then(function (val) { + var ngModel = elements.$.input.controller('ngModel'); + $mdLiveAnnouncer.announce(val + ' ' + ctrl.selectedMessage, 'assertive'); + ngModel.$setViewValue(val); + ngModel.$render(); + }).finally(function () { + $scope.selectedItem = ctrl.matches[ index ]; + setLoading(false); + }); + }, false); + } + + /** + * Clears the searchText value and selected item. + * @param {Event} $event + */ + function clearValue ($event) { + if ($event) { + $event.stopPropagation(); + } + clearSelectedItem(); + clearSearchText(); + } + + /** + * Clears the selected item + */ + function clearSelectedItem () { + // Reset our variables + ctrl.index = -1; + $mdUtil.nextTick(updateActiveOption); + ctrl.matches = []; + } + + /** + * Clears the searchText value + */ + function clearSearchText () { + // Set the loading to true so we don't see flashes of content. + // The flashing will only occur when an async request is running. + // So the loading process will stop when the results had been retrieved. + setLoading(true); + + $scope.searchText = ''; + + // Normally, triggering the change / input event is unnecessary, because the browser detects it properly. + // But some browsers are not detecting it properly, which means that we have to trigger the event. + // Using the `input` is not working properly, because for example IE11 is not supporting the `input` event. + // The `change` event is a good alternative and is supported by all supported browsers. + var eventObj = document.createEvent('CustomEvent'); + eventObj.initCustomEvent('change', true, true, { value: '' }); + elements.input.dispatchEvent(eventObj); + + // For some reason, firing the above event resets the value of $scope.searchText if + // $scope.searchText has a space character at the end, so we blank it one more time and then + // focus. + elements.input.blur(); + $scope.searchText = ''; + elements.input.focus(); + } + + /** + * Fetches the results for the provided search text. + * @param searchText + */ + function fetchResults (searchText) { + var items = $scope.$parent.$eval(itemExpr), + term = searchText.toLowerCase(), + isList = angular.isArray(items), + isPromise = !!items.then; // Every promise should contain a `then` property + + if (isList) onResultsRetrieved(items); + else if (isPromise) handleAsyncResults(items); + + function handleAsyncResults(items) { + if (!items) return; + + items = $q.when(items); + fetchesInProgress++; + setLoading(true); + + $mdUtil.nextTick(function () { + items + .then(onResultsRetrieved) + .finally(function(){ + if (--fetchesInProgress === 0) { + setLoading(false); + } + }); + },true, $scope); + } + + function onResultsRetrieved(matches) { + cache[term] = matches; + + // Just cache the results if the request is now outdated. + // The request becomes outdated, when the new searchText has changed during the result fetching. + if ((searchText || '') !== ($scope.searchText || '')) { + return; + } + + handleResults(matches); + } + } + + + /** + * Reports given message types to supported screen readers. + * @param {boolean} isPolite Whether the announcement should be polite. + * @param {!number} types Message flags to be reported to the screen reader. + */ + function reportMessages(isPolite, types) { + var politeness = isPolite ? 'polite' : 'assertive'; + var messages = []; + + if (types & ReportType.Selected && ctrl.index !== -1) { + messages.push(getCurrentDisplayValue()); + } + + if (types & ReportType.Count) { + messages.push($q.resolve(getCountMessage())); + } + + $q.all(messages).then(function(data) { + $mdLiveAnnouncer.announce(data.join(' '), politeness); + }); + } + + /** + * @returns {string} the ARIA message for how many results match the current query. + */ + function getCountMessage () { + switch (ctrl.matches.length) { + case 0: + return ctrl.noMatchMessage; + case 1: + return ctrl.singleMatchMessage; + default: + return ctrl.multipleMatchStartMessage + ctrl.matches.length + ctrl.multipleMatchEndMessage; + } + } + + /** + * Makes sure that the focused element is within view. + */ + function updateScroll () { + if (!elements.li[0]) return; + if (mode === MODE_STANDARD) { + updateStandardScroll(); + } else { + updateVirtualScroll(); + } + } + + function updateVirtualScroll() { + // elements in virtual scroll have consistent heights + var optionHeight = elements.li[0].offsetHeight, + top = optionHeight * Math.max(0, ctrl.index), + bottom = top + optionHeight, + containerHeight = elements.scroller.clientHeight, + scrollTop = elements.scroller.scrollTop; + + if (top < scrollTop) { + scrollTo(top); + } else if (bottom > scrollTop + containerHeight) { + scrollTo(bottom - containerHeight); + } + } + + function updateStandardScroll() { + // elements in standard scroll have variable heights + var selected = elements.li[Math.max(0, ctrl.index)]; + var containerHeight = elements.scrollContainer.offsetHeight, + top = selected && selected.offsetTop || 0, + bottom = top + selected.clientHeight, + scrollTop = elements.scrollContainer.scrollTop; + + if (top < scrollTop) { + scrollTo(top); + } else if (bottom > scrollTop + containerHeight) { + scrollTo(bottom - containerHeight); + } + } + + function isPromiseFetching() { + return fetchesInProgress !== 0; + } + + function scrollTo (offset) { + if (mode === MODE_STANDARD) { + elements.scrollContainer.scrollTop = offset; + } else { + elements.$.scrollContainer.controller('mdVirtualRepeatContainer').scrollTo(offset); + } + } + + function notFoundVisible () { + var textLength = (ctrl.scope.searchText || '').length; + + return ctrl.hasNotFound && !hasMatches() && (!ctrl.loading || isPromiseFetching()) && textLength >= getMinLength() && (hasFocus || noBlur) && !hasSelection(); + } + + /** + * Starts the query to gather the results for the current searchText. Attempts to return cached + * results first, then forwards the process to `fetchResults` if necessary. + */ + function handleQuery () { + var searchText = $scope.searchText || ''; + var term = searchText.toLowerCase(); + + // If caching is enabled and the current searchText is stored in the cache + if (!$scope.noCache && cache[term]) { + // The results should be handled as same as a normal un-cached request does. + handleResults(cache[term]); + } else { + fetchResults(searchText); + } + + ctrl.hidden = shouldHide(); + } + + /** + * Handles the retrieved results by showing them in the autocompletes dropdown. + * @param results Retrieved results + */ + function handleResults(results) { + ctrl.matches = results; + ctrl.hidden = shouldHide(); + + // If loading is in progress, then we'll end the progress. This is needed for example, + // when the `clear` button was clicked, because there we always show the loading process, to prevent flashing. + if (ctrl.loading) setLoading(false); + + if ($scope.selectOnMatch) selectItemOnMatch(); + + positionDropdown(); + reportMessages(true, ReportType.Count); + } + + /** + * If there is only one matching item and the search text matches its display value exactly, + * automatically select that item. Note: This function is only called if the user uses the + * `md-select-on-match` flag. + */ + function selectItemOnMatch () { + var searchText = $scope.searchText, + matches = ctrl.matches, + item = matches[ 0 ]; + if (matches.length === 1) getDisplayValue(item).then(function (displayValue) { + var isMatching = searchText === displayValue; + if ($scope.matchInsensitive && !isMatching) { + isMatching = searchText.toLowerCase() === displayValue.toLowerCase(); + } + + if (isMatching) { + select(0); + } + }); + } + + /** + * Evaluates an attribute expression against the parent scope. + * @param {String} attr Name of the attribute to be evaluated. + * @param {Object?} locals Properties to be injected into the evaluation context. + */ + function evalAttr(attr, locals) { + if ($attrs[attr]) { + $scope.$parent.$eval($attrs[attr], locals || {}); + } + } + +} + +})(); +(function(){ +"use strict"; + + +MdAutocomplete.$inject = ["$$mdSvgRegistry"];angular + .module('material.components.autocomplete') + .directive('mdAutocomplete', MdAutocomplete); + +/** + * @ngdoc directive + * @name mdAutocomplete + * @module material.components.autocomplete + * + * @description + * `` is a special input component with a drop-down of all possible matches to a + * custom query. This component allows you to provide real-time suggestions as the user types + * in the input area. + * + * To start, you will need to specify the required parameters and provide a template for your + * results. The content inside `md-autocomplete` will be treated as a template. + * + * In more complex cases, you may want to include other content such as a message to display when + * no matches were found. You can do this by wrapping your template in `md-item-template` and + * adding a tag for `md-not-found`. An example of this is shown below. + * + * To reset the displayed value you must clear both values for `md-search-text` and + * `md-selected-item`. + * + * ### Validation + * + * You can use `ng-messages` to include validation the same way that you would normally validate; + * however, if you want to replicate a standard input with a floating label, you will have to + * do the following: + * + * - Make sure that your template is wrapped in `md-item-template` + * - Add your `ng-messages` code inside of `md-autocomplete` + * - Add your validation properties to `md-autocomplete` (ie. `required`) + * - Add a `name` to `md-autocomplete` (to be used on the generated `input`) + * + * There is an example below of how this should look. + * + * ### Snapping Drop-Down + * + * You can cause the autocomplete drop-down to snap to an ancestor element by applying the + * `md-autocomplete-snap` attribute to that element. You can also snap to the width of + * the `md-autocomplete-snap` element by setting the attribute's value to `width` + * (ie. `md-autocomplete-snap="width"`). + * + * ### Notes + * + * **Autocomplete Dropdown Items Rendering** + * + * The `md-autocomplete` uses the the + * mdVirtualRepeat directive for displaying the results inside of the dropdown.
    + * + * > When encountering issues regarding the item template please take a look at the + * VirtualRepeatContainer documentation. + * + * **Autocomplete inside of a Virtual Repeat** + * + * When using the `md-autocomplete` directive inside of a + * VirtualRepeatContainer the dropdown items + * might not update properly, because caching of the results is enabled by default. + * + * The autocomplete will then show invalid dropdown items, because the Virtual Repeat only updates + * the scope bindings rather than re-creating the `md-autocomplete`. This means that the previous + * cached results will be used. + * + * > To avoid such problems, ensure that the autocomplete does not cache any results via + * `md-no-cache="true"`: + * + * + * + * {{ item.display }} + * + * + * + * + * @param {expression} md-items An expression in the format of `item in results` to iterate over + * matches for your search.

    + * The `results` expression can be also a function, which returns the results synchronously + * or asynchronously (per Promise). + * @param {expression=} md-selected-item-change An expression to be run each time a new item is + * selected. + * @param {expression=} md-search-text-change An expression to be run each time the search text + * updates. + * @param {expression=} md-search-text A model to bind the search query text to. + * @param {object=} md-selected-item A model to bind the selected item to. + * @param {expression=} md-item-text An expression that will convert your object to a single string. + * @param {string=} placeholder Placeholder text that will be forwarded to the input. + * @param {boolean=} md-no-cache Disables the internal caching that happens in autocomplete. + * @param {boolean=} ng-disabled Determines whether or not to disable the input field. + * @param {boolean=} md-require-match When set to true, the autocomplete will add a validator, + * which will evaluate to false, when no item is currently selected. + * @param {number=} md-min-length Specifies the minimum length of text before autocomplete will + * make suggestions. + * @param {number=} md-delay Specifies the amount of time (in milliseconds) to wait before looking + * for results. + * @param {boolean=} md-clear-button Whether the clear button for the autocomplete input should show + * up or not. When `md-floating-label` is set, defaults to false, defaults to true otherwise. + * @param {boolean=} md-autofocus If true, the autocomplete will be automatically focused when a + * `$mdDialog`, `$mdBottomsheet` or `$mdSidenav`, which contains the autocomplete, is opening. + *

    + * Also the autocomplete will immediately focus the input element. + * @param {boolean=} md-no-asterisk When present, asterisk will not be appended to the floating + * label. + * @param {boolean=} md-autoselect If set to true, the first item will be automatically selected + * in the dropdown upon open. + * @param {string=} md-input-name The name attribute given to the input element to be used with + * FormController. + * @param {string=} md-menu-class This class will be applied to the dropdown menu for styling. + * @param {string=} md-menu-container-class This class will be applied to the parent container + * of the dropdown panel. + * @param {string=} md-input-class This will be applied to the input for styling. This attribute + * is only valid when a `md-floating-label` is defined. + * @param {string=} md-floating-label This will add a floating label to autocomplete and wrap it in + * `md-input-container`. + * @param {string=} md-select-on-focus When present the input's text will be automatically selected + * on focus. + * @param {string=} md-input-id An ID to be added to the input element. + * @param {number=} md-input-minlength The minimum length for the input's value for validation. + * @param {number=} md-input-maxlength The maximum length for the input's value for validation. + * @param {boolean=} md-select-on-match When set, autocomplete will automatically select + * the item if the search text is an exact match.

    + * An exact match is when only one match is displayed. + * @param {boolean=} md-match-case-insensitive When set and using `md-select-on-match`, autocomplete + * will select on case-insensitive match. + * @param {string=} md-escape-options Override escape key logic. Default is `clear`.
    + * Options: `blur`, `clear`, `none`. + * @param {string=} md-dropdown-items Specifies the maximum amount of items to be shown in + * the dropdown.

    + * When the dropdown doesn't fit into the viewport, the dropdown will shrink + * as much as possible. + * @param {string=} md-dropdown-position Overrides the default dropdown position. Options: `top`, + * `bottom`. + * @param {string=} input-aria-describedby A space-separated list of element IDs. This should + * contain the IDs of any elements that describe this autocomplete. Screen readers will read the + * content of these elements at the end of announcing that the autocomplete has been selected + * and describing its current state. The descriptive elements do not need to be visible on the + * page. + * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use case + * is that this would contain the ID of a `
    ' : ''; + } + + function getRepeatType(repeatMode) { + return isVirtualRepeatDisabled(repeatMode) ? + 'ng-repeat' : 'md-virtual-repeat'; + } + + function isVirtualRepeatDisabled(repeatMode) { + // ensure we have a valid repeat mode + var correctedRepeatMode = getRepeatMode(repeatMode); + return correctedRepeatMode !== REPEAT_VIRTUAL; + } + + function getInputElement () { + if (attr.mdFloatingLabel) { + return '\ + \ + \ + \ +
    ' + leftover + '
    \ +
    '; + } else { + return '\ + '; + } + } + + function getClearButton() { + return '' + + ''; + } + } + }; +} + +})(); +(function(){ +"use strict"; + + +MdAutocompleteItemScopeDirective.$inject = ["$compile", "$mdUtil"];angular + .module('material.components.autocomplete') + .directive('mdAutocompleteParentScope', MdAutocompleteItemScopeDirective); + +function MdAutocompleteItemScopeDirective($compile, $mdUtil) { + return { + restrict: 'AE', + compile: compile, + terminal: true, + transclude: 'element' + }; + + function compile(tElement, tAttr, transclude) { + return function postLink(scope, element, attr) { + var ctrl = scope.$mdAutocompleteCtrl; + var newScope = ctrl.parent.$new(); + var itemName = ctrl.itemName; + + // Watch for changes to our scope's variables and copy them to the new scope + watchVariable('$index', '$index'); + watchVariable('item', itemName); + + // Ensure that $digest calls on our scope trigger $digest on newScope. + connectScopes(); + + // Link the element against newScope. + transclude(newScope, function(clone) { + element.after(clone); + }); + + /** + * Creates a watcher for variables that are copied from the parent scope + * @param variable + * @param alias + */ + function watchVariable(variable, alias) { + newScope[alias] = scope[variable]; + + scope.$watch(variable, function(value) { + $mdUtil.nextTick(function() { + newScope[alias] = value; + }); + }); + } + + /** + * Creates watchers on scope and newScope that ensure that for any + * $digest of scope, newScope is also $digested. + */ + function connectScopes() { + var scopeDigesting = false; + var newScopeDigesting = false; + + scope.$watch(function() { + if (newScopeDigesting || scopeDigesting) { + return; + } + + scopeDigesting = true; + scope.$$postDigest(function() { + if (!newScopeDigesting) { + newScope.$digest(); + } + + scopeDigesting = newScopeDigesting = false; + }); + }); + + newScope.$watch(function() { + newScopeDigesting = true; + }); + } + }; + } +} +})(); +(function(){ +"use strict"; + + +MdHighlightCtrl.$inject = ["$scope", "$element", "$attrs", "$mdUtil"];angular + .module('material.components.autocomplete') + .controller('MdHighlightCtrl', MdHighlightCtrl); + +function MdHighlightCtrl ($scope, $element, $attrs, $mdUtil) { + this.$scope = $scope; + this.$element = $element; + this.$attrs = $attrs; + this.$mdUtil = $mdUtil; + + // Cache the Regex to avoid rebuilding each time. + this.regex = null; +} + +MdHighlightCtrl.prototype.init = function(unsafeTermFn, unsafeContentFn) { + + this.flags = this.$attrs.mdHighlightFlags || ''; + + this.unregisterFn = this.$scope.$watch(function($scope) { + return { + term: unsafeTermFn($scope), + contentText: unsafeContentFn($scope) + }; + }.bind(this), this.onRender.bind(this), true); + + this.$element.on('$destroy', this.unregisterFn); +}; + +/** + * Triggered once a new change has been recognized and the highlighted + * text needs to be updated. + */ +MdHighlightCtrl.prototype.onRender = function(state, prevState) { + + var contentText = state.contentText; + + /* Update the regex if it's outdated, because we don't want to rebuilt it constantly. */ + if (this.regex === null || state.term !== prevState.term) { + this.regex = this.createRegex(state.term, this.flags); + } + + /* If a term is available apply the regex to the content */ + if (state.term) { + this.applyRegex(contentText); + } else { + this.$element.text(contentText); + } + +}; + +/** + * Decomposes the specified text into different tokens (whether match or not). + * Breaking down the string guarantees proper XSS protection due to the native browser + * escaping of unsafe text. + */ +MdHighlightCtrl.prototype.applyRegex = function(text) { + var tokens = this.resolveTokens(text); + + this.$element.empty(); + + tokens.forEach(function (token) { + + if (token.isMatch) { + var tokenEl = angular.element('').text(token.text); + + this.$element.append(tokenEl); + } else { + this.$element.append(document.createTextNode(token)); + } + + }.bind(this)); + +}; + + /** + * Decomposes the specified text into different tokens by running the regex against the text. + */ +MdHighlightCtrl.prototype.resolveTokens = function(string) { + var tokens = []; + var lastIndex = 0; + + // Use replace here, because it supports global and single regular expressions at same time. + string.replace(this.regex, function(match, index) { + appendToken(lastIndex, index); + + tokens.push({ + text: match, + isMatch: true + }); + + lastIndex = index + match.length; + }); + + // Append the missing text as a token. + appendToken(lastIndex); + + return tokens; + + function appendToken(from, to) { + var targetText = string.slice(from, to); + targetText && tokens.push(targetText); + } +}; + +/** Creates a regex for the specified text with the given flags. */ +MdHighlightCtrl.prototype.createRegex = function(term, flags) { + var startFlag = '', endFlag = ''; + var regexTerm = this.$mdUtil.sanitize(term); + + if (flags.indexOf('^') >= 0) startFlag = '^'; + if (flags.indexOf('$') >= 0) endFlag = '$'; + + return new RegExp(startFlag + regexTerm + endFlag, flags.replace(/[$^]/g, '')); +}; + +})(); +(function(){ +"use strict"; + + +MdHighlight.$inject = ["$interpolate", "$parse"];angular + .module('material.components.autocomplete') + .directive('mdHighlightText', MdHighlight); + +/** + * @ngdoc directive + * @name mdHighlightText + * @module material.components.autocomplete + * + * @description + * The `md-highlight-text` directive allows you to specify text that should be highlighted within + * an element. Highlighted text will be wrapped in `` which can + * be styled through CSS. Please note that child elements may not be used with this directive. + * + * @param {string} md-highlight-text A model to be searched for + * @param {string=} md-highlight-flags A list of flags (loosely based on JavaScript RexExp flags). + * #### **Supported flags**: + * - `g`: Find all matches within the provided text + * - `i`: Ignore case when searching for matches + * - `$`: Only match if the text ends with the search term + * - `^`: Only match if the text begins with the search term + * + * @usage + * + * + *
      + *
    • + * {{result.text}} + *
    • + *
    + *
    + */ + +function MdHighlight ($interpolate, $parse) { + return { + terminal: true, + controller: 'MdHighlightCtrl', + compile: function mdHighlightCompile(tElement, tAttr) { + var termExpr = $parse(tAttr.mdHighlightText); + var unsafeContentExpr = $interpolate(tElement.html()); + + return function mdHighlightLink(scope, element, attr, ctrl) { + ctrl.init(termExpr, unsafeContentExpr); + }; + } + }; +} + +})(); +(function(){ +"use strict"; + +/* + * @ngdoc module + * @name material.components.backdrop + * @description Backdrop + */ + +/** + * @ngdoc directive + * @name mdBackdrop + * @module material.components.backdrop + * + * @restrict E + * + * @description + * `` is a backdrop element used by other components, such as dialog and bottom sheet. + * Apply class `opaque` to make the backdrop use the theme backdrop color. + * + */ + +angular + .module('material.components.backdrop', ['material.core']) + .directive('mdBackdrop', ["$mdTheming", "$mdUtil", "$animate", "$rootElement", "$window", "$log", "$$rAF", "$document", function BackdropDirective($mdTheming, $mdUtil, $animate, $rootElement, $window, $log, $$rAF, $document) { + var ERROR_CSS_POSITION = ' may not work properly in a scrolled, static-positioned parent container.'; + + return { + restrict: 'E', + link: postLink + }; + + function postLink(scope, element, attrs) { + // backdrop may be outside the $rootElement, tell ngAnimate to animate regardless + if ($animate.pin) $animate.pin(element, $rootElement); + + var bodyStyles; + + $$rAF(function() { + // If body scrolling has been disabled using mdUtil.disableBodyScroll(), + // adjust the 'backdrop' height to account for the fixed 'body' top offset. + // Note that this can be pretty expensive and is better done inside the $$rAF. + bodyStyles = $window.getComputedStyle($document[0].body); + + if (bodyStyles.position === 'fixed') { + var resizeHandler = $mdUtil.debounce(function(){ + bodyStyles = $window.getComputedStyle($document[0].body); + resize(); + }, 60, null, false); + + resize(); + angular.element($window).on('resize', resizeHandler); + + scope.$on('$destroy', function() { + angular.element($window).off('resize', resizeHandler); + }); + } + + // Often $animate.enter() is used to append the backDrop element + // so let's wait until $animate is done... + var parent = element.parent(); + + if (parent.length) { + if (parent[0].nodeName === 'BODY') { + element.css('position', 'fixed'); + } + + var styles = $window.getComputedStyle(parent[0]); + + if (styles.position === 'static') { + // backdrop uses position:absolute and will not work properly with parent position:static (default) + $log.warn(ERROR_CSS_POSITION); + } + + // Only inherit the parent if the backdrop has a parent. + $mdTheming.inherit(element, parent); + } + }); + + function resize() { + var viewportHeight = parseInt(bodyStyles.height, 10) + Math.abs(parseInt(bodyStyles.top, 10)); + element.css('height', viewportHeight + 'px'); + } + } + + }]); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.bottomSheet + * @description + * BottomSheet + */ +MdBottomSheetDirective.$inject = ["$mdBottomSheet"]; +MdBottomSheetProvider.$inject = ["$$interimElementProvider"]; +angular + .module('material.components.bottomSheet', [ + 'material.core', + 'material.components.backdrop' + ]) + .directive('mdBottomSheet', MdBottomSheetDirective) + .provider('$mdBottomSheet', MdBottomSheetProvider); + +/* @ngInject */ +function MdBottomSheetDirective($mdBottomSheet) { + return { + restrict: 'E', + link : function postLink(scope, element) { + element.addClass('_md'); // private md component indicator for styling + + // When navigation force destroys an interimElement, then + // listen and $destroy() that interim instance... + scope.$on('$destroy', function() { + $mdBottomSheet.destroy(); + }); + } + }; +} + + +/** + * @ngdoc service + * @name $mdBottomSheet + * @module material.components.bottomSheet + * + * @description + * `$mdBottomSheet` opens a bottom sheet over the app and provides a simple promise API. + * + * ## Restrictions + * + * - The bottom sheet's template must have an outer `` element. + * - Add the `md-grid` class to the bottom sheet for a grid layout. + * - Add the `md-list` class to the bottom sheet for a list layout. + * + * @usage + * + *
    + * + * Open a Bottom Sheet! + * + *
    + *
    + * + * var app = angular.module('app', ['ngMaterial']); + * app.controller('MyController', function($scope, $mdBottomSheet) { + * $scope.openBottomSheet = function() { + * $mdBottomSheet.show({ + * template: '' + + * 'Hello! Close' + + * '' + * }) + * + * // Fires when the hide() method is used + * .then(function() { + * console.log('You clicked the button to close the bottom sheet!'); + * }) + * + * // Fires when the cancel() method is used + * .catch(function() { + * console.log('You hit escape or clicked the backdrop to close.'); + * }); + * }; + * + * $scope.closeBottomSheet = function($scope, $mdBottomSheet) { + * $mdBottomSheet.hide(); + * } + * + * }); + * + * + * ### Custom Presets + * Developers are also able to create their own preset, which can be easily used without repeating + * their options each time. + * + * + * $mdBottomSheetProvider.addPreset('testPreset', { + * options: function() { + * return { + * template: + * '' + + * 'This is a custom preset' + + * '', + * controllerAs: 'bottomSheet', + * bindToController: true, + * clickOutsideToClose: true, + * escapeToClose: true + * }; + * } + * }); + * + * + * After you create your preset during the config phase, you can easily access it. + * + * + * $mdBottomSheet.show( + * $mdBottomSheet.testPreset() + * ); + * + */ + +/** + * @ngdoc method + * @name $mdBottomSheet#show + * + * @description + * Show a bottom sheet with the specified options. + * + * Note: You should always provide a `.catch()` method in case the user hits the + * `esc` key or clicks the background to close. In this case, the `cancel()` method will + * automatically be called on the bottom sheet which will `reject()` the promise. See the @usage + * section above for an example. + * + * Newer versions of Angular will throw a `Possibly unhandled rejection` exception if you forget + * this. + * + * @param {Object} optionsOrPreset Either provide an `$mdBottomSheetPreset` defined during the + * config phase or an options object, with the following properties: + * + * - `templateUrl` - `{string=}`: The url of an html template file that will + * be used as the content of the bottom sheet. Restrictions: the template must + * have an outer `md-bottom-sheet` element. + * - `template` - `{string=}`: Same as templateUrl, except this is an actual + * template string. + * - `scope` - `{Object=}`: the scope to link the template / controller to. If none is specified, + * it will create a new child scope. This scope will be destroyed when the bottom sheet is + * removed unless `preserveScope` is set to true. + * - `preserveScope` - `{boolean=}`: whether to preserve the scope when the element is removed. + * Default is false + * - `controller` - `{string=}`: The controller to associate with this bottom sheet. + * - `locals` - `{string=}`: An object containing key/value pairs. The keys will be used as names + * of values to inject into the controller. For example, `locals: {three: 3}` would inject + * `three` into the controller with the value of 3. + * - `clickOutsideToClose` - `{boolean=}`: Whether the user can click outside the bottom sheet to + * close it. Default true. + * - `bindToController` - `{boolean=}`: When set to true, the locals will be bound to the + * controller instance and available in it's $onInit function. + * - `disableBackdrop` - `{boolean=}`: When set to true, the bottomsheet will not show a backdrop. + * - `escapeToClose` - `{boolean=}`: Whether the user can press escape to close the bottom sheet. + * Default true. + * - `isLockedOpen` - `{boolean=}`: Disables all default ways of closing the bottom sheet. + * **Note:** this will override the `clickOutsideToClose` and `escapeToClose` options, leaving + * only the `hide` and `cancel` methods as ways of closing the bottom sheet. Defaults to false. + * - `resolve` - `{Object=}`: Similar to locals, except it takes promises as values + * and the bottom sheet will not open until the promises resolve. + * - `controllerAs` - `{string=}`: An alias to assign the controller to on the scope. + * - `parent` - `{element=}`: The element to append the bottom sheet to. The `parent` may be a + * `function`, `string`, `Object`, or null. Defaults to appending to the body of the root element + * (or the root element) of the application. + * e.g. angular.element(document.getElementById('content')) or "#content" + * - `disableParentScroll` - `{boolean=}`: Whether to disable scrolling while the bottom sheet is + * open. Default true. + * + * @returns {promise} A promise that can be resolved with `$mdBottomSheet.hide()` or + * rejected with `$mdBottomSheet.cancel()`. + */ + +/** + * @ngdoc method + * @name $mdBottomSheet#hide + * + * @description + * Hide the existing bottom sheet and resolve the promise returned from + * `$mdBottomSheet.show()`. This call will close the most recently opened/current bottom sheet (if + * any). + * + * Note: Use a `.then()` on your `.show()` to handle this callback. + * + * @param {*=} response An argument for the resolved promise. + * + */ + +/** + * @ngdoc method + * @name $mdBottomSheet#cancel + * + * @description + * Hide the existing bottom sheet and reject the promise returned from + * `$mdBottomSheet.show()`. + * + * Note: Use a `.catch()` on your `.show()` to handle this callback. + * + * @param {*=} response An argument for the rejected promise. + * + */ + +function MdBottomSheetProvider($$interimElementProvider) { + // how fast we need to flick down to close the sheet, pixels/ms + bottomSheetDefaults.$inject = ["$animate", "$mdConstant", "$mdUtil", "$mdTheming", "$mdBottomSheet", "$rootElement", "$mdGesture", "$log"]; + var CLOSING_VELOCITY = 0.5; + var PADDING = 80; // same as css + + return $$interimElementProvider('$mdBottomSheet') + .setDefaults({ + methods: ['disableParentScroll', 'escapeToClose', 'clickOutsideToClose'], + options: bottomSheetDefaults + }); + + /* @ngInject */ + function bottomSheetDefaults($animate, $mdConstant, $mdUtil, $mdTheming, $mdBottomSheet, $rootElement, + $mdGesture, $log) { + var backdrop; + + return { + themable: true, + onShow: onShow, + onRemove: onRemove, + disableBackdrop: false, + escapeToClose: true, + clickOutsideToClose: true, + disableParentScroll: true, + isLockedOpen: false + }; + + function onShow(scope, element, options) { + element = $mdUtil.extractElementByName(element, 'md-bottom-sheet'); + + // prevent tab focus or click focus on the bottom-sheet container + element.attr('tabindex', '-1'); + + // Once the md-bottom-sheet has `ng-cloak` applied on his template the opening animation will not work properly. + // This is a very common problem, so we have to notify the developer about this. + if (element.hasClass('ng-cloak')) { + var message = '$mdBottomSheet: using `` will affect the bottom-sheet opening animations.'; + $log.warn(message, element[0]); + } + + if (options.isLockedOpen) { + options.clickOutsideToClose = false; + options.escapeToClose = false; + } else { + options.cleanupGestures = registerGestures(element, options.parent); + } + + if (!options.disableBackdrop) { + // Add a backdrop that will close on click + backdrop = $mdUtil.createBackdrop(scope, "md-bottom-sheet-backdrop md-opaque"); + + // Prevent mouse focus on backdrop; ONLY programmatic focus allowed. + // This allows clicks on backdrop to propagate to the $rootElement and + // ESC key events to be detected properly. + backdrop[0].tabIndex = -1; + + if (options.clickOutsideToClose) { + backdrop.on('click', function() { + $mdUtil.nextTick($mdBottomSheet.cancel, true); + }); + } + + $mdTheming.inherit(backdrop, options.parent); + + $animate.enter(backdrop, options.parent, null); + } + + $mdTheming.inherit(element, options.parent); + + if (options.disableParentScroll) { + options.restoreScroll = $mdUtil.disableScrollAround(element, options.parent); + } + + return $animate.enter(element, options.parent, backdrop) + .then(function() { + var focusable = $mdUtil.findFocusTarget(element) || angular.element( + element[0].querySelector('button') || + element[0].querySelector('a') || + element[0].querySelector($mdUtil.prefixer('ng-click', true)) + ) || backdrop; + + if (options.escapeToClose) { + options.rootElementKeyupCallback = function(e) { + if (e.keyCode === $mdConstant.KEY_CODE.ESCAPE) { + $mdUtil.nextTick($mdBottomSheet.cancel, true); + } + }; + + $rootElement.on('keyup', options.rootElementKeyupCallback); + focusable && focusable.focus(); + } + }); + + } + + function onRemove(scope, element, options) { + if (!options.disableBackdrop) $animate.leave(backdrop); + + return $animate.leave(element).then(function() { + if (options.disableParentScroll) { + options.restoreScroll(); + delete options.restoreScroll; + } + + options.cleanupGestures && options.cleanupGestures(); + }); + } + + /** + * Adds the drag gestures to the bottom sheet. + * @param {JQLite} element where CSS transitions will be applied + * @param {JQLite} parent used for registering gesture listeners + * @return {Function} function that removes gesture listeners that were set up by + * registerGestures() + */ + function registerGestures(element, parent) { + var deregister = $mdGesture.register(parent, 'drag', { horizontal: false }); + parent.on('$md.dragstart', onDragStart) + .on('$md.drag', onDrag) + .on('$md.dragend', onDragEnd); + + return function cleanupGestures() { + deregister(); + parent.off('$md.dragstart', onDragStart); + parent.off('$md.drag', onDrag); + parent.off('$md.dragend', onDragEnd); + }; + + function onDragStart() { + // Disable transitions on transform so that it feels fast + element.css($mdConstant.CSS.TRANSITION_DURATION, '0ms'); + } + + function onDrag(ev) { + var transform = ev.pointer.distanceY; + if (transform < 5) { + // Slow down drag when trying to drag up, and stop after PADDING + transform = Math.max(-PADDING, transform / 2); + } + element.css($mdConstant.CSS.TRANSFORM, 'translate3d(0,' + (PADDING + transform) + 'px,0)'); + } + + function onDragEnd(ev) { + if (ev.pointer.distanceY > 0 && + (ev.pointer.distanceY > 20 || Math.abs(ev.pointer.velocityY) > CLOSING_VELOCITY)) { + var distanceRemaining = element.prop('offsetHeight') - ev.pointer.distanceY; + var transitionDuration = Math.min(distanceRemaining / ev.pointer.velocityY * 0.75, 500); + element.css($mdConstant.CSS.TRANSITION_DURATION, transitionDuration + 'ms'); + $mdUtil.nextTick($mdBottomSheet.cancel, true); + } else { + element.css($mdConstant.CSS.TRANSITION_DURATION, ''); + element.css($mdConstant.CSS.TRANSFORM, ''); + } + } + } + } +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.button + * @description + * + * Button + */ +MdButtonDirective.$inject = ["$mdButtonInkRipple", "$mdTheming", "$mdAria", "$mdInteraction"]; +MdAnchorDirective.$inject = ["$mdTheming"]; +angular + .module('material.components.button', ['material.core']) + .directive('mdButton', MdButtonDirective) + .directive('a', MdAnchorDirective); + + +/** + * @private + * @restrict E + * + * @description + * `a` is an anchor directive used to inherit theme colors for md-primary, md-accent, etc. + * + * @usage + * + * + * + * + * + * + */ +function MdAnchorDirective($mdTheming) { + return { + restrict : 'E', + link : function postLink(scope, element) { + // Make sure to inherit theme so stand-alone anchors + // support theme colors for md-primary, md-accent, etc. + $mdTheming(element); + } + }; +} + + +/** + * @ngdoc directive + * @name mdButton + * @module material.components.button + * + * @restrict E + * + * @description + * `` is a button directive with optional ink ripples (default enabled). + * + * If you supply a `href` or `ng-href` attribute, it will become an `` element. Otherwise, it + * will become a `'; + } + } + + function postLink(scope, element, attr) { + $mdTheming(element); + $mdButtonInkRipple.attach(scope, element); + + // Use async expect to support possible bindings in the button label + $mdAria.expectWithoutText(element, 'aria-label'); + + // For anchor elements, we have to set tabindex manually when the element is disabled. + // We don't do this for md-nav-bar anchors as the component manages its own tabindex values. + if (isAnchor(attr) && angular.isDefined(attr.ngDisabled) && + !element.hasClass('_md-nav-button')) { + scope.$watch(attr.ngDisabled, function(isDisabled) { + element.attr('tabindex', isDisabled ? -1 : 0); + }); + } + + // disabling click event when disabled is true + element.on('click', function(e){ + if (attr.disabled === true) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + }); + + if (!element.hasClass('md-no-focus')) { + + element.on('focus', function() { + + // Only show the focus effect when being focused through keyboard interaction or programmatically + if (!$mdInteraction.isUserInvoked() || $mdInteraction.getLastInteractionType() === 'keyboard') { + element.addClass('md-focused'); + } + + }); + + element.on('blur', function() { + element.removeClass('md-focused'); + }); + } + + } + +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.card + * + * @description + * Card components. + */ +mdCardDirective.$inject = ["$mdTheming"]; +angular.module('material.components.card', [ + 'material.core' + ]) + .directive('mdCard', mdCardDirective); + + +/** + * @ngdoc directive + * @name mdCard + * @module material.components.card + * + * @restrict E + * + * @description + * The `` directive is a container element used within `` containers. + * + * An image included as a direct descendant will fill the card's width. If you want to avoid this, + * you can add the `md-image-no-fill` class to the parent element. The `` + * container will wrap text content and provide padding. An `` element can be + * optionally included to put content flush against the bottom edge of the card. + * + * Action buttons can be included in an `` element, similar to ``. + * You can then position buttons using layout attributes. + * + * Card is built with: + * * `` - Header for the card, holds avatar, text and squared image + * - `` - Card avatar + * - `md-user-avatar` - Class for user image + * - `` + * - `` - Contains elements for the card description + * - `md-title` - Class for the card title + * - `md-subhead` - Class for the card sub header + * * `` - Image for the card + * * `` - Card content title + * - `` + * - `md-headline` - Class for the card content title + * - `md-subhead` - Class for the card content sub header + * - `` - Squared image within the title + * - `md-media-sm` - Class for small image + * - `md-media-md` - Class for medium image + * - `md-media-lg` - Class for large image + * - `md-media-xl` - Class for extra large image + * * `` - Card content + * * `` - Card actions + * - `` - Icon actions + * + * Cards have constant width and variable heights; where the maximum height is limited to what can + * fit within a single view on a platform, but it can temporarily expand as needed. + * + * @usage + * ### Card with optional footer + * + * + * image caption + * + *

    Card headline

    + *

    Card content

    + *
    + * + * Card footer + * + *
    + *
    + * + * ### Card with actions + * + * + * image caption + * + *

    Card headline

    + *

    Card content

    + *
    + * + * Action 1 + * Action 2 + * + *
    + *
    + * + * ### Card with header, image, title actions and content + * + * + * + * + * + * + * + * Title + * Sub header + * + * + * image caption + * + * + * Card headline + * Card subheader + * + * + * + * Action 1 + * Action 2 + * + * + * + * + * + * + * + *

    + * Card content + *

    + *
    + *
    + *
    + */ +function mdCardDirective($mdTheming) { + return { + restrict: 'E', + link: function ($scope, $element, attr) { + $element.addClass('_md'); // private md component indicator for styling + $mdTheming($element); + } + }; +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.checkbox + * @description Checkbox module! + */ +MdCheckboxDirective.$inject = ["inputDirective", "$mdAria", "$mdConstant", "$mdTheming", "$mdUtil", "$mdInteraction"]; +angular + .module('material.components.checkbox', ['material.core']) + .directive('mdCheckbox', MdCheckboxDirective); + +/** + * @ngdoc directive + * @name mdCheckbox + * @module material.components.checkbox + * @restrict E + * + * @description + * The checkbox directive is used like the normal + * [angular checkbox](https://docs.angularjs.org/api/ng/input/input%5Bcheckbox%5D). + * + * As per the [Material Design spec](https://material.io/archive/guidelines/style/color.html#color-color-palette) + * the checkbox is in the accent color by default. The primary color palette may be used with + * the `md-primary` class. + * + * @param {expression} ng-model Assignable angular expression to data-bind to. + * @param {string=} name Property name of the form under which the control is published. + * @param {expression=} ng-true-value The value to which the expression should be set when selected. + * @param {expression=} ng-false-value The value to which the expression should be set when not + * selected. + * @param {expression=} ng-change Expression to be executed when the model value changes. + * @param {boolean=} md-no-ink If present, disable ink ripple effects. + * @param {string=} aria-label Adds label to checkbox for accessibility. + * Defaults to checkbox's text. If no default text is found, a warning will be logged. + * @param {expression=} md-indeterminate This determines when the checkbox should be rendered as + * 'indeterminate'. If a truthy expression or no value is passed in the checkbox renders in the + * md-indeterminate state. If falsy expression is passed in it just looks like a normal unchecked + * checkbox. The indeterminate, checked, and unchecked states are mutually exclusive. A box + * cannot be in any two states at the same time. Adding the 'md-indeterminate' attribute + * overrides any checked/unchecked rendering logic. When using the 'md-indeterminate' attribute + * use 'ng-checked' to define rendering logic instead of using 'ng-model'. + * @param {expression=} ng-checked If this expression evaluates as truthy, the 'md-checked' css + * class is added to the checkbox and it will appear checked. + * + * @usage + * + * + * Finished ? + * + * + * + * No Ink Effects + * + * + * + * Disabled + * + * + * + * + */ +function MdCheckboxDirective(inputDirective, $mdAria, $mdConstant, $mdTheming, $mdUtil, $mdInteraction) { + inputDirective = inputDirective[0]; + + return { + restrict: 'E', + transclude: true, + require: ['^?mdInputContainer', '?ngModel', '?^form'], + priority: $mdConstant.BEFORE_NG_ARIA, + template: + '
    ' + + '
    ' + + '
    ' + + '
    ', + compile: compile + }; + + // ********************************************************** + // Private Methods + // ********************************************************** + + function compile (tElement, tAttrs) { + tAttrs.$set('tabindex', tAttrs.tabindex || '0'); + tAttrs.$set('type', 'checkbox'); + tAttrs.$set('role', tAttrs.type); + tElement.addClass('md-auto-horizontal-margin'); + + return { + pre: function(scope, element) { + // Attach a click handler during preLink, in order to immediately stop propagation + // (especially for ng-click) when the checkbox is disabled. + element.on('click', function(e) { + if (this.hasAttribute('disabled')) { + e.stopImmediatePropagation(); + } + }); + }, + post: postLink + }; + + function postLink(scope, element, attr, ctrls) { + var isIndeterminate; + var containerCtrl = ctrls[0]; + var ngModelCtrl = ctrls[1] || $mdUtil.fakeNgModel(); + var formCtrl = ctrls[2]; + var labelHasLink = element.find('a').length > 0; + + // The original component structure is not accessible when the checkbox's label contains a link. + // In order to keep backwards compatibility, we're only changing the structure of the component + // when we detect a link within the label. Using a span after the md-checkbox and attaching it + // via aria-labelledby allows screen readers to find and work with the link within the label. + if (labelHasLink) { + var labelId = 'label-' + $mdUtil.nextUid(); + attr.$set('aria-labelledby', labelId); + + var label = element.children()[1]; + // Use jQLite here since ChildNode.remove() is not supported in IE11. + angular.element(label).remove(); + label.removeAttribute('ng-transclude'); + label.className = 'md-checkbox-link-label'; + label.setAttribute('id', labelId); + element.after(label); + // Make sure that clicking on the label still causes the checkbox to be toggled, when appropriate. + var externalLabel = element.next(); + externalLabel.on('click', listener); + } + + if (containerCtrl) { + var isErrorGetter = containerCtrl.isErrorGetter || function() { + return ngModelCtrl.$invalid && (ngModelCtrl.$touched || (formCtrl && formCtrl.$submitted)); + }; + + containerCtrl.input = element; + + scope.$watch(isErrorGetter, containerCtrl.setInvalid); + } + + $mdTheming(element); + + // Redirect focus events to the root element, because IE11 is always focusing the container element instead + // of the md-checkbox element. This causes issues when using ngModelOptions: `updateOnBlur` + element.children().on('focus', function() { + element.focus(); + }); + + if ($mdUtil.parseAttributeBoolean(attr.mdIndeterminate)) { + setIndeterminateState(); + scope.$watch(attr.mdIndeterminate, setIndeterminateState); + } + + if (attr.ngChecked) { + scope.$watch(scope.$eval.bind(scope, attr.ngChecked), function(value) { + ngModelCtrl.$setViewValue(value); + ngModelCtrl.$render(); + }); + } + + $$watchExpr('ngDisabled', 'tabindex', { + true: '-1', + false: attr.tabindex + }); + + // Don't emit a warning when the label has a link within it. In that case we'll use + // aria-labelledby to point to another span that should be read as the label. + if (!labelHasLink) { + $mdAria.expectWithText(element, 'aria-label'); + } + + // Reuse the original input[type=checkbox] directive from AngularJS core. + // This is a bit hacky as we need our own event listener and own render + // function. + inputDirective.link.pre(scope, { + on: angular.noop, + 0: {} + }, attr, [ngModelCtrl]); + + element.on('click', listener) + .on('keypress', keypressHandler) + .on('focus', function() { + if ($mdInteraction.getLastInteractionType() === 'keyboard') { + element.addClass('md-focused'); + } + }) + .on('blur', function() { + element.removeClass('md-focused'); + }); + + ngModelCtrl.$render = render; + + function $$watchExpr(expr, htmlAttr, valueOpts) { + if (attr[expr]) { + scope.$watch(attr[expr], function(val) { + if (valueOpts[val]) { + element.attr(htmlAttr, valueOpts[val]); + } + }); + } + } + + /** + * @param {KeyboardEvent} ev 'keypress' event to handle + */ + function keypressHandler(ev) { + var keyCode = ev.which || ev.keyCode; + var submit, form; + + ev.preventDefault(); + switch (keyCode) { + case $mdConstant.KEY_CODE.SPACE: + element.addClass('md-focused'); + listener(ev); + break; + case $mdConstant.KEY_CODE.ENTER: + // Match the behavior of the native . + // When the enter key is pressed while focusing a native checkbox inside a form, + // the browser will trigger a `click` on the first non-disabled submit button/input + // in the form. Note that this is different from text inputs, which + // will directly submit the form without needing a submit button/input to be present. + form = $mdUtil.getClosest(ev.target, 'form'); + if (form) { + submit = form.querySelector('button[type="submit"]:enabled, input[type="submit"]:enabled'); + if (submit) { + submit.click(); + } + } + break; + } + } + + function listener(ev) { + // skipToggle boolean is used by the switch directive to prevent the click event + // when releasing the drag. There will be always a click if releasing the drag over the checkbox. + // If the click came from a link in the checkbox, don't toggle the value. + // We want the link to be opened without changing the value in this case. + if (element[0].hasAttribute('disabled') || scope.skipToggle || ev.target.tagName === 'A') { + return; + } + + scope.$apply(function() { + // Toggle the checkbox value... + var viewValue = attr.ngChecked && attr.ngClick ? attr.checked : !ngModelCtrl.$viewValue; + + ngModelCtrl.$setViewValue(viewValue, ev && ev.type); + ngModelCtrl.$render(); + }); + } + + function render() { + // Cast the $viewValue to a boolean since it could be undefined + var checked = !!ngModelCtrl.$viewValue && !isIndeterminate; + element.toggleClass('md-checked', checked); + if (!isIndeterminate) { + if (checked) { + element.attr('aria-checked', 'true'); + } else { + element.attr('aria-checked', 'false'); + } + } + } + + /** + * @param {string=} newValue + */ + function setIndeterminateState(newValue) { + isIndeterminate = newValue !== false; + if (isIndeterminate) { + element.attr('aria-checked', 'mixed'); + } + element.toggleClass('md-indeterminate', isIndeterminate); + ngModelCtrl.$render(); + } + } + } +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.chips + */ +/* + * @see js folder for chips implementation + */ +angular.module('material.components.chips', [ + 'material.core', + 'material.components.autocomplete' +]); + +})(); +(function(){ +"use strict"; + + +MdChipCtrl.$inject = ["$scope", "$element", "$mdConstant", "$timeout", "$mdUtil"];angular + .module('material.components.chips') + .controller('MdChipCtrl', MdChipCtrl); + +/** + * Controller for the MdChip component. Responsible for handling keyboard + * events and editing the chip if needed. + * + * @param $scope + * @param $element + * @param $mdConstant + * @param $timeout + * @param $mdUtil + * @constructor + */ +function MdChipCtrl ($scope, $element, $mdConstant, $timeout, $mdUtil) { + /** + * @type {$scope} + */ + this.$scope = $scope; + + /** + * @type {$element} + */ + this.$element = $element; + + /** + * @type {$mdConstant} + */ + this.$mdConstant = $mdConstant; + + /** + * @type {$timeout} + */ + this.$timeout = $timeout; + + /** + * @type {$mdUtil} + */ + this.$mdUtil = $mdUtil; + + /** + * @type {boolean} + */ + this.isEditing = false; + + /** + * @type {MdChipsCtrl} + */ + this.parentController = undefined; + + /** + * @type {boolean} + */ + this.enableChipEdit = false; +} + + +/** + * @param {MdChipsCtrl} controller + */ +MdChipCtrl.prototype.init = function(controller) { + this.parentController = controller; + this.enableChipEdit = this.parentController.enableChipEdit; + + if (this.enableChipEdit) { + this.$element.on('keydown', this.chipKeyDown.bind(this)); + this.$element.on('dblclick', this.chipMouseDoubleClick.bind(this)); + this.getChipContent().addClass('_md-chip-content-edit-is-enabled'); + } +}; + + +/** + * @return {Object} first element with the md-chip-content class + */ +MdChipCtrl.prototype.getChipContent = function() { + var chipContents = this.$element[0].getElementsByClassName('md-chip-content'); + return angular.element(chipContents[0]); +}; + + +/** + * When editing the chip, if the user modifies the existing contents, we'll get a span back and + * need to ignore text elements as they only contain blank space. + * `children()` ignores text elements. + * + * When editing the chip, if the user deletes the contents and then enters some new content + * we'll only get a text element back. + * @return {Object} jQuery object representing the content element of the chip + */ +MdChipCtrl.prototype.getContentElement = function() { + var contentElement = angular.element(this.getChipContent().children()[0]); + if (!contentElement || contentElement.length === 0) { + contentElement = angular.element(this.getChipContent().contents()[0]); + } + return contentElement; +}; + + +/** + * @return {number} index of this chip + */ +MdChipCtrl.prototype.getChipIndex = function() { + return parseInt(this.$element.attr('index')); +}; + + +/** + * Update the chip's contents, focus the chip if it's selected, and exit edit mode. + * If the contents were updated to be empty, remove the chip and re-focus the input element. + */ +MdChipCtrl.prototype.goOutOfEditMode = function() { + if (!this.isEditing) { + return; + } + + this.isEditing = false; + this.$element.removeClass('_md-chip-editing'); + this.getChipContent()[0].contentEditable = 'false'; + var chipIndex = this.getChipIndex(); + + var content = this.getContentElement().text(); + if (content) { + this.parentController.updateChipContents(chipIndex, content); + + this.$mdUtil.nextTick(function() { + if (this.parentController.selectedChip === chipIndex) { + this.parentController.focusChip(chipIndex); + } + }.bind(this)); + } else { + this.parentController.removeChipAndFocusInput(chipIndex); + } +}; + + +/** + * Given an HTML element. Selects contents of it. + * @param {Element} node + */ +MdChipCtrl.prototype.selectNodeContents = function(node) { + var range, selection; + if (document.body.createTextRange) { + range = document.body.createTextRange(); + range.moveToElementText(node); + range.select(); + } else if (window.getSelection) { + selection = window.getSelection(); + range = document.createRange(); + range.selectNodeContents(node); + selection.removeAllRanges(); + selection.addRange(range); + } +}; + + +/** + * Presents an input element to edit the contents of the chip. + */ +MdChipCtrl.prototype.goInEditMode = function() { + this.isEditing = true; + this.$element.addClass('_md-chip-editing'); + this.getChipContent()[0].contentEditable = 'true'; + this.getChipContent().on('blur', function() { + this.goOutOfEditMode(); + }.bind(this)); + + this.selectNodeContents(this.getChipContent()[0]); +}; + + +/** + * Handles the keydown event on the chip element. If enable-chip-edit attribute is + * set to true, space or enter keys can trigger going into edit mode. Enter can also + * trigger submitting if the chip is already being edited. + * @param {KeyboardEvent} event + */ +MdChipCtrl.prototype.chipKeyDown = function(event) { + if (!this.isEditing && + (event.keyCode === this.$mdConstant.KEY_CODE.ENTER || + event.keyCode === this.$mdConstant.KEY_CODE.SPACE)) { + event.preventDefault(); + this.goInEditMode(); + } else if (this.isEditing && event.keyCode === this.$mdConstant.KEY_CODE.ENTER) { + event.preventDefault(); + this.goOutOfEditMode(); + } +}; + + +/** + * Enter edit mode if we're not already editing and the enable-chip-edit attribute is enabled. + */ +MdChipCtrl.prototype.chipMouseDoubleClick = function() { + if (this.enableChipEdit && !this.isEditing) { + this.goInEditMode(); + } +}; + +})(); +(function(){ +"use strict"; + + +MdChip.$inject = ["$mdTheming", "$mdUtil", "$compile", "$timeout"];angular + .module('material.components.chips') + .directive('mdChip', MdChip); + +/** + * @ngdoc directive + * @name mdChip + * @module material.components.chips + * + * @description + * `` is a component used within ``. It is responsible for rendering an + * individual chip. + * + * + * @usage + * + * + * {{$chip}} + * + * + * + */ + +/** + * MDChip Directive Definition + * + * @param $mdTheming + * @param $mdUtil + * @param $compile + * @param $timeout + * @ngInject + */ +function MdChip($mdTheming, $mdUtil, $compile, $timeout) { + return { + restrict: 'E', + require: ['^?mdChips', 'mdChip'], + link: postLink, + controller: 'MdChipCtrl' + }; + + function postLink(scope, element, attr, ctrls) { + var chipsController = ctrls.shift(); + var chipController = ctrls.shift(); + var chipContentElement = angular.element(element[0].querySelector('.md-chip-content')); + + $mdTheming(element); + + if (chipsController) { + chipController.init(chipsController); + + // When a chip is blurred, make sure to unset (or reset) the selected chip so that tabbing + // through elements works properly + chipContentElement.on('blur', function() { + chipsController.resetSelectedChip(); + chipsController.$scope.$applyAsync(); + }); + } + + // Use $timeout to ensure we run AFTER the element has been added to the DOM so we can focus it. + $timeout(function() { + if (!chipsController) { + return; + } + + if (chipsController.shouldFocusLastChip) { + chipsController.focusLastChipThenInput(); + } + }); + } +} + +})(); +(function(){ +"use strict"; + + +MdChipRemove.$inject = ["$timeout"];angular + .module('material.components.chips') + .directive('mdChipRemove', MdChipRemove); + +/** + * @ngdoc directive + * @name mdChipRemove + * @restrict A + * @module material.components.chips + * + * @description + * Indicates that the associated element should be used as the delete button template for all chips. + * The associated element must be a child of `md-chips`. + * + * The provided button template will be appended to each chip and will remove the associated chip + * on click. + * + * The button is not styled or themed based on the theme set on the `md-chips` component. A theme + * class and custom icon can be specified in your template. + * + * You can also specify the `type` of the button in your template. + * + * @usage + * ### With Standard Chips + * + * + * + * + * + * + * ### With Object Chips + * + * + * + * + * + */ + + +/** + * MdChipRemove Directive Definition. + * + * @param $timeout + * @returns {{restrict: string, require: string[], link: Function, scope: boolean}} + * @constructor + */ +function MdChipRemove ($timeout) { + return { + restrict: 'A', + require: '^mdChips', + scope: false, + link: postLink + }; + + function postLink(scope, element, attr, ctrl) { + element.on('click', function() { + scope.$apply(function() { + ctrl.removeChip(scope.$$replacedScope.$index); + }); + }); + + // Child elements aren't available until after a $timeout tick as they are hidden by an + // `ng-if`. see http://goo.gl/zIWfuw + $timeout(function() { + element.attr({ 'tabindex': '-1', 'aria-hidden': 'true' }); + element.find('button').attr('tabindex', '-1'); + }); + } +} + +})(); +(function(){ +"use strict"; + + +MdChipTransclude.$inject = ["$compile"];angular + .module('material.components.chips') + .directive('mdChipTransclude', MdChipTransclude); + +function MdChipTransclude ($compile) { + return { + restrict: 'EA', + terminal: true, + link: link, + scope: false + }; + function link (scope, element, attr) { + var ctrl = scope.$parent.$mdChipsCtrl, + newScope = ctrl.parent.$new(false, ctrl.parent); + newScope.$$replacedScope = scope; + newScope.$chip = scope.$chip; + newScope.$index = scope.$index; + newScope.$mdChipsCtrl = ctrl; + + var newHtml = ctrl.$scope.$eval(attr.mdChipTransclude); + + element.html(newHtml); + $compile(element.contents())(newScope); + } +} + +})(); +(function(){ +"use strict"; + +/** + * The default chip append delay. + * + * @type {number} + */ +MdChipsCtrl.$inject = ["$scope", "$attrs", "$mdConstant", "$log", "$element", "$timeout", "$mdUtil", "$mdLiveAnnouncer", "$exceptionHandler"]; +var DEFAULT_CHIP_APPEND_DELAY = 300; + +angular + .module('material.components.chips') + .controller('MdChipsCtrl', MdChipsCtrl); + +/** + * Controller for the MdChips component. Responsible for adding to and + * removing from the list of chips, marking chips as selected, and binding to + * the models of various input components. + * + * @param $scope + * @param $attrs + * @param $mdConstant + * @param $log + * @param $element + * @param $timeout + * @param $mdUtil + * @param $mdLiveAnnouncer + * @param $exceptionHandler + * @constructor + */ +function MdChipsCtrl ($scope, $attrs, $mdConstant, $log, $element, $timeout, $mdUtil, + $mdLiveAnnouncer, $exceptionHandler) { + /** @type {Function} **/ + this.$timeout = $timeout; + + /** @type {Object} */ + this.$mdConstant = $mdConstant; + + /** @type {angular.$scope} */ + this.$scope = $scope; + + /** @type {angular.$scope} */ + this.parent = $scope.$parent; + + /** @type {$mdUtil} */ + this.$mdUtil = $mdUtil; + + /** @type {$log} */ + this.$log = $log; + + /** @type {$mdLiveAnnouncer} */ + this.$mdLiveAnnouncer = $mdLiveAnnouncer; + + /** @type {$exceptionHandler} */ + this.$exceptionHandler = $exceptionHandler; + + /** @type {$element} */ + this.$element = $element; + + /** @type {$attrs} */ + this.$attrs = $attrs; + + /** @type {angular.NgModelController} */ + this.ngModelCtrl = null; + + /** @type {angular.NgModelController} */ + this.userInputNgModelCtrl = null; + + /** @type {MdAutocompleteCtrl} */ + this.autocompleteCtrl = null; + + /** @type {Element} */ + this.userInputElement = null; + + /** @type {Array.} */ + this.items = []; + + /** @type {number} */ + this.selectedChip = -1; + + /** @type {string} */ + this.enableChipEdit = $mdUtil.parseAttributeBoolean($attrs.mdEnableChipEdit); + + /** @type {string} */ + this.addOnBlur = $mdUtil.parseAttributeBoolean($attrs.mdAddOnBlur); + + /** + * The class names to apply to the autocomplete or input. + * @type {string} + */ + this.inputClass = ''; + + /** + * The text to be used as the aria-label for the input. + * @type {string} + */ + this.inputAriaLabel = 'Chips input.'; + + /** + * Label text to describe the chips container. Used to give context and instructions to screen + * reader users when the chips container is selected. + * @type {string} + */ + this.containerHint = 'Chips container. Use arrow keys to select chips.'; + + /** + * Label text to describe the chips container when it is empty. Used to give context and + * instructions to screen reader users when the chips container is selected and it contains + * no chips. + * @type {string} + */ + this.containerEmptyHint = + 'Chips container. Enter the text area, then type text, and press enter to add a chip.'; + + /** + * Hidden hint text for how to delete a chip. Used to give context to screen readers. + * @type {string} + */ + this.deleteHint = 'Press delete to remove this chip.'; + + /** + * Hidden label for the delete button. Used to give context to screen readers. + * @type {string} + */ + this.deleteButtonLabel = 'Remove'; + + /** + * Model used by the input element. + * @type {string} + */ + this.chipBuffer = ''; + + /** + * Whether to use the transformChip expression to transform the chip buffer + * before appending it to the list. + * @type {boolean} + */ + this.useTransformChip = false; + + /** + * Whether to use the onAdd expression to notify of chip additions. + * @type {boolean} + */ + this.useOnAdd = false; + + /** + * Whether to use the onRemove expression to notify of chip removals. + * @type {boolean} + */ + this.useOnRemove = false; + + /** + * The ID of the chips wrapper which is used to build unique IDs for the chips and the aria-owns + * attribute. + * + * Defaults to '_md-chips-wrapper-' plus a unique number. + * + * @type {string} + */ + this.wrapperId = ''; + + /** + * Array of unique numbers which will be auto-generated any time the items change, and is used to + * create unique IDs for the aria-owns attribute. + * + * @type {Array} + */ + this.contentIds = []; + + /** + * The index of the chip that should have it's `tabindex` property set to `0` so it is selectable + * via the keyboard. + * + * @type {number|null} + */ + this.ariaTabIndex = null; + + /** + * After appending a chip, the chip will be focused for this number of milliseconds before the + * input is refocused. + * + * **Note:** This is **required** for compatibility with certain screen readers in order for + * them to properly allow keyboard access. + * + * @type {number} + */ + this.chipAppendDelay = DEFAULT_CHIP_APPEND_DELAY; + + /** + * Collection of functions to call to un-register watchers + * + * @type {Array} + */ + this.deRegister = []; + + /** + * The screen reader will announce the chip content followed by this message when a chip is added. + * @type {string} + */ + this.addedMessage = 'added'; + + /** + * The screen reader will announce the chip content followed by this message when a chip is + * removed. + * @type {string} + */ + this.removedMessage = 'removed'; + + this.init(); +} + +/** + * Initializes variables and sets up watchers + */ +MdChipsCtrl.prototype.init = function() { + var ctrl = this; + + // Set the wrapper ID + this.wrapperId = '_md-chips-wrapper-' + this.$mdUtil.nextUid(); + + // If we're using static chips, then we need to initialize a few things. + if (!this.$element.attr('ng-model')) { + this.setupStaticChips(); + } + + // Setup a watcher which manages the role and aria-owns attributes. + // This is never called for static chips since items is not defined. + this.deRegister.push( + this.$scope.$watchCollection('$mdChipsCtrl.items', function() { + // Make sure our input and wrapper have the correct ARIA attributes + ctrl.setupInputAria(); + ctrl.setupWrapperAria(); + }) + ); + + this.deRegister.push( + this.$attrs.$observe('mdChipAppendDelay', function(newValue) { + ctrl.chipAppendDelay = parseInt(newValue) || DEFAULT_CHIP_APPEND_DELAY; + }) + ); +}; + +/** + * Destructor for cleanup + */ +MdChipsCtrl.prototype.$onDestroy = function $onDestroy() { + var $destroyFn; + while (($destroyFn = this.deRegister.pop())) { + $destroyFn.call(this); + } +}; + +/** + * If we have an input, ensure it has the appropriate ARIA attributes. + */ +MdChipsCtrl.prototype.setupInputAria = function() { + var input = this.$element.find('input'); + + // If we have no input, just return + if (!input) { + return; + } + + input.attr('role', 'textbox'); + input.attr('aria-multiline', true); + if (this.inputAriaDescribedBy) { + input.attr('aria-describedby', this.inputAriaDescribedBy); + } + if (this.inputAriaLabelledBy) { + input.attr('aria-labelledby', this.inputAriaLabelledBy); + input.removeAttr('aria-label'); + } else { + input.attr('aria-label', this.inputAriaLabel); + } +}; + +/** + * Ensure our wrapper has the appropriate ARIA attributes. + */ +MdChipsCtrl.prototype.setupWrapperAria = function() { + var ctrl = this, + wrapper = this.$element.find('md-chips-wrap'); + + if (this.items && this.items.length) { + // Dynamically add the listbox role on every change because it must be removed when there are + // no items. + wrapper.attr('role', 'listbox'); + + // Generate some random (but unique) IDs for each chip + this.contentIds = this.items.map(function() { + return ctrl.wrapperId + '-chip-' + ctrl.$mdUtil.nextUid(); + }); + + // Use the contentIDs above to generate the aria-owns attribute + wrapper.attr('aria-owns', this.contentIds.join(' ')); + wrapper.attr('aria-label', this.containerHint); + } else { + // If we have no items, then the role and aria-owns attributes MUST be removed + wrapper.removeAttr('role'); + wrapper.removeAttr('aria-owns'); + wrapper.attr('aria-label', this.containerEmptyHint); + } +}; + +/** + * Apply specific roles and aria attributes for static chips + */ +MdChipsCtrl.prototype.setupStaticChips = function() { + var ctrl = this, i, staticChips; + var wrapper = this.$element.find('md-chips-wrap'); + + this.$timeout(function() { + wrapper.attr('role', 'list'); + staticChips = wrapper[0].children; + for (i = 0; i < staticChips.length; i++) { + staticChips[i].setAttribute('role', 'listitem'); + staticChips[i].setAttribute('aria-setsize', staticChips.length); + } + if (ctrl.inputAriaDescribedBy) { + wrapper.attr('aria-describedby', ctrl.inputAriaDescribedBy); + } + if (ctrl.inputAriaLabelledBy) { + wrapper.attr('aria-labelledby', ctrl.inputAriaLabelledBy); + wrapper.removeAttr('aria-label'); + } else { + wrapper.attr('aria-label', ctrl.inputAriaLabel); + } + }, 10); +}; + +/** + * Handles the keydown event on the input element: by default appends + * the buffer to the chip list, while backspace removes the last chip in the + * list if the current buffer is empty. + * @param {jQuery.Event|KeyboardEvent} event + */ +MdChipsCtrl.prototype.inputKeydown = function(event) { + var chipBuffer = this.getChipBuffer(); + + // If we have an autocomplete, and it handled the event, we have nothing to do + if (this.autocompleteCtrl && event.isDefaultPrevented && event.isDefaultPrevented()) { + return; + } + + if (event.keyCode === this.$mdConstant.KEY_CODE.BACKSPACE) { + // Only select and focus the previous chip, if the current caret position of the + // input element is at the beginning. + if (this.getCursorPosition(event.target) !== 0) { + return; + } + + event.preventDefault(); + event.stopPropagation(); + + if (this.items.length) { + this.selectAndFocusChipSafe(this.items.length - 1); + } + + return; + } + + // By default appends the buffer to the chip list. + if (!this.separatorKeys || this.separatorKeys.length < 1) { + this.separatorKeys = [this.$mdConstant.KEY_CODE.ENTER]; + } + + // Support additional separator key codes in an array of `md-separator-keys`. + if (this.separatorKeys.indexOf(event.keyCode) !== -1) { + if ((this.autocompleteCtrl && this.requireMatch) || !chipBuffer) return; + event.preventDefault(); + + // Only append the chip and reset the chip buffer if the max chips limit isn't reached. + if (this.hasMaxChipsReached()) return; + + this.appendChip(chipBuffer.trim()); + this.resetChipBuffer(); + + return false; + } +}; + +/** + * Returns the cursor position of the specified input element. + * @param {HTMLInputElement} element relevant input element + * @returns {Number} Cursor Position of the input. + */ +MdChipsCtrl.prototype.getCursorPosition = function(element) { + /* + * Figure out whether the current input for the chips buffer is valid for using + * the selectionStart / end property to retrieve the cursor position. + * Some browsers do not allow the use of those attributes, on different input types. + */ + try { + if (element.selectionStart === element.selectionEnd) { + return element.selectionStart; + } + } catch (e) { + if (!element.value) { + return 0; + } + } +}; + + +/** + * Updates the content of the chip at given index + * @param {number} chipIndex + * @param {string} chipContents + */ +MdChipsCtrl.prototype.updateChipContents = function(chipIndex, chipContents) { + if (chipIndex >= 0 && chipIndex < this.items.length) { + this.items[chipIndex] = chipContents; + this.updateNgModel(true); + } +}; + + +/** + * @return {boolean} true if a chip is currently being edited. False otherwise. + */ +MdChipsCtrl.prototype.isEditingChip = function() { + return !!this.$element[0].querySelector('._md-chip-editing'); +}; + +/** + * @param {string|Object} chip contents of a single chip + * @returns {boolean} true if the chip is an Object, false otherwise. + * @private + */ +MdChipsCtrl.prototype._isChipObject = function(chip) { + return angular.isObject(chip); +}; + +/** + * @returns {boolean} true if chips can be removed, false otherwise. + */ +MdChipsCtrl.prototype.isRemovable = function() { + // Return false if we have static chips + if (!this.ngModelCtrl) { + return false; + } + + return this.readonly ? this.removable : + angular.isDefined(this.removable) ? this.removable : true; +}; + +/** + * Handles the keydown event on the chip elements: backspace removes the selected chip, arrow + * keys switch which chip is active. + * @param {KeyboardEvent} event + */ +MdChipsCtrl.prototype.chipKeydown = function (event) { + if (this.getChipBuffer()) return; + if (this.isEditingChip()) return; + + switch (event.keyCode) { + case this.$mdConstant.KEY_CODE.BACKSPACE: + case this.$mdConstant.KEY_CODE.DELETE: + if (this.selectedChip < 0) return; + event.preventDefault(); + // Cancel the delete action only after the event cancel. Otherwise the page will go back. + if (!this.isRemovable()) return; + this.removeAndSelectAdjacentChip(this.selectedChip, event); + break; + case this.$mdConstant.KEY_CODE.LEFT_ARROW: + event.preventDefault(); + // By default, allow selection of -1 which will focus the input; if we're readonly, don't go + // below 0. + if (this.selectedChip < 0 || (this.readonly && this.selectedChip === 0)) { + this.selectedChip = this.items.length; + } + if (this.items.length) this.selectAndFocusChipSafe(this.selectedChip - 1); + break; + case this.$mdConstant.KEY_CODE.RIGHT_ARROW: + event.preventDefault(); + this.selectAndFocusChipSafe(this.selectedChip + 1); + break; + case this.$mdConstant.KEY_CODE.ESCAPE: + case this.$mdConstant.KEY_CODE.TAB: + if (this.selectedChip < 0) return; + event.preventDefault(); + this.onFocus(); + break; + } +}; + +/** + * Get the input's placeholder - uses `placeholder` when list is empty and `secondary-placeholder` + * when the list is non-empty. If `secondary-placeholder` is not provided, `placeholder` is used + * always. + * @returns {string} + */ +MdChipsCtrl.prototype.getPlaceholder = function() { + // Allow `secondary-placeholder` to be blank. + var useSecondary = (this.items && this.items.length && + (this.secondaryPlaceholder === '' || this.secondaryPlaceholder)); + return useSecondary ? this.secondaryPlaceholder : this.placeholder; +}; + +/** + * Removes chip at {@code index} and selects the adjacent chip. + * @param {number} index adjacent chip to select + * @param {Event=} event + */ +MdChipsCtrl.prototype.removeAndSelectAdjacentChip = function(index, event) { + var self = this; + var selIndex = self.getAdjacentChipIndex(index); + var wrap = this.$element[0].querySelector('md-chips-wrap'); + var chip = this.$element[0].querySelector('md-chip[index="' + index + '"]'); + + self.removeChip(index, event); + + // The double-timeout is currently necessary to ensure that the DOM has finalized and the select() + // will find the proper chip since the selection is index-based. + // + // TODO: Investigate calling from within chip $scope.$on('$destroy') to reduce/remove timeouts + self.$timeout(function() { + self.$timeout(function() { + self.selectAndFocusChipSafe(selIndex); + }); + }); +}; + +/** + * Sets the selected chip index to -1. + */ +MdChipsCtrl.prototype.resetSelectedChip = function() { + this.selectedChip = -1; + this.ariaTabIndex = null; +}; + +/** + * Gets the index of an adjacent chip to select after deletion. Adjacency is + * determined as the next chip in the list, unless the target chip is the + * last in the list, then it is the chip immediately preceding the target. If + * there is only one item in the list, -1 is returned (select none). + * The number returned is the index to select AFTER the target has been removed. + * If the current chip is not selected, then -1 is returned to select none. + * @param {number} index + * @returns {number} + */ +MdChipsCtrl.prototype.getAdjacentChipIndex = function(index) { + var len = this.items.length - 1; + return (len === 0) ? -1 : + (index === len) ? index - 1 : index; +}; + +/** + * Append the contents of the buffer to the chip list. This method will first + * call out to the md-transform-chip method, if provided. + * @param {string} newChip chip buffer contents that will be used to create the new chip + */ +MdChipsCtrl.prototype.appendChip = function(newChip) { + this.shouldFocusLastChip = !this.addOnBlur; + if (this.useTransformChip && this.transformChip) { + var transformedChip = this.transformChip({'$chip': newChip}); + + // Check to make sure the chip is defined before assigning it, otherwise, we'll just assume + // they want the string version. + if (angular.isDefined(transformedChip)) { + newChip = transformedChip; + } + } + + // If items contains an identical object to newChip, do not append + if (angular.isObject(newChip)) { + var identical = this.items.some(function(item) { + return angular.equals(newChip, item); + }); + if (identical) return; + } + + // Check for a null (but not undefined), or existing chip and cancel appending + if (newChip == null || this.items.indexOf(newChip) + 1) return; + + // Append the new chip onto our list + var length = this.items.push(newChip); + var index = length - 1; + + this.updateNgModel(); + + // Tell screen reader users that the chip was successfully added. + // TODO add a way for developers to specify which field of the object should be announced here. + var chipContent = angular.isObject(newChip) ? '' : newChip; + this.$mdLiveAnnouncer.announce(chipContent + ' ' + this.addedMessage, 'assertive'); + + // If the md-on-add attribute is specified, send a chip addition event + if (this.useOnAdd && this.onAdd) { + this.onAdd({ '$chip': newChip, '$index': index }); + } +}; + +/** + * Sets whether to use the md-transform-chip expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code transformChip}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useTransformChipExpression = function() { + this.useTransformChip = true; +}; + +/** + * Sets whether to use the md-on-add expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code onAdd}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useOnAddExpression = function() { + this.useOnAdd = true; +}; + +/** + * Sets whether to use the md-on-remove expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code onRemove}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useOnRemoveExpression = function() { + this.useOnRemove = true; +}; + +/** + * Sets whether to use the md-on-select expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code onSelect}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useOnSelectExpression = function() { + this.useOnSelect = true; +}; + +/** + * Gets the input buffer. The input buffer can be the model bound to the + * default input item {@code this.chipBuffer}, the {@code selectedItem} + * model of an {@code md-autocomplete}, or, through some magic, the model + * bound to any input or text area element found within a + * {@code md-input-container} element. + * @return {string} the input buffer + */ +MdChipsCtrl.prototype.getChipBuffer = function() { + var chipBuffer = !this.userInputElement ? this.chipBuffer : + this.userInputNgModelCtrl ? this.userInputNgModelCtrl.$viewValue : + this.userInputElement[0].value; + + // Ensure that the chip buffer is always a string. For example, the input element buffer + // might be falsy. + return angular.isString(chipBuffer) ? chipBuffer : ''; +}; + +/** + * Resets the input buffer for either the internal input or user provided input element. + */ +MdChipsCtrl.prototype.resetChipBuffer = function() { + if (this.userInputElement) { + if (this.userInputNgModelCtrl) { + this.userInputNgModelCtrl.$setViewValue(''); + this.userInputNgModelCtrl.$render(); + } else { + this.userInputElement[0].value = ''; + } + } else { + this.chipBuffer = ''; + } +}; + +/** + * @returns {boolean} true if the max chips limit has been reached, false otherwise. + */ +MdChipsCtrl.prototype.hasMaxChipsReached = function() { + if (angular.isString(this.maxChips)) { + this.maxChips = parseInt(this.maxChips, 10) || 0; + } + + return this.maxChips > 0 && this.items.length >= this.maxChips; +}; + +/** + * Updates the validity properties for the ngModel. + * + * TODO add the md-max-chips validator to this.ngModelCtrl.validators so that the validation will + * be performed automatically. + */ +MdChipsCtrl.prototype.validateModel = function() { + this.ngModelCtrl.$setValidity('md-max-chips', !this.hasMaxChipsReached()); + this.ngModelCtrl.$validate(); // rerun any registered validators +}; + +/** + * Function to handle updating the model, validation, and change notification when a chip + * is added, removed, or changed. + * @param {boolean=} skipValidation true to skip calling validateModel() + */ +MdChipsCtrl.prototype.updateNgModel = function(skipValidation) { + if (!skipValidation) { + this.validateModel(); + } + // This will trigger ng-change to fire, even in cases where $setViewValue() would not. + angular.forEach(this.ngModelCtrl.$viewChangeListeners, function(listener) { + try { + listener(); + } catch (e) { + this.$exceptionHandler(e); + } + }); +}; + +/** + * Removes the chip at the given index. + * @param {number} index of chip to remove + * @param {Event=} event optionally passed to the onRemove callback + */ +MdChipsCtrl.prototype.removeChip = function(index, event) { + var removed = this.items.splice(index, 1); + + this.updateNgModel(); + this.ngModelCtrl.$setDirty(); + + // Tell screen reader users that the chip was successfully removed. + // TODO add a way for developers to specify which field of the object should be announced here. + var chipContent = angular.isObject(removed[0]) ? '' : removed[0]; + this.$mdLiveAnnouncer.announce(chipContent + ' ' + this.removedMessage, 'assertive'); + + if (removed && removed.length && this.useOnRemove && this.onRemove) { + this.onRemove({ '$chip': removed[0], '$index': index, '$event': event }); + } +}; + +/** + * @param {number} index location of chip to remove + * @param {Event=} $event + */ +MdChipsCtrl.prototype.removeChipAndFocusInput = function (index, $event) { + this.removeChip(index, $event); + + if (this.autocompleteCtrl) { + // Always hide the autocomplete dropdown before focusing the autocomplete input. + // Wait for the input to move horizontally, because the chip was removed. + // This can lead to an incorrect dropdown position. + this.autocompleteCtrl.hidden = true; + this.$mdUtil.nextTick(this.onFocus.bind(this)); + } else { + this.onFocus(); + } + +}; +/** + * Selects the chip at `index`, + * @param {number} index location of chip to select and focus + */ +MdChipsCtrl.prototype.selectAndFocusChipSafe = function(index) { + // If we have no chips, or are asked to select a chip before the first, just focus the input + if (!this.items.length || index === -1) { + return this.focusInput(); + } + + // If we are asked to select a chip greater than the number of chips... + if (index >= this.items.length) { + if (this.readonly) { + // If we are readonly, jump back to the start (because we have no input) + index = 0; + } else { + // If we are not readonly, we should attempt to focus the input + return this.onFocus(); + } + } + + index = Math.max(index, 0); + index = Math.min(index, this.items.length - 1); + + this.selectChip(index); + this.focusChip(index); +}; + +/** + * Focus last chip, then focus the input. This is needed for screen reader support. + */ +MdChipsCtrl.prototype.focusLastChipThenInput = function() { + var ctrl = this; + + ctrl.shouldFocusLastChip = false; + + ctrl.focusChip(this.items.length - 1); + + ctrl.$timeout(function() { + ctrl.focusInput(); + }, ctrl.chipAppendDelay); +}; + +/** + * Focus the input element. + */ +MdChipsCtrl.prototype.focusInput = function() { + this.selectChip(-1); + this.onFocus(); +}; + +/** + * Marks the chip at the given index as selected. + * @param {number} index location of chip to select + */ +MdChipsCtrl.prototype.selectChip = function(index) { + if (index >= -1 && index <= this.items.length) { + this.selectedChip = index; + + // Fire the onSelect if provided + if (this.useOnSelect && this.onSelect) { + this.onSelect({'$chip': this.items[index] }); + } + } else { + this.$log.warn('Selected Chip index out of bounds; ignoring.'); + } +}; + +/** + * Call {@code focus()} on the chip at {@code index} + * @param {number} index location of chip to focus + */ +MdChipsCtrl.prototype.focusChip = function(index) { + var chipContent = this.$element[0].querySelector( + 'md-chip[index="' + index + '"] .md-chip-content' + ); + + this.ariaTabIndex = index; + + chipContent.focus(); +}; + +/** + * Configures the required interactions with the ngModel Controller. + * Specifically, set {@code this.items} to the {@code NgModelController#$viewValue}. + * @param {NgModelController} ngModelCtrl + */ +MdChipsCtrl.prototype.configureNgModel = function(ngModelCtrl) { + this.ngModelCtrl = ngModelCtrl; + + var self = this; + + // in chips the meaning of $isEmpty changes + ngModelCtrl.$isEmpty = function(value) { + return !value || value.length === 0; + }; + + ngModelCtrl.$render = function() { + // model is updated. do something. + self.items = self.ngModelCtrl.$viewValue; + }; +}; + +MdChipsCtrl.prototype.onFocus = function () { + var input = this.$element[0].querySelector('input'); + input && input.focus(); + this.resetSelectedChip(); +}; + +MdChipsCtrl.prototype.onInputFocus = function () { + this.inputHasFocus = true; + + // Make sure we have the appropriate ARIA attributes + this.setupInputAria(); + + // Make sure we don't have any chips selected + this.resetSelectedChip(); +}; + +MdChipsCtrl.prototype.onInputBlur = function () { + this.inputHasFocus = false; + + if (this.shouldAddOnBlur()) { + this.appendChip(this.getChipBuffer().trim()); + this.resetChipBuffer(); + } +}; + +/** + * Configure event bindings on input element. + * @param {angular.element} inputElement + */ +MdChipsCtrl.prototype.configureInput = function configureInput(inputElement) { + // Find the NgModelCtrl for the input element + var ngModelCtrl = inputElement.controller('ngModel'); + var ctrl = this; + + if (ngModelCtrl) { + + // sync touched-state from inner input to chips-element + this.deRegister.push( + this.$scope.$watch( + function() { + return ngModelCtrl.$touched; + }, + function(isTouched) { + isTouched && ctrl.ngModelCtrl.$setTouched(); + } + ) + ); + + // sync dirty-state from inner input to chips-element + this.deRegister.push( + this.$scope.$watch( + function() { + return ngModelCtrl.$dirty; + }, + function(isDirty) { + isDirty && ctrl.ngModelCtrl.$setDirty(); + } + ) + ); + } +}; + +/** + * Configure event bindings on a user-provided input element. + * @param {angular.element} inputElement + */ +MdChipsCtrl.prototype.configureUserInput = function(inputElement) { + this.userInputElement = inputElement; + + // Find the NgModelCtrl for the input element + var ngModelCtrl = inputElement.controller('ngModel'); + // `.controller` will look in the parent as well. + if (ngModelCtrl !== this.ngModelCtrl) { + this.userInputNgModelCtrl = ngModelCtrl; + } + + var scope = this.$scope; + var ctrl = this; + + // Run all of the events using evalAsync because a focus may fire a blur in the same digest loop + var scopeApplyFn = function(event, fn) { + scope.$evalAsync(angular.bind(ctrl, fn, event)); + }; + + // Bind to keydown and focus events of input + inputElement + .attr({ tabindex: 0 }) + .on('keydown', function(event) { scopeApplyFn(event, ctrl.inputKeydown); }) + .on('focus', function(event) { scopeApplyFn(event, ctrl.onInputFocus); }) + .on('blur', function(event) { scopeApplyFn(event, ctrl.onInputBlur); }); +}; + +/** + * @param {MdAutocompleteCtrl} ctrl controller from the autocomplete component + */ +MdChipsCtrl.prototype.configureAutocomplete = function(ctrl) { + if (ctrl) { + this.autocompleteCtrl = ctrl; + // Update the default container empty hint when we're inside of an autocomplete. + if (!this.$element.attr('container-empty-hint')) { + this.containerEmptyHint = 'Chips container with autocompletion. Enter the text area, ' + + 'type text to search, and then use the up and down arrow keys to select an option. ' + + 'Press enter to add the selected option as a chip.'; + this.setupWrapperAria(); + } + + ctrl.registerSelectedItemWatcher(angular.bind(this, function (item) { + if (item) { + // Only append the chip and reset the chip buffer if the max chips limit isn't reached. + if (this.hasMaxChipsReached()) return; + + this.appendChip(item); + this.resetChipBuffer(); + } + })); + + this.$element.find('input') + .on('focus',angular.bind(this, this.onInputFocus)) + .on('blur', angular.bind(this, this.onInputBlur)); + } +}; + +/** + * @returns {boolean} Whether the current chip buffer should be added on input blur or not. + */ +MdChipsCtrl.prototype.shouldAddOnBlur = function() { + + // Update the custom ngModel validators from the chips component. + this.validateModel(); + + var chipBuffer = this.getChipBuffer().trim(); + // If the model value is empty and required is set on the element, then the model will be invalid. + // In that case, we still want to allow adding the chip. The main (but not only) case we want + // to disallow is adding a chip on blur when md-max-chips validation fails. + var isModelValid = this.ngModelCtrl.$isEmpty(this.ngModelCtrl.$modelValue) || + this.ngModelCtrl.$valid; + var isAutocompleteShowing = this.autocompleteCtrl && !this.autocompleteCtrl.hidden; + + if (this.userInputNgModelCtrl) { + isModelValid = isModelValid && this.userInputNgModelCtrl.$valid; + } + + return this.addOnBlur && !this.requireMatch && chipBuffer && isModelValid && + !isAutocompleteShowing; +}; + +/** + * @returns {boolean} true if the input or a chip is focused. False otherwise. + */ +MdChipsCtrl.prototype.hasFocus = function () { + return this.inputHasFocus || this.selectedChip >= 0; +}; + +/** + * @param {number} index location of content id + * @returns {number} unique id for the aria-owns attribute + */ +MdChipsCtrl.prototype.contentIdFor = function(index) { + return this.contentIds[index]; +}; + +})(); +(function(){ +"use strict"; + + + MdChips.$inject = ["$mdTheming", "$mdUtil", "$compile", "$log", "$timeout", "$$mdSvgRegistry"];angular + .module('material.components.chips') + .directive('mdChips', MdChips); + + /** + * @ngdoc directive + * @name mdChips + * @module material.components.chips + * + * @description + * `` is an input component for building lists of strings or objects. The list items are + * displayed as 'chips'. This component can make use of an `` element or an + * `` element. + * + * ### Custom templates + * A custom template may be provided to render the content of each chip. This is achieved by + * specifying an `` element containing the custom content as a child of + * ``. + * + * Note: Any attributes on + * `` will be dropped as only the innerHTML is used for the chip template. The + * variables `$chip` and `$index` are available in the scope of ``, representing + * the chip object and its index in the list of chips, respectively. + * To override the chip delete control, include an element (ideally a button) with the attribute + * `md-chip-remove`. A click listener to remove the chip will be added automatically. The element + * is also placed as a sibling to the chip content (on which there are also click listeners) to + * avoid a nested ng-click situation. + * + * + * + * Sometimes developers want to limit the amount of possible chips.
    + * You can specify the maximum amount of chips by using the following markup. + * + * + * + * + * + * + * In some cases, you have an autocomplete inside of the `md-chips`.
    + * When the maximum amount of chips has been reached, you can also disable the autocomplete + * selection.
    + * Here is an example markup. + * + * + * + * + * + * + * + * ### Accessibility + * + * The `md-chips` component supports keyboard and screen reader users since Version 1.1.2. In + * order to achieve this, we modified the chips behavior to select newly appended chips for + * `300ms` before re-focusing the input and allowing the user to type. + * + * For most users, this delay is small enough that it will not be noticeable but allows certain + * screen readers to function properly (JAWS and NVDA in particular). + * + * We introduced a new `md-chip-append-delay` option to allow developers to better control this + * behavior. + * + * Please refer to the documentation of this option (below) for more information. + * + * @param {expression} ng-model Assignable AngularJS expression to be data-bound to the list of + * chips. The expression should evaluate to a `string` or `Object` Array. The type of this + * array should align with the return value of `md-transform-chip`. + * @param {expression=} ng-change AngularJS expression to be executed on chip addition, removal, + * or content change. + * @param {string=} placeholder Placeholder text that will be forwarded to the input. + * @param {string=} secondary-placeholder Placeholder text that will be forwarded to the input, + * displayed when there is at least one item in the list + * @param {boolean=} md-removable Enables or disables the deletion of chips through the + * removal icon or the Delete/Backspace key. Defaults to true. + * @param {boolean=} readonly Disables list manipulation (deleting or adding list items), hiding + * the input and delete buttons. If no `ng-model` is provided, the chips will automatically be + * marked as readonly.

    + * When `md-removable` is not defined, the `md-remove` behavior will be overwritten and + * disabled. + * @param {boolean=} md-enable-chip-edit Set this to `"true"` to enable editing of chip contents. + * The user can go into edit mode by pressing the `space` or `enter` keys, or by double + * clicking on the chip. Chip editing is only supported for chips using the basic template. + * **Note:** This attribute is only evaluated once; it is not watched. + * @param {boolean=} ng-required Whether ng-model is allowed to be empty or not. + * @param {number=} md-max-chips The maximum number of chips allowed to add through user input. + *

    The validation property `md-max-chips` can be used when the max chips + * amount is reached. + * @param {boolean=} md-add-on-blur When set to `"true"`, the remaining text inside of the input + * will be converted into a new chip on blur. + * **Note:** This attribute is only evaluated once; it is not watched. + * @param {expression} md-transform-chip An expression of form `myFunction($chip)` that when + * called expects one of the following return values: + * - an object representing the `$chip` input string + * - `undefined` to simply add the `$chip` input string, or + * - `null` to prevent the chip from being appended + * @param {expression=} md-on-add An expression which will be called when a chip has been + * added with `$chip` and `$index` available as parameters. + * @param {expression=} md-on-remove An expression which will be called when a chip has been + * removed with `$chip`, `$index`, and `$event` available as parameters. + * @param {expression=} md-on-select An expression which will be called when a chip is selected. + * @param {boolean=} md-require-match If true, and the chips template contains an autocomplete, + * only allow selection of pre-defined chips (i.e. you cannot add new ones). + * @param {string=} md-input-class This class will be applied to the child input for custom + * styling. If you are using an `md-autocomplete`, then you need to put this attribute on the + * `md-autocomplete` rather than the `md-chips`. + * @param {string=} input-aria-describedby A space-separated list of element IDs. This should + * contain the IDs of any elements that describe this autocomplete. Screen readers will read + * the content of these elements at the end of announcing that the chips input has been + * selected and describing its current state. The descriptive elements do not need to be + * visible on the page. + * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use + * case is that this would contain the ID of a `
    \ + \ +
    \ + {{$chip[$mdContactChipsCtrl.contactName]}}\ +
    \ +
    \ + {{$chip[$mdContactChipsCtrl.contactName]}}\ +
    \ +
    \ +
    '; + + +/** + * MDContactChips Directive Definition + * + * @param $mdTheming + * @param $mdUtil + * @returns {*} + * @ngInject + */ +function MdContactChips($mdTheming, $mdUtil) { + return { + template: function(element, attrs) { + return MD_CONTACT_CHIPS_TEMPLATE; + }, + restrict: 'E', + controller: 'MdContactChipsCtrl', + controllerAs: '$mdContactChipsCtrl', + bindToController: true, + compile: compile, + scope: { + contactQuery: '&mdContacts', + placeholder: '@?', + secondaryPlaceholder: '@?', + contactName: '@mdContactName', + contactImage: '@mdContactImage', + contactEmail: '@mdContactEmail', + contacts: '=ngModel', + ngChange: '&?', + requireMatch: '=?mdRequireMatch', + minLength: '=?mdMinLength', + maxChips: '=?mdMaxChips', + highlightFlags: '@?mdHighlightFlags', + chipAppendDelay: '@?mdChipAppendDelay', + separatorKeys: '=?mdSeparatorKeys', + removedMessage: '@?mdRemovedMessage', + inputClass: '@?mdInputClass', + inputAriaDescribedBy: '@?inputAriaDescribedby', + inputAriaLabelledBy: '@?inputAriaLabelledby', + inputAriaLabel: '@?', + containerHint: '@?', + containerEmptyHint: '@?', + deleteHint: '@?' + } + }; + + function compile(element, attr) { + return function postLink(scope, element, attrs, controllers) { + var contactChipsController = controllers; + + $mdUtil.initOptionalProperties(scope, attr); + $mdTheming(element); + + element.attr('tabindex', '-1'); + + attrs.$observe('mdChipAppendDelay', function(newValue) { + contactChipsController.chipAppendDelay = newValue; + }); + }; + } +} + +})(); +(function(){ +"use strict"; + +(function () { + "use strict"; + + /** + * Use a RegExp to check if the `md-colors=""` is static string + * or one that should be observed and dynamically interpolated. + */ + MdColorsDirective.$inject = ["$mdColors", "$mdUtil", "$log", "$parse"]; + MdColorsService.$inject = ["$mdTheming", "$mdUtil", "$log"]; + var STATIC_COLOR_EXPRESSION = /^{((\s|,)*?["'a-zA-Z-]+?\s*?:\s*?(['"])[a-zA-Z0-9-.]*(['"]))+\s*}$/; + var colorPalettes = null; + + /** + * @ngdoc module + * @name material.components.colors + * + * @description + * Define $mdColors service and a `md-colors=""` attribute directive + */ + angular + .module('material.components.colors', ['material.core']) + .directive('mdColors', MdColorsDirective) + .service('$mdColors', MdColorsService); + + /** + * @ngdoc service + * @name $mdColors + * @module material.components.colors + * + * @description + * By default, defining a theme does not make its colors available for applying to non AngularJS + * Material elements. The `$mdColors` service is used by the `md-color` directive to convert a + * set of color expressions to RGBA values and then apply those values to the element as CSS + * property values. + * + * @usage + * Getting a color based on a theme + * + * + * angular.controller('myCtrl', function ($mdColors) { + * var color = $mdColors.getThemeColor('myTheme-primary-900-0.5'); + * ... + * }); + * + * + * Applying a color from a palette to an element + * + * app.directive('myDirective', function($mdColors) { + * return { + * ... + * link: function (scope, elem) { + * $mdColors.applyThemeColors(elem, {color: 'red-A200-0.2'}); + * } + * } + * }); + * + */ + function MdColorsService($mdTheming, $mdUtil, $log) { + colorPalettes = colorPalettes || Object.keys($mdTheming.PALETTES); + + // Publish service instance + return { + applyThemeColors: applyThemeColors, + getThemeColor: getThemeColor, + hasTheme: hasTheme + }; + + // ******************************************** + // Internal Methods + // ******************************************** + + /** + * @ngdoc method + * @name $mdColors#applyThemeColors + * + * @description + * Lookup a set of colors by hue, theme, and palette, then apply those colors + * with the provided opacity (via `rgba()`) to the specified CSS property. + * + * @param {angular.element} element the element to apply the styles to + * @param {Object} colorExpression Keys are CSS properties and values are strings representing + * the `theme-palette-hue-opacity` of the desired color. For example: + * `{'color': 'red-A200-0.3', 'background-color': 'myTheme-primary-700-0.8'}`. Theme, hue, and + * opacity are optional. + */ + function applyThemeColors(element, colorExpression) { + try { + if (colorExpression) { + // Assign the calculate RGBA color values directly as inline CSS + element.css(interpolateColors(colorExpression)); + } + } catch (e) { + $log.error(e.message); + } + } + + /** + * @ngdoc method + * @name $mdColors#getThemeColor + * + * @description + * Get a parsed RGBA color using a string representing the `theme-palette-hue-opacity` of the + * desired color. + * + * @param {string} expression color expression like `'red-A200-0.3'` or + * `'myTheme-primary-700-0.8'`. Theme, hue, and opacity are optional. + * @returns {string} a CSS color value like `rgba(211, 47, 47, 0.8)` + */ + function getThemeColor(expression) { + var color = extractColorOptions(expression); + + return parseColor(color); + } + + /** + * Return the parsed color + * @param {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} color hash map of color + * definitions + * @param {boolean=} contrast whether use contrast color for foreground. Defaults to false. + * @returns {string} rgba color string + */ + function parseColor(color, contrast) { + contrast = contrast || false; + var rgbValues = $mdTheming.PALETTES[color.palette][color.hue]; + + rgbValues = contrast ? rgbValues.contrast : rgbValues.value; + + return $mdUtil.supplant('rgba({0}, {1}, {2}, {3})', + [rgbValues[0], rgbValues[1], rgbValues[2], rgbValues[3] || color.opacity] + ); + } + + /** + * Convert the color expression into an object with scope-interpolated values + * Then calculate the rgba() values based on the theme color parts + * @param {Object} themeColors json object, keys are css properties and values are string of + * the wanted color, for example: `{color: 'red-A200-0.3'}`. + * @return {Object} Hashmap of CSS properties with associated `rgba()` string values + */ + function interpolateColors(themeColors) { + var rgbColors = {}; + + var hasColorProperty = themeColors.hasOwnProperty('color'); + + angular.forEach(themeColors, function (value, key) { + var color = extractColorOptions(value); + var hasBackground = key.indexOf('background') > -1; + + rgbColors[key] = parseColor(color); + if (hasBackground && !hasColorProperty) { + rgbColors.color = parseColor(color, true); + } + }); + + return rgbColors; + } + + /** + * Check if expression has defined theme + * For instance: + * 'myTheme-primary' => true + * 'red-800' => false + * @param {string} expression color expression like 'red-800', 'red-A200-0.3', + * 'myTheme-primary', or 'myTheme-primary-400' + * @return {boolean} true if the expression has a theme part, false otherwise. + */ + function hasTheme(expression) { + return angular.isDefined($mdTheming.THEMES[expression.split('-')[0]]); + } + + /** + * For the evaluated expression, extract the color parts into a hash map + * @param {string} expression color expression like 'red-800', 'red-A200-0.3', + * 'myTheme-primary', or 'myTheme-primary-400' + * @returns {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} + */ + function extractColorOptions(expression) { + var parts = expression.split('-'); + var hasTheme = angular.isDefined($mdTheming.THEMES[parts[0]]); + var theme = hasTheme ? parts.splice(0, 1)[0] : $mdTheming.defaultTheme(); + + return { + theme: theme, + palette: extractPalette(parts, theme), + hue: extractHue(parts, theme), + opacity: parts[2] || 1 + }; + } + + /** + * Calculate the theme palette name + * @param {Array} parts + * @param {string} theme name + * @return {string} + */ + function extractPalette(parts, theme) { + // If the next section is one of the palettes we assume it's a two word palette + // Two word palette can be also written in camelCase, forming camelCase to dash-case + + var isTwoWord = parts.length > 1 && colorPalettes.indexOf(parts[1]) !== -1; + var palette = parts[0].replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); + + if (isTwoWord) palette = parts[0] + '-' + parts.splice(1, 1); + + if (colorPalettes.indexOf(palette) === -1) { + // If the palette is not in the palette list it's one of primary/accent/warn/background + var scheme = $mdTheming.THEMES[theme].colors[palette]; + if (!scheme) { + throw new Error($mdUtil.supplant( + 'mdColors: couldn\'t find \'{palette}\' in the palettes.', + {palette: palette})); + } + palette = scheme.name; + } + + return palette; + } + + /** + * @param {Array} parts + * @param {string} theme name + * @return {*} + */ + function extractHue(parts, theme) { + var themeColors = $mdTheming.THEMES[theme].colors; + + if (parts[1] === 'hue') { + var hueNumber = parseInt(parts.splice(2, 1)[0], 10); + + if (hueNumber < 1 || hueNumber > 3) { + throw new Error($mdUtil.supplant( + 'mdColors: \'hue-{hueNumber}\' is not a valid hue, can be only \'hue-1\', \'hue-2\' and \'hue-3\'', + {hueNumber: hueNumber})); + } + parts[1] = 'hue-' + hueNumber; + + if (!(parts[0] in themeColors)) { + throw new Error($mdUtil.supplant( + 'mdColors: \'hue-x\' can only be used with [{availableThemes}], but was used with \'{usedTheme}\'', + { + availableThemes: Object.keys(themeColors).join(', '), + usedTheme: parts[0] + })); + } + + return themeColors[parts[0]].hues[parts[1]]; + } + + return parts[1] || themeColors[parts[0] in themeColors ? parts[0] : 'primary'].hues['default']; + } + } + + /** + * @ngdoc directive + * @name mdColors + * @module material.components.colors + * + * @restrict A + * + * @description + * `mdColors` directive will apply the theme-based color expression as RGBA CSS style values. + * + * The format will be similar to the colors defined in the Sass files: + * + * ## `[?theme]-[palette]-[?hue]-[?opacity]` + * - [theme] - default value is the default theme + * - [palette] - can be either palette name or primary/accent/warn/background + * - [hue] - default is 500 (hue-x can be used with primary/accent/warn/background) + * - [opacity] - default is 1 + * + * + * > `?` indicates optional parameter + * + * @usage + * + *
    + *
    + * Color demo + *
    + *
    + *
    + * + * The `mdColors` directive will automatically watch for changes in the expression if it recognizes + * an interpolation expression or a function. For performance options, you can use `::` prefix to + * the `md-colors` expression to indicate a one-time data binding. + * + * + * + * + * + */ + function MdColorsDirective($mdColors, $mdUtil, $log, $parse) { + return { + restrict: 'A', + require: ['^?mdTheme'], + compile: function (tElem, tAttrs) { + var shouldWatch = shouldColorsWatch(); + + return function (scope, element, attrs, ctrl) { + var mdThemeController = ctrl[0]; + + var lastColors = {}; + + /** + * @param {string=} theme + * @return {Object} colors found in the specified theme + */ + var parseColors = function (theme) { + if (typeof theme !== 'string') { + theme = ''; + } + + if (!attrs.mdColors) { + attrs.mdColors = '{}'; + } + + /** + * Json.parse() does not work because the keys are not quoted; + * use $parse to convert to a hash map + */ + var colors = $parse(attrs.mdColors)(scope); + + /** + * If mdTheme is defined higher up the DOM tree, + * we add mdTheme's theme to the colors which don't specify a theme. + * + * @example + * + *
    + *
    + * Color demo + *
    + *
    + *
    + * + * 'primary-600' will be changed to 'myTheme-primary-600', + * but 'mySecondTheme-accent-200' will not be changed since it has a theme defined. + */ + if (mdThemeController) { + Object.keys(colors).forEach(function (prop) { + var color = colors[prop]; + if (!$mdColors.hasTheme(color)) { + colors[prop] = (theme || mdThemeController.$mdTheme) + '-' + color; + } + }); + } + + cleanElement(colors); + + return colors; + }; + + /** + * @param {Object} colors + */ + var cleanElement = function (colors) { + if (!angular.equals(colors, lastColors)) { + var keys = Object.keys(lastColors); + + if (lastColors.background && !keys.color) { + keys.push('color'); + } + + keys.forEach(function (key) { + element.css(key, ''); + }); + } + + lastColors = colors; + }; + + /** + * Registering for mgTheme changes and asking mdTheme controller run our callback whenever + * a theme changes. + */ + var unregisterChanges = angular.noop; + + if (mdThemeController) { + unregisterChanges = mdThemeController.registerChanges(function (theme) { + $mdColors.applyThemeColors(element, parseColors(theme)); + }); + } + + scope.$on('$destroy', function () { + unregisterChanges(); + }); + + try { + if (shouldWatch) { + scope.$watch(parseColors, angular.bind(this, + $mdColors.applyThemeColors, element + ), true); + } + else { + $mdColors.applyThemeColors(element, parseColors()); + } + + } + catch (e) { + $log.error(e.message); + } + + }; + + /** + * @return {boolean} + */ + function shouldColorsWatch() { + // Simulate 1x binding and mark mdColorsWatch == false + var rawColorExpression = tAttrs.mdColors; + var bindOnce = rawColorExpression.indexOf('::') > -1; + var isStatic = bindOnce ? true : STATIC_COLOR_EXPRESSION.test(tAttrs.mdColors); + + // Remove it for the postLink... + tAttrs.mdColors = rawColorExpression.replace('::', ''); + + var hasWatchAttr = angular.isDefined(tAttrs.mdColorsWatch); + + return (bindOnce || isStatic) ? false : + hasWatchAttr ? $mdUtil.parseAttributeBoolean(tAttrs.mdColorsWatch) : true; + } + } + }; + } +})(); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.content + * + * @description + * Scrollable content + */ +mdContentDirective.$inject = ["$mdTheming"]; +angular.module('material.components.content', [ + 'material.core' +]) + .directive('mdContent', mdContentDirective); + +/** + * @ngdoc directive + * @name mdContent + * @module material.components.content + * + * @restrict E + * + * @description + * + * The `` directive is a container element useful for scrollable content. It achieves + * this by setting the CSS `overflow` property to `auto` so that content can properly scroll. + * + * In general, `` components are not designed to be nested inside one another. If + * possible, it is better to make them siblings. This often results in a better user experience as + * having nested scrollbars may confuse the user. + * + * ## Troubleshooting + * + * In some cases, you may wish to apply the `md-no-momentum` class to ensure that Safari's + * momentum scrolling is disabled. Momentum scrolling can cause flickering issues while scrolling + * SVG icons and some other components. + * + * Additionally, we now also offer the `md-no-flicker` class which can be applied to any element + * and uses a Webkit-specific filter of `blur(0px)` that forces GPU rendering of all elements + * inside (which eliminates the flicker on iOS devices). + * + * _Note: Forcing an element to render on the GPU can have unintended side-effects, especially + * related to the z-index of elements. Please use with caution and only on the elements needed._ + * + * @usage + * + * Add the `[layout-padding]` attribute to make the content padded. + * + * + * + * Lorem ipsum dolor sit amet, ne quod novum mei. + * + * + */ + +function mdContentDirective($mdTheming) { + return { + restrict: 'E', + controller: ['$scope', '$element', ContentController], + link: function(scope, element) { + element.addClass('_md'); // private md component indicator for styling + + $mdTheming(element); + scope.$broadcast('$mdContentLoaded', element); + + iosScrollFix(element[0]); + } + }; + + function ContentController($scope, $element) { + this.$scope = $scope; + this.$element = $element; + } +} + +function iosScrollFix(node) { + // IOS FIX: + // If we scroll where there is no more room for the webview to scroll, + // by default the webview itself will scroll up and down, this looks really + // bad. So if we are scrolling to the very top or bottom, add/subtract one + angular.element(node).on('$md.pressdown', function(ev) { + // Only touch events + if (ev.pointer.type !== 't') return; + // Don't let a child content's touchstart ruin it for us. + if (ev.$materialScrollFixed) return; + ev.$materialScrollFixed = true; + + if (node.scrollTop === 0) { + node.scrollTop = 1; + } else if (node.scrollHeight === node.scrollTop + node.offsetHeight) { + node.scrollTop -= 1; + } + }); +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.datepicker + * @description Module for the datepicker component. + */ + +angular.module('material.components.datepicker', [ + 'material.core', + 'material.components.icon', + 'material.components.virtualRepeat' +]); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc directive + * @name mdCalendar + * @module material.components.datepicker + * + * @param {Date} ng-model The component's model. Should be a Date object. + * @param {Object=} ng-model-options Allows tuning of the way in which `ng-model` is being + * updated. Also allows for a timezone to be specified. + * Read more at the + * ngModelOptions docs. + * @param {Date=} md-min-date Expression representing the minimum date. + * @param {Date=} md-max-date Expression representing the maximum date. + * @param {(function(Date): boolean)=} md-date-filter Function expecting a date and returning a + * boolean whether it can be selected in "day" mode or not. + * @param {(function(Date): boolean)=} md-month-filter Function expecting a date and returning a + * boolean whether it can be selected in "month" mode or not. + * @param {String=} md-current-view Current view of the calendar. Can be either "month" or "year". + * @param {String=} md-mode Restricts the user to only selecting a value from a particular view. + * This option can be used if the user is only supposed to choose from a certain date type + * (e.g. only selecting the month). Can be either "month" or "day". **Note** that this will + * overwrite the `md-current-view` value. + * + * @description + * `` is a component that renders a calendar that can be used to select a date. + * It is a part of the `` pane, however it can also be used on it's own. + * + * @usage + * + * + * + * + */ + CalendarCtrl.$inject = ["$element", "$scope", "$$mdDateUtil", "$mdUtil", "$mdConstant", "$mdTheming", "$$rAF", "$attrs", "$mdDateLocale", "$filter", "$document"]; + calendarDirective.$inject = ["inputDirective"]; + angular.module('material.components.datepicker') + .directive('mdCalendar', calendarDirective); + + // TODO(jelbourn): Mac Cmd + left / right == Home / End + // TODO(jelbourn): Refactor month element creation to use cloneNode (performance). + // TODO(jelbourn): Define virtual scrolling constants (compactness) users can override. + // TODO(jelbourn): Animated month transition on ng-model change (virtual-repeat) + // TODO(jelbourn): Scroll snapping (virtual repeat) + // TODO(jelbourn): Remove superfluous row from short months (virtual-repeat) + // TODO(jelbourn): Month headers stick to top when scrolling. + // TODO(jelbourn): Previous month opacity is lowered when partially scrolled out of view. + // TODO(jelbourn): Support md-calendar standalone on a page (as a tabstop w/ aria-live + // announcement and key handling). + // TODO Read-only calendar (not just date-picker). + + function calendarDirective(inputDirective) { + return { + template: function(tElement, tAttr) { + // This allows the calendar to work, without a datepicker. This ensures that the virtual + // repeater scrolls to the proper place on load by deferring the execution until the next + // digest. It's necessary only if the calendar is used without a datepicker, otherwise it's + // already wrapped in an ngIf. + var extraAttrs = tAttr.hasOwnProperty('ngIf') ? '' : 'ng-if="calendarCtrl.isInitialized"'; + return '' + + '
    ' + + '' + + '' + + '
    '; + }, + scope: { + minDate: '=mdMinDate', + maxDate: '=mdMaxDate', + dateFilter: '=mdDateFilter', + monthFilter: '=mdMonthFilter', + + // These need to be prefixed, because Angular resets + // any changes to the value due to bindToController. + _mode: '@mdMode', + _currentView: '@mdCurrentView' + }, + require: ['ngModel', 'mdCalendar'], + controller: CalendarCtrl, + controllerAs: 'calendarCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var ngModelCtrl = controllers[0]; + var mdCalendarCtrl = controllers[1]; + mdCalendarCtrl.configureNgModel(ngModelCtrl, inputDirective); + } + }; + } + + /** + * Occasionally the hideVerticalScrollbar method might read an element's + * width as 0, because it hasn't been laid out yet. This value will be used + * as a fallback, in order to prevent scenarios where the element's width + * would otherwise have been set to 0. This value is the "usual" width of a + * calendar within a floating calendar pane. + */ + var FALLBACK_WIDTH = 340; + + /** Next identifier for calendar instance. */ + var nextUniqueId = 0; + + /** Maps the `md-mode` values to their corresponding calendar views. */ + var MODE_MAP = { + day: 'month', + month: 'year' + }; + + /** + * Controller for the mdCalendar component. + * @ngInject @constructor + */ + function CalendarCtrl($element, $scope, $$mdDateUtil, $mdUtil, $mdConstant, $mdTheming, $$rAF, + $attrs, $mdDateLocale, $filter, $document) { + $mdTheming($element); + + /** + * @final + * @type {!JQLite} + */ + this.$element = $element; + + /** + * @final + * @type {!angular.Scope} + */ + this.$scope = $scope; + + /** + * @final + * @type {!angular.$attrs} Current attributes object for the element + */ + this.$attrs = $attrs; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.$mdUtil = $mdUtil; + + /** @final */ + this.keyCode = $mdConstant.KEY_CODE; + + /** @final */ + this.$$rAF = $$rAF; + + /** @final */ + this.$mdDateLocale = $mdDateLocale; + + /** @final The built-in Angular date filter. */ + this.ngDateFilter = $filter('date'); + + /** + * @final + * @type {Date} + */ + this.today = this.dateUtil.createDateAtMidnight(); + + /** @type {!ngModel.NgModelController} */ + this.ngModelCtrl = undefined; + + /** @type {string} Class applied to the selected date cell. */ + this.SELECTED_DATE_CLASS = 'md-calendar-selected-date'; + + /** @type {string} Class applied to the cell for today. */ + this.TODAY_CLASS = 'md-calendar-date-today'; + + /** @type {string} Class applied to the focused cell. */ + this.FOCUSED_DATE_CLASS = 'md-focus'; + + /** + * @final + * @type {number} Unique ID for this calendar instance. + */ + this.id = nextUniqueId++; + + /** + * The date that is currently focused or showing in the calendar. This will initially be set + * to the ng-model value if set, otherwise to today. It will be updated as the user navigates + * to other months. The cell corresponding to the displayDate does not necessarily always have + * focus in the document (such as for cases when the user is scrolling the calendar). + * @type {Date} + */ + this.displayDate = null; + + /** + * Allows restricting the calendar to only allow selecting a month or a day. + * @type {'month'|'day'|null} + */ + this.mode = null; + + /** + * The selected date. Keep track of this separately from the ng-model value so that we + * can know, when the ng-model value changes, what the previous value was before it's updated + * in the component's UI. + * + * @type {Date} + */ + this.selectedDate = null; + + /** + * The first date that can be rendered by the calendar. The default is taken + * from the mdDateLocale provider and is limited by the mdMinDate. + * @type {Date} + */ + this.firstRenderableDate = null; + + /** + * The last date that can be rendered by the calendar. The default comes + * from the mdDateLocale provider and is limited by the maxDate. + * @type {Date} + */ + this.lastRenderableDate = null; + + /** + * Used to toggle initialize the root element in the next digest. + * @type {boolean} + */ + this.isInitialized = false; + + /** + * Cache for the width of the element without a scrollbar. Used to hide the scrollbar later on + * and to avoid extra reflows when switching between views. + * @type {number} + */ + this.width = 0; + + /** + * Caches the width of the scrollbar in order to be used when hiding it and to avoid extra reflows. + * @type {number} + */ + this.scrollbarWidth = 0; + + /** + * @type {boolean} set to true if the calendar is being used "standalone" (outside of a + * md-datepicker). + */ + this.standaloneMode = false; + + // Unless the user specifies so, the calendar should not be a tab stop. + // This is necessary because ngAria might add a tabindex to anything with an ng-model + // (based on whether or not the user has turned that particular feature on/off). + if (!$attrs.tabindex) { + $element.attr('tabindex', '-1'); + } + + var boundKeyHandler = angular.bind(this, this.handleKeyEvent); + + // If use the md-calendar directly in the body without datepicker, + // handleKeyEvent will disable other inputs on the page. + // So only apply the handleKeyEvent on the body when the md-calendar inside datepicker, + // otherwise apply on the calendar element only. + + var handleKeyElement; + if ($element.parent().hasClass('md-datepicker-calendar')) { + handleKeyElement = angular.element($document[0].body); + } else { + this.standaloneMode = true; + handleKeyElement = $element; + } + + // Bind the keydown handler to the body, in order to handle cases where the focused + // element gets removed from the DOM and stops propagating click events. + handleKeyElement.on('keydown', boundKeyHandler); + + $scope.$on('$destroy', function() { + handleKeyElement.off('keydown', boundKeyHandler); + }); + + // For AngularJS 1.4 and older, where there are no lifecycle hooks but bindings are pre-assigned, + // manually call the $onInit hook. + if (angular.version.major === 1 && angular.version.minor <= 4) { + this.$onInit(); + } + } + + /** + * AngularJS Lifecycle hook for newer AngularJS versions. + * Bindings are not guaranteed to have been assigned in the controller, but they are in the + * $onInit hook. + */ + CalendarCtrl.prototype.$onInit = function() { + /** + * The currently visible calendar view. Note the prefix on the scope value, + * which is necessary, because the datepicker seems to reset the real one value if the + * calendar is open, but the `currentView` on the datepicker's scope is empty. + * @type {String} + */ + if (this._mode && MODE_MAP.hasOwnProperty(this._mode)) { + this.currentView = MODE_MAP[this._mode]; + this.mode = this._mode; + } else { + this.currentView = this._currentView || 'month'; + this.mode = null; + } + + if (this.minDate && this.minDate > this.$mdDateLocale.firstRenderableDate) { + this.firstRenderableDate = this.minDate; + } else { + this.firstRenderableDate = this.$mdDateLocale.firstRenderableDate; + } + + if (this.maxDate && this.maxDate < this.$mdDateLocale.lastRenderableDate) { + this.lastRenderableDate = this.maxDate; + } else { + this.lastRenderableDate = this.$mdDateLocale.lastRenderableDate; + } + }; + + /** + * Sets up the controller's reference to ngModelController. + * @param {!ngModel.NgModelController} ngModelCtrl Instance of the ngModel controller. + * @param {Object} inputDirective Config for AngularJS's `input` directive. + */ + CalendarCtrl.prototype.configureNgModel = function(ngModelCtrl, inputDirective) { + var self = this; + self.ngModelCtrl = ngModelCtrl; + + // The component needs to be [type="date"] in order to be picked up by AngularJS. + this.$attrs.$set('type', 'date'); + + // Invoke the `input` directive link function, adding a stub for the element. + // This allows us to re-use AngularJS' logic for setting the timezone via ng-model-options. + // It works by calling the link function directly which then adds the proper `$parsers` and + // `$formatters` to the NgModelController. + inputDirective[0].link.pre(this.$scope, { + on: angular.noop, + val: angular.noop, + 0: {} + }, this.$attrs, [ngModelCtrl]); + + ngModelCtrl.$render = function() { + var value = this.$viewValue, convertedDate; + + // In the case where a conversion is needed, the $viewValue here will be a string like + // "2020-05-10" instead of a Date object. + if (!self.dateUtil.isValidDate(value)) { + convertedDate = self.dateUtil.removeLocalTzAndReparseDate(new Date(value)); + if (self.dateUtil.isValidDate(convertedDate)) { + value = convertedDate; + } + } + + // Notify the child scopes of any changes. + self.$scope.$broadcast('md-calendar-parent-changed', value); + + // Set up the selectedDate if it hasn't been already. + if (!self.selectedDate) { + self.selectedDate = value; + } + + // Also set up the displayDate. + if (!self.displayDate) { + self.displayDate = self.selectedDate || self.today; + } + }; + + self.$mdUtil.nextTick(function() { + self.isInitialized = true; + }); + }; + + /** + * Sets the ng-model value for the calendar and emits a change event. + * @param {Date} date new value for the calendar + */ + CalendarCtrl.prototype.setNgModelValue = function(date) { + var timezone = this.$mdUtil.getModelOption(this.ngModelCtrl, 'timezone'); + var value = this.dateUtil.createDateAtMidnight(date); + this.focusDate(value); + this.$scope.$emit('md-calendar-change', value); + // Using the timezone when the offset is negative (GMT+X) causes the previous day to be + // selected here. This check avoids that. + if (timezone == null || value.getTimezoneOffset() < 0) { + this.ngModelCtrl.$setViewValue(this.ngDateFilter(value, 'yyyy-MM-dd'), 'default'); + } else { + this.ngModelCtrl.$setViewValue(this.ngDateFilter(value, 'yyyy-MM-dd', timezone), 'default'); + } + this.ngModelCtrl.$render(); + return value; + }; + + /** + * Sets the current view that should be visible in the calendar + * @param {string} newView View name to be set. + * @param {number|Date} time Date object or a timestamp for the new display date. + */ + CalendarCtrl.prototype.setCurrentView = function(newView, time) { + var self = this; + + self.$mdUtil.nextTick(function() { + self.currentView = newView; + + if (time) { + self.displayDate = angular.isDate(time) ? time : new Date(time); + } + }); + }; + + /** + * Focus the cell corresponding to the given date. + * @param {Date=} date The date to be focused. + */ + CalendarCtrl.prototype.focusDate = function(date) { + if (this.dateUtil.isValidDate(date)) { + var previousFocus = this.$element[0].querySelector('.' + this.FOCUSED_DATE_CLASS); + if (previousFocus) { + previousFocus.classList.remove(this.FOCUSED_DATE_CLASS); + } + + var cellId = this.getDateId(date, this.currentView); + var cell = document.getElementById(cellId); + if (cell) { + cell.classList.add(this.FOCUSED_DATE_CLASS); + cell.focus(); + this.displayDate = date; + } + } else { + var rootElement = this.$element[0].querySelector('[ng-switch]'); + + if (rootElement) { + rootElement.focus(); + } + } + }; + + /** + * Highlights a date cell on the calendar and changes the selected date. + * @param {Date=} date Date to be marked as selected. + */ + CalendarCtrl.prototype.changeSelectedDate = function(date) { + var selectedDateClass = this.SELECTED_DATE_CLASS; + var prevDateCell = this.$element[0].querySelector('.' + selectedDateClass); + + // Remove the selected class from the previously selected date, if any. + if (prevDateCell) { + prevDateCell.classList.remove(selectedDateClass); + prevDateCell.setAttribute('aria-selected', 'false'); + } + + // Apply the select class to the new selected date if it is set. + if (date) { + var dateCell = document.getElementById(this.getDateId(date, this.currentView)); + if (dateCell) { + dateCell.classList.add(selectedDateClass); + dateCell.setAttribute('aria-selected', 'true'); + } + } + + this.selectedDate = date; + }; + + /** + * Normalizes the key event into an action name. The action will be broadcast + * to the child controllers. + * @param {KeyboardEvent} event + * @returns {string} The action that should be taken, or null if the key + * does not match a calendar shortcut. + */ + CalendarCtrl.prototype.getActionFromKeyEvent = function(event) { + var keyCode = this.keyCode; + + switch (event.which) { + case keyCode.ENTER: return 'select'; + + case keyCode.RIGHT_ARROW: return 'move-right'; + case keyCode.LEFT_ARROW: return 'move-left'; + + case keyCode.DOWN_ARROW: return event.metaKey ? 'move-page-down' : 'move-row-down'; + case keyCode.UP_ARROW: return event.metaKey ? 'move-page-up' : 'move-row-up'; + + case keyCode.PAGE_DOWN: return 'move-page-down'; + case keyCode.PAGE_UP: return 'move-page-up'; + + case keyCode.HOME: return 'start'; + case keyCode.END: return 'end'; + + default: return null; + } + }; + + /** + * Handles a key event in the calendar with the appropriate action. + * The action will either + * - select the focused date + * - navigate to focus a new date + * - emit a md-calendar-close event if in a md-datepicker panel + * - emit a md-calendar-parent-action + * - delegate to normal tab order if the TAB key is pressed in standalone mode + * @param {KeyboardEvent} event + */ + CalendarCtrl.prototype.handleKeyEvent = function(event) { + var self = this; + + this.$scope.$apply(function() { + // Capture escape and emit back up so that a wrapping component + // (such as a date-picker) can decide to close. + if (event.which === self.keyCode.ESCAPE || + (event.which === self.keyCode.TAB && !self.standaloneMode)) { + self.$scope.$emit('md-calendar-close'); + + if (event.which === self.keyCode.TAB) { + event.preventDefault(); + } + + return; + } else if (event.which === self.keyCode.TAB && self.standaloneMode) { + // delegate to the normal tab order if the TAB key is pressed in standalone mode + return; + } + + // Broadcast the action that any child controllers should take. + var action = self.getActionFromKeyEvent(event); + if (action) { + event.preventDefault(); + event.stopPropagation(); + self.$scope.$broadcast('md-calendar-parent-action', action); + } + }); + }; + + /** + * Hides the vertical scrollbar on the calendar scroller of a child controller by + * setting the width on the calendar scroller and the `overflow: hidden` wrapper + * around the scroller, and then setting a padding-right on the scroller equal + * to the width of the browser's scrollbar. + * + * This will cause a reflow. + * + * @param {object} childCtrl The child controller whose scrollbar should be hidden. + */ + CalendarCtrl.prototype.hideVerticalScrollbar = function(childCtrl) { + var self = this; + var element = childCtrl.$element[0]; + var scrollMask = element.querySelector('.md-calendar-scroll-mask'); + + if (self.width > 0) { + setWidth(); + } else { + self.$$rAF(function() { + var scroller = childCtrl.calendarScroller; + + self.scrollbarWidth = scroller.offsetWidth - scroller.clientWidth; + self.width = element.querySelector('table').offsetWidth; + setWidth(); + }); + } + + function setWidth() { + var width = self.width || FALLBACK_WIDTH; + var scrollbarWidth = self.scrollbarWidth; + var scroller = childCtrl.calendarScroller; + + scrollMask.style.width = width + 'px'; + scroller.style.width = (width + scrollbarWidth) + 'px'; + scroller.style.paddingRight = scrollbarWidth + 'px'; + } + }; + + /** + * Gets an identifier for a date unique to the calendar instance for internal + * purposes. Not to be displayed. + * @param {Date} date The date for which the id is being generated + * @param {string} namespace Namespace for the id. (month, year etc.) + * @returns {string} + */ + CalendarCtrl.prototype.getDateId = function(date, namespace) { + if (!namespace) { + throw new Error('A namespace for the date id has to be specified.'); + } + + return [ + 'md', + this.id, + namespace, + date.getFullYear(), + date.getMonth(), + date.getDate() + ].join('-'); + }; + + /** + * Util to trigger an extra digest on a parent scope, in order to to ensure that + * any child virtual repeaters have updated. This is necessary, because the virtual + * repeater doesn't update the $index the first time around since the content isn't + * in place yet. The case, in which this is an issue, is when the repeater has less + * than a page of content (e.g. a month or year view has a min or max date). + */ + CalendarCtrl.prototype.updateVirtualRepeat = function() { + var scope = this.$scope; + var virtualRepeatResizeListener = scope.$on('$md-resize-enable', function() { + if (!scope.$$phase) { + scope.$apply(); + } + + virtualRepeatResizeListener(); + }); + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + CalendarMonthCtrl.$inject = ["$element", "$scope", "$animate", "$q", "$$mdDateUtil", "$mdDateLocale"]; + angular.module('material.components.datepicker') + .directive('mdCalendarMonth', calendarDirective); + + /** + * Height of one calendar month tbody. This must be made known to the virtual-repeat and is + * subsequently used for scrolling to specific months. + */ + var TBODY_HEIGHT = 265; + + /** + * Height of a calendar month with a single row. This is needed to calculate the offset for + * rendering an extra month in virtual-repeat that only contains one row. + */ + var TBODY_SINGLE_ROW_HEIGHT = 45; + + /** Private directive that represents a list of months inside the calendar. */ + function calendarDirective() { + return { + template: + '' + + '
    ' + + '' + + '' + + '' + + + // The ensures that the will always have the + // proper height, even if it's empty. If it's content is + // compiled, the will be overwritten. + '' + + '' + + '
    ' + + '
    ' + + '
    ', + require: ['^^mdCalendar', 'mdCalendarMonth'], + controller: CalendarMonthCtrl, + controllerAs: 'monthCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var monthCtrl = controllers[1]; + monthCtrl.initialize(calendarCtrl); + } + }; + } + + /** + * Controller for the calendar month component. + * @ngInject @constructor + */ + function CalendarMonthCtrl($element, $scope, $animate, $q, + $$mdDateUtil, $mdDateLocale) { + + /** @final {!angular.JQLite} */ + this.$element = $element; + + /** @final {!angular.Scope} */ + this.$scope = $scope; + + /** @final {!angular.$animate} */ + this.$animate = $animate; + + /** @final {!angular.$q} */ + this.$q = $q; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.dateLocale = $mdDateLocale; + + /** @final {HTMLElement} */ + this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller'); + + /** @type {boolean} */ + this.isInitialized = false; + + /** @type {boolean} */ + this.isMonthTransitionInProgress = false; + + var self = this; + + /** + * Handles a click event on a date cell. + * Created here so that every cell can use the same function instance. + * @this {HTMLTableCellElement} The cell that was clicked. + */ + this.cellClickHandler = function() { + var timestamp = $$mdDateUtil.getTimestampFromNode(this); + self.$scope.$apply(function() { + // The timestamp has to be converted to a valid date. + self.calendarCtrl.setNgModelValue(new Date(timestamp)); + }); + }; + + /** + * Handles click events on the month headers. Switches + * the calendar to the year view. + * @this {HTMLTableCellElement} The cell that was clicked. + */ + this.headerClickHandler = function() { + self.calendarCtrl.setCurrentView('year', $$mdDateUtil.getTimestampFromNode(this)); + }; + } + + /** Initialization **/ + + /** + * Initialize the controller by saving a reference to the calendar and + * setting up the object that will be iterated by the virtual repeater. + */ + CalendarMonthCtrl.prototype.initialize = function(calendarCtrl) { + /** + * Dummy array-like object for virtual-repeat to iterate over. The length is the total + * number of months that can be viewed. We add 2 months: one to include the current month + * and one for the last dummy month. + * + * This is shorter than ideal because of a (potential) Firefox bug + * https://bugzilla.mozilla.org/show_bug.cgi?id=1181658. + */ + + this.items = { + length: this.dateUtil.getMonthDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.lastRenderableDate + ) + 2 + }; + + this.calendarCtrl = calendarCtrl; + this.attachScopeListeners(); + calendarCtrl.updateVirtualRepeat(); + + // Fire the initial render, since we might have missed it the first time it fired. + calendarCtrl.ngModelCtrl && calendarCtrl.ngModelCtrl.$render(); + }; + + /** + * Gets the "index" of the currently selected date as it would be in the virtual-repeat. + * @returns {number} the "index" of the currently selected date + */ + CalendarMonthCtrl.prototype.getSelectedMonthIndex = function() { + var calendarCtrl = this.calendarCtrl; + + return this.dateUtil.getMonthDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.displayDate || calendarCtrl.selectedDate || calendarCtrl.today + ); + }; + + /** + * Change the date that is being shown in the calendar. If the given date is in a different + * month, the displayed month will be transitioned. + * @param {Date} date + */ + CalendarMonthCtrl.prototype.changeDisplayDate = function(date) { + // Initialization is deferred until this function is called because we want to reflect + // the starting value of ngModel. + if (!this.isInitialized) { + this.buildWeekHeader(); + this.calendarCtrl.hideVerticalScrollbar(this); + this.isInitialized = true; + return this.$q.when(); + } + + // If trying to show an invalid date or a transition is in progress, do nothing. + if (!this.dateUtil.isValidDate(date) || this.isMonthTransitionInProgress) { + return this.$q.when(); + } + + this.isMonthTransitionInProgress = true; + var animationPromise = this.animateDateChange(date); + + this.calendarCtrl.displayDate = date; + + var self = this; + animationPromise.then(function() { + self.isMonthTransitionInProgress = false; + }); + + return animationPromise; + }; + + /** + * Animates the transition from the calendar's current month to the given month. + * @param {Date} date + * @returns {angular.$q.Promise} The animation promise. + */ + CalendarMonthCtrl.prototype.animateDateChange = function(date) { + if (this.dateUtil.isValidDate(date)) { + var monthDistance = this.dateUtil.getMonthDistance(this.calendarCtrl.firstRenderableDate, date); + this.calendarScroller.scrollTop = monthDistance * TBODY_HEIGHT; + } + + return this.$q.when(); + }; + + /** + * Builds and appends a day-of-the-week header to the calendar. + * This should only need to be called once during initialization. + */ + CalendarMonthCtrl.prototype.buildWeekHeader = function() { + var firstDayOfWeek = this.dateLocale.firstDayOfWeek; + var shortDays = this.dateLocale.shortDays; + + var row = document.createElement('tr'); + for (var i = 0; i < 7; i++) { + var th = document.createElement('th'); + th.textContent = shortDays[(i + firstDayOfWeek) % 7]; + row.appendChild(th); + } + + this.$element.find('thead').append(row); + }; + + /** + * Attaches listeners for the scope events that are broadcast by the calendar. + */ + CalendarMonthCtrl.prototype.attachScopeListeners = function() { + var self = this; + + self.$scope.$on('md-calendar-parent-changed', function(event, value) { + self.calendarCtrl.changeSelectedDate(value); + self.changeDisplayDate(value); + }); + + self.$scope.$on('md-calendar-parent-action', angular.bind(this, this.handleKeyEvent)); + }; + + /** + * Handles the month-specific keyboard interactions. + * @param {Object} event Scope event object passed by the calendar. + * @param {String} action Action, corresponding to the key that was pressed. + */ + CalendarMonthCtrl.prototype.handleKeyEvent = function(event, action) { + var calendarCtrl = this.calendarCtrl; + var displayDate = calendarCtrl.displayDate; + + if (action === 'select') { + calendarCtrl.setNgModelValue(displayDate); + } else { + var date = null; + var dateUtil = this.dateUtil; + + switch (action) { + case 'move-right': date = dateUtil.incrementDays(displayDate, 1); break; + case 'move-left': date = dateUtil.incrementDays(displayDate, -1); break; + + case 'move-page-down': date = dateUtil.incrementMonths(displayDate, 1); break; + case 'move-page-up': date = dateUtil.incrementMonths(displayDate, -1); break; + + case 'move-row-down': date = dateUtil.incrementDays(displayDate, 7); break; + case 'move-row-up': date = dateUtil.incrementDays(displayDate, -7); break; + + case 'start': date = dateUtil.getFirstDateOfMonth(displayDate); break; + case 'end': date = dateUtil.getLastDateOfMonth(displayDate); break; + } + + if (date) { + date = this.dateUtil.clampDate(date, calendarCtrl.minDate, calendarCtrl.maxDate); + + this.changeDisplayDate(date).then(function() { + calendarCtrl.focusDate(date); + }); + } + } + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + mdCalendarMonthBodyDirective.$inject = ["$compile", "$$mdSvgRegistry"]; + CalendarMonthBodyCtrl.$inject = ["$element", "$$mdDateUtil", "$mdDateLocale"]; + angular.module('material.components.datepicker') + .directive('mdCalendarMonthBody', mdCalendarMonthBodyDirective); + + /** + * Private directive consumed by md-calendar-month. Having this directive lets the calender use + * md-virtual-repeat and also cleanly separates the month DOM construction functions from + * the rest of the calendar controller logic. + * @ngInject + */ + function mdCalendarMonthBodyDirective($compile, $$mdSvgRegistry) { + var ARROW_ICON = $compile('')({})[0]; + + return { + require: ['^^mdCalendar', '^^mdCalendarMonth', 'mdCalendarMonthBody'], + scope: { offset: '=mdMonthOffset' }, + controller: CalendarMonthBodyCtrl, + controllerAs: 'mdMonthBodyCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var monthCtrl = controllers[1]; + var monthBodyCtrl = controllers[2]; + + monthBodyCtrl.calendarCtrl = calendarCtrl; + monthBodyCtrl.monthCtrl = monthCtrl; + monthBodyCtrl.arrowIcon = ARROW_ICON.cloneNode(true); + + // The virtual-repeat re-uses the same DOM elements, so there are only a limited number + // of repeated items that are linked, and then those elements have their bindings updated. + // Since the months are not generated by bindings, we simply regenerate the entire thing + // when the binding (offset) changes. + scope.$watch(function() { return monthBodyCtrl.offset; }, function(offset) { + if (angular.isNumber(offset)) { + monthBodyCtrl.generateContent(); + } + }); + } + }; + } + + /** + * Controller for a single calendar month. + * @ngInject @constructor + */ + function CalendarMonthBodyCtrl($element, $$mdDateUtil, $mdDateLocale) { + /** + * @final + * @type {!JQLite} + */ + this.$element = $element; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.dateLocale = $mdDateLocale; + + /** @type {Object} Reference to the month view. */ + this.monthCtrl = null; + + /** @type {Object} Reference to the calendar. */ + this.calendarCtrl = null; + + /** + * Number of months from the start of the month "items" that the currently rendered month + * occurs. Set via angular data binding. + * @type {number|null} + */ + this.offset = null; + + /** + * Date cell to focus after appending the month to the document. + * @type {HTMLElement} + */ + this.focusAfterAppend = null; + } + + /** Generate and append the content for this month to the directive element. */ + CalendarMonthBodyCtrl.prototype.generateContent = function() { + var date = this.dateUtil.incrementMonths(this.calendarCtrl.firstRenderableDate, this.offset); + + this.$element + .empty() + .append(this.buildCalendarForMonth(date)); + + if (this.focusAfterAppend) { + this.focusAfterAppend.classList.add(this.calendarCtrl.FOCUSED_DATE_CLASS); + this.focusAfterAppend = null; + } + }; + + /** + * Creates a single cell to contain a date in the calendar with all appropriate + * attributes and classes added. If a date is given, the cell content will be set + * based on the date. + * @param {Date=} opt_date + * @returns {HTMLElement} + */ + CalendarMonthBodyCtrl.prototype.buildDateCell = function(opt_date) { + var monthCtrl = this.monthCtrl; + var calendarCtrl = this.calendarCtrl; + + // TODO(jelbourn): cloneNode is likely a faster way of doing this. + var cell = document.createElement('td'); + cell.tabIndex = -1; + cell.classList.add('md-calendar-date'); + cell.setAttribute('role', 'gridcell'); + + if (opt_date) { + cell.setAttribute('tabindex', '-1'); + cell.setAttribute('aria-label', this.dateLocale.longDateFormatter(opt_date)); + cell.id = calendarCtrl.getDateId(opt_date, 'month'); + + // Use `data-timestamp` attribute because IE10 does not support the `dataset` property. + cell.setAttribute('data-timestamp', opt_date.getTime()); + + // TODO(jelourn): Doing these comparisons for class addition during generation might be slow. + // It may be better to finish the construction and then query the node and add the class. + if (this.dateUtil.isSameDay(opt_date, calendarCtrl.today)) { + cell.classList.add(calendarCtrl.TODAY_CLASS); + } + + if (this.dateUtil.isValidDate(calendarCtrl.selectedDate) && + this.dateUtil.isSameDay(opt_date, calendarCtrl.selectedDate)) { + cell.classList.add(calendarCtrl.SELECTED_DATE_CLASS); + cell.setAttribute('aria-selected', 'true'); + } + + var cellText = this.dateLocale.dates[opt_date.getDate()]; + + if (this.isDateEnabled(opt_date)) { + // Add a indicator for select, hover, and focus states. + var selectionIndicator = document.createElement('span'); + selectionIndicator.classList.add('md-calendar-date-selection-indicator'); + selectionIndicator.textContent = cellText; + cell.appendChild(selectionIndicator); + cell.addEventListener('click', monthCtrl.cellClickHandler); + + if (calendarCtrl.displayDate && this.dateUtil.isSameDay(opt_date, calendarCtrl.displayDate)) { + this.focusAfterAppend = cell; + } + } else { + cell.classList.add('md-calendar-date-disabled'); + cell.textContent = cellText; + } + } + + return cell; + }; + + /** + * Check whether date is in range and enabled + * @param {Date=} opt_date + * @return {boolean} Whether the date is enabled. + */ + CalendarMonthBodyCtrl.prototype.isDateEnabled = function(opt_date) { + return this.dateUtil.isDateWithinRange(opt_date, + this.calendarCtrl.minDate, this.calendarCtrl.maxDate) && + (!angular.isFunction(this.calendarCtrl.dateFilter) + || this.calendarCtrl.dateFilter(opt_date)); + }; + + /** + * Builds a `tr` element for the calendar grid. + * @param rowNumber The week number within the month. + * @returns {HTMLElement} + */ + CalendarMonthBodyCtrl.prototype.buildDateRow = function(rowNumber) { + var row = document.createElement('tr'); + row.setAttribute('role', 'row'); + + // Because of an NVDA bug (with Firefox), the row needs an aria-label in order + // to prevent the entire row being read aloud when the user moves between rows. + // See http://community.nvda-project.org/ticket/4643. + row.setAttribute('aria-label', this.dateLocale.weekNumberFormatter(rowNumber)); + + return row; + }; + + /** + * Builds the content for the given date's month. + * @param {Date=} opt_dateInMonth + * @returns {DocumentFragment} A document fragment containing the elements. + */ + CalendarMonthBodyCtrl.prototype.buildCalendarForMonth = function(opt_dateInMonth) { + var date = this.dateUtil.isValidDate(opt_dateInMonth) ? opt_dateInMonth : new Date(); + + var firstDayOfMonth = this.dateUtil.getFirstDateOfMonth(date); + var firstDayOfTheWeek = this.getLocaleDay_(firstDayOfMonth); + var numberOfDaysInMonth = this.dateUtil.getNumberOfDaysInMonth(date); + + // Store rows for the month in a document fragment so that we can append them all at once. + var monthBody = document.createDocumentFragment(); + + var rowNumber = 1; + var row = this.buildDateRow(rowNumber); + monthBody.appendChild(row); + + // If this is the final month in the list of items, only the first week should render, + // so we should return immediately after the first row is complete and has been + // attached to the body. + var isFinalMonth = this.offset === this.monthCtrl.items.length - 1; + + // Add a label for the month. If the month starts on a Sun/Mon/Tues, the month label + // goes on a row above the first of the month. Otherwise, the month label takes up the first + // two cells of the first row. + var blankCellOffset = 0; + var monthLabelCell = document.createElement('td'); + var monthLabelCellContent = document.createElement('span'); + var calendarCtrl = this.calendarCtrl; + + monthLabelCellContent.textContent = this.dateLocale.monthHeaderFormatter(date); + monthLabelCell.appendChild(monthLabelCellContent); + monthLabelCell.classList.add('md-calendar-month-label'); + // If the entire month is after the max date, render the label as a disabled state. + if (calendarCtrl.maxDate && firstDayOfMonth > calendarCtrl.maxDate) { + monthLabelCell.classList.add('md-calendar-month-label-disabled'); + // If the user isn't supposed to be able to change views, render the + // label as usual, but disable the clicking functionality. + } else if (!calendarCtrl.mode) { + monthLabelCell.addEventListener('click', this.monthCtrl.headerClickHandler); + monthLabelCell.setAttribute('data-timestamp', firstDayOfMonth.getTime()); + monthLabelCell.setAttribute('aria-label', this.dateLocale.monthFormatter(date)); + monthLabelCell.classList.add('md-calendar-label-clickable'); + monthLabelCell.appendChild(this.arrowIcon.cloneNode(true)); + } + + if (firstDayOfTheWeek <= 2) { + monthLabelCell.setAttribute('colspan', '7'); + + var monthLabelRow = this.buildDateRow(); + monthLabelRow.appendChild(monthLabelCell); + monthBody.insertBefore(monthLabelRow, row); + + if (isFinalMonth) { + return monthBody; + } + } else { + blankCellOffset = 3; + monthLabelCell.setAttribute('colspan', '3'); + row.appendChild(monthLabelCell); + } + + // Add a blank cell for each day of the week that occurs before the first of the month. + // For example, if the first day of the month is a Tuesday, add blank cells for Sun and Mon. + // The blankCellOffset is needed in cases where the first N cells are used by the month label. + for (var i = blankCellOffset; i < firstDayOfTheWeek; i++) { + row.appendChild(this.buildDateCell()); + } + + // Add a cell for each day of the month, keeping track of the day of the week so that + // we know when to start a new row. + var dayOfWeek = firstDayOfTheWeek; + var iterationDate = firstDayOfMonth; + for (var d = 1; d <= numberOfDaysInMonth; d++) { + // If we've reached the end of the week, start a new row. + if (dayOfWeek === 7) { + // We've finished the first row, so we're done if this is the final month. + if (isFinalMonth) { + return monthBody; + } + dayOfWeek = 0; + rowNumber++; + row = this.buildDateRow(rowNumber); + monthBody.appendChild(row); + } + + iterationDate.setDate(d); + var cell = this.buildDateCell(iterationDate); + row.appendChild(cell); + + dayOfWeek++; + } + + // Ensure that the last row of the month has 7 cells. + while (row.childNodes.length < 7) { + row.appendChild(this.buildDateCell()); + } + + // Ensure that all months have 6 rows. This is necessary for now because the virtual-repeat + // requires that all items have exactly the same height. + while (monthBody.childNodes.length < 6) { + var whitespaceRow = this.buildDateRow(); + for (var j = 0; j < 7; j++) { + whitespaceRow.appendChild(this.buildDateCell()); + } + monthBody.appendChild(whitespaceRow); + } + + return monthBody; + }; + + /** + * Gets the day-of-the-week index for a date for the current locale. + * @private + * @param {Date} date + * @returns {number} The column index of the date in the calendar. + */ + CalendarMonthBodyCtrl.prototype.getLocaleDay_ = function(date) { + return (date.getDay() + (7 - this.dateLocale.firstDayOfWeek)) % 7; + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + CalendarYearCtrl.$inject = ["$element", "$scope", "$animate", "$q", "$$mdDateUtil", "$mdUtil"]; + angular.module('material.components.datepicker') + .directive('mdCalendarYear', calendarDirective); + + /** + * Height of one calendar year tbody. This must be made known to the virtual-repeat and is + * subsequently used for scrolling to specific years. + */ + var TBODY_HEIGHT = 88; + + /** Private component, representing a list of years in the calendar. */ + function calendarDirective() { + return { + template: + '
    ' + + '' + + '' + + '' + + // The ensures that the will have the proper + // height, even though it may be empty. + '' + + '' + + '
    ' + + '
    ' + + '
    ', + require: ['^^mdCalendar', 'mdCalendarYear'], + controller: CalendarYearCtrl, + controllerAs: 'yearCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var yearCtrl = controllers[1]; + yearCtrl.initialize(calendarCtrl); + } + }; + } + + /** + * Controller for the mdCalendar component. + * @ngInject @constructor + */ + function CalendarYearCtrl($element, $scope, $animate, $q, $$mdDateUtil, $mdUtil) { + + /** @final {!angular.JQLite} */ + this.$element = $element; + + /** @final {!angular.Scope} */ + this.$scope = $scope; + + /** @final {!angular.$animate} */ + this.$animate = $animate; + + /** @final {!angular.$q} */ + this.$q = $q; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final {HTMLElement} */ + this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller'); + + /** @type {boolean} */ + this.isInitialized = false; + + /** @type {boolean} */ + this.isMonthTransitionInProgress = false; + + /** @final */ + this.$mdUtil = $mdUtil; + + var self = this; + + /** + * Handles a click event on a date cell. + * Created here so that every cell can use the same function instance. + * @this {HTMLTableCellElement} The cell that was clicked. + */ + this.cellClickHandler = function() { + self.onTimestampSelected($$mdDateUtil.getTimestampFromNode(this)); + }; + } + + /** + * Initialize the controller by saving a reference to the calendar and + * setting up the object that will be iterated by the virtual repeater. + */ + CalendarYearCtrl.prototype.initialize = function(calendarCtrl) { + /** + * Dummy array-like object for virtual-repeat to iterate over. The length is the total + * number of years that can be viewed. We add 1 extra in order to include the current year. + */ + + this.items = { + length: this.dateUtil.getYearDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.lastRenderableDate + ) + 1 + }; + + this.calendarCtrl = calendarCtrl; + this.attachScopeListeners(); + calendarCtrl.updateVirtualRepeat(); + + // Fire the initial render, since we might have missed it the first time it fired. + calendarCtrl.ngModelCtrl && calendarCtrl.ngModelCtrl.$render(); + }; + + /** + * Gets the "index" of the currently selected date as it would be in the virtual-repeat. + * @returns {number} + */ + CalendarYearCtrl.prototype.getFocusedYearIndex = function() { + var calendarCtrl = this.calendarCtrl; + + return this.dateUtil.getYearDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.displayDate || calendarCtrl.selectedDate || calendarCtrl.today + ); + }; + + /** + * Change the date that is highlighted in the calendar. + * @param {Date} date + */ + CalendarYearCtrl.prototype.changeDate = function(date) { + // Initialization is deferred until this function is called because we want to reflect + // the starting value of ngModel. + if (!this.isInitialized) { + this.calendarCtrl.hideVerticalScrollbar(this); + this.isInitialized = true; + return this.$q.when(); + } else if (this.dateUtil.isValidDate(date) && !this.isMonthTransitionInProgress) { + var self = this; + var animationPromise = this.animateDateChange(date); + + self.isMonthTransitionInProgress = true; + self.calendarCtrl.displayDate = date; + + return animationPromise.then(function() { + self.isMonthTransitionInProgress = false; + }); + } + }; + + /** + * Animates the transition from the calendar's current month to the given month. + * @param {Date} date + * @returns {angular.$q.Promise} The animation promise. + */ + CalendarYearCtrl.prototype.animateDateChange = function(date) { + if (this.dateUtil.isValidDate(date)) { + var monthDistance = this.dateUtil.getYearDistance(this.calendarCtrl.firstRenderableDate, date); + this.calendarScroller.scrollTop = monthDistance * TBODY_HEIGHT; + } + + return this.$q.when(); + }; + + /** + * Handles the year-view-specific keyboard interactions. + * @param {Object} event Scope event object passed by the calendar. + * @param {String} action Action, corresponding to the key that was pressed. + */ + CalendarYearCtrl.prototype.handleKeyEvent = function(event, action) { + var self = this; + var calendarCtrl = self.calendarCtrl; + var displayDate = calendarCtrl.displayDate; + + if (action === 'select') { + self.changeDate(displayDate).then(function() { + self.onTimestampSelected(displayDate); + }); + } else { + var date = null; + var dateUtil = self.dateUtil; + + switch (action) { + case 'move-right': date = dateUtil.incrementMonths(displayDate, 1); break; + case 'move-left': date = dateUtil.incrementMonths(displayDate, -1); break; + + case 'move-row-down': date = dateUtil.incrementMonths(displayDate, 6); break; + case 'move-row-up': date = dateUtil.incrementMonths(displayDate, -6); break; + } + + if (date) { + var min = calendarCtrl.minDate ? dateUtil.getFirstDateOfMonth(calendarCtrl.minDate) : null; + var max = calendarCtrl.maxDate ? dateUtil.getFirstDateOfMonth(calendarCtrl.maxDate) : null; + date = dateUtil.getFirstDateOfMonth(self.dateUtil.clampDate(date, min, max)); + + self.changeDate(date).then(function() { + calendarCtrl.focusDate(date); + }); + } + } + }; + + /** + * Attaches listeners for the scope events that are broadcast by the calendar. + */ + CalendarYearCtrl.prototype.attachScopeListeners = function() { + var self = this; + + self.$scope.$on('md-calendar-parent-changed', function(event, value) { + self.calendarCtrl.changeSelectedDate(value ? self.dateUtil.getFirstDateOfMonth(value) : value); + self.changeDate(value); + }); + + self.$scope.$on('md-calendar-parent-action', angular.bind(self, self.handleKeyEvent)); + }; + + /** + * Handles the behavior when a date is selected. Depending on the `mode` + * of the calendar, this can either switch back to the calendar view or + * set the model value. + * @param {number} timestamp The selected timestamp. + */ + CalendarYearCtrl.prototype.onTimestampSelected = function(timestamp) { + var calendarCtrl = this.calendarCtrl; + + if (calendarCtrl.mode) { + this.$mdUtil.nextTick(function() { + // The timestamp has to be converted to a valid date. + calendarCtrl.setNgModelValue(new Date(timestamp)); + }); + } else { + calendarCtrl.setCurrentView('month', timestamp); + } + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + CalendarYearBodyCtrl.$inject = ["$element", "$$mdDateUtil", "$mdDateLocale"]; + angular.module('material.components.datepicker') + .directive('mdCalendarYearBody', mdCalendarYearDirective); + + /** + * Private component, consumed by the md-calendar-year, which separates the DOM construction logic + * and allows for the year view to use md-virtual-repeat. + */ + function mdCalendarYearDirective() { + return { + require: ['^^mdCalendar', '^^mdCalendarYear', 'mdCalendarYearBody'], + scope: { offset: '=mdYearOffset' }, + controller: CalendarYearBodyCtrl, + controllerAs: 'mdYearBodyCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var yearCtrl = controllers[1]; + var yearBodyCtrl = controllers[2]; + + yearBodyCtrl.calendarCtrl = calendarCtrl; + yearBodyCtrl.yearCtrl = yearCtrl; + + scope.$watch(function() { return yearBodyCtrl.offset; }, function(offset) { + if (angular.isNumber(offset)) { + yearBodyCtrl.generateContent(); + } + }); + } + }; + } + + /** + * Controller for a single year. + * @ngInject @constructor + */ + function CalendarYearBodyCtrl($element, $$mdDateUtil, $mdDateLocale) { + /** + * @final + * @type {!JQLite} + */ + this.$element = $element; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.dateLocale = $mdDateLocale; + + /** @type {Object} Reference to the calendar. */ + this.calendarCtrl = null; + + /** @type {Object} Reference to the year view. */ + this.yearCtrl = null; + + /** + * Number of months from the start of the month "items" that the currently rendered month + * occurs. Set via angular data binding. + * @type {number|null} + */ + this.offset = null; + + /** + * Date cell to focus after appending the month to the document. + * @type {HTMLElement} + */ + this.focusAfterAppend = null; + } + + /** Generate and append the content for this year to the directive element. */ + CalendarYearBodyCtrl.prototype.generateContent = function() { + var date = this.dateUtil.incrementYears(this.calendarCtrl.firstRenderableDate, this.offset); + + this.$element + .empty() + .append(this.buildCalendarForYear(date)); + + if (this.focusAfterAppend) { + this.focusAfterAppend.classList.add(this.calendarCtrl.FOCUSED_DATE_CLASS); + this.focusAfterAppend = null; + } + }; + + /** + * Creates a single cell to contain a year in the calendar. + * @param {number} year Four-digit year. + * @param {number} month Zero-indexed month. + * @returns {HTMLElement} + */ + CalendarYearBodyCtrl.prototype.buildMonthCell = function(year, month) { + var calendarCtrl = this.calendarCtrl; + var yearCtrl = this.yearCtrl; + var cell = this.buildBlankCell(); + + // Represent this month/year as a date. + var firstOfMonth = new Date(year, month, 1); + cell.setAttribute('aria-label', this.dateLocale.monthFormatter(firstOfMonth)); + cell.id = calendarCtrl.getDateId(firstOfMonth, 'year'); + + // Use `data-timestamp` attribute because IE10 does not support the `dataset` property. + cell.setAttribute('data-timestamp', String(firstOfMonth.getTime())); + + if (this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.today)) { + cell.classList.add(calendarCtrl.TODAY_CLASS); + } + + if (this.dateUtil.isValidDate(calendarCtrl.selectedDate) && + this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.selectedDate)) { + cell.classList.add(calendarCtrl.SELECTED_DATE_CLASS); + cell.setAttribute('aria-selected', 'true'); + } + + var cellText = this.dateLocale.shortMonths[month]; + + if (this.dateUtil.isMonthWithinRange( + firstOfMonth, calendarCtrl.minDate, calendarCtrl.maxDate) && + (!angular.isFunction(calendarCtrl.monthFilter) || + calendarCtrl.monthFilter(firstOfMonth))) { + var selectionIndicator = document.createElement('span'); + selectionIndicator.classList.add('md-calendar-date-selection-indicator'); + selectionIndicator.textContent = cellText; + cell.appendChild(selectionIndicator); + cell.addEventListener('click', yearCtrl.cellClickHandler); + + if (calendarCtrl.displayDate && + this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.displayDate)) { + this.focusAfterAppend = cell; + } + } else { + cell.classList.add('md-calendar-date-disabled'); + cell.textContent = cellText; + } + + return cell; + }; + + /** + * Builds a blank cell. + * @return {HTMLElement} + */ + CalendarYearBodyCtrl.prototype.buildBlankCell = function() { + var cell = document.createElement('td'); + cell.tabIndex = -1; + cell.classList.add('md-calendar-date'); + cell.setAttribute('role', 'gridcell'); + + cell.setAttribute('tabindex', '-1'); + return cell; + }; + + /** + * Builds the content for the given year. + * @param {Date} date Date for which the content should be built. + * @returns {DocumentFragment} A document fragment containing the months within the year. + */ + CalendarYearBodyCtrl.prototype.buildCalendarForYear = function(date) { + // Store rows for the month in a document fragment so that we can append them all at once. + var year = date.getFullYear(); + var yearBody = document.createDocumentFragment(); + + var monthCell, i; + // First row contains label and Jan-Jun. + var firstRow = document.createElement('tr'); + var labelCell = document.createElement('td'); + labelCell.className = 'md-calendar-month-label'; + labelCell.textContent = String(year); + firstRow.appendChild(labelCell); + + for (i = 0; i < 6; i++) { + firstRow.appendChild(this.buildMonthCell(year, i)); + } + yearBody.appendChild(firstRow); + + // Second row contains a blank cell and Jul-Dec. + var secondRow = document.createElement('tr'); + secondRow.appendChild(this.buildBlankCell()); + for (i = 6; i < 12; i++) { + secondRow.appendChild(this.buildMonthCell(year, i)); + } + yearBody.appendChild(secondRow); + + return yearBody; + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdDateLocaleProvider + * @module material.components.datepicker + * + * @description + * The `$mdDateLocaleProvider` is the provider that creates the `$mdDateLocale` service. + * This provider that allows the user to specify messages, formatters, and parsers for date + * internationalization. The `$mdDateLocale` service itself is consumed by AngularJS Material + * components that deal with dates + * (i.e. mdDatepicker). + * + * @property {Array} months Array of month names (in order). + * @property {Array} shortMonths Array of abbreviated month names. + * @property {Array} days Array of the days of the week (in order). + * @property {Array} shortDays Array of abbreviated days of the week. + * @property {Array} dates Array of dates of the month. Only necessary for locales + * using a numeral system other than [1, 2, 3...]. + * @property {Array} firstDayOfWeek The first day of the week. Sunday = 0, Monday = 1, + * etc. + * @property {function(string): Date} parseDate Function that converts a date string to a Date + * object (the date portion). + * @property {function(Date, string): string} formatDate Function to format a date object to a + * string. The datepicker directive also provides the time zone, if it was specified. + * @property {function(Date): string} monthHeaderFormatter Function that returns the label for + * a month given a date. + * @property {function(Date): string} monthFormatter Function that returns the full name of a month + * for a given date. + * @property {function(number): string} weekNumberFormatter Function that returns a label for + * a week given the week number. + * @property {function(Date): string} longDateFormatter Function that formats a date into a long + * `aria-label` that is read by the screen reader when the focused date changes. + * @property {string} msgCalendar Translation of the label "Calendar" for the current locale. + * @property {string} msgOpenCalendar Translation of the button label "Open calendar" for the + * current locale. + * @property {Date} firstRenderableDate The date from which the datepicker calendar will begin + * rendering. Note that this will be ignored if a minimum date is set. + * Defaults to January 1st 1880. + * @property {Date} lastRenderableDate The last date that will be rendered by the datepicker + * calendar. Note that this will be ignored if a maximum date is set. + * Defaults to January 1st 2130. + * @property {function(string): boolean} isDateComplete Function to determine whether a string + * makes sense to be parsed to a `Date` object. Returns `true` if the date appears to be complete + * and parsing should occur. By default, this checks for 3 groups of text or numbers separated + * by delimiters. This means that by default, date strings must include a month, day, and year + * to be parsed and for the model to be updated. + * + * @usage + * + * myAppModule.config(function($mdDateLocaleProvider) { + * + * // Example of a French localization. + * $mdDateLocaleProvider.months = ['janvier', 'février', 'mars', ...]; + * $mdDateLocaleProvider.shortMonths = ['janv', 'févr', 'mars', ...]; + * $mdDateLocaleProvider.days = ['dimanche', 'lundi', 'mardi', ...]; + * $mdDateLocaleProvider.shortDays = ['Di', 'Lu', 'Ma', ...]; + * + * // Can change week display to start on Monday. + * $mdDateLocaleProvider.firstDayOfWeek = 1; + * + * // Optional. + * $mdDateLocaleProvider.dates = [1, 2, 3, 4, 5, 6, ...]; + * + * // Example uses moment.js to parse and format dates. + * $mdDateLocaleProvider.parseDate = function(dateString) { + * var m = moment(dateString, 'L', true); + * return m.isValid() ? m.toDate() : new Date(NaN); + * }; + * + * $mdDateLocaleProvider.formatDate = function(date) { + * var m = moment(date); + * return m.isValid() ? m.format('L') : ''; + * }; + * + * // Allow only a day and month to be specified. + * // This is required if using the 'M/D' format with moment.js. + * $mdDateLocaleProvider.isDateComplete = function(dateString) { + * dateString = dateString.trim(); + * + * // Look for two chunks of content (either numbers or text) separated by delimiters. + * var re = /^(([a-zA-Z]{3,}|[0-9]{1,4})([ .,]+|[/-]))([a-zA-Z]{3,}|[0-9]{1,4})/; + * return re.test(dateString); + * }; + * + * $mdDateLocaleProvider.monthHeaderFormatter = function(date) { + * return myShortMonths[date.getMonth()] + ' ' + date.getFullYear(); + * }; + * + * // In addition to date display, date components also need localized messages + * // for aria-labels for screen-reader users. + * + * $mdDateLocaleProvider.weekNumberFormatter = function(weekNumber) { + * return 'Semaine ' + weekNumber; + * }; + * + * $mdDateLocaleProvider.msgCalendar = 'Calendrier'; + * $mdDateLocaleProvider.msgOpenCalendar = 'Ouvrir le calendrier'; + * + * // You can also set when your calendar begins and ends. + * $mdDateLocaleProvider.firstRenderableDate = new Date(1776, 6, 4); + * $mdDateLocaleProvider.lastRenderableDate = new Date(2012, 11, 21); + * }); + * + * + */ + angular.module('material.components.datepicker').config(["$provide", function($provide) { + // TODO(jelbourn): Assert provided values are correctly formatted. Need assertions. + + /** @constructor */ + function DateLocaleProvider() { + /** Array of full month names. E.g., ['January', 'February', ...] */ + this.months = null; + + /** Array of abbreviated month names. E.g., ['Jan', 'Feb', ...] */ + this.shortMonths = null; + + /** Array of full day of the week names. E.g., ['Monday', 'Tuesday', ...] */ + this.days = null; + + /** Array of abbreviated dat of the week names. E.g., ['M', 'T', ...] */ + this.shortDays = null; + + /** Array of dates of a month (1 - 31). Characters might be different in some locales. */ + this.dates = null; + + /** Index of the first day of the week. 0 = Sunday, 1 = Monday, etc. */ + this.firstDayOfWeek = 0; + + /** + * Function that converts the date portion of a Date to a string. + * @type {(function(Date): string)} + */ + this.formatDate = null; + + /** + * Function that converts a date string to a Date object (the date portion) + * @type {function(string): Date} + */ + this.parseDate = null; + + /** + * Function that formats a Date into a month header string. + * @type {function(Date): string} + */ + this.monthHeaderFormatter = null; + + /** + * Function that formats a week number into a label for the week. + * @type {function(number): string} + */ + this.weekNumberFormatter = null; + + /** + * Function that formats a date into a long aria-label that is read + * when the focused date changes. + * @type {function(Date): string} + */ + this.longDateFormatter = null; + + /** + * Function to determine whether a string makes sense to be + * parsed to a Date object. + * @type {function(string): boolean} + */ + this.isDateComplete = null; + + /** + * ARIA label for the calendar "dialog" used in the datepicker. + * @type {string} + */ + this.msgCalendar = ''; + + /** + * ARIA label for the datepicker's "Open calendar" buttons. + * @type {string} + */ + this.msgOpenCalendar = ''; + } + + /** + * Factory function that returns an instance of the dateLocale service. + * @ngInject + * @param $locale + * @param $filter + * @returns {DateLocale} + */ + DateLocaleProvider.prototype.$get = function($locale, $filter) { + /** + * Default date-to-string formatting function. + * @param {!Date} date + * @param {string=} timezone + * @returns {string} + */ + function defaultFormatDate(date, timezone) { + if (!date) { + return ''; + } + + // All of the dates created through ng-material *should* be set to midnight. + // If we encounter a date where the localeTime shows at 11pm instead of midnight, + // we have run into an issue with DST where we need to increment the hour by one: + // var d = new Date(1992, 9, 8, 0, 0, 0); + // d.toLocaleString(); // == "10/7/1992, 11:00:00 PM" + var localeTime = date.toLocaleTimeString(); + var formatDate = date; + if (date.getHours() === 0 && + (localeTime.indexOf('11:') !== -1 || localeTime.indexOf('23:') !== -1)) { + formatDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 1, 0, 0); + } + + return $filter('date')(formatDate, 'M/d/yyyy', timezone); + } + + /** + * Default string-to-date parsing function. + * @param {string|number} dateString + * @returns {!Date} + */ + function defaultParseDate(dateString) { + return new Date(dateString); + } + + /** + * Default function to determine whether a string makes sense to be + * parsed to a Date object. + * + * This is very permissive and is just a basic check to ensure that + * things like single integers aren't able to be parsed into dates. + * @param {string} dateString + * @returns {boolean} + */ + function defaultIsDateComplete(dateString) { + dateString = dateString.trim(); + + // Looks for three chunks of content (either numbers or text) separated + // by delimiters. + var re = /^(([a-zA-Z]{3,}|[0-9]{1,4})([ .,]+|[/-])){2}([a-zA-Z]{3,}|[0-9]{1,4})$/; + return re.test(dateString); + } + + /** + * Default date-to-string formatter to get a month header. + * @param {!Date} date + * @returns {string} + */ + function defaultMonthHeaderFormatter(date) { + return service.shortMonths[date.getMonth()] + ' ' + date.getFullYear(); + } + + /** + * Default formatter for a month. + * @param {!Date} date + * @returns {string} + */ + function defaultMonthFormatter(date) { + return service.months[date.getMonth()] + ' ' + date.getFullYear(); + } + + /** + * Default week number formatter. + * @param number + * @returns {string} + */ + function defaultWeekNumberFormatter(number) { + return 'Week ' + number; + } + + /** + * Default formatter for date cell aria-labels. + * @param {!Date} date + * @returns {string} + */ + function defaultLongDateFormatter(date) { + // Example: 'Thursday June 18 2015' + return [ + service.days[date.getDay()], + service.months[date.getMonth()], + service.dates[date.getDate()], + date.getFullYear() + ].join(' '); + } + + // The default "short" day strings are the first character of each day, + // e.g., "Monday" => "M". + var defaultShortDays = $locale.DATETIME_FORMATS.SHORTDAY.map(function(day) { + return day.substring(0, 1); + }); + + // The default dates are simply the numbers 1 through 31. + var defaultDates = Array(32); + for (var i = 1; i <= 31; i++) { + defaultDates[i] = i; + } + + // Default ARIA messages are in English (US). + var defaultMsgCalendar = 'Calendar'; + var defaultMsgOpenCalendar = 'Open calendar'; + + // Default start/end dates that are rendered in the calendar. + var defaultFirstRenderableDate = new Date(1880, 0, 1); + var defaultLastRendereableDate = new Date(defaultFirstRenderableDate.getFullYear() + 250, 0, 1); + + var service = { + months: this.months || $locale.DATETIME_FORMATS.MONTH, + shortMonths: this.shortMonths || $locale.DATETIME_FORMATS.SHORTMONTH, + days: this.days || $locale.DATETIME_FORMATS.DAY, + shortDays: this.shortDays || defaultShortDays, + dates: this.dates || defaultDates, + firstDayOfWeek: this.firstDayOfWeek || 0, + formatDate: this.formatDate || defaultFormatDate, + parseDate: this.parseDate || defaultParseDate, + isDateComplete: this.isDateComplete || defaultIsDateComplete, + monthHeaderFormatter: this.monthHeaderFormatter || defaultMonthHeaderFormatter, + monthFormatter: this.monthFormatter || defaultMonthFormatter, + weekNumberFormatter: this.weekNumberFormatter || defaultWeekNumberFormatter, + longDateFormatter: this.longDateFormatter || defaultLongDateFormatter, + msgCalendar: this.msgCalendar || defaultMsgCalendar, + msgOpenCalendar: this.msgOpenCalendar || defaultMsgOpenCalendar, + firstRenderableDate: this.firstRenderableDate || defaultFirstRenderableDate, + lastRenderableDate: this.lastRenderableDate || defaultLastRendereableDate + }; + + return service; + }; + DateLocaleProvider.prototype.$get.$inject = ["$locale", "$filter"]; + + $provide.provider('$mdDateLocale', new DateLocaleProvider()); + }]); +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * Utility for performing date calculations to facilitate operation of the calendar and + * datepicker. + */ + angular.module('material.components.datepicker').factory('$$mdDateUtil', ["$mdDateLocale", function($mdDateLocale) { + return { + getFirstDateOfMonth: getFirstDateOfMonth, + getNumberOfDaysInMonth: getNumberOfDaysInMonth, + getDateInNextMonth: getDateInNextMonth, + getDateInPreviousMonth: getDateInPreviousMonth, + isInNextMonth: isInNextMonth, + isInPreviousMonth: isInPreviousMonth, + getDateMidpoint: getDateMidpoint, + isSameMonthAndYear: isSameMonthAndYear, + getWeekOfMonth: getWeekOfMonth, + incrementDays: incrementDays, + incrementMonths: incrementMonths, + getLastDateOfMonth: getLastDateOfMonth, + isSameDay: isSameDay, + getMonthDistance: getMonthDistance, + isValidDate: isValidDate, + setDateTimeToMidnight: setDateTimeToMidnight, + createDateAtMidnight: createDateAtMidnight, + isDateWithinRange: isDateWithinRange, + incrementYears: incrementYears, + getYearDistance: getYearDistance, + clampDate: clampDate, + getTimestampFromNode: getTimestampFromNode, + isMonthWithinRange: isMonthWithinRange, + removeLocalTzAndReparseDate: removeLocalTzAndReparseDate + }; + + /** + * Gets the first day of the month for the given date's month. + * @param {Date} date + * @returns {Date} + */ + function getFirstDateOfMonth(date) { + return new Date(date.getFullYear(), date.getMonth(), 1); + } + + /** + * Gets the number of days in the month for the given date's month. + * @param date + * @returns {number} + */ + function getNumberOfDaysInMonth(date) { + return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(); + } + + /** + * Get an arbitrary date in the month after the given date's month. + * @param date + * @returns {Date} + */ + function getDateInNextMonth(date) { + return new Date(date.getFullYear(), date.getMonth() + 1, 1); + } + + /** + * Get an arbitrary date in the month before the given date's month. + * @param date + * @returns {Date} + */ + function getDateInPreviousMonth(date) { + return new Date(date.getFullYear(), date.getMonth() - 1, 1); + } + + /** + * Gets whether two dates have the same month and year. + * @param {Date} d1 + * @param {Date} d2 + * @returns {boolean} + */ + function isSameMonthAndYear(d1, d2) { + return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth(); + } + + /** + * Gets whether two dates are the same day (not not necessarily the same time). + * @param {Date} d1 + * @param {Date} d2 + * @returns {boolean} + */ + function isSameDay(d1, d2) { + return d1.getDate() == d2.getDate() && isSameMonthAndYear(d1, d2); + } + + /** + * Gets whether a date is in the month immediately after some date. + * @param {Date} startDate The date from which to compare. + * @param {Date} endDate The date to check. + * @returns {boolean} + */ + function isInNextMonth(startDate, endDate) { + var nextMonth = getDateInNextMonth(startDate); + return isSameMonthAndYear(nextMonth, endDate); + } + + /** + * Gets whether a date is in the month immediately before some date. + * @param {Date} startDate The date from which to compare. + * @param {Date} endDate The date to check. + * @returns {boolean} + */ + function isInPreviousMonth(startDate, endDate) { + var previousMonth = getDateInPreviousMonth(startDate); + return isSameMonthAndYear(endDate, previousMonth); + } + + /** + * Gets the midpoint between two dates. + * @param {Date} d1 + * @param {Date} d2 + * @returns {Date} + */ + function getDateMidpoint(d1, d2) { + return createDateAtMidnight((d1.getTime() + d2.getTime()) / 2); + } + + /** + * Gets the week of the month that a given date occurs in. + * @param {Date} date + * @returns {number} Index of the week of the month (zero-based). + */ + function getWeekOfMonth(date) { + var firstDayOfMonth = getFirstDateOfMonth(date); + return Math.floor((firstDayOfMonth.getDay() + date.getDate() - 1) / 7); + } + + /** + * Gets a new date incremented by the given number of days. Number of days can be negative. + * @param {Date} date + * @param {number} numberOfDays + * @returns {Date} + */ + function incrementDays(date, numberOfDays) { + return new Date(date.getFullYear(), date.getMonth(), date.getDate() + numberOfDays); + } + + /** + * Gets a new date incremented by the given number of months. Number of months can be negative. + * If the date of the given month does not match the target month, the date will be set to the + * last day of the month. + * @param {Date} date + * @param {number} numberOfMonths + * @returns {Date} + */ + function incrementMonths(date, numberOfMonths) { + // If the same date in the target month does not actually exist, the Date object will + // automatically advance *another* month by the number of missing days. + // For example, if you try to go from Jan. 30 to Feb. 30, you'll end up on March 2. + // So, we check if the month overflowed and go to the last day of the target month instead. + var dateInTargetMonth = new Date(date.getFullYear(), date.getMonth() + numberOfMonths, 1); + var numberOfDaysInMonth = getNumberOfDaysInMonth(dateInTargetMonth); + if (numberOfDaysInMonth < date.getDate()) { + dateInTargetMonth.setDate(numberOfDaysInMonth); + } else { + dateInTargetMonth.setDate(date.getDate()); + } + + return dateInTargetMonth; + } + + /** + * Get the integer distance between two months. This *only* considers the month and year + * portion of the Date instances. + * + * @param {Date} start + * @param {Date} end + * @returns {number} Number of months between `start` and `end`. If `end` is before `start` + * chronologically, this number will be negative. + */ + function getMonthDistance(start, end) { + return (12 * (end.getFullYear() - start.getFullYear())) + (end.getMonth() - start.getMonth()); + } + + /** + * Gets the last day of the month for the given date. + * @param {Date} date + * @returns {Date} + */ + function getLastDateOfMonth(date) { + return new Date(date.getFullYear(), date.getMonth(), getNumberOfDaysInMonth(date)); + } + + /** + * Checks whether a date is valid. + * @param {Date} date + * @return {boolean} Whether the date is a valid Date. + */ + function isValidDate(date) { + return date && date.getTime && !isNaN(date.getTime()); + } + + /** + * Sets a date's time to midnight. + * @param {Date} date + */ + function setDateTimeToMidnight(date) { + if (isValidDate(date)) { + date.setHours(0, 0, 0, 0); + } + } + + /** + * Creates a date with the time set to midnight. + * Drop-in replacement for two forms of the Date constructor via opt_value. + * @param {number|Date=} opt_value Leave undefined for a Date representing now. Or use a + * single value representing the number of seconds since the Unix Epoch or a Date object. + * @return {Date} New date with time set to midnight. + */ + function createDateAtMidnight(opt_value) { + var date; + if (angular.isDate(opt_value)) { + date = opt_value; + } else if (angular.isNumber(opt_value)) { + date = new Date(opt_value); + } else { + date = new Date(); + } + setDateTimeToMidnight(date); + return date; + } + + /** + * Checks if a date is within a min and max range, ignoring the time component. + * If minDate or maxDate are not dates, they are ignored. + * @param {Date} date + * @param {Date} minDate + * @param {Date} maxDate + */ + function isDateWithinRange(date, minDate, maxDate) { + var dateAtMidnight = createDateAtMidnight(date); + var minDateAtMidnight = isValidDate(minDate) ? createDateAtMidnight(minDate) : null; + var maxDateAtMidnight = isValidDate(maxDate) ? createDateAtMidnight(maxDate) : null; + return (!minDateAtMidnight || minDateAtMidnight <= dateAtMidnight) && + (!maxDateAtMidnight || maxDateAtMidnight >= dateAtMidnight); + } + + /** + * Gets a new date incremented by the given number of years. Number of years can be negative. + * See `incrementMonths` for notes on overflow for specific dates. + * @param {Date} date + * @param {number} numberOfYears + * @returns {Date} + */ + function incrementYears(date, numberOfYears) { + return incrementMonths(date, numberOfYears * 12); + } + + /** + * Get the integer distance between two years. This *only* considers the year portion of the + * Date instances. + * + * @param {Date} start + * @param {Date} end + * @returns {number} Number of months between `start` and `end`. If `end` is before `start` + * chronologically, this number will be negative. + */ + function getYearDistance(start, end) { + return end.getFullYear() - start.getFullYear(); + } + + /** + * Clamps a date between a minimum and a maximum date. + * @param {Date} date Date to be clamped + * @param {Date=} minDate Minimum date + * @param {Date=} maxDate Maximum date + * @return {Date} + */ + function clampDate(date, minDate, maxDate) { + var boundDate = date; + if (minDate && date < minDate) { + boundDate = new Date(minDate.getTime()); + } + if (maxDate && date > maxDate) { + boundDate = new Date(maxDate.getTime()); + } + return boundDate; + } + + /** + * Extracts and parses the timestamp from a DOM node. + * @param {HTMLElement} node Node from which the timestamp will be extracted. + * @return {number} Time since epoch. + */ + function getTimestampFromNode(node) { + if (node && node.hasAttribute('data-timestamp')) { + return Number(node.getAttribute('data-timestamp')); + } + } + + /** + * Checks if a month is within a min and max range, ignoring the date and time components. + * If minDate or maxDate are not dates, they are ignored. + * @param {Date} date + * @param {Date} minDate + * @param {Date} maxDate + */ + function isMonthWithinRange(date, minDate, maxDate) { + var month = date.getMonth(); + var year = date.getFullYear(); + + return (!minDate || minDate.getFullYear() < year || minDate.getMonth() <= month) && + (!maxDate || maxDate.getFullYear() > year || maxDate.getMonth() >= month); + } + + /** + * @param {Date} value date in local timezone + * @return {Date} date with local timezone offset removed + */ + function removeLocalTzAndReparseDate(value) { + var dateValue, formattedDate; + // Remove the local timezone offset before calling formatDate. + dateValue = new Date(value.getTime() + 60000 * value.getTimezoneOffset()); + formattedDate = $mdDateLocale.formatDate(dateValue); + // parseDate only works with a date formatted by formatDate when using Moment validation. + return $mdDateLocale.parseDate(formattedDate); + } + }]); +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + // TODO(jelbourn): forward more attributes to the internal input (required, autofocus, etc.) + // TODO(jelbourn): something better for mobile (calendar panel takes up entire screen?) + // TODO(jelbourn): input behavior (masking? auto-complete?) + + DatePickerCtrl.$inject = ["$scope", "$element", "$attrs", "$window", "$mdConstant", "$mdTheming", "$mdUtil", "$mdDateLocale", "$$mdDateUtil", "$$rAF", "$filter", "$timeout"]; + datePickerDirective.$inject = ["$$mdSvgRegistry", "$mdUtil", "$mdAria", "inputDirective"]; + angular.module('material.components.datepicker') + .directive('mdDatepicker', datePickerDirective); + + /** + * @ngdoc directive + * @name mdDatepicker + * @module material.components.datepicker + * + * @param {Date} ng-model The component's model. Expects either a JavaScript Date object or a + * value that can be parsed into one (e.g. a ISO 8601 string). + * @param {Object=} ng-model-options Allows tuning of the way in which `ng-model` is being + * updated. Also allows for a timezone to be specified. + * + * Read more at the ngModelOptions docs. + * @param {expression=} ng-change Expression evaluated when the model value changes. + * @param {expression=} ng-focus Expression evaluated when the input is focused or the calendar + * is opened. + * @param {expression=} ng-blur Expression evaluated when focus is removed from the input or the + * calendar is closed. + * @param {boolean=} ng-disabled Whether the datepicker is disabled. + * @param {boolean=} ng-required Whether a value is required for the datepicker. + * @param {Date=} md-min-date Expression representing a min date (inclusive). + * @param {Date=} md-max-date Expression representing a max date (inclusive). + * @param {(function(Date): boolean)=} md-date-filter Function expecting a date and returning a + * boolean whether it can be selected in "day" mode or not. Returning false will also trigger a + * `filtered` model validation error. + * @param {(function(Date): boolean)=} md-month-filter Function expecting a date and returning a + * boolean whether it can be selected in "month" mode or not. Returning false will also trigger a + * `filtered` model validation error. + * @param {string=} md-placeholder The date input placeholder value. + * @param {string=} md-open-on-focus When present, the calendar will be opened when the input + * is focused. + * @param {Boolean=} md-is-open Expression that can be used to open the datepicker's calendar + * on-demand. + * @param {string=} md-current-view Default open view of the calendar pane. Can be either + * "month" or "year". + * @param {string=} md-mode Restricts the user to only selecting a value from a particular view. + * This option can be used if the user is only supposed to choose from a certain date type + * (e.g. only selecting the month). + * Can be either "month" or "day". **Note** that this will overwrite the `md-current-view` value. + * @param {string=} md-hide-icons Determines which datepicker icons should be hidden. Note that + * this may cause the datepicker to not align properly with other components. + * **Use at your own risk.** Possible values are: + * * `"all"` - Hides all icons. + * * `"calendar"` - Only hides the calendar icon. + * * `"triangle"` - Only hides the triangle icon. + * @param {Object=} md-date-locale Allows for the values from the `$mdDateLocaleProvider` to be + * overwritten on a per-element basis (e.g. `msgOpenCalendar` can be overwritten with + * `md-date-locale="{ msgOpenCalendar: 'Open a special calendar' }"`). + * @param {string=} input-aria-describedby A space-separated list of element IDs. This should + * contain the IDs of any elements that describe this datepicker. Screen readers will read the + * content of these elements at the end of announcing that the datepicker has been selected + * and describing its current state. The descriptive elements do not need to be visible on the + * page. + * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use + * case is that this would contain the ID of a `